From: support Date: Mon, 14 Nov 2022 16:17:43 +0000 (+0000) Subject: Built motion from commit 7b026345.|2.6.22 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/www.w3.org/TR/wai-aria-practices?a=commitdiff_plain;h=4901263a8dc94a02d8a63efe2c7a99369877249e;p=motion2.git Built motion from commit 7b026345.|2.6.22 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index d1a6e48..568995e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-14T15:49:50.484Z", + "time": "2022-11-14T16:08:43.510Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 3e177d3..8e04d4b 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-14T15:49:50.484Z", + "time": "2022-11-14T16:08:43.510Z", "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 0b1731a..2b7913e 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 _0x3cbd=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x3775c9,_0x3e9fbc){var _0x76fc90=function(_0x13477e){while(--_0x13477e){_0x3775c9['push'](_0x3775c9['shift']());}};_0x76fc90(++_0x3e9fbc);}(_0x3cbd,0x184));var _0xd3cb=function(_0x46b82b,_0x2231fe){_0x46b82b=_0x46b82b-0x0;var _0x2aa860=_0x3cbd[_0x46b82b];return _0x2aa860;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd3cb('0x0')],'get':function(_0x2ac103){return this[_0xd3cb('0x1')](_0xd3cb('0x2'));}},'action':{'type':Sequelize[_0xd3cb('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xd3cb('0x4'),_0xd3cb('0x5'),'motionbar',_0xd3cb('0x6'),_0xd3cb('0x7'),_0xd3cb('0x8'),_0xd3cb('0x9'),_0xd3cb('0xa')]],'msg':_0xd3cb('0xb')}},'comment':_0xd3cb('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xd3cb('0xc')},'data2':{'type':Sequelize[_0xd3cb('0x3')](0x1000),'comment':_0xd3cb('0xd')},'data3':{'type':Sequelize[_0xd3cb('0x3')](0x1000),'comment':_0xd3cb('0xe')},'data4':{'type':Sequelize[_0xd3cb('0x3')](0x1000),'comments':_0xd3cb('0xf')},'data5':{'type':Sequelize[_0xd3cb('0x3')](0x1000),'comments':_0xd3cb('0x10')},'data6':{'type':Sequelize[_0xd3cb('0x3')],'comments':_0xd3cb('0x11')},'data7':{'type':Sequelize[_0xd3cb('0x12')],'comments':_0xd3cb('0x13')}}; \ No newline at end of file +var _0x0b6b=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','getDataValue','action','STRING','contactManager','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x0b6b,0xdf));var _0xb0b6=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x0b6b[_0x47cfa0];return _0x386b1d;};'use strict';var Sequelize=require(_0xb0b6('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x39cde9){return this[_0xb0b6('0x1')](_0xb0b6('0x2'));}},'action':{'type':Sequelize[_0xb0b6('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb0b6('0x4'),'integration','motionbar',_0xb0b6('0x5'),'urlForward',_0xb0b6('0x6'),_0xb0b6('0x7'),_0xb0b6('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xb0b6('0x9')},'data1':{'type':Sequelize[_0xb0b6('0x3')](0x1000),'comment':_0xb0b6('0xa')},'data2':{'type':Sequelize[_0xb0b6('0x3')](0x1000),'comment':_0xb0b6('0xb')},'data3':{'type':Sequelize[_0xb0b6('0x3')](0x1000),'comment':_0xb0b6('0xc')},'data4':{'type':Sequelize[_0xb0b6('0x3')](0x1000),'comments':_0xb0b6('0xd')},'data5':{'type':Sequelize[_0xb0b6('0x3')](0x1000),'comments':_0xb0b6('0xe')},'data6':{'type':Sequelize[_0xb0b6('0x3')],'comments':_0xb0b6('0xf')},'data7':{'type':Sequelize[_0xb0b6('0x10')],'comments':_0xb0b6('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b633060..9bef570 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 _0xa635=['count','set','apply','update','then','destroy','error','name','send','body','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0xa66d8c,_0xe5aade){var _0x4caf28=function(_0x466662){while(--_0x466662){_0xa66d8c['push'](_0xa66d8c['shift']());}};_0x4caf28(++_0xe5aade);}(_0xa635,0x148));var _0x5a63=function(_0x5c2438,_0x1753c2){_0x5c2438=_0x5c2438-0x0;var _0x75cfae=_0xa635[_0x5c2438];return _0x75cfae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a63('0x0'));var zipdir=require(_0x5a63('0x1'));var jsonpatch=require(_0x5a63('0x2'));var rp=require(_0x5a63('0x3'));var moment=require(_0x5a63('0x4'));var BPromise=require(_0x5a63('0x5'));var Mustache=require(_0x5a63('0x6'));var util=require(_0x5a63('0x7'));var path=require(_0x5a63('0x8'));var sox=require('sox');var csv=require(_0x5a63('0x9'));var ejs=require(_0x5a63('0xa'));var fs=require('fs');var fs_extra=require(_0x5a63('0xb'));var _=require('lodash');var squel=require(_0x5a63('0xc'));var crypto=require(_0x5a63('0xd'));var jsforce=require(_0x5a63('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5a63('0x9'));var querystring=require(_0x5a63('0xf'));var Papa=require(_0x5a63('0x10'));var Redis=require(_0x5a63('0x11'));var authService=require(_0x5a63('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5a63('0x13'));var hardwareService=require(_0x5a63('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5a63('0x15'));var config=require(_0x5a63('0x16'));var licenseUtil=require(_0x5a63('0x17'));var db=require(_0x5a63('0x18'))['db'];function respondWithStatusCode(_0x700aa7,_0x550cdc){_0x550cdc=_0x550cdc||0xcc;return function(_0x4d0037){if(_0x4d0037){return _0x700aa7[_0x5a63('0x19')](_0x550cdc);}return _0x700aa7[_0x5a63('0x1a')](_0x550cdc)[_0x5a63('0x1b')]();};}function respondWithResult(_0x37e783,_0x2324e6){_0x2324e6=_0x2324e6||0xc8;return function(_0x3ebbdc){if(_0x3ebbdc){return _0x37e783['status'](_0x2324e6)[_0x5a63('0x1c')](_0x3ebbdc);}};}function respondWithFilteredResult(_0x165b0f,_0x1e45f0){return function(_0x3b8da4){if(_0x3b8da4){var _0x3668be=typeof _0x1e45f0[_0x5a63('0x1d')]===_0x5a63('0x1e')&&typeof _0x1e45f0[_0x5a63('0x1f')]===_0x5a63('0x1e');var _0x11ef1f=_0x3b8da4[_0x5a63('0x20')];var _0x5c3198=_0x3668be?0x0:_0x1e45f0[_0x5a63('0x1d')];var _0x2cdbfb=_0x3668be?_0x3b8da4[_0x5a63('0x20')]:_0x1e45f0[_0x5a63('0x1d')]+_0x1e45f0[_0x5a63('0x1f')];var _0xe5bd76;if(_0x2cdbfb>=_0x11ef1f){_0x2cdbfb=_0x11ef1f;_0xe5bd76=0xc8;}else{_0xe5bd76=0xce;}_0x165b0f[_0x5a63('0x1a')](_0xe5bd76);return _0x165b0f[_0x5a63('0x21')]('Content-Range',_0x5c3198+'-'+_0x2cdbfb+'/'+_0x11ef1f)[_0x5a63('0x1c')](_0x3b8da4);}return null;};}function patchUpdates(_0x3e63b7){return function(_0x31c9e7){try{jsonpatch[_0x5a63('0x22')](_0x31c9e7,_0x3e63b7,!![]);}catch(_0x14460c){return BPromise['reject'](_0x14460c);}return _0x31c9e7['save']();};}function saveUpdates(_0x2e756b,_0x364cce){return function(_0x158adc){if(_0x158adc){return _0x158adc[_0x5a63('0x23')](_0x2e756b)[_0x5a63('0x24')](function(_0x52d3ad){return _0x52d3ad;});}return null;};}function removeEntity(_0x246d37,_0x37106f){return function(_0x5eec61){if(_0x5eec61){return _0x5eec61[_0x5a63('0x25')]()[_0x5a63('0x24')](function(){_0x246d37[_0x5a63('0x1a')](0xcc)[_0x5a63('0x1b')]();});}};}function handleEntityNotFound(_0x114a56,_0x2e80f7){return function(_0x3e671a){if(!_0x3e671a){_0x114a56[_0x5a63('0x19')](0x194);}return _0x3e671a;};}function handleError(_0x3cfff1,_0x3acc4b){_0x3acc4b=_0x3acc4b||0x1f4;return function(_0x4c569d){logger[_0x5a63('0x26')](_0x4c569d['stack']);if(_0x4c569d[_0x5a63('0x27')]){delete _0x4c569d[_0x5a63('0x27')];}_0x3cfff1[_0x5a63('0x1a')](_0x3acc4b)[_0x5a63('0x28')](_0x4c569d);};}exports[_0x5a63('0x23')]=function(_0xb96b04,_0x2dad6b){if(_0xb96b04[_0x5a63('0x29')]['id']){delete _0xb96b04[_0x5a63('0x29')]['id'];}return db['Action'][_0x5a63('0x2a')]({'where':{'id':_0xb96b04[_0x5a63('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2dad6b,null))[_0x5a63('0x24')](saveUpdates(_0xb96b04[_0x5a63('0x29')],null))['then'](respondWithResult(_0x2dad6b,null))[_0x5a63('0x2c')](handleError(_0x2dad6b,null));};exports[_0x5a63('0x25')]=function(_0x233966,_0x123794){return db['Action'][_0x5a63('0x2a')]({'where':{'id':_0x233966[_0x5a63('0x2b')]['id']}})[_0x5a63('0x24')](handleEntityNotFound(_0x123794,null))[_0x5a63('0x24')](removeEntity(_0x123794,null))[_0x5a63('0x2c')](handleError(_0x123794,null));}; \ No newline at end of file +var _0xa028=['json','undefined','limit','count','Content-Range','apply','save','then','destroy','name','send','update','body','Action','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x800105,_0x28370d){var _0x18a7e0=function(_0x2e3f28){while(--_0x2e3f28){_0x800105['push'](_0x800105['shift']());}};_0x18a7e0(++_0x28370d);}(_0xa028,0x98));var _0x8a02=function(_0x46a4d5,_0x43e654){_0x46a4d5=_0x46a4d5-0x0;var _0x20ae52=_0xa028[_0x46a4d5];return _0x20ae52;};'use strict';var emlformat=require(_0x8a02('0x0'));var rimraf=require(_0x8a02('0x1'));var zipdir=require(_0x8a02('0x2'));var jsonpatch=require(_0x8a02('0x3'));var rp=require(_0x8a02('0x4'));var moment=require(_0x8a02('0x5'));var BPromise=require(_0x8a02('0x6'));var Mustache=require(_0x8a02('0x7'));var util=require(_0x8a02('0x8'));var path=require(_0x8a02('0x9'));var sox=require(_0x8a02('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a02('0xb'));var squel=require(_0x8a02('0xc'));var crypto=require(_0x8a02('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8a02('0xe'));var querystring=require(_0x8a02('0xf'));var Papa=require(_0x8a02('0x10'));var Redis=require(_0x8a02('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8a02('0x12'));var hardwareService=require(_0x8a02('0x13'));var logger=require(_0x8a02('0x14'))(_0x8a02('0x15'));var utils=require('../../config/utils');var config=require(_0x8a02('0x16'));var licenseUtil=require(_0x8a02('0x17'));var db=require(_0x8a02('0x18'))['db'];function respondWithStatusCode(_0x4913b9,_0x1d8094){_0x1d8094=_0x1d8094||0xcc;return function(_0x29a15d){if(_0x29a15d){return _0x4913b9[_0x8a02('0x19')](_0x1d8094);}return _0x4913b9[_0x8a02('0x1a')](_0x1d8094)[_0x8a02('0x1b')]();};}function respondWithResult(_0xcb7a2d,_0x5f59d7){_0x5f59d7=_0x5f59d7||0xc8;return function(_0x2dd0fd){if(_0x2dd0fd){return _0xcb7a2d[_0x8a02('0x1a')](_0x5f59d7)[_0x8a02('0x1c')](_0x2dd0fd);}};}function respondWithFilteredResult(_0x415898,_0x40827d){return function(_0x250145){if(_0x250145){var _0x1cfa37=typeof _0x40827d['offset']===_0x8a02('0x1d')&&typeof _0x40827d[_0x8a02('0x1e')]==='undefined';var _0x3ef007=_0x250145[_0x8a02('0x1f')];var _0x13b031=_0x1cfa37?0x0:_0x40827d['offset'];var _0x301103=_0x1cfa37?_0x250145[_0x8a02('0x1f')]:_0x40827d['offset']+_0x40827d['limit'];var _0x30264b;if(_0x301103>=_0x3ef007){_0x301103=_0x3ef007;_0x30264b=0xc8;}else{_0x30264b=0xce;}_0x415898[_0x8a02('0x1a')](_0x30264b);return _0x415898['set'](_0x8a02('0x20'),_0x13b031+'-'+_0x301103+'/'+_0x3ef007)[_0x8a02('0x1c')](_0x250145);}return null;};}function patchUpdates(_0x4af8bb){return function(_0x4bfa2c){try{jsonpatch[_0x8a02('0x21')](_0x4bfa2c,_0x4af8bb,!![]);}catch(_0x379c7c){return BPromise['reject'](_0x379c7c);}return _0x4bfa2c[_0x8a02('0x22')]();};}function saveUpdates(_0x3332d1,_0x3be87e){return function(_0x222e9f){if(_0x222e9f){return _0x222e9f['update'](_0x3332d1)[_0x8a02('0x23')](function(_0x37f00a){return _0x37f00a;});}return null;};}function removeEntity(_0x43146e,_0x3e6ad0){return function(_0x1b9154){if(_0x1b9154){return _0x1b9154[_0x8a02('0x24')]()[_0x8a02('0x23')](function(){_0x43146e[_0x8a02('0x1a')](0xcc)[_0x8a02('0x1b')]();});}};}function handleEntityNotFound(_0x4dbc9d,_0xb9c5bd){return function(_0x531e47){if(!_0x531e47){_0x4dbc9d[_0x8a02('0x19')](0x194);}return _0x531e47;};}function handleError(_0x200424,_0x323543){_0x323543=_0x323543||0x1f4;return function(_0x3b7cd2){logger['error'](_0x3b7cd2['stack']);if(_0x3b7cd2[_0x8a02('0x25')]){delete _0x3b7cd2[_0x8a02('0x25')];}_0x200424['status'](_0x323543)[_0x8a02('0x26')](_0x3b7cd2);};}exports[_0x8a02('0x27')]=function(_0x58bb6b,_0x5e2d63){if(_0x58bb6b[_0x8a02('0x28')]['id']){delete _0x58bb6b[_0x8a02('0x28')]['id'];}return db[_0x8a02('0x29')][_0x8a02('0x2a')]({'where':{'id':_0x58bb6b['params']['id']}})['then'](handleEntityNotFound(_0x5e2d63,null))[_0x8a02('0x23')](saveUpdates(_0x58bb6b[_0x8a02('0x28')],null))['then'](respondWithResult(_0x5e2d63,null))[_0x8a02('0x2b')](handleError(_0x5e2d63,null));};exports[_0x8a02('0x24')]=function(_0x495094,_0x46cf83){return db[_0x8a02('0x29')][_0x8a02('0x2a')]({'where':{'id':_0x495094[_0x8a02('0x2c')]['id']}})[_0x8a02('0x23')](handleEntityNotFound(_0x46cf83,null))['then'](removeEntity(_0x46cf83,null))[_0x8a02('0x2b')](handleError(_0x46cf83,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9e5cb9e..dc4d402 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 _0xea26=['exports','define','tools_actions','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x33166f,_0x4d5e6e){var _0x3bef19=function(_0x5e2ece){while(--_0x5e2ece){_0x33166f['push'](_0x33166f['shift']());}};_0x3bef19(++_0x4d5e6e);}(_0xea26,0x7c));var _0x6ea2=function(_0x136ff1,_0x3461e1){_0x136ff1=_0x136ff1-0x0;var _0x3e68e0=_0xea26[_0x136ff1];return _0x3e68e0;};'use strict';var _=require(_0x6ea2('0x0'));var util=require(_0x6ea2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6ea2('0x2'));var BPromise=require(_0x6ea2('0x3'));var rp=require(_0x6ea2('0x4'));var fs=require('fs');var path=require(_0x6ea2('0x5'));var rimraf=require(_0x6ea2('0x6'));var config=require(_0x6ea2('0x7'));var attributes=require('./action.attributes');module[_0x6ea2('0x8')]=function(_0x510035,_0x3e8b6e){return _0x510035[_0x6ea2('0x9')]('Action',attributes,{'tableName':_0x6ea2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ffc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Action','tools_actions','util','../../config/logger'];(function(_0x1f83ef,_0x257b1f){var _0x52a3bc=function(_0x4776aa){while(--_0x4776aa){_0x1f83ef['push'](_0x1f83ef['shift']());}};_0x52a3bc(++_0x257b1f);}(_0x3ffc,0x80));var _0xc3ff=function(_0x380016,_0x178dd6){_0x380016=_0x380016-0x0;var _0x5c7ac0=_0x3ffc[_0x380016];return _0x5c7ac0;};'use strict';var _=require('lodash');var util=require(_0xc3ff('0x0'));var logger=require(_0xc3ff('0x1'))(_0xc3ff('0x2'));var moment=require(_0xc3ff('0x3'));var BPromise=require(_0xc3ff('0x4'));var rp=require(_0xc3ff('0x5'));var fs=require('fs');var path=require(_0xc3ff('0x6'));var rimraf=require(_0xc3ff('0x7'));var config=require(_0xc3ff('0x8'));var attributes=require('./action.attributes');module[_0xc3ff('0x9')]=function(_0x2905c9,_0x112932){return _0x2905c9[_0xc3ff('0xa')](_0xc3ff('0xb'),attributes,{'tableName':_0xc3ff('0xc'),'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 37085b9..b14fc41 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 _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(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x814b,0x1a2));var _0xb814=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x814b[_0x35387d];return _0x3aba56;};'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 +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(_0x5f2b52,_0xbe16c6){var _0xb63ca5=function(_0x4a7237){while(--_0x4a7237){_0x5f2b52['push'](_0x5f2b52['shift']());}};_0xb63ca5(++_0xbe16c6);}(_0xe14b,0x93));var _0xbe14=function(_0x510970,_0x914eed){_0x510970=_0x510970-0x0;var _0x390831=_0xe14b[_0x510970];return _0x390831;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 0712027..e3efa8d 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 _0xce4a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','path','express'];(function(_0x51bfa7,_0x51c8e0){var _0x1cf7ae=function(_0x5e5625){while(--_0x5e5625){_0x51bfa7['push'](_0x51bfa7['shift']());}};_0x1cf7ae(++_0x51c8e0);}(_0xce4a,0x1a1));var _0xace4=function(_0x1dc6c4,_0x13399a){_0x1dc6c4=_0x1dc6c4-0x0;var _0x521068=_0xce4a[_0x1dc6c4];return _0x521068;};'use strict';var multer=require(_0xace4('0x0'));var util=require('util');var path=require(_0xace4('0x1'));var timeout=require('connect-timeout');var express=require(_0xace4('0x2'));var router=express[_0xace4('0x3')]();var fs_extra=require(_0xace4('0x4'));var auth=require(_0xace4('0x5'));var interaction=require(_0xace4('0x6'));var config=require(_0xace4('0x7'));var controller=require('./action.controller');router[_0xace4('0x8')](_0xace4('0x9'),auth['isAuthenticated'](),controller[_0xace4('0xa')]);router[_0xace4('0xb')]('/:id',auth[_0xace4('0xc')](),controller[_0xace4('0xd')]);module[_0xace4('0xe')]=router; \ No newline at end of file +var _0x0083=['../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra'];(function(_0x43e00a,_0x2712e7){var _0x56f729=function(_0x40301b){while(--_0x40301b){_0x43e00a['push'](_0x43e00a['shift']());}};_0x56f729(++_0x2712e7);}(_0x0083,0xe6));var _0x3008=function(_0x44f3c0,_0x1d7c35){_0x44f3c0=_0x44f3c0-0x0;var _0x4cae07=_0x0083[_0x44f3c0];return _0x4cae07;};'use strict';var multer=require(_0x3008('0x0'));var util=require('util');var path=require(_0x3008('0x1'));var timeout=require(_0x3008('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3008('0x3'));var auth=require(_0x3008('0x4'));var interaction=require(_0x3008('0x5'));var config=require('../../config/environment');var controller=require(_0x3008('0x6'));router['put'](_0x3008('0x7'),auth[_0x3008('0x8')](),controller[_0x3008('0x9')]);router[_0x3008('0xa')](_0x3008('0x7'),auth[_0x3008('0x8')](),controller[_0x3008('0xb')]);module[_0x3008('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2835370..2fda148 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 _0x7fbe=['STRING','TEXT'];(function(_0x557404,_0x1f162){var _0x2fdec8=function(_0x3f4ef2){while(--_0x3f4ef2){_0x557404['push'](_0x557404['shift']());}};_0x2fdec8(++_0x1f162);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x13e9d4,_0x25483d){_0x13e9d4=_0x13e9d4-0x0;var _0x2c62b8=_0x7fbe[_0x13e9d4];return _0x2c62b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +var _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x400faf,_0x294d75){_0x400faf=_0x400faf-0x0;var _0x48adeb=_0x8ef6[_0x400faf];return _0x48adeb;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ee8c8d6..bc9951b 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 _0x7e74=['csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','SELECT','run','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ValidationErrorItem','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','apply','then','get','UserProfileResource','destroy','end','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','rows','show','params','length','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','table','MetricId','function','format','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','MIN(%s)','IS\x20NULL','IS\x20NOT\x20NULL','getFields','from','metric','replace','groupBy','output','web','fullPath','%s-%s.%s','randomstring','generate'];(function(_0x585d37,_0x39b97b){var _0xb22c02=function(_0x38c284){while(--_0x38c284){_0x585d37['push'](_0x585d37['shift']());}};_0xb22c02(++_0x39b97b);}(_0x7e74,0xbd));var _0x47e7=function(_0x21143f,_0x3df19b){_0x21143f=_0x21143f-0x0;var _0x497168=_0x7e74[_0x21143f];return _0x497168;};'use strict';var emlformat=require(_0x47e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47e7('0x1'));var jsonpatch=require(_0x47e7('0x2'));var rp=require(_0x47e7('0x3'));var moment=require(_0x47e7('0x4'));var BPromise=require(_0x47e7('0x5'));var Mustache=require('mustache');var util=require(_0x47e7('0x6'));var path=require(_0x47e7('0x7'));var sox=require(_0x47e7('0x8'));var csv=require(_0x47e7('0x9'));var ejs=require(_0x47e7('0xa'));var fs=require('fs');var fs_extra=require(_0x47e7('0xb'));var _=require(_0x47e7('0xc'));var squel=require('squel');var crypto=require(_0x47e7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x47e7('0xe'));var toCsv=require(_0x47e7('0x9'));var querystring=require(_0x47e7('0xf'));var Papa=require(_0x47e7('0x10'));var Redis=require(_0x47e7('0x11'));var authService=require(_0x47e7('0x12'));var qs=require(_0x47e7('0x13'));var as=require(_0x47e7('0x14'));var hardwareService=require(_0x47e7('0x15'));var logger=require(_0x47e7('0x16'))(_0x47e7('0x17'));var utils=require(_0x47e7('0x18'));var config=require(_0x47e7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x47e7('0x1a'))['db'];var dbH=require(_0x47e7('0x1a'))[_0x47e7('0x1b')];function respondWithStatusCode(_0x534717,_0x44d1e4){_0x44d1e4=_0x44d1e4||0xcc;return function(_0x12df32){if(_0x12df32){return _0x534717[_0x47e7('0x1c')](_0x44d1e4);}return _0x534717[_0x47e7('0x1d')](_0x44d1e4)['end']();};}function respondWithResult(_0x21efb6,_0x149182){_0x149182=_0x149182||0xc8;return function(_0x22c861){if(_0x22c861){return _0x21efb6[_0x47e7('0x1d')](_0x149182)[_0x47e7('0x1e')](_0x22c861);}};}function respondWithFilteredResult(_0x5369d4,_0x2e2aeb){return function(_0x5d4801){if(_0x5d4801){var _0x402ccc=typeof _0x2e2aeb[_0x47e7('0x1f')]===_0x47e7('0x20')&&typeof _0x2e2aeb[_0x47e7('0x21')]===_0x47e7('0x20');var _0x4429e6=_0x5d4801[_0x47e7('0x22')];var _0x42d837=_0x402ccc?0x0:_0x2e2aeb[_0x47e7('0x1f')];var _0x37d436=_0x402ccc?_0x5d4801[_0x47e7('0x22')]:_0x2e2aeb[_0x47e7('0x1f')]+_0x2e2aeb[_0x47e7('0x21')];var _0x32e00e;if(_0x37d436>=_0x4429e6){_0x37d436=_0x4429e6;_0x32e00e=0xc8;}else{_0x32e00e=0xce;}_0x5369d4['status'](_0x32e00e);return _0x5369d4['set']('Content-Range',_0x42d837+'-'+_0x37d436+'/'+_0x4429e6)['json'](_0x5d4801);}return null;};}function patchUpdates(_0xf3e7d8){return function(_0x3484cf){try{jsonpatch[_0x47e7('0x23')](_0x3484cf,_0xf3e7d8,!![]);}catch(_0x42e3ba){return BPromise['reject'](_0x42e3ba);}return _0x3484cf['save']();};}function saveUpdates(_0x2372f0,_0x4d6505){return function(_0x3df9f3){if(_0x3df9f3){return _0x3df9f3['update'](_0x2372f0)[_0x47e7('0x24')](function(_0x8e7237){return _0x8e7237;});}return null;};}function removeEntity(_0x233f8d,_0x2ce873){return function(_0x55146e){if(_0x55146e){return _0x55146e['destroy']()[_0x47e7('0x24')](function(){var _0x25c0ca=_0x55146e[_0x47e7('0x25')]({'plain':!![]});var _0x28843b='CustomReports';return db[_0x47e7('0x26')][_0x47e7('0x27')]({'where':{'type':_0x28843b,'resourceId':_0x25c0ca['id']}})[_0x47e7('0x24')](function(){return _0x55146e;});})[_0x47e7('0x24')](function(){_0x233f8d['status'](0xcc)[_0x47e7('0x28')]();});}};}function handleEntityNotFound(_0x1bdb4c,_0x301a68){return function(_0x459a59){if(!_0x459a59){_0x1bdb4c[_0x47e7('0x1c')](0x194);}return _0x459a59;};}function handleError(_0x303ff6,_0x150c8b){_0x150c8b=_0x150c8b||0x1f4;return function(_0x55866e){logger[_0x47e7('0x29')](_0x55866e[_0x47e7('0x2a')]);if(_0x55866e[_0x47e7('0x2b')]){delete _0x55866e[_0x47e7('0x2b')];}_0x303ff6[_0x47e7('0x1d')](_0x150c8b)[_0x47e7('0x2c')](_0x55866e);};}exports['index']=function(_0x2bc66d,_0x193a9a){var _0x4078bd={},_0x2f8f2d={},_0x2fc425={'count':0x0,'rows':[]};var _0x5a8484=_[_0x47e7('0x2d')](db[_0x47e7('0x2e')][_0x47e7('0x2f')],function(_0x117bec){return{'name':_0x117bec[_0x47e7('0x30')],'type':_0x117bec[_0x47e7('0x31')][_0x47e7('0x32')]};});_0x2f8f2d['model']=_['map'](_0x5a8484,_0x47e7('0x2b'));_0x2f8f2d['query']=_[_0x47e7('0x33')](_0x2bc66d[_0x47e7('0x34')]);_0x2f8f2d['filters']=_[_0x47e7('0x35')](_0x2f8f2d[_0x47e7('0x36')],_0x2f8f2d[_0x47e7('0x34')]);_0x4078bd['attributes']=_['intersection'](_0x2f8f2d[_0x47e7('0x36')],qs[_0x47e7('0x37')](_0x2bc66d['query'][_0x47e7('0x37')]));_0x4078bd[_0x47e7('0x38')]=_0x4078bd[_0x47e7('0x38')]['length']?_0x4078bd[_0x47e7('0x38')]:_0x2f8f2d['model'];if(!_0x2bc66d[_0x47e7('0x34')][_0x47e7('0x39')](_0x47e7('0x3a'))){_0x4078bd['limit']=qs[_0x47e7('0x21')](_0x2bc66d[_0x47e7('0x34')][_0x47e7('0x21')]);_0x4078bd[_0x47e7('0x1f')]=qs[_0x47e7('0x1f')](_0x2bc66d[_0x47e7('0x34')]['offset']);}_0x4078bd['order']=qs[_0x47e7('0x3b')](_0x2bc66d['query'][_0x47e7('0x3b')]);_0x4078bd[_0x47e7('0x3c')]=qs[_0x47e7('0x3d')](_[_0x47e7('0x3e')](_0x2bc66d[_0x47e7('0x34')],_0x2f8f2d[_0x47e7('0x3d')]),_0x5a8484);if(_0x2bc66d[_0x47e7('0x34')][_0x47e7('0x3f')]){_0x4078bd[_0x47e7('0x3c')]=_[_0x47e7('0x40')](_0x4078bd['where'],{'$or':_[_0x47e7('0x2d')](_0x5a8484,function(_0x55c02d){if(_0x55c02d['type']!=='VIRTUAL'){var _0x6ad8f={};_0x6ad8f[_0x55c02d[_0x47e7('0x2b')]]={'$like':'%'+_0x2bc66d['query'][_0x47e7('0x3f')]+'%'};return _0x6ad8f;}})});}_0x4078bd=_[_0x47e7('0x40')]({},_0x4078bd,_0x2bc66d[_0x47e7('0x41')]);var _0x1fec36={'where':_0x4078bd[_0x47e7('0x3c')]};return db['AnalyticCustomReport'][_0x47e7('0x22')](_0x1fec36)['then'](function(_0x46559a){_0x2fc425[_0x47e7('0x22')]=_0x46559a;if(_0x2bc66d[_0x47e7('0x34')]['includeAll']){_0x4078bd[_0x47e7('0x42')]=[{'all':!![]}];}return db[_0x47e7('0x2e')]['findAll'](_0x4078bd);})['then'](function(_0x2b241c){_0x2fc425[_0x47e7('0x43')]=_0x2b241c;return _0x2fc425;})[_0x47e7('0x24')](respondWithFilteredResult(_0x193a9a,_0x4078bd))['catch'](handleError(_0x193a9a,null));};exports[_0x47e7('0x44')]=function(_0x3c1f2c,_0x45a096){var _0x93526e={'raw':![],'where':{'id':_0x3c1f2c[_0x47e7('0x45')]['id']}},_0x7aa148={};_0x7aa148[_0x47e7('0x36')]=_[_0x47e7('0x33')](db[_0x47e7('0x2e')][_0x47e7('0x2f')]);_0x7aa148[_0x47e7('0x34')]=_['keys'](_0x3c1f2c[_0x47e7('0x34')]);_0x7aa148['filters']=_[_0x47e7('0x35')](_0x7aa148['model'],_0x7aa148[_0x47e7('0x34')]);_0x93526e['attributes']=_['intersection'](_0x7aa148[_0x47e7('0x36')],qs[_0x47e7('0x37')](_0x3c1f2c['query'][_0x47e7('0x37')]));_0x93526e[_0x47e7('0x38')]=_0x93526e[_0x47e7('0x38')][_0x47e7('0x46')]?_0x93526e[_0x47e7('0x38')]:_0x7aa148[_0x47e7('0x36')];if(_0x3c1f2c[_0x47e7('0x34')][_0x47e7('0x47')]){_0x93526e[_0x47e7('0x42')]=[{'all':!![]}];}_0x93526e=_['merge']({},_0x93526e,_0x3c1f2c[_0x47e7('0x41')]);return db['AnalyticCustomReport']['find'](_0x93526e)[_0x47e7('0x24')](handleEntityNotFound(_0x45a096,null))[_0x47e7('0x24')](respondWithResult(_0x45a096,null))[_0x47e7('0x48')](handleError(_0x45a096,null));};exports[_0x47e7('0x49')]=function(_0x5d4b8f,_0x59cc9a){return db[_0x47e7('0x2e')][_0x47e7('0x49')](_0x5d4b8f[_0x47e7('0x4a')],{})[_0x47e7('0x24')](function(_0x5d0ad6){var _0x926bc4=_0x5d4b8f['user']['get']({'plain':!![]});if(!_0x926bc4)throw new Error(_0x47e7('0x4b'));if(_0x926bc4['role']===_0x47e7('0x4c')){var _0x270b90=_0x5d0ad6[_0x47e7('0x25')]({'plain':!![]});var _0x44f0f4=_0x47e7('0x4d');return db[_0x47e7('0x4e')][_0x47e7('0x4f')]({'where':{'name':_0x44f0f4,'userProfileId':_0x926bc4[_0x47e7('0x50')]},'raw':!![]})[_0x47e7('0x24')](function(_0x16b8ce){if(_0x16b8ce&&_0x16b8ce[_0x47e7('0x51')]===0x0){return db[_0x47e7('0x26')]['create']({'name':_0x270b90[_0x47e7('0x2b')],'resourceId':_0x270b90['id'],'type':'CustomReports','sectionId':_0x16b8ce['id']},{})[_0x47e7('0x24')](function(){return _0x5d0ad6;});}else{return _0x5d0ad6;}})[_0x47e7('0x48')](function(_0x1fed17){logger[_0x47e7('0x29')](_0x47e7('0x52'),_0x1fed17);throw _0x1fed17;});}return _0x5d0ad6;})[_0x47e7('0x24')](respondWithResult(_0x59cc9a,0xc9))[_0x47e7('0x48')](handleError(_0x59cc9a,null));};exports[_0x47e7('0x53')]=function(_0x1753a6,_0xb021f3){if(_0x1753a6[_0x47e7('0x4a')]['id']){delete _0x1753a6[_0x47e7('0x4a')]['id'];}return db[_0x47e7('0x2e')][_0x47e7('0x4f')]({'where':{'id':_0x1753a6[_0x47e7('0x45')]['id']}})['then'](handleEntityNotFound(_0xb021f3,null))['then'](saveUpdates(_0x1753a6[_0x47e7('0x4a')],null))[_0x47e7('0x24')](respondWithResult(_0xb021f3,null))['catch'](handleError(_0xb021f3,null));};exports[_0x47e7('0x27')]=function(_0x42dac7,_0x1ab7db){return db['AnalyticCustomReport'][_0x47e7('0x4f')]({'where':{'id':_0x42dac7['params']['id']}})[_0x47e7('0x24')](handleEntityNotFound(_0x1ab7db,null))[_0x47e7('0x24')](removeEntity(_0x1ab7db,null))['catch'](handleError(_0x1ab7db,null));};exports[_0x47e7('0x54')]=function(_0x2c3d61,_0x3f86c8){var _0x35468e=0xa;var _0x2e06e8=[_0x47e7('0x55'),_0x47e7('0x56'),'right_join',_0x47e7('0x57')];var _0x12868c={'SUM':_0x47e7('0x58'),'COUNT':_0x47e7('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x47e7('0x5a'),'MIN':'MIN(%s)','AVG':_0x47e7('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47e7('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x192f8f={'SEC_TO_TIME':_0x47e7('0x5d'),'DATE':_0x47e7('0x5e'),'HOUR':_0x47e7('0x5f'),'ROUND':_0x47e7('0x60'),'UNIX_TIMESTAMP':_0x47e7('0x61')};var _0x339b15=function(_0x38c9e6){return!_[_0x47e7('0x62')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47e7('0x63'),_0x47e7('0x64')],_0x38c9e6);};var _0x48b252=function(_0x10865){if(!_0x10865||!_0x10865[_0x47e7('0x65')][_0x47e7('0x46')]){return'';}for(var _0x3ae349='(',_0x5b27c1=0x0;_0x5b27c1<_0x10865[_0x47e7('0x65')][_0x47e7('0x46')];_0x5b27c1+=0x1){_0x5b27c1>0x0&&(_0x3ae349+='\x20'+_0x10865[_0x47e7('0x66')]+'\x20');_0x3ae349+=_0x10865[_0x47e7('0x65')][_0x5b27c1][_0x47e7('0x67')]?_0x48b252(_0x10865[_0x47e7('0x65')][_0x5b27c1][_0x47e7('0x67')]):_0x10865[_0x47e7('0x65')][_0x5b27c1][_0x47e7('0x68')]+'\x20'+_0x10865['rules'][_0x5b27c1][_0x47e7('0x69')]+(_0x339b15(_0x10865[_0x47e7('0x65')][_0x5b27c1][_0x47e7('0x69')])?'\x20'+_0x10865['rules'][_0x5b27c1][_0x47e7('0x6a')]:'');}return _0x3ae349+')';};var _0x244dc8={'where':{'id':_0x2c3d61[_0x47e7('0x45')]['id']}},_0x5e52a7,_0x52de0c,_0x454562,_0x278496,_0x3e1a4c;_0x244dc8=_[_0x47e7('0x40')]({},_0x244dc8,_0x2c3d61[_0x47e7('0x41')]);return db['AnalyticCustomReport']['find'](_0x244dc8)[_0x47e7('0x24')](function(_0x41fb01){if(_0x41fb01){_0x5e52a7=_0x41fb01;return _0x41fb01['getFields']();}return null;})['then'](function(_0x10a8a8){if(_0x10a8a8){if(!_0x10a8a8[_0x47e7('0x46')]){throw new db[(_0x47e7('0x6b'))]['ValidationErrorItem'](_0x47e7('0x6c'),0x193);}_0x52de0c=_0x10a8a8;return db[_0x47e7('0x6d')][_0x47e7('0x6e')]({'raw':!![]});}return null;})['then'](function(_0x1b9cf4){if(_0x1b9cf4){_0x454562=_[_0x47e7('0x6f')](_0x1b9cf4,'id');var _0x2f5796;var _0x1096fb=squel[_0x47e7('0x70')]();_0x1096fb['from'](_0x5e52a7[_0x47e7('0x71')]);for(var _0x53d1c6=0x0;_0x53d1c6<_0x52de0c[_0x47e7('0x46')];_0x53d1c6+=0x1){_0x2f5796=_0x52de0c[_0x53d1c6][_0x47e7('0x72')]?_0x454562[_0x52de0c[_0x53d1c6][_0x47e7('0x72')]]['metric']:_0x52de0c[_0x53d1c6]['field'];_0x2f5796=_0x52de0c[_0x53d1c6][_0x47e7('0x73')]?_['replace'](_0x12868c[_0x52de0c[_0x53d1c6]['function']],'%s',_0x2f5796):_0x2f5796;_0x2f5796=_0x52de0c[_0x53d1c6]['format']?_['replace'](_0x192f8f[_0x52de0c[_0x53d1c6][_0x47e7('0x74')]],'%s',_0x2f5796):_0x2f5796;if(_0x52de0c[_0x53d1c6]['groupBy']){_0x1096fb['group'](_0x2f5796);}_0x52de0c[_0x53d1c6][_0x47e7('0x75')]&&_0x1096fb[_0x47e7('0x76')](_0x2f5796,_0x52de0c[_0x53d1c6][_0x47e7('0x75')]===_0x47e7('0x77')?![]:!![]);_0x1096fb[_0x47e7('0x68')](_0x2f5796,_0x52de0c[_0x53d1c6][_0x47e7('0x78')]||_0x2f5796);}if(_0x5e52a7[_0x47e7('0x79')]){_0x5e52a7[_0x47e7('0x79')]=JSON[_0x47e7('0x7a')](_0x5e52a7[_0x47e7('0x79')]);for(var _0xcde073=0x0;_0xcde073<_0x5e52a7['joins'][_0x47e7('0x46')];_0xcde073+=0x1){if(_0x5e52a7[_0x47e7('0x79')][_0xcde073][_0x47e7('0x31')]&&_[_0x47e7('0x62')](_0x2e06e8,_0x5e52a7[_0x47e7('0x79')][_0xcde073][_0x47e7('0x31')])&&_0x5e52a7['joins'][_0xcde073][_0x47e7('0x7b')]&&_0x5e52a7[_0x47e7('0x79')][_0xcde073]['foreignTable']&&_0x5e52a7[_0x47e7('0x79')][_0xcde073]['foreignKey']){_0x1096fb[_0x5e52a7[_0x47e7('0x79')][_0xcde073][_0x47e7('0x31')]](_0x5e52a7[_0x47e7('0x79')][_0xcde073][_0x47e7('0x7c')],null,util['format'](_0x47e7('0x7d'),_0x5e52a7[_0x47e7('0x71')],_0x5e52a7[_0x47e7('0x79')][_0xcde073]['parentKey'],_0x5e52a7['joins'][_0xcde073][_0x47e7('0x7c')],_0x5e52a7['joins'][_0xcde073][_0x47e7('0x7e')]));}}}if(_0x5e52a7[_0x47e7('0x7f')]){_0x5e52a7[_0x47e7('0x7f')]=JSON[_0x47e7('0x7a')](_0x5e52a7['conditions']);_0x1096fb[_0x47e7('0x3c')](_0x48b252(_0x5e52a7[_0x47e7('0x7f')][_0x47e7('0x67')]));}_0x3e1a4c=_0x1096fb[_0x47e7('0x80')]();_0x1096fb[_0x47e7('0x21')](_0x35468e);_0x1096fb[_0x47e7('0x1f')](0x0);logger[_0x47e7('0x81')](_0x47e7('0x82'),_0x1096fb['toString']());return dbH[_0x47e7('0x83')][_0x47e7('0x34')](_0x1096fb[_0x47e7('0x84')](),{'type':dbH[_0x47e7('0x83')][_0x47e7('0x85')]['SELECT']});}})['then'](respondWithResult(_0x3f86c8,null))[_0x47e7('0x48')](handleError(_0x3f86c8,null));};function runReport(_0x4916e1,_0x1ceed6,_0x454d8c){var _0x540330=_0x1ceed6['name'];var _0x496594=0xa;var _0x2451aa=['join',_0x47e7('0x56'),_0x47e7('0x86'),_0x47e7('0x57')];var _0x3dc848={'SUM':_0x47e7('0x58'),'COUNT':_0x47e7('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x47e7('0x5a'),'MIN':_0x47e7('0x87'),'AVG':_0x47e7('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47e7('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5a0606={'SEC_TO_TIME':_0x47e7('0x5d'),'DATE':_0x47e7('0x5e'),'HOUR':_0x47e7('0x5f'),'ROUND':_0x47e7('0x60'),'UNIX_TIMESTAMP':_0x47e7('0x61')};var _0x3d9f17=function(_0xf47468){return!_['includes']([_0x47e7('0x88'),_0x47e7('0x89'),'IS\x20EMPTY',_0x47e7('0x64')],_0xf47468);};var _0xfb4a67=function(_0x4c8095){if(!_0x4c8095||!_0x4c8095[_0x47e7('0x65')]['length']){return'';}for(var _0x3135f3='(',_0x5d8067=0x0;_0x5d8067<_0x4c8095[_0x47e7('0x65')]['length'];_0x5d8067+=0x1){_0x5d8067>0x0&&(_0x3135f3+='\x20'+_0x4c8095[_0x47e7('0x66')]+'\x20');_0x3135f3+=_0x4c8095[_0x47e7('0x65')][_0x5d8067][_0x47e7('0x67')]?_0xfb4a67(_0x4c8095[_0x47e7('0x65')][_0x5d8067][_0x47e7('0x67')]):_0x4c8095[_0x47e7('0x65')][_0x5d8067][_0x47e7('0x68')]+'\x20'+_0x4c8095[_0x47e7('0x65')][_0x5d8067][_0x47e7('0x69')]+(_0x3d9f17(_0x4c8095[_0x47e7('0x65')][_0x5d8067][_0x47e7('0x69')])?'\x20'+_0x4c8095[_0x47e7('0x65')][_0x5d8067][_0x47e7('0x6a')]:'');}return _0x3135f3+')';};var _0x4cad0c={'where':{'id':_0x4916e1['id']}},_0x58b318,_0x11dfa3,_0xd25b68,_0x124da6,_0x570602;_0x4cad0c=_[_0x47e7('0x40')]({},_0x4cad0c,_0x454d8c);return db['AnalyticCustomReport']['find'](_0x4cad0c)['then'](function(_0x50f603){if(_0x50f603){_0x58b318=_0x50f603;return _0x50f603[_0x47e7('0x8a')]();}return null;})['then'](function(_0x55284e){if(_0x55284e){if(!_0x55284e[_0x47e7('0x46')]){throw new db[(_0x47e7('0x6b'))]['ValidationErrorItem'](_0x47e7('0x6c'),0x193);}_0x11dfa3=_0x55284e;return db[_0x47e7('0x6d')][_0x47e7('0x6e')]({'raw':!![]});}return null;})[_0x47e7('0x24')](function(_0x12e242){if(_0x12e242){_0xd25b68=_['keyBy'](_0x12e242,'id');var _0x48f546;var _0x205142=squel[_0x47e7('0x70')]();_0x205142[_0x47e7('0x8b')](_0x58b318['table']);for(var _0x423f9a=0x0;_0x423f9a<_0x11dfa3[_0x47e7('0x46')];_0x423f9a+=0x1){_0x48f546=_0x11dfa3[_0x423f9a][_0x47e7('0x72')]?_0xd25b68[_0x11dfa3[_0x423f9a][_0x47e7('0x72')]][_0x47e7('0x8c')]:_0x11dfa3[_0x423f9a][_0x47e7('0x68')];_0x48f546=_0x11dfa3[_0x423f9a][_0x47e7('0x73')]?_[_0x47e7('0x8d')](_0x3dc848[_0x11dfa3[_0x423f9a][_0x47e7('0x73')]],'%s',_0x48f546):_0x48f546;_0x48f546=_0x11dfa3[_0x423f9a]['format']?_[_0x47e7('0x8d')](_0x5a0606[_0x11dfa3[_0x423f9a][_0x47e7('0x74')]],'%s',_0x48f546):_0x48f546;if(_0x11dfa3[_0x423f9a][_0x47e7('0x8e')]){_0x205142[_0x47e7('0x67')](_0x48f546);}_0x11dfa3[_0x423f9a][_0x47e7('0x75')]&&_0x205142['order'](_0x48f546,_0x11dfa3[_0x423f9a][_0x47e7('0x75')]==='DESC'?![]:!![]);_0x205142[_0x47e7('0x68')](_0x48f546,_0x11dfa3[_0x423f9a][_0x47e7('0x78')]||_0x48f546);}if(_0x58b318[_0x47e7('0x79')]){_0x58b318['joins']=JSON[_0x47e7('0x7a')](_0x58b318[_0x47e7('0x79')]);for(var _0x89acb3=0x0;_0x89acb3<_0x58b318[_0x47e7('0x79')][_0x47e7('0x46')];_0x89acb3+=0x1){if(_0x58b318[_0x47e7('0x79')][_0x89acb3]['type']&&_[_0x47e7('0x62')](_0x2451aa,_0x58b318[_0x47e7('0x79')][_0x89acb3][_0x47e7('0x31')])&&_0x58b318[_0x47e7('0x79')][_0x89acb3]['parentKey']&&_0x58b318[_0x47e7('0x79')][_0x89acb3][_0x47e7('0x7c')]&&_0x58b318['joins'][_0x89acb3][_0x47e7('0x7e')]){_0x205142[_0x58b318['joins'][_0x89acb3][_0x47e7('0x31')]](_0x58b318[_0x47e7('0x79')][_0x89acb3][_0x47e7('0x7c')],null,util[_0x47e7('0x74')]('%s.%s\x20=\x20%s.%s',_0x58b318[_0x47e7('0x71')],_0x58b318['joins'][_0x89acb3][_0x47e7('0x7b')],_0x58b318[_0x47e7('0x79')][_0x89acb3][_0x47e7('0x7c')],_0x58b318['joins'][_0x89acb3][_0x47e7('0x7e')]));}}}if(_0x58b318['conditions']){_0x58b318[_0x47e7('0x7f')]=JSON[_0x47e7('0x7a')](_0x58b318[_0x47e7('0x7f')]);_0x205142['where'](_0xfb4a67(_0x58b318[_0x47e7('0x7f')][_0x47e7('0x67')]));}_0x570602=_0x205142[_0x47e7('0x80')]();_0x205142[_0x47e7('0x21')](_0x496594);_0x205142['offset'](0x0);return;}})[_0x47e7('0x24')](function(){if(_0x1ceed6[_0x47e7('0x8f')]===_0x47e7('0x90')){return null;}var _0x246da1=_[_0x47e7('0x40')](_0x1ceed6,{'name':_0x1ceed6[_0x47e7('0x91')]||_0x1ceed6[_0x47e7('0x2b')]||_0x58b318[_0x47e7('0x2b')],'basename':_0x540330,'savename':util[_0x47e7('0x74')](_0x47e7('0x92'),_0x1ceed6[_0x47e7('0x2b')]||_0x58b318['name'],require(_0x47e7('0x93'))[_0x47e7('0x94')](0x4),_0x1ceed6[_0x47e7('0x8f')]||_0x47e7('0x95')),'reportId':_0x58b318['id'],'reportType':_0x47e7('0x96')});return db[_0x47e7('0x97')][_0x47e7('0x49')](_0x246da1,{'raw':!![]});})[_0x47e7('0x24')](function(_0x57cb5d){if(_0x58b318['table']==='cdr'){_0x570602[_0x47e7('0x3c')](_0x58b318[_0x47e7('0x71')]+_0x47e7('0x98'),_0x1ceed6['startDate'],_0x1ceed6[_0x47e7('0x99')]);}else{_0x570602[_0x47e7('0x3c')](_0x58b318['table']+_0x47e7('0x9a'),_0x1ceed6[_0x47e7('0x9b')],_0x1ceed6[_0x47e7('0x99')]);}if(_0x57cb5d){logger[_0x47e7('0x9c')](_0x47e7('0x9d'),_0x570602[_0x47e7('0x84')]());require(_0x47e7('0x9e'))['fork'](path[_0x47e7('0x55')](__dirname,_0x47e7('0x9f'),_0x57cb5d[_0x47e7('0x8f')]),[_0x57cb5d['id'],_0x570602[_0x47e7('0x84')](),path[_0x47e7('0x55')](__dirname,_0x47e7('0xa0'),_0x57cb5d[_0x47e7('0xa1')]),_0x540330]);return _0x57cb5d;}else{var _0x182d09=squel[_0x47e7('0x70')]();_0x182d09[_0x47e7('0x8b')]('('+_0x570602[_0x47e7('0x84')]()+')','countTable');_0x182d09[_0x47e7('0x68')](_0x47e7('0xa2'),'count');_0x570602[_0x47e7('0x21')](_0x1ceed6['limit']||_0x496594);_0x570602[_0x47e7('0x1f')](_0x1ceed6[_0x47e7('0x1f')]||0x0);return dbH[_0x47e7('0x83')][_0x47e7('0x34')](_0x182d09[_0x47e7('0x84')](),{'type':dbH[_0x47e7('0x83')][_0x47e7('0x85')][_0x47e7('0xa3')]})[_0x47e7('0x24')](function(_0x24ef24){if(!_0x24ef24[_0x47e7('0x46')]){_0x124da6=0x0;}else{_0x124da6=_0x24ef24[0x0][_0x47e7('0x22')]||0x0;}return dbH['sequelize'][_0x47e7('0x34')](_0x570602[_0x47e7('0x84')](),{'type':dbH[_0x47e7('0x83')][_0x47e7('0x85')][_0x47e7('0xa3')]});})[_0x47e7('0x24')](function(_0x5060e2){return{'rows':_0x5060e2||[],'count':_0x124da6};});}});}exports[_0x47e7('0xa4')]=function(_0x41b03f,_0x1666be){return runReport(_0x41b03f[_0x47e7('0x45')],_0x41b03f[_0x47e7('0x34')],_0x41b03f[_0x47e7('0x41')])[_0x47e7('0x24')](respondWithResult(_0x1666be,null))[_0x47e7('0x48')](handleError(_0x1666be,null));};exports['runReport']=runReport;exports[_0x47e7('0x34')]=function(_0x1b3c95,_0x1ea31f){var _0x9e6c6a=0xa;var _0x323675=['join',_0x47e7('0x56'),_0x47e7('0x86'),_0x47e7('0x57')];var _0x42d034={'SUM':'SUM(%s)','COUNT':_0x47e7('0x59'),'COUNT DISTINCT':_0x47e7('0xa5'),'MAX':_0x47e7('0x5a'),'MIN':_0x47e7('0x87'),'AVG':_0x47e7('0x5b'),'GROUP_CONCAT':_0x47e7('0xa6'),'GROUP_CONCAT ASC':_0x47e7('0x5c'),'GROUP_CONCAT DESC':_0x47e7('0xa7')};var _0x10edbb={'SEC_TO_TIME':_0x47e7('0x5d'),'DATE':_0x47e7('0x5e'),'HOUR':_0x47e7('0x5f'),'ROUND':_0x47e7('0x60'),'UNIX_TIMESTAMP':_0x47e7('0x61')};var _0x560a1d=function(_0x4cb907){return!_[_0x47e7('0x62')]([_0x47e7('0x88'),_0x47e7('0x89'),_0x47e7('0x63'),_0x47e7('0x64')],_0x4cb907);};var _0x20852d=function(_0x3b0de7){if(!_0x3b0de7||!_0x3b0de7['rules'][_0x47e7('0x46')]){return'';}for(var _0x5dfb80='(',_0x3855da=0x0;_0x3855da<_0x3b0de7[_0x47e7('0x65')]['length'];_0x3855da+=0x1){_0x3855da>0x0&&(_0x5dfb80+='\x20'+_0x3b0de7['operator']+'\x20');_0x5dfb80+=_0x3b0de7[_0x47e7('0x65')][_0x3855da][_0x47e7('0x67')]?_0x20852d(_0x3b0de7[_0x47e7('0x65')][_0x3855da]['group']):_0x3b0de7[_0x47e7('0x65')][_0x3855da][_0x47e7('0x68')]+'\x20'+_0x3b0de7[_0x47e7('0x65')][_0x3855da][_0x47e7('0x69')]+(_0x560a1d(_0x3b0de7['rules'][_0x3855da][_0x47e7('0x69')])?'\x20'+_0x3b0de7[_0x47e7('0x65')][_0x3855da]['value']:'');}return _0x5dfb80+')';};var _0x15ccbe={'where':{'id':_0x1b3c95[_0x47e7('0x45')]['id']}},_0x94ef0,_0x444a68,_0x2878a4,_0x6d5193,_0x174dab;_0x15ccbe=_['merge']({},_0x15ccbe,_0x1b3c95[_0x47e7('0x41')]);return db[_0x47e7('0x2e')]['find'](_0x15ccbe)['then'](function(_0x9576bc){if(_0x9576bc){_0x94ef0=_0x9576bc;return _0x9576bc['getFields']();}return null;})[_0x47e7('0x24')](function(_0x372c7b){if(_0x372c7b){if(!_0x372c7b['length']){throw new db[(_0x47e7('0x6b'))][(_0x47e7('0xa8'))](_0x47e7('0x6c'),0x193);}_0x444a68=_0x372c7b;return db['AnalyticMetric'][_0x47e7('0x6e')]({'raw':!![]});}return null;})[_0x47e7('0x24')](function(_0x49bf59){if(_0x49bf59){_0x2878a4=_[_0x47e7('0x6f')](_0x49bf59,'id');var _0x15074a;var _0xa0f9db=squel[_0x47e7('0x70')]();_0xa0f9db[_0x47e7('0x8b')](_0x94ef0[_0x47e7('0x71')]);for(var _0xbc1d18=0x0;_0xbc1d18<_0x444a68[_0x47e7('0x46')];_0xbc1d18+=0x1){_0x15074a=_0x444a68[_0xbc1d18][_0x47e7('0x72')]?_0x2878a4[_0x444a68[_0xbc1d18][_0x47e7('0x72')]]['metric']:_0x444a68[_0xbc1d18][_0x47e7('0x68')];_0x15074a=_0x444a68[_0xbc1d18][_0x47e7('0x73')]?_[_0x47e7('0x8d')](_0x42d034[_0x444a68[_0xbc1d18]['function']],'%s',_0x15074a):_0x15074a;_0x15074a=_0x444a68[_0xbc1d18][_0x47e7('0x74')]?_[_0x47e7('0x8d')](_0x10edbb[_0x444a68[_0xbc1d18][_0x47e7('0x74')]],'%s',_0x15074a):_0x15074a;if(_0x444a68[_0xbc1d18][_0x47e7('0x8e')]){_0xa0f9db['group'](_0x15074a);}_0x444a68[_0xbc1d18][_0x47e7('0x75')]&&_0xa0f9db[_0x47e7('0x76')](_0x15074a,_0x444a68[_0xbc1d18]['orderBy']===_0x47e7('0x77')?![]:!![]);_0xa0f9db[_0x47e7('0x68')](_0x15074a,_0x444a68[_0xbc1d18][_0x47e7('0x78')]||_0x15074a);}if(_0x94ef0[_0x47e7('0x79')]){_0x94ef0[_0x47e7('0x79')]=JSON[_0x47e7('0x7a')](_0x94ef0[_0x47e7('0x79')]);for(var _0x3553a5=0x0;_0x3553a5<_0x94ef0[_0x47e7('0x79')][_0x47e7('0x46')];_0x3553a5+=0x1){if(_0x94ef0[_0x47e7('0x79')][_0x3553a5][_0x47e7('0x31')]&&_['includes'](_0x323675,_0x94ef0[_0x47e7('0x79')][_0x3553a5][_0x47e7('0x31')])&&_0x94ef0[_0x47e7('0x79')][_0x3553a5][_0x47e7('0x7b')]&&_0x94ef0[_0x47e7('0x79')][_0x3553a5][_0x47e7('0x7c')]&&_0x94ef0['joins'][_0x3553a5][_0x47e7('0x7e')]){_0xa0f9db[_0x94ef0['joins'][_0x3553a5][_0x47e7('0x31')]](_0x94ef0[_0x47e7('0x79')][_0x3553a5][_0x47e7('0x7c')],null,util['format'](_0x47e7('0x7d'),_0x94ef0[_0x47e7('0x71')],_0x94ef0[_0x47e7('0x79')][_0x3553a5][_0x47e7('0x7b')],_0x94ef0['joins'][_0x3553a5]['foreignTable'],_0x94ef0[_0x47e7('0x79')][_0x3553a5][_0x47e7('0x7e')]));}}}if(_0x94ef0[_0x47e7('0x7f')]){_0x94ef0['conditions']=JSON['parse'](_0x94ef0['conditions']);_0xa0f9db[_0x47e7('0x3c')](_0x20852d(_0x94ef0[_0x47e7('0x7f')][_0x47e7('0x67')]));}_0x174dab=_0xa0f9db[_0x47e7('0x80')]();_0xa0f9db[_0x47e7('0x21')](_0x9e6c6a);_0xa0f9db['offset'](0x0);logger[_0x47e7('0x81')](_0x47e7('0x82'),_0xa0f9db['toString']());return dbH['sequelize'][_0x47e7('0x34')](_0xa0f9db[_0x47e7('0x84')](),{'type':dbH['sequelize'][_0x47e7('0x85')][_0x47e7('0xa3')]});}})['then'](function(){return{'sql':_0x174dab['toString']()};})[_0x47e7('0x24')](respondWithResult(_0x1ea31f,null))[_0x47e7('0x48')](handleError(_0x1ea31f,null));}; \ No newline at end of file +var _0x0f11=['UserProfileSection','CustomReports','params','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','type','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','SUM(%s)','GROUP_CONCAT(%s)','IS\x20NOT\x20NULL','value','from','output','web','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','SELECT','runReport','AnalyticMetric','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','rawAttributes','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports'];(function(_0x81e097,_0x31d5fe){var _0x57ff74=function(_0x4ff0b9){while(--_0x4ff0b9){_0x81e097['push'](_0x81e097['shift']());}};_0x57ff74(++_0x31d5fe);}(_0x0f11,0x190));var _0x10f1=function(_0x3949f5,_0x16aa2f){_0x3949f5=_0x3949f5-0x0;var _0x461064=_0x0f11[_0x3949f5];return _0x461064;};'use strict';var emlformat=require(_0x10f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10f1('0x1'));var jsonpatch=require(_0x10f1('0x2'));var rp=require(_0x10f1('0x3'));var moment=require(_0x10f1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x10f1('0x5'));var util=require(_0x10f1('0x6'));var path=require(_0x10f1('0x7'));var sox=require(_0x10f1('0x8'));var csv=require(_0x10f1('0x9'));var ejs=require(_0x10f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x10f1('0xb'));var squel=require('squel');var crypto=require(_0x10f1('0xc'));var jsforce=require(_0x10f1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x10f1('0x9'));var querystring=require(_0x10f1('0xe'));var Papa=require(_0x10f1('0xf'));var Redis=require(_0x10f1('0x10'));var authService=require(_0x10f1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x10f1('0x12'))(_0x10f1('0x13'));var utils=require(_0x10f1('0x14'));var config=require(_0x10f1('0x15'));var licenseUtil=require(_0x10f1('0x16'));var db=require(_0x10f1('0x17'))['db'];var dbH=require(_0x10f1('0x17'))['dbH'];function respondWithStatusCode(_0x250d38,_0x386399){_0x386399=_0x386399||0xcc;return function(_0x916371){if(_0x916371){return _0x250d38[_0x10f1('0x18')](_0x386399);}return _0x250d38[_0x10f1('0x19')](_0x386399)[_0x10f1('0x1a')]();};}function respondWithResult(_0x43786a,_0x24b3e4){_0x24b3e4=_0x24b3e4||0xc8;return function(_0x2cbc11){if(_0x2cbc11){return _0x43786a[_0x10f1('0x19')](_0x24b3e4)[_0x10f1('0x1b')](_0x2cbc11);}};}function respondWithFilteredResult(_0x3e2233,_0x3644f7){return function(_0x58807e){if(_0x58807e){var _0x75e63e=typeof _0x3644f7[_0x10f1('0x1c')]===_0x10f1('0x1d')&&typeof _0x3644f7[_0x10f1('0x1e')]===_0x10f1('0x1d');var _0x8fb161=_0x58807e['count'];var _0x4f1bec=_0x75e63e?0x0:_0x3644f7[_0x10f1('0x1c')];var _0x47e645=_0x75e63e?_0x58807e[_0x10f1('0x1f')]:_0x3644f7[_0x10f1('0x1c')]+_0x3644f7[_0x10f1('0x1e')];var _0x30ca68;if(_0x47e645>=_0x8fb161){_0x47e645=_0x8fb161;_0x30ca68=0xc8;}else{_0x30ca68=0xce;}_0x3e2233[_0x10f1('0x19')](_0x30ca68);return _0x3e2233['set'](_0x10f1('0x20'),_0x4f1bec+'-'+_0x47e645+'/'+_0x8fb161)['json'](_0x58807e);}return null;};}function patchUpdates(_0x208e0c){return function(_0x5ae34){try{jsonpatch[_0x10f1('0x21')](_0x5ae34,_0x208e0c,!![]);}catch(_0x1856cc){return BPromise['reject'](_0x1856cc);}return _0x5ae34[_0x10f1('0x22')]();};}function saveUpdates(_0x5a2194,_0x36c74b){return function(_0x2c7367){if(_0x2c7367){return _0x2c7367[_0x10f1('0x23')](_0x5a2194)[_0x10f1('0x24')](function(_0x196b3b){return _0x196b3b;});}return null;};}function removeEntity(_0x2802f4,_0x45efe4){return function(_0x519b39){if(_0x519b39){return _0x519b39[_0x10f1('0x25')]()[_0x10f1('0x24')](function(){var _0x269987=_0x519b39[_0x10f1('0x26')]({'plain':!![]});var _0x54ef8b='CustomReports';return db[_0x10f1('0x27')][_0x10f1('0x25')]({'where':{'type':_0x54ef8b,'resourceId':_0x269987['id']}})[_0x10f1('0x24')](function(){return _0x519b39;});})[_0x10f1('0x24')](function(){_0x2802f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2140b7,_0x590c39){return function(_0x260729){if(!_0x260729){_0x2140b7[_0x10f1('0x18')](0x194);}return _0x260729;};}function handleError(_0x4bc5d6,_0x3816f9){_0x3816f9=_0x3816f9||0x1f4;return function(_0x4604ef){logger[_0x10f1('0x28')](_0x4604ef[_0x10f1('0x29')]);if(_0x4604ef['name']){delete _0x4604ef[_0x10f1('0x2a')];}_0x4bc5d6['status'](_0x3816f9)[_0x10f1('0x2b')](_0x4604ef);};}exports[_0x10f1('0x2c')]=function(_0x13fd45,_0x3ffa2d){var _0x19adb2={},_0x42f890={},_0x2cbd71={'count':0x0,'rows':[]};var _0x257761=_[_0x10f1('0x2d')](db[_0x10f1('0x2e')]['rawAttributes'],function(_0x525f8e){return{'name':_0x525f8e[_0x10f1('0x2f')],'type':_0x525f8e['type'][_0x10f1('0x30')]};});_0x42f890[_0x10f1('0x31')]=_['map'](_0x257761,_0x10f1('0x2a'));_0x42f890[_0x10f1('0x32')]=_[_0x10f1('0x33')](_0x13fd45[_0x10f1('0x32')]);_0x42f890[_0x10f1('0x34')]=_[_0x10f1('0x35')](_0x42f890[_0x10f1('0x31')],_0x42f890[_0x10f1('0x32')]);_0x19adb2[_0x10f1('0x36')]=_['intersection'](_0x42f890[_0x10f1('0x31')],qs[_0x10f1('0x37')](_0x13fd45[_0x10f1('0x32')]['fields']));_0x19adb2[_0x10f1('0x36')]=_0x19adb2[_0x10f1('0x36')]['length']?_0x19adb2[_0x10f1('0x36')]:_0x42f890[_0x10f1('0x31')];if(!_0x13fd45[_0x10f1('0x32')][_0x10f1('0x38')](_0x10f1('0x39'))){_0x19adb2[_0x10f1('0x1e')]=qs[_0x10f1('0x1e')](_0x13fd45[_0x10f1('0x32')][_0x10f1('0x1e')]);_0x19adb2[_0x10f1('0x1c')]=qs[_0x10f1('0x1c')](_0x13fd45[_0x10f1('0x32')][_0x10f1('0x1c')]);}_0x19adb2[_0x10f1('0x3a')]=qs[_0x10f1('0x3b')](_0x13fd45['query'][_0x10f1('0x3b')]);_0x19adb2[_0x10f1('0x3c')]=qs[_0x10f1('0x34')](_[_0x10f1('0x3d')](_0x13fd45[_0x10f1('0x32')],_0x42f890['filters']),_0x257761);if(_0x13fd45[_0x10f1('0x32')][_0x10f1('0x3e')]){_0x19adb2['where']=_[_0x10f1('0x3f')](_0x19adb2[_0x10f1('0x3c')],{'$or':_['map'](_0x257761,function(_0x3be423){if(_0x3be423['type']!=='VIRTUAL'){var _0x1b66cc={};_0x1b66cc[_0x3be423['name']]={'$like':'%'+_0x13fd45['query'][_0x10f1('0x3e')]+'%'};return _0x1b66cc;}})});}_0x19adb2=_[_0x10f1('0x3f')]({},_0x19adb2,_0x13fd45['options']);var _0x27994b={'where':_0x19adb2['where']};return db['AnalyticCustomReport'][_0x10f1('0x1f')](_0x27994b)['then'](function(_0x207f52){_0x2cbd71['count']=_0x207f52;if(_0x13fd45[_0x10f1('0x32')][_0x10f1('0x40')]){_0x19adb2[_0x10f1('0x41')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x10f1('0x42')](_0x19adb2);})['then'](function(_0x1531de){_0x2cbd71[_0x10f1('0x43')]=_0x1531de;return _0x2cbd71;})[_0x10f1('0x24')](respondWithFilteredResult(_0x3ffa2d,_0x19adb2))[_0x10f1('0x44')](handleError(_0x3ffa2d,null));};exports['show']=function(_0x333107,_0x22ebfa){var _0x31bfc6={'raw':![],'where':{'id':_0x333107['params']['id']}},_0x592795={};_0x592795[_0x10f1('0x31')]=_[_0x10f1('0x33')](db[_0x10f1('0x2e')][_0x10f1('0x45')]);_0x592795[_0x10f1('0x32')]=_['keys'](_0x333107[_0x10f1('0x32')]);_0x592795[_0x10f1('0x34')]=_['intersection'](_0x592795[_0x10f1('0x31')],_0x592795['query']);_0x31bfc6[_0x10f1('0x36')]=_[_0x10f1('0x35')](_0x592795['model'],qs[_0x10f1('0x37')](_0x333107['query'][_0x10f1('0x37')]));_0x31bfc6['attributes']=_0x31bfc6['attributes'][_0x10f1('0x46')]?_0x31bfc6[_0x10f1('0x36')]:_0x592795[_0x10f1('0x31')];if(_0x333107[_0x10f1('0x32')][_0x10f1('0x40')]){_0x31bfc6[_0x10f1('0x41')]=[{'all':!![]}];}_0x31bfc6=_['merge']({},_0x31bfc6,_0x333107[_0x10f1('0x47')]);return db['AnalyticCustomReport'][_0x10f1('0x48')](_0x31bfc6)['then'](handleEntityNotFound(_0x22ebfa,null))[_0x10f1('0x24')](respondWithResult(_0x22ebfa,null))['catch'](handleError(_0x22ebfa,null));};exports[_0x10f1('0x49')]=function(_0x2f2ecb,_0x4754e0){return db[_0x10f1('0x2e')][_0x10f1('0x49')](_0x2f2ecb[_0x10f1('0x4a')],{})[_0x10f1('0x24')](function(_0x45e674){var _0x58c4c6=_0x2f2ecb['user'][_0x10f1('0x26')]({'plain':!![]});if(!_0x58c4c6)throw new Error(_0x10f1('0x4b'));if(_0x58c4c6['role']==='user'){var _0x2e0344=_0x45e674[_0x10f1('0x26')]({'plain':!![]});var _0x220cfd=_0x10f1('0x4c');return db[_0x10f1('0x4d')]['find']({'where':{'name':_0x220cfd,'userProfileId':_0x58c4c6['userProfileId']},'raw':!![]})[_0x10f1('0x24')](function(_0x1ad16d){if(_0x1ad16d&&_0x1ad16d['autoAssociation']===0x0){return db[_0x10f1('0x27')]['create']({'name':_0x2e0344['name'],'resourceId':_0x2e0344['id'],'type':_0x10f1('0x4e'),'sectionId':_0x1ad16d['id']},{})[_0x10f1('0x24')](function(){return _0x45e674;});}else{return _0x45e674;}})[_0x10f1('0x44')](function(_0x1f6bf1){logger[_0x10f1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f6bf1);throw _0x1f6bf1;});}return _0x45e674;})[_0x10f1('0x24')](respondWithResult(_0x4754e0,0xc9))[_0x10f1('0x44')](handleError(_0x4754e0,null));};exports['update']=function(_0x159d0f,_0x5b88b1){if(_0x159d0f['body']['id']){delete _0x159d0f[_0x10f1('0x4a')]['id'];}return db['AnalyticCustomReport'][_0x10f1('0x48')]({'where':{'id':_0x159d0f[_0x10f1('0x4f')]['id']}})[_0x10f1('0x24')](handleEntityNotFound(_0x5b88b1,null))[_0x10f1('0x24')](saveUpdates(_0x159d0f['body'],null))[_0x10f1('0x24')](respondWithResult(_0x5b88b1,null))[_0x10f1('0x44')](handleError(_0x5b88b1,null));};exports['destroy']=function(_0x5b2681,_0x4ea7fd){return db['AnalyticCustomReport'][_0x10f1('0x48')]({'where':{'id':_0x5b2681['params']['id']}})[_0x10f1('0x24')](handleEntityNotFound(_0x4ea7fd,null))['then'](removeEntity(_0x4ea7fd,null))[_0x10f1('0x44')](handleError(_0x4ea7fd,null));};exports[_0x10f1('0x50')]=function(_0x4e0840,_0x1dffeb){var _0x1c9fa7=0xa;var _0x4de6ae=[_0x10f1('0x51'),'left_join',_0x10f1('0x52'),_0x10f1('0x53')];var _0x342b43={'SUM':'SUM(%s)','COUNT':_0x10f1('0x54'),'COUNT DISTINCT':_0x10f1('0x55'),'MAX':_0x10f1('0x56'),'MIN':_0x10f1('0x57'),'AVG':_0x10f1('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x10f1('0x59'),'GROUP_CONCAT DESC':_0x10f1('0x5a')};var _0x14a350={'SEC_TO_TIME':_0x10f1('0x5b'),'DATE':_0x10f1('0x5c'),'HOUR':_0x10f1('0x5d'),'ROUND':_0x10f1('0x5e'),'UNIX_TIMESTAMP':_0x10f1('0x5f')};var _0x13b6ed=function(_0x5a1fdc){return!_['includes']([_0x10f1('0x60'),'IS\x20NOT\x20NULL',_0x10f1('0x61'),'IS\x20NOT\x20EMPTY'],_0x5a1fdc);};var _0x495feb=function(_0x450882){if(!_0x450882||!_0x450882['rules'][_0x10f1('0x46')]){return'';}for(var _0x5508ba='(',_0x28dbab=0x0;_0x28dbab<_0x450882[_0x10f1('0x62')][_0x10f1('0x46')];_0x28dbab+=0x1){_0x28dbab>0x0&&(_0x5508ba+='\x20'+_0x450882[_0x10f1('0x63')]+'\x20');_0x5508ba+=_0x450882[_0x10f1('0x62')][_0x28dbab]['group']?_0x495feb(_0x450882[_0x10f1('0x62')][_0x28dbab][_0x10f1('0x64')]):_0x450882[_0x10f1('0x62')][_0x28dbab][_0x10f1('0x65')]+'\x20'+_0x450882['rules'][_0x28dbab][_0x10f1('0x66')]+(_0x13b6ed(_0x450882['rules'][_0x28dbab]['condition'])?'\x20'+_0x450882[_0x10f1('0x62')][_0x28dbab]['value']:'');}return _0x5508ba+')';};var _0x38db3b={'where':{'id':_0x4e0840['params']['id']}},_0xd3e66,_0x220b71,_0x3511ca,_0x45a0e7,_0x2a7917;_0x38db3b=_[_0x10f1('0x3f')]({},_0x38db3b,_0x4e0840[_0x10f1('0x47')]);return db[_0x10f1('0x2e')][_0x10f1('0x48')](_0x38db3b)[_0x10f1('0x24')](function(_0x3e3405){if(_0x3e3405){_0xd3e66=_0x3e3405;return _0x3e3405[_0x10f1('0x67')]();}return null;})[_0x10f1('0x24')](function(_0xc87a0e){if(_0xc87a0e){if(!_0xc87a0e[_0x10f1('0x46')]){throw new db[(_0x10f1('0x68'))][(_0x10f1('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x220b71=_0xc87a0e;return db['AnalyticMetric'][_0x10f1('0x42')]({'raw':!![]});}return null;})['then'](function(_0x58eead){if(_0x58eead){_0x3511ca=_[_0x10f1('0x6a')](_0x58eead,'id');var _0x455fae;var _0x123047=squel[_0x10f1('0x6b')]();_0x123047['from'](_0xd3e66[_0x10f1('0x6c')]);for(var _0x253a00=0x0;_0x253a00<_0x220b71['length'];_0x253a00+=0x1){_0x455fae=_0x220b71[_0x253a00][_0x10f1('0x6d')]?_0x3511ca[_0x220b71[_0x253a00][_0x10f1('0x6d')]][_0x10f1('0x6e')]:_0x220b71[_0x253a00]['field'];_0x455fae=_0x220b71[_0x253a00]['function']?_['replace'](_0x342b43[_0x220b71[_0x253a00][_0x10f1('0x6f')]],'%s',_0x455fae):_0x455fae;_0x455fae=_0x220b71[_0x253a00][_0x10f1('0x70')]?_[_0x10f1('0x71')](_0x14a350[_0x220b71[_0x253a00][_0x10f1('0x70')]],'%s',_0x455fae):_0x455fae;if(_0x220b71[_0x253a00][_0x10f1('0x72')]){_0x123047[_0x10f1('0x64')](_0x455fae);}_0x220b71[_0x253a00][_0x10f1('0x73')]&&_0x123047[_0x10f1('0x3a')](_0x455fae,_0x220b71[_0x253a00][_0x10f1('0x73')]===_0x10f1('0x74')?![]:!![]);_0x123047[_0x10f1('0x65')](_0x455fae,_0x220b71[_0x253a00][_0x10f1('0x75')]||_0x455fae);}if(_0xd3e66[_0x10f1('0x76')]){_0xd3e66['joins']=JSON[_0x10f1('0x77')](_0xd3e66[_0x10f1('0x76')]);for(var _0x4a5ad4=0x0;_0x4a5ad4<_0xd3e66[_0x10f1('0x76')][_0x10f1('0x46')];_0x4a5ad4+=0x1){if(_0xd3e66[_0x10f1('0x76')][_0x4a5ad4][_0x10f1('0x78')]&&_[_0x10f1('0x79')](_0x4de6ae,_0xd3e66[_0x10f1('0x76')][_0x4a5ad4]['type'])&&_0xd3e66[_0x10f1('0x76')][_0x4a5ad4][_0x10f1('0x7a')]&&_0xd3e66[_0x10f1('0x76')][_0x4a5ad4][_0x10f1('0x7b')]&&_0xd3e66['joins'][_0x4a5ad4]['foreignKey']){_0x123047[_0xd3e66[_0x10f1('0x76')][_0x4a5ad4][_0x10f1('0x78')]](_0xd3e66[_0x10f1('0x76')][_0x4a5ad4][_0x10f1('0x7b')],null,util[_0x10f1('0x70')](_0x10f1('0x7c'),_0xd3e66[_0x10f1('0x6c')],_0xd3e66[_0x10f1('0x76')][_0x4a5ad4]['parentKey'],_0xd3e66['joins'][_0x4a5ad4][_0x10f1('0x7b')],_0xd3e66['joins'][_0x4a5ad4][_0x10f1('0x7d')]));}}}if(_0xd3e66[_0x10f1('0x7e')]){_0xd3e66['conditions']=JSON[_0x10f1('0x77')](_0xd3e66[_0x10f1('0x7e')]);_0x123047[_0x10f1('0x3c')](_0x495feb(_0xd3e66[_0x10f1('0x7e')][_0x10f1('0x64')]));}_0x2a7917=_0x123047[_0x10f1('0x7f')]();_0x123047[_0x10f1('0x1e')](_0x1c9fa7);_0x123047[_0x10f1('0x1c')](0x0);logger['debug'](_0x10f1('0x80'),_0x123047['toString']());return dbH['sequelize'][_0x10f1('0x32')](_0x123047[_0x10f1('0x81')](),{'type':dbH[_0x10f1('0x82')][_0x10f1('0x83')]['SELECT']});}})[_0x10f1('0x24')](respondWithResult(_0x1dffeb,null))[_0x10f1('0x44')](handleError(_0x1dffeb,null));};function runReport(_0x1c6623,_0x2a3959,_0x391641){var _0x41ba49=_0x2a3959[_0x10f1('0x2a')];var _0x2d0f7e=0xa;var _0x9f61f3=[_0x10f1('0x51'),_0x10f1('0x84'),_0x10f1('0x52'),_0x10f1('0x53')];var _0x826f2a={'SUM':_0x10f1('0x85'),'COUNT':_0x10f1('0x54'),'COUNT DISTINCT':_0x10f1('0x55'),'MAX':_0x10f1('0x56'),'MIN':_0x10f1('0x57'),'AVG':_0x10f1('0x58'),'GROUP_CONCAT':_0x10f1('0x86'),'GROUP_CONCAT ASC':_0x10f1('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x47d3d7={'SEC_TO_TIME':_0x10f1('0x5b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x10f1('0x5f')};var _0x494b56=function(_0x3a5c68){return!_[_0x10f1('0x79')](['IS\x20NULL',_0x10f1('0x87'),_0x10f1('0x61'),'IS\x20NOT\x20EMPTY'],_0x3a5c68);};var _0x2f7fa9=function(_0x155f1a){if(!_0x155f1a||!_0x155f1a[_0x10f1('0x62')][_0x10f1('0x46')]){return'';}for(var _0x156d46='(',_0xb52d90=0x0;_0xb52d90<_0x155f1a[_0x10f1('0x62')][_0x10f1('0x46')];_0xb52d90+=0x1){_0xb52d90>0x0&&(_0x156d46+='\x20'+_0x155f1a[_0x10f1('0x63')]+'\x20');_0x156d46+=_0x155f1a[_0x10f1('0x62')][_0xb52d90][_0x10f1('0x64')]?_0x2f7fa9(_0x155f1a['rules'][_0xb52d90][_0x10f1('0x64')]):_0x155f1a[_0x10f1('0x62')][_0xb52d90]['field']+'\x20'+_0x155f1a['rules'][_0xb52d90]['condition']+(_0x494b56(_0x155f1a[_0x10f1('0x62')][_0xb52d90][_0x10f1('0x66')])?'\x20'+_0x155f1a[_0x10f1('0x62')][_0xb52d90][_0x10f1('0x88')]:'');}return _0x156d46+')';};var _0x5aff39={'where':{'id':_0x1c6623['id']}},_0x18f125,_0x1aa710,_0xe3c8bb,_0x539897,_0x33c915;_0x5aff39=_[_0x10f1('0x3f')]({},_0x5aff39,_0x391641);return db[_0x10f1('0x2e')][_0x10f1('0x48')](_0x5aff39)[_0x10f1('0x24')](function(_0x1af974){if(_0x1af974){_0x18f125=_0x1af974;return _0x1af974['getFields']();}return null;})[_0x10f1('0x24')](function(_0x3ddb4c){if(_0x3ddb4c){if(!_0x3ddb4c[_0x10f1('0x46')]){throw new db[(_0x10f1('0x68'))][(_0x10f1('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1aa710=_0x3ddb4c;return db['AnalyticMetric'][_0x10f1('0x42')]({'raw':!![]});}return null;})['then'](function(_0x30bf24){if(_0x30bf24){_0xe3c8bb=_['keyBy'](_0x30bf24,'id');var _0x3f9f45;var _0x568c3=squel[_0x10f1('0x6b')]();_0x568c3[_0x10f1('0x89')](_0x18f125[_0x10f1('0x6c')]);for(var _0x494656=0x0;_0x494656<_0x1aa710[_0x10f1('0x46')];_0x494656+=0x1){_0x3f9f45=_0x1aa710[_0x494656][_0x10f1('0x6d')]?_0xe3c8bb[_0x1aa710[_0x494656][_0x10f1('0x6d')]][_0x10f1('0x6e')]:_0x1aa710[_0x494656][_0x10f1('0x65')];_0x3f9f45=_0x1aa710[_0x494656][_0x10f1('0x6f')]?_[_0x10f1('0x71')](_0x826f2a[_0x1aa710[_0x494656][_0x10f1('0x6f')]],'%s',_0x3f9f45):_0x3f9f45;_0x3f9f45=_0x1aa710[_0x494656][_0x10f1('0x70')]?_[_0x10f1('0x71')](_0x47d3d7[_0x1aa710[_0x494656][_0x10f1('0x70')]],'%s',_0x3f9f45):_0x3f9f45;if(_0x1aa710[_0x494656][_0x10f1('0x72')]){_0x568c3[_0x10f1('0x64')](_0x3f9f45);}_0x1aa710[_0x494656][_0x10f1('0x73')]&&_0x568c3[_0x10f1('0x3a')](_0x3f9f45,_0x1aa710[_0x494656][_0x10f1('0x73')]===_0x10f1('0x74')?![]:!![]);_0x568c3[_0x10f1('0x65')](_0x3f9f45,_0x1aa710[_0x494656]['alias']||_0x3f9f45);}if(_0x18f125[_0x10f1('0x76')]){_0x18f125[_0x10f1('0x76')]=JSON[_0x10f1('0x77')](_0x18f125[_0x10f1('0x76')]);for(var _0x252f58=0x0;_0x252f58<_0x18f125[_0x10f1('0x76')][_0x10f1('0x46')];_0x252f58+=0x1){if(_0x18f125[_0x10f1('0x76')][_0x252f58]['type']&&_['includes'](_0x9f61f3,_0x18f125[_0x10f1('0x76')][_0x252f58][_0x10f1('0x78')])&&_0x18f125[_0x10f1('0x76')][_0x252f58][_0x10f1('0x7a')]&&_0x18f125[_0x10f1('0x76')][_0x252f58][_0x10f1('0x7b')]&&_0x18f125[_0x10f1('0x76')][_0x252f58]['foreignKey']){_0x568c3[_0x18f125[_0x10f1('0x76')][_0x252f58][_0x10f1('0x78')]](_0x18f125[_0x10f1('0x76')][_0x252f58][_0x10f1('0x7b')],null,util[_0x10f1('0x70')](_0x10f1('0x7c'),_0x18f125[_0x10f1('0x6c')],_0x18f125[_0x10f1('0x76')][_0x252f58][_0x10f1('0x7a')],_0x18f125['joins'][_0x252f58][_0x10f1('0x7b')],_0x18f125['joins'][_0x252f58][_0x10f1('0x7d')]));}}}if(_0x18f125[_0x10f1('0x7e')]){_0x18f125[_0x10f1('0x7e')]=JSON[_0x10f1('0x77')](_0x18f125[_0x10f1('0x7e')]);_0x568c3[_0x10f1('0x3c')](_0x2f7fa9(_0x18f125[_0x10f1('0x7e')][_0x10f1('0x64')]));}_0x33c915=_0x568c3['clone']();_0x568c3[_0x10f1('0x1e')](_0x2d0f7e);_0x568c3['offset'](0x0);return;}})[_0x10f1('0x24')](function(){if(_0x2a3959[_0x10f1('0x8a')]===_0x10f1('0x8b')){return null;}var _0x2498f2=_['merge'](_0x2a3959,{'name':_0x2a3959['fullPath']||_0x2a3959[_0x10f1('0x2a')]||_0x18f125[_0x10f1('0x2a')],'basename':_0x41ba49,'savename':util[_0x10f1('0x70')](_0x10f1('0x8c'),_0x2a3959[_0x10f1('0x2a')]||_0x18f125[_0x10f1('0x2a')],require(_0x10f1('0x8d'))[_0x10f1('0x8e')](0x4),_0x2a3959[_0x10f1('0x8a')]||_0x10f1('0x8f')),'reportId':_0x18f125['id'],'reportType':'custom'});return db[_0x10f1('0x90')][_0x10f1('0x49')](_0x2498f2,{'raw':!![]});})[_0x10f1('0x24')](function(_0x2ce375){if(_0x18f125['table']===_0x10f1('0x91')){_0x33c915[_0x10f1('0x3c')](_0x18f125[_0x10f1('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2a3959[_0x10f1('0x92')],_0x2a3959[_0x10f1('0x93')]);}else{_0x33c915[_0x10f1('0x3c')](_0x18f125[_0x10f1('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2a3959['startDate'],_0x2a3959[_0x10f1('0x93')]);}if(_0x2ce375){logger['info'](_0x10f1('0x94'),_0x33c915[_0x10f1('0x81')]());require(_0x10f1('0x95'))[_0x10f1('0x96')](path[_0x10f1('0x51')](__dirname,_0x10f1('0x97'),_0x2ce375[_0x10f1('0x8a')]),[_0x2ce375['id'],_0x33c915['toString'](),path[_0x10f1('0x51')](__dirname,_0x10f1('0x98'),_0x2ce375[_0x10f1('0x99')]),_0x41ba49]);return _0x2ce375;}else{var _0x397ded=squel[_0x10f1('0x6b')]();_0x397ded[_0x10f1('0x89')]('('+_0x33c915[_0x10f1('0x81')]()+')',_0x10f1('0x9a'));_0x397ded['field']('COUNT(*)',_0x10f1('0x1f'));_0x33c915[_0x10f1('0x1e')](_0x2a3959[_0x10f1('0x1e')]||_0x2d0f7e);_0x33c915[_0x10f1('0x1c')](_0x2a3959[_0x10f1('0x1c')]||0x0);return dbH[_0x10f1('0x82')][_0x10f1('0x32')](_0x397ded[_0x10f1('0x81')](),{'type':dbH['sequelize'][_0x10f1('0x83')][_0x10f1('0x9b')]})['then'](function(_0x2735e7){if(!_0x2735e7[_0x10f1('0x46')]){_0x539897=0x0;}else{_0x539897=_0x2735e7[0x0]['count']||0x0;}return dbH[_0x10f1('0x82')]['query'](_0x33c915[_0x10f1('0x81')](),{'type':dbH[_0x10f1('0x82')]['QueryTypes'][_0x10f1('0x9b')]});})['then'](function(_0x58fd95){return{'rows':_0x58fd95||[],'count':_0x539897};});}});}exports['run']=function(_0x5b742b,_0x2e2384){return runReport(_0x5b742b[_0x10f1('0x4f')],_0x5b742b['query'],_0x5b742b[_0x10f1('0x47')])[_0x10f1('0x24')](respondWithResult(_0x2e2384,null))[_0x10f1('0x44')](handleError(_0x2e2384,null));};exports[_0x10f1('0x9c')]=runReport;exports['query']=function(_0x3d68ff,_0x3f4753){var _0x1d7a2e=0xa;var _0x53e175=['join',_0x10f1('0x84'),'right_join',_0x10f1('0x53')];var _0x623979={'SUM':_0x10f1('0x85'),'COUNT':_0x10f1('0x54'),'COUNT DISTINCT':_0x10f1('0x55'),'MAX':_0x10f1('0x56'),'MIN':_0x10f1('0x57'),'AVG':_0x10f1('0x58'),'GROUP_CONCAT':_0x10f1('0x86'),'GROUP_CONCAT ASC':_0x10f1('0x59'),'GROUP_CONCAT DESC':_0x10f1('0x5a')};var _0x5572a2={'SEC_TO_TIME':_0x10f1('0x5b'),'DATE':_0x10f1('0x5c'),'HOUR':_0x10f1('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x10f1('0x5f')};var _0x5551bb=function(_0x5682b7){return!_[_0x10f1('0x79')]([_0x10f1('0x60'),_0x10f1('0x87'),_0x10f1('0x61'),'IS\x20NOT\x20EMPTY'],_0x5682b7);};var _0x480a05=function(_0x2b937d){if(!_0x2b937d||!_0x2b937d[_0x10f1('0x62')][_0x10f1('0x46')]){return'';}for(var _0x1cc86a='(',_0x25e8ac=0x0;_0x25e8ac<_0x2b937d['rules']['length'];_0x25e8ac+=0x1){_0x25e8ac>0x0&&(_0x1cc86a+='\x20'+_0x2b937d[_0x10f1('0x63')]+'\x20');_0x1cc86a+=_0x2b937d['rules'][_0x25e8ac][_0x10f1('0x64')]?_0x480a05(_0x2b937d['rules'][_0x25e8ac][_0x10f1('0x64')]):_0x2b937d[_0x10f1('0x62')][_0x25e8ac]['field']+'\x20'+_0x2b937d[_0x10f1('0x62')][_0x25e8ac][_0x10f1('0x66')]+(_0x5551bb(_0x2b937d[_0x10f1('0x62')][_0x25e8ac][_0x10f1('0x66')])?'\x20'+_0x2b937d[_0x10f1('0x62')][_0x25e8ac][_0x10f1('0x88')]:'');}return _0x1cc86a+')';};var _0x4f3159={'where':{'id':_0x3d68ff[_0x10f1('0x4f')]['id']}},_0x17312d,_0x5ca0d5,_0xdb48a6,_0x3b63d6,_0x4bc056;_0x4f3159=_[_0x10f1('0x3f')]({},_0x4f3159,_0x3d68ff[_0x10f1('0x47')]);return db[_0x10f1('0x2e')]['find'](_0x4f3159)[_0x10f1('0x24')](function(_0x1a8fb4){if(_0x1a8fb4){_0x17312d=_0x1a8fb4;return _0x1a8fb4[_0x10f1('0x67')]();}return null;})[_0x10f1('0x24')](function(_0x200b47){if(_0x200b47){if(!_0x200b47['length']){throw new db[(_0x10f1('0x68'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ca0d5=_0x200b47;return db[_0x10f1('0x9d')][_0x10f1('0x42')]({'raw':!![]});}return null;})[_0x10f1('0x24')](function(_0x2a7455){if(_0x2a7455){_0xdb48a6=_['keyBy'](_0x2a7455,'id');var _0x4697e3;var _0x4a410f=squel[_0x10f1('0x6b')]();_0x4a410f['from'](_0x17312d[_0x10f1('0x6c')]);for(var _0x2c5f52=0x0;_0x2c5f52<_0x5ca0d5['length'];_0x2c5f52+=0x1){_0x4697e3=_0x5ca0d5[_0x2c5f52]['MetricId']?_0xdb48a6[_0x5ca0d5[_0x2c5f52]['MetricId']][_0x10f1('0x6e')]:_0x5ca0d5[_0x2c5f52][_0x10f1('0x65')];_0x4697e3=_0x5ca0d5[_0x2c5f52]['function']?_[_0x10f1('0x71')](_0x623979[_0x5ca0d5[_0x2c5f52][_0x10f1('0x6f')]],'%s',_0x4697e3):_0x4697e3;_0x4697e3=_0x5ca0d5[_0x2c5f52]['format']?_[_0x10f1('0x71')](_0x5572a2[_0x5ca0d5[_0x2c5f52]['format']],'%s',_0x4697e3):_0x4697e3;if(_0x5ca0d5[_0x2c5f52][_0x10f1('0x72')]){_0x4a410f[_0x10f1('0x64')](_0x4697e3);}_0x5ca0d5[_0x2c5f52]['orderBy']&&_0x4a410f[_0x10f1('0x3a')](_0x4697e3,_0x5ca0d5[_0x2c5f52][_0x10f1('0x73')]==='DESC'?![]:!![]);_0x4a410f['field'](_0x4697e3,_0x5ca0d5[_0x2c5f52][_0x10f1('0x75')]||_0x4697e3);}if(_0x17312d[_0x10f1('0x76')]){_0x17312d[_0x10f1('0x76')]=JSON[_0x10f1('0x77')](_0x17312d[_0x10f1('0x76')]);for(var _0x19a36e=0x0;_0x19a36e<_0x17312d[_0x10f1('0x76')][_0x10f1('0x46')];_0x19a36e+=0x1){if(_0x17312d[_0x10f1('0x76')][_0x19a36e]['type']&&_[_0x10f1('0x79')](_0x53e175,_0x17312d['joins'][_0x19a36e][_0x10f1('0x78')])&&_0x17312d[_0x10f1('0x76')][_0x19a36e][_0x10f1('0x7a')]&&_0x17312d['joins'][_0x19a36e][_0x10f1('0x7b')]&&_0x17312d['joins'][_0x19a36e]['foreignKey']){_0x4a410f[_0x17312d[_0x10f1('0x76')][_0x19a36e]['type']](_0x17312d['joins'][_0x19a36e]['foreignTable'],null,util[_0x10f1('0x70')](_0x10f1('0x7c'),_0x17312d['table'],_0x17312d[_0x10f1('0x76')][_0x19a36e][_0x10f1('0x7a')],_0x17312d['joins'][_0x19a36e][_0x10f1('0x7b')],_0x17312d['joins'][_0x19a36e][_0x10f1('0x7d')]));}}}if(_0x17312d['conditions']){_0x17312d[_0x10f1('0x7e')]=JSON[_0x10f1('0x77')](_0x17312d[_0x10f1('0x7e')]);_0x4a410f[_0x10f1('0x3c')](_0x480a05(_0x17312d['conditions'][_0x10f1('0x64')]));}_0x4bc056=_0x4a410f[_0x10f1('0x7f')]();_0x4a410f['limit'](_0x1d7a2e);_0x4a410f[_0x10f1('0x1c')](0x0);logger[_0x10f1('0x9e')](_0x10f1('0x80'),_0x4a410f['toString']());return dbH[_0x10f1('0x82')][_0x10f1('0x32')](_0x4a410f[_0x10f1('0x81')](),{'type':dbH[_0x10f1('0x82')][_0x10f1('0x83')][_0x10f1('0x9b')]});}})['then'](function(){return{'sql':_0x4bc056['toString']()};})[_0x10f1('0x24')](respondWithResult(_0x3f4753,null))[_0x10f1('0x44')](handleError(_0x3f4753,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 4f56b5c..9376dfa 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 _0x2192=['api','moment','bluebird','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x44b374,_0x597c7d){var _0x27016a=function(_0xd870e1){while(--_0xd870e1){_0x44b374['push'](_0x44b374['shift']());}};_0x27016a(++_0x597c7d);}(_0x2192,0x1a0));var _0x2219=function(_0x2f9cc4,_0x4213e8){_0x2f9cc4=_0x2f9cc4-0x0;var _0x4d90cb=_0x2192[_0x2f9cc4];return _0x4d90cb;};'use strict';var _=require(_0x2219('0x0'));var util=require(_0x2219('0x1'));var logger=require('../../config/logger')(_0x2219('0x2'));var moment=require(_0x2219('0x3'));var BPromise=require(_0x2219('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2219('0x5'));var config=require('../../config/environment');var attributes=require(_0x2219('0x6'));module[_0x2219('0x7')]=function(_0x1b28ca,_0x2dc670){return _0x1b28ca[_0x2219('0x8')](_0x2219('0x9'),attributes,{'tableName':_0x2219('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4871=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','util'];(function(_0x44278,_0x1bd66f){var _0x2d97f9=function(_0x18a1a3){while(--_0x18a1a3){_0x44278['push'](_0x44278['shift']());}};_0x2d97f9(++_0x1bd66f);}(_0x4871,0x1c7));var _0x1487=function(_0x1afc76,_0x5ad4e4){_0x1afc76=_0x1afc76-0x0;var _0x3317f0=_0x4871[_0x1afc76];return _0x3317f0;};'use strict';var _=require('lodash');var util=require(_0x1487('0x0'));var logger=require(_0x1487('0x1'))(_0x1487('0x2'));var moment=require(_0x1487('0x3'));var BPromise=require(_0x1487('0x4'));var rp=require(_0x1487('0x5'));var fs=require('fs');var path=require(_0x1487('0x6'));var rimraf=require('rimraf');var config=require(_0x1487('0x7'));var attributes=require(_0x1487('0x8'));module[_0x1487('0x9')]=function(_0x491e88,_0x3fd4fc){return _0x491e88['define'](_0x1487('0xa'),attributes,{'tableName':_0x1487('0xb'),'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 9897266..a46be8d 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 _0x2a85=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x3a235a,_0x1e593f){var _0x1a6e21=function(_0x4117fd){while(--_0x4117fd){_0x3a235a['push'](_0x3a235a['shift']());}};_0x1a6e21(++_0x1e593f);}(_0x2a85,0x1a3));var _0x52a8=function(_0xc39e33,_0x4a366d){_0xc39e33=_0xc39e33-0x0;var _0x13e072=_0x2a85[_0xc39e33];return _0x13e072;};'use strict';var _=require(_0x52a8('0x0'));var util=require('util');var moment=require(_0x52a8('0x1'));var BPromise=require(_0x52a8('0x2'));var rs=require(_0x52a8('0x3'));var fs=require('fs');var Redis=require(_0x52a8('0x4'));var db=require(_0x52a8('0x5'))['db'];var utils=require(_0x52a8('0x6'));var logger=require(_0x52a8('0x7'))('rpc');var config=require(_0x52a8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x52a8('0x9')][_0x52a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x370897,_0x3dff27,_0x3faca4){return new BPromise(function(_0x586262,_0x3dfe80){return client[_0x52a8('0xb')](_0x370897,_0x3faca4)['then'](function(_0x575e0e){logger[_0x52a8('0xc')](_0x52a8('0xd'),_0x3dff27,_0x52a8('0xe'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3dff27,'request\x20sent',JSON[_0x52a8('0xf')](_0x575e0e));if(_0x575e0e['error']){if(_0x575e0e[_0x52a8('0x10')][_0x52a8('0x11')]===0x1f4){logger['error'](_0x52a8('0xd'),_0x3dff27,_0x575e0e[_0x52a8('0x10')]['message']);return _0x3dfe80(_0x575e0e[_0x52a8('0x10')][_0x52a8('0x12')]);}logger[_0x52a8('0x10')](_0x52a8('0xd'),_0x3dff27,_0x575e0e[_0x52a8('0x10')][_0x52a8('0x12')]);return _0x586262(_0x575e0e[_0x52a8('0x10')][_0x52a8('0x12')]);}else{logger[_0x52a8('0xc')](_0x52a8('0xd'),_0x3dff27,'request\x20sent');_0x586262(_0x575e0e[_0x52a8('0x13')][_0x52a8('0x12')]);}})[_0x52a8('0x14')](function(_0x3cb67e){logger[_0x52a8('0x10')](_0x52a8('0xd'),_0x3dff27,_0x3cb67e);_0x3dfe80(_0x3cb67e);});});} \ No newline at end of file +var _0xfd34=['then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0xaf910b,_0x30f2ad){var _0x219c23=function(_0x550725){while(--_0x550725){_0xaf910b['push'](_0xaf910b['shift']());}};_0x219c23(++_0x30f2ad);}(_0xfd34,0x1d8));var _0x4fd3=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xfd34[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0x4fd3('0x0'));var util=require(_0x4fd3('0x1'));var moment=require('moment');var BPromise=require(_0x4fd3('0x2'));var rs=require(_0x4fd3('0x3'));var fs=require('fs');var Redis=require(_0x4fd3('0x4'));var db=require(_0x4fd3('0x5'))['db'];var utils=require(_0x4fd3('0x6'));var logger=require(_0x4fd3('0x7'))(_0x4fd3('0x8'));var config=require('../../config/environment');var jayson=require(_0x4fd3('0x9'));var client=jayson[_0x4fd3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5305,_0x350112,_0x2ee466){return new BPromise(function(_0x2bba5d,_0x57991d){return client[_0x4fd3('0xb')](_0x4d5305,_0x2ee466)[_0x4fd3('0xc')](function(_0x15890a){logger[_0x4fd3('0xd')](_0x4fd3('0xe'),_0x350112,_0x4fd3('0xf'));logger[_0x4fd3('0x10')](_0x4fd3('0x11'),_0x350112,_0x4fd3('0xf'),JSON['stringify'](_0x15890a));if(_0x15890a[_0x4fd3('0x12')]){if(_0x15890a[_0x4fd3('0x12')][_0x4fd3('0x13')]===0x1f4){logger[_0x4fd3('0x12')](_0x4fd3('0xe'),_0x350112,_0x15890a['error'][_0x4fd3('0x14')]);return _0x57991d(_0x15890a['error']['message']);}logger[_0x4fd3('0x12')](_0x4fd3('0xe'),_0x350112,_0x15890a['error'][_0x4fd3('0x14')]);return _0x2bba5d(_0x15890a[_0x4fd3('0x12')][_0x4fd3('0x14')]);}else{logger[_0x4fd3('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x350112,_0x4fd3('0xf'));_0x2bba5d(_0x15890a['result'][_0x4fd3('0x14')]);}})[_0x4fd3('0x15')](function(_0x130d8a){logger[_0x4fd3('0x12')](_0x4fd3('0xe'),_0x350112,_0x130d8a);_0x57991d(_0x130d8a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5b48bee..25204a0 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 _0xb438=['path','express','../../components/auth/service','./analyticCustomReport.controller','index','/:id','isAuthenticated','show','get','/:id/preview','post','put','update','destroy','exports','multer','util'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xb438,0xa8));var _0x8b43=function(_0x369835,_0x1a6067){_0x369835=_0x369835-0x0;var _0x1e8056=_0xb438[_0x369835];return _0x1e8056;};'use strict';var multer=require(_0x8b43('0x0'));var util=require(_0x8b43('0x1'));var path=require(_0x8b43('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b43('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8b43('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8b43('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b43('0x6')]);router['get'](_0x8b43('0x7'),auth[_0x8b43('0x8')](),controller[_0x8b43('0x9')]);router[_0x8b43('0xa')](_0x8b43('0xb'),auth[_0x8b43('0x8')](),controller['preview']);router[_0x8b43('0xa')]('/:id/run',auth[_0x8b43('0x8')](),controller['run']);router[_0x8b43('0xa')]('/:id/query',auth[_0x8b43('0x8')](),controller['query']);router[_0x8b43('0xc')]('/',auth[_0x8b43('0x8')](),controller['create']);router[_0x8b43('0xd')](_0x8b43('0x7'),auth[_0x8b43('0x8')](),controller[_0x8b43('0xe')]);router['delete'](_0x8b43('0x7'),auth[_0x8b43('0x8')](),controller[_0x8b43('0xf')]);module[_0x8b43('0x10')]=router; \ No newline at end of file +var _0x7dc6=['index','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x5f4552,_0xd26590){var _0x13f878=function(_0x30bf96){while(--_0x30bf96){_0x5f4552['push'](_0x5f4552['shift']());}};_0x13f878(++_0xd26590);}(_0x7dc6,0x148));var _0x67dc=function(_0x23f9da,_0x29e580){_0x23f9da=_0x23f9da-0x0;var _0x304147=_0x7dc6[_0x23f9da];return _0x304147;};'use strict';var multer=require(_0x67dc('0x0'));var util=require(_0x67dc('0x1'));var path=require(_0x67dc('0x2'));var timeout=require('connect-timeout');var express=require(_0x67dc('0x3'));var router=express[_0x67dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x67dc('0x5'));var interaction=require(_0x67dc('0x6'));var config=require('../../config/environment');var controller=require(_0x67dc('0x7'));router[_0x67dc('0x8')]('/',auth[_0x67dc('0x9')](),controller[_0x67dc('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x67dc('0xb')]);router[_0x67dc('0x8')](_0x67dc('0xc'),auth['isAuthenticated'](),controller[_0x67dc('0xd')]);router[_0x67dc('0x8')](_0x67dc('0xe'),auth[_0x67dc('0x9')](),controller[_0x67dc('0xf')]);router[_0x67dc('0x8')](_0x67dc('0x10'),auth[_0x67dc('0x9')](),controller[_0x67dc('0x11')]);router[_0x67dc('0x12')]('/',auth[_0x67dc('0x9')](),controller[_0x67dc('0x13')]);router[_0x67dc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x67dc('0x15')]);router[_0x67dc('0x16')](_0x67dc('0x17'),auth['isAuthenticated'](),controller[_0x67dc('0x18')]);module[_0x67dc('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 20ef0b7..ce19ec9 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 _0x7da7=['TEXT','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7da7,0x10d));var _0x77da=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x7da7[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x77da('0x2')]},'conditions':{'type':Sequelize[_0x77da('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x687b=['STRING','TEXT','sequelize','exports'];(function(_0x2716c6,_0x38dd17){var _0x518dc2=function(_0x36e9e9){while(--_0x36e9e9){_0x2716c6['push'](_0x2716c6['shift']());}};_0x518dc2(++_0x38dd17);}(_0x687b,0x14a));var _0xb687=function(_0x30994d,_0x2cc269){_0x30994d=_0x30994d-0x0;var _0x4554df=_0x687b[_0x30994d];return _0x4554df;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb687('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb687('0x3')]},'joins':{'type':Sequelize[_0xb687('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5107086..b880bc2 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x4b7347,_0x99c03d){var _0x1f3e9c=function(_0x17a866){while(--_0x17a866){_0x4b7347['push'](_0x4b7347['shift']());}};_0x1f3e9c(++_0x99c03d);}(_0x1967,0x173));var _0x7196=function(_0x457779,_0x103554){_0x457779=_0x457779-0x0;var _0x2f3b04=_0x1967[_0x457779];return _0x2f3b04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x17bb19,_0x22872e){var _0x582be9=function(_0x10e563){while(--_0x10e563){_0x17bb19['push'](_0x17bb19['shift']());}};_0x582be9(++_0x22872e);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 99662cc..5ae6a4f 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 _0xff7b=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports'];(function(_0x229f1a,_0x4b3e83){var _0x186647=function(_0x113238){while(--_0x113238){_0x229f1a['push'](_0x229f1a['shift']());}};_0x186647(++_0x4b3e83);}(_0xff7b,0x1ec));var _0xbff7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xff7b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbff7('0x0'));var util=require(_0xbff7('0x1'));var logger=require('../../config/logger')(_0xbff7('0x2'));var moment=require(_0xbff7('0x3'));var BPromise=require(_0xbff7('0x4'));var rp=require(_0xbff7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbff7('0x6'));var config=require(_0xbff7('0x7'));var attributes=require(_0xbff7('0x8'));module[_0xbff7('0x9')]=function(_0x585f0d,_0x23f1df){return _0x585f0d[_0xbff7('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0xbff7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6026=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports'];(function(_0x3db464,_0x53fd4e){var _0x81faa2=function(_0x98fc91){while(--_0x98fc91){_0x3db464['push'](_0x3db464['shift']());}};_0x81faa2(++_0x53fd4e);}(_0x6026,0xb6));var _0x6602=function(_0x523ff7,_0x1c1d24){_0x523ff7=_0x523ff7-0x0;var _0x34d888=_0x6026[_0x523ff7];return _0x34d888;};'use strict';var _=require(_0x6602('0x0'));var util=require(_0x6602('0x1'));var logger=require(_0x6602('0x2'))(_0x6602('0x3'));var moment=require(_0x6602('0x4'));var BPromise=require(_0x6602('0x5'));var rp=require(_0x6602('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6602('0x7'));var config=require(_0x6602('0x8'));var attributes=require(_0x6602('0x9'));module[_0x6602('0xa')]=function(_0x562ac6,_0x318f1c){return _0x562ac6['define'](_0x6602('0xb'),attributes,{'tableName':_0x6602('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 5a98557..52e04b8 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 _0x4afc=['stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x17b45f,_0x2b521f){var _0x559c2a=function(_0x49eac9){while(--_0x49eac9){_0x17b45f['push'](_0x17b45f['shift']());}};_0x559c2a(++_0x2b521f);}(_0x4afc,0x165));var _0xc4af=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x4afc[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xc4af('0x0'));var util=require(_0xc4af('0x1'));var moment=require('moment');var BPromise=require(_0xc4af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4af('0x3'));var db=require(_0xc4af('0x4'))['db'];var utils=require(_0xc4af('0x5'));var logger=require(_0xc4af('0x6'))(_0xc4af('0x7'));var config=require(_0xc4af('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc4af('0x9')][_0xc4af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e651e,_0x5b9811,_0x20e9b1){return new BPromise(function(_0x3e5fbc,_0x45923a){return client['request'](_0x1e651e,_0x20e9b1)[_0xc4af('0xb')](function(_0x14dac6){logger[_0xc4af('0xc')](_0xc4af('0xd'),_0x5b9811,_0xc4af('0xe'));logger[_0xc4af('0xf')](_0xc4af('0x10'),_0x5b9811,_0xc4af('0xe'),JSON[_0xc4af('0x11')](_0x14dac6));if(_0x14dac6['error']){if(_0x14dac6[_0xc4af('0x12')][_0xc4af('0x13')]===0x1f4){logger['error'](_0xc4af('0xd'),_0x5b9811,_0x14dac6[_0xc4af('0x12')]['message']);return _0x45923a(_0x14dac6[_0xc4af('0x12')]['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x5b9811,_0x14dac6[_0xc4af('0x12')][_0xc4af('0x14')]);return _0x3e5fbc(_0x14dac6[_0xc4af('0x12')][_0xc4af('0x14')]);}else{logger['info'](_0xc4af('0xd'),_0x5b9811,_0xc4af('0xe'));_0x3e5fbc(_0x14dac6[_0xc4af('0x15')][_0xc4af('0x14')]);}})['catch'](function(_0x457b26){logger['error'](_0xc4af('0xd'),_0x5b9811,_0x457b26);_0x45923a(_0x457b26);});});} \ No newline at end of file +var _0xef61=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xef61,0x1f3));var _0x1ef6=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xef61[_0x1778e1];return _0x2bc4c6;};'use strict';var _=require(_0x1ef6('0x0'));var util=require(_0x1ef6('0x1'));var moment=require(_0x1ef6('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ef6('0x3'));var fs=require('fs');var Redis=require(_0x1ef6('0x4'));var db=require(_0x1ef6('0x5'))['db'];var utils=require(_0x1ef6('0x6'));var logger=require(_0x1ef6('0x7'))(_0x1ef6('0x8'));var config=require('../../config/environment');var jayson=require(_0x1ef6('0x9'));var client=jayson[_0x1ef6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4489d4,_0x5888fc,_0x35090b){return new BPromise(function(_0xe5a4d8,_0x41f069){return client[_0x1ef6('0xb')](_0x4489d4,_0x35090b)[_0x1ef6('0xc')](function(_0x5194ba){logger[_0x1ef6('0xd')](_0x1ef6('0xe'),_0x5888fc,_0x1ef6('0xf'));logger[_0x1ef6('0x10')](_0x1ef6('0x11'),_0x5888fc,_0x1ef6('0xf'),JSON[_0x1ef6('0x12')](_0x5194ba));if(_0x5194ba['error']){if(_0x5194ba[_0x1ef6('0x13')][_0x1ef6('0x14')]===0x1f4){logger['error'](_0x1ef6('0xe'),_0x5888fc,_0x5194ba['error']['message']);return _0x41f069(_0x5194ba[_0x1ef6('0x13')]['message']);}logger[_0x1ef6('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5888fc,_0x5194ba[_0x1ef6('0x13')]['message']);return _0xe5a4d8(_0x5194ba['error'][_0x1ef6('0x15')]);}else{logger[_0x1ef6('0xd')](_0x1ef6('0xe'),_0x5888fc,_0x1ef6('0xf'));_0xe5a4d8(_0x5194ba[_0x1ef6('0x16')][_0x1ef6('0x15')]);}})[_0x1ef6('0x17')](function(_0x163ab1){logger[_0x1ef6('0x13')](_0x1ef6('0xe'),_0x5888fc,_0x163ab1);_0x41f069(_0x163ab1);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1f9b65e..077ba3b 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 _0xada4=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','query','post','create','put','update','destroy','exports'];(function(_0x54a7f5,_0x3617ea){var _0x3653a0=function(_0x2b886e){while(--_0x2b886e){_0x54a7f5['push'](_0x54a7f5['shift']());}};_0x3653a0(++_0x3617ea);}(_0xada4,0x96));var _0x4ada=function(_0x24383f,_0x5965eb){_0x24383f=_0x24383f-0x0;var _0x5b6cc3=_0xada4[_0x24383f];return _0x5b6cc3;};'use strict';var multer=require(_0x4ada('0x0'));var util=require(_0x4ada('0x1'));var path=require(_0x4ada('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ada('0x3'));var router=express[_0x4ada('0x4')]();var fs_extra=require(_0x4ada('0x5'));var auth=require(_0x4ada('0x6'));var interaction=require(_0x4ada('0x7'));var config=require(_0x4ada('0x8'));var controller=require(_0x4ada('0x9'));router[_0x4ada('0xa')]('/',auth[_0x4ada('0xb')](),controller[_0x4ada('0xc')]);router[_0x4ada('0xa')](_0x4ada('0xd'),auth['isAuthenticated'](),controller[_0x4ada('0xe')]);router[_0x4ada('0xa')](_0x4ada('0xf'),auth[_0x4ada('0xb')](),controller[_0x4ada('0x10')]);router['get'](_0x4ada('0x11'),auth[_0x4ada('0xb')](),controller['run']);router[_0x4ada('0xa')]('/:id/query',auth[_0x4ada('0xb')](),controller[_0x4ada('0x12')]);router[_0x4ada('0x13')]('/',auth[_0x4ada('0xb')](),controller[_0x4ada('0x14')]);router[_0x4ada('0x15')](_0x4ada('0xd'),auth[_0x4ada('0xb')](),controller[_0x4ada('0x16')]);router['delete'](_0x4ada('0xd'),auth[_0x4ada('0xb')](),controller[_0x4ada('0x17')]);module[_0x4ada('0x18')]=router; \ No newline at end of file +var _0x5b87=['Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/query','query','post','create','delete','destroy','exports','multer','util','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5b87,0x18d));var _0x75b8=function(_0x19d1f7,_0x3dbeea){_0x19d1f7=_0x19d1f7-0x0;var _0x517fbf=_0x5b87[_0x19d1f7];return _0x517fbf;};'use strict';var multer=require(_0x75b8('0x0'));var util=require(_0x75b8('0x1'));var path=require(_0x75b8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x75b8('0x3')]();var fs_extra=require(_0x75b8('0x4'));var auth=require(_0x75b8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x75b8('0x6'));router[_0x75b8('0x7')]('/',auth[_0x75b8('0x8')](),controller[_0x75b8('0x9')]);router[_0x75b8('0x7')](_0x75b8('0xa'),auth[_0x75b8('0x8')](),controller[_0x75b8('0xb')]);router['get'](_0x75b8('0xc'),auth[_0x75b8('0x8')](),controller['preview']);router['get']('/:id/run',auth[_0x75b8('0x8')](),controller['run']);router[_0x75b8('0x7')](_0x75b8('0xd'),auth['isAuthenticated'](),controller[_0x75b8('0xe')]);router[_0x75b8('0xf')]('/',auth[_0x75b8('0x8')](),controller[_0x75b8('0x10')]);router['put'](_0x75b8('0xa'),auth[_0x75b8('0x8')](),controller['update']);router[_0x75b8('0x11')](_0x75b8('0xa'),auth[_0x75b8('0x8')](),controller[_0x75b8('0x12')]);module[_0x75b8('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 11d7914..59b9f13 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 _0x58ec=['exports','STRING','ENUM','csv','DATE','Loading','manual','scheduled','UNSIGNED','sequelize','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x58ec,0x13d));var _0xc58e=function(_0x1c770c,_0x454d45){_0x1c770c=_0x1c770c-0x0;var _0x5c51a1=_0x58ec[_0x1c770c];return _0x5c51a1;};'use strict';var Sequelize=require(_0xc58e('0x0'));var moment=require(_0xc58e('0x1'));module[_0xc58e('0x2')]={'name':{'type':Sequelize[_0xc58e('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xc58e('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xc58e('0x4')](_0xc58e('0x5'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xc58e('0x5')},'savename':{'type':Sequelize[_0xc58e('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc58e('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xc58e('0x3')],'defaultValue':_0xc58e('0x7')},'type':{'type':Sequelize[_0xc58e('0x4')](_0xc58e('0x8'),_0xc58e('0x9')),'allowNull':![],'defaultValue':_0xc58e('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xc58e('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x887b=['csv','DATE','Loading','scheduled','manual','UNSIGNED','sequelize','exports','STRING','ENUM','pdf','xlsx'];(function(_0xce7ef4,_0x34bb99){var _0x418e6c=function(_0x304736){while(--_0x304736){_0xce7ef4['push'](_0xce7ef4['shift']());}};_0x418e6c(++_0x34bb99);}(_0x887b,0x13e));var _0xb887=function(_0x48d515,_0x4d0db4){_0x48d515=_0x48d515-0x0;var _0x510796=_0x887b[_0x48d515];return _0x510796;};'use strict';var Sequelize=require(_0xb887('0x0'));var moment=require('moment');module[_0xb887('0x1')]={'name':{'type':Sequelize[_0xb887('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xb887('0x3')]('csv',_0xb887('0x4'),_0xb887('0x5')),'allowNull':![],'defaultValue':_0xb887('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xb887('0x7')]},'endDate':{'type':Sequelize[_0xb887('0x7')]},'status':{'type':Sequelize[_0xb887('0x2')],'defaultValue':_0xb887('0x8')},'type':{'type':Sequelize[_0xb887('0x3')]('manual',_0xb887('0x9')),'allowNull':![],'defaultValue':_0xb887('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xb887('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 7e0741d..f26a87b 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 _0x8b8c=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','update','get','UserProfileResource','destroy','then','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','VIRTUAL','options','where','AnalyticExtractedReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','basename','toLowerCase'];(function(_0x3a9a34,_0x4f3ef0){var _0x293739=function(_0x338fce){while(--_0x338fce){_0x3a9a34['push'](_0x3a9a34['shift']());}};_0x293739(++_0x4f3ef0);}(_0x8b8c,0x126));var _0xc8b8=function(_0x3f38aa,_0x4e6b50){_0x3f38aa=_0x3f38aa-0x0;var _0x2da111=_0x8b8c[_0x3f38aa];return _0x2da111;};'use strict';var emlformat=require(_0xc8b8('0x0'));var rimraf=require(_0xc8b8('0x1'));var zipdir=require(_0xc8b8('0x2'));var jsonpatch=require(_0xc8b8('0x3'));var rp=require(_0xc8b8('0x4'));var moment=require(_0xc8b8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8b8('0x6'));var util=require(_0xc8b8('0x7'));var path=require(_0xc8b8('0x8'));var sox=require(_0xc8b8('0x9'));var csv=require(_0xc8b8('0xa'));var ejs=require(_0xc8b8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8b8('0xc'));var squel=require(_0xc8b8('0xd'));var crypto=require(_0xc8b8('0xe'));var jsforce=require(_0xc8b8('0xf'));var deskjs=require(_0xc8b8('0x10'));var toCsv=require(_0xc8b8('0xa'));var querystring=require('querystring');var Papa=require(_0xc8b8('0x11'));var Redis=require(_0xc8b8('0x12'));var authService=require(_0xc8b8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc8b8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc8b8('0x15'));var utils=require(_0xc8b8('0x16'));var config=require(_0xc8b8('0x17'));var licenseUtil=require(_0xc8b8('0x18'));var db=require(_0xc8b8('0x19'))['db'];function respondWithStatusCode(_0x2a4cef,_0x59870d){_0x59870d=_0x59870d||0xcc;return function(_0x8481db){if(_0x8481db){return _0x2a4cef[_0xc8b8('0x1a')](_0x59870d);}return _0x2a4cef[_0xc8b8('0x1b')](_0x59870d)[_0xc8b8('0x1c')]();};}function respondWithResult(_0x1f3fc7,_0xf541c7){_0xf541c7=_0xf541c7||0xc8;return function(_0x5580bd){if(_0x5580bd){return _0x1f3fc7[_0xc8b8('0x1b')](_0xf541c7)[_0xc8b8('0x1d')](_0x5580bd);}};}function respondWithFilteredResult(_0x30c1fb,_0x15634b){return function(_0x1e5b51){if(_0x1e5b51){var _0x1dd530=typeof _0x15634b[_0xc8b8('0x1e')]==='undefined'&&typeof _0x15634b['limit']===_0xc8b8('0x1f');var _0x468c65=_0x1e5b51[_0xc8b8('0x20')];var _0x23c4a4=_0x1dd530?0x0:_0x15634b['offset'];var _0x536872=_0x1dd530?_0x1e5b51[_0xc8b8('0x20')]:_0x15634b[_0xc8b8('0x1e')]+_0x15634b['limit'];var _0x26d500;if(_0x536872>=_0x468c65){_0x536872=_0x468c65;_0x26d500=0xc8;}else{_0x26d500=0xce;}_0x30c1fb['status'](_0x26d500);return _0x30c1fb['set']('Content-Range',_0x23c4a4+'-'+_0x536872+'/'+_0x468c65)[_0xc8b8('0x1d')](_0x1e5b51);}return null;};}function patchUpdates(_0x1875fa){return function(_0x1e6a85){try{jsonpatch[_0xc8b8('0x21')](_0x1e6a85,_0x1875fa,!![]);}catch(_0x309010){return BPromise['reject'](_0x309010);}return _0x1e6a85['save']();};}function saveUpdates(_0x581381,_0x9602dc){return function(_0x1576c7){if(_0x1576c7){return _0x1576c7[_0xc8b8('0x22')](_0x581381)['then'](function(_0x4c12fb){return _0x4c12fb;});}return null;};}function removeEntity(_0x58f735,_0x2a437f){return function(_0x1faa58){if(_0x1faa58){return _0x1faa58['destroy']()['then'](function(){var _0x16b7d3=_0x1faa58[_0xc8b8('0x23')]({'plain':!![]});var _0x5638d3='ExtractedReports';return db[_0xc8b8('0x24')][_0xc8b8('0x25')]({'where':{'type':_0x5638d3,'resourceId':_0x16b7d3['id']}})[_0xc8b8('0x26')](function(){return _0x1faa58;});})[_0xc8b8('0x26')](function(){_0x58f735['status'](0xcc)[_0xc8b8('0x1c')]();});}};}function handleEntityNotFound(_0x2ffa2c,_0x2067f0){return function(_0x1a4002){if(!_0x1a4002){_0x2ffa2c[_0xc8b8('0x1a')](0x194);}return _0x1a4002;};}function handleError(_0x4f2307,_0x599807){_0x599807=_0x599807||0x1f4;return function(_0x4f314e){logger['error'](_0x4f314e[_0xc8b8('0x27')]);if(_0x4f314e['name']){delete _0x4f314e[_0xc8b8('0x28')];}_0x4f2307[_0xc8b8('0x1b')](_0x599807)[_0xc8b8('0x29')](_0x4f314e);};}exports['index']=function(_0x307556,_0x3ac67d){var _0x1d3326={},_0x2661bb={},_0x5b09d5={'count':0x0,'rows':[]};var _0x1aea1a=_['map'](db['AnalyticExtractedReport'][_0xc8b8('0x2a')],function(_0x2b02b){return{'name':_0x2b02b[_0xc8b8('0x2b')],'type':_0x2b02b[_0xc8b8('0x2c')][_0xc8b8('0x2d')]};});_0x2661bb[_0xc8b8('0x2e')]=_[_0xc8b8('0x2f')](_0x1aea1a,_0xc8b8('0x28'));_0x2661bb[_0xc8b8('0x30')]=_[_0xc8b8('0x31')](_0x307556[_0xc8b8('0x30')]);_0x2661bb[_0xc8b8('0x32')]=_[_0xc8b8('0x33')](_0x2661bb[_0xc8b8('0x2e')],_0x2661bb[_0xc8b8('0x30')]);_0x1d3326['attributes']=_[_0xc8b8('0x33')](_0x2661bb[_0xc8b8('0x2e')],qs[_0xc8b8('0x34')](_0x307556['query'][_0xc8b8('0x34')]));_0x1d3326['attributes']=_0x1d3326[_0xc8b8('0x35')][_0xc8b8('0x36')]?_0x1d3326[_0xc8b8('0x35')]:_0x2661bb['model'];if(!_0x307556[_0xc8b8('0x30')][_0xc8b8('0x37')](_0xc8b8('0x38'))){_0x1d3326[_0xc8b8('0x39')]=qs[_0xc8b8('0x39')](_0x307556[_0xc8b8('0x30')]['limit']);_0x1d3326[_0xc8b8('0x1e')]=qs[_0xc8b8('0x1e')](_0x307556[_0xc8b8('0x30')]['offset']);}_0x1d3326[_0xc8b8('0x3a')]=qs[_0xc8b8('0x3b')](_0x307556[_0xc8b8('0x30')][_0xc8b8('0x3b')]);_0x1d3326['where']=qs['filters'](_[_0xc8b8('0x3c')](_0x307556[_0xc8b8('0x30')],_0x2661bb[_0xc8b8('0x32')]),_0x1aea1a);if(_0x307556[_0xc8b8('0x30')][_0xc8b8('0x3d')]){_0x1d3326['where']=_['merge'](_0x1d3326['where'],{'$or':_[_0xc8b8('0x2f')](_0x1aea1a,function(_0x527380){if(_0x527380['type']!==_0xc8b8('0x3e')){var _0xf16f63={};_0xf16f63[_0x527380[_0xc8b8('0x28')]]={'$like':'%'+_0x307556[_0xc8b8('0x30')][_0xc8b8('0x3d')]+'%'};return _0xf16f63;}})});}_0x1d3326=_['merge']({},_0x1d3326,_0x307556[_0xc8b8('0x3f')]);var _0x1aee00={'where':_0x1d3326[_0xc8b8('0x40')]};return db[_0xc8b8('0x41')][_0xc8b8('0x20')](_0x1aee00)[_0xc8b8('0x26')](function(_0x2a89e4){_0x5b09d5[_0xc8b8('0x20')]=_0x2a89e4;if(_0x307556['query']['includeAll']){_0x1d3326[_0xc8b8('0x42')]=[{'all':!![]}];}return db[_0xc8b8('0x41')][_0xc8b8('0x43')](_0x1d3326);})['then'](function(_0xc031b5){_0x5b09d5[_0xc8b8('0x44')]=_0xc031b5;return _0x5b09d5;})[_0xc8b8('0x26')](respondWithFilteredResult(_0x3ac67d,_0x1d3326))[_0xc8b8('0x45')](handleError(_0x3ac67d,null));};exports[_0xc8b8('0x46')]=function(_0x5876aa,_0x3d9136){var _0x135077={'raw':!![],'where':{'id':_0x5876aa[_0xc8b8('0x47')]['id']}},_0x5f446f={};_0x5f446f['model']=_[_0xc8b8('0x31')](db['AnalyticExtractedReport'][_0xc8b8('0x2a')]);_0x5f446f[_0xc8b8('0x30')]=_[_0xc8b8('0x31')](_0x5876aa[_0xc8b8('0x30')]);_0x5f446f[_0xc8b8('0x32')]=_[_0xc8b8('0x33')](_0x5f446f['model'],_0x5f446f['query']);_0x135077[_0xc8b8('0x35')]=_[_0xc8b8('0x33')](_0x5f446f[_0xc8b8('0x2e')],qs['fields'](_0x5876aa[_0xc8b8('0x30')][_0xc8b8('0x34')]));_0x135077[_0xc8b8('0x35')]=_0x135077['attributes'][_0xc8b8('0x36')]?_0x135077[_0xc8b8('0x35')]:_0x5f446f[_0xc8b8('0x2e')];if(_0x5876aa[_0xc8b8('0x30')][_0xc8b8('0x48')]){_0x135077[_0xc8b8('0x42')]=[{'all':!![]}];}_0x135077=_['merge']({},_0x135077,_0x5876aa[_0xc8b8('0x3f')]);return db[_0xc8b8('0x41')][_0xc8b8('0x49')](_0x135077)[_0xc8b8('0x26')](handleEntityNotFound(_0x3d9136,null))[_0xc8b8('0x26')](respondWithResult(_0x3d9136,null))['catch'](handleError(_0x3d9136,null));};exports[_0xc8b8('0x4a')]=function(_0x27156f,_0x335e6f){return db[_0xc8b8('0x41')][_0xc8b8('0x4a')](_0x27156f[_0xc8b8('0x4b')],{})[_0xc8b8('0x26')](function(_0x1c9916){var _0x5a4def=_0x27156f[_0xc8b8('0x4c')][_0xc8b8('0x23')]({'plain':!![]});if(!_0x5a4def)throw new Error(_0xc8b8('0x4d'));if(_0x5a4def[_0xc8b8('0x4e')]===_0xc8b8('0x4c')){var _0x14dbb2=_0x1c9916['get']({'plain':!![]});var _0x3da6ec=_0xc8b8('0x4f');return db[_0xc8b8('0x50')]['find']({'where':{'name':_0x3da6ec,'userProfileId':_0x5a4def[_0xc8b8('0x51')]},'raw':!![]})[_0xc8b8('0x26')](function(_0x513144){if(_0x513144&&_0x513144['autoAssociation']===0x0){return db[_0xc8b8('0x24')][_0xc8b8('0x4a')]({'name':_0x14dbb2[_0xc8b8('0x28')],'resourceId':_0x14dbb2['id'],'type':_0x513144[_0xc8b8('0x28')],'sectionId':_0x513144['id']},{})['then'](function(){return _0x1c9916;});}else{return _0x1c9916;}})[_0xc8b8('0x45')](function(_0x115bc5){logger[_0xc8b8('0x52')](_0xc8b8('0x53'),_0x115bc5);throw _0x115bc5;});}return _0x1c9916;})[_0xc8b8('0x26')](respondWithResult(_0x335e6f,0xc9))[_0xc8b8('0x45')](handleError(_0x335e6f,null));};exports[_0xc8b8('0x22')]=function(_0x3a6c58,_0x7dd15c){if(_0x3a6c58[_0xc8b8('0x4b')]['id']){delete _0x3a6c58[_0xc8b8('0x4b')]['id'];}return db[_0xc8b8('0x41')][_0xc8b8('0x49')]({'where':{'id':_0x3a6c58[_0xc8b8('0x47')]['id']}})['then'](handleEntityNotFound(_0x7dd15c,null))['then'](saveUpdates(_0x3a6c58[_0xc8b8('0x4b')],null))[_0xc8b8('0x26')](respondWithResult(_0x7dd15c,null))['catch'](handleError(_0x7dd15c,null));};exports[_0xc8b8('0x25')]=function(_0x3f9eee,_0x3bc9d8){return db['AnalyticExtractedReport'][_0xc8b8('0x49')]({'where':{'id':_0x3f9eee['params']['id']}})[_0xc8b8('0x26')](handleEntityNotFound(_0x3bc9d8,null))[_0xc8b8('0x26')](removeEntity(_0x3bc9d8,null))[_0xc8b8('0x45')](handleError(_0x3bc9d8,null));};exports[_0xc8b8('0x54')]=function(_0x251865,_0x2b4259,_0xeeb743){return db[_0xc8b8('0x41')][_0xc8b8('0x49')]({'where':{'id':_0x251865[_0xc8b8('0x47')]['id']},'attributes':[_0xc8b8('0x28'),'basename',_0xc8b8('0x55'),_0xc8b8('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x2b4259,null))['then'](function(_0xb50bbe){if(_0xb50bbe){if(!fs['existsSync'](path['join'](config[_0xc8b8('0x57')],_0xc8b8('0x58'),_0xb50bbe['savename']))){throw new db[(_0xc8b8('0x59'))][(_0xc8b8('0x5a'))](_0xc8b8('0x5b'));}if(_0x251865[_0xc8b8('0x30')][_0xc8b8('0x5c')]){return _0x2b4259['sendStatus'](0xc8);}return _0x2b4259[_0xc8b8('0x54')](path[_0xc8b8('0x5d')](config[_0xc8b8('0x57')],_0xc8b8('0x58'),_0xb50bbe[_0xc8b8('0x55')]),util[_0xc8b8('0x5e')](_0xc8b8('0x5f'),_0xb50bbe[_0xc8b8('0x60')]||_0xb50bbe[_0xc8b8('0x28')],_0xb50bbe[_0xc8b8('0x56')][_0xc8b8('0x61')]()));}})[_0xc8b8('0x45')](handleError(_0x2b4259,null));}; \ No newline at end of file +var _0x0068=['hasOwnProperty','nolimit','sort','where','filter','merge','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','basename','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','ExtractedReports','UserProfileResource','error','stack','send','index','map','AnalyticExtractedReport','type','key','query','keys','filters','intersection','model','fields','attributes'];(function(_0x5777e9,_0x4efa7c){var _0x28f943=function(_0x3427a4){while(--_0x3427a4){_0x5777e9['push'](_0x5777e9['shift']());}};_0x28f943(++_0x4efa7c);}(_0x0068,0x83));var _0x8006=function(_0x2f229a,_0x542731){_0x2f229a=_0x2f229a-0x0;var _0xdd2c1f=_0x0068[_0x2f229a];return _0xdd2c1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8006('0x0'));var zipdir=require(_0x8006('0x1'));var jsonpatch=require(_0x8006('0x2'));var rp=require(_0x8006('0x3'));var moment=require(_0x8006('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8006('0x5'));var util=require(_0x8006('0x6'));var path=require(_0x8006('0x7'));var sox=require('sox');var csv=require(_0x8006('0x8'));var ejs=require(_0x8006('0x9'));var fs=require('fs');var fs_extra=require(_0x8006('0xa'));var _=require(_0x8006('0xb'));var squel=require(_0x8006('0xc'));var crypto=require(_0x8006('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8006('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8006('0xf'));var Papa=require(_0x8006('0x10'));var Redis=require(_0x8006('0x11'));var authService=require(_0x8006('0x12'));var qs=require(_0x8006('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8006('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8006('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8006('0x16'))['db'];function respondWithStatusCode(_0x5db0fa,_0x4b9347){_0x4b9347=_0x4b9347||0xcc;return function(_0x2eada1){if(_0x2eada1){return _0x5db0fa[_0x8006('0x17')](_0x4b9347);}return _0x5db0fa['status'](_0x4b9347)[_0x8006('0x18')]();};}function respondWithResult(_0x13fe7a,_0xef857d){_0xef857d=_0xef857d||0xc8;return function(_0x240663){if(_0x240663){return _0x13fe7a[_0x8006('0x19')](_0xef857d)[_0x8006('0x1a')](_0x240663);}};}function respondWithFilteredResult(_0x568007,_0x13a31e){return function(_0xb4778b){if(_0xb4778b){var _0xc8aa70=typeof _0x13a31e[_0x8006('0x1b')]==='undefined'&&typeof _0x13a31e['limit']===_0x8006('0x1c');var _0x31efa1=_0xb4778b[_0x8006('0x1d')];var _0xe50aae=_0xc8aa70?0x0:_0x13a31e['offset'];var _0x521165=_0xc8aa70?_0xb4778b['count']:_0x13a31e['offset']+_0x13a31e[_0x8006('0x1e')];var _0x10c6cb;if(_0x521165>=_0x31efa1){_0x521165=_0x31efa1;_0x10c6cb=0xc8;}else{_0x10c6cb=0xce;}_0x568007[_0x8006('0x19')](_0x10c6cb);return _0x568007[_0x8006('0x1f')](_0x8006('0x20'),_0xe50aae+'-'+_0x521165+'/'+_0x31efa1)[_0x8006('0x1a')](_0xb4778b);}return null;};}function patchUpdates(_0x3d5c82){return function(_0x5db51b){try{jsonpatch['apply'](_0x5db51b,_0x3d5c82,!![]);}catch(_0x516eff){return BPromise[_0x8006('0x21')](_0x516eff);}return _0x5db51b[_0x8006('0x22')]();};}function saveUpdates(_0x3d04aa,_0x4e5b7d){return function(_0x12c4d4){if(_0x12c4d4){return _0x12c4d4[_0x8006('0x23')](_0x3d04aa)['then'](function(_0x4b6146){return _0x4b6146;});}return null;};}function removeEntity(_0x270308,_0x8ef762){return function(_0x461d0b){if(_0x461d0b){return _0x461d0b[_0x8006('0x24')]()[_0x8006('0x25')](function(){var _0x118d1f=_0x461d0b['get']({'plain':!![]});var _0x4966f1=_0x8006('0x26');return db[_0x8006('0x27')]['destroy']({'where':{'type':_0x4966f1,'resourceId':_0x118d1f['id']}})['then'](function(){return _0x461d0b;});})[_0x8006('0x25')](function(){_0x270308[_0x8006('0x19')](0xcc)[_0x8006('0x18')]();});}};}function handleEntityNotFound(_0x446986,_0x38cc92){return function(_0x1e279c){if(!_0x1e279c){_0x446986[_0x8006('0x17')](0x194);}return _0x1e279c;};}function handleError(_0x325d04,_0x3c0fc3){_0x3c0fc3=_0x3c0fc3||0x1f4;return function(_0x19e4ec){logger[_0x8006('0x28')](_0x19e4ec[_0x8006('0x29')]);if(_0x19e4ec['name']){delete _0x19e4ec['name'];}_0x325d04[_0x8006('0x19')](_0x3c0fc3)[_0x8006('0x2a')](_0x19e4ec);};}exports[_0x8006('0x2b')]=function(_0x5c631c,_0x38399f){var _0x4e1c92={},_0x205de7={},_0x36d7b={'count':0x0,'rows':[]};var _0x4718b4=_[_0x8006('0x2c')](db[_0x8006('0x2d')]['rawAttributes'],function(_0x164674){return{'name':_0x164674['fieldName'],'type':_0x164674[_0x8006('0x2e')][_0x8006('0x2f')]};});_0x205de7['model']=_[_0x8006('0x2c')](_0x4718b4,'name');_0x205de7[_0x8006('0x30')]=_[_0x8006('0x31')](_0x5c631c[_0x8006('0x30')]);_0x205de7[_0x8006('0x32')]=_[_0x8006('0x33')](_0x205de7[_0x8006('0x34')],_0x205de7[_0x8006('0x30')]);_0x4e1c92['attributes']=_[_0x8006('0x33')](_0x205de7[_0x8006('0x34')],qs[_0x8006('0x35')](_0x5c631c[_0x8006('0x30')][_0x8006('0x35')]));_0x4e1c92[_0x8006('0x36')]=_0x4e1c92[_0x8006('0x36')]['length']?_0x4e1c92[_0x8006('0x36')]:_0x205de7['model'];if(!_0x5c631c[_0x8006('0x30')][_0x8006('0x37')](_0x8006('0x38'))){_0x4e1c92[_0x8006('0x1e')]=qs['limit'](_0x5c631c[_0x8006('0x30')]['limit']);_0x4e1c92[_0x8006('0x1b')]=qs[_0x8006('0x1b')](_0x5c631c[_0x8006('0x30')][_0x8006('0x1b')]);}_0x4e1c92['order']=qs[_0x8006('0x39')](_0x5c631c[_0x8006('0x30')][_0x8006('0x39')]);_0x4e1c92[_0x8006('0x3a')]=qs['filters'](_['pick'](_0x5c631c[_0x8006('0x30')],_0x205de7['filters']),_0x4718b4);if(_0x5c631c['query'][_0x8006('0x3b')]){_0x4e1c92[_0x8006('0x3a')]=_[_0x8006('0x3c')](_0x4e1c92['where'],{'$or':_[_0x8006('0x2c')](_0x4718b4,function(_0xc408f0){if(_0xc408f0['type']!=='VIRTUAL'){var _0x32b65c={};_0x32b65c[_0xc408f0['name']]={'$like':'%'+_0x5c631c['query'][_0x8006('0x3b')]+'%'};return _0x32b65c;}})});}_0x4e1c92=_[_0x8006('0x3c')]({},_0x4e1c92,_0x5c631c['options']);var _0x20bd8b={'where':_0x4e1c92['where']};return db[_0x8006('0x2d')][_0x8006('0x1d')](_0x20bd8b)[_0x8006('0x25')](function(_0x4b6ee6){_0x36d7b[_0x8006('0x1d')]=_0x4b6ee6;if(_0x5c631c['query']['includeAll']){_0x4e1c92[_0x8006('0x3d')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8006('0x3e')](_0x4e1c92);})[_0x8006('0x25')](function(_0x22b9d6){_0x36d7b[_0x8006('0x3f')]=_0x22b9d6;return _0x36d7b;})[_0x8006('0x25')](respondWithFilteredResult(_0x38399f,_0x4e1c92))[_0x8006('0x40')](handleError(_0x38399f,null));};exports[_0x8006('0x41')]=function(_0x30169e,_0x6da08f){var _0x1ed26a={'raw':!![],'where':{'id':_0x30169e[_0x8006('0x42')]['id']}},_0x587229={};_0x587229[_0x8006('0x34')]=_[_0x8006('0x31')](db[_0x8006('0x2d')][_0x8006('0x43')]);_0x587229['query']=_[_0x8006('0x31')](_0x30169e[_0x8006('0x30')]);_0x587229['filters']=_[_0x8006('0x33')](_0x587229[_0x8006('0x34')],_0x587229['query']);_0x1ed26a[_0x8006('0x36')]=_[_0x8006('0x33')](_0x587229[_0x8006('0x34')],qs[_0x8006('0x35')](_0x30169e[_0x8006('0x30')][_0x8006('0x35')]));_0x1ed26a['attributes']=_0x1ed26a[_0x8006('0x36')]['length']?_0x1ed26a[_0x8006('0x36')]:_0x587229['model'];if(_0x30169e[_0x8006('0x30')][_0x8006('0x44')]){_0x1ed26a[_0x8006('0x3d')]=[{'all':!![]}];}_0x1ed26a=_[_0x8006('0x3c')]({},_0x1ed26a,_0x30169e[_0x8006('0x45')]);return db[_0x8006('0x2d')][_0x8006('0x46')](_0x1ed26a)[_0x8006('0x25')](handleEntityNotFound(_0x6da08f,null))['then'](respondWithResult(_0x6da08f,null))[_0x8006('0x40')](handleError(_0x6da08f,null));};exports[_0x8006('0x47')]=function(_0x158b8a,_0x3d8927){return db[_0x8006('0x2d')][_0x8006('0x47')](_0x158b8a[_0x8006('0x48')],{})['then'](function(_0xb31ba0){var _0x5e2697=_0x158b8a['user'][_0x8006('0x49')]({'plain':!![]});if(!_0x5e2697)throw new Error(_0x8006('0x4a'));if(_0x5e2697[_0x8006('0x4b')]==='user'){var _0x34e396=_0xb31ba0['get']({'plain':!![]});var _0x366a2b=_0x8006('0x26');return db[_0x8006('0x4c')][_0x8006('0x46')]({'where':{'name':_0x366a2b,'userProfileId':_0x5e2697['userProfileId']},'raw':!![]})[_0x8006('0x25')](function(_0x4029e2){if(_0x4029e2&&_0x4029e2[_0x8006('0x4d')]===0x0){return db[_0x8006('0x27')][_0x8006('0x47')]({'name':_0x34e396[_0x8006('0x4e')],'resourceId':_0x34e396['id'],'type':_0x4029e2['name'],'sectionId':_0x4029e2['id']},{})[_0x8006('0x25')](function(){return _0xb31ba0;});}else{return _0xb31ba0;}})['catch'](function(_0x56fc71){logger['error'](_0x8006('0x4f'),_0x56fc71);throw _0x56fc71;});}return _0xb31ba0;})[_0x8006('0x25')](respondWithResult(_0x3d8927,0xc9))['catch'](handleError(_0x3d8927,null));};exports[_0x8006('0x23')]=function(_0x5f5273,_0x170f64){if(_0x5f5273['body']['id']){delete _0x5f5273['body']['id'];}return db[_0x8006('0x2d')][_0x8006('0x46')]({'where':{'id':_0x5f5273[_0x8006('0x42')]['id']}})[_0x8006('0x25')](handleEntityNotFound(_0x170f64,null))[_0x8006('0x25')](saveUpdates(_0x5f5273[_0x8006('0x48')],null))['then'](respondWithResult(_0x170f64,null))['catch'](handleError(_0x170f64,null));};exports[_0x8006('0x24')]=function(_0x641abe,_0x30c98a){return db[_0x8006('0x2d')]['find']({'where':{'id':_0x641abe[_0x8006('0x42')]['id']}})[_0x8006('0x25')](handleEntityNotFound(_0x30c98a,null))[_0x8006('0x25')](removeEntity(_0x30c98a,null))['catch'](handleError(_0x30c98a,null));};exports[_0x8006('0x50')]=function(_0x4f8040,_0x394f0c,_0x191eff){return db['AnalyticExtractedReport'][_0x8006('0x46')]({'where':{'id':_0x4f8040[_0x8006('0x42')]['id']},'attributes':[_0x8006('0x4e'),'basename',_0x8006('0x51'),_0x8006('0x52')],'raw':!![]})[_0x8006('0x25')](handleEntityNotFound(_0x394f0c,null))['then'](function(_0xcc65f3){if(_0xcc65f3){if(!fs[_0x8006('0x53')](path[_0x8006('0x54')](config[_0x8006('0x55')],'server/files/reports',_0xcc65f3[_0x8006('0x51')]))){throw new db[(_0x8006('0x56'))]['ValidationError'](_0x8006('0x57'));}if(_0x4f8040[_0x8006('0x30')][_0x8006('0x58')]){return _0x394f0c[_0x8006('0x17')](0xc8);}return _0x394f0c[_0x8006('0x50')](path[_0x8006('0x54')](config[_0x8006('0x55')],_0x8006('0x59'),_0xcc65f3['savename']),util[_0x8006('0x5a')]('%s.%s',_0xcc65f3[_0x8006('0x5b')]||_0xcc65f3[_0x8006('0x4e')],_0xcc65f3[_0x8006('0x52')][_0x8006('0x5c')]()));}})[_0x8006('0x40')](handleError(_0x394f0c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 74068dd..73a0a11 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 _0x0b5a=['./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b5a,0x147));var _0xa0b5=function(_0x25da1e,_0x121889){_0x25da1e=_0x25da1e-0x0;var _0x827301=_0x0b5a[_0x25da1e];return _0x827301;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0b5('0x0'))('api');var moment=require(_0xa0b5('0x1'));var BPromise=require('bluebird');var rp=require(_0xa0b5('0x2'));var fs=require('fs');var path=require(_0xa0b5('0x3'));var rimraf=require(_0xa0b5('0x4'));var config=require(_0xa0b5('0x5'));var attributes=require(_0xa0b5('0x6'));module[_0xa0b5('0x7')]=function(_0x224c11,_0x2c1360){return _0x224c11['define'](_0xa0b5('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95b8=['analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x555a47,_0xc42f55){var _0x2155db=function(_0xefee7c){while(--_0xefee7c){_0x555a47['push'](_0x555a47['shift']());}};_0x2155db(++_0xc42f55);}(_0x95b8,0xb5));var _0x895b=function(_0x1c2f30,_0x53b8da){_0x1c2f30=_0x1c2f30-0x0;var _0x562241=_0x95b8[_0x1c2f30];return _0x562241;};'use strict';var _=require('lodash');var util=require(_0x895b('0x0'));var logger=require(_0x895b('0x1'))(_0x895b('0x2'));var moment=require(_0x895b('0x3'));var BPromise=require(_0x895b('0x4'));var rp=require(_0x895b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x895b('0x6'));var config=require(_0x895b('0x7'));var attributes=require(_0x895b('0x8'));module['exports']=function(_0x5e8b9c,_0x28b59a){return _0x5e8b9c['define']('AnalyticExtractedReport',attributes,{'tableName':_0x895b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 0436c3d..b3ef27a 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 _0xf7fe=['rpc','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x29ddde,_0x1e6000){var _0x41a8e4=function(_0x3c53cf){while(--_0x3c53cf){_0x29ddde['push'](_0x29ddde['shift']());}};_0x41a8e4(++_0x1e6000);}(_0xf7fe,0xe9));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef7f('0x0'));var util=require(_0xef7f('0x1'));var moment=require(_0xef7f('0x2'));var BPromise=require('bluebird');var rs=require(_0xef7f('0x3'));var fs=require('fs');var Redis=require(_0xef7f('0x4'));var db=require(_0xef7f('0x5'))['db'];var utils=require(_0xef7f('0x6'));var logger=require('../../config/logger')(_0xef7f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xef7f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a74c3,_0x21b1b9,_0x3cac6d){return new BPromise(function(_0x6b9304,_0x421ac6){return client[_0xef7f('0x9')](_0x2a74c3,_0x3cac6d)['then'](function(_0x3cfd23){logger[_0xef7f('0xa')](_0xef7f('0xb'),_0x21b1b9,_0xef7f('0xc'));logger[_0xef7f('0xd')](_0xef7f('0xe'),_0x21b1b9,_0xef7f('0xc'),JSON[_0xef7f('0xf')](_0x3cfd23));if(_0x3cfd23[_0xef7f('0x10')]){if(_0x3cfd23['error']['code']===0x1f4){logger[_0xef7f('0x10')](_0xef7f('0xb'),_0x21b1b9,_0x3cfd23[_0xef7f('0x10')]['message']);return _0x421ac6(_0x3cfd23['error'][_0xef7f('0x11')]);}logger[_0xef7f('0x10')](_0xef7f('0xb'),_0x21b1b9,_0x3cfd23['error'][_0xef7f('0x11')]);return _0x6b9304(_0x3cfd23[_0xef7f('0x10')][_0xef7f('0x11')]);}else{logger['info'](_0xef7f('0xb'),_0x21b1b9,_0xef7f('0xc'));_0x6b9304(_0x3cfd23[_0xef7f('0x12')]['message']);}})[_0xef7f('0x13')](function(_0x31781d){logger[_0xef7f('0x10')](_0xef7f('0xb'),_0x21b1b9,_0x31781d);_0x421ac6(_0x31781d);});});} \ No newline at end of file +var _0x3419=['then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x337453,_0x1b9e50){var _0x5ced1e=function(_0x3e02ab){while(--_0x3e02ab){_0x337453['push'](_0x337453['shift']());}};_0x5ced1e(++_0x1b9e50);}(_0x3419,0xb3));var _0x9341=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x3419[_0x358806];return _0x19fdcb;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var moment=require(_0x9341('0x2'));var BPromise=require(_0x9341('0x3'));var rs=require(_0x9341('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9341('0x5'))['db'];var utils=require(_0x9341('0x6'));var logger=require(_0x9341('0x7'))(_0x9341('0x8'));var config=require(_0x9341('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9341('0xa')][_0x9341('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e3e79,_0x2efc5a,_0x1c30cf){return new BPromise(function(_0x188d3b,_0x3b736e){return client[_0x9341('0xc')](_0x5e3e79,_0x1c30cf)[_0x9341('0xd')](function(_0x51826c){logger[_0x9341('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2efc5a,_0x9341('0xf'));logger[_0x9341('0x10')](_0x9341('0x11'),_0x2efc5a,'request\x20sent',JSON[_0x9341('0x12')](_0x51826c));if(_0x51826c['error']){if(_0x51826c[_0x9341('0x13')][_0x9341('0x14')]===0x1f4){logger[_0x9341('0x13')](_0x9341('0x15'),_0x2efc5a,_0x51826c['error'][_0x9341('0x16')]);return _0x3b736e(_0x51826c['error']['message']);}logger[_0x9341('0x13')](_0x9341('0x15'),_0x2efc5a,_0x51826c['error'][_0x9341('0x16')]);return _0x188d3b(_0x51826c[_0x9341('0x13')]['message']);}else{logger[_0x9341('0xe')](_0x9341('0x15'),_0x2efc5a,_0x9341('0xf'));_0x188d3b(_0x51826c['result'][_0x9341('0x16')]);}})[_0x9341('0x17')](function(_0x256b0f){logger[_0x9341('0x13')](_0x9341('0x15'),_0x2efc5a,_0x256b0f);_0x3b736e(_0x256b0f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b5159cf..abf29d6 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 _0x4f3a=['put','/:id','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','show','download','post','create'];(function(_0x35a845,_0x4c1f3a){var _0x53dfcc=function(_0x163f26){while(--_0x163f26){_0x35a845['push'](_0x35a845['shift']());}};_0x53dfcc(++_0x4c1f3a);}(_0x4f3a,0x183));var _0xa4f3=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x4f3a[_0x2085f3];return _0x384e3c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa4f3('0x0'));var timeout=require(_0xa4f3('0x1'));var express=require('express');var router=express[_0xa4f3('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa4f3('0x3'));var interaction=require(_0xa4f3('0x4'));var config=require('../../config/environment');var controller=require(_0xa4f3('0x5'));router[_0xa4f3('0x6')]('/',auth[_0xa4f3('0x7')](),controller[_0xa4f3('0x8')]);router[_0xa4f3('0x6')]('/:id',auth[_0xa4f3('0x7')](),controller[_0xa4f3('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xa4f3('0xa')]);router[_0xa4f3('0xb')]('/',auth[_0xa4f3('0x7')](),controller[_0xa4f3('0xc')]);router[_0xa4f3('0xd')](_0xa4f3('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa4f3('0xe'),auth[_0xa4f3('0x7')](),controller[_0xa4f3('0xf')]);module['exports']=router; \ No newline at end of file +var _0x53b0=['isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x53b0,0xf1));var _0x053b=function(_0x374939,_0x187929){_0x374939=_0x374939-0x0;var _0x4d2308=_0x53b0[_0x374939];return _0x4d2308;};'use strict';var multer=require('multer');var util=require(_0x053b('0x0'));var path=require(_0x053b('0x1'));var timeout=require(_0x053b('0x2'));var express=require(_0x053b('0x3'));var router=express[_0x053b('0x4')]();var fs_extra=require(_0x053b('0x5'));var auth=require(_0x053b('0x6'));var interaction=require(_0x053b('0x7'));var config=require(_0x053b('0x8'));var controller=require(_0x053b('0x9'));router[_0x053b('0xa')]('/',auth[_0x053b('0xb')](),controller['index']);router[_0x053b('0xa')](_0x053b('0xc'),auth[_0x053b('0xb')](),controller[_0x053b('0xd')]);router[_0x053b('0xa')](_0x053b('0xe'),auth[_0x053b('0xb')](),controller[_0x053b('0xf')]);router['post']('/',auth[_0x053b('0xb')](),controller[_0x053b('0x10')]);router[_0x053b('0x11')](_0x053b('0xc'),auth[_0x053b('0xb')](),controller[_0x053b('0x12')]);router[_0x053b('0x13')](_0x053b('0xc'),auth[_0x053b('0xb')](),controller[_0x053b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e739fdd..ec49dd0 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 _0x3d71=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x3d71,0x1eb));var _0x13d7=function(_0x43df87,_0x59bac7){_0x43df87=_0x43df87-0x0;var _0x49caaf=_0x3d71[_0x43df87];return _0x49caaf;};'use strict';var Sequelize=require(_0x13d7('0x0'));module[_0x13d7('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x13d7('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x13d7('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x13d7('0x2')]},'custom':{'type':Sequelize[_0x13d7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2207=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x59caeb,_0x73021e){var _0x3dbc19=function(_0x1826b8){while(--_0x1826b8){_0x59caeb['push'](_0x59caeb['shift']());}};_0x3dbc19(++_0x73021e);}(_0x2207,0xd2));var _0x7220=function(_0x577d63,_0x21cf6d){_0x577d63=_0x577d63-0x0;var _0x7bb968=_0x2207[_0x577d63];return _0x7bb968;};'use strict';var Sequelize=require(_0x7220('0x0'));module['exports']={'field':{'type':Sequelize[_0x7220('0x1')]},'alias':{'type':Sequelize[_0x7220('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7220('0x2')]},'groupBy':{'type':Sequelize[_0x7220('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x7220('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 8d102a6..628bbde 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 _0x0f2c=['status','end','json','undefined','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','params','find','create','body','bulkCreate','ids','findOne','sequelize','transaction','CustomReportId','findAll','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5c0368,_0x423cf2){var _0x5b31b9=function(_0x118b40){while(--_0x118b40){_0x5c0368['push'](_0x5c0368['shift']());}};_0x5b31b9(++_0x423cf2);}(_0x0f2c,0x125));var _0xc0f2=function(_0x41dd75,_0x5b08eb){_0x41dd75=_0x41dd75-0x0;var _0x281ffa=_0x0f2c[_0x41dd75];return _0x281ffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0f2('0x0'));var zipdir=require(_0xc0f2('0x1'));var jsonpatch=require(_0xc0f2('0x2'));var rp=require(_0xc0f2('0x3'));var moment=require('moment');var BPromise=require(_0xc0f2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc0f2('0x5'));var sox=require('sox');var csv=require(_0xc0f2('0x6'));var ejs=require(_0xc0f2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0f2('0x8'));var squel=require(_0xc0f2('0x9'));var crypto=require(_0xc0f2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc0f2('0x6'));var querystring=require('querystring');var Papa=require(_0xc0f2('0xb'));var Redis=require(_0xc0f2('0xc'));var authService=require(_0xc0f2('0xd'));var qs=require(_0xc0f2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0f2('0xf'));var logger=require(_0xc0f2('0x10'))(_0xc0f2('0x11'));var utils=require(_0xc0f2('0x12'));var config=require(_0xc0f2('0x13'));var licenseUtil=require(_0xc0f2('0x14'));var db=require(_0xc0f2('0x15'))['db'];function respondWithStatusCode(_0x3867ed,_0x4e5341){_0x4e5341=_0x4e5341||0xcc;return function(_0x1917cf){if(_0x1917cf){return _0x3867ed[_0xc0f2('0x16')](_0x4e5341);}return _0x3867ed[_0xc0f2('0x17')](_0x4e5341)[_0xc0f2('0x18')]();};}function respondWithResult(_0x3bbc33,_0x33fc7d){_0x33fc7d=_0x33fc7d||0xc8;return function(_0x10845c){if(_0x10845c){return _0x3bbc33[_0xc0f2('0x17')](_0x33fc7d)[_0xc0f2('0x19')](_0x10845c);}};}function respondWithFilteredResult(_0x59f269,_0x9e978d){return function(_0x315656){if(_0x315656){var _0x1784e0=typeof _0x9e978d['offset']==='undefined'&&typeof _0x9e978d['limit']===_0xc0f2('0x1a');var _0x1902ba=_0x315656['count'];var _0x412933=_0x1784e0?0x0:_0x9e978d[_0xc0f2('0x1b')];var _0x30ec6e=_0x1784e0?_0x315656[_0xc0f2('0x1c')]:_0x9e978d['offset']+_0x9e978d['limit'];var _0x4152f4;if(_0x30ec6e>=_0x1902ba){_0x30ec6e=_0x1902ba;_0x4152f4=0xc8;}else{_0x4152f4=0xce;}_0x59f269[_0xc0f2('0x17')](_0x4152f4);return _0x59f269[_0xc0f2('0x1d')](_0xc0f2('0x1e'),_0x412933+'-'+_0x30ec6e+'/'+_0x1902ba)['json'](_0x315656);}return null;};}function patchUpdates(_0x278a5d){return function(_0x26d030){try{jsonpatch[_0xc0f2('0x1f')](_0x26d030,_0x278a5d,!![]);}catch(_0x809eea){return BPromise[_0xc0f2('0x20')](_0x809eea);}return _0x26d030['save']();};}function saveUpdates(_0x495c11,_0x412631){return function(_0x2d429d){if(_0x2d429d){return _0x2d429d[_0xc0f2('0x21')](_0x495c11)[_0xc0f2('0x22')](function(_0x2c3d19){return _0x2c3d19;});}return null;};}function removeEntity(_0x2edb28,_0x135d80){return function(_0x30ab4f){if(_0x30ab4f){return _0x30ab4f[_0xc0f2('0x23')]()[_0xc0f2('0x22')](function(){_0x2edb28['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c72bd,_0x236301){return function(_0x1859da){if(!_0x1859da){_0x3c72bd[_0xc0f2('0x16')](0x194);}return _0x1859da;};}function handleError(_0x1a7d45,_0x66bf28){_0x66bf28=_0x66bf28||0x1f4;return function(_0x3da70b){logger[_0xc0f2('0x24')](_0x3da70b[_0xc0f2('0x25')]);if(_0x3da70b[_0xc0f2('0x26')]){delete _0x3da70b[_0xc0f2('0x26')];}_0x1a7d45['status'](_0x66bf28)[_0xc0f2('0x27')](_0x3da70b);};}exports['index']=function(_0x2578bb,_0x258b85){var _0x12614d={},_0x2f2eef={},_0x46e7f5={'count':0x0,'rows':[]};var _0x5158f5=_[_0xc0f2('0x28')](db[_0xc0f2('0x29')][_0xc0f2('0x2a')],function(_0x5bbad2){return{'name':_0x5bbad2[_0xc0f2('0x2b')],'type':_0x5bbad2[_0xc0f2('0x2c')][_0xc0f2('0x2d')]};});_0x2f2eef[_0xc0f2('0x2e')]=_['map'](_0x5158f5,_0xc0f2('0x26'));_0x2f2eef['query']=_[_0xc0f2('0x2f')](_0x2578bb[_0xc0f2('0x30')]);_0x2f2eef['filters']=_[_0xc0f2('0x31')](_0x2f2eef[_0xc0f2('0x2e')],_0x2f2eef[_0xc0f2('0x30')]);_0x12614d[_0xc0f2('0x32')]=_[_0xc0f2('0x31')](_0x2f2eef['model'],qs['fields'](_0x2578bb[_0xc0f2('0x30')][_0xc0f2('0x33')]));_0x12614d[_0xc0f2('0x32')]=_0x12614d[_0xc0f2('0x32')][_0xc0f2('0x34')]?_0x12614d[_0xc0f2('0x32')]:_0x2f2eef[_0xc0f2('0x2e')];if(!_0x2578bb[_0xc0f2('0x30')][_0xc0f2('0x35')](_0xc0f2('0x36'))){_0x12614d[_0xc0f2('0x37')]=qs['limit'](_0x2578bb['query']['limit']);_0x12614d[_0xc0f2('0x1b')]=qs[_0xc0f2('0x1b')](_0x2578bb['query'][_0xc0f2('0x1b')]);}_0x12614d[_0xc0f2('0x38')]=qs[_0xc0f2('0x39')](_0x2578bb['query']['sort']);_0x12614d[_0xc0f2('0x3a')]=qs[_0xc0f2('0x3b')](_[_0xc0f2('0x3c')](_0x2578bb[_0xc0f2('0x30')],_0x2f2eef[_0xc0f2('0x3b')]),_0x5158f5);if(_0x2578bb['query'][_0xc0f2('0x3d')]){_0x12614d['where']=_[_0xc0f2('0x3e')](_0x12614d[_0xc0f2('0x3a')],{'$or':_[_0xc0f2('0x28')](_0x5158f5,function(_0x10a5ca){if(_0x10a5ca['type']!=='VIRTUAL'){var _0x41d16e={};_0x41d16e[_0x10a5ca[_0xc0f2('0x26')]]={'$like':'%'+_0x2578bb[_0xc0f2('0x30')][_0xc0f2('0x3d')]+'%'};return _0x41d16e;}})});}_0x12614d=_[_0xc0f2('0x3e')]({},_0x12614d,_0x2578bb[_0xc0f2('0x3f')]);var _0x3735b5={'where':_0x12614d['where']};return db[_0xc0f2('0x29')]['count'](_0x3735b5)[_0xc0f2('0x22')](function(_0x6348e){_0x46e7f5[_0xc0f2('0x1c')]=_0x6348e;if(_0x2578bb[_0xc0f2('0x30')][_0xc0f2('0x40')]){_0x12614d[_0xc0f2('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x12614d);})[_0xc0f2('0x22')](function(_0x57ee7a){_0x46e7f5[_0xc0f2('0x42')]=_0x57ee7a;return _0x46e7f5;})[_0xc0f2('0x22')](respondWithFilteredResult(_0x258b85,_0x12614d))[_0xc0f2('0x43')](handleError(_0x258b85,null));};exports['show']=function(_0x532854,_0x1d586c){var _0x223728={'raw':![],'where':{'id':_0x532854[_0xc0f2('0x44')]['id']}},_0x41d4f1={};_0x41d4f1[_0xc0f2('0x2e')]=_[_0xc0f2('0x2f')](db['AnalyticFieldReport']['rawAttributes']);_0x41d4f1[_0xc0f2('0x30')]=_['keys'](_0x532854['query']);_0x41d4f1[_0xc0f2('0x3b')]=_['intersection'](_0x41d4f1['model'],_0x41d4f1[_0xc0f2('0x30')]);_0x223728['attributes']=_[_0xc0f2('0x31')](_0x41d4f1[_0xc0f2('0x2e')],qs[_0xc0f2('0x33')](_0x532854[_0xc0f2('0x30')]['fields']));_0x223728[_0xc0f2('0x32')]=_0x223728['attributes'][_0xc0f2('0x34')]?_0x223728[_0xc0f2('0x32')]:_0x41d4f1['model'];if(_0x532854[_0xc0f2('0x30')][_0xc0f2('0x40')]){_0x223728[_0xc0f2('0x41')]=[{'all':!![]}];}_0x223728=_[_0xc0f2('0x3e')]({},_0x223728,_0x532854[_0xc0f2('0x3f')]);return db['AnalyticFieldReport'][_0xc0f2('0x45')](_0x223728)['then'](handleEntityNotFound(_0x1d586c,null))[_0xc0f2('0x22')](respondWithResult(_0x1d586c,null))[_0xc0f2('0x43')](handleError(_0x1d586c,null));};exports['create']=function(_0x410b74,_0x2c241f){return db['AnalyticFieldReport'][_0xc0f2('0x46')](_0x410b74[_0xc0f2('0x47')],{})[_0xc0f2('0x22')](respondWithResult(_0x2c241f,0xc9))[_0xc0f2('0x43')](handleError(_0x2c241f,null));};exports[_0xc0f2('0x48')]=function(_0x2c1c7c,_0x194b69){return db[_0xc0f2('0x29')][_0xc0f2('0x48')](_0x2c1c7c[_0xc0f2('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x194b69,0xc9))['catch'](handleError(_0x194b69,null));};exports['update']=function(_0x2b1f0a,_0x3d5262){if(_0x2b1f0a[_0xc0f2('0x47')]['id']){delete _0x2b1f0a[_0xc0f2('0x47')]['id'];}return db[_0xc0f2('0x29')][_0xc0f2('0x45')]({'where':{'id':_0x2b1f0a[_0xc0f2('0x44')]['id']}})[_0xc0f2('0x22')](handleEntityNotFound(_0x3d5262,null))[_0xc0f2('0x22')](saveUpdates(_0x2b1f0a['body'],null))['then'](respondWithResult(_0x3d5262,null))[_0xc0f2('0x43')](handleError(_0x3d5262,null));};exports[_0xc0f2('0x23')]=function(_0x1180c4,_0x54d30e){return db[_0xc0f2('0x29')][_0xc0f2('0x45')]({'where':{'id':_0x1180c4[_0xc0f2('0x44')]['id']}})[_0xc0f2('0x22')](handleEntityNotFound(_0x54d30e,null))[_0xc0f2('0x22')](removeEntity(_0x54d30e,null))[_0xc0f2('0x43')](handleError(_0x54d30e,null));};exports['bulkDestroy']=function(_0x3fd7e0,_0x580a5){return db[_0xc0f2('0x29')][_0xc0f2('0x23')]({'where':{'id':_0x3fd7e0[_0xc0f2('0x30')][_0xc0f2('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xc0f2('0x22')](respondWithResult(_0x580a5,0xcc))[_0xc0f2('0x43')](handleError(_0x580a5,null));};exports['addFields']=function(_0x467f61,_0x2553c0,_0x55da0b){return db['AnalyticCustomReport'][_0xc0f2('0x4a')]({'where':{'id':_0x467f61[_0xc0f2('0x44')]['id']}})[_0xc0f2('0x22')](handleEntityNotFound(_0x2553c0,null))[_0xc0f2('0x22')](function(_0x3312fa){if(_0x3312fa){return db[_0xc0f2('0x4b')][_0xc0f2('0x4c')](function(_0x571506){return db[_0xc0f2('0x29')]['destroy']({'where':{'CustomReportId':_0x467f61[_0xc0f2('0x44')]['id']},'transaction':_0x571506})[_0xc0f2('0x22')](function(_0x387d9f){var _0x3dbd24=_[_0xc0f2('0x28')](_0x467f61[_0xc0f2('0x47')],function(_0x311260){delete _0x311260['id'];_0x311260[_0xc0f2('0x4d')]=_0x467f61[_0xc0f2('0x44')]['id'];return _0x311260;});return db[_0xc0f2('0x29')][_0xc0f2('0x48')](_0x3dbd24,{'transaction':_0x571506});});})[_0xc0f2('0x22')](function(){return db[_0xc0f2('0x29')][_0xc0f2('0x4e')]({'where':{'CustomReportId':_0x467f61[_0xc0f2('0x44')]['id']}});});}})[_0xc0f2('0x22')](respondWithResult(_0x2553c0,null))['catch'](handleError(_0x2553c0,null));}; \ No newline at end of file +var _0x2d44=['model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','error','stack','name','map','type','key'];(function(_0x4cd1e6,_0xb176a8){var _0xd24a00=function(_0x4d63a1){while(--_0x4d63a1){_0x4cd1e6['push'](_0x4cd1e6['shift']());}};_0xd24a00(++_0xb176a8);}(_0x2d44,0x71));var _0x42d4=function(_0x5164f6,_0x14d9cf){_0x5164f6=_0x5164f6-0x0;var _0x25430c=_0x2d44[_0x5164f6];return _0x25430c;};'use strict';var emlformat=require(_0x42d4('0x0'));var rimraf=require(_0x42d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42d4('0x2'));var rp=require(_0x42d4('0x3'));var moment=require(_0x42d4('0x4'));var BPromise=require(_0x42d4('0x5'));var Mustache=require(_0x42d4('0x6'));var util=require(_0x42d4('0x7'));var path=require(_0x42d4('0x8'));var sox=require(_0x42d4('0x9'));var csv=require(_0x42d4('0xa'));var ejs=require(_0x42d4('0xb'));var fs=require('fs');var fs_extra=require(_0x42d4('0xc'));var _=require(_0x42d4('0xd'));var squel=require(_0x42d4('0xe'));var crypto=require('crypto');var jsforce=require(_0x42d4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x42d4('0xa'));var querystring=require(_0x42d4('0x10'));var Papa=require(_0x42d4('0x11'));var Redis=require(_0x42d4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x42d4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x42d4('0x14'));var utils=require(_0x42d4('0x15'));var config=require(_0x42d4('0x16'));var licenseUtil=require(_0x42d4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7433ab,_0x4780d0){_0x4780d0=_0x4780d0||0xcc;return function(_0x36d01a){if(_0x36d01a){return _0x7433ab[_0x42d4('0x18')](_0x4780d0);}return _0x7433ab[_0x42d4('0x19')](_0x4780d0)[_0x42d4('0x1a')]();};}function respondWithResult(_0x4ff667,_0x37d275){_0x37d275=_0x37d275||0xc8;return function(_0x4d2f02){if(_0x4d2f02){return _0x4ff667[_0x42d4('0x19')](_0x37d275)['json'](_0x4d2f02);}};}function respondWithFilteredResult(_0x51efa1,_0x1b1447){return function(_0x25e62f){if(_0x25e62f){var _0x178e00=typeof _0x1b1447[_0x42d4('0x1b')]===_0x42d4('0x1c')&&typeof _0x1b1447[_0x42d4('0x1d')]===_0x42d4('0x1c');var _0xca6d=_0x25e62f[_0x42d4('0x1e')];var _0x5a047c=_0x178e00?0x0:_0x1b1447[_0x42d4('0x1b')];var _0x55b084=_0x178e00?_0x25e62f[_0x42d4('0x1e')]:_0x1b1447[_0x42d4('0x1b')]+_0x1b1447['limit'];var _0x15a87c;if(_0x55b084>=_0xca6d){_0x55b084=_0xca6d;_0x15a87c=0xc8;}else{_0x15a87c=0xce;}_0x51efa1['status'](_0x15a87c);return _0x51efa1['set'](_0x42d4('0x1f'),_0x5a047c+'-'+_0x55b084+'/'+_0xca6d)[_0x42d4('0x20')](_0x25e62f);}return null;};}function patchUpdates(_0x56a655){return function(_0xda1e88){try{jsonpatch['apply'](_0xda1e88,_0x56a655,!![]);}catch(_0x1942bc){return BPromise[_0x42d4('0x21')](_0x1942bc);}return _0xda1e88['save']();};}function saveUpdates(_0x2c6419,_0x1b0b63){return function(_0x4c9eb4){if(_0x4c9eb4){return _0x4c9eb4[_0x42d4('0x22')](_0x2c6419)[_0x42d4('0x23')](function(_0x530b5e){return _0x530b5e;});}return null;};}function removeEntity(_0x2be8f7,_0x5e9f04){return function(_0xd8ee4){if(_0xd8ee4){return _0xd8ee4[_0x42d4('0x24')]()[_0x42d4('0x23')](function(){_0x2be8f7[_0x42d4('0x19')](0xcc)[_0x42d4('0x1a')]();});}};}function handleEntityNotFound(_0x306e7f,_0x28ee87){return function(_0x3a2c55){if(!_0x3a2c55){_0x306e7f['sendStatus'](0x194);}return _0x3a2c55;};}function handleError(_0x431390,_0x42d0d7){_0x42d0d7=_0x42d0d7||0x1f4;return function(_0x357a12){logger[_0x42d4('0x25')](_0x357a12[_0x42d4('0x26')]);if(_0x357a12[_0x42d4('0x27')]){delete _0x357a12[_0x42d4('0x27')];}_0x431390[_0x42d4('0x19')](_0x42d0d7)['send'](_0x357a12);};}exports['index']=function(_0x3372cb,_0x13eea3){var _0x471059={},_0x49342f={},_0x20c982={'count':0x0,'rows':[]};var _0x5d6eb3=_[_0x42d4('0x28')](db['AnalyticFieldReport']['rawAttributes'],function(_0x2c6273){return{'name':_0x2c6273['fieldName'],'type':_0x2c6273[_0x42d4('0x29')][_0x42d4('0x2a')]};});_0x49342f[_0x42d4('0x2b')]=_[_0x42d4('0x28')](_0x5d6eb3,_0x42d4('0x27'));_0x49342f[_0x42d4('0x2c')]=_[_0x42d4('0x2d')](_0x3372cb[_0x42d4('0x2c')]);_0x49342f['filters']=_[_0x42d4('0x2e')](_0x49342f[_0x42d4('0x2b')],_0x49342f[_0x42d4('0x2c')]);_0x471059[_0x42d4('0x2f')]=_[_0x42d4('0x2e')](_0x49342f[_0x42d4('0x2b')],qs[_0x42d4('0x30')](_0x3372cb[_0x42d4('0x2c')]['fields']));_0x471059[_0x42d4('0x2f')]=_0x471059[_0x42d4('0x2f')][_0x42d4('0x31')]?_0x471059['attributes']:_0x49342f['model'];if(!_0x3372cb[_0x42d4('0x2c')]['hasOwnProperty'](_0x42d4('0x32'))){_0x471059[_0x42d4('0x1d')]=qs[_0x42d4('0x1d')](_0x3372cb[_0x42d4('0x2c')]['limit']);_0x471059[_0x42d4('0x1b')]=qs['offset'](_0x3372cb['query'][_0x42d4('0x1b')]);}_0x471059[_0x42d4('0x33')]=qs[_0x42d4('0x34')](_0x3372cb[_0x42d4('0x2c')][_0x42d4('0x34')]);_0x471059[_0x42d4('0x35')]=qs[_0x42d4('0x36')](_[_0x42d4('0x37')](_0x3372cb['query'],_0x49342f[_0x42d4('0x36')]),_0x5d6eb3);if(_0x3372cb['query'][_0x42d4('0x38')]){_0x471059[_0x42d4('0x35')]=_[_0x42d4('0x39')](_0x471059['where'],{'$or':_[_0x42d4('0x28')](_0x5d6eb3,function(_0x481752){if(_0x481752['type']!==_0x42d4('0x3a')){var _0x2a0411={};_0x2a0411[_0x481752['name']]={'$like':'%'+_0x3372cb['query'][_0x42d4('0x38')]+'%'};return _0x2a0411;}})});}_0x471059=_[_0x42d4('0x39')]({},_0x471059,_0x3372cb[_0x42d4('0x3b')]);var _0x36a87a={'where':_0x471059[_0x42d4('0x35')]};return db[_0x42d4('0x3c')][_0x42d4('0x1e')](_0x36a87a)[_0x42d4('0x23')](function(_0x425788){_0x20c982['count']=_0x425788;if(_0x3372cb[_0x42d4('0x2c')]['includeAll']){_0x471059[_0x42d4('0x3d')]=[{'all':!![]}];}return db[_0x42d4('0x3c')][_0x42d4('0x3e')](_0x471059);})['then'](function(_0x257c31){_0x20c982['rows']=_0x257c31;return _0x20c982;})['then'](respondWithFilteredResult(_0x13eea3,_0x471059))[_0x42d4('0x3f')](handleError(_0x13eea3,null));};exports[_0x42d4('0x40')]=function(_0x27650a,_0x23dd48){var _0x5838c2={'raw':![],'where':{'id':_0x27650a[_0x42d4('0x41')]['id']}},_0x31b883={};_0x31b883[_0x42d4('0x2b')]=_['keys'](db[_0x42d4('0x3c')][_0x42d4('0x42')]);_0x31b883[_0x42d4('0x2c')]=_['keys'](_0x27650a[_0x42d4('0x2c')]);_0x31b883['filters']=_[_0x42d4('0x2e')](_0x31b883[_0x42d4('0x2b')],_0x31b883[_0x42d4('0x2c')]);_0x5838c2[_0x42d4('0x2f')]=_[_0x42d4('0x2e')](_0x31b883[_0x42d4('0x2b')],qs[_0x42d4('0x30')](_0x27650a[_0x42d4('0x2c')][_0x42d4('0x30')]));_0x5838c2[_0x42d4('0x2f')]=_0x5838c2[_0x42d4('0x2f')]['length']?_0x5838c2[_0x42d4('0x2f')]:_0x31b883[_0x42d4('0x2b')];if(_0x27650a[_0x42d4('0x2c')][_0x42d4('0x43')]){_0x5838c2[_0x42d4('0x3d')]=[{'all':!![]}];}_0x5838c2=_[_0x42d4('0x39')]({},_0x5838c2,_0x27650a['options']);return db[_0x42d4('0x3c')][_0x42d4('0x44')](_0x5838c2)[_0x42d4('0x23')](handleEntityNotFound(_0x23dd48,null))[_0x42d4('0x23')](respondWithResult(_0x23dd48,null))[_0x42d4('0x3f')](handleError(_0x23dd48,null));};exports[_0x42d4('0x45')]=function(_0x216ab0,_0x2f4a02){return db[_0x42d4('0x3c')][_0x42d4('0x45')](_0x216ab0[_0x42d4('0x46')],{})[_0x42d4('0x23')](respondWithResult(_0x2f4a02,0xc9))[_0x42d4('0x3f')](handleError(_0x2f4a02,null));};exports[_0x42d4('0x47')]=function(_0x3b255a,_0x45b011){return db[_0x42d4('0x3c')]['bulkCreate'](_0x3b255a[_0x42d4('0x46')],{'raw':![],'individualHooks':!![]})[_0x42d4('0x23')](respondWithResult(_0x45b011,0xc9))['catch'](handleError(_0x45b011,null));};exports[_0x42d4('0x22')]=function(_0x2dc6d8,_0x4bbd32){if(_0x2dc6d8[_0x42d4('0x46')]['id']){delete _0x2dc6d8[_0x42d4('0x46')]['id'];}return db[_0x42d4('0x3c')][_0x42d4('0x44')]({'where':{'id':_0x2dc6d8['params']['id']}})[_0x42d4('0x23')](handleEntityNotFound(_0x4bbd32,null))[_0x42d4('0x23')](saveUpdates(_0x2dc6d8[_0x42d4('0x46')],null))['then'](respondWithResult(_0x4bbd32,null))[_0x42d4('0x3f')](handleError(_0x4bbd32,null));};exports[_0x42d4('0x24')]=function(_0x2fecae,_0x5a452d){return db[_0x42d4('0x3c')][_0x42d4('0x44')]({'where':{'id':_0x2fecae[_0x42d4('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a452d,null))['then'](removeEntity(_0x5a452d,null))[_0x42d4('0x3f')](handleError(_0x5a452d,null));};exports[_0x42d4('0x48')]=function(_0x3d0a5b,_0x20a188){return db[_0x42d4('0x3c')][_0x42d4('0x24')]({'where':{'id':_0x3d0a5b['query'][_0x42d4('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x42d4('0x23')](respondWithResult(_0x20a188,0xcc))[_0x42d4('0x3f')](handleError(_0x20a188,null));};exports[_0x42d4('0x4a')]=function(_0x55dc31,_0x39cfd4,_0x51d5d){return db[_0x42d4('0x4b')][_0x42d4('0x4c')]({'where':{'id':_0x55dc31[_0x42d4('0x41')]['id']}})[_0x42d4('0x23')](handleEntityNotFound(_0x39cfd4,null))[_0x42d4('0x23')](function(_0x31026c){if(_0x31026c){return db['sequelize'][_0x42d4('0x4d')](function(_0x152c3d){return db['AnalyticFieldReport'][_0x42d4('0x24')]({'where':{'CustomReportId':_0x55dc31[_0x42d4('0x41')]['id']},'transaction':_0x152c3d})[_0x42d4('0x23')](function(_0x3902ee){var _0x4ac7f2=_[_0x42d4('0x28')](_0x55dc31[_0x42d4('0x46')],function(_0x4c6be2){delete _0x4c6be2['id'];_0x4c6be2['CustomReportId']=_0x55dc31[_0x42d4('0x41')]['id'];return _0x4c6be2;});return db[_0x42d4('0x3c')][_0x42d4('0x47')](_0x4ac7f2,{'transaction':_0x152c3d});});})['then'](function(){return db[_0x42d4('0x3c')][_0x42d4('0x3e')]({'where':{'CustomReportId':_0x55dc31[_0x42d4('0x41')]['id']}});});}})[_0x42d4('0x23')](respondWithResult(_0x39cfd4,null))[_0x42d4('0x3f')](handleError(_0x39cfd4,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 4639b48..186953c 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 _0xfac8=['analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport'];(function(_0x2e0d54,_0x5f3292){var _0xca179f=function(_0x439b6a){while(--_0x439b6a){_0x2e0d54['push'](_0x2e0d54['shift']());}};_0xca179f(++_0x5f3292);}(_0xfac8,0xd1));var _0x8fac=function(_0x7ad6cb,_0xffee6c){_0x7ad6cb=_0x7ad6cb-0x0;var _0x22a0ba=_0xfac8[_0x7ad6cb];return _0x22a0ba;};'use strict';var _=require(_0x8fac('0x0'));var util=require('util');var logger=require(_0x8fac('0x1'))(_0x8fac('0x2'));var moment=require(_0x8fac('0x3'));var BPromise=require(_0x8fac('0x4'));var rp=require(_0x8fac('0x5'));var fs=require('fs');var path=require(_0x8fac('0x6'));var rimraf=require('rimraf');var config=require(_0x8fac('0x7'));var attributes=require(_0x8fac('0x8'));module[_0x8fac('0x9')]=function(_0x313874,_0x3032e4){return _0x313874[_0x8fac('0xa')](_0x8fac('0xb'),attributes,{'tableName':_0x8fac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf09=['util','api','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0xb7a342,_0x4f1de8){var _0x13a2bd=function(_0x2aea8f){while(--_0x2aea8f){_0xb7a342['push'](_0xb7a342['shift']());}};_0x13a2bd(++_0x4f1de8);}(_0xaf09,0x1c2));var _0x9af0=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xaf09[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x9af0('0x0'));var util=require(_0x9af0('0x1'));var logger=require('../../config/logger')(_0x9af0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9af0('0x3'));var rimraf=require(_0x9af0('0x4'));var config=require(_0x9af0('0x5'));var attributes=require(_0x9af0('0x6'));module[_0x9af0('0x7')]=function(_0x9dde94,_0x3f92f4){return _0x9dde94[_0x9af0('0x8')](_0x9af0('0x9'),attributes,{'tableName':_0x9af0('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 3396ea8..0413507 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 _0xd1e8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xd1e8,0x14e));var _0x8d1e=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xd1e8[_0x5beda8];return _0x2aa042;};'use strict';var _=require(_0x8d1e('0x0'));var util=require('util');var moment=require(_0x8d1e('0x1'));var BPromise=require(_0x8d1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d1e('0x3'));var db=require(_0x8d1e('0x4'))['db'];var utils=require(_0x8d1e('0x5'));var logger=require(_0x8d1e('0x6'))(_0x8d1e('0x7'));var config=require(_0x8d1e('0x8'));var jayson=require(_0x8d1e('0x9'));var client=jayson[_0x8d1e('0xa')][_0x8d1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2db925,_0x451af4,_0x48ad1f){return new BPromise(function(_0x5c06ef,_0x14c0f4){return client['request'](_0x2db925,_0x48ad1f)[_0x8d1e('0xc')](function(_0x4b2e3a){logger[_0x8d1e('0xd')](_0x8d1e('0xe'),_0x451af4,_0x8d1e('0xf'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x451af4,_0x8d1e('0xf'),JSON['stringify'](_0x4b2e3a));if(_0x4b2e3a[_0x8d1e('0x10')]){if(_0x4b2e3a[_0x8d1e('0x10')][_0x8d1e('0x11')]===0x1f4){logger[_0x8d1e('0x10')](_0x8d1e('0xe'),_0x451af4,_0x4b2e3a[_0x8d1e('0x10')][_0x8d1e('0x12')]);return _0x14c0f4(_0x4b2e3a['error'][_0x8d1e('0x12')]);}logger[_0x8d1e('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x451af4,_0x4b2e3a[_0x8d1e('0x10')]['message']);return _0x5c06ef(_0x4b2e3a[_0x8d1e('0x10')]['message']);}else{logger[_0x8d1e('0xd')](_0x8d1e('0xe'),_0x451af4,_0x8d1e('0xf'));_0x5c06ef(_0x4b2e3a['result'][_0x8d1e('0x12')]);}})[_0x8d1e('0x13')](function(_0x914c6d){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x451af4,_0x914c6d);_0x14c0f4(_0x914c6d);});});} \ No newline at end of file +var _0xaa31=['http','request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3ef280,_0x271105){var _0x5e00da=function(_0x1dd8d8){while(--_0x1dd8d8){_0x3ef280['push'](_0x3ef280['shift']());}};_0x5e00da(++_0x271105);}(_0xaa31,0xa6));var _0x1aa3=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xaa31[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x1aa3('0x0'));var util=require(_0x1aa3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1aa3('0x2'));var fs=require('fs');var Redis=require(_0x1aa3('0x3'));var db=require(_0x1aa3('0x4'))['db'];var utils=require(_0x1aa3('0x5'));var logger=require(_0x1aa3('0x6'))('rpc');var config=require(_0x1aa3('0x7'));var jayson=require(_0x1aa3('0x8'));var client=jayson[_0x1aa3('0x9')][_0x1aa3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x894ef3,_0x50ac59,_0x1b2fc4){return new BPromise(function(_0x33a59c,_0x4d4fe5){return client[_0x1aa3('0xb')](_0x894ef3,_0x1b2fc4)[_0x1aa3('0xc')](function(_0x52ad43){logger[_0x1aa3('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x50ac59,_0x1aa3('0xe'));logger['debug'](_0x1aa3('0xf'),_0x50ac59,'request\x20sent',JSON[_0x1aa3('0x10')](_0x52ad43));if(_0x52ad43[_0x1aa3('0x11')]){if(_0x52ad43[_0x1aa3('0x11')][_0x1aa3('0x12')]===0x1f4){logger[_0x1aa3('0x11')](_0x1aa3('0x13'),_0x50ac59,_0x52ad43[_0x1aa3('0x11')][_0x1aa3('0x14')]);return _0x4d4fe5(_0x52ad43[_0x1aa3('0x11')][_0x1aa3('0x14')]);}logger[_0x1aa3('0x11')](_0x1aa3('0x13'),_0x50ac59,_0x52ad43[_0x1aa3('0x11')][_0x1aa3('0x14')]);return _0x33a59c(_0x52ad43[_0x1aa3('0x11')][_0x1aa3('0x14')]);}else{logger[_0x1aa3('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x50ac59,_0x1aa3('0xe'));_0x33a59c(_0x52ad43['result']['message']);}})[_0x1aa3('0x15')](function(_0x55b58a){logger[_0x1aa3('0x11')](_0x1aa3('0x13'),_0x50ac59,_0x55b58a);_0x4d4fe5(_0x55b58a);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 5476c0b..e9c2e49 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(_0x53903c,_0x24556e){var _0x1066b9=function(_0x20046d){while(--_0x20046d){_0x53903c['push'](_0x53903c['shift']());}};_0x1066b9(++_0x24556e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x152e24,_0x1b80ed){var _0x3308c6=function(_0x2b5678){while(--_0x2b5678){_0x152e24['push'](_0x152e24['shift']());}};_0x3308c6(++_0x1b80ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index db267ca..7ea8a4d 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 _0x58a7=['name','TEXT','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x58a7,0xf7));var _0x758a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x58a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x758a('0x0'));module[_0x758a('0x1')]={'name':{'type':Sequelize[_0x758a('0x2')],'allowNull':![],'unique':_0x758a('0x3')},'table':{'type':Sequelize[_0x758a('0x2')]},'metric':{'type':Sequelize[_0x758a('0x4')]},'description':{'type':Sequelize[_0x758a('0x2')]}}; \ No newline at end of file +var _0xf4eb=['sequelize','TEXT'];(function(_0x2fcadc,_0x1dc842){var _0x23d314=function(_0x4d5969){while(--_0x4d5969){_0x2fcadc['push'](_0x2fcadc['shift']());}};_0x23d314(++_0x1dc842);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4ae17c,_0x538498){_0x4ae17c=_0x4ae17c-0x0;var _0x5d10bb=_0xf4eb[_0x4ae17c];return _0x5d10bb;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xbf4e('0x1')]},'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 231c353..7c2279b 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 _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x84ab,0x12f));var _0xb84a=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x84ab[_0x5b27da];return _0x3254f4;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x1d25ed,_0x2c84aa){var _0x383c67=function(_0x8134ea){while(--_0x8134ea){_0x1d25ed['push'](_0x1d25ed['shift']());}};_0x383c67(++_0x2c84aa);}(_0x5fc3,0xa8));var _0x35fc=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0x5fc3[_0x102977];return _0x15c466;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 9dea71b..226309a 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 _0xb1a3=['../../config/logger','moment','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x28e334,_0x419adf){var _0x5d65fa=function(_0x5040a6){while(--_0x5040a6){_0x28e334['push'](_0x28e334['shift']());}};_0x5d65fa(++_0x419adf);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xb1a3[_0x934425];return _0x31d596;};'use strict';var _=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var logger=require(_0x3b1a('0x2'))('api');var moment=require(_0x3b1a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b1a('0x4'));var rimraf=require(_0x3b1a('0x5'));var config=require(_0x3b1a('0x6'));var attributes=require(_0x3b1a('0x7'));module[_0x3b1a('0x8')]=function(_0xe6490d,_0x208d05){return _0xe6490d['define'](_0x3b1a('0x9'),attributes,{'tableName':_0x3b1a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84e7=['./analyticMetric.attributes','exports','define','analytics_metrics','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x84e7,0x122));var _0x784e=function(_0x362283,_0x457235){_0x362283=_0x362283-0x0;var _0x31783c=_0x84e7[_0x362283];return _0x31783c;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('AnalyticMetric',attributes,{'tableName':_0x784e('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 88f1df9..ca6ef11 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 _0x3132=['request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x4f1e9c,_0x262999){var _0x23b383=function(_0x9459cd){while(--_0x9459cd){_0x4f1e9c['push'](_0x4f1e9c['shift']());}};_0x23b383(++_0x262999);}(_0x3132,0xd6));var _0x2313=function(_0x2f888d,_0x597d3c){_0x2f888d=_0x2f888d-0x0;var _0x40f285=_0x3132[_0x2f888d];return _0x40f285;};'use strict';var _=require('lodash');var util=require(_0x2313('0x0'));var moment=require(_0x2313('0x1'));var BPromise=require('bluebird');var rs=require(_0x2313('0x2'));var fs=require('fs');var Redis=require(_0x2313('0x3'));var db=require(_0x2313('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2313('0x5'))(_0x2313('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2313('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b8134,_0x3061f7,_0xd9db7d){return new BPromise(function(_0x3d215a,_0x3a70b4){return client['request'](_0x5b8134,_0xd9db7d)['then'](function(_0x367698){logger[_0x2313('0x8')](_0x2313('0x9'),_0x3061f7,_0x2313('0xa'));logger['debug'](_0x2313('0xb'),_0x3061f7,_0x2313('0xa'),JSON[_0x2313('0xc')](_0x367698));if(_0x367698[_0x2313('0xd')]){if(_0x367698[_0x2313('0xd')][_0x2313('0xe')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3061f7,_0x367698[_0x2313('0xd')][_0x2313('0xf')]);return _0x3a70b4(_0x367698[_0x2313('0xd')][_0x2313('0xf')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3061f7,_0x367698[_0x2313('0xd')][_0x2313('0xf')]);return _0x3d215a(_0x367698[_0x2313('0xd')]['message']);}else{logger[_0x2313('0x8')]('AnalyticMetric,\x20%s,\x20%s',_0x3061f7,_0x2313('0xa'));_0x3d215a(_0x367698['result'][_0x2313('0xf')]);}})['catch'](function(_0x38d21f){logger[_0x2313('0xd')](_0x2313('0x9'),_0x3061f7,_0x38d21f);_0x3a70b4(_0x38d21f);});});} \ No newline at end of file +var _0xdeeb=['jayson/promise','client','http','request','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','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xdeeb,0xbe));var _0xbdee=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xdeeb[_0x55821d];return _0x58ea8a;};'use strict';var _=require(_0xbdee('0x0'));var util=require(_0xbdee('0x1'));var moment=require(_0xbdee('0x2'));var BPromise=require(_0xbdee('0x3'));var rs=require(_0xbdee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdee('0x5'))['db'];var utils=require(_0xbdee('0x6'));var logger=require(_0xbdee('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbdee('0x8'));var client=jayson[_0xbdee('0x9')][_0xbdee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5095e6,_0x52b812,_0x22b166){return new BPromise(function(_0x42a449,_0x300144){return client[_0xbdee('0xb')](_0x5095e6,_0x22b166)['then'](function(_0x2521c9){logger[_0xbdee('0xc')](_0xbdee('0xd'),_0x52b812,_0xbdee('0xe'));logger[_0xbdee('0xf')](_0xbdee('0x10'),_0x52b812,'request\x20sent',JSON['stringify'](_0x2521c9));if(_0x2521c9['error']){if(_0x2521c9[_0xbdee('0x11')][_0xbdee('0x12')]===0x1f4){logger[_0xbdee('0x11')](_0xbdee('0xd'),_0x52b812,_0x2521c9['error'][_0xbdee('0x13')]);return _0x300144(_0x2521c9['error']['message']);}logger[_0xbdee('0x11')](_0xbdee('0xd'),_0x52b812,_0x2521c9['error']['message']);return _0x42a449(_0x2521c9[_0xbdee('0x11')][_0xbdee('0x13')]);}else{logger[_0xbdee('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x52b812,'request\x20sent');_0x42a449(_0x2521c9[_0xbdee('0x14')]['message']);}})[_0xbdee('0x15')](function(_0x487900){logger[_0xbdee('0x11')](_0xbdee('0xd'),_0x52b812,_0x487900);_0x300144(_0x487900);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 26c7379..37e15af 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 _0xcb66=['delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x4bba2e,_0x5672a7){var _0x46efde=function(_0x7663b5){while(--_0x7663b5){_0x4bba2e['push'](_0x4bba2e['shift']());}};_0x46efde(++_0x5672a7);}(_0xcb66,0x19f));var _0x6cb6=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xcb66[_0x136619];return _0x38c4a5;};'use strict';var multer=require('multer');var util=require(_0x6cb6('0x0'));var path=require(_0x6cb6('0x1'));var timeout=require(_0x6cb6('0x2'));var express=require(_0x6cb6('0x3'));var router=express[_0x6cb6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb6('0x5'));var interaction=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var controller=require(_0x6cb6('0x8'));router[_0x6cb6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6cb6('0x9')](_0x6cb6('0xa'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xc')]);router[_0x6cb6('0xd')]('/',auth[_0x6cb6('0xb')](),controller[_0x6cb6('0xe')]);router[_0x6cb6('0xf')](_0x6cb6('0xa'),auth[_0x6cb6('0xb')](),controller[_0x6cb6('0x10')]);router[_0x6cb6('0x11')](_0x6cb6('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3eea=['get','isAuthenticated','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x1aa549,_0x16e983){var _0x50f812=function(_0x334076){while(--_0x334076){_0x1aa549['push'](_0x1aa549['shift']());}};_0x50f812(++_0x16e983);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xb19f9f,_0x52479a){_0xb19f9f=_0xb19f9f-0x0;var _0x28d54b=_0x3eea[_0xb19f9f];return _0x28d54b;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')]('/',auth[_0xa3ee('0xb')](),controller['index']);router['get'](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['post']('/',auth[_0xa3ee('0xb')](),controller['create']);router[_0xa3ee('0xe')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0xf')]);router[_0xa3ee('0x10')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('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 2c20c66..2c06c36 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 _0xfacc=['TEXT'];(function(_0x14e90f,_0x2e1597){var _0x4eb0e7=function(_0x2ec7c3){while(--_0x2ec7c3){_0x14e90f['push'](_0x14e90f['shift']());}};_0x4eb0e7(++_0x2e1597);}(_0xfacc,0x8a));var _0xcfac=function(_0x48fefe,_0x341c3f){_0x48fefe=_0x48fefe-0x0;var _0x5dd63b=_0xfacc[_0x48fefe];return _0x5dd63b;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0xcfac('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0b10=['exports','TEXT','sequelize'];(function(_0x192ba7,_0x3aca74){var _0x5aa8bb=function(_0x23e4cd){while(--_0x23e4cd){_0x192ba7['push'](_0x192ba7['shift']());}};_0x5aa8bb(++_0x3aca74);}(_0x0b10,0x10d));var _0x00b1=function(_0x35f92c,_0x32d602){_0x35f92c=_0x35f92c-0x0;var _0x4fbc8e=_0x0b10[_0x35f92c];return _0x4fbc8e;};'use strict';var Sequelize=require(_0x00b1('0x0'));module[_0x00b1('0x1')]={'tree':{'type':Sequelize[_0x00b1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 76d214e..0bda990 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 _0x64b5=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','index','map','AnalyticTreeReport','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','catch','show','params','rawAttributes','fields','length','includeAll','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x64b5,0x18d));var _0x564b=function(_0x2feda1,_0x4424bf){_0x2feda1=_0x2feda1-0x0;var _0x130dbd=_0x64b5[_0x2feda1];return _0x130dbd;};'use strict';var emlformat=require(_0x564b('0x0'));var rimraf=require(_0x564b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x564b('0x2'));var rp=require(_0x564b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x564b('0x4'));var util=require(_0x564b('0x5'));var path=require(_0x564b('0x6'));var sox=require(_0x564b('0x7'));var csv=require(_0x564b('0x8'));var ejs=require(_0x564b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x564b('0xa'));var squel=require('squel');var crypto=require(_0x564b('0xb'));var jsforce=require(_0x564b('0xc'));var deskjs=require(_0x564b('0xd'));var toCsv=require(_0x564b('0x8'));var querystring=require(_0x564b('0xe'));var Papa=require(_0x564b('0xf'));var Redis=require('ioredis');var authService=require(_0x564b('0x10'));var qs=require(_0x564b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x564b('0x12'));var logger=require(_0x564b('0x13'))('api');var utils=require(_0x564b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x564b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a53a9,_0x61c936){_0x61c936=_0x61c936||0xcc;return function(_0x313746){if(_0x313746){return _0x2a53a9[_0x564b('0x16')](_0x61c936);}return _0x2a53a9[_0x564b('0x17')](_0x61c936)[_0x564b('0x18')]();};}function respondWithResult(_0x15d208,_0x44fabb){_0x44fabb=_0x44fabb||0xc8;return function(_0x3c24a3){if(_0x3c24a3){return _0x15d208[_0x564b('0x17')](_0x44fabb)[_0x564b('0x19')](_0x3c24a3);}};}function respondWithFilteredResult(_0x4384d2,_0x2d6ed5){return function(_0x177266){if(_0x177266){var _0x443481=typeof _0x2d6ed5[_0x564b('0x1a')]===_0x564b('0x1b')&&typeof _0x2d6ed5[_0x564b('0x1c')]==='undefined';var _0x3a6780=_0x177266[_0x564b('0x1d')];var _0x4f2051=_0x443481?0x0:_0x2d6ed5[_0x564b('0x1a')];var _0x3112b4=_0x443481?_0x177266[_0x564b('0x1d')]:_0x2d6ed5[_0x564b('0x1a')]+_0x2d6ed5[_0x564b('0x1c')];var _0x3a9b75;if(_0x3112b4>=_0x3a6780){_0x3112b4=_0x3a6780;_0x3a9b75=0xc8;}else{_0x3a9b75=0xce;}_0x4384d2['status'](_0x3a9b75);return _0x4384d2[_0x564b('0x1e')]('Content-Range',_0x4f2051+'-'+_0x3112b4+'/'+_0x3a6780)['json'](_0x177266);}return null;};}function patchUpdates(_0x2df35d){return function(_0x5b378a){try{jsonpatch[_0x564b('0x1f')](_0x5b378a,_0x2df35d,!![]);}catch(_0x37c053){return BPromise[_0x564b('0x20')](_0x37c053);}return _0x5b378a[_0x564b('0x21')]();};}function saveUpdates(_0x39075a,_0x4d537e){return function(_0xdae74b){if(_0xdae74b){return _0xdae74b[_0x564b('0x22')](_0x39075a)['then'](function(_0x572418){return _0x572418;});}return null;};}function removeEntity(_0x59b751,_0x1ff6f8){return function(_0x26a710){if(_0x26a710){return _0x26a710['destroy']()[_0x564b('0x23')](function(){_0x59b751['status'](0xcc)[_0x564b('0x18')]();});}};}function handleEntityNotFound(_0x4db202,_0x9db6c3){return function(_0x36f9e7){if(!_0x36f9e7){_0x4db202[_0x564b('0x16')](0x194);}return _0x36f9e7;};}function handleError(_0xb75c9,_0x3585cf){_0x3585cf=_0x3585cf||0x1f4;return function(_0x249b97){logger['error'](_0x249b97[_0x564b('0x24')]);if(_0x249b97[_0x564b('0x25')]){delete _0x249b97[_0x564b('0x25')];}_0xb75c9[_0x564b('0x17')](_0x3585cf)['send'](_0x249b97);};}exports[_0x564b('0x26')]=function(_0x597de0,_0xd2571){var _0x560882={},_0x5ed742={},_0x41c4b3={'count':0x0,'rows':[]};var _0x3d0e24=_[_0x564b('0x27')](db[_0x564b('0x28')]['rawAttributes'],function(_0x5f31e9){return{'name':_0x5f31e9['fieldName'],'type':_0x5f31e9[_0x564b('0x29')][_0x564b('0x2a')]};});_0x5ed742[_0x564b('0x2b')]=_['map'](_0x3d0e24,_0x564b('0x25'));_0x5ed742[_0x564b('0x2c')]=_[_0x564b('0x2d')](_0x597de0['query']);_0x5ed742[_0x564b('0x2e')]=_[_0x564b('0x2f')](_0x5ed742[_0x564b('0x2b')],_0x5ed742[_0x564b('0x2c')]);_0x560882[_0x564b('0x30')]=_[_0x564b('0x2f')](_0x5ed742['model'],qs['fields'](_0x597de0[_0x564b('0x2c')]['fields']));_0x560882['attributes']=_0x560882[_0x564b('0x30')]['length']?_0x560882[_0x564b('0x30')]:_0x5ed742[_0x564b('0x2b')];if(!_0x597de0[_0x564b('0x2c')][_0x564b('0x31')]('nolimit')){_0x560882[_0x564b('0x1c')]=qs[_0x564b('0x1c')](_0x597de0[_0x564b('0x2c')][_0x564b('0x1c')]);_0x560882['offset']=qs[_0x564b('0x1a')](_0x597de0[_0x564b('0x2c')][_0x564b('0x1a')]);}_0x560882[_0x564b('0x32')]=qs[_0x564b('0x33')](_0x597de0[_0x564b('0x2c')]['sort']);_0x560882[_0x564b('0x34')]=qs['filters'](_[_0x564b('0x35')](_0x597de0[_0x564b('0x2c')],_0x5ed742[_0x564b('0x2e')]),_0x3d0e24);if(_0x597de0[_0x564b('0x2c')][_0x564b('0x36')]){_0x560882[_0x564b('0x34')]=_[_0x564b('0x37')](_0x560882[_0x564b('0x34')],{'$or':_[_0x564b('0x27')](_0x3d0e24,function(_0x4e9245){if(_0x4e9245[_0x564b('0x29')]!=='VIRTUAL'){var _0x2a567c={};_0x2a567c[_0x4e9245[_0x564b('0x25')]]={'$like':'%'+_0x597de0[_0x564b('0x2c')][_0x564b('0x36')]+'%'};return _0x2a567c;}})});}_0x560882=_[_0x564b('0x37')]({},_0x560882,_0x597de0['options']);var _0x26b410={'where':_0x560882['where']};return db['AnalyticTreeReport']['count'](_0x26b410)[_0x564b('0x23')](function(_0x4e8def){_0x41c4b3[_0x564b('0x1d')]=_0x4e8def;if(_0x597de0[_0x564b('0x2c')]['includeAll']){_0x560882[_0x564b('0x38')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x564b('0x39')](_0x560882);})[_0x564b('0x23')](function(_0x5bf303){_0x41c4b3['rows']=_0x5bf303;return _0x41c4b3;})[_0x564b('0x23')](respondWithFilteredResult(_0xd2571,_0x560882))[_0x564b('0x3a')](handleError(_0xd2571,null));};exports[_0x564b('0x3b')]=function(_0x54aefe,_0x387482){var _0x2f166e={'raw':!![],'where':{'id':_0x54aefe[_0x564b('0x3c')]['id']}},_0x3b0ecd={};_0x3b0ecd[_0x564b('0x2b')]=_['keys'](db[_0x564b('0x28')][_0x564b('0x3d')]);_0x3b0ecd['query']=_['keys'](_0x54aefe[_0x564b('0x2c')]);_0x3b0ecd['filters']=_['intersection'](_0x3b0ecd['model'],_0x3b0ecd[_0x564b('0x2c')]);_0x2f166e[_0x564b('0x30')]=_['intersection'](_0x3b0ecd[_0x564b('0x2b')],qs['fields'](_0x54aefe[_0x564b('0x2c')][_0x564b('0x3e')]));_0x2f166e[_0x564b('0x30')]=_0x2f166e['attributes'][_0x564b('0x3f')]?_0x2f166e[_0x564b('0x30')]:_0x3b0ecd[_0x564b('0x2b')];if(_0x54aefe['query'][_0x564b('0x40')]){_0x2f166e[_0x564b('0x38')]=[{'all':!![]}];}_0x2f166e=_['merge']({},_0x2f166e,_0x54aefe['options']);return db[_0x564b('0x28')][_0x564b('0x41')](_0x2f166e)[_0x564b('0x23')](handleEntityNotFound(_0x387482,null))[_0x564b('0x23')](respondWithResult(_0x387482,null))[_0x564b('0x3a')](handleError(_0x387482,null));};exports[_0x564b('0x42')]=function(_0x2169c1,_0x8f28e0){return db[_0x564b('0x28')][_0x564b('0x42')](_0x2169c1[_0x564b('0x43')],{})[_0x564b('0x23')](respondWithResult(_0x8f28e0,0xc9))['catch'](handleError(_0x8f28e0,null));};exports[_0x564b('0x22')]=function(_0x110530,_0x551044){if(_0x110530[_0x564b('0x43')]['id']){delete _0x110530[_0x564b('0x43')]['id'];}return db[_0x564b('0x28')]['find']({'where':{'id':_0x110530[_0x564b('0x3c')]['id']}})[_0x564b('0x23')](handleEntityNotFound(_0x551044,null))[_0x564b('0x23')](saveUpdates(_0x110530[_0x564b('0x43')],null))['then'](respondWithResult(_0x551044,null))['catch'](handleError(_0x551044,null));};exports[_0x564b('0x44')]=function(_0x59752b,_0xc88722){return db['AnalyticTreeReport'][_0x564b('0x41')]({'where':{'id':_0x59752b['params']['id']}})[_0x564b('0x23')](handleEntityNotFound(_0xc88722,null))[_0x564b('0x23')](removeEntity(_0xc88722,null))[_0x564b('0x3a')](handleError(_0xc88722,null));}; \ No newline at end of file +var _0xdf96=['count','Content-Range','apply','save','update','then','error','stack','name','send','index','map','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','AnalyticTreeReport','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x25f893,_0x4bac0a){var _0x130ed4=function(_0x8de3ea){while(--_0x8de3ea){_0x25f893['push'](_0x25f893['shift']());}};_0x130ed4(++_0x4bac0a);}(_0xdf96,0x1f3));var _0x6df9=function(_0x4147fd,_0x5b2258){_0x4147fd=_0x4147fd-0x0;var _0x1e0a5d=_0xdf96[_0x4147fd];return _0x1e0a5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6df9('0x0'));var zipdir=require(_0x6df9('0x1'));var jsonpatch=require(_0x6df9('0x2'));var rp=require(_0x6df9('0x3'));var moment=require('moment');var BPromise=require(_0x6df9('0x4'));var Mustache=require(_0x6df9('0x5'));var util=require(_0x6df9('0x6'));var path=require(_0x6df9('0x7'));var sox=require(_0x6df9('0x8'));var csv=require(_0x6df9('0x9'));var ejs=require(_0x6df9('0xa'));var fs=require('fs');var fs_extra=require(_0x6df9('0xb'));var _=require(_0x6df9('0xc'));var squel=require(_0x6df9('0xd'));var crypto=require(_0x6df9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6df9('0xf'));var Papa=require(_0x6df9('0x10'));var Redis=require(_0x6df9('0x11'));var authService=require(_0x6df9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6df9('0x13'));var hardwareService=require(_0x6df9('0x14'));var logger=require('../../config/logger')(_0x6df9('0x15'));var utils=require(_0x6df9('0x16'));var config=require(_0x6df9('0x17'));var licenseUtil=require(_0x6df9('0x18'));var db=require(_0x6df9('0x19'))['db'];function respondWithStatusCode(_0x514afb,_0x2524ef){_0x2524ef=_0x2524ef||0xcc;return function(_0xd0ab51){if(_0xd0ab51){return _0x514afb[_0x6df9('0x1a')](_0x2524ef);}return _0x514afb[_0x6df9('0x1b')](_0x2524ef)[_0x6df9('0x1c')]();};}function respondWithResult(_0x285f49,_0x59b700){_0x59b700=_0x59b700||0xc8;return function(_0xa1ddd5){if(_0xa1ddd5){return _0x285f49[_0x6df9('0x1b')](_0x59b700)[_0x6df9('0x1d')](_0xa1ddd5);}};}function respondWithFilteredResult(_0x2df81c,_0x1aaaa1){return function(_0x246414){if(_0x246414){var _0x1f12be=typeof _0x1aaaa1[_0x6df9('0x1e')]===_0x6df9('0x1f')&&typeof _0x1aaaa1[_0x6df9('0x20')]===_0x6df9('0x1f');var _0x2887dc=_0x246414[_0x6df9('0x21')];var _0x5649e8=_0x1f12be?0x0:_0x1aaaa1[_0x6df9('0x1e')];var _0x3cdcbd=_0x1f12be?_0x246414[_0x6df9('0x21')]:_0x1aaaa1['offset']+_0x1aaaa1[_0x6df9('0x20')];var _0x159c69;if(_0x3cdcbd>=_0x2887dc){_0x3cdcbd=_0x2887dc;_0x159c69=0xc8;}else{_0x159c69=0xce;}_0x2df81c['status'](_0x159c69);return _0x2df81c['set'](_0x6df9('0x22'),_0x5649e8+'-'+_0x3cdcbd+'/'+_0x2887dc)[_0x6df9('0x1d')](_0x246414);}return null;};}function patchUpdates(_0x172c1c){return function(_0x20897f){try{jsonpatch[_0x6df9('0x23')](_0x20897f,_0x172c1c,!![]);}catch(_0x2633ff){return BPromise['reject'](_0x2633ff);}return _0x20897f[_0x6df9('0x24')]();};}function saveUpdates(_0x7c7445,_0x557560){return function(_0x3b07f9){if(_0x3b07f9){return _0x3b07f9[_0x6df9('0x25')](_0x7c7445)[_0x6df9('0x26')](function(_0x1de2a6){return _0x1de2a6;});}return null;};}function removeEntity(_0x5dadf9,_0x1466a4){return function(_0xe68b2a){if(_0xe68b2a){return _0xe68b2a['destroy']()[_0x6df9('0x26')](function(){_0x5dadf9[_0x6df9('0x1b')](0xcc)[_0x6df9('0x1c')]();});}};}function handleEntityNotFound(_0x1e1840,_0x5b5007){return function(_0xca6d0e){if(!_0xca6d0e){_0x1e1840[_0x6df9('0x1a')](0x194);}return _0xca6d0e;};}function handleError(_0x53705e,_0x36a76b){_0x36a76b=_0x36a76b||0x1f4;return function(_0x18127a){logger[_0x6df9('0x27')](_0x18127a[_0x6df9('0x28')]);if(_0x18127a['name']){delete _0x18127a[_0x6df9('0x29')];}_0x53705e[_0x6df9('0x1b')](_0x36a76b)[_0x6df9('0x2a')](_0x18127a);};}exports[_0x6df9('0x2b')]=function(_0xb10b05,_0x12ce66){var _0x4db168={},_0x162a0c={},_0x5d2d7c={'count':0x0,'rows':[]};var _0x36de54=_[_0x6df9('0x2c')](db['AnalyticTreeReport']['rawAttributes'],function(_0x235785){return{'name':_0x235785[_0x6df9('0x2d')],'type':_0x235785[_0x6df9('0x2e')]['key']};});_0x162a0c[_0x6df9('0x2f')]=_[_0x6df9('0x2c')](_0x36de54,_0x6df9('0x29'));_0x162a0c[_0x6df9('0x30')]=_['keys'](_0xb10b05[_0x6df9('0x30')]);_0x162a0c[_0x6df9('0x31')]=_['intersection'](_0x162a0c[_0x6df9('0x2f')],_0x162a0c[_0x6df9('0x30')]);_0x4db168[_0x6df9('0x32')]=_[_0x6df9('0x33')](_0x162a0c['model'],qs[_0x6df9('0x34')](_0xb10b05['query'][_0x6df9('0x34')]));_0x4db168['attributes']=_0x4db168[_0x6df9('0x32')]['length']?_0x4db168[_0x6df9('0x32')]:_0x162a0c[_0x6df9('0x2f')];if(!_0xb10b05[_0x6df9('0x30')][_0x6df9('0x35')](_0x6df9('0x36'))){_0x4db168[_0x6df9('0x20')]=qs[_0x6df9('0x20')](_0xb10b05[_0x6df9('0x30')]['limit']);_0x4db168[_0x6df9('0x1e')]=qs[_0x6df9('0x1e')](_0xb10b05[_0x6df9('0x30')][_0x6df9('0x1e')]);}_0x4db168[_0x6df9('0x37')]=qs[_0x6df9('0x38')](_0xb10b05[_0x6df9('0x30')][_0x6df9('0x38')]);_0x4db168[_0x6df9('0x39')]=qs[_0x6df9('0x31')](_[_0x6df9('0x3a')](_0xb10b05[_0x6df9('0x30')],_0x162a0c[_0x6df9('0x31')]),_0x36de54);if(_0xb10b05[_0x6df9('0x30')][_0x6df9('0x3b')]){_0x4db168[_0x6df9('0x39')]=_['merge'](_0x4db168[_0x6df9('0x39')],{'$or':_['map'](_0x36de54,function(_0x348cf6){if(_0x348cf6[_0x6df9('0x2e')]!=='VIRTUAL'){var _0x28cd9a={};_0x28cd9a[_0x348cf6[_0x6df9('0x29')]]={'$like':'%'+_0xb10b05['query'][_0x6df9('0x3b')]+'%'};return _0x28cd9a;}})});}_0x4db168=_[_0x6df9('0x3c')]({},_0x4db168,_0xb10b05[_0x6df9('0x3d')]);var _0x53119b={'where':_0x4db168[_0x6df9('0x39')]};return db[_0x6df9('0x3e')][_0x6df9('0x21')](_0x53119b)[_0x6df9('0x26')](function(_0x22d701){_0x5d2d7c[_0x6df9('0x21')]=_0x22d701;if(_0xb10b05[_0x6df9('0x30')][_0x6df9('0x3f')]){_0x4db168['include']=[{'all':!![]}];}return db[_0x6df9('0x3e')][_0x6df9('0x40')](_0x4db168);})['then'](function(_0x101604){_0x5d2d7c[_0x6df9('0x41')]=_0x101604;return _0x5d2d7c;})[_0x6df9('0x26')](respondWithFilteredResult(_0x12ce66,_0x4db168))[_0x6df9('0x42')](handleError(_0x12ce66,null));};exports[_0x6df9('0x43')]=function(_0x31a33f,_0x4026b3){var _0x1e5b24={'raw':!![],'where':{'id':_0x31a33f[_0x6df9('0x44')]['id']}},_0x417c79={};_0x417c79['model']=_[_0x6df9('0x45')](db['AnalyticTreeReport'][_0x6df9('0x46')]);_0x417c79['query']=_[_0x6df9('0x45')](_0x31a33f['query']);_0x417c79[_0x6df9('0x31')]=_[_0x6df9('0x33')](_0x417c79[_0x6df9('0x2f')],_0x417c79[_0x6df9('0x30')]);_0x1e5b24[_0x6df9('0x32')]=_[_0x6df9('0x33')](_0x417c79['model'],qs['fields'](_0x31a33f[_0x6df9('0x30')]['fields']));_0x1e5b24['attributes']=_0x1e5b24['attributes'][_0x6df9('0x47')]?_0x1e5b24[_0x6df9('0x32')]:_0x417c79[_0x6df9('0x2f')];if(_0x31a33f[_0x6df9('0x30')][_0x6df9('0x3f')]){_0x1e5b24[_0x6df9('0x48')]=[{'all':!![]}];}_0x1e5b24=_[_0x6df9('0x3c')]({},_0x1e5b24,_0x31a33f[_0x6df9('0x3d')]);return db['AnalyticTreeReport'][_0x6df9('0x49')](_0x1e5b24)[_0x6df9('0x26')](handleEntityNotFound(_0x4026b3,null))[_0x6df9('0x26')](respondWithResult(_0x4026b3,null))[_0x6df9('0x42')](handleError(_0x4026b3,null));};exports['create']=function(_0x2dee66,_0x357eb8){return db[_0x6df9('0x3e')][_0x6df9('0x4a')](_0x2dee66[_0x6df9('0x4b')],{})[_0x6df9('0x26')](respondWithResult(_0x357eb8,0xc9))[_0x6df9('0x42')](handleError(_0x357eb8,null));};exports['update']=function(_0xf262f7,_0x17dfb1){if(_0xf262f7['body']['id']){delete _0xf262f7[_0x6df9('0x4b')]['id'];}return db[_0x6df9('0x3e')][_0x6df9('0x49')]({'where':{'id':_0xf262f7[_0x6df9('0x44')]['id']}})[_0x6df9('0x26')](handleEntityNotFound(_0x17dfb1,null))[_0x6df9('0x26')](saveUpdates(_0xf262f7[_0x6df9('0x4b')],null))[_0x6df9('0x26')](respondWithResult(_0x17dfb1,null))[_0x6df9('0x42')](handleError(_0x17dfb1,null));};exports['destroy']=function(_0x5b6d5b,_0xf83e29){return db['AnalyticTreeReport'][_0x6df9('0x49')]({'where':{'id':_0x5b6d5b['params']['id']}})['then'](handleEntityNotFound(_0xf83e29,null))[_0x6df9('0x26')](removeEntity(_0xf83e29,null))[_0x6df9('0x42')](handleError(_0xf83e29,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 7b0dcee..799babc 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 _0x091d=['./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x091d,0xdc));var _0xd091=function(_0x4f7cef,_0x28eaee){_0x4f7cef=_0x4f7cef-0x0;var _0x5a87e8=_0x091d[_0x4f7cef];return _0x5a87e8;};'use strict';var _=require(_0xd091('0x0'));var util=require('util');var logger=require(_0xd091('0x1'))(_0xd091('0x2'));var moment=require(_0xd091('0x3'));var BPromise=require('bluebird');var rp=require(_0xd091('0x4'));var fs=require('fs');var path=require(_0xd091('0x5'));var rimraf=require(_0xd091('0x6'));var config=require(_0xd091('0x7'));var attributes=require(_0xd091('0x8'));module[_0xd091('0x9')]=function(_0x3521dc,_0x4693c1){return _0x3521dc[_0xd091('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xd091('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbe9=['bluebird','request-promise','rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport','lodash','util','moment'];(function(_0x1d734a,_0xf7cfec){var _0x3eef41=function(_0x5a8d18){while(--_0x5a8d18){_0x1d734a['push'](_0x1d734a['shift']());}};_0x3eef41(++_0xf7cfec);}(_0xbbe9,0x138));var _0x9bbe=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbbe9[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x9bbe('0x0'));var util=require(_0x9bbe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9bbe('0x2'));var BPromise=require(_0x9bbe('0x3'));var rp=require(_0x9bbe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bbe('0x5'));var config=require('../../config/environment');var attributes=require(_0x9bbe('0x6'));module['exports']=function(_0x8495f4,_0x3d3227){return _0x8495f4[_0x9bbe('0x7')](_0x9bbe('0x8'),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 a777666..3bc5ee8 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4ea0f7,_0x4f1b31){var _0xc028b5=function(_0x4f21f9){while(--_0x4f21f9){_0x4ea0f7['push'](_0x4ea0f7['shift']());}};_0xc028b5(++_0x4f1b31);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _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(_0x241e61,_0x51e5ea){var _0x409de4=function(_0x1ccc72){while(--_0x1ccc72){_0x241e61['push'](_0x241e61['shift']());}};_0x409de4(++_0x51e5ea);}(_0xadb5,0xad));var _0x5adb=function(_0x2e439f,_0x13de74){_0x2e439f=_0x2e439f-0x0;var _0x4d7080=_0xadb5[_0x2e439f];return _0x4d7080;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 832087f..b5452f3 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 _0x5654=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','post','create','delete','destroy','exports','multer','util','path'];(function(_0xc4a608,_0x45fecd){var _0x5e2730=function(_0x38c3c5){while(--_0x38c3c5){_0xc4a608['push'](_0xc4a608['shift']());}};_0x5e2730(++_0x45fecd);}(_0x5654,0x12f));var _0x4565=function(_0x2d2823,_0x578be6){_0x2d2823=_0x2d2823-0x0;var _0x4c78e0=_0x5654[_0x2d2823];return _0x4c78e0;};'use strict';var multer=require(_0x4565('0x0'));var util=require(_0x4565('0x1'));var path=require(_0x4565('0x2'));var timeout=require(_0x4565('0x3'));var express=require('express');var router=express[_0x4565('0x4')]();var fs_extra=require(_0x4565('0x5'));var auth=require(_0x4565('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4565('0x7'));var controller=require(_0x4565('0x8'));router[_0x4565('0x9')]('/',auth['isAuthenticated'](),controller[_0x4565('0xa')]);router['get'](_0x4565('0xb'),auth[_0x4565('0xc')](),controller['show']);router[_0x4565('0xd')]('/',auth[_0x4565('0xc')](),controller[_0x4565('0xe')]);router['put'](_0x4565('0xb'),auth[_0x4565('0xc')](),controller['update']);router[_0x4565('0xf')](_0x4565('0xb'),auth[_0x4565('0xc')](),controller[_0x4565('0x10')]);module[_0x4565('0x11')]=router; \ No newline at end of file +var _0x2b77=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','util','connect-timeout','express','fs-extra'];(function(_0x5a852b,_0x1694c2){var _0xd74d84=function(_0x170a6d){while(--_0x170a6d){_0x5a852b['push'](_0x5a852b['shift']());}};_0xd74d84(++_0x1694c2);}(_0x2b77,0xce));var _0x72b7=function(_0x4ac3db,_0x1560f6){_0x4ac3db=_0x4ac3db-0x0;var _0x298c73=_0x2b77[_0x4ac3db];return _0x298c73;};'use strict';var multer=require('multer');var util=require(_0x72b7('0x0'));var path=require('path');var timeout=require(_0x72b7('0x1'));var express=require(_0x72b7('0x2'));var router=express['Router']();var fs_extra=require(_0x72b7('0x3'));var auth=require(_0x72b7('0x4'));var interaction=require(_0x72b7('0x5'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x72b7('0x6')]('/',auth[_0x72b7('0x7')](),controller['index']);router[_0x72b7('0x6')]('/:id',auth[_0x72b7('0x7')](),controller[_0x72b7('0x8')]);router[_0x72b7('0x9')]('/',auth[_0x72b7('0x7')](),controller[_0x72b7('0xa')]);router['put'](_0x72b7('0xb'),auth[_0x72b7('0x7')](),controller['update']);router[_0x72b7('0xc')](_0x72b7('0xb'),auth[_0x72b7('0x7')](),controller[_0x72b7('0xd')]);module[_0x72b7('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 b95ca2b..07d0e9c 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 _0xd66c=['sequelize','STRING'];(function(_0x1cc160,_0x29f228){var _0xc83051=function(_0x1cc984){while(--_0x1cc984){_0x1cc160['push'](_0x1cc160['shift']());}};_0xc83051(++_0x29f228);}(_0xd66c,0x106));var _0xcd66=function(_0x11d2ce,_0xca0de4){_0x11d2ce=_0x11d2ce-0x0;var _0x570671=_0xd66c[_0x11d2ce];return _0x570671;};'use strict';var Sequelize=require(_0xcd66('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd66('0x1')]},'basename':{'type':Sequelize[_0xcd66('0x1')]},'type':{'type':Sequelize[_0xcd66('0x1')]}}; \ No newline at end of file +var _0xbbfa=['STRING','sequelize'];(function(_0x16f584,_0x59daab){var _0x2a4101=function(_0x839fb5){while(--_0x839fb5){_0x16f584['push'](_0x16f584['shift']());}};_0x2a4101(++_0x59daab);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x3edc22,_0x243990){_0x3edc22=_0x3edc22-0x0;var _0x1ddf50=_0xbbfa[_0x3edc22];return _0x1ddf50;};'use strict';var Sequelize=require(_0xabbf('0x0'));module['exports']={'name':{'type':Sequelize[_0xabbf('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xabbf('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3416a01..04d1458 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 _0x16c2=['keys','filters','attributes','intersection','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','download','root','server/files/attachments/','offline-chat/','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','status','end','error','stack','name','send','Attachment','rawAttributes','fieldName','type','model','map','query'];(function(_0x41063c,_0x13b225){var _0x2eb8b6=function(_0x3044fc){while(--_0x3044fc){_0x41063c['push'](_0x41063c['shift']());}};_0x2eb8b6(++_0x13b225);}(_0x16c2,0x7e));var _0x216c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16c2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x216c('0x0'));var rimraf=require(_0x216c('0x1'));var zipdir=require(_0x216c('0x2'));var jsonpatch=require(_0x216c('0x3'));var rp=require(_0x216c('0x4'));var moment=require(_0x216c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x216c('0x6'));var util=require(_0x216c('0x7'));var path=require(_0x216c('0x8'));var sox=require(_0x216c('0x9'));var csv=require(_0x216c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x216c('0xb'));var _=require(_0x216c('0xc'));var squel=require(_0x216c('0xd'));var crypto=require('crypto');var jsforce=require(_0x216c('0xe'));var deskjs=require(_0x216c('0xf'));var toCsv=require(_0x216c('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x216c('0x10'));var authService=require(_0x216c('0x11'));var qs=require(_0x216c('0x12'));var as=require(_0x216c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x216c('0x14'))(_0x216c('0x15'));var utils=require(_0x216c('0x16'));var config=require(_0x216c('0x17'));var licenseUtil=require(_0x216c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371934,_0xd5fd26){_0xd5fd26=_0xd5fd26||0xcc;return function(_0x3966d2){if(_0x3966d2){return _0x371934[_0x216c('0x19')](_0xd5fd26);}return _0x371934['status'](_0xd5fd26)['end']();};}function respondWithResult(_0x2b824c,_0x6f9029){_0x6f9029=_0x6f9029||0xc8;return function(_0x34d58a){if(_0x34d58a){return _0x2b824c['status'](_0x6f9029)[_0x216c('0x1a')](_0x34d58a);}};}function respondWithFilteredResult(_0x3e866e,_0x1b4584){return function(_0x1fa940){if(_0x1fa940){var _0x5300b5=typeof _0x1b4584[_0x216c('0x1b')]===_0x216c('0x1c')&&typeof _0x1b4584['limit']===_0x216c('0x1c');var _0x107525=_0x1fa940[_0x216c('0x1d')];var _0x44c1a9=_0x5300b5?0x0:_0x1b4584[_0x216c('0x1b')];var _0x1037b1=_0x5300b5?_0x1fa940['count']:_0x1b4584[_0x216c('0x1b')]+_0x1b4584['limit'];var _0x1783ae;if(_0x1037b1>=_0x107525){_0x1037b1=_0x107525;_0x1783ae=0xc8;}else{_0x1783ae=0xce;}_0x3e866e['status'](_0x1783ae);return _0x3e866e[_0x216c('0x1e')]('Content-Range',_0x44c1a9+'-'+_0x1037b1+'/'+_0x107525)['json'](_0x1fa940);}return null;};}function patchUpdates(_0x182466){return function(_0x20b46b){try{jsonpatch[_0x216c('0x1f')](_0x20b46b,_0x182466,!![]);}catch(_0x563d2e){return BPromise[_0x216c('0x20')](_0x563d2e);}return _0x20b46b[_0x216c('0x21')]();};}function saveUpdates(_0x19c5a6,_0x2454e4){return function(_0x45b99f){if(_0x45b99f){return _0x45b99f[_0x216c('0x22')](_0x19c5a6)[_0x216c('0x23')](function(_0x37a2cf){return _0x37a2cf;});}return null;};}function removeEntity(_0x3b908b,_0x27cb5e){return function(_0x5db09b){if(_0x5db09b){return _0x5db09b[_0x216c('0x24')]()[_0x216c('0x23')](function(){_0x3b908b[_0x216c('0x25')](0xcc)[_0x216c('0x26')]();});}};}function handleEntityNotFound(_0x3cdd23,_0x1acb73){return function(_0x34a7e0){if(!_0x34a7e0){_0x3cdd23[_0x216c('0x19')](0x194);}return _0x34a7e0;};}function handleError(_0x14194f,_0x95f252){_0x95f252=_0x95f252||0x1f4;return function(_0x28341d){logger[_0x216c('0x27')](_0x28341d[_0x216c('0x28')]);if(_0x28341d[_0x216c('0x29')]){delete _0x28341d[_0x216c('0x29')];}_0x14194f[_0x216c('0x25')](_0x95f252)[_0x216c('0x2a')](_0x28341d);};}exports['index']=function(_0x115026,_0x438c13){var _0x2e90aa={},_0x325d64={},_0x15226a={'count':0x0,'rows':[]};var _0x37ac77=_['map'](db[_0x216c('0x2b')][_0x216c('0x2c')],function(_0x19e7e2){return{'name':_0x19e7e2[_0x216c('0x2d')],'type':_0x19e7e2[_0x216c('0x2e')]['key']};});_0x325d64[_0x216c('0x2f')]=_[_0x216c('0x30')](_0x37ac77,_0x216c('0x29'));_0x325d64[_0x216c('0x31')]=_[_0x216c('0x32')](_0x115026[_0x216c('0x31')]);_0x325d64[_0x216c('0x33')]=_['intersection'](_0x325d64[_0x216c('0x2f')],_0x325d64[_0x216c('0x31')]);_0x2e90aa[_0x216c('0x34')]=_[_0x216c('0x35')](_0x325d64[_0x216c('0x2f')],qs['fields'](_0x115026['query']['fields']));_0x2e90aa[_0x216c('0x34')]=_0x2e90aa['attributes'][_0x216c('0x36')]?_0x2e90aa['attributes']:_0x325d64['model'];if(!_0x115026['query'][_0x216c('0x37')]('nolimit')){_0x2e90aa[_0x216c('0x38')]=qs[_0x216c('0x38')](_0x115026[_0x216c('0x31')][_0x216c('0x38')]);_0x2e90aa[_0x216c('0x1b')]=qs[_0x216c('0x1b')](_0x115026[_0x216c('0x31')]['offset']);}_0x2e90aa['order']=qs[_0x216c('0x39')](_0x115026[_0x216c('0x31')][_0x216c('0x39')]);_0x2e90aa[_0x216c('0x3a')]=qs[_0x216c('0x33')](_[_0x216c('0x3b')](_0x115026['query'],_0x325d64[_0x216c('0x33')]),_0x37ac77);if(_0x115026[_0x216c('0x31')][_0x216c('0x3c')]){_0x2e90aa[_0x216c('0x3a')]=_[_0x216c('0x3d')](_0x2e90aa[_0x216c('0x3a')],{'$or':_['map'](_0x37ac77,function(_0x40982a){if(_0x40982a[_0x216c('0x2e')]!==_0x216c('0x3e')){var _0x401667={};_0x401667[_0x40982a['name']]={'$like':'%'+_0x115026[_0x216c('0x31')][_0x216c('0x3c')]+'%'};return _0x401667;}})});}_0x2e90aa=_['merge']({},_0x2e90aa,_0x115026[_0x216c('0x3f')]);var _0x394718={'where':_0x2e90aa[_0x216c('0x3a')]};return db[_0x216c('0x2b')][_0x216c('0x1d')](_0x394718)['then'](function(_0x4f5cc9){_0x15226a[_0x216c('0x1d')]=_0x4f5cc9;if(_0x115026[_0x216c('0x31')][_0x216c('0x40')]){_0x2e90aa[_0x216c('0x41')]=[{'all':!![]}];}return db[_0x216c('0x2b')][_0x216c('0x42')](_0x2e90aa);})[_0x216c('0x23')](function(_0x5c12ff){_0x15226a[_0x216c('0x43')]=_0x5c12ff;return _0x15226a;})[_0x216c('0x23')](respondWithFilteredResult(_0x438c13,_0x2e90aa))[_0x216c('0x44')](handleError(_0x438c13,null));};exports[_0x216c('0x45')]=function(_0x42fefa,_0x2c1244){var _0xc80adc={'raw':!![],'where':{'id':_0x42fefa[_0x216c('0x46')]['id']}},_0x592a37={};_0x592a37[_0x216c('0x2f')]=_[_0x216c('0x32')](db[_0x216c('0x2b')][_0x216c('0x2c')]);_0x592a37[_0x216c('0x31')]=_[_0x216c('0x32')](_0x42fefa['query']);_0x592a37[_0x216c('0x33')]=_[_0x216c('0x35')](_0x592a37[_0x216c('0x2f')],_0x592a37['query']);_0xc80adc[_0x216c('0x34')]=_[_0x216c('0x35')](_0x592a37['model'],qs[_0x216c('0x47')](_0x42fefa['query'][_0x216c('0x47')]));_0xc80adc[_0x216c('0x34')]=_0xc80adc[_0x216c('0x34')][_0x216c('0x36')]?_0xc80adc[_0x216c('0x34')]:_0x592a37[_0x216c('0x2f')];if(_0x42fefa[_0x216c('0x31')]['includeAll']){_0xc80adc[_0x216c('0x41')]=[{'all':!![]}];}_0xc80adc=_[_0x216c('0x3d')]({},_0xc80adc,_0x42fefa[_0x216c('0x3f')]);return db[_0x216c('0x2b')][_0x216c('0x48')](_0xc80adc)[_0x216c('0x23')](handleEntityNotFound(_0x2c1244,null))[_0x216c('0x23')](respondWithResult(_0x2c1244,null))[_0x216c('0x44')](handleError(_0x2c1244,null));};exports['clone']=function(_0x4abe8c,_0x5eb8c7){var _0x4781d2={'where':{'id':_0x4abe8c['params']['id']}},_0x564185={};_0x564185[_0x216c('0x2f')]=_['keys'](db[_0x216c('0x2b')][_0x216c('0x2c')]);_0x4781d2[_0x216c('0x34')]=_['intersection'](_0x564185[_0x216c('0x2f')],qs[_0x216c('0x47')](_0x4abe8c[_0x216c('0x31')][_0x216c('0x47')]));_0x4781d2['attributes']=_0x4781d2['attributes'][_0x216c('0x36')]?_0x4781d2['attributes']:_0x564185[_0x216c('0x2f')];if(_0x4abe8c[_0x216c('0x31')][_0x216c('0x40')]){_0x4781d2[_0x216c('0x41')]=[{'all':!![]}];}_0x4781d2=_[_0x216c('0x3d')]({},_0x4781d2,_0x4abe8c['options']);return db['Attachment'][_0x216c('0x48')](_0x4781d2)[_0x216c('0x23')](handleEntityNotFound(_0x5eb8c7,null))[_0x216c('0x23')](function(_0x46dc5e){if(_0x46dc5e){var _0x406f57=_0x46dc5e[_0x216c('0x49')]({'plain':!![]});_0x406f57=qs['omit'](_0x406f57,['id',_0x216c('0x4a'),_0x216c('0x4b')]);_0x4abe8c[_0x216c('0x4c')]=_[_0x216c('0x4d')](_0x4abe8c['body'],['id','createdAt',_0x216c('0x4b')]);return db['Attachment'][_0x216c('0x4e')](_[_0x216c('0x3d')](_0x406f57,_0x4abe8c[_0x216c('0x4c')]),{'include':_0x4abe8c[_0x216c('0x31')][_0x216c('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5eb8c7,0xc9))['catch'](handleError(_0x5eb8c7,null));};exports['update']=function(_0x2e1a57,_0x3abc94){if(_0x2e1a57[_0x216c('0x4c')]['id']){delete _0x2e1a57['body']['id'];}return db[_0x216c('0x2b')]['find']({'where':{'id':_0x2e1a57[_0x216c('0x46')]['id']}})[_0x216c('0x23')](handleEntityNotFound(_0x3abc94,null))['then'](saveUpdates(_0x2e1a57['body'],null))['then'](respondWithResult(_0x3abc94,null))[_0x216c('0x44')](handleError(_0x3abc94,null));};exports['destroy']=function(_0x4ebf8b,_0x4a0e64){return db[_0x216c('0x2b')][_0x216c('0x48')]({'where':{'id':_0x4ebf8b['params']['id']}})['then'](handleEntityNotFound(_0x4a0e64,null))[_0x216c('0x23')](removeEntity(_0x4a0e64,null))[_0x216c('0x44')](handleError(_0x4a0e64,null));};exports[_0x216c('0x4e')]=function(_0x234a5e,_0x3d591c,_0x5a8d7b){_0x234a5e[_0x216c('0x4c')][_0x216c('0x29')]=_0x234a5e[_0x216c('0x4f')][_0x216c('0x50')];_0x234a5e[_0x216c('0x4c')][_0x216c('0x51')]=_0x234a5e[_0x216c('0x4f')][_0x216c('0x52')];_0x234a5e[_0x216c('0x4c')][_0x216c('0x2e')]=_0x234a5e[_0x216c('0x4f')]['mimetype'];return db[_0x216c('0x2b')][_0x216c('0x4e')](_0x234a5e[_0x216c('0x4c')])[_0x216c('0x23')](respondWithResult(_0x3d591c,0xc9))[_0x216c('0x44')](handleError(_0x3d591c,null));};exports[_0x216c('0x53')]=function(_0x3b8c0f,_0x28765c,_0x5aecf8){return db[_0x216c('0x2b')]['findOne']({'where':{'id':_0x3b8c0f[_0x216c('0x46')]['id']},'raw':!![]})[_0x216c('0x23')](handleEntityNotFound(_0x28765c,null))['then'](function(_0x1ed18c){if(_0x1ed18c){var _0x4c420d=_0x1ed18c['ChatOfflineMessageId']!==null;var _0x5e3d8a=path['join'](config[_0x216c('0x54')],_0x216c('0x55'));if(_0x4c420d){_0x5e3d8a=path['join'](_0x5e3d8a,_0x216c('0x56'));}var _0x581813=path[_0x216c('0x57')](_0x5e3d8a,_0x1ed18c['basename']);return _0x28765c[_0x216c('0x53')](_0x581813);}})['catch'](handleError(_0x28765c,null));}; \ No newline at end of file +var _0xc8f8=['VIRTUAL','options','count','includeAll','include','Attachment','findAll','rows','show','params','catch','clone','rawAttributes','find','get','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','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/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge'];(function(_0x5abf47,_0x2b2e0e){var _0x578c43=function(_0x57fda5){while(--_0x57fda5){_0x5abf47['push'](_0x5abf47['shift']());}};_0x578c43(++_0x2b2e0e);}(_0xc8f8,0x133));var _0x8c8f=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xc8f8[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0x8c8f('0x0'));var rimraf=require(_0x8c8f('0x1'));var zipdir=require(_0x8c8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c8f('0x3'));var moment=require('moment');var BPromise=require(_0x8c8f('0x4'));var Mustache=require('mustache');var util=require(_0x8c8f('0x5'));var path=require(_0x8c8f('0x6'));var sox=require(_0x8c8f('0x7'));var csv=require(_0x8c8f('0x8'));var ejs=require(_0x8c8f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c8f('0xa'));var crypto=require(_0x8c8f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8c8f('0xc'));var toCsv=require(_0x8c8f('0x8'));var querystring=require(_0x8c8f('0xd'));var Papa=require(_0x8c8f('0xe'));var Redis=require(_0x8c8f('0xf'));var authService=require(_0x8c8f('0x10'));var qs=require(_0x8c8f('0x11'));var as=require(_0x8c8f('0x12'));var hardwareService=require(_0x8c8f('0x13'));var logger=require(_0x8c8f('0x14'))(_0x8c8f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8c8f('0x16'));var db=require(_0x8c8f('0x17'))['db'];function respondWithStatusCode(_0x155f84,_0x518459){_0x518459=_0x518459||0xcc;return function(_0x120f38){if(_0x120f38){return _0x155f84[_0x8c8f('0x18')](_0x518459);}return _0x155f84[_0x8c8f('0x19')](_0x518459)[_0x8c8f('0x1a')]();};}function respondWithResult(_0x47f4c6,_0x187495){_0x187495=_0x187495||0xc8;return function(_0x2192c7){if(_0x2192c7){return _0x47f4c6[_0x8c8f('0x19')](_0x187495)[_0x8c8f('0x1b')](_0x2192c7);}};}function respondWithFilteredResult(_0x5e44b8,_0x284869){return function(_0x1f0515){if(_0x1f0515){var _0x57d887=typeof _0x284869[_0x8c8f('0x1c')]===_0x8c8f('0x1d')&&typeof _0x284869[_0x8c8f('0x1e')]===_0x8c8f('0x1d');var _0x2f227f=_0x1f0515['count'];var _0x6d472c=_0x57d887?0x0:_0x284869['offset'];var _0x45b4a5=_0x57d887?_0x1f0515['count']:_0x284869[_0x8c8f('0x1c')]+_0x284869[_0x8c8f('0x1e')];var _0x541936;if(_0x45b4a5>=_0x2f227f){_0x45b4a5=_0x2f227f;_0x541936=0xc8;}else{_0x541936=0xce;}_0x5e44b8[_0x8c8f('0x19')](_0x541936);return _0x5e44b8[_0x8c8f('0x1f')](_0x8c8f('0x20'),_0x6d472c+'-'+_0x45b4a5+'/'+_0x2f227f)['json'](_0x1f0515);}return null;};}function patchUpdates(_0x4793d4){return function(_0x54c72d){try{jsonpatch[_0x8c8f('0x21')](_0x54c72d,_0x4793d4,!![]);}catch(_0x3ebc6c){return BPromise[_0x8c8f('0x22')](_0x3ebc6c);}return _0x54c72d[_0x8c8f('0x23')]();};}function saveUpdates(_0x515253,_0x4e719d){return function(_0x121470){if(_0x121470){return _0x121470[_0x8c8f('0x24')](_0x515253)['then'](function(_0x578c26){return _0x578c26;});}return null;};}function removeEntity(_0x4c8bc9,_0x35cc9b){return function(_0x1f22ec){if(_0x1f22ec){return _0x1f22ec['destroy']()[_0x8c8f('0x25')](function(){_0x4c8bc9[_0x8c8f('0x19')](0xcc)[_0x8c8f('0x1a')]();});}};}function handleEntityNotFound(_0x49bbcc,_0x1ccd79){return function(_0x3afab7){if(!_0x3afab7){_0x49bbcc[_0x8c8f('0x18')](0x194);}return _0x3afab7;};}function handleError(_0x2119f6,_0x592395){_0x592395=_0x592395||0x1f4;return function(_0x124638){logger[_0x8c8f('0x26')](_0x124638[_0x8c8f('0x27')]);if(_0x124638[_0x8c8f('0x28')]){delete _0x124638[_0x8c8f('0x28')];}_0x2119f6[_0x8c8f('0x19')](_0x592395)[_0x8c8f('0x29')](_0x124638);};}exports['index']=function(_0x2e8527,_0x45d3cf){var _0x48d009={},_0x1b264b={},_0x34eaaf={'count':0x0,'rows':[]};var _0xf9913a=_[_0x8c8f('0x2a')](db['Attachment']['rawAttributes'],function(_0x4fe226){return{'name':_0x4fe226[_0x8c8f('0x2b')],'type':_0x4fe226[_0x8c8f('0x2c')][_0x8c8f('0x2d')]};});_0x1b264b['model']=_['map'](_0xf9913a,'name');_0x1b264b[_0x8c8f('0x2e')]=_[_0x8c8f('0x2f')](_0x2e8527[_0x8c8f('0x2e')]);_0x1b264b['filters']=_[_0x8c8f('0x30')](_0x1b264b[_0x8c8f('0x31')],_0x1b264b[_0x8c8f('0x2e')]);_0x48d009['attributes']=_['intersection'](_0x1b264b[_0x8c8f('0x31')],qs[_0x8c8f('0x32')](_0x2e8527[_0x8c8f('0x2e')]['fields']));_0x48d009[_0x8c8f('0x33')]=_0x48d009[_0x8c8f('0x33')][_0x8c8f('0x34')]?_0x48d009[_0x8c8f('0x33')]:_0x1b264b[_0x8c8f('0x31')];if(!_0x2e8527[_0x8c8f('0x2e')][_0x8c8f('0x35')](_0x8c8f('0x36'))){_0x48d009[_0x8c8f('0x1e')]=qs[_0x8c8f('0x1e')](_0x2e8527[_0x8c8f('0x2e')][_0x8c8f('0x1e')]);_0x48d009[_0x8c8f('0x1c')]=qs[_0x8c8f('0x1c')](_0x2e8527[_0x8c8f('0x2e')][_0x8c8f('0x1c')]);}_0x48d009['order']=qs['sort'](_0x2e8527[_0x8c8f('0x2e')][_0x8c8f('0x37')]);_0x48d009[_0x8c8f('0x38')]=qs['filters'](_[_0x8c8f('0x39')](_0x2e8527['query'],_0x1b264b[_0x8c8f('0x3a')]),_0xf9913a);if(_0x2e8527[_0x8c8f('0x2e')][_0x8c8f('0x3b')]){_0x48d009[_0x8c8f('0x38')]=_[_0x8c8f('0x3c')](_0x48d009[_0x8c8f('0x38')],{'$or':_['map'](_0xf9913a,function(_0x25e97f){if(_0x25e97f[_0x8c8f('0x2c')]!==_0x8c8f('0x3d')){var _0x1179e3={};_0x1179e3[_0x25e97f['name']]={'$like':'%'+_0x2e8527[_0x8c8f('0x2e')][_0x8c8f('0x3b')]+'%'};return _0x1179e3;}})});}_0x48d009=_[_0x8c8f('0x3c')]({},_0x48d009,_0x2e8527[_0x8c8f('0x3e')]);var _0x3ed4ac={'where':_0x48d009[_0x8c8f('0x38')]};return db['Attachment'][_0x8c8f('0x3f')](_0x3ed4ac)[_0x8c8f('0x25')](function(_0x3271bb){_0x34eaaf[_0x8c8f('0x3f')]=_0x3271bb;if(_0x2e8527[_0x8c8f('0x2e')][_0x8c8f('0x40')]){_0x48d009[_0x8c8f('0x41')]=[{'all':!![]}];}return db[_0x8c8f('0x42')][_0x8c8f('0x43')](_0x48d009);})[_0x8c8f('0x25')](function(_0x1e74d9){_0x34eaaf[_0x8c8f('0x44')]=_0x1e74d9;return _0x34eaaf;})[_0x8c8f('0x25')](respondWithFilteredResult(_0x45d3cf,_0x48d009))['catch'](handleError(_0x45d3cf,null));};exports[_0x8c8f('0x45')]=function(_0x312a5a,_0x10ed2a){var _0x444e14={'raw':!![],'where':{'id':_0x312a5a[_0x8c8f('0x46')]['id']}},_0x11ea86={};_0x11ea86['model']=_[_0x8c8f('0x2f')](db[_0x8c8f('0x42')]['rawAttributes']);_0x11ea86['query']=_['keys'](_0x312a5a[_0x8c8f('0x2e')]);_0x11ea86[_0x8c8f('0x3a')]=_['intersection'](_0x11ea86['model'],_0x11ea86[_0x8c8f('0x2e')]);_0x444e14[_0x8c8f('0x33')]=_[_0x8c8f('0x30')](_0x11ea86[_0x8c8f('0x31')],qs[_0x8c8f('0x32')](_0x312a5a[_0x8c8f('0x2e')][_0x8c8f('0x32')]));_0x444e14[_0x8c8f('0x33')]=_0x444e14[_0x8c8f('0x33')][_0x8c8f('0x34')]?_0x444e14['attributes']:_0x11ea86['model'];if(_0x312a5a[_0x8c8f('0x2e')]['includeAll']){_0x444e14['include']=[{'all':!![]}];}_0x444e14=_[_0x8c8f('0x3c')]({},_0x444e14,_0x312a5a['options']);return db['Attachment']['find'](_0x444e14)[_0x8c8f('0x25')](handleEntityNotFound(_0x10ed2a,null))[_0x8c8f('0x25')](respondWithResult(_0x10ed2a,null))[_0x8c8f('0x47')](handleError(_0x10ed2a,null));};exports[_0x8c8f('0x48')]=function(_0x4aa69f,_0x19479d){var _0xab9c0d={'where':{'id':_0x4aa69f['params']['id']}},_0x3f2e5b={};_0x3f2e5b['model']=_[_0x8c8f('0x2f')](db[_0x8c8f('0x42')][_0x8c8f('0x49')]);_0xab9c0d[_0x8c8f('0x33')]=_[_0x8c8f('0x30')](_0x3f2e5b[_0x8c8f('0x31')],qs[_0x8c8f('0x32')](_0x4aa69f[_0x8c8f('0x2e')]['fields']));_0xab9c0d[_0x8c8f('0x33')]=_0xab9c0d[_0x8c8f('0x33')][_0x8c8f('0x34')]?_0xab9c0d[_0x8c8f('0x33')]:_0x3f2e5b[_0x8c8f('0x31')];if(_0x4aa69f['query'][_0x8c8f('0x40')]){_0xab9c0d[_0x8c8f('0x41')]=[{'all':!![]}];}_0xab9c0d=_[_0x8c8f('0x3c')]({},_0xab9c0d,_0x4aa69f[_0x8c8f('0x3e')]);return db[_0x8c8f('0x42')][_0x8c8f('0x4a')](_0xab9c0d)['then'](handleEntityNotFound(_0x19479d,null))[_0x8c8f('0x25')](function(_0x249927){if(_0x249927){var _0x4c1184=_0x249927[_0x8c8f('0x4b')]({'plain':!![]});_0x4c1184=qs['omit'](_0x4c1184,['id',_0x8c8f('0x4c'),_0x8c8f('0x4d')]);_0x4aa69f[_0x8c8f('0x4e')]=_['omit'](_0x4aa69f[_0x8c8f('0x4e')],['id',_0x8c8f('0x4c'),'updatedAt']);return db[_0x8c8f('0x42')][_0x8c8f('0x4f')](_[_0x8c8f('0x3c')](_0x4c1184,_0x4aa69f[_0x8c8f('0x4e')]),{'include':_0x4aa69f[_0x8c8f('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x8c8f('0x25')](respondWithResult(_0x19479d,0xc9))[_0x8c8f('0x47')](handleError(_0x19479d,null));};exports[_0x8c8f('0x24')]=function(_0x2b39b4,_0x5614ef){if(_0x2b39b4[_0x8c8f('0x4e')]['id']){delete _0x2b39b4[_0x8c8f('0x4e')]['id'];}return db[_0x8c8f('0x42')][_0x8c8f('0x4a')]({'where':{'id':_0x2b39b4[_0x8c8f('0x46')]['id']}})[_0x8c8f('0x25')](handleEntityNotFound(_0x5614ef,null))[_0x8c8f('0x25')](saveUpdates(_0x2b39b4[_0x8c8f('0x4e')],null))['then'](respondWithResult(_0x5614ef,null))[_0x8c8f('0x47')](handleError(_0x5614ef,null));};exports['destroy']=function(_0x431a7d,_0x668925){return db[_0x8c8f('0x42')]['find']({'where':{'id':_0x431a7d[_0x8c8f('0x46')]['id']}})['then'](handleEntityNotFound(_0x668925,null))[_0x8c8f('0x25')](removeEntity(_0x668925,null))[_0x8c8f('0x47')](handleError(_0x668925,null));};exports[_0x8c8f('0x4f')]=function(_0xe9ee7d,_0x3b73ae,_0x1f5647){_0xe9ee7d[_0x8c8f('0x4e')][_0x8c8f('0x28')]=_0xe9ee7d[_0x8c8f('0x50')][_0x8c8f('0x51')];_0xe9ee7d['body'][_0x8c8f('0x52')]=_0xe9ee7d[_0x8c8f('0x50')][_0x8c8f('0x53')];_0xe9ee7d[_0x8c8f('0x4e')][_0x8c8f('0x2c')]=_0xe9ee7d[_0x8c8f('0x50')][_0x8c8f('0x54')];return db[_0x8c8f('0x42')][_0x8c8f('0x4f')](_0xe9ee7d[_0x8c8f('0x4e')])[_0x8c8f('0x25')](respondWithResult(_0x3b73ae,0xc9))[_0x8c8f('0x47')](handleError(_0x3b73ae,null));};exports[_0x8c8f('0x55')]=function(_0x2ef680,_0x598f33,_0x5f545a){return db[_0x8c8f('0x42')][_0x8c8f('0x56')]({'where':{'id':_0x2ef680[_0x8c8f('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x598f33,null))[_0x8c8f('0x25')](function(_0x1296f7){if(_0x1296f7){var _0x3f7622=_0x1296f7[_0x8c8f('0x57')]!==null;var _0x126d6d=path[_0x8c8f('0x58')](config[_0x8c8f('0x59')],_0x8c8f('0x5a'));if(_0x3f7622){_0x126d6d=path[_0x8c8f('0x58')](_0x126d6d,_0x8c8f('0x5b'));}var _0xc46de1=path[_0x8c8f('0x58')](_0x126d6d,_0x1296f7[_0x8c8f('0x52')]);return _0x598f33['download'](_0xc46de1);}})[_0x8c8f('0x47')](handleError(_0x598f33,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 90725dd..ef9b729 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 _0x26cb=['./attachment.attributes','exports','attachments','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x44cef8,_0x291c68){var _0x459a4b=function(_0x4d237b){while(--_0x4d237b){_0x44cef8['push'](_0x44cef8['shift']());}};_0x459a4b(++_0x291c68);}(_0x26cb,0x111));var _0xb26c=function(_0x1b97c1,_0x3fca4e){_0x1b97c1=_0x1b97c1-0x0;var _0x30850d=_0x26cb[_0x1b97c1];return _0x30850d;};'use strict';var _=require(_0xb26c('0x0'));var util=require(_0xb26c('0x1'));var logger=require(_0xb26c('0x2'))(_0xb26c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb26c('0x4'));var rimraf=require(_0xb26c('0x5'));var config=require('../../config/environment');var attributes=require(_0xb26c('0x6'));module[_0xb26c('0x7')]=function(_0x5c0e2c,_0x549e11){return _0x5c0e2c['define']('Attachment',attributes,{'tableName':_0xb26c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52f6=['Attachment','util','api','moment','bluebird','request-promise','path','./attachment.attributes'];(function(_0x337d38,_0x5cb203){var _0x502d8b=function(_0x24247c){while(--_0x24247c){_0x337d38['push'](_0x337d38['shift']());}};_0x502d8b(++_0x5cb203);}(_0x52f6,0x81));var _0x652f=function(_0x4704fc,_0x1f93c8){_0x4704fc=_0x4704fc-0x0;var _0x316e4b=_0x52f6[_0x4704fc];return _0x316e4b;};'use strict';var _=require('lodash');var util=require(_0x652f('0x0'));var logger=require('../../config/logger')(_0x652f('0x1'));var moment=require(_0x652f('0x2'));var BPromise=require(_0x652f('0x3'));var rp=require(_0x652f('0x4'));var fs=require('fs');var path=require(_0x652f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x652f('0x6'));module['exports']=function(_0x3fe9e8,_0x4815fb){return _0x3fe9e8['define'](_0x652f('0x7'),attributes,{'tableName':'attachments','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 f65baca..e74279b 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 _0xad8a=['message','result','catch','CreateAttachment','create','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39d1f5,_0x40cd6d){var _0x1a86f2=function(_0x50d609){while(--_0x50d609){_0x39d1f5['push'](_0x39d1f5['shift']());}};_0x1a86f2(++_0x40cd6d);}(_0xad8a,0xb0));var _0xaad8=function(_0x3a61e3,_0x223080){_0x3a61e3=_0x3a61e3-0x0;var _0x56b790=_0xad8a[_0x3a61e3];return _0x56b790;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var moment=require(_0xaad8('0x2'));var BPromise=require(_0xaad8('0x3'));var rs=require(_0xaad8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaad8('0x5'))['db'];var utils=require(_0xaad8('0x6'));var logger=require(_0xaad8('0x7'))('rpc');var config=require(_0xaad8('0x8'));var jayson=require(_0xaad8('0x9'));var client=jayson[_0xaad8('0xa')][_0xaad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x95aef9,_0x39c599,_0x28f3a1){return new BPromise(function(_0xf3a6c7,_0x11408a){return client[_0xaad8('0xc')](_0x95aef9,_0x28f3a1)['then'](function(_0x52477f){logger[_0xaad8('0xd')](_0xaad8('0xe'),_0x39c599,_0xaad8('0xf'));logger[_0xaad8('0x10')](_0xaad8('0x11'),_0x39c599,_0xaad8('0xf'),JSON[_0xaad8('0x12')](_0x52477f));if(_0x52477f[_0xaad8('0x13')]){if(_0x52477f[_0xaad8('0x13')]['code']===0x1f4){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0x11408a(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0xf3a6c7(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}else{logger[_0xaad8('0xd')]('Attachment,\x20%s,\x20%s',_0x39c599,_0xaad8('0xf'));_0xf3a6c7(_0x52477f[_0xaad8('0x15')]['message']);}})[_0xaad8('0x16')](function(_0x2a8e12){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x2a8e12);_0x11408a(_0x2a8e12);});});}exports[_0xaad8('0x17')]=function(_0x3895e2){var _0x535b82=this;return new Promise(function(_0xfd8b0a,_0x26684c){return db['Attachment'][_0xaad8('0x18')](_0x3895e2['body'],{'raw':_0x3895e2[_0xaad8('0x19')]?_0x3895e2[_0xaad8('0x19')][_0xaad8('0x1a')]===undefined?!![]:![]:!![]})[_0xaad8('0x1b')](function(_0x5cb39b){logger[_0xaad8('0xd')](_0xaad8('0x17'),_0x3895e2);logger['debug'](_0xaad8('0x17'),_0x3895e2,JSON[_0xaad8('0x12')](_0x5cb39b));_0xfd8b0a(_0x5cb39b);})[_0xaad8('0x16')](function(_0x5b4b61){logger['error'](_0xaad8('0x17'),_0x5b4b61[_0xaad8('0x14')],_0x3895e2);_0x26684c(_0x535b82[_0xaad8('0x13')](0x1f4,_0x5b4b61[_0xaad8('0x14')]));});});}; \ No newline at end of file +var _0x136c=['message','catch','CreateAttachment','Attachment','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x298d89,_0x3c2d9c){var _0x5b1861=function(_0xb85cd9){while(--_0xb85cd9){_0x298d89['push'](_0x298d89['shift']());}};_0x5b1861(++_0x3c2d9c);}(_0x136c,0x1d2));var _0xc136=function(_0x3612eb,_0x4d1079){_0x3612eb=_0x3612eb-0x0;var _0x341b04=_0x136c[_0x3612eb];return _0x341b04;};'use strict';var _=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var moment=require('moment');var BPromise=require(_0xc136('0x2'));var rs=require(_0xc136('0x3'));var fs=require('fs');var Redis=require(_0xc136('0x4'));var db=require(_0xc136('0x5'))['db'];var utils=require(_0xc136('0x6'));var logger=require(_0xc136('0x7'))(_0xc136('0x8'));var config=require(_0xc136('0x9'));var jayson=require(_0xc136('0xa'));var client=jayson['client'][_0xc136('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594112,_0x361a52,_0x3993f2){return new BPromise(function(_0x1804c1,_0x500376){return client[_0xc136('0xc')](_0x594112,_0x3993f2)['then'](function(_0x1ea07d){logger[_0xc136('0xd')](_0xc136('0xe'),_0x361a52,_0xc136('0xf'));logger[_0xc136('0x10')](_0xc136('0x11'),_0x361a52,_0xc136('0xf'),JSON[_0xc136('0x12')](_0x1ea07d));if(_0x1ea07d[_0xc136('0x13')]){if(_0x1ea07d['error']['code']===0x1f4){logger[_0xc136('0x13')]('Attachment,\x20%s,\x20%s',_0x361a52,_0x1ea07d[_0xc136('0x13')][_0xc136('0x14')]);return _0x500376(_0x1ea07d[_0xc136('0x13')]['message']);}logger['error'](_0xc136('0xe'),_0x361a52,_0x1ea07d[_0xc136('0x13')][_0xc136('0x14')]);return _0x1804c1(_0x1ea07d['error']['message']);}else{logger[_0xc136('0xd')](_0xc136('0xe'),_0x361a52,'request\x20sent');_0x1804c1(_0x1ea07d['result']['message']);}})[_0xc136('0x15')](function(_0x3daf55){logger[_0xc136('0x13')](_0xc136('0xe'),_0x361a52,_0x3daf55);_0x500376(_0x3daf55);});});}exports[_0xc136('0x16')]=function(_0x1ccf5f){var _0x59503b=this;return new Promise(function(_0x5df9b7,_0x4d56cb){return db[_0xc136('0x17')]['create'](_0x1ccf5f[_0xc136('0x18')],{'raw':_0x1ccf5f[_0xc136('0x19')]?_0x1ccf5f[_0xc136('0x19')][_0xc136('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2b8527){logger[_0xc136('0xd')]('CreateAttachment',_0x1ccf5f);logger[_0xc136('0x10')]('CreateAttachment',_0x1ccf5f,JSON['stringify'](_0x2b8527));_0x5df9b7(_0x2b8527);})[_0xc136('0x15')](function(_0x1a350a){logger['error'](_0xc136('0x16'),_0x1a350a[_0xc136('0x14')],_0x1ccf5f);_0x4d56cb(_0x59503b[_0xc136('0x13')](0x1f4,_0x1a350a[_0xc136('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index faa9014..d94d6ef 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0b0e,0x187));var _0xe0b0=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0x0b0e[_0x25f805];return _0xf6628f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x50d3d9,_0x28334b){var _0x4d859f=function(_0x27b9f3){while(--_0x27b9f3){_0x50d3d9['push'](_0x50d3d9['shift']());}};_0x4d859f(++_0x28334b);}(_0xadb5,0xad));var _0x5adb=function(_0x3bddf4,_0x216ace){_0x3bddf4=_0x3bddf4-0x0;var _0xe1dc58=_0xadb5[_0x3bddf4];return _0xe1dc58;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index ef50795..216e9da 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 _0x09f6=['message','login','authenticate','ad-login','signToken','json','online','use','passport','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','agent','add','minutes','clearBlockUser','getLicense','catch','status','send'];(function(_0x4bd1ea,_0x13fded){var _0x4d6f54=function(_0x27451f){while(--_0x27451f){_0x4bd1ea['push'](_0x4bd1ea['shift']());}};_0x4d6f54(++_0x13fded);}(_0x09f6,0xfd));var _0x609f=function(_0x4f8e5c,_0x29af5c){_0x4f8e5c=_0x4f8e5c-0x0;var _0x917a18=_0x09f6[_0x4f8e5c];return _0x917a18;};'use strict';var passport=require(_0x609f('0x0'));var LocalStrategy=require('passport-local')[_0x609f('0x1')];var moment=require(_0x609f('0x2'));var ActiveDirectory=require(_0x609f('0x3'));var BPromise=require(_0x609f('0x4'));var util=require(_0x609f('0x5'));var db=require(_0x609f('0x6'))['db'];var authService=require(_0x609f('0x7'));var utils=require(_0x609f('0x8'));var config=require(_0x609f('0x9'));var logger=require(_0x609f('0xa'))(_0x609f('0xb'));function isActiveDirectoryConfigured(_0x33e941){var _0x16d29b=![];if(typeof _0x33e941[_0x609f('0xc')]!=='undefined'){_0x16d29b=_0x33e941[_0x609f('0xc')][_0x609f('0xd')]&&_0x33e941[_0x609f('0xc')][_0x609f('0xe')]&&_0x33e941[_0x609f('0xc')][_0x609f('0xf')];}return _0x16d29b;}function adAuthenticate(_0x5ca439,_0xf73a3e,_0x5837b7){return new BPromise(function(_0x49ba02,_0x492de6){try{var _0x338d8b=new ActiveDirectory(_0x5ca439);_0x338d8b['authenticate'](_0xf73a3e,_0x5837b7,function(_0x17f5d6,_0x357192){if(_0x17f5d6){logger[_0x609f('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0xf73a3e,util[_0x609f('0x11')](_0x17f5d6,{'showHidden':![],'depth':null}));_0x492de6(_0x609f('0x12'));}else if(!_0x357192){logger[_0x609f('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0xf73a3e);_0x492de6(_0x609f('0x12'));}else{_0x49ba02(_0x357192);}});}catch(_0x2c2054){_0x492de6(_0x2c2054);}});}function ActiveDirectoryAuthenticate(_0x10ca5e,_0x44b02d,_0x15fa17,_0x245569){var _0x507e0f,_0x4e3111;if(!isActiveDirectoryConfigured(config)){logger[_0x609f('0x10')](_0x609f('0x13'),_0x44b02d);return _0x245569(null,![],{'message':_0x609f('0x12')});}return db[_0x609f('0x14')][_0x609f('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x609f('0x16')],'raw':!![]})[_0x609f('0x17')](function(_0x51004a){_0x507e0f=_0x51004a;if(!_0x507e0f[_0x609f('0x18')]){logger['error'](_0x609f('0x19'),_0x44b02d);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x10ca5e[_0x609f('0x15')]({'attributes':['id',_0x609f('0x1a'),_0x609f('0x1b'),_0x609f('0x1c'),_0x609f('0x1d'),_0x609f('0x1e'),_0x609f('0x1f'),_0x609f('0x20'),'online'],'where':{'name':_0x44b02d,'role':{'$or':['admin','user',_0x609f('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0xcf0416){if(!_0xcf0416||_0xcf0416&&_0xcf0416[_0x609f('0x1a')]!==_0x44b02d){throw new Error(_0x609f('0x12'));}_0x4e3111=_0xcf0416;var _0x523e5e=_0x4e3111[_0x609f('0x1a')]+'@'+config[_0x609f('0xc')][_0x609f('0xf')];return adAuthenticate(config[_0x609f('0xc')],_0x523e5e,_0x15fa17);})[_0x609f('0x17')](function(_0x524d06){if(_0x4e3111[_0x609f('0x1e')]){throw new Error(_0x609f('0x12'));}if(_0x507e0f[_0x609f('0x16')]>0x0){if(_0x4e3111[_0x609f('0x1f')]){if(moment(_0x4e3111[_0x609f('0x20')])[_0x609f('0x22')](_0x507e0f[_0x609f('0x16')],_0x609f('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x609f('0x24')](_0x4e3111,0x0,![],null)[_0x609f('0x17')](function(){return utils[_0x609f('0x25')](_0x4e3111);})[_0x609f('0x17')](function(){return _0x245569(null,_0x4e3111);});}else{return utils['getLicense'](_0x4e3111)['then'](function(){return _0x245569(null,_0x4e3111);});}}else{return utils['getLicense'](_0x4e3111)[_0x609f('0x17')](function(){return _0x245569(null,_0x4e3111);});}})[_0x609f('0x26')](function(_0x5c6cc6){return _0x245569(null,![],_0x5c6cc6);});}function handleError(_0x488965,_0x2ef8f7,_0x1f6927){return _0x488965[_0x609f('0x27')](_0x2ef8f7||0x1f4)[_0x609f('0x28')]({'message':_0x1f6927?_0x1f6927[_0x609f('0x29')]||_0x1f6927:''});}exports[_0x609f('0x2a')]=function(_0x3cb3bc,_0x2a98da,_0x26b827){passport[_0x609f('0x2b')](_0x609f('0x2c'),function(_0x556503,_0x2b8915,_0xc290bf){var _0x473aee=_0x556503||_0xc290bf;if(_0x473aee){return handleError(_0x2a98da,0x191,_0x473aee);}if(!_0x2b8915){return handleError(_0x2a98da,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x34d7c6={'payload':{'id':_0x2b8915['id'],'role':_0x2b8915[_0x609f('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x609f('0x2d')](_0x34d7c6)[_0x609f('0x17')](function(_0x19e9db){_0x2a98da[_0x609f('0x2e')]({'id':_0x2b8915['id'],'token':_0x19e9db,'statusCall':'','isAlreadyLogged':_0x2b8915[_0x609f('0x2f')]});});}})(_0x3cb3bc,_0x2a98da,_0x26b827);};passport[_0x609f('0x30')](_0x609f('0x2c'),new LocalStrategy({'usernameField':_0x609f('0x1a'),'passwordField':_0x609f('0x1b')},function(_0x3124fb,_0x383d8f,_0x204aad){return ActiveDirectoryAuthenticate(db['User'],_0x3124fb,_0x383d8f,_0x204aad);})); \ No newline at end of file +var _0x1224=['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','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','name','add','minutes','clearBlockUser','getLicense','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined'];(function(_0x54db5e,_0x34b433){var _0x48e565=function(_0x342849){while(--_0x342849){_0x54db5e['push'](_0x54db5e['shift']());}};_0x48e565(++_0x34b433);}(_0x1224,0x10d));var _0x4122=function(_0x52db3f,_0x37ab5f){_0x52db3f=_0x52db3f-0x0;var _0x41b731=_0x1224[_0x52db3f];return _0x41b731;};'use strict';var passport=require(_0x4122('0x0'));var LocalStrategy=require(_0x4122('0x1'))[_0x4122('0x2')];var moment=require(_0x4122('0x3'));var ActiveDirectory=require(_0x4122('0x4'));var BPromise=require(_0x4122('0x5'));var util=require('util');var db=require(_0x4122('0x6'))['db'];var authService=require(_0x4122('0x7'));var utils=require(_0x4122('0x8'));var config=require('../../config/environment');var logger=require(_0x4122('0x9'))(_0x4122('0xa'));function isActiveDirectoryConfigured(_0xc6dfaf){var _0x40b5e4=![];if(typeof _0xc6dfaf[_0x4122('0xb')]!==_0x4122('0xc')){_0x40b5e4=_0xc6dfaf[_0x4122('0xb')][_0x4122('0xd')]&&_0xc6dfaf[_0x4122('0xb')][_0x4122('0xe')]&&_0xc6dfaf[_0x4122('0xb')][_0x4122('0xf')];}return _0x40b5e4;}function adAuthenticate(_0x251ade,_0x35160c,_0x1d229f){return new BPromise(function(_0x201538,_0x1c22f7){try{var _0x2d3fa6=new ActiveDirectory(_0x251ade);_0x2d3fa6[_0x4122('0x10')](_0x35160c,_0x1d229f,function(_0x955280,_0x12dc57){if(_0x955280){logger[_0x4122('0x11')](_0x4122('0x12'),_0x35160c,util[_0x4122('0x13')](_0x955280,{'showHidden':![],'depth':null}));_0x1c22f7(_0x4122('0x14'));}else if(!_0x12dc57){logger[_0x4122('0x11')](_0x4122('0x15'),_0x35160c);_0x1c22f7(_0x4122('0x14'));}else{_0x201538(_0x12dc57);}});}catch(_0x421ee3){_0x1c22f7(_0x421ee3);}});}function ActiveDirectoryAuthenticate(_0x1a701e,_0x3a88fe,_0x47ae9b,_0x4761a0){var _0x3c674e,_0x192e77;if(!isActiveDirectoryConfigured(config)){logger[_0x4122('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x3a88fe);return _0x4761a0(null,![],{'message':_0x4122('0x14')});}return db[_0x4122('0x16')]['findOne']({'where':{'id':0x1},'attributes':[_0x4122('0x17'),_0x4122('0x18')],'raw':!![]})[_0x4122('0x19')](function(_0x4636ae){_0x3c674e=_0x4636ae;if(!_0x3c674e[_0x4122('0x17')]){logger[_0x4122('0x11')](_0x4122('0x1a'),_0x3a88fe);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1a701e['findOne']({'attributes':['id','name',_0x4122('0x1b'),_0x4122('0x1c'),_0x4122('0x1d'),_0x4122('0x1e'),_0x4122('0x1f'),_0x4122('0x20'),_0x4122('0x21')],'where':{'name':_0x3a88fe,'role':{'$or':[_0x4122('0x22'),'user',_0x4122('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0x4f949a){if(!_0x4f949a||_0x4f949a&&_0x4f949a['name']!==_0x3a88fe){throw new Error(_0x4122('0x14'));}_0x192e77=_0x4f949a;var _0x13a08c=_0x192e77[_0x4122('0x24')]+'@'+config['activedirectory'][_0x4122('0xf')];return adAuthenticate(config[_0x4122('0xb')],_0x13a08c,_0x47ae9b);})['then'](function(_0x4a5711){if(_0x192e77[_0x4122('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3c674e['blockDuration']>0x0){if(_0x192e77['blocked']){if(moment(_0x192e77[_0x4122('0x20')])[_0x4122('0x25')](_0x3c674e[_0x4122('0x18')],_0x4122('0x26'))>moment()){throw new Error(_0x4122('0x14'));}return utils[_0x4122('0x27')](_0x192e77,0x0,![],null)[_0x4122('0x19')](function(){return utils[_0x4122('0x28')](_0x192e77);})[_0x4122('0x19')](function(){return _0x4761a0(null,_0x192e77);});}else{return utils[_0x4122('0x28')](_0x192e77)[_0x4122('0x19')](function(){return _0x4761a0(null,_0x192e77);});}}else{return utils[_0x4122('0x28')](_0x192e77)[_0x4122('0x19')](function(){return _0x4761a0(null,_0x192e77);});}})['catch'](function(_0x2e5bc2){return _0x4761a0(null,![],_0x2e5bc2);});}function handleError(_0x43c51c,_0x79c85,_0x31f141){return _0x43c51c['status'](_0x79c85||0x1f4)[_0x4122('0x29')]({'message':_0x31f141?_0x31f141['message']||_0x31f141:''});}exports[_0x4122('0x2a')]=function(_0x431430,_0x3a9633,_0xd8634b){passport[_0x4122('0x10')](_0x4122('0x2b'),function(_0xb98ce8,_0x427e8a,_0x57c0a7){var _0x17968f=_0xb98ce8||_0x57c0a7;if(_0x17968f){return handleError(_0x3a9633,0x191,_0x17968f);}if(!_0x427e8a){return handleError(_0x3a9633,0x194,{'message':_0x4122('0x2c')});}else{var _0x5770bd={'payload':{'id':_0x427e8a['id'],'role':_0x427e8a[_0x4122('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x4122('0x2d')](_0x5770bd)[_0x4122('0x19')](function(_0x1876f8){_0x3a9633['json']({'id':_0x427e8a['id'],'token':_0x1876f8,'statusCall':'','isAlreadyLogged':_0x427e8a[_0x4122('0x21')]});});}})(_0x431430,_0x3a9633,_0xd8634b);};passport[_0x4122('0x2e')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x4122('0x1b')},function(_0x591ea8,_0x2359ef,_0x1081e3){return ActiveDirectoryAuthenticate(db['User'],_0x591ea8,_0x2359ef,_0x1081e3);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 73a7350..4d261df 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 _0x2967=['express','Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x2967,0xea));var _0x7296=function(_0x325a08,_0x571fff){_0x325a08=_0x325a08-0x0;var _0x436e01=_0x2967[_0x325a08];return _0x436e01;};'use strict';var express=require(_0x7296('0x0'));var router=express[_0x7296('0x1')]();var controller=require(_0x7296('0x2'));router[_0x7296('0x3')]('/',controller[_0x7296('0x4')]);module[_0x7296('0x5')]=router; \ No newline at end of file +var _0x7f67=['post','express','Router','./authActiveDirectory.controller'];(function(_0x33f85b,_0x1fbeb1){var _0x4c0b81=function(_0x31a582){while(--_0x31a582){_0x33f85b['push'](_0x33f85b['shift']());}};_0x4c0b81(++_0x1fbeb1);}(_0x7f67,0x1b1));var _0x77f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7f67[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x77f6('0x0'));var router=express[_0x77f6('0x1')]();var controller=require(_0x77f6('0x2'));router[_0x77f6('0x3')]('/',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 aafac98..5412d63 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x7a54,0x106));var _0x47a5=function(_0x2ed26e,_0x4b9432){_0x2ed26e=_0x2ed26e-0x0;var _0x17e22c=_0x7a54[_0x2ed26e];return _0x17e22c;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x577032,_0x23e546){var _0x491213=function(_0x34a2c4){while(--_0x34a2c4){_0x577032['push'](_0x577032['shift']());}};_0x491213(++_0x23e546);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index fe60397..6a9b253 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 _0xc076=['callback','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x1c2e1c,_0x5121ba){var _0x3bc774=function(_0x4e711e){while(--_0x4e711e){_0x1c2e1c['push'](_0x1c2e1c['shift']());}};_0x3bc774(++_0x5121ba);}(_0xc076,0x84));var _0x6c07=function(_0x52c59a,_0x22f656){_0x52c59a=_0x52c59a-0x0;var _0x53c678=_0xc076[_0x52c59a];return _0x53c678;};'use strict';var express=require(_0x6c07('0x0'));var passport=require(_0x6c07('0x1'));var router=express[_0x6c07('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x6c07('0x3'));var authService=require(_0x6c07('0x4'));router[_0x6c07('0x5')]('/',controller[_0x6c07('0x6')]);router[_0x6c07('0x5')](_0x6c07('0x7'),controller[_0x6c07('0x8')],authService['isMiddleware'],userController[_0x6c07('0x6')],authService['setTokenCookie']);module[_0x6c07('0x9')]=router; \ No newline at end of file +var _0x487d=['login','/callback','isMiddleware','exports','express','passport','Router','../../components/auth/service','get'];(function(_0x199116,_0x2bbb4a){var _0x58a22f=function(_0x4fc1b3){while(--_0x4fc1b3){_0x199116['push'](_0x199116['shift']());}};_0x58a22f(++_0x2bbb4a);}(_0x487d,0x1b4));var _0xd487=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x487d[_0x4aba15];return _0x1c8122;};'use strict';var express=require(_0xd487('0x0'));var passport=require(_0xd487('0x1'));var router=express[_0xd487('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xd487('0x3'));router[_0xd487('0x4')]('/',controller[_0xd487('0x5')]);router[_0xd487('0x4')](_0xd487('0x6'),controller['callback'],authService[_0xd487('0x7')],userController[_0xd487('0x5')],authService['setTokenCookie']);module[_0xd487('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 0da82cc..3ee6763 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 _0x4bac=['Email\x20parameter\x20is\x20missing','trim','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','User','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','send','Password\x20reset!','use','util','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','disabled','blocked','loginAttempts','admin','user','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','email','Smtp','CloudProvider','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','error','status','login','local-login','role','signToken','json','online','forgot','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bac,0xb9));var _0xc4ba=function(_0x4b41ab,_0x16a2d2){_0x4b41ab=_0x4b41ab-0x0;var _0x491794=_0x4bac[_0x4b41ab];return _0x491794;};'use strict';var util=require(_0xc4ba('0x0'));var passport=require('passport');var LocalStrategy=require(_0xc4ba('0x1'))[_0xc4ba('0x2')];var jayson=require('jayson/promise');var _=require(_0xc4ba('0x3'));var rs=require(_0xc4ba('0x4'));var moment=require(_0xc4ba('0x5'));var db=require(_0xc4ba('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc4ba('0x7'));var client=jayson[_0xc4ba('0x8')][_0xc4ba('0x9')]({'port':0x232b});function localAuthenticate(_0x3279ca,_0x2fdb3e,_0x4a52c8,_0x5aeac6){var _0x35ea42,_0xf71509;return db[_0xc4ba('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xc4ba('0xb'),_0xc4ba('0xc')],'raw':!![]})[_0xc4ba('0xd')](function(_0x319efb){_0x35ea42=_0x319efb;return _0x3279ca[_0xc4ba('0xe')]({'attributes':['id',_0xc4ba('0xf'),_0xc4ba('0x10'),_0xc4ba('0x11'),'role',_0xc4ba('0x12'),_0xc4ba('0x13'),'blockedAt',_0xc4ba('0x14')],'where':{'name':_0x2fdb3e,'role':{'$or':[_0xc4ba('0x15'),_0xc4ba('0x16'),'agent']}}});})[_0xc4ba('0xd')](function(_0x5d1a95){if(!_0x5d1a95||_0x5d1a95&&_0x5d1a95[_0xc4ba('0xf')]!==_0x2fdb3e){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xf71509=_0x5d1a95;return _0xf71509;}})[_0xc4ba('0xd')](function(){_0xf71509[_0xc4ba('0x17')](_0x4a52c8,function(_0x375a26,_0x7bbae9){var _0x489699=_0xf71509[_0xc4ba('0x14')]+0x1;if(_0x375a26){return _0x5aeac6(_0x375a26);}else if(!_0x7bbae9){if(_0xf71509[_0xc4ba('0x12')]){return _0x5aeac6(null,![],{'message':_0xc4ba('0x18')});}else if(_0x35ea42['allowedLoginAttempts']>0x0){if(_0xf71509[_0xc4ba('0x13')]){if(_0x35ea42['blockDuration']>0x0){if(moment(_0xf71509[_0xc4ba('0x19')])[_0xc4ba('0x1a')](_0x35ea42[_0xc4ba('0xc')],_0xc4ba('0x1b'))>moment()){return _0x5aeac6(null,![],{'message':_0xc4ba('0x18')});}else{return utils[_0xc4ba('0x1c')](_0xf71509,_0x489699,![],null)[_0xc4ba('0xd')](function(){return _0x5aeac6(null,![],{'message':_0xc4ba('0x18')});});}}else{return _0x5aeac6(null,![],{'message':_0xc4ba('0x18')});}}else{if(_0x489699>=_0x35ea42[_0xc4ba('0xb')]){return utils[_0xc4ba('0x1c')](_0xf71509,0x0,!![],moment())[_0xc4ba('0xd')](function(){return _0x5aeac6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0xf71509,_0x489699,![],null)[_0xc4ba('0xd')](function(){return _0x5aeac6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x5aeac6(null,![],{'message':_0xc4ba('0x18')});}}else{if(_0xf71509['disabled']){return _0x5aeac6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x35ea42[_0xc4ba('0xb')]>0x0){if(_0xf71509[_0xc4ba('0x13')]){if(_0x35ea42[_0xc4ba('0xc')]>0x0){if(moment(_0xf71509[_0xc4ba('0x19')])[_0xc4ba('0x1a')](_0x35ea42['blockDuration'],_0xc4ba('0x1b'))>moment()){return _0x5aeac6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0xf71509,0x0,![],null)[_0xc4ba('0xd')](function(){return utils[_0xc4ba('0x1d')](_0xf71509);})['then'](function(){return _0x5aeac6(null,_0xf71509);});}}else{return _0x5aeac6(null,![],{'message':_0xc4ba('0x18')});}}else{return utils[_0xc4ba('0x1c')](_0xf71509,0x0,![],null)['then'](function(){return utils[_0xc4ba('0x1d')](_0xf71509);})[_0xc4ba('0xd')](function(){return _0x5aeac6(null,_0xf71509);})[_0xc4ba('0x1e')](function(_0x1e82b0){return _0x5aeac6(null,![],_0x1e82b0);});}}else{if(_0xf71509[_0xc4ba('0x13')]){return _0x5aeac6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc4ba('0x1d')](_0xf71509)[_0xc4ba('0xd')](function(){return _0x5aeac6(null,_0xf71509);});}}}});})[_0xc4ba('0x1e')](function(_0x4c4dc7){return _0x5aeac6(null,![],_0x4c4dc7);});}function sendServiceMail(_0x1acb27){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id','name',_0xc4ba('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0xc4ba('0x20'),'include':[{'model':db[_0xc4ba('0x21')],'as':_0xc4ba('0x21')}]}]})[_0xc4ba('0xd')](function(_0x251b43){if(!_0x251b43){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1bd2ed=_0x251b43[_0xc4ba('0x22')]();var _0x5cb71f={'account':_0x1bd2ed,'message':_[_0xc4ba('0x23')]({'from':util['format'](_0xc4ba('0x24'),_0x251b43[_0xc4ba('0xf')],_0x251b43[_0xc4ba('0x1f')]||_0x251b43[_0xc4ba('0x20')][_0xc4ba('0x16')])},_0x1acb27)};return client[_0xc4ba('0x25')](_0xc4ba('0x26'),_0x5cb71f);})[_0xc4ba('0xd')](function(_0x302312){if(_0x302312['error']){throw new Error(util[_0xc4ba('0x27')](_0xc4ba('0x28'),_0x302312['error'][_0xc4ba('0x29')]||JSON['stringify'](_0x302312[_0xc4ba('0x2a')])));}return!![];});}function handleError(_0x40af59,_0x36b9c2,_0x3fac39){return _0x40af59[_0xc4ba('0x2b')](_0x36b9c2||0x1f4)['send']({'message':_0x3fac39?_0x3fac39[_0xc4ba('0x29')]||_0x3fac39:''});}exports[_0xc4ba('0x2c')]=function(_0x4f6d22,_0x29c63e,_0x279e9d){passport['authenticate'](_0xc4ba('0x2d'),function(_0x2eca2b,_0x565648,_0x38c29e){var _0x494678=_0x2eca2b||_0x38c29e;if(_0x494678){return handleError(_0x29c63e,0x191,_0x494678);}if(!_0x565648){return handleError(_0x29c63e,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4d8bd1={'payload':{'id':_0x565648['id'],'role':_0x565648[_0xc4ba('0x2e')]},'options':{'expiresIn':0x15180}};return authService[_0xc4ba('0x2f')](_0x4d8bd1)['then'](function(_0x276625){_0x29c63e[_0xc4ba('0x30')]({'id':_0x565648['id'],'token':_0x276625,'statusCall':'','isAlreadyLogged':_0x565648[_0xc4ba('0x31')]});});}})(_0x4f6d22,_0x29c63e,_0x279e9d);};exports[_0xc4ba('0x32')]=function(_0x4cd298,_0x1557f2){if(!_0x4cd298[_0xc4ba('0x33')]['email']){return handleError(_0x1557f2,0x1f4,{'message':_0xc4ba('0x34')});}var _0x3594a3=rs['generate']();_0x4cd298['body'][_0xc4ba('0x1f')]=_0x4cd298[_0xc4ba('0x33')][_0xc4ba('0x1f')][_0xc4ba('0x35')]()['toLowerCase']();var _0x530783;return db[_0xc4ba('0xa')][_0xc4ba('0xe')]({'where':{'id':0x1},'attributes':[_0xc4ba('0xb'),_0xc4ba('0xc')],'raw':!![]})['then'](function(_0x3f8df2){_0x530783=_0x3f8df2;return db['User'][_0xc4ba('0x36')]({'where':{'email':_0x4cd298[_0xc4ba('0x33')]['email']}});})[_0xc4ba('0xd')](function(_0x10c69c){if(!_0x10c69c){throw new Error(_0xc4ba('0x37'));}if(_0x10c69c['disabled']){throw new Error(_0xc4ba('0x38'));}if(_0x10c69c[_0xc4ba('0x13')]){if(moment(_0x10c69c[_0xc4ba('0x19')])[_0xc4ba('0x1a')](_0x530783[_0xc4ba('0xc')],_0xc4ba('0x1b'))>moment()){throw new Error(_0xc4ba('0x39'));}else{_0x10c69c[_0xc4ba('0x13')]=![];_0x10c69c[_0xc4ba('0x19')]=null;}}_0x10c69c[_0xc4ba('0x3a')]=_0x3594a3;_0x10c69c[_0xc4ba('0x3b')]=Date[_0xc4ba('0x3c')]()+0x36ee80;return _0x10c69c[_0xc4ba('0x3d')]();})[_0xc4ba('0xd')](function(){return sendServiceMail({'to':_0x4cd298[_0xc4ba('0x33')][_0xc4ba('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xc4ba('0x3e')+_0xc4ba('0x3f')+_0xc4ba('0x40')+_0x4cd298[_0xc4ba('0x41')][_0xc4ba('0x42')]+_0xc4ba('0x43')+_0x3594a3+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x1557f2[_0xc4ba('0x2b')](0xc8)['send']({'message':_0xc4ba('0x44')});})[_0xc4ba('0x1e')](function(_0x298171){return handleError(_0x1557f2,0x1f4,_0x298171);});};exports['reset']=function(_0x3df319,_0x470eeb){return db[_0xc4ba('0x45')][_0xc4ba('0x36')]({'where':{'resetPasswordToken':_0x3df319['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xc4ba('0xd')](function(_0x56f120){if(!_0x56f120){throw new Error(_0xc4ba('0x46'));}return db['Setting'][_0xc4ba('0xe')]({'attributes':['id',_0xc4ba('0x47'),_0xc4ba('0x48'),_0xc4ba('0x49')]})['then'](function(_0x4b2e48){if(_0x4b2e48[_0xc4ba('0x47')])authService[_0xc4ba('0x4a')](_0x3df319[_0xc4ba('0x33')][_0xc4ba('0x10')]);if(!_0x4b2e48[_0xc4ba('0x48')]||!_0x56f120[_0xc4ba('0x4b')])return _0x56f120;authService['validatePasswordHistory'](_0x3df319[_0xc4ba('0x33')]['password'],_0x56f120[_0xc4ba('0x4b')],_0x4b2e48[_0xc4ba('0x49')]);return _0x56f120;})['then'](function(){_0x56f120[_0xc4ba('0x10')]=_0x3df319['body']['password'];_0x56f120[_0xc4ba('0x3a')]=null;_0x56f120[_0xc4ba('0x3b')]=null;return _0x56f120[_0xc4ba('0x3d')]();});})['then'](function(){_0x470eeb[_0xc4ba('0x2b')](0xc8)[_0xc4ba('0x4c')]({'message':_0xc4ba('0x4d')});})['catch'](function(_0x1bfb6e){return handleError(_0x470eeb,0x1f4,_0x1bfb6e);});};passport[_0xc4ba('0x4e')]('local-login',new LocalStrategy({'usernameField':_0xc4ba('0xf'),'passwordField':_0xc4ba('0x10')},function(_0x3b7b84,_0xf3bef8,_0x22466b){return localAuthenticate(db[_0xc4ba('0x45')],_0x3b7b84,_0xf3bef8,_0x22466b);})); \ No newline at end of file +var _0x5984=['https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','now','passwordHistoryLimit','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','allowedLoginAttempts','blockDuration','then','findOne','name','password','role','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','disabled','getLicense','catch','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','Setting','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'];(function(_0xb1d61d,_0x39d9c2){var _0xbaca6=function(_0x1e5299){while(--_0x1e5299){_0xb1d61d['push'](_0xb1d61d['shift']());}};_0xbaca6(++_0x39d9c2);}(_0x5984,0x15e));var _0x4598=function(_0x508ac6,_0x4d9a97){_0x508ac6=_0x508ac6-0x0;var _0x25d22a=_0x5984[_0x508ac6];return _0x25d22a;};'use strict';var util=require(_0x4598('0x0'));var passport=require(_0x4598('0x1'));var LocalStrategy=require(_0x4598('0x2'))[_0x4598('0x3')];var jayson=require(_0x4598('0x4'));var _=require(_0x4598('0x5'));var rs=require(_0x4598('0x6'));var moment=require(_0x4598('0x7'));var db=require(_0x4598('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x4598('0x9'));var client=jayson[_0x4598('0xa')][_0x4598('0xb')]({'port':0x232b});function localAuthenticate(_0x2a22ff,_0x12eb8e,_0x20210f,_0x12be1c){var _0x245db1,_0x234d9b;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x4598('0xc'),_0x4598('0xd')],'raw':!![]})[_0x4598('0xe')](function(_0x1bc36a){_0x245db1=_0x1bc36a;return _0x2a22ff[_0x4598('0xf')]({'attributes':['id',_0x4598('0x10'),_0x4598('0x11'),'salt',_0x4598('0x12'),'disabled','blocked',_0x4598('0x13'),_0x4598('0x14')],'where':{'name':_0x12eb8e,'role':{'$or':[_0x4598('0x15'),_0x4598('0x16'),_0x4598('0x17')]}}});})[_0x4598('0xe')](function(_0x1200f7){if(!_0x1200f7||_0x1200f7&&_0x1200f7['name']!==_0x12eb8e){throw new Error(_0x4598('0x18'));}else{_0x234d9b=_0x1200f7;return _0x234d9b;}})[_0x4598('0xe')](function(){_0x234d9b[_0x4598('0x19')](_0x20210f,function(_0x11806f,_0x2e5b1b){var _0x552f4a=_0x234d9b[_0x4598('0x14')]+0x1;if(_0x11806f){return _0x12be1c(_0x11806f);}else if(!_0x2e5b1b){if(_0x234d9b['disabled']){return _0x12be1c(null,![],{'message':_0x4598('0x18')});}else if(_0x245db1['allowedLoginAttempts']>0x0){if(_0x234d9b[_0x4598('0x1a')]){if(_0x245db1[_0x4598('0xd')]>0x0){if(moment(_0x234d9b[_0x4598('0x13')])[_0x4598('0x1b')](_0x245db1[_0x4598('0xd')],_0x4598('0x1c'))>moment()){return _0x12be1c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4598('0x1d')](_0x234d9b,_0x552f4a,![],null)[_0x4598('0xe')](function(){return _0x12be1c(null,![],{'message':_0x4598('0x18')});});}}else{return _0x12be1c(null,![],{'message':_0x4598('0x18')});}}else{if(_0x552f4a>=_0x245db1['allowedLoginAttempts']){return utils['clearBlockUser'](_0x234d9b,0x0,!![],moment())[_0x4598('0xe')](function(){return _0x12be1c(null,![],{'message':_0x4598('0x18')});});}else{return utils[_0x4598('0x1d')](_0x234d9b,_0x552f4a,![],null)['then'](function(){return _0x12be1c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x12be1c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x234d9b[_0x4598('0x1e')]){return _0x12be1c(null,![],{'message':_0x4598('0x18')});}else if(_0x245db1[_0x4598('0xc')]>0x0){if(_0x234d9b[_0x4598('0x1a')]){if(_0x245db1[_0x4598('0xd')]>0x0){if(moment(_0x234d9b[_0x4598('0x13')])[_0x4598('0x1b')](_0x245db1[_0x4598('0xd')],_0x4598('0x1c'))>moment()){return _0x12be1c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x234d9b,0x0,![],null)['then'](function(){return utils[_0x4598('0x1f')](_0x234d9b);})[_0x4598('0xe')](function(){return _0x12be1c(null,_0x234d9b);});}}else{return _0x12be1c(null,![],{'message':_0x4598('0x18')});}}else{return utils[_0x4598('0x1d')](_0x234d9b,0x0,![],null)[_0x4598('0xe')](function(){return utils['getLicense'](_0x234d9b);})[_0x4598('0xe')](function(){return _0x12be1c(null,_0x234d9b);})['catch'](function(_0x3d0492){return _0x12be1c(null,![],_0x3d0492);});}}else{if(_0x234d9b[_0x4598('0x1a')]){return _0x12be1c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4598('0x1f')](_0x234d9b)['then'](function(){return _0x12be1c(null,_0x234d9b);});}}}});})[_0x4598('0x20')](function(_0xd5cf0f){return _0x12be1c(null,![],_0xd5cf0f);});}function sendServiceMail(_0x40a3f8){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x4598('0x10'),_0x4598('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x4598('0x22'),'include':[{'model':db[_0x4598('0x23')],'as':_0x4598('0x23')}]}]})[_0x4598('0xe')](function(_0x1a4e7f){if(!_0x1a4e7f){throw new Error(_0x4598('0x24'));}var _0x3acf9d=_0x1a4e7f['getSmtpOptions']();var _0x2101be={'account':_0x3acf9d,'message':_[_0x4598('0x25')]({'from':util[_0x4598('0x26')](_0x4598('0x27'),_0x1a4e7f[_0x4598('0x10')],_0x1a4e7f[_0x4598('0x21')]||_0x1a4e7f['Smtp'][_0x4598('0x16')])},_0x40a3f8)};return client[_0x4598('0x28')](_0x4598('0x29'),_0x2101be);})['then'](function(_0x318240){if(_0x318240[_0x4598('0x2a')]){throw new Error(util[_0x4598('0x26')](_0x4598('0x2b'),_0x318240[_0x4598('0x2a')]['message']||JSON[_0x4598('0x2c')](_0x318240[_0x4598('0x2a')])));}return!![];});}function handleError(_0x52d32e,_0x2c46f9,_0x1b0e27){return _0x52d32e[_0x4598('0x2d')](_0x2c46f9||0x1f4)[_0x4598('0x2e')]({'message':_0x1b0e27?_0x1b0e27[_0x4598('0x2f')]||_0x1b0e27:''});}exports[_0x4598('0x30')]=function(_0xeae30c,_0x1dcbf7,_0x54c696){passport['authenticate'](_0x4598('0x31'),function(_0x3bc226,_0x59552a,_0x197ab4){var _0x398bd7=_0x3bc226||_0x197ab4;if(_0x398bd7){return handleError(_0x1dcbf7,0x191,_0x398bd7);}if(!_0x59552a){return handleError(_0x1dcbf7,0x194,{'message':_0x4598('0x32')});}else{var _0x2927cc={'payload':{'id':_0x59552a['id'],'role':_0x59552a[_0x4598('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x4598('0x33')](_0x2927cc)['then'](function(_0xa15a9f){_0x1dcbf7[_0x4598('0x34')]({'id':_0x59552a['id'],'token':_0xa15a9f,'statusCall':'','isAlreadyLogged':_0x59552a[_0x4598('0x35')]});});}})(_0xeae30c,_0x1dcbf7,_0x54c696);};exports[_0x4598('0x36')]=function(_0x1d8089,_0x3960e5){if(!_0x1d8089[_0x4598('0x37')][_0x4598('0x21')]){return handleError(_0x3960e5,0x1f4,{'message':_0x4598('0x38')});}var _0x53a64b=rs[_0x4598('0x39')]();_0x1d8089[_0x4598('0x37')][_0x4598('0x21')]=_0x1d8089[_0x4598('0x37')][_0x4598('0x21')][_0x4598('0x3a')]()['toLowerCase']();var _0x50ad75;return db[_0x4598('0x3b')][_0x4598('0xf')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x4598('0xd')],'raw':!![]})[_0x4598('0xe')](function(_0x353b4a){_0x50ad75=_0x353b4a;return db['User'][_0x4598('0x3c')]({'where':{'email':_0x1d8089[_0x4598('0x37')][_0x4598('0x21')]}});})[_0x4598('0xe')](function(_0x4a0e4b){if(!_0x4a0e4b){throw new Error(_0x4598('0x3d'));}if(_0x4a0e4b[_0x4598('0x1e')]){throw new Error(_0x4598('0x3e'));}if(_0x4a0e4b[_0x4598('0x1a')]){if(moment(_0x4a0e4b[_0x4598('0x13')])['add'](_0x50ad75[_0x4598('0xd')],'minutes')>moment()){throw new Error(_0x4598('0x3f'));}else{_0x4a0e4b['blocked']=![];_0x4a0e4b['blockedAt']=null;}}_0x4a0e4b[_0x4598('0x40')]=_0x53a64b;_0x4a0e4b[_0x4598('0x41')]=Date['now']()+0x36ee80;return _0x4a0e4b[_0x4598('0x42')]();})[_0x4598('0xe')](function(){return sendServiceMail({'to':_0x1d8089[_0x4598('0x37')]['email'],'subject':_0x4598('0x43'),'text':_0x4598('0x44')+_0x4598('0x45')+_0x4598('0x46')+_0x1d8089[_0x4598('0x47')]['host']+'/reset/'+_0x53a64b+'\x0a\x0a'+_0x4598('0x48')});})['then'](function(){_0x3960e5[_0x4598('0x2d')](0xc8)[_0x4598('0x2e')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x43b7a7){return handleError(_0x3960e5,0x1f4,_0x43b7a7);});};exports[_0x4598('0x49')]=function(_0x612221,_0x125c55){return db[_0x4598('0x4a')][_0x4598('0x3c')]({'where':{'resetPasswordToken':_0x612221['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x4598('0x4b')]()}}})[_0x4598('0xe')](function(_0x407173){if(!_0x407173){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x4598('0xf')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x4598('0x4c')]})[_0x4598('0xe')](function(_0xaa5d95){if(_0xaa5d95[_0x4598('0x4d')])authService[_0x4598('0x4e')](_0x612221['body'][_0x4598('0x11')]);if(!_0xaa5d95[_0x4598('0x4f')]||!_0x407173[_0x4598('0x50')])return _0x407173;authService[_0x4598('0x51')](_0x612221[_0x4598('0x37')][_0x4598('0x11')],_0x407173[_0x4598('0x50')],_0xaa5d95['passwordHistoryLimit']);return _0x407173;})[_0x4598('0xe')](function(){_0x407173[_0x4598('0x11')]=_0x612221[_0x4598('0x37')][_0x4598('0x11')];_0x407173[_0x4598('0x40')]=null;_0x407173[_0x4598('0x41')]=null;return _0x407173['save']();});})['then'](function(){_0x125c55[_0x4598('0x2d')](0xc8)['send']({'message':_0x4598('0x52')});})[_0x4598('0x20')](function(_0x2526a8){return handleError(_0x125c55,0x1f4,_0x2526a8);});};passport[_0x4598('0x53')](_0x4598('0x31'),new LocalStrategy({'usernameField':'name','passwordField':_0x4598('0x11')},function(_0x2422c5,_0x2de51d,_0x4d8f40){return localAuthenticate(db[_0x4598('0x4a')],_0x2422c5,_0x2de51d,_0x4d8f40);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ebcdeaf..23b7763 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 _0xd6b7=['/reset/:token','reset','exports','Router','./authLocal.controller','post','login','forgot'];(function(_0x4008de,_0x15f2e9){var _0x596738=function(_0x2d4060){while(--_0x2d4060){_0x4008de['push'](_0x4008de['shift']());}};_0x596738(++_0x15f2e9);}(_0xd6b7,0x1d3));var _0x7d6b=function(_0x2fa0b4,_0x3ca453){_0x2fa0b4=_0x2fa0b4-0x0;var _0x8fc7a9=_0xd6b7[_0x2fa0b4];return _0x8fc7a9;};'use strict';var express=require('express');var router=express[_0x7d6b('0x0')]();var controller=require(_0x7d6b('0x1'));router[_0x7d6b('0x2')]('/',controller[_0x7d6b('0x3')]);router['post']('/forgot',controller[_0x7d6b('0x4')]);router['post'](_0x7d6b('0x5'),controller[_0x7d6b('0x6')]);module[_0x7d6b('0x7')]=router; \ No newline at end of file +var _0xd2fb=['/reset/:token','exports','./authLocal.controller','post','login'];(function(_0x43f7e0,_0x1f0ca7){var _0x1d3cf6=function(_0x529623){while(--_0x529623){_0x43f7e0['push'](_0x43f7e0['shift']());}};_0x1d3cf6(++_0x1f0ca7);}(_0xd2fb,0x101));var _0xbd2f=function(_0x5a060d,_0x6723fd){_0x5a060d=_0x5a060d-0x0;var _0x534966=_0xd2fb[_0x5a060d];return _0x534966;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xbd2f('0x0'));router[_0xbd2f('0x1')]('/',controller[_0xbd2f('0x2')]);router[_0xbd2f('0x1')]('/forgot',controller['forgot']);router[_0xbd2f('0x1')](_0xbd2f('0x3'),controller['reset']);module[_0xbd2f('0x4')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 1dee2fc..d2be4ef 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 _0x27dd=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0x27dd,0x15b));var _0xd27d=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x27dd[_0x24259d];return _0x5a701;};'use strict';var Sequelize=require(_0xd27d('0x0'));module[_0xd27d('0x1')]={'name':{'type':Sequelize[_0xd27d('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd27d('0x2')]},'status':{'type':Sequelize[_0xd27d('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd27d('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x6f35=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x39d8b8,_0x2b9b4b){var _0x13f7a0=function(_0x358c49){while(--_0x358c49){_0x39d8b8['push'](_0x39d8b8['shift']());}};_0x13f7a0(++_0x2b9b4b);}(_0x6f35,0x1be));var _0x56f3=function(_0x43e885,_0x25c816){_0x43e885=_0x43e885-0x0;var _0xc86170=_0x6f35[_0x43e885];return _0xc86170;};'use strict';var Sequelize=require(_0x56f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x56f3('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x56f3('0x1')]},'description':{'type':Sequelize[_0x56f3('0x1')]},'status':{'type':Sequelize[_0x56f3('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x56f3('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 2453752..995a7ad 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 _0x9548=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','merge','find','catch','create','body','destroy','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','Automation','fieldName','type','key','model'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x9548,0xd5));var _0x8954=function(_0x2bbee6,_0x58e667){_0x2bbee6=_0x2bbee6-0x0;var _0x4a7ab2=_0x9548[_0x2bbee6];return _0x4a7ab2;};'use strict';var emlformat=require(_0x8954('0x0'));var rimraf=require(_0x8954('0x1'));var zipdir=require(_0x8954('0x2'));var jsonpatch=require(_0x8954('0x3'));var rp=require('request-promise');var moment=require(_0x8954('0x4'));var BPromise=require(_0x8954('0x5'));var Mustache=require('mustache');var util=require(_0x8954('0x6'));var path=require(_0x8954('0x7'));var sox=require(_0x8954('0x8'));var csv=require(_0x8954('0x9'));var ejs=require(_0x8954('0xa'));var fs=require('fs');var fs_extra=require(_0x8954('0xb'));var _=require(_0x8954('0xc'));var squel=require(_0x8954('0xd'));var crypto=require(_0x8954('0xe'));var jsforce=require(_0x8954('0xf'));var deskjs=require(_0x8954('0x10'));var toCsv=require(_0x8954('0x9'));var querystring=require(_0x8954('0x11'));var Papa=require(_0x8954('0x12'));var Redis=require(_0x8954('0x13'));var authService=require(_0x8954('0x14'));var qs=require(_0x8954('0x15'));var as=require(_0x8954('0x16'));var hardwareService=require(_0x8954('0x17'));var logger=require(_0x8954('0x18'))('api');var utils=require(_0x8954('0x19'));var config=require(_0x8954('0x1a'));var licenseUtil=require(_0x8954('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a043f,_0x328edc){_0x328edc=_0x328edc||0xcc;return function(_0x40a777){if(_0x40a777){return _0x4a043f[_0x8954('0x1c')](_0x328edc);}return _0x4a043f['status'](_0x328edc)['end']();};}function respondWithResult(_0x4d5a51,_0x41b132){_0x41b132=_0x41b132||0xc8;return function(_0xd23fd7){if(_0xd23fd7){return _0x4d5a51[_0x8954('0x1d')](_0x41b132)['json'](_0xd23fd7);}};}function respondWithFilteredResult(_0x105e52,_0xf6f207){return function(_0x23bc0b){if(_0x23bc0b){var _0x5c3eab=typeof _0xf6f207[_0x8954('0x1e')]===_0x8954('0x1f')&&typeof _0xf6f207[_0x8954('0x20')]===_0x8954('0x1f');var _0x20413e=_0x23bc0b[_0x8954('0x21')];var _0x2f3b9f=_0x5c3eab?0x0:_0xf6f207['offset'];var _0x30239a=_0x5c3eab?_0x23bc0b[_0x8954('0x21')]:_0xf6f207[_0x8954('0x1e')]+_0xf6f207[_0x8954('0x20')];var _0x25fc94;if(_0x30239a>=_0x20413e){_0x30239a=_0x20413e;_0x25fc94=0xc8;}else{_0x25fc94=0xce;}_0x105e52['status'](_0x25fc94);return _0x105e52['set'](_0x8954('0x22'),_0x2f3b9f+'-'+_0x30239a+'/'+_0x20413e)[_0x8954('0x23')](_0x23bc0b);}return null;};}function patchUpdates(_0xf914f2){return function(_0x41fb23){try{jsonpatch[_0x8954('0x24')](_0x41fb23,_0xf914f2,!![]);}catch(_0x5dc28c){return BPromise[_0x8954('0x25')](_0x5dc28c);}return _0x41fb23[_0x8954('0x26')]();};}function saveUpdates(_0x511d99,_0x2a8a53){return function(_0x90a46d){if(_0x90a46d){return _0x90a46d[_0x8954('0x27')](_0x511d99)['then'](function(_0x9e2e57){return _0x9e2e57;});}return null;};}function removeEntity(_0x2b1d02,_0x4f03af){return function(_0x5be11d){if(_0x5be11d){return _0x5be11d['destroy']()[_0x8954('0x28')](function(){_0x2b1d02[_0x8954('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x246dbf,_0x32945c){return function(_0x5a0dec){if(!_0x5a0dec){_0x246dbf['sendStatus'](0x194);}return _0x5a0dec;};}function handleError(_0xf4e451,_0x50b51e){_0x50b51e=_0x50b51e||0x1f4;return function(_0x1931d6){logger[_0x8954('0x29')](_0x1931d6[_0x8954('0x2a')]);if(_0x1931d6[_0x8954('0x2b')]){delete _0x1931d6[_0x8954('0x2b')];}_0xf4e451[_0x8954('0x1d')](_0x50b51e)['send'](_0x1931d6);};}exports[_0x8954('0x2c')]=function(_0x180533,_0x55eb12){var _0x6adabe={},_0x27e58a={},_0x49e09a={'count':0x0,'rows':[]};var _0x2ccaff=_[_0x8954('0x2d')](db[_0x8954('0x2e')]['rawAttributes'],function(_0x1ed627){return{'name':_0x1ed627[_0x8954('0x2f')],'type':_0x1ed627[_0x8954('0x30')][_0x8954('0x31')]};});_0x27e58a[_0x8954('0x32')]=_[_0x8954('0x2d')](_0x2ccaff,_0x8954('0x2b'));_0x27e58a[_0x8954('0x33')]=_[_0x8954('0x34')](_0x180533[_0x8954('0x33')]);_0x27e58a[_0x8954('0x35')]=_[_0x8954('0x36')](_0x27e58a[_0x8954('0x32')],_0x27e58a['query']);_0x6adabe['attributes']=_[_0x8954('0x36')](_0x27e58a['model'],qs[_0x8954('0x37')](_0x180533[_0x8954('0x33')][_0x8954('0x37')]));_0x6adabe['attributes']=_0x6adabe[_0x8954('0x38')][_0x8954('0x39')]?_0x6adabe[_0x8954('0x38')]:_0x27e58a[_0x8954('0x32')];if(!_0x180533['query'][_0x8954('0x3a')](_0x8954('0x3b'))){_0x6adabe['limit']=qs[_0x8954('0x20')](_0x180533[_0x8954('0x33')]['limit']);_0x6adabe['offset']=qs[_0x8954('0x1e')](_0x180533[_0x8954('0x33')]['offset']);}_0x6adabe[_0x8954('0x3c')]=qs[_0x8954('0x3d')](_0x180533['query'][_0x8954('0x3d')]);_0x6adabe[_0x8954('0x3e')]=qs['filters'](_[_0x8954('0x3f')](_0x180533[_0x8954('0x33')],_0x27e58a[_0x8954('0x35')]),_0x2ccaff);if(_0x180533['query'][_0x8954('0x40')]){_0x6adabe['where']=_['merge'](_0x6adabe['where'],{'$or':_['map'](_0x2ccaff,function(_0x577d3d){if(_0x577d3d[_0x8954('0x30')]!==_0x8954('0x41')){var _0x447d3c={};_0x447d3c[_0x577d3d[_0x8954('0x2b')]]={'$like':'%'+_0x180533[_0x8954('0x33')][_0x8954('0x40')]+'%'};return _0x447d3c;}})});}_0x6adabe=_['merge']({},_0x6adabe,_0x180533[_0x8954('0x42')]);var _0x5b7d5c={'where':_0x6adabe[_0x8954('0x3e')]};return db[_0x8954('0x2e')][_0x8954('0x21')](_0x5b7d5c)[_0x8954('0x28')](function(_0x1f56e7){_0x49e09a[_0x8954('0x21')]=_0x1f56e7;if(_0x180533['query'][_0x8954('0x43')]){_0x6adabe['include']=[{'all':!![]}];}return db[_0x8954('0x2e')][_0x8954('0x44')](_0x6adabe);})['then'](function(_0x3bb929){_0x49e09a[_0x8954('0x45')]=_0x3bb929;return _0x49e09a;})[_0x8954('0x28')](respondWithFilteredResult(_0x55eb12,_0x6adabe))['catch'](handleError(_0x55eb12,null));};exports[_0x8954('0x46')]=function(_0x4899cf,_0x1d61ae){var _0xa5f97b={'raw':![],'where':{'id':_0x4899cf[_0x8954('0x47')]['id']}},_0x245cad={};_0x245cad[_0x8954('0x32')]=_['keys'](db[_0x8954('0x2e')][_0x8954('0x48')]);_0x245cad[_0x8954('0x33')]=_[_0x8954('0x34')](_0x4899cf[_0x8954('0x33')]);_0x245cad[_0x8954('0x35')]=_[_0x8954('0x36')](_0x245cad[_0x8954('0x32')],_0x245cad[_0x8954('0x33')]);_0xa5f97b['attributes']=_['intersection'](_0x245cad[_0x8954('0x32')],qs[_0x8954('0x37')](_0x4899cf[_0x8954('0x33')][_0x8954('0x37')]));_0xa5f97b[_0x8954('0x38')]=_0xa5f97b[_0x8954('0x38')][_0x8954('0x39')]?_0xa5f97b['attributes']:_0x245cad['model'];if(_0x4899cf[_0x8954('0x33')][_0x8954('0x43')]){_0xa5f97b[_0x8954('0x49')]=[{'all':!![]}];}_0xa5f97b=_[_0x8954('0x4a')]({},_0xa5f97b,_0x4899cf['options']);return db['Automation'][_0x8954('0x4b')](_0xa5f97b)[_0x8954('0x28')](handleEntityNotFound(_0x1d61ae,null))[_0x8954('0x28')](respondWithResult(_0x1d61ae,null))[_0x8954('0x4c')](handleError(_0x1d61ae,null));};exports['create']=function(_0x3d7e18,_0x1f01a5){return db[_0x8954('0x2e')][_0x8954('0x4d')](_0x3d7e18[_0x8954('0x4e')],{})[_0x8954('0x28')](respondWithResult(_0x1f01a5,0xc9))[_0x8954('0x4c')](handleError(_0x1f01a5,null));};exports[_0x8954('0x27')]=function(_0x53422c,_0x4454d8){if(_0x53422c[_0x8954('0x4e')]['id']){delete _0x53422c[_0x8954('0x4e')]['id'];}return db[_0x8954('0x2e')][_0x8954('0x4b')]({'where':{'id':_0x53422c['params']['id']}})[_0x8954('0x28')](handleEntityNotFound(_0x4454d8,null))[_0x8954('0x28')](saveUpdates(_0x53422c[_0x8954('0x4e')],null))['then'](respondWithResult(_0x4454d8,null))[_0x8954('0x4c')](handleError(_0x4454d8,null));};exports[_0x8954('0x4f')]=function(_0x3d447e,_0x29136b){return db[_0x8954('0x2e')][_0x8954('0x4b')]({'where':{'id':_0x3d447e['params']['id']}})[_0x8954('0x28')](handleEntityNotFound(_0x29136b,null))[_0x8954('0x28')](removeEntity(_0x29136b,null))[_0x8954('0x4c')](handleError(_0x29136b,null));};exports[_0x8954('0x50')]=function(_0x5cfe4e,_0x468efa,_0x4ac0d1){return db['Condition']['find']({'where':{'id':_0x5cfe4e[_0x8954('0x47')]['id']}})[_0x8954('0x28')](handleEntityNotFound(_0x468efa,null))[_0x8954('0x28')](function(_0x24eccb){if(_0x24eccb){return _0x24eccb['addConditions'](_0x5cfe4e[_0x8954('0x4e')][_0x8954('0x51')],_[_0x8954('0x52')](_0x5cfe4e['body'],[_0x8954('0x51'),'id'])||{});}})[_0x8954('0x28')](respondWithResult(_0x468efa,null))[_0x8954('0x4c')](handleError(_0x468efa,null));};exports[_0x8954('0x53')]=function(_0x449e8b,_0x7b4718,_0x3cd651){var _0x2b9d85={};var _0xeacb5f={};var _0x40c527;var _0x53013b;return db['Automation'][_0x8954('0x54')]({'where':{'id':_0x449e8b[_0x8954('0x47')]['id']}})[_0x8954('0x28')](handleEntityNotFound(_0x7b4718,null))['then'](function(_0x744a67){if(_0x744a67){_0x40c527=_0x744a67;_0xeacb5f['model']=_[_0x8954('0x34')](db[_0x8954('0x55')][_0x8954('0x48')]);_0xeacb5f[_0x8954('0x33')]=_[_0x8954('0x34')](_0x449e8b[_0x8954('0x33')]);_0xeacb5f[_0x8954('0x35')]=_[_0x8954('0x36')](_0xeacb5f[_0x8954('0x32')],_0xeacb5f[_0x8954('0x33')]);_0x2b9d85[_0x8954('0x38')]=_['intersection'](_0xeacb5f['model'],qs[_0x8954('0x37')](_0x449e8b[_0x8954('0x33')][_0x8954('0x37')]));_0x2b9d85[_0x8954('0x38')]=_0x2b9d85[_0x8954('0x38')][_0x8954('0x39')]?_0x2b9d85[_0x8954('0x38')]:_0xeacb5f[_0x8954('0x32')];_0x2b9d85[_0x8954('0x3c')]=qs['sort'](_0x449e8b[_0x8954('0x33')][_0x8954('0x3d')]);_0x2b9d85['where']=qs[_0x8954('0x35')](_[_0x8954('0x3f')](_0x449e8b['query'],_0xeacb5f[_0x8954('0x35')]));if(_0x449e8b[_0x8954('0x33')][_0x8954('0x40')]){_0x2b9d85[_0x8954('0x3e')]=_['merge'](_0x2b9d85[_0x8954('0x3e')],{'$or':_[_0x8954('0x2d')](_0x2b9d85['attributes'],function(_0x4c4e2b){var _0x188c86={};_0x188c86[_0x4c4e2b]={'$like':'%'+_0x449e8b[_0x8954('0x33')][_0x8954('0x40')]+'%'};return _0x188c86;})});}_0x2b9d85=_[_0x8954('0x4a')]({},_0x2b9d85,_0x449e8b[_0x8954('0x42')]);return _0x40c527[_0x8954('0x53')](_0x2b9d85);}})[_0x8954('0x28')](function(_0x51809d){if(_0x51809d){_0x53013b=_0x51809d[_0x8954('0x39')];if(!_0x449e8b[_0x8954('0x33')][_0x8954('0x3a')](_0x8954('0x3b'))){_0x2b9d85[_0x8954('0x20')]=qs[_0x8954('0x20')](_0x449e8b[_0x8954('0x33')]['limit']);_0x2b9d85[_0x8954('0x1e')]=qs[_0x8954('0x1e')](_0x449e8b[_0x8954('0x33')][_0x8954('0x1e')]);}return _0x40c527[_0x8954('0x53')](_0x2b9d85);}})[_0x8954('0x28')](function(_0x2a1f4c){if(_0x2a1f4c){return _0x2a1f4c?{'count':_0x53013b,'rows':_0x2a1f4c}:null;}})['then'](respondWithResult(_0x7b4718,null))[_0x8954('0x4c')](handleError(_0x7b4718,null));};exports[_0x8954('0x56')]=function(_0x4a109d,_0x534e45,_0x4906e8){return db[_0x8954('0x57')]['find']({'where':{'id':_0x4a109d[_0x8954('0x47')]['id']}})[_0x8954('0x28')](handleEntityNotFound(_0x534e45,null))[_0x8954('0x28')](function(_0x436394){if(_0x436394){return _0x436394[_0x8954('0x56')](_0x4a109d['body'][_0x8954('0x51')],_['omit'](_0x4a109d[_0x8954('0x4e')],[_0x8954('0x51'),'id'])||{});}})['then'](respondWithResult(_0x534e45,null))[_0x8954('0x4c')](handleError(_0x534e45,null));};exports['getActions']=function(_0x30a821,_0x4ec080,_0x38f5c3){var _0x602d0d={};var _0x49fe6a={};var _0x1b21e8;var _0x26719b;return db[_0x8954('0x2e')][_0x8954('0x54')]({'where':{'id':_0x30a821[_0x8954('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ec080,null))[_0x8954('0x28')](function(_0x2215f){if(_0x2215f){_0x1b21e8=_0x2215f;_0x49fe6a[_0x8954('0x32')]=_[_0x8954('0x34')](db['Action'][_0x8954('0x48')]);_0x49fe6a['query']=_['keys'](_0x30a821[_0x8954('0x33')]);_0x49fe6a['filters']=_[_0x8954('0x36')](_0x49fe6a['model'],_0x49fe6a[_0x8954('0x33')]);_0x602d0d[_0x8954('0x38')]=_[_0x8954('0x36')](_0x49fe6a[_0x8954('0x32')],qs['fields'](_0x30a821[_0x8954('0x33')][_0x8954('0x37')]));_0x602d0d['attributes']=_0x602d0d[_0x8954('0x38')][_0x8954('0x39')]?_0x602d0d[_0x8954('0x38')]:_0x49fe6a[_0x8954('0x32')];_0x602d0d[_0x8954('0x3c')]=qs[_0x8954('0x3d')](_0x30a821[_0x8954('0x33')]['sort']);_0x602d0d[_0x8954('0x3e')]=qs[_0x8954('0x35')](_['pick'](_0x30a821[_0x8954('0x33')],_0x49fe6a[_0x8954('0x35')]));if(_0x30a821['query'][_0x8954('0x40')]){_0x602d0d[_0x8954('0x3e')]=_[_0x8954('0x4a')](_0x602d0d[_0x8954('0x3e')],{'$or':_[_0x8954('0x2d')](_0x602d0d[_0x8954('0x38')],function(_0x1f4db8){var _0x2cd507={};_0x2cd507[_0x1f4db8]={'$like':'%'+_0x30a821[_0x8954('0x33')][_0x8954('0x40')]+'%'};return _0x2cd507;})});}_0x602d0d=_['merge']({},_0x602d0d,_0x30a821['options']);return _0x1b21e8['getActions'](_0x602d0d);}})[_0x8954('0x28')](function(_0x2f9792){if(_0x2f9792){_0x26719b=_0x2f9792[_0x8954('0x39')];if(!_0x30a821[_0x8954('0x33')][_0x8954('0x3a')](_0x8954('0x3b'))){_0x602d0d[_0x8954('0x20')]=qs['limit'](_0x30a821[_0x8954('0x33')][_0x8954('0x20')]);_0x602d0d[_0x8954('0x1e')]=qs[_0x8954('0x1e')](_0x30a821[_0x8954('0x33')][_0x8954('0x1e')]);}return _0x1b21e8['getActions'](_0x602d0d);}})[_0x8954('0x28')](function(_0x36d9d1){if(_0x36d9d1){return _0x36d9d1?{'count':_0x26719b,'rows':_0x36d9d1}:null;}})[_0x8954('0x28')](respondWithResult(_0x4ec080,null))[_0x8954('0x4c')](handleError(_0x4ec080,null));}; \ No newline at end of file +var _0xdad8=['Automation','then','includeAll','findAll','rows','catch','show','include','options','find','create','body','addConditions','params','omit','ids','getConditions','findOne','Condition','order','nolimit','Action','addActions','getActions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge'];(function(_0x770c67,_0x1ea22b){var _0x2bdbbe=function(_0xbab638){while(--_0xbab638){_0x770c67['push'](_0x770c67['shift']());}};_0x2bdbbe(++_0x1ea22b);}(_0xdad8,0x1b2));var _0x8dad=function(_0x1ce559,_0xc71110){_0x1ce559=_0x1ce559-0x0;var _0x18e671=_0xdad8[_0x1ce559];return _0x18e671;};'use strict';var emlformat=require(_0x8dad('0x0'));var rimraf=require(_0x8dad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8dad('0x2'));var rp=require('request-promise');var moment=require(_0x8dad('0x3'));var BPromise=require(_0x8dad('0x4'));var Mustache=require('mustache');var util=require(_0x8dad('0x5'));var path=require(_0x8dad('0x6'));var sox=require(_0x8dad('0x7'));var csv=require(_0x8dad('0x8'));var ejs=require(_0x8dad('0x9'));var fs=require('fs');var fs_extra=require(_0x8dad('0xa'));var _=require(_0x8dad('0xb'));var squel=require(_0x8dad('0xc'));var crypto=require(_0x8dad('0xd'));var jsforce=require(_0x8dad('0xe'));var deskjs=require(_0x8dad('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8dad('0x10'));var Redis=require(_0x8dad('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dad('0x12'));var logger=require(_0x8dad('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8dad('0x14'));var licenseUtil=require(_0x8dad('0x15'));var db=require(_0x8dad('0x16'))['db'];function respondWithStatusCode(_0xe75e60,_0x3b69b7){_0x3b69b7=_0x3b69b7||0xcc;return function(_0x53d698){if(_0x53d698){return _0xe75e60['sendStatus'](_0x3b69b7);}return _0xe75e60[_0x8dad('0x17')](_0x3b69b7)[_0x8dad('0x18')]();};}function respondWithResult(_0x3175a5,_0x446146){_0x446146=_0x446146||0xc8;return function(_0xe3452e){if(_0xe3452e){return _0x3175a5[_0x8dad('0x17')](_0x446146)[_0x8dad('0x19')](_0xe3452e);}};}function respondWithFilteredResult(_0x24d720,_0x2f86cf){return function(_0x4fc10b){if(_0x4fc10b){var _0x56599b=typeof _0x2f86cf[_0x8dad('0x1a')]===_0x8dad('0x1b')&&typeof _0x2f86cf[_0x8dad('0x1c')]===_0x8dad('0x1b');var _0x1de77c=_0x4fc10b[_0x8dad('0x1d')];var _0x37d572=_0x56599b?0x0:_0x2f86cf[_0x8dad('0x1a')];var _0x631a75=_0x56599b?_0x4fc10b[_0x8dad('0x1d')]:_0x2f86cf[_0x8dad('0x1a')]+_0x2f86cf['limit'];var _0x5c1e78;if(_0x631a75>=_0x1de77c){_0x631a75=_0x1de77c;_0x5c1e78=0xc8;}else{_0x5c1e78=0xce;}_0x24d720[_0x8dad('0x17')](_0x5c1e78);return _0x24d720['set'](_0x8dad('0x1e'),_0x37d572+'-'+_0x631a75+'/'+_0x1de77c)['json'](_0x4fc10b);}return null;};}function patchUpdates(_0x42f807){return function(_0x50bb46){try{jsonpatch['apply'](_0x50bb46,_0x42f807,!![]);}catch(_0x5ac6d6){return BPromise[_0x8dad('0x1f')](_0x5ac6d6);}return _0x50bb46[_0x8dad('0x20')]();};}function saveUpdates(_0x595a96,_0x3519a2){return function(_0x508584){if(_0x508584){return _0x508584[_0x8dad('0x21')](_0x595a96)['then'](function(_0x546851){return _0x546851;});}return null;};}function removeEntity(_0x8a3191,_0x3ae81d){return function(_0x466fa9){if(_0x466fa9){return _0x466fa9[_0x8dad('0x22')]()['then'](function(){_0x8a3191[_0x8dad('0x17')](0xcc)[_0x8dad('0x18')]();});}};}function handleEntityNotFound(_0x5b7881,_0x31275e){return function(_0x1ae933){if(!_0x1ae933){_0x5b7881['sendStatus'](0x194);}return _0x1ae933;};}function handleError(_0x2907c8,_0x11baef){_0x11baef=_0x11baef||0x1f4;return function(_0x45e0d6){logger['error'](_0x45e0d6[_0x8dad('0x23')]);if(_0x45e0d6['name']){delete _0x45e0d6[_0x8dad('0x24')];}_0x2907c8[_0x8dad('0x17')](_0x11baef)[_0x8dad('0x25')](_0x45e0d6);};}exports[_0x8dad('0x26')]=function(_0x2d9321,_0x217633){var _0x5ef2fa={},_0x4835cf={},_0x1e39fa={'count':0x0,'rows':[]};var _0x5788fd=_[_0x8dad('0x27')](db['Automation'][_0x8dad('0x28')],function(_0x2480ac){return{'name':_0x2480ac[_0x8dad('0x29')],'type':_0x2480ac[_0x8dad('0x2a')][_0x8dad('0x2b')]};});_0x4835cf[_0x8dad('0x2c')]=_[_0x8dad('0x27')](_0x5788fd,_0x8dad('0x24'));_0x4835cf[_0x8dad('0x2d')]=_[_0x8dad('0x2e')](_0x2d9321[_0x8dad('0x2d')]);_0x4835cf['filters']=_[_0x8dad('0x2f')](_0x4835cf[_0x8dad('0x2c')],_0x4835cf[_0x8dad('0x2d')]);_0x5ef2fa[_0x8dad('0x30')]=_[_0x8dad('0x2f')](_0x4835cf['model'],qs[_0x8dad('0x31')](_0x2d9321[_0x8dad('0x2d')][_0x8dad('0x31')]));_0x5ef2fa['attributes']=_0x5ef2fa[_0x8dad('0x30')][_0x8dad('0x32')]?_0x5ef2fa['attributes']:_0x4835cf[_0x8dad('0x2c')];if(!_0x2d9321['query'][_0x8dad('0x33')]('nolimit')){_0x5ef2fa[_0x8dad('0x1c')]=qs[_0x8dad('0x1c')](_0x2d9321[_0x8dad('0x2d')][_0x8dad('0x1c')]);_0x5ef2fa[_0x8dad('0x1a')]=qs['offset'](_0x2d9321[_0x8dad('0x2d')]['offset']);}_0x5ef2fa['order']=qs[_0x8dad('0x34')](_0x2d9321['query']['sort']);_0x5ef2fa['where']=qs[_0x8dad('0x35')](_[_0x8dad('0x36')](_0x2d9321['query'],_0x4835cf[_0x8dad('0x35')]),_0x5788fd);if(_0x2d9321[_0x8dad('0x2d')][_0x8dad('0x37')]){_0x5ef2fa[_0x8dad('0x38')]=_[_0x8dad('0x39')](_0x5ef2fa[_0x8dad('0x38')],{'$or':_[_0x8dad('0x27')](_0x5788fd,function(_0x401c6a){if(_0x401c6a[_0x8dad('0x2a')]!=='VIRTUAL'){var _0x14379c={};_0x14379c[_0x401c6a[_0x8dad('0x24')]]={'$like':'%'+_0x2d9321['query'][_0x8dad('0x37')]+'%'};return _0x14379c;}})});}_0x5ef2fa=_['merge']({},_0x5ef2fa,_0x2d9321['options']);var _0x4b4641={'where':_0x5ef2fa[_0x8dad('0x38')]};return db[_0x8dad('0x3a')]['count'](_0x4b4641)[_0x8dad('0x3b')](function(_0xaf1cd6){_0x1e39fa[_0x8dad('0x1d')]=_0xaf1cd6;if(_0x2d9321[_0x8dad('0x2d')][_0x8dad('0x3c')]){_0x5ef2fa['include']=[{'all':!![]}];}return db[_0x8dad('0x3a')][_0x8dad('0x3d')](_0x5ef2fa);})['then'](function(_0x3074f4){_0x1e39fa[_0x8dad('0x3e')]=_0x3074f4;return _0x1e39fa;})[_0x8dad('0x3b')](respondWithFilteredResult(_0x217633,_0x5ef2fa))[_0x8dad('0x3f')](handleError(_0x217633,null));};exports[_0x8dad('0x40')]=function(_0x407ccd,_0x37cce5){var _0x4b01c5={'raw':![],'where':{'id':_0x407ccd['params']['id']}},_0x6f851={};_0x6f851[_0x8dad('0x2c')]=_[_0x8dad('0x2e')](db[_0x8dad('0x3a')][_0x8dad('0x28')]);_0x6f851[_0x8dad('0x2d')]=_[_0x8dad('0x2e')](_0x407ccd[_0x8dad('0x2d')]);_0x6f851[_0x8dad('0x35')]=_[_0x8dad('0x2f')](_0x6f851[_0x8dad('0x2c')],_0x6f851[_0x8dad('0x2d')]);_0x4b01c5[_0x8dad('0x30')]=_['intersection'](_0x6f851[_0x8dad('0x2c')],qs['fields'](_0x407ccd[_0x8dad('0x2d')][_0x8dad('0x31')]));_0x4b01c5[_0x8dad('0x30')]=_0x4b01c5[_0x8dad('0x30')][_0x8dad('0x32')]?_0x4b01c5[_0x8dad('0x30')]:_0x6f851[_0x8dad('0x2c')];if(_0x407ccd[_0x8dad('0x2d')][_0x8dad('0x3c')]){_0x4b01c5[_0x8dad('0x41')]=[{'all':!![]}];}_0x4b01c5=_[_0x8dad('0x39')]({},_0x4b01c5,_0x407ccd[_0x8dad('0x42')]);return db[_0x8dad('0x3a')][_0x8dad('0x43')](_0x4b01c5)[_0x8dad('0x3b')](handleEntityNotFound(_0x37cce5,null))['then'](respondWithResult(_0x37cce5,null))[_0x8dad('0x3f')](handleError(_0x37cce5,null));};exports[_0x8dad('0x44')]=function(_0x4195cb,_0x210f47){return db[_0x8dad('0x3a')][_0x8dad('0x44')](_0x4195cb[_0x8dad('0x45')],{})[_0x8dad('0x3b')](respondWithResult(_0x210f47,0xc9))[_0x8dad('0x3f')](handleError(_0x210f47,null));};exports[_0x8dad('0x21')]=function(_0x55c9d4,_0x48aa9d){if(_0x55c9d4[_0x8dad('0x45')]['id']){delete _0x55c9d4['body']['id'];}return db[_0x8dad('0x3a')][_0x8dad('0x43')]({'where':{'id':_0x55c9d4['params']['id']}})[_0x8dad('0x3b')](handleEntityNotFound(_0x48aa9d,null))['then'](saveUpdates(_0x55c9d4[_0x8dad('0x45')],null))[_0x8dad('0x3b')](respondWithResult(_0x48aa9d,null))[_0x8dad('0x3f')](handleError(_0x48aa9d,null));};exports[_0x8dad('0x22')]=function(_0x352ce5,_0x409707){return db['Automation'][_0x8dad('0x43')]({'where':{'id':_0x352ce5['params']['id']}})[_0x8dad('0x3b')](handleEntityNotFound(_0x409707,null))[_0x8dad('0x3b')](removeEntity(_0x409707,null))[_0x8dad('0x3f')](handleError(_0x409707,null));};exports[_0x8dad('0x46')]=function(_0x512a27,_0x6cba36,_0x58521f){return db['Condition'][_0x8dad('0x43')]({'where':{'id':_0x512a27[_0x8dad('0x47')]['id']}})[_0x8dad('0x3b')](handleEntityNotFound(_0x6cba36,null))['then'](function(_0x5aac05){if(_0x5aac05){return _0x5aac05[_0x8dad('0x46')](_0x512a27[_0x8dad('0x45')]['ids'],_[_0x8dad('0x48')](_0x512a27['body'],[_0x8dad('0x49'),'id'])||{});}})['then'](respondWithResult(_0x6cba36,null))[_0x8dad('0x3f')](handleError(_0x6cba36,null));};exports[_0x8dad('0x4a')]=function(_0x3d7257,_0x472347,_0x10230c){var _0x4e55df={};var _0x112b81={};var _0xe595f6;var _0x2e4dc7;return db[_0x8dad('0x3a')][_0x8dad('0x4b')]({'where':{'id':_0x3d7257['params']['id']}})[_0x8dad('0x3b')](handleEntityNotFound(_0x472347,null))['then'](function(_0x5c8219){if(_0x5c8219){_0xe595f6=_0x5c8219;_0x112b81[_0x8dad('0x2c')]=_[_0x8dad('0x2e')](db[_0x8dad('0x4c')][_0x8dad('0x28')]);_0x112b81['query']=_[_0x8dad('0x2e')](_0x3d7257[_0x8dad('0x2d')]);_0x112b81['filters']=_[_0x8dad('0x2f')](_0x112b81['model'],_0x112b81[_0x8dad('0x2d')]);_0x4e55df['attributes']=_[_0x8dad('0x2f')](_0x112b81[_0x8dad('0x2c')],qs[_0x8dad('0x31')](_0x3d7257[_0x8dad('0x2d')][_0x8dad('0x31')]));_0x4e55df[_0x8dad('0x30')]=_0x4e55df['attributes'][_0x8dad('0x32')]?_0x4e55df[_0x8dad('0x30')]:_0x112b81['model'];_0x4e55df[_0x8dad('0x4d')]=qs['sort'](_0x3d7257[_0x8dad('0x2d')]['sort']);_0x4e55df['where']=qs['filters'](_[_0x8dad('0x36')](_0x3d7257['query'],_0x112b81[_0x8dad('0x35')]));if(_0x3d7257[_0x8dad('0x2d')][_0x8dad('0x37')]){_0x4e55df[_0x8dad('0x38')]=_['merge'](_0x4e55df[_0x8dad('0x38')],{'$or':_[_0x8dad('0x27')](_0x4e55df[_0x8dad('0x30')],function(_0x1deb83){var _0x322c5b={};_0x322c5b[_0x1deb83]={'$like':'%'+_0x3d7257[_0x8dad('0x2d')]['filter']+'%'};return _0x322c5b;})});}_0x4e55df=_['merge']({},_0x4e55df,_0x3d7257[_0x8dad('0x42')]);return _0xe595f6[_0x8dad('0x4a')](_0x4e55df);}})[_0x8dad('0x3b')](function(_0x4b33b0){if(_0x4b33b0){_0x2e4dc7=_0x4b33b0[_0x8dad('0x32')];if(!_0x3d7257[_0x8dad('0x2d')][_0x8dad('0x33')](_0x8dad('0x4e'))){_0x4e55df[_0x8dad('0x1c')]=qs[_0x8dad('0x1c')](_0x3d7257['query'][_0x8dad('0x1c')]);_0x4e55df[_0x8dad('0x1a')]=qs[_0x8dad('0x1a')](_0x3d7257[_0x8dad('0x2d')]['offset']);}return _0xe595f6[_0x8dad('0x4a')](_0x4e55df);}})[_0x8dad('0x3b')](function(_0x2c9e43){if(_0x2c9e43){return _0x2c9e43?{'count':_0x2e4dc7,'rows':_0x2c9e43}:null;}})[_0x8dad('0x3b')](respondWithResult(_0x472347,null))['catch'](handleError(_0x472347,null));};exports['addActions']=function(_0x22fbb5,_0x1f2932,_0x2973c4){return db[_0x8dad('0x4f')]['find']({'where':{'id':_0x22fbb5[_0x8dad('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f2932,null))[_0x8dad('0x3b')](function(_0x5ef534){if(_0x5ef534){return _0x5ef534[_0x8dad('0x50')](_0x22fbb5['body'][_0x8dad('0x49')],_[_0x8dad('0x48')](_0x22fbb5[_0x8dad('0x45')],['ids','id'])||{});}})[_0x8dad('0x3b')](respondWithResult(_0x1f2932,null))['catch'](handleError(_0x1f2932,null));};exports[_0x8dad('0x51')]=function(_0x18126a,_0x544478,_0x17840c){var _0x4e4fcf={};var _0x3e02fe={};var _0x20ace8;var _0x40cb0a;return db[_0x8dad('0x3a')]['findOne']({'where':{'id':_0x18126a[_0x8dad('0x47')]['id']}})[_0x8dad('0x3b')](handleEntityNotFound(_0x544478,null))[_0x8dad('0x3b')](function(_0x27d6e7){if(_0x27d6e7){_0x20ace8=_0x27d6e7;_0x3e02fe[_0x8dad('0x2c')]=_[_0x8dad('0x2e')](db[_0x8dad('0x4f')][_0x8dad('0x28')]);_0x3e02fe[_0x8dad('0x2d')]=_[_0x8dad('0x2e')](_0x18126a[_0x8dad('0x2d')]);_0x3e02fe[_0x8dad('0x35')]=_[_0x8dad('0x2f')](_0x3e02fe['model'],_0x3e02fe[_0x8dad('0x2d')]);_0x4e4fcf[_0x8dad('0x30')]=_['intersection'](_0x3e02fe[_0x8dad('0x2c')],qs[_0x8dad('0x31')](_0x18126a[_0x8dad('0x2d')][_0x8dad('0x31')]));_0x4e4fcf[_0x8dad('0x30')]=_0x4e4fcf[_0x8dad('0x30')][_0x8dad('0x32')]?_0x4e4fcf[_0x8dad('0x30')]:_0x3e02fe['model'];_0x4e4fcf[_0x8dad('0x4d')]=qs[_0x8dad('0x34')](_0x18126a[_0x8dad('0x2d')][_0x8dad('0x34')]);_0x4e4fcf[_0x8dad('0x38')]=qs['filters'](_[_0x8dad('0x36')](_0x18126a[_0x8dad('0x2d')],_0x3e02fe[_0x8dad('0x35')]));if(_0x18126a[_0x8dad('0x2d')]['filter']){_0x4e4fcf['where']=_[_0x8dad('0x39')](_0x4e4fcf[_0x8dad('0x38')],{'$or':_[_0x8dad('0x27')](_0x4e4fcf[_0x8dad('0x30')],function(_0x542668){var _0x5e6311={};_0x5e6311[_0x542668]={'$like':'%'+_0x18126a['query']['filter']+'%'};return _0x5e6311;})});}_0x4e4fcf=_[_0x8dad('0x39')]({},_0x4e4fcf,_0x18126a[_0x8dad('0x42')]);return _0x20ace8[_0x8dad('0x51')](_0x4e4fcf);}})[_0x8dad('0x3b')](function(_0x512258){if(_0x512258){_0x40cb0a=_0x512258['length'];if(!_0x18126a['query'][_0x8dad('0x33')]('nolimit')){_0x4e4fcf[_0x8dad('0x1c')]=qs['limit'](_0x18126a[_0x8dad('0x2d')][_0x8dad('0x1c')]);_0x4e4fcf[_0x8dad('0x1a')]=qs[_0x8dad('0x1a')](_0x18126a[_0x8dad('0x2d')][_0x8dad('0x1a')]);}return _0x20ace8[_0x8dad('0x51')](_0x4e4fcf);}})[_0x8dad('0x3b')](function(_0x58d0ec){if(_0x58d0ec){return _0x58d0ec?{'count':_0x40cb0a,'rows':_0x58d0ec}:null;}})['then'](respondWithResult(_0x544478,null))[_0x8dad('0x3f')](handleError(_0x544478,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 419cfad..3e1ba5b 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 _0xed43=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Automation','tools_automations'];(function(_0x1c98fa,_0x3167ca){var _0x524ac1=function(_0x41a984){while(--_0x41a984){_0x1c98fa['push'](_0x1c98fa['shift']());}};_0x524ac1(++_0x3167ca);}(_0xed43,0x172));var _0x3ed4=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0xed43[_0x22f85a];return _0xaa717;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3ed4('0x0'))(_0x3ed4('0x1'));var moment=require(_0x3ed4('0x2'));var BPromise=require('bluebird');var rp=require(_0x3ed4('0x3'));var fs=require('fs');var path=require(_0x3ed4('0x4'));var rimraf=require(_0x3ed4('0x5'));var config=require(_0x3ed4('0x6'));var attributes=require('./automation.attributes');module[_0x3ed4('0x7')]=function(_0x33ddab,_0x5d46dd){return _0x33ddab['define'](_0x3ed4('0x8'),attributes,{'tableName':_0x3ed4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88d8=['rimraf','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x24bdf6,_0x3ccdf6){var _0x4bba55=function(_0x153765){while(--_0x153765){_0x24bdf6['push'](_0x24bdf6['shift']());}};_0x4bba55(++_0x3ccdf6);}(_0x88d8,0x1e6));var _0x888d=function(_0x3d248e,_0xb9500e){_0x3d248e=_0x3d248e-0x0;var _0x292c43=_0x88d8[_0x3d248e];return _0x292c43;};'use strict';var _=require(_0x888d('0x0'));var util=require(_0x888d('0x1'));var logger=require(_0x888d('0x2'))(_0x888d('0x3'));var moment=require(_0x888d('0x4'));var BPromise=require(_0x888d('0x5'));var rp=require(_0x888d('0x6'));var fs=require('fs');var path=require(_0x888d('0x7'));var rimraf=require(_0x888d('0x8'));var config=require('../../config/environment');var attributes=require(_0x888d('0x9'));module[_0x888d('0xa')]=function(_0x9c661d,_0x1d93cf){return _0x9c661d['define'](_0x888d('0xb'),attributes,{'tableName':_0x888d('0xc'),'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 0cae6ef..8b47045 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 _0xe5fc=['http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3ca829,_0xc55f17){var _0x3b416b=function(_0x592aae){while(--_0x592aae){_0x3ca829['push'](_0x3ca829['shift']());}};_0x3b416b(++_0xc55f17);}(_0xe5fc,0x109));var _0xce5f=function(_0x42d1f0,_0x2b279c){_0x42d1f0=_0x42d1f0-0x0;var _0x383ec4=_0xe5fc[_0x42d1f0];return _0x383ec4;};'use strict';var _=require(_0xce5f('0x0'));var util=require('util');var moment=require(_0xce5f('0x1'));var BPromise=require(_0xce5f('0x2'));var rs=require(_0xce5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce5f('0x4'))('rpc');var config=require(_0xce5f('0x5'));var jayson=require(_0xce5f('0x6'));var client=jayson[_0xce5f('0x7')][_0xce5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ef,_0x30a150,_0x2b64dc){return new BPromise(function(_0x3451af,_0x4fa651){return client[_0xce5f('0x9')](_0x3b77ef,_0x2b64dc)[_0xce5f('0xa')](function(_0x29a7bf){logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));logger[_0xce5f('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x30a150,_0xce5f('0xd'),JSON[_0xce5f('0xf')](_0x29a7bf));if(_0x29a7bf[_0xce5f('0x10')]){if(_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x11')]===0x1f4){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x4fa651(_0x29a7bf['error']['message']);}logger['error'](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x3451af(_0x29a7bf[_0xce5f('0x10')]['message']);}else{logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));_0x3451af(_0x29a7bf[_0xce5f('0x13')][_0xce5f('0x12')]);}})[_0xce5f('0x14')](function(_0x1544ba){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x1544ba);_0x4fa651(_0x1544ba);});});} \ No newline at end of file +var _0x3c85=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','debug','stringify','error','code','message','Automation,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0x3c85,0x1a0));var _0x53c8=function(_0x27a2bf,_0x18d0cf){_0x27a2bf=_0x27a2bf-0x0;var _0x53a201=_0x3c85[_0x27a2bf];return _0x53a201;};'use strict';var _=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var moment=require(_0x53c8('0x2'));var BPromise=require(_0x53c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53c8('0x4'))['db'];var utils=require(_0x53c8('0x5'));var logger=require(_0x53c8('0x6'))('rpc');var config=require(_0x53c8('0x7'));var jayson=require(_0x53c8('0x8'));var client=jayson[_0x53c8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5271ad,_0x4bc6ae,_0x4bb757){return new BPromise(function(_0x7d5c2a,_0x4de781){return client['request'](_0x5271ad,_0x4bb757)[_0x53c8('0xa')](function(_0x19504c){logger['info']('Automation,\x20%s,\x20%s',_0x4bc6ae,'request\x20sent');logger[_0x53c8('0xb')]('Automation,\x20%s,\x20%s,\x20%s',_0x4bc6ae,'request\x20sent',JSON[_0x53c8('0xc')](_0x19504c));if(_0x19504c[_0x53c8('0xd')]){if(_0x19504c[_0x53c8('0xd')][_0x53c8('0xe')]===0x1f4){logger[_0x53c8('0xd')]('Automation,\x20%s,\x20%s',_0x4bc6ae,_0x19504c[_0x53c8('0xd')][_0x53c8('0xf')]);return _0x4de781(_0x19504c[_0x53c8('0xd')]['message']);}logger[_0x53c8('0xd')](_0x53c8('0x10'),_0x4bc6ae,_0x19504c['error'][_0x53c8('0xf')]);return _0x7d5c2a(_0x19504c[_0x53c8('0xd')][_0x53c8('0xf')]);}else{logger[_0x53c8('0x11')](_0x53c8('0x10'),_0x4bc6ae,_0x53c8('0x12'));_0x7d5c2a(_0x19504c[_0x53c8('0x13')][_0x53c8('0xf')]);}})[_0x53c8('0x14')](function(_0x8a7c46){logger[_0x53c8('0xd')](_0x53c8('0x10'),_0x4bc6ae,_0x8a7c46);_0x4de781(_0x8a7c46);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index a15d9e4..0c32ca8 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 _0x572b=['../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','create','post','addConditions','addActions','update','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x47efe5,_0x10d6fd){var _0x1a0a84=function(_0xf64bcd){while(--_0xf64bcd){_0x47efe5['push'](_0x47efe5['shift']());}};_0x1a0a84(++_0x10d6fd);}(_0x572b,0x1b2));var _0xb572=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x572b[_0x4bd950];return _0x5dc59a;};'use strict';var multer=require(_0xb572('0x0'));var util=require(_0xb572('0x1'));var path=require(_0xb572('0x2'));var timeout=require(_0xb572('0x3'));var express=require(_0xb572('0x4'));var router=express['Router']();var fs_extra=require(_0xb572('0x5'));var auth=require(_0xb572('0x6'));var interaction=require(_0xb572('0x7'));var config=require('../../config/environment');var controller=require(_0xb572('0x8'));router[_0xb572('0x9')]('/',auth[_0xb572('0xa')](),controller[_0xb572('0xb')]);router[_0xb572('0x9')](_0xb572('0xc'),auth[_0xb572('0xa')](),controller[_0xb572('0xd')]);router[_0xb572('0x9')](_0xb572('0xe'),auth['isAuthenticated'](),controller[_0xb572('0xf')]);router['get'](_0xb572('0x10'),auth[_0xb572('0xa')](),controller['getActions']);router['post']('/',auth[_0xb572('0xa')](),controller[_0xb572('0x11')]);router[_0xb572('0x12')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xb572('0x13')]);router['post'](_0xb572('0x10'),auth[_0xb572('0xa')](),controller[_0xb572('0x14')]);router['put'](_0xb572('0xc'),auth[_0xb572('0xa')](),controller[_0xb572('0x15')]);router['delete'](_0xb572('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x94ca=['isAuthenticated','/:id','show','/:id/actions','getActions','post','create','/:id/conditions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x53b7ff,_0x280fa1){var _0x5f0222=function(_0x357f47){while(--_0x357f47){_0x53b7ff['push'](_0x53b7ff['shift']());}};_0x5f0222(++_0x280fa1);}(_0x94ca,0xde));var _0xa94c=function(_0x5d4dd7,_0x38229c){_0x5d4dd7=_0x5d4dd7-0x0;var _0x2ce0ad=_0x94ca[_0x5d4dd7];return _0x2ce0ad;};'use strict';var multer=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var path=require(_0xa94c('0x2'));var timeout=require(_0xa94c('0x3'));var express=require(_0xa94c('0x4'));var router=express[_0xa94c('0x5')]();var fs_extra=require(_0xa94c('0x6'));var auth=require(_0xa94c('0x7'));var interaction=require(_0xa94c('0x8'));var config=require(_0xa94c('0x9'));var controller=require(_0xa94c('0xa'));router[_0xa94c('0xb')]('/',auth[_0xa94c('0xc')](),controller['index']);router[_0xa94c('0xb')](_0xa94c('0xd'),auth[_0xa94c('0xc')](),controller[_0xa94c('0xe')]);router['get']('/:id/conditions',auth['isAuthenticated'](),controller['getConditions']);router[_0xa94c('0xb')](_0xa94c('0xf'),auth['isAuthenticated'](),controller[_0xa94c('0x10')]);router[_0xa94c('0x11')]('/',auth[_0xa94c('0xc')](),controller[_0xa94c('0x12')]);router[_0xa94c('0x11')](_0xa94c('0x13'),auth['isAuthenticated'](),controller['addConditions']);router['post'](_0xa94c('0xf'),auth[_0xa94c('0xc')](),controller[_0xa94c('0x14')]);router[_0xa94c('0x15')](_0xa94c('0xd'),auth[_0xa94c('0xc')](),controller[_0xa94c('0x16')]);router[_0xa94c('0x17')](_0xa94c('0xd'),auth['isAuthenticated'](),controller[_0xa94c('0x18')]);module[_0xa94c('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 53ad9a3..9e110ab 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 _0xd1ca=['sequelize','exports','ivr','STRING','Active/Disactive\x20Campaign','Max\x20200\x20calls.','UNSIGNED','INTEGER','#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','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0xb8e3d3,_0x3df4f2){var _0xcce310=function(_0x5935cf){while(--_0x5935cf){_0xb8e3d3['push'](_0xb8e3d3['shift']());}};_0xcce310(++_0x3df4f2);}(_0xd1ca,0x140));var _0xad1c=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xd1ca[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0xad1c('0x0'));module[_0xad1c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xad1c('0x2')),'allowNull':![],'defaultValue':_0xad1c('0x2')},'description':{'type':Sequelize[_0xad1c('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xad1c('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xad1c('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0xad1c('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xad1c('0x3')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xad1c('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xad1c('0x7')](0x3)[_0xad1c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad1c('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xad1c('0x7')](0x5)[_0xad1c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad1c('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xad1c('0x7')](0x3)[_0xad1c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad1c('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xad1c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad1c('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xad1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xad1c('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xad1c('0x7')](0x5)[_0xad1c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad1c('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xad1c('0x7')](0x3)[_0xad1c('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xad1c('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xad1c('0x3')],'defaultValue':_0xad1c('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xad1c('0x10')](_0xad1c('0x11'),_0xad1c('0x12'),'onlyIfOpen'),'defaultValue':_0xad1c('0x11')},'dialAMDActive':{'type':Sequelize[_0xad1c('0x13')],'defaultValue':0x0,'comment':_0xad1c('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xad1c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xad1c('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xad1c('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xad1c('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xad1c('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xad1c('0x7')](0x9)[_0xad1c('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xad1c('0x18')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xad1c('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xad1c('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xad1c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xad1c('0x7')](0x9)[_0xad1c('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xad1c('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xad1c('0x7')](0x5)[_0xad1c('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xad1c('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xad1c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xad1c('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xad1c('0x10')](_0xad1c('0x1d'),_0xad1c('0x1e')),'defaultValue':_0xad1c('0x1d')},'dialPrefix':{'type':Sequelize[_0xad1c('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xad1c('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xad1c('0x7')](0x3)[_0xad1c('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xad1c('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xad1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad1c('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xad1c('0x7')](0x5)[_0xad1c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad1c('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0xad1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad1c('0x22')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xad1c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad1c('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xad1c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad1c('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xad1c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xad1c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad1c('0x25')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xad1c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xad1c('0x7')](0x3)[_0xad1c('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xad1c('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xad1c('0x7')](0x5)[_0xad1c('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xad1c('0x27')}}; \ No newline at end of file +var _0xf1d3=['onlyIfOpen','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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','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,*,*,*','always'];(function(_0x1b5312,_0x778b7e){var _0x2daba5=function(_0x41aeb4){while(--_0x41aeb4){_0x1b5312['push'](_0x1b5312['shift']());}};_0x2daba5(++_0x778b7e);}(_0xf1d3,0xee));var _0x3f1d=function(_0x42a3af,_0xb48a6c){_0x42a3af=_0x42a3af-0x0;var _0x46cc92=_0xf1d3[_0x42a3af];return _0x46cc92;};'use strict';var Sequelize=require(_0x3f1d('0x0'));module[_0x3f1d('0x1')]={'name':{'type':Sequelize[_0x3f1d('0x2')],'unique':_0x3f1d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3f1d('0x4')](_0x3f1d('0x5')),'allowNull':![],'defaultValue':_0x3f1d('0x5')},'description':{'type':Sequelize[_0x3f1d('0x2')]},'active':{'type':Sequelize[_0x3f1d('0x6')],'defaultValue':0x0,'comment':_0x3f1d('0x7')},'limitCalls':{'type':Sequelize[_0x3f1d('0x8')](0x4)[_0x3f1d('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3f1d('0xa')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3f1d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x3f1d('0x8')](0x3)[_0x3f1d('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3f1d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f1d('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3f1d('0x8')](0x5)[_0x3f1d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f1d('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3f1d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f1d('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3f1d('0x8')](0x5)[_0x3f1d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f1d('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3f1d('0x9')],'defaultValue':0x3,'comment':_0x3f1d('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3f1d('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f1d('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3f1d('0x8')](0x3)[_0x3f1d('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3f1d('0x11')},'dialTimezone':{'type':Sequelize[_0x3f1d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3f1d('0x2')],'defaultValue':_0x3f1d('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x3f1d('0x4')](_0x3f1d('0x13'),'never',_0x3f1d('0x14')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x3f1d('0x6')],'defaultValue':0x0,'comment':_0x3f1d('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x3f1d('0x8')](0x9)[_0x3f1d('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3f1d('0x16')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x3f1d('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3f1d('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3f1d('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3f1d('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3f1d('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x3f1d('0x8')](0x9)[_0x3f1d('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3f1d('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3f1d('0x8')](0x9)[_0x3f1d('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3f1d('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3f1d('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3f1d('0x8')](0x5)[_0x3f1d('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3f1d('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3f1d('0x8')](0x9)[_0x3f1d('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3f1d('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3f1d('0x4')](_0x3f1d('0x1f'),_0x3f1d('0x20')),'defaultValue':_0x3f1d('0x1f')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3f1d('0x8')](0x3)[_0x3f1d('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3f1d('0x21')},'dialCutDigit':{'type':Sequelize[_0x3f1d('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3f1d('0x22')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3f1d('0x8')](0x3)[_0x3f1d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f1d('0x23')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3f1d('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f1d('0x24')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3f1d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f1d('0x25')},'dialDropRetryFrequency':{'type':Sequelize[_0x3f1d('0x8')](0x5)[_0x3f1d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f1d('0x26')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3f1d('0x8')](0x5)[_0x3f1d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f1d('0x27')},'dialMachineMaxRetry':{'type':Sequelize[_0x3f1d('0x8')](0x3)[_0x3f1d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x3f1d('0x8')](0x5)[_0x3f1d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f1d('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3f1d('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3f1d('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3f1d('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3f1d('0x2a')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2b95d16..b99d27b 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 _0xbde2=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','stack','name','index','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','Campaign','keys','rawAttributes','find','create','user','get','IvrCampaigns','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','include','omit','createdAt','updatedAt','body','params','getHoppers','findOne','CmHopper','order','pick','CampaignId','findAll','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ContactId','select','NOW()','field','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','ListId\x20=\x20?','cmHopperId','OrderBy','h.id','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x1135e9,_0x198c05){var _0x39c4d1=function(_0x3c1bf3){while(--_0x3c1bf3){_0x1135e9['push'](_0x1135e9['shift']());}};_0x39c4d1(++_0x198c05);}(_0xbde2,0x7a));var _0x2bde=function(_0x307133,_0x570033){_0x307133=_0x307133-0x0;var _0x363fea=_0xbde2[_0x307133];return _0x363fea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bde('0x0'));var zipdir=require(_0x2bde('0x1'));var jsonpatch=require(_0x2bde('0x2'));var rp=require('request-promise');var moment=require(_0x2bde('0x3'));var BPromise=require(_0x2bde('0x4'));var Mustache=require(_0x2bde('0x5'));var util=require('util');var path=require(_0x2bde('0x6'));var sox=require(_0x2bde('0x7'));var csv=require(_0x2bde('0x8'));var ejs=require(_0x2bde('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2bde('0xa'));var squel=require(_0x2bde('0xb'));var crypto=require(_0x2bde('0xc'));var jsforce=require(_0x2bde('0xd'));var deskjs=require(_0x2bde('0xe'));var toCsv=require(_0x2bde('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2bde('0xf'));var qs=require(_0x2bde('0x10'));var as=require(_0x2bde('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bde('0x12'))(_0x2bde('0x13'));var utils=require(_0x2bde('0x14'));var config=require(_0x2bde('0x15'));var licenseUtil=require(_0x2bde('0x16'));var db=require(_0x2bde('0x17'))['db'];function respondWithStatusCode(_0x5c98f3,_0x62de8f){_0x62de8f=_0x62de8f||0xcc;return function(_0x5ba816){if(_0x5ba816){return _0x5c98f3[_0x2bde('0x18')](_0x62de8f);}return _0x5c98f3[_0x2bde('0x19')](_0x62de8f)[_0x2bde('0x1a')]();};}function respondWithResult(_0x22b48,_0x3441dd){_0x3441dd=_0x3441dd||0xc8;return function(_0x2583da){if(_0x2583da){return _0x22b48[_0x2bde('0x19')](_0x3441dd)[_0x2bde('0x1b')](_0x2583da);}};}function respondWithFilteredResult(_0xaa6cec,_0x1bfcda){return function(_0x329331){if(_0x329331){var _0x1b2958=typeof _0x1bfcda[_0x2bde('0x1c')]===_0x2bde('0x1d')&&typeof _0x1bfcda['limit']==='undefined';var _0x145aa3=_0x329331[_0x2bde('0x1e')];var _0x39da17=_0x1b2958?0x0:_0x1bfcda[_0x2bde('0x1c')];var _0x590e44=_0x1b2958?_0x329331[_0x2bde('0x1e')]:_0x1bfcda[_0x2bde('0x1c')]+_0x1bfcda[_0x2bde('0x1f')];var _0x34f820;if(_0x590e44>=_0x145aa3){_0x590e44=_0x145aa3;_0x34f820=0xc8;}else{_0x34f820=0xce;}_0xaa6cec[_0x2bde('0x19')](_0x34f820);return _0xaa6cec[_0x2bde('0x20')](_0x2bde('0x21'),_0x39da17+'-'+_0x590e44+'/'+_0x145aa3)[_0x2bde('0x1b')](_0x329331);}return null;};}function patchUpdates(_0x58e640){return function(_0xe302eb){try{jsonpatch['apply'](_0xe302eb,_0x58e640,!![]);}catch(_0x560202){return BPromise[_0x2bde('0x22')](_0x560202);}return _0xe302eb[_0x2bde('0x23')]();};}function saveUpdates(_0x27b6e1,_0x481dd2){return function(_0x6c0da){if(_0x6c0da){return _0x6c0da[_0x2bde('0x24')](_0x27b6e1)[_0x2bde('0x25')](function(_0x5b4463){return _0x5b4463;});}return null;};}function removeEntity(_0x17d654,_0xc492e4){return function(_0x2479d7){if(_0x2479d7){return _0x2479d7['destroy']()['then'](function(){var _0x591aea=_0x2479d7['get']({'plain':!![]});var _0x109da2='IvrCampaigns';return db[_0x2bde('0x26')][_0x2bde('0x27')]({'where':{'type':_0x109da2,'resourceId':_0x591aea['id']}})[_0x2bde('0x25')](function(){return _0x2479d7;});})[_0x2bde('0x25')](function(){_0x17d654['status'](0xcc)[_0x2bde('0x1a')]();});}};}function handleEntityNotFound(_0x3e9222,_0x2cd535){return function(_0x4a2d24){if(!_0x4a2d24){_0x3e9222[_0x2bde('0x18')](0x194);}return _0x4a2d24;};}function handleError(_0x4328bf,_0x2962e4){_0x2962e4=_0x2962e4||0x1f4;return function(_0x336c7d){logger[_0x2bde('0x28')](_0x336c7d[_0x2bde('0x29')]);if(_0x336c7d[_0x2bde('0x2a')]){delete _0x336c7d['name'];}_0x4328bf[_0x2bde('0x19')](_0x2962e4)['send'](_0x336c7d);};}exports[_0x2bde('0x2b')]=function(_0x2be21,_0x2310b7){var _0x3f7584={},_0x10d1b3={},_0xd7a015={'count':0x0,'rows':[]};var _0x9efba6=_[_0x2bde('0x2c')](db['Campaign']['rawAttributes'],function(_0x2e74d4){return{'name':_0x2e74d4[_0x2bde('0x2d')],'type':_0x2e74d4[_0x2bde('0x2e')][_0x2bde('0x2f')]};});_0x10d1b3[_0x2bde('0x30')]=_[_0x2bde('0x2c')](_0x9efba6,_0x2bde('0x2a'));_0x10d1b3['query']=_['keys'](_0x2be21[_0x2bde('0x31')]);_0x10d1b3[_0x2bde('0x32')]=_['intersection'](_0x10d1b3[_0x2bde('0x30')],_0x10d1b3[_0x2bde('0x31')]);_0x3f7584[_0x2bde('0x33')]=_[_0x2bde('0x34')](_0x10d1b3['model'],qs[_0x2bde('0x35')](_0x2be21[_0x2bde('0x31')][_0x2bde('0x35')]));_0x3f7584[_0x2bde('0x33')]=_0x3f7584[_0x2bde('0x33')][_0x2bde('0x36')]?_0x3f7584['attributes']:_0x10d1b3[_0x2bde('0x30')];if(!_0x2be21['query'][_0x2bde('0x37')](_0x2bde('0x38'))){_0x3f7584[_0x2bde('0x1f')]=qs[_0x2bde('0x1f')](_0x2be21['query'][_0x2bde('0x1f')]);_0x3f7584['offset']=qs[_0x2bde('0x1c')](_0x2be21[_0x2bde('0x31')][_0x2bde('0x1c')]);}_0x3f7584['order']=qs['sort'](_0x2be21[_0x2bde('0x31')][_0x2bde('0x39')]);_0x3f7584['where']=qs[_0x2bde('0x32')](_['pick'](_0x2be21[_0x2bde('0x31')],_0x10d1b3['filters']),_0x9efba6);if(_0x2be21[_0x2bde('0x31')][_0x2bde('0x3a')]){_0x3f7584[_0x2bde('0x3b')]=_['merge'](_0x3f7584[_0x2bde('0x3b')],{'$or':_['map'](_0x9efba6,function(_0x59379f){if(_0x59379f[_0x2bde('0x2e')]!==_0x2bde('0x3c')){var _0x207004={};_0x207004[_0x59379f[_0x2bde('0x2a')]]={'$like':'%'+_0x2be21[_0x2bde('0x31')][_0x2bde('0x3a')]+'%'};return _0x207004;}})});}_0x3f7584=_[_0x2bde('0x3d')]({},_0x3f7584,_0x2be21[_0x2bde('0x3e')]);var _0x2cdd7e={'where':_0x3f7584[_0x2bde('0x3b')]};return db['Campaign'][_0x2bde('0x1e')](_0x2cdd7e)['then'](function(_0x5b8760){_0xd7a015[_0x2bde('0x1e')]=_0x5b8760;if(_0x2be21['query'][_0x2bde('0x3f')]){_0x3f7584['include']=[{'all':!![]}];}return db[_0x2bde('0x40')]['findAll'](_0x3f7584);})[_0x2bde('0x25')](function(_0x2eb305){_0xd7a015['rows']=_0x2eb305;return _0xd7a015;})[_0x2bde('0x25')](respondWithFilteredResult(_0x2310b7,_0x3f7584))['catch'](handleError(_0x2310b7,null));};exports['show']=function(_0x78f6a4,_0x541e5c){var _0x410bda={'raw':![],'where':{'id':_0x78f6a4['params']['id']}},_0x28a418={};_0x28a418['model']=_[_0x2bde('0x41')](db[_0x2bde('0x40')][_0x2bde('0x42')]);_0x28a418[_0x2bde('0x31')]=_[_0x2bde('0x41')](_0x78f6a4[_0x2bde('0x31')]);_0x28a418['filters']=_[_0x2bde('0x34')](_0x28a418[_0x2bde('0x30')],_0x28a418[_0x2bde('0x31')]);_0x410bda[_0x2bde('0x33')]=_['intersection'](_0x28a418[_0x2bde('0x30')],qs[_0x2bde('0x35')](_0x78f6a4[_0x2bde('0x31')][_0x2bde('0x35')]));_0x410bda[_0x2bde('0x33')]=_0x410bda[_0x2bde('0x33')]['length']?_0x410bda['attributes']:_0x28a418['model'];if(_0x78f6a4[_0x2bde('0x31')][_0x2bde('0x3f')]){_0x410bda['include']=[{'all':!![]}];}_0x410bda=_[_0x2bde('0x3d')]({},_0x410bda,_0x78f6a4['options']);return db[_0x2bde('0x40')][_0x2bde('0x43')](_0x410bda)[_0x2bde('0x25')](handleEntityNotFound(_0x541e5c,null))[_0x2bde('0x25')](respondWithResult(_0x541e5c,null))['catch'](handleError(_0x541e5c,null));};exports[_0x2bde('0x44')]=function(_0x39cf8e,_0x5932fb){return db['Campaign'][_0x2bde('0x44')](_0x39cf8e['body'],{})['then'](function(_0x546aa7){var _0x186b94=_0x39cf8e[_0x2bde('0x45')][_0x2bde('0x46')]({'plain':!![]});if(!_0x186b94)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x186b94['role']===_0x2bde('0x45')){var _0x490038=_0x546aa7[_0x2bde('0x46')]({'plain':!![]});var _0x36a704=_0x2bde('0x47');return db[_0x2bde('0x48')][_0x2bde('0x43')]({'where':{'name':_0x36a704,'userProfileId':_0x186b94['userProfileId']},'raw':!![]})[_0x2bde('0x25')](function(_0x2e1b27){if(_0x2e1b27&&_0x2e1b27[_0x2bde('0x49')]===0x0){return db[_0x2bde('0x26')]['create']({'name':_0x490038['name'],'resourceId':_0x490038['id'],'type':_0x2e1b27[_0x2bde('0x2a')],'sectionId':_0x2e1b27['id']},{})[_0x2bde('0x25')](function(){return _0x546aa7;});}else{return _0x546aa7;}})['catch'](function(_0xe6afd4){logger['error'](_0x2bde('0x4a'),_0xe6afd4);throw _0xe6afd4;});}return _0x546aa7;})[_0x2bde('0x25')](respondWithResult(_0x5932fb,0xc9))[_0x2bde('0x4b')](handleError(_0x5932fb,null));};exports['clone']=function(_0x104c16,_0x769b1b){var _0x37f787={'where':{'id':_0x104c16['params']['id']}},_0x30c745={};_0x30c745[_0x2bde('0x30')]=_[_0x2bde('0x41')](db[_0x2bde('0x40')]['rawAttributes']);_0x37f787['attributes']=_[_0x2bde('0x34')](_0x30c745['model'],qs['fields'](_0x104c16[_0x2bde('0x31')][_0x2bde('0x35')]));_0x37f787[_0x2bde('0x33')]=_0x37f787[_0x2bde('0x33')][_0x2bde('0x36')]?_0x37f787[_0x2bde('0x33')]:_0x30c745[_0x2bde('0x30')];if(_0x104c16['query'][_0x2bde('0x3f')]){_0x37f787[_0x2bde('0x4c')]=[{'all':!![]}];}_0x37f787=_[_0x2bde('0x3d')]({},_0x37f787,_0x104c16[_0x2bde('0x3e')]);return db[_0x2bde('0x40')][_0x2bde('0x43')](_0x37f787)[_0x2bde('0x25')](handleEntityNotFound(_0x769b1b,null))[_0x2bde('0x25')](function(_0x1c1440){if(_0x1c1440){var _0x44b23e=_0x1c1440[_0x2bde('0x46')]({'plain':!![]});_0x44b23e=qs[_0x2bde('0x4d')](_0x44b23e,['id',_0x2bde('0x4e'),_0x2bde('0x4f')]);_0x104c16[_0x2bde('0x50')]=_[_0x2bde('0x4d')](_0x104c16[_0x2bde('0x50')],['id',_0x2bde('0x4e'),'updatedAt']);return db[_0x2bde('0x40')]['create'](_['merge'](_0x44b23e,_0x104c16[_0x2bde('0x50')]),{'include':_0x104c16[_0x2bde('0x31')][_0x2bde('0x3f')]?[{'all':!![]}]:undefined})[_0x2bde('0x25')](function(_0x2c2660){var _0x2d51fb=_0x104c16['user']['get']({'plain':!![]});if(!_0x2d51fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d51fb['role']===_0x2bde('0x45')){var _0x591a37=_0x2c2660[_0x2bde('0x46')]({'plain':!![]});var _0x38c80d='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x38c80d,'userProfileId':_0x2d51fb['userProfileId']},'raw':!![]})[_0x2bde('0x25')](function(_0x24ef8a){if(_0x24ef8a&&_0x24ef8a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x591a37[_0x2bde('0x2a')],'resourceId':_0x591a37['id'],'type':_0x24ef8a[_0x2bde('0x2a')],'sectionId':_0x24ef8a['id']},{})[_0x2bde('0x25')](function(){return _0x2c2660;});}else{return _0x2c2660;}})['catch'](function(_0x2dbd0b){logger[_0x2bde('0x28')](_0x2bde('0x4a'),_0x2dbd0b);throw _0x2dbd0b;});}return _0x2c2660;});}})['then'](respondWithResult(_0x769b1b,0xc9))[_0x2bde('0x4b')](handleError(_0x769b1b,null));};exports['update']=function(_0x1798b2,_0xa2128d){if(_0x1798b2[_0x2bde('0x50')]['id']){delete _0x1798b2[_0x2bde('0x50')]['id'];}return db[_0x2bde('0x40')]['find']({'where':{'id':_0x1798b2[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0xa2128d,null))[_0x2bde('0x25')](saveUpdates(_0x1798b2[_0x2bde('0x50')],null))[_0x2bde('0x25')](respondWithResult(_0xa2128d,null))[_0x2bde('0x4b')](handleError(_0xa2128d,null));};exports[_0x2bde('0x27')]=function(_0x11a214,_0x27f14a){return db[_0x2bde('0x40')]['find']({'where':{'id':_0x11a214['params']['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x27f14a,null))['then'](removeEntity(_0x27f14a,null))[_0x2bde('0x4b')](handleError(_0x27f14a,null));};exports[_0x2bde('0x52')]=function(_0x2e25e9,_0x355fce,_0x4afdda){var _0x214d58={'raw':!![],'where':{}};var _0x57d4b2={};var _0x4f34ed={'count':0x0,'rows':[]};return db['Campaign'][_0x2bde('0x53')]({'where':{'id':_0x2e25e9[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x355fce,null))['then'](function(_0x27576d){if(_0x27576d){_0x57d4b2[_0x2bde('0x30')]=_['keys'](db[_0x2bde('0x54')]['rawAttributes']);_0x57d4b2[_0x2bde('0x31')]=_['keys'](_0x2e25e9[_0x2bde('0x31')]);_0x57d4b2[_0x2bde('0x32')]=_[_0x2bde('0x34')](_0x57d4b2[_0x2bde('0x30')],_0x57d4b2['query']);_0x214d58[_0x2bde('0x33')]=_['intersection'](_0x57d4b2[_0x2bde('0x30')],qs[_0x2bde('0x35')](_0x2e25e9['query']['fields']));_0x214d58[_0x2bde('0x33')]=_0x214d58['attributes'][_0x2bde('0x36')]?_0x214d58['attributes']:_0x57d4b2[_0x2bde('0x30')];if(!_0x2e25e9[_0x2bde('0x31')][_0x2bde('0x37')]('nolimit')){_0x214d58[_0x2bde('0x1f')]=qs[_0x2bde('0x1f')](_0x2e25e9[_0x2bde('0x31')][_0x2bde('0x1f')]);_0x214d58[_0x2bde('0x1c')]=qs[_0x2bde('0x1c')](_0x2e25e9[_0x2bde('0x31')][_0x2bde('0x1c')]);}_0x214d58[_0x2bde('0x55')]=qs[_0x2bde('0x39')](_0x2e25e9[_0x2bde('0x31')]['sort']);_0x214d58[_0x2bde('0x3b')]=qs['filters'](_[_0x2bde('0x56')](_0x2e25e9[_0x2bde('0x31')],_0x57d4b2['filters']));_0x214d58[_0x2bde('0x3b')][_0x2bde('0x57')]=_0x27576d['id'];if(_0x2e25e9['query'][_0x2bde('0x3a')]){_0x214d58[_0x2bde('0x3b')]=_[_0x2bde('0x3d')](_0x214d58[_0x2bde('0x3b')],{'$or':_[_0x2bde('0x2c')](_0x214d58[_0x2bde('0x33')],function(_0x23576b){var _0x2749e3={};_0x2749e3[_0x23576b]={'$like':'%'+_0x2e25e9[_0x2bde('0x31')]['filter']+'%'};return _0x2749e3;})});}_0x214d58=_[_0x2bde('0x3d')]({},_0x214d58,_0x2e25e9[_0x2bde('0x3e')]);return db[_0x2bde('0x54')][_0x2bde('0x1e')]({'where':_0x214d58[_0x2bde('0x3b')]})[_0x2bde('0x25')](function(_0x422fd3){_0x4f34ed[_0x2bde('0x1e')]=_0x422fd3;if(_0x2e25e9[_0x2bde('0x31')]['includeAll']){_0x214d58['include']=[{'all':!![]}];}return db[_0x2bde('0x54')][_0x2bde('0x58')](_0x214d58);})[_0x2bde('0x25')](function(_0x1b8583){_0x4f34ed['rows']=_0x1b8583;return _0x4f34ed;});}})[_0x2bde('0x25')](respondWithFilteredResult(_0x355fce,_0x214d58))[_0x2bde('0x4b')](handleError(_0x355fce,null));};exports[_0x2bde('0x59')]=function(_0x413d7d,_0x4cf9fd,_0x6f251d){var _0x25bdc5={'raw':!![],'where':{}};var _0x3914e8={};var _0x5a3f31={'count':0x0,'rows':[]};return db[_0x2bde('0x40')][_0x2bde('0x53')]({'where':{'id':_0x413d7d[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x4cf9fd,null))[_0x2bde('0x25')](function(_0x112d26){if(_0x112d26){_0x3914e8['model']=_[_0x2bde('0x41')](db['CmHopperHistory'][_0x2bde('0x42')]);_0x3914e8[_0x2bde('0x31')]=_[_0x2bde('0x41')](_0x413d7d[_0x2bde('0x31')]);_0x3914e8['filters']=_[_0x2bde('0x34')](_0x3914e8['model'],_0x3914e8['query']);_0x25bdc5[_0x2bde('0x33')]=_['intersection'](_0x3914e8[_0x2bde('0x30')],qs[_0x2bde('0x35')](_0x413d7d[_0x2bde('0x31')][_0x2bde('0x35')]));_0x25bdc5[_0x2bde('0x33')]=_0x25bdc5['attributes'][_0x2bde('0x36')]?_0x25bdc5[_0x2bde('0x33')]:_0x3914e8['model'];if(!_0x413d7d[_0x2bde('0x31')][_0x2bde('0x37')](_0x2bde('0x38'))){_0x25bdc5[_0x2bde('0x1f')]=qs[_0x2bde('0x1f')](_0x413d7d[_0x2bde('0x31')][_0x2bde('0x1f')]);_0x25bdc5['offset']=qs[_0x2bde('0x1c')](_0x413d7d[_0x2bde('0x31')]['offset']);}_0x25bdc5[_0x2bde('0x55')]=qs[_0x2bde('0x39')](_0x413d7d[_0x2bde('0x31')]['sort']);_0x25bdc5[_0x2bde('0x3b')]=qs[_0x2bde('0x32')](_[_0x2bde('0x56')](_0x413d7d[_0x2bde('0x31')],_0x3914e8[_0x2bde('0x32')]));_0x25bdc5[_0x2bde('0x3b')][_0x2bde('0x57')]=_0x112d26['id'];if(_0x413d7d[_0x2bde('0x31')][_0x2bde('0x3a')]){_0x25bdc5[_0x2bde('0x3b')]=_[_0x2bde('0x3d')](_0x25bdc5['where'],{'$or':_[_0x2bde('0x2c')](_0x25bdc5['attributes'],function(_0x2d0a57){var _0x18c4f5={};_0x18c4f5[_0x2d0a57]={'$like':'%'+_0x413d7d[_0x2bde('0x31')][_0x2bde('0x3a')]+'%'};return _0x18c4f5;})});}_0x25bdc5=_['merge']({},_0x25bdc5,_0x413d7d[_0x2bde('0x3e')]);return db['CmHopperHistory'][_0x2bde('0x1e')]({'where':_0x25bdc5[_0x2bde('0x3b')]})[_0x2bde('0x25')](function(_0x3a363c){_0x5a3f31[_0x2bde('0x1e')]=_0x3a363c;if(_0x413d7d[_0x2bde('0x31')]['includeAll']){_0x25bdc5['include']=[{'all':!![]}];}return db[_0x2bde('0x5a')][_0x2bde('0x58')](_0x25bdc5);})[_0x2bde('0x25')](function(_0x190c26){_0x5a3f31[_0x2bde('0x5b')]=_0x190c26;return _0x5a3f31;});}})[_0x2bde('0x25')](respondWithFilteredResult(_0x4cf9fd,_0x25bdc5))[_0x2bde('0x4b')](handleError(_0x4cf9fd,null));};exports[_0x2bde('0x5c')]=function(_0x4f3517,_0x3307d9,_0x54437c){var _0x198c26={'raw':!![],'where':{}};var _0x3703c5={};var _0x178039={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4f3517[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x3307d9,null))[_0x2bde('0x25')](function(_0x33381d){if(_0x33381d){_0x3703c5[_0x2bde('0x30')]=_['keys'](db[_0x2bde('0x5d')][_0x2bde('0x42')]);_0x3703c5['query']=_[_0x2bde('0x41')](_0x4f3517[_0x2bde('0x31')]);_0x3703c5[_0x2bde('0x32')]=_['intersection'](_0x3703c5[_0x2bde('0x30')],_0x3703c5[_0x2bde('0x31')]);_0x198c26[_0x2bde('0x33')]=_['intersection'](_0x3703c5[_0x2bde('0x30')],qs[_0x2bde('0x35')](_0x4f3517['query'][_0x2bde('0x35')]));_0x198c26[_0x2bde('0x33')]=_0x198c26[_0x2bde('0x33')]['length']?_0x198c26['attributes']:_0x3703c5[_0x2bde('0x30')];if(!_0x4f3517[_0x2bde('0x31')][_0x2bde('0x37')]('nolimit')){_0x198c26[_0x2bde('0x1f')]=qs['limit'](_0x4f3517[_0x2bde('0x31')][_0x2bde('0x1f')]);_0x198c26[_0x2bde('0x1c')]=qs[_0x2bde('0x1c')](_0x4f3517[_0x2bde('0x31')][_0x2bde('0x1c')]);}_0x198c26[_0x2bde('0x55')]=qs[_0x2bde('0x39')](_0x4f3517[_0x2bde('0x31')][_0x2bde('0x39')]);_0x198c26[_0x2bde('0x3b')]=qs['filters'](_[_0x2bde('0x56')](_0x4f3517[_0x2bde('0x31')],_0x3703c5['filters']));_0x198c26[_0x2bde('0x3b')][_0x2bde('0x57')]=_0x33381d['id'];if(_0x4f3517[_0x2bde('0x31')]['filter']){_0x198c26[_0x2bde('0x3b')]=_[_0x2bde('0x3d')](_0x198c26[_0x2bde('0x3b')],{'$or':_[_0x2bde('0x2c')](_0x198c26[_0x2bde('0x33')],function(_0xb8bf2e){var _0x2e3bd0={};_0x2e3bd0[_0xb8bf2e]={'$like':'%'+_0x4f3517['query'][_0x2bde('0x3a')]+'%'};return _0x2e3bd0;})});}_0x198c26=_['merge']({},_0x198c26,_0x4f3517[_0x2bde('0x3e')]);return db[_0x2bde('0x5d')][_0x2bde('0x1e')]({'where':_0x198c26[_0x2bde('0x3b')]})[_0x2bde('0x25')](function(_0x348a77){_0x178039[_0x2bde('0x1e')]=_0x348a77;if(_0x4f3517[_0x2bde('0x31')][_0x2bde('0x3f')]){_0x198c26['include']=[{'all':!![]}];}return db[_0x2bde('0x5d')]['findAll'](_0x198c26);})['then'](function(_0x28971d){_0x178039[_0x2bde('0x5b')]=_0x28971d;return _0x178039;});}})[_0x2bde('0x25')](respondWithFilteredResult(_0x3307d9,_0x198c26))[_0x2bde('0x4b')](handleError(_0x3307d9,null));};exports[_0x2bde('0x5e')]=function(_0x540d39,_0x3c0677,_0x21c8d4){var _0x5b3d73={'raw':!![],'where':{}};var _0x18ff7b={};var _0x4e89db={'count':0x0,'rows':[]};return db[_0x2bde('0x40')]['findOne']({'where':{'id':_0x540d39[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x3c0677,null))['then'](function(_0x3bb359){if(_0x3bb359){_0x18ff7b[_0x2bde('0x30')]=_[_0x2bde('0x41')](db[_0x2bde('0x5f')][_0x2bde('0x42')]);_0x18ff7b[_0x2bde('0x31')]=_['keys'](_0x540d39[_0x2bde('0x31')]);_0x18ff7b[_0x2bde('0x32')]=_[_0x2bde('0x34')](_0x18ff7b[_0x2bde('0x30')],_0x18ff7b[_0x2bde('0x31')]);_0x5b3d73[_0x2bde('0x33')]=_[_0x2bde('0x34')](_0x18ff7b[_0x2bde('0x30')],qs[_0x2bde('0x35')](_0x540d39['query'][_0x2bde('0x35')]));_0x5b3d73[_0x2bde('0x33')]=_0x5b3d73[_0x2bde('0x33')][_0x2bde('0x36')]?_0x5b3d73[_0x2bde('0x33')]:_0x18ff7b[_0x2bde('0x30')];if(!_0x540d39['query']['hasOwnProperty'](_0x2bde('0x38'))){_0x5b3d73[_0x2bde('0x1f')]=qs[_0x2bde('0x1f')](_0x540d39[_0x2bde('0x31')][_0x2bde('0x1f')]);_0x5b3d73[_0x2bde('0x1c')]=qs['offset'](_0x540d39[_0x2bde('0x31')]['offset']);}_0x5b3d73[_0x2bde('0x55')]=qs[_0x2bde('0x39')](_0x540d39[_0x2bde('0x31')][_0x2bde('0x39')]);_0x5b3d73['where']=qs[_0x2bde('0x32')](_[_0x2bde('0x56')](_0x540d39[_0x2bde('0x31')],_0x18ff7b[_0x2bde('0x32')]));_0x5b3d73[_0x2bde('0x3b')][_0x2bde('0x57')]=_0x3bb359['id'];if(_0x540d39[_0x2bde('0x31')]['filter']){_0x5b3d73[_0x2bde('0x3b')]=_[_0x2bde('0x3d')](_0x5b3d73[_0x2bde('0x3b')],{'$or':_[_0x2bde('0x2c')](_0x5b3d73[_0x2bde('0x33')],function(_0x4f4816){var _0x232e4e={};_0x232e4e[_0x4f4816]={'$like':'%'+_0x540d39['query']['filter']+'%'};return _0x232e4e;})});}_0x5b3d73=_['merge']({},_0x5b3d73,_0x540d39[_0x2bde('0x3e')]);return db['CmHopperBlack'][_0x2bde('0x1e')]({'where':_0x5b3d73[_0x2bde('0x3b')]})[_0x2bde('0x25')](function(_0x5d6d25){_0x4e89db[_0x2bde('0x1e')]=_0x5d6d25;if(_0x540d39['query'][_0x2bde('0x3f')]){_0x5b3d73['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x2bde('0x58')](_0x5b3d73);})[_0x2bde('0x25')](function(_0x2733da){_0x4e89db[_0x2bde('0x5b')]=_0x2733da;return _0x4e89db;});}})['then'](respondWithFilteredResult(_0x3c0677,_0x5b3d73))['catch'](handleError(_0x3c0677,null));};exports[_0x2bde('0x60')]=function(_0x5dff1e,_0x234b87,_0x1c9247){var _0x1db77f={};var _0x1a5c57={};var _0x251895;var _0x553c6f;return db[_0x2bde('0x40')][_0x2bde('0x53')]({'where':{'id':_0x5dff1e['params']['id']}})['then'](handleEntityNotFound(_0x234b87,null))['then'](function(_0x11c9f3){if(_0x11c9f3){_0x251895=_0x11c9f3;_0x1a5c57[_0x2bde('0x30')]=_[_0x2bde('0x41')](db[_0x2bde('0x61')][_0x2bde('0x42')]);_0x1a5c57[_0x2bde('0x31')]=_[_0x2bde('0x41')](_0x5dff1e[_0x2bde('0x31')]);_0x1a5c57[_0x2bde('0x32')]=_['intersection'](_0x1a5c57[_0x2bde('0x30')],_0x1a5c57['query']);_0x1db77f[_0x2bde('0x33')]=_[_0x2bde('0x34')](_0x1a5c57[_0x2bde('0x30')],qs[_0x2bde('0x35')](_0x5dff1e['query'][_0x2bde('0x35')]));_0x1db77f['attributes']=_0x1db77f[_0x2bde('0x33')][_0x2bde('0x36')]?_0x1db77f[_0x2bde('0x33')]:_0x1a5c57['model'];_0x1db77f['order']=qs[_0x2bde('0x39')](_0x5dff1e[_0x2bde('0x31')][_0x2bde('0x39')]);_0x1db77f[_0x2bde('0x3b')]=qs[_0x2bde('0x32')](_[_0x2bde('0x56')](_0x5dff1e[_0x2bde('0x31')],_0x1a5c57[_0x2bde('0x32')]));if(_0x5dff1e[_0x2bde('0x31')][_0x2bde('0x3a')]){_0x1db77f[_0x2bde('0x3b')]=_[_0x2bde('0x3d')](_0x1db77f[_0x2bde('0x3b')],{'$or':_[_0x2bde('0x2c')](_0x1db77f[_0x2bde('0x33')],function(_0x40bdc4){var _0x52312a={};_0x52312a[_0x40bdc4]={'$like':'%'+_0x5dff1e[_0x2bde('0x31')][_0x2bde('0x3a')]+'%'};return _0x52312a;})});}_0x1db77f=_[_0x2bde('0x3d')]({},_0x1db77f,_0x5dff1e[_0x2bde('0x3e')]);return _0x251895[_0x2bde('0x60')](_0x1db77f);}})[_0x2bde('0x25')](function(_0x2985f1){if(_0x2985f1){_0x553c6f=_0x2985f1[_0x2bde('0x36')];if(!_0x5dff1e[_0x2bde('0x31')]['hasOwnProperty'](_0x2bde('0x38'))){_0x1db77f['limit']=qs['limit'](_0x5dff1e[_0x2bde('0x31')][_0x2bde('0x1f')]);_0x1db77f[_0x2bde('0x1c')]=qs['offset'](_0x5dff1e[_0x2bde('0x31')][_0x2bde('0x1c')]);}return _0x251895[_0x2bde('0x60')](_0x1db77f);}})[_0x2bde('0x25')](function(_0x3b782c){if(_0x3b782c){return _0x3b782c?{'count':_0x553c6f,'rows':_0x3b782c}:null;}})[_0x2bde('0x25')](respondWithResult(_0x234b87,null))[_0x2bde('0x4b')](handleError(_0x234b87,null));};exports[_0x2bde('0x62')]=function(_0x412a2a,_0x314332,_0xfeedb5){var _0xd8b9a,_0x3d531f;var _0x50ba0a=[];var _0x447a86=moment()[_0x2bde('0x63')](_0x2bde('0x64'));return db['Campaign'][_0x2bde('0x43')]({'where':{'id':_0x412a2a[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x314332,null))['then'](function(_0x3e5131){if(_0x3e5131){_0x3d531f=_0x3e5131;return _0x3e5131['addLists'](_0x412a2a[_0x2bde('0x50')][_0x2bde('0x65')],_['omit'](_0x412a2a[_0x2bde('0x50')],[_0x2bde('0x65'),'id'])||{});}return null;})[_0x2bde('0x66')](function(_0x43bce2){var _0x42ab28;var _0x1cbe0d;_0xd8b9a=_0x43bce2||[];var _0x5363a7=[];if(_0x43bce2){for(var _0xaab5c8=0x0;_0xaab5c8<_0x43bce2[_0x2bde('0x36')];_0xaab5c8+=0x1){var _0x455a71=_0x43bce2[_0xaab5c8]['get']({'plain':!![]});_0x3d531f['dialCheckDuplicateType']=_0x412a2a['body']['dialCheckDuplicateType']?_0x412a2a['body'][_0x2bde('0x67')]:_0x3d531f[_0x2bde('0x67')];switch(_0x3d531f[_0x2bde('0x67')]){case'always':_0x42ab28=squel[_0x2bde('0x68')]()[_0x2bde('0x69')](_0x2bde('0x6a'))['fromQuery']([_0x2bde('0x6b'),_0x2bde('0x6c'),_0x2bde('0x6d'),'ListId',_0x2bde('0x57'),'createdAt',_0x2bde('0x4f')],squel[_0x2bde('0x6e')]()['field'](_0x2bde('0x6b'),_0x2bde('0x6b'))['field'](_0x2bde('0x6f'),_0x2bde('0x6c'))[_0x2bde('0x70')]('id',_0x2bde('0x6d'))[_0x2bde('0x70')](_0x455a71[_0x2bde('0x71')][_0x2bde('0x72')](),_0x2bde('0x73'))[_0x2bde('0x70')](_0x412a2a['params']['id'][_0x2bde('0x72')](),_0x2bde('0x57'))[_0x2bde('0x70')]('\x27'+_0x447a86+'\x27',_0x2bde('0x4e'))[_0x2bde('0x70')]('\x27'+_0x447a86+'\x27','updatedAt')['from'](_0x2bde('0x74'))[_0x2bde('0x3b')](_0x2bde('0x75'))[_0x2bde('0x3b')]('ListId\x20=\x20?',_0x455a71[_0x2bde('0x71')]['toString']())[_0x2bde('0x3b')](_0x2bde('0x76'))[_0x2bde('0x3b')](_0x2bde('0x77'),squel[_0x2bde('0x6e')]()[_0x2bde('0x70')](_0x2bde('0x78'))[_0x2bde('0x79')]('cm_hopper_final')[_0x2bde('0x3b')](_0x2bde('0x7a'),_0x412a2a['params']['id'][_0x2bde('0x72')]()))['where'](_0x2bde('0x77'),squel[_0x2bde('0x6e')]()[_0x2bde('0x70')]('COALESCE(phone,\x27\x27)')['from'](_0x2bde('0x6a'))[_0x2bde('0x3b')](_0x2bde('0x7a'),_0x412a2a[_0x2bde('0x51')]['id'][_0x2bde('0x72')]())))[_0x2bde('0x72')]();break;case _0x2bde('0x7b'):_0x42ab28=squel[_0x2bde('0x68')]()['into'](_0x2bde('0x6a'))[_0x2bde('0x7c')]([_0x2bde('0x6b'),'scheduledAt',_0x2bde('0x6d'),_0x2bde('0x73'),'CampaignId',_0x2bde('0x4e'),'updatedAt'],squel[_0x2bde('0x6e')]()[_0x2bde('0x70')](_0x2bde('0x6b'),'phone')['field'](_0x2bde('0x6f'),_0x2bde('0x6c'))[_0x2bde('0x70')]('id','ContactId')[_0x2bde('0x70')](_0x455a71[_0x2bde('0x71')][_0x2bde('0x72')](),'ListId')[_0x2bde('0x70')](_0x412a2a[_0x2bde('0x51')]['id']['toString'](),_0x2bde('0x57'))['field']('\x27'+_0x447a86+'\x27','createdAt')[_0x2bde('0x70')]('\x27'+_0x447a86+'\x27',_0x2bde('0x4f'))[_0x2bde('0x79')](_0x2bde('0x74'))[_0x2bde('0x3b')](_0x2bde('0x75'))['where'](_0x2bde('0x7d'),_0x455a71[_0x2bde('0x71')][_0x2bde('0x72')]())[_0x2bde('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x2bde('0x3b')](_0x2bde('0x77'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x2bde('0x79')](_0x2bde('0x6a'))[_0x2bde('0x3b')]('CampaignId\x20=\x20?',_0x412a2a[_0x2bde('0x51')]['id'][_0x2bde('0x72')]())))['toString']();break;default:_0x42ab28=squel[_0x2bde('0x68')]()[_0x2bde('0x69')](_0x2bde('0x6a'))[_0x2bde('0x7c')](['phone','scheduledAt',_0x2bde('0x6d'),_0x2bde('0x73'),_0x2bde('0x57'),_0x2bde('0x4e'),_0x2bde('0x4f')],squel[_0x2bde('0x6e')]()[_0x2bde('0x70')](_0x2bde('0x6b'),_0x2bde('0x6b'))[_0x2bde('0x70')](_0x2bde('0x6f'),'scheduledAt')[_0x2bde('0x70')]('id',_0x2bde('0x6d'))[_0x2bde('0x70')](_0x455a71[_0x2bde('0x71')][_0x2bde('0x72')](),'ListId')['field'](_0x412a2a[_0x2bde('0x51')]['id']['toString'](),_0x2bde('0x57'))[_0x2bde('0x70')]('\x27'+_0x447a86+'\x27',_0x2bde('0x4e'))[_0x2bde('0x70')]('\x27'+_0x447a86+'\x27',_0x2bde('0x4f'))['from']('cm_contacts')[_0x2bde('0x3b')]('deletedAt\x20IS\x20NULL')[_0x2bde('0x3b')]('ListId\x20=\x20?',_0x455a71[_0x2bde('0x71')]['toString']())[_0x2bde('0x3b')](_0x2bde('0x76')))[_0x2bde('0x72')]();}_0x1cbe0d=squel[_0x2bde('0x68')]()[_0x2bde('0x69')]('cm_hopper_additional_phones')['fromQuery']([_0x2bde('0x7e'),_0x2bde('0x6c'),_0x2bde('0x6b'),_0x2bde('0x7f'),_0x2bde('0x4e'),_0x2bde('0x4f')],squel[_0x2bde('0x6e')]()[_0x2bde('0x70')](_0x2bde('0x80'),'id')[_0x2bde('0x70')](_0x2bde('0x6f'),_0x2bde('0x6c'))['field']('ci.item',_0x2bde('0x6b'))[_0x2bde('0x70')]('ci.OrderBY','OrderBy')['field']('\x27'+_0x447a86+'\x27','createdAt')['field']('\x27'+_0x447a86+'\x27',_0x2bde('0x4f'))[_0x2bde('0x79')](_0x2bde('0x81'),'ci')[_0x2bde('0x82')]('cm_hopper','h',_0x2bde('0x83'))[_0x2bde('0x3b')](_0x2bde('0x84'),_0x455a71[_0x2bde('0x71')]['toString']())[_0x2bde('0x3b')](_0x2bde('0x85'),_0x412a2a['params']['id']['toString']())[_0x2bde('0x3b')](_0x2bde('0x86'),_0x447a86))[_0x2bde('0x72')]();_0x5363a7[_0x2bde('0x87')](db[_0x2bde('0x88')][_0x2bde('0x31')](_0x42ab28));_0x50ba0a[_0x2bde('0x87')](db['sequelize'][_0x2bde('0x31')](_0x1cbe0d));}return BPromise[_0x2bde('0x89')](_0x5363a7);}})['then'](function(){return BPromise['all'](_0x50ba0a);})[_0x2bde('0x25')](function(){return _0xd8b9a;})[_0x2bde('0x25')](respondWithResult(_0x314332,null))[_0x2bde('0x4b')](handleError(_0x314332,null));};exports['removeLists']=function(_0x2bb27f,_0x1d74e5,_0x28429a){return db[_0x2bde('0x40')][_0x2bde('0x43')]({'where':{'id':_0x2bb27f['params']['id']}})['then'](handleEntityNotFound(_0x1d74e5,null))['then'](function(_0xe8a831){if(_0xe8a831){return _0xe8a831[_0x2bde('0x8a')](_0x2bb27f['query']['ids']);}})['then'](function(_0x5b2855){if(_0x5b2855){return db[_0x2bde('0x54')][_0x2bde('0x27')]({'where':{'ListId':_0x2bb27f['query'][_0x2bde('0x65')],'CampaignId':_0x2bb27f[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](function(){return _0x5b2855;});}})[_0x2bde('0x25')](respondWithStatusCode(_0x1d74e5,null))[_0x2bde('0x4b')](handleError(_0x1d74e5,null));};exports[_0x2bde('0x8b')]=function(_0x22c1a6,_0x22e90b,_0x5404c5){var _0x40f310={};var _0x34ebbc={};var _0x52dfbe;var _0x19c2b1;return db[_0x2bde('0x40')][_0x2bde('0x53')]({'where':{'id':_0x22c1a6[_0x2bde('0x51')]['id']}})['then'](handleEntityNotFound(_0x22e90b,null))[_0x2bde('0x25')](function(_0x2ab5c1){if(_0x2ab5c1){_0x52dfbe=_0x2ab5c1;_0x34ebbc['model']=_[_0x2bde('0x41')](db[_0x2bde('0x61')]['rawAttributes']);_0x34ebbc[_0x2bde('0x31')]=_[_0x2bde('0x41')](_0x22c1a6[_0x2bde('0x31')]);_0x34ebbc['filters']=_[_0x2bde('0x34')](_0x34ebbc[_0x2bde('0x30')],_0x34ebbc[_0x2bde('0x31')]);_0x40f310[_0x2bde('0x33')]=_['intersection'](_0x34ebbc[_0x2bde('0x30')],qs[_0x2bde('0x35')](_0x22c1a6['query']['fields']));_0x40f310['attributes']=_0x40f310[_0x2bde('0x33')][_0x2bde('0x36')]?_0x40f310[_0x2bde('0x33')]:_0x34ebbc[_0x2bde('0x30')];_0x40f310[_0x2bde('0x55')]=qs[_0x2bde('0x39')](_0x22c1a6['query'][_0x2bde('0x39')]);_0x40f310['where']=qs[_0x2bde('0x32')](_[_0x2bde('0x56')](_0x22c1a6[_0x2bde('0x31')],_0x34ebbc[_0x2bde('0x32')]));if(_0x22c1a6[_0x2bde('0x31')]['filter']){_0x40f310['where']=_[_0x2bde('0x3d')](_0x40f310[_0x2bde('0x3b')],{'$or':_[_0x2bde('0x2c')](_0x40f310[_0x2bde('0x33')],function(_0x22864a){var _0x3f5dc3={};_0x3f5dc3[_0x22864a]={'$like':'%'+_0x22c1a6['query'][_0x2bde('0x3a')]+'%'};return _0x3f5dc3;})});}_0x40f310=_[_0x2bde('0x3d')]({},_0x40f310,_0x22c1a6[_0x2bde('0x3e')]);return _0x52dfbe[_0x2bde('0x8b')](_0x40f310);}})[_0x2bde('0x25')](function(_0x29a882){if(_0x29a882){_0x19c2b1=_0x29a882[_0x2bde('0x36')];if(!_0x22c1a6[_0x2bde('0x31')][_0x2bde('0x37')](_0x2bde('0x38'))){_0x40f310[_0x2bde('0x1f')]=qs[_0x2bde('0x1f')](_0x22c1a6['query'][_0x2bde('0x1f')]);_0x40f310['offset']=qs[_0x2bde('0x1c')](_0x22c1a6[_0x2bde('0x31')]['offset']);}return _0x52dfbe[_0x2bde('0x8b')](_0x40f310);}})[_0x2bde('0x25')](function(_0x4168f7){if(_0x4168f7){return _0x4168f7?{'count':_0x19c2b1,'rows':_0x4168f7}:null;}})[_0x2bde('0x25')](respondWithResult(_0x22e90b,null))[_0x2bde('0x4b')](handleError(_0x22e90b,null));};exports[_0x2bde('0x8c')]=function(_0x296e62,_0x52c7a6,_0x570172){var _0x106926,_0x5b63da;var _0x28ed42=[];var _0x31a7da=moment()[_0x2bde('0x63')](_0x2bde('0x64'));return db['Campaign'][_0x2bde('0x43')]({'where':{'id':_0x296e62[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x52c7a6,null))[_0x2bde('0x25')](function(_0x365897){if(_0x365897){_0x5b63da=_0x365897;return _0x365897[_0x2bde('0x8c')](_0x296e62['body'][_0x2bde('0x65')],_[_0x2bde('0x4d')](_0x296e62[_0x2bde('0x50')],[_0x2bde('0x65'),'id'])||{});}return null;})[_0x2bde('0x66')](function(_0x992ce0){var _0x244f3d;var _0x512ff5;_0x106926=_0x992ce0||[];var _0x410944=[];if(_0x992ce0){for(var _0x4f1ab7=0x0;_0x4f1ab7<_0x992ce0[_0x2bde('0x36')];_0x4f1ab7+=0x1){var _0x5f2b59=_0x992ce0[_0x4f1ab7][_0x2bde('0x46')]({'plain':!![]});_0x244f3d=squel[_0x2bde('0x68')]()[_0x2bde('0x69')](_0x2bde('0x8d'))['fromQuery'](['phone',_0x2bde('0x6d'),_0x2bde('0x73'),_0x2bde('0x57'),_0x2bde('0x4e'),_0x2bde('0x4f')],squel[_0x2bde('0x6e')]()[_0x2bde('0x70')](_0x2bde('0x6b'),_0x2bde('0x6b'))[_0x2bde('0x70')]('id','ContactId')[_0x2bde('0x70')](_0x5f2b59['CmListId']['toString'](),_0x2bde('0x73'))[_0x2bde('0x70')](_0x296e62['params']['id'][_0x2bde('0x72')](),_0x2bde('0x57'))['field']('NOW()',_0x2bde('0x4e'))[_0x2bde('0x70')](_0x2bde('0x6f'),_0x2bde('0x4f'))['from'](_0x2bde('0x74'))[_0x2bde('0x3b')](_0x2bde('0x75'))[_0x2bde('0x3b')](_0x2bde('0x7d'),_0x5f2b59[_0x2bde('0x71')]['toString']())[_0x2bde('0x3b')](_0x2bde('0x76')))[_0x2bde('0x72')]();_0x410944[_0x2bde('0x87')](db[_0x2bde('0x88')]['query'](_0x244f3d));}return BPromise[_0x2bde('0x89')](_0x410944);}})[_0x2bde('0x25')](function(){return _0x106926;})['then'](respondWithResult(_0x52c7a6,null))[_0x2bde('0x4b')](handleError(_0x52c7a6,null));};exports[_0x2bde('0x8e')]=function(_0x2ac066,_0x50a377,_0x5cf0cc){return db[_0x2bde('0x40')]['find']({'where':{'id':_0x2ac066[_0x2bde('0x51')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x50a377,null))[_0x2bde('0x25')](function(_0x352e8c){if(_0x352e8c){return _0x352e8c[_0x2bde('0x8e')](_0x2ac066[_0x2bde('0x31')][_0x2bde('0x65')]);}})['then'](function(_0x4c0d2c){if(_0x4c0d2c){return db[_0x2bde('0x5f')][_0x2bde('0x27')]({'where':{'ListId':_0x2ac066[_0x2bde('0x31')][_0x2bde('0x65')],'CampaignId':_0x2ac066['params']['id']}})[_0x2bde('0x25')](function(){return _0x4c0d2c;});}})[_0x2bde('0x25')](respondWithStatusCode(_0x50a377,null))[_0x2bde('0x4b')](handleError(_0x50a377,null));}; \ No newline at end of file +var _0x3c2c=['show','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','clone','params','rawAttributes','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','order','CampaignId','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cmHopperId','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','IvrCampaigns','UserProfileResource','then','error','stack','name','index','Campaign','fieldName','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows'];(function(_0x388653,_0x57c50b){var _0x347f05=function(_0x523b9d){while(--_0x523b9d){_0x388653['push'](_0x388653['shift']());}};_0x347f05(++_0x57c50b);}(_0x3c2c,0x160));var _0xc3c2=function(_0x367a96,_0x4ab6e5){_0x367a96=_0x367a96-0x0;var _0x5ec123=_0x3c2c[_0x367a96];return _0x5ec123;};'use strict';var emlformat=require(_0xc3c2('0x0'));var rimraf=require(_0xc3c2('0x1'));var zipdir=require(_0xc3c2('0x2'));var jsonpatch=require(_0xc3c2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3c2('0x4'));var Mustache=require(_0xc3c2('0x5'));var util=require(_0xc3c2('0x6'));var path=require(_0xc3c2('0x7'));var sox=require('sox');var csv=require(_0xc3c2('0x8'));var ejs=require(_0xc3c2('0x9'));var fs=require('fs');var fs_extra=require(_0xc3c2('0xa'));var _=require(_0xc3c2('0xb'));var squel=require(_0xc3c2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3c2('0x8'));var querystring=require(_0xc3c2('0xd'));var Papa=require('papaparse');var Redis=require(_0xc3c2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc3c2('0xf'));var hardwareService=require(_0xc3c2('0x10'));var logger=require(_0xc3c2('0x11'))('api');var utils=require(_0xc3c2('0x12'));var config=require(_0xc3c2('0x13'));var licenseUtil=require(_0xc3c2('0x14'));var db=require(_0xc3c2('0x15'))['db'];function respondWithStatusCode(_0x578ac4,_0x3920e7){_0x3920e7=_0x3920e7||0xcc;return function(_0x1befad){if(_0x1befad){return _0x578ac4['sendStatus'](_0x3920e7);}return _0x578ac4[_0xc3c2('0x16')](_0x3920e7)['end']();};}function respondWithResult(_0x25b091,_0x4d7d11){_0x4d7d11=_0x4d7d11||0xc8;return function(_0x154071){if(_0x154071){return _0x25b091['status'](_0x4d7d11)[_0xc3c2('0x17')](_0x154071);}};}function respondWithFilteredResult(_0xf5d9a,_0x56bc61){return function(_0x1c2987){if(_0x1c2987){var _0x36f10f=typeof _0x56bc61[_0xc3c2('0x18')]===_0xc3c2('0x19')&&typeof _0x56bc61[_0xc3c2('0x1a')]===_0xc3c2('0x19');var _0x57b7b3=_0x1c2987['count'];var _0x4c0f2d=_0x36f10f?0x0:_0x56bc61[_0xc3c2('0x18')];var _0x3e26e1=_0x36f10f?_0x1c2987[_0xc3c2('0x1b')]:_0x56bc61[_0xc3c2('0x18')]+_0x56bc61[_0xc3c2('0x1a')];var _0x5c9d2c;if(_0x3e26e1>=_0x57b7b3){_0x3e26e1=_0x57b7b3;_0x5c9d2c=0xc8;}else{_0x5c9d2c=0xce;}_0xf5d9a['status'](_0x5c9d2c);return _0xf5d9a[_0xc3c2('0x1c')](_0xc3c2('0x1d'),_0x4c0f2d+'-'+_0x3e26e1+'/'+_0x57b7b3)[_0xc3c2('0x17')](_0x1c2987);}return null;};}function patchUpdates(_0x5e925e){return function(_0x42feba){try{jsonpatch['apply'](_0x42feba,_0x5e925e,!![]);}catch(_0x2e9c78){return BPromise[_0xc3c2('0x1e')](_0x2e9c78);}return _0x42feba[_0xc3c2('0x1f')]();};}function saveUpdates(_0x57458a,_0x2ca609){return function(_0x340c75){if(_0x340c75){return _0x340c75[_0xc3c2('0x20')](_0x57458a)['then'](function(_0x3db978){return _0x3db978;});}return null;};}function removeEntity(_0x3287a3,_0x6ad7af){return function(_0x5d7789){if(_0x5d7789){return _0x5d7789[_0xc3c2('0x21')]()['then'](function(){var _0x323daf=_0x5d7789[_0xc3c2('0x22')]({'plain':!![]});var _0x26aacc=_0xc3c2('0x23');return db[_0xc3c2('0x24')][_0xc3c2('0x21')]({'where':{'type':_0x26aacc,'resourceId':_0x323daf['id']}})[_0xc3c2('0x25')](function(){return _0x5d7789;});})['then'](function(){_0x3287a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b2786,_0x140106){return function(_0x2aca0d){if(!_0x2aca0d){_0x1b2786['sendStatus'](0x194);}return _0x2aca0d;};}function handleError(_0x43548f,_0x1fd93f){_0x1fd93f=_0x1fd93f||0x1f4;return function(_0x2dc9ec){logger[_0xc3c2('0x26')](_0x2dc9ec[_0xc3c2('0x27')]);if(_0x2dc9ec[_0xc3c2('0x28')]){delete _0x2dc9ec[_0xc3c2('0x28')];}_0x43548f[_0xc3c2('0x16')](_0x1fd93f)['send'](_0x2dc9ec);};}exports[_0xc3c2('0x29')]=function(_0x45f56c,_0x165154){var _0x3aebab={},_0x236132={},_0x322852={'count':0x0,'rows':[]};var _0x562b91=_['map'](db[_0xc3c2('0x2a')]['rawAttributes'],function(_0x27c3bd){return{'name':_0x27c3bd[_0xc3c2('0x2b')],'type':_0x27c3bd[_0xc3c2('0x2c')]['key']};});_0x236132['model']=_['map'](_0x562b91,'name');_0x236132[_0xc3c2('0x2d')]=_['keys'](_0x45f56c[_0xc3c2('0x2d')]);_0x236132['filters']=_[_0xc3c2('0x2e')](_0x236132['model'],_0x236132['query']);_0x3aebab[_0xc3c2('0x2f')]=_[_0xc3c2('0x2e')](_0x236132[_0xc3c2('0x30')],qs[_0xc3c2('0x31')](_0x45f56c[_0xc3c2('0x2d')][_0xc3c2('0x31')]));_0x3aebab[_0xc3c2('0x2f')]=_0x3aebab[_0xc3c2('0x2f')][_0xc3c2('0x32')]?_0x3aebab['attributes']:_0x236132['model'];if(!_0x45f56c[_0xc3c2('0x2d')][_0xc3c2('0x33')](_0xc3c2('0x34'))){_0x3aebab[_0xc3c2('0x1a')]=qs[_0xc3c2('0x1a')](_0x45f56c[_0xc3c2('0x2d')]['limit']);_0x3aebab[_0xc3c2('0x18')]=qs['offset'](_0x45f56c[_0xc3c2('0x2d')][_0xc3c2('0x18')]);}_0x3aebab['order']=qs[_0xc3c2('0x35')](_0x45f56c[_0xc3c2('0x2d')]['sort']);_0x3aebab[_0xc3c2('0x36')]=qs[_0xc3c2('0x37')](_[_0xc3c2('0x38')](_0x45f56c[_0xc3c2('0x2d')],_0x236132[_0xc3c2('0x37')]),_0x562b91);if(_0x45f56c[_0xc3c2('0x2d')][_0xc3c2('0x39')]){_0x3aebab[_0xc3c2('0x36')]=_['merge'](_0x3aebab[_0xc3c2('0x36')],{'$or':_[_0xc3c2('0x3a')](_0x562b91,function(_0x279e25){if(_0x279e25[_0xc3c2('0x2c')]!==_0xc3c2('0x3b')){var _0x97039a={};_0x97039a[_0x279e25[_0xc3c2('0x28')]]={'$like':'%'+_0x45f56c[_0xc3c2('0x2d')][_0xc3c2('0x39')]+'%'};return _0x97039a;}})});}_0x3aebab=_[_0xc3c2('0x3c')]({},_0x3aebab,_0x45f56c['options']);var _0x3e6d42={'where':_0x3aebab[_0xc3c2('0x36')]};return db['Campaign'][_0xc3c2('0x1b')](_0x3e6d42)[_0xc3c2('0x25')](function(_0x49f1f1){_0x322852[_0xc3c2('0x1b')]=_0x49f1f1;if(_0x45f56c['query'][_0xc3c2('0x3d')]){_0x3aebab[_0xc3c2('0x3e')]=[{'all':!![]}];}return db[_0xc3c2('0x2a')][_0xc3c2('0x3f')](_0x3aebab);})[_0xc3c2('0x25')](function(_0x2ef1db){_0x322852[_0xc3c2('0x40')]=_0x2ef1db;return _0x322852;})[_0xc3c2('0x25')](respondWithFilteredResult(_0x165154,_0x3aebab))['catch'](handleError(_0x165154,null));};exports[_0xc3c2('0x41')]=function(_0xf39a12,_0x29811c){var _0x464ada={'raw':![],'where':{'id':_0xf39a12['params']['id']}},_0x5e9efc={};_0x5e9efc['model']=_[_0xc3c2('0x42')](db[_0xc3c2('0x2a')]['rawAttributes']);_0x5e9efc[_0xc3c2('0x2d')]=_['keys'](_0xf39a12[_0xc3c2('0x2d')]);_0x5e9efc['filters']=_[_0xc3c2('0x2e')](_0x5e9efc[_0xc3c2('0x30')],_0x5e9efc[_0xc3c2('0x2d')]);_0x464ada[_0xc3c2('0x2f')]=_[_0xc3c2('0x2e')](_0x5e9efc['model'],qs['fields'](_0xf39a12[_0xc3c2('0x2d')][_0xc3c2('0x31')]));_0x464ada[_0xc3c2('0x2f')]=_0x464ada[_0xc3c2('0x2f')][_0xc3c2('0x32')]?_0x464ada[_0xc3c2('0x2f')]:_0x5e9efc[_0xc3c2('0x30')];if(_0xf39a12[_0xc3c2('0x2d')][_0xc3c2('0x3d')]){_0x464ada[_0xc3c2('0x3e')]=[{'all':!![]}];}_0x464ada=_[_0xc3c2('0x3c')]({},_0x464ada,_0xf39a12[_0xc3c2('0x43')]);return db[_0xc3c2('0x2a')][_0xc3c2('0x44')](_0x464ada)['then'](handleEntityNotFound(_0x29811c,null))[_0xc3c2('0x25')](respondWithResult(_0x29811c,null))[_0xc3c2('0x45')](handleError(_0x29811c,null));};exports[_0xc3c2('0x46')]=function(_0x444d41,_0x2321a3){return db[_0xc3c2('0x2a')][_0xc3c2('0x46')](_0x444d41[_0xc3c2('0x47')],{})[_0xc3c2('0x25')](function(_0x373e7e){var _0x103d1f=_0x444d41[_0xc3c2('0x48')]['get']({'plain':!![]});if(!_0x103d1f)throw new Error(_0xc3c2('0x49'));if(_0x103d1f['role']===_0xc3c2('0x48')){var _0x34cae8=_0x373e7e[_0xc3c2('0x22')]({'plain':!![]});var _0x1d0e9f=_0xc3c2('0x23');return db['UserProfileSection'][_0xc3c2('0x44')]({'where':{'name':_0x1d0e9f,'userProfileId':_0x103d1f[_0xc3c2('0x4a')]},'raw':!![]})[_0xc3c2('0x25')](function(_0x179bf6){if(_0x179bf6&&_0x179bf6['autoAssociation']===0x0){return db[_0xc3c2('0x24')]['create']({'name':_0x34cae8[_0xc3c2('0x28')],'resourceId':_0x34cae8['id'],'type':_0x179bf6[_0xc3c2('0x28')],'sectionId':_0x179bf6['id']},{})[_0xc3c2('0x25')](function(){return _0x373e7e;});}else{return _0x373e7e;}})[_0xc3c2('0x45')](function(_0x27235b){logger[_0xc3c2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27235b);throw _0x27235b;});}return _0x373e7e;})[_0xc3c2('0x25')](respondWithResult(_0x2321a3,0xc9))[_0xc3c2('0x45')](handleError(_0x2321a3,null));};exports[_0xc3c2('0x4b')]=function(_0x2aa1e8,_0x1eab23){var _0x3322ae={'where':{'id':_0x2aa1e8[_0xc3c2('0x4c')]['id']}},_0x3b4917={};_0x3b4917[_0xc3c2('0x30')]=_[_0xc3c2('0x42')](db[_0xc3c2('0x2a')][_0xc3c2('0x4d')]);_0x3322ae[_0xc3c2('0x2f')]=_[_0xc3c2('0x2e')](_0x3b4917['model'],qs[_0xc3c2('0x31')](_0x2aa1e8['query'][_0xc3c2('0x31')]));_0x3322ae['attributes']=_0x3322ae[_0xc3c2('0x2f')][_0xc3c2('0x32')]?_0x3322ae[_0xc3c2('0x2f')]:_0x3b4917['model'];if(_0x2aa1e8[_0xc3c2('0x2d')][_0xc3c2('0x3d')]){_0x3322ae[_0xc3c2('0x3e')]=[{'all':!![]}];}_0x3322ae=_[_0xc3c2('0x3c')]({},_0x3322ae,_0x2aa1e8[_0xc3c2('0x43')]);return db[_0xc3c2('0x2a')][_0xc3c2('0x44')](_0x3322ae)['then'](handleEntityNotFound(_0x1eab23,null))[_0xc3c2('0x25')](function(_0x7053dd){if(_0x7053dd){var _0x86ab8e=_0x7053dd[_0xc3c2('0x22')]({'plain':!![]});_0x86ab8e=qs[_0xc3c2('0x4e')](_0x86ab8e,['id',_0xc3c2('0x4f'),_0xc3c2('0x50')]);_0x2aa1e8[_0xc3c2('0x47')]=_[_0xc3c2('0x4e')](_0x2aa1e8['body'],['id',_0xc3c2('0x4f'),_0xc3c2('0x50')]);return db[_0xc3c2('0x2a')][_0xc3c2('0x46')](_[_0xc3c2('0x3c')](_0x86ab8e,_0x2aa1e8[_0xc3c2('0x47')]),{'include':_0x2aa1e8[_0xc3c2('0x2d')][_0xc3c2('0x3d')]?[{'all':!![]}]:undefined})[_0xc3c2('0x25')](function(_0x5c3bf0){var _0x574bd6=_0x2aa1e8[_0xc3c2('0x48')][_0xc3c2('0x22')]({'plain':!![]});if(!_0x574bd6)throw new Error(_0xc3c2('0x49'));if(_0x574bd6['role']===_0xc3c2('0x48')){var _0x3ac527=_0x5c3bf0[_0xc3c2('0x22')]({'plain':!![]});var _0x2e6501=_0xc3c2('0x23');return db[_0xc3c2('0x51')][_0xc3c2('0x44')]({'where':{'name':_0x2e6501,'userProfileId':_0x574bd6[_0xc3c2('0x4a')]},'raw':!![]})[_0xc3c2('0x25')](function(_0x17cb5d){if(_0x17cb5d&&_0x17cb5d[_0xc3c2('0x52')]===0x0){return db[_0xc3c2('0x24')][_0xc3c2('0x46')]({'name':_0x3ac527[_0xc3c2('0x28')],'resourceId':_0x3ac527['id'],'type':_0x17cb5d[_0xc3c2('0x28')],'sectionId':_0x17cb5d['id']},{})[_0xc3c2('0x25')](function(){return _0x5c3bf0;});}else{return _0x5c3bf0;}})['catch'](function(_0x620174){logger[_0xc3c2('0x26')](_0xc3c2('0x53'),_0x620174);throw _0x620174;});}return _0x5c3bf0;});}})[_0xc3c2('0x25')](respondWithResult(_0x1eab23,0xc9))[_0xc3c2('0x45')](handleError(_0x1eab23,null));};exports['update']=function(_0x2e7dee,_0x6a62e2){if(_0x2e7dee[_0xc3c2('0x47')]['id']){delete _0x2e7dee[_0xc3c2('0x47')]['id'];}return db[_0xc3c2('0x2a')][_0xc3c2('0x44')]({'where':{'id':_0x2e7dee['params']['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x6a62e2,null))['then'](saveUpdates(_0x2e7dee[_0xc3c2('0x47')],null))[_0xc3c2('0x25')](respondWithResult(_0x6a62e2,null))[_0xc3c2('0x45')](handleError(_0x6a62e2,null));};exports['destroy']=function(_0x2c682b,_0x21ad73){return db['Campaign'][_0xc3c2('0x44')]({'where':{'id':_0x2c682b[_0xc3c2('0x4c')]['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x21ad73,null))[_0xc3c2('0x25')](removeEntity(_0x21ad73,null))[_0xc3c2('0x45')](handleError(_0x21ad73,null));};exports[_0xc3c2('0x54')]=function(_0xd40b83,_0x518b2d,_0x5adc95){var _0x726a70={'raw':!![],'where':{}};var _0x3757a7={};var _0x36eef2={'count':0x0,'rows':[]};return db[_0xc3c2('0x2a')]['findOne']({'where':{'id':_0xd40b83['params']['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x518b2d,null))[_0xc3c2('0x25')](function(_0x242b90){if(_0x242b90){_0x3757a7[_0xc3c2('0x30')]=_['keys'](db[_0xc3c2('0x55')][_0xc3c2('0x4d')]);_0x3757a7[_0xc3c2('0x2d')]=_[_0xc3c2('0x42')](_0xd40b83[_0xc3c2('0x2d')]);_0x3757a7[_0xc3c2('0x37')]=_[_0xc3c2('0x2e')](_0x3757a7[_0xc3c2('0x30')],_0x3757a7[_0xc3c2('0x2d')]);_0x726a70[_0xc3c2('0x2f')]=_[_0xc3c2('0x2e')](_0x3757a7['model'],qs['fields'](_0xd40b83['query'][_0xc3c2('0x31')]));_0x726a70[_0xc3c2('0x2f')]=_0x726a70[_0xc3c2('0x2f')][_0xc3c2('0x32')]?_0x726a70[_0xc3c2('0x2f')]:_0x3757a7['model'];if(!_0xd40b83[_0xc3c2('0x2d')][_0xc3c2('0x33')](_0xc3c2('0x34'))){_0x726a70[_0xc3c2('0x1a')]=qs[_0xc3c2('0x1a')](_0xd40b83[_0xc3c2('0x2d')][_0xc3c2('0x1a')]);_0x726a70['offset']=qs[_0xc3c2('0x18')](_0xd40b83[_0xc3c2('0x2d')][_0xc3c2('0x18')]);}_0x726a70[_0xc3c2('0x56')]=qs[_0xc3c2('0x35')](_0xd40b83[_0xc3c2('0x2d')]['sort']);_0x726a70[_0xc3c2('0x36')]=qs[_0xc3c2('0x37')](_[_0xc3c2('0x38')](_0xd40b83[_0xc3c2('0x2d')],_0x3757a7['filters']));_0x726a70['where'][_0xc3c2('0x57')]=_0x242b90['id'];if(_0xd40b83['query'][_0xc3c2('0x39')]){_0x726a70[_0xc3c2('0x36')]=_[_0xc3c2('0x3c')](_0x726a70['where'],{'$or':_[_0xc3c2('0x3a')](_0x726a70[_0xc3c2('0x2f')],function(_0x41d067){var _0x1cfef6={};_0x1cfef6[_0x41d067]={'$like':'%'+_0xd40b83[_0xc3c2('0x2d')]['filter']+'%'};return _0x1cfef6;})});}_0x726a70=_[_0xc3c2('0x3c')]({},_0x726a70,_0xd40b83[_0xc3c2('0x43')]);return db[_0xc3c2('0x55')][_0xc3c2('0x1b')]({'where':_0x726a70[_0xc3c2('0x36')]})[_0xc3c2('0x25')](function(_0x2354b1){_0x36eef2[_0xc3c2('0x1b')]=_0x2354b1;if(_0xd40b83[_0xc3c2('0x2d')][_0xc3c2('0x3d')]){_0x726a70[_0xc3c2('0x3e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x726a70);})[_0xc3c2('0x25')](function(_0x30295a){_0x36eef2['rows']=_0x30295a;return _0x36eef2;});}})['then'](respondWithFilteredResult(_0x518b2d,_0x726a70))['catch'](handleError(_0x518b2d,null));};exports['getHopperHistories']=function(_0xb7a647,_0x2923d3,_0x1578f4){var _0x414316={'raw':!![],'where':{}};var _0x5d9a18={};var _0x3bb66b={'count':0x0,'rows':[]};return db[_0xc3c2('0x2a')][_0xc3c2('0x58')]({'where':{'id':_0xb7a647[_0xc3c2('0x4c')]['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x2923d3,null))[_0xc3c2('0x25')](function(_0x5a7445){if(_0x5a7445){_0x5d9a18[_0xc3c2('0x30')]=_['keys'](db[_0xc3c2('0x59')]['rawAttributes']);_0x5d9a18[_0xc3c2('0x2d')]=_[_0xc3c2('0x42')](_0xb7a647[_0xc3c2('0x2d')]);_0x5d9a18['filters']=_[_0xc3c2('0x2e')](_0x5d9a18[_0xc3c2('0x30')],_0x5d9a18['query']);_0x414316[_0xc3c2('0x2f')]=_[_0xc3c2('0x2e')](_0x5d9a18[_0xc3c2('0x30')],qs[_0xc3c2('0x31')](_0xb7a647[_0xc3c2('0x2d')][_0xc3c2('0x31')]));_0x414316[_0xc3c2('0x2f')]=_0x414316[_0xc3c2('0x2f')][_0xc3c2('0x32')]?_0x414316['attributes']:_0x5d9a18[_0xc3c2('0x30')];if(!_0xb7a647['query']['hasOwnProperty'](_0xc3c2('0x34'))){_0x414316[_0xc3c2('0x1a')]=qs['limit'](_0xb7a647[_0xc3c2('0x2d')][_0xc3c2('0x1a')]);_0x414316[_0xc3c2('0x18')]=qs[_0xc3c2('0x18')](_0xb7a647[_0xc3c2('0x2d')]['offset']);}_0x414316[_0xc3c2('0x56')]=qs[_0xc3c2('0x35')](_0xb7a647[_0xc3c2('0x2d')]['sort']);_0x414316['where']=qs[_0xc3c2('0x37')](_[_0xc3c2('0x38')](_0xb7a647[_0xc3c2('0x2d')],_0x5d9a18['filters']));_0x414316[_0xc3c2('0x36')][_0xc3c2('0x57')]=_0x5a7445['id'];if(_0xb7a647['query'][_0xc3c2('0x39')]){_0x414316[_0xc3c2('0x36')]=_[_0xc3c2('0x3c')](_0x414316[_0xc3c2('0x36')],{'$or':_['map'](_0x414316[_0xc3c2('0x2f')],function(_0x2af851){var _0x2b9a83={};_0x2b9a83[_0x2af851]={'$like':'%'+_0xb7a647[_0xc3c2('0x2d')][_0xc3c2('0x39')]+'%'};return _0x2b9a83;})});}_0x414316=_[_0xc3c2('0x3c')]({},_0x414316,_0xb7a647[_0xc3c2('0x43')]);return db[_0xc3c2('0x59')][_0xc3c2('0x1b')]({'where':_0x414316[_0xc3c2('0x36')]})['then'](function(_0x22ff10){_0x3bb66b[_0xc3c2('0x1b')]=_0x22ff10;if(_0xb7a647[_0xc3c2('0x2d')][_0xc3c2('0x3d')]){_0x414316[_0xc3c2('0x3e')]=[{'all':!![]}];}return db[_0xc3c2('0x59')][_0xc3c2('0x3f')](_0x414316);})[_0xc3c2('0x25')](function(_0x4b3b35){_0x3bb66b[_0xc3c2('0x40')]=_0x4b3b35;return _0x3bb66b;});}})['then'](respondWithFilteredResult(_0x2923d3,_0x414316))['catch'](handleError(_0x2923d3,null));};exports['getHopperFinals']=function(_0x562e94,_0x585e4e,_0x35599c){var _0x1a1f3e={'raw':!![],'where':{}};var _0x5f0ac3={};var _0x293d95={'count':0x0,'rows':[]};return db[_0xc3c2('0x2a')][_0xc3c2('0x58')]({'where':{'id':_0x562e94['params']['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x585e4e,null))[_0xc3c2('0x25')](function(_0x47df2a){if(_0x47df2a){_0x5f0ac3[_0xc3c2('0x30')]=_[_0xc3c2('0x42')](db[_0xc3c2('0x5a')][_0xc3c2('0x4d')]);_0x5f0ac3[_0xc3c2('0x2d')]=_[_0xc3c2('0x42')](_0x562e94['query']);_0x5f0ac3['filters']=_[_0xc3c2('0x2e')](_0x5f0ac3['model'],_0x5f0ac3['query']);_0x1a1f3e[_0xc3c2('0x2f')]=_[_0xc3c2('0x2e')](_0x5f0ac3['model'],qs['fields'](_0x562e94[_0xc3c2('0x2d')][_0xc3c2('0x31')]));_0x1a1f3e[_0xc3c2('0x2f')]=_0x1a1f3e[_0xc3c2('0x2f')][_0xc3c2('0x32')]?_0x1a1f3e[_0xc3c2('0x2f')]:_0x5f0ac3[_0xc3c2('0x30')];if(!_0x562e94[_0xc3c2('0x2d')][_0xc3c2('0x33')](_0xc3c2('0x34'))){_0x1a1f3e[_0xc3c2('0x1a')]=qs[_0xc3c2('0x1a')](_0x562e94[_0xc3c2('0x2d')][_0xc3c2('0x1a')]);_0x1a1f3e['offset']=qs[_0xc3c2('0x18')](_0x562e94[_0xc3c2('0x2d')][_0xc3c2('0x18')]);}_0x1a1f3e[_0xc3c2('0x56')]=qs[_0xc3c2('0x35')](_0x562e94[_0xc3c2('0x2d')]['sort']);_0x1a1f3e[_0xc3c2('0x36')]=qs[_0xc3c2('0x37')](_[_0xc3c2('0x38')](_0x562e94['query'],_0x5f0ac3['filters']));_0x1a1f3e['where'][_0xc3c2('0x57')]=_0x47df2a['id'];if(_0x562e94[_0xc3c2('0x2d')][_0xc3c2('0x39')]){_0x1a1f3e[_0xc3c2('0x36')]=_[_0xc3c2('0x3c')](_0x1a1f3e['where'],{'$or':_[_0xc3c2('0x3a')](_0x1a1f3e[_0xc3c2('0x2f')],function(_0x4ebb55){var _0x272786={};_0x272786[_0x4ebb55]={'$like':'%'+_0x562e94['query'][_0xc3c2('0x39')]+'%'};return _0x272786;})});}_0x1a1f3e=_[_0xc3c2('0x3c')]({},_0x1a1f3e,_0x562e94[_0xc3c2('0x43')]);return db[_0xc3c2('0x5a')][_0xc3c2('0x1b')]({'where':_0x1a1f3e['where']})[_0xc3c2('0x25')](function(_0x4817c6){_0x293d95['count']=_0x4817c6;if(_0x562e94['query']['includeAll']){_0x1a1f3e[_0xc3c2('0x3e')]=[{'all':!![]}];}return db[_0xc3c2('0x5a')][_0xc3c2('0x3f')](_0x1a1f3e);})[_0xc3c2('0x25')](function(_0x5c860d){_0x293d95[_0xc3c2('0x40')]=_0x5c860d;return _0x293d95;});}})['then'](respondWithFilteredResult(_0x585e4e,_0x1a1f3e))[_0xc3c2('0x45')](handleError(_0x585e4e,null));};exports[_0xc3c2('0x5b')]=function(_0x2da00d,_0x437b1f,_0x14d7eb){var _0xfe3d8a={'raw':!![],'where':{}};var _0x2f1e32={};var _0x20a93d={'count':0x0,'rows':[]};return db[_0xc3c2('0x2a')][_0xc3c2('0x58')]({'where':{'id':_0x2da00d['params']['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x437b1f,null))[_0xc3c2('0x25')](function(_0x285062){if(_0x285062){_0x2f1e32[_0xc3c2('0x30')]=_[_0xc3c2('0x42')](db[_0xc3c2('0x5c')][_0xc3c2('0x4d')]);_0x2f1e32['query']=_[_0xc3c2('0x42')](_0x2da00d['query']);_0x2f1e32[_0xc3c2('0x37')]=_['intersection'](_0x2f1e32[_0xc3c2('0x30')],_0x2f1e32[_0xc3c2('0x2d')]);_0xfe3d8a[_0xc3c2('0x2f')]=_['intersection'](_0x2f1e32['model'],qs[_0xc3c2('0x31')](_0x2da00d[_0xc3c2('0x2d')]['fields']));_0xfe3d8a[_0xc3c2('0x2f')]=_0xfe3d8a['attributes'][_0xc3c2('0x32')]?_0xfe3d8a[_0xc3c2('0x2f')]:_0x2f1e32[_0xc3c2('0x30')];if(!_0x2da00d['query'][_0xc3c2('0x33')](_0xc3c2('0x34'))){_0xfe3d8a[_0xc3c2('0x1a')]=qs[_0xc3c2('0x1a')](_0x2da00d[_0xc3c2('0x2d')][_0xc3c2('0x1a')]);_0xfe3d8a[_0xc3c2('0x18')]=qs[_0xc3c2('0x18')](_0x2da00d[_0xc3c2('0x2d')][_0xc3c2('0x18')]);}_0xfe3d8a['order']=qs[_0xc3c2('0x35')](_0x2da00d[_0xc3c2('0x2d')][_0xc3c2('0x35')]);_0xfe3d8a[_0xc3c2('0x36')]=qs[_0xc3c2('0x37')](_[_0xc3c2('0x38')](_0x2da00d[_0xc3c2('0x2d')],_0x2f1e32[_0xc3c2('0x37')]));_0xfe3d8a[_0xc3c2('0x36')]['CampaignId']=_0x285062['id'];if(_0x2da00d['query'][_0xc3c2('0x39')]){_0xfe3d8a[_0xc3c2('0x36')]=_[_0xc3c2('0x3c')](_0xfe3d8a[_0xc3c2('0x36')],{'$or':_[_0xc3c2('0x3a')](_0xfe3d8a[_0xc3c2('0x2f')],function(_0x1d5c76){var _0x5e5b6d={};_0x5e5b6d[_0x1d5c76]={'$like':'%'+_0x2da00d[_0xc3c2('0x2d')]['filter']+'%'};return _0x5e5b6d;})});}_0xfe3d8a=_['merge']({},_0xfe3d8a,_0x2da00d[_0xc3c2('0x43')]);return db[_0xc3c2('0x5c')][_0xc3c2('0x1b')]({'where':_0xfe3d8a[_0xc3c2('0x36')]})[_0xc3c2('0x25')](function(_0x989caa){_0x20a93d[_0xc3c2('0x1b')]=_0x989caa;if(_0x2da00d[_0xc3c2('0x2d')]['includeAll']){_0xfe3d8a[_0xc3c2('0x3e')]=[{'all':!![]}];}return db[_0xc3c2('0x5c')][_0xc3c2('0x3f')](_0xfe3d8a);})[_0xc3c2('0x25')](function(_0xfd6db2){_0x20a93d['rows']=_0xfd6db2;return _0x20a93d;});}})[_0xc3c2('0x25')](respondWithFilteredResult(_0x437b1f,_0xfe3d8a))['catch'](handleError(_0x437b1f,null));};exports[_0xc3c2('0x5d')]=function(_0x17266a,_0x392306,_0x5e5690){var _0x3a758b={};var _0x50a83a={};var _0x42ec22;var _0x2eb265;return db[_0xc3c2('0x2a')][_0xc3c2('0x58')]({'where':{'id':_0x17266a[_0xc3c2('0x4c')]['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x392306,null))[_0xc3c2('0x25')](function(_0x4ecb63){if(_0x4ecb63){_0x42ec22=_0x4ecb63;_0x50a83a['model']=_[_0xc3c2('0x42')](db[_0xc3c2('0x5e')][_0xc3c2('0x4d')]);_0x50a83a[_0xc3c2('0x2d')]=_[_0xc3c2('0x42')](_0x17266a[_0xc3c2('0x2d')]);_0x50a83a[_0xc3c2('0x37')]=_[_0xc3c2('0x2e')](_0x50a83a[_0xc3c2('0x30')],_0x50a83a[_0xc3c2('0x2d')]);_0x3a758b['attributes']=_[_0xc3c2('0x2e')](_0x50a83a['model'],qs[_0xc3c2('0x31')](_0x17266a[_0xc3c2('0x2d')][_0xc3c2('0x31')]));_0x3a758b[_0xc3c2('0x2f')]=_0x3a758b['attributes'][_0xc3c2('0x32')]?_0x3a758b['attributes']:_0x50a83a[_0xc3c2('0x30')];_0x3a758b[_0xc3c2('0x56')]=qs[_0xc3c2('0x35')](_0x17266a[_0xc3c2('0x2d')][_0xc3c2('0x35')]);_0x3a758b[_0xc3c2('0x36')]=qs[_0xc3c2('0x37')](_[_0xc3c2('0x38')](_0x17266a['query'],_0x50a83a[_0xc3c2('0x37')]));if(_0x17266a[_0xc3c2('0x2d')][_0xc3c2('0x39')]){_0x3a758b[_0xc3c2('0x36')]=_[_0xc3c2('0x3c')](_0x3a758b['where'],{'$or':_[_0xc3c2('0x3a')](_0x3a758b[_0xc3c2('0x2f')],function(_0x44a5ba){var _0x29527a={};_0x29527a[_0x44a5ba]={'$like':'%'+_0x17266a[_0xc3c2('0x2d')][_0xc3c2('0x39')]+'%'};return _0x29527a;})});}_0x3a758b=_[_0xc3c2('0x3c')]({},_0x3a758b,_0x17266a[_0xc3c2('0x43')]);return _0x42ec22[_0xc3c2('0x5d')](_0x3a758b);}})[_0xc3c2('0x25')](function(_0x4efe4e){if(_0x4efe4e){_0x2eb265=_0x4efe4e[_0xc3c2('0x32')];if(!_0x17266a[_0xc3c2('0x2d')][_0xc3c2('0x33')](_0xc3c2('0x34'))){_0x3a758b[_0xc3c2('0x1a')]=qs['limit'](_0x17266a[_0xc3c2('0x2d')][_0xc3c2('0x1a')]);_0x3a758b['offset']=qs[_0xc3c2('0x18')](_0x17266a[_0xc3c2('0x2d')][_0xc3c2('0x18')]);}return _0x42ec22[_0xc3c2('0x5d')](_0x3a758b);}})[_0xc3c2('0x25')](function(_0x2d133c){if(_0x2d133c){return _0x2d133c?{'count':_0x2eb265,'rows':_0x2d133c}:null;}})['then'](respondWithResult(_0x392306,null))[_0xc3c2('0x45')](handleError(_0x392306,null));};exports[_0xc3c2('0x5f')]=function(_0x277324,_0x501b00,_0x2f2486){var _0x38508,_0x1d729b;var _0x13e363=[];var _0x25f9be=moment()['format'](_0xc3c2('0x60'));return db[_0xc3c2('0x2a')]['find']({'where':{'id':_0x277324['params']['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x501b00,null))[_0xc3c2('0x25')](function(_0x302be4){if(_0x302be4){_0x1d729b=_0x302be4;return _0x302be4[_0xc3c2('0x5f')](_0x277324[_0xc3c2('0x47')][_0xc3c2('0x61')],_[_0xc3c2('0x4e')](_0x277324[_0xc3c2('0x47')],[_0xc3c2('0x61'),'id'])||{});}return null;})['spread'](function(_0x2a6c1f){var _0x3ee015;var _0x1630d6;_0x38508=_0x2a6c1f||[];var _0x50c925=[];if(_0x2a6c1f){for(var _0x32f37f=0x0;_0x32f37f<_0x2a6c1f[_0xc3c2('0x32')];_0x32f37f+=0x1){var _0x285c85=_0x2a6c1f[_0x32f37f][_0xc3c2('0x22')]({'plain':!![]});_0x1d729b[_0xc3c2('0x62')]=_0x277324[_0xc3c2('0x47')][_0xc3c2('0x62')]?_0x277324[_0xc3c2('0x47')][_0xc3c2('0x62')]:_0x1d729b[_0xc3c2('0x62')];switch(_0x1d729b[_0xc3c2('0x62')]){case _0xc3c2('0x63'):_0x3ee015=squel[_0xc3c2('0x64')]()[_0xc3c2('0x65')](_0xc3c2('0x66'))[_0xc3c2('0x67')]([_0xc3c2('0x68'),_0xc3c2('0x69'),'ContactId',_0xc3c2('0x6a'),_0xc3c2('0x57'),'createdAt',_0xc3c2('0x50')],squel['select']()[_0xc3c2('0x6b')](_0xc3c2('0x68'),_0xc3c2('0x68'))['field'](_0xc3c2('0x6c'),_0xc3c2('0x69'))[_0xc3c2('0x6b')]('id',_0xc3c2('0x6d'))[_0xc3c2('0x6b')](_0x285c85[_0xc3c2('0x6e')]['toString'](),'ListId')[_0xc3c2('0x6b')](_0x277324[_0xc3c2('0x4c')]['id'][_0xc3c2('0x6f')](),_0xc3c2('0x57'))[_0xc3c2('0x6b')]('\x27'+_0x25f9be+'\x27',_0xc3c2('0x4f'))[_0xc3c2('0x6b')]('\x27'+_0x25f9be+'\x27',_0xc3c2('0x50'))[_0xc3c2('0x70')](_0xc3c2('0x71'))[_0xc3c2('0x36')](_0xc3c2('0x72'))[_0xc3c2('0x36')](_0xc3c2('0x73'),_0x285c85[_0xc3c2('0x6e')][_0xc3c2('0x6f')]())[_0xc3c2('0x36')](_0xc3c2('0x74'))[_0xc3c2('0x36')](_0xc3c2('0x75'),squel[_0xc3c2('0x76')]()[_0xc3c2('0x6b')](_0xc3c2('0x77'))[_0xc3c2('0x70')]('cm_hopper_final')['where'](_0xc3c2('0x78'),_0x277324[_0xc3c2('0x4c')]['id'][_0xc3c2('0x6f')]()))['where'](_0xc3c2('0x75'),squel[_0xc3c2('0x76')]()[_0xc3c2('0x6b')](_0xc3c2('0x79'))['from']('cm_hopper')[_0xc3c2('0x36')](_0xc3c2('0x78'),_0x277324[_0xc3c2('0x4c')]['id'][_0xc3c2('0x6f')]())))[_0xc3c2('0x6f')]();break;case'onlyIfOpen':_0x3ee015=squel[_0xc3c2('0x64')]()[_0xc3c2('0x65')]('cm_hopper')[_0xc3c2('0x67')]([_0xc3c2('0x68'),_0xc3c2('0x69'),'ContactId','ListId',_0xc3c2('0x57'),_0xc3c2('0x4f'),_0xc3c2('0x50')],squel[_0xc3c2('0x76')]()['field'](_0xc3c2('0x68'),_0xc3c2('0x68'))[_0xc3c2('0x6b')](_0xc3c2('0x6c'),_0xc3c2('0x69'))[_0xc3c2('0x6b')]('id',_0xc3c2('0x6d'))[_0xc3c2('0x6b')](_0x285c85['CmListId'][_0xc3c2('0x6f')](),_0xc3c2('0x6a'))[_0xc3c2('0x6b')](_0x277324['params']['id'][_0xc3c2('0x6f')](),'CampaignId')[_0xc3c2('0x6b')]('\x27'+_0x25f9be+'\x27','createdAt')[_0xc3c2('0x6b')]('\x27'+_0x25f9be+'\x27','updatedAt')[_0xc3c2('0x70')](_0xc3c2('0x71'))[_0xc3c2('0x36')](_0xc3c2('0x72'))[_0xc3c2('0x36')](_0xc3c2('0x73'),_0x285c85[_0xc3c2('0x6e')]['toString']())[_0xc3c2('0x36')]('phone\x20IS\x20NOT\x20NULL')[_0xc3c2('0x36')](_0xc3c2('0x75'),squel['select']()[_0xc3c2('0x6b')](_0xc3c2('0x79'))[_0xc3c2('0x70')](_0xc3c2('0x66'))[_0xc3c2('0x36')](_0xc3c2('0x78'),_0x277324[_0xc3c2('0x4c')]['id'][_0xc3c2('0x6f')]())))['toString']();break;default:_0x3ee015=squel['insert']()[_0xc3c2('0x65')](_0xc3c2('0x66'))[_0xc3c2('0x67')]([_0xc3c2('0x68'),_0xc3c2('0x69'),_0xc3c2('0x6d'),_0xc3c2('0x6a'),_0xc3c2('0x57'),_0xc3c2('0x4f'),_0xc3c2('0x50')],squel['select']()[_0xc3c2('0x6b')](_0xc3c2('0x68'),_0xc3c2('0x68'))[_0xc3c2('0x6b')]('NOW()','scheduledAt')[_0xc3c2('0x6b')]('id',_0xc3c2('0x6d'))[_0xc3c2('0x6b')](_0x285c85['CmListId'][_0xc3c2('0x6f')](),_0xc3c2('0x6a'))['field'](_0x277324[_0xc3c2('0x4c')]['id'][_0xc3c2('0x6f')](),_0xc3c2('0x57'))['field']('\x27'+_0x25f9be+'\x27',_0xc3c2('0x4f'))[_0xc3c2('0x6b')]('\x27'+_0x25f9be+'\x27',_0xc3c2('0x50'))[_0xc3c2('0x70')]('cm_contacts')[_0xc3c2('0x36')](_0xc3c2('0x72'))[_0xc3c2('0x36')](_0xc3c2('0x73'),_0x285c85[_0xc3c2('0x6e')][_0xc3c2('0x6f')]())[_0xc3c2('0x36')](_0xc3c2('0x74')))['toString']();}_0x1630d6=squel[_0xc3c2('0x64')]()[_0xc3c2('0x65')]('cm_hopper_additional_phones')['fromQuery']([_0xc3c2('0x7a'),_0xc3c2('0x69'),'phone','OrderBy',_0xc3c2('0x4f'),_0xc3c2('0x50')],squel[_0xc3c2('0x76')]()[_0xc3c2('0x6b')](_0xc3c2('0x7b'),'id')[_0xc3c2('0x6b')]('NOW()',_0xc3c2('0x69'))[_0xc3c2('0x6b')](_0xc3c2('0x7c'),_0xc3c2('0x68'))[_0xc3c2('0x6b')](_0xc3c2('0x7d'),'OrderBy')[_0xc3c2('0x6b')]('\x27'+_0x25f9be+'\x27',_0xc3c2('0x4f'))['field']('\x27'+_0x25f9be+'\x27',_0xc3c2('0x50'))[_0xc3c2('0x70')](_0xc3c2('0x7e'),'ci')['join'](_0xc3c2('0x66'),'h',_0xc3c2('0x7f'))[_0xc3c2('0x36')]('h.ListId\x20=\x20?',_0x285c85['CmListId'][_0xc3c2('0x6f')]())[_0xc3c2('0x36')](_0xc3c2('0x80'),_0x277324['params']['id'][_0xc3c2('0x6f')]())[_0xc3c2('0x36')](_0xc3c2('0x81'),_0x25f9be))[_0xc3c2('0x6f')]();_0x50c925[_0xc3c2('0x82')](db['sequelize'][_0xc3c2('0x2d')](_0x3ee015));_0x13e363[_0xc3c2('0x82')](db[_0xc3c2('0x83')][_0xc3c2('0x2d')](_0x1630d6));}return BPromise[_0xc3c2('0x84')](_0x50c925);}})['then'](function(){return BPromise['all'](_0x13e363);})['then'](function(){return _0x38508;})[_0xc3c2('0x25')](respondWithResult(_0x501b00,null))[_0xc3c2('0x45')](handleError(_0x501b00,null));};exports['removeLists']=function(_0x3aca93,_0x4ce05e,_0x9d07af){return db[_0xc3c2('0x2a')]['find']({'where':{'id':_0x3aca93[_0xc3c2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ce05e,null))[_0xc3c2('0x25')](function(_0x592d2b){if(_0x592d2b){return _0x592d2b[_0xc3c2('0x85')](_0x3aca93[_0xc3c2('0x2d')][_0xc3c2('0x61')]);}})[_0xc3c2('0x25')](function(_0x277714){if(_0x277714){return db[_0xc3c2('0x55')][_0xc3c2('0x21')]({'where':{'ListId':_0x3aca93['query']['ids'],'CampaignId':_0x3aca93['params']['id']}})[_0xc3c2('0x25')](function(){return _0x277714;});}})[_0xc3c2('0x25')](respondWithStatusCode(_0x4ce05e,null))[_0xc3c2('0x45')](handleError(_0x4ce05e,null));};exports[_0xc3c2('0x86')]=function(_0x36d216,_0x2ba4c1,_0x1cc0e0){var _0xfe4659={};var _0x16836f={};var _0x282c83;var _0xec0903;return db[_0xc3c2('0x2a')][_0xc3c2('0x58')]({'where':{'id':_0x36d216[_0xc3c2('0x4c')]['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x2ba4c1,null))[_0xc3c2('0x25')](function(_0x2efb8d){if(_0x2efb8d){_0x282c83=_0x2efb8d;_0x16836f[_0xc3c2('0x30')]=_[_0xc3c2('0x42')](db['CmList'][_0xc3c2('0x4d')]);_0x16836f['query']=_[_0xc3c2('0x42')](_0x36d216[_0xc3c2('0x2d')]);_0x16836f[_0xc3c2('0x37')]=_['intersection'](_0x16836f[_0xc3c2('0x30')],_0x16836f[_0xc3c2('0x2d')]);_0xfe4659['attributes']=_[_0xc3c2('0x2e')](_0x16836f[_0xc3c2('0x30')],qs[_0xc3c2('0x31')](_0x36d216[_0xc3c2('0x2d')][_0xc3c2('0x31')]));_0xfe4659[_0xc3c2('0x2f')]=_0xfe4659['attributes'][_0xc3c2('0x32')]?_0xfe4659['attributes']:_0x16836f[_0xc3c2('0x30')];_0xfe4659[_0xc3c2('0x56')]=qs['sort'](_0x36d216[_0xc3c2('0x2d')]['sort']);_0xfe4659[_0xc3c2('0x36')]=qs[_0xc3c2('0x37')](_['pick'](_0x36d216[_0xc3c2('0x2d')],_0x16836f['filters']));if(_0x36d216[_0xc3c2('0x2d')][_0xc3c2('0x39')]){_0xfe4659['where']=_[_0xc3c2('0x3c')](_0xfe4659[_0xc3c2('0x36')],{'$or':_[_0xc3c2('0x3a')](_0xfe4659[_0xc3c2('0x2f')],function(_0x4263bd){var _0x4befa9={};_0x4befa9[_0x4263bd]={'$like':'%'+_0x36d216['query'][_0xc3c2('0x39')]+'%'};return _0x4befa9;})});}_0xfe4659=_['merge']({},_0xfe4659,_0x36d216['options']);return _0x282c83[_0xc3c2('0x86')](_0xfe4659);}})[_0xc3c2('0x25')](function(_0x101950){if(_0x101950){_0xec0903=_0x101950['length'];if(!_0x36d216['query'][_0xc3c2('0x33')]('nolimit')){_0xfe4659[_0xc3c2('0x1a')]=qs[_0xc3c2('0x1a')](_0x36d216[_0xc3c2('0x2d')][_0xc3c2('0x1a')]);_0xfe4659['offset']=qs[_0xc3c2('0x18')](_0x36d216[_0xc3c2('0x2d')]['offset']);}return _0x282c83[_0xc3c2('0x86')](_0xfe4659);}})[_0xc3c2('0x25')](function(_0x3d023e){if(_0x3d023e){return _0x3d023e?{'count':_0xec0903,'rows':_0x3d023e}:null;}})['then'](respondWithResult(_0x2ba4c1,null))['catch'](handleError(_0x2ba4c1,null));};exports[_0xc3c2('0x87')]=function(_0x10b4d2,_0x1c58cc,_0x39c3db){var _0x288ef4,_0x1c7d72;var _0xa9fbaf=[];var _0x5ac5b7=moment()['format'](_0xc3c2('0x60'));return db['Campaign']['find']({'where':{'id':_0x10b4d2[_0xc3c2('0x4c')]['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x1c58cc,null))[_0xc3c2('0x25')](function(_0x2916be){if(_0x2916be){_0x1c7d72=_0x2916be;return _0x2916be['addBlackLists'](_0x10b4d2[_0xc3c2('0x47')]['ids'],_[_0xc3c2('0x4e')](_0x10b4d2[_0xc3c2('0x47')],['ids','id'])||{});}return null;})[_0xc3c2('0x88')](function(_0x2842b9){var _0xb4599e;var _0x122f63;_0x288ef4=_0x2842b9||[];var _0x284c51=[];if(_0x2842b9){for(var _0x2c36ee=0x0;_0x2c36ee<_0x2842b9[_0xc3c2('0x32')];_0x2c36ee+=0x1){var _0x12c252=_0x2842b9[_0x2c36ee][_0xc3c2('0x22')]({'plain':!![]});_0xb4599e=squel[_0xc3c2('0x64')]()[_0xc3c2('0x65')](_0xc3c2('0x89'))[_0xc3c2('0x67')]([_0xc3c2('0x68'),_0xc3c2('0x6d'),_0xc3c2('0x6a'),_0xc3c2('0x57'),_0xc3c2('0x4f'),_0xc3c2('0x50')],squel[_0xc3c2('0x76')]()[_0xc3c2('0x6b')](_0xc3c2('0x68'),_0xc3c2('0x68'))[_0xc3c2('0x6b')]('id',_0xc3c2('0x6d'))[_0xc3c2('0x6b')](_0x12c252['CmListId'][_0xc3c2('0x6f')](),_0xc3c2('0x6a'))[_0xc3c2('0x6b')](_0x10b4d2[_0xc3c2('0x4c')]['id'][_0xc3c2('0x6f')](),_0xc3c2('0x57'))[_0xc3c2('0x6b')](_0xc3c2('0x6c'),_0xc3c2('0x4f'))[_0xc3c2('0x6b')](_0xc3c2('0x6c'),'updatedAt')[_0xc3c2('0x70')](_0xc3c2('0x71'))['where'](_0xc3c2('0x72'))[_0xc3c2('0x36')](_0xc3c2('0x73'),_0x12c252['CmListId'][_0xc3c2('0x6f')]())[_0xc3c2('0x36')](_0xc3c2('0x74')))['toString']();_0x284c51[_0xc3c2('0x82')](db[_0xc3c2('0x83')][_0xc3c2('0x2d')](_0xb4599e));}return BPromise[_0xc3c2('0x84')](_0x284c51);}})['then'](function(){return _0x288ef4;})[_0xc3c2('0x25')](respondWithResult(_0x1c58cc,null))['catch'](handleError(_0x1c58cc,null));};exports['removeBlackLists']=function(_0xecc24b,_0x5a15a7,_0x4953a2){return db[_0xc3c2('0x2a')][_0xc3c2('0x44')]({'where':{'id':_0xecc24b['params']['id']}})[_0xc3c2('0x25')](handleEntityNotFound(_0x5a15a7,null))[_0xc3c2('0x25')](function(_0x1d4e24){if(_0x1d4e24){return _0x1d4e24[_0xc3c2('0x8a')](_0xecc24b[_0xc3c2('0x2d')][_0xc3c2('0x61')]);}})[_0xc3c2('0x25')](function(_0x2dea89){if(_0x2dea89){return db[_0xc3c2('0x5c')][_0xc3c2('0x21')]({'where':{'ListId':_0xecc24b['query'][_0xc3c2('0x61')],'CampaignId':_0xecc24b[_0xc3c2('0x4c')]['id']}})[_0xc3c2('0x25')](function(){return _0x2dea89;});}})[_0xc3c2('0x25')](respondWithStatusCode(_0x5a15a7,null))[_0xc3c2('0x45')](handleError(_0x5a15a7,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1713365..514f79d 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xfa9f42,_0x3b9207){var _0x4f51db=function(_0x4a1a1e){while(--_0x4a1a1e){_0xfa9f42['push'](_0xfa9f42['shift']());}};_0x4f51db(++_0x3b9207);}(_0x7a54,0x106));var _0x47a5=function(_0x39589a,_0x4364a7){_0x39589a=_0x39589a-0x0;var _0x20b419=_0x7a54[_0x39589a];return _0x20b419;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8cf523d..32fb510 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 _0xc718=['error','code','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x859b4a,_0x4d1b1f){var _0x5636e6=function(_0x349aec){while(--_0x349aec){_0x859b4a['push'](_0x859b4a['shift']());}};_0x5636e6(++_0x4d1b1f);}(_0xc718,0xb6));var _0x8c71=function(_0x1e9300,_0x1cd496){_0x1e9300=_0x1e9300-0x0;var _0x39573d=_0xc718[_0x1e9300];return _0x39573d;};'use strict';var _=require(_0x8c71('0x0'));var util=require('util');var moment=require(_0x8c71('0x1'));var BPromise=require(_0x8c71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c71('0x3'));var db=require(_0x8c71('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c71('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8c71('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4cfd67,_0xf122c7,_0x10c4a){return new BPromise(function(_0x29f3b7,_0x143ca0){return client[_0x8c71('0x7')](_0x4cfd67,_0x10c4a)['then'](function(_0xaeb417){logger[_0x8c71('0x8')](_0x8c71('0x9'),_0xf122c7,_0x8c71('0xa'));logger[_0x8c71('0xb')](_0x8c71('0xc'),_0xf122c7,_0x8c71('0xa'),JSON[_0x8c71('0xd')](_0xaeb417));if(_0xaeb417[_0x8c71('0xe')]){if(_0xaeb417['error'][_0x8c71('0xf')]===0x1f4){logger[_0x8c71('0xe')](_0x8c71('0x9'),_0xf122c7,_0xaeb417[_0x8c71('0xe')][_0x8c71('0x10')]);return _0x143ca0(_0xaeb417[_0x8c71('0xe')][_0x8c71('0x10')]);}logger[_0x8c71('0xe')](_0x8c71('0x9'),_0xf122c7,_0xaeb417[_0x8c71('0xe')][_0x8c71('0x10')]);return _0x29f3b7(_0xaeb417[_0x8c71('0xe')][_0x8c71('0x10')]);}else{logger[_0x8c71('0x8')](_0x8c71('0x9'),_0xf122c7,_0x8c71('0xa'));_0x29f3b7(_0xaeb417[_0x8c71('0x11')][_0x8c71('0x10')]);}})['catch'](function(_0x2588b3){logger[_0x8c71('0xe')]('Campaign,\x20%s,\x20%s',_0xf122c7,_0x2588b3);_0x143ca0(_0x2588b3);});});}exports['GetCampaign']=function(_0x20f93a){var _0x18986c=this;return new Promise(function(_0x4bdfa7,_0x175af7){return db['Campaign'][_0x8c71('0x12')]({'raw':_0x20f93a['options']?_0x20f93a[_0x8c71('0x13')][_0x8c71('0x14')]===undefined?!![]:![]:!![],'where':_0x20f93a['options']?_0x20f93a[_0x8c71('0x13')][_0x8c71('0x15')]||null:null,'attributes':_0x20f93a[_0x8c71('0x13')]?_0x20f93a[_0x8c71('0x13')][_0x8c71('0x16')]||null:null,'limit':_0x20f93a[_0x8c71('0x13')]?_0x20f93a['options'][_0x8c71('0x17')]||null:null,'include':_0x20f93a['options']?_0x20f93a['options'][_0x8c71('0x18')]?_[_0x8c71('0x19')](_0x20f93a['options'][_0x8c71('0x18')],function(_0xc22d7b){return{'model':db[_0xc22d7b['model']],'as':_0xc22d7b['as'],'attributes':_0xc22d7b['attributes'],'include':_0xc22d7b[_0x8c71('0x18')]?_[_0x8c71('0x19')](_0xc22d7b[_0x8c71('0x18')],function(_0x911372){return{'model':db[_0x911372[_0x8c71('0x1a')]],'as':_0x911372['as'],'attributes':_0x911372[_0x8c71('0x16')],'include':_0x911372['include']?_[_0x8c71('0x19')](_0x911372['include'],function(_0x4c12af){return{'model':db[_0x4c12af['model']],'as':_0x4c12af['as'],'attributes':_0x4c12af[_0x8c71('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2415f0){logger[_0x8c71('0x8')](_0x8c71('0x1b'),_0x20f93a);logger['debug'](_0x8c71('0x1b'),_0x20f93a,JSON[_0x8c71('0xd')](_0x2415f0));_0x4bdfa7(_0x2415f0);})['catch'](function(_0xa6e14d){logger['error'](_0x8c71('0x1b'),_0xa6e14d[_0x8c71('0x10')],_0x20f93a);_0x175af7(_0x18986c[_0x8c71('0xe')](0x1f4,_0xa6e14d[_0x8c71('0x10')]));});});}; \ No newline at end of file +var _0xd136=['catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','Campaign,\x20%s,\x20%s','message','info','result'];(function(_0x4d95db,_0x28b7e9){var _0x1cc484=function(_0x42c09c){while(--_0x42c09c){_0x4d95db['push'](_0x4d95db['shift']());}};_0x1cc484(++_0x28b7e9);}(_0xd136,0x94));var _0x6d13=function(_0x476b00,_0xcdd1e1){_0x476b00=_0x476b00-0x0;var _0x3d4fb1=_0xd136[_0x476b00];return _0x3d4fb1;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335482,_0xdf6760,_0x4c563a){return new BPromise(function(_0x598021,_0x1af16f){return client[_0x6d13('0xb')](_0x335482,_0x4c563a)[_0x6d13('0xc')](function(_0x2216d7){logger['info']('Campaign,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));logger[_0x6d13('0xe')](_0x6d13('0xf'),_0xdf6760,'request\x20sent',JSON['stringify'](_0x2216d7));if(_0x2216d7[_0x6d13('0x10')]){if(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x11')]===0x1f4){logger['error'](_0x6d13('0x12'),_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x1af16f(_0x2216d7[_0x6d13('0x10')]['message']);}logger['error']('Campaign,\x20%s,\x20%s',_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x598021(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);}else{logger[_0x6d13('0x14')]('Campaign,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));_0x598021(_0x2216d7[_0x6d13('0x15')][_0x6d13('0x13')]);}})[_0x6d13('0x16')](function(_0x348cab){logger[_0x6d13('0x10')](_0x6d13('0x12'),_0xdf6760,_0x348cab);_0x1af16f(_0x348cab);});});}exports[_0x6d13('0x17')]=function(_0xc6c2b){var _0x5bcac4=this;return new Promise(function(_0x276fdd,_0x269f27){return db[_0x6d13('0x18')][_0x6d13('0x19')]({'raw':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1b')]===undefined?!![]:![]:!![],'where':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1c')]||null:null,'attributes':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1d')]||null:null,'limit':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1e')]||null:null,'include':_0xc6c2b['options']?_0xc6c2b[_0x6d13('0x1a')]['include']?_[_0x6d13('0x1f')](_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x20')],function(_0x5bbc9d){return{'model':db[_0x5bbc9d[_0x6d13('0x21')]],'as':_0x5bbc9d['as'],'attributes':_0x5bbc9d[_0x6d13('0x1d')],'include':_0x5bbc9d[_0x6d13('0x20')]?_[_0x6d13('0x1f')](_0x5bbc9d[_0x6d13('0x20')],function(_0x361432){return{'model':db[_0x361432[_0x6d13('0x21')]],'as':_0x361432['as'],'attributes':_0x361432[_0x6d13('0x1d')],'include':_0x361432['include']?_[_0x6d13('0x1f')](_0x361432['include'],function(_0x4c8526){return{'model':db[_0x4c8526[_0x6d13('0x21')]],'as':_0x4c8526['as'],'attributes':_0x4c8526['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d13('0xc')](function(_0x2618e5){logger[_0x6d13('0x14')]('GetCampaign',_0xc6c2b);logger[_0x6d13('0xe')](_0x6d13('0x17'),_0xc6c2b,JSON['stringify'](_0x2618e5));_0x276fdd(_0x2618e5);})[_0x6d13('0x16')](function(_0x1eda96){logger[_0x6d13('0x10')](_0x6d13('0x17'),_0x1eda96[_0x6d13('0x13')],_0xc6c2b);_0x269f27(_0x5bcac4[_0x6d13('0x10')](0x1f4,_0x1eda96[_0x6d13('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 58973b5..a97d891 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 _0x0434=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','multer','util','path'];(function(_0x28fab8,_0x5e9d0a){var _0x2a326c=function(_0x158121){while(--_0x158121){_0x28fab8['push'](_0x28fab8['shift']());}};_0x2a326c(++_0x5e9d0a);}(_0x0434,0x1ad));var _0x4043=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x0434[_0x5b7788];return _0x573871;};'use strict';var multer=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var path=require(_0x4043('0x2'));var timeout=require(_0x4043('0x3'));var express=require(_0x4043('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4043('0x5'));var interaction=require(_0x4043('0x6'));var config=require(_0x4043('0x7'));var controller=require(_0x4043('0x8'));router[_0x4043('0x9')]('/',auth[_0x4043('0xa')](),controller['index']);router[_0x4043('0x9')](_0x4043('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4043('0x9')](_0x4043('0xc'),auth[_0x4043('0xa')](),controller[_0x4043('0xd')]);router[_0x4043('0x9')](_0x4043('0xe'),auth[_0x4043('0xa')](),controller[_0x4043('0xf')]);router['get'](_0x4043('0x10'),auth[_0x4043('0xa')](),controller[_0x4043('0x11')]);router[_0x4043('0x9')](_0x4043('0x12'),auth['isAuthenticated'](),controller[_0x4043('0x13')]);router[_0x4043('0x9')](_0x4043('0x14'),auth[_0x4043('0xa')](),controller[_0x4043('0x15')]);router['get'](_0x4043('0x16'),auth[_0x4043('0xa')](),controller[_0x4043('0x17')]);router[_0x4043('0x18')]('/',auth[_0x4043('0xa')](),controller[_0x4043('0x19')]);router[_0x4043('0x18')](_0x4043('0x1a'),auth[_0x4043('0xa')](),controller[_0x4043('0x1b')]);router[_0x4043('0x18')](_0x4043('0x14'),auth['isAuthenticated'](),controller[_0x4043('0x1c')]);router[_0x4043('0x18')](_0x4043('0x16'),auth['isAuthenticated'](),controller[_0x4043('0x1d')]);router[_0x4043('0x1e')](_0x4043('0xb'),auth[_0x4043('0xa')](),controller[_0x4043('0x1f')]);router['delete'](_0x4043('0xb'),auth['isAuthenticated'](),controller[_0x4043('0x20')]);router[_0x4043('0x21')](_0x4043('0x14'),auth[_0x4043('0xa')](),controller[_0x4043('0x22')]);router[_0x4043('0x21')]('/:id/blacklists',auth[_0x4043('0xa')](),controller[_0x4043('0x23')]);module['exports']=router; \ No newline at end of file +var _0x2463=['removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addBlackLists','put','update','delete'];(function(_0x36a63c,_0x3d5e94){var _0x35e7a1=function(_0x24dd9a){while(--_0x24dd9a){_0x36a63c['push'](_0x36a63c['shift']());}};_0x35e7a1(++_0x3d5e94);}(_0x2463,0xf7));var _0x3246=function(_0x2a7b44,_0x3786f2){_0x2a7b44=_0x2a7b44-0x0;var _0x1af209=_0x2463[_0x2a7b44];return _0x1af209;};'use strict';var multer=require(_0x3246('0x0'));var util=require(_0x3246('0x1'));var path=require(_0x3246('0x2'));var timeout=require(_0x3246('0x3'));var express=require(_0x3246('0x4'));var router=express[_0x3246('0x5')]();var fs_extra=require(_0x3246('0x6'));var auth=require(_0x3246('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3246('0x8'));var controller=require('./campaign.controller');router['get']('/',auth[_0x3246('0x9')](),controller[_0x3246('0xa')]);router[_0x3246('0xb')](_0x3246('0xc'),auth['isAuthenticated'](),controller[_0x3246('0xd')]);router[_0x3246('0xb')](_0x3246('0xe'),auth[_0x3246('0x9')](),controller[_0x3246('0xf')]);router['get'](_0x3246('0x10'),auth[_0x3246('0x9')](),controller[_0x3246('0x11')]);router[_0x3246('0xb')](_0x3246('0x12'),auth[_0x3246('0x9')](),controller[_0x3246('0x13')]);router['get'](_0x3246('0x14'),auth['isAuthenticated'](),controller[_0x3246('0x15')]);router[_0x3246('0xb')]('/:id/lists',auth[_0x3246('0x9')](),controller['getLists']);router[_0x3246('0xb')](_0x3246('0x16'),auth[_0x3246('0x9')](),controller[_0x3246('0x17')]);router[_0x3246('0x18')]('/',auth['isAuthenticated'](),controller[_0x3246('0x19')]);router[_0x3246('0x18')](_0x3246('0x1a'),auth[_0x3246('0x9')](),controller[_0x3246('0x1b')]);router[_0x3246('0x18')](_0x3246('0x1c'),auth[_0x3246('0x9')](),controller['addLists']);router['post'](_0x3246('0x16'),auth['isAuthenticated'](),controller[_0x3246('0x1d')]);router[_0x3246('0x1e')](_0x3246('0xc'),auth[_0x3246('0x9')](),controller[_0x3246('0x1f')]);router[_0x3246('0x20')]('/:id',auth[_0x3246('0x9')](),controller['destroy']);router[_0x3246('0x20')](_0x3246('0x1c'),auth['isAuthenticated'](),controller[_0x3246('0x21')]);router[_0x3246('0x20')]('/:id/blacklists',auth[_0x3246('0x9')](),controller[_0x3246('0x22')]);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 c9d4e49..6d96d9c 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 _0xd104=['getDataValue','key','sequelize','exports','VIRTUAL'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0xd104,0x1ab));var _0x4d10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd104[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4d10('0x0'));module[_0x4d10('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x4d10('0x2')],'get':function(){return this[_0x4d10('0x3')](_0x4d10('0x4'));}}}; \ No newline at end of file +var _0xf0d9=['exports','TEXT','STRING','VIRTUAL','getDataValue','sequelize'];(function(_0x44122d,_0x33ed22){var _0xa43d5e=function(_0x35c1a6){while(--_0x35c1a6){_0x44122d['push'](_0x44122d['shift']());}};_0xa43d5e(++_0x33ed22);}(_0xf0d9,0x11f));var _0x9f0d=function(_0x19c136,_0x382348){_0x19c136=_0x19c136-0x0;var _0x58bdb6=_0xf0d9[_0x19c136];return _0x58bdb6;};'use strict';var Sequelize=require(_0x9f0d('0x0'));module[_0x9f0d('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9f0d('0x2')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x9f0d('0x3')]},'name':{'type':Sequelize[_0x9f0d('0x4')],'get':function(){return this[_0x9f0d('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 788489e..a8c70fc 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 _0x8993=['then','CannedAnswers','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save'];(function(_0x3d0ac0,_0x21da0c){var _0x533c12=function(_0x3d8e19){while(--_0x3d8e19){_0x3d0ac0['push'](_0x3d0ac0['shift']());}};_0x533c12(++_0x21da0c);}(_0x8993,0x8e));var _0x3899=function(_0xa05b2c,_0x3f6f84){_0xa05b2c=_0xa05b2c-0x0;var _0x329fa4=_0x8993[_0xa05b2c];return _0x329fa4;};'use strict';var emlformat=require(_0x3899('0x0'));var rimraf=require(_0x3899('0x1'));var zipdir=require(_0x3899('0x2'));var jsonpatch=require(_0x3899('0x3'));var rp=require(_0x3899('0x4'));var moment=require(_0x3899('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3899('0x6'));var util=require(_0x3899('0x7'));var path=require(_0x3899('0x8'));var sox=require(_0x3899('0x9'));var csv=require(_0x3899('0xa'));var ejs=require(_0x3899('0xb'));var fs=require('fs');var fs_extra=require(_0x3899('0xc'));var _=require(_0x3899('0xd'));var squel=require(_0x3899('0xe'));var crypto=require(_0x3899('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3899('0x10'));var toCsv=require(_0x3899('0xa'));var querystring=require(_0x3899('0x11'));var Papa=require('papaparse');var Redis=require(_0x3899('0x12'));var authService=require(_0x3899('0x13'));var qs=require(_0x3899('0x14'));var as=require(_0x3899('0x15'));var hardwareService=require(_0x3899('0x16'));var logger=require(_0x3899('0x17'))(_0x3899('0x18'));var utils=require(_0x3899('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3899('0x1a'));var db=require(_0x3899('0x1b'))['db'];function respondWithStatusCode(_0x2dcfb1,_0x4acb84){_0x4acb84=_0x4acb84||0xcc;return function(_0x120c2f){if(_0x120c2f){return _0x2dcfb1[_0x3899('0x1c')](_0x4acb84);}return _0x2dcfb1[_0x3899('0x1d')](_0x4acb84)[_0x3899('0x1e')]();};}function respondWithResult(_0x254545,_0x54d1a8){_0x54d1a8=_0x54d1a8||0xc8;return function(_0x49c3de){if(_0x49c3de){return _0x254545[_0x3899('0x1d')](_0x54d1a8)[_0x3899('0x1f')](_0x49c3de);}};}function respondWithFilteredResult(_0x3f7ba6,_0x24f02b){return function(_0x258390){if(_0x258390){var _0x4cb298=typeof _0x24f02b[_0x3899('0x20')]==='undefined'&&typeof _0x24f02b[_0x3899('0x21')]===_0x3899('0x22');var _0x330667=_0x258390[_0x3899('0x23')];var _0x325672=_0x4cb298?0x0:_0x24f02b[_0x3899('0x20')];var _0x4efbca=_0x4cb298?_0x258390[_0x3899('0x23')]:_0x24f02b[_0x3899('0x20')]+_0x24f02b[_0x3899('0x21')];var _0x539935;if(_0x4efbca>=_0x330667){_0x4efbca=_0x330667;_0x539935=0xc8;}else{_0x539935=0xce;}_0x3f7ba6[_0x3899('0x1d')](_0x539935);return _0x3f7ba6[_0x3899('0x24')](_0x3899('0x25'),_0x325672+'-'+_0x4efbca+'/'+_0x330667)[_0x3899('0x1f')](_0x258390);}return null;};}function patchUpdates(_0x408e93){return function(_0x492986){try{jsonpatch['apply'](_0x492986,_0x408e93,!![]);}catch(_0x439ba2){return BPromise[_0x3899('0x26')](_0x439ba2);}return _0x492986[_0x3899('0x27')]();};}function saveUpdates(_0xe4b01,_0x54e5c3){return function(_0x546f32){if(_0x546f32){return _0x546f32['update'](_0xe4b01)[_0x3899('0x28')](function(_0xb753b0){return _0xb753b0;});}return null;};}function removeEntity(_0x39c579,_0x287fc5){return function(_0x1541b5){if(_0x1541b5){return _0x1541b5['destroy']()[_0x3899('0x28')](function(){var _0x3dd773=_0x1541b5['get']({'plain':!![]});var _0x251fa0=_0x3899('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x251fa0,'resourceId':_0x3dd773['id']}})[_0x3899('0x28')](function(){return _0x1541b5;});})[_0x3899('0x28')](function(){_0x39c579[_0x3899('0x1d')](0xcc)[_0x3899('0x1e')]();});}};}function handleEntityNotFound(_0x348e17,_0x3afcae){return function(_0x326fa4){if(!_0x326fa4){_0x348e17[_0x3899('0x1c')](0x194);}return _0x326fa4;};}function handleError(_0xc1e87e,_0x1b4219){_0x1b4219=_0x1b4219||0x1f4;return function(_0x5642e7){logger[_0x3899('0x2a')](_0x5642e7[_0x3899('0x2b')]);if(_0x5642e7[_0x3899('0x2c')]){delete _0x5642e7[_0x3899('0x2c')];}_0xc1e87e[_0x3899('0x1d')](_0x1b4219)[_0x3899('0x2d')](_0x5642e7);};}exports['index']=function(_0x245184,_0x3cfc77){var _0x59bf41={},_0x28f8b0={},_0xc483b4={'count':0x0,'rows':[]};var _0x3cba6f=_[_0x3899('0x2e')](db[_0x3899('0x2f')][_0x3899('0x30')],function(_0x2bd2ee){return{'name':_0x2bd2ee[_0x3899('0x31')],'type':_0x2bd2ee[_0x3899('0x32')][_0x3899('0x33')]};});_0x28f8b0[_0x3899('0x34')]=_['map'](_0x3cba6f,_0x3899('0x2c'));_0x28f8b0['query']=_[_0x3899('0x35')](_0x245184['query']);_0x28f8b0[_0x3899('0x36')]=_[_0x3899('0x37')](_0x28f8b0[_0x3899('0x34')],_0x28f8b0[_0x3899('0x38')]);_0x59bf41[_0x3899('0x39')]=_[_0x3899('0x37')](_0x28f8b0[_0x3899('0x34')],qs['fields'](_0x245184[_0x3899('0x38')][_0x3899('0x3a')]));_0x59bf41[_0x3899('0x39')]=_0x59bf41[_0x3899('0x39')][_0x3899('0x3b')]?_0x59bf41[_0x3899('0x39')]:_0x28f8b0[_0x3899('0x34')];if(!_0x245184[_0x3899('0x38')]['hasOwnProperty'](_0x3899('0x3c'))){_0x59bf41[_0x3899('0x21')]=qs['limit'](_0x245184[_0x3899('0x38')][_0x3899('0x21')]);_0x59bf41[_0x3899('0x20')]=qs[_0x3899('0x20')](_0x245184['query'][_0x3899('0x20')]);}_0x59bf41[_0x3899('0x3d')]=qs['sort'](_0x245184[_0x3899('0x38')]['sort']);_0x59bf41['where']=qs['filters'](_['pick'](_0x245184['query'],_0x28f8b0['filters']),_0x3cba6f);if(_0x245184['query'][_0x3899('0x3e')]){_0x59bf41[_0x3899('0x3f')]=_[_0x3899('0x40')](_0x59bf41[_0x3899('0x3f')],{'$or':[{'key':{'$like':'%'+_0x245184[_0x3899('0x38')][_0x3899('0x3e')]+'%'}},{'value':{'$like':'%'+_0x245184[_0x3899('0x38')]['filter']+'%'}}]});}_0x59bf41=_['merge']({},_0x59bf41,_0x245184[_0x3899('0x41')]);var _0x2f2ecc={'where':_0x59bf41[_0x3899('0x3f')]};return db[_0x3899('0x2f')][_0x3899('0x23')](_0x2f2ecc)[_0x3899('0x28')](function(_0x5eeb6c){_0xc483b4['count']=_0x5eeb6c;if(_0x245184[_0x3899('0x38')][_0x3899('0x42')]){_0x59bf41[_0x3899('0x43')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3899('0x44')](_0x59bf41);})[_0x3899('0x28')](function(_0x293ea7){_0xc483b4[_0x3899('0x45')]=_0x293ea7;return _0xc483b4;})['then'](respondWithFilteredResult(_0x3cfc77,_0x59bf41))[_0x3899('0x46')](handleError(_0x3cfc77,null));};exports[_0x3899('0x47')]=function(_0x4cd374,_0x4c073b){var _0x1e9141={'raw':!![],'where':{'id':_0x4cd374[_0x3899('0x48')]['id']}},_0xbed15b={};_0xbed15b[_0x3899('0x34')]=_[_0x3899('0x35')](db[_0x3899('0x2f')][_0x3899('0x30')]);_0xbed15b['query']=_['keys'](_0x4cd374[_0x3899('0x38')]);_0xbed15b[_0x3899('0x36')]=_[_0x3899('0x37')](_0xbed15b[_0x3899('0x34')],_0xbed15b['query']);_0x1e9141[_0x3899('0x39')]=_[_0x3899('0x37')](_0xbed15b[_0x3899('0x34')],qs[_0x3899('0x3a')](_0x4cd374[_0x3899('0x38')]['fields']));_0x1e9141['attributes']=_0x1e9141[_0x3899('0x39')][_0x3899('0x3b')]?_0x1e9141[_0x3899('0x39')]:_0xbed15b[_0x3899('0x34')];if(_0x4cd374['query'][_0x3899('0x42')]){_0x1e9141[_0x3899('0x43')]=[{'all':!![]}];}_0x1e9141=_[_0x3899('0x40')]({},_0x1e9141,_0x4cd374[_0x3899('0x41')]);return db['CannedAnswer'][_0x3899('0x49')](_0x1e9141)[_0x3899('0x28')](handleEntityNotFound(_0x4c073b,null))[_0x3899('0x28')](respondWithResult(_0x4c073b,null))[_0x3899('0x46')](handleError(_0x4c073b,null));};exports[_0x3899('0x4a')]=function(_0x152f2a,_0x2f6360){if(_0x152f2a[_0x3899('0x4b')]['id']){delete _0x152f2a['body']['id'];}return db['CannedAnswer'][_0x3899('0x49')]({'where':{'id':_0x152f2a[_0x3899('0x48')]['id']}})[_0x3899('0x28')](handleEntityNotFound(_0x2f6360,null))[_0x3899('0x28')](saveUpdates(_0x152f2a[_0x3899('0x4b')],null))[_0x3899('0x28')](respondWithResult(_0x2f6360,null))['catch'](handleError(_0x2f6360,null));};exports['destroy']=function(_0x517a2f,_0x1f850d){return db[_0x3899('0x2f')][_0x3899('0x49')]({'where':{'id':_0x517a2f['params']['id']}})[_0x3899('0x28')](handleEntityNotFound(_0x1f850d,null))[_0x3899('0x28')](removeEntity(_0x1f850d,null))[_0x3899('0x46')](handleError(_0x1f850d,null));};exports[_0x3899('0x4c')]=function(_0x2ab959,_0x1aace6){var _0x58d8a7={'key':_0x2ab959[_0x3899('0x4b')][_0x3899('0x33')]};if(_0x2ab959[_0x3899('0x4b')][_0x3899('0x4d')]){_0x58d8a7[_0x3899('0x4d')]=_0x2ab959[_0x3899('0x4b')][_0x3899('0x4d')];}else if(_0x2ab959[_0x3899('0x4b')][_0x3899('0x4e')]){_0x58d8a7[_0x3899('0x4e')]=_0x2ab959['body']['SmsAccountId'];}else if(_0x2ab959[_0x3899('0x4b')][_0x3899('0x4f')]){_0x58d8a7['OpenchannelAccountId']=_0x2ab959[_0x3899('0x4b')][_0x3899('0x4f')];}else if(_0x2ab959[_0x3899('0x4b')][_0x3899('0x50')]){_0x58d8a7[_0x3899('0x50')]=_0x2ab959[_0x3899('0x4b')]['ChatWebsiteId'];}return db[_0x3899('0x2f')][_0x3899('0x49')]({'where':_0x58d8a7})['then'](function(_0x1c14e2){if(_0x1c14e2){throw new db[(_0x3899('0x51'))]['ValidationError'](_0x3899('0x52'));}return db['CannedAnswer'][_0x3899('0x4c')](_0x2ab959[_0x3899('0x4b')]);})[_0x3899('0x28')](function(_0x22e2e6){var _0x5b65af=_0x2ab959[_0x3899('0x53')][_0x3899('0x54')]({'plain':!![]});if(!_0x5b65af)throw new Error(_0x3899('0x55'));if(_0x5b65af[_0x3899('0x56')]===_0x3899('0x53')){var _0x408a33=_0x22e2e6[_0x3899('0x54')]({'plain':!![]});return db[_0x3899('0x57')][_0x3899('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x5b65af['userProfileId']},'raw':!![]})[_0x3899('0x28')](function(_0x265cce){if(_0x265cce&&_0x265cce[_0x3899('0x58')]===0x0){return db[_0x3899('0x59')][_0x3899('0x4c')]({'name':_0x408a33[_0x3899('0x2c')],'resourceId':_0x408a33['id'],'type':_0x265cce['name'],'sectionId':_0x265cce['id']},{})['then'](function(){return _0x22e2e6;});}else{return _0x22e2e6;}})[_0x3899('0x46')](function(_0x23e117){logger['error'](_0x3899('0x5a'),_0x23e117);throw _0x23e117;});}return _0x22e2e6;})[_0x3899('0x28')](respondWithResult(_0x1aace6,0xc9))['catch'](handleError(_0x1aace6,null));}; \ No newline at end of file +var _0x18b1=['UserProfileResource','then','error','stack','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','where','merge','filter','options','includeAll','include','findAll','catch','show','length','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','CannedAnswers'];(function(_0x3b58c9,_0x1b86e6){var _0x2eac7a=function(_0x4b1212){while(--_0x4b1212){_0x3b58c9['push'](_0x3b58c9['shift']());}};_0x2eac7a(++_0x1b86e6);}(_0x18b1,0xe1));var _0x118b=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x18b1[_0x135904];return _0x1ce7d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x118b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x118b('0x1'));var rp=require(_0x118b('0x2'));var moment=require('moment');var BPromise=require(_0x118b('0x3'));var Mustache=require(_0x118b('0x4'));var util=require(_0x118b('0x5'));var path=require(_0x118b('0x6'));var sox=require(_0x118b('0x7'));var csv=require(_0x118b('0x8'));var ejs=require(_0x118b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x118b('0xa'));var squel=require(_0x118b('0xb'));var crypto=require(_0x118b('0xc'));var jsforce=require(_0x118b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x118b('0x8'));var querystring=require('querystring');var Papa=require(_0x118b('0xe'));var Redis=require(_0x118b('0xf'));var authService=require(_0x118b('0x10'));var qs=require(_0x118b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x118b('0x12'));var logger=require(_0x118b('0x13'))(_0x118b('0x14'));var utils=require('../../config/utils');var config=require(_0x118b('0x15'));var licenseUtil=require(_0x118b('0x16'));var db=require(_0x118b('0x17'))['db'];function respondWithStatusCode(_0x23e06d,_0x34db35){_0x34db35=_0x34db35||0xcc;return function(_0x4c3afb){if(_0x4c3afb){return _0x23e06d[_0x118b('0x18')](_0x34db35);}return _0x23e06d['status'](_0x34db35)[_0x118b('0x19')]();};}function respondWithResult(_0x5e07e9,_0x42431a){_0x42431a=_0x42431a||0xc8;return function(_0xf54f81){if(_0xf54f81){return _0x5e07e9[_0x118b('0x1a')](_0x42431a)[_0x118b('0x1b')](_0xf54f81);}};}function respondWithFilteredResult(_0x241f2a,_0x3eb1de){return function(_0x3de26b){if(_0x3de26b){var _0x183070=typeof _0x3eb1de[_0x118b('0x1c')]==='undefined'&&typeof _0x3eb1de[_0x118b('0x1d')]===_0x118b('0x1e');var _0x31552e=_0x3de26b[_0x118b('0x1f')];var _0x426ff1=_0x183070?0x0:_0x3eb1de['offset'];var _0x53c920=_0x183070?_0x3de26b[_0x118b('0x1f')]:_0x3eb1de[_0x118b('0x1c')]+_0x3eb1de[_0x118b('0x1d')];var _0x489b28;if(_0x53c920>=_0x31552e){_0x53c920=_0x31552e;_0x489b28=0xc8;}else{_0x489b28=0xce;}_0x241f2a[_0x118b('0x1a')](_0x489b28);return _0x241f2a[_0x118b('0x20')](_0x118b('0x21'),_0x426ff1+'-'+_0x53c920+'/'+_0x31552e)[_0x118b('0x1b')](_0x3de26b);}return null;};}function patchUpdates(_0x1c6027){return function(_0x5bb31a){try{jsonpatch['apply'](_0x5bb31a,_0x1c6027,!![]);}catch(_0x5e0815){return BPromise[_0x118b('0x22')](_0x5e0815);}return _0x5bb31a['save']();};}function saveUpdates(_0x4f9f79,_0x132f39){return function(_0x32128a){if(_0x32128a){return _0x32128a[_0x118b('0x23')](_0x4f9f79)['then'](function(_0x2a2ac1){return _0x2a2ac1;});}return null;};}function removeEntity(_0x489db0,_0xc13140){return function(_0x41a3ff){if(_0x41a3ff){return _0x41a3ff[_0x118b('0x24')]()['then'](function(){var _0x2dc0da=_0x41a3ff[_0x118b('0x25')]({'plain':!![]});var _0x1ab8c4=_0x118b('0x26');return db[_0x118b('0x27')][_0x118b('0x24')]({'where':{'type':_0x1ab8c4,'resourceId':_0x2dc0da['id']}})[_0x118b('0x28')](function(){return _0x41a3ff;});})[_0x118b('0x28')](function(){_0x489db0[_0x118b('0x1a')](0xcc)[_0x118b('0x19')]();});}};}function handleEntityNotFound(_0x5bb2fa,_0x525c58){return function(_0x56ff49){if(!_0x56ff49){_0x5bb2fa[_0x118b('0x18')](0x194);}return _0x56ff49;};}function handleError(_0x1eba46,_0x4f05c2){_0x4f05c2=_0x4f05c2||0x1f4;return function(_0x2829fc){logger[_0x118b('0x29')](_0x2829fc[_0x118b('0x2a')]);if(_0x2829fc[_0x118b('0x2b')]){delete _0x2829fc[_0x118b('0x2b')];}_0x1eba46[_0x118b('0x1a')](_0x4f05c2)[_0x118b('0x2c')](_0x2829fc);};}exports[_0x118b('0x2d')]=function(_0x519bf7,_0x25ab33){var _0x3f0b70={},_0x2f9bc3={},_0x45a7c4={'count':0x0,'rows':[]};var _0x6cdf22=_[_0x118b('0x2e')](db[_0x118b('0x2f')]['rawAttributes'],function(_0x36d733){return{'name':_0x36d733[_0x118b('0x30')],'type':_0x36d733[_0x118b('0x31')][_0x118b('0x32')]};});_0x2f9bc3[_0x118b('0x33')]=_[_0x118b('0x2e')](_0x6cdf22,_0x118b('0x2b'));_0x2f9bc3[_0x118b('0x34')]=_[_0x118b('0x35')](_0x519bf7[_0x118b('0x34')]);_0x2f9bc3['filters']=_[_0x118b('0x36')](_0x2f9bc3[_0x118b('0x33')],_0x2f9bc3['query']);_0x3f0b70['attributes']=_[_0x118b('0x36')](_0x2f9bc3['model'],qs[_0x118b('0x37')](_0x519bf7[_0x118b('0x34')]['fields']));_0x3f0b70[_0x118b('0x38')]=_0x3f0b70[_0x118b('0x38')]['length']?_0x3f0b70[_0x118b('0x38')]:_0x2f9bc3[_0x118b('0x33')];if(!_0x519bf7[_0x118b('0x34')][_0x118b('0x39')](_0x118b('0x3a'))){_0x3f0b70[_0x118b('0x1d')]=qs[_0x118b('0x1d')](_0x519bf7[_0x118b('0x34')][_0x118b('0x1d')]);_0x3f0b70[_0x118b('0x1c')]=qs[_0x118b('0x1c')](_0x519bf7[_0x118b('0x34')][_0x118b('0x1c')]);}_0x3f0b70[_0x118b('0x3b')]=qs[_0x118b('0x3c')](_0x519bf7[_0x118b('0x34')][_0x118b('0x3c')]);_0x3f0b70['where']=qs[_0x118b('0x3d')](_['pick'](_0x519bf7[_0x118b('0x34')],_0x2f9bc3['filters']),_0x6cdf22);if(_0x519bf7[_0x118b('0x34')]['filter']){_0x3f0b70[_0x118b('0x3e')]=_[_0x118b('0x3f')](_0x3f0b70[_0x118b('0x3e')],{'$or':[{'key':{'$like':'%'+_0x519bf7[_0x118b('0x34')][_0x118b('0x40')]+'%'}},{'value':{'$like':'%'+_0x519bf7[_0x118b('0x34')][_0x118b('0x40')]+'%'}}]});}_0x3f0b70=_[_0x118b('0x3f')]({},_0x3f0b70,_0x519bf7[_0x118b('0x41')]);var _0x4ea7c0={'where':_0x3f0b70[_0x118b('0x3e')]};return db['CannedAnswer'][_0x118b('0x1f')](_0x4ea7c0)[_0x118b('0x28')](function(_0x5b21b6){_0x45a7c4[_0x118b('0x1f')]=_0x5b21b6;if(_0x519bf7[_0x118b('0x34')][_0x118b('0x42')]){_0x3f0b70[_0x118b('0x43')]=[{'all':!![]}];}return db[_0x118b('0x2f')][_0x118b('0x44')](_0x3f0b70);})[_0x118b('0x28')](function(_0x48be9f){_0x45a7c4['rows']=_0x48be9f;return _0x45a7c4;})[_0x118b('0x28')](respondWithFilteredResult(_0x25ab33,_0x3f0b70))[_0x118b('0x45')](handleError(_0x25ab33,null));};exports[_0x118b('0x46')]=function(_0xcdd457,_0x40ce5d){var _0x5504cf={'raw':!![],'where':{'id':_0xcdd457['params']['id']}},_0x27161f={};_0x27161f['model']=_['keys'](db[_0x118b('0x2f')]['rawAttributes']);_0x27161f[_0x118b('0x34')]=_[_0x118b('0x35')](_0xcdd457[_0x118b('0x34')]);_0x27161f['filters']=_[_0x118b('0x36')](_0x27161f[_0x118b('0x33')],_0x27161f[_0x118b('0x34')]);_0x5504cf['attributes']=_['intersection'](_0x27161f['model'],qs['fields'](_0xcdd457[_0x118b('0x34')][_0x118b('0x37')]));_0x5504cf[_0x118b('0x38')]=_0x5504cf[_0x118b('0x38')][_0x118b('0x47')]?_0x5504cf['attributes']:_0x27161f[_0x118b('0x33')];if(_0xcdd457['query'][_0x118b('0x42')]){_0x5504cf[_0x118b('0x43')]=[{'all':!![]}];}_0x5504cf=_[_0x118b('0x3f')]({},_0x5504cf,_0xcdd457['options']);return db[_0x118b('0x2f')][_0x118b('0x48')](_0x5504cf)[_0x118b('0x28')](handleEntityNotFound(_0x40ce5d,null))[_0x118b('0x28')](respondWithResult(_0x40ce5d,null))[_0x118b('0x45')](handleError(_0x40ce5d,null));};exports[_0x118b('0x23')]=function(_0x220580,_0x177103){if(_0x220580[_0x118b('0x49')]['id']){delete _0x220580[_0x118b('0x49')]['id'];}return db['CannedAnswer'][_0x118b('0x48')]({'where':{'id':_0x220580[_0x118b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x177103,null))['then'](saveUpdates(_0x220580[_0x118b('0x49')],null))[_0x118b('0x28')](respondWithResult(_0x177103,null))[_0x118b('0x45')](handleError(_0x177103,null));};exports[_0x118b('0x24')]=function(_0x25fd80,_0x1b864c){return db['CannedAnswer'][_0x118b('0x48')]({'where':{'id':_0x25fd80[_0x118b('0x4a')]['id']}})[_0x118b('0x28')](handleEntityNotFound(_0x1b864c,null))['then'](removeEntity(_0x1b864c,null))[_0x118b('0x45')](handleError(_0x1b864c,null));};exports['create']=function(_0x5f3fdd,_0x21a5dd){var _0x31e891={'key':_0x5f3fdd[_0x118b('0x49')][_0x118b('0x32')]};if(_0x5f3fdd[_0x118b('0x49')][_0x118b('0x4b')]){_0x31e891[_0x118b('0x4b')]=_0x5f3fdd['body'][_0x118b('0x4b')];}else if(_0x5f3fdd[_0x118b('0x49')][_0x118b('0x4c')]){_0x31e891['SmsAccountId']=_0x5f3fdd[_0x118b('0x49')]['SmsAccountId'];}else if(_0x5f3fdd[_0x118b('0x49')][_0x118b('0x4d')]){_0x31e891['OpenchannelAccountId']=_0x5f3fdd[_0x118b('0x49')][_0x118b('0x4d')];}else if(_0x5f3fdd[_0x118b('0x49')][_0x118b('0x4e')]){_0x31e891['ChatWebsiteId']=_0x5f3fdd[_0x118b('0x49')][_0x118b('0x4e')];}return db['CannedAnswer'][_0x118b('0x48')]({'where':_0x31e891})[_0x118b('0x28')](function(_0x50a31e){if(_0x50a31e){throw new db[(_0x118b('0x4f'))]['ValidationError'](_0x118b('0x50'));}return db['CannedAnswer'][_0x118b('0x51')](_0x5f3fdd['body']);})[_0x118b('0x28')](function(_0x136128){var _0x27687e=_0x5f3fdd['user'][_0x118b('0x25')]({'plain':!![]});if(!_0x27687e)throw new Error(_0x118b('0x52'));if(_0x27687e[_0x118b('0x53')]===_0x118b('0x54')){var _0x23c210=_0x136128[_0x118b('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x118b('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x27687e[_0x118b('0x55')]},'raw':!![]})[_0x118b('0x28')](function(_0x2b8684){if(_0x2b8684&&_0x2b8684[_0x118b('0x56')]===0x0){return db[_0x118b('0x27')]['create']({'name':_0x23c210[_0x118b('0x2b')],'resourceId':_0x23c210['id'],'type':_0x2b8684['name'],'sectionId':_0x2b8684['id']},{})['then'](function(){return _0x136128;});}else{return _0x136128;}})['catch'](function(_0x49d377){logger[_0x118b('0x29')](_0x118b('0x57'),_0x49d377);throw _0x49d377;});}return _0x136128;})['then'](respondWithResult(_0x21a5dd,0xc9))[_0x118b('0x45')](handleError(_0x21a5dd,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 10a357c..65c2232 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 _0x4a0e=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports','CannedAnswer'];(function(_0x32d330,_0xe907c8){var _0xe81a43=function(_0x322e56){while(--_0x322e56){_0x32d330['push'](_0x32d330['shift']());}};_0xe81a43(++_0xe907c8);}(_0x4a0e,0xab));var _0xe4a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4a0e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe4a0('0x0'));var util=require(_0xe4a0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe4a0('0x2'));var BPromise=require(_0xe4a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4a0('0x4'));var rimraf=require(_0xe4a0('0x5'));var config=require(_0xe4a0('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0xe4a0('0x7')]=function(_0x175e2c,_0x1b65dc){return _0x175e2c['define'](_0xe4a0('0x8'),attributes,{'tableName':_0xe4a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4a0('0xa'),'collate':_0xe4a0('0xb')});}; \ No newline at end of file +var _0x6212=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x5ec171,_0x1bc5ac){var _0x1daffc=function(_0x4cd205){while(--_0x4cd205){_0x5ec171['push'](_0x5ec171['shift']());}};_0x1daffc(++_0x1bc5ac);}(_0x6212,0x1d2));var _0x2621=function(_0x87e314,_0x1529d2){_0x87e314=_0x87e314-0x0;var _0x4f9fb6=_0x6212[_0x87e314];return _0x4f9fb6;};'use strict';var _=require('lodash');var util=require(_0x2621('0x0'));var logger=require(_0x2621('0x1'))(_0x2621('0x2'));var moment=require('moment');var BPromise=require(_0x2621('0x3'));var rp=require(_0x2621('0x4'));var fs=require('fs');var path=require(_0x2621('0x5'));var rimraf=require(_0x2621('0x6'));var config=require(_0x2621('0x7'));var attributes=require(_0x2621('0x8'));module[_0x2621('0x9')]=function(_0x36216b,_0x1d4bea){return _0x36216b['define'](_0x2621('0xa'),attributes,{'tableName':_0x2621('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2621('0xc'),'collate':_0x2621('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3c22b06..df37b8d 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(_0x2392ce,_0x58047f){var _0x3d7dd8=function(_0x429896){while(--_0x429896){_0x2392ce['push'](_0x2392ce['shift']());}};_0x3d7dd8(++_0x58047f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x5950a4,_0x3a8648){var _0x224b20=function(_0x56af52){while(--_0x56af52){_0x5950a4['push'](_0x5950a4['shift']());}};_0x224b20(++_0x3a8648);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 d0f8006..47d5743 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 _0x33b0=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x17d703,_0x2266eb){var _0x4fd652=function(_0x4147ad){while(--_0x4147ad){_0x17d703['push'](_0x17d703['shift']());}};_0x4fd652(++_0x2266eb);}(_0x33b0,0xe8));var _0x033b=function(_0x3b3530,_0x460ac7){_0x3b3530=_0x3b3530-0x0;var _0x46d015=_0x33b0[_0x3b3530];return _0x46d015;};'use strict';var multer=require('multer');var util=require(_0x033b('0x0'));var path=require(_0x033b('0x1'));var timeout=require(_0x033b('0x2'));var express=require(_0x033b('0x3'));var router=express[_0x033b('0x4')]();var fs_extra=require(_0x033b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x033b('0x6'));var config=require(_0x033b('0x7'));var controller=require(_0x033b('0x8'));router[_0x033b('0x9')]('/',auth[_0x033b('0xa')](),controller[_0x033b('0xb')]);router['get'](_0x033b('0xc'),auth[_0x033b('0xa')](),controller['show']);router[_0x033b('0xd')]('/',auth[_0x033b('0xa')](),controller[_0x033b('0xe')]);router[_0x033b('0xf')](_0x033b('0xc'),auth[_0x033b('0xa')](),controller['update']);router['delete'](_0x033b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x033b('0x10')]=router; \ No newline at end of file +var _0xcc9d=['create','/:id','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post'];(function(_0x3c755a,_0x1e220d){var _0x1a7177=function(_0x1bd88e){while(--_0x1bd88e){_0x3c755a['push'](_0x3c755a['shift']());}};_0x1a7177(++_0x1e220d);}(_0xcc9d,0x6b));var _0xdcc9=function(_0x564c60,_0x25afdc){_0x564c60=_0x564c60-0x0;var _0x484d84=_0xcc9d[_0x564c60];return _0x484d84;};'use strict';var multer=require(_0xdcc9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdcc9('0x1'));var express=require(_0xdcc9('0x2'));var router=express[_0xdcc9('0x3')]();var fs_extra=require(_0xdcc9('0x4'));var auth=require(_0xdcc9('0x5'));var interaction=require(_0xdcc9('0x6'));var config=require(_0xdcc9('0x7'));var controller=require('./cannedAnswer.controller');router[_0xdcc9('0x8')]('/',auth['isAuthenticated'](),controller[_0xdcc9('0x9')]);router[_0xdcc9('0x8')]('/:id',auth[_0xdcc9('0xa')](),controller['show']);router[_0xdcc9('0xb')]('/',auth[_0xdcc9('0xa')](),controller[_0xdcc9('0xc')]);router['put'](_0xdcc9('0xd'),auth[_0xdcc9('0xa')](),controller[_0xdcc9('0xe')]);router['delete'](_0xdcc9('0xd'),auth[_0xdcc9('0xa')](),controller[_0xdcc9('0xf')]);module[_0xdcc9('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index cc90272..4486f63 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 _0x639a=['INTEGER','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x56b7df,_0x3e54bd){var _0x41a7e1=function(_0x2ece92){while(--_0x2ece92){_0x56b7df['push'](_0x56b7df['shift']());}};_0x41a7e1(++_0x3e54bd);}(_0x639a,0xec));var _0xa639=function(_0x2b7bd1,_0x50c736){_0x2b7bd1=_0x2b7bd1-0x0;var _0x3c2388=_0x639a[_0x2b7bd1];return _0x3c2388;};'use strict';var Sequelize=require('sequelize');module[_0xa639('0x0')]={'calldate':{'type':Sequelize[_0xa639('0x1')],'allowNull':![],'defaultValue':_0xa639('0x2')},'clid':{'type':Sequelize[_0xa639('0x3')]},'src':{'type':Sequelize[_0xa639('0x3')]},'dst':{'type':Sequelize[_0xa639('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa639('0x3')]},'dstchannel':{'type':Sequelize[_0xa639('0x3')]},'lastapp':{'type':Sequelize[_0xa639('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xa639('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa639('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa639('0x3')]},'amaflags':{'type':Sequelize[_0xa639('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xa639('0x3')]},'uniqueid':{'type':Sequelize[_0xa639('0x3')]},'linkedid':{'type':Sequelize[_0xa639('0x3')]},'sequence':{'type':Sequelize[_0xa639('0x3')]},'peeraccount':{'type':Sequelize[_0xa639('0x3')]},'type':{'type':Sequelize[_0xa639('0x3')]},'tag':{'type':Sequelize[_0xa639('0x3')]}}; \ No newline at end of file +var _0xf0e8=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x3ebf20,_0x45fa5d){var _0x5d4975=function(_0x4de4fb){while(--_0x4de4fb){_0x3ebf20['push'](_0x3ebf20['shift']());}};_0x5d4975(++_0x45fa5d);}(_0xf0e8,0x81));var _0x8f0e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf0e8[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x8f0e('0x0'));module[_0x8f0e('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x8f0e('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x8f0e('0x3')]},'dst':{'type':Sequelize[_0x8f0e('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8f0e('0x3')]},'dstchannel':{'type':Sequelize[_0x8f0e('0x3')]},'lastapp':{'type':Sequelize[_0x8f0e('0x3')]},'lastdata':{'type':Sequelize[_0x8f0e('0x3')]},'duration':{'type':Sequelize[_0x8f0e('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x8f0e('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8f0e('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8f0e('0x3')]},'linkedid':{'type':Sequelize[_0x8f0e('0x3')]},'sequence':{'type':Sequelize[_0x8f0e('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x8f0e('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index c13fa83..f81bf55 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 _0xf072=['describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','Cdr','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','body','find','params'];(function(_0x293493,_0x507b91){var _0x453030=function(_0x93ea7d){while(--_0x93ea7d){_0x293493['push'](_0x293493['shift']());}};_0x453030(++_0x507b91);}(_0xf072,0x1cf));var _0x2f07=function(_0x43e81a,_0x16ff48){_0x43e81a=_0x43e81a-0x0;var _0x4870a9=_0xf072[_0x43e81a];return _0x4870a9;};'use strict';var emlformat=require(_0x2f07('0x0'));var rimraf=require(_0x2f07('0x1'));var zipdir=require(_0x2f07('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f07('0x3'));var moment=require('moment');var BPromise=require(_0x2f07('0x4'));var Mustache=require(_0x2f07('0x5'));var util=require(_0x2f07('0x6'));var path=require('path');var sox=require(_0x2f07('0x7'));var csv=require(_0x2f07('0x8'));var ejs=require(_0x2f07('0x9'));var fs=require('fs');var fs_extra=require(_0x2f07('0xa'));var _=require(_0x2f07('0xb'));var squel=require(_0x2f07('0xc'));var crypto=require(_0x2f07('0xd'));var jsforce=require(_0x2f07('0xe'));var deskjs=require(_0x2f07('0xf'));var toCsv=require(_0x2f07('0x8'));var querystring=require(_0x2f07('0x10'));var Papa=require(_0x2f07('0x11'));var Redis=require(_0x2f07('0x12'));var authService=require(_0x2f07('0x13'));var qs=require(_0x2f07('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f07('0x15'));var logger=require(_0x2f07('0x16'))(_0x2f07('0x17'));var utils=require(_0x2f07('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f07('0x19'))['db'];function respondWithStatusCode(_0x1e291d,_0x58549c){_0x58549c=_0x58549c||0xcc;return function(_0x6eb88a){if(_0x6eb88a){return _0x1e291d[_0x2f07('0x1a')](_0x58549c);}return _0x1e291d[_0x2f07('0x1b')](_0x58549c)['end']();};}function respondWithResult(_0x211514,_0x443fdc){_0x443fdc=_0x443fdc||0xc8;return function(_0x3596ea){if(_0x3596ea){return _0x211514[_0x2f07('0x1b')](_0x443fdc)[_0x2f07('0x1c')](_0x3596ea);}};}function respondWithFilteredResult(_0x309908,_0x5d32d6){return function(_0x8475cf){if(_0x8475cf){var _0x5a7b5c=typeof _0x5d32d6[_0x2f07('0x1d')]===_0x2f07('0x1e')&&typeof _0x5d32d6[_0x2f07('0x1f')]===_0x2f07('0x1e');var _0x1ec70d=_0x8475cf[_0x2f07('0x20')];var _0x1a6135=_0x5a7b5c?0x0:_0x5d32d6[_0x2f07('0x1d')];var _0x55bd60=_0x5a7b5c?_0x8475cf[_0x2f07('0x20')]:_0x5d32d6['offset']+_0x5d32d6[_0x2f07('0x1f')];var _0x2df6ed;if(_0x55bd60>=_0x1ec70d){_0x55bd60=_0x1ec70d;_0x2df6ed=0xc8;}else{_0x2df6ed=0xce;}_0x309908[_0x2f07('0x1b')](_0x2df6ed);return _0x309908[_0x2f07('0x21')](_0x2f07('0x22'),_0x1a6135+'-'+_0x55bd60+'/'+_0x1ec70d)['json'](_0x8475cf);}return null;};}function patchUpdates(_0x45df73){return function(_0x5a0146){try{jsonpatch['apply'](_0x5a0146,_0x45df73,!![]);}catch(_0x51ed43){return BPromise[_0x2f07('0x23')](_0x51ed43);}return _0x5a0146['save']();};}function saveUpdates(_0xb0c978,_0x5e6ac6){return function(_0x354ee2){if(_0x354ee2){return _0x354ee2[_0x2f07('0x24')](_0xb0c978)[_0x2f07('0x25')](function(_0x307888){return _0x307888;});}return null;};}function removeEntity(_0x49521b,_0x31be77){return function(_0x428d8c){if(_0x428d8c){return _0x428d8c[_0x2f07('0x26')]()['then'](function(){_0x49521b[_0x2f07('0x1b')](0xcc)[_0x2f07('0x27')]();});}};}function handleEntityNotFound(_0x522006,_0x1dcedc){return function(_0x1c9ca1){if(!_0x1c9ca1){_0x522006['sendStatus'](0x194);}return _0x1c9ca1;};}function handleError(_0x427e13,_0x562335){_0x562335=_0x562335||0x1f4;return function(_0x894cd4){logger[_0x2f07('0x28')](_0x894cd4[_0x2f07('0x29')]);if(_0x894cd4[_0x2f07('0x2a')]){delete _0x894cd4[_0x2f07('0x2a')];}_0x427e13[_0x2f07('0x1b')](_0x562335)[_0x2f07('0x2b')](_0x894cd4);};}exports[_0x2f07('0x2c')]=function(_0x3d7fff,_0x468cd8){var _0x3b4e2f={},_0x279eb3={},_0x4c607a={'count':0x0,'rows':[]};var _0x1accef=_[_0x2f07('0x2d')](db[_0x2f07('0x2e')]['rawAttributes'],function(_0x36d4b8){return{'name':_0x36d4b8[_0x2f07('0x2f')],'type':_0x36d4b8[_0x2f07('0x30')]['key']};});_0x279eb3[_0x2f07('0x31')]=_[_0x2f07('0x2d')](_0x1accef,_0x2f07('0x2a'));_0x279eb3[_0x2f07('0x32')]=_[_0x2f07('0x33')](_0x3d7fff[_0x2f07('0x32')]);_0x279eb3[_0x2f07('0x34')]=_['intersection'](_0x279eb3[_0x2f07('0x31')],_0x279eb3['query']);_0x3b4e2f[_0x2f07('0x35')]=_[_0x2f07('0x36')](_0x279eb3[_0x2f07('0x31')],qs[_0x2f07('0x37')](_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x37')]));_0x3b4e2f[_0x2f07('0x35')]=_0x3b4e2f[_0x2f07('0x35')][_0x2f07('0x38')]?_0x3b4e2f[_0x2f07('0x35')]:_0x279eb3[_0x2f07('0x31')];if(!_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x39')](_0x2f07('0x3a'))){_0x3b4e2f[_0x2f07('0x1f')]=qs[_0x2f07('0x1f')](_0x3d7fff['query']['limit']);_0x3b4e2f[_0x2f07('0x1d')]=qs[_0x2f07('0x1d')](_0x3d7fff[_0x2f07('0x32')]['offset']);}_0x3b4e2f['order']=qs[_0x2f07('0x3b')](_0x3d7fff['query'][_0x2f07('0x3b')]);_0x3b4e2f[_0x2f07('0x3c')]=qs[_0x2f07('0x34')](_[_0x2f07('0x3d')](_0x3d7fff[_0x2f07('0x32')],_0x279eb3['filters']),_0x1accef);if(_0x3d7fff[_0x2f07('0x32')]['filter']){_0x3b4e2f[_0x2f07('0x3c')]=_['merge'](_0x3b4e2f[_0x2f07('0x3c')],{'$or':_['map'](_0x1accef,function(_0x508f8a){if(_0x508f8a[_0x2f07('0x30')]!==_0x2f07('0x3e')){var _0x5e96b5={};_0x5e96b5[_0x508f8a[_0x2f07('0x2a')]]={'$like':'%'+_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x3f')]+'%'};return _0x5e96b5;}})});}_0x3b4e2f=_['merge']({},_0x3b4e2f,_0x3d7fff[_0x2f07('0x40')]);var _0x185ef8={'where':_0x3b4e2f[_0x2f07('0x3c')]};return db[_0x2f07('0x2e')][_0x2f07('0x20')](_0x185ef8)[_0x2f07('0x25')](function(_0x1a0ef2){_0x4c607a[_0x2f07('0x20')]=_0x1a0ef2;if(_0x3d7fff['query'][_0x2f07('0x41')]){_0x3b4e2f[_0x2f07('0x42')]=[{'all':!![]}];}return db[_0x2f07('0x2e')][_0x2f07('0x43')](_0x3b4e2f);})[_0x2f07('0x25')](function(_0x2ded2e){_0x4c607a[_0x2f07('0x44')]=_0x2ded2e;return _0x4c607a;})['then'](respondWithFilteredResult(_0x468cd8,_0x3b4e2f))[_0x2f07('0x45')](handleError(_0x468cd8,null));};exports[_0x2f07('0x46')]=function(_0x32e3b0,_0x273c0f){var _0x3db7ad={'raw':!![],'where':{'id':_0x32e3b0['params']['id']}},_0xb6afe8={};_0xb6afe8[_0x2f07('0x31')]=_[_0x2f07('0x33')](db[_0x2f07('0x2e')][_0x2f07('0x47')]);_0xb6afe8['query']=_['keys'](_0x32e3b0[_0x2f07('0x32')]);_0xb6afe8[_0x2f07('0x34')]=_[_0x2f07('0x36')](_0xb6afe8[_0x2f07('0x31')],_0xb6afe8['query']);_0x3db7ad[_0x2f07('0x35')]=_[_0x2f07('0x36')](_0xb6afe8[_0x2f07('0x31')],qs[_0x2f07('0x37')](_0x32e3b0[_0x2f07('0x32')][_0x2f07('0x37')]));_0x3db7ad[_0x2f07('0x35')]=_0x3db7ad[_0x2f07('0x35')][_0x2f07('0x38')]?_0x3db7ad[_0x2f07('0x35')]:_0xb6afe8['model'];if(_0x32e3b0['query']['includeAll']){_0x3db7ad[_0x2f07('0x42')]=[{'all':!![]}];}_0x3db7ad=_[_0x2f07('0x48')]({},_0x3db7ad,_0x32e3b0['options']);return db[_0x2f07('0x2e')]['find'](_0x3db7ad)[_0x2f07('0x25')](handleEntityNotFound(_0x273c0f,null))[_0x2f07('0x25')](respondWithResult(_0x273c0f,null))[_0x2f07('0x45')](handleError(_0x273c0f,null));};exports['create']=function(_0x33f888,_0x350ace){return db['Cdr']['create'](_0x33f888[_0x2f07('0x49')],{})[_0x2f07('0x25')](respondWithResult(_0x350ace,0xc9))[_0x2f07('0x45')](handleError(_0x350ace,null));};exports[_0x2f07('0x24')]=function(_0x1596f8,_0x2f598b){if(_0x1596f8[_0x2f07('0x49')]['id']){delete _0x1596f8[_0x2f07('0x49')]['id'];}return db[_0x2f07('0x2e')][_0x2f07('0x4a')]({'where':{'id':_0x1596f8[_0x2f07('0x4b')]['id']}})[_0x2f07('0x25')](handleEntityNotFound(_0x2f598b,null))[_0x2f07('0x25')](saveUpdates(_0x1596f8[_0x2f07('0x49')],null))[_0x2f07('0x25')](respondWithResult(_0x2f598b,null))[_0x2f07('0x45')](handleError(_0x2f598b,null));};exports['destroy']=function(_0xec609d,_0x91e0e0){return db[_0x2f07('0x2e')][_0x2f07('0x4a')]({'where':{'id':_0xec609d[_0x2f07('0x4b')]['id']}})[_0x2f07('0x25')](handleEntityNotFound(_0x91e0e0,null))[_0x2f07('0x25')](removeEntity(_0x91e0e0,null))[_0x2f07('0x45')](handleError(_0x91e0e0,null));};exports[_0x2f07('0x4c')]=function(_0x5b920b,_0x3354e0){return db[_0x2f07('0x2e')][_0x2f07('0x4c')]()[_0x2f07('0x25')](respondWithResult(_0x3354e0,null))['catch'](handleError(_0x3354e0,null));}; \ No newline at end of file +var _0xf987=['attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','catch','show','params','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','model','keys','filters','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf987,0x18a));var _0x7f98=function(_0x4df542,_0x3fbbb3){_0x4df542=_0x4df542-0x0;var _0x5d6a7d=_0xf987[_0x4df542];return _0x5d6a7d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f98('0x0'));var jsonpatch=require(_0x7f98('0x1'));var rp=require('request-promise');var moment=require(_0x7f98('0x2'));var BPromise=require(_0x7f98('0x3'));var Mustache=require(_0x7f98('0x4'));var util=require(_0x7f98('0x5'));var path=require(_0x7f98('0x6'));var sox=require(_0x7f98('0x7'));var csv=require(_0x7f98('0x8'));var ejs=require(_0x7f98('0x9'));var fs=require('fs');var fs_extra=require(_0x7f98('0xa'));var _=require(_0x7f98('0xb'));var squel=require(_0x7f98('0xc'));var crypto=require(_0x7f98('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f98('0xe'));var toCsv=require(_0x7f98('0x8'));var querystring=require(_0x7f98('0xf'));var Papa=require(_0x7f98('0x10'));var Redis=require(_0x7f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7f98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f98('0x13'))(_0x7f98('0x14'));var utils=require(_0x7f98('0x15'));var config=require(_0x7f98('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f98('0x17'))['db'];function respondWithStatusCode(_0x4c4ae9,_0x9c2633){_0x9c2633=_0x9c2633||0xcc;return function(_0x2c26d8){if(_0x2c26d8){return _0x4c4ae9[_0x7f98('0x18')](_0x9c2633);}return _0x4c4ae9[_0x7f98('0x19')](_0x9c2633)[_0x7f98('0x1a')]();};}function respondWithResult(_0x11b1f8,_0x33108e){_0x33108e=_0x33108e||0xc8;return function(_0x3044d4){if(_0x3044d4){return _0x11b1f8[_0x7f98('0x19')](_0x33108e)[_0x7f98('0x1b')](_0x3044d4);}};}function respondWithFilteredResult(_0x2d366a,_0x1fa829){return function(_0x5e3bb5){if(_0x5e3bb5){var _0xcab406=typeof _0x1fa829['offset']==='undefined'&&typeof _0x1fa829[_0x7f98('0x1c')]===_0x7f98('0x1d');var _0x585a1a=_0x5e3bb5['count'];var _0x5f27dd=_0xcab406?0x0:_0x1fa829['offset'];var _0x111385=_0xcab406?_0x5e3bb5[_0x7f98('0x1e')]:_0x1fa829['offset']+_0x1fa829['limit'];var _0x4f3ac0;if(_0x111385>=_0x585a1a){_0x111385=_0x585a1a;_0x4f3ac0=0xc8;}else{_0x4f3ac0=0xce;}_0x2d366a[_0x7f98('0x19')](_0x4f3ac0);return _0x2d366a['set'](_0x7f98('0x1f'),_0x5f27dd+'-'+_0x111385+'/'+_0x585a1a)[_0x7f98('0x1b')](_0x5e3bb5);}return null;};}function patchUpdates(_0x3e78e2){return function(_0x446dd5){try{jsonpatch[_0x7f98('0x20')](_0x446dd5,_0x3e78e2,!![]);}catch(_0x1f2e6c){return BPromise[_0x7f98('0x21')](_0x1f2e6c);}return _0x446dd5[_0x7f98('0x22')]();};}function saveUpdates(_0x20ad36,_0x53c1ef){return function(_0x55189b){if(_0x55189b){return _0x55189b[_0x7f98('0x23')](_0x20ad36)['then'](function(_0xf39ff1){return _0xf39ff1;});}return null;};}function removeEntity(_0x2d9e09,_0x51eca3){return function(_0x417ad4){if(_0x417ad4){return _0x417ad4[_0x7f98('0x24')]()['then'](function(){_0x2d9e09[_0x7f98('0x19')](0xcc)[_0x7f98('0x1a')]();});}};}function handleEntityNotFound(_0x1d6bdb,_0x1a5788){return function(_0x3e1cd5){if(!_0x3e1cd5){_0x1d6bdb[_0x7f98('0x18')](0x194);}return _0x3e1cd5;};}function handleError(_0x2b58d0,_0x8b27a4){_0x8b27a4=_0x8b27a4||0x1f4;return function(_0x1d086f){logger[_0x7f98('0x25')](_0x1d086f[_0x7f98('0x26')]);if(_0x1d086f[_0x7f98('0x27')]){delete _0x1d086f[_0x7f98('0x27')];}_0x2b58d0['status'](_0x8b27a4)['send'](_0x1d086f);};}exports[_0x7f98('0x28')]=function(_0x2122f4,_0x186519){var _0x1dd8d5={},_0xc8f69f={},_0x16a8cb={'count':0x0,'rows':[]};var _0x20ff8d=_[_0x7f98('0x29')](db[_0x7f98('0x2a')][_0x7f98('0x2b')],function(_0x544bae){return{'name':_0x544bae[_0x7f98('0x2c')],'type':_0x544bae[_0x7f98('0x2d')]['key']};});_0xc8f69f[_0x7f98('0x2e')]=_[_0x7f98('0x29')](_0x20ff8d,_0x7f98('0x27'));_0xc8f69f['query']=_[_0x7f98('0x2f')](_0x2122f4['query']);_0xc8f69f[_0x7f98('0x30')]=_['intersection'](_0xc8f69f[_0x7f98('0x2e')],_0xc8f69f[_0x7f98('0x31')]);_0x1dd8d5[_0x7f98('0x32')]=_[_0x7f98('0x33')](_0xc8f69f[_0x7f98('0x2e')],qs[_0x7f98('0x34')](_0x2122f4[_0x7f98('0x31')]['fields']));_0x1dd8d5['attributes']=_0x1dd8d5[_0x7f98('0x32')][_0x7f98('0x35')]?_0x1dd8d5[_0x7f98('0x32')]:_0xc8f69f[_0x7f98('0x2e')];if(!_0x2122f4[_0x7f98('0x31')][_0x7f98('0x36')](_0x7f98('0x37'))){_0x1dd8d5['limit']=qs['limit'](_0x2122f4[_0x7f98('0x31')]['limit']);_0x1dd8d5[_0x7f98('0x38')]=qs['offset'](_0x2122f4[_0x7f98('0x31')][_0x7f98('0x38')]);}_0x1dd8d5[_0x7f98('0x39')]=qs[_0x7f98('0x3a')](_0x2122f4[_0x7f98('0x31')][_0x7f98('0x3a')]);_0x1dd8d5[_0x7f98('0x3b')]=qs[_0x7f98('0x30')](_[_0x7f98('0x3c')](_0x2122f4[_0x7f98('0x31')],_0xc8f69f[_0x7f98('0x30')]),_0x20ff8d);if(_0x2122f4[_0x7f98('0x31')][_0x7f98('0x3d')]){_0x1dd8d5[_0x7f98('0x3b')]=_[_0x7f98('0x3e')](_0x1dd8d5[_0x7f98('0x3b')],{'$or':_[_0x7f98('0x29')](_0x20ff8d,function(_0x45f280){if(_0x45f280[_0x7f98('0x2d')]!==_0x7f98('0x3f')){var _0x1b82cc={};_0x1b82cc[_0x45f280[_0x7f98('0x27')]]={'$like':'%'+_0x2122f4[_0x7f98('0x31')]['filter']+'%'};return _0x1b82cc;}})});}_0x1dd8d5=_[_0x7f98('0x3e')]({},_0x1dd8d5,_0x2122f4[_0x7f98('0x40')]);var _0x57a855={'where':_0x1dd8d5[_0x7f98('0x3b')]};return db['Cdr']['count'](_0x57a855)[_0x7f98('0x41')](function(_0x24bbdc){_0x16a8cb['count']=_0x24bbdc;if(_0x2122f4[_0x7f98('0x31')]['includeAll']){_0x1dd8d5['include']=[{'all':!![]}];}return db['Cdr'][_0x7f98('0x42')](_0x1dd8d5);})['then'](function(_0x2ab479){_0x16a8cb['rows']=_0x2ab479;return _0x16a8cb;})[_0x7f98('0x41')](respondWithFilteredResult(_0x186519,_0x1dd8d5))[_0x7f98('0x43')](handleError(_0x186519,null));};exports[_0x7f98('0x44')]=function(_0x1d53eb,_0x48ede9){var _0x55a8cc={'raw':!![],'where':{'id':_0x1d53eb[_0x7f98('0x45')]['id']}},_0x5b8fef={};_0x5b8fef[_0x7f98('0x2e')]=_['keys'](db['Cdr'][_0x7f98('0x2b')]);_0x5b8fef[_0x7f98('0x31')]=_[_0x7f98('0x2f')](_0x1d53eb[_0x7f98('0x31')]);_0x5b8fef[_0x7f98('0x30')]=_[_0x7f98('0x33')](_0x5b8fef['model'],_0x5b8fef[_0x7f98('0x31')]);_0x55a8cc[_0x7f98('0x32')]=_[_0x7f98('0x33')](_0x5b8fef[_0x7f98('0x2e')],qs[_0x7f98('0x34')](_0x1d53eb[_0x7f98('0x31')][_0x7f98('0x34')]));_0x55a8cc[_0x7f98('0x32')]=_0x55a8cc[_0x7f98('0x32')][_0x7f98('0x35')]?_0x55a8cc[_0x7f98('0x32')]:_0x5b8fef[_0x7f98('0x2e')];if(_0x1d53eb['query']['includeAll']){_0x55a8cc['include']=[{'all':!![]}];}_0x55a8cc=_[_0x7f98('0x3e')]({},_0x55a8cc,_0x1d53eb[_0x7f98('0x40')]);return db['Cdr'][_0x7f98('0x46')](_0x55a8cc)[_0x7f98('0x41')](handleEntityNotFound(_0x48ede9,null))[_0x7f98('0x41')](respondWithResult(_0x48ede9,null))[_0x7f98('0x43')](handleError(_0x48ede9,null));};exports[_0x7f98('0x47')]=function(_0x83db32,_0x157723){return db[_0x7f98('0x2a')][_0x7f98('0x47')](_0x83db32['body'],{})[_0x7f98('0x41')](respondWithResult(_0x157723,0xc9))[_0x7f98('0x43')](handleError(_0x157723,null));};exports[_0x7f98('0x23')]=function(_0x32e242,_0x3396a7){if(_0x32e242['body']['id']){delete _0x32e242[_0x7f98('0x48')]['id'];}return db[_0x7f98('0x2a')]['find']({'where':{'id':_0x32e242[_0x7f98('0x45')]['id']}})[_0x7f98('0x41')](handleEntityNotFound(_0x3396a7,null))[_0x7f98('0x41')](saveUpdates(_0x32e242[_0x7f98('0x48')],null))['then'](respondWithResult(_0x3396a7,null))[_0x7f98('0x43')](handleError(_0x3396a7,null));};exports['destroy']=function(_0x513c2f,_0x3467ad){return db[_0x7f98('0x2a')][_0x7f98('0x46')]({'where':{'id':_0x513c2f[_0x7f98('0x45')]['id']}})[_0x7f98('0x41')](handleEntityNotFound(_0x3467ad,null))[_0x7f98('0x41')](removeEntity(_0x3467ad,null))[_0x7f98('0x43')](handleError(_0x3467ad,null));};exports[_0x7f98('0x49')]=function(_0x3b268d,_0x203a53){return db['Cdr'][_0x7f98('0x49')]()[_0x7f98('0x41')](respondWithResult(_0x203a53,null))[_0x7f98('0x43')](handleError(_0x203a53,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8dd8c3b..5f2ed42 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(_0x3a0086,_0x1d1f2f){var _0x3c1cd8=function(_0x457219){while(--_0x457219){_0x3a0086['push'](_0x3a0086['shift']());}};_0x3c1cd8(++_0x1d1f2f);}(_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':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x35355c,_0x5b3c4a){var _0x2a4b23=function(_0x1fe2b9){while(--_0x1fe2b9){_0x35355c['push'](_0x35355c['shift']());}};_0x2a4b23(++_0x5b3c4a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 070d667..ff57d51 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 _0x2b3b=['error','code','Cdr,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c148f,_0x3eafcf){var _0x4d956a=function(_0x4a98b4){while(--_0x4a98b4){_0x3c148f['push'](_0x3c148f['shift']());}};_0x4d956a(++_0x3eafcf);}(_0x2b3b,0x151));var _0xb2b3=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x2b3b[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0xb2b3('0x0'));var util=require(_0xb2b3('0x1'));var moment=require(_0xb2b3('0x2'));var BPromise=require(_0xb2b3('0x3'));var rs=require(_0xb2b3('0x4'));var fs=require('fs');var Redis=require(_0xb2b3('0x5'));var db=require(_0xb2b3('0x6'))['db'];var utils=require(_0xb2b3('0x7'));var logger=require('../../config/logger')(_0xb2b3('0x8'));var config=require(_0xb2b3('0x9'));var jayson=require(_0xb2b3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49ddb1,_0x23a4b9,_0x494acd){return new BPromise(function(_0x3c81af,_0x3fa82f){return client['request'](_0x49ddb1,_0x494acd)[_0xb2b3('0xb')](function(_0x51d444){logger['info']('Cdr,\x20%s,\x20%s',_0x23a4b9,_0xb2b3('0xc'));logger['debug'](_0xb2b3('0xd'),_0x23a4b9,'request\x20sent',JSON[_0xb2b3('0xe')](_0x51d444));if(_0x51d444[_0xb2b3('0xf')]){if(_0x51d444[_0xb2b3('0xf')][_0xb2b3('0x10')]===0x1f4){logger[_0xb2b3('0xf')](_0xb2b3('0x11'),_0x23a4b9,_0x51d444[_0xb2b3('0xf')][_0xb2b3('0x12')]);return _0x3fa82f(_0x51d444[_0xb2b3('0xf')][_0xb2b3('0x12')]);}logger[_0xb2b3('0xf')](_0xb2b3('0x11'),_0x23a4b9,_0x51d444[_0xb2b3('0xf')][_0xb2b3('0x12')]);return _0x3c81af(_0x51d444['error']['message']);}else{logger[_0xb2b3('0x13')](_0xb2b3('0x11'),_0x23a4b9,_0xb2b3('0xc'));_0x3c81af(_0x51d444[_0xb2b3('0x14')][_0xb2b3('0x12')]);}})[_0xb2b3('0x15')](function(_0x24eca0){logger[_0xb2b3('0xf')](_0xb2b3('0x11'),_0x23a4b9,_0x24eca0);_0x3fa82f(_0x24eca0);});});} \ No newline at end of file +var _0xafb8=['client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0xafb8,0x14d));var _0x8afb=function(_0x49988a,_0x5d4fef){_0x49988a=_0x49988a-0x0;var _0x399902=_0xafb8[_0x49988a];return _0x399902;};'use strict';var _=require(_0x8afb('0x0'));var util=require('util');var moment=require(_0x8afb('0x1'));var BPromise=require('bluebird');var rs=require(_0x8afb('0x2'));var fs=require('fs');var Redis=require(_0x8afb('0x3'));var db=require(_0x8afb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8afb('0x5'))(_0x8afb('0x6'));var config=require(_0x8afb('0x7'));var jayson=require(_0x8afb('0x8'));var client=jayson[_0x8afb('0x9')][_0x8afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x549d46,_0x6a0b51,_0x5c27bc){return new BPromise(function(_0x28f063,_0x1c7091){return client[_0x8afb('0xb')](_0x549d46,_0x5c27bc)['then'](function(_0x4e7030){logger[_0x8afb('0xc')](_0x8afb('0xd'),_0x6a0b51,_0x8afb('0xe'));logger[_0x8afb('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x6a0b51,_0x8afb('0xe'),JSON['stringify'](_0x4e7030));if(_0x4e7030['error']){if(_0x4e7030[_0x8afb('0x10')]['code']===0x1f4){logger['error'](_0x8afb('0xd'),_0x6a0b51,_0x4e7030[_0x8afb('0x10')]['message']);return _0x1c7091(_0x4e7030[_0x8afb('0x10')]['message']);}logger['error'](_0x8afb('0xd'),_0x6a0b51,_0x4e7030[_0x8afb('0x10')]['message']);return _0x28f063(_0x4e7030[_0x8afb('0x10')][_0x8afb('0x11')]);}else{logger[_0x8afb('0xc')]('Cdr,\x20%s,\x20%s',_0x6a0b51,'request\x20sent');_0x28f063(_0x4e7030['result'][_0x8afb('0x11')]);}})[_0x8afb('0x12')](function(_0xd8d3b1){logger[_0x8afb('0x10')]('Cdr,\x20%s,\x20%s',_0x6a0b51,_0xd8d3b1);_0x1c7091(_0xd8d3b1);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4be1545..60c645b 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x11a44a,_0x38c203){var _0x1f3a32=function(_0x560f1d){while(--_0x560f1d){_0x11a44a['push'](_0x11a44a['shift']());}};_0x1f3a32(++_0x38c203);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4e8022,_0x53229d){var _0xf5e73f=function(_0x3a1309){while(--_0x3a1309){_0x4e8022['push'](_0x4e8022['shift']());}};_0xf5e73f(++_0x53229d);}(_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 09ed65d..f5b987e 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 _0xa979=['TEXT','STRING','exports','noop'];(function(_0x2e4a2c,_0x137021){var _0x2d2114=function(_0x449043){while(--_0x449043){_0x2e4a2c['push'](_0x2e4a2c['shift']());}};_0x2d2114(++_0x137021);}(_0xa979,0x92));var _0x9a97=function(_0x3e80b4,_0x310588){_0x3e80b4=_0x3e80b4-0x0;var _0x423d6d=_0xa979[_0x3e80b4];return _0x423d6d;};'use strict';var Sequelize=require('sequelize');module[_0x9a97('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9a97('0x1')},'appdata':{'type':Sequelize[_0x9a97('0x2')]()},'description':{'type':Sequelize[_0x9a97('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd9fa=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x403dbf,_0x2dde4e){var _0x1a68af=function(_0x3addbd){while(--_0x3addbd){_0x403dbf['push'](_0x403dbf['shift']());}};_0x1a68af(++_0x2dde4e);}(_0xd9fa,0xa0));var _0xad9f=function(_0x4ff786,_0x5190fc){_0x4ff786=_0x4ff786-0x0;var _0x55d81a=_0xd9fa[_0x4ff786];return _0x55d81a;};'use strict';var Sequelize=require(_0xad9f('0x0'));module[_0xad9f('0x1')]={'priority':{'type':Sequelize[_0xad9f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad9f('0x3')},'appdata':{'type':Sequelize[_0xad9f('0x4')]()},'description':{'type':Sequelize[_0xad9f('0x5')]},'interval':{'type':Sequelize[_0xad9f('0x5')],'defaultValue':_0xad9f('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 9f79176..ad13ef3 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 _0x0f73=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','update','body','catch','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f73,0x146));var _0x30f7=function(_0x6b1809,_0x5b41fa){_0x6b1809=_0x6b1809-0x0;var _0x34eb12=_0x0f73[_0x6b1809];return _0x34eb12;};'use strict';var emlformat=require(_0x30f7('0x0'));var rimraf=require(_0x30f7('0x1'));var zipdir=require(_0x30f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x30f7('0x3'));var BPromise=require(_0x30f7('0x4'));var Mustache=require(_0x30f7('0x5'));var util=require(_0x30f7('0x6'));var path=require(_0x30f7('0x7'));var sox=require('sox');var csv=require(_0x30f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30f7('0x9'));var squel=require(_0x30f7('0xa'));var crypto=require(_0x30f7('0xb'));var jsforce=require(_0x30f7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x30f7('0x8'));var querystring=require(_0x30f7('0xd'));var Papa=require('papaparse');var Redis=require(_0x30f7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x30f7('0xf'));var hardwareService=require(_0x30f7('0x10'));var logger=require(_0x30f7('0x11'))(_0x30f7('0x12'));var utils=require('../../config/utils');var config=require(_0x30f7('0x13'));var licenseUtil=require(_0x30f7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x121af8,_0x7b4cd1){_0x7b4cd1=_0x7b4cd1||0xcc;return function(_0xb9752c){if(_0xb9752c){return _0x121af8['sendStatus'](_0x7b4cd1);}return _0x121af8[_0x30f7('0x15')](_0x7b4cd1)[_0x30f7('0x16')]();};}function respondWithResult(_0x5155bd,_0x1ad086){_0x1ad086=_0x1ad086||0xc8;return function(_0xfc31c5){if(_0xfc31c5){return _0x5155bd[_0x30f7('0x15')](_0x1ad086)[_0x30f7('0x17')](_0xfc31c5);}};}function respondWithFilteredResult(_0x2b5a47,_0x579e7a){return function(_0x49fccb){if(_0x49fccb){var _0x401f9e=typeof _0x579e7a[_0x30f7('0x18')]===_0x30f7('0x19')&&typeof _0x579e7a[_0x30f7('0x1a')]==='undefined';var _0x2681d7=_0x49fccb[_0x30f7('0x1b')];var _0x1efb71=_0x401f9e?0x0:_0x579e7a[_0x30f7('0x18')];var _0x1e7777=_0x401f9e?_0x49fccb[_0x30f7('0x1b')]:_0x579e7a[_0x30f7('0x18')]+_0x579e7a[_0x30f7('0x1a')];var _0x1d6f46;if(_0x1e7777>=_0x2681d7){_0x1e7777=_0x2681d7;_0x1d6f46=0xc8;}else{_0x1d6f46=0xce;}_0x2b5a47['status'](_0x1d6f46);return _0x2b5a47[_0x30f7('0x1c')](_0x30f7('0x1d'),_0x1efb71+'-'+_0x1e7777+'/'+_0x2681d7)[_0x30f7('0x17')](_0x49fccb);}return null;};}function patchUpdates(_0x12cdf1){return function(_0x37d7d5){try{jsonpatch[_0x30f7('0x1e')](_0x37d7d5,_0x12cdf1,!![]);}catch(_0x5745d7){return BPromise[_0x30f7('0x1f')](_0x5745d7);}return _0x37d7d5[_0x30f7('0x20')]();};}function saveUpdates(_0x571f7e,_0x570d52){return function(_0x12d3f2){if(_0x12d3f2){return _0x12d3f2['update'](_0x571f7e)['then'](function(_0x4c6009){return _0x4c6009;});}return null;};}function removeEntity(_0x1bfc45,_0x261116){return function(_0x4c686d){if(_0x4c686d){return _0x4c686d['destroy']()[_0x30f7('0x21')](function(){_0x1bfc45[_0x30f7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x393d2f,_0x3bb297){return function(_0x14429e){if(!_0x14429e){_0x393d2f['sendStatus'](0x194);}return _0x14429e;};}function handleError(_0x206583,_0x4407ed){_0x4407ed=_0x4407ed||0x1f4;return function(_0x540caf){logger[_0x30f7('0x22')](_0x540caf[_0x30f7('0x23')]);if(_0x540caf['name']){delete _0x540caf[_0x30f7('0x24')];}_0x206583[_0x30f7('0x15')](_0x4407ed)['send'](_0x540caf);};}exports[_0x30f7('0x25')]=function(_0x591773,_0x2ec3b9){var _0x371258={'raw':!![],'where':{'id':_0x591773[_0x30f7('0x26')]['id']}},_0x21bb2a={};_0x21bb2a[_0x30f7('0x27')]=_[_0x30f7('0x28')](db[_0x30f7('0x29')][_0x30f7('0x2a')]);_0x21bb2a[_0x30f7('0x2b')]=_[_0x30f7('0x28')](_0x591773['query']);_0x21bb2a[_0x30f7('0x2c')]=_['intersection'](_0x21bb2a[_0x30f7('0x27')],_0x21bb2a['query']);_0x371258[_0x30f7('0x2d')]=_[_0x30f7('0x2e')](_0x21bb2a[_0x30f7('0x27')],qs[_0x30f7('0x2f')](_0x591773['query']['fields']));_0x371258[_0x30f7('0x2d')]=_0x371258[_0x30f7('0x2d')][_0x30f7('0x30')]?_0x371258[_0x30f7('0x2d')]:_0x21bb2a['model'];if(_0x591773[_0x30f7('0x2b')][_0x30f7('0x31')]){_0x371258[_0x30f7('0x32')]=[{'all':!![]}];}_0x371258=_[_0x30f7('0x33')]({},_0x371258,_0x591773[_0x30f7('0x34')]);return db[_0x30f7('0x29')][_0x30f7('0x35')](_0x371258)[_0x30f7('0x21')](handleEntityNotFound(_0x2ec3b9,null))[_0x30f7('0x21')](respondWithResult(_0x2ec3b9,null))['catch'](handleError(_0x2ec3b9,null));};exports[_0x30f7('0x36')]=function(_0x40fc05,_0x364952){if(_0x40fc05[_0x30f7('0x37')]['id']){delete _0x40fc05['body']['id'];}return db[_0x30f7('0x29')][_0x30f7('0x35')]({'where':{'id':_0x40fc05[_0x30f7('0x26')]['id']}})['then'](handleEntityNotFound(_0x364952,null))[_0x30f7('0x21')](saveUpdates(_0x40fc05[_0x30f7('0x37')],null))[_0x30f7('0x21')](respondWithResult(_0x364952,null))[_0x30f7('0x38')](handleError(_0x364952,null));};exports[_0x30f7('0x39')]=function(_0x31253a,_0x343011){return db[_0x30f7('0x29')]['find']({'where':{'id':_0x31253a[_0x30f7('0x26')]['id']}})[_0x30f7('0x21')](handleEntityNotFound(_0x343011,null))['then'](removeEntity(_0x343011,null))[_0x30f7('0x38')](handleError(_0x343011,null));}; \ No newline at end of file +var _0xefe2=['count','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','catch','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xefe2,0xd9));var _0x2efe=function(_0x15a25a,_0x19c429){_0x15a25a=_0x15a25a-0x0;var _0x1d25f8=_0xefe2[_0x15a25a];return _0x1d25f8;};'use strict';var emlformat=require(_0x2efe('0x0'));var rimraf=require(_0x2efe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2efe('0x2'));var rp=require(_0x2efe('0x3'));var moment=require('moment');var BPromise=require(_0x2efe('0x4'));var Mustache=require('mustache');var util=require(_0x2efe('0x5'));var path=require(_0x2efe('0x6'));var sox=require(_0x2efe('0x7'));var csv=require(_0x2efe('0x8'));var ejs=require(_0x2efe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2efe('0xa'));var squel=require(_0x2efe('0xb'));var crypto=require(_0x2efe('0xc'));var jsforce=require(_0x2efe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2efe('0x8'));var querystring=require(_0x2efe('0xe'));var Papa=require(_0x2efe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2efe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2efe('0x11'))(_0x2efe('0x12'));var utils=require(_0x2efe('0x13'));var config=require(_0x2efe('0x14'));var licenseUtil=require(_0x2efe('0x15'));var db=require(_0x2efe('0x16'))['db'];function respondWithStatusCode(_0x39a93b,_0x250023){_0x250023=_0x250023||0xcc;return function(_0x41039a){if(_0x41039a){return _0x39a93b[_0x2efe('0x17')](_0x250023);}return _0x39a93b['status'](_0x250023)['end']();};}function respondWithResult(_0x28681f,_0x1d9e5c){_0x1d9e5c=_0x1d9e5c||0xc8;return function(_0x562753){if(_0x562753){return _0x28681f['status'](_0x1d9e5c)[_0x2efe('0x18')](_0x562753);}};}function respondWithFilteredResult(_0x5195c8,_0x235af3){return function(_0x3b8b31){if(_0x3b8b31){var _0x51cbf3=typeof _0x235af3[_0x2efe('0x19')]===_0x2efe('0x1a')&&typeof _0x235af3['limit']===_0x2efe('0x1a');var _0x499c70=_0x3b8b31['count'];var _0xefd47=_0x51cbf3?0x0:_0x235af3[_0x2efe('0x19')];var _0x16acde=_0x51cbf3?_0x3b8b31[_0x2efe('0x1b')]:_0x235af3[_0x2efe('0x19')]+_0x235af3[_0x2efe('0x1c')];var _0x3017a7;if(_0x16acde>=_0x499c70){_0x16acde=_0x499c70;_0x3017a7=0xc8;}else{_0x3017a7=0xce;}_0x5195c8[_0x2efe('0x1d')](_0x3017a7);return _0x5195c8[_0x2efe('0x1e')](_0x2efe('0x1f'),_0xefd47+'-'+_0x16acde+'/'+_0x499c70)[_0x2efe('0x18')](_0x3b8b31);}return null;};}function patchUpdates(_0x6962df){return function(_0x491958){try{jsonpatch[_0x2efe('0x20')](_0x491958,_0x6962df,!![]);}catch(_0x538f39){return BPromise[_0x2efe('0x21')](_0x538f39);}return _0x491958[_0x2efe('0x22')]();};}function saveUpdates(_0x30ed16,_0x4ebeb6){return function(_0x131169){if(_0x131169){return _0x131169[_0x2efe('0x23')](_0x30ed16)['then'](function(_0x1c4a8d){return _0x1c4a8d;});}return null;};}function removeEntity(_0x368d08,_0xc24859){return function(_0x319b7f){if(_0x319b7f){return _0x319b7f[_0x2efe('0x24')]()[_0x2efe('0x25')](function(){_0x368d08[_0x2efe('0x1d')](0xcc)[_0x2efe('0x26')]();});}};}function handleEntityNotFound(_0x3d4449,_0x301cf2){return function(_0x1beaad){if(!_0x1beaad){_0x3d4449[_0x2efe('0x17')](0x194);}return _0x1beaad;};}function handleError(_0x3059c7,_0x255330){_0x255330=_0x255330||0x1f4;return function(_0x4c5118){logger[_0x2efe('0x27')](_0x4c5118[_0x2efe('0x28')]);if(_0x4c5118[_0x2efe('0x29')]){delete _0x4c5118[_0x2efe('0x29')];}_0x3059c7[_0x2efe('0x1d')](_0x255330)[_0x2efe('0x2a')](_0x4c5118);};}exports[_0x2efe('0x2b')]=function(_0xa11a23,_0x4039cb){var _0x33124f={'raw':!![],'where':{'id':_0xa11a23[_0x2efe('0x2c')]['id']}},_0x56b011={};_0x56b011[_0x2efe('0x2d')]=_[_0x2efe('0x2e')](db[_0x2efe('0x2f')][_0x2efe('0x30')]);_0x56b011['query']=_[_0x2efe('0x2e')](_0xa11a23[_0x2efe('0x31')]);_0x56b011[_0x2efe('0x32')]=_[_0x2efe('0x33')](_0x56b011[_0x2efe('0x2d')],_0x56b011[_0x2efe('0x31')]);_0x33124f[_0x2efe('0x34')]=_[_0x2efe('0x33')](_0x56b011[_0x2efe('0x2d')],qs[_0x2efe('0x35')](_0xa11a23['query'][_0x2efe('0x35')]));_0x33124f[_0x2efe('0x34')]=_0x33124f[_0x2efe('0x34')][_0x2efe('0x36')]?_0x33124f[_0x2efe('0x34')]:_0x56b011[_0x2efe('0x2d')];if(_0xa11a23[_0x2efe('0x31')][_0x2efe('0x37')]){_0x33124f[_0x2efe('0x38')]=[{'all':!![]}];}_0x33124f=_['merge']({},_0x33124f,_0xa11a23[_0x2efe('0x39')]);return db[_0x2efe('0x2f')]['find'](_0x33124f)['then'](handleEntityNotFound(_0x4039cb,null))['then'](respondWithResult(_0x4039cb,null))[_0x2efe('0x3a')](handleError(_0x4039cb,null));};exports[_0x2efe('0x23')]=function(_0x38e44f,_0x5a8ba4){if(_0x38e44f[_0x2efe('0x3b')]['id']){delete _0x38e44f[_0x2efe('0x3b')]['id'];}return db[_0x2efe('0x2f')]['find']({'where':{'id':_0x38e44f['params']['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x5a8ba4,null))['then'](saveUpdates(_0x38e44f[_0x2efe('0x3b')],null))[_0x2efe('0x25')](respondWithResult(_0x5a8ba4,null))[_0x2efe('0x3a')](handleError(_0x5a8ba4,null));};exports['destroy']=function(_0xd3ce22,_0x2ec0cd){return db[_0x2efe('0x2f')][_0x2efe('0x3c')]({'where':{'id':_0xd3ce22[_0x2efe('0x2c')]['id']}})[_0x2efe('0x25')](handleEntityNotFound(_0x2ec0cd,null))[_0x2efe('0x25')](removeEntity(_0x2ec0cd,null))['catch'](handleError(_0x2ec0cd,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 21f5694..97d5aab 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 _0xd6d6=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x580a4c,_0x42a6bb){var _0x48d86f=function(_0x2c4c25){while(--_0x2c4c25){_0x580a4c['push'](_0x580a4c['shift']());}};_0x48d86f(++_0x42a6bb);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x261cef,_0x1f0110){_0x261cef=_0x261cef-0x0;var _0x51ef6f=_0xd6d6[_0x261cef];return _0x51ef6f;};'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':!![],'charset':_0x6d6d('0xe'),'collate':_0x6d6d('0xf')});}; \ No newline at end of file +var _0x1749=['moment','bluebird','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','lodash','util','api'];(function(_0x5d9da9,_0x45d649){var _0x4af7b0=function(_0xd0b0bd){while(--_0xd0b0bd){_0x5d9da9['push'](_0x5d9da9['shift']());}};_0x4af7b0(++_0x45d649);}(_0x1749,0xfa));var _0x9174=function(_0x56e5a0,_0x3e3041){_0x56e5a0=_0x56e5a0-0x0;var _0x57239d=_0x1749[_0x56e5a0];return _0x57239d;};'use strict';var _=require(_0x9174('0x0'));var util=require(_0x9174('0x1'));var logger=require('../../config/logger')(_0x9174('0x2'));var moment=require(_0x9174('0x3'));var BPromise=require(_0x9174('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9174('0x5'));var attributes=require(_0x9174('0x6'));module[_0x9174('0x7')]=function(_0x17b580,_0x56d115){return _0x17b580['define'](_0x9174('0x8'),attributes,{'tableName':_0x9174('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9174('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5bb3629..050da00 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 _0x2036=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ChatApplication,\x20%s,\x20%s','debug'];(function(_0x24fb02,_0x8a25ea){var _0x42c490=function(_0x3eb45b){while(--_0x3eb45b){_0x24fb02['push'](_0x24fb02['shift']());}};_0x42c490(++_0x8a25ea);}(_0x2036,0x17e));var _0x6203=function(_0x213916,_0x5f55ce){_0x213916=_0x213916-0x0;var _0x26a845=_0x2036[_0x213916];return _0x26a845;};'use strict';var _=require('lodash');var util=require(_0x6203('0x0'));var moment=require(_0x6203('0x1'));var BPromise=require(_0x6203('0x2'));var rs=require(_0x6203('0x3'));var fs=require('fs');var Redis=require(_0x6203('0x4'));var db=require(_0x6203('0x5'))['db'];var utils=require(_0x6203('0x6'));var logger=require(_0x6203('0x7'))('rpc');var config=require(_0x6203('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6203('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5045,_0x535719,_0x2804f9){return new BPromise(function(_0x172585,_0x139f2b){return client[_0x6203('0xa')](_0x1e5045,_0x2804f9)[_0x6203('0xb')](function(_0x272cdd){logger['info'](_0x6203('0xc'),_0x535719,'request\x20sent');logger[_0x6203('0xd')](_0x6203('0xe'),_0x535719,'request\x20sent',JSON[_0x6203('0xf')](_0x272cdd));if(_0x272cdd[_0x6203('0x10')]){if(_0x272cdd[_0x6203('0x10')][_0x6203('0x11')]===0x1f4){logger[_0x6203('0x10')](_0x6203('0xc'),_0x535719,_0x272cdd[_0x6203('0x10')][_0x6203('0x12')]);return _0x139f2b(_0x272cdd[_0x6203('0x10')]['message']);}logger[_0x6203('0x10')](_0x6203('0xc'),_0x535719,_0x272cdd[_0x6203('0x10')][_0x6203('0x12')]);return _0x172585(_0x272cdd[_0x6203('0x10')]['message']);}else{logger[_0x6203('0x13')]('ChatApplication,\x20%s,\x20%s',_0x535719,_0x6203('0x14'));_0x172585(_0x272cdd[_0x6203('0x15')]['message']);}})['catch'](function(_0xca6a45){logger[_0x6203('0x10')](_0x6203('0xc'),_0x535719,_0xca6a45);_0x139f2b(_0xca6a45);});});} \ No newline at end of file +var _0x6527=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x17dcd1,_0x3b7ccb){var _0x12af77=function(_0x5c3bac){while(--_0x5c3bac){_0x17dcd1['push'](_0x17dcd1['shift']());}};_0x12af77(++_0x3b7ccb);}(_0x6527,0x113));var _0x7652=function(_0x3792f2,_0x43b3d2){_0x3792f2=_0x3792f2-0x0;var _0x50c888=_0x6527[_0x3792f2];return _0x50c888;};'use strict';var _=require(_0x7652('0x0'));var util=require(_0x7652('0x1'));var moment=require(_0x7652('0x2'));var BPromise=require('bluebird');var rs=require(_0x7652('0x3'));var fs=require('fs');var Redis=require(_0x7652('0x4'));var db=require(_0x7652('0x5'))['db'];var utils=require(_0x7652('0x6'));var logger=require(_0x7652('0x7'))(_0x7652('0x8'));var config=require(_0x7652('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7652('0xa')][_0x7652('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a1466,_0x45f3b3,_0x379c8b){return new BPromise(function(_0x2d4b2a,_0x5ba24c){return client[_0x7652('0xc')](_0x2a1466,_0x379c8b)[_0x7652('0xd')](function(_0x3a4aa6){logger[_0x7652('0xe')](_0x7652('0xf'),_0x45f3b3,_0x7652('0x10'));logger[_0x7652('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x45f3b3,'request\x20sent',JSON[_0x7652('0x12')](_0x3a4aa6));if(_0x3a4aa6[_0x7652('0x13')]){if(_0x3a4aa6[_0x7652('0x13')][_0x7652('0x14')]===0x1f4){logger[_0x7652('0x13')](_0x7652('0xf'),_0x45f3b3,_0x3a4aa6[_0x7652('0x13')][_0x7652('0x15')]);return _0x5ba24c(_0x3a4aa6[_0x7652('0x13')]['message']);}logger[_0x7652('0x13')](_0x7652('0xf'),_0x45f3b3,_0x3a4aa6[_0x7652('0x13')][_0x7652('0x15')]);return _0x2d4b2a(_0x3a4aa6[_0x7652('0x13')][_0x7652('0x15')]);}else{logger[_0x7652('0xe')](_0x7652('0xf'),_0x45f3b3,'request\x20sent');_0x2d4b2a(_0x3a4aa6['result']['message']);}})[_0x7652('0x16')](function(_0x10e495){logger[_0x7652('0x13')](_0x7652('0xf'),_0x45f3b3,_0x10e495);_0x5ba24c(_0x10e495);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 17a473e..6eacfcc 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 _0xf191=['get','/:id','isAuthenticated','show','put','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x3f4283,_0x4eaa04){var _0x457e2e=function(_0x3b0734){while(--_0x3b0734){_0x3f4283['push'](_0x3f4283['shift']());}};_0x457e2e(++_0x4eaa04);}(_0xf191,0x14b));var _0x1f19=function(_0x3f4a8e,_0x507c39){_0x3f4a8e=_0x3f4a8e-0x0;var _0x7f68fd=_0xf191[_0x3f4a8e];return _0x7f68fd;};'use strict';var multer=require(_0x1f19('0x0'));var util=require(_0x1f19('0x1'));var path=require(_0x1f19('0x2'));var timeout=require(_0x1f19('0x3'));var express=require(_0x1f19('0x4'));var router=express['Router']();var fs_extra=require(_0x1f19('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1f19('0x6'));var controller=require('./chatApplication.controller');router[_0x1f19('0x7')](_0x1f19('0x8'),auth[_0x1f19('0x9')](),controller[_0x1f19('0xa')]);router[_0x1f19('0xb')](_0x1f19('0x8'),auth[_0x1f19('0x9')](),controller['update']);router['delete']('/:id',auth[_0x1f19('0x9')](),controller[_0x1f19('0xc')]);module['exports']=router; \ No newline at end of file +var _0x93d4=['put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated','show'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x93d4,0x17e));var _0x493d=function(_0x240663,_0x3f3566){_0x240663=_0x240663-0x0;var _0x773b8c=_0x93d4[_0x240663];return _0x773b8c;};'use strict';var multer=require(_0x493d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x493d('0x1'));var express=require(_0x493d('0x2'));var router=express[_0x493d('0x3')]();var fs_extra=require(_0x493d('0x4'));var auth=require(_0x493d('0x5'));var interaction=require(_0x493d('0x6'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x493d('0x7'),auth[_0x493d('0x8')](),controller[_0x493d('0x9')]);router[_0x493d('0xa')](_0x493d('0x7'),auth['isAuthenticated'](),controller[_0x493d('0xb')]);router[_0x493d('0xc')]('/:id',auth[_0x493d('0x8')](),controller[_0x493d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 74d49d3..6aabb1a 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 _0x9797=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3a678e,_0x4d297c){var _0x2e62e7=function(_0x8cf1a9){while(--_0x8cf1a9){_0x3a678e['push'](_0x3a678e['shift']());}};_0x2e62e7(++_0x4d297c);}(_0x9797,0x1c9));var _0x7979=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x9797[_0x569caa];return _0x44cb5a;};'use strict';var Sequelize=require(_0x7979('0x0'));module[_0x7979('0x1')]={'name':{'type':Sequelize[_0x7979('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x7979('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf8cc=['exports','BOOLEAN','sequelize'];(function(_0x5a7593,_0x22207a){var _0x25b556=function(_0x155a73){while(--_0x155a73){_0x5a7593['push'](_0x5a7593['shift']());}};_0x25b556(++_0x22207a);}(_0xf8cc,0x173));var _0xcf8c=function(_0x388ccc,_0x2a24fd){_0x388ccc=_0x388ccc-0x0;var _0x570c20=_0xf8cc[_0x388ccc];return _0x570c20;};'use strict';var Sequelize=require(_0xcf8c('0x0'));module[_0xcf8c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xcf8c('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index dacc91f..b6ad9c9 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 _0x2119=['filter','merge','VIRTUAL','ChatGroup','includeAll','include','findAll','rows','catch','show','params','options','create','update','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','User','pick','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters'];(function(_0x39e5a8,_0x367273){var _0x5c9feb=function(_0x5a372e){while(--_0x5a372e){_0x39e5a8['push'](_0x39e5a8['shift']());}};_0x5c9feb(++_0x367273);}(_0x2119,0x84));var _0x9211=function(_0x121cd6,_0x213365){_0x121cd6=_0x121cd6-0x0;var _0x22447d=_0x2119[_0x121cd6];return _0x22447d;};'use strict';var emlformat=require(_0x9211('0x0'));var rimraf=require(_0x9211('0x1'));var zipdir=require(_0x9211('0x2'));var jsonpatch=require(_0x9211('0x3'));var rp=require('request-promise');var moment=require(_0x9211('0x4'));var BPromise=require(_0x9211('0x5'));var Mustache=require(_0x9211('0x6'));var util=require(_0x9211('0x7'));var path=require('path');var sox=require(_0x9211('0x8'));var csv=require('to-csv');var ejs=require(_0x9211('0x9'));var fs=require('fs');var fs_extra=require(_0x9211('0xa'));var _=require('lodash');var squel=require(_0x9211('0xb'));var crypto=require(_0x9211('0xc'));var jsforce=require(_0x9211('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9211('0xe'));var querystring=require(_0x9211('0xf'));var Papa=require(_0x9211('0x10'));var Redis=require(_0x9211('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9211('0x12'));var as=require(_0x9211('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9211('0x14'))(_0x9211('0x15'));var utils=require(_0x9211('0x16'));var config=require(_0x9211('0x17'));var licenseUtil=require(_0x9211('0x18'));var db=require(_0x9211('0x19'))['db'];config[_0x9211('0x1a')]=_['defaults'](config[_0x9211('0x1a')],{'host':_0x9211('0x1b'),'port':0x18eb});var socket=require(_0x9211('0x1c'))(new Redis(config[_0x9211('0x1a')]));require('./chatGroup.socket')[_0x9211('0x1d')](socket);function respondWithStatusCode(_0x490bdd,_0x3265b0){_0x3265b0=_0x3265b0||0xcc;return function(_0x10971b){if(_0x10971b){return _0x490bdd['sendStatus'](_0x3265b0);}return _0x490bdd[_0x9211('0x1e')](_0x3265b0)[_0x9211('0x1f')]();};}function respondWithResult(_0x4e0b19,_0x440b80){_0x440b80=_0x440b80||0xc8;return function(_0x43dc57){if(_0x43dc57){return _0x4e0b19[_0x9211('0x1e')](_0x440b80)['json'](_0x43dc57);}};}function respondWithFilteredResult(_0x3a053b,_0x56faa7){return function(_0x533ee4){if(_0x533ee4){var _0x333744=typeof _0x56faa7['offset']===_0x9211('0x20')&&typeof _0x56faa7[_0x9211('0x21')]===_0x9211('0x20');var _0x200fe4=_0x533ee4[_0x9211('0x22')];var _0xcff015=_0x333744?0x0:_0x56faa7[_0x9211('0x23')];var _0x446d92=_0x333744?_0x533ee4[_0x9211('0x22')]:_0x56faa7[_0x9211('0x23')]+_0x56faa7[_0x9211('0x21')];var _0x3b2552;if(_0x446d92>=_0x200fe4){_0x446d92=_0x200fe4;_0x3b2552=0xc8;}else{_0x3b2552=0xce;}_0x3a053b[_0x9211('0x1e')](_0x3b2552);return _0x3a053b['set'](_0x9211('0x24'),_0xcff015+'-'+_0x446d92+'/'+_0x200fe4)[_0x9211('0x25')](_0x533ee4);}return null;};}function patchUpdates(_0x4913bf){return function(_0x4b1844){try{jsonpatch[_0x9211('0x26')](_0x4b1844,_0x4913bf,!![]);}catch(_0x3f4d70){return BPromise[_0x9211('0x27')](_0x3f4d70);}return _0x4b1844[_0x9211('0x28')]();};}function saveUpdates(_0x25cc08,_0x54c874){return function(_0x34641c){if(_0x34641c){return _0x34641c['update'](_0x25cc08)[_0x9211('0x29')](function(_0x1dc428){return _0x1dc428;});}return null;};}function removeEntity(_0x247ab7,_0x589f5f){return function(_0x34a96b){if(_0x34a96b){return _0x34a96b[_0x9211('0x2a')]()[_0x9211('0x29')](function(){_0x247ab7[_0x9211('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50de42,_0x53931d){return function(_0x493f48){if(!_0x493f48){_0x50de42[_0x9211('0x2b')](0x194);}return _0x493f48;};}function handleError(_0x1977e5,_0x4d97f6){_0x4d97f6=_0x4d97f6||0x1f4;return function(_0x54c68a){logger[_0x9211('0x2c')](_0x54c68a[_0x9211('0x2d')]);if(_0x54c68a[_0x9211('0x2e')]){delete _0x54c68a[_0x9211('0x2e')];}_0x1977e5['status'](_0x4d97f6)[_0x9211('0x2f')](_0x54c68a);};}exports[_0x9211('0x30')]=function(_0x4c16f8,_0x44024b){var _0xf4c8af={},_0x415ca4={},_0x1dc9bb={'count':0x0,'rows':[]};var _0x282ecf=_[_0x9211('0x31')](db['ChatGroup'][_0x9211('0x32')],function(_0x4928da){return{'name':_0x4928da[_0x9211('0x33')],'type':_0x4928da[_0x9211('0x34')][_0x9211('0x35')]};});_0x415ca4[_0x9211('0x36')]=_[_0x9211('0x31')](_0x282ecf,_0x9211('0x2e'));_0x415ca4['query']=_[_0x9211('0x37')](_0x4c16f8['query']);_0x415ca4['filters']=_[_0x9211('0x38')](_0x415ca4[_0x9211('0x36')],_0x415ca4[_0x9211('0x39')]);_0xf4c8af[_0x9211('0x3a')]=_['intersection'](_0x415ca4[_0x9211('0x36')],qs['fields'](_0x4c16f8[_0x9211('0x39')][_0x9211('0x3b')]));_0xf4c8af[_0x9211('0x3a')]=_0xf4c8af[_0x9211('0x3a')][_0x9211('0x3c')]?_0xf4c8af[_0x9211('0x3a')]:_0x415ca4['model'];if(!_0x4c16f8[_0x9211('0x39')][_0x9211('0x3d')]('nolimit')){_0xf4c8af[_0x9211('0x21')]=qs[_0x9211('0x21')](_0x4c16f8[_0x9211('0x39')][_0x9211('0x21')]);_0xf4c8af[_0x9211('0x23')]=qs[_0x9211('0x23')](_0x4c16f8[_0x9211('0x39')][_0x9211('0x23')]);}_0xf4c8af[_0x9211('0x3e')]=qs[_0x9211('0x3f')](_0x4c16f8[_0x9211('0x39')][_0x9211('0x3f')]);_0xf4c8af[_0x9211('0x40')]=qs[_0x9211('0x41')](_['pick'](_0x4c16f8[_0x9211('0x39')],_0x415ca4[_0x9211('0x41')]),_0x282ecf);if(_0x4c16f8['query'][_0x9211('0x42')]){_0xf4c8af[_0x9211('0x40')]=_[_0x9211('0x43')](_0xf4c8af[_0x9211('0x40')],{'$or':_['map'](_0x282ecf,function(_0x4266a4){if(_0x4266a4[_0x9211('0x34')]!==_0x9211('0x44')){var _0x30eebf={};_0x30eebf[_0x4266a4[_0x9211('0x2e')]]={'$like':'%'+_0x4c16f8['query'][_0x9211('0x42')]+'%'};return _0x30eebf;}})});}_0xf4c8af=_[_0x9211('0x43')]({},_0xf4c8af,_0x4c16f8['options']);var _0x1b7a9d={'where':_0xf4c8af[_0x9211('0x40')]};return db[_0x9211('0x45')][_0x9211('0x22')](_0x1b7a9d)[_0x9211('0x29')](function(_0x73817d){_0x1dc9bb[_0x9211('0x22')]=_0x73817d;if(_0x4c16f8['query'][_0x9211('0x46')]){_0xf4c8af[_0x9211('0x47')]=[{'all':!![]}];}return db[_0x9211('0x45')][_0x9211('0x48')](_0xf4c8af);})[_0x9211('0x29')](function(_0x46a2bf){_0x1dc9bb[_0x9211('0x49')]=_0x46a2bf;return _0x1dc9bb;})[_0x9211('0x29')](respondWithFilteredResult(_0x44024b,_0xf4c8af))[_0x9211('0x4a')](handleError(_0x44024b,null));};exports[_0x9211('0x4b')]=function(_0x58f61a,_0x3bbbc2){var _0x398ee5={'raw':!![],'where':{'id':_0x58f61a[_0x9211('0x4c')]['id']}},_0x318c4e={};_0x318c4e[_0x9211('0x36')]=_[_0x9211('0x37')](db['ChatGroup'][_0x9211('0x32')]);_0x318c4e['query']=_[_0x9211('0x37')](_0x58f61a[_0x9211('0x39')]);_0x318c4e[_0x9211('0x41')]=_[_0x9211('0x38')](_0x318c4e['model'],_0x318c4e[_0x9211('0x39')]);_0x398ee5['attributes']=_[_0x9211('0x38')](_0x318c4e[_0x9211('0x36')],qs[_0x9211('0x3b')](_0x58f61a[_0x9211('0x39')][_0x9211('0x3b')]));_0x398ee5[_0x9211('0x3a')]=_0x398ee5[_0x9211('0x3a')][_0x9211('0x3c')]?_0x398ee5[_0x9211('0x3a')]:_0x318c4e[_0x9211('0x36')];if(_0x58f61a[_0x9211('0x39')][_0x9211('0x46')]){_0x398ee5[_0x9211('0x47')]=[{'all':!![]}];}_0x398ee5=_[_0x9211('0x43')]({},_0x398ee5,_0x58f61a[_0x9211('0x4d')]);return db[_0x9211('0x45')]['find'](_0x398ee5)[_0x9211('0x29')](handleEntityNotFound(_0x3bbbc2,null))[_0x9211('0x29')](respondWithResult(_0x3bbbc2,null))[_0x9211('0x4a')](handleError(_0x3bbbc2,null));};exports[_0x9211('0x4e')]=function(_0x211562,_0x5e0202){return db['ChatGroup'][_0x9211('0x4e')](_0x211562['body'],{})[_0x9211('0x29')](respondWithResult(_0x5e0202,0xc9))['catch'](handleError(_0x5e0202,null));};exports[_0x9211('0x4f')]=function(_0x19432b,_0x353791){if(_0x19432b[_0x9211('0x50')]['id']){delete _0x19432b[_0x9211('0x50')]['id'];}return db['ChatGroup'][_0x9211('0x51')]({'where':{'id':_0x19432b[_0x9211('0x4c')]['id']}})[_0x9211('0x29')](handleEntityNotFound(_0x353791,null))[_0x9211('0x29')](saveUpdates(_0x19432b['body'],null))[_0x9211('0x29')](respondWithResult(_0x353791,null))[_0x9211('0x4a')](handleError(_0x353791,null));};exports[_0x9211('0x2a')]=function(_0x2d4cb4,_0x4f5dea){return db[_0x9211('0x45')][_0x9211('0x51')]({'where':{'id':_0x2d4cb4['params']['id']}})[_0x9211('0x29')](handleEntityNotFound(_0x4f5dea,null))['then'](removeEntity(_0x4f5dea,null))['catch'](handleError(_0x4f5dea,null));};exports[_0x9211('0x52')]=function(_0x29577d,_0x31df8a){return db[_0x9211('0x45')]['describe']()[_0x9211('0x29')](respondWithResult(_0x31df8a,null))['catch'](handleError(_0x31df8a,null));};exports[_0x9211('0x53')]=function(_0x28140d,_0x584189,_0x486c95){return db[_0x9211('0x54')]['count']({'where':{'ChatGroupId':_0x28140d[_0x9211('0x4c')]['id'],'ToId':_0x28140d['user']['id'],'read':![]}})[_0x9211('0x29')](function(_0x11eba1){return{'id':_[_0x9211('0x55')](_0x28140d[_0x9211('0x4c')]['id']),'count':_0x11eba1};})['then'](respondWithResult(_0x584189,null))[_0x9211('0x4a')](handleError(_0x584189,null));};exports[_0x9211('0x56')]=function(_0x3e3873,_0x3c876c,_0x18384a){return db[_0x9211('0x45')]['find']({'where':{'id':_0x3e3873[_0x9211('0x4c')]['id']}})[_0x9211('0x29')](handleEntityNotFound(_0x3c876c,null))['then'](function(_0x512f6c){if(_0x512f6c){return _0x512f6c['addMembers'](_0x3e3873['body'][_0x9211('0x57')],_[_0x9211('0x58')](_0x3e3873['body'],[_0x9211('0x57'),'id'])||{});}})[_0x9211('0x29')](respondWithResult(_0x3c876c,null))['catch'](handleError(_0x3c876c,null));};exports[_0x9211('0x59')]=function(_0x3fa74a,_0x49fe75,_0x539a00){var _0x4991a5={};var _0x50a957={};var _0x1b5841;var _0x4401a3;return db[_0x9211('0x45')]['findOne']({'where':{'id':_0x3fa74a[_0x9211('0x4c')]['id']}})[_0x9211('0x29')](handleEntityNotFound(_0x49fe75,null))[_0x9211('0x29')](function(_0x1b6dda){if(_0x1b6dda){_0x1b5841=_0x1b6dda;_0x50a957[_0x9211('0x36')]=_['keys'](db[_0x9211('0x5a')][_0x9211('0x32')]);_0x50a957[_0x9211('0x39')]=_[_0x9211('0x37')](_0x3fa74a['query']);_0x50a957[_0x9211('0x41')]=_[_0x9211('0x38')](_0x50a957[_0x9211('0x36')],_0x50a957[_0x9211('0x39')]);_0x4991a5['attributes']=_['intersection'](_0x50a957[_0x9211('0x36')],qs[_0x9211('0x3b')](_0x3fa74a[_0x9211('0x39')][_0x9211('0x3b')]));_0x4991a5['attributes']=_0x4991a5[_0x9211('0x3a')][_0x9211('0x3c')]?_0x4991a5[_0x9211('0x3a')]:_0x50a957['model'];_0x4991a5[_0x9211('0x3e')]=qs['sort'](_0x3fa74a['query'][_0x9211('0x3f')]);_0x4991a5[_0x9211('0x40')]=qs[_0x9211('0x41')](_[_0x9211('0x5b')](_0x3fa74a['query'],_0x50a957[_0x9211('0x41')]));if(_0x3fa74a[_0x9211('0x39')][_0x9211('0x42')]){_0x4991a5[_0x9211('0x40')]=_['merge'](_0x4991a5['where'],{'$or':_[_0x9211('0x31')](_0x4991a5[_0x9211('0x3a')],function(_0x284e9a){var _0x3822c7={};_0x3822c7[_0x284e9a]={'$like':'%'+_0x3fa74a[_0x9211('0x39')]['filter']+'%'};return _0x3822c7;})});}_0x4991a5=_['merge']({},_0x4991a5,_0x3fa74a[_0x9211('0x4d')]);return _0x1b5841[_0x9211('0x59')](_0x4991a5);}})[_0x9211('0x29')](function(_0x5cbbca){if(_0x5cbbca){_0x4401a3=_0x5cbbca[_0x9211('0x3c')];if(!_0x3fa74a[_0x9211('0x39')][_0x9211('0x3d')](_0x9211('0x5c'))){_0x4991a5['limit']=qs[_0x9211('0x21')](_0x3fa74a[_0x9211('0x39')]['limit']);_0x4991a5[_0x9211('0x23')]=qs[_0x9211('0x23')](_0x3fa74a[_0x9211('0x39')][_0x9211('0x23')]);}return _0x1b5841[_0x9211('0x59')](_0x4991a5);}})[_0x9211('0x29')](function(_0x4f4cef){if(_0x4f4cef){return _0x4f4cef?{'count':_0x4401a3,'rows':_0x4f4cef}:null;}})[_0x9211('0x29')](respondWithResult(_0x49fe75,null))[_0x9211('0x4a')](handleError(_0x49fe75,null));};exports['removeMembers']=function(_0x145e3f,_0xfad191,_0x46375a){return db[_0x9211('0x45')][_0x9211('0x51')]({'where':{'id':_0x145e3f[_0x9211('0x4c')]['id']}})[_0x9211('0x29')](handleEntityNotFound(_0xfad191,null))[_0x9211('0x29')](function(_0x30fdfa){if(_0x30fdfa){return _0x30fdfa[_0x9211('0x5d')](_0x145e3f[_0x9211('0x39')]['ids']);}})[_0x9211('0x29')](respondWithStatusCode(_0xfad191,null))[_0x9211('0x4a')](handleError(_0xfad191,null));};exports[_0x9211('0x5e')]=function(_0x2af81b,_0x253864,_0x3aa816){if(_0x2af81b[_0x9211('0x50')]['id']){delete _0x2af81b[_0x9211('0x50')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x2af81b[_0x9211('0x4c')]['id']}})[_0x9211('0x29')](handleEntityNotFound(_0x253864,null))['then'](function(_0x24beeb){if(_0x24beeb){_0x2af81b[_0x9211('0x50')][_0x9211('0x5f')]=_0x24beeb['id'];return db['ChatInternalMessage'][_0x9211('0x4e')](_0x2af81b[_0x9211('0x50')]);}})['then'](respondWithResult(_0x253864,null))[_0x9211('0x4a')](handleError(_0x253864,null));};exports[_0x9211('0x60')]=function(_0x2e0bbf,_0x6730f5,_0x4ac97b){var _0x2d0206={};var _0xf44578={};var _0x99cb6e;var _0x2b881b;return db[_0x9211('0x45')]['findOne']({'where':{'id':_0x2e0bbf['params']['id']}})['then'](handleEntityNotFound(_0x6730f5,null))[_0x9211('0x29')](function(_0x3a6217){if(_0x3a6217){_0x99cb6e=_0x3a6217;_0xf44578['model']=_[_0x9211('0x37')](db[_0x9211('0x54')]['rawAttributes']);_0xf44578[_0x9211('0x39')]=_[_0x9211('0x37')](_0x2e0bbf[_0x9211('0x39')]);_0xf44578[_0x9211('0x41')]=_[_0x9211('0x38')](_0xf44578[_0x9211('0x36')],_0xf44578[_0x9211('0x39')]);_0x2d0206[_0x9211('0x3a')]=_['intersection'](_0xf44578[_0x9211('0x36')],qs['fields'](_0x2e0bbf[_0x9211('0x39')][_0x9211('0x3b')]));_0x2d0206['attributes']=_0x2d0206[_0x9211('0x3a')][_0x9211('0x3c')]?_0x2d0206[_0x9211('0x3a')]:_0xf44578[_0x9211('0x36')];_0x2d0206['order']=qs[_0x9211('0x3f')](_0x2e0bbf[_0x9211('0x39')][_0x9211('0x3f')]);_0x2d0206[_0x9211('0x40')]=qs[_0x9211('0x41')](_[_0x9211('0x5b')](_0x2e0bbf['query'],_0xf44578[_0x9211('0x41')]));if(_0x2e0bbf[_0x9211('0x39')]['filter']){_0x2d0206['where']=_[_0x9211('0x43')](_0x2d0206[_0x9211('0x40')],{'$or':_[_0x9211('0x31')](_0x2d0206['attributes'],function(_0x5c3e00){var _0x491244={};_0x491244[_0x5c3e00]={'$like':'%'+_0x2e0bbf[_0x9211('0x39')]['filter']+'%'};return _0x491244;})});}if(_0x2e0bbf['query'][_0x9211('0x61')]){var _0x591c63=_0x2e0bbf['query'][_0x9211('0x61')]['split'](',');var _0x2ebb42={};_0x2ebb42[_0x591c63[0x0]]={'$gte':moment(_0x591c63[0x1])['format'](_0x9211('0x62'))};_0x2d0206[_0x9211('0x40')]=_['merge'](_0x2d0206['where'],_0x2ebb42);}_0x2d0206=_[_0x9211('0x43')]({},_0x2d0206,_0x2e0bbf[_0x9211('0x4d')]);return _0x99cb6e[_0x9211('0x60')](_0x2d0206);}})['then'](function(_0x4d972c){if(_0x4d972c){_0x2b881b=_0x4d972c['length'];if(!_0x2e0bbf[_0x9211('0x39')][_0x9211('0x3d')](_0x9211('0x5c'))){_0x2d0206[_0x9211('0x21')]=qs[_0x9211('0x21')](_0x2e0bbf[_0x9211('0x39')][_0x9211('0x21')]);_0x2d0206['offset']=qs['offset'](_0x2e0bbf[_0x9211('0x39')]['offset']);}return _0x99cb6e['getMessages'](_0x2d0206);}})[_0x9211('0x29')](function(_0x498173){if(_0x498173){return _0x498173?{'count':_0x2b881b,'rows':_0x498173}:null;}})[_0x9211('0x29')](respondWithResult(_0x6730f5,null))[_0x9211('0x4a')](handleError(_0x6730f5,null));}; \ No newline at end of file +var _0x764b=['type','VIRTUAL','includeAll','include','catch','show','params','options','create','body','find','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','User','nolimit','removeMembers','addMessage','getMessages','findOne','$gte','split','format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','index','map','ChatGroup','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where'];(function(_0x3e2c12,_0x908854){var _0x24a416=function(_0x1773f8){while(--_0x1773f8){_0x3e2c12['push'](_0x3e2c12['shift']());}};_0x24a416(++_0x908854);}(_0x764b,0x7a));var _0xb764=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x764b[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb764('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb764('0x1'));var rp=require(_0xb764('0x2'));var moment=require(_0xb764('0x3'));var BPromise=require(_0xb764('0x4'));var Mustache=require(_0xb764('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb764('0x6'));var csv=require(_0xb764('0x7'));var ejs=require(_0xb764('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb764('0x9'));var crypto=require(_0xb764('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb764('0xb'));var Papa=require('papaparse');var Redis=require(_0xb764('0xc'));var authService=require(_0xb764('0xd'));var qs=require(_0xb764('0xe'));var as=require(_0xb764('0xf'));var hardwareService=require(_0xb764('0x10'));var logger=require(_0xb764('0x11'))(_0xb764('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb764('0x13'));var db=require(_0xb764('0x14'))['db'];config[_0xb764('0x15')]=_[_0xb764('0x16')](config[_0xb764('0x15')],{'host':_0xb764('0x17'),'port':0x18eb});var socket=require(_0xb764('0x18'))(new Redis(config[_0xb764('0x15')]));require(_0xb764('0x19'))['register'](socket);function respondWithStatusCode(_0x399675,_0x5d8b1f){_0x5d8b1f=_0x5d8b1f||0xcc;return function(_0xac3055){if(_0xac3055){return _0x399675[_0xb764('0x1a')](_0x5d8b1f);}return _0x399675[_0xb764('0x1b')](_0x5d8b1f)['end']();};}function respondWithResult(_0x2f6224,_0xa1565b){_0xa1565b=_0xa1565b||0xc8;return function(_0x152b46){if(_0x152b46){return _0x2f6224[_0xb764('0x1b')](_0xa1565b)[_0xb764('0x1c')](_0x152b46);}};}function respondWithFilteredResult(_0xa17894,_0x435d21){return function(_0x925be1){if(_0x925be1){var _0x7ae6a8=typeof _0x435d21[_0xb764('0x1d')]===_0xb764('0x1e')&&typeof _0x435d21['limit']===_0xb764('0x1e');var _0x65598b=_0x925be1[_0xb764('0x1f')];var _0x569c3b=_0x7ae6a8?0x0:_0x435d21[_0xb764('0x1d')];var _0x32f274=_0x7ae6a8?_0x925be1[_0xb764('0x1f')]:_0x435d21[_0xb764('0x1d')]+_0x435d21[_0xb764('0x20')];var _0x571d9d;if(_0x32f274>=_0x65598b){_0x32f274=_0x65598b;_0x571d9d=0xc8;}else{_0x571d9d=0xce;}_0xa17894[_0xb764('0x1b')](_0x571d9d);return _0xa17894[_0xb764('0x21')](_0xb764('0x22'),_0x569c3b+'-'+_0x32f274+'/'+_0x65598b)[_0xb764('0x1c')](_0x925be1);}return null;};}function patchUpdates(_0x1f196a){return function(_0xc69d19){try{jsonpatch['apply'](_0xc69d19,_0x1f196a,!![]);}catch(_0x4e40d8){return BPromise[_0xb764('0x23')](_0x4e40d8);}return _0xc69d19[_0xb764('0x24')]();};}function saveUpdates(_0x47ad4e,_0x394e4e){return function(_0x2ecaf0){if(_0x2ecaf0){return _0x2ecaf0[_0xb764('0x25')](_0x47ad4e)[_0xb764('0x26')](function(_0x46cd72){return _0x46cd72;});}return null;};}function removeEntity(_0x1a1826,_0x1a0578){return function(_0x4edb9d){if(_0x4edb9d){return _0x4edb9d['destroy']()[_0xb764('0x26')](function(){_0x1a1826[_0xb764('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5491db,_0x35f4e0){return function(_0x16d05b){if(!_0x16d05b){_0x5491db[_0xb764('0x1a')](0x194);}return _0x16d05b;};}function handleError(_0x3e3661,_0x33b0fc){_0x33b0fc=_0x33b0fc||0x1f4;return function(_0x3b8773){logger[_0xb764('0x27')](_0x3b8773['stack']);if(_0x3b8773[_0xb764('0x28')]){delete _0x3b8773[_0xb764('0x28')];}_0x3e3661[_0xb764('0x1b')](_0x33b0fc)['send'](_0x3b8773);};}exports[_0xb764('0x29')]=function(_0x5594cf,_0x4a6003){var _0x5c7ac8={},_0x5ba4c8={},_0x5e4ba5={'count':0x0,'rows':[]};var _0x36955d=_[_0xb764('0x2a')](db[_0xb764('0x2b')][_0xb764('0x2c')],function(_0xba1d98){return{'name':_0xba1d98[_0xb764('0x2d')],'type':_0xba1d98['type'][_0xb764('0x2e')]};});_0x5ba4c8['model']=_[_0xb764('0x2a')](_0x36955d,_0xb764('0x28'));_0x5ba4c8[_0xb764('0x2f')]=_[_0xb764('0x30')](_0x5594cf[_0xb764('0x2f')]);_0x5ba4c8[_0xb764('0x31')]=_[_0xb764('0x32')](_0x5ba4c8['model'],_0x5ba4c8[_0xb764('0x2f')]);_0x5c7ac8[_0xb764('0x33')]=_[_0xb764('0x32')](_0x5ba4c8[_0xb764('0x34')],qs[_0xb764('0x35')](_0x5594cf[_0xb764('0x2f')]['fields']));_0x5c7ac8[_0xb764('0x33')]=_0x5c7ac8[_0xb764('0x33')][_0xb764('0x36')]?_0x5c7ac8[_0xb764('0x33')]:_0x5ba4c8[_0xb764('0x34')];if(!_0x5594cf[_0xb764('0x2f')][_0xb764('0x37')]('nolimit')){_0x5c7ac8[_0xb764('0x20')]=qs[_0xb764('0x20')](_0x5594cf[_0xb764('0x2f')]['limit']);_0x5c7ac8['offset']=qs[_0xb764('0x1d')](_0x5594cf[_0xb764('0x2f')][_0xb764('0x1d')]);}_0x5c7ac8[_0xb764('0x38')]=qs[_0xb764('0x39')](_0x5594cf[_0xb764('0x2f')]['sort']);_0x5c7ac8['where']=qs['filters'](_[_0xb764('0x3a')](_0x5594cf[_0xb764('0x2f')],_0x5ba4c8[_0xb764('0x31')]),_0x36955d);if(_0x5594cf[_0xb764('0x2f')][_0xb764('0x3b')]){_0x5c7ac8['where']=_[_0xb764('0x3c')](_0x5c7ac8[_0xb764('0x3d')],{'$or':_[_0xb764('0x2a')](_0x36955d,function(_0x1ceed1){if(_0x1ceed1[_0xb764('0x3e')]!==_0xb764('0x3f')){var _0x878a8d={};_0x878a8d[_0x1ceed1[_0xb764('0x28')]]={'$like':'%'+_0x5594cf['query'][_0xb764('0x3b')]+'%'};return _0x878a8d;}})});}_0x5c7ac8=_['merge']({},_0x5c7ac8,_0x5594cf['options']);var _0x19856e={'where':_0x5c7ac8[_0xb764('0x3d')]};return db[_0xb764('0x2b')][_0xb764('0x1f')](_0x19856e)[_0xb764('0x26')](function(_0x520773){_0x5e4ba5[_0xb764('0x1f')]=_0x520773;if(_0x5594cf[_0xb764('0x2f')][_0xb764('0x40')]){_0x5c7ac8[_0xb764('0x41')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x5c7ac8);})[_0xb764('0x26')](function(_0x5e57ca){_0x5e4ba5['rows']=_0x5e57ca;return _0x5e4ba5;})[_0xb764('0x26')](respondWithFilteredResult(_0x4a6003,_0x5c7ac8))[_0xb764('0x42')](handleError(_0x4a6003,null));};exports[_0xb764('0x43')]=function(_0x4766d2,_0x5bcbb1){var _0x1b34ae={'raw':!![],'where':{'id':_0x4766d2[_0xb764('0x44')]['id']}},_0x4ff8cc={};_0x4ff8cc[_0xb764('0x34')]=_[_0xb764('0x30')](db['ChatGroup'][_0xb764('0x2c')]);_0x4ff8cc[_0xb764('0x2f')]=_[_0xb764('0x30')](_0x4766d2[_0xb764('0x2f')]);_0x4ff8cc['filters']=_[_0xb764('0x32')](_0x4ff8cc[_0xb764('0x34')],_0x4ff8cc[_0xb764('0x2f')]);_0x1b34ae[_0xb764('0x33')]=_['intersection'](_0x4ff8cc['model'],qs[_0xb764('0x35')](_0x4766d2[_0xb764('0x2f')][_0xb764('0x35')]));_0x1b34ae[_0xb764('0x33')]=_0x1b34ae['attributes'][_0xb764('0x36')]?_0x1b34ae['attributes']:_0x4ff8cc[_0xb764('0x34')];if(_0x4766d2[_0xb764('0x2f')][_0xb764('0x40')]){_0x1b34ae['include']=[{'all':!![]}];}_0x1b34ae=_[_0xb764('0x3c')]({},_0x1b34ae,_0x4766d2[_0xb764('0x45')]);return db[_0xb764('0x2b')]['find'](_0x1b34ae)[_0xb764('0x26')](handleEntityNotFound(_0x5bcbb1,null))['then'](respondWithResult(_0x5bcbb1,null))[_0xb764('0x42')](handleError(_0x5bcbb1,null));};exports[_0xb764('0x46')]=function(_0x18068f,_0x2bc80d){return db[_0xb764('0x2b')][_0xb764('0x46')](_0x18068f[_0xb764('0x47')],{})[_0xb764('0x26')](respondWithResult(_0x2bc80d,0xc9))[_0xb764('0x42')](handleError(_0x2bc80d,null));};exports['update']=function(_0x1c1982,_0x259e8b){if(_0x1c1982[_0xb764('0x47')]['id']){delete _0x1c1982['body']['id'];}return db['ChatGroup'][_0xb764('0x48')]({'where':{'id':_0x1c1982['params']['id']}})[_0xb764('0x26')](handleEntityNotFound(_0x259e8b,null))['then'](saveUpdates(_0x1c1982[_0xb764('0x47')],null))[_0xb764('0x26')](respondWithResult(_0x259e8b,null))[_0xb764('0x42')](handleError(_0x259e8b,null));};exports[_0xb764('0x49')]=function(_0x5c794c,_0x569835){return db[_0xb764('0x2b')][_0xb764('0x48')]({'where':{'id':_0x5c794c[_0xb764('0x44')]['id']}})['then'](handleEntityNotFound(_0x569835,null))['then'](removeEntity(_0x569835,null))[_0xb764('0x42')](handleError(_0x569835,null));};exports[_0xb764('0x4a')]=function(_0x2fd9b5,_0x24da2f){return db[_0xb764('0x2b')][_0xb764('0x4a')]()['then'](respondWithResult(_0x24da2f,null))[_0xb764('0x42')](handleError(_0x24da2f,null));};exports[_0xb764('0x4b')]=function(_0x2b8f5b,_0xca6200,_0x43b6a4){return db[_0xb764('0x4c')][_0xb764('0x1f')]({'where':{'ChatGroupId':_0x2b8f5b['params']['id'],'ToId':_0x2b8f5b[_0xb764('0x4d')]['id'],'read':![]}})['then'](function(_0x4117c6){return{'id':_[_0xb764('0x4e')](_0x2b8f5b[_0xb764('0x44')]['id']),'count':_0x4117c6};})[_0xb764('0x26')](respondWithResult(_0xca6200,null))[_0xb764('0x42')](handleError(_0xca6200,null));};exports[_0xb764('0x4f')]=function(_0x43d097,_0x5499a6,_0x2afbb3){return db[_0xb764('0x2b')]['find']({'where':{'id':_0x43d097['params']['id']}})['then'](handleEntityNotFound(_0x5499a6,null))[_0xb764('0x26')](function(_0x3696fb){if(_0x3696fb){return _0x3696fb['addMembers'](_0x43d097[_0xb764('0x47')][_0xb764('0x50')],_[_0xb764('0x51')](_0x43d097[_0xb764('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0x5499a6,null))[_0xb764('0x42')](handleError(_0x5499a6,null));};exports[_0xb764('0x52')]=function(_0x41ab8c,_0x4990a3,_0x5c6a9a){var _0xc7adf8={};var _0x37316e={};var _0x39dbae;var _0xd4880;return db[_0xb764('0x2b')]['findOne']({'where':{'id':_0x41ab8c[_0xb764('0x44')]['id']}})['then'](handleEntityNotFound(_0x4990a3,null))['then'](function(_0x53b9b2){if(_0x53b9b2){_0x39dbae=_0x53b9b2;_0x37316e[_0xb764('0x34')]=_[_0xb764('0x30')](db[_0xb764('0x53')][_0xb764('0x2c')]);_0x37316e[_0xb764('0x2f')]=_[_0xb764('0x30')](_0x41ab8c[_0xb764('0x2f')]);_0x37316e[_0xb764('0x31')]=_['intersection'](_0x37316e[_0xb764('0x34')],_0x37316e[_0xb764('0x2f')]);_0xc7adf8[_0xb764('0x33')]=_[_0xb764('0x32')](_0x37316e['model'],qs[_0xb764('0x35')](_0x41ab8c[_0xb764('0x2f')][_0xb764('0x35')]));_0xc7adf8[_0xb764('0x33')]=_0xc7adf8['attributes'][_0xb764('0x36')]?_0xc7adf8[_0xb764('0x33')]:_0x37316e['model'];_0xc7adf8[_0xb764('0x38')]=qs[_0xb764('0x39')](_0x41ab8c['query'][_0xb764('0x39')]);_0xc7adf8[_0xb764('0x3d')]=qs[_0xb764('0x31')](_[_0xb764('0x3a')](_0x41ab8c[_0xb764('0x2f')],_0x37316e[_0xb764('0x31')]));if(_0x41ab8c[_0xb764('0x2f')]['filter']){_0xc7adf8[_0xb764('0x3d')]=_[_0xb764('0x3c')](_0xc7adf8[_0xb764('0x3d')],{'$or':_[_0xb764('0x2a')](_0xc7adf8[_0xb764('0x33')],function(_0x4a2619){var _0x4f8a87={};_0x4f8a87[_0x4a2619]={'$like':'%'+_0x41ab8c[_0xb764('0x2f')]['filter']+'%'};return _0x4f8a87;})});}_0xc7adf8=_[_0xb764('0x3c')]({},_0xc7adf8,_0x41ab8c[_0xb764('0x45')]);return _0x39dbae[_0xb764('0x52')](_0xc7adf8);}})[_0xb764('0x26')](function(_0x3280c4){if(_0x3280c4){_0xd4880=_0x3280c4[_0xb764('0x36')];if(!_0x41ab8c[_0xb764('0x2f')][_0xb764('0x37')](_0xb764('0x54'))){_0xc7adf8['limit']=qs[_0xb764('0x20')](_0x41ab8c[_0xb764('0x2f')][_0xb764('0x20')]);_0xc7adf8['offset']=qs[_0xb764('0x1d')](_0x41ab8c['query'][_0xb764('0x1d')]);}return _0x39dbae[_0xb764('0x52')](_0xc7adf8);}})[_0xb764('0x26')](function(_0x147ed9){if(_0x147ed9){return _0x147ed9?{'count':_0xd4880,'rows':_0x147ed9}:null;}})['then'](respondWithResult(_0x4990a3,null))['catch'](handleError(_0x4990a3,null));};exports[_0xb764('0x55')]=function(_0x52842c,_0x197561,_0x36ac18){return db['ChatGroup'][_0xb764('0x48')]({'where':{'id':_0x52842c[_0xb764('0x44')]['id']}})[_0xb764('0x26')](handleEntityNotFound(_0x197561,null))[_0xb764('0x26')](function(_0x85e345){if(_0x85e345){return _0x85e345[_0xb764('0x55')](_0x52842c[_0xb764('0x2f')][_0xb764('0x50')]);}})[_0xb764('0x26')](respondWithStatusCode(_0x197561,null))[_0xb764('0x42')](handleError(_0x197561,null));};exports[_0xb764('0x56')]=function(_0x5f25e0,_0x5c2758,_0x4d0ec6){if(_0x5f25e0[_0xb764('0x47')]['id']){delete _0x5f25e0['body']['id'];}return db[_0xb764('0x2b')][_0xb764('0x48')]({'where':{'id':_0x5f25e0[_0xb764('0x44')]['id']}})[_0xb764('0x26')](handleEntityNotFound(_0x5c2758,null))[_0xb764('0x26')](function(_0x3e0e7e){if(_0x3e0e7e){_0x5f25e0[_0xb764('0x47')]['ChatGroupId']=_0x3e0e7e['id'];return db[_0xb764('0x4c')][_0xb764('0x46')](_0x5f25e0['body']);}})[_0xb764('0x26')](respondWithResult(_0x5c2758,null))['catch'](handleError(_0x5c2758,null));};exports[_0xb764('0x57')]=function(_0x3c586b,_0x545aae,_0x5d31f7){var _0x1506ad={};var _0x25b142={};var _0x587cf3;var _0xecad54;return db[_0xb764('0x2b')][_0xb764('0x58')]({'where':{'id':_0x3c586b[_0xb764('0x44')]['id']}})['then'](handleEntityNotFound(_0x545aae,null))[_0xb764('0x26')](function(_0x319c2f){if(_0x319c2f){_0x587cf3=_0x319c2f;_0x25b142[_0xb764('0x34')]=_[_0xb764('0x30')](db[_0xb764('0x4c')][_0xb764('0x2c')]);_0x25b142[_0xb764('0x2f')]=_[_0xb764('0x30')](_0x3c586b[_0xb764('0x2f')]);_0x25b142[_0xb764('0x31')]=_[_0xb764('0x32')](_0x25b142[_0xb764('0x34')],_0x25b142[_0xb764('0x2f')]);_0x1506ad[_0xb764('0x33')]=_[_0xb764('0x32')](_0x25b142[_0xb764('0x34')],qs[_0xb764('0x35')](_0x3c586b[_0xb764('0x2f')]['fields']));_0x1506ad[_0xb764('0x33')]=_0x1506ad[_0xb764('0x33')][_0xb764('0x36')]?_0x1506ad[_0xb764('0x33')]:_0x25b142[_0xb764('0x34')];_0x1506ad[_0xb764('0x38')]=qs[_0xb764('0x39')](_0x3c586b[_0xb764('0x2f')][_0xb764('0x39')]);_0x1506ad[_0xb764('0x3d')]=qs[_0xb764('0x31')](_['pick'](_0x3c586b[_0xb764('0x2f')],_0x25b142['filters']));if(_0x3c586b[_0xb764('0x2f')][_0xb764('0x3b')]){_0x1506ad[_0xb764('0x3d')]=_[_0xb764('0x3c')](_0x1506ad[_0xb764('0x3d')],{'$or':_[_0xb764('0x2a')](_0x1506ad[_0xb764('0x33')],function(_0x18324b){var _0x5195c6={};_0x5195c6[_0x18324b]={'$like':'%'+_0x3c586b['query'][_0xb764('0x3b')]+'%'};return _0x5195c6;})});}if(_0x3c586b[_0xb764('0x2f')]['$gte']){var _0x40f18c=_0x3c586b['query'][_0xb764('0x59')][_0xb764('0x5a')](',');var _0x35889a={};_0x35889a[_0x40f18c[0x0]]={'$gte':moment(_0x40f18c[0x1])[_0xb764('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1506ad[_0xb764('0x3d')]=_[_0xb764('0x3c')](_0x1506ad[_0xb764('0x3d')],_0x35889a);}_0x1506ad=_[_0xb764('0x3c')]({},_0x1506ad,_0x3c586b['options']);return _0x587cf3[_0xb764('0x57')](_0x1506ad);}})['then'](function(_0x4ba66a){if(_0x4ba66a){_0xecad54=_0x4ba66a[_0xb764('0x36')];if(!_0x3c586b['query'][_0xb764('0x37')](_0xb764('0x54'))){_0x1506ad['limit']=qs[_0xb764('0x20')](_0x3c586b['query'][_0xb764('0x20')]);_0x1506ad[_0xb764('0x1d')]=qs['offset'](_0x3c586b[_0xb764('0x2f')][_0xb764('0x1d')]);}return _0x587cf3[_0xb764('0x57')](_0x1506ad);}})[_0xb764('0x26')](function(_0xac812a){if(_0xac812a){return _0xac812a?{'count':_0xecad54,'rows':_0xac812a}:null;}})[_0xb764('0x26')](respondWithResult(_0x545aae,null))['catch'](handleError(_0x545aae,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4f3a847..282fca5 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 _0xa8cb=['hasOwnProperty','exports','events','../../mysqldb','save','update','emit'];(function(_0x39fd8b,_0x42d96e){var _0x273ecc=function(_0x5d8cba){while(--_0x5d8cba){_0x39fd8b['push'](_0x39fd8b['shift']());}};_0x273ecc(++_0x42d96e);}(_0xa8cb,0x1de));var _0xba8c=function(_0x135051,_0x1a4262){_0x135051=_0x135051-0x0;var _0x5845cb=_0xa8cb[_0x135051];return _0x5845cb;};'use strict';var EventEmitter=require(_0xba8c('0x0'));var ChatGroup=require(_0xba8c('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xba8c('0x2'),'afterUpdate':_0xba8c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x440c80){return function(_0x2e14c5,_0x240f3e,_0x401d89){ChatGroupEvents[_0xba8c('0x4')](_0x440c80+':'+_0x2e14c5['id'],_0x2e14c5);ChatGroupEvents['emit'](_0x440c80,_0x2e14c5);_0x401d89(null);};}for(var e in events){if(events[_0xba8c('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xba8c('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xfba2=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3272b0,_0x51ed45){var _0x4daf85=function(_0x45f540){while(--_0x45f540){_0x3272b0['push'](_0x3272b0['shift']());}};_0x4daf85(++_0x51ed45);}(_0xfba2,0xf9));var _0x2fba=function(_0x183609,_0x520ef4){_0x183609=_0x183609-0x0;var _0x47c03c=_0xfba2[_0x183609];return _0x47c03c;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2fba('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2fba('0x1')](0x0);var events={'afterCreate':_0x2fba('0x2'),'afterUpdate':_0x2fba('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2db851){return function(_0x3eef22,_0x233e9c,_0x16c6ed){ChatGroupEvents[_0x2fba('0x4')](_0x2db851+':'+_0x3eef22['id'],_0x3eef22);ChatGroupEvents['emit'](_0x2db851,_0x3eef22);_0x16c6ed(null);};}for(var e in events){if(events[_0x2fba('0x5')](e)){var event=events[e];ChatGroup[_0x2fba('0x6')](e,emitEvent(event));}}module[_0x2fba('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index fc84d16..bdd90d5 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 _0x25d4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','lodash','util'];(function(_0x1162d6,_0x860ab7){var _0x41648=function(_0x3ef6c9){while(--_0x3ef6c9){_0x1162d6['push'](_0x1162d6['shift']());}};_0x41648(++_0x860ab7);}(_0x25d4,0x172));var _0x425d=function(_0x238e2d,_0x3398c1){_0x238e2d=_0x238e2d-0x0;var _0x28e7d7=_0x25d4[_0x238e2d];return _0x28e7d7;};'use strict';var _=require(_0x425d('0x0'));var util=require(_0x425d('0x1'));var logger=require(_0x425d('0x2'))(_0x425d('0x3'));var moment=require(_0x425d('0x4'));var BPromise=require(_0x425d('0x5'));var rp=require(_0x425d('0x6'));var fs=require('fs');var path=require(_0x425d('0x7'));var rimraf=require(_0x425d('0x8'));var config=require(_0x425d('0x9'));var attributes=require(_0x425d('0xa'));module['exports']=function(_0x53819a,_0x530382){return _0x53819a[_0x425d('0xb')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf378=['path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','api','bluebird','request-promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf378,0x1e7));var _0x8f37=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xf378[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x8f37('0x0'));var util=require(_0x8f37('0x1'));var logger=require('../../config/logger')(_0x8f37('0x2'));var moment=require('moment');var BPromise=require(_0x8f37('0x3'));var rp=require(_0x8f37('0x4'));var fs=require('fs');var path=require(_0x8f37('0x5'));var rimraf=require(_0x8f37('0x6'));var config=require(_0x8f37('0x7'));var attributes=require(_0x8f37('0x8'));module['exports']=function(_0x35b62d,_0x27f80f){return _0x35b62d[_0x8f37('0x9')](_0x8f37('0xa'),attributes,{'tableName':_0x8f37('0xb'),'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 208de56..eeb7bf9 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 _0xcabc=['code','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x295531,_0x7a99c5){var _0x15a0b8=function(_0x16cce7){while(--_0x16cce7){_0x295531['push'](_0x295531['shift']());}};_0x15a0b8(++_0x7a99c5);}(_0xcabc,0x16a));var _0xccab=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xcabc[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0xccab('0x0'));var moment=require(_0xccab('0x1'));var BPromise=require(_0xccab('0x2'));var rs=require(_0xccab('0x3'));var fs=require('fs');var Redis=require(_0xccab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xccab('0x5'));var logger=require(_0xccab('0x6'))('rpc');var config=require(_0xccab('0x7'));var jayson=require(_0xccab('0x8'));var client=jayson[_0xccab('0x9')]['http']({'port':0x232a});config[_0xccab('0xa')]=_[_0xccab('0xb')](config[_0xccab('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xccab('0xc'))(new Redis(config[_0xccab('0xa')]));require('./chatGroup.socket')[_0xccab('0xd')](socket);function respondWithRpcPromise(_0x25d09d,_0x1186c9,_0x32a098){return new BPromise(function(_0x2471ca,_0x4fe302){return client['request'](_0x25d09d,_0x32a098)[_0xccab('0xe')](function(_0x229ce0){logger[_0xccab('0xf')](_0xccab('0x10'),_0x1186c9,_0xccab('0x11'));logger[_0xccab('0x12')](_0xccab('0x13'),_0x1186c9,'request\x20sent',JSON[_0xccab('0x14')](_0x229ce0));if(_0x229ce0[_0xccab('0x15')]){if(_0x229ce0['error'][_0xccab('0x16')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1186c9,_0x229ce0[_0xccab('0x15')][_0xccab('0x17')]);return _0x4fe302(_0x229ce0[_0xccab('0x15')]['message']);}logger[_0xccab('0x15')](_0xccab('0x10'),_0x1186c9,_0x229ce0['error'][_0xccab('0x17')]);return _0x2471ca(_0x229ce0[_0xccab('0x15')][_0xccab('0x17')]);}else{logger[_0xccab('0xf')](_0xccab('0x10'),_0x1186c9,'request\x20sent');_0x2471ca(_0x229ce0['result'][_0xccab('0x17')]);}})['catch'](function(_0x126eea){logger[_0xccab('0x15')](_0xccab('0x10'),_0x1186c9,_0x126eea);_0x4fe302(_0x126eea);});});} \ No newline at end of file +var _0xc4f5=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatGroup,\x20%s,\x20%s'];(function(_0x12003a,_0x563c09){var _0x3400c4=function(_0x508a71){while(--_0x508a71){_0x12003a['push'](_0x12003a['shift']());}};_0x3400c4(++_0x563c09);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0xc4f5[_0x207d2f];return _0x3c3498;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var moment=require(_0x5c4f('0x1'));var BPromise=require(_0x5c4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c4f('0x3'));var db=require(_0x5c4f('0x4'))['db'];var utils=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});config[_0x5c4f('0xb')]=_[_0x5c4f('0xc')](config['redis'],{'host':_0x5c4f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c4f('0xb')]));require('./chatGroup.socket')[_0x5c4f('0xe')](socket);function respondWithRpcPromise(_0x458348,_0x19623c,_0x56535a){return new BPromise(function(_0x249955,_0x2a9bf9){return client[_0x5c4f('0xf')](_0x458348,_0x56535a)['then'](function(_0x255e5d){logger[_0x5c4f('0x10')]('ChatGroup,\x20%s,\x20%s',_0x19623c,_0x5c4f('0x11'));logger[_0x5c4f('0x12')](_0x5c4f('0x13'),_0x19623c,_0x5c4f('0x11'),JSON[_0x5c4f('0x14')](_0x255e5d));if(_0x255e5d['error']){if(_0x255e5d['error'][_0x5c4f('0x15')]===0x1f4){logger[_0x5c4f('0x16')](_0x5c4f('0x17'),_0x19623c,_0x255e5d[_0x5c4f('0x16')][_0x5c4f('0x18')]);return _0x2a9bf9(_0x255e5d['error']['message']);}logger[_0x5c4f('0x16')]('ChatGroup,\x20%s,\x20%s',_0x19623c,_0x255e5d['error'][_0x5c4f('0x18')]);return _0x249955(_0x255e5d['error'][_0x5c4f('0x18')]);}else{logger[_0x5c4f('0x10')](_0x5c4f('0x17'),_0x19623c,_0x5c4f('0x11'));_0x249955(_0x255e5d[_0x5c4f('0x19')][_0x5c4f('0x18')]);}})[_0x5c4f('0x1a')](function(_0x3ec0ff){logger[_0x5c4f('0x16')]('ChatGroup,\x20%s,\x20%s',_0x19623c,_0x3ec0ff);_0x2a9bf9(_0x3ec0ff);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c8d1225..49e365a 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 _0x5d0e=['./chatGroup.events','save','update','removeListener','length','chatGroup:'];(function(_0x3fa099,_0x2b18be){var _0x442f3c=function(_0x17f0e5){while(--_0x17f0e5){_0x3fa099['push'](_0x3fa099['shift']());}};_0x442f3c(++_0x2b18be);}(_0x5d0e,0x78));var _0xe5d0=function(_0x2eb831,_0x484c60){_0x2eb831=_0x2eb831-0x0;var _0x51b600=_0x5d0e[_0x2eb831];return _0x51b600;};'use strict';var ChatGroupEvents=require(_0xe5d0('0x0'));var events=[_0xe5d0('0x1'),'remove',_0xe5d0('0x2')];function createListener(_0x5ea3c9,_0x2e6083){return function(_0x2b9e91){_0x2e6083['emit'](_0x5ea3c9,_0x2b9e91);};}function removeListener(_0x18eb44,_0xfc24ff){return function(){ChatGroupEvents[_0xe5d0('0x3')](_0x18eb44,_0xfc24ff);};}exports['register']=function(_0x5d37ae){for(var _0x2d3a29=0x0,_0x4eff62=events[_0xe5d0('0x4')];_0x2d3a29<_0x4eff62;_0x2d3a29++){var _0x477fff=events[_0x2d3a29];var _0x5786e6=createListener(_0xe5d0('0x5')+_0x477fff,_0x5d37ae);ChatGroupEvents['on'](_0x477fff,_0x5786e6);}}; \ No newline at end of file +var _0x6dcb=['register','./chatGroup.events','emit'];(function(_0x421c11,_0xcf7560){var _0x317709=function(_0x5c8c71){while(--_0x5c8c71){_0x421c11['push'](_0x421c11['shift']());}};_0x317709(++_0xcf7560);}(_0x6dcb,0x76));var _0xb6dc=function(_0x52041f,_0x2fe7d5){_0x52041f=_0x52041f-0x0;var _0x2cd5bf=_0x6dcb[_0x52041f];return _0x2cd5bf;};'use strict';var ChatGroupEvents=require(_0xb6dc('0x0'));var events=['save','remove','update'];function createListener(_0x4d8b87,_0xbe5682){return function(_0x5be2f7){_0xbe5682[_0xb6dc('0x1')](_0x4d8b87,_0x5be2f7);};}function removeListener(_0x1a8123,_0x4c14eb){return function(){ChatGroupEvents['removeListener'](_0x1a8123,_0x4c14eb);};}exports[_0xb6dc('0x2')]=function(_0x1c5e74){for(var _0x1f5571=0x0,_0x1a2e63=events['length'];_0x1f5571<_0x1a2e63;_0x1f5571++){var _0x408d20=events[_0x1f5571];var _0x31200f=createListener('chatGroup:'+_0x408d20,_0x1c5e74);ChatGroupEvents['on'](_0x408d20,_0x31200f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 95b590e..d9d26fc 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 _0x8e6f=['isAuthenticated','/:id','/:id/unread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','delete','removeMembers','express','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','index','/describe'];(function(_0x2d438e,_0x234eb7){var _0x3eeaa5=function(_0x492611){while(--_0x492611){_0x2d438e['push'](_0x2d438e['shift']());}};_0x3eeaa5(++_0x234eb7);}(_0x8e6f,0x19c));var _0xf8e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e6f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf8e6('0x0'));var router=express['Router']();var fs_extra=require(_0xf8e6('0x1'));var auth=require(_0xf8e6('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e6('0x3'));var controller=require(_0xf8e6('0x4'));router[_0xf8e6('0x5')]('/',auth['isAuthenticated'](),controller[_0xf8e6('0x6')]);router['get'](_0xf8e6('0x7'),auth[_0xf8e6('0x8')](),controller['describe']);router[_0xf8e6('0x5')](_0xf8e6('0x9'),auth[_0xf8e6('0x8')](),controller['show']);router[_0xf8e6('0x5')](_0xf8e6('0xa'),auth[_0xf8e6('0x8')](),controller['getUnread']);router[_0xf8e6('0x5')](_0xf8e6('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xf8e6('0x5')](_0xf8e6('0xc'),auth['isAuthenticated'](),controller[_0xf8e6('0xd')]);router[_0xf8e6('0xe')]('/',auth[_0xf8e6('0x8')](),controller[_0xf8e6('0xf')]);router['post'](_0xf8e6('0xb'),auth['isAuthenticated'](),controller[_0xf8e6('0x10')]);router[_0xf8e6('0xe')](_0xf8e6('0xc'),auth[_0xf8e6('0x8')](),controller[_0xf8e6('0x11')]);router[_0xf8e6('0x12')]('/:id',auth[_0xf8e6('0x8')](),controller['update']);router[_0xf8e6('0x13')](_0xf8e6('0x9'),auth[_0xf8e6('0x8')](),controller['destroy']);router['delete']('/:id/members',auth[_0xf8e6('0x8')](),controller[_0xf8e6('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7b56=['destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','/:id','update','delete'];(function(_0x48d732,_0x202a72){var _0x221c79=function(_0x423c1e){while(--_0x423c1e){_0x48d732['push'](_0x48d732['shift']());}};_0x221c79(++_0x202a72);}(_0x7b56,0x92));var _0x67b5=function(_0x2413cc,_0x1d2eb7){_0x2413cc=_0x2413cc-0x0;var _0xf20ecf=_0x7b56[_0x2413cc];return _0xf20ecf;};'use strict';var multer=require('multer');var util=require(_0x67b5('0x0'));var path=require('path');var timeout=require(_0x67b5('0x1'));var express=require(_0x67b5('0x2'));var router=express[_0x67b5('0x3')]();var fs_extra=require(_0x67b5('0x4'));var auth=require(_0x67b5('0x5'));var interaction=require(_0x67b5('0x6'));var config=require(_0x67b5('0x7'));var controller=require(_0x67b5('0x8'));router['get']('/',auth[_0x67b5('0x9')](),controller[_0x67b5('0xa')]);router[_0x67b5('0xb')](_0x67b5('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x67b5('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x67b5('0xd')]);router['get'](_0x67b5('0xe'),auth[_0x67b5('0x9')](),controller[_0x67b5('0xf')]);router[_0x67b5('0xb')]('/:id/members',auth[_0x67b5('0x9')](),controller[_0x67b5('0x10')]);router[_0x67b5('0xb')](_0x67b5('0x11'),auth[_0x67b5('0x9')](),controller[_0x67b5('0x12')]);router[_0x67b5('0x13')]('/',auth['isAuthenticated'](),controller[_0x67b5('0x14')]);router[_0x67b5('0x13')](_0x67b5('0x15'),auth[_0x67b5('0x9')](),controller[_0x67b5('0x16')]);router[_0x67b5('0x13')](_0x67b5('0x11'),auth['isAuthenticated'](),controller[_0x67b5('0x17')]);router[_0x67b5('0x18')](_0x67b5('0x19'),auth[_0x67b5('0x9')](),controller[_0x67b5('0x1a')]);router[_0x67b5('0x1b')]('/:id',auth[_0x67b5('0x9')](),controller[_0x67b5('0x1c')]);router[_0x67b5('0x1b')](_0x67b5('0x15'),auth[_0x67b5('0x9')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 003c2ca..c7c2d8c 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 _0xf5b7=['TEXT','STRING','DATE','out','BOOLEAN','exports','INTEGER','ENUM','star'];(function(_0x490fac,_0xd1da09){var _0x1401cc=function(_0x74fcb5){while(--_0x74fcb5){_0x490fac['push'](_0x490fac['shift']());}};_0x1401cc(++_0xd1da09);}(_0xf5b7,0x1c7));var _0x7f5b=function(_0x1d3266,_0xa642ae){_0x1d3266=_0x1d3266-0x0;var _0xfb4815=_0xf5b7[_0x1d3266];return _0xfb4815;};'use strict';var Sequelize=require('sequelize');module[_0x7f5b('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7f5b('0x1')]},'ratingType':{'type':Sequelize[_0x7f5b('0x2')](_0x7f5b('0x3'),'thumb'),'defaultValue':_0x7f5b('0x3')},'ratingMessage':{'type':Sequelize[_0x7f5b('0x4')]},'pathTranscript':{'type':Sequelize[_0x7f5b('0x4')]},'mailTranscript':{'type':Sequelize[_0x7f5b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7f5b('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7f5b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7f5b('0x5')]},'note':{'type':Sequelize[_0x7f5b('0x5')]},'browserName':{'type':Sequelize[_0x7f5b('0x5')]},'browserVersion':{'type':Sequelize[_0x7f5b('0x5')]},'osName':{'type':Sequelize[_0x7f5b('0x5')]},'osVersion':{'type':Sequelize[_0x7f5b('0x5')]},'deviceModel':{'type':Sequelize[_0x7f5b('0x5')]},'deviceVendor':{'type':Sequelize[_0x7f5b('0x5')]},'deviceType':{'type':Sequelize[_0x7f5b('0x5')]},'referer':{'type':Sequelize[_0x7f5b('0x4')]},'customerIp':{'type':Sequelize[_0x7f5b('0x5')]},'formData':{'type':Sequelize[_0x7f5b('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x7f5b('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7f5b('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7f5b('0x5')]},'customerPort':{'type':Sequelize[_0x7f5b('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x7f5b('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x7f5b('0x8')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7f5b('0x1')]}}; \ No newline at end of file +var _0xb195=['out','INTEGER','exports','BOOLEAN','star','TEXT','STRING','DATE','long'];(function(_0x320b7f,_0x326601){var _0x5a67a1=function(_0x3db391){while(--_0x3db391){_0x320b7f['push'](_0x320b7f['shift']());}};_0x5a67a1(++_0x326601);}(_0xb195,0x1cd));var _0x5b19=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xb195[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require('sequelize');module[_0x5b19('0x0')]={'closed':{'type':Sequelize[_0x5b19('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x5b19('0x2'),'thumb'),'defaultValue':_0x5b19('0x2')},'ratingMessage':{'type':Sequelize[_0x5b19('0x3')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x5b19('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5b19('0x5')]},'disposition':{'type':Sequelize[_0x5b19('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5b19('0x4')]},'note':{'type':Sequelize[_0x5b19('0x4')]},'browserName':{'type':Sequelize[_0x5b19('0x4')]},'browserVersion':{'type':Sequelize[_0x5b19('0x4')]},'osName':{'type':Sequelize[_0x5b19('0x4')]},'osVersion':{'type':Sequelize[_0x5b19('0x4')]},'deviceModel':{'type':Sequelize[_0x5b19('0x4')]},'deviceVendor':{'type':Sequelize[_0x5b19('0x4')]},'deviceType':{'type':Sequelize[_0x5b19('0x4')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x5b19('0x4')]},'formData':{'type':Sequelize[_0x5b19('0x3')](_0x5b19('0x6'))},'read1stAt':{'type':Sequelize[_0x5b19('0x5')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5b19('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5b19('0x4')]},'customerPort':{'type':Sequelize[_0x5b19('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x5b19('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x5b19('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5b19('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2e007d5..54d373e 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 _0xe4db=['count','set','Content-Range','update','destroy','then','stack','name','send','contact','agent','interaction','index','map','ChatInteraction','fieldName','type','getOptions','findAll','chat','query','user','show','params','model','keys','intersection','attributes','fields','length','merge','options','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','Messages','User','ContactId','agentAlias','System','customer','%s%d','website_alias','agent_alias','alias','fullname','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','omit','ids','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','$gte','split','includeAll','include','getMyMessages','pick','filter','push','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','root','tmp','files','attachments','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','createdAt','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString','browserName','osName','customerIp','customerPort','existsSync','pipe','createWriteStream','read','value','server','createPdfFromHTML','err','rimraf','zip-dir','request-promise','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./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','catch','sendStatus','status','end','json','undefined','limit','offset'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0xe4db,0x173));var _0xbe4d=function(_0x37085b,_0x5173ab){_0x37085b=_0x37085b-0x0;var _0x5cde73=_0xe4db[_0x37085b];return _0x5cde73;};'use strict';var rimraf=require(_0xbe4d('0x0'));var zipdir=require(_0xbe4d('0x1'));var rp=require(_0xbe4d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbe4d('0x3'));var util=require(_0xbe4d('0x4'));var path=require(_0xbe4d('0x5'));var ejs=require(_0xbe4d('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xbe4d('0x7'));var interaction=require(_0xbe4d('0x8'));var qs=require(_0xbe4d('0x9'));var pdf=require(_0xbe4d('0xa'));var logger=require(_0xbe4d('0xb'))(_0xbe4d('0xc'));var config=require('../../config/environment');var db=require(_0xbe4d('0xd'))['db'];config[_0xbe4d('0xe')]=_[_0xbe4d('0xf')](config[_0xbe4d('0xe')],{'host':_0xbe4d('0x10'),'port':0x18eb});var socket=require(_0xbe4d('0x11'))(new Redis(config[_0xbe4d('0xe')]));require(_0xbe4d('0x12'))[_0xbe4d('0x13')](socket);var jayson=require(_0xbe4d('0x14'));var client=jayson[_0xbe4d('0x15')][_0xbe4d('0x16')]({'port':0x232b});var client9004=jayson[_0xbe4d('0x15')][_0xbe4d('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x455e95,_0x36a162,_0x40db75,_0x5a87ae){return new BPromise(function(_0x51a71c,_0x7350fc){var _0x6bbdc0=_0x5a87ae||client;return _0x6bbdc0[_0xbe4d('0x17')](_0x455e95,_0x40db75)['then'](function(_0x39bf56){logger[_0xbe4d('0x18')](_0xbe4d('0x19'),_0x36a162,_0xbe4d('0x1a'));logger[_0xbe4d('0x1b')](_0xbe4d('0x1c'),_0x36a162,_0xbe4d('0x1a'),JSON['stringify'](_0x39bf56));if(_0x39bf56[_0xbe4d('0x1d')]){if(_0x39bf56[_0xbe4d('0x1d')]['code']===0x1f4){logger[_0xbe4d('0x1d')](_0xbe4d('0x19'),_0x36a162,_0x39bf56[_0xbe4d('0x1d')]['message']);return _0x7350fc(_0x39bf56[_0xbe4d('0x1d')][_0xbe4d('0x1e')]);}logger[_0xbe4d('0x1d')](_0xbe4d('0x19'),_0x36a162,_0x39bf56[_0xbe4d('0x1d')][_0xbe4d('0x1e')]);return _0x51a71c(_0x39bf56[_0xbe4d('0x1d')][_0xbe4d('0x1e')]);}else{logger[_0xbe4d('0x18')](_0xbe4d('0x19'),_0x36a162,_0xbe4d('0x1a'));_0x51a71c(_0x39bf56['result'][_0xbe4d('0x1e')]);}})[_0xbe4d('0x1f')](function(_0x2ae9ed){logger[_0xbe4d('0x1d')](_0xbe4d('0x19'),_0x36a162,_0x2ae9ed);_0x7350fc(_0x2ae9ed);});});}function respondWithStatusCode(_0x47dd6a,_0x493c7d){_0x493c7d=_0x493c7d||0xcc;return function(_0x4df3b0){if(_0x4df3b0){return _0x47dd6a[_0xbe4d('0x20')](_0x493c7d);}return _0x47dd6a[_0xbe4d('0x21')](_0x493c7d)[_0xbe4d('0x22')]();};}function respondWithResult(_0x2c37c0,_0x3484d1){_0x3484d1=_0x3484d1||0xc8;return function(_0xd50845){if(_0xd50845){return _0x2c37c0['status'](_0x3484d1)[_0xbe4d('0x23')](_0xd50845);}};}function respondWithFilteredResult(_0x16671a,_0x40879c){return function(_0x44f050){if(_0x44f050){var _0x5a955=typeof _0x40879c['offset']===_0xbe4d('0x24')&&typeof _0x40879c[_0xbe4d('0x25')]===_0xbe4d('0x24');var _0x1dbdc4=_0x44f050['count'];var _0x1a3399=_0x5a955?0x0:_0x40879c[_0xbe4d('0x26')];var _0x4566f0=_0x5a955?_0x44f050[_0xbe4d('0x27')]:_0x40879c[_0xbe4d('0x26')]+_0x40879c['limit'];var _0x44771b;if(_0x4566f0>=_0x1dbdc4){_0x4566f0=_0x1dbdc4;_0x44771b=0xc8;}else{_0x44771b=0xce;}_0x16671a['status'](_0x44771b);return _0x16671a[_0xbe4d('0x28')](_0xbe4d('0x29'),_0x1a3399+'-'+_0x4566f0+'/'+_0x1dbdc4)[_0xbe4d('0x23')](_0x44f050);}return null;};}function saveUpdates(_0x5d912d){return function(_0x3d5e4e){if(_0x3d5e4e){return _0x3d5e4e[_0xbe4d('0x2a')](_0x5d912d)['then'](function(_0x1af726){return _0x1af726;});}return null;};}function removeEntity(_0x32f9c6){return function(_0x252712){if(_0x252712){return _0x252712[_0xbe4d('0x2b')]()[_0xbe4d('0x2c')](function(){_0x32f9c6[_0xbe4d('0x21')](0xcc)[_0xbe4d('0x22')]();});}};}function handleEntityNotFound(_0x4f8974){return function(_0x39c161){if(!_0x39c161){_0x4f8974[_0xbe4d('0x20')](0x194);}return _0x39c161;};}function handleError(_0x4edc78,_0x17fc5b){_0x17fc5b=_0x17fc5b||0x1f4;return function(_0x2a0125){logger['error'](_0x2a0125[_0xbe4d('0x2d')]);if(_0x2a0125['name']){delete _0x2a0125[_0xbe4d('0x2e')];}_0x4edc78[_0xbe4d('0x21')](_0x17fc5b)[_0xbe4d('0x2f')](_0x2a0125);};}function getMustacheRender(_0x34eba3,_0xa30919){return Mustache['render'](_0x34eba3,_['merge'](_0xa30919['body'],{'contact':_0xa30919[_0xbe4d('0x30')],'message':_0xa30919[_0xbe4d('0x1e')],'agent':_0xa30919[_0xbe4d('0x31')],'interaction':_0xa30919[_0xbe4d('0x32')],'account':_0xa30919['account']}))||'';}exports[_0xbe4d('0x33')]=function(_0x1547da,_0x559e7d){var _0x31a231={};var _0x225d07=_[_0xbe4d('0x34')](db[_0xbe4d('0x35')]['rawAttributes'],function(_0x33affd){return{'name':_0x33affd[_0xbe4d('0x36')],'type':_0x33affd[_0xbe4d('0x37')]['key']};});_0x31a231=qs[_0xbe4d('0x38')](_0x225d07,_0x1547da);return interaction[_0xbe4d('0x39')](_0xbe4d('0x3a'),_0x1547da[_0xbe4d('0x3b')],_0x1547da[_0xbe4d('0x3c')],_0x31a231,_0x225d07)[_0xbe4d('0x2c')](respondWithFilteredResult(_0x559e7d,_0x31a231))['catch'](handleError(_0x559e7d,null));};exports[_0xbe4d('0x3d')]=function(_0x3dc5ce,_0x115136){var _0xe639b={'raw':![],'where':{'id':_0x3dc5ce[_0xbe4d('0x3e')]['id']}},_0x5790fd={};_0x5790fd[_0xbe4d('0x3f')]=_[_0xbe4d('0x40')](db[_0xbe4d('0x35')]['rawAttributes']);_0x5790fd[_0xbe4d('0x3b')]=_['keys'](_0x3dc5ce['query']);_0x5790fd['filters']=_[_0xbe4d('0x41')](_0x5790fd[_0xbe4d('0x3f')],_0x5790fd[_0xbe4d('0x3b')]);_0xe639b[_0xbe4d('0x42')]=_[_0xbe4d('0x41')](_0x5790fd['model'],qs[_0xbe4d('0x43')](_0x3dc5ce[_0xbe4d('0x3b')][_0xbe4d('0x43')]));_0xe639b[_0xbe4d('0x42')]=_0xe639b[_0xbe4d('0x42')][_0xbe4d('0x44')]?_0xe639b[_0xbe4d('0x42')]:_0x5790fd[_0xbe4d('0x3f')];if(_0x3dc5ce[_0xbe4d('0x3b')]['includeAll']){_0xe639b['include']=[{'all':!![]}];}_0xe639b=_[_0xbe4d('0x45')]({},_0xe639b,_0x3dc5ce[_0xbe4d('0x46')]);return db[_0xbe4d('0x35')][_0xbe4d('0x47')](_0xe639b)[_0xbe4d('0x2c')](handleEntityNotFound(_0x115136,null))[_0xbe4d('0x2c')](respondWithResult(_0x115136,null))[_0xbe4d('0x1f')](handleError(_0x115136,null));};exports[_0xbe4d('0x48')]=function(_0x18d48d,_0x405d2e){return db[_0xbe4d('0x35')][_0xbe4d('0x48')](_0x18d48d['body'],{})[_0xbe4d('0x2c')](respondWithResult(_0x405d2e,0xc9))[_0xbe4d('0x1f')](handleError(_0x405d2e,null));};exports['update']=function(_0x2fbb21,_0x2287f9){if(_0x2fbb21[_0xbe4d('0x49')]['id']){delete _0x2fbb21[_0xbe4d('0x49')]['id'];}return db[_0xbe4d('0x35')][_0xbe4d('0x47')]({'where':{'id':_0x2fbb21[_0xbe4d('0x3e')]['id']}})[_0xbe4d('0x2c')](handleEntityNotFound(_0x2287f9,null))[_0xbe4d('0x2c')](saveUpdates(_0x2fbb21[_0xbe4d('0x49')],null))[_0xbe4d('0x2c')](respondWithResult(_0x2287f9,null))[_0xbe4d('0x1f')](handleError(_0x2287f9,null));};exports[_0xbe4d('0x2b')]=function(_0x554365,_0x12d000){return db[_0xbe4d('0x35')][_0xbe4d('0x47')]({'where':{'id':_0x554365['params']['id']}})[_0xbe4d('0x2c')](handleEntityNotFound(_0x12d000,null))[_0xbe4d('0x2c')](removeEntity(_0x12d000,null))[_0xbe4d('0x1f')](handleError(_0x12d000,null));};exports[_0xbe4d('0x4a')]=function(_0x3a0e77,_0x560429){return db[_0xbe4d('0x35')][_0xbe4d('0x4a')]()['then'](respondWithResult(_0x560429,null))[_0xbe4d('0x1f')](handleError(_0x560429,null));};exports[_0xbe4d('0x4b')]=function(_0x5c0c88,_0x3010a4){var _0x318061=_0x5c0c88[_0xbe4d('0x3e')]['id'];var _0x8113c2;var _0x475e7e;var _0x2a0aaf;return db[_0xbe4d('0x35')][_0xbe4d('0x4c')]({'where':{'id':_0x318061}})[_0xbe4d('0x2c')](function(_0x390c4e){_0x8113c2=_0x390c4e;return db[_0xbe4d('0x4d')]['findOne']({'where':{'id':_0x390c4e[_0xbe4d('0x4e')]},'attributes':['id','vidaooApiKey',_0xbe4d('0x4f'),_0xbe4d('0x50'),_0xbe4d('0x51'),_0xbe4d('0x52')],'raw':!![]});})[_0xbe4d('0x2c')](function(_0x4af6d4){if(_0x4af6d4&&_0x4af6d4['vidaooApiKey']&&_0x4af6d4[_0xbe4d('0x4f')]){_0x475e7e=_0x4af6d4;var _0x5600b9={'interaction':{'id':_0x318061},'agent':{'id':_0x5c0c88[_0xbe4d('0x3c')]['id'],'name':_0x5c0c88['user']['name'],'fullname':_0x5c0c88['user']['fullname'],'email':_0x5c0c88['user'][_0xbe4d('0x53')]},'contact':_0x5c0c88[_0xbe4d('0x49')][_0xbe4d('0x30')],'account':_0x5c0c88[_0xbe4d('0x49')][_0xbe4d('0x54')]};var _0x340d14={'rejectUnauthorized':![],'method':'POST','url':_0xbe4d('0x55'),'headers':{'X-APIKEY':_0x4af6d4[_0xbe4d('0x56')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5c0c88[_0xbe4d('0x3c')]['email']],'buttons':null,'topic':_0x475e7e[_0xbe4d('0x50')],'note':_['isNull'](_0x475e7e['vidaooNote'])?null:getMustacheRender(_0x475e7e[_0xbe4d('0x51')],_0x5600b9),'metadata':null},'redirect':_0xbe4d('0x57'),'json':!![]};try{if(!_['isNull'](_0x475e7e[_0xbe4d('0x52')])){var _0x21cb52=getMustacheRender(_0x475e7e[_0xbe4d('0x52')],_0x5600b9);var _0x2c9045=JSON[_0xbe4d('0x58')](_0x21cb52);_0x340d14[_0xbe4d('0x49')][_0xbe4d('0x59')]=_0x2c9045;}}catch(_0x590ca4){throw new db[(_0xbe4d('0x5a'))]['ValidationError'](_0xbe4d('0x5b'));}return rp(_0x340d14);}else{throw new db[(_0xbe4d('0x5a'))][(_0xbe4d('0x5c'))](_0xbe4d('0x5d'));}})[_0xbe4d('0x2c')](function(_0x5d389b){_0x2a0aaf=_0x5d389b;if(_0x2a0aaf['id']){var _0x19a87c={'body':_0x2a0aaf['join_url'],'ChatWebsiteId':_0x475e7e['id'],'ChatInteractionId':_0x8113c2['id'],'direction':_0xbe4d('0x5e'),'UserId':_0x5c0c88['user']['id']};return db['ChatMessage'][_0xbe4d('0x48')](_0x19a87c,{});}else{throw new db[(_0xbe4d('0x5a'))][(_0xbe4d('0x5c'))](_0xbe4d('0x5f'));}})[_0xbe4d('0x2c')](function(){return _0x8113c2['updateAttributes']({'vidaooSessionId':_0x2a0aaf['id']});})[_0xbe4d('0x2c')](respondWithResult(_0x3010a4,null))['catch'](handleError(_0x3010a4,null));};exports[_0xbe4d('0x60')]=function(_0x362711,_0x44f9d6){if(_0x362711[_0xbe4d('0x49')]['id']){delete _0x362711['body']['id'];}return db['ChatInteraction'][_0xbe4d('0x47')]({'where':{'id':_0x362711['params']['id']},'include':[{'model':db[_0xbe4d('0x61')],'as':_0xbe4d('0x62')}]})[_0xbe4d('0x2c')](handleEntityNotFound(_0x44f9d6,null))[_0xbe4d('0x2c')](saveUpdates(_0x362711[_0xbe4d('0x49')],null))['then'](respondWithResult(_0x44f9d6,null))[_0xbe4d('0x1f')](handleError(_0x44f9d6,null));};exports[_0xbe4d('0x63')]=function(_0x280325,_0x190848){if(_0x280325[_0xbe4d('0x49')]['id']){delete _0x280325[_0xbe4d('0x49')]['id'];}return db[_0xbe4d('0x35')]['find']({'where':{'id':_0x280325[_0xbe4d('0x3e')]['id']}})[_0xbe4d('0x2c')](function(_0x4ae4ec){if(!_0x4ae4ec){logger[_0xbe4d('0x1d')](_0xbe4d('0x64'),'abandon',0x194,_0xbe4d('0x65'));_0x190848[_0xbe4d('0x20')](0x194);}else{if(_0x4ae4ec[_0xbe4d('0x66')]){throw new db['Sequelize'][(_0xbe4d('0x5c'))]('Interaction\x20already\x20assigned');}}return _0x4ae4ec;})[_0xbe4d('0x2c')](function(_0x168a5a){if(_0x168a5a){return _0x168a5a['update']({'closed':_0x280325[_0xbe4d('0x49')][_0xbe4d('0x67')],'disposition':_0x280325[_0xbe4d('0x49')][_0xbe4d('0x68')]})[_0xbe4d('0x2c')](function(_0x465488){return _0x465488;});}})[_0xbe4d('0x2c')](function(){return respondWithRpcPromise(_0xbe4d('0x69'),'abandon',_0x280325[_0xbe4d('0x49')],client9004);})['then'](respondWithResult(_0x190848,null))[_0xbe4d('0x1f')](handleError(_0x190848,null));};exports[_0xbe4d('0x6a')]=function(_0x2b068c,_0xaed7f8){_0x2b068c[_0xbe4d('0x49')][_0xbe4d('0x2e')]=_0x2b068c[_0xbe4d('0x6b')][_0xbe4d('0x6c')];_0x2b068c[_0xbe4d('0x49')][_0xbe4d('0x6d')]=_0x2b068c[_0xbe4d('0x6b')][_0xbe4d('0x6e')];_0x2b068c['body'][_0xbe4d('0x37')]=_0x2b068c['file'][_0xbe4d('0x6f')];return db[_0xbe4d('0x70')][_0xbe4d('0x48')](_0x2b068c[_0xbe4d('0x49')])['then'](respondWithResult(_0xaed7f8,0xc9))[_0xbe4d('0x1f')](handleError(_0xaed7f8,null));};exports[_0xbe4d('0x71')]=function(_0x48c206,_0x3a3a9b){return db['ChatInteraction'][_0xbe4d('0x4c')]({'where':{'id':_0x48c206['params']['id']},'raw':!![]})[_0xbe4d('0x2c')](handleEntityNotFound(_0x3a3a9b,null))['then'](function(_0x383ba9){if(_0x383ba9){if(_0x383ba9[_0xbe4d('0x67')]){return _0x3a3a9b['status'](0x193)[_0xbe4d('0x23')]({'status':0x193,'message':_0xbe4d('0x72')});}return db[_0xbe4d('0x70')][_0xbe4d('0x4c')]({'where':{'id':_0x48c206[_0xbe4d('0x3b')][_0xbe4d('0x73')]},'raw':!![]})[_0xbe4d('0x2c')](handleEntityNotFound(_0x3a3a9b,null));}})[_0xbe4d('0x2c')](function(_0x274e9a){if(_0x274e9a){var _0x6b1df2=_0x274e9a[_0xbe4d('0x74')]!==null;var _0x2e1fe8=path[_0xbe4d('0x75')](config['root'],_0xbe4d('0x76'));if(_0x6b1df2){_0x2e1fe8=path[_0xbe4d('0x75')](_0x2e1fe8,_0xbe4d('0x77'));}var _0x43b0df=path['join'](_0x2e1fe8,_0x274e9a[_0xbe4d('0x6d')]);return _0x3a3a9b[_0xbe4d('0x78')](_0x43b0df);}})[_0xbe4d('0x1f')](handleError(_0x3a3a9b,null));};exports[_0xbe4d('0x79')]=function(_0x5cc2e3,_0x444f5d){var _0x5d69cd=null;var _0x1d11b0=null;var _0x5dc658=null;if(_0x5cc2e3[_0xbe4d('0x49')]['id']){delete _0x5cc2e3['body']['id'];}if(_0x5cc2e3[_0xbe4d('0x49')][_0xbe4d('0x7a')]){_0x5dc658=path['join'](config['root'],'server/files/chat/upload/',util[_0xbe4d('0x7b')](_0xbe4d('0x7c'),Date[_0xbe4d('0x7d')]()));_0x5cc2e3['body']['pathTranscript']=_0x5dc658;}return db[_0xbe4d('0x35')][_0xbe4d('0x47')]({'where':{'id':_0x5cc2e3[_0xbe4d('0x3e')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xbe4d('0x7e'),'include':[{'model':db[_0xbe4d('0x7f')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x444f5d,null))[_0xbe4d('0x2c')](saveUpdates(_0x5cc2e3['body'],null))[_0xbe4d('0x2c')](function(_0x4cc842){if(_0x4cc842){_0x5d69cd=_0x4cc842;return db[_0xbe4d('0x4d')][_0xbe4d('0x47')]({'where':{'id':_0x5d69cd[_0xbe4d('0x4e')]}});}})['then'](function(_0x5a56e6){if(_0x5a56e6){_0x1d11b0=_0x5a56e6;return db['CmContact'][_0xbe4d('0x47')]({'where':{'id':_0x5d69cd[_0xbe4d('0x80')]}});}})['then'](function(_0x35000a){if(_0x35000a){if(_0x5dc658){var _0x1ffe98=null;for(var _0x5773cd=0x1;_0x5773cd<_0x5d69cd[_0xbe4d('0x7e')]['length'];++_0x5773cd){_0x1ffe98=_0x5d69cd[_0xbe4d('0x7e')][_0x5773cd];var _0x2c4d16=_0x1ffe98[_0xbe4d('0x66')]?util[_0xbe4d('0x7b')]('%s%d',_0x1d11b0[_0xbe4d('0x81')],_0x1ffe98[_0xbe4d('0x66')]):_0xbe4d('0x82');var _0x5965cd=_0x5cc2e3[_0xbe4d('0x49')][_0xbe4d('0x83')]||util[_0xbe4d('0x7b')](_0xbe4d('0x84'),'Visitor',_0x1ffe98['ContactId']);switch(_0x1d11b0['agentIdentifier']){case _0xbe4d('0x85'):_0x2c4d16=_0x1ffe98[_0xbe4d('0x66')]?util[_0xbe4d('0x7b')](_0xbe4d('0x84'),_0x1d11b0['agentAlias'],_0x1ffe98[_0xbe4d('0x66')]):_0xbe4d('0x82');break;case _0xbe4d('0x86'):_0x2c4d16=_0x1ffe98[_0xbe4d('0x66')]?_0x1ffe98[_0xbe4d('0x7f')][_0xbe4d('0x87')]||_0x1ffe98[_0xbe4d('0x7f')][_0xbe4d('0x88')]:_0xbe4d('0x82');break;case'agent_fullname':_0x2c4d16=_0x1ffe98[_0xbe4d('0x66')]?_0x1ffe98[_0xbe4d('0x7f')][_0xbe4d('0x88')]:'System';break;default:_0x2c4d16=_0x1ffe98[_0xbe4d('0x66')]?util[_0xbe4d('0x7b')](_0xbe4d('0x84'),_0x1d11b0[_0xbe4d('0x81')],_0x1ffe98[_0xbe4d('0x66')]):_0xbe4d('0x82');}var _0x8c73cd=util[_0xbe4d('0x7b')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1ffe98['createdAt'])[_0xbe4d('0x7b')]('MM/DD/YYYY\x20HH:mm:ss'),_0x1ffe98[_0xbe4d('0x89')]==='in'?_0x5965cd:_0x2c4d16,_0x1ffe98['body']);if(!_0x1ffe98[_0xbe4d('0x8a')]){fs[_0xbe4d('0x8b')](_0x5dc658,_0x8c73cd);}}return db[_0xbe4d('0x8c')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xbe4d('0x8d')],'as':_0xbe4d('0x8e'),'raw':!![],'include':[{'model':db[_0xbe4d('0x8f')],'as':_0xbe4d('0x8f'),'raw':!![]}]}]});}}})['then'](function(_0x18376e){if(!_0x18376e||!_0x18376e['Smtp']||!_0x5cc2e3[_0xbe4d('0x49')])return _0x5d69cd;var _0x12f05d=_0x18376e[_0xbe4d('0x90')]();return respondWithRpcPromise(_0xbe4d('0x91'),_0xbe4d('0x92'),{'account':_0x12f05d,'message':{'from':util[_0xbe4d('0x7b')](_0xbe4d('0x93'),_0x18376e['name'],_0x18376e[_0xbe4d('0x53')]||_0x18376e[_0xbe4d('0x8e')]['user']),'to':_0x5cc2e3['body']['mailTranscript'],'subject':_0xbe4d('0x94'),'text':util[_0xbe4d('0x7b')](_0xbe4d('0x95'),_0x5cc2e3['body'][_0xbe4d('0x7a')]),'attachments':[{'path':_0x5dc658}]}})[_0xbe4d('0x2c')](function(){return _0x5d69cd;})[_0xbe4d('0x1f')](function(_0x24fa75){logger[_0xbe4d('0x1d')](_0x24fa75);});})['then'](respondWithStatusCode(_0x444f5d,0xc8))['catch'](handleError(_0x444f5d,null));};exports[_0xbe4d('0x96')]=function(_0x436c96,_0x4c752b){return db[_0xbe4d('0x97')][_0xbe4d('0x47')]({'where':{'id':_0x436c96[_0xbe4d('0x3e')]['id']}})[_0xbe4d('0x2c')](handleEntityNotFound(_0x4c752b,null))['then'](function(_0x16b589){if(_0x16b589){return _0x16b589['addMessage'](_0x436c96[_0xbe4d('0x49')]['ids'],_[_0xbe4d('0x98')](_0x436c96[_0xbe4d('0x49')],[_0xbe4d('0x99'),'id'])||{});}})[_0xbe4d('0x2c')](respondWithResult(_0x4c752b,null))[_0xbe4d('0x1f')](handleError(_0x4c752b,null));};exports['getMessages']=function(_0x15822f,_0xe6d556){var _0x349330={'raw':![],'where':{}};var _0x9bc554={};var _0x19506a={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbe4d('0x4c')]({'where':{'id':_0x15822f['params']['id']}})[_0xbe4d('0x2c')](handleEntityNotFound(_0xe6d556,null))[_0xbe4d('0x2c')](function(_0x513a34){if(_0x513a34){_0x9bc554[_0xbe4d('0x3f')]=_[_0xbe4d('0x40')](db[_0xbe4d('0x97')][_0xbe4d('0x9a')]);_0x9bc554['query']=_['keys'](_0x15822f[_0xbe4d('0x3b')]);_0x9bc554[_0xbe4d('0x9b')]=_['intersection'](_0x9bc554['model'],_0x9bc554[_0xbe4d('0x3b')]);_0x349330[_0xbe4d('0x42')]=_[_0xbe4d('0x41')](_0x9bc554['model'],qs[_0xbe4d('0x43')](_0x15822f[_0xbe4d('0x3b')][_0xbe4d('0x43')]));_0x349330[_0xbe4d('0x42')]=_0x349330[_0xbe4d('0x42')][_0xbe4d('0x44')]?_0x349330[_0xbe4d('0x42')]:_0x9bc554['model'];if(!_0x15822f[_0xbe4d('0x3b')][_0xbe4d('0x9c')](_0xbe4d('0x9d'))){_0x349330[_0xbe4d('0x25')]=qs[_0xbe4d('0x25')](_0x15822f['query'][_0xbe4d('0x25')]);_0x349330[_0xbe4d('0x26')]=qs[_0xbe4d('0x26')](_0x15822f['query']['offset']);}_0x349330[_0xbe4d('0x9e')]=qs[_0xbe4d('0x9f')](_0x15822f[_0xbe4d('0x3b')]['sort']);_0x349330['where']=qs['filters'](_['pick'](_0x15822f[_0xbe4d('0x3b')],_0x9bc554[_0xbe4d('0x9b')]));_0x349330[_0xbe4d('0xa0')][_0xbe4d('0xa1')]=_0x513a34['id'];if(_0x15822f[_0xbe4d('0x3b')]['filter']){_0x349330[_0xbe4d('0xa0')]=_[_0xbe4d('0x45')](_0x349330[_0xbe4d('0xa0')],{'$or':_[_0xbe4d('0x34')](_0x349330[_0xbe4d('0x42')],function(_0x4c6d8b){var _0x2eb986={};_0x2eb986[_0x4c6d8b]={'$like':'%'+_0x15822f['query']['filter']+'%'};return _0x2eb986;})});}if(_0x15822f[_0xbe4d('0x3b')][_0xbe4d('0xa2')]){var _0x472947=_0x15822f[_0xbe4d('0x3b')][_0xbe4d('0xa2')][_0xbe4d('0xa3')](',');var _0x14d8a9={};_0x14d8a9[_0x472947[0x0]]={'$gte':moment(_0x472947[0x1])[_0xbe4d('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x349330[_0xbe4d('0xa0')]=_['merge'](_0x349330[_0xbe4d('0xa0')],_0x14d8a9);}_0x349330=_[_0xbe4d('0x45')]({},_0x349330,_0x15822f['options']);return db[_0xbe4d('0x97')][_0xbe4d('0x27')]({'where':_0x349330[_0xbe4d('0xa0')]})[_0xbe4d('0x2c')](function(_0x59388a){_0x19506a[_0xbe4d('0x27')]=_0x59388a;if(_0x15822f['query'][_0xbe4d('0xa4')]){_0x349330[_0xbe4d('0xa5')]=[{'all':!![]}];}return db[_0xbe4d('0x97')]['findAll'](_0x349330);})['then'](function(_0x144963){_0x19506a['rows']=_0x144963;return _0x19506a;});}})[_0xbe4d('0x2c')](respondWithFilteredResult(_0xe6d556,_0x349330))[_0xbe4d('0x1f')](handleError(_0xe6d556,null));};exports[_0xbe4d('0xa6')]=function(_0x5e95e4,_0x342be7){var _0x4d3a84={'where':{}},_0x405aed={},_0x52e10b={'count':0x0,'rows':[]};return db[_0xbe4d('0x35')][_0xbe4d('0x4c')]({'where':{'id':_0x5e95e4['params']['id']}})[_0xbe4d('0x2c')](handleEntityNotFound(_0x342be7,null))[_0xbe4d('0x2c')](function(_0x25b24e){if(_0x25b24e){_0x405aed[_0xbe4d('0x3f')]=_[_0xbe4d('0x40')](db[_0xbe4d('0x97')][_0xbe4d('0x9a')]);_0x405aed['query']=_['keys'](_0x5e95e4[_0xbe4d('0x3b')]);_0x405aed[_0xbe4d('0x9b')]=_[_0xbe4d('0x41')](_0x405aed[_0xbe4d('0x3f')],_0x405aed[_0xbe4d('0x3b')]);_0x4d3a84[_0xbe4d('0x42')]=_[_0xbe4d('0x41')](_0x405aed[_0xbe4d('0x3f')],qs['fields'](_0x5e95e4[_0xbe4d('0x3b')][_0xbe4d('0x43')]));_0x4d3a84['attributes']=_0x4d3a84[_0xbe4d('0x42')][_0xbe4d('0x44')]?_0x4d3a84['attributes']:_0x405aed['model'];if(!_0x5e95e4['query'][_0xbe4d('0x9c')](_0xbe4d('0x9d'))){_0x4d3a84[_0xbe4d('0x25')]=qs[_0xbe4d('0x25')](_0x5e95e4[_0xbe4d('0x3b')][_0xbe4d('0x25')]);_0x4d3a84[_0xbe4d('0x26')]=qs[_0xbe4d('0x26')](_0x5e95e4['query'][_0xbe4d('0x26')]);}_0x4d3a84['order']=qs['sort'](_0x5e95e4[_0xbe4d('0x3b')][_0xbe4d('0x9f')]);_0x4d3a84[_0xbe4d('0xa0')]=qs[_0xbe4d('0x9b')](_[_0xbe4d('0xa7')](_0x5e95e4[_0xbe4d('0x3b')],_0x405aed[_0xbe4d('0x9b')]));_0x4d3a84[_0xbe4d('0xa0')][_0xbe4d('0xa1')]=_0x25b24e['id'];if(_0x5e95e4['query'][_0xbe4d('0xa8')]){_0x4d3a84[_0xbe4d('0xa0')]=_[_0xbe4d('0x45')](_0x4d3a84[_0xbe4d('0xa0')],{'$or':_[_0xbe4d('0x34')](_0x4d3a84[_0xbe4d('0x42')],function(_0x26fb5e){var _0x507da4={};_0x507da4[_0x26fb5e]={'$like':'%'+_0x5e95e4[_0xbe4d('0x3b')][_0xbe4d('0xa8')]+'%'};return _0x507da4;})});}_0x4d3a84['where']['secret']=![];if(_0x5e95e4['query']['id']){_0x4d3a84[_0xbe4d('0xa0')]['id']={'$gt':_0x5e95e4['query']['id']};}_0x4d3a84=_[_0xbe4d('0x45')]({},_0x4d3a84,_0x5e95e4[_0xbe4d('0x46')]);return db[_0xbe4d('0x97')][_0xbe4d('0x27')]({'where':_0x4d3a84[_0xbe4d('0xa0')]})[_0xbe4d('0x2c')](function(_0x47472f){_0x52e10b[_0xbe4d('0x27')]=_0x47472f;_0x4d3a84[_0xbe4d('0xa5')]=[];if(_0x5e95e4['query']['includeAgent']){_0x4d3a84[_0xbe4d('0xa5')][_0xbe4d('0xa9')]({'model':db[_0xbe4d('0x7f')],'as':_0xbe4d('0x7f'),'attributes':['id',_0xbe4d('0x88'),'alias']});}if(_0x5e95e4[_0xbe4d('0x3b')][_0xbe4d('0xa4')]){_0x4d3a84[_0xbe4d('0xa5')]=[{'all':!![]}];}return db['ChatMessage'][_0xbe4d('0x39')](_0x4d3a84);})['then'](function(_0x3335a4){_0x52e10b['rows']=_0x3335a4;return _0x52e10b;});}})[_0xbe4d('0x2c')](respondWithFilteredResult(_0x342be7,_0x4d3a84))['catch'](handleError(_0x342be7,null));};exports[_0xbe4d('0xaa')]=function(_0x30b555,_0x49b263){return db[_0xbe4d('0x35')]['find']({'where':{'id':_0x30b555[_0xbe4d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x49b263,null))['then'](function(_0x35a5b6){if(_0x35a5b6){return _0x35a5b6[_0xbe4d('0xab')](_0x30b555[_0xbe4d('0x49')][_0xbe4d('0x99')],_[_0xbe4d('0x98')](_0x30b555[_0xbe4d('0x49')],['ids','id'])||{})['spread'](function(){return db[_0xbe4d('0xac')][_0xbe4d('0x39')]({'attributes':['id',_0xbe4d('0x2e'),_0xbe4d('0xad')],'where':{'id':_0x30b555[_0xbe4d('0x49')]['ids']}});})[_0xbe4d('0x2c')](function(_0x2b6a6e){socket[_0xbe4d('0xae')](_0xbe4d('0xaf'),{'id':Number(_0x30b555[_0xbe4d('0x3e')]['id']),'tags':_0x2b6a6e||[]});return{'id':Number(_0x30b555[_0xbe4d('0x3e')]['id']),'tags':_0x2b6a6e||[]};});}})[_0xbe4d('0x2c')](respondWithResult(_0x49b263,null))['catch'](handleError(_0x49b263,null));};exports[_0xbe4d('0xb0')]=function(_0x1dc895,_0xb8bffe){return db['ChatInteraction'][_0xbe4d('0x47')]({'where':{'id':_0x1dc895[_0xbe4d('0x3e')]['id']}})['then'](handleEntityNotFound(_0xb8bffe,null))[_0xbe4d('0x2c')](function(_0xc4d3c){if(_0xc4d3c){return _0xc4d3c['removeTags'](_0x1dc895[_0xbe4d('0x3b')][_0xbe4d('0x99')]);}})['then'](respondWithStatusCode(_0xb8bffe,null))[_0xbe4d('0x1f')](handleError(_0xb8bffe,null));};exports[_0xbe4d('0x78')]=function(_0x2d034c,_0x30f318){var _0x34f8c8=moment()['unix']()['toString']();var _0x3278b1=path['join'](config[_0xbe4d('0xb1')],'server','files',_0xbe4d('0xb2'));var _0x26e765=path[_0xbe4d('0x75')](config['root'],'server',_0xbe4d('0xb3'),_0xbe4d('0xb4'));var _0x23bc45=path['join'](_0x3278b1,_0x34f8c8);var _0x443317=util[_0xbe4d('0x7b')]('transcript-%d-%s.zip',_0x2d034c[_0xbe4d('0x3e')]['id'],_0x34f8c8);var _0x451994=path[_0xbe4d('0x75')](_0x3278b1,_0x443317);var _0x10f87d=[];_0x10f87d[_0xbe4d('0xa9')]({'model':db[_0xbe4d('0x7f')],'as':_0xbe4d('0x7f'),'attributes':['id','fullname'],'raw':!![]});_0x10f87d[_0xbe4d('0xa9')]({'model':db[_0xbe4d('0x61')],'as':_0xbe4d('0x62'),'attributes':['id',_0xbe4d('0xb5'),_0xbe4d('0xb6')],'raw':!![]});if(_0x2d034c[_0xbe4d('0x3b')]['attachments']){_0x10f87d[_0xbe4d('0xa9')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x4fd550=[{'model':db[_0xbe4d('0x97')],'as':_0xbe4d('0x7e'),'attributes':['id','body','createdAt',_0xbe4d('0x89'),_0xbe4d('0x8a'),'read'],'include':_0x10f87d}];_0x4fd550[_0xbe4d('0xa9')]({'model':db['ChatWebsite'],'as':_0xbe4d('0xb7'),'attributes':['id',_0xbe4d('0x2e')]});_0x4fd550[_0xbe4d('0xa9')]({'model':db[_0xbe4d('0x7f')],'as':_0xbe4d('0xb8'),'attributes':['id',_0xbe4d('0x88')]});return db[_0xbe4d('0x35')][_0xbe4d('0x47')]({'where':{'id':_0x2d034c[_0xbe4d('0x3e')]['id']},'include':_0x4fd550})[_0xbe4d('0x2c')](handleEntityNotFound(_0x30f318,null))[_0xbe4d('0x2c')](function(_0x2e7000){if(_0x2e7000){var _0x1bacf7=_0x2e7000[_0xbe4d('0xb9')]({'plain':!![]});fs[_0xbe4d('0xba')](_0x23bc45);var _0x892874={'channel':_0xbe4d('0xbb'),'account':_0x1bacf7['Account'][_0xbe4d('0x2e')],'agent':_0x1bacf7[_0xbe4d('0xb8')]?_0x1bacf7[_0xbe4d('0xb8')][_0xbe4d('0x88')]:_0xbe4d('0xbc'),'createdAt':moment(_0x1bacf7[_0xbe4d('0xbd')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1bacf7[_0xbe4d('0x67')]?moment(_0x1bacf7[_0xbe4d('0xbe')])[_0xbe4d('0x7b')](_0xbe4d('0xbf'))[_0xbe4d('0xc0')]():'','disposition':_0x1bacf7[_0xbe4d('0x68')],'chatInfo':{'browser':_0x1bacf7[_0xbe4d('0xc1')],'os':_0x1bacf7[_0xbe4d('0xc2')],'referer':_0x1bacf7['referer'],'customerIp':_0x1bacf7[_0xbe4d('0xc3')],'customerPort':_0x1bacf7[_0xbe4d('0xc4')]?_0x1bacf7[_0xbe4d('0xc4')]:_0xbe4d('0xbc')},'messages':_(_0x1bacf7['Messages'])['tail']()[_0xbe4d('0xa8')]({'secret':![]})['map'](function(_0x24fd3e){if(_0x24fd3e[_0xbe4d('0x70')]){var _0x2fe5b8=path[_0xbe4d('0x75')](_0x26e765,_0x24fd3e[_0xbe4d('0x70')][_0xbe4d('0x6d')]);if(fs[_0xbe4d('0xc5')](_0x2fe5b8)){fs['createReadStream'](_0x2fe5b8)[_0xbe4d('0xc6')](fs[_0xbe4d('0xc7')](path[_0xbe4d('0x75')](_0x23bc45,_0x24fd3e['Attachment'][_0xbe4d('0x6d')])));}}return{'date':moment(_0x24fd3e['createdAt'])[_0xbe4d('0x7b')](_0xbe4d('0xbf'))[_0xbe4d('0xc0')](),'sender':_0x24fd3e[_0xbe4d('0x89')]==='out'?_0x24fd3e['User']?_0x24fd3e[_0xbe4d('0x7f')][_0xbe4d('0x88')]:_0xbe4d('0x82'):_0x24fd3e[_0xbe4d('0x62')][_0xbe4d('0xb5')]+(_0x24fd3e[_0xbe4d('0x62')]['lastName']?'\x20'+_0x24fd3e[_0xbe4d('0x62')][_0xbe4d('0xb6')]:''),'body':_0x24fd3e[_0xbe4d('0x70')]?_0x24fd3e[_0xbe4d('0x70')][_0xbe4d('0x6d')]:_0x24fd3e[_0xbe4d('0x49')],'direction':_0x24fd3e[_0xbe4d('0x89')]===_0xbe4d('0x5e')?'A':'C','secret':_0x24fd3e[_0xbe4d('0x8a')],'read':_0x24fd3e[_0xbe4d('0xc8')],'attachment':_0x24fd3e[_0xbe4d('0x70')]};})[_0xbe4d('0xc9')]()};return ejs['renderFile'](path[_0xbe4d('0x75')](config['root'],_0xbe4d('0xca'),'views','downloadInteraction.ejs'),{'interaction':_0x892874})[_0xbe4d('0x2c')](function(_0x4ec3a){var _0x25eab6=path['join'](_0x23bc45,'transcript-'+_0x1bacf7['id']+'-'+_0x34f8c8+'.pdf');var _0x153b13={'path':_0x25eab6,'channel':_0xbe4d('0xbb'),'interactionId':_0x1bacf7['id']};return pdf[_0xbe4d('0xcb')](_0x4ec3a,_0x153b13);})[_0xbe4d('0x2c')](function(){return new Promise(function(_0x1cd4b6,_0x390b18){zipdir(_0x23bc45,{'saveTo':_0x451994},function(_0x36f09c,_0x4c93b4){if(_0x36f09c)return _0x390b18(_0x36f09c);return _0x1cd4b6(_0x4c93b4);});})[_0xbe4d('0x2c')](function(){return new BPromise(function(_0x5a70eb,_0x135fc3){rimraf(_0x23bc45,function(_0x1bebff){if(_0x1bebff)_0x135fc3(_0x1bebff);return _0x5a70eb();});});})[_0xbe4d('0x2c')](function(){return _0x30f318[_0xbe4d('0x78')](_0x451994,_0x443317,function(_0x3c28b8){if(_0x3c28b8){logger[_0xbe4d('0x1d')](_0xbe4d('0xcc'),_0x3c28b8);}else{fs['unlinkSync'](_0x451994);}});});});}else{return _0x30f318[_0xbe4d('0x20')](0xc8);}})[_0xbe4d('0x1f')](handleError(_0x30f318,null));}; \ No newline at end of file +var _0x833b=['UserId','ValidationError','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','Messages','User','CmContact','format','agentAlias','customer','%s%d','ContactId','agentIdentifier','website_alias','System','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','keys','hasOwnProperty','order','sort','where','ChatInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','nolimit','pick','alias','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','push','Contact','lastName','read','Account','get','mkdirSync','Chat','Owner','N.A.','toString','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','createWriteStream','direction','firstName','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','end','status','json','offset','undefined','limit','count','Content-Range','update','destroy','stack','contact','agent','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','findAll','chat','user','catch','show','params','model','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','name','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','metadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus'];(function(_0x465e7c,_0x118e7b){var _0x3535f9=function(_0x8d182f){while(--_0x8d182f){_0x465e7c['push'](_0x465e7c['shift']());}};_0x3535f9(++_0x118e7b);}(_0x833b,0x13b));var _0xb833=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x833b[_0x59ee6f];return _0x4c0979;};'use strict';var rimraf=require(_0xb833('0x0'));var zipdir=require(_0xb833('0x1'));var rp=require('request-promise');var moment=require(_0xb833('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb833('0x3'));var path=require(_0xb833('0x4'));var ejs=require(_0xb833('0x5'));var fs=require('fs');var _=require(_0xb833('0x6'));var Redis=require(_0xb833('0x7'));var interaction=require(_0xb833('0x8'));var qs=require(_0xb833('0x9'));var pdf=require(_0xb833('0xa'));var logger=require('../../config/logger')(_0xb833('0xb'));var config=require(_0xb833('0xc'));var db=require(_0xb833('0xd'))['db'];config[_0xb833('0xe')]=_[_0xb833('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb833('0xe')]));require('./chatInteraction.socket')[_0xb833('0x10')](socket);var jayson=require(_0xb833('0x11'));var client=jayson[_0xb833('0x12')][_0xb833('0x13')]({'port':0x232b});var client9004=jayson[_0xb833('0x12')][_0xb833('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x4fac43,_0x51c6d4,_0x58cc25,_0x59a9d8){return new BPromise(function(_0xf4e4fa,_0x55f294){var _0x4db74c=_0x59a9d8||client;return _0x4db74c['request'](_0x4fac43,_0x58cc25)[_0xb833('0x14')](function(_0x1995e){logger['info'](_0xb833('0x15'),_0x51c6d4,'request\x20sent');logger[_0xb833('0x16')](_0xb833('0x17'),_0x51c6d4,_0xb833('0x18'),JSON[_0xb833('0x19')](_0x1995e));if(_0x1995e[_0xb833('0x1a')]){if(_0x1995e[_0xb833('0x1a')]['code']===0x1f4){logger[_0xb833('0x1a')](_0xb833('0x15'),_0x51c6d4,_0x1995e[_0xb833('0x1a')][_0xb833('0x1b')]);return _0x55f294(_0x1995e['error']['message']);}logger[_0xb833('0x1a')](_0xb833('0x15'),_0x51c6d4,_0x1995e[_0xb833('0x1a')][_0xb833('0x1b')]);return _0xf4e4fa(_0x1995e['error'][_0xb833('0x1b')]);}else{logger[_0xb833('0x1c')](_0xb833('0x15'),_0x51c6d4,'request\x20sent');_0xf4e4fa(_0x1995e[_0xb833('0x1d')][_0xb833('0x1b')]);}})['catch'](function(_0x3c1bc4){logger['error'](_0xb833('0x15'),_0x51c6d4,_0x3c1bc4);_0x55f294(_0x3c1bc4);});});}function respondWithStatusCode(_0x8ebb75,_0x4ac515){_0x4ac515=_0x4ac515||0xcc;return function(_0x16c871){if(_0x16c871){return _0x8ebb75['sendStatus'](_0x4ac515);}return _0x8ebb75['status'](_0x4ac515)[_0xb833('0x1e')]();};}function respondWithResult(_0x2fb6d8,_0x4dcf0d){_0x4dcf0d=_0x4dcf0d||0xc8;return function(_0x5ef3a0){if(_0x5ef3a0){return _0x2fb6d8[_0xb833('0x1f')](_0x4dcf0d)[_0xb833('0x20')](_0x5ef3a0);}};}function respondWithFilteredResult(_0xf2a9c9,_0x51aa19){return function(_0x4c827f){if(_0x4c827f){var _0x1fa532=typeof _0x51aa19[_0xb833('0x21')]===_0xb833('0x22')&&typeof _0x51aa19[_0xb833('0x23')]===_0xb833('0x22');var _0x1acd4a=_0x4c827f['count'];var _0x28e5ae=_0x1fa532?0x0:_0x51aa19[_0xb833('0x21')];var _0x31f5c4=_0x1fa532?_0x4c827f[_0xb833('0x24')]:_0x51aa19[_0xb833('0x21')]+_0x51aa19[_0xb833('0x23')];var _0x515ec5;if(_0x31f5c4>=_0x1acd4a){_0x31f5c4=_0x1acd4a;_0x515ec5=0xc8;}else{_0x515ec5=0xce;}_0xf2a9c9[_0xb833('0x1f')](_0x515ec5);return _0xf2a9c9['set'](_0xb833('0x25'),_0x28e5ae+'-'+_0x31f5c4+'/'+_0x1acd4a)[_0xb833('0x20')](_0x4c827f);}return null;};}function saveUpdates(_0x12be8e){return function(_0x42a89b){if(_0x42a89b){return _0x42a89b[_0xb833('0x26')](_0x12be8e)[_0xb833('0x14')](function(_0x310b66){return _0x310b66;});}return null;};}function removeEntity(_0xbd2c75){return function(_0x56da9d){if(_0x56da9d){return _0x56da9d[_0xb833('0x27')]()[_0xb833('0x14')](function(){_0xbd2c75[_0xb833('0x1f')](0xcc)[_0xb833('0x1e')]();});}};}function handleEntityNotFound(_0x470ed6){return function(_0x7d023c){if(!_0x7d023c){_0x470ed6['sendStatus'](0x194);}return _0x7d023c;};}function handleError(_0x1201cf,_0x2bee99){_0x2bee99=_0x2bee99||0x1f4;return function(_0x1e6b2c){logger[_0xb833('0x1a')](_0x1e6b2c[_0xb833('0x28')]);if(_0x1e6b2c['name']){delete _0x1e6b2c['name'];}_0x1201cf[_0xb833('0x1f')](_0x2bee99)['send'](_0x1e6b2c);};}function getMustacheRender(_0x7cc2b9,_0x16acca){return Mustache['render'](_0x7cc2b9,_['merge'](_0x16acca['body'],{'contact':_0x16acca[_0xb833('0x29')],'message':_0x16acca['message'],'agent':_0x16acca[_0xb833('0x2a')],'interaction':_0x16acca[_0xb833('0x2b')],'account':_0x16acca['account']}))||'';}exports[_0xb833('0x2c')]=function(_0x34d610,_0x4dfb66){var _0x1bee57={};var _0x44d976=_[_0xb833('0x2d')](db[_0xb833('0x2e')][_0xb833('0x2f')],function(_0x307bc1){return{'name':_0x307bc1[_0xb833('0x30')],'type':_0x307bc1[_0xb833('0x31')][_0xb833('0x32')]};});_0x1bee57=qs['getOptions'](_0x44d976,_0x34d610);return interaction[_0xb833('0x33')](_0xb833('0x34'),_0x34d610['query'],_0x34d610[_0xb833('0x35')],_0x1bee57,_0x44d976)[_0xb833('0x14')](respondWithFilteredResult(_0x4dfb66,_0x1bee57))[_0xb833('0x36')](handleError(_0x4dfb66,null));};exports[_0xb833('0x37')]=function(_0x44121e,_0x114d02){var _0x558157={'raw':![],'where':{'id':_0x44121e[_0xb833('0x38')]['id']}},_0x7b4612={};_0x7b4612[_0xb833('0x39')]=_['keys'](db['ChatInteraction'][_0xb833('0x2f')]);_0x7b4612[_0xb833('0x3a')]=_['keys'](_0x44121e[_0xb833('0x3a')]);_0x7b4612[_0xb833('0x3b')]=_[_0xb833('0x3c')](_0x7b4612[_0xb833('0x39')],_0x7b4612[_0xb833('0x3a')]);_0x558157[_0xb833('0x3d')]=_[_0xb833('0x3c')](_0x7b4612['model'],qs[_0xb833('0x3e')](_0x44121e[_0xb833('0x3a')][_0xb833('0x3e')]));_0x558157[_0xb833('0x3d')]=_0x558157[_0xb833('0x3d')][_0xb833('0x3f')]?_0x558157[_0xb833('0x3d')]:_0x7b4612[_0xb833('0x39')];if(_0x44121e[_0xb833('0x3a')][_0xb833('0x40')]){_0x558157[_0xb833('0x41')]=[{'all':!![]}];}_0x558157=_['merge']({},_0x558157,_0x44121e[_0xb833('0x42')]);return db['ChatInteraction'][_0xb833('0x43')](_0x558157)[_0xb833('0x14')](handleEntityNotFound(_0x114d02,null))[_0xb833('0x14')](respondWithResult(_0x114d02,null))[_0xb833('0x36')](handleError(_0x114d02,null));};exports[_0xb833('0x44')]=function(_0x2b21cd,_0x47b5f4){return db[_0xb833('0x2e')][_0xb833('0x44')](_0x2b21cd['body'],{})[_0xb833('0x14')](respondWithResult(_0x47b5f4,0xc9))[_0xb833('0x36')](handleError(_0x47b5f4,null));};exports[_0xb833('0x26')]=function(_0x16eefa,_0xa4ba08){if(_0x16eefa['body']['id']){delete _0x16eefa[_0xb833('0x45')]['id'];}return db[_0xb833('0x2e')]['find']({'where':{'id':_0x16eefa[_0xb833('0x38')]['id']}})[_0xb833('0x14')](handleEntityNotFound(_0xa4ba08,null))['then'](saveUpdates(_0x16eefa[_0xb833('0x45')],null))[_0xb833('0x14')](respondWithResult(_0xa4ba08,null))['catch'](handleError(_0xa4ba08,null));};exports[_0xb833('0x27')]=function(_0x1501ff,_0x619b97){return db['ChatInteraction'][_0xb833('0x43')]({'where':{'id':_0x1501ff['params']['id']}})[_0xb833('0x14')](handleEntityNotFound(_0x619b97,null))[_0xb833('0x14')](removeEntity(_0x619b97,null))['catch'](handleError(_0x619b97,null));};exports[_0xb833('0x46')]=function(_0x34463c,_0x3f158f){return db[_0xb833('0x2e')][_0xb833('0x46')]()[_0xb833('0x14')](respondWithResult(_0x3f158f,null))['catch'](handleError(_0x3f158f,null));};exports[_0xb833('0x47')]=function(_0x3c1231,_0x2bf41f){var _0x3c2ba1=_0x3c1231[_0xb833('0x38')]['id'];var _0xeb7726;var _0x3984a9;var _0x261215;return db[_0xb833('0x2e')]['findOne']({'where':{'id':_0x3c2ba1}})[_0xb833('0x14')](function(_0x5749e2){_0xeb7726=_0x5749e2;return db[_0xb833('0x48')][_0xb833('0x49')]({'where':{'id':_0x5749e2[_0xb833('0x4a')]},'attributes':['id',_0xb833('0x4b'),_0xb833('0x4c'),_0xb833('0x4d'),'vidaooNote',_0xb833('0x4e')],'raw':!![]});})[_0xb833('0x14')](function(_0x2fedd6){if(_0x2fedd6&&_0x2fedd6[_0xb833('0x4b')]&&_0x2fedd6[_0xb833('0x4c')]){_0x3984a9=_0x2fedd6;var _0x18aa17={'interaction':{'id':_0x3c2ba1},'agent':{'id':_0x3c1231[_0xb833('0x35')]['id'],'name':_0x3c1231[_0xb833('0x35')][_0xb833('0x4f')],'fullname':_0x3c1231['user'][_0xb833('0x50')],'email':_0x3c1231[_0xb833('0x35')][_0xb833('0x51')]},'contact':_0x3c1231['body']['contact'],'account':_0x3c1231['body'][_0xb833('0x52')]};var _0x397179={'rejectUnauthorized':![],'method':_0xb833('0x53'),'url':_0xb833('0x54'),'headers':{'X-APIKEY':_0x2fedd6[_0xb833('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3c1231[_0xb833('0x35')][_0xb833('0x51')]],'buttons':null,'topic':_0x3984a9[_0xb833('0x4d')],'note':_[_0xb833('0x55')](_0x3984a9[_0xb833('0x56')])?null:getMustacheRender(_0x3984a9['vidaooNote'],_0x18aa17),'metadata':null},'redirect':_0xb833('0x57'),'json':!![]};try{if(!_[_0xb833('0x55')](_0x3984a9[_0xb833('0x4e')])){var _0x599691=getMustacheRender(_0x3984a9[_0xb833('0x4e')],_0x18aa17);var _0x10d90e=JSON[_0xb833('0x58')](_0x599691);_0x397179[_0xb833('0x45')][_0xb833('0x59')]=_0x10d90e;}}catch(_0x302d8c){throw new db[(_0xb833('0x5a'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x397179);}else{throw new db[(_0xb833('0x5a'))]['ValidationError'](_0xb833('0x5b'));}})[_0xb833('0x14')](function(_0x205658){_0x261215=_0x205658;if(_0x261215['id']){var _0x3d05e1={'body':_0x261215['join_url'],'ChatWebsiteId':_0x3984a9['id'],'ChatInteractionId':_0xeb7726['id'],'direction':_0xb833('0x5c'),'UserId':_0x3c1231[_0xb833('0x35')]['id']};return db[_0xb833('0x5d')][_0xb833('0x44')](_0x3d05e1,{});}else{throw new db['Sequelize']['ValidationError'](_0xb833('0x5e'));}})[_0xb833('0x14')](function(){return _0xeb7726[_0xb833('0x5f')]({'vidaooSessionId':_0x261215['id']});})[_0xb833('0x14')](respondWithResult(_0x2bf41f,null))[_0xb833('0x36')](handleError(_0x2bf41f,null));};exports[_0xb833('0x60')]=function(_0x508b0e,_0x3e5f1e){if(_0x508b0e[_0xb833('0x45')]['id']){delete _0x508b0e[_0xb833('0x45')]['id'];}return db[_0xb833('0x2e')][_0xb833('0x43')]({'where':{'id':_0x508b0e[_0xb833('0x38')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xb833('0x14')](handleEntityNotFound(_0x3e5f1e,null))[_0xb833('0x14')](saveUpdates(_0x508b0e['body'],null))[_0xb833('0x14')](respondWithResult(_0x3e5f1e,null))[_0xb833('0x36')](handleError(_0x3e5f1e,null));};exports[_0xb833('0x61')]=function(_0x16272d,_0x51faea){if(_0x16272d[_0xb833('0x45')]['id']){delete _0x16272d[_0xb833('0x45')]['id'];}return db[_0xb833('0x2e')][_0xb833('0x43')]({'where':{'id':_0x16272d['params']['id']}})[_0xb833('0x14')](function(_0x46a993){if(!_0x46a993){logger['error'](_0xb833('0x62'),_0xb833('0x61'),0x194,_0xb833('0x63'));_0x51faea[_0xb833('0x64')](0x194);}else{if(_0x46a993[_0xb833('0x65')]){throw new db['Sequelize'][(_0xb833('0x66'))](_0xb833('0x67'));}}return _0x46a993;})[_0xb833('0x14')](function(_0x3c81f3){if(_0x3c81f3){return _0x3c81f3[_0xb833('0x26')]({'closed':_0x16272d[_0xb833('0x45')][_0xb833('0x68')],'disposition':_0x16272d[_0xb833('0x45')][_0xb833('0x69')]})[_0xb833('0x14')](function(_0x342d32){return _0x342d32;});}})[_0xb833('0x14')](function(){return respondWithRpcPromise(_0xb833('0x6a'),_0xb833('0x61'),_0x16272d[_0xb833('0x45')],client9004);})[_0xb833('0x14')](respondWithResult(_0x51faea,null))[_0xb833('0x36')](handleError(_0x51faea,null));};exports[_0xb833('0x6b')]=function(_0x4edeac,_0x5e0bc1){_0x4edeac[_0xb833('0x45')][_0xb833('0x4f')]=_0x4edeac[_0xb833('0x6c')][_0xb833('0x6d')];_0x4edeac['body'][_0xb833('0x6e')]=_0x4edeac['file'][_0xb833('0x6f')];_0x4edeac['body'][_0xb833('0x31')]=_0x4edeac['file'][_0xb833('0x70')];return db[_0xb833('0x71')][_0xb833('0x44')](_0x4edeac['body'])[_0xb833('0x14')](respondWithResult(_0x5e0bc1,0xc9))['catch'](handleError(_0x5e0bc1,null));};exports[_0xb833('0x72')]=function(_0x452cc5,_0x36aa23){return db['ChatInteraction'][_0xb833('0x49')]({'where':{'id':_0x452cc5['params']['id']},'raw':!![]})[_0xb833('0x14')](handleEntityNotFound(_0x36aa23,null))[_0xb833('0x14')](function(_0x323748){if(_0x323748){if(_0x323748['closed']){return _0x36aa23[_0xb833('0x1f')](0x193)[_0xb833('0x20')]({'status':0x193,'message':'Unauthorized'});}return db[_0xb833('0x71')][_0xb833('0x49')]({'where':{'id':_0x452cc5[_0xb833('0x3a')][_0xb833('0x73')]},'raw':!![]})['then'](handleEntityNotFound(_0x36aa23,null));}})['then'](function(_0x5bd92d){if(_0x5bd92d){var _0x4503e6=_0x5bd92d[_0xb833('0x74')]!==null;var _0x4c7eaf=path[_0xb833('0x75')](config[_0xb833('0x76')],'server/files/attachments/');if(_0x4503e6){_0x4c7eaf=path[_0xb833('0x75')](_0x4c7eaf,_0xb833('0x77'));}var _0xc1d8e=path[_0xb833('0x75')](_0x4c7eaf,_0x5bd92d[_0xb833('0x6e')]);return _0x36aa23[_0xb833('0x78')](_0xc1d8e);}})[_0xb833('0x36')](handleError(_0x36aa23,null));};exports[_0xb833('0x79')]=function(_0x1693e0,_0x36e3ed){var _0x4235d7=null;var _0x12457c=null;var _0x44cb1f=null;if(_0x1693e0[_0xb833('0x45')]['id']){delete _0x1693e0[_0xb833('0x45')]['id'];}if(_0x1693e0[_0xb833('0x45')][_0xb833('0x7a')]){_0x44cb1f=path[_0xb833('0x75')](config[_0xb833('0x76')],_0xb833('0x7b'),util['format']('transcript-%s.txt',Date[_0xb833('0x7c')]()));_0x1693e0[_0xb833('0x45')][_0xb833('0x7d')]=_0x44cb1f;}return db[_0xb833('0x2e')][_0xb833('0x43')]({'where':{'id':_0x1693e0['params']['id']},'include':[{'model':db[_0xb833('0x5d')],'as':_0xb833('0x7e'),'include':[{'model':db['User'],'as':_0xb833('0x7f')}]}]})[_0xb833('0x14')](handleEntityNotFound(_0x36e3ed,null))[_0xb833('0x14')](saveUpdates(_0x1693e0[_0xb833('0x45')],null))[_0xb833('0x14')](function(_0x277c68){if(_0x277c68){_0x4235d7=_0x277c68;return db[_0xb833('0x48')][_0xb833('0x43')]({'where':{'id':_0x4235d7[_0xb833('0x4a')]}});}})['then'](function(_0x5cc510){if(_0x5cc510){_0x12457c=_0x5cc510;return db[_0xb833('0x80')][_0xb833('0x43')]({'where':{'id':_0x4235d7['ContactId']}});}})[_0xb833('0x14')](function(_0x59574f){if(_0x59574f){if(_0x44cb1f){var _0x1dc431=null;for(var _0x5313f9=0x1;_0x5313f9<_0x4235d7[_0xb833('0x7e')][_0xb833('0x3f')];++_0x5313f9){_0x1dc431=_0x4235d7['Messages'][_0x5313f9];var _0x103457=_0x1dc431['UserId']?util[_0xb833('0x81')]('%s%d',_0x12457c[_0xb833('0x82')],_0x1dc431[_0xb833('0x65')]):'System';var _0x428e71=_0x1693e0[_0xb833('0x45')][_0xb833('0x83')]||util[_0xb833('0x81')](_0xb833('0x84'),'Visitor',_0x1dc431[_0xb833('0x85')]);switch(_0x12457c[_0xb833('0x86')]){case _0xb833('0x87'):_0x103457=_0x1dc431['UserId']?util[_0xb833('0x81')](_0xb833('0x84'),_0x12457c['agentAlias'],_0x1dc431[_0xb833('0x65')]):_0xb833('0x88');break;case _0xb833('0x89'):_0x103457=_0x1dc431[_0xb833('0x65')]?_0x1dc431[_0xb833('0x7f')]['alias']||_0x1dc431[_0xb833('0x7f')][_0xb833('0x50')]:_0xb833('0x88');break;case _0xb833('0x8a'):_0x103457=_0x1dc431[_0xb833('0x65')]?_0x1dc431[_0xb833('0x7f')]['fullname']:'System';break;default:_0x103457=_0x1dc431[_0xb833('0x65')]?util[_0xb833('0x81')]('%s%d',_0x12457c[_0xb833('0x82')],_0x1dc431[_0xb833('0x65')]):_0xb833('0x88');}var _0x13d8eb=util[_0xb833('0x81')](_0xb833('0x8b'),moment(_0x1dc431[_0xb833('0x8c')])[_0xb833('0x81')]('MM/DD/YYYY\x20HH:mm:ss'),_0x1dc431['direction']==='in'?_0x428e71:_0x103457,_0x1dc431[_0xb833('0x45')]);if(!_0x1dc431[_0xb833('0x8d')]){fs[_0xb833('0x8e')](_0x44cb1f,_0x13d8eb);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xb833('0x8f')],'as':_0xb833('0x90'),'raw':!![],'include':[{'model':db[_0xb833('0x91')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xb833('0x14')](function(_0x105f25){if(!_0x105f25||!_0x105f25[_0xb833('0x90')]||!_0x1693e0['body'])return _0x4235d7;var _0x4fd304=_0x105f25['getSmtpOptions']();return respondWithRpcPromise(_0xb833('0x92'),_0xb833('0x93'),{'account':_0x4fd304,'message':{'from':util[_0xb833('0x81')](_0xb833('0x94'),_0x105f25['name'],_0x105f25['email']||_0x105f25['Smtp'][_0xb833('0x35')]),'to':_0x1693e0[_0xb833('0x45')][_0xb833('0x7a')],'subject':'Mail\x20Transcript','text':util[_0xb833('0x81')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x1693e0['body'][_0xb833('0x7a')]),'attachments':[{'path':_0x44cb1f}]}})[_0xb833('0x14')](function(){return _0x4235d7;})[_0xb833('0x36')](function(_0x46f45f){logger[_0xb833('0x1a')](_0x46f45f);});})[_0xb833('0x14')](respondWithStatusCode(_0x36e3ed,0xc8))[_0xb833('0x36')](handleError(_0x36e3ed,null));};exports[_0xb833('0x95')]=function(_0x927fc,_0x1f2d53){return db[_0xb833('0x5d')]['find']({'where':{'id':_0x927fc['params']['id']}})[_0xb833('0x14')](handleEntityNotFound(_0x1f2d53,null))[_0xb833('0x14')](function(_0x2c7e5b){if(_0x2c7e5b){return _0x2c7e5b['addMessage'](_0x927fc[_0xb833('0x45')][_0xb833('0x96')],_[_0xb833('0x97')](_0x927fc[_0xb833('0x45')],[_0xb833('0x96'),'id'])||{});}})['then'](respondWithResult(_0x1f2d53,null))[_0xb833('0x36')](handleError(_0x1f2d53,null));};exports[_0xb833('0x98')]=function(_0xd8d92b,_0x57c252){var _0x101360={'raw':![],'where':{}};var _0x1b9730={};var _0x170e79={'count':0x0,'rows':[]};return db[_0xb833('0x2e')][_0xb833('0x49')]({'where':{'id':_0xd8d92b['params']['id']}})[_0xb833('0x14')](handleEntityNotFound(_0x57c252,null))[_0xb833('0x14')](function(_0x33df35){if(_0x33df35){_0x1b9730[_0xb833('0x39')]=_[_0xb833('0x99')](db[_0xb833('0x5d')][_0xb833('0x2f')]);_0x1b9730['query']=_[_0xb833('0x99')](_0xd8d92b[_0xb833('0x3a')]);_0x1b9730[_0xb833('0x3b')]=_[_0xb833('0x3c')](_0x1b9730['model'],_0x1b9730[_0xb833('0x3a')]);_0x101360[_0xb833('0x3d')]=_[_0xb833('0x3c')](_0x1b9730[_0xb833('0x39')],qs[_0xb833('0x3e')](_0xd8d92b[_0xb833('0x3a')][_0xb833('0x3e')]));_0x101360[_0xb833('0x3d')]=_0x101360[_0xb833('0x3d')][_0xb833('0x3f')]?_0x101360[_0xb833('0x3d')]:_0x1b9730[_0xb833('0x39')];if(!_0xd8d92b['query'][_0xb833('0x9a')]('nolimit')){_0x101360[_0xb833('0x23')]=qs[_0xb833('0x23')](_0xd8d92b['query'][_0xb833('0x23')]);_0x101360[_0xb833('0x21')]=qs['offset'](_0xd8d92b[_0xb833('0x3a')]['offset']);}_0x101360[_0xb833('0x9b')]=qs[_0xb833('0x9c')](_0xd8d92b[_0xb833('0x3a')][_0xb833('0x9c')]);_0x101360[_0xb833('0x9d')]=qs[_0xb833('0x3b')](_['pick'](_0xd8d92b[_0xb833('0x3a')],_0x1b9730[_0xb833('0x3b')]));_0x101360[_0xb833('0x9d')][_0xb833('0x9e')]=_0x33df35['id'];if(_0xd8d92b[_0xb833('0x3a')][_0xb833('0x9f')]){_0x101360[_0xb833('0x9d')]=_[_0xb833('0xa0')](_0x101360['where'],{'$or':_[_0xb833('0x2d')](_0x101360['attributes'],function(_0x262f89){var _0x18ec5c={};_0x18ec5c[_0x262f89]={'$like':'%'+_0xd8d92b[_0xb833('0x3a')][_0xb833('0x9f')]+'%'};return _0x18ec5c;})});}if(_0xd8d92b[_0xb833('0x3a')]['$gte']){var _0x576f25=_0xd8d92b[_0xb833('0x3a')][_0xb833('0xa1')][_0xb833('0xa2')](',');var _0x4e04f6={};_0x4e04f6[_0x576f25[0x0]]={'$gte':moment(_0x576f25[0x1])[_0xb833('0x81')](_0xb833('0xa3'))};_0x101360[_0xb833('0x9d')]=_[_0xb833('0xa0')](_0x101360[_0xb833('0x9d')],_0x4e04f6);}_0x101360=_[_0xb833('0xa0')]({},_0x101360,_0xd8d92b['options']);return db[_0xb833('0x5d')][_0xb833('0x24')]({'where':_0x101360[_0xb833('0x9d')]})[_0xb833('0x14')](function(_0x3d41a6){_0x170e79[_0xb833('0x24')]=_0x3d41a6;if(_0xd8d92b[_0xb833('0x3a')][_0xb833('0x40')]){_0x101360['include']=[{'all':!![]}];}return db[_0xb833('0x5d')][_0xb833('0x33')](_0x101360);})[_0xb833('0x14')](function(_0x26858a){_0x170e79[_0xb833('0xa4')]=_0x26858a;return _0x170e79;});}})[_0xb833('0x14')](respondWithFilteredResult(_0x57c252,_0x101360))[_0xb833('0x36')](handleError(_0x57c252,null));};exports['getMyMessages']=function(_0x4c9e9e,_0x41d48f){var _0x18c603={'where':{}},_0x21f27a={},_0x4daa4d={'count':0x0,'rows':[]};return db[_0xb833('0x2e')][_0xb833('0x49')]({'where':{'id':_0x4c9e9e[_0xb833('0x38')]['id']}})[_0xb833('0x14')](handleEntityNotFound(_0x41d48f,null))[_0xb833('0x14')](function(_0x4f04c4){if(_0x4f04c4){_0x21f27a[_0xb833('0x39')]=_[_0xb833('0x99')](db[_0xb833('0x5d')][_0xb833('0x2f')]);_0x21f27a[_0xb833('0x3a')]=_[_0xb833('0x99')](_0x4c9e9e['query']);_0x21f27a[_0xb833('0x3b')]=_[_0xb833('0x3c')](_0x21f27a[_0xb833('0x39')],_0x21f27a[_0xb833('0x3a')]);_0x18c603['attributes']=_[_0xb833('0x3c')](_0x21f27a[_0xb833('0x39')],qs[_0xb833('0x3e')](_0x4c9e9e[_0xb833('0x3a')]['fields']));_0x18c603[_0xb833('0x3d')]=_0x18c603[_0xb833('0x3d')]['length']?_0x18c603['attributes']:_0x21f27a[_0xb833('0x39')];if(!_0x4c9e9e[_0xb833('0x3a')][_0xb833('0x9a')](_0xb833('0xa5'))){_0x18c603[_0xb833('0x23')]=qs[_0xb833('0x23')](_0x4c9e9e[_0xb833('0x3a')][_0xb833('0x23')]);_0x18c603['offset']=qs['offset'](_0x4c9e9e[_0xb833('0x3a')][_0xb833('0x21')]);}_0x18c603[_0xb833('0x9b')]=qs[_0xb833('0x9c')](_0x4c9e9e[_0xb833('0x3a')][_0xb833('0x9c')]);_0x18c603[_0xb833('0x9d')]=qs[_0xb833('0x3b')](_[_0xb833('0xa6')](_0x4c9e9e[_0xb833('0x3a')],_0x21f27a[_0xb833('0x3b')]));_0x18c603[_0xb833('0x9d')][_0xb833('0x9e')]=_0x4f04c4['id'];if(_0x4c9e9e[_0xb833('0x3a')][_0xb833('0x9f')]){_0x18c603[_0xb833('0x9d')]=_[_0xb833('0xa0')](_0x18c603['where'],{'$or':_[_0xb833('0x2d')](_0x18c603[_0xb833('0x3d')],function(_0x323512){var _0x51d0a5={};_0x51d0a5[_0x323512]={'$like':'%'+_0x4c9e9e[_0xb833('0x3a')][_0xb833('0x9f')]+'%'};return _0x51d0a5;})});}_0x18c603['where']['secret']=![];if(_0x4c9e9e[_0xb833('0x3a')]['id']){_0x18c603['where']['id']={'$gt':_0x4c9e9e[_0xb833('0x3a')]['id']};}_0x18c603=_['merge']({},_0x18c603,_0x4c9e9e[_0xb833('0x42')]);return db['ChatMessage']['count']({'where':_0x18c603['where']})[_0xb833('0x14')](function(_0x2bd17f){_0x4daa4d[_0xb833('0x24')]=_0x2bd17f;_0x18c603[_0xb833('0x41')]=[];if(_0x4c9e9e['query']['includeAgent']){_0x18c603['include']['push']({'model':db[_0xb833('0x7f')],'as':_0xb833('0x7f'),'attributes':['id',_0xb833('0x50'),_0xb833('0xa7')]});}if(_0x4c9e9e[_0xb833('0x3a')][_0xb833('0x40')]){_0x18c603[_0xb833('0x41')]=[{'all':!![]}];}return db[_0xb833('0x5d')]['findAll'](_0x18c603);})[_0xb833('0x14')](function(_0x39f7b7){_0x4daa4d[_0xb833('0xa4')]=_0x39f7b7;return _0x4daa4d;});}})[_0xb833('0x14')](respondWithFilteredResult(_0x41d48f,_0x18c603))[_0xb833('0x36')](handleError(_0x41d48f,null));};exports['addTags']=function(_0x148a72,_0x4a1ff4){return db[_0xb833('0x2e')][_0xb833('0x43')]({'where':{'id':_0x148a72[_0xb833('0x38')]['id']}})[_0xb833('0x14')](handleEntityNotFound(_0x4a1ff4,null))[_0xb833('0x14')](function(_0x1b6c1e){if(_0x1b6c1e){return _0x1b6c1e[_0xb833('0xa8')](_0x148a72[_0xb833('0x45')][_0xb833('0x96')],_[_0xb833('0x97')](_0x148a72[_0xb833('0x45')],[_0xb833('0x96'),'id'])||{})[_0xb833('0xa9')](function(){return db['Tag'][_0xb833('0x33')]({'attributes':['id',_0xb833('0x4f'),_0xb833('0xaa')],'where':{'id':_0x148a72[_0xb833('0x45')][_0xb833('0x96')]}});})[_0xb833('0x14')](function(_0x4c692c){socket[_0xb833('0xab')](_0xb833('0xac'),{'id':Number(_0x148a72[_0xb833('0x38')]['id']),'tags':_0x4c692c||[]});return{'id':Number(_0x148a72[_0xb833('0x38')]['id']),'tags':_0x4c692c||[]};});}})[_0xb833('0x14')](respondWithResult(_0x4a1ff4,null))['catch'](handleError(_0x4a1ff4,null));};exports['removeTags']=function(_0x3a39fe,_0x50993b){return db[_0xb833('0x2e')]['find']({'where':{'id':_0x3a39fe['params']['id']}})[_0xb833('0x14')](handleEntityNotFound(_0x50993b,null))[_0xb833('0x14')](function(_0x1102e9){if(_0x1102e9){return _0x1102e9[_0xb833('0xad')](_0x3a39fe['query'][_0xb833('0x96')]);}})[_0xb833('0x14')](respondWithStatusCode(_0x50993b,null))['catch'](handleError(_0x50993b,null));};exports['download']=function(_0x22c6ce,_0x1c98d0){var _0xb4f9f=moment()[_0xb833('0xae')]()['toString']();var _0x34401c=path[_0xb833('0x75')](config[_0xb833('0x76')],'server',_0xb833('0xaf'),_0xb833('0xb0'));var _0x1c003f=path['join'](config[_0xb833('0x76')],_0xb833('0xb1'),_0xb833('0xaf'),_0xb833('0xb2'));var _0x55fa01=path['join'](_0x34401c,_0xb4f9f);var _0x28d324=util[_0xb833('0x81')](_0xb833('0xb3'),_0x22c6ce[_0xb833('0x38')]['id'],_0xb4f9f);var _0x402462=path['join'](_0x34401c,_0x28d324);var _0x4ba028=[];_0x4ba028['push']({'model':db['User'],'as':'User','attributes':['id',_0xb833('0x50')],'raw':!![]});_0x4ba028[_0xb833('0xb4')]({'model':db[_0xb833('0x80')],'as':_0xb833('0xb5'),'attributes':['id','firstName',_0xb833('0xb6')],'raw':!![]});if(_0x22c6ce[_0xb833('0x3a')]['attachments']){_0x4ba028[_0xb833('0xb4')]({'model':db[_0xb833('0x71')],'as':_0xb833('0x71'),'raw':!![]});}var _0xaa6ace=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0xb833('0x45'),'createdAt','direction',_0xb833('0x8d'),_0xb833('0xb7')],'include':_0x4ba028}];_0xaa6ace[_0xb833('0xb4')]({'model':db['ChatWebsite'],'as':_0xb833('0xb8'),'attributes':['id','name']});_0xaa6ace[_0xb833('0xb4')]({'model':db[_0xb833('0x7f')],'as':'Owner','attributes':['id',_0xb833('0x50')]});return db[_0xb833('0x2e')][_0xb833('0x43')]({'where':{'id':_0x22c6ce[_0xb833('0x38')]['id']},'include':_0xaa6ace})[_0xb833('0x14')](handleEntityNotFound(_0x1c98d0,null))[_0xb833('0x14')](function(_0x5c4fd6){if(_0x5c4fd6){var _0x57b908=_0x5c4fd6[_0xb833('0xb9')]({'plain':!![]});fs[_0xb833('0xba')](_0x55fa01);var _0x568d9c={'channel':_0xb833('0xbb'),'account':_0x57b908[_0xb833('0xb8')][_0xb833('0x4f')],'agent':_0x57b908[_0xb833('0xbc')]?_0x57b908['Owner'][_0xb833('0x50')]:_0xb833('0xbd'),'createdAt':moment(_0x57b908[_0xb833('0x8c')])[_0xb833('0x81')](_0xb833('0xa3'))[_0xb833('0xbe')](),'closedAt':_0x57b908[_0xb833('0x68')]?moment(_0x57b908[_0xb833('0xbf')])[_0xb833('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb833('0xbe')]():'','disposition':_0x57b908[_0xb833('0x69')],'chatInfo':{'browser':_0x57b908[_0xb833('0xc0')],'os':_0x57b908[_0xb833('0xc1')],'referer':_0x57b908[_0xb833('0xc2')],'customerIp':_0x57b908['customerIp'],'customerPort':_0x57b908['customerPort']?_0x57b908[_0xb833('0xc3')]:_0xb833('0xbd')},'messages':_(_0x57b908[_0xb833('0x7e')])[_0xb833('0xc4')]()['filter']({'secret':![]})['map'](function(_0x36a7f9){if(_0x36a7f9[_0xb833('0x71')]){var _0x389d01=path['join'](_0x1c003f,_0x36a7f9[_0xb833('0x71')][_0xb833('0x6e')]);if(fs['existsSync'](_0x389d01)){fs[_0xb833('0xc5')](_0x389d01)['pipe'](fs[_0xb833('0xc6')](path[_0xb833('0x75')](_0x55fa01,_0x36a7f9['Attachment']['basename'])));}}return{'date':moment(_0x36a7f9[_0xb833('0x8c')])[_0xb833('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb833('0xbe')](),'sender':_0x36a7f9[_0xb833('0xc7')]===_0xb833('0x5c')?_0x36a7f9[_0xb833('0x7f')]?_0x36a7f9['User']['fullname']:_0xb833('0x88'):_0x36a7f9[_0xb833('0xb5')][_0xb833('0xc8')]+(_0x36a7f9['Contact'][_0xb833('0xb6')]?'\x20'+_0x36a7f9['Contact'][_0xb833('0xb6')]:''),'body':_0x36a7f9[_0xb833('0x71')]?_0x36a7f9[_0xb833('0x71')][_0xb833('0x6e')]:_0x36a7f9[_0xb833('0x45')],'direction':_0x36a7f9['direction']===_0xb833('0x5c')?'A':'C','secret':_0x36a7f9['secret'],'read':_0x36a7f9[_0xb833('0xb7')],'attachment':_0x36a7f9[_0xb833('0x71')]};})['value']()};return ejs[_0xb833('0xc9')](path[_0xb833('0x75')](config[_0xb833('0x76')],_0xb833('0xb1'),'views',_0xb833('0xca')),{'interaction':_0x568d9c})['then'](function(_0x2e9b8e){var _0x4fc710=path['join'](_0x55fa01,_0xb833('0xcb')+_0x57b908['id']+'-'+_0xb4f9f+_0xb833('0xcc'));var _0x309125={'path':_0x4fc710,'channel':_0xb833('0xbb'),'interactionId':_0x57b908['id']};return pdf[_0xb833('0xcd')](_0x2e9b8e,_0x309125);})[_0xb833('0x14')](function(){return new Promise(function(_0x553313,_0x2a9e9f){zipdir(_0x55fa01,{'saveTo':_0x402462},function(_0x39f6b7,_0x22beb7){if(_0x39f6b7)return _0x2a9e9f(_0x39f6b7);return _0x553313(_0x22beb7);});})[_0xb833('0x14')](function(){return new BPromise(function(_0x42da58,_0x2e7c18){rimraf(_0x55fa01,function(_0x1b2d2c){if(_0x1b2d2c)_0x2e7c18(_0x1b2d2c);return _0x42da58();});});})[_0xb833('0x14')](function(){return _0x1c98d0[_0xb833('0x78')](_0x402462,_0x28d324,function(_0x235be5){if(_0x235be5){logger[_0xb833('0x1a')](_0xb833('0xce'),_0x235be5);}else{fs[_0xb833('0xcf')](_0x402462);}});});});}else{return _0x1c98d0[_0xb833('0x64')](0xc8);}})[_0xb833('0x36')](handleError(_0x1c98d0,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a0351c8..440b0c6 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 _0xb01c=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','Users','map','then','setDataValue','unreadMessages','length','emit'];(function(_0x12108d,_0x325b74){var _0x324c85=function(_0x5afb3e){while(--_0x5afb3e){_0x12108d['push'](_0x12108d['shift']());}};_0x324c85(++_0x325b74);}(_0xb01c,0x194));var _0xcb01=function(_0x2ad472,_0x13530f){_0x2ad472=_0x2ad472-0x0;var _0x24069f=_0xb01c[_0x2ad472];return _0x24069f;};'use strict';var EventEmitter=require(_0xcb01('0x0'));var ChatInteraction=require(_0xcb01('0x1'))['db'][_0xcb01('0x2')];var ChatMessage=require(_0xcb01('0x1'))['db'][_0xcb01('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xcb01('0x4')](0x0);var events={'afterCreate':_0xcb01('0x5'),'afterUpdate':_0xcb01('0x6'),'afterDestroy':_0xcb01('0x7')};function emitEvent(_0x245d7f){return function(_0x3a29ea,_0x3e4dcd,_0x44e7a4){_0x3a29ea[_0xcb01('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x738620){_0x3a29ea['setDataValue'](_0xcb01('0x9'),_0x738620[_0xcb01('0xa')](function(_0x55fe2c){return{'id':_0x55fe2c['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3a29ea['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcb01('0xb')](function(_0x4c775e){_0x3a29ea[_0xcb01('0xc')](_0xcb01('0xd'),_0x4c775e[_0xcb01('0xe')]);ChatInteractionEvents[_0xcb01('0xf')](_0x245d7f+':'+_0x3a29ea['id'],_0x3a29ea);ChatInteractionEvents[_0xcb01('0xf')](_0x245d7f,_0x3a29ea);_0x44e7a4(null);})[_0xcb01('0x10')](_0x44e7a4(null));};}for(var e in events){if(events[_0xcb01('0x11')](e)){var event=events[e];ChatInteraction[_0xcb01('0x12')](e,emitEvent(event));}}module[_0xcb01('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0x6d12=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x32912e,_0x43f6f4){var _0xe6fbe4=function(_0x48edce){while(--_0x48edce){_0x32912e['push'](_0x32912e['shift']());}};_0xe6fbe4(++_0x43f6f4);}(_0x6d12,0xbb));var _0x26d1=function(_0x3372fa,_0x50fbc3){_0x3372fa=_0x3372fa-0x0;var _0x4d436c=_0x6d12[_0x3372fa];return _0x4d436c;};'use strict';var EventEmitter=require(_0x26d1('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x26d1('0x1'))['db'][_0x26d1('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x26d1('0x3')](0x0);var events={'afterCreate':_0x26d1('0x4'),'afterUpdate':_0x26d1('0x5'),'afterDestroy':_0x26d1('0x6')};function emitEvent(_0x271a8c){return function(_0x311958,_0x4960f4,_0x1cc715){_0x311958[_0x26d1('0x7')]({'attributes':['id'],'raw':!![]})[_0x26d1('0x8')](function(_0x2112c6){_0x311958[_0x26d1('0x9')](_0x26d1('0xa'),_0x2112c6['map'](function(_0x1f82dd){return{'id':_0x1f82dd['id']};}));return ChatMessage[_0x26d1('0xb')]({'where':{'ChatInteractionId':_0x311958['id'],'direction':'in','read':![]},'raw':!![]});})[_0x26d1('0x8')](function(_0x2ea1ae){_0x311958[_0x26d1('0x9')](_0x26d1('0xc'),_0x2ea1ae['length']);ChatInteractionEvents[_0x26d1('0xd')](_0x271a8c+':'+_0x311958['id'],_0x311958);ChatInteractionEvents[_0x26d1('0xd')](_0x271a8c,_0x311958);_0x1cc715(null);})[_0x26d1('0xe')](_0x1cc715(null));};}for(var e in events){if(events[_0x26d1('0xf')](e)){var event=events[e];ChatInteraction[_0x26d1('0x10')](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 9223cce..eb1fa6f 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 _0x9d9f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2b1e2f,_0x1d8719){var _0x561544=function(_0x592386){while(--_0x592386){_0x2b1e2f['push'](_0x2b1e2f['shift']());}};_0x561544(++_0x1d8719);}(_0x9d9f,0x10a));var _0xf9d9=function(_0x556b6a,_0x58af94){_0x556b6a=_0x556b6a-0x0;var _0x4406ed=_0x9d9f[_0x556b6a];return _0x4406ed;};'use strict';var _=require(_0xf9d9('0x0'));var util=require(_0xf9d9('0x1'));var logger=require(_0xf9d9('0x2'))(_0xf9d9('0x3'));var moment=require(_0xf9d9('0x4'));var BPromise=require(_0xf9d9('0x5'));var rp=require(_0xf9d9('0x6'));var fs=require('fs');var path=require(_0xf9d9('0x7'));var rimraf=require(_0xf9d9('0x8'));var config=require(_0xf9d9('0x9'));var attributes=require('./chatInteraction.attributes');module[_0xf9d9('0xa')]=function(_0x22abf9,_0x54e412){return _0x22abf9[_0xf9d9('0xb')](_0xf9d9('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x474747,_0x4931f8,_0x264078){if(_0x474747['changed'](_0xf9d9('0xd'))){_0x474747[_0xf9d9('0xe')]=moment()[_0xf9d9('0xf')](_0xf9d9('0x10'));}_0x264078(null,_0x474747);}},'charset':_0xf9d9('0x11'),'collate':_0xf9d9('0x12')});}; \ No newline at end of file +var _0x3eb9=['ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports'];(function(_0xfa8892,_0x48ed5d){var _0x4edc80=function(_0xd29b50){while(--_0xd29b50){_0xfa8892['push'](_0xfa8892['shift']());}};_0x4edc80(++_0x48ed5d);}(_0x3eb9,0x197));var _0x93eb=function(_0x3d6785,_0x492ea3){_0x3d6785=_0x3d6785-0x0;var _0x39a624=_0x3eb9[_0x3d6785];return _0x39a624;};'use strict';var _=require(_0x93eb('0x0'));var util=require('util');var logger=require(_0x93eb('0x1'))(_0x93eb('0x2'));var moment=require(_0x93eb('0x3'));var BPromise=require('bluebird');var rp=require(_0x93eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93eb('0x5'));var config=require(_0x93eb('0x6'));var attributes=require(_0x93eb('0x7'));module[_0x93eb('0x8')]=function(_0x16ccdc,_0x2b4f45){return _0x16ccdc['define'](_0x93eb('0x9'),attributes,{'tableName':_0x93eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b3df1,_0x2d7b64,_0x4a7cf5){if(_0x3b3df1[_0x93eb('0xb')]('closed')){_0x3b3df1[_0x93eb('0xc')]=moment()[_0x93eb('0xd')](_0x93eb('0xe'));}_0x4a7cf5(null,_0x3b3df1);}},'charset':_0x93eb('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index f4694c8..2a2e5e0 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 _0xa84d=['omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','update','body','options','where','attributes','limit','then','ChatInteraction','find','addTags','ids'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0xa84d,0x1d1));var _0xda84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa84d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda84('0x0'));var util=require(_0xda84('0x1'));var moment=require(_0xda84('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda84('0x3'));var db=require(_0xda84('0x4'))['db'];var utils=require(_0xda84('0x5'));var logger=require(_0xda84('0x6'))(_0xda84('0x7'));var config=require(_0xda84('0x8'));var jayson=require(_0xda84('0x9'));var client=jayson[_0xda84('0xa')]['http']({'port':0x232a});config[_0xda84('0xb')]=_[_0xda84('0xc')](config[_0xda84('0xb')],{'host':_0xda84('0xd'),'port':0x18eb});var socket=require(_0xda84('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x43b0f6,_0x25d902,_0x5f17b9){return new BPromise(function(_0x2bd5fd,_0x1f6260){return client[_0xda84('0xf')](_0x43b0f6,_0x5f17b9)['then'](function(_0xc1ab39){logger[_0xda84('0x10')](_0xda84('0x11'),_0x25d902,_0xda84('0x12'));logger[_0xda84('0x13')](_0xda84('0x14'),_0x25d902,'request\x20sent',JSON[_0xda84('0x15')](_0xc1ab39));if(_0xc1ab39[_0xda84('0x16')]){if(_0xc1ab39[_0xda84('0x16')][_0xda84('0x17')]===0x1f4){logger[_0xda84('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x25d902,_0xc1ab39[_0xda84('0x16')][_0xda84('0x18')]);return _0x1f6260(_0xc1ab39[_0xda84('0x16')][_0xda84('0x18')]);}logger[_0xda84('0x16')](_0xda84('0x11'),_0x25d902,_0xc1ab39['error'][_0xda84('0x18')]);return _0x2bd5fd(_0xc1ab39['error']['message']);}else{logger[_0xda84('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x25d902,'request\x20sent');_0x2bd5fd(_0xc1ab39[_0xda84('0x19')][_0xda84('0x18')]);}})[_0xda84('0x1a')](function(_0x28f090){logger[_0xda84('0x16')](_0xda84('0x11'),_0x25d902,_0x28f090);_0x1f6260(_0x28f090);});});}exports[_0xda84('0x1b')]=function(_0x5a5c80){var _0x3a6d0f=this;return new Promise(function(_0x37ec96,_0x2f3d06){return db['ChatInteraction'][_0xda84('0x1c')](_0x5a5c80[_0xda84('0x1d')],{'raw':_0x5a5c80[_0xda84('0x1e')]?_0x5a5c80[_0xda84('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a5c80['options']?_0x5a5c80[_0xda84('0x1e')][_0xda84('0x1f')]||null:null,'attributes':_0x5a5c80[_0xda84('0x1e')]?_0x5a5c80['options'][_0xda84('0x20')]||null:null,'limit':_0x5a5c80[_0xda84('0x1e')]?_0x5a5c80['options'][_0xda84('0x21')]||null:null})[_0xda84('0x22')](function(_0x270143){logger[_0xda84('0x10')](_0xda84('0x1b'),_0x5a5c80);logger['debug'](_0xda84('0x1b'),_0x5a5c80,JSON['stringify'](_0x270143));_0x37ec96(_0x270143);})[_0xda84('0x1a')](function(_0x16a105){logger[_0xda84('0x16')]('UpdateChatInteraction',_0x16a105['message'],_0x5a5c80);_0x2f3d06(_0x3a6d0f[_0xda84('0x16')](0x1f4,_0x16a105[_0xda84('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x3a929f){return new Promise(function(_0x3b2124,_0x24b940){return db[_0xda84('0x23')][_0xda84('0x24')]({'where':_0x3a929f['options']?_0x3a929f[_0xda84('0x1e')][_0xda84('0x1f')]||null:null})[_0xda84('0x22')](function(_0x559d1a){if(_0x559d1a){return _0x559d1a[_0xda84('0x25')](_0x3a929f[_0xda84('0x1d')][_0xda84('0x26')],_[_0xda84('0x27')](_0x3a929f[_0xda84('0x1d')],[_0xda84('0x26'),'id'])||{});}})[_0xda84('0x28')](function(_0x292cd5){logger['info'](_0xda84('0x29'),_0x3a929f);logger['debug']('AddTags',_0x3a929f,JSON[_0xda84('0x15')](_0x292cd5));_0x3b2124(_0x292cd5);})['catch'](function(_0x2c2afe){logger[_0xda84('0x16')](_0xda84('0x29'),_0x2c2afe[_0xda84('0x18')],_0x3a929f);_0x24b940(_this[_0xda84('0x16')](0x1f4,_0x2c2afe[_0xda84('0x18')]));});});}; \ No newline at end of file +var _0x2a40=['error','code','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x572165,_0x6a45cc){var _0x8c8709=function(_0x43faab){while(--_0x43faab){_0x572165['push'](_0x572165['shift']());}};_0x8c8709(++_0x6a45cc);}(_0x2a40,0x1d6));var _0x02a4=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0x2a40[_0x5a7dd3];return _0x2f4d07;};'use strict';var _=require(_0x02a4('0x0'));var util=require(_0x02a4('0x1'));var moment=require(_0x02a4('0x2'));var BPromise=require('bluebird');var rs=require(_0x02a4('0x3'));var fs=require('fs');var Redis=require(_0x02a4('0x4'));var db=require(_0x02a4('0x5'))['db'];var utils=require(_0x02a4('0x6'));var logger=require(_0x02a4('0x7'))(_0x02a4('0x8'));var config=require('../../config/environment');var jayson=require(_0x02a4('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x02a4('0xa')],{'host':_0x02a4('0xb'),'port':0x18eb});var socket=require(_0x02a4('0xc'))(new Redis(config[_0x02a4('0xa')]));require('./chatInteraction.socket')[_0x02a4('0xd')](socket);function respondWithRpcPromise(_0x1a0185,_0x4c486a,_0x516f01){return new BPromise(function(_0x259d8e,_0x73bc99){return client[_0x02a4('0xe')](_0x1a0185,_0x516f01)[_0x02a4('0xf')](function(_0x2be699){logger[_0x02a4('0x10')](_0x02a4('0x11'),_0x4c486a,_0x02a4('0x12'));logger[_0x02a4('0x13')](_0x02a4('0x14'),_0x4c486a,_0x02a4('0x12'),JSON[_0x02a4('0x15')](_0x2be699));if(_0x2be699[_0x02a4('0x16')]){if(_0x2be699[_0x02a4('0x16')][_0x02a4('0x17')]===0x1f4){logger[_0x02a4('0x16')](_0x02a4('0x11'),_0x4c486a,_0x2be699['error'][_0x02a4('0x18')]);return _0x73bc99(_0x2be699[_0x02a4('0x16')][_0x02a4('0x18')]);}logger[_0x02a4('0x16')](_0x02a4('0x11'),_0x4c486a,_0x2be699[_0x02a4('0x16')][_0x02a4('0x18')]);return _0x259d8e(_0x2be699[_0x02a4('0x16')][_0x02a4('0x18')]);}else{logger['info'](_0x02a4('0x11'),_0x4c486a,_0x02a4('0x12'));_0x259d8e(_0x2be699[_0x02a4('0x19')]['message']);}})[_0x02a4('0x1a')](function(_0x423284){logger[_0x02a4('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4c486a,_0x423284);_0x73bc99(_0x423284);});});}exports['UpdateChatInteraction']=function(_0x492bec){var _0x408995=this;return new Promise(function(_0x5ee12d,_0x3a3ec5){return db['ChatInteraction'][_0x02a4('0x1b')](_0x492bec[_0x02a4('0x1c')],{'raw':_0x492bec[_0x02a4('0x1d')]?_0x492bec['options'][_0x02a4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x492bec[_0x02a4('0x1d')]?_0x492bec[_0x02a4('0x1d')][_0x02a4('0x1f')]||null:null,'attributes':_0x492bec[_0x02a4('0x1d')]?_0x492bec[_0x02a4('0x1d')][_0x02a4('0x20')]||null:null,'limit':_0x492bec[_0x02a4('0x1d')]?_0x492bec['options'][_0x02a4('0x21')]||null:null})['then'](function(_0x306f2a){logger[_0x02a4('0x10')](_0x02a4('0x22'),_0x492bec);logger['debug']('UpdateChatInteraction',_0x492bec,JSON[_0x02a4('0x15')](_0x306f2a));_0x5ee12d(_0x306f2a);})[_0x02a4('0x1a')](function(_0x17eca6){logger['error'](_0x02a4('0x22'),_0x17eca6[_0x02a4('0x18')],_0x492bec);_0x3a3ec5(_0x408995['error'](0x1f4,_0x17eca6[_0x02a4('0x18')]));});});};exports[_0x02a4('0x23')]=function(_0x51ca9a){return new Promise(function(_0x4f931b,_0x5ba28c){return db[_0x02a4('0x24')]['find']({'where':_0x51ca9a['options']?_0x51ca9a[_0x02a4('0x1d')]['where']||null:null})[_0x02a4('0xf')](function(_0x327f03){if(_0x327f03){return _0x327f03[_0x02a4('0x25')](_0x51ca9a[_0x02a4('0x1c')][_0x02a4('0x26')],_['omit'](_0x51ca9a['body'],[_0x02a4('0x26'),'id'])||{});}})[_0x02a4('0x27')](function(_0x4bdcaa){logger[_0x02a4('0x10')](_0x02a4('0x28'),_0x51ca9a);logger[_0x02a4('0x13')]('AddTags',_0x51ca9a,JSON[_0x02a4('0x15')](_0x4bdcaa));_0x4f931b(_0x4bdcaa);})[_0x02a4('0x1a')](function(_0x36f46f){logger[_0x02a4('0x16')]('AddTags',_0x36f46f[_0x02a4('0x18')],_0x51ca9a);_0x5ba28c(_this[_0x02a4('0x16')](0x1f4,_0x36f46f[_0x02a4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b5f628c..d5b436e 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 _0xa9dc=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x4aa804,_0x2d31ff){var _0x16f3fe=function(_0x3d835e){while(--_0x3d835e){_0x4aa804['push'](_0x4aa804['shift']());}};_0x16f3fe(++_0x2d31ff);}(_0xa9dc,0xb0));var _0xca9d=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0xa9dc[_0x337a10];return _0x575f98;};'use strict';var ChatInteractionEvents=require(_0xca9d('0x0'));var events=[_0xca9d('0x1'),_0xca9d('0x2'),_0xca9d('0x3')];function createListener(_0x170fc6,_0x47f74e){return function(_0x88b72){_0x47f74e[_0xca9d('0x4')](_0x170fc6,_0x88b72);};}function removeListener(_0x429851,_0x3475cf){return function(){ChatInteractionEvents[_0xca9d('0x5')](_0x429851,_0x3475cf);};}exports[_0xca9d('0x6')]=function(_0x5f3ac1){for(var _0x64c921=0x0,_0x596038=events[_0xca9d('0x7')];_0x64c921<_0x596038;_0x64c921++){var _0x13e396=events[_0x64c921];var _0x348235=createListener(_0xca9d('0x8')+_0x13e396,_0x5f3ac1);ChatInteractionEvents['on'](_0x13e396,_0x348235);}}; \ No newline at end of file +var _0x144c=['update','emit','register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x58a9d2,_0x31d558){var _0x41fc0b=function(_0x4c399d){while(--_0x4c399d){_0x58a9d2['push'](_0x58a9d2['shift']());}};_0x41fc0b(++_0x31d558);}(_0x144c,0x66));var _0xc144=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x144c[_0x1ebeea];return _0x576465;};'use strict';var ChatInteractionEvents=require(_0xc144('0x0'));var events=[_0xc144('0x1'),_0xc144('0x2'),_0xc144('0x3')];function createListener(_0x36847b,_0x48c3e6){return function(_0x225b1b){_0x48c3e6[_0xc144('0x4')](_0x36847b,_0x225b1b);};}function removeListener(_0x4c856b,_0x4f7f8e){return function(){ChatInteractionEvents['removeListener'](_0x4c856b,_0x4f7f8e);};}exports[_0xc144('0x5')]=function(_0x496d94){for(var _0x10c90d=0x0,_0x21b73a=events['length'];_0x10c90d<_0x21b73a;_0x10c90d++){var _0x56e042=events[_0x10c90d];var _0x2cee30=createListener(_0xc144('0x6')+_0x56e042,_0x496d94);ChatInteractionEvents['on'](_0x56e042,_0x2cee30);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 46c2743..b8ee81d 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 _0x717e=['/describe','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/download','post','create','/:id/vidaoo','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','/:id/messages','addMessage','/:id/tags','tracked','put','/:id','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./chatInteraction.controller','get'];(function(_0x55749a,_0x47b1d7){var _0x5d92df=function(_0x446936){while(--_0x446936){_0x55749a['push'](_0x55749a['shift']());}};_0x5d92df(++_0x47b1d7);}(_0x717e,0x180));var _0xe717=function(_0xdb50e1,_0x112a80){_0xdb50e1=_0xdb50e1-0x0;var _0x2a50fc=_0x717e[_0xdb50e1];return _0x2a50fc;};'use strict';var multer=require(_0xe717('0x0'));var util=require('util');var path=require(_0xe717('0x1'));var timeout=require(_0xe717('0x2'));var express=require('express');var router=express[_0xe717('0x3')]();var fs_extra=require(_0xe717('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe717('0x5'));var controller=require(_0xe717('0x6'));router[_0xe717('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe717('0x7')](_0xe717('0x8'),auth[_0xe717('0x9')](),controller[_0xe717('0xa')]);router[_0xe717('0x7')]('/:id',auth[_0xe717('0xb')](),controller[_0xe717('0xc')]);router['get'](_0xe717('0xd'),auth[_0xe717('0xb')](),controller[_0xe717('0xe')]);router['get']('/:id/messages',auth[_0xe717('0x9')](),controller[_0xe717('0xf')]);router[_0xe717('0x7')]('/:id/my_messages',auth[_0xe717('0xb')](),controller['getMyMessages']);router[_0xe717('0x7')](_0xe717('0x10'),auth[_0xe717('0x9')](),controller['download']);router[_0xe717('0x11')]('/',auth['isAuthenticated'](),controller[_0xe717('0x12')]);router['post'](_0xe717('0x13'),auth[_0xe717('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x283724,_0x44b560,_0xb97b46){_0xb97b46(null,path[_0xe717('0x14')](config[_0xe717('0x15')],_0xe717('0x16')));},'filename':function(_0x24a313,_0x50d025,_0x3d47c9){_0x3d47c9(null,util['format'](_0xe717('0x17'),Date[_0xe717('0x18')](),_0x50d025[_0xe717('0x19')][_0xe717('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe717('0x11')](_0xe717('0x1b'),upload[_0xe717('0x1c')](_0xe717('0x1d')),controller['attachmentUpload']);router[_0xe717('0x11')](_0xe717('0x1e'),auth[_0xe717('0xb')](),controller[_0xe717('0x1f')]);router[_0xe717('0x11')](_0xe717('0x20'),auth[_0xe717('0x9')](),interaction[_0xe717('0x21')]('chat','chatinteraction:addtags'),controller['addTags']);router[_0xe717('0x22')](_0xe717('0x23'),auth[_0xe717('0x9')](),interaction[_0xe717('0x21')](_0xe717('0x24'),_0xe717('0x25')),controller[_0xe717('0x26')]);router[_0xe717('0x22')](_0xe717('0x27'),controller[_0xe717('0x28')]);router['put'](_0xe717('0x29'),auth['isChatInteractionAuthorized'](),controller[_0xe717('0x2a')]);router[_0xe717('0x22')](_0xe717('0x2b'),controller[_0xe717('0x2c')]);router[_0xe717('0x2d')]('/:id',auth[_0xe717('0x9')](),interaction[_0xe717('0x21')](_0xe717('0x24'),_0xe717('0x2e')),controller[_0xe717('0x2f')]);router[_0xe717('0x2d')](_0xe717('0x20'),auth['isAuthenticated'](),controller['removeTags']);module[_0xe717('0x30')]=router; \ No newline at end of file +var _0xa9c9=['path','express','Router','fs-extra','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','post','diskStorage','root','server/files/attachments/','format','now','originalname','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports'];(function(_0x4e0d05,_0x1252ef){var _0x568b50=function(_0x5f3071){while(--_0x5f3071){_0x4e0d05['push'](_0x4e0d05['shift']());}};_0x568b50(++_0x1252ef);}(_0xa9c9,0xf0));var _0x9a9c=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xa9c9[_0x1203f];return _0x365f0a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a9c('0x0'));var timeout=require('connect-timeout');var express=require(_0x9a9c('0x1'));var router=express[_0x9a9c('0x2')]();var fs_extra=require(_0x9a9c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9a9c('0x4'));var config=require('../../config/environment');var controller=require(_0x9a9c('0x5'));router[_0x9a9c('0x6')]('/',auth[_0x9a9c('0x7')](),controller[_0x9a9c('0x8')]);router[_0x9a9c('0x6')](_0x9a9c('0x9'),auth[_0x9a9c('0x7')](),controller['describe']);router[_0x9a9c('0x6')](_0x9a9c('0xa'),auth[_0x9a9c('0xb')](),controller[_0x9a9c('0xc')]);router[_0x9a9c('0x6')]('/:id/attachment_download',auth[_0x9a9c('0xb')](),controller[_0x9a9c('0xd')]);router['get']('/:id/messages',auth[_0x9a9c('0x7')](),controller[_0x9a9c('0xe')]);router[_0x9a9c('0x6')](_0x9a9c('0xf'),auth[_0x9a9c('0xb')](),controller[_0x9a9c('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x9a9c('0x11')]);router[_0x9a9c('0x12')]('/',auth[_0x9a9c('0x7')](),controller['create']);router['post']('/:id/vidaoo',auth[_0x9a9c('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x9a9c('0x13')]({'destination':function(_0x209506,_0x590742,_0x57f65e){_0x57f65e(null,path['join'](config[_0x9a9c('0x14')],_0x9a9c('0x15')));},'filename':function(_0x2dbb24,_0x97b6b8,_0x1c652d){_0x1c652d(null,util[_0x9a9c('0x16')]('%s-%s',Date[_0x9a9c('0x17')](),_0x97b6b8[_0x9a9c('0x18')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9a9c('0x12')]('/:id/attachment_upload',upload[_0x9a9c('0x19')](_0x9a9c('0x1a')),controller[_0x9a9c('0x1b')]);router['post'](_0x9a9c('0x1c'),auth['isChatInteractionAuthorized'](),controller[_0x9a9c('0x1d')]);router[_0x9a9c('0x12')](_0x9a9c('0x1e'),auth['isAuthenticated'](),interaction[_0x9a9c('0x1f')](_0x9a9c('0x20'),_0x9a9c('0x21')),controller[_0x9a9c('0x22')]);router[_0x9a9c('0x23')](_0x9a9c('0xa'),auth[_0x9a9c('0x7')](),interaction[_0x9a9c('0x1f')](_0x9a9c('0x20'),'chatinteraction:update'),controller[_0x9a9c('0x24')]);router[_0x9a9c('0x23')](_0x9a9c('0x25'),controller[_0x9a9c('0x26')]);router[_0x9a9c('0x23')](_0x9a9c('0x27'),auth[_0x9a9c('0xb')](),controller[_0x9a9c('0x28')]);router[_0x9a9c('0x23')](_0x9a9c('0x29'),controller[_0x9a9c('0x2a')]);router[_0x9a9c('0x2b')](_0x9a9c('0xa'),auth[_0x9a9c('0x7')](),interaction[_0x9a9c('0x1f')](_0x9a9c('0x20'),_0x9a9c('0x2c')),controller[_0x9a9c('0x2d')]);router[_0x9a9c('0x2b')]('/:id/tags',auth[_0x9a9c('0x7')](),controller[_0x9a9c('0x2e')]);module[_0x9a9c('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f87743a..db8a341 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 _0x96ca=['INTEGER','sequelize','exports','TEXT'];(function(_0xcc55b5,_0x1ce946){var _0x529611=function(_0x197a7e){while(--_0x197a7e){_0xcc55b5['push'](_0xcc55b5['shift']());}};_0x529611(++_0x1ce946);}(_0x96ca,0x7d));var _0xa96c=function(_0x357633,_0x254610){_0x357633=_0x357633-0x0;var _0x261faf=_0x96ca[_0x357633];return _0x261faf;};'use strict';var Sequelize=require(_0xa96c('0x0'));module[_0xa96c('0x1')]={'body':{'type':Sequelize[_0xa96c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa96c('0x3')]}}; \ No newline at end of file +var _0x2c2e=['exports','TEXT','INTEGER','sequelize'];(function(_0x14553f,_0x3be5af){var _0x2623c0=function(_0x2df415){while(--_0x2df415){_0x14553f['push'](_0x14553f['shift']());}};_0x2623c0(++_0x3be5af);}(_0x2c2e,0x19f));var _0xe2c2=function(_0x3e3182,_0x596abc){_0x3e3182=_0x3e3182-0x0;var _0xb33c81=_0x2c2e[_0x3e3182];return _0xb33c81;};'use strict';var Sequelize=require(_0xe2c2('0x0'));module[_0xe2c2('0x1')]={'body':{'type':Sequelize[_0xe2c2('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe2c2('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 992ca8c..2bf5533 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 _0xc919=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','catch','show','params','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','user','fullname','role','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc919,0xd0));var _0x9c91=function(_0x56e56b,_0x12019c){_0x56e56b=_0x56e56b-0x0;var _0x147c17=_0xc919[_0x56e56b];return _0x147c17;};'use strict';var emlformat=require(_0x9c91('0x0'));var rimraf=require(_0x9c91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c91('0x2'));var moment=require(_0x9c91('0x3'));var BPromise=require(_0x9c91('0x4'));var Mustache=require(_0x9c91('0x5'));var util=require(_0x9c91('0x6'));var path=require('path');var sox=require(_0x9c91('0x7'));var csv=require(_0x9c91('0x8'));var ejs=require(_0x9c91('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9c91('0xa'));var crypto=require(_0x9c91('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c91('0xc'));var toCsv=require(_0x9c91('0x8'));var querystring=require(_0x9c91('0xd'));var Papa=require('papaparse');var Redis=require(_0x9c91('0xe'));var authService=require(_0x9c91('0xf'));var qs=require(_0x9c91('0x10'));var as=require(_0x9c91('0x11'));var hardwareService=require(_0x9c91('0x12'));var logger=require(_0x9c91('0x13'))(_0x9c91('0x14'));var utils=require(_0x9c91('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c91('0x16'))['db'];config['redis']=_[_0x9c91('0x17')](config[_0x9c91('0x18')],{'host':_0x9c91('0x19'),'port':0x18eb});var socket=require(_0x9c91('0x1a'))(new Redis(config[_0x9c91('0x18')]));require(_0x9c91('0x1b'))[_0x9c91('0x1c')](socket);function respondWithStatusCode(_0x3dfb93,_0x209ce2){_0x209ce2=_0x209ce2||0xcc;return function(_0x14037d){if(_0x14037d){return _0x3dfb93[_0x9c91('0x1d')](_0x209ce2);}return _0x3dfb93[_0x9c91('0x1e')](_0x209ce2)[_0x9c91('0x1f')]();};}function respondWithResult(_0x30bdd1,_0x288aa1){_0x288aa1=_0x288aa1||0xc8;return function(_0x3d6d2a){if(_0x3d6d2a){return _0x30bdd1[_0x9c91('0x1e')](_0x288aa1)[_0x9c91('0x20')](_0x3d6d2a);}};}function respondWithFilteredResult(_0x52561a,_0x1737de){return function(_0x33e4b5){if(_0x33e4b5){var _0x10b383=typeof _0x1737de['offset']===_0x9c91('0x21')&&typeof _0x1737de[_0x9c91('0x22')]===_0x9c91('0x21');var _0x17b5d0=_0x33e4b5[_0x9c91('0x23')];var _0x252943=_0x10b383?0x0:_0x1737de[_0x9c91('0x24')];var _0x223c06=_0x10b383?_0x33e4b5[_0x9c91('0x23')]:_0x1737de[_0x9c91('0x24')]+_0x1737de[_0x9c91('0x22')];var _0x5202c6;if(_0x223c06>=_0x17b5d0){_0x223c06=_0x17b5d0;_0x5202c6=0xc8;}else{_0x5202c6=0xce;}_0x52561a[_0x9c91('0x1e')](_0x5202c6);return _0x52561a[_0x9c91('0x25')](_0x9c91('0x26'),_0x252943+'-'+_0x223c06+'/'+_0x17b5d0)[_0x9c91('0x20')](_0x33e4b5);}return null;};}function patchUpdates(_0x196a3f){return function(_0x442a49){try{jsonpatch['apply'](_0x442a49,_0x196a3f,!![]);}catch(_0x1e7332){return BPromise[_0x9c91('0x27')](_0x1e7332);}return _0x442a49[_0x9c91('0x28')]();};}function saveUpdates(_0x2db587,_0x496cf6){return function(_0x185534){if(_0x185534){return _0x185534[_0x9c91('0x29')](_0x2db587)[_0x9c91('0x2a')](function(_0x35623e){return _0x35623e;});}return null;};}function removeEntity(_0x44650f,_0x271b7d){return function(_0x5a53df){if(_0x5a53df){return _0x5a53df['destroy']()[_0x9c91('0x2a')](function(){_0x44650f[_0x9c91('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58aac9,_0x25501b){return function(_0x22066a){if(!_0x22066a){_0x58aac9[_0x9c91('0x1d')](0x194);}return _0x22066a;};}function handleError(_0x4dcede,_0x50dc11){_0x50dc11=_0x50dc11||0x1f4;return function(_0x2372d1){logger[_0x9c91('0x2b')](_0x2372d1[_0x9c91('0x2c')]);if(_0x2372d1[_0x9c91('0x2d')]){delete _0x2372d1['name'];}_0x4dcede['status'](_0x50dc11)[_0x9c91('0x2e')](_0x2372d1);};}exports['index']=function(_0x473a3e,_0x14a43b){var _0x1131bb={},_0x485573={},_0x2c1efc={'count':0x0,'rows':[]};var _0x5599ac=_[_0x9c91('0x2f')](db[_0x9c91('0x30')][_0x9c91('0x31')],function(_0x12e6af){return{'name':_0x12e6af[_0x9c91('0x32')],'type':_0x12e6af[_0x9c91('0x33')][_0x9c91('0x34')]};});_0x485573[_0x9c91('0x35')]=_[_0x9c91('0x2f')](_0x5599ac,_0x9c91('0x2d'));_0x485573['query']=_[_0x9c91('0x36')](_0x473a3e[_0x9c91('0x37')]);_0x485573[_0x9c91('0x38')]=_[_0x9c91('0x39')](_0x485573[_0x9c91('0x35')],_0x485573[_0x9c91('0x37')]);_0x1131bb[_0x9c91('0x3a')]=_[_0x9c91('0x39')](_0x485573['model'],qs[_0x9c91('0x3b')](_0x473a3e[_0x9c91('0x37')][_0x9c91('0x3b')]));_0x1131bb['attributes']=_0x1131bb['attributes'][_0x9c91('0x3c')]?_0x1131bb[_0x9c91('0x3a')]:_0x485573[_0x9c91('0x35')];if(!_0x473a3e['query'][_0x9c91('0x3d')](_0x9c91('0x3e'))){_0x1131bb[_0x9c91('0x22')]=qs['limit'](_0x473a3e[_0x9c91('0x37')][_0x9c91('0x22')]);_0x1131bb[_0x9c91('0x24')]=qs[_0x9c91('0x24')](_0x473a3e[_0x9c91('0x37')][_0x9c91('0x24')]);}_0x1131bb[_0x9c91('0x3f')]=qs['sort'](_0x473a3e[_0x9c91('0x37')][_0x9c91('0x40')]);_0x1131bb[_0x9c91('0x41')]=qs['filters'](_['pick'](_0x473a3e[_0x9c91('0x37')],_0x485573[_0x9c91('0x38')]),_0x5599ac);if(_0x473a3e[_0x9c91('0x37')]['filter']){_0x1131bb[_0x9c91('0x41')]=_[_0x9c91('0x42')](_0x1131bb['where'],{'$or':_['map'](_0x5599ac,function(_0x32b163){if(_0x32b163[_0x9c91('0x33')]!=='VIRTUAL'){var _0x5023b3={};_0x5023b3[_0x32b163[_0x9c91('0x2d')]]={'$like':'%'+_0x473a3e['query'][_0x9c91('0x43')]+'%'};return _0x5023b3;}})});}_0x1131bb=_['merge']({},_0x1131bb,_0x473a3e[_0x9c91('0x44')]);var _0x27eb6b={'where':_0x1131bb['where']};return db[_0x9c91('0x30')][_0x9c91('0x23')](_0x27eb6b)['then'](function(_0x1d166d){_0x2c1efc[_0x9c91('0x23')]=_0x1d166d;if(_0x473a3e[_0x9c91('0x37')][_0x9c91('0x45')]){_0x1131bb[_0x9c91('0x46')]=[{'all':!![]}];}return db[_0x9c91('0x30')][_0x9c91('0x47')](_0x1131bb);})[_0x9c91('0x2a')](function(_0x49865d){_0x2c1efc['rows']=_0x49865d;return _0x2c1efc;})[_0x9c91('0x2a')](respondWithFilteredResult(_0x14a43b,_0x1131bb))[_0x9c91('0x48')](handleError(_0x14a43b,null));};exports[_0x9c91('0x49')]=function(_0x37fe53,_0x16366b){var _0x1fb665={'raw':!![],'where':{'id':_0x37fe53[_0x9c91('0x4a')]['id']}},_0x549c33={};_0x549c33[_0x9c91('0x35')]=_[_0x9c91('0x36')](db['ChatInternalMessage'][_0x9c91('0x31')]);_0x549c33['query']=_[_0x9c91('0x36')](_0x37fe53[_0x9c91('0x37')]);_0x549c33[_0x9c91('0x38')]=_[_0x9c91('0x39')](_0x549c33['model'],_0x549c33[_0x9c91('0x37')]);_0x1fb665[_0x9c91('0x3a')]=_[_0x9c91('0x39')](_0x549c33[_0x9c91('0x35')],qs[_0x9c91('0x3b')](_0x37fe53[_0x9c91('0x37')][_0x9c91('0x3b')]));_0x1fb665[_0x9c91('0x3a')]=_0x1fb665[_0x9c91('0x3a')][_0x9c91('0x3c')]?_0x1fb665[_0x9c91('0x3a')]:_0x549c33[_0x9c91('0x35')];if(_0x37fe53[_0x9c91('0x37')][_0x9c91('0x45')]){_0x1fb665[_0x9c91('0x46')]=[{'all':!![]}];}_0x1fb665=_[_0x9c91('0x42')]({},_0x1fb665,_0x37fe53[_0x9c91('0x44')]);return db[_0x9c91('0x30')]['find'](_0x1fb665)[_0x9c91('0x2a')](handleEntityNotFound(_0x16366b,null))[_0x9c91('0x2a')](respondWithResult(_0x16366b,null))[_0x9c91('0x48')](handleError(_0x16366b,null));};exports['create']=function(_0x472f6f,_0x1fdd42){return db[_0x9c91('0x30')]['create'](_0x472f6f['body'],{})[_0x9c91('0x2a')](respondWithResult(_0x1fdd42,0xc9))['catch'](handleError(_0x1fdd42,null));};exports[_0x9c91('0x29')]=function(_0x96ddf7,_0xbff490){if(_0x96ddf7[_0x9c91('0x4b')]['id']){delete _0x96ddf7[_0x9c91('0x4b')]['id'];}return db[_0x9c91('0x30')]['find']({'where':{'id':_0x96ddf7['params']['id']}})[_0x9c91('0x2a')](handleEntityNotFound(_0xbff490,null))[_0x9c91('0x2a')](saveUpdates(_0x96ddf7['body'],null))['then'](respondWithResult(_0xbff490,null))[_0x9c91('0x48')](handleError(_0xbff490,null));};exports['destroy']=function(_0x3f3c99,_0x2b90d2){return db[_0x9c91('0x30')][_0x9c91('0x4c')]({'where':{'id':_0x3f3c99[_0x9c91('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b90d2,null))[_0x9c91('0x2a')](removeEntity(_0x2b90d2,null))[_0x9c91('0x48')](handleError(_0x2b90d2,null));};exports[_0x9c91('0x4d')]=function(_0x558f11,_0x555a72){return db[_0x9c91('0x30')][_0x9c91('0x4d')]()['then'](respondWithResult(_0x555a72,null))[_0x9c91('0x48')](handleError(_0x555a72,null));};function wrapUser(_0xe3b6a9){return function(_0x1409e2){var _0x23bdb2=_0xe3b6a9[_0x9c91('0x4e')]({'plain':!![]});_0x23bdb2[_0x9c91('0x4f')]=[];if(_0x1409e2){_0x23bdb2[_0x9c91('0x50')]=_0x1409e2[_0x9c91('0x51')];_0x23bdb2[_0x9c91('0x52')]=_0x1409e2;}else{_0x23bdb2['lastMessageAt']=moment(0x0)[_0x9c91('0x53')](_0x9c91('0x54'));_0x23bdb2['lastMessage']={};}return _0x23bdb2;};}exports['getUsers']=function(_0x3033f8,_0x3e602a,_0x2c8e85){var _0x4b02c7=[];return db[_0x9c91('0x55')]['findAll']({'where':{'role':[_0x9c91('0x56'),'admin',_0x9c91('0x57')]},'attributes':['id',_0x9c91('0x58'),'name',_0x9c91('0x59'),'userpic',_0x9c91('0x5a'),_0x9c91('0x5b'),_0x9c91('0x5c'),'allowmessenger',_0x9c91('0x5d')],'order':qs[_0x9c91('0x40')]('-online'),'include':[{'model':db[_0x9c91('0x5e')],'as':_0x9c91('0x5f'),'attributes':['id',_0x9c91('0x2d'),'type'],'through':{'attributes':[]}}]})[_0x9c91('0x2a')](function(_0x1db88a){if(_0x1db88a){var _0x12db18=_0x3033f8['user'][_0x9c91('0x4e')]({'plain':!![]});if(!_0x12db18)throw new Error(_0x9c91('0x60'));if(_0x12db18['role']==='user'){return db[_0x9c91('0x61')][_0x9c91('0x4c')]({'where':{'name':_0x9c91('0x62'),'userProfileId':_0x12db18[_0x9c91('0x63')]},'raw':!![]})[_0x9c91('0x2a')](function(_0x1234e0){if(_0x1234e0){if(_0x1234e0[_0x9c91('0x64')]===0x0){return db[_0x9c91('0x65')][_0x9c91('0x47')]({'where':{'sectionId':_0x1234e0['id']},'raw':!![]})[_0x9c91('0x2a')](function(_0x549371){var _0x5669d4=[];if(_[_0x9c91('0x66')](_0x549371)){_0x5669d4=_[_0x9c91('0x43')](_0x1db88a,function(_0x165ab7){if(_0x165ab7[_0x9c91('0x59')]!==_0x9c91('0x56')){return _0x165ab7;}});return _0x5669d4;}else{for(var _0x1fa127=0x0;_0x1fa127<_0x1db88a[_0x9c91('0x3c')];_0x1fa127++){var _0x49e903=_0x1db88a[_0x1fa127];if(_0x49e903[_0x9c91('0x59')]===_0x9c91('0x56')){var _0x5979ee=_[_0x9c91('0x4c')](_0x549371,function(_0x13f4fc){return _0x13f4fc[_0x9c91('0x67')]===_0x49e903['id'];});if(_0x5979ee)_0x5669d4[_0x9c91('0x68')](_0x49e903);}else{_0x5669d4[_0x9c91('0x68')](_0x49e903);}}return _0x5669d4;}});}else{return _0x1db88a;}}else{var _0x36f290=_[_0x9c91('0x43')](_0x1db88a,function(_0x3dd8e8){if(_0x3dd8e8['role']!==_0x9c91('0x56')){return _0x3dd8e8;}});return _0x36f290;}});}else{return _0x1db88a;}}})[_0x9c91('0x2a')](function(_0x1e56b1){var _0x24f702=[];if(_0x1e56b1){_0x4b02c7=_0x1e56b1;for(var _0x2ecbd2=0x0;_0x2ecbd2<_0x1e56b1[_0x9c91('0x3c')];_0x2ecbd2+=0x1){_0x4b02c7[_0x2ecbd2][_0x9c91('0x4f')]=[];_0x24f702['push'](db[_0x9c91('0x30')][_0x9c91('0x4c')]({'where':{'FromId':[_0x3033f8[_0x9c91('0x57')]['id'],_0x1e56b1[_0x2ecbd2]['id']],'ToId':[_0x3033f8[_0x9c91('0x57')]['id'],_0x1e56b1[_0x2ecbd2]['id']],'ChatGroupId':null},'attributes':['id',_0x9c91('0x51'),_0x9c91('0x69'),_0x9c91('0x6a'),_0x9c91('0x6b'),_0x9c91('0x4b')],'order':qs[_0x9c91('0x40')](_0x9c91('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9c91('0x2a')](wrapUser(_0x1e56b1[_0x2ecbd2])));}return BPromise[_0x9c91('0x6d')](_0x24f702);}return[];})[_0x9c91('0x2a')](function(_0x17cd40){return{'rows':_0x17cd40,'count':_0x17cd40[_0x9c91('0x3c')]};})[_0x9c91('0x2a')](respondWithResult(_0x3e602a,null))[_0x9c91('0x48')](handleError(_0x3e602a,null));}; \ No newline at end of file +var _0xcf4b=['lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Agents','autoAssociation','UserProfileResource','isEmpty','role','agent','push','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','catch','update','describe','messages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf4b,0xf2));var _0xbcf4=function(_0x49f2f6,_0x11fa68){_0x49f2f6=_0x49f2f6-0x0;var _0x2e957a=_0xcf4b[_0x49f2f6];return _0x2e957a;};'use strict';var emlformat=require(_0xbcf4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcf4('0x1'));var jsonpatch=require(_0xbcf4('0x2'));var rp=require(_0xbcf4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbcf4('0x4'));var util=require(_0xbcf4('0x5'));var path=require(_0xbcf4('0x6'));var sox=require(_0xbcf4('0x7'));var csv=require(_0xbcf4('0x8'));var ejs=require(_0xbcf4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcf4('0xa'));var squel=require(_0xbcf4('0xb'));var crypto=require(_0xbcf4('0xc'));var jsforce=require(_0xbcf4('0xd'));var deskjs=require(_0xbcf4('0xe'));var toCsv=require(_0xbcf4('0x8'));var querystring=require('querystring');var Papa=require(_0xbcf4('0xf'));var Redis=require('ioredis');var authService=require(_0xbcf4('0x10'));var qs=require(_0xbcf4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbcf4('0x12'));var logger=require('../../config/logger')(_0xbcf4('0x13'));var utils=require(_0xbcf4('0x14'));var config=require(_0xbcf4('0x15'));var licenseUtil=require(_0xbcf4('0x16'));var db=require(_0xbcf4('0x17'))['db'];config[_0xbcf4('0x18')]=_['defaults'](config[_0xbcf4('0x18')],{'host':_0xbcf4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbcf4('0x18')]));require(_0xbcf4('0x1a'))[_0xbcf4('0x1b')](socket);function respondWithStatusCode(_0x4dcfdf,_0x388372){_0x388372=_0x388372||0xcc;return function(_0x1ef87c){if(_0x1ef87c){return _0x4dcfdf[_0xbcf4('0x1c')](_0x388372);}return _0x4dcfdf['status'](_0x388372)[_0xbcf4('0x1d')]();};}function respondWithResult(_0x1bfc5f,_0x327641){_0x327641=_0x327641||0xc8;return function(_0x353bf6){if(_0x353bf6){return _0x1bfc5f[_0xbcf4('0x1e')](_0x327641)[_0xbcf4('0x1f')](_0x353bf6);}};}function respondWithFilteredResult(_0x4b36ac,_0x22927d){return function(_0x54d04a){if(_0x54d04a){var _0x5b91c7=typeof _0x22927d[_0xbcf4('0x20')]===_0xbcf4('0x21')&&typeof _0x22927d[_0xbcf4('0x22')]==='undefined';var _0x326366=_0x54d04a[_0xbcf4('0x23')];var _0x40bd14=_0x5b91c7?0x0:_0x22927d[_0xbcf4('0x20')];var _0x33466e=_0x5b91c7?_0x54d04a['count']:_0x22927d[_0xbcf4('0x20')]+_0x22927d[_0xbcf4('0x22')];var _0xf73431;if(_0x33466e>=_0x326366){_0x33466e=_0x326366;_0xf73431=0xc8;}else{_0xf73431=0xce;}_0x4b36ac[_0xbcf4('0x1e')](_0xf73431);return _0x4b36ac[_0xbcf4('0x24')]('Content-Range',_0x40bd14+'-'+_0x33466e+'/'+_0x326366)[_0xbcf4('0x1f')](_0x54d04a);}return null;};}function patchUpdates(_0x1e868a){return function(_0x1bb23b){try{jsonpatch[_0xbcf4('0x25')](_0x1bb23b,_0x1e868a,!![]);}catch(_0x70b57){return BPromise[_0xbcf4('0x26')](_0x70b57);}return _0x1bb23b['save']();};}function saveUpdates(_0x6953f1,_0x1fdf05){return function(_0x235d90){if(_0x235d90){return _0x235d90['update'](_0x6953f1)['then'](function(_0x3be6b1){return _0x3be6b1;});}return null;};}function removeEntity(_0xab2b94,_0x20e3db){return function(_0x21cee0){if(_0x21cee0){return _0x21cee0[_0xbcf4('0x27')]()[_0xbcf4('0x28')](function(){_0xab2b94[_0xbcf4('0x1e')](0xcc)[_0xbcf4('0x1d')]();});}};}function handleEntityNotFound(_0x39c894,_0x694325){return function(_0x350ba0){if(!_0x350ba0){_0x39c894['sendStatus'](0x194);}return _0x350ba0;};}function handleError(_0x23b770,_0x52d980){_0x52d980=_0x52d980||0x1f4;return function(_0x4e2196){logger[_0xbcf4('0x29')](_0x4e2196[_0xbcf4('0x2a')]);if(_0x4e2196[_0xbcf4('0x2b')]){delete _0x4e2196[_0xbcf4('0x2b')];}_0x23b770['status'](_0x52d980)[_0xbcf4('0x2c')](_0x4e2196);};}exports[_0xbcf4('0x2d')]=function(_0x357845,_0x506cf9){var _0x3be774={},_0xfae094={},_0x2441c6={'count':0x0,'rows':[]};var _0x3c8caf=_[_0xbcf4('0x2e')](db[_0xbcf4('0x2f')][_0xbcf4('0x30')],function(_0x37cc3a){return{'name':_0x37cc3a[_0xbcf4('0x31')],'type':_0x37cc3a['type']['key']};});_0xfae094[_0xbcf4('0x32')]=_[_0xbcf4('0x2e')](_0x3c8caf,_0xbcf4('0x2b'));_0xfae094[_0xbcf4('0x33')]=_[_0xbcf4('0x34')](_0x357845[_0xbcf4('0x33')]);_0xfae094[_0xbcf4('0x35')]=_[_0xbcf4('0x36')](_0xfae094['model'],_0xfae094['query']);_0x3be774['attributes']=_['intersection'](_0xfae094[_0xbcf4('0x32')],qs[_0xbcf4('0x37')](_0x357845[_0xbcf4('0x33')][_0xbcf4('0x37')]));_0x3be774[_0xbcf4('0x38')]=_0x3be774['attributes'][_0xbcf4('0x39')]?_0x3be774[_0xbcf4('0x38')]:_0xfae094[_0xbcf4('0x32')];if(!_0x357845['query'][_0xbcf4('0x3a')]('nolimit')){_0x3be774[_0xbcf4('0x22')]=qs[_0xbcf4('0x22')](_0x357845[_0xbcf4('0x33')]['limit']);_0x3be774['offset']=qs[_0xbcf4('0x20')](_0x357845[_0xbcf4('0x33')][_0xbcf4('0x20')]);}_0x3be774['order']=qs[_0xbcf4('0x3b')](_0x357845[_0xbcf4('0x33')][_0xbcf4('0x3b')]);_0x3be774[_0xbcf4('0x3c')]=qs['filters'](_[_0xbcf4('0x3d')](_0x357845['query'],_0xfae094[_0xbcf4('0x35')]),_0x3c8caf);if(_0x357845['query'][_0xbcf4('0x3e')]){_0x3be774[_0xbcf4('0x3c')]=_[_0xbcf4('0x3f')](_0x3be774['where'],{'$or':_[_0xbcf4('0x2e')](_0x3c8caf,function(_0x1ad149){if(_0x1ad149[_0xbcf4('0x40')]!==_0xbcf4('0x41')){var _0x4ab24b={};_0x4ab24b[_0x1ad149['name']]={'$like':'%'+_0x357845['query']['filter']+'%'};return _0x4ab24b;}})});}_0x3be774=_[_0xbcf4('0x3f')]({},_0x3be774,_0x357845[_0xbcf4('0x42')]);var _0x581ac1={'where':_0x3be774[_0xbcf4('0x3c')]};return db['ChatInternalMessage'][_0xbcf4('0x23')](_0x581ac1)[_0xbcf4('0x28')](function(_0x391513){_0x2441c6[_0xbcf4('0x23')]=_0x391513;if(_0x357845[_0xbcf4('0x33')][_0xbcf4('0x43')]){_0x3be774[_0xbcf4('0x44')]=[{'all':!![]}];}return db[_0xbcf4('0x2f')][_0xbcf4('0x45')](_0x3be774);})['then'](function(_0x19b095){_0x2441c6[_0xbcf4('0x46')]=_0x19b095;return _0x2441c6;})[_0xbcf4('0x28')](respondWithFilteredResult(_0x506cf9,_0x3be774))['catch'](handleError(_0x506cf9,null));};exports['show']=function(_0x5c4632,_0x2511d9){var _0x197ad1={'raw':!![],'where':{'id':_0x5c4632[_0xbcf4('0x47')]['id']}},_0x911221={};_0x911221[_0xbcf4('0x32')]=_[_0xbcf4('0x34')](db[_0xbcf4('0x2f')][_0xbcf4('0x30')]);_0x911221['query']=_[_0xbcf4('0x34')](_0x5c4632[_0xbcf4('0x33')]);_0x911221['filters']=_[_0xbcf4('0x36')](_0x911221[_0xbcf4('0x32')],_0x911221[_0xbcf4('0x33')]);_0x197ad1['attributes']=_[_0xbcf4('0x36')](_0x911221['model'],qs[_0xbcf4('0x37')](_0x5c4632['query'][_0xbcf4('0x37')]));_0x197ad1['attributes']=_0x197ad1[_0xbcf4('0x38')][_0xbcf4('0x39')]?_0x197ad1[_0xbcf4('0x38')]:_0x911221['model'];if(_0x5c4632[_0xbcf4('0x33')][_0xbcf4('0x43')]){_0x197ad1[_0xbcf4('0x44')]=[{'all':!![]}];}_0x197ad1=_[_0xbcf4('0x3f')]({},_0x197ad1,_0x5c4632[_0xbcf4('0x42')]);return db[_0xbcf4('0x2f')][_0xbcf4('0x48')](_0x197ad1)[_0xbcf4('0x28')](handleEntityNotFound(_0x2511d9,null))[_0xbcf4('0x28')](respondWithResult(_0x2511d9,null))['catch'](handleError(_0x2511d9,null));};exports[_0xbcf4('0x49')]=function(_0x55e4e7,_0x3faf63){return db[_0xbcf4('0x2f')]['create'](_0x55e4e7[_0xbcf4('0x4a')],{})[_0xbcf4('0x28')](respondWithResult(_0x3faf63,0xc9))[_0xbcf4('0x4b')](handleError(_0x3faf63,null));};exports[_0xbcf4('0x4c')]=function(_0x1d3bd4,_0x2ca44f){if(_0x1d3bd4['body']['id']){delete _0x1d3bd4[_0xbcf4('0x4a')]['id'];}return db[_0xbcf4('0x2f')][_0xbcf4('0x48')]({'where':{'id':_0x1d3bd4[_0xbcf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ca44f,null))[_0xbcf4('0x28')](saveUpdates(_0x1d3bd4[_0xbcf4('0x4a')],null))[_0xbcf4('0x28')](respondWithResult(_0x2ca44f,null))[_0xbcf4('0x4b')](handleError(_0x2ca44f,null));};exports[_0xbcf4('0x27')]=function(_0x13907e,_0x2a8cdb){return db[_0xbcf4('0x2f')][_0xbcf4('0x48')]({'where':{'id':_0x13907e[_0xbcf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a8cdb,null))[_0xbcf4('0x28')](removeEntity(_0x2a8cdb,null))[_0xbcf4('0x4b')](handleError(_0x2a8cdb,null));};exports[_0xbcf4('0x4d')]=function(_0x47d60a,_0x5db843){return db[_0xbcf4('0x2f')][_0xbcf4('0x4d')]()[_0xbcf4('0x28')](respondWithResult(_0x5db843,null))[_0xbcf4('0x4b')](handleError(_0x5db843,null));};function wrapUser(_0x56414e){return function(_0x804572){var _0x490478=_0x56414e['get']({'plain':!![]});_0x490478[_0xbcf4('0x4e')]=[];if(_0x804572){_0x490478[_0xbcf4('0x4f')]=_0x804572[_0xbcf4('0x50')];_0x490478[_0xbcf4('0x51')]=_0x804572;}else{_0x490478[_0xbcf4('0x4f')]=moment(0x0)['format'](_0xbcf4('0x52'));_0x490478[_0xbcf4('0x51')]={};}return _0x490478;};}exports[_0xbcf4('0x53')]=function(_0x11a81d,_0x20830e,_0xa288a){var _0x50fff5=[];return db[_0xbcf4('0x54')]['findAll']({'where':{'role':['agent',_0xbcf4('0x55'),'user']},'attributes':['id','fullname',_0xbcf4('0x2b'),'role',_0xbcf4('0x56'),_0xbcf4('0x57'),'online',_0xbcf4('0x58'),_0xbcf4('0x59'),_0xbcf4('0x5a')],'order':qs[_0xbcf4('0x3b')]('-online'),'include':[{'model':db[_0xbcf4('0x5b')],'as':_0xbcf4('0x5c'),'attributes':['id',_0xbcf4('0x2b'),_0xbcf4('0x40')],'through':{'attributes':[]}}]})[_0xbcf4('0x28')](function(_0x1c92d5){if(_0x1c92d5){var _0x356e42=_0x11a81d['user']['get']({'plain':!![]});if(!_0x356e42)throw new Error(_0xbcf4('0x5d'));if(_0x356e42['role']===_0xbcf4('0x5e')){return db['UserProfileSection'][_0xbcf4('0x48')]({'where':{'name':_0xbcf4('0x5f'),'userProfileId':_0x356e42['userProfileId']},'raw':!![]})['then'](function(_0x5ea491){if(_0x5ea491){if(_0x5ea491[_0xbcf4('0x60')]===0x0){return db[_0xbcf4('0x61')][_0xbcf4('0x45')]({'where':{'sectionId':_0x5ea491['id']},'raw':!![]})[_0xbcf4('0x28')](function(_0x58a283){var _0x5689ed=[];if(_[_0xbcf4('0x62')](_0x58a283)){_0x5689ed=_[_0xbcf4('0x3e')](_0x1c92d5,function(_0x49bf05){if(_0x49bf05[_0xbcf4('0x63')]!==_0xbcf4('0x64')){return _0x49bf05;}});return _0x5689ed;}else{for(var _0x54192d=0x0;_0x54192d<_0x1c92d5[_0xbcf4('0x39')];_0x54192d++){var _0x2b7a05=_0x1c92d5[_0x54192d];if(_0x2b7a05[_0xbcf4('0x63')]===_0xbcf4('0x64')){var _0x2f9e1a=_[_0xbcf4('0x48')](_0x58a283,function(_0x1fb15e){return _0x1fb15e['resourceId']===_0x2b7a05['id'];});if(_0x2f9e1a)_0x5689ed[_0xbcf4('0x65')](_0x2b7a05);}else{_0x5689ed['push'](_0x2b7a05);}}return _0x5689ed;}});}else{return _0x1c92d5;}}else{var _0x2ce064=_[_0xbcf4('0x3e')](_0x1c92d5,function(_0x5e7086){if(_0x5e7086[_0xbcf4('0x63')]!==_0xbcf4('0x64')){return _0x5e7086;}});return _0x2ce064;}});}else{return _0x1c92d5;}}})[_0xbcf4('0x28')](function(_0x50dac5){var _0x23a8af=[];if(_0x50dac5){_0x50fff5=_0x50dac5;for(var _0x310a0f=0x0;_0x310a0f<_0x50dac5['length'];_0x310a0f+=0x1){_0x50fff5[_0x310a0f][_0xbcf4('0x4e')]=[];_0x23a8af[_0xbcf4('0x65')](db[_0xbcf4('0x2f')][_0xbcf4('0x48')]({'where':{'FromId':[_0x11a81d['user']['id'],_0x50dac5[_0x310a0f]['id']],'ToId':[_0x11a81d[_0xbcf4('0x5e')]['id'],_0x50dac5[_0x310a0f]['id']],'ChatGroupId':null},'attributes':['id',_0xbcf4('0x50'),_0xbcf4('0x66'),_0xbcf4('0x67'),_0xbcf4('0x68'),_0xbcf4('0x4a')],'order':qs['sort'](_0xbcf4('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xbcf4('0x28')](wrapUser(_0x50dac5[_0x310a0f])));}return BPromise[_0xbcf4('0x6a')](_0x23a8af);}return[];})[_0xbcf4('0x28')](function(_0x439107){return{'rows':_0x439107,'count':_0x439107[_0xbcf4('0x39')]};})[_0xbcf4('0x28')](respondWithResult(_0x20830e,null))[_0xbcf4('0x4b')](handleError(_0x20830e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 828acc6..10ce2b6 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 _0x7b39=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','ChatInternalMessage'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x7b39,0x66));var _0x97b3=function(_0x7eb3ad,_0x571c4e){_0x7eb3ad=_0x7eb3ad-0x0;var _0x19816b=_0x7b39[_0x7eb3ad];return _0x19816b;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x97b3('0x0'))['db'][_0x97b3('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x97b3('0x2')](0x0);var events={'afterCreate':_0x97b3('0x3'),'afterUpdate':_0x97b3('0x4'),'afterDestroy':_0x97b3('0x5')};function emitEvent(_0x5c4de0){return function(_0x438fe4,_0x276941,_0x367f54){ChatInternalMessageEvents['emit'](_0x5c4de0+':'+_0x438fe4['id'],_0x438fe4);ChatInternalMessageEvents[_0x97b3('0x6')](_0x5c4de0,_0x438fe4);_0x367f54(null);};}for(var e in events){if(events[_0x97b3('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xe810=['../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4500df,_0xaaf3ca){var _0x4e3018=function(_0x45a11a){while(--_0x45a11a){_0x4500df['push'](_0x4500df['shift']());}};_0x4e3018(++_0xaaf3ca);}(_0xe810,0xf0));var _0x0e81=function(_0x1e159e,_0x426d76){_0x1e159e=_0x1e159e-0x0;var _0x107cd7=_0xe810[_0x1e159e];return _0x107cd7;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x0e81('0x0'))['db'][_0x0e81('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0e81('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e81('0x3'),'afterDestroy':_0x0e81('0x4')};function emitEvent(_0x4cd910){return function(_0x144a4f,_0x2b5477,_0x320ae0){ChatInternalMessageEvents[_0x0e81('0x5')](_0x4cd910+':'+_0x144a4f['id'],_0x144a4f);ChatInternalMessageEvents[_0x0e81('0x5')](_0x4cd910,_0x144a4f);_0x320ae0(null);};}for(var e in events){if(events[_0x0e81('0x6')](e)){var event=events[e];ChatInternalMessage[_0x0e81('0x7')](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 860bea5..6165588 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 _0x9f7a=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b0851,_0xcbcf49){var _0x3f35bb=function(_0xa99012){while(--_0xa99012){_0x2b0851['push'](_0x2b0851['shift']());}};_0x3f35bb(++_0xcbcf49);}(_0x9f7a,0xc4));var _0xa9f7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9f7a[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0xa9f7('0x0'));var logger=require(_0xa9f7('0x1'))('api');var moment=require(_0xa9f7('0x2'));var BPromise=require(_0xa9f7('0x3'));var rp=require(_0xa9f7('0x4'));var fs=require('fs');var path=require(_0xa9f7('0x5'));var rimraf=require(_0xa9f7('0x6'));var config=require(_0xa9f7('0x7'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x31a70e,_0x5a891a){return _0x31a70e['define'](_0xa9f7('0x8'),attributes,{'tableName':_0xa9f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa9f7('0xa'),'collate':_0xa9f7('0xb')});}; \ No newline at end of file +var _0x66ad=['rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x66ad,0x166));var _0xd66a=function(_0x4bbcc1,_0x289c0c){_0x4bbcc1=_0x4bbcc1-0x0;var _0x546f80=_0x66ad[_0x4bbcc1];return _0x546f80;};'use strict';var _=require(_0xd66a('0x0'));var util=require(_0xd66a('0x1'));var logger=require('../../config/logger')(_0xd66a('0x2'));var moment=require('moment');var BPromise=require(_0xd66a('0x3'));var rp=require(_0xd66a('0x4'));var fs=require('fs');var path=require(_0xd66a('0x5'));var rimraf=require(_0xd66a('0x6'));var config=require(_0xd66a('0x7'));var attributes=require(_0xd66a('0x8'));module['exports']=function(_0x543f7e,_0x19346c){return _0x543f7e[_0xd66a('0x9')](_0xd66a('0xa'),attributes,{'tableName':_0xd66a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd66a('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index a7e3c83..602140e 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 _0xa039=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x4cc402,_0x58d30c){var _0x4b5d6b=function(_0x55e4f6){while(--_0x55e4f6){_0x4cc402['push'](_0x4cc402['shift']());}};_0x4b5d6b(++_0x58d30c);}(_0xa039,0x133));var _0x9a03=function(_0xab4618,_0x5c6d29){_0xab4618=_0xab4618-0x0;var _0x53679c=_0xa039[_0xab4618];return _0x53679c;};'use strict';var _=require(_0x9a03('0x0'));var util=require(_0x9a03('0x1'));var moment=require(_0x9a03('0x2'));var BPromise=require(_0x9a03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a03('0x4'));var db=require(_0x9a03('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a03('0x6'))('rpc');var config=require(_0x9a03('0x7'));var jayson=require(_0x9a03('0x8'));var client=jayson['client'][_0x9a03('0x9')]({'port':0x232a});config[_0x9a03('0xa')]=_[_0x9a03('0xb')](config[_0x9a03('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a03('0xa')]));require(_0x9a03('0xc'))[_0x9a03('0xd')](socket);function respondWithRpcPromise(_0x134e57,_0x48ccbd,_0x53acf2){return new BPromise(function(_0x2486e2,_0x39f772){return client[_0x9a03('0xe')](_0x134e57,_0x53acf2)[_0x9a03('0xf')](function(_0x21d837){logger[_0x9a03('0x10')](_0x9a03('0x11'),_0x48ccbd,_0x9a03('0x12'));logger[_0x9a03('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x48ccbd,_0x9a03('0x12'),JSON[_0x9a03('0x14')](_0x21d837));if(_0x21d837[_0x9a03('0x15')]){if(_0x21d837[_0x9a03('0x15')][_0x9a03('0x16')]===0x1f4){logger[_0x9a03('0x15')](_0x9a03('0x11'),_0x48ccbd,_0x21d837[_0x9a03('0x15')][_0x9a03('0x17')]);return _0x39f772(_0x21d837[_0x9a03('0x15')][_0x9a03('0x17')]);}logger[_0x9a03('0x15')](_0x9a03('0x11'),_0x48ccbd,_0x21d837['error'][_0x9a03('0x17')]);return _0x2486e2(_0x21d837['error'][_0x9a03('0x17')]);}else{logger[_0x9a03('0x10')](_0x9a03('0x11'),_0x48ccbd,_0x9a03('0x12'));_0x2486e2(_0x21d837[_0x9a03('0x18')]['message']);}})['catch'](function(_0x317540){logger['error'](_0x9a03('0x11'),_0x48ccbd,_0x317540);_0x39f772(_0x317540);});});} \ No newline at end of file +var _0x0261=['request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x46d8b2,_0x3829c4){var _0x1a351f=function(_0x279ce5){while(--_0x279ce5){_0x46d8b2['push'](_0x46d8b2['shift']());}};_0x1a351f(++_0x3829c4);}(_0x0261,0x11b));var _0x1026=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x0261[_0x28a5ad];return _0x176b8a;};'use strict';var _=require(_0x1026('0x0'));var util=require(_0x1026('0x1'));var moment=require(_0x1026('0x2'));var BPromise=require(_0x1026('0x3'));var rs=require(_0x1026('0x4'));var fs=require('fs');var Redis=require(_0x1026('0x5'));var db=require(_0x1026('0x6'))['db'];var utils=require(_0x1026('0x7'));var logger=require(_0x1026('0x8'))(_0x1026('0x9'));var config=require(_0x1026('0xa'));var jayson=require(_0x1026('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x1026('0xc')]=_[_0x1026('0xd')](config['redis'],{'host':_0x1026('0xe'),'port':0x18eb});var socket=require(_0x1026('0xf'))(new Redis(config[_0x1026('0xc')]));require('./chatInternalMessage.socket')[_0x1026('0x10')](socket);function respondWithRpcPromise(_0x2341e7,_0xf417a8,_0x32e84b){return new BPromise(function(_0x1f3b9d,_0xf8d029){return client[_0x1026('0x11')](_0x2341e7,_0x32e84b)[_0x1026('0x12')](function(_0x51413f){logger[_0x1026('0x13')](_0x1026('0x14'),_0xf417a8,'request\x20sent');logger[_0x1026('0x15')](_0x1026('0x16'),_0xf417a8,'request\x20sent',JSON['stringify'](_0x51413f));if(_0x51413f[_0x1026('0x17')]){if(_0x51413f['error']['code']===0x1f4){logger['error'](_0x1026('0x14'),_0xf417a8,_0x51413f[_0x1026('0x17')][_0x1026('0x18')]);return _0xf8d029(_0x51413f['error'][_0x1026('0x18')]);}logger[_0x1026('0x17')](_0x1026('0x14'),_0xf417a8,_0x51413f[_0x1026('0x17')]['message']);return _0x1f3b9d(_0x51413f[_0x1026('0x17')][_0x1026('0x18')]);}else{logger['info'](_0x1026('0x14'),_0xf417a8,_0x1026('0x19'));_0x1f3b9d(_0x51413f[_0x1026('0x1a')][_0x1026('0x18')]);}})[_0x1026('0x1b')](function(_0x360119){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0xf417a8,_0x360119);_0xf8d029(_0x360119);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 249fcd9..79a9828 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 _0x2674=['removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x42f488,_0x59d8f5){var _0xdf49b7=function(_0x243931){while(--_0x243931){_0x42f488['push'](_0x42f488['shift']());}};_0xdf49b7(++_0x59d8f5);}(_0x2674,0x14b));var _0x4267=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2674[_0x110c3d];return _0x226d67;};'use strict';var ChatInternalMessageEvents=require(_0x4267('0x0'));var events=[_0x4267('0x1'),_0x4267('0x2'),_0x4267('0x3')];function createListener(_0x5dcb7a,_0x43d392){return function(_0x47fe15){_0x43d392[_0x4267('0x4')](_0x5dcb7a,_0x47fe15);};}function removeListener(_0x5e6541,_0x134b4f){return function(){ChatInternalMessageEvents[_0x4267('0x5')](_0x5e6541,_0x134b4f);};}exports['register']=function(_0x1fd65a){for(var _0x51424e=0x0,_0x570e19=events[_0x4267('0x6')];_0x51424e<_0x570e19;_0x51424e++){var _0x50d3e3=events[_0x51424e];var _0xbcf89a=createListener(_0x4267('0x7')+_0x50d3e3,_0x1fd65a);ChatInternalMessageEvents['on'](_0x50d3e3,_0xbcf89a);}}; \ No newline at end of file +var _0x679c=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x275222,_0x7635fe){var _0x14a885=function(_0x269f87){while(--_0x269f87){_0x275222['push'](_0x275222['shift']());}};_0x14a885(++_0x7635fe);}(_0x679c,0xd6));var _0xc679=function(_0xd0cffa,_0x558124){_0xd0cffa=_0xd0cffa-0x0;var _0x5087ab=_0x679c[_0xd0cffa];return _0x5087ab;};'use strict';var ChatInternalMessageEvents=require(_0xc679('0x0'));var events=[_0xc679('0x1'),_0xc679('0x2'),'update'];function createListener(_0x5b0437,_0x4671a2){return function(_0x1f86b7){_0x4671a2['emit'](_0x5b0437,_0x1f86b7);};}function removeListener(_0xb2a879,_0x24c542){return function(){ChatInternalMessageEvents[_0xc679('0x3')](_0xb2a879,_0x24c542);};}exports[_0xc679('0x4')]=function(_0x1a35ee){for(var _0x1fc7c7=0x0,_0x1fee26=events[_0xc679('0x5')];_0x1fc7c7<_0x1fee26;_0x1fc7c7++){var _0x1de1ec=events[_0x1fc7c7];var _0x4827b0=createListener(_0xc679('0x6')+_0x1de1ec,_0x1a35ee);ChatInternalMessageEvents['on'](_0x1de1ec,_0x4827b0);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ae2fe54..583a75a 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 _0xeebd=['/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','getUsers'];(function(_0x57a92d,_0x2fc4f4){var _0x3a92b2=function(_0x45ca43){while(--_0x45ca43){_0x57a92d['push'](_0x57a92d['shift']());}};_0x3a92b2(++_0x2fc4f4);}(_0xeebd,0x117));var _0xdeeb=function(_0x3ec48a,_0x28de6b){_0x3ec48a=_0x3ec48a-0x0;var _0x5901da=_0xeebd[_0x3ec48a];return _0x5901da;};'use strict';var multer=require(_0xdeeb('0x0'));var util=require(_0xdeeb('0x1'));var path=require(_0xdeeb('0x2'));var timeout=require(_0xdeeb('0x3'));var express=require(_0xdeeb('0x4'));var router=express[_0xdeeb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdeeb('0x6'));var interaction=require(_0xdeeb('0x7'));var config=require('../../config/environment');var controller=require(_0xdeeb('0x8'));router[_0xdeeb('0x9')]('/',auth[_0xdeeb('0xa')](),controller[_0xdeeb('0xb')]);router['get'](_0xdeeb('0xc'),auth[_0xdeeb('0xa')](),controller['describe']);router[_0xdeeb('0x9')](_0xdeeb('0xd'),auth[_0xdeeb('0xa')](),controller[_0xdeeb('0xe')]);router[_0xdeeb('0x9')](_0xdeeb('0xf'),auth[_0xdeeb('0xa')](),controller[_0xdeeb('0x10')]);router['post']('/',auth[_0xdeeb('0xa')](),controller[_0xdeeb('0x11')]);router['put'](_0xdeeb('0xf'),controller[_0xdeeb('0x12')]);router[_0xdeeb('0x13')](_0xdeeb('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xdeeb('0x14')]=router; \ No newline at end of file +var _0xe2f2=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','destroy','exports','multer','util','path'];(function(_0x3a728e,_0x1b4c9d){var _0xd248b9=function(_0x15ae84){while(--_0x15ae84){_0x3a728e['push'](_0x3a728e['shift']());}};_0xd248b9(++_0x1b4c9d);}(_0xe2f2,0x95));var _0x2e2f=function(_0x134110,_0x4a8602){_0x134110=_0x134110-0x0;var _0x3f2e97=_0xe2f2[_0x134110];return _0x3f2e97;};'use strict';var multer=require(_0x2e2f('0x0'));var util=require(_0x2e2f('0x1'));var path=require(_0x2e2f('0x2'));var timeout=require(_0x2e2f('0x3'));var express=require(_0x2e2f('0x4'));var router=express['Router']();var fs_extra=require(_0x2e2f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e2f('0x6'));var config=require(_0x2e2f('0x7'));var controller=require(_0x2e2f('0x8'));router[_0x2e2f('0x9')]('/',auth[_0x2e2f('0xa')](),controller[_0x2e2f('0xb')]);router[_0x2e2f('0x9')](_0x2e2f('0xc'),auth[_0x2e2f('0xa')](),controller[_0x2e2f('0xd')]);router[_0x2e2f('0x9')]('/users',auth[_0x2e2f('0xa')](),controller['getUsers']);router['get'](_0x2e2f('0xe'),auth[_0x2e2f('0xa')](),controller[_0x2e2f('0xf')]);router['post']('/',auth[_0x2e2f('0xa')](),controller['create']);router['put'](_0x2e2f('0xe'),controller[_0x2e2f('0x10')]);router['delete'](_0x2e2f('0xe'),auth[_0x2e2f('0xa')](),controller[_0x2e2f('0x11')]);module[_0x2e2f('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1077f3e..708d518 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 _0xb8a0=['STRING','TEXT','medium','BOOLEAN'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x27d7ee,_0x482447){_0x27d7ee=_0x27d7ee-0x0;var _0x313e7a=_0xb8a0[_0x27d7ee];return _0x313e7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x0b8a('0x0')](_0x0b8a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0b8a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0b8a('0x3')]},'providerResponse':{'type':Sequelize[_0x0b8a('0x0')]}}; \ No newline at end of file +var _0x676c=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x41c77b,_0x224480){var _0x3f36e0=function(_0x3650d0){while(--_0x3650d0){_0x41c77b['push'](_0x41c77b['shift']());}};_0x3f36e0(++_0x224480);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc676('0x0'));module[_0xc676('0x1')]={'body':{'type':Sequelize[_0xc676('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc676('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc676('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc676('0x4')]('in',_0xc676('0x5')),'defaultValue':_0xc676('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc676('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc676('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index fb06729..306f7ce 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 _0x59ae=['destroy','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','merge','VIRTUAL','count','includeAll','include','findAll','show','params','find','create','body','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','agent','email','internal','manual','interface','SIP/%s','channel','event','EventManager','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','User','fullname','motionChannel','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','set','Content-Range','reject','save','update','then'];(function(_0x47fb6e,_0x32dce1){var _0x31c478=function(_0x3bfa13){while(--_0x3bfa13){_0x47fb6e['push'](_0x47fb6e['shift']());}};_0x31c478(++_0x32dce1);}(_0x59ae,0x1d2));var _0xe59a=function(_0x3053e1,_0x187e21){_0x3053e1=_0x3053e1-0x0;var _0x54067e=_0x59ae[_0x3053e1];return _0x54067e;};'use strict';var emlformat=require(_0xe59a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe59a('0x1'));var jsonpatch=require(_0xe59a('0x2'));var rp=require(_0xe59a('0x3'));var moment=require(_0xe59a('0x4'));var BPromise=require(_0xe59a('0x5'));var Mustache=require(_0xe59a('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe59a('0x7'));var csv=require('to-csv');var ejs=require(_0xe59a('0x8'));var fs=require('fs');var fs_extra=require(_0xe59a('0x9'));var _=require(_0xe59a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe59a('0xb'));var deskjs=require(_0xe59a('0xc'));var toCsv=require(_0xe59a('0xd'));var querystring=require('querystring');var Papa=require(_0xe59a('0xe'));var Redis=require(_0xe59a('0xf'));var authService=require(_0xe59a('0x10'));var qs=require(_0xe59a('0x11'));var as=require(_0xe59a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe59a('0x13'))(_0xe59a('0x14'));var utils=require(_0xe59a('0x15'));var config=require(_0xe59a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe59a('0x17'))['db'];config[_0xe59a('0x18')]=_[_0xe59a('0x19')](config[_0xe59a('0x18')],{'host':_0xe59a('0x1a'),'port':0x18eb});var socket=require(_0xe59a('0x1b'))(new Redis(config[_0xe59a('0x18')]));require('./chatMessage.socket')[_0xe59a('0x1c')](socket);var jayson=require(_0xe59a('0x1d'));var client=jayson[_0xe59a('0x1e')][_0xe59a('0x1f')]({'port':0x232c});var client9002=jayson[_0xe59a('0x1e')][_0xe59a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x32d867,_0xe1d9b0,_0x421937,_0x2813f4){return new BPromise(function(_0x73fbc5,_0x237b57){var _0x1c714a=_0x2813f4||client;return _0x1c714a[_0xe59a('0x20')](_0x32d867,_0x421937)['then'](function(_0x347ce2){logger[_0xe59a('0x21')](_0xe59a('0x22'),_0xe1d9b0,_0xe59a('0x23'));logger[_0xe59a('0x24')](_0xe59a('0x25'),_0xe1d9b0,_0xe59a('0x23'),JSON[_0xe59a('0x26')](_0x347ce2));if(_0x347ce2[_0xe59a('0x27')]){if(_0x347ce2[_0xe59a('0x27')]['code']===0x1f4){logger[_0xe59a('0x27')]('ChatMessage,\x20%s,\x20%s',_0xe1d9b0,_0x347ce2[_0xe59a('0x27')][_0xe59a('0x28')]);return _0x237b57(_0x347ce2[_0xe59a('0x27')]['message']);}logger['error'](_0xe59a('0x22'),_0xe1d9b0,_0x347ce2['error'][_0xe59a('0x28')]);return _0x73fbc5(_0x347ce2['error'][_0xe59a('0x28')]);}else{logger[_0xe59a('0x21')](_0xe59a('0x22'),_0xe1d9b0,_0xe59a('0x23'));_0x73fbc5(_0x347ce2[_0xe59a('0x29')][_0xe59a('0x28')]);}})[_0xe59a('0x2a')](function(_0x18e57e){logger['error'](_0xe59a('0x22'),_0xe1d9b0,_0x18e57e);_0x237b57(_0x18e57e);});});}function respondWithStatusCode(_0x48615c,_0x380e35){_0x380e35=_0x380e35||0xcc;return function(_0x4c21d3){if(_0x4c21d3){return _0x48615c['sendStatus'](_0x380e35);}return _0x48615c[_0xe59a('0x2b')](_0x380e35)[_0xe59a('0x2c')]();};}function respondWithResult(_0x72c579,_0x4903f9){_0x4903f9=_0x4903f9||0xc8;return function(_0x2234fb){if(_0x2234fb){return _0x72c579[_0xe59a('0x2b')](_0x4903f9)[_0xe59a('0x2d')](_0x2234fb);}};}function respondWithFilteredResult(_0x2dca3b,_0x195e07){return function(_0x179030){if(_0x179030){var _0x2767b4=typeof _0x195e07[_0xe59a('0x2e')]===_0xe59a('0x2f')&&typeof _0x195e07['limit']===_0xe59a('0x2f');var _0x3de921=_0x179030['count'];var _0x2da178=_0x2767b4?0x0:_0x195e07[_0xe59a('0x2e')];var _0x23c361=_0x2767b4?_0x179030['count']:_0x195e07['offset']+_0x195e07['limit'];var _0x4935f1;if(_0x23c361>=_0x3de921){_0x23c361=_0x3de921;_0x4935f1=0xc8;}else{_0x4935f1=0xce;}_0x2dca3b[_0xe59a('0x2b')](_0x4935f1);return _0x2dca3b[_0xe59a('0x30')](_0xe59a('0x31'),_0x2da178+'-'+_0x23c361+'/'+_0x3de921)[_0xe59a('0x2d')](_0x179030);}return null;};}function patchUpdates(_0x47e567){return function(_0x522307){try{jsonpatch['apply'](_0x522307,_0x47e567,!![]);}catch(_0x579e56){return BPromise[_0xe59a('0x32')](_0x579e56);}return _0x522307[_0xe59a('0x33')]();};}function saveUpdates(_0x17380e,_0x213ee8){return function(_0x3abf62){if(_0x3abf62){return _0x3abf62[_0xe59a('0x34')](_0x17380e)[_0xe59a('0x35')](function(_0x4a7908){return _0x4a7908;});}return null;};}function removeEntity(_0x26a166,_0x4f6556){return function(_0x399db4){if(_0x399db4){return _0x399db4[_0xe59a('0x36')]()[_0xe59a('0x35')](function(){_0x26a166[_0xe59a('0x2b')](0xcc)[_0xe59a('0x2c')]();});}};}function handleEntityNotFound(_0x2b6486,_0x20b3e3){return function(_0x59eab0){if(!_0x59eab0){_0x2b6486[_0xe59a('0x37')](0x194);}return _0x59eab0;};}function handleError(_0xdb1cb8,_0x2f92ca){_0x2f92ca=_0x2f92ca||0x1f4;return function(_0x29b113){logger[_0xe59a('0x27')](_0x29b113[_0xe59a('0x38')]);if(_0x29b113[_0xe59a('0x39')]){delete _0x29b113['name'];}_0xdb1cb8[_0xe59a('0x2b')](_0x2f92ca)[_0xe59a('0x3a')](_0x29b113);};}exports['index']=function(_0x180aa,_0x5a6cf7){var _0xaa2541={},_0x651ed4={},_0x3ec31b={'count':0x0,'rows':[]};var _0x336bdb=_[_0xe59a('0x3b')](db[_0xe59a('0x3c')][_0xe59a('0x3d')],function(_0x20eaa9){return{'name':_0x20eaa9['fieldName'],'type':_0x20eaa9[_0xe59a('0x3e')][_0xe59a('0x3f')]};});_0x651ed4[_0xe59a('0x40')]=_[_0xe59a('0x3b')](_0x336bdb,_0xe59a('0x39'));_0x651ed4[_0xe59a('0x41')]=_[_0xe59a('0x42')](_0x180aa['query']);_0x651ed4[_0xe59a('0x43')]=_['intersection'](_0x651ed4['model'],_0x651ed4[_0xe59a('0x41')]);_0xaa2541[_0xe59a('0x44')]=_[_0xe59a('0x45')](_0x651ed4[_0xe59a('0x40')],qs[_0xe59a('0x46')](_0x180aa[_0xe59a('0x41')][_0xe59a('0x46')]));_0xaa2541[_0xe59a('0x44')]=_0xaa2541[_0xe59a('0x44')][_0xe59a('0x47')]?_0xaa2541[_0xe59a('0x44')]:_0x651ed4[_0xe59a('0x40')];if(!_0x180aa[_0xe59a('0x41')]['hasOwnProperty'](_0xe59a('0x48'))){_0xaa2541[_0xe59a('0x49')]=qs[_0xe59a('0x49')](_0x180aa[_0xe59a('0x41')]['limit']);_0xaa2541[_0xe59a('0x2e')]=qs[_0xe59a('0x2e')](_0x180aa[_0xe59a('0x41')]['offset']);}_0xaa2541[_0xe59a('0x4a')]=qs[_0xe59a('0x4b')](_0x180aa[_0xe59a('0x41')]['sort']);_0xaa2541['where']=qs[_0xe59a('0x43')](_['pick'](_0x180aa[_0xe59a('0x41')],_0x651ed4['filters']),_0x336bdb);if(_0x180aa[_0xe59a('0x41')]['filter']){_0xaa2541[_0xe59a('0x4c')]=_[_0xe59a('0x4d')](_0xaa2541[_0xe59a('0x4c')],{'$or':_['map'](_0x336bdb,function(_0x4cb41b){if(_0x4cb41b[_0xe59a('0x3e')]!==_0xe59a('0x4e')){var _0x353a4d={};_0x353a4d[_0x4cb41b[_0xe59a('0x39')]]={'$like':'%'+_0x180aa['query']['filter']+'%'};return _0x353a4d;}})});}_0xaa2541=_[_0xe59a('0x4d')]({},_0xaa2541,_0x180aa['options']);var _0x4bf0f1={'where':_0xaa2541[_0xe59a('0x4c')]};return db[_0xe59a('0x3c')][_0xe59a('0x4f')](_0x4bf0f1)[_0xe59a('0x35')](function(_0x4eaed4){_0x3ec31b[_0xe59a('0x4f')]=_0x4eaed4;if(_0x180aa['query'][_0xe59a('0x50')]){_0xaa2541[_0xe59a('0x51')]=[{'all':!![]}];}return db[_0xe59a('0x3c')][_0xe59a('0x52')](_0xaa2541);})[_0xe59a('0x35')](function(_0xfecf4e){_0x3ec31b['rows']=_0xfecf4e;return _0x3ec31b;})[_0xe59a('0x35')](respondWithFilteredResult(_0x5a6cf7,_0xaa2541))[_0xe59a('0x2a')](handleError(_0x5a6cf7,null));};exports[_0xe59a('0x53')]=function(_0x598480,_0x1c1ba3){var _0x5781dd={'raw':!![],'where':{'id':_0x598480[_0xe59a('0x54')]['id']}},_0x146c99={};_0x146c99['model']=_['keys'](db['ChatMessage'][_0xe59a('0x3d')]);_0x146c99['query']=_[_0xe59a('0x42')](_0x598480[_0xe59a('0x41')]);_0x146c99[_0xe59a('0x43')]=_['intersection'](_0x146c99['model'],_0x146c99['query']);_0x5781dd[_0xe59a('0x44')]=_[_0xe59a('0x45')](_0x146c99[_0xe59a('0x40')],qs[_0xe59a('0x46')](_0x598480[_0xe59a('0x41')][_0xe59a('0x46')]));_0x5781dd[_0xe59a('0x44')]=_0x5781dd[_0xe59a('0x44')]['length']?_0x5781dd[_0xe59a('0x44')]:_0x146c99[_0xe59a('0x40')];if(_0x598480[_0xe59a('0x41')]['includeAll']){_0x5781dd[_0xe59a('0x51')]=[{'all':!![]}];}_0x5781dd=_[_0xe59a('0x4d')]({},_0x5781dd,_0x598480['options']);return db[_0xe59a('0x3c')][_0xe59a('0x55')](_0x5781dd)[_0xe59a('0x35')](handleEntityNotFound(_0x1c1ba3,null))['then'](respondWithResult(_0x1c1ba3,null))[_0xe59a('0x2a')](handleError(_0x1c1ba3,null));};exports[_0xe59a('0x56')]=function(_0x268f4f,_0xf9b907){return db['ChatMessage']['create'](_0x268f4f[_0xe59a('0x57')],{})[_0xe59a('0x35')](respondWithResult(_0xf9b907,0xc9))[_0xe59a('0x2a')](handleError(_0xf9b907,null));};exports[_0xe59a('0x34')]=function(_0x30aa80,_0x38e875){if(_0x30aa80[_0xe59a('0x57')]['id']){delete _0x30aa80[_0xe59a('0x57')]['id'];}return db['ChatMessage'][_0xe59a('0x55')]({'where':{'id':_0x30aa80[_0xe59a('0x54')]['id']}})[_0xe59a('0x35')](handleEntityNotFound(_0x38e875,null))[_0xe59a('0x35')](saveUpdates(_0x30aa80['body'],null))[_0xe59a('0x35')](respondWithResult(_0x38e875,null))[_0xe59a('0x2a')](handleError(_0x38e875,null));};exports[_0xe59a('0x36')]=function(_0x3fc71b,_0x462c81){return db[_0xe59a('0x3c')][_0xe59a('0x55')]({'where':{'id':_0x3fc71b[_0xe59a('0x54')]['id']}})[_0xe59a('0x35')](handleEntityNotFound(_0x462c81,null))['then'](removeEntity(_0x462c81,null))[_0xe59a('0x2a')](handleError(_0x462c81,null));};exports['describe']=function(_0x4f82a8,_0x4fbafa){return db['ChatMessage']['describe']()[_0xe59a('0x35')](respondWithResult(_0x4fbafa,null))[_0xe59a('0x2a')](handleError(_0x4fbafa,null));};var interaction_log=require('../../config/logger')(_0xe59a('0x58'));exports[_0xe59a('0x59')]=function(_0x2fe8c4,_0x301ed2,_0x2e851e){var _0x243d23={'agent':{},'channel':_0xe59a('0x5a')};if(_0x2fe8c4[_0xe59a('0x57')]['id']){delete _0x2fe8c4['body']['id'];}_0x2fe8c4[_0xe59a('0x57')][_0xe59a('0x5b')]=!![];_0x2fe8c4[_0xe59a('0x57')]['readAt']=moment()[_0xe59a('0x5c')](_0xe59a('0x5d'));_0x2fe8c4[_0xe59a('0x57')][_0xe59a('0x5e')]=_0x2fe8c4['body'][_0xe59a('0x5e')]||_0x2fe8c4['user']['id'];_0x243d23['agent']['id']=_0x2fe8c4[_0xe59a('0x57')][_0xe59a('0x5e')];return db['ChatMessage'][_0xe59a('0x55')]({'where':{'id':_0x2fe8c4[_0xe59a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x301ed2,null))['then'](saveUpdates(_0x2fe8c4[_0xe59a('0x57')],null))['then'](function(_0x44057a){if(_0x44057a){_0x243d23[_0xe59a('0x28')]=_0x44057a[_0xe59a('0x5f')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x44057a[_0xe59a('0x60')]}});}return null;})[_0xe59a('0x35')](handleEntityNotFound(_0x301ed2,null))[_0xe59a('0x35')](function(_0x419384){if(_0x419384){return _0x419384[_0xe59a('0x34')]({'UserId':_0x2fe8c4[_0xe59a('0x57')]['UserId'],'read1stAt':_[_0xe59a('0x61')](_0x419384[_0xe59a('0x62')])?moment()[_0xe59a('0x5c')](_0xe59a('0x5d')):undefined});}return null;})[_0xe59a('0x35')](function(_0x493af8){if(_0x493af8){_0x243d23[_0xe59a('0x63')]=_0x493af8[_0xe59a('0x5f')]({'plain':!![]});interaction_log[_0xe59a('0x21')](_0xe59a('0x64'),_0x2fe8c4[_0xe59a('0x65')]['id'],_0x2fe8c4[_0xe59a('0x65')][_0xe59a('0x39')],_0x2fe8c4[_0xe59a('0x65')][_0xe59a('0x66')],_0x243d23[_0xe59a('0x63')]['id'],_0x2fe8c4[_0xe59a('0x57')]?JSON[_0xe59a('0x26')](_0x2fe8c4['body']):_0xe59a('0x67'));return respondWithRpcPromise(_0xe59a('0x68'),_0xe59a('0x69'),_0x243d23);}return null;})[_0xe59a('0x35')](function(_0x56e2b){var _0x211d4d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x56e2b[_0xe59a('0x28')][_0xe59a('0x6a')];return db[_0xe59a('0x6b')][_0xe59a('0x41')](_0x211d4d,{'type':db['Sequelize'][_0xe59a('0x6c')][_0xe59a('0x6d')],'raw':!![]})[_0xe59a('0x35')](function(_0x41a6cc){return _0x41a6cc;});})['then'](function(_0x109ca9){if(_0x109ca9){_0x243d23[_0xe59a('0x28')][_0xe59a('0x6e')]=_0x109ca9[0x0];if(!_0x2fe8c4['body'][_0xe59a('0x5e')])return;return db['User'][_0xe59a('0x55')]({'where':{'id':_0x2fe8c4[_0xe59a('0x57')]['UserId'],'role':_0xe59a('0x6f')},'attributes':['id',_0xe59a('0x39'),'fullname',_0xe59a('0x70'),_0xe59a('0x71')],'raw':!![]});}return null;})[_0xe59a('0x35')](function(_0x2f167d){if(!_0x2f167d)return null;_0x243d23[_0xe59a('0x28')][_0xe59a('0x6f')]=_0x2f167d;return _0x243d23;})[_0xe59a('0x35')](function(_0x1487ce){if(_0x1487ce){if(_0x2fe8c4[_0xe59a('0x57')][_0xe59a('0x72')]){_0x243d23[_0xe59a('0x28')][_0xe59a('0x73')]=util[_0xe59a('0x5c')](_0xe59a('0x74'),_0x2fe8c4[_0xe59a('0x65')][_0xe59a('0x39')]);_0x243d23[_0xe59a('0x28')][_0xe59a('0x75')]=_0x243d23[_0xe59a('0x75')];_0x243d23['message']['motionChannel']=_0x243d23[_0xe59a('0x75')];_0x243d23[_0xe59a('0x28')][_0xe59a('0x76')]=_0xe59a('0x59');return respondWithRpcPromise(_0xe59a('0x77'),_0xe59a('0x77'),{'event':'acceptmessage','message':_[_0xe59a('0x4d')](_0x243d23[_0xe59a('0x28')],JSON[_0xe59a('0x78')](_0x243d23[_0xe59a('0x63')][_0xe59a('0x79')]))},client9002)[_0xe59a('0x35')](function(){return _0x243d23;});}return _0x243d23;}return null;})[_0xe59a('0x35')](respondWithResult(_0x301ed2,null))[_0xe59a('0x2a')](handleError(_0x301ed2,null));};var interaction_log=require(_0xe59a('0x13'))(_0xe59a('0x58'));exports[_0xe59a('0x32')]=function(_0x4ced36,_0x4c432c,_0x57674a){var _0x3f3ffa={'agent':{},'channel':_0xe59a('0x5a')};if(_0x4ced36['body']['id']){delete _0x4ced36[_0xe59a('0x57')]['id'];}_0x4ced36[_0xe59a('0x57')][_0xe59a('0x5e')]=_0x4ced36['body']['UserId']||_0x4ced36['user']['id'];_0x3f3ffa[_0xe59a('0x6f')]['id']=_0x4ced36['body'][_0xe59a('0x5e')];return db[_0xe59a('0x3c')][_0xe59a('0x55')]({'where':{'id':_0x4ced36[_0xe59a('0x54')]['id'],'UserId':null}})[_0xe59a('0x35')](handleEntityNotFound(_0x4c432c,null))[_0xe59a('0x35')](function(_0x1240d2){if(_0x1240d2){_0x3f3ffa[_0xe59a('0x28')]=_0x1240d2[_0xe59a('0x5f')]({'plain':!![]});return db[_0xe59a('0x7a')]['find']({'where':{'id':_0x1240d2[_0xe59a('0x60')]}});}return null;})[_0xe59a('0x35')](handleEntityNotFound(_0x4c432c,null))['then'](function(_0x4eca35){if(_0x4eca35){_0x3f3ffa[_0xe59a('0x63')]=_0x4eca35[_0xe59a('0x5f')]({'plain':!![]});interaction_log[_0xe59a('0x21')](_0xe59a('0x7b'),_0x4ced36[_0xe59a('0x65')]['id'],_0x4ced36[_0xe59a('0x65')][_0xe59a('0x39')],_0x4ced36['user'][_0xe59a('0x66')],_0x3f3ffa[_0xe59a('0x63')]['id'],_0x4ced36[_0xe59a('0x57')]?JSON[_0xe59a('0x26')](_0x4ced36[_0xe59a('0x57')]):_0xe59a('0x67'));return respondWithRpcPromise('RejectMessage',_0xe59a('0x7c'),_0x3f3ffa);}return null;})['then'](function(_0x5e034f){var _0x4f3f73='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e034f[_0xe59a('0x28')][_0xe59a('0x6a')];return db[_0xe59a('0x6b')]['query'](_0x4f3f73,{'type':db[_0xe59a('0x7d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xe59a('0x35')](function(_0x32c19c){return _0x32c19c;});})['then'](function(_0x33145c){if(_0x33145c){_0x3f3ffa['message'][_0xe59a('0x6e')]=_0x33145c[0x0];if(!_0x4ced36[_0xe59a('0x57')]['UserId'])return;return db[_0xe59a('0x7e')][_0xe59a('0x55')]({'where':{'id':_0x4ced36[_0xe59a('0x57')][_0xe59a('0x5e')],'role':'agent'},'attributes':['id',_0xe59a('0x39'),_0xe59a('0x7f'),_0xe59a('0x70'),_0xe59a('0x71')],'raw':!![]});}return null;})[_0xe59a('0x35')](function(_0x46044e){if(!_0x46044e)return null;_0x3f3ffa[_0xe59a('0x28')][_0xe59a('0x6f')]=_0x46044e;return _0x3f3ffa;})[_0xe59a('0x35')](function(_0x5e442f){if(_0x5e442f){_0x5e442f[_0xe59a('0x28')][_0xe59a('0x73')]=util['format'](_0xe59a('0x74'),_0x4ced36[_0xe59a('0x65')][_0xe59a('0x39')]);_0x5e442f[_0xe59a('0x28')][_0xe59a('0x75')]=_0x3f3ffa[_0xe59a('0x75')];_0x5e442f[_0xe59a('0x28')][_0xe59a('0x80')]=_0x3f3ffa[_0xe59a('0x75')];_0x5e442f[_0xe59a('0x28')][_0xe59a('0x76')]=_0xe59a('0x32');respondWithRpcPromise(_0xe59a('0x77'),_0xe59a('0x77'),{'event':_0xe59a('0x81'),'message':_[_0xe59a('0x4d')](_0x3f3ffa[_0xe59a('0x28')],JSON[_0xe59a('0x78')](_0x3f3ffa[_0xe59a('0x63')][_0xe59a('0x79')]))},client9002);return _0x3f3ffa;}return null;})[_0xe59a('0x35')](respondWithResult(_0x4c432c,null))[_0xe59a('0x2a')](handleError(_0x4c432c,null));}; \ No newline at end of file +var _0xfd93=['event','EventManager','acceptmessage','formData','ChatInteraction','RejectMessage','sequelize','Sequelize','email','rejectmessage','eml-format','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./chatMessage.socket','register','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','undefined','offset','count','limit','apply','reject','save','destroy','sendStatus','stack','name','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','fields','find','create','body','update','../../config/logger','chat-interactions','accept','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteractionId','isNil','read1stAt','format','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel'];(function(_0x8398e5,_0x3389f9){var _0x57c8a7=function(_0x154f13){while(--_0x154f13){_0x8398e5['push'](_0x8398e5['shift']());}};_0x57c8a7(++_0x3389f9);}(_0xfd93,0x8d));var _0x3fd9=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0xfd93[_0x34c4e1];return _0x5a11ef;};'use strict';var emlformat=require(_0x3fd9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fd9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fd9('0x2'));var moment=require(_0x3fd9('0x3'));var BPromise=require(_0x3fd9('0x4'));var Mustache=require(_0x3fd9('0x5'));var util=require(_0x3fd9('0x6'));var path=require(_0x3fd9('0x7'));var sox=require(_0x3fd9('0x8'));var csv=require(_0x3fd9('0x9'));var ejs=require(_0x3fd9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fd9('0xb'));var squel=require('squel');var crypto=require(_0x3fd9('0xc'));var jsforce=require(_0x3fd9('0xd'));var deskjs=require(_0x3fd9('0xe'));var toCsv=require(_0x3fd9('0x9'));var querystring=require(_0x3fd9('0xf'));var Papa=require(_0x3fd9('0x10'));var Redis=require(_0x3fd9('0x11'));var authService=require(_0x3fd9('0x12'));var qs=require(_0x3fd9('0x13'));var as=require(_0x3fd9('0x14'));var hardwareService=require(_0x3fd9('0x15'));var logger=require('../../config/logger')(_0x3fd9('0x16'));var utils=require(_0x3fd9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3fd9('0x18'));var db=require(_0x3fd9('0x19'))['db'];config[_0x3fd9('0x1a')]=_['defaults'](config['redis'],{'host':_0x3fd9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fd9('0x1a')]));require(_0x3fd9('0x1c'))[_0x3fd9('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3fd9('0x1e')][_0x3fd9('0x1f')]({'port':0x232c});var client9002=jayson[_0x3fd9('0x1e')][_0x3fd9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x577bd1,_0x51f405,_0x35c3ab,_0x4f28e5){return new BPromise(function(_0x410c7c,_0x3f7f4a){var _0x20e71d=_0x4f28e5||client;return _0x20e71d[_0x3fd9('0x20')](_0x577bd1,_0x35c3ab)[_0x3fd9('0x21')](function(_0x3b3022){logger['info'](_0x3fd9('0x22'),_0x51f405,_0x3fd9('0x23'));logger['debug'](_0x3fd9('0x24'),_0x51f405,'request\x20sent',JSON[_0x3fd9('0x25')](_0x3b3022));if(_0x3b3022[_0x3fd9('0x26')]){if(_0x3b3022[_0x3fd9('0x26')][_0x3fd9('0x27')]===0x1f4){logger[_0x3fd9('0x26')]('ChatMessage,\x20%s,\x20%s',_0x51f405,_0x3b3022[_0x3fd9('0x26')][_0x3fd9('0x28')]);return _0x3f7f4a(_0x3b3022[_0x3fd9('0x26')][_0x3fd9('0x28')]);}logger[_0x3fd9('0x26')]('ChatMessage,\x20%s,\x20%s',_0x51f405,_0x3b3022[_0x3fd9('0x26')]['message']);return _0x410c7c(_0x3b3022['error'][_0x3fd9('0x28')]);}else{logger[_0x3fd9('0x29')](_0x3fd9('0x22'),_0x51f405,_0x3fd9('0x23'));_0x410c7c(_0x3b3022[_0x3fd9('0x2a')]['message']);}})[_0x3fd9('0x2b')](function(_0x5c03cb){logger['error']('ChatMessage,\x20%s,\x20%s',_0x51f405,_0x5c03cb);_0x3f7f4a(_0x5c03cb);});});}function respondWithStatusCode(_0x1084bc,_0x5eb868){_0x5eb868=_0x5eb868||0xcc;return function(_0x3f3713){if(_0x3f3713){return _0x1084bc['sendStatus'](_0x5eb868);}return _0x1084bc[_0x3fd9('0x2c')](_0x5eb868)[_0x3fd9('0x2d')]();};}function respondWithResult(_0x49b39c,_0x1271d2){_0x1271d2=_0x1271d2||0xc8;return function(_0x7b650d){if(_0x7b650d){return _0x49b39c[_0x3fd9('0x2c')](_0x1271d2)[_0x3fd9('0x2e')](_0x7b650d);}};}function respondWithFilteredResult(_0x4e34e0,_0x35ecca){return function(_0x38bc47){if(_0x38bc47){var _0x425bd2=typeof _0x35ecca['offset']==='undefined'&&typeof _0x35ecca['limit']===_0x3fd9('0x2f');var _0x5d5553=_0x38bc47['count'];var _0x3cc10e=_0x425bd2?0x0:_0x35ecca[_0x3fd9('0x30')];var _0x18ddd2=_0x425bd2?_0x38bc47[_0x3fd9('0x31')]:_0x35ecca[_0x3fd9('0x30')]+_0x35ecca[_0x3fd9('0x32')];var _0x3ede52;if(_0x18ddd2>=_0x5d5553){_0x18ddd2=_0x5d5553;_0x3ede52=0xc8;}else{_0x3ede52=0xce;}_0x4e34e0[_0x3fd9('0x2c')](_0x3ede52);return _0x4e34e0['set']('Content-Range',_0x3cc10e+'-'+_0x18ddd2+'/'+_0x5d5553)['json'](_0x38bc47);}return null;};}function patchUpdates(_0x16e6ef){return function(_0x300d45){try{jsonpatch[_0x3fd9('0x33')](_0x300d45,_0x16e6ef,!![]);}catch(_0x48cc7c){return BPromise[_0x3fd9('0x34')](_0x48cc7c);}return _0x300d45[_0x3fd9('0x35')]();};}function saveUpdates(_0x1a2e7b,_0x48e015){return function(_0x3b9515){if(_0x3b9515){return _0x3b9515['update'](_0x1a2e7b)[_0x3fd9('0x21')](function(_0x255df0){return _0x255df0;});}return null;};}function removeEntity(_0x2fcaa8,_0x4c3b09){return function(_0x665d){if(_0x665d){return _0x665d[_0x3fd9('0x36')]()['then'](function(){_0x2fcaa8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58872c,_0x545c53){return function(_0x2df126){if(!_0x2df126){_0x58872c[_0x3fd9('0x37')](0x194);}return _0x2df126;};}function handleError(_0x1beade,_0x5c9502){_0x5c9502=_0x5c9502||0x1f4;return function(_0x48215c){logger[_0x3fd9('0x26')](_0x48215c[_0x3fd9('0x38')]);if(_0x48215c[_0x3fd9('0x39')]){delete _0x48215c[_0x3fd9('0x39')];}_0x1beade[_0x3fd9('0x2c')](_0x5c9502)['send'](_0x48215c);};}exports[_0x3fd9('0x3a')]=function(_0x5b764a,_0x442d8c){var _0x57dd32={},_0x5c2397={},_0x57f06a={'count':0x0,'rows':[]};var _0x45c5b1=_[_0x3fd9('0x3b')](db[_0x3fd9('0x3c')][_0x3fd9('0x3d')],function(_0x1122fd){return{'name':_0x1122fd['fieldName'],'type':_0x1122fd[_0x3fd9('0x3e')][_0x3fd9('0x3f')]};});_0x5c2397[_0x3fd9('0x40')]=_['map'](_0x45c5b1,_0x3fd9('0x39'));_0x5c2397[_0x3fd9('0x41')]=_[_0x3fd9('0x42')](_0x5b764a[_0x3fd9('0x41')]);_0x5c2397['filters']=_[_0x3fd9('0x43')](_0x5c2397[_0x3fd9('0x40')],_0x5c2397['query']);_0x57dd32[_0x3fd9('0x44')]=_[_0x3fd9('0x43')](_0x5c2397['model'],qs['fields'](_0x5b764a['query']['fields']));_0x57dd32[_0x3fd9('0x44')]=_0x57dd32[_0x3fd9('0x44')][_0x3fd9('0x45')]?_0x57dd32['attributes']:_0x5c2397[_0x3fd9('0x40')];if(!_0x5b764a[_0x3fd9('0x41')]['hasOwnProperty']('nolimit')){_0x57dd32[_0x3fd9('0x32')]=qs['limit'](_0x5b764a['query']['limit']);_0x57dd32[_0x3fd9('0x30')]=qs[_0x3fd9('0x30')](_0x5b764a[_0x3fd9('0x41')]['offset']);}_0x57dd32[_0x3fd9('0x46')]=qs['sort'](_0x5b764a[_0x3fd9('0x41')][_0x3fd9('0x47')]);_0x57dd32['where']=qs[_0x3fd9('0x48')](_[_0x3fd9('0x49')](_0x5b764a['query'],_0x5c2397[_0x3fd9('0x48')]),_0x45c5b1);if(_0x5b764a[_0x3fd9('0x41')][_0x3fd9('0x4a')]){_0x57dd32[_0x3fd9('0x4b')]=_[_0x3fd9('0x4c')](_0x57dd32[_0x3fd9('0x4b')],{'$or':_[_0x3fd9('0x3b')](_0x45c5b1,function(_0x77244){if(_0x77244[_0x3fd9('0x3e')]!==_0x3fd9('0x4d')){var _0x2a508b={};_0x2a508b[_0x77244[_0x3fd9('0x39')]]={'$like':'%'+_0x5b764a[_0x3fd9('0x41')]['filter']+'%'};return _0x2a508b;}})});}_0x57dd32=_['merge']({},_0x57dd32,_0x5b764a[_0x3fd9('0x4e')]);var _0x149df7={'where':_0x57dd32[_0x3fd9('0x4b')]};return db[_0x3fd9('0x3c')]['count'](_0x149df7)[_0x3fd9('0x21')](function(_0x5d438d){_0x57f06a[_0x3fd9('0x31')]=_0x5d438d;if(_0x5b764a[_0x3fd9('0x41')]['includeAll']){_0x57dd32[_0x3fd9('0x4f')]=[{'all':!![]}];}return db['ChatMessage'][_0x3fd9('0x50')](_0x57dd32);})['then'](function(_0x5a1057){_0x57f06a[_0x3fd9('0x51')]=_0x5a1057;return _0x57f06a;})[_0x3fd9('0x21')](respondWithFilteredResult(_0x442d8c,_0x57dd32))[_0x3fd9('0x2b')](handleError(_0x442d8c,null));};exports['show']=function(_0x1de0b6,_0x1df822){var _0x2e637e={'raw':!![],'where':{'id':_0x1de0b6[_0x3fd9('0x52')]['id']}},_0x2d239e={};_0x2d239e[_0x3fd9('0x40')]=_[_0x3fd9('0x42')](db[_0x3fd9('0x3c')][_0x3fd9('0x3d')]);_0x2d239e[_0x3fd9('0x41')]=_[_0x3fd9('0x42')](_0x1de0b6[_0x3fd9('0x41')]);_0x2d239e[_0x3fd9('0x48')]=_[_0x3fd9('0x43')](_0x2d239e[_0x3fd9('0x40')],_0x2d239e['query']);_0x2e637e['attributes']=_[_0x3fd9('0x43')](_0x2d239e[_0x3fd9('0x40')],qs[_0x3fd9('0x53')](_0x1de0b6[_0x3fd9('0x41')]['fields']));_0x2e637e[_0x3fd9('0x44')]=_0x2e637e[_0x3fd9('0x44')][_0x3fd9('0x45')]?_0x2e637e[_0x3fd9('0x44')]:_0x2d239e[_0x3fd9('0x40')];if(_0x1de0b6[_0x3fd9('0x41')]['includeAll']){_0x2e637e[_0x3fd9('0x4f')]=[{'all':!![]}];}_0x2e637e=_['merge']({},_0x2e637e,_0x1de0b6[_0x3fd9('0x4e')]);return db['ChatMessage'][_0x3fd9('0x54')](_0x2e637e)[_0x3fd9('0x21')](handleEntityNotFound(_0x1df822,null))['then'](respondWithResult(_0x1df822,null))[_0x3fd9('0x2b')](handleError(_0x1df822,null));};exports[_0x3fd9('0x55')]=function(_0x5c66a1,_0x24cd6c){return db[_0x3fd9('0x3c')][_0x3fd9('0x55')](_0x5c66a1[_0x3fd9('0x56')],{})[_0x3fd9('0x21')](respondWithResult(_0x24cd6c,0xc9))[_0x3fd9('0x2b')](handleError(_0x24cd6c,null));};exports[_0x3fd9('0x57')]=function(_0x173c47,_0x567bc4){if(_0x173c47[_0x3fd9('0x56')]['id']){delete _0x173c47[_0x3fd9('0x56')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x173c47['params']['id']}})[_0x3fd9('0x21')](handleEntityNotFound(_0x567bc4,null))[_0x3fd9('0x21')](saveUpdates(_0x173c47[_0x3fd9('0x56')],null))['then'](respondWithResult(_0x567bc4,null))[_0x3fd9('0x2b')](handleError(_0x567bc4,null));};exports['destroy']=function(_0x35c9e7,_0x14beb9){return db[_0x3fd9('0x3c')][_0x3fd9('0x54')]({'where':{'id':_0x35c9e7[_0x3fd9('0x52')]['id']}})[_0x3fd9('0x21')](handleEntityNotFound(_0x14beb9,null))[_0x3fd9('0x21')](removeEntity(_0x14beb9,null))[_0x3fd9('0x2b')](handleError(_0x14beb9,null));};exports['describe']=function(_0x5eb4d0,_0x3f171b){return db[_0x3fd9('0x3c')]['describe']()[_0x3fd9('0x21')](respondWithResult(_0x3f171b,null))[_0x3fd9('0x2b')](handleError(_0x3f171b,null));};var interaction_log=require(_0x3fd9('0x58'))(_0x3fd9('0x59'));exports[_0x3fd9('0x5a')]=function(_0x47877e,_0xa80d57,_0x2f8449){var _0x19d316={'agent':{},'channel':_0x3fd9('0x5b')};if(_0x47877e['body']['id']){delete _0x47877e[_0x3fd9('0x56')]['id'];}_0x47877e[_0x3fd9('0x56')]['read']=!![];_0x47877e['body'][_0x3fd9('0x5c')]=moment()['format'](_0x3fd9('0x5d'));_0x47877e[_0x3fd9('0x56')][_0x3fd9('0x5e')]=_0x47877e[_0x3fd9('0x56')][_0x3fd9('0x5e')]||_0x47877e[_0x3fd9('0x5f')]['id'];_0x19d316[_0x3fd9('0x60')]['id']=_0x47877e[_0x3fd9('0x56')][_0x3fd9('0x5e')];return db[_0x3fd9('0x3c')][_0x3fd9('0x54')]({'where':{'id':_0x47877e[_0x3fd9('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa80d57,null))['then'](saveUpdates(_0x47877e[_0x3fd9('0x56')],null))[_0x3fd9('0x21')](function(_0x1395e1){if(_0x1395e1){_0x19d316['message']=_0x1395e1['get']({'plain':!![]});return db['ChatInteraction'][_0x3fd9('0x54')]({'where':{'id':_0x1395e1[_0x3fd9('0x61')]}});}return null;})['then'](handleEntityNotFound(_0xa80d57,null))[_0x3fd9('0x21')](function(_0x499445){if(_0x499445){return _0x499445[_0x3fd9('0x57')]({'UserId':_0x47877e[_0x3fd9('0x56')]['UserId'],'read1stAt':_[_0x3fd9('0x62')](_0x499445[_0x3fd9('0x63')])?moment()[_0x3fd9('0x64')](_0x3fd9('0x5d')):undefined});}return null;})[_0x3fd9('0x21')](function(_0xdac03f){if(_0xdac03f){_0x19d316[_0x3fd9('0x65')]=_0xdac03f[_0x3fd9('0x66')]({'plain':!![]});interaction_log[_0x3fd9('0x29')](_0x3fd9('0x67'),_0x47877e[_0x3fd9('0x5f')]['id'],_0x47877e[_0x3fd9('0x5f')]['name'],_0x47877e[_0x3fd9('0x5f')][_0x3fd9('0x68')],_0x19d316['interaction']['id'],_0x47877e['body']?JSON['stringify'](_0x47877e['body']):_0x3fd9('0x69'));return respondWithRpcPromise(_0x3fd9('0x6a'),_0x3fd9('0x6b'),_0x19d316);}return null;})[_0x3fd9('0x21')](function(_0x4b51f9){var _0x4350cc=_0x3fd9('0x6c')+_0x4b51f9['message'][_0x3fd9('0x6d')];return db['sequelize'][_0x3fd9('0x41')](_0x4350cc,{'type':db['Sequelize'][_0x3fd9('0x6e')][_0x3fd9('0x6f')],'raw':!![]})[_0x3fd9('0x21')](function(_0xb3cdf6){return _0xb3cdf6;});})[_0x3fd9('0x21')](function(_0x403233){if(_0x403233){_0x19d316['message'][_0x3fd9('0x70')]=_0x403233[0x0];if(!_0x47877e[_0x3fd9('0x56')][_0x3fd9('0x5e')])return;return db[_0x3fd9('0x71')]['find']({'where':{'id':_0x47877e[_0x3fd9('0x56')][_0x3fd9('0x5e')],'role':_0x3fd9('0x60')},'attributes':['id','name',_0x3fd9('0x72'),'email',_0x3fd9('0x73')],'raw':!![]});}return null;})[_0x3fd9('0x21')](function(_0x26bd3b){if(!_0x26bd3b)return null;_0x19d316[_0x3fd9('0x28')][_0x3fd9('0x60')]=_0x26bd3b;return _0x19d316;})[_0x3fd9('0x21')](function(_0x465cdb){if(_0x465cdb){if(_0x47877e[_0x3fd9('0x56')][_0x3fd9('0x74')]){_0x19d316[_0x3fd9('0x28')][_0x3fd9('0x75')]=util['format'](_0x3fd9('0x76'),_0x47877e[_0x3fd9('0x5f')][_0x3fd9('0x39')]);_0x19d316[_0x3fd9('0x28')]['channel']=_0x19d316[_0x3fd9('0x77')];_0x19d316[_0x3fd9('0x28')][_0x3fd9('0x78')]=_0x19d316['channel'];_0x19d316[_0x3fd9('0x28')][_0x3fd9('0x79')]=_0x3fd9('0x5a');return respondWithRpcPromise(_0x3fd9('0x7a'),_0x3fd9('0x7a'),{'event':_0x3fd9('0x7b'),'message':_[_0x3fd9('0x4c')](_0x19d316[_0x3fd9('0x28')],JSON['parse'](_0x19d316[_0x3fd9('0x65')][_0x3fd9('0x7c')]))},client9002)[_0x3fd9('0x21')](function(){return _0x19d316;});}return _0x19d316;}return null;})[_0x3fd9('0x21')](respondWithResult(_0xa80d57,null))['catch'](handleError(_0xa80d57,null));};var interaction_log=require(_0x3fd9('0x58'))(_0x3fd9('0x59'));exports[_0x3fd9('0x34')]=function(_0x8138c0,_0x1e14bb,_0x598cf4){var _0x56e414={'agent':{},'channel':_0x3fd9('0x5b')};if(_0x8138c0['body']['id']){delete _0x8138c0['body']['id'];}_0x8138c0[_0x3fd9('0x56')]['UserId']=_0x8138c0['body'][_0x3fd9('0x5e')]||_0x8138c0['user']['id'];_0x56e414[_0x3fd9('0x60')]['id']=_0x8138c0[_0x3fd9('0x56')][_0x3fd9('0x5e')];return db[_0x3fd9('0x3c')][_0x3fd9('0x54')]({'where':{'id':_0x8138c0['params']['id'],'UserId':null}})[_0x3fd9('0x21')](handleEntityNotFound(_0x1e14bb,null))[_0x3fd9('0x21')](function(_0x3f382e){if(_0x3f382e){_0x56e414[_0x3fd9('0x28')]=_0x3f382e[_0x3fd9('0x66')]({'plain':!![]});return db[_0x3fd9('0x7d')]['find']({'where':{'id':_0x3f382e[_0x3fd9('0x61')]}});}return null;})[_0x3fd9('0x21')](handleEntityNotFound(_0x1e14bb,null))[_0x3fd9('0x21')](function(_0x52610c){if(_0x52610c){_0x56e414[_0x3fd9('0x65')]=_0x52610c[_0x3fd9('0x66')]({'plain':!![]});interaction_log[_0x3fd9('0x29')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8138c0[_0x3fd9('0x5f')]['id'],_0x8138c0[_0x3fd9('0x5f')][_0x3fd9('0x39')],_0x8138c0[_0x3fd9('0x5f')][_0x3fd9('0x68')],_0x56e414[_0x3fd9('0x65')]['id'],_0x8138c0['body']?JSON[_0x3fd9('0x25')](_0x8138c0[_0x3fd9('0x56')]):'null');return respondWithRpcPromise(_0x3fd9('0x7e'),'rejectMessage',_0x56e414);}return null;})[_0x3fd9('0x21')](function(_0x362fbc){var _0x3b765f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x362fbc[_0x3fd9('0x28')][_0x3fd9('0x6d')];return db[_0x3fd9('0x7f')][_0x3fd9('0x41')](_0x3b765f,{'type':db[_0x3fd9('0x80')][_0x3fd9('0x6e')][_0x3fd9('0x6f')],'raw':!![]})[_0x3fd9('0x21')](function(_0x161375){return _0x161375;});})[_0x3fd9('0x21')](function(_0x1ffdfc){if(_0x1ffdfc){_0x56e414[_0x3fd9('0x28')]['contact']=_0x1ffdfc[0x0];if(!_0x8138c0[_0x3fd9('0x56')][_0x3fd9('0x5e')])return;return db[_0x3fd9('0x71')][_0x3fd9('0x54')]({'where':{'id':_0x8138c0['body']['UserId'],'role':_0x3fd9('0x60')},'attributes':['id',_0x3fd9('0x39'),_0x3fd9('0x72'),_0x3fd9('0x81'),_0x3fd9('0x73')],'raw':!![]});}return null;})[_0x3fd9('0x21')](function(_0xd39bbf){if(!_0xd39bbf)return null;_0x56e414['message']['agent']=_0xd39bbf;return _0x56e414;})[_0x3fd9('0x21')](function(_0x168f04){if(_0x168f04){_0x168f04[_0x3fd9('0x28')][_0x3fd9('0x75')]=util[_0x3fd9('0x64')](_0x3fd9('0x76'),_0x8138c0[_0x3fd9('0x5f')][_0x3fd9('0x39')]);_0x168f04[_0x3fd9('0x28')][_0x3fd9('0x77')]=_0x56e414[_0x3fd9('0x77')];_0x168f04[_0x3fd9('0x28')]['motionChannel']=_0x56e414['channel'];_0x168f04[_0x3fd9('0x28')][_0x3fd9('0x79')]=_0x3fd9('0x34');respondWithRpcPromise(_0x3fd9('0x7a'),'EventManager',{'event':_0x3fd9('0x82'),'message':_[_0x3fd9('0x4c')](_0x56e414[_0x3fd9('0x28')],JSON['parse'](_0x56e414[_0x3fd9('0x65')][_0x3fd9('0x7c')]))},client9002);return _0x56e414;}return null;})[_0x3fd9('0x21')](respondWithResult(_0x1e14bb,null))['catch'](handleError(_0x1e14bb,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1665bfa..369ad83 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 _0x1553=['exports','events','../../mysqldb','ChatMessage','save','emit','hasOwnProperty','hook'];(function(_0x577670,_0x32bfb4){var _0x1cd6b3=function(_0x340834){while(--_0x340834){_0x577670['push'](_0x577670['shift']());}};_0x1cd6b3(++_0x32bfb4);}(_0x1553,0x101));var _0x3155=function(_0x4d7df6,_0x3f6139){_0x4d7df6=_0x4d7df6-0x0;var _0x4c0d29=_0x1553[_0x4d7df6];return _0x4c0d29;};'use strict';var EventEmitter=require(_0x3155('0x0'));var ChatMessage=require(_0x3155('0x1'))['db'][_0x3155('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3155('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5eeda6){return function(_0x11f793,_0x5de8e8,_0x4c1be8){ChatMessageEvents[_0x3155('0x4')](_0x5eeda6+':'+_0x11f793['id'],_0x11f793);ChatMessageEvents[_0x3155('0x4')](_0x5eeda6,_0x11f793);_0x4c1be8(null);};}for(var e in events){if(events[_0x3155('0x5')](e)){var event=events[e];ChatMessage[_0x3155('0x6')](e,emitEvent(event));}}module[_0x3155('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x37cd=['ChatMessage','setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x37cd,0xa1));var _0xd37c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x37cd[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xd37c('0x0'))['db'][_0xd37c('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd37c('0x2')](0x0);var events={'afterCreate':_0xd37c('0x3'),'afterUpdate':_0xd37c('0x4'),'afterDestroy':_0xd37c('0x5')};function emitEvent(_0x1188c6){return function(_0x273751,_0x99e193,_0x43f800){ChatMessageEvents[_0xd37c('0x6')](_0x1188c6+':'+_0x273751['id'],_0x273751);ChatMessageEvents[_0xd37c('0x6')](_0x1188c6,_0x273751);_0x43f800(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xd37c('0x7')](e,emitEvent(event));}}module[_0xd37c('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9fef2d6..b0d5a7e 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 _0x6ae2=['request-promise','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','toLowerCase','direction','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x39e9be,_0x589d56){var _0x4a8d97=function(_0x5b0e3a){while(--_0x5b0e3a){_0x39e9be['push'](_0x39e9be['shift']());}};_0x4a8d97(++_0x589d56);}(_0x6ae2,0xcd));var _0x26ae=function(_0x5cbbb6,_0x21e5ef){_0x5cbbb6=_0x5cbbb6-0x0;var _0x464e58=_0x6ae2[_0x5cbbb6];return _0x464e58;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var logger=require(_0x26ae('0x2'))(_0x26ae('0x3'));var moment=require('moment');var BPromise=require(_0x26ae('0x4'));var rp=require(_0x26ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x26ae('0x6'));var attributes=require(_0x26ae('0x7'));module[_0x26ae('0x8')]=function(_0x58bb23,_0x26ade3){return _0x58bb23[_0x26ae('0x9')](_0x26ae('0xa'),attributes,{'tableName':_0x26ae('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x26ae('0xc')],'type':_0x26ae('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b59a2,_0x1f4bd1,_0x44486c){var _0x494a86=_0x58bb23[_0x26ae('0xe')];var _0x1f6f6a=_0x3b59a2['get']({'plain':!![]});if(_0x1f6f6a['direction'][_0x26ae('0xf')]()==='in'||_0x1f6f6a[_0x26ae('0x10')][_0x26ae('0xf')]()==='out'&&!_0x1f6f6a[_0x26ae('0x11')]&&!_[_0x26ae('0x12')](_0x1f6f6a[_0x26ae('0x13')])){_0x494a86[_0x26ae('0x14')][_0x26ae('0x15')]({'where':{'id':_0x1f6f6a[_0x26ae('0x16')]}})[_0x26ae('0x17')](function(_0x144243){if(_0x144243){_0x144243[_0x26ae('0x18')]({'lastMsgAt':_0x1f6f6a[_0x26ae('0x19')],'lastMsgDirection':_0x1f6f6a[_0x26ae('0x10')][_0x26ae('0xf')]()});}})[_0x26ae('0x1a')](function(_0x15e40b){console[_0x26ae('0x1b')](_0x15e40b);});}_0x44486c();}},'charset':_0x26ae('0x1c'),'collate':_0x26ae('0x1d')});}; \ No newline at end of file +var _0x10ef=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','update','createdAt'];(function(_0x560684,_0x4fe7fd){var _0x51ec93=function(_0x2e88b4){while(--_0x2e88b4){_0x560684['push'](_0x560684['shift']());}};_0x51ec93(++_0x4fe7fd);}(_0x10ef,0xc7));var _0xf10e=function(_0x4c1bdc,_0x177e19){_0x4c1bdc=_0x4c1bdc-0x0;var _0x2a27b3=_0x10ef[_0x4c1bdc];return _0x2a27b3;};'use strict';var _=require(_0xf10e('0x0'));var util=require(_0xf10e('0x1'));var logger=require('../../config/logger')(_0xf10e('0x2'));var moment=require(_0xf10e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf10e('0x4'));var fs=require('fs');var path=require(_0xf10e('0x5'));var rimraf=require(_0xf10e('0x6'));var config=require(_0xf10e('0x7'));var attributes=require('./chatMessage.attributes');module[_0xf10e('0x8')]=function(_0x237694,_0x4e030c){return _0x237694['define'](_0xf10e('0x9'),attributes,{'tableName':_0xf10e('0xa'),'paranoid':![],'indexes':[{'name':_0xf10e('0xb'),'fields':[_0xf10e('0xc')],'type':_0xf10e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x314d54,_0x43a54d,_0x344e06){var _0x450514=_0x237694[_0xf10e('0xe')];var _0xece515=_0x314d54['get']({'plain':!![]});if(_0xece515[_0xf10e('0xf')]['toLowerCase']()==='in'||_0xece515['direction'][_0xf10e('0x10')]()===_0xf10e('0x11')&&!_0xece515[_0xf10e('0x12')]&&!_[_0xf10e('0x13')](_0xece515[_0xf10e('0x14')])){_0x450514['ChatInteraction'][_0xf10e('0x15')]({'where':{'id':_0xece515[_0xf10e('0x16')]}})['then'](function(_0x2ddb55){if(_0x2ddb55){_0x2ddb55[_0xf10e('0x17')]({'lastMsgAt':_0xece515[_0xf10e('0x18')],'lastMsgDirection':_0xece515[_0xf10e('0xf')][_0xf10e('0x10')]()});}})[_0xf10e('0x19')](function(_0x15a5b6){console['error'](_0x15a5b6);});}_0x344e06();}},'charset':_0xf10e('0x1a'),'collate':_0xf10e('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f950810..9da6c3a 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 _0x4c18=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0xbde99f,_0x37a79d){var _0x381414=function(_0x983710){while(--_0x983710){_0xbde99f['push'](_0xbde99f['shift']());}};_0x381414(++_0x37a79d);}(_0x4c18,0x14b));var _0x84c1=function(_0x1b2aeb,_0x38fac3){_0x1b2aeb=_0x1b2aeb-0x0;var _0x3a9b99=_0x4c18[_0x1b2aeb];return _0x3a9b99;};'use strict';var _=require(_0x84c1('0x0'));var util=require(_0x84c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84c1('0x2'));var fs=require('fs');var Redis=require(_0x84c1('0x3'));var db=require(_0x84c1('0x4'))['db'];var utils=require(_0x84c1('0x5'));var logger=require('../../config/logger')(_0x84c1('0x6'));var config=require('../../config/environment');var jayson=require(_0x84c1('0x7'));var client=jayson[_0x84c1('0x8')][_0x84c1('0x9')]({'port':0x232a});config[_0x84c1('0xa')]=_[_0x84c1('0xb')](config[_0x84c1('0xa')],{'host':_0x84c1('0xc'),'port':0x18eb});var socket=require(_0x84c1('0xd'))(new Redis(config[_0x84c1('0xa')]));require('./chatMessage.socket')[_0x84c1('0xe')](socket);function respondWithRpcPromise(_0x124d80,_0x131567,_0x3f46a5){return new BPromise(function(_0x601cf8,_0xd47fa9){return client[_0x84c1('0xf')](_0x124d80,_0x3f46a5)[_0x84c1('0x10')](function(_0x95ffd){logger[_0x84c1('0x11')](_0x84c1('0x12'),_0x131567,_0x84c1('0x13'));logger[_0x84c1('0x14')](_0x84c1('0x15'),_0x131567,_0x84c1('0x13'),JSON['stringify'](_0x95ffd));if(_0x95ffd['error']){if(_0x95ffd[_0x84c1('0x16')][_0x84c1('0x17')]===0x1f4){logger[_0x84c1('0x16')](_0x84c1('0x12'),_0x131567,_0x95ffd[_0x84c1('0x16')][_0x84c1('0x18')]);return _0xd47fa9(_0x95ffd[_0x84c1('0x16')][_0x84c1('0x18')]);}logger['error'](_0x84c1('0x12'),_0x131567,_0x95ffd[_0x84c1('0x16')][_0x84c1('0x18')]);return _0x601cf8(_0x95ffd[_0x84c1('0x16')][_0x84c1('0x18')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x131567,_0x84c1('0x13'));_0x601cf8(_0x95ffd[_0x84c1('0x19')]['message']);}})['catch'](function(_0x5bb7d4){logger[_0x84c1('0x16')](_0x84c1('0x12'),_0x131567,_0x5bb7d4);_0xd47fa9(_0x5bb7d4);});});}exports[_0x84c1('0x1a')]=function(_0x11f06a){var _0x459113=this;return new Promise(function(_0x499f2d,_0xc97c83){return db[_0x84c1('0x1b')][_0x84c1('0x1c')](_0x11f06a[_0x84c1('0x1d')],{'raw':_0x11f06a[_0x84c1('0x1e')]?_0x11f06a[_0x84c1('0x1e')][_0x84c1('0x1f')]===undefined?!![]:![]:!![]})[_0x84c1('0x10')](function(_0x2dc171){logger[_0x84c1('0x11')](_0x84c1('0x1a'),_0x11f06a);logger['debug'](_0x84c1('0x1a'),_0x11f06a,JSON[_0x84c1('0x20')](_0x2dc171));_0x499f2d(_0x2dc171);})[_0x84c1('0x21')](function(_0x5068e4){logger['error'](_0x84c1('0x1a'),_0x5068e4[_0x84c1('0x18')],_0x11f06a);_0xc97c83(_0x459113[_0x84c1('0x16')](0x1f4,_0x5068e4['message']));});});}; \ No newline at end of file +var _0xaf32=['../../mysqldb','rpc','jayson/promise','client','defaults','redis','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','CreateChatMessage','ChatMessage','create','options','raw','then','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0xaf32,0x14b));var _0x2af3=function(_0x5ed928,_0x2dbbdc){_0x5ed928=_0x5ed928-0x0;var _0x2effcc=_0xaf32[_0x5ed928];return _0x2effcc;};'use strict';var _=require(_0x2af3('0x0'));var util=require(_0x2af3('0x1'));var moment=require(_0x2af3('0x2'));var BPromise=require(_0x2af3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2af3('0x4'));var db=require(_0x2af3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2af3('0x6'));var config=require('../../config/environment');var jayson=require(_0x2af3('0x7'));var client=jayson[_0x2af3('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2af3('0x9')](config[_0x2af3('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2af3('0xb'))[_0x2af3('0xc')](socket);function respondWithRpcPromise(_0xb4cf42,_0x207f11,_0xd29472){return new BPromise(function(_0x558e70,_0x10c727){return client[_0x2af3('0xd')](_0xb4cf42,_0xd29472)['then'](function(_0x4d0a5e){logger[_0x2af3('0xe')](_0x2af3('0xf'),_0x207f11,_0x2af3('0x10'));logger[_0x2af3('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x207f11,'request\x20sent',JSON['stringify'](_0x4d0a5e));if(_0x4d0a5e[_0x2af3('0x12')]){if(_0x4d0a5e[_0x2af3('0x12')][_0x2af3('0x13')]===0x1f4){logger[_0x2af3('0x12')](_0x2af3('0xf'),_0x207f11,_0x4d0a5e[_0x2af3('0x12')][_0x2af3('0x14')]);return _0x10c727(_0x4d0a5e[_0x2af3('0x12')]['message']);}logger['error'](_0x2af3('0xf'),_0x207f11,_0x4d0a5e[_0x2af3('0x12')][_0x2af3('0x14')]);return _0x558e70(_0x4d0a5e[_0x2af3('0x12')][_0x2af3('0x14')]);}else{logger[_0x2af3('0xe')](_0x2af3('0xf'),_0x207f11,'request\x20sent');_0x558e70(_0x4d0a5e['result'][_0x2af3('0x14')]);}})['catch'](function(_0x45c56e){logger['error'](_0x2af3('0xf'),_0x207f11,_0x45c56e);_0x10c727(_0x45c56e);});});}exports[_0x2af3('0x15')]=function(_0x4393f3){var _0x612d2f=this;return new Promise(function(_0x565db1,_0xe551e6){return db[_0x2af3('0x16')][_0x2af3('0x17')](_0x4393f3['body'],{'raw':_0x4393f3[_0x2af3('0x18')]?_0x4393f3[_0x2af3('0x18')][_0x2af3('0x19')]===undefined?!![]:![]:!![]})[_0x2af3('0x1a')](function(_0x3039f9){logger[_0x2af3('0xe')](_0x2af3('0x15'),_0x4393f3);logger[_0x2af3('0x11')](_0x2af3('0x15'),_0x4393f3,JSON['stringify'](_0x3039f9));_0x565db1(_0x3039f9);})[_0x2af3('0x1b')](function(_0x341791){logger[_0x2af3('0x12')](_0x2af3('0x15'),_0x341791[_0x2af3('0x14')],_0x4393f3);_0xe551e6(_0x612d2f[_0x2af3('0x12')](0x1f4,_0x341791[_0x2af3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 3c90909..dfdfd93 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 _0x8c32=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x7b0400,_0x2808c9){var _0x1c7cb3=function(_0x17d3a4){while(--_0x17d3a4){_0x7b0400['push'](_0x7b0400['shift']());}};_0x1c7cb3(++_0x2808c9);}(_0x8c32,0x130));var _0x28c3=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8c32[_0x29d94e];return _0x106237;};'use strict';var ChatMessageEvents=require(_0x28c3('0x0'));var events=[_0x28c3('0x1'),_0x28c3('0x2'),_0x28c3('0x3')];function createListener(_0x27dd09,_0xc522d5){return function(_0x36d4ad){_0xc522d5[_0x28c3('0x4')](_0x27dd09,_0x36d4ad);};}function removeListener(_0x2f94e0,_0x40df22){return function(){ChatMessageEvents[_0x28c3('0x5')](_0x2f94e0,_0x40df22);};}exports[_0x28c3('0x6')]=function(_0x537b4f){for(var _0x2861c9=0x0,_0x4ed515=events[_0x28c3('0x7')];_0x2861c9<_0x4ed515;_0x2861c9++){var _0x482952=events[_0x2861c9];var _0xbaee6f=createListener(_0x28c3('0x8')+_0x482952,_0x537b4f);ChatMessageEvents['on'](_0x482952,_0xbaee6f);}}; \ No newline at end of file +var _0x1696=['length','chatMessage:','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x1696,0x79));var _0x6169=function(_0x2b5c1e,_0x5ee7eb){_0x2b5c1e=_0x2b5c1e-0x0;var _0x30a4d1=_0x1696[_0x2b5c1e];return _0x30a4d1;};'use strict';var ChatMessageEvents=require(_0x6169('0x0'));var events=['save',_0x6169('0x1'),_0x6169('0x2')];function createListener(_0x1c5bac,_0xab8597){return function(_0x20d57e){_0xab8597[_0x6169('0x3')](_0x1c5bac,_0x20d57e);};}function removeListener(_0x357aaf,_0x10d0ab){return function(){ChatMessageEvents[_0x6169('0x4')](_0x357aaf,_0x10d0ab);};}exports['register']=function(_0x3569ff){for(var _0x128cf1=0x0,_0x277459=events[_0x6169('0x5')];_0x128cf1<_0x277459;_0x128cf1++){var _0x289333=events[_0x128cf1];var _0x2a1658=createListener(_0x6169('0x6')+_0x289333,_0x3569ff);ChatMessageEvents['on'](_0x289333,_0x2a1658);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3f33f8d..182d813 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 _0x9cb2=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','accept','/:id/reject','delete','destroy','util','path','connect-timeout','express'];(function(_0x281305,_0x2998d6){var _0x56ffbe=function(_0x270b4c){while(--_0x270b4c){_0x281305['push'](_0x281305['shift']());}};_0x56ffbe(++_0x2998d6);}(_0x9cb2,0x6f));var _0x29cb=function(_0x1d9400,_0x3e0a4f){_0x1d9400=_0x1d9400-0x0;var _0x2fcffc=_0x9cb2[_0x1d9400];return _0x2fcffc;};'use strict';var multer=require('multer');var util=require(_0x29cb('0x0'));var path=require(_0x29cb('0x1'));var timeout=require(_0x29cb('0x2'));var express=require(_0x29cb('0x3'));var router=express[_0x29cb('0x4')]();var fs_extra=require(_0x29cb('0x5'));var auth=require(_0x29cb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x29cb('0x7')]('/',auth[_0x29cb('0x8')](),controller['index']);router[_0x29cb('0x7')](_0x29cb('0x9'),auth[_0x29cb('0x8')](),controller['describe']);router[_0x29cb('0x7')](_0x29cb('0xa'),auth[_0x29cb('0x8')](),controller[_0x29cb('0xb')]);router[_0x29cb('0xc')]('/',auth[_0x29cb('0x8')](),interaction[_0x29cb('0xd')](_0x29cb('0xe'),_0x29cb('0xf')),controller[_0x29cb('0x10')]);router[_0x29cb('0x11')]('/:id',controller[_0x29cb('0x12')]);router[_0x29cb('0x11')]('/:id/accept',auth[_0x29cb('0x8')](),controller[_0x29cb('0x13')]);router[_0x29cb('0x11')](_0x29cb('0x14'),auth[_0x29cb('0x8')](),controller['reject']);router[_0x29cb('0x15')](_0x29cb('0xa'),auth['isAuthenticated'](),controller[_0x29cb('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa011=['/:id','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0xa011,0xbb));var _0x1a01=function(_0x469d85,_0x3ffa0c){_0x469d85=_0x469d85-0x0;var _0x1e75c9=_0xa011[_0x469d85];return _0x1e75c9;};'use strict';var multer=require(_0x1a01('0x0'));var util=require(_0x1a01('0x1'));var path=require('path');var timeout=require(_0x1a01('0x2'));var express=require('express');var router=express[_0x1a01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1a01('0x4'));var interaction=require(_0x1a01('0x5'));var config=require(_0x1a01('0x6'));var controller=require(_0x1a01('0x7'));router[_0x1a01('0x8')]('/',auth[_0x1a01('0x9')](),controller[_0x1a01('0xa')]);router[_0x1a01('0x8')](_0x1a01('0xb'),auth[_0x1a01('0x9')](),controller[_0x1a01('0xc')]);router[_0x1a01('0x8')](_0x1a01('0xd'),auth[_0x1a01('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x1a01('0xe')](_0x1a01('0xf'),_0x1a01('0x10')),controller['create']);router[_0x1a01('0x11')](_0x1a01('0xd'),controller[_0x1a01('0x12')]);router[_0x1a01('0x11')](_0x1a01('0x13'),auth[_0x1a01('0x9')](),controller[_0x1a01('0x14')]);router[_0x1a01('0x11')](_0x1a01('0x15'),auth['isAuthenticated'](),controller[_0x1a01('0x16')]);router[_0x1a01('0x17')]('/:id',auth[_0x1a01('0x9')](),controller[_0x1a01('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 45f3adf..a07c752 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0xac134a,_0x5c6872){var _0x719c75=function(_0x296476){while(--_0x296476){_0xac134a['push'](_0xac134a['shift']());}};_0x719c75(++_0x5c6872);}(_0x5f2f,0x73));var _0xf5f2=function(_0xd8f53c,_0x19c398){_0xd8f53c=_0xd8f53c-0x0;var _0x7a85ac=_0x5f2f[_0xd8f53c];return _0x7a85ac;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x30a07b,_0x210a9){var _0x14bf47=function(_0x38ba28){while(--_0x38ba28){_0x30a07b['push'](_0x30a07b['shift']());}};_0x14bf47(++_0x210a9);}(_0xadb5,0xad));var _0x5adb=function(_0x5636e9,_0x4342f5){_0x5636e9=_0x5636e9-0x0;var _0x1bb2dd=_0xadb5[_0x5636e9];return _0x1bb2dd;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 7a82987..a7c8aa3 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(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x7a54,0x106));var _0x47a5=function(_0x193862,_0x18b1b9){_0x193862=_0x193862-0x0;var _0x4a3887=_0x7a54[_0x193862];return _0x4a3887;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x7a54,0x106));var _0x47a5=function(_0x41cfbd,_0xef5664){_0x41cfbd=_0x41cfbd-0x0;var _0x745d03=_0x7a54[_0x41cfbd];return _0x745d03;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 1d63f59..92220ce 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe51f=['hook','exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe51f,0xaa));var _0xfe51=function(_0x26640d,_0x2e8f03){_0x26640d=_0x26640d-0x0;var _0x1d0387=_0xe51f[_0x26640d];return _0x1d0387;};'use strict';var EventEmitter=require(_0xfe51('0x0'));var ChatOfflineMessage=require(_0xfe51('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xfe51('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe51('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d5bb5){return function(_0x3df243,_0xd4ffb3,_0x63475d){ChatOfflineMessageEvents[_0xfe51('0x4')](_0x2d5bb5+':'+_0x3df243['id'],_0x3df243);ChatOfflineMessageEvents[_0xfe51('0x4')](_0x2d5bb5,_0x3df243);_0x63475d(null);};}for(var e in events){if(events[_0xfe51('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xfe51('0x6')](e,emitEvent(event));}}module[_0xfe51('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xaf99=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xaf99,0x13a));var _0x9af9=function(_0x301615,_0x1fde35){_0x301615=_0x301615-0x0;var _0x47514b=_0xaf99[_0x301615];return _0x47514b;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x9af9('0x0'))['db'][_0x9af9('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9af9('0x2')](0x0);var events={'afterCreate':_0x9af9('0x3'),'afterUpdate':_0x9af9('0x4'),'afterDestroy':_0x9af9('0x5')};function emitEvent(_0x322bf2){return function(_0x4fa322,_0x231cf3,_0x33abc1){ChatOfflineMessageEvents['emit'](_0x322bf2+':'+_0x4fa322['id'],_0x4fa322);ChatOfflineMessageEvents[_0x9af9('0x6')](_0x322bf2,_0x4fa322);_0x33abc1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x9af9('0x7')](e,emitEvent(event));}}module[_0x9af9('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8cdac55..fa40f46 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 _0xc09c=['./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x4316d9,_0x353db4){var _0x50cbfa=function(_0x47c738){while(--_0x47c738){_0x4316d9['push'](_0x4316d9['shift']());}};_0x50cbfa(++_0x353db4);}(_0xc09c,0x12c));var _0xcc09=function(_0x3349c5,_0x5b8949){_0x3349c5=_0x3349c5-0x0;var _0x2ccecf=_0xc09c[_0x3349c5];return _0x2ccecf;};'use strict';var attributes=require(_0xcc09('0x0'));module['exports']=function(_0x496d37){return _0x496d37[_0xcc09('0x1')](_0xcc09('0x2'),attributes,{'tableName':_0xcc09('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc09('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x79a3=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x559293,_0xd7dce1){var _0x2506c3=function(_0x153eac){while(--_0x153eac){_0x559293['push'](_0x559293['shift']());}};_0x2506c3(++_0xd7dce1);}(_0x79a3,0x179));var _0x379a=function(_0x4dd268,_0x4484c3){_0x4dd268=_0x4dd268-0x0;var _0x5db527=_0x79a3[_0x4dd268];return _0x5db527;};'use strict';var attributes=require(_0x379a('0x0'));module[_0x379a('0x1')]=function(_0x4dc1e8){return _0x4dc1e8['define'](_0x379a('0x2'),attributes,{'tableName':_0x379a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x379a('0x4'),'collate':_0x379a('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e371d52..18397dd 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 _0x8987=['result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent'];(function(_0x53c318,_0xdadc55){var _0x290f8c=function(_0x57cb74){while(--_0x57cb74){_0x53c318['push'](_0x53c318['shift']());}};_0x290f8c(++_0xdadc55);}(_0x8987,0xc9));var _0x7898=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x8987[_0x173f10];return _0x53142d;};'use strict';var _=require('lodash');var util=require(_0x7898('0x0'));var moment=require(_0x7898('0x1'));var BPromise=require(_0x7898('0x2'));var rs=require(_0x7898('0x3'));var fs=require('fs');var Redis=require(_0x7898('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7898('0x5'));var logger=require(_0x7898('0x6'))(_0x7898('0x7'));var config=require(_0x7898('0x8'));var jayson=require(_0x7898('0x9'));var client=jayson[_0x7898('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd71b66,_0x2d9ea6,_0x35d16c){return new BPromise(function(_0x56347f,_0x2a88c2){return client[_0x7898('0xb')](_0xd71b66,_0x35d16c)['then'](function(_0x8db27){logger[_0x7898('0xc')](_0x7898('0xd'),_0x2d9ea6,'request\x20sent');logger[_0x7898('0xe')](_0x7898('0xf'),_0x2d9ea6,'request\x20sent',JSON['stringify'](_0x8db27));if(_0x8db27[_0x7898('0x10')]){if(_0x8db27['error']['code']===0x1f4){logger[_0x7898('0x10')](_0x7898('0xd'),_0x2d9ea6,_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);return _0x2a88c2(_0x8db27[_0x7898('0x10')]['message']);}logger[_0x7898('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d9ea6,_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);return _0x56347f(_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);}else{logger[_0x7898('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d9ea6,_0x7898('0x12'));_0x56347f(_0x8db27[_0x7898('0x13')][_0x7898('0x11')]);}})['catch'](function(_0x26cb5a){logger['error'](_0x7898('0xd'),_0x2d9ea6,_0x26cb5a);_0x2a88c2(_0x26cb5a);});});} \ No newline at end of file +var _0xae3c=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xae3c,0x104));var _0xcae3=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0xae3c[_0x1562a2];return _0x39a636;};'use strict';var _=require(_0xcae3('0x0'));var util=require('util');var moment=require(_0xcae3('0x1'));var BPromise=require('bluebird');var rs=require(_0xcae3('0x2'));var fs=require('fs');var Redis=require(_0xcae3('0x3'));var db=require(_0xcae3('0x4'))['db'];var utils=require(_0xcae3('0x5'));var logger=require('../../config/logger')(_0xcae3('0x6'));var config=require(_0xcae3('0x7'));var jayson=require(_0xcae3('0x8'));var client=jayson['client'][_0xcae3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ba90,_0x348197,_0x25fed8){return new BPromise(function(_0x2dad94,_0x451f66){return client[_0xcae3('0xa')](_0x50ba90,_0x25fed8)[_0xcae3('0xb')](function(_0x16892f){logger[_0xcae3('0xc')](_0xcae3('0xd'),_0x348197,'request\x20sent');logger[_0xcae3('0xe')](_0xcae3('0xf'),_0x348197,'request\x20sent',JSON[_0xcae3('0x10')](_0x16892f));if(_0x16892f[_0xcae3('0x11')]){if(_0x16892f['error'][_0xcae3('0x12')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x348197,_0x16892f['error']['message']);return _0x451f66(_0x16892f[_0xcae3('0x11')][_0xcae3('0x13')]);}logger[_0xcae3('0x11')](_0xcae3('0xd'),_0x348197,_0x16892f[_0xcae3('0x11')][_0xcae3('0x13')]);return _0x2dad94(_0x16892f[_0xcae3('0x11')][_0xcae3('0x13')]);}else{logger['info'](_0xcae3('0xd'),_0x348197,_0xcae3('0x14'));_0x2dad94(_0x16892f['result'][_0xcae3('0x13')]);}})[_0xcae3('0x15')](function(_0x2ee41d){logger[_0xcae3('0x11')](_0xcae3('0xd'),_0x348197,_0x2ee41d);_0x451f66(_0x2ee41d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index a4286d4..d8b09ea 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 _0xadd4=['create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','isAuthenticated','/:id','show','post'];(function(_0x5a4dfc,_0x5a3b0c){var _0x127d2b=function(_0x4ba433){while(--_0x4ba433){_0x5a4dfc['push'](_0x5a4dfc['shift']());}};_0x127d2b(++_0x5a3b0c);}(_0xadd4,0xd7));var _0x4add=function(_0x22071a,_0x4bcf62){_0x22071a=_0x22071a-0x0;var _0x5c6c85=_0xadd4[_0x22071a];return _0x5c6c85;};'use strict';var multer=require(_0x4add('0x0'));var util=require(_0x4add('0x1'));var path=require(_0x4add('0x2'));var timeout=require(_0x4add('0x3'));var express=require('express');var router=express[_0x4add('0x4')]();var fs_extra=require(_0x4add('0x5'));var auth=require(_0x4add('0x6'));var interaction=require(_0x4add('0x7'));var config=require(_0x4add('0x8'));var controller=require(_0x4add('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4add('0xa')](_0x4add('0xb'),auth[_0x4add('0xc')](),controller['describe']);router['get'](_0x4add('0xd'),auth['isAuthenticated'](),controller[_0x4add('0xe')]);router[_0x4add('0xf')]('/',auth[_0x4add('0xc')](),controller[_0x4add('0x10')]);router[_0x4add('0x11')](_0x4add('0xd'),auth['isAuthenticated'](),controller[_0x4add('0x12')]);router[_0x4add('0x13')](_0x4add('0xd'),auth[_0x4add('0xc')](),controller['destroy']);module[_0x4add('0x14')]=router; \ No newline at end of file +var _0xc38c=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x356894,_0x48e229){var _0xe80b45=function(_0xbbe43c){while(--_0xbbe43c){_0x356894['push'](_0x356894['shift']());}};_0xe80b45(++_0x48e229);}(_0xc38c,0xb1));var _0xcc38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc38c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcc38('0x0'));var util=require(_0xcc38('0x1'));var path=require(_0xcc38('0x2'));var timeout=require(_0xcc38('0x3'));var express=require('express');var router=express[_0xcc38('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcc38('0x5'));var config=require(_0xcc38('0x6'));var controller=require(_0xcc38('0x7'));router[_0xcc38('0x8')]('/',auth['isAuthenticated'](),controller[_0xcc38('0x9')]);router[_0xcc38('0x8')](_0xcc38('0xa'),auth[_0xcc38('0xb')](),controller['describe']);router[_0xcc38('0x8')](_0xcc38('0xc'),auth[_0xcc38('0xb')](),controller[_0xcc38('0xd')]);router[_0xcc38('0xe')]('/',auth[_0xcc38('0xb')](),controller[_0xcc38('0xf')]);router[_0xcc38('0x10')]('/:id',auth[_0xcc38('0xb')](),controller[_0xcc38('0x11')]);router['delete'](_0xcc38('0xc'),auth[_0xcc38('0xb')](),controller[_0xcc38('0x12')]);module[_0xcc38('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c51b447..4a4ced8 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 _0x0bbe=['mouseOver','timeout','INTEGER','exports','ENUM'];(function(_0x2d759b,_0x2aad52){var _0x37a4d4=function(_0x1222a0){while(--_0x1222a0){_0x2d759b['push'](_0x2d759b['shift']());}};_0x37a4d4(++_0x2aad52);}(_0x0bbe,0x94));var _0xe0bb=function(_0x253bbd,_0x147b83){_0x253bbd=_0x253bbd-0x0;var _0x36f31e=_0x0bbe[_0x253bbd];return _0x36f31e;};'use strict';var Sequelize=require('sequelize');module[_0xe0bb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe0bb('0x1')](_0xe0bb('0x2'),_0xe0bb('0x3')),'defaultValue':_0xe0bb('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe0bb('0x4')]}}; \ No newline at end of file +var _0x2220=['mouseOver','timeout','INTEGER','exports','STRING','ENUM'];(function(_0x596d6e,_0x4a048d){var _0x10d2c3=function(_0x2255ef){while(--_0x2255ef){_0x596d6e['push'](_0x596d6e['shift']());}};_0x10d2c3(++_0x4a048d);}(_0x2220,0x1a7));var _0x0222=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2220[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module[_0x0222('0x0')]={'name':{'type':Sequelize[_0x0222('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0222('0x2')](_0x0222('0x3'),_0x0222('0x4')),'defaultValue':_0x0222('0x3')},'selector':{'type':Sequelize[_0x0222('0x1')]},'timeout':{'type':Sequelize[_0x0222('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 24b50f7..c96ea59 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 _0x34aa=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','show','params','keys','ChatProactiveAction','query','intersection','model','attributes','fields','length','includeAll','include','merge','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1bdd2e,_0x292494){var _0x4d7989=function(_0x139f15){while(--_0x139f15){_0x1bdd2e['push'](_0x1bdd2e['shift']());}};_0x4d7989(++_0x292494);}(_0x34aa,0x171));var _0xa34a=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x34aa[_0x44afa4];return _0xcad289;};'use strict';var emlformat=require(_0xa34a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa34a('0x1'));var jsonpatch=require(_0xa34a('0x2'));var rp=require(_0xa34a('0x3'));var moment=require(_0xa34a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa34a('0x5'));var util=require(_0xa34a('0x6'));var path=require(_0xa34a('0x7'));var sox=require(_0xa34a('0x8'));var csv=require(_0xa34a('0x9'));var ejs=require(_0xa34a('0xa'));var fs=require('fs');var fs_extra=require(_0xa34a('0xb'));var _=require(_0xa34a('0xc'));var squel=require(_0xa34a('0xd'));var crypto=require(_0xa34a('0xe'));var jsforce=require(_0xa34a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa34a('0x9'));var querystring=require(_0xa34a('0x10'));var Papa=require(_0xa34a('0x11'));var Redis=require(_0xa34a('0x12'));var authService=require(_0xa34a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa34a('0x14'));var hardwareService=require(_0xa34a('0x15'));var logger=require(_0xa34a('0x16'))(_0xa34a('0x17'));var utils=require(_0xa34a('0x18'));var config=require(_0xa34a('0x19'));var licenseUtil=require(_0xa34a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3145e9,_0x33e150){_0x33e150=_0x33e150||0xcc;return function(_0x1c2972){if(_0x1c2972){return _0x3145e9['sendStatus'](_0x33e150);}return _0x3145e9[_0xa34a('0x1b')](_0x33e150)[_0xa34a('0x1c')]();};}function respondWithResult(_0x525eff,_0x2f5ded){_0x2f5ded=_0x2f5ded||0xc8;return function(_0x3d5926){if(_0x3d5926){return _0x525eff['status'](_0x2f5ded)[_0xa34a('0x1d')](_0x3d5926);}};}function respondWithFilteredResult(_0x7ac9a2,_0x19580a){return function(_0xfd0d79){if(_0xfd0d79){var _0x41b9bb=typeof _0x19580a['offset']===_0xa34a('0x1e')&&typeof _0x19580a['limit']===_0xa34a('0x1e');var _0x14837d=_0xfd0d79[_0xa34a('0x1f')];var _0x181dcc=_0x41b9bb?0x0:_0x19580a['offset'];var _0x27ad19=_0x41b9bb?_0xfd0d79[_0xa34a('0x1f')]:_0x19580a[_0xa34a('0x20')]+_0x19580a[_0xa34a('0x21')];var _0xaa360e;if(_0x27ad19>=_0x14837d){_0x27ad19=_0x14837d;_0xaa360e=0xc8;}else{_0xaa360e=0xce;}_0x7ac9a2['status'](_0xaa360e);return _0x7ac9a2[_0xa34a('0x22')](_0xa34a('0x23'),_0x181dcc+'-'+_0x27ad19+'/'+_0x14837d)[_0xa34a('0x1d')](_0xfd0d79);}return null;};}function patchUpdates(_0x5a641c){return function(_0x14a18b){try{jsonpatch[_0xa34a('0x24')](_0x14a18b,_0x5a641c,!![]);}catch(_0x36749d){return BPromise[_0xa34a('0x25')](_0x36749d);}return _0x14a18b[_0xa34a('0x26')]();};}function saveUpdates(_0x14e24c,_0x4f9342){return function(_0x28249a){if(_0x28249a){return _0x28249a[_0xa34a('0x27')](_0x14e24c)['then'](function(_0x13135a){return _0x13135a;});}return null;};}function removeEntity(_0x377c4a,_0x746078){return function(_0x254b75){if(_0x254b75){return _0x254b75[_0xa34a('0x28')]()[_0xa34a('0x29')](function(){_0x377c4a[_0xa34a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351b9e,_0xb314d2){return function(_0x473c15){if(!_0x473c15){_0x351b9e[_0xa34a('0x2a')](0x194);}return _0x473c15;};}function handleError(_0x502b4d,_0x1ab30a){_0x1ab30a=_0x1ab30a||0x1f4;return function(_0x7ecf44){logger[_0xa34a('0x2b')](_0x7ecf44[_0xa34a('0x2c')]);if(_0x7ecf44['name']){delete _0x7ecf44[_0xa34a('0x2d')];}_0x502b4d[_0xa34a('0x1b')](_0x1ab30a)[_0xa34a('0x2e')](_0x7ecf44);};}exports[_0xa34a('0x2f')]=function(_0x48e428,_0x2b03a7){var _0x82350e={'raw':!![],'where':{'id':_0x48e428[_0xa34a('0x30')]['id']}},_0x196681={};_0x196681['model']=_[_0xa34a('0x31')](db[_0xa34a('0x32')]['rawAttributes']);_0x196681[_0xa34a('0x33')]=_[_0xa34a('0x31')](_0x48e428['query']);_0x196681['filters']=_[_0xa34a('0x34')](_0x196681[_0xa34a('0x35')],_0x196681[_0xa34a('0x33')]);_0x82350e[_0xa34a('0x36')]=_[_0xa34a('0x34')](_0x196681[_0xa34a('0x35')],qs['fields'](_0x48e428[_0xa34a('0x33')][_0xa34a('0x37')]));_0x82350e['attributes']=_0x82350e[_0xa34a('0x36')][_0xa34a('0x38')]?_0x82350e[_0xa34a('0x36')]:_0x196681[_0xa34a('0x35')];if(_0x48e428['query'][_0xa34a('0x39')]){_0x82350e[_0xa34a('0x3a')]=[{'all':!![]}];}_0x82350e=_[_0xa34a('0x3b')]({},_0x82350e,_0x48e428['options']);return db[_0xa34a('0x32')][_0xa34a('0x3c')](_0x82350e)[_0xa34a('0x29')](handleEntityNotFound(_0x2b03a7,null))[_0xa34a('0x29')](respondWithResult(_0x2b03a7,null))[_0xa34a('0x3d')](handleError(_0x2b03a7,null));};exports[_0xa34a('0x3e')]=function(_0x50fa82,_0x4c7a6e){return db['ChatProactiveAction'][_0xa34a('0x3e')](_0x50fa82[_0xa34a('0x3f')],{})[_0xa34a('0x29')](respondWithResult(_0x4c7a6e,0xc9))[_0xa34a('0x3d')](handleError(_0x4c7a6e,null));};exports[_0xa34a('0x27')]=function(_0xc74618,_0x58b8ba){if(_0xc74618[_0xa34a('0x3f')]['id']){delete _0xc74618[_0xa34a('0x3f')]['id'];}return db[_0xa34a('0x32')][_0xa34a('0x3c')]({'where':{'id':_0xc74618[_0xa34a('0x30')]['id']}})[_0xa34a('0x29')](handleEntityNotFound(_0x58b8ba,null))['then'](saveUpdates(_0xc74618[_0xa34a('0x3f')],null))[_0xa34a('0x29')](respondWithResult(_0x58b8ba,null))['catch'](handleError(_0x58b8ba,null));};exports[_0xa34a('0x28')]=function(_0x53f4a4,_0x41a4d5){return db[_0xa34a('0x32')][_0xa34a('0x3c')]({'where':{'id':_0x53f4a4[_0xa34a('0x30')]['id']}})[_0xa34a('0x29')](handleEntityNotFound(_0x41a4d5,null))[_0xa34a('0x29')](removeEntity(_0x41a4d5,null))[_0xa34a('0x3d')](handleError(_0x41a4d5,null));}; \ No newline at end of file +var _0x90b5=['undefined','count','set','apply','reject','then','error','stack','name','send','show','model','ChatProactiveAction','rawAttributes','query','keys','filters','attributes','intersection','fields','includeAll','include','catch','create','body','params','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3ae164,_0x2e6692){var _0x9f36f5=function(_0x19016c){while(--_0x19016c){_0x3ae164['push'](_0x3ae164['shift']());}};_0x9f36f5(++_0x2e6692);}(_0x90b5,0x139));var _0x590b=function(_0x3366b0,_0x42688c){_0x3366b0=_0x3366b0-0x0;var _0x378ff7=_0x90b5[_0x3366b0];return _0x378ff7;};'use strict';var emlformat=require(_0x590b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x590b('0x1'));var jsonpatch=require(_0x590b('0x2'));var rp=require(_0x590b('0x3'));var moment=require(_0x590b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x590b('0x5'));var path=require(_0x590b('0x6'));var sox=require('sox');var csv=require(_0x590b('0x7'));var ejs=require(_0x590b('0x8'));var fs=require('fs');var fs_extra=require(_0x590b('0x9'));var _=require('lodash');var squel=require(_0x590b('0xa'));var crypto=require(_0x590b('0xb'));var jsforce=require(_0x590b('0xc'));var deskjs=require(_0x590b('0xd'));var toCsv=require(_0x590b('0x7'));var querystring=require(_0x590b('0xe'));var Papa=require(_0x590b('0xf'));var Redis=require(_0x590b('0x10'));var authService=require(_0x590b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x590b('0x12'));var hardwareService=require(_0x590b('0x13'));var logger=require('../../config/logger')(_0x590b('0x14'));var utils=require('../../config/utils');var config=require(_0x590b('0x15'));var licenseUtil=require(_0x590b('0x16'));var db=require(_0x590b('0x17'))['db'];function respondWithStatusCode(_0x477069,_0x527487){_0x527487=_0x527487||0xcc;return function(_0xb0ca22){if(_0xb0ca22){return _0x477069[_0x590b('0x18')](_0x527487);}return _0x477069[_0x590b('0x19')](_0x527487)[_0x590b('0x1a')]();};}function respondWithResult(_0x2e85b1,_0x6ad7e7){_0x6ad7e7=_0x6ad7e7||0xc8;return function(_0x45ac04){if(_0x45ac04){return _0x2e85b1[_0x590b('0x19')](_0x6ad7e7)[_0x590b('0x1b')](_0x45ac04);}};}function respondWithFilteredResult(_0x1fbc84,_0x3fc5ca){return function(_0x260f47){if(_0x260f47){var _0x3e4723=typeof _0x3fc5ca[_0x590b('0x1c')]===_0x590b('0x1d')&&typeof _0x3fc5ca['limit']===_0x590b('0x1d');var _0x530e24=_0x260f47[_0x590b('0x1e')];var _0x115309=_0x3e4723?0x0:_0x3fc5ca[_0x590b('0x1c')];var _0x53337c=_0x3e4723?_0x260f47['count']:_0x3fc5ca[_0x590b('0x1c')]+_0x3fc5ca['limit'];var _0x21e771;if(_0x53337c>=_0x530e24){_0x53337c=_0x530e24;_0x21e771=0xc8;}else{_0x21e771=0xce;}_0x1fbc84[_0x590b('0x19')](_0x21e771);return _0x1fbc84[_0x590b('0x1f')]('Content-Range',_0x115309+'-'+_0x53337c+'/'+_0x530e24)[_0x590b('0x1b')](_0x260f47);}return null;};}function patchUpdates(_0x8ab843){return function(_0x2b8ea0){try{jsonpatch[_0x590b('0x20')](_0x2b8ea0,_0x8ab843,!![]);}catch(_0x4990ba){return BPromise[_0x590b('0x21')](_0x4990ba);}return _0x2b8ea0['save']();};}function saveUpdates(_0x10a339,_0x30dc9f){return function(_0x5bdaba){if(_0x5bdaba){return _0x5bdaba['update'](_0x10a339)[_0x590b('0x22')](function(_0x2bcfca){return _0x2bcfca;});}return null;};}function removeEntity(_0x52bdad,_0x21638c){return function(_0x1045d5){if(_0x1045d5){return _0x1045d5['destroy']()['then'](function(){_0x52bdad[_0x590b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fead,_0x520095){return function(_0x4d3ff9){if(!_0x4d3ff9){_0x39fead[_0x590b('0x18')](0x194);}return _0x4d3ff9;};}function handleError(_0x20571b,_0x5cf6b6){_0x5cf6b6=_0x5cf6b6||0x1f4;return function(_0x1febcd){logger[_0x590b('0x23')](_0x1febcd[_0x590b('0x24')]);if(_0x1febcd[_0x590b('0x25')]){delete _0x1febcd[_0x590b('0x25')];}_0x20571b['status'](_0x5cf6b6)[_0x590b('0x26')](_0x1febcd);};}exports[_0x590b('0x27')]=function(_0x333af8,_0x38a64a){var _0x1ee769={'raw':!![],'where':{'id':_0x333af8['params']['id']}},_0x3b881f={};_0x3b881f[_0x590b('0x28')]=_['keys'](db[_0x590b('0x29')][_0x590b('0x2a')]);_0x3b881f[_0x590b('0x2b')]=_[_0x590b('0x2c')](_0x333af8['query']);_0x3b881f[_0x590b('0x2d')]=_['intersection'](_0x3b881f[_0x590b('0x28')],_0x3b881f[_0x590b('0x2b')]);_0x1ee769[_0x590b('0x2e')]=_[_0x590b('0x2f')](_0x3b881f[_0x590b('0x28')],qs['fields'](_0x333af8[_0x590b('0x2b')][_0x590b('0x30')]));_0x1ee769[_0x590b('0x2e')]=_0x1ee769[_0x590b('0x2e')]['length']?_0x1ee769['attributes']:_0x3b881f[_0x590b('0x28')];if(_0x333af8[_0x590b('0x2b')][_0x590b('0x31')]){_0x1ee769[_0x590b('0x32')]=[{'all':!![]}];}_0x1ee769=_['merge']({},_0x1ee769,_0x333af8['options']);return db[_0x590b('0x29')]['find'](_0x1ee769)[_0x590b('0x22')](handleEntityNotFound(_0x38a64a,null))[_0x590b('0x22')](respondWithResult(_0x38a64a,null))[_0x590b('0x33')](handleError(_0x38a64a,null));};exports[_0x590b('0x34')]=function(_0x35dcaf,_0x294688){return db[_0x590b('0x29')][_0x590b('0x34')](_0x35dcaf[_0x590b('0x35')],{})[_0x590b('0x22')](respondWithResult(_0x294688,0xc9))['catch'](handleError(_0x294688,null));};exports['update']=function(_0x322940,_0x446db1){if(_0x322940[_0x590b('0x35')]['id']){delete _0x322940[_0x590b('0x35')]['id'];}return db[_0x590b('0x29')]['find']({'where':{'id':_0x322940[_0x590b('0x36')]['id']}})[_0x590b('0x22')](handleEntityNotFound(_0x446db1,null))[_0x590b('0x22')](saveUpdates(_0x322940[_0x590b('0x35')],null))[_0x590b('0x22')](respondWithResult(_0x446db1,null))['catch'](handleError(_0x446db1,null));};exports[_0x590b('0x37')]=function(_0x2fd86b,_0x4e3f84){return db['ChatProactiveAction'][_0x590b('0x38')]({'where':{'id':_0x2fd86b['params']['id']}})[_0x590b('0x22')](handleEntityNotFound(_0x4e3f84,null))[_0x590b('0x22')](removeEntity(_0x4e3f84,null))[_0x590b('0x33')](handleError(_0x4e3f84,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6a00010..5f3da73 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 _0x3ad0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api'];(function(_0x4d119f,_0x31f933){var _0x1f60b4=function(_0x5540a8){while(--_0x5540a8){_0x4d119f['push'](_0x4d119f['shift']());}};_0x1f60b4(++_0x31f933);}(_0x3ad0,0x195));var _0x03ad=function(_0x265cb1,_0x432c0b){_0x265cb1=_0x265cb1-0x0;var _0x37651c=_0x3ad0[_0x265cb1];return _0x37651c;};'use strict';var _=require('lodash');var util=require(_0x03ad('0x0'));var logger=require(_0x03ad('0x1'))(_0x03ad('0x2'));var moment=require(_0x03ad('0x3'));var BPromise=require(_0x03ad('0x4'));var rp=require(_0x03ad('0x5'));var fs=require('fs');var path=require(_0x03ad('0x6'));var rimraf=require(_0x03ad('0x7'));var config=require(_0x03ad('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x03ad('0x9')]=function(_0x27c402,_0x478dd5){return _0x27c402['define'](_0x03ad('0xa'),attributes,{'tableName':_0x03ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa38c=['util','../../config/logger','path','rimraf','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x5b9db8,_0x398711){var _0x34c35f=function(_0x3bd297){while(--_0x3bd297){_0x5b9db8['push'](_0x5b9db8['shift']());}};_0x34c35f(++_0x398711);}(_0xa38c,0x178));var _0xca38=function(_0x521da0,_0x4986a4){_0x521da0=_0x521da0-0x0;var _0x159674=_0xa38c[_0x521da0];return _0x159674;};'use strict';var _=require('lodash');var util=require(_0xca38('0x0'));var logger=require(_0xca38('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xca38('0x2'));var rimraf=require(_0xca38('0x3'));var config=require('../../config/environment');var attributes=require(_0xca38('0x4'));module['exports']=function(_0xfa6388,_0x598179){return _0xfa6388[_0xca38('0x5')](_0xca38('0x6'),attributes,{'tableName':_0xca38('0x7'),'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 c18fe3a..69552ba 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 _0xb655=['rpc','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb655,0x1f2));var _0x5b65=function(_0x27a45b,_0x53d837){_0x27a45b=_0x27a45b-0x0;var _0x1f71f2=_0xb655[_0x27a45b];return _0x1f71f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5b65('0x0'));var rs=require(_0x5b65('0x1'));var fs=require('fs');var Redis=require(_0x5b65('0x2'));var db=require(_0x5b65('0x3'))['db'];var utils=require(_0x5b65('0x4'));var logger=require(_0x5b65('0x5'))(_0x5b65('0x6'));var config=require(_0x5b65('0x7'));var jayson=require(_0x5b65('0x8'));var client=jayson['client'][_0x5b65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46eec6,_0x59c2f2,_0x5b6386){return new BPromise(function(_0x3a3a78,_0x45518c){return client[_0x5b65('0xa')](_0x46eec6,_0x5b6386)['then'](function(_0x537fd5){logger[_0x5b65('0xb')](_0x5b65('0xc'),_0x59c2f2,_0x5b65('0xd'));logger['debug'](_0x5b65('0xe'),_0x59c2f2,_0x5b65('0xd'),JSON['stringify'](_0x537fd5));if(_0x537fd5['error']){if(_0x537fd5[_0x5b65('0xf')][_0x5b65('0x10')]===0x1f4){logger[_0x5b65('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x59c2f2,_0x537fd5['error']['message']);return _0x45518c(_0x537fd5['error'][_0x5b65('0x11')]);}logger[_0x5b65('0xf')](_0x5b65('0xc'),_0x59c2f2,_0x537fd5['error'][_0x5b65('0x11')]);return _0x3a3a78(_0x537fd5[_0x5b65('0xf')][_0x5b65('0x11')]);}else{logger[_0x5b65('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x59c2f2,_0x5b65('0xd'));_0x3a3a78(_0x537fd5['result'][_0x5b65('0x11')]);}})['catch'](function(_0x1c9e4d){logger['error'](_0x5b65('0xc'),_0x59c2f2,_0x1c9e4d);_0x45518c(_0x1c9e4d);});});} \ No newline at end of file +var _0x9f1f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f1f,0x10f));var _0xf9f1=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x9f1f[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xf9f1('0x0'));var util=require(_0xf9f1('0x1'));var moment=require(_0xf9f1('0x2'));var BPromise=require(_0xf9f1('0x3'));var rs=require(_0xf9f1('0x4'));var fs=require('fs');var Redis=require(_0xf9f1('0x5'));var db=require(_0xf9f1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9f1('0x7'))(_0xf9f1('0x8'));var config=require(_0xf9f1('0x9'));var jayson=require(_0xf9f1('0xa'));var client=jayson[_0xf9f1('0xb')][_0xf9f1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x463dec,_0x21d791,_0x40ade2){return new BPromise(function(_0x1260f3,_0x134010){return client[_0xf9f1('0xd')](_0x463dec,_0x40ade2)['then'](function(_0x13cba5){logger[_0xf9f1('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x21d791,_0xf9f1('0xf'));logger[_0xf9f1('0x10')](_0xf9f1('0x11'),_0x21d791,_0xf9f1('0xf'),JSON['stringify'](_0x13cba5));if(_0x13cba5['error']){if(_0x13cba5[_0xf9f1('0x12')][_0xf9f1('0x13')]===0x1f4){logger['error'](_0xf9f1('0x14'),_0x21d791,_0x13cba5[_0xf9f1('0x12')][_0xf9f1('0x15')]);return _0x134010(_0x13cba5['error'][_0xf9f1('0x15')]);}logger[_0xf9f1('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x21d791,_0x13cba5[_0xf9f1('0x12')][_0xf9f1('0x15')]);return _0x1260f3(_0x13cba5[_0xf9f1('0x12')][_0xf9f1('0x15')]);}else{logger[_0xf9f1('0xe')](_0xf9f1('0x14'),_0x21d791,_0xf9f1('0xf'));_0x1260f3(_0x13cba5['result']['message']);}})[_0xf9f1('0x16')](function(_0x6d801b){logger['error'](_0xf9f1('0x14'),_0x21d791,_0x6d801b);_0x134010(_0x6d801b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 371c071..d36aae1 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xabce,0x103));var _0xeabc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xabce[_0x543084];return _0x306a57;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0xeec6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','put','update','delete','exports'];(function(_0x3f09a9,_0x2a1758){var _0x854a6d=function(_0x3eff89){while(--_0x3eff89){_0x3f09a9['push'](_0x3f09a9['shift']());}};_0x854a6d(++_0x2a1758);}(_0xeec6,0x1c2));var _0x6eec=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0xeec6[_0x387603];return _0x55ea9e;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get'](_0x6eec('0xa'),auth[_0x6eec('0xb')](),controller['show']);router[_0x6eec('0xc')]('/',auth[_0x6eec('0xb')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6eec('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 434525d..f7333f0 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 _0x400d=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x1845c3,_0x1b98ab){var _0xdfe275=function(_0x445ad7){while(--_0x445ad7){_0x1845c3['push'](_0x1845c3['shift']());}};_0xdfe275(++_0x1b98ab);}(_0x400d,0x195));var _0xd400=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x400d[_0x2272b5];return _0x110156;};'use strict';var Sequelize=require(_0xd400('0x0'));module[_0xd400('0x1')]={'name':{'type':Sequelize[_0xd400('0x2')],'unique':_0xd400('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd400('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd400('0x5')](_0xd400('0x6'),_0xd400('0x7'),'roundrobin')}}; \ No newline at end of file +var _0xfaf6=['roundrobin','sequelize','exports','STRING','name','ENUM','beepall'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfaf6,0x13c));var _0x6faf=function(_0xffabed,_0x558f46){_0xffabed=_0xffabed-0x0;var _0x121681=_0xfaf6[_0xffabed];return _0x121681;};'use strict';var Sequelize=require(_0x6faf('0x0'));module[_0x6faf('0x1')]={'name':{'type':Sequelize[_0x6faf('0x2')],'unique':_0x6faf('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6faf('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6faf('0x4')]('rrmemory',_0x6faf('0x5'),_0x6faf('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4c209c1..b6922c1 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 _0x177a=['merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','map','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','findOne','Team','getTeams','addTeams','Agents','interface','flatMap','sequelize','transaction','UserChatQueue','findOrCreate','forEach','emit','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','bluebird','util','lodash','ioredis','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','update','then','destroy','get','UserProfileResource','error','stack','name','send','ChatQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','keys','intersection','model','attributes','fields','includeAll'];(function(_0x1ba734,_0x4cc0c2){var _0xbf9b4b=function(_0x342c7b){while(--_0x342c7b){_0x1ba734['push'](_0x1ba734['shift']());}};_0xbf9b4b(++_0x4cc0c2);}(_0x177a,0x1af));var _0xa177=function(_0x5cc50a,_0x475a33){_0x5cc50a=_0x5cc50a-0x0;var _0x3baedb=_0x177a[_0x5cc50a];return _0x3baedb;};'use strict';var BPromise=require(_0xa177('0x0'));var util=require(_0xa177('0x1'));var _=require(_0xa177('0x2'));var squel=require('squel');var Redis=require(_0xa177('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa177('0x4'));var config=require(_0xa177('0x5'));var db=require('../../mysqldb')['db'];config[_0xa177('0x6')]=_[_0xa177('0x7')](config[_0xa177('0x6')],{'host':_0xa177('0x8'),'port':0x18eb});var socket=require(_0xa177('0x9'))(new Redis(config['redis']));require(_0xa177('0xa'))[_0xa177('0xb')](socket);function respondWithStatusCode(_0x5b471d,_0x1cfec1){_0x1cfec1=_0x1cfec1||0xcc;return function(_0x54a7ef){if(_0x54a7ef){return _0x5b471d[_0xa177('0xc')](_0x1cfec1);}return _0x5b471d[_0xa177('0xd')](_0x1cfec1)[_0xa177('0xe')]();};}function respondWithResult(_0x5db4d2,_0x12ef38){_0x12ef38=_0x12ef38||0xc8;return function(_0x43733e){if(_0x43733e){return _0x5db4d2[_0xa177('0xd')](_0x12ef38)['json'](_0x43733e);}};}function respondWithFilteredResult(_0x5df276,_0x331bb6){return function(_0x4c6239){if(_0x4c6239){var _0x5621ff=typeof _0x331bb6['offset']===_0xa177('0xf')&&typeof _0x331bb6['limit']===_0xa177('0xf');var _0x2445b3=_0x4c6239[_0xa177('0x10')];var _0x52e36f=_0x5621ff?0x0:_0x331bb6[_0xa177('0x11')];var _0x34fb9c=_0x5621ff?_0x4c6239['count']:_0x331bb6['offset']+_0x331bb6[_0xa177('0x12')];var _0x1d175c;if(_0x34fb9c>=_0x2445b3){_0x34fb9c=_0x2445b3;_0x1d175c=0xc8;}else{_0x1d175c=0xce;}_0x5df276[_0xa177('0xd')](_0x1d175c);return _0x5df276[_0xa177('0x13')](_0xa177('0x14'),_0x52e36f+'-'+_0x34fb9c+'/'+_0x2445b3)[_0xa177('0x15')](_0x4c6239);}return null;};}function saveUpdates(_0x305edc){return function(_0x13ae90){if(_0x13ae90){return _0x13ae90[_0xa177('0x16')](_0x305edc)[_0xa177('0x17')](function(_0x23e214){return _0x23e214;});}return null;};}function removeEntity(_0x2616e6){return function(_0x2b004e){if(_0x2b004e){return _0x2b004e[_0xa177('0x18')]()[_0xa177('0x17')](function(){var _0x5d6f62=_0x2b004e[_0xa177('0x19')]({'plain':!![]});var _0x2e292e='ChatQueues';return db[_0xa177('0x1a')][_0xa177('0x18')]({'where':{'type':_0x2e292e,'resourceId':_0x5d6f62['id']}})[_0xa177('0x17')](function(){return _0x2b004e;});})[_0xa177('0x17')](function(){_0x2616e6[_0xa177('0xd')](0xcc)[_0xa177('0xe')]();});}};}function handleEntityNotFound(_0x5a25e8){return function(_0x1b0f80){if(!_0x1b0f80){_0x5a25e8[_0xa177('0xc')](0x194);}return _0x1b0f80;};}function handleError(_0x285949,_0x201cd8){_0x201cd8=_0x201cd8||0x1f4;return function(_0x437e82){logger[_0xa177('0x1b')](_0x437e82[_0xa177('0x1c')]);if(_0x437e82['name']){delete _0x437e82[_0xa177('0x1d')];}_0x285949[_0xa177('0xd')](_0x201cd8)[_0xa177('0x1e')](_0x437e82);};}exports['index']=function(_0x567b7a,_0xad4ca6){var _0x5e7273={};var _0x1141e1={'count':0x0,'rows':[]};var _0x45d591=_['map'](db[_0xa177('0x1f')][_0xa177('0x20')],function(_0x2548d3){return{'name':_0x2548d3[_0xa177('0x21')],'type':_0x2548d3['type'][_0xa177('0x22')]};});_0x5e7273=qs['getOptions'](_0x45d591,_0x567b7a);var _0x10364b={'where':_0x5e7273[_0xa177('0x23')]};return db[_0xa177('0x1f')]['count'](_0x10364b)[_0xa177('0x17')](function(_0x34ac77){_0x1141e1[_0xa177('0x10')]=_0x34ac77;_0x5e7273['include']=qs[_0xa177('0x24')](_0x567b7a[_0xa177('0x25')]);return db[_0xa177('0x1f')][_0xa177('0x26')](_0x5e7273);})[_0xa177('0x17')](function(_0x42f3e9){_0x1141e1[_0xa177('0x27')]=_0x42f3e9;return _0x1141e1;})[_0xa177('0x17')](respondWithFilteredResult(_0xad4ca6,_0x5e7273))[_0xa177('0x28')](handleError(_0xad4ca6,null));};exports[_0xa177('0x29')]=function(_0x4715ae,_0x3dcd98){var _0x385a33={'raw':!![],'where':{'id':_0x4715ae[_0xa177('0x2a')]['id']}},_0x2fb139={};_0x2fb139['model']=_[_0xa177('0x2b')](db[_0xa177('0x1f')][_0xa177('0x20')]);_0x2fb139[_0xa177('0x25')]=_['keys'](_0x4715ae[_0xa177('0x25')]);_0x2fb139['filters']=_[_0xa177('0x2c')](_0x2fb139[_0xa177('0x2d')],_0x2fb139[_0xa177('0x25')]);_0x385a33[_0xa177('0x2e')]=_[_0xa177('0x2c')](_0x2fb139[_0xa177('0x2d')],qs[_0xa177('0x2f')](_0x4715ae['query'][_0xa177('0x2f')]));_0x385a33[_0xa177('0x2e')]=_0x385a33[_0xa177('0x2e')]['length']?_0x385a33[_0xa177('0x2e')]:_0x2fb139[_0xa177('0x2d')];if(_0x4715ae[_0xa177('0x25')][_0xa177('0x30')]){_0x385a33[_0xa177('0x24')]=[{'all':!![]}];}_0x385a33=_[_0xa177('0x31')]({},_0x385a33,_0x4715ae[_0xa177('0x32')]);return db[_0xa177('0x1f')][_0xa177('0x33')](_0x385a33)['then'](handleEntityNotFound(_0x3dcd98,null))[_0xa177('0x17')](respondWithResult(_0x3dcd98,null))[_0xa177('0x28')](handleError(_0x3dcd98,null));};exports[_0xa177('0x34')]=function(_0x1f369d,_0x8d3414){return db[_0xa177('0x1f')][_0xa177('0x34')](_0x1f369d[_0xa177('0x35')],{})[_0xa177('0x17')](function(_0x5cdeb1){var _0x3470b8=_0x1f369d[_0xa177('0x36')][_0xa177('0x19')]({'plain':!![]});if(!_0x3470b8)throw new Error(_0xa177('0x37'));if(_0x3470b8[_0xa177('0x38')]==='user'){var _0x5cad85=_0x5cdeb1[_0xa177('0x19')]({'plain':!![]});var _0x5c73b2='ChatQueues';return db[_0xa177('0x39')]['find']({'where':{'name':_0x5c73b2,'userProfileId':_0x3470b8[_0xa177('0x3a')]},'raw':!![]})[_0xa177('0x17')](function(_0x5a36b5){if(_0x5a36b5&&_0x5a36b5['autoAssociation']===0x0){return db[_0xa177('0x1a')]['create']({'name':_0x5cad85['name'],'resourceId':_0x5cad85['id'],'type':_0x5a36b5[_0xa177('0x1d')],'sectionId':_0x5a36b5['id']},{})[_0xa177('0x17')](function(){return _0x5cdeb1;});}else{return _0x5cdeb1;}})[_0xa177('0x28')](function(_0x305807){logger['error'](_0xa177('0x3b'),_0x305807);throw _0x305807;});}return _0x5cdeb1;})[_0xa177('0x17')](respondWithResult(_0x8d3414,0xc9))['catch'](handleError(_0x8d3414,null));};exports[_0xa177('0x16')]=function(_0x34a6ad,_0x7d20cf){if(_0x34a6ad[_0xa177('0x35')]['id']){delete _0x34a6ad[_0xa177('0x35')]['id'];}return db['ChatQueue'][_0xa177('0x33')]({'where':{'id':_0x34a6ad['params']['id']}})[_0xa177('0x17')](handleEntityNotFound(_0x7d20cf,null))[_0xa177('0x17')](saveUpdates(_0x34a6ad[_0xa177('0x35')],null))['then'](respondWithResult(_0x7d20cf,null))[_0xa177('0x28')](handleError(_0x7d20cf,null));};exports['destroy']=function(_0x59bd3e,_0xeb9b13){return db[_0xa177('0x1f')][_0xa177('0x33')]({'where':{'id':_0x59bd3e[_0xa177('0x2a')]['id']}})['then'](handleEntityNotFound(_0xeb9b13,null))[_0xa177('0x17')](removeEntity(_0xeb9b13,null))['catch'](handleError(_0xeb9b13,null));};exports[_0xa177('0x3c')]=function(_0x462992,_0x5ec686){return db[_0xa177('0x1f')][_0xa177('0x3c')]()[_0xa177('0x17')](respondWithResult(_0x5ec686,null))[_0xa177('0x28')](handleError(_0x5ec686,null));};exports[_0xa177('0x3d')]=function(_0x203e3e,_0x1cd3e3){var _0x50587f={'raw':!![],'where':{}},_0x2be980={},_0x6c253;return db[_0xa177('0x1f')]['findOne']({'where':{'id':_0x203e3e[_0xa177('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1cd3e3,null))['then'](function(_0x3714f2){if(_0x3714f2){_0x6c253=_0x3714f2[_0xa177('0x19')]({'plain':!![]});_0x2be980['model']=_[_0xa177('0x2b')](db['UserChatQueue']['rawAttributes']);_0x2be980[_0xa177('0x25')]=_[_0xa177('0x2b')](_0x203e3e[_0xa177('0x25')]);_0x2be980['filters']=_['intersection'](_0x2be980[_0xa177('0x2d')],_0x2be980[_0xa177('0x25')]);_0x50587f[_0xa177('0x2e')]=_['intersection'](_0x2be980[_0xa177('0x2d')],qs[_0xa177('0x2f')](_0x203e3e[_0xa177('0x25')][_0xa177('0x2f')]));_0x50587f['attributes']=_0x50587f[_0xa177('0x2e')][_0xa177('0x3e')]?_0x50587f[_0xa177('0x2e')]:_0x2be980[_0xa177('0x2d')];if(!_0x203e3e['query'][_0xa177('0x3f')](_0xa177('0x40'))){_0x50587f[_0xa177('0x12')]=qs[_0xa177('0x12')](_0x203e3e['query'][_0xa177('0x12')]);_0x50587f[_0xa177('0x11')]=qs[_0xa177('0x11')](_0x203e3e['query'][_0xa177('0x11')]);}_0x50587f[_0xa177('0x41')]=qs[_0xa177('0x42')](_0x203e3e[_0xa177('0x25')][_0xa177('0x42')]);_0x50587f[_0xa177('0x23')]=qs[_0xa177('0x43')](_[_0xa177('0x44')](_0x203e3e['query'],_0x2be980[_0xa177('0x43')]));_0x50587f[_0xa177('0x23')]['ChatQueueId']=_0x3714f2['id'];if(_0x203e3e['query'][_0xa177('0x45')]){_0x50587f[_0xa177('0x23')]=_[_0xa177('0x31')](_0x50587f[_0xa177('0x23')],{'$or':_[_0xa177('0x46')](_0x50587f[_0xa177('0x2e')],function(_0x319be1){var _0x29d843={};_0x29d843[_0x319be1]={'$like':'%'+_0x203e3e[_0xa177('0x25')][_0xa177('0x45')]+'%'};return _0x29d843;})});}_0x50587f=_[_0xa177('0x31')]({},_0x50587f,_0x203e3e['options']);return db['UserChatQueue']['findAll'](_0x50587f);}})[_0xa177('0x17')](function(_0x5efc0d){if(_0x5efc0d){return db[_0xa177('0x47')][_0xa177('0x48')]({'where':{'id':_[_0xa177('0x46')](_0x5efc0d,_0xa177('0x49')),'role':_0xa177('0x4a')},'attributes':['id',_0xa177('0x1d'),_0xa177('0x4b'),_0xa177('0x4c'),'createdAt']});}})[_0xa177('0x17')](function(_0x25d448){if(_0x25d448){return{'count':_0x25d448[_0xa177('0x10')],'rows':_[_0xa177('0x46')](_0x25d448['rows'],function(_0x31d8eb){return{'membername':_0x31d8eb['name'],'UserId':_0x31d8eb['id'],'queue_name':_0x6c253[_0xa177('0x1d')],'ChatQueueId':_0x6c253['id'],'interface':util[_0xa177('0x4d')](_0xa177('0x4e'),_0xa177('0x4f'),_0x31d8eb[_0xa177('0x1d')]),'penalty':0x0,'paused':_0x31d8eb['chatPause'],'createdAt':_0x31d8eb[_0xa177('0x50')],'updatedAt':_0x31d8eb[_0xa177('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1cd3e3,_0x50587f))[_0xa177('0x28')](handleError(_0x1cd3e3,null));};exports['getTeams']=function(_0x26240e,_0x5b1682){var _0x775220={};var _0x33e279={};var _0x176d65;var _0x25f852;return db['ChatQueue'][_0xa177('0x51')]({'where':{'id':_0x26240e[_0xa177('0x2a')]['id']}})[_0xa177('0x17')](handleEntityNotFound(_0x5b1682,null))[_0xa177('0x17')](function(_0x392a5d){if(_0x392a5d){_0x176d65=_0x392a5d;_0x33e279[_0xa177('0x2d')]=_[_0xa177('0x2b')](db[_0xa177('0x52')]['rawAttributes']);_0x33e279['query']=_[_0xa177('0x2b')](_0x26240e[_0xa177('0x25')]);_0x33e279['filters']=_['intersection'](_0x33e279[_0xa177('0x2d')],_0x33e279[_0xa177('0x25')]);_0x775220[_0xa177('0x2e')]=_[_0xa177('0x2c')](_0x33e279[_0xa177('0x2d')],qs[_0xa177('0x2f')](_0x26240e[_0xa177('0x25')][_0xa177('0x2f')]));_0x775220[_0xa177('0x2e')]=_0x775220[_0xa177('0x2e')][_0xa177('0x3e')]?_0x775220[_0xa177('0x2e')]:_0x33e279['model'];_0x775220[_0xa177('0x41')]=qs[_0xa177('0x42')](_0x26240e[_0xa177('0x25')][_0xa177('0x42')]);_0x775220[_0xa177('0x23')]=qs[_0xa177('0x43')](_[_0xa177('0x44')](_0x26240e['query'],_0x33e279[_0xa177('0x43')]));if(_0x26240e[_0xa177('0x25')]['filter']){_0x775220[_0xa177('0x23')]=_[_0xa177('0x31')](_0x775220[_0xa177('0x23')],{'$or':_[_0xa177('0x46')](_0x775220[_0xa177('0x2e')],function(_0x13eabf){var _0x3d9835={};_0x3d9835[_0x13eabf]={'$like':'%'+_0x26240e[_0xa177('0x25')][_0xa177('0x45')]+'%'};return _0x3d9835;})});}_0x775220=_[_0xa177('0x31')]({},_0x775220,_0x26240e[_0xa177('0x32')]);return _0x176d65[_0xa177('0x53')](_0x775220);}})['then'](function(_0x1e47c9){if(_0x1e47c9){_0x25f852=_0x1e47c9[_0xa177('0x3e')];if(!_0x26240e[_0xa177('0x25')][_0xa177('0x3f')](_0xa177('0x40'))){_0x775220[_0xa177('0x12')]=qs['limit'](_0x26240e[_0xa177('0x25')][_0xa177('0x12')]);_0x775220[_0xa177('0x11')]=qs[_0xa177('0x11')](_0x26240e[_0xa177('0x25')][_0xa177('0x11')]);}return _0x176d65[_0xa177('0x53')](_0x775220);}})[_0xa177('0x17')](function(_0x6644d4){if(_0x6644d4){return _0x6644d4?{'count':_0x25f852,'rows':_0x6644d4}:null;}})[_0xa177('0x17')](respondWithResult(_0x5b1682,null))[_0xa177('0x28')](handleError(_0x5b1682,null));};exports[_0xa177('0x54')]=function(_0x19afbd,_0x17fcf6){var _0x17dd98=_0x19afbd[_0xa177('0x35')]['ids'];return db[_0xa177('0x52')]['findAll']({'where':{'id':_0x17dd98},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa177('0x55'),'attributes':['id',_0xa177('0x1d'),'online','voicePause',_0xa177('0x56')],'raw':!![]}]})['then'](function(_0x447d81){if(_0x447d81){var _0x1190fa=_[_0xa177('0x57')](_0x447d81,function(_0x5d47ff){var _0x1c0c7b=_0x5d47ff[_0xa177('0x19')]({'plain':!![]});return _0x1c0c7b[_0xa177('0x55')];});return db['ChatQueue'][_0xa177('0x33')]({'where':{'id':_0x19afbd[_0xa177('0x2a')]['id']}})['then'](function(_0x57e48b){return db[_0xa177('0x58')][_0xa177('0x59')](function(_0x3524f1){return _0x57e48b[_0xa177('0x54')](_0x17dd98,{'transaction':_0x3524f1})['then'](function(){return BPromise['each'](_0x1190fa,function(_0x64cf9c){return db[_0xa177('0x5a')][_0xa177('0x5b')]({'where':{'UserId':_0x64cf9c['id'],'ChatQueueId':_0x19afbd[_0xa177('0x2a')]['id']},'transaction':_0x3524f1});});})[_0xa177('0x17')](function(){_0x1190fa[_0xa177('0x5c')](function(_0x248039){socket[_0xa177('0x5d')]('userChatQueue:save',{'UserId':_0x248039['id'],'ChatQueueId':_0x57e48b['id']});});});});});}})[_0xa177('0x17')](respondWithStatusCode(_0x17fcf6,null))[_0xa177('0x28')](handleError(_0x17fcf6,null));};exports['removeTeams']=function(_0x3dd7d6,_0x1dda45){return db['Team']['findAll']({'where':{'id':_0x3dd7d6['query'][_0xa177('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xa177('0x47')],'as':_0xa177('0x55'),'attributes':['id'],'raw':!![]}]})[_0xa177('0x17')](handleEntityNotFound(_0x1dda45,null))[_0xa177('0x17')](function(_0x2e0ff3){var _0x5c9182=_['map'](_0x2e0ff3,'id');var _0x50d49e=[];var _0x2fb752=[];var _0x32db02=squel[_0xa177('0x5f')]();_0x32db02[_0xa177('0x60')](_0xa177('0x61'))[_0xa177('0x62')](_0xa177('0x63'),'tq')[_0xa177('0x64')]('user_has_teams','ut',_0xa177('0x65'))[_0xa177('0x23')](_0xa177('0x66'),_0x3dd7d6['params']['id']);for(var _0x27aa0c=0x0;_0x27aa0c<_0x2e0ff3[_0xa177('0x3e')];_0x27aa0c+=0x1){let _0x1f6c37=_0x2e0ff3[_0x27aa0c];for(var _0x40da8c=0x0;_0x40da8c<_0x1f6c37[_0xa177('0x55')][_0xa177('0x3e')];_0x40da8c+=0x1){let _0x2be2dd=_0x1f6c37[_0xa177('0x55')][_0x40da8c];var _0x46b94f=_0x32db02['clone']();_0x46b94f[_0xa177('0x23')]('ut.UserId\x20=\x20?',_0x2be2dd['id']);_0x2fb752[_0xa177('0x67')](db[_0xa177('0x58')]['query'](_0x46b94f[_0xa177('0x68')](),{'type':db[_0xa177('0x58')][_0xa177('0x69')][_0xa177('0x6a')]})[_0xa177('0x17')](function(_0x383410){if(_0x383410[_0xa177('0x3e')]===0x1){return _0x2be2dd['id'];}else{var _0x35550e=_[_0xa177('0x6b')](_[_0xa177('0x46')](_0x383410,'TeamId'),function(_0x56d909){return _[_0xa177('0x6c')](_0x5c9182,_0x56d909);});if(_0x35550e){return _0x2be2dd['id'];}}}));}}return BPromise[_0xa177('0x6d')](_0x2fb752)['then'](function(_0x339fc5){_0x50d49e=_(_0x50d49e)[_0xa177('0x6e')](_0x339fc5)['compact']()[_0xa177('0x6f')]();return db['ChatQueue'][_0xa177('0x33')]({'where':{'id':_0x3dd7d6[_0xa177('0x2a')]['id']}})[_0xa177('0x17')](function(_0x2465d3){return db[_0xa177('0x58')]['transaction'](function(_0x2fc830){return _0x2465d3['removeTeams'](_0x3dd7d6[_0xa177('0x25')][_0xa177('0x5e')],{'transaction':_0x2fc830})[_0xa177('0x17')](function(){if(!_['isEmpty'](_0x50d49e)){return _0x2465d3[_0xa177('0x70')](_0x50d49e,{'transaction':_0x2fc830});}})[_0xa177('0x17')](function(){_0x50d49e[_0xa177('0x5c')](function(_0x204fac){socket[_0xa177('0x5d')](_0xa177('0x71'),{'UserId':_0x204fac,'ChatQueueId':_0x2465d3['id']});});});});});});})[_0xa177('0x17')](respondWithStatusCode(_0x1dda45,null))['catch'](handleError(_0x1dda45,null));};exports[_0xa177('0x72')]=function(_0x185248,_0x21f138){return db[_0xa177('0x1f')]['find']({'where':{'id':_0x185248[_0xa177('0x2a')]['id']}})['then'](handleEntityNotFound(_0x21f138,null))[_0xa177('0x17')](function(_0x43084d){if(_0x43084d){return _0x43084d[_0xa177('0x72')](_0x185248[_0xa177('0x35')][_0xa177('0x5e')],_[_0xa177('0x73')](_0x185248[_0xa177('0x35')],[_0xa177('0x5e'),'id'])||{})[_0xa177('0x74')](function(_0x3f81ba){for(var _0x13e533=0x0;_0x13e533<_0x185248['body']['ids'][_0xa177('0x3e')];_0x13e533+=0x1){socket['emit'](_0xa177('0x75'),{'UserId':Number(_0x185248[_0xa177('0x35')][_0xa177('0x5e')][_0x13e533]),'ChatQueueId':Number(_0x185248[_0xa177('0x2a')]['id'])});}return _0x3f81ba;});}})['then'](respondWithResult(_0x21f138,null))[_0xa177('0x28')](handleError(_0x21f138,null));};exports['removeAgents']=function(_0x181a56,_0x1df60b){return db[_0xa177('0x1f')]['find']({'where':{'id':_0x181a56[_0xa177('0x2a')]['id']}})[_0xa177('0x17')](handleEntityNotFound(_0x1df60b,null))[_0xa177('0x17')](function(_0x1e0b01){if(_0x1e0b01){return _0x1e0b01[_0xa177('0x70')](_0x181a56[_0xa177('0x25')][_0xa177('0x5e')])['then'](function(){if(_[_0xa177('0x76')](_0x181a56[_0xa177('0x25')][_0xa177('0x5e')])){for(var _0x3f6f64=0x0;_0x3f6f64<_0x181a56[_0xa177('0x25')][_0xa177('0x5e')][_0xa177('0x3e')];_0x3f6f64+=0x1){socket[_0xa177('0x5d')](_0xa177('0x71'),{'UserId':Number(_0x181a56['query'][_0xa177('0x5e')][_0x3f6f64]),'ChatQueueId':Number(_0x181a56[_0xa177('0x2a')]['id'])});}}else{socket[_0xa177('0x5d')](_0xa177('0x71'),{'UserId':Number(_0x181a56['query']['ids']),'ChatQueueId':Number(_0x181a56['params']['id'])});}});}})[_0xa177('0x17')](respondWithStatusCode(_0x1df60b,null))[_0xa177('0x28')](handleError(_0x1df60b,null));};exports['getAgents']=function(_0x5b536d,_0x4ce3e0){var _0x15fbb0={};var _0x824a80={};var _0x20ded9;var _0x163d42;return db[_0xa177('0x1f')][_0xa177('0x51')]({'where':{'id':_0x5b536d[_0xa177('0x2a')]['id']}})[_0xa177('0x17')](handleEntityNotFound(_0x4ce3e0,null))[_0xa177('0x17')](function(_0x1ec5c1){if(_0x1ec5c1){_0x20ded9=_0x1ec5c1;_0x824a80['model']=_['keys'](db['User'][_0xa177('0x20')]);_0x824a80[_0xa177('0x25')]=_['keys'](_0x5b536d[_0xa177('0x25')]);_0x824a80[_0xa177('0x43')]=_[_0xa177('0x2c')](_0x824a80[_0xa177('0x2d')],_0x824a80[_0xa177('0x25')]);_0x15fbb0[_0xa177('0x2e')]=_[_0xa177('0x2c')](_0x824a80[_0xa177('0x2d')],qs[_0xa177('0x2f')](_0x5b536d['query']['fields']));_0x15fbb0[_0xa177('0x2e')]=_0x15fbb0['attributes']['length']?_0x15fbb0[_0xa177('0x2e')]:_0x824a80['model'];_0x15fbb0[_0xa177('0x41')]=qs['sort'](_0x5b536d[_0xa177('0x25')][_0xa177('0x42')]);_0x15fbb0['where']=qs[_0xa177('0x43')](_[_0xa177('0x44')](_0x5b536d['query'],_0x824a80[_0xa177('0x43')]));if(_0x5b536d['query']['filter']){_0x15fbb0[_0xa177('0x23')]=_['merge'](_0x15fbb0[_0xa177('0x23')],{'$or':_[_0xa177('0x46')](_0x15fbb0['attributes'],function(_0x20fc46){var _0x57458f={};_0x57458f[_0x20fc46]={'$like':'%'+_0x5b536d['query'][_0xa177('0x45')]+'%'};return _0x57458f;})});}_0x15fbb0=_[_0xa177('0x31')]({},_0x15fbb0,_0x5b536d[_0xa177('0x32')]);return _0x20ded9[_0xa177('0x77')](_0x15fbb0);}})[_0xa177('0x17')](function(_0x52f071){if(_0x52f071){_0x163d42=_0x52f071[_0xa177('0x3e')];if(!_0x5b536d[_0xa177('0x25')]['hasOwnProperty'](_0xa177('0x40'))){_0x15fbb0[_0xa177('0x12')]=qs[_0xa177('0x12')](_0x5b536d[_0xa177('0x25')][_0xa177('0x12')]);_0x15fbb0[_0xa177('0x11')]=qs[_0xa177('0x11')](_0x5b536d[_0xa177('0x25')][_0xa177('0x11')]);}return _0x20ded9[_0xa177('0x77')](_0x15fbb0);}})['then'](function(_0x13998c){if(_0x13998c){return _0x13998c?{'count':_0x163d42,'rows':_0x13998c}:null;}})[_0xa177('0x17')](respondWithResult(_0x4ce3e0,null))[_0xa177('0x28')](handleError(_0x4ce3e0,null));}; \ No newline at end of file +var _0x00d1=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','where','ChatQueue','include','query','catch','show','model','keys','filters','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','findOne','UserChatQueue','intersection','hasOwnProperty','nolimit','sort','pick','findAll','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','chatPause','getTeams','Team','order','filter','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','spread','isArray','userChatQueue:remove','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','get','ChatQueues','UserProfileResource'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x00d1,0x159));var _0x100d=function(_0x10d3c2,_0x1f5142){_0x10d3c2=_0x10d3c2-0x0;var _0x4208aa=_0x00d1[_0x10d3c2];return _0x4208aa;};'use strict';var BPromise=require('bluebird');var util=require(_0x100d('0x0'));var _=require('lodash');var squel=require(_0x100d('0x1'));var Redis=require(_0x100d('0x2'));var qs=require(_0x100d('0x3'));var logger=require(_0x100d('0x4'))('api');var config=require(_0x100d('0x5'));var db=require(_0x100d('0x6'))['db'];config[_0x100d('0x7')]=_[_0x100d('0x8')](config[_0x100d('0x7')],{'host':_0x100d('0x9'),'port':0x18eb});var socket=require(_0x100d('0xa'))(new Redis(config[_0x100d('0x7')]));require(_0x100d('0xb'))[_0x100d('0xc')](socket);function respondWithStatusCode(_0x57fa11,_0x53e1f0){_0x53e1f0=_0x53e1f0||0xcc;return function(_0x76f1cc){if(_0x76f1cc){return _0x57fa11[_0x100d('0xd')](_0x53e1f0);}return _0x57fa11[_0x100d('0xe')](_0x53e1f0)['end']();};}function respondWithResult(_0x514806,_0x18d6ff){_0x18d6ff=_0x18d6ff||0xc8;return function(_0x12fec7){if(_0x12fec7){return _0x514806[_0x100d('0xe')](_0x18d6ff)[_0x100d('0xf')](_0x12fec7);}};}function respondWithFilteredResult(_0xd615a6,_0x5347ad){return function(_0x1311b7){if(_0x1311b7){var _0x2ecafd=typeof _0x5347ad[_0x100d('0x10')]===_0x100d('0x11')&&typeof _0x5347ad['limit']==='undefined';var _0x173442=_0x1311b7[_0x100d('0x12')];var _0x330a20=_0x2ecafd?0x0:_0x5347ad['offset'];var _0x30d1bd=_0x2ecafd?_0x1311b7['count']:_0x5347ad[_0x100d('0x10')]+_0x5347ad[_0x100d('0x13')];var _0x2209a2;if(_0x30d1bd>=_0x173442){_0x30d1bd=_0x173442;_0x2209a2=0xc8;}else{_0x2209a2=0xce;}_0xd615a6[_0x100d('0xe')](_0x2209a2);return _0xd615a6[_0x100d('0x14')](_0x100d('0x15'),_0x330a20+'-'+_0x30d1bd+'/'+_0x173442)[_0x100d('0xf')](_0x1311b7);}return null;};}function saveUpdates(_0x285736){return function(_0x317cfb){if(_0x317cfb){return _0x317cfb[_0x100d('0x16')](_0x285736)[_0x100d('0x17')](function(_0x56c525){return _0x56c525;});}return null;};}function removeEntity(_0x8ac2b){return function(_0x5af288){if(_0x5af288){return _0x5af288['destroy']()[_0x100d('0x17')](function(){var _0x53e040=_0x5af288[_0x100d('0x18')]({'plain':!![]});var _0x4accf6=_0x100d('0x19');return db[_0x100d('0x1a')]['destroy']({'where':{'type':_0x4accf6,'resourceId':_0x53e040['id']}})[_0x100d('0x17')](function(){return _0x5af288;});})[_0x100d('0x17')](function(){_0x8ac2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16190a){return function(_0x40a740){if(!_0x40a740){_0x16190a[_0x100d('0xd')](0x194);}return _0x40a740;};}function handleError(_0x13cdf4,_0x198e11){_0x198e11=_0x198e11||0x1f4;return function(_0x29b6ff){logger[_0x100d('0x1b')](_0x29b6ff[_0x100d('0x1c')]);if(_0x29b6ff[_0x100d('0x1d')]){delete _0x29b6ff[_0x100d('0x1d')];}_0x13cdf4['status'](_0x198e11)[_0x100d('0x1e')](_0x29b6ff);};}exports[_0x100d('0x1f')]=function(_0x42d30a,_0x421556){var _0x46c99a={};var _0x124a87={'count':0x0,'rows':[]};var _0x272d4a=_[_0x100d('0x20')](db['ChatQueue'][_0x100d('0x21')],function(_0x13f276){return{'name':_0x13f276[_0x100d('0x22')],'type':_0x13f276[_0x100d('0x23')][_0x100d('0x24')]};});_0x46c99a=qs['getOptions'](_0x272d4a,_0x42d30a);var _0x1420a5={'where':_0x46c99a[_0x100d('0x25')]};return db[_0x100d('0x26')][_0x100d('0x12')](_0x1420a5)['then'](function(_0x4e4fa0){_0x124a87[_0x100d('0x12')]=_0x4e4fa0;_0x46c99a['include']=qs[_0x100d('0x27')](_0x42d30a[_0x100d('0x28')]);return db[_0x100d('0x26')]['findAll'](_0x46c99a);})[_0x100d('0x17')](function(_0x2f5dda){_0x124a87['rows']=_0x2f5dda;return _0x124a87;})[_0x100d('0x17')](respondWithFilteredResult(_0x421556,_0x46c99a))[_0x100d('0x29')](handleError(_0x421556,null));};exports[_0x100d('0x2a')]=function(_0x351323,_0x12eebc){var _0x3beeba={'raw':!![],'where':{'id':_0x351323['params']['id']}},_0xbb9ffc={};_0xbb9ffc[_0x100d('0x2b')]=_[_0x100d('0x2c')](db['ChatQueue'][_0x100d('0x21')]);_0xbb9ffc[_0x100d('0x28')]=_[_0x100d('0x2c')](_0x351323[_0x100d('0x28')]);_0xbb9ffc[_0x100d('0x2d')]=_['intersection'](_0xbb9ffc[_0x100d('0x2b')],_0xbb9ffc[_0x100d('0x28')]);_0x3beeba[_0x100d('0x2e')]=_['intersection'](_0xbb9ffc['model'],qs[_0x100d('0x2f')](_0x351323[_0x100d('0x28')][_0x100d('0x2f')]));_0x3beeba[_0x100d('0x2e')]=_0x3beeba[_0x100d('0x2e')][_0x100d('0x30')]?_0x3beeba[_0x100d('0x2e')]:_0xbb9ffc['model'];if(_0x351323[_0x100d('0x28')]['includeAll']){_0x3beeba['include']=[{'all':!![]}];}_0x3beeba=_[_0x100d('0x31')]({},_0x3beeba,_0x351323[_0x100d('0x32')]);return db[_0x100d('0x26')][_0x100d('0x33')](_0x3beeba)[_0x100d('0x17')](handleEntityNotFound(_0x12eebc,null))[_0x100d('0x17')](respondWithResult(_0x12eebc,null))[_0x100d('0x29')](handleError(_0x12eebc,null));};exports[_0x100d('0x34')]=function(_0x49eeb0,_0x146ba0){return db[_0x100d('0x26')][_0x100d('0x34')](_0x49eeb0[_0x100d('0x35')],{})[_0x100d('0x17')](function(_0x55706e){var _0x252ef7=_0x49eeb0[_0x100d('0x36')][_0x100d('0x18')]({'plain':!![]});if(!_0x252ef7)throw new Error(_0x100d('0x37'));if(_0x252ef7[_0x100d('0x38')]===_0x100d('0x36')){var _0x1f58a7=_0x55706e[_0x100d('0x18')]({'plain':!![]});var _0x19020b=_0x100d('0x19');return db[_0x100d('0x39')][_0x100d('0x33')]({'where':{'name':_0x19020b,'userProfileId':_0x252ef7['userProfileId']},'raw':!![]})['then'](function(_0x48fdee){if(_0x48fdee&&_0x48fdee[_0x100d('0x3a')]===0x0){return db['UserProfileResource'][_0x100d('0x34')]({'name':_0x1f58a7['name'],'resourceId':_0x1f58a7['id'],'type':_0x48fdee['name'],'sectionId':_0x48fdee['id']},{})[_0x100d('0x17')](function(){return _0x55706e;});}else{return _0x55706e;}})['catch'](function(_0x45ec25){logger[_0x100d('0x1b')](_0x100d('0x3b'),_0x45ec25);throw _0x45ec25;});}return _0x55706e;})['then'](respondWithResult(_0x146ba0,0xc9))['catch'](handleError(_0x146ba0,null));};exports[_0x100d('0x16')]=function(_0x489b37,_0x7e9b4b){if(_0x489b37[_0x100d('0x35')]['id']){delete _0x489b37[_0x100d('0x35')]['id'];}return db[_0x100d('0x26')][_0x100d('0x33')]({'where':{'id':_0x489b37[_0x100d('0x3c')]['id']}})[_0x100d('0x17')](handleEntityNotFound(_0x7e9b4b,null))['then'](saveUpdates(_0x489b37[_0x100d('0x35')],null))[_0x100d('0x17')](respondWithResult(_0x7e9b4b,null))[_0x100d('0x29')](handleError(_0x7e9b4b,null));};exports[_0x100d('0x3d')]=function(_0x3af043,_0x20c97d){return db[_0x100d('0x26')][_0x100d('0x33')]({'where':{'id':_0x3af043[_0x100d('0x3c')]['id']}})[_0x100d('0x17')](handleEntityNotFound(_0x20c97d,null))[_0x100d('0x17')](removeEntity(_0x20c97d,null))[_0x100d('0x29')](handleError(_0x20c97d,null));};exports[_0x100d('0x3e')]=function(_0x29f829,_0x5b8864){return db[_0x100d('0x26')]['describe']()[_0x100d('0x17')](respondWithResult(_0x5b8864,null))[_0x100d('0x29')](handleError(_0x5b8864,null));};exports[_0x100d('0x3f')]=function(_0x1d4d0d,_0x1b7797){var _0x2d55fc={'raw':!![],'where':{}},_0x5e7145={},_0x4d8989;return db[_0x100d('0x26')][_0x100d('0x40')]({'where':{'id':_0x1d4d0d[_0x100d('0x3c')]['id']}})[_0x100d('0x17')](handleEntityNotFound(_0x1b7797,null))[_0x100d('0x17')](function(_0x57ac38){if(_0x57ac38){_0x4d8989=_0x57ac38[_0x100d('0x18')]({'plain':!![]});_0x5e7145[_0x100d('0x2b')]=_[_0x100d('0x2c')](db[_0x100d('0x41')]['rawAttributes']);_0x5e7145[_0x100d('0x28')]=_[_0x100d('0x2c')](_0x1d4d0d[_0x100d('0x28')]);_0x5e7145[_0x100d('0x2d')]=_['intersection'](_0x5e7145[_0x100d('0x2b')],_0x5e7145[_0x100d('0x28')]);_0x2d55fc[_0x100d('0x2e')]=_[_0x100d('0x42')](_0x5e7145['model'],qs[_0x100d('0x2f')](_0x1d4d0d['query'][_0x100d('0x2f')]));_0x2d55fc[_0x100d('0x2e')]=_0x2d55fc[_0x100d('0x2e')]['length']?_0x2d55fc[_0x100d('0x2e')]:_0x5e7145[_0x100d('0x2b')];if(!_0x1d4d0d[_0x100d('0x28')][_0x100d('0x43')](_0x100d('0x44'))){_0x2d55fc[_0x100d('0x13')]=qs['limit'](_0x1d4d0d[_0x100d('0x28')][_0x100d('0x13')]);_0x2d55fc[_0x100d('0x10')]=qs['offset'](_0x1d4d0d['query'][_0x100d('0x10')]);}_0x2d55fc['order']=qs['sort'](_0x1d4d0d['query'][_0x100d('0x45')]);_0x2d55fc[_0x100d('0x25')]=qs[_0x100d('0x2d')](_[_0x100d('0x46')](_0x1d4d0d[_0x100d('0x28')],_0x5e7145[_0x100d('0x2d')]));_0x2d55fc[_0x100d('0x25')]['ChatQueueId']=_0x57ac38['id'];if(_0x1d4d0d['query']['filter']){_0x2d55fc[_0x100d('0x25')]=_[_0x100d('0x31')](_0x2d55fc[_0x100d('0x25')],{'$or':_['map'](_0x2d55fc['attributes'],function(_0x5b4f83){var _0xbea6a={};_0xbea6a[_0x5b4f83]={'$like':'%'+_0x1d4d0d['query']['filter']+'%'};return _0xbea6a;})});}_0x2d55fc=_['merge']({},_0x2d55fc,_0x1d4d0d['options']);return db[_0x100d('0x41')][_0x100d('0x47')](_0x2d55fc);}})['then'](function(_0x219b51){if(_0x219b51){return db['User'][_0x100d('0x48')]({'where':{'id':_[_0x100d('0x20')](_0x219b51,'UserId'),'role':_0x100d('0x49')},'attributes':['id',_0x100d('0x1d'),'chatPause',_0x100d('0x4a'),_0x100d('0x4b')]});}})[_0x100d('0x17')](function(_0x7f0f42){if(_0x7f0f42){return{'count':_0x7f0f42[_0x100d('0x12')],'rows':_[_0x100d('0x20')](_0x7f0f42['rows'],function(_0x435c8c){return{'membername':_0x435c8c[_0x100d('0x1d')],'UserId':_0x435c8c['id'],'queue_name':_0x4d8989[_0x100d('0x1d')],'ChatQueueId':_0x4d8989['id'],'interface':util[_0x100d('0x4c')](_0x100d('0x4d'),'SIP',_0x435c8c[_0x100d('0x1d')]),'penalty':0x0,'paused':_0x435c8c[_0x100d('0x4e')],'createdAt':_0x435c8c[_0x100d('0x4b')],'updatedAt':_0x435c8c[_0x100d('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x100d('0x17')](respondWithFilteredResult(_0x1b7797,_0x2d55fc))[_0x100d('0x29')](handleError(_0x1b7797,null));};exports[_0x100d('0x4f')]=function(_0x41c09,_0x2f263c){var _0xca14c2={};var _0x5c9392={};var _0x46e15e;var _0x327516;return db[_0x100d('0x26')][_0x100d('0x40')]({'where':{'id':_0x41c09['params']['id']}})['then'](handleEntityNotFound(_0x2f263c,null))[_0x100d('0x17')](function(_0x24f4bf){if(_0x24f4bf){_0x46e15e=_0x24f4bf;_0x5c9392[_0x100d('0x2b')]=_[_0x100d('0x2c')](db[_0x100d('0x50')]['rawAttributes']);_0x5c9392[_0x100d('0x28')]=_[_0x100d('0x2c')](_0x41c09[_0x100d('0x28')]);_0x5c9392[_0x100d('0x2d')]=_[_0x100d('0x42')](_0x5c9392[_0x100d('0x2b')],_0x5c9392['query']);_0xca14c2[_0x100d('0x2e')]=_[_0x100d('0x42')](_0x5c9392['model'],qs[_0x100d('0x2f')](_0x41c09['query'][_0x100d('0x2f')]));_0xca14c2[_0x100d('0x2e')]=_0xca14c2[_0x100d('0x2e')][_0x100d('0x30')]?_0xca14c2['attributes']:_0x5c9392[_0x100d('0x2b')];_0xca14c2[_0x100d('0x51')]=qs['sort'](_0x41c09[_0x100d('0x28')][_0x100d('0x45')]);_0xca14c2[_0x100d('0x25')]=qs['filters'](_[_0x100d('0x46')](_0x41c09[_0x100d('0x28')],_0x5c9392['filters']));if(_0x41c09[_0x100d('0x28')]['filter']){_0xca14c2[_0x100d('0x25')]=_[_0x100d('0x31')](_0xca14c2['where'],{'$or':_[_0x100d('0x20')](_0xca14c2[_0x100d('0x2e')],function(_0x16c06e){var _0x4aa6fd={};_0x4aa6fd[_0x16c06e]={'$like':'%'+_0x41c09[_0x100d('0x28')][_0x100d('0x52')]+'%'};return _0x4aa6fd;})});}_0xca14c2=_[_0x100d('0x31')]({},_0xca14c2,_0x41c09['options']);return _0x46e15e[_0x100d('0x4f')](_0xca14c2);}})[_0x100d('0x17')](function(_0x1f32e5){if(_0x1f32e5){_0x327516=_0x1f32e5['length'];if(!_0x41c09[_0x100d('0x28')][_0x100d('0x43')](_0x100d('0x44'))){_0xca14c2[_0x100d('0x13')]=qs[_0x100d('0x13')](_0x41c09[_0x100d('0x28')][_0x100d('0x13')]);_0xca14c2[_0x100d('0x10')]=qs[_0x100d('0x10')](_0x41c09[_0x100d('0x28')]['offset']);}return _0x46e15e[_0x100d('0x4f')](_0xca14c2);}})['then'](function(_0x3ba4bb){if(_0x3ba4bb){return _0x3ba4bb?{'count':_0x327516,'rows':_0x3ba4bb}:null;}})[_0x100d('0x17')](respondWithResult(_0x2f263c,null))[_0x100d('0x29')](handleError(_0x2f263c,null));};exports[_0x100d('0x53')]=function(_0x1cb245,_0x4be416){var _0x532cb0=_0x1cb245[_0x100d('0x35')][_0x100d('0x54')];return db[_0x100d('0x50')][_0x100d('0x47')]({'where':{'id':_0x532cb0},'attributes':['id'],'include':[{'model':db[_0x100d('0x55')],'as':_0x100d('0x56'),'attributes':['id','name',_0x100d('0x57'),_0x100d('0x58'),_0x100d('0x59')],'raw':!![]}]})[_0x100d('0x17')](function(_0x1b9fc2){if(_0x1b9fc2){var _0x30cf4d=_[_0x100d('0x5a')](_0x1b9fc2,function(_0x184d9a){var _0x128188=_0x184d9a[_0x100d('0x18')]({'plain':!![]});return _0x128188[_0x100d('0x56')];});return db[_0x100d('0x26')]['find']({'where':{'id':_0x1cb245[_0x100d('0x3c')]['id']}})['then'](function(_0x3b6538){return db[_0x100d('0x5b')][_0x100d('0x5c')](function(_0x1cb89e){return _0x3b6538['addTeams'](_0x532cb0,{'transaction':_0x1cb89e})[_0x100d('0x17')](function(){return BPromise[_0x100d('0x5d')](_0x30cf4d,function(_0x497879){return db['UserChatQueue'][_0x100d('0x5e')]({'where':{'UserId':_0x497879['id'],'ChatQueueId':_0x1cb245[_0x100d('0x3c')]['id']},'transaction':_0x1cb89e});});})[_0x100d('0x17')](function(){_0x30cf4d['forEach'](function(_0xbbd082){socket[_0x100d('0x5f')](_0x100d('0x60'),{'UserId':_0xbbd082['id'],'ChatQueueId':_0x3b6538['id']});});});});});}})['then'](respondWithStatusCode(_0x4be416,null))['catch'](handleError(_0x4be416,null));};exports[_0x100d('0x61')]=function(_0x47e775,_0x422c32){return db[_0x100d('0x50')]['findAll']({'where':{'id':_0x47e775[_0x100d('0x28')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x100d('0x56'),'attributes':['id'],'raw':!![]}]})[_0x100d('0x17')](handleEntityNotFound(_0x422c32,null))[_0x100d('0x17')](function(_0x398737){var _0x305632=_[_0x100d('0x20')](_0x398737,'id');var _0x4e70de=[];var _0x32b6fb=[];var _0x17f5fa=squel[_0x100d('0x62')]();_0x17f5fa[_0x100d('0x63')](_0x100d('0x64'))[_0x100d('0x65')](_0x100d('0x66'),'tq')[_0x100d('0x67')](_0x100d('0x68'),'ut',_0x100d('0x69'))[_0x100d('0x25')](_0x100d('0x6a'),_0x47e775[_0x100d('0x3c')]['id']);for(var _0x346d61=0x0;_0x346d61<_0x398737[_0x100d('0x30')];_0x346d61+=0x1){let _0x1a2c73=_0x398737[_0x346d61];for(var _0x598b82=0x0;_0x598b82<_0x1a2c73[_0x100d('0x56')][_0x100d('0x30')];_0x598b82+=0x1){let _0x2ffbd8=_0x1a2c73[_0x100d('0x56')][_0x598b82];var _0x8514=_0x17f5fa['clone']();_0x8514[_0x100d('0x25')](_0x100d('0x6b'),_0x2ffbd8['id']);_0x32b6fb[_0x100d('0x6c')](db[_0x100d('0x5b')][_0x100d('0x28')](_0x8514[_0x100d('0x6d')](),{'type':db[_0x100d('0x5b')][_0x100d('0x6e')]['SELECT']})['then'](function(_0x5bb744){if(_0x5bb744['length']===0x1){return _0x2ffbd8['id'];}else{var _0xd25fde=_[_0x100d('0x6f')](_[_0x100d('0x20')](_0x5bb744,_0x100d('0x70')),function(_0x37f22b){return _[_0x100d('0x71')](_0x305632,_0x37f22b);});if(_0xd25fde){return _0x2ffbd8['id'];}}}));}}return BPromise[_0x100d('0x72')](_0x32b6fb)['then'](function(_0x2c20bd){_0x4e70de=_(_0x4e70de)[_0x100d('0x73')](_0x2c20bd)[_0x100d('0x74')]()[_0x100d('0x75')]();return db['ChatQueue'][_0x100d('0x33')]({'where':{'id':_0x47e775['params']['id']}})[_0x100d('0x17')](function(_0x41fed3){return db[_0x100d('0x5b')][_0x100d('0x5c')](function(_0x2a06a0){return _0x41fed3[_0x100d('0x61')](_0x47e775[_0x100d('0x28')][_0x100d('0x54')],{'transaction':_0x2a06a0})[_0x100d('0x17')](function(){if(!_[_0x100d('0x76')](_0x4e70de)){return _0x41fed3[_0x100d('0x77')](_0x4e70de,{'transaction':_0x2a06a0});}})[_0x100d('0x17')](function(){_0x4e70de['forEach'](function(_0x1f2170){socket['emit']('userChatQueue:remove',{'UserId':_0x1f2170,'ChatQueueId':_0x41fed3['id']});});});});});});})['then'](respondWithStatusCode(_0x422c32,null))[_0x100d('0x29')](handleError(_0x422c32,null));};exports['addAgents']=function(_0x58f4f6,_0x44489b){return db['ChatQueue'][_0x100d('0x33')]({'where':{'id':_0x58f4f6[_0x100d('0x3c')]['id']}})[_0x100d('0x17')](handleEntityNotFound(_0x44489b,null))['then'](function(_0x3dc6e5){if(_0x3dc6e5){return _0x3dc6e5['addAgents'](_0x58f4f6[_0x100d('0x35')][_0x100d('0x54')],_['omit'](_0x58f4f6[_0x100d('0x35')],[_0x100d('0x54'),'id'])||{})[_0x100d('0x78')](function(_0x23b5fd){for(var _0x406494=0x0;_0x406494<_0x58f4f6[_0x100d('0x35')]['ids']['length'];_0x406494+=0x1){socket[_0x100d('0x5f')](_0x100d('0x60'),{'UserId':Number(_0x58f4f6[_0x100d('0x35')][_0x100d('0x54')][_0x406494]),'ChatQueueId':Number(_0x58f4f6[_0x100d('0x3c')]['id'])});}return _0x23b5fd;});}})[_0x100d('0x17')](respondWithResult(_0x44489b,null))[_0x100d('0x29')](handleError(_0x44489b,null));};exports[_0x100d('0x77')]=function(_0x286890,_0x3e36d2){return db[_0x100d('0x26')][_0x100d('0x33')]({'where':{'id':_0x286890[_0x100d('0x3c')]['id']}})[_0x100d('0x17')](handleEntityNotFound(_0x3e36d2,null))[_0x100d('0x17')](function(_0xbd87ac){if(_0xbd87ac){return _0xbd87ac['removeAgents'](_0x286890['query'][_0x100d('0x54')])[_0x100d('0x17')](function(){if(_[_0x100d('0x79')](_0x286890['query'][_0x100d('0x54')])){for(var _0x4460c2=0x0;_0x4460c2<_0x286890[_0x100d('0x28')][_0x100d('0x54')]['length'];_0x4460c2+=0x1){socket[_0x100d('0x5f')]('userChatQueue:remove',{'UserId':Number(_0x286890[_0x100d('0x28')][_0x100d('0x54')][_0x4460c2]),'ChatQueueId':Number(_0x286890['params']['id'])});}}else{socket[_0x100d('0x5f')](_0x100d('0x7a'),{'UserId':Number(_0x286890[_0x100d('0x28')][_0x100d('0x54')]),'ChatQueueId':Number(_0x286890['params']['id'])});}});}})[_0x100d('0x17')](respondWithStatusCode(_0x3e36d2,null))[_0x100d('0x29')](handleError(_0x3e36d2,null));};exports['getAgents']=function(_0x1ecb7f,_0x10f477){var _0x497459={};var _0x2e2082={};var _0xfa9061;var _0x48b7ae;return db[_0x100d('0x26')][_0x100d('0x40')]({'where':{'id':_0x1ecb7f[_0x100d('0x3c')]['id']}})[_0x100d('0x17')](handleEntityNotFound(_0x10f477,null))[_0x100d('0x17')](function(_0x1e7ede){if(_0x1e7ede){_0xfa9061=_0x1e7ede;_0x2e2082[_0x100d('0x2b')]=_['keys'](db[_0x100d('0x55')][_0x100d('0x21')]);_0x2e2082[_0x100d('0x28')]=_[_0x100d('0x2c')](_0x1ecb7f[_0x100d('0x28')]);_0x2e2082['filters']=_[_0x100d('0x42')](_0x2e2082[_0x100d('0x2b')],_0x2e2082[_0x100d('0x28')]);_0x497459['attributes']=_['intersection'](_0x2e2082[_0x100d('0x2b')],qs['fields'](_0x1ecb7f[_0x100d('0x28')][_0x100d('0x2f')]));_0x497459['attributes']=_0x497459[_0x100d('0x2e')]['length']?_0x497459[_0x100d('0x2e')]:_0x2e2082[_0x100d('0x2b')];_0x497459[_0x100d('0x51')]=qs[_0x100d('0x45')](_0x1ecb7f[_0x100d('0x28')][_0x100d('0x45')]);_0x497459[_0x100d('0x25')]=qs['filters'](_[_0x100d('0x46')](_0x1ecb7f['query'],_0x2e2082[_0x100d('0x2d')]));if(_0x1ecb7f['query'][_0x100d('0x52')]){_0x497459[_0x100d('0x25')]=_[_0x100d('0x31')](_0x497459[_0x100d('0x25')],{'$or':_[_0x100d('0x20')](_0x497459['attributes'],function(_0x4590fc){var _0x56191b={};_0x56191b[_0x4590fc]={'$like':'%'+_0x1ecb7f['query']['filter']+'%'};return _0x56191b;})});}_0x497459=_[_0x100d('0x31')]({},_0x497459,_0x1ecb7f[_0x100d('0x32')]);return _0xfa9061['getAgents'](_0x497459);}})[_0x100d('0x17')](function(_0x430018){if(_0x430018){_0x48b7ae=_0x430018[_0x100d('0x30')];if(!_0x1ecb7f[_0x100d('0x28')][_0x100d('0x43')]('nolimit')){_0x497459[_0x100d('0x13')]=qs['limit'](_0x1ecb7f['query']['limit']);_0x497459[_0x100d('0x10')]=qs[_0x100d('0x10')](_0x1ecb7f[_0x100d('0x28')][_0x100d('0x10')]);}return _0xfa9061[_0x100d('0x7b')](_0x497459);}})[_0x100d('0x17')](function(_0x3106cd){if(_0x3106cd){return _0x3106cd?{'count':_0x48b7ae,'rows':_0x3106cd}:null;}})[_0x100d('0x17')](respondWithResult(_0x10f477,null))[_0x100d('0x29')](handleError(_0x10f477,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 0051bfd..a933d86 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 _0xb477=['update','emit','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x5bf35e,_0x4ccc17){var _0x35b3d7=function(_0xefa9e4){while(--_0xefa9e4){_0x5bf35e['push'](_0x5bf35e['shift']());}};_0x35b3d7(++_0x4ccc17);}(_0xb477,0xac));var _0x7b47=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb477[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0x7b47('0x0'));var ChatQueue=require(_0x7b47('0x1'))['db'][_0x7b47('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7b47('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7b47('0x4'),'afterDestroy':'remove'};function emitEvent(_0x304e64){return function(_0x515762,_0x30c8bc,_0x6736d7){ChatQueueEvents['emit'](_0x304e64+':'+_0x515762['id'],_0x515762);ChatQueueEvents[_0x7b47('0x5')](_0x304e64,_0x515762);_0x6736d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x7b47('0x6')](e,emitEvent(event));}}module[_0x7b47('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x1c7d=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3e7a7c,_0xdb5829){var _0x12a920=function(_0x58d313){while(--_0x58d313){_0x3e7a7c['push'](_0x3e7a7c['shift']());}};_0x12a920(++_0xdb5829);}(_0x1c7d,0x19a));var _0xd1c7=function(_0x16ace0,_0x5a64c8){_0x16ace0=_0x16ace0-0x0;var _0x2748d8=_0x1c7d[_0x16ace0];return _0x2748d8;};'use strict';var EventEmitter=require(_0xd1c7('0x0'));var ChatQueue=require(_0xd1c7('0x1'))['db'][_0xd1c7('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd1c7('0x3')](0x0);var events={'afterCreate':_0xd1c7('0x4'),'afterUpdate':_0xd1c7('0x5'),'afterDestroy':_0xd1c7('0x6')};function emitEvent(_0x54e009){return function(_0x3c7750,_0x1aa460,_0x555693){ChatQueueEvents[_0xd1c7('0x7')](_0x54e009+':'+_0x3c7750['id'],_0x3c7750);ChatQueueEvents[_0xd1c7('0x7')](_0x54e009,_0x3c7750);_0x555693(null);};}for(var e in events){if(events[_0xd1c7('0x8')](e)){var event=events[e];ChatQueue[_0xd1c7('0x9')](e,emitEvent(event));}}module[_0xd1c7('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 019f6c0..cdd963c 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 _0xf295=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xf295,0x1e6));var _0x5f29=function(_0x3a6606,_0x51bd1e){_0x3a6606=_0x3a6606-0x0;var _0x52299c=_0xf295[_0x3a6606];return _0x52299c;};'use strict';var _=require(_0x5f29('0x0'));var util=require(_0x5f29('0x1'));var logger=require(_0x5f29('0x2'))('api');var moment=require(_0x5f29('0x3'));var BPromise=require(_0x5f29('0x4'));var rp=require(_0x5f29('0x5'));var fs=require('fs');var path=require(_0x5f29('0x6'));var rimraf=require(_0x5f29('0x7'));var config=require(_0x5f29('0x8'));var attributes=require(_0x5f29('0x9'));module[_0x5f29('0xa')]=function(_0xe4eeb2,_0x4680c7){return _0xe4eeb2[_0x5f29('0xb')](_0x5f29('0xc'),attributes,{'tableName':_0x5f29('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec25=['./chatQueue.attributes','define','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xec25,0x190));var _0x5ec2=function(_0x1c4c3d,_0x219522){_0x1c4c3d=_0x1c4c3d-0x0;var _0x5833ce=_0xec25[_0x1c4c3d];return _0x5833ce;};'use strict';var _=require('lodash');var util=require(_0x5ec2('0x0'));var logger=require(_0x5ec2('0x1'))(_0x5ec2('0x2'));var moment=require(_0x5ec2('0x3'));var BPromise=require(_0x5ec2('0x4'));var rp=require(_0x5ec2('0x5'));var fs=require('fs');var path=require(_0x5ec2('0x6'));var rimraf=require(_0x5ec2('0x7'));var config=require('../../config/environment');var attributes=require(_0x5ec2('0x8'));module['exports']=function(_0x59a2a2,_0x28d87d){return _0x59a2a2[_0x5ec2('0x9')](_0x5ec2('0xa'),attributes,{'tableName':_0x5ec2('0xb'),'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 99d0e4b..09d6d73 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 _0x1527=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','GetChatQueue','ChatQueue','findAll','options','where','limit','include','map','model','attributes','stringify','ShowChatQueue','find','raw','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x447088,_0x17d62c){var _0x1c2fad=function(_0x3c3935){while(--_0x3c3935){_0x447088['push'](_0x447088['shift']());}};_0x1c2fad(++_0x17d62c);}(_0x1527,0xc1));var _0x7152=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0x1527[_0x419550];return _0x55f9ef;};'use strict';var _=require('lodash');var util=require(_0x7152('0x0'));var moment=require(_0x7152('0x1'));var BPromise=require(_0x7152('0x2'));var rs=require(_0x7152('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7152('0x4'));var logger=require(_0x7152('0x5'))('rpc');var config=require(_0x7152('0x6'));var jayson=require(_0x7152('0x7'));var client=jayson['client'][_0x7152('0x8')]({'port':0x232a});config[_0x7152('0x9')]=_[_0x7152('0xa')](config['redis'],{'host':_0x7152('0xb'),'port':0x18eb});var socket=require(_0x7152('0xc'))(new Redis(config[_0x7152('0x9')]));require(_0x7152('0xd'))[_0x7152('0xe')](socket);function respondWithRpcPromise(_0x37c291,_0x5750e6,_0x2eb53a){return new BPromise(function(_0x24b460,_0xb4f00f){return client[_0x7152('0xf')](_0x37c291,_0x2eb53a)[_0x7152('0x10')](function(_0x5cae05){logger[_0x7152('0x11')](_0x7152('0x12'),_0x5750e6,'request\x20sent');logger[_0x7152('0x13')](_0x7152('0x14'),_0x5750e6,'request\x20sent',JSON['stringify'](_0x5cae05));if(_0x5cae05['error']){if(_0x5cae05[_0x7152('0x15')][_0x7152('0x16')]===0x1f4){logger[_0x7152('0x15')]('ChatQueue,\x20%s,\x20%s',_0x5750e6,_0x5cae05['error'][_0x7152('0x17')]);return _0xb4f00f(_0x5cae05[_0x7152('0x15')][_0x7152('0x17')]);}logger['error'](_0x7152('0x12'),_0x5750e6,_0x5cae05[_0x7152('0x15')]['message']);return _0x24b460(_0x5cae05['error'][_0x7152('0x17')]);}else{logger['info'](_0x7152('0x12'),_0x5750e6,_0x7152('0x18'));_0x24b460(_0x5cae05['result']['message']);}})[_0x7152('0x19')](function(_0x3820dd){logger['error'](_0x7152('0x12'),_0x5750e6,_0x3820dd);_0xb4f00f(_0x3820dd);});});}exports[_0x7152('0x1a')]=function(_0x345426){var _0x4eacf9=this;return new Promise(function(_0x4bb541,_0x1720c9){return db[_0x7152('0x1b')][_0x7152('0x1c')]({'raw':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')][_0x7152('0x1e')]||null:null,'attributes':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')]['attributes']||null:null,'limit':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')][_0x7152('0x1f')]||null:null,'include':_0x345426[_0x7152('0x1d')]?_0x345426[_0x7152('0x1d')][_0x7152('0x20')]?_[_0x7152('0x21')](_0x345426[_0x7152('0x1d')]['include'],function(_0x4671bf){return{'model':db[_0x4671bf[_0x7152('0x22')]],'as':_0x4671bf['as'],'attributes':_0x4671bf[_0x7152('0x23')],'include':_0x4671bf[_0x7152('0x20')]?_[_0x7152('0x21')](_0x4671bf['include'],function(_0x286194){return{'model':db[_0x286194[_0x7152('0x22')]],'as':_0x286194['as'],'attributes':_0x286194[_0x7152('0x23')],'include':_0x286194[_0x7152('0x20')]?_[_0x7152('0x21')](_0x286194[_0x7152('0x20')],function(_0x51fb5c){return{'model':db[_0x51fb5c[_0x7152('0x22')]],'as':_0x51fb5c['as'],'attributes':_0x51fb5c[_0x7152('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7152('0x10')](function(_0x39ae3b){logger[_0x7152('0x11')](_0x7152('0x1a'),_0x345426);logger[_0x7152('0x13')](_0x7152('0x1a'),_0x345426,JSON[_0x7152('0x24')](_0x39ae3b));_0x4bb541(_0x39ae3b);})['catch'](function(_0x3c7fe1){logger[_0x7152('0x15')]('GetChatQueue',_0x3c7fe1[_0x7152('0x17')],_0x345426);_0x1720c9(_0x4eacf9[_0x7152('0x15')](0x1f4,_0x3c7fe1['message']));});});};exports[_0x7152('0x25')]=function(_0x143062){var _0x40056d=this;return new Promise(function(_0x5e3004,_0x145595){return db[_0x7152('0x1b')][_0x7152('0x26')]({'raw':_0x143062['options']?_0x143062['options'][_0x7152('0x27')]===undefined?!![]:![]:!![],'where':_0x143062[_0x7152('0x1d')]?_0x143062[_0x7152('0x1d')][_0x7152('0x1e')]||null:null,'attributes':_0x143062['options']?_0x143062[_0x7152('0x1d')][_0x7152('0x23')]||null:null,'include':_0x143062[_0x7152('0x1d')]?_0x143062[_0x7152('0x1d')][_0x7152('0x20')]?_[_0x7152('0x21')](_0x143062[_0x7152('0x1d')][_0x7152('0x20')],function(_0x3a7742){return{'model':db[_0x3a7742[_0x7152('0x22')]],'as':_0x3a7742['as'],'attributes':_0x3a7742['attributes'],'include':_0x3a7742[_0x7152('0x20')]?_['map'](_0x3a7742[_0x7152('0x20')],function(_0x1ec28c){return{'model':db[_0x1ec28c[_0x7152('0x22')]],'as':_0x1ec28c['as'],'attributes':_0x1ec28c[_0x7152('0x23')],'include':_0x1ec28c[_0x7152('0x20')]?_[_0x7152('0x21')](_0x1ec28c[_0x7152('0x20')],function(_0xab1618){return{'model':db[_0xab1618[_0x7152('0x22')]],'as':_0xab1618['as'],'attributes':_0xab1618[_0x7152('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7152('0x10')](function(_0x3e3061){logger[_0x7152('0x11')](_0x7152('0x25'),_0x143062);logger[_0x7152('0x13')](_0x7152('0x25'),_0x143062,JSON[_0x7152('0x24')](_0x3e3061));_0x5e3004(_0x3e3061);})[_0x7152('0x19')](function(_0x465101){logger[_0x7152('0x15')](_0x7152('0x25'),_0x465101[_0x7152('0x17')],_0x143062);_0x145595(_0x40056d[_0x7152('0x15')](0x1f4,_0x465101[_0x7152('0x17')]));});});}; \ No newline at end of file +var _0x3aee=['register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','ShowChatQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket'];(function(_0x22f9ac,_0x175405){var _0x4007bd=function(_0x593b50){while(--_0x593b50){_0x22f9ac['push'](_0x22f9ac['shift']());}};_0x4007bd(++_0x175405);}(_0x3aee,0x131));var _0xe3ae=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x3aee[_0x4c3ffe];return _0x28d3eb;};'use strict';var _=require(_0xe3ae('0x0'));var util=require(_0xe3ae('0x1'));var moment=require('moment');var BPromise=require(_0xe3ae('0x2'));var rs=require(_0xe3ae('0x3'));var fs=require('fs');var Redis=require(_0xe3ae('0x4'));var db=require(_0xe3ae('0x5'))['db'];var utils=require(_0xe3ae('0x6'));var logger=require(_0xe3ae('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe3ae('0x8'));var client=jayson[_0xe3ae('0x9')][_0xe3ae('0xa')]({'port':0x232a});config[_0xe3ae('0xb')]=_[_0xe3ae('0xc')](config[_0xe3ae('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3ae('0xd'))(new Redis(config['redis']));require(_0xe3ae('0xe'))[_0xe3ae('0xf')](socket);function respondWithRpcPromise(_0x239b6c,_0x5caa0c,_0x546247){return new BPromise(function(_0x5da465,_0x31b80b){return client[_0xe3ae('0x10')](_0x239b6c,_0x546247)[_0xe3ae('0x11')](function(_0x40171b){logger[_0xe3ae('0x12')](_0xe3ae('0x13'),_0x5caa0c,'request\x20sent');logger['debug'](_0xe3ae('0x14'),_0x5caa0c,_0xe3ae('0x15'),JSON['stringify'](_0x40171b));if(_0x40171b['error']){if(_0x40171b[_0xe3ae('0x16')]['code']===0x1f4){logger[_0xe3ae('0x16')](_0xe3ae('0x13'),_0x5caa0c,_0x40171b[_0xe3ae('0x16')][_0xe3ae('0x17')]);return _0x31b80b(_0x40171b[_0xe3ae('0x16')]['message']);}logger[_0xe3ae('0x16')](_0xe3ae('0x13'),_0x5caa0c,_0x40171b['error'][_0xe3ae('0x17')]);return _0x5da465(_0x40171b[_0xe3ae('0x16')][_0xe3ae('0x17')]);}else{logger['info'](_0xe3ae('0x13'),_0x5caa0c,_0xe3ae('0x15'));_0x5da465(_0x40171b['result'][_0xe3ae('0x17')]);}})['catch'](function(_0x3522c0){logger[_0xe3ae('0x16')](_0xe3ae('0x13'),_0x5caa0c,_0x3522c0);_0x31b80b(_0x3522c0);});});}exports[_0xe3ae('0x18')]=function(_0x2272c0){var _0x280266=this;return new Promise(function(_0x5dba66,_0x48743e){return db[_0xe3ae('0x19')][_0xe3ae('0x1a')]({'raw':_0x2272c0[_0xe3ae('0x1b')]?_0x2272c0['options'][_0xe3ae('0x1c')]===undefined?!![]:![]:!![],'where':_0x2272c0[_0xe3ae('0x1b')]?_0x2272c0[_0xe3ae('0x1b')][_0xe3ae('0x1d')]||null:null,'attributes':_0x2272c0[_0xe3ae('0x1b')]?_0x2272c0[_0xe3ae('0x1b')][_0xe3ae('0x1e')]||null:null,'limit':_0x2272c0[_0xe3ae('0x1b')]?_0x2272c0[_0xe3ae('0x1b')][_0xe3ae('0x1f')]||null:null,'include':_0x2272c0['options']?_0x2272c0[_0xe3ae('0x1b')][_0xe3ae('0x20')]?_[_0xe3ae('0x21')](_0x2272c0['options'][_0xe3ae('0x20')],function(_0x2eaeed){return{'model':db[_0x2eaeed[_0xe3ae('0x22')]],'as':_0x2eaeed['as'],'attributes':_0x2eaeed[_0xe3ae('0x1e')],'include':_0x2eaeed['include']?_[_0xe3ae('0x21')](_0x2eaeed[_0xe3ae('0x20')],function(_0x437a51){return{'model':db[_0x437a51[_0xe3ae('0x22')]],'as':_0x437a51['as'],'attributes':_0x437a51['attributes'],'include':_0x437a51['include']?_[_0xe3ae('0x21')](_0x437a51[_0xe3ae('0x20')],function(_0x2ed03a){return{'model':db[_0x2ed03a['model']],'as':_0x2ed03a['as'],'attributes':_0x2ed03a[_0xe3ae('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d4f53){logger['info'](_0xe3ae('0x18'),_0x2272c0);logger[_0xe3ae('0x23')](_0xe3ae('0x18'),_0x2272c0,JSON[_0xe3ae('0x24')](_0x3d4f53));_0x5dba66(_0x3d4f53);})[_0xe3ae('0x25')](function(_0x99520e){logger[_0xe3ae('0x16')](_0xe3ae('0x18'),_0x99520e[_0xe3ae('0x17')],_0x2272c0);_0x48743e(_0x280266[_0xe3ae('0x16')](0x1f4,_0x99520e[_0xe3ae('0x17')]));});});};exports[_0xe3ae('0x26')]=function(_0x2e2147){var _0x265f8e=this;return new Promise(function(_0x4c71fc,_0xabf9f7){return db[_0xe3ae('0x19')][_0xe3ae('0x27')]({'raw':_0x2e2147['options']?_0x2e2147['options'][_0xe3ae('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e2147['options']?_0x2e2147[_0xe3ae('0x1b')][_0xe3ae('0x1d')]||null:null,'attributes':_0x2e2147[_0xe3ae('0x1b')]?_0x2e2147['options'][_0xe3ae('0x1e')]||null:null,'include':_0x2e2147[_0xe3ae('0x1b')]?_0x2e2147[_0xe3ae('0x1b')][_0xe3ae('0x20')]?_[_0xe3ae('0x21')](_0x2e2147[_0xe3ae('0x1b')]['include'],function(_0x269f4a){return{'model':db[_0x269f4a[_0xe3ae('0x22')]],'as':_0x269f4a['as'],'attributes':_0x269f4a[_0xe3ae('0x1e')],'include':_0x269f4a[_0xe3ae('0x20')]?_[_0xe3ae('0x21')](_0x269f4a['include'],function(_0x5b474f){return{'model':db[_0x5b474f[_0xe3ae('0x22')]],'as':_0x5b474f['as'],'attributes':_0x5b474f[_0xe3ae('0x1e')],'include':_0x5b474f[_0xe3ae('0x20')]?_[_0xe3ae('0x21')](_0x5b474f[_0xe3ae('0x20')],function(_0x1ed112){return{'model':db[_0x1ed112[_0xe3ae('0x22')]],'as':_0x1ed112['as'],'attributes':_0x1ed112[_0xe3ae('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe3ae('0x11')](function(_0x4ad4aa){logger[_0xe3ae('0x12')]('ShowChatQueue',_0x2e2147);logger[_0xe3ae('0x23')](_0xe3ae('0x26'),_0x2e2147,JSON[_0xe3ae('0x24')](_0x4ad4aa));_0x4c71fc(_0x4ad4aa);})[_0xe3ae('0x25')](function(_0x255235){logger[_0xe3ae('0x16')](_0xe3ae('0x26'),_0x255235['message'],_0x2e2147);_0xabf9f7(_0x265f8e[_0xe3ae('0x16')](0x1f4,_0x255235[_0xe3ae('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index dc654a1..ac5e6db 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 _0x57d4=['length','./chatQueue.events','save','update','emit','removeListener','register'];(function(_0xc4e8b1,_0x5982d1){var _0x53cad3=function(_0x24f6c3){while(--_0x24f6c3){_0xc4e8b1['push'](_0xc4e8b1['shift']());}};_0x53cad3(++_0x5982d1);}(_0x57d4,0x78));var _0x457d=function(_0x44b381,_0x324dad){_0x44b381=_0x44b381-0x0;var _0x4b100f=_0x57d4[_0x44b381];return _0x4b100f;};'use strict';var ChatQueueEvents=require(_0x457d('0x0'));var events=[_0x457d('0x1'),'remove',_0x457d('0x2')];function createListener(_0xa408c8,_0x1e26ab){return function(_0x30a25c){_0x1e26ab[_0x457d('0x3')](_0xa408c8,_0x30a25c);};}function removeListener(_0x3c89b2,_0x3e2239){return function(){ChatQueueEvents[_0x457d('0x4')](_0x3c89b2,_0x3e2239);};}exports[_0x457d('0x5')]=function(_0x247ec7){for(var _0x3fd867=0x0,_0x5c6816=events[_0x457d('0x6')];_0x3fd867<_0x5c6816;_0x3fd867++){var _0x381e22=events[_0x3fd867];var _0x4e32c0=createListener('chatQueue:'+_0x381e22,_0x247ec7);ChatQueueEvents['on'](_0x381e22,_0x4e32c0);}}; \ No newline at end of file +var _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x3da233,_0x3d5810){var _0xbba6b7=function(_0x4142fa){while(--_0x4142fa){_0x3da233['push'](_0x3da233['shift']());}};_0xbba6b7(++_0x3d5810);}(_0xcb99,0x8b));var _0x9cb9=function(_0x1671c7,_0x36f775){_0x1671c7=_0x1671c7-0x0;var _0x160b76=_0xcb99[_0x1671c7];return _0x160b76;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a0a95b9..21f6b8b 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0x5fc3[_0x4996d5];return _0x4793f9;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x501f4d,_0x51b9d9){var _0x199d85=function(_0x4c8370){while(--_0x4c8370){_0x501f4d['push'](_0x501f4d['shift']());}};_0x199d85(++_0x51b9d9);}(_0x55ca,0x126));var _0xa55c=function(_0x38b3cb,_0x4ad7b3){_0x38b3cb=_0x38b3cb-0x0;var _0x5a9a84=_0x55ca[_0x38b3cb];return _0x5a9a84;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f5ca7a5..25107f0 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 _0xa07c=['STRING','DATE','moment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa07c,0x11e));var _0xca07=function(_0x4279c9,_0x1fdbaa){_0x4279c9=_0x4279c9-0x0;var _0x46975c=_0xa07c[_0x4279c9];return _0x46975c;};'use strict';var moment=require(_0xca07('0x0'));var Sequelize=require('sequelize');module[_0xca07('0x1')]={'uniqueid':{'type':Sequelize[_0xca07('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xca07('0x2')]},'joinAt':{'type':Sequelize[_0xca07('0x3')]},'leaveAt':{'type':Sequelize[_0xca07('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xca07('0x3')]},'reason':{'type':Sequelize[_0xca07('0x2')]}}; \ No newline at end of file +var _0xe588=['DATE','moment','sequelize','STRING'];(function(_0x576554,_0x9c1a31){var _0x354a86=function(_0xaddcca){while(--_0xaddcca){_0x576554['push'](_0x576554['shift']());}};_0x354a86(++_0x9c1a31);}(_0xe588,0xe1));var _0x8e58=function(_0x5224c5,_0x18ef01){_0x5224c5=_0x5224c5-0x0;var _0x1935cf=_0xe588[_0x5224c5];return _0x1935cf;};'use strict';var moment=require(_0x8e58('0x0'));var Sequelize=require(_0x8e58('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8e58('0x2')]},'joinAt':{'type':Sequelize[_0x8e58('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8e58('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8d5c3ad..a8dc854 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 _0x3dba=['reject','save','update','then','destroy','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','filters','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0x3dba,0x73));var _0xa3db=function(_0x2904a8,_0x73180){_0x2904a8=_0x2904a8-0x0;var _0x4aae50=_0x3dba[_0x2904a8];return _0x4aae50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa3db('0x0'));var rp=require(_0xa3db('0x1'));var moment=require('moment');var BPromise=require(_0xa3db('0x2'));var Mustache=require(_0xa3db('0x3'));var util=require(_0xa3db('0x4'));var path=require(_0xa3db('0x5'));var sox=require(_0xa3db('0x6'));var csv=require(_0xa3db('0x7'));var ejs=require(_0xa3db('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa3db('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa3db('0xa'));var Redis=require(_0xa3db('0xb'));var authService=require(_0xa3db('0xc'));var qs=require(_0xa3db('0xd'));var as=require(_0xa3db('0xe'));var hardwareService=require(_0xa3db('0xf'));var logger=require(_0xa3db('0x10'))(_0xa3db('0x11'));var utils=require(_0xa3db('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa3db('0x13'));var db=require(_0xa3db('0x14'))['db'];function respondWithStatusCode(_0x56c636,_0x20f91f){_0x20f91f=_0x20f91f||0xcc;return function(_0x42f8e0){if(_0x42f8e0){return _0x56c636[_0xa3db('0x15')](_0x20f91f);}return _0x56c636['status'](_0x20f91f)['end']();};}function respondWithResult(_0x221695,_0x302c34){_0x302c34=_0x302c34||0xc8;return function(_0x4f323b){if(_0x4f323b){return _0x221695[_0xa3db('0x16')](_0x302c34)[_0xa3db('0x17')](_0x4f323b);}};}function respondWithFilteredResult(_0xb75bcc,_0x1d07c5){return function(_0xaa5756){if(_0xaa5756){var _0xd53611=typeof _0x1d07c5[_0xa3db('0x18')]===_0xa3db('0x19')&&typeof _0x1d07c5[_0xa3db('0x1a')]==='undefined';var _0x558581=_0xaa5756[_0xa3db('0x1b')];var _0x278c2a=_0xd53611?0x0:_0x1d07c5[_0xa3db('0x18')];var _0x3f5e3e=_0xd53611?_0xaa5756['count']:_0x1d07c5[_0xa3db('0x18')]+_0x1d07c5[_0xa3db('0x1a')];var _0x356f63;if(_0x3f5e3e>=_0x558581){_0x3f5e3e=_0x558581;_0x356f63=0xc8;}else{_0x356f63=0xce;}_0xb75bcc[_0xa3db('0x16')](_0x356f63);return _0xb75bcc[_0xa3db('0x1c')](_0xa3db('0x1d'),_0x278c2a+'-'+_0x3f5e3e+'/'+_0x558581)[_0xa3db('0x17')](_0xaa5756);}return null;};}function patchUpdates(_0x2c817c){return function(_0x1eee9e){try{jsonpatch[_0xa3db('0x1e')](_0x1eee9e,_0x2c817c,!![]);}catch(_0x2581e2){return BPromise[_0xa3db('0x1f')](_0x2581e2);}return _0x1eee9e[_0xa3db('0x20')]();};}function saveUpdates(_0x5de05c,_0x195f57){return function(_0x16bc03){if(_0x16bc03){return _0x16bc03[_0xa3db('0x21')](_0x5de05c)[_0xa3db('0x22')](function(_0x989eed){return _0x989eed;});}return null;};}function removeEntity(_0x55a7cf,_0x3eab0c){return function(_0x49bc1b){if(_0x49bc1b){return _0x49bc1b[_0xa3db('0x23')]()[_0xa3db('0x22')](function(){_0x55a7cf['status'](0xcc)[_0xa3db('0x24')]();});}};}function handleEntityNotFound(_0xe0be83,_0x415d61){return function(_0x5e71f2){if(!_0x5e71f2){_0xe0be83[_0xa3db('0x15')](0x194);}return _0x5e71f2;};}function handleError(_0x374d03,_0x34f314){_0x34f314=_0x34f314||0x1f4;return function(_0x1f0d0e){logger[_0xa3db('0x25')](_0x1f0d0e['stack']);if(_0x1f0d0e[_0xa3db('0x26')]){delete _0x1f0d0e[_0xa3db('0x26')];}_0x374d03[_0xa3db('0x16')](_0x34f314)[_0xa3db('0x27')](_0x1f0d0e);};}exports[_0xa3db('0x28')]=function(_0x2f8602,_0x2f08da){var _0x3416bc={},_0x19a858={},_0x2ecde3={'count':0x0,'rows':[]};var _0x52578a=_[_0xa3db('0x29')](db[_0xa3db('0x2a')][_0xa3db('0x2b')],function(_0x551010){return{'name':_0x551010[_0xa3db('0x2c')],'type':_0x551010[_0xa3db('0x2d')]['key']};});_0x19a858[_0xa3db('0x2e')]=_[_0xa3db('0x29')](_0x52578a,_0xa3db('0x26'));_0x19a858['query']=_[_0xa3db('0x2f')](_0x2f8602[_0xa3db('0x30')]);_0x19a858['filters']=_['intersection'](_0x19a858[_0xa3db('0x2e')],_0x19a858[_0xa3db('0x30')]);_0x3416bc[_0xa3db('0x31')]=_[_0xa3db('0x32')](_0x19a858[_0xa3db('0x2e')],qs[_0xa3db('0x33')](_0x2f8602[_0xa3db('0x30')][_0xa3db('0x33')]));_0x3416bc['attributes']=_0x3416bc[_0xa3db('0x31')]['length']?_0x3416bc[_0xa3db('0x31')]:_0x19a858[_0xa3db('0x2e')];if(!_0x2f8602[_0xa3db('0x30')][_0xa3db('0x34')](_0xa3db('0x35'))){_0x3416bc[_0xa3db('0x1a')]=qs[_0xa3db('0x1a')](_0x2f8602[_0xa3db('0x30')]['limit']);_0x3416bc[_0xa3db('0x18')]=qs[_0xa3db('0x18')](_0x2f8602[_0xa3db('0x30')]['offset']);}_0x3416bc[_0xa3db('0x36')]=qs[_0xa3db('0x37')](_0x2f8602[_0xa3db('0x30')][_0xa3db('0x37')]);_0x3416bc[_0xa3db('0x38')]=qs['filters'](_[_0xa3db('0x39')](_0x2f8602['query'],_0x19a858['filters']),_0x52578a);if(_0x2f8602[_0xa3db('0x30')][_0xa3db('0x3a')]){_0x3416bc[_0xa3db('0x38')]=_[_0xa3db('0x3b')](_0x3416bc[_0xa3db('0x38')],{'$or':_[_0xa3db('0x29')](_0x52578a,function(_0xa3b488){if(_0xa3b488[_0xa3db('0x2d')]!==_0xa3db('0x3c')){var _0x23c94b={};_0x23c94b[_0xa3b488[_0xa3db('0x26')]]={'$like':'%'+_0x2f8602[_0xa3db('0x30')]['filter']+'%'};return _0x23c94b;}})});}_0x3416bc=_[_0xa3db('0x3b')]({},_0x3416bc,_0x2f8602[_0xa3db('0x3d')]);var _0xe24bd1={'where':_0x3416bc[_0xa3db('0x38')]};return db[_0xa3db('0x2a')]['count'](_0xe24bd1)['then'](function(_0x414745){_0x2ecde3[_0xa3db('0x1b')]=_0x414745;if(_0x2f8602[_0xa3db('0x30')][_0xa3db('0x3e')]){_0x3416bc[_0xa3db('0x3f')]=[{'all':!![]}];}return db[_0xa3db('0x2a')][_0xa3db('0x40')](_0x3416bc);})[_0xa3db('0x22')](function(_0x57350f){_0x2ecde3['rows']=_0x57350f;return _0x2ecde3;})[_0xa3db('0x22')](respondWithFilteredResult(_0x2f08da,_0x3416bc))[_0xa3db('0x41')](handleError(_0x2f08da,null));};exports[_0xa3db('0x42')]=function(_0x4ef9d1,_0x4cf5e8){var _0x3d612d={'raw':!![],'where':{'id':_0x4ef9d1[_0xa3db('0x43')]['id']}},_0x47e625={};_0x47e625['model']=_[_0xa3db('0x2f')](db[_0xa3db('0x2a')][_0xa3db('0x2b')]);_0x47e625[_0xa3db('0x30')]=_[_0xa3db('0x2f')](_0x4ef9d1[_0xa3db('0x30')]);_0x47e625[_0xa3db('0x44')]=_['intersection'](_0x47e625[_0xa3db('0x2e')],_0x47e625[_0xa3db('0x30')]);_0x3d612d[_0xa3db('0x31')]=_[_0xa3db('0x32')](_0x47e625['model'],qs[_0xa3db('0x33')](_0x4ef9d1['query'][_0xa3db('0x33')]));_0x3d612d[_0xa3db('0x31')]=_0x3d612d['attributes']['length']?_0x3d612d[_0xa3db('0x31')]:_0x47e625['model'];if(_0x4ef9d1[_0xa3db('0x30')][_0xa3db('0x3e')]){_0x3d612d[_0xa3db('0x3f')]=[{'all':!![]}];}_0x3d612d=_[_0xa3db('0x3b')]({},_0x3d612d,_0x4ef9d1['options']);return db[_0xa3db('0x2a')][_0xa3db('0x45')](_0x3d612d)[_0xa3db('0x22')](handleEntityNotFound(_0x4cf5e8,null))[_0xa3db('0x22')](respondWithResult(_0x4cf5e8,null))[_0xa3db('0x41')](handleError(_0x4cf5e8,null));};exports[_0xa3db('0x46')]=function(_0x572bbf,_0x3cb6c0){return db[_0xa3db('0x2a')]['create'](_0x572bbf[_0xa3db('0x47')],{})['then'](respondWithResult(_0x3cb6c0,0xc9))[_0xa3db('0x41')](handleError(_0x3cb6c0,null));};exports[_0xa3db('0x21')]=function(_0x2207e9,_0x4b55a9){if(_0x2207e9[_0xa3db('0x47')]['id']){delete _0x2207e9[_0xa3db('0x47')]['id'];}return db[_0xa3db('0x2a')][_0xa3db('0x45')]({'where':{'id':_0x2207e9['params']['id']}})[_0xa3db('0x22')](handleEntityNotFound(_0x4b55a9,null))[_0xa3db('0x22')](saveUpdates(_0x2207e9[_0xa3db('0x47')],null))[_0xa3db('0x22')](respondWithResult(_0x4b55a9,null))[_0xa3db('0x41')](handleError(_0x4b55a9,null));};exports[_0xa3db('0x23')]=function(_0x40a45b,_0x3f2463){return db['ChatQueueReport']['find']({'where':{'id':_0x40a45b[_0xa3db('0x43')]['id']}})[_0xa3db('0x22')](handleEntityNotFound(_0x3f2463,null))[_0xa3db('0x22')](removeEntity(_0x3f2463,null))[_0xa3db('0x41')](handleError(_0x3f2463,null));};exports['describe']=function(_0x8d54e9,_0x40c6cd){return db[_0xa3db('0x2a')][_0xa3db('0x48')]()[_0xa3db('0x22')](respondWithResult(_0x40c6cd,null))['catch'](handleError(_0x40c6cd,null));}; \ No newline at end of file +var _0xdded=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','include','findAll','catch','show','params','length','includeAll','merge','options','find','create','body','describe','eml-format','rimraf'];(function(_0x1945b3,_0x59902a){var _0x5de191=function(_0x3d986b){while(--_0x3d986b){_0x1945b3['push'](_0x1945b3['shift']());}};_0x5de191(++_0x59902a);}(_0xdded,0x17a));var _0xddde=function(_0x442153,_0x4872a3){_0x442153=_0x442153-0x0;var _0x34df53=_0xdded[_0x442153];return _0x34df53;};'use strict';var emlformat=require(_0xddde('0x0'));var rimraf=require(_0xddde('0x1'));var zipdir=require(_0xddde('0x2'));var jsonpatch=require(_0xddde('0x3'));var rp=require(_0xddde('0x4'));var moment=require(_0xddde('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddde('0x6'));var util=require(_0xddde('0x7'));var path=require(_0xddde('0x8'));var sox=require(_0xddde('0x9'));var csv=require(_0xddde('0xa'));var ejs=require(_0xddde('0xb'));var fs=require('fs');var fs_extra=require(_0xddde('0xc'));var _=require(_0xddde('0xd'));var squel=require(_0xddde('0xe'));var crypto=require(_0xddde('0xf'));var jsforce=require(_0xddde('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xddde('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddde('0x13'))(_0xddde('0x14'));var utils=require(_0xddde('0x15'));var config=require(_0xddde('0x16'));var licenseUtil=require(_0xddde('0x17'));var db=require(_0xddde('0x18'))['db'];function respondWithStatusCode(_0x25fadc,_0x35172e){_0x35172e=_0x35172e||0xcc;return function(_0x57e121){if(_0x57e121){return _0x25fadc[_0xddde('0x19')](_0x35172e);}return _0x25fadc[_0xddde('0x1a')](_0x35172e)[_0xddde('0x1b')]();};}function respondWithResult(_0x860ff4,_0x7cbcee){_0x7cbcee=_0x7cbcee||0xc8;return function(_0x31c111){if(_0x31c111){return _0x860ff4['status'](_0x7cbcee)[_0xddde('0x1c')](_0x31c111);}};}function respondWithFilteredResult(_0xbe1df5,_0x3698d4){return function(_0x48f602){if(_0x48f602){var _0x5de7ce=typeof _0x3698d4[_0xddde('0x1d')]==='undefined'&&typeof _0x3698d4[_0xddde('0x1e')]===_0xddde('0x1f');var _0x338fa7=_0x48f602[_0xddde('0x20')];var _0x2f0e58=_0x5de7ce?0x0:_0x3698d4['offset'];var _0x249f19=_0x5de7ce?_0x48f602[_0xddde('0x20')]:_0x3698d4['offset']+_0x3698d4[_0xddde('0x1e')];var _0x1185f9;if(_0x249f19>=_0x338fa7){_0x249f19=_0x338fa7;_0x1185f9=0xc8;}else{_0x1185f9=0xce;}_0xbe1df5['status'](_0x1185f9);return _0xbe1df5['set'](_0xddde('0x21'),_0x2f0e58+'-'+_0x249f19+'/'+_0x338fa7)['json'](_0x48f602);}return null;};}function patchUpdates(_0x1ef35a){return function(_0x5175bd){try{jsonpatch[_0xddde('0x22')](_0x5175bd,_0x1ef35a,!![]);}catch(_0xea045b){return BPromise['reject'](_0xea045b);}return _0x5175bd['save']();};}function saveUpdates(_0x3cfd91,_0x107bca){return function(_0x97bb0f){if(_0x97bb0f){return _0x97bb0f[_0xddde('0x23')](_0x3cfd91)[_0xddde('0x24')](function(_0xa663e4){return _0xa663e4;});}return null;};}function removeEntity(_0x3bc4bf,_0x56a33a){return function(_0x59320f){if(_0x59320f){return _0x59320f[_0xddde('0x25')]()[_0xddde('0x24')](function(){_0x3bc4bf[_0xddde('0x1a')](0xcc)[_0xddde('0x1b')]();});}};}function handleEntityNotFound(_0xdb57ef,_0x533332){return function(_0x394da0){if(!_0x394da0){_0xdb57ef[_0xddde('0x19')](0x194);}return _0x394da0;};}function handleError(_0x4ca351,_0x4bd409){_0x4bd409=_0x4bd409||0x1f4;return function(_0xa60e85){logger[_0xddde('0x26')](_0xa60e85['stack']);if(_0xa60e85[_0xddde('0x27')]){delete _0xa60e85[_0xddde('0x27')];}_0x4ca351['status'](_0x4bd409)[_0xddde('0x28')](_0xa60e85);};}exports[_0xddde('0x29')]=function(_0x2dd131,_0x32be0f){var _0x477d44={},_0xb5d4b6={},_0x450bac={'count':0x0,'rows':[]};var _0x7c0c18=_[_0xddde('0x2a')](db[_0xddde('0x2b')][_0xddde('0x2c')],function(_0x1ff3e2){return{'name':_0x1ff3e2[_0xddde('0x2d')],'type':_0x1ff3e2[_0xddde('0x2e')][_0xddde('0x2f')]};});_0xb5d4b6[_0xddde('0x30')]=_[_0xddde('0x2a')](_0x7c0c18,_0xddde('0x27'));_0xb5d4b6[_0xddde('0x31')]=_[_0xddde('0x32')](_0x2dd131['query']);_0xb5d4b6['filters']=_[_0xddde('0x33')](_0xb5d4b6[_0xddde('0x30')],_0xb5d4b6[_0xddde('0x31')]);_0x477d44['attributes']=_['intersection'](_0xb5d4b6[_0xddde('0x30')],qs[_0xddde('0x34')](_0x2dd131[_0xddde('0x31')][_0xddde('0x34')]));_0x477d44['attributes']=_0x477d44[_0xddde('0x35')]['length']?_0x477d44[_0xddde('0x35')]:_0xb5d4b6[_0xddde('0x30')];if(!_0x2dd131[_0xddde('0x31')][_0xddde('0x36')](_0xddde('0x37'))){_0x477d44[_0xddde('0x1e')]=qs[_0xddde('0x1e')](_0x2dd131[_0xddde('0x31')][_0xddde('0x1e')]);_0x477d44[_0xddde('0x1d')]=qs[_0xddde('0x1d')](_0x2dd131[_0xddde('0x31')]['offset']);}_0x477d44[_0xddde('0x38')]=qs[_0xddde('0x39')](_0x2dd131['query']['sort']);_0x477d44['where']=qs[_0xddde('0x3a')](_[_0xddde('0x3b')](_0x2dd131[_0xddde('0x31')],_0xb5d4b6[_0xddde('0x3a')]),_0x7c0c18);if(_0x2dd131[_0xddde('0x31')][_0xddde('0x3c')]){_0x477d44[_0xddde('0x3d')]=_['merge'](_0x477d44['where'],{'$or':_[_0xddde('0x2a')](_0x7c0c18,function(_0x5595a7){if(_0x5595a7[_0xddde('0x2e')]!==_0xddde('0x3e')){var _0x4c356a={};_0x4c356a[_0x5595a7[_0xddde('0x27')]]={'$like':'%'+_0x2dd131[_0xddde('0x31')][_0xddde('0x3c')]+'%'};return _0x4c356a;}})});}_0x477d44=_['merge']({},_0x477d44,_0x2dd131['options']);var _0x434868={'where':_0x477d44['where']};return db[_0xddde('0x2b')][_0xddde('0x20')](_0x434868)[_0xddde('0x24')](function(_0x216b12){_0x450bac[_0xddde('0x20')]=_0x216b12;if(_0x2dd131[_0xddde('0x31')]['includeAll']){_0x477d44[_0xddde('0x3f')]=[{'all':!![]}];}return db[_0xddde('0x2b')][_0xddde('0x40')](_0x477d44);})[_0xddde('0x24')](function(_0x10d9d3){_0x450bac['rows']=_0x10d9d3;return _0x450bac;})[_0xddde('0x24')](respondWithFilteredResult(_0x32be0f,_0x477d44))[_0xddde('0x41')](handleError(_0x32be0f,null));};exports[_0xddde('0x42')]=function(_0x3a52b5,_0x21b469){var _0xb0c016={'raw':!![],'where':{'id':_0x3a52b5[_0xddde('0x43')]['id']}},_0x6cbadb={};_0x6cbadb[_0xddde('0x30')]=_['keys'](db[_0xddde('0x2b')]['rawAttributes']);_0x6cbadb[_0xddde('0x31')]=_[_0xddde('0x32')](_0x3a52b5['query']);_0x6cbadb[_0xddde('0x3a')]=_[_0xddde('0x33')](_0x6cbadb[_0xddde('0x30')],_0x6cbadb['query']);_0xb0c016['attributes']=_['intersection'](_0x6cbadb[_0xddde('0x30')],qs[_0xddde('0x34')](_0x3a52b5[_0xddde('0x31')][_0xddde('0x34')]));_0xb0c016['attributes']=_0xb0c016[_0xddde('0x35')][_0xddde('0x44')]?_0xb0c016[_0xddde('0x35')]:_0x6cbadb['model'];if(_0x3a52b5[_0xddde('0x31')][_0xddde('0x45')]){_0xb0c016[_0xddde('0x3f')]=[{'all':!![]}];}_0xb0c016=_[_0xddde('0x46')]({},_0xb0c016,_0x3a52b5[_0xddde('0x47')]);return db['ChatQueueReport'][_0xddde('0x48')](_0xb0c016)['then'](handleEntityNotFound(_0x21b469,null))[_0xddde('0x24')](respondWithResult(_0x21b469,null))['catch'](handleError(_0x21b469,null));};exports[_0xddde('0x49')]=function(_0x3c3c6c,_0x1db505){return db[_0xddde('0x2b')][_0xddde('0x49')](_0x3c3c6c[_0xddde('0x4a')],{})[_0xddde('0x24')](respondWithResult(_0x1db505,0xc9))[_0xddde('0x41')](handleError(_0x1db505,null));};exports['update']=function(_0x3ad9b6,_0x1b4a00){if(_0x3ad9b6[_0xddde('0x4a')]['id']){delete _0x3ad9b6[_0xddde('0x4a')]['id'];}return db[_0xddde('0x2b')][_0xddde('0x48')]({'where':{'id':_0x3ad9b6['params']['id']}})[_0xddde('0x24')](handleEntityNotFound(_0x1b4a00,null))[_0xddde('0x24')](saveUpdates(_0x3ad9b6[_0xddde('0x4a')],null))[_0xddde('0x24')](respondWithResult(_0x1b4a00,null))[_0xddde('0x41')](handleError(_0x1b4a00,null));};exports['destroy']=function(_0x2a8537,_0x42a325){return db[_0xddde('0x2b')][_0xddde('0x48')]({'where':{'id':_0x2a8537[_0xddde('0x43')]['id']}})[_0xddde('0x24')](handleEntityNotFound(_0x42a325,null))[_0xddde('0x24')](removeEntity(_0x42a325,null))[_0xddde('0x41')](handleError(_0x42a325,null));};exports[_0xddde('0x4b')]=function(_0xff548d,_0x43fcf6){return db[_0xddde('0x2b')][_0xddde('0x4b')]()[_0xddde('0x24')](respondWithResult(_0x43fcf6,null))[_0xddde('0x41')](handleError(_0x43fcf6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 68f40aa..99466c9 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(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_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(_0x1bf713,_0x2a079b){var _0x4b2b7b=function(_0x25f828){while(--_0x25f828){_0x1bf713['push'](_0x1bf713['shift']());}};_0x4b2b7b(++_0x2a079b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xb7e7[_0x4d8ed9];return _0x1e2140;};'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 cf5e98d..10fef0d 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 _0xceab=['info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','create','body','raw','UpdateChatQueueReport','ChatQueueReport','options','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0xae31e,_0x4280ae){var _0x27e138=function(_0x16ba29){while(--_0x16ba29){_0xae31e['push'](_0xae31e['shift']());}};_0x27e138(++_0x4280ae);}(_0xceab,0x93));var _0xbcea=function(_0xdec08d,_0x256596){_0xdec08d=_0xdec08d-0x0;var _0x113186=_0xceab[_0xdec08d];return _0x113186;};'use strict';var _=require(_0xbcea('0x0'));var util=require(_0xbcea('0x1'));var moment=require(_0xbcea('0x2'));var BPromise=require(_0xbcea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcea('0x4'))['db'];var utils=require(_0xbcea('0x5'));var logger=require(_0xbcea('0x6'))(_0xbcea('0x7'));var config=require(_0xbcea('0x8'));var jayson=require(_0xbcea('0x9'));var client=jayson[_0xbcea('0xa')][_0xbcea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a47d8,_0x30e93d,_0xae8b91){return new BPromise(function(_0x261657,_0x2383f2){return client['request'](_0x5a47d8,_0xae8b91)[_0xbcea('0xc')](function(_0x2c4930){logger[_0xbcea('0xd')](_0xbcea('0xe'),_0x30e93d,_0xbcea('0xf'));logger[_0xbcea('0x10')](_0xbcea('0x11'),_0x30e93d,_0xbcea('0xf'),JSON[_0xbcea('0x12')](_0x2c4930));if(_0x2c4930[_0xbcea('0x13')]){if(_0x2c4930[_0xbcea('0x13')]['code']===0x1f4){logger[_0xbcea('0x13')](_0xbcea('0xe'),_0x30e93d,_0x2c4930[_0xbcea('0x13')][_0xbcea('0x14')]);return _0x2383f2(_0x2c4930['error'][_0xbcea('0x14')]);}logger[_0xbcea('0x13')](_0xbcea('0xe'),_0x30e93d,_0x2c4930['error'][_0xbcea('0x14')]);return _0x261657(_0x2c4930[_0xbcea('0x13')]['message']);}else{logger[_0xbcea('0xd')](_0xbcea('0xe'),_0x30e93d,_0xbcea('0xf'));_0x261657(_0x2c4930['result']['message']);}})[_0xbcea('0x15')](function(_0x3c5e3e){logger[_0xbcea('0x13')](_0xbcea('0xe'),_0x30e93d,_0x3c5e3e);_0x2383f2(_0x3c5e3e);});});}exports[_0xbcea('0x16')]=function(_0x26cc01){var _0xe44162=this;return new Promise(function(_0x4124a8,_0x47c143){return db['ChatQueueReport'][_0xbcea('0x17')](_0x26cc01[_0xbcea('0x18')],{'raw':_0x26cc01['options']?_0x26cc01['options'][_0xbcea('0x19')]===undefined?!![]:![]:!![]})[_0xbcea('0xc')](function(_0x540b87){logger[_0xbcea('0xd')]('CreateChatQueueReport',_0x26cc01);logger[_0xbcea('0x10')](_0xbcea('0x16'),_0x26cc01,JSON['stringify'](_0x540b87));_0x4124a8(_0x540b87);})[_0xbcea('0x15')](function(_0x2ee697){logger['error'](_0xbcea('0x16'),_0x2ee697[_0xbcea('0x14')],_0x26cc01);_0x47c143(_0xe44162['error'](0x1f4,_0x2ee697[_0xbcea('0x14')]));});});};exports[_0xbcea('0x1a')]=function(_0x2d7999){var _0x5ccec4=this;return new Promise(function(_0x2abac9,_0x40d73e){return db[_0xbcea('0x1b')]['update'](_0x2d7999[_0xbcea('0x18')],{'raw':_0x2d7999[_0xbcea('0x1c')]?_0x2d7999[_0xbcea('0x1c')][_0xbcea('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7999[_0xbcea('0x1c')]?_0x2d7999[_0xbcea('0x1c')][_0xbcea('0x1d')]||null:null,'attributes':_0x2d7999[_0xbcea('0x1c')]?_0x2d7999[_0xbcea('0x1c')][_0xbcea('0x1e')]||null:null,'limit':_0x2d7999[_0xbcea('0x1c')]?_0x2d7999[_0xbcea('0x1c')][_0xbcea('0x1f')]||null:null})[_0xbcea('0xc')](function(_0x946e96){logger[_0xbcea('0xd')](_0xbcea('0x1a'),_0x2d7999);logger[_0xbcea('0x10')]('UpdateChatQueueReport',_0x2d7999,JSON[_0xbcea('0x12')](_0x946e96));_0x2abac9(_0x946e96);})['catch'](function(_0x48c77c){logger[_0xbcea('0x13')]('UpdateChatQueueReport',_0x48c77c[_0xbcea('0x14')],_0x2d7999);_0x40d73e(_0x5ccec4[_0xbcea('0x13')](0x1f4,_0x48c77c[_0xbcea('0x14')]));});});}; \ No newline at end of file +var _0x18ff=['catch','update','raw','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateChatQueueReport','ChatQueueReport','body','options','info'];(function(_0x4ea4df,_0x260f0c){var _0x2fe919=function(_0x2d078e){while(--_0x2d078e){_0x4ea4df['push'](_0x4ea4df['shift']());}};_0x2fe919(++_0x260f0c);}(_0x18ff,0x69));var _0xf18f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x18ff[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf18f('0x0'));var util=require(_0xf18f('0x1'));var moment=require(_0xf18f('0x2'));var BPromise=require(_0xf18f('0x3'));var rs=require(_0xf18f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf18f('0x5'));var logger=require(_0xf18f('0x6'))(_0xf18f('0x7'));var config=require(_0xf18f('0x8'));var jayson=require(_0xf18f('0x9'));var client=jayson[_0xf18f('0xa')][_0xf18f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38db48,_0x3845fc,_0x58aef3){return new BPromise(function(_0x693240,_0x19c2b1){return client[_0xf18f('0xc')](_0x38db48,_0x58aef3)[_0xf18f('0xd')](function(_0x4b0b28){logger['info'](_0xf18f('0xe'),_0x3845fc,_0xf18f('0xf'));logger[_0xf18f('0x10')](_0xf18f('0x11'),_0x3845fc,_0xf18f('0xf'),JSON[_0xf18f('0x12')](_0x4b0b28));if(_0x4b0b28['error']){if(_0x4b0b28[_0xf18f('0x13')][_0xf18f('0x14')]===0x1f4){logger[_0xf18f('0x13')](_0xf18f('0xe'),_0x3845fc,_0x4b0b28[_0xf18f('0x13')][_0xf18f('0x15')]);return _0x19c2b1(_0x4b0b28[_0xf18f('0x13')][_0xf18f('0x15')]);}logger[_0xf18f('0x13')](_0xf18f('0xe'),_0x3845fc,_0x4b0b28['error'][_0xf18f('0x15')]);return _0x693240(_0x4b0b28[_0xf18f('0x13')][_0xf18f('0x15')]);}else{logger['info'](_0xf18f('0xe'),_0x3845fc,'request\x20sent');_0x693240(_0x4b0b28['result']['message']);}})['catch'](function(_0x456951){logger[_0xf18f('0x13')](_0xf18f('0xe'),_0x3845fc,_0x456951);_0x19c2b1(_0x456951);});});}exports[_0xf18f('0x16')]=function(_0x185d89){var _0x55a1d4=this;return new Promise(function(_0xbd27b4,_0xeea782){return db[_0xf18f('0x17')]['create'](_0x185d89[_0xf18f('0x18')],{'raw':_0x185d89[_0xf18f('0x19')]?_0x185d89[_0xf18f('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3ffbf0){logger[_0xf18f('0x1a')](_0xf18f('0x16'),_0x185d89);logger['debug'](_0xf18f('0x16'),_0x185d89,JSON['stringify'](_0x3ffbf0));_0xbd27b4(_0x3ffbf0);})[_0xf18f('0x1b')](function(_0x3591d0){logger[_0xf18f('0x13')](_0xf18f('0x16'),_0x3591d0[_0xf18f('0x15')],_0x185d89);_0xeea782(_0x55a1d4[_0xf18f('0x13')](0x1f4,_0x3591d0[_0xf18f('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x200995){var _0x30407b=this;return new Promise(function(_0x50f122,_0x1ded5e){return db[_0xf18f('0x17')][_0xf18f('0x1c')](_0x200995[_0xf18f('0x18')],{'raw':_0x200995[_0xf18f('0x19')]?_0x200995[_0xf18f('0x19')][_0xf18f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200995['options']?_0x200995[_0xf18f('0x19')]['where']||null:null,'attributes':_0x200995[_0xf18f('0x19')]?_0x200995[_0xf18f('0x19')][_0xf18f('0x1e')]||null:null,'limit':_0x200995[_0xf18f('0x19')]?_0x200995['options'][_0xf18f('0x1f')]||null:null})[_0xf18f('0xd')](function(_0x39037a){logger['info'](_0xf18f('0x20'),_0x200995);logger['debug'](_0xf18f('0x20'),_0x200995,JSON[_0xf18f('0x12')](_0x39037a));_0x50f122(_0x39037a);})[_0xf18f('0x1b')](function(_0x265324){logger['error']('UpdateChatQueueReport',_0x265324[_0xf18f('0x15')],_0x200995);_0x1ded5e(_0x30407b[_0xf18f('0x13')](0x1f4,_0x265324['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 34ac272..a89e316 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 _0x786b=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','describe','show','/:id','update','delete','destroy','exports','multer'];(function(_0x3d82c5,_0x1d8a69){var _0x9bac17=function(_0x5abbfe){while(--_0x5abbfe){_0x3d82c5['push'](_0x3d82c5['shift']());}};_0x9bac17(++_0x1d8a69);}(_0x786b,0x197));var _0xb786=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x786b[_0x18cac4];return _0x2227c6;};'use strict';var multer=require(_0xb786('0x0'));var util=require(_0xb786('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb786('0x2')]();var fs_extra=require(_0xb786('0x3'));var auth=require(_0xb786('0x4'));var interaction=require(_0xb786('0x5'));var config=require('../../config/environment');var controller=require(_0xb786('0x6'));router[_0xb786('0x7')]('/',auth[_0xb786('0x8')](),controller[_0xb786('0x9')]);router[_0xb786('0x7')]('/describe',auth[_0xb786('0x8')](),controller[_0xb786('0xa')]);router[_0xb786('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb786('0xb')]);router['post']('/',auth[_0xb786('0x8')](),controller['create']);router['put'](_0xb786('0xc'),auth[_0xb786('0x8')](),controller[_0xb786('0xd')]);router[_0xb786('0xe')](_0xb786('0xc'),auth[_0xb786('0x8')](),controller[_0xb786('0xf')]);module[_0xb786('0x10')]=router; \ No newline at end of file +var _0x2f85=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','delete'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x2f85,0x16b));var _0x52f8=function(_0x101334,_0xdb3758){_0x101334=_0x101334-0x0;var _0x387e22=_0x2f85[_0x101334];return _0x387e22;};'use strict';var multer=require(_0x52f8('0x0'));var util=require(_0x52f8('0x1'));var path=require(_0x52f8('0x2'));var timeout=require(_0x52f8('0x3'));var express=require(_0x52f8('0x4'));var router=express[_0x52f8('0x5')]();var fs_extra=require(_0x52f8('0x6'));var auth=require(_0x52f8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x52f8('0x8'));var controller=require(_0x52f8('0x9'));router[_0x52f8('0xa')]('/',auth[_0x52f8('0xb')](),controller[_0x52f8('0xc')]);router['get'](_0x52f8('0xd'),auth[_0x52f8('0xb')](),controller[_0x52f8('0xe')]);router[_0x52f8('0xa')](_0x52f8('0xf'),auth[_0x52f8('0xb')](),controller['show']);router['post']('/',auth[_0x52f8('0xb')](),controller['create']);router['put'](_0x52f8('0xf'),auth[_0x52f8('0xb')](),controller['update']);router[_0x52f8('0x10')](_0x52f8('0xf'),auth[_0x52f8('0xb')](),controller[_0x52f8('0x11')]);module[_0x52f8('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 30ab3e1..8d4929f 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5c07f5,_0x55b70e){var _0x3a2d28=function(_0x3206b5){while(--_0x3206b5){_0x5c07f5['push'](_0x5c07f5['shift']());}};_0x3a2d28(++_0x55b70e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xcb91[_0x1e500e];return _0x10dc5e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x18b4d3,_0x1cc71){var _0x665332=function(_0x27e3d9){while(--_0x27e3d9){_0x18b4d3['push'](_0x18b4d3['shift']());}};_0x665332(++_0x1cc71);}(_0x34e8,0x12c));var _0x834e=function(_0x2e7574,_0x32c435){_0x2e7574=_0x2e7574-0x0;var _0x4d78b6=_0x34e8[_0x2e7574];return _0x4d78b6;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index f7cdf65..ce56b5e 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 _0x110b=['end','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1c8b6a,_0x3c4171){var _0x18d923=function(_0x490e6e){while(--_0x490e6e){_0x1c8b6a['push'](_0x1c8b6a['shift']());}};_0x18d923(++_0x3c4171);}(_0x110b,0xc4));var _0xb110=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x110b[_0x257642];return _0x3d813b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb110('0x0'));var zipdir=require(_0xb110('0x1'));var jsonpatch=require(_0xb110('0x2'));var rp=require(_0xb110('0x3'));var moment=require(_0xb110('0x4'));var BPromise=require(_0xb110('0x5'));var Mustache=require(_0xb110('0x6'));var util=require('util');var path=require(_0xb110('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb110('0x8'));var fs=require('fs');var fs_extra=require(_0xb110('0x9'));var _=require(_0xb110('0xa'));var squel=require(_0xb110('0xb'));var crypto=require(_0xb110('0xc'));var jsforce=require(_0xb110('0xd'));var deskjs=require(_0xb110('0xe'));var toCsv=require(_0xb110('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb110('0x10'));var authService=require(_0xb110('0x11'));var qs=require(_0xb110('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb110('0x13'));var logger=require('../../config/logger')(_0xb110('0x14'));var utils=require('../../config/utils');var config=require(_0xb110('0x15'));var licenseUtil=require(_0xb110('0x16'));var db=require(_0xb110('0x17'))['db'];function respondWithStatusCode(_0x3817b7,_0x4c8bdc){_0x4c8bdc=_0x4c8bdc||0xcc;return function(_0x68de30){if(_0x68de30){return _0x3817b7[_0xb110('0x18')](_0x4c8bdc);}return _0x3817b7[_0xb110('0x19')](_0x4c8bdc)[_0xb110('0x1a')]();};}function respondWithResult(_0x5c38ef,_0x225c7f){_0x225c7f=_0x225c7f||0xc8;return function(_0x413f98){if(_0x413f98){return _0x5c38ef[_0xb110('0x19')](_0x225c7f)['json'](_0x413f98);}};}function respondWithFilteredResult(_0xf02fff,_0x516cc0){return function(_0x726c86){if(_0x726c86){var _0x4df70e=typeof _0x516cc0[_0xb110('0x1b')]===_0xb110('0x1c')&&typeof _0x516cc0[_0xb110('0x1d')]===_0xb110('0x1c');var _0xe96aec=_0x726c86['count'];var _0x246108=_0x4df70e?0x0:_0x516cc0[_0xb110('0x1b')];var _0x232eed=_0x4df70e?_0x726c86['count']:_0x516cc0[_0xb110('0x1b')]+_0x516cc0[_0xb110('0x1d')];var _0x39440b;if(_0x232eed>=_0xe96aec){_0x232eed=_0xe96aec;_0x39440b=0xc8;}else{_0x39440b=0xce;}_0xf02fff[_0xb110('0x19')](_0x39440b);return _0xf02fff[_0xb110('0x1e')](_0xb110('0x1f'),_0x246108+'-'+_0x232eed+'/'+_0xe96aec)['json'](_0x726c86);}return null;};}function patchUpdates(_0x190786){return function(_0x4da173){try{jsonpatch['apply'](_0x4da173,_0x190786,!![]);}catch(_0x5e2e6d){return BPromise[_0xb110('0x20')](_0x5e2e6d);}return _0x4da173[_0xb110('0x21')]();};}function saveUpdates(_0x1951d4,_0x1b5ce0){return function(_0xc09935){if(_0xc09935){return _0xc09935[_0xb110('0x22')](_0x1951d4)[_0xb110('0x23')](function(_0x5f005c){return _0x5f005c;});}return null;};}function removeEntity(_0x1a979f,_0x3ca95b){return function(_0x2f2179){if(_0x2f2179){return _0x2f2179[_0xb110('0x24')]()[_0xb110('0x23')](function(){_0x1a979f['status'](0xcc)[_0xb110('0x1a')]();});}};}function handleEntityNotFound(_0x3dd95f,_0x89a568){return function(_0x1209d4){if(!_0x1209d4){_0x3dd95f['sendStatus'](0x194);}return _0x1209d4;};}function handleError(_0x5a43c7,_0x2a5636){_0x2a5636=_0x2a5636||0x1f4;return function(_0x4cd27e){logger[_0xb110('0x25')](_0x4cd27e['stack']);if(_0x4cd27e[_0xb110('0x26')]){delete _0x4cd27e['name'];}_0x5a43c7['status'](_0x2a5636)[_0xb110('0x27')](_0x4cd27e);};}exports['index']=function(_0x2eb6de,_0x298604){var _0x16883a={},_0x19137a={},_0x4085c0={'count':0x0,'rows':[]};var _0x568799=_[_0xb110('0x28')](db[_0xb110('0x29')]['rawAttributes'],function(_0x5869a4){return{'name':_0x5869a4[_0xb110('0x2a')],'type':_0x5869a4[_0xb110('0x2b')][_0xb110('0x2c')]};});_0x19137a[_0xb110('0x2d')]=_[_0xb110('0x28')](_0x568799,_0xb110('0x26'));_0x19137a[_0xb110('0x2e')]=_[_0xb110('0x2f')](_0x2eb6de['query']);_0x19137a[_0xb110('0x30')]=_[_0xb110('0x31')](_0x19137a['model'],_0x19137a[_0xb110('0x2e')]);_0x16883a['attributes']=_['intersection'](_0x19137a['model'],qs[_0xb110('0x32')](_0x2eb6de[_0xb110('0x2e')]['fields']));_0x16883a[_0xb110('0x33')]=_0x16883a[_0xb110('0x33')][_0xb110('0x34')]?_0x16883a[_0xb110('0x33')]:_0x19137a[_0xb110('0x2d')];if(!_0x2eb6de[_0xb110('0x2e')][_0xb110('0x35')](_0xb110('0x36'))){_0x16883a['limit']=qs[_0xb110('0x1d')](_0x2eb6de['query']['limit']);_0x16883a[_0xb110('0x1b')]=qs[_0xb110('0x1b')](_0x2eb6de[_0xb110('0x2e')][_0xb110('0x1b')]);}_0x16883a['order']=qs[_0xb110('0x37')](_0x2eb6de[_0xb110('0x2e')]['sort']);_0x16883a[_0xb110('0x38')]=qs[_0xb110('0x30')](_[_0xb110('0x39')](_0x2eb6de['query'],_0x19137a[_0xb110('0x30')]),_0x568799);if(_0x2eb6de[_0xb110('0x2e')][_0xb110('0x3a')]){_0x16883a[_0xb110('0x38')]=_[_0xb110('0x3b')](_0x16883a[_0xb110('0x38')],{'$or':_[_0xb110('0x28')](_0x568799,function(_0x535aa8){if(_0x535aa8['type']!==_0xb110('0x3c')){var _0x553710={};_0x553710[_0x535aa8[_0xb110('0x26')]]={'$like':'%'+_0x2eb6de['query']['filter']+'%'};return _0x553710;}})});}_0x16883a=_[_0xb110('0x3b')]({},_0x16883a,_0x2eb6de[_0xb110('0x3d')]);var _0x45cafa={'where':_0x16883a[_0xb110('0x38')]};return db[_0xb110('0x29')]['count'](_0x45cafa)['then'](function(_0x41bd46){_0x4085c0['count']=_0x41bd46;if(_0x2eb6de[_0xb110('0x2e')]['includeAll']){_0x16883a[_0xb110('0x3e')]=[{'all':!![]}];}return db[_0xb110('0x29')][_0xb110('0x3f')](_0x16883a);})[_0xb110('0x23')](function(_0x59e27f){_0x4085c0[_0xb110('0x40')]=_0x59e27f;return _0x4085c0;})['then'](respondWithFilteredResult(_0x298604,_0x16883a))[_0xb110('0x41')](handleError(_0x298604,null));};exports[_0xb110('0x42')]=function(_0x2fc117,_0x1b35ae){var _0x496120={'raw':!![],'where':{'id':_0x2fc117['params']['id']}},_0x4fadb7={};_0x4fadb7[_0xb110('0x2d')]=_[_0xb110('0x2f')](db['ChatTransferReport'][_0xb110('0x43')]);_0x4fadb7[_0xb110('0x2e')]=_[_0xb110('0x2f')](_0x2fc117[_0xb110('0x2e')]);_0x4fadb7[_0xb110('0x30')]=_[_0xb110('0x31')](_0x4fadb7[_0xb110('0x2d')],_0x4fadb7[_0xb110('0x2e')]);_0x496120[_0xb110('0x33')]=_[_0xb110('0x31')](_0x4fadb7[_0xb110('0x2d')],qs[_0xb110('0x32')](_0x2fc117[_0xb110('0x2e')][_0xb110('0x32')]));_0x496120[_0xb110('0x33')]=_0x496120[_0xb110('0x33')][_0xb110('0x34')]?_0x496120[_0xb110('0x33')]:_0x4fadb7['model'];if(_0x2fc117[_0xb110('0x2e')][_0xb110('0x44')]){_0x496120['include']=[{'all':!![]}];}_0x496120=_['merge']({},_0x496120,_0x2fc117[_0xb110('0x3d')]);return db[_0xb110('0x29')]['find'](_0x496120)[_0xb110('0x23')](handleEntityNotFound(_0x1b35ae,null))[_0xb110('0x23')](respondWithResult(_0x1b35ae,null))[_0xb110('0x41')](handleError(_0x1b35ae,null));};exports[_0xb110('0x45')]=function(_0x2f9994,_0x296723){return db[_0xb110('0x29')][_0xb110('0x45')](_0x2f9994[_0xb110('0x46')],{})['then'](respondWithResult(_0x296723,0xc9))[_0xb110('0x41')](handleError(_0x296723,null));};exports[_0xb110('0x22')]=function(_0x5e63d6,_0xe9d82f){if(_0x5e63d6['body']['id']){delete _0x5e63d6[_0xb110('0x46')]['id'];}return db[_0xb110('0x29')]['find']({'where':{'id':_0x5e63d6['params']['id']}})['then'](handleEntityNotFound(_0xe9d82f,null))[_0xb110('0x23')](saveUpdates(_0x5e63d6[_0xb110('0x46')],null))[_0xb110('0x23')](respondWithResult(_0xe9d82f,null))[_0xb110('0x41')](handleError(_0xe9d82f,null));};exports[_0xb110('0x24')]=function(_0x4ed969,_0x368d91){return db[_0xb110('0x29')][_0xb110('0x47')]({'where':{'id':_0x4ed969[_0xb110('0x48')]['id']}})[_0xb110('0x23')](handleEntityNotFound(_0x368d91,null))[_0xb110('0x23')](removeEntity(_0x368d91,null))['catch'](handleError(_0x368d91,null));};exports[_0xb110('0x49')]=function(_0x2208f4,_0x2ab87f){return db[_0xb110('0x29')][_0xb110('0x49')]()['then'](respondWithResult(_0x2ab87f,null))['catch'](handleError(_0x2ab87f,null));}; \ No newline at end of file +var _0x173c=['then','error','name','send','index','ChatTransferReport','rawAttributes','key','map','query','keys','intersection','attributes','model','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x203dca,_0x306207){var _0x50965f=function(_0x25264c){while(--_0x25264c){_0x203dca['push'](_0x203dca['shift']());}};_0x50965f(++_0x306207);}(_0x173c,0xf2));var _0xc173=function(_0xa38202,_0xbdbc76){_0xa38202=_0xa38202-0x0;var _0x14bbbe=_0x173c[_0xa38202];return _0x14bbbe;};'use strict';var emlformat=require(_0xc173('0x0'));var rimraf=require(_0xc173('0x1'));var zipdir=require(_0xc173('0x2'));var jsonpatch=require(_0xc173('0x3'));var rp=require(_0xc173('0x4'));var moment=require(_0xc173('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc173('0x6'));var path=require(_0xc173('0x7'));var sox=require(_0xc173('0x8'));var csv=require(_0xc173('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc173('0xa'));var squel=require(_0xc173('0xb'));var crypto=require('crypto');var jsforce=require(_0xc173('0xc'));var deskjs=require(_0xc173('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc173('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc173('0xf'));var logger=require(_0xc173('0x10'))(_0xc173('0x11'));var utils=require('../../config/utils');var config=require(_0xc173('0x12'));var licenseUtil=require(_0xc173('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fa88d,_0x46508b){_0x46508b=_0x46508b||0xcc;return function(_0x42478f){if(_0x42478f){return _0x1fa88d[_0xc173('0x14')](_0x46508b);}return _0x1fa88d['status'](_0x46508b)[_0xc173('0x15')]();};}function respondWithResult(_0x16c0c1,_0xdd68a1){_0xdd68a1=_0xdd68a1||0xc8;return function(_0x4b93cb){if(_0x4b93cb){return _0x16c0c1[_0xc173('0x16')](_0xdd68a1)['json'](_0x4b93cb);}};}function respondWithFilteredResult(_0x2b30a9,_0x35dd76){return function(_0x5f10be){if(_0x5f10be){var _0x242654=typeof _0x35dd76[_0xc173('0x17')]==='undefined'&&typeof _0x35dd76['limit']===_0xc173('0x18');var _0x346a06=_0x5f10be[_0xc173('0x19')];var _0xef9457=_0x242654?0x0:_0x35dd76['offset'];var _0x90fa04=_0x242654?_0x5f10be[_0xc173('0x19')]:_0x35dd76[_0xc173('0x17')]+_0x35dd76[_0xc173('0x1a')];var _0x4b95bd;if(_0x90fa04>=_0x346a06){_0x90fa04=_0x346a06;_0x4b95bd=0xc8;}else{_0x4b95bd=0xce;}_0x2b30a9['status'](_0x4b95bd);return _0x2b30a9[_0xc173('0x1b')](_0xc173('0x1c'),_0xef9457+'-'+_0x90fa04+'/'+_0x346a06)['json'](_0x5f10be);}return null;};}function patchUpdates(_0xdca518){return function(_0x522c0a){try{jsonpatch[_0xc173('0x1d')](_0x522c0a,_0xdca518,!![]);}catch(_0x273395){return BPromise[_0xc173('0x1e')](_0x273395);}return _0x522c0a[_0xc173('0x1f')]();};}function saveUpdates(_0x4100ee,_0x167bfa){return function(_0x27bd26){if(_0x27bd26){return _0x27bd26[_0xc173('0x20')](_0x4100ee)['then'](function(_0x32092f){return _0x32092f;});}return null;};}function removeEntity(_0x3db74a,_0x162b3d){return function(_0x726143){if(_0x726143){return _0x726143[_0xc173('0x21')]()[_0xc173('0x22')](function(){_0x3db74a[_0xc173('0x16')](0xcc)[_0xc173('0x15')]();});}};}function handleEntityNotFound(_0x26fa07,_0xabcd70){return function(_0x830a55){if(!_0x830a55){_0x26fa07[_0xc173('0x14')](0x194);}return _0x830a55;};}function handleError(_0x1f090d,_0x19322b){_0x19322b=_0x19322b||0x1f4;return function(_0x423b00){logger[_0xc173('0x23')](_0x423b00['stack']);if(_0x423b00[_0xc173('0x24')]){delete _0x423b00[_0xc173('0x24')];}_0x1f090d[_0xc173('0x16')](_0x19322b)[_0xc173('0x25')](_0x423b00);};}exports[_0xc173('0x26')]=function(_0x2967c4,_0x21c74f){var _0x58f2e6={},_0x4be7d7={},_0x287074={'count':0x0,'rows':[]};var _0x5b3657=_['map'](db[_0xc173('0x27')][_0xc173('0x28')],function(_0x5985f8){return{'name':_0x5985f8['fieldName'],'type':_0x5985f8['type'][_0xc173('0x29')]};});_0x4be7d7['model']=_[_0xc173('0x2a')](_0x5b3657,'name');_0x4be7d7[_0xc173('0x2b')]=_[_0xc173('0x2c')](_0x2967c4['query']);_0x4be7d7['filters']=_[_0xc173('0x2d')](_0x4be7d7['model'],_0x4be7d7['query']);_0x58f2e6[_0xc173('0x2e')]=_[_0xc173('0x2d')](_0x4be7d7[_0xc173('0x2f')],qs[_0xc173('0x30')](_0x2967c4[_0xc173('0x2b')][_0xc173('0x30')]));_0x58f2e6[_0xc173('0x2e')]=_0x58f2e6[_0xc173('0x2e')][_0xc173('0x31')]?_0x58f2e6[_0xc173('0x2e')]:_0x4be7d7['model'];if(!_0x2967c4['query']['hasOwnProperty']('nolimit')){_0x58f2e6['limit']=qs[_0xc173('0x1a')](_0x2967c4['query']['limit']);_0x58f2e6['offset']=qs[_0xc173('0x17')](_0x2967c4[_0xc173('0x2b')][_0xc173('0x17')]);}_0x58f2e6[_0xc173('0x32')]=qs[_0xc173('0x33')](_0x2967c4['query']['sort']);_0x58f2e6[_0xc173('0x34')]=qs[_0xc173('0x35')](_[_0xc173('0x36')](_0x2967c4[_0xc173('0x2b')],_0x4be7d7[_0xc173('0x35')]),_0x5b3657);if(_0x2967c4['query'][_0xc173('0x37')]){_0x58f2e6[_0xc173('0x34')]=_[_0xc173('0x38')](_0x58f2e6[_0xc173('0x34')],{'$or':_[_0xc173('0x2a')](_0x5b3657,function(_0x5765fc){if(_0x5765fc[_0xc173('0x39')]!==_0xc173('0x3a')){var _0x3c1251={};_0x3c1251[_0x5765fc['name']]={'$like':'%'+_0x2967c4[_0xc173('0x2b')][_0xc173('0x37')]+'%'};return _0x3c1251;}})});}_0x58f2e6=_[_0xc173('0x38')]({},_0x58f2e6,_0x2967c4[_0xc173('0x3b')]);var _0x4cd902={'where':_0x58f2e6[_0xc173('0x34')]};return db[_0xc173('0x27')][_0xc173('0x19')](_0x4cd902)[_0xc173('0x22')](function(_0x5527d7){_0x287074[_0xc173('0x19')]=_0x5527d7;if(_0x2967c4[_0xc173('0x2b')]['includeAll']){_0x58f2e6[_0xc173('0x3c')]=[{'all':!![]}];}return db[_0xc173('0x27')][_0xc173('0x3d')](_0x58f2e6);})[_0xc173('0x22')](function(_0xe65d52){_0x287074['rows']=_0xe65d52;return _0x287074;})[_0xc173('0x22')](respondWithFilteredResult(_0x21c74f,_0x58f2e6))[_0xc173('0x3e')](handleError(_0x21c74f,null));};exports[_0xc173('0x3f')]=function(_0x2ba334,_0x12c768){var _0x2f40a6={'raw':!![],'where':{'id':_0x2ba334['params']['id']}},_0x56639a={};_0x56639a[_0xc173('0x2f')]=_[_0xc173('0x2c')](db[_0xc173('0x27')][_0xc173('0x28')]);_0x56639a[_0xc173('0x2b')]=_[_0xc173('0x2c')](_0x2ba334[_0xc173('0x2b')]);_0x56639a['filters']=_[_0xc173('0x2d')](_0x56639a['model'],_0x56639a[_0xc173('0x2b')]);_0x2f40a6['attributes']=_['intersection'](_0x56639a[_0xc173('0x2f')],qs[_0xc173('0x30')](_0x2ba334['query'][_0xc173('0x30')]));_0x2f40a6[_0xc173('0x2e')]=_0x2f40a6['attributes']['length']?_0x2f40a6[_0xc173('0x2e')]:_0x56639a[_0xc173('0x2f')];if(_0x2ba334[_0xc173('0x2b')][_0xc173('0x40')]){_0x2f40a6[_0xc173('0x3c')]=[{'all':!![]}];}_0x2f40a6=_[_0xc173('0x38')]({},_0x2f40a6,_0x2ba334['options']);return db[_0xc173('0x27')][_0xc173('0x41')](_0x2f40a6)['then'](handleEntityNotFound(_0x12c768,null))[_0xc173('0x22')](respondWithResult(_0x12c768,null))[_0xc173('0x3e')](handleError(_0x12c768,null));};exports[_0xc173('0x42')]=function(_0x2fa315,_0x136318){return db['ChatTransferReport']['create'](_0x2fa315[_0xc173('0x43')],{})[_0xc173('0x22')](respondWithResult(_0x136318,0xc9))[_0xc173('0x3e')](handleError(_0x136318,null));};exports[_0xc173('0x20')]=function(_0x25c62a,_0x437700){if(_0x25c62a[_0xc173('0x43')]['id']){delete _0x25c62a['body']['id'];}return db[_0xc173('0x27')]['find']({'where':{'id':_0x25c62a[_0xc173('0x44')]['id']}})[_0xc173('0x22')](handleEntityNotFound(_0x437700,null))[_0xc173('0x22')](saveUpdates(_0x25c62a[_0xc173('0x43')],null))[_0xc173('0x22')](respondWithResult(_0x437700,null))['catch'](handleError(_0x437700,null));};exports[_0xc173('0x21')]=function(_0x4bd68d,_0x372ffe){return db[_0xc173('0x27')]['find']({'where':{'id':_0x4bd68d[_0xc173('0x44')]['id']}})[_0xc173('0x22')](handleEntityNotFound(_0x372ffe,null))[_0xc173('0x22')](removeEntity(_0x372ffe,null))[_0xc173('0x3e')](handleError(_0x372ffe,null));};exports['describe']=function(_0x10911c,_0x12a383){return db['ChatTransferReport']['describe']()[_0xc173('0x22')](respondWithResult(_0x12a383,null))['catch'](handleError(_0x12a383,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4b8efe6..cd616ff 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 _0xe82f=['define','report_chat_transfer','uniqueid','lodash','util','bluebird','path','rimraf','./chatTransferReport.attributes','exports'];(function(_0x30cfe6,_0x39210e){var _0x28a8e4=function(_0x54c32b){while(--_0x54c32b){_0x30cfe6['push'](_0x30cfe6['shift']());}};_0x28a8e4(++_0x39210e);}(_0xe82f,0x7b));var _0xfe82=function(_0x2c54a0,_0x26a3b4){_0x2c54a0=_0x2c54a0-0x0;var _0x4bb23c=_0xe82f[_0x2c54a0];return _0x4bb23c;};'use strict';var _=require(_0xfe82('0x0'));var util=require(_0xfe82('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfe82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe82('0x3'));var rimraf=require(_0xfe82('0x4'));var config=require('../../config/environment');var attributes=require(_0xfe82('0x5'));module[_0xfe82('0x6')]=function(_0x2ddef7,_0x80be93){return _0x2ddef7[_0xfe82('0x7')]('ChatTransferReport',attributes,{'tableName':_0xfe82('0x8'),'paranoid':![],'indexes':[{'name':_0xfe82('0x9'),'fields':[_0xfe82('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1739=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1739,0x1ad));var _0x9173=function(_0x25e281,_0x8e0974){_0x25e281=_0x25e281-0x0;var _0x38457d=_0x1739[_0x25e281];return _0x38457d;};'use strict';var _=require(_0x9173('0x0'));var util=require(_0x9173('0x1'));var logger=require(_0x9173('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9173('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9173('0x4'));var rimraf=require(_0x9173('0x5'));var config=require(_0x9173('0x6'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x42baee,_0x1eac26){return _0x42baee[_0x9173('0x7')](_0x9173('0x8'),attributes,{'tableName':_0x9173('0x9'),'paranoid':![],'indexes':[{'name':_0x9173('0xa'),'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 794f93f..5d31152 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 _0x4ce5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2b65e0,_0x38e073){var _0x207686=function(_0x2473d6){while(--_0x2473d6){_0x2b65e0['push'](_0x2b65e0['shift']());}};_0x207686(++_0x38e073);}(_0x4ce5,0xb3));var _0x54ce=function(_0x530f24,_0x25e80a){_0x530f24=_0x530f24-0x0;var _0x46c900=_0x4ce5[_0x530f24];return _0x46c900;};'use strict';var _=require(_0x54ce('0x0'));var util=require(_0x54ce('0x1'));var moment=require(_0x54ce('0x2'));var BPromise=require('bluebird');var rs=require(_0x54ce('0x3'));var fs=require('fs');var Redis=require(_0x54ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x54ce('0x5'))(_0x54ce('0x6'));var config=require(_0x54ce('0x7'));var jayson=require(_0x54ce('0x8'));var client=jayson[_0x54ce('0x9')][_0x54ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbf68e3,_0x45990d,_0x7f5fb1){return new BPromise(function(_0x50c6a6,_0x282e7d){return client['request'](_0xbf68e3,_0x7f5fb1)[_0x54ce('0xb')](function(_0x5b09f5){logger[_0x54ce('0xc')](_0x54ce('0xd'),_0x45990d,_0x54ce('0xe'));logger[_0x54ce('0xf')](_0x54ce('0x10'),_0x45990d,_0x54ce('0xe'),JSON[_0x54ce('0x11')](_0x5b09f5));if(_0x5b09f5['error']){if(_0x5b09f5['error'][_0x54ce('0x12')]===0x1f4){logger[_0x54ce('0x13')](_0x54ce('0xd'),_0x45990d,_0x5b09f5[_0x54ce('0x13')][_0x54ce('0x14')]);return _0x282e7d(_0x5b09f5[_0x54ce('0x13')][_0x54ce('0x14')]);}logger[_0x54ce('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x45990d,_0x5b09f5[_0x54ce('0x13')]['message']);return _0x50c6a6(_0x5b09f5[_0x54ce('0x13')]['message']);}else{logger[_0x54ce('0xc')](_0x54ce('0xd'),_0x45990d,'request\x20sent');_0x50c6a6(_0x5b09f5[_0x54ce('0x15')][_0x54ce('0x14')]);}})[_0x54ce('0x16')](function(_0x4aae58){logger['error'](_0x54ce('0xd'),_0x45990d,_0x4aae58);_0x282e7d(_0x4aae58);});});} \ No newline at end of file +var _0x0841=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug'];(function(_0x10d4e8,_0x296816){var _0x87ed99=function(_0x10eea3){while(--_0x10eea3){_0x10d4e8['push'](_0x10d4e8['shift']());}};_0x87ed99(++_0x296816);}(_0x0841,0x1d4));var _0x1084=function(_0x5d4b62,_0x37771c){_0x5d4b62=_0x5d4b62-0x0;var _0x488b98=_0x0841[_0x5d4b62];return _0x488b98;};'use strict';var _=require(_0x1084('0x0'));var util=require(_0x1084('0x1'));var moment=require(_0x1084('0x2'));var BPromise=require(_0x1084('0x3'));var rs=require(_0x1084('0x4'));var fs=require('fs');var Redis=require(_0x1084('0x5'));var db=require(_0x1084('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1084('0x7'))(_0x1084('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1084('0x9')][_0x1084('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeb35e8,_0x51a00c,_0x120b5c){return new BPromise(function(_0x3a525d,_0x3b7f57){return client['request'](_0xeb35e8,_0x120b5c)[_0x1084('0xb')](function(_0x548442){logger[_0x1084('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x51a00c,_0x1084('0xd'));logger[_0x1084('0xe')](_0x1084('0xf'),_0x51a00c,_0x1084('0xd'),JSON[_0x1084('0x10')](_0x548442));if(_0x548442[_0x1084('0x11')]){if(_0x548442[_0x1084('0x11')][_0x1084('0x12')]===0x1f4){logger[_0x1084('0x11')](_0x1084('0x13'),_0x51a00c,_0x548442[_0x1084('0x11')]['message']);return _0x3b7f57(_0x548442[_0x1084('0x11')][_0x1084('0x14')]);}logger['error'](_0x1084('0x13'),_0x51a00c,_0x548442['error']['message']);return _0x3a525d(_0x548442[_0x1084('0x11')]['message']);}else{logger[_0x1084('0xc')](_0x1084('0x13'),_0x51a00c,_0x1084('0xd'));_0x3a525d(_0x548442[_0x1084('0x15')][_0x1084('0x14')]);}})[_0x1084('0x16')](function(_0xd69ddc){logger[_0x1084('0x11')](_0x1084('0x13'),_0x51a00c,_0xd69ddc);_0x3b7f57(_0xd69ddc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 17a7cfd..3ef0d1e 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 _0x73e5=['isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get'];(function(_0x4fa750,_0x462b13){var _0x3db2f9=function(_0x3ac702){while(--_0x3ac702){_0x4fa750['push'](_0x4fa750['shift']());}};_0x3db2f9(++_0x462b13);}(_0x73e5,0x174));var _0x573e=function(_0x5011f5,_0x92181b){_0x5011f5=_0x5011f5-0x0;var _0x2b0e3f=_0x73e5[_0x5011f5];return _0x2b0e3f;};'use strict';var multer=require(_0x573e('0x0'));var util=require('util');var path=require(_0x573e('0x1'));var timeout=require('connect-timeout');var express=require(_0x573e('0x2'));var router=express['Router']();var fs_extra=require(_0x573e('0x3'));var auth=require(_0x573e('0x4'));var interaction=require(_0x573e('0x5'));var config=require('../../config/environment');var controller=require(_0x573e('0x6'));router[_0x573e('0x7')]('/',auth[_0x573e('0x8')](),controller[_0x573e('0x9')]);router[_0x573e('0x7')](_0x573e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x573e('0x7')](_0x573e('0xb'),auth[_0x573e('0x8')](),controller[_0x573e('0xc')]);router[_0x573e('0xd')]('/',auth[_0x573e('0x8')](),controller[_0x573e('0xe')]);router[_0x573e('0xf')](_0x573e('0xb'),auth[_0x573e('0x8')](),controller[_0x573e('0x10')]);router[_0x573e('0x11')](_0x573e('0xb'),auth[_0x573e('0x8')](),controller[_0x573e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xaa43=['post','create','put','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa43,0x147));var _0x3aa4=function(_0x55d5d0,_0x535f2f){_0x55d5d0=_0x55d5d0-0x0;var _0x45ee76=_0xaa43[_0x55d5d0];return _0x45ee76;};'use strict';var multer=require(_0x3aa4('0x0'));var util=require(_0x3aa4('0x1'));var path=require(_0x3aa4('0x2'));var timeout=require('connect-timeout');var express=require(_0x3aa4('0x3'));var router=express[_0x3aa4('0x4')]();var fs_extra=require(_0x3aa4('0x5'));var auth=require(_0x3aa4('0x6'));var interaction=require(_0x3aa4('0x7'));var config=require(_0x3aa4('0x8'));var controller=require(_0x3aa4('0x9'));router[_0x3aa4('0xa')]('/',auth[_0x3aa4('0xb')](),controller[_0x3aa4('0xc')]);router[_0x3aa4('0xa')](_0x3aa4('0xd'),auth[_0x3aa4('0xb')](),controller['describe']);router[_0x3aa4('0xa')](_0x3aa4('0xe'),auth[_0x3aa4('0xb')](),controller['show']);router[_0x3aa4('0xf')]('/',auth['isAuthenticated'](),controller[_0x3aa4('0x10')]);router[_0x3aa4('0x11')](_0x3aa4('0xe'),auth[_0x3aa4('0xb')](),controller['update']);router[_0x3aa4('0x12')](_0x3aa4('0xe'),auth[_0x3aa4('0xb')](),controller['destroy']);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 8bbcfae..0ecda53 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 _0x8105=['rounded','squared','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','ENUM','thumb','star','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN'];(function(_0x5354b2,_0x1b3716){var _0x1442f6=function(_0xaaad6c){while(--_0xaaad6c){_0x5354b2['push'](_0x5354b2['shift']());}};_0x1442f6(++_0x1b3716);}(_0x8105,0xc1));var _0x5810=function(_0x33adf2,_0x45f78a){_0x33adf2=_0x33adf2-0x0;var _0x4a7ac2=_0x8105[_0x33adf2];return _0x4a7ac2;};'use strict';var Sequelize=require(_0x5810('0x0'));var rs=require(_0x5810('0x1'));module[_0x5810('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5810('0x3')],'allowNull':![],'unique':_0x5810('0x4')},'description':{'type':Sequelize[_0x5810('0x3')]},'mapKey':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x5810('0x5')},'key':{'type':Sequelize[_0x5810('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x6')},'customerAlias':{'type':Sequelize[_0x5810('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5810('0x3')],'allowNull':![],'defaultValue':_0x5810('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5810('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5810('0x3')],'allowNull':![],'defaultValue':_0x5810('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5810('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5810('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5810('0x3')]},'animation':{'type':Sequelize[_0x5810('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x5810('0xb'),_0x5810('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x5810('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0xd')},'header_offline':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0xe')},'download_transcript':{'type':Sequelize[_0x5810('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5810('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x5810('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5810('0x10')]},'closingQuestion':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5810('0x13')},'noteTitle':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5810('0x15')},'closingMessage':{'type':Sequelize[_0x5810('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x5810('0x16')},'conditionAgreement':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x17')},'ratingType':{'type':Sequelize[_0x5810('0x18')]('star',_0x5810('0x19')),'defaultValue':_0x5810('0x1a')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5810('0x10')],'defaultValue':function(){return JSON[_0x5810('0x1b')]({'items':[{'type':_0x5810('0x1c'),'variable':null,'config':{'placeholder':_0x5810('0x1d'),'type':'text','required':!![]},'props':{'title':_0x5810('0x1d'),'helpText':''}},{'type':_0x5810('0x1c'),'props':{'title':_0x5810('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5810('0x1e')](_0x5810('0x1f'))?JSON[_0x5810('0x20')](this[_0x5810('0x1e')](_0x5810('0x1f'))):{};},'set':function(_0xe2f54e){return this[_0x5810('0x21')]('onlineForm',JSON[_0x5810('0x1b')](_0xe2f54e));}},'offlineForm':{'type':Sequelize[_0x5810('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5810('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x5810('0x5')},'variable':null},{'type':_0x5810('0x22'),'config':{'placeholder':_0x5810('0x23')},'props':{'title':_0x5810('0x23'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5810('0x1e')](_0x5810('0x24'))?JSON[_0x5810('0x20')](this['getDataValue'](_0x5810('0x24'))):{};},'set':function(_0x1c6b14){return this[_0x5810('0x21')](_0x5810('0x24'),JSON[_0x5810('0x1b')](_0x1c6b14));}},'token':{'type':Sequelize[_0x5810('0x3')],'defaultValue':function(){return rs[_0x5810('0x25')]();}},'autoclose':{'type':Sequelize[_0x5810('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5810('0x3')]},'forwardOffline':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5810('0x3')]},'waitingTitle':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x26')},'waitingMessage':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x28')},'offlineMessageBody':{'type':Sequelize[_0x5810('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x5810('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5810('0x29')},'skipUnmanaged':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x16')},'sendUnmanaged':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5810('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5810('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5810('0x10')],'defaultValue':function(){return _0x5810('0x2a');}},'notificationSound':{'type':Sequelize[_0x5810('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5810('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x5810('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5810('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x2b')},'verticalAlignment':{'type':Sequelize[_0x5810('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x2c')},'messagesAlignment':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x2d')},'defaultTitle':{'type':Sequelize[_0x5810('0x3')]},'customerAvatar':{'type':Sequelize[_0x5810('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5810('0x3')],'allowNull':![],'defaultValue':_0x5810('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5810('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5810('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5810('0x3')],'defaultValue':_0x5810('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5810('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5792a0){if(!_0x5792a0)this[_0x5810('0x21')](_0x5810('0x30'),null);this[_0x5810('0x21')](_0x5810('0x31'),_0x5792a0);}},'vidaooEscalation':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5810('0x3')]},'vidaooTopic':{'type':Sequelize[_0x5810('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x5810('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x5810('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5810('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5810('0x10')]}}; \ No newline at end of file +var _0xe34d=['getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','BOOLEAN','Feedback','star','thumb','input','name','text'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe34d,0x7f));var _0xde34=function(_0x51ad6b,_0x3d3f9d){_0x51ad6b=_0x51ad6b-0x0;var _0x18e62d=_0xe34d[_0x51ad6b];return _0x18e62d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xde34('0x0'));module[_0xde34('0x1')]={'name':{'type':Sequelize[_0xde34('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xde34('0x2')]},'mapKey':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x3')},'mapKeyOffline':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x3')},'key':{'type':Sequelize[_0xde34('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x4')},'customerAlias':{'type':Sequelize[_0xde34('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xde34('0x2')],'allowNull':![],'defaultValue':_0xde34('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xde34('0x2')],'allowNull':![],'defaultValue':_0xde34('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xde34('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xde34('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xde34('0x7')](_0xde34('0x8'),_0xde34('0x9')),'defaultValue':_0xde34('0x8')},'header_online':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xde34('0xb')},'offline_chat_button':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xde34('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xde34('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xde34('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xde34('0xf')]},'closingQuestion':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xde34('0x12')},'noteTitle':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xde34('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0xc')},'skipMessageButton':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x17')},'ratingType':{'type':Sequelize[_0xde34('0x7')](_0xde34('0x18'),_0xde34('0x19')),'defaultValue':_0xde34('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xde34('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xde34('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xde34('0x1a'),'variable':null,'config':{'placeholder':_0xde34('0x1b'),'type':_0xde34('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xde34('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xde34('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xde34('0x1d')](_0xde34('0x1e'))?JSON[_0xde34('0x1f')](this[_0xde34('0x1d')](_0xde34('0x1e'))):{};},'set':function(_0x2f60e2){return this[_0xde34('0x20')](_0xde34('0x1e'),JSON[_0xde34('0x21')](_0x2f60e2));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xde34('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xde34('0x3'),'type':_0xde34('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0xde34('0x22')},'props':{'title':_0xde34('0x22'),'helpText':_0xde34('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xde34('0x1d')](_0xde34('0x24'))?JSON[_0xde34('0x1f')](this[_0xde34('0x1d')]('offlineForm')):{};},'set':function(_0x1baae7){return this[_0xde34('0x20')](_0xde34('0x24'),JSON['stringify'](_0x1baae7));}},'token':{'type':Sequelize[_0xde34('0x2')],'defaultValue':function(){return rs[_0xde34('0x25')]();}},'autoclose':{'type':Sequelize[_0xde34('0x16')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xde34('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xde34('0x2')]},'waitingTitle':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x26')},'waitingMessage':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x28')},'offlineMessageBody':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xde34('0x16')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xde34('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xde34('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xde34('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xde34('0xf')],'defaultValue':function(){return _0xde34('0x2a');}},'notificationSound':{'type':Sequelize[_0xde34('0x16')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xde34('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xde34('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x2c')},'verticalAlignment':{'type':Sequelize[_0xde34('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xde34('0x2')],'defaultValue':_0xde34('0x2d')},'messagesAlignment':{'type':Sequelize[_0xde34('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xde34('0x2')]},'customerAvatar':{'type':Sequelize[_0xde34('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xde34('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xde34('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xde34('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xde34('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xde34('0x2e')},'systemAvatar':{'type':Sequelize[_0xde34('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xde34('0xe')],'comment':_0xde34('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x19152d){if(!_0x19152d)this[_0xde34('0x20')](_0xde34('0x30'),null);this[_0xde34('0x20')](_0xde34('0x31'),_0x19152d);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xde34('0x2')]},'vidaooTopic':{'type':Sequelize[_0xde34('0x2')],'allowNull':![],'defaultValue':_0xde34('0x32')},'vidaooNote':{'type':Sequelize[_0xde34('0x2')],'defaultValue':function(){return _0xde34('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xde34('0x16')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index efd7982..7ab53bf 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 _0xa839=['virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','redis','defaults','localhost','socket.io-emitter','register','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','ChatWebsites','UserProfileResource','sendStatus','name','send','Command','getSnippet','format','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','map','Interval','Intervals','get','some','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','model','type','stringify','index','Pause','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','hasOwnProperty','nolimit','pick','findAll','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','isNil','getSystemAvatar','systemAvatar','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','ChatApplication','Applications','account','list','applications','orderBy','asc','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','EventManager','notify','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','mapValues','NotifyMailAccount','remove','addInteraction','omit','getInteractions','Contact','User','fullname','internal','Tags','color','tag','getProactiveActions'];(function(_0x49ea79,_0x179fe6){var _0x4db41d=function(_0x4bdaa8){while(--_0x4bdaa8){_0x49ea79['push'](_0x49ea79['shift']());}};_0x4db41d(++_0x179fe6);}(_0xa839,0x168));var _0x9a83=function(_0x3dff66,_0x3162a8){_0x3dff66=_0x3dff66-0x0;var _0x5d1e6a=_0xa839[_0x3dff66];return _0x5d1e6a;};'use strict';var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require(_0x9a83('0x0'));var fs=require('fs');var fs_extra=require(_0x9a83('0x1'));var _=require(_0x9a83('0x2'));var querystring=require(_0x9a83('0x3'));var htmlToText=require(_0x9a83('0x4'));var Redis=require(_0x9a83('0x5'));var jayson=require(_0x9a83('0x6'));var url=require(_0x9a83('0x7'));var qs=require(_0x9a83('0x8'));var logger=require(_0x9a83('0x9'))(_0x9a83('0xa'));var config=require(_0x9a83('0xb'));var APIOutOfIntervalError=require(_0x9a83('0xc'))[_0x9a83('0xd')];var APINotFoundError=require(_0x9a83('0xc'))[_0x9a83('0xe')];var APIHandleError=require(_0x9a83('0xc'))['handleError'];var db=require('../../mysqldb')['db'];config[_0x9a83('0xf')]=_[_0x9a83('0x10')](config[_0x9a83('0xf')],{'host':_0x9a83('0x11'),'port':0x18eb});var socket=require(_0x9a83('0x12'))(new Redis(config[_0x9a83('0xf')]));require('./chatWebsite.socket')[_0x9a83('0x13')](socket);var client=jayson['client'][_0x9a83('0x14')]({'port':0x232c});var client9002=jayson['client'][_0x9a83('0x14')]({'port':0x232a});var client9003=jayson[_0x9a83('0x15')]['http']({'port':0x232b});var client9001=jayson[_0x9a83('0x15')][_0x9a83('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x137546,_0x5ba02e,_0x3d42df,_0x3de569){return new Promise(function(_0x5abae8,_0x31a394){var _0x27d874=_0x3de569||client;return _0x27d874[_0x9a83('0x16')](_0x137546,_0x3d42df)[_0x9a83('0x17')](function(_0x4cc616){logger['info'](_0x9a83('0x18'),_0x5ba02e,_0x9a83('0x19'));logger[_0x9a83('0x1a')](_0x9a83('0x1b'),_0x5ba02e,'request\x20sent',JSON['stringify'](_0x4cc616));if(_0x4cc616[_0x9a83('0x1c')]){if(_0x4cc616[_0x9a83('0x1c')][_0x9a83('0x1d')]===0x1f4){logger[_0x9a83('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x5ba02e,_0x4cc616[_0x9a83('0x1c')]['message']);return _0x31a394(_0x4cc616[_0x9a83('0x1c')][_0x9a83('0x1e')]);}logger['error'](_0x9a83('0x18'),_0x5ba02e,_0x4cc616[_0x9a83('0x1c')][_0x9a83('0x1e')]);return _0x5abae8(_0x4cc616[_0x9a83('0x1c')]['message']);}else{logger[_0x9a83('0x1f')](_0x9a83('0x18'),_0x5ba02e,_0x9a83('0x19'));_0x5abae8(_0x4cc616[_0x9a83('0x20')][_0x9a83('0x1e')]);}})[_0x9a83('0x21')](function(_0x37359b){logger[_0x9a83('0x1c')](_0x9a83('0x18'),_0x5ba02e,_0x37359b);_0x31a394(_0x37359b);});});}function respondWithStatusCode(_0x124402,_0x5ed55c){_0x5ed55c=_0x5ed55c||0xcc;return function(_0x4a885e){if(_0x4a885e){return _0x124402['sendStatus'](_0x5ed55c);}return _0x124402['status'](_0x5ed55c)[_0x9a83('0x22')]();};}function respondWithResult(_0x2d239d,_0x2d6a58){_0x2d6a58=_0x2d6a58||0xc8;return function(_0x316e5a){if(_0x316e5a){return _0x2d239d[_0x9a83('0x23')](_0x2d6a58)[_0x9a83('0x24')](_0x316e5a);}};}function respondWithFilteredResult(_0x288fbb,_0x57dc43){return function(_0x31b7b1){if(_0x31b7b1){var _0x385cf4=typeof _0x57dc43[_0x9a83('0x25')]===_0x9a83('0x26')&&typeof _0x57dc43[_0x9a83('0x27')]===_0x9a83('0x26');var _0x1fd97a=_0x31b7b1[_0x9a83('0x28')];var _0x52bd02=_0x385cf4?0x0:_0x57dc43[_0x9a83('0x25')];var _0x5ee2ee=_0x385cf4?_0x31b7b1[_0x9a83('0x28')]:_0x57dc43[_0x9a83('0x25')]+_0x57dc43[_0x9a83('0x27')];var _0x123ab7;if(_0x5ee2ee>=_0x1fd97a){_0x5ee2ee=_0x1fd97a;_0x123ab7=0xc8;}else{_0x123ab7=0xce;}_0x288fbb[_0x9a83('0x23')](_0x123ab7);return _0x288fbb[_0x9a83('0x29')](_0x9a83('0x2a'),_0x52bd02+'-'+_0x5ee2ee+'/'+_0x1fd97a)['json'](_0x31b7b1);}return null;};}function saveUpdates(_0x18daa9){return function(_0x2d3024){if(_0x2d3024){return _0x2d3024[_0x9a83('0x2b')](_0x18daa9)[_0x9a83('0x17')](function(_0x523101){return _0x523101;});}return null;};}function removeEntity(_0x130eee){return function(_0x5d2155){if(_0x5d2155){return _0x5d2155[_0x9a83('0x2c')]()[_0x9a83('0x17')](function(){var _0xaa2648=_0x5d2155['get']({'plain':!![]});var _0x217b4f=_0x9a83('0x2d');return db[_0x9a83('0x2e')][_0x9a83('0x2c')]({'where':{'type':_0x217b4f,'resourceId':_0xaa2648['id']}})[_0x9a83('0x17')](function(){return _0x5d2155;});})[_0x9a83('0x17')](function(){_0x130eee[_0x9a83('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7853){return function(_0x375045){if(!_0x375045){_0x2c7853[_0x9a83('0x2f')](0x194);}return _0x375045;};}function handleError(_0x22617a,_0x29b44f){_0x29b44f=_0x29b44f||0x1f4;return function(_0x1e1da7){logger['error'](_0x1e1da7['stack']);if(_0x1e1da7[_0x9a83('0x30')]){delete _0x1e1da7[_0x9a83('0x30')];}_0x22617a[_0x9a83('0x23')](_0x29b44f)[_0x9a83('0x31')](_0x1e1da7);};}function iftimePromise(_0x33bb91,_0x17453a){return respondWithRpcPromise(_0x9a83('0x32'),_0x9a83('0x33'),{'command':_0x17453a['timezone']?util[_0x9a83('0x34')](_0x9a83('0x35'),_0x33bb91['interval'],_0x17453a['timezone']):util['format']('iftime\x20%s',_0x33bb91[_0x9a83('0x36')])},client9002)[_0x9a83('0x17')](function(_0x2a8e98){var _0x188b4f=_0x2a8e98&&_0x2a8e98[_0x9a83('0x37')](_0x9a83('0x38'))>=0x0?!![]:![];logger['info'](_0x9a83('0x39'),_0x17453a['id'],_0x33bb91['id'],_0x33bb91[_0x9a83('0x36')],_0x188b4f?_0x9a83('0x3a'):_0x9a83('0x3b'),_0x17453a[_0x9a83('0x3c')]?_0x17453a['timezone']:_0x9a83('0x3d'));return _0x188b4f;})[_0x9a83('0x21')](function(_0xc34a74){logger[_0x9a83('0x1c')](_0x9a83('0x39'),_0x17453a['id'],_0x33bb91['id'],_0x33bb91[_0x9a83('0x36')],util[_0x9a83('0x3e')](_0xc34a74,{'showHidden':![],'depth':null}),_0x17453a['timezone']?_0x17453a['timezone']:_0x9a83('0x3d'));return![];});}function checkWebsiteIntervals(_0xede307){var _0x454cb4=_[_0x9a83('0x3f')](_0xede307[_0x9a83('0x40')][_0x9a83('0x41')],function(_0xaa10c0){var _0x34c928=_0xaa10c0[_0x9a83('0x42')]({'plain':!![]});return iftimePromise(_0x34c928,_0xede307);});return Promise['all'](_0x454cb4)[_0x9a83('0x17')](function(_0xe47ef7){return _[_0x9a83('0x43')](_0xe47ef7);});}function createInteractionObject(_0x2fa80b,_0x29b9b3,_0x21f4d3,_0x521834){var _0x1a6207=require('user-agent-parser');var _0x5eeb2a=new _0x1a6207();var _0x3c3ed4=_0x5eeb2a[_0x9a83('0x44')](_0x21f4d3[_0x9a83('0x45')])[_0x9a83('0x46')]();var _0x3a942d=_0x29b9b3[_0x9a83('0x47')];if(_0x21f4d3['cf-connecting-ip']){_0x3a942d=_0x21f4d3[_0x9a83('0x48')];}else if(_0x21f4d3[_0x9a83('0x49')]){_0x3a942d=_[_0x9a83('0x4a')](_0x21f4d3[_0x9a83('0x49')][_0x9a83('0x4b')](','));}return{'ContactId':_0x521834['id'],'ChatWebsiteId':_0x2fa80b,'from':(_0x521834[_0x9a83('0x4c')]||'')+'\x20'+(_0x521834[_0x9a83('0x4d')]||''),'customerIp':_0x3a942d,'customerPort':_0x21f4d3[_0x9a83('0x4e')]?_0x21f4d3[_0x9a83('0x4e')]:null,'referer':_0x29b9b3[_0x9a83('0x4f')],'browserName':_0x3c3ed4[_0x9a83('0x50')]['name']&&_0x3c3ed4['browser'][_0x9a83('0x51')]?util['format'](_0x9a83('0x52'),_0x3c3ed4['browser']['name'],_0x3c3ed4['browser']['version']):'unknown','browserVersion':_0x3c3ed4['browser'][_0x9a83('0x51')]||_0x9a83('0x53'),'osName':util[_0x9a83('0x34')]('%s\x20%s',_0x3c3ed4['os']['name'],_0x3c3ed4['os']['version']),'osVersion':_0x3c3ed4['os']['version'],'deviceModel':_0x3c3ed4[_0x9a83('0x54')]['model']&&_0x3c3ed4[_0x9a83('0x54')][_0x9a83('0x55')]?util['format']('%s\x20%s\x20%s',_0x3c3ed4[_0x9a83('0x54')][_0x9a83('0x56')],_0x3c3ed4[_0x9a83('0x54')]['vendor'],_0x3c3ed4[_0x9a83('0x54')][_0x9a83('0x57')]):null,'deviceVendor':_0x3c3ed4['device'][_0x9a83('0x55')],'deviceType':_0x3c3ed4[_0x9a83('0x54')][_0x9a83('0x57')],'formData':JSON[_0x9a83('0x58')](_0x29b9b3)};}exports[_0x9a83('0x59')]=function(_0x51f603,_0x130b60){var _0x5de7e5={'include':[{'model':db[_0x9a83('0x5a')],'as':'mandatoryDispositionPause'}]},_0x4203bf={},_0x4b9594={'count':0x0,'rows':[]};var _0x7b3fe9=_['map'](db[_0x9a83('0x5b')][_0x9a83('0x5c')],function(_0x1943b5){return{'name':_0x1943b5[_0x9a83('0x5d')],'type':_0x1943b5[_0x9a83('0x57')][_0x9a83('0x5e')]};});_0x4203bf[_0x9a83('0x56')]=_[_0x9a83('0x3f')](_0x7b3fe9,_0x9a83('0x30'));_0x4203bf[_0x9a83('0x5f')]=_[_0x9a83('0x60')](_0x51f603['query']);_0x4203bf[_0x9a83('0x61')]=_[_0x9a83('0x62')](_0x4203bf[_0x9a83('0x56')],_0x4203bf[_0x9a83('0x5f')]);_0x5de7e5[_0x9a83('0x63')]=_[_0x9a83('0x62')](_0x4203bf[_0x9a83('0x56')],qs[_0x9a83('0x64')](_0x51f603[_0x9a83('0x5f')][_0x9a83('0x64')]));_0x5de7e5['attributes']=_0x5de7e5[_0x9a83('0x63')][_0x9a83('0x65')]?_0x5de7e5[_0x9a83('0x63')]:_0x4203bf[_0x9a83('0x56')];if(!_0x51f603['query']['hasOwnProperty']('nolimit')){_0x5de7e5[_0x9a83('0x27')]=qs[_0x9a83('0x27')](_0x51f603[_0x9a83('0x5f')]['limit']);_0x5de7e5[_0x9a83('0x25')]=qs[_0x9a83('0x25')](_0x51f603[_0x9a83('0x5f')][_0x9a83('0x25')]);}_0x5de7e5[_0x9a83('0x66')]=qs['sort'](_0x51f603['query'][_0x9a83('0x67')]);_0x5de7e5['where']=qs['filters'](_['pick'](_0x51f603['query'],_0x4203bf['filters']),_0x7b3fe9);if(_0x51f603['query'][_0x9a83('0x68')]){_0x5de7e5[_0x9a83('0x69')]=_[_0x9a83('0x6a')](_0x5de7e5[_0x9a83('0x69')],{'$or':_[_0x9a83('0x3f')](_0x7b3fe9,function(_0x58966d){if(_0x58966d['type']!==_0x9a83('0x6b')){var _0x301cae={};_0x301cae[_0x58966d[_0x9a83('0x30')]]={'$like':'%'+_0x51f603[_0x9a83('0x5f')]['filter']+'%'};return _0x301cae;}})});}_0x5de7e5=_[_0x9a83('0x6a')]({},_0x5de7e5,_0x51f603[_0x9a83('0x6c')]);var _0x14ca11={'where':_0x5de7e5[_0x9a83('0x69')]};return db[_0x9a83('0x5b')][_0x9a83('0x28')](_0x14ca11)[_0x9a83('0x17')](function(_0x1804d3){_0x4b9594[_0x9a83('0x28')]=_0x1804d3;if(_0x51f603[_0x9a83('0x5f')][_0x9a83('0x6d')]){_0x5de7e5[_0x9a83('0x6e')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x5de7e5);})[_0x9a83('0x17')](function(_0x291c01){_0x4b9594[_0x9a83('0x6f')]=_0x291c01;return _0x4b9594;})['then'](respondWithFilteredResult(_0x130b60,_0x5de7e5))[_0x9a83('0x21')](handleError(_0x130b60,null));};exports[_0x9a83('0x70')]=function(_0x559689,_0x2b414b){var _0x377210={'raw':![],'where':{'id':_0x559689[_0x9a83('0x71')]['id']},'include':[{'model':db[_0x9a83('0x5a')],'as':_0x9a83('0x72')}]},_0x5ba9fc={};_0x5ba9fc[_0x9a83('0x56')]=_[_0x9a83('0x60')](db['ChatWebsite'][_0x9a83('0x5c')]);_0x5ba9fc['query']=_[_0x9a83('0x60')](_0x559689[_0x9a83('0x5f')]);_0x5ba9fc[_0x9a83('0x61')]=_[_0x9a83('0x62')](_0x5ba9fc[_0x9a83('0x56')],_0x5ba9fc[_0x9a83('0x5f')]);_0x377210[_0x9a83('0x63')]=_[_0x9a83('0x62')](_0x5ba9fc[_0x9a83('0x56')],qs['fields'](_0x559689[_0x9a83('0x5f')][_0x9a83('0x64')]));_0x377210[_0x9a83('0x63')]=_0x377210['attributes'][_0x9a83('0x65')]?_0x377210['attributes']:_0x5ba9fc['model'];if(_0x559689['query'][_0x9a83('0x6d')]){_0x377210['include']=[{'all':!![]}];}_0x377210=_[_0x9a83('0x6a')]({},_0x377210,_0x559689[_0x9a83('0x6c')]);return db['ChatWebsite'][_0x9a83('0x73')](_0x377210)[_0x9a83('0x17')](handleEntityNotFound(_0x2b414b,null))[_0x9a83('0x17')](respondWithResult(_0x2b414b,null))['catch'](handleError(_0x2b414b,null));};exports['create']=function(_0x3e62ad,_0x2d6763){return db[_0x9a83('0x5b')][_0x9a83('0x74')](_0x3e62ad[_0x9a83('0x75')],{})[_0x9a83('0x17')](function(_0x117870){var _0x304988=_0x3e62ad[_0x9a83('0x76')][_0x9a83('0x42')]({'plain':!![]});if(!_0x304988)throw new Error(_0x9a83('0x77'));if(_0x304988['role']===_0x9a83('0x76')){var _0x32d130=_0x117870[_0x9a83('0x42')]({'plain':!![]});var _0x4bab0a=_0x9a83('0x2d');return db[_0x9a83('0x78')][_0x9a83('0x73')]({'where':{'name':_0x4bab0a,'userProfileId':_0x304988[_0x9a83('0x79')]},'raw':!![]})[_0x9a83('0x17')](function(_0x685b81){if(_0x685b81&&_0x685b81[_0x9a83('0x7a')]===0x0){return db['UserProfileResource'][_0x9a83('0x74')]({'name':_0x32d130[_0x9a83('0x30')],'resourceId':_0x32d130['id'],'type':_0x685b81['name'],'sectionId':_0x685b81['id']},{})[_0x9a83('0x17')](function(){return _0x117870;});}else{return _0x117870;}})[_0x9a83('0x21')](function(_0x1026c9){logger['error'](_0x9a83('0x7b'),_0x1026c9);throw _0x1026c9;});}return _0x117870;})[_0x9a83('0x17')](respondWithResult(_0x2d6763,0xc9))[_0x9a83('0x21')](handleError(_0x2d6763,null));};exports['update']=function(_0x5a0710,_0xb7a7ae){if(_0x5a0710[_0x9a83('0x75')]['id']){delete _0x5a0710[_0x9a83('0x75')]['id'];}return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x5a0710[_0x9a83('0x71')]['id']},'include':[{'model':db['Pause'],'as':_0x9a83('0x72')}]})[_0x9a83('0x17')](handleEntityNotFound(_0xb7a7ae,null))['then'](saveUpdates(_0x5a0710[_0x9a83('0x75')],null))[_0x9a83('0x17')](respondWithResult(_0xb7a7ae,null))[_0x9a83('0x21')](handleError(_0xb7a7ae,null));};exports['destroy']=function(_0x5d13ef,_0x5992c4){return db[_0x9a83('0x5b')]['find']({'where':{'id':_0x5d13ef[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x5992c4,null))[_0x9a83('0x17')](removeEntity(_0x5992c4,null))['catch'](handleError(_0x5992c4,null));};exports[_0x9a83('0x7c')]=function(_0x13213e,_0x4207f7){return db['ChatWebsite']['describe']()[_0x9a83('0x17')](respondWithResult(_0x4207f7,null))[_0x9a83('0x21')](handleError(_0x4207f7,null));};exports[_0x9a83('0x7d')]=function(_0x2148f9,_0xd8ba40){if(_0x2148f9[_0x9a83('0x75')]['id']){delete _0x2148f9[_0x9a83('0x75')]['id'];}return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x2148f9[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0xd8ba40,null))['then'](function(_0x168a4b){if(_0x168a4b){_0x2148f9[_0x9a83('0x75')][_0x9a83('0x7e')]=_0x168a4b['id'];return db[_0x9a83('0x7f')][_0x9a83('0x74')](_0x2148f9['body']);}})[_0x9a83('0x17')](respondWithResult(_0xd8ba40,null))['catch'](handleError(_0xd8ba40,null));};exports['getDispositions']=function(_0x4a8285,_0x123c93){var _0x1de6f6={'raw':![],'where':{}};var _0xece10d={};var _0x2deb20={'count':0x0,'rows':[]};return db[_0x9a83('0x5b')][_0x9a83('0x80')]({'where':{'id':_0x4a8285[_0x9a83('0x71')]['id']}})['then'](handleEntityNotFound(_0x123c93,null))['then'](function(_0x4c0245){if(_0x4c0245){_0xece10d[_0x9a83('0x56')]=_['keys'](db[_0x9a83('0x7f')]['rawAttributes']);_0xece10d['query']=_['keys'](_0x4a8285[_0x9a83('0x5f')]);_0xece10d[_0x9a83('0x61')]=_['intersection'](_0xece10d[_0x9a83('0x56')],_0xece10d[_0x9a83('0x5f')]);_0x1de6f6['attributes']=_['intersection'](_0xece10d[_0x9a83('0x56')],qs[_0x9a83('0x64')](_0x4a8285[_0x9a83('0x5f')]['fields']));_0x1de6f6[_0x9a83('0x63')]=_0x1de6f6[_0x9a83('0x63')][_0x9a83('0x65')]?_0x1de6f6[_0x9a83('0x63')]:_0xece10d[_0x9a83('0x56')];if(!_0x4a8285[_0x9a83('0x5f')][_0x9a83('0x81')](_0x9a83('0x82'))){_0x1de6f6[_0x9a83('0x27')]=qs[_0x9a83('0x27')](_0x4a8285[_0x9a83('0x5f')]['limit']);_0x1de6f6['offset']=qs[_0x9a83('0x25')](_0x4a8285[_0x9a83('0x5f')]['offset']);}_0x1de6f6[_0x9a83('0x66')]=qs[_0x9a83('0x67')](_0x4a8285[_0x9a83('0x5f')]['sort']);_0x1de6f6[_0x9a83('0x69')]=qs[_0x9a83('0x61')](_[_0x9a83('0x83')](_0x4a8285['query'],_0xece10d[_0x9a83('0x61')]));_0x1de6f6['where'][_0x9a83('0x7e')]=_0x4c0245['id'];if(_0x4a8285['query'][_0x9a83('0x68')]){_0x1de6f6[_0x9a83('0x69')]=_[_0x9a83('0x6a')](_0x1de6f6[_0x9a83('0x69')],{'$or':_['map'](_0x1de6f6[_0x9a83('0x63')],function(_0x5ffbcd){var _0x411a61={};_0x411a61[_0x5ffbcd]={'$like':'%'+_0x4a8285[_0x9a83('0x5f')][_0x9a83('0x68')]+'%'};return _0x411a61;})});}_0x1de6f6=_[_0x9a83('0x6a')]({},_0x1de6f6,_0x4a8285[_0x9a83('0x6c')]);return db[_0x9a83('0x7f')][_0x9a83('0x28')]({'where':_0x1de6f6[_0x9a83('0x69')]})['then'](function(_0x49a474){_0x2deb20[_0x9a83('0x28')]=_0x49a474;if(_0x4a8285[_0x9a83('0x5f')][_0x9a83('0x6d')]){_0x1de6f6[_0x9a83('0x6e')]=[{'all':!![]}];}return db[_0x9a83('0x7f')][_0x9a83('0x84')](_0x1de6f6);})[_0x9a83('0x17')](function(_0x5b45b1){_0x2deb20[_0x9a83('0x6f')]=_0x5b45b1;return _0x2deb20;});}})[_0x9a83('0x17')](respondWithFilteredResult(_0x123c93,_0x1de6f6))['catch'](handleError(_0x123c93,null));};exports['removeDispositions']=function(_0x3ffc42,_0x4ea73d){return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x3ffc42[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x4ea73d,null))[_0x9a83('0x17')](function(_0x3d3d4d){if(_0x3d3d4d){return _0x3d3d4d['removeDispositions'](_0x3ffc42[_0x9a83('0x5f')][_0x9a83('0x85')]);}})[_0x9a83('0x17')](respondWithStatusCode(_0x4ea73d,null))[_0x9a83('0x21')](handleError(_0x4ea73d,null));};exports[_0x9a83('0x86')]=function(_0x6b9e51,_0x343466){if(_0x6b9e51['body']['id']){delete _0x6b9e51[_0x9a83('0x75')]['id'];}return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x6b9e51[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x343466,null))['then'](function(_0x836c40){if(_0x836c40){_0x6b9e51[_0x9a83('0x75')]['ChatWebsiteId']=_0x836c40['id'];return db[_0x9a83('0x87')]['create'](_0x6b9e51[_0x9a83('0x75')]);}})[_0x9a83('0x17')](respondWithResult(_0x343466,null))['catch'](handleError(_0x343466,null));};exports[_0x9a83('0x88')]=function(_0x1872cf,_0xd8d851){var _0x4821eb={'raw':![],'where':{}};var _0x122932={};var _0x4758ff={'count':0x0,'rows':[]};return db[_0x9a83('0x5b')][_0x9a83('0x80')]({'where':{'id':_0x1872cf['params']['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0xd8d851,null))['then'](function(_0x936630){if(_0x936630){_0x122932[_0x9a83('0x56')]=_[_0x9a83('0x60')](db[_0x9a83('0x87')]['rawAttributes']);_0x122932['query']=_[_0x9a83('0x60')](_0x1872cf[_0x9a83('0x5f')]);_0x122932[_0x9a83('0x61')]=_['intersection'](_0x122932[_0x9a83('0x56')],_0x122932['query']);_0x4821eb[_0x9a83('0x63')]=_[_0x9a83('0x62')](_0x122932[_0x9a83('0x56')],qs['fields'](_0x1872cf[_0x9a83('0x5f')]['fields']));_0x4821eb[_0x9a83('0x63')]=_0x4821eb[_0x9a83('0x63')]['length']?_0x4821eb['attributes']:_0x122932['model'];if(!_0x1872cf[_0x9a83('0x5f')]['hasOwnProperty'](_0x9a83('0x82'))){_0x4821eb[_0x9a83('0x27')]=qs[_0x9a83('0x27')](_0x1872cf[_0x9a83('0x5f')][_0x9a83('0x27')]);_0x4821eb[_0x9a83('0x25')]=qs[_0x9a83('0x25')](_0x1872cf[_0x9a83('0x5f')]['offset']);}_0x4821eb[_0x9a83('0x66')]=qs[_0x9a83('0x67')](_0x1872cf['query'][_0x9a83('0x67')]);_0x4821eb[_0x9a83('0x69')]=qs[_0x9a83('0x61')](_[_0x9a83('0x83')](_0x1872cf[_0x9a83('0x5f')],_0x122932['filters']));_0x4821eb[_0x9a83('0x69')]['ChatWebsiteId']=_0x936630['id'];if(_0x1872cf[_0x9a83('0x5f')][_0x9a83('0x68')]){_0x4821eb['where']=_[_0x9a83('0x6a')](_0x4821eb[_0x9a83('0x69')],{'$or':_[_0x9a83('0x3f')](_0x4821eb['attributes'],function(_0x4a0bff){var _0x35e254={};_0x35e254[_0x4a0bff]={'$like':'%'+_0x1872cf[_0x9a83('0x5f')][_0x9a83('0x68')]+'%'};return _0x35e254;})});}_0x4821eb=_[_0x9a83('0x6a')]({},_0x4821eb,_0x1872cf['options']);return db[_0x9a83('0x87')][_0x9a83('0x28')]({'where':_0x4821eb[_0x9a83('0x69')]})[_0x9a83('0x17')](function(_0x3cfca5){_0x4758ff[_0x9a83('0x28')]=_0x3cfca5;if(_0x1872cf[_0x9a83('0x5f')]['includeAll']){_0x4821eb['include']=[{'all':!![]}];}return db[_0x9a83('0x87')][_0x9a83('0x84')](_0x4821eb);})[_0x9a83('0x17')](function(_0x2b9f95){_0x4758ff['rows']=_0x2b9f95;return _0x4758ff;});}})[_0x9a83('0x17')](respondWithFilteredResult(_0xd8d851,_0x4821eb))[_0x9a83('0x21')](handleError(_0xd8d851,null));};exports['removeAnswers']=function(_0x143960,_0xce8463){return db[_0x9a83('0x5b')]['find']({'where':{'id':_0x143960[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0xce8463,null))[_0x9a83('0x17')](function(_0x11066f){if(_0x11066f){return _0x11066f[_0x9a83('0x89')](_0x143960['query'][_0x9a83('0x85')]);}})[_0x9a83('0x17')](respondWithStatusCode(_0xce8463,null))[_0x9a83('0x21')](handleError(_0xce8463,null));};exports[_0x9a83('0x8a')]=function(_0x13c525,_0x42ef60){_0x13c525[_0x9a83('0x75')][_0x9a83('0x8b')]=_0x13c525[_0x9a83('0x8c')][_0x9a83('0x8d')];return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x13c525['params']['id']}})['then'](handleEntityNotFound(_0x42ef60,null))[_0x9a83('0x17')](saveUpdates(_0x13c525[_0x9a83('0x75')],null))[_0x9a83('0x17')](respondWithResult(_0x42ef60,null))[_0x9a83('0x21')](handleError(_0x42ef60,null));};exports[_0x9a83('0x8e')]=function(_0xc3e4b7,_0x3b4863){_0xc3e4b7[_0x9a83('0x75')][_0x9a83('0x8f')]=_0xc3e4b7[_0x9a83('0x8c')][_0x9a83('0x8d')];return db['ChatWebsite'][_0x9a83('0x73')]({'where':{'id':_0xc3e4b7[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x3b4863,null))[_0x9a83('0x17')](saveUpdates(_0xc3e4b7[_0x9a83('0x75')],null))['then'](respondWithResult(_0x3b4863,null))[_0x9a83('0x21')](handleError(_0x3b4863,null));};exports[_0x9a83('0x90')]=function(_0x4711e2,_0x4b5710){_0x4711e2['body'][_0x9a83('0x91')]=_0x4711e2['file'][_0x9a83('0x8d')];return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x4711e2[_0x9a83('0x71')]['id']}})['then'](handleEntityNotFound(_0x4b5710,null))[_0x9a83('0x17')](saveUpdates(_0x4711e2['body'],null))[_0x9a83('0x17')](respondWithResult(_0x4b5710,null))[_0x9a83('0x21')](handleError(_0x4b5710,null));};exports[_0x9a83('0x92')]=function(_0x1740b9,_0x2bdd44){_0x1740b9[_0x9a83('0x75')]['systemAvatar']=_0x1740b9[_0x9a83('0x8c')][_0x9a83('0x8d')];return db['ChatWebsite'][_0x9a83('0x73')]({'where':{'id':_0x1740b9[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x2bdd44,null))[_0x9a83('0x17')](saveUpdates(_0x1740b9[_0x9a83('0x75')],null))['then'](respondWithResult(_0x2bdd44,null))[_0x9a83('0x21')](handleError(_0x2bdd44,null));};exports['getLogo']=function(_0x1881d0,_0x1b55a6){var _0x511793=path[_0x9a83('0x93')](config[_0x9a83('0x94')],_0x9a83('0x95'));var _0xb5225c={'where':{'id':_0x1881d0['params']['id']},'attributes':['id',_0x9a83('0x8b')],'raw':!![]};var _0x48afee=![];return require(_0x9a83('0x96'))[_0x9a83('0x97')]()[_0x9a83('0x17')](function(_0x205932){if(_0x205932){_0x48afee=_0x205932['custom'];}})[_0x9a83('0x17')](function(){return db[_0x9a83('0x5b')][_0x9a83('0x73')](_0xb5225c);})[_0x9a83('0x17')](handleEntityNotFound(_0x1b55a6,null))['then'](function(_0x36ad63){if(_0x36ad63){if(!_['isNil'](_0x36ad63[_0x9a83('0x8b')])){if(fs[_0x9a83('0x98')](path[_0x9a83('0x93')](config['root'],_0x9a83('0x99'),_0x36ad63[_0x9a83('0x8b')]))&&_0x48afee){_0x511793=path[_0x9a83('0x93')](config['root'],_0x9a83('0x99'),_0x36ad63['sitepic']);}}return _0x1b55a6['download'](_0x511793);}})[_0x9a83('0x21')](handleError(_0x1b55a6,null));};exports['getAvatar']=function(_0x8c5db0,_0x2d5120){var _0x544cff=path[_0x9a83('0x93')](config[_0x9a83('0x94')],_0x9a83('0x9a'));var _0x537f42={'where':{'id':_0x8c5db0[_0x9a83('0x71')]['id']},'attributes':['id',_0x9a83('0x8f')],'raw':!![]};return db[_0x9a83('0x5b')][_0x9a83('0x73')](_0x537f42)[_0x9a83('0x17')](handleEntityNotFound(_0x2d5120,null))[_0x9a83('0x17')](function(_0x2d3b04){if(_0x2d3b04){if(!_['isNil'](_0x2d3b04[_0x9a83('0x8f')])){if(fs[_0x9a83('0x98')](path[_0x9a83('0x93')](config[_0x9a83('0x94')],'server/files/images/avatars/',_0x2d3b04[_0x9a83('0x8f')]))){_0x544cff=path[_0x9a83('0x93')](config['root'],_0x9a83('0x9b'),_0x2d3b04[_0x9a83('0x8f')]);}}return _0x2d5120[_0x9a83('0x9c')](_0x544cff);}})[_0x9a83('0x21')](handleError(_0x2d5120,null));};exports[_0x9a83('0x9d')]=function(_0xbd7962,_0x20cc08){var _0xe9363d=path[_0x9a83('0x93')](config['root'],_0x9a83('0x9e'));var _0x4fa6c1={'where':{'id':_0xbd7962[_0x9a83('0x71')]['id']},'attributes':['id',_0x9a83('0x91'),'showCustomerAvatar'],'raw':!![]};return db[_0x9a83('0x5b')][_0x9a83('0x73')](_0x4fa6c1)[_0x9a83('0x17')](handleEntityNotFound(_0x20cc08,null))['then'](function(_0x44196f){if(_0x44196f){if(!_[_0x9a83('0x9f')](_0x44196f['customerAvatar'])){if(fs['existsSync'](path[_0x9a83('0x93')](config['root'],_0x9a83('0x9b'),_0x44196f[_0x9a83('0x91')]))&&_0x44196f['showCustomerAvatar']){_0xe9363d=path['join'](config[_0x9a83('0x94')],_0x9a83('0x9b'),_0x44196f['customerAvatar']);}}return _0x20cc08[_0x9a83('0x9c')](_0xe9363d);}})[_0x9a83('0x21')](handleError(_0x20cc08,null));};exports[_0x9a83('0xa0')]=function(_0x482a56,_0x33528a){var _0x1abdd5=path[_0x9a83('0x93')](config[_0x9a83('0x94')],'server/files/images/avatars/system_avatar.png');var _0x27b3c6={'where':{'id':_0x482a56[_0x9a83('0x71')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x9a83('0x5b')][_0x9a83('0x73')](_0x27b3c6)[_0x9a83('0x17')](handleEntityNotFound(_0x33528a,null))[_0x9a83('0x17')](function(_0x45f664){if(_0x45f664){if(!_[_0x9a83('0x9f')](_0x45f664['systemAvatar'])){if(fs['existsSync'](path[_0x9a83('0x93')](config[_0x9a83('0x94')],_0x9a83('0x9b'),_0x45f664[_0x9a83('0xa1')]))){_0x1abdd5=path[_0x9a83('0x93')](config[_0x9a83('0x94')],_0x9a83('0x9b'),_0x45f664['systemAvatar']);}}return _0x33528a[_0x9a83('0x9c')](_0x1abdd5);}})[_0x9a83('0x21')](handleError(_0x33528a,null));};exports['notify']=function(_0x28238,_0x5bb23a){var _0x3394eb={'body':_0x28238[_0x9a83('0x75')],'channel':_0x9a83('0xa2')};var _0x22015f=[];var _0x24b970=[];var _0x465a13={};var _0x253b9e=![];return db[_0x9a83('0xa3')][_0x9a83('0x7c')]()[_0x9a83('0x17')](function(_0x3158dd){if(!_0x3158dd){throw new db[(_0x9a83('0xa4'))][(_0x9a83('0xa5'))](_0x9a83('0xa6'));}_0x22015f=_[_0x9a83('0xa7')](_[_0x9a83('0x60')](_0x3158dd),[_0x9a83('0xa8'),_0x9a83('0xa9')]);_0x24b970=_[_0x9a83('0xa7')](_['keys'](_0x3158dd),[_0x9a83('0xa8'),_0x9a83('0xa9'),_0x9a83('0xaa'),_0x9a83('0xab')]);if(_0x28238['body']['id']){delete _0x28238['body']['id'];}if(_[_0x9a83('0x9f')](_0x28238[_0x9a83('0x75')][_0x9a83('0xac')])){throw new db[(_0x9a83('0xa4'))]['ValidationError'](_0x9a83('0xad'));}if(_[_0x9a83('0x9f')](_0x28238[_0x9a83('0x75')][_0x9a83('0x75')])||_0x28238[_0x9a83('0x75')][_0x9a83('0x75')]===''){throw new db[(_0x9a83('0xa4'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x28238[_0x9a83('0x75')][_0x9a83('0xae')])){throw new db['Sequelize'][(_0x9a83('0xa5'))](_0x9a83('0xaf')+_0x24b970);}if(!_[_0x9a83('0xb0')](_0x24b970,_0x28238[_0x9a83('0x75')][_0x9a83('0xae')])){throw new db['Sequelize'][(_0x9a83('0xa5'))](_0x9a83('0xb1')+_0x24b970);}_0x465a13[_0x28238['body'][_0x9a83('0xae')]]=_0x28238[_0x9a83('0x75')][_0x9a83('0xac')];})[_0x9a83('0x17')](function(){return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x28238['params']['id']},'include':[{'model':db['CmList'],'as':_0x9a83('0xb2'),'include':[{'model':db['CmContact'],'as':_0x9a83('0xb3'),'where':_0x465a13,'limit':0x1,'order':[[_0x9a83('0xa9'),'DESC']]}]},{'model':db[_0x9a83('0xb4')],'as':_0x9a83('0xb5')},{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':_0x9a83('0x41'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x9a83('0x17')](function(_0x23733c){if(!_0x23733c)throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x28238[_0x9a83('0x71')]['id']));if(!_0x23733c['Interval']||!_0x23733c[_0x9a83('0x40')][_0x9a83('0x41')])return[_0x23733c,!![]];return[_0x23733c,checkWebsiteIntervals(_0x23733c)];})['spread'](function(_0x4526e9,_0x5a92ee){if(!_0x5a92ee)throw new APIOutOfIntervalError();if(!_0x4526e9[_0x9a83('0xb2')])return;_0x3394eb[_0x9a83('0xb6')]=_0x4526e9;_0x3394eb[_0x9a83('0xb7')]=_0x4526e9['List'];_0x3394eb[_0x9a83('0xb8')]=_[_0x9a83('0xb9')](_0x4526e9[_0x9a83('0xb5')],['priority'],[_0x9a83('0xba')]);if(_0x3394eb[_0x9a83('0xb6')][_0x9a83('0xb5')]){delete _0x3394eb['account']['Applications'];}if(_0x3394eb[_0x9a83('0xb6')][_0x9a83('0xb2')]&&_0x3394eb[_0x9a83('0xb6')][_0x9a83('0xb2')][_0x9a83('0xb3')][_0x9a83('0x65')]){return _0x3394eb[_0x9a83('0xb6')]['List']['Contacts'][0x0];}var _0x40aea5=_['defaults'](_0x28238[_0x9a83('0x75')],{'firstName':_0x28238[_0x9a83('0x75')]['from'],'ListId':_0x4526e9[_0x9a83('0xab')]});_0x40aea5[_0x28238[_0x9a83('0x75')][_0x9a83('0xae')]]=_0x28238[_0x9a83('0x75')][_0x9a83('0xac')];return db[_0x9a83('0xa3')]['create'](_0x40aea5,{'fields':_0x22015f,'raw':!![]});})['then'](function(_0x40db92){_0x3394eb[_0x9a83('0xbb')]=_0x40db92;var _0x405810=createInteractionObject(_0x28238['params']['id'],_0x28238[_0x9a83('0x75')],_0x28238[_0x9a83('0xbc')],_0x40db92);var _0x2d8dc1={'ChatWebsiteId':_0x28238[_0x9a83('0x71')]['id'],'closed':![]};if(_0x28238[_0x9a83('0x75')][_0x9a83('0xbd')]){_0x2d8dc1['threadId']=_0x28238[_0x9a83('0x75')][_0x9a83('0xbd')];return db[_0x9a83('0xbe')][_0x9a83('0x73')]({'where':_0x2d8dc1})['then'](function(_0x1ff504){if(_0x1ff504){_0x253b9e=!![];return _0x1ff504;}_0x405810[_0x9a83('0xbd')]=_0x28238[_0x9a83('0x75')]['threadId'];_0x405810[_0x9a83('0xbf')]=_0x28238[_0x9a83('0x75')][_0x9a83('0xbf')];return db[_0x9a83('0xbe')]['create'](_0x405810);});}_0x2d8dc1[_0x9a83('0xc0')]=_0x40db92['id'];if(_0x28238[_0x9a83('0x75')][_0x9a83('0xc1')]&&_0x28238[_0x9a83('0x75')][_0x9a83('0xc1')]['id']){_0x2d8dc1['id']=_0x28238[_0x9a83('0x75')][_0x9a83('0xc1')]['id'];return db[_0x9a83('0xbe')][_0x9a83('0x73')]({'where':_0x2d8dc1})[_0x9a83('0x17')](function(_0x432357){if(_0x432357){_0x253b9e=!![];return _0x432357;}return db[_0x9a83('0xbe')]['create'](_0x405810);});}return db[_0x9a83('0xbe')][_0x9a83('0x74')](_0x405810);})['then'](function(_0x9c1361){if(!_0x253b9e)return _0x9c1361;var _0x451906={'from':(_0x3394eb[_0x9a83('0xbb')][_0x9a83('0x4c')]||'')+'\x20'+(_0x3394eb['contact'][_0x9a83('0x4d')]||'')};if(_0x28238[_0x9a83('0x75')][_0x9a83('0xbd')]&&_0x28238['body'][_0x9a83('0xc2')]&&_0x28238['body'][_0x9a83('0xbd')]!=_0x28238[_0x9a83('0x75')]['messageId']){_0x451906[_0x9a83('0xbd')]=_0x28238[_0x9a83('0x75')][_0x9a83('0xc2')];}return _0x9c1361[_0x9a83('0x2b')](_0x451906);})[_0x9a83('0x17')](function(_0x2cf3e4){_0x3394eb[_0x9a83('0xc1')]=_0x2cf3e4[_0x9a83('0x42')]({'plain':!![]});_0x3394eb[_0x9a83('0xc1')][_0x9a83('0xc3')]=!_0x253b9e;if(_0x3394eb['interaction'][_0x9a83('0xc3')]){if(_0x3394eb[_0x9a83('0xb6')]['autoclose']){_0x3394eb[_0x9a83('0xb8')][_0x9a83('0xc4')]({'id':0x0,'priority':_0x3394eb['applications'][_0x9a83('0x65')]+0x1,'app':_0x9a83('0xc5'),'appdata':_0x9a83('0xc6'),'interval':_0x9a83('0xc7')});}}return db[_0x9a83('0xc8')]['create']({'body':_0x28238[_0x9a83('0x75')][_0x9a83('0x75')],'ChatWebsiteId':_0x28238[_0x9a83('0x71')]['id'],'ChatInteractionId':_0x2cf3e4['id'],'direction':'in','ContactId':_0x3394eb['contact']['id'],'AttachmentId':_0x28238[_0x9a83('0x75')][_0x9a83('0xc9')]});})[_0x9a83('0x17')](function(_0xa67e79){_0x3394eb[_0x9a83('0x1e')]=_0xa67e79;if(!_0x3394eb[_0x9a83('0xc1')][_0x9a83('0xca')]){return;}return db['User'][_0x9a83('0x73')]({'attributes':['id',_0x9a83('0x30')],'where':{'id':_0x3394eb[_0x9a83('0xc1')]['UserId']}});})[_0x9a83('0x17')](function(_0x19a347){if(_0x19a347){_0x3394eb[_0x9a83('0xb8')][_0x9a83('0xcb')]({'id':0x0,'priority':0x0,'app':_0x9a83('0xcc'),'appdata':_0x19a347[_0x9a83('0x30')]+','+(_0x3394eb[_0x9a83('0xb6')][_0x9a83('0xcd')]||0xa),'interval':_0x9a83('0xc7')});_0x3394eb[_0x9a83('0xce')]=!![];}if(!_0x3394eb[_0x9a83('0xc1')][_0x9a83('0xcf')]){return;}return db[_0x9a83('0xd0')][_0x9a83('0x73')]({'attributes':['id','name'],'where':{'id':_0x3394eb['interaction'][_0x9a83('0xcf')]}});})['then'](function(_0x449d34){if(_0x449d34){_0x3394eb[_0x9a83('0xb8')][_0x9a83('0xcb')]({'id':0x0,'priority':0x1,'app':_0x9a83('0xd1'),'appdata':_0x449d34['name']+','+(_0x3394eb['account'][_0x9a83('0xd2')]||0x12c),'interval':_0x9a83('0xc7')});}return respondWithRpcPromise('Start','startRouting',_0x3394eb);})[_0x9a83('0x17')](function(_0x124cee){respondWithRpcPromise(_0x9a83('0xd3'),_0x9a83('0xd3'),{'event':_0x9a83('0xd4'),'message':_0x124cee},client9002);return _0x124cee;})[_0x9a83('0x17')](respondWithResult(_0x5bb23a,null))[_0x9a83('0x21')](APIHandleError(_0x5bb23a));};exports[_0x9a83('0xd5')]=function(_0x2449a7,_0x168122){var _0x143771,_0x588b42,_0x414cea;var _0x3bd9d3=[];var _0x560684={};var _0x54af67=_0x2449a7['files']||[];var _0x5e73f0=[];var _0x11b87f;return db[_0x9a83('0xa3')][_0x9a83('0x7c')]()[_0x9a83('0x17')](function(_0x55b161){if(!_0x55b161){throw new db[(_0x9a83('0xa4'))][(_0x9a83('0xa5'))]('no\x20available\x20attributes');}_0x3bd9d3=_[_0x9a83('0xa7')](_['keys'](_0x55b161),['createdAt',_0x9a83('0xa9'),'CompanyId',_0x9a83('0xab')]);if(_0x2449a7[_0x9a83('0x75')]['id']){delete _0x2449a7[_0x9a83('0x75')]['id'];}if(_[_0x9a83('0x9f')](_0x2449a7[_0x9a83('0x75')][_0x9a83('0xac')])){throw _0x168122[_0x9a83('0x23')](0x1f4)[_0x9a83('0x31')](new db[(_0x9a83('0xa4'))]['ValidationError'](_0x9a83('0xad')));}if(_['isNil'](_0x2449a7[_0x9a83('0x75')]['body'])||_0x2449a7[_0x9a83('0x75')][_0x9a83('0x75')]===''){throw _0x168122[_0x9a83('0x23')](0x1f4)[_0x9a83('0x31')](new db[(_0x9a83('0xa4'))][(_0x9a83('0xa5'))](_0x9a83('0xd6')));}if(_['isNil'](_0x2449a7[_0x9a83('0x75')]['mapKeyOffline'])){throw _0x168122[_0x9a83('0x23')](0x1f4)['send'](new db[(_0x9a83('0xa4'))][(_0x9a83('0xa5'))](_0x9a83('0xd7')+_0x3bd9d3));}if(!_[_0x9a83('0xb0')](_0x3bd9d3,_0x2449a7[_0x9a83('0x75')][_0x9a83('0xd8')])){throw _0x168122[_0x9a83('0x23')](0x1f4)['send'](new db[(_0x9a83('0xa4'))][(_0x9a83('0xa5'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3bd9d3));}_0x560684[_0x2449a7['body'][_0x9a83('0xd8')]]=_0x2449a7[_0x9a83('0x75')][_0x9a83('0xac')];})[_0x9a83('0x17')](function(){return db[_0x9a83('0x5b')]['find']({'where':{'id':_0x2449a7[_0x9a83('0x71')]['id']},'include':[{'model':db['CmList'],'as':_0x9a83('0xb2')},{'model':db[_0x9a83('0xd9')],'as':_0x9a83('0xd9')}]});})[_0x9a83('0x17')](handleEntityNotFound(_0x168122,null))[_0x9a83('0x17')](function(_0x4e28ef){if(_0x4e28ef&&_0x4e28ef[_0x9a83('0xb2')]){_0x588b42=_0x4e28ef;var _0xdb184f=_[_0x9a83('0x10')](_0x2449a7[_0x9a83('0x75')],{'firstName':_0x2449a7[_0x9a83('0x75')][_0x9a83('0xac')],'phone':_0x2449a7['body'][_0x9a83('0xac')],'ListId':_0x4e28ef[_0x9a83('0xab')]});_0xdb184f[_0x2449a7[_0x9a83('0x75')][_0x9a83('0xd8')]]=_0x2449a7[_0x9a83('0x75')][_0x9a83('0xac')];return db[_0x9a83('0xa3')]['findOrCreate']({'where':_0x560684,'defaults':_0xdb184f});}})[_0x9a83('0xda')](function(_0x2c2d84){if(_0x2c2d84){_0x414cea=_0x2c2d84;var _0x25b065=fs[_0x9a83('0xdb')](path['join'](config[_0x9a83('0x94')],_0x9a83('0xdc')),_0x9a83('0xdd'));var _0x247905=ejs[_0x9a83('0xde')](_0x25b065,{'body':_[_0x9a83('0xdf')](_0x2449a7[_0x9a83('0x75')]['body']),'bodyTitle':_0x588b42[_0x9a83('0xe0')]});return db['ChatOfflineMessage'][_0x9a83('0x74')]({'body':_0x247905,'plainBody':htmlToText['fromString'](_0x247905),'ContactId':_0x2c2d84['id'],'ChatWebsiteId':_0x588b42['id']});}})['then'](function(_0x54358a){_0x11b87f=_0x54358a;if(_0x54af67[_0x9a83('0x65')]){var _0x2a2e4a=_0x54af67['map'](function(_0x1ab89f){return{'name':_0x1ab89f[_0x9a83('0xe1')],'basename':_0x1ab89f[_0x9a83('0x8d')],'type':_0x1ab89f['mimetype'],'ChatOfflineMessageId':_0x54358a['id']};});_0x5e73f0=_0x2a2e4a[_0x9a83('0x3f')](_0x1398f8=>{var _0x41c971={'filename':_0x1398f8[_0x9a83('0x30')],'path':path[_0x9a83('0x93')](config['root'],_0x9a83('0xe2'),_0x9a83('0xe3'),_0x9a83('0xe4'),_0x9a83('0xe5'),_0x1398f8[_0x9a83('0xe6')])};return _0x41c971;});if(!_0x588b42[_0x9a83('0xe7')]){return db[_0x9a83('0xe8')][_0x9a83('0xe9')](function(_0x2251f9){return db['Attachment'][_0x9a83('0xea')](_0x2a2e4a,{'transaction':_0x2251f9});});}}})[_0x9a83('0x17')](function(){if(_0x11b87f){_0x143771=_0x11b87f;return db[_0x9a83('0xd9')][_0x9a83('0x80')]({'where':{'service':!![]},'include':[{'model':db[_0x9a83('0xeb')],'as':_0x9a83('0xec'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x9a83('0xed'),'raw':!![]}]}]});}})[_0x9a83('0x17')](function(_0x201818){if(_0x201818&&_0x201818['Smtp']&&_0x588b42['forwardOffline']&&_0x588b42['forwardOfflineAddress']){var _0x39ab87=_0x201818[_0x9a83('0xee')]();return respondWithRpcPromise(_0x9a83('0xef'),_0x9a83('0xf0'),{'account':_0x39ab87,'message':{'from':util[_0x9a83('0x34')](_0x9a83('0xf1'),_0x201818[_0x9a83('0x30')],_0x201818[_0x9a83('0xf2')]||_0x201818[_0x9a83('0xec')][_0x9a83('0x76')]),'to':_0x588b42[_0x9a83('0xf3')],'subject':_0x588b42[_0x9a83('0xf4')],'html':_0x143771[_0x9a83('0x75')],'attachments':_0x5e73f0}},client9003)[_0x9a83('0x17')](function(){return _0x143771;})['catch'](function(_0x104f57){logger[_0x9a83('0x1c')](_0x104f57);});}})[_0x9a83('0x17')](function(){if(_0x588b42&&_0x588b42[_0x9a83('0xe7')]&&_0x588b42[_0x9a83('0xf5')]){var _0x3133ef=[];if(_0x54af67[_0x9a83('0x65')]){_0x3133ef=_0x54af67[_0x9a83('0x3f')](function(_0x275257){return{'name':_0x275257[_0x9a83('0xe1')],'basename':_0x275257['filename'],'type':_0x275257[_0x9a83('0xf6')],'ChatOfflineMessageId':_0x11b87f['id']};});}var _0x3d05ad;if(!_['isNil'](_0x588b42[_0x9a83('0xf7')])){var _0x38534b=_[_0x9a83('0x3f')](_0x2449a7[_0x9a83('0x75')],function(_0x23c1ef){return _0x23c1ef;});var _0x4e0d15=_['toPairsIn'](_0x38534b)[0x0];var _0x418ae3=_[_0x9a83('0xf8')](_0x4e0d15,function(_0x44b62f){return _0x44b62f;});_0x3d05ad=_0x418ae3[0x1][_0x588b42[_0x9a83('0xf7')]];}var _0x2ff550={'from':_0x414cea[_0x9a83('0xf2')],'firstName':_0x414cea['firstName'],'lastName':_0x414cea[_0x9a83('0x4d')],'mapKey':_0x9a83('0xf2'),'message':{'from':_0x414cea[_0x9a83('0xf2')],'to':_0x588b42[_0x9a83('0xd9')][_0x9a83('0xf2')],'cc':'','subject':_[_0x9a83('0x9f')](_0x3d05ad)?_0x588b42[_0x9a83('0xf4')]:_0x3d05ad,'messageId':'','sentAt':new Date(),'attach':_0x3133ef[_0x9a83('0x65')],'attachments':_0x3133ef,'originChannel':'Chat','ChatWebsiteId':_0x588b42['id'],'ChatOfflineMessageId':_0x143771['id'],'originTo':_0x588b42['MailAccount'][_0x9a83('0xf2')]},'body':_0x143771[_0x9a83('0x75')]};var _0x55253c={'account':{'id':_0x588b42[_0x9a83('0xf5')]},'body':_0x2ff550,'log':_0x9a83('0xf9')};return respondWithRpcPromise(_0x9a83('0xf9'),'notifyMail',_0x55253c,client9001)[_0x9a83('0x17')](function(){return _0x143771;})[_0x9a83('0x21')](function(_0x520ad8){logger[_0x9a83('0x1c')](_0x520ad8);});}return;})[_0x9a83('0x17')](function(){if(_0x143771){return _0x143771;}})[_0x9a83('0x17')](respondWithResult(_0x168122,null))[_0x9a83('0x21')](function(){for(var _0x25db11 of _0x54af67){var _0x414093=path[_0x9a83('0x93')](config[_0x9a83('0x94')],_0x9a83('0xe2'),'files',_0x9a83('0xe4'),_0x9a83('0xe5'),_0x25db11[_0x9a83('0x8d')]);fs_extra[_0x9a83('0xfa')](_0x414093)[_0x9a83('0x21')](function(_0x5448db){logger[_0x9a83('0x1c')]('Could\x20not\x20remove\x20attachment\x20file',_0x414093,_0x5448db);});}});};exports[_0x9a83('0xfb')]=function(_0x5c6d6c,_0x385795){return db[_0x9a83('0xbe')][_0x9a83('0x73')]({'where':{'id':_0x5c6d6c[_0x9a83('0x71')]['id']}})['then'](handleEntityNotFound(_0x385795,null))[_0x9a83('0x17')](function(_0x156166){if(_0x156166){return _0x156166[_0x9a83('0xfb')](_0x5c6d6c[_0x9a83('0x75')][_0x9a83('0x85')],_[_0x9a83('0xfc')](_0x5c6d6c['body'],[_0x9a83('0x85'),'id'])||{});}})[_0x9a83('0x17')](respondWithResult(_0x385795,null))['catch'](handleError(_0x385795,null));};exports[_0x9a83('0xfd')]=function(_0x18cfae,_0x28b62c){var _0x59d6af={'raw':![],'where':{}};var _0xd82e13={};var _0x38a3b7={'count':0x0,'rows':[]};return db[_0x9a83('0x5b')]['findOne']({'where':{'id':_0x18cfae['params']['id']}})['then'](handleEntityNotFound(_0x28b62c,null))['then'](function(_0x499741){if(_0x499741){_0xd82e13[_0x9a83('0x56')]=_[_0x9a83('0x60')](db[_0x9a83('0xbe')]['rawAttributes']);_0xd82e13['query']=_[_0x9a83('0x60')](_0x18cfae['query']);_0xd82e13[_0x9a83('0x61')]=_[_0x9a83('0x62')](_0xd82e13[_0x9a83('0x56')],_0xd82e13[_0x9a83('0x5f')]);_0x59d6af[_0x9a83('0x63')]=_['intersection'](_0xd82e13['model'],qs[_0x9a83('0x64')](_0x18cfae[_0x9a83('0x5f')][_0x9a83('0x64')]));_0x59d6af[_0x9a83('0x63')]=_0x59d6af['attributes'][_0x9a83('0x65')]?_0x59d6af[_0x9a83('0x63')]:_0xd82e13[_0x9a83('0x56')];if(!_0x18cfae[_0x9a83('0x5f')][_0x9a83('0x81')]('nolimit')){_0x59d6af['limit']=qs[_0x9a83('0x27')](_0x18cfae[_0x9a83('0x5f')][_0x9a83('0x27')]);_0x59d6af[_0x9a83('0x25')]=qs['offset'](_0x18cfae['query'][_0x9a83('0x25')]);}_0x59d6af[_0x9a83('0x66')]=qs[_0x9a83('0x67')](_0x18cfae[_0x9a83('0x5f')][_0x9a83('0x67')]);_0x59d6af[_0x9a83('0x69')]=qs[_0x9a83('0x61')](_[_0x9a83('0x83')](_0x18cfae[_0x9a83('0x5f')],_0xd82e13[_0x9a83('0x61')]));_0x59d6af[_0x9a83('0x69')]['ChatWebsiteId']=_0x499741['id'];if(_0x18cfae[_0x9a83('0x5f')]['filter']){_0x59d6af['where']=_[_0x9a83('0x6a')](_0x59d6af[_0x9a83('0x69')],{'$or':_[_0x9a83('0x3f')](_0x59d6af[_0x9a83('0x63')],function(_0x5db018){var _0x5543e7={};_0x5543e7[_0x5db018]={'$like':'%'+_0x18cfae[_0x9a83('0x5f')]['filter']+'%'};return _0x5543e7;})});}_0x59d6af=_[_0x9a83('0x6a')]({},_0x59d6af,_0x18cfae[_0x9a83('0x6c')]);return db[_0x9a83('0xbe')][_0x9a83('0x28')]({'where':_0x59d6af[_0x9a83('0x69')]})[_0x9a83('0x17')](function(_0x12dc07){_0x38a3b7['count']=_0x12dc07;if(_0x18cfae[_0x9a83('0x5f')][_0x9a83('0x6d')]){_0x59d6af[_0x9a83('0x6e')]=[{'model':db[_0x9a83('0xa3')],'as':_0x9a83('0xfe'),'required':![]},{'model':db[_0x9a83('0xff')],'as':'Owner','attributes':['name',_0x9a83('0x100'),_0x9a83('0x101')],'required':![]},{'model':db['Tag'],'as':_0x9a83('0x102'),'attributes':['id',_0x9a83('0x30'),_0x9a83('0x103')],'where':_0x18cfae[_0x9a83('0x5f')][_0x9a83('0x104')]?{'id':_0x18cfae[_0x9a83('0x5f')][_0x9a83('0x104')]}:undefined,'required':_0x18cfae[_0x9a83('0x5f')][_0x9a83('0x104')]?!![]:![]}];}return db['ChatInteraction'][_0x9a83('0x84')](_0x59d6af);})[_0x9a83('0x17')](function(_0x33bd33){_0x38a3b7['rows']=_0x33bd33;return _0x38a3b7;});}})['then'](respondWithFilteredResult(_0x28b62c,_0x59d6af))[_0x9a83('0x21')](handleError(_0x28b62c,null));};exports['getSnippet']=function(_0x4b4e0d,_0x167d14){var _0x43f6a2=0x0;var _0x33c434=0x0;var _0x42854e=![];var _0x1432c;var _0x18ce56;return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x4b4e0d[_0x9a83('0x71')]['id']},'include':[{'model':db[_0x9a83('0x40')],'as':'Interval','include':[{'model':db[_0x9a83('0x40')],'as':_0x9a83('0x41'),'attributes':['id',_0x9a83('0x36')]}]}]})[_0x9a83('0x17')](handleEntityNotFound(_0x167d14,null))[_0x9a83('0x17')](function(_0x4f20aa){if(_0x4f20aa){_0x1432c=_0x4f20aa;return _0x4f20aa[_0x9a83('0x105')]({'raw':!![]});}})[_0x9a83('0x17')](function(_0x428e25){if(_0x1432c){if(_0x428e25){_0x18ce56=_0x428e25;}}return require(_0x9a83('0x96'))['getLicense']();})[_0x9a83('0x17')](function(_0x5dccaa){if(_0x5dccaa){_0x33c434=_0x5dccaa[_0x9a83('0x106')];_0x42854e=_0x5dccaa['custom'];}})[_0x9a83('0x17')](function(){return db[_0x9a83('0xbe')][_0x9a83('0x28')]({'where':{'closed':![]}});})[_0x9a83('0x17')](function(_0x4e9136){_0x43f6a2=_0x4e9136;if(_0x33c434&&_0x4e9136>_0x33c434){return db[_0x9a83('0x107')][_0x9a83('0x80')]({'where':{'id':0x1}})[_0x9a83('0x17')](function(_0x21b97f){if(_0x21b97f){_0x21b97f[_0x9a83('0x108')](_0x9a83('0x109'));}});}})[_0x9a83('0x17')](function(){if(!_0x1432c[_0x9a83('0x40')]||!_0x1432c[_0x9a83('0x40')][_0x9a83('0x41')])return!![];return checkWebsiteIntervals(_0x1432c);})['then'](function(_0x1e2221){var _0x330c44=fs['readFileSync'](path[_0x9a83('0x93')](config['root'],_0x9a83('0x10a')),_0x9a83('0xdd'));var _0x58254e=new url[(_0x9a83('0x10b'))](_0x1432c[_0x9a83('0x10c')])[_0x9a83('0x10d')];var _0x418c3c=_0x9a83('0x10e');var _0x9632b4=![];var _0x340829={'chatVersion':_0x418c3c,'chatWebsiteAddressOrigin':_0x58254e,'remote':_0x1432c[_0x9a83('0x10f')],'query':querystring[_0x9a83('0x58')](_[_0x9a83('0x6a')](_0x1432c[_0x9a83('0x42')]({'plain':!![]}),{'customerIp':_0x4b4e0d[_0x9a83('0xbc')][_0x9a83('0x49')]||_0x4b4e0d['headers']['x-real-ip']||_0x4b4e0d[_0x9a83('0x110')][_0x9a83('0x111')]||_0x4b4e0d['ip'],'referer':_0x4b4e0d[_0x9a83('0xbc')][_0x9a83('0x4f')],'openedInteractions':_0x43f6a2,'maxInteractions':_0x33c434,'virtual':_0x42854e['virtual'],'online':_0x1e2221,'custom':_0x42854e}))[_0x9a83('0x112')](/'/g,'\x5c\x27')};_0x167d14[_0x9a83('0x31')](ejs['render'](Mustache[_0x9a83('0xde')](_0x330c44,_0x340829),{'proactiveActions':_0x18ce56,'alignment':_0x1432c[_0x9a83('0x113')],'verticalAlignment':_0x1432c[_0x9a83('0x114')],'div_color':_0x1432c[_0x9a83('0x103')],'labelText':_0x1432c[_0x9a83('0x115')],'text_color':_0x1432c[_0x9a83('0x116')],'text_button_color':_0x1432c[_0x9a83('0x117')],'button_color':_0x1432c[_0x9a83('0x118')],'background_color':_0x1432c[_0x9a83('0x119')],'hideWhenOffline':_0x1432c[_0x9a83('0x11a')],'intervalId':_0x1432c['IntervalId'],'isDevelopment':_0x9632b4,'chatVersion':_0x418c3c}));})['catch'](handleError(_0x167d14,null));};exports[_0x9a83('0x11b')]=function(_0xa6182e,_0x45b662){var _0x3c9bef=_0xa6182e['params']['id'];var _0x306b07=_0xa6182e['body'];var _0x486b1c=0xc8;var _0xcaa8db=null;return db[_0x9a83('0xe8')][_0x9a83('0xe9')]({'isolationLevel':db[_0x9a83('0xe8')][_0x9a83('0x11c')][_0x9a83('0x11d')][_0x9a83('0x11e')]},function(_0x1fd3cf){return db[_0x9a83('0x5b')]['findOne']({'where':{'id':_0x3c9bef},'transaction':_0x1fd3cf})[_0x9a83('0x17')](function(_0x116e48){if(_0x116e48){return db[_0x9a83('0xb4')][_0x9a83('0x2c')]({'where':{'ChatWebsiteId':_0x3c9bef},'transaction':_0x1fd3cf})['then'](function(){var _0x180e1e=_['map'](_0x306b07,function(_0x431704){_0x431704[_0x9a83('0x7e')]=_0x3c9bef;return _0x431704;});return db[_0x9a83('0xb4')]['bulkCreate'](_0x180e1e,{'transaction':_0x1fd3cf});});}else{_0x486b1c=0x194;_0xcaa8db=[];}});})[_0x9a83('0x17')](function(){if(_0x486b1c!==0x194){return db['ChatApplication'][_0x9a83('0x11f')]({'where':{'ChatWebsiteId':_0x3c9bef},'order':'priority'})[_0x9a83('0x17')](function(_0x2d2b9a){_0xcaa8db=_0x2d2b9a;});}})['catch'](function(_0x584bf7){_0x486b1c=0x1f4;logger[_0x9a83('0x1c')](_0x584bf7[_0x9a83('0x120')]);if(_0x584bf7[_0x9a83('0x30')]){delete _0x584bf7[_0x9a83('0x30')];}_0xcaa8db=_0x584bf7;})[_0x9a83('0x121')](function(){if(_0xcaa8db===null){_0x45b662[_0x9a83('0x2f')](_0x486b1c);}else{if(_0x486b1c===0x1f4){_0x45b662[_0x9a83('0x23')](_0x486b1c)[_0x9a83('0x31')](_0xcaa8db);}else{_0x45b662[_0x9a83('0x23')](_0x486b1c)[_0x9a83('0x24')](_0xcaa8db);}}});};exports[_0x9a83('0x122')]=function(_0x587390,_0x29ff25){var _0x58f14f={};var _0x1d694d={};var _0x1589ad;var _0x4893a9;return db[_0x9a83('0x5b')][_0x9a83('0x80')]({'where':{'id':_0x587390[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x29ff25,null))[_0x9a83('0x17')](function(_0x470c61){if(_0x470c61){_0x1589ad=_0x470c61;_0x1d694d[_0x9a83('0x56')]=_[_0x9a83('0x60')](db[_0x9a83('0xb4')][_0x9a83('0x5c')]);_0x1d694d[_0x9a83('0x5f')]=_[_0x9a83('0x60')](_0x587390[_0x9a83('0x5f')]);_0x1d694d[_0x9a83('0x61')]=_[_0x9a83('0x62')](_0x1d694d[_0x9a83('0x56')],_0x1d694d[_0x9a83('0x5f')]);_0x58f14f[_0x9a83('0x63')]=_['intersection'](_0x1d694d['model'],qs[_0x9a83('0x64')](_0x587390[_0x9a83('0x5f')]['fields']));_0x58f14f['attributes']=_0x58f14f[_0x9a83('0x63')]['length']?_0x58f14f[_0x9a83('0x63')]:_0x1d694d[_0x9a83('0x56')];_0x58f14f[_0x9a83('0x66')]=qs[_0x9a83('0x67')](_0x587390[_0x9a83('0x5f')]['sort']);_0x58f14f[_0x9a83('0x69')]=qs[_0x9a83('0x61')](_[_0x9a83('0x83')](_0x587390['query'],_0x1d694d[_0x9a83('0x61')]));if(_0x587390[_0x9a83('0x5f')][_0x9a83('0x68')]){_0x58f14f['where']=_['merge'](_0x58f14f[_0x9a83('0x69')],{'$or':_['map'](_0x58f14f[_0x9a83('0x63')],function(_0x11edda){var _0x2ed399={};_0x2ed399[_0x11edda]={'$like':'%'+_0x587390[_0x9a83('0x5f')][_0x9a83('0x68')]+'%'};return _0x2ed399;})});}_0x58f14f=_[_0x9a83('0x6a')]({},_0x58f14f,_0x587390[_0x9a83('0x6c')]);return _0x1589ad[_0x9a83('0x122')](_0x58f14f);}})[_0x9a83('0x17')](function(_0x1b0a29){if(_0x1b0a29){_0x4893a9=_0x1b0a29[_0x9a83('0x65')];if(!_0x587390['query'][_0x9a83('0x81')]('nolimit')){_0x58f14f['limit']=qs[_0x9a83('0x27')](_0x587390[_0x9a83('0x5f')][_0x9a83('0x27')]);_0x58f14f[_0x9a83('0x25')]=qs[_0x9a83('0x25')](_0x587390[_0x9a83('0x5f')][_0x9a83('0x25')]);}return _0x1589ad[_0x9a83('0x122')](_0x58f14f);}})[_0x9a83('0x17')](function(_0x4d68f5){if(_0x4d68f5){return _0x4d68f5?{'count':_0x4893a9,'rows':_0x4d68f5}:null;}})['then'](respondWithResult(_0x29ff25,null))[_0x9a83('0x21')](handleError(_0x29ff25,null));};exports[_0x9a83('0x123')]=function(_0x18bc60,_0x196404){return db[_0x9a83('0x124')][_0x9a83('0x73')]({'where':{'id':_0x18bc60[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x196404,null))[_0x9a83('0x17')](function(_0x5d95bc){if(_0x5d95bc){return _0x5d95bc[_0x9a83('0x123')](_0x18bc60[_0x9a83('0x75')][_0x9a83('0x85')],_[_0x9a83('0xfc')](_0x18bc60['body'],[_0x9a83('0x85'),'id'])||{});}})[_0x9a83('0x17')](respondWithResult(_0x196404,null))[_0x9a83('0x21')](handleError(_0x196404,null));};exports['getProactiveActions']=function(_0x4be20b,_0x2a4d31){var _0x318b7f={};var _0x1a00c7={};var _0x2054fa;var _0x3e9d2f;return db[_0x9a83('0x5b')][_0x9a83('0x80')]({'where':{'id':_0x4be20b[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x2a4d31,null))[_0x9a83('0x17')](function(_0x141c4e){if(_0x141c4e){_0x2054fa=_0x141c4e;_0x1a00c7[_0x9a83('0x56')]=_[_0x9a83('0x60')](db[_0x9a83('0x125')][_0x9a83('0x5c')]);_0x1a00c7[_0x9a83('0x5f')]=_[_0x9a83('0x60')](_0x4be20b['query']);_0x1a00c7[_0x9a83('0x61')]=_['intersection'](_0x1a00c7[_0x9a83('0x56')],_0x1a00c7[_0x9a83('0x5f')]);_0x318b7f[_0x9a83('0x63')]=_[_0x9a83('0x62')](_0x1a00c7[_0x9a83('0x56')],qs[_0x9a83('0x64')](_0x4be20b[_0x9a83('0x5f')][_0x9a83('0x64')]));_0x318b7f['attributes']=_0x318b7f[_0x9a83('0x63')]['length']?_0x318b7f[_0x9a83('0x63')]:_0x1a00c7[_0x9a83('0x56')];_0x318b7f['order']=qs[_0x9a83('0x67')](_0x4be20b['query']['sort']);_0x318b7f[_0x9a83('0x69')]=qs[_0x9a83('0x61')](_['pick'](_0x4be20b[_0x9a83('0x5f')],_0x1a00c7[_0x9a83('0x61')]));if(_0x4be20b[_0x9a83('0x5f')]['filter']){_0x318b7f[_0x9a83('0x69')]=_[_0x9a83('0x6a')](_0x318b7f['where'],{'$or':_['map'](_0x318b7f[_0x9a83('0x63')],function(_0x45d6c6){var _0x17ff83={};_0x17ff83[_0x45d6c6]={'$like':'%'+_0x4be20b['query'][_0x9a83('0x68')]+'%'};return _0x17ff83;})});}_0x318b7f=_[_0x9a83('0x6a')]({},_0x318b7f,_0x4be20b[_0x9a83('0x6c')]);return _0x2054fa[_0x9a83('0x105')](_0x318b7f);}})['then'](function(_0x184c0f){if(_0x184c0f){_0x3e9d2f=_0x184c0f[_0x9a83('0x65')];if(!_0x4be20b[_0x9a83('0x5f')][_0x9a83('0x81')](_0x9a83('0x82'))){_0x318b7f[_0x9a83('0x27')]=qs[_0x9a83('0x27')](_0x4be20b[_0x9a83('0x5f')][_0x9a83('0x27')]);_0x318b7f[_0x9a83('0x25')]=qs[_0x9a83('0x25')](_0x4be20b['query'][_0x9a83('0x25')]);}return _0x2054fa['getProactiveActions'](_0x318b7f);}})[_0x9a83('0x17')](function(_0x37bc6a){if(_0x37bc6a){return _0x37bc6a?{'count':_0x3e9d2f,'rows':_0x37bc6a}:null;}})[_0x9a83('0x17')](respondWithResult(_0x2a4d31,null))[_0x9a83('0x21')](handleError(_0x2a4d31,null));};exports[_0x9a83('0x126')]=function(_0x58b7c6,_0x35b97c){var _0xbeead3=_0x58b7c6['query']['online']===_0x9a83('0x127')?_0x9a83('0x128'):_0x9a83('0x129');return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'attributes':['id',_0xbeead3],'where':{'id':_0x58b7c6[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x35b97c,null))[_0x9a83('0x17')](function(_0x21f6e1){if(_0x21f6e1){var _0x394199=_0x21f6e1[_0xbeead3];var _0x234198=_0x394199&&_0x394199['items']?_0x394199[_0x9a83('0x12a')]:[];_0x35b97c[_0x9a83('0x31')]({'fromKey':_[_0x9a83('0x9f')](_0x394199['fromKey'])?undefined:_0x394199[_0x9a83('0x12b')],'count':_0x234198[_0x9a83('0x65')],'rows':_0x234198});}})[_0x9a83('0x21')](handleError(_0x35b97c,null));};exports[_0x9a83('0x12c')]=function(_0x679693,_0x35dcce){var _0x3abc00={'raw':![],'where':{}};var _0x4ed937={};var _0x144c6c={'count':0x0,'rows':[]};return db[_0x9a83('0x5b')][_0x9a83('0x80')]({'where':{'id':_0x679693[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x35dcce,null))[_0x9a83('0x17')](function(_0x34d038){if(_0x34d038){_0x4ed937['model']=_['keys'](db[_0x9a83('0x12d')][_0x9a83('0x5c')]);_0x4ed937[_0x9a83('0x5f')]=_['keys'](_0x679693['query']);_0x4ed937[_0x9a83('0x61')]=_[_0x9a83('0x62')](_0x4ed937[_0x9a83('0x56')],_0x4ed937[_0x9a83('0x5f')]);_0x3abc00[_0x9a83('0x63')]=_['intersection'](_0x4ed937[_0x9a83('0x56')],qs[_0x9a83('0x64')](_0x679693[_0x9a83('0x5f')][_0x9a83('0x64')]));_0x3abc00[_0x9a83('0x63')]=_0x3abc00[_0x9a83('0x63')][_0x9a83('0x65')]?_0x3abc00[_0x9a83('0x63')]:_0x4ed937[_0x9a83('0x56')];if(!_0x679693[_0x9a83('0x5f')][_0x9a83('0x81')](_0x9a83('0x82'))){_0x3abc00['limit']=qs[_0x9a83('0x27')](_0x679693['query'][_0x9a83('0x27')]);_0x3abc00[_0x9a83('0x25')]=qs[_0x9a83('0x25')](_0x679693[_0x9a83('0x5f')][_0x9a83('0x25')]);}_0x3abc00[_0x9a83('0x66')]=qs[_0x9a83('0x67')](_0x679693[_0x9a83('0x5f')][_0x9a83('0x67')]);_0x3abc00[_0x9a83('0x69')]=qs[_0x9a83('0x61')](_[_0x9a83('0x83')](_0x679693[_0x9a83('0x5f')],_0x4ed937['filters']));_0x3abc00[_0x9a83('0x69')][_0x9a83('0x7e')]=_0x34d038['id'];if(_0x679693[_0x9a83('0x5f')][_0x9a83('0x68')]){_0x3abc00['where']=_[_0x9a83('0x6a')](_0x3abc00[_0x9a83('0x69')],{'$or':_['map'](_0x3abc00['attributes'],function(_0x3d0866){var _0x147418={};_0x147418[_0x3d0866]={'$like':'%'+_0x679693['query']['filter']+'%'};return _0x147418;})});}_0x3abc00=_[_0x9a83('0x6a')]({},_0x3abc00,_0x679693[_0x9a83('0x6c')]);return db[_0x9a83('0x12d')]['count']({'where':_0x3abc00[_0x9a83('0x69')]})[_0x9a83('0x17')](function(_0x34ae51){_0x144c6c[_0x9a83('0x28')]=_0x34ae51;if(_0x679693['query']['includeAll']){_0x3abc00[_0x9a83('0x6e')]=[{'all':!![]}];}else{_0x3abc00[_0x9a83('0x6e')]=[{'model':db[_0x9a83('0xa3')],'as':_0x9a83('0xfe'),'required':![]},{'model':db[_0x9a83('0x12e')],'as':_0x9a83('0x12f'),'required':![]}];}return db[_0x9a83('0x12d')][_0x9a83('0x84')](_0x3abc00);})[_0x9a83('0x17')](function(_0x399785){_0x144c6c[_0x9a83('0x6f')]=_0x399785;return _0x144c6c;});}})[_0x9a83('0x17')](respondWithFilteredResult(_0x35dcce,_0x3abc00))['catch'](handleError(_0x35dcce,null));};exports[_0x9a83('0x130')]=function(_0x19b228,_0x4b76fd){return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x19b228[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x4b76fd,null))[_0x9a83('0x17')](function(_0x411e6d){if(_0x411e6d){return _0x411e6d[_0x9a83('0x130')](_0x19b228[_0x9a83('0x75')][_0x9a83('0x85')],_[_0x9a83('0xfc')](_0x19b228['body'],['ids','id'])||{})['spread'](function(_0x1c9ce8){for(var _0x252b0d=0x0;_0x252b0d<_0x19b228['body'][_0x9a83('0x85')][_0x9a83('0x65')];_0x252b0d+=0x1){socket[_0x9a83('0x131')](_0x9a83('0x132'),{'UserId':Number(_0x19b228[_0x9a83('0x75')]['ids'][_0x252b0d]),'ChatWebsiteId':Number(_0x19b228[_0x9a83('0x71')]['id'])});}return _0x1c9ce8;});}})[_0x9a83('0x17')](respondWithResult(_0x4b76fd,null))[_0x9a83('0x21')](handleError(_0x4b76fd,null));};exports[_0x9a83('0x133')]=function(_0x47846b,_0xfc7d27){return db[_0x9a83('0x5b')][_0x9a83('0x73')]({'where':{'id':_0x47846b[_0x9a83('0x71')]['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0xfc7d27,null))[_0x9a83('0x17')](function(_0x3de01f){if(_0x3de01f){return _0x3de01f['removeAgents'](_0x47846b['query'][_0x9a83('0x85')])[_0x9a83('0x17')](function(){if(_[_0x9a83('0x134')](_0x47846b['query'][_0x9a83('0x85')])){for(var _0x4d8872=0x0;_0x4d8872<_0x47846b[_0x9a83('0x5f')][_0x9a83('0x85')][_0x9a83('0x65')];_0x4d8872+=0x1){socket[_0x9a83('0x131')](_0x9a83('0x135'),{'UserId':Number(_0x47846b[_0x9a83('0x5f')]['ids'][_0x4d8872]),'ChatWebsiteId':Number(_0x47846b[_0x9a83('0x71')]['id'])});}}else{socket[_0x9a83('0x131')](_0x9a83('0x135'),{'UserId':Number(_0x47846b['query']['ids']),'ChatWebsiteId':Number(_0x47846b[_0x9a83('0x71')]['id'])});}});}})[_0x9a83('0x17')](respondWithStatusCode(_0xfc7d27,null))[_0x9a83('0x21')](handleError(_0xfc7d27,null));};exports[_0x9a83('0x136')]=function(_0xd87798,_0x1884a8){var _0xc50757={};var _0x1bb64c={};var _0xd0b48c;var _0x34653f;return db['ChatWebsite']['findOne']({'where':{'id':_0xd87798['params']['id']}})[_0x9a83('0x17')](handleEntityNotFound(_0x1884a8,null))[_0x9a83('0x17')](function(_0x49111f){if(_0x49111f){_0xd0b48c=_0x49111f;_0x1bb64c['model']=_['keys'](db[_0x9a83('0xff')][_0x9a83('0x5c')]);_0x1bb64c[_0x9a83('0x5f')]=_[_0x9a83('0x60')](_0xd87798[_0x9a83('0x5f')]);_0x1bb64c[_0x9a83('0x61')]=_[_0x9a83('0x62')](_0x1bb64c[_0x9a83('0x56')],_0x1bb64c[_0x9a83('0x5f')]);_0xc50757[_0x9a83('0x63')]=_[_0x9a83('0x62')](_0x1bb64c[_0x9a83('0x56')],qs[_0x9a83('0x64')](_0xd87798[_0x9a83('0x5f')]['fields']));_0xc50757[_0x9a83('0x63')]=_0xc50757[_0x9a83('0x63')][_0x9a83('0x65')]?_0xc50757['attributes']:_0x1bb64c[_0x9a83('0x56')];_0xc50757['order']=qs['sort'](_0xd87798['query'][_0x9a83('0x67')]);_0xc50757['where']=qs['filters'](_[_0x9a83('0x83')](_0xd87798[_0x9a83('0x5f')],_0x1bb64c[_0x9a83('0x61')]));if(_0xd87798['query'][_0x9a83('0x68')]){_0xc50757[_0x9a83('0x69')]=_[_0x9a83('0x6a')](_0xc50757[_0x9a83('0x69')],{'$or':_['map'](_0xc50757[_0x9a83('0x63')],function(_0x4c342d){var _0x4688c7={};_0x4688c7[_0x4c342d]={'$like':'%'+_0xd87798['query']['filter']+'%'};return _0x4688c7;})});}_0xc50757=_[_0x9a83('0x6a')]({},_0xc50757,_0xd87798['options']);return _0xd0b48c[_0x9a83('0x136')](_0xc50757);}})[_0x9a83('0x17')](function(_0x393c20){if(_0x393c20){_0x34653f=_0x393c20[_0x9a83('0x65')];if(!_0xd87798[_0x9a83('0x5f')][_0x9a83('0x81')](_0x9a83('0x82'))){_0xc50757[_0x9a83('0x27')]=qs['limit'](_0xd87798['query'][_0x9a83('0x27')]);_0xc50757['offset']=qs[_0x9a83('0x25')](_0xd87798['query'][_0x9a83('0x25')]);}return _0xd0b48c[_0x9a83('0x136')](_0xc50757);}})[_0x9a83('0x17')](function(_0x5c8978){if(_0x5c8978){return _0x5c8978?{'count':_0x34653f,'rows':_0x5c8978}:null;}})['then'](respondWithResult(_0x1884a8,null))[_0x9a83('0x21')](handleError(_0x1884a8,null));}; \ No newline at end of file +var _0x1b7e=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ChatWebsite','includeAll','findAll','rows','show','params','Pause','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','DESC','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','List','list','applications','orderBy','priority','asc','account','Contacts','defaults','ListId','threadId','ChatInteraction','ContactId','interaction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','unshift','queue','Start','startRouting','EventManager','offline','files','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','rawAttributes','Contact','Owner','fullname','internal','Tag','color','tag','getProactiveActions','custom','increment','URL','address','3.5.0','remote','headers','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','findAndCountAll','json','getApplications','addProactiveActions','chatProactiveAction','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','querystring','html-to-text','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','handleError','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','end','offset','undefined','limit','count','set','update','destroy','ChatWebsites','status','sendStatus','stack','name','send','Command','getSnippet','timezone','format','interval','iftime\x20%s','indexOf','true','OFFLINE','No\x20timezone','catch','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','map','Interval','Intervals','get','all','some','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','device','model','vendor','type','index','mandatoryDispositionPause','fieldName','key'];(function(_0xa7a45d,_0x425715){var _0x1a098e=function(_0x36ab29){while(--_0x36ab29){_0xa7a45d['push'](_0xa7a45d['shift']());}};_0x1a098e(++_0x425715);}(_0x1b7e,0xdd));var _0xe1b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b7e[_0x3dd15e];return _0x231fd0;};'use strict';var Mustache=require(_0xe1b7('0x0'));var util=require(_0xe1b7('0x1'));var path=require('path');var ejs=require(_0xe1b7('0x2'));var fs=require('fs');var fs_extra=require(_0xe1b7('0x3'));var _=require('lodash');var querystring=require(_0xe1b7('0x4'));var htmlToText=require(_0xe1b7('0x5'));var Redis=require('ioredis');var jayson=require(_0xe1b7('0x6'));var url=require('url');var qs=require(_0xe1b7('0x7'));var logger=require(_0xe1b7('0x8'))(_0xe1b7('0x9'));var config=require(_0xe1b7('0xa'));var APIOutOfIntervalError=require(_0xe1b7('0xb'))['APIOutOfIntervalError'];var APINotFoundError=require(_0xe1b7('0xb'))[_0xe1b7('0xc')];var APIHandleError=require('../../errors/api')[_0xe1b7('0xd')];var db=require(_0xe1b7('0xe'))['db'];config[_0xe1b7('0xf')]=_['defaults'](config[_0xe1b7('0xf')],{'host':_0xe1b7('0x10'),'port':0x18eb});var socket=require(_0xe1b7('0x11'))(new Redis(config[_0xe1b7('0xf')]));require('./chatWebsite.socket')[_0xe1b7('0x12')](socket);var client=jayson[_0xe1b7('0x13')][_0xe1b7('0x14')]({'port':0x232c});var client9002=jayson[_0xe1b7('0x13')][_0xe1b7('0x14')]({'port':0x232a});var client9003=jayson[_0xe1b7('0x13')]['http']({'port':0x232b});var client9001=jayson[_0xe1b7('0x13')][_0xe1b7('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x1ddfea,_0x2b61a1,_0x539b0d,_0x33a1bc){return new Promise(function(_0x123a20,_0x35efee){var _0x3503de=_0x33a1bc||client;return _0x3503de[_0xe1b7('0x15')](_0x1ddfea,_0x539b0d)[_0xe1b7('0x16')](function(_0x7a7fac){logger['info'](_0xe1b7('0x17'),_0x2b61a1,_0xe1b7('0x18'));logger[_0xe1b7('0x19')](_0xe1b7('0x1a'),_0x2b61a1,'request\x20sent',JSON[_0xe1b7('0x1b')](_0x7a7fac));if(_0x7a7fac['error']){if(_0x7a7fac[_0xe1b7('0x1c')][_0xe1b7('0x1d')]===0x1f4){logger['error'](_0xe1b7('0x17'),_0x2b61a1,_0x7a7fac[_0xe1b7('0x1c')]['message']);return _0x35efee(_0x7a7fac[_0xe1b7('0x1c')][_0xe1b7('0x1e')]);}logger['error'](_0xe1b7('0x17'),_0x2b61a1,_0x7a7fac[_0xe1b7('0x1c')][_0xe1b7('0x1e')]);return _0x123a20(_0x7a7fac['error']['message']);}else{logger[_0xe1b7('0x1f')](_0xe1b7('0x17'),_0x2b61a1,'request\x20sent');_0x123a20(_0x7a7fac[_0xe1b7('0x20')]['message']);}})['catch'](function(_0x40a221){logger[_0xe1b7('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x2b61a1,_0x40a221);_0x35efee(_0x40a221);});});}function respondWithStatusCode(_0x19d6da,_0x523eed){_0x523eed=_0x523eed||0xcc;return function(_0x44d6db){if(_0x44d6db){return _0x19d6da['sendStatus'](_0x523eed);}return _0x19d6da['status'](_0x523eed)[_0xe1b7('0x21')]();};}function respondWithResult(_0x220470,_0x23aa7f){_0x23aa7f=_0x23aa7f||0xc8;return function(_0x4127ba){if(_0x4127ba){return _0x220470['status'](_0x23aa7f)['json'](_0x4127ba);}};}function respondWithFilteredResult(_0x15e6d5,_0xfabd3){return function(_0x54292e){if(_0x54292e){var _0x16e0f2=typeof _0xfabd3[_0xe1b7('0x22')]===_0xe1b7('0x23')&&typeof _0xfabd3[_0xe1b7('0x24')]==='undefined';var _0x20603d=_0x54292e[_0xe1b7('0x25')];var _0x15023c=_0x16e0f2?0x0:_0xfabd3[_0xe1b7('0x22')];var _0x5b378f=_0x16e0f2?_0x54292e[_0xe1b7('0x25')]:_0xfabd3['offset']+_0xfabd3['limit'];var _0x118249;if(_0x5b378f>=_0x20603d){_0x5b378f=_0x20603d;_0x118249=0xc8;}else{_0x118249=0xce;}_0x15e6d5['status'](_0x118249);return _0x15e6d5[_0xe1b7('0x26')]('Content-Range',_0x15023c+'-'+_0x5b378f+'/'+_0x20603d)['json'](_0x54292e);}return null;};}function saveUpdates(_0x380c02){return function(_0x49a691){if(_0x49a691){return _0x49a691[_0xe1b7('0x27')](_0x380c02)['then'](function(_0x1d9758){return _0x1d9758;});}return null;};}function removeEntity(_0x341a71){return function(_0x2f5dc5){if(_0x2f5dc5){return _0x2f5dc5[_0xe1b7('0x28')]()[_0xe1b7('0x16')](function(){var _0x8f37b=_0x2f5dc5['get']({'plain':!![]});var _0x3047f3=_0xe1b7('0x29');return db['UserProfileResource'][_0xe1b7('0x28')]({'where':{'type':_0x3047f3,'resourceId':_0x8f37b['id']}})['then'](function(){return _0x2f5dc5;});})[_0xe1b7('0x16')](function(){_0x341a71[_0xe1b7('0x2a')](0xcc)[_0xe1b7('0x21')]();});}};}function handleEntityNotFound(_0x307341){return function(_0x23747e){if(!_0x23747e){_0x307341[_0xe1b7('0x2b')](0x194);}return _0x23747e;};}function handleError(_0x14b1b7,_0x5aea70){_0x5aea70=_0x5aea70||0x1f4;return function(_0x1b0e0d){logger[_0xe1b7('0x1c')](_0x1b0e0d[_0xe1b7('0x2c')]);if(_0x1b0e0d[_0xe1b7('0x2d')]){delete _0x1b0e0d[_0xe1b7('0x2d')];}_0x14b1b7['status'](_0x5aea70)[_0xe1b7('0x2e')](_0x1b0e0d);};}function iftimePromise(_0x315a92,_0x30cdbd){return respondWithRpcPromise(_0xe1b7('0x2f'),_0xe1b7('0x30'),{'command':_0x30cdbd[_0xe1b7('0x31')]?util[_0xe1b7('0x32')]('iftime\x20%s,%s',_0x315a92[_0xe1b7('0x33')],_0x30cdbd[_0xe1b7('0x31')]):util['format'](_0xe1b7('0x34'),_0x315a92['interval'])},client9002)[_0xe1b7('0x16')](function(_0x41890e){var _0x3f525e=_0x41890e&&_0x41890e[_0xe1b7('0x35')](_0xe1b7('0x36'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x30cdbd['id'],_0x315a92['id'],_0x315a92[_0xe1b7('0x33')],_0x3f525e?'ONLINE':_0xe1b7('0x37'),_0x30cdbd[_0xe1b7('0x31')]?_0x30cdbd[_0xe1b7('0x31')]:_0xe1b7('0x38'));return _0x3f525e;})[_0xe1b7('0x39')](function(_0x7bc07c){logger[_0xe1b7('0x1c')](_0xe1b7('0x3a'),_0x30cdbd['id'],_0x315a92['id'],_0x315a92[_0xe1b7('0x33')],util['inspect'](_0x7bc07c,{'showHidden':![],'depth':null}),_0x30cdbd[_0xe1b7('0x31')]?_0x30cdbd[_0xe1b7('0x31')]:_0xe1b7('0x38'));return![];});}function checkWebsiteIntervals(_0x4c34cc){var _0x141aeb=_[_0xe1b7('0x3b')](_0x4c34cc[_0xe1b7('0x3c')][_0xe1b7('0x3d')],function(_0x13d9f6){var _0x452ddc=_0x13d9f6[_0xe1b7('0x3e')]({'plain':!![]});return iftimePromise(_0x452ddc,_0x4c34cc);});return Promise[_0xe1b7('0x3f')](_0x141aeb)[_0xe1b7('0x16')](function(_0x242e7f){return _[_0xe1b7('0x40')](_0x242e7f);});}function createInteractionObject(_0xf14551,_0x481164,_0x513bac,_0x3499d9){var _0x61f05e=require('user-agent-parser');var _0x587d31=new _0x61f05e();var _0x13b942=_0x587d31[_0xe1b7('0x41')](_0x513bac[_0xe1b7('0x42')])[_0xe1b7('0x43')]();var _0x50d745=_0x481164['customerIp'];if(_0x513bac[_0xe1b7('0x44')]){_0x50d745=_0x513bac[_0xe1b7('0x44')];}else if(_0x513bac[_0xe1b7('0x45')]){_0x50d745=_[_0xe1b7('0x46')](_0x513bac[_0xe1b7('0x45')][_0xe1b7('0x47')](','));}return{'ContactId':_0x3499d9['id'],'ChatWebsiteId':_0xf14551,'from':(_0x3499d9[_0xe1b7('0x48')]||'')+'\x20'+(_0x3499d9[_0xe1b7('0x49')]||''),'customerIp':_0x50d745,'customerPort':_0x513bac['x-real-port']?_0x513bac[_0xe1b7('0x4a')]:null,'referer':_0x481164['referer'],'browserName':_0x13b942[_0xe1b7('0x4b')][_0xe1b7('0x2d')]&&_0x13b942['browser'][_0xe1b7('0x4c')]?util[_0xe1b7('0x32')](_0xe1b7('0x4d'),_0x13b942[_0xe1b7('0x4b')]['name'],_0x13b942[_0xe1b7('0x4b')][_0xe1b7('0x4c')]):'unknown','browserVersion':_0x13b942[_0xe1b7('0x4b')][_0xe1b7('0x4c')]||_0xe1b7('0x4e'),'osName':util['format']('%s\x20%s',_0x13b942['os']['name'],_0x13b942['os'][_0xe1b7('0x4c')]),'osVersion':_0x13b942['os'][_0xe1b7('0x4c')],'deviceModel':_0x13b942[_0xe1b7('0x4f')][_0xe1b7('0x50')]&&_0x13b942[_0xe1b7('0x4f')][_0xe1b7('0x51')]?util[_0xe1b7('0x32')]('%s\x20%s\x20%s',_0x13b942['device']['model'],_0x13b942[_0xe1b7('0x4f')][_0xe1b7('0x51')],_0x13b942[_0xe1b7('0x4f')]['type']):null,'deviceVendor':_0x13b942[_0xe1b7('0x4f')][_0xe1b7('0x51')],'deviceType':_0x13b942[_0xe1b7('0x4f')][_0xe1b7('0x52')],'formData':JSON[_0xe1b7('0x1b')](_0x481164)};}exports[_0xe1b7('0x53')]=function(_0x454a81,_0x48a814){var _0x59ad47={'include':[{'model':db['Pause'],'as':_0xe1b7('0x54')}]},_0x390474={},_0x11622e={'count':0x0,'rows':[]};var _0x8bff73=_['map'](db['ChatWebsite']['rawAttributes'],function(_0x3032d2){return{'name':_0x3032d2[_0xe1b7('0x55')],'type':_0x3032d2[_0xe1b7('0x52')][_0xe1b7('0x56')]};});_0x390474[_0xe1b7('0x50')]=_[_0xe1b7('0x3b')](_0x8bff73,_0xe1b7('0x2d'));_0x390474[_0xe1b7('0x57')]=_[_0xe1b7('0x58')](_0x454a81['query']);_0x390474[_0xe1b7('0x59')]=_[_0xe1b7('0x5a')](_0x390474['model'],_0x390474['query']);_0x59ad47[_0xe1b7('0x5b')]=_[_0xe1b7('0x5a')](_0x390474[_0xe1b7('0x50')],qs[_0xe1b7('0x5c')](_0x454a81[_0xe1b7('0x57')]['fields']));_0x59ad47[_0xe1b7('0x5b')]=_0x59ad47[_0xe1b7('0x5b')][_0xe1b7('0x5d')]?_0x59ad47[_0xe1b7('0x5b')]:_0x390474[_0xe1b7('0x50')];if(!_0x454a81[_0xe1b7('0x57')][_0xe1b7('0x5e')](_0xe1b7('0x5f'))){_0x59ad47[_0xe1b7('0x24')]=qs[_0xe1b7('0x24')](_0x454a81[_0xe1b7('0x57')][_0xe1b7('0x24')]);_0x59ad47[_0xe1b7('0x22')]=qs[_0xe1b7('0x22')](_0x454a81[_0xe1b7('0x57')]['offset']);}_0x59ad47[_0xe1b7('0x60')]=qs[_0xe1b7('0x61')](_0x454a81[_0xe1b7('0x57')][_0xe1b7('0x61')]);_0x59ad47[_0xe1b7('0x62')]=qs[_0xe1b7('0x59')](_[_0xe1b7('0x63')](_0x454a81['query'],_0x390474[_0xe1b7('0x59')]),_0x8bff73);if(_0x454a81[_0xe1b7('0x57')]['filter']){_0x59ad47[_0xe1b7('0x62')]=_[_0xe1b7('0x64')](_0x59ad47[_0xe1b7('0x62')],{'$or':_[_0xe1b7('0x3b')](_0x8bff73,function(_0x129c32){if(_0x129c32[_0xe1b7('0x52')]!==_0xe1b7('0x65')){var _0x3e33a5={};_0x3e33a5[_0x129c32[_0xe1b7('0x2d')]]={'$like':'%'+_0x454a81[_0xe1b7('0x57')][_0xe1b7('0x66')]+'%'};return _0x3e33a5;}})});}_0x59ad47=_[_0xe1b7('0x64')]({},_0x59ad47,_0x454a81['options']);var _0x208d07={'where':_0x59ad47[_0xe1b7('0x62')]};return db[_0xe1b7('0x67')][_0xe1b7('0x25')](_0x208d07)[_0xe1b7('0x16')](function(_0x16c144){_0x11622e[_0xe1b7('0x25')]=_0x16c144;if(_0x454a81[_0xe1b7('0x57')][_0xe1b7('0x68')]){_0x59ad47['include']=[{'all':!![]}];}return db[_0xe1b7('0x67')][_0xe1b7('0x69')](_0x59ad47);})[_0xe1b7('0x16')](function(_0x36000b){_0x11622e[_0xe1b7('0x6a')]=_0x36000b;return _0x11622e;})[_0xe1b7('0x16')](respondWithFilteredResult(_0x48a814,_0x59ad47))[_0xe1b7('0x39')](handleError(_0x48a814,null));};exports[_0xe1b7('0x6b')]=function(_0x14bb1f,_0x558700){var _0x36164a={'raw':![],'where':{'id':_0x14bb1f[_0xe1b7('0x6c')]['id']},'include':[{'model':db[_0xe1b7('0x6d')],'as':_0xe1b7('0x54')}]},_0x2330e0={};_0x2330e0[_0xe1b7('0x50')]=_[_0xe1b7('0x58')](db['ChatWebsite']['rawAttributes']);_0x2330e0[_0xe1b7('0x57')]=_[_0xe1b7('0x58')](_0x14bb1f[_0xe1b7('0x57')]);_0x2330e0[_0xe1b7('0x59')]=_[_0xe1b7('0x5a')](_0x2330e0[_0xe1b7('0x50')],_0x2330e0[_0xe1b7('0x57')]);_0x36164a[_0xe1b7('0x5b')]=_[_0xe1b7('0x5a')](_0x2330e0[_0xe1b7('0x50')],qs['fields'](_0x14bb1f['query'][_0xe1b7('0x5c')]));_0x36164a[_0xe1b7('0x5b')]=_0x36164a[_0xe1b7('0x5b')]['length']?_0x36164a[_0xe1b7('0x5b')]:_0x2330e0[_0xe1b7('0x50')];if(_0x14bb1f['query']['includeAll']){_0x36164a['include']=[{'all':!![]}];}_0x36164a=_[_0xe1b7('0x64')]({},_0x36164a,_0x14bb1f[_0xe1b7('0x6e')]);return db[_0xe1b7('0x67')][_0xe1b7('0x6f')](_0x36164a)[_0xe1b7('0x16')](handleEntityNotFound(_0x558700,null))[_0xe1b7('0x16')](respondWithResult(_0x558700,null))['catch'](handleError(_0x558700,null));};exports[_0xe1b7('0x70')]=function(_0x49bdee,_0x5d46e7){return db[_0xe1b7('0x67')]['create'](_0x49bdee[_0xe1b7('0x71')],{})[_0xe1b7('0x16')](function(_0x40c6b6){var _0x256756=_0x49bdee[_0xe1b7('0x72')]['get']({'plain':!![]});if(!_0x256756)throw new Error(_0xe1b7('0x73'));if(_0x256756[_0xe1b7('0x74')]===_0xe1b7('0x72')){var _0x30aa9a=_0x40c6b6['get']({'plain':!![]});var _0x304029=_0xe1b7('0x29');return db[_0xe1b7('0x75')]['find']({'where':{'name':_0x304029,'userProfileId':_0x256756[_0xe1b7('0x76')]},'raw':!![]})[_0xe1b7('0x16')](function(_0x4ef496){if(_0x4ef496&&_0x4ef496['autoAssociation']===0x0){return db[_0xe1b7('0x77')]['create']({'name':_0x30aa9a[_0xe1b7('0x2d')],'resourceId':_0x30aa9a['id'],'type':_0x4ef496['name'],'sectionId':_0x4ef496['id']},{})['then'](function(){return _0x40c6b6;});}else{return _0x40c6b6;}})[_0xe1b7('0x39')](function(_0x2433d9){logger[_0xe1b7('0x1c')](_0xe1b7('0x78'),_0x2433d9);throw _0x2433d9;});}return _0x40c6b6;})['then'](respondWithResult(_0x5d46e7,0xc9))[_0xe1b7('0x39')](handleError(_0x5d46e7,null));};exports[_0xe1b7('0x27')]=function(_0x1d042b,_0xda6070){if(_0x1d042b['body']['id']){delete _0x1d042b['body']['id'];}return db[_0xe1b7('0x67')]['find']({'where':{'id':_0x1d042b[_0xe1b7('0x6c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xda6070,null))[_0xe1b7('0x16')](saveUpdates(_0x1d042b['body'],null))[_0xe1b7('0x16')](respondWithResult(_0xda6070,null))['catch'](handleError(_0xda6070,null));};exports[_0xe1b7('0x28')]=function(_0x5994b0,_0x18a244){return db[_0xe1b7('0x67')]['find']({'where':{'id':_0x5994b0[_0xe1b7('0x6c')]['id']}})['then'](handleEntityNotFound(_0x18a244,null))[_0xe1b7('0x16')](removeEntity(_0x18a244,null))[_0xe1b7('0x39')](handleError(_0x18a244,null));};exports['describe']=function(_0x289d3b,_0x47bf4b){return db[_0xe1b7('0x67')][_0xe1b7('0x79')]()[_0xe1b7('0x16')](respondWithResult(_0x47bf4b,null))['catch'](handleError(_0x47bf4b,null));};exports[_0xe1b7('0x7a')]=function(_0x252313,_0x3400e0){if(_0x252313['body']['id']){delete _0x252313[_0xe1b7('0x71')]['id'];}return db['ChatWebsite'][_0xe1b7('0x6f')]({'where':{'id':_0x252313[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x3400e0,null))[_0xe1b7('0x16')](function(_0x3f6e95){if(_0x3f6e95){_0x252313['body'][_0xe1b7('0x7b')]=_0x3f6e95['id'];return db[_0xe1b7('0x7c')][_0xe1b7('0x70')](_0x252313['body']);}})['then'](respondWithResult(_0x3400e0,null))['catch'](handleError(_0x3400e0,null));};exports[_0xe1b7('0x7d')]=function(_0x189c4c,_0x1be615){var _0x1d048a={'raw':![],'where':{}};var _0x1feeeb={};var _0x427960={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe1b7('0x7e')]({'where':{'id':_0x189c4c[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x1be615,null))[_0xe1b7('0x16')](function(_0xab7e38){if(_0xab7e38){_0x1feeeb[_0xe1b7('0x50')]=_['keys'](db['Disposition']['rawAttributes']);_0x1feeeb['query']=_[_0xe1b7('0x58')](_0x189c4c[_0xe1b7('0x57')]);_0x1feeeb[_0xe1b7('0x59')]=_[_0xe1b7('0x5a')](_0x1feeeb[_0xe1b7('0x50')],_0x1feeeb[_0xe1b7('0x57')]);_0x1d048a[_0xe1b7('0x5b')]=_[_0xe1b7('0x5a')](_0x1feeeb[_0xe1b7('0x50')],qs[_0xe1b7('0x5c')](_0x189c4c[_0xe1b7('0x57')][_0xe1b7('0x5c')]));_0x1d048a['attributes']=_0x1d048a['attributes'][_0xe1b7('0x5d')]?_0x1d048a[_0xe1b7('0x5b')]:_0x1feeeb[_0xe1b7('0x50')];if(!_0x189c4c[_0xe1b7('0x57')][_0xe1b7('0x5e')](_0xe1b7('0x5f'))){_0x1d048a['limit']=qs[_0xe1b7('0x24')](_0x189c4c[_0xe1b7('0x57')][_0xe1b7('0x24')]);_0x1d048a[_0xe1b7('0x22')]=qs[_0xe1b7('0x22')](_0x189c4c['query'][_0xe1b7('0x22')]);}_0x1d048a['order']=qs[_0xe1b7('0x61')](_0x189c4c[_0xe1b7('0x57')][_0xe1b7('0x61')]);_0x1d048a['where']=qs['filters'](_['pick'](_0x189c4c[_0xe1b7('0x57')],_0x1feeeb[_0xe1b7('0x59')]));_0x1d048a[_0xe1b7('0x62')][_0xe1b7('0x7b')]=_0xab7e38['id'];if(_0x189c4c[_0xe1b7('0x57')][_0xe1b7('0x66')]){_0x1d048a[_0xe1b7('0x62')]=_[_0xe1b7('0x64')](_0x1d048a['where'],{'$or':_[_0xe1b7('0x3b')](_0x1d048a[_0xe1b7('0x5b')],function(_0x5d2d9c){var _0x3b28fc={};_0x3b28fc[_0x5d2d9c]={'$like':'%'+_0x189c4c[_0xe1b7('0x57')]['filter']+'%'};return _0x3b28fc;})});}_0x1d048a=_[_0xe1b7('0x64')]({},_0x1d048a,_0x189c4c['options']);return db[_0xe1b7('0x7c')][_0xe1b7('0x25')]({'where':_0x1d048a['where']})[_0xe1b7('0x16')](function(_0x38f083){_0x427960[_0xe1b7('0x25')]=_0x38f083;if(_0x189c4c[_0xe1b7('0x57')][_0xe1b7('0x68')]){_0x1d048a['include']=[{'all':!![]}];}return db[_0xe1b7('0x7c')][_0xe1b7('0x69')](_0x1d048a);})['then'](function(_0x9eeafc){_0x427960[_0xe1b7('0x6a')]=_0x9eeafc;return _0x427960;});}})[_0xe1b7('0x16')](respondWithFilteredResult(_0x1be615,_0x1d048a))['catch'](handleError(_0x1be615,null));};exports[_0xe1b7('0x7f')]=function(_0x4db887,_0x27ec63){return db[_0xe1b7('0x67')][_0xe1b7('0x6f')]({'where':{'id':_0x4db887[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x27ec63,null))['then'](function(_0x17677c){if(_0x17677c){return _0x17677c['removeDispositions'](_0x4db887['query'][_0xe1b7('0x80')]);}})['then'](respondWithStatusCode(_0x27ec63,null))[_0xe1b7('0x39')](handleError(_0x27ec63,null));};exports[_0xe1b7('0x81')]=function(_0x1223f4,_0x29296f){if(_0x1223f4[_0xe1b7('0x71')]['id']){delete _0x1223f4['body']['id'];}return db[_0xe1b7('0x67')]['find']({'where':{'id':_0x1223f4['params']['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x29296f,null))['then'](function(_0x4f4337){if(_0x4f4337){_0x1223f4[_0xe1b7('0x71')][_0xe1b7('0x7b')]=_0x4f4337['id'];return db[_0xe1b7('0x82')][_0xe1b7('0x70')](_0x1223f4[_0xe1b7('0x71')]);}})[_0xe1b7('0x16')](respondWithResult(_0x29296f,null))[_0xe1b7('0x39')](handleError(_0x29296f,null));};exports[_0xe1b7('0x83')]=function(_0xf6d3d1,_0x57dc09){var _0x53de05={'raw':![],'where':{}};var _0x39d4c0={};var _0x3a354d={'count':0x0,'rows':[]};return db[_0xe1b7('0x67')][_0xe1b7('0x7e')]({'where':{'id':_0xf6d3d1[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x57dc09,null))[_0xe1b7('0x16')](function(_0x5cf646){if(_0x5cf646){_0x39d4c0[_0xe1b7('0x50')]=_[_0xe1b7('0x58')](db[_0xe1b7('0x82')]['rawAttributes']);_0x39d4c0[_0xe1b7('0x57')]=_[_0xe1b7('0x58')](_0xf6d3d1[_0xe1b7('0x57')]);_0x39d4c0['filters']=_[_0xe1b7('0x5a')](_0x39d4c0['model'],_0x39d4c0[_0xe1b7('0x57')]);_0x53de05[_0xe1b7('0x5b')]=_[_0xe1b7('0x5a')](_0x39d4c0[_0xe1b7('0x50')],qs[_0xe1b7('0x5c')](_0xf6d3d1[_0xe1b7('0x57')][_0xe1b7('0x5c')]));_0x53de05['attributes']=_0x53de05[_0xe1b7('0x5b')][_0xe1b7('0x5d')]?_0x53de05[_0xe1b7('0x5b')]:_0x39d4c0['model'];if(!_0xf6d3d1[_0xe1b7('0x57')][_0xe1b7('0x5e')](_0xe1b7('0x5f'))){_0x53de05[_0xe1b7('0x24')]=qs[_0xe1b7('0x24')](_0xf6d3d1[_0xe1b7('0x57')][_0xe1b7('0x24')]);_0x53de05[_0xe1b7('0x22')]=qs[_0xe1b7('0x22')](_0xf6d3d1[_0xe1b7('0x57')][_0xe1b7('0x22')]);}_0x53de05[_0xe1b7('0x60')]=qs[_0xe1b7('0x61')](_0xf6d3d1[_0xe1b7('0x57')]['sort']);_0x53de05[_0xe1b7('0x62')]=qs[_0xe1b7('0x59')](_['pick'](_0xf6d3d1[_0xe1b7('0x57')],_0x39d4c0[_0xe1b7('0x59')]));_0x53de05[_0xe1b7('0x62')][_0xe1b7('0x7b')]=_0x5cf646['id'];if(_0xf6d3d1['query']['filter']){_0x53de05[_0xe1b7('0x62')]=_[_0xe1b7('0x64')](_0x53de05[_0xe1b7('0x62')],{'$or':_[_0xe1b7('0x3b')](_0x53de05[_0xe1b7('0x5b')],function(_0x7955ca){var _0x910a80={};_0x910a80[_0x7955ca]={'$like':'%'+_0xf6d3d1[_0xe1b7('0x57')]['filter']+'%'};return _0x910a80;})});}_0x53de05=_[_0xe1b7('0x64')]({},_0x53de05,_0xf6d3d1[_0xe1b7('0x6e')]);return db[_0xe1b7('0x82')][_0xe1b7('0x25')]({'where':_0x53de05[_0xe1b7('0x62')]})[_0xe1b7('0x16')](function(_0x3705ce){_0x3a354d['count']=_0x3705ce;if(_0xf6d3d1[_0xe1b7('0x57')][_0xe1b7('0x68')]){_0x53de05[_0xe1b7('0x84')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe1b7('0x69')](_0x53de05);})[_0xe1b7('0x16')](function(_0xb9ac00){_0x3a354d[_0xe1b7('0x6a')]=_0xb9ac00;return _0x3a354d;});}})[_0xe1b7('0x16')](respondWithFilteredResult(_0x57dc09,_0x53de05))[_0xe1b7('0x39')](handleError(_0x57dc09,null));};exports[_0xe1b7('0x85')]=function(_0x2c430e,_0x307680){return db[_0xe1b7('0x67')][_0xe1b7('0x6f')]({'where':{'id':_0x2c430e[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x307680,null))[_0xe1b7('0x16')](function(_0x4996a4){if(_0x4996a4){return _0x4996a4[_0xe1b7('0x85')](_0x2c430e[_0xe1b7('0x57')][_0xe1b7('0x80')]);}})[_0xe1b7('0x16')](respondWithStatusCode(_0x307680,null))[_0xe1b7('0x39')](handleError(_0x307680,null));};exports['addLogo']=function(_0x2797dc,_0x4c12d7){_0x2797dc[_0xe1b7('0x71')][_0xe1b7('0x86')]=_0x2797dc[_0xe1b7('0x87')]['filename'];return db[_0xe1b7('0x67')][_0xe1b7('0x6f')]({'where':{'id':_0x2797dc['params']['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x4c12d7,null))[_0xe1b7('0x16')](saveUpdates(_0x2797dc[_0xe1b7('0x71')],null))[_0xe1b7('0x16')](respondWithResult(_0x4c12d7,null))[_0xe1b7('0x39')](handleError(_0x4c12d7,null));};exports[_0xe1b7('0x88')]=function(_0x333417,_0x2ca4f3){_0x333417['body'][_0xe1b7('0x89')]=_0x333417['file'][_0xe1b7('0x8a')];return db[_0xe1b7('0x67')][_0xe1b7('0x6f')]({'where':{'id':_0x333417[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x2ca4f3,null))[_0xe1b7('0x16')](saveUpdates(_0x333417['body'],null))['then'](respondWithResult(_0x2ca4f3,null))['catch'](handleError(_0x2ca4f3,null));};exports[_0xe1b7('0x8b')]=function(_0x1ec5dc,_0x138283){_0x1ec5dc[_0xe1b7('0x71')][_0xe1b7('0x8c')]=_0x1ec5dc[_0xe1b7('0x87')][_0xe1b7('0x8a')];return db[_0xe1b7('0x67')][_0xe1b7('0x6f')]({'where':{'id':_0x1ec5dc[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x138283,null))[_0xe1b7('0x16')](saveUpdates(_0x1ec5dc[_0xe1b7('0x71')],null))[_0xe1b7('0x16')](respondWithResult(_0x138283,null))[_0xe1b7('0x39')](handleError(_0x138283,null));};exports[_0xe1b7('0x8d')]=function(_0xcd19ca,_0x111a53){_0xcd19ca['body'][_0xe1b7('0x8e')]=_0xcd19ca[_0xe1b7('0x87')][_0xe1b7('0x8a')];return db[_0xe1b7('0x67')][_0xe1b7('0x6f')]({'where':{'id':_0xcd19ca[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x111a53,null))['then'](saveUpdates(_0xcd19ca[_0xe1b7('0x71')],null))[_0xe1b7('0x16')](respondWithResult(_0x111a53,null))['catch'](handleError(_0x111a53,null));};exports[_0xe1b7('0x8f')]=function(_0x5cebf3,_0x121489){var _0x4eba3a=path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],_0xe1b7('0x92'));var _0x5ae8d8={'where':{'id':_0x5cebf3['params']['id']},'attributes':['id',_0xe1b7('0x86')],'raw':!![]};var _0x119d8f=![];return require(_0xe1b7('0x93'))[_0xe1b7('0x94')]()[_0xe1b7('0x16')](function(_0x416d5f){if(_0x416d5f){_0x119d8f=_0x416d5f['custom'];}})[_0xe1b7('0x16')](function(){return db[_0xe1b7('0x67')][_0xe1b7('0x6f')](_0x5ae8d8);})[_0xe1b7('0x16')](handleEntityNotFound(_0x121489,null))[_0xe1b7('0x16')](function(_0x38dbed){if(_0x38dbed){if(!_[_0xe1b7('0x95')](_0x38dbed[_0xe1b7('0x86')])){if(fs['existsSync'](path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],_0xe1b7('0x96'),_0x38dbed[_0xe1b7('0x86')]))&&_0x119d8f){_0x4eba3a=path[_0xe1b7('0x90')](config['root'],_0xe1b7('0x96'),_0x38dbed['sitepic']);}}return _0x121489[_0xe1b7('0x97')](_0x4eba3a);}})[_0xe1b7('0x39')](handleError(_0x121489,null));};exports[_0xe1b7('0x98')]=function(_0x601521,_0x21da19){var _0x1a1068=path['join'](config[_0xe1b7('0x91')],'server/files/images/avatars/default_avatar.png');var _0x5590b7={'where':{'id':_0x601521['params']['id']},'attributes':['id',_0xe1b7('0x89')],'raw':!![]};return db[_0xe1b7('0x67')][_0xe1b7('0x6f')](_0x5590b7)[_0xe1b7('0x16')](handleEntityNotFound(_0x21da19,null))[_0xe1b7('0x16')](function(_0x102743){if(_0x102743){if(!_[_0xe1b7('0x95')](_0x102743[_0xe1b7('0x89')])){if(fs['existsSync'](path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],'server/files/images/avatars/',_0x102743[_0xe1b7('0x89')]))){_0x1a1068=path['join'](config[_0xe1b7('0x91')],_0xe1b7('0x99'),_0x102743[_0xe1b7('0x89')]);}}return _0x21da19[_0xe1b7('0x97')](_0x1a1068);}})[_0xe1b7('0x39')](handleError(_0x21da19,null));};exports[_0xe1b7('0x9a')]=function(_0x541de2,_0x276700){var _0x963bcd=path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],_0xe1b7('0x9b'));var _0x16ef6c={'where':{'id':_0x541de2[_0xe1b7('0x6c')]['id']},'attributes':['id','customerAvatar',_0xe1b7('0x9c')],'raw':!![]};return db[_0xe1b7('0x67')]['find'](_0x16ef6c)[_0xe1b7('0x16')](handleEntityNotFound(_0x276700,null))[_0xe1b7('0x16')](function(_0x168302){if(_0x168302){if(!_[_0xe1b7('0x95')](_0x168302[_0xe1b7('0x8c')])){if(fs['existsSync'](path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],_0xe1b7('0x99'),_0x168302[_0xe1b7('0x8c')]))&&_0x168302['showCustomerAvatar']){_0x963bcd=path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],_0xe1b7('0x99'),_0x168302[_0xe1b7('0x8c')]);}}return _0x276700[_0xe1b7('0x97')](_0x963bcd);}})['catch'](handleError(_0x276700,null));};exports['getSystemAvatar']=function(_0x3a4457,_0xfe11c3){var _0xbf4499=path['join'](config[_0xe1b7('0x91')],_0xe1b7('0x9d'));var _0xccbfb5={'where':{'id':_0x3a4457[_0xe1b7('0x6c')]['id']},'attributes':['id',_0xe1b7('0x8e')],'raw':!![]};return db[_0xe1b7('0x67')][_0xe1b7('0x6f')](_0xccbfb5)['then'](handleEntityNotFound(_0xfe11c3,null))[_0xe1b7('0x16')](function(_0x26669e){if(_0x26669e){if(!_['isNil'](_0x26669e[_0xe1b7('0x8e')])){if(fs['existsSync'](path['join'](config[_0xe1b7('0x91')],'server/files/images/avatars/',_0x26669e[_0xe1b7('0x8e')]))){_0xbf4499=path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],_0xe1b7('0x99'),_0x26669e['systemAvatar']);}}return _0xfe11c3['download'](_0xbf4499);}})[_0xe1b7('0x39')](handleError(_0xfe11c3,null));};exports[_0xe1b7('0x9e')]=function(_0x38fad5,_0x13ea41){var _0x3f1dea={'body':_0x38fad5[_0xe1b7('0x71')],'channel':'chat'};var _0x1401ed=[];var _0x5a9fb8=[];var _0x412769={};var _0x2d5ae2=![];return db['CmContact'][_0xe1b7('0x79')]()[_0xe1b7('0x16')](function(_0x5b5ef3){if(!_0x5b5ef3){throw new db[(_0xe1b7('0x9f'))][(_0xe1b7('0xa0'))](_0xe1b7('0xa1'));}_0x1401ed=_['difference'](_[_0xe1b7('0x58')](_0x5b5ef3),[_0xe1b7('0xa2'),_0xe1b7('0xa3')]);_0x5a9fb8=_[_0xe1b7('0xa4')](_[_0xe1b7('0x58')](_0x5b5ef3),[_0xe1b7('0xa2'),_0xe1b7('0xa3'),_0xe1b7('0xa5'),'ListId']);if(_0x38fad5[_0xe1b7('0x71')]['id']){delete _0x38fad5['body']['id'];}if(_[_0xe1b7('0x95')](_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xa6')])){throw new db[(_0xe1b7('0x9f'))][(_0xe1b7('0xa0'))]('from\x20is\x20mandatory');}if(_[_0xe1b7('0x95')](_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0x71')])||_0x38fad5['body'][_0xe1b7('0x71')]===''){throw new db[(_0xe1b7('0x9f'))][(_0xe1b7('0xa0'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xa7')])){throw new db[(_0xe1b7('0x9f'))]['ValidationError'](_0xe1b7('0xa8')+_0x5a9fb8);}if(!_[_0xe1b7('0xa9')](_0x5a9fb8,_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xa7')])){throw new db[(_0xe1b7('0x9f'))][(_0xe1b7('0xa0'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5a9fb8);}_0x412769[_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xa7')]]=_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xa6')];})[_0xe1b7('0x16')](function(){return db[_0xe1b7('0x67')][_0xe1b7('0x6f')]({'where':{'id':_0x38fad5[_0xe1b7('0x6c')]['id']},'include':[{'model':db[_0xe1b7('0xaa')],'as':'List','include':[{'model':db[_0xe1b7('0xab')],'as':'Contacts','where':_0x412769,'limit':0x1,'order':[['updatedAt',_0xe1b7('0xac')]]}]},{'model':db['ChatApplication'],'as':_0xe1b7('0xad')},{'model':db[_0xe1b7('0x3c')],'as':'Interval','include':[{'model':db[_0xe1b7('0x3c')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]});})['then'](function(_0xf6245f){if(!_0xf6245f)throw new APINotFoundError(util['format'](_0xe1b7('0xae'),_0x38fad5[_0xe1b7('0x6c')]['id']));if(!_0xf6245f['Interval']||!_0xf6245f['Interval'][_0xe1b7('0x3d')])return[_0xf6245f,!![]];return[_0xf6245f,checkWebsiteIntervals(_0xf6245f)];})[_0xe1b7('0xaf')](function(_0x5a3236,_0x3af5d0){if(!_0x3af5d0)throw new APIOutOfIntervalError();if(!_0x5a3236[_0xe1b7('0xb0')])return;_0x3f1dea['account']=_0x5a3236;_0x3f1dea[_0xe1b7('0xb1')]=_0x5a3236[_0xe1b7('0xb0')];_0x3f1dea[_0xe1b7('0xb2')]=_[_0xe1b7('0xb3')](_0x5a3236[_0xe1b7('0xad')],[_0xe1b7('0xb4')],[_0xe1b7('0xb5')]);if(_0x3f1dea['account'][_0xe1b7('0xad')]){delete _0x3f1dea['account'][_0xe1b7('0xad')];}if(_0x3f1dea[_0xe1b7('0xb6')][_0xe1b7('0xb0')]&&_0x3f1dea[_0xe1b7('0xb6')][_0xe1b7('0xb0')][_0xe1b7('0xb7')]['length']){return _0x3f1dea[_0xe1b7('0xb6')][_0xe1b7('0xb0')][_0xe1b7('0xb7')][0x0];}var _0x5037dd=_[_0xe1b7('0xb8')](_0x38fad5[_0xe1b7('0x71')],{'firstName':_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xa6')],'ListId':_0x5a3236[_0xe1b7('0xb9')]});_0x5037dd[_0x38fad5[_0xe1b7('0x71')]['mapKey']]=_0x38fad5[_0xe1b7('0x71')]['from'];return db[_0xe1b7('0xab')][_0xe1b7('0x70')](_0x5037dd,{'fields':_0x1401ed,'raw':!![]});})[_0xe1b7('0x16')](function(_0x1a5558){_0x3f1dea['contact']=_0x1a5558;var _0x4c80b5=createInteractionObject(_0x38fad5[_0xe1b7('0x6c')]['id'],_0x38fad5[_0xe1b7('0x71')],_0x38fad5['headers'],_0x1a5558);var _0x43255d={'ChatWebsiteId':_0x38fad5[_0xe1b7('0x6c')]['id'],'closed':![]};if(_0x38fad5['body'][_0xe1b7('0xba')]){_0x43255d[_0xe1b7('0xba')]=_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xba')];return db[_0xe1b7('0xbb')][_0xe1b7('0x6f')]({'where':_0x43255d})[_0xe1b7('0x16')](function(_0x108855){if(_0x108855){_0x2d5ae2=!![];return _0x108855;}_0x4c80b5[_0xe1b7('0xba')]=_0x38fad5['body']['threadId'];_0x4c80b5['externalUrl']=_0x38fad5[_0xe1b7('0x71')]['externalUrl'];return db[_0xe1b7('0xbb')][_0xe1b7('0x70')](_0x4c80b5);});}_0x43255d[_0xe1b7('0xbc')]=_0x1a5558['id'];if(_0x38fad5['body'][_0xe1b7('0xbd')]&&_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xbd')]['id']){_0x43255d['id']=_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xbd')]['id'];return db['ChatInteraction'][_0xe1b7('0x6f')]({'where':_0x43255d})[_0xe1b7('0x16')](function(_0x505d54){if(_0x505d54){_0x2d5ae2=!![];return _0x505d54;}return db[_0xe1b7('0xbb')][_0xe1b7('0x70')](_0x4c80b5);});}return db['ChatInteraction'][_0xe1b7('0x70')](_0x4c80b5);})['then'](function(_0x1aba69){if(!_0x2d5ae2)return _0x1aba69;var _0x44464d={'from':(_0x3f1dea[_0xe1b7('0xbe')][_0xe1b7('0x48')]||'')+'\x20'+(_0x3f1dea[_0xe1b7('0xbe')][_0xe1b7('0x49')]||'')};if(_0x38fad5[_0xe1b7('0x71')]['threadId']&&_0x38fad5[_0xe1b7('0x71')]['messageId']&&_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xba')]!=_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0xbf')]){_0x44464d[_0xe1b7('0xba')]=_0x38fad5['body']['messageId'];}return _0x1aba69[_0xe1b7('0x27')](_0x44464d);})[_0xe1b7('0x16')](function(_0x29b789){_0x3f1dea[_0xe1b7('0xbd')]=_0x29b789['get']({'plain':!![]});_0x3f1dea[_0xe1b7('0xbd')][_0xe1b7('0xc0')]=!_0x2d5ae2;if(_0x3f1dea['interaction'][_0xe1b7('0xc0')]){if(_0x3f1dea[_0xe1b7('0xb6')][_0xe1b7('0xc1')]){_0x3f1dea[_0xe1b7('0xb2')][_0xe1b7('0xc2')]({'id':0x0,'priority':_0x3f1dea[_0xe1b7('0xb2')]['length']+0x1,'app':_0xe1b7('0xc3'),'appdata':_0xe1b7('0xc4'),'interval':_0xe1b7('0xc5')});}}return db[_0xe1b7('0xc6')][_0xe1b7('0x70')]({'body':_0x38fad5[_0xe1b7('0x71')][_0xe1b7('0x71')],'ChatWebsiteId':_0x38fad5[_0xe1b7('0x6c')]['id'],'ChatInteractionId':_0x29b789['id'],'direction':'in','ContactId':_0x3f1dea['contact']['id'],'AttachmentId':_0x38fad5[_0xe1b7('0x71')]['AttachmentId']});})['then'](function(_0x166825){_0x3f1dea[_0xe1b7('0x1e')]=_0x166825;if(!_0x3f1dea[_0xe1b7('0xbd')][_0xe1b7('0xc7')]){return;}return db[_0xe1b7('0xc8')]['find']({'attributes':['id','name'],'where':{'id':_0x3f1dea[_0xe1b7('0xbd')][_0xe1b7('0xc7')]}});})[_0xe1b7('0x16')](function(_0x14a5f2){if(_0x14a5f2){_0x3f1dea['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xe1b7('0xc9'),'appdata':_0x14a5f2[_0xe1b7('0x2d')]+','+(_0x3f1dea['account'][_0xe1b7('0xca')]||0xa),'interval':'*,*,*,*'});_0x3f1dea[_0xe1b7('0xcb')]=!![];}if(!_0x3f1dea[_0xe1b7('0xbd')]['queueId']){return;}return db[_0xe1b7('0xcc')][_0xe1b7('0x6f')]({'attributes':['id',_0xe1b7('0x2d')],'where':{'id':_0x3f1dea['interaction'][_0xe1b7('0xcd')]}});})[_0xe1b7('0x16')](function(_0x4404c7){if(_0x4404c7){_0x3f1dea['applications'][_0xe1b7('0xce')]({'id':0x0,'priority':0x1,'app':_0xe1b7('0xcf'),'appdata':_0x4404c7['name']+','+(_0x3f1dea[_0xe1b7('0xb6')]['waitForTheAssignedQueue']||0x12c),'interval':_0xe1b7('0xc5')});}return respondWithRpcPromise(_0xe1b7('0xd0'),_0xe1b7('0xd1'),_0x3f1dea);})['then'](function(_0x100a1e){respondWithRpcPromise('EventManager',_0xe1b7('0xd2'),{'event':_0xe1b7('0x9e'),'message':_0x100a1e},client9002);return _0x100a1e;})['then'](respondWithResult(_0x13ea41,null))[_0xe1b7('0x39')](APIHandleError(_0x13ea41));};exports[_0xe1b7('0xd3')]=function(_0x31acc2,_0x3a171c){var _0x106b95,_0x7172d8,_0x4b3ea7;var _0x358321=[];var _0x5d2392={};var _0xdae68a=_0x31acc2[_0xe1b7('0xd4')]||[];var _0xd497c5=[];var _0x5a3379;return db[_0xe1b7('0xab')][_0xe1b7('0x79')]()[_0xe1b7('0x16')](function(_0x56273f){if(!_0x56273f){throw new db['Sequelize'][(_0xe1b7('0xa0'))]('no\x20available\x20attributes');}_0x358321=_[_0xe1b7('0xa4')](_[_0xe1b7('0x58')](_0x56273f),['createdAt',_0xe1b7('0xa3'),_0xe1b7('0xa5'),_0xe1b7('0xb9')]);if(_0x31acc2[_0xe1b7('0x71')]['id']){delete _0x31acc2['body']['id'];}if(_['isNil'](_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0xa6')])){throw _0x3a171c[_0xe1b7('0x2a')](0x1f4)[_0xe1b7('0x2e')](new db[(_0xe1b7('0x9f'))][(_0xe1b7('0xa0'))](_0xe1b7('0xd5')));}if(_[_0xe1b7('0x95')](_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0x71')])||_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0x71')]===''){throw _0x3a171c[_0xe1b7('0x2a')](0x1f4)['send'](new db[(_0xe1b7('0x9f'))][(_0xe1b7('0xa0'))](_0xe1b7('0xd6')));}if(_['isNil'](_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0xd7')])){throw _0x3a171c[_0xe1b7('0x2a')](0x1f4)['send'](new db['Sequelize'][(_0xe1b7('0xa0'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x358321));}if(!_[_0xe1b7('0xa9')](_0x358321,_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0xd7')])){throw _0x3a171c[_0xe1b7('0x2a')](0x1f4)[_0xe1b7('0x2e')](new db['Sequelize'][(_0xe1b7('0xa0'))](_0xe1b7('0xd8')+_0x358321));}_0x5d2392[_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0xd7')]]=_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0xa6')];})[_0xe1b7('0x16')](function(){return db['ChatWebsite'][_0xe1b7('0x6f')]({'where':{'id':_0x31acc2[_0xe1b7('0x6c')]['id']},'include':[{'model':db['CmList'],'as':_0xe1b7('0xb0')},{'model':db[_0xe1b7('0xd9')],'as':_0xe1b7('0xd9')}]});})['then'](handleEntityNotFound(_0x3a171c,null))['then'](function(_0x1505c4){if(_0x1505c4&&_0x1505c4[_0xe1b7('0xb0')]){_0x7172d8=_0x1505c4;var _0x258492=_[_0xe1b7('0xb8')](_0x31acc2[_0xe1b7('0x71')],{'firstName':_0x31acc2['body'][_0xe1b7('0xa6')],'phone':_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0xa6')],'ListId':_0x1505c4[_0xe1b7('0xb9')]});_0x258492[_0x31acc2['body'][_0xe1b7('0xd7')]]=_0x31acc2[_0xe1b7('0x71')][_0xe1b7('0xa6')];return db[_0xe1b7('0xab')][_0xe1b7('0xda')]({'where':_0x5d2392,'defaults':_0x258492});}})[_0xe1b7('0xaf')](function(_0x2fa721){if(_0x2fa721){_0x4b3ea7=_0x2fa721;var _0x3a3840=fs[_0xe1b7('0xdb')](path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],_0xe1b7('0xdc')),_0xe1b7('0xdd'));var _0x22331f=ejs[_0xe1b7('0xde')](_0x3a3840,{'body':_[_0xe1b7('0xdf')](_0x31acc2['body']['body']),'bodyTitle':_0x7172d8[_0xe1b7('0xe0')]});return db[_0xe1b7('0xe1')][_0xe1b7('0x70')]({'body':_0x22331f,'plainBody':htmlToText[_0xe1b7('0xe2')](_0x22331f),'ContactId':_0x2fa721['id'],'ChatWebsiteId':_0x7172d8['id']});}})['then'](function(_0x32a90c){_0x5a3379=_0x32a90c;if(_0xdae68a[_0xe1b7('0x5d')]){var _0x29ad35=_0xdae68a[_0xe1b7('0x3b')](function(_0x55eb1d){return{'name':_0x55eb1d[_0xe1b7('0xe3')],'basename':_0x55eb1d['filename'],'type':_0x55eb1d[_0xe1b7('0xe4')],'ChatOfflineMessageId':_0x32a90c['id']};});_0xd497c5=_0x29ad35[_0xe1b7('0x3b')](_0x40310c=>{var _0x41140f={'filename':_0x40310c[_0xe1b7('0x2d')],'path':path[_0xe1b7('0x90')](config['root'],_0xe1b7('0xe5'),_0xe1b7('0xd4'),_0xe1b7('0xe6'),_0xe1b7('0xe7'),_0x40310c[_0xe1b7('0xe8')])};return _0x41140f;});if(!_0x7172d8[_0xe1b7('0xe9')]){return db[_0xe1b7('0xea')][_0xe1b7('0xeb')](function(_0x1b7cb9){return db[_0xe1b7('0xec')]['bulkCreate'](_0x29ad35,{'transaction':_0x1b7cb9});});}}})[_0xe1b7('0x16')](function(){if(_0x5a3379){_0x106b95=_0x5a3379;return db[_0xe1b7('0xd9')][_0xe1b7('0x7e')]({'where':{'service':!![]},'include':[{'model':db[_0xe1b7('0xed')],'as':_0xe1b7('0xee'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe1b7('0xef'),'raw':!![]}]}]});}})[_0xe1b7('0x16')](function(_0x2249d1){if(_0x2249d1&&_0x2249d1[_0xe1b7('0xee')]&&_0x7172d8[_0xe1b7('0xf0')]&&_0x7172d8[_0xe1b7('0xf1')]){var _0x485509=_0x2249d1[_0xe1b7('0xf2')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x485509,'message':{'from':util[_0xe1b7('0x32')](_0xe1b7('0xf3'),_0x2249d1[_0xe1b7('0x2d')],_0x2249d1['email']||_0x2249d1['Smtp']['user']),'to':_0x7172d8[_0xe1b7('0xf1')],'subject':_0x7172d8[_0xe1b7('0xf4')],'html':_0x106b95[_0xe1b7('0x71')],'attachments':_0xd497c5}},client9003)['then'](function(){return _0x106b95;})['catch'](function(_0x4b7785){logger['error'](_0x4b7785);});}})[_0xe1b7('0x16')](function(){if(_0x7172d8&&_0x7172d8[_0xe1b7('0xe9')]&&_0x7172d8[_0xe1b7('0xf5')]){var _0x323f23=[];if(_0xdae68a[_0xe1b7('0x5d')]){_0x323f23=_0xdae68a[_0xe1b7('0x3b')](function(_0x2cb17e){return{'name':_0x2cb17e[_0xe1b7('0xe3')],'basename':_0x2cb17e[_0xe1b7('0x8a')],'type':_0x2cb17e[_0xe1b7('0xe4')],'ChatOfflineMessageId':_0x5a3379['id']};});}var _0xf9b6b2;if(!_[_0xe1b7('0x95')](_0x7172d8[_0xe1b7('0xf6')])){var _0x5b09e7=_['map'](_0x31acc2['body'],function(_0x53d914){return _0x53d914;});var _0xdb89cb=_[_0xe1b7('0xf7')](_0x5b09e7)[0x0];var _0xcd8bf8=_[_0xe1b7('0xf8')](_0xdb89cb,function(_0x24ff53){return _0x24ff53;});_0xf9b6b2=_0xcd8bf8[0x1][_0x7172d8['subjectOffline']];}var _0x212041={'from':_0x4b3ea7[_0xe1b7('0xf9')],'firstName':_0x4b3ea7[_0xe1b7('0x48')],'lastName':_0x4b3ea7['lastName'],'mapKey':_0xe1b7('0xf9'),'message':{'from':_0x4b3ea7['email'],'to':_0x7172d8[_0xe1b7('0xd9')][_0xe1b7('0xf9')],'cc':'','subject':_[_0xe1b7('0x95')](_0xf9b6b2)?_0x7172d8[_0xe1b7('0xf4')]:_0xf9b6b2,'messageId':'','sentAt':new Date(),'attach':_0x323f23['length'],'attachments':_0x323f23,'originChannel':_0xe1b7('0xfa'),'ChatWebsiteId':_0x7172d8['id'],'ChatOfflineMessageId':_0x106b95['id'],'originTo':_0x7172d8[_0xe1b7('0xd9')][_0xe1b7('0xf9')]},'body':_0x106b95[_0xe1b7('0x71')]};var _0x5693c8={'account':{'id':_0x7172d8[_0xe1b7('0xf5')]},'body':_0x212041,'log':_0xe1b7('0xfb')};return respondWithRpcPromise(_0xe1b7('0xfb'),_0xe1b7('0xfc'),_0x5693c8,client9001)[_0xe1b7('0x16')](function(){return _0x106b95;})[_0xe1b7('0x39')](function(_0x238830){logger[_0xe1b7('0x1c')](_0x238830);});}return;})[_0xe1b7('0x16')](function(){if(_0x106b95){return _0x106b95;}})[_0xe1b7('0x16')](respondWithResult(_0x3a171c,null))[_0xe1b7('0x39')](function(){for(var _0x2c5ba3 of _0xdae68a){var _0x27cadf=path['join'](config['root'],_0xe1b7('0xe5'),_0xe1b7('0xd4'),_0xe1b7('0xe6'),_0xe1b7('0xe7'),_0x2c5ba3[_0xe1b7('0x8a')]);fs_extra['remove'](_0x27cadf)[_0xe1b7('0x39')](function(_0x5bf10a){logger[_0xe1b7('0x1c')](_0xe1b7('0xfd'),_0x27cadf,_0x5bf10a);});}});};exports['addInteraction']=function(_0x5244ab,_0x5c36c6){return db[_0xe1b7('0xbb')][_0xe1b7('0x6f')]({'where':{'id':_0x5244ab[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x5c36c6,null))['then'](function(_0x297d08){if(_0x297d08){return _0x297d08[_0xe1b7('0xfe')](_0x5244ab[_0xe1b7('0x71')][_0xe1b7('0x80')],_[_0xe1b7('0xff')](_0x5244ab['body'],[_0xe1b7('0x80'),'id'])||{});}})[_0xe1b7('0x16')](respondWithResult(_0x5c36c6,null))[_0xe1b7('0x39')](handleError(_0x5c36c6,null));};exports[_0xe1b7('0x100')]=function(_0x4261e6,_0x277c51){var _0xd4af02={'raw':![],'where':{}};var _0x182da6={};var _0x3f7fc9={'count':0x0,'rows':[]};return db[_0xe1b7('0x67')]['findOne']({'where':{'id':_0x4261e6[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x277c51,null))['then'](function(_0x407ad6){if(_0x407ad6){_0x182da6[_0xe1b7('0x50')]=_[_0xe1b7('0x58')](db[_0xe1b7('0xbb')][_0xe1b7('0x101')]);_0x182da6['query']=_[_0xe1b7('0x58')](_0x4261e6[_0xe1b7('0x57')]);_0x182da6['filters']=_[_0xe1b7('0x5a')](_0x182da6[_0xe1b7('0x50')],_0x182da6[_0xe1b7('0x57')]);_0xd4af02[_0xe1b7('0x5b')]=_[_0xe1b7('0x5a')](_0x182da6['model'],qs['fields'](_0x4261e6['query'][_0xe1b7('0x5c')]));_0xd4af02[_0xe1b7('0x5b')]=_0xd4af02[_0xe1b7('0x5b')][_0xe1b7('0x5d')]?_0xd4af02['attributes']:_0x182da6[_0xe1b7('0x50')];if(!_0x4261e6[_0xe1b7('0x57')][_0xe1b7('0x5e')](_0xe1b7('0x5f'))){_0xd4af02[_0xe1b7('0x24')]=qs[_0xe1b7('0x24')](_0x4261e6['query']['limit']);_0xd4af02[_0xe1b7('0x22')]=qs[_0xe1b7('0x22')](_0x4261e6[_0xe1b7('0x57')][_0xe1b7('0x22')]);}_0xd4af02[_0xe1b7('0x60')]=qs['sort'](_0x4261e6['query'][_0xe1b7('0x61')]);_0xd4af02[_0xe1b7('0x62')]=qs[_0xe1b7('0x59')](_[_0xe1b7('0x63')](_0x4261e6['query'],_0x182da6[_0xe1b7('0x59')]));_0xd4af02[_0xe1b7('0x62')][_0xe1b7('0x7b')]=_0x407ad6['id'];if(_0x4261e6[_0xe1b7('0x57')][_0xe1b7('0x66')]){_0xd4af02['where']=_['merge'](_0xd4af02['where'],{'$or':_['map'](_0xd4af02[_0xe1b7('0x5b')],function(_0x20f956){var _0x9029f9={};_0x9029f9[_0x20f956]={'$like':'%'+_0x4261e6[_0xe1b7('0x57')][_0xe1b7('0x66')]+'%'};return _0x9029f9;})});}_0xd4af02=_[_0xe1b7('0x64')]({},_0xd4af02,_0x4261e6[_0xe1b7('0x6e')]);return db['ChatInteraction'][_0xe1b7('0x25')]({'where':_0xd4af02[_0xe1b7('0x62')]})[_0xe1b7('0x16')](function(_0x66bb42){_0x3f7fc9[_0xe1b7('0x25')]=_0x66bb42;if(_0x4261e6['query']['includeAll']){_0xd4af02[_0xe1b7('0x84')]=[{'model':db[_0xe1b7('0xab')],'as':_0xe1b7('0x102'),'required':![]},{'model':db['User'],'as':_0xe1b7('0x103'),'attributes':[_0xe1b7('0x2d'),_0xe1b7('0x104'),_0xe1b7('0x105')],'required':![]},{'model':db[_0xe1b7('0x106')],'as':'Tags','attributes':['id',_0xe1b7('0x2d'),_0xe1b7('0x107')],'where':_0x4261e6[_0xe1b7('0x57')][_0xe1b7('0x108')]?{'id':_0x4261e6[_0xe1b7('0x57')][_0xe1b7('0x108')]}:undefined,'required':_0x4261e6[_0xe1b7('0x57')]['tag']?!![]:![]}];}return db[_0xe1b7('0xbb')][_0xe1b7('0x69')](_0xd4af02);})['then'](function(_0x330b11){_0x3f7fc9[_0xe1b7('0x6a')]=_0x330b11;return _0x3f7fc9;});}})[_0xe1b7('0x16')](respondWithFilteredResult(_0x277c51,_0xd4af02))[_0xe1b7('0x39')](handleError(_0x277c51,null));};exports[_0xe1b7('0x30')]=function(_0x1b1074,_0x1b88c5){var _0x726939=0x0;var _0x5f080a=0x0;var _0x3dc41d=![];var _0x5709d4;var _0xe35b42;return db['ChatWebsite'][_0xe1b7('0x6f')]({'where':{'id':_0x1b1074['params']['id']},'include':[{'model':db['Interval'],'as':_0xe1b7('0x3c'),'include':[{'model':db[_0xe1b7('0x3c')],'as':'Intervals','attributes':['id',_0xe1b7('0x33')]}]}]})[_0xe1b7('0x16')](handleEntityNotFound(_0x1b88c5,null))[_0xe1b7('0x16')](function(_0x9d5e85){if(_0x9d5e85){_0x5709d4=_0x9d5e85;return _0x9d5e85[_0xe1b7('0x109')]({'raw':!![]});}})[_0xe1b7('0x16')](function(_0x310c62){if(_0x5709d4){if(_0x310c62){_0xe35b42=_0x310c62;}}return require(_0xe1b7('0x93'))[_0xe1b7('0x94')]();})[_0xe1b7('0x16')](function(_0x38c10e){if(_0x38c10e){_0x5f080a=_0x38c10e['virtual'];_0x3dc41d=_0x38c10e[_0xe1b7('0x10a')];}})['then'](function(){return db[_0xe1b7('0xbb')][_0xe1b7('0x25')]({'where':{'closed':![]}});})[_0xe1b7('0x16')](function(_0x4f5507){_0x726939=_0x4f5507;if(_0x5f080a&&_0x4f5507>_0x5f080a){return db['License'][_0xe1b7('0x7e')]({'where':{'id':0x1}})[_0xe1b7('0x16')](function(_0x43cfa3){if(_0x43cfa3){_0x43cfa3[_0xe1b7('0x10b')]('chatLicenseExceeded');}});}})[_0xe1b7('0x16')](function(){if(!_0x5709d4[_0xe1b7('0x3c')]||!_0x5709d4[_0xe1b7('0x3c')][_0xe1b7('0x3d')])return!![];return checkWebsiteIntervals(_0x5709d4);})[_0xe1b7('0x16')](function(_0x25f11a){var _0x356132=fs[_0xe1b7('0xdb')](path[_0xe1b7('0x90')](config[_0xe1b7('0x91')],'server/files/chat/iframe.ejs'),_0xe1b7('0xdd'));var _0x1ce31b=new url[(_0xe1b7('0x10c'))](_0x5709d4[_0xe1b7('0x10d')])['origin'];var _0x39de60=_0xe1b7('0x10e');var _0x366d80=![];var _0x9d1e4a={'chatVersion':_0x39de60,'chatWebsiteAddressOrigin':_0x1ce31b,'remote':_0x5709d4[_0xe1b7('0x10f')],'query':querystring[_0xe1b7('0x1b')](_[_0xe1b7('0x64')](_0x5709d4[_0xe1b7('0x3e')]({'plain':!![]}),{'customerIp':_0x1b1074['headers'][_0xe1b7('0x45')]||_0x1b1074[_0xe1b7('0x110')][_0xe1b7('0x111')]||_0x1b1074[_0xe1b7('0x112')][_0xe1b7('0x113')]||_0x1b1074['ip'],'referer':_0x1b1074['headers']['referer'],'openedInteractions':_0x726939,'maxInteractions':_0x5f080a,'virtual':_0x3dc41d['virtual'],'online':_0x25f11a,'custom':_0x3dc41d}))[_0xe1b7('0x114')](/'/g,'\x5c\x27')};_0x1b88c5[_0xe1b7('0x2e')](ejs[_0xe1b7('0xde')](Mustache['render'](_0x356132,_0x9d1e4a),{'proactiveActions':_0xe35b42,'alignment':_0x5709d4[_0xe1b7('0x115')],'verticalAlignment':_0x5709d4[_0xe1b7('0x116')],'div_color':_0x5709d4[_0xe1b7('0x107')],'labelText':_0x5709d4['labelText'],'text_color':_0x5709d4[_0xe1b7('0x117')],'text_button_color':_0x5709d4[_0xe1b7('0x118')],'button_color':_0x5709d4[_0xe1b7('0x119')],'background_color':_0x5709d4[_0xe1b7('0x11a')],'hideWhenOffline':_0x5709d4['hideWhenOffline'],'intervalId':_0x5709d4[_0xe1b7('0x11b')],'isDevelopment':_0x366d80,'chatVersion':_0x39de60}));})[_0xe1b7('0x39')](handleError(_0x1b88c5,null));};exports[_0xe1b7('0x11c')]=function(_0x5235ef,_0x46f37f){var _0x16c12d=_0x5235ef['params']['id'];var _0x1a5aed=_0x5235ef['body'];var _0x1702b6=0xc8;var _0x4d4643=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xe1b7('0xea')][_0xe1b7('0x11d')][_0xe1b7('0x11e')][_0xe1b7('0x11f')]},function(_0x38e539){return db[_0xe1b7('0x67')][_0xe1b7('0x7e')]({'where':{'id':_0x16c12d},'transaction':_0x38e539})[_0xe1b7('0x16')](function(_0x35478f){if(_0x35478f){return db[_0xe1b7('0x120')][_0xe1b7('0x28')]({'where':{'ChatWebsiteId':_0x16c12d},'transaction':_0x38e539})[_0xe1b7('0x16')](function(){var _0x23c608=_['map'](_0x1a5aed,function(_0x447935){_0x447935[_0xe1b7('0x7b')]=_0x16c12d;return _0x447935;});return db[_0xe1b7('0x120')][_0xe1b7('0x121')](_0x23c608,{'transaction':_0x38e539});});}else{_0x1702b6=0x194;_0x4d4643=[];}});})[_0xe1b7('0x16')](function(){if(_0x1702b6!==0x194){return db[_0xe1b7('0x120')][_0xe1b7('0x122')]({'where':{'ChatWebsiteId':_0x16c12d},'order':'priority'})[_0xe1b7('0x16')](function(_0x2068ef){_0x4d4643=_0x2068ef;});}})[_0xe1b7('0x39')](function(_0x3d255e){_0x1702b6=0x1f4;logger['error'](_0x3d255e[_0xe1b7('0x2c')]);if(_0x3d255e[_0xe1b7('0x2d')]){delete _0x3d255e[_0xe1b7('0x2d')];}_0x4d4643=_0x3d255e;})['finally'](function(){if(_0x4d4643===null){_0x46f37f[_0xe1b7('0x2b')](_0x1702b6);}else{if(_0x1702b6===0x1f4){_0x46f37f['status'](_0x1702b6)[_0xe1b7('0x2e')](_0x4d4643);}else{_0x46f37f[_0xe1b7('0x2a')](_0x1702b6)[_0xe1b7('0x123')](_0x4d4643);}}});};exports['getApplications']=function(_0x3bb29a,_0x53686c){var _0x3ba2ec={};var _0x1af5c4={};var _0x37af7f;var _0x386287;return db[_0xe1b7('0x67')]['findOne']({'where':{'id':_0x3bb29a[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x53686c,null))[_0xe1b7('0x16')](function(_0x4c9a23){if(_0x4c9a23){_0x37af7f=_0x4c9a23;_0x1af5c4['model']=_[_0xe1b7('0x58')](db[_0xe1b7('0x120')][_0xe1b7('0x101')]);_0x1af5c4[_0xe1b7('0x57')]=_['keys'](_0x3bb29a[_0xe1b7('0x57')]);_0x1af5c4['filters']=_[_0xe1b7('0x5a')](_0x1af5c4['model'],_0x1af5c4[_0xe1b7('0x57')]);_0x3ba2ec['attributes']=_[_0xe1b7('0x5a')](_0x1af5c4[_0xe1b7('0x50')],qs[_0xe1b7('0x5c')](_0x3bb29a[_0xe1b7('0x57')]['fields']));_0x3ba2ec[_0xe1b7('0x5b')]=_0x3ba2ec['attributes'][_0xe1b7('0x5d')]?_0x3ba2ec['attributes']:_0x1af5c4['model'];_0x3ba2ec['order']=qs['sort'](_0x3bb29a[_0xe1b7('0x57')][_0xe1b7('0x61')]);_0x3ba2ec['where']=qs[_0xe1b7('0x59')](_[_0xe1b7('0x63')](_0x3bb29a[_0xe1b7('0x57')],_0x1af5c4[_0xe1b7('0x59')]));if(_0x3bb29a[_0xe1b7('0x57')][_0xe1b7('0x66')]){_0x3ba2ec[_0xe1b7('0x62')]=_[_0xe1b7('0x64')](_0x3ba2ec[_0xe1b7('0x62')],{'$or':_[_0xe1b7('0x3b')](_0x3ba2ec[_0xe1b7('0x5b')],function(_0x6b8cdb){var _0xbb94ee={};_0xbb94ee[_0x6b8cdb]={'$like':'%'+_0x3bb29a[_0xe1b7('0x57')][_0xe1b7('0x66')]+'%'};return _0xbb94ee;})});}_0x3ba2ec=_[_0xe1b7('0x64')]({},_0x3ba2ec,_0x3bb29a[_0xe1b7('0x6e')]);return _0x37af7f[_0xe1b7('0x124')](_0x3ba2ec);}})[_0xe1b7('0x16')](function(_0x1f1546){if(_0x1f1546){_0x386287=_0x1f1546['length'];if(!_0x3bb29a['query'][_0xe1b7('0x5e')](_0xe1b7('0x5f'))){_0x3ba2ec[_0xe1b7('0x24')]=qs[_0xe1b7('0x24')](_0x3bb29a[_0xe1b7('0x57')][_0xe1b7('0x24')]);_0x3ba2ec[_0xe1b7('0x22')]=qs['offset'](_0x3bb29a[_0xe1b7('0x57')][_0xe1b7('0x22')]);}return _0x37af7f[_0xe1b7('0x124')](_0x3ba2ec);}})[_0xe1b7('0x16')](function(_0x3b9eb3){if(_0x3b9eb3){return _0x3b9eb3?{'count':_0x386287,'rows':_0x3b9eb3}:null;}})[_0xe1b7('0x16')](respondWithResult(_0x53686c,null))[_0xe1b7('0x39')](handleError(_0x53686c,null));};exports[_0xe1b7('0x125')]=function(_0x38e548,_0x55e1e4){return db[_0xe1b7('0x126')]['find']({'where':{'id':_0x38e548[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x55e1e4,null))[_0xe1b7('0x16')](function(_0x3b8c9d){if(_0x3b8c9d){return _0x3b8c9d['addProactiveActions'](_0x38e548[_0xe1b7('0x71')][_0xe1b7('0x80')],_[_0xe1b7('0xff')](_0x38e548[_0xe1b7('0x71')],['ids','id'])||{});}})[_0xe1b7('0x16')](respondWithResult(_0x55e1e4,null))['catch'](handleError(_0x55e1e4,null));};exports[_0xe1b7('0x109')]=function(_0x5dacf4,_0x4f6507){var _0x570df7={};var _0x45a2b9={};var _0x4d3529;var _0x279a99;return db[_0xe1b7('0x67')][_0xe1b7('0x7e')]({'where':{'id':_0x5dacf4[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x4f6507,null))[_0xe1b7('0x16')](function(_0x297309){if(_0x297309){_0x4d3529=_0x297309;_0x45a2b9['model']=_[_0xe1b7('0x58')](db['ChatProactiveAction']['rawAttributes']);_0x45a2b9[_0xe1b7('0x57')]=_[_0xe1b7('0x58')](_0x5dacf4[_0xe1b7('0x57')]);_0x45a2b9[_0xe1b7('0x59')]=_[_0xe1b7('0x5a')](_0x45a2b9[_0xe1b7('0x50')],_0x45a2b9[_0xe1b7('0x57')]);_0x570df7[_0xe1b7('0x5b')]=_[_0xe1b7('0x5a')](_0x45a2b9[_0xe1b7('0x50')],qs[_0xe1b7('0x5c')](_0x5dacf4['query'][_0xe1b7('0x5c')]));_0x570df7[_0xe1b7('0x5b')]=_0x570df7['attributes']['length']?_0x570df7['attributes']:_0x45a2b9['model'];_0x570df7[_0xe1b7('0x60')]=qs[_0xe1b7('0x61')](_0x5dacf4[_0xe1b7('0x57')]['sort']);_0x570df7[_0xe1b7('0x62')]=qs[_0xe1b7('0x59')](_[_0xe1b7('0x63')](_0x5dacf4[_0xe1b7('0x57')],_0x45a2b9[_0xe1b7('0x59')]));if(_0x5dacf4[_0xe1b7('0x57')]['filter']){_0x570df7[_0xe1b7('0x62')]=_['merge'](_0x570df7[_0xe1b7('0x62')],{'$or':_['map'](_0x570df7[_0xe1b7('0x5b')],function(_0x12592f){var _0x28f803={};_0x28f803[_0x12592f]={'$like':'%'+_0x5dacf4[_0xe1b7('0x57')][_0xe1b7('0x66')]+'%'};return _0x28f803;})});}_0x570df7=_['merge']({},_0x570df7,_0x5dacf4[_0xe1b7('0x6e')]);return _0x4d3529[_0xe1b7('0x109')](_0x570df7);}})[_0xe1b7('0x16')](function(_0xdbefb9){if(_0xdbefb9){_0x279a99=_0xdbefb9[_0xe1b7('0x5d')];if(!_0x5dacf4[_0xe1b7('0x57')][_0xe1b7('0x5e')]('nolimit')){_0x570df7[_0xe1b7('0x24')]=qs[_0xe1b7('0x24')](_0x5dacf4[_0xe1b7('0x57')][_0xe1b7('0x24')]);_0x570df7[_0xe1b7('0x22')]=qs[_0xe1b7('0x22')](_0x5dacf4[_0xe1b7('0x57')][_0xe1b7('0x22')]);}return _0x4d3529[_0xe1b7('0x109')](_0x570df7);}})[_0xe1b7('0x16')](function(_0x12b21d){if(_0x12b21d){return _0x12b21d?{'count':_0x279a99,'rows':_0x12b21d}:null;}})['then'](respondWithResult(_0x4f6507,null))[_0xe1b7('0x39')](handleError(_0x4f6507,null));};exports['getFields']=function(_0x286ed3,_0x5eb516){var _0x5b4c67=_0x286ed3[_0xe1b7('0x57')][_0xe1b7('0x127')]===_0xe1b7('0x128')?_0xe1b7('0x129'):'onlineForm';return db[_0xe1b7('0x67')]['find']({'attributes':['id',_0x5b4c67],'where':{'id':_0x286ed3[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x5eb516,null))['then'](function(_0x4ca197){if(_0x4ca197){var _0xd5e9a0=_0x4ca197[_0x5b4c67];var _0x4389bd=_0xd5e9a0&&_0xd5e9a0[_0xe1b7('0x12a')]?_0xd5e9a0['items']:[];_0x5eb516[_0xe1b7('0x2e')]({'fromKey':_[_0xe1b7('0x95')](_0xd5e9a0[_0xe1b7('0x12b')])?undefined:_0xd5e9a0[_0xe1b7('0x12b')],'count':_0x4389bd[_0xe1b7('0x5d')],'rows':_0x4389bd});}})[_0xe1b7('0x39')](handleError(_0x5eb516,null));};exports[_0xe1b7('0x12c')]=function(_0xf99fbf,_0x3a6ca6){var _0x19f14c={'raw':![],'where':{}};var _0x5092e1={};var _0x114cd7={'count':0x0,'rows':[]};return db[_0xe1b7('0x67')][_0xe1b7('0x7e')]({'where':{'id':_0xf99fbf[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x3a6ca6,null))[_0xe1b7('0x16')](function(_0xbac304){if(_0xbac304){_0x5092e1['model']=_[_0xe1b7('0x58')](db[_0xe1b7('0xe1')][_0xe1b7('0x101')]);_0x5092e1[_0xe1b7('0x57')]=_[_0xe1b7('0x58')](_0xf99fbf['query']);_0x5092e1[_0xe1b7('0x59')]=_['intersection'](_0x5092e1[_0xe1b7('0x50')],_0x5092e1[_0xe1b7('0x57')]);_0x19f14c[_0xe1b7('0x5b')]=_[_0xe1b7('0x5a')](_0x5092e1[_0xe1b7('0x50')],qs[_0xe1b7('0x5c')](_0xf99fbf[_0xe1b7('0x57')][_0xe1b7('0x5c')]));_0x19f14c[_0xe1b7('0x5b')]=_0x19f14c[_0xe1b7('0x5b')]['length']?_0x19f14c['attributes']:_0x5092e1['model'];if(!_0xf99fbf['query']['hasOwnProperty'](_0xe1b7('0x5f'))){_0x19f14c['limit']=qs[_0xe1b7('0x24')](_0xf99fbf['query'][_0xe1b7('0x24')]);_0x19f14c['offset']=qs[_0xe1b7('0x22')](_0xf99fbf[_0xe1b7('0x57')][_0xe1b7('0x22')]);}_0x19f14c[_0xe1b7('0x60')]=qs[_0xe1b7('0x61')](_0xf99fbf[_0xe1b7('0x57')][_0xe1b7('0x61')]);_0x19f14c['where']=qs[_0xe1b7('0x59')](_[_0xe1b7('0x63')](_0xf99fbf[_0xe1b7('0x57')],_0x5092e1[_0xe1b7('0x59')]));_0x19f14c['where']['ChatWebsiteId']=_0xbac304['id'];if(_0xf99fbf[_0xe1b7('0x57')][_0xe1b7('0x66')]){_0x19f14c[_0xe1b7('0x62')]=_[_0xe1b7('0x64')](_0x19f14c['where'],{'$or':_[_0xe1b7('0x3b')](_0x19f14c['attributes'],function(_0x5de66f){var _0x6c0c0d={};_0x6c0c0d[_0x5de66f]={'$like':'%'+_0xf99fbf[_0xe1b7('0x57')][_0xe1b7('0x66')]+'%'};return _0x6c0c0d;})});}_0x19f14c=_[_0xe1b7('0x64')]({},_0x19f14c,_0xf99fbf[_0xe1b7('0x6e')]);return db[_0xe1b7('0xe1')][_0xe1b7('0x25')]({'where':_0x19f14c[_0xe1b7('0x62')]})['then'](function(_0x1139b2){_0x114cd7[_0xe1b7('0x25')]=_0x1139b2;if(_0xf99fbf[_0xe1b7('0x57')][_0xe1b7('0x68')]){_0x19f14c[_0xe1b7('0x84')]=[{'all':!![]}];}else{_0x19f14c['include']=[{'model':db[_0xe1b7('0xab')],'as':_0xe1b7('0x102'),'required':![]},{'model':db[_0xe1b7('0xec')],'as':_0xe1b7('0x12d'),'required':![]}];}return db[_0xe1b7('0xe1')][_0xe1b7('0x69')](_0x19f14c);})[_0xe1b7('0x16')](function(_0x529dc7){_0x114cd7[_0xe1b7('0x6a')]=_0x529dc7;return _0x114cd7;});}})[_0xe1b7('0x16')](respondWithFilteredResult(_0x3a6ca6,_0x19f14c))[_0xe1b7('0x39')](handleError(_0x3a6ca6,null));};exports[_0xe1b7('0x12e')]=function(_0x364231,_0x5e93e4){return db[_0xe1b7('0x67')]['find']({'where':{'id':_0x364231[_0xe1b7('0x6c')]['id']}})[_0xe1b7('0x16')](handleEntityNotFound(_0x5e93e4,null))[_0xe1b7('0x16')](function(_0x50f762){if(_0x50f762){return _0x50f762[_0xe1b7('0x12e')](_0x364231[_0xe1b7('0x71')]['ids'],_[_0xe1b7('0xff')](_0x364231[_0xe1b7('0x71')],[_0xe1b7('0x80'),'id'])||{})[_0xe1b7('0xaf')](function(_0x58b828){for(var _0x48e162=0x0;_0x48e162<_0x364231[_0xe1b7('0x71')]['ids'][_0xe1b7('0x5d')];_0x48e162+=0x1){socket[_0xe1b7('0x12f')](_0xe1b7('0x130'),{'UserId':Number(_0x364231[_0xe1b7('0x71')][_0xe1b7('0x80')][_0x48e162]),'ChatWebsiteId':Number(_0x364231['params']['id'])});}return _0x58b828;});}})['then'](respondWithResult(_0x5e93e4,null))[_0xe1b7('0x39')](handleError(_0x5e93e4,null));};exports['removeAgents']=function(_0x1d331a,_0x3cf0fe){return db[_0xe1b7('0x67')]['find']({'where':{'id':_0x1d331a[_0xe1b7('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3cf0fe,null))[_0xe1b7('0x16')](function(_0x1da2e3){if(_0x1da2e3){return _0x1da2e3[_0xe1b7('0x131')](_0x1d331a[_0xe1b7('0x57')][_0xe1b7('0x80')])['then'](function(){if(_['isArray'](_0x1d331a[_0xe1b7('0x57')][_0xe1b7('0x80')])){for(var _0x3cf1bf=0x0;_0x3cf1bf<_0x1d331a[_0xe1b7('0x57')][_0xe1b7('0x80')][_0xe1b7('0x5d')];_0x3cf1bf+=0x1){socket['emit'](_0xe1b7('0x132'),{'UserId':Number(_0x1d331a['query'][_0xe1b7('0x80')][_0x3cf1bf]),'ChatWebsiteId':Number(_0x1d331a[_0xe1b7('0x6c')]['id'])});}}else{socket[_0xe1b7('0x12f')]('userChatWebsite:remove',{'UserId':Number(_0x1d331a[_0xe1b7('0x57')][_0xe1b7('0x80')]),'ChatWebsiteId':Number(_0x1d331a[_0xe1b7('0x6c')]['id'])});}});}})[_0xe1b7('0x16')](respondWithStatusCode(_0x3cf0fe,null))['catch'](handleError(_0x3cf0fe,null));};exports[_0xe1b7('0x133')]=function(_0x415457,_0x5b431c){var _0x4206bf={};var _0x407b79={};var _0x3fa647;var _0x4996bb;return db[_0xe1b7('0x67')][_0xe1b7('0x7e')]({'where':{'id':_0x415457[_0xe1b7('0x6c')]['id']}})['then'](handleEntityNotFound(_0x5b431c,null))[_0xe1b7('0x16')](function(_0x47ec87){if(_0x47ec87){_0x3fa647=_0x47ec87;_0x407b79['model']=_['keys'](db[_0xe1b7('0xc8')][_0xe1b7('0x101')]);_0x407b79[_0xe1b7('0x57')]=_['keys'](_0x415457[_0xe1b7('0x57')]);_0x407b79[_0xe1b7('0x59')]=_[_0xe1b7('0x5a')](_0x407b79[_0xe1b7('0x50')],_0x407b79['query']);_0x4206bf[_0xe1b7('0x5b')]=_[_0xe1b7('0x5a')](_0x407b79[_0xe1b7('0x50')],qs['fields'](_0x415457['query']['fields']));_0x4206bf[_0xe1b7('0x5b')]=_0x4206bf[_0xe1b7('0x5b')][_0xe1b7('0x5d')]?_0x4206bf['attributes']:_0x407b79[_0xe1b7('0x50')];_0x4206bf['order']=qs[_0xe1b7('0x61')](_0x415457['query'][_0xe1b7('0x61')]);_0x4206bf[_0xe1b7('0x62')]=qs[_0xe1b7('0x59')](_[_0xe1b7('0x63')](_0x415457['query'],_0x407b79[_0xe1b7('0x59')]));if(_0x415457[_0xe1b7('0x57')][_0xe1b7('0x66')]){_0x4206bf[_0xe1b7('0x62')]=_['merge'](_0x4206bf[_0xe1b7('0x62')],{'$or':_[_0xe1b7('0x3b')](_0x4206bf[_0xe1b7('0x5b')],function(_0x3a9d37){var _0x405ed3={};_0x405ed3[_0x3a9d37]={'$like':'%'+_0x415457[_0xe1b7('0x57')]['filter']+'%'};return _0x405ed3;})});}_0x4206bf=_[_0xe1b7('0x64')]({},_0x4206bf,_0x415457[_0xe1b7('0x6e')]);return _0x3fa647[_0xe1b7('0x133')](_0x4206bf);}})[_0xe1b7('0x16')](function(_0x2301e8){if(_0x2301e8){_0x4996bb=_0x2301e8['length'];if(!_0x415457['query'][_0xe1b7('0x5e')](_0xe1b7('0x5f'))){_0x4206bf['limit']=qs[_0xe1b7('0x24')](_0x415457[_0xe1b7('0x57')][_0xe1b7('0x24')]);_0x4206bf[_0xe1b7('0x22')]=qs['offset'](_0x415457['query']['offset']);}return _0x3fa647[_0xe1b7('0x133')](_0x4206bf);}})[_0xe1b7('0x16')](function(_0x74b700){if(_0x74b700){return _0x74b700?{'count':_0x4996bb,'rows':_0x74b700}:null;}})[_0xe1b7('0x16')](respondWithResult(_0x5b431c,null))['catch'](handleError(_0x5b431c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index fd4b661..be93514 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 _0x0faf=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite','setMaxListeners','save'];(function(_0x397240,_0x1b9c02){var _0x5020e5=function(_0x2747f3){while(--_0x2747f3){_0x397240['push'](_0x397240['shift']());}};_0x5020e5(++_0x1b9c02);}(_0x0faf,0x132));var _0xf0fa=function(_0x1966f3,_0x210ea3){_0x1966f3=_0x1966f3-0x0;var _0x17575f=_0x0faf[_0x1966f3];return _0x17575f;};'use strict';var EventEmitter=require(_0xf0fa('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xf0fa('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf0fa('0x2')](0x0);var events={'afterCreate':_0xf0fa('0x3'),'afterUpdate':_0xf0fa('0x4'),'afterDestroy':_0xf0fa('0x5')};function emitEvent(_0xdc9ce3){return function(_0x515b12,_0xc83253,_0x283f04){ChatWebsiteEvents['emit'](_0xdc9ce3+':'+_0x515b12['id'],_0x515b12);ChatWebsiteEvents[_0xf0fa('0x6')](_0xdc9ce3,_0x515b12);_0x283f04(null);};}for(var e in events){if(events[_0xf0fa('0x7')](e)){var event=events[e];ChatWebsite[_0xf0fa('0x8')](e,emitEvent(event));}}module[_0xf0fa('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x9330=['events','setMaxListeners','remove','emit','hook','exports'];(function(_0x15bb39,_0x42bd41){var _0x88fadc=function(_0x177f6c){while(--_0x177f6c){_0x15bb39['push'](_0x15bb39['shift']());}};_0x88fadc(++_0x42bd41);}(_0x9330,0x14a));var _0x0933=function(_0x4da138,_0x1f4f4e){_0x4da138=_0x4da138-0x0;var _0x36f041=_0x9330[_0x4da138];return _0x36f041;};'use strict';var EventEmitter=require(_0x0933('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0933('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0933('0x2')};function emitEvent(_0x18cf92){return function(_0x39ad54,_0x2964c7,_0x2462a4){ChatWebsiteEvents[_0x0933('0x3')](_0x18cf92+':'+_0x39ad54['id'],_0x39ad54);ChatWebsiteEvents[_0x0933('0x3')](_0x18cf92,_0x39ad54);_0x2462a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x0933('0x4')](e,emitEvent(event));}}module[_0x0933('0x5')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index f8c842c..d5032a4 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 _0x6649=['bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','../../config/logger','api'];(function(_0xf812cd,_0x51eede){var _0x321cfe=function(_0x1bae30){while(--_0x1bae30){_0xf812cd['push'](_0xf812cd['shift']());}};_0x321cfe(++_0x51eede);}(_0x6649,0x112));var _0x9664=function(_0x1546d0,_0xa424d8){_0x1546d0=_0x1546d0-0x0;var _0x1117d2=_0x6649[_0x1546d0];return _0x1117d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9664('0x0'))(_0x9664('0x1'));var moment=require('moment');var BPromise=require(_0x9664('0x2'));var rp=require(_0x9664('0x3'));var fs=require('fs');var path=require(_0x9664('0x4'));var rimraf=require(_0x9664('0x5'));var config=require(_0x9664('0x6'));var attributes=require(_0x9664('0x7'));module[_0x9664('0x8')]=function(_0x1f32e8,_0x2567ac){return _0x1f32e8[_0x9664('0x9')](_0x9664('0xa'),attributes,{'tableName':_0x9664('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xace5=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','lodash','util'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xace5,0x111));var _0x5ace=function(_0x150f14,_0x1ff699){_0x150f14=_0x150f14-0x0;var _0xea1655=_0xace5[_0x150f14];return _0xea1655;};'use strict';var _=require(_0x5ace('0x0'));var util=require(_0x5ace('0x1'));var logger=require(_0x5ace('0x2'))(_0x5ace('0x3'));var moment=require('moment');var BPromise=require(_0x5ace('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ace('0x5'));var rimraf=require(_0x5ace('0x6'));var config=require(_0x5ace('0x7'));var attributes=require(_0x5ace('0x8'));module['exports']=function(_0x27fb14,_0x2e8ab6){return _0x27fb14[_0x5ace('0x9')](_0x5ace('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index aba3167..4b98e0e 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 _0x60da=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5aebb7,_0x29d165){var _0x2dccac=function(_0xa51c32){while(--_0xa51c32){_0x5aebb7['push'](_0x5aebb7['shift']());}};_0x2dccac(++_0x29d165);}(_0x60da,0xf9));var _0xa60d=function(_0x1e39cc,_0x1b141f){_0x1e39cc=_0x1e39cc-0x0;var _0x5e1d93=_0x60da[_0x1e39cc];return _0x5e1d93;};'use strict';var _=require(_0xa60d('0x0'));var util=require(_0xa60d('0x1'));var moment=require(_0xa60d('0x2'));var BPromise=require('bluebird');var rs=require(_0xa60d('0x3'));var fs=require('fs');var Redis=require(_0xa60d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa60d('0x5'));var logger=require(_0xa60d('0x6'))(_0xa60d('0x7'));var config=require(_0xa60d('0x8'));var jayson=require(_0xa60d('0x9'));var client=jayson['client'][_0xa60d('0xa')]({'port':0x232a});config[_0xa60d('0xb')]=_['defaults'](config[_0xa60d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa60d('0xc'))(new Redis(config[_0xa60d('0xb')]));require(_0xa60d('0xd'))[_0xa60d('0xe')](socket);function respondWithRpcPromise(_0xcee6c2,_0x29e3d,_0x470fe1){return new BPromise(function(_0x32febc,_0x427bdd){return client[_0xa60d('0xf')](_0xcee6c2,_0x470fe1)[_0xa60d('0x10')](function(_0x3e6a3d){logger[_0xa60d('0x11')](_0xa60d('0x12'),_0x29e3d,_0xa60d('0x13'));logger[_0xa60d('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x29e3d,_0xa60d('0x13'),JSON[_0xa60d('0x15')](_0x3e6a3d));if(_0x3e6a3d[_0xa60d('0x16')]){if(_0x3e6a3d[_0xa60d('0x16')][_0xa60d('0x17')]===0x1f4){logger[_0xa60d('0x16')](_0xa60d('0x12'),_0x29e3d,_0x3e6a3d[_0xa60d('0x16')][_0xa60d('0x18')]);return _0x427bdd(_0x3e6a3d[_0xa60d('0x16')][_0xa60d('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x29e3d,_0x3e6a3d['error'][_0xa60d('0x18')]);return _0x32febc(_0x3e6a3d[_0xa60d('0x16')]['message']);}else{logger[_0xa60d('0x11')](_0xa60d('0x12'),_0x29e3d,_0xa60d('0x13'));_0x32febc(_0x3e6a3d[_0xa60d('0x19')][_0xa60d('0x18')]);}})[_0xa60d('0x1a')](function(_0x480a9b){logger[_0xa60d('0x16')](_0xa60d('0x12'),_0x29e3d,_0x480a9b);_0x427bdd(_0x480a9b);});});} \ No newline at end of file +var _0xe6d7=['stringify','error','code','message','request\x20sent','catch','lodash','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe6d7,0xf6));var _0x7e6d=function(_0x137459,_0x19eea2){_0x137459=_0x137459-0x0;var _0x2031d2=_0xe6d7[_0x137459];return _0x2031d2;};'use strict';var _=require(_0x7e6d('0x0'));var util=require('util');var moment=require(_0x7e6d('0x1'));var BPromise=require(_0x7e6d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e6d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7e6d('0x4'))('rpc');var config=require(_0x7e6d('0x5'));var jayson=require(_0x7e6d('0x6'));var client=jayson[_0x7e6d('0x7')]['http']({'port':0x232a});config[_0x7e6d('0x8')]=_[_0x7e6d('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e6d('0xa'))(new Redis(config[_0x7e6d('0x8')]));require(_0x7e6d('0xb'))[_0x7e6d('0xc')](socket);function respondWithRpcPromise(_0x427967,_0x586ff4,_0x5ce04f){return new BPromise(function(_0x66aa3b,_0x2e55fa){return client['request'](_0x427967,_0x5ce04f)[_0x7e6d('0xd')](function(_0xf3e3a0){logger[_0x7e6d('0xe')](_0x7e6d('0xf'),_0x586ff4,'request\x20sent');logger[_0x7e6d('0x10')](_0x7e6d('0x11'),_0x586ff4,'request\x20sent',JSON[_0x7e6d('0x12')](_0xf3e3a0));if(_0xf3e3a0[_0x7e6d('0x13')]){if(_0xf3e3a0[_0x7e6d('0x13')][_0x7e6d('0x14')]===0x1f4){logger[_0x7e6d('0x13')](_0x7e6d('0xf'),_0x586ff4,_0xf3e3a0[_0x7e6d('0x13')][_0x7e6d('0x15')]);return _0x2e55fa(_0xf3e3a0['error']['message']);}logger[_0x7e6d('0x13')](_0x7e6d('0xf'),_0x586ff4,_0xf3e3a0[_0x7e6d('0x13')][_0x7e6d('0x15')]);return _0x66aa3b(_0xf3e3a0[_0x7e6d('0x13')]['message']);}else{logger[_0x7e6d('0xe')]('ChatWebsite,\x20%s,\x20%s',_0x586ff4,_0x7e6d('0x16'));_0x66aa3b(_0xf3e3a0['result'][_0x7e6d('0x15')]);}})[_0x7e6d('0x17')](function(_0x280705){logger[_0x7e6d('0x13')](_0x7e6d('0xf'),_0x586ff4,_0x280705);_0x2e55fa(_0x280705);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 9672cb9..5dc9c44 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 _0xf9e0=['remove','update','emit','register','length','chatWebsite:','save'];(function(_0x13cbf0,_0x4d76f7){var _0x596b74=function(_0x591f29){while(--_0x591f29){_0x13cbf0['push'](_0x13cbf0['shift']());}};_0x596b74(++_0x4d76f7);}(_0xf9e0,0x13a));var _0x0f9e=function(_0x327e19,_0x476d8b){_0x327e19=_0x327e19-0x0;var _0x44b763=_0xf9e0[_0x327e19];return _0x44b763;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x0f9e('0x0'),_0x0f9e('0x1'),_0x0f9e('0x2')];function createListener(_0x22f005,_0x5c5ddf){return function(_0x4ce911){_0x5c5ddf[_0x0f9e('0x3')](_0x22f005,_0x4ce911);};}function removeListener(_0x4680b1,_0x151125){return function(){ChatWebsiteEvents['removeListener'](_0x4680b1,_0x151125);};}exports[_0x0f9e('0x4')]=function(_0x613b5f){for(var _0x40b5a6=0x0,_0x4462d6=events[_0x0f9e('0x5')];_0x40b5a6<_0x4462d6;_0x40b5a6++){var _0x12a361=events[_0x40b5a6];var _0x547c0d=createListener(_0x0f9e('0x6')+_0x12a361,_0x613b5f);ChatWebsiteEvents['on'](_0x12a361,_0x547c0d);}}; \ No newline at end of file +var _0xb7c8=['remove','update','removeListener','register','length','chatWebsite:','save'];(function(_0x263714,_0x399b37){var _0x1cd43d=function(_0x2f2d3a){while(--_0x2f2d3a){_0x263714['push'](_0x263714['shift']());}};_0x1cd43d(++_0x399b37);}(_0xb7c8,0xae));var _0x8b7c=function(_0xa4e726,_0x415201){_0xa4e726=_0xa4e726-0x0;var _0x4cfe2f=_0xb7c8[_0xa4e726];return _0x4cfe2f;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x8b7c('0x0'),_0x8b7c('0x1'),_0x8b7c('0x2')];function createListener(_0x599498,_0x1b332c){return function(_0x963abe){_0x1b332c['emit'](_0x599498,_0x963abe);};}function removeListener(_0x4e1f5c,_0x4d6ee6){return function(){ChatWebsiteEvents[_0x8b7c('0x3')](_0x4e1f5c,_0x4d6ee6);};}exports[_0x8b7c('0x4')]=function(_0x293859){for(var _0x554883=0x0,_0x2fa975=events[_0x8b7c('0x5')];_0x554883<_0x2fa975;_0x554883++){var _0x34b79e=events[_0x554883];var _0x38cc82=createListener(_0x8b7c('0x6')+_0x34b79e,_0x293859);ChatWebsiteEvents['on'](_0x34b79e,_0x38cc82);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index a940076..584a9f8 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 _0x990f=['addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','get','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','/:id/users','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','/:id/proactive_actions'];(function(_0x599bc8,_0x585db7){var _0x11e65c=function(_0xab889a){while(--_0xab889a){_0x599bc8['push'](_0x599bc8['shift']());}};_0x11e65c(++_0x585db7);}(_0x990f,0x1b3));var _0xf990=function(_0x576049,_0x3c3a4f){_0x576049=_0x576049-0x0;var _0x409a29=_0x990f[_0x576049];return _0x409a29;};'use strict';var multer=require(_0xf990('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf990('0x1'));var express=require(_0xf990('0x2'));var router=express['Router']();var fs_extra=require(_0xf990('0x3'));var auth=require(_0xf990('0x4'));var interaction=require(_0xf990('0x5'));var config=require('../../config/environment');var controller=require(_0xf990('0x6'));router['get']('/',auth[_0xf990('0x7')](),controller[_0xf990('0x8')]);router['get']('/describe',auth[_0xf990('0x7')](),controller[_0xf990('0x9')]);router['get'](_0xf990('0xa'),auth[_0xf990('0x7')](),controller[_0xf990('0xb')]);router['get'](_0xf990('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xf990('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xf990('0xe')](_0xf990('0xf'),controller['getLogo']);router[_0xf990('0xe')](_0xf990('0x10'),controller[_0xf990('0x11')]);router[_0xf990('0xe')](_0xf990('0x12'),controller[_0xf990('0x13')]);router[_0xf990('0xe')](_0xf990('0x14'),controller[_0xf990('0x15')]);router['get'](_0xf990('0x16'),auth[_0xf990('0x7')](),controller[_0xf990('0x17')]);router[_0xf990('0xe')](_0xf990('0x18'),controller[_0xf990('0x19')]);router['get'](_0xf990('0x1a'),auth['isAuthenticated'](),controller[_0xf990('0x1b')]);router[_0xf990('0xe')]('/:id/proactive_actions',auth[_0xf990('0x7')](),controller[_0xf990('0x1c')]);router[_0xf990('0xe')]('/:id/fields',controller[_0xf990('0x1d')]);router[_0xf990('0xe')](_0xf990('0x1e'),auth[_0xf990('0x7')](),controller['getOfflineMessages']);router[_0xf990('0xe')](_0xf990('0x1f'),auth[_0xf990('0x7')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf990('0x20')](_0xf990('0xc'),auth[_0xf990('0x7')](),controller[_0xf990('0x21')]);router[_0xf990('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf990('0x22')]);var upload=multer({'storage':multer[_0xf990('0x23')]({'destination':function(_0x448373,_0x578c83,_0x46fbea){_0x46fbea(null,path[_0xf990('0x24')](config[_0xf990('0x25')],_0xf990('0x26')));},'filename':function(_0x2adc70,_0x4b25a4,_0x41a5fc){_0x41a5fc(null,util[_0xf990('0x27')](_0xf990('0x28'),Date[_0xf990('0x29')](),_0x4b25a4[_0xf990('0x2a')]));}})});router['post'](_0xf990('0xf'),upload[_0xf990('0x2b')](_0xf990('0x2c')),controller[_0xf990('0x2d')]);var upload=multer({'storage':multer[_0xf990('0x23')]({'destination':function(_0x4c881d,_0x347c95,_0x5dadc9){_0x5dadc9(null,path[_0xf990('0x24')](config[_0xf990('0x25')],_0xf990('0x2e')));},'filename':function(_0x47a3e3,_0xc7ab57,_0x3d16ff){_0x3d16ff(null,util[_0xf990('0x27')](_0xf990('0x28'),Date[_0xf990('0x29')](),_0xc7ab57[_0xf990('0x2a')]));}})});router[_0xf990('0x20')]('/:id/avatar',upload[_0xf990('0x2b')](_0xf990('0x2c')),controller[_0xf990('0x2f')]);var upload=multer({'storage':multer[_0xf990('0x23')]({'destination':function(_0x16e3ad,_0x4ccb63,_0x52420a){_0x52420a(null,path[_0xf990('0x24')](config[_0xf990('0x25')],_0xf990('0x2e')));},'filename':function(_0x4a2f19,_0x5ea599,_0x29a185){_0x29a185(null,util['format'](_0xf990('0x28'),Date[_0xf990('0x29')](),_0x5ea599['originalname']));}})});router[_0xf990('0x20')](_0xf990('0x12'),upload[_0xf990('0x2b')](_0xf990('0x2c')),controller[_0xf990('0x30')]);var upload=multer({'storage':multer[_0xf990('0x23')]({'destination':function(_0x581705,_0x5b3285,_0x3967eb){_0x3967eb(null,path[_0xf990('0x24')](config[_0xf990('0x25')],_0xf990('0x2e')));},'filename':function(_0x5061b1,_0x13187c,_0x59fda0){_0x59fda0(null,util[_0xf990('0x27')]('%s-%s',Date[_0xf990('0x29')](),_0x13187c[_0xf990('0x2a')]));}})});router[_0xf990('0x20')](_0xf990('0x14'),upload[_0xf990('0x2b')](_0xf990('0x2c')),controller['addSystemAvatar']);router[_0xf990('0x20')](_0xf990('0x31'),controller[_0xf990('0x32')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3d8797,_0x34dd2e,_0xc9502f){const _0x59016b=path[_0xf990('0x24')](config[_0xf990('0x25')],_0xf990('0x33'),'attachments',_0xf990('0x34'));fs_extra[_0xf990('0x35')](_0x59016b,function(){_0xc9502f(null,_0x59016b);});},'filename':function(_0x1bcd10,_0x46f782,_0x514697){const _0x23695a=_0x46f782['originalname'][_0xf990('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x44c1db=path[_0xf990('0x37')](_0x23695a);const _0x496c17=Date[_0xf990('0x29')]()+'-'+_0x23695a['replace'](_0x44c1db,'')+_0x44c1db;_0x514697(null,_0x496c17);}})});router[_0xf990('0x20')](_0xf990('0x38'),offlineUploadMulter[_0xf990('0x39')](),controller[_0xf990('0x3a')]);router['post'](_0xf990('0x16'),auth[_0xf990('0x7')](),controller[_0xf990('0x3b')]);router['post']('/:id/applications',auth[_0xf990('0x7')](),controller[_0xf990('0x3c')]);router[_0xf990('0x20')](_0xf990('0x3d'),auth[_0xf990('0x7')](),controller[_0xf990('0x3e')]);router[_0xf990('0x20')](_0xf990('0x1f'),auth[_0xf990('0x7')](),controller[_0xf990('0x3f')]);router[_0xf990('0x40')](_0xf990('0xa'),auth['isAuthenticated'](),controller[_0xf990('0x41')]);router[_0xf990('0x42')](_0xf990('0xa'),auth[_0xf990('0x7')](),controller[_0xf990('0x43')]);router[_0xf990('0x42')](_0xf990('0xc'),auth[_0xf990('0x7')](),controller[_0xf990('0x44')]);router[_0xf990('0x42')](_0xf990('0xd'),auth['isAuthenticated'](),controller[_0xf990('0x45')]);router[_0xf990('0x42')](_0xf990('0x1f'),auth[_0xf990('0x7')](),controller[_0xf990('0x46')]);module['exports']=router; \ No newline at end of file +var _0x4d77=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','file','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','/:id/proactive_actions','addProactiveActions','update','destroy','removeDispositions','removeAnswers','delete','removeAgents'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4d77,0xdf));var _0x74d7=function(_0x13d453,_0x16e7d2){_0x13d453=_0x13d453-0x0;var _0x2a4f7a=_0x4d77[_0x13d453];return _0x2a4f7a;};'use strict';var multer=require('multer');var util=require(_0x74d7('0x0'));var path=require('path');var timeout=require(_0x74d7('0x1'));var express=require(_0x74d7('0x2'));var router=express[_0x74d7('0x3')]();var fs_extra=require(_0x74d7('0x4'));var auth=require(_0x74d7('0x5'));var interaction=require(_0x74d7('0x6'));var config=require(_0x74d7('0x7'));var controller=require('./chatWebsite.controller');router[_0x74d7('0x8')]('/',auth[_0x74d7('0x9')](),controller[_0x74d7('0xa')]);router[_0x74d7('0x8')](_0x74d7('0xb'),auth[_0x74d7('0x9')](),controller[_0x74d7('0xc')]);router[_0x74d7('0x8')](_0x74d7('0xd'),auth['isAuthenticated'](),controller[_0x74d7('0xe')]);router[_0x74d7('0x8')](_0x74d7('0xf'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x10')]);router[_0x74d7('0x8')](_0x74d7('0x11'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x12')]);router[_0x74d7('0x8')](_0x74d7('0x13'),controller[_0x74d7('0x14')]);router[_0x74d7('0x8')](_0x74d7('0x15'),controller[_0x74d7('0x16')]);router[_0x74d7('0x8')](_0x74d7('0x17'),controller[_0x74d7('0x18')]);router[_0x74d7('0x8')](_0x74d7('0x19'),controller[_0x74d7('0x1a')]);router[_0x74d7('0x8')](_0x74d7('0x1b'),auth['isAuthenticated'](),controller[_0x74d7('0x1c')]);router[_0x74d7('0x8')](_0x74d7('0x1d'),controller[_0x74d7('0x1e')]);router['get'](_0x74d7('0x1f'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x20')]);router[_0x74d7('0x8')]('/:id/proactive_actions',auth[_0x74d7('0x9')](),controller[_0x74d7('0x21')]);router[_0x74d7('0x8')]('/:id/fields',controller[_0x74d7('0x22')]);router[_0x74d7('0x8')](_0x74d7('0x23'),auth[_0x74d7('0x9')](),controller['getOfflineMessages']);router['get'](_0x74d7('0x24'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x25')]);router[_0x74d7('0x26')]('/',auth['isAuthenticated'](),controller[_0x74d7('0x27')]);router[_0x74d7('0x26')](_0x74d7('0xf'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x28')]);router[_0x74d7('0x26')](_0x74d7('0x11'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x29')]);var upload=multer({'storage':multer[_0x74d7('0x2a')]({'destination':function(_0x4ac15f,_0x2ed67f,_0x31af24){_0x31af24(null,path[_0x74d7('0x2b')](config[_0x74d7('0x2c')],_0x74d7('0x2d')));},'filename':function(_0x19170f,_0x14c3cd,_0x18aad3){_0x18aad3(null,util[_0x74d7('0x2e')](_0x74d7('0x2f'),Date[_0x74d7('0x30')](),_0x14c3cd[_0x74d7('0x31')]));}})});router[_0x74d7('0x26')](_0x74d7('0x13'),upload[_0x74d7('0x32')]('file'),controller[_0x74d7('0x33')]);var upload=multer({'storage':multer[_0x74d7('0x2a')]({'destination':function(_0x213aa3,_0x3924a4,_0x3d958f){_0x3d958f(null,path[_0x74d7('0x2b')](config[_0x74d7('0x2c')],_0x74d7('0x34')));},'filename':function(_0x34d5d3,_0x39fbf1,_0x512c78){_0x512c78(null,util['format'](_0x74d7('0x2f'),Date[_0x74d7('0x30')](),_0x39fbf1[_0x74d7('0x31')]));}})});router[_0x74d7('0x26')]('/:id/avatar',upload[_0x74d7('0x32')](_0x74d7('0x35')),controller[_0x74d7('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19846d,_0x1b571c,_0x4ad428){_0x4ad428(null,path[_0x74d7('0x2b')](config[_0x74d7('0x2c')],_0x74d7('0x34')));},'filename':function(_0x1188da,_0x3caee6,_0x274f39){_0x274f39(null,util[_0x74d7('0x2e')]('%s-%s',Date[_0x74d7('0x30')](),_0x3caee6[_0x74d7('0x31')]));}})});router[_0x74d7('0x26')]('/:id/customer_avatar',upload[_0x74d7('0x32')](_0x74d7('0x35')),controller[_0x74d7('0x37')]);var upload=multer({'storage':multer[_0x74d7('0x2a')]({'destination':function(_0x3f0576,_0x41a28e,_0x53a942){_0x53a942(null,path[_0x74d7('0x2b')](config[_0x74d7('0x2c')],_0x74d7('0x34')));},'filename':function(_0x2de36f,_0x919205,_0x256621){_0x256621(null,util[_0x74d7('0x2e')]('%s-%s',Date[_0x74d7('0x30')](),_0x919205['originalname']));}})});router[_0x74d7('0x26')](_0x74d7('0x19'),upload[_0x74d7('0x32')]('file'),controller['addSystemAvatar']);router[_0x74d7('0x26')](_0x74d7('0x38'),controller[_0x74d7('0x39')]);const offlineUploadMulter=multer({'storage':multer[_0x74d7('0x2a')]({'destination':function(_0x1d8596,_0x1ee70d,_0x3e94ff){const _0x1cf608=path[_0x74d7('0x2b')](config[_0x74d7('0x2c')],_0x74d7('0x3a'),_0x74d7('0x3b'),_0x74d7('0x3c'));fs_extra[_0x74d7('0x3d')](_0x1cf608,function(){_0x3e94ff(null,_0x1cf608);});},'filename':function(_0x146ca9,_0x1fc11d,_0x18b57e){const _0x7d5cd2=_0x1fc11d[_0x74d7('0x31')][_0x74d7('0x3e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xcd303c=path['extname'](_0x7d5cd2);const _0x532560=Date[_0x74d7('0x30')]()+'-'+_0x7d5cd2[_0x74d7('0x3e')](_0xcd303c,'')+_0xcd303c;_0x18b57e(null,_0x532560);}})});router[_0x74d7('0x26')](_0x74d7('0x3f'),offlineUploadMulter[_0x74d7('0x40')](),controller['offline']);router[_0x74d7('0x26')](_0x74d7('0x1b'),auth[_0x74d7('0x9')](),controller['addInteraction']);router[_0x74d7('0x26')](_0x74d7('0x1f'),auth[_0x74d7('0x9')](),controller['addApplications']);router[_0x74d7('0x26')](_0x74d7('0x41'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x42')]);router['post']('/:id/users',auth[_0x74d7('0x9')](),controller['addAgents']);router['put'](_0x74d7('0xd'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x43')]);router['delete'](_0x74d7('0xd'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x44')]);router['delete'](_0x74d7('0xf'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x45')]);router['delete'](_0x74d7('0x11'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x46')]);router[_0x74d7('0x47')](_0x74d7('0x24'),auth[_0x74d7('0x9')](),controller[_0x74d7('0x48')]);module[_0x74d7('0x49')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 15891ae..8df4db0 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2208=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2208,0xcb));var _0x8220=function(_0x500f60,_0x430934){_0x500f60=_0x500f60-0x0;var _0x45701b=_0x2208[_0x500f60];return _0x45701b;};var beaverLogger=require(_0x8220('0x0'));var express=require(_0x8220('0x1'));var auth=require(_0x8220('0x2'));var config=require(_0x8220('0x3'));var router=express['Router']();var isProduction=config[_0x8220('0x4')]===_0x8220('0x5')||![];function clientSideLogs(_0x13c438,_0x39b490,_0x7ebda3){var _0x37c830=_0x13c438[_0x8220('0x6')][_0x8220('0x7')](_0x8220('0x8'));if(!_0x37c830){throw new Error(_0x8220('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x8220('0xa'),'logger':_0x37c830,'enableCors':!isProduction})(_0x13c438,_0x39b490,_0x7ebda3);}router['use'](auth[_0x8220('0xb')](),clientSideLogs);module[_0x8220('0xc')]=router; \ No newline at end of file +var _0x7b58=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','../components/auth/service','Router','env'];(function(_0x49e175,_0x1f0e25){var _0x250bb6=function(_0x3c2685){while(--_0x3c2685){_0x49e175['push'](_0x49e175['shift']());}};_0x250bb6(++_0x1f0e25);}(_0x7b58,0xad));var _0x87b5=function(_0x173d97,_0x1028d6){_0x173d97=_0x173d97-0x0;var _0x2ebce0=_0x7b58[_0x173d97];return _0x2ebce0;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x87b5('0x0'));var config=require('../config/environment');var router=express[_0x87b5('0x1')]();var isProduction=config[_0x87b5('0x2')]==='production'||![];function clientSideLogs(_0x482111,_0x2b2801,_0xed3e5c){var _0x514a7b=_0x482111[_0x87b5('0x3')][_0x87b5('0x4')](_0x87b5('0x5'));if(!_0x514a7b){throw new Error(_0x87b5('0x6'));}return beaverLogger[_0x87b5('0x7')]({'uri':_0x87b5('0x8'),'logger':_0x514a7b,'enableCors':!isProduction})(_0x482111,_0x2b2801,_0xed3e5c);}router['use'](auth[_0x87b5('0x9')](),clientSideLogs);module[_0x87b5('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 65a049e..bdbd455 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 _0x2195=['sequelize','STRING','ENUM','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x53dbf0,_0x178fc2){var _0x36e68f=function(_0x424641){while(--_0x424641){_0x53dbf0['push'](_0x53dbf0['shift']());}};_0x36e68f(++_0x178fc2);}(_0x2195,0x180));var _0x5219=function(_0x1622a0,_0x2b55a9){_0x1622a0=_0x1622a0-0x0;var _0x2a2308=_0x2195[_0x1622a0];return _0x2a2308;};'use strict';var Sequelize=require(_0x5219('0x0'));module['exports']={'name':{'type':Sequelize[_0x5219('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5219('0x2')]('AmazonAWS','Google',_0x5219('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5219('0x2')](_0x5219('0x4'),_0x5219('0x5'))},'data1':{'type':Sequelize[_0x5219('0x1')],'comment':_0x5219('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0x5219('0x7')},'data3':{'type':Sequelize[_0x5219('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x5219('0x1')],'comment':_0x5219('0x8')},'data5':{'type':Sequelize[_0x5219('0x9')],'comment':_0x5219('0xa')},'data6':{'type':Sequelize[_0x5219('0x9')],'comment':_0x5219('0xb')},'data7':{'type':Sequelize[_0x5219('0x9')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xd613=['exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize'];(function(_0x545e05,_0x27180e){var _0x26d054=function(_0x304906){while(--_0x304906){_0x545e05['push'](_0x545e05['shift']());}};_0x26d054(++_0x27180e);}(_0xd613,0x1bf));var _0x3d61=function(_0x1559b7,_0x4b703d){_0x1559b7=_0x1559b7-0x0;var _0x38982e=_0xd613[_0x1559b7];return _0x38982e;};'use strict';var Sequelize=require(_0x3d61('0x0'));module[_0x3d61('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3d61('0x2')](_0x3d61('0x3'),_0x3d61('0x4'),_0x3d61('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x3d61('0x2')](_0x3d61('0x6'),_0x3d61('0x7'))},'data1':{'type':Sequelize[_0x3d61('0x8')],'comment':_0x3d61('0x9')},'data2':{'type':Sequelize[_0x3d61('0x8')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x3d61('0xa')},'data4':{'type':Sequelize[_0x3d61('0x8')],'comment':_0x3d61('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0x3d61('0xc')},'data6':{'type':Sequelize[_0x3d61('0xd')],'comment':_0x3d61('0xe')},'data7':{'type':Sequelize[_0x3d61('0xd')],'comment':_0x3d61('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 0c8acea..fd4ccff 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 _0x262c=['key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','CloudProvider','includeAll','include','findAll','data3','catch','show','params','keys','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','parse','from','state','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','update','then','end','error','stack','name','send','padEnd','slice','index','map','rawAttributes','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x262c,0xf4));var _0xc262=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x262c[_0x2797c6];return _0x54809f;};'use strict';var _=require(_0xc262('0x0'));var Redis=require(_0xc262('0x1'));var qs=require(_0xc262('0x2'));var encryptor=require(_0xc262('0x3'));var config=require(_0xc262('0x4'));var logger=require('../../config/logger')(_0xc262('0x5'));var db=require(_0xc262('0x6'))['db'];var oauth=require(_0xc262('0x7'));config['redis']=_['defaults'](config[_0xc262('0x8')],{'host':_0xc262('0x9'),'port':0x18eb});var socket=require(_0xc262('0xa'))(new Redis(config[_0xc262('0x8')]));var redis=new Redis(config[_0xc262('0x8')]);function respondWithStatusCode(_0x931cfe,_0x382fa1){_0x382fa1=_0x382fa1||0xcc;return function(_0x44b79f){if(_0x44b79f){return _0x931cfe[_0xc262('0xb')](_0x382fa1);}return _0x931cfe[_0xc262('0xc')](_0x382fa1)['end']();};}function respondWithResult(_0x1427db,_0x2fa1b1){_0x2fa1b1=_0x2fa1b1||0xc8;return function(_0x4a8960){if(_0x4a8960){return _0x1427db[_0xc262('0xc')](_0x2fa1b1)[_0xc262('0xd')](_0x4a8960);}};}function respondWithFilteredResult(_0x38f36a,_0x22abc8){return function(_0x7b1428){if(_0x7b1428){var _0x20827b=typeof _0x22abc8[_0xc262('0xe')]===_0xc262('0xf')&&typeof _0x22abc8[_0xc262('0x10')]==='undefined';var _0x4bab7c=_0x7b1428[_0xc262('0x11')];var _0x2a3af9=_0x20827b?0x0:_0x22abc8[_0xc262('0xe')];var _0x3fbef3=_0x20827b?_0x7b1428['count']:_0x22abc8[_0xc262('0xe')]+_0x22abc8[_0xc262('0x10')];var _0xebd9d2;if(_0x3fbef3>=_0x4bab7c){_0x3fbef3=_0x4bab7c;_0xebd9d2=0xc8;}else{_0xebd9d2=0xce;}_0x38f36a[_0xc262('0xc')](_0xebd9d2);return _0x38f36a[_0xc262('0x12')]('Content-Range',_0x2a3af9+'-'+_0x3fbef3+'/'+_0x4bab7c)[_0xc262('0xd')](_0x7b1428);}return null;};}function saveUpdates(_0x1396b4){return function(_0x10f531){if(_0x10f531){return _0x10f531[_0xc262('0x13')](_0x1396b4)[_0xc262('0x14')](function(_0x3a7c32){return _0x3a7c32;});}return null;};}function removeEntity(_0x99c109){return function(_0x445626){if(_0x445626){return _0x445626['destroy']()[_0xc262('0x14')](function(){_0x99c109['status'](0xcc)[_0xc262('0x15')]();});}};}function handleEntityNotFound(_0x3797dc){return function(_0x4a0387){if(!_0x4a0387){_0x3797dc['sendStatus'](0x194);}return _0x4a0387;};}function handleError(_0x5a674c,_0x37ddf8){_0x37ddf8=_0x37ddf8||0x1f4;return function(_0x1edca7){logger[_0xc262('0x16')](_0x1edca7[_0xc262('0x17')]);if(_0x1edca7[_0xc262('0x18')]){delete _0x1edca7['name'];}_0x5a674c[_0xc262('0xc')](_0x37ddf8)[_0xc262('0x19')](_0x1edca7);};}function maskClientSecret(_0x543315){return _[_0xc262('0x1a')](_0x543315[_0xc262('0x1b')](0x0,0x3),0x14,'*');}exports[_0xc262('0x1c')]=function(_0x102611,_0xf1e40b){var _0x4052a1={},_0x1e49a4={},_0x3f745f={'count':0x0,'rows':[]};var _0x14060f=_[_0xc262('0x1d')](db['CloudProvider'][_0xc262('0x1e')],function(_0x51c795){return{'name':_0x51c795['fieldName'],'type':_0x51c795[_0xc262('0x1f')][_0xc262('0x20')]};});_0x1e49a4[_0xc262('0x21')]=_[_0xc262('0x1d')](_0x14060f,_0xc262('0x18'));_0x1e49a4['query']=_['keys'](_0x102611['query']);_0x1e49a4[_0xc262('0x22')]=_[_0xc262('0x23')](_0x1e49a4[_0xc262('0x21')],_0x1e49a4[_0xc262('0x24')]);_0x4052a1[_0xc262('0x25')]=_[_0xc262('0x23')](_0x1e49a4[_0xc262('0x21')],qs[_0xc262('0x26')](_0x102611[_0xc262('0x24')][_0xc262('0x26')]));_0x4052a1[_0xc262('0x25')]=_0x4052a1['attributes'][_0xc262('0x27')]?_0x4052a1[_0xc262('0x25')]:_0x1e49a4['model'];if(!_0x102611[_0xc262('0x24')][_0xc262('0x28')]('nolimit')){_0x4052a1[_0xc262('0x10')]=qs[_0xc262('0x10')](_0x102611[_0xc262('0x24')][_0xc262('0x10')]);_0x4052a1[_0xc262('0xe')]=qs[_0xc262('0xe')](_0x102611['query']['offset']);}_0x4052a1['order']=qs['sort'](_0x102611[_0xc262('0x24')][_0xc262('0x29')]);_0x4052a1[_0xc262('0x2a')]=qs[_0xc262('0x22')](_[_0xc262('0x2b')](_0x102611['query'],_0x1e49a4[_0xc262('0x22')]),_0x14060f);if(_0x102611['query']['filter']){_0x4052a1[_0xc262('0x2a')]=_[_0xc262('0x2c')](_0x4052a1[_0xc262('0x2a')],{'$or':_[_0xc262('0x1d')](_0x14060f,function(_0x1ced98){if(_0x1ced98[_0xc262('0x1f')]!=='VIRTUAL'){var _0x352992={};_0x352992[_0x1ced98[_0xc262('0x18')]]={'$like':'%'+_0x102611[_0xc262('0x24')][_0xc262('0x2d')]+'%'};return _0x352992;}})});}_0x4052a1=_[_0xc262('0x2c')]({},_0x4052a1,_0x102611[_0xc262('0x2e')]);var _0x316f34={'where':_0x4052a1[_0xc262('0x2a')]};return db[_0xc262('0x2f')][_0xc262('0x11')](_0x316f34)['then'](function(_0x3541ff){_0x3f745f[_0xc262('0x11')]=_0x3541ff;if(_0x102611[_0xc262('0x24')][_0xc262('0x30')]){_0x4052a1[_0xc262('0x31')]=[{'all':!![]}];}return db[_0xc262('0x2f')][_0xc262('0x32')](_0x4052a1);})['then'](function(_0x20d4c4){_0x3f745f['rows']=_[_0xc262('0x1d')](_0x20d4c4,function(_0x72eecd){if(_0x72eecd['service']==='MicrosoftAzure'){var _0x4289a3=encryptor['decryptString'](_0x72eecd[_0xc262('0x33')]);_0x72eecd['data3']=maskClientSecret(_0x4289a3);}return _0x72eecd;});return _0x3f745f;})[_0xc262('0x14')](respondWithFilteredResult(_0xf1e40b,_0x4052a1))[_0xc262('0x34')](handleError(_0xf1e40b,null));};exports[_0xc262('0x35')]=function(_0x55a5fc,_0x30fd59){var _0x594565={'raw':!![],'where':{'id':_0x55a5fc[_0xc262('0x36')]['id']}},_0x5e6976={};_0x5e6976['model']=_[_0xc262('0x37')](db[_0xc262('0x2f')]['rawAttributes']);_0x5e6976[_0xc262('0x24')]=_['keys'](_0x55a5fc[_0xc262('0x24')]);_0x5e6976['filters']=_[_0xc262('0x23')](_0x5e6976[_0xc262('0x21')],_0x5e6976[_0xc262('0x24')]);_0x594565[_0xc262('0x25')]=_[_0xc262('0x23')](_0x5e6976[_0xc262('0x21')],qs[_0xc262('0x26')](_0x55a5fc[_0xc262('0x24')][_0xc262('0x26')]));_0x594565['attributes']=_0x594565['attributes']['length']?_0x594565[_0xc262('0x25')]:_0x5e6976[_0xc262('0x21')];if(_0x55a5fc['query'][_0xc262('0x30')]){_0x594565[_0xc262('0x31')]=[{'all':!![]}];}_0x594565=_[_0xc262('0x2c')]({},_0x594565,_0x55a5fc[_0xc262('0x2e')]);return db['CloudProvider'][_0xc262('0x38')](_0x594565)[_0xc262('0x14')](handleEntityNotFound(_0x30fd59,null))[_0xc262('0x14')](function(_0x300741){if(_0x300741[_0xc262('0x39')]==='MicrosoftAzure'){var _0x31dcbc=encryptor['decryptString'](_0x300741['data3']);_0x300741['data3']=maskClientSecret(_0x31dcbc);}return _0x300741;})[_0xc262('0x14')](respondWithResult(_0x30fd59,null))[_0xc262('0x34')](handleError(_0x30fd59,null));};exports[_0xc262('0x3a')]=function(_0x3c2f68,_0x23b7b4){if(!_0x3c2f68[_0xc262('0x3b')]['name'])throw new Error(_0xc262('0x3c'));if(!_0x3c2f68['body'][_0xc262('0x39')])throw new Error(_0xc262('0x3d'));var _0x84fb31=db[_0xc262('0x2f')][_0xc262('0x1e')][_0xc262('0x39')][_0xc262('0x3e')];if(!_0x84fb31['includes'](_0x3c2f68[_0xc262('0x3b')][_0xc262('0x39')]))throw new Error(_0xc262('0x3f')+_0x84fb31[_0xc262('0x40')](',\x20'));if(_0x3c2f68[_0xc262('0x3b')]['service']===_0xc262('0x41')&&_0x3c2f68[_0xc262('0x3b')][_0xc262('0x33')]){_0x3c2f68['body'][_0xc262('0x33')]=encryptor[_0xc262('0x42')](_0x3c2f68[_0xc262('0x3b')][_0xc262('0x33')]);}return db[_0xc262('0x2f')][_0xc262('0x3a')](_0x3c2f68[_0xc262('0x3b')],{})[_0xc262('0x14')](respondWithResult(_0x23b7b4,0xc9))[_0xc262('0x34')](handleError(_0x23b7b4,null));};exports[_0xc262('0x13')]=function(_0x3b48a9,_0x3900d5){if(_0x3b48a9[_0xc262('0x3b')]['id']){delete _0x3b48a9[_0xc262('0x3b')]['id'];}return db[_0xc262('0x2f')][_0xc262('0x38')]({'where':{'id':_0x3b48a9['params']['id']}})[_0xc262('0x14')](handleEntityNotFound(_0x3900d5,null))[_0xc262('0x14')](function(_0x2982fc){if(_0x2982fc['service']===_0xc262('0x41')&&_0x3b48a9[_0xc262('0x3b')][_0xc262('0x33')]){_0x3b48a9[_0xc262('0x3b')]['data3']=encryptor[_0xc262('0x42')](_0x3b48a9[_0xc262('0x3b')][_0xc262('0x33')]);}return _0x2982fc;})['then'](saveUpdates(_0x3b48a9[_0xc262('0x3b')],null))['then'](respondWithResult(_0x3900d5,null))[_0xc262('0x34')](handleError(_0x3900d5,null));};exports[_0xc262('0x43')]=function(_0x3ae17c,_0x4d42ba){return db[_0xc262('0x2f')][_0xc262('0x38')]({'where':{'id':_0x3ae17c[_0xc262('0x36')]['id']}})[_0xc262('0x14')](handleEntityNotFound(_0x4d42ba,null))[_0xc262('0x14')](removeEntity(_0x4d42ba,null))[_0xc262('0x34')](handleError(_0x4d42ba,null));};exports[_0xc262('0x44')]=function(_0x2b44cc,_0x2e486b){return db['CloudProvider'][_0xc262('0x45')]({'where':{'id':_0x2b44cc[_0xc262('0x36')]['id']},'raw':!![]})[_0xc262('0x14')](function(_0x578230){if(!_0x578230)return _0x2e486b[_0xc262('0xb')](0x194);return{'url':oauth[_0xc262('0x46')](_0x578230,_0x2b44cc[_0xc262('0x47')]['id'])};})['then'](respondWithResult(_0x2e486b,null))[_0xc262('0x34')](handleError(_0x2e486b,null));};exports[_0xc262('0x48')]=function(_0x5f346b,_0x49b2d2){var _0x18727b=_0x5f346b[_0xc262('0x3b')];var _0xbd41e0;var _0x514a89;if(_0x18727b[_0xc262('0x16')])throw _0x18727b;redis['get'](_0x18727b['state'])[_0xc262('0x14')](function(_0x45c918){if(!_0x45c918)throw new Error('Invalid\x20state\x20parameter');_0xbd41e0=JSON[_0xc262('0x49')](_0x45c918);var _0x2ca610=Buffer[_0xc262('0x4a')](_0x18727b[_0xc262('0x4b')],_0xc262('0x4c'))['toString']('ascii');_0x514a89=JSON[_0xc262('0x49')](_0x2ca610);if(!oauth[_0xc262('0x4d')](_0x18727b[_0xc262('0x4e')],_0xbd41e0[_0xc262('0x4f')]))throw new Error(_0xc262('0x50'));redis[_0xc262('0x51')](_0x18727b[_0xc262('0x4b')]);return oauth['getOauth2MicrosoftAccessToken'](_0x18727b[_0xc262('0x52')],_0xbd41e0);})[_0xc262('0x14')](function(_0x20f34e){_0xbd41e0['data5']=_0x20f34e[_0xc262('0x53')];_0xbd41e0[_0xc262('0x54')]=_0x20f34e[_0xc262('0x55')];return db[_0xc262('0x2f')][_0xc262('0x13')]({'data5':_0xbd41e0[_0xc262('0x56')],'data6':_0xbd41e0['data6']},{'where':{'id':_0xbd41e0['id']}});})[_0xc262('0x14')](function(){oauth[_0xc262('0x57')](_0xbd41e0);socket[_0xc262('0x58')]('microsoftAuthorization:success',{'id':_0x514a89['id']});return;})[_0xc262('0x14')](respondWithStatusCode(_0x49b2d2,null))[_0xc262('0x34')](function(_0x3da2dc){if(_0x514a89){socket[_0xc262('0x58')](_0xc262('0x59'),{'id':_0x514a89['id']});}if(!_0xbd41e0){logger[_0xc262('0x16')](_0xc262('0x5a'),_0x3da2dc);return _0x49b2d2[_0xc262('0xc')](0x1f4)[_0xc262('0x19')](_0x3da2dc['message']);}logger[_0xc262('0x16')](_0xc262('0x5b'),_0xbd41e0['id'],JSON['stringify'](_0x3da2dc));});}; \ No newline at end of file +var _0xde20=['stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','params','filters','length','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','catch','findOne','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','base64','ascii','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','./cloudProvider.oauth','redis','localhost','socket.io-emitter','end','json','limit','undefined','count','offset','status','set','Content-Range','update','then','destroy','sendStatus','error'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xde20,0x1b9));var _0x0de2=function(_0x40e2e4,_0x5972b6){_0x40e2e4=_0x40e2e4-0x0;var _0x5a6cbf=_0xde20[_0x40e2e4];return _0x5a6cbf;};'use strict';var _=require(_0x0de2('0x0'));var Redis=require(_0x0de2('0x1'));var qs=require(_0x0de2('0x2'));var encryptor=require(_0x0de2('0x3'));var config=require('../../config/environment');var logger=require(_0x0de2('0x4'))(_0x0de2('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x0de2('0x6'));config[_0x0de2('0x7')]=_['defaults'](config[_0x0de2('0x7')],{'host':_0x0de2('0x8'),'port':0x18eb});var socket=require(_0x0de2('0x9'))(new Redis(config[_0x0de2('0x7')]));var redis=new Redis(config[_0x0de2('0x7')]);function respondWithStatusCode(_0xf237dd,_0x27542d){_0x27542d=_0x27542d||0xcc;return function(_0x4d03db){if(_0x4d03db){return _0xf237dd['sendStatus'](_0x27542d);}return _0xf237dd['status'](_0x27542d)[_0x0de2('0xa')]();};}function respondWithResult(_0x312c6a,_0x17e718){_0x17e718=_0x17e718||0xc8;return function(_0x4655c5){if(_0x4655c5){return _0x312c6a['status'](_0x17e718)[_0x0de2('0xb')](_0x4655c5);}};}function respondWithFilteredResult(_0x3d35c0,_0x1c97df){return function(_0x348f56){if(_0x348f56){var _0x78ab2b=typeof _0x1c97df['offset']==='undefined'&&typeof _0x1c97df[_0x0de2('0xc')]===_0x0de2('0xd');var _0x14ca41=_0x348f56[_0x0de2('0xe')];var _0xb918b1=_0x78ab2b?0x0:_0x1c97df[_0x0de2('0xf')];var _0x7bb60a=_0x78ab2b?_0x348f56['count']:_0x1c97df[_0x0de2('0xf')]+_0x1c97df['limit'];var _0x5d3847;if(_0x7bb60a>=_0x14ca41){_0x7bb60a=_0x14ca41;_0x5d3847=0xc8;}else{_0x5d3847=0xce;}_0x3d35c0[_0x0de2('0x10')](_0x5d3847);return _0x3d35c0[_0x0de2('0x11')](_0x0de2('0x12'),_0xb918b1+'-'+_0x7bb60a+'/'+_0x14ca41)['json'](_0x348f56);}return null;};}function saveUpdates(_0x4c825a){return function(_0x4c25ad){if(_0x4c25ad){return _0x4c25ad[_0x0de2('0x13')](_0x4c825a)[_0x0de2('0x14')](function(_0xea63d1){return _0xea63d1;});}return null;};}function removeEntity(_0x58734e){return function(_0x4f7629){if(_0x4f7629){return _0x4f7629[_0x0de2('0x15')]()[_0x0de2('0x14')](function(){_0x58734e[_0x0de2('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b89f){return function(_0x41996a){if(!_0x41996a){_0x16b89f[_0x0de2('0x16')](0x194);}return _0x41996a;};}function handleError(_0xffe8c5,_0x56ba88){_0x56ba88=_0x56ba88||0x1f4;return function(_0x46c6d6){logger[_0x0de2('0x17')](_0x46c6d6[_0x0de2('0x18')]);if(_0x46c6d6[_0x0de2('0x19')]){delete _0x46c6d6[_0x0de2('0x19')];}_0xffe8c5[_0x0de2('0x10')](_0x56ba88)[_0x0de2('0x1a')](_0x46c6d6);};}function maskClientSecret(_0x56bea4){return _[_0x0de2('0x1b')](_0x56bea4['slice'](0x0,0x3),0x14,'*');}exports[_0x0de2('0x1c')]=function(_0x51269c,_0x41eefb){var _0x5ef794={},_0x19c2b9={},_0x4bee92={'count':0x0,'rows':[]};var _0x3f8b04=_[_0x0de2('0x1d')](db[_0x0de2('0x1e')][_0x0de2('0x1f')],function(_0x4f4d60){return{'name':_0x4f4d60[_0x0de2('0x20')],'type':_0x4f4d60[_0x0de2('0x21')][_0x0de2('0x22')]};});_0x19c2b9[_0x0de2('0x23')]=_['map'](_0x3f8b04,'name');_0x19c2b9[_0x0de2('0x24')]=_[_0x0de2('0x25')](_0x51269c[_0x0de2('0x24')]);_0x19c2b9['filters']=_[_0x0de2('0x26')](_0x19c2b9[_0x0de2('0x23')],_0x19c2b9[_0x0de2('0x24')]);_0x5ef794[_0x0de2('0x27')]=_[_0x0de2('0x26')](_0x19c2b9[_0x0de2('0x23')],qs['fields'](_0x51269c['query'][_0x0de2('0x28')]));_0x5ef794[_0x0de2('0x27')]=_0x5ef794[_0x0de2('0x27')]['length']?_0x5ef794[_0x0de2('0x27')]:_0x19c2b9['model'];if(!_0x51269c['query'][_0x0de2('0x29')](_0x0de2('0x2a'))){_0x5ef794[_0x0de2('0xc')]=qs['limit'](_0x51269c[_0x0de2('0x24')][_0x0de2('0xc')]);_0x5ef794[_0x0de2('0xf')]=qs[_0x0de2('0xf')](_0x51269c[_0x0de2('0x24')][_0x0de2('0xf')]);}_0x5ef794[_0x0de2('0x2b')]=qs[_0x0de2('0x2c')](_0x51269c[_0x0de2('0x24')][_0x0de2('0x2c')]);_0x5ef794[_0x0de2('0x2d')]=qs['filters'](_[_0x0de2('0x2e')](_0x51269c[_0x0de2('0x24')],_0x19c2b9['filters']),_0x3f8b04);if(_0x51269c[_0x0de2('0x24')][_0x0de2('0x2f')]){_0x5ef794['where']=_[_0x0de2('0x30')](_0x5ef794[_0x0de2('0x2d')],{'$or':_[_0x0de2('0x1d')](_0x3f8b04,function(_0xa0eba6){if(_0xa0eba6[_0x0de2('0x21')]!==_0x0de2('0x31')){var _0x39f2d5={};_0x39f2d5[_0xa0eba6[_0x0de2('0x19')]]={'$like':'%'+_0x51269c[_0x0de2('0x24')][_0x0de2('0x2f')]+'%'};return _0x39f2d5;}})});}_0x5ef794=_[_0x0de2('0x30')]({},_0x5ef794,_0x51269c[_0x0de2('0x32')]);var _0x45433e={'where':_0x5ef794[_0x0de2('0x2d')]};return db[_0x0de2('0x1e')]['count'](_0x45433e)[_0x0de2('0x14')](function(_0x178d52){_0x4bee92[_0x0de2('0xe')]=_0x178d52;if(_0x51269c[_0x0de2('0x24')][_0x0de2('0x33')]){_0x5ef794[_0x0de2('0x34')]=[{'all':!![]}];}return db[_0x0de2('0x1e')][_0x0de2('0x35')](_0x5ef794);})['then'](function(_0x598623){_0x4bee92[_0x0de2('0x36')]=_['map'](_0x598623,function(_0xb30d09){if(_0xb30d09[_0x0de2('0x37')]===_0x0de2('0x38')){var _0x4ad92c=encryptor['decryptString'](_0xb30d09[_0x0de2('0x39')]);_0xb30d09[_0x0de2('0x39')]=maskClientSecret(_0x4ad92c);}return _0xb30d09;});return _0x4bee92;})[_0x0de2('0x14')](respondWithFilteredResult(_0x41eefb,_0x5ef794))['catch'](handleError(_0x41eefb,null));};exports['show']=function(_0x2f24fa,_0x4d6d6d){var _0x438bda={'raw':!![],'where':{'id':_0x2f24fa[_0x0de2('0x3a')]['id']}},_0x53ca0f={};_0x53ca0f[_0x0de2('0x23')]=_[_0x0de2('0x25')](db[_0x0de2('0x1e')][_0x0de2('0x1f')]);_0x53ca0f[_0x0de2('0x24')]=_['keys'](_0x2f24fa[_0x0de2('0x24')]);_0x53ca0f[_0x0de2('0x3b')]=_[_0x0de2('0x26')](_0x53ca0f[_0x0de2('0x23')],_0x53ca0f[_0x0de2('0x24')]);_0x438bda[_0x0de2('0x27')]=_[_0x0de2('0x26')](_0x53ca0f[_0x0de2('0x23')],qs[_0x0de2('0x28')](_0x2f24fa[_0x0de2('0x24')][_0x0de2('0x28')]));_0x438bda[_0x0de2('0x27')]=_0x438bda[_0x0de2('0x27')][_0x0de2('0x3c')]?_0x438bda[_0x0de2('0x27')]:_0x53ca0f[_0x0de2('0x23')];if(_0x2f24fa[_0x0de2('0x24')][_0x0de2('0x33')]){_0x438bda[_0x0de2('0x34')]=[{'all':!![]}];}_0x438bda=_[_0x0de2('0x30')]({},_0x438bda,_0x2f24fa[_0x0de2('0x32')]);return db[_0x0de2('0x1e')][_0x0de2('0x3d')](_0x438bda)['then'](handleEntityNotFound(_0x4d6d6d,null))[_0x0de2('0x14')](function(_0x113b72){if(_0x113b72[_0x0de2('0x37')]===_0x0de2('0x38')){var _0x2d3c5b=encryptor[_0x0de2('0x3e')](_0x113b72['data3']);_0x113b72[_0x0de2('0x39')]=maskClientSecret(_0x2d3c5b);}return _0x113b72;})[_0x0de2('0x14')](respondWithResult(_0x4d6d6d,null))['catch'](handleError(_0x4d6d6d,null));};exports[_0x0de2('0x3f')]=function(_0x3cb169,_0x3af158){if(!_0x3cb169[_0x0de2('0x40')][_0x0de2('0x19')])throw new Error(_0x0de2('0x41'));if(!_0x3cb169['body'][_0x0de2('0x37')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x36432c=db[_0x0de2('0x1e')][_0x0de2('0x1f')][_0x0de2('0x37')]['values'];if(!_0x36432c[_0x0de2('0x42')](_0x3cb169[_0x0de2('0x40')][_0x0de2('0x37')]))throw new Error(_0x0de2('0x43')+_0x36432c['join'](',\x20'));if(_0x3cb169[_0x0de2('0x40')][_0x0de2('0x37')]===_0x0de2('0x38')&&_0x3cb169[_0x0de2('0x40')]['data3']){_0x3cb169['body']['data3']=encryptor[_0x0de2('0x44')](_0x3cb169[_0x0de2('0x40')][_0x0de2('0x39')]);}return db[_0x0de2('0x1e')][_0x0de2('0x3f')](_0x3cb169['body'],{})[_0x0de2('0x14')](respondWithResult(_0x3af158,0xc9))['catch'](handleError(_0x3af158,null));};exports[_0x0de2('0x13')]=function(_0x2bfed3,_0x46e8e0){if(_0x2bfed3[_0x0de2('0x40')]['id']){delete _0x2bfed3[_0x0de2('0x40')]['id'];}return db[_0x0de2('0x1e')][_0x0de2('0x3d')]({'where':{'id':_0x2bfed3['params']['id']}})['then'](handleEntityNotFound(_0x46e8e0,null))[_0x0de2('0x14')](function(_0x3c10b9){if(_0x3c10b9['service']==='MicrosoftAzure'&&_0x2bfed3['body'][_0x0de2('0x39')]){_0x2bfed3[_0x0de2('0x40')][_0x0de2('0x39')]=encryptor['encryptString'](_0x2bfed3[_0x0de2('0x40')]['data3']);}return _0x3c10b9;})[_0x0de2('0x14')](saveUpdates(_0x2bfed3['body'],null))[_0x0de2('0x14')](respondWithResult(_0x46e8e0,null))['catch'](handleError(_0x46e8e0,null));};exports[_0x0de2('0x15')]=function(_0x435428,_0x2259b1){return db[_0x0de2('0x1e')]['find']({'where':{'id':_0x435428['params']['id']}})['then'](handleEntityNotFound(_0x2259b1,null))[_0x0de2('0x14')](removeEntity(_0x2259b1,null))[_0x0de2('0x45')](handleError(_0x2259b1,null));};exports['oauth2MicrosoftAuthorize']=function(_0x569d5f,_0x2a19e1){return db['CloudProvider'][_0x0de2('0x46')]({'where':{'id':_0x569d5f[_0x0de2('0x3a')]['id']},'raw':!![]})['then'](function(_0x10bb1d){if(!_0x10bb1d)return _0x2a19e1['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x10bb1d,_0x569d5f[_0x0de2('0x47')]['id'])};})[_0x0de2('0x14')](respondWithResult(_0x2a19e1,null))[_0x0de2('0x45')](handleError(_0x2a19e1,null));};exports[_0x0de2('0x48')]=function(_0x4010fe,_0x2a06cf){var _0x280cd2=_0x4010fe[_0x0de2('0x40')];var _0x50f874;var _0x23a729;if(_0x280cd2['error'])throw _0x280cd2;redis['get'](_0x280cd2[_0x0de2('0x49')])[_0x0de2('0x14')](function(_0x1035a2){if(!_0x1035a2)throw new Error(_0x0de2('0x4a'));_0x50f874=JSON[_0x0de2('0x4b')](_0x1035a2);var _0x4f93c7=Buffer['from'](_0x280cd2[_0x0de2('0x49')],_0x0de2('0x4c'))['toString'](_0x0de2('0x4d'));_0x23a729=JSON[_0x0de2('0x4b')](_0x4f93c7);if(!oauth['isValidIdToken'](_0x280cd2[_0x0de2('0x4e')],_0x50f874['oauth2Claims']))throw new Error(_0x0de2('0x4f'));redis[_0x0de2('0x50')](_0x280cd2['state']);return oauth[_0x0de2('0x51')](_0x280cd2[_0x0de2('0x52')],_0x50f874);})[_0x0de2('0x14')](function(_0x387346){_0x50f874[_0x0de2('0x53')]=_0x387346[_0x0de2('0x54')];_0x50f874[_0x0de2('0x55')]=_0x387346['refresh_token'];return db[_0x0de2('0x1e')][_0x0de2('0x13')]({'data5':_0x50f874[_0x0de2('0x53')],'data6':_0x50f874[_0x0de2('0x55')]},{'where':{'id':_0x50f874['id']}});})[_0x0de2('0x14')](function(){oauth[_0x0de2('0x56')](_0x50f874);socket[_0x0de2('0x57')](_0x0de2('0x58'),{'id':_0x23a729['id']});return;})[_0x0de2('0x14')](respondWithStatusCode(_0x2a06cf,null))[_0x0de2('0x45')](function(_0x33b537){if(_0x23a729){socket[_0x0de2('0x57')](_0x0de2('0x59'),{'id':_0x23a729['id']});}if(!_0x50f874){logger[_0x0de2('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x33b537);return _0x2a06cf['status'](0x1f4)[_0x0de2('0x1a')](_0x33b537[_0x0de2('0x5a')]);}logger[_0x0de2('0x17')](_0x0de2('0x5b'),_0x50f874['id'],JSON[_0x0de2('0x5c')](_0x33b537));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 8c9f8e2..84a8a18 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 _0x532d=['exports','cloud_providers','util','api','bluebird','request-promise','path','rimraf','./cloudProvider.attributes'];(function(_0x54fdf2,_0x484e04){var _0x1f556f=function(_0x4a3c01){while(--_0x4a3c01){_0x54fdf2['push'](_0x54fdf2['shift']());}};_0x1f556f(++_0x484e04);}(_0x532d,0x1e8));var _0xd532=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x532d[_0xe39824];return _0x4bc31e;};'use strict';var _=require('lodash');var util=require(_0xd532('0x0'));var logger=require('../../config/logger')(_0xd532('0x1'));var moment=require('moment');var BPromise=require(_0xd532('0x2'));var rp=require(_0xd532('0x3'));var fs=require('fs');var path=require(_0xd532('0x4'));var rimraf=require(_0xd532('0x5'));var config=require('../../config/environment');var attributes=require(_0xd532('0x6'));module[_0xd532('0x7')]=function(_0x54b8f9,_0x2590e0){return _0x54b8f9['define']('CloudProvider',attributes,{'tableName':_0xd532('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb306=['./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb306,0xdd));var _0x6b30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb306[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6b30('0x0'));var util=require(_0x6b30('0x1'));var logger=require('../../config/logger')(_0x6b30('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b30('0x3'));var fs=require('fs');var path=require(_0x6b30('0x4'));var rimraf=require(_0x6b30('0x5'));var config=require(_0x6b30('0x6'));var attributes=require(_0x6b30('0x7'));module[_0x6b30('0x8')]=function(_0x7a8649,_0x2469b4){return _0x7a8649[_0x6b30('0x9')](_0x6b30('0xa'),attributes,{'tableName':_0x6b30('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 9823147..177ebd7 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73e1=['all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','defaults','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','Outlook365','replace','{TENANT_ID}','data2','stringify','toString','base64','randomBytes','hex','client_id','data1','join','redirect_uri','response_mode','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','iss','issuer','aud','audience','isAfter','exp','resolve','then','data3','CloudProvider','findOne','data6','decryptString','POST','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data4','intervals','bind','findAll'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x73e1,0xea));var _0x173e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x73e1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x173e('0x0'));var crypto=require(_0x173e('0x1'));var jwt=require(_0x173e('0x2'));var moment=require(_0x173e('0x3'));var Redis=require(_0x173e('0x4'));var rp=require('request-promise');var util=require(_0x173e('0x5'));var encryptor=require(_0x173e('0x6'));var config=require('../../config/environment');var logger=require(_0x173e('0x7'))('api');var schedule=require(_0x173e('0x8'));var db=require(_0x173e('0x9'))['db'];config['redis']=_[_0x173e('0xa')](config['redis'],{'host':_0x173e('0xb'),'port':0x18eb});var redis=new Redis(config[_0x173e('0xc')]);var MICROSOFT_AUTH_URL=_0x173e('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x173e('0xe'),_0x173e('0xf'),_0x173e('0x10'),_0x173e('0x11'),_0x173e('0x12'),_0x173e('0x13'),_0x173e('0x14')],'Dynamics365':[_0x173e('0xe'),_0x173e('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x173e('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x173e('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x353616){var _0x3fbd48=_[_0x173e('0x17')](AZURE_AUTH_SCOPES[_0x353616[_0x173e('0x18')]]);if(_0x353616[_0x173e('0x18')]===_0x173e('0x19'))_0x3fbd48[_0x173e('0x1a')](_0x353616[_0x173e('0x1b')]+_0x173e('0x1c'));return _0x3fbd48['join']('\x20');}function getAccessTokenScope(_0x4471e8){if(_0x4471e8['type']===_0x173e('0x1d'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x4471e8[_0x173e('0x18')]===_0x173e('0x19'))return _0x4471e8['data7']+_0x173e('0x1c');}function generateMicrosoftAuthorizationUrl(_0x38ffcb,_0x51e5db){var _0x33786f=MICROSOFT_AUTH_URL[_0x173e('0x1e')](_0x173e('0x1f'),_0x38ffcb[_0x173e('0x20')]);var _0x52c824=['code','id_token'];var _0x1fb451=Buffer['from'](JSON[_0x173e('0x21')]({'id':_0x51e5db}))[_0x173e('0x22')](_0x173e('0x23'));var _0x1a107a=crypto[_0x173e('0x24')](0x10)[_0x173e('0x22')](_0x173e('0x25'));var _0x90e775=getAuthorizationScopes(_0x38ffcb);var _0x258cb6=[{'key':_0x173e('0x26'),'value':_0x38ffcb[_0x173e('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x52c824[_0x173e('0x28')]('\x20'))},{'key':_0x173e('0x29'),'value':_0x38ffcb['data4']},{'key':_0x173e('0x2a'),'value':'form_post'},{'key':_0x173e('0x2b'),'value':encodeURIComponent(_0x90e775)},{'key':_0x173e('0x2c'),'value':_0x1fb451},{'key':_0x173e('0x2d'),'value':_0x1a107a},{'key':_0x173e('0x2e'),'value':_0x173e('0x2f')}];var _0x333936=_0x33786f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x173e('0x17')](_0x258cb6,function(_0x3da73d){return _0x3da73d[_0x173e('0x30')]+'='+_0x3da73d['value'];})[_0x173e('0x28')]('&');_0x38ffcb[_0x173e('0x31')]={'issuer':_0x33786f[_0x173e('0x1e')](_0x173e('0x32'),''),'audience':_0x38ffcb[_0x173e('0x27')],'state':_0x1fb451,'nonce':_0x1a107a};redis['set'](_0x1fb451,JSON['stringify'](_0x38ffcb));return _0x333936;}function isValidIdToken(_0xeeb116,_0x25ee32){try{var _0x105f8e=jwt['decode'](_0xeeb116,{'complete':!![]});var _0x40d8f9=_0x105f8e['payload'];if(_0x40d8f9[_0x173e('0x33')]!==_0x25ee32[_0x173e('0x34')])return![];if(_0x40d8f9[_0x173e('0x35')]!==_0x25ee32[_0x173e('0x36')])return![];if(_0x40d8f9[_0x173e('0x2d')]!==_0x25ee32[_0x173e('0x2d')])return![];if(moment()[_0x173e('0x37')](moment['unix'](_0x40d8f9[_0x173e('0x38')])))return![];return!![];}catch(_0x146236){throw _0x146236;}}function refreshOauth2MicrosoftAccessToken(_0x39981f){return Promise[_0x173e('0x39')]()[_0x173e('0x3a')](function(){if(_0x39981f[_0x173e('0x3b')])return _0x39981f;return db[_0x173e('0x3c')][_0x173e('0x3d')]({'where':{'id':_0x39981f['id']},'raw':!![]});})[_0x173e('0x3a')](function(_0x125d47){var _0x40e5f3={'grant_type':'refresh_token','refresh_token':_0x125d47[_0x173e('0x3e')],'scope':getAccessTokenScope(_0x125d47),'redirect_uri':_0x125d47['data4'],'client_id':_0x125d47[_0x173e('0x27')],'client_secret':encryptor[_0x173e('0x3f')](_0x125d47[_0x173e('0x3b')])};var _0x4da88a={'method':_0x173e('0x40'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x125d47[_0x173e('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x40e5f3,'json':!![]};return rp(_0x4da88a);})[_0x173e('0x3a')](function(_0x8ce8f0){_0x39981f[_0x173e('0x41')]=_0x8ce8f0[_0x173e('0x42')];_0x39981f['data6']=_0x8ce8f0['refresh_token'];return db[_0x173e('0x3c')][_0x173e('0x43')]({'data5':_0x39981f[_0x173e('0x41')],'data6':_0x39981f[_0x173e('0x3e')]},{'where':{'id':_0x39981f['id']}});})['then'](function(){return _0x39981f;})[_0x173e('0x44')](function(_0x1157f3){logger['error'](_0x173e('0x45'),_0x39981f['id'],_0x1157f3);});}function getOauth2MicrosoftAccessToken(_0xa83a0a,_0x538a5d){var _0x1e72c1={'grant_type':'authorization_code','code':_0xa83a0a,'scope':getAccessTokenScope(_0x538a5d),'redirect_uri':_0x538a5d[_0x173e('0x46')],'client_id':_0x538a5d[_0x173e('0x27')],'client_secret':encryptor[_0x173e('0x3f')](_0x538a5d[_0x173e('0x3b')])};var _0x2601e0={'method':_0x173e('0x40'),'uri':MICROSOFT_AUTH_URL[_0x173e('0x1e')]('{TENANT_ID}',_0x538a5d[_0x173e('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1e72c1,'json':!![]};return rp(_0x2601e0);}function startRefreshInterval(_0x411bd0){var _0x948eab=schedule[_0x173e('0x47')];if(_0x948eab[_0x411bd0['id']])clearInterval(_0x948eab[_0x411bd0['id']]);_0x948eab[_0x411bd0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x173e('0x48')](this,{'id':_0x411bd0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x173e('0x47')]=_0x948eab;}function startAllRefreshIntervals(){return db[_0x173e('0x3c')][_0x173e('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x28aa19){var _0x4faf27=_0x28aa19[_0x173e('0x17')](function(_0x4f2747){return refreshOauth2MicrosoftAccessToken(_0x4f2747)[_0x173e('0x3a')](function(_0x51d552){startRefreshInterval(_0x51d552);});});return Promise[_0x173e('0x4a')](_0x4faf27);})['catch'](function(_0x347236){var _0x48d863=_0x347236?util['inspect'](_0x347236,{'showHidden':![],'depth':null}):'';logger['error'](_0x173e('0x4b'),_0x48d863);});}module[_0x173e('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb31f=['then','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','catch','error','authorization_code','bind','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','/.default','join','Outlook365','Dynamics365','data7','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','base64','randomBytes','hex','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','oauth2Claims','oauth2/','decode','payload','iss','aud','audience','isAfter','unix','resolve'];(function(_0xd637a3,_0x19b904){var _0x180a84=function(_0x2fc05a){while(--_0x2fc05a){_0xd637a3['push'](_0xd637a3['shift']());}};_0x180a84(++_0x19b904);}(_0xb31f,0x105));var _0xfb31=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xb31f[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var crypto=require(_0xfb31('0x0'));var jwt=require(_0xfb31('0x1'));var moment=require(_0xfb31('0x2'));var Redis=require(_0xfb31('0x3'));var rp=require(_0xfb31('0x4'));var util=require('util');var encryptor=require(_0xfb31('0x5'));var config=require('../../config/environment');var logger=require(_0xfb31('0x6'))(_0xfb31('0x7'));var schedule=require(_0xfb31('0x8'));var db=require(_0xfb31('0x9'))['db'];config[_0xfb31('0xa')]=_[_0xfb31('0xb')](config[_0xfb31('0xa')],{'host':_0xfb31('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xfb31('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xfb31('0xe'),_0xfb31('0xf'),_0xfb31('0x10'),_0xfb31('0x11'),_0xfb31('0x12'),_0xfb31('0x13'),_0xfb31('0x14')],'Dynamics365':[_0xfb31('0xe'),_0xfb31('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xfb31('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0xfb31('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x13392e){var _0x569fec=_[_0xfb31('0x17')](AZURE_AUTH_SCOPES[_0x13392e[_0xfb31('0x18')]]);if(_0x13392e[_0xfb31('0x18')]==='Dynamics365')_0x569fec[_0xfb31('0x19')](_0x13392e['data7']+_0xfb31('0x1a'));return _0x569fec[_0xfb31('0x1b')]('\x20');}function getAccessTokenScope(_0x36c730){if(_0x36c730[_0xfb31('0x18')]===_0xfb31('0x1c'))return _0xfb31('0x12');if(_0x36c730[_0xfb31('0x18')]===_0xfb31('0x1d'))return _0x36c730[_0xfb31('0x1e')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x36b72b,_0x5673ac){var _0x10634f=MICROSOFT_AUTH_URL[_0xfb31('0x1f')](_0xfb31('0x20'),_0x36b72b[_0xfb31('0x21')]);var _0x28c9cd=[_0xfb31('0x22'),_0xfb31('0x23')];var _0x5128d8=Buffer['from'](JSON[_0xfb31('0x24')]({'id':_0x5673ac}))[_0xfb31('0x25')](_0xfb31('0x26'));var _0x3a70f9=crypto[_0xfb31('0x27')](0x10)[_0xfb31('0x25')](_0xfb31('0x28'));var _0x27361b=getAuthorizationScopes(_0x36b72b);var _0x39e7c4=[{'key':'client_id','value':_0x36b72b[_0xfb31('0x29')]},{'key':_0xfb31('0x2a'),'value':encodeURIComponent(_0x28c9cd['join']('\x20'))},{'key':_0xfb31('0x2b'),'value':_0x36b72b[_0xfb31('0x2c')]},{'key':_0xfb31('0x2d'),'value':_0xfb31('0x2e')},{'key':_0xfb31('0x2f'),'value':encodeURIComponent(_0x27361b)},{'key':_0xfb31('0x30'),'value':_0x5128d8},{'key':_0xfb31('0x31'),'value':_0x3a70f9},{'key':_0xfb31('0x32'),'value':_0xfb31('0x33')}];var _0x163d17=_0x10634f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xfb31('0x17')](_0x39e7c4,function(_0x4c086e){return _0x4c086e[_0xfb31('0x34')]+'='+_0x4c086e['value'];})[_0xfb31('0x1b')]('&');_0x36b72b[_0xfb31('0x35')]={'issuer':_0x10634f[_0xfb31('0x1f')](_0xfb31('0x36'),''),'audience':_0x36b72b['data1'],'state':_0x5128d8,'nonce':_0x3a70f9};redis['set'](_0x5128d8,JSON[_0xfb31('0x24')](_0x36b72b));return _0x163d17;}function isValidIdToken(_0x459902,_0x263003){try{var _0x575bd3=jwt[_0xfb31('0x37')](_0x459902,{'complete':!![]});var _0x38767e=_0x575bd3[_0xfb31('0x38')];if(_0x38767e[_0xfb31('0x39')]!==_0x263003['issuer'])return![];if(_0x38767e[_0xfb31('0x3a')]!==_0x263003[_0xfb31('0x3b')])return![];if(_0x38767e[_0xfb31('0x31')]!==_0x263003['nonce'])return![];if(moment()[_0xfb31('0x3c')](moment[_0xfb31('0x3d')](_0x38767e['exp'])))return![];return!![];}catch(_0x3f290c){throw _0x3f290c;}}function refreshOauth2MicrosoftAccessToken(_0x4b6a15){return Promise[_0xfb31('0x3e')]()[_0xfb31('0x3f')](function(){if(_0x4b6a15['data3'])return _0x4b6a15;return db[_0xfb31('0x40')][_0xfb31('0x41')]({'where':{'id':_0x4b6a15['id']},'raw':!![]});})[_0xfb31('0x3f')](function(_0x18d06d){var _0x2641bb={'grant_type':_0xfb31('0x42'),'refresh_token':_0x18d06d[_0xfb31('0x43')],'scope':getAccessTokenScope(_0x18d06d),'redirect_uri':_0x18d06d[_0xfb31('0x2c')],'client_id':_0x18d06d[_0xfb31('0x29')],'client_secret':encryptor[_0xfb31('0x44')](_0x18d06d['data3'])};var _0x19ba88={'method':_0xfb31('0x45'),'uri':MICROSOFT_AUTH_URL[_0xfb31('0x1f')](_0xfb31('0x20'),_0x18d06d[_0xfb31('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2641bb,'json':!![]};return rp(_0x19ba88);})['then'](function(_0x350ea3){_0x4b6a15[_0xfb31('0x46')]=_0x350ea3[_0xfb31('0x47')];_0x4b6a15['data6']=_0x350ea3['refresh_token'];return db[_0xfb31('0x40')]['update']({'data5':_0x4b6a15[_0xfb31('0x46')],'data6':_0x4b6a15[_0xfb31('0x43')]},{'where':{'id':_0x4b6a15['id']}});})[_0xfb31('0x3f')](function(){return _0x4b6a15;})[_0xfb31('0x48')](function(_0xfb4e94){logger[_0xfb31('0x49')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x4b6a15['id'],_0xfb4e94);});}function getOauth2MicrosoftAccessToken(_0x4270c9,_0x5d4828){var _0x2eccdd={'grant_type':_0xfb31('0x4a'),'code':_0x4270c9,'scope':getAccessTokenScope(_0x5d4828),'redirect_uri':_0x5d4828[_0xfb31('0x2c')],'client_id':_0x5d4828[_0xfb31('0x29')],'client_secret':encryptor['decryptString'](_0x5d4828['data3'])};var _0x761657={'method':_0xfb31('0x45'),'uri':MICROSOFT_AUTH_URL[_0xfb31('0x1f')]('{TENANT_ID}',_0x5d4828[_0xfb31('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2eccdd,'json':!![]};return rp(_0x761657);}function startRefreshInterval(_0x4c38b2){var _0x4faac6=schedule['intervals'];if(_0x4faac6[_0x4c38b2['id']])clearInterval(_0x4faac6[_0x4c38b2['id']]);_0x4faac6[_0x4c38b2['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xfb31('0x4b')](this,{'id':_0x4c38b2['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xfb31('0x4c')]=_0x4faac6;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xfb31('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x46b4f9){var _0x37fba4=_0x46b4f9['map'](function(_0x47d533){return refreshOauth2MicrosoftAccessToken(_0x47d533)[_0xfb31('0x3f')](function(_0x42f9d5){startRefreshInterval(_0x42f9d5);});});return Promise[_0xfb31('0x4e')](_0x37fba4);})[_0xfb31('0x48')](function(_0x2ab622){var _0x58b175=_0x2ab622?util[_0xfb31('0x4f')](_0x2ab622,{'showHidden':![],'depth':null}):'';logger['error'](_0xfb31('0x50'),_0x58b175);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index a901dd6..59f7d84 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 _0xb8a0=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x50f732,_0xce3de1){_0x50f732=_0x50f732-0x0;var _0x540e21=_0xb8a0[_0x50f732];return _0x540e21;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b8a('0x0'));var BPromise=require(_0x0b8a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b8a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0b8a('0x3'));var jayson=require(_0x0b8a('0x4'));var client=jayson[_0x0b8a('0x5')][_0x0b8a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3527dd,_0x4039c2,_0x33a5bd){return new BPromise(function(_0x463015,_0x29ebdc){return client[_0x0b8a('0x7')](_0x3527dd,_0x33a5bd)[_0x0b8a('0x8')](function(_0x478492){logger[_0x0b8a('0x9')](_0x0b8a('0xa'),_0x4039c2,_0x0b8a('0xb'));logger[_0x0b8a('0xc')](_0x0b8a('0xd'),_0x4039c2,_0x0b8a('0xb'),JSON[_0x0b8a('0xe')](_0x478492));if(_0x478492[_0x0b8a('0xf')]){if(_0x478492[_0x0b8a('0xf')][_0x0b8a('0x10')]===0x1f4){logger['error'](_0x0b8a('0xa'),_0x4039c2,_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);return _0x29ebdc(_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);}logger[_0x0b8a('0xf')](_0x0b8a('0xa'),_0x4039c2,_0x478492[_0x0b8a('0xf')][_0x0b8a('0x11')]);return _0x463015(_0x478492['error'][_0x0b8a('0x11')]);}else{logger[_0x0b8a('0x9')](_0x0b8a('0xa'),_0x4039c2,'request\x20sent');_0x463015(_0x478492[_0x0b8a('0x12')][_0x0b8a('0x11')]);}})[_0x0b8a('0x13')](function(_0x5a2623){logger['error']('CloudProvider,\x20%s,\x20%s',_0x4039c2,_0x5a2623);_0x29ebdc(_0x5a2623);});});} \ No newline at end of file +var _0x2fc9=['stringify','error','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3634cf,_0x351d9d){var _0x4d454e=function(_0x51bda7){while(--_0x51bda7){_0x3634cf['push'](_0x3634cf['shift']());}};_0x4d454e(++_0x351d9d);}(_0x2fc9,0xc2));var _0x92fc=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x2fc9[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x92fc('0x0'));var moment=require(_0x92fc('0x1'));var BPromise=require(_0x92fc('0x2'));var rs=require(_0x92fc('0x3'));var fs=require('fs');var Redis=require(_0x92fc('0x4'));var db=require(_0x92fc('0x5'))['db'];var utils=require(_0x92fc('0x6'));var logger=require(_0x92fc('0x7'))(_0x92fc('0x8'));var config=require(_0x92fc('0x9'));var jayson=require(_0x92fc('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c79a5,_0x340518,_0x13787c){return new BPromise(function(_0xa640a5,_0x3b656e){return client[_0x92fc('0xb')](_0x5c79a5,_0x13787c)[_0x92fc('0xc')](function(_0x2805f4){logger['info'](_0x92fc('0xd'),_0x340518,_0x92fc('0xe'));logger[_0x92fc('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x340518,_0x92fc('0xe'),JSON[_0x92fc('0x10')](_0x2805f4));if(_0x2805f4[_0x92fc('0x11')]){if(_0x2805f4['error']['code']===0x1f4){logger[_0x92fc('0x11')](_0x92fc('0xd'),_0x340518,_0x2805f4['error'][_0x92fc('0x12')]);return _0x3b656e(_0x2805f4[_0x92fc('0x11')][_0x92fc('0x12')]);}logger[_0x92fc('0x11')](_0x92fc('0xd'),_0x340518,_0x2805f4['error'][_0x92fc('0x12')]);return _0xa640a5(_0x2805f4[_0x92fc('0x11')][_0x92fc('0x12')]);}else{logger[_0x92fc('0x13')]('CloudProvider,\x20%s,\x20%s',_0x340518,'request\x20sent');_0xa640a5(_0x2805f4[_0x92fc('0x14')][_0x92fc('0x12')]);}})['catch'](function(_0x3370c9){logger[_0x92fc('0x11')](_0x92fc('0xd'),_0x340518,_0x3370c9);_0x3b656e(_0x3370c9);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 59cf79f..bad0cd0 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x5b78ed,_0x38b602){var _0x41dcc9=function(_0x39d299){while(--_0x39d299){_0x5b78ed['push'](_0x5b78ed['shift']());}};_0x41dcc9(++_0x38b602);}(_0xdb28,0x106));var _0x8db2=function(_0x21052f,_0x3f15f4){_0x21052f=_0x21052f-0x0;var _0x533652=_0xdb28[_0x21052f];return _0x533652;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0x1261,0x144));var _0x1126=function(_0x4ede04,_0x58132b){_0x4ede04=_0x4ede04-0x0;var _0x49ccfc=_0x1261[_0x4ede04];return _0x49ccfc;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index e8f10e8..118dafc 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 _0x331f=['sequelize','STRING'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x331f,0x18a));var _0xf331=function(_0x4894ad,_0x389187){_0x4894ad=_0x4894ad-0x0;var _0x5d72a6=_0x331f[_0x4894ad];return _0x5d72a6;};'use strict';var Sequelize=require(_0xf331('0x0'));module['exports']={'name':{'type':Sequelize[_0xf331('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf331('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xf331('0x1')]},'type':{'type':Sequelize[_0xf331('0x1')]},'street':{'type':Sequelize[_0xf331('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf331('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf331('0x1')]},'sStreet':{'type':Sequelize[_0xf331('0x1')]},'sPostalCode':{'type':Sequelize[_0xf331('0x1')]},'sCity':{'type':Sequelize[_0xf331('0x1')]},'sCountry':{'type':Sequelize[_0xf331('0x1')]},'description':{'type':Sequelize[_0xf331('0x1')]}}; \ No newline at end of file +var _0x6f1d=['STRING','name','exports'];(function(_0x3e5c78,_0x5a56f8){var _0x46a3dc=function(_0x2eaab9){while(--_0x2eaab9){_0x3e5c78['push'](_0x3e5c78['shift']());}};_0x46a3dc(++_0x5a56f8);}(_0x6f1d,0x1b2));var _0xd6f1=function(_0x3af9e8,_0x13f64f){_0x3af9e8=_0x3af9e8-0x0;var _0x10e3ef=_0x6f1d[_0x3af9e8];return _0x10e3ef;};'use strict';var Sequelize=require('sequelize');module[_0xd6f1('0x0')]={'name':{'type':Sequelize[_0xd6f1('0x1')],'unique':_0xd6f1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd6f1('0x1')]},'companyId':{'type':Sequelize[_0xd6f1('0x1')]},'website':{'type':Sequelize[_0xd6f1('0x1')]},'phone':{'type':Sequelize[_0xd6f1('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd6f1('0x1')]},'street':{'type':Sequelize[_0xd6f1('0x1')]},'postalCode':{'type':Sequelize[_0xd6f1('0x1')]},'city':{'type':Sequelize[_0xd6f1('0x1')]},'country':{'type':Sequelize[_0xd6f1('0x1')]},'email':{'type':Sequelize[_0xd6f1('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd6f1('0x1')]},'sStreet':{'type':Sequelize[_0xd6f1('0x1')]},'sPostalCode':{'type':Sequelize[_0xd6f1('0x1')]},'sCity':{'type':Sequelize[_0xd6f1('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd6f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 07e766e..b20dcf1 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 _0xf50b=['status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','name','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','filter','where','merge','map','includeAll','include','findAll','rows','catch','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','ids','omit','getContacts','findOne','order','sort','pick','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x36d670,_0x32f05b){var _0x4f3fae=function(_0x148c9a){while(--_0x148c9a){_0x36d670['push'](_0x36d670['shift']());}};_0x4f3fae(++_0x32f05b);}(_0xf50b,0x1a2));var _0xbf50=function(_0x58aaea,_0x2cc48e){_0x58aaea=_0x58aaea-0x0;var _0x3f9c0b=_0xf50b[_0x58aaea];return _0x3f9c0b;};'use strict';var emlformat=require(_0xbf50('0x0'));var rimraf=require(_0xbf50('0x1'));var zipdir=require(_0xbf50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf50('0x3'));var moment=require(_0xbf50('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbf50('0x5'));var util=require(_0xbf50('0x6'));var path=require(_0xbf50('0x7'));var sox=require(_0xbf50('0x8'));var csv=require(_0xbf50('0x9'));var ejs=require(_0xbf50('0xa'));var fs=require('fs');var fs_extra=require(_0xbf50('0xb'));var _=require('lodash');var squel=require(_0xbf50('0xc'));var crypto=require(_0xbf50('0xd'));var jsforce=require(_0xbf50('0xe'));var deskjs=require(_0xbf50('0xf'));var toCsv=require(_0xbf50('0x9'));var querystring=require(_0xbf50('0x10'));var Papa=require('papaparse');var Redis=require(_0xbf50('0x11'));var authService=require(_0xbf50('0x12'));var qs=require(_0xbf50('0x13'));var as=require(_0xbf50('0x14'));var hardwareService=require(_0xbf50('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbf50('0x16'));var config=require(_0xbf50('0x17'));var licenseUtil=require(_0xbf50('0x18'));var db=require(_0xbf50('0x19'))['db'];function respondWithStatusCode(_0x5698af,_0x4cf208){_0x4cf208=_0x4cf208||0xcc;return function(_0x2e5703){if(_0x2e5703){return _0x5698af[_0xbf50('0x1a')](_0x4cf208);}return _0x5698af[_0xbf50('0x1b')](_0x4cf208)[_0xbf50('0x1c')]();};}function respondWithResult(_0x575c79,_0x3669d1){_0x3669d1=_0x3669d1||0xc8;return function(_0x3ba45b){if(_0x3ba45b){return _0x575c79[_0xbf50('0x1b')](_0x3669d1)[_0xbf50('0x1d')](_0x3ba45b);}};}function respondWithFilteredResult(_0x3d47bf,_0x4d31db){return function(_0x166768){if(_0x166768){var _0x765948=typeof _0x4d31db[_0xbf50('0x1e')]===_0xbf50('0x1f')&&typeof _0x4d31db[_0xbf50('0x20')]==='undefined';var _0x29772c=_0x166768[_0xbf50('0x21')];var _0x5d2dd7=_0x765948?0x0:_0x4d31db[_0xbf50('0x1e')];var _0x43aec1=_0x765948?_0x166768['count']:_0x4d31db[_0xbf50('0x1e')]+_0x4d31db[_0xbf50('0x20')];var _0x21cf43;if(_0x43aec1>=_0x29772c){_0x43aec1=_0x29772c;_0x21cf43=0xc8;}else{_0x21cf43=0xce;}_0x3d47bf['status'](_0x21cf43);return _0x3d47bf['set'](_0xbf50('0x22'),_0x5d2dd7+'-'+_0x43aec1+'/'+_0x29772c)[_0xbf50('0x1d')](_0x166768);}return null;};}function patchUpdates(_0x4ed860){return function(_0x4e7875){try{jsonpatch[_0xbf50('0x23')](_0x4e7875,_0x4ed860,!![]);}catch(_0x2a9a5b){return BPromise[_0xbf50('0x24')](_0x2a9a5b);}return _0x4e7875[_0xbf50('0x25')]();};}function saveUpdates(_0x2e2b12,_0x540fe1){return function(_0x1e812e){if(_0x1e812e){return _0x1e812e[_0xbf50('0x26')](_0x2e2b12)[_0xbf50('0x27')](function(_0x46ec33){return _0x46ec33;});}return null;};}function removeEntity(_0xffd7a7,_0x5e7f3f){return function(_0x2cf688){if(_0x2cf688){return _0x2cf688[_0xbf50('0x28')]()['then'](function(){var _0xa91ac=_0x2cf688[_0xbf50('0x29')]({'plain':!![]});var _0x4cba28=_0xbf50('0x2a');return db[_0xbf50('0x2b')][_0xbf50('0x28')]({'where':{'type':_0x4cba28,'resourceId':_0xa91ac['id']}})['then'](function(){return _0x2cf688;});})['then'](function(){_0xffd7a7[_0xbf50('0x1b')](0xcc)[_0xbf50('0x1c')]();});}};}function handleEntityNotFound(_0x1a8496,_0xda553f){return function(_0xc14d1e){if(!_0xc14d1e){_0x1a8496[_0xbf50('0x1a')](0x194);}return _0xc14d1e;};}function handleError(_0x32dc1c,_0x55670d){_0x55670d=_0x55670d||0x1f4;return function(_0x4a760f){logger['error'](_0x4a760f['stack']);if(_0x4a760f['name']){delete _0x4a760f[_0xbf50('0x2c')];}_0x32dc1c[_0xbf50('0x1b')](_0x55670d)['send'](_0x4a760f);};}exports[_0xbf50('0x2d')]=function(_0x39f553,_0x5200ea){var _0x3b616a={},_0x3e44a5={},_0xc06bdf={'count':0x0,'rows':[]};return db[_0xbf50('0x2e')]['describe']()[_0xbf50('0x27')](function(_0x570450){_0x3e44a5[_0xbf50('0x2f')]=_[_0xbf50('0x30')](_0x570450);_0x3e44a5[_0xbf50('0x31')]=_[_0xbf50('0x30')](_0x39f553[_0xbf50('0x31')]);_0x3e44a5[_0xbf50('0x32')]=_[_0xbf50('0x33')](_0x3e44a5[_0xbf50('0x2f')],_0x3e44a5[_0xbf50('0x31')]);_0x3b616a[_0xbf50('0x34')]=_[_0xbf50('0x33')](_0x3e44a5['model'],qs[_0xbf50('0x35')](_0x39f553[_0xbf50('0x31')][_0xbf50('0x35')]));_0x3b616a[_0xbf50('0x34')]=_0x3b616a[_0xbf50('0x34')][_0xbf50('0x36')]?_0x3b616a['attributes']:_0x3e44a5[_0xbf50('0x2f')];if(!_0x39f553[_0xbf50('0x31')]['hasOwnProperty']('nolimit')){_0x3b616a[_0xbf50('0x20')]=qs[_0xbf50('0x20')](_0x39f553[_0xbf50('0x31')][_0xbf50('0x20')]);_0x3b616a[_0xbf50('0x1e')]=qs['offset'](_0x39f553['query']['offset']);}_0x3b616a['order']=qs['sort'](_0x39f553['query']['sort']);_0x3b616a['where']=qs[_0xbf50('0x32')](_['pick'](_0x39f553['query'],_0x3e44a5['filters']),_0x570450);if(_0x39f553[_0xbf50('0x31')][_0xbf50('0x37')]){_0x3b616a[_0xbf50('0x38')]=_[_0xbf50('0x39')](_0x3b616a[_0xbf50('0x38')],{'$or':_[_0xbf50('0x3a')](_0x3b616a['attributes'],function(_0x4ad72c){var _0x235afa={};_0x235afa[_0x4ad72c]={'$like':'%'+_0x39f553[_0xbf50('0x31')]['filter']+'%'};return _0x235afa;})});}_0x3b616a=_['merge']({},_0x3b616a,_0x39f553['options']);var _0x315331={'where':_0x3b616a[_0xbf50('0x38')]};return db[_0xbf50('0x2e')]['count'](_0x315331)['then'](function(_0x285fec){_0xc06bdf['count']=_0x285fec;if(_0x39f553['query'][_0xbf50('0x3b')]){_0x3b616a[_0xbf50('0x3c')]=[{'all':!![]}];}return db['CmCompany'][_0xbf50('0x3d')](_0x3b616a);})[_0xbf50('0x27')](function(_0x4c15e7){_0xc06bdf[_0xbf50('0x3e')]=_0x4c15e7;return _0xc06bdf;})[_0xbf50('0x27')](respondWithFilteredResult(_0x5200ea,_0x3b616a))[_0xbf50('0x3f')](handleError(_0x5200ea,null));})[_0xbf50('0x3f')](handleError(_0x5200ea,null));};exports['show']=function(_0x221103,_0x519a5e){var _0x568c8d={'raw':![],'where':{'id':_0x221103['params']['id']}},_0x5b67dc={};_0x5b67dc[_0xbf50('0x2f')]=_[_0xbf50('0x30')](db['CmCompany'][_0xbf50('0x40')]);_0x5b67dc[_0xbf50('0x31')]=_[_0xbf50('0x30')](_0x221103[_0xbf50('0x31')]);_0x5b67dc[_0xbf50('0x32')]=_[_0xbf50('0x33')](_0x5b67dc[_0xbf50('0x2f')],_0x5b67dc['query']);_0x568c8d[_0xbf50('0x34')]=_[_0xbf50('0x33')](_0x5b67dc['model'],qs[_0xbf50('0x35')](_0x221103['query'][_0xbf50('0x35')]));_0x568c8d[_0xbf50('0x34')]=_0x568c8d[_0xbf50('0x34')][_0xbf50('0x36')]?_0x568c8d[_0xbf50('0x34')]:_0x5b67dc['model'];if(_0x221103['query'][_0xbf50('0x3b')]){_0x568c8d[_0xbf50('0x3c')]=[{'all':!![]}];}_0x568c8d=_['merge']({},_0x568c8d,_0x221103[_0xbf50('0x41')]);return db[_0xbf50('0x2e')]['find'](_0x568c8d)[_0xbf50('0x27')](handleEntityNotFound(_0x519a5e,null))[_0xbf50('0x27')](respondWithResult(_0x519a5e,null))[_0xbf50('0x3f')](handleError(_0x519a5e,null));};exports[_0xbf50('0x42')]=function(_0x110c44,_0x301ddd){return db[_0xbf50('0x2e')][_0xbf50('0x42')](_0x110c44[_0xbf50('0x43')],{})[_0xbf50('0x27')](function(_0xd63c47){var _0x5cdcf3=_0x110c44[_0xbf50('0x44')]['get']({'plain':!![]});if(!_0x5cdcf3)throw new Error(_0xbf50('0x45'));if(_0x5cdcf3[_0xbf50('0x46')]===_0xbf50('0x44')){var _0x124f10=_0xd63c47[_0xbf50('0x29')]({'plain':!![]});var _0x5be306='Companies';return db[_0xbf50('0x47')][_0xbf50('0x48')]({'where':{'name':_0x5be306,'userProfileId':_0x5cdcf3['userProfileId']},'raw':!![]})[_0xbf50('0x27')](function(_0x5b2240){if(_0x5b2240&&_0x5b2240[_0xbf50('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x124f10[_0xbf50('0x2c')],'resourceId':_0x124f10['id'],'type':_0x5b2240['name'],'sectionId':_0x5b2240['id']},{})[_0xbf50('0x27')](function(){return _0xd63c47;});}else{return _0xd63c47;}})[_0xbf50('0x3f')](function(_0x2375b6){logger[_0xbf50('0x4a')](_0xbf50('0x4b'),_0x2375b6);throw _0x2375b6;});}return _0xd63c47;})['then'](respondWithResult(_0x301ddd,0xc9))[_0xbf50('0x3f')](handleError(_0x301ddd,null));};exports[_0xbf50('0x26')]=function(_0x298ac4,_0x5ab14c){if(_0x298ac4[_0xbf50('0x43')]['id']){delete _0x298ac4[_0xbf50('0x43')]['id'];}return db[_0xbf50('0x2e')][_0xbf50('0x48')]({'where':{'id':_0x298ac4[_0xbf50('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ab14c,null))[_0xbf50('0x27')](saveUpdates(_0x298ac4[_0xbf50('0x43')],null))[_0xbf50('0x27')](respondWithResult(_0x5ab14c,null))[_0xbf50('0x3f')](handleError(_0x5ab14c,null));};exports[_0xbf50('0x28')]=function(_0x91caf1,_0x65f28c){return db[_0xbf50('0x2e')][_0xbf50('0x48')]({'where':{'id':_0x91caf1[_0xbf50('0x4c')]['id']}})[_0xbf50('0x27')](handleEntityNotFound(_0x65f28c,null))[_0xbf50('0x27')](removeEntity(_0x65f28c,null))[_0xbf50('0x3f')](handleError(_0x65f28c,null));};exports[_0xbf50('0x4d')]=function(_0x139232,_0x594b2b){return db[_0xbf50('0x2e')]['describe']()[_0xbf50('0x27')](respondWithResult(_0x594b2b,null))[_0xbf50('0x3f')](handleError(_0x594b2b,null));};exports[_0xbf50('0x4e')]=function(_0x3f5fc3,_0x40e5c1,_0x20d2ac){return db[_0xbf50('0x4f')]['find']({'where':{'id':_0x3f5fc3[_0xbf50('0x4c')]['id']}})[_0xbf50('0x27')](handleEntityNotFound(_0x40e5c1,null))['then'](function(_0x12192e){if(_0x12192e){return _0x12192e['addContacts'](_0x3f5fc3[_0xbf50('0x43')][_0xbf50('0x50')],_[_0xbf50('0x51')](_0x3f5fc3[_0xbf50('0x43')],['ids','id'])||{});}})[_0xbf50('0x27')](respondWithResult(_0x40e5c1,null))[_0xbf50('0x3f')](handleError(_0x40e5c1,null));};exports[_0xbf50('0x52')]=function(_0x36225e,_0x437508,_0x3576a4){var _0x1fb414={};var _0x2a3bd9={};var _0x47dc00;var _0x2d5e3a;return db[_0xbf50('0x2e')][_0xbf50('0x53')]({'where':{'id':_0x36225e[_0xbf50('0x4c')]['id']}})['then'](handleEntityNotFound(_0x437508,null))[_0xbf50('0x27')](function(_0x4f4310){if(_0x4f4310){_0x47dc00=_0x4f4310;_0x2a3bd9[_0xbf50('0x2f')]=_[_0xbf50('0x30')](db[_0xbf50('0x4f')]['rawAttributes']);_0x2a3bd9[_0xbf50('0x31')]=_[_0xbf50('0x30')](_0x36225e[_0xbf50('0x31')]);_0x2a3bd9[_0xbf50('0x32')]=_[_0xbf50('0x33')](_0x2a3bd9[_0xbf50('0x2f')],_0x2a3bd9['query']);_0x1fb414['attributes']=_['intersection'](_0x2a3bd9[_0xbf50('0x2f')],qs[_0xbf50('0x35')](_0x36225e[_0xbf50('0x31')][_0xbf50('0x35')]));_0x1fb414[_0xbf50('0x34')]=_0x1fb414[_0xbf50('0x34')]['length']?_0x1fb414[_0xbf50('0x34')]:_0x2a3bd9[_0xbf50('0x2f')];_0x1fb414[_0xbf50('0x54')]=qs[_0xbf50('0x55')](_0x36225e[_0xbf50('0x31')][_0xbf50('0x55')]);_0x1fb414[_0xbf50('0x38')]=qs['filters'](_[_0xbf50('0x56')](_0x36225e[_0xbf50('0x31')],_0x2a3bd9['filters']));if(_0x36225e['query'][_0xbf50('0x37')]){_0x1fb414[_0xbf50('0x38')]=_[_0xbf50('0x39')](_0x1fb414[_0xbf50('0x38')],{'$or':_[_0xbf50('0x3a')](_0x1fb414[_0xbf50('0x34')],function(_0x3ff524){var _0x15eb83={};_0x15eb83[_0x3ff524]={'$like':'%'+_0x36225e['query'][_0xbf50('0x37')]+'%'};return _0x15eb83;})});}_0x1fb414=_[_0xbf50('0x39')]({},_0x1fb414,_0x36225e[_0xbf50('0x41')]);return _0x47dc00[_0xbf50('0x52')](_0x1fb414);}})[_0xbf50('0x27')](function(_0x1f0c64){if(_0x1f0c64){_0x2d5e3a=_0x1f0c64[_0xbf50('0x36')];if(!_0x36225e[_0xbf50('0x31')][_0xbf50('0x57')](_0xbf50('0x58'))){_0x1fb414[_0xbf50('0x20')]=qs[_0xbf50('0x20')](_0x36225e[_0xbf50('0x31')]['limit']);_0x1fb414[_0xbf50('0x1e')]=qs['offset'](_0x36225e[_0xbf50('0x31')][_0xbf50('0x1e')]);}return _0x47dc00['getContacts'](_0x1fb414);}})[_0xbf50('0x27')](function(_0x1900ff){if(_0x1900ff){return _0x1900ff?{'count':_0x2d5e3a,'rows':_0x1900ff}:null;}})[_0xbf50('0x27')](respondWithResult(_0x437508,null))['catch'](handleError(_0x437508,null));}; \ No newline at end of file +var _0x07f2=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Companies','end','sendStatus','error','stack','name','send','index','CmCompany','describe','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','addContacts','CmContact','ids','omit','getContacts','keys','nolimit','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x2289b5,_0x334692){var _0x402acd=function(_0xb59519){while(--_0xb59519){_0x2289b5['push'](_0x2289b5['shift']());}};_0x402acd(++_0x334692);}(_0x07f2,0xf6));var _0x207f=function(_0x490203,_0x3802b0){_0x490203=_0x490203-0x0;var _0x389396=_0x07f2[_0x490203];return _0x389396;};'use strict';var emlformat=require(_0x207f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x207f('0x1'));var rp=require(_0x207f('0x2'));var moment=require(_0x207f('0x3'));var BPromise=require(_0x207f('0x4'));var Mustache=require('mustache');var util=require(_0x207f('0x5'));var path=require(_0x207f('0x6'));var sox=require(_0x207f('0x7'));var csv=require('to-csv');var ejs=require(_0x207f('0x8'));var fs=require('fs');var fs_extra=require(_0x207f('0x9'));var _=require(_0x207f('0xa'));var squel=require(_0x207f('0xb'));var crypto=require(_0x207f('0xc'));var jsforce=require(_0x207f('0xd'));var deskjs=require(_0x207f('0xe'));var toCsv=require(_0x207f('0xf'));var querystring=require(_0x207f('0x10'));var Papa=require(_0x207f('0x11'));var Redis=require(_0x207f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x207f('0x13'));var as=require(_0x207f('0x14'));var hardwareService=require(_0x207f('0x15'));var logger=require('../../config/logger')(_0x207f('0x16'));var utils=require(_0x207f('0x17'));var config=require(_0x207f('0x18'));var licenseUtil=require(_0x207f('0x19'));var db=require(_0x207f('0x1a'))['db'];function respondWithStatusCode(_0x417e9a,_0x277da0){_0x277da0=_0x277da0||0xcc;return function(_0x102536){if(_0x102536){return _0x417e9a['sendStatus'](_0x277da0);}return _0x417e9a[_0x207f('0x1b')](_0x277da0)['end']();};}function respondWithResult(_0x12d340,_0x46068d){_0x46068d=_0x46068d||0xc8;return function(_0x496a24){if(_0x496a24){return _0x12d340[_0x207f('0x1b')](_0x46068d)[_0x207f('0x1c')](_0x496a24);}};}function respondWithFilteredResult(_0x3a71e2,_0x3651d4){return function(_0x413b95){if(_0x413b95){var _0x407a42=typeof _0x3651d4[_0x207f('0x1d')]===_0x207f('0x1e')&&typeof _0x3651d4[_0x207f('0x1f')]===_0x207f('0x1e');var _0x33ae51=_0x413b95[_0x207f('0x20')];var _0x2c501b=_0x407a42?0x0:_0x3651d4[_0x207f('0x1d')];var _0x14a4a7=_0x407a42?_0x413b95[_0x207f('0x20')]:_0x3651d4[_0x207f('0x1d')]+_0x3651d4[_0x207f('0x1f')];var _0x4cd195;if(_0x14a4a7>=_0x33ae51){_0x14a4a7=_0x33ae51;_0x4cd195=0xc8;}else{_0x4cd195=0xce;}_0x3a71e2[_0x207f('0x1b')](_0x4cd195);return _0x3a71e2['set'](_0x207f('0x21'),_0x2c501b+'-'+_0x14a4a7+'/'+_0x33ae51)[_0x207f('0x1c')](_0x413b95);}return null;};}function patchUpdates(_0x1f2f38){return function(_0x6b0bce){try{jsonpatch[_0x207f('0x22')](_0x6b0bce,_0x1f2f38,!![]);}catch(_0x33e586){return BPromise[_0x207f('0x23')](_0x33e586);}return _0x6b0bce[_0x207f('0x24')]();};}function saveUpdates(_0x3f470e,_0x11ce37){return function(_0x231208){if(_0x231208){return _0x231208[_0x207f('0x25')](_0x3f470e)[_0x207f('0x26')](function(_0x5eee6f){return _0x5eee6f;});}return null;};}function removeEntity(_0x342058,_0x374f6a){return function(_0x250dc2){if(_0x250dc2){return _0x250dc2[_0x207f('0x27')]()[_0x207f('0x26')](function(){var _0x38e32e=_0x250dc2['get']({'plain':!![]});var _0x5379bb=_0x207f('0x28');return db['UserProfileResource'][_0x207f('0x27')]({'where':{'type':_0x5379bb,'resourceId':_0x38e32e['id']}})[_0x207f('0x26')](function(){return _0x250dc2;});})['then'](function(){_0x342058[_0x207f('0x1b')](0xcc)[_0x207f('0x29')]();});}};}function handleEntityNotFound(_0x1bd16e,_0x324103){return function(_0x248f64){if(!_0x248f64){_0x1bd16e[_0x207f('0x2a')](0x194);}return _0x248f64;};}function handleError(_0x1766f7,_0x19b0d6){_0x19b0d6=_0x19b0d6||0x1f4;return function(_0x57bfd8){logger[_0x207f('0x2b')](_0x57bfd8[_0x207f('0x2c')]);if(_0x57bfd8[_0x207f('0x2d')]){delete _0x57bfd8['name'];}_0x1766f7['status'](_0x19b0d6)[_0x207f('0x2e')](_0x57bfd8);};}exports[_0x207f('0x2f')]=function(_0x32e16,_0xe50398){var _0x173c4e={},_0x2badb4={},_0x1b5eaa={'count':0x0,'rows':[]};return db[_0x207f('0x30')][_0x207f('0x31')]()[_0x207f('0x26')](function(_0x122c4d){_0x2badb4[_0x207f('0x32')]=_['keys'](_0x122c4d);_0x2badb4[_0x207f('0x33')]=_['keys'](_0x32e16[_0x207f('0x33')]);_0x2badb4[_0x207f('0x34')]=_[_0x207f('0x35')](_0x2badb4[_0x207f('0x32')],_0x2badb4[_0x207f('0x33')]);_0x173c4e[_0x207f('0x36')]=_['intersection'](_0x2badb4['model'],qs[_0x207f('0x37')](_0x32e16[_0x207f('0x33')][_0x207f('0x37')]));_0x173c4e[_0x207f('0x36')]=_0x173c4e[_0x207f('0x36')][_0x207f('0x38')]?_0x173c4e['attributes']:_0x2badb4[_0x207f('0x32')];if(!_0x32e16[_0x207f('0x33')][_0x207f('0x39')]('nolimit')){_0x173c4e['limit']=qs[_0x207f('0x1f')](_0x32e16[_0x207f('0x33')][_0x207f('0x1f')]);_0x173c4e[_0x207f('0x1d')]=qs['offset'](_0x32e16['query'][_0x207f('0x1d')]);}_0x173c4e[_0x207f('0x3a')]=qs[_0x207f('0x3b')](_0x32e16['query'][_0x207f('0x3b')]);_0x173c4e[_0x207f('0x3c')]=qs[_0x207f('0x34')](_[_0x207f('0x3d')](_0x32e16[_0x207f('0x33')],_0x2badb4[_0x207f('0x34')]),_0x122c4d);if(_0x32e16[_0x207f('0x33')][_0x207f('0x3e')]){_0x173c4e[_0x207f('0x3c')]=_[_0x207f('0x3f')](_0x173c4e[_0x207f('0x3c')],{'$or':_[_0x207f('0x40')](_0x173c4e[_0x207f('0x36')],function(_0x30a2d4){var _0x5b6532={};_0x5b6532[_0x30a2d4]={'$like':'%'+_0x32e16[_0x207f('0x33')][_0x207f('0x3e')]+'%'};return _0x5b6532;})});}_0x173c4e=_['merge']({},_0x173c4e,_0x32e16['options']);var _0x339f11={'where':_0x173c4e[_0x207f('0x3c')]};return db[_0x207f('0x30')][_0x207f('0x20')](_0x339f11)['then'](function(_0x16fe22){_0x1b5eaa[_0x207f('0x20')]=_0x16fe22;if(_0x32e16['query']['includeAll']){_0x173c4e[_0x207f('0x41')]=[{'all':!![]}];}return db[_0x207f('0x30')][_0x207f('0x42')](_0x173c4e);})[_0x207f('0x26')](function(_0x5744be){_0x1b5eaa[_0x207f('0x43')]=_0x5744be;return _0x1b5eaa;})['then'](respondWithFilteredResult(_0xe50398,_0x173c4e))['catch'](handleError(_0xe50398,null));})[_0x207f('0x44')](handleError(_0xe50398,null));};exports[_0x207f('0x45')]=function(_0x2fab82,_0x1b45a4){var _0x15d63a={'raw':![],'where':{'id':_0x2fab82[_0x207f('0x46')]['id']}},_0x98ce1e={};_0x98ce1e[_0x207f('0x32')]=_['keys'](db['CmCompany'][_0x207f('0x47')]);_0x98ce1e[_0x207f('0x33')]=_['keys'](_0x2fab82[_0x207f('0x33')]);_0x98ce1e['filters']=_[_0x207f('0x35')](_0x98ce1e[_0x207f('0x32')],_0x98ce1e[_0x207f('0x33')]);_0x15d63a[_0x207f('0x36')]=_['intersection'](_0x98ce1e['model'],qs[_0x207f('0x37')](_0x2fab82['query'][_0x207f('0x37')]));_0x15d63a[_0x207f('0x36')]=_0x15d63a[_0x207f('0x36')]['length']?_0x15d63a['attributes']:_0x98ce1e[_0x207f('0x32')];if(_0x2fab82[_0x207f('0x33')][_0x207f('0x48')]){_0x15d63a['include']=[{'all':!![]}];}_0x15d63a=_[_0x207f('0x3f')]({},_0x15d63a,_0x2fab82[_0x207f('0x49')]);return db[_0x207f('0x30')]['find'](_0x15d63a)[_0x207f('0x26')](handleEntityNotFound(_0x1b45a4,null))[_0x207f('0x26')](respondWithResult(_0x1b45a4,null))['catch'](handleError(_0x1b45a4,null));};exports[_0x207f('0x4a')]=function(_0x14f5f1,_0x3efae8){return db['CmCompany'][_0x207f('0x4a')](_0x14f5f1[_0x207f('0x4b')],{})[_0x207f('0x26')](function(_0x370d7c){var _0x59bce4=_0x14f5f1[_0x207f('0x4c')][_0x207f('0x4d')]({'plain':!![]});if(!_0x59bce4)throw new Error(_0x207f('0x4e'));if(_0x59bce4[_0x207f('0x4f')]==='user'){var _0x45f411=_0x370d7c[_0x207f('0x4d')]({'plain':!![]});var _0x473500=_0x207f('0x28');return db[_0x207f('0x50')][_0x207f('0x51')]({'where':{'name':_0x473500,'userProfileId':_0x59bce4[_0x207f('0x52')]},'raw':!![]})[_0x207f('0x26')](function(_0x1d9f83){if(_0x1d9f83&&_0x1d9f83[_0x207f('0x53')]===0x0){return db[_0x207f('0x54')][_0x207f('0x4a')]({'name':_0x45f411[_0x207f('0x2d')],'resourceId':_0x45f411['id'],'type':_0x1d9f83[_0x207f('0x2d')],'sectionId':_0x1d9f83['id']},{})[_0x207f('0x26')](function(){return _0x370d7c;});}else{return _0x370d7c;}})[_0x207f('0x44')](function(_0x2c16f0){logger[_0x207f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c16f0);throw _0x2c16f0;});}return _0x370d7c;})[_0x207f('0x26')](respondWithResult(_0x3efae8,0xc9))[_0x207f('0x44')](handleError(_0x3efae8,null));};exports[_0x207f('0x25')]=function(_0x51f6a4,_0x33f98f){if(_0x51f6a4[_0x207f('0x4b')]['id']){delete _0x51f6a4[_0x207f('0x4b')]['id'];}return db[_0x207f('0x30')][_0x207f('0x51')]({'where':{'id':_0x51f6a4[_0x207f('0x46')]['id']}})['then'](handleEntityNotFound(_0x33f98f,null))[_0x207f('0x26')](saveUpdates(_0x51f6a4[_0x207f('0x4b')],null))[_0x207f('0x26')](respondWithResult(_0x33f98f,null))[_0x207f('0x44')](handleError(_0x33f98f,null));};exports[_0x207f('0x27')]=function(_0x5c3ed3,_0x142c13){return db[_0x207f('0x30')][_0x207f('0x51')]({'where':{'id':_0x5c3ed3[_0x207f('0x46')]['id']}})[_0x207f('0x26')](handleEntityNotFound(_0x142c13,null))[_0x207f('0x26')](removeEntity(_0x142c13,null))[_0x207f('0x44')](handleError(_0x142c13,null));};exports['describe']=function(_0xfee89e,_0x1b17ec){return db[_0x207f('0x30')][_0x207f('0x31')]()[_0x207f('0x26')](respondWithResult(_0x1b17ec,null))[_0x207f('0x44')](handleError(_0x1b17ec,null));};exports[_0x207f('0x55')]=function(_0x264223,_0x12cc9c,_0x39ae78){return db[_0x207f('0x56')]['find']({'where':{'id':_0x264223['params']['id']}})[_0x207f('0x26')](handleEntityNotFound(_0x12cc9c,null))[_0x207f('0x26')](function(_0x3168eb){if(_0x3168eb){return _0x3168eb['addContacts'](_0x264223[_0x207f('0x4b')][_0x207f('0x57')],_[_0x207f('0x58')](_0x264223['body'],[_0x207f('0x57'),'id'])||{});}})[_0x207f('0x26')](respondWithResult(_0x12cc9c,null))['catch'](handleError(_0x12cc9c,null));};exports[_0x207f('0x59')]=function(_0x1aa5f5,_0xbcade,_0x1c0a13){var _0x406fc8={};var _0x17580c={};var _0x28e53f;var _0x35a3df;return db[_0x207f('0x30')]['findOne']({'where':{'id':_0x1aa5f5[_0x207f('0x46')]['id']}})['then'](handleEntityNotFound(_0xbcade,null))[_0x207f('0x26')](function(_0x3f6750){if(_0x3f6750){_0x28e53f=_0x3f6750;_0x17580c['model']=_['keys'](db[_0x207f('0x56')][_0x207f('0x47')]);_0x17580c['query']=_[_0x207f('0x5a')](_0x1aa5f5[_0x207f('0x33')]);_0x17580c[_0x207f('0x34')]=_[_0x207f('0x35')](_0x17580c[_0x207f('0x32')],_0x17580c['query']);_0x406fc8[_0x207f('0x36')]=_[_0x207f('0x35')](_0x17580c['model'],qs['fields'](_0x1aa5f5[_0x207f('0x33')][_0x207f('0x37')]));_0x406fc8[_0x207f('0x36')]=_0x406fc8[_0x207f('0x36')][_0x207f('0x38')]?_0x406fc8[_0x207f('0x36')]:_0x17580c[_0x207f('0x32')];_0x406fc8['order']=qs[_0x207f('0x3b')](_0x1aa5f5[_0x207f('0x33')][_0x207f('0x3b')]);_0x406fc8['where']=qs[_0x207f('0x34')](_[_0x207f('0x3d')](_0x1aa5f5[_0x207f('0x33')],_0x17580c[_0x207f('0x34')]));if(_0x1aa5f5[_0x207f('0x33')][_0x207f('0x3e')]){_0x406fc8[_0x207f('0x3c')]=_[_0x207f('0x3f')](_0x406fc8[_0x207f('0x3c')],{'$or':_[_0x207f('0x40')](_0x406fc8[_0x207f('0x36')],function(_0x482425){var _0x2b9358={};_0x2b9358[_0x482425]={'$like':'%'+_0x1aa5f5['query'][_0x207f('0x3e')]+'%'};return _0x2b9358;})});}_0x406fc8=_['merge']({},_0x406fc8,_0x1aa5f5[_0x207f('0x49')]);return _0x28e53f[_0x207f('0x59')](_0x406fc8);}})['then'](function(_0x2456bf){if(_0x2456bf){_0x35a3df=_0x2456bf[_0x207f('0x38')];if(!_0x1aa5f5['query'][_0x207f('0x39')](_0x207f('0x5b'))){_0x406fc8[_0x207f('0x1f')]=qs['limit'](_0x1aa5f5[_0x207f('0x33')][_0x207f('0x1f')]);_0x406fc8[_0x207f('0x1d')]=qs[_0x207f('0x1d')](_0x1aa5f5[_0x207f('0x33')]['offset']);}return _0x28e53f[_0x207f('0x59')](_0x406fc8);}})[_0x207f('0x26')](function(_0x40109a){if(_0x40109a){return _0x40109a?{'count':_0x35a3df,'rows':_0x40109a}:null;}})['then'](respondWithResult(_0xbcade,null))[_0x207f('0x44')](handleError(_0xbcade,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 26dad4c..af2c68d 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 _0x3ea8=['util','../../config/logger','api','moment','bluebird','request-promise','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x5ab6d8,_0x54cbad){var _0x57cd16=function(_0x1b5c33){while(--_0x1b5c33){_0x5ab6d8['push'](_0x5ab6d8['shift']());}};_0x57cd16(++_0x54cbad);}(_0x3ea8,0x167));var _0x83ea=function(_0x4f2fc6,_0x3f6093){_0x4f2fc6=_0x4f2fc6-0x0;var _0x3136fc=_0x3ea8[_0x4f2fc6];return _0x3136fc;};'use strict';var _=require(_0x83ea('0x0'));var util=require(_0x83ea('0x1'));var logger=require(_0x83ea('0x2'))(_0x83ea('0x3'));var moment=require(_0x83ea('0x4'));var BPromise=require(_0x83ea('0x5'));var rp=require(_0x83ea('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x83ea('0x7'));module[_0x83ea('0x8')]=function(_0x2ece04,_0x11bad1){return _0x2ece04[_0x83ea('0x9')](_0x83ea('0xa'),attributes,{'tableName':_0x83ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcca1=['path','define','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcca1,0x133));var _0x1cca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcca1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1cca('0x0'));var util=require(_0x1cca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1cca('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cca('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module['exports']=function(_0x50d1dc,_0x36b8f3){return _0x50d1dc[_0x1cca('0x4')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 39123f8..d861261 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 _0xeb43=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1abc5f,_0x1d28da){var _0x57a641=function(_0x149048){while(--_0x149048){_0x1abc5f['push'](_0x1abc5f['shift']());}};_0x57a641(++_0x1d28da);}(_0xeb43,0xac));var _0x3eb4=function(_0x332998,_0x2d99c7){_0x332998=_0x332998-0x0;var _0x460be7=_0xeb43[_0x332998];return _0x460be7;};'use strict';var _=require(_0x3eb4('0x0'));var util=require(_0x3eb4('0x1'));var moment=require(_0x3eb4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3eb4('0x3'));var db=require(_0x3eb4('0x4'))['db'];var utils=require(_0x3eb4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3eb4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3eb4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e8917,_0x3afcb3,_0x150859){return new BPromise(function(_0x238222,_0x39e264){return client[_0x3eb4('0x8')](_0x5e8917,_0x150859)[_0x3eb4('0x9')](function(_0x52ea77){logger[_0x3eb4('0xa')](_0x3eb4('0xb'),_0x3afcb3,_0x3eb4('0xc'));logger[_0x3eb4('0xd')](_0x3eb4('0xe'),_0x3afcb3,_0x3eb4('0xc'),JSON[_0x3eb4('0xf')](_0x52ea77));if(_0x52ea77[_0x3eb4('0x10')]){if(_0x52ea77[_0x3eb4('0x10')][_0x3eb4('0x11')]===0x1f4){logger['error'](_0x3eb4('0xb'),_0x3afcb3,_0x52ea77[_0x3eb4('0x10')][_0x3eb4('0x12')]);return _0x39e264(_0x52ea77[_0x3eb4('0x10')][_0x3eb4('0x12')]);}logger[_0x3eb4('0x10')](_0x3eb4('0xb'),_0x3afcb3,_0x52ea77[_0x3eb4('0x10')][_0x3eb4('0x12')]);return _0x238222(_0x52ea77[_0x3eb4('0x10')][_0x3eb4('0x12')]);}else{logger['info'](_0x3eb4('0xb'),_0x3afcb3,_0x3eb4('0xc'));_0x238222(_0x52ea77[_0x3eb4('0x13')][_0x3eb4('0x12')]);}})[_0x3eb4('0x14')](function(_0xba27){logger[_0x3eb4('0x10')](_0x3eb4('0xb'),_0x3afcb3,_0xba27);_0x39e264(_0xba27);});});} \ No newline at end of file +var _0x1dba=['../../mysqldb','../../config/logger','rpc','client','request','then','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x1a6def,_0x29fa12){var _0x1019f9=function(_0x22ce66){while(--_0x22ce66){_0x1a6def['push'](_0x1a6def['shift']());}};_0x1019f9(++_0x29fa12);}(_0x1dba,0x73));var _0xa1db=function(_0x580f92,_0x21547d){_0x580f92=_0x580f92-0x0;var _0x164e6d=_0x1dba[_0x580f92];return _0x164e6d;};'use strict';var _=require(_0xa1db('0x0'));var util=require(_0xa1db('0x1'));var moment=require(_0xa1db('0x2'));var BPromise=require(_0xa1db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1db('0x4'));var db=require(_0xa1db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1db('0x6'))(_0xa1db('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa1db('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca999,_0x557523,_0xbe3833){return new BPromise(function(_0x21f5eb,_0x9ec007){return client[_0xa1db('0x9')](_0x4ca999,_0xbe3833)[_0xa1db('0xa')](function(_0x1bde60){logger['info'](_0xa1db('0xb'),_0x557523,'request\x20sent');logger['debug'](_0xa1db('0xc'),_0x557523,_0xa1db('0xd'),JSON[_0xa1db('0xe')](_0x1bde60));if(_0x1bde60[_0xa1db('0xf')]){if(_0x1bde60[_0xa1db('0xf')][_0xa1db('0x10')]===0x1f4){logger[_0xa1db('0xf')](_0xa1db('0xb'),_0x557523,_0x1bde60[_0xa1db('0xf')][_0xa1db('0x11')]);return _0x9ec007(_0x1bde60[_0xa1db('0xf')]['message']);}logger[_0xa1db('0xf')]('CmCompany,\x20%s,\x20%s',_0x557523,_0x1bde60[_0xa1db('0xf')]['message']);return _0x21f5eb(_0x1bde60[_0xa1db('0xf')][_0xa1db('0x11')]);}else{logger['info'](_0xa1db('0xb'),_0x557523,_0xa1db('0xd'));_0x21f5eb(_0x1bde60[_0xa1db('0x12')]['message']);}})[_0xa1db('0x13')](function(_0x5e2bf3){logger[_0xa1db('0xf')](_0xa1db('0xb'),_0x557523,_0x5e2bf3);_0x9ec007(_0x5e2bf3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index a500cd6..38a85c5 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 _0xf403=['/:id','show','create','addContacts','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','isAuthenticated','describe'];(function(_0x21ffb1,_0x177883){var _0x35aa98=function(_0x1b343){while(--_0x1b343){_0x21ffb1['push'](_0x21ffb1['shift']());}};_0x35aa98(++_0x177883);}(_0xf403,0x158));var _0x3f40=function(_0x560cee,_0x5c67c9){_0x560cee=_0x560cee-0x0;var _0x21015a=_0xf403[_0x560cee];return _0x21015a;};'use strict';var multer=require('multer');var util=require(_0x3f40('0x0'));var path=require(_0x3f40('0x1'));var timeout=require(_0x3f40('0x2'));var express=require(_0x3f40('0x3'));var router=express[_0x3f40('0x4')]();var fs_extra=require(_0x3f40('0x5'));var auth=require(_0x3f40('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3f40('0x7'));var controller=require(_0x3f40('0x8'));router[_0x3f40('0x9')]('/',auth['isAuthenticated'](),controller[_0x3f40('0xa')]);router[_0x3f40('0x9')]('/describe',auth[_0x3f40('0xb')](),controller[_0x3f40('0xc')]);router[_0x3f40('0x9')](_0x3f40('0xd'),auth[_0x3f40('0xb')](),controller[_0x3f40('0xe')]);router[_0x3f40('0x9')]('/:id/contacts',auth[_0x3f40('0xb')](),controller['getContacts']);router['post']('/',auth[_0x3f40('0xb')](),controller[_0x3f40('0xf')]);router['post']('/:id/contacts',auth[_0x3f40('0xb')](),controller[_0x3f40('0x10')]);router[_0x3f40('0x11')](_0x3f40('0xd'),auth['isAuthenticated'](),controller[_0x3f40('0x12')]);router[_0x3f40('0x13')](_0x3f40('0xd'),auth['isAuthenticated'](),controller[_0x3f40('0x14')]);module['exports']=router; \ No newline at end of file +var _0x515a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','put','update','delete'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x515a,0x14a));var _0xa515=function(_0x1562e5,_0x97e4c9){_0x1562e5=_0x1562e5-0x0;var _0x126806=_0x515a[_0x1562e5];return _0x126806;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa515('0x0'));var timeout=require(_0xa515('0x1'));var express=require(_0xa515('0x2'));var router=express[_0xa515('0x3')]();var fs_extra=require(_0xa515('0x4'));var auth=require(_0xa515('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa515('0x6'));var controller=require(_0xa515('0x7'));router[_0xa515('0x8')]('/',auth['isAuthenticated'](),controller[_0xa515('0x9')]);router[_0xa515('0x8')](_0xa515('0xa'),auth[_0xa515('0xb')](),controller[_0xa515('0xc')]);router[_0xa515('0x8')](_0xa515('0xd'),auth['isAuthenticated'](),controller[_0xa515('0xe')]);router[_0xa515('0x8')](_0xa515('0xf'),auth[_0xa515('0xb')](),controller[_0xa515('0x10')]);router[_0xa515('0x11')]('/',auth[_0xa515('0xb')](),controller[_0xa515('0x12')]);router[_0xa515('0x11')](_0xa515('0xf'),auth[_0xa515('0xb')](),controller['addContacts']);router[_0xa515('0x13')](_0xa515('0xd'),auth['isAuthenticated'](),controller[_0xa515('0x14')]);router[_0xa515('0x15')](_0xa515('0xd'),auth[_0xa515('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 0f59d86..b9f7ce0 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 _0xf199=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','sequelize'];(function(_0x56a56d,_0x16b7f5){var _0x3b420a=function(_0x497e25){while(--_0x497e25){_0x56a56d['push'](_0x56a56d['shift']());}};_0x3b420a(++_0x16b7f5);}(_0xf199,0xed));var _0x9f19=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xf199[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require('lodash');var Sequelize=require(_0x9f19('0x0'));module[_0x9f19('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x9f19('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9f19('0x2')]},'city':{'type':Sequelize[_0x9f19('0x2')]},'country':{'type':Sequelize[_0x9f19('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x9f19('0x2')]},'mobile':{'type':Sequelize[_0x9f19('0x2')]},'fax':{'type':Sequelize[_0x9f19('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x9f19('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x9f19('0x2')]},'skype':{'type':Sequelize[_0x9f19('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x9f19('0x2')]},'line':{'type':Sequelize[_0x9f19('0x2')]},'wechat':{'type':Sequelize[_0x9f19('0x2')]},'telegram':{'type':Sequelize[_0x9f19('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x9f19('0x2')]},'priority':{'type':Sequelize[_0x9f19('0x3')](0x2)[_0x9f19('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9f19('0x5')],'defaultValue':Sequelize[_0x9f19('0x6')]},'dialTimezone':{'type':Sequelize[_0x9f19('0x2')]},'utcOffset':{'type':Sequelize[_0x9f19('0x3')]}}; \ No newline at end of file +var _0x776d=['NOW','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x776d,0x1c3));var _0xd776=function(_0x4dca0a,_0x899da1){_0x4dca0a=_0x4dca0a-0x0;var _0x4161bc=_0x776d[_0x4dca0a];return _0x4161bc;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xd776('0x0')]={'firstName':{'type':Sequelize[_0xd776('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd776('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xd776('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xd776('0x1')]},'dateOfBirth':{'type':Sequelize[_0xd776('0x1')]},'description':{'type':Sequelize[_0xd776('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd776('0x1')]},'fax':{'type':Sequelize[_0xd776('0x1')]},'email':{'type':Sequelize[_0xd776('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xd776('0x1')]},'fb_data':{'type':Sequelize[_0xd776('0x1')]},'twitter':{'type':Sequelize[_0xd776('0x1')]},'skype':{'type':Sequelize[_0xd776('0x1')]},'teams':{'type':Sequelize[_0xd776('0x1')]},'viber':{'type':Sequelize[_0xd776('0x1')]},'line':{'type':Sequelize[_0xd776('0x1')]},'wechat':{'type':Sequelize[_0xd776('0x1')]},'telegram':{'type':Sequelize[_0xd776('0x1')]},'UserId':{'type':Sequelize[_0xd776('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xd776('0x1')]},'priority':{'type':Sequelize[_0xd776('0x3')](0x2)[_0xd776('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xd776('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xd776('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 2aa8ec6..fb7d65b 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 _0x33e5=['voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','alias','startCase','chat','Website','Account','closed','closedAt','disposition','secondDisposition','Owner','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','referer','substatus','threadId','Interaction','flatten','sortBy','value','slice','bluebird','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','status','json','undefined','limit','offset','Content-Range','update','then','destroy','sendStatus','stack','name','index','getOptions','findAll','query','catch','CmContact','find','params','tags','keys','length','startsWith','columnName','displayName','analytics','CmCustomField','cf_','custom','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','join','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','describe','each','duplicates','where','$or','push','ListId','findOrCreate','spread','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','omit','format','cf_%d','pickBy','isEmpty','table','setFields','id\x20=\x20?','toParam','text','values','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','options','nolimit','setTags','ids','all','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','map','item','literal','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','hopperId','getHoppers','ContactId','count','includeAll','include','getHopperHistories','rows','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','fork','../../components/import/cm/csv','socket_timestamp','pid','send','upload','parse','meta','import','User','binding','No\x20firstName\x20column\x20specified','child_process','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','agent','../../components/import/cm/csvUpdates','exit','getJourney','mail','openchannel','fax','whatsapp'];(function(_0x201471,_0x337bf1){var _0xcb523c=function(_0x3bfd23){while(--_0x3bfd23){_0x201471['push'](_0x201471['shift']());}};_0xcb523c(++_0x337bf1);}(_0x33e5,0x136));var _0x533e=function(_0x3e5126,_0x3daf6a){_0x3e5126=_0x3e5126-0x0;var _0x5dfd77=_0x33e5[_0x3e5126];return _0x5dfd77;};'use strict';var moment=require('moment');var BPromise=require(_0x533e('0x0'));var util=require('util');var path=require(_0x533e('0x1'));var fs=require('fs');var _=require(_0x533e('0x2'));var squel=require(_0x533e('0x3'));var Papa=require(_0x533e('0x4'));var Redis=require(_0x533e('0x5'));var contacts=require(_0x533e('0x6'));var qs=require(_0x533e('0x7'));var logger=require(_0x533e('0x8'))(_0x533e('0x9'));var config=require(_0x533e('0xa'));var shared=require(_0x533e('0xb'));var db=require(_0x533e('0xc'))['db'];config[_0x533e('0xd')]=_[_0x533e('0xe')](config[_0x533e('0xd')],{'host':_0x533e('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x533e('0xd')]));require(_0x533e('0x10'))[_0x533e('0x11')](socket);function respondWithResult(_0x4b680f,_0x1e4781){_0x1e4781=_0x1e4781||0xc8;return function(_0x31ded7){if(_0x31ded7){return _0x4b680f[_0x533e('0x12')](_0x1e4781)[_0x533e('0x13')](_0x31ded7);}};}function respondWithFilteredResult(_0x26c98e,_0x5347dc){return function(_0x5dc3aa){if(_0x5dc3aa){var _0x5c1c05=typeof _0x5347dc['offset']===_0x533e('0x14')&&typeof _0x5347dc[_0x533e('0x15')]===_0x533e('0x14');var _0x339d35=_0x5dc3aa['count'];var _0x412991=_0x5c1c05?0x0:_0x5347dc[_0x533e('0x16')];var _0x18f4bd=_0x5c1c05?_0x5dc3aa['count']:_0x5347dc[_0x533e('0x16')]+_0x5347dc[_0x533e('0x15')];var _0x4baff4;if(_0x18f4bd>=_0x339d35){_0x18f4bd=_0x339d35;_0x4baff4=0xc8;}else{_0x4baff4=0xce;}_0x26c98e[_0x533e('0x12')](_0x4baff4);return _0x26c98e['set'](_0x533e('0x17'),_0x412991+'-'+_0x18f4bd+'/'+_0x339d35)[_0x533e('0x13')](_0x5dc3aa);}return null;};}function saveUpdates(_0x29a8f4){return function(_0x3810c9){if(_0x3810c9){return _0x3810c9[_0x533e('0x18')](_0x29a8f4)[_0x533e('0x19')](function(_0x592bf2){return _0x592bf2;});}return null;};}function removeEntity(_0x595c72){return function(_0x385525){if(_0x385525){return _0x385525[_0x533e('0x1a')]()[_0x533e('0x19')](function(){_0x595c72[_0x533e('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d427c){return function(_0x2469a7){if(!_0x2469a7){_0x1d427c[_0x533e('0x1b')](0x194);}return _0x2469a7;};}function handleError(_0x54791a,_0x4edff8){_0x4edff8=_0x4edff8||0x1f4;return function(_0x117adc){logger['error'](_0x117adc[_0x533e('0x1c')]);if(_0x117adc['name']){delete _0x117adc[_0x533e('0x1d')];}_0x54791a[_0x533e('0x12')](_0x4edff8)['send'](_0x117adc);};}exports[_0x533e('0x1e')]=function(_0x635aa4,_0x580ee8){var _0x4a2e56={};return contacts['describe']()[_0x533e('0x19')](function(_0x162547){_0x4a2e56=qs[_0x533e('0x1f')](_0x162547,_0x635aa4);return contacts[_0x533e('0x20')](_0x635aa4[_0x533e('0x21')],_0x635aa4['user'],_0x4a2e56,_0x162547);})['then'](respondWithFilteredResult(_0x580ee8,_0x4a2e56))[_0x533e('0x22')](handleError(_0x580ee8,null));};exports[_0x533e('0x1a')]=function(_0x256f85,_0x243870){return db[_0x533e('0x23')][_0x533e('0x24')]({'where':{'id':_0x256f85[_0x533e('0x25')]['id']}})[_0x533e('0x19')](handleEntityNotFound(_0x243870,null))[_0x533e('0x19')](removeEntity(_0x243870,null))[_0x533e('0x22')](handleError(_0x243870,null));};exports['describe']=function(_0x2df3dc,_0x4f9edf){return db[_0x533e('0x23')]['describe']()['then'](function(_0x1b840e){delete _0x1b840e[_0x533e('0x26')];for(var _0x186d03=0x0;_0x186d030x0){return new Promise(function(_0x4eaf7f){var _0x304679=[];for(var _0x9a7139=0x0;_0x9a7139<_0x1431de['length'];_0x9a7139++){_0x304679[_0x533e('0x60')](insertAdditionalPhones(_0x1431de[_0x9a7139]['contact'],_0x1431de[_0x9a7139]['additionalPhones']));}Promise['all'](_0x304679)[_0x533e('0x19')](function(){_0x4eaf7f(0x1);});})[_0x533e('0x19')](function(){return{'success':_0xb08b30,'failure':_0x49daac,'duplicates':_0x2a78ea};});}else{return{'success':_0xb08b30,'failure':_0x49daac,'duplicates':_0x2a78ea};}}})[_0x533e('0x19')](respondWithResult(_0x6bab93,0xc9))[_0x533e('0x22')](handleError(_0x6bab93,null));};exports['show']=function(_0x123b9a,_0x5c6c2a){var _0x5f0615;return db[_0x533e('0x23')][_0x533e('0x5b')]()[_0x533e('0x19')](function(_0x3fd484){return db[_0x533e('0x23')][_0x533e('0x24')]({'where':{'id':_0x123b9a[_0x533e('0x25')]['id']},'include':[{'model':db[_0x533e('0x64')],'as':_0x533e('0x65'),'attributes':['id','name',_0x533e('0x66')],'required':_0x123b9a['query'][_0x533e('0x67')]?!![]:![]},{'model':db[_0x533e('0x48')],'as':_0x533e('0x68'),'where':{'CmContactId':_0x123b9a[_0x533e('0x25')]['id']},'required':![],'include':[{'model':db[_0x533e('0x69')],'as':_0x533e('0x6a')}]}],'order':[db[_0x533e('0x6b')]['literal'](_0x533e('0x6c'))],'attributes':_[_0x533e('0x27')](_0x3fd484)});})[_0x533e('0x19')](function(_0x4d8d68){if(!_[_0x533e('0x56')](_0x4d8d68)){_0x5f0615=_0x4d8d68[_0x533e('0x35')]({'plain':!![]});var _0x4b223e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4d8d68&&_0x4d8d68[_0x533e('0x61')]){if(_0x4d8d68[_0x533e('0x61')]){_0x4b223e[_0x533e('0x5e')][_0x533e('0x6d')]['push']({'ListId':{'$ne':_0x4d8d68[_0x533e('0x61')]}});}}return db[_0x533e('0x2d')][_0x533e('0x20')](_0x4b223e);}})[_0x533e('0x19')](function(_0x16a762){if(!_['isNil'](_0x16a762)){return _[_0x533e('0x6e')](_0x5f0615,_['map'](_0x16a762,function(_0x40e5ce){return util[_0x533e('0x6f')](_0x533e('0x70'),_0x40e5ce['id']);}));}})['then'](handleEntityNotFound(_0x5c6c2a,null))[_0x533e('0x19')](respondWithResult(_0x5c6c2a,null))[_0x533e('0x22')](handleError(_0x5c6c2a,null));};exports[_0x533e('0x18')]=function(_0x1e8d83,_0x261f51){var _0x5ed5b2;if(_0x1e8d83[_0x533e('0x33')]['id']){delete _0x1e8d83['body']['id'];}if(!_['isNil'](_0x1e8d83[_0x533e('0x33')][_0x533e('0x57')])){var _0x3b6414=_0x1e8d83[_0x533e('0x33')][_0x533e('0x57')];if(!_[_0x533e('0x56')](shared[_0x533e('0x58')][_0x3b6414]))_0x1e8d83[_0x533e('0x33')][_0x533e('0x59')]=shared[_0x533e('0x58')][_0x3b6414][_0x533e('0x59')];}return db[_0x533e('0x23')]['find']({'where':{'id':_0x1e8d83[_0x533e('0x25')]['id']}})[_0x533e('0x19')](handleEntityNotFound(_0x261f51,null))[_0x533e('0x19')](saveUpdates(_0x1e8d83['body'],null))[_0x533e('0x19')](function(_0x41ec0d){_0x5ed5b2=_0x41ec0d;var _0x148a30={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x41ec0d&&_0x41ec0d['ListId']){if(_0x41ec0d[_0x533e('0x61')]){_0x148a30[_0x533e('0x5e')][_0x533e('0x6d')][_0x533e('0x60')]({'ListId':{'$ne':_0x41ec0d[_0x533e('0x61')]}});}}return db['CmCustomField'][_0x533e('0x20')](_0x148a30);})[_0x533e('0x19')](function(_0x9485e4){if(_0x9485e4){return _[_0x533e('0x6e')](_[_0x533e('0x71')](_0x1e8d83[_0x533e('0x33')],function(_0x40f5e7,_0x2f37f3){return _['startsWith'](_0x2f37f3,_0x533e('0x2e'));}),_['map'](_0x9485e4,function(_0x33422b){return util[_0x533e('0x6f')](_0x533e('0x70'),_0x33422b['id']);}));}})[_0x533e('0x19')](function(_0x75a1bc){if(_0x75a1bc&&!_[_0x533e('0x72')](_0x75a1bc)){var _0x1593bb=squel[_0x533e('0x18')]()[_0x533e('0x73')]('cm_contacts')[_0x533e('0x74')](_0x75a1bc)['where'](_0x533e('0x75'),_0x1e8d83[_0x533e('0x25')]['id'])[_0x533e('0x76')]();return db[_0x533e('0x6b')][_0x533e('0x21')](_0x1593bb[_0x533e('0x77')],{'replacements':_0x1593bb[_0x533e('0x78')]});}})[_0x533e('0x19')](function(){if(_0x1e8d83[_0x533e('0x33')][_0x533e('0x79')]&&_0x5ed5b2){return db[_0x533e('0x39')][_0x533e('0x18')]({'phone':_0x1e8d83[_0x533e('0x33')][_0x533e('0x79')],'OrderBy':0x0},{'where':{'ContactId':_0x5ed5b2['id']}});}})[_0x533e('0x19')](function(){return _0x5ed5b2;})[_0x533e('0x19')](respondWithResult(_0x261f51,null))[_0x533e('0x22')](handleError(_0x261f51,null));};exports[_0x533e('0x7a')]=function(_0x1ec62c,_0x2d20d2){var _0xa990de={};var _0x47272d={};var _0x173dd6;var _0x262e66;return db[_0x533e('0x23')][_0x533e('0x7b')]({'where':{'id':_0x1ec62c[_0x533e('0x25')]['id']}})['then'](handleEntityNotFound(_0x2d20d2,null))[_0x533e('0x19')](function(_0x590db4){if(_0x590db4){_0x173dd6=_0x590db4;_0x47272d[_0x533e('0x7c')]=_[_0x533e('0x27')](db['Tag'][_0x533e('0x7d')]);_0x47272d['query']=_[_0x533e('0x27')](_0x1ec62c[_0x533e('0x21')]);_0x47272d[_0x533e('0x7e')]=_[_0x533e('0x7f')](_0x47272d[_0x533e('0x7c')],_0x47272d['query']);_0xa990de[_0x533e('0x80')]=_[_0x533e('0x7f')](_0x47272d['model'],qs[_0x533e('0x81')](_0x1ec62c[_0x533e('0x21')][_0x533e('0x81')]));_0xa990de[_0x533e('0x80')]=_0xa990de[_0x533e('0x80')][_0x533e('0x28')]?_0xa990de[_0x533e('0x80')]:_0x47272d[_0x533e('0x7c')];_0xa990de[_0x533e('0x82')]=qs[_0x533e('0x83')](_0x1ec62c[_0x533e('0x21')]['sort']);_0xa990de[_0x533e('0x5e')]=qs[_0x533e('0x7e')](_[_0x533e('0x84')](_0x1ec62c[_0x533e('0x21')],_0x47272d[_0x533e('0x7e')]));if(_0x1ec62c[_0x533e('0x21')][_0x533e('0x85')]){_0xa990de[_0x533e('0x5e')]=_[_0x533e('0x86')](_0xa990de[_0x533e('0x5e')],{'$or':_['map'](_0xa990de['attributes'],function(_0x39fc4d){var _0x77a2ac={};_0x77a2ac[_0x39fc4d]={'$like':'%'+_0x1ec62c['query'][_0x533e('0x85')]+'%'};return _0x77a2ac;})});}_0xa990de=_['merge']({},_0xa990de,_0x1ec62c[_0x533e('0x87')]);return _0x173dd6['getTags'](_0xa990de);}})[_0x533e('0x19')](function(_0x1657fe){if(_0x1657fe){_0x262e66=_0x1657fe['length'];if(!_0x1ec62c['query'][_0x533e('0x32')](_0x533e('0x88'))){_0xa990de['limit']=qs[_0x533e('0x15')](_0x1ec62c[_0x533e('0x21')]['limit']);_0xa990de[_0x533e('0x16')]=qs['offset'](_0x1ec62c[_0x533e('0x21')][_0x533e('0x16')]);}return _0x173dd6[_0x533e('0x7a')](_0xa990de);}})['then'](function(_0x3ef68b){if(_0x3ef68b){return _0x3ef68b?{'count':_0x262e66,'rows':_0x3ef68b}:null;}})[_0x533e('0x19')](respondWithResult(_0x2d20d2,null))[_0x533e('0x22')](handleError(_0x2d20d2,null));};exports[_0x533e('0x89')]=function(_0x310fe7,_0x469721){if(_0x310fe7['body']['id']){delete _0x310fe7[_0x533e('0x33')]['id'];}return db[_0x533e('0x23')][_0x533e('0x7b')]({'where':{'id':_0x310fe7[_0x533e('0x25')]['id']}})['then'](handleEntityNotFound(_0x469721,null))[_0x533e('0x19')](function(_0x408b37){if(_0x408b37){return _0x408b37[_0x533e('0x89')](_0x310fe7[_0x533e('0x33')][_0x533e('0x8a')]||[]);}return null;})[_0x533e('0x19')](respondWithResult(_0x469721,null))[_0x533e('0x22')](handleError(_0x469721,null));};exports['setAdditionalPhones']=function(_0x48a9e8,_0x22c53c){var _0x2e3808=[];_0x2e3808[_0x533e('0x60')](addAdditionalPhones(_0x48a9e8[_0x533e('0x33')]));Promise[_0x533e('0x8b')](_0x2e3808)[_0x533e('0x19')](function(){_0x2e3808=[];_0x2e3808['push'](deleteCmHopperPhones(_0x48a9e8['body']['id']));_0x2e3808[_0x533e('0x60')](addCmHopperPhones(_0x48a9e8[_0x533e('0x33')]['id']));Promise[_0x533e('0x8b')](_0x2e3808)[_0x533e('0x19')](function(){return[0x1];})['then'](respondWithResult(_0x22c53c,null));});};function addAdditionalPhones(_0x2f29df){var _0x29f661;return new Promise(function(_0x4a49c9){return db['CmContactHasItem'][_0x533e('0x1a')]({'where':{'CmContactId':_0x2f29df['id']}})[_0x533e('0x19')](function(){db[_0x533e('0x69')][_0x533e('0x20')]({'raw':!![],'attributes':['id',_0x533e('0x8c')]})[_0x533e('0x19')](function(_0xfc6bc5){var _0x106435=[];for(var _0x490b7a=0x0;_0x490b7a<_0x2f29df[_0x533e('0x8d')][_0x533e('0x28')];_0x490b7a++){var _0x248983=_0x2f29df[_0x533e('0x8e')]?_[_0x533e('0x56')](_0x2f29df[_0x533e('0x8e')][_0x490b7a])?'':_0x2f29df[_0x533e('0x8e')][_0x490b7a]:_0x2f29df['items'][_0x490b7a][_0x533e('0x8f')]?_0x2f29df['items'][_0x490b7a][_0x533e('0x8f')]:'';var _0x68743e=_[_0x533e('0x56')](_0x2f29df[_0x533e('0x8d')][_0x490b7a][_0x533e('0x90')])?'':_0x2f29df[_0x533e('0x8d')][_0x490b7a][_0x533e('0x90')];var _0x4dbb8b=_0x248983+':'+_0x2f29df[_0x533e('0x8d')][_0x490b7a][_0x533e('0x79')]+'§'+_0x68743e;if(_[_0x533e('0x56')](_0x29f661))_0x29f661=_0x4dbb8b;else _0x29f661+=';'+_0x4dbb8b;var _0xe05138=null;var _0x2f4a9e=null;if(_0x2f29df[_0x533e('0x8e')]){if(!_[_0x533e('0x56')](_0x2f29df[_0x533e('0x8e')][_0x490b7a])){_0x2f4a9e=_['find'](_0xfc6bc5,function(_0x1065e6){return _0x1065e6['id']===_0x2f29df[_0x533e('0x8e')][_0x490b7a];});if(!_[_0x533e('0x56')](_0x2f4a9e)){_0xe05138=_0x2f4a9e[_0x533e('0x8c')];}}}else{if(!_[_0x533e('0x56')](_0x2f29df[_0x533e('0x8d')][_0x490b7a])){_0x2f4a9e=_[_0x533e('0x24')](_0xfc6bc5,function(_0x22f8f5){return _0x22f8f5['id']===_0x2f29df[_0x533e('0x8d')][_0x490b7a][_0x533e('0x8f')];});if(!_[_0x533e('0x56')](_0x2f4a9e)){_0xe05138=_0x490b7a;}}}if(_['isNil'](_0xe05138)){_0xe05138=0x64;}_0x106435[_0x533e('0x60')](addAdditionalPhone(_0x2f29df['id'],_0x2f29df['items'][_0x490b7a][_0x533e('0x79')],_0x2f29df[_0x533e('0x8e')]?_['isNil'](_0x2f29df[_0x533e('0x8e')][_0x490b7a])?null:_0x2f29df[_0x533e('0x8e')][_0x490b7a]:_0x2f29df['items'][_0x490b7a][_0x533e('0x8f')]?_0x2f29df[_0x533e('0x8d')][_0x490b7a]['ItemTypeId']:null,_0xe05138,_0x68743e));}Promise[_0x533e('0x8b')](_0x106435)[_0x533e('0x19')](function(){db['CmContact'][_0x533e('0x18')]({'AdditionalPhones':_0x29f661},{'where':{'id':_0x2f29df['id']}})[_0x533e('0x19')](function(){_0x4a49c9(0x1);});});});});});}function addAdditionalPhone(_0x309d9c,_0x4f0457,_0x41183a,_0x4186d1,_0x1f3431){return db['CmContactHasItem'][_0x533e('0x24')]({'where':{'CmContactId':_0x309d9c,'item':_0x4f0457}})[_0x533e('0x19')](function(_0x121d65){if(_0x121d65)logger['info'](_0x533e('0x91'),_0x121d65);else{db[_0x533e('0x48')][_0x533e('0x3e')]({'CmContactId':_0x309d9c,'item':_0x4f0457,'ItemTypeId':_0x41183a,'OrderBy':_0x4186d1,'ItemClass':_0x533e('0x92'),'description':_0x1f3431});}});}function deleteCmHopperPhones(_0x27b1d4){return new Promise(function(_0xd029a1){return db[_0x533e('0x39')][_0x533e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x27b1d4}})['then'](function(_0x445aab){db[_0x533e('0x93')][_0x533e('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x533e('0x94')](_0x445aab,'id')}}});})[_0x533e('0x19')](function(){_0xd029a1(0x1);});});}function addCmHopperPhones(_0x5e9002){return new Promise(function(_0x24f87f){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5e9002}})[_0x533e('0x19')](function(_0x250bd4){var _0x37180d=[];_[_0x533e('0x94')](_0x250bd4,function(_0x5b331e){_0x37180d[_0x533e('0x60')](createCmHopperPhone(_0x5e9002,_0x5b331e['id']));});Promise[_0x533e('0x8b')](_0x37180d)[_0x533e('0x19')](function(){_0x24f87f(0x1);});});});}function createCmHopperPhone(_0x1f6f1e,_0x229a6e){return new Promise(function(_0x4dc7ae){db[_0x533e('0x48')][_0x533e('0x20')]({'raw':!![],'attributes':[_0x533e('0x95'),'OrderBy'],'where':{'CmContactId':_0x1f6f1e,'ItemClass':_0x533e('0x92')},'include':[{'model':db[_0x533e('0x69')],'attributes':[_0x533e('0x8c')],'as':_0x533e('0x6a')}],'order':[_0x533e('0x8c'),db[_0x533e('0x6b')][_0x533e('0x96')](_0x533e('0x97'))]})[_0x533e('0x19')](function(_0x187892){var _0x37e754=0x1;var _0x39a405=_['map'](_0x187892,function(_0x54e50f){_0x54e50f[_0x533e('0x98')]=_0x229a6e;_0x54e50f[_0x533e('0x79')]=_0x54e50f[_0x533e('0x95')];_0x54e50f[_0x533e('0x8c')]=_0x37e754;delete _0x54e50f[_0x533e('0x99')];_0x37e754=_0x37e754+0x1;return _0x54e50f;});return db[_0x533e('0x93')][_0x533e('0x9a')](_0x39a405,{});})[_0x533e('0x19')](function(){_0x4dc7ae(0x1);});});}function insertAdditionalPhones(_0x261330,_0x4af48e){return new Promise(function(_0x28b82e){var _0xfe041f=[];for(var _0xb247a9=0x0;_0xb247a9<_0x4af48e[_0x533e('0x28')];_0xb247a9++){var _0x4d611d=_0x4af48e[_0xb247a9];_0xfe041f[_0x533e('0x60')](parseContactItemType(_0x4d611d));}Promise[_0x533e('0x8b')](_0xfe041f)[_0x533e('0x19')](function(){var _0x5bfde2={'id':_0x261330['id'],'items':_0x4af48e};return addAdditionalPhones(_0x5bfde2)[_0x533e('0x19')](function(){return addCmHopperPhones(_0x261330['id']);});})[_0x533e('0x19')](function(){_0x28b82e(_0x261330);});});}function parseContactItemType(_0x2d1827){return new Promise(function(_0x541555){if(_0x2d1827[_0x533e('0x32')]('ItemTypeId')){_0x541555(_0x2d1827);}else{return db['ContactItemType'][_0x533e('0x24')]({'where':{'name':_0x2d1827[_0x533e('0x6a')]}})[_0x533e('0x19')](function(_0x23cb16){if(_[_0x533e('0x56')](_0x23cb16))_0x2d1827[_0x533e('0x8f')]=null;else _0x2d1827[_0x533e('0x8f')]=_0x23cb16['id'];_0x541555(_0x2d1827);});}});}exports[_0x533e('0x9b')]=function(_0x5ab203,_0x109b74){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x5ab203[_0x533e('0x25')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x533e('0x69')],'as':_0x533e('0x6a')}],'order':[[_0x533e('0x8c')],[db['sequelize']['literal']('`ItemType`.OrderBy')]]})[_0x533e('0x19')](function(_0x1eb9f0){return _0x1eb9f0;})[_0x533e('0x19')](respondWithResult(_0x109b74,null))[_0x533e('0x22')](handleError(_0x109b74,null));};exports[_0x533e('0x9c')]=function(_0x5bb0b3,_0x2e2414){return db['CmContactHasItem'][_0x533e('0x20')]({'raw':!![],'where':{'CmContactId':_0x5bb0b3[_0x533e('0x33')]['fromContactId']}})[_0x533e('0x19')](function(_0x120e88){var _0x3223d6=_[_0x533e('0x94')](_0x120e88,function(_0x30f73e){_0x30f73e['CmContactId']=_0x5bb0b3[_0x533e('0x33')]['toContactId'];return _0x30f73e;});return db['CmContactHasItem'][_0x533e('0x9a')](_0x3223d6,{});})[_0x533e('0x19')](function(){return addCmHopperPhones(_0x5bb0b3[_0x533e('0x33')]['toContactId']);})[_0x533e('0x19')](function(){return['ok'];})['then'](respondWithResult(_0x2e2414,null))[_0x533e('0x22')](handleError(_0x2e2414,null));};exports['rescheduleAdditionalPhones']=function(_0x19cf3b,_0x38beb1){var _0xac9228=[];_0xac9228[_0x533e('0x60')](createCmHopperPhone(_0x19cf3b[_0x533e('0x33')]['id'],_0x19cf3b[_0x533e('0x33')][_0x533e('0x9d')]));Promise[_0x533e('0x8b')](_0xac9228)[_0x533e('0x19')](function(){return[0x1];})[_0x533e('0x19')](respondWithResult(_0x38beb1,null));};exports[_0x533e('0x9e')]=function(_0x2ebae3,_0x5ba935){var _0x114672={'raw':![],'where':{}};var _0x3cc03d={};var _0x2279a8={'count':0x0,'rows':[]};return db[_0x533e('0x23')][_0x533e('0x7b')]({'where':{'id':_0x2ebae3[_0x533e('0x25')]['id']}})[_0x533e('0x19')](handleEntityNotFound(_0x5ba935,null))[_0x533e('0x19')](function(_0x9d5c9b){if(_0x9d5c9b){_0x3cc03d[_0x533e('0x7c')]=_[_0x533e('0x27')](db[_0x533e('0x39')][_0x533e('0x7d')]);_0x3cc03d['query']=_[_0x533e('0x27')](_0x2ebae3[_0x533e('0x21')]);_0x3cc03d[_0x533e('0x7e')]=_[_0x533e('0x7f')](_0x3cc03d['model'],_0x3cc03d[_0x533e('0x21')]);_0x114672[_0x533e('0x80')]=_['intersection'](_0x3cc03d[_0x533e('0x7c')],qs[_0x533e('0x81')](_0x2ebae3[_0x533e('0x21')][_0x533e('0x81')]));_0x114672['attributes']=_0x114672[_0x533e('0x80')][_0x533e('0x28')]?_0x114672[_0x533e('0x80')]:_0x3cc03d[_0x533e('0x7c')];if(!_0x2ebae3['query']['hasOwnProperty']('nolimit')){_0x114672[_0x533e('0x15')]=qs[_0x533e('0x15')](_0x2ebae3[_0x533e('0x21')][_0x533e('0x15')]);_0x114672[_0x533e('0x16')]=qs[_0x533e('0x16')](_0x2ebae3[_0x533e('0x21')][_0x533e('0x16')]);}_0x114672[_0x533e('0x82')]=qs[_0x533e('0x83')](_0x2ebae3[_0x533e('0x21')]['sort']);_0x114672[_0x533e('0x5e')]=qs[_0x533e('0x7e')](_[_0x533e('0x84')](_0x2ebae3[_0x533e('0x21')],_0x3cc03d[_0x533e('0x7e')]));_0x114672[_0x533e('0x5e')][_0x533e('0x9f')]=_0x9d5c9b['id'];if(_0x2ebae3[_0x533e('0x21')][_0x533e('0x85')]){_0x114672[_0x533e('0x5e')]=_['merge'](_0x114672[_0x533e('0x5e')],{'$or':_[_0x533e('0x94')](_0x114672[_0x533e('0x80')],function(_0x575795){var _0x2d3ad8={};_0x2d3ad8[_0x575795]={'$like':'%'+_0x2ebae3[_0x533e('0x21')]['filter']+'%'};return _0x2d3ad8;})});}_0x114672=_[_0x533e('0x86')]({},_0x114672,_0x2ebae3['options']);return db[_0x533e('0x39')][_0x533e('0xa0')]({'where':_0x114672[_0x533e('0x5e')]})[_0x533e('0x19')](function(_0x3edcfc){_0x2279a8[_0x533e('0xa0')]=_0x3edcfc;if(_0x2ebae3[_0x533e('0x21')][_0x533e('0xa1')]){_0x114672[_0x533e('0xa2')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x114672);})[_0x533e('0x19')](function(_0x5dd345){_0x2279a8['rows']=_0x5dd345;return _0x2279a8;});}})[_0x533e('0x19')](respondWithFilteredResult(_0x5ba935,_0x114672))[_0x533e('0x22')](handleError(_0x5ba935,null));};exports[_0x533e('0xa3')]=function(_0x5c99d4,_0x354cda){var _0x2303af={'raw':!![],'where':{}};var _0x166ce9={};var _0x41ad23={'count':0x0,'rows':[]};return db[_0x533e('0x23')][_0x533e('0x7b')]({'where':{'id':_0x5c99d4['params']['id']}})['then'](handleEntityNotFound(_0x354cda,null))[_0x533e('0x19')](function(_0x169b11){if(_0x169b11){_0x166ce9[_0x533e('0x7c')]=_[_0x533e('0x27')](db[_0x533e('0x4a')][_0x533e('0x7d')]);_0x166ce9['query']=_[_0x533e('0x27')](_0x5c99d4[_0x533e('0x21')]);_0x166ce9[_0x533e('0x7e')]=_[_0x533e('0x7f')](_0x166ce9['model'],_0x166ce9['query']);_0x2303af['attributes']=_[_0x533e('0x7f')](_0x166ce9[_0x533e('0x7c')],qs[_0x533e('0x81')](_0x5c99d4[_0x533e('0x21')]['fields']));_0x2303af[_0x533e('0x80')]=_0x2303af['attributes'][_0x533e('0x28')]?_0x2303af[_0x533e('0x80')]:_0x166ce9[_0x533e('0x7c')];if(!_0x5c99d4[_0x533e('0x21')][_0x533e('0x32')](_0x533e('0x88'))){_0x2303af['limit']=qs[_0x533e('0x15')](_0x5c99d4[_0x533e('0x21')]['limit']);_0x2303af['offset']=qs[_0x533e('0x16')](_0x5c99d4[_0x533e('0x21')][_0x533e('0x16')]);}_0x2303af[_0x533e('0x82')]=qs['sort'](_0x5c99d4['query'][_0x533e('0x83')]);_0x2303af['where']=qs['filters'](_[_0x533e('0x84')](_0x5c99d4['query'],_0x166ce9[_0x533e('0x7e')]));_0x2303af[_0x533e('0x5e')][_0x533e('0x9f')]=_0x169b11['id'];if(_0x5c99d4['query']['filter']){_0x2303af[_0x533e('0x5e')]=_[_0x533e('0x86')](_0x2303af[_0x533e('0x5e')],{'$or':_[_0x533e('0x94')](_0x2303af[_0x533e('0x80')],function(_0xe531b8){var _0x1f7c9d={};_0x1f7c9d[_0xe531b8]={'$like':'%'+_0x5c99d4[_0x533e('0x21')][_0x533e('0x85')]+'%'};return _0x1f7c9d;})});}_0x2303af=_[_0x533e('0x86')]({},_0x2303af,_0x5c99d4['options']);return db[_0x533e('0x4a')][_0x533e('0xa0')]({'where':_0x2303af['where']})[_0x533e('0x19')](function(_0x1aaaa3){_0x41ad23[_0x533e('0xa0')]=_0x1aaaa3;if(_0x5c99d4[_0x533e('0x21')][_0x533e('0xa1')]){_0x2303af[_0x533e('0xa2')]=[{'all':!![]}];}return db[_0x533e('0x4a')][_0x533e('0x20')](_0x2303af);})[_0x533e('0x19')](function(_0x288d2a){_0x41ad23[_0x533e('0xa4')]=_0x288d2a;return _0x41ad23;});}})[_0x533e('0x19')](respondWithFilteredResult(_0x354cda,_0x2303af))[_0x533e('0x22')](handleError(_0x354cda,null));};exports['getHopperFinals']=function(_0x3b8622,_0x2df3f8){var _0x5c6c35={'raw':!![],'where':{}};var _0x264b55={};var _0x976d12={'count':0x0,'rows':[]};return db[_0x533e('0x23')][_0x533e('0x7b')]({'where':{'id':_0x3b8622['params']['id']}})['then'](handleEntityNotFound(_0x2df3f8,null))['then'](function(_0x46baec){if(_0x46baec){_0x264b55[_0x533e('0x7c')]=_[_0x533e('0x27')](db[_0x533e('0x49')]['rawAttributes']);_0x264b55[_0x533e('0x21')]=_[_0x533e('0x27')](_0x3b8622['query']);_0x264b55[_0x533e('0x7e')]=_[_0x533e('0x7f')](_0x264b55[_0x533e('0x7c')],_0x264b55[_0x533e('0x21')]);_0x5c6c35[_0x533e('0x80')]=_['intersection'](_0x264b55['model'],qs[_0x533e('0x81')](_0x3b8622[_0x533e('0x21')][_0x533e('0x81')]));_0x5c6c35[_0x533e('0x80')]=_0x5c6c35[_0x533e('0x80')][_0x533e('0x28')]?_0x5c6c35[_0x533e('0x80')]:_0x264b55[_0x533e('0x7c')];if(!_0x3b8622['query']['hasOwnProperty'](_0x533e('0x88'))){_0x5c6c35[_0x533e('0x15')]=qs[_0x533e('0x15')](_0x3b8622['query'][_0x533e('0x15')]);_0x5c6c35[_0x533e('0x16')]=qs['offset'](_0x3b8622['query'][_0x533e('0x16')]);}_0x5c6c35[_0x533e('0x82')]=qs[_0x533e('0x83')](_0x3b8622[_0x533e('0x21')][_0x533e('0x83')]);_0x5c6c35[_0x533e('0x5e')]=qs['filters'](_[_0x533e('0x84')](_0x3b8622[_0x533e('0x21')],_0x264b55[_0x533e('0x7e')]));_0x5c6c35[_0x533e('0x5e')][_0x533e('0x9f')]=_0x46baec['id'];if(_0x3b8622[_0x533e('0x21')][_0x533e('0x85')]){_0x5c6c35[_0x533e('0x5e')]=_['merge'](_0x5c6c35['where'],{'$or':_['map'](_0x5c6c35[_0x533e('0x80')],function(_0x35959a){var _0x464b89={};_0x464b89[_0x35959a]={'$like':'%'+_0x3b8622[_0x533e('0x21')][_0x533e('0x85')]+'%'};return _0x464b89;})});}_0x5c6c35=_[_0x533e('0x86')]({},_0x5c6c35,_0x3b8622[_0x533e('0x87')]);return db[_0x533e('0x49')][_0x533e('0xa0')]({'where':_0x5c6c35[_0x533e('0x5e')]})[_0x533e('0x19')](function(_0x469492){_0x976d12['count']=_0x469492;if(_0x3b8622[_0x533e('0x21')][_0x533e('0xa1')]){_0x5c6c35[_0x533e('0xa2')]=[{'all':!![]}];}return db[_0x533e('0x49')]['findAll'](_0x5c6c35);})[_0x533e('0x19')](function(_0xa2d7b){_0x976d12[_0x533e('0xa4')]=_0xa2d7b;return _0x976d12;});}})[_0x533e('0x19')](respondWithFilteredResult(_0x2df3f8,_0x5c6c35))[_0x533e('0x22')](handleError(_0x2df3f8,null));};exports[_0x533e('0xa5')]=function(_0x305303,_0x35b174){var _0x1809ea={'raw':!![],'where':{}};var _0x4510f3={};var _0x573815={'count':0x0,'rows':[]};return db['CmContact'][_0x533e('0x7b')]({'where':{'id':_0x305303[_0x533e('0x25')]['id']}})[_0x533e('0x19')](handleEntityNotFound(_0x35b174,null))[_0x533e('0x19')](function(_0x566b4d){if(_0x566b4d){_0x4510f3[_0x533e('0x7c')]=_[_0x533e('0x27')](db[_0x533e('0x52')][_0x533e('0x7d')]);_0x4510f3['query']=_['keys'](_0x305303[_0x533e('0x21')]);_0x4510f3[_0x533e('0x7e')]=_[_0x533e('0x7f')](_0x4510f3[_0x533e('0x7c')],_0x4510f3[_0x533e('0x21')]);_0x1809ea['attributes']=_['intersection'](_0x4510f3[_0x533e('0x7c')],qs['fields'](_0x305303[_0x533e('0x21')][_0x533e('0x81')]));_0x1809ea[_0x533e('0x80')]=_0x1809ea[_0x533e('0x80')][_0x533e('0x28')]?_0x1809ea[_0x533e('0x80')]:_0x4510f3['model'];if(!_0x305303[_0x533e('0x21')][_0x533e('0x32')](_0x533e('0x88'))){_0x1809ea['limit']=qs[_0x533e('0x15')](_0x305303['query'][_0x533e('0x15')]);_0x1809ea['offset']=qs[_0x533e('0x16')](_0x305303['query'][_0x533e('0x16')]);}_0x1809ea[_0x533e('0x82')]=qs['sort'](_0x305303[_0x533e('0x21')][_0x533e('0x83')]);_0x1809ea[_0x533e('0x5e')]=qs['filters'](_[_0x533e('0x84')](_0x305303[_0x533e('0x21')],_0x4510f3[_0x533e('0x7e')]));_0x1809ea[_0x533e('0x5e')]['ContactId']=_0x566b4d['id'];if(_0x305303[_0x533e('0x21')]['filter']){_0x1809ea[_0x533e('0x5e')]=_[_0x533e('0x86')](_0x1809ea['where'],{'$or':_[_0x533e('0x94')](_0x1809ea['attributes'],function(_0x1405a6){var _0xb38fd0={};_0xb38fd0[_0x1405a6]={'$like':'%'+_0x305303[_0x533e('0x21')][_0x533e('0x85')]+'%'};return _0xb38fd0;})});}_0x1809ea=_[_0x533e('0x86')]({},_0x1809ea,_0x305303[_0x533e('0x87')]);return db['JscriptySessionReport'][_0x533e('0xa0')]({'where':_0x1809ea[_0x533e('0x5e')]})[_0x533e('0x19')](function(_0x40e3e8){_0x573815[_0x533e('0xa0')]=_0x40e3e8;if(_0x305303[_0x533e('0x21')][_0x533e('0xa1')]){_0x1809ea[_0x533e('0xa2')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1809ea);})[_0x533e('0x19')](function(_0x5161c4){_0x573815['rows']=_0x5161c4;return _0x573815;});}})[_0x533e('0x19')](respondWithFilteredResult(_0x35b174,_0x1809ea))[_0x533e('0x22')](handleError(_0x35b174,null));};exports[_0x533e('0xa6')]=function(_0x5adbd2,_0x2e036f){try{if(!_0x5adbd2[_0x533e('0x33')][_0x533e('0x61')]){throw new Error(_0x533e('0xa7'));}if(!_0x5adbd2['body'][_0x533e('0xa8')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x5adbd2[_0x533e('0x33')][_0x533e('0xa9')]){throw new Error(_0x533e('0xaa'));}if(!_0x5adbd2['body']['socket_timestamp']){throw new Error(_0x533e('0xab'));}var _0x47b825=_0x5adbd2['body'][_0x533e('0xa8')][_0x533e('0xac')](',');var _0x134a98=_0x5adbd2[_0x533e('0x33')][_0x533e('0xa9')][_0x533e('0xac')](',');if(!_0x47b825[_0x533e('0x28')]||!_0x134a98[_0x533e('0x28')]||_0x47b825['length']!==_0x134a98[_0x533e('0x28')]){throw new Error(_0x533e('0xad'));}_0x5adbd2[_0x533e('0x33')][_0x533e('0x81')]=_[_0x533e('0xae')](_0x47b825,_0x134a98);if(!_0x5adbd2['body'][_0x533e('0x81')]['phone']){throw new Error(_0x533e('0xaf'));}if(!_0x5adbd2[_0x533e('0x33')][_0x533e('0x81')][_0x533e('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x50abdb=path[_0x533e('0x38')](config[_0x533e('0xb1')],_0x533e('0xb2'),_0x5adbd2[_0x533e('0xb3')][_0x533e('0xb4')]);fs[_0x533e('0xb5')](_0x50abdb,parseInt('0777',0x8));var _0x36f306=require('child_process')[_0x533e('0xb6')](path[_0x533e('0x38')](__dirname,_0x533e('0xb7')),[_0x50abdb,_0x5adbd2['body'][_0x533e('0xa8')],_0x5adbd2[_0x533e('0x33')][_0x533e('0xa9')],_0x5adbd2[_0x533e('0x33')][_0x533e('0x61')],_0x5adbd2[_0x533e('0x33')]['CompanyId'],_0x5adbd2['body'][_0x533e('0x5d')],_0x5adbd2[_0x533e('0x33')][_0x533e('0xb8')]]);return _0x2e036f[_0x533e('0x12')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x36f306[_0x533e('0xb9')]});}catch(_0x14d3a0){return _0x2e036f[_0x533e('0x12')](0x1f4)[_0x533e('0xba')](_0x14d3a0);}};exports[_0x533e('0xbb')]=function(_0x24da0f,_0x5e8928){var _0x57aae4=fs['createReadStream'](_0x24da0f[_0x533e('0xb3')][_0x533e('0x1')]);Papa[_0x533e('0xbc')](_0x57aae4,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4afdfa){return _0x5e8928[_0x533e('0x12')](0xc8)[_0x533e('0x13')]({'file':_0x24da0f[_0x533e('0xb3')],'fields':_0x4afdfa[_0x533e('0xbd')][_0x533e('0x81')]});}});};exports[_0x533e('0xbe')]=function(_0x1cb343,_0x3d70ae){return db[_0x533e('0xbf')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x533e('0x19')](function(_0x47a63b){var _0x1a1023=![];if(!_0x1cb343[_0x533e('0x33')][_0x533e('0x61')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1cb343[_0x533e('0x33')][_0x533e('0xc0')][_0x533e('0x79')]){throw new Error(_0x533e('0xaf'));}if(!_0x1cb343[_0x533e('0x33')][_0x533e('0xc0')][_0x533e('0xb0')]){throw new Error(_0x533e('0xc1'));}if(!_0x1cb343[_0x533e('0x33')][_0x533e('0xb8')]){throw new Error(_0x533e('0xab'));}var _0x424b58=require(_0x533e('0xc2'))[_0x533e('0xb6')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x1cb343[_0x533e('0x25')]['id'],JSON[_0x533e('0xc3')](_0x1cb343[_0x533e('0x33')]),JSON['stringify'](_0x47a63b)]);_0x424b58['on'](_0x533e('0xc4'),function(){_0x1a1023=!![];return _0x3d70ae[_0x533e('0x12')](0xc8)[_0x533e('0x13')]({'message':_0x533e('0xc5'),'pid':_0x424b58[_0x533e('0xb9')]});});_0x424b58['on']('exit',function(_0x53559d){if(_0x53559d&&!_0x1a1023){return _0x3d70ae[_0x533e('0x12')](0x1f4)[_0x533e('0x13')]({'message':_0x533e('0xc6'),'pid':_0x424b58[_0x533e('0xb9')]});}});})[_0x533e('0x22')](handleError(_0x3d70ae,null));};exports[_0x533e('0xc7')]=function(_0x43f216,_0x8f52da){return db[_0x533e('0xbf')][_0x533e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x533e('0xc8')}})['then'](function(_0x281b35){var _0x100246=![];if(!_0x43f216[_0x533e('0x33')]['ListId']){throw new Error(_0x533e('0xa7'));}if(!_0x43f216['body'][_0x533e('0xc0')]['phone']){throw new Error(_0x533e('0xaf'));}if(!_0x43f216[_0x533e('0x33')][_0x533e('0xc0')][_0x533e('0xb0')]){throw new Error(_0x533e('0xc1'));}if(!_0x43f216[_0x533e('0x33')][_0x533e('0xb8')]){throw new Error(_0x533e('0xab'));}var _0x11f6ca=require(_0x533e('0xc2'))['fork'](path[_0x533e('0x38')](__dirname,_0x533e('0xc9')),[_0x43f216[_0x533e('0x25')]['id'],JSON['stringify'](_0x43f216['body']),JSON['stringify'](_0x281b35)]);_0x11f6ca['on'](_0x533e('0xc4'),function(){_0x100246=!![];return _0x8f52da[_0x533e('0x12')](0xc8)[_0x533e('0x13')]({'message':_0x533e('0xc5'),'pid':_0x11f6ca[_0x533e('0xb9')]});});_0x11f6ca['on'](_0x533e('0xca'),function(_0x2ff30d){if(_0x2ff30d&&!_0x100246){return _0x8f52da[_0x533e('0x12')](0x1f4)[_0x533e('0x13')]({'message':_0x533e('0xc6'),'pid':_0x11f6ca[_0x533e('0xb9')]});}});})[_0x533e('0x22')](handleError(_0x8f52da,null));};exports[_0x533e('0xcb')]=function(_0x53fdbf,_0x5e5fb8){var _0x433fdc=[_0x533e('0xcc'),'chat','sms',_0x533e('0xcd'),_0x533e('0xce'),_0x533e('0xcf'),_0x533e('0xd0')];var _0x2af264={'offset':0x0,'order':qs[_0x533e('0x83')](_0x533e('0xd1'))},_0x1d67ab={'count':0x0,'rows':[]};Promise[_0x533e('0xd2')]()['then'](function(){if(_0x53fdbf[_0x533e('0x21')][_0x533e('0xd3')]){if(!_[_0x533e('0xd4')](_0x433fdc,_0x53fdbf[_0x533e('0x21')][_0x533e('0xd3')][_0x533e('0xd5')]())){throw new Error(_0x533e('0xd6'));}_0x433fdc=[_0x53fdbf[_0x533e('0x21')]['channel'][_0x533e('0xd5')]()];}if(_0x53fdbf[_0x533e('0x21')][_0x533e('0xd7')]){try{var _0xce4122=JSON[_0x533e('0xbc')](_0x53fdbf[_0x533e('0x21')][_0x533e('0xd7')]);if(!moment(_0xce4122[_0x533e('0x34')])[_0x533e('0xd8')]()){throw new Error(_0x533e('0xd9'));}if(!moment(_0xce4122['to'])['isValid']()){throw new Error(_0x533e('0xda'));}}catch(_0x2ca413){throw new Error(_0x533e('0xdb'));}}if(!_0x53fdbf[_0x533e('0x21')][_0x533e('0x32')]('nolimit')){_0x2af264[_0x533e('0x15')]=qs[_0x533e('0x15')](_0x53fdbf['query'][_0x533e('0x15')]||0xa);_0x2af264['offset']=qs[_0x533e('0x16')](_0x53fdbf['query'][_0x533e('0x16')]);}var _0x183697=_0x433fdc[_0x533e('0x94')](function(_0x5c864a){if(_0x5c864a===_0x533e('0xd0')){var _0x43a39a={'attributes':['id',_0x533e('0xdc'),_0x533e('0xdd'),_0x533e('0xde'),'destination',_0x533e('0xdf'),_0x533e('0xe0'),_0x533e('0xe1'),'duration',_0x533e('0xe2'),_0x533e('0xe3'),_0x533e('0xe4'),_0x533e('0xe5'),_0x533e('0xe6'),_0x533e('0xe7')],'where':{'ContactId':_0x53fdbf['params']['id']},'include':[{'model':db[_0x533e('0xbf')],'as':_0x533e('0xbf'),'attributes':['id','name',_0x533e('0xe8'),'alias']}],'order':[[_0x533e('0xe3'),_0x533e('0xe9')]]};if(_0x53fdbf[_0x533e('0x21')][_0x533e('0xd7')]){_0x43a39a['where']['createdAt']={'$gte':_0xce4122['from'],'$lte':_0xce4122['to']};}return db[_0x533e('0x4c')][_0x533e('0xea')](_0x43a39a)['then'](function(_0x164c86){_0x1d67ab[_0x533e('0xa0')]+=_0x164c86[_0x533e('0xa0')];return _[_0x533e('0x94')](_0x164c86[_0x533e('0xa4')],function(_0x17aa39){var _0x2f1f10=_0x17aa39[_0x533e('0x35')]({'plain':!![]});_0x2f1f10[_0x533e('0xd3')]=_0x5c864a;if(_0x2f1f10[_0x533e('0xbf')]){_0x2f1f10[_0x533e('0xbf')]={'id':_0x2f1f10['User']['id'],'name':_0x2f1f10[_0x533e('0xbf')][_0x533e('0x1d')],'fullname':_0x2f1f10[_0x533e('0xbf')][_0x533e('0xe8')],'alias':_0x2f1f10[_0x533e('0xbf')][_0x533e('0xeb')]};}return _0x2f1f10;});});}else{var _0x50ec11=_[_0x533e('0xec')](_0x5c864a)+(_0x5c864a===_0x533e('0xed')?_0x533e('0xee'):_0x533e('0xef'));var _0x3f733c={'attributes':['id',_0x533e('0xf0'),_0x533e('0xf1'),_0x533e('0xe3'),_0x533e('0xe2'),_0x533e('0xf2'),_0x533e('0xf3'),'thirdDisposition',_0x533e('0xe7'),_0x50ec11+'Id'],'where':{'ContactId':_0x53fdbf[_0x533e('0x25')]['id']},'include':[{'model':db[_0x50ec11],'as':'Account','attributes':['id',_0x533e('0x1d'),'key']},{'model':db['User'],'as':_0x533e('0xf4'),'attributes':['id','name','fullname']},{'model':db['Tag'],'as':_0x533e('0x65'),'attributes':['id','name',_0x533e('0x66')],'through':{'attributes':[]}}],'order':[[_0x533e('0xe3'),_0x533e('0xe9')]]};if(_0x53fdbf[_0x533e('0x21')][_0x533e('0xd7')]){_0x3f733c[_0x533e('0x5e')]['createdAt']={'$gte':_0xce4122[_0x533e('0x34')],'$lte':_0xce4122['to']};}switch(_0x5c864a){case _0x533e('0xed'):_0x3f733c[_0x533e('0x80')]['push'](_0x533e('0xf5'),_0x533e('0xf6'),_0x533e('0xf7'),'deviceModel',_0x533e('0xf8'),_0x533e('0xf9'),_0x533e('0xfa'),'ratingValue',_0x533e('0xfb'));break;case _0x533e('0xcc'):_0x3f733c[_0x533e('0x80')][_0x533e('0x60')]('subject',_0x533e('0xfc'));break;case _0x533e('0xcd'):_0x3f733c[_0x533e('0x80')][_0x533e('0x60')]('externalUrl',_0x533e('0xfd'));break;}return db[_[_0x533e('0xec')](_0x5c864a)+_0x533e('0xfe')][_0x533e('0xea')](_0x3f733c)[_0x533e('0x19')](function(_0x4c7ef7){_0x1d67ab[_0x533e('0xa0')]+=_0x4c7ef7[_0x533e('0xa0')];return _[_0x533e('0x94')](_0x4c7ef7['rows'],function(_0x5d4830){var _0x269ab6=_0x5d4830[_0x533e('0x35')]({'plain':!![]});_0x269ab6[_0x533e('0xd3')]=_0x5c864a;if(_0x269ab6[_0x533e('0xf4')]){_0x269ab6[_0x533e('0xf4')]={'id':_0x269ab6['Owner']['id'],'name':_0x269ab6['Owner'][_0x533e('0x1d')],'fullname':_0x269ab6['Owner']['fullname']};}return _0x269ab6;});});}});return Promise[_0x533e('0x8b')](_0x183697);})[_0x533e('0x19')](function(_0x4ee3a8){return _(_0x4ee3a8)[_0x533e('0xff')]()[_0x533e('0x100')]('createdAt')['reverse']()[_0x533e('0x101')]();})[_0x533e('0x19')](function(_0x545720){_0x1d67ab['rows']=_0x2af264[_0x533e('0x15')]?_0x545720[_0x533e('0x102')](_0x2af264['offset'],_0x2af264['offset']+_0x2af264[_0x533e('0x15')]):_0x545720;return _0x1d67ab;})[_0x533e('0x19')](respondWithFilteredResult(_0x5e5fb8,_0x2af264))[_0x533e('0x22')](handleError(_0x5e5fb8,null));}; \ No newline at end of file +var _0x1475=['offset','undefined','count','limit','set','update','destroy','sendStatus','stack','name','index','getOptions','findAll','query','user','then','catch','CmContact','find','params','describe','tags','keys','length','cf_','columnName','displayName','analytics','CmCustomField','alias','custom','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','body','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','MailInteraction','MailMessage','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','create','dialTimezone','isNil','timezones','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','hasOwnProperty','push','contact','all','Tag','Tags','color','tag','ContactItemType','ItemType','sequelize','Phones.OrderBy','omit','map','format','cf_%d','utcOffset','pickBy','startsWith','table','cm_contacts','setFields','toParam','phone','getTags','findOne','model','rawAttributes','filters','intersection','fields','attributes','order','sort','pick','merge','filter','options','setTags','ids','CmContactHasItem','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','binding_keys','split','zipObject','No\x20phone\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','parse','import','User','agent','binding','firstName','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','stringify','message','start\x20child\x20process\x20correctly!','importUpdates','../../components/import/cm/csvUpdates','exit','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','type','source','destination','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','path','squel','papaparse','ioredis','../../components/contacts','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','json'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x1475,0xf0));var _0x5147=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x1475[_0x3c4062];return _0x3f5bf3;};'use strict';var moment=require(_0x5147('0x0'));var BPromise=require(_0x5147('0x1'));var util=require('util');var path=require(_0x5147('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5147('0x3'));var Papa=require(_0x5147('0x4'));var Redis=require(_0x5147('0x5'));var contacts=require(_0x5147('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x5147('0x7'))('api');var config=require(_0x5147('0x8'));var shared=require(_0x5147('0x9'));var db=require(_0x5147('0xa'))['db'];config[_0x5147('0xb')]=_[_0x5147('0xc')](config[_0x5147('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5147('0xd'))(new Redis(config['redis']));require(_0x5147('0xe'))[_0x5147('0xf')](socket);function respondWithResult(_0x27e5fb,_0x4c7ec5){_0x4c7ec5=_0x4c7ec5||0xc8;return function(_0x4f69e8){if(_0x4f69e8){return _0x27e5fb[_0x5147('0x10')](_0x4c7ec5)[_0x5147('0x11')](_0x4f69e8);}};}function respondWithFilteredResult(_0xe7c1d8,_0x3e9cf5){return function(_0x5bfc63){if(_0x5bfc63){var _0x3809b5=typeof _0x3e9cf5[_0x5147('0x12')]===_0x5147('0x13')&&typeof _0x3e9cf5['limit']===_0x5147('0x13');var _0x11d154=_0x5bfc63[_0x5147('0x14')];var _0xbb4189=_0x3809b5?0x0:_0x3e9cf5[_0x5147('0x12')];var _0xfb8184=_0x3809b5?_0x5bfc63['count']:_0x3e9cf5[_0x5147('0x12')]+_0x3e9cf5[_0x5147('0x15')];var _0x5a7544;if(_0xfb8184>=_0x11d154){_0xfb8184=_0x11d154;_0x5a7544=0xc8;}else{_0x5a7544=0xce;}_0xe7c1d8[_0x5147('0x10')](_0x5a7544);return _0xe7c1d8[_0x5147('0x16')]('Content-Range',_0xbb4189+'-'+_0xfb8184+'/'+_0x11d154)[_0x5147('0x11')](_0x5bfc63);}return null;};}function saveUpdates(_0x5ab30e){return function(_0x4b1762){if(_0x4b1762){return _0x4b1762[_0x5147('0x17')](_0x5ab30e)['then'](function(_0x2a2a5c){return _0x2a2a5c;});}return null;};}function removeEntity(_0x6925de){return function(_0x349181){if(_0x349181){return _0x349181[_0x5147('0x18')]()['then'](function(){_0x6925de[_0x5147('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x907b6f){return function(_0x433598){if(!_0x433598){_0x907b6f[_0x5147('0x19')](0x194);}return _0x433598;};}function handleError(_0x546d80,_0x38f89c){_0x38f89c=_0x38f89c||0x1f4;return function(_0x3e928e){logger['error'](_0x3e928e[_0x5147('0x1a')]);if(_0x3e928e[_0x5147('0x1b')]){delete _0x3e928e['name'];}_0x546d80[_0x5147('0x10')](_0x38f89c)['send'](_0x3e928e);};}exports[_0x5147('0x1c')]=function(_0x36c636,_0x494728){var _0x357b68={};return contacts['describe']()['then'](function(_0x51140d){_0x357b68=qs[_0x5147('0x1d')](_0x51140d,_0x36c636);return contacts[_0x5147('0x1e')](_0x36c636[_0x5147('0x1f')],_0x36c636[_0x5147('0x20')],_0x357b68,_0x51140d);})[_0x5147('0x21')](respondWithFilteredResult(_0x494728,_0x357b68))[_0x5147('0x22')](handleError(_0x494728,null));};exports[_0x5147('0x18')]=function(_0x1d4c4f,_0x151be0){return db[_0x5147('0x23')][_0x5147('0x24')]({'where':{'id':_0x1d4c4f[_0x5147('0x25')]['id']}})[_0x5147('0x21')](handleEntityNotFound(_0x151be0,null))['then'](removeEntity(_0x151be0,null))[_0x5147('0x22')](handleError(_0x151be0,null));};exports['describe']=function(_0x4dbc25,_0x469a5c){return db[_0x5147('0x23')][_0x5147('0x26')]()[_0x5147('0x21')](function(_0x110b6f){delete _0x110b6f[_0x5147('0x27')];for(var _0x1a772f=0x0;_0x1a772f0x0){return new Promise(function(_0x48263b){var _0x593975=[];for(var _0x5137d2=0x0;_0x5137d2<_0x368273[_0x5147('0x29')];_0x5137d2++){_0x593975[_0x5147('0x5d')](insertAdditionalPhones(_0x368273[_0x5137d2][_0x5147('0x5e')],_0x368273[_0x5137d2][_0x5147('0x53')]));}Promise[_0x5147('0x5f')](_0x593975)[_0x5147('0x21')](function(){_0x48263b(0x1);});})[_0x5147('0x21')](function(){return{'success':_0x8b3975,'failure':_0x42af47,'duplicates':_0x49bb30};});}else{return{'success':_0x8b3975,'failure':_0x42af47,'duplicates':_0x49bb30};}}})[_0x5147('0x21')](respondWithResult(_0x45e0e3,0xc9))[_0x5147('0x22')](handleError(_0x45e0e3,null));};exports['show']=function(_0xc9a3bb,_0x3c12a2){var _0x5cda11;return db[_0x5147('0x23')][_0x5147('0x26')]()['then'](function(_0x587141){return db[_0x5147('0x23')][_0x5147('0x24')]({'where':{'id':_0xc9a3bb[_0x5147('0x25')]['id']},'include':[{'model':db[_0x5147('0x60')],'as':_0x5147('0x61'),'attributes':['id','name',_0x5147('0x62')],'required':_0xc9a3bb[_0x5147('0x1f')][_0x5147('0x63')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0xc9a3bb['params']['id']},'required':![],'include':[{'model':db[_0x5147('0x64')],'as':_0x5147('0x65')}]}],'order':[db[_0x5147('0x66')]['literal'](_0x5147('0x67'))],'attributes':_['keys'](_0x587141)});})[_0x5147('0x21')](function(_0x2e341d){if(!_['isNil'](_0x2e341d)){_0x5cda11=_0x2e341d['get']({'plain':!![]});var _0x58fbf5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2e341d&&_0x2e341d[_0x5147('0x59')]){if(_0x2e341d[_0x5147('0x59')]){_0x58fbf5[_0x5147('0x57')]['$and'][_0x5147('0x5d')]({'ListId':{'$ne':_0x2e341d[_0x5147('0x59')]}});}}return db[_0x5147('0x2e')][_0x5147('0x1e')](_0x58fbf5);}})[_0x5147('0x21')](function(_0x4bda7e){if(!_[_0x5147('0x51')](_0x4bda7e)){return _[_0x5147('0x68')](_0x5cda11,_[_0x5147('0x69')](_0x4bda7e,function(_0x292f09){return util[_0x5147('0x6a')](_0x5147('0x6b'),_0x292f09['id']);}));}})[_0x5147('0x21')](handleEntityNotFound(_0x3c12a2,null))[_0x5147('0x21')](respondWithResult(_0x3c12a2,null))[_0x5147('0x22')](handleError(_0x3c12a2,null));};exports[_0x5147('0x17')]=function(_0xff918a,_0x9e01a){var _0x5f2519;if(_0xff918a[_0x5147('0x34')]['id']){delete _0xff918a[_0x5147('0x34')]['id'];}if(!_[_0x5147('0x51')](_0xff918a[_0x5147('0x34')][_0x5147('0x50')])){var _0x26af21=_0xff918a[_0x5147('0x34')][_0x5147('0x50')];if(!_['isNil'](shared[_0x5147('0x52')][_0x26af21]))_0xff918a[_0x5147('0x34')][_0x5147('0x6c')]=shared['timezones'][_0x26af21][_0x5147('0x6c')];}return db[_0x5147('0x23')]['find']({'where':{'id':_0xff918a[_0x5147('0x25')]['id']}})[_0x5147('0x21')](handleEntityNotFound(_0x9e01a,null))[_0x5147('0x21')](saveUpdates(_0xff918a['body'],null))[_0x5147('0x21')](function(_0x38b199){_0x5f2519=_0x38b199;var _0x1e063b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x38b199&&_0x38b199[_0x5147('0x59')]){if(_0x38b199[_0x5147('0x59')]){_0x1e063b['where']['$and'][_0x5147('0x5d')]({'ListId':{'$ne':_0x38b199[_0x5147('0x59')]}});}}return db[_0x5147('0x2e')][_0x5147('0x1e')](_0x1e063b);})[_0x5147('0x21')](function(_0x31fadb){if(_0x31fadb){return _[_0x5147('0x68')](_[_0x5147('0x6d')](_0xff918a[_0x5147('0x34')],function(_0x11916d,_0x20c7ff){return _[_0x5147('0x6e')](_0x20c7ff,'cf_');}),_['map'](_0x31fadb,function(_0x484597){return util['format']('cf_%d',_0x484597['id']);}));}})['then'](function(_0x2766ca){if(_0x2766ca&&!_['isEmpty'](_0x2766ca)){var _0x5010db=squel['update']()[_0x5147('0x6f')](_0x5147('0x70'))[_0x5147('0x71')](_0x2766ca)[_0x5147('0x57')]('id\x20=\x20?',_0xff918a[_0x5147('0x25')]['id'])[_0x5147('0x72')]();return db[_0x5147('0x66')][_0x5147('0x1f')](_0x5010db['text'],{'replacements':_0x5010db[_0x5147('0x31')]});}})[_0x5147('0x21')](function(){if(_0xff918a[_0x5147('0x34')][_0x5147('0x73')]&&_0x5f2519){return db[_0x5147('0x3a')][_0x5147('0x17')]({'phone':_0xff918a[_0x5147('0x34')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5f2519['id']}});}})[_0x5147('0x21')](function(){return _0x5f2519;})['then'](respondWithResult(_0x9e01a,null))['catch'](handleError(_0x9e01a,null));};exports[_0x5147('0x74')]=function(_0x58a5cd,_0x531e20){var _0x9c81a7={};var _0x1395d5={};var _0x199a59;var _0x171078;return db['CmContact'][_0x5147('0x75')]({'where':{'id':_0x58a5cd['params']['id']}})[_0x5147('0x21')](handleEntityNotFound(_0x531e20,null))[_0x5147('0x21')](function(_0x149524){if(_0x149524){_0x199a59=_0x149524;_0x1395d5[_0x5147('0x76')]=_[_0x5147('0x28')](db[_0x5147('0x60')][_0x5147('0x77')]);_0x1395d5[_0x5147('0x1f')]=_[_0x5147('0x28')](_0x58a5cd[_0x5147('0x1f')]);_0x1395d5[_0x5147('0x78')]=_[_0x5147('0x79')](_0x1395d5[_0x5147('0x76')],_0x1395d5[_0x5147('0x1f')]);_0x9c81a7['attributes']=_['intersection'](_0x1395d5[_0x5147('0x76')],qs[_0x5147('0x7a')](_0x58a5cd[_0x5147('0x1f')]['fields']));_0x9c81a7[_0x5147('0x7b')]=_0x9c81a7[_0x5147('0x7b')][_0x5147('0x29')]?_0x9c81a7[_0x5147('0x7b')]:_0x1395d5[_0x5147('0x76')];_0x9c81a7[_0x5147('0x7c')]=qs['sort'](_0x58a5cd[_0x5147('0x1f')][_0x5147('0x7d')]);_0x9c81a7[_0x5147('0x57')]=qs[_0x5147('0x78')](_[_0x5147('0x7e')](_0x58a5cd[_0x5147('0x1f')],_0x1395d5[_0x5147('0x78')]));if(_0x58a5cd[_0x5147('0x1f')]['filter']){_0x9c81a7['where']=_[_0x5147('0x7f')](_0x9c81a7[_0x5147('0x57')],{'$or':_['map'](_0x9c81a7[_0x5147('0x7b')],function(_0x33e1d){var _0x3bafff={};_0x3bafff[_0x33e1d]={'$like':'%'+_0x58a5cd['query'][_0x5147('0x80')]+'%'};return _0x3bafff;})});}_0x9c81a7=_[_0x5147('0x7f')]({},_0x9c81a7,_0x58a5cd[_0x5147('0x81')]);return _0x199a59[_0x5147('0x74')](_0x9c81a7);}})[_0x5147('0x21')](function(_0x1f9a9a){if(_0x1f9a9a){_0x171078=_0x1f9a9a[_0x5147('0x29')];if(!_0x58a5cd[_0x5147('0x1f')][_0x5147('0x5c')]('nolimit')){_0x9c81a7[_0x5147('0x15')]=qs[_0x5147('0x15')](_0x58a5cd[_0x5147('0x1f')][_0x5147('0x15')]);_0x9c81a7[_0x5147('0x12')]=qs[_0x5147('0x12')](_0x58a5cd[_0x5147('0x1f')][_0x5147('0x12')]);}return _0x199a59[_0x5147('0x74')](_0x9c81a7);}})[_0x5147('0x21')](function(_0x3fabba){if(_0x3fabba){return _0x3fabba?{'count':_0x171078,'rows':_0x3fabba}:null;}})['then'](respondWithResult(_0x531e20,null))['catch'](handleError(_0x531e20,null));};exports[_0x5147('0x82')]=function(_0x2941f7,_0x18edd9){if(_0x2941f7[_0x5147('0x34')]['id']){delete _0x2941f7[_0x5147('0x34')]['id'];}return db[_0x5147('0x23')][_0x5147('0x75')]({'where':{'id':_0x2941f7[_0x5147('0x25')]['id']}})['then'](handleEntityNotFound(_0x18edd9,null))['then'](function(_0x1ecfd8){if(_0x1ecfd8){return _0x1ecfd8['setTags'](_0x2941f7['body'][_0x5147('0x83')]||[]);}return null;})['then'](respondWithResult(_0x18edd9,null))[_0x5147('0x22')](handleError(_0x18edd9,null));};exports['setAdditionalPhones']=function(_0x1c374f,_0x1926af){var _0x213526=[];_0x213526[_0x5147('0x5d')](addAdditionalPhones(_0x1c374f[_0x5147('0x34')]));Promise[_0x5147('0x5f')](_0x213526)[_0x5147('0x21')](function(){_0x213526=[];_0x213526['push'](deleteCmHopperPhones(_0x1c374f[_0x5147('0x34')]['id']));_0x213526[_0x5147('0x5d')](addCmHopperPhones(_0x1c374f[_0x5147('0x34')]['id']));Promise['all'](_0x213526)[_0x5147('0x21')](function(){return[0x1];})['then'](respondWithResult(_0x1926af,null));});};function addAdditionalPhones(_0x32fbba){var _0x5872ae;return new Promise(function(_0x425112){return db[_0x5147('0x84')][_0x5147('0x18')]({'where':{'CmContactId':_0x32fbba['id']}})['then'](function(){db[_0x5147('0x64')]['findAll']({'raw':!![],'attributes':['id',_0x5147('0x85')]})['then'](function(_0x1b2761){var _0x399a24=[];for(var _0x5a771e=0x0;_0x5a771e<_0x32fbba[_0x5147('0x86')]['length'];_0x5a771e++){var _0x3ec04a=_0x32fbba[_0x5147('0x87')]?_[_0x5147('0x51')](_0x32fbba['item_types'][_0x5a771e])?'':_0x32fbba['item_types'][_0x5a771e]:_0x32fbba[_0x5147('0x86')][_0x5a771e]['ItemTypeId']?_0x32fbba[_0x5147('0x86')][_0x5a771e][_0x5147('0x88')]:'';var _0x34859f=_[_0x5147('0x51')](_0x32fbba['items'][_0x5a771e][_0x5147('0x89')])?'':_0x32fbba[_0x5147('0x86')][_0x5a771e][_0x5147('0x89')];var _0x3eb4ba=_0x3ec04a+':'+_0x32fbba['items'][_0x5a771e][_0x5147('0x73')]+'§'+_0x34859f;if(_[_0x5147('0x51')](_0x5872ae))_0x5872ae=_0x3eb4ba;else _0x5872ae+=';'+_0x3eb4ba;var _0x263377=null;var _0x46a5bd=null;if(_0x32fbba[_0x5147('0x87')]){if(!_['isNil'](_0x32fbba['item_types'][_0x5a771e])){_0x46a5bd=_[_0x5147('0x24')](_0x1b2761,function(_0x504236){return _0x504236['id']===_0x32fbba[_0x5147('0x87')][_0x5a771e];});if(!_['isNil'](_0x46a5bd)){_0x263377=_0x46a5bd['OrderBy'];}}}else{if(!_['isNil'](_0x32fbba['items'][_0x5a771e])){_0x46a5bd=_[_0x5147('0x24')](_0x1b2761,function(_0x283796){return _0x283796['id']===_0x32fbba[_0x5147('0x86')][_0x5a771e][_0x5147('0x88')];});if(!_[_0x5147('0x51')](_0x46a5bd)){_0x263377=_0x5a771e;}}}if(_[_0x5147('0x51')](_0x263377)){_0x263377=0x64;}_0x399a24[_0x5147('0x5d')](addAdditionalPhone(_0x32fbba['id'],_0x32fbba['items'][_0x5a771e][_0x5147('0x73')],_0x32fbba[_0x5147('0x87')]?_[_0x5147('0x51')](_0x32fbba[_0x5147('0x87')][_0x5a771e])?null:_0x32fbba[_0x5147('0x87')][_0x5a771e]:_0x32fbba['items'][_0x5a771e][_0x5147('0x88')]?_0x32fbba[_0x5147('0x86')][_0x5a771e][_0x5147('0x88')]:null,_0x263377,_0x34859f));}Promise['all'](_0x399a24)[_0x5147('0x21')](function(){db[_0x5147('0x23')]['update']({'AdditionalPhones':_0x5872ae},{'where':{'id':_0x32fbba['id']}})[_0x5147('0x21')](function(){_0x425112(0x1);});});});});});}function addAdditionalPhone(_0x26173a,_0x3f1d83,_0x3634e2,_0x38ca7b,_0x5d3b94){return db[_0x5147('0x84')][_0x5147('0x24')]({'where':{'CmContactId':_0x26173a,'item':_0x3f1d83}})[_0x5147('0x21')](function(_0x4c504b){if(_0x4c504b)logger[_0x5147('0x32')]('contact\x20phone\x20exists',_0x4c504b);else{db[_0x5147('0x84')]['create']({'CmContactId':_0x26173a,'item':_0x3f1d83,'ItemTypeId':_0x3634e2,'OrderBy':_0x38ca7b,'ItemClass':_0x5147('0x8a'),'description':_0x5d3b94});}});}function deleteCmHopperPhones(_0x21803e){return new Promise(function(_0x327a50){return db['CmHopper'][_0x5147('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x21803e}})['then'](function(_0x2efbed){db[_0x5147('0x8b')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x5147('0x69')](_0x2efbed,'id')}}});})['then'](function(){_0x327a50(0x1);});});}function addCmHopperPhones(_0x36f40a){return new Promise(function(_0x37163e){return db[_0x5147('0x3a')][_0x5147('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x36f40a}})[_0x5147('0x21')](function(_0x307823){var _0x39bfda=[];_[_0x5147('0x69')](_0x307823,function(_0x3fd950){_0x39bfda[_0x5147('0x5d')](createCmHopperPhone(_0x36f40a,_0x3fd950['id']));});Promise['all'](_0x39bfda)[_0x5147('0x21')](function(){_0x37163e(0x1);});});});}function createCmHopperPhone(_0x33eafa,_0x4f2ff7){return new Promise(function(_0x66ce63){db[_0x5147('0x84')][_0x5147('0x1e')]({'raw':!![],'attributes':[_0x5147('0x8c'),_0x5147('0x85')],'where':{'CmContactId':_0x33eafa,'ItemClass':'PHONE'},'include':[{'model':db[_0x5147('0x64')],'attributes':[_0x5147('0x85')],'as':'ItemType'}],'order':[_0x5147('0x85'),db[_0x5147('0x66')][_0x5147('0x8d')](_0x5147('0x8e'))]})[_0x5147('0x21')](function(_0x2df0ae){var _0x183027=0x1;var _0x17c3f3=_[_0x5147('0x69')](_0x2df0ae,function(_0x383751){_0x383751[_0x5147('0x8f')]=_0x4f2ff7;_0x383751['phone']=_0x383751[_0x5147('0x8c')];_0x383751[_0x5147('0x85')]=_0x183027;delete _0x383751['ItemType.OrderBy'];_0x183027=_0x183027+0x1;return _0x383751;});return db[_0x5147('0x8b')][_0x5147('0x54')](_0x17c3f3,{});})[_0x5147('0x21')](function(){_0x66ce63(0x1);});});}function insertAdditionalPhones(_0x21555c,_0x58189d){return new Promise(function(_0x3d1a66){var _0x2b9eb0=[];for(var _0x523dda=0x0;_0x523dda<_0x58189d[_0x5147('0x29')];_0x523dda++){var _0x730c37=_0x58189d[_0x523dda];_0x2b9eb0[_0x5147('0x5d')](parseContactItemType(_0x730c37));}Promise[_0x5147('0x5f')](_0x2b9eb0)['then'](function(){var _0x339e43={'id':_0x21555c['id'],'items':_0x58189d};return addAdditionalPhones(_0x339e43)[_0x5147('0x21')](function(){return addCmHopperPhones(_0x21555c['id']);});})[_0x5147('0x21')](function(){_0x3d1a66(_0x21555c);});});}function parseContactItemType(_0x2aa832){return new Promise(function(_0x38bbd1){if(_0x2aa832[_0x5147('0x5c')](_0x5147('0x88'))){_0x38bbd1(_0x2aa832);}else{return db[_0x5147('0x64')][_0x5147('0x24')]({'where':{'name':_0x2aa832['ItemType']}})[_0x5147('0x21')](function(_0x3e777d){if(_['isNil'](_0x3e777d))_0x2aa832[_0x5147('0x88')]=null;else _0x2aa832[_0x5147('0x88')]=_0x3e777d['id'];_0x38bbd1(_0x2aa832);});}});}exports[_0x5147('0x90')]=function(_0x46cd1,_0x18a3f6){return db[_0x5147('0x84')]['findAll']({'raw':!![],'where':{'CmContactId':_0x46cd1[_0x5147('0x25')]['id'],'ItemClass':_0x5147('0x8a')},'include':[{'model':db[_0x5147('0x64')],'as':_0x5147('0x65')}],'order':[['OrderBy'],[db['sequelize']['literal']('`ItemType`.OrderBy')]]})[_0x5147('0x21')](function(_0x2c181a){return _0x2c181a;})[_0x5147('0x21')](respondWithResult(_0x18a3f6,null))[_0x5147('0x22')](handleError(_0x18a3f6,null));};exports['duplicateAdditionalPhones']=function(_0x2d00e1,_0x3b202f){return db[_0x5147('0x84')][_0x5147('0x1e')]({'raw':!![],'where':{'CmContactId':_0x2d00e1['body'][_0x5147('0x91')]}})[_0x5147('0x21')](function(_0x4b8c50){var _0x476793=_[_0x5147('0x69')](_0x4b8c50,function(_0x543bc2){_0x543bc2[_0x5147('0x92')]=_0x2d00e1[_0x5147('0x34')][_0x5147('0x93')];return _0x543bc2;});return db['CmContactHasItem'][_0x5147('0x54')](_0x476793,{});})[_0x5147('0x21')](function(){return addCmHopperPhones(_0x2d00e1[_0x5147('0x34')][_0x5147('0x93')]);})[_0x5147('0x21')](function(){return['ok'];})['then'](respondWithResult(_0x3b202f,null))[_0x5147('0x22')](handleError(_0x3b202f,null));};exports[_0x5147('0x94')]=function(_0x977998,_0x145b56){var _0x503701=[];_0x503701['push'](createCmHopperPhone(_0x977998['body']['id'],_0x977998[_0x5147('0x34')][_0x5147('0x95')]));Promise[_0x5147('0x5f')](_0x503701)[_0x5147('0x21')](function(){return[0x1];})[_0x5147('0x21')](respondWithResult(_0x145b56,null));};exports[_0x5147('0x96')]=function(_0x21a2d4,_0x36cadb){var _0x19749f={'raw':![],'where':{}};var _0x408817={};var _0x352e51={'count':0x0,'rows':[]};return db[_0x5147('0x23')][_0x5147('0x75')]({'where':{'id':_0x21a2d4['params']['id']}})[_0x5147('0x21')](handleEntityNotFound(_0x36cadb,null))[_0x5147('0x21')](function(_0x553e0a){if(_0x553e0a){_0x408817[_0x5147('0x76')]=_[_0x5147('0x28')](db[_0x5147('0x3a')][_0x5147('0x77')]);_0x408817['query']=_[_0x5147('0x28')](_0x21a2d4[_0x5147('0x1f')]);_0x408817[_0x5147('0x78')]=_[_0x5147('0x79')](_0x408817[_0x5147('0x76')],_0x408817[_0x5147('0x1f')]);_0x19749f[_0x5147('0x7b')]=_[_0x5147('0x79')](_0x408817['model'],qs[_0x5147('0x7a')](_0x21a2d4[_0x5147('0x1f')][_0x5147('0x7a')]));_0x19749f['attributes']=_0x19749f['attributes'][_0x5147('0x29')]?_0x19749f[_0x5147('0x7b')]:_0x408817[_0x5147('0x76')];if(!_0x21a2d4['query']['hasOwnProperty'](_0x5147('0x97'))){_0x19749f[_0x5147('0x15')]=qs[_0x5147('0x15')](_0x21a2d4[_0x5147('0x1f')][_0x5147('0x15')]);_0x19749f['offset']=qs[_0x5147('0x12')](_0x21a2d4['query'][_0x5147('0x12')]);}_0x19749f['order']=qs[_0x5147('0x7d')](_0x21a2d4['query'][_0x5147('0x7d')]);_0x19749f[_0x5147('0x57')]=qs[_0x5147('0x78')](_['pick'](_0x21a2d4[_0x5147('0x1f')],_0x408817[_0x5147('0x78')]));_0x19749f['where'][_0x5147('0x98')]=_0x553e0a['id'];if(_0x21a2d4['query'][_0x5147('0x80')]){_0x19749f['where']=_[_0x5147('0x7f')](_0x19749f[_0x5147('0x57')],{'$or':_['map'](_0x19749f['attributes'],function(_0x32d686){var _0x3041ff={};_0x3041ff[_0x32d686]={'$like':'%'+_0x21a2d4['query']['filter']+'%'};return _0x3041ff;})});}_0x19749f=_[_0x5147('0x7f')]({},_0x19749f,_0x21a2d4[_0x5147('0x81')]);return db[_0x5147('0x3a')][_0x5147('0x14')]({'where':_0x19749f['where']})['then'](function(_0x36434a){_0x352e51[_0x5147('0x14')]=_0x36434a;if(_0x21a2d4[_0x5147('0x1f')][_0x5147('0x99')]){_0x19749f[_0x5147('0x9a')]=[{'all':!![]}];}return db[_0x5147('0x3a')][_0x5147('0x1e')](_0x19749f);})['then'](function(_0x584555){_0x352e51[_0x5147('0x9b')]=_0x584555;return _0x352e51;});}})['then'](respondWithFilteredResult(_0x36cadb,_0x19749f))['catch'](handleError(_0x36cadb,null));};exports[_0x5147('0x9c')]=function(_0x25e635,_0x4c117d){var _0x5bda7c={'raw':!![],'where':{}};var _0xbeb6f7={};var _0x534ede={'count':0x0,'rows':[]};return db['CmContact'][_0x5147('0x75')]({'where':{'id':_0x25e635[_0x5147('0x25')]['id']}})[_0x5147('0x21')](handleEntityNotFound(_0x4c117d,null))[_0x5147('0x21')](function(_0x5cff05){if(_0x5cff05){_0xbeb6f7[_0x5147('0x76')]=_[_0x5147('0x28')](db[_0x5147('0x44')][_0x5147('0x77')]);_0xbeb6f7[_0x5147('0x1f')]=_[_0x5147('0x28')](_0x25e635[_0x5147('0x1f')]);_0xbeb6f7[_0x5147('0x78')]=_[_0x5147('0x79')](_0xbeb6f7['model'],_0xbeb6f7[_0x5147('0x1f')]);_0x5bda7c[_0x5147('0x7b')]=_[_0x5147('0x79')](_0xbeb6f7[_0x5147('0x76')],qs[_0x5147('0x7a')](_0x25e635[_0x5147('0x1f')]['fields']));_0x5bda7c[_0x5147('0x7b')]=_0x5bda7c[_0x5147('0x7b')][_0x5147('0x29')]?_0x5bda7c['attributes']:_0xbeb6f7['model'];if(!_0x25e635[_0x5147('0x1f')]['hasOwnProperty']('nolimit')){_0x5bda7c[_0x5147('0x15')]=qs[_0x5147('0x15')](_0x25e635['query'][_0x5147('0x15')]);_0x5bda7c[_0x5147('0x12')]=qs[_0x5147('0x12')](_0x25e635[_0x5147('0x1f')]['offset']);}_0x5bda7c[_0x5147('0x7c')]=qs[_0x5147('0x7d')](_0x25e635['query'][_0x5147('0x7d')]);_0x5bda7c[_0x5147('0x57')]=qs[_0x5147('0x78')](_['pick'](_0x25e635[_0x5147('0x1f')],_0xbeb6f7[_0x5147('0x78')]));_0x5bda7c['where'][_0x5147('0x98')]=_0x5cff05['id'];if(_0x25e635['query']['filter']){_0x5bda7c[_0x5147('0x57')]=_[_0x5147('0x7f')](_0x5bda7c['where'],{'$or':_['map'](_0x5bda7c[_0x5147('0x7b')],function(_0x40e792){var _0x154b67={};_0x154b67[_0x40e792]={'$like':'%'+_0x25e635[_0x5147('0x1f')][_0x5147('0x80')]+'%'};return _0x154b67;})});}_0x5bda7c=_[_0x5147('0x7f')]({},_0x5bda7c,_0x25e635['options']);return db['CmHopperHistory']['count']({'where':_0x5bda7c[_0x5147('0x57')]})[_0x5147('0x21')](function(_0x3dc189){_0x534ede[_0x5147('0x14')]=_0x3dc189;if(_0x25e635['query'][_0x5147('0x99')]){_0x5bda7c['include']=[{'all':!![]}];}return db[_0x5147('0x44')][_0x5147('0x1e')](_0x5bda7c);})[_0x5147('0x21')](function(_0x2d8e90){_0x534ede[_0x5147('0x9b')]=_0x2d8e90;return _0x534ede;});}})['then'](respondWithFilteredResult(_0x4c117d,_0x5bda7c))[_0x5147('0x22')](handleError(_0x4c117d,null));};exports[_0x5147('0x9d')]=function(_0x3099c8,_0x1b0236){var _0x1c6365={'raw':!![],'where':{}};var _0x476ef6={};var _0x554f97={'count':0x0,'rows':[]};return db[_0x5147('0x23')][_0x5147('0x75')]({'where':{'id':_0x3099c8['params']['id']}})[_0x5147('0x21')](handleEntityNotFound(_0x1b0236,null))['then'](function(_0x44416a){if(_0x44416a){_0x476ef6[_0x5147('0x76')]=_[_0x5147('0x28')](db['CmHopperFinal'][_0x5147('0x77')]);_0x476ef6[_0x5147('0x1f')]=_[_0x5147('0x28')](_0x3099c8[_0x5147('0x1f')]);_0x476ef6[_0x5147('0x78')]=_[_0x5147('0x79')](_0x476ef6[_0x5147('0x76')],_0x476ef6['query']);_0x1c6365[_0x5147('0x7b')]=_[_0x5147('0x79')](_0x476ef6[_0x5147('0x76')],qs['fields'](_0x3099c8[_0x5147('0x1f')][_0x5147('0x7a')]));_0x1c6365['attributes']=_0x1c6365[_0x5147('0x7b')][_0x5147('0x29')]?_0x1c6365[_0x5147('0x7b')]:_0x476ef6[_0x5147('0x76')];if(!_0x3099c8[_0x5147('0x1f')][_0x5147('0x5c')](_0x5147('0x97'))){_0x1c6365[_0x5147('0x15')]=qs[_0x5147('0x15')](_0x3099c8[_0x5147('0x1f')][_0x5147('0x15')]);_0x1c6365[_0x5147('0x12')]=qs[_0x5147('0x12')](_0x3099c8[_0x5147('0x1f')][_0x5147('0x12')]);}_0x1c6365[_0x5147('0x7c')]=qs['sort'](_0x3099c8[_0x5147('0x1f')][_0x5147('0x7d')]);_0x1c6365['where']=qs['filters'](_['pick'](_0x3099c8['query'],_0x476ef6['filters']));_0x1c6365[_0x5147('0x57')][_0x5147('0x98')]=_0x44416a['id'];if(_0x3099c8[_0x5147('0x1f')][_0x5147('0x80')]){_0x1c6365[_0x5147('0x57')]=_[_0x5147('0x7f')](_0x1c6365[_0x5147('0x57')],{'$or':_[_0x5147('0x69')](_0x1c6365['attributes'],function(_0x358a35){var _0x438ddf={};_0x438ddf[_0x358a35]={'$like':'%'+_0x3099c8['query'][_0x5147('0x80')]+'%'};return _0x438ddf;})});}_0x1c6365=_['merge']({},_0x1c6365,_0x3099c8['options']);return db[_0x5147('0x9e')]['count']({'where':_0x1c6365['where']})[_0x5147('0x21')](function(_0x3c66c9){_0x554f97[_0x5147('0x14')]=_0x3c66c9;if(_0x3099c8[_0x5147('0x1f')][_0x5147('0x99')]){_0x1c6365[_0x5147('0x9a')]=[{'all':!![]}];}return db[_0x5147('0x9e')][_0x5147('0x1e')](_0x1c6365);})[_0x5147('0x21')](function(_0x1fd64c){_0x554f97[_0x5147('0x9b')]=_0x1fd64c;return _0x554f97;});}})[_0x5147('0x21')](respondWithFilteredResult(_0x1b0236,_0x1c6365))[_0x5147('0x22')](handleError(_0x1b0236,null));};exports[_0x5147('0x9f')]=function(_0x31e3e7,_0x3a3363){var _0x4eb5a6={'raw':!![],'where':{}};var _0x24e79b={};var _0x1294c8={'count':0x0,'rows':[]};return db[_0x5147('0x23')]['findOne']({'where':{'id':_0x31e3e7[_0x5147('0x25')]['id']}})['then'](handleEntityNotFound(_0x3a3363,null))['then'](function(_0x597327){if(_0x597327){_0x24e79b[_0x5147('0x76')]=_['keys'](db[_0x5147('0x4c')][_0x5147('0x77')]);_0x24e79b['query']=_['keys'](_0x31e3e7[_0x5147('0x1f')]);_0x24e79b[_0x5147('0x78')]=_['intersection'](_0x24e79b[_0x5147('0x76')],_0x24e79b[_0x5147('0x1f')]);_0x4eb5a6[_0x5147('0x7b')]=_[_0x5147('0x79')](_0x24e79b[_0x5147('0x76')],qs['fields'](_0x31e3e7[_0x5147('0x1f')][_0x5147('0x7a')]));_0x4eb5a6[_0x5147('0x7b')]=_0x4eb5a6[_0x5147('0x7b')][_0x5147('0x29')]?_0x4eb5a6[_0x5147('0x7b')]:_0x24e79b[_0x5147('0x76')];if(!_0x31e3e7[_0x5147('0x1f')][_0x5147('0x5c')](_0x5147('0x97'))){_0x4eb5a6['limit']=qs[_0x5147('0x15')](_0x31e3e7[_0x5147('0x1f')][_0x5147('0x15')]);_0x4eb5a6[_0x5147('0x12')]=qs[_0x5147('0x12')](_0x31e3e7[_0x5147('0x1f')][_0x5147('0x12')]);}_0x4eb5a6['order']=qs['sort'](_0x31e3e7[_0x5147('0x1f')]['sort']);_0x4eb5a6[_0x5147('0x57')]=qs[_0x5147('0x78')](_['pick'](_0x31e3e7[_0x5147('0x1f')],_0x24e79b['filters']));_0x4eb5a6[_0x5147('0x57')][_0x5147('0x98')]=_0x597327['id'];if(_0x31e3e7['query'][_0x5147('0x80')]){_0x4eb5a6[_0x5147('0x57')]=_['merge'](_0x4eb5a6['where'],{'$or':_[_0x5147('0x69')](_0x4eb5a6[_0x5147('0x7b')],function(_0x309848){var _0x2baa78={};_0x2baa78[_0x309848]={'$like':'%'+_0x31e3e7['query'][_0x5147('0x80')]+'%'};return _0x2baa78;})});}_0x4eb5a6=_[_0x5147('0x7f')]({},_0x4eb5a6,_0x31e3e7['options']);return db[_0x5147('0x4c')]['count']({'where':_0x4eb5a6[_0x5147('0x57')]})[_0x5147('0x21')](function(_0x163f4c){_0x1294c8['count']=_0x163f4c;if(_0x31e3e7[_0x5147('0x1f')][_0x5147('0x99')]){_0x4eb5a6[_0x5147('0x9a')]=[{'all':!![]}];}return db[_0x5147('0x4c')]['findAll'](_0x4eb5a6);})[_0x5147('0x21')](function(_0x5ede8f){_0x1294c8[_0x5147('0x9b')]=_0x5ede8f;return _0x1294c8;});}})[_0x5147('0x21')](respondWithFilteredResult(_0x3a3363,_0x4eb5a6))[_0x5147('0x22')](handleError(_0x3a3363,null));};exports[_0x5147('0xa0')]=function(_0x11c8e3,_0x5c757d){try{if(!_0x11c8e3['body']['ListId']){throw new Error(_0x5147('0xa1'));}if(!_0x11c8e3[_0x5147('0x34')]['binding_keys']){throw new Error(_0x5147('0xa2'));}if(!_0x11c8e3[_0x5147('0x34')][_0x5147('0xa3')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x11c8e3[_0x5147('0x34')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x34a261=_0x11c8e3['body'][_0x5147('0xa4')][_0x5147('0xa5')](',');var _0x2f06f5=_0x11c8e3[_0x5147('0x34')][_0x5147('0xa3')][_0x5147('0xa5')](',');if(!_0x34a261[_0x5147('0x29')]||!_0x2f06f5[_0x5147('0x29')]||_0x34a261[_0x5147('0x29')]!==_0x2f06f5[_0x5147('0x29')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x11c8e3[_0x5147('0x34')][_0x5147('0x7a')]=_[_0x5147('0xa6')](_0x34a261,_0x2f06f5);if(!_0x11c8e3['body'][_0x5147('0x7a')][_0x5147('0x73')]){throw new Error(_0x5147('0xa7'));}if(!_0x11c8e3[_0x5147('0x34')][_0x5147('0x7a')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x485313=path[_0x5147('0x37')](config['root'],_0x5147('0xa8'),_0x11c8e3[_0x5147('0xa9')][_0x5147('0xaa')]);fs[_0x5147('0xab')](_0x485313,parseInt(_0x5147('0xac'),0x8));var _0x16444b=require(_0x5147('0xad'))[_0x5147('0xae')](path[_0x5147('0x37')](__dirname,_0x5147('0xaf')),[_0x485313,_0x11c8e3[_0x5147('0x34')][_0x5147('0xa4')],_0x11c8e3['body'][_0x5147('0xa3')],_0x11c8e3[_0x5147('0x34')]['ListId'],_0x11c8e3[_0x5147('0x34')][_0x5147('0xb0')],_0x11c8e3[_0x5147('0x34')][_0x5147('0x56')],_0x11c8e3[_0x5147('0x34')][_0x5147('0xb1')]]);return _0x5c757d[_0x5147('0x10')](0xc8)[_0x5147('0x11')]({'message':_0x5147('0xb2'),'pid':_0x16444b[_0x5147('0xb3')]});}catch(_0x262071){return _0x5c757d[_0x5147('0x10')](0x1f4)['send'](_0x262071);}};exports[_0x5147('0xb4')]=function(_0x499c72,_0x44aa0f){var _0x1c3e16=fs['createReadStream'](_0x499c72[_0x5147('0xa9')]['path']);Papa[_0x5147('0xb5')](_0x1c3e16,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x59ed08){return _0x44aa0f[_0x5147('0x10')](0xc8)[_0x5147('0x11')]({'file':_0x499c72[_0x5147('0xa9')],'fields':_0x59ed08['meta'][_0x5147('0x7a')]});}});};exports[_0x5147('0xb6')]=function(_0xdb2097,_0xfa9751){return db[_0x5147('0xb7')][_0x5147('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0x5147('0xb8')}})[_0x5147('0x21')](function(_0x47e0ae){var _0x24c44b=![];if(!_0xdb2097['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0xdb2097[_0x5147('0x34')][_0x5147('0xb9')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xdb2097[_0x5147('0x34')][_0x5147('0xb9')][_0x5147('0xba')]){throw new Error(_0x5147('0xbb'));}if(!_0xdb2097[_0x5147('0x34')]['socket_timestamp']){throw new Error(_0x5147('0xbc'));}var _0x3ad927=require(_0x5147('0xad'))[_0x5147('0xae')](path[_0x5147('0x37')](__dirname,'../../components/import/cm/csv2'),[_0xdb2097[_0x5147('0x25')]['id'],JSON[_0x5147('0xbd')](_0xdb2097['body']),JSON[_0x5147('0xbd')](_0x47e0ae)]);_0x3ad927['on'](_0x5147('0xbe'),function(){_0x24c44b=!![];return _0xfa9751[_0x5147('0x10')](0xc8)[_0x5147('0x11')]({'message':_0x5147('0xbf'),'pid':_0x3ad927['pid']});});_0x3ad927['on']('exit',function(_0x28c0a7){if(_0x28c0a7&&!_0x24c44b){return _0xfa9751[_0x5147('0x10')](0x1f4)[_0x5147('0x11')]({'message':'error\x20child\x20process','pid':_0x3ad927[_0x5147('0xb3')]});}});})[_0x5147('0x22')](handleError(_0xfa9751,null));};exports[_0x5147('0xc0')]=function(_0x2372ae,_0x9af50){return db['User'][_0x5147('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0x5147('0xb8')}})['then'](function(_0x507688){var _0x42f6d8=![];if(!_0x2372ae[_0x5147('0x34')][_0x5147('0x59')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2372ae['body'][_0x5147('0xb9')][_0x5147('0x73')]){throw new Error(_0x5147('0xa7'));}if(!_0x2372ae['body'][_0x5147('0xb9')]['firstName']){throw new Error(_0x5147('0xbb'));}if(!_0x2372ae[_0x5147('0x34')][_0x5147('0xb1')]){throw new Error(_0x5147('0xbc'));}var _0x2c81b8=require('child_process')[_0x5147('0xae')](path[_0x5147('0x37')](__dirname,_0x5147('0xc1')),[_0x2372ae['params']['id'],JSON[_0x5147('0xbd')](_0x2372ae[_0x5147('0x34')]),JSON[_0x5147('0xbd')](_0x507688)]);_0x2c81b8['on'](_0x5147('0xbe'),function(){_0x42f6d8=!![];return _0x9af50['status'](0xc8)[_0x5147('0x11')]({'message':_0x5147('0xbf'),'pid':_0x2c81b8['pid']});});_0x2c81b8['on'](_0x5147('0xc2'),function(_0x8e4162){if(_0x8e4162&&!_0x42f6d8){return _0x9af50[_0x5147('0x10')](0x1f4)[_0x5147('0x11')]({'message':_0x5147('0xc3'),'pid':_0x2c81b8[_0x5147('0xb3')]});}});})['catch'](handleError(_0x9af50,null));};exports[_0x5147('0xc4')]=function(_0x2ec73f,_0x569cbf){var _0x5d8cae=[_0x5147('0xc5'),_0x5147('0xc6'),_0x5147('0xc7'),_0x5147('0xc8'),_0x5147('0xc9'),_0x5147('0xca'),'voice'];var _0x36f3d5={'offset':0x0,'order':qs[_0x5147('0x7d')](_0x5147('0xcb'))},_0x56f53a={'count':0x0,'rows':[]};Promise[_0x5147('0xcc')]()[_0x5147('0x21')](function(){if(_0x2ec73f[_0x5147('0x1f')][_0x5147('0xcd')]){if(!_[_0x5147('0xce')](_0x5d8cae,_0x2ec73f['query']['channel']['toLowerCase']())){throw new Error(_0x5147('0xcf'));}_0x5d8cae=[_0x2ec73f[_0x5147('0x1f')][_0x5147('0xcd')][_0x5147('0xd0')]()];}if(_0x2ec73f[_0x5147('0x1f')]['range']){try{var _0x4f5e9e=JSON['parse'](_0x2ec73f[_0x5147('0x1f')][_0x5147('0xd1')]);if(!moment(_0x4f5e9e['from'])[_0x5147('0xd2')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x4f5e9e['to'])[_0x5147('0xd2')]()){throw new Error(_0x5147('0xd3'));}}catch(_0x321b4a){throw new Error(_0x5147('0xd4'));}}if(!_0x2ec73f[_0x5147('0x1f')]['hasOwnProperty'](_0x5147('0x97'))){_0x36f3d5[_0x5147('0x15')]=qs[_0x5147('0x15')](_0x2ec73f[_0x5147('0x1f')]['limit']||0xa);_0x36f3d5[_0x5147('0x12')]=qs['offset'](_0x2ec73f['query'][_0x5147('0x12')]);}var _0x8efb26=_0x5d8cae[_0x5147('0x69')](function(_0x408be2){if(_0x408be2===_0x5147('0xd5')){var _0x2bb744={'attributes':['id',_0x5147('0xd6'),_0x5147('0xd7'),_0x5147('0xd8'),_0x5147('0xd9'),_0x5147('0xda'),'starttime',_0x5147('0xdb'),_0x5147('0xdc'),_0x5147('0xdd'),_0x5147('0xde'),_0x5147('0xdf'),_0x5147('0xe0'),_0x5147('0xe1'),_0x5147('0xe2')],'where':{'ContactId':_0x2ec73f[_0x5147('0x25')]['id']},'include':[{'model':db[_0x5147('0xb7')],'as':'User','attributes':['id',_0x5147('0x1b'),_0x5147('0xe3'),_0x5147('0x2f')]}],'order':[[_0x5147('0xde'),_0x5147('0xe4')]]};if(_0x2ec73f[_0x5147('0x1f')][_0x5147('0xd1')]){_0x2bb744['where']['createdAt']={'$gte':_0x4f5e9e['from'],'$lte':_0x4f5e9e['to']};}return db['VoiceCallReport'][_0x5147('0xe5')](_0x2bb744)[_0x5147('0x21')](function(_0x3b409b){_0x56f53a[_0x5147('0x14')]+=_0x3b409b[_0x5147('0x14')];return _[_0x5147('0x69')](_0x3b409b[_0x5147('0x9b')],function(_0x184656){var _0x10cb48=_0x184656['get']({'plain':!![]});_0x10cb48[_0x5147('0xcd')]=_0x408be2;if(_0x10cb48['User']){_0x10cb48['User']={'id':_0x10cb48[_0x5147('0xb7')]['id'],'name':_0x10cb48[_0x5147('0xb7')][_0x5147('0x1b')],'fullname':_0x10cb48[_0x5147('0xb7')][_0x5147('0xe3')],'alias':_0x10cb48['User']['alias']};}return _0x10cb48;});});}else{var _0x5a489c=_[_0x5147('0xe6')](_0x408be2)+(_0x408be2===_0x5147('0xc6')?_0x5147('0xe7'):_0x5147('0xe8'));var _0x2a93ef={'attributes':['id',_0x5147('0xe9'),_0x5147('0xea'),'createdAt',_0x5147('0xdd'),_0x5147('0xeb'),_0x5147('0xec'),_0x5147('0xed'),_0x5147('0xe2'),_0x5a489c+'Id'],'where':{'ContactId':_0x2ec73f[_0x5147('0x25')]['id']},'include':[{'model':db[_0x5a489c],'as':'Account','attributes':['id',_0x5147('0x1b'),_0x5147('0xee')]},{'model':db[_0x5147('0xb7')],'as':_0x5147('0xef'),'attributes':['id',_0x5147('0x1b'),_0x5147('0xe3')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5147('0x1b'),_0x5147('0x62')],'through':{'attributes':[]}}],'order':[[_0x5147('0xde'),_0x5147('0xe4')]]};if(_0x2ec73f[_0x5147('0x1f')]['range']){_0x2a93ef['where'][_0x5147('0xde')]={'$gte':_0x4f5e9e[_0x5147('0x39')],'$lte':_0x4f5e9e['to']};}switch(_0x408be2){case _0x5147('0xc6'):_0x2a93ef[_0x5147('0x7b')][_0x5147('0x5d')]('browserName',_0x5147('0xf0'),_0x5147('0xf1'),_0x5147('0xf2'),_0x5147('0xf3'),_0x5147('0xf4'),_0x5147('0xf5'),_0x5147('0xf6'),_0x5147('0xf7'));break;case _0x5147('0xc5'):_0x2a93ef[_0x5147('0x7b')][_0x5147('0x5d')](_0x5147('0xf8'),_0x5147('0xf9'));break;case _0x5147('0xc8'):_0x2a93ef['attributes'][_0x5147('0x5d')](_0x5147('0xfa'),_0x5147('0xfb'));break;}return db[_[_0x5147('0xe6')](_0x408be2)+_0x5147('0xfc')][_0x5147('0xe5')](_0x2a93ef)['then'](function(_0x4d7442){_0x56f53a[_0x5147('0x14')]+=_0x4d7442[_0x5147('0x14')];return _['map'](_0x4d7442[_0x5147('0x9b')],function(_0xfb9bd0){var _0x43d3fe=_0xfb9bd0['get']({'plain':!![]});_0x43d3fe[_0x5147('0xcd')]=_0x408be2;if(_0x43d3fe['Owner']){_0x43d3fe[_0x5147('0xef')]={'id':_0x43d3fe[_0x5147('0xef')]['id'],'name':_0x43d3fe[_0x5147('0xef')][_0x5147('0x1b')],'fullname':_0x43d3fe[_0x5147('0xef')][_0x5147('0xe3')]};}return _0x43d3fe;});});}});return Promise[_0x5147('0x5f')](_0x8efb26);})[_0x5147('0x21')](function(_0x1abb52){return _(_0x1abb52)[_0x5147('0xfd')]()[_0x5147('0xfe')](_0x5147('0xde'))[_0x5147('0xff')]()[_0x5147('0x100')]();})[_0x5147('0x21')](function(_0x45b581){_0x56f53a[_0x5147('0x9b')]=_0x36f3d5[_0x5147('0x15')]?_0x45b581[_0x5147('0x101')](_0x36f3d5[_0x5147('0x12')],_0x36f3d5[_0x5147('0x12')]+_0x36f3d5[_0x5147('0x15')]):_0x45b581;return _0x56f53a;})[_0x5147('0x21')](respondWithFilteredResult(_0x569cbf,_0x36f3d5))['catch'](handleError(_0x569cbf,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index d1b9122..e90e51b 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6168=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x10f99a,_0x46e1f1){var _0x5aba0e=function(_0x37a737){while(--_0x37a737){_0x10f99a['push'](_0x10f99a['shift']());}};_0x5aba0e(++_0x46e1f1);}(_0x6168,0xb7));var _0x8616=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x6168[_0x3070dc];return _0x431489;};'use strict';var EventEmitter=require(_0x8616('0x0'));var CmContact=require(_0x8616('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8616('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8616('0x3'),'afterDestroy':_0x8616('0x4')};function emitEvent(_0x251f44){return function(_0x58897f,_0x55c44b,_0x2064d6){CmContactEvents[_0x8616('0x5')](_0x251f44+':'+_0x58897f['id'],_0x58897f);CmContactEvents[_0x8616('0x5')](_0x251f44,_0x58897f);_0x2064d6(null);};}for(var e in events){if(events[_0x8616('0x6')](e)){var event=events[e];CmContact[_0x8616('0x7')](e,emitEvent(event));}}module[_0x8616('0x8')]=CmContactEvents; \ No newline at end of file +var _0x5783=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x5783,0x10a));var _0x3578=function(_0x5f025f,_0x420828){_0x5f025f=_0x5f025f-0x0;var _0x5c1c62=_0x5783[_0x5f025f];return _0x5c1c62;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x3578('0x0'))['db'][_0x3578('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x3578('0x2')](0x0);var events={'afterCreate':_0x3578('0x3'),'afterUpdate':_0x3578('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4261bf){return function(_0x29a184,_0x318363,_0x176d08){CmContactEvents['emit'](_0x4261bf+':'+_0x29a184['id'],_0x29a184);CmContactEvents[_0x3578('0x5')](_0x4261bf,_0x29a184);_0x176d08(null);};}for(var e in events){if(events[_0x3578('0x6')](e)){var event=events[e];CmContact[_0x3578('0x7')](e,emitEvent(event));}}module[_0x3578('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index a76330a..d8f3c0b 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8e1=['length','onlyIfOpen','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','always','BlackLists','List\x20not\x20found','ContactId','VoiceQueueId','CampaignId','push','[CmContact][afterDestroy][Succesfull]','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','exports','define','cm_contacts','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists'];(function(_0x1947fd,_0x1f4805){var _0x4485ad=function(_0x1f9a31){while(--_0x1f9a31){_0x1947fd['push'](_0x1947fd['shift']());}};_0x4485ad(++_0x1f4805);}(_0xf8e1,0x137));var _0x1f8e=function(_0x23a7ab,_0x516053){_0x23a7ab=_0x23a7ab-0x0;var _0x306d68=_0xf8e1[_0x23a7ab];return _0x306d68;};'use strict';var _=require('lodash');var util=require(_0x1f8e('0x0'));var logger=require(_0x1f8e('0x1'))(_0x1f8e('0x2'));var moment=require(_0x1f8e('0x3'));var BPromise=require(_0x1f8e('0x4'));var rp=require(_0x1f8e('0x5'));var fs=require('fs');var path=require(_0x1f8e('0x6'));var rimraf=require(_0x1f8e('0x7'));var config=require(_0x1f8e('0x8'));var shared=require(_0x1f8e('0x9'));var attributes=require('./cmContact.attributes');module[_0x1f8e('0xa')]=function(_0x3399c3,_0x12b962){return _0x3399c3[_0x1f8e('0xb')]('CmContact',attributes,{'tableName':_0x1f8e('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x1f8e('0xd')]},{'name':'fti_cm_contacts','fields':[_0x1f8e('0xe'),_0x1f8e('0xf'),_0x1f8e('0xd'),_0x1f8e('0x10'),_0x1f8e('0x11'),_0x1f8e('0x12')],'type':_0x1f8e('0x13')}],'timestamps':!![],'charset':_0x1f8e('0x14'),'collate':_0x1f8e('0x15'),'hooks':{'afterCreate':function(_0x1c8444,_0x483734,_0x3c0691){var _0x425819=_0x3399c3[_0x1f8e('0x16')];var _0x506ff0=_0x1c8444[_0x1f8e('0x17')]({'plain':!![]});function _0x3a0c0e(){return function(_0x39a608){logger[_0x1f8e('0x18')](_0x1f8e('0x19'),_0x1f8e('0x1a'),util[_0x1f8e('0x1b')](_0x39a608,{'showHidden':![],'depth':null}));};}function _0x326396(_0x3b25ea,_0x59e310){var _0x5504f6=_0x59e310[_0x1f8e('0x1c')]?_0x59e310['scheduledat']:moment()[_0x1f8e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x34991e,_0xad3c3e){if(_['isNil'](_0x59e310[_0x1f8e('0x1e')])){_0x34991e({'ret':_0x5504f6});}else{_0x425819[_0x1f8e('0x1f')][_0x1f8e('0x20')]({'where':{'id':_0x3b25ea['id']}})[_0x1f8e('0x21')](function(_0x32a960){if(!_['isNil'](_0x32a960)){var _0x3de07c=_0x32a960[_0x1f8e('0x1e')];if(!_[_0x1f8e('0x22')](_0x3de07c)){var _0x515c1f=shared[_0x1f8e('0x23')];var _0x18ac91=_0x515c1f[_0x3de07c];var _0x59dacb=_0x515c1f[_0x59e310[_0x1f8e('0x1e')]];if(!_[_0x1f8e('0x22')](_0x18ac91)&&!_[_0x1f8e('0x22')](_0x59dacb)){var _0x152424=_0x18ac91[_0x1f8e('0x24')]-_0x59dacb[_0x1f8e('0x24')];_0x5504f6=_0x59e310[_0x1f8e('0x1c')]?_0x59e310[_0x1f8e('0x1c')]:moment();var _0x2313e5=moment(_0x5504f6)['add'](_0x152424,_0x1f8e('0x25'));_0x34991e({'ret':_0x2313e5[_0x1f8e('0x1d')](_0x1f8e('0x26'))});}else _0x34991e({'ret':_0x5504f6});}else _0x34991e({'ret':_0x5504f6});}else{_0x34991e({'ret':_0x5504f6});}});}});return 0xa;}var _0x43722f=function(_0x3d078d){return new BPromise(function(_0x2f3170,_0x1d74bf){_0x326396(_0x3d078d,_0x506ff0)[_0x1f8e('0x21')](function(_0x5a77e9){_0x506ff0[_0x1f8e('0x1c')]=_0x5a77e9['ret'];_0x425819[_0x1f8e('0x27')][_0x1f8e('0x20')]({'where':{'phone':_0x506ff0[_0x1f8e('0xd')],'VoiceQueueId':_0x3d078d['id']}})[_0x1f8e('0x21')](function(_0x5577a2){if(!_[_0x1f8e('0x22')](_0x5577a2)){throw new Error(_0x1f8e('0x28')+_0x506ff0[_0x1f8e('0xd')]+_0x1f8e('0x29')+_0x3d078d['id']);}return _0x425819[_0x1f8e('0x27')][_0x1f8e('0x2a')]({'phone':_0x506ff0['phone'],'ContactId':_0x506ff0['id'],'ListId':_0x506ff0['ListId'],'priority':_0x506ff0[_0x1f8e('0x2b')]?_0x506ff0[_0x1f8e('0x2b')]:0x2,'scheduledat':_0x506ff0['scheduledat']?_0x506ff0[_0x1f8e('0x1c')]:moment()[_0x1f8e('0x1d')](_0x1f8e('0x26')),'callback':_0x506ff0[_0x1f8e('0x2c')]?!![]:![],'callbackuniqueid':_0x506ff0['callbackUniqueid']?_0x506ff0[_0x1f8e('0x2c')]:undefined,'callbackat':_0x506ff0['callbackUniqueid']?moment()[_0x1f8e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3d078d['id']});})[_0x1f8e('0x2d')](function(_0x2f5a1c){_0x1d74bf(_0x2f5a1c);});});});};var _0x57d345=function(_0x13ac7c){return new BPromise(function(_0x2e624e,_0x1bef36){_0x326396(_0x13ac7c,_0x506ff0)[_0x1f8e('0x21')](function(_0x4a87ca){_0x506ff0['scheduledat']=_0x4a87ca[_0x1f8e('0x2e')];_0x425819[_0x1f8e('0x27')][_0x1f8e('0x20')]({'where':{'phone':_0x506ff0['phone'],'VoiceQueueId':_0x13ac7c['id']}})[_0x1f8e('0x21')](function(_0x452074){if(!_[_0x1f8e('0x22')](_0x452074)){throw new Error(_0x1f8e('0x28')+_0x506ff0[_0x1f8e('0xd')]+_0x1f8e('0x2f')+_0x13ac7c['id']);}return _0x425819['CmHopperFinal'][_0x1f8e('0x20')]({'where':{'calleridnum':_0x506ff0[_0x1f8e('0xd')],'VoiceQueueId':_0x13ac7c['id']}});})[_0x1f8e('0x21')](function(_0x4962a8){if(!_[_0x1f8e('0x22')](_0x4962a8)){throw new Error(_0x1f8e('0x30')+_0x506ff0['phone']+_0x1f8e('0x31')+_0x13ac7c['id']);}return _0x425819[_0x1f8e('0x27')][_0x1f8e('0x2a')]({'phone':_0x506ff0[_0x1f8e('0xd')],'ContactId':_0x506ff0['id'],'ListId':_0x506ff0['ListId'],'priority':_0x506ff0[_0x1f8e('0x2b')]?_0x506ff0[_0x1f8e('0x2b')]:0x2,'scheduledat':_0x506ff0[_0x1f8e('0x1c')]?_0x506ff0[_0x1f8e('0x1c')]:moment()['format'](_0x1f8e('0x26')),'callback':_0x506ff0['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x506ff0['callbackUniqueid']?_0x506ff0[_0x1f8e('0x2c')]:undefined,'callbackat':_0x506ff0[_0x1f8e('0x2c')]?moment()[_0x1f8e('0x1d')](_0x1f8e('0x26')):undefined,'VoiceQueueId':_0x13ac7c['id']});})[_0x1f8e('0x2d')](function(_0x2da908){_0x1bef36(_0x2da908);});});});};function _0x5498bc(){return function(_0x5a42dc){logger[_0x1f8e('0x18')](_0x1f8e('0x19'),'afterCreate',util[_0x1f8e('0x1b')](_0x5a42dc,{'showHidden':![],'depth':null}));};}function _0x1108d5(_0x5e1619,_0x55e76f){var _0x16ac0c=_0x55e76f[_0x1f8e('0x1c')]?_0x55e76f[_0x1f8e('0x1c')]:moment()[_0x1f8e('0x1d')](_0x1f8e('0x26'));return new BPromise(function(_0x33d14d,_0x55ae50){if(_[_0x1f8e('0x22')](_0x55e76f['dialTimezone'])){_0x33d14d({'ret':_0x16ac0c});}else{_0x425819['Campaign'][_0x1f8e('0x20')]({'where':{'id':_0x5e1619['id']}})['then'](function(_0x4ae2ef){if(!_[_0x1f8e('0x22')](_0x4ae2ef)){var _0x1a9e9d=_0x4ae2ef['dialTimezone'];if(!_[_0x1f8e('0x22')](_0x1a9e9d)){var _0x3db572=shared[_0x1f8e('0x23')];var _0x4e41eb=_0x3db572[_0x1a9e9d];var _0x576952=_0x3db572[_0x55e76f['dialTimezone']];if(!_[_0x1f8e('0x22')](_0x4e41eb)&&!_['isNil'](_0x576952)){var _0x51f267=_0x4e41eb[_0x1f8e('0x24')]-_0x576952[_0x1f8e('0x24')];_0x16ac0c=_0x55e76f[_0x1f8e('0x1c')]?_0x55e76f[_0x1f8e('0x1c')]:moment();var _0x63f534=moment(_0x16ac0c)['add'](_0x51f267,_0x1f8e('0x25'));_0x33d14d({'ret':_0x63f534['format'](_0x1f8e('0x26'))});}else _0x33d14d({'ret':_0x16ac0c});}else _0x33d14d({'ret':_0x16ac0c});}else{_0x33d14d({'ret':_0x16ac0c});}});}});return 0xa;}var _0x51f7fa=function(_0x458a46){return new BPromise(function(_0x2e8b4e,_0x221609){_0x1108d5(_0x458a46,_0x506ff0)[_0x1f8e('0x21')](function(_0x5ac5ce){_0x506ff0[_0x1f8e('0x1c')]=_0x5ac5ce[_0x1f8e('0x2e')];_0x425819[_0x1f8e('0x27')][_0x1f8e('0x20')]({'where':{'phone':_0x506ff0[_0x1f8e('0xd')],'CampaignId':_0x458a46['id']}})[_0x1f8e('0x21')](function(_0x29665a){if(!_[_0x1f8e('0x22')](_0x29665a)){throw new Error('cmContact,\x20afterCreate\x20'+_0x506ff0[_0x1f8e('0xd')]+_0x1f8e('0x32')+_0x458a46['id']);}return _0x425819[_0x1f8e('0x27')][_0x1f8e('0x2a')]({'phone':_0x506ff0[_0x1f8e('0xd')],'ContactId':_0x506ff0['id'],'ListId':_0x506ff0[_0x1f8e('0x33')],'priority':_0x506ff0['priority']?_0x506ff0['priority']:0x2,'scheduledat':_0x506ff0[_0x1f8e('0x1c')]?_0x506ff0[_0x1f8e('0x1c')]:moment()[_0x1f8e('0x1d')](_0x1f8e('0x26')),'callback':_0x506ff0[_0x1f8e('0x2c')]?!![]:![],'callbackuniqueid':_0x506ff0['callbackUniqueid']?_0x506ff0[_0x1f8e('0x2c')]:undefined,'callbackat':_0x506ff0['callbackUniqueid']?moment()[_0x1f8e('0x1d')](_0x1f8e('0x26')):undefined,'CampaignId':_0x458a46['id']});})[_0x1f8e('0x2d')](function(_0x441d68){_0x221609(_0x441d68);});});});};var _0x550f67=function(_0x4344cd){return new BPromise(function(_0x176b85,_0x46cb99){_0x1108d5(_0x4344cd,_0x506ff0)[_0x1f8e('0x21')](function(_0x461aa5){_0x506ff0['scheduledat']=_0x461aa5[_0x1f8e('0x2e')];_0x425819[_0x1f8e('0x27')]['findOne']({'where':{'phone':_0x506ff0[_0x1f8e('0xd')],'CampaignId':_0x4344cd['id']}})[_0x1f8e('0x21')](function(_0x1e78db){if(!_[_0x1f8e('0x22')](_0x1e78db)){throw new Error('cmContact,\x20afterCreate\x20'+_0x506ff0[_0x1f8e('0xd')]+_0x1f8e('0x34')+_0x4344cd['id']);}return _0x425819[_0x1f8e('0x35')][_0x1f8e('0x20')]({'where':{'calleridnum':_0x506ff0['phone'],'CampaignId':_0x4344cd['id']}});})[_0x1f8e('0x21')](function(_0x3e98d4){if(!_['isNil'](_0x3e98d4)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x506ff0[_0x1f8e('0xd')]+_0x1f8e('0x36')+_0x4344cd['id']);}return _0x425819[_0x1f8e('0x27')][_0x1f8e('0x2a')]({'phone':_0x506ff0['phone'],'ContactId':_0x506ff0['id'],'ListId':_0x506ff0['ListId'],'priority':_0x506ff0[_0x1f8e('0x2b')]?_0x506ff0[_0x1f8e('0x2b')]:0x2,'scheduledat':_0x506ff0[_0x1f8e('0x1c')]?_0x506ff0[_0x1f8e('0x1c')]:moment()[_0x1f8e('0x1d')](_0x1f8e('0x26')),'callback':_0x506ff0[_0x1f8e('0x2c')]?!![]:![],'callbackuniqueid':_0x506ff0['callbackUniqueid']?_0x506ff0[_0x1f8e('0x2c')]:undefined,'callbackat':_0x506ff0[_0x1f8e('0x2c')]?moment()[_0x1f8e('0x1d')](_0x1f8e('0x26')):undefined,'CampaignId':_0x4344cd['id']});})[_0x1f8e('0x2d')](function(_0x2cfb9e){_0x46cb99(_0x2cfb9e);});});});};if(_0x506ff0[_0x1f8e('0x33')]){_0x425819[_0x1f8e('0x1f')][_0x1f8e('0x37')]({'where':{'type':_0x1f8e('0x38')},'attributes':['id',_0x1f8e('0x39'),_0x1f8e('0x1e')],'include':[{'model':_0x425819['CmList'],'as':_0x1f8e('0x3a'),'where':{'id':_0x506ff0['ListId']}}]})['then'](function(_0x24253c){if(_0x24253c){var _0x57e471=[];for(var _0x2a10c7=0x0,_0x221222;_0x2a10c7<_0x24253c[_0x1f8e('0x3b')];_0x2a10c7+=0x1){_0x221222=_0x24253c[_0x2a10c7]['get']({'plain':!![]});switch(_0x221222['dialCheckDuplicateType']){case'always':_0x57d345(_0x221222)[_0x1f8e('0x2d')](_0x3a0c0e());break;case _0x1f8e('0x3c'):_0x43722f(_0x221222)[_0x1f8e('0x2d')](_0x3a0c0e());break;default:_0x1108d5(_0x221222,_0x506ff0)[_0x1f8e('0x21')](function(_0x992642){_0x506ff0['scheduledat']=_0x992642['ret'];_0x425819['CmHopper']['create']({'phone':_0x506ff0[_0x1f8e('0xd')],'ContactId':_0x506ff0['id'],'ListId':_0x506ff0[_0x1f8e('0x33')],'scheduledat':_0x506ff0[_0x1f8e('0x1c')]?_0x506ff0[_0x1f8e('0x1c')]:moment()[_0x1f8e('0x1d')](_0x1f8e('0x26')),'priority':_0x506ff0[_0x1f8e('0x2b')]?_0x506ff0[_0x1f8e('0x2b')]:0x2,'callback':_0x506ff0[_0x1f8e('0x2c')]?!![]:![],'callbackuniqueid':_0x506ff0[_0x1f8e('0x2c')]?_0x506ff0[_0x1f8e('0x2c')]:undefined,'callbackat':_0x506ff0['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x221222['id']})['catch'](_0x3a0c0e());});}}}})[_0x1f8e('0x21')](function(){return _0x425819[_0x1f8e('0x1f')]['findAll']({'where':{'type':_0x1f8e('0x38')},'attributes':['id'],'include':[{'model':_0x425819[_0x1f8e('0x3d')],'as':'BlackLists','where':{'id':_0x506ff0[_0x1f8e('0x33')]}}]})[_0x1f8e('0x21')](function(_0x554233){if(_0x554233){var _0x3b8d93=[];for(var _0x2367e7=0x0,_0x1d08c9;_0x2367e7<_0x554233['length'];_0x2367e7+=0x1){_0x1d08c9=_0x554233[_0x2367e7][_0x1f8e('0x17')]({'plain':!![]});_0x425819[_0x1f8e('0x3e')][_0x1f8e('0x2a')]({'phone':_0x506ff0[_0x1f8e('0xd')],'ContactId':_0x506ff0['id'],'ListId':_0x506ff0[_0x1f8e('0x33')],'VoiceQueueId':_0x1d08c9['id']})[_0x1f8e('0x2d')](function(_0x5c97ec){logger[_0x1f8e('0x18')](_0x1f8e('0x3f'),_0x1f8e('0x1a'),_0x5c97ec[_0x1f8e('0x40')]);});}}});})[_0x1f8e('0x21')](function(){return _0x425819[_0x1f8e('0x41')][_0x1f8e('0x37')]({'attributes':['id',_0x1f8e('0x39'),_0x1f8e('0x1e')],'include':[{'model':_0x425819[_0x1f8e('0x3d')],'as':'Lists','where':{'id':_0x506ff0[_0x1f8e('0x33')]}}]})[_0x1f8e('0x21')](function(_0x4e4369){if(_0x4e4369){var _0x394e49=[];for(var _0x187132=0x0,_0x24fbf4;_0x187132<_0x4e4369['length'];_0x187132+=0x1){_0x24fbf4=_0x4e4369[_0x187132][_0x1f8e('0x17')]({'plain':!![]});switch(_0x24fbf4[_0x1f8e('0x39')]){case _0x1f8e('0x42'):_0x550f67(_0x24fbf4)[_0x1f8e('0x2d')](_0x5498bc());break;case _0x1f8e('0x3c'):_0x51f7fa(_0x24fbf4)[_0x1f8e('0x2d')](_0x5498bc());break;default:_0x425819[_0x1f8e('0x27')][_0x1f8e('0x2a')]({'phone':_0x506ff0[_0x1f8e('0xd')],'ContactId':_0x506ff0['id'],'ListId':_0x506ff0[_0x1f8e('0x33')],'scheduledat':_0x506ff0[_0x1f8e('0x1c')]?_0x506ff0[_0x1f8e('0x1c')]:moment()[_0x1f8e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x506ff0[_0x1f8e('0x2b')]?_0x506ff0[_0x1f8e('0x2b')]:0x2,'callback':_0x506ff0[_0x1f8e('0x2c')]?!![]:![],'callbackuniqueid':_0x506ff0[_0x1f8e('0x2c')]?_0x506ff0['callbackUniqueid']:undefined,'callbackat':_0x506ff0[_0x1f8e('0x2c')]?moment()[_0x1f8e('0x1d')](_0x1f8e('0x26')):undefined,'CampaignId':_0x24fbf4['id']})[_0x1f8e('0x2d')](_0x5498bc());}}}});})[_0x1f8e('0x21')](function(){return _0x425819[_0x1f8e('0x41')][_0x1f8e('0x37')]({'attributes':['id'],'include':[{'model':_0x425819[_0x1f8e('0x3d')],'as':_0x1f8e('0x43'),'where':{'id':_0x506ff0['ListId']}}]})[_0x1f8e('0x21')](function(_0x239c83){if(_0x239c83){var _0x47067e=[];for(var _0x151239=0x0,_0x3ad0e7;_0x151239<_0x239c83[_0x1f8e('0x3b')];_0x151239+=0x1){_0x3ad0e7=_0x239c83[_0x151239]['get']({'plain':!![]});_0x425819[_0x1f8e('0x3e')][_0x1f8e('0x2a')]({'phone':_0x506ff0[_0x1f8e('0xd')],'ContactId':_0x506ff0['id'],'ListId':_0x506ff0[_0x1f8e('0x33')],'CampaignId':_0x3ad0e7['id']})[_0x1f8e('0x2d')](function(_0x8a9712){logger[_0x1f8e('0x18')](_0x1f8e('0x3f'),'afterCreate',_0x8a9712[_0x1f8e('0x40')]);});}}});})['then'](function(){_0x3c0691();})[_0x1f8e('0x2d')](function(_0x3ca0f2){logger[_0x1f8e('0x18')](_0x1f8e('0x3f'),'afterCreate',_0x3ca0f2[_0x1f8e('0x40')]);_0x3c0691(_0x3ca0f2);});}else{_0x3c0691(new Error(_0x1f8e('0x44')));}},'afterDestroy':function(_0x54f266,_0x19cba4,_0x863c72){var _0x33e012=_0x3399c3[_0x1f8e('0x16')];var _0x52863e=_0x54f266[_0x1f8e('0x17')]({'plain':!![]});return _0x33e012['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x52863e[_0x1f8e('0x33')],'ContactId':_0x52863e['id']}})[_0x1f8e('0x21')](function(_0xa49f0d){if(!_['isEmpty'](_0xa49f0d)){var _0xbc5c0c=[];for(var _0xd63cab=0x0;_0xd63cab<_0xa49f0d[_0x1f8e('0x3b')];_0xd63cab+=0x1){var _0x10ab1e=_0x33e012[_0x1f8e('0x27')]['destroy']({'where':{'ListId':_0xa49f0d[_0xd63cab]['ListId'],'ContactId':_0xa49f0d[_0xd63cab][_0x1f8e('0x45')],'VoiceQueueId':_0xa49f0d[_0xd63cab][_0x1f8e('0x46')],'CampaignId':_0xa49f0d[_0xd63cab][_0x1f8e('0x47')]}});_0xbc5c0c[_0x1f8e('0x48')](_0x10ab1e);}return BPromise['all'](_0xbc5c0c);}})[_0x1f8e('0x21')](function(_0x422e9a){logger['info'](_0x1f8e('0x49'),util[_0x1f8e('0x1b')](_0x422e9a,{'showHidden':![],'depth':null}));_0x863c72();})[_0x1f8e('0x2d')](function(_0x58e39c){logger['error']('[CmContact][afterDestroy][Error]',util[_0x1f8e('0x1b')](_0x58e39c,{'showHidden':![],'depth':null}));_0x863c72(_0x58e39c);});}}});}; \ No newline at end of file +var _0xe2be=['error','cmContact','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','utcOffset','add','format','then','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','afterCreate','Campaign','timezones','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','length','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','./cmContact.attributes','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','email','utf8mb4','get'];(function(_0x9b26d6,_0x58533f){var _0x56d6e9=function(_0x5ebd89){while(--_0x5ebd89){_0x9b26d6['push'](_0x9b26d6['shift']());}};_0x56d6e9(++_0x58533f);}(_0xe2be,0x7e));var _0xee2b=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xe2be[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xee2b('0x0'));var util=require(_0xee2b('0x1'));var logger=require(_0xee2b('0x2'))(_0xee2b('0x3'));var moment=require('moment');var BPromise=require(_0xee2b('0x4'));var rp=require(_0xee2b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0xee2b('0x6'));module['exports']=function(_0x2a58be,_0x2c6afd){return _0x2a58be[_0xee2b('0x7')](_0xee2b('0x8'),attributes,{'tableName':_0xee2b('0x9'),'paranoid':!![],'indexes':[{'name':_0xee2b('0xa'),'fields':[_0xee2b('0xa')]},{'name':'fti_cm_contacts','fields':[_0xee2b('0xb'),_0xee2b('0xc'),_0xee2b('0xa'),_0xee2b('0xd'),_0xee2b('0xe'),_0xee2b('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xee2b('0x10'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x56f9a9,_0x35e1bc,_0x4ee06c){var _0xb3d00=_0x2a58be['models'];var _0x4837ed=_0x56f9a9[_0xee2b('0x11')]({'plain':!![]});function _0x54e9e4(){return function(_0x35565a){logger[_0xee2b('0x12')](_0xee2b('0x13'),'afterCreate',util[_0xee2b('0x14')](_0x35565a,{'showHidden':![],'depth':null}));};}function _0x526672(_0xe1744a,_0x591c20){var _0x31c02e=_0x591c20[_0xee2b('0x15')]?_0x591c20[_0xee2b('0x15')]:moment()['format'](_0xee2b('0x16'));return new BPromise(function(_0x5a9cd5,_0x411956){if(_[_0xee2b('0x17')](_0x591c20[_0xee2b('0x18')])){_0x5a9cd5({'ret':_0x31c02e});}else{_0xb3d00[_0xee2b('0x19')][_0xee2b('0x1a')]({'where':{'id':_0xe1744a['id']}})['then'](function(_0x397efc){if(!_['isNil'](_0x397efc)){var _0x231809=_0x397efc[_0xee2b('0x18')];if(!_[_0xee2b('0x17')](_0x231809)){var _0x5017ea=shared['timezones'];var _0x5b681a=_0x5017ea[_0x231809];var _0x360974=_0x5017ea[_0x591c20[_0xee2b('0x18')]];if(!_[_0xee2b('0x17')](_0x5b681a)&&!_['isNil'](_0x360974)){var _0x3aae3f=_0x5b681a['utcOffset']-_0x360974[_0xee2b('0x1b')];_0x31c02e=_0x591c20['scheduledat']?_0x591c20['scheduledat']:moment();var _0x50dc29=moment(_0x31c02e)[_0xee2b('0x1c')](_0x3aae3f,'minutes');_0x5a9cd5({'ret':_0x50dc29[_0xee2b('0x1d')](_0xee2b('0x16'))});}else _0x5a9cd5({'ret':_0x31c02e});}else _0x5a9cd5({'ret':_0x31c02e});}else{_0x5a9cd5({'ret':_0x31c02e});}});}});return 0xa;}var _0x2f8bbb=function(_0x5257b4){return new BPromise(function(_0x56c51e,_0x342b70){_0x526672(_0x5257b4,_0x4837ed)[_0xee2b('0x1e')](function(_0x5545b0){_0x4837ed[_0xee2b('0x15')]=_0x5545b0[_0xee2b('0x1f')];_0xb3d00[_0xee2b('0x20')][_0xee2b('0x1a')]({'where':{'phone':_0x4837ed[_0xee2b('0xa')],'VoiceQueueId':_0x5257b4['id']}})[_0xee2b('0x1e')](function(_0x4ca697){if(!_[_0xee2b('0x17')](_0x4ca697)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4837ed[_0xee2b('0xa')]+_0xee2b('0x21')+_0x5257b4['id']);}return _0xb3d00[_0xee2b('0x20')][_0xee2b('0x22')]({'phone':_0x4837ed['phone'],'ContactId':_0x4837ed['id'],'ListId':_0x4837ed['ListId'],'priority':_0x4837ed['priority']?_0x4837ed[_0xee2b('0x23')]:0x2,'scheduledat':_0x4837ed['scheduledat']?_0x4837ed[_0xee2b('0x15')]:moment()[_0xee2b('0x1d')](_0xee2b('0x16')),'callback':_0x4837ed[_0xee2b('0x24')]?!![]:![],'callbackuniqueid':_0x4837ed['callbackUniqueid']?_0x4837ed[_0xee2b('0x24')]:undefined,'callbackat':_0x4837ed['callbackUniqueid']?moment()[_0xee2b('0x1d')](_0xee2b('0x16')):undefined,'VoiceQueueId':_0x5257b4['id']});})[_0xee2b('0x25')](function(_0x34169a){_0x342b70(_0x34169a);});});});};var _0x5db987=function(_0x39ab51){return new BPromise(function(_0x55db1a,_0x2d95e5){_0x526672(_0x39ab51,_0x4837ed)[_0xee2b('0x1e')](function(_0x227822){_0x4837ed[_0xee2b('0x15')]=_0x227822['ret'];_0xb3d00[_0xee2b('0x20')]['findOne']({'where':{'phone':_0x4837ed[_0xee2b('0xa')],'VoiceQueueId':_0x39ab51['id']}})[_0xee2b('0x1e')](function(_0x4a29ef){if(!_[_0xee2b('0x17')](_0x4a29ef)){throw new Error(_0xee2b('0x26')+_0x4837ed[_0xee2b('0xa')]+_0xee2b('0x27')+_0x39ab51['id']);}return _0xb3d00['CmHopperFinal'][_0xee2b('0x1a')]({'where':{'calleridnum':_0x4837ed['phone'],'VoiceQueueId':_0x39ab51['id']}});})['then'](function(_0x688235){if(!_[_0xee2b('0x17')](_0x688235)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4837ed[_0xee2b('0xa')]+_0xee2b('0x28')+_0x39ab51['id']);}return _0xb3d00[_0xee2b('0x20')][_0xee2b('0x22')]({'phone':_0x4837ed[_0xee2b('0xa')],'ContactId':_0x4837ed['id'],'ListId':_0x4837ed[_0xee2b('0x29')],'priority':_0x4837ed[_0xee2b('0x23')]?_0x4837ed[_0xee2b('0x23')]:0x2,'scheduledat':_0x4837ed[_0xee2b('0x15')]?_0x4837ed['scheduledat']:moment()[_0xee2b('0x1d')](_0xee2b('0x16')),'callback':_0x4837ed['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4837ed[_0xee2b('0x24')]?_0x4837ed[_0xee2b('0x24')]:undefined,'callbackat':_0x4837ed[_0xee2b('0x24')]?moment()[_0xee2b('0x1d')](_0xee2b('0x16')):undefined,'VoiceQueueId':_0x39ab51['id']});})[_0xee2b('0x25')](function(_0x10956d){_0x2d95e5(_0x10956d);});});});};function _0x665187(){return function(_0x4427d4){logger[_0xee2b('0x12')](_0xee2b('0x13'),_0xee2b('0x2a'),util['inspect'](_0x4427d4,{'showHidden':![],'depth':null}));};}function _0x2aa99c(_0x16ec81,_0x5f21d0){var _0x2ec057=_0x5f21d0[_0xee2b('0x15')]?_0x5f21d0[_0xee2b('0x15')]:moment()[_0xee2b('0x1d')](_0xee2b('0x16'));return new BPromise(function(_0x14b863,_0x24be28){if(_['isNil'](_0x5f21d0[_0xee2b('0x18')])){_0x14b863({'ret':_0x2ec057});}else{_0xb3d00[_0xee2b('0x2b')][_0xee2b('0x1a')]({'where':{'id':_0x16ec81['id']}})[_0xee2b('0x1e')](function(_0x4a6670){if(!_[_0xee2b('0x17')](_0x4a6670)){var _0x2382d7=_0x4a6670['dialTimezone'];if(!_['isNil'](_0x2382d7)){var _0x58a2b4=shared[_0xee2b('0x2c')];var _0x414e37=_0x58a2b4[_0x2382d7];var _0x58560c=_0x58a2b4[_0x5f21d0[_0xee2b('0x18')]];if(!_[_0xee2b('0x17')](_0x414e37)&&!_[_0xee2b('0x17')](_0x58560c)){var _0x2c96f7=_0x414e37[_0xee2b('0x1b')]-_0x58560c[_0xee2b('0x1b')];_0x2ec057=_0x5f21d0[_0xee2b('0x15')]?_0x5f21d0[_0xee2b('0x15')]:moment();var _0x4dc02a=moment(_0x2ec057)[_0xee2b('0x1c')](_0x2c96f7,_0xee2b('0x2d'));_0x14b863({'ret':_0x4dc02a[_0xee2b('0x1d')](_0xee2b('0x16'))});}else _0x14b863({'ret':_0x2ec057});}else _0x14b863({'ret':_0x2ec057});}else{_0x14b863({'ret':_0x2ec057});}});}});return 0xa;}var _0x3a39fe=function(_0x64e797){return new BPromise(function(_0x19fc55,_0x54724a){_0x2aa99c(_0x64e797,_0x4837ed)['then'](function(_0x5be343){_0x4837ed[_0xee2b('0x15')]=_0x5be343['ret'];_0xb3d00[_0xee2b('0x20')][_0xee2b('0x1a')]({'where':{'phone':_0x4837ed['phone'],'CampaignId':_0x64e797['id']}})[_0xee2b('0x1e')](function(_0xf9db44){if(!_[_0xee2b('0x17')](_0xf9db44)){throw new Error(_0xee2b('0x26')+_0x4837ed[_0xee2b('0xa')]+_0xee2b('0x2e')+_0x64e797['id']);}return _0xb3d00[_0xee2b('0x20')][_0xee2b('0x22')]({'phone':_0x4837ed[_0xee2b('0xa')],'ContactId':_0x4837ed['id'],'ListId':_0x4837ed[_0xee2b('0x29')],'priority':_0x4837ed[_0xee2b('0x23')]?_0x4837ed[_0xee2b('0x23')]:0x2,'scheduledat':_0x4837ed[_0xee2b('0x15')]?_0x4837ed[_0xee2b('0x15')]:moment()[_0xee2b('0x1d')](_0xee2b('0x16')),'callback':_0x4837ed[_0xee2b('0x24')]?!![]:![],'callbackuniqueid':_0x4837ed['callbackUniqueid']?_0x4837ed[_0xee2b('0x24')]:undefined,'callbackat':_0x4837ed[_0xee2b('0x24')]?moment()[_0xee2b('0x1d')](_0xee2b('0x16')):undefined,'CampaignId':_0x64e797['id']});})[_0xee2b('0x25')](function(_0x4f83ae){_0x54724a(_0x4f83ae);});});});};var _0x53d040=function(_0x172e24){return new BPromise(function(_0x1f54be,_0x5ae0f9){_0x2aa99c(_0x172e24,_0x4837ed)[_0xee2b('0x1e')](function(_0x1ed19b){_0x4837ed[_0xee2b('0x15')]=_0x1ed19b[_0xee2b('0x1f')];_0xb3d00[_0xee2b('0x20')]['findOne']({'where':{'phone':_0x4837ed['phone'],'CampaignId':_0x172e24['id']}})[_0xee2b('0x1e')](function(_0x1422da){if(!_[_0xee2b('0x17')](_0x1422da)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4837ed['phone']+_0xee2b('0x2f')+_0x172e24['id']);}return _0xb3d00[_0xee2b('0x30')]['findOne']({'where':{'calleridnum':_0x4837ed[_0xee2b('0xa')],'CampaignId':_0x172e24['id']}});})[_0xee2b('0x1e')](function(_0x407d59){if(!_[_0xee2b('0x17')](_0x407d59)){throw new Error(_0xee2b('0x31')+_0x4837ed[_0xee2b('0xa')]+_0xee2b('0x32')+_0x172e24['id']);}return _0xb3d00[_0xee2b('0x20')]['create']({'phone':_0x4837ed['phone'],'ContactId':_0x4837ed['id'],'ListId':_0x4837ed[_0xee2b('0x29')],'priority':_0x4837ed[_0xee2b('0x23')]?_0x4837ed[_0xee2b('0x23')]:0x2,'scheduledat':_0x4837ed[_0xee2b('0x15')]?_0x4837ed[_0xee2b('0x15')]:moment()['format'](_0xee2b('0x16')),'callback':_0x4837ed[_0xee2b('0x24')]?!![]:![],'callbackuniqueid':_0x4837ed['callbackUniqueid']?_0x4837ed['callbackUniqueid']:undefined,'callbackat':_0x4837ed['callbackUniqueid']?moment()[_0xee2b('0x1d')](_0xee2b('0x16')):undefined,'CampaignId':_0x172e24['id']});})['catch'](function(_0x303efa){_0x5ae0f9(_0x303efa);});});});};if(_0x4837ed[_0xee2b('0x29')]){_0xb3d00[_0xee2b('0x19')][_0xee2b('0x33')]({'where':{'type':_0xee2b('0x34')},'attributes':['id',_0xee2b('0x35'),_0xee2b('0x18')],'include':[{'model':_0xb3d00[_0xee2b('0x36')],'as':_0xee2b('0x37'),'where':{'id':_0x4837ed['ListId']}}]})['then'](function(_0xa5a38b){if(_0xa5a38b){var _0x20a7d8=[];for(var _0x3a0ff2=0x0,_0x401502;_0x3a0ff2<_0xa5a38b['length'];_0x3a0ff2+=0x1){_0x401502=_0xa5a38b[_0x3a0ff2][_0xee2b('0x11')]({'plain':!![]});switch(_0x401502[_0xee2b('0x35')]){case'always':_0x5db987(_0x401502)['catch'](_0x54e9e4());break;case _0xee2b('0x38'):_0x2f8bbb(_0x401502)[_0xee2b('0x25')](_0x54e9e4());break;default:_0x2aa99c(_0x401502,_0x4837ed)[_0xee2b('0x1e')](function(_0x42087c){_0x4837ed[_0xee2b('0x15')]=_0x42087c[_0xee2b('0x1f')];_0xb3d00['CmHopper'][_0xee2b('0x22')]({'phone':_0x4837ed['phone'],'ContactId':_0x4837ed['id'],'ListId':_0x4837ed[_0xee2b('0x29')],'scheduledat':_0x4837ed[_0xee2b('0x15')]?_0x4837ed['scheduledat']:moment()[_0xee2b('0x1d')](_0xee2b('0x16')),'priority':_0x4837ed['priority']?_0x4837ed[_0xee2b('0x23')]:0x2,'callback':_0x4837ed['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4837ed['callbackUniqueid']?_0x4837ed[_0xee2b('0x24')]:undefined,'callbackat':_0x4837ed[_0xee2b('0x24')]?moment()[_0xee2b('0x1d')](_0xee2b('0x16')):undefined,'VoiceQueueId':_0x401502['id']})[_0xee2b('0x25')](_0x54e9e4());});}}}})[_0xee2b('0x1e')](function(){return _0xb3d00['VoiceQueue']['findAll']({'where':{'type':_0xee2b('0x34')},'attributes':['id'],'include':[{'model':_0xb3d00[_0xee2b('0x36')],'as':_0xee2b('0x39'),'where':{'id':_0x4837ed[_0xee2b('0x29')]}}]})[_0xee2b('0x1e')](function(_0x20b28a){if(_0x20b28a){var _0x1448df=[];for(var _0x1da935=0x0,_0x1050dd;_0x1da935<_0x20b28a['length'];_0x1da935+=0x1){_0x1050dd=_0x20b28a[_0x1da935][_0xee2b('0x11')]({'plain':!![]});_0xb3d00['CmHopperBlack'][_0xee2b('0x22')]({'phone':_0x4837ed[_0xee2b('0xa')],'ContactId':_0x4837ed['id'],'ListId':_0x4837ed[_0xee2b('0x29')],'VoiceQueueId':_0x1050dd['id']})['catch'](function(_0xfa9d55){logger['error'](_0xee2b('0x3a'),'afterCreate',_0xfa9d55[_0xee2b('0x3b')]);});}}});})[_0xee2b('0x1e')](function(){return _0xb3d00[_0xee2b('0x2b')][_0xee2b('0x33')]({'attributes':['id',_0xee2b('0x35'),_0xee2b('0x18')],'include':[{'model':_0xb3d00['CmList'],'as':_0xee2b('0x37'),'where':{'id':_0x4837ed['ListId']}}]})[_0xee2b('0x1e')](function(_0x42cc88){if(_0x42cc88){var _0x1c6a92=[];for(var _0x53fabb=0x0,_0x118c57;_0x53fabb<_0x42cc88[_0xee2b('0x3c')];_0x53fabb+=0x1){_0x118c57=_0x42cc88[_0x53fabb]['get']({'plain':!![]});switch(_0x118c57['dialCheckDuplicateType']){case'always':_0x53d040(_0x118c57)[_0xee2b('0x25')](_0x665187());break;case _0xee2b('0x38'):_0x3a39fe(_0x118c57)['catch'](_0x665187());break;default:_0xb3d00[_0xee2b('0x20')][_0xee2b('0x22')]({'phone':_0x4837ed[_0xee2b('0xa')],'ContactId':_0x4837ed['id'],'ListId':_0x4837ed[_0xee2b('0x29')],'scheduledat':_0x4837ed[_0xee2b('0x15')]?_0x4837ed[_0xee2b('0x15')]:moment()[_0xee2b('0x1d')](_0xee2b('0x16')),'priority':_0x4837ed[_0xee2b('0x23')]?_0x4837ed[_0xee2b('0x23')]:0x2,'callback':_0x4837ed[_0xee2b('0x24')]?!![]:![],'callbackuniqueid':_0x4837ed[_0xee2b('0x24')]?_0x4837ed[_0xee2b('0x24')]:undefined,'callbackat':_0x4837ed[_0xee2b('0x24')]?moment()[_0xee2b('0x1d')](_0xee2b('0x16')):undefined,'CampaignId':_0x118c57['id']})[_0xee2b('0x25')](_0x665187());}}}});})[_0xee2b('0x1e')](function(){return _0xb3d00[_0xee2b('0x2b')][_0xee2b('0x33')]({'attributes':['id'],'include':[{'model':_0xb3d00[_0xee2b('0x36')],'as':_0xee2b('0x39'),'where':{'id':_0x4837ed[_0xee2b('0x29')]}}]})[_0xee2b('0x1e')](function(_0x2fba3c){if(_0x2fba3c){var _0x117e32=[];for(var _0x3537e0=0x0,_0x1c137e;_0x3537e0<_0x2fba3c[_0xee2b('0x3c')];_0x3537e0+=0x1){_0x1c137e=_0x2fba3c[_0x3537e0][_0xee2b('0x11')]({'plain':!![]});_0xb3d00['CmHopperBlack'][_0xee2b('0x22')]({'phone':_0x4837ed[_0xee2b('0xa')],'ContactId':_0x4837ed['id'],'ListId':_0x4837ed[_0xee2b('0x29')],'CampaignId':_0x1c137e['id']})[_0xee2b('0x25')](function(_0x5490da){logger[_0xee2b('0x12')](_0xee2b('0x3a'),_0xee2b('0x2a'),_0x5490da[_0xee2b('0x3b')]);});}}});})[_0xee2b('0x1e')](function(){_0x4ee06c();})[_0xee2b('0x25')](function(_0x40f1ec){logger['error'](_0xee2b('0x3a'),'afterCreate',_0x40f1ec[_0xee2b('0x3b')]);_0x4ee06c(_0x40f1ec);});}else{_0x4ee06c(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x1157df,_0x3e1ea1,_0x4c64b7){var _0x5074b0=_0x2a58be[_0xee2b('0x3d')];var _0x1e0015=_0x1157df[_0xee2b('0x11')]({'plain':!![]});return _0x5074b0[_0xee2b('0x20')][_0xee2b('0x33')]({'raw':!![],'where':{'ListId':_0x1e0015['ListId'],'ContactId':_0x1e0015['id']}})[_0xee2b('0x1e')](function(_0x5ed8fe){if(!_[_0xee2b('0x3e')](_0x5ed8fe)){var _0x12f4c6=[];for(var _0x2818cf=0x0;_0x2818cf<_0x5ed8fe[_0xee2b('0x3c')];_0x2818cf+=0x1){var _0xe16431=_0x5074b0[_0xee2b('0x20')][_0xee2b('0x3f')]({'where':{'ListId':_0x5ed8fe[_0x2818cf][_0xee2b('0x29')],'ContactId':_0x5ed8fe[_0x2818cf][_0xee2b('0x40')],'VoiceQueueId':_0x5ed8fe[_0x2818cf][_0xee2b('0x41')],'CampaignId':_0x5ed8fe[_0x2818cf][_0xee2b('0x42')]}});_0x12f4c6[_0xee2b('0x43')](_0xe16431);}return BPromise[_0xee2b('0x44')](_0x12f4c6);}})[_0xee2b('0x1e')](function(_0x4659ce){logger[_0xee2b('0x45')](_0xee2b('0x46'),util[_0xee2b('0x14')](_0x4659ce,{'showHidden':![],'depth':null}));_0x4c64b7();})[_0xee2b('0x25')](function(_0x3b81d8){logger[_0xee2b('0x12')](_0xee2b('0x47'),util[_0xee2b('0x14')](_0x3b81d8,{'showHidden':![],'depth':null}));_0x4c64b7(_0x3b81d8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 05c93f6..27120e7 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x46b96f,_0x17493f){var _0x3931c5=function(_0x5566e6){while(--_0x5566e6){_0x46b96f['push'](_0x46b96f['shift']());}};_0x3931c5(++_0x17493f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index c7ad3df..3f27c91 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe148=['STRING','INTEGER','PHONE','sequelize','exports'];(function(_0x3847d0,_0x12103c){var _0x25c6ea=function(_0x2668b9){while(--_0x2668b9){_0x3847d0['push'](_0x3847d0['shift']());}};_0x25c6ea(++_0x12103c);}(_0xe148,0x9e));var _0x8e14=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0xe148[_0x16db8b];return _0x5ba017;};'use strict';var Sequelize=require(_0x8e14('0x0'));module[_0x8e14('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x8e14('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x8e14('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x8e14('0x4')},'OrderBy':{'type':Sequelize[_0x8e14('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x8e14('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x222f=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x222f,0x1a4));var _0xf222=function(_0x3d7f0e,_0x104d69){_0x3d7f0e=_0x3d7f0e-0x0;var _0x3e45dd=_0x222f[_0x3d7f0e];return _0x3e45dd;};'use strict';var Sequelize=require(_0xf222('0x0'));module[_0xf222('0x1')]={'CmContactId':{'type':Sequelize[_0xf222('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xf222('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xf222('0x4')},'OrderBy':{'type':Sequelize[_0xf222('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xf222('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index ade6303..22fcc22 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83c8=['json','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','CmContactHasItem','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x3c0ab8,_0x3664ba){var _0x2dfb07=function(_0x52590e){while(--_0x52590e){_0x3c0ab8['push'](_0x3c0ab8['shift']());}};_0x2dfb07(++_0x3664ba);}(_0x83c8,0x84));var _0x883c=function(_0xc3b595,_0x4108fd){_0xc3b595=_0xc3b595-0x0;var _0x26befa=_0x83c8[_0xc3b595];return _0x26befa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x883c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x883c('0x1'));var rp=require(_0x883c('0x2'));var moment=require('moment');var BPromise=require(_0x883c('0x3'));var Mustache=require(_0x883c('0x4'));var util=require(_0x883c('0x5'));var path=require(_0x883c('0x6'));var sox=require(_0x883c('0x7'));var csv=require(_0x883c('0x8'));var ejs=require(_0x883c('0x9'));var fs=require('fs');var fs_extra=require(_0x883c('0xa'));var _=require('lodash');var squel=require(_0x883c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x883c('0xc'));var toCsv=require(_0x883c('0x8'));var querystring=require(_0x883c('0xd'));var Papa=require(_0x883c('0xe'));var Redis=require(_0x883c('0xf'));var authService=require(_0x883c('0x10'));var qs=require(_0x883c('0x11'));var as=require(_0x883c('0x12'));var hardwareService=require(_0x883c('0x13'));var logger=require(_0x883c('0x14'))('api');var utils=require(_0x883c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x883c('0x16'))['db'];function respondWithStatusCode(_0x27fdbb,_0x44e9f1){_0x44e9f1=_0x44e9f1||0xcc;return function(_0x340762){if(_0x340762){return _0x27fdbb[_0x883c('0x17')](_0x44e9f1);}return _0x27fdbb[_0x883c('0x18')](_0x44e9f1)[_0x883c('0x19')]();};}function respondWithResult(_0x13ea90,_0x4b96fe){_0x4b96fe=_0x4b96fe||0xc8;return function(_0x4fa4d3){if(_0x4fa4d3){return _0x13ea90[_0x883c('0x18')](_0x4b96fe)['json'](_0x4fa4d3);}};}function respondWithFilteredResult(_0x3ac506,_0x5a2865){return function(_0x479264){if(_0x479264){var _0x470819=typeof _0x5a2865[_0x883c('0x1a')]===_0x883c('0x1b')&&typeof _0x5a2865[_0x883c('0x1c')]===_0x883c('0x1b');var _0x9fa27e=_0x479264[_0x883c('0x1d')];var _0x14c408=_0x470819?0x0:_0x5a2865[_0x883c('0x1a')];var _0xe255e9=_0x470819?_0x479264[_0x883c('0x1d')]:_0x5a2865['offset']+_0x5a2865['limit'];var _0x30982b;if(_0xe255e9>=_0x9fa27e){_0xe255e9=_0x9fa27e;_0x30982b=0xc8;}else{_0x30982b=0xce;}_0x3ac506[_0x883c('0x18')](_0x30982b);return _0x3ac506[_0x883c('0x1e')](_0x883c('0x1f'),_0x14c408+'-'+_0xe255e9+'/'+_0x9fa27e)[_0x883c('0x20')](_0x479264);}return null;};}function patchUpdates(_0x5a41e5){return function(_0x24916b){try{jsonpatch['apply'](_0x24916b,_0x5a41e5,!![]);}catch(_0x8fccaf){return BPromise[_0x883c('0x21')](_0x8fccaf);}return _0x24916b[_0x883c('0x22')]();};}function saveUpdates(_0x858ff4,_0x526aa3){return function(_0x138e8c){if(_0x138e8c){return _0x138e8c[_0x883c('0x23')](_0x858ff4)[_0x883c('0x24')](function(_0x492854){return _0x492854;});}return null;};}function removeEntity(_0x35cc44,_0x20e427){return function(_0x1f75c6){if(_0x1f75c6){return _0x1f75c6[_0x883c('0x25')]()['then'](function(){var _0x255b40=_0x1f75c6[_0x883c('0x26')]({'plain':!![]});var _0xa474ed=_0x883c('0x27');return db[_0x883c('0x28')][_0x883c('0x25')]({'where':{'type':_0xa474ed,'resourceId':_0x255b40['id']}})[_0x883c('0x24')](function(){return _0x1f75c6;});})['then'](function(){_0x35cc44[_0x883c('0x18')](0xcc)[_0x883c('0x19')]();});}};}function handleEntityNotFound(_0x475d72,_0x25e2f1){return function(_0x2fc9e6){if(!_0x2fc9e6){_0x475d72[_0x883c('0x17')](0x194);}return _0x2fc9e6;};}function handleError(_0x3c0edb,_0x5cfa86){_0x5cfa86=_0x5cfa86||0x1f4;return function(_0x29907f){logger[_0x883c('0x29')](_0x29907f['stack']);if(_0x29907f[_0x883c('0x2a')]){delete _0x29907f[_0x883c('0x2a')];}_0x3c0edb[_0x883c('0x18')](_0x5cfa86)[_0x883c('0x2b')](_0x29907f);};}exports[_0x883c('0x2c')]=function(_0x145db0,_0x376699){var _0x374ed7={},_0x2ce00f={},_0x4916d5={'count':0x0,'rows':[]};var _0x159115=_[_0x883c('0x2d')](db['CmContactHasItem']['rawAttributes'],function(_0x32f9b5){return{'name':_0x32f9b5[_0x883c('0x2e')],'type':_0x32f9b5[_0x883c('0x2f')][_0x883c('0x30')]};});_0x2ce00f['model']=_[_0x883c('0x2d')](_0x159115,_0x883c('0x2a'));_0x2ce00f[_0x883c('0x31')]=_[_0x883c('0x32')](_0x145db0[_0x883c('0x31')]);_0x2ce00f[_0x883c('0x33')]=_['intersection'](_0x2ce00f['model'],_0x2ce00f[_0x883c('0x31')]);_0x374ed7[_0x883c('0x34')]=_[_0x883c('0x35')](_0x2ce00f['model'],qs[_0x883c('0x36')](_0x145db0[_0x883c('0x31')][_0x883c('0x36')]));_0x374ed7[_0x883c('0x34')]=_0x374ed7[_0x883c('0x34')][_0x883c('0x37')]?_0x374ed7[_0x883c('0x34')]:_0x2ce00f[_0x883c('0x38')];if(!_0x145db0['query'][_0x883c('0x39')]('nolimit')){_0x374ed7['limit']=qs['limit'](_0x145db0['query'][_0x883c('0x1c')]);_0x374ed7[_0x883c('0x1a')]=qs[_0x883c('0x1a')](_0x145db0[_0x883c('0x31')][_0x883c('0x1a')]);}_0x374ed7['order']=qs[_0x883c('0x3a')](_0x145db0[_0x883c('0x31')][_0x883c('0x3a')]);_0x374ed7[_0x883c('0x3b')]=qs[_0x883c('0x33')](_[_0x883c('0x3c')](_0x145db0[_0x883c('0x31')],_0x2ce00f['filters']),_0x159115);if(_0x145db0[_0x883c('0x31')][_0x883c('0x3d')]){_0x374ed7[_0x883c('0x3b')]=_[_0x883c('0x3e')](_0x374ed7[_0x883c('0x3b')],{'$or':_[_0x883c('0x2d')](_0x159115,function(_0x3e427c){if(_0x3e427c[_0x883c('0x2f')]!==_0x883c('0x3f')){var _0x2aa7e7={};_0x2aa7e7[_0x3e427c[_0x883c('0x2a')]]={'$like':'%'+_0x145db0[_0x883c('0x31')][_0x883c('0x3d')]+'%'};return _0x2aa7e7;}})});}_0x374ed7=_[_0x883c('0x3e')]({},_0x374ed7,_0x145db0[_0x883c('0x40')]);var _0x50a8e2={'where':_0x374ed7[_0x883c('0x3b')]};return db[_0x883c('0x41')]['count'](_0x50a8e2)['then'](function(_0x58b718){_0x4916d5[_0x883c('0x1d')]=_0x58b718;if(_0x145db0[_0x883c('0x31')]['includeAll']){_0x374ed7[_0x883c('0x42')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x374ed7);})[_0x883c('0x24')](function(_0x3cf987){_0x4916d5[_0x883c('0x43')]=_0x3cf987;return _0x4916d5;})[_0x883c('0x24')](respondWithFilteredResult(_0x376699,_0x374ed7))[_0x883c('0x44')](handleError(_0x376699,null));};exports[_0x883c('0x45')]=function(_0x1d0473,_0x5724fe){var _0x3b5ac3={'raw':!![],'where':{'id':_0x1d0473[_0x883c('0x46')]['id']}},_0x27b345={};_0x27b345['model']=_[_0x883c('0x32')](db['CmContactHasItem'][_0x883c('0x47')]);_0x27b345['query']=_[_0x883c('0x32')](_0x1d0473[_0x883c('0x31')]);_0x27b345[_0x883c('0x33')]=_[_0x883c('0x35')](_0x27b345[_0x883c('0x38')],_0x27b345['query']);_0x3b5ac3[_0x883c('0x34')]=_[_0x883c('0x35')](_0x27b345['model'],qs['fields'](_0x1d0473['query'][_0x883c('0x36')]));_0x3b5ac3[_0x883c('0x34')]=_0x3b5ac3[_0x883c('0x34')][_0x883c('0x37')]?_0x3b5ac3[_0x883c('0x34')]:_0x27b345[_0x883c('0x38')];if(_0x1d0473[_0x883c('0x31')][_0x883c('0x48')]){_0x3b5ac3['include']=[{'all':!![]}];}_0x3b5ac3=_['merge']({},_0x3b5ac3,_0x1d0473[_0x883c('0x40')]);return db['CmContactHasItem'][_0x883c('0x49')](_0x3b5ac3)['then'](handleEntityNotFound(_0x5724fe,null))[_0x883c('0x24')](respondWithResult(_0x5724fe,null))['catch'](handleError(_0x5724fe,null));};exports['create']=function(_0x395be5,_0x5ed241){return db[_0x883c('0x41')][_0x883c('0x4a')](_0x395be5[_0x883c('0x4b')],{})['then'](function(_0x52786e){var _0x263a9c=_0x395be5[_0x883c('0x4c')][_0x883c('0x26')]({'plain':!![]});if(!_0x263a9c)throw new Error(_0x883c('0x4d'));if(_0x263a9c[_0x883c('0x4e')]===_0x883c('0x4c')){var _0x509d27=_0x52786e['get']({'plain':!![]});var _0x41d5af=_0x883c('0x27');return db[_0x883c('0x4f')]['find']({'where':{'name':_0x41d5af,'userProfileId':_0x263a9c['userProfileId']},'raw':!![]})[_0x883c('0x24')](function(_0x55df28){if(_0x55df28&&_0x55df28[_0x883c('0x50')]===0x0){return db[_0x883c('0x28')][_0x883c('0x4a')]({'name':_0x509d27[_0x883c('0x2a')],'resourceId':_0x509d27['id'],'type':_0x55df28[_0x883c('0x2a')],'sectionId':_0x55df28['id']},{})[_0x883c('0x24')](function(){return _0x52786e;});}else{return _0x52786e;}})[_0x883c('0x44')](function(_0x118e23){logger[_0x883c('0x29')](_0x883c('0x51'),_0x118e23);throw _0x118e23;});}return _0x52786e;})[_0x883c('0x24')](respondWithResult(_0x5ed241,0xc9))[_0x883c('0x44')](handleError(_0x5ed241,null));};exports['update']=function(_0x4fa332,_0x4f7a80){if(_0x4fa332[_0x883c('0x4b')]['id']){delete _0x4fa332[_0x883c('0x4b')]['id'];}return db[_0x883c('0x41')][_0x883c('0x49')]({'where':{'id':_0x4fa332[_0x883c('0x46')]['id']}})[_0x883c('0x24')](handleEntityNotFound(_0x4f7a80,null))[_0x883c('0x24')](saveUpdates(_0x4fa332[_0x883c('0x4b')],null))[_0x883c('0x24')](respondWithResult(_0x4f7a80,null))[_0x883c('0x44')](handleError(_0x4f7a80,null));};exports[_0x883c('0x25')]=function(_0x2c3c86,_0x48c581){return db[_0x883c('0x41')][_0x883c('0x49')]({'where':{'id':_0x2c3c86[_0x883c('0x46')]['id']}})[_0x883c('0x24')](handleEntityNotFound(_0x48c581,null))[_0x883c('0x24')](removeEntity(_0x48c581,null))[_0x883c('0x44')](handleError(_0x48c581,null));}; \ No newline at end of file +var _0x1e02=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','length','include','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params'];(function(_0x93872e,_0x37f470){var _0x4a6ff1=function(_0x2e6117){while(--_0x2e6117){_0x93872e['push'](_0x93872e['shift']());}};_0x4a6ff1(++_0x37f470);}(_0x1e02,0x1b3));var _0x21e0=function(_0x2cec0c,_0x12c5c9){_0x2cec0c=_0x2cec0c-0x0;var _0x15fa2a=_0x1e02[_0x2cec0c];return _0x15fa2a;};'use strict';var emlformat=require(_0x21e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21e0('0x1'));var jsonpatch=require(_0x21e0('0x2'));var rp=require(_0x21e0('0x3'));var moment=require(_0x21e0('0x4'));var BPromise=require(_0x21e0('0x5'));var Mustache=require('mustache');var util=require(_0x21e0('0x6'));var path=require(_0x21e0('0x7'));var sox=require(_0x21e0('0x8'));var csv=require(_0x21e0('0x9'));var ejs=require(_0x21e0('0xa'));var fs=require('fs');var fs_extra=require(_0x21e0('0xb'));var _=require(_0x21e0('0xc'));var squel=require(_0x21e0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x21e0('0xe'));var toCsv=require(_0x21e0('0x9'));var querystring=require(_0x21e0('0xf'));var Papa=require(_0x21e0('0x10'));var Redis=require(_0x21e0('0x11'));var authService=require(_0x21e0('0x12'));var qs=require(_0x21e0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21e0('0x14'));var logger=require(_0x21e0('0x15'))(_0x21e0('0x16'));var utils=require('../../config/utils');var config=require(_0x21e0('0x17'));var licenseUtil=require(_0x21e0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41f3b5,_0xce529f){_0xce529f=_0xce529f||0xcc;return function(_0x1df467){if(_0x1df467){return _0x41f3b5[_0x21e0('0x19')](_0xce529f);}return _0x41f3b5['status'](_0xce529f)[_0x21e0('0x1a')]();};}function respondWithResult(_0x4ad4f7,_0x24a4ea){_0x24a4ea=_0x24a4ea||0xc8;return function(_0x561e47){if(_0x561e47){return _0x4ad4f7[_0x21e0('0x1b')](_0x24a4ea)['json'](_0x561e47);}};}function respondWithFilteredResult(_0xd4676d,_0x3a8cb3){return function(_0x3b4c9a){if(_0x3b4c9a){var _0x4601e6=typeof _0x3a8cb3[_0x21e0('0x1c')]===_0x21e0('0x1d')&&typeof _0x3a8cb3[_0x21e0('0x1e')]===_0x21e0('0x1d');var _0x4b2186=_0x3b4c9a[_0x21e0('0x1f')];var _0x5b839f=_0x4601e6?0x0:_0x3a8cb3['offset'];var _0xd032d3=_0x4601e6?_0x3b4c9a[_0x21e0('0x1f')]:_0x3a8cb3[_0x21e0('0x1c')]+_0x3a8cb3[_0x21e0('0x1e')];var _0x2a560b;if(_0xd032d3>=_0x4b2186){_0xd032d3=_0x4b2186;_0x2a560b=0xc8;}else{_0x2a560b=0xce;}_0xd4676d[_0x21e0('0x1b')](_0x2a560b);return _0xd4676d[_0x21e0('0x20')]('Content-Range',_0x5b839f+'-'+_0xd032d3+'/'+_0x4b2186)[_0x21e0('0x21')](_0x3b4c9a);}return null;};}function patchUpdates(_0x3decc6){return function(_0x23e982){try{jsonpatch[_0x21e0('0x22')](_0x23e982,_0x3decc6,!![]);}catch(_0x569972){return BPromise[_0x21e0('0x23')](_0x569972);}return _0x23e982[_0x21e0('0x24')]();};}function saveUpdates(_0xdb9ecf,_0x3d7e54){return function(_0x14917e){if(_0x14917e){return _0x14917e[_0x21e0('0x25')](_0xdb9ecf)[_0x21e0('0x26')](function(_0x554afe){return _0x554afe;});}return null;};}function removeEntity(_0x2dcf47,_0x34065b){return function(_0x18b789){if(_0x18b789){return _0x18b789[_0x21e0('0x27')]()[_0x21e0('0x26')](function(){var _0x578ae7=_0x18b789[_0x21e0('0x28')]({'plain':!![]});var _0x2e964d=_0x21e0('0x29');return db[_0x21e0('0x2a')][_0x21e0('0x27')]({'where':{'type':_0x2e964d,'resourceId':_0x578ae7['id']}})[_0x21e0('0x26')](function(){return _0x18b789;});})[_0x21e0('0x26')](function(){_0x2dcf47[_0x21e0('0x1b')](0xcc)[_0x21e0('0x1a')]();});}};}function handleEntityNotFound(_0x29cf92,_0x581aaf){return function(_0xaa1540){if(!_0xaa1540){_0x29cf92[_0x21e0('0x19')](0x194);}return _0xaa1540;};}function handleError(_0x19b00f,_0x5b52f5){_0x5b52f5=_0x5b52f5||0x1f4;return function(_0x354fcb){logger[_0x21e0('0x2b')](_0x354fcb[_0x21e0('0x2c')]);if(_0x354fcb[_0x21e0('0x2d')]){delete _0x354fcb[_0x21e0('0x2d')];}_0x19b00f[_0x21e0('0x1b')](_0x5b52f5)[_0x21e0('0x2e')](_0x354fcb);};}exports[_0x21e0('0x2f')]=function(_0x10a12d,_0x52a620){var _0xef026a={},_0x30b93f={},_0x49e216={'count':0x0,'rows':[]};var _0x2034bf=_[_0x21e0('0x30')](db[_0x21e0('0x31')][_0x21e0('0x32')],function(_0x4ab491){return{'name':_0x4ab491[_0x21e0('0x33')],'type':_0x4ab491[_0x21e0('0x34')][_0x21e0('0x35')]};});_0x30b93f[_0x21e0('0x36')]=_[_0x21e0('0x30')](_0x2034bf,'name');_0x30b93f[_0x21e0('0x37')]=_[_0x21e0('0x38')](_0x10a12d[_0x21e0('0x37')]);_0x30b93f[_0x21e0('0x39')]=_['intersection'](_0x30b93f[_0x21e0('0x36')],_0x30b93f['query']);_0xef026a[_0x21e0('0x3a')]=_[_0x21e0('0x3b')](_0x30b93f[_0x21e0('0x36')],qs['fields'](_0x10a12d[_0x21e0('0x37')][_0x21e0('0x3c')]));_0xef026a[_0x21e0('0x3a')]=_0xef026a[_0x21e0('0x3a')]['length']?_0xef026a[_0x21e0('0x3a')]:_0x30b93f[_0x21e0('0x36')];if(!_0x10a12d[_0x21e0('0x37')][_0x21e0('0x3d')](_0x21e0('0x3e'))){_0xef026a[_0x21e0('0x1e')]=qs[_0x21e0('0x1e')](_0x10a12d[_0x21e0('0x37')][_0x21e0('0x1e')]);_0xef026a['offset']=qs[_0x21e0('0x1c')](_0x10a12d[_0x21e0('0x37')][_0x21e0('0x1c')]);}_0xef026a[_0x21e0('0x3f')]=qs[_0x21e0('0x40')](_0x10a12d[_0x21e0('0x37')][_0x21e0('0x40')]);_0xef026a['where']=qs[_0x21e0('0x39')](_[_0x21e0('0x41')](_0x10a12d[_0x21e0('0x37')],_0x30b93f[_0x21e0('0x39')]),_0x2034bf);if(_0x10a12d[_0x21e0('0x37')][_0x21e0('0x42')]){_0xef026a[_0x21e0('0x43')]=_[_0x21e0('0x44')](_0xef026a[_0x21e0('0x43')],{'$or':_[_0x21e0('0x30')](_0x2034bf,function(_0x4bbe7b){if(_0x4bbe7b[_0x21e0('0x34')]!==_0x21e0('0x45')){var _0x24f130={};_0x24f130[_0x4bbe7b[_0x21e0('0x2d')]]={'$like':'%'+_0x10a12d['query'][_0x21e0('0x42')]+'%'};return _0x24f130;}})});}_0xef026a=_[_0x21e0('0x44')]({},_0xef026a,_0x10a12d['options']);var _0x5bc99a={'where':_0xef026a[_0x21e0('0x43')]};return db[_0x21e0('0x31')][_0x21e0('0x1f')](_0x5bc99a)[_0x21e0('0x26')](function(_0x398e22){_0x49e216[_0x21e0('0x1f')]=_0x398e22;if(_0x10a12d['query'][_0x21e0('0x46')]){_0xef026a['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x21e0('0x47')](_0xef026a);})[_0x21e0('0x26')](function(_0x4dd8ee){_0x49e216['rows']=_0x4dd8ee;return _0x49e216;})[_0x21e0('0x26')](respondWithFilteredResult(_0x52a620,_0xef026a))[_0x21e0('0x48')](handleError(_0x52a620,null));};exports[_0x21e0('0x49')]=function(_0x5cd663,_0x2093f4){var _0x9b71ba={'raw':!![],'where':{'id':_0x5cd663['params']['id']}},_0x803bb={};_0x803bb[_0x21e0('0x36')]=_['keys'](db[_0x21e0('0x31')]['rawAttributes']);_0x803bb[_0x21e0('0x37')]=_[_0x21e0('0x38')](_0x5cd663[_0x21e0('0x37')]);_0x803bb[_0x21e0('0x39')]=_[_0x21e0('0x3b')](_0x803bb[_0x21e0('0x36')],_0x803bb[_0x21e0('0x37')]);_0x9b71ba[_0x21e0('0x3a')]=_[_0x21e0('0x3b')](_0x803bb[_0x21e0('0x36')],qs['fields'](_0x5cd663[_0x21e0('0x37')][_0x21e0('0x3c')]));_0x9b71ba[_0x21e0('0x3a')]=_0x9b71ba[_0x21e0('0x3a')][_0x21e0('0x4a')]?_0x9b71ba[_0x21e0('0x3a')]:_0x803bb[_0x21e0('0x36')];if(_0x5cd663[_0x21e0('0x37')][_0x21e0('0x46')]){_0x9b71ba[_0x21e0('0x4b')]=[{'all':!![]}];}_0x9b71ba=_[_0x21e0('0x44')]({},_0x9b71ba,_0x5cd663[_0x21e0('0x4c')]);return db[_0x21e0('0x31')][_0x21e0('0x4d')](_0x9b71ba)[_0x21e0('0x26')](handleEntityNotFound(_0x2093f4,null))[_0x21e0('0x26')](respondWithResult(_0x2093f4,null))[_0x21e0('0x48')](handleError(_0x2093f4,null));};exports[_0x21e0('0x4e')]=function(_0x4ca5c5,_0x144cc1){return db[_0x21e0('0x31')][_0x21e0('0x4e')](_0x4ca5c5[_0x21e0('0x4f')],{})[_0x21e0('0x26')](function(_0x352393){var _0x21290c=_0x4ca5c5['user'][_0x21e0('0x28')]({'plain':!![]});if(!_0x21290c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21290c[_0x21e0('0x50')]===_0x21e0('0x51')){var _0x422fca=_0x352393[_0x21e0('0x28')]({'plain':!![]});var _0x20db9a='CmContactHasItems';return db[_0x21e0('0x52')][_0x21e0('0x4d')]({'where':{'name':_0x20db9a,'userProfileId':_0x21290c[_0x21e0('0x53')]},'raw':!![]})[_0x21e0('0x26')](function(_0x43c71b){if(_0x43c71b&&_0x43c71b[_0x21e0('0x54')]===0x0){return db[_0x21e0('0x2a')][_0x21e0('0x4e')]({'name':_0x422fca['name'],'resourceId':_0x422fca['id'],'type':_0x43c71b['name'],'sectionId':_0x43c71b['id']},{})['then'](function(){return _0x352393;});}else{return _0x352393;}})['catch'](function(_0x6165cf){logger[_0x21e0('0x2b')](_0x21e0('0x55'),_0x6165cf);throw _0x6165cf;});}return _0x352393;})[_0x21e0('0x26')](respondWithResult(_0x144cc1,0xc9))[_0x21e0('0x48')](handleError(_0x144cc1,null));};exports[_0x21e0('0x25')]=function(_0x475afe,_0x2e4058){if(_0x475afe[_0x21e0('0x4f')]['id']){delete _0x475afe[_0x21e0('0x4f')]['id'];}return db[_0x21e0('0x31')][_0x21e0('0x4d')]({'where':{'id':_0x475afe['params']['id']}})[_0x21e0('0x26')](handleEntityNotFound(_0x2e4058,null))['then'](saveUpdates(_0x475afe[_0x21e0('0x4f')],null))[_0x21e0('0x26')](respondWithResult(_0x2e4058,null))[_0x21e0('0x48')](handleError(_0x2e4058,null));};exports[_0x21e0('0x27')]=function(_0x57130e,_0x531aae){return db['CmContactHasItem'][_0x21e0('0x4d')]({'where':{'id':_0x57130e[_0x21e0('0x56')]['id']}})[_0x21e0('0x26')](handleEntityNotFound(_0x531aae,null))[_0x21e0('0x26')](removeEntity(_0x531aae,null))[_0x21e0('0x48')](handleError(_0x531aae,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6d6f4b7..de29f0a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5d1=['CmContactHasItem','cm_contact_has_items','lodash','util','api','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes','exports','define'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0xb5d1,0x1e2));var _0x1b5d=function(_0x2f5fcb,_0x4df21e){_0x2f5fcb=_0x2f5fcb-0x0;var _0x2fc15e=_0xb5d1[_0x2f5fcb];return _0x2fc15e;};'use strict';var _=require(_0x1b5d('0x0'));var util=require(_0x1b5d('0x1'));var logger=require('../../config/logger')(_0x1b5d('0x2'));var moment=require('moment');var BPromise=require(_0x1b5d('0x3'));var rp=require(_0x1b5d('0x4'));var fs=require('fs');var path=require(_0x1b5d('0x5'));var rimraf=require(_0x1b5d('0x6'));var config=require('../../config/environment');var attributes=require(_0x1b5d('0x7'));module[_0x1b5d('0x8')]=function(_0x48cebf,_0x4f3941){return _0x48cebf[_0x1b5d('0x9')](_0x1b5d('0xa'),attributes,{'tableName':_0x1b5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce74=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x216f98,_0x470c7f){var _0xea6b36=function(_0x38f18c){while(--_0x38f18c){_0x216f98['push'](_0x216f98['shift']());}};_0xea6b36(++_0x470c7f);}(_0xce74,0x12a));var _0x4ce7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xce74[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x4ce7('0x0'));var util=require(_0x4ce7('0x1'));var logger=require(_0x4ce7('0x2'))(_0x4ce7('0x3'));var moment=require('moment');var BPromise=require(_0x4ce7('0x4'));var rp=require(_0x4ce7('0x5'));var fs=require('fs');var path=require(_0x4ce7('0x6'));var rimraf=require('rimraf');var config=require(_0x4ce7('0x7'));var attributes=require(_0x4ce7('0x8'));module[_0x4ce7('0x9')]=function(_0x5d654c,_0x42ef0c){return _0x5d654c[_0x4ce7('0xa')](_0x4ce7('0xb'),attributes,{'tableName':_0x4ce7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 41caa03..0f07b03 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x226a=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment'];(function(_0x2e73fc,_0x28c695){var _0x797832=function(_0x3c9bfd){while(--_0x3c9bfd){_0x2e73fc['push'](_0x2e73fc['shift']());}};_0x797832(++_0x28c695);}(_0x226a,0xef));var _0xa226=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x226a[_0x3203a1];return _0x24215e;};'use strict';var _=require(_0xa226('0x0'));var util=require(_0xa226('0x1'));var moment=require(_0xa226('0x2'));var BPromise=require(_0xa226('0x3'));var rs=require(_0xa226('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa226('0x5'));var logger=require(_0xa226('0x6'))(_0xa226('0x7'));var config=require(_0xa226('0x8'));var jayson=require(_0xa226('0x9'));var client=jayson['client'][_0xa226('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x524033,_0x10c12b,_0x2d0edb){return new BPromise(function(_0x4915c2,_0xb023b6){return client[_0xa226('0xb')](_0x524033,_0x2d0edb)['then'](function(_0x523cf7){logger[_0xa226('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x10c12b,'request\x20sent');logger[_0xa226('0xd')](_0xa226('0xe'),_0x10c12b,'request\x20sent',JSON[_0xa226('0xf')](_0x523cf7));if(_0x523cf7[_0xa226('0x10')]){if(_0x523cf7[_0xa226('0x10')][_0xa226('0x11')]===0x1f4){logger[_0xa226('0x10')](_0xa226('0x12'),_0x10c12b,_0x523cf7[_0xa226('0x10')][_0xa226('0x13')]);return _0xb023b6(_0x523cf7[_0xa226('0x10')][_0xa226('0x13')]);}logger[_0xa226('0x10')](_0xa226('0x12'),_0x10c12b,_0x523cf7[_0xa226('0x10')][_0xa226('0x13')]);return _0x4915c2(_0x523cf7[_0xa226('0x10')][_0xa226('0x13')]);}else{logger[_0xa226('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x10c12b,_0xa226('0x14'));_0x4915c2(_0x523cf7[_0xa226('0x15')]['message']);}})['catch'](function(_0x537c8a){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x10c12b,_0x537c8a);_0xb023b6(_0x537c8a);});});} \ No newline at end of file +var _0x6dc5=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x6dc5,0x18c));var _0x56dc=function(_0x49330e,_0x3d6b3a){_0x49330e=_0x49330e-0x0;var _0x3bd188=_0x6dc5[_0x49330e];return _0x3bd188;};'use strict';var _=require(_0x56dc('0x0'));var util=require(_0x56dc('0x1'));var moment=require(_0x56dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x56dc('0x3'));var fs=require('fs');var Redis=require(_0x56dc('0x4'));var db=require(_0x56dc('0x5'))['db'];var utils=require(_0x56dc('0x6'));var logger=require(_0x56dc('0x7'))(_0x56dc('0x8'));var config=require(_0x56dc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x56dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d1e76,_0xebe38e,_0x47fa41){return new BPromise(function(_0x380af1,_0x2ac805){return client[_0x56dc('0xb')](_0x3d1e76,_0x47fa41)[_0x56dc('0xc')](function(_0x3259bb){logger[_0x56dc('0xd')](_0x56dc('0xe'),_0xebe38e,_0x56dc('0xf'));logger['debug'](_0x56dc('0x10'),_0xebe38e,_0x56dc('0xf'),JSON[_0x56dc('0x11')](_0x3259bb));if(_0x3259bb['error']){if(_0x3259bb[_0x56dc('0x12')][_0x56dc('0x13')]===0x1f4){logger[_0x56dc('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0xebe38e,_0x3259bb[_0x56dc('0x12')][_0x56dc('0x14')]);return _0x2ac805(_0x3259bb[_0x56dc('0x12')][_0x56dc('0x14')]);}logger[_0x56dc('0x12')](_0x56dc('0xe'),_0xebe38e,_0x3259bb['error'][_0x56dc('0x14')]);return _0x380af1(_0x3259bb[_0x56dc('0x12')][_0x56dc('0x14')]);}else{logger[_0x56dc('0xd')](_0x56dc('0xe'),_0xebe38e,_0x56dc('0xf'));_0x380af1(_0x3259bb[_0x56dc('0x15')][_0x56dc('0x14')]);}})[_0x56dc('0x16')](function(_0xf64562){logger['error'](_0x56dc('0xe'),_0xebe38e,_0xf64562);_0x2ac805(_0xf64562);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 1d32771..21a0e33 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x367b=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x367b,0xad));var _0xb367=function(_0x436d5b,_0x4d1edb){_0x436d5b=_0x436d5b-0x0;var _0x53586d=_0x367b[_0x436d5b];return _0x53586d;};'use strict';var multer=require(_0xb367('0x0'));var util=require(_0xb367('0x1'));var path=require(_0xb367('0x2'));var timeout=require(_0xb367('0x3'));var express=require(_0xb367('0x4'));var router=express[_0xb367('0x5')]();var fs_extra=require(_0xb367('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb367('0x7'));router[_0xb367('0x8')]('/',auth['isAuthenticated'](),controller[_0xb367('0x9')]);router[_0xb367('0x8')](_0xb367('0xa'),auth[_0xb367('0xb')](),controller[_0xb367('0xc')]);router[_0xb367('0xd')]('/',auth[_0xb367('0xb')](),controller['create']);router[_0xb367('0xe')](_0xb367('0xa'),auth[_0xb367('0xb')](),controller[_0xb367('0xf')]);router[_0xb367('0x10')](_0xb367('0xa'),auth[_0xb367('0xb')](),controller[_0xb367('0x11')]);module[_0xb367('0x12')]=router; \ No newline at end of file +var _0x82b1=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x82b1,0x197));var _0x182b=function(_0x246a6c,_0x33a5cd){_0x246a6c=_0x246a6c-0x0;var _0x53a05a=_0x82b1[_0x246a6c];return _0x53a05a;};'use strict';var multer=require(_0x182b('0x0'));var util=require(_0x182b('0x1'));var path=require(_0x182b('0x2'));var timeout=require(_0x182b('0x3'));var express=require(_0x182b('0x4'));var router=express[_0x182b('0x5')]();var fs_extra=require(_0x182b('0x6'));var auth=require(_0x182b('0x7'));var interaction=require(_0x182b('0x8'));var config=require(_0x182b('0x9'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0x182b('0xa')](),controller[_0x182b('0xb')]);router[_0x182b('0xc')](_0x182b('0xd'),auth[_0x182b('0xa')](),controller[_0x182b('0xe')]);router[_0x182b('0xf')]('/',auth[_0x182b('0xa')](),controller['create']);router[_0x182b('0x10')]('/:id',auth[_0x182b('0xa')](),controller[_0x182b('0x11')]);router[_0x182b('0x12')]('/:id',auth[_0x182b('0xa')](),controller[_0x182b('0x13')]);module[_0x182b('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e52f58e..65dd409 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 _0x3c48=['alias','STRING','getDataValue','TEXT','long','type','parse','values','stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL'];(function(_0x5ad421,_0x532683){var _0x5b2b24=function(_0x16b632){while(--_0x16b632){_0x5ad421['push'](_0x5ad421['shift']());}};_0x5b2b24(++_0x532683);}(_0x3c48,0x1cd));var _0x83c4=function(_0x2672fc,_0x113ef8){_0x2672fc=_0x2672fc-0x0;var _0x1d2013=_0x3c48[_0x2672fc];return _0x1d2013;};'use strict';var Sequelize=require(_0x83c4('0x0'));var _=require(_0x83c4('0x1'));module['exports']={'name':{'type':Sequelize[_0x83c4('0x2')],'get':function(_0x9f128a){return this['getDataValue'](_0x83c4('0x3'));}},'alias':{'type':Sequelize[_0x83c4('0x4')],'allowNull':![],'set':function(_0x412fcc){this['setDataValue'](_0x83c4('0x3'),_0x412fcc?_0x412fcc:this[_0x83c4('0x5')]('name'));}},'type':{'type':Sequelize[_0x83c4('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x83c4('0x6')](_0x83c4('0x7')),'get':function(){if(this[_0x83c4('0x5')](_0x83c4('0x8'))==='select'){return JSON[_0x83c4('0x9')](this['getDataValue'](_0x83c4('0xa')));}else{return this['getDataValue'](_0x83c4('0xa'));}},'set':function(_0x24ae8f){if(Array['isArray'](_0x24ae8f)){this['setDataValue'](_0x83c4('0xa'),JSON[_0x83c4('0xb')](_0x24ae8f));}else{this[_0x83c4('0xc')](_0x83c4('0xa'),_0x24ae8f);}}},'required':{'type':Sequelize[_0x83c4('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x83c4('0xe')](_0x83c4('0xf'))}}; \ No newline at end of file +var _0x5211=['select','values','stringify','BOOLEAN','ENUM','voice','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','long','type'];(function(_0x114cdd,_0x3d5c3c){var _0x2eee5c=function(_0x46ef8d){while(--_0x46ef8d){_0x114cdd['push'](_0x114cdd['shift']());}};_0x2eee5c(++_0x3d5c3c);}(_0x5211,0x105));var _0x1521=function(_0x312c87,_0x336076){_0x312c87=_0x312c87-0x0;var _0x3f4a1a=_0x5211[_0x312c87];return _0x3f4a1a;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x1521('0x0')]={'name':{'type':Sequelize[_0x1521('0x1')],'get':function(_0x2f6837){return this[_0x1521('0x2')](_0x1521('0x3'));}},'alias':{'type':Sequelize[_0x1521('0x4')],'allowNull':![],'set':function(_0x3a9ff3){this[_0x1521('0x5')](_0x1521('0x3'),_0x3a9ff3?_0x3a9ff3:this[_0x1521('0x2')]('name'));}},'type':{'type':Sequelize[_0x1521('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x1521('0x6')](_0x1521('0x7')),'get':function(){if(this[_0x1521('0x2')](_0x1521('0x8'))===_0x1521('0x9')){return JSON['parse'](this[_0x1521('0x2')](_0x1521('0xa')));}else{return this['getDataValue'](_0x1521('0xa'));}},'set':function(_0x3f4bd9){if(Array['isArray'](_0x3f4bd9)){this[_0x1521('0x5')](_0x1521('0xa'),JSON[_0x1521('0xb')](_0x3f4bd9));}else{this[_0x1521('0x5')](_0x1521('0xa'),_0x3f4bd9);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1521('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1521('0xd')](_0x1521('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f59a670..92aa456 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 _0x0b6e=['fields','hasOwnProperty','sort','where','pick','filter','merge','findAll','rows','show','length','includeAll','options','find','catch','update','body','params','create','sequelize','transaction','TEXT','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes'];(function(_0x3d145d,_0x3aa561){var _0x200285=function(_0x51e7ce){while(--_0x51e7ce){_0x3d145d['push'](_0x3d145d['shift']());}};_0x200285(++_0x3aa561);}(_0x0b6e,0x11f));var _0xe0b6=function(_0x2811f5,_0x3e9b30){_0x2811f5=_0x2811f5-0x0;var _0x45a070=_0x0b6e[_0x2811f5];return _0x45a070;};'use strict';var emlformat=require(_0xe0b6('0x0'));var rimraf=require(_0xe0b6('0x1'));var zipdir=require(_0xe0b6('0x2'));var jsonpatch=require(_0xe0b6('0x3'));var rp=require(_0xe0b6('0x4'));var moment=require(_0xe0b6('0x5'));var BPromise=require(_0xe0b6('0x6'));var Mustache=require(_0xe0b6('0x7'));var util=require(_0xe0b6('0x8'));var path=require('path');var sox=require(_0xe0b6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0b6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0b6('0xb'));var jsforce=require(_0xe0b6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe0b6('0xd'));var Papa=require(_0xe0b6('0xe'));var Redis=require(_0xe0b6('0xf'));var authService=require(_0xe0b6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b6('0x12'))(_0xe0b6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe0b6('0x14'));var db=require(_0xe0b6('0x15'))['db'];function respondWithStatusCode(_0x53d61d,_0x1a5a66){_0x1a5a66=_0x1a5a66||0xcc;return function(_0x4ad326){if(_0x4ad326){return _0x53d61d[_0xe0b6('0x16')](_0x1a5a66);}return _0x53d61d[_0xe0b6('0x17')](_0x1a5a66)[_0xe0b6('0x18')]();};}function respondWithResult(_0x5bf775,_0x478826){_0x478826=_0x478826||0xc8;return function(_0xafa771){if(_0xafa771){return _0x5bf775[_0xe0b6('0x17')](_0x478826)[_0xe0b6('0x19')](_0xafa771);}};}function respondWithFilteredResult(_0x5040e0,_0x2830dd){return function(_0x5a2cd8){if(_0x5a2cd8){var _0x59b3bb=typeof _0x2830dd[_0xe0b6('0x1a')]===_0xe0b6('0x1b')&&typeof _0x2830dd[_0xe0b6('0x1c')]===_0xe0b6('0x1b');var _0x54353d=_0x5a2cd8[_0xe0b6('0x1d')];var _0x16a20f=_0x59b3bb?0x0:_0x2830dd[_0xe0b6('0x1a')];var _0x5b8c28=_0x59b3bb?_0x5a2cd8['count']:_0x2830dd[_0xe0b6('0x1a')]+_0x2830dd[_0xe0b6('0x1c')];var _0x1b6188;if(_0x5b8c28>=_0x54353d){_0x5b8c28=_0x54353d;_0x1b6188=0xc8;}else{_0x1b6188=0xce;}_0x5040e0[_0xe0b6('0x17')](_0x1b6188);return _0x5040e0[_0xe0b6('0x1e')](_0xe0b6('0x1f'),_0x16a20f+'-'+_0x5b8c28+'/'+_0x54353d)[_0xe0b6('0x19')](_0x5a2cd8);}return null;};}function patchUpdates(_0x103e57){return function(_0xb317c7){try{jsonpatch[_0xe0b6('0x20')](_0xb317c7,_0x103e57,!![]);}catch(_0x303dcd){return BPromise['reject'](_0x303dcd);}return _0xb317c7[_0xe0b6('0x21')]();};}function saveUpdates(_0x5a119c,_0x5c7d56){return function(_0x68b540){if(_0x68b540){return _0x68b540['update'](_0x5a119c)[_0xe0b6('0x22')](function(_0x4c65e3){return _0x4c65e3;});}return null;};}function removeEntity(_0x5db790,_0x1a6756){return function(_0x2a289c){if(_0x2a289c){return _0x2a289c[_0xe0b6('0x23')]()[_0xe0b6('0x22')](function(){_0x5db790[_0xe0b6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1944,_0x1b0a13){return function(_0x1efc9d){if(!_0x1efc9d){_0x3f1944['sendStatus'](0x194);}return _0x1efc9d;};}function handleError(_0x2fab6a,_0x523abb){_0x523abb=_0x523abb||0x1f4;return function(_0x1ef1d5){logger[_0xe0b6('0x24')](_0x1ef1d5[_0xe0b6('0x25')]);if(_0x1ef1d5['name']){delete _0x1ef1d5[_0xe0b6('0x26')];}_0x2fab6a[_0xe0b6('0x17')](_0x523abb)[_0xe0b6('0x27')](_0x1ef1d5);};}exports['index']=function(_0xd036fe,_0xaeda91){var _0x595d6f={},_0xb3dbf3={},_0x4677c3={'count':0x0,'rows':[]};var _0xa6eee=_[_0xe0b6('0x28')](db[_0xe0b6('0x29')][_0xe0b6('0x2a')],function(_0x4e9bcf){return{'name':_0x4e9bcf[_0xe0b6('0x2b')],'type':_0x4e9bcf[_0xe0b6('0x2c')][_0xe0b6('0x2d')]};});_0xb3dbf3[_0xe0b6('0x2e')]=_[_0xe0b6('0x2f')](_[_0xe0b6('0x28')](_0xa6eee,_0xe0b6('0x26')),[_0xe0b6('0x26')]);_0xb3dbf3[_0xe0b6('0x30')]=_[_0xe0b6('0x31')](_0xd036fe[_0xe0b6('0x30')]);_0xb3dbf3[_0xe0b6('0x32')]=_[_0xe0b6('0x33')](_0xb3dbf3[_0xe0b6('0x2e')],_0xb3dbf3[_0xe0b6('0x30')]);_0x595d6f[_0xe0b6('0x34')]=_[_0xe0b6('0x33')](_0xb3dbf3[_0xe0b6('0x2e')],qs['fields'](_0xd036fe['query'][_0xe0b6('0x35')]));_0x595d6f[_0xe0b6('0x34')]=_0x595d6f[_0xe0b6('0x34')]['length']?_0x595d6f[_0xe0b6('0x34')]:_0xb3dbf3[_0xe0b6('0x2e')];if(!_0xd036fe[_0xe0b6('0x30')][_0xe0b6('0x36')]('nolimit')){_0x595d6f[_0xe0b6('0x1c')]=qs[_0xe0b6('0x1c')](_0xd036fe[_0xe0b6('0x30')][_0xe0b6('0x1c')]);_0x595d6f['offset']=qs[_0xe0b6('0x1a')](_0xd036fe['query']['offset']);}_0x595d6f['order']=qs[_0xe0b6('0x37')](_0xd036fe[_0xe0b6('0x30')][_0xe0b6('0x37')]);_0x595d6f[_0xe0b6('0x38')]=qs[_0xe0b6('0x32')](_[_0xe0b6('0x39')](_0xd036fe[_0xe0b6('0x30')],_0xb3dbf3['filters']),_0xa6eee);if(_0xd036fe[_0xe0b6('0x30')][_0xe0b6('0x3a')]){_0x595d6f[_0xe0b6('0x38')]=_['merge'](_0x595d6f[_0xe0b6('0x38')],{'$or':_[_0xe0b6('0x28')](_0xa6eee,function(_0x5a09e3){if(_0x5a09e3[_0xe0b6('0x2c')]!=='VIRTUAL'){var _0x230e6e={};_0x230e6e[_0x5a09e3['name']]={'$like':'%'+_0xd036fe[_0xe0b6('0x30')][_0xe0b6('0x3a')]+'%'};return _0x230e6e;}})});}_0x595d6f=_[_0xe0b6('0x3b')]({},_0x595d6f,_0xd036fe['options']);var _0x18b7e1={'where':_0x595d6f[_0xe0b6('0x38')]};return db[_0xe0b6('0x29')]['count'](_0x18b7e1)[_0xe0b6('0x22')](function(_0x38f39e){_0x4677c3[_0xe0b6('0x1d')]=_0x38f39e;if(_0xd036fe['query']['includeAll']){_0x595d6f['include']=[{'all':!![]}];}return db['CmCustomField'][_0xe0b6('0x3c')](_0x595d6f);})[_0xe0b6('0x22')](function(_0x12d840){_0x4677c3[_0xe0b6('0x3d')]=_0x12d840;return _0x4677c3;})['then'](respondWithFilteredResult(_0xaeda91,_0x595d6f))['catch'](handleError(_0xaeda91,null));};exports[_0xe0b6('0x3e')]=function(_0xe72105,_0x2de4c8){var _0xa67103={'raw':!![],'where':{'id':_0xe72105['params']['id']}},_0x4303fe={};_0x4303fe['model']=_['keys'](db[_0xe0b6('0x29')]['rawAttributes']);_0x4303fe['query']=_['keys'](_0xe72105[_0xe0b6('0x30')]);_0x4303fe[_0xe0b6('0x32')]=_['intersection'](_0x4303fe[_0xe0b6('0x2e')],_0x4303fe[_0xe0b6('0x30')]);_0xa67103[_0xe0b6('0x34')]=_[_0xe0b6('0x33')](_0x4303fe[_0xe0b6('0x2e')],qs[_0xe0b6('0x35')](_0xe72105[_0xe0b6('0x30')]['fields']));_0xa67103[_0xe0b6('0x34')]=_0xa67103[_0xe0b6('0x34')][_0xe0b6('0x3f')]?_0xa67103[_0xe0b6('0x34')]:_0x4303fe[_0xe0b6('0x2e')];if(_0xe72105[_0xe0b6('0x30')][_0xe0b6('0x40')]){_0xa67103['include']=[{'all':!![]}];}_0xa67103=_[_0xe0b6('0x3b')]({},_0xa67103,_0xe72105[_0xe0b6('0x41')]);return db['CmCustomField'][_0xe0b6('0x42')](_0xa67103)['then'](handleEntityNotFound(_0x2de4c8,null))['then'](respondWithResult(_0x2de4c8,null))[_0xe0b6('0x43')](handleError(_0x2de4c8,null));};exports[_0xe0b6('0x44')]=function(_0x346f53,_0x18574b){if(_0x346f53[_0xe0b6('0x45')]['id']){delete _0x346f53['body']['id'];}return db['CmCustomField'][_0xe0b6('0x42')]({'where':{'id':_0x346f53[_0xe0b6('0x46')]['id']}})['then'](handleEntityNotFound(_0x18574b,null))[_0xe0b6('0x22')](saveUpdates(_0x346f53[_0xe0b6('0x45')],null))[_0xe0b6('0x22')](respondWithResult(_0x18574b,null))[_0xe0b6('0x43')](handleError(_0x18574b,null));};exports[_0xe0b6('0x23')]=function(_0x338f64,_0x45278f){return db[_0xe0b6('0x29')]['find']({'where':{'id':_0x338f64[_0xe0b6('0x46')]['id']}})[_0xe0b6('0x22')](handleEntityNotFound(_0x45278f,null))[_0xe0b6('0x22')](removeEntity(_0x45278f,null))[_0xe0b6('0x43')](handleError(_0x45278f,null));};exports[_0xe0b6('0x47')]=function(_0x2215de,_0x1ab2fb){var _0x48d445;return db[_0xe0b6('0x48')][_0xe0b6('0x49')](function(_0x43ed87){return db[_0xe0b6('0x29')][_0xe0b6('0x47')](_0x2215de[_0xe0b6('0x45')],{'transaction':_0x43ed87})[_0xe0b6('0x22')](function(_0x4356ab){_0x48d445=_0x4356ab;var _0x4a2975={'type':db['Sequelize'][_0xe0b6('0x4a')],'transaction':_0x43ed87};switch(_0x2215de[_0xe0b6('0x45')][_0xe0b6('0x2c')]){case'text':_0x4a2975[_0xe0b6('0x2c')]=db[_0xe0b6('0x4b')][_0xe0b6('0x4a')];break;case _0xe0b6('0x4c'):_0x4a2975[_0xe0b6('0x2c')]=db['Sequelize'][_0xe0b6('0x4d')];break;case _0xe0b6('0x4e'):_0x4a2975['type']=db[_0xe0b6('0x4b')][_0xe0b6('0x4f')];_0x4a2975[_0xe0b6('0x50')]=![];break;default:}return db[_0xe0b6('0x48')][_0xe0b6('0x51')][_0xe0b6('0x52')]('cm_contacts',util[_0xe0b6('0x53')](_0xe0b6('0x54'),_0x48d445['id']),_0x4a2975);})[_0xe0b6('0x22')](function(){return _0x48d445;});})['then'](respondWithResult(_0x1ab2fb,0xc9))[_0xe0b6('0x43')](handleError(_0x1ab2fb,null));}; \ No newline at end of file +var _0x7494=['show','params','keys','body','find','create','sequelize','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch'];(function(_0x55bdd2,_0x2dae28){var _0x3b6e03=function(_0x5ea479){while(--_0x5ea479){_0x55bdd2['push'](_0x55bdd2['shift']());}};_0x3b6e03(++_0x2dae28);}(_0x7494,0x69));var _0x4749=function(_0x1a0353,_0x52249e){_0x1a0353=_0x1a0353-0x0;var _0x1f6643=_0x7494[_0x1a0353];return _0x1f6643;};'use strict';var emlformat=require(_0x4749('0x0'));var rimraf=require(_0x4749('0x1'));var zipdir=require(_0x4749('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4749('0x3'));var moment=require(_0x4749('0x4'));var BPromise=require(_0x4749('0x5'));var Mustache=require(_0x4749('0x6'));var util=require('util');var path=require(_0x4749('0x7'));var sox=require(_0x4749('0x8'));var csv=require(_0x4749('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4749('0xa'));var _=require('lodash');var squel=require(_0x4749('0xb'));var crypto=require(_0x4749('0xc'));var jsforce=require(_0x4749('0xd'));var deskjs=require(_0x4749('0xe'));var toCsv=require(_0x4749('0x9'));var querystring=require(_0x4749('0xf'));var Papa=require(_0x4749('0x10'));var Redis=require(_0x4749('0x11'));var authService=require(_0x4749('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4749('0x13'));var hardwareService=require(_0x4749('0x14'));var logger=require(_0x4749('0x15'))(_0x4749('0x16'));var utils=require(_0x4749('0x17'));var config=require(_0x4749('0x18'));var licenseUtil=require(_0x4749('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x482959,_0x3d86a8){_0x3d86a8=_0x3d86a8||0xcc;return function(_0x5a0faf){if(_0x5a0faf){return _0x482959[_0x4749('0x1a')](_0x3d86a8);}return _0x482959['status'](_0x3d86a8)[_0x4749('0x1b')]();};}function respondWithResult(_0x4c8547,_0x348c7a){_0x348c7a=_0x348c7a||0xc8;return function(_0x228323){if(_0x228323){return _0x4c8547[_0x4749('0x1c')](_0x348c7a)['json'](_0x228323);}};}function respondWithFilteredResult(_0x1812f4,_0x70045c){return function(_0x599067){if(_0x599067){var _0x530003=typeof _0x70045c[_0x4749('0x1d')]===_0x4749('0x1e')&&typeof _0x70045c['limit']===_0x4749('0x1e');var _0x570d3d=_0x599067['count'];var _0x5e6600=_0x530003?0x0:_0x70045c['offset'];var _0x260835=_0x530003?_0x599067[_0x4749('0x1f')]:_0x70045c[_0x4749('0x1d')]+_0x70045c[_0x4749('0x20')];var _0x48f788;if(_0x260835>=_0x570d3d){_0x260835=_0x570d3d;_0x48f788=0xc8;}else{_0x48f788=0xce;}_0x1812f4[_0x4749('0x1c')](_0x48f788);return _0x1812f4[_0x4749('0x21')](_0x4749('0x22'),_0x5e6600+'-'+_0x260835+'/'+_0x570d3d)[_0x4749('0x23')](_0x599067);}return null;};}function patchUpdates(_0x24c4c7){return function(_0x2196b2){try{jsonpatch[_0x4749('0x24')](_0x2196b2,_0x24c4c7,!![]);}catch(_0x4b1fbe){return BPromise['reject'](_0x4b1fbe);}return _0x2196b2[_0x4749('0x25')]();};}function saveUpdates(_0x1fbdee,_0x3b1a77){return function(_0x474da6){if(_0x474da6){return _0x474da6['update'](_0x1fbdee)[_0x4749('0x26')](function(_0x419bc1){return _0x419bc1;});}return null;};}function removeEntity(_0x2bae93,_0x26b44b){return function(_0x56af41){if(_0x56af41){return _0x56af41[_0x4749('0x27')]()[_0x4749('0x26')](function(){_0x2bae93['status'](0xcc)[_0x4749('0x1b')]();});}};}function handleEntityNotFound(_0x14d7e0,_0x3a3eb8){return function(_0x29f4c4){if(!_0x29f4c4){_0x14d7e0['sendStatus'](0x194);}return _0x29f4c4;};}function handleError(_0x4e1a02,_0x284608){_0x284608=_0x284608||0x1f4;return function(_0x59b394){logger[_0x4749('0x28')](_0x59b394[_0x4749('0x29')]);if(_0x59b394['name']){delete _0x59b394[_0x4749('0x2a')];}_0x4e1a02[_0x4749('0x1c')](_0x284608)[_0x4749('0x2b')](_0x59b394);};}exports[_0x4749('0x2c')]=function(_0x5a58d1,_0x50a103){var _0x202e32={},_0x3331ac={},_0x4eb595={'count':0x0,'rows':[]};var _0x2ae64b=_[_0x4749('0x2d')](db[_0x4749('0x2e')][_0x4749('0x2f')],function(_0x30d9e2){return{'name':_0x30d9e2[_0x4749('0x30')],'type':_0x30d9e2[_0x4749('0x31')][_0x4749('0x32')]};});_0x3331ac[_0x4749('0x33')]=_[_0x4749('0x34')](_[_0x4749('0x2d')](_0x2ae64b,_0x4749('0x2a')),['name']);_0x3331ac[_0x4749('0x35')]=_['keys'](_0x5a58d1[_0x4749('0x35')]);_0x3331ac[_0x4749('0x36')]=_[_0x4749('0x37')](_0x3331ac[_0x4749('0x33')],_0x3331ac['query']);_0x202e32[_0x4749('0x38')]=_['intersection'](_0x3331ac[_0x4749('0x33')],qs['fields'](_0x5a58d1[_0x4749('0x35')][_0x4749('0x39')]));_0x202e32[_0x4749('0x38')]=_0x202e32[_0x4749('0x38')]['length']?_0x202e32[_0x4749('0x38')]:_0x3331ac[_0x4749('0x33')];if(!_0x5a58d1['query'][_0x4749('0x3a')](_0x4749('0x3b'))){_0x202e32[_0x4749('0x20')]=qs[_0x4749('0x20')](_0x5a58d1[_0x4749('0x35')][_0x4749('0x20')]);_0x202e32['offset']=qs[_0x4749('0x1d')](_0x5a58d1[_0x4749('0x35')][_0x4749('0x1d')]);}_0x202e32[_0x4749('0x3c')]=qs['sort'](_0x5a58d1[_0x4749('0x35')][_0x4749('0x3d')]);_0x202e32['where']=qs['filters'](_['pick'](_0x5a58d1[_0x4749('0x35')],_0x3331ac['filters']),_0x2ae64b);if(_0x5a58d1[_0x4749('0x35')]['filter']){_0x202e32[_0x4749('0x3e')]=_[_0x4749('0x3f')](_0x202e32[_0x4749('0x3e')],{'$or':_[_0x4749('0x2d')](_0x2ae64b,function(_0x5635d1){if(_0x5635d1[_0x4749('0x31')]!==_0x4749('0x40')){var _0x3dc123={};_0x3dc123[_0x5635d1[_0x4749('0x2a')]]={'$like':'%'+_0x5a58d1[_0x4749('0x35')][_0x4749('0x41')]+'%'};return _0x3dc123;}})});}_0x202e32=_[_0x4749('0x3f')]({},_0x202e32,_0x5a58d1[_0x4749('0x42')]);var _0x5a3777={'where':_0x202e32[_0x4749('0x3e')]};return db['CmCustomField'][_0x4749('0x1f')](_0x5a3777)[_0x4749('0x26')](function(_0x4c2a7d){_0x4eb595[_0x4749('0x1f')]=_0x4c2a7d;if(_0x5a58d1['query'][_0x4749('0x43')]){_0x202e32[_0x4749('0x44')]=[{'all':!![]}];}return db[_0x4749('0x2e')]['findAll'](_0x202e32);})[_0x4749('0x26')](function(_0x580ac7){_0x4eb595[_0x4749('0x45')]=_0x580ac7;return _0x4eb595;})[_0x4749('0x26')](respondWithFilteredResult(_0x50a103,_0x202e32))[_0x4749('0x46')](handleError(_0x50a103,null));};exports[_0x4749('0x47')]=function(_0x4d3224,_0x14c7e7){var _0x281472={'raw':!![],'where':{'id':_0x4d3224[_0x4749('0x48')]['id']}},_0x26f788={};_0x26f788['model']=_['keys'](db[_0x4749('0x2e')][_0x4749('0x2f')]);_0x26f788[_0x4749('0x35')]=_[_0x4749('0x49')](_0x4d3224[_0x4749('0x35')]);_0x26f788[_0x4749('0x36')]=_[_0x4749('0x37')](_0x26f788[_0x4749('0x33')],_0x26f788[_0x4749('0x35')]);_0x281472[_0x4749('0x38')]=_['intersection'](_0x26f788[_0x4749('0x33')],qs[_0x4749('0x39')](_0x4d3224[_0x4749('0x35')][_0x4749('0x39')]));_0x281472[_0x4749('0x38')]=_0x281472[_0x4749('0x38')]['length']?_0x281472[_0x4749('0x38')]:_0x26f788[_0x4749('0x33')];if(_0x4d3224['query'][_0x4749('0x43')]){_0x281472[_0x4749('0x44')]=[{'all':!![]}];}_0x281472=_[_0x4749('0x3f')]({},_0x281472,_0x4d3224[_0x4749('0x42')]);return db[_0x4749('0x2e')]['find'](_0x281472)['then'](handleEntityNotFound(_0x14c7e7,null))[_0x4749('0x26')](respondWithResult(_0x14c7e7,null))[_0x4749('0x46')](handleError(_0x14c7e7,null));};exports['update']=function(_0x398f12,_0x4639b6){if(_0x398f12[_0x4749('0x4a')]['id']){delete _0x398f12['body']['id'];}return db['CmCustomField'][_0x4749('0x4b')]({'where':{'id':_0x398f12[_0x4749('0x48')]['id']}})[_0x4749('0x26')](handleEntityNotFound(_0x4639b6,null))[_0x4749('0x26')](saveUpdates(_0x398f12['body'],null))[_0x4749('0x26')](respondWithResult(_0x4639b6,null))[_0x4749('0x46')](handleError(_0x4639b6,null));};exports[_0x4749('0x27')]=function(_0x7b7cd6,_0xd3f44b){return db['CmCustomField'][_0x4749('0x4b')]({'where':{'id':_0x7b7cd6[_0x4749('0x48')]['id']}})['then'](handleEntityNotFound(_0xd3f44b,null))[_0x4749('0x26')](removeEntity(_0xd3f44b,null))[_0x4749('0x46')](handleError(_0xd3f44b,null));};exports[_0x4749('0x4c')]=function(_0xf1fc50,_0x64a09c){var _0x155d53;return db[_0x4749('0x4d')]['transaction'](function(_0x267d57){return db[_0x4749('0x2e')][_0x4749('0x4c')](_0xf1fc50[_0x4749('0x4a')],{'transaction':_0x267d57})[_0x4749('0x26')](function(_0x11e6f1){_0x155d53=_0x11e6f1;var _0x507594={'type':db['Sequelize'][_0x4749('0x4e')],'transaction':_0x267d57};switch(_0xf1fc50[_0x4749('0x4a')][_0x4749('0x31')]){case _0x4749('0x4f'):_0x507594[_0x4749('0x31')]=db['Sequelize'][_0x4749('0x4e')];break;case'number':_0x507594[_0x4749('0x31')]=db[_0x4749('0x50')][_0x4749('0x51')];break;case _0x4749('0x52'):_0x507594[_0x4749('0x31')]=db[_0x4749('0x50')][_0x4749('0x53')];_0x507594[_0x4749('0x54')]=![];break;default:}return db[_0x4749('0x4d')][_0x4749('0x55')][_0x4749('0x56')]('cm_contacts',util[_0x4749('0x57')]('cf_%d',_0x155d53['id']),_0x507594);})['then'](function(){return _0x155d53;});})[_0x4749('0x26')](respondWithResult(_0x64a09c,0xc9))[_0x4749('0x46')](handleError(_0x64a09c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d958cef..23608dd 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 _0xac25=['request-promise','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','moment','bluebird'];(function(_0x805f26,_0x1f7295){var _0x19b139=function(_0x2e563a){while(--_0x2e563a){_0x805f26['push'](_0x805f26['shift']());}};_0x19b139(++_0x1f7295);}(_0xac25,0x16e));var _0x5ac2=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xac25[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x5ac2('0x0'));var util=require(_0x5ac2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5ac2('0x2'));var BPromise=require(_0x5ac2('0x3'));var rp=require(_0x5ac2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ac2('0x5'));var attributes=require(_0x5ac2('0x6'));module[_0x5ac2('0x7')]=function(_0x30b2b1,_0x5313ee){return _0x30b2b1[_0x5ac2('0x8')](_0x5ac2('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a16=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x8b3b9,_0x1d5fce){var _0x426934=function(_0x330c34){while(--_0x330c34){_0x8b3b9['push'](_0x8b3b9['shift']());}};_0x426934(++_0x1d5fce);}(_0x3a16,0x105));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x63a1('0x0'));var util=require(_0x63a1('0x1'));var logger=require(_0x63a1('0x2'))(_0x63a1('0x3'));var moment=require(_0x63a1('0x4'));var BPromise=require(_0x63a1('0x5'));var rp=require(_0x63a1('0x6'));var fs=require('fs');var path=require(_0x63a1('0x7'));var rimraf=require(_0x63a1('0x8'));var config=require(_0x63a1('0x9'));var attributes=require(_0x63a1('0xa'));module[_0x63a1('0xb')]=function(_0xbfbb9,_0x26aefe){return _0xbfbb9[_0x63a1('0xc')](_0x63a1('0xd'),attributes,{'tableName':_0x63a1('0xe'),'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 f71c7cf..5ea491b 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 _0x32bb=['message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x549fcd,_0x9df371){var _0x5ddb52=function(_0x3521d2){while(--_0x3521d2){_0x549fcd['push'](_0x549fcd['shift']());}};_0x5ddb52(++_0x9df371);}(_0x32bb,0x87));var _0xb32b=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x32bb[_0x31172e];return _0x414ada;};'use strict';var _=require('lodash');var util=require(_0xb32b('0x0'));var moment=require(_0xb32b('0x1'));var BPromise=require(_0xb32b('0x2'));var rs=require(_0xb32b('0x3'));var fs=require('fs');var Redis=require(_0xb32b('0x4'));var db=require(_0xb32b('0x5'))['db'];var utils=require(_0xb32b('0x6'));var logger=require(_0xb32b('0x7'))(_0xb32b('0x8'));var config=require(_0xb32b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb32b('0xa')][_0xb32b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15951c,_0x119b5d,_0x3eefae){return new BPromise(function(_0x4ff2c5,_0x4c7e90){return client[_0xb32b('0xc')](_0x15951c,_0x3eefae)['then'](function(_0x26d6ff){logger['info'](_0xb32b('0xd'),_0x119b5d,_0xb32b('0xe'));logger[_0xb32b('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x119b5d,_0xb32b('0xe'),JSON[_0xb32b('0x10')](_0x26d6ff));if(_0x26d6ff['error']){if(_0x26d6ff[_0xb32b('0x11')][_0xb32b('0x12')]===0x1f4){logger['error'](_0xb32b('0xd'),_0x119b5d,_0x26d6ff['error']['message']);return _0x4c7e90(_0x26d6ff[_0xb32b('0x11')][_0xb32b('0x13')]);}logger['error'](_0xb32b('0xd'),_0x119b5d,_0x26d6ff[_0xb32b('0x11')]['message']);return _0x4ff2c5(_0x26d6ff['error'][_0xb32b('0x13')]);}else{logger[_0xb32b('0x14')](_0xb32b('0xd'),_0x119b5d,_0xb32b('0xe'));_0x4ff2c5(_0x26d6ff[_0xb32b('0x15')][_0xb32b('0x13')]);}})['catch'](function(_0x23a907){logger['error']('CmCustomField,\x20%s,\x20%s',_0x119b5d,_0x23a907);_0x4c7e90(_0x23a907);});});} \ No newline at end of file +var _0x075d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd77cdb,_0x24c82a){var _0x269b7b=function(_0x570f67){while(--_0x570f67){_0xd77cdb['push'](_0xd77cdb['shift']());}};_0x269b7b(++_0x24c82a);}(_0x075d,0x11a));var _0xd075=function(_0x469c04,_0x1eb194){_0x469c04=_0x469c04-0x0;var _0x1d297e=_0x075d[_0x469c04];return _0x1d297e;};'use strict';var _=require(_0xd075('0x0'));var util=require(_0xd075('0x1'));var moment=require('moment');var BPromise=require(_0xd075('0x2'));var rs=require(_0xd075('0x3'));var fs=require('fs');var Redis=require(_0xd075('0x4'));var db=require(_0xd075('0x5'))['db'];var utils=require(_0xd075('0x6'));var logger=require(_0xd075('0x7'))(_0xd075('0x8'));var config=require(_0xd075('0x9'));var jayson=require(_0xd075('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33840b,_0x381ea8,_0xb54924){return new BPromise(function(_0x335511,_0x91662d){return client[_0xd075('0xb')](_0x33840b,_0xb54924)[_0xd075('0xc')](function(_0x202809){logger[_0xd075('0xd')]('CmCustomField,\x20%s,\x20%s',_0x381ea8,_0xd075('0xe'));logger[_0xd075('0xf')](_0xd075('0x10'),_0x381ea8,_0xd075('0xe'),JSON[_0xd075('0x11')](_0x202809));if(_0x202809[_0xd075('0x12')]){if(_0x202809[_0xd075('0x12')][_0xd075('0x13')]===0x1f4){logger['error'](_0xd075('0x14'),_0x381ea8,_0x202809[_0xd075('0x12')][_0xd075('0x15')]);return _0x91662d(_0x202809[_0xd075('0x12')]['message']);}logger[_0xd075('0x12')](_0xd075('0x14'),_0x381ea8,_0x202809[_0xd075('0x12')]['message']);return _0x335511(_0x202809[_0xd075('0x12')][_0xd075('0x15')]);}else{logger[_0xd075('0xd')](_0xd075('0x14'),_0x381ea8,_0xd075('0xe'));_0x335511(_0x202809[_0xd075('0x16')]['message']);}})[_0xd075('0x17')](function(_0x5d01c3){logger[_0xd075('0x12')](_0xd075('0x14'),_0x381ea8,_0x5d01c3);_0x91662d(_0x5d01c3);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 571802c..ae7b3b8 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 _0xf4d9=['isAuthenticated','index','get','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x2872b1,_0x544181){var _0x343b08=function(_0x5ff0bf){while(--_0x5ff0bf){_0x2872b1['push'](_0x2872b1['shift']());}};_0x343b08(++_0x544181);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x4ff7cc,_0x38f5d2){_0x4ff7cc=_0x4ff7cc-0x0;var _0x3bec59=_0xf4d9[_0x4ff7cc];return _0x3bec59;};'use strict';var multer=require(_0x9f4d('0x0'));var util=require('util');var path=require(_0x9f4d('0x1'));var timeout=require(_0x9f4d('0x2'));var express=require(_0x9f4d('0x3'));var router=express[_0x9f4d('0x4')]();var fs_extra=require(_0x9f4d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f4d('0x6'));var config=require(_0x9f4d('0x7'));var controller=require(_0x9f4d('0x8'));router['get']('/',auth[_0x9f4d('0x9')](),controller[_0x9f4d('0xa')]);router[_0x9f4d('0xb')]('/:id',auth[_0x9f4d('0x9')](),controller['show']);router[_0x9f4d('0xc')]('/',auth['isAuthenticated'](),controller[_0x9f4d('0xd')]);router[_0x9f4d('0xe')](_0x9f4d('0xf'),auth[_0x9f4d('0x9')](),controller['update']);router[_0x9f4d('0x10')](_0x9f4d('0xf'),auth[_0x9f4d('0x9')](),controller[_0x9f4d('0x11')]);module[_0x9f4d('0x12')]=router; \ No newline at end of file +var _0x4989=['destroy','multer','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x44ab49,_0x3f87c0){var _0x3e034c=function(_0x277c82){while(--_0x277c82){_0x44ab49['push'](_0x44ab49['shift']());}};_0x3e034c(++_0x3f87c0);}(_0x4989,0x79));var _0x9498=function(_0x27b3df,_0x34a01a){_0x27b3df=_0x27b3df-0x0;var _0x275390=_0x4989[_0x27b3df];return _0x275390;};'use strict';var multer=require(_0x9498('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9498('0x1'));var express=require(_0x9498('0x2'));var router=express[_0x9498('0x3')]();var fs_extra=require(_0x9498('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9498('0x5'));var controller=require('./cmCustomField.controller');router[_0x9498('0x6')]('/',auth[_0x9498('0x7')](),controller['index']);router[_0x9498('0x6')](_0x9498('0x8'),auth[_0x9498('0x7')](),controller[_0x9498('0x9')]);router[_0x9498('0xa')]('/',auth[_0x9498('0x7')](),controller[_0x9498('0xb')]);router[_0x9498('0xc')](_0x9498('0x8'),auth[_0x9498('0x7')](),controller[_0x9498('0xd')]);router['delete'](_0x9498('0x8'),auth[_0x9498('0x7')](),controller[_0x9498('0xe')]);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 87d1a58..36502f5 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 _0x3718=['STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','moment','exports'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x3718,0xf8));var _0x8371=function(_0x549aeb,_0x591153){_0x549aeb=_0x549aeb-0x0;var _0x4ec981=_0x3718[_0x549aeb];return _0x4ec981;};'use strict';var moment=require(_0x8371('0x0'));var Sequelize=require('sequelize');module[_0x8371('0x1')]={'phone':{'type':Sequelize[_0x8371('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x8371('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x8371('0x4')](_0x8371('0x5'))},'countbusyretry':{'type':Sequelize[_0x8371('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8371('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8371('0x7')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8371('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8371('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8371('0x6')],'unique':_0x8371('0x9')},'UserId':{'type':Sequelize[_0x8371('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x8371('0x6')],'unique':_0x8371('0x9')},'CampaignId':{'type':Sequelize[_0x8371('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x8371('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8371('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8371('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8371('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8371('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x8371('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8371('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8371('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x8554=['STRING','moment','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x8554,0x191));var _0x4855=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8554[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x4855('0x0'));var Sequelize=require(_0x4855('0x1'));module[_0x4855('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4855('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4855('0x4')],'defaultValue':moment()[_0x4855('0x5')](_0x4855('0x6'))},'countbusyretry':{'type':Sequelize[_0x4855('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4855('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4855('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4855('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4855('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4855('0x7')],'unique':_0x4855('0x8')},'ListId':{'type':Sequelize[_0x4855('0x7')],'unique':_0x4855('0x8')},'UserId':{'type':Sequelize[_0x4855('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x4855('0x8')},'CampaignId':{'type':Sequelize[_0x4855('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x4855('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4855('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4855('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4855('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4855('0x9')]},'recallmeNotifiedDate':{'type':Sequelize[_0x4855('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 0c9d1a0..7078f38 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 _0x8d0a=['$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','VIRTUAL','filter','options','CmHopper','count','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','Queue','dialActive','LOCK','CmList','List','getOpenContacts','outbound','isNumber','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','json','update','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains'];(function(_0x596f51,_0x191863){var _0xb572b0=function(_0x47e18d){while(--_0x47e18d){_0x596f51['push'](_0x596f51['shift']());}};_0xb572b0(++_0x191863);}(_0x8d0a,0x65));var _0xa8d0=function(_0x4a48ca,_0x6020c1){_0x4a48ca=_0x4a48ca-0x0;var _0x125498=_0x8d0a[_0x4a48ca];return _0x125498;};'use strict';var moment=require(_0xa8d0('0x0'));var _=require('lodash');var qs=require(_0xa8d0('0x1'));var logger=require(_0xa8d0('0x2'))(_0xa8d0('0x3'));var shared=require(_0xa8d0('0x4'));var db=require(_0xa8d0('0x5'))['db'];function respondWithResult(_0x477190,_0x528287){_0x528287=_0x528287||0xc8;return function(_0x202833){if(_0x202833){return _0x477190[_0xa8d0('0x6')](_0x528287)['json'](_0x202833);}};}function respondWithFilteredResult(_0x1cac4f,_0x212aaf){return function(_0x1f95a7){if(_0x1f95a7){var _0x1f8b78=typeof _0x212aaf[_0xa8d0('0x7')]==='undefined'&&typeof _0x212aaf['limit']===_0xa8d0('0x8');var _0x823481=_0x1f95a7['count'];var _0x5362af=_0x1f8b78?0x0:_0x212aaf['offset'];var _0x296b54=_0x1f8b78?_0x1f95a7['count']:_0x212aaf[_0xa8d0('0x7')]+_0x212aaf[_0xa8d0('0x9')];var _0x44541e;if(_0x296b54>=_0x823481){_0x296b54=_0x823481;_0x44541e=0xc8;}else{_0x44541e=0xce;}_0x1cac4f[_0xa8d0('0x6')](_0x44541e);return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),_0x5362af+'-'+_0x296b54+'/'+_0x823481)[_0xa8d0('0xc')](_0x1f95a7);}return null;};}function saveUpdates(_0x3bf335,_0x329583){return function(_0x1bfcb6){if(_0x1bfcb6){return _0x1bfcb6[_0xa8d0('0xd')](_0x3bf335)['then'](function(_0x757540){return _0x757540;});}return null;};}function handleEntityNotFound(_0x478f66,_0x5a9193){return function(_0x32ea3e){if(!_0x32ea3e){_0x478f66[_0xa8d0('0xe')](0x194);}return _0x32ea3e;};}function handleError(_0x523ec0,_0x31da9f){_0x31da9f=_0x31da9f||0x1f4;return function(_0x459e9d){logger[_0xa8d0('0xf')](_0x459e9d[_0xa8d0('0x10')]);if(_0x459e9d[_0xa8d0('0x11')]){delete _0x459e9d[_0xa8d0('0x11')];}_0x523ec0['status'](_0x31da9f)[_0xa8d0('0x12')](_0x459e9d);};}exports[_0xa8d0('0x13')]=function(_0x5cf619,_0x2f0b00){var _0x1e325a={},_0x53d168={},_0x32b11a={'count':0x0,'rows':[]};var _0xf9267d=_['map'](db['CmHopper'][_0xa8d0('0x14')],function(_0x25ed8d){return{'name':_0x25ed8d['fieldName'],'type':_0x25ed8d[_0xa8d0('0x15')][_0xa8d0('0x16')]};});_0x53d168[_0xa8d0('0x17')]=_['map'](_0xf9267d,_0xa8d0('0x11'));_0x53d168['query']=_[_0xa8d0('0x18')](_0x5cf619[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x53d168[_0xa8d0('0x17')],_0x53d168[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_['concat'](_0x53d168['filters'],[_0xa8d0('0x1c'),'$or',_0xa8d0('0x1d'),_0xa8d0('0x1e'),_0xa8d0('0x1f'),_0xa8d0('0x20'),_0xa8d0('0x21'),'$eq',_0xa8d0('0x22'),_0xa8d0('0x23'),_0xa8d0('0x24'),_0xa8d0('0x25'),_0xa8d0('0x26'),_0xa8d0('0x27'),_0xa8d0('0x28'),_0xa8d0('0x29'),'$notILike',_0xa8d0('0x27'),_0xa8d0('0x2a'),_0xa8d0('0x2b'),_0xa8d0('0x2c'),_0xa8d0('0x2d')]);_0x1e325a[_0xa8d0('0x2e')]=_['intersection'](_0x53d168[_0xa8d0('0x17')],qs[_0xa8d0('0x2f')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1e325a['attributes']=_0x1e325a[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1e325a['attributes']:_0x53d168['model'];if(!_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x31')](_0xa8d0('0x32'))){_0x1e325a[_0xa8d0('0x9')]=qs[_0xa8d0('0x9')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x9')]);_0x1e325a[_0xa8d0('0x7')]=qs[_0xa8d0('0x7')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x7')]);}_0x1e325a[_0xa8d0('0x33')]=qs['sort'](_0x5cf619['query'][_0xa8d0('0x34')]);_0x1e325a['where']=qs[_0xa8d0('0x1a')](_[_0xa8d0('0x35')](_0x5cf619[_0xa8d0('0x19')],_0x53d168[_0xa8d0('0x1a')]),_0xf9267d);if(_0x5cf619[_0xa8d0('0x19')]['filter']){_0x1e325a['where']=_[_0xa8d0('0x36')](_0x1e325a[_0xa8d0('0x37')],{'$or':_[_0xa8d0('0x38')](_0xf9267d,function(_0x1352ed){if(_0x1352ed[_0xa8d0('0x15')]!==_0xa8d0('0x39')){var _0x5b2d5e={};_0x5b2d5e[_0x1352ed[_0xa8d0('0x11')]]={'$like':'%'+_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3a')]+'%'};return _0x5b2d5e;}})});}_0x1e325a=_['merge']({},_0x1e325a,_0x5cf619[_0xa8d0('0x3b')]);var _0x4ac500={'where':_0x1e325a[_0xa8d0('0x37')]};return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')](_0x4ac500)[_0xa8d0('0x3e')](function(_0x27515e){_0x32b11a['count']=_0x27515e;if(_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1e325a[_0xa8d0('0x40')]=[{'all':!![]}];}return db[_0xa8d0('0x3c')][_0xa8d0('0x41')](_0x1e325a);})[_0xa8d0('0x3e')](function(_0x5dea4a){_0x32b11a[_0xa8d0('0x42')]=_0x5dea4a;return _0x32b11a;})[_0xa8d0('0x3e')](respondWithFilteredResult(_0x2f0b00,_0x1e325a))[_0xa8d0('0x43')](handleError(_0x2f0b00,null));};exports[_0xa8d0('0x44')]=function(_0xeba90c,_0x2f5186){var _0x1c1e05={'raw':!![],'where':{'id':_0xeba90c['params']['id']}},_0x10dc8b={};_0x10dc8b[_0xa8d0('0x17')]=_['keys'](db[_0xa8d0('0x3c')][_0xa8d0('0x14')]);_0x10dc8b[_0xa8d0('0x19')]=_[_0xa8d0('0x18')](_0xeba90c[_0xa8d0('0x19')]);_0x10dc8b[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],_0x10dc8b[_0xa8d0('0x19')]);_0x1c1e05[_0xa8d0('0x2e')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],qs['fields'](_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1c1e05[_0xa8d0('0x2e')]=_0x1c1e05[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1c1e05[_0xa8d0('0x2e')]:_0x10dc8b['model'];if(_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1c1e05[_0xa8d0('0x40')]=[{'all':!![]}];}_0x1c1e05=_[_0xa8d0('0x36')]({},_0x1c1e05,_0xeba90c[_0xa8d0('0x3b')]);return db[_0xa8d0('0x3c')][_0xa8d0('0x45')](_0x1c1e05)[_0xa8d0('0x3e')](handleEntityNotFound(_0x2f5186,null))['then'](respondWithResult(_0x2f5186,null))[_0xa8d0('0x43')](handleError(_0x2f5186,null));};exports['create']=function(_0x3f6760,_0x1ae68b){return db[_0xa8d0('0x3c')][_0xa8d0('0x46')](_0x3f6760['body'],{})[_0xa8d0('0x3e')](respondWithResult(_0x1ae68b,0xc9))[_0xa8d0('0x43')](handleError(_0x1ae68b,null));};exports['update']=function(_0x22be14,_0x4b0d20){if(_0x22be14[_0xa8d0('0x47')]['id']){delete _0x22be14['body']['id'];}return db['CmHopper'][_0xa8d0('0x45')]({'where':{'id':_0x22be14[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x4b0d20,null))[_0xa8d0('0x3e')](saveUpdates(_0x22be14['body'],null))[_0xa8d0('0x3e')](respondWithResult(_0x4b0d20,null))[_0xa8d0('0x43')](handleError(_0x4b0d20,null));};exports[_0xa8d0('0x49')]=function(_0x352adc,_0x2258d1){return db['CmHopper'][_0xa8d0('0x49')]()['then'](respondWithResult(_0x2258d1,null))[_0xa8d0('0x43')](handleError(_0x2258d1,null));};exports[_0xa8d0('0x4a')]=function(_0x3dd3ae,_0x5a2aef){var _0x900fd0;var _0x149d65=_0x3dd3ae[_0xa8d0('0x48')]['id'];return db[_0xa8d0('0x3c')][_0xa8d0('0x45')]({'where':{'id':_0x3dd3ae['params']['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5a2aef,null))[_0xa8d0('0x3e')](function(_0x5329d3){if(_0x5329d3){return _0x5329d3[_0xa8d0('0x4a')]()[_0xa8d0('0x3e')](function(_0x20b617){return _0x20b617;});}})[_0xa8d0('0x3e')](function(_0x2eeed7){_0x900fd0=_0x2eeed7;if(_0x2eeed7){if(_0x2eeed7[_0xa8d0('0x4b')]||_0x2eeed7[_0xa8d0('0x4c')]){return db[_0x2eeed7['VoiceQueueId']?_0xa8d0('0x4d'):'Campaign']['find']({'where':{'id':_0x2eeed7[_0xa8d0('0x4b')]?_0x2eeed7[_0xa8d0('0x4b')]:_0x2eeed7['CampaignId']},'attributes':['id',_0xa8d0('0x11')],'raw':!![]});}}})[_0xa8d0('0x3e')](function(_0x238a3f){var _0x5bc28c={};if(_0x238a3f){_[_0xa8d0('0x36')](_0x5bc28c,_['omit'](_0x900fd0[_0xa8d0('0x4e')],[_0xa8d0('0x4f'),_0xa8d0('0x50'),'id']));_0x5bc28c[_0xa8d0('0x51')]=0x15;_0x5bc28c[_0xa8d0('0x52')]=_0xa8d0('0x53');_0x5bc28c['campaign']=_0x238a3f[_0xa8d0('0x11')];_0x5bc28c[_0xa8d0('0x54')]=_0x3dd3ae[_0xa8d0('0x55')]['name'];_0x5bc28c[_0xa8d0('0x56')]=_0x3dd3ae[_0xa8d0('0x55')]['id'];_0x5bc28c[_0xa8d0('0x53')]=!![];_0x5bc28c[_0xa8d0('0x57')]=moment()[_0xa8d0('0x58')](_0xa8d0('0x59'));_0x5bc28c[_0xa8d0('0x5a')]=_0x900fd0[_0xa8d0('0x5b')];_0x5bc28c[_0xa8d0('0x5c')]=_0x900fd0[_0xa8d0('0x4b')]?_0xa8d0('0x5d'):_0xa8d0('0x5e');return db[_0xa8d0('0x5f')]['find']({'where':{'id':_0x5bc28c[_0xa8d0('0x60')]},'attributes':['firstName',_0xa8d0('0x61')]})['then'](function(_0x575301){if(!_[_0xa8d0('0x62')](_0x5a2aef)&&!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x63')])){_0x5bc28c['calleridname']=_0x575301['firstName'];if(!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x61')])){_0x5bc28c[_0xa8d0('0x64')]+='\x20'+_0x575301['lastName'];}}})[_0xa8d0('0x65')](function(){return db[_0xa8d0('0x66')][_0xa8d0('0x46')](_0x5bc28c);});}})[_0xa8d0('0x3e')](function(_0x20d3fe){return db[_0xa8d0('0x67')]['destroy']({'where':{'CmHopperId':_0x149d65}});})[_0xa8d0('0x3e')](function(){return _0x5a2aef[_0xa8d0('0x6')](0xcc)[_0xa8d0('0x68')]();})[_0xa8d0('0x43')](handleError(_0x5a2aef,null));};exports[_0xa8d0('0x69')]=function(_0x191df2,_0x3504ac){var _0x3a54a9=[];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x2e2237){_0x3a54a9=_[_0xa8d0('0x18')](_0x2e2237);return _0x191df2['user'][_0xa8d0('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id',_0xa8d0('0x6c'),_0xa8d0('0x6d')],'raw':!![]});})[_0xa8d0('0x3e')](function(_0x59e607){if(_0x59e607&&_0x59e607['length']){return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x41ebd3){var _0x4820d0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa8d0('0x58')](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_[_0xa8d0('0x38')](_0x59e607,'id')},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x203b29={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x59e607)['filter']([_0xa8d0('0x6d'),0x0])[_0xa8d0('0x38')]('id')[_0xa8d0('0x70')]()},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x5a2817={'$or':[_0x4820d0,_0x203b29]};var _0x682412=[];if(_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x71')]&&_0x191df2[_0xa8d0('0x47')]['direction']===_0xa8d0('0x72')){if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')]['hopperIds'])){_0x5a2817['id']={'$in':_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x76')],[_0xa8d0('0x77'),_0x59e607[0x0]['dialOrderByScheduledAt']===_0xa8d0('0x76')?_0xa8d0('0x78'):'ASC'],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7a')),['id',_0xa8d0('0x78')]];}else{if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')])){_0x5a2817['id']={'$notIn':_0x191df2['body'][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x78')],[_0xa8d0('0x77'),_0x59e607[0x0][_0xa8d0('0x6c')]],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7b')),['id','ASC']];}return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),_0xa8d0('0x5b'),_0xa8d0('0x7e')],'where':_0x5a2817,'order':_0x682412,'transaction':_0x41ebd3,'lock':_0x41ebd3['LOCK'][_0xa8d0('0x7f')],'include':[{'model':db[_0xa8d0('0x5f')],'as':_0xa8d0('0x80'),'attributes':_0x3a54a9,'include':[{'model':db[_0xa8d0('0x81')],'as':_0xa8d0('0x82'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name',_0xa8d0('0x84')]}]})[_0xa8d0('0x3e')](function(_0x4e373c){if(_0x4e373c){return _0x4e373c[_0xa8d0('0xd')]({'UserId':_0x191df2[_0xa8d0('0x55')]['id']},{'transaction':_0x41ebd3});}});});}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x3504ac,null))['then'](respondWithResult(_0x3504ac,null))['catch'](handleError(_0x3504ac,null));};exports['getPreviewRecall']=function(_0x2e50c5,_0x5ea683,_0x1effc3){var _0x29d2c1=[];var _0x185a62=_0x2e50c5[_0xa8d0('0x48')]['id'];var _0x5c8ce5=_0x2e50c5[_0xa8d0('0x55')]['id'];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x37cba8){_0x29d2c1=_[_0xa8d0('0x18')](_0x37cba8);return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x348529){const _0x4509c6={'id':_0x185a62};return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),'recallme'],'where':_0x4509c6,'transaction':_0x348529,'lock':_0x348529[_0xa8d0('0x85')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa8d0('0x80'),'attributes':_0x29d2c1,'include':[{'model':db[_0xa8d0('0x81')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xa8d0('0x86')],'as':_0xa8d0('0x87'),'attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name','dialActive']}]})[_0xa8d0('0x3e')](function(_0x12ad99){if(_0x12ad99){return _0x12ad99['update']({'UserId':_0x5c8ce5},{'transaction':_0x348529});}});});})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5ea683,null))['then'](respondWithResult(_0x5ea683,null))[_0xa8d0('0x43')](handleError(_0x5ea683,null));};exports[_0xa8d0('0x88')]=function(_0x975558,_0x4dad88){return _0x975558['user']['getVoiceQueues']({'where':{'type':_0xa8d0('0x89'),'dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id'],'raw':!![]})[_0xa8d0('0x3e')](function(_0x1815c8){if(_0x1815c8&&_0x1815c8[_0xa8d0('0x30')]){return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_['map'](_0x1815c8,'id')},'$or':[{'UserId':null},{'UserId':_0x975558[_0xa8d0('0x55')]['id']}]}});}return 0x0;})[_0xa8d0('0x3e')](function(_0x379286){if(!_[_0xa8d0('0x62')](_0x379286)&&_[_0xa8d0('0x8a')](_0x379286)){return _0x4dad88[_0xa8d0('0x6')](0xc8)['json']({'contacts':_0x379286});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xa8d0('0x88'),0x194,_0xa8d0('0x8b'));_0x4dad88[_0xa8d0('0xe')](0x194);}})[_0xa8d0('0x43')](handleError(_0x4dad88,null));};exports[_0xa8d0('0x8c')]=function(_0x2e439b,_0xfcdf8c){var _0x543521=shared['timezones'];var _0x458af1=[];_[_0xa8d0('0x38')](_0x543521,function(_0x4eb658){_0x458af1[_0xa8d0('0x8d')]({'id':_0x4eb658['name'],'name':_0x4eb658['name'],'utcOffset':_0x4eb658[_0xa8d0('0x8e')]});});return _0xfcdf8c[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')]({'tz':_0x458af1});};exports[_0xa8d0('0x8f')]=function(_0x1d8197,_0x2be1ad){var _0x76609=shared[_0xa8d0('0x90')];var _0x4fc9fe={};if(!_[_0xa8d0('0x62')](_0x76609[_0x1d8197['body']['id']]))_0x4fc9fe=_0x76609[_0x1d8197[_0xa8d0('0x47')]['id']];return _0x2be1ad[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')](_0x4fc9fe);}; \ No newline at end of file +var _0xe132=['merge','options','CmHopper','include','findAll','rows','catch','show','params','keys','length','includeAll','body','find','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','updatedAt','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','create','CmHopperAdditionalPhone','end','getVoiceQueues','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','sequelize','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','CmCompany','Company','CmList','List','Queue','LOCK','Contact','dialActive','getOpenContacts','outbound','preview','format','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','offset','undefined','limit','count','status','Content-Range','json','update','then','stack','name','index','map','rawAttributes','fieldName','type','filters','intersection','model','query','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','order','sort','where','pick','filter'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0xe132,0x162));var _0x2e13=function(_0x294931,_0x318a4b){_0x294931=_0x294931-0x0;var _0x5388de=_0xe132[_0x294931];return _0x5388de;};'use strict';var moment=require(_0x2e13('0x0'));var _=require('lodash');var qs=require(_0x2e13('0x1'));var logger=require(_0x2e13('0x2'))(_0x2e13('0x3'));var shared=require(_0x2e13('0x4'));var db=require(_0x2e13('0x5'))['db'];function respondWithResult(_0x4b87a6,_0x1ae6a9){_0x1ae6a9=_0x1ae6a9||0xc8;return function(_0x3f01fe){if(_0x3f01fe){return _0x4b87a6['status'](_0x1ae6a9)['json'](_0x3f01fe);}};}function respondWithFilteredResult(_0x260dc1,_0x2f9d00){return function(_0x1c670b){if(_0x1c670b){var _0x71f9d3=typeof _0x2f9d00[_0x2e13('0x6')]===_0x2e13('0x7')&&typeof _0x2f9d00[_0x2e13('0x8')]===_0x2e13('0x7');var _0xd031e9=_0x1c670b[_0x2e13('0x9')];var _0x5122a2=_0x71f9d3?0x0:_0x2f9d00[_0x2e13('0x6')];var _0x20fe3e=_0x71f9d3?_0x1c670b[_0x2e13('0x9')]:_0x2f9d00[_0x2e13('0x6')]+_0x2f9d00[_0x2e13('0x8')];var _0x1a871d;if(_0x20fe3e>=_0xd031e9){_0x20fe3e=_0xd031e9;_0x1a871d=0xc8;}else{_0x1a871d=0xce;}_0x260dc1[_0x2e13('0xa')](_0x1a871d);return _0x260dc1['set'](_0x2e13('0xb'),_0x5122a2+'-'+_0x20fe3e+'/'+_0xd031e9)[_0x2e13('0xc')](_0x1c670b);}return null;};}function saveUpdates(_0x320303,_0x299dd3){return function(_0x424e58){if(_0x424e58){return _0x424e58[_0x2e13('0xd')](_0x320303)[_0x2e13('0xe')](function(_0x51f1a3){return _0x51f1a3;});}return null;};}function handleEntityNotFound(_0xb70eb8,_0xea6c20){return function(_0xfaca18){if(!_0xfaca18){_0xb70eb8['sendStatus'](0x194);}return _0xfaca18;};}function handleError(_0x4d7fa3,_0x2a58e5){_0x2a58e5=_0x2a58e5||0x1f4;return function(_0x433bbd){logger['error'](_0x433bbd[_0x2e13('0xf')]);if(_0x433bbd[_0x2e13('0x10')]){delete _0x433bbd[_0x2e13('0x10')];}_0x4d7fa3['status'](_0x2a58e5)['send'](_0x433bbd);};}exports[_0x2e13('0x11')]=function(_0x2c026d,_0x336a10){var _0x3cdefc={},_0x399ce2={},_0x32ce2f={'count':0x0,'rows':[]};var _0x2496ee=_[_0x2e13('0x12')](db['CmHopper'][_0x2e13('0x13')],function(_0x9c37a9){return{'name':_0x9c37a9[_0x2e13('0x14')],'type':_0x9c37a9[_0x2e13('0x15')]['key']};});_0x399ce2['model']=_[_0x2e13('0x12')](_0x2496ee,_0x2e13('0x10'));_0x399ce2['query']=_['keys'](_0x2c026d['query']);_0x399ce2[_0x2e13('0x16')]=_[_0x2e13('0x17')](_0x399ce2[_0x2e13('0x18')],_0x399ce2[_0x2e13('0x19')]);_0x399ce2[_0x2e13('0x16')]=_[_0x2e13('0x1a')](_0x399ce2['filters'],[_0x2e13('0x1b'),_0x2e13('0x1c'),_0x2e13('0x1d'),_0x2e13('0x1e'),_0x2e13('0x1f'),_0x2e13('0x20'),'$ne',_0x2e13('0x21'),_0x2e13('0x22'),'$between','$notBetween',_0x2e13('0x23'),_0x2e13('0x24'),_0x2e13('0x25'),'$notLike',_0x2e13('0x26'),_0x2e13('0x27'),_0x2e13('0x25'),_0x2e13('0x28'),_0x2e13('0x29'),_0x2e13('0x2a'),_0x2e13('0x2b')]);_0x3cdefc[_0x2e13('0x2c')]=_[_0x2e13('0x17')](_0x399ce2[_0x2e13('0x18')],qs[_0x2e13('0x2d')](_0x2c026d[_0x2e13('0x19')][_0x2e13('0x2d')]));_0x3cdefc[_0x2e13('0x2c')]=_0x3cdefc[_0x2e13('0x2c')]['length']?_0x3cdefc[_0x2e13('0x2c')]:_0x399ce2[_0x2e13('0x18')];if(!_0x2c026d[_0x2e13('0x19')]['hasOwnProperty']('nolimit')){_0x3cdefc[_0x2e13('0x8')]=qs[_0x2e13('0x8')](_0x2c026d[_0x2e13('0x19')][_0x2e13('0x8')]);_0x3cdefc[_0x2e13('0x6')]=qs[_0x2e13('0x6')](_0x2c026d['query']['offset']);}_0x3cdefc[_0x2e13('0x2e')]=qs[_0x2e13('0x2f')](_0x2c026d[_0x2e13('0x19')][_0x2e13('0x2f')]);_0x3cdefc[_0x2e13('0x30')]=qs[_0x2e13('0x16')](_[_0x2e13('0x31')](_0x2c026d[_0x2e13('0x19')],_0x399ce2['filters']),_0x2496ee);if(_0x2c026d[_0x2e13('0x19')][_0x2e13('0x32')]){_0x3cdefc[_0x2e13('0x30')]=_[_0x2e13('0x33')](_0x3cdefc[_0x2e13('0x30')],{'$or':_['map'](_0x2496ee,function(_0x28e6de){if(_0x28e6de[_0x2e13('0x15')]!=='VIRTUAL'){var _0x750ee2={};_0x750ee2[_0x28e6de[_0x2e13('0x10')]]={'$like':'%'+_0x2c026d[_0x2e13('0x19')]['filter']+'%'};return _0x750ee2;}})});}_0x3cdefc=_[_0x2e13('0x33')]({},_0x3cdefc,_0x2c026d[_0x2e13('0x34')]);var _0x4bfb50={'where':_0x3cdefc[_0x2e13('0x30')]};return db[_0x2e13('0x35')]['count'](_0x4bfb50)[_0x2e13('0xe')](function(_0x5c17bb){_0x32ce2f[_0x2e13('0x9')]=_0x5c17bb;if(_0x2c026d[_0x2e13('0x19')]['includeAll']){_0x3cdefc[_0x2e13('0x36')]=[{'all':!![]}];}return db[_0x2e13('0x35')][_0x2e13('0x37')](_0x3cdefc);})[_0x2e13('0xe')](function(_0x20ae95){_0x32ce2f[_0x2e13('0x38')]=_0x20ae95;return _0x32ce2f;})[_0x2e13('0xe')](respondWithFilteredResult(_0x336a10,_0x3cdefc))[_0x2e13('0x39')](handleError(_0x336a10,null));};exports[_0x2e13('0x3a')]=function(_0x1cca7f,_0x4ffb30){var _0x24ebb6={'raw':!![],'where':{'id':_0x1cca7f[_0x2e13('0x3b')]['id']}},_0xd2e8ae={};_0xd2e8ae[_0x2e13('0x18')]=_[_0x2e13('0x3c')](db['CmHopper'][_0x2e13('0x13')]);_0xd2e8ae['query']=_[_0x2e13('0x3c')](_0x1cca7f[_0x2e13('0x19')]);_0xd2e8ae['filters']=_[_0x2e13('0x17')](_0xd2e8ae['model'],_0xd2e8ae[_0x2e13('0x19')]);_0x24ebb6[_0x2e13('0x2c')]=_[_0x2e13('0x17')](_0xd2e8ae[_0x2e13('0x18')],qs[_0x2e13('0x2d')](_0x1cca7f['query'][_0x2e13('0x2d')]));_0x24ebb6['attributes']=_0x24ebb6[_0x2e13('0x2c')][_0x2e13('0x3d')]?_0x24ebb6[_0x2e13('0x2c')]:_0xd2e8ae[_0x2e13('0x18')];if(_0x1cca7f[_0x2e13('0x19')][_0x2e13('0x3e')]){_0x24ebb6['include']=[{'all':!![]}];}_0x24ebb6=_['merge']({},_0x24ebb6,_0x1cca7f[_0x2e13('0x34')]);return db[_0x2e13('0x35')]['find'](_0x24ebb6)[_0x2e13('0xe')](handleEntityNotFound(_0x4ffb30,null))[_0x2e13('0xe')](respondWithResult(_0x4ffb30,null))[_0x2e13('0x39')](handleError(_0x4ffb30,null));};exports['create']=function(_0x5c6a9a,_0xd44b46){return db['CmHopper']['create'](_0x5c6a9a[_0x2e13('0x3f')],{})[_0x2e13('0xe')](respondWithResult(_0xd44b46,0xc9))[_0x2e13('0x39')](handleError(_0xd44b46,null));};exports['update']=function(_0x20b444,_0x16bdf2){if(_0x20b444[_0x2e13('0x3f')]['id']){delete _0x20b444[_0x2e13('0x3f')]['id'];}return db['CmHopper'][_0x2e13('0x40')]({'where':{'id':_0x20b444['params']['id']}})[_0x2e13('0xe')](handleEntityNotFound(_0x16bdf2,null))[_0x2e13('0xe')](saveUpdates(_0x20b444[_0x2e13('0x3f')],null))[_0x2e13('0xe')](respondWithResult(_0x16bdf2,null))[_0x2e13('0x39')](handleError(_0x16bdf2,null));};exports[_0x2e13('0x41')]=function(_0x961af7,_0x8e8b86){return db[_0x2e13('0x35')][_0x2e13('0x41')]()['then'](respondWithResult(_0x8e8b86,null))[_0x2e13('0x39')](handleError(_0x8e8b86,null));};exports[_0x2e13('0x42')]=function(_0x4780b7,_0x1d13ec){var _0x426e75;var _0xcc5495=_0x4780b7[_0x2e13('0x3b')]['id'];return db[_0x2e13('0x35')][_0x2e13('0x40')]({'where':{'id':_0x4780b7[_0x2e13('0x3b')]['id']}})[_0x2e13('0xe')](handleEntityNotFound(_0x1d13ec,null))[_0x2e13('0xe')](function(_0x532689){if(_0x532689){return _0x532689[_0x2e13('0x42')]()[_0x2e13('0xe')](function(_0x39cef0){return _0x39cef0;});}})[_0x2e13('0xe')](function(_0x13374a){_0x426e75=_0x13374a;if(_0x13374a){if(_0x13374a[_0x2e13('0x43')]||_0x13374a['CampaignId']){return db[_0x13374a[_0x2e13('0x43')]?_0x2e13('0x44'):_0x2e13('0x45')][_0x2e13('0x40')]({'where':{'id':_0x13374a[_0x2e13('0x43')]?_0x13374a[_0x2e13('0x43')]:_0x13374a[_0x2e13('0x46')]},'attributes':['id','name'],'raw':!![]});}}})[_0x2e13('0xe')](function(_0x3a1a9c){var _0x252b14={};if(_0x3a1a9c){_['merge'](_0x252b14,_[_0x2e13('0x47')](_0x426e75[_0x2e13('0x48')],['createdAt',_0x2e13('0x49'),'id']));_0x252b14['state']=0x15;_0x252b14['statedesc']=_0x2e13('0x4a');_0x252b14[_0x2e13('0x4b')]=_0x3a1a9c[_0x2e13('0x10')];_0x252b14[_0x2e13('0x4c')]=_0x4780b7[_0x2e13('0x4d')]['name'];_0x252b14[_0x2e13('0x4e')]=_0x4780b7['user']['id'];_0x252b14['deleted']=!![];_0x252b14[_0x2e13('0x4f')]=moment()['format'](_0x2e13('0x50'));_0x252b14[_0x2e13('0x51')]=_0x426e75[_0x2e13('0x52')];_0x252b14[_0x2e13('0x53')]=_0x426e75[_0x2e13('0x43')]?_0x2e13('0x54'):_0x2e13('0x55');return db[_0x2e13('0x56')]['find']({'where':{'id':_0x252b14[_0x2e13('0x57')]},'attributes':[_0x2e13('0x58'),'lastName']})['then'](function(_0xbfecec){if(!_[_0x2e13('0x59')](_0x1d13ec)&&!_[_0x2e13('0x59')](_0xbfecec['firstName'])){_0x252b14[_0x2e13('0x5a')]=_0xbfecec['firstName'];if(!_[_0x2e13('0x59')](_0xbfecec[_0x2e13('0x5b')])){_0x252b14[_0x2e13('0x5a')]+='\x20'+_0xbfecec['lastName'];}}})[_0x2e13('0x5c')](function(){return db['CmHopperFinal'][_0x2e13('0x5d')](_0x252b14);});}})[_0x2e13('0xe')](function(_0x3de3fc){return db[_0x2e13('0x5e')][_0x2e13('0x42')]({'where':{'CmHopperId':_0xcc5495}});})[_0x2e13('0xe')](function(){return _0x1d13ec['status'](0xcc)[_0x2e13('0x5f')]();})[_0x2e13('0x39')](handleError(_0x1d13ec,null));};exports['getPreview']=function(_0x591065,_0x446643){var _0x1c8862=[];return db['CmContact']['describe']()[_0x2e13('0xe')](function(_0x4b0481){_0x1c8862=_[_0x2e13('0x3c')](_0x4b0481);return _0x591065[_0x2e13('0x4d')][_0x2e13('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x2e13('0x61'),_0x2e13('0x62')],'raw':!![]});})[_0x2e13('0xe')](function(_0x52ee42){if(_0x52ee42&&_0x52ee42[_0x2e13('0x3d')]){return db['sequelize'][_0x2e13('0x63')](function(_0x571fd9){var _0x5d09c4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x2e13('0x50'))},'VoiceQueueId':{'$in':_[_0x2e13('0x12')](_0x52ee42,'id')},'$or':[{'UserId':null},{'UserId':_0x591065[_0x2e13('0x4d')]['id']}]};var _0x1a1cc0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x52ee42)[_0x2e13('0x32')]([_0x2e13('0x62'),0x0])[_0x2e13('0x12')]('id')[_0x2e13('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x591065['user']['id']}]};var _0x1ac435={'$or':[_0x5d09c4,_0x1a1cc0]};var _0x2c75b2=[];if(_0x591065[_0x2e13('0x3f')][_0x2e13('0x65')]&&_0x591065[_0x2e13('0x3f')]['direction']===_0x2e13('0x66')){if(!_[_0x2e13('0x67')](_0x591065['body'][_0x2e13('0x68')])){_0x1ac435['id']={'$in':_0x591065['body'][_0x2e13('0x68')]};}_0x2c75b2=[[_0x2e13('0x69'),_0x2e13('0x6a')],[_0x2e13('0x6b'),_0x52ee42[0x0][_0x2e13('0x61')]===_0x2e13('0x6a')?'DESC':_0x2e13('0x6a')],db[_0x2e13('0x6c')][_0x2e13('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x2e13('0x6e')]];}else{if(!_[_0x2e13('0x67')](_0x591065[_0x2e13('0x3f')][_0x2e13('0x68')])){_0x1ac435['id']={'$notIn':_0x591065['body'][_0x2e13('0x68')]};}_0x2c75b2=[[_0x2e13('0x69'),_0x2e13('0x6e')],[_0x2e13('0x6b'),_0x52ee42[0x0]['dialOrderByScheduledAt']],db[_0x2e13('0x6c')][_0x2e13('0x6d')](_0x2e13('0x6f')),['id','ASC']];}return db[_0x2e13('0x35')][_0x2e13('0x70')]({'attributes':['id',_0x2e13('0x71'),_0x2e13('0x52'),_0x2e13('0x72')],'where':_0x1ac435,'order':_0x2c75b2,'transaction':_0x571fd9,'lock':_0x571fd9['LOCK'][_0x2e13('0x73')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x1c8862,'include':[{'model':db[_0x2e13('0x74')],'as':_0x2e13('0x75'),'attributes':['id',_0x2e13('0x10')]}]},{'model':db[_0x2e13('0x76')],'as':_0x2e13('0x77'),'attributes':['id','name']},{'model':db[_0x2e13('0x44')],'as':_0x2e13('0x78'),'attributes':['id',_0x2e13('0x10'),'dialActive']}]})[_0x2e13('0xe')](function(_0xec435e){if(_0xec435e){return _0xec435e[_0x2e13('0xd')]({'UserId':_0x591065[_0x2e13('0x4d')]['id']},{'transaction':_0x571fd9});}});});}})['then'](handleEntityNotFound(_0x446643,null))[_0x2e13('0xe')](respondWithResult(_0x446643,null))['catch'](handleError(_0x446643,null));};exports['getPreviewRecall']=function(_0x22f345,_0x27ccff,_0xa7c844){var _0x5e110e=[];var _0x101e3b=_0x22f345[_0x2e13('0x3b')]['id'];var _0x55f9ae=_0x22f345[_0x2e13('0x4d')]['id'];return db[_0x2e13('0x56')][_0x2e13('0x41')]()[_0x2e13('0xe')](function(_0x5f50d3){_0x5e110e=_[_0x2e13('0x3c')](_0x5f50d3);return db['sequelize'][_0x2e13('0x63')](function(_0x94d5af){const _0x33e627={'id':_0x101e3b};return db[_0x2e13('0x35')][_0x2e13('0x70')]({'attributes':['id','scheduledat',_0x2e13('0x72')],'where':_0x33e627,'transaction':_0x94d5af,'lock':_0x94d5af[_0x2e13('0x79')][_0x2e13('0x73')],'include':[{'model':db['CmContact'],'as':_0x2e13('0x7a'),'attributes':_0x5e110e,'include':[{'model':db['CmCompany'],'as':_0x2e13('0x75'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x2e13('0x77'),'attributes':['id',_0x2e13('0x10')]},{'model':db[_0x2e13('0x44')],'as':_0x2e13('0x78'),'attributes':['id',_0x2e13('0x10'),_0x2e13('0x7b')]}]})[_0x2e13('0xe')](function(_0x5c8f68){if(_0x5c8f68){return _0x5c8f68[_0x2e13('0xd')]({'UserId':_0x55f9ae},{'transaction':_0x94d5af});}});});})[_0x2e13('0xe')](handleEntityNotFound(_0x27ccff,null))['then'](respondWithResult(_0x27ccff,null))[_0x2e13('0x39')](handleError(_0x27ccff,null));};exports[_0x2e13('0x7c')]=function(_0x466858,_0x2f79e2){return _0x466858[_0x2e13('0x4d')][_0x2e13('0x60')]({'where':{'type':_0x2e13('0x7d'),'dialActive':!![],'dialMethod':_0x2e13('0x7e')},'attributes':['id'],'raw':!![]})[_0x2e13('0xe')](function(_0x3be5a8){if(_0x3be5a8&&_0x3be5a8[_0x2e13('0x3d')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2e13('0x7f')](_0x2e13('0x50'))},'VoiceQueueId':{'$in':_[_0x2e13('0x12')](_0x3be5a8,'id')},'$or':[{'UserId':null},{'UserId':_0x466858[_0x2e13('0x4d')]['id']}]}});}return 0x0;})[_0x2e13('0xe')](function(_0x29f599){if(!_[_0x2e13('0x59')](_0x29f599)&&_['isNumber'](_0x29f599)){return _0x2f79e2[_0x2e13('0xa')](0xc8)[_0x2e13('0xc')]({'contacts':_0x29f599});}else{logger['error'](_0x2e13('0x80'),_0x2e13('0x7c'),0x194,_0x2e13('0x81'));_0x2f79e2[_0x2e13('0x82')](0x194);}})[_0x2e13('0x39')](handleError(_0x2f79e2,null));};exports[_0x2e13('0x83')]=function(_0x373100,_0x4c897b){var _0x2ee8d0=shared['timezones'];var _0x1369ff=[];_[_0x2e13('0x12')](_0x2ee8d0,function(_0x42be7d){_0x1369ff[_0x2e13('0x84')]({'id':_0x42be7d['name'],'name':_0x42be7d[_0x2e13('0x10')],'utcOffset':_0x42be7d['utcOffset']});});return _0x4c897b['status'](0xc8)[_0x2e13('0xc')]({'tz':_0x1369ff});};exports[_0x2e13('0x85')]=function(_0x47d8fe,_0x12fbe3){var _0x56a094=shared[_0x2e13('0x86')];var _0x5d1927={};if(!_['isNil'](_0x56a094[_0x47d8fe[_0x2e13('0x3f')]['id']]))_0x5d1927=_0x56a094[_0x47d8fe[_0x2e13('0x3f')]['id']];return _0x12fbe3[_0x2e13('0xa')](0xc8)['json'](_0x5d1927);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 69ce7cd..818cbbd 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 _0xeff8=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x3ab566,_0x8d2cf0){var _0x20ce65=function(_0x5758fe){while(--_0x5758fe){_0x3ab566['push'](_0x3ab566['shift']());}};_0x20ce65(++_0x8d2cf0);}(_0xeff8,0x186));var _0x8eff=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xeff8[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]},{'name':_0x8eff('0xc'),'fields':[_0x8eff('0xc')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xd117,0x182));var _0x7d11=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xd117[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0d92148..ab89bc2 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 _0xe3ef=['CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetCmHopper','debug','stringify','catch','message','error','find','ShowCmHopper','CreateCmHopper','CmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','transaction','order','LOCK','UPDATE','keys','User','Agent','name','length','UserId','push','all','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','sequelize','COUNT','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','Contact','phone','dialTimezone','getContactByPhone','ResetActiveCalls'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xe3ef,0x1d7));var _0xfe3e=function(_0x213457,_0x14f917){_0x213457=_0x213457-0x0;var _0x497651=_0xe3ef[_0x213457];return _0x497651;};'use strict';var _=require(_0xfe3e('0x0'));var util=require('util');var moment=require(_0xfe3e('0x1'));var BPromise=require(_0xfe3e('0x2'));var db=require(_0xfe3e('0x3'))['db'];var logger=require(_0xfe3e('0x4'))(_0xfe3e('0x5'));exports['GetCmHopper']=function(_0xd7a761){var _0x1a5b1e=this;return new Promise(function(_0x287995,_0x45578d){return db['CmHopper'][_0xfe3e('0x6')]({'raw':_0xd7a761[_0xfe3e('0x7')]?_0xd7a761[_0xfe3e('0x7')][_0xfe3e('0x8')]===undefined?!![]:![]:!![],'where':_0xd7a761['options']?_0xd7a761[_0xfe3e('0x7')][_0xfe3e('0x9')]||null:null,'attributes':_0xd7a761['options']?_0xd7a761[_0xfe3e('0x7')][_0xfe3e('0xa')]||null:null,'limit':_0xd7a761[_0xfe3e('0x7')]?_0xd7a761[_0xfe3e('0x7')][_0xfe3e('0xb')]||null:null,'include':_0xd7a761[_0xfe3e('0x7')]?_0xd7a761[_0xfe3e('0x7')][_0xfe3e('0xc')]?_[_0xfe3e('0xd')](_0xd7a761[_0xfe3e('0x7')][_0xfe3e('0xc')],function(_0x184343){return{'model':db[_0x184343['model']],'as':_0x184343['as'],'attributes':_0x184343['attributes'],'include':_0x184343[_0xfe3e('0xc')]?_[_0xfe3e('0xd')](_0x184343['include'],function(_0x55a237){return{'model':db[_0x55a237[_0xfe3e('0xe')]],'as':_0x55a237['as'],'attributes':_0x55a237[_0xfe3e('0xa')],'include':_0x55a237[_0xfe3e('0xc')]?_['map'](_0x55a237[_0xfe3e('0xc')],function(_0x4e0b0f){return{'model':db[_0x4e0b0f[_0xfe3e('0xe')]],'as':_0x4e0b0f['as'],'attributes':_0x4e0b0f[_0xfe3e('0xa')]};}):[]};}):[]};}):[]:[]})[_0xfe3e('0xf')](function(_0x49bbc2){logger[_0xfe3e('0x10')](_0xfe3e('0x11'),_0xd7a761);logger[_0xfe3e('0x12')](_0xfe3e('0x11'),_0xd7a761,JSON[_0xfe3e('0x13')](_0x49bbc2));_0x287995(_0x49bbc2);})[_0xfe3e('0x14')](function(_0x1e549b){logger['error'](_0xfe3e('0x11'),_0x1e549b[_0xfe3e('0x15')],_0xd7a761);_0x45578d(_0x1a5b1e[_0xfe3e('0x16')](0x1f4,_0x1e549b[_0xfe3e('0x15')]));});});};exports['ShowCmHopper']=function(_0x517664){var _0x55f778=this;return new Promise(function(_0xdae153,_0xfc6fd9){return db['CmHopper'][_0xfe3e('0x17')]({'raw':_0x517664['options']?_0x517664[_0xfe3e('0x7')][_0xfe3e('0x8')]===undefined?!![]:![]:!![],'where':_0x517664[_0xfe3e('0x7')]?_0x517664['options'][_0xfe3e('0x9')]||null:null,'attributes':_0x517664[_0xfe3e('0x7')]?_0x517664[_0xfe3e('0x7')][_0xfe3e('0xa')]||null:null,'include':_0x517664['options']?_0x517664['options'][_0xfe3e('0xc')]?_[_0xfe3e('0xd')](_0x517664['options']['include'],function(_0x5bc046){return{'model':db[_0x5bc046[_0xfe3e('0xe')]],'as':_0x5bc046['as'],'attributes':_0x5bc046[_0xfe3e('0xa')],'include':_0x5bc046['include']?_[_0xfe3e('0xd')](_0x5bc046[_0xfe3e('0xc')],function(_0x149912){return{'model':db[_0x149912['model']],'as':_0x149912['as'],'attributes':_0x149912['attributes'],'include':_0x149912[_0xfe3e('0xc')]?_[_0xfe3e('0xd')](_0x149912[_0xfe3e('0xc')],function(_0x1a4d30){return{'model':db[_0x1a4d30[_0xfe3e('0xe')]],'as':_0x1a4d30['as'],'attributes':_0x1a4d30[_0xfe3e('0xa')]};}):[]};}):[]};}):[]:[]})[_0xfe3e('0xf')](function(_0x141514){logger[_0xfe3e('0x10')]('ShowCmHopper',_0x517664);logger[_0xfe3e('0x12')]('ShowCmHopper',_0x517664,JSON[_0xfe3e('0x13')](_0x141514));_0xdae153(_0x141514);})[_0xfe3e('0x14')](function(_0x1adf83){logger['error'](_0xfe3e('0x18'),_0x1adf83[_0xfe3e('0x15')],_0x517664);_0xfc6fd9(_0x55f778[_0xfe3e('0x16')](0x1f4,_0x1adf83['message']));});});};exports[_0xfe3e('0x19')]=function(_0x24f0aa){var _0x44a1fb=this;return new Promise(function(_0x2acd67,_0x2c2b88){return db[_0xfe3e('0x1a')][_0xfe3e('0x1b')](_0x24f0aa['body'],{'raw':_0x24f0aa[_0xfe3e('0x7')]?_0x24f0aa[_0xfe3e('0x7')][_0xfe3e('0x8')]===undefined?!![]:![]:!![]})[_0xfe3e('0xf')](function(_0x471e16){logger[_0xfe3e('0x10')](_0xfe3e('0x19'),_0x24f0aa);logger[_0xfe3e('0x12')](_0xfe3e('0x19'),_0x24f0aa,JSON[_0xfe3e('0x13')](_0x471e16));_0x2acd67(_0x471e16);})['catch'](function(_0x57417a){logger[_0xfe3e('0x16')](_0xfe3e('0x19'),_0x57417a[_0xfe3e('0x15')],_0x24f0aa);_0x2c2b88(_0x44a1fb['error'](0x1f4,_0x57417a[_0xfe3e('0x15')]));});});};exports[_0xfe3e('0x1c')]=function(_0x1e1325){var _0x74b966=this;return new Promise(function(_0x44f306,_0x55a64d){return db[_0xfe3e('0x1a')][_0xfe3e('0x1d')](_0x1e1325[_0xfe3e('0x1e')],{'raw':_0x1e1325[_0xfe3e('0x7')]?_0x1e1325['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1325['options']?_0x1e1325[_0xfe3e('0x7')]['where']||null:null,'attributes':_0x1e1325[_0xfe3e('0x7')]?_0x1e1325['options'][_0xfe3e('0xa')]||null:null,'limit':_0x1e1325[_0xfe3e('0x7')]?_0x1e1325[_0xfe3e('0x7')]['limit']||null:null})['then'](function(_0xb0f6fe){logger[_0xfe3e('0x10')]('UpdateCmHopper',_0x1e1325);logger[_0xfe3e('0x10')](_0xfe3e('0x1f'),JSON['stringify'](_0x1e1325['options'][_0xfe3e('0x9')]),_0x1e1325[_0xfe3e('0x1e')][_0xfe3e('0x20')]);logger[_0xfe3e('0x12')](_0xfe3e('0x1c'),_0x1e1325,JSON[_0xfe3e('0x13')](_0xb0f6fe));_0x44f306(_0xb0f6fe);})[_0xfe3e('0x14')](function(_0x16a244){logger[_0xfe3e('0x16')](_0xfe3e('0x1c'),_0x16a244[_0xfe3e('0x15')],_0x1e1325);_0x55a64d(_0x74b966['error'](0x1f4,_0x16a244[_0xfe3e('0x15')]));});});};exports[_0xfe3e('0x21')]=function(_0x4365f8){var _0x413e73=this;return new Promise(function(_0x576767,_0x14889a){return db[_0xfe3e('0x1a')][_0xfe3e('0x22')]({'where':_0x4365f8[_0xfe3e('0x7')]?_0x4365f8[_0xfe3e('0x7')][_0xfe3e('0x9')]||null:null})[_0xfe3e('0xf')](function(_0x25ee8c){logger[_0xfe3e('0x10')]('DestroyCmHopper',_0x4365f8);logger[_0xfe3e('0x12')](_0xfe3e('0x21'),_0x4365f8,JSON[_0xfe3e('0x13')](_0x25ee8c));_0x576767(_0x25ee8c);})['catch'](function(_0xc70f79){logger['error']('DestroyCmHopper',_0xc70f79[_0xfe3e('0x15')],_0x4365f8);_0x14889a(_0x413e73[_0xfe3e('0x16')](0x1f4,_0xc70f79['message']));});});};exports['GetContactDialer']=function(_0x1b66db){var _0x3c124c=this;return new Promise(function(_0x5c674c,_0x50932a){return db[_0xfe3e('0x23')][_0xfe3e('0x24')]()[_0xfe3e('0xf')](function(_0x276390){return db['sequelize'][_0xfe3e('0x25')](function(_0xfcae89){return db[_0xfe3e('0x1a')][_0xfe3e('0x6')]({'where':_0x1b66db[_0xfe3e('0x7')]?_0x1b66db[_0xfe3e('0x7')]['where']||null:null,'attributes':_0x1b66db[_0xfe3e('0x7')]?_0x1b66db[_0xfe3e('0x7')][_0xfe3e('0xa')]||null:null,'limit':_0x1b66db[_0xfe3e('0x7')]?_0x1b66db[_0xfe3e('0x7')][_0xfe3e('0xb')]||null:null,'order':_0x1b66db[_0xfe3e('0x7')]?_0x1b66db[_0xfe3e('0x7')][_0xfe3e('0x26')]||null:null,'transaction':_0xfcae89,'lock':_0xfcae89[_0xfe3e('0x27')][_0xfe3e('0x28')],'include':[{'model':db[_0xfe3e('0x23')],'as':'Contact','attributes':_[_0xfe3e('0x29')](_0x276390)},{'model':db[_0xfe3e('0x2a')],'as':_0xfe3e('0x2b'),'attributes':['id',_0xfe3e('0x2c'),'voicePause']}]})[_0xfe3e('0xf')](function(_0x1b4bde){var _0x355028=[];var _0x4ccc6f=[];for(var _0x5ad767=0x0;_0x5ad767<_0x1b4bde[_0xfe3e('0x2d')];_0x5ad767+=0x1){var _0x178fd6=_0x1b4bde[_0x5ad767][_0xfe3e('0x2e')];if(_0x178fd6===null){_0x355028['push'](_0x1b4bde[_0x5ad767][_0xfe3e('0x1d')](_0x1b66db[_0xfe3e('0x1e')],{'transaction':_0xfcae89}));}else if(!_0x4ccc6f['includes'](_0x178fd6)){_0x4ccc6f[_0xfe3e('0x2f')](_0x178fd6);_0x355028[_0xfe3e('0x2f')](_0x1b4bde[_0x5ad767][_0xfe3e('0x1d')](_0x1b66db['body'],{'transaction':_0xfcae89}));}}return BPromise[_0xfe3e('0x30')](_0x355028);});})['then'](function(_0x59b765){logger[_0xfe3e('0x10')]('GetContactDialer',_0x1b66db);if(_0x59b765[_0xfe3e('0x2d')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x59b765[0x0][_0xfe3e('0x31')]['id'],_0x59b765[0x0][_0xfe3e('0x31')][_0xfe3e('0x32')],_0x59b765[0x0]['dataValues'][_0xfe3e('0x20')]);}logger[_0xfe3e('0x12')]('GetContactDialer',_0x1b66db,JSON[_0xfe3e('0x13')](_0x59b765));_0x5c674c(_0x59b765);})['catch'](function(_0x507ba8){logger[_0xfe3e('0x16')](_0xfe3e('0x33'),_0x507ba8[_0xfe3e('0x15')],_0x1b66db);_0x50932a(_0x3c124c['error'](0x1f4,_0x507ba8[_0xfe3e('0x15')]));});});});};exports[_0xfe3e('0x34')]=function(_0x4854dd){var _0x58e4d2=this;return new Promise(function(_0x13ffe1,_0x2367de){return db['sequelize']['transaction'](function(_0x5840eb){return db['CmHopperFinal'][_0xfe3e('0x1b')](_0x4854dd[_0xfe3e('0x1e')],{'raw':_0x4854dd[_0xfe3e('0x7')]?_0x4854dd[_0xfe3e('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0x5840eb})['then'](function(){logger[_0xfe3e('0x10')](_0xfe3e('0x35'),JSON[_0xfe3e('0x13')](_0x4854dd[_0xfe3e('0x7')][_0xfe3e('0x9')]),_0x4854dd[_0xfe3e('0x7')][_0xfe3e('0x9')]['active']);return db[_0xfe3e('0x1a')]['destroy']({'where':_0x4854dd[_0xfe3e('0x7')]?_0x4854dd['options']['where']||null:null,'transaction':_0x5840eb});});})[_0xfe3e('0xf')](function(_0x890123){logger[_0xfe3e('0x10')](_0xfe3e('0x34'),_0x4854dd);logger[_0xfe3e('0x12')](_0xfe3e('0x34'),_0x4854dd,JSON['stringify'](_0x890123));_0x13ffe1(_0x890123);})[_0xfe3e('0x14')](function(_0x17a60a){logger[_0xfe3e('0x16')](_0xfe3e('0x34'),_0x17a60a[_0xfe3e('0x15')],_0x4854dd);_0x2367de(_0x58e4d2[_0xfe3e('0x16')](0x1f4,_0x17a60a[_0xfe3e('0x15')]));});});};exports[_0xfe3e('0x36')]=function(_0xf67687){var _0x42d391=this;return new Promise(function(_0xf7adb,_0x14bcad){return db[_0xfe3e('0x1a')][_0xfe3e('0x6')]({'raw':_0xf67687[_0xfe3e('0x7')]?_0xf67687[_0xfe3e('0x7')][_0xfe3e('0x8')]===undefined?!![]:![]:!![],'where':_0xf67687[_0xfe3e('0x7')]?_0xf67687[_0xfe3e('0x7')][_0xfe3e('0x9')]||null:null,'attributes':[[db[_0xfe3e('0x37')]['fn'](_0xfe3e('0x38'),db[_0xfe3e('0x37')]['fn']('IF',db[_0xfe3e('0x37')]['literal']('`scheduledat`\x20>=\x20'+util[_0xfe3e('0x39')](_0xfe3e('0x3a'),moment()[_0xfe3e('0x39')](_0xfe3e('0x3b')))+_0xfe3e('0x3c')))),_0xfe3e('0x3d')]]})[_0xfe3e('0xf')](function(_0x7f723e){logger['info'](_0xfe3e('0x36'),_0xf67687);logger[_0xfe3e('0x12')](_0xfe3e('0x36'),_0xf67687,JSON[_0xfe3e('0x13')](_0x7f723e));_0xf7adb(_0x7f723e);})['catch'](function(_0x10764c){logger[_0xfe3e('0x16')](_0xfe3e('0x36'),_0x10764c[_0xfe3e('0x15')],_0xf67687);_0x14bcad(_0x42d391['error'](0x1f4,_0x10764c[_0xfe3e('0x15')]));});});};exports[_0xfe3e('0x3e')]=function(_0x476b3f){var _0x163c24=this;return new Promise(function(_0x21cb1b,_0x47cc20){return db[_0xfe3e('0x23')][_0xfe3e('0x24')]()[_0xfe3e('0xf')](function(){return db[_0xfe3e('0x37')][_0xfe3e('0x25')](function(_0xdab787){return db[_0xfe3e('0x1a')][_0xfe3e('0x6')]({'where':_0x476b3f[_0xfe3e('0x7')]?_0x476b3f[_0xfe3e('0x7')]['where']||null:null,'attributes':_0x476b3f['options']?_0x476b3f[_0xfe3e('0x7')][_0xfe3e('0xa')]||null:null,'limit':0x1,'order':_0x476b3f[_0xfe3e('0x7')]?_0x476b3f['options']['order']||null:null,'group':db[_0xfe3e('0x1a')][_0xfe3e('0x2e')],'transaction':_0xdab787,'lock':_0xdab787[_0xfe3e('0x27')][_0xfe3e('0x28')],'include':_0x476b3f['options']?_0x476b3f[_0xfe3e('0x7')][_0xfe3e('0xc')]?_['map'](_0x476b3f[_0xfe3e('0x7')][_0xfe3e('0xc')],function(_0x2ea33a){return{'model':db[_0x2ea33a[_0xfe3e('0xe')]],'as':_0x2ea33a['as'],'attributes':_0x2ea33a['attributes'],'include':_0x2ea33a[_0xfe3e('0xc')]?_['map'](_0x2ea33a['include'],function(_0x505f05){return{'model':db[_0x505f05[_0xfe3e('0xe')]],'as':_0x505f05['as'],'attributes':_0x505f05['attributes'],'include':_0x505f05[_0xfe3e('0xc')]?_[_0xfe3e('0xd')](_0x505f05[_0xfe3e('0xc')],function(_0x38e145){return{'model':db[_0x38e145[_0xfe3e('0xe')]],'as':_0x38e145['as'],'attributes':_0x38e145[_0xfe3e('0xa')]};}):[]};}):[]};}):[]:[]})[_0xfe3e('0xf')](function(_0x50e4ae){var _0x2014a7=[];for(var _0x2e105e=0x0;_0x2e105e<_0x50e4ae[_0xfe3e('0x2d')];_0x2e105e+=0x1){_0x2014a7['push'](_0x50e4ae[_0x2e105e][_0xfe3e('0x1d')](_0x476b3f['body'],{'transaction':_0xdab787}));}return BPromise['all'](_0x2014a7);});})[_0xfe3e('0xf')](function(_0x4c4b9e){logger['info'](_0xfe3e('0x3e'),_0x476b3f);logger[_0xfe3e('0x12')](_0xfe3e('0x3e'),_0x476b3f,JSON[_0xfe3e('0x13')](_0x4c4b9e));_0x21cb1b(_0x4c4b9e);})[_0xfe3e('0x14')](function(_0x2c8eeb){logger[_0xfe3e('0x16')](_0xfe3e('0x3e'),_0x2c8eeb[_0xfe3e('0x15')],_0x476b3f);_0x47cc20(_0x163c24[_0xfe3e('0x16')](0x1f4,_0x2c8eeb[_0xfe3e('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x42dc85){var _0x4e90e2=this;return new Promise(function(_0xf200,_0x131e2b){db[_0xfe3e('0x23')]['describe']()[_0xfe3e('0xf')](function(_0x5e44ef){return db[_0xfe3e('0x1a')]['findAll']({'raw':_0x42dc85[_0xfe3e('0x7')]?_0x42dc85[_0xfe3e('0x7')][_0xfe3e('0x8')]===undefined?!![]:![]:!![],'where':_0x42dc85[_0xfe3e('0x7')]?_0x42dc85[_0xfe3e('0x7')]['where']||null:null,'attributes':_0x42dc85[_0xfe3e('0x7')]?_0x42dc85[_0xfe3e('0x7')][_0xfe3e('0xa')]||null:null,'limit':_0x42dc85[_0xfe3e('0x7')]?_0x42dc85[_0xfe3e('0x7')][_0xfe3e('0xb')]||null:null,'include':_0x42dc85[_0xfe3e('0x7')]?_0x42dc85[_0xfe3e('0x7')][_0xfe3e('0xc')]?_[_0xfe3e('0xd')](_0x42dc85['options']['include'],function(_0x44696d){return{'model':db[_0x44696d[_0xfe3e('0xe')]],'as':_0x44696d['as'],'attributes':_0x44696d['as']===_0xfe3e('0x3f')?_[_0xfe3e('0x29')](_0x5e44ef):_0x44696d['attributes'],'include':_0x44696d[_0xfe3e('0xc')]?_[_0xfe3e('0xd')](_0x44696d[_0xfe3e('0xc')],function(_0x4e9650){return{'model':db[_0x4e9650[_0xfe3e('0xe')]],'as':_0x4e9650['as'],'attributes':_0x4e9650[_0xfe3e('0xa')],'include':_0x4e9650['include']?_[_0xfe3e('0xd')](_0x4e9650[_0xfe3e('0xc')],function(_0x574c94){return{'model':db[_0x574c94['model']],'as':_0x574c94['as'],'attributes':_0x574c94[_0xfe3e('0xa')]};}):[]};}):[]};}):[]:[]})[_0xfe3e('0xf')](function(_0x551e4c){logger[_0xfe3e('0x10')]('GetCmHopper',_0x42dc85);logger[_0xfe3e('0x12')]('GetCmHopper',_0x42dc85,JSON[_0xfe3e('0x13')](_0x551e4c));_0xf200(_0x551e4c);})[_0xfe3e('0x14')](function(_0xb08741){logger[_0xfe3e('0x16')]('GetCmHopper',_0xb08741['message'],_0x42dc85);_0x131e2b(_0x4e90e2['error'](0x1f4,_0xb08741['message']));});});});};exports['GetContactByPhone']=function(_0x7dafe1){var _0x1874eb=this;return new Promise(function(_0x1642ef,_0x358313){return db[_0xfe3e('0x23')]['findOne']({'raw':!![],'where':{'phone':_0x7dafe1['options']['where'][_0xfe3e('0x40')]},'attributes':['id',_0xfe3e('0x41')],'order':[['id','DESC']]})[_0xfe3e('0xf')](function(_0x5242b8){logger[_0xfe3e('0x10')](_0xfe3e('0x42'),_0x7dafe1);logger[_0xfe3e('0x12')](_0xfe3e('0x42'),_0x7dafe1,JSON['stringify'](_0x5242b8));_0x1642ef(_0x5242b8);})[_0xfe3e('0x14')](function(_0x4c6635){logger['error'](_0xfe3e('0x42'),_0x4c6635[_0xfe3e('0x15')],_0x7dafe1);_0x358313(_0x1874eb[_0xfe3e('0x16')](0x1f4,_0x4c6635[_0xfe3e('0x15')]));});});};exports[_0xfe3e('0x43')]=function(_0x2e82b4){var _0x101ae4=this;return new Promise(function(_0x3177a5,_0x11deed){return db['sequelize']['transaction'](function(_0xd65e0c){var _0x29f720=_0x2e82b4[_0xfe3e('0x7')]&&_0x2e82b4[_0xfe3e('0x7')][_0xfe3e('0x9')]?_0x2e82b4[_0xfe3e('0x7')]['where']:{};return db['CmHopper']['update'](_0x2e82b4['body'],{'where':_0x29f720,'transaction':_0xd65e0c})[_0xfe3e('0xf')](function(_0x24ab67){logger[_0xfe3e('0x10')](_0xfe3e('0x43'),_0x2e82b4);logger['debug'](_0xfe3e('0x43'),_0x2e82b4,JSON['stringify'](_0x24ab67));_0x3177a5(_0x24ab67);})[_0xfe3e('0x14')](function(_0x2950c5){logger['error']('ResetActiveCalls',_0x2950c5['message'],_0x2e82b4);_0x11deed(_0x101ae4[_0xfe3e('0x16')](0x1f4,_0x2950c5[_0xfe3e('0x15')]));});});});};exports[_0xfe3e('0x44')]=function(_0x274a2c){var _0x1b5f27=this;var _0x1315ff=_0x274a2c[_0xfe3e('0x1e')][_0xfe3e('0x9')][_0xfe3e('0x45')];var _0x344f24=_0x274a2c[_0xfe3e('0x1e')][_0xfe3e('0x9')][_0xfe3e('0x46')];var _0x48b9fd=_0x274a2c['body'][_0xfe3e('0x9')]['availableAgentsIds'];return new Promise(function(_0x2b2b25,_0x52b5dc){return db[_0xfe3e('0x1a')][_0xfe3e('0x6')]({'where':{'voiceQueueId':{'$in':_0x1315ff},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xfe3e('0x37')][_0xfe3e('0x47')](_0xfe3e('0x48')+_0x344f24+_0xfe3e('0x49')),'$gt':db[_0xfe3e('0x37')][_0xfe3e('0x47')]('NOW()')}},'UserId':{'$in':_0x48b9fd}},'include':[{'model':db[_0xfe3e('0x23')],'as':_0xfe3e('0x3f')},{'model':db[_0xfe3e('0x2a')],'as':'Agent','attributes':['id',_0xfe3e('0x2c'),'voicePause']},{'model':db[_0xfe3e('0x4a')],'as':_0xfe3e('0x4b')}]})['then'](function(_0x46d409){if(_0x46d409[_0xfe3e('0x2d')]>0x0){return db[_0xfe3e('0x37')][_0xfe3e('0x25')](function(_0x252854){return db['CmHopper'][_0xfe3e('0x1d')]({'recallmeNotifiedDate':db['sequelize'][_0xfe3e('0x47')](_0xfe3e('0x4c'))},{'where':{'id':{'$in':_[_0xfe3e('0xd')](_0x46d409,'id')}},'transaction':_0x252854})[_0xfe3e('0xf')](function(){_0x2b2b25(_0x46d409);})[_0xfe3e('0x14')](function(_0x28e8db){logger[_0xfe3e('0x16')](_0xfe3e('0x44'),_0x28e8db[_0xfe3e('0x15')],_0x274a2c);_0x52b5dc(_0x1b5f27['error'](0x1f4,_0x28e8db[_0xfe3e('0x15')]));});})[_0xfe3e('0x14')](function(_0x34cb71){logger[_0xfe3e('0x16')](_0xfe3e('0x44'),_0x34cb71['message'],_0x274a2c);_0x52b5dc(_0x1b5f27[_0xfe3e('0x16')](0x1f4,_0x34cb71[_0xfe3e('0x15')]));});}else{_0x2b2b25(_0x46d409);}});});}; \ No newline at end of file +var _0x518b=['describe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','voicePause','CmList','NOW()','lodash','util','moment','bluebird','../../mysqldb','CmHopper','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','GetCmHopper','catch','message','error','ShowCmHopper','where','CreateCmHopper','body','stringify','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','LOCK','UPDATE','Contact','keys','Agent','name','length','UserId','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','transaction','CmHopperFinal','create','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','contactsRescheduled','CountReScheduled','GetContactRecallMe'];(function(_0x46fdbb,_0x217295){var _0x219d7e=function(_0x1350b8){while(--_0x1350b8){_0x46fdbb['push'](_0x46fdbb['shift']());}};_0x219d7e(++_0x217295);}(_0x518b,0x15b));var _0xb518=function(_0x46947d,_0x1b09c9){_0x46947d=_0x46947d-0x0;var _0x14dbc8=_0x518b[_0x46947d];return _0x14dbc8;};'use strict';var _=require(_0xb518('0x0'));var util=require(_0xb518('0x1'));var moment=require(_0xb518('0x2'));var BPromise=require(_0xb518('0x3'));var db=require(_0xb518('0x4'))['db'];var logger=require('../../config/logger')('rpc');exports['GetCmHopper']=function(_0x72291a){var _0x31255d=this;return new Promise(function(_0x516522,_0x4863c7){return db[_0xb518('0x5')][_0xb518('0x6')]({'raw':_0x72291a[_0xb518('0x7')]?_0x72291a[_0xb518('0x7')][_0xb518('0x8')]===undefined?!![]:![]:!![],'where':_0x72291a['options']?_0x72291a[_0xb518('0x7')]['where']||null:null,'attributes':_0x72291a[_0xb518('0x7')]?_0x72291a['options'][_0xb518('0x9')]||null:null,'limit':_0x72291a['options']?_0x72291a[_0xb518('0x7')][_0xb518('0xa')]||null:null,'include':_0x72291a[_0xb518('0x7')]?_0x72291a[_0xb518('0x7')][_0xb518('0xb')]?_[_0xb518('0xc')](_0x72291a[_0xb518('0x7')][_0xb518('0xb')],function(_0x6257c5){return{'model':db[_0x6257c5[_0xb518('0xd')]],'as':_0x6257c5['as'],'attributes':_0x6257c5[_0xb518('0x9')],'include':_0x6257c5[_0xb518('0xb')]?_[_0xb518('0xc')](_0x6257c5['include'],function(_0x931897){return{'model':db[_0x931897[_0xb518('0xd')]],'as':_0x931897['as'],'attributes':_0x931897[_0xb518('0x9')],'include':_0x931897[_0xb518('0xb')]?_['map'](_0x931897['include'],function(_0xfa2101){return{'model':db[_0xfa2101[_0xb518('0xd')]],'as':_0xfa2101['as'],'attributes':_0xfa2101['attributes']};}):[]};}):[]};}):[]:[]})[_0xb518('0xe')](function(_0x5ef06b){logger[_0xb518('0xf')]('GetCmHopper',_0x72291a);logger[_0xb518('0x10')](_0xb518('0x11'),_0x72291a,JSON['stringify'](_0x5ef06b));_0x516522(_0x5ef06b);})[_0xb518('0x12')](function(_0x1e88b0){logger['error'](_0xb518('0x11'),_0x1e88b0[_0xb518('0x13')],_0x72291a);_0x4863c7(_0x31255d[_0xb518('0x14')](0x1f4,_0x1e88b0[_0xb518('0x13')]));});});};exports[_0xb518('0x15')]=function(_0x5aa176){var _0x15ac75=this;return new Promise(function(_0x3e15e8,_0xc73da9){return db['CmHopper']['find']({'raw':_0x5aa176[_0xb518('0x7')]?_0x5aa176[_0xb518('0x7')][_0xb518('0x8')]===undefined?!![]:![]:!![],'where':_0x5aa176[_0xb518('0x7')]?_0x5aa176[_0xb518('0x7')][_0xb518('0x16')]||null:null,'attributes':_0x5aa176['options']?_0x5aa176[_0xb518('0x7')][_0xb518('0x9')]||null:null,'include':_0x5aa176[_0xb518('0x7')]?_0x5aa176['options'][_0xb518('0xb')]?_[_0xb518('0xc')](_0x5aa176['options'][_0xb518('0xb')],function(_0x239b6f){return{'model':db[_0x239b6f[_0xb518('0xd')]],'as':_0x239b6f['as'],'attributes':_0x239b6f[_0xb518('0x9')],'include':_0x239b6f[_0xb518('0xb')]?_[_0xb518('0xc')](_0x239b6f[_0xb518('0xb')],function(_0x503442){return{'model':db[_0x503442['model']],'as':_0x503442['as'],'attributes':_0x503442[_0xb518('0x9')],'include':_0x503442[_0xb518('0xb')]?_['map'](_0x503442[_0xb518('0xb')],function(_0x162670){return{'model':db[_0x162670['model']],'as':_0x162670['as'],'attributes':_0x162670['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x382585){logger['info'](_0xb518('0x15'),_0x5aa176);logger[_0xb518('0x10')](_0xb518('0x15'),_0x5aa176,JSON['stringify'](_0x382585));_0x3e15e8(_0x382585);})[_0xb518('0x12')](function(_0x40c1f0){logger['error'](_0xb518('0x15'),_0x40c1f0[_0xb518('0x13')],_0x5aa176);_0xc73da9(_0x15ac75[_0xb518('0x14')](0x1f4,_0x40c1f0[_0xb518('0x13')]));});});};exports[_0xb518('0x17')]=function(_0x5e8606){var _0x5768e4=this;return new Promise(function(_0x19ac3c,_0x526c8c){return db[_0xb518('0x5')]['create'](_0x5e8606[_0xb518('0x18')],{'raw':_0x5e8606[_0xb518('0x7')]?_0x5e8606[_0xb518('0x7')][_0xb518('0x8')]===undefined?!![]:![]:!![]})[_0xb518('0xe')](function(_0x314529){logger[_0xb518('0xf')]('CreateCmHopper',_0x5e8606);logger[_0xb518('0x10')](_0xb518('0x17'),_0x5e8606,JSON[_0xb518('0x19')](_0x314529));_0x19ac3c(_0x314529);})['catch'](function(_0x5b56f7){logger[_0xb518('0x14')](_0xb518('0x17'),_0x5b56f7['message'],_0x5e8606);_0x526c8c(_0x5768e4[_0xb518('0x14')](0x1f4,_0x5b56f7['message']));});});};exports[_0xb518('0x1a')]=function(_0x15c464){var _0x577238=this;return new Promise(function(_0x150abc,_0x33a678){return db[_0xb518('0x5')][_0xb518('0x1b')](_0x15c464[_0xb518('0x18')],{'raw':_0x15c464[_0xb518('0x7')]?_0x15c464[_0xb518('0x7')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15c464[_0xb518('0x7')]?_0x15c464['options']['where']||null:null,'attributes':_0x15c464[_0xb518('0x7')]?_0x15c464['options'][_0xb518('0x9')]||null:null,'limit':_0x15c464[_0xb518('0x7')]?_0x15c464[_0xb518('0x7')][_0xb518('0xa')]||null:null})[_0xb518('0xe')](function(_0x1f89d1){logger[_0xb518('0xf')](_0xb518('0x1a'),_0x15c464);logger['info'](_0xb518('0x1c'),JSON[_0xb518('0x19')](_0x15c464[_0xb518('0x7')][_0xb518('0x16')]),_0x15c464[_0xb518('0x18')]['active']);logger['debug'](_0xb518('0x1a'),_0x15c464,JSON[_0xb518('0x19')](_0x1f89d1));_0x150abc(_0x1f89d1);})[_0xb518('0x12')](function(_0x37162d){logger[_0xb518('0x14')](_0xb518('0x1a'),_0x37162d[_0xb518('0x13')],_0x15c464);_0x33a678(_0x577238['error'](0x1f4,_0x37162d[_0xb518('0x13')]));});});};exports[_0xb518('0x1d')]=function(_0x41a251){var _0x401e0b=this;return new Promise(function(_0x7e9834,_0x3ae017){return db[_0xb518('0x5')][_0xb518('0x1e')]({'where':_0x41a251['options']?_0x41a251[_0xb518('0x7')][_0xb518('0x16')]||null:null})[_0xb518('0xe')](function(_0x170e76){logger[_0xb518('0xf')](_0xb518('0x1d'),_0x41a251);logger[_0xb518('0x10')](_0xb518('0x1d'),_0x41a251,JSON[_0xb518('0x19')](_0x170e76));_0x7e9834(_0x170e76);})[_0xb518('0x12')](function(_0x1ceb8e){logger['error'](_0xb518('0x1d'),_0x1ceb8e[_0xb518('0x13')],_0x41a251);_0x3ae017(_0x401e0b[_0xb518('0x14')](0x1f4,_0x1ceb8e['message']));});});};exports[_0xb518('0x1f')]=function(_0x5aaf12){var _0x30968f=this;return new Promise(function(_0x202983,_0x4cde73){return db[_0xb518('0x20')]['describe']()[_0xb518('0xe')](function(_0x1fbcb2){return db[_0xb518('0x21')]['transaction'](function(_0x589817){return db['CmHopper'][_0xb518('0x6')]({'where':_0x5aaf12[_0xb518('0x7')]?_0x5aaf12[_0xb518('0x7')][_0xb518('0x16')]||null:null,'attributes':_0x5aaf12[_0xb518('0x7')]?_0x5aaf12['options'][_0xb518('0x9')]||null:null,'limit':_0x5aaf12['options']?_0x5aaf12[_0xb518('0x7')][_0xb518('0xa')]||null:null,'order':_0x5aaf12[_0xb518('0x7')]?_0x5aaf12[_0xb518('0x7')]['order']||null:null,'transaction':_0x589817,'lock':_0x589817[_0xb518('0x22')][_0xb518('0x23')],'include':[{'model':db['CmContact'],'as':_0xb518('0x24'),'attributes':_[_0xb518('0x25')](_0x1fbcb2)},{'model':db['User'],'as':_0xb518('0x26'),'attributes':['id',_0xb518('0x27'),'voicePause']}]})[_0xb518('0xe')](function(_0x4d4f05){var _0x2a8669=[];var _0x2f21e0=[];for(var _0x55018e=0x0;_0x55018e<_0x4d4f05[_0xb518('0x28')];_0x55018e+=0x1){var _0x172c1d=_0x4d4f05[_0x55018e][_0xb518('0x29')];if(_0x172c1d===null){_0x2a8669['push'](_0x4d4f05[_0x55018e][_0xb518('0x1b')](_0x5aaf12[_0xb518('0x18')],{'transaction':_0x589817}));}else if(!_0x2f21e0[_0xb518('0x2a')](_0x172c1d)){_0x2f21e0[_0xb518('0x2b')](_0x172c1d);_0x2a8669['push'](_0x4d4f05[_0x55018e][_0xb518('0x1b')](_0x5aaf12['body'],{'transaction':_0x589817}));}}return BPromise[_0xb518('0x2c')](_0x2a8669);});})['then'](function(_0x331851){logger['info']('GetContactDialer',_0x5aaf12);if(_0x331851['length']>0x0){logger[_0xb518('0xf')](_0xb518('0x2d'),_0x331851[0x0][_0xb518('0x2e')]['id'],_0x331851[0x0]['dataValues'][_0xb518('0x2f')],_0x331851[0x0]['dataValues'][_0xb518('0x30')]);}logger['debug']('GetContactDialer',_0x5aaf12,JSON[_0xb518('0x19')](_0x331851));_0x202983(_0x331851);})[_0xb518('0x12')](function(_0x3f85ad){logger['error'](_0xb518('0x1f'),_0x3f85ad[_0xb518('0x13')],_0x5aaf12);_0x4cde73(_0x30968f[_0xb518('0x14')](0x1f4,_0x3f85ad['message']));});});});};exports['MoveContactManagedDialer']=function(_0x36f59c){var _0x1b2323=this;return new Promise(function(_0x470f01,_0x6f7a34){return db[_0xb518('0x21')][_0xb518('0x31')](function(_0x57a478){return db[_0xb518('0x32')][_0xb518('0x33')](_0x36f59c[_0xb518('0x18')],{'raw':_0x36f59c[_0xb518('0x7')]?_0x36f59c['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x57a478})[_0xb518('0xe')](function(){logger['info'](_0xb518('0x34'),JSON[_0xb518('0x19')](_0x36f59c[_0xb518('0x7')][_0xb518('0x16')]),_0x36f59c[_0xb518('0x7')]['where'][_0xb518('0x30')]);return db['CmHopper'][_0xb518('0x1e')]({'where':_0x36f59c[_0xb518('0x7')]?_0x36f59c['options']['where']||null:null,'transaction':_0x57a478});});})[_0xb518('0xe')](function(_0x1df987){logger[_0xb518('0xf')](_0xb518('0x35'),_0x36f59c);logger[_0xb518('0x10')]('MoveContactManagedDialer',_0x36f59c,JSON[_0xb518('0x19')](_0x1df987));_0x470f01(_0x1df987);})[_0xb518('0x12')](function(_0x3525d9){logger[_0xb518('0x14')]('MoveContactManagedDialer',_0x3525d9['message'],_0x36f59c);_0x6f7a34(_0x1b2323['error'](0x1f4,_0x3525d9[_0xb518('0x13')]));});});};exports['CountReScheduled']=function(_0x1dbdd2){var _0xc3a65e=this;return new Promise(function(_0x12f380,_0x1082c9){return db[_0xb518('0x5')][_0xb518('0x6')]({'raw':_0x1dbdd2['options']?_0x1dbdd2[_0xb518('0x7')][_0xb518('0x8')]===undefined?!![]:![]:!![],'where':_0x1dbdd2[_0xb518('0x7')]?_0x1dbdd2[_0xb518('0x7')]['where']||null:null,'attributes':[[db[_0xb518('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb518('0x21')][_0xb518('0x36')](_0xb518('0x37')+util[_0xb518('0x38')](_0xb518('0x39'),moment()[_0xb518('0x38')](_0xb518('0x3a')))+_0xb518('0x3b')))),_0xb518('0x3c')]]})[_0xb518('0xe')](function(_0x3513f3){logger[_0xb518('0xf')]('CountReScheduled',_0x1dbdd2);logger[_0xb518('0x10')](_0xb518('0x3d'),_0x1dbdd2,JSON['stringify'](_0x3513f3));_0x12f380(_0x3513f3);})['catch'](function(_0x85a951){logger[_0xb518('0x14')](_0xb518('0x3d'),_0x85a951[_0xb518('0x13')],_0x1dbdd2);_0x1082c9(_0xc3a65e['error'](0x1f4,_0x85a951[_0xb518('0x13')]));});});};exports[_0xb518('0x3e')]=function(_0x3f472d){var _0x1d2cb4=this;return new Promise(function(_0x30ce14,_0x5461dd){return db[_0xb518('0x20')][_0xb518('0x3f')]()[_0xb518('0xe')](function(){return db[_0xb518('0x21')]['transaction'](function(_0x378c5e){return db[_0xb518('0x5')]['findAll']({'where':_0x3f472d[_0xb518('0x7')]?_0x3f472d[_0xb518('0x7')][_0xb518('0x16')]||null:null,'attributes':_0x3f472d[_0xb518('0x7')]?_0x3f472d[_0xb518('0x7')][_0xb518('0x9')]||null:null,'limit':0x1,'order':_0x3f472d[_0xb518('0x7')]?_0x3f472d[_0xb518('0x7')]['order']||null:null,'group':db[_0xb518('0x5')][_0xb518('0x29')],'transaction':_0x378c5e,'lock':_0x378c5e[_0xb518('0x22')][_0xb518('0x23')],'include':_0x3f472d[_0xb518('0x7')]?_0x3f472d[_0xb518('0x7')]['include']?_[_0xb518('0xc')](_0x3f472d[_0xb518('0x7')]['include'],function(_0x987ff3){return{'model':db[_0x987ff3[_0xb518('0xd')]],'as':_0x987ff3['as'],'attributes':_0x987ff3['attributes'],'include':_0x987ff3['include']?_['map'](_0x987ff3[_0xb518('0xb')],function(_0x322006){return{'model':db[_0x322006[_0xb518('0xd')]],'as':_0x322006['as'],'attributes':_0x322006[_0xb518('0x9')],'include':_0x322006[_0xb518('0xb')]?_[_0xb518('0xc')](_0x322006[_0xb518('0xb')],function(_0x49d601){return{'model':db[_0x49d601['model']],'as':_0x49d601['as'],'attributes':_0x49d601[_0xb518('0x9')]};}):[]};}):[]};}):[]:[]})[_0xb518('0xe')](function(_0x4ddd06){var _0x4e6609=[];for(var _0x4a0d09=0x0;_0x4a0d09<_0x4ddd06['length'];_0x4a0d09+=0x1){_0x4e6609[_0xb518('0x2b')](_0x4ddd06[_0x4a0d09][_0xb518('0x1b')](_0x3f472d[_0xb518('0x18')],{'transaction':_0x378c5e}));}return BPromise[_0xb518('0x2c')](_0x4e6609);});})[_0xb518('0xe')](function(_0x3a1d12){logger[_0xb518('0xf')](_0xb518('0x3e'),_0x3f472d);logger[_0xb518('0x10')]('GetContactRecallMe',_0x3f472d,JSON[_0xb518('0x19')](_0x3a1d12));_0x30ce14(_0x3a1d12);})[_0xb518('0x12')](function(_0x1e2805){logger[_0xb518('0x14')](_0xb518('0x3e'),_0x1e2805[_0xb518('0x13')],_0x3f472d);_0x5461dd(_0x1d2cb4[_0xb518('0x14')](0x1f4,_0x1e2805[_0xb518('0x13')]));});});});};exports[_0xb518('0x40')]=function(_0x428607){var _0x104fa8=this;return new Promise(function(_0x405b53,_0x5c52c0){db[_0xb518('0x20')]['describe']()['then'](function(_0x51f642){return db[_0xb518('0x5')]['findAll']({'raw':_0x428607['options']?_0x428607['options'][_0xb518('0x8')]===undefined?!![]:![]:!![],'where':_0x428607['options']?_0x428607[_0xb518('0x7')]['where']||null:null,'attributes':_0x428607['options']?_0x428607[_0xb518('0x7')]['attributes']||null:null,'limit':_0x428607['options']?_0x428607[_0xb518('0x7')][_0xb518('0xa')]||null:null,'include':_0x428607[_0xb518('0x7')]?_0x428607[_0xb518('0x7')][_0xb518('0xb')]?_['map'](_0x428607[_0xb518('0x7')][_0xb518('0xb')],function(_0x32c47b){return{'model':db[_0x32c47b[_0xb518('0xd')]],'as':_0x32c47b['as'],'attributes':_0x32c47b['as']===_0xb518('0x24')?_['keys'](_0x51f642):_0x32c47b[_0xb518('0x9')],'include':_0x32c47b[_0xb518('0xb')]?_[_0xb518('0xc')](_0x32c47b[_0xb518('0xb')],function(_0xec698e){return{'model':db[_0xec698e[_0xb518('0xd')]],'as':_0xec698e['as'],'attributes':_0xec698e[_0xb518('0x9')],'include':_0xec698e[_0xb518('0xb')]?_[_0xb518('0xc')](_0xec698e[_0xb518('0xb')],function(_0x1b750b){return{'model':db[_0x1b750b[_0xb518('0xd')]],'as':_0x1b750b['as'],'attributes':_0x1b750b[_0xb518('0x9')]};}):[]};}):[]};}):[]:[]})[_0xb518('0xe')](function(_0x39baca){logger[_0xb518('0xf')]('GetCmHopper',_0x428607);logger['debug']('GetCmHopper',_0x428607,JSON[_0xb518('0x19')](_0x39baca));_0x405b53(_0x39baca);})['catch'](function(_0xfef726){logger[_0xb518('0x14')]('GetCmHopper',_0xfef726['message'],_0x428607);_0x5c52c0(_0x104fa8[_0xb518('0x14')](0x1f4,_0xfef726[_0xb518('0x13')]));});});});};exports[_0xb518('0x41')]=function(_0x4d91ef){var _0x17a15f=this;return new Promise(function(_0x230926,_0x3fb4c9){return db[_0xb518('0x20')][_0xb518('0x42')]({'raw':!![],'where':{'phone':_0x4d91ef[_0xb518('0x7')][_0xb518('0x16')][_0xb518('0x43')]},'attributes':['id',_0xb518('0x44')],'order':[['id',_0xb518('0x45')]]})[_0xb518('0xe')](function(_0x24100f){logger['info'](_0xb518('0x46'),_0x4d91ef);logger[_0xb518('0x10')]('getContactByPhone',_0x4d91ef,JSON[_0xb518('0x19')](_0x24100f));_0x230926(_0x24100f);})['catch'](function(_0x3f94c5){logger[_0xb518('0x14')](_0xb518('0x46'),_0x3f94c5[_0xb518('0x13')],_0x4d91ef);_0x3fb4c9(_0x17a15f[_0xb518('0x14')](0x1f4,_0x3f94c5['message']));});});};exports[_0xb518('0x47')]=function(_0x181957){var _0x5ea6ac=this;return new Promise(function(_0x23befc,_0x2399fe){return db[_0xb518('0x21')][_0xb518('0x31')](function(_0x207d11){var _0xeb9cde=_0x181957[_0xb518('0x7')]&&_0x181957['options']['where']?_0x181957['options'][_0xb518('0x16')]:{};return db[_0xb518('0x5')][_0xb518('0x1b')](_0x181957[_0xb518('0x18')],{'where':_0xeb9cde,'transaction':_0x207d11})[_0xb518('0xe')](function(_0x5c08e0){logger['info'](_0xb518('0x47'),_0x181957);logger[_0xb518('0x10')](_0xb518('0x47'),_0x181957,JSON[_0xb518('0x19')](_0x5c08e0));_0x23befc(_0x5c08e0);})[_0xb518('0x12')](function(_0x283da3){logger[_0xb518('0x14')](_0xb518('0x47'),_0x283da3['message'],_0x181957);_0x2399fe(_0x5ea6ac[_0xb518('0x14')](0x1f4,_0x283da3[_0xb518('0x13')]));});});});};exports[_0xb518('0x48')]=function(_0x5af9d9){var _0xca0e08=this;var _0xcd7016=_0x5af9d9[_0xb518('0x18')][_0xb518('0x16')][_0xb518('0x49')];var _0x1d5485=_0x5af9d9[_0xb518('0x18')][_0xb518('0x16')][_0xb518('0x4a')];var _0x563356=_0x5af9d9[_0xb518('0x18')][_0xb518('0x16')][_0xb518('0x4b')];return new Promise(function(_0x591e85,_0x27d984){return db[_0xb518('0x5')][_0xb518('0x6')]({'where':{'voiceQueueId':{'$in':_0xcd7016},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xb518('0x21')][_0xb518('0x36')](_0xb518('0x4c')+_0x1d5485+_0xb518('0x4d')),'$gt':db['sequelize']['literal']('NOW()')}},'UserId':{'$in':_0x563356}},'include':[{'model':db['CmContact'],'as':_0xb518('0x24')},{'model':db[_0xb518('0x4e')],'as':_0xb518('0x26'),'attributes':['id',_0xb518('0x27'),_0xb518('0x4f')]},{'model':db[_0xb518('0x50')],'as':'List'}]})[_0xb518('0xe')](function(_0x4618db){if(_0x4618db[_0xb518('0x28')]>0x0){return db[_0xb518('0x21')][_0xb518('0x31')](function(_0x56b274){return db[_0xb518('0x5')]['update']({'recallmeNotifiedDate':db[_0xb518('0x21')][_0xb518('0x36')](_0xb518('0x51'))},{'where':{'id':{'$in':_[_0xb518('0xc')](_0x4618db,'id')}},'transaction':_0x56b274})[_0xb518('0xe')](function(){_0x591e85(_0x4618db);})[_0xb518('0x12')](function(_0x21383c){logger['error'](_0xb518('0x48'),_0x21383c[_0xb518('0x13')],_0x5af9d9);_0x27d984(_0xca0e08[_0xb518('0x14')](0x1f4,_0x21383c[_0xb518('0x13')]));});})['catch'](function(_0x343b2e){logger[_0xb518('0x14')](_0xb518('0x48'),_0x343b2e[_0xb518('0x13')],_0x5af9d9);_0x27d984(_0xca0e08[_0xb518('0x14')](0x1f4,_0x343b2e[_0xb518('0x13')]));});}else{_0x591e85(_0x4618db);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 15d0e39..6e25926 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 _0xea2e=['/preview','getPreview','/timezone','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create'];(function(_0x960ce2,_0x1468a1){var _0x5973e2=function(_0x168ccc){while(--_0x168ccc){_0x960ce2['push'](_0x960ce2['shift']());}};_0x5973e2(++_0x1468a1);}(_0xea2e,0x1a5));var _0xeea2=function(_0x3baa10,_0x27a92e){_0x3baa10=_0x3baa10-0x0;var _0x20a8a7=_0xea2e[_0x3baa10];return _0x20a8a7;};'use strict';var express=require(_0xeea2('0x0'));var router=express[_0xeea2('0x1')]();var auth=require(_0xeea2('0x2'));var controller=require('./cmHopper.controller');router[_0xeea2('0x3')]('/',auth[_0xeea2('0x4')](),controller[_0xeea2('0x5')]);router['get'](_0xeea2('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0xeea2('0x3')](_0xeea2('0x7'),auth[_0xeea2('0x4')](),controller[_0xeea2('0x8')]);router['get']('/timezones',auth[_0xeea2('0x4')](),controller[_0xeea2('0x9')]);router[_0xeea2('0x3')](_0xeea2('0xa'),auth[_0xeea2('0x4')](),controller[_0xeea2('0xb')]);router[_0xeea2('0x3')](_0xeea2('0xc'),auth['isAuthenticated'](),controller[_0xeea2('0xd')]);router[_0xeea2('0xe')]('/',auth[_0xeea2('0x4')](),controller[_0xeea2('0xf')]);router[_0xeea2('0xe')](_0xeea2('0x10'),auth[_0xeea2('0x4')](),controller[_0xeea2('0x11')]);router[_0xeea2('0xe')](_0xeea2('0x12'),auth[_0xeea2('0x4')](),controller['getTimezone']);router['put']('/:id',auth[_0xeea2('0x4')](),controller[_0xeea2('0x13')]);router[_0xeea2('0x14')](_0xeea2('0xa'),auth[_0xeea2('0x4')](),controller[_0xeea2('0x15')]);module[_0xeea2('0x16')]=router; \ No newline at end of file +var _0x4bef=['/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','delete','exports','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show'];(function(_0x2f81e1,_0x2c6d9b){var _0x4da558=function(_0x38b586){while(--_0x38b586){_0x2f81e1['push'](_0x2f81e1['shift']());}};_0x4da558(++_0x2c6d9b);}(_0x4bef,0x1ed));var _0xf4be=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x4bef[_0x386c3e];return _0x4b8e13;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xf4be('0x0'));var controller=require(_0xf4be('0x1'));router[_0xf4be('0x2')]('/',auth[_0xf4be('0x3')](),controller['index']);router[_0xf4be('0x2')](_0xf4be('0x4'),auth['isAuthenticated'](),controller['describe']);router[_0xf4be('0x2')](_0xf4be('0x5'),auth['isAuthenticated'](),controller[_0xf4be('0x6')]);router[_0xf4be('0x2')](_0xf4be('0x7'),auth[_0xf4be('0x3')](),controller[_0xf4be('0x8')]);router[_0xf4be('0x2')](_0xf4be('0x9'),auth['isAuthenticated'](),controller[_0xf4be('0xa')]);router[_0xf4be('0x2')](_0xf4be('0xb'),auth[_0xf4be('0x3')](),controller[_0xf4be('0xc')]);router[_0xf4be('0xd')]('/',auth[_0xf4be('0x3')](),controller['create']);router['post'](_0xf4be('0xe'),auth[_0xf4be('0x3')](),controller[_0xf4be('0xf')]);router[_0xf4be('0xd')](_0xf4be('0x10'),auth[_0xf4be('0x3')](),controller[_0xf4be('0x11')]);router[_0xf4be('0x12')]('/:id',auth[_0xf4be('0x3')](),controller['update']);router[_0xf4be('0x13')](_0xf4be('0x9'),auth[_0xf4be('0x3')](),controller['destroy']);module[_0xf4be('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index ddf4ecb..6c24ea8 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1a4=['YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x425eff,_0xd68854){var _0x5c3080=function(_0x3cb28d){while(--_0x3cb28d){_0x425eff['push'](_0x425eff['shift']());}};_0x5c3080(++_0xd68854);}(_0xe1a4,0x1c8));var _0x4e1a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xe1a4[_0x5d4607];return _0x5e4a86;};'use strict';var moment=require('moment');var Sequelize=require(_0x4e1a('0x0'));module[_0x4e1a('0x1')]={'CmHopperId':{'type':Sequelize[_0x4e1a('0x2')]},'phone':{'type':Sequelize[_0x4e1a('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4e1a('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4e1a('0x4')],'defaultValue':moment()[_0x4e1a('0x5')](_0x4e1a('0x6'))},'countbusyretry':{'type':Sequelize[_0x4e1a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4e1a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4e1a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4e1a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4e1a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6219=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x1e694f,_0x380ef6){var _0xba5174=function(_0x343344){while(--_0x343344){_0x1e694f['push'](_0x1e694f['shift']());}};_0xba5174(++_0x380ef6);}(_0x6219,0xf6));var _0x9621=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x6219[_0x591cfd];return _0x4d0100;};'use strict';var moment=require(_0x9621('0x0'));var Sequelize=require(_0x9621('0x1'));module[_0x9621('0x2')]={'CmHopperId':{'type':Sequelize[_0x9621('0x3')]},'phone':{'type':Sequelize[_0x9621('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9621('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9621('0x5')],'defaultValue':moment()[_0x9621('0x6')](_0x9621('0x7'))},'countbusyretry':{'type':Sequelize[_0x9621('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9621('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9621('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9621('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9621('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9621('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9621('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index e2a06e2..f81f570 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1b7=['key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','length','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type'];(function(_0x52dace,_0x530aa7){var _0x4e43b6=function(_0x40aa29){while(--_0x40aa29){_0x52dace['push'](_0x52dace['shift']());}};_0x4e43b6(++_0x530aa7);}(_0xa1b7,0xcc));var _0x7a1b=function(_0x323183,_0x43ca70){_0x323183=_0x323183-0x0;var _0x4f3b20=_0xa1b7[_0x323183];return _0x4f3b20;};'use strict';var emlformat=require(_0x7a1b('0x0'));var rimraf=require(_0x7a1b('0x1'));var zipdir=require(_0x7a1b('0x2'));var jsonpatch=require(_0x7a1b('0x3'));var rp=require(_0x7a1b('0x4'));var moment=require('moment');var BPromise=require(_0x7a1b('0x5'));var Mustache=require(_0x7a1b('0x6'));var util=require('util');var path=require(_0x7a1b('0x7'));var sox=require(_0x7a1b('0x8'));var csv=require(_0x7a1b('0x9'));var ejs=require(_0x7a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x7a1b('0xb'));var _=require(_0x7a1b('0xc'));var squel=require('squel');var crypto=require(_0x7a1b('0xd'));var jsforce=require(_0x7a1b('0xe'));var deskjs=require(_0x7a1b('0xf'));var toCsv=require(_0x7a1b('0x9'));var querystring=require('querystring');var Papa=require(_0x7a1b('0x10'));var Redis=require(_0x7a1b('0x11'));var authService=require(_0x7a1b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7a1b('0x13'));var hardwareService=require(_0x7a1b('0x14'));var logger=require(_0x7a1b('0x15'))(_0x7a1b('0x16'));var utils=require(_0x7a1b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7a1b('0x18'));var db=require(_0x7a1b('0x19'))['db'];function respondWithStatusCode(_0x15381c,_0x5be50b){_0x5be50b=_0x5be50b||0xcc;return function(_0x46bf71){if(_0x46bf71){return _0x15381c['sendStatus'](_0x5be50b);}return _0x15381c[_0x7a1b('0x1a')](_0x5be50b)[_0x7a1b('0x1b')]();};}function respondWithResult(_0x44df7d,_0x2c8658){_0x2c8658=_0x2c8658||0xc8;return function(_0x200424){if(_0x200424){return _0x44df7d[_0x7a1b('0x1a')](_0x2c8658)['json'](_0x200424);}};}function respondWithFilteredResult(_0x1c4702,_0x5ca427){return function(_0x123c2e){if(_0x123c2e){var _0x2442bf=typeof _0x5ca427['offset']===_0x7a1b('0x1c')&&typeof _0x5ca427['limit']==='undefined';var _0x25af44=_0x123c2e['count'];var _0x17fdfa=_0x2442bf?0x0:_0x5ca427['offset'];var _0x1604c7=_0x2442bf?_0x123c2e[_0x7a1b('0x1d')]:_0x5ca427[_0x7a1b('0x1e')]+_0x5ca427[_0x7a1b('0x1f')];var _0x20ecf9;if(_0x1604c7>=_0x25af44){_0x1604c7=_0x25af44;_0x20ecf9=0xc8;}else{_0x20ecf9=0xce;}_0x1c4702[_0x7a1b('0x1a')](_0x20ecf9);return _0x1c4702[_0x7a1b('0x20')](_0x7a1b('0x21'),_0x17fdfa+'-'+_0x1604c7+'/'+_0x25af44)[_0x7a1b('0x22')](_0x123c2e);}return null;};}function patchUpdates(_0x1684d0){return function(_0xb3635b){try{jsonpatch[_0x7a1b('0x23')](_0xb3635b,_0x1684d0,!![]);}catch(_0x2dce3b){return BPromise[_0x7a1b('0x24')](_0x2dce3b);}return _0xb3635b[_0x7a1b('0x25')]();};}function saveUpdates(_0x30cdbd,_0x2dc8fc){return function(_0x54c770){if(_0x54c770){return _0x54c770['update'](_0x30cdbd)[_0x7a1b('0x26')](function(_0x4553ff){return _0x4553ff;});}return null;};}function removeEntity(_0x5810dc,_0x543e11){return function(_0x5bf69e){if(_0x5bf69e){return _0x5bf69e[_0x7a1b('0x27')]()['then'](function(){var _0x19de30=_0x5bf69e[_0x7a1b('0x28')]({'plain':!![]});var _0x4d9b16='CmHopperAdditionalPhones';return db[_0x7a1b('0x29')][_0x7a1b('0x27')]({'where':{'type':_0x4d9b16,'resourceId':_0x19de30['id']}})[_0x7a1b('0x26')](function(){return _0x5bf69e;});})[_0x7a1b('0x26')](function(){_0x5810dc[_0x7a1b('0x1a')](0xcc)[_0x7a1b('0x1b')]();});}};}function handleEntityNotFound(_0x20ab49,_0x51ab2d){return function(_0x2a334c){if(!_0x2a334c){_0x20ab49[_0x7a1b('0x2a')](0x194);}return _0x2a334c;};}function handleError(_0x1a0b99,_0x4827e8){_0x4827e8=_0x4827e8||0x1f4;return function(_0x3b228a){logger[_0x7a1b('0x2b')](_0x3b228a[_0x7a1b('0x2c')]);if(_0x3b228a[_0x7a1b('0x2d')]){delete _0x3b228a[_0x7a1b('0x2d')];}_0x1a0b99[_0x7a1b('0x1a')](_0x4827e8)['send'](_0x3b228a);};}exports[_0x7a1b('0x2e')]=function(_0x28a939,_0x1a6b23){var _0x4235bc={},_0x4d28ba={},_0x37c0ea={'count':0x0,'rows':[]};var _0x3ba62e=_['map'](db[_0x7a1b('0x2f')][_0x7a1b('0x30')],function(_0x17328d){return{'name':_0x17328d[_0x7a1b('0x31')],'type':_0x17328d[_0x7a1b('0x32')][_0x7a1b('0x33')]};});_0x4d28ba[_0x7a1b('0x34')]=_[_0x7a1b('0x35')](_0x3ba62e,_0x7a1b('0x2d'));_0x4d28ba[_0x7a1b('0x36')]=_[_0x7a1b('0x37')](_0x28a939[_0x7a1b('0x36')]);_0x4d28ba[_0x7a1b('0x38')]=_[_0x7a1b('0x39')](_0x4d28ba[_0x7a1b('0x34')],_0x4d28ba[_0x7a1b('0x36')]);_0x4235bc[_0x7a1b('0x3a')]=_['intersection'](_0x4d28ba[_0x7a1b('0x34')],qs['fields'](_0x28a939[_0x7a1b('0x36')][_0x7a1b('0x3b')]));_0x4235bc[_0x7a1b('0x3a')]=_0x4235bc['attributes']['length']?_0x4235bc[_0x7a1b('0x3a')]:_0x4d28ba[_0x7a1b('0x34')];if(!_0x28a939[_0x7a1b('0x36')]['hasOwnProperty']('nolimit')){_0x4235bc[_0x7a1b('0x1f')]=qs[_0x7a1b('0x1f')](_0x28a939['query'][_0x7a1b('0x1f')]);_0x4235bc[_0x7a1b('0x1e')]=qs[_0x7a1b('0x1e')](_0x28a939['query'][_0x7a1b('0x1e')]);}_0x4235bc[_0x7a1b('0x3c')]=qs[_0x7a1b('0x3d')](_0x28a939['query']['sort']);_0x4235bc[_0x7a1b('0x3e')]=qs[_0x7a1b('0x38')](_[_0x7a1b('0x3f')](_0x28a939[_0x7a1b('0x36')],_0x4d28ba[_0x7a1b('0x38')]),_0x3ba62e);if(_0x28a939[_0x7a1b('0x36')][_0x7a1b('0x40')]){_0x4235bc[_0x7a1b('0x3e')]=_[_0x7a1b('0x41')](_0x4235bc[_0x7a1b('0x3e')],{'$or':_[_0x7a1b('0x35')](_0x3ba62e,function(_0x35b899){if(_0x35b899['type']!==_0x7a1b('0x42')){var _0x4c56ab={};_0x4c56ab[_0x35b899[_0x7a1b('0x2d')]]={'$like':'%'+_0x28a939['query']['filter']+'%'};return _0x4c56ab;}})});}_0x4235bc=_[_0x7a1b('0x41')]({},_0x4235bc,_0x28a939['options']);var _0x50972b={'where':_0x4235bc[_0x7a1b('0x3e')]};return db[_0x7a1b('0x2f')]['count'](_0x50972b)[_0x7a1b('0x26')](function(_0x440389){_0x37c0ea[_0x7a1b('0x1d')]=_0x440389;if(_0x28a939['query'][_0x7a1b('0x43')]){_0x4235bc['include']=[{'all':!![]}];}return db[_0x7a1b('0x2f')]['findAll'](_0x4235bc);})[_0x7a1b('0x26')](function(_0x4c7093){_0x37c0ea[_0x7a1b('0x44')]=_0x4c7093;return _0x37c0ea;})[_0x7a1b('0x26')](respondWithFilteredResult(_0x1a6b23,_0x4235bc))[_0x7a1b('0x45')](handleError(_0x1a6b23,null));};exports[_0x7a1b('0x46')]=function(_0x26f025,_0x51abf2){var _0x28491b={'raw':!![],'where':{'id':_0x26f025[_0x7a1b('0x47')]['id']}},_0x47cabc={};_0x47cabc[_0x7a1b('0x34')]=_['keys'](db['CmHopperAdditionalPhone'][_0x7a1b('0x30')]);_0x47cabc[_0x7a1b('0x36')]=_[_0x7a1b('0x37')](_0x26f025[_0x7a1b('0x36')]);_0x47cabc['filters']=_[_0x7a1b('0x39')](_0x47cabc['model'],_0x47cabc['query']);_0x28491b[_0x7a1b('0x3a')]=_[_0x7a1b('0x39')](_0x47cabc[_0x7a1b('0x34')],qs['fields'](_0x26f025['query'][_0x7a1b('0x3b')]));_0x28491b['attributes']=_0x28491b[_0x7a1b('0x3a')][_0x7a1b('0x48')]?_0x28491b[_0x7a1b('0x3a')]:_0x47cabc[_0x7a1b('0x34')];if(_0x26f025[_0x7a1b('0x36')][_0x7a1b('0x43')]){_0x28491b[_0x7a1b('0x49')]=[{'all':!![]}];}_0x28491b=_[_0x7a1b('0x41')]({},_0x28491b,_0x26f025[_0x7a1b('0x4a')]);return db['CmHopperAdditionalPhone'][_0x7a1b('0x4b')](_0x28491b)[_0x7a1b('0x26')](handleEntityNotFound(_0x51abf2,null))['then'](respondWithResult(_0x51abf2,null))[_0x7a1b('0x45')](handleError(_0x51abf2,null));};exports[_0x7a1b('0x4c')]=function(_0x462b04,_0xb6b6e6){return db['CmHopperAdditionalPhone'][_0x7a1b('0x4c')](_0x462b04[_0x7a1b('0x4d')],{})[_0x7a1b('0x26')](function(_0x257f4a){var _0x4c20d3=_0x462b04['user']['get']({'plain':!![]});if(!_0x4c20d3)throw new Error(_0x7a1b('0x4e'));if(_0x4c20d3[_0x7a1b('0x4f')]===_0x7a1b('0x50')){var _0x4df3ef=_0x257f4a[_0x7a1b('0x28')]({'plain':!![]});var _0x427268=_0x7a1b('0x51');return db[_0x7a1b('0x52')][_0x7a1b('0x4b')]({'where':{'name':_0x427268,'userProfileId':_0x4c20d3['userProfileId']},'raw':!![]})[_0x7a1b('0x26')](function(_0x146c45){if(_0x146c45&&_0x146c45['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4df3ef[_0x7a1b('0x2d')],'resourceId':_0x4df3ef['id'],'type':_0x146c45[_0x7a1b('0x2d')],'sectionId':_0x146c45['id']},{})[_0x7a1b('0x26')](function(){return _0x257f4a;});}else{return _0x257f4a;}})['catch'](function(_0x311a0e){logger[_0x7a1b('0x2b')](_0x7a1b('0x53'),_0x311a0e);throw _0x311a0e;});}return _0x257f4a;})[_0x7a1b('0x26')](respondWithResult(_0xb6b6e6,0xc9))['catch'](handleError(_0xb6b6e6,null));};exports[_0x7a1b('0x54')]=function(_0x37ecd2,_0x22a0fa){if(_0x37ecd2[_0x7a1b('0x4d')]['id']){delete _0x37ecd2[_0x7a1b('0x4d')]['id'];}return db[_0x7a1b('0x2f')][_0x7a1b('0x4b')]({'where':{'id':_0x37ecd2[_0x7a1b('0x47')]['id']}})[_0x7a1b('0x26')](handleEntityNotFound(_0x22a0fa,null))[_0x7a1b('0x26')](saveUpdates(_0x37ecd2[_0x7a1b('0x4d')],null))['then'](respondWithResult(_0x22a0fa,null))[_0x7a1b('0x45')](handleError(_0x22a0fa,null));};exports[_0x7a1b('0x27')]=function(_0x2da71a,_0x4be725){return db['CmHopperAdditionalPhone'][_0x7a1b('0x4b')]({'where':{'id':_0x2da71a[_0x7a1b('0x47')]['id']}})[_0x7a1b('0x26')](handleEntityNotFound(_0x4be725,null))[_0x7a1b('0x26')](removeEntity(_0x4be725,null))[_0x7a1b('0x45')](handleError(_0x4be725,null));}; \ No newline at end of file +var _0xa7a5=['CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x30a0b7,_0x3698d9){var _0x1d8e00=function(_0xd8696a){while(--_0xd8696a){_0x30a0b7['push'](_0x30a0b7['shift']());}};_0x1d8e00(++_0x3698d9);}(_0xa7a5,0xa7));var _0x5a7a=function(_0x35658f,_0x341ad5){_0x35658f=_0x35658f-0x0;var _0xfd59b3=_0xa7a5[_0x35658f];return _0xfd59b3;};'use strict';var emlformat=require(_0x5a7a('0x0'));var rimraf=require(_0x5a7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5a7a('0x2'));var moment=require(_0x5a7a('0x3'));var BPromise=require(_0x5a7a('0x4'));var Mustache=require(_0x5a7a('0x5'));var util=require(_0x5a7a('0x6'));var path=require(_0x5a7a('0x7'));var sox=require(_0x5a7a('0x8'));var csv=require(_0x5a7a('0x9'));var ejs=require(_0x5a7a('0xa'));var fs=require('fs');var fs_extra=require(_0x5a7a('0xb'));var _=require(_0x5a7a('0xc'));var squel=require(_0x5a7a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5a7a('0xe'));var toCsv=require(_0x5a7a('0x9'));var querystring=require('querystring');var Papa=require(_0x5a7a('0xf'));var Redis=require('ioredis');var authService=require(_0x5a7a('0x10'));var qs=require(_0x5a7a('0x11'));var as=require(_0x5a7a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a7a('0x13'))(_0x5a7a('0x14'));var utils=require(_0x5a7a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a302,_0xe84e5f){_0xe84e5f=_0xe84e5f||0xcc;return function(_0x58e865){if(_0x58e865){return _0x59a302[_0x5a7a('0x16')](_0xe84e5f);}return _0x59a302['status'](_0xe84e5f)[_0x5a7a('0x17')]();};}function respondWithResult(_0x327c36,_0x13c1b3){_0x13c1b3=_0x13c1b3||0xc8;return function(_0x5de1cd){if(_0x5de1cd){return _0x327c36[_0x5a7a('0x18')](_0x13c1b3)[_0x5a7a('0x19')](_0x5de1cd);}};}function respondWithFilteredResult(_0x4c65e8,_0x402380){return function(_0x37f738){if(_0x37f738){var _0x1661ee=typeof _0x402380['offset']===_0x5a7a('0x1a')&&typeof _0x402380['limit']===_0x5a7a('0x1a');var _0x21f96d=_0x37f738['count'];var _0x16c24a=_0x1661ee?0x0:_0x402380[_0x5a7a('0x1b')];var _0x3a0746=_0x1661ee?_0x37f738[_0x5a7a('0x1c')]:_0x402380[_0x5a7a('0x1b')]+_0x402380[_0x5a7a('0x1d')];var _0x2378d8;if(_0x3a0746>=_0x21f96d){_0x3a0746=_0x21f96d;_0x2378d8=0xc8;}else{_0x2378d8=0xce;}_0x4c65e8[_0x5a7a('0x18')](_0x2378d8);return _0x4c65e8[_0x5a7a('0x1e')](_0x5a7a('0x1f'),_0x16c24a+'-'+_0x3a0746+'/'+_0x21f96d)[_0x5a7a('0x19')](_0x37f738);}return null;};}function patchUpdates(_0x2c9193){return function(_0x24f9d9){try{jsonpatch['apply'](_0x24f9d9,_0x2c9193,!![]);}catch(_0x56ae0a){return BPromise[_0x5a7a('0x20')](_0x56ae0a);}return _0x24f9d9[_0x5a7a('0x21')]();};}function saveUpdates(_0x489ae3,_0x5cc067){return function(_0x203144){if(_0x203144){return _0x203144['update'](_0x489ae3)[_0x5a7a('0x22')](function(_0x4d50d3){return _0x4d50d3;});}return null;};}function removeEntity(_0x2db7b2,_0xfbcca8){return function(_0x142c2f){if(_0x142c2f){return _0x142c2f[_0x5a7a('0x23')]()['then'](function(){var _0x26c4b1=_0x142c2f[_0x5a7a('0x24')]({'plain':!![]});var _0x5affb5='CmHopperAdditionalPhones';return db[_0x5a7a('0x25')][_0x5a7a('0x23')]({'where':{'type':_0x5affb5,'resourceId':_0x26c4b1['id']}})[_0x5a7a('0x22')](function(){return _0x142c2f;});})['then'](function(){_0x2db7b2[_0x5a7a('0x18')](0xcc)[_0x5a7a('0x17')]();});}};}function handleEntityNotFound(_0x2b13c4,_0x3602b2){return function(_0x42e3fe){if(!_0x42e3fe){_0x2b13c4[_0x5a7a('0x16')](0x194);}return _0x42e3fe;};}function handleError(_0x590272,_0x496b0b){_0x496b0b=_0x496b0b||0x1f4;return function(_0x55cb88){logger['error'](_0x55cb88[_0x5a7a('0x26')]);if(_0x55cb88[_0x5a7a('0x27')]){delete _0x55cb88[_0x5a7a('0x27')];}_0x590272[_0x5a7a('0x18')](_0x496b0b)[_0x5a7a('0x28')](_0x55cb88);};}exports['index']=function(_0x10d57,_0x26ad64){var _0x8b0854={},_0x5d3305={},_0x5efffc={'count':0x0,'rows':[]};var _0x5d577f=_[_0x5a7a('0x29')](db[_0x5a7a('0x2a')][_0x5a7a('0x2b')],function(_0xb4462a){return{'name':_0xb4462a[_0x5a7a('0x2c')],'type':_0xb4462a['type']['key']};});_0x5d3305['model']=_[_0x5a7a('0x29')](_0x5d577f,_0x5a7a('0x27'));_0x5d3305[_0x5a7a('0x2d')]=_[_0x5a7a('0x2e')](_0x10d57['query']);_0x5d3305[_0x5a7a('0x2f')]=_[_0x5a7a('0x30')](_0x5d3305[_0x5a7a('0x31')],_0x5d3305[_0x5a7a('0x2d')]);_0x8b0854['attributes']=_[_0x5a7a('0x30')](_0x5d3305['model'],qs['fields'](_0x10d57['query'][_0x5a7a('0x32')]));_0x8b0854['attributes']=_0x8b0854[_0x5a7a('0x33')]['length']?_0x8b0854[_0x5a7a('0x33')]:_0x5d3305[_0x5a7a('0x31')];if(!_0x10d57[_0x5a7a('0x2d')]['hasOwnProperty']('nolimit')){_0x8b0854[_0x5a7a('0x1d')]=qs['limit'](_0x10d57['query'][_0x5a7a('0x1d')]);_0x8b0854[_0x5a7a('0x1b')]=qs[_0x5a7a('0x1b')](_0x10d57[_0x5a7a('0x2d')][_0x5a7a('0x1b')]);}_0x8b0854[_0x5a7a('0x34')]=qs[_0x5a7a('0x35')](_0x10d57['query'][_0x5a7a('0x35')]);_0x8b0854[_0x5a7a('0x36')]=qs[_0x5a7a('0x2f')](_[_0x5a7a('0x37')](_0x10d57[_0x5a7a('0x2d')],_0x5d3305[_0x5a7a('0x2f')]),_0x5d577f);if(_0x10d57['query'][_0x5a7a('0x38')]){_0x8b0854[_0x5a7a('0x36')]=_[_0x5a7a('0x39')](_0x8b0854[_0x5a7a('0x36')],{'$or':_[_0x5a7a('0x29')](_0x5d577f,function(_0x15a866){if(_0x15a866[_0x5a7a('0x3a')]!==_0x5a7a('0x3b')){var _0x4dea86={};_0x4dea86[_0x15a866[_0x5a7a('0x27')]]={'$like':'%'+_0x10d57[_0x5a7a('0x2d')][_0x5a7a('0x38')]+'%'};return _0x4dea86;}})});}_0x8b0854=_[_0x5a7a('0x39')]({},_0x8b0854,_0x10d57[_0x5a7a('0x3c')]);var _0x4f964d={'where':_0x8b0854[_0x5a7a('0x36')]};return db[_0x5a7a('0x2a')][_0x5a7a('0x1c')](_0x4f964d)[_0x5a7a('0x22')](function(_0x3f21ab){_0x5efffc[_0x5a7a('0x1c')]=_0x3f21ab;if(_0x10d57[_0x5a7a('0x2d')][_0x5a7a('0x3d')]){_0x8b0854[_0x5a7a('0x3e')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x8b0854);})[_0x5a7a('0x22')](function(_0x4d7307){_0x5efffc[_0x5a7a('0x3f')]=_0x4d7307;return _0x5efffc;})[_0x5a7a('0x22')](respondWithFilteredResult(_0x26ad64,_0x8b0854))['catch'](handleError(_0x26ad64,null));};exports[_0x5a7a('0x40')]=function(_0x5f4cbe,_0x2b599d){var _0x27814b={'raw':!![],'where':{'id':_0x5f4cbe[_0x5a7a('0x41')]['id']}},_0x49af6d={};_0x49af6d[_0x5a7a('0x31')]=_[_0x5a7a('0x2e')](db[_0x5a7a('0x2a')][_0x5a7a('0x2b')]);_0x49af6d[_0x5a7a('0x2d')]=_['keys'](_0x5f4cbe['query']);_0x49af6d[_0x5a7a('0x2f')]=_['intersection'](_0x49af6d[_0x5a7a('0x31')],_0x49af6d[_0x5a7a('0x2d')]);_0x27814b[_0x5a7a('0x33')]=_['intersection'](_0x49af6d[_0x5a7a('0x31')],qs[_0x5a7a('0x32')](_0x5f4cbe[_0x5a7a('0x2d')][_0x5a7a('0x32')]));_0x27814b['attributes']=_0x27814b[_0x5a7a('0x33')][_0x5a7a('0x42')]?_0x27814b['attributes']:_0x49af6d[_0x5a7a('0x31')];if(_0x5f4cbe['query'][_0x5a7a('0x3d')]){_0x27814b[_0x5a7a('0x3e')]=[{'all':!![]}];}_0x27814b=_[_0x5a7a('0x39')]({},_0x27814b,_0x5f4cbe[_0x5a7a('0x3c')]);return db[_0x5a7a('0x2a')]['find'](_0x27814b)[_0x5a7a('0x22')](handleEntityNotFound(_0x2b599d,null))['then'](respondWithResult(_0x2b599d,null))[_0x5a7a('0x43')](handleError(_0x2b599d,null));};exports[_0x5a7a('0x44')]=function(_0x4c1dac,_0x42a5ea){return db[_0x5a7a('0x2a')][_0x5a7a('0x44')](_0x4c1dac[_0x5a7a('0x45')],{})[_0x5a7a('0x22')](function(_0x158c3f){var _0xff82c9=_0x4c1dac[_0x5a7a('0x46')][_0x5a7a('0x24')]({'plain':!![]});if(!_0xff82c9)throw new Error(_0x5a7a('0x47'));if(_0xff82c9[_0x5a7a('0x48')]===_0x5a7a('0x46')){var _0x575bf8=_0x158c3f[_0x5a7a('0x24')]({'plain':!![]});var _0x21580c=_0x5a7a('0x49');return db[_0x5a7a('0x4a')]['find']({'where':{'name':_0x21580c,'userProfileId':_0xff82c9[_0x5a7a('0x4b')]},'raw':!![]})[_0x5a7a('0x22')](function(_0x5ae12f){if(_0x5ae12f&&_0x5ae12f[_0x5a7a('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x575bf8[_0x5a7a('0x27')],'resourceId':_0x575bf8['id'],'type':_0x5ae12f[_0x5a7a('0x27')],'sectionId':_0x5ae12f['id']},{})[_0x5a7a('0x22')](function(){return _0x158c3f;});}else{return _0x158c3f;}})[_0x5a7a('0x43')](function(_0x253a6e){logger['error'](_0x5a7a('0x4d'),_0x253a6e);throw _0x253a6e;});}return _0x158c3f;})[_0x5a7a('0x22')](respondWithResult(_0x42a5ea,0xc9))[_0x5a7a('0x43')](handleError(_0x42a5ea,null));};exports[_0x5a7a('0x4e')]=function(_0x227d3f,_0x57d5ec){if(_0x227d3f['body']['id']){delete _0x227d3f[_0x5a7a('0x45')]['id'];}return db[_0x5a7a('0x2a')][_0x5a7a('0x4f')]({'where':{'id':_0x227d3f[_0x5a7a('0x41')]['id']}})['then'](handleEntityNotFound(_0x57d5ec,null))[_0x5a7a('0x22')](saveUpdates(_0x227d3f[_0x5a7a('0x45')],null))[_0x5a7a('0x22')](respondWithResult(_0x57d5ec,null))['catch'](handleError(_0x57d5ec,null));};exports['destroy']=function(_0x22a0ca,_0x1e8517){return db[_0x5a7a('0x2a')][_0x5a7a('0x4f')]({'where':{'id':_0x22a0ca['params']['id']}})['then'](handleEntityNotFound(_0x1e8517,null))[_0x5a7a('0x22')](removeEntity(_0x1e8517,null))['catch'](handleError(_0x1e8517,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 716feed..b12a714 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc903=['path','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','bluebird'];(function(_0x4df2c7,_0xdc84f5){var _0x519644=function(_0x1315d1){while(--_0x1315d1){_0x4df2c7['push'](_0x4df2c7['shift']());}};_0x519644(++_0xdc84f5);}(_0xc903,0x177));var _0x3c90=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xc903[_0x34c063];return _0x2c63a3;};'use strict';var _=require(_0x3c90('0x0'));var util=require('util');var logger=require(_0x3c90('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3c90('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c90('0x3'));var rimraf=require('rimraf');var config=require(_0x3c90('0x4'));var attributes=require(_0x3c90('0x5'));module['exports']=function(_0x3d9d9c,_0x361068){return _0x3d9d9c[_0x3c90('0x6')](_0x3c90('0x7'),attributes,{'tableName':_0x3c90('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b5d=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','lodash','util','../../config/logger','api'];(function(_0x16adf1,_0x1273a5){var _0xc13362=function(_0x35e767){while(--_0x35e767){_0x16adf1['push'](_0x16adf1['shift']());}};_0xc13362(++_0x1273a5);}(_0x6b5d,0xd4));var _0xd6b5=function(_0x584a6f,_0x308da5){_0x584a6f=_0x584a6f-0x0;var _0x17e3d1=_0x6b5d[_0x584a6f];return _0x17e3d1;};'use strict';var _=require(_0xd6b5('0x0'));var util=require(_0xd6b5('0x1'));var logger=require(_0xd6b5('0x2'))(_0xd6b5('0x3'));var moment=require('moment');var BPromise=require(_0xd6b5('0x4'));var rp=require(_0xd6b5('0x5'));var fs=require('fs');var path=require(_0xd6b5('0x6'));var rimraf=require(_0xd6b5('0x7'));var config=require(_0xd6b5('0x8'));var attributes=require(_0xd6b5('0x9'));module[_0xd6b5('0xa')]=function(_0x5bd530,_0x288321){return _0x5bd530['define'](_0xd6b5('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 8e392b6..703cd2b 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1f2=['http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countbusyretry','dialGlobalMaxRetry','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','activateAdditionalPhone','IncrementPreviewCounters','update','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc1f2,0x151));var _0x2c1f=function(_0x56efe1,_0x59a027){_0x56efe1=_0x56efe1-0x0;var _0x50fd8e=_0xc1f2[_0x56efe1];return _0x50fd8e;};'use strict';var _=require(_0x2c1f('0x0'));var util=require(_0x2c1f('0x1'));var moment=require(_0x2c1f('0x2'));var BPromise=require(_0x2c1f('0x3'));var rs=require(_0x2c1f('0x4'));var fs=require('fs');var Redis=require(_0x2c1f('0x5'));var db=require(_0x2c1f('0x6'))['db'];var utils=require(_0x2c1f('0x7'));var logger=require(_0x2c1f('0x8'))('rpc');var config=require(_0x2c1f('0x9'));var jayson=require(_0x2c1f('0xa'));var client=jayson['client'][_0x2c1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e6c1d,_0x28d933,_0x13a419){return new BPromise(function(_0x4d669d,_0x18eb9d){return client[_0x2c1f('0xc')](_0x5e6c1d,_0x13a419)[_0x2c1f('0xd')](function(_0x2b608e){logger[_0x2c1f('0xe')](_0x2c1f('0xf'),_0x28d933,_0x2c1f('0x10'));logger[_0x2c1f('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x28d933,'request\x20sent',JSON['stringify'](_0x2b608e));if(_0x2b608e[_0x2c1f('0x12')]){if(_0x2b608e[_0x2c1f('0x12')][_0x2c1f('0x13')]===0x1f4){logger[_0x2c1f('0x12')](_0x2c1f('0xf'),_0x28d933,_0x2b608e[_0x2c1f('0x12')][_0x2c1f('0x14')]);return _0x18eb9d(_0x2b608e[_0x2c1f('0x12')]['message']);}logger[_0x2c1f('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x28d933,_0x2b608e[_0x2c1f('0x12')][_0x2c1f('0x14')]);return _0x4d669d(_0x2b608e[_0x2c1f('0x12')]['message']);}else{logger[_0x2c1f('0xe')](_0x2c1f('0xf'),_0x28d933,'request\x20sent');_0x4d669d(_0x2b608e['result'][_0x2c1f('0x14')]);}})['catch'](function(_0x104ed4){logger[_0x2c1f('0x12')](_0x2c1f('0xf'),_0x28d933,_0x104ed4);_0x18eb9d(_0x104ed4);});});}exports[_0x2c1f('0x15')]=function(_0x48b40a){var _0x20e668=this;return new Promise(function(_0x1538e6,_0x2d6e76){return db[_0x2c1f('0x16')][_0x2c1f('0x17')]({'raw':!![],'where':{'ContactId':_0x48b40a[_0x2c1f('0x18')]['ContactId'],'ListId':_0x48b40a['body'][_0x2c1f('0x19')],'VoiceQueueId':_0x48b40a['body'][_0x2c1f('0x1a')]===undefined?null:_0x48b40a['body']['VoiceQueueId'],'CampaignId':_0x48b40a[_0x2c1f('0x18')][_0x2c1f('0x1b')]===undefined?null:_0x48b40a[_0x2c1f('0x18')][_0x2c1f('0x1b')]}})[_0x2c1f('0xd')](function(_0x28a681){if(_0x28a681!=null){return db[_0x2c1f('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x28a681['id'],'OrderBy':{'$gt':_0x28a681[_0x2c1f('0x1d')]}},'order':[[_0x2c1f('0x1d'),_0x2c1f('0x1e')]]})[_0x2c1f('0xd')](function(_0xef9bad){var _0x137c6d=0x0;if(_0xef9bad){if(_0xef9bad['countbusyretry']+_0xef9bad[_0x2c1f('0x1f')]+_0xef9bad[_0x2c1f('0x20')]+_0xef9bad[_0x2c1f('0x21')]+_0xef9bad[_0x2c1f('0x22')]+_0xef9bad[_0x2c1f('0x23')]+_0xef9bad[_0x2c1f('0x24')]+_0xef9bad[_0x2c1f('0x25')]<_0x48b40a[_0x2c1f('0x26')]['dialGlobalMaxRetry'])_0x137c6d=0x1;_0x1538e6({'additional':_0x137c6d});}else{return db[_0x2c1f('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x28a681['id']},'order':[[_0x2c1f('0x1d'),'ASC']]})[_0x2c1f('0xd')](function(_0x323d4c){var _0x35882e=0x0;if(_0x323d4c){if(_0x323d4c[_0x2c1f('0x27')]+_0x323d4c[_0x2c1f('0x1f')]+_0x323d4c[_0x2c1f('0x20')]+_0x323d4c[_0x2c1f('0x21')]+_0x323d4c[_0x2c1f('0x22')]+_0x323d4c[_0x2c1f('0x23')]+_0x323d4c[_0x2c1f('0x24')]+_0x323d4c[_0x2c1f('0x25')]<_0x48b40a[_0x2c1f('0x26')][_0x2c1f('0x28')])_0x35882e=0x1;_0x1538e6({'additional':_0x35882e});}else{_0x1538e6({'additional':0x0});}})['catch'](function(_0x3bc0c4){logger[_0x2c1f('0x12')](_0x2c1f('0x15'),_0x3bc0c4[_0x2c1f('0x14')]);_0x2d6e76(_0x20e668[_0x2c1f('0x12')](0x1f4,_0x3bc0c4[_0x2c1f('0x14')]));});}})[_0x2c1f('0x29')](function(_0xdd6024){logger[_0x2c1f('0x12')](_0x2c1f('0x15'),_0xdd6024[_0x2c1f('0x14')]);_0x2d6e76(_0x20e668[_0x2c1f('0x12')](0x1f4,_0xdd6024[_0x2c1f('0x14')]));});}else _0x1538e6({'additional':0x0});});});};exports[_0x2c1f('0x2a')]=function(_0x36c647){var _0x53f025=this;return new Promise(function(_0x519c64,_0x5b8e2a){return db[_0x2c1f('0x16')][_0x2c1f('0x17')]({'raw':!![],'where':{'ContactId':_0x36c647[_0x2c1f('0x18')]['ContactId'],'ListId':_0x36c647['body'][_0x2c1f('0x19')],'VoiceQueueId':_0x36c647['body'][_0x2c1f('0x1a')]===undefined?null:_0x36c647[_0x2c1f('0x18')]['VoiceQueueId'],'CampaignId':_0x36c647['body'][_0x2c1f('0x1b')]===undefined?null:_0x36c647[_0x2c1f('0x18')][_0x2c1f('0x1b')]}})[_0x2c1f('0xd')](function(_0x492b9a){if(_0x492b9a!=null){return db[_0x2c1f('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x492b9a['id'],'OrderBy':{'$gte':_0x492b9a[_0x2c1f('0x1d')]}},'order':[['OrderBy',_0x2c1f('0x1e')]]})[_0x2c1f('0xd')](function(_0x5b8a42){if(_0x5b8a42)return activateAdditionalPhone(_0x492b9a,_0x36c647[_0x2c1f('0x18')],_0x5b8a42,_0x36c647[_0x2c1f('0x2b')],_0x36c647[_0x2c1f('0x2c')])[_0x2c1f('0xd')](function(_0x443f43){_0x519c64(_0x443f43);});else{return db[_0x2c1f('0x1c')][_0x2c1f('0x17')]({'raw':!![],'where':{'CmHopperId':_0x492b9a['id']},'order':[[_0x2c1f('0x1d'),_0x2c1f('0x1e')]]})[_0x2c1f('0xd')](function(_0x275c53){if(_0x275c53)return activateAdditionalPhone(_0x492b9a,_0x36c647['body'],_0x275c53,_0x36c647[_0x2c1f('0x2b')],_0x36c647[_0x2c1f('0x2c')])[_0x2c1f('0xd')](function(_0x4a6860){_0x519c64(_0x4a6860);});else{_0x519c64({'id':_0x492b9a['id'],'phone':''});}})[_0x2c1f('0x29')](function(_0x2cbafa){logger[_0x2c1f('0x12')](_0x2c1f('0x15'),_0x2cbafa[_0x2c1f('0x14')]);_0x5b8e2a(_0x53f025['error'](0x1f4,_0x2cbafa[_0x2c1f('0x14')]));});}})[_0x2c1f('0x29')](function(_0x27b992){logger[_0x2c1f('0x12')](_0x2c1f('0x15'),_0x27b992[_0x2c1f('0x14')]);_0x5b8e2a(_0x53f025['error'](0x1f4,_0x27b992[_0x2c1f('0x14')]));});}else _0x519c64(0x1);});});};function activateAdditionalPhone(_0x279f08,_0x4d71ee,_0xd867a3,_0x21378b,_0x358824){return new Promise(function(_0x323bc4,_0x1c7f3c){var _0x2d8b05;if(_[_0x2c1f('0x2d')](_0xd867a3['scheduledat'])){_0xd867a3[_0x2c1f('0x2e')]=moment();}if(moment()>moment(_0xd867a3[_0x2c1f('0x2e')])){_0x2d8b05=moment()[_0x2c1f('0x2f')](_0x358824||0x3,_0x2c1f('0x30'));}else{if(_0xd867a3['OrderBy']==0x0){_0x2d8b05=moment(_0xd867a3[_0x2c1f('0x2e')]);}else{_0x2d8b05=moment()[_0x2c1f('0x2f')](_0x358824||0x3,'minutes');}}if(_[_0x2c1f('0x2d')](_0x2d8b05)){_0x2d8b05=moment()[_0x2c1f('0x2f')](_0x358824||0x3,_0x2c1f('0x30'));}var _0x39e4a4={'phone':_0x279f08[_0x2c1f('0x31')],'active':0x0,'OrderBy':_[_0x2c1f('0x2d')](_0x279f08[_0x2c1f('0x1d')])?0x0:_0x279f08['OrderBy'],'scheduledat':moment()[_0x2c1f('0x2f')](_0x21378b||0x1,_0x2c1f('0x30')),'countbusyretry':_0x4d71ee['countbusyretry'],'countcongestionretry':_0x4d71ee[_0x2c1f('0x1f')],'countnoanswerretry':_0x4d71ee[_0x2c1f('0x20')],'countnosuchnumberretry':_0x4d71ee[_0x2c1f('0x21')],'countdropretry':_0x4d71ee[_0x2c1f('0x22')],'countabandonedretry':_0x4d71ee[_0x2c1f('0x23')],'countmachineretry':_0x4d71ee[_0x2c1f('0x24')],'countagentrejectretry':_0x4d71ee['countagentrejectretry'],'createdAt':_0x4d71ee[_0x2c1f('0x32')],'updatedAt':_0x4d71ee[_0x2c1f('0x33')]};var _0x796fd={'CmHopperId':_0x279f08['id'],'phone':_0xd867a3[_0x2c1f('0x31')],'active':0x0,'OrderBy':_['isNil'](_0xd867a3[_0x2c1f('0x1d')])?0x0:_0xd867a3[_0x2c1f('0x1d')],'scheduledat':_0x2d8b05,'countbusyretry':_0xd867a3['countbusyretry'],'countcongestionretry':_0xd867a3[_0x2c1f('0x1f')],'countnoanswerretry':_0xd867a3[_0x2c1f('0x20')],'countnosuchnumberretry':_0xd867a3[_0x2c1f('0x21')],'countdropretry':_0xd867a3[_0x2c1f('0x22')],'countabandonedretry':_0xd867a3[_0x2c1f('0x23')],'countmachineretry':_0xd867a3['countmachineretry'],'countagentrejectretry':_0xd867a3['countagentrejectretry'],'createdAt':_0xd867a3[_0x2c1f('0x32')],'updatedAt':_0xd867a3[_0x2c1f('0x33')]};return db[_0x2c1f('0x34')][_0x2c1f('0x35')](function(_0xd78fa1){return db[_0x2c1f('0x1c')]['update'](_0x39e4a4,{'where':{'id':_0xd867a3['id']}},{'transaction':_0xd78fa1})[_0x2c1f('0xd')](function(){return db[_0x2c1f('0x16')]['update'](_0x796fd,{'where':{'id':_0x279f08['id']}},{'transaction':_0xd78fa1});});})[_0x2c1f('0xd')](function(_0x159b88){_0x323bc4({'id':_0x279f08['id'],'phone':_0xd867a3[_0x2c1f('0x31')]});})[_0x2c1f('0x29')](function(_0x4e9630){logger['error'](_0x2c1f('0x36'),_0x4e9630[_0x2c1f('0x14')]);_0x1c7f3c({'error':_0x4e9630[_0x2c1f('0x14')]});});});}exports[_0x2c1f('0x37')]=function(_0x462369){var _0x171582=this;return new Promise(function(_0x47f3d6,_0x4b5596){return db[_0x2c1f('0x16')][_0x2c1f('0x38')](_0x462369[_0x2c1f('0x18')][_0x2c1f('0x39')],{'where':{'id':_0x462369[_0x2c1f('0x18')]['id']}})[_0x2c1f('0xd')](function(_0x42d3b9){_0x47f3d6(_0x42d3b9);})[_0x2c1f('0x29')](function(_0x536cc9){logger[_0x2c1f('0x12')](_0x2c1f('0x37'),_0x536cc9[_0x2c1f('0x14')]);_0x4b5596(_0x171582[_0x2c1f('0x12')](0x1f4,_0x536cc9[_0x2c1f('0x14')]));});});}; \ No newline at end of file +var _0x10c7=['client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ASC','dialGlobalMaxRetry','catch','SwapAdditionalPhones','CmHopperAdditionalPhone','waitTime','duration','isNil','scheduledat','add','minutes','countagentrejectretry','createdAt','updatedAt','phone','sequelize','update','IncrementPreviewCounters','field','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xb61568,_0x13b716){var _0x58b607=function(_0x4b6052){while(--_0x4b6052){_0xb61568['push'](_0xb61568['shift']());}};_0x58b607(++_0x13b716);}(_0x10c7,0xd8));var _0x710c=function(_0x2d3145,_0x2e57e3){_0x2d3145=_0x2d3145-0x0;var _0x1d0d68=_0x10c7[_0x2d3145];return _0x1d0d68;};'use strict';var _=require('lodash');var util=require(_0x710c('0x0'));var moment=require(_0x710c('0x1'));var BPromise=require('bluebird');var rs=require(_0x710c('0x2'));var fs=require('fs');var Redis=require(_0x710c('0x3'));var db=require(_0x710c('0x4'))['db'];var utils=require(_0x710c('0x5'));var logger=require(_0x710c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x710c('0x7'));var client=jayson[_0x710c('0x8')][_0x710c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463dd2,_0x2b472c,_0x4cfed5){return new BPromise(function(_0x3cc066,_0x12569d){return client[_0x710c('0xa')](_0x463dd2,_0x4cfed5)['then'](function(_0x2634f3){logger[_0x710c('0xb')](_0x710c('0xc'),_0x2b472c,_0x710c('0xd'));logger['debug'](_0x710c('0xe'),_0x2b472c,'request\x20sent',JSON[_0x710c('0xf')](_0x2634f3));if(_0x2634f3[_0x710c('0x10')]){if(_0x2634f3[_0x710c('0x10')][_0x710c('0x11')]===0x1f4){logger[_0x710c('0x10')](_0x710c('0xc'),_0x2b472c,_0x2634f3['error'][_0x710c('0x12')]);return _0x12569d(_0x2634f3[_0x710c('0x10')]['message']);}logger[_0x710c('0x10')](_0x710c('0xc'),_0x2b472c,_0x2634f3[_0x710c('0x10')][_0x710c('0x12')]);return _0x3cc066(_0x2634f3['error'][_0x710c('0x12')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2b472c,_0x710c('0xd'));_0x3cc066(_0x2634f3[_0x710c('0x13')]['message']);}})['catch'](function(_0x609c1b){logger[_0x710c('0x10')](_0x710c('0xc'),_0x2b472c,_0x609c1b);_0x12569d(_0x609c1b);});});}exports[_0x710c('0x14')]=function(_0x3fbdb3){var _0x31ff08=this;return new Promise(function(_0x3d0bc5,_0x215a1d){return db[_0x710c('0x15')][_0x710c('0x16')]({'raw':!![],'where':{'ContactId':_0x3fbdb3[_0x710c('0x17')][_0x710c('0x18')],'ListId':_0x3fbdb3['body'][_0x710c('0x19')],'VoiceQueueId':_0x3fbdb3[_0x710c('0x17')][_0x710c('0x1a')]===undefined?null:_0x3fbdb3[_0x710c('0x17')][_0x710c('0x1a')],'CampaignId':_0x3fbdb3[_0x710c('0x17')][_0x710c('0x1b')]===undefined?null:_0x3fbdb3[_0x710c('0x17')][_0x710c('0x1b')]}})[_0x710c('0x1c')](function(_0x20744d){if(_0x20744d!=null){return db['CmHopperAdditionalPhone'][_0x710c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x20744d['id'],'OrderBy':{'$gt':_0x20744d[_0x710c('0x1d')]}},'order':[['OrderBy','ASC']]})['then'](function(_0xa2dacd){var _0x3ee68d=0x0;if(_0xa2dacd){if(_0xa2dacd[_0x710c('0x1e')]+_0xa2dacd[_0x710c('0x1f')]+_0xa2dacd[_0x710c('0x20')]+_0xa2dacd[_0x710c('0x21')]+_0xa2dacd[_0x710c('0x22')]+_0xa2dacd[_0x710c('0x23')]+_0xa2dacd[_0x710c('0x24')]+_0xa2dacd['countagentrejectretry']<_0x3fbdb3['entity']['dialGlobalMaxRetry'])_0x3ee68d=0x1;_0x3d0bc5({'additional':_0x3ee68d});}else{return db['CmHopperAdditionalPhone'][_0x710c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x20744d['id']},'order':[[_0x710c('0x1d'),_0x710c('0x25')]]})[_0x710c('0x1c')](function(_0x1976ad){var _0x27ee96=0x0;if(_0x1976ad){if(_0x1976ad['countbusyretry']+_0x1976ad[_0x710c('0x1f')]+_0x1976ad[_0x710c('0x20')]+_0x1976ad[_0x710c('0x21')]+_0x1976ad[_0x710c('0x22')]+_0x1976ad[_0x710c('0x23')]+_0x1976ad[_0x710c('0x24')]+_0x1976ad['countagentrejectretry']<_0x3fbdb3['entity'][_0x710c('0x26')])_0x27ee96=0x1;_0x3d0bc5({'additional':_0x27ee96});}else{_0x3d0bc5({'additional':0x0});}})[_0x710c('0x27')](function(_0x529ec5){logger[_0x710c('0x10')](_0x710c('0x14'),_0x529ec5[_0x710c('0x12')]);_0x215a1d(_0x31ff08[_0x710c('0x10')](0x1f4,_0x529ec5['message']));});}})[_0x710c('0x27')](function(_0x1a51e1){logger[_0x710c('0x10')](_0x710c('0x14'),_0x1a51e1['message']);_0x215a1d(_0x31ff08[_0x710c('0x10')](0x1f4,_0x1a51e1['message']));});}else _0x3d0bc5({'additional':0x0});});});};exports[_0x710c('0x28')]=function(_0x196c3e){var _0x2145a3=this;return new Promise(function(_0x228f17,_0x409ae4){return db[_0x710c('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x196c3e[_0x710c('0x17')]['ContactId'],'ListId':_0x196c3e[_0x710c('0x17')][_0x710c('0x19')],'VoiceQueueId':_0x196c3e[_0x710c('0x17')][_0x710c('0x1a')]===undefined?null:_0x196c3e[_0x710c('0x17')]['VoiceQueueId'],'CampaignId':_0x196c3e[_0x710c('0x17')][_0x710c('0x1b')]===undefined?null:_0x196c3e['body'][_0x710c('0x1b')]}})[_0x710c('0x1c')](function(_0x29a0ff){if(_0x29a0ff!=null){return db[_0x710c('0x29')][_0x710c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x29a0ff['id'],'OrderBy':{'$gte':_0x29a0ff[_0x710c('0x1d')]}},'order':[[_0x710c('0x1d'),_0x710c('0x25')]]})[_0x710c('0x1c')](function(_0x3533c4){if(_0x3533c4)return activateAdditionalPhone(_0x29a0ff,_0x196c3e['body'],_0x3533c4,_0x196c3e['duration'],_0x196c3e[_0x710c('0x2a')])[_0x710c('0x1c')](function(_0x5bc409){_0x228f17(_0x5bc409);});else{return db['CmHopperAdditionalPhone'][_0x710c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x29a0ff['id']},'order':[[_0x710c('0x1d'),_0x710c('0x25')]]})[_0x710c('0x1c')](function(_0x29f658){if(_0x29f658)return activateAdditionalPhone(_0x29a0ff,_0x196c3e[_0x710c('0x17')],_0x29f658,_0x196c3e[_0x710c('0x2b')],_0x196c3e[_0x710c('0x2a')])[_0x710c('0x1c')](function(_0x4e7b02){_0x228f17(_0x4e7b02);});else{_0x228f17({'id':_0x29a0ff['id'],'phone':''});}})[_0x710c('0x27')](function(_0x4632ab){logger['error'](_0x710c('0x14'),_0x4632ab[_0x710c('0x12')]);_0x409ae4(_0x2145a3[_0x710c('0x10')](0x1f4,_0x4632ab[_0x710c('0x12')]));});}})[_0x710c('0x27')](function(_0x427487){logger[_0x710c('0x10')]('VerifyAdditionalPhones',_0x427487[_0x710c('0x12')]);_0x409ae4(_0x2145a3[_0x710c('0x10')](0x1f4,_0x427487['message']));});}else _0x228f17(0x1);});});};function activateAdditionalPhone(_0x3b3532,_0x1bc850,_0x5d8cac,_0xc3fb52,_0x4ce1cd){return new Promise(function(_0x17c8df,_0x4d2226){var _0x3d71f9;if(_[_0x710c('0x2c')](_0x5d8cac[_0x710c('0x2d')])){_0x5d8cac[_0x710c('0x2d')]=moment();}if(moment()>moment(_0x5d8cac['scheduledat'])){_0x3d71f9=moment()[_0x710c('0x2e')](_0x4ce1cd||0x3,'minutes');}else{if(_0x5d8cac[_0x710c('0x1d')]==0x0){_0x3d71f9=moment(_0x5d8cac[_0x710c('0x2d')]);}else{_0x3d71f9=moment()[_0x710c('0x2e')](_0x4ce1cd||0x3,_0x710c('0x2f'));}}if(_[_0x710c('0x2c')](_0x3d71f9)){_0x3d71f9=moment()[_0x710c('0x2e')](_0x4ce1cd||0x3,_0x710c('0x2f'));}var _0x40ece2={'phone':_0x3b3532['phone'],'active':0x0,'OrderBy':_[_0x710c('0x2c')](_0x3b3532[_0x710c('0x1d')])?0x0:_0x3b3532[_0x710c('0x1d')],'scheduledat':moment()['add'](_0xc3fb52||0x1,'minutes'),'countbusyretry':_0x1bc850['countbusyretry'],'countcongestionretry':_0x1bc850[_0x710c('0x1f')],'countnoanswerretry':_0x1bc850[_0x710c('0x20')],'countnosuchnumberretry':_0x1bc850[_0x710c('0x21')],'countdropretry':_0x1bc850[_0x710c('0x22')],'countabandonedretry':_0x1bc850[_0x710c('0x23')],'countmachineretry':_0x1bc850['countmachineretry'],'countagentrejectretry':_0x1bc850[_0x710c('0x30')],'createdAt':_0x1bc850[_0x710c('0x31')],'updatedAt':_0x1bc850[_0x710c('0x32')]};var _0x1fdffc={'CmHopperId':_0x3b3532['id'],'phone':_0x5d8cac[_0x710c('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x5d8cac['OrderBy'])?0x0:_0x5d8cac[_0x710c('0x1d')],'scheduledat':_0x3d71f9,'countbusyretry':_0x5d8cac[_0x710c('0x1e')],'countcongestionretry':_0x5d8cac['countcongestionretry'],'countnoanswerretry':_0x5d8cac[_0x710c('0x20')],'countnosuchnumberretry':_0x5d8cac[_0x710c('0x21')],'countdropretry':_0x5d8cac[_0x710c('0x22')],'countabandonedretry':_0x5d8cac[_0x710c('0x23')],'countmachineretry':_0x5d8cac[_0x710c('0x24')],'countagentrejectretry':_0x5d8cac[_0x710c('0x30')],'createdAt':_0x5d8cac[_0x710c('0x31')],'updatedAt':_0x5d8cac[_0x710c('0x32')]};return db[_0x710c('0x34')]['transaction'](function(_0x3bcc24){return db[_0x710c('0x29')][_0x710c('0x35')](_0x40ece2,{'where':{'id':_0x5d8cac['id']}},{'transaction':_0x3bcc24})[_0x710c('0x1c')](function(){return db['CmHopper'][_0x710c('0x35')](_0x1fdffc,{'where':{'id':_0x3b3532['id']}},{'transaction':_0x3bcc24});});})['then'](function(_0x548e11){_0x17c8df({'id':_0x3b3532['id'],'phone':_0x5d8cac[_0x710c('0x33')]});})[_0x710c('0x27')](function(_0x43ce2a){logger[_0x710c('0x10')]('activateAdditionalPhone',_0x43ce2a['message']);_0x4d2226({'error':_0x43ce2a[_0x710c('0x12')]});});});}exports[_0x710c('0x36')]=function(_0x4941a7){var _0x4c216d=this;return new Promise(function(_0x204984,_0x477b2e){return db[_0x710c('0x15')][_0x710c('0x35')](_0x4941a7[_0x710c('0x17')][_0x710c('0x37')],{'where':{'id':_0x4941a7[_0x710c('0x17')]['id']}})[_0x710c('0x1c')](function(_0x153cbb){_0x204984(_0x153cbb);})[_0x710c('0x27')](function(_0x1277be){logger[_0x710c('0x10')]('IncrementPreviewCounters',_0x1277be[_0x710c('0x12')]);_0x477b2e(_0x4c216d[_0x710c('0x10')](0x1f4,_0x1277be[_0x710c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 748a116..2f865c0 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf4a=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xaf4a,0x101));var _0xaaf4=function(_0x25a245,_0x158aa9){_0x25a245=_0x25a245-0x0;var _0x3990e7=_0xaf4a[_0x25a245];return _0x3990e7;};'use strict';var multer=require('multer');var util=require(_0xaaf4('0x0'));var path=require(_0xaaf4('0x1'));var timeout=require(_0xaaf4('0x2'));var express=require(_0xaaf4('0x3'));var router=express[_0xaaf4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaaf4('0x5'));var interaction=require(_0xaaf4('0x6'));var config=require(_0xaaf4('0x7'));var controller=require(_0xaaf4('0x8'));router[_0xaaf4('0x9')]('/',auth[_0xaaf4('0xa')](),controller[_0xaaf4('0xb')]);router['get'](_0xaaf4('0xc'),auth['isAuthenticated'](),controller[_0xaaf4('0xd')]);router[_0xaaf4('0xe')]('/',auth['isAuthenticated'](),controller[_0xaaf4('0xf')]);router[_0xaaf4('0x10')](_0xaaf4('0xc'),auth[_0xaaf4('0xa')](),controller[_0xaaf4('0x11')]);router[_0xaaf4('0x12')](_0xaaf4('0xc'),auth[_0xaaf4('0xa')](),controller[_0xaaf4('0x13')]);module[_0xaaf4('0x14')]=router; \ No newline at end of file +var _0xc021=['express','Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path'];(function(_0x3c8819,_0x5c9166){var _0x30d5cb=function(_0x10db30){while(--_0x10db30){_0x3c8819['push'](_0x3c8819['shift']());}};_0x30d5cb(++_0x5c9166);}(_0xc021,0x19b));var _0x1c02=function(_0x435e16,_0x5d3519){_0x435e16=_0x435e16-0x0;var _0x3629ef=_0xc021[_0x435e16];return _0x3629ef;};'use strict';var multer=require(_0x1c02('0x0'));var util=require(_0x1c02('0x1'));var path=require(_0x1c02('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c02('0x3'));var router=express[_0x1c02('0x4')]();var fs_extra=require(_0x1c02('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1c02('0x6'));var config=require('../../config/environment');var controller=require(_0x1c02('0x7'));router[_0x1c02('0x8')]('/',auth[_0x1c02('0x9')](),controller[_0x1c02('0xa')]);router[_0x1c02('0x8')](_0x1c02('0xb'),auth[_0x1c02('0x9')](),controller[_0x1c02('0xc')]);router[_0x1c02('0xd')]('/',auth['isAuthenticated'](),controller[_0x1c02('0xe')]);router['put'](_0x1c02('0xb'),auth[_0x1c02('0x9')](),controller[_0x1c02('0xf')]);router['delete']('/:id',auth[_0x1c02('0x9')](),controller[_0x1c02('0x10')]);module[_0x1c02('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 8a17c37..26d046e 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 _0xf569=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x36ca9f,_0x173c20){var _0xf5b105=function(_0x53ad8d){while(--_0x53ad8d){_0x36ca9f['push'](_0x36ca9f['shift']());}};_0xf5b105(++_0x173c20);}(_0xf569,0xd0));var _0x9f56=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xf569[_0xa8883];return _0x479426;};'use strict';var moment=require('moment');var Sequelize=require(_0x9f56('0x0'));module[_0x9f56('0x1')]={'phone':{'type':Sequelize[_0x9f56('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9f56('0x3')],'unique':_0x9f56('0x4')},'ListId':{'type':Sequelize[_0x9f56('0x3')],'unique':_0x9f56('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9f56('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xc57c=['INTEGER','contactListQueue','moment'];(function(_0x3efc92,_0x49a75b){var _0x152e9d=function(_0x2c7f59){while(--_0x2c7f59){_0x3efc92['push'](_0x3efc92['shift']());}};_0x152e9d(++_0x49a75b);}(_0xc57c,0x149));var _0xcc57=function(_0xf61f53,_0x3f1d7e){_0xf61f53=_0xf61f53-0x0;var _0x50abce=_0xc57c[_0xf61f53];return _0x50abce;};'use strict';var moment=require(_0xcc57('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcc57('0x1')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xcc57('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xcc57('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 4668a4e..b39b915 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 _0xce6b=['find','update','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','json','undefined','count','offset','set','Content-Range','reject','save','then','destroy','end','error','stack','name','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','filters','merge','where','filter','options','include','findAll','catch','show','params'];(function(_0x23ea17,_0x1455dc){var _0x224b9c=function(_0x439769){while(--_0x439769){_0x23ea17['push'](_0x23ea17['shift']());}};_0x224b9c(++_0x1455dc);}(_0xce6b,0x8e));var _0xbce6=function(_0x57b347,_0x1272cc){_0x57b347=_0x57b347-0x0;var _0x23faf4=_0xce6b[_0x57b347];return _0x23faf4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbce6('0x0'));var jsonpatch=require(_0xbce6('0x1'));var rp=require(_0xbce6('0x2'));var moment=require(_0xbce6('0x3'));var BPromise=require(_0xbce6('0x4'));var Mustache=require(_0xbce6('0x5'));var util=require(_0xbce6('0x6'));var path=require(_0xbce6('0x7'));var sox=require(_0xbce6('0x8'));var csv=require('to-csv');var ejs=require(_0xbce6('0x9'));var fs=require('fs');var fs_extra=require(_0xbce6('0xa'));var _=require(_0xbce6('0xb'));var squel=require(_0xbce6('0xc'));var crypto=require(_0xbce6('0xd'));var jsforce=require(_0xbce6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbce6('0xf'));var Papa=require('papaparse');var Redis=require(_0xbce6('0x10'));var authService=require(_0xbce6('0x11'));var qs=require(_0xbce6('0x12'));var as=require(_0xbce6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbce6('0x14'))(_0xbce6('0x15'));var utils=require(_0xbce6('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x469395,_0x52d330){_0x52d330=_0x52d330||0xcc;return function(_0x47f64b){if(_0x47f64b){return _0x469395['sendStatus'](_0x52d330);}return _0x469395[_0xbce6('0x17')](_0x52d330)['end']();};}function respondWithResult(_0x19e6db,_0x2a9279){_0x2a9279=_0x2a9279||0xc8;return function(_0x17006c){if(_0x17006c){return _0x19e6db[_0xbce6('0x17')](_0x2a9279)[_0xbce6('0x18')](_0x17006c);}};}function respondWithFilteredResult(_0x42055b,_0x4a5a48){return function(_0x4541b8){if(_0x4541b8){var _0x5b9da1=typeof _0x4a5a48['offset']==='undefined'&&typeof _0x4a5a48['limit']===_0xbce6('0x19');var _0x5c4e24=_0x4541b8[_0xbce6('0x1a')];var _0x2bf9ea=_0x5b9da1?0x0:_0x4a5a48['offset'];var _0x2c69c9=_0x5b9da1?_0x4541b8[_0xbce6('0x1a')]:_0x4a5a48[_0xbce6('0x1b')]+_0x4a5a48['limit'];var _0x3d5835;if(_0x2c69c9>=_0x5c4e24){_0x2c69c9=_0x5c4e24;_0x3d5835=0xc8;}else{_0x3d5835=0xce;}_0x42055b[_0xbce6('0x17')](_0x3d5835);return _0x42055b[_0xbce6('0x1c')](_0xbce6('0x1d'),_0x2bf9ea+'-'+_0x2c69c9+'/'+_0x5c4e24)[_0xbce6('0x18')](_0x4541b8);}return null;};}function patchUpdates(_0x9b6115){return function(_0x7ba12f){try{jsonpatch['apply'](_0x7ba12f,_0x9b6115,!![]);}catch(_0x1c7bf5){return BPromise[_0xbce6('0x1e')](_0x1c7bf5);}return _0x7ba12f[_0xbce6('0x1f')]();};}function saveUpdates(_0x2eef0c,_0x323dbc){return function(_0xdb4463){if(_0xdb4463){return _0xdb4463['update'](_0x2eef0c)[_0xbce6('0x20')](function(_0x5bc547){return _0x5bc547;});}return null;};}function removeEntity(_0x4764ea,_0x5ceff9){return function(_0x2007dd){if(_0x2007dd){return _0x2007dd[_0xbce6('0x21')]()[_0xbce6('0x20')](function(){_0x4764ea['status'](0xcc)[_0xbce6('0x22')]();});}};}function handleEntityNotFound(_0x4a6c11,_0x2098d2){return function(_0x22a81e){if(!_0x22a81e){_0x4a6c11['sendStatus'](0x194);}return _0x22a81e;};}function handleError(_0x2152f0,_0x15483e){_0x15483e=_0x15483e||0x1f4;return function(_0x48ae24){logger[_0xbce6('0x23')](_0x48ae24[_0xbce6('0x24')]);if(_0x48ae24[_0xbce6('0x25')]){delete _0x48ae24[_0xbce6('0x25')];}_0x2152f0[_0xbce6('0x17')](_0x15483e)['send'](_0x48ae24);};}exports[_0xbce6('0x26')]=function(_0x5a13da,_0x4cef76){var _0x437f8d={},_0x4a0010={},_0xaec5ed={'count':0x0,'rows':[]};var _0x283c5b=_['map'](db[_0xbce6('0x27')][_0xbce6('0x28')],function(_0x3b4e9b){return{'name':_0x3b4e9b[_0xbce6('0x29')],'type':_0x3b4e9b[_0xbce6('0x2a')][_0xbce6('0x2b')]};});_0x4a0010[_0xbce6('0x2c')]=_[_0xbce6('0x2d')](_0x283c5b,_0xbce6('0x25'));_0x4a0010[_0xbce6('0x2e')]=_[_0xbce6('0x2f')](_0x5a13da[_0xbce6('0x2e')]);_0x4a0010['filters']=_[_0xbce6('0x30')](_0x4a0010[_0xbce6('0x2c')],_0x4a0010[_0xbce6('0x2e')]);_0x437f8d[_0xbce6('0x31')]=_[_0xbce6('0x30')](_0x4a0010[_0xbce6('0x2c')],qs[_0xbce6('0x32')](_0x5a13da[_0xbce6('0x2e')]['fields']));_0x437f8d['attributes']=_0x437f8d[_0xbce6('0x31')]['length']?_0x437f8d[_0xbce6('0x31')]:_0x4a0010[_0xbce6('0x2c')];if(!_0x5a13da[_0xbce6('0x2e')][_0xbce6('0x33')]('nolimit')){_0x437f8d['limit']=qs[_0xbce6('0x34')](_0x5a13da[_0xbce6('0x2e')][_0xbce6('0x34')]);_0x437f8d[_0xbce6('0x1b')]=qs['offset'](_0x5a13da[_0xbce6('0x2e')]['offset']);}_0x437f8d[_0xbce6('0x35')]=qs['sort'](_0x5a13da[_0xbce6('0x2e')][_0xbce6('0x36')]);_0x437f8d['where']=qs[_0xbce6('0x37')](_['pick'](_0x5a13da[_0xbce6('0x2e')],_0x4a0010['filters']),_0x283c5b);if(_0x5a13da[_0xbce6('0x2e')]['filter']){_0x437f8d['where']=_[_0xbce6('0x38')](_0x437f8d[_0xbce6('0x39')],{'$or':_[_0xbce6('0x2d')](_0x283c5b,function(_0x29db01){if(_0x29db01[_0xbce6('0x2a')]!=='VIRTUAL'){var _0x56ea3d={};_0x56ea3d[_0x29db01['name']]={'$like':'%'+_0x5a13da['query'][_0xbce6('0x3a')]+'%'};return _0x56ea3d;}})});}_0x437f8d=_[_0xbce6('0x38')]({},_0x437f8d,_0x5a13da[_0xbce6('0x3b')]);var _0x1f1a60={'where':_0x437f8d['where']};return db[_0xbce6('0x27')][_0xbce6('0x1a')](_0x1f1a60)[_0xbce6('0x20')](function(_0x19d828){_0xaec5ed[_0xbce6('0x1a')]=_0x19d828;if(_0x5a13da[_0xbce6('0x2e')]['includeAll']){_0x437f8d[_0xbce6('0x3c')]=[{'all':!![]}];}return db[_0xbce6('0x27')][_0xbce6('0x3d')](_0x437f8d);})[_0xbce6('0x20')](function(_0x26cdb4){_0xaec5ed['rows']=_0x26cdb4;return _0xaec5ed;})[_0xbce6('0x20')](respondWithFilteredResult(_0x4cef76,_0x437f8d))[_0xbce6('0x3e')](handleError(_0x4cef76,null));};exports[_0xbce6('0x3f')]=function(_0x30eb2b,_0x490dda){var _0x5e7b91={'raw':!![],'where':{'id':_0x30eb2b[_0xbce6('0x40')]['id']}},_0x149889={};_0x149889[_0xbce6('0x2c')]=_[_0xbce6('0x2f')](db[_0xbce6('0x27')][_0xbce6('0x28')]);_0x149889[_0xbce6('0x2e')]=_[_0xbce6('0x2f')](_0x30eb2b[_0xbce6('0x2e')]);_0x149889[_0xbce6('0x37')]=_['intersection'](_0x149889['model'],_0x149889[_0xbce6('0x2e')]);_0x5e7b91['attributes']=_[_0xbce6('0x30')](_0x149889[_0xbce6('0x2c')],qs[_0xbce6('0x32')](_0x30eb2b['query']['fields']));_0x5e7b91['attributes']=_0x5e7b91['attributes']['length']?_0x5e7b91[_0xbce6('0x31')]:_0x149889['model'];if(_0x30eb2b['query']['includeAll']){_0x5e7b91[_0xbce6('0x3c')]=[{'all':!![]}];}_0x5e7b91=_[_0xbce6('0x38')]({},_0x5e7b91,_0x30eb2b[_0xbce6('0x3b')]);return db[_0xbce6('0x27')][_0xbce6('0x41')](_0x5e7b91)[_0xbce6('0x20')](handleEntityNotFound(_0x490dda,null))[_0xbce6('0x20')](respondWithResult(_0x490dda,null))['catch'](handleError(_0x490dda,null));};exports[_0xbce6('0x42')]=function(_0x3dac69,_0x149516){if(_0x3dac69[_0xbce6('0x43')]['id']){delete _0x3dac69[_0xbce6('0x43')]['id'];}return db[_0xbce6('0x27')][_0xbce6('0x41')]({'where':{'id':_0x3dac69[_0xbce6('0x40')]['id']}})['then'](handleEntityNotFound(_0x149516,null))[_0xbce6('0x20')](saveUpdates(_0x3dac69[_0xbce6('0x43')],null))[_0xbce6('0x20')](respondWithResult(_0x149516,null))['catch'](handleError(_0x149516,null));};exports[_0xbce6('0x21')]=function(_0x53a3d1,_0x5c39c8){return db[_0xbce6('0x27')][_0xbce6('0x41')]({'where':{'id':_0x53a3d1['params']['id']}})[_0xbce6('0x20')](handleEntityNotFound(_0x5c39c8,null))['then'](removeEntity(_0x5c39c8,null))[_0xbce6('0x3e')](handleError(_0x5c39c8,null));};exports['describe']=function(_0x47ddb5,_0x4bb2fa){return db[_0xbce6('0x27')][_0xbce6('0x44')]()[_0xbce6('0x20')](respondWithResult(_0x4bb2fa,null))[_0xbce6('0x3e')](handleError(_0x4bb2fa,null));}; \ No newline at end of file +var _0x30cd=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','CmHopperBlack','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','show','params','rawAttributes','length','include','find','catch','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x32792d,_0x2f0aae){var _0x4e09aa=function(_0x133f75){while(--_0x133f75){_0x32792d['push'](_0x32792d['shift']());}};_0x4e09aa(++_0x2f0aae);}(_0x30cd,0x1e3));var _0xd30c=function(_0x1c4fcf,_0x5f0319){_0x1c4fcf=_0x1c4fcf-0x0;var _0x3777fc=_0x30cd[_0x1c4fcf];return _0x3777fc;};'use strict';var emlformat=require(_0xd30c('0x0'));var rimraf=require(_0xd30c('0x1'));var zipdir=require(_0xd30c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd30c('0x3'));var moment=require(_0xd30c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd30c('0x5'));var util=require(_0xd30c('0x6'));var path=require(_0xd30c('0x7'));var sox=require(_0xd30c('0x8'));var csv=require(_0xd30c('0x9'));var ejs=require(_0xd30c('0xa'));var fs=require('fs');var fs_extra=require(_0xd30c('0xb'));var _=require('lodash');var squel=require(_0xd30c('0xc'));var crypto=require(_0xd30c('0xd'));var jsforce=require(_0xd30c('0xe'));var deskjs=require(_0xd30c('0xf'));var toCsv=require(_0xd30c('0x9'));var querystring=require(_0xd30c('0x10'));var Papa=require(_0xd30c('0x11'));var Redis=require(_0xd30c('0x12'));var authService=require(_0xd30c('0x13'));var qs=require(_0xd30c('0x14'));var as=require(_0xd30c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd30c('0x16'));var utils=require(_0xd30c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd30c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x587a58,_0x10d180){_0x10d180=_0x10d180||0xcc;return function(_0x856153){if(_0x856153){return _0x587a58['sendStatus'](_0x10d180);}return _0x587a58[_0xd30c('0x19')](_0x10d180)['end']();};}function respondWithResult(_0x2d4deb,_0x5bec31){_0x5bec31=_0x5bec31||0xc8;return function(_0x2d7c20){if(_0x2d7c20){return _0x2d4deb[_0xd30c('0x19')](_0x5bec31)[_0xd30c('0x1a')](_0x2d7c20);}};}function respondWithFilteredResult(_0x2e626a,_0x146a94){return function(_0x1526c1){if(_0x1526c1){var _0x30be7d=typeof _0x146a94[_0xd30c('0x1b')]===_0xd30c('0x1c')&&typeof _0x146a94[_0xd30c('0x1d')]===_0xd30c('0x1c');var _0x2021b7=_0x1526c1['count'];var _0x1237de=_0x30be7d?0x0:_0x146a94[_0xd30c('0x1b')];var _0x329906=_0x30be7d?_0x1526c1[_0xd30c('0x1e')]:_0x146a94[_0xd30c('0x1b')]+_0x146a94[_0xd30c('0x1d')];var _0xe5d98f;if(_0x329906>=_0x2021b7){_0x329906=_0x2021b7;_0xe5d98f=0xc8;}else{_0xe5d98f=0xce;}_0x2e626a['status'](_0xe5d98f);return _0x2e626a[_0xd30c('0x1f')](_0xd30c('0x20'),_0x1237de+'-'+_0x329906+'/'+_0x2021b7)['json'](_0x1526c1);}return null;};}function patchUpdates(_0x2b7571){return function(_0x235eb3){try{jsonpatch[_0xd30c('0x21')](_0x235eb3,_0x2b7571,!![]);}catch(_0x5325a8){return BPromise[_0xd30c('0x22')](_0x5325a8);}return _0x235eb3['save']();};}function saveUpdates(_0x88ecb5,_0x1636b4){return function(_0x42b493){if(_0x42b493){return _0x42b493[_0xd30c('0x23')](_0x88ecb5)[_0xd30c('0x24')](function(_0x48aab3){return _0x48aab3;});}return null;};}function removeEntity(_0x58e3a3,_0x2d4fc4){return function(_0x1630da){if(_0x1630da){return _0x1630da['destroy']()[_0xd30c('0x24')](function(){_0x58e3a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a41b9,_0x41f010){return function(_0x3e1f51){if(!_0x3e1f51){_0x1a41b9['sendStatus'](0x194);}return _0x3e1f51;};}function handleError(_0x3119c8,_0x57d933){_0x57d933=_0x57d933||0x1f4;return function(_0x4fc802){logger[_0xd30c('0x25')](_0x4fc802[_0xd30c('0x26')]);if(_0x4fc802[_0xd30c('0x27')]){delete _0x4fc802[_0xd30c('0x27')];}_0x3119c8['status'](_0x57d933)[_0xd30c('0x28')](_0x4fc802);};}exports['index']=function(_0x48335c,_0x3ab885){var _0x100824={},_0x4f3085={},_0x5140c3={'count':0x0,'rows':[]};var _0x4c8700=_[_0xd30c('0x29')](db[_0xd30c('0x2a')]['rawAttributes'],function(_0x2d030c){return{'name':_0x2d030c[_0xd30c('0x2b')],'type':_0x2d030c[_0xd30c('0x2c')]['key']};});_0x4f3085[_0xd30c('0x2d')]=_['map'](_0x4c8700,_0xd30c('0x27'));_0x4f3085[_0xd30c('0x2e')]=_[_0xd30c('0x2f')](_0x48335c[_0xd30c('0x2e')]);_0x4f3085['filters']=_[_0xd30c('0x30')](_0x4f3085[_0xd30c('0x2d')],_0x4f3085['query']);_0x100824[_0xd30c('0x31')]=_[_0xd30c('0x30')](_0x4f3085[_0xd30c('0x2d')],qs[_0xd30c('0x32')](_0x48335c[_0xd30c('0x2e')]['fields']));_0x100824[_0xd30c('0x31')]=_0x100824[_0xd30c('0x31')]['length']?_0x100824['attributes']:_0x4f3085['model'];if(!_0x48335c[_0xd30c('0x2e')]['hasOwnProperty'](_0xd30c('0x33'))){_0x100824[_0xd30c('0x1d')]=qs[_0xd30c('0x1d')](_0x48335c[_0xd30c('0x2e')][_0xd30c('0x1d')]);_0x100824[_0xd30c('0x1b')]=qs[_0xd30c('0x1b')](_0x48335c['query'][_0xd30c('0x1b')]);}_0x100824[_0xd30c('0x34')]=qs['sort'](_0x48335c[_0xd30c('0x2e')][_0xd30c('0x35')]);_0x100824[_0xd30c('0x36')]=qs[_0xd30c('0x37')](_[_0xd30c('0x38')](_0x48335c['query'],_0x4f3085[_0xd30c('0x37')]),_0x4c8700);if(_0x48335c[_0xd30c('0x2e')][_0xd30c('0x39')]){_0x100824[_0xd30c('0x36')]=_['merge'](_0x100824[_0xd30c('0x36')],{'$or':_[_0xd30c('0x29')](_0x4c8700,function(_0x352482){if(_0x352482['type']!==_0xd30c('0x3a')){var _0x3a2d4b={};_0x3a2d4b[_0x352482[_0xd30c('0x27')]]={'$like':'%'+_0x48335c[_0xd30c('0x2e')][_0xd30c('0x39')]+'%'};return _0x3a2d4b;}})});}_0x100824=_['merge']({},_0x100824,_0x48335c[_0xd30c('0x3b')]);var _0x5c02fd={'where':_0x100824[_0xd30c('0x36')]};return db[_0xd30c('0x2a')][_0xd30c('0x1e')](_0x5c02fd)[_0xd30c('0x24')](function(_0x1599dd){_0x5140c3['count']=_0x1599dd;if(_0x48335c[_0xd30c('0x2e')][_0xd30c('0x3c')]){_0x100824['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x100824);})[_0xd30c('0x24')](function(_0xb2c67a){_0x5140c3['rows']=_0xb2c67a;return _0x5140c3;})['then'](respondWithFilteredResult(_0x3ab885,_0x100824))['catch'](handleError(_0x3ab885,null));};exports[_0xd30c('0x3d')]=function(_0x2ebbe6,_0x265b09){var _0x22b6da={'raw':!![],'where':{'id':_0x2ebbe6[_0xd30c('0x3e')]['id']}},_0x1cefa4={};_0x1cefa4['model']=_[_0xd30c('0x2f')](db[_0xd30c('0x2a')][_0xd30c('0x3f')]);_0x1cefa4[_0xd30c('0x2e')]=_[_0xd30c('0x2f')](_0x2ebbe6['query']);_0x1cefa4[_0xd30c('0x37')]=_['intersection'](_0x1cefa4[_0xd30c('0x2d')],_0x1cefa4[_0xd30c('0x2e')]);_0x22b6da[_0xd30c('0x31')]=_[_0xd30c('0x30')](_0x1cefa4[_0xd30c('0x2d')],qs[_0xd30c('0x32')](_0x2ebbe6['query']['fields']));_0x22b6da[_0xd30c('0x31')]=_0x22b6da[_0xd30c('0x31')][_0xd30c('0x40')]?_0x22b6da[_0xd30c('0x31')]:_0x1cefa4['model'];if(_0x2ebbe6[_0xd30c('0x2e')][_0xd30c('0x3c')]){_0x22b6da[_0xd30c('0x41')]=[{'all':!![]}];}_0x22b6da=_['merge']({},_0x22b6da,_0x2ebbe6[_0xd30c('0x3b')]);return db[_0xd30c('0x2a')][_0xd30c('0x42')](_0x22b6da)['then'](handleEntityNotFound(_0x265b09,null))[_0xd30c('0x24')](respondWithResult(_0x265b09,null))[_0xd30c('0x43')](handleError(_0x265b09,null));};exports[_0xd30c('0x23')]=function(_0x202b28,_0x331662){if(_0x202b28[_0xd30c('0x44')]['id']){delete _0x202b28[_0xd30c('0x44')]['id'];}return db['CmHopperBlack'][_0xd30c('0x42')]({'where':{'id':_0x202b28[_0xd30c('0x3e')]['id']}})[_0xd30c('0x24')](handleEntityNotFound(_0x331662,null))[_0xd30c('0x24')](saveUpdates(_0x202b28['body'],null))['then'](respondWithResult(_0x331662,null))[_0xd30c('0x43')](handleError(_0x331662,null));};exports[_0xd30c('0x45')]=function(_0x506503,_0x33acd9){return db['CmHopperBlack']['find']({'where':{'id':_0x506503[_0xd30c('0x3e')]['id']}})[_0xd30c('0x24')](handleEntityNotFound(_0x33acd9,null))['then'](removeEntity(_0x33acd9,null))[_0xd30c('0x43')](handleError(_0x33acd9,null));};exports[_0xd30c('0x46')]=function(_0x1f78c1,_0x51c8e0){return db[_0xd30c('0x2a')][_0xd30c('0x46')]()[_0xd30c('0x24')](respondWithResult(_0x51c8e0,null))[_0xd30c('0x43')](handleError(_0x51c8e0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 41b4450..389d997 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 _0xe522=['rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe522,0x1e6));var _0x2e52=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe522[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x2e52('0x0'));var util=require(_0x2e52('0x1'));var logger=require(_0x2e52('0x2'))(_0x2e52('0x3'));var moment=require(_0x2e52('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e52('0x5'));var rimraf=require(_0x2e52('0x6'));var config=require(_0x2e52('0x7'));var attributes=require(_0x2e52('0x8'));module['exports']=function(_0x26d726,_0x4206d9){return _0x26d726[_0x2e52('0x9')](_0x2e52('0xa'),attributes,{'tableName':_0x2e52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fb1=['../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','lodash','util','bluebird','request-promise','path'];(function(_0xa49ead,_0x6cb7c5){var _0x11d356=function(_0x4f343b){while(--_0x4f343b){_0xa49ead['push'](_0xa49ead['shift']());}};_0x11d356(++_0x6cb7c5);}(_0x1fb1,0x190));var _0x11fb=function(_0x2de580,_0x569049){_0x2de580=_0x2de580-0x0;var _0x1cc158=_0x1fb1[_0x2de580];return _0x1cc158;};'use strict';var _=require(_0x11fb('0x0'));var util=require(_0x11fb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x11fb('0x2'));var rp=require(_0x11fb('0x3'));var fs=require('fs');var path=require(_0x11fb('0x4'));var rimraf=require('rimraf');var config=require(_0x11fb('0x5'));var attributes=require(_0x11fb('0x6'));module['exports']=function(_0x9d722b,_0x37de7b){return _0x9d722b['define'](_0x11fb('0x7'),attributes,{'tableName':_0x11fb('0x8'),'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 9140388..0b38367 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 _0x0135=['UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','map','model','attributes'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x0135,0x1c5));var _0x5013=function(_0xa26d1a,_0x59bcb8){_0xa26d1a=_0xa26d1a-0x0;var _0x20eb0f=_0x0135[_0xa26d1a];return _0x20eb0f;};'use strict';var _=require(_0x5013('0x0'));var util=require(_0x5013('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5013('0x2'));var fs=require('fs');var Redis=require(_0x5013('0x3'));var db=require(_0x5013('0x4'))['db'];var utils=require(_0x5013('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5013('0x6'));var client=jayson[_0x5013('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29d78a,_0x37d010,_0x4fcdee){return new BPromise(function(_0x57cf25,_0x2f9ec2){return client['request'](_0x29d78a,_0x4fcdee)[_0x5013('0x8')](function(_0x5b76c1){logger[_0x5013('0x9')](_0x5013('0xa'),_0x37d010,_0x5013('0xb'));logger[_0x5013('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x37d010,_0x5013('0xb'),JSON[_0x5013('0xd')](_0x5b76c1));if(_0x5b76c1[_0x5013('0xe')]){if(_0x5b76c1[_0x5013('0xe')]['code']===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x37d010,_0x5b76c1[_0x5013('0xe')][_0x5013('0xf')]);return _0x2f9ec2(_0x5b76c1[_0x5013('0xe')][_0x5013('0xf')]);}logger[_0x5013('0xe')](_0x5013('0xa'),_0x37d010,_0x5b76c1['error'][_0x5013('0xf')]);return _0x57cf25(_0x5b76c1[_0x5013('0xe')]['message']);}else{logger[_0x5013('0x9')](_0x5013('0xa'),_0x37d010,_0x5013('0xb'));_0x57cf25(_0x5b76c1['result']['message']);}})[_0x5013('0x10')](function(_0x23dd18){logger[_0x5013('0xe')](_0x5013('0xa'),_0x37d010,_0x23dd18);_0x2f9ec2(_0x23dd18);});});}exports[_0x5013('0x11')]=function(_0x2f1298){var _0x3517d2=this;return new Promise(function(_0x72bac0,_0x36db5e){return db[_0x5013('0x12')][_0x5013('0x13')]({'raw':_0x2f1298[_0x5013('0x14')]?_0x2f1298[_0x5013('0x14')][_0x5013('0x15')]===undefined?!![]:![]:!![],'where':_0x2f1298[_0x5013('0x14')]?_0x2f1298['options']['where']||null:null,'attributes':_0x2f1298[_0x5013('0x14')]?_0x2f1298[_0x5013('0x14')]['attributes']||null:null,'limit':_0x2f1298[_0x5013('0x14')]?_0x2f1298[_0x5013('0x14')][_0x5013('0x16')]||null:null,'include':_0x2f1298[_0x5013('0x14')]?_0x2f1298[_0x5013('0x14')][_0x5013('0x17')]?_[_0x5013('0x18')](_0x2f1298[_0x5013('0x14')][_0x5013('0x17')],function(_0x3cb2fa){return{'model':db[_0x3cb2fa['model']],'as':_0x3cb2fa['as'],'attributes':_0x3cb2fa['attributes'],'include':_0x3cb2fa[_0x5013('0x17')]?_[_0x5013('0x18')](_0x3cb2fa[_0x5013('0x17')],function(_0x1d4508){return{'model':db[_0x1d4508[_0x5013('0x19')]],'as':_0x1d4508['as'],'attributes':_0x1d4508[_0x5013('0x1a')],'include':_0x1d4508[_0x5013('0x17')]?_[_0x5013('0x18')](_0x1d4508['include'],function(_0x388258){return{'model':db[_0x388258[_0x5013('0x19')]],'as':_0x388258['as'],'attributes':_0x388258[_0x5013('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x422b33){logger[_0x5013('0x9')](_0x5013('0x11'),_0x2f1298);logger[_0x5013('0xc')](_0x5013('0x11'),_0x2f1298,JSON[_0x5013('0xd')](_0x422b33));_0x72bac0(_0x422b33);})[_0x5013('0x10')](function(_0x5c17f3){logger[_0x5013('0xe')](_0x5013('0x11'),_0x5c17f3[_0x5013('0xf')],_0x2f1298);_0x36db5e(_0x3517d2[_0x5013('0xe')](0x1f4,_0x5c17f3['message']));});});};exports[_0x5013('0x1b')]=function(_0x3d3751){var _0x5ecd42=this;return new Promise(function(_0x5012bd,_0x74fb01){return db[_0x5013('0x12')][_0x5013('0x1c')](_0x3d3751[_0x5013('0x1d')],{'raw':_0x3d3751[_0x5013('0x14')]?_0x3d3751['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d3751[_0x5013('0x14')]?_0x3d3751[_0x5013('0x14')][_0x5013('0x1e')]||null:null,'attributes':_0x3d3751['options']?_0x3d3751[_0x5013('0x14')][_0x5013('0x1a')]||null:null,'limit':_0x3d3751[_0x5013('0x14')]?_0x3d3751[_0x5013('0x14')]['limit']||null:null})[_0x5013('0x8')](function(_0x209e42){logger[_0x5013('0x9')](_0x5013('0x1b'),_0x3d3751);logger[_0x5013('0xc')](_0x5013('0x1b'),_0x3d3751,JSON[_0x5013('0xd')](_0x209e42));_0x5012bd(_0x209e42);})[_0x5013('0x10')](function(_0x16eab4){logger[_0x5013('0xe')]('UpdateCmHopperBlack',_0x16eab4[_0x5013('0xf')],_0x3d3751);_0x74fb01(_0x5ecd42[_0x5013('0xe')](0x1f4,_0x16eab4['message']));});});};exports[_0x5013('0x1f')]=function(_0x107cd7){var _0x52125a=this;return new Promise(function(_0x3f2ba5,_0x3c1680){return db['CmHopperBlack']['destroy']({'where':_0x107cd7[_0x5013('0x14')]?_0x107cd7[_0x5013('0x14')][_0x5013('0x1e')]||null:null})[_0x5013('0x8')](function(_0x5eaf20){logger['info']('DestroyCmHopperBlack',_0x107cd7);logger[_0x5013('0xc')](_0x5013('0x1f'),_0x107cd7,JSON[_0x5013('0xd')](_0x5eaf20));_0x3f2ba5(_0x5eaf20);})['catch'](function(_0x327079){logger[_0x5013('0xe')]('DestroyCmHopperBlack',_0x327079['message'],_0x107cd7);_0x3c1680(_0x52125a[_0x5013('0xe')](0x1f4,_0x327079[_0x5013('0xf')]));});});}; \ No newline at end of file +var _0x4bf6=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CmHopperBlack,\x20%s,\x20%s','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','UpdateCmHopperBlack','CmHopperBlack','body','DestroyCmHopperBlack','lodash','util'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4bf6,0xd6));var _0x64bf=function(_0x3f173a,_0x222687){_0x3f173a=_0x3f173a-0x0;var _0x2d8559=_0x4bf6[_0x3f173a];return _0x2d8559;};'use strict';var _=require(_0x64bf('0x0'));var util=require(_0x64bf('0x1'));var moment=require(_0x64bf('0x2'));var BPromise=require(_0x64bf('0x3'));var rs=require(_0x64bf('0x4'));var fs=require('fs');var Redis=require(_0x64bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x64bf('0x6'))(_0x64bf('0x7'));var config=require('../../config/environment');var jayson=require(_0x64bf('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48e399,_0x3f038c,_0x601d0d){return new BPromise(function(_0x5dfd5e,_0x36d420){return client[_0x64bf('0x9')](_0x48e399,_0x601d0d)[_0x64bf('0xa')](function(_0x58e7f8){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x3f038c,_0x64bf('0xb'));logger[_0x64bf('0xc')](_0x64bf('0xd'),_0x3f038c,_0x64bf('0xb'),JSON[_0x64bf('0xe')](_0x58e7f8));if(_0x58e7f8[_0x64bf('0xf')]){if(_0x58e7f8[_0x64bf('0xf')][_0x64bf('0x10')]===0x1f4){logger[_0x64bf('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x3f038c,_0x58e7f8['error']['message']);return _0x36d420(_0x58e7f8[_0x64bf('0xf')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3f038c,_0x58e7f8[_0x64bf('0xf')]['message']);return _0x5dfd5e(_0x58e7f8[_0x64bf('0xf')][_0x64bf('0x11')]);}else{logger[_0x64bf('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x3f038c,_0x64bf('0xb'));_0x5dfd5e(_0x58e7f8[_0x64bf('0x13')][_0x64bf('0x11')]);}})['catch'](function(_0xe2a27d){logger[_0x64bf('0xf')](_0x64bf('0x14'),_0x3f038c,_0xe2a27d);_0x36d420(_0xe2a27d);});});}exports[_0x64bf('0x15')]=function(_0x287692){var _0x2fdf62=this;return new Promise(function(_0x575258,_0x4a6cb0){return db['CmHopperBlack'][_0x64bf('0x16')]({'raw':_0x287692[_0x64bf('0x17')]?_0x287692[_0x64bf('0x17')][_0x64bf('0x18')]===undefined?!![]:![]:!![],'where':_0x287692[_0x64bf('0x17')]?_0x287692[_0x64bf('0x17')][_0x64bf('0x19')]||null:null,'attributes':_0x287692[_0x64bf('0x17')]?_0x287692[_0x64bf('0x17')][_0x64bf('0x1a')]||null:null,'limit':_0x287692[_0x64bf('0x17')]?_0x287692[_0x64bf('0x17')][_0x64bf('0x1b')]||null:null,'include':_0x287692[_0x64bf('0x17')]?_0x287692[_0x64bf('0x17')][_0x64bf('0x1c')]?_[_0x64bf('0x1d')](_0x287692['options'][_0x64bf('0x1c')],function(_0x537e5a){return{'model':db[_0x537e5a[_0x64bf('0x1e')]],'as':_0x537e5a['as'],'attributes':_0x537e5a['attributes'],'include':_0x537e5a[_0x64bf('0x1c')]?_[_0x64bf('0x1d')](_0x537e5a['include'],function(_0x252de6){return{'model':db[_0x252de6[_0x64bf('0x1e')]],'as':_0x252de6['as'],'attributes':_0x252de6[_0x64bf('0x1a')],'include':_0x252de6[_0x64bf('0x1c')]?_[_0x64bf('0x1d')](_0x252de6[_0x64bf('0x1c')],function(_0x244d50){return{'model':db[_0x244d50['model']],'as':_0x244d50['as'],'attributes':_0x244d50[_0x64bf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x64bf('0xa')](function(_0x196f26){logger[_0x64bf('0x12')](_0x64bf('0x15'),_0x287692);logger[_0x64bf('0xc')]('GetCmHopperBlack',_0x287692,JSON['stringify'](_0x196f26));_0x575258(_0x196f26);})[_0x64bf('0x1f')](function(_0x1e033f){logger['error']('GetCmHopperBlack',_0x1e033f[_0x64bf('0x11')],_0x287692);_0x4a6cb0(_0x2fdf62[_0x64bf('0xf')](0x1f4,_0x1e033f['message']));});});};exports[_0x64bf('0x20')]=function(_0x2372b0){var _0x3d2438=this;return new Promise(function(_0x4db3ee,_0x3e3e0b){return db[_0x64bf('0x21')]['update'](_0x2372b0[_0x64bf('0x22')],{'raw':_0x2372b0[_0x64bf('0x17')]?_0x2372b0[_0x64bf('0x17')][_0x64bf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2372b0['options']?_0x2372b0[_0x64bf('0x17')][_0x64bf('0x19')]||null:null,'attributes':_0x2372b0['options']?_0x2372b0[_0x64bf('0x17')][_0x64bf('0x1a')]||null:null,'limit':_0x2372b0['options']?_0x2372b0['options'][_0x64bf('0x1b')]||null:null})['then'](function(_0x48fe53){logger['info'](_0x64bf('0x20'),_0x2372b0);logger['debug'](_0x64bf('0x20'),_0x2372b0,JSON[_0x64bf('0xe')](_0x48fe53));_0x4db3ee(_0x48fe53);})[_0x64bf('0x1f')](function(_0x241ab8){logger[_0x64bf('0xf')](_0x64bf('0x20'),_0x241ab8['message'],_0x2372b0);_0x3e3e0b(_0x3d2438['error'](0x1f4,_0x241ab8['message']));});});};exports[_0x64bf('0x23')]=function(_0x267a81){var _0x2ec653=this;return new Promise(function(_0x2b41cd,_0x6c3111){return db[_0x64bf('0x21')]['destroy']({'where':_0x267a81[_0x64bf('0x17')]?_0x267a81[_0x64bf('0x17')][_0x64bf('0x19')]||null:null})['then'](function(_0x2bde26){logger['info'](_0x64bf('0x23'),_0x267a81);logger[_0x64bf('0xc')]('DestroyCmHopperBlack',_0x267a81,JSON['stringify'](_0x2bde26));_0x2b41cd(_0x2bde26);})[_0x64bf('0x1f')](function(_0x1e69eb){logger[_0x64bf('0xf')](_0x64bf('0x23'),_0x1e69eb['message'],_0x267a81);_0x6c3111(_0x2ec653[_0x64bf('0xf')](0x1f4,_0x1e69eb[_0x64bf('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 400dc26..fb6cb84 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 _0x0f4d=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','show','/:id','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x28c2c3,_0x3ee89b){var _0x5d7efb=function(_0x953ad9){while(--_0x953ad9){_0x28c2c3['push'](_0x28c2c3['shift']());}};_0x5d7efb(++_0x3ee89b);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x4f8fc2,_0x2a696e){_0x4f8fc2=_0x4f8fc2-0x0;var _0x1d9df1=_0x0f4d[_0x4f8fc2];return _0x1d9df1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var fs_extra=require(_0xd0f4('0x2'));var auth=require(_0xd0f4('0x3'));var interaction=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var controller=require(_0xd0f4('0x6'));router[_0xd0f4('0x7')]('/',auth[_0xd0f4('0x8')](),controller['index']);router[_0xd0f4('0x7')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xa')]);router[_0xd0f4('0x7')]('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xb')]);router['put'](_0xd0f4('0xc'),auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xd')]);router['delete']('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xe')]);module[_0xd0f4('0xf')]=router; \ No newline at end of file +var _0x6d38=['exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x44b68a,_0x48205e){var _0x159615=function(_0x178a0c){while(--_0x178a0c){_0x44b68a['push'](_0x44b68a['shift']());}};_0x159615(++_0x48205e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6d38[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['put'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['update']);router['delete'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['destroy']);module[_0x86d3('0xc')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b568230..87ea81c 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 _0xc1cd=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x59d452,_0x254802){var _0x342b85=function(_0x61c821){while(--_0x61c821){_0x59d452['push'](_0x59d452['shift']());}};_0x342b85(++_0x254802);}(_0xc1cd,0xbe));var _0xdc1c=function(_0x2e0b8c,_0x3e03fe){_0x2e0b8c=_0x2e0b8c-0x0;var _0x8bb228=_0xc1cd[_0x2e0b8c];return _0x8bb228;};'use strict';var Sequelize=require(_0xdc1c('0x0'));var moment=require(_0xdc1c('0x1'));module[_0xdc1c('0x2')]={'state':{'type':Sequelize[_0xdc1c('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xdc1c('0x4')]},'scheduledat':{'type':Sequelize[_0xdc1c('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdc1c('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xdc1c('0x4')]},'originatecalleridname':{'type':Sequelize[_0xdc1c('0x4')]},'calleridnum':{'type':Sequelize[_0xdc1c('0x4')]},'calleridname':{'type':Sequelize[_0xdc1c('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xdc1c('0x5')]},'answertime':{'type':Sequelize[_0xdc1c('0x5')]},'droptime':{'type':Sequelize[_0xdc1c('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdc1c('0x4')]},'campaign':{'type':Sequelize[_0xdc1c('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xdc1c('0x4')]},'reason':{'type':Sequelize[_0xdc1c('0x4')]},'disposition':{'type':Sequelize[_0xdc1c('0x4')]},'secondDisposition':{'type':Sequelize[_0xdc1c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdc1c('0x4')]},'dispositionat':{'type':Sequelize[_0xdc1c('0x5')],'set':function(_0x5aaf7e){var _0x527e22=this[_0xdc1c('0x6')](_0xdc1c('0x7'));if(_0x527e22&&_0x5aaf7e){this[_0xdc1c('0x8')]('followuptime',moment(_0x5aaf7e)[_0xdc1c('0x9')](moment(_0x527e22),_0xdc1c('0xa')));}}},'amd':{'type':Sequelize[_0xdc1c('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xdc1c('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xdc1c('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xdc1c('0x5')]},'callback':{'type':Sequelize[_0xdc1c('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdc1c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdc1c('0x5')]},'deleted':{'type':Sequelize[_0xdc1c('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xdc1c('0x5')]},'recallme':{'type':Sequelize[_0xdc1c('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xdc1c('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdc1c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46db=['STRING','DATE','getDataValue','setDataValue','diff','seconds','BOOLEAN','sequelize','moment','INTEGER'];(function(_0x54d4d2,_0x239775){var _0x3a9f07=function(_0x515ca4){while(--_0x515ca4){_0x54d4d2['push'](_0x54d4d2['shift']());}};_0x3a9f07(++_0x239775);}(_0x46db,0x6b));var _0xb46d=function(_0x28780d,_0xaf942e){_0x28780d=_0x28780d-0x0;var _0x41e3bc=_0x46db[_0x28780d];return _0x41e3bc;};'use strict';var Sequelize=require(_0xb46d('0x0'));var moment=require(_0xb46d('0x1'));module['exports']={'state':{'type':Sequelize[_0xb46d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb46d('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb46d('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb46d('0x3')]},'calleridname':{'type':Sequelize[_0xb46d('0x3')]},'starttime':{'type':Sequelize[_0xb46d('0x4')]},'responsetime':{'type':Sequelize[_0xb46d('0x4')]},'answertime':{'type':Sequelize[_0xb46d('0x4')]},'droptime':{'type':Sequelize[_0xb46d('0x4')]},'endtime':{'type':Sequelize[_0xb46d('0x4')]},'ringtime':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb46d('0x3')]},'campaigntype':{'type':Sequelize[_0xb46d('0x3')]},'membername':{'type':Sequelize[_0xb46d('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb46d('0x3')]},'secondDisposition':{'type':Sequelize[_0xb46d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb46d('0x3')]},'dispositionat':{'type':Sequelize[_0xb46d('0x4')],'set':function(_0x499703){var _0x4cd702=this[_0xb46d('0x5')]('endtime');if(_0x4cd702&&_0x499703){this[_0xb46d('0x6')]('followuptime',moment(_0x499703)[_0xb46d('0x7')](moment(_0x4cd702),_0xb46d('0x8')));}}},'amd':{'type':Sequelize[_0xb46d('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb46d('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb46d('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb46d('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb46d('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb46d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb46d('0x4')]},'deleted':{'type':Sequelize[_0xb46d('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb46d('0x4')]},'recallme':{'type':Sequelize[_0xb46d('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb46d('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb46d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb46d('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 2a3f8e0..4eeebcf 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 _0x187d=['state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','toString'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x187d,0x93));var _0xd187=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x187d[_0x25bea7];return _0x175952;};'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'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':!![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')]()[_0xd187('0x3f')](respondWithResult(_0x3f5def,null))['catch'](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x2657be,_0x4523c8){if(_0x2657be[_0xd187('0x48')][_0xd187('0x49')]){delete _0x2657be['body'][_0xd187('0x49')];}return db[_0xd187('0x2d')]['find']({'where':{'uniqueid':_0x2657be[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x4523c8,null))['then'](saveUpdates(_0x2657be['body'],null))['then'](respondWithResult(_0x4523c8,null))['catch'](handleError(_0x4523c8,null));};exports[_0xd187('0x4a')]=function(_0x22f432,_0x12d448,_0x1bcc3a){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x22f432[_0xd187('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd187('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x4f')))),_0xd187('0x50')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x52')))),'congestionContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd187('0x53')],[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd187('0x56')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x12d448,null))[_0xd187('0x3f')](respondWithResult(_0x12d448,null))[_0xd187('0x41')](handleError(_0x12d448,null));};exports[_0xd187('0x59')]=function(_0x23271b,_0x288a04,_0x39934c){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'CampaignId':_0x23271b[_0xd187('0x43')]['id']},'attributes':[[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x5a')))),_0xd187('0x4e')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x52')))),_0xd187('0x5b')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xd187('0x5c')))),_0xd187('0x53')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x5d')))),'reCallContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x288a04,null))['then'](respondWithResult(_0x288a04,null))[_0xd187('0x41')](handleError(_0x288a04,null));};exports[_0xd187('0x5e')]=function(_0x52e364,_0x569959,_0x3bca83){return db['VoiceQueue'][_0xd187('0x46')]({'where':{'id':_0x52e364[_0xd187('0x43')]['id']}})['then'](handleEntityNotFound(_0x569959,null))[_0xd187('0x3f')](function(_0x570c1c){var _0x317bc3;if(_0x570c1c){_0x317bc3=squel['insert']()['into']('cm_hopper')[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x64'),_0xd187('0x65'),_0xd187('0x66')],squel['select']()[_0xd187('0x67')](_0xd187('0x68'),_0xd187('0x60'))['field'](_0xd187('0x69'),_0xd187('0x61'))[_0xd187('0x67')](_0xd187('0x6a'),'ContactId')[_0xd187('0x67')](_0xd187('0x6b'),'ListId')[_0xd187('0x67')](_0xd187('0x6c'),_0xd187('0x64'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')]('NOW()',_0xd187('0x66'))['from']('cm_hopper_final')['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x6f'),_0x52e364[_0xd187('0x48')]['state'][_0xd187('0x6e')]())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x60'))[_0xd187('0x72')](_0xd187('0x73'))['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x74'))[_0xd187('0x72')](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x6d'),_0x52e364['params']['id']['toString']())[_0xd187('0x39')](_0xd187('0x76')))[_0xd187('0x77')](_0xd187('0x62')))[_0xd187('0x6e')]();return db[_0xd187('0x4c')]['query'](_0x317bc3);}return[];})[_0xd187('0x3f')](respondWithResult(_0x569959,null))['catch'](handleError(_0x569959,null));};exports[_0xd187('0x78')]=function(_0x520f86,_0x5cbfa6,_0x304117){return db['Campaign'][_0xd187('0x46')]({'where':{'id':_0x520f86[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x5cbfa6,null))[_0xd187('0x3f')](function(_0x1b93db){var _0x13a362;if(_0x1b93db){_0x13a362=squel[_0xd187('0x79')]()[_0xd187('0x7a')](_0xd187('0x73'))[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x7b'),'createdAt',_0xd187('0x66')],squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x68'),'phone')[_0xd187('0x67')](_0xd187('0x69'),'scheduledAt')['field'](_0xd187('0x6a'),_0xd187('0x62'))[_0xd187('0x67')](_0xd187('0x6b'),_0xd187('0x63'))[_0xd187('0x67')]('ANY_VALUE(CampaignId)',_0xd187('0x7b'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')](_0xd187('0x69'),_0xd187('0x66'))['from']('cm_hopper_final')[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id']['toString']())[_0xd187('0x39')](_0xd187('0x6f'),_0x520f86[_0xd187('0x48')][_0xd187('0x7d')]['toString']())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')['from'](_0xd187('0x73'))[_0xd187('0x39')]('CampaignId\x20=\x20?',_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()['field'](_0xd187('0x74'))['from'](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x76')))['group'](_0xd187('0x62')))[_0xd187('0x6e')]();return db['sequelize'][_0xd187('0x31')](_0x13a362);}return[];})[_0xd187('0x3f')](respondWithResult(_0x5cbfa6,null))['catch'](handleError(_0x5cbfa6,null));};exports[_0xd187('0x7e')]=function(_0x3bd1d8,_0x224312,_0x45b522){return db[_0xd187('0x7f')][_0xd187('0x80')]({'where':{'VoiceQueueId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x64')],'CampaignId':_0x3bd1d8['body'][_0xd187('0x7b')],'ContactId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x62')]}})[_0xd187('0x3f')](handleEntityNotFound(_0x224312,null))[_0xd187('0x3f')](function(_0x400a9){if(_0x400a9){return _0x400a9;}return null;})['then'](respondWithResult(_0x224312,null))['catch'](handleError(_0x224312,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(_0x2a8dbe,_0x1cf0bd){var _0x31ce92=function(_0x2c3d64){while(--_0x2c3d64){_0x2a8dbe['push'](_0x2a8dbe['shift']());}};_0x31ce92(++_0x1cf0bd);}(_0x2675,0x75));var _0x5267=function(_0x50d2ce,_0x1dcee4){_0x50d2ce=_0x50d2ce-0x0;var _0x2e1b69=_0x2675[_0x50d2ce];return _0x2e1b69;};'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 070586d..09677c3 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 _0xccf1=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xccf1,0xc2));var _0x1ccf=function(_0x4b88f8,_0x20ae18){_0x4b88f8=_0x4b88f8-0x0;var _0x15ecc5=_0xccf1[_0x4b88f8];return _0x15ecc5;};'use strict';var _=require(_0x1ccf('0x0'));var util=require('util');var logger=require(_0x1ccf('0x1'))('api');var moment=require(_0x1ccf('0x2'));var BPromise=require(_0x1ccf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ccf('0x4'));var rimraf=require(_0x1ccf('0x5'));var config=require(_0x1ccf('0x6'));var attributes=require(_0x1ccf('0x7'));module[_0x1ccf('0x8')]=function(_0x2130de,_0x4b6cbb){return _0x2130de[_0x1ccf('0x9')]('CmHopperFinal',attributes,{'tableName':_0x1ccf('0xa'),'paranoid':![],'indexes':[{'name':_0x1ccf('0xb'),'fields':[_0x1ccf('0xb')]},{'name':_0x1ccf('0xc'),'fields':[_0x1ccf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaee3=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3fd275,_0xf0cd7){var _0xe4f14f=function(_0x23971d){while(--_0x23971d){_0x3fd275['push'](_0x3fd275['shift']());}};_0xe4f14f(++_0xf0cd7);}(_0xaee3,0x190));var _0x3aee=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0xaee3[_0xdd82b4];return _0x549bb2;};'use strict';var _=require('lodash');var util=require(_0x3aee('0x0'));var logger=require(_0x3aee('0x1'))(_0x3aee('0x2'));var moment=require(_0x3aee('0x3'));var BPromise=require(_0x3aee('0x4'));var rp=require(_0x3aee('0x5'));var fs=require('fs');var path=require(_0x3aee('0x6'));var rimraf=require(_0x3aee('0x7'));var config=require(_0x3aee('0x8'));var attributes=require(_0x3aee('0x9'));module[_0x3aee('0xa')]=function(_0x101df5,_0x474374){return _0x101df5['define']('CmHopperFinal',attributes,{'tableName':_0x3aee('0xb'),'paranoid':![],'indexes':[{'name':_0x3aee('0xc'),'fields':[_0x3aee('0xc')]},{'name':_0x3aee('0xd'),'fields':[_0x3aee('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 6360e99..f93e93b 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2899cc,_0x332aec){var _0x3423ea=function(_0x3187f8){while(--_0x3187f8){_0x2899cc['push'](_0x2899cc['shift']());}};_0x3423ea(++_0x332aec);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fe35d,_0x21fee1){_0x4fe35d=_0x4fe35d-0x0;var _0x5bb28e=_0xb10b[_0x4fe35d];return _0x5bb28e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x17cd1a,_0x514190){var _0x480fc8=function(_0x55ae4e){while(--_0x55ae4e){_0x17cd1a['push'](_0x17cd1a['shift']());}};_0x480fc8(++_0x514190);}(_0x7a54,0x106));var _0x47a5=function(_0x418c87,_0x27ec5b){_0x418c87=_0x418c87-0x0;var _0x54eba6=_0x7a54[_0x418c87];return _0x54eba6;};'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 1869ba7..39eb7d1 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 _0x6e0c=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post'];(function(_0x40a4c2,_0x5a72c6){var _0x4d0d44=function(_0xf66afe){while(--_0xf66afe){_0x40a4c2['push'](_0x40a4c2['shift']());}};_0x4d0d44(++_0x5a72c6);}(_0x6e0c,0x1a6));var _0xc6e0=function(_0x40cc74,_0x37e2ce){_0x40cc74=_0x40cc74-0x0;var _0x50610e=_0x6e0c[_0x40cc74];return _0x50610e;};'use strict';var multer=require(_0xc6e0('0x0'));var util=require(_0xc6e0('0x1'));var path=require(_0xc6e0('0x2'));var timeout=require(_0xc6e0('0x3'));var express=require(_0xc6e0('0x4'));var router=express['Router']();var fs_extra=require(_0xc6e0('0x5'));var auth=require(_0xc6e0('0x6'));var interaction=require(_0xc6e0('0x7'));var config=require(_0xc6e0('0x8'));var controller=require(_0xc6e0('0x9'));router[_0xc6e0('0xa')]('/',auth[_0xc6e0('0xb')](),controller['index']);router['get'](_0xc6e0('0xc'),auth[_0xc6e0('0xb')](),controller['describe']);router[_0xc6e0('0xa')](_0xc6e0('0xd'),auth[_0xc6e0('0xb')](),controller[_0xc6e0('0xe')]);router[_0xc6e0('0xa')](_0xc6e0('0xf'),auth[_0xc6e0('0xb')](),controller[_0xc6e0('0x10')]);router['get']('/campaign/countAttributes/:id',auth[_0xc6e0('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xc6e0('0x11')]('/voice/queue/moveContacts/:id',auth[_0xc6e0('0xb')](),controller[_0xc6e0('0x12')]);router[_0xc6e0('0x11')](_0xc6e0('0x13'),auth[_0xc6e0('0xb')](),controller[_0xc6e0('0x14')]);router[_0xc6e0('0x11')]('/checkContactHopper',auth[_0xc6e0('0xb')](),controller['checkContactHopper']);router[_0xc6e0('0x15')]('/:id',auth[_0xc6e0('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xd592=['get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','put','update','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x5d5c06,_0x5e97f6){var _0x2ccc0d=function(_0x5e1db9){while(--_0x5e1db9){_0x5d5c06['push'](_0x5d5c06['shift']());}};_0x2ccc0d(++_0x5e97f6);}(_0xd592,0x1ec));var _0x2d59=function(_0x358051,_0x15e552){_0x358051=_0x358051-0x0;var _0x36c56b=_0xd592[_0x358051];return _0x36c56b;};'use strict';var multer=require(_0x2d59('0x0'));var util=require(_0x2d59('0x1'));var path=require(_0x2d59('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2d59('0x3')]();var fs_extra=require(_0x2d59('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2d59('0x5'));var config=require(_0x2d59('0x6'));var controller=require(_0x2d59('0x7'));router[_0x2d59('0x8')]('/',auth[_0x2d59('0x9')](),controller[_0x2d59('0xa')]);router[_0x2d59('0x8')](_0x2d59('0xb'),auth[_0x2d59('0x9')](),controller[_0x2d59('0xc')]);router['get'](_0x2d59('0xd'),auth[_0x2d59('0x9')](),controller[_0x2d59('0xe')]);router[_0x2d59('0x8')](_0x2d59('0xf'),auth[_0x2d59('0x9')](),controller[_0x2d59('0x10')]);router[_0x2d59('0x8')](_0x2d59('0x11'),auth[_0x2d59('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth[_0x2d59('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x2d59('0x12'),auth['isAuthenticated'](),controller[_0x2d59('0x13')]);router[_0x2d59('0x14')](_0x2d59('0x15'),auth[_0x2d59('0x9')](),controller['checkContactHopper']);router[_0x2d59('0x16')](_0x2d59('0xd'),auth[_0x2d59('0x9')](),controller[_0x2d59('0x17')]);module[_0x2d59('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 694b10f..c7ee8af 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 _0x2706=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x2706,0x107));var _0x6270=function(_0x58bc91,_0x29f7a5){_0x58bc91=_0x58bc91-0x0;var _0x2f0b72=_0x2706[_0x58bc91];return _0x2f0b72;};'use strict';var Sequelize=require('sequelize');module[_0x6270('0x0')]={'state':{'type':Sequelize[_0x6270('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6270('0x2')]},'scheduledat':{'type':Sequelize[_0x6270('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6270('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6270('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6270('0x2')]},'calleridnum':{'type':Sequelize[_0x6270('0x2')]},'calleridname':{'type':Sequelize[_0x6270('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6270('0x3')]},'answertime':{'type':Sequelize[_0x6270('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6270('0x3')]},'ringtime':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6270('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6270('0x2')]},'membername':{'type':Sequelize[_0x6270('0x2')]},'reason':{'type':Sequelize[_0x6270('0x2')]},'amd':{'type':Sequelize[_0x6270('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6270('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6270('0x3')]},'recallme':{'type':Sequelize[_0x6270('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6270('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcac3=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x8db5d8,_0x289e68){var _0x3490ec=function(_0x5dd98b){while(--_0x5dd98b){_0x8db5d8['push'](_0x8db5d8['shift']());}};_0x3490ec(++_0x289e68);}(_0xcac3,0x193));var _0x3cac=function(_0x527bdf,_0x20bd3a){_0x527bdf=_0x527bdf-0x0;var _0x33abdf=_0xcac3[_0x527bdf];return _0x33abdf;};'use strict';var Sequelize=require('sequelize');module[_0x3cac('0x0')]={'state':{'type':Sequelize[_0x3cac('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x3cac('0x2')]},'scheduledat':{'type':Sequelize[_0x3cac('0x3')]},'countbusyretry':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3cac('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x3cac('0x2')]},'originatecalleridname':{'type':Sequelize[_0x3cac('0x2')]},'calleridnum':{'type':Sequelize[_0x3cac('0x2')]},'calleridname':{'type':Sequelize[_0x3cac('0x2')]},'starttime':{'type':Sequelize[_0x3cac('0x3')]},'responsetime':{'type':Sequelize[_0x3cac('0x3')]},'answertime':{'type':Sequelize[_0x3cac('0x3')]},'droptime':{'type':Sequelize[_0x3cac('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3cac('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3cac('0x2')]},'membername':{'type':Sequelize[_0x3cac('0x2')]},'reason':{'type':Sequelize[_0x3cac('0x2')]},'amd':{'type':Sequelize[_0x3cac('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3cac('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3cac('0x3')]},'recallme':{'type':Sequelize[_0x3cac('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3cac('0x3')]},'edited':{'type':Sequelize[_0x3cac('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3cac('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3cac('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 7be7d4a..3fdc7ac 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 _0xe4bb=['query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','includeAll','create','uniqueid','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','stack','send','CmHopperHistory','rawAttributes','type','key','model','map','name'];(function(_0x14e1c5,_0x159ee4){var _0x1e94d1=function(_0x197644){while(--_0x197644){_0x14e1c5['push'](_0x14e1c5['shift']());}};_0x1e94d1(++_0x159ee4);}(_0xe4bb,0xb0));var _0xbe4b=function(_0x56c199,_0x48b5f4){_0x56c199=_0x56c199-0x0;var _0x46c7a8=_0xe4bb[_0x56c199];return _0x46c7a8;};'use strict';var emlformat=require(_0xbe4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe4b('0x1'));var jsonpatch=require(_0xbe4b('0x2'));var rp=require(_0xbe4b('0x3'));var moment=require(_0xbe4b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe4b('0x5'));var util=require(_0xbe4b('0x6'));var path=require(_0xbe4b('0x7'));var sox=require(_0xbe4b('0x8'));var csv=require(_0xbe4b('0x9'));var ejs=require(_0xbe4b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe4b('0xb'));var squel=require(_0xbe4b('0xc'));var crypto=require(_0xbe4b('0xd'));var jsforce=require(_0xbe4b('0xe'));var deskjs=require(_0xbe4b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbe4b('0x10'));var Papa=require(_0xbe4b('0x11'));var Redis=require(_0xbe4b('0x12'));var authService=require(_0xbe4b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbe4b('0x14'));var hardwareService=require(_0xbe4b('0x15'));var logger=require('../../config/logger')(_0xbe4b('0x16'));var utils=require(_0xbe4b('0x17'));var config=require(_0xbe4b('0x18'));var licenseUtil=require(_0xbe4b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ec21a,_0x160b2a){_0x160b2a=_0x160b2a||0xcc;return function(_0x38bc1e){if(_0x38bc1e){return _0x5ec21a[_0xbe4b('0x1a')](_0x160b2a);}return _0x5ec21a[_0xbe4b('0x1b')](_0x160b2a)[_0xbe4b('0x1c')]();};}function respondWithResult(_0x24be72,_0x398af2){_0x398af2=_0x398af2||0xc8;return function(_0x2b7c54){if(_0x2b7c54){return _0x24be72[_0xbe4b('0x1b')](_0x398af2)['json'](_0x2b7c54);}};}function respondWithFilteredResult(_0x52e99a,_0x39ca12){return function(_0x4e30ff){if(_0x4e30ff){var _0x502dc0=typeof _0x39ca12['offset']===_0xbe4b('0x1d')&&typeof _0x39ca12[_0xbe4b('0x1e')]===_0xbe4b('0x1d');var _0xa8458f=_0x4e30ff[_0xbe4b('0x1f')];var _0x33552e=_0x502dc0?0x0:_0x39ca12[_0xbe4b('0x20')];var _0x5a427c=_0x502dc0?_0x4e30ff[_0xbe4b('0x1f')]:_0x39ca12['offset']+_0x39ca12['limit'];var _0xa994d2;if(_0x5a427c>=_0xa8458f){_0x5a427c=_0xa8458f;_0xa994d2=0xc8;}else{_0xa994d2=0xce;}_0x52e99a[_0xbe4b('0x1b')](_0xa994d2);return _0x52e99a['set'](_0xbe4b('0x21'),_0x33552e+'-'+_0x5a427c+'/'+_0xa8458f)['json'](_0x4e30ff);}return null;};}function patchUpdates(_0x41f246){return function(_0x43f83e){try{jsonpatch[_0xbe4b('0x22')](_0x43f83e,_0x41f246,!![]);}catch(_0x4583c7){return BPromise[_0xbe4b('0x23')](_0x4583c7);}return _0x43f83e[_0xbe4b('0x24')]();};}function saveUpdates(_0x31b3ad,_0x49ace3){return function(_0x13a674){if(_0x13a674){return _0x13a674[_0xbe4b('0x25')](_0x31b3ad)['then'](function(_0x1ad163){return _0x1ad163;});}return null;};}function removeEntity(_0x231b6f,_0x522c16){return function(_0x48613e){if(_0x48613e){return _0x48613e[_0xbe4b('0x26')]()[_0xbe4b('0x27')](function(){_0x231b6f['status'](0xcc)[_0xbe4b('0x1c')]();});}};}function handleEntityNotFound(_0x103eb3,_0x50d6e4){return function(_0x4625ea){if(!_0x4625ea){_0x103eb3[_0xbe4b('0x1a')](0x194);}return _0x4625ea;};}function handleError(_0x126b7e,_0x183a3b){_0x183a3b=_0x183a3b||0x1f4;return function(_0x530ac4){logger['error'](_0x530ac4[_0xbe4b('0x28')]);if(_0x530ac4['name']){delete _0x530ac4['name'];}_0x126b7e[_0xbe4b('0x1b')](_0x183a3b)[_0xbe4b('0x29')](_0x530ac4);};}exports['index']=function(_0x11b11b,_0x2bcdaa){var _0x1bd835={},_0x7b68b0={},_0x12b7fd={'count':0x0,'rows':[]};var _0xa80b9a=_['map'](db[_0xbe4b('0x2a')][_0xbe4b('0x2b')],function(_0x31095d){return{'name':_0x31095d['fieldName'],'type':_0x31095d[_0xbe4b('0x2c')][_0xbe4b('0x2d')]};});_0x7b68b0[_0xbe4b('0x2e')]=_[_0xbe4b('0x2f')](_0xa80b9a,_0xbe4b('0x30'));_0x7b68b0[_0xbe4b('0x31')]=_['keys'](_0x11b11b[_0xbe4b('0x31')]);_0x7b68b0[_0xbe4b('0x32')]=_['intersection'](_0x7b68b0[_0xbe4b('0x2e')],_0x7b68b0[_0xbe4b('0x31')]);_0x1bd835[_0xbe4b('0x33')]=_[_0xbe4b('0x34')](_0x7b68b0['model'],qs[_0xbe4b('0x35')](_0x11b11b[_0xbe4b('0x31')][_0xbe4b('0x35')]));_0x1bd835[_0xbe4b('0x33')]=_0x1bd835[_0xbe4b('0x33')][_0xbe4b('0x36')]?_0x1bd835[_0xbe4b('0x33')]:_0x7b68b0['model'];if(!_0x11b11b[_0xbe4b('0x31')][_0xbe4b('0x37')](_0xbe4b('0x38'))){_0x1bd835[_0xbe4b('0x1e')]=qs[_0xbe4b('0x1e')](_0x11b11b[_0xbe4b('0x31')][_0xbe4b('0x1e')]);_0x1bd835['offset']=qs[_0xbe4b('0x20')](_0x11b11b['query'][_0xbe4b('0x20')]);}_0x1bd835[_0xbe4b('0x39')]=qs[_0xbe4b('0x3a')](_0x11b11b[_0xbe4b('0x31')][_0xbe4b('0x3a')]);_0x1bd835[_0xbe4b('0x3b')]=qs['filters'](_[_0xbe4b('0x3c')](_0x11b11b[_0xbe4b('0x31')],_0x7b68b0[_0xbe4b('0x32')]),_0xa80b9a);if(_0x11b11b[_0xbe4b('0x31')]['filter']){_0x1bd835[_0xbe4b('0x3b')]=_[_0xbe4b('0x3d')](_0x1bd835[_0xbe4b('0x3b')],{'$or':_[_0xbe4b('0x2f')](_0xa80b9a,function(_0x2606f0){if(_0x2606f0[_0xbe4b('0x2c')]!==_0xbe4b('0x3e')){var _0x5bd484={};_0x5bd484[_0x2606f0[_0xbe4b('0x30')]]={'$like':'%'+_0x11b11b[_0xbe4b('0x31')][_0xbe4b('0x3f')]+'%'};return _0x5bd484;}})});}_0x1bd835=_[_0xbe4b('0x3d')]({},_0x1bd835,_0x11b11b[_0xbe4b('0x40')]);var _0x3083eb={'where':_0x1bd835[_0xbe4b('0x3b')]};return db[_0xbe4b('0x2a')]['count'](_0x3083eb)[_0xbe4b('0x27')](function(_0x682ba7){_0x12b7fd[_0xbe4b('0x1f')]=_0x682ba7;if(_0x11b11b[_0xbe4b('0x31')]['includeAll']){_0x1bd835[_0xbe4b('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xbe4b('0x42')](_0x1bd835);})[_0xbe4b('0x27')](function(_0x832443){_0x12b7fd[_0xbe4b('0x43')]=_0x832443;return _0x12b7fd;})[_0xbe4b('0x27')](respondWithFilteredResult(_0x2bcdaa,_0x1bd835))[_0xbe4b('0x44')](handleError(_0x2bcdaa,null));};exports['show']=function(_0x5416f1,_0x19fbb1){var _0x5f3a1c={'raw':!![],'where':{'id':_0x5416f1[_0xbe4b('0x45')]['id']}},_0x3e184e={};_0x3e184e[_0xbe4b('0x2e')]=_['keys'](db[_0xbe4b('0x2a')][_0xbe4b('0x2b')]);_0x3e184e[_0xbe4b('0x31')]=_['keys'](_0x5416f1[_0xbe4b('0x31')]);_0x3e184e['filters']=_['intersection'](_0x3e184e[_0xbe4b('0x2e')],_0x3e184e['query']);_0x5f3a1c[_0xbe4b('0x33')]=_[_0xbe4b('0x34')](_0x3e184e[_0xbe4b('0x2e')],qs[_0xbe4b('0x35')](_0x5416f1[_0xbe4b('0x31')][_0xbe4b('0x35')]));_0x5f3a1c[_0xbe4b('0x33')]=_0x5f3a1c[_0xbe4b('0x33')][_0xbe4b('0x36')]?_0x5f3a1c[_0xbe4b('0x33')]:_0x3e184e[_0xbe4b('0x2e')];if(_0x5416f1[_0xbe4b('0x31')][_0xbe4b('0x46')]){_0x5f3a1c[_0xbe4b('0x41')]=[{'all':!![]}];}_0x5f3a1c=_[_0xbe4b('0x3d')]({},_0x5f3a1c,_0x5416f1[_0xbe4b('0x40')]);return db[_0xbe4b('0x2a')]['find'](_0x5f3a1c)[_0xbe4b('0x27')](handleEntityNotFound(_0x19fbb1,null))[_0xbe4b('0x27')](respondWithResult(_0x19fbb1,null))[_0xbe4b('0x44')](handleError(_0x19fbb1,null));};exports[_0xbe4b('0x47')]=function(_0xdedc63,_0xc37b72){return db['CmHopperHistory']['create'](_0xdedc63['body'],{})[_0xbe4b('0x27')](respondWithResult(_0xc37b72,0xc9))[_0xbe4b('0x44')](handleError(_0xc37b72,null));};exports['describe']=function(_0x41aef4,_0x438163){return db[_0xbe4b('0x2a')]['describe']()[_0xbe4b('0x27')](respondWithResult(_0x438163,null))['catch'](handleError(_0x438163,null));};exports[_0xbe4b('0x25')]=function(_0x1c4dbe,_0x3846e5){if(_0x1c4dbe['body'][_0xbe4b('0x48')]){delete _0x1c4dbe[_0xbe4b('0x49')]['uniqueid'];}return db['CmHopperHistory'][_0xbe4b('0x4a')]({'where':{'uniqueid':_0x1c4dbe[_0xbe4b('0x45')]['id']}})['then'](handleEntityNotFound(_0x3846e5,null))['then'](saveUpdates(_0x1c4dbe[_0xbe4b('0x49')],null))[_0xbe4b('0x27')](respondWithResult(_0x3846e5,null))[_0xbe4b('0x44')](handleError(_0x3846e5,null));}; \ No newline at end of file +var _0x16cc=['save','update','then','error','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','uniqueid','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x27d6c5,_0x4c0e92){var _0x51fba6=function(_0xc58e1a){while(--_0xc58e1a){_0x27d6c5['push'](_0x27d6c5['shift']());}};_0x51fba6(++_0x4c0e92);}(_0x16cc,0xb5));var _0xc16c=function(_0x4f8ad6,_0x25fbb2){_0x4f8ad6=_0x4f8ad6-0x0;var _0x55561e=_0x16cc[_0x4f8ad6];return _0x55561e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc16c('0x0'));var jsonpatch=require(_0xc16c('0x1'));var rp=require('request-promise');var moment=require(_0xc16c('0x2'));var BPromise=require(_0xc16c('0x3'));var Mustache=require(_0xc16c('0x4'));var util=require(_0xc16c('0x5'));var path=require(_0xc16c('0x6'));var sox=require(_0xc16c('0x7'));var csv=require(_0xc16c('0x8'));var ejs=require(_0xc16c('0x9'));var fs=require('fs');var fs_extra=require(_0xc16c('0xa'));var _=require(_0xc16c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc16c('0xc'));var deskjs=require(_0xc16c('0xd'));var toCsv=require(_0xc16c('0x8'));var querystring=require('querystring');var Papa=require(_0xc16c('0xe'));var Redis=require(_0xc16c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc16c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc16c('0x11'));var logger=require(_0xc16c('0x12'))(_0xc16c('0x13'));var utils=require(_0xc16c('0x14'));var config=require(_0xc16c('0x15'));var licenseUtil=require(_0xc16c('0x16'));var db=require(_0xc16c('0x17'))['db'];function respondWithStatusCode(_0x59f30f,_0x20b9ba){_0x20b9ba=_0x20b9ba||0xcc;return function(_0x372648){if(_0x372648){return _0x59f30f[_0xc16c('0x18')](_0x20b9ba);}return _0x59f30f[_0xc16c('0x19')](_0x20b9ba)[_0xc16c('0x1a')]();};}function respondWithResult(_0x40ea97,_0x43be21){_0x43be21=_0x43be21||0xc8;return function(_0x1efc95){if(_0x1efc95){return _0x40ea97[_0xc16c('0x19')](_0x43be21)[_0xc16c('0x1b')](_0x1efc95);}};}function respondWithFilteredResult(_0x115840,_0x429268){return function(_0x2333c5){if(_0x2333c5){var _0x46d10f=typeof _0x429268[_0xc16c('0x1c')]===_0xc16c('0x1d')&&typeof _0x429268[_0xc16c('0x1e')]===_0xc16c('0x1d');var _0x503444=_0x2333c5['count'];var _0x48b9ac=_0x46d10f?0x0:_0x429268[_0xc16c('0x1c')];var _0x2df6f8=_0x46d10f?_0x2333c5[_0xc16c('0x1f')]:_0x429268[_0xc16c('0x1c')]+_0x429268[_0xc16c('0x1e')];var _0x703ab2;if(_0x2df6f8>=_0x503444){_0x2df6f8=_0x503444;_0x703ab2=0xc8;}else{_0x703ab2=0xce;}_0x115840[_0xc16c('0x19')](_0x703ab2);return _0x115840['set'](_0xc16c('0x20'),_0x48b9ac+'-'+_0x2df6f8+'/'+_0x503444)['json'](_0x2333c5);}return null;};}function patchUpdates(_0x2c8a65){return function(_0x320a15){try{jsonpatch[_0xc16c('0x21')](_0x320a15,_0x2c8a65,!![]);}catch(_0x1b6a75){return BPromise[_0xc16c('0x22')](_0x1b6a75);}return _0x320a15[_0xc16c('0x23')]();};}function saveUpdates(_0x1adac0,_0x44b26a){return function(_0x104b9c){if(_0x104b9c){return _0x104b9c[_0xc16c('0x24')](_0x1adac0)[_0xc16c('0x25')](function(_0x4c9975){return _0x4c9975;});}return null;};}function removeEntity(_0x17d299,_0x127594){return function(_0x26338e){if(_0x26338e){return _0x26338e['destroy']()['then'](function(){_0x17d299['status'](0xcc)[_0xc16c('0x1a')]();});}};}function handleEntityNotFound(_0x16ccd7,_0x5f355f){return function(_0x30156d){if(!_0x30156d){_0x16ccd7[_0xc16c('0x18')](0x194);}return _0x30156d;};}function handleError(_0x33d104,_0x58962b){_0x58962b=_0x58962b||0x1f4;return function(_0x36d2d3){logger[_0xc16c('0x26')](_0x36d2d3['stack']);if(_0x36d2d3['name']){delete _0x36d2d3[_0xc16c('0x27')];}_0x33d104['status'](_0x58962b)['send'](_0x36d2d3);};}exports[_0xc16c('0x28')]=function(_0x49582c,_0x50fc24){var _0x6f56f1={},_0x590ad1={},_0x54c3c0={'count':0x0,'rows':[]};var _0x31bbe7=_[_0xc16c('0x29')](db[_0xc16c('0x2a')][_0xc16c('0x2b')],function(_0x469c25){return{'name':_0x469c25[_0xc16c('0x2c')],'type':_0x469c25[_0xc16c('0x2d')][_0xc16c('0x2e')]};});_0x590ad1['model']=_[_0xc16c('0x29')](_0x31bbe7,_0xc16c('0x27'));_0x590ad1['query']=_[_0xc16c('0x2f')](_0x49582c[_0xc16c('0x30')]);_0x590ad1[_0xc16c('0x31')]=_[_0xc16c('0x32')](_0x590ad1[_0xc16c('0x33')],_0x590ad1['query']);_0x6f56f1[_0xc16c('0x34')]=_[_0xc16c('0x32')](_0x590ad1[_0xc16c('0x33')],qs[_0xc16c('0x35')](_0x49582c[_0xc16c('0x30')]['fields']));_0x6f56f1[_0xc16c('0x34')]=_0x6f56f1[_0xc16c('0x34')][_0xc16c('0x36')]?_0x6f56f1[_0xc16c('0x34')]:_0x590ad1[_0xc16c('0x33')];if(!_0x49582c[_0xc16c('0x30')][_0xc16c('0x37')](_0xc16c('0x38'))){_0x6f56f1[_0xc16c('0x1e')]=qs['limit'](_0x49582c[_0xc16c('0x30')][_0xc16c('0x1e')]);_0x6f56f1[_0xc16c('0x1c')]=qs[_0xc16c('0x1c')](_0x49582c[_0xc16c('0x30')][_0xc16c('0x1c')]);}_0x6f56f1['order']=qs[_0xc16c('0x39')](_0x49582c[_0xc16c('0x30')][_0xc16c('0x39')]);_0x6f56f1[_0xc16c('0x3a')]=qs[_0xc16c('0x31')](_['pick'](_0x49582c[_0xc16c('0x30')],_0x590ad1[_0xc16c('0x31')]),_0x31bbe7);if(_0x49582c[_0xc16c('0x30')]['filter']){_0x6f56f1[_0xc16c('0x3a')]=_[_0xc16c('0x3b')](_0x6f56f1['where'],{'$or':_[_0xc16c('0x29')](_0x31bbe7,function(_0x2b6835){if(_0x2b6835[_0xc16c('0x2d')]!==_0xc16c('0x3c')){var _0x415159={};_0x415159[_0x2b6835['name']]={'$like':'%'+_0x49582c[_0xc16c('0x30')]['filter']+'%'};return _0x415159;}})});}_0x6f56f1=_[_0xc16c('0x3b')]({},_0x6f56f1,_0x49582c['options']);var _0x18deee={'where':_0x6f56f1['where']};return db['CmHopperHistory']['count'](_0x18deee)[_0xc16c('0x25')](function(_0x225477){_0x54c3c0[_0xc16c('0x1f')]=_0x225477;if(_0x49582c[_0xc16c('0x30')][_0xc16c('0x3d')]){_0x6f56f1[_0xc16c('0x3e')]=[{'all':!![]}];}return db[_0xc16c('0x2a')][_0xc16c('0x3f')](_0x6f56f1);})[_0xc16c('0x25')](function(_0x7285eb){_0x54c3c0[_0xc16c('0x40')]=_0x7285eb;return _0x54c3c0;})[_0xc16c('0x25')](respondWithFilteredResult(_0x50fc24,_0x6f56f1))['catch'](handleError(_0x50fc24,null));};exports['show']=function(_0xdacbc7,_0x532a61){var _0x3b6548={'raw':!![],'where':{'id':_0xdacbc7[_0xc16c('0x41')]['id']}},_0x16fa2c={};_0x16fa2c[_0xc16c('0x33')]=_['keys'](db['CmHopperHistory'][_0xc16c('0x2b')]);_0x16fa2c[_0xc16c('0x30')]=_['keys'](_0xdacbc7[_0xc16c('0x30')]);_0x16fa2c[_0xc16c('0x31')]=_[_0xc16c('0x32')](_0x16fa2c[_0xc16c('0x33')],_0x16fa2c['query']);_0x3b6548['attributes']=_[_0xc16c('0x32')](_0x16fa2c[_0xc16c('0x33')],qs[_0xc16c('0x35')](_0xdacbc7[_0xc16c('0x30')][_0xc16c('0x35')]));_0x3b6548[_0xc16c('0x34')]=_0x3b6548[_0xc16c('0x34')]['length']?_0x3b6548[_0xc16c('0x34')]:_0x16fa2c['model'];if(_0xdacbc7[_0xc16c('0x30')][_0xc16c('0x3d')]){_0x3b6548[_0xc16c('0x3e')]=[{'all':!![]}];}_0x3b6548=_['merge']({},_0x3b6548,_0xdacbc7[_0xc16c('0x42')]);return db[_0xc16c('0x2a')][_0xc16c('0x43')](_0x3b6548)[_0xc16c('0x25')](handleEntityNotFound(_0x532a61,null))[_0xc16c('0x25')](respondWithResult(_0x532a61,null))[_0xc16c('0x44')](handleError(_0x532a61,null));};exports['create']=function(_0x2ea2c0,_0x5c9461){return db[_0xc16c('0x2a')][_0xc16c('0x45')](_0x2ea2c0[_0xc16c('0x46')],{})[_0xc16c('0x25')](respondWithResult(_0x5c9461,0xc9))[_0xc16c('0x44')](handleError(_0x5c9461,null));};exports['describe']=function(_0x4cc89b,_0x4ce332){return db[_0xc16c('0x2a')]['describe']()[_0xc16c('0x25')](respondWithResult(_0x4ce332,null))[_0xc16c('0x44')](handleError(_0x4ce332,null));};exports[_0xc16c('0x24')]=function(_0x29612d,_0x163a8f){if(_0x29612d[_0xc16c('0x46')][_0xc16c('0x47')]){delete _0x29612d[_0xc16c('0x46')][_0xc16c('0x47')];}return db[_0xc16c('0x2a')]['find']({'where':{'uniqueid':_0x29612d[_0xc16c('0x41')]['id']}})['then'](handleEntityNotFound(_0x163a8f,null))[_0xc16c('0x25')](saveUpdates(_0x29612d[_0xc16c('0x46')],null))[_0xc16c('0x25')](respondWithResult(_0x163a8f,null))['catch'](handleError(_0x163a8f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c4189a4..baeba7f 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 _0xcdd2=['exports','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require(_0x2cdd('0x2'))(_0x2cdd('0x3'));var moment=require('moment');var BPromise=require(_0x2cdd('0x4'));var rp=require(_0x2cdd('0x5'));var fs=require('fs');var path=require(_0x2cdd('0x6'));var rimraf=require(_0x2cdd('0x7'));var config=require('../../config/environment');var attributes=require(_0x2cdd('0x8'));module[_0x2cdd('0x9')]=function(_0x5f3b53,_0x1cc1ac){return _0x5f3b53[_0x2cdd('0xa')](_0x2cdd('0xb'),attributes,{'tableName':_0x2cdd('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':'uniqueid','fields':[_0x2cdd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb11=['lodash','../../config/logger','api','bluebird','path','../../config/environment','./cmHopperHistory.attributes','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x54567a,_0x18a589){var _0x4a987b=function(_0xb57498){while(--_0xb57498){_0x54567a['push'](_0x54567a['shift']());}};_0x4a987b(++_0x18a589);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xfb11[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));module['exports']=function(_0x25d44f,_0x133727){return _0x25d44f['define'](_0x1fb1('0x7'),attributes,{'tableName':_0x1fb1('0x8'),'paranoid':![],'indexes':[{'name':_0x1fb1('0x9'),'fields':[_0x1fb1('0x9')]},{'name':_0x1fb1('0xa'),'fields':[_0x1fb1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 69a7df7..9b60823 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 _0x2843=['options','raw','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','name','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body'];(function(_0x583afb,_0xf696a7){var _0x4bb5ae=function(_0x189db5){while(--_0x189db5){_0x583afb['push'](_0x583afb['shift']());}};_0x4bb5ae(++_0xf696a7);}(_0x2843,0x6a));var _0x3284=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x2843[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x3284('0x0'));var util=require(_0x3284('0x1'));var moment=require(_0x3284('0x2'));var BPromise=require(_0x3284('0x3'));var rs=require(_0x3284('0x4'));var fs=require('fs');var Redis=require(_0x3284('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3284('0x6'));var logger=require('../../config/logger')(_0x3284('0x7'));var config=require(_0x3284('0x8'));var jayson=require(_0x3284('0x9'));var client=jayson[_0x3284('0xa')][_0x3284('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ceb3a,_0x57bbce,_0x519674){return new BPromise(function(_0x341376,_0x51d132){return client[_0x3284('0xc')](_0x3ceb3a,_0x519674)[_0x3284('0xd')](function(_0x5ecf39){logger['info'](_0x3284('0xe'),_0x57bbce,_0x3284('0xf'));logger[_0x3284('0x10')](_0x3284('0x11'),_0x57bbce,_0x3284('0xf'),JSON[_0x3284('0x12')](_0x5ecf39));if(_0x5ecf39[_0x3284('0x13')]){if(_0x5ecf39[_0x3284('0x13')][_0x3284('0x14')]===0x1f4){logger['error'](_0x3284('0xe'),_0x57bbce,_0x5ecf39['error']['message']);return _0x51d132(_0x5ecf39[_0x3284('0x13')][_0x3284('0x15')]);}logger[_0x3284('0x13')](_0x3284('0xe'),_0x57bbce,_0x5ecf39[_0x3284('0x13')][_0x3284('0x15')]);return _0x341376(_0x5ecf39[_0x3284('0x13')][_0x3284('0x15')]);}else{logger[_0x3284('0x16')](_0x3284('0xe'),_0x57bbce,'request\x20sent');_0x341376(_0x5ecf39[_0x3284('0x17')][_0x3284('0x15')]);}})[_0x3284('0x18')](function(_0x2d633a){logger[_0x3284('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x57bbce,_0x2d633a);_0x51d132(_0x2d633a);});});}exports[_0x3284('0x19')]=function(_0x3c6e56){var _0x3a6108=this;return new Promise(function(_0x34660a,_0xa0debb){return db[_0x3284('0x1a')]['create'](_0x3c6e56[_0x3284('0x1b')],{'raw':_0x3c6e56[_0x3284('0x1c')]?_0x3c6e56[_0x3284('0x1c')][_0x3284('0x1d')]===undefined?!![]:![]:!![]})[_0x3284('0xd')](function(_0x36b5fc){logger['info'](_0x3284('0x19'),_0x3c6e56);logger[_0x3284('0x10')](_0x3284('0x19'),_0x3c6e56,JSON[_0x3284('0x12')](_0x36b5fc));_0x34660a(_0x36b5fc);})[_0x3284('0x18')](function(_0x5e6db9){logger[_0x3284('0x13')](_0x3284('0x19'),_0x5e6db9[_0x3284('0x15')],_0x3c6e56);_0xa0debb(_0x3a6108[_0x3284('0x13')](0x1f4,_0x5e6db9[_0x3284('0x15')]));});});};exports[_0x3284('0x1e')]=function(_0x2c2d6b){var _0xd178cb=this;return new Promise(function(_0x344c5c,_0x1d766d){return db[_0x3284('0x1a')][_0x3284('0x1f')]({'raw':_0x2c2d6b[_0x3284('0x1c')]?_0x2c2d6b[_0x3284('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2c2d6b[_0x3284('0x1c')]?_0x2c2d6b[_0x3284('0x1c')][_0x3284('0x20')]||null:null,'attributes':[[db[_0x3284('0x21')]['fn']('COUNT',db[_0x3284('0x21')][_0x3284('0x22')]('id')),_0x3284('0x23')],[db['sequelize']['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db['sequelize'][_0x3284('0x25')](_0x3284('0x26')))),'predictiveIntervalAnsweredCalls'],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db['sequelize'][_0x3284('0x25')](_0x3284('0x27')))),_0x3284('0x28')],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db['sequelize']['fn']('IF',db[_0x3284('0x21')][_0x3284('0x25')](_0x3284('0x29')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x3284('0x21')]['fn'](_0x3284('0x2a'),db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')]['literal'](_0x3284('0x2b')))),'predictiveIntervalAvgHoldtime'],[db[_0x3284('0x21')]['fn'](_0x3284('0x2a'),db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')][_0x3284('0x25')](_0x3284('0x2c')))),_0x3284('0x2d')]]})[_0x3284('0xd')](function(_0x3b4d04){logger[_0x3284('0x16')](_0x3284('0x1e'),_0x2c2d6b);logger[_0x3284('0x10')](_0x3284('0x1e'),_0x2c2d6b,JSON[_0x3284('0x12')](_0x3b4d04));_0x344c5c(_0x3b4d04);})[_0x3284('0x18')](function(_0x3fe3b6){logger[_0x3284('0x13')](_0x3284('0x1e'),_0x3fe3b6[_0x3284('0x15')],_0x2c2d6b);_0x1d766d(_0xd178cb[_0x3284('0x13')](0x1f4,_0x3fe3b6['message']));});});};exports[_0x3284('0x2e')]=function(_0x3cbf90){var _0x37caf5=this;return new Promise(function(_0x2e27f9,_0x1fbae2){return db[_0x3284('0x1a')][_0x3284('0x1f')]({'raw':_0x3cbf90[_0x3284('0x1c')]?_0x3cbf90[_0x3284('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3cbf90[_0x3284('0x1c')]?_0x3cbf90['options'][_0x3284('0x20')]||null:null,'attributes':[['campaign','name'],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')][_0x3284('0x25')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')][_0x3284('0x25')](_0x3284('0x2f')))),_0x3284('0x30')],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db['sequelize'][_0x3284('0x25')](_0x3284('0x26')))),'outboundAnswerCallsDay'],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')][_0x3284('0x25')](_0x3284('0x31')))),'outboundBusyCallsDay'],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db['sequelize'][_0x3284('0x25')]('`state`\x20=\x208,\x201,\x20null'))),_0x3284('0x32')],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')][_0x3284('0x25')](_0x3284('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x3284('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3284('0x25')](_0x3284('0x34')))),'outboundDropCallsDayCallersExit'],[db[_0x3284('0x21')]['fn']('COUNT',db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x3284('0x35')],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db['sequelize']['fn']('IF',db['sequelize'][_0x3284('0x25')](_0x3284('0x36')))),_0x3284('0x37')],[db[_0x3284('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3284('0x21')]['literal'](_0x3284('0x38')))),_0x3284('0x39')],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')][_0x3284('0x25')]('`state`\x20=\x2018,\x201,\x20null'))),_0x3284('0x3a')],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')]['literal'](_0x3284('0x3b')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x3284('0x21')]['fn']('IF',db[_0x3284('0x21')]['literal'](_0x3284('0x3c')))),'outboundRejectCallsDay'],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db['sequelize']['fn']('IF',db[_0x3284('0x21')][_0x3284('0x25')](_0x3284('0x3d')))),_0x3284('0x3e')]],'group':[_0x3284('0x3f')]})[_0x3284('0xd')](function(_0x2ce4a6){logger[_0x3284('0x16')](_0x3284('0x2e'),_0x3cbf90);logger[_0x3284('0x10')](_0x3284('0x2e'),_0x3cbf90,JSON['stringify'](_0x2ce4a6));_0x2e27f9(_0x2ce4a6);})[_0x3284('0x18')](function(_0x364fda){logger[_0x3284('0x13')](_0x3284('0x2e'),_0x364fda[_0x3284('0x15')],_0x3cbf90);_0x1fbae2(_0x37caf5['error'](0x1f4,_0x364fda[_0x3284('0x15')]));});});};exports[_0x3284('0x40')]=function(_0x2bb1c1){var _0x21ba60=this;return new Promise(function(_0x592d94,_0xaeab3e){return db['CmHopperHistory'][_0x3284('0x1f')]({'raw':_0x2bb1c1[_0x3284('0x1c')]?_0x2bb1c1[_0x3284('0x1c')][_0x3284('0x1d')]===undefined?!![]:![]:!![],'where':_0x2bb1c1[_0x3284('0x1c')]?_0x2bb1c1['options'][_0x3284('0x20')]||null:null,'attributes':[[_0x3284('0x3f'),_0x3284('0x41')],[db[_0x3284('0x21')]['fn'](_0x3284('0x24'),db[_0x3284('0x21')]['col']('id')),_0x3284('0x42')],[db[_0x3284('0x21')]['fn']('COUNT',db[_0x3284('0x21')]['fn']('IF',db['sequelize'][_0x3284('0x25')](_0x3284('0x26')))),'ivrAnswerCallsDay']],'group':[_0x3284('0x3f')]})[_0x3284('0xd')](function(_0x2f4eba){logger[_0x3284('0x16')](_0x3284('0x40'),_0x2bb1c1);logger['debug'](_0x3284('0x40'),_0x2bb1c1,JSON[_0x3284('0x12')](_0x2f4eba));_0x592d94(_0x2f4eba);})[_0x3284('0x18')](function(_0xce0ee7){logger[_0x3284('0x13')]('GetCampaignHopperHistory',_0xce0ee7['message'],_0x2bb1c1);_0xaeab3e(_0x21ba60[_0x3284('0x13')](0x1f4,_0xce0ee7[_0x3284('0x15')]));});});}; \ No newline at end of file +var _0xfa7c=['rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','info','result','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgTalktime','stringify','catch','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x407871,_0x566a99){_0x407871=_0x407871-0x0;var _0x479e34=_0xfa7c[_0x407871];return _0x479e34;};'use strict';var _=require(_0xcfa7('0x0'));var util=require('util');var moment=require(_0xcfa7('0x1'));var BPromise=require(_0xcfa7('0x2'));var rs=require(_0xcfa7('0x3'));var fs=require('fs');var Redis=require(_0xcfa7('0x4'));var db=require(_0xcfa7('0x5'))['db'];var utils=require(_0xcfa7('0x6'));var logger=require(_0xcfa7('0x7'))(_0xcfa7('0x8'));var config=require('../../config/environment');var jayson=require(_0xcfa7('0x9'));var client=jayson[_0xcfa7('0xa')][_0xcfa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d5f85,_0x4b2669,_0x816590){return new BPromise(function(_0x573432,_0x376c4e){return client[_0xcfa7('0xc')](_0x1d5f85,_0x816590)[_0xcfa7('0xd')](function(_0x14e62a){logger['info'](_0xcfa7('0xe'),_0x4b2669,_0xcfa7('0xf'));logger[_0xcfa7('0x10')](_0xcfa7('0x11'),_0x4b2669,_0xcfa7('0xf'),JSON['stringify'](_0x14e62a));if(_0x14e62a['error']){if(_0x14e62a[_0xcfa7('0x12')]['code']===0x1f4){logger[_0xcfa7('0x12')](_0xcfa7('0xe'),_0x4b2669,_0x14e62a[_0xcfa7('0x12')][_0xcfa7('0x13')]);return _0x376c4e(_0x14e62a[_0xcfa7('0x12')][_0xcfa7('0x13')]);}logger[_0xcfa7('0x12')](_0xcfa7('0xe'),_0x4b2669,_0x14e62a['error'][_0xcfa7('0x13')]);return _0x573432(_0x14e62a['error']['message']);}else{logger[_0xcfa7('0x14')](_0xcfa7('0xe'),_0x4b2669,_0xcfa7('0xf'));_0x573432(_0x14e62a[_0xcfa7('0x15')][_0xcfa7('0x13')]);}})['catch'](function(_0x11d8bf){logger[_0xcfa7('0x12')](_0xcfa7('0xe'),_0x4b2669,_0x11d8bf);_0x376c4e(_0x11d8bf);});});}exports[_0xcfa7('0x16')]=function(_0x4e2a46){var _0x21f73c=this;return new Promise(function(_0x34f829,_0x558a21){return db['CmHopperHistory'][_0xcfa7('0x17')](_0x4e2a46[_0xcfa7('0x18')],{'raw':_0x4e2a46[_0xcfa7('0x19')]?_0x4e2a46[_0xcfa7('0x19')][_0xcfa7('0x1a')]===undefined?!![]:![]:!![]})[_0xcfa7('0xd')](function(_0x2312fd){logger[_0xcfa7('0x14')]('CreateCmHopperHistory',_0x4e2a46);logger[_0xcfa7('0x10')]('CreateCmHopperHistory',_0x4e2a46,JSON['stringify'](_0x2312fd));_0x34f829(_0x2312fd);})['catch'](function(_0xdf35fa){logger['error'](_0xcfa7('0x16'),_0xdf35fa[_0xcfa7('0x13')],_0x4e2a46);_0x558a21(_0x21f73c[_0xcfa7('0x12')](0x1f4,_0xdf35fa[_0xcfa7('0x13')]));});});};exports[_0xcfa7('0x1b')]=function(_0x2d00e1){var _0x1562c8=this;return new Promise(function(_0x311f9f,_0x5bff8b){return db[_0xcfa7('0x1c')][_0xcfa7('0x1d')]({'raw':_0x2d00e1[_0xcfa7('0x19')]?_0x2d00e1[_0xcfa7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2d00e1[_0xcfa7('0x19')]?_0x2d00e1[_0xcfa7('0x19')][_0xcfa7('0x1e')]||null:null,'attributes':[[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db['sequelize'][_0xcfa7('0x21')]('id')),_0xcfa7('0x22')],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xcfa7('0x23')))),_0xcfa7('0x24')],[db[_0xcfa7('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcfa7('0x1f')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xcfa7('0x25')],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')][_0xcfa7('0x26')](_0xcfa7('0x27')))),_0xcfa7('0x28')],[db['sequelize']['fn']('AVG',db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')][_0xcfa7('0x26')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x29'),db[_0xcfa7('0x1f')]['fn']('IF',db['sequelize'][_0xcfa7('0x26')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xcfa7('0x2a')]]})['then'](function(_0x1b9e07){logger[_0xcfa7('0x14')](_0xcfa7('0x1b'),_0x2d00e1);logger[_0xcfa7('0x10')](_0xcfa7('0x1b'),_0x2d00e1,JSON[_0xcfa7('0x2b')](_0x1b9e07));_0x311f9f(_0x1b9e07);})[_0xcfa7('0x2c')](function(_0x5a9c5a){logger[_0xcfa7('0x12')](_0xcfa7('0x1b'),_0x5a9c5a[_0xcfa7('0x13')],_0x2d00e1);_0x5bff8b(_0x1562c8[_0xcfa7('0x12')](0x1f4,_0x5a9c5a[_0xcfa7('0x13')]));});});};exports[_0xcfa7('0x2d')]=function(_0x1be019){var _0x2926f1=this;return new Promise(function(_0x5c04f3,_0x42a16a){return db['CmHopperHistory']['findAll']({'raw':_0x1be019[_0xcfa7('0x19')]?_0x1be019['options'][_0xcfa7('0x1a')]===undefined?!![]:![]:!![],'where':_0x1be019[_0xcfa7('0x19')]?_0x1be019[_0xcfa7('0x19')]['where']||null:null,'attributes':[[_0xcfa7('0x2e'),_0xcfa7('0x2f')],[db['sequelize']['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')]['literal'](_0xcfa7('0x30')))),_0xcfa7('0x31')],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')]['literal'](_0xcfa7('0x32')))),'outboundNoAnswerCallsDay'],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db['sequelize']['fn']('IF',db[_0xcfa7('0x1f')][_0xcfa7('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0xcfa7('0x33')],[db['sequelize']['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db['sequelize'][_0xcfa7('0x26')](_0xcfa7('0x34')))),_0xcfa7('0x35')],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')][_0xcfa7('0x26')]('`state`\x20=\x208,\x201,\x20null'))),_0xcfa7('0x36')],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')]['literal'](_0xcfa7('0x37')))),'outboundDropCallsDayTimeout'],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db['sequelize'][_0xcfa7('0x26')](_0xcfa7('0x38')))),_0xcfa7('0x39')],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db['sequelize'][_0xcfa7('0x26')](_0xcfa7('0x3a')))),_0xcfa7('0x3b')],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')][_0xcfa7('0x26')](_0xcfa7('0x3c')))),'outboundBlacklistCallsDay'],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')][_0xcfa7('0x26')](_0xcfa7('0x3d')))),_0xcfa7('0x3e')],[db['sequelize']['fn']('COUNT',db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')]['literal'](_0xcfa7('0x3f')))),_0xcfa7('0x40')],[db['sequelize']['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')]['literal'](_0xcfa7('0x41')))),_0xcfa7('0x42')],[db['sequelize']['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')][_0xcfa7('0x26')]('`state`\x20=\x2020,\x201,\x20null'))),_0xcfa7('0x40')],[db[_0xcfa7('0x1f')]['fn']('COUNT',db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')]['literal'](_0xcfa7('0x43')))),_0xcfa7('0x44')]],'group':[_0xcfa7('0x2e')]})['then'](function(_0x403f51){logger[_0xcfa7('0x14')](_0xcfa7('0x2d'),_0x1be019);logger[_0xcfa7('0x10')]('GetVoiceQueueHopperHistory',_0x1be019,JSON[_0xcfa7('0x2b')](_0x403f51));_0x5c04f3(_0x403f51);})['catch'](function(_0x360d4d){logger[_0xcfa7('0x12')](_0xcfa7('0x2d'),_0x360d4d[_0xcfa7('0x13')],_0x1be019);_0x42a16a(_0x2926f1[_0xcfa7('0x12')](0x1f4,_0x360d4d[_0xcfa7('0x13')]));});});};exports[_0xcfa7('0x45')]=function(_0x25fe73){var _0x2dd57d=this;return new Promise(function(_0x33b159,_0x4fdf09){return db['CmHopperHistory']['findAll']({'raw':_0x25fe73[_0xcfa7('0x19')]?_0x25fe73[_0xcfa7('0x19')][_0xcfa7('0x1a')]===undefined?!![]:![]:!![],'where':_0x25fe73[_0xcfa7('0x19')]?_0x25fe73[_0xcfa7('0x19')][_0xcfa7('0x1e')]||null:null,'attributes':[[_0xcfa7('0x2e'),'name'],[db[_0xcfa7('0x1f')]['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')][_0xcfa7('0x21')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0xcfa7('0x20'),db[_0xcfa7('0x1f')]['fn']('IF',db[_0xcfa7('0x1f')][_0xcfa7('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0xcfa7('0x46')]],'group':[_0xcfa7('0x2e')]})[_0xcfa7('0xd')](function(_0x40d232){logger[_0xcfa7('0x14')]('GetCampaignHopperHistory',_0x25fe73);logger[_0xcfa7('0x10')](_0xcfa7('0x45'),_0x25fe73,JSON['stringify'](_0x40d232));_0x33b159(_0x40d232);})[_0xcfa7('0x2c')](function(_0x25074d){logger[_0xcfa7('0x12')]('GetCampaignHopperHistory',_0x25074d[_0xcfa7('0x13')],_0x25fe73);_0x4fdf09(_0x2dd57d['error'](0x1f4,_0x25074d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6f696ad..599f32b 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 _0xc279=['index','/describe','isAuthenticated','describe','/:id','create','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./cmHopperHistory.controller','get'];(function(_0x58b190,_0x1011ad){var _0x46b010=function(_0x407cd8){while(--_0x407cd8){_0x58b190['push'](_0x58b190['shift']());}};_0x46b010(++_0x1011ad);}(_0xc279,0xd8));var _0x9c27=function(_0x271594,_0x2c1cc4){_0x271594=_0x271594-0x0;var _0x58c5a0=_0xc279[_0x271594];return _0x58c5a0;};'use strict';var multer=require(_0x9c27('0x0'));var util=require('util');var path=require(_0x9c27('0x1'));var timeout=require(_0x9c27('0x2'));var express=require('express');var router=express[_0x9c27('0x3')]();var fs_extra=require(_0x9c27('0x4'));var auth=require(_0x9c27('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c27('0x6'));router[_0x9c27('0x7')]('/',auth['isAuthenticated'](),controller[_0x9c27('0x8')]);router[_0x9c27('0x7')](_0x9c27('0x9'),auth[_0x9c27('0xa')](),controller[_0x9c27('0xb')]);router[_0x9c27('0x7')](_0x9c27('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9c27('0xa')](),controller[_0x9c27('0xd')]);router['put']('/:id',auth[_0x9c27('0xa')](),controller[_0x9c27('0xe')]);module[_0x9c27('0xf')]=router; \ No newline at end of file +var _0xd263=['/describe','describe','/:id','show','post','create','put','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5c975b,_0x3c39c5){var _0x3b839f=function(_0x1409da){while(--_0x1409da){_0x5c975b['push'](_0x5c975b['shift']());}};_0x3b839f(++_0x3c39c5);}(_0xd263,0x181));var _0x3d26=function(_0x3f7b42,_0x3b2f2d){_0x3f7b42=_0x3f7b42-0x0;var _0x26e4d8=_0xd263[_0x3f7b42];return _0x26e4d8;};'use strict';var multer=require(_0x3d26('0x0'));var util=require('util');var path=require(_0x3d26('0x1'));var timeout=require(_0x3d26('0x2'));var express=require(_0x3d26('0x3'));var router=express[_0x3d26('0x4')]();var fs_extra=require(_0x3d26('0x5'));var auth=require(_0x3d26('0x6'));var interaction=require(_0x3d26('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x3d26('0x8')]('/',auth[_0x3d26('0x9')](),controller[_0x3d26('0xa')]);router['get'](_0x3d26('0xb'),auth[_0x3d26('0x9')](),controller[_0x3d26('0xc')]);router[_0x3d26('0x8')](_0x3d26('0xd'),auth[_0x3d26('0x9')](),controller[_0x3d26('0xe')]);router[_0x3d26('0xf')]('/',auth['isAuthenticated'](),controller[_0x3d26('0x10')]);router[_0x3d26('0x11')](_0x3d26('0xd'),auth[_0x3d26('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 82addec..8e2d9c5 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 _0x9f75=['name','sequelize','STRING'];(function(_0x4c2f3b,_0x4b4b02){var _0x240495=function(_0x22f4f8){while(--_0x22f4f8){_0x4c2f3b['push'](_0x4c2f3b['shift']());}};_0x240495(++_0x4b4b02);}(_0x9f75,0x15a));var _0x59f7=function(_0x2415ff,_0x14bbad){_0x2415ff=_0x2415ff-0x0;var _0x27e453=_0x9f75[_0x2415ff];return _0x27e453;};'use strict';var Sequelize=require(_0x59f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x59f7('0x1')],'unique':_0x59f7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa19=['name','sequelize','exports','STRING'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0xaa19,0x79));var _0x9aa1=function(_0x3b68c1,_0xa6f17e){_0x3b68c1=_0x3b68c1-0x0;var _0x37af14=_0xaa19[_0x3b68c1];return _0x37af14;};'use strict';var Sequelize=require(_0x9aa1('0x0'));module[_0x9aa1('0x1')]={'name':{'type':Sequelize[_0x9aa1('0x2')],'unique':_0x9aa1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x9aa1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 07f309a..7bc5995 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 _0x1d4f=['index','map','CmList','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','findAll','rows','params','includeAll','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','describe','addDisposition','ListId','Disposition','findOne','removeDispositions','ids','CmContact','isArray','tags','join','push','each','omit','success','dataValues','message','getContacts','CmCustomField','CustomFields','concat','format','hasOwnProperty','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','isEmpty','setHeader','Content-disposition','list_%d_%s.csv','Content-type','download','/tmp/list_%d_%s.csv','sendStatus','addCustomField','addCustomFields','Sequelize','text','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','name','send'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x1d4f,0x6c));var _0xf1d4=function(_0x126215,_0x348f30){_0x126215=_0x126215-0x0;var _0x2bbcb6=_0x1d4f[_0x126215];return _0x2bbcb6;};'use strict';var emlformat=require(_0xf1d4('0x0'));var rimraf=require(_0xf1d4('0x1'));var zipdir=require(_0xf1d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1d4('0x3'));var moment=require('moment');var BPromise=require(_0xf1d4('0x4'));var Mustache=require(_0xf1d4('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf1d4('0x6'));var csv=require(_0xf1d4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1d4('0x8'));var _=require(_0xf1d4('0x9'));var squel=require(_0xf1d4('0xa'));var crypto=require(_0xf1d4('0xb'));var jsforce=require(_0xf1d4('0xc'));var deskjs=require(_0xf1d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf1d4('0xe'));var Papa=require(_0xf1d4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf1d4('0x10'));var as=require(_0xf1d4('0x11'));var hardwareService=require(_0xf1d4('0x12'));var logger=require(_0xf1d4('0x13'))(_0xf1d4('0x14'));var utils=require('../../config/utils');var config=require(_0xf1d4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf1d4('0x16'))['db'];var csv_results;config['redis']=_[_0xf1d4('0x17')](config[_0xf1d4('0x18')],{'host':_0xf1d4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf1d4('0x18')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x4d8741,_0x3cc3cc){_0x3cc3cc=_0x3cc3cc||0xcc;return function(_0x365cc0){if(_0x365cc0){return _0x4d8741['sendStatus'](_0x3cc3cc);}return _0x4d8741[_0xf1d4('0x1a')](_0x3cc3cc)[_0xf1d4('0x1b')]();};}function respondWithResult(_0x50e338,_0x584c2c){_0x584c2c=_0x584c2c||0xc8;return function(_0x1efe1f){if(_0x1efe1f){return _0x50e338['status'](_0x584c2c)[_0xf1d4('0x1c')](_0x1efe1f);}};}function respondWithFilteredResult(_0x7097c,_0x98749d){return function(_0x200921){if(_0x200921){var _0x27d2fa=typeof _0x98749d['offset']===_0xf1d4('0x1d')&&typeof _0x98749d['limit']==='undefined';var _0x56b574=_0x200921[_0xf1d4('0x1e')];var _0x92b34b=_0x27d2fa?0x0:_0x98749d[_0xf1d4('0x1f')];var _0x10e86c=_0x27d2fa?_0x200921[_0xf1d4('0x1e')]:_0x98749d[_0xf1d4('0x1f')]+_0x98749d[_0xf1d4('0x20')];var _0x3aa438;if(_0x10e86c>=_0x56b574){_0x10e86c=_0x56b574;_0x3aa438=0xc8;}else{_0x3aa438=0xce;}_0x7097c[_0xf1d4('0x1a')](_0x3aa438);return _0x7097c[_0xf1d4('0x21')](_0xf1d4('0x22'),_0x92b34b+'-'+_0x10e86c+'/'+_0x56b574)[_0xf1d4('0x1c')](_0x200921);}return null;};}function patchUpdates(_0x594dbe){return function(_0x32fc15){try{jsonpatch[_0xf1d4('0x23')](_0x32fc15,_0x594dbe,!![]);}catch(_0x6149d6){return BPromise[_0xf1d4('0x24')](_0x6149d6);}return _0x32fc15[_0xf1d4('0x25')]();};}function saveUpdates(_0xe45bc0,_0x5bfcae){return function(_0x9373ae){if(_0x9373ae){return _0x9373ae[_0xf1d4('0x26')](_0xe45bc0)[_0xf1d4('0x27')](function(_0x5d26c5){return _0x5d26c5;});}return null;};}function removeEntity(_0x54dbda,_0x449703){return function(_0x30d92d){if(_0x30d92d){return _0x30d92d[_0xf1d4('0x28')]()[_0xf1d4('0x27')](function(){var _0x3f9f6c=_0x30d92d[_0xf1d4('0x29')]({'plain':!![]});var _0x31536e=_0xf1d4('0x2a');return db[_0xf1d4('0x2b')]['destroy']({'where':{'type':_0x31536e,'resourceId':_0x3f9f6c['id']}})[_0xf1d4('0x27')](function(){return _0x30d92d;});})[_0xf1d4('0x27')](function(){_0x54dbda[_0xf1d4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422a26,_0x472b75){return function(_0x53c578){if(!_0x53c578){_0x422a26['sendStatus'](0x194);}return _0x53c578;};}function handleError(_0x6e6ae9,_0x265d0a){_0x265d0a=_0x265d0a||0x1f4;return function(_0x5aaa3d){logger[_0xf1d4('0x2c')](_0x5aaa3d['stack']);if(_0x5aaa3d[_0xf1d4('0x2d')]){delete _0x5aaa3d[_0xf1d4('0x2d')];}_0x6e6ae9[_0xf1d4('0x1a')](_0x265d0a)[_0xf1d4('0x2e')](_0x5aaa3d);};}exports[_0xf1d4('0x2f')]=function(_0x166bad,_0x5c9140){var _0x1119be={},_0x24175b={},_0x5785c5={'count':0x0,'rows':[]};var _0x1df535=_[_0xf1d4('0x30')](db[_0xf1d4('0x31')][_0xf1d4('0x32')],function(_0x351030){return{'name':_0x351030[_0xf1d4('0x33')],'type':_0x351030[_0xf1d4('0x34')][_0xf1d4('0x35')]};});_0x24175b[_0xf1d4('0x36')]=_[_0xf1d4('0x30')](_0x1df535,_0xf1d4('0x2d'));_0x24175b['query']=_[_0xf1d4('0x37')](_0x166bad['query']);_0x24175b[_0xf1d4('0x38')]=_[_0xf1d4('0x39')](_0x24175b[_0xf1d4('0x36')],_0x24175b[_0xf1d4('0x3a')]);_0x1119be['attributes']=_[_0xf1d4('0x39')](_0x24175b[_0xf1d4('0x36')],qs[_0xf1d4('0x3b')](_0x166bad[_0xf1d4('0x3a')][_0xf1d4('0x3b')]));_0x1119be[_0xf1d4('0x3c')]=_0x1119be[_0xf1d4('0x3c')][_0xf1d4('0x3d')]?_0x1119be[_0xf1d4('0x3c')]:_0x24175b[_0xf1d4('0x36')];if(!_0x166bad[_0xf1d4('0x3a')]['hasOwnProperty'](_0xf1d4('0x3e'))){_0x1119be[_0xf1d4('0x20')]=qs[_0xf1d4('0x20')](_0x166bad[_0xf1d4('0x3a')][_0xf1d4('0x20')]);_0x1119be['offset']=qs[_0xf1d4('0x1f')](_0x166bad[_0xf1d4('0x3a')][_0xf1d4('0x1f')]);}_0x1119be[_0xf1d4('0x3f')]=qs[_0xf1d4('0x40')](_0x166bad[_0xf1d4('0x3a')][_0xf1d4('0x40')]);_0x1119be[_0xf1d4('0x41')]=qs[_0xf1d4('0x38')](_[_0xf1d4('0x42')](_0x166bad['query'],_0x24175b['filters']),_0x1df535);if(_0x166bad[_0xf1d4('0x3a')][_0xf1d4('0x43')]){_0x1119be['where']=_[_0xf1d4('0x44')](_0x1119be[_0xf1d4('0x41')],{'$or':_[_0xf1d4('0x30')](_0x1df535,function(_0x2cbe65){if(_0x2cbe65['type']!=='VIRTUAL'){var _0x2f7980={};_0x2f7980[_0x2cbe65[_0xf1d4('0x2d')]]={'$like':'%'+_0x166bad[_0xf1d4('0x3a')][_0xf1d4('0x43')]+'%'};return _0x2f7980;}})});}_0x1119be=_[_0xf1d4('0x44')]({},_0x1119be,_0x166bad['options']);var _0xa935ad={'where':_0x1119be['where']};return db['CmList'][_0xf1d4('0x1e')](_0xa935ad)['then'](function(_0x4efe05){_0x5785c5['count']=_0x4efe05;if(_0x166bad[_0xf1d4('0x3a')]['includeAll']){_0x1119be['include']=[{'all':!![]}];}return db[_0xf1d4('0x31')][_0xf1d4('0x45')](_0x1119be);})[_0xf1d4('0x27')](function(_0x4e9f48){_0x5785c5[_0xf1d4('0x46')]=_0x4e9f48;return _0x5785c5;})[_0xf1d4('0x27')](respondWithFilteredResult(_0x5c9140,_0x1119be))['catch'](handleError(_0x5c9140,null));};exports['show']=function(_0x1b9fda,_0x51f201){var _0x21d008={'raw':![],'where':{'id':_0x1b9fda[_0xf1d4('0x47')]['id']}},_0xcf8af9={};_0xcf8af9[_0xf1d4('0x36')]=_[_0xf1d4('0x37')](db[_0xf1d4('0x31')][_0xf1d4('0x32')]);_0xcf8af9['query']=_[_0xf1d4('0x37')](_0x1b9fda[_0xf1d4('0x3a')]);_0xcf8af9['filters']=_['intersection'](_0xcf8af9[_0xf1d4('0x36')],_0xcf8af9[_0xf1d4('0x3a')]);_0x21d008['attributes']=_[_0xf1d4('0x39')](_0xcf8af9[_0xf1d4('0x36')],qs[_0xf1d4('0x3b')](_0x1b9fda[_0xf1d4('0x3a')]['fields']));_0x21d008['attributes']=_0x21d008[_0xf1d4('0x3c')][_0xf1d4('0x3d')]?_0x21d008[_0xf1d4('0x3c')]:_0xcf8af9[_0xf1d4('0x36')];if(_0x1b9fda[_0xf1d4('0x3a')][_0xf1d4('0x48')]){_0x21d008[_0xf1d4('0x49')]=[{'all':!![]}];}_0x21d008=_[_0xf1d4('0x44')]({},_0x21d008,_0x1b9fda[_0xf1d4('0x4a')]);return db[_0xf1d4('0x31')][_0xf1d4('0x4b')](_0x21d008)[_0xf1d4('0x27')](handleEntityNotFound(_0x51f201,null))['then'](respondWithResult(_0x51f201,null))[_0xf1d4('0x4c')](handleError(_0x51f201,null));};exports[_0xf1d4('0x4d')]=function(_0x23ad82,_0x4b8b7b){return db[_0xf1d4('0x31')][_0xf1d4('0x4d')](_0x23ad82[_0xf1d4('0x4e')],{})[_0xf1d4('0x27')](function(_0x1cbf2e){var _0x586042=_0x23ad82[_0xf1d4('0x4f')]['get']({'plain':!![]});if(!_0x586042)throw new Error(_0xf1d4('0x50'));if(_0x586042['role']===_0xf1d4('0x4f')){var _0x18d10d=_0x1cbf2e[_0xf1d4('0x29')]({'plain':!![]});var _0x4ccd0a=_0xf1d4('0x2a');return db['UserProfileSection'][_0xf1d4('0x4b')]({'where':{'name':_0x4ccd0a,'userProfileId':_0x586042[_0xf1d4('0x51')]},'raw':!![]})[_0xf1d4('0x27')](function(_0x22434c){if(_0x22434c&&_0x22434c[_0xf1d4('0x52')]===0x0){return db[_0xf1d4('0x2b')][_0xf1d4('0x4d')]({'name':_0x18d10d[_0xf1d4('0x2d')],'resourceId':_0x18d10d['id'],'type':_0x22434c[_0xf1d4('0x2d')],'sectionId':_0x22434c['id']},{})[_0xf1d4('0x27')](function(){return _0x1cbf2e;});}else{return _0x1cbf2e;}})[_0xf1d4('0x4c')](function(_0x5e5afe){logger[_0xf1d4('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e5afe);throw _0x5e5afe;});}return _0x1cbf2e;})[_0xf1d4('0x27')](respondWithResult(_0x4b8b7b,0xc9))[_0xf1d4('0x4c')](handleError(_0x4b8b7b,null));};exports[_0xf1d4('0x26')]=function(_0x125f00,_0x7e2e32){if(_0x125f00[_0xf1d4('0x4e')]['id']){delete _0x125f00['body']['id'];}return db[_0xf1d4('0x31')]['find']({'where':{'id':_0x125f00[_0xf1d4('0x47')]['id']}})['then'](handleEntityNotFound(_0x7e2e32,null))[_0xf1d4('0x27')](saveUpdates(_0x125f00[_0xf1d4('0x4e')],null))[_0xf1d4('0x27')](respondWithResult(_0x7e2e32,null))[_0xf1d4('0x4c')](handleError(_0x7e2e32,null));};exports[_0xf1d4('0x28')]=function(_0x189084,_0x13ff77){return db['CmList']['find']({'where':{'id':_0x189084['params']['id']}})[_0xf1d4('0x27')](handleEntityNotFound(_0x13ff77,null))[_0xf1d4('0x27')](removeEntity(_0x13ff77,null))[_0xf1d4('0x4c')](handleError(_0x13ff77,null));};exports[_0xf1d4('0x53')]=function(_0x4056f3,_0x4f2aa0){return db[_0xf1d4('0x31')][_0xf1d4('0x53')]()[_0xf1d4('0x27')](respondWithResult(_0x4f2aa0,null))[_0xf1d4('0x4c')](handleError(_0x4f2aa0,null));};exports[_0xf1d4('0x54')]=function(_0x522565,_0x42f48f,_0x3b8058){if(_0x522565[_0xf1d4('0x4e')]['id']){delete _0x522565['body']['id'];}return db[_0xf1d4('0x31')][_0xf1d4('0x4b')]({'where':{'id':_0x522565[_0xf1d4('0x47')]['id']}})[_0xf1d4('0x27')](handleEntityNotFound(_0x42f48f,null))['then'](function(_0x3b52bc){if(_0x3b52bc){_0x522565[_0xf1d4('0x4e')][_0xf1d4('0x55')]=_0x3b52bc['id'];return db[_0xf1d4('0x56')][_0xf1d4('0x4d')](_0x522565['body']);}})[_0xf1d4('0x27')](respondWithResult(_0x42f48f,null))[_0xf1d4('0x4c')](handleError(_0x42f48f,null));};exports['getDispositions']=function(_0x14417c,_0x2820bd,_0x4c4cc0){var _0x5113dd={'raw':![],'where':{}};var _0x2979d8={};var _0x2c4754={'count':0x0,'rows':[]};return db[_0xf1d4('0x31')][_0xf1d4('0x57')]({'where':{'id':_0x14417c[_0xf1d4('0x47')]['id']}})[_0xf1d4('0x27')](handleEntityNotFound(_0x2820bd,null))[_0xf1d4('0x27')](function(_0x1f0027){if(_0x1f0027){_0x2979d8[_0xf1d4('0x36')]=_[_0xf1d4('0x37')](db[_0xf1d4('0x56')]['rawAttributes']);_0x2979d8[_0xf1d4('0x3a')]=_[_0xf1d4('0x37')](_0x14417c[_0xf1d4('0x3a')]);_0x2979d8[_0xf1d4('0x38')]=_[_0xf1d4('0x39')](_0x2979d8[_0xf1d4('0x36')],_0x2979d8[_0xf1d4('0x3a')]);_0x5113dd['attributes']=_['intersection'](_0x2979d8[_0xf1d4('0x36')],qs[_0xf1d4('0x3b')](_0x14417c[_0xf1d4('0x3a')][_0xf1d4('0x3b')]));_0x5113dd[_0xf1d4('0x3c')]=_0x5113dd[_0xf1d4('0x3c')][_0xf1d4('0x3d')]?_0x5113dd['attributes']:_0x2979d8['model'];if(!_0x14417c[_0xf1d4('0x3a')]['hasOwnProperty']('nolimit')){_0x5113dd['limit']=qs[_0xf1d4('0x20')](_0x14417c[_0xf1d4('0x3a')][_0xf1d4('0x20')]);_0x5113dd['offset']=qs['offset'](_0x14417c['query'][_0xf1d4('0x1f')]);}_0x5113dd[_0xf1d4('0x3f')]=qs[_0xf1d4('0x40')](_0x14417c[_0xf1d4('0x3a')][_0xf1d4('0x40')]);_0x5113dd[_0xf1d4('0x41')]=qs[_0xf1d4('0x38')](_[_0xf1d4('0x42')](_0x14417c[_0xf1d4('0x3a')],_0x2979d8[_0xf1d4('0x38')]));_0x5113dd[_0xf1d4('0x41')][_0xf1d4('0x55')]=_0x1f0027['id'];if(_0x14417c['query'][_0xf1d4('0x43')]){_0x5113dd[_0xf1d4('0x41')]=_['merge'](_0x5113dd[_0xf1d4('0x41')],{'$or':_[_0xf1d4('0x30')](_0x5113dd[_0xf1d4('0x3c')],function(_0x4d6748){var _0x147cd9={};_0x147cd9[_0x4d6748]={'$like':'%'+_0x14417c[_0xf1d4('0x3a')]['filter']+'%'};return _0x147cd9;})});}_0x5113dd=_[_0xf1d4('0x44')]({},_0x5113dd,_0x14417c[_0xf1d4('0x4a')]);return db['Disposition']['count']({'where':_0x5113dd[_0xf1d4('0x41')]})[_0xf1d4('0x27')](function(_0x200446){_0x2c4754[_0xf1d4('0x1e')]=_0x200446;if(_0x14417c[_0xf1d4('0x3a')][_0xf1d4('0x48')]){_0x5113dd[_0xf1d4('0x49')]=[{'all':!![]}];}return db[_0xf1d4('0x56')][_0xf1d4('0x45')](_0x5113dd);})['then'](function(_0x5e2c60){_0x2c4754['rows']=_0x5e2c60;return _0x2c4754;});}})['then'](respondWithFilteredResult(_0x2820bd,_0x5113dd))[_0xf1d4('0x4c')](handleError(_0x2820bd,null));};exports[_0xf1d4('0x58')]=function(_0x4e4e2a,_0x38d3a5,_0x450433){return db[_0xf1d4('0x31')][_0xf1d4('0x4b')]({'where':{'id':_0x4e4e2a['params']['id']}})[_0xf1d4('0x27')](handleEntityNotFound(_0x38d3a5,null))[_0xf1d4('0x27')](function(_0x20dd59){if(_0x20dd59){return _0x20dd59[_0xf1d4('0x58')](_0x4e4e2a[_0xf1d4('0x3a')][_0xf1d4('0x59')]);}})[_0xf1d4('0x27')](respondWithStatusCode(_0x38d3a5,null))[_0xf1d4('0x4c')](handleError(_0x38d3a5,null));};exports['addContacts']=function(_0x1a80a0,_0x408fee,_0x7f0ced){return db[_0xf1d4('0x31')]['find']({'where':{'id':_0x1a80a0['params']['id']}})[_0xf1d4('0x27')](handleEntityNotFound(_0x408fee,null))[_0xf1d4('0x27')](function(_0x43fd8c){if(_0x43fd8c){var _0x39a51f=[];var _0x4e016c={'success':[],'errors':[]};return db[_0xf1d4('0x5a')][_0xf1d4('0x53')]()[_0xf1d4('0x27')](function(_0x19d999){if(_0x1a80a0[_0xf1d4('0x4e')]['tags']&&_[_0xf1d4('0x5b')](_0x1a80a0['body']['tags'])){if(_0x1a80a0['body']['tags'][_0xf1d4('0x3d')]){_0x1a80a0[_0xf1d4('0x4e')][_0xf1d4('0x5c')]=_0x1a80a0['body'][_0xf1d4('0x5c')][_0xf1d4('0x5d')](';')+';';}else{_0x1a80a0['body']['tags']=null;}}else{_0x1a80a0['body'][_0xf1d4('0x5c')]=null;}if(_0x1a80a0[_0xf1d4('0x4e')]&&_[_0xf1d4('0x5b')](_0x1a80a0[_0xf1d4('0x4e')])){for(var _0x16302c=0x0;_0x16302c<_0x1a80a0[_0xf1d4('0x4e')][_0xf1d4('0x3d')];_0x16302c+=0x1){_0x1a80a0[_0xf1d4('0x4e')][_0x16302c][_0xf1d4('0x55')]=_0x1a80a0[_0xf1d4('0x47')]['id'];_0x39a51f[_0xf1d4('0x5e')](_0x1a80a0[_0xf1d4('0x4e')][_0x16302c]);}return BPromise[_0xf1d4('0x5f')](_0x39a51f,function(_0x38ba6c){return db['CmContact'][_0xf1d4('0x4d')](_[_0xf1d4('0x60')](_0x38ba6c,[_0xf1d4('0x59'),'id'])||{},{'fields':_[_0xf1d4('0x37')](_0x19d999),'raw':!![]})['then'](function(_0x2788e1){_0x4e016c[_0xf1d4('0x61')][_0xf1d4('0x5e')](_0x2788e1[_0xf1d4('0x62')]);})[_0xf1d4('0x4c')](function(_0x4051f4){_0x4e016c['errors'][_0xf1d4('0x5e')]({'data':_0x38ba6c,'error':_0x4051f4[_0xf1d4('0x63')]});});})[_0xf1d4('0x27')](function(_0x30c634){return _0x4e016c;})[_0xf1d4('0x4c')](function(_0x14d2e5){return _0x14d2e5;});}else{_0x408fee[_0xf1d4('0x1a')](0x190)[_0xf1d4('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xf1d4('0x27')](respondWithResult(_0x408fee,null))[_0xf1d4('0x4c')](handleError(_0x408fee,null));};exports[_0xf1d4('0x64')]=function(_0x451bc2,_0x1f90a6,_0x5b8647){var _0xe6b996;return db[_0xf1d4('0x31')][_0xf1d4('0x4b')]({'where':{'id':_0x451bc2[_0xf1d4('0x47')]['id']},'include':[{'model':db[_0xf1d4('0x65')],'as':_0xf1d4('0x66')}]})[_0xf1d4('0x27')](handleEntityNotFound(_0x1f90a6,null))[_0xf1d4('0x27')](function(_0x28936c){if(_0x28936c){_0xe6b996=_0x28936c;return db[_0xf1d4('0x5a')][_0xf1d4('0x32')];}})['then'](function(_0x1488d4){if(_0x1488d4){var _0x593b1b={};var _0x40b922={};_0x40b922[_0xf1d4('0x36')]=_[_0xf1d4('0x67')](_['keys'](_0x1488d4),_[_0xf1d4('0x30')](_0xe6b996[_0xf1d4('0x66')],function(_0x5546e9){return util[_0xf1d4('0x68')]('cf_%d',_0x5546e9['id']);}));_0x40b922[_0xf1d4('0x3a')]=_[_0xf1d4('0x37')](_0x451bc2[_0xf1d4('0x3a')]);_0x40b922[_0xf1d4('0x38')]=_[_0xf1d4('0x39')](_0x40b922[_0xf1d4('0x36')],_0x40b922[_0xf1d4('0x3a')]);_0x593b1b[_0xf1d4('0x3c')]=_[_0xf1d4('0x39')](_0x40b922[_0xf1d4('0x36')],qs[_0xf1d4('0x3b')](_0x451bc2[_0xf1d4('0x3a')][_0xf1d4('0x3b')]));_0x593b1b[_0xf1d4('0x3c')]=_0x593b1b[_0xf1d4('0x3c')][_0xf1d4('0x3d')]?_0x593b1b[_0xf1d4('0x3c')]:_0x40b922['model'];if(!_0x451bc2[_0xf1d4('0x3a')][_0xf1d4('0x69')](_0xf1d4('0x3e'))){_0x593b1b[_0xf1d4('0x20')]=qs['limit'](_0x451bc2[_0xf1d4('0x3a')]['limit']);_0x593b1b[_0xf1d4('0x1f')]=qs[_0xf1d4('0x1f')](_0x451bc2[_0xf1d4('0x3a')]['offset']);}_0x593b1b[_0xf1d4('0x3f')]=qs[_0xf1d4('0x40')](_0x451bc2[_0xf1d4('0x3a')][_0xf1d4('0x40')]);_0x593b1b[_0xf1d4('0x41')]=qs[_0xf1d4('0x38')](_[_0xf1d4('0x42')](_0x451bc2['query'],_0x40b922[_0xf1d4('0x38')]));_0x593b1b[_0xf1d4('0x6a')]=!![];if(_0x451bc2[_0xf1d4('0x3a')][_0xf1d4('0x43')]){_0x593b1b[_0xf1d4('0x41')]=_[_0xf1d4('0x44')](_0x593b1b[_0xf1d4('0x41')],{'$or':_[_0xf1d4('0x30')](_0x593b1b[_0xf1d4('0x3c')],function(_0x25242f){var _0x6173f1={};_0x6173f1[_0x25242f]={'$like':'%'+_0x451bc2[_0xf1d4('0x3a')]['filter']+'%'};return _0x6173f1;})});}_0x593b1b=_[_0xf1d4('0x44')]({},_0x593b1b,_0x451bc2[_0xf1d4('0x4a')]);return _0xe6b996[_0xf1d4('0x64')](_0x593b1b);}})[_0xf1d4('0x27')](respondWithResult(_0x1f90a6,null))[_0xf1d4('0x4c')](handleError(_0x1f90a6,null));};exports[_0xf1d4('0x6b')]=function(_0x1b3fa5,_0x5a2c05,_0x4fb4a6){var _0x210e9b;var _0x5670c5;var _0x1c1c33;var _0x3b90a4=_0x1b3fa5[_0xf1d4('0x47')]['id'];csv_results=[];return db[_0xf1d4('0x6c')][_0xf1d4('0x45')]({'attributes':['id',_0xf1d4('0x2d')],'raw':!![],'order':[_0xf1d4('0x6d')]})['then'](function(_0x5e76b7){_0x210e9b=_0x5e76b7;var _0x3398e3=_[_0xf1d4('0x37')](db[_0xf1d4('0x5a')][_0xf1d4('0x32')]);return db[_0xf1d4('0x65')][_0xf1d4('0x45')]({'raw':!![],'attributes':['id',_0xf1d4('0x6e')]})[_0xf1d4('0x27')](function(_0x4ff1b4){_0x5670c5=_0x4ff1b4;var _0x1b5c29=squel[_0xf1d4('0x6f')]()[_0xf1d4('0x3b')](_0x3398e3)[_0xf1d4('0x70')]('cm_contacts','c')['where'](_0xf1d4('0x71'),_0x3b90a4)[_0xf1d4('0x41')](_0xf1d4('0x72'))[_0xf1d4('0x73')]();for(var _0x595fc0=0x0;_0x595fc0<_0x5670c5[_0xf1d4('0x3d')];_0x595fc0++){_0x1b5c29[_0xf1d4('0x74')](_0xf1d4('0x75')+_0x5670c5[_0x595fc0]['id'],_0xf1d4('0x76')+_0x5670c5[_0x595fc0][_0xf1d4('0x6e')]);}for(var _0x595fc0=0x0;_0x595fc0<_0x210e9b[_0xf1d4('0x3d')];_0x595fc0++){_0x1b5c29[_0xf1d4('0x74')](squel[_0xf1d4('0x6f')]()['field'](_0xf1d4('0x77'))[_0xf1d4('0x70')](_0xf1d4('0x78'))[_0xf1d4('0x41')](_0xf1d4('0x79'),_0x210e9b[_0x595fc0]['id'])[_0xf1d4('0x41')](_0xf1d4('0x7a')),_0xf1d4('0x7b')+_0x210e9b[_0x595fc0][_0xf1d4('0x2d')]);_0x1b5c29[_0xf1d4('0x74')](squel[_0xf1d4('0x6f')]()[_0xf1d4('0x74')]('description')[_0xf1d4('0x70')](_0xf1d4('0x78'))[_0xf1d4('0x41')]('ItemTypeId\x20=\x20?',_0x210e9b[_0x595fc0]['id'])[_0xf1d4('0x41')](_0xf1d4('0x7a')),_0xf1d4('0x7c')+_0x210e9b[_0x595fc0]['name']);}var _0x354474=[];_0x354474['push'](_0x1b5c29[_0xf1d4('0x7d')]());BPromise[_0xf1d4('0x5f')](_0x354474,handleQuery)['then'](function(_0x2aaa02){handleQuery(_0x1b5c29['toString']());var _0x223a60=csv_results[0x0];if(!_[_0xf1d4('0x7e')](_0x223a60)){var _0x43be07=toCsv(_0x223a60);var _0x52bb4a=Date['now']();fs['writeFileSync'](util[_0xf1d4('0x68')]('/tmp/list_%d_%s.csv',_0x3b90a4,_0x52bb4a),_0x43be07);_0x5a2c05[_0xf1d4('0x7f')](_0xf1d4('0x80'),'attachment;\x20filename='+util['format'](_0xf1d4('0x81'),_0x3b90a4,_0x52bb4a));_0x5a2c05[_0xf1d4('0x7f')](_0xf1d4('0x82'),'text/csv');return _0x5a2c05[_0xf1d4('0x83')](util[_0xf1d4('0x68')](_0xf1d4('0x84'),_0x3b90a4,_0x52bb4a));}else{return _0x5a2c05[_0xf1d4('0x85')](0xcc);}});});});};exports[_0xf1d4('0x86')]=function(_0x1cb97a,_0x13d8d5,_0x27e012){var _0x1052ac;delete _0x1cb97a[_0xf1d4('0x4e')]['id'];return db[_0xf1d4('0x31')][_0xf1d4('0x57')]({'where':{'id':_0x1cb97a['params']['id']}})[_0xf1d4('0x27')](handleEntityNotFound(_0x13d8d5,null))['then'](function(_0x341cab){if(_0x341cab){return db['sequelize']['transaction'](function(_0x1e3244){return db['CmCustomField']['create'](_0x1cb97a['body'],{'transaction':_0x1e3244})[_0xf1d4('0x27')](function(_0x212cf6){_0x1052ac=_0x212cf6;return _0x341cab[_0xf1d4('0x87')](_0x212cf6,{'transaction':_0x1e3244});})[_0xf1d4('0x27')](function(){var _0x28c3dc={'type':db[_0xf1d4('0x88')]['TEXT'],'transaction':_0x1e3244};switch(_0x1cb97a['body'][_0xf1d4('0x34')]){case _0xf1d4('0x89'):_0x28c3dc[_0xf1d4('0x34')]=db[_0xf1d4('0x88')]['TEXT'];break;case _0xf1d4('0x8a'):_0x28c3dc[_0xf1d4('0x34')]=db['Sequelize'][_0xf1d4('0x8b')];break;case'switch':_0x28c3dc[_0xf1d4('0x34')]=db['Sequelize'][_0xf1d4('0x8c')];_0x28c3dc['defaultValue']=![];break;default:}return db['sequelize'][_0xf1d4('0x8d')][_0xf1d4('0x8e')](_0xf1d4('0x8f'),util[_0xf1d4('0x68')](_0xf1d4('0x90'),_0x1052ac['id']),_0x28c3dc);})[_0xf1d4('0x27')](function(){return _0x1052ac;});});}})[_0xf1d4('0x27')](respondWithResult(_0x13d8d5,null))['catch'](handleError(_0x13d8d5,null));};exports[_0xf1d4('0x91')]=function(_0x50525b,_0x3a43b3,_0x486641){var _0x34af11={};var _0x8e9881={};var _0x12d52b;var _0x9a3923;return db[_0xf1d4('0x31')]['findOne']({'where':{'id':_0x50525b[_0xf1d4('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a43b3,null))[_0xf1d4('0x27')](function(_0x335db8){if(_0x335db8){_0x12d52b=_0x335db8;_0x8e9881['model']=_[_0xf1d4('0x37')](db[_0xf1d4('0x65')]['rawAttributes']);_0x8e9881[_0xf1d4('0x3a')]=_['keys'](_0x50525b[_0xf1d4('0x3a')]);_0x8e9881[_0xf1d4('0x38')]=_[_0xf1d4('0x39')](_0x8e9881[_0xf1d4('0x36')],_0x8e9881[_0xf1d4('0x3a')]);_0x34af11['attributes']=_[_0xf1d4('0x39')](_0x8e9881['model'],qs[_0xf1d4('0x3b')](_0x50525b['query'][_0xf1d4('0x3b')]));_0x34af11[_0xf1d4('0x3c')]=_0x34af11[_0xf1d4('0x3c')][_0xf1d4('0x3d')]?_0x34af11[_0xf1d4('0x3c')]:_0x8e9881[_0xf1d4('0x36')];_0x34af11[_0xf1d4('0x3f')]=qs[_0xf1d4('0x40')](_0x50525b[_0xf1d4('0x3a')]['sort']);_0x34af11[_0xf1d4('0x41')]=qs[_0xf1d4('0x38')](_[_0xf1d4('0x42')](_0x50525b[_0xf1d4('0x3a')],_0x8e9881[_0xf1d4('0x38')]));_0x34af11[_0xf1d4('0x41')]=_[_0xf1d4('0x44')](_0x34af11[_0xf1d4('0x41')],{'$or':[{'ListId':_0x335db8['id']},{'ListId':null}]});if(_0x50525b['query'][_0xf1d4('0x43')]){_0x34af11[_0xf1d4('0x41')]=_[_0xf1d4('0x44')](_0x34af11[_0xf1d4('0x41')],{'$or':_[_0xf1d4('0x30')](_0x34af11[_0xf1d4('0x3c')],function(_0x17cc4e){var _0x11de8d={};_0x11de8d[_0x17cc4e]={'$like':'%'+_0x50525b[_0xf1d4('0x3a')]['filter']+'%'};return _0x11de8d;})});}_0x34af11=_[_0xf1d4('0x44')]({},_0x34af11,_0x50525b[_0xf1d4('0x4a')]);return db['CmCustomField'][_0xf1d4('0x92')](_0x34af11);}})[_0xf1d4('0x27')](respondWithResult(_0x3a43b3,null))[_0xf1d4('0x4c')](handleError(_0x3a43b3,null));};exports[_0xf1d4('0x93')]=function(_0x5b6bb0,_0x11d7fe){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0xf1d4('0x27')](handleEntityNotFound(_0x11d7fe,null))[_0xf1d4('0x27')](function(_0x198e4f){return _0x198e4f;})[_0xf1d4('0x27')](respondWithResult(_0x11d7fe,null))['catch'](handleError(_0x11d7fe,null));};exports[_0xf1d4('0x94')]=function(_0x254de5,_0xb70299,_0x2da05f){return db[_0xf1d4('0x31')][_0xf1d4('0x4b')]({'where':{'id':_0x254de5['params']['id']}})['then'](handleEntityNotFound(_0xb70299,null))[_0xf1d4('0x27')](function(_0x11fcdb){if(_0x11fcdb){return _0x11fcdb['addAgents'](_0x254de5[_0xf1d4('0x4e')]['ids'],_[_0xf1d4('0x60')](_0x254de5[_0xf1d4('0x4e')],[_0xf1d4('0x59'),'id'])||{})[_0xf1d4('0x95')](function(_0x1a7362){for(var _0x17899a=0x0;_0x17899a<_0x254de5[_0xf1d4('0x4e')]['ids'][_0xf1d4('0x3d')];_0x17899a+=0x1){socket[_0xf1d4('0x96')]('userCmList:save',{'UserId':Number(_0x254de5[_0xf1d4('0x4e')]['ids'][_0x17899a]),'CmListId':Number(_0x254de5[_0xf1d4('0x47')]['id'])});}return _0x1a7362;});}})[_0xf1d4('0x27')](respondWithResult(_0xb70299,null))[_0xf1d4('0x4c')](handleError(_0xb70299,null));};exports[_0xf1d4('0x97')]=function(_0x4aab91,_0x4c1a46,_0x1a6abe){return db[_0xf1d4('0x31')][_0xf1d4('0x4b')]({'where':{'id':_0x4aab91[_0xf1d4('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c1a46,null))[_0xf1d4('0x27')](function(_0x2358b7){if(_0x2358b7){return _0x2358b7[_0xf1d4('0x97')](_0x4aab91[_0xf1d4('0x3a')][_0xf1d4('0x59')])['then'](function(){if(_[_0xf1d4('0x5b')](_0x4aab91['query'][_0xf1d4('0x59')])){for(var _0x4a9a36=0x0;_0x4a9a36<_0x4aab91['query'][_0xf1d4('0x59')][_0xf1d4('0x3d')];_0x4a9a36+=0x1){socket[_0xf1d4('0x96')](_0xf1d4('0x98'),{'UserId':Number(_0x4aab91[_0xf1d4('0x3a')]['ids'][_0x4a9a36]),'CmListId':Number(_0x4aab91[_0xf1d4('0x47')]['id'])});}}else{socket['emit'](_0xf1d4('0x98'),{'UserId':Number(_0x4aab91[_0xf1d4('0x3a')][_0xf1d4('0x59')]),'CmListId':Number(_0x4aab91[_0xf1d4('0x47')]['id'])});}});}})[_0xf1d4('0x27')](respondWithStatusCode(_0x4c1a46,null))[_0xf1d4('0x4c')](handleError(_0x4c1a46,null));};exports[_0xf1d4('0x99')]=function(_0x17e787,_0x23ea22,_0x2ecc08){var _0x5a91f2={};var _0x4d296c={};var _0x5a6c64;var _0x122251;return db[_0xf1d4('0x31')]['findOne']({'where':{'id':_0x17e787[_0xf1d4('0x47')]['id']}})['then'](handleEntityNotFound(_0x23ea22,null))[_0xf1d4('0x27')](function(_0x22e580){if(_0x22e580){_0x5a6c64=_0x22e580;_0x4d296c['model']=_[_0xf1d4('0x37')](db[_0xf1d4('0x9a')][_0xf1d4('0x32')]);_0x4d296c[_0xf1d4('0x3a')]=_[_0xf1d4('0x37')](_0x17e787[_0xf1d4('0x3a')]);_0x4d296c[_0xf1d4('0x38')]=_[_0xf1d4('0x39')](_0x4d296c[_0xf1d4('0x36')],_0x4d296c[_0xf1d4('0x3a')]);_0x5a91f2[_0xf1d4('0x3c')]=_['intersection'](_0x4d296c[_0xf1d4('0x36')],qs[_0xf1d4('0x3b')](_0x17e787[_0xf1d4('0x3a')]['fields']));_0x5a91f2['attributes']=_0x5a91f2[_0xf1d4('0x3c')][_0xf1d4('0x3d')]?_0x5a91f2['attributes']:_0x4d296c[_0xf1d4('0x36')];_0x5a91f2['order']=qs[_0xf1d4('0x40')](_0x17e787['query'][_0xf1d4('0x40')]);_0x5a91f2[_0xf1d4('0x41')]=qs['filters'](_[_0xf1d4('0x42')](_0x17e787[_0xf1d4('0x3a')],_0x4d296c['filters']));if(_0x17e787[_0xf1d4('0x3a')][_0xf1d4('0x43')]){_0x5a91f2[_0xf1d4('0x41')]=_[_0xf1d4('0x44')](_0x5a91f2[_0xf1d4('0x41')],{'$or':_[_0xf1d4('0x30')](_0x5a91f2['attributes'],function(_0x269615){var _0x544b75={};_0x544b75[_0x269615]={'$like':'%'+_0x17e787[_0xf1d4('0x3a')][_0xf1d4('0x43')]+'%'};return _0x544b75;})});}_0x5a91f2=_[_0xf1d4('0x44')]({},_0x5a91f2,_0x17e787['options']);return _0x5a6c64[_0xf1d4('0x99')](_0x5a91f2);}})['then'](function(_0x4e6313){if(_0x4e6313){_0x122251=_0x4e6313['length'];if(!_0x17e787[_0xf1d4('0x3a')]['hasOwnProperty']('nolimit')){_0x5a91f2[_0xf1d4('0x20')]=qs[_0xf1d4('0x20')](_0x17e787['query']['limit']);_0x5a91f2['offset']=qs['offset'](_0x17e787['query'][_0xf1d4('0x1f')]);}return _0x5a6c64[_0xf1d4('0x99')](_0x5a91f2);}})[_0xf1d4('0x27')](function(_0xfe6ab9){if(_0xfe6ab9){return _0xfe6ab9?{'count':_0x122251,'rows':_0xfe6ab9}:null;}})['then'](respondWithResult(_0x23ea22,null))['catch'](handleError(_0x23ea22,null));};function handleQuery(_0x4c2a2a){logger['info'](_0x4c2a2a);return db['sequelize'][_0xf1d4('0x3a')](_0x4c2a2a)[_0xf1d4('0x95')](function(_0x41f14d){csv_results[_0xf1d4('0x5e')](_0x41f14d);})[_0xf1d4('0x4c')](function(_0x519568){logger[_0xf1d4('0x2c')](_0x519568['message']);});} \ No newline at end of file +var _0x06a5=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','ListId','Disposition','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','pick','raw','getContactsCsv','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','field','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','select','description','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','sendStatus','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x06a5,0x12b));var _0x506a=function(_0x555aa9,_0x3a607f){_0x555aa9=_0x555aa9-0x0;var _0x20aecd=_0x06a5[_0x555aa9];return _0x20aecd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x506a('0x0'));var zipdir=require(_0x506a('0x1'));var jsonpatch=require(_0x506a('0x2'));var rp=require(_0x506a('0x3'));var moment=require(_0x506a('0x4'));var BPromise=require(_0x506a('0x5'));var Mustache=require(_0x506a('0x6'));var util=require(_0x506a('0x7'));var path=require(_0x506a('0x8'));var sox=require(_0x506a('0x9'));var csv=require(_0x506a('0xa'));var ejs=require(_0x506a('0xb'));var fs=require('fs');var fs_extra=require(_0x506a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x506a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x506a('0xe'));var toCsv=require(_0x506a('0xa'));var querystring=require(_0x506a('0xf'));var Papa=require('papaparse');var Redis=require(_0x506a('0x10'));var authService=require(_0x506a('0x11'));var qs=require(_0x506a('0x12'));var as=require(_0x506a('0x13'));var hardwareService=require(_0x506a('0x14'));var logger=require('../../config/logger')(_0x506a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x506a('0x16'));var db=require(_0x506a('0x17'))['db'];var csv_results;config[_0x506a('0x18')]=_['defaults'](config[_0x506a('0x18')],{'host':_0x506a('0x19'),'port':0x18eb});var socket=require(_0x506a('0x1a'))(new Redis(config[_0x506a('0x18')]));require(_0x506a('0x1b'))[_0x506a('0x1c')](socket);function respondWithStatusCode(_0x45b6d3,_0x8fa677){_0x8fa677=_0x8fa677||0xcc;return function(_0xad5d26){if(_0xad5d26){return _0x45b6d3['sendStatus'](_0x8fa677);}return _0x45b6d3['status'](_0x8fa677)[_0x506a('0x1d')]();};}function respondWithResult(_0x5c5afa,_0x284c96){_0x284c96=_0x284c96||0xc8;return function(_0x3f5f7d){if(_0x3f5f7d){return _0x5c5afa[_0x506a('0x1e')](_0x284c96)[_0x506a('0x1f')](_0x3f5f7d);}};}function respondWithFilteredResult(_0x5807f5,_0x4ad1e5){return function(_0x2a0d34){if(_0x2a0d34){var _0x5a2d16=typeof _0x4ad1e5[_0x506a('0x20')]===_0x506a('0x21')&&typeof _0x4ad1e5[_0x506a('0x22')]===_0x506a('0x21');var _0x357637=_0x2a0d34[_0x506a('0x23')];var _0x40c9cd=_0x5a2d16?0x0:_0x4ad1e5[_0x506a('0x20')];var _0xcfd07=_0x5a2d16?_0x2a0d34[_0x506a('0x23')]:_0x4ad1e5[_0x506a('0x20')]+_0x4ad1e5[_0x506a('0x22')];var _0xeeee0a;if(_0xcfd07>=_0x357637){_0xcfd07=_0x357637;_0xeeee0a=0xc8;}else{_0xeeee0a=0xce;}_0x5807f5[_0x506a('0x1e')](_0xeeee0a);return _0x5807f5[_0x506a('0x24')]('Content-Range',_0x40c9cd+'-'+_0xcfd07+'/'+_0x357637)[_0x506a('0x1f')](_0x2a0d34);}return null;};}function patchUpdates(_0x57e283){return function(_0x54d9f3){try{jsonpatch[_0x506a('0x25')](_0x54d9f3,_0x57e283,!![]);}catch(_0x4238e3){return BPromise['reject'](_0x4238e3);}return _0x54d9f3[_0x506a('0x26')]();};}function saveUpdates(_0x1c9b3f,_0x25f2a8){return function(_0x1886ca){if(_0x1886ca){return _0x1886ca[_0x506a('0x27')](_0x1c9b3f)[_0x506a('0x28')](function(_0xdf91c){return _0xdf91c;});}return null;};}function removeEntity(_0x59edf0,_0x36b1aa){return function(_0x29cdd1){if(_0x29cdd1){return _0x29cdd1[_0x506a('0x29')]()[_0x506a('0x28')](function(){var _0xd31abc=_0x29cdd1[_0x506a('0x2a')]({'plain':!![]});var _0x1a339c=_0x506a('0x2b');return db[_0x506a('0x2c')]['destroy']({'where':{'type':_0x1a339c,'resourceId':_0xd31abc['id']}})['then'](function(){return _0x29cdd1;});})[_0x506a('0x28')](function(){_0x59edf0[_0x506a('0x1e')](0xcc)[_0x506a('0x1d')]();});}};}function handleEntityNotFound(_0x64a8ca,_0x3ffda7){return function(_0x10039f){if(!_0x10039f){_0x64a8ca['sendStatus'](0x194);}return _0x10039f;};}function handleError(_0x2311a4,_0x2a924d){_0x2a924d=_0x2a924d||0x1f4;return function(_0x1d408b){logger[_0x506a('0x2d')](_0x1d408b[_0x506a('0x2e')]);if(_0x1d408b['name']){delete _0x1d408b[_0x506a('0x2f')];}_0x2311a4['status'](_0x2a924d)['send'](_0x1d408b);};}exports[_0x506a('0x30')]=function(_0x4925a4,_0x6870c6){var _0x25d5df={},_0x50a4f0={},_0x2dd370={'count':0x0,'rows':[]};var _0x11b6f7=_[_0x506a('0x31')](db[_0x506a('0x32')][_0x506a('0x33')],function(_0x40d50d){return{'name':_0x40d50d[_0x506a('0x34')],'type':_0x40d50d[_0x506a('0x35')][_0x506a('0x36')]};});_0x50a4f0['model']=_[_0x506a('0x31')](_0x11b6f7,'name');_0x50a4f0['query']=_[_0x506a('0x37')](_0x4925a4[_0x506a('0x38')]);_0x50a4f0[_0x506a('0x39')]=_[_0x506a('0x3a')](_0x50a4f0[_0x506a('0x3b')],_0x50a4f0[_0x506a('0x38')]);_0x25d5df[_0x506a('0x3c')]=_[_0x506a('0x3a')](_0x50a4f0[_0x506a('0x3b')],qs[_0x506a('0x3d')](_0x4925a4[_0x506a('0x38')][_0x506a('0x3d')]));_0x25d5df[_0x506a('0x3c')]=_0x25d5df[_0x506a('0x3c')][_0x506a('0x3e')]?_0x25d5df[_0x506a('0x3c')]:_0x50a4f0[_0x506a('0x3b')];if(!_0x4925a4[_0x506a('0x38')][_0x506a('0x3f')](_0x506a('0x40'))){_0x25d5df['limit']=qs[_0x506a('0x22')](_0x4925a4[_0x506a('0x38')][_0x506a('0x22')]);_0x25d5df[_0x506a('0x20')]=qs['offset'](_0x4925a4[_0x506a('0x38')][_0x506a('0x20')]);}_0x25d5df[_0x506a('0x41')]=qs[_0x506a('0x42')](_0x4925a4[_0x506a('0x38')]['sort']);_0x25d5df[_0x506a('0x43')]=qs[_0x506a('0x39')](_['pick'](_0x4925a4[_0x506a('0x38')],_0x50a4f0['filters']),_0x11b6f7);if(_0x4925a4[_0x506a('0x38')]['filter']){_0x25d5df[_0x506a('0x43')]=_[_0x506a('0x44')](_0x25d5df['where'],{'$or':_[_0x506a('0x31')](_0x11b6f7,function(_0x5a62bf){if(_0x5a62bf['type']!==_0x506a('0x45')){var _0x5d1f24={};_0x5d1f24[_0x5a62bf[_0x506a('0x2f')]]={'$like':'%'+_0x4925a4[_0x506a('0x38')][_0x506a('0x46')]+'%'};return _0x5d1f24;}})});}_0x25d5df=_['merge']({},_0x25d5df,_0x4925a4[_0x506a('0x47')]);var _0x18c115={'where':_0x25d5df[_0x506a('0x43')]};return db[_0x506a('0x32')][_0x506a('0x23')](_0x18c115)[_0x506a('0x28')](function(_0x56113d){_0x2dd370[_0x506a('0x23')]=_0x56113d;if(_0x4925a4[_0x506a('0x38')][_0x506a('0x48')]){_0x25d5df[_0x506a('0x49')]=[{'all':!![]}];}return db[_0x506a('0x32')][_0x506a('0x4a')](_0x25d5df);})[_0x506a('0x28')](function(_0x227ea4){_0x2dd370[_0x506a('0x4b')]=_0x227ea4;return _0x2dd370;})[_0x506a('0x28')](respondWithFilteredResult(_0x6870c6,_0x25d5df))['catch'](handleError(_0x6870c6,null));};exports['show']=function(_0x31f487,_0xdf043e){var _0x177289={'raw':![],'where':{'id':_0x31f487[_0x506a('0x4c')]['id']}},_0x39a39a={};_0x39a39a[_0x506a('0x3b')]=_[_0x506a('0x37')](db['CmList'][_0x506a('0x33')]);_0x39a39a[_0x506a('0x38')]=_[_0x506a('0x37')](_0x31f487[_0x506a('0x38')]);_0x39a39a['filters']=_['intersection'](_0x39a39a[_0x506a('0x3b')],_0x39a39a['query']);_0x177289[_0x506a('0x3c')]=_[_0x506a('0x3a')](_0x39a39a['model'],qs[_0x506a('0x3d')](_0x31f487['query'][_0x506a('0x3d')]));_0x177289[_0x506a('0x3c')]=_0x177289[_0x506a('0x3c')]['length']?_0x177289['attributes']:_0x39a39a[_0x506a('0x3b')];if(_0x31f487[_0x506a('0x38')]['includeAll']){_0x177289[_0x506a('0x49')]=[{'all':!![]}];}_0x177289=_['merge']({},_0x177289,_0x31f487[_0x506a('0x47')]);return db['CmList'][_0x506a('0x4d')](_0x177289)[_0x506a('0x28')](handleEntityNotFound(_0xdf043e,null))['then'](respondWithResult(_0xdf043e,null))[_0x506a('0x4e')](handleError(_0xdf043e,null));};exports[_0x506a('0x4f')]=function(_0x51d8a9,_0x3178a0){return db['CmList'][_0x506a('0x4f')](_0x51d8a9[_0x506a('0x50')],{})[_0x506a('0x28')](function(_0x3e3473){var _0x5775e7=_0x51d8a9['user'][_0x506a('0x2a')]({'plain':!![]});if(!_0x5775e7)throw new Error(_0x506a('0x51'));if(_0x5775e7[_0x506a('0x52')]==='user'){var _0x48bce9=_0x3e3473['get']({'plain':!![]});var _0x424d30=_0x506a('0x2b');return db['UserProfileSection'][_0x506a('0x4d')]({'where':{'name':_0x424d30,'userProfileId':_0x5775e7[_0x506a('0x53')]},'raw':!![]})[_0x506a('0x28')](function(_0x11f9d5){if(_0x11f9d5&&_0x11f9d5[_0x506a('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x48bce9[_0x506a('0x2f')],'resourceId':_0x48bce9['id'],'type':_0x11f9d5[_0x506a('0x2f')],'sectionId':_0x11f9d5['id']},{})[_0x506a('0x28')](function(){return _0x3e3473;});}else{return _0x3e3473;}})['catch'](function(_0x12abec){logger[_0x506a('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12abec);throw _0x12abec;});}return _0x3e3473;})['then'](respondWithResult(_0x3178a0,0xc9))['catch'](handleError(_0x3178a0,null));};exports['update']=function(_0x17d600,_0x329b35){if(_0x17d600[_0x506a('0x50')]['id']){delete _0x17d600[_0x506a('0x50')]['id'];}return db['CmList'][_0x506a('0x4d')]({'where':{'id':_0x17d600[_0x506a('0x4c')]['id']}})[_0x506a('0x28')](handleEntityNotFound(_0x329b35,null))[_0x506a('0x28')](saveUpdates(_0x17d600[_0x506a('0x50')],null))[_0x506a('0x28')](respondWithResult(_0x329b35,null))['catch'](handleError(_0x329b35,null));};exports['destroy']=function(_0x15667f,_0x5b0e56){return db[_0x506a('0x32')][_0x506a('0x4d')]({'where':{'id':_0x15667f[_0x506a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b0e56,null))[_0x506a('0x28')](removeEntity(_0x5b0e56,null))[_0x506a('0x4e')](handleError(_0x5b0e56,null));};exports[_0x506a('0x55')]=function(_0x4b7132,_0x414059){return db[_0x506a('0x32')]['describe']()['then'](respondWithResult(_0x414059,null))[_0x506a('0x4e')](handleError(_0x414059,null));};exports['addDisposition']=function(_0x5e8fca,_0x45e98f,_0x3e6fff){if(_0x5e8fca['body']['id']){delete _0x5e8fca['body']['id'];}return db[_0x506a('0x32')][_0x506a('0x4d')]({'where':{'id':_0x5e8fca[_0x506a('0x4c')]['id']}})[_0x506a('0x28')](handleEntityNotFound(_0x45e98f,null))[_0x506a('0x28')](function(_0x2051fc){if(_0x2051fc){_0x5e8fca[_0x506a('0x50')][_0x506a('0x56')]=_0x2051fc['id'];return db[_0x506a('0x57')]['create'](_0x5e8fca['body']);}})[_0x506a('0x28')](respondWithResult(_0x45e98f,null))[_0x506a('0x4e')](handleError(_0x45e98f,null));};exports['getDispositions']=function(_0x160b97,_0x434bcb,_0x39a3ac){var _0x35c322={'raw':![],'where':{}};var _0x1832af={};var _0x5ccf1d={'count':0x0,'rows':[]};return db[_0x506a('0x32')][_0x506a('0x58')]({'where':{'id':_0x160b97['params']['id']}})[_0x506a('0x28')](handleEntityNotFound(_0x434bcb,null))[_0x506a('0x28')](function(_0x544bb0){if(_0x544bb0){_0x1832af[_0x506a('0x3b')]=_[_0x506a('0x37')](db[_0x506a('0x57')]['rawAttributes']);_0x1832af[_0x506a('0x38')]=_[_0x506a('0x37')](_0x160b97[_0x506a('0x38')]);_0x1832af['filters']=_[_0x506a('0x3a')](_0x1832af['model'],_0x1832af[_0x506a('0x38')]);_0x35c322[_0x506a('0x3c')]=_[_0x506a('0x3a')](_0x1832af[_0x506a('0x3b')],qs[_0x506a('0x3d')](_0x160b97['query'][_0x506a('0x3d')]));_0x35c322[_0x506a('0x3c')]=_0x35c322[_0x506a('0x3c')][_0x506a('0x3e')]?_0x35c322[_0x506a('0x3c')]:_0x1832af[_0x506a('0x3b')];if(!_0x160b97[_0x506a('0x38')][_0x506a('0x3f')]('nolimit')){_0x35c322[_0x506a('0x22')]=qs[_0x506a('0x22')](_0x160b97[_0x506a('0x38')][_0x506a('0x22')]);_0x35c322['offset']=qs[_0x506a('0x20')](_0x160b97[_0x506a('0x38')][_0x506a('0x20')]);}_0x35c322[_0x506a('0x41')]=qs[_0x506a('0x42')](_0x160b97[_0x506a('0x38')][_0x506a('0x42')]);_0x35c322[_0x506a('0x43')]=qs[_0x506a('0x39')](_['pick'](_0x160b97[_0x506a('0x38')],_0x1832af[_0x506a('0x39')]));_0x35c322[_0x506a('0x43')][_0x506a('0x56')]=_0x544bb0['id'];if(_0x160b97[_0x506a('0x38')][_0x506a('0x46')]){_0x35c322[_0x506a('0x43')]=_['merge'](_0x35c322[_0x506a('0x43')],{'$or':_['map'](_0x35c322['attributes'],function(_0x500a96){var _0x17507d={};_0x17507d[_0x500a96]={'$like':'%'+_0x160b97[_0x506a('0x38')][_0x506a('0x46')]+'%'};return _0x17507d;})});}_0x35c322=_['merge']({},_0x35c322,_0x160b97[_0x506a('0x47')]);return db[_0x506a('0x57')][_0x506a('0x23')]({'where':_0x35c322[_0x506a('0x43')]})[_0x506a('0x28')](function(_0x2a1d00){_0x5ccf1d['count']=_0x2a1d00;if(_0x160b97[_0x506a('0x38')][_0x506a('0x48')]){_0x35c322[_0x506a('0x49')]=[{'all':!![]}];}return db[_0x506a('0x57')][_0x506a('0x4a')](_0x35c322);})[_0x506a('0x28')](function(_0x4faeaa){_0x5ccf1d[_0x506a('0x4b')]=_0x4faeaa;return _0x5ccf1d;});}})[_0x506a('0x28')](respondWithFilteredResult(_0x434bcb,_0x35c322))['catch'](handleError(_0x434bcb,null));};exports['removeDispositions']=function(_0x2eb8e2,_0x1145ce,_0x5cdc86){return db[_0x506a('0x32')][_0x506a('0x4d')]({'where':{'id':_0x2eb8e2[_0x506a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1145ce,null))[_0x506a('0x28')](function(_0x568ad1){if(_0x568ad1){return _0x568ad1[_0x506a('0x59')](_0x2eb8e2[_0x506a('0x38')][_0x506a('0x5a')]);}})['then'](respondWithStatusCode(_0x1145ce,null))['catch'](handleError(_0x1145ce,null));};exports[_0x506a('0x5b')]=function(_0x17824c,_0x396d7c,_0x60a7a6){return db[_0x506a('0x32')][_0x506a('0x4d')]({'where':{'id':_0x17824c[_0x506a('0x4c')]['id']}})[_0x506a('0x28')](handleEntityNotFound(_0x396d7c,null))[_0x506a('0x28')](function(_0x678cb0){if(_0x678cb0){var _0x5e1d94=[];var _0x319e9f={'success':[],'errors':[]};return db[_0x506a('0x5c')]['describe']()['then'](function(_0x48f135){if(_0x17824c[_0x506a('0x50')][_0x506a('0x5d')]&&_[_0x506a('0x5e')](_0x17824c[_0x506a('0x50')][_0x506a('0x5d')])){if(_0x17824c[_0x506a('0x50')]['tags']['length']){_0x17824c[_0x506a('0x50')][_0x506a('0x5d')]=_0x17824c[_0x506a('0x50')][_0x506a('0x5d')][_0x506a('0x5f')](';')+';';}else{_0x17824c[_0x506a('0x50')]['tags']=null;}}else{_0x17824c[_0x506a('0x50')]['tags']=null;}if(_0x17824c['body']&&_['isArray'](_0x17824c[_0x506a('0x50')])){for(var _0x8005a9=0x0;_0x8005a9<_0x17824c['body'][_0x506a('0x3e')];_0x8005a9+=0x1){_0x17824c[_0x506a('0x50')][_0x8005a9][_0x506a('0x56')]=_0x17824c['params']['id'];_0x5e1d94[_0x506a('0x60')](_0x17824c['body'][_0x8005a9]);}return BPromise[_0x506a('0x61')](_0x5e1d94,function(_0x311fcd){return db[_0x506a('0x5c')][_0x506a('0x4f')](_[_0x506a('0x62')](_0x311fcd,[_0x506a('0x5a'),'id'])||{},{'fields':_[_0x506a('0x37')](_0x48f135),'raw':!![]})[_0x506a('0x28')](function(_0x2e45c0){_0x319e9f[_0x506a('0x63')]['push'](_0x2e45c0['dataValues']);})[_0x506a('0x4e')](function(_0xb2d2fd){_0x319e9f[_0x506a('0x64')][_0x506a('0x60')]({'data':_0x311fcd,'error':_0xb2d2fd[_0x506a('0x65')]});});})['then'](function(_0x237da0){return _0x319e9f;})[_0x506a('0x4e')](function(_0x37fd8d){return _0x37fd8d;});}else{_0x396d7c[_0x506a('0x1e')](0x190)[_0x506a('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x396d7c,null))['catch'](handleError(_0x396d7c,null));};exports[_0x506a('0x66')]=function(_0x33cf44,_0x51f47e,_0x24c8e8){var _0x2a0aa9;return db[_0x506a('0x32')][_0x506a('0x4d')]({'where':{'id':_0x33cf44['params']['id']},'include':[{'model':db[_0x506a('0x67')],'as':_0x506a('0x68')}]})['then'](handleEntityNotFound(_0x51f47e,null))[_0x506a('0x28')](function(_0x16978a){if(_0x16978a){_0x2a0aa9=_0x16978a;return db[_0x506a('0x5c')][_0x506a('0x33')];}})[_0x506a('0x28')](function(_0x5ded81){if(_0x5ded81){var _0xfa8f40={};var _0x3f7e16={};_0x3f7e16[_0x506a('0x3b')]=_[_0x506a('0x69')](_[_0x506a('0x37')](_0x5ded81),_[_0x506a('0x31')](_0x2a0aa9[_0x506a('0x68')],function(_0x506468){return util[_0x506a('0x6a')](_0x506a('0x6b'),_0x506468['id']);}));_0x3f7e16[_0x506a('0x38')]=_[_0x506a('0x37')](_0x33cf44[_0x506a('0x38')]);_0x3f7e16[_0x506a('0x39')]=_[_0x506a('0x3a')](_0x3f7e16[_0x506a('0x3b')],_0x3f7e16[_0x506a('0x38')]);_0xfa8f40[_0x506a('0x3c')]=_[_0x506a('0x3a')](_0x3f7e16[_0x506a('0x3b')],qs[_0x506a('0x3d')](_0x33cf44[_0x506a('0x38')][_0x506a('0x3d')]));_0xfa8f40[_0x506a('0x3c')]=_0xfa8f40[_0x506a('0x3c')][_0x506a('0x3e')]?_0xfa8f40[_0x506a('0x3c')]:_0x3f7e16[_0x506a('0x3b')];if(!_0x33cf44['query'][_0x506a('0x3f')]('nolimit')){_0xfa8f40[_0x506a('0x22')]=qs['limit'](_0x33cf44[_0x506a('0x38')][_0x506a('0x22')]);_0xfa8f40[_0x506a('0x20')]=qs[_0x506a('0x20')](_0x33cf44[_0x506a('0x38')]['offset']);}_0xfa8f40[_0x506a('0x41')]=qs[_0x506a('0x42')](_0x33cf44['query'][_0x506a('0x42')]);_0xfa8f40['where']=qs[_0x506a('0x39')](_[_0x506a('0x6c')](_0x33cf44['query'],_0x3f7e16[_0x506a('0x39')]));_0xfa8f40[_0x506a('0x6d')]=!![];if(_0x33cf44[_0x506a('0x38')]['filter']){_0xfa8f40[_0x506a('0x43')]=_[_0x506a('0x44')](_0xfa8f40[_0x506a('0x43')],{'$or':_[_0x506a('0x31')](_0xfa8f40[_0x506a('0x3c')],function(_0x11b4ff){var _0x3f34fb={};_0x3f34fb[_0x11b4ff]={'$like':'%'+_0x33cf44[_0x506a('0x38')]['filter']+'%'};return _0x3f34fb;})});}_0xfa8f40=_[_0x506a('0x44')]({},_0xfa8f40,_0x33cf44[_0x506a('0x47')]);return _0x2a0aa9[_0x506a('0x66')](_0xfa8f40);}})[_0x506a('0x28')](respondWithResult(_0x51f47e,null))['catch'](handleError(_0x51f47e,null));};exports[_0x506a('0x6e')]=function(_0x55c33c,_0x52394d,_0x1b342b){var _0xa8c366;var _0x1dcb73;var _0x1f8168;var _0x1f9b41=_0x55c33c[_0x506a('0x4c')]['id'];csv_results=[];return db[_0x506a('0x6f')][_0x506a('0x4a')]({'attributes':['id',_0x506a('0x2f')],'raw':!![],'order':[_0x506a('0x70')]})[_0x506a('0x28')](function(_0x2ad53e){_0xa8c366=_0x2ad53e;var _0x173a60=_[_0x506a('0x37')](db[_0x506a('0x5c')][_0x506a('0x33')]);return db[_0x506a('0x67')][_0x506a('0x4a')]({'raw':!![],'attributes':['id',_0x506a('0x71')]})[_0x506a('0x28')](function(_0xfde3e0){_0x1dcb73=_0xfde3e0;var _0x49f740=squel['select']()[_0x506a('0x3d')](_0x173a60)[_0x506a('0x72')](_0x506a('0x73'),'c')[_0x506a('0x43')](_0x506a('0x74'),_0x1f9b41)[_0x506a('0x43')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x3dffd2=0x0;_0x3dffd2<_0x1dcb73[_0x506a('0x3e')];_0x3dffd2++){_0x49f740[_0x506a('0x75')]('c.cf_'+_0x1dcb73[_0x3dffd2]['id'],_0x506a('0x76')+_0x1dcb73[_0x3dffd2][_0x506a('0x71')]);}for(var _0x3dffd2=0x0;_0x3dffd2<_0xa8c366[_0x506a('0x3e')];_0x3dffd2++){_0x49f740['field'](squel['select']()['field'](_0x506a('0x77'))['from'](_0x506a('0x78'))[_0x506a('0x43')](_0x506a('0x79'),_0xa8c366[_0x3dffd2]['id'])[_0x506a('0x43')](_0x506a('0x7a')),_0x506a('0x7b')+_0xa8c366[_0x3dffd2][_0x506a('0x2f')]);_0x49f740['field'](squel[_0x506a('0x7c')]()[_0x506a('0x75')](_0x506a('0x7d'))[_0x506a('0x72')](_0x506a('0x78'))[_0x506a('0x43')]('ItemTypeId\x20=\x20?',_0xa8c366[_0x3dffd2]['id'])['where'](_0x506a('0x7a')),'description_additionalPhone_'+_0xa8c366[_0x3dffd2][_0x506a('0x2f')]);}var _0x3489bd=[];_0x3489bd[_0x506a('0x60')](_0x49f740[_0x506a('0x7e')]());BPromise[_0x506a('0x61')](_0x3489bd,handleQuery)[_0x506a('0x28')](function(_0x1a50f1){handleQuery(_0x49f740[_0x506a('0x7e')]());var _0x1b289f=csv_results[0x0];if(!_[_0x506a('0x7f')](_0x1b289f)){var _0x52ea3d=toCsv(_0x1b289f);var _0x48e927=Date[_0x506a('0x80')]();fs[_0x506a('0x81')](util['format'](_0x506a('0x82'),_0x1f9b41,_0x48e927),_0x52ea3d);_0x52394d['setHeader'](_0x506a('0x83'),_0x506a('0x84')+util[_0x506a('0x6a')](_0x506a('0x85'),_0x1f9b41,_0x48e927));_0x52394d[_0x506a('0x86')](_0x506a('0x87'),'text/csv');return _0x52394d['download'](util['format'](_0x506a('0x82'),_0x1f9b41,_0x48e927));}else{return _0x52394d[_0x506a('0x88')](0xcc);}});});});};exports[_0x506a('0x89')]=function(_0x5271f2,_0x2305c2,_0x591aab){var _0x1fd401;delete _0x5271f2[_0x506a('0x50')]['id'];return db['CmList'][_0x506a('0x58')]({'where':{'id':_0x5271f2[_0x506a('0x4c')]['id']}})[_0x506a('0x28')](handleEntityNotFound(_0x2305c2,null))[_0x506a('0x28')](function(_0x3de6fe){if(_0x3de6fe){return db[_0x506a('0x8a')]['transaction'](function(_0x3da571){return db[_0x506a('0x67')][_0x506a('0x4f')](_0x5271f2[_0x506a('0x50')],{'transaction':_0x3da571})[_0x506a('0x28')](function(_0x57936d){_0x1fd401=_0x57936d;return _0x3de6fe[_0x506a('0x8b')](_0x57936d,{'transaction':_0x3da571});})[_0x506a('0x28')](function(){var _0x3a47cc={'type':db[_0x506a('0x8c')][_0x506a('0x8d')],'transaction':_0x3da571};switch(_0x5271f2['body'][_0x506a('0x35')]){case _0x506a('0x8e'):_0x3a47cc[_0x506a('0x35')]=db[_0x506a('0x8c')]['TEXT'];break;case _0x506a('0x8f'):_0x3a47cc[_0x506a('0x35')]=db['Sequelize'][_0x506a('0x90')];break;case _0x506a('0x91'):_0x3a47cc[_0x506a('0x35')]=db['Sequelize']['BOOLEAN'];_0x3a47cc[_0x506a('0x92')]=![];break;default:}return db[_0x506a('0x8a')][_0x506a('0x93')][_0x506a('0x94')](_0x506a('0x73'),util[_0x506a('0x6a')]('cf_%s',_0x1fd401['id']),_0x3a47cc);})[_0x506a('0x28')](function(){return _0x1fd401;});});}})[_0x506a('0x28')](respondWithResult(_0x2305c2,null))[_0x506a('0x4e')](handleError(_0x2305c2,null));};exports['getCustomFields']=function(_0x59cf09,_0x1d9346,_0x3bcd4a){var _0x1107a7={};var _0x51a3c8={};var _0x26ee96;var _0x510fa5;return db['CmList'][_0x506a('0x58')]({'where':{'id':_0x59cf09[_0x506a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d9346,null))[_0x506a('0x28')](function(_0xb71cd2){if(_0xb71cd2){_0x26ee96=_0xb71cd2;_0x51a3c8[_0x506a('0x3b')]=_['keys'](db[_0x506a('0x67')][_0x506a('0x33')]);_0x51a3c8[_0x506a('0x38')]=_[_0x506a('0x37')](_0x59cf09[_0x506a('0x38')]);_0x51a3c8[_0x506a('0x39')]=_[_0x506a('0x3a')](_0x51a3c8[_0x506a('0x3b')],_0x51a3c8[_0x506a('0x38')]);_0x1107a7[_0x506a('0x3c')]=_['intersection'](_0x51a3c8['model'],qs[_0x506a('0x3d')](_0x59cf09['query'][_0x506a('0x3d')]));_0x1107a7['attributes']=_0x1107a7[_0x506a('0x3c')][_0x506a('0x3e')]?_0x1107a7[_0x506a('0x3c')]:_0x51a3c8['model'];_0x1107a7[_0x506a('0x41')]=qs[_0x506a('0x42')](_0x59cf09['query'][_0x506a('0x42')]);_0x1107a7[_0x506a('0x43')]=qs[_0x506a('0x39')](_[_0x506a('0x6c')](_0x59cf09['query'],_0x51a3c8['filters']));_0x1107a7['where']=_['merge'](_0x1107a7[_0x506a('0x43')],{'$or':[{'ListId':_0xb71cd2['id']},{'ListId':null}]});if(_0x59cf09[_0x506a('0x38')][_0x506a('0x46')]){_0x1107a7[_0x506a('0x43')]=_[_0x506a('0x44')](_0x1107a7['where'],{'$or':_['map'](_0x1107a7[_0x506a('0x3c')],function(_0x526603){var _0x54408d={};_0x54408d[_0x526603]={'$like':'%'+_0x59cf09[_0x506a('0x38')]['filter']+'%'};return _0x54408d;})});}_0x1107a7=_['merge']({},_0x1107a7,_0x59cf09[_0x506a('0x47')]);return db[_0x506a('0x67')][_0x506a('0x95')](_0x1107a7);}})['then'](respondWithResult(_0x1d9346,null))['catch'](handleError(_0x1d9346,null));};exports['getGlobalCustomFields']=function(_0x4ba636,_0x21c103){return db['CmCustomField'][_0x506a('0x95')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x21c103,null))[_0x506a('0x28')](function(_0x39b343){return _0x39b343;})[_0x506a('0x28')](respondWithResult(_0x21c103,null))[_0x506a('0x4e')](handleError(_0x21c103,null));};exports[_0x506a('0x96')]=function(_0x3f429e,_0xd2a9f9,_0x3e7daa){return db[_0x506a('0x32')][_0x506a('0x4d')]({'where':{'id':_0x3f429e[_0x506a('0x4c')]['id']}})[_0x506a('0x28')](handleEntityNotFound(_0xd2a9f9,null))[_0x506a('0x28')](function(_0x2a2354){if(_0x2a2354){return _0x2a2354[_0x506a('0x96')](_0x3f429e[_0x506a('0x50')]['ids'],_['omit'](_0x3f429e['body'],['ids','id'])||{})[_0x506a('0x97')](function(_0x591b91){for(var _0x41795b=0x0;_0x41795b<_0x3f429e['body']['ids'][_0x506a('0x3e')];_0x41795b+=0x1){socket[_0x506a('0x98')](_0x506a('0x99'),{'UserId':Number(_0x3f429e['body'][_0x506a('0x5a')][_0x41795b]),'CmListId':Number(_0x3f429e[_0x506a('0x4c')]['id'])});}return _0x591b91;});}})[_0x506a('0x28')](respondWithResult(_0xd2a9f9,null))[_0x506a('0x4e')](handleError(_0xd2a9f9,null));};exports[_0x506a('0x9a')]=function(_0x290db9,_0x38dced,_0x296c28){return db['CmList'][_0x506a('0x4d')]({'where':{'id':_0x290db9[_0x506a('0x4c')]['id']}})[_0x506a('0x28')](handleEntityNotFound(_0x38dced,null))[_0x506a('0x28')](function(_0x10c6ec){if(_0x10c6ec){return _0x10c6ec[_0x506a('0x9a')](_0x290db9['query'][_0x506a('0x5a')])[_0x506a('0x28')](function(){if(_[_0x506a('0x5e')](_0x290db9[_0x506a('0x38')]['ids'])){for(var _0x15ae3c=0x0;_0x15ae3c<_0x290db9[_0x506a('0x38')]['ids']['length'];_0x15ae3c+=0x1){socket[_0x506a('0x98')](_0x506a('0x9b'),{'UserId':Number(_0x290db9[_0x506a('0x38')][_0x506a('0x5a')][_0x15ae3c]),'CmListId':Number(_0x290db9[_0x506a('0x4c')]['id'])});}}else{socket[_0x506a('0x98')](_0x506a('0x9b'),{'UserId':Number(_0x290db9['query'][_0x506a('0x5a')]),'CmListId':Number(_0x290db9[_0x506a('0x4c')]['id'])});}});}})[_0x506a('0x28')](respondWithStatusCode(_0x38dced,null))[_0x506a('0x4e')](handleError(_0x38dced,null));};exports[_0x506a('0x9c')]=function(_0x12bf22,_0xd31122,_0x6d3a8c){var _0x293160={};var _0x373776={};var _0x3cfc57;var _0x2009f3;return db[_0x506a('0x32')]['findOne']({'where':{'id':_0x12bf22[_0x506a('0x4c')]['id']}})[_0x506a('0x28')](handleEntityNotFound(_0xd31122,null))[_0x506a('0x28')](function(_0x8516f){if(_0x8516f){_0x3cfc57=_0x8516f;_0x373776[_0x506a('0x3b')]=_['keys'](db[_0x506a('0x9d')][_0x506a('0x33')]);_0x373776[_0x506a('0x38')]=_[_0x506a('0x37')](_0x12bf22['query']);_0x373776[_0x506a('0x39')]=_[_0x506a('0x3a')](_0x373776[_0x506a('0x3b')],_0x373776['query']);_0x293160[_0x506a('0x3c')]=_['intersection'](_0x373776['model'],qs[_0x506a('0x3d')](_0x12bf22[_0x506a('0x38')][_0x506a('0x3d')]));_0x293160['attributes']=_0x293160[_0x506a('0x3c')][_0x506a('0x3e')]?_0x293160[_0x506a('0x3c')]:_0x373776[_0x506a('0x3b')];_0x293160[_0x506a('0x41')]=qs[_0x506a('0x42')](_0x12bf22[_0x506a('0x38')][_0x506a('0x42')]);_0x293160[_0x506a('0x43')]=qs[_0x506a('0x39')](_[_0x506a('0x6c')](_0x12bf22[_0x506a('0x38')],_0x373776[_0x506a('0x39')]));if(_0x12bf22[_0x506a('0x38')][_0x506a('0x46')]){_0x293160[_0x506a('0x43')]=_[_0x506a('0x44')](_0x293160['where'],{'$or':_[_0x506a('0x31')](_0x293160[_0x506a('0x3c')],function(_0x5cadb0){var _0x243207={};_0x243207[_0x5cadb0]={'$like':'%'+_0x12bf22[_0x506a('0x38')][_0x506a('0x46')]+'%'};return _0x243207;})});}_0x293160=_[_0x506a('0x44')]({},_0x293160,_0x12bf22['options']);return _0x3cfc57['getAgents'](_0x293160);}})[_0x506a('0x28')](function(_0x1a5ed7){if(_0x1a5ed7){_0x2009f3=_0x1a5ed7[_0x506a('0x3e')];if(!_0x12bf22[_0x506a('0x38')][_0x506a('0x3f')](_0x506a('0x40'))){_0x293160[_0x506a('0x22')]=qs[_0x506a('0x22')](_0x12bf22[_0x506a('0x38')]['limit']);_0x293160[_0x506a('0x20')]=qs[_0x506a('0x20')](_0x12bf22[_0x506a('0x38')][_0x506a('0x20')]);}return _0x3cfc57[_0x506a('0x9c')](_0x293160);}})[_0x506a('0x28')](function(_0x2fe94a){if(_0x2fe94a){return _0x2fe94a?{'count':_0x2009f3,'rows':_0x2fe94a}:null;}})[_0x506a('0x28')](respondWithResult(_0xd31122,null))[_0x506a('0x4e')](handleError(_0xd31122,null));};function handleQuery(_0x2a6e4b){logger[_0x506a('0x9e')](_0x2a6e4b);return db[_0x506a('0x8a')][_0x506a('0x38')](_0x2a6e4b)['spread'](function(_0x416741){csv_results[_0x506a('0x60')](_0x416741);})[_0x506a('0x4e')](function(_0x51f3d9){logger[_0x506a('0x2d')](_0x51f3d9['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 5a7315f..be4ed0a 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x356cf1,_0x136375){_0x356cf1=_0x356cf1-0x0;var _0x3f3568=_0xe14b[_0x356cf1];return _0x3f3568;};'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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x3a2213,_0x5eb75d){_0x3a2213=_0x3a2213-0x0;var _0x38a466=_0x3e74[_0x3a2213];return _0x38a466;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ba6b585..d78ccda 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','CmList','util'];(function(_0x35f24e,_0x552db3){var _0x4656ac=function(_0x5be49a){while(--_0x5be49a){_0x35f24e['push'](_0x35f24e['shift']());}};_0x4656ac(++_0x552db3);}(_0xedd9,0xfc));var _0x9edd=function(_0x1a4e06,_0x442dcd){_0x1a4e06=_0x1a4e06-0x0;var _0x19c18f=_0xedd9[_0x1a4e06];return _0x19c18f;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x501497,_0x6ab7ea){var _0x5460d2=function(_0xf94618){while(--_0xf94618){_0x501497['push'](_0x501497['shift']());}};_0x5460d2(++_0x6ab7ea);}(_0xe706,0xa3));var _0x6e70=function(_0x3fd7ab,_0x3dd0bc){_0x3fd7ab=_0x3fd7ab-0x0;var _0x56cb4b=_0xe706[_0x3fd7ab];return _0x56cb4b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 6654696..7e97255 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 _0xfa5f=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','./cmList.socket','register','request','info','request\x20sent','error','code','CmList,\x20%s,\x20%s'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xfa5f,0xb9));var _0xffa5=function(_0x453e85,_0x549523){_0x453e85=_0x453e85-0x0;var _0x4c5e6b=_0xfa5f[_0x453e85];return _0x4c5e6b;};'use strict';var _=require(_0xffa5('0x0'));var util=require(_0xffa5('0x1'));var moment=require('moment');var BPromise=require(_0xffa5('0x2'));var rs=require(_0xffa5('0x3'));var fs=require('fs');var Redis=require(_0xffa5('0x4'));var db=require(_0xffa5('0x5'))['db'];var utils=require(_0xffa5('0x6'));var logger=require(_0xffa5('0x7'))(_0xffa5('0x8'));var config=require(_0xffa5('0x9'));var jayson=require(_0xffa5('0xa'));var client=jayson[_0xffa5('0xb')][_0xffa5('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xffa5('0xd'))(new Redis(config[_0xffa5('0xe')]));require(_0xffa5('0xf'))[_0xffa5('0x10')](socket);function respondWithRpcPromise(_0x1c0118,_0x39c190,_0x35d480){return new BPromise(function(_0x406ccb,_0x5cfc0f){return client[_0xffa5('0x11')](_0x1c0118,_0x35d480)['then'](function(_0x4fbcc6){logger[_0xffa5('0x12')]('CmList,\x20%s,\x20%s',_0x39c190,_0xffa5('0x13'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x39c190,_0xffa5('0x13'),JSON['stringify'](_0x4fbcc6));if(_0x4fbcc6[_0xffa5('0x14')]){if(_0x4fbcc6[_0xffa5('0x14')][_0xffa5('0x15')]===0x1f4){logger[_0xffa5('0x14')](_0xffa5('0x16'),_0x39c190,_0x4fbcc6['error'][_0xffa5('0x17')]);return _0x5cfc0f(_0x4fbcc6[_0xffa5('0x14')]['message']);}logger[_0xffa5('0x14')](_0xffa5('0x16'),_0x39c190,_0x4fbcc6[_0xffa5('0x14')]['message']);return _0x406ccb(_0x4fbcc6[_0xffa5('0x14')][_0xffa5('0x17')]);}else{logger['info'](_0xffa5('0x16'),_0x39c190,_0xffa5('0x13'));_0x406ccb(_0x4fbcc6[_0xffa5('0x18')][_0xffa5('0x17')]);}})[_0xffa5('0x19')](function(_0x2eaec1){logger['error'](_0xffa5('0x16'),_0x39c190,_0x2eaec1);_0x5cfc0f(_0x2eaec1);});});} \ No newline at end of file +var _0x1fc7=['error','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./cmList.socket','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0x1fc7,0x163));var _0x71fc=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x1fc7[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x71fc('0x0'));var util=require(_0x71fc('0x1'));var moment=require(_0x71fc('0x2'));var BPromise=require(_0x71fc('0x3'));var rs=require(_0x71fc('0x4'));var fs=require('fs');var Redis=require(_0x71fc('0x5'));var db=require(_0x71fc('0x6'))['db'];var utils=require(_0x71fc('0x7'));var logger=require(_0x71fc('0x8'))(_0x71fc('0x9'));var config=require(_0x71fc('0xa'));var jayson=require(_0x71fc('0xb'));var client=jayson['client'][_0x71fc('0xc')]({'port':0x232a});config[_0x71fc('0xd')]=_[_0x71fc('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x71fc('0xf'))(new Redis(config[_0x71fc('0xd')]));require(_0x71fc('0x10'))['register'](socket);function respondWithRpcPromise(_0x2314cc,_0x4e7f44,_0x26fa2c){return new BPromise(function(_0x2c03e8,_0x3faf32){return client[_0x71fc('0x11')](_0x2314cc,_0x26fa2c)['then'](function(_0x5e22b4){logger[_0x71fc('0x12')]('CmList,\x20%s,\x20%s',_0x4e7f44,_0x71fc('0x13'));logger[_0x71fc('0x14')](_0x71fc('0x15'),_0x4e7f44,_0x71fc('0x13'),JSON[_0x71fc('0x16')](_0x5e22b4));if(_0x5e22b4[_0x71fc('0x17')]){if(_0x5e22b4[_0x71fc('0x17')]['code']===0x1f4){logger[_0x71fc('0x17')](_0x71fc('0x18'),_0x4e7f44,_0x5e22b4[_0x71fc('0x17')][_0x71fc('0x19')]);return _0x3faf32(_0x5e22b4[_0x71fc('0x17')][_0x71fc('0x19')]);}logger[_0x71fc('0x17')](_0x71fc('0x18'),_0x4e7f44,_0x5e22b4[_0x71fc('0x17')]['message']);return _0x2c03e8(_0x5e22b4['error'][_0x71fc('0x19')]);}else{logger[_0x71fc('0x12')](_0x71fc('0x18'),_0x4e7f44,'request\x20sent');_0x2c03e8(_0x5e22b4['result']['message']);}})[_0x71fc('0x1a')](function(_0x21989b){logger[_0x71fc('0x17')](_0x71fc('0x18'),_0x4e7f44,_0x21989b);_0x3faf32(_0x21989b);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 8203724..143df34 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 _0x51c7=['save','update','emit','removeListener','register','./cmList.events'];(function(_0x59197d,_0x58b050){var _0x4d206f=function(_0x1779ba){while(--_0x1779ba){_0x59197d['push'](_0x59197d['shift']());}};_0x4d206f(++_0x58b050);}(_0x51c7,0x1cd));var _0x751c=function(_0x10ff81,_0x15002e){_0x10ff81=_0x10ff81-0x0;var _0x49b5c9=_0x51c7[_0x10ff81];return _0x49b5c9;};'use strict';var CmListEvents=require(_0x751c('0x0'));var events=[_0x751c('0x1'),'remove',_0x751c('0x2')];function createListener(_0x411a37,_0x416865){return function(_0x154fba){_0x416865[_0x751c('0x3')](_0x411a37,_0x154fba);};}function removeListener(_0x5f103f,_0x54f31b){return function(){CmListEvents[_0x751c('0x4')](_0x5f103f,_0x54f31b);};}exports[_0x751c('0x5')]=function(_0x28e7f9){for(var _0x260cb8=0x0,_0x415431=events['length'];_0x260cb8<_0x415431;_0x260cb8++){var _0x3dc938=events[_0x260cb8];var _0xd6fb2=createListener('cmList:'+_0x3dc938,_0x28e7f9);CmListEvents['on'](_0x3dc938,_0xd6fb2);}}; \ No newline at end of file +var _0xc3d9=['length','cmList:','remove','emit','removeListener','register'];(function(_0x154c65,_0x186f04){var _0x10effc=function(_0x2a3be5){while(--_0x2a3be5){_0x154c65['push'](_0x154c65['shift']());}};_0x10effc(++_0x186f04);}(_0xc3d9,0x6e));var _0x9c3d=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xc3d9[_0x1afabf];return _0x497ff1;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x9c3d('0x0'),'update'];function createListener(_0x389e74,_0x1c287d){return function(_0x9f91e6){_0x1c287d[_0x9c3d('0x1')](_0x389e74,_0x9f91e6);};}function removeListener(_0x1f1647,_0x47a71a){return function(){CmListEvents[_0x9c3d('0x2')](_0x1f1647,_0x47a71a);};}exports[_0x9c3d('0x3')]=function(_0x20950d){for(var _0x40d482=0x0,_0x2458e8=events[_0x9c3d('0x4')];_0x40d482<_0x2458e8;_0x40d482++){var _0x4d7ddc=events[_0x40d482];var _0x179ec0=createListener(_0x9c3d('0x5')+_0x4d7ddc,_0x20950d);CmListEvents['on'](_0x4d7ddc,_0x179ec0);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3302a2c..4d36211 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 _0x433e=['removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','create','post','addDisposition','addContacts','/:id/fields','addAgents','update','delete','destroy','removeDispositions'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x433e,0xbf));var _0xe433=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x433e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe433('0x0'));var util=require(_0xe433('0x1'));var path=require(_0xe433('0x2'));var timeout=require(_0xe433('0x3'));var express=require(_0xe433('0x4'));var router=express[_0xe433('0x5')]();var fs_extra=require(_0xe433('0x6'));var auth=require(_0xe433('0x7'));var interaction=require(_0xe433('0x8'));var config=require(_0xe433('0x9'));var controller=require(_0xe433('0xa'));router[_0xe433('0xb')]('/',auth[_0xe433('0xc')](),controller[_0xe433('0xd')]);router[_0xe433('0xb')](_0xe433('0xe'),auth[_0xe433('0xc')](),controller[_0xe433('0xf')]);router[_0xe433('0xb')](_0xe433('0x10'),auth['isAuthenticated'](),controller[_0xe433('0x11')]);router[_0xe433('0xb')](_0xe433('0x12'),auth['isAuthenticated'](),controller[_0xe433('0x13')]);router['get'](_0xe433('0x14'),auth['isAuthenticated'](),controller[_0xe433('0x15')]);router[_0xe433('0xb')](_0xe433('0x16'),auth[_0xe433('0xc')](),controller[_0xe433('0x17')]);router[_0xe433('0xb')](_0xe433('0x18'),auth[_0xe433('0xc')](),controller[_0xe433('0x19')]);router[_0xe433('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getCustomFields']);router['get'](_0xe433('0x1a'),auth[_0xe433('0xc')](),controller['getAgents']);router['post']('/',auth[_0xe433('0xc')](),controller[_0xe433('0x1b')]);router[_0xe433('0x1c')](_0xe433('0x14'),auth['isAuthenticated'](),controller[_0xe433('0x1d')]);router['post'](_0xe433('0x16'),auth[_0xe433('0xc')](),controller[_0xe433('0x1e')]);router[_0xe433('0x1c')](_0xe433('0x1f'),auth[_0xe433('0xc')](),controller['addCustomField']);router[_0xe433('0x1c')](_0xe433('0x1a'),auth[_0xe433('0xc')](),controller[_0xe433('0x20')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe433('0x21')]);router[_0xe433('0x22')](_0xe433('0x12'),auth['isAuthenticated'](),controller[_0xe433('0x23')]);router['delete']('/:id/dispositions',auth[_0xe433('0xc')](),controller[_0xe433('0x24')]);router[_0xe433('0x22')]('/:id/users',auth[_0xe433('0xc')](),controller[_0xe433('0x25')]);module['exports']=router; \ No newline at end of file +var _0xd661=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','get','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','update','delete','/:id','destroy','removeAgents','exports'];(function(_0x9163f5,_0x776cef){var _0x3c879d=function(_0xf7545c){while(--_0xf7545c){_0x9163f5['push'](_0x9163f5['shift']());}};_0x3c879d(++_0x776cef);}(_0xd661,0x197));var _0x1d66=function(_0x450682,_0x201a06){_0x450682=_0x450682-0x0;var _0x1c56bb=_0xd661[_0x450682];return _0x1c56bb;};'use strict';var multer=require(_0x1d66('0x0'));var util=require('util');var path=require(_0x1d66('0x1'));var timeout=require('connect-timeout');var express=require(_0x1d66('0x2'));var router=express[_0x1d66('0x3')]();var fs_extra=require(_0x1d66('0x4'));var auth=require(_0x1d66('0x5'));var interaction=require(_0x1d66('0x6'));var config=require(_0x1d66('0x7'));var controller=require(_0x1d66('0x8'));router['get']('/',auth[_0x1d66('0x9')](),controller['index']);router[_0x1d66('0xa')](_0x1d66('0xb'),auth[_0x1d66('0x9')](),controller[_0x1d66('0xc')]);router[_0x1d66('0xa')](_0x1d66('0xd'),auth['isAuthenticated'](),controller[_0x1d66('0xe')]);router[_0x1d66('0xa')]('/:id',auth[_0x1d66('0x9')](),controller[_0x1d66('0xf')]);router[_0x1d66('0xa')](_0x1d66('0x10'),auth['isAuthenticated'](),controller[_0x1d66('0x11')]);router[_0x1d66('0xa')](_0x1d66('0x12'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x13')]);router[_0x1d66('0xa')](_0x1d66('0x14'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x15')]);router[_0x1d66('0xa')]('/:id/fields',auth[_0x1d66('0x9')](),controller['getCustomFields']);router[_0x1d66('0xa')](_0x1d66('0x16'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x17')]);router[_0x1d66('0x18')]('/',auth[_0x1d66('0x9')](),controller['create']);router[_0x1d66('0x18')](_0x1d66('0x10'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x19')]);router[_0x1d66('0x18')](_0x1d66('0x12'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x1a')]);router[_0x1d66('0x18')](_0x1d66('0x1b'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x1c')]);router[_0x1d66('0x18')](_0x1d66('0x16'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x1d')]);router[_0x1d66('0x1e')]('/:id',auth[_0x1d66('0x9')](),controller[_0x1d66('0x1f')]);router[_0x1d66('0x20')](_0x1d66('0x21'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x22')]);router['delete'](_0x1d66('0x10'),auth[_0x1d66('0x9')](),controller['removeDispositions']);router[_0x1d66('0x20')](_0x1d66('0x16'),auth[_0x1d66('0x9')](),controller[_0x1d66('0x23')]);module[_0x1d66('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d637b53..ee829b3 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 _0x5616=['VIRTUAL','getDataValue','field','STRING','exports'];(function(_0x5e1248,_0x42b862){var _0x1b4201=function(_0x534a23){while(--_0x534a23){_0x5e1248['push'](_0x5e1248['shift']());}};_0x1b4201(++_0x42b862);}(_0x5616,0x77));var _0x6561=function(_0x520552,_0x568c01){_0x520552=_0x520552-0x0;var _0x545f39=_0x5616[_0x520552];return _0x545f39;};'use strict';var Sequelize=require('sequelize');module[_0x6561('0x0')]={'name':{'type':Sequelize[_0x6561('0x1')],'get':function(_0x49e9bd){return this[_0x6561('0x2')](_0x6561('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x6561('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x6561('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x51ba=['sequelize','exports','field','STRING'];(function(_0x5a16a6,_0x13eaa0){var _0x48e7b8=function(_0x4f0b7a){while(--_0x4f0b7a){_0x5a16a6['push'](_0x5a16a6['shift']());}};_0x48e7b8(++_0x13eaa0);}(_0x51ba,0x130));var _0xa51b=function(_0x2d5eaf,_0x3885a1){_0x2d5eaf=_0x2d5eaf-0x0;var _0x510319=_0x51ba[_0x2d5eaf];return _0x510319;};'use strict';var Sequelize=require(_0xa51b('0x0'));module[_0xa51b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x50d303){return this['getDataValue'](_0xa51b('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xa51b('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xa51b('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 6edfc72..e91aeba 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xd64064,_0xe5ccd5){var _0x319101=function(_0x266e6e){while(--_0x266e6e){_0xd64064['push'](_0xd64064['shift']());}};_0x319101(++_0xe5ccd5);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5873f0,_0x40f2d0){var _0x36071b=function(_0x5136d1){while(--_0x5136d1){_0x5873f0['push'](_0x5873f0['shift']());}};_0x36071b(++_0x40f2d0);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 a3279a0..8388e6d 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 _0x273f=['tools_conditions','util','api','moment','bluebird','path','../../config/environment','./condition.attributes','define'];(function(_0x1d7791,_0x2a291f){var _0x2293f8=function(_0x464734){while(--_0x464734){_0x1d7791['push'](_0x1d7791['shift']());}};_0x2293f8(++_0x2a291f);}(_0x273f,0x1b1));var _0xf273=function(_0x4dcae6,_0x2fa7d9){_0x4dcae6=_0x4dcae6-0x0;var _0x5cb1e2=_0x273f[_0x4dcae6];return _0x5cb1e2;};'use strict';var _=require('lodash');var util=require(_0xf273('0x0'));var logger=require('../../config/logger')(_0xf273('0x1'));var moment=require(_0xf273('0x2'));var BPromise=require(_0xf273('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf273('0x4'));var rimraf=require('rimraf');var config=require(_0xf273('0x5'));var attributes=require(_0xf273('0x6'));module['exports']=function(_0x258d27,_0x295d17){return _0x258d27[_0xf273('0x7')]('Condition',attributes,{'tableName':_0xf273('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1597=['define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c4a8b,_0x402020){var _0x20fa14=function(_0xbe8c84){while(--_0xbe8c84){_0x4c4a8b['push'](_0x4c4a8b['shift']());}};_0x20fa14(++_0x402020);}(_0x1597,0x19b));var _0x7159=function(_0xdd2348,_0x5d3232){_0xdd2348=_0xdd2348-0x0;var _0x2e0a02=_0x1597[_0xdd2348];return _0x2e0a02;};'use strict';var _=require(_0x7159('0x0'));var util=require(_0x7159('0x1'));var logger=require(_0x7159('0x2'))(_0x7159('0x3'));var moment=require(_0x7159('0x4'));var BPromise=require(_0x7159('0x5'));var rp=require(_0x7159('0x6'));var fs=require('fs');var path=require(_0x7159('0x7'));var rimraf=require(_0x7159('0x8'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module['exports']=function(_0x1c01ca,_0x54a6f9){return _0x1c01ca[_0x7159('0x9')](_0x7159('0xa'),attributes,{'tableName':_0x7159('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index e46f099..29cb8c1 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 _0x9281=['http','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x9281,0xc4));var _0x1928=function(_0x5d2e14,_0x1111f6){_0x5d2e14=_0x5d2e14-0x0;var _0x22b851=_0x9281[_0x5d2e14];return _0x22b851;};'use strict';var _=require(_0x1928('0x0'));var util=require(_0x1928('0x1'));var moment=require(_0x1928('0x2'));var BPromise=require(_0x1928('0x3'));var rs=require(_0x1928('0x4'));var fs=require('fs');var Redis=require(_0x1928('0x5'));var db=require(_0x1928('0x6'))['db'];var utils=require(_0x1928('0x7'));var logger=require(_0x1928('0x8'))(_0x1928('0x9'));var config=require('../../config/environment');var jayson=require(_0x1928('0xa'));var client=jayson[_0x1928('0xb')][_0x1928('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe2f2bd,_0x4d23b2,_0x56188a){return new BPromise(function(_0x250176,_0x387a97){return client[_0x1928('0xd')](_0xe2f2bd,_0x56188a)[_0x1928('0xe')](function(_0x258a67){logger['info']('Condition,\x20%s,\x20%s',_0x4d23b2,_0x1928('0xf'));logger[_0x1928('0x10')](_0x1928('0x11'),_0x4d23b2,_0x1928('0xf'),JSON[_0x1928('0x12')](_0x258a67));if(_0x258a67[_0x1928('0x13')]){if(_0x258a67[_0x1928('0x13')][_0x1928('0x14')]===0x1f4){logger[_0x1928('0x13')]('Condition,\x20%s,\x20%s',_0x4d23b2,_0x258a67[_0x1928('0x13')]['message']);return _0x387a97(_0x258a67[_0x1928('0x13')][_0x1928('0x15')]);}logger[_0x1928('0x13')](_0x1928('0x16'),_0x4d23b2,_0x258a67[_0x1928('0x13')][_0x1928('0x15')]);return _0x250176(_0x258a67['error'][_0x1928('0x15')]);}else{logger[_0x1928('0x17')](_0x1928('0x16'),_0x4d23b2,'request\x20sent');_0x250176(_0x258a67[_0x1928('0x18')][_0x1928('0x15')]);}})[_0x1928('0x19')](function(_0x311383){logger[_0x1928('0x13')]('Condition,\x20%s,\x20%s',_0x4d23b2,_0x311383);_0x387a97(_0x311383);});});} \ No newline at end of file +var _0x4ffd=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0x4ffd,0x1cf));var _0xd4ff=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x4ffd[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xd4ff('0x0'));var util=require(_0xd4ff('0x1'));var moment=require(_0xd4ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4ff('0x3'));var fs=require('fs');var Redis=require(_0xd4ff('0x4'));var db=require(_0xd4ff('0x5'))['db'];var utils=require(_0xd4ff('0x6'));var logger=require(_0xd4ff('0x7'))(_0xd4ff('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd4ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d14be,_0x770223,_0x483d4c){return new BPromise(function(_0x3d6944,_0x305817){return client[_0xd4ff('0xa')](_0x3d14be,_0x483d4c)['then'](function(_0x27e9bf){logger[_0xd4ff('0xb')](_0xd4ff('0xc'),_0x770223,_0xd4ff('0xd'));logger['debug'](_0xd4ff('0xe'),_0x770223,_0xd4ff('0xd'),JSON[_0xd4ff('0xf')](_0x27e9bf));if(_0x27e9bf[_0xd4ff('0x10')]){if(_0x27e9bf[_0xd4ff('0x10')][_0xd4ff('0x11')]===0x1f4){logger[_0xd4ff('0x10')](_0xd4ff('0xc'),_0x770223,_0x27e9bf[_0xd4ff('0x10')][_0xd4ff('0x12')]);return _0x305817(_0x27e9bf[_0xd4ff('0x10')][_0xd4ff('0x12')]);}logger['error'](_0xd4ff('0xc'),_0x770223,_0x27e9bf[_0xd4ff('0x10')]['message']);return _0x3d6944(_0x27e9bf[_0xd4ff('0x10')][_0xd4ff('0x12')]);}else{logger[_0xd4ff('0xb')](_0xd4ff('0xc'),_0x770223,_0xd4ff('0xd'));_0x3d6944(_0x27e9bf[_0xd4ff('0x13')][_0xd4ff('0x12')]);}})[_0xd4ff('0x14')](function(_0x56fa51){logger['error'](_0xd4ff('0xc'),_0x770223,_0x56fa51);_0x305817(_0x56fa51);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 50aa7a9..96f68e2 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 _0x83ef=['../../components/interaction/service','../../config/environment','/:id','isAuthenticated','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x143a86,_0x18ee76){var _0x213922=function(_0x7ed4eb){while(--_0x7ed4eb){_0x143a86['push'](_0x143a86['shift']());}};_0x213922(++_0x18ee76);}(_0x83ef,0x124));var _0xf83e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x83ef[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xf83e('0x0'));var util=require('util');var path=require(_0xf83e('0x1'));var timeout=require(_0xf83e('0x2'));var express=require(_0xf83e('0x3'));var router=express[_0xf83e('0x4')]();var fs_extra=require(_0xf83e('0x5'));var auth=require(_0xf83e('0x6'));var interaction=require(_0xf83e('0x7'));var config=require(_0xf83e('0x8'));var controller=require('./condition.controller');router['put'](_0xf83e('0x9'),auth[_0xf83e('0xa')](),controller['update']);router[_0xf83e('0xb')](_0xf83e('0x9'),auth[_0xf83e('0xa')](),controller['destroy']);module[_0xf83e('0xc')]=router; \ No newline at end of file +var _0xc753=['/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./condition.controller','put','isAuthenticated','update','delete'];(function(_0x28b18c,_0x499e63){var _0x1d0b40=function(_0x11d49f){while(--_0x11d49f){_0x28b18c['push'](_0x28b18c['shift']());}};_0x1d0b40(++_0x499e63);}(_0xc753,0x18b));var _0x3c75=function(_0x13502c,_0x118965){_0x13502c=_0x13502c-0x0;var _0x3739a9=_0xc753[_0x13502c];return _0x3739a9;};'use strict';var multer=require('multer');var util=require(_0x3c75('0x0'));var path=require('path');var timeout=require(_0x3c75('0x1'));var express=require(_0x3c75('0x2'));var router=express[_0x3c75('0x3')]();var fs_extra=require(_0x3c75('0x4'));var auth=require(_0x3c75('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c75('0x6'));router[_0x3c75('0x7')]('/:id',auth[_0x3c75('0x8')](),controller[_0x3c75('0x9')]);router[_0x3c75('0xa')](_0x3c75('0xb'),auth['isAuthenticated'](),controller[_0x3c75('0xc')]);module[_0x3c75('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 4374c12..9c18196 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc529=['STRING','sequelize','name','INTEGER'];(function(_0x5bc763,_0x542561){var _0x37f31a=function(_0x4e0eac){while(--_0x4e0eac){_0x5bc763['push'](_0x5bc763['shift']());}};_0x37f31a(++_0x542561);}(_0xc529,0xa9));var _0x9c52=function(_0xc80d54,_0x39a6a7){_0xc80d54=_0xc80d54-0x0;var _0x308fc6=_0xc529[_0xc80d54];return _0x308fc6;};'use strict';var Sequelize=require(_0x9c52('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9c52('0x1')},'OrderBy':{'type':Sequelize[_0x9c52('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9c52('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0xc939=['INTEGER','sequelize','exports','STRING','name'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xc939,0x187));var _0x9c93=function(_0xfbdb0d,_0x1dc1c5){_0xfbdb0d=_0xfbdb0d-0x0;var _0x4c6097=_0xc939[_0xfbdb0d];return _0x4c6097;};'use strict';var Sequelize=require(_0x9c93('0x0'));module[_0x9c93('0x1')]={'name':{'type':Sequelize[_0x9c93('0x2')],'allowNull':![],'unique':_0x9c93('0x3')},'OrderBy':{'type':Sequelize[_0x9c93('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9c93('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index c7ccd2e..85703cb 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1399=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName'];(function(_0x151916,_0x14f185){var _0x4e059d=function(_0x484d54){while(--_0x484d54){_0x151916['push'](_0x151916['shift']());}};_0x4e059d(++_0x14f185);}(_0x1399,0x16c));var _0x9139=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x1399[_0x46cf00];return _0x3974dc;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){var _0x31c22d=_0x1a7350['get']({'plain':!![]});var _0x3ed4da=_0x9139('0x23');return db[_0x9139('0x24')]['destroy']({'where':{'type':_0x3ed4da,'resourceId':_0x31c22d['id']}})[_0x9139('0x22')](function(){return _0x1a7350;});})[_0x9139('0x22')](function(){_0x1aee3b['status'](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x39e8cf,_0x452d9a){return function(_0x55e95f){if(!_0x55e95f){_0x39e8cf[_0x9139('0x25')](0x194);}return _0x55e95f;};}function handleError(_0x22e11e,_0x2a35fd){_0x2a35fd=_0x2a35fd||0x1f4;return function(_0x22994c){logger[_0x9139('0x26')](_0x22994c[_0x9139('0x27')]);if(_0x22994c[_0x9139('0x28')]){delete _0x22994c['name'];}_0x22e11e['status'](_0x2a35fd)[_0x9139('0x29')](_0x22994c);};}exports[_0x9139('0x2a')]=function(_0xd27355,_0x4c1693){var _0x50d545={},_0x24e8d5={},_0x2118a2={'count':0x0,'rows':[]};var _0x2dff49=_[_0x9139('0x2b')](db[_0x9139('0x2c')]['rawAttributes'],function(_0x5a1673){return{'name':_0x5a1673[_0x9139('0x2d')],'type':_0x5a1673['type']['key']};});_0x24e8d5[_0x9139('0x2e')]=_[_0x9139('0x2b')](_0x2dff49,'name');_0x24e8d5[_0x9139('0x2f')]=_[_0x9139('0x30')](_0xd27355['query']);_0x24e8d5[_0x9139('0x31')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],_0x24e8d5[_0x9139('0x2f')]);_0x50d545[_0x9139('0x33')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],qs[_0x9139('0x34')](_0xd27355[_0x9139('0x2f')][_0x9139('0x34')]));_0x50d545[_0x9139('0x33')]=_0x50d545['attributes'][_0x9139('0x35')]?_0x50d545[_0x9139('0x33')]:_0x24e8d5['model'];if(!_0xd27355[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x50d545['limit']=qs[_0x9139('0x1a')](_0xd27355[_0x9139('0x2f')][_0x9139('0x1a')]);_0x50d545[_0x9139('0x18')]=qs[_0x9139('0x18')](_0xd27355[_0x9139('0x2f')][_0x9139('0x18')]);}_0x50d545[_0x9139('0x38')]=qs[_0x9139('0x39')](_0xd27355[_0x9139('0x2f')]['sort']);_0x50d545[_0x9139('0x3a')]=qs[_0x9139('0x31')](_[_0x9139('0x3b')](_0xd27355[_0x9139('0x2f')],_0x24e8d5[_0x9139('0x31')]),_0x2dff49);if(_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]){_0x50d545['where']=_[_0x9139('0x3d')](_0x50d545['where'],{'$or':_[_0x9139('0x2b')](_0x2dff49,function(_0x11789e){if(_0x11789e[_0x9139('0x3e')]!=='VIRTUAL'){var _0x1228b6={};_0x1228b6[_0x11789e[_0x9139('0x28')]]={'$like':'%'+_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x1228b6;}})});}_0x50d545=_[_0x9139('0x3d')]({},_0x50d545,_0xd27355[_0x9139('0x3f')]);var _0x3c98a4={'where':_0x50d545[_0x9139('0x3a')]};return db[_0x9139('0x2c')][_0x9139('0x40')](_0x3c98a4)['then'](function(_0xf14393){_0x2118a2[_0x9139('0x40')]=_0xf14393;if(_0xd27355[_0x9139('0x2f')]['includeAll']){_0x50d545['include']=[{'all':!![]}];}return db['ContactItemType'][_0x9139('0x41')](_0x50d545);})[_0x9139('0x22')](function(_0x3611b4){_0x2118a2[_0x9139('0x42')]=_0x3611b4;return _0x2118a2;})[_0x9139('0x22')](respondWithFilteredResult(_0x4c1693,_0x50d545))['catch'](handleError(_0x4c1693,null));};exports[_0x9139('0x43')]=function(_0x2f3ed4,_0x40fd52){var _0xf81f77={'raw':!![],'where':{'id':_0x2f3ed4['params']['id']}},_0x2197ff={};_0x2197ff[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2197ff['query']=_['keys'](_0x2f3ed4[_0x9139('0x2f')]);_0x2197ff[_0x9139('0x31')]=_['intersection'](_0x2197ff['model'],_0x2197ff[_0x9139('0x2f')]);_0xf81f77[_0x9139('0x33')]=_['intersection'](_0x2197ff[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2f3ed4['query'][_0x9139('0x34')]));_0xf81f77['attributes']=_0xf81f77['attributes'][_0x9139('0x35')]?_0xf81f77[_0x9139('0x33')]:_0x2197ff[_0x9139('0x2e')];if(_0x2f3ed4[_0x9139('0x2f')][_0x9139('0x45')]){_0xf81f77['include']=[{'all':!![]}];}_0xf81f77=_[_0x9139('0x3d')]({},_0xf81f77,_0x2f3ed4[_0x9139('0x3f')]);return db[_0x9139('0x2c')]['find'](_0xf81f77)[_0x9139('0x22')](handleEntityNotFound(_0x40fd52,null))[_0x9139('0x22')](respondWithResult(_0x40fd52,null))[_0x9139('0x46')](handleError(_0x40fd52,null));};exports[_0x9139('0x47')]=function(_0x215793,_0x31395f){return db[_0x9139('0x2c')][_0x9139('0x47')](_0x215793[_0x9139('0x48')],{})[_0x9139('0x22')](function(_0x2da28c){var _0x54c926=_0x215793[_0x9139('0x49')][_0x9139('0x4a')]({'plain':!![]});if(!_0x54c926)throw new Error(_0x9139('0x4b'));if(_0x54c926['role']===_0x9139('0x49')){var _0x46f77a=_0x2da28c['get']({'plain':!![]});var _0x2f4a6f=_0x9139('0x23');return db[_0x9139('0x4c')]['find']({'where':{'name':_0x2f4a6f,'userProfileId':_0x54c926[_0x9139('0x4d')]},'raw':!![]})[_0x9139('0x22')](function(_0x1404ce){if(_0x1404ce&&_0x1404ce[_0x9139('0x4e')]===0x0){return db['UserProfileResource'][_0x9139('0x47')]({'name':_0x46f77a[_0x9139('0x28')],'resourceId':_0x46f77a['id'],'type':_0x1404ce[_0x9139('0x28')],'sectionId':_0x1404ce['id']},{})['then'](function(){return _0x2da28c;});}else{return _0x2da28c;}})[_0x9139('0x46')](function(_0x146201){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x146201);throw _0x146201;});}return _0x2da28c;})[_0x9139('0x22')](respondWithResult(_0x31395f,0xc9))[_0x9139('0x46')](handleError(_0x31395f,null));};exports[_0x9139('0x21')]=function(_0x5857bf,_0x35002d){if(_0x5857bf[_0x9139('0x48')]['id']){delete _0x5857bf['body']['id'];}return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x5857bf[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x35002d,null))[_0x9139('0x22')](saveUpdates(_0x5857bf['body'],null))[_0x9139('0x22')](respondWithResult(_0x35002d,null))[_0x9139('0x46')](handleError(_0x35002d,null));};exports['destroy']=function(_0x500863,_0x212d56){return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x500863['params']['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x212d56,null))['then'](db['CmContactHasItem'][_0x9139('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x500863[_0x9139('0x51')]['id']}}))[_0x9139('0x22')](removeEntity(_0x212d56,null))[_0x9139('0x46')](handleError(_0x212d56,null));}; \ No newline at end of file +var _0x1a37=['includeAll','include','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','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','get','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1a37,0xb4));var _0x71a3=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x1a37[_0x1d9aa0];return _0x226868;};'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(){var _0xb9c195=_0x5f33c5[_0x71a3('0x26')]({'plain':!![]});var _0xb0f3aa='ContactItemTypes';return db[_0x71a3('0x27')][_0x71a3('0x25')]({'where':{'type':_0xb0f3aa,'resourceId':_0xb9c195['id']}})['then'](function(){return _0x5f33c5;});})[_0x71a3('0x24')](function(){_0x452bc4['status'](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0x2fd3b6,_0x211ea8){return function(_0x35b5c7){if(!_0x35b5c7){_0x2fd3b6[_0x71a3('0x18')](0x194);}return _0x35b5c7;};}function handleError(_0x314439,_0x2317ec){_0x2317ec=_0x2317ec||0x1f4;return function(_0x242b85){logger[_0x71a3('0x28')](_0x242b85[_0x71a3('0x29')]);if(_0x242b85[_0x71a3('0x2a')]){delete _0x242b85[_0x71a3('0x2a')];}_0x314439['status'](_0x2317ec)[_0x71a3('0x2b')](_0x242b85);};}exports[_0x71a3('0x2c')]=function(_0x334db0,_0x23ae85){var _0x4a750c={},_0x18a8fe={},_0x216d84={'count':0x0,'rows':[]};var _0x45d13d=_[_0x71a3('0x2d')](db[_0x71a3('0x2e')][_0x71a3('0x2f')],function(_0x1d09bd){return{'name':_0x1d09bd['fieldName'],'type':_0x1d09bd[_0x71a3('0x30')][_0x71a3('0x31')]};});_0x18a8fe[_0x71a3('0x32')]=_[_0x71a3('0x2d')](_0x45d13d,_0x71a3('0x2a'));_0x18a8fe[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x334db0[_0x71a3('0x33')]);_0x18a8fe[_0x71a3('0x35')]=_[_0x71a3('0x36')](_0x18a8fe[_0x71a3('0x32')],_0x18a8fe[_0x71a3('0x33')]);_0x4a750c[_0x71a3('0x37')]=_['intersection'](_0x18a8fe['model'],qs[_0x71a3('0x38')](_0x334db0[_0x71a3('0x33')]['fields']));_0x4a750c[_0x71a3('0x37')]=_0x4a750c[_0x71a3('0x37')]['length']?_0x4a750c[_0x71a3('0x37')]:_0x18a8fe[_0x71a3('0x32')];if(!_0x334db0[_0x71a3('0x33')][_0x71a3('0x39')](_0x71a3('0x3a'))){_0x4a750c[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x334db0['query'][_0x71a3('0x1d')]);_0x4a750c[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x334db0['query'][_0x71a3('0x1b')]);}_0x4a750c[_0x71a3('0x3b')]=qs[_0x71a3('0x3c')](_0x334db0[_0x71a3('0x33')][_0x71a3('0x3c')]);_0x4a750c['where']=qs['filters'](_[_0x71a3('0x3d')](_0x334db0[_0x71a3('0x33')],_0x18a8fe[_0x71a3('0x35')]),_0x45d13d);if(_0x334db0[_0x71a3('0x33')][_0x71a3('0x3e')]){_0x4a750c['where']=_[_0x71a3('0x3f')](_0x4a750c[_0x71a3('0x40')],{'$or':_[_0x71a3('0x2d')](_0x45d13d,function(_0x58b833){if(_0x58b833[_0x71a3('0x30')]!=='VIRTUAL'){var _0x3edeff={};_0x3edeff[_0x58b833[_0x71a3('0x2a')]]={'$like':'%'+_0x334db0[_0x71a3('0x33')][_0x71a3('0x3e')]+'%'};return _0x3edeff;}})});}_0x4a750c=_[_0x71a3('0x3f')]({},_0x4a750c,_0x334db0[_0x71a3('0x41')]);var _0x468ca4={'where':_0x4a750c[_0x71a3('0x40')]};return db[_0x71a3('0x2e')][_0x71a3('0x1e')](_0x468ca4)['then'](function(_0xa49846){_0x216d84['count']=_0xa49846;if(_0x334db0[_0x71a3('0x33')][_0x71a3('0x42')]){_0x4a750c[_0x71a3('0x43')]=[{'all':!![]}];}return db[_0x71a3('0x2e')]['findAll'](_0x4a750c);})[_0x71a3('0x24')](function(_0x4b4fde){_0x216d84['rows']=_0x4b4fde;return _0x216d84;})[_0x71a3('0x24')](respondWithFilteredResult(_0x23ae85,_0x4a750c))[_0x71a3('0x44')](handleError(_0x23ae85,null));};exports[_0x71a3('0x45')]=function(_0x1dc34b,_0x519242){var _0x248a04={'raw':!![],'where':{'id':_0x1dc34b[_0x71a3('0x46')]['id']}},_0x615c6f={};_0x615c6f[_0x71a3('0x32')]=_[_0x71a3('0x34')](db[_0x71a3('0x2e')][_0x71a3('0x2f')]);_0x615c6f[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x1dc34b[_0x71a3('0x33')]);_0x615c6f[_0x71a3('0x35')]=_[_0x71a3('0x36')](_0x615c6f[_0x71a3('0x32')],_0x615c6f[_0x71a3('0x33')]);_0x248a04[_0x71a3('0x37')]=_[_0x71a3('0x36')](_0x615c6f['model'],qs[_0x71a3('0x38')](_0x1dc34b[_0x71a3('0x33')]['fields']));_0x248a04[_0x71a3('0x37')]=_0x248a04[_0x71a3('0x37')][_0x71a3('0x47')]?_0x248a04[_0x71a3('0x37')]:_0x615c6f[_0x71a3('0x32')];if(_0x1dc34b['query']['includeAll']){_0x248a04[_0x71a3('0x43')]=[{'all':!![]}];}_0x248a04=_[_0x71a3('0x3f')]({},_0x248a04,_0x1dc34b['options']);return db[_0x71a3('0x2e')][_0x71a3('0x48')](_0x248a04)[_0x71a3('0x24')](handleEntityNotFound(_0x519242,null))[_0x71a3('0x24')](respondWithResult(_0x519242,null))[_0x71a3('0x44')](handleError(_0x519242,null));};exports[_0x71a3('0x49')]=function(_0x501a62,_0x1c9ba6){return db['ContactItemType'][_0x71a3('0x49')](_0x501a62[_0x71a3('0x4a')],{})[_0x71a3('0x24')](function(_0x2f3f19){var _0x32e313=_0x501a62['user'][_0x71a3('0x26')]({'plain':!![]});if(!_0x32e313)throw new Error(_0x71a3('0x4b'));if(_0x32e313[_0x71a3('0x4c')]==='user'){var _0x6c34=_0x2f3f19['get']({'plain':!![]});var _0x278e11=_0x71a3('0x4d');return db['UserProfileSection'][_0x71a3('0x48')]({'where':{'name':_0x278e11,'userProfileId':_0x32e313[_0x71a3('0x4e')]},'raw':!![]})[_0x71a3('0x24')](function(_0x384f38){if(_0x384f38&&_0x384f38[_0x71a3('0x4f')]===0x0){return db[_0x71a3('0x27')][_0x71a3('0x49')]({'name':_0x6c34['name'],'resourceId':_0x6c34['id'],'type':_0x384f38[_0x71a3('0x2a')],'sectionId':_0x384f38['id']},{})['then'](function(){return _0x2f3f19;});}else{return _0x2f3f19;}})[_0x71a3('0x44')](function(_0x480e90){logger[_0x71a3('0x28')](_0x71a3('0x50'),_0x480e90);throw _0x480e90;});}return _0x2f3f19;})[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,0xc9))[_0x71a3('0x44')](handleError(_0x1c9ba6,null));};exports['update']=function(_0x54b80f,_0x1e13ae){if(_0x54b80f[_0x71a3('0x4a')]['id']){delete _0x54b80f[_0x71a3('0x4a')]['id'];}return db[_0x71a3('0x2e')]['find']({'where':{'id':_0x54b80f['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1e13ae,null))[_0x71a3('0x24')](saveUpdates(_0x54b80f[_0x71a3('0x4a')],null))[_0x71a3('0x24')](respondWithResult(_0x1e13ae,null))[_0x71a3('0x44')](handleError(_0x1e13ae,null));};exports['destroy']=function(_0x421b6a,_0x3379cb){return db[_0x71a3('0x2e')][_0x71a3('0x48')]({'where':{'id':_0x421b6a[_0x71a3('0x46')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x3379cb,null))[_0x71a3('0x24')](db[_0x71a3('0x51')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x421b6a[_0x71a3('0x46')]['id']}}))[_0x71a3('0x24')](removeEntity(_0x3379cb,null))[_0x71a3('0x44')](handleError(_0x3379cb,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 3892c27..40eec68 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3505=['request-promise','path','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x3505,0x19f));var _0x5350=function(_0xb4a78d,_0x505894){_0xb4a78d=_0xb4a78d-0x0;var _0x191ebe=_0x3505[_0xb4a78d];return _0x191ebe;};'use strict';var _=require(_0x5350('0x0'));var util=require(_0x5350('0x1'));var logger=require(_0x5350('0x2'))(_0x5350('0x3'));var moment=require(_0x5350('0x4'));var BPromise=require('bluebird');var rp=require(_0x5350('0x5'));var fs=require('fs');var path=require(_0x5350('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5350('0x7'));module[_0x5350('0x8')]=function(_0x22f2fb,_0xffd138){return _0x22f2fb[_0x5350('0x9')](_0x5350('0xa'),attributes,{'tableName':_0x5350('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5870=['path','rimraf','../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x5870,0x180));var _0x0587=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5870[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x0587('0x0'));var util=require(_0x0587('0x1'));var logger=require(_0x0587('0x2'))(_0x0587('0x3'));var moment=require(_0x0587('0x4'));var BPromise=require(_0x0587('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0587('0x6'));var rimraf=require(_0x0587('0x7'));var config=require(_0x0587('0x8'));var attributes=require(_0x0587('0x9'));module['exports']=function(_0x23ebcf,_0x44a519){return _0x23ebcf[_0x0587('0xa')](_0x0587('0xb'),attributes,{'tableName':_0x0587('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 9b8b60a..0196e0a 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe58=['ContactItemType,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbe58,0x19f));var _0x8be5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xbe58[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8be5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8be5('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8be5('0x2'));var logger=require(_0x8be5('0x3'))(_0x8be5('0x4'));var config=require(_0x8be5('0x5'));var jayson=require(_0x8be5('0x6'));var client=jayson[_0x8be5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fdbb6,_0x61c95,_0x22ed1f){return new BPromise(function(_0xb9d4df,_0x9d6c40){return client[_0x8be5('0x8')](_0x4fdbb6,_0x22ed1f)['then'](function(_0x364658){logger[_0x8be5('0x9')](_0x8be5('0xa'),_0x61c95,_0x8be5('0xb'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x61c95,_0x8be5('0xb'),JSON['stringify'](_0x364658));if(_0x364658[_0x8be5('0xc')]){if(_0x364658[_0x8be5('0xc')][_0x8be5('0xd')]===0x1f4){logger[_0x8be5('0xc')](_0x8be5('0xa'),_0x61c95,_0x364658['error'][_0x8be5('0xe')]);return _0x9d6c40(_0x364658[_0x8be5('0xc')]['message']);}logger[_0x8be5('0xc')](_0x8be5('0xa'),_0x61c95,_0x364658['error']['message']);return _0xb9d4df(_0x364658['error'][_0x8be5('0xe')]);}else{logger[_0x8be5('0x9')](_0x8be5('0xa'),_0x61c95,_0x8be5('0xb'));_0xb9d4df(_0x364658[_0x8be5('0xf')][_0x8be5('0xe')]);}})[_0x8be5('0x10')](function(_0x3ea19c){logger['error'](_0x8be5('0xa'),_0x61c95,_0x3ea19c);_0x9d6c40(_0x3ea19c);});});} \ No newline at end of file +var _0x1cfc=['rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','code','message','error','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x1cfc,0x6b));var _0xc1cf=function(_0x388ded,_0x306e1d){_0x388ded=_0x388ded-0x0;var _0x37b582=_0x1cfc[_0x388ded];return _0x37b582;};'use strict';var _=require(_0xc1cf('0x0'));var util=require('util');var moment=require(_0xc1cf('0x1'));var BPromise=require(_0xc1cf('0x2'));var rs=require(_0xc1cf('0x3'));var fs=require('fs');var Redis=require(_0xc1cf('0x4'));var db=require(_0xc1cf('0x5'))['db'];var utils=require(_0xc1cf('0x6'));var logger=require(_0xc1cf('0x7'))(_0xc1cf('0x8'));var config=require(_0xc1cf('0x9'));var jayson=require(_0xc1cf('0xa'));var client=jayson[_0xc1cf('0xb')][_0xc1cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f69ad,_0x4867b8,_0x317173){return new BPromise(function(_0x5e1c1a,_0xf78ae6){return client['request'](_0x4f69ad,_0x317173)[_0xc1cf('0xd')](function(_0x2ce44b){logger[_0xc1cf('0xe')](_0xc1cf('0xf'),_0x4867b8,_0xc1cf('0x10'));logger[_0xc1cf('0x11')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x4867b8,_0xc1cf('0x10'),JSON['stringify'](_0x2ce44b));if(_0x2ce44b['error']){if(_0x2ce44b['error'][_0xc1cf('0x12')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x4867b8,_0x2ce44b['error'][_0xc1cf('0x13')]);return _0xf78ae6(_0x2ce44b[_0xc1cf('0x14')][_0xc1cf('0x13')]);}logger[_0xc1cf('0x14')](_0xc1cf('0xf'),_0x4867b8,_0x2ce44b[_0xc1cf('0x14')][_0xc1cf('0x13')]);return _0x5e1c1a(_0x2ce44b['error']['message']);}else{logger[_0xc1cf('0xe')](_0xc1cf('0xf'),_0x4867b8,_0xc1cf('0x10'));_0x5e1c1a(_0x2ce44b[_0xc1cf('0x15')][_0xc1cf('0x13')]);}})[_0xc1cf('0x16')](function(_0x3fd010){logger[_0xc1cf('0x14')](_0xc1cf('0xf'),_0x4867b8,_0x3fd010);_0xf78ae6(_0x3fd010);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index a10421f..ebdfb42 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb107=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb107,0x8f));var _0x7b10=function(_0x129657,_0x266b64){_0x129657=_0x129657-0x0;var _0x537359=_0xb107[_0x129657];return _0x537359;};'use strict';var multer=require(_0x7b10('0x0'));var util=require(_0x7b10('0x1'));var path=require(_0x7b10('0x2'));var timeout=require('connect-timeout');var express=require(_0x7b10('0x3'));var router=express[_0x7b10('0x4')]();var fs_extra=require(_0x7b10('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7b10('0x6'));var config=require(_0x7b10('0x7'));var controller=require(_0x7b10('0x8'));router[_0x7b10('0x9')]('/',auth[_0x7b10('0xa')](),controller[_0x7b10('0xb')]);router[_0x7b10('0x9')](_0x7b10('0xc'),auth[_0x7b10('0xa')](),controller[_0x7b10('0xd')]);router['post']('/',auth[_0x7b10('0xa')](),controller[_0x7b10('0xe')]);router[_0x7b10('0xf')](_0x7b10('0xc'),auth[_0x7b10('0xa')](),controller[_0x7b10('0x10')]);router['delete'](_0x7b10('0xc'),auth[_0x7b10('0xa')](),controller[_0x7b10('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbba2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','post','put','/:id','update','destroy','exports','util'];(function(_0x37ea15,_0x5a0470){var _0x453798=function(_0x47b5f9){while(--_0x47b5f9){_0x37ea15['push'](_0x37ea15['shift']());}};_0x453798(++_0x5a0470);}(_0xbba2,0x131));var _0x2bba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbba2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2bba('0x0'));var path=require(_0x2bba('0x1'));var timeout=require(_0x2bba('0x2'));var express=require(_0x2bba('0x3'));var router=express[_0x2bba('0x4')]();var fs_extra=require(_0x2bba('0x5'));var auth=require(_0x2bba('0x6'));var interaction=require(_0x2bba('0x7'));var config=require(_0x2bba('0x8'));var controller=require(_0x2bba('0x9'));router[_0x2bba('0xa')]('/',auth[_0x2bba('0xb')](),controller['index']);router[_0x2bba('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2bba('0xc')]('/',auth[_0x2bba('0xb')](),controller['create']);router[_0x2bba('0xd')](_0x2bba('0xe'),auth[_0x2bba('0xb')](),controller[_0x2bba('0xf')]);router['delete'](_0x2bba('0xe'),auth['isAuthenticated'](),controller[_0x2bba('0x10')]);module[_0x2bba('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c2327d1..847b6eb 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x3bc486,_0x588342){var _0x440df5=function(_0x5ca7f5){while(--_0x5ca7f5){_0x3bc486['push'](_0x3bc486['shift']());}};_0x440df5(++_0x588342);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f240d,_0x13a89a){_0x4f240d=_0x4f240d-0x0;var _0x5b92cc=_0xb10b[_0x4f240d];return _0x5b92cc;};'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 _0xb7e7=['STRING','sequelize'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'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 d06bf76..a5b439d 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 _0xa2e3=['findOne','DashboardItem','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','userProfileId','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems'];(function(_0x4c49fc,_0x4718c8){var _0x28ac3c=function(_0x1f2d08){while(--_0x1f2d08){_0x4c49fc['push'](_0x4c49fc['shift']());}};_0x28ac3c(++_0x4718c8);}(_0xa2e3,0x84));var _0x3a2e=function(_0x1c7db0,_0x1b90a7){_0x1c7db0=_0x1c7db0-0x0;var _0x342c53=_0xa2e3[_0x1c7db0];return _0x342c53;};'use strict';var emlformat=require(_0x3a2e('0x0'));var rimraf=require(_0x3a2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a2e('0x2'));var rp=require('request-promise');var moment=require(_0x3a2e('0x3'));var BPromise=require(_0x3a2e('0x4'));var Mustache=require(_0x3a2e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3a2e('0x6'));var ejs=require(_0x3a2e('0x7'));var fs=require('fs');var fs_extra=require(_0x3a2e('0x8'));var _=require('lodash');var squel=require(_0x3a2e('0x9'));var crypto=require(_0x3a2e('0xa'));var jsforce=require(_0x3a2e('0xb'));var deskjs=require(_0x3a2e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3a2e('0xd'));var Papa=require(_0x3a2e('0xe'));var Redis=require(_0x3a2e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3a2e('0x10'));var as=require(_0x3a2e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a2e('0x12'))(_0x3a2e('0x13'));var utils=require(_0x3a2e('0x14'));var config=require(_0x3a2e('0x15'));var licenseUtil=require(_0x3a2e('0x16'));var db=require(_0x3a2e('0x17'))['db'];config[_0x3a2e('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a2e('0x18')]));require('./dashboard.socket')[_0x3a2e('0x19')](socket);function respondWithStatusCode(_0x338f9b,_0x28e1bf){_0x28e1bf=_0x28e1bf||0xcc;return function(_0x474b2e){if(_0x474b2e){return _0x338f9b[_0x3a2e('0x1a')](_0x28e1bf);}return _0x338f9b[_0x3a2e('0x1b')](_0x28e1bf)['end']();};}function respondWithResult(_0xa90c9a,_0x549f85){_0x549f85=_0x549f85||0xc8;return function(_0x5cc767){if(_0x5cc767){return _0xa90c9a[_0x3a2e('0x1b')](_0x549f85)[_0x3a2e('0x1c')](_0x5cc767);}};}function respondWithFilteredResult(_0x1c84d2,_0x52f040){return function(_0x19e632){if(_0x19e632){var _0x1c9a17=typeof _0x52f040[_0x3a2e('0x1d')]===_0x3a2e('0x1e')&&typeof _0x52f040[_0x3a2e('0x1f')]===_0x3a2e('0x1e');var _0x533d55=_0x19e632[_0x3a2e('0x20')];var _0xe29d1=_0x1c9a17?0x0:_0x52f040[_0x3a2e('0x1d')];var _0x570dce=_0x1c9a17?_0x19e632[_0x3a2e('0x20')]:_0x52f040[_0x3a2e('0x1d')]+_0x52f040[_0x3a2e('0x1f')];var _0x1d5cd0;if(_0x570dce>=_0x533d55){_0x570dce=_0x533d55;_0x1d5cd0=0xc8;}else{_0x1d5cd0=0xce;}_0x1c84d2['status'](_0x1d5cd0);return _0x1c84d2[_0x3a2e('0x21')]('Content-Range',_0xe29d1+'-'+_0x570dce+'/'+_0x533d55)[_0x3a2e('0x1c')](_0x19e632);}return null;};}function patchUpdates(_0x5e7269){return function(_0x49ff7b){try{jsonpatch[_0x3a2e('0x22')](_0x49ff7b,_0x5e7269,!![]);}catch(_0x551f2d){return BPromise[_0x3a2e('0x23')](_0x551f2d);}return _0x49ff7b[_0x3a2e('0x24')]();};}function saveUpdates(_0x17b6fa,_0x4ca000){return function(_0x387a77){if(_0x387a77){return _0x387a77[_0x3a2e('0x25')](_0x17b6fa)['then'](function(_0x599ca4){return _0x599ca4;});}return null;};}function removeEntity(_0x30b4e7,_0x10ed48){return function(_0x30ceff){if(_0x30ceff){return _0x30ceff[_0x3a2e('0x26')]()[_0x3a2e('0x27')](function(){var _0x59a79a=_0x30ceff[_0x3a2e('0x28')]({'plain':!![]});var _0x9b2eba=_0x3a2e('0x29');return db[_0x3a2e('0x2a')]['destroy']({'where':{'type':_0x9b2eba,'resourceId':_0x59a79a['id']}})[_0x3a2e('0x27')](function(){return _0x30ceff;});})[_0x3a2e('0x27')](function(){_0x30b4e7[_0x3a2e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36d4ef,_0x3149c7){return function(_0x53d7d2){if(!_0x53d7d2){_0x36d4ef['sendStatus'](0x194);}return _0x53d7d2;};}function handleError(_0x23eefb,_0xebb0df){_0xebb0df=_0xebb0df||0x1f4;return function(_0x35e864){logger[_0x3a2e('0x2b')](_0x35e864[_0x3a2e('0x2c')]);if(_0x35e864[_0x3a2e('0x2d')]){delete _0x35e864[_0x3a2e('0x2d')];}_0x23eefb['status'](_0xebb0df)['send'](_0x35e864);};}exports[_0x3a2e('0x2e')]=function(_0x453add,_0x280157){var _0x3adda8={},_0x273561={},_0x47e758={'count':0x0,'rows':[]};var _0x4d12ea=_[_0x3a2e('0x2f')](db[_0x3a2e('0x30')]['rawAttributes'],function(_0x4bdefb){return{'name':_0x4bdefb[_0x3a2e('0x31')],'type':_0x4bdefb['type']['key']};});_0x273561[_0x3a2e('0x32')]=_[_0x3a2e('0x2f')](_0x4d12ea,_0x3a2e('0x2d'));_0x273561['query']=_[_0x3a2e('0x33')](_0x453add[_0x3a2e('0x34')]);_0x273561[_0x3a2e('0x35')]=_[_0x3a2e('0x36')](_0x273561[_0x3a2e('0x32')],_0x273561[_0x3a2e('0x34')]);_0x3adda8[_0x3a2e('0x37')]=_[_0x3a2e('0x36')](_0x273561[_0x3a2e('0x32')],qs[_0x3a2e('0x38')](_0x453add[_0x3a2e('0x34')]['fields']));_0x3adda8[_0x3a2e('0x37')]=_0x3adda8[_0x3a2e('0x37')][_0x3a2e('0x39')]?_0x3adda8[_0x3a2e('0x37')]:_0x273561[_0x3a2e('0x32')];if(!_0x453add[_0x3a2e('0x34')][_0x3a2e('0x3a')](_0x3a2e('0x3b'))){_0x3adda8[_0x3a2e('0x1f')]=qs[_0x3a2e('0x1f')](_0x453add[_0x3a2e('0x34')][_0x3a2e('0x1f')]);_0x3adda8[_0x3a2e('0x1d')]=qs['offset'](_0x453add[_0x3a2e('0x34')][_0x3a2e('0x1d')]);}_0x3adda8[_0x3a2e('0x3c')]=qs['sort'](_0x453add['query'][_0x3a2e('0x3d')]);_0x3adda8['where']=qs[_0x3a2e('0x35')](_[_0x3a2e('0x3e')](_0x453add[_0x3a2e('0x34')],_0x273561[_0x3a2e('0x35')]),_0x4d12ea);if(_0x453add[_0x3a2e('0x34')][_0x3a2e('0x3f')]){_0x3adda8[_0x3a2e('0x40')]=_[_0x3a2e('0x41')](_0x3adda8['where'],{'$or':_[_0x3a2e('0x2f')](_0x4d12ea,function(_0x183434){if(_0x183434[_0x3a2e('0x42')]!==_0x3a2e('0x43')){var _0x2f2c9c={};_0x2f2c9c[_0x183434['name']]={'$like':'%'+_0x453add[_0x3a2e('0x34')][_0x3a2e('0x3f')]+'%'};return _0x2f2c9c;}})});}_0x3adda8=_['merge']({},_0x3adda8,_0x453add[_0x3a2e('0x44')]);var _0x1167bd={'where':_0x3adda8[_0x3a2e('0x40')]};return db['Dashboard']['count'](_0x1167bd)[_0x3a2e('0x27')](function(_0x4a981c){_0x47e758[_0x3a2e('0x20')]=_0x4a981c;if(_0x453add['query'][_0x3a2e('0x45')]){_0x3adda8[_0x3a2e('0x46')]=[{'all':!![]}];}return db['Dashboard'][_0x3a2e('0x47')](_0x3adda8);})[_0x3a2e('0x27')](function(_0x2476f4){_0x47e758[_0x3a2e('0x48')]=_0x2476f4;return _0x47e758;})['then'](respondWithFilteredResult(_0x280157,_0x3adda8))[_0x3a2e('0x49')](handleError(_0x280157,null));};exports[_0x3a2e('0x4a')]=function(_0x5dcb77,_0x544467){var _0x2c312f={'raw':![],'where':{'id':_0x5dcb77[_0x3a2e('0x4b')]['id']}},_0x5a9cb6={};_0x5a9cb6[_0x3a2e('0x32')]=_[_0x3a2e('0x33')](db['Dashboard'][_0x3a2e('0x4c')]);_0x5a9cb6[_0x3a2e('0x34')]=_[_0x3a2e('0x33')](_0x5dcb77[_0x3a2e('0x34')]);_0x5a9cb6['filters']=_[_0x3a2e('0x36')](_0x5a9cb6[_0x3a2e('0x32')],_0x5a9cb6[_0x3a2e('0x34')]);_0x2c312f[_0x3a2e('0x37')]=_['intersection'](_0x5a9cb6[_0x3a2e('0x32')],qs[_0x3a2e('0x38')](_0x5dcb77[_0x3a2e('0x34')][_0x3a2e('0x38')]));_0x2c312f[_0x3a2e('0x37')]=_0x2c312f[_0x3a2e('0x37')][_0x3a2e('0x39')]?_0x2c312f[_0x3a2e('0x37')]:_0x5a9cb6[_0x3a2e('0x32')];if(_0x5dcb77['query'][_0x3a2e('0x45')]){_0x2c312f['include']=[{'all':!![]}];}_0x2c312f=_[_0x3a2e('0x41')]({},_0x2c312f,_0x5dcb77[_0x3a2e('0x44')]);return db['Dashboard'][_0x3a2e('0x4d')](_0x2c312f)[_0x3a2e('0x27')](handleEntityNotFound(_0x544467,null))[_0x3a2e('0x27')](respondWithResult(_0x544467,null))['catch'](handleError(_0x544467,null));};exports[_0x3a2e('0x4e')]=function(_0x4b0de5,_0x56a657){return db[_0x3a2e('0x30')]['create'](_0x4b0de5[_0x3a2e('0x4f')],{})[_0x3a2e('0x27')](function(_0x4a7b4b){var _0x5be4aa=_0x4b0de5[_0x3a2e('0x50')][_0x3a2e('0x28')]({'plain':!![]});if(!_0x5be4aa)throw new Error(_0x3a2e('0x51'));if(_0x5be4aa[_0x3a2e('0x52')]==='user'){var _0xd92c31=_0x4a7b4b[_0x3a2e('0x28')]({'plain':!![]});var _0x1daf06=_0x3a2e('0x29');return db[_0x3a2e('0x53')][_0x3a2e('0x4d')]({'where':{'name':_0x1daf06,'userProfileId':_0x5be4aa['userProfileId']},'raw':!![]})[_0x3a2e('0x27')](function(_0x5a442c){if(_0x5a442c&&_0x5a442c['autoAssociation']===0x0){return db[_0x3a2e('0x2a')][_0x3a2e('0x4e')]({'name':_0xd92c31[_0x3a2e('0x2d')],'resourceId':_0xd92c31['id'],'type':_0x5a442c[_0x3a2e('0x2d')],'sectionId':_0x5a442c['id']},{})['then'](function(){return _0x4a7b4b;});}else{return _0x4a7b4b;}})[_0x3a2e('0x49')](function(_0x50edc3){logger[_0x3a2e('0x2b')](_0x3a2e('0x54'),_0x50edc3);throw _0x50edc3;});}return _0x4a7b4b;})[_0x3a2e('0x27')](respondWithResult(_0x56a657,0xc9))[_0x3a2e('0x49')](handleError(_0x56a657,null));};exports[_0x3a2e('0x55')]=function(_0x55e7ec,_0x5d33aa){var _0x405ef8={'where':{'id':_0x55e7ec[_0x3a2e('0x4b')]['id']}},_0x3c9c83={};_0x3c9c83[_0x3a2e('0x32')]=_[_0x3a2e('0x33')](db[_0x3a2e('0x30')]['rawAttributes']);_0x405ef8[_0x3a2e('0x37')]=_[_0x3a2e('0x36')](_0x3c9c83[_0x3a2e('0x32')],qs[_0x3a2e('0x38')](_0x55e7ec[_0x3a2e('0x34')][_0x3a2e('0x38')]));_0x405ef8[_0x3a2e('0x37')]=_0x405ef8[_0x3a2e('0x37')][_0x3a2e('0x39')]?_0x405ef8[_0x3a2e('0x37')]:_0x3c9c83[_0x3a2e('0x32')];if(_0x55e7ec[_0x3a2e('0x34')][_0x3a2e('0x45')]){_0x405ef8[_0x3a2e('0x46')]=[{'all':!![]}];}_0x405ef8=_[_0x3a2e('0x41')]({},_0x405ef8,_0x55e7ec[_0x3a2e('0x44')]);return db['Dashboard']['find'](_0x405ef8)[_0x3a2e('0x27')](handleEntityNotFound(_0x5d33aa,null))[_0x3a2e('0x27')](function(_0x4391cc){if(_0x4391cc){var _0x106780=_0x4391cc[_0x3a2e('0x28')]({'plain':!![]});_0x106780=qs['omit'](_0x106780,['id','createdAt',_0x3a2e('0x56')]);_0x55e7ec[_0x3a2e('0x4f')]=_[_0x3a2e('0x57')](_0x55e7ec[_0x3a2e('0x4f')],['id',_0x3a2e('0x58'),_0x3a2e('0x56')]);return db['Dashboard'][_0x3a2e('0x4e')](_[_0x3a2e('0x41')](_0x106780,_0x55e7ec[_0x3a2e('0x4f')]),{'include':_0x55e7ec[_0x3a2e('0x34')][_0x3a2e('0x45')]?[{'all':!![]}]:undefined})[_0x3a2e('0x27')](function(_0x426709){var _0x1796df=_0x55e7ec[_0x3a2e('0x50')][_0x3a2e('0x28')]({'plain':!![]});if(!_0x1796df)throw new Error(_0x3a2e('0x51'));if(_0x1796df['role']===_0x3a2e('0x50')){var _0x3e4055=_0x426709['get']({'plain':!![]});var _0x4363d7=_0x3a2e('0x29');return db[_0x3a2e('0x53')][_0x3a2e('0x4d')]({'where':{'name':_0x4363d7,'userProfileId':_0x1796df[_0x3a2e('0x59')]},'raw':!![]})[_0x3a2e('0x27')](function(_0x4d5a50){if(_0x4d5a50&&_0x4d5a50[_0x3a2e('0x5a')]===0x0){return db['UserProfileResource'][_0x3a2e('0x4e')]({'name':_0x3e4055[_0x3a2e('0x2d')],'resourceId':_0x3e4055['id'],'type':_0x4d5a50[_0x3a2e('0x2d')],'sectionId':_0x4d5a50['id']},{})[_0x3a2e('0x27')](function(){return _0x426709;});}else{return _0x426709;}})[_0x3a2e('0x49')](function(_0x4d097f){logger[_0x3a2e('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d097f);throw _0x4d097f;});}return _0x426709;});}})[_0x3a2e('0x27')](respondWithResult(_0x5d33aa,0xc9))[_0x3a2e('0x49')](handleError(_0x5d33aa,null));};exports['update']=function(_0x236564,_0x2df586){if(_0x236564['body']['id']){delete _0x236564[_0x3a2e('0x4f')]['id'];}return db[_0x3a2e('0x30')]['find']({'where':{'id':_0x236564[_0x3a2e('0x4b')]['id']}})[_0x3a2e('0x27')](handleEntityNotFound(_0x2df586,null))[_0x3a2e('0x27')](saveUpdates(_0x236564['body'],null))['then'](respondWithResult(_0x2df586,null))[_0x3a2e('0x49')](handleError(_0x2df586,null));};exports[_0x3a2e('0x26')]=function(_0x6bae5d,_0x2f5e71){return db[_0x3a2e('0x30')][_0x3a2e('0x4d')]({'where':{'id':_0x6bae5d[_0x3a2e('0x4b')]['id']}})[_0x3a2e('0x27')](handleEntityNotFound(_0x2f5e71,null))[_0x3a2e('0x27')](removeEntity(_0x2f5e71,null))[_0x3a2e('0x49')](handleError(_0x2f5e71,null));};function widgetAttributes(_0x17752f){try{switch(_0x17752f[_0x3a2e('0x42')]){case _0x3a2e('0x5b'):return[{'name':_0x3a2e('0x5c'),'value':_0x17752f[_0x3a2e('0x5c')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x0]?_0x17752f[_0x3a2e('0x5d')][0x0][_0x3a2e('0x5e')]:undefined)||_0x3a2e('0x5f')}];case _0x3a2e('0x60'):return[{'name':_0x3a2e('0x61'),'value':_0x17752f[_0x3a2e('0x61')]||(_0x17752f['attrs']&&_0x17752f[_0x3a2e('0x5d')][0x0]?_0x17752f['attrs'][0x0][_0x3a2e('0x5e')]:undefined)||''}];case _0x3a2e('0x62'):return[{'name':_0x3a2e('0x63'),'value':_0x17752f[_0x3a2e('0x63')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f['attrs'][0x0]?_0x17752f[_0x3a2e('0x5d')][0x0][_0x3a2e('0x5e')]:undefined)||_0x3a2e('0x64')},{'name':'attrTimezone','value':_0x17752f[_0x3a2e('0x65')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x1]?_0x17752f[_0x3a2e('0x5d')][0x1][_0x3a2e('0x5e')]:undefined)||'0.00'},{'name':_0x3a2e('0x66'),'value':_0x17752f[_0x3a2e('0x66')]||(_0x17752f['attrs']&&_0x17752f[_0x3a2e('0x5d')][0x2]?_0x17752f[_0x3a2e('0x5d')][0x2][_0x3a2e('0x5e')]:undefined)||0xc}];case _0x3a2e('0x67'):return[{'name':'attrMetric','value':_0x17752f[_0x3a2e('0x68')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x0]?_0x17752f['attrs'][0x0]['value']:undefined)||_0x3a2e('0x69')},{'name':_0x3a2e('0x6a'),'value':_0x17752f[_0x3a2e('0x6a')]||(_0x17752f['attrs']&&_0x17752f[_0x3a2e('0x5d')][0x1]?_0x17752f[_0x3a2e('0x5d')][0x1]['value']:undefined)||[]},{'name':_0x3a2e('0x66'),'value':_0x17752f[_0x3a2e('0x66')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x2]?_0x17752f['attrs'][0x2][_0x3a2e('0x5e')]:undefined)||0x14},{'name':_0x3a2e('0x6b'),'value':_0x17752f[_0x3a2e('0x6b')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x3]?_0x17752f[_0x3a2e('0x5d')][0x3][_0x3a2e('0x5e')]:undefined)||_0x3a2e('0x6c')},{'name':_0x3a2e('0x6d'),'value':_0x17752f[_0x3a2e('0x6d')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x4]?_0x17752f['attrs'][0x4]['value']:undefined)||''},{'name':_0x3a2e('0x6e'),'value':_0x17752f[_0x3a2e('0x6e')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x5]?_0x17752f[_0x3a2e('0x5d')][0x5][_0x3a2e('0x5e')]:undefined)||''},{'name':_0x3a2e('0x6f'),'value':_0x17752f[_0x3a2e('0x6f')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f['attrs'][0x6]?_0x17752f[_0x3a2e('0x5d')][0x6][_0x3a2e('0x5e')]:undefined)||''},{'name':_0x3a2e('0x70'),'value':_0x17752f[_0x3a2e('0x70')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x7]?_0x17752f[_0x3a2e('0x5d')][0x7]['value']:undefined)||''},{'name':_0x3a2e('0x71'),'value':_0x17752f['attrWhatsappAccounts']||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x8]?_0x17752f[_0x3a2e('0x5d')][0x8]['value']:undefined)||''},{'name':_0x3a2e('0x72'),'value':_0x17752f[_0x3a2e('0x72')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x9]?_0x17752f[_0x3a2e('0x5d')][0x9]['value']:undefined)||''}];case _0x3a2e('0x73'):case _0x3a2e('0x74'):return[{'name':_0x3a2e('0x75'),'value':_0x17752f[_0x3a2e('0x75')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f['attrs'][0x0]?_0x17752f[_0x3a2e('0x5d')][0x0][_0x3a2e('0x5e')]:undefined)||'total'},{'name':_0x3a2e('0x76'),'value':_0x17752f[_0x3a2e('0x76')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x1]?_0x17752f['attrs'][0x1][_0x3a2e('0x5e')]:undefined)||null},{'name':_0x3a2e('0x77'),'value':_0x17752f['attrSerie3']||(_0x17752f['attrs']&&_0x17752f[_0x3a2e('0x5d')][0x2]?_0x17752f[_0x3a2e('0x5d')][0x2][_0x3a2e('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x17752f[_0x3a2e('0x6a')]||(_0x17752f['attrs']&&_0x17752f[_0x3a2e('0x5d')][0x3]?_0x17752f[_0x3a2e('0x5d')][0x3][_0x3a2e('0x5e')]:undefined)||[]},{'name':'attrChannel','value':_0x17752f['attrChannel']||(_0x17752f['attrs']&&_0x17752f['attrs'][0x4]?_0x17752f[_0x3a2e('0x5d')][0x4]['value']:undefined)||_0x3a2e('0x6c')},{'name':_0x3a2e('0x6d'),'value':_0x17752f[_0x3a2e('0x6d')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x5]?_0x17752f['attrs'][0x5][_0x3a2e('0x5e')]:undefined)||''},{'name':_0x3a2e('0x6e'),'value':_0x17752f[_0x3a2e('0x6e')]||(_0x17752f['attrs']&&_0x17752f[_0x3a2e('0x5d')][0x6]?_0x17752f[_0x3a2e('0x5d')][0x6][_0x3a2e('0x5e')]:undefined)||''},{'name':_0x3a2e('0x6f'),'value':_0x17752f[_0x3a2e('0x6f')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x7]?_0x17752f[_0x3a2e('0x5d')][0x7][_0x3a2e('0x5e')]:undefined)||''},{'name':_0x3a2e('0x70'),'value':_0x17752f[_0x3a2e('0x70')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x8]?_0x17752f[_0x3a2e('0x5d')][0x8][_0x3a2e('0x5e')]:undefined)||''},{'name':_0x3a2e('0x71'),'value':_0x17752f[_0x3a2e('0x71')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x9]?_0x17752f['attrs'][0x9]['value']:undefined)||''},{'name':_0x3a2e('0x72'),'value':_0x17752f[_0x3a2e('0x72')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0xa]?_0x17752f[_0x3a2e('0x5d')][0xa]['value']:undefined)||''}];case _0x3a2e('0x78'):return[{'name':'attrReport','type':_0x17752f['reportType']||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x0]?_0x17752f[_0x3a2e('0x5d')][0x0][_0x3a2e('0x42')]:undefined)||null,'value':_0x17752f[_0x3a2e('0x79')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x0]?_0x17752f[_0x3a2e('0x5d')][0x0][_0x3a2e('0x5e')]:undefined)||null},{'name':_0x3a2e('0x7a'),'value':_0x17752f[_0x3a2e('0x7a')]||(_0x17752f[_0x3a2e('0x5d')]&&_0x17752f[_0x3a2e('0x5d')][0x1]?_0x17752f[_0x3a2e('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x22e813){logger[_0x3a2e('0x2b')](_0x3a2e('0x7b'),JSON[_0x3a2e('0x7c')](_0x22e813));return[];}}exports[_0x3a2e('0x7d')]=function(_0x4d877b,_0x4c25a5,_0x17f682){if(_0x4d877b[_0x3a2e('0x4f')]['id']){delete _0x4d877b[_0x3a2e('0x4f')]['id'];}return db[_0x3a2e('0x30')][_0x3a2e('0x4d')]({'where':{'id':_0x4d877b[_0x3a2e('0x4b')]['id']}})[_0x3a2e('0x27')](handleEntityNotFound(_0x4c25a5,null))[_0x3a2e('0x27')](function(_0x62dc9d){if(_0x62dc9d){_0x4d877b['body'][_0x3a2e('0x7e')]=_0x62dc9d['id'];_0x4d877b['body'][_0x3a2e('0x5d')]=widgetAttributes(_0x4d877b[_0x3a2e('0x4f')]);return db['DashboardItem'][_0x3a2e('0x4e')](_0x4d877b[_0x3a2e('0x4f')]);}})['then'](respondWithResult(_0x4c25a5,null))['catch'](handleError(_0x4c25a5,null));};exports[_0x3a2e('0x7f')]=function(_0x2875c6,_0x40ed65,_0x47b13c){var _0x12b41d={};var _0x4294cc={};var _0x4b3fad;var _0xc26f67;return db['Dashboard'][_0x3a2e('0x80')]({'where':{'id':_0x2875c6[_0x3a2e('0x4b')]['id']}})[_0x3a2e('0x27')](handleEntityNotFound(_0x40ed65,null))['then'](function(_0x3c706f){if(_0x3c706f){_0x4b3fad=_0x3c706f;_0x4294cc[_0x3a2e('0x32')]=_[_0x3a2e('0x33')](db[_0x3a2e('0x81')][_0x3a2e('0x4c')]);_0x4294cc['query']=_[_0x3a2e('0x33')](_0x2875c6[_0x3a2e('0x34')]);_0x4294cc[_0x3a2e('0x35')]=_[_0x3a2e('0x36')](_0x4294cc['model'],_0x4294cc['query']);_0x12b41d[_0x3a2e('0x37')]=_[_0x3a2e('0x36')](_0x4294cc[_0x3a2e('0x32')],qs[_0x3a2e('0x38')](_0x2875c6[_0x3a2e('0x34')][_0x3a2e('0x38')]));_0x12b41d[_0x3a2e('0x37')]=_0x12b41d[_0x3a2e('0x37')]['length']?_0x12b41d[_0x3a2e('0x37')]:_0x4294cc['model'];_0x12b41d[_0x3a2e('0x3c')]=qs[_0x3a2e('0x3d')](_0x2875c6[_0x3a2e('0x34')][_0x3a2e('0x3d')]);_0x12b41d[_0x3a2e('0x40')]=qs[_0x3a2e('0x35')](_['pick'](_0x2875c6[_0x3a2e('0x34')],_0x4294cc[_0x3a2e('0x35')]));if(_0x2875c6[_0x3a2e('0x34')][_0x3a2e('0x3f')]){_0x12b41d[_0x3a2e('0x40')]=_[_0x3a2e('0x41')](_0x12b41d['where'],{'$or':_['map'](_0x12b41d[_0x3a2e('0x37')],function(_0x1ac9ac){var _0x4ed17d={};_0x4ed17d[_0x1ac9ac]={'$like':'%'+_0x2875c6[_0x3a2e('0x34')][_0x3a2e('0x3f')]+'%'};return _0x4ed17d;})});}_0x12b41d=_['merge']({},_0x12b41d,_0x2875c6[_0x3a2e('0x44')]);return _0x4b3fad[_0x3a2e('0x7f')](_0x12b41d);}})[_0x3a2e('0x27')](function(_0x46815f){if(_0x46815f){_0xc26f67=_0x46815f[_0x3a2e('0x39')];if(!_0x2875c6[_0x3a2e('0x34')][_0x3a2e('0x3a')]('nolimit')){_0x12b41d[_0x3a2e('0x1f')]=qs[_0x3a2e('0x1f')](_0x2875c6[_0x3a2e('0x34')][_0x3a2e('0x1f')]);_0x12b41d[_0x3a2e('0x1d')]=qs[_0x3a2e('0x1d')](_0x2875c6['query'][_0x3a2e('0x1d')]);}return _0x4b3fad['getItems'](_0x12b41d);}})['then'](function(_0x5a4aa9){if(_0x5a4aa9){return _0x5a4aa9?{'count':_0xc26f67,'rows':_0x5a4aa9}:null;}})['then'](respondWithResult(_0x40ed65,null))[_0x3a2e('0x49')](handleError(_0x40ed65,null));}; \ No newline at end of file +var _0x371a=['destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','getItems','DashboardItem','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then'];(function(_0x2d81a0,_0x3f2db9){var _0x5d680d=function(_0x394a21){while(--_0x394a21){_0x2d81a0['push'](_0x2d81a0['shift']());}};_0x5d680d(++_0x3f2db9);}(_0x371a,0x1d9));var _0xa371=function(_0x190e57,_0x5ce262){_0x190e57=_0x190e57-0x0;var _0x6997e1=_0x371a[_0x190e57];return _0x6997e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa371('0x0'));var zipdir=require(_0xa371('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa371('0x2'));var moment=require(_0xa371('0x3'));var BPromise=require(_0xa371('0x4'));var Mustache=require(_0xa371('0x5'));var util=require(_0xa371('0x6'));var path=require(_0xa371('0x7'));var sox=require(_0xa371('0x8'));var csv=require(_0xa371('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa371('0xa'));var _=require(_0xa371('0xb'));var squel=require('squel');var crypto=require(_0xa371('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa371('0xd'));var toCsv=require(_0xa371('0x9'));var querystring=require(_0xa371('0xe'));var Papa=require(_0xa371('0xf'));var Redis=require('ioredis');var authService=require(_0xa371('0x10'));var qs=require(_0xa371('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa371('0x12'))(_0xa371('0x13'));var utils=require('../../config/utils');var config=require(_0xa371('0x14'));var licenseUtil=require(_0xa371('0x15'));var db=require(_0xa371('0x16'))['db'];config[_0xa371('0x17')]=_['defaults'](config[_0xa371('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa371('0x18'))(new Redis(config[_0xa371('0x17')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x317227,_0x2f7868){_0x2f7868=_0x2f7868||0xcc;return function(_0xe625bb){if(_0xe625bb){return _0x317227[_0xa371('0x19')](_0x2f7868);}return _0x317227[_0xa371('0x1a')](_0x2f7868)[_0xa371('0x1b')]();};}function respondWithResult(_0x57cd7d,_0x308cfc){_0x308cfc=_0x308cfc||0xc8;return function(_0x3c6829){if(_0x3c6829){return _0x57cd7d[_0xa371('0x1a')](_0x308cfc)['json'](_0x3c6829);}};}function respondWithFilteredResult(_0x68762f,_0x4d90ab){return function(_0x3afbdd){if(_0x3afbdd){var _0x3474aa=typeof _0x4d90ab['offset']===_0xa371('0x1c')&&typeof _0x4d90ab[_0xa371('0x1d')]===_0xa371('0x1c');var _0x34df1f=_0x3afbdd[_0xa371('0x1e')];var _0x26e95b=_0x3474aa?0x0:_0x4d90ab[_0xa371('0x1f')];var _0x29f087=_0x3474aa?_0x3afbdd['count']:_0x4d90ab[_0xa371('0x1f')]+_0x4d90ab[_0xa371('0x1d')];var _0x46b4d9;if(_0x29f087>=_0x34df1f){_0x29f087=_0x34df1f;_0x46b4d9=0xc8;}else{_0x46b4d9=0xce;}_0x68762f[_0xa371('0x1a')](_0x46b4d9);return _0x68762f[_0xa371('0x20')](_0xa371('0x21'),_0x26e95b+'-'+_0x29f087+'/'+_0x34df1f)[_0xa371('0x22')](_0x3afbdd);}return null;};}function patchUpdates(_0x257c41){return function(_0x4652d4){try{jsonpatch[_0xa371('0x23')](_0x4652d4,_0x257c41,!![]);}catch(_0x9b8532){return BPromise['reject'](_0x9b8532);}return _0x4652d4[_0xa371('0x24')]();};}function saveUpdates(_0x1db0bb,_0x4969a0){return function(_0x5f2e69){if(_0x5f2e69){return _0x5f2e69[_0xa371('0x25')](_0x1db0bb)[_0xa371('0x26')](function(_0x349937){return _0x349937;});}return null;};}function removeEntity(_0x2c4793,_0x304b37){return function(_0x13242d){if(_0x13242d){return _0x13242d[_0xa371('0x27')]()[_0xa371('0x26')](function(){var _0x118f9f=_0x13242d[_0xa371('0x28')]({'plain':!![]});var _0x788d84=_0xa371('0x29');return db[_0xa371('0x2a')][_0xa371('0x27')]({'where':{'type':_0x788d84,'resourceId':_0x118f9f['id']}})[_0xa371('0x26')](function(){return _0x13242d;});})['then'](function(){_0x2c4793[_0xa371('0x1a')](0xcc)[_0xa371('0x1b')]();});}};}function handleEntityNotFound(_0x4e633c,_0xe2287d){return function(_0x1a1f89){if(!_0x1a1f89){_0x4e633c[_0xa371('0x19')](0x194);}return _0x1a1f89;};}function handleError(_0x4baa27,_0x1027c3){_0x1027c3=_0x1027c3||0x1f4;return function(_0x9b0e0b){logger[_0xa371('0x2b')](_0x9b0e0b[_0xa371('0x2c')]);if(_0x9b0e0b[_0xa371('0x2d')]){delete _0x9b0e0b[_0xa371('0x2d')];}_0x4baa27[_0xa371('0x1a')](_0x1027c3)['send'](_0x9b0e0b);};}exports[_0xa371('0x2e')]=function(_0x16ae19,_0xa3a8){var _0x13f261={},_0x456960={},_0x9705b7={'count':0x0,'rows':[]};var _0x426d7d=_[_0xa371('0x2f')](db[_0xa371('0x30')][_0xa371('0x31')],function(_0x353a0e){return{'name':_0x353a0e[_0xa371('0x32')],'type':_0x353a0e[_0xa371('0x33')][_0xa371('0x34')]};});_0x456960[_0xa371('0x35')]=_[_0xa371('0x2f')](_0x426d7d,'name');_0x456960[_0xa371('0x36')]=_[_0xa371('0x37')](_0x16ae19[_0xa371('0x36')]);_0x456960[_0xa371('0x38')]=_['intersection'](_0x456960[_0xa371('0x35')],_0x456960['query']);_0x13f261[_0xa371('0x39')]=_[_0xa371('0x3a')](_0x456960['model'],qs[_0xa371('0x3b')](_0x16ae19[_0xa371('0x36')][_0xa371('0x3b')]));_0x13f261[_0xa371('0x39')]=_0x13f261[_0xa371('0x39')][_0xa371('0x3c')]?_0x13f261[_0xa371('0x39')]:_0x456960[_0xa371('0x35')];if(!_0x16ae19['query'][_0xa371('0x3d')](_0xa371('0x3e'))){_0x13f261['limit']=qs[_0xa371('0x1d')](_0x16ae19[_0xa371('0x36')][_0xa371('0x1d')]);_0x13f261[_0xa371('0x1f')]=qs[_0xa371('0x1f')](_0x16ae19['query'][_0xa371('0x1f')]);}_0x13f261[_0xa371('0x3f')]=qs[_0xa371('0x40')](_0x16ae19['query']['sort']);_0x13f261['where']=qs[_0xa371('0x38')](_[_0xa371('0x41')](_0x16ae19[_0xa371('0x36')],_0x456960['filters']),_0x426d7d);if(_0x16ae19['query'][_0xa371('0x42')]){_0x13f261[_0xa371('0x43')]=_[_0xa371('0x44')](_0x13f261[_0xa371('0x43')],{'$or':_[_0xa371('0x2f')](_0x426d7d,function(_0x1dbb55){if(_0x1dbb55[_0xa371('0x33')]!==_0xa371('0x45')){var _0x5c0604={};_0x5c0604[_0x1dbb55[_0xa371('0x2d')]]={'$like':'%'+_0x16ae19['query']['filter']+'%'};return _0x5c0604;}})});}_0x13f261=_[_0xa371('0x44')]({},_0x13f261,_0x16ae19[_0xa371('0x46')]);var _0x3f1ccb={'where':_0x13f261[_0xa371('0x43')]};return db[_0xa371('0x30')][_0xa371('0x1e')](_0x3f1ccb)[_0xa371('0x26')](function(_0x51e431){_0x9705b7[_0xa371('0x1e')]=_0x51e431;if(_0x16ae19[_0xa371('0x36')][_0xa371('0x47')]){_0x13f261[_0xa371('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0xa371('0x49')](_0x13f261);})[_0xa371('0x26')](function(_0x44ae7c){_0x9705b7[_0xa371('0x4a')]=_0x44ae7c;return _0x9705b7;})[_0xa371('0x26')](respondWithFilteredResult(_0xa3a8,_0x13f261))[_0xa371('0x4b')](handleError(_0xa3a8,null));};exports[_0xa371('0x4c')]=function(_0x274cb8,_0x485470){var _0x5f4fbe={'raw':![],'where':{'id':_0x274cb8[_0xa371('0x4d')]['id']}},_0x5d0d9a={};_0x5d0d9a[_0xa371('0x35')]=_[_0xa371('0x37')](db['Dashboard'][_0xa371('0x31')]);_0x5d0d9a[_0xa371('0x36')]=_[_0xa371('0x37')](_0x274cb8['query']);_0x5d0d9a['filters']=_[_0xa371('0x3a')](_0x5d0d9a[_0xa371('0x35')],_0x5d0d9a[_0xa371('0x36')]);_0x5f4fbe['attributes']=_['intersection'](_0x5d0d9a['model'],qs[_0xa371('0x3b')](_0x274cb8[_0xa371('0x36')]['fields']));_0x5f4fbe[_0xa371('0x39')]=_0x5f4fbe['attributes'][_0xa371('0x3c')]?_0x5f4fbe[_0xa371('0x39')]:_0x5d0d9a[_0xa371('0x35')];if(_0x274cb8[_0xa371('0x36')][_0xa371('0x47')]){_0x5f4fbe[_0xa371('0x48')]=[{'all':!![]}];}_0x5f4fbe=_['merge']({},_0x5f4fbe,_0x274cb8[_0xa371('0x46')]);return db[_0xa371('0x30')][_0xa371('0x4e')](_0x5f4fbe)[_0xa371('0x26')](handleEntityNotFound(_0x485470,null))[_0xa371('0x26')](respondWithResult(_0x485470,null))[_0xa371('0x4b')](handleError(_0x485470,null));};exports[_0xa371('0x4f')]=function(_0x563fa7,_0x447a18){return db[_0xa371('0x30')][_0xa371('0x4f')](_0x563fa7[_0xa371('0x50')],{})[_0xa371('0x26')](function(_0x5ebf8a){var _0x944cc1=_0x563fa7[_0xa371('0x51')][_0xa371('0x28')]({'plain':!![]});if(!_0x944cc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x944cc1[_0xa371('0x52')]===_0xa371('0x51')){var _0x2f49e5=_0x5ebf8a[_0xa371('0x28')]({'plain':!![]});var _0x2611ec=_0xa371('0x29');return db[_0xa371('0x53')]['find']({'where':{'name':_0x2611ec,'userProfileId':_0x944cc1[_0xa371('0x54')]},'raw':!![]})[_0xa371('0x26')](function(_0x2dbd60){if(_0x2dbd60&&_0x2dbd60[_0xa371('0x55')]===0x0){return db['UserProfileResource'][_0xa371('0x4f')]({'name':_0x2f49e5[_0xa371('0x2d')],'resourceId':_0x2f49e5['id'],'type':_0x2dbd60['name'],'sectionId':_0x2dbd60['id']},{})['then'](function(){return _0x5ebf8a;});}else{return _0x5ebf8a;}})[_0xa371('0x4b')](function(_0x26cb29){logger[_0xa371('0x2b')](_0xa371('0x56'),_0x26cb29);throw _0x26cb29;});}return _0x5ebf8a;})['then'](respondWithResult(_0x447a18,0xc9))['catch'](handleError(_0x447a18,null));};exports[_0xa371('0x57')]=function(_0x4f135d,_0xd9f468){var _0x4ed83c={'where':{'id':_0x4f135d[_0xa371('0x4d')]['id']}},_0x19c33c={};_0x19c33c[_0xa371('0x35')]=_[_0xa371('0x37')](db[_0xa371('0x30')][_0xa371('0x31')]);_0x4ed83c[_0xa371('0x39')]=_[_0xa371('0x3a')](_0x19c33c['model'],qs['fields'](_0x4f135d['query'][_0xa371('0x3b')]));_0x4ed83c[_0xa371('0x39')]=_0x4ed83c[_0xa371('0x39')]['length']?_0x4ed83c['attributes']:_0x19c33c[_0xa371('0x35')];if(_0x4f135d['query'][_0xa371('0x47')]){_0x4ed83c[_0xa371('0x48')]=[{'all':!![]}];}_0x4ed83c=_[_0xa371('0x44')]({},_0x4ed83c,_0x4f135d[_0xa371('0x46')]);return db[_0xa371('0x30')][_0xa371('0x4e')](_0x4ed83c)[_0xa371('0x26')](handleEntityNotFound(_0xd9f468,null))[_0xa371('0x26')](function(_0x5272c5){if(_0x5272c5){var _0xf3cb25=_0x5272c5['get']({'plain':!![]});_0xf3cb25=qs['omit'](_0xf3cb25,['id','createdAt',_0xa371('0x58')]);_0x4f135d[_0xa371('0x50')]=_['omit'](_0x4f135d[_0xa371('0x50')],['id',_0xa371('0x59'),_0xa371('0x58')]);return db[_0xa371('0x30')]['create'](_['merge'](_0xf3cb25,_0x4f135d[_0xa371('0x50')]),{'include':_0x4f135d['query'][_0xa371('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x4c9940){var _0x28bd7c=_0x4f135d[_0xa371('0x51')][_0xa371('0x28')]({'plain':!![]});if(!_0x28bd7c)throw new Error(_0xa371('0x5a'));if(_0x28bd7c[_0xa371('0x52')]===_0xa371('0x51')){var _0x50e9bb=_0x4c9940['get']({'plain':!![]});var _0x58c1e8=_0xa371('0x29');return db['UserProfileSection'][_0xa371('0x4e')]({'where':{'name':_0x58c1e8,'userProfileId':_0x28bd7c[_0xa371('0x54')]},'raw':!![]})[_0xa371('0x26')](function(_0x57079d){if(_0x57079d&&_0x57079d[_0xa371('0x55')]===0x0){return db['UserProfileResource'][_0xa371('0x4f')]({'name':_0x50e9bb[_0xa371('0x2d')],'resourceId':_0x50e9bb['id'],'type':_0x57079d[_0xa371('0x2d')],'sectionId':_0x57079d['id']},{})['then'](function(){return _0x4c9940;});}else{return _0x4c9940;}})[_0xa371('0x4b')](function(_0x3b4f56){logger[_0xa371('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b4f56);throw _0x3b4f56;});}return _0x4c9940;});}})[_0xa371('0x26')](respondWithResult(_0xd9f468,0xc9))[_0xa371('0x4b')](handleError(_0xd9f468,null));};exports[_0xa371('0x25')]=function(_0x5f3197,_0xe18241){if(_0x5f3197[_0xa371('0x50')]['id']){delete _0x5f3197[_0xa371('0x50')]['id'];}return db[_0xa371('0x30')][_0xa371('0x4e')]({'where':{'id':_0x5f3197[_0xa371('0x4d')]['id']}})[_0xa371('0x26')](handleEntityNotFound(_0xe18241,null))[_0xa371('0x26')](saveUpdates(_0x5f3197[_0xa371('0x50')],null))[_0xa371('0x26')](respondWithResult(_0xe18241,null))[_0xa371('0x4b')](handleError(_0xe18241,null));};exports[_0xa371('0x27')]=function(_0x4e23a1,_0xba2ed1){return db[_0xa371('0x30')][_0xa371('0x4e')]({'where':{'id':_0x4e23a1[_0xa371('0x4d')]['id']}})[_0xa371('0x26')](handleEntityNotFound(_0xba2ed1,null))[_0xa371('0x26')](removeEntity(_0xba2ed1,null))['catch'](handleError(_0xba2ed1,null));};function widgetAttributes(_0x1e441a){try{switch(_0x1e441a[_0xa371('0x33')]){case'iframe':return[{'name':'attrUrl','value':_0x1e441a[_0xa371('0x5b')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x0]?_0x1e441a[_0xa371('0x5c')][0x0][_0xa371('0x5d')]:undefined)||_0xa371('0x5e')}];case _0xa371('0x5f'):return[{'name':_0xa371('0x60'),'value':_0x1e441a['attrPath']||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x0]?_0x1e441a[_0xa371('0x5c')][0x0][_0xa371('0x5d')]:undefined)||''}];case _0xa371('0x61'):return[{'name':_0xa371('0x62'),'value':_0x1e441a[_0xa371('0x62')]||(_0x1e441a['attrs']&&_0x1e441a['attrs'][0x0]?_0x1e441a['attrs'][0x0]['value']:undefined)||_0xa371('0x63')},{'name':_0xa371('0x64'),'value':_0x1e441a[_0xa371('0x64')]||(_0x1e441a['attrs']&&_0x1e441a[_0xa371('0x5c')][0x1]?_0x1e441a[_0xa371('0x5c')][0x1]['value']:undefined)||_0xa371('0x65')},{'name':_0xa371('0x66'),'value':_0x1e441a['attrFontSize']||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x2]?_0x1e441a[_0xa371('0x5c')][0x2][_0xa371('0x5d')]:undefined)||0xc}];case _0xa371('0x67'):return[{'name':_0xa371('0x68'),'value':_0x1e441a[_0xa371('0x68')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x0]?_0x1e441a[_0xa371('0x5c')][0x0]['value']:undefined)||'total'},{'name':_0xa371('0x69'),'value':_0x1e441a[_0xa371('0x69')]||(_0x1e441a['attrs']&&_0x1e441a[_0xa371('0x5c')][0x1]?_0x1e441a['attrs'][0x1][_0xa371('0x5d')]:undefined)||[]},{'name':_0xa371('0x66'),'value':_0x1e441a[_0xa371('0x66')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a['attrs'][0x2]?_0x1e441a[_0xa371('0x5c')][0x2][_0xa371('0x5d')]:undefined)||0x14},{'name':_0xa371('0x6a'),'value':_0x1e441a[_0xa371('0x6a')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x3]?_0x1e441a[_0xa371('0x5c')][0x3][_0xa371('0x5d')]:undefined)||_0xa371('0x6b')},{'name':_0xa371('0x6c'),'value':_0x1e441a[_0xa371('0x6c')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x4]?_0x1e441a['attrs'][0x4][_0xa371('0x5d')]:undefined)||''},{'name':_0xa371('0x6d'),'value':_0x1e441a[_0xa371('0x6d')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x5]?_0x1e441a['attrs'][0x5][_0xa371('0x5d')]:undefined)||''},{'name':_0xa371('0x6e'),'value':_0x1e441a[_0xa371('0x6e')]||(_0x1e441a['attrs']&&_0x1e441a[_0xa371('0x5c')][0x6]?_0x1e441a[_0xa371('0x5c')][0x6][_0xa371('0x5d')]:undefined)||''},{'name':_0xa371('0x6f'),'value':_0x1e441a['attrOpenchannelAccounts']||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x7]?_0x1e441a[_0xa371('0x5c')][0x7][_0xa371('0x5d')]:undefined)||''},{'name':_0xa371('0x70'),'value':_0x1e441a['attrWhatsappAccounts']||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x8]?_0x1e441a['attrs'][0x8][_0xa371('0x5d')]:undefined)||''},{'name':_0xa371('0x71'),'value':_0x1e441a[_0xa371('0x71')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a['attrs'][0x9]?_0x1e441a[_0xa371('0x5c')][0x9][_0xa371('0x5d')]:undefined)||''}];case'multibar-chart':case _0xa371('0x72'):return[{'name':'attrSerie1','value':_0x1e441a[_0xa371('0x73')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x0]?_0x1e441a[_0xa371('0x5c')][0x0][_0xa371('0x5d')]:undefined)||_0xa371('0x74')},{'name':_0xa371('0x75'),'value':_0x1e441a[_0xa371('0x75')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x1]?_0x1e441a[_0xa371('0x5c')][0x1][_0xa371('0x5d')]:undefined)||null},{'name':_0xa371('0x76'),'value':_0x1e441a[_0xa371('0x76')]||(_0x1e441a['attrs']&&_0x1e441a[_0xa371('0x5c')][0x2]?_0x1e441a[_0xa371('0x5c')][0x2]['value']:undefined)||null},{'name':_0xa371('0x69'),'value':_0x1e441a[_0xa371('0x69')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x3]?_0x1e441a[_0xa371('0x5c')][0x3]['value']:undefined)||[]},{'name':_0xa371('0x6a'),'value':_0x1e441a[_0xa371('0x6a')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a['attrs'][0x4]?_0x1e441a[_0xa371('0x5c')][0x4][_0xa371('0x5d')]:undefined)||'voice'},{'name':_0xa371('0x6c'),'value':_0x1e441a['attrEmailAccounts']||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x5]?_0x1e441a[_0xa371('0x5c')][0x5][_0xa371('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1e441a[_0xa371('0x6d')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x6]?_0x1e441a[_0xa371('0x5c')][0x6][_0xa371('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1e441a[_0xa371('0x6e')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a['attrs'][0x7]?_0x1e441a[_0xa371('0x5c')][0x7]['value']:undefined)||''},{'name':_0xa371('0x6f'),'value':_0x1e441a['attrOpenchannelAccounts']||(_0x1e441a['attrs']&&_0x1e441a[_0xa371('0x5c')][0x8]?_0x1e441a['attrs'][0x8]['value']:undefined)||''},{'name':_0xa371('0x70'),'value':_0x1e441a[_0xa371('0x70')]||(_0x1e441a['attrs']&&_0x1e441a['attrs'][0x9]?_0x1e441a[_0xa371('0x5c')][0x9][_0xa371('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1e441a['attrChatWebsites']||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0xa]?_0x1e441a[_0xa371('0x5c')][0xa][_0xa371('0x5d')]:undefined)||''}];case _0xa371('0x77'):return[{'name':_0xa371('0x78'),'type':_0x1e441a[_0xa371('0x79')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x0]?_0x1e441a[_0xa371('0x5c')][0x0]['type']:undefined)||null,'value':_0x1e441a[_0xa371('0x78')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a['attrs'][0x0]?_0x1e441a[_0xa371('0x5c')][0x0][_0xa371('0x5d')]:undefined)||null},{'name':_0xa371('0x7a'),'value':_0x1e441a[_0xa371('0x7a')]||(_0x1e441a[_0xa371('0x5c')]&&_0x1e441a[_0xa371('0x5c')][0x1]?_0x1e441a[_0xa371('0x5c')][0x1][_0xa371('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x4cbcc3){logger[_0xa371('0x2b')](_0xa371('0x7b'),JSON['stringify'](_0x4cbcc3));return[];}}exports[_0xa371('0x7c')]=function(_0x3db793,_0x20d088,_0x60ddad){if(_0x3db793[_0xa371('0x50')]['id']){delete _0x3db793[_0xa371('0x50')]['id'];}return db[_0xa371('0x30')][_0xa371('0x4e')]({'where':{'id':_0x3db793[_0xa371('0x4d')]['id']}})['then'](handleEntityNotFound(_0x20d088,null))['then'](function(_0x3d3c03){if(_0x3d3c03){_0x3db793[_0xa371('0x50')][_0xa371('0x7d')]=_0x3d3c03['id'];_0x3db793['body'][_0xa371('0x5c')]=widgetAttributes(_0x3db793[_0xa371('0x50')]);return db['DashboardItem'][_0xa371('0x4f')](_0x3db793[_0xa371('0x50')]);}})['then'](respondWithResult(_0x20d088,null))[_0xa371('0x4b')](handleError(_0x20d088,null));};exports[_0xa371('0x7e')]=function(_0x5407a3,_0x2eea54,_0x572bb6){var _0x4c68c1={};var _0x4ed6a0={};var _0x2b0c24;var _0xaab1b4;return db[_0xa371('0x30')]['findOne']({'where':{'id':_0x5407a3[_0xa371('0x4d')]['id']}})[_0xa371('0x26')](handleEntityNotFound(_0x2eea54,null))['then'](function(_0x56d39d){if(_0x56d39d){_0x2b0c24=_0x56d39d;_0x4ed6a0[_0xa371('0x35')]=_['keys'](db[_0xa371('0x7f')]['rawAttributes']);_0x4ed6a0[_0xa371('0x36')]=_[_0xa371('0x37')](_0x5407a3[_0xa371('0x36')]);_0x4ed6a0[_0xa371('0x38')]=_['intersection'](_0x4ed6a0[_0xa371('0x35')],_0x4ed6a0['query']);_0x4c68c1[_0xa371('0x39')]=_['intersection'](_0x4ed6a0[_0xa371('0x35')],qs[_0xa371('0x3b')](_0x5407a3[_0xa371('0x36')][_0xa371('0x3b')]));_0x4c68c1['attributes']=_0x4c68c1[_0xa371('0x39')][_0xa371('0x3c')]?_0x4c68c1[_0xa371('0x39')]:_0x4ed6a0[_0xa371('0x35')];_0x4c68c1[_0xa371('0x3f')]=qs[_0xa371('0x40')](_0x5407a3['query']['sort']);_0x4c68c1[_0xa371('0x43')]=qs['filters'](_[_0xa371('0x41')](_0x5407a3[_0xa371('0x36')],_0x4ed6a0[_0xa371('0x38')]));if(_0x5407a3[_0xa371('0x36')][_0xa371('0x42')]){_0x4c68c1[_0xa371('0x43')]=_['merge'](_0x4c68c1[_0xa371('0x43')],{'$or':_[_0xa371('0x2f')](_0x4c68c1[_0xa371('0x39')],function(_0x51fe70){var _0x36a915={};_0x36a915[_0x51fe70]={'$like':'%'+_0x5407a3['query'][_0xa371('0x42')]+'%'};return _0x36a915;})});}_0x4c68c1=_[_0xa371('0x44')]({},_0x4c68c1,_0x5407a3['options']);return _0x2b0c24[_0xa371('0x7e')](_0x4c68c1);}})['then'](function(_0x2be686){if(_0x2be686){_0xaab1b4=_0x2be686[_0xa371('0x3c')];if(!_0x5407a3[_0xa371('0x36')][_0xa371('0x3d')](_0xa371('0x3e'))){_0x4c68c1[_0xa371('0x1d')]=qs[_0xa371('0x1d')](_0x5407a3[_0xa371('0x36')][_0xa371('0x1d')]);_0x4c68c1[_0xa371('0x1f')]=qs[_0xa371('0x1f')](_0x5407a3[_0xa371('0x36')][_0xa371('0x1f')]);}return _0x2b0c24[_0xa371('0x7e')](_0x4c68c1);}})[_0xa371('0x26')](function(_0x2952f9){if(_0x2952f9){return _0x2952f9?{'count':_0xaab1b4,'rows':_0x2952f9}:null;}})[_0xa371('0x26')](respondWithResult(_0x2eea54,null))[_0xa371('0x4b')](handleError(_0x2eea54,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 577b882..ec47d4f 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 _0x52c3=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x5b28c2,_0x808665){var _0x15d58d=function(_0x208c3a){while(--_0x208c3a){_0x5b28c2['push'](_0x5b28c2['shift']());}};_0x15d58d(++_0x808665);}(_0x52c3,0x94));var _0x352c=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x52c3[_0x2261ce];return _0x524640;};'use strict';var EventEmitter=require(_0x352c('0x0'));var Dashboard=require(_0x352c('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x352c('0x2')](0x0);var events={'afterCreate':_0x352c('0x3'),'afterUpdate':_0x352c('0x4'),'afterDestroy':_0x352c('0x5')};function emitEvent(_0x529db5){return function(_0x14ed45,_0x24c011,_0x43edb3){DashboardEvents[_0x352c('0x6')](_0x529db5+':'+_0x14ed45['id'],_0x14ed45);DashboardEvents[_0x352c('0x6')](_0x529db5,_0x14ed45);_0x43edb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x352c('0x7')](e,emitEvent(event));}}module[_0x352c('0x8')]=DashboardEvents; \ No newline at end of file +var _0x2732=['Dashboard','save','emit','hook','exports','../../mysqldb'];(function(_0x2673c5,_0x15d7ce){var _0x38498b=function(_0x3be856){while(--_0x3be856){_0x2673c5['push'](_0x2673c5['shift']());}};_0x38498b(++_0x15d7ce);}(_0x2732,0x17f));var _0x2273=function(_0xebed77,_0x2de5c4){_0xebed77=_0xebed77-0x0;var _0x4eb945=_0x2732[_0xebed77];return _0x4eb945;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x2273('0x0'))['db'][_0x2273('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2273('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x48c8c7){return function(_0xb3d2aa,_0x28d290,_0x29d6d7){DashboardEvents[_0x2273('0x3')](_0x48c8c7+':'+_0xb3d2aa['id'],_0xb3d2aa);DashboardEvents[_0x2273('0x3')](_0x48c8c7,_0xb3d2aa);_0x29d6d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x2273('0x4')](e,emitEvent(event));}}module[_0x2273('0x5')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fbf679d..5e4f83a 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 _0x7b0c=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','dashboards','lodash'];(function(_0x618564,_0x4df9df){var _0x230c69=function(_0x3bbd6f){while(--_0x3bbd6f){_0x618564['push'](_0x618564['shift']());}};_0x230c69(++_0x4df9df);}(_0x7b0c,0x1ee));var _0xc7b0=function(_0x277bae,_0x48ef87){_0x277bae=_0x277bae-0x0;var _0x284611=_0x7b0c[_0x277bae];return _0x284611;};'use strict';var _=require(_0xc7b0('0x0'));var util=require(_0xc7b0('0x1'));var logger=require(_0xc7b0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc7b0('0x3'));var rp=require(_0xc7b0('0x4'));var fs=require('fs');var path=require(_0xc7b0('0x5'));var rimraf=require(_0xc7b0('0x6'));var config=require(_0xc7b0('0x7'));var attributes=require('./dashboard.attributes');module[_0xc7b0('0x8')]=function(_0x4bf567,_0x7baa9a){return _0x4bf567[_0xc7b0('0x9')]('Dashboard',attributes,{'tableName':_0xc7b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x291a=['Dashboard','lodash','util','api','moment','path','../../config/environment','exports'];(function(_0x54cffe,_0x3bd547){var _0x5ca54d=function(_0x13cf63){while(--_0x13cf63){_0x54cffe['push'](_0x54cffe['shift']());}};_0x5ca54d(++_0x3bd547);}(_0x291a,0x101));var _0xa291=function(_0x22754d,_0x3ffa6b){_0x22754d=_0x22754d-0x0;var _0x4e2724=_0x291a[_0x22754d];return _0x4e2724;};'use strict';var _=require(_0xa291('0x0'));var util=require(_0xa291('0x1'));var logger=require('../../config/logger')(_0xa291('0x2'));var moment=require(_0xa291('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa291('0x4'));var rimraf=require('rimraf');var config=require(_0xa291('0x5'));var attributes=require('./dashboard.attributes');module[_0xa291('0x6')]=function(_0xb3855,_0x4728e2){return _0xb3855['define'](_0xa291('0x7'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index d4705eb..c65a87a 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 _0x8508=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x45d515,_0x35e790){var _0x3e8ae9=function(_0x50f38a){while(--_0x50f38a){_0x45d515['push'](_0x45d515['shift']());}};_0x3e8ae9(++_0x35e790);}(_0x8508,0x64));var _0x8850=function(_0x5627a6,_0x14afa6){_0x5627a6=_0x5627a6-0x0;var _0x90749f=_0x8508[_0x5627a6];return _0x90749f;};'use strict';var _=require(_0x8850('0x0'));var util=require(_0x8850('0x1'));var moment=require(_0x8850('0x2'));var BPromise=require(_0x8850('0x3'));var rs=require(_0x8850('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8850('0x5'))['db'];var utils=require(_0x8850('0x6'));var logger=require(_0x8850('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8850('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x8850('0x9')]=_[_0x8850('0xa')](config[_0x8850('0x9')],{'host':_0x8850('0xb'),'port':0x18eb});var socket=require(_0x8850('0xc'))(new Redis(config[_0x8850('0x9')]));require(_0x8850('0xd'))['register'](socket);function respondWithRpcPromise(_0x28c7f8,_0x20ac8a,_0x3a3121){return new BPromise(function(_0x1e71ce,_0x20307d){return client[_0x8850('0xe')](_0x28c7f8,_0x3a3121)[_0x8850('0xf')](function(_0x28ed8d){logger[_0x8850('0x10')](_0x8850('0x11'),_0x20ac8a,_0x8850('0x12'));logger[_0x8850('0x13')](_0x8850('0x14'),_0x20ac8a,_0x8850('0x12'),JSON['stringify'](_0x28ed8d));if(_0x28ed8d[_0x8850('0x15')]){if(_0x28ed8d[_0x8850('0x15')][_0x8850('0x16')]===0x1f4){logger[_0x8850('0x15')](_0x8850('0x11'),_0x20ac8a,_0x28ed8d[_0x8850('0x15')][_0x8850('0x17')]);return _0x20307d(_0x28ed8d[_0x8850('0x15')][_0x8850('0x17')]);}logger[_0x8850('0x15')]('Dashboard,\x20%s,\x20%s',_0x20ac8a,_0x28ed8d[_0x8850('0x15')][_0x8850('0x17')]);return _0x1e71ce(_0x28ed8d[_0x8850('0x15')]['message']);}else{logger[_0x8850('0x10')](_0x8850('0x11'),_0x20ac8a,_0x8850('0x12'));_0x1e71ce(_0x28ed8d[_0x8850('0x18')][_0x8850('0x17')]);}})['catch'](function(_0x3e982e){logger[_0x8850('0x15')](_0x8850('0x11'),_0x20ac8a,_0x3e982e);_0x20307d(_0x3e982e);});});} \ No newline at end of file +var _0x6a5a=['result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x462a0e,_0x65bb6b){var _0x368281=function(_0x7f61bf){while(--_0x7f61bf){_0x462a0e['push'](_0x462a0e['shift']());}};_0x368281(++_0x65bb6b);}(_0x6a5a,0xaa));var _0xa6a5=function(_0x4f48ab,_0x5b366e){_0x4f48ab=_0x4f48ab-0x0;var _0x759f9e=_0x6a5a[_0x4f48ab];return _0x759f9e;};'use strict';var _=require(_0xa6a5('0x0'));var util=require(_0xa6a5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6a5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6a5('0x3'));var logger=require(_0xa6a5('0x4'))(_0xa6a5('0x5'));var config=require(_0xa6a5('0x6'));var jayson=require(_0xa6a5('0x7'));var client=jayson['client'][_0xa6a5('0x8')]({'port':0x232a});config[_0xa6a5('0x9')]=_[_0xa6a5('0xa')](config[_0xa6a5('0x9')],{'host':_0xa6a5('0xb'),'port':0x18eb});var socket=require(_0xa6a5('0xc'))(new Redis(config[_0xa6a5('0x9')]));require(_0xa6a5('0xd'))[_0xa6a5('0xe')](socket);function respondWithRpcPromise(_0x245ddf,_0x5a23f1,_0x29d13b){return new BPromise(function(_0x39c405,_0x1cb70a){return client[_0xa6a5('0xf')](_0x245ddf,_0x29d13b)[_0xa6a5('0x10')](function(_0x59f8b9){logger[_0xa6a5('0x11')](_0xa6a5('0x12'),_0x5a23f1,_0xa6a5('0x13'));logger[_0xa6a5('0x14')](_0xa6a5('0x15'),_0x5a23f1,'request\x20sent',JSON[_0xa6a5('0x16')](_0x59f8b9));if(_0x59f8b9['error']){if(_0x59f8b9[_0xa6a5('0x17')][_0xa6a5('0x18')]===0x1f4){logger[_0xa6a5('0x17')](_0xa6a5('0x12'),_0x5a23f1,_0x59f8b9[_0xa6a5('0x17')][_0xa6a5('0x19')]);return _0x1cb70a(_0x59f8b9[_0xa6a5('0x17')]['message']);}logger[_0xa6a5('0x17')](_0xa6a5('0x12'),_0x5a23f1,_0x59f8b9[_0xa6a5('0x17')][_0xa6a5('0x19')]);return _0x39c405(_0x59f8b9[_0xa6a5('0x17')][_0xa6a5('0x19')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x5a23f1,_0xa6a5('0x13'));_0x39c405(_0x59f8b9[_0xa6a5('0x1a')]['message']);}})[_0xa6a5('0x1b')](function(_0x2cf455){logger[_0xa6a5('0x17')](_0xa6a5('0x12'),_0x5a23f1,_0x2cf455);_0x1cb70a(_0x2cf455);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5885b2b..c179a78 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 _0x8503=['dashboard:','save','update','emit','removeListener','register'];(function(_0x2c4b42,_0x4346dd){var _0xe69963=function(_0x1fa9ea){while(--_0x1fa9ea){_0x2c4b42['push'](_0x2c4b42['shift']());}};_0xe69963(++_0x4346dd);}(_0x8503,0xdf));var _0x3850=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x8503[_0x2fc012];return _0x2891f9;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x3850('0x0'),'remove',_0x3850('0x1')];function createListener(_0x57cc34,_0x918fdf){return function(_0x4ef81a){_0x918fdf[_0x3850('0x2')](_0x57cc34,_0x4ef81a);};}function removeListener(_0x3b04b6,_0x36fa51){return function(){DashboardEvents[_0x3850('0x3')](_0x3b04b6,_0x36fa51);};}exports[_0x3850('0x4')]=function(_0x469695){for(var _0x2890c2=0x0,_0x1c56c0=events['length'];_0x2890c2<_0x1c56c0;_0x2890c2++){var _0x4c0259=events[_0x2890c2];var _0x1102cf=createListener(_0x3850('0x5')+_0x4c0259,_0x469695);DashboardEvents['on'](_0x4c0259,_0x1102cf);}}; \ No newline at end of file +var _0x8d09=['save','remove','update','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x178b3d,_0x40dc46){var _0x1c05c1=function(_0x525349){while(--_0x525349){_0x178b3d['push'](_0x178b3d['shift']());}};_0x1c05c1(++_0x40dc46);}(_0x8d09,0x1df));var _0x98d0=function(_0x5da4d8,_0x31cca6){_0x5da4d8=_0x5da4d8-0x0;var _0x354518=_0x8d09[_0x5da4d8];return _0x354518;};'use strict';var DashboardEvents=require(_0x98d0('0x0'));var events=[_0x98d0('0x1'),_0x98d0('0x2'),_0x98d0('0x3')];function createListener(_0x2d8010,_0x319eae){return function(_0x258ee2){_0x319eae['emit'](_0x2d8010,_0x258ee2);};}function removeListener(_0x28a0a8,_0x3ade74){return function(){DashboardEvents[_0x98d0('0x4')](_0x28a0a8,_0x3ade74);};}exports[_0x98d0('0x5')]=function(_0x1533e0){for(var _0x42825c=0x0,_0x54c44e=events[_0x98d0('0x6')];_0x42825c<_0x54c44e;_0x42825c++){var _0x103a7f=events[_0x42825c];var _0x53808f=createListener(_0x98d0('0x7')+_0x103a7f,_0x1533e0);DashboardEvents['on'](_0x103a7f,_0x53808f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 58dd4df..0fc7a70 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 _0xbec9=['create','/:id/items','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./dashboard.controller','get','/:id','isAuthenticated','show','getItems','post'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0xbec9,0x76));var _0x9bec=function(_0x32e4e8,_0x5d0bbd){_0x32e4e8=_0x32e4e8-0x0;var _0x33636f=_0xbec9[_0x32e4e8];return _0x33636f;};'use strict';var multer=require(_0x9bec('0x0'));var util=require(_0x9bec('0x1'));var path=require(_0x9bec('0x2'));var timeout=require(_0x9bec('0x3'));var express=require('express');var router=express[_0x9bec('0x4')]();var fs_extra=require(_0x9bec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9bec('0x6'));var config=require('../../config/environment');var controller=require(_0x9bec('0x7'));router[_0x9bec('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9bec('0x8')](_0x9bec('0x9'),auth[_0x9bec('0xa')](),controller[_0x9bec('0xb')]);router['get']('/:id/items',auth[_0x9bec('0xa')](),controller[_0x9bec('0xc')]);router[_0x9bec('0xd')]('/',auth[_0x9bec('0xa')](),controller[_0x9bec('0xe')]);router['post']('/:id/clone',auth[_0x9bec('0xa')](),controller['clone']);router[_0x9bec('0xd')](_0x9bec('0xf'),auth[_0x9bec('0xa')](),controller[_0x9bec('0x10')]);router[_0x9bec('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9bec('0x12')]);router[_0x9bec('0x13')](_0x9bec('0x9'),auth[_0x9bec('0xa')](),controller[_0x9bec('0x14')]);module[_0x9bec('0x15')]=router; \ No newline at end of file +var _0x3560=['get','isAuthenticated','index','/:id/items','getItems','create','post','/:id/clone','clone','addItem','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x3560,0x121));var _0x0356=function(_0x27d10a,_0x35ff44){_0x27d10a=_0x27d10a-0x0;var _0x63302e=_0x3560[_0x27d10a];return _0x63302e;};'use strict';var multer=require(_0x0356('0x0'));var util=require('util');var path=require(_0x0356('0x1'));var timeout=require(_0x0356('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0356('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0356('0x4'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x0356('0x5')]('/',auth[_0x0356('0x6')](),controller[_0x0356('0x7')]);router[_0x0356('0x5')]('/:id',auth[_0x0356('0x6')](),controller['show']);router[_0x0356('0x5')](_0x0356('0x8'),auth[_0x0356('0x6')](),controller[_0x0356('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0356('0xa')]);router[_0x0356('0xb')](_0x0356('0xc'),auth[_0x0356('0x6')](),controller[_0x0356('0xd')]);router['post'](_0x0356('0x8'),auth[_0x0356('0x6')](),controller[_0x0356('0xe')]);router[_0x0356('0xf')](_0x0356('0x10'),auth[_0x0356('0x6')](),controller[_0x0356('0x11')]);router[_0x0356('0x12')]('/:id',auth[_0x0356('0x6')](),controller[_0x0356('0x13')]);module[_0x0356('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 765045f..fa8673f 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 _0xe3da=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize'];(function(_0x101fa5,_0x1b2ffa){var _0x3c791b=function(_0x295265){while(--_0x295265){_0x101fa5['push'](_0x101fa5['shift']());}};_0x3c791b(++_0x1b2ffa);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xae3d('0x0'));var squel=require(_0xae3d('0x1'));var _=require(_0xae3d('0x2'));module[_0xae3d('0x3')]={'title':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xae3d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){try{return JSON[_0xae3d('0x7')](this[_0xae3d('0x8')](_0xae3d('0x9')));}catch(_0x26282d){return[];}},'set':function(_0xa9a1a){try{this[_0xae3d('0xa')](_0xae3d('0x9'),JSON[_0xae3d('0xb')](_0xa9a1a));}catch(_0x583b98){this[_0xae3d('0xa')](_0xae3d('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xae3d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xae3d('0xc')]},'col':{'type':Sequelize[_0xae3d('0xc')]},'background':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':_0xae3d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xae3d('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x9a02e0,_0x2540c2){var _0x1d9afe=function(_0x36276e){while(--_0x36276e){_0x9a02e0['push'](_0x9a02e0['shift']());}};_0x1d9afe(++_0x2540c2);}(_0x6f47,0xc7));var _0x76f4=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6f47[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'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 ff71afe..ec4af5f 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 _0xc1dc=['attrs','https://','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','create','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','params','keys','DashboardItem','query','model','attributes','intersection','fields','includeAll','merge','options','find','catch','type','iframe','attrUrl'];(function(_0x4f0245,_0xd442cd){var _0xc2a770=function(_0x5322f6){while(--_0x5322f6){_0x4f0245['push'](_0x4f0245['shift']());}};_0xc2a770(++_0xd442cd);}(_0xc1dc,0x84));var _0xcc1d=function(_0x545ccd,_0x25ad80){_0x545ccd=_0x545ccd-0x0;var _0x4b9789=_0xc1dc[_0x545ccd];return _0x4b9789;};'use strict';var emlformat=require(_0xcc1d('0x0'));var rimraf=require(_0xcc1d('0x1'));var zipdir=require(_0xcc1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc1d('0x3'));var moment=require('moment');var BPromise=require(_0xcc1d('0x4'));var Mustache=require(_0xcc1d('0x5'));var util=require('util');var path=require(_0xcc1d('0x6'));var sox=require(_0xcc1d('0x7'));var csv=require(_0xcc1d('0x8'));var ejs=require(_0xcc1d('0x9'));var fs=require('fs');var fs_extra=require(_0xcc1d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc1d('0xb'));var jsforce=require(_0xcc1d('0xc'));var deskjs=require(_0xcc1d('0xd'));var toCsv=require(_0xcc1d('0x8'));var querystring=require(_0xcc1d('0xe'));var Papa=require(_0xcc1d('0xf'));var Redis=require('ioredis');var authService=require(_0xcc1d('0x10'));var qs=require(_0xcc1d('0x11'));var as=require(_0xcc1d('0x12'));var hardwareService=require(_0xcc1d('0x13'));var logger=require(_0xcc1d('0x14'))(_0xcc1d('0x15'));var utils=require('../../config/utils');var config=require(_0xcc1d('0x16'));var licenseUtil=require(_0xcc1d('0x17'));var db=require('../../mysqldb')['db'];config[_0xcc1d('0x18')]=_[_0xcc1d('0x19')](config[_0xcc1d('0x18')],{'host':_0xcc1d('0x1a'),'port':0x18eb});var socket=require(_0xcc1d('0x1b'))(new Redis(config[_0xcc1d('0x18')]));require(_0xcc1d('0x1c'))['register'](socket);function respondWithStatusCode(_0x5e66ce,_0x9e2365){_0x9e2365=_0x9e2365||0xcc;return function(_0x562648){if(_0x562648){return _0x5e66ce[_0xcc1d('0x1d')](_0x9e2365);}return _0x5e66ce[_0xcc1d('0x1e')](_0x9e2365)[_0xcc1d('0x1f')]();};}function respondWithResult(_0xc71166,_0xc8391f){_0xc8391f=_0xc8391f||0xc8;return function(_0x2bf07a){if(_0x2bf07a){return _0xc71166[_0xcc1d('0x1e')](_0xc8391f)[_0xcc1d('0x20')](_0x2bf07a);}};}function respondWithFilteredResult(_0x2147ca,_0x2e1e4d){return function(_0x483963){if(_0x483963){var _0x57a551=typeof _0x2e1e4d[_0xcc1d('0x21')]==='undefined'&&typeof _0x2e1e4d[_0xcc1d('0x22')]===_0xcc1d('0x23');var _0xf44327=_0x483963[_0xcc1d('0x24')];var _0x17dd9b=_0x57a551?0x0:_0x2e1e4d[_0xcc1d('0x21')];var _0x2ffd94=_0x57a551?_0x483963[_0xcc1d('0x24')]:_0x2e1e4d[_0xcc1d('0x21')]+_0x2e1e4d['limit'];var _0x23189c;if(_0x2ffd94>=_0xf44327){_0x2ffd94=_0xf44327;_0x23189c=0xc8;}else{_0x23189c=0xce;}_0x2147ca['status'](_0x23189c);return _0x2147ca[_0xcc1d('0x25')](_0xcc1d('0x26'),_0x17dd9b+'-'+_0x2ffd94+'/'+_0xf44327)[_0xcc1d('0x20')](_0x483963);}return null;};}function patchUpdates(_0x5a2df6){return function(_0x38955e){try{jsonpatch[_0xcc1d('0x27')](_0x38955e,_0x5a2df6,!![]);}catch(_0x31a006){return BPromise[_0xcc1d('0x28')](_0x31a006);}return _0x38955e[_0xcc1d('0x29')]();};}function saveUpdates(_0x5e2f74,_0x305942){return function(_0x4aa82e){if(_0x4aa82e){return _0x4aa82e[_0xcc1d('0x2a')](_0x5e2f74)[_0xcc1d('0x2b')](function(_0x3f8b30){return _0x3f8b30;});}return null;};}function removeEntity(_0x40e31c,_0xd2dba0){return function(_0x4f6ec8){if(_0x4f6ec8){return _0x4f6ec8[_0xcc1d('0x2c')]()[_0xcc1d('0x2b')](function(){_0x40e31c[_0xcc1d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf867a,_0x491edb){return function(_0x2d2b0c){if(!_0x2d2b0c){_0xf867a['sendStatus'](0x194);}return _0x2d2b0c;};}function handleError(_0x708bc,_0x2b4058){_0x2b4058=_0x2b4058||0x1f4;return function(_0x47710b){logger['error'](_0x47710b[_0xcc1d('0x2d')]);if(_0x47710b[_0xcc1d('0x2e')]){delete _0x47710b[_0xcc1d('0x2e')];}_0x708bc['status'](_0x2b4058)[_0xcc1d('0x2f')](_0x47710b);};}exports['show']=function(_0x18cbc0,_0x2a68ef){var _0x14a4d4={'raw':![],'where':{'id':_0x18cbc0[_0xcc1d('0x30')]['id']}},_0x380bd2={};_0x380bd2['model']=_[_0xcc1d('0x31')](db[_0xcc1d('0x32')]['rawAttributes']);_0x380bd2[_0xcc1d('0x33')]=_['keys'](_0x18cbc0[_0xcc1d('0x33')]);_0x380bd2['filters']=_['intersection'](_0x380bd2[_0xcc1d('0x34')],_0x380bd2['query']);_0x14a4d4[_0xcc1d('0x35')]=_[_0xcc1d('0x36')](_0x380bd2[_0xcc1d('0x34')],qs[_0xcc1d('0x37')](_0x18cbc0[_0xcc1d('0x33')][_0xcc1d('0x37')]));_0x14a4d4['attributes']=_0x14a4d4[_0xcc1d('0x35')]['length']?_0x14a4d4[_0xcc1d('0x35')]:_0x380bd2[_0xcc1d('0x34')];if(_0x18cbc0[_0xcc1d('0x33')][_0xcc1d('0x38')]){_0x14a4d4['include']=[{'all':!![]}];}_0x14a4d4=_[_0xcc1d('0x39')]({},_0x14a4d4,_0x18cbc0[_0xcc1d('0x3a')]);return db[_0xcc1d('0x32')][_0xcc1d('0x3b')](_0x14a4d4)[_0xcc1d('0x2b')](handleEntityNotFound(_0x2a68ef,null))[_0xcc1d('0x2b')](respondWithResult(_0x2a68ef,null))[_0xcc1d('0x3c')](handleError(_0x2a68ef,null));};exports[_0xcc1d('0x2c')]=function(_0x3116cf,_0x21af60){return db['DashboardItem']['find']({'where':{'id':_0x3116cf[_0xcc1d('0x30')]['id']}})[_0xcc1d('0x2b')](handleEntityNotFound(_0x21af60,null))['then'](removeEntity(_0x21af60,null))['catch'](handleError(_0x21af60,null));};function widgetAttributes(_0x5e2df9){try{switch(_0x5e2df9[_0xcc1d('0x3d')]){case _0xcc1d('0x3e'):return[{'name':_0xcc1d('0x3f'),'value':_0x5e2df9[_0xcc1d('0x3f')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x0]?_0x5e2df9[_0xcc1d('0x40')][0x0]['value']:undefined)||_0xcc1d('0x41')}];case'custom':return[{'name':'attrPath','value':_0x5e2df9['attrPath']||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x0]?_0x5e2df9['attrs'][0x0]['value']:undefined)||''}];case _0xcc1d('0x42'):return[{'name':'attrHourFormat','value':_0x5e2df9[_0xcc1d('0x43')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x0]?_0x5e2df9['attrs'][0x0][_0xcc1d('0x44')]:undefined)||_0xcc1d('0x45')},{'name':_0xcc1d('0x46'),'value':_0x5e2df9[_0xcc1d('0x46')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x1]?_0x5e2df9[_0xcc1d('0x40')][0x1]['value']:undefined)||_0xcc1d('0x47')},{'name':'attrFontSize','value':_0x5e2df9[_0xcc1d('0x48')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x2]?_0x5e2df9[_0xcc1d('0x40')][0x2][_0xcc1d('0x44')]:undefined)||0xc}];case _0xcc1d('0x49'):return[{'name':_0xcc1d('0x4a'),'value':_0x5e2df9[_0xcc1d('0x4a')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x0]?_0x5e2df9[_0xcc1d('0x40')][0x0][_0xcc1d('0x44')]:undefined)||'total'},{'name':_0xcc1d('0x4b'),'value':_0x5e2df9[_0xcc1d('0x4b')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x1]?_0x5e2df9[_0xcc1d('0x40')][0x1][_0xcc1d('0x44')]:undefined)||[]},{'name':_0xcc1d('0x48'),'value':_0x5e2df9[_0xcc1d('0x48')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x2]?_0x5e2df9[_0xcc1d('0x40')][0x2]['value']:undefined)||0x14},{'name':_0xcc1d('0x4c'),'value':_0x5e2df9[_0xcc1d('0x4c')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x3]?_0x5e2df9[_0xcc1d('0x40')][0x3][_0xcc1d('0x44')]:undefined)||_0xcc1d('0x4d')},{'name':_0xcc1d('0x4e'),'value':_0x5e2df9[_0xcc1d('0x4e')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x4]?_0x5e2df9[_0xcc1d('0x40')][0x4][_0xcc1d('0x44')]:undefined)||''},{'name':_0xcc1d('0x4f'),'value':_0x5e2df9[_0xcc1d('0x4f')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x5]?_0x5e2df9[_0xcc1d('0x40')][0x5][_0xcc1d('0x44')]:undefined)||''},{'name':_0xcc1d('0x50'),'value':_0x5e2df9['attrSmsAccounts']||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9['attrs'][0x6]?_0x5e2df9[_0xcc1d('0x40')][0x6][_0xcc1d('0x44')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5e2df9['attrOpenchannelAccounts']||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x7]?_0x5e2df9[_0xcc1d('0x40')][0x7][_0xcc1d('0x44')]:undefined)||''},{'name':_0xcc1d('0x51'),'value':_0x5e2df9[_0xcc1d('0x51')]||(_0x5e2df9['attrs']&&_0x5e2df9[_0xcc1d('0x40')][0x8]?_0x5e2df9[_0xcc1d('0x40')][0x8]['value']:undefined)||''},{'name':_0xcc1d('0x52'),'value':_0x5e2df9[_0xcc1d('0x52')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9['attrs'][0x9]?_0x5e2df9[_0xcc1d('0x40')][0x9][_0xcc1d('0x44')]:undefined)||''}];case _0xcc1d('0x53'):case'pie-chart':return[{'name':_0xcc1d('0x54'),'value':_0x5e2df9[_0xcc1d('0x54')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x0]?_0x5e2df9[_0xcc1d('0x40')][0x0][_0xcc1d('0x44')]:undefined)||_0xcc1d('0x55')},{'name':_0xcc1d('0x56'),'value':_0x5e2df9['attrSerie2']||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x1]?_0x5e2df9['attrs'][0x1][_0xcc1d('0x44')]:undefined)||null},{'name':_0xcc1d('0x57'),'value':_0x5e2df9[_0xcc1d('0x57')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x2]?_0x5e2df9[_0xcc1d('0x40')][0x2][_0xcc1d('0x44')]:undefined)||null},{'name':_0xcc1d('0x4b'),'value':_0x5e2df9[_0xcc1d('0x4b')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x3]?_0x5e2df9[_0xcc1d('0x40')][0x3][_0xcc1d('0x44')]:undefined)||[]},{'name':_0xcc1d('0x4c'),'value':_0x5e2df9[_0xcc1d('0x4c')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x4]?_0x5e2df9[_0xcc1d('0x40')][0x4]['value']:undefined)||_0xcc1d('0x4d')},{'name':'attrEmailAccounts','value':_0x5e2df9[_0xcc1d('0x4e')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9['attrs'][0x5]?_0x5e2df9[_0xcc1d('0x40')][0x5][_0xcc1d('0x44')]:undefined)||''},{'name':_0xcc1d('0x4f'),'value':_0x5e2df9['attrFaxAccounts']||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9['attrs'][0x6]?_0x5e2df9[_0xcc1d('0x40')][0x6]['value']:undefined)||''},{'name':_0xcc1d('0x50'),'value':_0x5e2df9[_0xcc1d('0x50')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x7]?_0x5e2df9[_0xcc1d('0x40')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5e2df9[_0xcc1d('0x58')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x8]?_0x5e2df9[_0xcc1d('0x40')][0x8][_0xcc1d('0x44')]:undefined)||''},{'name':_0xcc1d('0x51'),'value':_0x5e2df9['attrWhatsappAccounts']||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x9]?_0x5e2df9[_0xcc1d('0x40')][0x9][_0xcc1d('0x44')]:undefined)||''},{'name':_0xcc1d('0x52'),'value':_0x5e2df9[_0xcc1d('0x52')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9['attrs'][0xa]?_0x5e2df9['attrs'][0xa][_0xcc1d('0x44')]:undefined)||''}];case _0xcc1d('0x59'):return[{'name':_0xcc1d('0x5a'),'type':_0x5e2df9[_0xcc1d('0x5b')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9['attrs'][0x0]?_0x5e2df9['attrs'][0x0][_0xcc1d('0x3d')]:undefined)||null,'value':_0x5e2df9[_0xcc1d('0x5a')]||(_0x5e2df9[_0xcc1d('0x40')]&&_0x5e2df9[_0xcc1d('0x40')][0x0]?_0x5e2df9[_0xcc1d('0x40')][0x0][_0xcc1d('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x5e2df9[_0xcc1d('0x5c')]||(_0x5e2df9['attrs']&&_0x5e2df9[_0xcc1d('0x40')][0x1]?_0x5e2df9[_0xcc1d('0x40')][0x1][_0xcc1d('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x47c93f){logger[_0xcc1d('0x5d')](_0xcc1d('0x5e'),JSON[_0xcc1d('0x5f')](_0x47c93f));return[];}}exports['create']=function(_0x4bc6e3,_0x5d09b0){if(_0x4bc6e3[_0xcc1d('0x60')]){_0x4bc6e3[_0xcc1d('0x60')][_0xcc1d('0x40')]=widgetAttributes(_0x4bc6e3['body']);}return db[_0xcc1d('0x32')][_0xcc1d('0x61')](_0x4bc6e3[_0xcc1d('0x60')],{})['then'](respondWithResult(_0x5d09b0,0xc9))[_0xcc1d('0x3c')](handleError(_0x5d09b0,null));};exports[_0xcc1d('0x2a')]=function(_0x1966be,_0x6f8ca8){if(_0x1966be[_0xcc1d('0x60')]['id']){delete _0x1966be['body']['id'];}_0x1966be[_0xcc1d('0x60')][_0xcc1d('0x40')]=widgetAttributes(_0x1966be[_0xcc1d('0x60')]);return db[_0xcc1d('0x32')][_0xcc1d('0x3b')]({'where':{'id':_0x1966be[_0xcc1d('0x30')]['id']}})[_0xcc1d('0x2b')](handleEntityNotFound(_0x6f8ca8,null))[_0xcc1d('0x2b')](saveUpdates(_0x1966be[_0xcc1d('0x60')],null))[_0xcc1d('0x2b')](respondWithResult(_0x6f8ca8,null))[_0xcc1d('0x3c')](handleError(_0x6f8ca8,null));}; \ No newline at end of file +var _0x2ef3=['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','redis','localhost','./dashboardItem.socket','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','update','destroy','then','end','error','name','send','params','model','keys','rawAttributes','query','intersection','attributes','length','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body'];(function(_0x11eac6,_0x293339){var _0x384383=function(_0x442210){while(--_0x442210){_0x11eac6['push'](_0x11eac6['shift']());}};_0x384383(++_0x293339);}(_0x2ef3,0xba));var _0x32ef=function(_0xf706c2,_0x118f6a){_0xf706c2=_0xf706c2-0x0;var _0x941ba2=_0x2ef3[_0xf706c2];return _0x941ba2;};'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'];config[_0x32ef('0x18')]=_['defaults'](config[_0x32ef('0x18')],{'host':_0x32ef('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x32ef('0x1a'))['register'](socket);function respondWithStatusCode(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xcc;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x1b')](_0x40a6e6);}return _0x326fce['status'](_0x40a6e6)['end']();};}function respondWithResult(_0x531e30,_0x13db1a){_0x13db1a=_0x13db1a||0xc8;return function(_0x3950e6){if(_0x3950e6){return _0x531e30[_0x32ef('0x1c')](_0x13db1a)['json'](_0x3950e6);}};}function respondWithFilteredResult(_0x5d559b,_0x1eb468){return function(_0x1a9476){if(_0x1a9476){var _0x286bfb=typeof _0x1eb468['offset']===_0x32ef('0x1d')&&typeof _0x1eb468[_0x32ef('0x1e')]==='undefined';var _0x304505=_0x1a9476[_0x32ef('0x1f')];var _0x26aff3=_0x286bfb?0x0:_0x1eb468[_0x32ef('0x20')];var _0x445cda=_0x286bfb?_0x1a9476[_0x32ef('0x1f')]:_0x1eb468['offset']+_0x1eb468[_0x32ef('0x1e')];var _0x5cc3ef;if(_0x445cda>=_0x304505){_0x445cda=_0x304505;_0x5cc3ef=0xc8;}else{_0x5cc3ef=0xce;}_0x5d559b[_0x32ef('0x1c')](_0x5cc3ef);return _0x5d559b[_0x32ef('0x21')]('Content-Range',_0x26aff3+'-'+_0x445cda+'/'+_0x304505)[_0x32ef('0x22')](_0x1a9476);}return null;};}function patchUpdates(_0x97780){return function(_0x5e8898){try{jsonpatch['apply'](_0x5e8898,_0x97780,!![]);}catch(_0x57f5e5){return BPromise[_0x32ef('0x23')](_0x57f5e5);}return _0x5e8898[_0x32ef('0x24')]();};}function saveUpdates(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x25')](_0x225feb)['then'](function(_0x51a412){return _0x51a412;});}return null;};}function removeEntity(_0x278495,_0x14d4b3){return function(_0x371540){if(_0x371540){return _0x371540[_0x32ef('0x26')]()[_0x32ef('0x27')](function(){_0x278495[_0x32ef('0x1c')](0xcc)[_0x32ef('0x28')]();});}};}function handleEntityNotFound(_0x38aed5,_0x338f19){return function(_0x2f52d7){if(!_0x2f52d7){_0x38aed5[_0x32ef('0x1b')](0x194);}return _0x2f52d7;};}function handleError(_0xba4b3f,_0x5a88a5){_0x5a88a5=_0x5a88a5||0x1f4;return function(_0xd65fde){logger[_0x32ef('0x29')](_0xd65fde['stack']);if(_0xd65fde[_0x32ef('0x2a')]){delete _0xd65fde[_0x32ef('0x2a')];}_0xba4b3f[_0x32ef('0x1c')](_0x5a88a5)[_0x32ef('0x2b')](_0xd65fde);};}exports['show']=function(_0x10e38c,_0x22bf86){var _0x31dbc3={'raw':![],'where':{'id':_0x10e38c[_0x32ef('0x2c')]['id']}},_0x2ac686={};_0x2ac686[_0x32ef('0x2d')]=_[_0x32ef('0x2e')](db['DashboardItem'][_0x32ef('0x2f')]);_0x2ac686['query']=_[_0x32ef('0x2e')](_0x10e38c[_0x32ef('0x30')]);_0x2ac686['filters']=_[_0x32ef('0x31')](_0x2ac686[_0x32ef('0x2d')],_0x2ac686[_0x32ef('0x30')]);_0x31dbc3[_0x32ef('0x32')]=_[_0x32ef('0x31')](_0x2ac686['model'],qs['fields'](_0x10e38c[_0x32ef('0x30')]['fields']));_0x31dbc3[_0x32ef('0x32')]=_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x33')]?_0x31dbc3[_0x32ef('0x32')]:_0x2ac686[_0x32ef('0x2d')];if(_0x10e38c[_0x32ef('0x30')]['includeAll']){_0x31dbc3['include']=[{'all':!![]}];}_0x31dbc3=_['merge']({},_0x31dbc3,_0x10e38c[_0x32ef('0x34')]);return db[_0x32ef('0x35')][_0x32ef('0x36')](_0x31dbc3)['then'](handleEntityNotFound(_0x22bf86,null))['then'](respondWithResult(_0x22bf86,null))[_0x32ef('0x37')](handleError(_0x22bf86,null));};exports[_0x32ef('0x26')]=function(_0x410334,_0x480348){return db['DashboardItem'][_0x32ef('0x36')]({'where':{'id':_0x410334[_0x32ef('0x2c')]['id']}})[_0x32ef('0x27')](handleEntityNotFound(_0x480348,null))[_0x32ef('0x27')](removeEntity(_0x480348,null))[_0x32ef('0x37')](handleError(_0x480348,null));};function widgetAttributes(_0x211c79){try{switch(_0x211c79[_0x32ef('0x38')]){case _0x32ef('0x39'):return[{'name':_0x32ef('0x3a'),'value':_0x211c79['attrUrl']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0]['value']:undefined)||_0x32ef('0x3c')}];case _0x32ef('0x3d'):return[{'name':_0x32ef('0x3e'),'value':_0x211c79[_0x32ef('0x3e')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||''}];case _0x32ef('0x40'):return[{'name':_0x32ef('0x41'),'value':_0x211c79[_0x32ef('0x41')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x42')},{'name':_0x32ef('0x43'),'value':_0x211c79[_0x32ef('0x43')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79['attrs'][0x1]['value']:undefined)||_0x32ef('0x44')},{'name':_0x32ef('0x45'),'value':_0x211c79[_0x32ef('0x45')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x2]?_0x211c79[_0x32ef('0x3b')][0x2][_0x32ef('0x3f')]:undefined)||0xc}];case'counter':return[{'name':_0x32ef('0x46'),'value':_0x211c79['attrMetric']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x47')},{'name':_0x32ef('0x48'),'value':_0x211c79[_0x32ef('0x48')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1]['value']:undefined)||[]},{'name':_0x32ef('0x45'),'value':_0x211c79['attrFontSize']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x2]?_0x211c79[_0x32ef('0x3b')][0x2]['value']:undefined)||0x14},{'name':_0x32ef('0x49'),'value':_0x211c79[_0x32ef('0x49')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x3]?_0x211c79[_0x32ef('0x3b')][0x3][_0x32ef('0x3f')]:undefined)||_0x32ef('0x4a')},{'name':'attrEmailAccounts','value':_0x211c79['attrEmailAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x4]?_0x211c79[_0x32ef('0x3b')][0x4][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4b'),'value':_0x211c79[_0x32ef('0x4b')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x5]?_0x211c79[_0x32ef('0x3b')][0x5][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4c'),'value':_0x211c79[_0x32ef('0x4c')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x6]?_0x211c79[_0x32ef('0x3b')][0x6][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4d'),'value':_0x211c79[_0x32ef('0x4d')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x7]?_0x211c79[_0x32ef('0x3b')][0x7][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4e'),'value':_0x211c79[_0x32ef('0x4e')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x8]?_0x211c79[_0x32ef('0x3b')][0x8][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4f'),'value':_0x211c79[_0x32ef('0x4f')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x9]?_0x211c79['attrs'][0x9]['value']:undefined)||''}];case _0x32ef('0x50'):case _0x32ef('0x51'):return[{'name':_0x32ef('0x52'),'value':_0x211c79[_0x32ef('0x52')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x3f')]:undefined)||_0x32ef('0x47')},{'name':_0x32ef('0x53'),'value':_0x211c79[_0x32ef('0x53')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1][_0x32ef('0x3f')]:undefined)||null},{'name':_0x32ef('0x54'),'value':_0x211c79[_0x32ef('0x54')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x2]?_0x211c79[_0x32ef('0x3b')][0x2][_0x32ef('0x3f')]:undefined)||null},{'name':_0x32ef('0x48'),'value':_0x211c79['attrVoiceQueues']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x3]?_0x211c79[_0x32ef('0x3b')][0x3][_0x32ef('0x3f')]:undefined)||[]},{'name':'attrChannel','value':_0x211c79[_0x32ef('0x49')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x4]?_0x211c79[_0x32ef('0x3b')][0x4][_0x32ef('0x3f')]:undefined)||_0x32ef('0x4a')},{'name':_0x32ef('0x55'),'value':_0x211c79[_0x32ef('0x55')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x5]?_0x211c79['attrs'][0x5][_0x32ef('0x3f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x211c79['attrFaxAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x6]?_0x211c79[_0x32ef('0x3b')][0x6][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4c'),'value':_0x211c79[_0x32ef('0x4c')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x7]?_0x211c79[_0x32ef('0x3b')][0x7][_0x32ef('0x3f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x211c79['attrOpenchannelAccounts']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x8]?_0x211c79['attrs'][0x8][_0x32ef('0x3f')]:undefined)||''},{'name':_0x32ef('0x4e'),'value':_0x211c79[_0x32ef('0x4e')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x9]?_0x211c79[_0x32ef('0x3b')][0x9][_0x32ef('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x211c79['attrChatWebsites']||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0xa]?_0x211c79[_0x32ef('0x3b')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x32ef('0x56'),'type':_0x211c79[_0x32ef('0x57')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79['attrs'][0x0]?_0x211c79[_0x32ef('0x3b')][0x0][_0x32ef('0x38')]:undefined)||null,'value':_0x211c79[_0x32ef('0x56')]||(_0x211c79['attrs']&&_0x211c79[_0x32ef('0x3b')][0x0]?_0x211c79[_0x32ef('0x3b')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x211c79[_0x32ef('0x58')]||(_0x211c79[_0x32ef('0x3b')]&&_0x211c79[_0x32ef('0x3b')][0x1]?_0x211c79[_0x32ef('0x3b')][0x1][_0x32ef('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x40700e){logger['error'](_0x32ef('0x59'),JSON[_0x32ef('0x5a')](_0x40700e));return[];}}exports[_0x32ef('0x5b')]=function(_0x36ed97,_0x21e930){if(_0x36ed97[_0x32ef('0x5c')]){_0x36ed97[_0x32ef('0x5c')][_0x32ef('0x3b')]=widgetAttributes(_0x36ed97[_0x32ef('0x5c')]);}return db['DashboardItem'][_0x32ef('0x5b')](_0x36ed97[_0x32ef('0x5c')],{})[_0x32ef('0x27')](respondWithResult(_0x21e930,0xc9))[_0x32ef('0x37')](handleError(_0x21e930,null));};exports[_0x32ef('0x25')]=function(_0x5ad75c,_0x47c0ed){if(_0x5ad75c[_0x32ef('0x5c')]['id']){delete _0x5ad75c[_0x32ef('0x5c')]['id'];}_0x5ad75c[_0x32ef('0x5c')][_0x32ef('0x3b')]=widgetAttributes(_0x5ad75c[_0x32ef('0x5c')]);return db['DashboardItem'][_0x32ef('0x36')]({'where':{'id':_0x5ad75c['params']['id']}})[_0x32ef('0x27')](handleEntityNotFound(_0x47c0ed,null))[_0x32ef('0x27')](saveUpdates(_0x5ad75c['body'],null))['then'](respondWithResult(_0x47c0ed,null))[_0x32ef('0x37')](handleError(_0x47c0ed,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d4c69f5..aef01d6 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 _0x29b2=['emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','save','update'];(function(_0x9c607a,_0x1cb2c6){var _0x3b1311=function(_0x1b3fec){while(--_0x1b3fec){_0x9c607a['push'](_0x9c607a['shift']());}};_0x3b1311(++_0x1cb2c6);}(_0x29b2,0x123));var _0x229b=function(_0x3af61c,_0x5b7492){_0x3af61c=_0x3af61c-0x0;var _0x5aad7d=_0x29b2[_0x3af61c];return _0x5aad7d;};'use strict';var EventEmitter=require(_0x229b('0x0'));var DashboardItem=require(_0x229b('0x1'))['db'][_0x229b('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x229b('0x3'),'afterUpdate':_0x229b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35eb75){return function(_0x2adf6d,_0x35d73f,_0x2f5bf4){DashboardItemEvents[_0x229b('0x5')](_0x35eb75+':'+_0x2adf6d['id'],_0x2adf6d);DashboardItemEvents[_0x229b('0x5')](_0x35eb75,_0x2adf6d);_0x2f5bf4(null);};}for(var e in events){if(events[_0x229b('0x6')](e)){var event=events[e];DashboardItem[_0x229b('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x12ad=['remove','emit','../../mysqldb','DashboardItem','setMaxListeners','update'];(function(_0xb817c6,_0x45038c){var _0x513b57=function(_0x40fff9){while(--_0x40fff9){_0xb817c6['push'](_0xb817c6['shift']());}};_0x513b57(++_0x45038c);}(_0x12ad,0xfe));var _0xd12a=function(_0x2cfb2b,_0x30c0f1){_0x2cfb2b=_0x2cfb2b-0x0;var _0x403a5c=_0x12ad[_0x2cfb2b];return _0x403a5c;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xd12a('0x0'))['db'][_0xd12a('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd12a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd12a('0x3'),'afterDestroy':_0xd12a('0x4')};function emitEvent(_0x584530){return function(_0x4129cc,_0x84594f,_0x9f2a36){DashboardItemEvents['emit'](_0x584530+':'+_0x4129cc['id'],_0x4129cc);DashboardItemEvents[_0xd12a('0x5')](_0x584530,_0x4129cc);_0x9f2a36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 45ebf38..8ee01a9 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 _0x70e0=['dashboard_items','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./dashboardItem.attributes'];(function(_0x3fec22,_0x2b4645){var _0x402df5=function(_0xd9129f){while(--_0xd9129f){_0x3fec22['push'](_0x3fec22['shift']());}};_0x402df5(++_0x2b4645);}(_0x70e0,0x17b));var _0x070e=function(_0x562cd9,_0x6c3d98){_0x562cd9=_0x562cd9-0x0;var _0x1b7668=_0x70e0[_0x562cd9];return _0x1b7668;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('DashboardItem',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb358=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','util','../../config/logger','bluebird'];(function(_0x3ec15a,_0x3426d1){var _0x3691c9=function(_0x4e6384){while(--_0x4e6384){_0x3ec15a['push'](_0x3ec15a['shift']());}};_0x3691c9(++_0x3426d1);}(_0xb358,0x1b5));var _0x8b35=function(_0x2c42a5,_0x2d1b8f){_0x2c42a5=_0x2c42a5-0x0;var _0x50ef99=_0xb358[_0x2c42a5];return _0x50ef99;};'use strict';var _=require('lodash');var util=require(_0x8b35('0x0'));var logger=require(_0x8b35('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8b35('0x2'));var rp=require(_0x8b35('0x3'));var fs=require('fs');var path=require(_0x8b35('0x4'));var rimraf=require(_0x8b35('0x5'));var config=require(_0x8b35('0x6'));var attributes=require(_0x8b35('0x7'));module[_0x8b35('0x8')]=function(_0x249e2e,_0x122a86){return _0x249e2e['define'](_0x8b35('0x9'),attributes,{'tableName':_0x8b35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 584b7d7..173872c 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 _0xafcf=['http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0xafcf,0x1b5));var _0xfafc=function(_0x2a5262,_0x578588){_0x2a5262=_0x2a5262-0x0;var _0x483802=_0xafcf[_0x2a5262];return _0x483802;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfafc('0x0'));var BPromise=require(_0xfafc('0x1'));var rs=require(_0xfafc('0x2'));var fs=require('fs');var Redis=require(_0xfafc('0x3'));var db=require(_0xfafc('0x4'))['db'];var utils=require(_0xfafc('0x5'));var logger=require(_0xfafc('0x6'))(_0xfafc('0x7'));var config=require(_0xfafc('0x8'));var jayson=require(_0xfafc('0x9'));var client=jayson[_0xfafc('0xa')][_0xfafc('0xb')]({'port':0x232a});config[_0xfafc('0xc')]=_[_0xfafc('0xd')](config[_0xfafc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfafc('0xe'))(new Redis(config[_0xfafc('0xc')]));require(_0xfafc('0xf'))[_0xfafc('0x10')](socket);function respondWithRpcPromise(_0x675bb4,_0x5606eb,_0x5e6213){return new BPromise(function(_0x4e7ea3,_0x4375a5){return client[_0xfafc('0x11')](_0x675bb4,_0x5e6213)[_0xfafc('0x12')](function(_0x564a7f){logger['info'](_0xfafc('0x13'),_0x5606eb,'request\x20sent');logger[_0xfafc('0x14')](_0xfafc('0x15'),_0x5606eb,'request\x20sent',JSON[_0xfafc('0x16')](_0x564a7f));if(_0x564a7f[_0xfafc('0x17')]){if(_0x564a7f[_0xfafc('0x17')][_0xfafc('0x18')]===0x1f4){logger[_0xfafc('0x17')](_0xfafc('0x13'),_0x5606eb,_0x564a7f[_0xfafc('0x17')]['message']);return _0x4375a5(_0x564a7f[_0xfafc('0x17')]['message']);}logger[_0xfafc('0x17')](_0xfafc('0x13'),_0x5606eb,_0x564a7f[_0xfafc('0x17')]['message']);return _0x4e7ea3(_0x564a7f[_0xfafc('0x17')][_0xfafc('0x19')]);}else{logger['info'](_0xfafc('0x13'),_0x5606eb,_0xfafc('0x1a'));_0x4e7ea3(_0x564a7f[_0xfafc('0x1b')][_0xfafc('0x19')]);}})['catch'](function(_0x309369){logger[_0xfafc('0x17')](_0xfafc('0x13'),_0x5606eb,_0x309369);_0x4375a5(_0x309369);});});} \ No newline at end of file +var _0x4723=['../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','request','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x4723,0x115));var _0x3472=function(_0x328cdc,_0xe9775){_0x328cdc=_0x328cdc-0x0;var _0x17eea7=_0x4723[_0x328cdc];return _0x17eea7;};'use strict';var _=require('lodash');var util=require(_0x3472('0x0'));var moment=require('moment');var BPromise=require(_0x3472('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3472('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3472('0x3'))(_0x3472('0x4'));var config=require('../../config/environment');var jayson=require(_0x3472('0x5'));var client=jayson[_0x3472('0x6')]['http']({'port':0x232a});config[_0x3472('0x7')]=_[_0x3472('0x8')](config[_0x3472('0x7')],{'host':_0x3472('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3472('0x7')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x1e0eeb,_0x390946,_0x1dbbe8){return new BPromise(function(_0xd34349,_0x573315){return client[_0x3472('0xa')](_0x1e0eeb,_0x1dbbe8)['then'](function(_0x1c3236){logger['info']('DashboardItem,\x20%s,\x20%s',_0x390946,'request\x20sent');logger[_0x3472('0xb')](_0x3472('0xc'),_0x390946,_0x3472('0xd'),JSON[_0x3472('0xe')](_0x1c3236));if(_0x1c3236['error']){if(_0x1c3236['error']['code']===0x1f4){logger[_0x3472('0xf')](_0x3472('0x10'),_0x390946,_0x1c3236['error'][_0x3472('0x11')]);return _0x573315(_0x1c3236['error'][_0x3472('0x11')]);}logger[_0x3472('0xf')]('DashboardItem,\x20%s,\x20%s',_0x390946,_0x1c3236[_0x3472('0xf')]['message']);return _0xd34349(_0x1c3236[_0x3472('0xf')][_0x3472('0x11')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x390946,'request\x20sent');_0xd34349(_0x1c3236[_0x3472('0x12')][_0x3472('0x11')]);}})[_0x3472('0x13')](function(_0x135ba6){logger[_0x3472('0xf')](_0x3472('0x10'),_0x390946,_0x135ba6);_0x573315(_0x135ba6);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4acff2d..138974a 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 _0xfcac=['remove','update','removeListener','register','length','./dashboardItem.events','save'];(function(_0x191243,_0x203f89){var _0x48ecf2=function(_0x27ded1){while(--_0x27ded1){_0x191243['push'](_0x191243['shift']());}};_0x48ecf2(++_0x203f89);}(_0xfcac,0x98));var _0xcfca=function(_0x156ee1,_0x4bcf10){_0x156ee1=_0x156ee1-0x0;var _0x72c113=_0xfcac[_0x156ee1];return _0x72c113;};'use strict';var DashboardItemEvents=require(_0xcfca('0x0'));var events=[_0xcfca('0x1'),_0xcfca('0x2'),_0xcfca('0x3')];function createListener(_0x3800c9,_0x391d87){return function(_0x26cf23){_0x391d87['emit'](_0x3800c9,_0x26cf23);};}function removeListener(_0x384873,_0x32f7ad){return function(){DashboardItemEvents[_0xcfca('0x4')](_0x384873,_0x32f7ad);};}exports[_0xcfca('0x5')]=function(_0x5b7fcf){for(var _0x3b1703=0x0,_0x305427=events[_0xcfca('0x6')];_0x3b1703<_0x305427;_0x3b1703++){var _0x4a7178=events[_0x3b1703];var _0x288eca=createListener('dashboardItem:'+_0x4a7178,_0x5b7fcf);DashboardItemEvents['on'](_0x4a7178,_0x288eca);}}; \ No newline at end of file +var _0xe193=['save','remove','update','emit','length','dashboardItem:','./dashboardItem.events'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xe193,0x125));var _0x3e19=function(_0x2b8491,_0x428bf0){_0x2b8491=_0x2b8491-0x0;var _0x484b14=_0xe193[_0x2b8491];return _0x484b14;};'use strict';var DashboardItemEvents=require(_0x3e19('0x0'));var events=[_0x3e19('0x1'),_0x3e19('0x2'),_0x3e19('0x3')];function createListener(_0x129f7e,_0x1db5a){return function(_0x377738){_0x1db5a[_0x3e19('0x4')](_0x129f7e,_0x377738);};}function removeListener(_0x3f707b,_0xf72aa7){return function(){DashboardItemEvents['removeListener'](_0x3f707b,_0xf72aa7);};}exports['register']=function(_0x4df7c5){for(var _0x3c398e=0x0,_0x559cec=events[_0x3e19('0x5')];_0x3c398e<_0x559cec;_0x3c398e++){var _0x820931=events[_0x3c398e];var _0x57ea3e=createListener(_0x3e19('0x6')+_0x820931,_0x4df7c5);DashboardItemEvents['on'](_0x820931,_0x57ea3e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1347221..b6b4de6 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 _0x5601=['create','put','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','show','post','isAuthenticated'];(function(_0x13fbec,_0x5db7f7){var _0xa471d5=function(_0x4358cf){while(--_0x4358cf){_0x13fbec['push'](_0x13fbec['shift']());}};_0xa471d5(++_0x5db7f7);}(_0x5601,0x1be));var _0x1560=function(_0x29222b,_0x190e44){_0x29222b=_0x29222b-0x0;var _0x24b5e2=_0x5601[_0x29222b];return _0x24b5e2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1560('0x0'));var timeout=require(_0x1560('0x1'));var express=require(_0x1560('0x2'));var router=express[_0x1560('0x3')]();var fs_extra=require(_0x1560('0x4'));var auth=require(_0x1560('0x5'));var interaction=require(_0x1560('0x6'));var config=require(_0x1560('0x7'));var controller=require(_0x1560('0x8'));router['get'](_0x1560('0x9'),auth['isAuthenticated'](),controller[_0x1560('0xa')]);router[_0x1560('0xb')]('/',auth[_0x1560('0xc')](),controller[_0x1560('0xd')]);router[_0x1560('0xe')](_0x1560('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1560('0xf')](_0x1560('0x9'),auth[_0x1560('0xc')](),controller['destroy']);module[_0x1560('0x10')]=router; \ No newline at end of file +var _0x5cf0=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer'];(function(_0x17f397,_0x5bf1eb){var _0x65aa26=function(_0x2dfc7c){while(--_0x2dfc7c){_0x17f397['push'](_0x17f397['shift']());}};_0x65aa26(++_0x5bf1eb);}(_0x5cf0,0x1d3));var _0x05cf=function(_0x12bebf,_0x53a8fa){_0x12bebf=_0x12bebf-0x0;var _0x49667d=_0x5cf0[_0x12bebf];return _0x49667d;};'use strict';var multer=require(_0x05cf('0x0'));var util=require(_0x05cf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x05cf('0x2'));var router=express[_0x05cf('0x3')]();var fs_extra=require(_0x05cf('0x4'));var auth=require(_0x05cf('0x5'));var interaction=require(_0x05cf('0x6'));var config=require('../../config/environment');var controller=require(_0x05cf('0x7'));router[_0x05cf('0x8')](_0x05cf('0x9'),auth[_0x05cf('0xa')](),controller[_0x05cf('0xb')]);router[_0x05cf('0xc')]('/',auth[_0x05cf('0xa')](),controller['create']);router[_0x05cf('0xd')](_0x05cf('0x9'),auth[_0x05cf('0xa')](),controller[_0x05cf('0xe')]);router[_0x05cf('0xf')](_0x05cf('0x9'),auth['isAuthenticated'](),controller[_0x05cf('0x10')]);module[_0x05cf('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a32c05d..d49527e 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 _0x0e8c=['first','second','STRING','exports'];(function(_0x1bef07,_0x2a4e64){var _0x29edf6=function(_0x3e0230){while(--_0x3e0230){_0x1bef07['push'](_0x1bef07['shift']());}};_0x29edf6(++_0x2a4e64);}(_0x0e8c,0x1cf));var _0xc0e8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0e8c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xc0e8('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xc0e8('0x1'),_0xc0e8('0x2'),'third'),'allowNull':![],'defaultValue':_0xc0e8('0x1')},'description':{'type':Sequelize[_0xc0e8('0x3')]}}; \ No newline at end of file +var _0x04dd=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x04dd,0x14f));var _0xd04d=function(_0x51921f,_0x42bde0){_0x51921f=_0x51921f-0x0;var _0x41743a=_0x04dd[_0x51921f];return _0x41743a;};'use strict';var Sequelize=require(_0xd04d('0x0'));module[_0xd04d('0x1')]={'name':{'type':Sequelize[_0xd04d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xd04d('0x3')](_0xd04d('0x4'),_0xd04d('0x5'),_0xd04d('0x6')),'allowNull':![],'defaultValue':_0xd04d('0x4')},'description':{'type':Sequelize[_0xd04d('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 53dff19..be372e5 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 _0x7bfb=['includeAll','include','catch','params','rawAttributes','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','VIRTUAL','Disposition'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7bfb,0x199));var _0xb7bf=function(_0xa8f5ed,_0x37f782){_0xa8f5ed=_0xa8f5ed-0x0;var _0x99f5be=_0x7bfb[_0xa8f5ed];return _0x99f5be;};'use strict';var emlformat=require(_0xb7bf('0x0'));var rimraf=require(_0xb7bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7bf('0x2'));var rp=require('request-promise');var moment=require(_0xb7bf('0x3'));var BPromise=require(_0xb7bf('0x4'));var Mustache=require(_0xb7bf('0x5'));var util=require('util');var path=require(_0xb7bf('0x6'));var sox=require(_0xb7bf('0x7'));var csv=require(_0xb7bf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7bf('0x9'));var _=require(_0xb7bf('0xa'));var squel=require('squel');var crypto=require(_0xb7bf('0xb'));var jsforce=require(_0xb7bf('0xc'));var deskjs=require(_0xb7bf('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb7bf('0xe'));var authService=require(_0xb7bf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb7bf('0x10'));var hardwareService=require(_0xb7bf('0x11'));var logger=require(_0xb7bf('0x12'))(_0xb7bf('0x13'));var utils=require(_0xb7bf('0x14'));var config=require(_0xb7bf('0x15'));var licenseUtil=require(_0xb7bf('0x16'));var db=require(_0xb7bf('0x17'))['db'];function respondWithStatusCode(_0x28ae96,_0x25ea4e){_0x25ea4e=_0x25ea4e||0xcc;return function(_0x550c7d){if(_0x550c7d){return _0x28ae96[_0xb7bf('0x18')](_0x25ea4e);}return _0x28ae96[_0xb7bf('0x19')](_0x25ea4e)[_0xb7bf('0x1a')]();};}function respondWithResult(_0x145586,_0x1539fe){_0x1539fe=_0x1539fe||0xc8;return function(_0x1c2b47){if(_0x1c2b47){return _0x145586['status'](_0x1539fe)[_0xb7bf('0x1b')](_0x1c2b47);}};}function respondWithFilteredResult(_0x38da0e,_0x21a932){return function(_0x28dbfa){if(_0x28dbfa){var _0x513082=typeof _0x21a932[_0xb7bf('0x1c')]===_0xb7bf('0x1d')&&typeof _0x21a932['limit']==='undefined';var _0xd63709=_0x28dbfa[_0xb7bf('0x1e')];var _0x2a99eb=_0x513082?0x0:_0x21a932['offset'];var _0x2ab4b6=_0x513082?_0x28dbfa[_0xb7bf('0x1e')]:_0x21a932['offset']+_0x21a932['limit'];var _0x518d81;if(_0x2ab4b6>=_0xd63709){_0x2ab4b6=_0xd63709;_0x518d81=0xc8;}else{_0x518d81=0xce;}_0x38da0e['status'](_0x518d81);return _0x38da0e[_0xb7bf('0x1f')](_0xb7bf('0x20'),_0x2a99eb+'-'+_0x2ab4b6+'/'+_0xd63709)[_0xb7bf('0x1b')](_0x28dbfa);}return null;};}function patchUpdates(_0x3fe268){return function(_0x51342d){try{jsonpatch['apply'](_0x51342d,_0x3fe268,!![]);}catch(_0x18fbd8){return BPromise[_0xb7bf('0x21')](_0x18fbd8);}return _0x51342d['save']();};}function saveUpdates(_0x59842d,_0xe4c7df){return function(_0x362f32){if(_0x362f32){return _0x362f32[_0xb7bf('0x22')](_0x59842d)[_0xb7bf('0x23')](function(_0x116b87){return _0x116b87;});}return null;};}function removeEntity(_0x446d40,_0x3b52e4){return function(_0x40ee83){if(_0x40ee83){return _0x40ee83[_0xb7bf('0x24')]()[_0xb7bf('0x23')](function(){var _0x30e526=_0x40ee83[_0xb7bf('0x25')]({'plain':!![]});var _0x55bbf9=_0xb7bf('0x26');return db[_0xb7bf('0x27')][_0xb7bf('0x24')]({'where':{'type':_0x55bbf9,'resourceId':_0x30e526['id']}})[_0xb7bf('0x23')](function(){return _0x40ee83;});})[_0xb7bf('0x23')](function(){_0x446d40[_0xb7bf('0x19')](0xcc)[_0xb7bf('0x1a')]();});}};}function handleEntityNotFound(_0x31a030,_0x404423){return function(_0x4828cd){if(!_0x4828cd){_0x31a030[_0xb7bf('0x18')](0x194);}return _0x4828cd;};}function handleError(_0x3b2ed5,_0x2a7f45){_0x2a7f45=_0x2a7f45||0x1f4;return function(_0x2828cf){logger[_0xb7bf('0x28')](_0x2828cf[_0xb7bf('0x29')]);if(_0x2828cf[_0xb7bf('0x2a')]){delete _0x2828cf[_0xb7bf('0x2a')];}_0x3b2ed5[_0xb7bf('0x19')](_0x2a7f45)[_0xb7bf('0x2b')](_0x2828cf);};}exports[_0xb7bf('0x2c')]=function(_0x1957c7,_0x26f824){var _0x32a5ed={},_0x5d5e0b={},_0x504ed8={'count':0x0,'rows':[]};var _0x15faa4=_[_0xb7bf('0x2d')](db['Disposition']['rawAttributes'],function(_0x48956c){return{'name':_0x48956c['fieldName'],'type':_0x48956c[_0xb7bf('0x2e')][_0xb7bf('0x2f')]};});_0x5d5e0b[_0xb7bf('0x30')]=_['map'](_0x15faa4,_0xb7bf('0x2a'));_0x5d5e0b[_0xb7bf('0x31')]=_[_0xb7bf('0x32')](_0x1957c7['query']);_0x5d5e0b[_0xb7bf('0x33')]=_[_0xb7bf('0x34')](_0x5d5e0b[_0xb7bf('0x30')],_0x5d5e0b[_0xb7bf('0x31')]);_0x32a5ed[_0xb7bf('0x35')]=_['intersection'](_0x5d5e0b[_0xb7bf('0x30')],qs[_0xb7bf('0x36')](_0x1957c7[_0xb7bf('0x31')][_0xb7bf('0x36')]));_0x32a5ed[_0xb7bf('0x35')]=_0x32a5ed[_0xb7bf('0x35')][_0xb7bf('0x37')]?_0x32a5ed[_0xb7bf('0x35')]:_0x5d5e0b[_0xb7bf('0x30')];if(!_0x1957c7[_0xb7bf('0x31')][_0xb7bf('0x38')]('nolimit')){_0x32a5ed['limit']=qs[_0xb7bf('0x39')](_0x1957c7[_0xb7bf('0x31')][_0xb7bf('0x39')]);_0x32a5ed[_0xb7bf('0x1c')]=qs[_0xb7bf('0x1c')](_0x1957c7[_0xb7bf('0x31')]['offset']);}_0x32a5ed[_0xb7bf('0x3a')]=qs[_0xb7bf('0x3b')](_0x1957c7[_0xb7bf('0x31')][_0xb7bf('0x3b')]);_0x32a5ed['where']=qs['filters'](_[_0xb7bf('0x3c')](_0x1957c7['query'],_0x5d5e0b[_0xb7bf('0x33')]),_0x15faa4);if(_0x1957c7[_0xb7bf('0x31')][_0xb7bf('0x3d')]){_0x32a5ed['where']=_[_0xb7bf('0x3e')](_0x32a5ed['where'],{'$or':_[_0xb7bf('0x2d')](_0x15faa4,function(_0x360b34){if(_0x360b34[_0xb7bf('0x2e')]!==_0xb7bf('0x3f')){var _0x43bc65={};_0x43bc65[_0x360b34['name']]={'$like':'%'+_0x1957c7['query'][_0xb7bf('0x3d')]+'%'};return _0x43bc65;}})});}_0x32a5ed=_['merge']({},_0x32a5ed,_0x1957c7['options']);var _0x3da667={'where':_0x32a5ed['where']};return db[_0xb7bf('0x40')][_0xb7bf('0x1e')](_0x3da667)[_0xb7bf('0x23')](function(_0x219783){_0x504ed8['count']=_0x219783;if(_0x1957c7[_0xb7bf('0x31')][_0xb7bf('0x41')]){_0x32a5ed[_0xb7bf('0x42')]=[{'all':!![]}];}return db[_0xb7bf('0x40')]['findAll'](_0x32a5ed);})['then'](function(_0x5e9d44){_0x504ed8['rows']=_0x5e9d44;return _0x504ed8;})['then'](respondWithFilteredResult(_0x26f824,_0x32a5ed))[_0xb7bf('0x43')](handleError(_0x26f824,null));};exports['show']=function(_0x16ff6c,_0x4280de){var _0x1d4cf9={'raw':!![],'where':{'id':_0x16ff6c[_0xb7bf('0x44')]['id']}},_0x579173={};_0x579173[_0xb7bf('0x30')]=_[_0xb7bf('0x32')](db[_0xb7bf('0x40')][_0xb7bf('0x45')]);_0x579173[_0xb7bf('0x31')]=_[_0xb7bf('0x32')](_0x16ff6c[_0xb7bf('0x31')]);_0x579173[_0xb7bf('0x33')]=_[_0xb7bf('0x34')](_0x579173['model'],_0x579173[_0xb7bf('0x31')]);_0x1d4cf9[_0xb7bf('0x35')]=_[_0xb7bf('0x34')](_0x579173[_0xb7bf('0x30')],qs[_0xb7bf('0x36')](_0x16ff6c[_0xb7bf('0x31')][_0xb7bf('0x36')]));_0x1d4cf9[_0xb7bf('0x35')]=_0x1d4cf9['attributes'][_0xb7bf('0x37')]?_0x1d4cf9['attributes']:_0x579173['model'];if(_0x16ff6c[_0xb7bf('0x31')][_0xb7bf('0x41')]){_0x1d4cf9[_0xb7bf('0x42')]=[{'all':!![]}];}_0x1d4cf9=_['merge']({},_0x1d4cf9,_0x16ff6c[_0xb7bf('0x46')]);return db[_0xb7bf('0x40')][_0xb7bf('0x47')](_0x1d4cf9)['then'](handleEntityNotFound(_0x4280de,null))[_0xb7bf('0x23')](respondWithResult(_0x4280de,null))[_0xb7bf('0x43')](handleError(_0x4280de,null));};exports[_0xb7bf('0x48')]=function(_0x421a43,_0x3bcc70){return db[_0xb7bf('0x40')][_0xb7bf('0x48')](_0x421a43[_0xb7bf('0x49')],{})[_0xb7bf('0x23')](function(_0x4f36d5){var _0x2527b1=_0x421a43[_0xb7bf('0x4a')][_0xb7bf('0x25')]({'plain':!![]});if(!_0x2527b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2527b1[_0xb7bf('0x4b')]===_0xb7bf('0x4a')){var _0x383c98=_0x4f36d5['get']({'plain':!![]});var _0x44c4b0=_0xb7bf('0x26');return db[_0xb7bf('0x4c')]['find']({'where':{'name':_0x44c4b0,'userProfileId':_0x2527b1[_0xb7bf('0x4d')]},'raw':!![]})['then'](function(_0x41e2b2){if(_0x41e2b2&&_0x41e2b2[_0xb7bf('0x4e')]===0x0){return db[_0xb7bf('0x27')][_0xb7bf('0x48')]({'name':_0x383c98[_0xb7bf('0x2a')],'resourceId':_0x383c98['id'],'type':_0x41e2b2['name'],'sectionId':_0x41e2b2['id']},{})[_0xb7bf('0x23')](function(){return _0x4f36d5;});}else{return _0x4f36d5;}})[_0xb7bf('0x43')](function(_0x521e0a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x521e0a);throw _0x521e0a;});}return _0x4f36d5;})[_0xb7bf('0x23')](respondWithResult(_0x3bcc70,0xc9))[_0xb7bf('0x43')](handleError(_0x3bcc70,null));};exports['update']=function(_0x5f4042,_0x2b2071){if(_0x5f4042[_0xb7bf('0x49')]['id']){delete _0x5f4042[_0xb7bf('0x49')]['id'];}return db[_0xb7bf('0x40')][_0xb7bf('0x47')]({'where':{'id':_0x5f4042[_0xb7bf('0x44')]['id']}})[_0xb7bf('0x23')](handleEntityNotFound(_0x2b2071,null))[_0xb7bf('0x23')](saveUpdates(_0x5f4042[_0xb7bf('0x49')],null))[_0xb7bf('0x23')](respondWithResult(_0x2b2071,null))[_0xb7bf('0x43')](handleError(_0x2b2071,null));};exports[_0xb7bf('0x24')]=function(_0x504a25,_0x321c0d){return db[_0xb7bf('0x40')]['find']({'where':{'id':_0x504a25[_0xb7bf('0x44')]['id']}})[_0xb7bf('0x23')](handleEntityNotFound(_0x321c0d,null))[_0xb7bf('0x23')](removeEntity(_0x321c0d,null))[_0xb7bf('0x43')](handleError(_0x321c0d,null));}; \ No newline at end of file +var _0x238d=['set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','stack','index','map','fieldName','type','key','name','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Disposition','includeAll','findAll','show','rawAttributes','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','find','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x238d,0x123));var _0xd238=function(_0x469587,_0x2e65fb){_0x469587=_0x469587-0x0;var _0x50a7fc=_0x238d[_0x469587];return _0x50a7fc;};'use strict';var emlformat=require(_0xd238('0x0'));var rimraf=require(_0xd238('0x1'));var zipdir=require(_0xd238('0x2'));var jsonpatch=require(_0xd238('0x3'));var rp=require('request-promise');var moment=require(_0xd238('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd238('0x5'));var util=require('util');var path=require(_0xd238('0x6'));var sox=require(_0xd238('0x7'));var csv=require(_0xd238('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd238('0x9'));var _=require(_0xd238('0xa'));var squel=require(_0xd238('0xb'));var crypto=require(_0xd238('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd238('0x8'));var querystring=require(_0xd238('0xd'));var Papa=require(_0xd238('0xe'));var Redis=require('ioredis');var authService=require(_0xd238('0xf'));var qs=require(_0xd238('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd238('0x11'));var logger=require(_0xd238('0x12'))('api');var utils=require(_0xd238('0x13'));var config=require(_0xd238('0x14'));var licenseUtil=require(_0xd238('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf91d80,_0x3e976c){_0x3e976c=_0x3e976c||0xcc;return function(_0x520060){if(_0x520060){return _0xf91d80[_0xd238('0x16')](_0x3e976c);}return _0xf91d80[_0xd238('0x17')](_0x3e976c)['end']();};}function respondWithResult(_0x4f6a65,_0x395458){_0x395458=_0x395458||0xc8;return function(_0x127466){if(_0x127466){return _0x4f6a65[_0xd238('0x17')](_0x395458)[_0xd238('0x18')](_0x127466);}};}function respondWithFilteredResult(_0x14a9d3,_0x32f66c){return function(_0x247099){if(_0x247099){var _0x49ece3=typeof _0x32f66c[_0xd238('0x19')]===_0xd238('0x1a')&&typeof _0x32f66c['limit']===_0xd238('0x1a');var _0x47346c=_0x247099[_0xd238('0x1b')];var _0x3c281e=_0x49ece3?0x0:_0x32f66c[_0xd238('0x19')];var _0x1a5e94=_0x49ece3?_0x247099[_0xd238('0x1b')]:_0x32f66c[_0xd238('0x19')]+_0x32f66c[_0xd238('0x1c')];var _0x3ad878;if(_0x1a5e94>=_0x47346c){_0x1a5e94=_0x47346c;_0x3ad878=0xc8;}else{_0x3ad878=0xce;}_0x14a9d3[_0xd238('0x17')](_0x3ad878);return _0x14a9d3[_0xd238('0x1d')](_0xd238('0x1e'),_0x3c281e+'-'+_0x1a5e94+'/'+_0x47346c)['json'](_0x247099);}return null;};}function patchUpdates(_0xd905e2){return function(_0x406324){try{jsonpatch[_0xd238('0x1f')](_0x406324,_0xd905e2,!![]);}catch(_0xf9247){return BPromise[_0xd238('0x20')](_0xf9247);}return _0x406324[_0xd238('0x21')]();};}function saveUpdates(_0x589036,_0x42b2e3){return function(_0x51460f){if(_0x51460f){return _0x51460f[_0xd238('0x22')](_0x589036)['then'](function(_0x34defc){return _0x34defc;});}return null;};}function removeEntity(_0xeb4572,_0xd4e3e4){return function(_0x75f8a6){if(_0x75f8a6){return _0x75f8a6[_0xd238('0x23')]()['then'](function(){var _0x2ca995=_0x75f8a6[_0xd238('0x24')]({'plain':!![]});var _0x2c3979='Dispositions';return db[_0xd238('0x25')]['destroy']({'where':{'type':_0x2c3979,'resourceId':_0x2ca995['id']}})[_0xd238('0x26')](function(){return _0x75f8a6;});})['then'](function(){_0xeb4572[_0xd238('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e52e8,_0x159c17){return function(_0x58d39d){if(!_0x58d39d){_0x4e52e8[_0xd238('0x16')](0x194);}return _0x58d39d;};}function handleError(_0x4a8510,_0x28a0a9){_0x28a0a9=_0x28a0a9||0x1f4;return function(_0x28d9ea){logger[_0xd238('0x27')](_0x28d9ea[_0xd238('0x28')]);if(_0x28d9ea['name']){delete _0x28d9ea['name'];}_0x4a8510[_0xd238('0x17')](_0x28a0a9)['send'](_0x28d9ea);};}exports[_0xd238('0x29')]=function(_0x5f0574,_0x189fbd){var _0x190db1={},_0x3ebbe7={},_0x3c8f5d={'count':0x0,'rows':[]};var _0x453cf9=_[_0xd238('0x2a')](db['Disposition']['rawAttributes'],function(_0x1c68ea){return{'name':_0x1c68ea[_0xd238('0x2b')],'type':_0x1c68ea[_0xd238('0x2c')][_0xd238('0x2d')]};});_0x3ebbe7['model']=_[_0xd238('0x2a')](_0x453cf9,_0xd238('0x2e'));_0x3ebbe7['query']=_[_0xd238('0x2f')](_0x5f0574[_0xd238('0x30')]);_0x3ebbe7[_0xd238('0x31')]=_['intersection'](_0x3ebbe7['model'],_0x3ebbe7[_0xd238('0x30')]);_0x190db1[_0xd238('0x32')]=_[_0xd238('0x33')](_0x3ebbe7[_0xd238('0x34')],qs[_0xd238('0x35')](_0x5f0574[_0xd238('0x30')][_0xd238('0x35')]));_0x190db1[_0xd238('0x32')]=_0x190db1[_0xd238('0x32')][_0xd238('0x36')]?_0x190db1[_0xd238('0x32')]:_0x3ebbe7[_0xd238('0x34')];if(!_0x5f0574[_0xd238('0x30')][_0xd238('0x37')](_0xd238('0x38'))){_0x190db1[_0xd238('0x1c')]=qs[_0xd238('0x1c')](_0x5f0574['query'][_0xd238('0x1c')]);_0x190db1[_0xd238('0x19')]=qs[_0xd238('0x19')](_0x5f0574[_0xd238('0x30')][_0xd238('0x19')]);}_0x190db1[_0xd238('0x39')]=qs[_0xd238('0x3a')](_0x5f0574['query'][_0xd238('0x3a')]);_0x190db1[_0xd238('0x3b')]=qs[_0xd238('0x31')](_['pick'](_0x5f0574[_0xd238('0x30')],_0x3ebbe7[_0xd238('0x31')]),_0x453cf9);if(_0x5f0574[_0xd238('0x30')][_0xd238('0x3c')]){_0x190db1[_0xd238('0x3b')]=_['merge'](_0x190db1[_0xd238('0x3b')],{'$or':_[_0xd238('0x2a')](_0x453cf9,function(_0xe8630a){if(_0xe8630a[_0xd238('0x2c')]!=='VIRTUAL'){var _0x75324c={};_0x75324c[_0xe8630a[_0xd238('0x2e')]]={'$like':'%'+_0x5f0574['query'][_0xd238('0x3c')]+'%'};return _0x75324c;}})});}_0x190db1=_[_0xd238('0x3d')]({},_0x190db1,_0x5f0574[_0xd238('0x3e')]);var _0x294049={'where':_0x190db1[_0xd238('0x3b')]};return db[_0xd238('0x3f')][_0xd238('0x1b')](_0x294049)[_0xd238('0x26')](function(_0x283383){_0x3c8f5d[_0xd238('0x1b')]=_0x283383;if(_0x5f0574[_0xd238('0x30')][_0xd238('0x40')]){_0x190db1['include']=[{'all':!![]}];}return db[_0xd238('0x3f')][_0xd238('0x41')](_0x190db1);})['then'](function(_0x172434){_0x3c8f5d['rows']=_0x172434;return _0x3c8f5d;})[_0xd238('0x26')](respondWithFilteredResult(_0x189fbd,_0x190db1))['catch'](handleError(_0x189fbd,null));};exports[_0xd238('0x42')]=function(_0x49cbf8,_0x4b4662){var _0xad3e19={'raw':!![],'where':{'id':_0x49cbf8['params']['id']}},_0x479516={};_0x479516[_0xd238('0x34')]=_[_0xd238('0x2f')](db[_0xd238('0x3f')][_0xd238('0x43')]);_0x479516[_0xd238('0x30')]=_[_0xd238('0x2f')](_0x49cbf8['query']);_0x479516[_0xd238('0x31')]=_[_0xd238('0x33')](_0x479516[_0xd238('0x34')],_0x479516['query']);_0xad3e19[_0xd238('0x32')]=_[_0xd238('0x33')](_0x479516[_0xd238('0x34')],qs['fields'](_0x49cbf8['query'][_0xd238('0x35')]));_0xad3e19[_0xd238('0x32')]=_0xad3e19['attributes'][_0xd238('0x36')]?_0xad3e19[_0xd238('0x32')]:_0x479516[_0xd238('0x34')];if(_0x49cbf8[_0xd238('0x30')][_0xd238('0x40')]){_0xad3e19[_0xd238('0x44')]=[{'all':!![]}];}_0xad3e19=_[_0xd238('0x3d')]({},_0xad3e19,_0x49cbf8[_0xd238('0x3e')]);return db[_0xd238('0x3f')]['find'](_0xad3e19)[_0xd238('0x26')](handleEntityNotFound(_0x4b4662,null))[_0xd238('0x26')](respondWithResult(_0x4b4662,null))[_0xd238('0x45')](handleError(_0x4b4662,null));};exports[_0xd238('0x46')]=function(_0x4881d1,_0x368284){return db[_0xd238('0x3f')][_0xd238('0x46')](_0x4881d1[_0xd238('0x47')],{})[_0xd238('0x26')](function(_0x162cf3){var _0x5e9648=_0x4881d1[_0xd238('0x48')][_0xd238('0x24')]({'plain':!![]});if(!_0x5e9648)throw new Error(_0xd238('0x49'));if(_0x5e9648[_0xd238('0x4a')]===_0xd238('0x48')){var _0x5257dd=_0x162cf3[_0xd238('0x24')]({'plain':!![]});var _0x51bc00=_0xd238('0x4b');return db['UserProfileSection'][_0xd238('0x4c')]({'where':{'name':_0x51bc00,'userProfileId':_0x5e9648[_0xd238('0x4d')]},'raw':!![]})[_0xd238('0x26')](function(_0x4fb0f6){if(_0x4fb0f6&&_0x4fb0f6[_0xd238('0x4e')]===0x0){return db['UserProfileResource'][_0xd238('0x46')]({'name':_0x5257dd[_0xd238('0x2e')],'resourceId':_0x5257dd['id'],'type':_0x4fb0f6['name'],'sectionId':_0x4fb0f6['id']},{})['then'](function(){return _0x162cf3;});}else{return _0x162cf3;}})[_0xd238('0x45')](function(_0x24e9c1){logger[_0xd238('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24e9c1);throw _0x24e9c1;});}return _0x162cf3;})['then'](respondWithResult(_0x368284,0xc9))['catch'](handleError(_0x368284,null));};exports[_0xd238('0x22')]=function(_0x1b8ac0,_0x602986){if(_0x1b8ac0[_0xd238('0x47')]['id']){delete _0x1b8ac0['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x1b8ac0[_0xd238('0x4f')]['id']}})['then'](handleEntityNotFound(_0x602986,null))[_0xd238('0x26')](saveUpdates(_0x1b8ac0['body'],null))['then'](respondWithResult(_0x602986,null))[_0xd238('0x45')](handleError(_0x602986,null));};exports[_0xd238('0x23')]=function(_0x43e63a,_0x1d4bd7){return db['Disposition'][_0xd238('0x4c')]({'where':{'id':_0x43e63a[_0xd238('0x4f')]['id']}})[_0xd238('0x26')](handleEntityNotFound(_0x1d4bd7,null))[_0xd238('0x26')](removeEntity(_0x1d4bd7,null))[_0xd238('0x45')](handleError(_0x1d4bd7,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7fa200b..7e4e7f9 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 _0x5e3a=['MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId'];(function(_0x5df2ef,_0x38f33e){var _0x4df202=function(_0x50dff5){while(--_0x50dff5){_0x5df2ef['push'](_0x5df2ef['shift']());}};_0x4df202(++_0x38f33e);}(_0x5e3a,0x105));var _0xa5e3=function(_0x49b69e,_0x473561){_0x49b69e=_0x49b69e-0x0;var _0x32812c=_0x5e3a[_0x49b69e];return _0x32812c;};'use strict';var _=require(_0xa5e3('0x0'));var util=require(_0xa5e3('0x1'));var logger=require(_0xa5e3('0x2'))(_0xa5e3('0x3'));var moment=require('moment');var BPromise=require(_0xa5e3('0x4'));var rp=require(_0xa5e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5e3('0x6'));var config=require('../../config/environment');var attributes=require(_0xa5e3('0x7'));module[_0xa5e3('0x8')]=function(_0x1827d4,_0x2548ff){return _0x1827d4['define'](_0xa5e3('0x9'),attributes,{'tableName':_0xa5e3('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa5e3('0xb'),'fields':[_0xa5e3('0xc'),_0xa5e3('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xa5e3('0xc'),_0xa5e3('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0xa5e3('0xc'),_0xa5e3('0xf')]},{'unique':!![],'name':'name_sms','fields':['name',_0xa5e3('0x10')]},{'unique':!![],'name':_0xa5e3('0x11'),'fields':[_0xa5e3('0xc'),_0xa5e3('0x12')]},{'unique':!![],'name':_0xa5e3('0x13'),'fields':[_0xa5e3('0xc'),_0xa5e3('0x14')]},{'unique':!![],'name':_0xa5e3('0x15'),'fields':[_0xa5e3('0xc'),_0xa5e3('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3620=['bluebird','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','ChatWebsiteId','name_mail','name','MailAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment'];(function(_0x543b08,_0x36bcfc){var _0x1e08e4=function(_0x3bf864){while(--_0x3bf864){_0x543b08['push'](_0x543b08['shift']());}};_0x1e08e4(++_0x36bcfc);}(_0x3620,0xc4));var _0x0362=function(_0x3c4cb8,_0x227405){_0x3c4cb8=_0x3c4cb8-0x0;var _0x5eacf7=_0x3620[_0x3c4cb8];return _0x5eacf7;};'use strict';var _=require(_0x0362('0x0'));var util=require(_0x0362('0x1'));var logger=require('../../config/logger')(_0x0362('0x2'));var moment=require(_0x0362('0x3'));var BPromise=require(_0x0362('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0362('0x5'));var rimraf=require(_0x0362('0x6'));var config=require(_0x0362('0x7'));var attributes=require(_0x0362('0x8'));module['exports']=function(_0xd57a9d,_0x7b95d){return _0xd57a9d[_0x0362('0x9')](_0x0362('0xa'),attributes,{'tableName':_0x0362('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x0362('0xc'),'fields':['name',_0x0362('0xd')]},{'unique':!![],'name':_0x0362('0xe'),'fields':['name',_0x0362('0xf')]},{'unique':!![],'name':_0x0362('0x10'),'fields':[_0x0362('0x11'),_0x0362('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0x0362('0x11'),'SmsAccountId']},{'unique':!![],'name':_0x0362('0x13'),'fields':['name',_0x0362('0x14')]},{'unique':!![],'name':_0x0362('0x15'),'fields':[_0x0362('0x11'),_0x0362('0x16')]},{'unique':!![],'name':_0x0362('0x17'),'fields':[_0x0362('0x11'),_0x0362('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7b98c6e..5a2a6cf 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(_0x36eb97,_0x16dda1){var _0x9f35ca=function(_0x58f807){while(--_0x58f807){_0x36eb97['push'](_0x36eb97['shift']());}};_0x9f35ca(++_0x16dda1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x25b4aa,_0xae1d10){var _0x373b29=function(_0x7da86f){while(--_0x7da86f){_0x25b4aa['push'](_0x25b4aa['shift']());}};_0x373b29(++_0xae1d10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 8351406..bad32e7 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 _0xaaf9=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3e6544,_0x3f797f){var _0x22848b=function(_0x565851){while(--_0x565851){_0x3e6544['push'](_0x3e6544['shift']());}};_0x22848b(++_0x3f797f);}(_0xaaf9,0x1a9));var _0x9aaf=function(_0x2edb9a,_0x16853e){_0x2edb9a=_0x2edb9a-0x0;var _0x1f00a5=_0xaaf9[_0x2edb9a];return _0x1f00a5;};'use strict';var multer=require(_0x9aaf('0x0'));var util=require(_0x9aaf('0x1'));var path=require(_0x9aaf('0x2'));var timeout=require(_0x9aaf('0x3'));var express=require(_0x9aaf('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9aaf('0x5'));var interaction=require(_0x9aaf('0x6'));var config=require(_0x9aaf('0x7'));var controller=require(_0x9aaf('0x8'));router[_0x9aaf('0x9')]('/',auth[_0x9aaf('0xa')](),controller[_0x9aaf('0xb')]);router[_0x9aaf('0x9')](_0x9aaf('0xc'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0xd')]);router[_0x9aaf('0xe')]('/',auth[_0x9aaf('0xa')](),controller['create']);router['put'](_0x9aaf('0xc'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0xf')]);router[_0x9aaf('0x10')](_0x9aaf('0xc'),auth[_0x9aaf('0xa')](),controller['destroy']);module[_0x9aaf('0x11')]=router; \ No newline at end of file +var _0x6485=['index','isAuthenticated','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6485,0xb3));var _0x5648=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6485[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x5648('0x0'));var util=require(_0x5648('0x1'));var path=require(_0x5648('0x2'));var timeout=require(_0x5648('0x3'));var express=require(_0x5648('0x4'));var router=express[_0x5648('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5648('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5648('0x7'));var controller=require('./disposition.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5648('0x8')]);router['get']('/:id',auth[_0x5648('0x9')](),controller[_0x5648('0xa')]);router['post']('/',auth[_0x5648('0x9')](),controller[_0x5648('0xb')]);router['put'](_0x5648('0xc'),auth[_0x5648('0x9')](),controller[_0x5648('0xd')]);router[_0x5648('0xe')](_0x5648('0xc'),auth[_0x5648('0x9')](),controller[_0x5648('0xf')]);module[_0x5648('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 64dba5e..cdbc6b6 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 _0x0d4d=['2400','4800','7200','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x0d4d,0x132));var _0xd0d4=function(_0x568867,_0x3f0794){_0x568867=_0x568867-0x0;var _0x5db26a=_0x0d4d[_0x568867];return _0x5db26a;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module[_0xd0d4('0x1')]={'name':{'type':Sequelize[_0xd0d4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd0d4('0x2')]},'ecm':{'type':Sequelize[_0xd0d4('0x3')](_0xd0d4('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xd0d4('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xd0d4('0x2')],'unique':_0xd0d4('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xd0d4('0x6'),_0xd0d4('0x7'),_0xd0d4('0x8'),'9600',_0xd0d4('0x9'),'14400'),'defaultValue':_0xd0d4('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0xd0d4('0x6'),_0xd0d4('0x7'),_0xd0d4('0x8'),'9600',_0xd0d4('0x9'),_0xd0d4('0xa')),'defaultValue':_0xd0d4('0xa')},'modem':{'type':Sequelize[_0xd0d4('0x2')],'defaultValue':_0xd0d4('0xb')},'gateway':{'type':Sequelize[_0xd0d4('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[_0xd0d4('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd0d4('0x3')](_0xd0d4('0xd'),_0xd0d4('0xe'),_0xd0d4('0xf'),_0xd0d4('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xd0d4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd0d4('0x11')],'defaultValue':function(){return _0xd0d4('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd0d4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd0d4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd0d4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd0d4('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd0d4('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xd0d4('0x13')],'defaultValue':![],'comment':_0xd0d4('0x15'),'set':function(_0x5079d5){if(!_0x5079d5)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xd0d4('0x16')](_0xd0d4('0x17'),_0x5079d5);}}}; \ No newline at end of file +var _0xf767=['7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x40212e,_0x37a1b6){var _0x14b040=function(_0x42e08e){while(--_0x42e08e){_0x40212e['push'](_0x40212e['shift']());}};_0x14b040(++_0x37a1b6);}(_0xf767,0x76));var _0x7f76=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0xf767[_0x590b63];return _0x3c9380;};'use strict';var Sequelize=require('sequelize');module[_0x7f76('0x0')]={'name':{'type':Sequelize[_0x7f76('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f76('0x1')]},'ecm':{'type':Sequelize[_0x7f76('0x2')](_0x7f76('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x7f76('0x1')],'defaultValue':_0x7f76('0x4')},'localstationid':{'type':Sequelize[_0x7f76('0x1')],'unique':_0x7f76('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x7f76('0x6'),_0x7f76('0x7'),_0x7f76('0x8'),_0x7f76('0x9'),_0x7f76('0xa'),'14400'),'defaultValue':_0x7f76('0x7')},'maxrate':{'type':Sequelize[_0x7f76('0x2')](_0x7f76('0x6'),_0x7f76('0x7'),'7200',_0x7f76('0x9'),'12000',_0x7f76('0xb')),'defaultValue':_0x7f76('0xb')},'modem':{'type':Sequelize[_0x7f76('0x1')],'defaultValue':_0x7f76('0xc')},'gateway':{'type':Sequelize[_0x7f76('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7f76('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7f76('0x2')](_0x7f76('0xd'),_0x7f76('0xe'),_0x7f76('0xf'),_0x7f76('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x7f76('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7f76('0x11');}},'notificationSound':{'type':Sequelize[_0x7f76('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7f76('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7f76('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7f76('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7f76('0x13')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7f76('0x12')],'defaultValue':![],'comment':_0x7f76('0x14'),'set':function(_0x431076){if(!_0x431076)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x431076);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9a30ce5..dd72278 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 _0x80b0=['emit','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','length','find','create','body','user','role','UserProfileSection','autoAssociation','params','describe','FaxAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','addAnswer','CannedAnswer','rows','removeAnswers','ids','FaxInteraction','addInteraction','getInteractions','CmContact','User','fullname','internal','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','modem','FAXOPT(','Wait','addAccountApplications','VoiceExtension','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','path','from','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','spread','userFaxAccount:save'];(function(_0x10fd47,_0x39ac07){var _0x5a1252=function(_0xce86e8){while(--_0xce86e8){_0x10fd47['push'](_0x10fd47['shift']());}};_0x5a1252(++_0x39ac07);}(_0x80b0,0x181));var _0x080b=function(_0x34bf56,_0x265112){_0x34bf56=_0x34bf56-0x0;var _0x2fddd4=_0x80b0[_0x34bf56];return _0x2fddd4;};'use strict';var emlformat=require(_0x080b('0x0'));var rimraf=require(_0x080b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x080b('0x2'));var rp=require(_0x080b('0x3'));var moment=require('moment');var BPromise=require(_0x080b('0x4'));var Mustache=require(_0x080b('0x5'));var util=require(_0x080b('0x6'));var path=require('path');var sox=require(_0x080b('0x7'));var csv=require('to-csv');var ejs=require(_0x080b('0x8'));var fs=require('fs');var fs_extra=require(_0x080b('0x9'));var _=require(_0x080b('0xa'));var squel=require('squel');var crypto=require(_0x080b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x080b('0xc'));var toCsv=require(_0x080b('0xd'));var querystring=require(_0x080b('0xe'));var Papa=require(_0x080b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x080b('0x10'));var as=require(_0x080b('0x11'));var hardwareService=require(_0x080b('0x12'));var logger=require('../../config/logger')(_0x080b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x080b('0x14'))['db'];config['redis']=_[_0x080b('0x15')](config['redis'],{'host':_0x080b('0x16'),'port':0x18eb});var socket=require(_0x080b('0x17'))(new Redis(config[_0x080b('0x18')]));require(_0x080b('0x19'))[_0x080b('0x1a')](socket);var jayson=require(_0x080b('0x1b'));var client=jayson[_0x080b('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x080b('0x1c')][_0x080b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3dd6ae,_0x15a31e,_0xdd427e,_0x5d955f){return new BPromise(function(_0x1f802e,_0x102a59){var _0x1093af=_0x5d955f||client;return _0x1093af[_0x080b('0x1e')](_0x3dd6ae,_0xdd427e)[_0x080b('0x1f')](function(_0x54afb3){logger['info']('FaxAccount,\x20%s,\x20%s',_0x15a31e,_0x080b('0x20'));logger[_0x080b('0x21')](_0x080b('0x22'),_0x15a31e,'request\x20sent',JSON[_0x080b('0x23')](_0x54afb3));if(_0x54afb3[_0x080b('0x24')]){if(_0x54afb3[_0x080b('0x24')]['code']===0x1f4){logger[_0x080b('0x24')](_0x080b('0x25'),_0x15a31e,_0x54afb3[_0x080b('0x24')][_0x080b('0x26')]);return _0x102a59(_0x54afb3[_0x080b('0x24')][_0x080b('0x26')]);}logger[_0x080b('0x24')](_0x080b('0x25'),_0x15a31e,_0x54afb3['error']['message']);return _0x1f802e(_0x54afb3[_0x080b('0x24')][_0x080b('0x26')]);}else{logger[_0x080b('0x27')](_0x080b('0x25'),_0x15a31e,_0x080b('0x20'));_0x1f802e(_0x54afb3[_0x080b('0x28')]['message']);}})[_0x080b('0x29')](function(_0x8bca0b){logger[_0x080b('0x24')](_0x080b('0x25'),_0x15a31e,_0x8bca0b);_0x102a59(_0x8bca0b);});});}function respondWithStatusCode(_0x3eabc9,_0x3bb079){_0x3bb079=_0x3bb079||0xcc;return function(_0x18d0bc){if(_0x18d0bc){return _0x3eabc9[_0x080b('0x2a')](_0x3bb079);}return _0x3eabc9['status'](_0x3bb079)[_0x080b('0x2b')]();};}function respondWithResult(_0x458ae0,_0x45bf5a){_0x45bf5a=_0x45bf5a||0xc8;return function(_0xbeaed9){if(_0xbeaed9){return _0x458ae0[_0x080b('0x2c')](_0x45bf5a)[_0x080b('0x2d')](_0xbeaed9);}};}function respondWithFilteredResult(_0x42084b,_0x38009d){return function(_0x3e46ce){if(_0x3e46ce){var _0x3dd150=typeof _0x38009d['offset']===_0x080b('0x2e')&&typeof _0x38009d['limit']==='undefined';var _0x30de4e=_0x3e46ce[_0x080b('0x2f')];var _0x32e274=_0x3dd150?0x0:_0x38009d[_0x080b('0x30')];var _0x4e0601=_0x3dd150?_0x3e46ce['count']:_0x38009d[_0x080b('0x30')]+_0x38009d[_0x080b('0x31')];var _0x4949fc;if(_0x4e0601>=_0x30de4e){_0x4e0601=_0x30de4e;_0x4949fc=0xc8;}else{_0x4949fc=0xce;}_0x42084b['status'](_0x4949fc);return _0x42084b['set'](_0x080b('0x32'),_0x32e274+'-'+_0x4e0601+'/'+_0x30de4e)[_0x080b('0x2d')](_0x3e46ce);}return null;};}function patchUpdates(_0xadb14c){return function(_0x3baba6){try{jsonpatch[_0x080b('0x33')](_0x3baba6,_0xadb14c,!![]);}catch(_0x499722){return BPromise[_0x080b('0x34')](_0x499722);}return _0x3baba6[_0x080b('0x35')]();};}function saveUpdates(_0x54b172,_0x38de8a){return function(_0x3f2837){if(_0x3f2837){return _0x3f2837[_0x080b('0x36')](_0x54b172)[_0x080b('0x1f')](function(_0x52ee7e){return _0x52ee7e;});}return null;};}function removeEntity(_0x5226e4,_0x151cf6){return function(_0x1cdca0){if(_0x1cdca0){return _0x1cdca0['destroy']()[_0x080b('0x1f')](function(){var _0x35f567=_0x1cdca0[_0x080b('0x37')]({'plain':!![]});var _0x5584e7=_0x080b('0x38');return db[_0x080b('0x39')][_0x080b('0x3a')]({'where':{'type':_0x5584e7,'resourceId':_0x35f567['id']}})['then'](function(){return _0x1cdca0;});})[_0x080b('0x1f')](function(){_0x5226e4[_0x080b('0x2c')](0xcc)[_0x080b('0x2b')]();});}};}function handleEntityNotFound(_0x5c4e92,_0x466b1c){return function(_0x360fb9){if(!_0x360fb9){_0x5c4e92[_0x080b('0x2a')](0x194);}return _0x360fb9;};}function handleError(_0xe7b9b3,_0x79ab5a){_0x79ab5a=_0x79ab5a||0x1f4;return function(_0x3210f6){logger[_0x080b('0x24')](_0x3210f6[_0x080b('0x3b')]);if(_0x3210f6[_0x080b('0x3c')]){delete _0x3210f6[_0x080b('0x3c')];}_0xe7b9b3[_0x080b('0x2c')](_0x79ab5a)[_0x080b('0x3d')](_0x3210f6);};}exports[_0x080b('0x3e')]=function(_0x3a17a3,_0x2a64d5){var _0x46ff8a={'include':[{'model':db[_0x080b('0x3f')],'as':_0x080b('0x40')}]},_0x1f1428={},_0x2c4b44={'count':0x0,'rows':[]};var _0x8cf041=_[_0x080b('0x41')](db[_0x080b('0x42')][_0x080b('0x43')],function(_0x54adb7){return{'name':_0x54adb7[_0x080b('0x44')],'type':_0x54adb7[_0x080b('0x45')][_0x080b('0x46')]};});_0x1f1428[_0x080b('0x47')]=_[_0x080b('0x41')](_0x8cf041,'name');_0x1f1428['query']=_[_0x080b('0x48')](_0x3a17a3['query']);_0x1f1428[_0x080b('0x49')]=_[_0x080b('0x4a')](_0x1f1428[_0x080b('0x47')],_0x1f1428[_0x080b('0x4b')]);_0x46ff8a[_0x080b('0x4c')]=_[_0x080b('0x4a')](_0x1f1428[_0x080b('0x47')],qs[_0x080b('0x4d')](_0x3a17a3[_0x080b('0x4b')][_0x080b('0x4d')]));_0x46ff8a[_0x080b('0x4c')]=_0x46ff8a[_0x080b('0x4c')]['length']?_0x46ff8a[_0x080b('0x4c')]:_0x1f1428[_0x080b('0x47')];if(!_0x3a17a3[_0x080b('0x4b')][_0x080b('0x4e')](_0x080b('0x4f'))){_0x46ff8a[_0x080b('0x31')]=qs['limit'](_0x3a17a3[_0x080b('0x4b')][_0x080b('0x31')]);_0x46ff8a['offset']=qs['offset'](_0x3a17a3[_0x080b('0x4b')]['offset']);}_0x46ff8a[_0x080b('0x50')]=qs['sort'](_0x3a17a3[_0x080b('0x4b')][_0x080b('0x51')]);_0x46ff8a['where']=qs[_0x080b('0x49')](_['pick'](_0x3a17a3[_0x080b('0x4b')],_0x1f1428[_0x080b('0x49')]),_0x8cf041);if(_0x3a17a3[_0x080b('0x4b')][_0x080b('0x52')]){_0x46ff8a['where']=_['merge'](_0x46ff8a['where'],{'$or':_['map'](_0x8cf041,function(_0x3070e8){if(_0x3070e8['type']!==_0x080b('0x53')){var _0x19a37d={};_0x19a37d[_0x3070e8[_0x080b('0x3c')]]={'$like':'%'+_0x3a17a3[_0x080b('0x4b')][_0x080b('0x52')]+'%'};return _0x19a37d;}})});}_0x46ff8a=_[_0x080b('0x54')]({},_0x46ff8a,_0x3a17a3[_0x080b('0x55')]);var _0x100503={'where':_0x46ff8a[_0x080b('0x56')]};return db[_0x080b('0x42')][_0x080b('0x2f')](_0x100503)[_0x080b('0x1f')](function(_0x4b3053){_0x2c4b44[_0x080b('0x2f')]=_0x4b3053;if(_0x3a17a3['query'][_0x080b('0x57')]){_0x46ff8a[_0x080b('0x58')]=[{'all':!![]}];}return db[_0x080b('0x42')][_0x080b('0x59')](_0x46ff8a);})[_0x080b('0x1f')](function(_0x571184){_0x2c4b44['rows']=_0x571184;return _0x2c4b44;})[_0x080b('0x1f')](respondWithFilteredResult(_0x2a64d5,_0x46ff8a))['catch'](handleError(_0x2a64d5,null));};exports['show']=function(_0x436598,_0x53c39a){var _0x28ee03={'raw':![],'where':{'id':_0x436598['params']['id']},'include':[{'model':db[_0x080b('0x3f')],'as':'mandatoryDispositionPause'}]},_0x5736ab={};_0x5736ab[_0x080b('0x47')]=_[_0x080b('0x48')](db[_0x080b('0x42')][_0x080b('0x43')]);_0x5736ab[_0x080b('0x4b')]=_[_0x080b('0x48')](_0x436598[_0x080b('0x4b')]);_0x5736ab[_0x080b('0x49')]=_[_0x080b('0x4a')](_0x5736ab['model'],_0x5736ab[_0x080b('0x4b')]);_0x28ee03[_0x080b('0x4c')]=_[_0x080b('0x4a')](_0x5736ab['model'],qs[_0x080b('0x4d')](_0x436598[_0x080b('0x4b')][_0x080b('0x4d')]));_0x28ee03[_0x080b('0x4c')]=_0x28ee03[_0x080b('0x4c')][_0x080b('0x5a')]?_0x28ee03[_0x080b('0x4c')]:_0x5736ab['model'];if(_0x436598[_0x080b('0x4b')]['includeAll']){_0x28ee03[_0x080b('0x58')]=[{'all':!![]}];}_0x28ee03=_[_0x080b('0x54')]({},_0x28ee03,_0x436598[_0x080b('0x55')]);return db[_0x080b('0x42')][_0x080b('0x5b')](_0x28ee03)[_0x080b('0x1f')](handleEntityNotFound(_0x53c39a,null))[_0x080b('0x1f')](respondWithResult(_0x53c39a,null))[_0x080b('0x29')](handleError(_0x53c39a,null));};exports[_0x080b('0x5c')]=function(_0x39831b,_0x15054d){return db['FaxAccount'][_0x080b('0x5c')](_0x39831b[_0x080b('0x5d')],{})['then'](function(_0x567b1d){var _0x1d3077=_0x39831b[_0x080b('0x5e')][_0x080b('0x37')]({'plain':!![]});if(!_0x1d3077)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d3077[_0x080b('0x5f')]===_0x080b('0x5e')){var _0x58cc8e=_0x567b1d[_0x080b('0x37')]({'plain':!![]});var _0x5065ed=_0x080b('0x38');return db[_0x080b('0x60')][_0x080b('0x5b')]({'where':{'name':_0x5065ed,'userProfileId':_0x1d3077['userProfileId']},'raw':!![]})[_0x080b('0x1f')](function(_0x20e2c2){if(_0x20e2c2&&_0x20e2c2[_0x080b('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x58cc8e[_0x080b('0x3c')],'resourceId':_0x58cc8e['id'],'type':_0x20e2c2['name'],'sectionId':_0x20e2c2['id']},{})[_0x080b('0x1f')](function(){return _0x567b1d;});}else{return _0x567b1d;}})[_0x080b('0x29')](function(_0x1b9e37){logger[_0x080b('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b9e37);throw _0x1b9e37;});}return _0x567b1d;})[_0x080b('0x1f')](respondWithResult(_0x15054d,0xc9))[_0x080b('0x29')](handleError(_0x15054d,null));};exports[_0x080b('0x36')]=function(_0x3b625c,_0x3dfc58){if(_0x3b625c[_0x080b('0x5d')]['id']){delete _0x3b625c[_0x080b('0x5d')]['id'];}return db[_0x080b('0x42')][_0x080b('0x5b')]({'where':{'id':_0x3b625c[_0x080b('0x62')]['id']},'include':[{'model':db[_0x080b('0x3f')],'as':_0x080b('0x40')}]})[_0x080b('0x1f')](handleEntityNotFound(_0x3dfc58,null))['then'](saveUpdates(_0x3b625c[_0x080b('0x5d')],null))[_0x080b('0x1f')](respondWithResult(_0x3dfc58,null))[_0x080b('0x29')](handleError(_0x3dfc58,null));};exports[_0x080b('0x3a')]=function(_0xd9d93c,_0x58eaed){return db[_0x080b('0x42')][_0x080b('0x5b')]({'where':{'id':_0xd9d93c[_0x080b('0x62')]['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0x58eaed,null))['then'](removeEntity(_0x58eaed,null))[_0x080b('0x29')](handleError(_0x58eaed,null));};exports[_0x080b('0x63')]=function(_0x1e450b,_0x15b739){return db[_0x080b('0x42')]['describe']()[_0x080b('0x1f')](respondWithResult(_0x15b739,null))['catch'](handleError(_0x15b739,null));};exports['addDisposition']=function(_0x2fda21,_0xfa436b,_0x219559){if(_0x2fda21['body']['id']){delete _0x2fda21[_0x080b('0x5d')]['id'];}return db[_0x080b('0x42')]['find']({'where':{'id':_0x2fda21[_0x080b('0x62')]['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0xfa436b,null))[_0x080b('0x1f')](function(_0x463c46){if(_0x463c46){_0x2fda21[_0x080b('0x5d')][_0x080b('0x64')]=_0x463c46['id'];return db[_0x080b('0x65')][_0x080b('0x5c')](_0x2fda21[_0x080b('0x5d')]);}})[_0x080b('0x1f')](respondWithResult(_0xfa436b,null))[_0x080b('0x29')](handleError(_0xfa436b,null));};exports[_0x080b('0x66')]=function(_0x3aacce,_0x541041,_0x462f02){var _0x46d52d={'raw':![],'where':{}};var _0x1a64c9={};var _0x554f34={'count':0x0,'rows':[]};return db[_0x080b('0x42')][_0x080b('0x67')]({'where':{'id':_0x3aacce[_0x080b('0x62')]['id']}})['then'](handleEntityNotFound(_0x541041,null))['then'](function(_0x1eefb8){if(_0x1eefb8){_0x1a64c9[_0x080b('0x47')]=_[_0x080b('0x48')](db[_0x080b('0x65')][_0x080b('0x43')]);_0x1a64c9[_0x080b('0x4b')]=_['keys'](_0x3aacce[_0x080b('0x4b')]);_0x1a64c9['filters']=_[_0x080b('0x4a')](_0x1a64c9[_0x080b('0x47')],_0x1a64c9[_0x080b('0x4b')]);_0x46d52d[_0x080b('0x4c')]=_[_0x080b('0x4a')](_0x1a64c9['model'],qs[_0x080b('0x4d')](_0x3aacce['query']['fields']));_0x46d52d['attributes']=_0x46d52d[_0x080b('0x4c')]['length']?_0x46d52d[_0x080b('0x4c')]:_0x1a64c9[_0x080b('0x47')];if(!_0x3aacce[_0x080b('0x4b')]['hasOwnProperty'](_0x080b('0x4f'))){_0x46d52d[_0x080b('0x31')]=qs[_0x080b('0x31')](_0x3aacce[_0x080b('0x4b')][_0x080b('0x31')]);_0x46d52d['offset']=qs['offset'](_0x3aacce[_0x080b('0x4b')]['offset']);}_0x46d52d['order']=qs[_0x080b('0x51')](_0x3aacce[_0x080b('0x4b')][_0x080b('0x51')]);_0x46d52d[_0x080b('0x56')]=qs[_0x080b('0x49')](_[_0x080b('0x68')](_0x3aacce[_0x080b('0x4b')],_0x1a64c9[_0x080b('0x49')]));_0x46d52d[_0x080b('0x56')][_0x080b('0x64')]=_0x1eefb8['id'];if(_0x3aacce[_0x080b('0x4b')][_0x080b('0x52')]){_0x46d52d[_0x080b('0x56')]=_[_0x080b('0x54')](_0x46d52d[_0x080b('0x56')],{'$or':_[_0x080b('0x41')](_0x46d52d[_0x080b('0x4c')],function(_0x1617f1){var _0x580935={};_0x580935[_0x1617f1]={'$like':'%'+_0x3aacce[_0x080b('0x4b')]['filter']+'%'};return _0x580935;})});}_0x46d52d=_['merge']({},_0x46d52d,_0x3aacce[_0x080b('0x55')]);return db['Disposition'][_0x080b('0x2f')]({'where':_0x46d52d[_0x080b('0x56')]})['then'](function(_0xab20e1){_0x554f34[_0x080b('0x2f')]=_0xab20e1;if(_0x3aacce[_0x080b('0x4b')][_0x080b('0x57')]){_0x46d52d[_0x080b('0x58')]=[{'all':!![]}];}return db[_0x080b('0x65')]['findAll'](_0x46d52d);})[_0x080b('0x1f')](function(_0x232b5d){_0x554f34['rows']=_0x232b5d;return _0x554f34;});}})[_0x080b('0x1f')](respondWithFilteredResult(_0x541041,_0x46d52d))['catch'](handleError(_0x541041,null));};exports[_0x080b('0x69')]=function(_0x3e31e9,_0x5e3cd8,_0xdeec0c){return db[_0x080b('0x42')][_0x080b('0x5b')]({'where':{'id':_0x3e31e9[_0x080b('0x62')]['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0x5e3cd8,null))['then'](function(_0x51977a){if(_0x51977a){return _0x51977a['removeDispositions'](_0x3e31e9[_0x080b('0x4b')]['ids']);}})[_0x080b('0x1f')](respondWithStatusCode(_0x5e3cd8,null))[_0x080b('0x29')](handleError(_0x5e3cd8,null));};exports[_0x080b('0x6a')]=function(_0x2e475d,_0xad15e5,_0x123593){if(_0x2e475d[_0x080b('0x5d')]['id']){delete _0x2e475d['body']['id'];}return db[_0x080b('0x42')][_0x080b('0x5b')]({'where':{'id':_0x2e475d[_0x080b('0x62')]['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0xad15e5,null))['then'](function(_0xa6c92a){if(_0xa6c92a){_0x2e475d[_0x080b('0x5d')][_0x080b('0x64')]=_0xa6c92a['id'];return db[_0x080b('0x6b')]['create'](_0x2e475d[_0x080b('0x5d')]);}})['then'](respondWithResult(_0xad15e5,null))[_0x080b('0x29')](handleError(_0xad15e5,null));};exports['getAnswers']=function(_0x381c06,_0xc2192a,_0xad1b89){var _0x53e75d={'raw':![],'where':{}};var _0x41092e={};var _0x15afb3={'count':0x0,'rows':[]};return db[_0x080b('0x42')][_0x080b('0x67')]({'where':{'id':_0x381c06[_0x080b('0x62')]['id']}})['then'](handleEntityNotFound(_0xc2192a,null))[_0x080b('0x1f')](function(_0x21ade8){if(_0x21ade8){_0x41092e[_0x080b('0x47')]=_['keys'](db['CannedAnswer'][_0x080b('0x43')]);_0x41092e[_0x080b('0x4b')]=_[_0x080b('0x48')](_0x381c06[_0x080b('0x4b')]);_0x41092e[_0x080b('0x49')]=_[_0x080b('0x4a')](_0x41092e[_0x080b('0x47')],_0x41092e[_0x080b('0x4b')]);_0x53e75d[_0x080b('0x4c')]=_['intersection'](_0x41092e[_0x080b('0x47')],qs[_0x080b('0x4d')](_0x381c06['query'][_0x080b('0x4d')]));_0x53e75d[_0x080b('0x4c')]=_0x53e75d['attributes'][_0x080b('0x5a')]?_0x53e75d[_0x080b('0x4c')]:_0x41092e[_0x080b('0x47')];if(!_0x381c06['query'][_0x080b('0x4e')](_0x080b('0x4f'))){_0x53e75d[_0x080b('0x31')]=qs[_0x080b('0x31')](_0x381c06[_0x080b('0x4b')][_0x080b('0x31')]);_0x53e75d[_0x080b('0x30')]=qs[_0x080b('0x30')](_0x381c06[_0x080b('0x4b')][_0x080b('0x30')]);}_0x53e75d[_0x080b('0x50')]=qs[_0x080b('0x51')](_0x381c06[_0x080b('0x4b')][_0x080b('0x51')]);_0x53e75d[_0x080b('0x56')]=qs[_0x080b('0x49')](_['pick'](_0x381c06['query'],_0x41092e[_0x080b('0x49')]));_0x53e75d[_0x080b('0x56')][_0x080b('0x64')]=_0x21ade8['id'];if(_0x381c06[_0x080b('0x4b')]['filter']){_0x53e75d[_0x080b('0x56')]=_['merge'](_0x53e75d[_0x080b('0x56')],{'$or':_[_0x080b('0x41')](_0x53e75d['attributes'],function(_0x236be3){var _0x1c4bea={};_0x1c4bea[_0x236be3]={'$like':'%'+_0x381c06[_0x080b('0x4b')][_0x080b('0x52')]+'%'};return _0x1c4bea;})});}_0x53e75d=_[_0x080b('0x54')]({},_0x53e75d,_0x381c06[_0x080b('0x55')]);return db['CannedAnswer'][_0x080b('0x2f')]({'where':_0x53e75d[_0x080b('0x56')]})['then'](function(_0x5d4f90){_0x15afb3['count']=_0x5d4f90;if(_0x381c06['query'][_0x080b('0x57')]){_0x53e75d[_0x080b('0x58')]=[{'all':!![]}];}return db[_0x080b('0x6b')][_0x080b('0x59')](_0x53e75d);})[_0x080b('0x1f')](function(_0x644b90){_0x15afb3[_0x080b('0x6c')]=_0x644b90;return _0x15afb3;});}})[_0x080b('0x1f')](respondWithFilteredResult(_0xc2192a,_0x53e75d))[_0x080b('0x29')](handleError(_0xc2192a,null));};exports[_0x080b('0x6d')]=function(_0x124c2f,_0x450d26,_0x1845d7){return db[_0x080b('0x42')][_0x080b('0x5b')]({'where':{'id':_0x124c2f['params']['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0x450d26,null))[_0x080b('0x1f')](function(_0x593997){if(_0x593997){return _0x593997['removeAnswers'](_0x124c2f['query'][_0x080b('0x6e')]);}})[_0x080b('0x1f')](respondWithStatusCode(_0x450d26,null))['catch'](handleError(_0x450d26,null));};exports['addInteraction']=function(_0x1bc98d,_0x193989,_0x309e4e){return db[_0x080b('0x6f')][_0x080b('0x5b')]({'where':{'id':_0x1bc98d[_0x080b('0x62')]['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0x193989,null))[_0x080b('0x1f')](function(_0x267857){if(_0x267857){return _0x267857[_0x080b('0x70')](_0x1bc98d[_0x080b('0x5d')][_0x080b('0x6e')],_['omit'](_0x1bc98d[_0x080b('0x5d')],[_0x080b('0x6e'),'id'])||{});}})[_0x080b('0x1f')](respondWithResult(_0x193989,null))[_0x080b('0x29')](handleError(_0x193989,null));};exports[_0x080b('0x71')]=function(_0x5227bc,_0x22fb7e,_0x2f69b2){var _0x501f54={'raw':![],'where':{}};var _0x48554a={};var _0x293bb6={'count':0x0,'rows':[]};return db[_0x080b('0x42')][_0x080b('0x67')]({'where':{'id':_0x5227bc[_0x080b('0x62')]['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0x22fb7e,null))['then'](function(_0x3b1651){if(_0x3b1651){_0x48554a[_0x080b('0x47')]=_[_0x080b('0x48')](db['FaxInteraction'][_0x080b('0x43')]);_0x48554a[_0x080b('0x4b')]=_[_0x080b('0x48')](_0x5227bc['query']);_0x48554a[_0x080b('0x49')]=_['intersection'](_0x48554a['model'],_0x48554a['query']);_0x501f54['attributes']=_[_0x080b('0x4a')](_0x48554a[_0x080b('0x47')],qs[_0x080b('0x4d')](_0x5227bc[_0x080b('0x4b')][_0x080b('0x4d')]));_0x501f54[_0x080b('0x4c')]=_0x501f54['attributes'][_0x080b('0x5a')]?_0x501f54[_0x080b('0x4c')]:_0x48554a[_0x080b('0x47')];if(!_0x5227bc['query'][_0x080b('0x4e')](_0x080b('0x4f'))){_0x501f54[_0x080b('0x31')]=qs[_0x080b('0x31')](_0x5227bc[_0x080b('0x4b')]['limit']);_0x501f54[_0x080b('0x30')]=qs['offset'](_0x5227bc[_0x080b('0x4b')][_0x080b('0x30')]);}_0x501f54[_0x080b('0x50')]=qs[_0x080b('0x51')](_0x5227bc[_0x080b('0x4b')][_0x080b('0x51')]);_0x501f54[_0x080b('0x56')]=qs['filters'](_['pick'](_0x5227bc[_0x080b('0x4b')],_0x48554a['filters']));_0x501f54[_0x080b('0x56')][_0x080b('0x64')]=_0x3b1651['id'];if(_0x5227bc[_0x080b('0x4b')][_0x080b('0x52')]){_0x501f54[_0x080b('0x56')]=_[_0x080b('0x54')](_0x501f54[_0x080b('0x56')],{'$or':_[_0x080b('0x41')](_0x501f54[_0x080b('0x4c')],function(_0x4c5ab){var _0x4b5c8c={};_0x4b5c8c[_0x4c5ab]={'$like':'%'+_0x5227bc[_0x080b('0x4b')][_0x080b('0x52')]+'%'};return _0x4b5c8c;})});}_0x501f54=_[_0x080b('0x54')]({},_0x501f54,_0x5227bc[_0x080b('0x55')]);return db[_0x080b('0x6f')][_0x080b('0x2f')]({'where':_0x501f54[_0x080b('0x56')]})['then'](function(_0x5e4419){_0x293bb6[_0x080b('0x2f')]=_0x5e4419;if(_0x5227bc[_0x080b('0x4b')]['includeAll']){_0x501f54[_0x080b('0x58')]=[{'model':db[_0x080b('0x72')],'as':'Contact','required':![]},{'model':db[_0x080b('0x73')],'as':'Owner','attributes':['name',_0x080b('0x74'),_0x080b('0x75')],'required':![]},{'model':db['Tag'],'as':_0x080b('0x76'),'attributes':['id',_0x080b('0x3c'),_0x080b('0x77')],'where':_0x5227bc[_0x080b('0x4b')]['tag']?{'id':_0x5227bc[_0x080b('0x4b')][_0x080b('0x78')]}:undefined,'required':_0x5227bc[_0x080b('0x4b')][_0x080b('0x78')]?!![]:![]}];}return db['FaxInteraction'][_0x080b('0x59')](_0x501f54);})[_0x080b('0x1f')](function(_0x26c409){_0x293bb6[_0x080b('0x6c')]=_0x26c409;return _0x293bb6;});}})[_0x080b('0x1f')](respondWithFilteredResult(_0x22fb7e,_0x501f54))[_0x080b('0x29')](handleError(_0x22fb7e,null));};exports[_0x080b('0x79')]=function(_0x1fe860,_0xac3d18){var _0x499f5b=_0x1fe860['params']['id'];var _0x3bc5d2=_0x1fe860[_0x080b('0x5d')];var _0x48f7a4=0xc8;var _0xa1a376=null;return db['sequelize'][_0x080b('0x7a')]({'isolationLevel':db[_0x080b('0x7b')][_0x080b('0x7c')][_0x080b('0x7d')][_0x080b('0x7e')]},function(_0x1baa20){return db[_0x080b('0x42')][_0x080b('0x67')]({'where':{'id':_0x499f5b},'transaction':_0x1baa20})[_0x080b('0x1f')](function(_0x223a9d){if(_0x223a9d){return db[_0x080b('0x7f')][_0x080b('0x3a')]({'where':{'FaxAccountId':_0x499f5b},'transaction':_0x1baa20})[_0x080b('0x1f')](function(){var _0x1209fa=_['map'](_0x3bc5d2,function(_0x1c381d){_0x1c381d[_0x080b('0x64')]=_0x499f5b;return _0x1c381d;});return db['FaxApplication']['bulkCreate'](_0x1209fa,{'transaction':_0x1baa20});});}else{_0x48f7a4=0x194;_0xa1a376=[];}});})['then'](function(){if(_0x48f7a4!==0x194){return db[_0x080b('0x7f')][_0x080b('0x80')]({'where':{'FaxAccountId':_0x499f5b},'order':_0x080b('0x81')})['then'](function(_0x487a44){_0xa1a376=_0x487a44;});}})[_0x080b('0x29')](function(_0x47dbce){_0x48f7a4=0x1f4;logger['error'](_0x47dbce[_0x080b('0x3b')]);if(_0x47dbce[_0x080b('0x3c')]){delete _0x47dbce[_0x080b('0x3c')];}_0xa1a376=_0x47dbce;})['finally'](function(){if(_0xa1a376===null){_0xac3d18[_0x080b('0x2a')](_0x48f7a4);}else{if(_0x48f7a4===0x1f4){_0xac3d18['status'](_0x48f7a4)[_0x080b('0x3d')](_0xa1a376);}else{_0xac3d18[_0x080b('0x2c')](_0x48f7a4)[_0x080b('0x2d')](_0xa1a376);}}});};exports[_0x080b('0x82')]=function(_0x2dba6b,_0x34dcab,_0x4b8db5){var _0x5a371e={};var _0x14b436={};var _0x126f17;var _0x1b1bc2;return db[_0x080b('0x42')][_0x080b('0x67')]({'where':{'id':_0x2dba6b[_0x080b('0x62')]['id']}})['then'](handleEntityNotFound(_0x34dcab,null))[_0x080b('0x1f')](function(_0x5621ed){if(_0x5621ed){_0x126f17=_0x5621ed;_0x14b436[_0x080b('0x47')]=_[_0x080b('0x48')](db[_0x080b('0x7f')]['rawAttributes']);_0x14b436[_0x080b('0x4b')]=_[_0x080b('0x48')](_0x2dba6b[_0x080b('0x4b')]);_0x14b436[_0x080b('0x49')]=_[_0x080b('0x4a')](_0x14b436[_0x080b('0x47')],_0x14b436['query']);_0x5a371e[_0x080b('0x4c')]=_[_0x080b('0x4a')](_0x14b436[_0x080b('0x47')],qs[_0x080b('0x4d')](_0x2dba6b['query'][_0x080b('0x4d')]));_0x5a371e[_0x080b('0x4c')]=_0x5a371e[_0x080b('0x4c')][_0x080b('0x5a')]?_0x5a371e[_0x080b('0x4c')]:_0x14b436[_0x080b('0x47')];_0x5a371e[_0x080b('0x50')]=qs[_0x080b('0x51')](_0x2dba6b['query'][_0x080b('0x51')]);_0x5a371e['where']=qs[_0x080b('0x49')](_[_0x080b('0x68')](_0x2dba6b[_0x080b('0x4b')],_0x14b436['filters']));if(_0x2dba6b[_0x080b('0x4b')][_0x080b('0x52')]){_0x5a371e[_0x080b('0x56')]=_[_0x080b('0x54')](_0x5a371e[_0x080b('0x56')],{'$or':_[_0x080b('0x41')](_0x5a371e['attributes'],function(_0x44c89a){var _0x5eaab7={};_0x5eaab7[_0x44c89a]={'$like':'%'+_0x2dba6b[_0x080b('0x4b')]['filter']+'%'};return _0x5eaab7;})});}_0x5a371e=_[_0x080b('0x54')]({},_0x5a371e,_0x2dba6b['options']);return _0x126f17[_0x080b('0x82')](_0x5a371e);}})['then'](function(_0x17764c){if(_0x17764c){_0x1b1bc2=_0x17764c['length'];if(!_0x2dba6b[_0x080b('0x4b')][_0x080b('0x4e')](_0x080b('0x4f'))){_0x5a371e['limit']=qs[_0x080b('0x31')](_0x2dba6b['query']['limit']);_0x5a371e[_0x080b('0x30')]=qs[_0x080b('0x30')](_0x2dba6b[_0x080b('0x4b')][_0x080b('0x30')]);}return _0x126f17[_0x080b('0x82')](_0x5a371e);}})['then'](function(_0x77022){if(_0x77022){return _0x77022?{'count':_0x1b1bc2,'rows':_0x77022}:null;}})[_0x080b('0x1f')](respondWithResult(_0x34dcab,null))[_0x080b('0x29')](handleError(_0x34dcab,null));};function Extension(_0x4b61d9,_0x1bf1aa,_0x514229,_0xe780b5){this['context']=_0x080b('0x83');this[_0x080b('0x84')]=_0x4b61d9[_0x080b('0x85')];this[_0x080b('0x86')]=_0xe780b5;this[_0x080b('0x45')]=_0x080b('0x87');this['description']=_0x080b('0x88');this['FaxAccountId']=_0x4b61d9['id'];this[_0x080b('0x81')]=_0x1bf1aa;this[_0x080b('0x89')]=_0x514229;}function createExtensionsReciveFax(_0x3cd517){var _0x2c5ff1=0x1;var _0x3e4d29=[];_0x3e4d29[_0x080b('0x8a')](new Extension(_0x3cd517,_0x2c5ff1,'',_0x080b('0x8b')));_0x2c5ff1+=0x1;_0x3e4d29[_0x080b('0x8a')](new Extension(_0x3cd517,_0x2c5ff1,_0x080b('0x8c'),'Set'));_0x2c5ff1+=0x1;for(var _0x17e21d in _0x3cd517){if(_0x3cd517['hasOwnProperty'](_0x17e21d)&&(_0x17e21d===_0x080b('0x8d')||_0x17e21d===_0x080b('0x85')||_0x17e21d===_0x080b('0x8e')||_0x17e21d===_0x080b('0x8f')||_0x17e21d==='headerinfo'||_0x17e21d===_0x080b('0x90')||_0x17e21d==='minrate'||_0x17e21d===_0x080b('0x91')||_0x17e21d==='t38timeout')){_0x3e4d29[_0x080b('0x8a')](new Extension(_0x3cd517,_0x2c5ff1,_0x080b('0x92')+_0x17e21d+')='+_0x3cd517[_0x17e21d],'Set'));_0x2c5ff1+=0x1;}}_0x3e4d29['push'](new Extension(_0x3cd517,_0x2c5ff1,'6',_0x080b('0x93')));_0x2c5ff1+=0x1;_0x3e4d29[_0x080b('0x8a')](new Extension(_0x3cd517,_0x2c5ff1,'/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'));_0x2c5ff1=0x0;return _0x3e4d29;}exports[_0x080b('0x94')]=function(_0x36d3b5,_0x2dc443,_0x4c913d){var _0x3fc723;return db[_0x080b('0x7b')][_0x080b('0x7a')](function(_0x49c7fc){return db[_0x080b('0x42')]['create'](_0x36d3b5['body'],{'transaction':_0x49c7fc})[_0x080b('0x1f')](function(_0x299c0a){_0x3fc723=_0x299c0a['get']({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x3fc723),{'transaction':_0x49c7fc});});})[_0x080b('0x1f')](function(){return _0x3fc723;})[_0x080b('0x1f')](respondWithResult(_0x2dc443,null))[_0x080b('0x29')](handleError(_0x2dc443,null));};exports['updateAccountApplications']=function(_0x36904b,_0x544725,_0x5d70f6){var _0x37a1e2;return db[_0x080b('0x7b')]['transaction'](function(_0x4709a6){return db['FaxAccount'][_0x080b('0x36')](_0x36904b[_0x080b('0x5d')],{'where':{'id':_0x36904b[_0x080b('0x5d')]['id']},'transaction':_0x4709a6})[_0x080b('0x1f')](function(_0x56e978){return db[_0x080b('0x95')][_0x080b('0x3a')]({'where':{'FaxAccountId':_0x36904b[_0x080b('0x5d')]['id']},'transaction':_0x4709a6})[_0x080b('0x1f')](function(_0x2b3d20){return db[_0x080b('0x95')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x36904b[_0x080b('0x5d')],[_0x080b('0x96'),_0x080b('0x46'),_0x080b('0x97'),'updatedAt',_0x080b('0x98'),_0x080b('0x99')])),{'transaction':_0x4709a6});});});})[_0x080b('0x1f')](function(){return db[_0x080b('0x42')][_0x080b('0x9a')](_0x36904b['body']['id']);})[_0x080b('0x1f')](respondWithResult(_0x544725,null))['catch'](handleError(_0x544725,null));};exports[_0x080b('0x9b')]=function(_0x538f6a,_0x3ec2d2,_0x36472a){var _0x51b4e0={'raw':!![],'where':{}};var _0x5d9bc0={};var _0x429123={'count':0x0,'rows':[]};return db[_0x080b('0x42')][_0x080b('0x67')]({'where':{'id':_0x538f6a[_0x080b('0x62')]['id']}})['then'](handleEntityNotFound(_0x3ec2d2,null))[_0x080b('0x1f')](function(_0xb1c7cd){if(_0xb1c7cd){_0x5d9bc0[_0x080b('0x47')]=_[_0x080b('0x48')](db[_0x080b('0x9c')]['rawAttributes']);_0x5d9bc0[_0x080b('0x4b')]=_[_0x080b('0x48')](_0x538f6a['query']);_0x5d9bc0[_0x080b('0x49')]=_['intersection'](_0x5d9bc0[_0x080b('0x47')],_0x5d9bc0[_0x080b('0x4b')]);_0x51b4e0[_0x080b('0x4c')]=_[_0x080b('0x4a')](_0x5d9bc0['model'],qs[_0x080b('0x4d')](_0x538f6a['query'][_0x080b('0x4d')]));_0x51b4e0[_0x080b('0x4c')]=_0x51b4e0[_0x080b('0x4c')]['length']?_0x51b4e0[_0x080b('0x4c')]:_0x5d9bc0[_0x080b('0x47')];if(!_0x538f6a['query'][_0x080b('0x4e')]('nolimit')){_0x51b4e0[_0x080b('0x31')]=qs['limit'](_0x538f6a[_0x080b('0x4b')][_0x080b('0x31')]);_0x51b4e0[_0x080b('0x30')]=qs[_0x080b('0x30')](_0x538f6a[_0x080b('0x4b')][_0x080b('0x30')]);}_0x51b4e0[_0x080b('0x50')]=qs['sort'](_0x538f6a[_0x080b('0x4b')][_0x080b('0x51')]);_0x51b4e0[_0x080b('0x56')]=qs['filters'](_[_0x080b('0x68')](_0x538f6a[_0x080b('0x4b')],_0x5d9bc0[_0x080b('0x49')]));_0x51b4e0[_0x080b('0x56')][_0x080b('0x64')]=_0xb1c7cd['id'];if(_0x538f6a['query'][_0x080b('0x52')]){_0x51b4e0[_0x080b('0x56')]=_['merge'](_0x51b4e0[_0x080b('0x56')],{'$or':_[_0x080b('0x41')](_0x51b4e0[_0x080b('0x4c')],function(_0x308eb8){var _0x1f8198={};_0x1f8198[_0x308eb8]={'$like':'%'+_0x538f6a[_0x080b('0x4b')]['filter']+'%'};return _0x1f8198;})});}if(_0x538f6a[_0x080b('0x4b')][_0x080b('0x9d')]){var _0x11cefa=_0x538f6a[_0x080b('0x4b')][_0x080b('0x9d')][_0x080b('0x9e')](',');var _0x5f5177={};_0x5f5177[_0x11cefa[0x0]]={'$gte':moment(_0x11cefa[0x1])[_0x080b('0x9f')](_0x080b('0xa0'))};_0x51b4e0[_0x080b('0x56')]=_[_0x080b('0x54')](_0x51b4e0[_0x080b('0x56')],_0x5f5177);}_0x51b4e0=_[_0x080b('0x54')]({},_0x51b4e0,_0x538f6a[_0x080b('0x55')]);return db[_0x080b('0x9c')][_0x080b('0x2f')]({'where':_0x51b4e0['where']})['then'](function(_0x440983){_0x429123[_0x080b('0x2f')]=_0x440983;if(_0x538f6a[_0x080b('0x4b')][_0x080b('0x57')]){_0x51b4e0['include']=[{'all':!![]}];}return db[_0x080b('0x9c')][_0x080b('0x59')](_0x51b4e0);})[_0x080b('0x1f')](function(_0x29048e){_0x429123['rows']=_0x29048e;return _0x429123;});}})['then'](respondWithFilteredResult(_0x3ec2d2,_0x51b4e0))[_0x080b('0x29')](handleError(_0x3ec2d2,null));};exports[_0x080b('0x3d')]=function(_0x16f8a7,_0x1db04c,_0x2bbed1){var _0x3a3279,_0xbd554={},_0x4c8ece;if(_0x16f8a7[_0x080b('0x5d')]['to']){_0x4c8ece=_0x16f8a7[_0x080b('0x5d')]['to'][0x0];}return db[_0x080b('0x42')]['find']({'where':{'id':_0x16f8a7[_0x080b('0x62')]['id']},'include':[{'model':db[_0x080b('0xa1')],'as':'List','include':[{'model':db[_0x080b('0x72')],'as':_0x080b('0xa2'),'where':{'fax':_0x4c8ece},'limit':0x1,'order':[['updatedAt',_0x080b('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x1db04c,null))[_0x080b('0x1f')](function(_0x2dd63e){_0x3a3279=_0x2dd63e;if(_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')]&&_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')]['length']){for(var _0x1a85fb=0x0;_0x1a85fb<_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')][_0x080b('0x5a')];_0x1a85fb+=0x1){_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')][_0x1a85fb]={'filename':_0x16f8a7[_0x080b('0x5d')]['attachments'][_0x1a85fb][_0x080b('0x3c')],'id':_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')][_0x1a85fb]['id'],'path':path[_0x080b('0xa5')](config[_0x080b('0xa6')],_0x080b('0xa7'),_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')][_0x1a85fb][_0x080b('0xa8')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x16f8a7[_0x080b('0x62')]['id'])?undefined:_0x16f8a7[_0x080b('0x62')]['id'],'path':_[_0x080b('0xa9')](_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')][0x0][_0x080b('0xaa')])?undefined:_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')][0x0][_0x080b('0xaa')],'fax':_[_0x080b('0xa9')](_0x16f8a7[_0x080b('0x5d')]['to'][0x0])?undefined:_0x16f8a7['body']['to'][0x0]},client9002);})[_0x080b('0x1f')](function(){if(_0x3a3279){if(_['isNil'](_0x16f8a7[_0x080b('0x5d')]['from'])){_0x16f8a7[_0x080b('0x5d')][_0x080b('0xab')]=util[_0x080b('0x9f')](_0x080b('0xac'),_0x3a3279[_0x080b('0x3c')],_0x3a3279['fax']);}if(_0x3a3279[_0x080b('0xad')]){if(_0x3a3279[_0x080b('0xad')]['Contacts'][_0x080b('0x5a')]){return _0x3a3279[_0x080b('0xad')][_0x080b('0xa2')][0x0];}else{return db[_0x080b('0x72')]['create'](_[_0x080b('0x15')](_0x16f8a7[_0x080b('0x5d')],{'firstName':_0x16f8a7['body']['to'][0x0],'phone':_0x16f8a7[_0x080b('0x5d')]['to'][0x0],'fax':_0x16f8a7[_0x080b('0x5d')]['to'][0x0],'ListId':_0x3a3279['ListId']}));}}else{throw new Error(_0x080b('0xae'));}}else{throw new Error(_0x080b('0xaf'));}})['then'](function(_0x4c4998){if(_0x4c4998){return db[_0x080b('0x6f')][_0x080b('0x5b')]({'where':{'ContactId':_0x4c4998['id'],'closed':![],'FaxAccountId':_0x3a3279['id']}})[_0x080b('0x1f')](function(_0x4257e4){if(_0x4257e4){return[_0x4257e4,![]];}return db['FaxInteraction'][_0x080b('0x5c')]({'UserId':_0x16f8a7[_0x080b('0x5e')]['id'],'ContactId':_0x4c4998['id'],'FaxAccountId':_0x3a3279['id'],'fax':_0x16f8a7[_0x080b('0x5d')]['to'][0x0],'firstMsgDirection':_0x080b('0xb0'),'Messages':[_[_0x080b('0x54')](_0x16f8a7['body'],{'read':![],'body':_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')][0x0][_0x080b('0xb1')],'FaxAccountId':_0x3a3279['id'],'UserId':_0x16f8a7[_0x080b('0x5e')]['id'],'ContactId':_0x4c4998['id'],'AttachmentId':_0x16f8a7['body'][_0x080b('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0x080b('0x9c')],'as':_0x080b('0xb2')}]})[_0x080b('0x1f')](function(_0x2a34ed){return[_0x2a34ed,!![]];});});}else{throw new Error(_0x080b('0xb3'));}})['spread'](function(_0x1a18cd,_0x6871b8){if(_0x6871b8){return _0x1a18cd;}return db[_0x080b('0x9c')][_0x080b('0x5c')]({'direction':_0x080b('0xb0'),'read':![],'body':_0x16f8a7['body'][_0x080b('0xa4')][0x0][_0x080b('0xb1')],'FaxAccountId':_0x3a3279['id'],'FaxInteractionId':_0x1a18cd['id'],'UserId':_0x16f8a7[_0x080b('0x5e')]['id'],'ContactId':_0x1a18cd[_0x080b('0xb4')],'AttachmentId':_0x16f8a7[_0x080b('0x5d')]['attachments'][0x0]['id']})[_0x080b('0x1f')](function(_0x3449a8){_0x1a18cd[_0x080b('0xb5')]['Messages']=[];_0x1a18cd['dataValues']['Messages'][_0x080b('0x8a')](_0x3449a8[_0x080b('0xb5')]);return _0x1a18cd;});})['then'](function(_0x2ff56f){respondWithRpcPromise(_0x080b('0xb6'),'SendFax',{'FaxAccountId':_['isNil'](_0x16f8a7[_0x080b('0x62')]['id'])?undefined:_0x16f8a7[_0x080b('0x62')]['id'],'path':_['isNil'](_0x16f8a7[_0x080b('0x5d')][_0x080b('0xa4')][0x0]['path'])?undefined:_0x16f8a7[_0x080b('0x5d')]['attachments'][0x0][_0x080b('0xaa')],'fax':_['isNil'](_0x16f8a7[_0x080b('0x5d')]['to'][0x0])?undefined:_0x16f8a7[_0x080b('0x5d')]['to'][0x0],'AttachmentId':_0x16f8a7['body'][_0x080b('0xa4')][0x0]['id']},client9002)[_0x080b('0x1f')](function(_0x35b1e1){logger[_0x080b('0x27')](_0x080b('0xb7'),_0x35b1e1);})[_0x080b('0x29')](function(_0x5d350d){logger[_0x080b('0x27')](_0x080b('0xb7'),_0x5d350d);});return _0x2ff56f;})[_0x080b('0x1f')](respondWithResult(_0x1db04c,null))['catch'](handleError(_0x1db04c,null));};exports[_0x080b('0xb8')]=function(_0x47277c,_0x23603c,_0x591727){return db[_0x080b('0x42')][_0x080b('0x5b')]({'where':{'id':_0x47277c[_0x080b('0x62')]['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0x23603c,null))['then'](function(_0x51c384){if(_0x51c384){return _0x51c384['addAgents'](_0x47277c[_0x080b('0x5d')][_0x080b('0x6e')],_[_0x080b('0xb9')](_0x47277c[_0x080b('0x5d')],[_0x080b('0x6e'),'id'])||{})[_0x080b('0xba')](function(_0x3c3cca){for(var _0x5c3c32=0x0;_0x5c3c32<_0x47277c[_0x080b('0x5d')]['ids'][_0x080b('0x5a')];_0x5c3c32+=0x1){socket['emit'](_0x080b('0xbb'),{'UserId':Number(_0x47277c['body'][_0x080b('0x6e')][_0x5c3c32]),'FaxAccountId':Number(_0x47277c[_0x080b('0x62')]['id'])});}return _0x3c3cca;});}})[_0x080b('0x1f')](respondWithResult(_0x23603c,null))['catch'](handleError(_0x23603c,null));};exports['removeAgents']=function(_0x8d9659,_0x1013e7,_0x583ec1){return db[_0x080b('0x42')][_0x080b('0x5b')]({'where':{'id':_0x8d9659['params']['id']}})[_0x080b('0x1f')](handleEntityNotFound(_0x1013e7,null))['then'](function(_0x41db42){if(_0x41db42){return _0x41db42['removeAgents'](_0x8d9659['query'][_0x080b('0x6e')])[_0x080b('0x1f')](function(){if(_['isArray'](_0x8d9659[_0x080b('0x4b')][_0x080b('0x6e')])){for(var _0x1e6364=0x0;_0x1e6364<_0x8d9659[_0x080b('0x4b')][_0x080b('0x6e')][_0x080b('0x5a')];_0x1e6364+=0x1){socket[_0x080b('0xbc')](_0x080b('0xbd'),{'UserId':Number(_0x8d9659[_0x080b('0x4b')]['ids'][_0x1e6364]),'FaxAccountId':Number(_0x8d9659[_0x080b('0x62')]['id'])});}}else{socket[_0x080b('0xbc')](_0x080b('0xbd'),{'UserId':Number(_0x8d9659[_0x080b('0x4b')][_0x080b('0x6e')]),'FaxAccountId':Number(_0x8d9659[_0x080b('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x1013e7,null))['catch'](handleError(_0x1013e7,null));};exports[_0x080b('0xbe')]=function(_0x420924,_0x3c3f86,_0x553d38){var _0xe4e156={};var _0x50eec1={};var _0x3d5192;var _0x3b9d94;return db[_0x080b('0x42')][_0x080b('0x67')]({'where':{'id':_0x420924[_0x080b('0x62')]['id']}})['then'](handleEntityNotFound(_0x3c3f86,null))[_0x080b('0x1f')](function(_0x4cf0e0){if(_0x4cf0e0){_0x3d5192=_0x4cf0e0;_0x50eec1['model']=_['keys'](db[_0x080b('0x73')][_0x080b('0x43')]);_0x50eec1[_0x080b('0x4b')]=_[_0x080b('0x48')](_0x420924[_0x080b('0x4b')]);_0x50eec1[_0x080b('0x49')]=_['intersection'](_0x50eec1[_0x080b('0x47')],_0x50eec1[_0x080b('0x4b')]);_0xe4e156[_0x080b('0x4c')]=_[_0x080b('0x4a')](_0x50eec1[_0x080b('0x47')],qs[_0x080b('0x4d')](_0x420924['query'][_0x080b('0x4d')]));_0xe4e156[_0x080b('0x4c')]=_0xe4e156['attributes'][_0x080b('0x5a')]?_0xe4e156[_0x080b('0x4c')]:_0x50eec1['model'];_0xe4e156[_0x080b('0x50')]=qs[_0x080b('0x51')](_0x420924[_0x080b('0x4b')][_0x080b('0x51')]);_0xe4e156['where']=qs[_0x080b('0x49')](_[_0x080b('0x68')](_0x420924[_0x080b('0x4b')],_0x50eec1[_0x080b('0x49')]));if(_0x420924[_0x080b('0x4b')]['filter']){_0xe4e156['where']=_[_0x080b('0x54')](_0xe4e156['where'],{'$or':_[_0x080b('0x41')](_0xe4e156[_0x080b('0x4c')],function(_0x44c27b){var _0x1d741f={};_0x1d741f[_0x44c27b]={'$like':'%'+_0x420924[_0x080b('0x4b')][_0x080b('0x52')]+'%'};return _0x1d741f;})});}_0xe4e156=_[_0x080b('0x54')]({},_0xe4e156,_0x420924['options']);return _0x3d5192[_0x080b('0xbe')](_0xe4e156);}})[_0x080b('0x1f')](function(_0x33510b){if(_0x33510b){_0x3b9d94=_0x33510b['length'];if(!_0x420924['query']['hasOwnProperty'](_0x080b('0x4f'))){_0xe4e156['limit']=qs[_0x080b('0x31')](_0x420924[_0x080b('0x4b')][_0x080b('0x31')]);_0xe4e156[_0x080b('0x30')]=qs['offset'](_0x420924[_0x080b('0x4b')][_0x080b('0x30')]);}return _0x3d5192['getAgents'](_0xe4e156);}})[_0x080b('0x1f')](function(_0x1ed6d5){if(_0x1ed6d5){return _0x1ed6d5?{'count':_0x3b9d94,'rows':_0x1ed6d5}:null;}})[_0x080b('0x1f')](respondWithResult(_0x3c3f86,null))[_0x080b('0x29')](handleError(_0x3c3f86,null));}; \ No newline at end of file +var _0xf934=['rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','UserProfileResource','destroy','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','FaxAccount','includeAll','findAll','rows','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId','Disposition','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','findOne','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','findAndCountAll','priority','stack','finally','send','getApplications','context','from-voip-provider','exten','localstationid','type','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','headerinfo','maxrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','getMessages','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents'];(function(_0xc42937,_0x542030){var _0x45dd61=function(_0x48376e){while(--_0x48376e){_0xc42937['push'](_0xc42937['shift']());}};_0x45dd61(++_0x542030);}(_0xf934,0xc5));var _0x4f93=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xf934[_0x35885a];return _0xe86249;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f93('0x0'));var zipdir=require(_0x4f93('0x1'));var jsonpatch=require(_0x4f93('0x2'));var rp=require(_0x4f93('0x3'));var moment=require(_0x4f93('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4f93('0x5'));var path=require(_0x4f93('0x6'));var sox=require(_0x4f93('0x7'));var csv=require(_0x4f93('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f93('0x9'));var _=require(_0x4f93('0xa'));var squel=require(_0x4f93('0xb'));var crypto=require(_0x4f93('0xc'));var jsforce=require(_0x4f93('0xd'));var deskjs=require(_0x4f93('0xe'));var toCsv=require(_0x4f93('0x8'));var querystring=require(_0x4f93('0xf'));var Papa=require(_0x4f93('0x10'));var Redis=require('ioredis');var authService=require(_0x4f93('0x11'));var qs=require(_0x4f93('0x12'));var as=require(_0x4f93('0x13'));var hardwareService=require(_0x4f93('0x14'));var logger=require('../../config/logger')(_0x4f93('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f93('0x16'));var db=require(_0x4f93('0x17'))['db'];config[_0x4f93('0x18')]=_[_0x4f93('0x19')](config['redis'],{'host':_0x4f93('0x1a'),'port':0x18eb});var socket=require(_0x4f93('0x1b'))(new Redis(config[_0x4f93('0x18')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x4f93('0x1c'));var client=jayson[_0x4f93('0x1d')][_0x4f93('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x4f93('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc86e66,_0x12591b,_0x339605,_0x503f88){return new BPromise(function(_0xe58170,_0x4e0b43){var _0x4debbb=_0x503f88||client;return _0x4debbb[_0x4f93('0x1f')](_0xc86e66,_0x339605)[_0x4f93('0x20')](function(_0x232192){logger[_0x4f93('0x21')](_0x4f93('0x22'),_0x12591b,_0x4f93('0x23'));logger[_0x4f93('0x24')](_0x4f93('0x25'),_0x12591b,_0x4f93('0x23'),JSON[_0x4f93('0x26')](_0x232192));if(_0x232192[_0x4f93('0x27')]){if(_0x232192[_0x4f93('0x27')][_0x4f93('0x28')]===0x1f4){logger[_0x4f93('0x27')](_0x4f93('0x22'),_0x12591b,_0x232192[_0x4f93('0x27')][_0x4f93('0x29')]);return _0x4e0b43(_0x232192[_0x4f93('0x27')][_0x4f93('0x29')]);}logger[_0x4f93('0x27')](_0x4f93('0x22'),_0x12591b,_0x232192['error'][_0x4f93('0x29')]);return _0xe58170(_0x232192[_0x4f93('0x27')][_0x4f93('0x29')]);}else{logger['info'](_0x4f93('0x22'),_0x12591b,_0x4f93('0x23'));_0xe58170(_0x232192[_0x4f93('0x2a')][_0x4f93('0x29')]);}})[_0x4f93('0x2b')](function(_0x194a68){logger[_0x4f93('0x27')](_0x4f93('0x22'),_0x12591b,_0x194a68);_0x4e0b43(_0x194a68);});});}function respondWithStatusCode(_0x21700f,_0x1e23e2){_0x1e23e2=_0x1e23e2||0xcc;return function(_0x4193f6){if(_0x4193f6){return _0x21700f['sendStatus'](_0x1e23e2);}return _0x21700f[_0x4f93('0x2c')](_0x1e23e2)[_0x4f93('0x2d')]();};}function respondWithResult(_0x1b8cdd,_0x1f5288){_0x1f5288=_0x1f5288||0xc8;return function(_0x5268a6){if(_0x5268a6){return _0x1b8cdd[_0x4f93('0x2c')](_0x1f5288)[_0x4f93('0x2e')](_0x5268a6);}};}function respondWithFilteredResult(_0x4beaa9,_0x3a9f89){return function(_0x3ed960){if(_0x3ed960){var _0x2e59f2=typeof _0x3a9f89[_0x4f93('0x2f')]===_0x4f93('0x30')&&typeof _0x3a9f89[_0x4f93('0x31')]===_0x4f93('0x30');var _0x3a87db=_0x3ed960['count'];var _0x372e5a=_0x2e59f2?0x0:_0x3a9f89[_0x4f93('0x2f')];var _0x4f9b01=_0x2e59f2?_0x3ed960[_0x4f93('0x32')]:_0x3a9f89[_0x4f93('0x2f')]+_0x3a9f89['limit'];var _0x427da6;if(_0x4f9b01>=_0x3a87db){_0x4f9b01=_0x3a87db;_0x427da6=0xc8;}else{_0x427da6=0xce;}_0x4beaa9[_0x4f93('0x2c')](_0x427da6);return _0x4beaa9[_0x4f93('0x33')](_0x4f93('0x34'),_0x372e5a+'-'+_0x4f9b01+'/'+_0x3a87db)['json'](_0x3ed960);}return null;};}function patchUpdates(_0x598bc6){return function(_0x137712){try{jsonpatch[_0x4f93('0x35')](_0x137712,_0x598bc6,!![]);}catch(_0x2325e9){return BPromise[_0x4f93('0x36')](_0x2325e9);}return _0x137712[_0x4f93('0x37')]();};}function saveUpdates(_0x1a5d4a,_0x374b41){return function(_0x5f5b59){if(_0x5f5b59){return _0x5f5b59[_0x4f93('0x38')](_0x1a5d4a)['then'](function(_0x236382){return _0x236382;});}return null;};}function removeEntity(_0x145ca8,_0x43ae8c){return function(_0x37d1b5){if(_0x37d1b5){return _0x37d1b5['destroy']()['then'](function(){var _0x5a8ebf=_0x37d1b5['get']({'plain':!![]});var _0x179136='FaxAccounts';return db[_0x4f93('0x39')][_0x4f93('0x3a')]({'where':{'type':_0x179136,'resourceId':_0x5a8ebf['id']}})[_0x4f93('0x20')](function(){return _0x37d1b5;});})[_0x4f93('0x20')](function(){_0x145ca8[_0x4f93('0x2c')](0xcc)[_0x4f93('0x2d')]();});}};}function handleEntityNotFound(_0xca5547,_0x7a20d1){return function(_0x405deb){if(!_0x405deb){_0xca5547['sendStatus'](0x194);}return _0x405deb;};}function handleError(_0xe03aee,_0x4d9b65){_0x4d9b65=_0x4d9b65||0x1f4;return function(_0xf284ef){logger[_0x4f93('0x27')](_0xf284ef['stack']);if(_0xf284ef[_0x4f93('0x3b')]){delete _0xf284ef[_0x4f93('0x3b')];}_0xe03aee[_0x4f93('0x2c')](_0x4d9b65)['send'](_0xf284ef);};}exports[_0x4f93('0x3c')]=function(_0x224fa7,_0x1c3157){var _0x5715cc={'include':[{'model':db[_0x4f93('0x3d')],'as':_0x4f93('0x3e')}]},_0x217286={},_0x51233f={'count':0x0,'rows':[]};var _0x391e61=_[_0x4f93('0x3f')](db['FaxAccount'][_0x4f93('0x40')],function(_0x4cc8d1){return{'name':_0x4cc8d1['fieldName'],'type':_0x4cc8d1['type'][_0x4f93('0x41')]};});_0x217286[_0x4f93('0x42')]=_[_0x4f93('0x3f')](_0x391e61,_0x4f93('0x3b'));_0x217286[_0x4f93('0x43')]=_[_0x4f93('0x44')](_0x224fa7['query']);_0x217286[_0x4f93('0x45')]=_[_0x4f93('0x46')](_0x217286[_0x4f93('0x42')],_0x217286[_0x4f93('0x43')]);_0x5715cc[_0x4f93('0x47')]=_[_0x4f93('0x46')](_0x217286[_0x4f93('0x42')],qs[_0x4f93('0x48')](_0x224fa7['query'][_0x4f93('0x48')]));_0x5715cc[_0x4f93('0x47')]=_0x5715cc['attributes'][_0x4f93('0x49')]?_0x5715cc['attributes']:_0x217286[_0x4f93('0x42')];if(!_0x224fa7[_0x4f93('0x43')]['hasOwnProperty'](_0x4f93('0x4a'))){_0x5715cc[_0x4f93('0x31')]=qs[_0x4f93('0x31')](_0x224fa7[_0x4f93('0x43')][_0x4f93('0x31')]);_0x5715cc[_0x4f93('0x2f')]=qs['offset'](_0x224fa7[_0x4f93('0x43')][_0x4f93('0x2f')]);}_0x5715cc[_0x4f93('0x4b')]=qs[_0x4f93('0x4c')](_0x224fa7[_0x4f93('0x43')]['sort']);_0x5715cc['where']=qs[_0x4f93('0x45')](_[_0x4f93('0x4d')](_0x224fa7[_0x4f93('0x43')],_0x217286[_0x4f93('0x45')]),_0x391e61);if(_0x224fa7['query'][_0x4f93('0x4e')]){_0x5715cc['where']=_[_0x4f93('0x4f')](_0x5715cc[_0x4f93('0x50')],{'$or':_[_0x4f93('0x3f')](_0x391e61,function(_0x4c45ba){if(_0x4c45ba['type']!==_0x4f93('0x51')){var _0x538f44={};_0x538f44[_0x4c45ba[_0x4f93('0x3b')]]={'$like':'%'+_0x224fa7[_0x4f93('0x43')][_0x4f93('0x4e')]+'%'};return _0x538f44;}})});}_0x5715cc=_[_0x4f93('0x4f')]({},_0x5715cc,_0x224fa7[_0x4f93('0x52')]);var _0x5f0646={'where':_0x5715cc[_0x4f93('0x50')]};return db[_0x4f93('0x53')][_0x4f93('0x32')](_0x5f0646)['then'](function(_0x545af9){_0x51233f[_0x4f93('0x32')]=_0x545af9;if(_0x224fa7[_0x4f93('0x43')][_0x4f93('0x54')]){_0x5715cc['include']=[{'all':!![]}];}return db[_0x4f93('0x53')][_0x4f93('0x55')](_0x5715cc);})[_0x4f93('0x20')](function(_0x4bf796){_0x51233f[_0x4f93('0x56')]=_0x4bf796;return _0x51233f;})['then'](respondWithFilteredResult(_0x1c3157,_0x5715cc))[_0x4f93('0x2b')](handleError(_0x1c3157,null));};exports['show']=function(_0x4d0a99,_0x211682){var _0x12279d={'raw':![],'where':{'id':_0x4d0a99[_0x4f93('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x4f93('0x3e')}]},_0x506294={};_0x506294['model']=_[_0x4f93('0x44')](db['FaxAccount'][_0x4f93('0x40')]);_0x506294['query']=_[_0x4f93('0x44')](_0x4d0a99[_0x4f93('0x43')]);_0x506294[_0x4f93('0x45')]=_[_0x4f93('0x46')](_0x506294[_0x4f93('0x42')],_0x506294[_0x4f93('0x43')]);_0x12279d[_0x4f93('0x47')]=_['intersection'](_0x506294[_0x4f93('0x42')],qs[_0x4f93('0x48')](_0x4d0a99[_0x4f93('0x43')]['fields']));_0x12279d[_0x4f93('0x47')]=_0x12279d[_0x4f93('0x47')]['length']?_0x12279d['attributes']:_0x506294[_0x4f93('0x42')];if(_0x4d0a99[_0x4f93('0x43')][_0x4f93('0x54')]){_0x12279d[_0x4f93('0x58')]=[{'all':!![]}];}_0x12279d=_['merge']({},_0x12279d,_0x4d0a99[_0x4f93('0x52')]);return db[_0x4f93('0x53')][_0x4f93('0x59')](_0x12279d)[_0x4f93('0x20')](handleEntityNotFound(_0x211682,null))[_0x4f93('0x20')](respondWithResult(_0x211682,null))['catch'](handleError(_0x211682,null));};exports['create']=function(_0x3f8fae,_0x2d532d){return db[_0x4f93('0x53')][_0x4f93('0x5a')](_0x3f8fae['body'],{})['then'](function(_0x240635){var _0xd60093=_0x3f8fae[_0x4f93('0x5b')][_0x4f93('0x5c')]({'plain':!![]});if(!_0xd60093)throw new Error(_0x4f93('0x5d'));if(_0xd60093[_0x4f93('0x5e')]==='user'){var _0x299aa4=_0x240635[_0x4f93('0x5c')]({'plain':!![]});var _0xdd832e=_0x4f93('0x5f');return db[_0x4f93('0x60')][_0x4f93('0x59')]({'where':{'name':_0xdd832e,'userProfileId':_0xd60093[_0x4f93('0x61')]},'raw':!![]})[_0x4f93('0x20')](function(_0xfbbd83){if(_0xfbbd83&&_0xfbbd83['autoAssociation']===0x0){return db['UserProfileResource'][_0x4f93('0x5a')]({'name':_0x299aa4[_0x4f93('0x3b')],'resourceId':_0x299aa4['id'],'type':_0xfbbd83[_0x4f93('0x3b')],'sectionId':_0xfbbd83['id']},{})[_0x4f93('0x20')](function(){return _0x240635;});}else{return _0x240635;}})['catch'](function(_0x2886e2){logger[_0x4f93('0x27')](_0x4f93('0x62'),_0x2886e2);throw _0x2886e2;});}return _0x240635;})[_0x4f93('0x20')](respondWithResult(_0x2d532d,0xc9))['catch'](handleError(_0x2d532d,null));};exports[_0x4f93('0x38')]=function(_0x2e1ae3,_0x36bbfa){if(_0x2e1ae3[_0x4f93('0x63')]['id']){delete _0x2e1ae3[_0x4f93('0x63')]['id'];}return db['FaxAccount'][_0x4f93('0x59')]({'where':{'id':_0x2e1ae3['params']['id']},'include':[{'model':db[_0x4f93('0x3d')],'as':_0x4f93('0x3e')}]})['then'](handleEntityNotFound(_0x36bbfa,null))[_0x4f93('0x20')](saveUpdates(_0x2e1ae3[_0x4f93('0x63')],null))[_0x4f93('0x20')](respondWithResult(_0x36bbfa,null))[_0x4f93('0x2b')](handleError(_0x36bbfa,null));};exports[_0x4f93('0x3a')]=function(_0x2cfd2b,_0x48e004){return db[_0x4f93('0x53')][_0x4f93('0x59')]({'where':{'id':_0x2cfd2b[_0x4f93('0x57')]['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x48e004,null))[_0x4f93('0x20')](removeEntity(_0x48e004,null))[_0x4f93('0x2b')](handleError(_0x48e004,null));};exports[_0x4f93('0x64')]=function(_0x525d67,_0x2b51d0){return db['FaxAccount']['describe']()[_0x4f93('0x20')](respondWithResult(_0x2b51d0,null))['catch'](handleError(_0x2b51d0,null));};exports['addDisposition']=function(_0x51dff2,_0x1529c8,_0x48f8ca){if(_0x51dff2['body']['id']){delete _0x51dff2[_0x4f93('0x63')]['id'];}return db[_0x4f93('0x53')][_0x4f93('0x59')]({'where':{'id':_0x51dff2['params']['id']}})['then'](handleEntityNotFound(_0x1529c8,null))['then'](function(_0x5e3c6b){if(_0x5e3c6b){_0x51dff2['body'][_0x4f93('0x65')]=_0x5e3c6b['id'];return db[_0x4f93('0x66')][_0x4f93('0x5a')](_0x51dff2[_0x4f93('0x63')]);}})[_0x4f93('0x20')](respondWithResult(_0x1529c8,null))[_0x4f93('0x2b')](handleError(_0x1529c8,null));};exports['getDispositions']=function(_0x32b404,_0x818a2b,_0x1bd77f){var _0x7bc060={'raw':![],'where':{}};var _0x110dd3={};var _0x2c511b={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x32b404[_0x4f93('0x57')]['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x818a2b,null))[_0x4f93('0x20')](function(_0x34fc8a){if(_0x34fc8a){_0x110dd3['model']=_[_0x4f93('0x44')](db[_0x4f93('0x66')][_0x4f93('0x40')]);_0x110dd3[_0x4f93('0x43')]=_[_0x4f93('0x44')](_0x32b404['query']);_0x110dd3[_0x4f93('0x45')]=_['intersection'](_0x110dd3[_0x4f93('0x42')],_0x110dd3[_0x4f93('0x43')]);_0x7bc060[_0x4f93('0x47')]=_['intersection'](_0x110dd3[_0x4f93('0x42')],qs['fields'](_0x32b404[_0x4f93('0x43')][_0x4f93('0x48')]));_0x7bc060[_0x4f93('0x47')]=_0x7bc060[_0x4f93('0x47')][_0x4f93('0x49')]?_0x7bc060[_0x4f93('0x47')]:_0x110dd3[_0x4f93('0x42')];if(!_0x32b404[_0x4f93('0x43')][_0x4f93('0x67')](_0x4f93('0x4a'))){_0x7bc060[_0x4f93('0x31')]=qs[_0x4f93('0x31')](_0x32b404[_0x4f93('0x43')][_0x4f93('0x31')]);_0x7bc060[_0x4f93('0x2f')]=qs['offset'](_0x32b404[_0x4f93('0x43')][_0x4f93('0x2f')]);}_0x7bc060['order']=qs[_0x4f93('0x4c')](_0x32b404[_0x4f93('0x43')]['sort']);_0x7bc060[_0x4f93('0x50')]=qs[_0x4f93('0x45')](_[_0x4f93('0x4d')](_0x32b404[_0x4f93('0x43')],_0x110dd3[_0x4f93('0x45')]));_0x7bc060['where'][_0x4f93('0x65')]=_0x34fc8a['id'];if(_0x32b404[_0x4f93('0x43')][_0x4f93('0x4e')]){_0x7bc060['where']=_[_0x4f93('0x4f')](_0x7bc060[_0x4f93('0x50')],{'$or':_['map'](_0x7bc060[_0x4f93('0x47')],function(_0x48e7f9){var _0xb22709={};_0xb22709[_0x48e7f9]={'$like':'%'+_0x32b404[_0x4f93('0x43')]['filter']+'%'};return _0xb22709;})});}_0x7bc060=_[_0x4f93('0x4f')]({},_0x7bc060,_0x32b404[_0x4f93('0x52')]);return db[_0x4f93('0x66')][_0x4f93('0x32')]({'where':_0x7bc060[_0x4f93('0x50')]})[_0x4f93('0x20')](function(_0x4ded3f){_0x2c511b['count']=_0x4ded3f;if(_0x32b404[_0x4f93('0x43')][_0x4f93('0x54')]){_0x7bc060[_0x4f93('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x4f93('0x55')](_0x7bc060);})[_0x4f93('0x20')](function(_0x2d3a4b){_0x2c511b[_0x4f93('0x56')]=_0x2d3a4b;return _0x2c511b;});}})['then'](respondWithFilteredResult(_0x818a2b,_0x7bc060))['catch'](handleError(_0x818a2b,null));};exports[_0x4f93('0x68')]=function(_0x3250f2,_0x38423c,_0x2838f8){return db[_0x4f93('0x53')][_0x4f93('0x59')]({'where':{'id':_0x3250f2['params']['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x38423c,null))['then'](function(_0x4e3486){if(_0x4e3486){return _0x4e3486['removeDispositions'](_0x3250f2[_0x4f93('0x43')]['ids']);}})[_0x4f93('0x20')](respondWithStatusCode(_0x38423c,null))[_0x4f93('0x2b')](handleError(_0x38423c,null));};exports[_0x4f93('0x69')]=function(_0x49fcd8,_0x48c8c6,_0x19627d){if(_0x49fcd8[_0x4f93('0x63')]['id']){delete _0x49fcd8['body']['id'];}return db[_0x4f93('0x53')]['find']({'where':{'id':_0x49fcd8[_0x4f93('0x57')]['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x48c8c6,null))[_0x4f93('0x20')](function(_0x598862){if(_0x598862){_0x49fcd8[_0x4f93('0x63')]['FaxAccountId']=_0x598862['id'];return db[_0x4f93('0x6a')]['create'](_0x49fcd8['body']);}})[_0x4f93('0x20')](respondWithResult(_0x48c8c6,null))['catch'](handleError(_0x48c8c6,null));};exports[_0x4f93('0x6b')]=function(_0x372dd6,_0x4c4f16,_0x2f24e4){var _0x24782f={'raw':![],'where':{}};var _0x2bb2b9={};var _0x57c713={'count':0x0,'rows':[]};return db[_0x4f93('0x53')]['findOne']({'where':{'id':_0x372dd6[_0x4f93('0x57')]['id']}})['then'](handleEntityNotFound(_0x4c4f16,null))[_0x4f93('0x20')](function(_0xf19030){if(_0xf19030){_0x2bb2b9['model']=_[_0x4f93('0x44')](db[_0x4f93('0x6a')]['rawAttributes']);_0x2bb2b9[_0x4f93('0x43')]=_[_0x4f93('0x44')](_0x372dd6[_0x4f93('0x43')]);_0x2bb2b9['filters']=_[_0x4f93('0x46')](_0x2bb2b9['model'],_0x2bb2b9[_0x4f93('0x43')]);_0x24782f['attributes']=_[_0x4f93('0x46')](_0x2bb2b9[_0x4f93('0x42')],qs['fields'](_0x372dd6['query']['fields']));_0x24782f[_0x4f93('0x47')]=_0x24782f[_0x4f93('0x47')][_0x4f93('0x49')]?_0x24782f[_0x4f93('0x47')]:_0x2bb2b9['model'];if(!_0x372dd6[_0x4f93('0x43')][_0x4f93('0x67')]('nolimit')){_0x24782f[_0x4f93('0x31')]=qs['limit'](_0x372dd6[_0x4f93('0x43')][_0x4f93('0x31')]);_0x24782f[_0x4f93('0x2f')]=qs[_0x4f93('0x2f')](_0x372dd6[_0x4f93('0x43')][_0x4f93('0x2f')]);}_0x24782f[_0x4f93('0x4b')]=qs['sort'](_0x372dd6[_0x4f93('0x43')][_0x4f93('0x4c')]);_0x24782f[_0x4f93('0x50')]=qs[_0x4f93('0x45')](_['pick'](_0x372dd6[_0x4f93('0x43')],_0x2bb2b9[_0x4f93('0x45')]));_0x24782f[_0x4f93('0x50')][_0x4f93('0x65')]=_0xf19030['id'];if(_0x372dd6[_0x4f93('0x43')][_0x4f93('0x4e')]){_0x24782f['where']=_[_0x4f93('0x4f')](_0x24782f[_0x4f93('0x50')],{'$or':_[_0x4f93('0x3f')](_0x24782f[_0x4f93('0x47')],function(_0x4e8fca){var _0x1ebcc7={};_0x1ebcc7[_0x4e8fca]={'$like':'%'+_0x372dd6[_0x4f93('0x43')][_0x4f93('0x4e')]+'%'};return _0x1ebcc7;})});}_0x24782f=_[_0x4f93('0x4f')]({},_0x24782f,_0x372dd6[_0x4f93('0x52')]);return db['CannedAnswer'][_0x4f93('0x32')]({'where':_0x24782f['where']})[_0x4f93('0x20')](function(_0x52aaf6){_0x57c713['count']=_0x52aaf6;if(_0x372dd6[_0x4f93('0x43')][_0x4f93('0x54')]){_0x24782f[_0x4f93('0x58')]=[{'all':!![]}];}return db[_0x4f93('0x6a')]['findAll'](_0x24782f);})[_0x4f93('0x20')](function(_0x192956){_0x57c713[_0x4f93('0x56')]=_0x192956;return _0x57c713;});}})[_0x4f93('0x20')](respondWithFilteredResult(_0x4c4f16,_0x24782f))[_0x4f93('0x2b')](handleError(_0x4c4f16,null));};exports[_0x4f93('0x6c')]=function(_0x11ba47,_0x683daf,_0x1758e1){return db[_0x4f93('0x53')][_0x4f93('0x59')]({'where':{'id':_0x11ba47[_0x4f93('0x57')]['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x683daf,null))[_0x4f93('0x20')](function(_0x50e6da){if(_0x50e6da){return _0x50e6da[_0x4f93('0x6c')](_0x11ba47['query'][_0x4f93('0x6d')]);}})['then'](respondWithStatusCode(_0x683daf,null))[_0x4f93('0x2b')](handleError(_0x683daf,null));};exports[_0x4f93('0x6e')]=function(_0xbe9342,_0x6f1fab,_0x42e00e){return db[_0x4f93('0x6f')]['find']({'where':{'id':_0xbe9342[_0x4f93('0x57')]['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x6f1fab,null))[_0x4f93('0x20')](function(_0x3d3e72){if(_0x3d3e72){return _0x3d3e72[_0x4f93('0x6e')](_0xbe9342[_0x4f93('0x63')][_0x4f93('0x6d')],_[_0x4f93('0x70')](_0xbe9342['body'],[_0x4f93('0x6d'),'id'])||{});}})[_0x4f93('0x20')](respondWithResult(_0x6f1fab,null))[_0x4f93('0x2b')](handleError(_0x6f1fab,null));};exports[_0x4f93('0x71')]=function(_0x4f55c3,_0x37f7e9,_0x288027){var _0x4506f7={'raw':![],'where':{}};var _0x16f127={};var _0x85a5a9={'count':0x0,'rows':[]};return db[_0x4f93('0x53')][_0x4f93('0x72')]({'where':{'id':_0x4f55c3['params']['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x37f7e9,null))['then'](function(_0x4c5069){if(_0x4c5069){_0x16f127[_0x4f93('0x42')]=_[_0x4f93('0x44')](db[_0x4f93('0x6f')][_0x4f93('0x40')]);_0x16f127[_0x4f93('0x43')]=_[_0x4f93('0x44')](_0x4f55c3['query']);_0x16f127['filters']=_[_0x4f93('0x46')](_0x16f127[_0x4f93('0x42')],_0x16f127['query']);_0x4506f7[_0x4f93('0x47')]=_['intersection'](_0x16f127[_0x4f93('0x42')],qs[_0x4f93('0x48')](_0x4f55c3['query']['fields']));_0x4506f7[_0x4f93('0x47')]=_0x4506f7['attributes'][_0x4f93('0x49')]?_0x4506f7[_0x4f93('0x47')]:_0x16f127[_0x4f93('0x42')];if(!_0x4f55c3[_0x4f93('0x43')][_0x4f93('0x67')](_0x4f93('0x4a'))){_0x4506f7[_0x4f93('0x31')]=qs[_0x4f93('0x31')](_0x4f55c3[_0x4f93('0x43')][_0x4f93('0x31')]);_0x4506f7['offset']=qs[_0x4f93('0x2f')](_0x4f55c3['query'][_0x4f93('0x2f')]);}_0x4506f7[_0x4f93('0x4b')]=qs['sort'](_0x4f55c3[_0x4f93('0x43')]['sort']);_0x4506f7[_0x4f93('0x50')]=qs['filters'](_[_0x4f93('0x4d')](_0x4f55c3[_0x4f93('0x43')],_0x16f127['filters']));_0x4506f7['where'][_0x4f93('0x65')]=_0x4c5069['id'];if(_0x4f55c3['query'][_0x4f93('0x4e')]){_0x4506f7[_0x4f93('0x50')]=_['merge'](_0x4506f7[_0x4f93('0x50')],{'$or':_[_0x4f93('0x3f')](_0x4506f7[_0x4f93('0x47')],function(_0x307fcc){var _0x2ccbdc={};_0x2ccbdc[_0x307fcc]={'$like':'%'+_0x4f55c3[_0x4f93('0x43')][_0x4f93('0x4e')]+'%'};return _0x2ccbdc;})});}_0x4506f7=_[_0x4f93('0x4f')]({},_0x4506f7,_0x4f55c3['options']);return db[_0x4f93('0x6f')][_0x4f93('0x32')]({'where':_0x4506f7['where']})[_0x4f93('0x20')](function(_0x18ab29){_0x85a5a9['count']=_0x18ab29;if(_0x4f55c3['query'][_0x4f93('0x54')]){_0x4506f7[_0x4f93('0x58')]=[{'model':db[_0x4f93('0x73')],'as':_0x4f93('0x74'),'required':![]},{'model':db[_0x4f93('0x75')],'as':_0x4f93('0x76'),'attributes':['name',_0x4f93('0x77'),'internal'],'required':![]},{'model':db[_0x4f93('0x78')],'as':_0x4f93('0x79'),'attributes':['id',_0x4f93('0x3b'),_0x4f93('0x7a')],'where':_0x4f55c3[_0x4f93('0x43')][_0x4f93('0x7b')]?{'id':_0x4f55c3[_0x4f93('0x43')]['tag']}:undefined,'required':_0x4f55c3['query'][_0x4f93('0x7b')]?!![]:![]}];}return db[_0x4f93('0x6f')][_0x4f93('0x55')](_0x4506f7);})[_0x4f93('0x20')](function(_0x29ee68){_0x85a5a9[_0x4f93('0x56')]=_0x29ee68;return _0x85a5a9;});}})[_0x4f93('0x20')](respondWithFilteredResult(_0x37f7e9,_0x4506f7))[_0x4f93('0x2b')](handleError(_0x37f7e9,null));};exports['addApplications']=function(_0x149eba,_0x2b88f3){var _0x3a6f88=_0x149eba[_0x4f93('0x57')]['id'];var _0x44ba94=_0x149eba[_0x4f93('0x63')];var _0x3d85be=0xc8;var _0x2ff929=null;return db[_0x4f93('0x7c')][_0x4f93('0x7d')]({'isolationLevel':db[_0x4f93('0x7c')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4b793c){return db[_0x4f93('0x53')]['findOne']({'where':{'id':_0x3a6f88},'transaction':_0x4b793c})[_0x4f93('0x20')](function(_0x3ec93d){if(_0x3ec93d){return db[_0x4f93('0x7e')][_0x4f93('0x3a')]({'where':{'FaxAccountId':_0x3a6f88},'transaction':_0x4b793c})[_0x4f93('0x20')](function(){var _0x172638=_[_0x4f93('0x3f')](_0x44ba94,function(_0x4d12d5){_0x4d12d5[_0x4f93('0x65')]=_0x3a6f88;return _0x4d12d5;});return db[_0x4f93('0x7e')]['bulkCreate'](_0x172638,{'transaction':_0x4b793c});});}else{_0x3d85be=0x194;_0x2ff929=[];}});})[_0x4f93('0x20')](function(){if(_0x3d85be!==0x194){return db[_0x4f93('0x7e')][_0x4f93('0x7f')]({'where':{'FaxAccountId':_0x3a6f88},'order':_0x4f93('0x80')})[_0x4f93('0x20')](function(_0x51b77b){_0x2ff929=_0x51b77b;});}})[_0x4f93('0x2b')](function(_0x491d63){_0x3d85be=0x1f4;logger[_0x4f93('0x27')](_0x491d63[_0x4f93('0x81')]);if(_0x491d63[_0x4f93('0x3b')]){delete _0x491d63[_0x4f93('0x3b')];}_0x2ff929=_0x491d63;})[_0x4f93('0x82')](function(){if(_0x2ff929===null){_0x2b88f3['sendStatus'](_0x3d85be);}else{if(_0x3d85be===0x1f4){_0x2b88f3['status'](_0x3d85be)[_0x4f93('0x83')](_0x2ff929);}else{_0x2b88f3['status'](_0x3d85be)[_0x4f93('0x2e')](_0x2ff929);}}});};exports[_0x4f93('0x84')]=function(_0x465d25,_0x2284c6,_0x378b52){var _0xaf0211={};var _0x3969f6={};var _0x83f4a9;var _0x57226f;return db[_0x4f93('0x53')]['findOne']({'where':{'id':_0x465d25[_0x4f93('0x57')]['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x2284c6,null))['then'](function(_0x4e2d22){if(_0x4e2d22){_0x83f4a9=_0x4e2d22;_0x3969f6['model']=_['keys'](db[_0x4f93('0x7e')]['rawAttributes']);_0x3969f6[_0x4f93('0x43')]=_[_0x4f93('0x44')](_0x465d25[_0x4f93('0x43')]);_0x3969f6[_0x4f93('0x45')]=_[_0x4f93('0x46')](_0x3969f6[_0x4f93('0x42')],_0x3969f6['query']);_0xaf0211[_0x4f93('0x47')]=_[_0x4f93('0x46')](_0x3969f6['model'],qs['fields'](_0x465d25[_0x4f93('0x43')][_0x4f93('0x48')]));_0xaf0211[_0x4f93('0x47')]=_0xaf0211[_0x4f93('0x47')]['length']?_0xaf0211[_0x4f93('0x47')]:_0x3969f6[_0x4f93('0x42')];_0xaf0211['order']=qs[_0x4f93('0x4c')](_0x465d25[_0x4f93('0x43')][_0x4f93('0x4c')]);_0xaf0211[_0x4f93('0x50')]=qs[_0x4f93('0x45')](_[_0x4f93('0x4d')](_0x465d25[_0x4f93('0x43')],_0x3969f6[_0x4f93('0x45')]));if(_0x465d25['query'][_0x4f93('0x4e')]){_0xaf0211[_0x4f93('0x50')]=_[_0x4f93('0x4f')](_0xaf0211[_0x4f93('0x50')],{'$or':_[_0x4f93('0x3f')](_0xaf0211[_0x4f93('0x47')],function(_0x4c8a5c){var _0x2a17e1={};_0x2a17e1[_0x4c8a5c]={'$like':'%'+_0x465d25[_0x4f93('0x43')][_0x4f93('0x4e')]+'%'};return _0x2a17e1;})});}_0xaf0211=_[_0x4f93('0x4f')]({},_0xaf0211,_0x465d25[_0x4f93('0x52')]);return _0x83f4a9[_0x4f93('0x84')](_0xaf0211);}})['then'](function(_0x13632e){if(_0x13632e){_0x57226f=_0x13632e[_0x4f93('0x49')];if(!_0x465d25[_0x4f93('0x43')][_0x4f93('0x67')]('nolimit')){_0xaf0211[_0x4f93('0x31')]=qs[_0x4f93('0x31')](_0x465d25['query'][_0x4f93('0x31')]);_0xaf0211['offset']=qs['offset'](_0x465d25['query'][_0x4f93('0x2f')]);}return _0x83f4a9['getApplications'](_0xaf0211);}})['then'](function(_0x3e8d1c){if(_0x3e8d1c){return _0x3e8d1c?{'count':_0x57226f,'rows':_0x3e8d1c}:null;}})[_0x4f93('0x20')](respondWithResult(_0x2284c6,null))[_0x4f93('0x2b')](handleError(_0x2284c6,null));};function Extension(_0x51df8d,_0x1045e3,_0x307c51,_0x645b92){this[_0x4f93('0x85')]=_0x4f93('0x86');this[_0x4f93('0x87')]=_0x51df8d[_0x4f93('0x88')];this['app']=_0x645b92;this[_0x4f93('0x89')]='system';this[_0x4f93('0x8a')]=_0x4f93('0x8b');this[_0x4f93('0x65')]=_0x51df8d['id'];this[_0x4f93('0x80')]=_0x1045e3;this[_0x4f93('0x8c')]=_0x307c51;}function createExtensionsReciveFax(_0x7e082f){var _0x50c0ff=0x1;var _0x5edd72=[];_0x5edd72[_0x4f93('0x8d')](new Extension(_0x7e082f,_0x50c0ff,'',_0x4f93('0x8e')));_0x50c0ff+=0x1;_0x5edd72[_0x4f93('0x8d')](new Extension(_0x7e082f,_0x50c0ff,'CDR(type)=inbound-fax',_0x4f93('0x8f')));_0x50c0ff+=0x1;for(var _0x369b99 in _0x7e082f){if(_0x7e082f[_0x4f93('0x67')](_0x369b99)&&(_0x369b99===_0x4f93('0x90')||_0x369b99===_0x4f93('0x88')||_0x369b99==='gateway'||_0x369b99==='faxdetect'||_0x369b99===_0x4f93('0x91')||_0x369b99===_0x4f93('0x92')||_0x369b99==='minrate'||_0x369b99==='modem'||_0x369b99===_0x4f93('0x93'))){_0x5edd72[_0x4f93('0x8d')](new Extension(_0x7e082f,_0x50c0ff,_0x4f93('0x94')+_0x369b99+')='+_0x7e082f[_0x369b99],'Set'));_0x50c0ff+=0x1;}}_0x5edd72['push'](new Extension(_0x7e082f,_0x50c0ff,'6',_0x4f93('0x95')));_0x50c0ff+=0x1;_0x5edd72[_0x4f93('0x8d')](new Extension(_0x7e082f,_0x50c0ff,_0x4f93('0x96'),_0x4f93('0x97')));_0x50c0ff=0x0;return _0x5edd72;}exports['addAccountApplications']=function(_0x560b17,_0x3cbc0e,_0x1897c8){var _0x43774a;return db[_0x4f93('0x7c')][_0x4f93('0x7d')](function(_0xa3cb04){return db[_0x4f93('0x53')][_0x4f93('0x5a')](_0x560b17['body'],{'transaction':_0xa3cb04})[_0x4f93('0x20')](function(_0x17d72d){_0x43774a=_0x17d72d[_0x4f93('0x5c')]({'plain':!![]});return db[_0x4f93('0x98')][_0x4f93('0x99')](createExtensionsReciveFax(_0x43774a),{'transaction':_0xa3cb04});});})[_0x4f93('0x20')](function(){return _0x43774a;})[_0x4f93('0x20')](respondWithResult(_0x3cbc0e,null))['catch'](handleError(_0x3cbc0e,null));};exports[_0x4f93('0x9a')]=function(_0x19006b,_0x440c69,_0x1cb5a1){var _0x25e589;return db[_0x4f93('0x7c')][_0x4f93('0x7d')](function(_0x20c2b8){return db[_0x4f93('0x53')][_0x4f93('0x38')](_0x19006b[_0x4f93('0x63')],{'where':{'id':_0x19006b[_0x4f93('0x63')]['id']},'transaction':_0x20c2b8})[_0x4f93('0x20')](function(_0x1b7b91){return db['VoiceExtension'][_0x4f93('0x3a')]({'where':{'FaxAccountId':_0x19006b[_0x4f93('0x63')]['id']},'transaction':_0x20c2b8})[_0x4f93('0x20')](function(_0x28bd4b){return db['VoiceExtension'][_0x4f93('0x99')](createExtensionsReciveFax(_['omit'](_0x19006b[_0x4f93('0x63')],[_0x4f93('0x9b'),_0x4f93('0x41'),_0x4f93('0x9c'),_0x4f93('0x9d'),_0x4f93('0x9e'),'ListId'])),{'transaction':_0x20c2b8});});});})[_0x4f93('0x20')](function(){return db[_0x4f93('0x53')][_0x4f93('0x9f')](_0x19006b[_0x4f93('0x63')]['id']);})[_0x4f93('0x20')](respondWithResult(_0x440c69,null))[_0x4f93('0x2b')](handleError(_0x440c69,null));};exports[_0x4f93('0xa0')]=function(_0x3b673d,_0x39f36d,_0x273ea2){var _0x123ae8={'raw':!![],'where':{}};var _0x19fe55={};var _0x5027d2={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4f93('0x72')]({'where':{'id':_0x3b673d['params']['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x39f36d,null))[_0x4f93('0x20')](function(_0x4ccd73){if(_0x4ccd73){_0x19fe55['model']=_[_0x4f93('0x44')](db['FaxMessage'][_0x4f93('0x40')]);_0x19fe55[_0x4f93('0x43')]=_[_0x4f93('0x44')](_0x3b673d['query']);_0x19fe55[_0x4f93('0x45')]=_[_0x4f93('0x46')](_0x19fe55[_0x4f93('0x42')],_0x19fe55['query']);_0x123ae8[_0x4f93('0x47')]=_[_0x4f93('0x46')](_0x19fe55[_0x4f93('0x42')],qs[_0x4f93('0x48')](_0x3b673d['query'][_0x4f93('0x48')]));_0x123ae8['attributes']=_0x123ae8[_0x4f93('0x47')]['length']?_0x123ae8[_0x4f93('0x47')]:_0x19fe55['model'];if(!_0x3b673d[_0x4f93('0x43')][_0x4f93('0x67')](_0x4f93('0x4a'))){_0x123ae8[_0x4f93('0x31')]=qs[_0x4f93('0x31')](_0x3b673d[_0x4f93('0x43')][_0x4f93('0x31')]);_0x123ae8[_0x4f93('0x2f')]=qs[_0x4f93('0x2f')](_0x3b673d[_0x4f93('0x43')]['offset']);}_0x123ae8[_0x4f93('0x4b')]=qs['sort'](_0x3b673d[_0x4f93('0x43')][_0x4f93('0x4c')]);_0x123ae8[_0x4f93('0x50')]=qs[_0x4f93('0x45')](_[_0x4f93('0x4d')](_0x3b673d['query'],_0x19fe55['filters']));_0x123ae8[_0x4f93('0x50')][_0x4f93('0x65')]=_0x4ccd73['id'];if(_0x3b673d[_0x4f93('0x43')][_0x4f93('0x4e')]){_0x123ae8[_0x4f93('0x50')]=_[_0x4f93('0x4f')](_0x123ae8['where'],{'$or':_[_0x4f93('0x3f')](_0x123ae8[_0x4f93('0x47')],function(_0x3fe584){var _0x23d085={};_0x23d085[_0x3fe584]={'$like':'%'+_0x3b673d[_0x4f93('0x43')][_0x4f93('0x4e')]+'%'};return _0x23d085;})});}if(_0x3b673d[_0x4f93('0x43')]['$gte']){var _0xc3805c=_0x3b673d[_0x4f93('0x43')]['$gte'][_0x4f93('0xa1')](',');var _0x3624f1={};_0x3624f1[_0xc3805c[0x0]]={'$gte':moment(_0xc3805c[0x1])[_0x4f93('0xa2')](_0x4f93('0xa3'))};_0x123ae8[_0x4f93('0x50')]=_[_0x4f93('0x4f')](_0x123ae8[_0x4f93('0x50')],_0x3624f1);}_0x123ae8=_[_0x4f93('0x4f')]({},_0x123ae8,_0x3b673d['options']);return db[_0x4f93('0xa4')][_0x4f93('0x32')]({'where':_0x123ae8[_0x4f93('0x50')]})['then'](function(_0x104701){_0x5027d2[_0x4f93('0x32')]=_0x104701;if(_0x3b673d[_0x4f93('0x43')][_0x4f93('0x54')]){_0x123ae8['include']=[{'all':!![]}];}return db[_0x4f93('0xa4')][_0x4f93('0x55')](_0x123ae8);})[_0x4f93('0x20')](function(_0x1373d7){_0x5027d2[_0x4f93('0x56')]=_0x1373d7;return _0x5027d2;});}})[_0x4f93('0x20')](respondWithFilteredResult(_0x39f36d,_0x123ae8))[_0x4f93('0x2b')](handleError(_0x39f36d,null));};exports['send']=function(_0x333479,_0x21ec00,_0x4358fa){var _0x2575d5,_0x3d9849={},_0x38fa98;if(_0x333479['body']['to']){_0x38fa98=_0x333479['body']['to'][0x0];}return db[_0x4f93('0x53')][_0x4f93('0x59')]({'where':{'id':_0x333479[_0x4f93('0x57')]['id']},'include':[{'model':db[_0x4f93('0xa5')],'as':_0x4f93('0xa6'),'include':[{'model':db['CmContact'],'as':_0x4f93('0xa7'),'where':{'fax':_0x38fa98},'limit':0x1,'order':[['updatedAt',_0x4f93('0xa8')]]}]}]})[_0x4f93('0x20')](handleEntityNotFound(_0x21ec00,null))[_0x4f93('0x20')](function(_0x15f8d4){_0x2575d5=_0x15f8d4;if(_0x333479['body'][_0x4f93('0xa9')]&&_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][_0x4f93('0x49')]){for(var _0x10eb25=0x0;_0x10eb25<_0x333479[_0x4f93('0x63')]['attachments'][_0x4f93('0x49')];_0x10eb25+=0x1){_0x333479['body'][_0x4f93('0xa9')][_0x10eb25]={'filename':_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][_0x10eb25][_0x4f93('0x3b')],'id':_0x333479['body'][_0x4f93('0xa9')][_0x10eb25]['id'],'path':path[_0x4f93('0xaa')](config[_0x4f93('0xab')],_0x4f93('0xac'),_0x333479['body'][_0x4f93('0xa9')][_0x10eb25][_0x4f93('0xad')])};}}return respondWithRpcPromise(_0x4f93('0xae'),'CheckAfterSend',{'FaxAccountId':_[_0x4f93('0xaf')](_0x333479[_0x4f93('0x57')]['id'])?undefined:_0x333479[_0x4f93('0x57')]['id'],'path':_['isNil'](_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][0x0]['path'])?undefined:_0x333479['body']['attachments'][0x0][_0x4f93('0x6')],'fax':_[_0x4f93('0xaf')](_0x333479[_0x4f93('0x63')]['to'][0x0])?undefined:_0x333479[_0x4f93('0x63')]['to'][0x0]},client9002);})[_0x4f93('0x20')](function(){if(_0x2575d5){if(_[_0x4f93('0xaf')](_0x333479[_0x4f93('0x63')][_0x4f93('0xb0')])){_0x333479[_0x4f93('0x63')][_0x4f93('0xb0')]=util[_0x4f93('0xa2')]('\x22%s\x22\x20<%s>',_0x2575d5[_0x4f93('0x3b')],_0x2575d5[_0x4f93('0xb1')]);}if(_0x2575d5[_0x4f93('0xa6')]){if(_0x2575d5[_0x4f93('0xa6')][_0x4f93('0xa7')][_0x4f93('0x49')]){return _0x2575d5[_0x4f93('0xa6')][_0x4f93('0xa7')][0x0];}else{return db[_0x4f93('0x73')][_0x4f93('0x5a')](_['defaults'](_0x333479[_0x4f93('0x63')],{'firstName':_0x333479[_0x4f93('0x63')]['to'][0x0],'phone':_0x333479[_0x4f93('0x63')]['to'][0x0],'fax':_0x333479[_0x4f93('0x63')]['to'][0x0],'ListId':_0x2575d5[_0x4f93('0xb2')]}));}}else{throw new Error(_0x4f93('0xb3'));}}else{throw new Error(_0x4f93('0xb4'));}})[_0x4f93('0x20')](function(_0x5718e1){if(_0x5718e1){return db[_0x4f93('0x6f')][_0x4f93('0x59')]({'where':{'ContactId':_0x5718e1['id'],'closed':![],'FaxAccountId':_0x2575d5['id']}})['then'](function(_0x46c924){if(_0x46c924){return[_0x46c924,![]];}return db[_0x4f93('0x6f')][_0x4f93('0x5a')]({'UserId':_0x333479[_0x4f93('0x5b')]['id'],'ContactId':_0x5718e1['id'],'FaxAccountId':_0x2575d5['id'],'fax':_0x333479[_0x4f93('0x63')]['to'][0x0],'firstMsgDirection':_0x4f93('0xb5'),'Messages':[_[_0x4f93('0x4f')](_0x333479[_0x4f93('0x63')],{'read':![],'body':_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][0x0][_0x4f93('0xb6')],'FaxAccountId':_0x2575d5['id'],'UserId':_0x333479[_0x4f93('0x5b')]['id'],'ContactId':_0x5718e1['id'],'AttachmentId':_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x4f93('0xa4')],'as':_0x4f93('0xb7')}]})['then'](function(_0x744a08){return[_0x744a08,!![]];});});}else{throw new Error(_0x4f93('0xb8'));}})[_0x4f93('0xb9')](function(_0x1113ac,_0x4cb5b2){if(_0x4cb5b2){return _0x1113ac;}return db[_0x4f93('0xa4')]['create']({'direction':_0x4f93('0xb5'),'read':![],'body':_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][0x0]['filename'],'FaxAccountId':_0x2575d5['id'],'FaxInteractionId':_0x1113ac['id'],'UserId':_0x333479[_0x4f93('0x5b')]['id'],'ContactId':_0x1113ac[_0x4f93('0xba')],'AttachmentId':_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][0x0]['id']})[_0x4f93('0x20')](function(_0x1ce0cb){_0x1113ac[_0x4f93('0xbb')][_0x4f93('0xb7')]=[];_0x1113ac[_0x4f93('0xbb')]['Messages'][_0x4f93('0x8d')](_0x1ce0cb['dataValues']);return _0x1113ac;});})[_0x4f93('0x20')](function(_0x18dbfa){respondWithRpcPromise(_0x4f93('0xbc'),_0x4f93('0xbc'),{'FaxAccountId':_['isNil'](_0x333479[_0x4f93('0x57')]['id'])?undefined:_0x333479[_0x4f93('0x57')]['id'],'path':_['isNil'](_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][0x0][_0x4f93('0x6')])?undefined:_0x333479['body'][_0x4f93('0xa9')][0x0][_0x4f93('0x6')],'fax':_[_0x4f93('0xaf')](_0x333479[_0x4f93('0x63')]['to'][0x0])?undefined:_0x333479[_0x4f93('0x63')]['to'][0x0],'AttachmentId':_0x333479[_0x4f93('0x63')][_0x4f93('0xa9')][0x0]['id']},client9002)[_0x4f93('0x20')](function(_0x36e440){logger[_0x4f93('0x21')](_0x4f93('0xbd'),_0x36e440);})[_0x4f93('0x2b')](function(_0x212cc9){logger['info'](_0x4f93('0xbd'),_0x212cc9);});return _0x18dbfa;})[_0x4f93('0x20')](respondWithResult(_0x21ec00,null))[_0x4f93('0x2b')](handleError(_0x21ec00,null));};exports[_0x4f93('0xbe')]=function(_0x5708c6,_0x26c4ca,_0x10f8ac){return db['FaxAccount']['find']({'where':{'id':_0x5708c6[_0x4f93('0x57')]['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x26c4ca,null))['then'](function(_0x420e43){if(_0x420e43){return _0x420e43['addAgents'](_0x5708c6['body'][_0x4f93('0x6d')],_['omit'](_0x5708c6[_0x4f93('0x63')],[_0x4f93('0x6d'),'id'])||{})['spread'](function(_0x559fe6){for(var _0x470d78=0x0;_0x470d78<_0x5708c6[_0x4f93('0x63')][_0x4f93('0x6d')][_0x4f93('0x49')];_0x470d78+=0x1){socket['emit'](_0x4f93('0xbf'),{'UserId':Number(_0x5708c6[_0x4f93('0x63')]['ids'][_0x470d78]),'FaxAccountId':Number(_0x5708c6[_0x4f93('0x57')]['id'])});}return _0x559fe6;});}})[_0x4f93('0x20')](respondWithResult(_0x26c4ca,null))[_0x4f93('0x2b')](handleError(_0x26c4ca,null));};exports[_0x4f93('0xc0')]=function(_0x3170dd,_0x26c97b,_0x30af4a){return db['FaxAccount']['find']({'where':{'id':_0x3170dd['params']['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x26c97b,null))['then'](function(_0x5336e7){if(_0x5336e7){return _0x5336e7[_0x4f93('0xc0')](_0x3170dd[_0x4f93('0x43')][_0x4f93('0x6d')])[_0x4f93('0x20')](function(){if(_[_0x4f93('0xc1')](_0x3170dd[_0x4f93('0x43')][_0x4f93('0x6d')])){for(var _0x38e857=0x0;_0x38e857<_0x3170dd[_0x4f93('0x43')]['ids']['length'];_0x38e857+=0x1){socket[_0x4f93('0xc2')](_0x4f93('0xc3'),{'UserId':Number(_0x3170dd[_0x4f93('0x43')][_0x4f93('0x6d')][_0x38e857]),'FaxAccountId':Number(_0x3170dd[_0x4f93('0x57')]['id'])});}}else{socket['emit'](_0x4f93('0xc3'),{'UserId':Number(_0x3170dd['query']['ids']),'FaxAccountId':Number(_0x3170dd[_0x4f93('0x57')]['id'])});}});}})[_0x4f93('0x20')](respondWithStatusCode(_0x26c97b,null))['catch'](handleError(_0x26c97b,null));};exports[_0x4f93('0xc4')]=function(_0xbb5045,_0x2fc6f8,_0x2b9998){var _0x357c7c={};var _0x358207={};var _0x5a1233;var _0x3d8d8b;return db[_0x4f93('0x53')][_0x4f93('0x72')]({'where':{'id':_0xbb5045['params']['id']}})[_0x4f93('0x20')](handleEntityNotFound(_0x2fc6f8,null))[_0x4f93('0x20')](function(_0x4ded3c){if(_0x4ded3c){_0x5a1233=_0x4ded3c;_0x358207[_0x4f93('0x42')]=_[_0x4f93('0x44')](db['User'][_0x4f93('0x40')]);_0x358207['query']=_['keys'](_0xbb5045[_0x4f93('0x43')]);_0x358207[_0x4f93('0x45')]=_[_0x4f93('0x46')](_0x358207[_0x4f93('0x42')],_0x358207[_0x4f93('0x43')]);_0x357c7c['attributes']=_[_0x4f93('0x46')](_0x358207[_0x4f93('0x42')],qs['fields'](_0xbb5045[_0x4f93('0x43')][_0x4f93('0x48')]));_0x357c7c[_0x4f93('0x47')]=_0x357c7c['attributes'][_0x4f93('0x49')]?_0x357c7c[_0x4f93('0x47')]:_0x358207['model'];_0x357c7c[_0x4f93('0x4b')]=qs[_0x4f93('0x4c')](_0xbb5045[_0x4f93('0x43')]['sort']);_0x357c7c[_0x4f93('0x50')]=qs[_0x4f93('0x45')](_[_0x4f93('0x4d')](_0xbb5045[_0x4f93('0x43')],_0x358207[_0x4f93('0x45')]));if(_0xbb5045[_0x4f93('0x43')][_0x4f93('0x4e')]){_0x357c7c[_0x4f93('0x50')]=_[_0x4f93('0x4f')](_0x357c7c['where'],{'$or':_[_0x4f93('0x3f')](_0x357c7c[_0x4f93('0x47')],function(_0x3dbe5f){var _0x575ff7={};_0x575ff7[_0x3dbe5f]={'$like':'%'+_0xbb5045[_0x4f93('0x43')][_0x4f93('0x4e')]+'%'};return _0x575ff7;})});}_0x357c7c=_['merge']({},_0x357c7c,_0xbb5045[_0x4f93('0x52')]);return _0x5a1233[_0x4f93('0xc4')](_0x357c7c);}})['then'](function(_0x430db1){if(_0x430db1){_0x3d8d8b=_0x430db1[_0x4f93('0x49')];if(!_0xbb5045['query']['hasOwnProperty'](_0x4f93('0x4a'))){_0x357c7c[_0x4f93('0x31')]=qs[_0x4f93('0x31')](_0xbb5045[_0x4f93('0x43')][_0x4f93('0x31')]);_0x357c7c[_0x4f93('0x2f')]=qs['offset'](_0xbb5045['query']['offset']);}return _0x5a1233[_0x4f93('0xc4')](_0x357c7c);}})[_0x4f93('0x20')](function(_0x4becf3){if(_0x4becf3){return _0x4becf3?{'count':_0x3d8d8b,'rows':_0x4becf3}:null;}})[_0x4f93('0x20')](respondWithResult(_0x2fc6f8,null))[_0x4f93('0x2b')](handleError(_0x2fc6f8,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 06ace94..b5d27e0 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 _0xb749=['setMaxListeners','update','emit','hook','events','FaxAccount'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xb749,0xac));var _0x9b74=function(_0x8fc291,_0x2f47e4){_0x8fc291=_0x8fc291-0x0;var _0x79cafc=_0xb749[_0x8fc291];return _0x79cafc;};'use strict';var EventEmitter=require(_0x9b74('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x9b74('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9b74('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b74('0x3'),'afterDestroy':'remove'};function emitEvent(_0xb5e108){return function(_0x2d44b2,_0x218a95,_0x1b0346){FaxAccountEvents[_0x9b74('0x4')](_0xb5e108+':'+_0x2d44b2['id'],_0x2d44b2);FaxAccountEvents[_0x9b74('0x4')](_0xb5e108,_0x2d44b2);_0x1b0346(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x9b74('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xbb29=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xbb29,0x6d));var _0x9bb2=function(_0x298827,_0xe3d6ce){_0x298827=_0x298827-0x0;var _0x4a706d=_0xbb29[_0x298827];return _0x4a706d;};'use strict';var EventEmitter=require(_0x9bb2('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9bb2('0x1')](0x0);var events={'afterCreate':_0x9bb2('0x2'),'afterUpdate':_0x9bb2('0x3'),'afterDestroy':_0x9bb2('0x4')};function emitEvent(_0x5d2206){return function(_0x45ab7c,_0x3707d,_0x2fda2d){FaxAccountEvents[_0x9bb2('0x5')](_0x5d2206+':'+_0x45ab7c['id'],_0x45ab7c);FaxAccountEvents[_0x9bb2('0x5')](_0x5d2206,_0x45ab7c);_0x2fda2d(null);};}for(var e in events){if(events[_0x9bb2('0x6')](e)){var event=events[e];FaxAccount[_0x9bb2('0x7')](e,emitEvent(event));}}module[_0x9bb2('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 2dc4150..d07c00c 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 _0x6f98=['lodash','util','api','moment','bluebird','request-promise','rimraf','exports','fax_accounts'];(function(_0x5ada6c,_0x22cfaf){var _0x5c429a=function(_0xcaabea){while(--_0xcaabea){_0x5ada6c['push'](_0x5ada6c['shift']());}};_0x5c429a(++_0x22cfaf);}(_0x6f98,0x105));var _0x86f9=function(_0x1ae848,_0x1246fe){_0x1ae848=_0x1ae848-0x0;var _0x4c383e=_0x6f98[_0x1ae848];return _0x4c383e;};'use strict';var _=require(_0x86f9('0x0'));var util=require(_0x86f9('0x1'));var logger=require('../../config/logger')(_0x86f9('0x2'));var moment=require(_0x86f9('0x3'));var BPromise=require(_0x86f9('0x4'));var rp=require(_0x86f9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86f9('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x86f9('0x7')]=function(_0x4ce03b,_0x2e1b4c){return _0x4ce03b['define']('FaxAccount',attributes,{'tableName':_0x86f9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe1b=['../../config/logger','api','moment','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x1aa368,_0x56c31d){var _0x3d9e29=function(_0x32c580){while(--_0x32c580){_0x1aa368['push'](_0x1aa368['shift']());}};_0x3d9e29(++_0x56c31d);}(_0xbe1b,0xd0));var _0xbbe1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe1b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbbe1('0x0'));var util=require('util');var logger=require(_0xbbe1('0x1'))(_0xbbe1('0x2'));var moment=require(_0xbbe1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbe1('0x4'));var rimraf=require(_0xbbe1('0x5'));var config=require('../../config/environment');var attributes=require(_0xbbe1('0x6'));module[_0xbbe1('0x7')]=function(_0xf9dcd8,_0x480daa){return _0xf9dcd8[_0xbbe1('0x8')](_0xbbe1('0x9'),attributes,{'tableName':_0xbbe1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index a7aaba3..3d00fc6 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 _0x94b6=['FaxQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','updatedAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent'];(function(_0x45f2fe,_0x3534e0){var _0x511a6d=function(_0x186635){while(--_0x186635){_0x45f2fe['push'](_0x45f2fe['shift']());}};_0x511a6d(++_0x3534e0);}(_0x94b6,0x18f));var _0x694b=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x94b6[_0x1e381c];return _0x9b5ea9;};'use strict';var _=require(_0x694b('0x0'));var util=require(_0x694b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x694b('0x2'));var fs=require('fs');var Redis=require(_0x694b('0x3'));var db=require(_0x694b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x694b('0x5'))('rpc');var config=require(_0x694b('0x6'));var jayson=require(_0x694b('0x7'));var client=jayson['client'][_0x694b('0x8')]({'port':0x232c});config[_0x694b('0x9')]=_[_0x694b('0xa')](config[_0x694b('0x9')],{'host':_0x694b('0xb'),'port':0x18eb});var socket=require(_0x694b('0xc'))(new Redis(config['redis']));require(_0x694b('0xd'))[_0x694b('0xe')](socket);function respondWithRpcPromise(_0x2c2b98,_0xd2427e,_0x1227dc){return new BPromise(function(_0x3d0151,_0x20f11c){return client[_0x694b('0xf')](_0x2c2b98,_0x1227dc)[_0x694b('0x10')](function(_0x41d6fa){logger[_0x694b('0x11')]('FaxAccount,\x20%s,\x20%s',_0xd2427e,_0x694b('0x12'));logger[_0x694b('0x13')](_0x694b('0x14'),_0xd2427e,'request\x20sent',JSON[_0x694b('0x15')](_0x41d6fa));if(_0x41d6fa[_0x694b('0x16')]){if(_0x41d6fa[_0x694b('0x16')][_0x694b('0x17')]===0x1f4){logger['error'](_0x694b('0x18'),_0xd2427e,_0x41d6fa[_0x694b('0x16')]['message']);return _0x20f11c(_0x41d6fa[_0x694b('0x16')][_0x694b('0x19')]);}logger[_0x694b('0x16')]('FaxAccount,\x20%s,\x20%s',_0xd2427e,_0x41d6fa['error'][_0x694b('0x19')]);return _0x3d0151(_0x41d6fa[_0x694b('0x16')][_0x694b('0x19')]);}else{logger[_0x694b('0x11')]('FaxAccount,\x20%s,\x20%s',_0xd2427e,_0x694b('0x12'));_0x3d0151(_0x41d6fa[_0x694b('0x1a')]['message']);}})['catch'](function(_0x3fe3a0){logger[_0x694b('0x16')]('FaxAccount,\x20%s,\x20%s',_0xd2427e,_0x3fe3a0);_0x20f11c(_0x3fe3a0);});});}exports[_0x694b('0x1b')]=function(_0x195c6c){var _0x79fa56=this;return new Promise(function(_0x350d61,_0x2429cc){return db[_0x694b('0x1c')][_0x694b('0x1d')]({'raw':_0x195c6c[_0x694b('0x1e')]?_0x195c6c[_0x694b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x195c6c[_0x694b('0x1e')]?_0x195c6c[_0x694b('0x1e')][_0x694b('0x1f')]||null:null,'attributes':_0x195c6c['options']?_0x195c6c[_0x694b('0x1e')][_0x694b('0x20')]||null:null,'limit':_0x195c6c[_0x694b('0x1e')]?_0x195c6c[_0x694b('0x1e')][_0x694b('0x21')]||null:null,'include':_0x195c6c[_0x694b('0x1e')]?_0x195c6c[_0x694b('0x1e')][_0x694b('0x22')]?_['map'](_0x195c6c[_0x694b('0x1e')][_0x694b('0x22')],function(_0xea2739){return{'model':db[_0xea2739['model']],'as':_0xea2739['as'],'attributes':_0xea2739[_0x694b('0x20')],'include':_0xea2739[_0x694b('0x22')]?_[_0x694b('0x23')](_0xea2739[_0x694b('0x22')],function(_0x10bf6b){return{'model':db[_0x10bf6b['model']],'as':_0x10bf6b['as'],'attributes':_0x10bf6b[_0x694b('0x20')],'include':_0x10bf6b[_0x694b('0x22')]?_[_0x694b('0x23')](_0x10bf6b[_0x694b('0x22')],function(_0x21fce4){return{'model':db[_0x21fce4[_0x694b('0x24')]],'as':_0x21fce4['as'],'attributes':_0x21fce4[_0x694b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x694b('0x10')](function(_0xeea49f){logger[_0x694b('0x11')](_0x694b('0x1b'),_0x195c6c);logger['debug']('GetFaxAccount',_0x195c6c,JSON[_0x694b('0x15')](_0xeea49f));_0x350d61(_0xeea49f);})['catch'](function(_0x15d096){logger['error']('GetFaxAccount',_0x15d096['message'],_0x195c6c);_0x2429cc(_0x79fa56[_0x694b('0x16')](0x1f4,_0x15d096[_0x694b('0x19')]));});});};exports[_0x694b('0x25')]=function(_0x319c46,_0x5e76b7,_0x2282ea){var _0x52d450=this;return new Promise(function(_0x1bbc97,_0x57518d){var _0x591aeb={'body':_0x319c46[_0x694b('0x26')],'channel':_0x694b('0x27')};var _0x4fdb09=[];var _0x3aee9e=[];var _0x3a85d8={};return db[_0x694b('0x28')][_0x694b('0x29')]()[_0x694b('0x10')](function(_0xc179d7){if(!_0xc179d7){throw new db[(_0x694b('0x2a'))]['ValidationError'](_0x694b('0x2b'));}_0x4fdb09=_[_0x694b('0x2c')](_[_0x694b('0x2d')](_0xc179d7),['createdAt',_0x694b('0x2e')]);_0x3aee9e=_[_0x694b('0x2c')](_[_0x694b('0x2d')](_0xc179d7),['createdAt',_0x694b('0x2e'),_0x694b('0x2f'),_0x694b('0x30')]);if(_0x319c46['body']['id']){delete _0x319c46[_0x694b('0x26')]['id'];}if(_[_0x694b('0x31')](_0x319c46['body'][_0x694b('0x32')])){throw new db[(_0x694b('0x2a'))][(_0x694b('0x33'))]('from\x20is\x20mandatory');}if(_[_0x694b('0x31')](_0x319c46['body'][_0x694b('0x26')])||_0x319c46[_0x694b('0x26')][_0x694b('0x26')]===''){throw new db[(_0x694b('0x2a'))][(_0x694b('0x33'))](_0x694b('0x34'));}if(_[_0x694b('0x31')](_0x319c46[_0x694b('0x26')][_0x694b('0x35')])){throw new db['Sequelize'][(_0x694b('0x33'))](_0x694b('0x36')+_0x3aee9e);}if(!_[_0x694b('0x37')](_0x3aee9e,_0x319c46['body'][_0x694b('0x35')])){throw new db[(_0x694b('0x2a'))]['ValidationError'](_0x694b('0x38')+_0x3aee9e);}_0x3a85d8[_0x319c46[_0x694b('0x26')]['mapKey']]=_0x319c46[_0x694b('0x26')]['from'];})['then'](function(){return db[_0x694b('0x1c')][_0x694b('0x39')]({'where':{'id':_0x319c46[_0x694b('0x3a')]['id']},'include':[{'model':db[_0x694b('0x3b')],'as':_0x694b('0x3c'),'include':[{'model':db[_0x694b('0x28')],'as':_0x694b('0x3d'),'where':_0x3a85d8,'limit':0x1,'order':[[_0x694b('0x2e'),_0x694b('0x3e')]]}]},{'model':db[_0x694b('0x3f')],'as':_0x694b('0x40')}]});})[_0x694b('0x10')](function(_0x30c2a9){if(_0x30c2a9&&_0x30c2a9[_0x694b('0x3c')]){var _0x514051=_0x30c2a9[_0x694b('0x41')]({'plain':!![]});_0x591aeb[_0x694b('0x3a')]=_0x514051;_0x591aeb[_0x694b('0x42')]=_0x514051['Applications'];_0x591aeb[_0x694b('0x43')]=_0x514051[_0x694b('0x3c')];_0x591aeb[_0x694b('0x42')]=_[_0x694b('0x44')](_0x591aeb[_0x694b('0x42')],[_0x694b('0x45')],['asc']);if(_0x591aeb[_0x694b('0x3a')]['Applications']){delete _0x591aeb['account'][_0x694b('0x40')];}if(_0x591aeb[_0x694b('0x3a')][_0x694b('0x3c')]&&_0x591aeb[_0x694b('0x3a')]['List'][_0x694b('0x3d')][_0x694b('0x46')]){return _0x591aeb[_0x694b('0x3a')]['List'][_0x694b('0x3d')][0x0];}var _0x5a0b62=_['defaults'](_0x319c46[_0x694b('0x26')],{'firstName':_0x319c46[_0x694b('0x26')][_0x694b('0x32')],'ListId':_0x514051[_0x694b('0x30')]});_0x5a0b62[_0x319c46[_0x694b('0x26')][_0x694b('0x35')]]=_0x319c46[_0x694b('0x26')][_0x694b('0x32')];return db['CmContact'][_0x694b('0x47')](_0x5a0b62,{'fields':_0x4fdb09,'raw':!![]});}})[_0x694b('0x10')](function(_0x43a0de){_0x591aeb[_0x694b('0x48')]=_0x43a0de;if(_0x43a0de){var _0xa95456={'ContactId':_0x43a0de['id'],'FaxAccountId':_0x319c46[_0x694b('0x3a')]['id'],'fax':_0x43a0de[_0x694b('0x27')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x43a0de['id'],'closed':![],'FaxAccountId':_0x319c46['account']['id']}})[_0x694b('0x10')](function(_0x10877f){if(_0x10877f){return[_0x10877f,![]];}return db[_0x694b('0x49')]['create'](_0xa95456)['then'](function(_0x2d5652){return[_0x2d5652,!![]];});});}else{throw new Error(_0x694b('0x4a'));}})[_0x694b('0x4b')](function(_0x12c8c8,_0x3ad625){var _0x46c19b=_0x12c8c8[_0x694b('0x41')]({'plain':!![]});if(_0x3ad625){if(_0x591aeb['account'][_0x694b('0x4c')]){_0x591aeb['applications'][_0x694b('0x4d')]({'id':0x0,'priority':_0x591aeb['applications'][_0x694b('0x46')]+0x1,'app':_0x694b('0x4e'),'appdata':_0x694b('0x4f'),'interval':_0x694b('0x50')});}_0x46c19b[_0x694b('0x51')]=!![];}else{_0x46c19b[_0x694b('0x51')]=![];}_0x591aeb[_0x694b('0x52')]=_0x46c19b;return db[_0x694b('0x53')][_0x694b('0x47')]({'body':_0x319c46['body'][_0x694b('0x26')],'FaxAccountId':_0x319c46[_0x694b('0x3a')]['id'],'FaxInteractionId':_0x12c8c8['id'],'direction':'in','ContactId':_0x12c8c8['ContactId'],'AttachmentId':_0x319c46[_0x694b('0x26')][_0x694b('0x54')]});})[_0x694b('0x10')](function(_0x176033){_0x591aeb[_0x694b('0x19')]=_0x176033;if(!_0x591aeb[_0x694b('0x52')][_0x694b('0x55')])return;return db[_0x694b('0x56')][_0x694b('0x39')]({'attributes':['id',_0x694b('0x57')],'where':{'id':_0x591aeb['interaction']['UserId']}});})[_0x694b('0x10')](function(_0x256176){if(_0x256176){_0x591aeb[_0x694b('0x42')][_0x694b('0x58')]({'id':0x0,'priority':0x0,'app':_0x694b('0x59'),'appdata':_0x256176[_0x694b('0x57')]+','+(_0x591aeb[_0x694b('0x3a')][_0x694b('0x5a')]||0xa),'interval':_0x694b('0x50')});}if(!_0x591aeb[_0x694b('0x52')]['queueId'])return;return db[_0x694b('0x5b')][_0x694b('0x39')]({'attributes':['id','name'],'where':{'id':_0x591aeb[_0x694b('0x52')][_0x694b('0x5c')]}});})[_0x694b('0x10')](function(_0x2066c9){if(_0x2066c9){_0x591aeb[_0x694b('0x42')]['unshift']({'id':0x0,'priority':0x1,'app':_0x694b('0x5d'),'appdata':_0x2066c9['name']+','+(_0x591aeb['account'][_0x694b('0x5e')]||0x12c),'interval':_0x694b('0x50')});}return respondWithRpcPromise(_0x694b('0x5f'),_0x694b('0x60'),_0x591aeb);})[_0x694b('0x10')](function(_0x5f2f33){_0x1bbc97(_0x5f2f33);})[_0x694b('0x61')](function(_0x1f9beb){_0x57518d(_0x52d450['error'](0x1f4,_0x1f9beb['message']));});});}; \ No newline at end of file +var _0xaecc=['difference','keys','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body','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','FaxAccount','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','list','orderBy','applications','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','unmanaged','created','FaxMessage','ContactId','UserId','User','interaction','agent','waitForTheAssignedAgent','*,*,*,*','FaxQueue','name','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact'];(function(_0x5c524b,_0x551920){var _0x1bfcd4=function(_0x294df8){while(--_0x294df8){_0x5c524b['push'](_0x5c524b['shift']());}};_0x1bfcd4(++_0x551920);}(_0xaecc,0x154));var _0xcaec=function(_0x5abdb1,_0x53a9d8){_0x5abdb1=_0x5abdb1-0x0;var _0x353b1b=_0xaecc[_0x5abdb1];return _0x353b1b;};'use strict';var _=require('lodash');var util=require(_0xcaec('0x0'));var moment=require(_0xcaec('0x1'));var BPromise=require('bluebird');var rs=require(_0xcaec('0x2'));var fs=require('fs');var Redis=require(_0xcaec('0x3'));var db=require(_0xcaec('0x4'))['db'];var utils=require(_0xcaec('0x5'));var logger=require(_0xcaec('0x6'))(_0xcaec('0x7'));var config=require(_0xcaec('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcaec('0x9')]({'port':0x232c});config[_0xcaec('0xa')]=_['defaults'](config[_0xcaec('0xa')],{'host':_0xcaec('0xb'),'port':0x18eb});var socket=require(_0xcaec('0xc'))(new Redis(config[_0xcaec('0xa')]));require(_0xcaec('0xd'))[_0xcaec('0xe')](socket);function respondWithRpcPromise(_0x1016a6,_0x1735ee,_0x3304ba){return new BPromise(function(_0x3ebc49,_0x5867f1){return client[_0xcaec('0xf')](_0x1016a6,_0x3304ba)[_0xcaec('0x10')](function(_0x314678){logger[_0xcaec('0x11')](_0xcaec('0x12'),_0x1735ee,_0xcaec('0x13'));logger[_0xcaec('0x14')](_0xcaec('0x15'),_0x1735ee,_0xcaec('0x13'),JSON[_0xcaec('0x16')](_0x314678));if(_0x314678[_0xcaec('0x17')]){if(_0x314678[_0xcaec('0x17')][_0xcaec('0x18')]===0x1f4){logger[_0xcaec('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1735ee,_0x314678[_0xcaec('0x17')][_0xcaec('0x19')]);return _0x5867f1(_0x314678[_0xcaec('0x17')][_0xcaec('0x19')]);}logger[_0xcaec('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1735ee,_0x314678[_0xcaec('0x17')][_0xcaec('0x19')]);return _0x3ebc49(_0x314678[_0xcaec('0x17')][_0xcaec('0x19')]);}else{logger[_0xcaec('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1735ee,_0xcaec('0x13'));_0x3ebc49(_0x314678['result'][_0xcaec('0x19')]);}})[_0xcaec('0x1a')](function(_0x5c5e29){logger[_0xcaec('0x17')](_0xcaec('0x12'),_0x1735ee,_0x5c5e29);_0x5867f1(_0x5c5e29);});});}exports[_0xcaec('0x1b')]=function(_0x4b3ee2){var _0x325794=this;return new Promise(function(_0xd617fb,_0x55bf19){return db['FaxAccount'][_0xcaec('0x1c')]({'raw':_0x4b3ee2[_0xcaec('0x1d')]?_0x4b3ee2[_0xcaec('0x1d')][_0xcaec('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b3ee2['options']?_0x4b3ee2[_0xcaec('0x1d')][_0xcaec('0x1f')]||null:null,'attributes':_0x4b3ee2['options']?_0x4b3ee2[_0xcaec('0x1d')][_0xcaec('0x20')]||null:null,'limit':_0x4b3ee2['options']?_0x4b3ee2[_0xcaec('0x1d')][_0xcaec('0x21')]||null:null,'include':_0x4b3ee2[_0xcaec('0x1d')]?_0x4b3ee2['options'][_0xcaec('0x22')]?_[_0xcaec('0x23')](_0x4b3ee2[_0xcaec('0x1d')]['include'],function(_0x1b167d){return{'model':db[_0x1b167d[_0xcaec('0x24')]],'as':_0x1b167d['as'],'attributes':_0x1b167d[_0xcaec('0x20')],'include':_0x1b167d[_0xcaec('0x22')]?_[_0xcaec('0x23')](_0x1b167d[_0xcaec('0x22')],function(_0x30e3a2){return{'model':db[_0x30e3a2[_0xcaec('0x24')]],'as':_0x30e3a2['as'],'attributes':_0x30e3a2[_0xcaec('0x20')],'include':_0x30e3a2['include']?_[_0xcaec('0x23')](_0x30e3a2[_0xcaec('0x22')],function(_0x127c91){return{'model':db[_0x127c91[_0xcaec('0x24')]],'as':_0x127c91['as'],'attributes':_0x127c91[_0xcaec('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcaec('0x10')](function(_0x521100){logger[_0xcaec('0x11')](_0xcaec('0x1b'),_0x4b3ee2);logger[_0xcaec('0x14')](_0xcaec('0x1b'),_0x4b3ee2,JSON['stringify'](_0x521100));_0xd617fb(_0x521100);})[_0xcaec('0x1a')](function(_0x4c3174){logger[_0xcaec('0x17')](_0xcaec('0x1b'),_0x4c3174[_0xcaec('0x19')],_0x4b3ee2);_0x55bf19(_0x325794[_0xcaec('0x17')](0x1f4,_0x4c3174[_0xcaec('0x19')]));});});};exports[_0xcaec('0x25')]=function(_0x5509cf,_0x14c2fe,_0x221ee3){var _0x230958=this;return new Promise(function(_0x3d284f,_0x3d2978){var _0x211246={'body':_0x5509cf['body'],'channel':_0xcaec('0x26')};var _0x17146b=[];var _0x2b99d3=[];var _0x14b1bb={};return db[_0xcaec('0x27')]['describe']()['then'](function(_0x17b921){if(!_0x17b921){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x17146b=_[_0xcaec('0x28')](_[_0xcaec('0x29')](_0x17b921),[_0xcaec('0x2a'),_0xcaec('0x2b')]);_0x2b99d3=_[_0xcaec('0x28')](_['keys'](_0x17b921),[_0xcaec('0x2a'),'updatedAt',_0xcaec('0x2c'),'ListId']);if(_0x5509cf['body']['id']){delete _0x5509cf['body']['id'];}if(_[_0xcaec('0x2d')](_0x5509cf['body'][_0xcaec('0x2e')])){throw new db[(_0xcaec('0x2f'))][(_0xcaec('0x30'))](_0xcaec('0x31'));}if(_['isNil'](_0x5509cf['body'][_0xcaec('0x32')])||_0x5509cf[_0xcaec('0x32')][_0xcaec('0x32')]===''){throw new db[(_0xcaec('0x2f'))][(_0xcaec('0x30'))](_0xcaec('0x33'));}if(_['isNil'](_0x5509cf[_0xcaec('0x32')][_0xcaec('0x34')])){throw new db['Sequelize'][(_0xcaec('0x30'))](_0xcaec('0x35')+_0x2b99d3);}if(!_[_0xcaec('0x36')](_0x2b99d3,_0x5509cf[_0xcaec('0x32')][_0xcaec('0x34')])){throw new db['Sequelize'][(_0xcaec('0x30'))](_0xcaec('0x37')+_0x2b99d3);}_0x14b1bb[_0x5509cf[_0xcaec('0x32')]['mapKey']]=_0x5509cf[_0xcaec('0x32')][_0xcaec('0x2e')];})[_0xcaec('0x10')](function(){return db[_0xcaec('0x38')][_0xcaec('0x39')]({'where':{'id':_0x5509cf['account']['id']},'include':[{'model':db[_0xcaec('0x3a')],'as':_0xcaec('0x3b'),'include':[{'model':db['CmContact'],'as':_0xcaec('0x3c'),'where':_0x14b1bb,'limit':0x1,'order':[[_0xcaec('0x2b'),_0xcaec('0x3d')]]}]},{'model':db[_0xcaec('0x3e')],'as':_0xcaec('0x3f')}]});})[_0xcaec('0x10')](function(_0x2e6e5b){if(_0x2e6e5b&&_0x2e6e5b[_0xcaec('0x3b')]){var _0x8a6529=_0x2e6e5b[_0xcaec('0x40')]({'plain':!![]});_0x211246[_0xcaec('0x41')]=_0x8a6529;_0x211246['applications']=_0x8a6529[_0xcaec('0x3f')];_0x211246[_0xcaec('0x42')]=_0x8a6529[_0xcaec('0x3b')];_0x211246['applications']=_[_0xcaec('0x43')](_0x211246[_0xcaec('0x44')],['priority'],[_0xcaec('0x45')]);if(_0x211246[_0xcaec('0x41')][_0xcaec('0x3f')]){delete _0x211246['account'][_0xcaec('0x3f')];}if(_0x211246[_0xcaec('0x41')][_0xcaec('0x3b')]&&_0x211246['account'][_0xcaec('0x3b')][_0xcaec('0x3c')][_0xcaec('0x46')]){return _0x211246[_0xcaec('0x41')]['List'][_0xcaec('0x3c')][0x0];}var _0x4dba0f=_['defaults'](_0x5509cf[_0xcaec('0x32')],{'firstName':_0x5509cf['body'][_0xcaec('0x2e')],'ListId':_0x8a6529[_0xcaec('0x47')]});_0x4dba0f[_0x5509cf[_0xcaec('0x32')][_0xcaec('0x34')]]=_0x5509cf[_0xcaec('0x32')][_0xcaec('0x2e')];return db[_0xcaec('0x27')][_0xcaec('0x48')](_0x4dba0f,{'fields':_0x17146b,'raw':!![]});}})[_0xcaec('0x10')](function(_0x3fa46f){_0x211246[_0xcaec('0x49')]=_0x3fa46f;if(_0x3fa46f){var _0x2fb1c0={'ContactId':_0x3fa46f['id'],'FaxAccountId':_0x5509cf[_0xcaec('0x41')]['id'],'fax':_0x3fa46f[_0xcaec('0x26')]};return db[_0xcaec('0x4a')][_0xcaec('0x39')]({'where':{'ContactId':_0x3fa46f['id'],'closed':![],'FaxAccountId':_0x5509cf[_0xcaec('0x41')]['id']}})[_0xcaec('0x10')](function(_0x461a3f){if(_0x461a3f){return[_0x461a3f,![]];}return db[_0xcaec('0x4a')][_0xcaec('0x48')](_0x2fb1c0)[_0xcaec('0x10')](function(_0x3aedd5){return[_0x3aedd5,!![]];});});}else{throw new Error(_0xcaec('0x4b'));}})['spread'](function(_0x20cba4,_0x4e6299){var _0x2385a5=_0x20cba4[_0xcaec('0x40')]({'plain':!![]});if(_0x4e6299){if(_0x211246[_0xcaec('0x41')][_0xcaec('0x4c')]){_0x211246[_0xcaec('0x44')]['push']({'id':0x0,'priority':_0x211246['applications'][_0xcaec('0x46')]+0x1,'app':'close','appdata':_0xcaec('0x4d'),'interval':'*,*,*,*'});}_0x2385a5[_0xcaec('0x4e')]=!![];}else{_0x2385a5[_0xcaec('0x4e')]=![];}_0x211246['interaction']=_0x2385a5;return db[_0xcaec('0x4f')][_0xcaec('0x48')]({'body':_0x5509cf['body']['body'],'FaxAccountId':_0x5509cf['account']['id'],'FaxInteractionId':_0x20cba4['id'],'direction':'in','ContactId':_0x20cba4[_0xcaec('0x50')],'AttachmentId':_0x5509cf[_0xcaec('0x32')]['AttachmentId']});})['then'](function(_0x903805){_0x211246['message']=_0x903805;if(!_0x211246['interaction'][_0xcaec('0x51')])return;return db[_0xcaec('0x52')][_0xcaec('0x39')]({'attributes':['id','name'],'where':{'id':_0x211246[_0xcaec('0x53')][_0xcaec('0x51')]}});})['then'](function(_0x480a0d){if(_0x480a0d){_0x211246[_0xcaec('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcaec('0x54'),'appdata':_0x480a0d['name']+','+(_0x211246[_0xcaec('0x41')][_0xcaec('0x55')]||0xa),'interval':_0xcaec('0x56')});}if(!_0x211246['interaction']['queueId'])return;return db[_0xcaec('0x57')][_0xcaec('0x39')]({'attributes':['id',_0xcaec('0x58')],'where':{'id':_0x211246[_0xcaec('0x53')][_0xcaec('0x59')]}});})['then'](function(_0x408405){if(_0x408405){_0x211246[_0xcaec('0x44')][_0xcaec('0x5a')]({'id':0x0,'priority':0x1,'app':_0xcaec('0x5b'),'appdata':_0x408405['name']+','+(_0x211246[_0xcaec('0x41')][_0xcaec('0x5c')]||0x12c),'interval':_0xcaec('0x56')});}return respondWithRpcPromise(_0xcaec('0x5d'),_0xcaec('0x5e'),_0x211246);})['then'](function(_0x5e3de4){_0x3d284f(_0x5e3de4);})['catch'](function(_0x5ab508){_0x3d2978(_0x230958[_0xcaec('0x17')](0x1f4,_0x5ab508[_0xcaec('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9a32230..41b2c83 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 _0x6510=['faxAccount:','./faxAccount.events','save','remove','update','emit','register','length'];(function(_0x57a53b,_0x11494e){var _0x29e81c=function(_0x24c522){while(--_0x24c522){_0x57a53b['push'](_0x57a53b['shift']());}};_0x29e81c(++_0x11494e);}(_0x6510,0xa1));var _0x0651=function(_0x5828fa,_0x1be8e9){_0x5828fa=_0x5828fa-0x0;var _0x28506d=_0x6510[_0x5828fa];return _0x28506d;};'use strict';var FaxAccountEvents=require(_0x0651('0x0'));var events=[_0x0651('0x1'),_0x0651('0x2'),_0x0651('0x3')];function createListener(_0x3a83c0,_0x27ac24){return function(_0x4843f8){_0x27ac24[_0x0651('0x4')](_0x3a83c0,_0x4843f8);};}function removeListener(_0x40976b,_0x4c1fb5){return function(){FaxAccountEvents['removeListener'](_0x40976b,_0x4c1fb5);};}exports[_0x0651('0x5')]=function(_0x724729){for(var _0x452837=0x0,_0x379ae1=events[_0x0651('0x6')];_0x452837<_0x379ae1;_0x452837++){var _0x31978b=events[_0x452837];var _0x34aab1=createListener(_0x0651('0x7')+_0x31978b,_0x724729);FaxAccountEvents['on'](_0x31978b,_0x34aab1);}}; \ No newline at end of file +var _0xcba2=['register','length','save','remove','update','removeListener'];(function(_0x26a9a0,_0x45ccbd){var _0x128bf5=function(_0x1c500a){while(--_0x1c500a){_0x26a9a0['push'](_0x26a9a0['shift']());}};_0x128bf5(++_0x45ccbd);}(_0xcba2,0x1e2));var _0x2cba=function(_0x10377e,_0x37dce5){_0x10377e=_0x10377e-0x0;var _0x4b59e1=_0xcba2[_0x10377e];return _0x4b59e1;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x2cba('0x0'),_0x2cba('0x1'),_0x2cba('0x2')];function createListener(_0x4b3659,_0x1d6961){return function(_0x458f2a){_0x1d6961['emit'](_0x4b3659,_0x458f2a);};}function removeListener(_0x523025,_0x16d238){return function(){FaxAccountEvents[_0x2cba('0x3')](_0x523025,_0x16d238);};}exports[_0x2cba('0x4')]=function(_0x931425){for(var _0x1e0afd=0x0,_0x4e143d=events[_0x2cba('0x5')];_0x1e0afd<_0x4e143d;_0x1e0afd++){var _0x2136d9=events[_0x1e0afd];var _0x2b3820=createListener('faxAccount:'+_0x2136d9,_0x931425);FaxAccountEvents['on'](_0x2136d9,_0x2b3820);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6ea87e3..0d29fa2 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 _0x15cc=['updateAccountApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications'];(function(_0x286300,_0x13a093){var _0x50cca2=function(_0x382ac0){while(--_0x382ac0){_0x286300['push'](_0x286300['shift']());}};_0x50cca2(++_0x13a093);}(_0x15cc,0x77));var _0xc15c=function(_0x394739,_0x19ce1e){_0x394739=_0x394739-0x0;var _0x48d11e=_0x15cc[_0x394739];return _0x48d11e;};'use strict';var multer=require(_0xc15c('0x0'));var util=require(_0xc15c('0x1'));var path=require(_0xc15c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc15c('0x3')]();var fs_extra=require(_0xc15c('0x4'));var auth=require(_0xc15c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc15c('0x6'));var controller=require(_0xc15c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc15c('0x8')](_0xc15c('0x9'),auth[_0xc15c('0xa')](),controller['describe']);router[_0xc15c('0x8')](_0xc15c('0xb'),auth['isAuthenticated'](),controller[_0xc15c('0xc')]);router['get'](_0xc15c('0xd'),auth[_0xc15c('0xa')](),controller['getDispositions']);router['get'](_0xc15c('0xe'),auth[_0xc15c('0xa')](),controller['getAnswers']);router[_0xc15c('0x8')](_0xc15c('0xf'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x10')]);router['get'](_0xc15c('0x11'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x12')]);router[_0xc15c('0x8')]('/:id/messages',auth[_0xc15c('0xa')](),controller[_0xc15c('0x13')]);router[_0xc15c('0x8')](_0xc15c('0x14'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x15')]);router[_0xc15c('0x16')]('/',auth[_0xc15c('0xa')](),controller[_0xc15c('0x17')]);router['post'](_0xc15c('0xd'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x18')]);router[_0xc15c('0x16')](_0xc15c('0xe'),auth[_0xc15c('0xa')](),controller['addAnswer']);router['post'](_0xc15c('0xf'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x19')]);router['post'](_0xc15c('0x11'),auth[_0xc15c('0xa')](),controller['addApplications']);router[_0xc15c('0x16')](_0xc15c('0x1a'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x1b')]);router[_0xc15c('0x16')](_0xc15c('0x1c'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x1d')]);router[_0xc15c('0x16')](_0xc15c('0x1e'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x1f')]);router[_0xc15c('0x16')](_0xc15c('0x14'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x20')]);router[_0xc15c('0x21')](_0xc15c('0xb'),auth[_0xc15c('0xa')](),controller[_0xc15c('0x22')]);router[_0xc15c('0x23')]('/:id',auth[_0xc15c('0xa')](),controller['destroy']);router[_0xc15c('0x23')](_0xc15c('0xd'),auth[_0xc15c('0xa')](),controller['removeDispositions']);router[_0xc15c('0x23')](_0xc15c('0xe'),auth['isAuthenticated'](),controller[_0xc15c('0x24')]);router['delete'](_0xc15c('0x14'),auth[_0xc15c('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x69d1=['post','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/users','getAgents'];(function(_0x5c161,_0x12144c){var _0x1d961f=function(_0x207cbb){while(--_0x207cbb){_0x5c161['push'](_0x5c161['shift']());}};_0x1d961f(++_0x12144c);}(_0x69d1,0x170));var _0x169d=function(_0x59c5b7,_0x4fb175){_0x59c5b7=_0x59c5b7-0x0;var _0x1a79ff=_0x69d1[_0x59c5b7];return _0x1a79ff;};'use strict';var multer=require(_0x169d('0x0'));var util=require(_0x169d('0x1'));var path=require(_0x169d('0x2'));var timeout=require(_0x169d('0x3'));var express=require(_0x169d('0x4'));var router=express[_0x169d('0x5')]();var fs_extra=require(_0x169d('0x6'));var auth=require(_0x169d('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x169d('0x8'));router[_0x169d('0x9')]('/',auth[_0x169d('0xa')](),controller[_0x169d('0xb')]);router[_0x169d('0x9')](_0x169d('0xc'),auth[_0x169d('0xa')](),controller[_0x169d('0xd')]);router['get'](_0x169d('0xe'),auth[_0x169d('0xa')](),controller[_0x169d('0xf')]);router[_0x169d('0x9')](_0x169d('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x169d('0x9')](_0x169d('0x11'),auth[_0x169d('0xa')](),controller[_0x169d('0x12')]);router['get'](_0x169d('0x13'),auth[_0x169d('0xa')](),controller['getInteractions']);router['get']('/:id/applications',auth[_0x169d('0xa')](),controller['getApplications']);router['get']('/:id/messages',auth[_0x169d('0xa')](),controller['getMessages']);router[_0x169d('0x9')](_0x169d('0x14'),auth[_0x169d('0xa')](),controller[_0x169d('0x15')]);router[_0x169d('0x16')]('/',auth[_0x169d('0xa')](),controller['create']);router[_0x169d('0x16')](_0x169d('0x10'),auth[_0x169d('0xa')](),controller[_0x169d('0x17')]);router['post'](_0x169d('0x11'),auth[_0x169d('0xa')](),controller[_0x169d('0x18')]);router['post']('/:id/interactions',auth[_0x169d('0xa')](),controller[_0x169d('0x19')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x169d('0x1a')]);router[_0x169d('0x16')]('/addaccountapplications',auth[_0x169d('0xa')](),controller[_0x169d('0x1b')]);router['post'](_0x169d('0x1c'),auth[_0x169d('0xa')](),controller[_0x169d('0x1d')]);router['post'](_0x169d('0x1e'),auth[_0x169d('0xa')](),controller['send']);router[_0x169d('0x16')](_0x169d('0x14'),auth[_0x169d('0xa')](),controller[_0x169d('0x1f')]);router[_0x169d('0x20')](_0x169d('0xe'),auth['isAuthenticated'](),controller[_0x169d('0x21')]);router[_0x169d('0x22')]('/:id',auth[_0x169d('0xa')](),controller[_0x169d('0x23')]);router[_0x169d('0x22')]('/:id/dispositions',auth[_0x169d('0xa')](),controller[_0x169d('0x24')]);router['delete'](_0x169d('0x11'),auth[_0x169d('0xa')](),controller[_0x169d('0x25')]);router[_0x169d('0x22')](_0x169d('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x169d('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 826e3fd..6f2412a 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 _0xe9ec=['STRING','sequelize','INTEGER'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0xe9ec,0xca));var _0xce9e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe9ec[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xce9e('0x0'));module['exports']={'priority':{'type':Sequelize[_0xce9e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xce9e('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xce9e('0x2')]},'interval':{'type':Sequelize[_0xce9e('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xacb5=['sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x38d887,_0x261d68){var _0x84c717=function(_0x4c5a40){while(--_0x4c5a40){_0x38d887['push'](_0x38d887['shift']());}};_0x84c717(++_0x261d68);}(_0xacb5,0x1d1));var _0x5acb=function(_0x1deba7,_0x30f270){_0x1deba7=_0x1deba7-0x0;var _0x2dcc31=_0xacb5[_0x1deba7];return _0x2dcc31;};'use strict';var Sequelize=require(_0x5acb('0x0'));module[_0x5acb('0x1')]={'priority':{'type':Sequelize[_0x5acb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5acb('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5acb('0x4')]()},'description':{'type':Sequelize[_0x5acb('0x3')]},'interval':{'type':Sequelize[_0x5acb('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 9ad4aa2..c3de35a 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 _0xba9c=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','merge','where','type','VIRTUAL','filter','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto'];(function(_0x2ea4f0,_0x420118){var _0x5c5877=function(_0x16f450){while(--_0x16f450){_0x2ea4f0['push'](_0x2ea4f0['shift']());}};_0x5c5877(++_0x420118);}(_0xba9c,0x1a5));var _0xcba9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba9c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcba9('0x0'));var rimraf=require(_0xcba9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcba9('0x2'));var moment=require('moment');var BPromise=require(_0xcba9('0x3'));var Mustache=require(_0xcba9('0x4'));var util=require(_0xcba9('0x5'));var path=require('path');var sox=require(_0xcba9('0x6'));var csv=require(_0xcba9('0x7'));var ejs=require(_0xcba9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcba9('0x9'));var squel=require('squel');var crypto=require(_0xcba9('0xa'));var jsforce=require(_0xcba9('0xb'));var deskjs=require(_0xcba9('0xc'));var toCsv=require(_0xcba9('0x7'));var querystring=require(_0xcba9('0xd'));var Papa=require(_0xcba9('0xe'));var Redis=require(_0xcba9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcba9('0x10'));var as=require(_0xcba9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcba9('0x12'))(_0xcba9('0x13'));var utils=require(_0xcba9('0x14'));var config=require(_0xcba9('0x15'));var licenseUtil=require(_0xcba9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x184168,_0x5e7531){_0x5e7531=_0x5e7531||0xcc;return function(_0x2e84d5){if(_0x2e84d5){return _0x184168[_0xcba9('0x17')](_0x5e7531);}return _0x184168[_0xcba9('0x18')](_0x5e7531)[_0xcba9('0x19')]();};}function respondWithResult(_0xc06d50,_0x5d2689){_0x5d2689=_0x5d2689||0xc8;return function(_0x32645a){if(_0x32645a){return _0xc06d50[_0xcba9('0x18')](_0x5d2689)[_0xcba9('0x1a')](_0x32645a);}};}function respondWithFilteredResult(_0xf57af7,_0x1e6143){return function(_0x32b273){if(_0x32b273){var _0x39ba0c=typeof _0x1e6143['offset']==='undefined'&&typeof _0x1e6143[_0xcba9('0x1b')]==='undefined';var _0x5a9c0b=_0x32b273['count'];var _0x54b31d=_0x39ba0c?0x0:_0x1e6143[_0xcba9('0x1c')];var _0x219855=_0x39ba0c?_0x32b273[_0xcba9('0x1d')]:_0x1e6143[_0xcba9('0x1c')]+_0x1e6143[_0xcba9('0x1b')];var _0x3da83c;if(_0x219855>=_0x5a9c0b){_0x219855=_0x5a9c0b;_0x3da83c=0xc8;}else{_0x3da83c=0xce;}_0xf57af7[_0xcba9('0x18')](_0x3da83c);return _0xf57af7[_0xcba9('0x1e')](_0xcba9('0x1f'),_0x54b31d+'-'+_0x219855+'/'+_0x5a9c0b)[_0xcba9('0x1a')](_0x32b273);}return null;};}function patchUpdates(_0x4f029a){return function(_0x5b03ff){try{jsonpatch[_0xcba9('0x20')](_0x5b03ff,_0x4f029a,!![]);}catch(_0x261e3b){return BPromise[_0xcba9('0x21')](_0x261e3b);}return _0x5b03ff['save']();};}function saveUpdates(_0x36541a,_0x33bfbe){return function(_0x4c2a01){if(_0x4c2a01){return _0x4c2a01[_0xcba9('0x22')](_0x36541a)[_0xcba9('0x23')](function(_0x286280){return _0x286280;});}return null;};}function removeEntity(_0x177913,_0x59f74d){return function(_0x27473a){if(_0x27473a){return _0x27473a['destroy']()[_0xcba9('0x23')](function(){_0x177913['status'](0xcc)[_0xcba9('0x19')]();});}};}function handleEntityNotFound(_0x4181a2,_0x4ac4b3){return function(_0x28c43a){if(!_0x28c43a){_0x4181a2[_0xcba9('0x17')](0x194);}return _0x28c43a;};}function handleError(_0x1489a2,_0x340f2a){_0x340f2a=_0x340f2a||0x1f4;return function(_0x4d96da){logger[_0xcba9('0x24')](_0x4d96da[_0xcba9('0x25')]);if(_0x4d96da[_0xcba9('0x26')]){delete _0x4d96da['name'];}_0x1489a2[_0xcba9('0x18')](_0x340f2a)[_0xcba9('0x27')](_0x4d96da);};}exports[_0xcba9('0x28')]=function(_0x1c3e02,_0x1822c9){var _0x5ef3ff={},_0x531f1b={},_0x12e36a={'count':0x0,'rows':[]};var _0x2774a1=_[_0xcba9('0x29')](db['FaxApplication']['rawAttributes'],function(_0x1708cf){return{'name':_0x1708cf[_0xcba9('0x2a')],'type':_0x1708cf['type']['key']};});_0x531f1b[_0xcba9('0x2b')]=_[_0xcba9('0x29')](_0x2774a1,'name');_0x531f1b['query']=_[_0xcba9('0x2c')](_0x1c3e02[_0xcba9('0x2d')]);_0x531f1b[_0xcba9('0x2e')]=_[_0xcba9('0x2f')](_0x531f1b['model'],_0x531f1b[_0xcba9('0x2d')]);_0x5ef3ff[_0xcba9('0x30')]=_[_0xcba9('0x2f')](_0x531f1b[_0xcba9('0x2b')],qs[_0xcba9('0x31')](_0x1c3e02[_0xcba9('0x2d')]['fields']));_0x5ef3ff['attributes']=_0x5ef3ff[_0xcba9('0x30')][_0xcba9('0x32')]?_0x5ef3ff[_0xcba9('0x30')]:_0x531f1b[_0xcba9('0x2b')];if(!_0x1c3e02['query']['hasOwnProperty'](_0xcba9('0x33'))){_0x5ef3ff['limit']=qs['limit'](_0x1c3e02['query'][_0xcba9('0x1b')]);_0x5ef3ff['offset']=qs[_0xcba9('0x1c')](_0x1c3e02['query'][_0xcba9('0x1c')]);}_0x5ef3ff['order']=qs['sort'](_0x1c3e02[_0xcba9('0x2d')][_0xcba9('0x34')]);_0x5ef3ff['where']=qs[_0xcba9('0x2e')](_[_0xcba9('0x35')](_0x1c3e02[_0xcba9('0x2d')],_0x531f1b['filters']),_0x2774a1);if(_0x1c3e02['query']['filter']){_0x5ef3ff['where']=_[_0xcba9('0x36')](_0x5ef3ff[_0xcba9('0x37')],{'$or':_[_0xcba9('0x29')](_0x2774a1,function(_0x1c604c){if(_0x1c604c[_0xcba9('0x38')]!==_0xcba9('0x39')){var _0x57c484={};_0x57c484[_0x1c604c[_0xcba9('0x26')]]={'$like':'%'+_0x1c3e02[_0xcba9('0x2d')][_0xcba9('0x3a')]+'%'};return _0x57c484;}})});}_0x5ef3ff=_['merge']({},_0x5ef3ff,_0x1c3e02[_0xcba9('0x3b')]);var _0x38ad17={'where':_0x5ef3ff['where']};return db[_0xcba9('0x3c')]['count'](_0x38ad17)[_0xcba9('0x23')](function(_0x15f0a2){_0x12e36a[_0xcba9('0x1d')]=_0x15f0a2;if(_0x1c3e02[_0xcba9('0x2d')][_0xcba9('0x3d')]){_0x5ef3ff[_0xcba9('0x3e')]=[{'all':!![]}];}return db[_0xcba9('0x3c')][_0xcba9('0x3f')](_0x5ef3ff);})['then'](function(_0x460bdd){_0x12e36a[_0xcba9('0x40')]=_0x460bdd;return _0x12e36a;})[_0xcba9('0x23')](respondWithFilteredResult(_0x1822c9,_0x5ef3ff))[_0xcba9('0x41')](handleError(_0x1822c9,null));};exports[_0xcba9('0x42')]=function(_0x54056d,_0x43da3a){var _0x383df6={'raw':!![],'where':{'id':_0x54056d[_0xcba9('0x43')]['id']}},_0x3c4ec0={};_0x3c4ec0[_0xcba9('0x2b')]=_[_0xcba9('0x2c')](db[_0xcba9('0x3c')]['rawAttributes']);_0x3c4ec0[_0xcba9('0x2d')]=_['keys'](_0x54056d[_0xcba9('0x2d')]);_0x3c4ec0['filters']=_[_0xcba9('0x2f')](_0x3c4ec0['model'],_0x3c4ec0[_0xcba9('0x2d')]);_0x383df6['attributes']=_['intersection'](_0x3c4ec0['model'],qs[_0xcba9('0x31')](_0x54056d[_0xcba9('0x2d')][_0xcba9('0x31')]));_0x383df6[_0xcba9('0x30')]=_0x383df6[_0xcba9('0x30')][_0xcba9('0x32')]?_0x383df6['attributes']:_0x3c4ec0['model'];if(_0x54056d[_0xcba9('0x2d')][_0xcba9('0x3d')]){_0x383df6[_0xcba9('0x3e')]=[{'all':!![]}];}_0x383df6=_['merge']({},_0x383df6,_0x54056d[_0xcba9('0x3b')]);return db['FaxApplication'][_0xcba9('0x44')](_0x383df6)[_0xcba9('0x23')](handleEntityNotFound(_0x43da3a,null))[_0xcba9('0x23')](respondWithResult(_0x43da3a,null))[_0xcba9('0x41')](handleError(_0x43da3a,null));};exports[_0xcba9('0x45')]=function(_0x478cb4,_0x474ce1){return db[_0xcba9('0x3c')]['create'](_0x478cb4['body'],{})[_0xcba9('0x23')](respondWithResult(_0x474ce1,0xc9))[_0xcba9('0x41')](handleError(_0x474ce1,null));};exports[_0xcba9('0x22')]=function(_0x13a83f,_0x9da7e4){if(_0x13a83f['body']['id']){delete _0x13a83f[_0xcba9('0x46')]['id'];}return db[_0xcba9('0x3c')]['find']({'where':{'id':_0x13a83f['params']['id']}})[_0xcba9('0x23')](handleEntityNotFound(_0x9da7e4,null))[_0xcba9('0x23')](saveUpdates(_0x13a83f[_0xcba9('0x46')],null))['then'](respondWithResult(_0x9da7e4,null))[_0xcba9('0x41')](handleError(_0x9da7e4,null));};exports[_0xcba9('0x47')]=function(_0x543fba,_0x371ef6){return db['FaxApplication'][_0xcba9('0x44')]({'where':{'id':_0x543fba[_0xcba9('0x43')]['id']}})[_0xcba9('0x23')](handleEntityNotFound(_0x371ef6,null))[_0xcba9('0x23')](removeEntity(_0x371ef6,null))['catch'](handleError(_0x371ef6,null));}; \ No newline at end of file +var _0xa3de=['name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','include','findAll','rows','catch','params','intersection','fields','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack'];(function(_0x33ee6a,_0x456591){var _0x1311df=function(_0x38f6fd){while(--_0x38f6fd){_0x33ee6a['push'](_0x33ee6a['shift']());}};_0x1311df(++_0x456591);}(_0xa3de,0x68));var _0xea3d=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0xa3de[_0x403115];return _0x596ef3;};'use strict';var emlformat=require(_0xea3d('0x0'));var rimraf=require(_0xea3d('0x1'));var zipdir=require(_0xea3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea3d('0x3'));var moment=require(_0xea3d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea3d('0x5'));var util=require('util');var path=require('path');var sox=require(_0xea3d('0x6'));var csv=require('to-csv');var ejs=require(_0xea3d('0x7'));var fs=require('fs');var fs_extra=require(_0xea3d('0x8'));var _=require(_0xea3d('0x9'));var squel=require(_0xea3d('0xa'));var crypto=require('crypto');var jsforce=require(_0xea3d('0xb'));var deskjs=require(_0xea3d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xea3d('0xd'));var Papa=require(_0xea3d('0xe'));var Redis=require(_0xea3d('0xf'));var authService=require(_0xea3d('0x10'));var qs=require(_0xea3d('0x11'));var as=require(_0xea3d('0x12'));var hardwareService=require(_0xea3d('0x13'));var logger=require(_0xea3d('0x14'))(_0xea3d('0x15'));var utils=require(_0xea3d('0x16'));var config=require(_0xea3d('0x17'));var licenseUtil=require(_0xea3d('0x18'));var db=require(_0xea3d('0x19'))['db'];function respondWithStatusCode(_0xd5e1d9,_0x2ddf19){_0x2ddf19=_0x2ddf19||0xcc;return function(_0x42b800){if(_0x42b800){return _0xd5e1d9[_0xea3d('0x1a')](_0x2ddf19);}return _0xd5e1d9[_0xea3d('0x1b')](_0x2ddf19)[_0xea3d('0x1c')]();};}function respondWithResult(_0x1ec1a4,_0x4bf6da){_0x4bf6da=_0x4bf6da||0xc8;return function(_0x12bce7){if(_0x12bce7){return _0x1ec1a4['status'](_0x4bf6da)[_0xea3d('0x1d')](_0x12bce7);}};}function respondWithFilteredResult(_0x726bb,_0x537909){return function(_0x4787e6){if(_0x4787e6){var _0x1d342c=typeof _0x537909[_0xea3d('0x1e')]===_0xea3d('0x1f')&&typeof _0x537909[_0xea3d('0x20')]==='undefined';var _0x4ded1a=_0x4787e6['count'];var _0x522569=_0x1d342c?0x0:_0x537909[_0xea3d('0x1e')];var _0x48eca0=_0x1d342c?_0x4787e6['count']:_0x537909[_0xea3d('0x1e')]+_0x537909[_0xea3d('0x20')];var _0x3b8486;if(_0x48eca0>=_0x4ded1a){_0x48eca0=_0x4ded1a;_0x3b8486=0xc8;}else{_0x3b8486=0xce;}_0x726bb['status'](_0x3b8486);return _0x726bb[_0xea3d('0x21')](_0xea3d('0x22'),_0x522569+'-'+_0x48eca0+'/'+_0x4ded1a)['json'](_0x4787e6);}return null;};}function patchUpdates(_0x6656b4){return function(_0x33de06){try{jsonpatch[_0xea3d('0x23')](_0x33de06,_0x6656b4,!![]);}catch(_0x48d0da){return BPromise[_0xea3d('0x24')](_0x48d0da);}return _0x33de06['save']();};}function saveUpdates(_0x3c8e82,_0x2d3381){return function(_0x27bacd){if(_0x27bacd){return _0x27bacd[_0xea3d('0x25')](_0x3c8e82)[_0xea3d('0x26')](function(_0x11bbc6){return _0x11bbc6;});}return null;};}function removeEntity(_0x11ecb9,_0x407925){return function(_0x2318ab){if(_0x2318ab){return _0x2318ab[_0xea3d('0x27')]()[_0xea3d('0x26')](function(){_0x11ecb9[_0xea3d('0x1b')](0xcc)[_0xea3d('0x1c')]();});}};}function handleEntityNotFound(_0x5635d3,_0x356407){return function(_0x42f1ac){if(!_0x42f1ac){_0x5635d3[_0xea3d('0x1a')](0x194);}return _0x42f1ac;};}function handleError(_0x1c1fbe,_0x3a15a2){_0x3a15a2=_0x3a15a2||0x1f4;return function(_0x563f77){logger[_0xea3d('0x28')](_0x563f77[_0xea3d('0x29')]);if(_0x563f77[_0xea3d('0x2a')]){delete _0x563f77[_0xea3d('0x2a')];}_0x1c1fbe['status'](_0x3a15a2)[_0xea3d('0x2b')](_0x563f77);};}exports['index']=function(_0x2a3fbd,_0x2af7d1){var _0x3f2d27={},_0x59c295={},_0x2e522a={'count':0x0,'rows':[]};var _0x14eaf5=_[_0xea3d('0x2c')](db[_0xea3d('0x2d')][_0xea3d('0x2e')],function(_0x1bd692){return{'name':_0x1bd692[_0xea3d('0x2f')],'type':_0x1bd692['type'][_0xea3d('0x30')]};});_0x59c295[_0xea3d('0x31')]=_[_0xea3d('0x2c')](_0x14eaf5,_0xea3d('0x2a'));_0x59c295[_0xea3d('0x32')]=_[_0xea3d('0x33')](_0x2a3fbd['query']);_0x59c295['filters']=_['intersection'](_0x59c295['model'],_0x59c295[_0xea3d('0x32')]);_0x3f2d27[_0xea3d('0x34')]=_['intersection'](_0x59c295[_0xea3d('0x31')],qs['fields'](_0x2a3fbd[_0xea3d('0x32')]['fields']));_0x3f2d27[_0xea3d('0x34')]=_0x3f2d27['attributes'][_0xea3d('0x35')]?_0x3f2d27[_0xea3d('0x34')]:_0x59c295[_0xea3d('0x31')];if(!_0x2a3fbd[_0xea3d('0x32')][_0xea3d('0x36')](_0xea3d('0x37'))){_0x3f2d27[_0xea3d('0x20')]=qs['limit'](_0x2a3fbd[_0xea3d('0x32')][_0xea3d('0x20')]);_0x3f2d27['offset']=qs['offset'](_0x2a3fbd[_0xea3d('0x32')]['offset']);}_0x3f2d27['order']=qs[_0xea3d('0x38')](_0x2a3fbd['query'][_0xea3d('0x38')]);_0x3f2d27['where']=qs[_0xea3d('0x39')](_['pick'](_0x2a3fbd['query'],_0x59c295[_0xea3d('0x39')]),_0x14eaf5);if(_0x2a3fbd[_0xea3d('0x32')][_0xea3d('0x3a')]){_0x3f2d27[_0xea3d('0x3b')]=_[_0xea3d('0x3c')](_0x3f2d27[_0xea3d('0x3b')],{'$or':_[_0xea3d('0x2c')](_0x14eaf5,function(_0x48ffb7){if(_0x48ffb7['type']!==_0xea3d('0x3d')){var _0x43b80a={};_0x43b80a[_0x48ffb7['name']]={'$like':'%'+_0x2a3fbd['query'][_0xea3d('0x3a')]+'%'};return _0x43b80a;}})});}_0x3f2d27=_[_0xea3d('0x3c')]({},_0x3f2d27,_0x2a3fbd['options']);var _0x39cf67={'where':_0x3f2d27[_0xea3d('0x3b')]};return db[_0xea3d('0x2d')]['count'](_0x39cf67)[_0xea3d('0x26')](function(_0x533407){_0x2e522a['count']=_0x533407;if(_0x2a3fbd[_0xea3d('0x32')]['includeAll']){_0x3f2d27[_0xea3d('0x3e')]=[{'all':!![]}];}return db[_0xea3d('0x2d')][_0xea3d('0x3f')](_0x3f2d27);})['then'](function(_0x1b310b){_0x2e522a[_0xea3d('0x40')]=_0x1b310b;return _0x2e522a;})['then'](respondWithFilteredResult(_0x2af7d1,_0x3f2d27))[_0xea3d('0x41')](handleError(_0x2af7d1,null));};exports['show']=function(_0x39e1ae,_0x233918){var _0x491c72={'raw':!![],'where':{'id':_0x39e1ae[_0xea3d('0x42')]['id']}},_0x4c0f63={};_0x4c0f63[_0xea3d('0x31')]=_[_0xea3d('0x33')](db['FaxApplication']['rawAttributes']);_0x4c0f63[_0xea3d('0x32')]=_['keys'](_0x39e1ae[_0xea3d('0x32')]);_0x4c0f63[_0xea3d('0x39')]=_[_0xea3d('0x43')](_0x4c0f63['model'],_0x4c0f63[_0xea3d('0x32')]);_0x491c72[_0xea3d('0x34')]=_[_0xea3d('0x43')](_0x4c0f63[_0xea3d('0x31')],qs[_0xea3d('0x44')](_0x39e1ae[_0xea3d('0x32')][_0xea3d('0x44')]));_0x491c72[_0xea3d('0x34')]=_0x491c72[_0xea3d('0x34')][_0xea3d('0x35')]?_0x491c72['attributes']:_0x4c0f63['model'];if(_0x39e1ae[_0xea3d('0x32')]['includeAll']){_0x491c72[_0xea3d('0x3e')]=[{'all':!![]}];}_0x491c72=_[_0xea3d('0x3c')]({},_0x491c72,_0x39e1ae[_0xea3d('0x45')]);return db['FaxApplication'][_0xea3d('0x46')](_0x491c72)[_0xea3d('0x26')](handleEntityNotFound(_0x233918,null))[_0xea3d('0x26')](respondWithResult(_0x233918,null))[_0xea3d('0x41')](handleError(_0x233918,null));};exports['create']=function(_0x5e7361,_0x249ce3){return db[_0xea3d('0x2d')][_0xea3d('0x47')](_0x5e7361[_0xea3d('0x48')],{})[_0xea3d('0x26')](respondWithResult(_0x249ce3,0xc9))['catch'](handleError(_0x249ce3,null));};exports[_0xea3d('0x25')]=function(_0x3e7a10,_0x32c4c2){if(_0x3e7a10[_0xea3d('0x48')]['id']){delete _0x3e7a10[_0xea3d('0x48')]['id'];}return db[_0xea3d('0x2d')][_0xea3d('0x46')]({'where':{'id':_0x3e7a10[_0xea3d('0x42')]['id']}})[_0xea3d('0x26')](handleEntityNotFound(_0x32c4c2,null))['then'](saveUpdates(_0x3e7a10[_0xea3d('0x48')],null))[_0xea3d('0x26')](respondWithResult(_0x32c4c2,null))['catch'](handleError(_0x32c4c2,null));};exports[_0xea3d('0x27')]=function(_0x342416,_0x2d21aa){return db[_0xea3d('0x2d')][_0xea3d('0x46')]({'where':{'id':_0x342416['params']['id']}})['then'](handleEntityNotFound(_0x2d21aa,null))[_0xea3d('0x26')](removeEntity(_0x2d21aa,null))[_0xea3d('0x41')](handleError(_0x2d21aa,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b16bf17..6e40670 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 _0x8a4a=['../../config/environment','./faxApplication.attributes','exports','FaxApplication','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5ca62a,_0x3dffb9){var _0xcabff4=function(_0x48766a){while(--_0x48766a){_0x5ca62a['push'](_0x5ca62a['shift']());}};_0xcabff4(++_0x3dffb9);}(_0x8a4a,0x13d));var _0xa8a4=function(_0x3a4a66,_0x5afde4){_0x3a4a66=_0x3a4a66-0x0;var _0x2bd136=_0x8a4a[_0x3a4a66];return _0x2bd136;};'use strict';var _=require(_0xa8a4('0x0'));var util=require(_0xa8a4('0x1'));var logger=require('../../config/logger')(_0xa8a4('0x2'));var moment=require(_0xa8a4('0x3'));var BPromise=require(_0xa8a4('0x4'));var rp=require(_0xa8a4('0x5'));var fs=require('fs');var path=require(_0xa8a4('0x6'));var rimraf=require('rimraf');var config=require(_0xa8a4('0x7'));var attributes=require(_0xa8a4('0x8'));module[_0xa8a4('0x9')]=function(_0x463d43,_0x2deefa){return _0x463d43['define'](_0xa8a4('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa8a4('0xb')});}; \ No newline at end of file +var _0x966d=['rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path'];(function(_0x3ae033,_0x154aca){var _0x13dca7=function(_0x479c29){while(--_0x479c29){_0x3ae033['push'](_0x3ae033['shift']());}};_0x13dca7(++_0x154aca);}(_0x966d,0x1e7));var _0xd966=function(_0x5d1fd3,_0xa9527f){_0x5d1fd3=_0x5d1fd3-0x0;var _0x2ae6df=_0x966d[_0x5d1fd3];return _0x2ae6df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd966('0x0'))(_0xd966('0x1'));var moment=require(_0xd966('0x2'));var BPromise=require(_0xd966('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd966('0x4'));var rimraf=require(_0xd966('0x5'));var config=require(_0xd966('0x6'));var attributes=require(_0xd966('0x7'));module[_0xd966('0x8')]=function(_0xd4180c,_0x326080){return _0xd4180c[_0xd966('0x9')]('FaxApplication',attributes,{'tableName':_0xd966('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd966('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4a5b2f0..88bacc7 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 _0x395d=['catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3f0129,_0x46ce6d){var _0x6f976f=function(_0x21b0a1){while(--_0x21b0a1){_0x3f0129['push'](_0x3f0129['shift']());}};_0x6f976f(++_0x46ce6d);}(_0x395d,0x166));var _0xd395=function(_0x2c89dd,_0x3d4a30){_0x2c89dd=_0x2c89dd-0x0;var _0xe303ed=_0x395d[_0x2c89dd];return _0xe303ed;};'use strict';var _=require(_0xd395('0x0'));var util=require(_0xd395('0x1'));var moment=require(_0xd395('0x2'));var BPromise=require(_0xd395('0x3'));var rs=require(_0xd395('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd395('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd395('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd395('0x7'));var client=jayson[_0xd395('0x8')][_0xd395('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151489,_0xbeab0f,_0x1d4bce){return new BPromise(function(_0x3d9ba4,_0x13804f){return client[_0xd395('0xa')](_0x151489,_0x1d4bce)[_0xd395('0xb')](function(_0x4f84c5){logger[_0xd395('0xc')](_0xd395('0xd'),_0xbeab0f,_0xd395('0xe'));logger[_0xd395('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xbeab0f,_0xd395('0xe'),JSON[_0xd395('0x10')](_0x4f84c5));if(_0x4f84c5[_0xd395('0x11')]){if(_0x4f84c5[_0xd395('0x11')]['code']===0x1f4){logger[_0xd395('0x11')](_0xd395('0xd'),_0xbeab0f,_0x4f84c5[_0xd395('0x11')]['message']);return _0x13804f(_0x4f84c5[_0xd395('0x11')][_0xd395('0x12')]);}logger[_0xd395('0x11')](_0xd395('0xd'),_0xbeab0f,_0x4f84c5[_0xd395('0x11')]['message']);return _0x3d9ba4(_0x4f84c5['error'][_0xd395('0x12')]);}else{logger[_0xd395('0xc')]('FaxApplication,\x20%s,\x20%s',_0xbeab0f,_0xd395('0xe'));_0x3d9ba4(_0x4f84c5['result']['message']);}})[_0xd395('0x13')](function(_0x331178){logger[_0xd395('0x11')]('FaxApplication,\x20%s,\x20%s',_0xbeab0f,_0x331178);_0x13804f(_0x331178);});});}exports['UpdateFaxApplication']=function(_0x2c1410){var _0x321a5e=this;return new Promise(function(_0x56e15d,_0x53cf22){return db[_0xd395('0x14')][_0xd395('0x15')](_0x2c1410[_0xd395('0x16')],{'raw':_0x2c1410[_0xd395('0x17')]?_0x2c1410[_0xd395('0x17')][_0xd395('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c1410['options']?_0x2c1410[_0xd395('0x17')][_0xd395('0x19')]||null:null,'attributes':_0x2c1410[_0xd395('0x17')]?_0x2c1410[_0xd395('0x17')][_0xd395('0x1a')]||null:null,'limit':_0x2c1410['options']?_0x2c1410[_0xd395('0x17')][_0xd395('0x1b')]||null:null})[_0xd395('0xb')](function(_0xbb05b6){logger['info'](_0xd395('0x1c'),_0x2c1410);logger['debug'](_0xd395('0x1c'),_0x2c1410,JSON[_0xd395('0x10')](_0xbb05b6));_0x56e15d(_0xbb05b6);})[_0xd395('0x13')](function(_0x207275){logger[_0xd395('0x11')](_0xd395('0x1c'),_0x207275[_0xd395('0x12')],_0x2c1410);_0x53cf22(_0x321a5e[_0xd395('0x11')](0x1f4,_0x207275[_0xd395('0x12')]));});});}; \ No newline at end of file +var _0x8e67=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','debug','lodash','util','bluebird'];(function(_0x17ec13,_0x303855){var _0x1a8c12=function(_0xf82e9e){while(--_0xf82e9e){_0x17ec13['push'](_0x17ec13['shift']());}};_0x1a8c12(++_0x303855);}(_0x8e67,0x75));var _0x78e6=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8e67[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x78e6('0x0'));var util=require(_0x78e6('0x1'));var moment=require('moment');var BPromise=require(_0x78e6('0x2'));var rs=require(_0x78e6('0x3'));var fs=require('fs');var Redis=require(_0x78e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x78e6('0x5'));var logger=require(_0x78e6('0x6'))(_0x78e6('0x7'));var config=require('../../config/environment');var jayson=require(_0x78e6('0x8'));var client=jayson['client'][_0x78e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5391cd,_0x3c4265,_0x59c862){return new BPromise(function(_0x78905c,_0x5198f6){return client[_0x78e6('0xa')](_0x5391cd,_0x59c862)[_0x78e6('0xb')](function(_0x23e521){logger[_0x78e6('0xc')]('FaxApplication,\x20%s,\x20%s',_0x3c4265,_0x78e6('0xd'));logger['debug'](_0x78e6('0xe'),_0x3c4265,'request\x20sent',JSON[_0x78e6('0xf')](_0x23e521));if(_0x23e521[_0x78e6('0x10')]){if(_0x23e521[_0x78e6('0x10')]['code']===0x1f4){logger['error'](_0x78e6('0x11'),_0x3c4265,_0x23e521['error'][_0x78e6('0x12')]);return _0x5198f6(_0x23e521['error'][_0x78e6('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x3c4265,_0x23e521[_0x78e6('0x10')][_0x78e6('0x12')]);return _0x78905c(_0x23e521[_0x78e6('0x10')][_0x78e6('0x12')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x3c4265,_0x78e6('0xd'));_0x78905c(_0x23e521['result'][_0x78e6('0x12')]);}})[_0x78e6('0x13')](function(_0x262723){logger[_0x78e6('0x10')](_0x78e6('0x11'),_0x3c4265,_0x262723);_0x5198f6(_0x262723);});});}exports['UpdateFaxApplication']=function(_0xa49aa8){var _0x54abc3=this;return new Promise(function(_0x37d629,_0x176cc2){return db[_0x78e6('0x14')][_0x78e6('0x15')](_0xa49aa8[_0x78e6('0x16')],{'raw':_0xa49aa8[_0x78e6('0x17')]?_0xa49aa8[_0x78e6('0x17')][_0x78e6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa49aa8[_0x78e6('0x17')]?_0xa49aa8[_0x78e6('0x17')][_0x78e6('0x19')]||null:null,'attributes':_0xa49aa8[_0x78e6('0x17')]?_0xa49aa8[_0x78e6('0x17')][_0x78e6('0x1a')]||null:null,'limit':_0xa49aa8['options']?_0xa49aa8['options'][_0x78e6('0x1b')]||null:null})['then'](function(_0x28b71c){logger['info'](_0x78e6('0x1c'),_0xa49aa8);logger[_0x78e6('0x1d')]('UpdateFaxApplication',_0xa49aa8,JSON[_0x78e6('0xf')](_0x28b71c));_0x37d629(_0x28b71c);})['catch'](function(_0x471489){logger[_0x78e6('0x10')](_0x78e6('0x1c'),_0x471489[_0x78e6('0x12')],_0xa49aa8);_0x176cc2(_0x54abc3[_0x78e6('0x10')](0x1f4,_0x471489['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 445ea1f..94df091 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 _0x1eba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x12e4fc,_0xf01a75){var _0x197c91=function(_0x3922bb){while(--_0x3922bb){_0x12e4fc['push'](_0x12e4fc['shift']());}};_0x197c91(++_0xf01a75);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x1eba[_0x602ca8];return _0x26e8ab;};'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('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0xf')]);router['put'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router['delete'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x11')]);module[_0xa1eb('0x12')]=router; \ No newline at end of file +var _0x3266=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3266,0x6a));var _0x6326=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x3266[_0x2aecb2];return _0x3ebb80;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/:id',auth[_0x6326('0xa')](),controller['show']);router[_0x6326('0xd')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xf')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);module[_0x6326('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index dc051af..f518569 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 _0xf61e=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x321ade,_0x2f6097){var _0x10b9ae=function(_0x44f171){while(--_0x44f171){_0x321ade['push'](_0x321ade['shift']());}};_0x10b9ae(++_0x2f6097);}(_0xf61e,0x191));var _0xef61=function(_0x588b74,_0x545478){_0x588b74=_0x588b74-0x0;var _0x5a9fef=_0xf61e[_0x588b74];return _0x5a9fef;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'closed':{'type':Sequelize[_0xef61('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xef61('0x3')]},'disposition':{'type':Sequelize[_0xef61('0x4')]},'secondDisposition':{'type':Sequelize[_0xef61('0x4')]},'thirdDisposition':{'type':Sequelize[_0xef61('0x4')]},'note':{'type':Sequelize[_0xef61('0x4')]},'read1stAt':{'type':Sequelize[_0xef61('0x3')]},'fax':{'type':Sequelize[_0xef61('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xef61('0x5')]('in',_0xef61('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xef61('0x5')]('in',_0xef61('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x57ca=['STRING','DATE','ENUM','out','INTEGER','exports','BOOLEAN'];(function(_0x1e7788,_0x2c0e2f){var _0x7da817=function(_0x213204){while(--_0x213204){_0x1e7788['push'](_0x1e7788['shift']());}};_0x7da817(++_0x2c0e2f);}(_0x57ca,0x108));var _0xa57c=function(_0x197939,_0x4bafd6){_0x197939=_0x197939-0x0;var _0x21e0e4=_0x57ca[_0x197939];return _0x21e0e4;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'closed':{'type':Sequelize[_0xa57c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa57c('0x2')]},'secondDisposition':{'type':Sequelize[_0xa57c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa57c('0x2')]},'note':{'type':Sequelize[_0xa57c('0x2')]},'read1stAt':{'type':Sequelize[_0xa57c('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xa57c('0x4')]('in',_0xa57c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa57c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa57c('0x4')]('in',_0xa57c('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xa57c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 63459c5..3dad55a 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 _0x7799=['rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','name','index','map','FaxInteraction','fieldName','type','key','findAll','fax','user','params','model','keys','query','intersection','attributes','fields','length','merge','options','find','create','body','catch','destroy','describe','FaxMessage','addMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Messages','createdAt','get','Attachment','basename','existsSync','createReadStream','createWriteStream','log','err','unlinkSync'];(function(_0x30341c,_0x48bf2f){var _0x33ab45=function(_0x47daa2){while(--_0x47daa2){_0x30341c['push'](_0x30341c['shift']());}};_0x33ab45(++_0x48bf2f);}(_0x7799,0xcc));var _0x9779=function(_0x322548,_0x3e7823){_0x322548=_0x322548-0x0;var _0x5b1df6=_0x7799[_0x322548];return _0x5b1df6;};'use strict';var rimraf=require(_0x9779('0x0'));var zipdir=require(_0x9779('0x1'));var moment=require(_0x9779('0x2'));var BPromise=require(_0x9779('0x3'));var util=require(_0x9779('0x4'));var path=require(_0x9779('0x5'));var fs=require('fs');var _=require(_0x9779('0x6'));var Redis=require('ioredis');var interaction=require(_0x9779('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x9779('0x8'))(_0x9779('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9779('0xa')](config[_0x9779('0xb')],{'host':_0x9779('0xc'),'port':0x18eb});var socket=require(_0x9779('0xd'))(new Redis(config['redis']));require(_0x9779('0xe'))['register'](socket);function respondWithStatusCode(_0x1ac376,_0x405753){_0x405753=_0x405753||0xcc;return function(_0x29e3c8){if(_0x29e3c8){return _0x1ac376[_0x9779('0xf')](_0x405753);}return _0x1ac376[_0x9779('0x10')](_0x405753)[_0x9779('0x11')]();};}function respondWithResult(_0x99f0f9,_0x439f86){_0x439f86=_0x439f86||0xc8;return function(_0x171f30){if(_0x171f30){return _0x99f0f9[_0x9779('0x10')](_0x439f86)[_0x9779('0x12')](_0x171f30);}};}function respondWithFilteredResult(_0x173436,_0x20f4d5){return function(_0x4b6567){if(_0x4b6567){var _0x1830a9=typeof _0x20f4d5[_0x9779('0x13')]===_0x9779('0x14')&&typeof _0x20f4d5[_0x9779('0x15')]===_0x9779('0x14');var _0x5d43fc=_0x4b6567[_0x9779('0x16')];var _0xe77140=_0x1830a9?0x0:_0x20f4d5[_0x9779('0x13')];var _0x3ab5e0=_0x1830a9?_0x4b6567['count']:_0x20f4d5[_0x9779('0x13')]+_0x20f4d5[_0x9779('0x15')];var _0x58d1a7;if(_0x3ab5e0>=_0x5d43fc){_0x3ab5e0=_0x5d43fc;_0x58d1a7=0xc8;}else{_0x58d1a7=0xce;}_0x173436[_0x9779('0x10')](_0x58d1a7);return _0x173436[_0x9779('0x17')]('Content-Range',_0xe77140+'-'+_0x3ab5e0+'/'+_0x5d43fc)['json'](_0x4b6567);}return null;};}function saveUpdates(_0x4e9f5c){return function(_0x4b993e){if(_0x4b993e){return _0x4b993e[_0x9779('0x18')](_0x4e9f5c)[_0x9779('0x19')](function(_0x354d9b){return _0x354d9b;});}return null;};}function removeEntity(_0x16afc3){return function(_0x446f10){if(_0x446f10){return _0x446f10['destroy']()[_0x9779('0x19')](function(){_0x16afc3[_0x9779('0x10')](0xcc)[_0x9779('0x11')]();});}};}function handleEntityNotFound(_0x57a709){return function(_0x30283f){if(!_0x30283f){_0x57a709[_0x9779('0xf')](0x194);}return _0x30283f;};}function handleError(_0x48aead,_0x2ff23a){_0x2ff23a=_0x2ff23a||0x1f4;return function(_0x27d5ed){logger[_0x9779('0x1a')](_0x27d5ed[_0x9779('0x1b')]);if(_0x27d5ed[_0x9779('0x1c')]){delete _0x27d5ed[_0x9779('0x1c')];}_0x48aead[_0x9779('0x10')](_0x2ff23a)['send'](_0x27d5ed);};}exports[_0x9779('0x1d')]=function(_0x515970,_0x4ad979){var _0x2ed550={};var _0x4e9217=_[_0x9779('0x1e')](db[_0x9779('0x1f')]['rawAttributes'],function(_0x198dcc){return{'name':_0x198dcc[_0x9779('0x20')],'type':_0x198dcc[_0x9779('0x21')][_0x9779('0x22')]};});_0x2ed550=qs['getOptions'](_0x4e9217,_0x515970);return interaction[_0x9779('0x23')](_0x9779('0x24'),_0x515970['query'],_0x515970[_0x9779('0x25')],_0x2ed550,_0x4e9217)['then'](respondWithFilteredResult(_0x4ad979,_0x2ed550))['catch'](handleError(_0x4ad979,null));};exports['show']=function(_0x1425ed,_0x34b6c8){var _0x62827e={'raw':![],'where':{'id':_0x1425ed[_0x9779('0x26')]['id']}},_0x2c9762={};_0x2c9762[_0x9779('0x27')]=_[_0x9779('0x28')](db[_0x9779('0x1f')]['rawAttributes']);_0x2c9762[_0x9779('0x29')]=_[_0x9779('0x28')](_0x1425ed['query']);_0x2c9762['filters']=_[_0x9779('0x2a')](_0x2c9762['model'],_0x2c9762[_0x9779('0x29')]);_0x62827e[_0x9779('0x2b')]=_['intersection'](_0x2c9762[_0x9779('0x27')],qs[_0x9779('0x2c')](_0x1425ed['query'][_0x9779('0x2c')]));_0x62827e[_0x9779('0x2b')]=_0x62827e[_0x9779('0x2b')][_0x9779('0x2d')]?_0x62827e[_0x9779('0x2b')]:_0x2c9762[_0x9779('0x27')];if(_0x1425ed['query']['includeAll']){_0x62827e['include']=[{'all':!![]}];}_0x62827e=_[_0x9779('0x2e')]({},_0x62827e,_0x1425ed[_0x9779('0x2f')]);return db[_0x9779('0x1f')][_0x9779('0x30')](_0x62827e)['then'](handleEntityNotFound(_0x34b6c8,null))[_0x9779('0x19')](respondWithResult(_0x34b6c8,null))['catch'](handleError(_0x34b6c8,null));};exports[_0x9779('0x31')]=function(_0x3acb30,_0x1620d7){return db[_0x9779('0x1f')]['create'](_0x3acb30[_0x9779('0x32')],{})[_0x9779('0x19')](respondWithResult(_0x1620d7,0xc9))[_0x9779('0x33')](handleError(_0x1620d7,null));};exports['update']=function(_0x1b0028,_0x5d9bd7){if(_0x1b0028[_0x9779('0x32')]['id']){delete _0x1b0028[_0x9779('0x32')]['id'];}return db['FaxInteraction'][_0x9779('0x30')]({'where':{'id':_0x1b0028['params']['id']}})[_0x9779('0x19')](handleEntityNotFound(_0x5d9bd7,null))[_0x9779('0x19')](saveUpdates(_0x1b0028[_0x9779('0x32')],null))[_0x9779('0x19')](respondWithResult(_0x5d9bd7,null))[_0x9779('0x33')](handleError(_0x5d9bd7,null));};exports[_0x9779('0x34')]=function(_0x14514e,_0x1e579b){return db['FaxInteraction'][_0x9779('0x30')]({'where':{'id':_0x14514e[_0x9779('0x26')]['id']}})[_0x9779('0x19')](handleEntityNotFound(_0x1e579b,null))[_0x9779('0x19')](removeEntity(_0x1e579b,null))[_0x9779('0x33')](handleError(_0x1e579b,null));};exports[_0x9779('0x35')]=function(_0x2e8422,_0x18ebf1){return db['FaxInteraction'][_0x9779('0x35')]()['then'](respondWithResult(_0x18ebf1,null))[_0x9779('0x33')](handleError(_0x18ebf1,null));};exports['addMessage']=function(_0x41070b,_0xd7ddc3){return db[_0x9779('0x36')][_0x9779('0x30')]({'where':{'id':_0x41070b['params']['id']}})[_0x9779('0x19')](handleEntityNotFound(_0xd7ddc3,null))['then'](function(_0x20bb38){if(_0x20bb38){return _0x20bb38[_0x9779('0x37')](_0x41070b[_0x9779('0x32')][_0x9779('0x38')],_[_0x9779('0x39')](_0x41070b[_0x9779('0x32')],[_0x9779('0x38'),'id'])||{});}})[_0x9779('0x19')](respondWithResult(_0xd7ddc3,null))[_0x9779('0x33')](handleError(_0xd7ddc3,null));};exports[_0x9779('0x3a')]=function(_0x5e866b,_0x15b491){var _0x366182={'raw':![],'where':{}};var _0x1972bb={};var _0x4c3d83={'count':0x0,'rows':[]};return db[_0x9779('0x1f')]['findOne']({'where':{'id':_0x5e866b[_0x9779('0x26')]['id']}})[_0x9779('0x19')](handleEntityNotFound(_0x15b491,null))['then'](function(_0x15c6b2){if(_0x15c6b2){_0x1972bb[_0x9779('0x27')]=_[_0x9779('0x28')](db[_0x9779('0x36')]['rawAttributes']);_0x1972bb[_0x9779('0x29')]=_['keys'](_0x5e866b[_0x9779('0x29')]);_0x1972bb[_0x9779('0x3b')]=_[_0x9779('0x2a')](_0x1972bb[_0x9779('0x27')],_0x1972bb['query']);_0x366182['attributes']=_[_0x9779('0x2a')](_0x1972bb[_0x9779('0x27')],qs[_0x9779('0x2c')](_0x5e866b[_0x9779('0x29')][_0x9779('0x2c')]));_0x366182[_0x9779('0x2b')]=_0x366182[_0x9779('0x2b')][_0x9779('0x2d')]?_0x366182[_0x9779('0x2b')]:_0x1972bb['model'];if(!_0x5e866b[_0x9779('0x29')][_0x9779('0x3c')](_0x9779('0x3d'))){_0x366182[_0x9779('0x15')]=qs[_0x9779('0x15')](_0x5e866b[_0x9779('0x29')][_0x9779('0x15')]);_0x366182[_0x9779('0x13')]=qs[_0x9779('0x13')](_0x5e866b[_0x9779('0x29')][_0x9779('0x13')]);}_0x366182[_0x9779('0x3e')]=qs['sort'](_0x5e866b['query'][_0x9779('0x3f')]);_0x366182[_0x9779('0x40')]=qs[_0x9779('0x3b')](_[_0x9779('0x41')](_0x5e866b[_0x9779('0x29')],_0x1972bb[_0x9779('0x3b')]));_0x366182[_0x9779('0x40')][_0x9779('0x42')]=_0x15c6b2['id'];if(_0x5e866b[_0x9779('0x29')][_0x9779('0x43')]){_0x366182['where']=_[_0x9779('0x2e')](_0x366182[_0x9779('0x40')],{'$or':_[_0x9779('0x1e')](_0x366182[_0x9779('0x2b')],function(_0x5996a3){var _0x429134={};_0x429134[_0x5996a3]={'$like':'%'+_0x5e866b[_0x9779('0x29')][_0x9779('0x43')]+'%'};return _0x429134;})});}if(_0x5e866b[_0x9779('0x29')][_0x9779('0x44')]){var _0x1fc6e5=_0x5e866b['query'][_0x9779('0x44')][_0x9779('0x45')](',');var _0x3ea42d={};_0x3ea42d[_0x1fc6e5[0x0]]={'$gte':moment(_0x1fc6e5[0x1])[_0x9779('0x46')](_0x9779('0x47'))};_0x366182['where']=_[_0x9779('0x2e')](_0x366182[_0x9779('0x40')],_0x3ea42d);}_0x366182=_[_0x9779('0x2e')]({},_0x366182,_0x5e866b[_0x9779('0x2f')]);return db[_0x9779('0x36')][_0x9779('0x16')]({'where':_0x366182['where']})[_0x9779('0x19')](function(_0x19decb){_0x4c3d83['count']=_0x19decb;if(_0x5e866b[_0x9779('0x29')][_0x9779('0x48')]){_0x366182[_0x9779('0x49')]=[{'all':!![]}];}return db[_0x9779('0x36')]['findAll'](_0x366182);})[_0x9779('0x19')](function(_0x232a96){_0x4c3d83[_0x9779('0x4a')]=_0x232a96;return _0x4c3d83;});}})[_0x9779('0x19')](respondWithFilteredResult(_0x15b491,_0x366182))[_0x9779('0x33')](handleError(_0x15b491,null));};exports['addTags']=function(_0x2289d4,_0x138bec){return db[_0x9779('0x1f')][_0x9779('0x30')]({'where':{'id':_0x2289d4[_0x9779('0x26')]['id']}})['then'](handleEntityNotFound(_0x138bec,null))[_0x9779('0x19')](function(_0x62d42d){if(_0x62d42d){return _0x62d42d[_0x9779('0x4b')](_0x2289d4['body']['ids'],_[_0x9779('0x39')](_0x2289d4[_0x9779('0x32')],[_0x9779('0x38'),'id'])||{})[_0x9779('0x4c')](function(){return db[_0x9779('0x4d')][_0x9779('0x23')]({'attributes':['id',_0x9779('0x1c'),_0x9779('0x4e')],'where':{'id':_0x2289d4[_0x9779('0x32')]['ids']}});})[_0x9779('0x19')](function(_0x13dd44){socket['emit'](_0x9779('0x4f'),{'id':Number(_0x2289d4['params']['id']),'tags':_0x13dd44||[]});return{'id':Number(_0x2289d4[_0x9779('0x26')]['id']),'tags':_0x13dd44||[]};});}})[_0x9779('0x19')](respondWithResult(_0x138bec,null))[_0x9779('0x33')](handleError(_0x138bec,null));};exports[_0x9779('0x50')]=function(_0x5c649e,_0x82b5f5){return db[_0x9779('0x1f')][_0x9779('0x30')]({'where':{'id':_0x5c649e[_0x9779('0x26')]['id']}})[_0x9779('0x19')](handleEntityNotFound(_0x82b5f5,null))[_0x9779('0x19')](function(_0x2ff93b){if(_0x2ff93b){return _0x2ff93b[_0x9779('0x50')](_0x5c649e[_0x9779('0x29')][_0x9779('0x38')]);}})[_0x9779('0x19')](respondWithStatusCode(_0x82b5f5,null))[_0x9779('0x33')](handleError(_0x82b5f5,null));};exports[_0x9779('0x51')]=function(_0xecd46d,_0x1a6fe6){var _0x4551a8=moment()[_0x9779('0x52')]()['toString']();var _0x2d6ccd=path[_0x9779('0x53')](config[_0x9779('0x54')],_0x9779('0x55'),_0x9779('0x56'),_0x9779('0x57'));var _0x12c7c4=path[_0x9779('0x53')](config['root'],'server',_0x9779('0x56'),_0x9779('0x58'));var _0x355352=path['join'](_0x2d6ccd,_0x4551a8);var _0x3f02b9=util[_0x9779('0x46')](_0x9779('0x59'),_0xecd46d[_0x9779('0x26')]['id'],_0x4551a8);var _0x4e6da6=path[_0x9779('0x53')](_0x2d6ccd,_0x3f02b9);var _0x5c93fe=[];_0x5c93fe[_0x9779('0x5a')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x482fe9=[{'model':db[_0x9779('0x36')],'as':_0x9779('0x5b'),'attributes':['id','body',_0x9779('0x5c')],'include':_0x5c93fe}];return db['FaxInteraction'][_0x9779('0x30')]({'where':{'id':_0xecd46d[_0x9779('0x26')]['id']},'include':_0x482fe9})[_0x9779('0x19')](handleEntityNotFound(_0x1a6fe6,null))[_0x9779('0x19')](function(_0x44a73b){if(_0x44a73b&&_0x44a73b[_0x9779('0x5b')]){var _0x4dc5b9=_0x44a73b[_0x9779('0x5d')]({'plain':!![]});fs['mkdirSync'](_0x355352);for(var _0x3c1530=0x0;_0x3c1530<_0x4dc5b9['Messages'][_0x9779('0x2d')];_0x3c1530++){var _0x4ae80a=_0x4dc5b9[_0x9779('0x5b')][_0x3c1530][_0x9779('0x5e')];if(_0x4ae80a){var _0x4e14f7=path['join'](_0x12c7c4,_0x4ae80a[_0x9779('0x5f')]);if(fs[_0x9779('0x60')](_0x4e14f7)){fs[_0x9779('0x61')](_0x4e14f7)['pipe'](fs[_0x9779('0x62')](path['join'](_0x355352,_0x4ae80a[_0x9779('0x5f')])));}}}return BPromise['resolve']()[_0x9779('0x19')](function(){return new BPromise(function(_0x2eb3b1,_0x5cfd1b){zipdir(_0x355352,{'saveTo':_0x4e6da6},function(_0x42ea28,_0xb457e7){if(_0x42ea28)return _0x5cfd1b(_0x42ea28);return _0x2eb3b1(_0xb457e7);});})['then'](function(){return new BPromise(function(_0x23bdce,_0x2485ee){rimraf(_0x355352,function(_0x2d13bd){if(_0x2d13bd)_0x2485ee(_0x2d13bd);return _0x23bdce();});});})[_0x9779('0x19')](function(){return _0x1a6fe6['download'](_0x4e6da6,_0x3f02b9,function(_0xd8a0bf){if(_0xd8a0bf){console[_0x9779('0x63')](_0x9779('0x64'),_0xd8a0bf);}else{fs[_0x9779('0x65')](_0x4e6da6);}});});});}else{return _0x1a6fe6['sendStatus'](0xc8);}})['catch'](handleError(_0x1a6fe6,null));}; \ No newline at end of file +var _0x45c5=['err','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','params','model','keys','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','FaxMessage','ids','omit','findOne','order','sort','where','filters','pick','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','root','server','files','attachments','join','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x45c5,0x68));var _0x545c=function(_0x457539,_0x15025c){_0x457539=_0x457539-0x0;var _0x951b03=_0x45c5[_0x457539];return _0x951b03;};'use strict';var rimraf=require(_0x545c('0x0'));var zipdir=require(_0x545c('0x1'));var moment=require(_0x545c('0x2'));var BPromise=require(_0x545c('0x3'));var util=require(_0x545c('0x4'));var path=require(_0x545c('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x545c('0x6'));var qs=require(_0x545c('0x7'));var logger=require(_0x545c('0x8'))(_0x545c('0x9'));var config=require(_0x545c('0xa'));var db=require(_0x545c('0xb'))['db'];config[_0x545c('0xc')]=_[_0x545c('0xd')](config['redis'],{'host':_0x545c('0xe'),'port':0x18eb});var socket=require(_0x545c('0xf'))(new Redis(config[_0x545c('0xc')]));require(_0x545c('0x10'))['register'](socket);function respondWithStatusCode(_0x29a86f,_0x3fe70e){_0x3fe70e=_0x3fe70e||0xcc;return function(_0x194a0c){if(_0x194a0c){return _0x29a86f['sendStatus'](_0x3fe70e);}return _0x29a86f[_0x545c('0x11')](_0x3fe70e)[_0x545c('0x12')]();};}function respondWithResult(_0xec3504,_0x4f341f){_0x4f341f=_0x4f341f||0xc8;return function(_0xa37300){if(_0xa37300){return _0xec3504[_0x545c('0x11')](_0x4f341f)[_0x545c('0x13')](_0xa37300);}};}function respondWithFilteredResult(_0xf985a2,_0x43e326){return function(_0x155454){if(_0x155454){var _0x5f077c=typeof _0x43e326[_0x545c('0x14')]==='undefined'&&typeof _0x43e326['limit']===_0x545c('0x15');var _0xb5b1d8=_0x155454[_0x545c('0x16')];var _0x11dd97=_0x5f077c?0x0:_0x43e326['offset'];var _0x2e5343=_0x5f077c?_0x155454[_0x545c('0x16')]:_0x43e326['offset']+_0x43e326[_0x545c('0x17')];var _0x24d2be;if(_0x2e5343>=_0xb5b1d8){_0x2e5343=_0xb5b1d8;_0x24d2be=0xc8;}else{_0x24d2be=0xce;}_0xf985a2[_0x545c('0x11')](_0x24d2be);return _0xf985a2[_0x545c('0x18')](_0x545c('0x19'),_0x11dd97+'-'+_0x2e5343+'/'+_0xb5b1d8)[_0x545c('0x13')](_0x155454);}return null;};}function saveUpdates(_0xf8d343){return function(_0x53dac3){if(_0x53dac3){return _0x53dac3[_0x545c('0x1a')](_0xf8d343)[_0x545c('0x1b')](function(_0x5db260){return _0x5db260;});}return null;};}function removeEntity(_0x5504d1){return function(_0x474796){if(_0x474796){return _0x474796[_0x545c('0x1c')]()[_0x545c('0x1b')](function(){_0x5504d1[_0x545c('0x11')](0xcc)[_0x545c('0x12')]();});}};}function handleEntityNotFound(_0x8c99f7){return function(_0x3ab1ec){if(!_0x3ab1ec){_0x8c99f7['sendStatus'](0x194);}return _0x3ab1ec;};}function handleError(_0x5f2aa1,_0x1ad98e){_0x1ad98e=_0x1ad98e||0x1f4;return function(_0x46aadb){logger['error'](_0x46aadb[_0x545c('0x1d')]);if(_0x46aadb[_0x545c('0x1e')]){delete _0x46aadb['name'];}_0x5f2aa1[_0x545c('0x11')](_0x1ad98e)['send'](_0x46aadb);};}exports[_0x545c('0x1f')]=function(_0x43c656,_0x2fdfbb){var _0x3d623e={};var _0x343af7=_[_0x545c('0x20')](db[_0x545c('0x21')][_0x545c('0x22')],function(_0x3cf5ef){return{'name':_0x3cf5ef['fieldName'],'type':_0x3cf5ef[_0x545c('0x23')][_0x545c('0x24')]};});_0x3d623e=qs[_0x545c('0x25')](_0x343af7,_0x43c656);return interaction[_0x545c('0x26')](_0x545c('0x27'),_0x43c656[_0x545c('0x28')],_0x43c656['user'],_0x3d623e,_0x343af7)['then'](respondWithFilteredResult(_0x2fdfbb,_0x3d623e))['catch'](handleError(_0x2fdfbb,null));};exports['show']=function(_0x341789,_0x52d2fc){var _0x213e1b={'raw':![],'where':{'id':_0x341789[_0x545c('0x29')]['id']}},_0x326255={};_0x326255[_0x545c('0x2a')]=_['keys'](db['FaxInteraction'][_0x545c('0x22')]);_0x326255[_0x545c('0x28')]=_[_0x545c('0x2b')](_0x341789['query']);_0x326255['filters']=_['intersection'](_0x326255[_0x545c('0x2a')],_0x326255[_0x545c('0x28')]);_0x213e1b[_0x545c('0x2c')]=_[_0x545c('0x2d')](_0x326255[_0x545c('0x2a')],qs[_0x545c('0x2e')](_0x341789[_0x545c('0x28')]['fields']));_0x213e1b['attributes']=_0x213e1b[_0x545c('0x2c')][_0x545c('0x2f')]?_0x213e1b['attributes']:_0x326255[_0x545c('0x2a')];if(_0x341789['query'][_0x545c('0x30')]){_0x213e1b[_0x545c('0x31')]=[{'all':!![]}];}_0x213e1b=_[_0x545c('0x32')]({},_0x213e1b,_0x341789[_0x545c('0x33')]);return db[_0x545c('0x21')][_0x545c('0x34')](_0x213e1b)[_0x545c('0x1b')](handleEntityNotFound(_0x52d2fc,null))[_0x545c('0x1b')](respondWithResult(_0x52d2fc,null))[_0x545c('0x35')](handleError(_0x52d2fc,null));};exports['create']=function(_0x26233e,_0x16c2b5){return db['FaxInteraction'][_0x545c('0x36')](_0x26233e[_0x545c('0x37')],{})[_0x545c('0x1b')](respondWithResult(_0x16c2b5,0xc9))['catch'](handleError(_0x16c2b5,null));};exports[_0x545c('0x1a')]=function(_0xaa466f,_0x3b704a){if(_0xaa466f[_0x545c('0x37')]['id']){delete _0xaa466f[_0x545c('0x37')]['id'];}return db[_0x545c('0x21')][_0x545c('0x34')]({'where':{'id':_0xaa466f[_0x545c('0x29')]['id']}})[_0x545c('0x1b')](handleEntityNotFound(_0x3b704a,null))[_0x545c('0x1b')](saveUpdates(_0xaa466f[_0x545c('0x37')],null))[_0x545c('0x1b')](respondWithResult(_0x3b704a,null))['catch'](handleError(_0x3b704a,null));};exports['destroy']=function(_0x1fae62,_0x306703){return db['FaxInteraction']['find']({'where':{'id':_0x1fae62['params']['id']}})[_0x545c('0x1b')](handleEntityNotFound(_0x306703,null))[_0x545c('0x1b')](removeEntity(_0x306703,null))[_0x545c('0x35')](handleError(_0x306703,null));};exports[_0x545c('0x38')]=function(_0x2b0387,_0x5a13c4){return db['FaxInteraction'][_0x545c('0x38')]()[_0x545c('0x1b')](respondWithResult(_0x5a13c4,null))[_0x545c('0x35')](handleError(_0x5a13c4,null));};exports[_0x545c('0x39')]=function(_0x23f182,_0x2c6c39){return db[_0x545c('0x3a')][_0x545c('0x34')]({'where':{'id':_0x23f182[_0x545c('0x29')]['id']}})[_0x545c('0x1b')](handleEntityNotFound(_0x2c6c39,null))[_0x545c('0x1b')](function(_0x29dd9c){if(_0x29dd9c){return _0x29dd9c[_0x545c('0x39')](_0x23f182['body'][_0x545c('0x3b')],_[_0x545c('0x3c')](_0x23f182[_0x545c('0x37')],[_0x545c('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x2c6c39,null))[_0x545c('0x35')](handleError(_0x2c6c39,null));};exports['getMessages']=function(_0x4c0768,_0x5d15ff){var _0x2f5ec2={'raw':![],'where':{}};var _0x387b99={};var _0x487d68={'count':0x0,'rows':[]};return db[_0x545c('0x21')][_0x545c('0x3d')]({'where':{'id':_0x4c0768[_0x545c('0x29')]['id']}})[_0x545c('0x1b')](handleEntityNotFound(_0x5d15ff,null))[_0x545c('0x1b')](function(_0x2f4ae4){if(_0x2f4ae4){_0x387b99[_0x545c('0x2a')]=_['keys'](db[_0x545c('0x3a')][_0x545c('0x22')]);_0x387b99[_0x545c('0x28')]=_[_0x545c('0x2b')](_0x4c0768[_0x545c('0x28')]);_0x387b99['filters']=_['intersection'](_0x387b99[_0x545c('0x2a')],_0x387b99[_0x545c('0x28')]);_0x2f5ec2['attributes']=_[_0x545c('0x2d')](_0x387b99[_0x545c('0x2a')],qs[_0x545c('0x2e')](_0x4c0768[_0x545c('0x28')][_0x545c('0x2e')]));_0x2f5ec2[_0x545c('0x2c')]=_0x2f5ec2[_0x545c('0x2c')][_0x545c('0x2f')]?_0x2f5ec2[_0x545c('0x2c')]:_0x387b99['model'];if(!_0x4c0768[_0x545c('0x28')]['hasOwnProperty']('nolimit')){_0x2f5ec2[_0x545c('0x17')]=qs[_0x545c('0x17')](_0x4c0768['query'][_0x545c('0x17')]);_0x2f5ec2[_0x545c('0x14')]=qs['offset'](_0x4c0768[_0x545c('0x28')][_0x545c('0x14')]);}_0x2f5ec2[_0x545c('0x3e')]=qs[_0x545c('0x3f')](_0x4c0768[_0x545c('0x28')][_0x545c('0x3f')]);_0x2f5ec2[_0x545c('0x40')]=qs[_0x545c('0x41')](_[_0x545c('0x42')](_0x4c0768[_0x545c('0x28')],_0x387b99[_0x545c('0x41')]));_0x2f5ec2[_0x545c('0x40')][_0x545c('0x43')]=_0x2f4ae4['id'];if(_0x4c0768['query']['filter']){_0x2f5ec2[_0x545c('0x40')]=_[_0x545c('0x32')](_0x2f5ec2[_0x545c('0x40')],{'$or':_[_0x545c('0x20')](_0x2f5ec2[_0x545c('0x2c')],function(_0x3d7e50){var _0x2ca6fd={};_0x2ca6fd[_0x3d7e50]={'$like':'%'+_0x4c0768[_0x545c('0x28')]['filter']+'%'};return _0x2ca6fd;})});}if(_0x4c0768['query'][_0x545c('0x44')]){var _0x2e51f9=_0x4c0768[_0x545c('0x28')]['$gte'][_0x545c('0x45')](',');var _0x1a6204={};_0x1a6204[_0x2e51f9[0x0]]={'$gte':moment(_0x2e51f9[0x1])[_0x545c('0x46')](_0x545c('0x47'))};_0x2f5ec2[_0x545c('0x40')]=_[_0x545c('0x32')](_0x2f5ec2[_0x545c('0x40')],_0x1a6204);}_0x2f5ec2=_[_0x545c('0x32')]({},_0x2f5ec2,_0x4c0768[_0x545c('0x33')]);return db[_0x545c('0x3a')][_0x545c('0x16')]({'where':_0x2f5ec2[_0x545c('0x40')]})['then'](function(_0x15df35){_0x487d68[_0x545c('0x16')]=_0x15df35;if(_0x4c0768[_0x545c('0x28')]['includeAll']){_0x2f5ec2[_0x545c('0x31')]=[{'all':!![]}];}return db[_0x545c('0x3a')][_0x545c('0x26')](_0x2f5ec2);})['then'](function(_0x48569f){_0x487d68[_0x545c('0x48')]=_0x48569f;return _0x487d68;});}})[_0x545c('0x1b')](respondWithFilteredResult(_0x5d15ff,_0x2f5ec2))['catch'](handleError(_0x5d15ff,null));};exports[_0x545c('0x49')]=function(_0x15ddc2,_0x10acd3){return db[_0x545c('0x21')]['find']({'where':{'id':_0x15ddc2[_0x545c('0x29')]['id']}})[_0x545c('0x1b')](handleEntityNotFound(_0x10acd3,null))[_0x545c('0x1b')](function(_0x303655){if(_0x303655){return _0x303655[_0x545c('0x4a')](_0x15ddc2[_0x545c('0x37')][_0x545c('0x3b')],_[_0x545c('0x3c')](_0x15ddc2[_0x545c('0x37')],['ids','id'])||{})['spread'](function(){return db[_0x545c('0x4b')][_0x545c('0x26')]({'attributes':['id',_0x545c('0x1e'),_0x545c('0x4c')],'where':{'id':_0x15ddc2['body']['ids']}});})[_0x545c('0x1b')](function(_0x1cc2fc){socket['emit'](_0x545c('0x4d'),{'id':Number(_0x15ddc2['params']['id']),'tags':_0x1cc2fc||[]});return{'id':Number(_0x15ddc2[_0x545c('0x29')]['id']),'tags':_0x1cc2fc||[]};});}})[_0x545c('0x1b')](respondWithResult(_0x10acd3,null))[_0x545c('0x35')](handleError(_0x10acd3,null));};exports[_0x545c('0x4e')]=function(_0x1b2a4f,_0x467cbf){return db[_0x545c('0x21')][_0x545c('0x34')]({'where':{'id':_0x1b2a4f[_0x545c('0x29')]['id']}})['then'](handleEntityNotFound(_0x467cbf,null))[_0x545c('0x1b')](function(_0x24daaf){if(_0x24daaf){return _0x24daaf[_0x545c('0x4e')](_0x1b2a4f['query'][_0x545c('0x3b')]);}})[_0x545c('0x1b')](respondWithStatusCode(_0x467cbf,null))['catch'](handleError(_0x467cbf,null));};exports[_0x545c('0x4f')]=function(_0x2e6515,_0x1b7d17){var _0x3bf1d0=moment()[_0x545c('0x50')]()[_0x545c('0x51')]();var _0x485586=path['join'](config[_0x545c('0x52')],_0x545c('0x53'),_0x545c('0x54'),'tmp');var _0x173ecb=path['join'](config['root'],'server','files',_0x545c('0x55'));var _0x565f81=path[_0x545c('0x56')](_0x485586,_0x3bf1d0);var _0xaeb91c=util['format'](_0x545c('0x57'),_0x2e6515['params']['id'],_0x3bf1d0);var _0x2cebe6=path[_0x545c('0x56')](_0x485586,_0xaeb91c);var _0x32bf63=[];_0x32bf63[_0x545c('0x58')]({'model':db['Attachment'],'as':_0x545c('0x59'),'raw':!![]});var _0x51a524=[{'model':db[_0x545c('0x3a')],'as':_0x545c('0x5a'),'attributes':['id','body',_0x545c('0x5b')],'include':_0x32bf63}];return db[_0x545c('0x21')][_0x545c('0x34')]({'where':{'id':_0x2e6515[_0x545c('0x29')]['id']},'include':_0x51a524})['then'](handleEntityNotFound(_0x1b7d17,null))[_0x545c('0x1b')](function(_0x216c51){if(_0x216c51&&_0x216c51[_0x545c('0x5a')]){var _0x1c5404=_0x216c51[_0x545c('0x5c')]({'plain':!![]});fs['mkdirSync'](_0x565f81);for(var _0xf7ab30=0x0;_0xf7ab30<_0x1c5404[_0x545c('0x5a')]['length'];_0xf7ab30++){var _0xc5ecc=_0x1c5404['Messages'][_0xf7ab30][_0x545c('0x59')];if(_0xc5ecc){var _0x50f8f3=path[_0x545c('0x56')](_0x173ecb,_0xc5ecc[_0x545c('0x5d')]);if(fs[_0x545c('0x5e')](_0x50f8f3)){fs[_0x545c('0x5f')](_0x50f8f3)[_0x545c('0x60')](fs[_0x545c('0x61')](path[_0x545c('0x56')](_0x565f81,_0xc5ecc[_0x545c('0x5d')])));}}}return BPromise[_0x545c('0x62')]()['then'](function(){return new BPromise(function(_0xf99655,_0x55011b){zipdir(_0x565f81,{'saveTo':_0x2cebe6},function(_0x549240,_0x5ebd99){if(_0x549240)return _0x55011b(_0x549240);return _0xf99655(_0x5ebd99);});})[_0x545c('0x1b')](function(){return new BPromise(function(_0x495f57,_0x48c681){rimraf(_0x565f81,function(_0x2da13a){if(_0x2da13a)_0x48c681(_0x2da13a);return _0x495f57();});});})[_0x545c('0x1b')](function(){return _0x1b7d17[_0x545c('0x4f')](_0x2cebe6,_0xaeb91c,function(_0x107970){if(_0x107970){console[_0x545c('0x63')](_0x545c('0x64'),_0x107970);}else{fs['unlinkSync'](_0x2cebe6);}});});});}else{return _0x1b7d17[_0x545c('0x65')](0xc8);}})[_0x545c('0x35')](handleError(_0x1b7d17,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6aafadd..d5e3157 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 _0xbe6d=['../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports'];(function(_0x28af0a,_0x5386b9){var _0x3f087e=function(_0x4bc005){while(--_0x4bc005){_0x28af0a['push'](_0x28af0a['shift']());}};_0x3f087e(++_0x5386b9);}(_0xbe6d,0x144));var _0xdbe6=function(_0x5520f8,_0x3a53cb){_0x5520f8=_0x5520f8-0x0;var _0x4478ad=_0xbe6d[_0x5520f8];return _0x4478ad;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xdbe6('0x0'))['db'][_0xdbe6('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xdbe6('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xdbe6('0x3')](0x0);var events={'afterCreate':_0xdbe6('0x4'),'afterUpdate':_0xdbe6('0x5'),'afterDestroy':_0xdbe6('0x6')};function emitEvent(_0x5ea05f){return function(_0x461ec1,_0x36d06b,_0x301c05){_0x461ec1['getUsers']({'attributes':['id'],'raw':!![]})[_0xdbe6('0x7')](function(_0xf5de9a){_0x461ec1[_0xdbe6('0x8')](_0xdbe6('0x9'),_0xf5de9a[_0xdbe6('0xa')](function(_0x5f1f48){return{'id':_0x5f1f48['id']};}));return FaxMessage[_0xdbe6('0xb')]({'where':{'FaxInteractionId':_0x461ec1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1443f7){_0x461ec1['setDataValue'](_0xdbe6('0xc'),_0x1443f7[_0xdbe6('0xd')]);FaxInteractionEvents[_0xdbe6('0xe')](_0x5ea05f+':'+_0x461ec1['id'],_0x461ec1);FaxInteractionEvents['emit'](_0x5ea05f,_0x461ec1);_0x301c05(null);})[_0xdbe6('0xf')](_0x301c05(null));};}for(var e in events){if(events[_0xdbe6('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xdbe6('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xfbbb=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','emit'];(function(_0x6f2ce5,_0x4231eb){var _0x28a54a=function(_0x1bc980){while(--_0x1bc980){_0x6f2ce5['push'](_0x6f2ce5['shift']());}};_0x28a54a(++_0x4231eb);}(_0xfbbb,0x18a));var _0xbfbb=function(_0x1029f9,_0x15d0d7){_0x1029f9=_0x1029f9-0x0;var _0x570775=_0xfbbb[_0x1029f9];return _0x570775;};'use strict';var EventEmitter=require(_0xbfbb('0x0'));var FaxInteraction=require(_0xbfbb('0x1'))['db'][_0xbfbb('0x2')];var FaxMessage=require(_0xbfbb('0x1'))['db'][_0xbfbb('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xbfbb('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbfbb('0x5'),'afterDestroy':_0xbfbb('0x6')};function emitEvent(_0x241066){return function(_0x1b09b5,_0xb351b8,_0x1c712){_0x1b09b5[_0xbfbb('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xcacfb){_0x1b09b5[_0xbfbb('0x8')]('Users',_0xcacfb[_0xbfbb('0x9')](function(_0x4cd078){return{'id':_0x4cd078['id']};}));return FaxMessage[_0xbfbb('0xa')]({'where':{'FaxInteractionId':_0x1b09b5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbfbb('0xb')](function(_0x243ed6){_0x1b09b5['setDataValue'](_0xbfbb('0xc'),_0x243ed6['length']);FaxInteractionEvents['emit'](_0x241066+':'+_0x1b09b5['id'],_0x1b09b5);FaxInteractionEvents[_0xbfbb('0xd')](_0x241066,_0x1b09b5);_0x1c712(null);})['catch'](_0x1c712(null));};}for(var e in events){if(events[_0xbfbb('0xe')](e)){var event=events[e];FaxInteraction[_0xbfbb('0xf')](e,emitEvent(event));}}module[_0xbfbb('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 d62caae..75ce43e 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 _0x110e=['FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','define'];(function(_0x1800cb,_0xba50f9){var _0x3b5e95=function(_0x556308){while(--_0x556308){_0x1800cb['push'](_0x1800cb['shift']());}};_0x3b5e95(++_0xba50f9);}(_0x110e,0x68));var _0xe110=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x110e[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var logger=require('../../config/logger')(_0xe110('0x2'));var moment=require(_0xe110('0x3'));var BPromise=require(_0xe110('0x4'));var rp=require(_0xe110('0x5'));var fs=require('fs');var path=require(_0xe110('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x37f938,_0x553f49){return _0x37f938[_0xe110('0x7')](_0xe110('0x8'),attributes,{'tableName':_0xe110('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23c5ae,_0x44050a,_0x2eebc9){if(_0x23c5ae[_0xe110('0xa')](_0xe110('0xb'))){_0x23c5ae[_0xe110('0xc')]=moment()['format'](_0xe110('0xd'));}_0x2eebc9(null,_0x23c5ae);}}});}; \ No newline at end of file +var _0x5a1b=['fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./faxInteraction.attributes','define'];(function(_0x5e1b99,_0x522acc){var _0x162cb6=function(_0x5576c5){while(--_0x5576c5){_0x5e1b99['push'](_0x5e1b99['shift']());}};_0x162cb6(++_0x522acc);}(_0x5a1b,0xe6));var _0xb5a1=function(_0x3eb845,_0x28693f){_0x3eb845=_0x3eb845-0x0;var _0x36368e=_0x5a1b[_0x3eb845];return _0x36368e;};'use strict';var _=require(_0xb5a1('0x0'));var util=require(_0xb5a1('0x1'));var logger=require(_0xb5a1('0x2'))(_0xb5a1('0x3'));var moment=require(_0xb5a1('0x4'));var BPromise=require('bluebird');var rp=require(_0xb5a1('0x5'));var fs=require('fs');var path=require(_0xb5a1('0x6'));var rimraf=require(_0xb5a1('0x7'));var config=require('../../config/environment');var attributes=require(_0xb5a1('0x8'));module['exports']=function(_0x1fbb20,_0x123910){return _0x1fbb20[_0xb5a1('0x9')]('FaxInteraction',attributes,{'tableName':_0xb5a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c59a5,_0x1c64d0,_0x3f8102){if(_0x2c59a5['changed'](_0xb5a1('0xb'))){_0x2c59a5[_0xb5a1('0xc')]=moment()[_0xb5a1('0xd')](_0xb5a1('0xe'));}_0x3f8102(null,_0x2c59a5);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 486d419..ed9178c 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 _0x497d=['body','options','raw','where','attributes','info','debug','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','UpdateFaxInteraction','FaxInteraction','update'];(function(_0x1bc1aa,_0xf2fdf8){var _0x3c370e=function(_0x1df6c9){while(--_0x1df6c9){_0x1bc1aa['push'](_0x1bc1aa['shift']());}};_0x3c370e(++_0xf2fdf8);}(_0x497d,0x1c7));var _0xd497=function(_0x153797,_0x498b3d){_0x153797=_0x153797-0x0;var _0x36e2fd=_0x497d[_0x153797];return _0x36e2fd;};'use strict';var _=require('lodash');var util=require(_0xd497('0x0'));var moment=require(_0xd497('0x1'));var BPromise=require(_0xd497('0x2'));var rs=require(_0xd497('0x3'));var fs=require('fs');var Redis=require(_0xd497('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd497('0x5'));var logger=require(_0xd497('0x6'))(_0xd497('0x7'));var config=require(_0xd497('0x8'));var jayson=require(_0xd497('0x9'));var client=jayson[_0xd497('0xa')][_0xd497('0xb')]({'port':0x232a});config[_0xd497('0xc')]=_[_0xd497('0xd')](config['redis'],{'host':_0xd497('0xe'),'port':0x18eb});var socket=require(_0xd497('0xf'))(new Redis(config[_0xd497('0xc')]));require(_0xd497('0x10'))[_0xd497('0x11')](socket);function respondWithRpcPromise(_0x25fa19,_0x1f9abc,_0x434a54){return new BPromise(function(_0x3fc5c1,_0x324799){return client[_0xd497('0x12')](_0x25fa19,_0x434a54)[_0xd497('0x13')](function(_0x5e8781){logger['info'](_0xd497('0x14'),_0x1f9abc,'request\x20sent');logger['debug'](_0xd497('0x15'),_0x1f9abc,_0xd497('0x16'),JSON['stringify'](_0x5e8781));if(_0x5e8781[_0xd497('0x17')]){if(_0x5e8781[_0xd497('0x17')]['code']===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1f9abc,_0x5e8781[_0xd497('0x17')]['message']);return _0x324799(_0x5e8781['error']['message']);}logger['error'](_0xd497('0x14'),_0x1f9abc,_0x5e8781[_0xd497('0x17')][_0xd497('0x18')]);return _0x3fc5c1(_0x5e8781[_0xd497('0x17')][_0xd497('0x18')]);}else{logger['info'](_0xd497('0x14'),_0x1f9abc,_0xd497('0x16'));_0x3fc5c1(_0x5e8781['result']['message']);}})[_0xd497('0x19')](function(_0x3344e4){logger[_0xd497('0x17')](_0xd497('0x14'),_0x1f9abc,_0x3344e4);_0x324799(_0x3344e4);});});}exports[_0xd497('0x1a')]=function(_0x4227dc){var _0x2c1bb2=this;return new Promise(function(_0x2440a1,_0x44e493){return db[_0xd497('0x1b')][_0xd497('0x1c')](_0x4227dc[_0xd497('0x1d')],{'raw':_0x4227dc[_0xd497('0x1e')]?_0x4227dc[_0xd497('0x1e')][_0xd497('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4227dc[_0xd497('0x1e')]?_0x4227dc[_0xd497('0x1e')][_0xd497('0x20')]||null:null,'attributes':_0x4227dc[_0xd497('0x1e')]?_0x4227dc[_0xd497('0x1e')][_0xd497('0x21')]||null:null,'limit':_0x4227dc['options']?_0x4227dc['options']['limit']||null:null})[_0xd497('0x13')](function(_0xabad3f){logger[_0xd497('0x22')](_0xd497('0x1a'),_0x4227dc);logger[_0xd497('0x23')](_0xd497('0x1a'),_0x4227dc,JSON[_0xd497('0x24')](_0xabad3f));_0x2440a1(_0xabad3f);})['catch'](function(_0x3da642){logger[_0xd497('0x17')](_0xd497('0x1a'),_0x3da642[_0xd497('0x18')],_0x4227dc);_0x44e493(_0x2c1bb2[_0xd497('0x17')](0x1f4,_0x3da642[_0xd497('0x18')]));});});};exports[_0xd497('0x25')]=function(_0x1cd13d){return new Promise(function(_0x14ac5d,_0x333568){return db[_0xd497('0x1b')][_0xd497('0x26')]({'where':_0x1cd13d[_0xd497('0x1e')]?_0x1cd13d['options'][_0xd497('0x20')]||null:null})[_0xd497('0x13')](function(_0x414e66){if(_0x414e66){return _0x414e66[_0xd497('0x27')](_0x1cd13d['body'][_0xd497('0x28')],_[_0xd497('0x29')](_0x1cd13d['body'],[_0xd497('0x28'),'id'])||{});}})[_0xd497('0x2a')](function(_0x4b1b47){logger[_0xd497('0x22')](_0xd497('0x2b'),_0x1cd13d);logger[_0xd497('0x23')](_0xd497('0x2b'),_0x1cd13d,JSON[_0xd497('0x24')](_0x4b1b47));_0x14ac5d(_0x4b1b47);})[_0xd497('0x19')](function(_0x3a10fd){logger[_0xd497('0x17')](_0xd497('0x2b'),_0x3a10fd[_0xd497('0x18')],_0x1cd13d);_0x333568(_this['error'](0x1f4,_0x3a10fd[_0xd497('0x18')]));});});}; \ No newline at end of file +var _0x3511=['code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','body','spread','debug','AddTags','lodash','util','randomstring','ioredis','../../config/logger','redis','defaults','socket.io-emitter','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x535c63,_0x2464e9){var _0x2f5e71=function(_0x52e31e){while(--_0x52e31e){_0x535c63['push'](_0x535c63['shift']());}};_0x2f5e71(++_0x2464e9);}(_0x3511,0x1d1));var _0x1351=function(_0xbf7f20,_0x3f856e){_0xbf7f20=_0xbf7f20-0x0;var _0x5dc25d=_0x3511[_0xbf7f20];return _0x5dc25d;};'use strict';var _=require(_0x1351('0x0'));var util=require(_0x1351('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1351('0x2'));var fs=require('fs');var Redis=require(_0x1351('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1351('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x1351('0x5')]=_[_0x1351('0x6')](config[_0x1351('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x1351('0x7'))(new Redis(config[_0x1351('0x5')]));require('./faxInteraction.socket')[_0x1351('0x8')](socket);function respondWithRpcPromise(_0x1750e9,_0x22ac84,_0x4624f2){return new BPromise(function(_0x6881dc,_0x94a995){return client[_0x1351('0x9')](_0x1750e9,_0x4624f2)[_0x1351('0xa')](function(_0x4a454d){logger['info'](_0x1351('0xb'),_0x22ac84,_0x1351('0xc'));logger['debug'](_0x1351('0xd'),_0x22ac84,'request\x20sent',JSON[_0x1351('0xe')](_0x4a454d));if(_0x4a454d['error']){if(_0x4a454d[_0x1351('0xf')][_0x1351('0x10')]===0x1f4){logger[_0x1351('0xf')](_0x1351('0xb'),_0x22ac84,_0x4a454d[_0x1351('0xf')]['message']);return _0x94a995(_0x4a454d['error'][_0x1351('0x11')]);}logger[_0x1351('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x22ac84,_0x4a454d[_0x1351('0xf')]['message']);return _0x6881dc(_0x4a454d[_0x1351('0xf')][_0x1351('0x11')]);}else{logger[_0x1351('0x12')](_0x1351('0xb'),_0x22ac84,'request\x20sent');_0x6881dc(_0x4a454d[_0x1351('0x13')]['message']);}})[_0x1351('0x14')](function(_0x4c9cae){logger['error'](_0x1351('0xb'),_0x22ac84,_0x4c9cae);_0x94a995(_0x4c9cae);});});}exports[_0x1351('0x15')]=function(_0x5be228){var _0x27016d=this;return new Promise(function(_0xe9d577,_0xc1bac7){return db[_0x1351('0x16')][_0x1351('0x17')](_0x5be228['body'],{'raw':_0x5be228[_0x1351('0x18')]?_0x5be228['options'][_0x1351('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be228[_0x1351('0x18')]?_0x5be228[_0x1351('0x18')][_0x1351('0x1a')]||null:null,'attributes':_0x5be228[_0x1351('0x18')]?_0x5be228[_0x1351('0x18')][_0x1351('0x1b')]||null:null,'limit':_0x5be228['options']?_0x5be228[_0x1351('0x18')][_0x1351('0x1c')]||null:null})[_0x1351('0xa')](function(_0x79a6e8){logger[_0x1351('0x12')](_0x1351('0x15'),_0x5be228);logger['debug']('UpdateFaxInteraction',_0x5be228,JSON[_0x1351('0xe')](_0x79a6e8));_0xe9d577(_0x79a6e8);})[_0x1351('0x14')](function(_0xca2251){logger['error'](_0x1351('0x15'),_0xca2251[_0x1351('0x11')],_0x5be228);_0xc1bac7(_0x27016d['error'](0x1f4,_0xca2251[_0x1351('0x11')]));});});};exports[_0x1351('0x1d')]=function(_0x454d27){return new Promise(function(_0x3005f0,_0x7e7701){return db[_0x1351('0x16')][_0x1351('0x1e')]({'where':_0x454d27[_0x1351('0x18')]?_0x454d27['options']['where']||null:null})[_0x1351('0xa')](function(_0x2adaa1){if(_0x2adaa1){return _0x2adaa1[_0x1351('0x1f')](_0x454d27['body'][_0x1351('0x20')],_['omit'](_0x454d27[_0x1351('0x21')],[_0x1351('0x20'),'id'])||{});}})[_0x1351('0x22')](function(_0x4b207f){logger[_0x1351('0x12')]('AddTags',_0x454d27);logger[_0x1351('0x23')](_0x1351('0x24'),_0x454d27,JSON[_0x1351('0xe')](_0x4b207f));_0x3005f0(_0x4b207f);})['catch'](function(_0x4aa1eb){logger['error'](_0x1351('0x24'),_0x4aa1eb[_0x1351('0x11')],_0x454d27);_0x7e7701(_this['error'](0x1f4,_0x4aa1eb[_0x1351('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 44b4ba9..d3a0036 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 _0xfd31=['remove','emit','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd31,0x16a));var _0x1fd3=function(_0x43f29e,_0x43095f){_0x43f29e=_0x43f29e-0x0;var _0x2df664=_0xfd31[_0x43f29e];return _0x2df664;};'use strict';var FaxInteractionEvents=require(_0x1fd3('0x0'));var events=[_0x1fd3('0x1'),_0x1fd3('0x2'),'update'];function createListener(_0x3aee4e,_0x393ebe){return function(_0x4f5176){_0x393ebe[_0x1fd3('0x3')](_0x3aee4e,_0x4f5176);};}function removeListener(_0x54eb46,_0x26b691){return function(){FaxInteractionEvents['removeListener'](_0x54eb46,_0x26b691);};}exports[_0x1fd3('0x4')]=function(_0x2875f6){for(var _0x38fe8e=0x0,_0x3300eb=events[_0x1fd3('0x5')];_0x38fe8e<_0x3300eb;_0x38fe8e++){var _0xc89d4d=events[_0x38fe8e];var _0x54ef39=createListener(_0x1fd3('0x6')+_0xc89d4d,_0x2875f6);FaxInteractionEvents['on'](_0xc89d4d,_0x54ef39);}}; \ No newline at end of file +var _0xe62b=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x2587ca,_0x231303){var _0x5aada1=function(_0x2d21e1){while(--_0x2d21e1){_0x2587ca['push'](_0x2587ca['shift']());}};_0x5aada1(++_0x231303);}(_0xe62b,0x162));var _0xbe62=function(_0x426076,_0xfdf5d2){_0x426076=_0x426076-0x0;var _0x1e9565=_0xe62b[_0x426076];return _0x1e9565;};'use strict';var FaxInteractionEvents=require(_0xbe62('0x0'));var events=[_0xbe62('0x1'),_0xbe62('0x2'),_0xbe62('0x3')];function createListener(_0x4f69e8,_0x291ff9){return function(_0x267a7b){_0x291ff9[_0xbe62('0x4')](_0x4f69e8,_0x267a7b);};}function removeListener(_0x506887,_0x54312c){return function(){FaxInteractionEvents[_0xbe62('0x5')](_0x506887,_0x54312c);};}exports[_0xbe62('0x6')]=function(_0x22453f){for(var _0x25e768=0x0,_0x180741=events[_0xbe62('0x7')];_0x25e768<_0x180741;_0x25e768++){var _0x58a092=events[_0x25e768];var _0x9c2af3=createListener(_0xbe62('0x8')+_0x58a092,_0x22453f);FaxInteractionEvents['on'](_0x58a092,_0x9c2af3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 03cfbbb..c6a99f2 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 _0x8cb9=['/describe','describe','/:id','show','/:id/messages','isAuthenticated','getMessages','download','post','create','/:id/tags','tracked','fax','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index'];(function(_0x429c60,_0x237809){var _0x29ee2d=function(_0x2c118e){while(--_0x2c118e){_0x429c60['push'](_0x429c60['shift']());}};_0x29ee2d(++_0x237809);}(_0x8cb9,0x175));var _0x98cb=function(_0x263a74,_0x4e11b4){_0x263a74=_0x263a74-0x0;var _0x119e03=_0x8cb9[_0x263a74];return _0x119e03;};'use strict';var multer=require(_0x98cb('0x0'));var util=require(_0x98cb('0x1'));var path=require(_0x98cb('0x2'));var timeout=require(_0x98cb('0x3'));var express=require('express');var router=express[_0x98cb('0x4')]();var fs_extra=require(_0x98cb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x98cb('0x6'));var config=require(_0x98cb('0x7'));var controller=require(_0x98cb('0x8'));router[_0x98cb('0x9')]('/',auth['isAuthenticated'](),controller[_0x98cb('0xa')]);router[_0x98cb('0x9')](_0x98cb('0xb'),auth['isAuthenticated'](),controller[_0x98cb('0xc')]);router[_0x98cb('0x9')](_0x98cb('0xd'),auth['isAuthenticated'](),controller[_0x98cb('0xe')]);router[_0x98cb('0x9')](_0x98cb('0xf'),auth[_0x98cb('0x10')](),controller[_0x98cb('0x11')]);router[_0x98cb('0x9')]('/:id/download',auth[_0x98cb('0x10')](),controller[_0x98cb('0x12')]);router[_0x98cb('0x13')]('/',auth['isAuthenticated'](),controller[_0x98cb('0x14')]);router[_0x98cb('0x13')](_0x98cb('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x98cb('0x15'),auth[_0x98cb('0x10')](),interaction[_0x98cb('0x16')](_0x98cb('0x17'),'faxinteraction:addtags'),controller['addTags']);router[_0x98cb('0x18')](_0x98cb('0xd'),auth['isAuthenticated'](),interaction[_0x98cb('0x16')](_0x98cb('0x17'),_0x98cb('0x19')),controller[_0x98cb('0x1a')]);router[_0x98cb('0x1b')](_0x98cb('0xd'),auth[_0x98cb('0x10')](),interaction['tracked'](_0x98cb('0x17'),_0x98cb('0x1c')),controller[_0x98cb('0x1d')]);router['delete']('/:id/tags',auth[_0x98cb('0x10')](),controller[_0x98cb('0x1e')]);module[_0x98cb('0x1f')]=router; \ No newline at end of file +var _0x8b9a=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','exports','multer'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x8b9a,0x179));var _0xa8b9=function(_0x29fb8f,_0xeeeb0b){_0x29fb8f=_0x29fb8f-0x0;var _0x25dc93=_0x8b9a[_0x29fb8f];return _0x25dc93;};'use strict';var multer=require(_0xa8b9('0x0'));var util=require(_0xa8b9('0x1'));var path=require(_0xa8b9('0x2'));var timeout=require(_0xa8b9('0x3'));var express=require(_0xa8b9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa8b9('0x5'));var interaction=require(_0xa8b9('0x6'));var config=require('../../config/environment');var controller=require(_0xa8b9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa8b9('0x8')]('/describe',auth[_0xa8b9('0x9')](),controller[_0xa8b9('0xa')]);router['get'](_0xa8b9('0xb'),auth[_0xa8b9('0x9')](),controller[_0xa8b9('0xc')]);router['get'](_0xa8b9('0xd'),auth[_0xa8b9('0x9')](),controller[_0xa8b9('0xe')]);router[_0xa8b9('0x8')](_0xa8b9('0xf'),auth['isAuthenticated'](),controller[_0xa8b9('0x10')]);router[_0xa8b9('0x11')]('/',auth[_0xa8b9('0x9')](),controller['create']);router[_0xa8b9('0x11')](_0xa8b9('0xd'),auth[_0xa8b9('0x9')](),controller['addMessage']);router['post'](_0xa8b9('0x12'),auth['isAuthenticated'](),interaction[_0xa8b9('0x13')](_0xa8b9('0x14'),_0xa8b9('0x15')),controller[_0xa8b9('0x16')]);router[_0xa8b9('0x17')](_0xa8b9('0xb'),auth[_0xa8b9('0x9')](),interaction[_0xa8b9('0x13')](_0xa8b9('0x14'),_0xa8b9('0x18')),controller['update']);router[_0xa8b9('0x19')](_0xa8b9('0xb'),auth[_0xa8b9('0x9')](),interaction[_0xa8b9('0x13')](_0xa8b9('0x14'),'faxinteraction:destroy'),controller['destroy']);router['delete'](_0xa8b9('0x12'),auth[_0xa8b9('0x9')](),controller['removeTags']);module[_0xa8b9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 2569367..f0b1d23 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 _0x6ae0=['medium','out','sequelize','exports','TEXT'];(function(_0x18fe0a,_0x2c9a7f){var _0x5b9862=function(_0x1b12ff){while(--_0x1b12ff){_0x18fe0a['push'](_0x18fe0a['shift']());}};_0x5b9862(++_0x2c9a7f);}(_0x6ae0,0x192));var _0x06ae=function(_0x36d75a,_0xabad3a){_0x36d75a=_0x36d75a-0x0;var _0x3d0550=_0x6ae0[_0x36d75a];return _0x3d0550;};'use strict';var Sequelize=require(_0x06ae('0x0'));module[_0x06ae('0x1')]={'body':{'type':Sequelize[_0x06ae('0x2')](_0x06ae('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x06ae('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x06ae('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xf3cd=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x391747,_0x5853f7){var _0x15e572=function(_0x4f6caa){while(--_0x4f6caa){_0x391747['push'](_0x391747['shift']());}};_0x15e572(++_0x5853f7);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x43d0e6,_0x3c1489){_0x43d0e6=_0x43d0e6-0x0;var _0x51d841=_0xf3cd[_0x43d0e6];return _0x51d841;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'body':{'type':Sequelize[_0xdf3c('0x2')](_0xdf3c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdf3c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdf3c('0x5')]('in','out'),'defaultValue':_0xdf3c('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xdf3c('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xdf3c('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 22f4b2d..89ecaeb 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 _0xe6b0=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','FaxMessage','catch','show','length','options','find','body','params','describe','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','fax-interactions','fax','FaxInteractionId','role','RejectMessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','files','attachments','download','join','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','jayson/promise','http','client','request'];(function(_0x2f7892,_0x1c26c5){var _0x2f9e9c=function(_0x2755ba){while(--_0x2755ba){_0x2f7892['push'](_0x2f7892['shift']());}};_0x2f9e9c(++_0x1c26c5);}(_0xe6b0,0x6f));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e6b('0x0'));var jsonpatch=require(_0x0e6b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0e6b('0x2'));var Mustache=require(_0x0e6b('0x3'));var util=require(_0x0e6b('0x4'));var path=require('path');var sox=require(_0x0e6b('0x5'));var csv=require('to-csv');var ejs=require(_0x0e6b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e6b('0x7'));var squel=require(_0x0e6b('0x8'));var crypto=require(_0x0e6b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0e6b('0xa'));var toCsv=require(_0x0e6b('0xb'));var querystring=require(_0x0e6b('0xc'));var Papa=require('papaparse');var Redis=require(_0x0e6b('0xd'));var authService=require(_0x0e6b('0xe'));var qs=require(_0x0e6b('0xf'));var as=require(_0x0e6b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e6b('0x11'))(_0x0e6b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0e6b('0x13'));var db=require(_0x0e6b('0x14'))['db'];config[_0x0e6b('0x15')]=_[_0x0e6b('0x16')](config['redis'],{'host':_0x0e6b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e6b('0x15')]));require(_0x0e6b('0x18'))['register'](socket);var jayson=require(_0x0e6b('0x19'));var client=jayson['client'][_0x0e6b('0x1a')]({'port':0x232c});var client9002=jayson[_0x0e6b('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf830f0,_0x268043,_0x5ba44f,_0x516de6){return new BPromise(function(_0x2f6528,_0x442bf3){var _0x350def=_0x516de6||client;return _0x350def[_0x0e6b('0x1c')](_0xf830f0,_0x5ba44f)[_0x0e6b('0x1d')](function(_0x2a127e){logger[_0x0e6b('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x268043,_0x0e6b('0x1f'));logger[_0x0e6b('0x20')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x268043,'request\x20sent',JSON[_0x0e6b('0x21')](_0x2a127e));if(_0x2a127e['error']){if(_0x2a127e[_0x0e6b('0x22')][_0x0e6b('0x23')]===0x1f4){logger[_0x0e6b('0x22')](_0x0e6b('0x24'),_0x268043,_0x2a127e[_0x0e6b('0x22')][_0x0e6b('0x25')]);return _0x442bf3(_0x2a127e[_0x0e6b('0x22')][_0x0e6b('0x25')]);}logger[_0x0e6b('0x22')](_0x0e6b('0x24'),_0x268043,_0x2a127e[_0x0e6b('0x22')]['message']);return _0x2f6528(_0x2a127e[_0x0e6b('0x22')][_0x0e6b('0x25')]);}else{logger[_0x0e6b('0x1e')](_0x0e6b('0x24'),_0x268043,_0x0e6b('0x1f'));_0x2f6528(_0x2a127e[_0x0e6b('0x26')][_0x0e6b('0x25')]);}})['catch'](function(_0x1f6b97){logger[_0x0e6b('0x22')](_0x0e6b('0x24'),_0x268043,_0x1f6b97);_0x442bf3(_0x1f6b97);});});}function respondWithStatusCode(_0x32a82c,_0x4dc5ed){_0x4dc5ed=_0x4dc5ed||0xcc;return function(_0x366883){if(_0x366883){return _0x32a82c[_0x0e6b('0x27')](_0x4dc5ed);}return _0x32a82c[_0x0e6b('0x28')](_0x4dc5ed)[_0x0e6b('0x29')]();};}function respondWithResult(_0xb4c85b,_0x4ed0f5){_0x4ed0f5=_0x4ed0f5||0xc8;return function(_0x4af165){if(_0x4af165){return _0xb4c85b[_0x0e6b('0x28')](_0x4ed0f5)[_0x0e6b('0x2a')](_0x4af165);}};}function respondWithFilteredResult(_0x15b45a,_0x2e32aa){return function(_0x5d575f){if(_0x5d575f){var _0x433ef8=typeof _0x2e32aa[_0x0e6b('0x2b')]===_0x0e6b('0x2c')&&typeof _0x2e32aa['limit']===_0x0e6b('0x2c');var _0x2dad74=_0x5d575f[_0x0e6b('0x2d')];var _0x42615c=_0x433ef8?0x0:_0x2e32aa[_0x0e6b('0x2b')];var _0xba8019=_0x433ef8?_0x5d575f[_0x0e6b('0x2d')]:_0x2e32aa[_0x0e6b('0x2b')]+_0x2e32aa[_0x0e6b('0x2e')];var _0x3cd893;if(_0xba8019>=_0x2dad74){_0xba8019=_0x2dad74;_0x3cd893=0xc8;}else{_0x3cd893=0xce;}_0x15b45a[_0x0e6b('0x28')](_0x3cd893);return _0x15b45a[_0x0e6b('0x2f')](_0x0e6b('0x30'),_0x42615c+'-'+_0xba8019+'/'+_0x2dad74)[_0x0e6b('0x2a')](_0x5d575f);}return null;};}function patchUpdates(_0x337167){return function(_0x503817){try{jsonpatch[_0x0e6b('0x31')](_0x503817,_0x337167,!![]);}catch(_0x38d1bd){return BPromise[_0x0e6b('0x32')](_0x38d1bd);}return _0x503817[_0x0e6b('0x33')]();};}function saveUpdates(_0x343f6b,_0x42aff2){return function(_0xc1404f){if(_0xc1404f){return _0xc1404f[_0x0e6b('0x34')](_0x343f6b)[_0x0e6b('0x1d')](function(_0x265910){return _0x265910;});}return null;};}function removeEntity(_0x479aae,_0x353e03){return function(_0x2da132){if(_0x2da132){return _0x2da132[_0x0e6b('0x35')]()[_0x0e6b('0x1d')](function(){_0x479aae[_0x0e6b('0x28')](0xcc)[_0x0e6b('0x29')]();});}};}function handleEntityNotFound(_0x2ec371,_0xb9e86c){return function(_0x2ad588){if(!_0x2ad588){_0x2ec371['sendStatus'](0x194);}return _0x2ad588;};}function handleError(_0x2eebbe,_0xa0667){_0xa0667=_0xa0667||0x1f4;return function(_0x1eecdd){logger[_0x0e6b('0x22')](_0x1eecdd[_0x0e6b('0x36')]);if(_0x1eecdd[_0x0e6b('0x37')]){delete _0x1eecdd[_0x0e6b('0x37')];}_0x2eebbe[_0x0e6b('0x28')](_0xa0667)['send'](_0x1eecdd);};}exports[_0x0e6b('0x38')]=function(_0x246974,_0x43bba6){var _0x2fb315={},_0x28eeb0={},_0x38288d={'count':0x0,'rows':[]};var _0x4222dc=_[_0x0e6b('0x39')](db['FaxMessage'][_0x0e6b('0x3a')],function(_0x1e2477){return{'name':_0x1e2477['fieldName'],'type':_0x1e2477[_0x0e6b('0x3b')][_0x0e6b('0x3c')]};});_0x28eeb0['model']=_[_0x0e6b('0x39')](_0x4222dc,'name');_0x28eeb0[_0x0e6b('0x3d')]=_[_0x0e6b('0x3e')](_0x246974[_0x0e6b('0x3d')]);_0x28eeb0[_0x0e6b('0x3f')]=_['intersection'](_0x28eeb0['model'],_0x28eeb0['query']);_0x2fb315[_0x0e6b('0x40')]=_[_0x0e6b('0x41')](_0x28eeb0[_0x0e6b('0x42')],qs[_0x0e6b('0x43')](_0x246974[_0x0e6b('0x3d')][_0x0e6b('0x43')]));_0x2fb315[_0x0e6b('0x40')]=_0x2fb315[_0x0e6b('0x40')]['length']?_0x2fb315[_0x0e6b('0x40')]:_0x28eeb0[_0x0e6b('0x42')];if(!_0x246974[_0x0e6b('0x3d')][_0x0e6b('0x44')](_0x0e6b('0x45'))){_0x2fb315[_0x0e6b('0x2e')]=qs['limit'](_0x246974[_0x0e6b('0x3d')][_0x0e6b('0x2e')]);_0x2fb315[_0x0e6b('0x2b')]=qs[_0x0e6b('0x2b')](_0x246974['query']['offset']);}_0x2fb315[_0x0e6b('0x46')]=qs[_0x0e6b('0x47')](_0x246974[_0x0e6b('0x3d')][_0x0e6b('0x47')]);_0x2fb315['where']=qs[_0x0e6b('0x3f')](_[_0x0e6b('0x48')](_0x246974[_0x0e6b('0x3d')],_0x28eeb0[_0x0e6b('0x3f')]),_0x4222dc);if(_0x246974[_0x0e6b('0x3d')][_0x0e6b('0x49')]){_0x2fb315[_0x0e6b('0x4a')]=_[_0x0e6b('0x4b')](_0x2fb315[_0x0e6b('0x4a')],{'$or':_[_0x0e6b('0x39')](_0x4222dc,function(_0x2a6b12){if(_0x2a6b12['type']!=='VIRTUAL'){var _0x2c5309={};_0x2c5309[_0x2a6b12['name']]={'$like':'%'+_0x246974[_0x0e6b('0x3d')][_0x0e6b('0x49')]+'%'};return _0x2c5309;}})});}_0x2fb315=_[_0x0e6b('0x4b')]({},_0x2fb315,_0x246974['options']);var _0x1713b6={'where':_0x2fb315[_0x0e6b('0x4a')]};return db['FaxMessage'][_0x0e6b('0x2d')](_0x1713b6)['then'](function(_0x1863a5){_0x38288d[_0x0e6b('0x2d')]=_0x1863a5;if(_0x246974[_0x0e6b('0x3d')][_0x0e6b('0x4c')]){_0x2fb315[_0x0e6b('0x4d')]=[{'all':!![]}];}return db[_0x0e6b('0x4e')]['findAll'](_0x2fb315);})[_0x0e6b('0x1d')](function(_0x2e8fdb){_0x38288d['rows']=_0x2e8fdb;return _0x38288d;})[_0x0e6b('0x1d')](respondWithFilteredResult(_0x43bba6,_0x2fb315))[_0x0e6b('0x4f')](handleError(_0x43bba6,null));};exports[_0x0e6b('0x50')]=function(_0x472600,_0xf96f03){var _0x11dfad={'raw':!![],'where':{'id':_0x472600['params']['id']}},_0x948bce={};_0x948bce[_0x0e6b('0x42')]=_[_0x0e6b('0x3e')](db[_0x0e6b('0x4e')]['rawAttributes']);_0x948bce['query']=_[_0x0e6b('0x3e')](_0x472600[_0x0e6b('0x3d')]);_0x948bce[_0x0e6b('0x3f')]=_['intersection'](_0x948bce[_0x0e6b('0x42')],_0x948bce['query']);_0x11dfad[_0x0e6b('0x40')]=_[_0x0e6b('0x41')](_0x948bce[_0x0e6b('0x42')],qs[_0x0e6b('0x43')](_0x472600['query'][_0x0e6b('0x43')]));_0x11dfad[_0x0e6b('0x40')]=_0x11dfad[_0x0e6b('0x40')][_0x0e6b('0x51')]?_0x11dfad['attributes']:_0x948bce[_0x0e6b('0x42')];if(_0x472600[_0x0e6b('0x3d')]['includeAll']){_0x11dfad[_0x0e6b('0x4d')]=[{'all':!![]}];}_0x11dfad=_[_0x0e6b('0x4b')]({},_0x11dfad,_0x472600[_0x0e6b('0x52')]);return db['FaxMessage'][_0x0e6b('0x53')](_0x11dfad)[_0x0e6b('0x1d')](handleEntityNotFound(_0xf96f03,null))['then'](respondWithResult(_0xf96f03,null))['catch'](handleError(_0xf96f03,null));};exports[_0x0e6b('0x34')]=function(_0x3fd98f,_0x3e74d2){if(_0x3fd98f[_0x0e6b('0x54')]['id']){delete _0x3fd98f[_0x0e6b('0x54')]['id'];}return db[_0x0e6b('0x4e')]['find']({'where':{'id':_0x3fd98f[_0x0e6b('0x55')]['id']}})['then'](handleEntityNotFound(_0x3e74d2,null))['then'](saveUpdates(_0x3fd98f[_0x0e6b('0x54')],null))[_0x0e6b('0x1d')](respondWithResult(_0x3e74d2,null))[_0x0e6b('0x4f')](handleError(_0x3e74d2,null));};exports[_0x0e6b('0x35')]=function(_0x49bdfb,_0x176fe4){return db['FaxMessage'][_0x0e6b('0x53')]({'where':{'id':_0x49bdfb[_0x0e6b('0x55')]['id']}})['then'](handleEntityNotFound(_0x176fe4,null))[_0x0e6b('0x1d')](removeEntity(_0x176fe4,null))[_0x0e6b('0x4f')](handleError(_0x176fe4,null));};exports[_0x0e6b('0x56')]=function(_0x568bd3,_0x25c596){return db[_0x0e6b('0x4e')][_0x0e6b('0x56')]()['then'](respondWithResult(_0x25c596,null))[_0x0e6b('0x4f')](handleError(_0x25c596,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0x5719ff,_0x12d2b5,_0x444d21){var _0x4389e3={'agent':{},'channel':'fax'};if(_0x5719ff[_0x0e6b('0x54')]['id']){delete _0x5719ff[_0x0e6b('0x54')]['id'];}_0x5719ff['body'][_0x0e6b('0x57')]=!![];_0x5719ff[_0x0e6b('0x54')][_0x0e6b('0x58')]=moment()[_0x0e6b('0x59')](_0x0e6b('0x5a'));_0x5719ff['body'][_0x0e6b('0x5b')]=_0x5719ff[_0x0e6b('0x54')]['UserId']||_0x5719ff[_0x0e6b('0x5c')]['id'];_0x4389e3['agent']['id']=_0x5719ff[_0x0e6b('0x54')][_0x0e6b('0x5b')];return db[_0x0e6b('0x4e')]['find']({'where':{'id':_0x5719ff[_0x0e6b('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x12d2b5,null))[_0x0e6b('0x1d')](saveUpdates(_0x5719ff[_0x0e6b('0x54')],null))['then'](function(_0x2dac26){if(_0x2dac26){_0x4389e3[_0x0e6b('0x25')]=_0x2dac26[_0x0e6b('0x5d')]({'plain':!![]});return db[_0x0e6b('0x5e')][_0x0e6b('0x53')]({'where':{'id':_0x2dac26['FaxInteractionId']}});}return null;})[_0x0e6b('0x1d')](handleEntityNotFound(_0x12d2b5,null))['then'](function(_0x2c1b42){if(_0x2c1b42){return _0x2c1b42['update']({'UserId':_0x5719ff['body'][_0x0e6b('0x5b')],'read1stAt':_[_0x0e6b('0x5f')](_0x2c1b42[_0x0e6b('0x60')])?moment()[_0x0e6b('0x59')](_0x0e6b('0x5a')):undefined});}return null;})[_0x0e6b('0x1d')](function(_0x552aad){if(_0x552aad){_0x4389e3[_0x0e6b('0x61')]=_0x552aad[_0x0e6b('0x5d')]({'plain':!![]});interaction_log[_0x0e6b('0x1e')](_0x0e6b('0x62'),_0x5719ff[_0x0e6b('0x5c')]['id'],_0x5719ff[_0x0e6b('0x5c')][_0x0e6b('0x37')],_0x5719ff['user']['role'],_0x4389e3[_0x0e6b('0x61')]['id'],_0x5719ff[_0x0e6b('0x54')]?JSON[_0x0e6b('0x21')](_0x5719ff['body']):_0x0e6b('0x63'));return respondWithRpcPromise('AcceptMessage',_0x0e6b('0x64'),_0x4389e3);}return null;})[_0x0e6b('0x1d')](function(_0x5d0c63){var _0x53d99e=_0x0e6b('0x65')+_0x5d0c63['message'][_0x0e6b('0x66')];return db[_0x0e6b('0x67')]['query'](_0x53d99e,{'type':db[_0x0e6b('0x68')][_0x0e6b('0x69')][_0x0e6b('0x6a')],'raw':!![]})['then'](function(_0x529d6c){return _0x529d6c;});})[_0x0e6b('0x1d')](function(_0x213642){if(_0x213642){_0x4389e3[_0x0e6b('0x25')][_0x0e6b('0x6b')]=_0x213642[0x0];if(!_0x5719ff[_0x0e6b('0x54')][_0x0e6b('0x5b')])return;return db[_0x0e6b('0x6c')]['find']({'where':{'id':_0x5719ff['body'][_0x0e6b('0x5b')],'role':_0x0e6b('0x6d')},'attributes':['id','name',_0x0e6b('0x6e'),_0x0e6b('0x6f'),_0x0e6b('0x70')],'raw':!![]});}return null;})[_0x0e6b('0x1d')](function(_0x320310){if(!_0x320310)return null;_0x4389e3[_0x0e6b('0x25')][_0x0e6b('0x6d')]=_0x320310;return _0x4389e3;})[_0x0e6b('0x1d')](function(_0x18040a){if(_0x18040a){if(_0x5719ff['body'][_0x0e6b('0x71')]){_0x4389e3[_0x0e6b('0x25')][_0x0e6b('0x72')]=util['format'](_0x0e6b('0x73'),_0x5719ff[_0x0e6b('0x5c')][_0x0e6b('0x37')]);_0x4389e3[_0x0e6b('0x25')]['channel']=_0x4389e3[_0x0e6b('0x74')];_0x4389e3[_0x0e6b('0x25')][_0x0e6b('0x75')]=_0x4389e3[_0x0e6b('0x74')];_0x4389e3['message'][_0x0e6b('0x76')]=_0x0e6b('0x77');return respondWithRpcPromise('EventManager',_0x0e6b('0x78'),{'event':_0x0e6b('0x79'),'message':_0x4389e3['message']},client9002)[_0x0e6b('0x1d')](function(){return _0x4389e3;});}return _0x4389e3;}return null;})[_0x0e6b('0x1d')](respondWithResult(_0x12d2b5,null))[_0x0e6b('0x4f')](handleError(_0x12d2b5,null));};var interaction_log=require('../../config/logger')(_0x0e6b('0x7a'));exports[_0x0e6b('0x32')]=function(_0x2bfed0,_0x2733df,_0x5908fd){var _0x5cd0b8={'agent':{},'channel':_0x0e6b('0x7b')};if(_0x2bfed0[_0x0e6b('0x54')]['id']){delete _0x2bfed0[_0x0e6b('0x54')]['id'];}_0x2bfed0[_0x0e6b('0x54')][_0x0e6b('0x5b')]=_0x2bfed0['body'][_0x0e6b('0x5b')]||_0x2bfed0[_0x0e6b('0x5c')]['id'];_0x5cd0b8['agent']['id']=_0x2bfed0['body']['UserId'];return db[_0x0e6b('0x4e')][_0x0e6b('0x53')]({'where':{'id':_0x2bfed0[_0x0e6b('0x55')]['id'],'UserId':null}})[_0x0e6b('0x1d')](handleEntityNotFound(_0x2733df,null))['then'](function(_0x518446){if(_0x518446){_0x5cd0b8[_0x0e6b('0x25')]=_0x518446[_0x0e6b('0x5d')]({'plain':!![]});return db[_0x0e6b('0x5e')][_0x0e6b('0x53')]({'where':{'id':_0x518446[_0x0e6b('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x2733df,null))[_0x0e6b('0x1d')](function(_0x279808){if(_0x279808){_0x5cd0b8[_0x0e6b('0x61')]=_0x279808[_0x0e6b('0x5d')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2bfed0[_0x0e6b('0x5c')]['id'],_0x2bfed0[_0x0e6b('0x5c')]['name'],_0x2bfed0['user'][_0x0e6b('0x7d')],_0x5cd0b8[_0x0e6b('0x61')]['id'],_0x2bfed0['body']?JSON[_0x0e6b('0x21')](_0x2bfed0[_0x0e6b('0x54')]):_0x0e6b('0x63'));return respondWithRpcPromise(_0x0e6b('0x7e'),'rejectMessage',_0x5cd0b8);}return null;})[_0x0e6b('0x1d')](function(_0x5e19c8){var _0x32031e=_0x0e6b('0x65')+_0x5e19c8[_0x0e6b('0x25')]['ContactId'];return db[_0x0e6b('0x67')]['query'](_0x32031e,{'type':db['Sequelize'][_0x0e6b('0x69')]['SELECT'],'raw':!![]})[_0x0e6b('0x1d')](function(_0x1a4b81){return _0x1a4b81;});})[_0x0e6b('0x1d')](function(_0x3a4893){if(_0x3a4893){_0x5cd0b8[_0x0e6b('0x25')][_0x0e6b('0x6b')]=_0x3a4893[0x0];if(!_0x2bfed0[_0x0e6b('0x54')][_0x0e6b('0x5b')])return;return db[_0x0e6b('0x6c')]['find']({'where':{'id':_0x2bfed0[_0x0e6b('0x54')][_0x0e6b('0x5b')],'role':_0x0e6b('0x6d')},'attributes':['id',_0x0e6b('0x37'),_0x0e6b('0x6e'),'email',_0x0e6b('0x70')],'raw':!![]});}return null;})['then'](function(_0x3ccd14){if(!_0x3ccd14)return null;_0x5cd0b8[_0x0e6b('0x25')]['agent']=_0x3ccd14;return _0x5cd0b8;})['then'](function(_0x114d8b){if(_0x114d8b){_0x114d8b[_0x0e6b('0x25')][_0x0e6b('0x72')]=util[_0x0e6b('0x59')]('SIP/%s',_0x2bfed0[_0x0e6b('0x5c')][_0x0e6b('0x37')]);_0x114d8b['message'][_0x0e6b('0x74')]=_0x5cd0b8['channel'];_0x114d8b[_0x0e6b('0x25')][_0x0e6b('0x75')]=_0x5cd0b8[_0x0e6b('0x74')];_0x114d8b[_0x0e6b('0x25')][_0x0e6b('0x76')]='reject';respondWithRpcPromise('EventManager',_0x0e6b('0x78'),{'event':'rejectmessage','message':_0x114d8b['message']},client9002);return _0x5cd0b8;}return null;})[_0x0e6b('0x1d')](respondWithResult(_0x2733df,null))[_0x0e6b('0x4f')](handleError(_0x2733df,null));};exports[_0x0e6b('0x7f')]=function(_0x1a8a94,_0x5a7898){var _0x7f5546;return db[_0x0e6b('0x4e')][_0x0e6b('0x7f')](_0x1a8a94[_0x0e6b('0x54')],{})[_0x0e6b('0x1d')](function(_0x16e51c){_0x7f5546=_0x16e51c;return db['CmContact'][_0x0e6b('0x80')]({'where':{'id':_0x7f5546[_0x0e6b('0x66')]}});})[_0x0e6b('0x1d')](function(_0x1ea19c){if(_[_0x0e6b('0x5f')](_0x1ea19c)){return;}else{_0x7f5546[_0x0e6b('0x7b')]=_0x1ea19c[_0x0e6b('0x7b')];return db[_0x0e6b('0x81')]['findOne']({'where':{'id':_0x7f5546[_0x0e6b('0x82')]}});}})[_0x0e6b('0x1d')](function(_0x4c5cc0){return respondWithRpcPromise(_0x0e6b('0x83'),_0x0e6b('0x83'),{'FaxAccountId':_['isNil'](_0x1a8a94['body'])?undefined:_0x1a8a94['body'][_0x0e6b('0x84')],'path':_[_0x0e6b('0x5f')](_0x4c5cc0)?undefined:util[_0x0e6b('0x59')](_0x0e6b('0x85'),_0x4c5cc0[_0x0e6b('0x86')]),'fax':_[_0x0e6b('0x5f')](_0x7f5546[_0x0e6b('0x7b')])?undefined:_0x7f5546[_0x0e6b('0x7b')],'AttachmentId':_0x7f5546[_0x0e6b('0x82')]},client9002);})[_0x0e6b('0x1d')](respondWithResult(_0x5a7898,0xc9))['catch'](handleError(_0x5a7898,null));};exports['download']=function(_0x28e3ca,_0x1c56ac){var _0x148ed4=path['join'](config[_0x0e6b('0x87')],'server',_0x0e6b('0x88'),_0x0e6b('0x89'));return db[_0x0e6b('0x4e')][_0x0e6b('0x53')]({'where':{'id':_0x28e3ca[_0x0e6b('0x55')]['id']},'include':[{'model':db[_0x0e6b('0x81')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x1c56ac,null))[_0x0e6b('0x1d')](function(_0x343ddd){if(_0x343ddd){return _0x1c56ac[_0x0e6b('0x8a')](path[_0x0e6b('0x8b')](_0x148ed4,_0x343ddd[_0x0e6b('0x81')]['basename']));}})[_0x0e6b('0x4f')](handleError(_0x1c56ac,null));}; \ No newline at end of file +var _0xedd2=['code','FaxMessage,\x20%s,\x20%s','error','message','result','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','end','sendStatus','stack','name','index','map','FaxMessage','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','body','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','create','findOne','Attachment','SendFax','FaxAccountId','basename','AttachmentId','join','root','server','attachments','download','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x16b6e3,_0x5616f5){var _0x4732cf=function(_0x144ae1){while(--_0x144ae1){_0x16b6e3['push'](_0x16b6e3['shift']());}};_0x4732cf(++_0x5616f5);}(_0xedd2,0xf0));var _0x2edd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xedd2[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x2edd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2edd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2edd('0x2'));var moment=require(_0x2edd('0x3'));var BPromise=require(_0x2edd('0x4'));var Mustache=require(_0x2edd('0x5'));var util=require(_0x2edd('0x6'));var path=require(_0x2edd('0x7'));var sox=require(_0x2edd('0x8'));var csv=require(_0x2edd('0x9'));var ejs=require(_0x2edd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2edd('0xb'));var squel=require(_0x2edd('0xc'));var crypto=require(_0x2edd('0xd'));var jsforce=require(_0x2edd('0xe'));var deskjs=require(_0x2edd('0xf'));var toCsv=require(_0x2edd('0x9'));var querystring=require(_0x2edd('0x10'));var Papa=require(_0x2edd('0x11'));var Redis=require(_0x2edd('0x12'));var authService=require(_0x2edd('0x13'));var qs=require(_0x2edd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2edd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2edd('0x16'));var db=require(_0x2edd('0x17'))['db'];config[_0x2edd('0x18')]=_[_0x2edd('0x19')](config['redis'],{'host':_0x2edd('0x1a'),'port':0x18eb});var socket=require(_0x2edd('0x1b'))(new Redis(config[_0x2edd('0x18')]));require(_0x2edd('0x1c'))[_0x2edd('0x1d')](socket);var jayson=require(_0x2edd('0x1e'));var client=jayson[_0x2edd('0x1f')][_0x2edd('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x2edd('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x39c8d8,_0x2d6843,_0x2cbb34,_0x1a65fd){return new BPromise(function(_0x1a1f4e,_0x446255){var _0x7bb293=_0x1a65fd||client;return _0x7bb293[_0x2edd('0x21')](_0x39c8d8,_0x2cbb34)[_0x2edd('0x22')](function(_0x4c984b){logger[_0x2edd('0x23')]('FaxMessage,\x20%s,\x20%s',_0x2d6843,'request\x20sent');logger[_0x2edd('0x24')](_0x2edd('0x25'),_0x2d6843,_0x2edd('0x26'),JSON[_0x2edd('0x27')](_0x4c984b));if(_0x4c984b['error']){if(_0x4c984b['error'][_0x2edd('0x28')]===0x1f4){logger['error'](_0x2edd('0x29'),_0x2d6843,_0x4c984b[_0x2edd('0x2a')]['message']);return _0x446255(_0x4c984b['error'][_0x2edd('0x2b')]);}logger[_0x2edd('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x2d6843,_0x4c984b[_0x2edd('0x2a')][_0x2edd('0x2b')]);return _0x1a1f4e(_0x4c984b[_0x2edd('0x2a')][_0x2edd('0x2b')]);}else{logger[_0x2edd('0x23')](_0x2edd('0x29'),_0x2d6843,_0x2edd('0x26'));_0x1a1f4e(_0x4c984b[_0x2edd('0x2c')]['message']);}})['catch'](function(_0x10e3db){logger[_0x2edd('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x2d6843,_0x10e3db);_0x446255(_0x10e3db);});});}function respondWithStatusCode(_0x13109b,_0x4fe1dc){_0x4fe1dc=_0x4fe1dc||0xcc;return function(_0x4a000b){if(_0x4a000b){return _0x13109b['sendStatus'](_0x4fe1dc);}return _0x13109b[_0x2edd('0x2d')](_0x4fe1dc)['end']();};}function respondWithResult(_0x5b1bb9,_0x178413){_0x178413=_0x178413||0xc8;return function(_0x4cd03b){if(_0x4cd03b){return _0x5b1bb9[_0x2edd('0x2d')](_0x178413)[_0x2edd('0x2e')](_0x4cd03b);}};}function respondWithFilteredResult(_0x5235e7,_0x48d8e9){return function(_0xb3f02f){if(_0xb3f02f){var _0x4e0605=typeof _0x48d8e9[_0x2edd('0x2f')]===_0x2edd('0x30')&&typeof _0x48d8e9[_0x2edd('0x31')]==='undefined';var _0x26deb1=_0xb3f02f[_0x2edd('0x32')];var _0x2bdecb=_0x4e0605?0x0:_0x48d8e9[_0x2edd('0x2f')];var _0x5f5012=_0x4e0605?_0xb3f02f[_0x2edd('0x32')]:_0x48d8e9[_0x2edd('0x2f')]+_0x48d8e9[_0x2edd('0x31')];var _0x1f9bd0;if(_0x5f5012>=_0x26deb1){_0x5f5012=_0x26deb1;_0x1f9bd0=0xc8;}else{_0x1f9bd0=0xce;}_0x5235e7['status'](_0x1f9bd0);return _0x5235e7[_0x2edd('0x33')](_0x2edd('0x34'),_0x2bdecb+'-'+_0x5f5012+'/'+_0x26deb1)[_0x2edd('0x2e')](_0xb3f02f);}return null;};}function patchUpdates(_0x55c623){return function(_0x3f2242){try{jsonpatch[_0x2edd('0x35')](_0x3f2242,_0x55c623,!![]);}catch(_0x32dbc0){return BPromise[_0x2edd('0x36')](_0x32dbc0);}return _0x3f2242[_0x2edd('0x37')]();};}function saveUpdates(_0x3b83f3,_0x431ccb){return function(_0xc66997){if(_0xc66997){return _0xc66997[_0x2edd('0x38')](_0x3b83f3)[_0x2edd('0x22')](function(_0x17512f){return _0x17512f;});}return null;};}function removeEntity(_0x10af06,_0x4cd119){return function(_0x4d860c){if(_0x4d860c){return _0x4d860c['destroy']()[_0x2edd('0x22')](function(){_0x10af06[_0x2edd('0x2d')](0xcc)[_0x2edd('0x39')]();});}};}function handleEntityNotFound(_0x310999,_0x1d03cc){return function(_0x2430e9){if(!_0x2430e9){_0x310999[_0x2edd('0x3a')](0x194);}return _0x2430e9;};}function handleError(_0x5948bc,_0xabcdd7){_0xabcdd7=_0xabcdd7||0x1f4;return function(_0x37e754){logger[_0x2edd('0x2a')](_0x37e754[_0x2edd('0x3b')]);if(_0x37e754['name']){delete _0x37e754[_0x2edd('0x3c')];}_0x5948bc[_0x2edd('0x2d')](_0xabcdd7)['send'](_0x37e754);};}exports[_0x2edd('0x3d')]=function(_0x1421c8,_0x2058db){var _0x1bbee1={},_0x172b52={},_0x484e71={'count':0x0,'rows':[]};var _0x5e6b9b=_[_0x2edd('0x3e')](db[_0x2edd('0x3f')][_0x2edd('0x40')],function(_0x38cd8b){return{'name':_0x38cd8b['fieldName'],'type':_0x38cd8b[_0x2edd('0x41')][_0x2edd('0x42')]};});_0x172b52[_0x2edd('0x43')]=_[_0x2edd('0x3e')](_0x5e6b9b,_0x2edd('0x3c'));_0x172b52['query']=_[_0x2edd('0x44')](_0x1421c8[_0x2edd('0x45')]);_0x172b52['filters']=_[_0x2edd('0x46')](_0x172b52['model'],_0x172b52['query']);_0x1bbee1[_0x2edd('0x47')]=_[_0x2edd('0x46')](_0x172b52['model'],qs[_0x2edd('0x48')](_0x1421c8[_0x2edd('0x45')][_0x2edd('0x48')]));_0x1bbee1[_0x2edd('0x47')]=_0x1bbee1[_0x2edd('0x47')][_0x2edd('0x49')]?_0x1bbee1[_0x2edd('0x47')]:_0x172b52[_0x2edd('0x43')];if(!_0x1421c8['query'][_0x2edd('0x4a')](_0x2edd('0x4b'))){_0x1bbee1[_0x2edd('0x31')]=qs[_0x2edd('0x31')](_0x1421c8['query'][_0x2edd('0x31')]);_0x1bbee1[_0x2edd('0x2f')]=qs[_0x2edd('0x2f')](_0x1421c8[_0x2edd('0x45')][_0x2edd('0x2f')]);}_0x1bbee1['order']=qs[_0x2edd('0x4c')](_0x1421c8[_0x2edd('0x45')][_0x2edd('0x4c')]);_0x1bbee1[_0x2edd('0x4d')]=qs[_0x2edd('0x4e')](_['pick'](_0x1421c8[_0x2edd('0x45')],_0x172b52[_0x2edd('0x4e')]),_0x5e6b9b);if(_0x1421c8[_0x2edd('0x45')]['filter']){_0x1bbee1[_0x2edd('0x4d')]=_[_0x2edd('0x4f')](_0x1bbee1[_0x2edd('0x4d')],{'$or':_[_0x2edd('0x3e')](_0x5e6b9b,function(_0x14cc67){if(_0x14cc67[_0x2edd('0x41')]!==_0x2edd('0x50')){var _0x177908={};_0x177908[_0x14cc67['name']]={'$like':'%'+_0x1421c8['query']['filter']+'%'};return _0x177908;}})});}_0x1bbee1=_['merge']({},_0x1bbee1,_0x1421c8['options']);var _0x281c6d={'where':_0x1bbee1[_0x2edd('0x4d')]};return db[_0x2edd('0x3f')][_0x2edd('0x32')](_0x281c6d)['then'](function(_0x2a0466){_0x484e71[_0x2edd('0x32')]=_0x2a0466;if(_0x1421c8[_0x2edd('0x45')][_0x2edd('0x51')]){_0x1bbee1[_0x2edd('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1bbee1);})[_0x2edd('0x22')](function(_0x4896cf){_0x484e71[_0x2edd('0x53')]=_0x4896cf;return _0x484e71;})[_0x2edd('0x22')](respondWithFilteredResult(_0x2058db,_0x1bbee1))[_0x2edd('0x54')](handleError(_0x2058db,null));};exports['show']=function(_0x49c5df,_0x4b419e){var _0x2bf6e2={'raw':!![],'where':{'id':_0x49c5df[_0x2edd('0x55')]['id']}},_0x5e2f88={};_0x5e2f88[_0x2edd('0x43')]=_['keys'](db[_0x2edd('0x3f')][_0x2edd('0x40')]);_0x5e2f88[_0x2edd('0x45')]=_[_0x2edd('0x44')](_0x49c5df[_0x2edd('0x45')]);_0x5e2f88[_0x2edd('0x4e')]=_['intersection'](_0x5e2f88['model'],_0x5e2f88[_0x2edd('0x45')]);_0x2bf6e2['attributes']=_[_0x2edd('0x46')](_0x5e2f88[_0x2edd('0x43')],qs[_0x2edd('0x48')](_0x49c5df[_0x2edd('0x45')][_0x2edd('0x48')]));_0x2bf6e2[_0x2edd('0x47')]=_0x2bf6e2['attributes'][_0x2edd('0x49')]?_0x2bf6e2[_0x2edd('0x47')]:_0x5e2f88[_0x2edd('0x43')];if(_0x49c5df['query'][_0x2edd('0x51')]){_0x2bf6e2[_0x2edd('0x52')]=[{'all':!![]}];}_0x2bf6e2=_[_0x2edd('0x4f')]({},_0x2bf6e2,_0x49c5df[_0x2edd('0x56')]);return db[_0x2edd('0x3f')][_0x2edd('0x57')](_0x2bf6e2)[_0x2edd('0x22')](handleEntityNotFound(_0x4b419e,null))['then'](respondWithResult(_0x4b419e,null))[_0x2edd('0x54')](handleError(_0x4b419e,null));};exports[_0x2edd('0x38')]=function(_0x525ed6,_0x354cda){if(_0x525ed6['body']['id']){delete _0x525ed6[_0x2edd('0x58')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x525ed6[_0x2edd('0x55')]['id']}})[_0x2edd('0x22')](handleEntityNotFound(_0x354cda,null))['then'](saveUpdates(_0x525ed6['body'],null))['then'](respondWithResult(_0x354cda,null))['catch'](handleError(_0x354cda,null));};exports['destroy']=function(_0x48ae43,_0x475418){return db[_0x2edd('0x3f')]['find']({'where':{'id':_0x48ae43[_0x2edd('0x55')]['id']}})['then'](handleEntityNotFound(_0x475418,null))[_0x2edd('0x22')](removeEntity(_0x475418,null))[_0x2edd('0x54')](handleError(_0x475418,null));};exports['describe']=function(_0x514ecb,_0xd75433){return db[_0x2edd('0x3f')][_0x2edd('0x59')]()[_0x2edd('0x22')](respondWithResult(_0xd75433,null))[_0x2edd('0x54')](handleError(_0xd75433,null));};var interaction_log=require('../../config/logger')(_0x2edd('0x5a'));exports[_0x2edd('0x5b')]=function(_0x52017f,_0x590d68,_0xd3043a){var _0x4d9fe6={'agent':{},'channel':_0x2edd('0x5c')};if(_0x52017f[_0x2edd('0x58')]['id']){delete _0x52017f[_0x2edd('0x58')]['id'];}_0x52017f[_0x2edd('0x58')][_0x2edd('0x5d')]=!![];_0x52017f[_0x2edd('0x58')]['readAt']=moment()[_0x2edd('0x5e')](_0x2edd('0x5f'));_0x52017f[_0x2edd('0x58')][_0x2edd('0x60')]=_0x52017f[_0x2edd('0x58')][_0x2edd('0x60')]||_0x52017f[_0x2edd('0x61')]['id'];_0x4d9fe6[_0x2edd('0x62')]['id']=_0x52017f[_0x2edd('0x58')][_0x2edd('0x60')];return db[_0x2edd('0x3f')]['find']({'where':{'id':_0x52017f[_0x2edd('0x55')]['id'],'UserId':null}})[_0x2edd('0x22')](handleEntityNotFound(_0x590d68,null))[_0x2edd('0x22')](saveUpdates(_0x52017f[_0x2edd('0x58')],null))[_0x2edd('0x22')](function(_0x1d50af){if(_0x1d50af){_0x4d9fe6[_0x2edd('0x2b')]=_0x1d50af[_0x2edd('0x63')]({'plain':!![]});return db[_0x2edd('0x64')][_0x2edd('0x57')]({'where':{'id':_0x1d50af[_0x2edd('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x590d68,null))[_0x2edd('0x22')](function(_0x3320dd){if(_0x3320dd){return _0x3320dd[_0x2edd('0x38')]({'UserId':_0x52017f[_0x2edd('0x58')][_0x2edd('0x60')],'read1stAt':_[_0x2edd('0x66')](_0x3320dd[_0x2edd('0x67')])?moment()['format'](_0x2edd('0x5f')):undefined});}return null;})[_0x2edd('0x22')](function(_0x424253){if(_0x424253){_0x4d9fe6[_0x2edd('0x68')]=_0x424253[_0x2edd('0x63')]({'plain':!![]});interaction_log[_0x2edd('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52017f['user']['id'],_0x52017f[_0x2edd('0x61')][_0x2edd('0x3c')],_0x52017f['user']['role'],_0x4d9fe6[_0x2edd('0x68')]['id'],_0x52017f[_0x2edd('0x58')]?JSON[_0x2edd('0x27')](_0x52017f['body']):_0x2edd('0x69'));return respondWithRpcPromise(_0x2edd('0x6a'),_0x2edd('0x6b'),_0x4d9fe6);}return null;})[_0x2edd('0x22')](function(_0x18e743){var _0x54a0b4=_0x2edd('0x6c')+_0x18e743[_0x2edd('0x2b')][_0x2edd('0x6d')];return db['sequelize'][_0x2edd('0x45')](_0x54a0b4,{'type':db[_0x2edd('0x6e')][_0x2edd('0x6f')][_0x2edd('0x70')],'raw':!![]})[_0x2edd('0x22')](function(_0x51a26e){return _0x51a26e;});})[_0x2edd('0x22')](function(_0x2316f8){if(_0x2316f8){_0x4d9fe6[_0x2edd('0x2b')][_0x2edd('0x71')]=_0x2316f8[0x0];if(!_0x52017f[_0x2edd('0x58')]['UserId'])return;return db[_0x2edd('0x72')][_0x2edd('0x57')]({'where':{'id':_0x52017f[_0x2edd('0x58')][_0x2edd('0x60')],'role':_0x2edd('0x62')},'attributes':['id',_0x2edd('0x3c'),_0x2edd('0x73'),'email',_0x2edd('0x74')],'raw':!![]});}return null;})['then'](function(_0x1551be){if(!_0x1551be)return null;_0x4d9fe6[_0x2edd('0x2b')][_0x2edd('0x62')]=_0x1551be;return _0x4d9fe6;})[_0x2edd('0x22')](function(_0x432482){if(_0x432482){if(_0x52017f['body']['manual']){_0x4d9fe6[_0x2edd('0x2b')][_0x2edd('0x75')]=util[_0x2edd('0x5e')](_0x2edd('0x76'),_0x52017f[_0x2edd('0x61')][_0x2edd('0x3c')]);_0x4d9fe6['message'][_0x2edd('0x77')]=_0x4d9fe6[_0x2edd('0x77')];_0x4d9fe6[_0x2edd('0x2b')][_0x2edd('0x78')]=_0x4d9fe6[_0x2edd('0x77')];_0x4d9fe6['message'][_0x2edd('0x79')]=_0x2edd('0x5b');return respondWithRpcPromise('EventManager',_0x2edd('0x7a'),{'event':'acceptmessage','message':_0x4d9fe6[_0x2edd('0x2b')]},client9002)[_0x2edd('0x22')](function(){return _0x4d9fe6;});}return _0x4d9fe6;}return null;})[_0x2edd('0x22')](respondWithResult(_0x590d68,null))[_0x2edd('0x54')](handleError(_0x590d68,null));};var interaction_log=require(_0x2edd('0x7b'))(_0x2edd('0x5a'));exports['reject']=function(_0x12199c,_0x27af8f,_0x5df857){var _0x27b93e={'agent':{},'channel':_0x2edd('0x5c')};if(_0x12199c['body']['id']){delete _0x12199c['body']['id'];}_0x12199c['body']['UserId']=_0x12199c[_0x2edd('0x58')][_0x2edd('0x60')]||_0x12199c[_0x2edd('0x61')]['id'];_0x27b93e[_0x2edd('0x62')]['id']=_0x12199c['body'][_0x2edd('0x60')];return db[_0x2edd('0x3f')][_0x2edd('0x57')]({'where':{'id':_0x12199c[_0x2edd('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x27af8f,null))['then'](function(_0xade6c9){if(_0xade6c9){_0x27b93e[_0x2edd('0x2b')]=_0xade6c9[_0x2edd('0x63')]({'plain':!![]});return db['FaxInteraction'][_0x2edd('0x57')]({'where':{'id':_0xade6c9['FaxInteractionId']}});}return null;})[_0x2edd('0x22')](handleEntityNotFound(_0x27af8f,null))['then'](function(_0x57194d){if(_0x57194d){_0x27b93e[_0x2edd('0x68')]=_0x57194d[_0x2edd('0x63')]({'plain':!![]});interaction_log[_0x2edd('0x23')](_0x2edd('0x7c'),_0x12199c[_0x2edd('0x61')]['id'],_0x12199c['user']['name'],_0x12199c[_0x2edd('0x61')][_0x2edd('0x7d')],_0x27b93e['interaction']['id'],_0x12199c[_0x2edd('0x58')]?JSON[_0x2edd('0x27')](_0x12199c[_0x2edd('0x58')]):'null');return respondWithRpcPromise(_0x2edd('0x7e'),'rejectMessage',_0x27b93e);}return null;})[_0x2edd('0x22')](function(_0x481de8){var _0x2deef6=_0x2edd('0x6c')+_0x481de8[_0x2edd('0x2b')][_0x2edd('0x6d')];return db['sequelize'][_0x2edd('0x45')](_0x2deef6,{'type':db[_0x2edd('0x6e')][_0x2edd('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x2cf56f){return _0x2cf56f;});})[_0x2edd('0x22')](function(_0x1f13b9){if(_0x1f13b9){_0x27b93e[_0x2edd('0x2b')][_0x2edd('0x71')]=_0x1f13b9[0x0];if(!_0x12199c['body'][_0x2edd('0x60')])return;return db['User'][_0x2edd('0x57')]({'where':{'id':_0x12199c[_0x2edd('0x58')][_0x2edd('0x60')],'role':_0x2edd('0x62')},'attributes':['id',_0x2edd('0x3c'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x262741){if(!_0x262741)return null;_0x27b93e['message'][_0x2edd('0x62')]=_0x262741;return _0x27b93e;})[_0x2edd('0x22')](function(_0x4e5f07){if(_0x4e5f07){_0x4e5f07[_0x2edd('0x2b')][_0x2edd('0x75')]=util[_0x2edd('0x5e')]('SIP/%s',_0x12199c['user'][_0x2edd('0x3c')]);_0x4e5f07[_0x2edd('0x2b')]['channel']=_0x27b93e[_0x2edd('0x77')];_0x4e5f07['message'][_0x2edd('0x78')]=_0x27b93e['channel'];_0x4e5f07[_0x2edd('0x2b')][_0x2edd('0x79')]='reject';respondWithRpcPromise(_0x2edd('0x7a'),_0x2edd('0x7a'),{'event':_0x2edd('0x7f'),'message':_0x4e5f07[_0x2edd('0x2b')]},client9002);return _0x27b93e;}return null;})['then'](respondWithResult(_0x27af8f,null))[_0x2edd('0x54')](handleError(_0x27af8f,null));};exports[_0x2edd('0x80')]=function(_0x17abc0,_0x28c3e8){var _0x343c64;return db[_0x2edd('0x3f')]['create'](_0x17abc0[_0x2edd('0x58')],{})[_0x2edd('0x22')](function(_0x272f1f){_0x343c64=_0x272f1f;return db['CmContact'][_0x2edd('0x81')]({'where':{'id':_0x343c64[_0x2edd('0x6d')]}});})[_0x2edd('0x22')](function(_0x4b906a){if(_['isNil'](_0x4b906a)){return;}else{_0x343c64['fax']=_0x4b906a[_0x2edd('0x5c')];return db[_0x2edd('0x82')][_0x2edd('0x81')]({'where':{'id':_0x343c64['AttachmentId']}});}})[_0x2edd('0x22')](function(_0x3c90cd){return respondWithRpcPromise(_0x2edd('0x83'),_0x2edd('0x83'),{'FaxAccountId':_['isNil'](_0x17abc0[_0x2edd('0x58')])?undefined:_0x17abc0[_0x2edd('0x58')][_0x2edd('0x84')],'path':_['isNil'](_0x3c90cd)?undefined:util[_0x2edd('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0x3c90cd[_0x2edd('0x85')]),'fax':_[_0x2edd('0x66')](_0x343c64[_0x2edd('0x5c')])?undefined:_0x343c64['fax'],'AttachmentId':_0x343c64[_0x2edd('0x86')]},client9002);})['then'](respondWithResult(_0x28c3e8,0xc9))[_0x2edd('0x54')](handleError(_0x28c3e8,null));};exports['download']=function(_0x44e4f1,_0x232f5f){var _0x8580f=path[_0x2edd('0x87')](config[_0x2edd('0x88')],_0x2edd('0x89'),'files',_0x2edd('0x8a'));return db['FaxMessage'][_0x2edd('0x57')]({'where':{'id':_0x44e4f1[_0x2edd('0x55')]['id']},'include':[{'model':db[_0x2edd('0x82')],'as':_0x2edd('0x82')}]})['then'](handleEntityNotFound(_0x232f5f,null))[_0x2edd('0x22')](function(_0xb3db80){if(_0xb3db80){return _0x232f5f[_0x2edd('0x8b')](path[_0x2edd('0x87')](_0x8580f,_0xb3db80['Attachment'][_0x2edd('0x85')]));}})[_0x2edd('0x54')](handleError(_0x232f5f,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c42b775..e36722e 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 _0x6ec2=['events','../../mysqldb','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5ca7b3,_0xbfb0e5){var _0x4e0ab8=function(_0x3a262b){while(--_0x3a262b){_0x5ca7b3['push'](_0x5ca7b3['shift']());}};_0x4e0ab8(++_0xbfb0e5);}(_0x6ec2,0x78));var _0x26ec=function(_0x327e72,_0x1c1f65){_0x327e72=_0x327e72-0x0;var _0x42afe2=_0x6ec2[_0x327e72];return _0x42afe2;};'use strict';var EventEmitter=require(_0x26ec('0x0'));var FaxMessage=require(_0x26ec('0x1'))['db'][_0x26ec('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x26ec('0x3')](0x0);var events={'afterCreate':_0x26ec('0x4'),'afterUpdate':_0x26ec('0x5'),'afterDestroy':'remove'};function emitEvent(_0x336098){return function(_0x18650a,_0x2b4225,_0x13f29c){FaxMessageEvents[_0x26ec('0x6')](_0x336098+':'+_0x18650a['id'],_0x18650a);FaxMessageEvents['emit'](_0x336098,_0x18650a);_0x13f29c(null);};}for(var e in events){if(events[_0x26ec('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x4744=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x4c3456,_0x35a0f4){var _0x611b5c=function(_0x1b05d8){while(--_0x1b05d8){_0x4c3456['push'](_0x4c3456['shift']());}};_0x611b5c(++_0x35a0f4);}(_0x4744,0x107));var _0x4474=function(_0x2c3f5e,_0x3ca8aa){_0x2c3f5e=_0x2c3f5e-0x0;var _0x3b1259=_0x4744[_0x2c3f5e];return _0x3b1259;};'use strict';var EventEmitter=require(_0x4474('0x0'));var FaxMessage=require(_0x4474('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4474('0x2')](0x0);var events={'afterCreate':_0x4474('0x3'),'afterUpdate':_0x4474('0x4'),'afterDestroy':_0x4474('0x5')};function emitEvent(_0xbb4a32){return function(_0x3337f4,_0x395f6d,_0x37c996){FaxMessageEvents['emit'](_0xbb4a32+':'+_0x3337f4['id'],_0x3337f4);FaxMessageEvents['emit'](_0xbb4a32,_0x3337f4);_0x37c996(null);};}for(var e in events){if(events[_0x4474('0x6')](e)){var event=events[e];FaxMessage[_0x4474('0x7')](e,emitEvent(event));}}module[_0x4474('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9bbbb90..a80ed06 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 _0x9d49=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','body','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error'];(function(_0x27dc1f,_0x35223d){var _0x38b8c7=function(_0x43f863){while(--_0x43f863){_0x27dc1f['push'](_0x27dc1f['shift']());}};_0x38b8c7(++_0x35223d);}(_0x9d49,0xb0));var _0x99d4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d49[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x99d4('0x0'));var util=require(_0x99d4('0x1'));var logger=require('../../config/logger')(_0x99d4('0x2'));var moment=require(_0x99d4('0x3'));var BPromise=require(_0x99d4('0x4'));var rp=require(_0x99d4('0x5'));var fs=require('fs');var path=require(_0x99d4('0x6'));var rimraf=require(_0x99d4('0x7'));var config=require(_0x99d4('0x8'));var attributes=require(_0x99d4('0x9'));module[_0x99d4('0xa')]=function(_0x56cdf0,_0x336c5e){return _0x56cdf0[_0x99d4('0xb')]('FaxMessage',attributes,{'tableName':_0x99d4('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x99d4('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c5013,_0x157a03,_0x46684b){var _0x2a55be=_0x56cdf0['models'];var _0x153630=_0x2c5013[_0x99d4('0xe')]({'plain':!![]});if(_0x153630[_0x99d4('0xf')][_0x99d4('0x10')]()==='in'||_0x153630[_0x99d4('0xf')][_0x99d4('0x10')]()===_0x99d4('0x11')&&!_0x153630[_0x99d4('0x12')]&&!_['isNil'](_0x153630[_0x99d4('0x13')])){_0x2a55be[_0x99d4('0x14')][_0x99d4('0x15')]({'where':{'id':_0x153630[_0x99d4('0x16')]}})[_0x99d4('0x17')](function(_0x1a9556){if(_0x1a9556){_0x1a9556[_0x99d4('0x18')]({'lastMsgAt':_0x153630['createdAt'],'lastMsgDirection':_0x153630[_0x99d4('0xf')][_0x99d4('0x10')]()});}})[_0x99d4('0x19')](function(_0x8e50a1){console[_0x99d4('0x1a')](_0x8e50a1);});}_0x46684b();}},'charset':_0x99d4('0x1b'),'collate':_0x99d4('0x1c')});}; \ No newline at end of file +var _0x7c7b=['FaxInteraction','FaxInteractionId','update','catch','error','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x7c7b,0x19b));var _0xb7c7=function(_0x52c218,_0x559397){_0x52c218=_0x52c218-0x0;var _0x39ac6f=_0x7c7b[_0x52c218];return _0x39ac6f;};'use strict';var _=require('lodash');var util=require(_0xb7c7('0x0'));var logger=require(_0xb7c7('0x1'))('api');var moment=require(_0xb7c7('0x2'));var BPromise=require(_0xb7c7('0x3'));var rp=require(_0xb7c7('0x4'));var fs=require('fs');var path=require(_0xb7c7('0x5'));var rimraf=require(_0xb7c7('0x6'));var config=require(_0xb7c7('0x7'));var attributes=require(_0xb7c7('0x8'));module['exports']=function(_0x500e77,_0x276be7){return _0x500e77[_0xb7c7('0x9')](_0xb7c7('0xa'),attributes,{'tableName':_0xb7c7('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xb7c7('0xc')],'type':_0xb7c7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x314184,_0x199c01,_0x513002){var _0x176370=_0x500e77[_0xb7c7('0xe')];var _0x5b1d91=_0x314184[_0xb7c7('0xf')]({'plain':!![]});if(_0x5b1d91[_0xb7c7('0x10')][_0xb7c7('0x11')]()==='in'||_0x5b1d91[_0xb7c7('0x10')][_0xb7c7('0x11')]()===_0xb7c7('0x12')&&!_0x5b1d91[_0xb7c7('0x13')]&&!_['isNil'](_0x5b1d91[_0xb7c7('0x14')])){_0x176370[_0xb7c7('0x15')]['findOne']({'where':{'id':_0x5b1d91[_0xb7c7('0x16')]}})['then'](function(_0x539a5d){if(_0x539a5d){_0x539a5d[_0xb7c7('0x17')]({'lastMsgAt':_0x5b1d91['createdAt'],'lastMsgDirection':_0x5b1d91[_0xb7c7('0x10')]['toLowerCase']()});}})[_0xb7c7('0x18')](function(_0x303cb4){console[_0xb7c7('0x19')](_0x303cb4);});}_0x513002();}},'charset':'utf8mb4','collate':_0xb7c7('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f07ef4b..014e9f6 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 _0xe5b3=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','then','info'];(function(_0x5b2c73,_0x52f9b4){var _0x58f06e=function(_0x1c9f8e){while(--_0x1c9f8e){_0x5b2c73['push'](_0x5b2c73['shift']());}};_0x58f06e(++_0x52f9b4);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0xe5b3[_0x5c365f];return _0x295e1b;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});config[_0x3e5b('0xc')]=_['defaults'](config[_0x3e5b('0xc')],{'host':_0x3e5b('0xd'),'port':0x18eb});var socket=require(_0x3e5b('0xe'))(new Redis(config[_0x3e5b('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1fef54,_0x3d3b6e,_0x22fc1a){return new BPromise(function(_0x17dee7,_0xeeaabc){return client['request'](_0x1fef54,_0x22fc1a)[_0x3e5b('0xf')](function(_0x52efbd){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,_0x3e5b('0x12'));logger[_0x3e5b('0x13')](_0x3e5b('0x14'),_0x3d3b6e,_0x3e5b('0x12'),JSON[_0x3e5b('0x15')](_0x52efbd));if(_0x52efbd['error']){if(_0x52efbd[_0x3e5b('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd[_0x3e5b('0x16')][_0x3e5b('0x17')]);return _0xeeaabc(_0x52efbd[_0x3e5b('0x16')]['message']);}logger[_0x3e5b('0x16')]('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd['error'][_0x3e5b('0x17')]);return _0x17dee7(_0x52efbd[_0x3e5b('0x16')]['message']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,'request\x20sent');_0x17dee7(_0x52efbd[_0x3e5b('0x18')][_0x3e5b('0x17')]);}})['catch'](function(_0x4b189d){logger[_0x3e5b('0x16')](_0x3e5b('0x11'),_0x3d3b6e,_0x4b189d);_0xeeaabc(_0x4b189d);});});}exports[_0x3e5b('0x19')]=function(_0xff4aba){var _0x24de5b=this;return new Promise(function(_0x1564b5,_0x447d36){return db[_0x3e5b('0x1a')][_0x3e5b('0x1b')](_0xff4aba[_0x3e5b('0x1c')],{'raw':_0xff4aba[_0x3e5b('0x1d')]?_0xff4aba[_0x3e5b('0x1d')][_0x3e5b('0x1e')]===undefined?!![]:![]:!![]})[_0x3e5b('0xf')](function(_0x5b46d4){logger[_0x3e5b('0x10')](_0x3e5b('0x19'),_0xff4aba);logger[_0x3e5b('0x13')](_0x3e5b('0x19'),_0xff4aba,JSON['stringify'](_0x5b46d4));_0x1564b5(_0x5b46d4);})[_0x3e5b('0x1f')](function(_0x5b33bb){logger[_0x3e5b('0x16')](_0x3e5b('0x19'),_0x5b33bb['message'],_0xff4aba);_0x447d36(_0x24de5b[_0x3e5b('0x16')](0x1f4,_0x5b33bb[_0x3e5b('0x17')]));});});};exports[_0x3e5b('0x20')]=function(_0x3c8965){var _0x3bb749=this;return new Promise(function(_0x26c7f2,_0x160e87){return db[_0x3e5b('0x1a')]['update'](_0x3c8965[_0x3e5b('0x1c')],{'raw':_0x3c8965['options']?_0x3c8965[_0x3e5b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x21')]||null:null,'attributes':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x22')]||null:null,'limit':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x23')]||null:null})[_0x3e5b('0xf')](function(_0x1e1565){logger['info'](_0x3e5b('0x20'),_0x3c8965);logger[_0x3e5b('0x13')](_0x3e5b('0x20'),_0x3c8965,JSON[_0x3e5b('0x15')](_0x1e1565));_0x26c7f2(_0x1e1565);})[_0x3e5b('0x1f')](function(_0x31e9f9){logger[_0x3e5b('0x16')]('UpdateFaxMessage',_0x31e9f9[_0x3e5b('0x17')],_0x3c8965);_0x160e87(_0x3bb749['error'](0x1f4,_0x31e9f9['message']));});});}; \ No newline at end of file +var _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0x3ff26a,_0x3c5177){var _0x2fb1aa=function(_0x65f1f4){while(--_0x65f1f4){_0x3ff26a['push'](_0x3ff26a['shift']());}};_0x2fb1aa(++_0x3c5177);}(_0x55e0,0xdc));var _0x055e=function(_0xd75eec,_0xf6aa2c){_0xd75eec=_0xd75eec-0x0;var _0x548dc3=_0x55e0[_0xd75eec];return _0x548dc3;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index f6cb19b..97dcada 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 _0x267a=['length','./faxMessage.events','remove','emit','register'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x267a,0x187));var _0xa267=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0x267a[_0x11d95f];return _0x2b1a14;};'use strict';var FaxMessageEvents=require(_0xa267('0x0'));var events=['save',_0xa267('0x1'),'update'];function createListener(_0xc4ba24,_0x327ff0){return function(_0x200b55){_0x327ff0[_0xa267('0x2')](_0xc4ba24,_0x200b55);};}function removeListener(_0x4e204a,_0x5b01c7){return function(){FaxMessageEvents['removeListener'](_0x4e204a,_0x5b01c7);};}exports[_0xa267('0x3')]=function(_0x1f71dd){for(var _0x3b8900=0x0,_0xfa80f3=events[_0xa267('0x4')];_0x3b8900<_0xfa80f3;_0x3b8900++){var _0x3b2f86=events[_0x3b8900];var _0x14c372=createListener('faxMessage:'+_0x3b2f86,_0x1f71dd);FaxMessageEvents['on'](_0x3b2f86,_0x14c372);}}; \ No newline at end of file +var _0x4923=['save','remove','update','removeListener','length','faxMessage:'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4923,0x1b0));var _0x3492=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4923[_0x42cae2];return _0x5f256f;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x3492('0x0'),_0x3492('0x1'),_0x3492('0x2')];function createListener(_0xa7240c,_0xb0009c){return function(_0x324562){_0xb0009c['emit'](_0xa7240c,_0x324562);};}function removeListener(_0x4c0a86,_0x4bd209){return function(){FaxMessageEvents[_0x3492('0x3')](_0x4c0a86,_0x4bd209);};}exports['register']=function(_0x2f160a){for(var _0x25818c=0x0,_0x3de5a9=events[_0x3492('0x4')];_0x25818c<_0x3de5a9;_0x25818c++){var _0x3a7445=events[_0x25818c];var _0x162c61=createListener(_0x3492('0x5')+_0x3a7445,_0x2f160a);FaxMessageEvents['on'](_0x3a7445,_0x162c61);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 5de151e..2a017ce 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 _0x5db8=['download','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id/download'];(function(_0x34be85,_0x1b36ef){var _0x1e55fe=function(_0x4bd45f){while(--_0x4bd45f){_0x34be85['push'](_0x34be85['shift']());}};_0x1e55fe(++_0x1b36ef);}(_0x5db8,0xbb));var _0x85db=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x5db8[_0x5ecadc];return _0x565037;};'use strict';var multer=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var timeout=require('connect-timeout');var express=require(_0x85db('0x3'));var router=express[_0x85db('0x4')]();var fs_extra=require(_0x85db('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85db('0x6'));var controller=require(_0x85db('0x7'));router[_0x85db('0x8')]('/',auth[_0x85db('0x9')](),controller['index']);router['get'](_0x85db('0xa'),auth[_0x85db('0x9')](),controller[_0x85db('0xb')]);router[_0x85db('0x8')]('/:id',auth[_0x85db('0x9')](),controller['show']);router[_0x85db('0x8')](_0x85db('0xc'),auth[_0x85db('0x9')](),controller[_0x85db('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x85db('0xe'),_0x85db('0xf')),controller['create']);router[_0x85db('0x10')]('/:id',auth[_0x85db('0x9')](),controller[_0x85db('0x11')]);router[_0x85db('0x10')](_0x85db('0x12'),auth[_0x85db('0x9')](),controller[_0x85db('0x13')]);router[_0x85db('0x10')](_0x85db('0x14'),auth[_0x85db('0x9')](),controller[_0x85db('0x15')]);router[_0x85db('0x16')](_0x85db('0x17'),auth[_0x85db('0x9')](),controller['destroy']);module[_0x85db('0x18')]=router; \ No newline at end of file +var _0xf72b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','path','express'];(function(_0x5d1c7b,_0x4d11cd){var _0x5b63a2=function(_0x3aff7f){while(--_0x3aff7f){_0x5d1c7b['push'](_0x5d1c7b['shift']());}};_0x5b63a2(++_0x4d11cd);}(_0xf72b,0x1d9));var _0xbf72=function(_0x485c99,_0x17194c){_0x485c99=_0x485c99-0x0;var _0x2879a3=_0xf72b[_0x485c99];return _0x2879a3;};'use strict';var multer=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf72('0x2'));var router=express[_0xbf72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbf72('0x4'));var interaction=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var controller=require(_0xbf72('0x7'));router[_0xbf72('0x8')]('/',auth[_0xbf72('0x9')](),controller['index']);router[_0xbf72('0x8')](_0xbf72('0xa'),auth[_0xbf72('0x9')](),controller[_0xbf72('0xb')]);router[_0xbf72('0x8')](_0xbf72('0xc'),auth['isAuthenticated'](),controller[_0xbf72('0xd')]);router['get'](_0xbf72('0xe'),auth[_0xbf72('0x9')](),controller['download']);router[_0xbf72('0xf')]('/',auth[_0xbf72('0x9')](),interaction[_0xbf72('0x10')](_0xbf72('0x11'),_0xbf72('0x12')),controller[_0xbf72('0x13')]);router[_0xbf72('0x14')](_0xbf72('0xc'),auth['isAuthenticated'](),controller[_0xbf72('0x15')]);router[_0xbf72('0x14')](_0xbf72('0x16'),auth['isAuthenticated'](),controller[_0xbf72('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xbf72('0x18')]);router[_0xbf72('0x19')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller[_0xbf72('0x1a')]);module[_0xbf72('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 6d9579b..fbaccbc 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 _0x7d14=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','name'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x7d14,0x6d));var _0x47d1=function(_0x2d191e,_0xddb344){_0x2d191e=_0x2d191e-0x0;var _0x25108f=_0x7d14[_0x2d191e];return _0x25108f;};'use strict';var Sequelize=require(_0x47d1('0x0'));module[_0x47d1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x47d1('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x47d1('0x3')]},'timeout':{'type':Sequelize[_0x47d1('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x47d1('0x5')]('rrmemory',_0x47d1('0x6'),_0x47d1('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x47d1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b67=['roundrobin','sequelize','STRING','name','INTEGER','beepall'];(function(_0x1afe3e,_0x4bf84a){var _0x25645f=function(_0x1a8eb1){while(--_0x1a8eb1){_0x1afe3e['push'](_0x1afe3e['shift']());}};_0x25645f(++_0x4bf84a);}(_0x2b67,0x67));var _0x72b6=function(_0x32836,_0x1a21e7){_0x32836=_0x32836-0x0;var _0x486a81=_0x2b67[_0x32836];return _0x486a81;};'use strict';var Sequelize=require(_0x72b6('0x0'));module['exports']={'name':{'type':Sequelize[_0x72b6('0x1')],'unique':_0x72b6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x72b6('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x72b6('0x4'),_0x72b6('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x72b6('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 c429191..8c79d6b 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 _0x444e=['addAgents','omit','spread','getAgents','bluebird','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','offset','limit','count','set','Content-Range','json','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','FaxQueue','include','query','findAll','rows','catch','params','model','keys','filters','attributes','includeAll','merge','options','create','body','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','intersection','fields','length','nolimit','order','sort','where','FaxQueueId','filter','User','UserId','faxPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','pick','hasOwnProperty','addTeams','ids','Agents','online','interface','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Team','select','field','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','push','toString','sequelize','QueryTypes','every','all','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove'];(function(_0x48ef47,_0x33a590){var _0x522994=function(_0x23a8fb){while(--_0x23a8fb){_0x48ef47['push'](_0x48ef47['shift']());}};_0x522994(++_0x33a590);}(_0x444e,0xe8));var _0xe444=function(_0x3f84ce,_0xffa0ae){_0x3f84ce=_0x3f84ce-0x0;var _0x1db24c=_0x444e[_0x3f84ce];return _0x1db24c;};'use strict';var BPromise=require(_0xe444('0x0'));var util=require('util');var _=require(_0xe444('0x1'));var squel=require('squel');var Redis=require(_0xe444('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xe444('0x3'))('api');var config=require(_0xe444('0x4'));var db=require(_0xe444('0x5'))['db'];config[_0xe444('0x6')]=_[_0xe444('0x7')](config[_0xe444('0x6')],{'host':_0xe444('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe444('0x6')]));require('./faxQueue.socket')[_0xe444('0x9')](socket);function respondWithStatusCode(_0x482b98,_0x3199dd){_0x3199dd=_0x3199dd||0xcc;return function(_0x4b5e34){if(_0x4b5e34){return _0x482b98[_0xe444('0xa')](_0x3199dd);}return _0x482b98['status'](_0x3199dd)['end']();};}function respondWithResult(_0x36c8a5,_0x1f41ff){_0x1f41ff=_0x1f41ff||0xc8;return function(_0x5e53cb){if(_0x5e53cb){return _0x36c8a5[_0xe444('0xb')](_0x1f41ff)['json'](_0x5e53cb);}};}function respondWithFilteredResult(_0x5f0f7f,_0x390347){return function(_0x4cb1b6){if(_0x4cb1b6){var _0x2a6bf8=typeof _0x390347[_0xe444('0xc')]==='undefined'&&typeof _0x390347[_0xe444('0xd')]==='undefined';var _0x5ba044=_0x4cb1b6[_0xe444('0xe')];var _0x3e3b9f=_0x2a6bf8?0x0:_0x390347['offset'];var _0x192c1a=_0x2a6bf8?_0x4cb1b6['count']:_0x390347[_0xe444('0xc')]+_0x390347[_0xe444('0xd')];var _0x18f7cf;if(_0x192c1a>=_0x5ba044){_0x192c1a=_0x5ba044;_0x18f7cf=0xc8;}else{_0x18f7cf=0xce;}_0x5f0f7f[_0xe444('0xb')](_0x18f7cf);return _0x5f0f7f[_0xe444('0xf')](_0xe444('0x10'),_0x3e3b9f+'-'+_0x192c1a+'/'+_0x5ba044)[_0xe444('0x11')](_0x4cb1b6);}return null;};}function saveUpdates(_0x3e1b57){return function(_0x11129b){if(_0x11129b){return _0x11129b[_0xe444('0x12')](_0x3e1b57)[_0xe444('0x13')](function(_0x3d9066){return _0x3d9066;});}return null;};}function removeEntity(_0x38879b){return function(_0x4e2711){if(_0x4e2711){return _0x4e2711[_0xe444('0x14')]()[_0xe444('0x13')](function(){var _0x12eb54=_0x4e2711[_0xe444('0x15')]({'plain':!![]});var _0x58fd40=_0xe444('0x16');return db[_0xe444('0x17')][_0xe444('0x14')]({'where':{'type':_0x58fd40,'resourceId':_0x12eb54['id']}})[_0xe444('0x13')](function(){return _0x4e2711;});})[_0xe444('0x13')](function(){_0x38879b['status'](0xcc)[_0xe444('0x18')]();});}};}function handleEntityNotFound(_0x5ecdff){return function(_0x529336){if(!_0x529336){_0x5ecdff[_0xe444('0xa')](0x194);}return _0x529336;};}function handleError(_0x5ef1a4,_0x13108c){_0x13108c=_0x13108c||0x1f4;return function(_0x5c5b8){logger[_0xe444('0x19')](_0x5c5b8[_0xe444('0x1a')]);if(_0x5c5b8[_0xe444('0x1b')]){delete _0x5c5b8['name'];}_0x5ef1a4['status'](_0x13108c)[_0xe444('0x1c')](_0x5c5b8);};}exports[_0xe444('0x1d')]=function(_0x1ac266,_0x1ff6d2){var _0x2a03a2={};var _0x5e0311={'count':0x0,'rows':[]};var _0x3c9cf7=_[_0xe444('0x1e')](db['FaxQueue'][_0xe444('0x1f')],function(_0x4f4412){return{'name':_0x4f4412[_0xe444('0x20')],'type':_0x4f4412[_0xe444('0x21')][_0xe444('0x22')]};});_0x2a03a2=qs[_0xe444('0x23')](_0x3c9cf7,_0x1ac266);var _0x16915c={'where':_0x2a03a2['where']};return db[_0xe444('0x24')][_0xe444('0xe')](_0x16915c)[_0xe444('0x13')](function(_0x304b33){_0x5e0311['count']=_0x304b33;_0x2a03a2['include']=qs[_0xe444('0x25')](_0x1ac266[_0xe444('0x26')]);return db[_0xe444('0x24')][_0xe444('0x27')](_0x2a03a2);})['then'](function(_0x26e233){_0x5e0311[_0xe444('0x28')]=_0x26e233;return _0x5e0311;})[_0xe444('0x13')](respondWithFilteredResult(_0x1ff6d2,_0x2a03a2))[_0xe444('0x29')](handleError(_0x1ff6d2,null));};exports['show']=function(_0x5a1269,_0x5c37b6){var _0x1e2d04={'raw':!![],'where':{'id':_0x5a1269[_0xe444('0x2a')]['id']}},_0xd4df5={};_0xd4df5[_0xe444('0x2b')]=_[_0xe444('0x2c')](db['FaxQueue'][_0xe444('0x1f')]);_0xd4df5[_0xe444('0x26')]=_[_0xe444('0x2c')](_0x5a1269['query']);_0xd4df5[_0xe444('0x2d')]=_['intersection'](_0xd4df5['model'],_0xd4df5[_0xe444('0x26')]);_0x1e2d04[_0xe444('0x2e')]=_['intersection'](_0xd4df5[_0xe444('0x2b')],qs['fields'](_0x5a1269[_0xe444('0x26')]['fields']));_0x1e2d04['attributes']=_0x1e2d04[_0xe444('0x2e')]['length']?_0x1e2d04[_0xe444('0x2e')]:_0xd4df5[_0xe444('0x2b')];if(_0x5a1269[_0xe444('0x26')][_0xe444('0x2f')]){_0x1e2d04['include']=[{'all':!![]}];}_0x1e2d04=_[_0xe444('0x30')]({},_0x1e2d04,_0x5a1269[_0xe444('0x31')]);return db[_0xe444('0x24')]['find'](_0x1e2d04)[_0xe444('0x13')](handleEntityNotFound(_0x5c37b6,null))['then'](respondWithResult(_0x5c37b6,null))[_0xe444('0x29')](handleError(_0x5c37b6,null));};exports[_0xe444('0x32')]=function(_0x40df20,_0x4dc4c9){return db['FaxQueue'][_0xe444('0x32')](_0x40df20[_0xe444('0x33')],{})[_0xe444('0x13')](function(_0x238b2b){var _0xec1e35=_0x40df20[_0xe444('0x34')][_0xe444('0x15')]({'plain':!![]});if(!_0xec1e35)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xec1e35['role']===_0xe444('0x34')){var _0x495c9d=_0x238b2b[_0xe444('0x15')]({'plain':!![]});var _0x5cfdaa=_0xe444('0x16');return db[_0xe444('0x35')][_0xe444('0x36')]({'where':{'name':_0x5cfdaa,'userProfileId':_0xec1e35[_0xe444('0x37')]},'raw':!![]})[_0xe444('0x13')](function(_0x2b1e25){if(_0x2b1e25&&_0x2b1e25['autoAssociation']===0x0){return db[_0xe444('0x17')][_0xe444('0x32')]({'name':_0x495c9d[_0xe444('0x1b')],'resourceId':_0x495c9d['id'],'type':_0x2b1e25[_0xe444('0x1b')],'sectionId':_0x2b1e25['id']},{})['then'](function(){return _0x238b2b;});}else{return _0x238b2b;}})[_0xe444('0x29')](function(_0x19283c){logger[_0xe444('0x19')](_0xe444('0x38'),_0x19283c);throw _0x19283c;});}return _0x238b2b;})[_0xe444('0x13')](respondWithResult(_0x4dc4c9,0xc9))[_0xe444('0x29')](handleError(_0x4dc4c9,null));};exports[_0xe444('0x12')]=function(_0x390ba0,_0x16c249){if(_0x390ba0['body']['id']){delete _0x390ba0['body']['id'];}return db['FaxQueue'][_0xe444('0x36')]({'where':{'id':_0x390ba0[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](handleEntityNotFound(_0x16c249,null))[_0xe444('0x13')](saveUpdates(_0x390ba0[_0xe444('0x33')],null))['then'](respondWithResult(_0x16c249,null))['catch'](handleError(_0x16c249,null));};exports[_0xe444('0x14')]=function(_0x1674e9,_0x2f0d8a){return db['FaxQueue'][_0xe444('0x36')]({'where':{'id':_0x1674e9[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](handleEntityNotFound(_0x2f0d8a,null))[_0xe444('0x13')](removeEntity(_0x2f0d8a,null))[_0xe444('0x29')](handleError(_0x2f0d8a,null));};exports[_0xe444('0x39')]=function(_0x563ca2,_0x595f81){return db[_0xe444('0x24')][_0xe444('0x39')]()[_0xe444('0x13')](respondWithResult(_0x595f81,null))[_0xe444('0x29')](handleError(_0x595f81,null));};exports['getMembers']=function(_0x13b92d,_0x3f96bb){var _0x3549d0={'raw':!![],'where':{}},_0x394665={},_0xbbd474;return db[_0xe444('0x24')][_0xe444('0x3a')]({'where':{'id':_0x13b92d[_0xe444('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3f96bb,null))[_0xe444('0x13')](function(_0x1c584d){if(_0x1c584d){_0xbbd474=_0x1c584d[_0xe444('0x15')]({'plain':!![]});_0x394665['model']=_[_0xe444('0x2c')](db['UserFaxQueue']['rawAttributes']);_0x394665['query']=_[_0xe444('0x2c')](_0x13b92d[_0xe444('0x26')]);_0x394665['filters']=_['intersection'](_0x394665[_0xe444('0x2b')],_0x394665[_0xe444('0x26')]);_0x3549d0['attributes']=_[_0xe444('0x3b')](_0x394665[_0xe444('0x2b')],qs[_0xe444('0x3c')](_0x13b92d['query'][_0xe444('0x3c')]));_0x3549d0['attributes']=_0x3549d0[_0xe444('0x2e')][_0xe444('0x3d')]?_0x3549d0['attributes']:_0x394665['model'];if(!_0x13b92d[_0xe444('0x26')]['hasOwnProperty'](_0xe444('0x3e'))){_0x3549d0[_0xe444('0xd')]=qs['limit'](_0x13b92d[_0xe444('0x26')][_0xe444('0xd')]);_0x3549d0[_0xe444('0xc')]=qs[_0xe444('0xc')](_0x13b92d[_0xe444('0x26')][_0xe444('0xc')]);}_0x3549d0[_0xe444('0x3f')]=qs[_0xe444('0x40')](_0x13b92d[_0xe444('0x26')][_0xe444('0x40')]);_0x3549d0[_0xe444('0x41')]=qs[_0xe444('0x2d')](_['pick'](_0x13b92d[_0xe444('0x26')],_0x394665[_0xe444('0x2d')]));_0x3549d0['where'][_0xe444('0x42')]=_0x1c584d['id'];if(_0x13b92d['query'][_0xe444('0x43')]){_0x3549d0['where']=_[_0xe444('0x30')](_0x3549d0['where'],{'$or':_[_0xe444('0x1e')](_0x3549d0[_0xe444('0x2e')],function(_0x16aee3){var _0x2abc49={};_0x2abc49[_0x16aee3]={'$like':'%'+_0x13b92d[_0xe444('0x26')]['filter']+'%'};return _0x2abc49;})});}_0x3549d0=_[_0xe444('0x30')]({},_0x3549d0,_0x13b92d[_0xe444('0x31')]);return db['UserFaxQueue'][_0xe444('0x27')](_0x3549d0);}})[_0xe444('0x13')](function(_0x35da1f){if(_0x35da1f){return db[_0xe444('0x44')]['findAndCountAll']({'where':{'id':_[_0xe444('0x1e')](_0x35da1f,_0xe444('0x45')),'role':'agent'},'attributes':['id',_0xe444('0x1b'),_0xe444('0x46'),'updatedAt','createdAt']});}})[_0xe444('0x13')](function(_0x35793c){if(_0x35793c){return{'count':_0x35793c[_0xe444('0xe')],'rows':_[_0xe444('0x1e')](_0x35793c['rows'],function(_0xc4daf7){return{'membername':_0xc4daf7['name'],'UserId':_0xc4daf7['id'],'queue_name':_0xbbd474[_0xe444('0x1b')],'FaxQueueId':_0xbbd474['id'],'interface':util[_0xe444('0x47')](_0xe444('0x48'),_0xe444('0x49'),_0xc4daf7[_0xe444('0x1b')]),'penalty':0x0,'paused':_0xc4daf7['faxPause'],'createdAt':_0xc4daf7[_0xe444('0x4a')],'updatedAt':_0xc4daf7[_0xe444('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f96bb,_0x3549d0))[_0xe444('0x29')](handleError(_0x3f96bb,null));};exports[_0xe444('0x4c')]=function(_0x3a9acf,_0x211d70){var _0x20796f={};var _0x273d54={};var _0x1c744e;var _0x410311;return db[_0xe444('0x24')][_0xe444('0x3a')]({'where':{'id':_0x3a9acf[_0xe444('0x2a')]['id']}})['then'](handleEntityNotFound(_0x211d70,null))[_0xe444('0x13')](function(_0x2d0b20){if(_0x2d0b20){_0x1c744e=_0x2d0b20;_0x273d54['model']=_[_0xe444('0x2c')](db['Team'][_0xe444('0x1f')]);_0x273d54[_0xe444('0x26')]=_[_0xe444('0x2c')](_0x3a9acf[_0xe444('0x26')]);_0x273d54['filters']=_[_0xe444('0x3b')](_0x273d54[_0xe444('0x2b')],_0x273d54['query']);_0x20796f[_0xe444('0x2e')]=_[_0xe444('0x3b')](_0x273d54['model'],qs[_0xe444('0x3c')](_0x3a9acf[_0xe444('0x26')][_0xe444('0x3c')]));_0x20796f['attributes']=_0x20796f[_0xe444('0x2e')][_0xe444('0x3d')]?_0x20796f['attributes']:_0x273d54[_0xe444('0x2b')];_0x20796f[_0xe444('0x3f')]=qs[_0xe444('0x40')](_0x3a9acf[_0xe444('0x26')][_0xe444('0x40')]);_0x20796f[_0xe444('0x41')]=qs[_0xe444('0x2d')](_[_0xe444('0x4d')](_0x3a9acf['query'],_0x273d54[_0xe444('0x2d')]));if(_0x3a9acf[_0xe444('0x26')][_0xe444('0x43')]){_0x20796f[_0xe444('0x41')]=_['merge'](_0x20796f[_0xe444('0x41')],{'$or':_[_0xe444('0x1e')](_0x20796f[_0xe444('0x2e')],function(_0x4b7f07){var _0x3d85a0={};_0x3d85a0[_0x4b7f07]={'$like':'%'+_0x3a9acf[_0xe444('0x26')][_0xe444('0x43')]+'%'};return _0x3d85a0;})});}_0x20796f=_[_0xe444('0x30')]({},_0x20796f,_0x3a9acf[_0xe444('0x31')]);return _0x1c744e[_0xe444('0x4c')](_0x20796f);}})[_0xe444('0x13')](function(_0x365d7f){if(_0x365d7f){_0x410311=_0x365d7f[_0xe444('0x3d')];if(!_0x3a9acf[_0xe444('0x26')][_0xe444('0x4e')]('nolimit')){_0x20796f[_0xe444('0xd')]=qs[_0xe444('0xd')](_0x3a9acf[_0xe444('0x26')]['limit']);_0x20796f[_0xe444('0xc')]=qs[_0xe444('0xc')](_0x3a9acf['query'][_0xe444('0xc')]);}return _0x1c744e[_0xe444('0x4c')](_0x20796f);}})[_0xe444('0x13')](function(_0x4b6ed4){if(_0x4b6ed4){return _0x4b6ed4?{'count':_0x410311,'rows':_0x4b6ed4}:null;}})[_0xe444('0x13')](respondWithResult(_0x211d70,null))[_0xe444('0x29')](handleError(_0x211d70,null));};exports[_0xe444('0x4f')]=function(_0x17ed5c,_0xa26b2){var _0x558190=_0x17ed5c['body'][_0xe444('0x50')];return db['Team'][_0xe444('0x27')]({'where':{'id':_0x558190},'attributes':['id'],'include':[{'model':db[_0xe444('0x44')],'as':_0xe444('0x51'),'attributes':['id','name',_0xe444('0x52'),'voicePause',_0xe444('0x53')],'raw':!![]}]})[_0xe444('0x13')](function(_0x4d3dfa){if(_0x4d3dfa){var _0x5e7e4b=_['flatMap'](_0x4d3dfa,function(_0x2ac3a1){var _0x57344f=_0x2ac3a1[_0xe444('0x15')]({'plain':!![]});return _0x57344f['Agents'];});return db['FaxQueue'][_0xe444('0x36')]({'where':{'id':_0x17ed5c[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](function(_0x936b6d){return db['sequelize']['transaction'](function(_0x10f7b0){return _0x936b6d['addTeams'](_0x558190,{'transaction':_0x10f7b0})[_0xe444('0x13')](function(){return BPromise[_0xe444('0x54')](_0x5e7e4b,function(_0x4ff543){return db['UserFaxQueue'][_0xe444('0x55')]({'where':{'UserId':_0x4ff543['id'],'FaxQueueId':_0x17ed5c[_0xe444('0x2a')]['id']},'transaction':_0x10f7b0});});})[_0xe444('0x13')](function(){_0x5e7e4b[_0xe444('0x56')](function(_0x10d76f){socket[_0xe444('0x57')](_0xe444('0x58'),{'UserId':_0x10d76f['id'],'FaxQueueId':_0x936b6d['id']});});});});});}})[_0xe444('0x13')](respondWithStatusCode(_0xa26b2,null))['catch'](handleError(_0xa26b2,null));};exports[_0xe444('0x59')]=function(_0x4fc53a,_0x395707){return db[_0xe444('0x5a')][_0xe444('0x27')]({'where':{'id':_0x4fc53a[_0xe444('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe444('0x44')],'as':_0xe444('0x51'),'attributes':['id'],'raw':!![]}]})[_0xe444('0x13')](handleEntityNotFound(_0x395707,null))[_0xe444('0x13')](function(_0x2e33e0){var _0x5001fa=_[_0xe444('0x1e')](_0x2e33e0,'id');var _0x433304=[];var _0x1d7b58=[];var _0x466c5c=squel[_0xe444('0x5b')]();_0x466c5c[_0xe444('0x5c')]('tq.TeamId')[_0xe444('0x5d')](_0xe444('0x5e'),'tq')[_0xe444('0x5f')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe444('0x41')](_0xe444('0x60'),_0x4fc53a[_0xe444('0x2a')]['id']);for(var _0x1675c8=0x0;_0x1675c8<_0x2e33e0[_0xe444('0x3d')];_0x1675c8+=0x1){let _0x2b8de6=_0x2e33e0[_0x1675c8];for(var _0xb5039a=0x0;_0xb5039a<_0x2b8de6['Agents'][_0xe444('0x3d')];_0xb5039a+=0x1){let _0x42789d=_0x2b8de6[_0xe444('0x51')][_0xb5039a];var _0x5027da=_0x466c5c[_0xe444('0x61')]();_0x5027da[_0xe444('0x41')]('ut.UserId\x20=\x20?',_0x42789d['id']);_0x1d7b58[_0xe444('0x62')](db['sequelize']['query'](_0x5027da[_0xe444('0x63')](),{'type':db[_0xe444('0x64')][_0xe444('0x65')]['SELECT']})[_0xe444('0x13')](function(_0x3b5d9c){if(_0x3b5d9c[_0xe444('0x3d')]===0x1){return _0x42789d['id'];}else{var _0x51b876=_[_0xe444('0x66')](_[_0xe444('0x1e')](_0x3b5d9c,'TeamId'),function(_0xb20f20){return _['includes'](_0x5001fa,_0xb20f20);});if(_0x51b876){return _0x42789d['id'];}}}));}}return BPromise[_0xe444('0x67')](_0x1d7b58)['then'](function(_0x1372a7){_0x433304=_(_0x433304)['union'](_0x1372a7)[_0xe444('0x68')]()[_0xe444('0x69')]();return db[_0xe444('0x24')][_0xe444('0x36')]({'where':{'id':_0x4fc53a[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](function(_0x517f69){return db[_0xe444('0x64')][_0xe444('0x6a')](function(_0xb30cb6){return _0x517f69[_0xe444('0x59')](_0x4fc53a[_0xe444('0x26')][_0xe444('0x50')],{'transaction':_0xb30cb6})['then'](function(){if(!_[_0xe444('0x6b')](_0x433304)){return _0x517f69[_0xe444('0x6c')](_0x433304,{'transaction':_0xb30cb6});}})[_0xe444('0x13')](function(){_0x433304[_0xe444('0x56')](function(_0x4cda77){socket[_0xe444('0x57')](_0xe444('0x6d'),{'UserId':_0x4cda77,'FaxQueueId':_0x517f69['id']});});});});});});})['then'](respondWithStatusCode(_0x395707,null))[_0xe444('0x29')](handleError(_0x395707,null));};exports[_0xe444('0x6e')]=function(_0x356445,_0x5b863c){return db[_0xe444('0x24')]['find']({'where':{'id':_0x356445[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](handleEntityNotFound(_0x5b863c,null))[_0xe444('0x13')](function(_0x3f1842){if(_0x3f1842){return _0x3f1842[_0xe444('0x6e')](_0x356445[_0xe444('0x33')][_0xe444('0x50')],_[_0xe444('0x6f')](_0x356445[_0xe444('0x33')],[_0xe444('0x50'),'id'])||{})[_0xe444('0x70')](function(_0x103ed0){for(var _0x34deff=0x0;_0x34deff<_0x356445['body'][_0xe444('0x50')]['length'];_0x34deff+=0x1){socket[_0xe444('0x57')](_0xe444('0x58'),{'UserId':Number(_0x356445[_0xe444('0x33')][_0xe444('0x50')][_0x34deff]),'FaxQueueId':Number(_0x356445[_0xe444('0x2a')]['id'])});}return _0x103ed0;});}})[_0xe444('0x13')](respondWithResult(_0x5b863c,null))[_0xe444('0x29')](handleError(_0x5b863c,null));};exports[_0xe444('0x6c')]=function(_0x5a7c24,_0x32d87f){return db[_0xe444('0x24')][_0xe444('0x36')]({'where':{'id':_0x5a7c24[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](handleEntityNotFound(_0x32d87f,null))['then'](function(_0x1fa6fa){if(_0x1fa6fa){return _0x1fa6fa['removeAgents'](_0x5a7c24[_0xe444('0x26')][_0xe444('0x50')])['then'](function(){if(_['isArray'](_0x5a7c24[_0xe444('0x26')][_0xe444('0x50')])){for(var _0x592b5a=0x0;_0x592b5a<_0x5a7c24[_0xe444('0x26')][_0xe444('0x50')][_0xe444('0x3d')];_0x592b5a+=0x1){socket[_0xe444('0x57')]('userFaxQueue:remove',{'UserId':Number(_0x5a7c24[_0xe444('0x26')]['ids'][_0x592b5a]),'FaxQueueId':Number(_0x5a7c24[_0xe444('0x2a')]['id'])});}}else{socket[_0xe444('0x57')]('userFaxQueue:remove',{'UserId':Number(_0x5a7c24[_0xe444('0x26')][_0xe444('0x50')]),'FaxQueueId':Number(_0x5a7c24[_0xe444('0x2a')]['id'])});}});}})[_0xe444('0x13')](respondWithStatusCode(_0x32d87f,null))[_0xe444('0x29')](handleError(_0x32d87f,null));};exports[_0xe444('0x71')]=function(_0x1bc594,_0x15279f){var _0x4692b5={};var _0x40d8e4={};var _0x2d5a9c;var _0x281db5;return db[_0xe444('0x24')][_0xe444('0x3a')]({'where':{'id':_0x1bc594[_0xe444('0x2a')]['id']}})['then'](handleEntityNotFound(_0x15279f,null))[_0xe444('0x13')](function(_0x106383){if(_0x106383){_0x2d5a9c=_0x106383;_0x40d8e4[_0xe444('0x2b')]=_[_0xe444('0x2c')](db[_0xe444('0x44')][_0xe444('0x1f')]);_0x40d8e4[_0xe444('0x26')]=_['keys'](_0x1bc594[_0xe444('0x26')]);_0x40d8e4[_0xe444('0x2d')]=_[_0xe444('0x3b')](_0x40d8e4[_0xe444('0x2b')],_0x40d8e4[_0xe444('0x26')]);_0x4692b5['attributes']=_[_0xe444('0x3b')](_0x40d8e4[_0xe444('0x2b')],qs['fields'](_0x1bc594[_0xe444('0x26')][_0xe444('0x3c')]));_0x4692b5[_0xe444('0x2e')]=_0x4692b5[_0xe444('0x2e')]['length']?_0x4692b5[_0xe444('0x2e')]:_0x40d8e4[_0xe444('0x2b')];_0x4692b5[_0xe444('0x3f')]=qs[_0xe444('0x40')](_0x1bc594['query'][_0xe444('0x40')]);_0x4692b5[_0xe444('0x41')]=qs[_0xe444('0x2d')](_['pick'](_0x1bc594[_0xe444('0x26')],_0x40d8e4['filters']));if(_0x1bc594[_0xe444('0x26')][_0xe444('0x43')]){_0x4692b5[_0xe444('0x41')]=_[_0xe444('0x30')](_0x4692b5[_0xe444('0x41')],{'$or':_[_0xe444('0x1e')](_0x4692b5[_0xe444('0x2e')],function(_0x232d08){var _0xb32dd0={};_0xb32dd0[_0x232d08]={'$like':'%'+_0x1bc594[_0xe444('0x26')][_0xe444('0x43')]+'%'};return _0xb32dd0;})});}_0x4692b5=_[_0xe444('0x30')]({},_0x4692b5,_0x1bc594[_0xe444('0x31')]);return _0x2d5a9c[_0xe444('0x71')](_0x4692b5);}})['then'](function(_0x18a436){if(_0x18a436){_0x281db5=_0x18a436[_0xe444('0x3d')];if(!_0x1bc594[_0xe444('0x26')][_0xe444('0x4e')](_0xe444('0x3e'))){_0x4692b5[_0xe444('0xd')]=qs[_0xe444('0xd')](_0x1bc594[_0xe444('0x26')]['limit']);_0x4692b5[_0xe444('0xc')]=qs[_0xe444('0xc')](_0x1bc594[_0xe444('0x26')][_0xe444('0xc')]);}return _0x2d5a9c['getAgents'](_0x4692b5);}})[_0xe444('0x13')](function(_0x43d40d){if(_0x43d40d){return _0x43d40d?{'count':_0x281db5,'rows':_0x43d40d}:null;}})['then'](respondWithResult(_0x15279f,null))[_0xe444('0x29')](handleError(_0x15279f,null));}; \ No newline at end of file +var _0x44ff=['model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','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','describe','getMembers','rawAttributes','nolimit','order','sort','where','filter','UserFaxQueue','findAndCountAll','UserId','agent','createdAt','count','format','%s/%s','SIP','faxPause','updatedAt','getTeams','Team','pick','hasOwnProperty','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','findOrCreate','forEach','userFaxQueue:save','removeTeams','User','select','field','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','util','lodash','squel','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','update','then','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','fieldName','type','key','getOptions','include','query','findAll','rows','catch','show','params'];(function(_0x51513f,_0x3c7288){var _0xa5be6d=function(_0x32d560){while(--_0x32d560){_0x51513f['push'](_0x51513f['shift']());}};_0xa5be6d(++_0x3c7288);}(_0x44ff,0x1c3));var _0xf44f=function(_0x30a7f1,_0x243f53){_0x30a7f1=_0x30a7f1-0x0;var _0x4e2229=_0x44ff[_0x30a7f1];return _0x4e2229;};'use strict';var BPromise=require('bluebird');var util=require(_0xf44f('0x0'));var _=require(_0xf44f('0x1'));var squel=require(_0xf44f('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xf44f('0x3'));var db=require(_0xf44f('0x4'))['db'];config['redis']=_['defaults'](config[_0xf44f('0x5')],{'host':_0xf44f('0x6'),'port':0x18eb});var socket=require(_0xf44f('0x7'))(new Redis(config['redis']));require(_0xf44f('0x8'))[_0xf44f('0x9')](socket);function respondWithStatusCode(_0x1a1b8a,_0x4cce53){_0x4cce53=_0x4cce53||0xcc;return function(_0x12b3b9){if(_0x12b3b9){return _0x1a1b8a[_0xf44f('0xa')](_0x4cce53);}return _0x1a1b8a[_0xf44f('0xb')](_0x4cce53)[_0xf44f('0xc')]();};}function respondWithResult(_0x278017,_0x21fb0e){_0x21fb0e=_0x21fb0e||0xc8;return function(_0x22531e){if(_0x22531e){return _0x278017[_0xf44f('0xb')](_0x21fb0e)[_0xf44f('0xd')](_0x22531e);}};}function respondWithFilteredResult(_0x36fddf,_0x548488){return function(_0x349f3b){if(_0x349f3b){var _0x1c5c57=typeof _0x548488[_0xf44f('0xe')]===_0xf44f('0xf')&&typeof _0x548488[_0xf44f('0x10')]===_0xf44f('0xf');var _0x3ad8ba=_0x349f3b['count'];var _0x5d2b86=_0x1c5c57?0x0:_0x548488[_0xf44f('0xe')];var _0x5f20aa=_0x1c5c57?_0x349f3b['count']:_0x548488['offset']+_0x548488[_0xf44f('0x10')];var _0x1d2d77;if(_0x5f20aa>=_0x3ad8ba){_0x5f20aa=_0x3ad8ba;_0x1d2d77=0xc8;}else{_0x1d2d77=0xce;}_0x36fddf[_0xf44f('0xb')](_0x1d2d77);return _0x36fddf[_0xf44f('0x11')]('Content-Range',_0x5d2b86+'-'+_0x5f20aa+'/'+_0x3ad8ba)[_0xf44f('0xd')](_0x349f3b);}return null;};}function saveUpdates(_0x56b1ca){return function(_0x2b7201){if(_0x2b7201){return _0x2b7201[_0xf44f('0x12')](_0x56b1ca)[_0xf44f('0x13')](function(_0x15e5b6){return _0x15e5b6;});}return null;};}function removeEntity(_0x542786){return function(_0x4f0338){if(_0x4f0338){return _0x4f0338['destroy']()['then'](function(){var _0x397f94=_0x4f0338['get']({'plain':!![]});var _0x4d083c=_0xf44f('0x14');return db[_0xf44f('0x15')][_0xf44f('0x16')]({'where':{'type':_0x4d083c,'resourceId':_0x397f94['id']}})['then'](function(){return _0x4f0338;});})[_0xf44f('0x13')](function(){_0x542786[_0xf44f('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe23ff0){return function(_0x5c35f6){if(!_0x5c35f6){_0xe23ff0[_0xf44f('0xa')](0x194);}return _0x5c35f6;};}function handleError(_0x166acd,_0x3e0b9c){_0x3e0b9c=_0x3e0b9c||0x1f4;return function(_0x511661){logger[_0xf44f('0x17')](_0x511661[_0xf44f('0x18')]);if(_0x511661[_0xf44f('0x19')]){delete _0x511661['name'];}_0x166acd[_0xf44f('0xb')](_0x3e0b9c)[_0xf44f('0x1a')](_0x511661);};}exports[_0xf44f('0x1b')]=function(_0x2c660f,_0x1c85cc){var _0x5313f5={};var _0x3c04fe={'count':0x0,'rows':[]};var _0x2a17e0=_[_0xf44f('0x1c')](db[_0xf44f('0x1d')]['rawAttributes'],function(_0x1af2a2){return{'name':_0x1af2a2[_0xf44f('0x1e')],'type':_0x1af2a2[_0xf44f('0x1f')][_0xf44f('0x20')]};});_0x5313f5=qs[_0xf44f('0x21')](_0x2a17e0,_0x2c660f);var _0x21bcc2={'where':_0x5313f5['where']};return db[_0xf44f('0x1d')]['count'](_0x21bcc2)[_0xf44f('0x13')](function(_0x14e6cf){_0x3c04fe['count']=_0x14e6cf;_0x5313f5['include']=qs[_0xf44f('0x22')](_0x2c660f[_0xf44f('0x23')]);return db[_0xf44f('0x1d')][_0xf44f('0x24')](_0x5313f5);})['then'](function(_0x1ee969){_0x3c04fe[_0xf44f('0x25')]=_0x1ee969;return _0x3c04fe;})['then'](respondWithFilteredResult(_0x1c85cc,_0x5313f5))[_0xf44f('0x26')](handleError(_0x1c85cc,null));};exports[_0xf44f('0x27')]=function(_0x12bef4,_0x153a13){var _0x441249={'raw':!![],'where':{'id':_0x12bef4[_0xf44f('0x28')]['id']}},_0x57085e={};_0x57085e[_0xf44f('0x29')]=_[_0xf44f('0x2a')](db[_0xf44f('0x1d')]['rawAttributes']);_0x57085e[_0xf44f('0x23')]=_[_0xf44f('0x2a')](_0x12bef4['query']);_0x57085e[_0xf44f('0x2b')]=_[_0xf44f('0x2c')](_0x57085e[_0xf44f('0x29')],_0x57085e[_0xf44f('0x23')]);_0x441249[_0xf44f('0x2d')]=_['intersection'](_0x57085e[_0xf44f('0x29')],qs[_0xf44f('0x2e')](_0x12bef4[_0xf44f('0x23')][_0xf44f('0x2e')]));_0x441249[_0xf44f('0x2d')]=_0x441249[_0xf44f('0x2d')][_0xf44f('0x2f')]?_0x441249[_0xf44f('0x2d')]:_0x57085e[_0xf44f('0x29')];if(_0x12bef4['query'][_0xf44f('0x30')]){_0x441249[_0xf44f('0x22')]=[{'all':!![]}];}_0x441249=_[_0xf44f('0x31')]({},_0x441249,_0x12bef4[_0xf44f('0x32')]);return db[_0xf44f('0x1d')][_0xf44f('0x33')](_0x441249)[_0xf44f('0x13')](handleEntityNotFound(_0x153a13,null))[_0xf44f('0x13')](respondWithResult(_0x153a13,null))[_0xf44f('0x26')](handleError(_0x153a13,null));};exports[_0xf44f('0x34')]=function(_0x16808a,_0x13ae55){return db[_0xf44f('0x1d')][_0xf44f('0x34')](_0x16808a[_0xf44f('0x35')],{})[_0xf44f('0x13')](function(_0x24099c){var _0x37f274=_0x16808a[_0xf44f('0x36')][_0xf44f('0x37')]({'plain':!![]});if(!_0x37f274)throw new Error(_0xf44f('0x38'));if(_0x37f274[_0xf44f('0x39')]===_0xf44f('0x36')){var _0x58d078=_0x24099c[_0xf44f('0x37')]({'plain':!![]});var _0x2b2233=_0xf44f('0x14');return db[_0xf44f('0x3a')]['find']({'where':{'name':_0x2b2233,'userProfileId':_0x37f274[_0xf44f('0x3b')]},'raw':!![]})['then'](function(_0x54fd2f){if(_0x54fd2f&&_0x54fd2f[_0xf44f('0x3c')]===0x0){return db[_0xf44f('0x15')][_0xf44f('0x34')]({'name':_0x58d078[_0xf44f('0x19')],'resourceId':_0x58d078['id'],'type':_0x54fd2f[_0xf44f('0x19')],'sectionId':_0x54fd2f['id']},{})['then'](function(){return _0x24099c;});}else{return _0x24099c;}})[_0xf44f('0x26')](function(_0x32e8e0){logger['error'](_0xf44f('0x3d'),_0x32e8e0);throw _0x32e8e0;});}return _0x24099c;})[_0xf44f('0x13')](respondWithResult(_0x13ae55,0xc9))[_0xf44f('0x26')](handleError(_0x13ae55,null));};exports['update']=function(_0x11c508,_0x502a21){if(_0x11c508[_0xf44f('0x35')]['id']){delete _0x11c508[_0xf44f('0x35')]['id'];}return db['FaxQueue'][_0xf44f('0x33')]({'where':{'id':_0x11c508[_0xf44f('0x28')]['id']}})[_0xf44f('0x13')](handleEntityNotFound(_0x502a21,null))[_0xf44f('0x13')](saveUpdates(_0x11c508[_0xf44f('0x35')],null))[_0xf44f('0x13')](respondWithResult(_0x502a21,null))[_0xf44f('0x26')](handleError(_0x502a21,null));};exports[_0xf44f('0x16')]=function(_0x5c4933,_0x142dd9){return db[_0xf44f('0x1d')][_0xf44f('0x33')]({'where':{'id':_0x5c4933[_0xf44f('0x28')]['id']}})[_0xf44f('0x13')](handleEntityNotFound(_0x142dd9,null))[_0xf44f('0x13')](removeEntity(_0x142dd9,null))['catch'](handleError(_0x142dd9,null));};exports[_0xf44f('0x3e')]=function(_0x282b8a,_0x2d69d1){return db['FaxQueue'][_0xf44f('0x3e')]()['then'](respondWithResult(_0x2d69d1,null))[_0xf44f('0x26')](handleError(_0x2d69d1,null));};exports[_0xf44f('0x3f')]=function(_0x2d4d8b,_0x4b0535){var _0x36aa74={'raw':!![],'where':{}},_0x3589d9={},_0x44f7d6;return db['FaxQueue']['findOne']({'where':{'id':_0x2d4d8b[_0xf44f('0x28')]['id']}})[_0xf44f('0x13')](handleEntityNotFound(_0x4b0535,null))[_0xf44f('0x13')](function(_0x420532){if(_0x420532){_0x44f7d6=_0x420532[_0xf44f('0x37')]({'plain':!![]});_0x3589d9[_0xf44f('0x29')]=_[_0xf44f('0x2a')](db['UserFaxQueue'][_0xf44f('0x40')]);_0x3589d9[_0xf44f('0x23')]=_['keys'](_0x2d4d8b['query']);_0x3589d9['filters']=_[_0xf44f('0x2c')](_0x3589d9[_0xf44f('0x29')],_0x3589d9[_0xf44f('0x23')]);_0x36aa74['attributes']=_['intersection'](_0x3589d9[_0xf44f('0x29')],qs[_0xf44f('0x2e')](_0x2d4d8b[_0xf44f('0x23')][_0xf44f('0x2e')]));_0x36aa74[_0xf44f('0x2d')]=_0x36aa74['attributes'][_0xf44f('0x2f')]?_0x36aa74[_0xf44f('0x2d')]:_0x3589d9['model'];if(!_0x2d4d8b[_0xf44f('0x23')]['hasOwnProperty'](_0xf44f('0x41'))){_0x36aa74[_0xf44f('0x10')]=qs[_0xf44f('0x10')](_0x2d4d8b[_0xf44f('0x23')][_0xf44f('0x10')]);_0x36aa74[_0xf44f('0xe')]=qs[_0xf44f('0xe')](_0x2d4d8b['query'][_0xf44f('0xe')]);}_0x36aa74[_0xf44f('0x42')]=qs[_0xf44f('0x43')](_0x2d4d8b[_0xf44f('0x23')]['sort']);_0x36aa74['where']=qs['filters'](_['pick'](_0x2d4d8b[_0xf44f('0x23')],_0x3589d9[_0xf44f('0x2b')]));_0x36aa74[_0xf44f('0x44')]['FaxQueueId']=_0x420532['id'];if(_0x2d4d8b[_0xf44f('0x23')][_0xf44f('0x45')]){_0x36aa74['where']=_[_0xf44f('0x31')](_0x36aa74['where'],{'$or':_[_0xf44f('0x1c')](_0x36aa74[_0xf44f('0x2d')],function(_0xf4501f){var _0x432fdc={};_0x432fdc[_0xf4501f]={'$like':'%'+_0x2d4d8b[_0xf44f('0x23')][_0xf44f('0x45')]+'%'};return _0x432fdc;})});}_0x36aa74=_[_0xf44f('0x31')]({},_0x36aa74,_0x2d4d8b[_0xf44f('0x32')]);return db[_0xf44f('0x46')][_0xf44f('0x24')](_0x36aa74);}})[_0xf44f('0x13')](function(_0xeca3c){if(_0xeca3c){return db['User'][_0xf44f('0x47')]({'where':{'id':_['map'](_0xeca3c,_0xf44f('0x48')),'role':_0xf44f('0x49')},'attributes':['id',_0xf44f('0x19'),'faxPause','updatedAt',_0xf44f('0x4a')]});}})[_0xf44f('0x13')](function(_0x1fa774){if(_0x1fa774){return{'count':_0x1fa774[_0xf44f('0x4b')],'rows':_[_0xf44f('0x1c')](_0x1fa774[_0xf44f('0x25')],function(_0x3f9dc3){return{'membername':_0x3f9dc3[_0xf44f('0x19')],'UserId':_0x3f9dc3['id'],'queue_name':_0x44f7d6['name'],'FaxQueueId':_0x44f7d6['id'],'interface':util[_0xf44f('0x4c')](_0xf44f('0x4d'),_0xf44f('0x4e'),_0x3f9dc3['name']),'penalty':0x0,'paused':_0x3f9dc3[_0xf44f('0x4f')],'createdAt':_0x3f9dc3['createdAt'],'updatedAt':_0x3f9dc3[_0xf44f('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf44f('0x13')](respondWithFilteredResult(_0x4b0535,_0x36aa74))[_0xf44f('0x26')](handleError(_0x4b0535,null));};exports[_0xf44f('0x51')]=function(_0x4a53b8,_0x542c03){var _0x535244={};var _0x528f69={};var _0x221129;var _0x5b7316;return db[_0xf44f('0x1d')]['findOne']({'where':{'id':_0x4a53b8[_0xf44f('0x28')]['id']}})[_0xf44f('0x13')](handleEntityNotFound(_0x542c03,null))[_0xf44f('0x13')](function(_0x154b7c){if(_0x154b7c){_0x221129=_0x154b7c;_0x528f69[_0xf44f('0x29')]=_[_0xf44f('0x2a')](db[_0xf44f('0x52')]['rawAttributes']);_0x528f69['query']=_[_0xf44f('0x2a')](_0x4a53b8['query']);_0x528f69[_0xf44f('0x2b')]=_[_0xf44f('0x2c')](_0x528f69[_0xf44f('0x29')],_0x528f69[_0xf44f('0x23')]);_0x535244['attributes']=_[_0xf44f('0x2c')](_0x528f69[_0xf44f('0x29')],qs['fields'](_0x4a53b8['query'][_0xf44f('0x2e')]));_0x535244[_0xf44f('0x2d')]=_0x535244[_0xf44f('0x2d')]['length']?_0x535244['attributes']:_0x528f69[_0xf44f('0x29')];_0x535244[_0xf44f('0x42')]=qs[_0xf44f('0x43')](_0x4a53b8[_0xf44f('0x23')]['sort']);_0x535244[_0xf44f('0x44')]=qs[_0xf44f('0x2b')](_[_0xf44f('0x53')](_0x4a53b8['query'],_0x528f69['filters']));if(_0x4a53b8[_0xf44f('0x23')][_0xf44f('0x45')]){_0x535244[_0xf44f('0x44')]=_[_0xf44f('0x31')](_0x535244[_0xf44f('0x44')],{'$or':_[_0xf44f('0x1c')](_0x535244[_0xf44f('0x2d')],function(_0xe6f6db){var _0xef1dc6={};_0xef1dc6[_0xe6f6db]={'$like':'%'+_0x4a53b8[_0xf44f('0x23')][_0xf44f('0x45')]+'%'};return _0xef1dc6;})});}_0x535244=_[_0xf44f('0x31')]({},_0x535244,_0x4a53b8[_0xf44f('0x32')]);return _0x221129[_0xf44f('0x51')](_0x535244);}})[_0xf44f('0x13')](function(_0x592f48){if(_0x592f48){_0x5b7316=_0x592f48['length'];if(!_0x4a53b8[_0xf44f('0x23')][_0xf44f('0x54')](_0xf44f('0x41'))){_0x535244[_0xf44f('0x10')]=qs[_0xf44f('0x10')](_0x4a53b8['query'][_0xf44f('0x10')]);_0x535244[_0xf44f('0xe')]=qs[_0xf44f('0xe')](_0x4a53b8['query']['offset']);}return _0x221129[_0xf44f('0x51')](_0x535244);}})['then'](function(_0x47e555){if(_0x47e555){return _0x47e555?{'count':_0x5b7316,'rows':_0x47e555}:null;}})['then'](respondWithResult(_0x542c03,null))[_0xf44f('0x26')](handleError(_0x542c03,null));};exports['addTeams']=function(_0x1f6212,_0x356244){var _0x1e335c=_0x1f6212['body'][_0xf44f('0x55')];return db[_0xf44f('0x52')][_0xf44f('0x24')]({'where':{'id':_0x1e335c},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf44f('0x56'),'attributes':['id',_0xf44f('0x19'),_0xf44f('0x57'),_0xf44f('0x58'),_0xf44f('0x59')],'raw':!![]}]})['then'](function(_0x4f1226){if(_0x4f1226){var _0x950219=_['flatMap'](_0x4f1226,function(_0x3e1be2){var _0x129aa5=_0x3e1be2[_0xf44f('0x37')]({'plain':!![]});return _0x129aa5[_0xf44f('0x56')];});return db['FaxQueue']['find']({'where':{'id':_0x1f6212[_0xf44f('0x28')]['id']}})[_0xf44f('0x13')](function(_0x1a4c08){return db[_0xf44f('0x5a')][_0xf44f('0x5b')](function(_0x1bb449){return _0x1a4c08[_0xf44f('0x5c')](_0x1e335c,{'transaction':_0x1bb449})[_0xf44f('0x13')](function(){return BPromise['each'](_0x950219,function(_0x5ceffb){return db[_0xf44f('0x46')][_0xf44f('0x5d')]({'where':{'UserId':_0x5ceffb['id'],'FaxQueueId':_0x1f6212[_0xf44f('0x28')]['id']},'transaction':_0x1bb449});});})[_0xf44f('0x13')](function(){_0x950219[_0xf44f('0x5e')](function(_0x56e498){socket['emit'](_0xf44f('0x5f'),{'UserId':_0x56e498['id'],'FaxQueueId':_0x1a4c08['id']});});});});});}})['then'](respondWithStatusCode(_0x356244,null))[_0xf44f('0x26')](handleError(_0x356244,null));};exports[_0xf44f('0x60')]=function(_0x26e2aa,_0x2ce0eb){return db['Team'][_0xf44f('0x24')]({'where':{'id':_0x26e2aa[_0xf44f('0x23')][_0xf44f('0x55')]},'attributes':['id'],'include':[{'model':db[_0xf44f('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf44f('0x13')](handleEntityNotFound(_0x2ce0eb,null))['then'](function(_0x8cfb82){var _0x5d72b2=_[_0xf44f('0x1c')](_0x8cfb82,'id');var _0x2de672=[];var _0x345d8a=[];var _0x594de1=squel[_0xf44f('0x62')]();_0x594de1[_0xf44f('0x63')]('tq.TeamId')[_0xf44f('0x64')](_0xf44f('0x65'),'tq')['join'](_0xf44f('0x66'),'ut',_0xf44f('0x67'))[_0xf44f('0x44')](_0xf44f('0x68'),_0x26e2aa[_0xf44f('0x28')]['id']);for(var _0x23a922=0x0;_0x23a922<_0x8cfb82[_0xf44f('0x2f')];_0x23a922+=0x1){let _0x4e33f2=_0x8cfb82[_0x23a922];for(var _0x52e3d8=0x0;_0x52e3d8<_0x4e33f2[_0xf44f('0x56')]['length'];_0x52e3d8+=0x1){let _0x41611a=_0x4e33f2[_0xf44f('0x56')][_0x52e3d8];var _0x2f94a4=_0x594de1[_0xf44f('0x69')]();_0x2f94a4['where'](_0xf44f('0x6a'),_0x41611a['id']);_0x345d8a['push'](db[_0xf44f('0x5a')][_0xf44f('0x23')](_0x2f94a4['toString'](),{'type':db[_0xf44f('0x5a')][_0xf44f('0x6b')][_0xf44f('0x6c')]})[_0xf44f('0x13')](function(_0x32dd16){if(_0x32dd16[_0xf44f('0x2f')]===0x1){return _0x41611a['id'];}else{var _0x34d955=_['every'](_[_0xf44f('0x1c')](_0x32dd16,_0xf44f('0x6d')),function(_0x51df85){return _[_0xf44f('0x6e')](_0x5d72b2,_0x51df85);});if(_0x34d955){return _0x41611a['id'];}}}));}}return BPromise[_0xf44f('0x6f')](_0x345d8a)[_0xf44f('0x13')](function(_0xe2d05){_0x2de672=_(_0x2de672)[_0xf44f('0x70')](_0xe2d05)[_0xf44f('0x71')]()[_0xf44f('0x72')]();return db[_0xf44f('0x1d')][_0xf44f('0x33')]({'where':{'id':_0x26e2aa[_0xf44f('0x28')]['id']}})[_0xf44f('0x13')](function(_0x4abe25){return db[_0xf44f('0x5a')][_0xf44f('0x5b')](function(_0x33948a){return _0x4abe25['removeTeams'](_0x26e2aa['query'][_0xf44f('0x55')],{'transaction':_0x33948a})[_0xf44f('0x13')](function(){if(!_['isEmpty'](_0x2de672)){return _0x4abe25[_0xf44f('0x73')](_0x2de672,{'transaction':_0x33948a});}})['then'](function(){_0x2de672[_0xf44f('0x5e')](function(_0x28f5c9){socket['emit'](_0xf44f('0x74'),{'UserId':_0x28f5c9,'FaxQueueId':_0x4abe25['id']});});});});});});})[_0xf44f('0x13')](respondWithStatusCode(_0x2ce0eb,null))['catch'](handleError(_0x2ce0eb,null));};exports[_0xf44f('0x75')]=function(_0x3f4784,_0x2140cf){return db[_0xf44f('0x1d')]['find']({'where':{'id':_0x3f4784[_0xf44f('0x28')]['id']}})['then'](handleEntityNotFound(_0x2140cf,null))[_0xf44f('0x13')](function(_0x469cb4){if(_0x469cb4){return _0x469cb4['addAgents'](_0x3f4784[_0xf44f('0x35')][_0xf44f('0x55')],_[_0xf44f('0x76')](_0x3f4784['body'],['ids','id'])||{})[_0xf44f('0x77')](function(_0x300493){for(var _0x2ba50a=0x0;_0x2ba50a<_0x3f4784['body'][_0xf44f('0x55')]['length'];_0x2ba50a+=0x1){socket[_0xf44f('0x78')]('userFaxQueue:save',{'UserId':Number(_0x3f4784[_0xf44f('0x35')][_0xf44f('0x55')][_0x2ba50a]),'FaxQueueId':Number(_0x3f4784['params']['id'])});}return _0x300493;});}})[_0xf44f('0x13')](respondWithResult(_0x2140cf,null))[_0xf44f('0x26')](handleError(_0x2140cf,null));};exports[_0xf44f('0x73')]=function(_0x42112b,_0x45fa24){return db[_0xf44f('0x1d')][_0xf44f('0x33')]({'where':{'id':_0x42112b['params']['id']}})[_0xf44f('0x13')](handleEntityNotFound(_0x45fa24,null))[_0xf44f('0x13')](function(_0x554683){if(_0x554683){return _0x554683[_0xf44f('0x73')](_0x42112b['query'][_0xf44f('0x55')])[_0xf44f('0x13')](function(){if(_[_0xf44f('0x79')](_0x42112b['query'][_0xf44f('0x55')])){for(var _0x371f33=0x0;_0x371f33<_0x42112b[_0xf44f('0x23')][_0xf44f('0x55')][_0xf44f('0x2f')];_0x371f33+=0x1){socket[_0xf44f('0x78')](_0xf44f('0x74'),{'UserId':Number(_0x42112b[_0xf44f('0x23')][_0xf44f('0x55')][_0x371f33]),'FaxQueueId':Number(_0x42112b['params']['id'])});}}else{socket['emit'](_0xf44f('0x74'),{'UserId':Number(_0x42112b[_0xf44f('0x23')][_0xf44f('0x55')]),'FaxQueueId':Number(_0x42112b[_0xf44f('0x28')]['id'])});}});}})[_0xf44f('0x13')](respondWithStatusCode(_0x45fa24,null))['catch'](handleError(_0x45fa24,null));};exports[_0xf44f('0x7a')]=function(_0x3ace45,_0x275496){var _0x4d5036={};var _0x480056={};var _0x2e9c60;var _0xd4b20d;return db[_0xf44f('0x1d')]['findOne']({'where':{'id':_0x3ace45['params']['id']}})[_0xf44f('0x13')](handleEntityNotFound(_0x275496,null))[_0xf44f('0x13')](function(_0xd423a0){if(_0xd423a0){_0x2e9c60=_0xd423a0;_0x480056[_0xf44f('0x29')]=_['keys'](db[_0xf44f('0x61')][_0xf44f('0x40')]);_0x480056[_0xf44f('0x23')]=_['keys'](_0x3ace45[_0xf44f('0x23')]);_0x480056['filters']=_[_0xf44f('0x2c')](_0x480056[_0xf44f('0x29')],_0x480056[_0xf44f('0x23')]);_0x4d5036[_0xf44f('0x2d')]=_[_0xf44f('0x2c')](_0x480056[_0xf44f('0x29')],qs[_0xf44f('0x2e')](_0x3ace45[_0xf44f('0x23')][_0xf44f('0x2e')]));_0x4d5036[_0xf44f('0x2d')]=_0x4d5036[_0xf44f('0x2d')][_0xf44f('0x2f')]?_0x4d5036[_0xf44f('0x2d')]:_0x480056[_0xf44f('0x29')];_0x4d5036[_0xf44f('0x42')]=qs[_0xf44f('0x43')](_0x3ace45[_0xf44f('0x23')][_0xf44f('0x43')]);_0x4d5036[_0xf44f('0x44')]=qs[_0xf44f('0x2b')](_[_0xf44f('0x53')](_0x3ace45[_0xf44f('0x23')],_0x480056['filters']));if(_0x3ace45['query'][_0xf44f('0x45')]){_0x4d5036[_0xf44f('0x44')]=_[_0xf44f('0x31')](_0x4d5036[_0xf44f('0x44')],{'$or':_[_0xf44f('0x1c')](_0x4d5036[_0xf44f('0x2d')],function(_0x99bcf3){var _0x363cfa={};_0x363cfa[_0x99bcf3]={'$like':'%'+_0x3ace45[_0xf44f('0x23')][_0xf44f('0x45')]+'%'};return _0x363cfa;})});}_0x4d5036=_[_0xf44f('0x31')]({},_0x4d5036,_0x3ace45[_0xf44f('0x32')]);return _0x2e9c60[_0xf44f('0x7a')](_0x4d5036);}})[_0xf44f('0x13')](function(_0x532262){if(_0x532262){_0xd4b20d=_0x532262[_0xf44f('0x2f')];if(!_0x3ace45['query'][_0xf44f('0x54')](_0xf44f('0x41'))){_0x4d5036[_0xf44f('0x10')]=qs['limit'](_0x3ace45['query']['limit']);_0x4d5036[_0xf44f('0xe')]=qs[_0xf44f('0xe')](_0x3ace45[_0xf44f('0x23')][_0xf44f('0xe')]);}return _0x2e9c60[_0xf44f('0x7a')](_0x4d5036);}})['then'](function(_0x515e59){if(_0x515e59){return _0x515e59?{'count':_0xd4b20d,'rows':_0x515e59}:null;}})[_0xf44f('0x13')](respondWithResult(_0x275496,null))['catch'](handleError(_0x275496,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 1a2d442..031ab8b 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 _0x98ab=['emit','events','FaxQueue','setMaxListeners','save','update'];(function(_0xb3d2ac,_0x3b0282){var _0x359d8f=function(_0x46e33b){while(--_0x46e33b){_0xb3d2ac['push'](_0xb3d2ac['shift']());}};_0x359d8f(++_0x3b0282);}(_0x98ab,0x18d));var _0xb98a=function(_0x3f92a4,_0x596105){_0x3f92a4=_0x3f92a4-0x0;var _0xdff35c=_0x98ab[_0x3f92a4];return _0xdff35c;};'use strict';var EventEmitter=require(_0xb98a('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xb98a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb98a('0x2')](0x0);var events={'afterCreate':_0xb98a('0x3'),'afterUpdate':_0xb98a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x6c2959){return function(_0x13ab5a,_0x5147f9,_0x2dda7e){FaxQueueEvents[_0xb98a('0x5')](_0x6c2959+':'+_0x13ab5a['id'],_0x13ab5a);FaxQueueEvents[_0xb98a('0x5')](_0x6c2959,_0x13ab5a);_0x2dda7e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x3809=['FaxQueue','setMaxListeners','update','emit','hasOwnProperty','events'];(function(_0x81b2b2,_0xcea40){var _0x49f38b=function(_0x255dff){while(--_0x255dff){_0x81b2b2['push'](_0x81b2b2['shift']());}};_0x49f38b(++_0xcea40);}(_0x3809,0xe9));var _0x9380=function(_0x420e81,_0x241214){_0x420e81=_0x420e81-0x0;var _0x171e58=_0x3809[_0x420e81];return _0x171e58;};'use strict';var EventEmitter=require(_0x9380('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x9380('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9380('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9380('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3bfe87){return function(_0x7f089b,_0x3b1e59,_0x44fe6d){FaxQueueEvents[_0x9380('0x4')](_0x3bfe87+':'+_0x7f089b['id'],_0x7f089b);FaxQueueEvents[_0x9380('0x4')](_0x3bfe87,_0x7f089b);_0x44fe6d(null);};}for(var e in events){if(events[_0x9380('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index b49bbbf..801f5a1 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 _0xfd34=['bluebird','request-promise','../../config/environment','./faxQueue.attributes','FaxQueue','fax_queues','lodash','util','../../config/logger','moment'];(function(_0x2b8bbc,_0x781655){var _0x262faa=function(_0x2c55b4){while(--_0x2c55b4){_0x2b8bbc['push'](_0x2b8bbc['shift']());}};_0x262faa(++_0x781655);}(_0xfd34,0x6a));var _0x4fd3=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0xfd34[_0x1d83db];return _0x2dc1d1;};'use strict';var _=require(_0x4fd3('0x0'));var util=require(_0x4fd3('0x1'));var logger=require(_0x4fd3('0x2'))('api');var moment=require(_0x4fd3('0x3'));var BPromise=require(_0x4fd3('0x4'));var rp=require(_0x4fd3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4fd3('0x6'));var attributes=require(_0x4fd3('0x7'));module['exports']=function(_0x5c974c,_0x5699d0){return _0x5c974c['define'](_0x4fd3('0x8'),attributes,{'tableName':_0x4fd3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68f9=['lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues'];(function(_0x2e7735,_0x462860){var _0x587604=function(_0x5a3349){while(--_0x5a3349){_0x2e7735['push'](_0x2e7735['shift']());}};_0x587604(++_0x462860);}(_0x68f9,0x18c));var _0x968f=function(_0x20fd8,_0x1396a2){_0x20fd8=_0x20fd8-0x0;var _0x33f916=_0x68f9[_0x20fd8];return _0x33f916;};'use strict';var _=require(_0x968f('0x0'));var util=require(_0x968f('0x1'));var logger=require(_0x968f('0x2'))('api');var moment=require(_0x968f('0x3'));var BPromise=require(_0x968f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x968f('0x5'));var config=require(_0x968f('0x6'));var attributes=require(_0x968f('0x7'));module[_0x968f('0x8')]=function(_0x52a35c,_0x4d4a70){return _0x52a35c[_0x968f('0x9')](_0x968f('0xa'),attributes,{'tableName':_0x968f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 0cf8412..e596a81 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 _0xfbc8=['register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFaxQueue','findAll','options','where','limit','map','include','model','attributes','debug','catch','ShowFaxQueue','FaxQueue','find','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket'];(function(_0x13a5c5,_0x231290){var _0x491cff=function(_0x240a27){while(--_0x240a27){_0x13a5c5['push'](_0x13a5c5['shift']());}};_0x491cff(++_0x231290);}(_0xfbc8,0x95));var _0x8fbc=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xfbc8[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0x8fbc('0x0'));var util=require('util');var moment=require(_0x8fbc('0x1'));var BPromise=require(_0x8fbc('0x2'));var rs=require(_0x8fbc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fbc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fbc('0x5'))(_0x8fbc('0x6'));var config=require(_0x8fbc('0x7'));var jayson=require(_0x8fbc('0x8'));var client=jayson[_0x8fbc('0x9')][_0x8fbc('0xa')]({'port':0x232a});config[_0x8fbc('0xb')]=_[_0x8fbc('0xc')](config[_0x8fbc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8fbc('0xd'))(new Redis(config[_0x8fbc('0xb')]));require(_0x8fbc('0xe'))[_0x8fbc('0xf')](socket);function respondWithRpcPromise(_0x6e104b,_0x27388d,_0x5c35e8){return new BPromise(function(_0xdcfc60,_0x4565ed){return client[_0x8fbc('0x10')](_0x6e104b,_0x5c35e8)[_0x8fbc('0x11')](function(_0x3b3dbf){logger[_0x8fbc('0x12')](_0x8fbc('0x13'),_0x27388d,_0x8fbc('0x14'));logger['debug'](_0x8fbc('0x15'),_0x27388d,'request\x20sent',JSON[_0x8fbc('0x16')](_0x3b3dbf));if(_0x3b3dbf[_0x8fbc('0x17')]){if(_0x3b3dbf['error'][_0x8fbc('0x18')]===0x1f4){logger[_0x8fbc('0x17')](_0x8fbc('0x13'),_0x27388d,_0x3b3dbf[_0x8fbc('0x17')][_0x8fbc('0x19')]);return _0x4565ed(_0x3b3dbf[_0x8fbc('0x17')][_0x8fbc('0x19')]);}logger[_0x8fbc('0x17')]('FaxQueue,\x20%s,\x20%s',_0x27388d,_0x3b3dbf['error'][_0x8fbc('0x19')]);return _0xdcfc60(_0x3b3dbf[_0x8fbc('0x17')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x27388d,_0x8fbc('0x14'));_0xdcfc60(_0x3b3dbf['result']['message']);}})['catch'](function(_0xe0fcc2){logger[_0x8fbc('0x17')](_0x8fbc('0x13'),_0x27388d,_0xe0fcc2);_0x4565ed(_0xe0fcc2);});});}exports[_0x8fbc('0x1a')]=function(_0x4c2137){var _0x304569=this;return new Promise(function(_0x3a3312,_0x14dcff){return db['FaxQueue'][_0x8fbc('0x1b')]({'raw':_0x4c2137[_0x8fbc('0x1c')]?_0x4c2137[_0x8fbc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4c2137[_0x8fbc('0x1c')]?_0x4c2137['options'][_0x8fbc('0x1d')]||null:null,'attributes':_0x4c2137[_0x8fbc('0x1c')]?_0x4c2137[_0x8fbc('0x1c')]['attributes']||null:null,'limit':_0x4c2137['options']?_0x4c2137[_0x8fbc('0x1c')][_0x8fbc('0x1e')]||null:null,'include':_0x4c2137[_0x8fbc('0x1c')]?_0x4c2137['options']['include']?_[_0x8fbc('0x1f')](_0x4c2137['options'][_0x8fbc('0x20')],function(_0x5b980c){return{'model':db[_0x5b980c[_0x8fbc('0x21')]],'as':_0x5b980c['as'],'attributes':_0x5b980c[_0x8fbc('0x22')],'include':_0x5b980c[_0x8fbc('0x20')]?_[_0x8fbc('0x1f')](_0x5b980c[_0x8fbc('0x20')],function(_0x5c2fa4){return{'model':db[_0x5c2fa4[_0x8fbc('0x21')]],'as':_0x5c2fa4['as'],'attributes':_0x5c2fa4[_0x8fbc('0x22')],'include':_0x5c2fa4[_0x8fbc('0x20')]?_[_0x8fbc('0x1f')](_0x5c2fa4['include'],function(_0x58ac72){return{'model':db[_0x58ac72['model']],'as':_0x58ac72['as'],'attributes':_0x58ac72[_0x8fbc('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8fbc('0x11')](function(_0x30cd79){logger['info'](_0x8fbc('0x1a'),_0x4c2137);logger[_0x8fbc('0x23')](_0x8fbc('0x1a'),_0x4c2137,JSON[_0x8fbc('0x16')](_0x30cd79));_0x3a3312(_0x30cd79);})[_0x8fbc('0x24')](function(_0x1395c6){logger[_0x8fbc('0x17')](_0x8fbc('0x1a'),_0x1395c6[_0x8fbc('0x19')],_0x4c2137);_0x14dcff(_0x304569['error'](0x1f4,_0x1395c6[_0x8fbc('0x19')]));});});};exports[_0x8fbc('0x25')]=function(_0x43fb65){var _0x5d429b=this;return new Promise(function(_0xd2cf2d,_0x27fbff){return db[_0x8fbc('0x26')][_0x8fbc('0x27')]({'raw':_0x43fb65[_0x8fbc('0x1c')]?_0x43fb65[_0x8fbc('0x1c')][_0x8fbc('0x28')]===undefined?!![]:![]:!![],'where':_0x43fb65['options']?_0x43fb65[_0x8fbc('0x1c')][_0x8fbc('0x1d')]||null:null,'attributes':_0x43fb65[_0x8fbc('0x1c')]?_0x43fb65[_0x8fbc('0x1c')][_0x8fbc('0x22')]||null:null,'include':_0x43fb65[_0x8fbc('0x1c')]?_0x43fb65[_0x8fbc('0x1c')]['include']?_[_0x8fbc('0x1f')](_0x43fb65['options']['include'],function(_0x19602b){return{'model':db[_0x19602b[_0x8fbc('0x21')]],'as':_0x19602b['as'],'attributes':_0x19602b['attributes'],'include':_0x19602b[_0x8fbc('0x20')]?_[_0x8fbc('0x1f')](_0x19602b[_0x8fbc('0x20')],function(_0x12f817){return{'model':db[_0x12f817[_0x8fbc('0x21')]],'as':_0x12f817['as'],'attributes':_0x12f817['attributes'],'include':_0x12f817[_0x8fbc('0x20')]?_[_0x8fbc('0x1f')](_0x12f817[_0x8fbc('0x20')],function(_0x46b267){return{'model':db[_0x46b267[_0x8fbc('0x21')]],'as':_0x46b267['as'],'attributes':_0x46b267[_0x8fbc('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8fbc('0x11')](function(_0x49d335){logger[_0x8fbc('0x12')]('ShowFaxQueue',_0x43fb65);logger['debug'](_0x8fbc('0x25'),_0x43fb65,JSON[_0x8fbc('0x16')](_0x49d335));_0xd2cf2d(_0x49d335);})[_0x8fbc('0x24')](function(_0x4fcc73){logger[_0x8fbc('0x17')]('ShowFaxQueue',_0x4fcc73[_0x8fbc('0x19')],_0x43fb65);_0x27fbff(_0x5d429b[_0x8fbc('0x17')](0x1f4,_0x4fcc73[_0x8fbc('0x19')]));});});}; \ No newline at end of file +var _0x5ee0=['findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','stringify','ShowFaxQueue','find','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueue,\x20%s,\x20%s','result','catch','FaxQueue'];(function(_0x1f5be0,_0x2c41e5){var _0x21bcf7=function(_0x5134ca){while(--_0x5134ca){_0x1f5be0['push'](_0x1f5be0['shift']());}};_0x21bcf7(++_0x2c41e5);}(_0x5ee0,0xb2));var _0x05ee=function(_0x5c4a96,_0xbe3c95){_0x5c4a96=_0x5c4a96-0x0;var _0x3672ba=_0x5ee0[_0x5c4a96];return _0x3672ba;};'use strict';var _=require(_0x05ee('0x0'));var util=require(_0x05ee('0x1'));var moment=require(_0x05ee('0x2'));var BPromise=require(_0x05ee('0x3'));var rs=require(_0x05ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05ee('0x5'))['db'];var utils=require(_0x05ee('0x6'));var logger=require(_0x05ee('0x7'))(_0x05ee('0x8'));var config=require('../../config/environment');var jayson=require(_0x05ee('0x9'));var client=jayson[_0x05ee('0xa')]['http']({'port':0x232a});config[_0x05ee('0xb')]=_[_0x05ee('0xc')](config['redis'],{'host':_0x05ee('0xd'),'port':0x18eb});var socket=require(_0x05ee('0xe'))(new Redis(config[_0x05ee('0xb')]));require('./faxQueue.socket')[_0x05ee('0xf')](socket);function respondWithRpcPromise(_0x1b8e21,_0x5b6035,_0x22f7da){return new BPromise(function(_0x29d7cb,_0x109de3){return client[_0x05ee('0x10')](_0x1b8e21,_0x22f7da)['then'](function(_0x36931c){logger[_0x05ee('0x11')]('FaxQueue,\x20%s,\x20%s',_0x5b6035,_0x05ee('0x12'));logger['debug'](_0x05ee('0x13'),_0x5b6035,'request\x20sent',JSON['stringify'](_0x36931c));if(_0x36931c[_0x05ee('0x14')]){if(_0x36931c[_0x05ee('0x14')][_0x05ee('0x15')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x5b6035,_0x36931c[_0x05ee('0x14')]['message']);return _0x109de3(_0x36931c[_0x05ee('0x14')][_0x05ee('0x16')]);}logger[_0x05ee('0x14')](_0x05ee('0x17'),_0x5b6035,_0x36931c[_0x05ee('0x14')][_0x05ee('0x16')]);return _0x29d7cb(_0x36931c['error'][_0x05ee('0x16')]);}else{logger['info'](_0x05ee('0x17'),_0x5b6035,_0x05ee('0x12'));_0x29d7cb(_0x36931c[_0x05ee('0x18')]['message']);}})[_0x05ee('0x19')](function(_0x1db67d){logger[_0x05ee('0x14')]('FaxQueue,\x20%s,\x20%s',_0x5b6035,_0x1db67d);_0x109de3(_0x1db67d);});});}exports['GetFaxQueue']=function(_0x4bfa56){var _0x242f5a=this;return new Promise(function(_0x3013df,_0x2da237){return db[_0x05ee('0x1a')][_0x05ee('0x1b')]({'raw':_0x4bfa56['options']?_0x4bfa56[_0x05ee('0x1c')][_0x05ee('0x1d')]===undefined?!![]:![]:!![],'where':_0x4bfa56[_0x05ee('0x1c')]?_0x4bfa56[_0x05ee('0x1c')][_0x05ee('0x1e')]||null:null,'attributes':_0x4bfa56[_0x05ee('0x1c')]?_0x4bfa56[_0x05ee('0x1c')][_0x05ee('0x1f')]||null:null,'limit':_0x4bfa56['options']?_0x4bfa56['options'][_0x05ee('0x20')]||null:null,'include':_0x4bfa56['options']?_0x4bfa56['options'][_0x05ee('0x21')]?_[_0x05ee('0x22')](_0x4bfa56[_0x05ee('0x1c')]['include'],function(_0x5dae26){return{'model':db[_0x5dae26[_0x05ee('0x23')]],'as':_0x5dae26['as'],'attributes':_0x5dae26[_0x05ee('0x1f')],'include':_0x5dae26[_0x05ee('0x21')]?_[_0x05ee('0x22')](_0x5dae26['include'],function(_0x190208){return{'model':db[_0x190208[_0x05ee('0x23')]],'as':_0x190208['as'],'attributes':_0x190208[_0x05ee('0x1f')],'include':_0x190208[_0x05ee('0x21')]?_[_0x05ee('0x22')](_0x190208[_0x05ee('0x21')],function(_0x52756c){return{'model':db[_0x52756c[_0x05ee('0x23')]],'as':_0x52756c['as'],'attributes':_0x52756c[_0x05ee('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x175809){logger[_0x05ee('0x11')]('GetFaxQueue',_0x4bfa56);logger['debug'](_0x05ee('0x24'),_0x4bfa56,JSON[_0x05ee('0x25')](_0x175809));_0x3013df(_0x175809);})[_0x05ee('0x19')](function(_0x2c851b){logger['error']('GetFaxQueue',_0x2c851b[_0x05ee('0x16')],_0x4bfa56);_0x2da237(_0x242f5a[_0x05ee('0x14')](0x1f4,_0x2c851b[_0x05ee('0x16')]));});});};exports[_0x05ee('0x26')]=function(_0x1b4ff1){var _0x29207e=this;return new Promise(function(_0x14c9de,_0x57b480){return db['FaxQueue'][_0x05ee('0x27')]({'raw':_0x1b4ff1['options']?_0x1b4ff1['options'][_0x05ee('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b4ff1['options']?_0x1b4ff1[_0x05ee('0x1c')][_0x05ee('0x1e')]||null:null,'attributes':_0x1b4ff1[_0x05ee('0x1c')]?_0x1b4ff1[_0x05ee('0x1c')][_0x05ee('0x1f')]||null:null,'include':_0x1b4ff1[_0x05ee('0x1c')]?_0x1b4ff1[_0x05ee('0x1c')]['include']?_[_0x05ee('0x22')](_0x1b4ff1['options'][_0x05ee('0x21')],function(_0x5be152){return{'model':db[_0x5be152[_0x05ee('0x23')]],'as':_0x5be152['as'],'attributes':_0x5be152[_0x05ee('0x1f')],'include':_0x5be152[_0x05ee('0x21')]?_['map'](_0x5be152['include'],function(_0xdb439c){return{'model':db[_0xdb439c[_0x05ee('0x23')]],'as':_0xdb439c['as'],'attributes':_0xdb439c[_0x05ee('0x1f')],'include':_0xdb439c[_0x05ee('0x21')]?_[_0x05ee('0x22')](_0xdb439c[_0x05ee('0x21')],function(_0x59a565){return{'model':db[_0x59a565[_0x05ee('0x23')]],'as':_0x59a565['as'],'attributes':_0x59a565[_0x05ee('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x05ee('0x28')](function(_0x588302){logger[_0x05ee('0x11')]('ShowFaxQueue',_0x1b4ff1);logger['debug'](_0x05ee('0x26'),_0x1b4ff1,JSON['stringify'](_0x588302));_0x14c9de(_0x588302);})[_0x05ee('0x19')](function(_0x3c6c17){logger[_0x05ee('0x14')](_0x05ee('0x26'),_0x3c6c17[_0x05ee('0x16')],_0x1b4ff1);_0x57b480(_0x29207e[_0x05ee('0x14')](0x1f4,_0x3c6c17[_0x05ee('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ea51b36..ab27251 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 _0xb6c8=['remove','update','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6c8,0x180));var _0x8b6c=function(_0x111c5c,_0x4e6797){_0x111c5c=_0x111c5c-0x0;var _0x561e0c=_0xb6c8[_0x111c5c];return _0x561e0c;};'use strict';var FaxQueueEvents=require(_0x8b6c('0x0'));var events=['save',_0x8b6c('0x1'),_0x8b6c('0x2')];function createListener(_0x302dcc,_0x13b155){return function(_0x3123a1){_0x13b155['emit'](_0x302dcc,_0x3123a1);};}function removeListener(_0x4afa76,_0x513295){return function(){FaxQueueEvents[_0x8b6c('0x3')](_0x4afa76,_0x513295);};}exports[_0x8b6c('0x4')]=function(_0x1d33b1){for(var _0x349650=0x0,_0x210e9a=events[_0x8b6c('0x5')];_0x349650<_0x210e9a;_0x349650++){var _0x2bcfd9=events[_0x349650];var _0x252dd0=createListener(_0x8b6c('0x6')+_0x2bcfd9,_0x1d33b1);FaxQueueEvents['on'](_0x2bcfd9,_0x252dd0);}}; \ No newline at end of file +var _0x31c2=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x5ca10d,_0x4800dd){var _0xc14a55=function(_0x15527c){while(--_0x15527c){_0x5ca10d['push'](_0x5ca10d['shift']());}};_0xc14a55(++_0x4800dd);}(_0x31c2,0x1e1));var _0x231c=function(_0x58f082,_0x50a3a0){_0x58f082=_0x58f082-0x0;var _0x1ae862=_0x31c2[_0x58f082];return _0x1ae862;};'use strict';var FaxQueueEvents=require(_0x231c('0x0'));var events=[_0x231c('0x1'),_0x231c('0x2'),_0x231c('0x3')];function createListener(_0x1c57c9,_0x7e36a0){return function(_0xa1faa4){_0x7e36a0[_0x231c('0x4')](_0x1c57c9,_0xa1faa4);};}function removeListener(_0x5b0b0a,_0x59f232){return function(){FaxQueueEvents[_0x231c('0x5')](_0x5b0b0a,_0x59f232);};}exports[_0x231c('0x6')]=function(_0x1f3f7d){for(var _0x219c3f=0x0,_0x48bfb2=events[_0x231c('0x7')];_0x219c3f<_0x48bfb2;_0x219c3f++){var _0x49ff9e=events[_0x219c3f];var _0x439df8=createListener(_0x231c('0x8')+_0x49ff9e,_0x1f3f7d);FaxQueueEvents['on'](_0x49ff9e,_0x439df8);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8e43678..7762a71 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 _0x7b84=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0x348652,_0x1ab849){var _0x18a9ea=function(_0x3fd540){while(--_0x3fd540){_0x348652['push'](_0x348652['shift']());}};_0x18a9ea(++_0x1ab849);}(_0x7b84,0x17c));var _0x47b8=function(_0x5cb811,_0x265caf){_0x5cb811=_0x5cb811-0x0;var _0x24a6cb=_0x7b84[_0x5cb811];return _0x24a6cb;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0x17')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0x17')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x19')]);router[_0x47b8('0x17')]('/:id/users',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router[_0x47b8('0x1b')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1c')]);router[_0x47b8('0x1d')]('/:id',auth[_0x47b8('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1e')]);router[_0x47b8('0x1d')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x47b8('0x1f')]=router; \ No newline at end of file +var _0x8506=['addTeams','put','update','delete','destroy','removeTeams','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x8506,0xe8));var _0x6850=function(_0x50fb14,_0x3c6504){_0x50fb14=_0x50fb14-0x0;var _0x2fa003=_0x8506[_0x50fb14];return _0x2fa003;};'use strict';var multer=require('multer');var util=require(_0x6850('0x0'));var path=require('path');var timeout=require(_0x6850('0x1'));var express=require('express');var router=express[_0x6850('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6850('0x3'));var interaction=require(_0x6850('0x4'));var config=require(_0x6850('0x5'));var controller=require('./faxQueue.controller');router[_0x6850('0x6')]('/',auth[_0x6850('0x7')](),controller[_0x6850('0x8')]);router[_0x6850('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6850('0x6')](_0x6850('0x9'),auth[_0x6850('0x7')](),controller['show']);router['get'](_0x6850('0xa'),auth[_0x6850('0x7')](),controller[_0x6850('0xb')]);router[_0x6850('0x6')](_0x6850('0xc'),auth['isAuthenticated'](),controller[_0x6850('0xd')]);router[_0x6850('0x6')](_0x6850('0xe'),auth[_0x6850('0x7')](),controller[_0x6850('0xf')]);router[_0x6850('0x10')]('/',auth['isAuthenticated'](),controller[_0x6850('0x11')]);router[_0x6850('0x10')](_0x6850('0xc'),auth[_0x6850('0x7')](),controller[_0x6850('0x12')]);router[_0x6850('0x10')]('/:id/users',auth[_0x6850('0x7')](),controller['addAgents']);router[_0x6850('0x13')](_0x6850('0x9'),auth[_0x6850('0x7')](),controller[_0x6850('0x14')]);router[_0x6850('0x15')](_0x6850('0x9'),auth[_0x6850('0x7')](),controller[_0x6850('0x16')]);router[_0x6850('0x15')](_0x6850('0xc'),auth[_0x6850('0x7')](),controller[_0x6850('0x17')]);router[_0x6850('0x15')](_0x6850('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6850('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7b645bd..c67e385 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 _0xb715=['STRING','DATE','sequelize'];(function(_0xfcde0,_0xf94190){var _0x31f640=function(_0xd82a68){while(--_0xd82a68){_0xfcde0['push'](_0xfcde0['shift']());}};_0x31f640(++_0xf94190);}(_0xb715,0x16d));var _0x5b71=function(_0x3d0f11,_0x519a66){_0x3d0f11=_0x3d0f11-0x0;var _0x26acc8=_0xb715[_0x3d0f11];return _0x26acc8;};'use strict';var moment=require('moment');var Sequelize=require(_0x5b71('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5b71('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5b71('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5b71('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5b71('0x2')]},'reason':{'type':Sequelize[_0x5b71('0x1')]}}; \ No newline at end of file +var _0x6cb7=['exports','STRING','DATE','moment','sequelize'];(function(_0x1f23cd,_0x1d6fcf){var _0x18af3d=function(_0x425430){while(--_0x425430){_0x1f23cd['push'](_0x1f23cd['shift']());}};_0x18af3d(++_0x1d6fcf);}(_0x6cb7,0xa3));var _0x76cb=function(_0x829e00,_0x26034e){_0x829e00=_0x829e00-0x0;var _0x1e73a0=_0x6cb7[_0x829e00];return _0x1e73a0;};'use strict';var moment=require(_0x76cb('0x0'));var Sequelize=require(_0x76cb('0x1'));module[_0x76cb('0x2')]={'uniqueid':{'type':Sequelize[_0x76cb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x76cb('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x76cb('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x76cb('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a603123..4b5ee40 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 _0x1fdc=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','pick','where','filter','options','includeAll','include','findAll','rows','show','rawAttributes','merge','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x5e9e55,_0x13cc86){var _0x177696=function(_0x3aeb1a){while(--_0x3aeb1a){_0x5e9e55['push'](_0x5e9e55['shift']());}};_0x177696(++_0x13cc86);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x1fdc[_0x3a2a3c];return _0x50ac9a;};'use strict';var emlformat=require(_0xc1fd('0x0'));var rimraf=require(_0xc1fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1fd('0x2'));var rp=require(_0xc1fd('0x3'));var moment=require(_0xc1fd('0x4'));var BPromise=require(_0xc1fd('0x5'));var Mustache=require(_0xc1fd('0x6'));var util=require(_0xc1fd('0x7'));var path=require(_0xc1fd('0x8'));var sox=require('sox');var csv=require(_0xc1fd('0x9'));var ejs=require(_0xc1fd('0xa'));var fs=require('fs');var fs_extra=require(_0xc1fd('0xb'));var _=require(_0xc1fd('0xc'));var squel=require(_0xc1fd('0xd'));var crypto=require(_0xc1fd('0xe'));var jsforce=require(_0xc1fd('0xf'));var deskjs=require(_0xc1fd('0x10'));var toCsv=require(_0xc1fd('0x9'));var querystring=require(_0xc1fd('0x11'));var Papa=require(_0xc1fd('0x12'));var Redis=require(_0xc1fd('0x13'));var authService=require(_0xc1fd('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1fd('0x15'));var hardwareService=require(_0xc1fd('0x16'));var logger=require('../../config/logger')(_0xc1fd('0x17'));var utils=require('../../config/utils');var config=require(_0xc1fd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1fd('0x19'))['db'];function respondWithStatusCode(_0x18b9b7,_0xcea0b0){_0xcea0b0=_0xcea0b0||0xcc;return function(_0x4e540c){if(_0x4e540c){return _0x18b9b7[_0xc1fd('0x1a')](_0xcea0b0);}return _0x18b9b7[_0xc1fd('0x1b')](_0xcea0b0)[_0xc1fd('0x1c')]();};}function respondWithResult(_0x5439d8,_0x4ae51e){_0x4ae51e=_0x4ae51e||0xc8;return function(_0x4fa283){if(_0x4fa283){return _0x5439d8[_0xc1fd('0x1b')](_0x4ae51e)[_0xc1fd('0x1d')](_0x4fa283);}};}function respondWithFilteredResult(_0x5d3d4a,_0x57fed5){return function(_0x4bd8d8){if(_0x4bd8d8){var _0x6e9ea=typeof _0x57fed5[_0xc1fd('0x1e')]===_0xc1fd('0x1f')&&typeof _0x57fed5[_0xc1fd('0x20')]==='undefined';var _0x279b60=_0x4bd8d8['count'];var _0x3634e3=_0x6e9ea?0x0:_0x57fed5[_0xc1fd('0x1e')];var _0x12398e=_0x6e9ea?_0x4bd8d8[_0xc1fd('0x21')]:_0x57fed5[_0xc1fd('0x1e')]+_0x57fed5[_0xc1fd('0x20')];var _0x13a2c4;if(_0x12398e>=_0x279b60){_0x12398e=_0x279b60;_0x13a2c4=0xc8;}else{_0x13a2c4=0xce;}_0x5d3d4a[_0xc1fd('0x1b')](_0x13a2c4);return _0x5d3d4a[_0xc1fd('0x22')](_0xc1fd('0x23'),_0x3634e3+'-'+_0x12398e+'/'+_0x279b60)[_0xc1fd('0x1d')](_0x4bd8d8);}return null;};}function patchUpdates(_0x4e5f56){return function(_0x44668c){try{jsonpatch['apply'](_0x44668c,_0x4e5f56,!![]);}catch(_0x6d8688){return BPromise['reject'](_0x6d8688);}return _0x44668c[_0xc1fd('0x24')]();};}function saveUpdates(_0x145090,_0x3d4ae4){return function(_0x4d2410){if(_0x4d2410){return _0x4d2410[_0xc1fd('0x25')](_0x145090)['then'](function(_0x152d76){return _0x152d76;});}return null;};}function removeEntity(_0x27e63f,_0x3cf4a2){return function(_0x1593da){if(_0x1593da){return _0x1593da[_0xc1fd('0x26')]()[_0xc1fd('0x27')](function(){_0x27e63f[_0xc1fd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16509d,_0x510801){return function(_0x4bf6b4){if(!_0x4bf6b4){_0x16509d['sendStatus'](0x194);}return _0x4bf6b4;};}function handleError(_0x41e9e4,_0x42b7bd){_0x42b7bd=_0x42b7bd||0x1f4;return function(_0x236efa){logger[_0xc1fd('0x28')](_0x236efa[_0xc1fd('0x29')]);if(_0x236efa[_0xc1fd('0x2a')]){delete _0x236efa[_0xc1fd('0x2a')];}_0x41e9e4['status'](_0x42b7bd)[_0xc1fd('0x2b')](_0x236efa);};}exports[_0xc1fd('0x2c')]=function(_0x854418,_0x12f8f6){var _0x38677e={},_0x19bdef={},_0x121320={'count':0x0,'rows':[]};var _0x1d94b0=_[_0xc1fd('0x2d')](db[_0xc1fd('0x2e')]['rawAttributes'],function(_0x1ba573){return{'name':_0x1ba573[_0xc1fd('0x2f')],'type':_0x1ba573[_0xc1fd('0x30')][_0xc1fd('0x31')]};});_0x19bdef[_0xc1fd('0x32')]=_[_0xc1fd('0x2d')](_0x1d94b0,'name');_0x19bdef['query']=_[_0xc1fd('0x33')](_0x854418[_0xc1fd('0x34')]);_0x19bdef[_0xc1fd('0x35')]=_[_0xc1fd('0x36')](_0x19bdef[_0xc1fd('0x32')],_0x19bdef[_0xc1fd('0x34')]);_0x38677e['attributes']=_[_0xc1fd('0x36')](_0x19bdef['model'],qs['fields'](_0x854418[_0xc1fd('0x34')][_0xc1fd('0x37')]));_0x38677e[_0xc1fd('0x38')]=_0x38677e[_0xc1fd('0x38')][_0xc1fd('0x39')]?_0x38677e[_0xc1fd('0x38')]:_0x19bdef[_0xc1fd('0x32')];if(!_0x854418[_0xc1fd('0x34')]['hasOwnProperty']('nolimit')){_0x38677e[_0xc1fd('0x20')]=qs[_0xc1fd('0x20')](_0x854418['query'][_0xc1fd('0x20')]);_0x38677e['offset']=qs[_0xc1fd('0x1e')](_0x854418[_0xc1fd('0x34')][_0xc1fd('0x1e')]);}_0x38677e[_0xc1fd('0x3a')]=qs[_0xc1fd('0x3b')](_0x854418[_0xc1fd('0x34')][_0xc1fd('0x3b')]);_0x38677e['where']=qs[_0xc1fd('0x35')](_[_0xc1fd('0x3c')](_0x854418[_0xc1fd('0x34')],_0x19bdef['filters']),_0x1d94b0);if(_0x854418[_0xc1fd('0x34')]['filter']){_0x38677e[_0xc1fd('0x3d')]=_['merge'](_0x38677e['where'],{'$or':_[_0xc1fd('0x2d')](_0x1d94b0,function(_0x5b5ee4){if(_0x5b5ee4[_0xc1fd('0x30')]!=='VIRTUAL'){var _0x35fcd4={};_0x35fcd4[_0x5b5ee4[_0xc1fd('0x2a')]]={'$like':'%'+_0x854418[_0xc1fd('0x34')][_0xc1fd('0x3e')]+'%'};return _0x35fcd4;}})});}_0x38677e=_['merge']({},_0x38677e,_0x854418[_0xc1fd('0x3f')]);var _0x2ef383={'where':_0x38677e[_0xc1fd('0x3d')]};return db['FaxQueueReport'][_0xc1fd('0x21')](_0x2ef383)[_0xc1fd('0x27')](function(_0x3ade5f){_0x121320[_0xc1fd('0x21')]=_0x3ade5f;if(_0x854418[_0xc1fd('0x34')][_0xc1fd('0x40')]){_0x38677e[_0xc1fd('0x41')]=[{'all':!![]}];}return db[_0xc1fd('0x2e')][_0xc1fd('0x42')](_0x38677e);})[_0xc1fd('0x27')](function(_0x44998f){_0x121320[_0xc1fd('0x43')]=_0x44998f;return _0x121320;})[_0xc1fd('0x27')](respondWithFilteredResult(_0x12f8f6,_0x38677e))['catch'](handleError(_0x12f8f6,null));};exports[_0xc1fd('0x44')]=function(_0x476bdb,_0x2447c6){var _0x34af64={'raw':!![],'where':{'id':_0x476bdb['params']['id']}},_0x8db94a={};_0x8db94a[_0xc1fd('0x32')]=_[_0xc1fd('0x33')](db[_0xc1fd('0x2e')][_0xc1fd('0x45')]);_0x8db94a[_0xc1fd('0x34')]=_['keys'](_0x476bdb[_0xc1fd('0x34')]);_0x8db94a[_0xc1fd('0x35')]=_[_0xc1fd('0x36')](_0x8db94a[_0xc1fd('0x32')],_0x8db94a[_0xc1fd('0x34')]);_0x34af64[_0xc1fd('0x38')]=_[_0xc1fd('0x36')](_0x8db94a[_0xc1fd('0x32')],qs[_0xc1fd('0x37')](_0x476bdb['query'][_0xc1fd('0x37')]));_0x34af64[_0xc1fd('0x38')]=_0x34af64[_0xc1fd('0x38')][_0xc1fd('0x39')]?_0x34af64[_0xc1fd('0x38')]:_0x8db94a['model'];if(_0x476bdb['query'][_0xc1fd('0x40')]){_0x34af64['include']=[{'all':!![]}];}_0x34af64=_[_0xc1fd('0x46')]({},_0x34af64,_0x476bdb[_0xc1fd('0x3f')]);return db[_0xc1fd('0x2e')][_0xc1fd('0x47')](_0x34af64)[_0xc1fd('0x27')](handleEntityNotFound(_0x2447c6,null))[_0xc1fd('0x27')](respondWithResult(_0x2447c6,null))[_0xc1fd('0x48')](handleError(_0x2447c6,null));};exports[_0xc1fd('0x49')]=function(_0x17e20b,_0x3d730e){return db[_0xc1fd('0x2e')]['create'](_0x17e20b[_0xc1fd('0x4a')],{})[_0xc1fd('0x27')](respondWithResult(_0x3d730e,0xc9))[_0xc1fd('0x48')](handleError(_0x3d730e,null));};exports[_0xc1fd('0x25')]=function(_0x4ab8c0,_0x335fde){if(_0x4ab8c0[_0xc1fd('0x4a')]['id']){delete _0x4ab8c0['body']['id'];}return db['FaxQueueReport'][_0xc1fd('0x47')]({'where':{'id':_0x4ab8c0[_0xc1fd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x335fde,null))[_0xc1fd('0x27')](saveUpdates(_0x4ab8c0[_0xc1fd('0x4a')],null))['then'](respondWithResult(_0x335fde,null))[_0xc1fd('0x48')](handleError(_0x335fde,null));};exports[_0xc1fd('0x26')]=function(_0x51540f,_0x56c58e){return db[_0xc1fd('0x2e')][_0xc1fd('0x47')]({'where':{'id':_0x51540f[_0xc1fd('0x4b')]['id']}})[_0xc1fd('0x27')](handleEntityNotFound(_0x56c58e,null))[_0xc1fd('0x27')](removeEntity(_0x56c58e,null))[_0xc1fd('0x48')](handleError(_0x56c58e,null));};exports[_0xc1fd('0x4c')]=function(_0x43d6cb,_0x8feb70){return db['FaxQueueReport'][_0xc1fd('0x4c')]()[_0xc1fd('0x27')](respondWithResult(_0x8feb70,null))[_0xc1fd('0x48')](handleError(_0x8feb70,null));}; \ No newline at end of file +var _0x7070=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','set','json','save','then','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','rows','catch','params','length','find','create','body','update','describe','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse'];(function(_0xfba903,_0x1b675e){var _0x1553c4=function(_0x332214){while(--_0x332214){_0xfba903['push'](_0xfba903['shift']());}};_0x1553c4(++_0x1b675e);}(_0x7070,0x1d7));var _0x0707=function(_0xe6d064,_0x2fa6a7){_0xe6d064=_0xe6d064-0x0;var _0x1a650b=_0x7070[_0xe6d064];return _0x1a650b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0707('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0707('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0707('0x2'));var Mustache=require(_0x0707('0x3'));var util=require(_0x0707('0x4'));var path=require(_0x0707('0x5'));var sox=require('sox');var csv=require(_0x0707('0x6'));var ejs=require(_0x0707('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0707('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0707('0x9'));var toCsv=require(_0x0707('0x6'));var querystring=require(_0x0707('0xa'));var Papa=require(_0x0707('0xb'));var Redis=require(_0x0707('0xc'));var authService=require(_0x0707('0xd'));var qs=require(_0x0707('0xe'));var as=require(_0x0707('0xf'));var hardwareService=require(_0x0707('0x10'));var logger=require(_0x0707('0x11'))('api');var utils=require(_0x0707('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0707('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b55c6,_0x2bd4d8){_0x2bd4d8=_0x2bd4d8||0xcc;return function(_0x3eeea8){if(_0x3eeea8){return _0x3b55c6[_0x0707('0x14')](_0x2bd4d8);}return _0x3b55c6[_0x0707('0x15')](_0x2bd4d8)[_0x0707('0x16')]();};}function respondWithResult(_0x3b0f64,_0x111fd7){_0x111fd7=_0x111fd7||0xc8;return function(_0x380abc){if(_0x380abc){return _0x3b0f64[_0x0707('0x15')](_0x111fd7)['json'](_0x380abc);}};}function respondWithFilteredResult(_0x5bae3d,_0x3fce78){return function(_0x429da2){if(_0x429da2){var _0x1370b3=typeof _0x3fce78[_0x0707('0x17')]==='undefined'&&typeof _0x3fce78[_0x0707('0x18')]===_0x0707('0x19');var _0xe1cf0e=_0x429da2['count'];var _0x13d5de=_0x1370b3?0x0:_0x3fce78['offset'];var _0x471431=_0x1370b3?_0x429da2['count']:_0x3fce78[_0x0707('0x17')]+_0x3fce78[_0x0707('0x18')];var _0x1debb9;if(_0x471431>=_0xe1cf0e){_0x471431=_0xe1cf0e;_0x1debb9=0xc8;}else{_0x1debb9=0xce;}_0x5bae3d[_0x0707('0x15')](_0x1debb9);return _0x5bae3d[_0x0707('0x1a')]('Content-Range',_0x13d5de+'-'+_0x471431+'/'+_0xe1cf0e)[_0x0707('0x1b')](_0x429da2);}return null;};}function patchUpdates(_0x360caf){return function(_0x37d1fd){try{jsonpatch['apply'](_0x37d1fd,_0x360caf,!![]);}catch(_0x5c8731){return BPromise['reject'](_0x5c8731);}return _0x37d1fd[_0x0707('0x1c')]();};}function saveUpdates(_0x3f31e1,_0x1d133c){return function(_0x51dec4){if(_0x51dec4){return _0x51dec4['update'](_0x3f31e1)[_0x0707('0x1d')](function(_0x225a58){return _0x225a58;});}return null;};}function removeEntity(_0x370554,_0x3e9c41){return function(_0x3ba507){if(_0x3ba507){return _0x3ba507[_0x0707('0x1e')]()[_0x0707('0x1d')](function(){_0x370554[_0x0707('0x15')](0xcc)[_0x0707('0x16')]();});}};}function handleEntityNotFound(_0x3dc5fb,_0x392acd){return function(_0x373bca){if(!_0x373bca){_0x3dc5fb['sendStatus'](0x194);}return _0x373bca;};}function handleError(_0x14d68b,_0x1834e0){_0x1834e0=_0x1834e0||0x1f4;return function(_0x3be832){logger[_0x0707('0x1f')](_0x3be832['stack']);if(_0x3be832[_0x0707('0x20')]){delete _0x3be832[_0x0707('0x20')];}_0x14d68b[_0x0707('0x15')](_0x1834e0)[_0x0707('0x21')](_0x3be832);};}exports[_0x0707('0x22')]=function(_0x599090,_0x1a4f0b){var _0x3378a5={},_0x2f0ed2={},_0x2d7c68={'count':0x0,'rows':[]};var _0x5e8cbf=_[_0x0707('0x23')](db[_0x0707('0x24')][_0x0707('0x25')],function(_0x451c3f){return{'name':_0x451c3f[_0x0707('0x26')],'type':_0x451c3f[_0x0707('0x27')][_0x0707('0x28')]};});_0x2f0ed2['model']=_['map'](_0x5e8cbf,_0x0707('0x20'));_0x2f0ed2[_0x0707('0x29')]=_[_0x0707('0x2a')](_0x599090[_0x0707('0x29')]);_0x2f0ed2['filters']=_[_0x0707('0x2b')](_0x2f0ed2[_0x0707('0x2c')],_0x2f0ed2['query']);_0x3378a5[_0x0707('0x2d')]=_[_0x0707('0x2b')](_0x2f0ed2['model'],qs[_0x0707('0x2e')](_0x599090[_0x0707('0x29')]['fields']));_0x3378a5[_0x0707('0x2d')]=_0x3378a5[_0x0707('0x2d')]['length']?_0x3378a5[_0x0707('0x2d')]:_0x2f0ed2[_0x0707('0x2c')];if(!_0x599090[_0x0707('0x29')][_0x0707('0x2f')](_0x0707('0x30'))){_0x3378a5[_0x0707('0x18')]=qs[_0x0707('0x18')](_0x599090['query'][_0x0707('0x18')]);_0x3378a5[_0x0707('0x17')]=qs[_0x0707('0x17')](_0x599090['query'][_0x0707('0x17')]);}_0x3378a5[_0x0707('0x31')]=qs['sort'](_0x599090[_0x0707('0x29')][_0x0707('0x32')]);_0x3378a5[_0x0707('0x33')]=qs['filters'](_[_0x0707('0x34')](_0x599090['query'],_0x2f0ed2[_0x0707('0x35')]),_0x5e8cbf);if(_0x599090[_0x0707('0x29')][_0x0707('0x36')]){_0x3378a5[_0x0707('0x33')]=_[_0x0707('0x37')](_0x3378a5[_0x0707('0x33')],{'$or':_[_0x0707('0x23')](_0x5e8cbf,function(_0x23c13f){if(_0x23c13f[_0x0707('0x27')]!==_0x0707('0x38')){var _0x4da7c={};_0x4da7c[_0x23c13f[_0x0707('0x20')]]={'$like':'%'+_0x599090[_0x0707('0x29')][_0x0707('0x36')]+'%'};return _0x4da7c;}})});}_0x3378a5=_[_0x0707('0x37')]({},_0x3378a5,_0x599090[_0x0707('0x39')]);var _0x374e21={'where':_0x3378a5[_0x0707('0x33')]};return db[_0x0707('0x24')]['count'](_0x374e21)[_0x0707('0x1d')](function(_0x3cce6b){_0x2d7c68[_0x0707('0x3a')]=_0x3cce6b;if(_0x599090['query']['includeAll']){_0x3378a5[_0x0707('0x3b')]=[{'all':!![]}];}return db[_0x0707('0x24')]['findAll'](_0x3378a5);})[_0x0707('0x1d')](function(_0x2d9c47){_0x2d7c68[_0x0707('0x3c')]=_0x2d9c47;return _0x2d7c68;})[_0x0707('0x1d')](respondWithFilteredResult(_0x1a4f0b,_0x3378a5))[_0x0707('0x3d')](handleError(_0x1a4f0b,null));};exports['show']=function(_0x12eb2f,_0x56bf6e){var _0x2d67d6={'raw':!![],'where':{'id':_0x12eb2f[_0x0707('0x3e')]['id']}},_0x508cc2={};_0x508cc2[_0x0707('0x2c')]=_[_0x0707('0x2a')](db[_0x0707('0x24')][_0x0707('0x25')]);_0x508cc2[_0x0707('0x29')]=_['keys'](_0x12eb2f[_0x0707('0x29')]);_0x508cc2[_0x0707('0x35')]=_[_0x0707('0x2b')](_0x508cc2[_0x0707('0x2c')],_0x508cc2['query']);_0x2d67d6['attributes']=_[_0x0707('0x2b')](_0x508cc2[_0x0707('0x2c')],qs[_0x0707('0x2e')](_0x12eb2f[_0x0707('0x29')][_0x0707('0x2e')]));_0x2d67d6[_0x0707('0x2d')]=_0x2d67d6[_0x0707('0x2d')][_0x0707('0x3f')]?_0x2d67d6[_0x0707('0x2d')]:_0x508cc2[_0x0707('0x2c')];if(_0x12eb2f[_0x0707('0x29')]['includeAll']){_0x2d67d6[_0x0707('0x3b')]=[{'all':!![]}];}_0x2d67d6=_[_0x0707('0x37')]({},_0x2d67d6,_0x12eb2f[_0x0707('0x39')]);return db['FaxQueueReport'][_0x0707('0x40')](_0x2d67d6)[_0x0707('0x1d')](handleEntityNotFound(_0x56bf6e,null))[_0x0707('0x1d')](respondWithResult(_0x56bf6e,null))[_0x0707('0x3d')](handleError(_0x56bf6e,null));};exports[_0x0707('0x41')]=function(_0x2dae01,_0x1e560f){return db[_0x0707('0x24')]['create'](_0x2dae01[_0x0707('0x42')],{})[_0x0707('0x1d')](respondWithResult(_0x1e560f,0xc9))[_0x0707('0x3d')](handleError(_0x1e560f,null));};exports[_0x0707('0x43')]=function(_0x19a4df,_0x5e5d53){if(_0x19a4df[_0x0707('0x42')]['id']){delete _0x19a4df[_0x0707('0x42')]['id'];}return db[_0x0707('0x24')][_0x0707('0x40')]({'where':{'id':_0x19a4df['params']['id']}})[_0x0707('0x1d')](handleEntityNotFound(_0x5e5d53,null))['then'](saveUpdates(_0x19a4df[_0x0707('0x42')],null))[_0x0707('0x1d')](respondWithResult(_0x5e5d53,null))[_0x0707('0x3d')](handleError(_0x5e5d53,null));};exports[_0x0707('0x1e')]=function(_0x504255,_0x2aa0){return db[_0x0707('0x24')][_0x0707('0x40')]({'where':{'id':_0x504255[_0x0707('0x3e')]['id']}})[_0x0707('0x1d')](handleEntityNotFound(_0x2aa0,null))[_0x0707('0x1d')](removeEntity(_0x2aa0,null))['catch'](handleError(_0x2aa0,null));};exports[_0x0707('0x44')]=function(_0x1db4b5,_0x474463){return db[_0x0707('0x24')][_0x0707('0x44')]()[_0x0707('0x1d')](respondWithResult(_0x474463,null))['catch'](handleError(_0x474463,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f4b8715..7f952dd 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x5e7ecb,_0x581b23){var _0x1ffe43=function(_0x2de838){while(--_0x2de838){_0x5e7ecb['push'](_0x5e7ecb['shift']());}};_0x1ffe43(++_0x581b23);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x814b,0x1a2));var _0xb814=function(_0x45a7a6,_0x380289){_0x45a7a6=_0x45a7a6-0x0;var _0x514f51=_0x814b[_0x45a7a6];return _0x514f51;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d0ed892..8e53656 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 _0x0cf2=['limit','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateFaxQueueReport','FaxQueueReport','create','options','UpdateFaxQueueReport','body','raw','where','attributes'];(function(_0x352fbf,_0x5d417d){var _0x45784a=function(_0x22a0ff){while(--_0x22a0ff){_0x352fbf['push'](_0x352fbf['shift']());}};_0x45784a(++_0x5d417d);}(_0x0cf2,0xf9));var _0x20cf=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x0cf2[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var util=require(_0x20cf('0x0'));var moment=require(_0x20cf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20cf('0x2'));var db=require(_0x20cf('0x3'))['db'];var utils=require(_0x20cf('0x4'));var logger=require('../../config/logger')(_0x20cf('0x5'));var config=require(_0x20cf('0x6'));var jayson=require(_0x20cf('0x7'));var client=jayson['client'][_0x20cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7b50e4,_0xa698bf,_0x5c0546){return new BPromise(function(_0x1204a9,_0x48be2e){return client[_0x20cf('0x9')](_0x7b50e4,_0x5c0546)[_0x20cf('0xa')](function(_0x45289a){logger['info'](_0x20cf('0xb'),_0xa698bf,_0x20cf('0xc'));logger[_0x20cf('0xd')](_0x20cf('0xe'),_0xa698bf,_0x20cf('0xc'),JSON[_0x20cf('0xf')](_0x45289a));if(_0x45289a[_0x20cf('0x10')]){if(_0x45289a['error'][_0x20cf('0x11')]===0x1f4){logger[_0x20cf('0x10')](_0x20cf('0xb'),_0xa698bf,_0x45289a[_0x20cf('0x10')]['message']);return _0x48be2e(_0x45289a[_0x20cf('0x10')][_0x20cf('0x12')]);}logger['error'](_0x20cf('0xb'),_0xa698bf,_0x45289a[_0x20cf('0x10')]['message']);return _0x1204a9(_0x45289a[_0x20cf('0x10')][_0x20cf('0x12')]);}else{logger[_0x20cf('0x13')](_0x20cf('0xb'),_0xa698bf,_0x20cf('0xc'));_0x1204a9(_0x45289a['result'][_0x20cf('0x12')]);}})[_0x20cf('0x14')](function(_0x374115){logger[_0x20cf('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0xa698bf,_0x374115);_0x48be2e(_0x374115);});});}exports[_0x20cf('0x15')]=function(_0x43a5b0){var _0x139da9=this;return new Promise(function(_0x486980,_0x40dd1a){return db[_0x20cf('0x16')][_0x20cf('0x17')](_0x43a5b0['body'],{'raw':_0x43a5b0[_0x20cf('0x18')]?_0x43a5b0[_0x20cf('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x20cf('0xa')](function(_0xec4d51){logger['info'](_0x20cf('0x15'),_0x43a5b0);logger[_0x20cf('0xd')](_0x20cf('0x15'),_0x43a5b0,JSON['stringify'](_0xec4d51));_0x486980(_0xec4d51);})[_0x20cf('0x14')](function(_0x714a32){logger[_0x20cf('0x10')](_0x20cf('0x15'),_0x714a32[_0x20cf('0x12')],_0x43a5b0);_0x40dd1a(_0x139da9[_0x20cf('0x10')](0x1f4,_0x714a32[_0x20cf('0x12')]));});});};exports[_0x20cf('0x19')]=function(_0x31a8b9){var _0x1ea3b6=this;return new Promise(function(_0x14762c,_0x55b509){return db[_0x20cf('0x16')]['update'](_0x31a8b9[_0x20cf('0x1a')],{'raw':_0x31a8b9[_0x20cf('0x18')]?_0x31a8b9[_0x20cf('0x18')][_0x20cf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31a8b9['options']?_0x31a8b9['options'][_0x20cf('0x1c')]||null:null,'attributes':_0x31a8b9['options']?_0x31a8b9[_0x20cf('0x18')][_0x20cf('0x1d')]||null:null,'limit':_0x31a8b9[_0x20cf('0x18')]?_0x31a8b9['options'][_0x20cf('0x1e')]||null:null})[_0x20cf('0xa')](function(_0x5e953c){logger[_0x20cf('0x13')](_0x20cf('0x19'),_0x31a8b9);logger['debug'](_0x20cf('0x19'),_0x31a8b9,JSON[_0x20cf('0xf')](_0x5e953c));_0x14762c(_0x5e953c);})['catch'](function(_0x22f071){logger[_0x20cf('0x10')](_0x20cf('0x19'),_0x22f071['message'],_0x31a8b9);_0x55b509(_0x1ea3b6[_0x20cf('0x10')](0x1f4,_0x22f071[_0x20cf('0x12')]));});});}; \ No newline at end of file +var _0x1792=['where','attributes','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update'];(function(_0x4d3759,_0x3a8cde){var _0x36b555=function(_0x38e39a){while(--_0x38e39a){_0x4d3759['push'](_0x4d3759['shift']());}};_0x36b555(++_0x3a8cde);}(_0x1792,0x65));var _0x2179=function(_0x5800a5,_0x2823f6){_0x5800a5=_0x5800a5-0x0;var _0x420c85=_0x1792[_0x5800a5];return _0x420c85;};'use strict';var _=require('lodash');var util=require(_0x2179('0x0'));var moment=require(_0x2179('0x1'));var BPromise=require('bluebird');var rs=require(_0x2179('0x2'));var fs=require('fs');var Redis=require(_0x2179('0x3'));var db=require(_0x2179('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2179('0x5'))(_0x2179('0x6'));var config=require('../../config/environment');var jayson=require(_0x2179('0x7'));var client=jayson[_0x2179('0x8')][_0x2179('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x373ea7,_0x5d9720,_0x17ba43){return new BPromise(function(_0xdf1bb,_0x51a0bc){return client[_0x2179('0xa')](_0x373ea7,_0x17ba43)[_0x2179('0xb')](function(_0x3ee55a){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x5d9720,_0x2179('0xc'));logger[_0x2179('0xd')](_0x2179('0xe'),_0x5d9720,_0x2179('0xc'),JSON[_0x2179('0xf')](_0x3ee55a));if(_0x3ee55a[_0x2179('0x10')]){if(_0x3ee55a[_0x2179('0x10')][_0x2179('0x11')]===0x1f4){logger[_0x2179('0x10')](_0x2179('0x12'),_0x5d9720,_0x3ee55a[_0x2179('0x10')][_0x2179('0x13')]);return _0x51a0bc(_0x3ee55a['error'][_0x2179('0x13')]);}logger[_0x2179('0x10')](_0x2179('0x12'),_0x5d9720,_0x3ee55a[_0x2179('0x10')]['message']);return _0xdf1bb(_0x3ee55a['error']['message']);}else{logger[_0x2179('0x14')](_0x2179('0x12'),_0x5d9720,_0x2179('0xc'));_0xdf1bb(_0x3ee55a[_0x2179('0x15')][_0x2179('0x13')]);}})[_0x2179('0x16')](function(_0x12bc87){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5d9720,_0x12bc87);_0x51a0bc(_0x12bc87);});});}exports['CreateFaxQueueReport']=function(_0x26fafc){var _0x200f74=this;return new Promise(function(_0x500e81,_0x17aff5){return db[_0x2179('0x17')][_0x2179('0x18')](_0x26fafc[_0x2179('0x19')],{'raw':_0x26fafc['options']?_0x26fafc[_0x2179('0x1a')][_0x2179('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x192372){logger[_0x2179('0x14')](_0x2179('0x1c'),_0x26fafc);logger[_0x2179('0xd')](_0x2179('0x1c'),_0x26fafc,JSON[_0x2179('0xf')](_0x192372));_0x500e81(_0x192372);})[_0x2179('0x16')](function(_0xcdeab5){logger[_0x2179('0x10')](_0x2179('0x1c'),_0xcdeab5[_0x2179('0x13')],_0x26fafc);_0x17aff5(_0x200f74[_0x2179('0x10')](0x1f4,_0xcdeab5[_0x2179('0x13')]));});});};exports[_0x2179('0x1d')]=function(_0x4b529c){var _0x504112=this;return new Promise(function(_0x46dc9f,_0x580f47){return db[_0x2179('0x17')][_0x2179('0x1e')](_0x4b529c[_0x2179('0x19')],{'raw':_0x4b529c[_0x2179('0x1a')]?_0x4b529c[_0x2179('0x1a')][_0x2179('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b529c[_0x2179('0x1a')]?_0x4b529c[_0x2179('0x1a')][_0x2179('0x1f')]||null:null,'attributes':_0x4b529c[_0x2179('0x1a')]?_0x4b529c[_0x2179('0x1a')][_0x2179('0x20')]||null:null,'limit':_0x4b529c['options']?_0x4b529c[_0x2179('0x1a')]['limit']||null:null})[_0x2179('0xb')](function(_0x430f37){logger[_0x2179('0x14')](_0x2179('0x1d'),_0x4b529c);logger[_0x2179('0xd')](_0x2179('0x1d'),_0x4b529c,JSON[_0x2179('0xf')](_0x430f37));_0x46dc9f(_0x430f37);})[_0x2179('0x16')](function(_0x57e8bc){logger[_0x2179('0x10')](_0x2179('0x1d'),_0x57e8bc[_0x2179('0x13')],_0x4b529c);_0x580f47(_0x504112[_0x2179('0x10')](0x1f4,_0x57e8bc['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 74169e3..6256aab 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 _0x6666=['/describe','describe','/:id','show','post','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6666,0x10b));var _0x6666=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x6666[_0x307d86];return _0x361745;};'use strict';var multer=require(_0x6666('0x0'));var util=require(_0x6666('0x1'));var path=require(_0x6666('0x2'));var timeout=require(_0x6666('0x3'));var express=require(_0x6666('0x4'));var router=express['Router']();var fs_extra=require(_0x6666('0x5'));var auth=require(_0x6666('0x6'));var interaction=require(_0x6666('0x7'));var config=require(_0x6666('0x8'));var controller=require(_0x6666('0x9'));router[_0x6666('0xa')]('/',auth[_0x6666('0xb')](),controller[_0x6666('0xc')]);router[_0x6666('0xa')](_0x6666('0xd'),auth['isAuthenticated'](),controller[_0x6666('0xe')]);router[_0x6666('0xa')](_0x6666('0xf'),auth[_0x6666('0xb')](),controller[_0x6666('0x10')]);router[_0x6666('0x11')]('/',auth[_0x6666('0xb')](),controller['create']);router['put'](_0x6666('0xf'),auth[_0x6666('0xb')](),controller['update']);router['delete'](_0x6666('0xf'),auth['isAuthenticated'](),controller[_0x6666('0x12')]);module[_0x6666('0x13')]=router; \ No newline at end of file +var _0xceb9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put','delete','destroy'];(function(_0x3b8644,_0x2beda8){var _0x469f74=function(_0x49db04){while(--_0x49db04){_0x3b8644['push'](_0x3b8644['shift']());}};_0x469f74(++_0x2beda8);}(_0xceb9,0x18d));var _0x9ceb=function(_0x22929a,_0x5615d2){_0x22929a=_0x22929a-0x0;var _0x2140a5=_0xceb9[_0x22929a];return _0x2140a5;};'use strict';var multer=require(_0x9ceb('0x0'));var util=require(_0x9ceb('0x1'));var path=require(_0x9ceb('0x2'));var timeout=require(_0x9ceb('0x3'));var express=require(_0x9ceb('0x4'));var router=express[_0x9ceb('0x5')]();var fs_extra=require(_0x9ceb('0x6'));var auth=require(_0x9ceb('0x7'));var interaction=require(_0x9ceb('0x8'));var config=require('../../config/environment');var controller=require(_0x9ceb('0x9'));router['get']('/',auth[_0x9ceb('0xa')](),controller['index']);router['get'](_0x9ceb('0xb'),auth[_0x9ceb('0xa')](),controller[_0x9ceb('0xc')]);router[_0x9ceb('0xd')](_0x9ceb('0xe'),auth['isAuthenticated'](),controller[_0x9ceb('0xf')]);router[_0x9ceb('0x10')]('/',auth['isAuthenticated'](),controller[_0x9ceb('0x11')]);router[_0x9ceb('0x12')](_0x9ceb('0xe'),auth[_0x9ceb('0xa')](),controller['update']);router[_0x9ceb('0x13')](_0x9ceb('0xe'),auth[_0x9ceb('0xa')](),controller[_0x9ceb('0x14')]);module[_0x9ceb('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 93e5856..5cbc1fd 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4129ee,_0x58463e){var _0x13e6b8=function(_0xdd805f){while(--_0xdd805f){_0x4129ee['push'](_0x4129ee['shift']());}};_0x13e6b8(++_0x58463e);}(_0xedd9,0xfc));var _0x9edd=function(_0x5df77c,_0x3404c1){_0x5df77c=_0x5df77c-0x0;var _0x490a13=_0xedd9[_0x5df77c];return _0x490a13;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2e7a3f,_0x588e2a){var _0x663314=function(_0x2e6d4a){while(--_0x2e6d4a){_0x2e7a3f['push'](_0x2e7a3f['shift']());}};_0x663314(++_0x588e2a);}(_0xaa88,0x137));var _0x8aa8=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0xaa88[_0x1139d0];return _0xcc01a6;};'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 7523df7..2061c20 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 _0xb535=['hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length'];(function(_0x476597,_0x1a8a61){var _0x1235be=function(_0xd369fd){while(--_0xd369fd){_0x476597['push'](_0x476597['shift']());}};_0x1235be(++_0x1a8a61);}(_0xb535,0x193));var _0x5b53=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xb535[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x5b53('0x0'));var rimraf=require(_0x5b53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b53('0x2'));var rp=require(_0x5b53('0x3'));var moment=require(_0x5b53('0x4'));var BPromise=require(_0x5b53('0x5'));var Mustache=require(_0x5b53('0x6'));var util=require(_0x5b53('0x7'));var path=require(_0x5b53('0x8'));var sox=require(_0x5b53('0x9'));var csv=require('to-csv');var ejs=require(_0x5b53('0xa'));var fs=require('fs');var fs_extra=require(_0x5b53('0xb'));var _=require(_0x5b53('0xc'));var squel=require(_0x5b53('0xd'));var crypto=require(_0x5b53('0xe'));var jsforce=require(_0x5b53('0xf'));var deskjs=require(_0x5b53('0x10'));var toCsv=require(_0x5b53('0x11'));var querystring=require(_0x5b53('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5b53('0x13'));var as=require(_0x5b53('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b53('0x15'))(_0x5b53('0x16'));var utils=require('../../config/utils');var config=require(_0x5b53('0x17'));var licenseUtil=require(_0x5b53('0x18'));var db=require(_0x5b53('0x19'))['db'];function respondWithStatusCode(_0x434bb0,_0x40ad75){_0x40ad75=_0x40ad75||0xcc;return function(_0xc970a1){if(_0xc970a1){return _0x434bb0['sendStatus'](_0x40ad75);}return _0x434bb0[_0x5b53('0x1a')](_0x40ad75)[_0x5b53('0x1b')]();};}function respondWithResult(_0x457fa9,_0x3db60f){_0x3db60f=_0x3db60f||0xc8;return function(_0x15f3e0){if(_0x15f3e0){return _0x457fa9[_0x5b53('0x1a')](_0x3db60f)[_0x5b53('0x1c')](_0x15f3e0);}};}function respondWithFilteredResult(_0x3192e2,_0x48f459){return function(_0x360424){if(_0x360424){var _0x1e1932=typeof _0x48f459[_0x5b53('0x1d')]===_0x5b53('0x1e')&&typeof _0x48f459[_0x5b53('0x1f')]===_0x5b53('0x1e');var _0x8d1725=_0x360424[_0x5b53('0x20')];var _0x8cc6b6=_0x1e1932?0x0:_0x48f459[_0x5b53('0x1d')];var _0x238785=_0x1e1932?_0x360424[_0x5b53('0x20')]:_0x48f459['offset']+_0x48f459['limit'];var _0x178724;if(_0x238785>=_0x8d1725){_0x238785=_0x8d1725;_0x178724=0xc8;}else{_0x178724=0xce;}_0x3192e2[_0x5b53('0x1a')](_0x178724);return _0x3192e2[_0x5b53('0x21')](_0x5b53('0x22'),_0x8cc6b6+'-'+_0x238785+'/'+_0x8d1725)[_0x5b53('0x1c')](_0x360424);}return null;};}function patchUpdates(_0x5907b1){return function(_0x1a9a4f){try{jsonpatch['apply'](_0x1a9a4f,_0x5907b1,!![]);}catch(_0x5cacd5){return BPromise[_0x5b53('0x23')](_0x5cacd5);}return _0x1a9a4f[_0x5b53('0x24')]();};}function saveUpdates(_0xb8864b,_0x4a5b0c){return function(_0x2326dd){if(_0x2326dd){return _0x2326dd[_0x5b53('0x25')](_0xb8864b)[_0x5b53('0x26')](function(_0x50f672){return _0x50f672;});}return null;};}function removeEntity(_0x6d6240,_0x21d1fa){return function(_0x4b8209){if(_0x4b8209){return _0x4b8209[_0x5b53('0x27')]()[_0x5b53('0x26')](function(){_0x6d6240[_0x5b53('0x1a')](0xcc)[_0x5b53('0x1b')]();});}};}function handleEntityNotFound(_0x308d3c,_0x28e592){return function(_0x50c099){if(!_0x50c099){_0x308d3c[_0x5b53('0x28')](0x194);}return _0x50c099;};}function handleError(_0x1d9869,_0x1c79e6){_0x1c79e6=_0x1c79e6||0x1f4;return function(_0x14f5f5){logger[_0x5b53('0x29')](_0x14f5f5[_0x5b53('0x2a')]);if(_0x14f5f5['name']){delete _0x14f5f5[_0x5b53('0x2b')];}_0x1d9869[_0x5b53('0x1a')](_0x1c79e6)[_0x5b53('0x2c')](_0x14f5f5);};}exports[_0x5b53('0x2d')]=function(_0x407f94,_0x464e43){var _0xa61780={},_0x733598={},_0x410cec={'count':0x0,'rows':[]};var _0x3fd433=_[_0x5b53('0x2e')](db[_0x5b53('0x2f')][_0x5b53('0x30')],function(_0x58aaec){return{'name':_0x58aaec[_0x5b53('0x31')],'type':_0x58aaec[_0x5b53('0x32')][_0x5b53('0x33')]};});_0x733598['model']=_['map'](_0x3fd433,_0x5b53('0x2b'));_0x733598[_0x5b53('0x34')]=_['keys'](_0x407f94[_0x5b53('0x34')]);_0x733598[_0x5b53('0x35')]=_[_0x5b53('0x36')](_0x733598['model'],_0x733598[_0x5b53('0x34')]);_0xa61780[_0x5b53('0x37')]=_[_0x5b53('0x36')](_0x733598[_0x5b53('0x38')],qs[_0x5b53('0x39')](_0x407f94[_0x5b53('0x34')]['fields']));_0xa61780['attributes']=_0xa61780[_0x5b53('0x37')][_0x5b53('0x3a')]?_0xa61780['attributes']:_0x733598[_0x5b53('0x38')];if(!_0x407f94[_0x5b53('0x34')][_0x5b53('0x3b')](_0x5b53('0x3c'))){_0xa61780[_0x5b53('0x1f')]=qs['limit'](_0x407f94[_0x5b53('0x34')][_0x5b53('0x1f')]);_0xa61780[_0x5b53('0x1d')]=qs[_0x5b53('0x1d')](_0x407f94[_0x5b53('0x34')][_0x5b53('0x1d')]);}_0xa61780[_0x5b53('0x3d')]=qs[_0x5b53('0x3e')](_0x407f94[_0x5b53('0x34')][_0x5b53('0x3e')]);_0xa61780[_0x5b53('0x3f')]=qs[_0x5b53('0x35')](_[_0x5b53('0x40')](_0x407f94[_0x5b53('0x34')],_0x733598[_0x5b53('0x35')]),_0x3fd433);if(_0x407f94[_0x5b53('0x34')]['filter']){_0xa61780[_0x5b53('0x3f')]=_[_0x5b53('0x41')](_0xa61780[_0x5b53('0x3f')],{'$or':_[_0x5b53('0x2e')](_0x3fd433,function(_0x59860f){if(_0x59860f['type']!=='VIRTUAL'){var _0x54281e={};_0x54281e[_0x59860f['name']]={'$like':'%'+_0x407f94[_0x5b53('0x34')][_0x5b53('0x42')]+'%'};return _0x54281e;}})});}_0xa61780=_[_0x5b53('0x41')]({},_0xa61780,_0x407f94[_0x5b53('0x43')]);var _0x168ba1={'where':_0xa61780[_0x5b53('0x3f')]};return db['FaxTransferReport'][_0x5b53('0x20')](_0x168ba1)[_0x5b53('0x26')](function(_0x2736a4){_0x410cec[_0x5b53('0x20')]=_0x2736a4;if(_0x407f94[_0x5b53('0x34')][_0x5b53('0x44')]){_0xa61780[_0x5b53('0x45')]=[{'all':!![]}];}return db[_0x5b53('0x2f')][_0x5b53('0x46')](_0xa61780);})['then'](function(_0x2c575c){_0x410cec[_0x5b53('0x47')]=_0x2c575c;return _0x410cec;})['then'](respondWithFilteredResult(_0x464e43,_0xa61780))[_0x5b53('0x48')](handleError(_0x464e43,null));};exports['show']=function(_0x5e809a,_0x45906b){var _0x2003ed={'raw':!![],'where':{'id':_0x5e809a[_0x5b53('0x49')]['id']}},_0x5f24ab={};_0x5f24ab[_0x5b53('0x38')]=_[_0x5b53('0x4a')](db['FaxTransferReport'][_0x5b53('0x30')]);_0x5f24ab['query']=_[_0x5b53('0x4a')](_0x5e809a[_0x5b53('0x34')]);_0x5f24ab[_0x5b53('0x35')]=_[_0x5b53('0x36')](_0x5f24ab[_0x5b53('0x38')],_0x5f24ab[_0x5b53('0x34')]);_0x2003ed[_0x5b53('0x37')]=_['intersection'](_0x5f24ab[_0x5b53('0x38')],qs[_0x5b53('0x39')](_0x5e809a[_0x5b53('0x34')][_0x5b53('0x39')]));_0x2003ed[_0x5b53('0x37')]=_0x2003ed[_0x5b53('0x37')][_0x5b53('0x3a')]?_0x2003ed['attributes']:_0x5f24ab[_0x5b53('0x38')];if(_0x5e809a[_0x5b53('0x34')][_0x5b53('0x44')]){_0x2003ed[_0x5b53('0x45')]=[{'all':!![]}];}_0x2003ed=_[_0x5b53('0x41')]({},_0x2003ed,_0x5e809a[_0x5b53('0x43')]);return db[_0x5b53('0x2f')][_0x5b53('0x4b')](_0x2003ed)[_0x5b53('0x26')](handleEntityNotFound(_0x45906b,null))[_0x5b53('0x26')](respondWithResult(_0x45906b,null))[_0x5b53('0x48')](handleError(_0x45906b,null));};exports['create']=function(_0x526903,_0x3bfb57){return db[_0x5b53('0x2f')]['create'](_0x526903['body'],{})[_0x5b53('0x26')](respondWithResult(_0x3bfb57,0xc9))[_0x5b53('0x48')](handleError(_0x3bfb57,null));};exports[_0x5b53('0x25')]=function(_0x4fbc3b,_0x237bc0){if(_0x4fbc3b['body']['id']){delete _0x4fbc3b['body']['id'];}return db[_0x5b53('0x2f')][_0x5b53('0x4b')]({'where':{'id':_0x4fbc3b[_0x5b53('0x49')]['id']}})[_0x5b53('0x26')](handleEntityNotFound(_0x237bc0,null))[_0x5b53('0x26')](saveUpdates(_0x4fbc3b['body'],null))[_0x5b53('0x26')](respondWithResult(_0x237bc0,null))[_0x5b53('0x48')](handleError(_0x237bc0,null));};exports[_0x5b53('0x27')]=function(_0x4959d9,_0x5b8d8c){return db['FaxTransferReport'][_0x5b53('0x4b')]({'where':{'id':_0x4959d9['params']['id']}})[_0x5b53('0x26')](handleEntityNotFound(_0x5b8d8c,null))[_0x5b53('0x26')](removeEntity(_0x5b8d8c,null))[_0x5b53('0x48')](handleError(_0x5b8d8c,null));};exports[_0x5b53('0x4c')]=function(_0x57e5a5,_0x2003c9){return db[_0x5b53('0x2f')][_0x5b53('0x4c')]()[_0x5b53('0x26')](respondWithResult(_0x2003c9,null))['catch'](handleError(_0x2003c9,null));}; \ No newline at end of file +var _0x2775=['count','set','Content-Range','json','apply','save','update','then','end','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','offset','limit','undefined'];(function(_0xfd76a8,_0x1cfcf5){var _0x7a0fbf=function(_0x38cc0e){while(--_0x38cc0e){_0xfd76a8['push'](_0xfd76a8['shift']());}};_0x7a0fbf(++_0x1cfcf5);}(_0x2775,0x110));var _0x5277=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2775[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x5277('0x0'));var rimraf=require(_0x5277('0x1'));var zipdir=require(_0x5277('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5277('0x3'));var moment=require(_0x5277('0x4'));var BPromise=require(_0x5277('0x5'));var Mustache=require('mustache');var util=require(_0x5277('0x6'));var path=require(_0x5277('0x7'));var sox=require(_0x5277('0x8'));var csv=require(_0x5277('0x9'));var ejs=require(_0x5277('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5277('0xb'));var crypto=require(_0x5277('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5277('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5277('0xe'));var Papa=require('papaparse');var Redis=require(_0x5277('0xf'));var authService=require(_0x5277('0x10'));var qs=require(_0x5277('0x11'));var as=require(_0x5277('0x12'));var hardwareService=require(_0x5277('0x13'));var logger=require(_0x5277('0x14'))(_0x5277('0x15'));var utils=require(_0x5277('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x260bce,_0x1457b0){_0x1457b0=_0x1457b0||0xcc;return function(_0x38fc43){if(_0x38fc43){return _0x260bce[_0x5277('0x17')](_0x1457b0);}return _0x260bce[_0x5277('0x18')](_0x1457b0)['end']();};}function respondWithResult(_0x3c6fcb,_0x185b59){_0x185b59=_0x185b59||0xc8;return function(_0xac3541){if(_0xac3541){return _0x3c6fcb[_0x5277('0x18')](_0x185b59)['json'](_0xac3541);}};}function respondWithFilteredResult(_0x1aff2c,_0x353ce6){return function(_0x1fb36f){if(_0x1fb36f){var _0x2f2a2c=typeof _0x353ce6[_0x5277('0x19')]==='undefined'&&typeof _0x353ce6[_0x5277('0x1a')]===_0x5277('0x1b');var _0x5ebe22=_0x1fb36f[_0x5277('0x1c')];var _0x50fb2c=_0x2f2a2c?0x0:_0x353ce6[_0x5277('0x19')];var _0x5b8775=_0x2f2a2c?_0x1fb36f[_0x5277('0x1c')]:_0x353ce6[_0x5277('0x19')]+_0x353ce6[_0x5277('0x1a')];var _0xebe592;if(_0x5b8775>=_0x5ebe22){_0x5b8775=_0x5ebe22;_0xebe592=0xc8;}else{_0xebe592=0xce;}_0x1aff2c[_0x5277('0x18')](_0xebe592);return _0x1aff2c[_0x5277('0x1d')](_0x5277('0x1e'),_0x50fb2c+'-'+_0x5b8775+'/'+_0x5ebe22)[_0x5277('0x1f')](_0x1fb36f);}return null;};}function patchUpdates(_0xfa389){return function(_0x469636){try{jsonpatch[_0x5277('0x20')](_0x469636,_0xfa389,!![]);}catch(_0x2b8f4a){return BPromise['reject'](_0x2b8f4a);}return _0x469636[_0x5277('0x21')]();};}function saveUpdates(_0x54e08a,_0x5b5461){return function(_0x9c12b0){if(_0x9c12b0){return _0x9c12b0[_0x5277('0x22')](_0x54e08a)[_0x5277('0x23')](function(_0x46076c){return _0x46076c;});}return null;};}function removeEntity(_0x338bb6,_0x4ce57e){return function(_0x507bf2){if(_0x507bf2){return _0x507bf2['destroy']()['then'](function(){_0x338bb6[_0x5277('0x18')](0xcc)[_0x5277('0x24')]();});}};}function handleEntityNotFound(_0x3423c9,_0x1753ac){return function(_0x1e190d){if(!_0x1e190d){_0x3423c9[_0x5277('0x17')](0x194);}return _0x1e190d;};}function handleError(_0x372db8,_0x327fe7){_0x327fe7=_0x327fe7||0x1f4;return function(_0x42643c){logger[_0x5277('0x25')](_0x42643c['stack']);if(_0x42643c[_0x5277('0x26')]){delete _0x42643c[_0x5277('0x26')];}_0x372db8['status'](_0x327fe7)[_0x5277('0x27')](_0x42643c);};}exports[_0x5277('0x28')]=function(_0x3491cc,_0x518325){var _0xe54420={},_0x4fdc10={},_0x346aa6={'count':0x0,'rows':[]};var _0x4abf02=_[_0x5277('0x29')](db[_0x5277('0x2a')][_0x5277('0x2b')],function(_0x3961ca){return{'name':_0x3961ca[_0x5277('0x2c')],'type':_0x3961ca['type'][_0x5277('0x2d')]};});_0x4fdc10[_0x5277('0x2e')]=_[_0x5277('0x29')](_0x4abf02,_0x5277('0x26'));_0x4fdc10[_0x5277('0x2f')]=_[_0x5277('0x30')](_0x3491cc[_0x5277('0x2f')]);_0x4fdc10[_0x5277('0x31')]=_[_0x5277('0x32')](_0x4fdc10[_0x5277('0x2e')],_0x4fdc10['query']);_0xe54420[_0x5277('0x33')]=_['intersection'](_0x4fdc10['model'],qs[_0x5277('0x34')](_0x3491cc[_0x5277('0x2f')][_0x5277('0x34')]));_0xe54420[_0x5277('0x33')]=_0xe54420[_0x5277('0x33')][_0x5277('0x35')]?_0xe54420[_0x5277('0x33')]:_0x4fdc10[_0x5277('0x2e')];if(!_0x3491cc[_0x5277('0x2f')][_0x5277('0x36')](_0x5277('0x37'))){_0xe54420[_0x5277('0x1a')]=qs['limit'](_0x3491cc['query'][_0x5277('0x1a')]);_0xe54420[_0x5277('0x19')]=qs[_0x5277('0x19')](_0x3491cc[_0x5277('0x2f')][_0x5277('0x19')]);}_0xe54420[_0x5277('0x38')]=qs[_0x5277('0x39')](_0x3491cc[_0x5277('0x2f')][_0x5277('0x39')]);_0xe54420[_0x5277('0x3a')]=qs[_0x5277('0x31')](_[_0x5277('0x3b')](_0x3491cc[_0x5277('0x2f')],_0x4fdc10[_0x5277('0x31')]),_0x4abf02);if(_0x3491cc['query'][_0x5277('0x3c')]){_0xe54420[_0x5277('0x3a')]=_[_0x5277('0x3d')](_0xe54420[_0x5277('0x3a')],{'$or':_['map'](_0x4abf02,function(_0xb0b919){if(_0xb0b919[_0x5277('0x3e')]!=='VIRTUAL'){var _0x25c3fd={};_0x25c3fd[_0xb0b919[_0x5277('0x26')]]={'$like':'%'+_0x3491cc[_0x5277('0x2f')][_0x5277('0x3c')]+'%'};return _0x25c3fd;}})});}_0xe54420=_[_0x5277('0x3d')]({},_0xe54420,_0x3491cc[_0x5277('0x3f')]);var _0x1956f2={'where':_0xe54420[_0x5277('0x3a')]};return db[_0x5277('0x2a')]['count'](_0x1956f2)['then'](function(_0x5ae064){_0x346aa6[_0x5277('0x1c')]=_0x5ae064;if(_0x3491cc[_0x5277('0x2f')][_0x5277('0x40')]){_0xe54420['include']=[{'all':!![]}];}return db[_0x5277('0x2a')][_0x5277('0x41')](_0xe54420);})['then'](function(_0x5d2587){_0x346aa6[_0x5277('0x42')]=_0x5d2587;return _0x346aa6;})['then'](respondWithFilteredResult(_0x518325,_0xe54420))['catch'](handleError(_0x518325,null));};exports['show']=function(_0x413b9,_0x17f3e4){var _0x3e1136={'raw':!![],'where':{'id':_0x413b9[_0x5277('0x43')]['id']}},_0x13fe94={};_0x13fe94['model']=_['keys'](db['FaxTransferReport'][_0x5277('0x2b')]);_0x13fe94['query']=_[_0x5277('0x30')](_0x413b9[_0x5277('0x2f')]);_0x13fe94[_0x5277('0x31')]=_[_0x5277('0x32')](_0x13fe94[_0x5277('0x2e')],_0x13fe94[_0x5277('0x2f')]);_0x3e1136['attributes']=_[_0x5277('0x32')](_0x13fe94[_0x5277('0x2e')],qs[_0x5277('0x34')](_0x413b9[_0x5277('0x2f')][_0x5277('0x34')]));_0x3e1136[_0x5277('0x33')]=_0x3e1136[_0x5277('0x33')]['length']?_0x3e1136[_0x5277('0x33')]:_0x13fe94['model'];if(_0x413b9[_0x5277('0x2f')][_0x5277('0x40')]){_0x3e1136[_0x5277('0x44')]=[{'all':!![]}];}_0x3e1136=_[_0x5277('0x3d')]({},_0x3e1136,_0x413b9['options']);return db[_0x5277('0x2a')][_0x5277('0x45')](_0x3e1136)[_0x5277('0x23')](handleEntityNotFound(_0x17f3e4,null))['then'](respondWithResult(_0x17f3e4,null))[_0x5277('0x46')](handleError(_0x17f3e4,null));};exports[_0x5277('0x47')]=function(_0x259c9e,_0x3b9763){return db[_0x5277('0x2a')]['create'](_0x259c9e['body'],{})[_0x5277('0x23')](respondWithResult(_0x3b9763,0xc9))[_0x5277('0x46')](handleError(_0x3b9763,null));};exports[_0x5277('0x22')]=function(_0x91b946,_0x5bcf98){if(_0x91b946[_0x5277('0x48')]['id']){delete _0x91b946[_0x5277('0x48')]['id'];}return db[_0x5277('0x2a')][_0x5277('0x45')]({'where':{'id':_0x91b946[_0x5277('0x43')]['id']}})[_0x5277('0x23')](handleEntityNotFound(_0x5bcf98,null))['then'](saveUpdates(_0x91b946[_0x5277('0x48')],null))[_0x5277('0x23')](respondWithResult(_0x5bcf98,null))[_0x5277('0x46')](handleError(_0x5bcf98,null));};exports[_0x5277('0x49')]=function(_0x57df09,_0x2dcba6){return db['FaxTransferReport'][_0x5277('0x45')]({'where':{'id':_0x57df09[_0x5277('0x43')]['id']}})[_0x5277('0x23')](handleEntityNotFound(_0x2dcba6,null))[_0x5277('0x23')](removeEntity(_0x2dcba6,null))[_0x5277('0x46')](handleError(_0x2dcba6,null));};exports['describe']=function(_0x5e6fc2,_0x104e20){return db['FaxTransferReport'][_0x5277('0x4a')]()[_0x5277('0x23')](respondWithResult(_0x104e20,null))[_0x5277('0x46')](handleError(_0x104e20,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 83c5439..a97fc24 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 _0x70d2=['define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x342bd6,_0x57d790){var _0x46d96f=function(_0x3352a9){while(--_0x3352a9){_0x342bd6['push'](_0x342bd6['shift']());}};_0x46d96f(++_0x57d790);}(_0x70d2,0x93));var _0x270d=function(_0xd5e3bf,_0x3c50f1){_0xd5e3bf=_0xd5e3bf-0x0;var _0x214ce2=_0x70d2[_0xd5e3bf];return _0x214ce2;};'use strict';var _=require(_0x270d('0x0'));var util=require(_0x270d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x270d('0x2'));var BPromise=require(_0x270d('0x3'));var rp=require(_0x270d('0x4'));var fs=require('fs');var path=require(_0x270d('0x5'));var rimraf=require('rimraf');var config=require(_0x270d('0x6'));var attributes=require(_0x270d('0x7'));module[_0x270d('0x8')]=function(_0x478dd3,_0x1e10ea){return _0x478dd3[_0x270d('0x9')](_0x270d('0xa'),attributes,{'tableName':_0x270d('0xb'),'paranoid':![],'indexes':[{'name':_0x270d('0xc'),'fields':[_0x270d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad3a=['./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x234563,_0x1b724c){var _0x33334e=function(_0x40321d){while(--_0x40321d){_0x234563['push'](_0x234563['shift']());}};_0x33334e(++_0x1b724c);}(_0xad3a,0x13d));var _0xaad3=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xad3a[_0x243217];return _0x478029;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaad3('0x0'))(_0xaad3('0x1'));var moment=require(_0xaad3('0x2'));var BPromise=require(_0xaad3('0x3'));var rp=require(_0xaad3('0x4'));var fs=require('fs');var path=require(_0xaad3('0x5'));var rimraf=require(_0xaad3('0x6'));var config=require(_0xaad3('0x7'));var attributes=require(_0xaad3('0x8'));module[_0xaad3('0x9')]=function(_0x277700,_0x533571){return _0x277700['define'](_0xaad3('0xa'),attributes,{'tableName':_0xaad3('0xb'),'paranoid':![],'indexes':[{'name':_0xaad3('0xc'),'fields':[_0xaad3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1f632e0..80cb2cf 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 _0x9ffc=['lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x49311d,_0x35803c){var _0x5d10d6=function(_0x435794){while(--_0x435794){_0x49311d['push'](_0x49311d['shift']());}};_0x5d10d6(++_0x35803c);}(_0x9ffc,0xa8));var _0xc9ff=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x9ffc[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require(_0xc9ff('0x0'));var util=require(_0xc9ff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc9ff('0x2'));var fs=require('fs');var Redis=require(_0xc9ff('0x3'));var db=require(_0xc9ff('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc9ff('0x5'));var config=require(_0xc9ff('0x6'));var jayson=require(_0xc9ff('0x7'));var client=jayson[_0xc9ff('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9e7ed,_0x46521,_0x1f0c0b){return new BPromise(function(_0x40748d,_0x4635f){return client[_0xc9ff('0x9')](_0x9e7ed,_0x1f0c0b)[_0xc9ff('0xa')](function(_0x502a13){logger[_0xc9ff('0xb')](_0xc9ff('0xc'),_0x46521,_0xc9ff('0xd'));logger[_0xc9ff('0xe')](_0xc9ff('0xf'),_0x46521,_0xc9ff('0xd'),JSON[_0xc9ff('0x10')](_0x502a13));if(_0x502a13['error']){if(_0x502a13[_0xc9ff('0x11')][_0xc9ff('0x12')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x46521,_0x502a13[_0xc9ff('0x11')][_0xc9ff('0x13')]);return _0x4635f(_0x502a13[_0xc9ff('0x11')][_0xc9ff('0x13')]);}logger[_0xc9ff('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x46521,_0x502a13['error'][_0xc9ff('0x13')]);return _0x40748d(_0x502a13[_0xc9ff('0x11')][_0xc9ff('0x13')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x46521,'request\x20sent');_0x40748d(_0x502a13['result'][_0xc9ff('0x13')]);}})[_0xc9ff('0x14')](function(_0x2ecfc2){logger[_0xc9ff('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x46521,_0x2ecfc2);_0x4635f(_0x2ecfc2);});});} \ No newline at end of file +var _0xecff=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util'];(function(_0x16f88a,_0x2948fe){var _0x178cb7=function(_0x58cde4){while(--_0x58cde4){_0x16f88a['push'](_0x16f88a['shift']());}};_0x178cb7(++_0x2948fe);}(_0xecff,0xf6));var _0xfecf=function(_0xce0c61,_0x3769c0){_0xce0c61=_0xce0c61-0x0;var _0x36d93c=_0xecff[_0xce0c61];return _0x36d93c;};'use strict';var _=require('lodash');var util=require(_0xfecf('0x0'));var moment=require('moment');var BPromise=require(_0xfecf('0x1'));var rs=require(_0xfecf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfecf('0x3'))['db'];var utils=require(_0xfecf('0x4'));var logger=require('../../config/logger')(_0xfecf('0x5'));var config=require(_0xfecf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfecf('0x7')][_0xfecf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8c2113,_0x3da3c1,_0x1d622b){return new BPromise(function(_0x56506c,_0x1d6584){return client[_0xfecf('0x9')](_0x8c2113,_0x1d622b)[_0xfecf('0xa')](function(_0x1bd325){logger['info'](_0xfecf('0xb'),_0x3da3c1,'request\x20sent');logger[_0xfecf('0xc')](_0xfecf('0xd'),_0x3da3c1,_0xfecf('0xe'),JSON[_0xfecf('0xf')](_0x1bd325));if(_0x1bd325[_0xfecf('0x10')]){if(_0x1bd325[_0xfecf('0x10')]['code']===0x1f4){logger['error'](_0xfecf('0xb'),_0x3da3c1,_0x1bd325[_0xfecf('0x10')][_0xfecf('0x11')]);return _0x1d6584(_0x1bd325[_0xfecf('0x10')][_0xfecf('0x11')]);}logger[_0xfecf('0x10')](_0xfecf('0xb'),_0x3da3c1,_0x1bd325[_0xfecf('0x10')][_0xfecf('0x11')]);return _0x56506c(_0x1bd325[_0xfecf('0x10')]['message']);}else{logger['info'](_0xfecf('0xb'),_0x3da3c1,_0xfecf('0xe'));_0x56506c(_0x1bd325[_0xfecf('0x12')]['message']);}})['catch'](function(_0x1c4bb6){logger[_0xfecf('0x10')](_0xfecf('0xb'),_0x3da3c1,_0x1c4bb6);_0x1d6584(_0x1c4bb6);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b78306f..1afcac4 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 _0xfed9=['isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x467816,_0x404825){var _0x2708b4=function(_0x564830){while(--_0x564830){_0x467816['push'](_0x467816['shift']());}};_0x2708b4(++_0x404825);}(_0xfed9,0xe5));var _0x9fed=function(_0x386306,_0x1363c9){_0x386306=_0x386306-0x0;var _0xcb23d=_0xfed9[_0x386306];return _0xcb23d;};'use strict';var multer=require('multer');var util=require(_0x9fed('0x0'));var path=require(_0x9fed('0x1'));var timeout=require(_0x9fed('0x2'));var express=require(_0x9fed('0x3'));var router=express[_0x9fed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9fed('0x5'));var interaction=require(_0x9fed('0x6'));var config=require(_0x9fed('0x7'));var controller=require('./faxTransferReport.controller');router[_0x9fed('0x8')]('/',auth['isAuthenticated'](),controller[_0x9fed('0x9')]);router[_0x9fed('0x8')](_0x9fed('0xa'),auth[_0x9fed('0xb')](),controller[_0x9fed('0xc')]);router[_0x9fed('0x8')](_0x9fed('0xd'),auth[_0x9fed('0xb')](),controller[_0x9fed('0xe')]);router[_0x9fed('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9fed('0x10')](_0x9fed('0xd'),auth[_0x9fed('0xb')](),controller[_0x9fed('0x11')]);router[_0x9fed('0x12')](_0x9fed('0xd'),auth[_0x9fed('0xb')](),controller[_0x9fed('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbf8d=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0xbf8d,0x13b));var _0xdbf8=function(_0x136659,_0x661891){_0x136659=_0x136659-0x0;var _0x192cd9=_0xbf8d[_0x136659];return _0x192cd9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdbf8('0x0'));var timeout=require(_0xdbf8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdbf8('0x2'));var auth=require(_0xdbf8('0x3'));var interaction=require(_0xdbf8('0x4'));var config=require(_0xdbf8('0x5'));var controller=require(_0xdbf8('0x6'));router[_0xdbf8('0x7')]('/',auth[_0xdbf8('0x8')](),controller[_0xdbf8('0x9')]);router[_0xdbf8('0x7')](_0xdbf8('0xa'),auth[_0xdbf8('0x8')](),controller[_0xdbf8('0xb')]);router[_0xdbf8('0x7')](_0xdbf8('0xc'),auth[_0xdbf8('0x8')](),controller[_0xdbf8('0xd')]);router[_0xdbf8('0xe')]('/',auth[_0xdbf8('0x8')](),controller[_0xdbf8('0xf')]);router[_0xdbf8('0x10')](_0xdbf8('0xc'),auth[_0xdbf8('0x8')](),controller[_0xdbf8('0x11')]);router[_0xdbf8('0x12')](_0xdbf8('0xc'),auth['isAuthenticated'](),controller[_0xdbf8('0x13')]);module[_0xdbf8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index b21c212..bda7fa7 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 _0x67d6=['post','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x67d6,0xd5));var _0x667d=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x67d6[_0x4c8a8f];return _0x404500;};'use strict';var multer=require('multer');var util=require(_0x667d('0x0'));var path=require(_0x667d('0x1'));var timeout=require(_0x667d('0x2'));var express=require(_0x667d('0x3'));var router=express[_0x667d('0x4')]();var fs_extra=require(_0x667d('0x5'));var auth=require(_0x667d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x667d('0x7'));var controller=require(_0x667d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x667d('0x9')]);router['get'](_0x667d('0xa'),auth[_0x667d('0xb')](),controller[_0x667d('0xc')]);router[_0x667d('0xd')](_0x667d('0xe'),auth['isAuthenticated'](),controller[_0x667d('0xf')]);router[_0x667d('0xd')](_0x667d('0x10'),auth[_0x667d('0xb')](),controller['getFields']);router[_0x667d('0x11')]('/',auth[_0x667d('0xb')](),controller['create']);router[_0x667d('0x11')](_0x667d('0xe'),auth[_0x667d('0xb')](),controller[_0x667d('0x12')]);router[_0x667d('0x13')](_0x667d('0xa'),auth['isAuthenticated'](),controller[_0x667d('0x14')]);router['delete'](_0x667d('0xa'),auth[_0x667d('0xb')](),controller[_0x667d('0x15')]);module[_0x667d('0x16')]=router; \ No newline at end of file +var _0xbf32=['/:id','/:id/configurations','post','create','addConfiguration','delete','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x2a574b,_0x548a73){var _0x2e4ed3=function(_0x1ea83a){while(--_0x1ea83a){_0x2a574b['push'](_0x2a574b['shift']());}};_0x2e4ed3(++_0x548a73);}(_0xbf32,0x88));var _0x2bf3=function(_0x23f713,_0x192541){_0x23f713=_0x23f713-0x0;var _0x47ad32=_0xbf32[_0x23f713];return _0x47ad32;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2bf3('0x0'));var router=express['Router']();var fs_extra=require(_0x2bf3('0x1'));var auth=require(_0x2bf3('0x2'));var interaction=require(_0x2bf3('0x3'));var config=require(_0x2bf3('0x4'));var controller=require(_0x2bf3('0x5'));router[_0x2bf3('0x6')]('/',auth[_0x2bf3('0x7')](),controller['index']);router[_0x2bf3('0x6')](_0x2bf3('0x8'),auth[_0x2bf3('0x7')](),controller['show']);router[_0x2bf3('0x6')](_0x2bf3('0x9'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2bf3('0x6')]('/:id/fields',auth[_0x2bf3('0x7')](),controller['getFields']);router[_0x2bf3('0xa')]('/',auth['isAuthenticated'](),controller[_0x2bf3('0xb')]);router[_0x2bf3('0xa')](_0x2bf3('0x9'),auth[_0x2bf3('0x7')](),controller[_0x2bf3('0xc')]);router['put'](_0x2bf3('0x8'),auth[_0x2bf3('0x7')](),controller['update']);router[_0x2bf3('0xd')](_0x2bf3('0x8'),auth[_0x2bf3('0x7')](),controller[_0x2bf3('0xe')]);module[_0x2bf3('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a65bd31..fa549db 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 _0x18df=['newTab','sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x1453f4,_0x592062){var _0x5bff97=function(_0x423bc2){while(--_0x423bc2){_0x1453f4['push'](_0x1453f4['shift']());}};_0x5bff97(++_0x592062);}(_0x18df,0x79));var _0xf18d=function(_0x46f2f5,_0x4ed4e7){_0x46f2f5=_0x46f2f5-0x0;var _0x61919a=_0x18df[_0x46f2f5];return _0x61919a;};'use strict';var Sequelize=require(_0xf18d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf18d('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf18d('0x1')]},'authType':{'type':Sequelize[_0xf18d('0x2')](_0xf18d('0x3')),'defaultValue':_0xf18d('0x3')},'password':{'type':Sequelize[_0xf18d('0x1')]},'consumerKey':{'type':Sequelize[_0xf18d('0x1')]},'consumerSecret':{'type':Sequelize[_0xf18d('0x1')]},'token':{'type':Sequelize[_0xf18d('0x1')]},'tokenSecret':{'type':Sequelize[_0xf18d('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf18d('0x2')](_0xf18d('0x4'),_0xf18d('0x5')),'defaultValue':_0xf18d('0x4')}}; \ No newline at end of file +var _0xe352=['newTab','STRING','basic','ENUM','integrationTab'];(function(_0x7f5eb5,_0x124f16){var _0x4eff06=function(_0x4eb444){while(--_0x4eb444){_0x7f5eb5['push'](_0x7f5eb5['shift']());}};_0x4eff06(++_0x124f16);}(_0xe352,0x1aa));var _0x2e35=function(_0x1373c8,_0x2dea8b){_0x1373c8=_0x1373c8-0x0;var _0x5c1ce5=_0xe352[_0x1373c8];return _0x5c1ce5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2e35('0x0')]},'description':{'type':Sequelize[_0x2e35('0x0')]},'username':{'type':Sequelize[_0x2e35('0x0')]},'remoteUri':{'type':Sequelize[_0x2e35('0x0')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x2e35('0x1')},'password':{'type':Sequelize[_0x2e35('0x0')]},'consumerKey':{'type':Sequelize[_0x2e35('0x0')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2e35('0x0')]},'tokenSecret':{'type':Sequelize[_0x2e35('0x0')]},'serverUrl':{'type':Sequelize[_0x2e35('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x2e35('0x2')](_0x2e35('0x3'),_0x2e35('0x4')),'defaultValue':_0x2e35('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c134341..3d0610d 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 _0x0344=['DeskAccount','rawAttributes','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','create','body','find','getConfigurations','DeskConfiguration','order','pick','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','getFields','priority','authType','username','password','token','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x1afd99,_0x16f9ba){var _0x5edea5=function(_0x318da7){while(--_0x318da7){_0x1afd99['push'](_0x1afd99['shift']());}};_0x5edea5(++_0x16f9ba);}(_0x0344,0xb4));var _0x4034=function(_0x96f237,_0xd13695){_0x96f237=_0x96f237-0x0;var _0x3fa15e=_0x0344[_0x96f237];return _0x3fa15e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4034('0x0'));var zipdir=require(_0x4034('0x1'));var jsonpatch=require(_0x4034('0x2'));var rp=require(_0x4034('0x3'));var moment=require(_0x4034('0x4'));var BPromise=require(_0x4034('0x5'));var Mustache=require(_0x4034('0x6'));var util=require(_0x4034('0x7'));var path=require(_0x4034('0x8'));var sox=require(_0x4034('0x9'));var csv=require(_0x4034('0xa'));var ejs=require(_0x4034('0xb'));var fs=require('fs');var fs_extra=require(_0x4034('0xc'));var _=require(_0x4034('0xd'));var squel=require(_0x4034('0xe'));var crypto=require('crypto');var jsforce=require(_0x4034('0xf'));var deskjs=require(_0x4034('0x10'));var toCsv=require(_0x4034('0xa'));var querystring=require(_0x4034('0x11'));var Papa=require(_0x4034('0x12'));var Redis=require(_0x4034('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4034('0x14'));var as=require(_0x4034('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4034('0x16'))(_0x4034('0x17'));var utils=require(_0x4034('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4034('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4034('0x1a'));function respondWithStatusCode(_0x5a1ac1,_0x11d980){_0x11d980=_0x11d980||0xcc;return function(_0x47f7f1){if(_0x47f7f1){return _0x5a1ac1[_0x4034('0x1b')](_0x11d980);}return _0x5a1ac1[_0x4034('0x1c')](_0x11d980)[_0x4034('0x1d')]();};}function respondWithResult(_0x78e0e7,_0x21358d){_0x21358d=_0x21358d||0xc8;return function(_0x1d2a75){if(_0x1d2a75){return _0x78e0e7[_0x4034('0x1c')](_0x21358d)[_0x4034('0x1e')](_0x1d2a75);}};}function respondWithFilteredResult(_0x1f4164,_0x4f9fa8){return function(_0x20a7e5){if(_0x20a7e5){var _0x531f4a=typeof _0x4f9fa8[_0x4034('0x1f')]===_0x4034('0x20')&&typeof _0x4f9fa8[_0x4034('0x21')]==='undefined';var _0x5bf8f3=_0x20a7e5['count'];var _0x4269c8=_0x531f4a?0x0:_0x4f9fa8['offset'];var _0x56e09b=_0x531f4a?_0x20a7e5[_0x4034('0x22')]:_0x4f9fa8['offset']+_0x4f9fa8[_0x4034('0x21')];var _0x4c87da;if(_0x56e09b>=_0x5bf8f3){_0x56e09b=_0x5bf8f3;_0x4c87da=0xc8;}else{_0x4c87da=0xce;}_0x1f4164[_0x4034('0x1c')](_0x4c87da);return _0x1f4164[_0x4034('0x23')](_0x4034('0x24'),_0x4269c8+'-'+_0x56e09b+'/'+_0x5bf8f3)[_0x4034('0x1e')](_0x20a7e5);}return null;};}function patchUpdates(_0x16c7e2){return function(_0x3ef203){try{jsonpatch['apply'](_0x3ef203,_0x16c7e2,!![]);}catch(_0x501810){return BPromise[_0x4034('0x25')](_0x501810);}return _0x3ef203[_0x4034('0x26')]();};}function saveUpdates(_0x399e4d,_0xf05988){return function(_0xe99a93){if(_0xe99a93){return _0xe99a93[_0x4034('0x27')](_0x399e4d)['then'](function(_0xb4031f){return _0xb4031f;});}return null;};}function removeEntity(_0x18240e,_0x5f347e){return function(_0x1b9182){if(_0x1b9182){return _0x1b9182[_0x4034('0x28')]()[_0x4034('0x29')](function(){_0x18240e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48fd1a,_0x22b055){return function(_0x32deaa){if(!_0x32deaa){_0x48fd1a[_0x4034('0x1b')](0x194);}return _0x32deaa;};}function handleError(_0x7c11ab,_0x598ce7){_0x598ce7=_0x598ce7||0x1f4;return function(_0x170bbf){logger[_0x4034('0x2a')](_0x170bbf[_0x4034('0x2b')]);if(_0x170bbf[_0x4034('0x2c')]){delete _0x170bbf[_0x4034('0x2c')];}_0x7c11ab[_0x4034('0x1c')](_0x598ce7)[_0x4034('0x2d')](_0x170bbf);};}exports['index']=function(_0x57265a,_0x80f231){var _0x2ecf8c={},_0x38defb={},_0x50ea48={'count':0x0,'rows':[]};var _0x4be577=_['map'](db[_0x4034('0x2e')][_0x4034('0x2f')],function(_0x1905d6){return{'name':_0x1905d6['fieldName'],'type':_0x1905d6[_0x4034('0x30')]['key']};});_0x38defb[_0x4034('0x31')]=_[_0x4034('0x32')](_0x4be577,'name');_0x38defb[_0x4034('0x33')]=_['keys'](_0x57265a['query']);_0x38defb[_0x4034('0x34')]=_[_0x4034('0x35')](_0x38defb[_0x4034('0x31')],_0x38defb[_0x4034('0x33')]);_0x2ecf8c[_0x4034('0x36')]=_[_0x4034('0x35')](_0x38defb[_0x4034('0x31')],qs['fields'](_0x57265a['query']['fields']));_0x2ecf8c[_0x4034('0x36')]=_0x2ecf8c[_0x4034('0x36')][_0x4034('0x37')]?_0x2ecf8c[_0x4034('0x36')]:_0x38defb[_0x4034('0x31')];if(!_0x57265a['query'][_0x4034('0x38')](_0x4034('0x39'))){_0x2ecf8c['limit']=qs[_0x4034('0x21')](_0x57265a[_0x4034('0x33')][_0x4034('0x21')]);_0x2ecf8c[_0x4034('0x1f')]=qs[_0x4034('0x1f')](_0x57265a[_0x4034('0x33')][_0x4034('0x1f')]);}_0x2ecf8c['order']=qs[_0x4034('0x3a')](_0x57265a[_0x4034('0x33')]['sort']);_0x2ecf8c['where']=qs[_0x4034('0x34')](_['pick'](_0x57265a[_0x4034('0x33')],_0x38defb[_0x4034('0x34')]),_0x4be577);if(_0x57265a[_0x4034('0x33')][_0x4034('0x3b')]){_0x2ecf8c[_0x4034('0x3c')]=_[_0x4034('0x3d')](_0x2ecf8c['where'],{'$or':_[_0x4034('0x32')](_0x4be577,function(_0x25fb2f){if(_0x25fb2f[_0x4034('0x30')]!==_0x4034('0x3e')){var _0x4e71b3={};_0x4e71b3[_0x25fb2f[_0x4034('0x2c')]]={'$like':'%'+_0x57265a['query'][_0x4034('0x3b')]+'%'};return _0x4e71b3;}})});}_0x2ecf8c=_[_0x4034('0x3d')]({},_0x2ecf8c,_0x57265a['options']);var _0xdec2f0={'where':_0x2ecf8c[_0x4034('0x3c')]};return db[_0x4034('0x2e')]['count'](_0xdec2f0)[_0x4034('0x29')](function(_0xec30a7){_0x50ea48[_0x4034('0x22')]=_0xec30a7;if(_0x57265a['query'][_0x4034('0x3f')]){_0x2ecf8c[_0x4034('0x40')]=[{'all':!![]}];}return db[_0x4034('0x2e')][_0x4034('0x41')](_0x2ecf8c);})[_0x4034('0x29')](function(_0x5ecee4){_0x50ea48[_0x4034('0x42')]=_0x5ecee4;return _0x50ea48;})[_0x4034('0x29')](respondWithFilteredResult(_0x80f231,_0x2ecf8c))[_0x4034('0x43')](handleError(_0x80f231,null));};exports[_0x4034('0x44')]=function(_0x430d39,_0x3ce6a9){var _0x5e0f64={'raw':![],'where':{'id':_0x430d39[_0x4034('0x45')]['id']}},_0x4de421={};_0x4de421[_0x4034('0x31')]=_['keys'](db[_0x4034('0x2e')]['rawAttributes']);_0x4de421[_0x4034('0x33')]=_[_0x4034('0x46')](_0x430d39[_0x4034('0x33')]);_0x4de421[_0x4034('0x34')]=_[_0x4034('0x35')](_0x4de421[_0x4034('0x31')],_0x4de421['query']);_0x5e0f64[_0x4034('0x36')]=_[_0x4034('0x35')](_0x4de421['model'],qs['fields'](_0x430d39[_0x4034('0x33')][_0x4034('0x47')]));_0x5e0f64[_0x4034('0x36')]=_0x5e0f64['attributes'][_0x4034('0x37')]?_0x5e0f64[_0x4034('0x36')]:_0x4de421[_0x4034('0x31')];if(_0x430d39[_0x4034('0x33')]['includeAll']){_0x5e0f64['include']=[{'all':!![]}];}_0x5e0f64=_[_0x4034('0x3d')]({},_0x5e0f64,_0x430d39[_0x4034('0x48')]);return db['DeskAccount']['find'](_0x5e0f64)[_0x4034('0x29')](handleEntityNotFound(_0x3ce6a9,null))[_0x4034('0x29')](respondWithResult(_0x3ce6a9,null))[_0x4034('0x43')](handleError(_0x3ce6a9,null));};exports[_0x4034('0x49')]=function(_0x4319b8,_0x3e3354){return db[_0x4034('0x2e')]['create'](_0x4319b8[_0x4034('0x4a')],{})[_0x4034('0x29')](respondWithResult(_0x3e3354,0xc9))['catch'](handleError(_0x3e3354,null));};exports['update']=function(_0x3dbfd8,_0x565bd3){if(_0x3dbfd8[_0x4034('0x4a')]['id']){delete _0x3dbfd8[_0x4034('0x4a')]['id'];}return db['DeskAccount'][_0x4034('0x4b')]({'where':{'id':_0x3dbfd8[_0x4034('0x45')]['id']}})[_0x4034('0x29')](handleEntityNotFound(_0x565bd3,null))[_0x4034('0x29')](saveUpdates(_0x3dbfd8[_0x4034('0x4a')],null))[_0x4034('0x29')](respondWithResult(_0x565bd3,null))[_0x4034('0x43')](handleError(_0x565bd3,null));};exports[_0x4034('0x28')]=function(_0x3e3dc9,_0x221c7d){return db[_0x4034('0x2e')][_0x4034('0x4b')]({'where':{'id':_0x3e3dc9['params']['id']}})[_0x4034('0x29')](handleEntityNotFound(_0x221c7d,null))[_0x4034('0x29')](removeEntity(_0x221c7d,null))[_0x4034('0x43')](handleError(_0x221c7d,null));};exports[_0x4034('0x4c')]=function(_0x4e761f,_0x5e3297,_0x53b369){var _0x47547f={};var _0x1baba7={};var _0x11b845;var _0x1c4e74;return db[_0x4034('0x2e')]['findOne']({'where':{'id':_0x4e761f['params']['id']}})[_0x4034('0x29')](handleEntityNotFound(_0x5e3297,null))['then'](function(_0x491e54){if(_0x491e54){_0x11b845=_0x491e54;_0x1baba7[_0x4034('0x31')]=_[_0x4034('0x46')](db[_0x4034('0x4d')][_0x4034('0x2f')]);_0x1baba7[_0x4034('0x33')]=_[_0x4034('0x46')](_0x4e761f[_0x4034('0x33')]);_0x1baba7[_0x4034('0x34')]=_[_0x4034('0x35')](_0x1baba7['model'],_0x1baba7[_0x4034('0x33')]);_0x47547f[_0x4034('0x36')]=_[_0x4034('0x35')](_0x1baba7[_0x4034('0x31')],qs[_0x4034('0x47')](_0x4e761f[_0x4034('0x33')]['fields']));_0x47547f[_0x4034('0x36')]=_0x47547f['attributes']['length']?_0x47547f[_0x4034('0x36')]:_0x1baba7[_0x4034('0x31')];_0x47547f[_0x4034('0x4e')]=qs[_0x4034('0x3a')](_0x4e761f['query'][_0x4034('0x3a')]);_0x47547f[_0x4034('0x3c')]=qs[_0x4034('0x34')](_[_0x4034('0x4f')](_0x4e761f[_0x4034('0x33')],_0x1baba7[_0x4034('0x34')]));if(_0x4e761f[_0x4034('0x33')][_0x4034('0x3b')]){_0x47547f['where']=_['merge'](_0x47547f[_0x4034('0x3c')],{'$or':_[_0x4034('0x32')](_0x47547f[_0x4034('0x36')],function(_0x5e6449){var _0x5ea1f2={};_0x5ea1f2[_0x5e6449]={'$like':'%'+_0x4e761f[_0x4034('0x33')]['filter']+'%'};return _0x5ea1f2;})});}_0x47547f=_[_0x4034('0x3d')]({},_0x47547f,_0x4e761f[_0x4034('0x48')]);return _0x11b845[_0x4034('0x4c')](_0x47547f);}})[_0x4034('0x29')](function(_0x3cf405){if(_0x3cf405){_0x1c4e74=_0x3cf405[_0x4034('0x37')];if(!_0x4e761f['query'][_0x4034('0x38')](_0x4034('0x39'))){_0x47547f[_0x4034('0x21')]=qs['limit'](_0x4e761f['query'][_0x4034('0x21')]);_0x47547f[_0x4034('0x1f')]=qs['offset'](_0x4e761f[_0x4034('0x33')][_0x4034('0x1f')]);}return _0x11b845['getConfigurations'](_0x47547f);}})[_0x4034('0x29')](function(_0xad066c){if(_0xad066c){return _0xad066c?{'count':_0x1c4e74,'rows':_0xad066c}:null;}})[_0x4034('0x29')](respondWithResult(_0x5e3297,null))[_0x4034('0x43')](handleError(_0x5e3297,null));};exports['addConfiguration']=function(_0x12b0fb,_0xc8239,_0x293480){if(_0x12b0fb[_0x4034('0x4a')]['id']){delete _0x12b0fb[_0x4034('0x4a')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x12b0fb[_0x4034('0x45')]['id']}})[_0x4034('0x29')](handleEntityNotFound(_0xc8239,null))[_0x4034('0x29')](function(_0x468b96){if(_0x468b96){_0x12b0fb[_0x4034('0x4a')][_0x4034('0x50')]=_0x468b96['id'];_0x12b0fb[_0x4034('0x4a')][_0x4034('0x51')]=integrations[_0x4034('0x52')](_0x12b0fb[_0x4034('0x4a')][_0x4034('0x53')],_0x12b0fb['body'][_0x4034('0x30')]);_0x12b0fb[_0x4034('0x4a')]['Descriptions']=integrations[_0x4034('0x54')](_0x12b0fb[_0x4034('0x4a')][_0x4034('0x53')],_0x12b0fb[_0x4034('0x4a')][_0x4034('0x30')]);return db[_0x4034('0x4d')][_0x4034('0x49')](_0x12b0fb[_0x4034('0x4a')],{'include':[{'model':db[_0x4034('0x55')],'as':'Subjects'},{'model':db[_0x4034('0x55')],'as':'Descriptions'}]});}return null;})[_0x4034('0x29')](respondWithResult(_0xc8239,null))[_0x4034('0x43')](handleError(_0xc8239,null));};exports[_0x4034('0x56')]=function(_0x449a00,_0x30e43f,_0x332bf4){var _0x4319e9=[{'name':_0x4034('0x57'),'label':_0x4034('0x57'),'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 _0x51bcef='';return db[_0x4034('0x2e')]['findOne']({'where':{'id':_0x449a00['params']['id']},'attributes':['id','remoteUri',_0x4034('0x58'),_0x4034('0x59'),_0x4034('0x5a'),'consumerKey','consumerSecret',_0x4034('0x5b'),'tokenSecret']})[_0x4034('0x29')](handleEntityNotFound(_0x30e43f,null))[_0x4034('0x29')](function(_0x42d95e){if(_0x42d95e){_0x51bcef=_0x42d95e['remoteUri'];var _0x3bf05d=_0x51bcef['slice'](-0x1);if(_0x3bf05d==='/'){_0x51bcef=_0x51bcef[_0x4034('0x5c')](0x0,_0x51bcef[_0x4034('0x5d')](_0x3bf05d));}var _0xf50c68={'method':_0x4034('0x5e'),'uri':util[_0x4034('0x5f')]('%s/custom_fields',_0x51bcef),'headers':{'Content-Type':_0x4034('0x60'),'Accept':_0x4034('0x60')},'json':!![]};if(_0x42d95e[_0x4034('0x58')]===_0x4034('0x61')){_0xf50c68[_0x4034('0x62')][_0x4034('0x63')]=util[_0x4034('0x5f')](_0x4034('0x64'),new Buffer(util[_0x4034('0x5f')](_0x4034('0x65'),_0x42d95e[_0x4034('0x59')],_0x42d95e[_0x4034('0x5a')]))[_0x4034('0x66')](_0x4034('0x67')));}return rp(_0xf50c68)[_0x4034('0x29')](function(_0x31ed0d){return _0x4319e9[_0x4034('0x68')](_['map'](_0x31ed0d[_0x4034('0x69')][_0x4034('0x6a')],function(_0x515d5a){return{'id':_0x515d5a[_0x4034('0x2c')],'name':_0x515d5a[_0x4034('0x2c')],'type':_0x515d5a[_0x4034('0x30')],'active':_0x515d5a['active'],'label':_0x515d5a[_0x4034('0x6b')],'custom':!![]};}));});}})[_0x4034('0x29')](function(_0x409f5a){return{'count':_0x409f5a['length'],'rows':_0x409f5a};})[_0x4034('0x29')](respondWithResult(_0x30e43f,null))[_0x4034('0x43')](function(_0x1ce9a2){var _0x46d501=_0x449a00['query'][_0x4034('0x6c')]?0x1f4:_0x1ce9a2[_0x4034('0x6d')]||0x1f4;logger[_0x4034('0x2a')](_0x4034('0x6e'),_0x4034('0x56'),_0x46d501,JSON[_0x4034('0x6f')](_0x1ce9a2));delete _0x1ce9a2[_0x4034('0x2c')];if(_0x46d501===0x191){_0x46d501=0x190;}_0x30e43f['status'](_0x46d501)['send'](_0x449a00[_0x4034('0x33')][_0x4034('0x6c')]?{'message':_0x4034('0x70'),'statusCode':_0x1ce9a2[_0x4034('0x6d')]}:_0x1ce9a2);});}; \ No newline at end of file +var _0x93f0=['Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','limit','order','sort','pick','filter','where','options','findAll','rows','catch','show','params','fields','includeAll','merge','create','body','find','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','DeskField','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x58b142,_0x142ba9){var _0x28acf7=function(_0x3d4011){while(--_0x3d4011){_0x58b142['push'](_0x58b142['shift']());}};_0x28acf7(++_0x142ba9);}(_0x93f0,0x1e2));var _0x093f=function(_0x531f0e,_0x284d79){_0x531f0e=_0x531f0e-0x0;var _0x1f68b1=_0x93f0[_0x531f0e];return _0x1f68b1;};'use strict';var emlformat=require(_0x093f('0x0'));var rimraf=require(_0x093f('0x1'));var zipdir=require(_0x093f('0x2'));var jsonpatch=require(_0x093f('0x3'));var rp=require(_0x093f('0x4'));var moment=require('moment');var BPromise=require(_0x093f('0x5'));var Mustache=require(_0x093f('0x6'));var util=require(_0x093f('0x7'));var path=require(_0x093f('0x8'));var sox=require(_0x093f('0x9'));var csv=require(_0x093f('0xa'));var ejs=require(_0x093f('0xb'));var fs=require('fs');var fs_extra=require(_0x093f('0xc'));var _=require(_0x093f('0xd'));var squel=require(_0x093f('0xe'));var crypto=require(_0x093f('0xf'));var jsforce=require(_0x093f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x093f('0xa'));var querystring=require('querystring');var Papa=require(_0x093f('0x11'));var Redis=require(_0x093f('0x12'));var authService=require(_0x093f('0x13'));var qs=require(_0x093f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x093f('0x15'));var logger=require(_0x093f('0x16'))('api');var utils=require(_0x093f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x093f('0x18'));var db=require(_0x093f('0x19'))['db'];var integrations=require(_0x093f('0x1a'));function respondWithStatusCode(_0x5dd0c7,_0x561049){_0x561049=_0x561049||0xcc;return function(_0xae32bc){if(_0xae32bc){return _0x5dd0c7['sendStatus'](_0x561049);}return _0x5dd0c7[_0x093f('0x1b')](_0x561049)[_0x093f('0x1c')]();};}function respondWithResult(_0x5c627b,_0x218e13){_0x218e13=_0x218e13||0xc8;return function(_0x294284){if(_0x294284){return _0x5c627b['status'](_0x218e13)['json'](_0x294284);}};}function respondWithFilteredResult(_0x493d6b,_0x3b4cd7){return function(_0x10aa84){if(_0x10aa84){var _0x1eafe2=typeof _0x3b4cd7[_0x093f('0x1d')]===_0x093f('0x1e')&&typeof _0x3b4cd7['limit']===_0x093f('0x1e');var _0x4f231f=_0x10aa84['count'];var _0x38e0c9=_0x1eafe2?0x0:_0x3b4cd7[_0x093f('0x1d')];var _0x40e81e=_0x1eafe2?_0x10aa84[_0x093f('0x1f')]:_0x3b4cd7['offset']+_0x3b4cd7['limit'];var _0x1e7c49;if(_0x40e81e>=_0x4f231f){_0x40e81e=_0x4f231f;_0x1e7c49=0xc8;}else{_0x1e7c49=0xce;}_0x493d6b[_0x093f('0x1b')](_0x1e7c49);return _0x493d6b[_0x093f('0x20')](_0x093f('0x21'),_0x38e0c9+'-'+_0x40e81e+'/'+_0x4f231f)[_0x093f('0x22')](_0x10aa84);}return null;};}function patchUpdates(_0x540aa0){return function(_0x2eb3c3){try{jsonpatch['apply'](_0x2eb3c3,_0x540aa0,!![]);}catch(_0x2b4bd8){return BPromise[_0x093f('0x23')](_0x2b4bd8);}return _0x2eb3c3[_0x093f('0x24')]();};}function saveUpdates(_0x38e0db,_0x3ce1ab){return function(_0x553589){if(_0x553589){return _0x553589['update'](_0x38e0db)[_0x093f('0x25')](function(_0xe5eb54){return _0xe5eb54;});}return null;};}function removeEntity(_0x275ff9,_0x26587c){return function(_0xbaa4ae){if(_0xbaa4ae){return _0xbaa4ae[_0x093f('0x26')]()[_0x093f('0x25')](function(){_0x275ff9[_0x093f('0x1b')](0xcc)[_0x093f('0x1c')]();});}};}function handleEntityNotFound(_0x477bf7,_0x2e1120){return function(_0x234cd9){if(!_0x234cd9){_0x477bf7['sendStatus'](0x194);}return _0x234cd9;};}function handleError(_0x1f29cb,_0x14fa2f){_0x14fa2f=_0x14fa2f||0x1f4;return function(_0x1dd446){logger[_0x093f('0x27')](_0x1dd446[_0x093f('0x28')]);if(_0x1dd446[_0x093f('0x29')]){delete _0x1dd446['name'];}_0x1f29cb[_0x093f('0x1b')](_0x14fa2f)[_0x093f('0x2a')](_0x1dd446);};}exports[_0x093f('0x2b')]=function(_0x28a19b,_0x322134){var _0x84df92={},_0x20002e={},_0x353e3e={'count':0x0,'rows':[]};var _0x318f2d=_[_0x093f('0x2c')](db[_0x093f('0x2d')][_0x093f('0x2e')],function(_0x30ac99){return{'name':_0x30ac99[_0x093f('0x2f')],'type':_0x30ac99[_0x093f('0x30')][_0x093f('0x31')]};});_0x20002e[_0x093f('0x32')]=_[_0x093f('0x2c')](_0x318f2d,_0x093f('0x29'));_0x20002e[_0x093f('0x33')]=_[_0x093f('0x34')](_0x28a19b[_0x093f('0x33')]);_0x20002e[_0x093f('0x35')]=_[_0x093f('0x36')](_0x20002e[_0x093f('0x32')],_0x20002e[_0x093f('0x33')]);_0x84df92[_0x093f('0x37')]=_['intersection'](_0x20002e['model'],qs['fields'](_0x28a19b['query']['fields']));_0x84df92[_0x093f('0x37')]=_0x84df92[_0x093f('0x37')][_0x093f('0x38')]?_0x84df92['attributes']:_0x20002e[_0x093f('0x32')];if(!_0x28a19b[_0x093f('0x33')]['hasOwnProperty'](_0x093f('0x39'))){_0x84df92['limit']=qs[_0x093f('0x3a')](_0x28a19b[_0x093f('0x33')][_0x093f('0x3a')]);_0x84df92[_0x093f('0x1d')]=qs[_0x093f('0x1d')](_0x28a19b[_0x093f('0x33')][_0x093f('0x1d')]);}_0x84df92[_0x093f('0x3b')]=qs[_0x093f('0x3c')](_0x28a19b[_0x093f('0x33')][_0x093f('0x3c')]);_0x84df92['where']=qs[_0x093f('0x35')](_[_0x093f('0x3d')](_0x28a19b[_0x093f('0x33')],_0x20002e[_0x093f('0x35')]),_0x318f2d);if(_0x28a19b[_0x093f('0x33')][_0x093f('0x3e')]){_0x84df92['where']=_['merge'](_0x84df92[_0x093f('0x3f')],{'$or':_['map'](_0x318f2d,function(_0x36e4dd){if(_0x36e4dd[_0x093f('0x30')]!=='VIRTUAL'){var _0x13d39f={};_0x13d39f[_0x36e4dd['name']]={'$like':'%'+_0x28a19b[_0x093f('0x33')][_0x093f('0x3e')]+'%'};return _0x13d39f;}})});}_0x84df92=_['merge']({},_0x84df92,_0x28a19b[_0x093f('0x40')]);var _0x8daa02={'where':_0x84df92['where']};return db['DeskAccount']['count'](_0x8daa02)[_0x093f('0x25')](function(_0x527d80){_0x353e3e[_0x093f('0x1f')]=_0x527d80;if(_0x28a19b['query']['includeAll']){_0x84df92['include']=[{'all':!![]}];}return db['DeskAccount'][_0x093f('0x41')](_0x84df92);})[_0x093f('0x25')](function(_0x969c42){_0x353e3e[_0x093f('0x42')]=_0x969c42;return _0x353e3e;})['then'](respondWithFilteredResult(_0x322134,_0x84df92))[_0x093f('0x43')](handleError(_0x322134,null));};exports[_0x093f('0x44')]=function(_0x54ee6,_0x484b1c){var _0x54c77c={'raw':![],'where':{'id':_0x54ee6[_0x093f('0x45')]['id']}},_0x5c8ae8={};_0x5c8ae8[_0x093f('0x32')]=_[_0x093f('0x34')](db[_0x093f('0x2d')][_0x093f('0x2e')]);_0x5c8ae8[_0x093f('0x33')]=_[_0x093f('0x34')](_0x54ee6['query']);_0x5c8ae8['filters']=_[_0x093f('0x36')](_0x5c8ae8[_0x093f('0x32')],_0x5c8ae8[_0x093f('0x33')]);_0x54c77c[_0x093f('0x37')]=_['intersection'](_0x5c8ae8[_0x093f('0x32')],qs[_0x093f('0x46')](_0x54ee6[_0x093f('0x33')]['fields']));_0x54c77c[_0x093f('0x37')]=_0x54c77c['attributes'][_0x093f('0x38')]?_0x54c77c['attributes']:_0x5c8ae8[_0x093f('0x32')];if(_0x54ee6[_0x093f('0x33')][_0x093f('0x47')]){_0x54c77c['include']=[{'all':!![]}];}_0x54c77c=_[_0x093f('0x48')]({},_0x54c77c,_0x54ee6[_0x093f('0x40')]);return db[_0x093f('0x2d')]['find'](_0x54c77c)['then'](handleEntityNotFound(_0x484b1c,null))[_0x093f('0x25')](respondWithResult(_0x484b1c,null))[_0x093f('0x43')](handleError(_0x484b1c,null));};exports[_0x093f('0x49')]=function(_0x5469d1,_0x1c8ab0){return db[_0x093f('0x2d')][_0x093f('0x49')](_0x5469d1['body'],{})[_0x093f('0x25')](respondWithResult(_0x1c8ab0,0xc9))[_0x093f('0x43')](handleError(_0x1c8ab0,null));};exports['update']=function(_0x456bd4,_0x3ba1d8){if(_0x456bd4['body']['id']){delete _0x456bd4[_0x093f('0x4a')]['id'];}return db[_0x093f('0x2d')][_0x093f('0x4b')]({'where':{'id':_0x456bd4[_0x093f('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ba1d8,null))[_0x093f('0x25')](saveUpdates(_0x456bd4[_0x093f('0x4a')],null))[_0x093f('0x25')](respondWithResult(_0x3ba1d8,null))['catch'](handleError(_0x3ba1d8,null));};exports[_0x093f('0x26')]=function(_0xb9c647,_0x51eb01){return db[_0x093f('0x2d')][_0x093f('0x4b')]({'where':{'id':_0xb9c647[_0x093f('0x45')]['id']}})[_0x093f('0x25')](handleEntityNotFound(_0x51eb01,null))['then'](removeEntity(_0x51eb01,null))[_0x093f('0x43')](handleError(_0x51eb01,null));};exports[_0x093f('0x4c')]=function(_0x4f82e4,_0x1a898f,_0x53d83e){var _0x4c3394={};var _0x42c9df={};var _0x398e23;var _0x257efa;return db[_0x093f('0x2d')][_0x093f('0x4d')]({'where':{'id':_0x4f82e4[_0x093f('0x45')]['id']}})[_0x093f('0x25')](handleEntityNotFound(_0x1a898f,null))[_0x093f('0x25')](function(_0x334ed0){if(_0x334ed0){_0x398e23=_0x334ed0;_0x42c9df[_0x093f('0x32')]=_[_0x093f('0x34')](db[_0x093f('0x4e')][_0x093f('0x2e')]);_0x42c9df[_0x093f('0x33')]=_[_0x093f('0x34')](_0x4f82e4[_0x093f('0x33')]);_0x42c9df[_0x093f('0x35')]=_['intersection'](_0x42c9df['model'],_0x42c9df[_0x093f('0x33')]);_0x4c3394[_0x093f('0x37')]=_[_0x093f('0x36')](_0x42c9df['model'],qs[_0x093f('0x46')](_0x4f82e4[_0x093f('0x33')][_0x093f('0x46')]));_0x4c3394['attributes']=_0x4c3394['attributes'][_0x093f('0x38')]?_0x4c3394[_0x093f('0x37')]:_0x42c9df[_0x093f('0x32')];_0x4c3394[_0x093f('0x3b')]=qs['sort'](_0x4f82e4[_0x093f('0x33')]['sort']);_0x4c3394[_0x093f('0x3f')]=qs[_0x093f('0x35')](_[_0x093f('0x3d')](_0x4f82e4[_0x093f('0x33')],_0x42c9df[_0x093f('0x35')]));if(_0x4f82e4[_0x093f('0x33')][_0x093f('0x3e')]){_0x4c3394[_0x093f('0x3f')]=_['merge'](_0x4c3394[_0x093f('0x3f')],{'$or':_[_0x093f('0x2c')](_0x4c3394[_0x093f('0x37')],function(_0x1ffd7b){var _0x58710a={};_0x58710a[_0x1ffd7b]={'$like':'%'+_0x4f82e4[_0x093f('0x33')]['filter']+'%'};return _0x58710a;})});}_0x4c3394=_[_0x093f('0x48')]({},_0x4c3394,_0x4f82e4[_0x093f('0x40')]);return _0x398e23[_0x093f('0x4c')](_0x4c3394);}})['then'](function(_0x8317ca){if(_0x8317ca){_0x257efa=_0x8317ca[_0x093f('0x38')];if(!_0x4f82e4[_0x093f('0x33')][_0x093f('0x4f')](_0x093f('0x39'))){_0x4c3394[_0x093f('0x3a')]=qs[_0x093f('0x3a')](_0x4f82e4[_0x093f('0x33')][_0x093f('0x3a')]);_0x4c3394[_0x093f('0x1d')]=qs['offset'](_0x4f82e4[_0x093f('0x33')]['offset']);}return _0x398e23[_0x093f('0x4c')](_0x4c3394);}})[_0x093f('0x25')](function(_0x34e633){if(_0x34e633){return _0x34e633?{'count':_0x257efa,'rows':_0x34e633}:null;}})[_0x093f('0x25')](respondWithResult(_0x1a898f,null))[_0x093f('0x43')](handleError(_0x1a898f,null));};exports[_0x093f('0x50')]=function(_0x4c888f,_0x11f74e,_0x352bae){if(_0x4c888f[_0x093f('0x4a')]['id']){delete _0x4c888f[_0x093f('0x4a')]['id'];}return db[_0x093f('0x2d')][_0x093f('0x4d')]({'where':{'id':_0x4c888f[_0x093f('0x45')]['id']}})[_0x093f('0x25')](handleEntityNotFound(_0x11f74e,null))[_0x093f('0x25')](function(_0x5cf24f){if(_0x5cf24f){_0x4c888f['body'][_0x093f('0x51')]=_0x5cf24f['id'];_0x4c888f[_0x093f('0x4a')]['Subjects']=integrations[_0x093f('0x52')](_0x4c888f[_0x093f('0x4a')][_0x093f('0x53')],_0x4c888f['body'][_0x093f('0x30')]);_0x4c888f[_0x093f('0x4a')][_0x093f('0x54')]=integrations[_0x093f('0x55')](_0x4c888f[_0x093f('0x4a')]['channel'],_0x4c888f[_0x093f('0x4a')][_0x093f('0x30')]);return db[_0x093f('0x4e')][_0x093f('0x49')](_0x4c888f[_0x093f('0x4a')],{'include':[{'model':db['DeskField'],'as':_0x093f('0x56')},{'model':db[_0x093f('0x57')],'as':_0x093f('0x54')}]});}return null;})['then'](respondWithResult(_0x11f74e,null))[_0x093f('0x43')](handleError(_0x11f74e,null));};exports[_0x093f('0x58')]=function(_0x4bfbbc,_0xb69b0c,_0x763f8b){var _0x4899e6=[{'name':_0x093f('0x59'),'label':_0x093f('0x59'),'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 _0x5ea0fe='';return db[_0x093f('0x2d')]['findOne']({'where':{'id':_0x4bfbbc[_0x093f('0x45')]['id']},'attributes':['id',_0x093f('0x5a'),'authType',_0x093f('0x5b'),_0x093f('0x5c'),_0x093f('0x5d'),_0x093f('0x5e'),_0x093f('0x5f'),_0x093f('0x60')]})[_0x093f('0x25')](handleEntityNotFound(_0xb69b0c,null))[_0x093f('0x25')](function(_0x332f3e){if(_0x332f3e){_0x5ea0fe=_0x332f3e[_0x093f('0x5a')];var _0x7da5ee=_0x5ea0fe[_0x093f('0x61')](-0x1);if(_0x7da5ee==='/'){_0x5ea0fe=_0x5ea0fe[_0x093f('0x62')](0x0,_0x5ea0fe[_0x093f('0x63')](_0x7da5ee));}var _0x39ad66={'method':_0x093f('0x64'),'uri':util[_0x093f('0x65')](_0x093f('0x66'),_0x5ea0fe),'headers':{'Content-Type':_0x093f('0x67'),'Accept':_0x093f('0x67')},'json':!![]};if(_0x332f3e[_0x093f('0x68')]===_0x093f('0x69')){_0x39ad66['headers'][_0x093f('0x6a')]=util['format'](_0x093f('0x6b'),new Buffer(util['format'](_0x093f('0x6c'),_0x332f3e[_0x093f('0x5b')],_0x332f3e[_0x093f('0x5c')]))[_0x093f('0x6d')](_0x093f('0x6e')));}return rp(_0x39ad66)[_0x093f('0x25')](function(_0x2cb316){return _0x4899e6[_0x093f('0x6f')](_[_0x093f('0x2c')](_0x2cb316[_0x093f('0x70')]['entries'],function(_0x35e9d4){return{'id':_0x35e9d4[_0x093f('0x29')],'name':_0x35e9d4[_0x093f('0x29')],'type':_0x35e9d4['type'],'active':_0x35e9d4[_0x093f('0x71')],'label':_0x35e9d4[_0x093f('0x72')],'custom':!![]};}));});}})[_0x093f('0x25')](function(_0x4933d7){return{'count':_0x4933d7[_0x093f('0x38')],'rows':_0x4933d7};})[_0x093f('0x25')](respondWithResult(_0xb69b0c,null))[_0x093f('0x43')](function(_0x59ebbb){var _0x1e75da=_0x4bfbbc[_0x093f('0x33')][_0x093f('0x73')]?0x1f4:_0x59ebbb['statusCode']||0x1f4;logger[_0x093f('0x27')](_0x093f('0x74'),_0x093f('0x58'),_0x1e75da,JSON[_0x093f('0x75')](_0x59ebbb));delete _0x59ebbb['name'];if(_0x1e75da===0x191){_0x1e75da=0x190;}_0xb69b0c[_0x093f('0x1b')](_0x1e75da)['send'](_0x4bfbbc['query'][_0x093f('0x73')]?{'message':_0x093f('0x76'),'statusCode':_0x59ebbb[_0x093f('0x77')]}:_0x59ebbb);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index e3084a8..c6c994f 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 _0xb60d=['exports','DeskAccount','../../config/logger','api','moment','bluebird','request-promise','path','../../components/integrations/configuration'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb60d,0xbf));var _0xdb60=function(_0x532a13,_0x50e66f){_0x532a13=_0x532a13-0x0;var _0x22ce8a=_0xb60d[_0x532a13];return _0x22ce8a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdb60('0x0'))(_0xdb60('0x1'));var moment=require(_0xdb60('0x2'));var BPromise=require(_0xdb60('0x3'));var rp=require(_0xdb60('0x4'));var fs=require('fs');var path=require(_0xdb60('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xdb60('0x6'));module[_0xdb60('0x7')]=function(_0x52836c,_0x355b1f){return _0x52836c['define'](_0xdb60('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dd6=['./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x359639,_0x21ca4b){var _0x334f44=function(_0x14874d){while(--_0x14874d){_0x359639['push'](_0x359639['shift']());}};_0x334f44(++_0x21ca4b);}(_0x2dd6,0x101));var _0x62dd=function(_0x4f45bc,_0x3ea5f3){_0x4f45bc=_0x4f45bc-0x0;var _0x2c5112=_0x2dd6[_0x4f45bc];return _0x2c5112;};'use strict';var _=require(_0x62dd('0x0'));var util=require(_0x62dd('0x1'));var logger=require(_0x62dd('0x2'))(_0x62dd('0x3'));var moment=require('moment');var BPromise=require(_0x62dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62dd('0x5'));var rimraf=require('rimraf');var config=require(_0x62dd('0x6'));var attributes=require(_0x62dd('0x7'));var integrations=require(_0x62dd('0x8'));module[_0x62dd('0x9')]=function(_0x16a082,_0x507753){return _0x16a082[_0x62dd('0xa')](_0x62dd('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 6f1e9fa..e817181 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 _0x7bc9=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','DeskAccount','findAll','options','where','attributes','limit','include','map','model','GetDeskAccount','debug','find','ShowDeskAccount','stringify'];(function(_0x3a1aa6,_0x1501e8){var _0x32091a=function(_0x29fa35){while(--_0x29fa35){_0x3a1aa6['push'](_0x3a1aa6['shift']());}};_0x32091a(++_0x1501e8);}(_0x7bc9,0x8c));var _0x97bc=function(_0x5a58c3,_0x557d56){_0x5a58c3=_0x5a58c3-0x0;var _0x7cfb98=_0x7bc9[_0x5a58c3];return _0x7cfb98;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x97bc('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97bc('0x1'));var db=require(_0x97bc('0x2'))['db'];var utils=require(_0x97bc('0x3'));var logger=require(_0x97bc('0x4'))(_0x97bc('0x5'));var config=require(_0x97bc('0x6'));var jayson=require(_0x97bc('0x7'));var client=jayson[_0x97bc('0x8')][_0x97bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17ab2e,_0x31e8cf,_0x565440){return new BPromise(function(_0x521320,_0xe2df9f){return client[_0x97bc('0xa')](_0x17ab2e,_0x565440)[_0x97bc('0xb')](function(_0x484bae){logger['info'](_0x97bc('0xc'),_0x31e8cf,_0x97bc('0xd'));logger['debug'](_0x97bc('0xe'),_0x31e8cf,_0x97bc('0xd'),JSON['stringify'](_0x484bae));if(_0x484bae[_0x97bc('0xf')]){if(_0x484bae[_0x97bc('0xf')][_0x97bc('0x10')]===0x1f4){logger['error'](_0x97bc('0xc'),_0x31e8cf,_0x484bae['error'][_0x97bc('0x11')]);return _0xe2df9f(_0x484bae['error'][_0x97bc('0x11')]);}logger['error'](_0x97bc('0xc'),_0x31e8cf,_0x484bae['error'][_0x97bc('0x11')]);return _0x521320(_0x484bae[_0x97bc('0xf')][_0x97bc('0x11')]);}else{logger[_0x97bc('0x12')]('DeskAccount,\x20%s,\x20%s',_0x31e8cf,'request\x20sent');_0x521320(_0x484bae[_0x97bc('0x13')][_0x97bc('0x11')]);}})[_0x97bc('0x14')](function(_0x5dadcf){logger[_0x97bc('0xf')](_0x97bc('0xc'),_0x31e8cf,_0x5dadcf);_0xe2df9f(_0x5dadcf);});});}exports['GetDeskAccount']=function(_0x134948){var _0x346d00=this;return new Promise(function(_0x153ce9,_0x736773){return db[_0x97bc('0x15')][_0x97bc('0x16')]({'raw':_0x134948[_0x97bc('0x17')]?_0x134948[_0x97bc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x134948[_0x97bc('0x17')]?_0x134948[_0x97bc('0x17')][_0x97bc('0x18')]||null:null,'attributes':_0x134948[_0x97bc('0x17')]?_0x134948['options'][_0x97bc('0x19')]||null:null,'limit':_0x134948[_0x97bc('0x17')]?_0x134948[_0x97bc('0x17')][_0x97bc('0x1a')]||null:null,'include':_0x134948[_0x97bc('0x17')]?_0x134948[_0x97bc('0x17')][_0x97bc('0x1b')]?_[_0x97bc('0x1c')](_0x134948['options']['include'],function(_0x1136f2){return{'model':db[_0x1136f2[_0x97bc('0x1d')]],'as':_0x1136f2['as'],'attributes':_0x1136f2[_0x97bc('0x19')],'include':_0x1136f2[_0x97bc('0x1b')]?_['map'](_0x1136f2[_0x97bc('0x1b')],function(_0x25cee0){return{'model':db[_0x25cee0[_0x97bc('0x1d')]],'as':_0x25cee0['as'],'attributes':_0x25cee0[_0x97bc('0x19')],'include':_0x25cee0[_0x97bc('0x1b')]?_[_0x97bc('0x1c')](_0x25cee0[_0x97bc('0x1b')],function(_0x1e9792){return{'model':db[_0x1e9792['model']],'as':_0x1e9792['as'],'attributes':_0x1e9792[_0x97bc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x97bc('0xb')](function(_0x156689){logger[_0x97bc('0x12')](_0x97bc('0x1e'),_0x134948);logger[_0x97bc('0x1f')](_0x97bc('0x1e'),_0x134948,JSON['stringify'](_0x156689));_0x153ce9(_0x156689);})[_0x97bc('0x14')](function(_0x38da79){logger['error'](_0x97bc('0x1e'),_0x38da79[_0x97bc('0x11')],_0x134948);_0x736773(_0x346d00[_0x97bc('0xf')](0x1f4,_0x38da79[_0x97bc('0x11')]));});});};exports['ShowDeskAccount']=function(_0x15f0ec){var _0x5bbfb6=this;return new Promise(function(_0x39acd0,_0x6bed62){return db['DeskAccount'][_0x97bc('0x20')]({'raw':_0x15f0ec['options']?_0x15f0ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x15f0ec['options']?_0x15f0ec['options'][_0x97bc('0x18')]||null:null,'attributes':_0x15f0ec['options']?_0x15f0ec['options']['attributes']||null:null,'include':_0x15f0ec[_0x97bc('0x17')]?_0x15f0ec[_0x97bc('0x17')][_0x97bc('0x1b')]?_['map'](_0x15f0ec[_0x97bc('0x17')]['include'],function(_0x449849){return{'model':db[_0x449849[_0x97bc('0x1d')]],'as':_0x449849['as'],'attributes':_0x449849[_0x97bc('0x19')],'include':_0x449849[_0x97bc('0x1b')]?_[_0x97bc('0x1c')](_0x449849[_0x97bc('0x1b')],function(_0x4ff6ca){return{'model':db[_0x4ff6ca[_0x97bc('0x1d')]],'as':_0x4ff6ca['as'],'attributes':_0x4ff6ca['attributes'],'include':_0x4ff6ca[_0x97bc('0x1b')]?_['map'](_0x4ff6ca[_0x97bc('0x1b')],function(_0x46e36b){return{'model':db[_0x46e36b[_0x97bc('0x1d')]],'as':_0x46e36b['as'],'attributes':_0x46e36b[_0x97bc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x97bc('0xb')](function(_0x2d0f31){logger[_0x97bc('0x12')](_0x97bc('0x21'),_0x15f0ec);logger[_0x97bc('0x1f')](_0x97bc('0x21'),_0x15f0ec,JSON[_0x97bc('0x22')](_0x2d0f31));_0x39acd0(_0x2d0f31);})['catch'](function(_0x4068b0){logger['error'](_0x97bc('0x21'),_0x4068b0[_0x97bc('0x11')],_0x15f0ec);_0x6bed62(_0x5bbfb6['error'](0x1f4,_0x4068b0[_0x97bc('0x11')]));});});}; \ No newline at end of file +var _0xc147=['rpc','../../config/environment','jayson/promise','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','attributes','model','ShowDeskAccount','find','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xc147,0x133));var _0x7c14=function(_0x459a08,_0x5ae29a){_0x459a08=_0x459a08-0x0;var _0x3f4d07=_0xc147[_0x459a08];return _0x3f4d07;};'use strict';var _=require(_0x7c14('0x0'));var util=require('util');var moment=require(_0x7c14('0x1'));var BPromise=require(_0x7c14('0x2'));var rs=require(_0x7c14('0x3'));var fs=require('fs');var Redis=require(_0x7c14('0x4'));var db=require(_0x7c14('0x5'))['db'];var utils=require(_0x7c14('0x6'));var logger=require(_0x7c14('0x7'))(_0x7c14('0x8'));var config=require(_0x7c14('0x9'));var jayson=require(_0x7c14('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5575,_0x2ec60b,_0x2febad){return new BPromise(function(_0x113f9c,_0x3fbf04){return client['request'](_0x4b5575,_0x2febad)['then'](function(_0x2ca5f8){logger[_0x7c14('0xb')](_0x7c14('0xc'),_0x2ec60b,_0x7c14('0xd'));logger['debug'](_0x7c14('0xe'),_0x2ec60b,_0x7c14('0xd'),JSON[_0x7c14('0xf')](_0x2ca5f8));if(_0x2ca5f8[_0x7c14('0x10')]){if(_0x2ca5f8['error']['code']===0x1f4){logger[_0x7c14('0x10')]('DeskAccount,\x20%s,\x20%s',_0x2ec60b,_0x2ca5f8[_0x7c14('0x10')][_0x7c14('0x11')]);return _0x3fbf04(_0x2ca5f8['error'][_0x7c14('0x11')]);}logger[_0x7c14('0x10')](_0x7c14('0xc'),_0x2ec60b,_0x2ca5f8['error']['message']);return _0x113f9c(_0x2ca5f8['error']['message']);}else{logger[_0x7c14('0xb')](_0x7c14('0xc'),_0x2ec60b,_0x7c14('0xd'));_0x113f9c(_0x2ca5f8[_0x7c14('0x12')][_0x7c14('0x11')]);}})[_0x7c14('0x13')](function(_0x4719a6){logger[_0x7c14('0x10')](_0x7c14('0xc'),_0x2ec60b,_0x4719a6);_0x3fbf04(_0x4719a6);});});}exports[_0x7c14('0x14')]=function(_0x26ce16){var _0x203ed4=this;return new Promise(function(_0x1907f7,_0x543a44){return db[_0x7c14('0x15')][_0x7c14('0x16')]({'raw':_0x26ce16[_0x7c14('0x17')]?_0x26ce16[_0x7c14('0x17')][_0x7c14('0x18')]===undefined?!![]:![]:!![],'where':_0x26ce16[_0x7c14('0x17')]?_0x26ce16['options'][_0x7c14('0x19')]||null:null,'attributes':_0x26ce16['options']?_0x26ce16['options']['attributes']||null:null,'limit':_0x26ce16[_0x7c14('0x17')]?_0x26ce16[_0x7c14('0x17')][_0x7c14('0x1a')]||null:null,'include':_0x26ce16[_0x7c14('0x17')]?_0x26ce16[_0x7c14('0x17')][_0x7c14('0x1b')]?_[_0x7c14('0x1c')](_0x26ce16[_0x7c14('0x17')][_0x7c14('0x1b')],function(_0x473d1d){return{'model':db[_0x473d1d['model']],'as':_0x473d1d['as'],'attributes':_0x473d1d[_0x7c14('0x1d')],'include':_0x473d1d[_0x7c14('0x1b')]?_['map'](_0x473d1d[_0x7c14('0x1b')],function(_0x4d3a7b){return{'model':db[_0x4d3a7b[_0x7c14('0x1e')]],'as':_0x4d3a7b['as'],'attributes':_0x4d3a7b[_0x7c14('0x1d')],'include':_0x4d3a7b[_0x7c14('0x1b')]?_[_0x7c14('0x1c')](_0x4d3a7b['include'],function(_0x5abb9f){return{'model':db[_0x5abb9f[_0x7c14('0x1e')]],'as':_0x5abb9f['as'],'attributes':_0x5abb9f[_0x7c14('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x144199){logger[_0x7c14('0xb')](_0x7c14('0x14'),_0x26ce16);logger['debug'](_0x7c14('0x14'),_0x26ce16,JSON[_0x7c14('0xf')](_0x144199));_0x1907f7(_0x144199);})[_0x7c14('0x13')](function(_0x4e4efc){logger['error'](_0x7c14('0x14'),_0x4e4efc[_0x7c14('0x11')],_0x26ce16);_0x543a44(_0x203ed4[_0x7c14('0x10')](0x1f4,_0x4e4efc['message']));});});};exports[_0x7c14('0x1f')]=function(_0xe34388){var _0x2a32cb=this;return new Promise(function(_0x57b39c,_0x2fa7b4){return db[_0x7c14('0x15')][_0x7c14('0x20')]({'raw':_0xe34388[_0x7c14('0x17')]?_0xe34388[_0x7c14('0x17')][_0x7c14('0x18')]===undefined?!![]:![]:!![],'where':_0xe34388[_0x7c14('0x17')]?_0xe34388[_0x7c14('0x17')][_0x7c14('0x19')]||null:null,'attributes':_0xe34388[_0x7c14('0x17')]?_0xe34388['options']['attributes']||null:null,'include':_0xe34388[_0x7c14('0x17')]?_0xe34388[_0x7c14('0x17')][_0x7c14('0x1b')]?_[_0x7c14('0x1c')](_0xe34388[_0x7c14('0x17')][_0x7c14('0x1b')],function(_0x5862d6){return{'model':db[_0x5862d6[_0x7c14('0x1e')]],'as':_0x5862d6['as'],'attributes':_0x5862d6[_0x7c14('0x1d')],'include':_0x5862d6[_0x7c14('0x1b')]?_['map'](_0x5862d6[_0x7c14('0x1b')],function(_0x1fa47c){return{'model':db[_0x1fa47c['model']],'as':_0x1fa47c['as'],'attributes':_0x1fa47c['attributes'],'include':_0x1fa47c[_0x7c14('0x1b')]?_[_0x7c14('0x1c')](_0x1fa47c['include'],function(_0x4686e5){return{'model':db[_0x4686e5[_0x7c14('0x1e')]],'as':_0x4686e5['as'],'attributes':_0x4686e5[_0x7c14('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7c14('0x21')](function(_0x5ae090){logger[_0x7c14('0xb')]('ShowDeskAccount',_0xe34388);logger[_0x7c14('0x22')](_0x7c14('0x1f'),_0xe34388,JSON['stringify'](_0x5ae090));_0x57b39c(_0x5ae090);})[_0x7c14('0x13')](function(_0x3ee2e0){logger[_0x7c14('0x10')](_0x7c14('0x1f'),_0x3ee2e0[_0x7c14('0x11')],_0xe34388);_0x2fa7b4(_0x2a32cb[_0x7c14('0x10')](0x1f4,_0x3ee2e0['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4173e22..1d43215 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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3f6428,_0x22c82d){var _0x4a138b=function(_0x39da9b){while(--_0x39da9b){_0x3f6428['push'](_0x3f6428['shift']());}};_0x4a138b(++_0x22c82d);}(_0x7217,0x19e));var _0x7721=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x7217[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x533381,_0x8a69fa){var _0x2877ed=function(_0x45cb54){while(--_0x45cb54){_0x533381['push'](_0x533381['shift']());}};_0x2877ed(++_0x8a69fa);}(_0x55ca,0x126));var _0xa55c=function(_0x332c1b,_0x28d711){_0x332c1b=_0x332c1b-0x0;var _0x21b49b=_0x55ca[_0x332c1b];return _0x21b49b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index e882756..1d01970 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 _0x685b=['STRING'];(function(_0x1a2023,_0x51b7e1){var _0x4b41b3=function(_0x351789){while(--_0x351789){_0x1a2023['push'](_0x1a2023['shift']());}};_0x4b41b3(++_0x51b7e1);}(_0x685b,0x89));var _0xb685=function(_0x12ca7a,_0x3295bf){_0x12ca7a=_0x12ca7a-0x0;var _0x2249df=_0x685b[_0x12ca7a];return _0x2249df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb685('0x0')]},'description':{'type':Sequelize[_0xb685('0x0')]}}; \ No newline at end of file +var _0xb268=['STRING','sequelize','exports'];(function(_0x1ddd0,_0x15f9f4){var _0x4d86d0=function(_0x3173d7){while(--_0x3173d7){_0x1ddd0['push'](_0x1ddd0['shift']());}};_0x4d86d0(++_0x15f9f4);}(_0xb268,0x67));var _0x8b26=function(_0x17695f,_0x11f678){_0x17695f=_0x17695f-0x0;var _0x240989=_0xb268[_0x17695f];return _0x240989;};'use strict';var Sequelize=require(_0x8b26('0x0'));module[_0x8b26('0x1')]={'name':{'type':Sequelize[_0x8b26('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 95966d9..ebab24a 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 _0x9053=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','update','then','destroy','error','name','map','DeskConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','getFields','findOne','rawAttributes','getSubjects','DeskField','getDescriptions','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9053,0x1d0));var _0x3905=function(_0x53273a,_0x5ed978){_0x53273a=_0x53273a-0x0;var _0x3c41db=_0x9053[_0x53273a];return _0x3c41db;};'use strict';var emlformat=require(_0x3905('0x0'));var rimraf=require(_0x3905('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3905('0x2'));var rp=require('request-promise');var moment=require(_0x3905('0x3'));var BPromise=require(_0x3905('0x4'));var Mustache=require(_0x3905('0x5'));var util=require(_0x3905('0x6'));var path=require(_0x3905('0x7'));var sox=require('sox');var csv=require(_0x3905('0x8'));var ejs=require(_0x3905('0x9'));var fs=require('fs');var fs_extra=require(_0x3905('0xa'));var _=require(_0x3905('0xb'));var squel=require(_0x3905('0xc'));var crypto=require(_0x3905('0xd'));var jsforce=require(_0x3905('0xe'));var deskjs=require(_0x3905('0xf'));var toCsv=require(_0x3905('0x8'));var querystring=require(_0x3905('0x10'));var Papa=require('papaparse');var Redis=require(_0x3905('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3905('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3905('0x13'));var logger=require('../../config/logger')(_0x3905('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3905('0x15'))['db'];function respondWithStatusCode(_0x550c33,_0x82b521){_0x82b521=_0x82b521||0xcc;return function(_0x10a9dd){if(_0x10a9dd){return _0x550c33[_0x3905('0x16')](_0x82b521);}return _0x550c33['status'](_0x82b521)[_0x3905('0x17')]();};}function respondWithResult(_0x4e942f,_0x29bcff){_0x29bcff=_0x29bcff||0xc8;return function(_0x167930){if(_0x167930){return _0x4e942f[_0x3905('0x18')](_0x29bcff)[_0x3905('0x19')](_0x167930);}};}function respondWithFilteredResult(_0x1b9170,_0x1e95af){return function(_0x4c33c8){if(_0x4c33c8){var _0x167648=typeof _0x1e95af['offset']===_0x3905('0x1a')&&typeof _0x1e95af[_0x3905('0x1b')]==='undefined';var _0xdab6a5=_0x4c33c8[_0x3905('0x1c')];var _0x3e58b0=_0x167648?0x0:_0x1e95af[_0x3905('0x1d')];var _0x3bf209=_0x167648?_0x4c33c8[_0x3905('0x1c')]:_0x1e95af['offset']+_0x1e95af[_0x3905('0x1b')];var _0x251c59;if(_0x3bf209>=_0xdab6a5){_0x3bf209=_0xdab6a5;_0x251c59=0xc8;}else{_0x251c59=0xce;}_0x1b9170[_0x3905('0x18')](_0x251c59);return _0x1b9170['set']('Content-Range',_0x3e58b0+'-'+_0x3bf209+'/'+_0xdab6a5)[_0x3905('0x19')](_0x4c33c8);}return null;};}function patchUpdates(_0x79b0b8){return function(_0x11ab9b){try{jsonpatch[_0x3905('0x1e')](_0x11ab9b,_0x79b0b8,!![]);}catch(_0x32b3d9){return BPromise[_0x3905('0x1f')](_0x32b3d9);}return _0x11ab9b['save']();};}function saveUpdates(_0x3d293d,_0x42fd6f){return function(_0x4674a9){if(_0x4674a9){return _0x4674a9[_0x3905('0x20')](_0x3d293d)[_0x3905('0x21')](function(_0x1563a6){return _0x1563a6;});}return null;};}function removeEntity(_0x246d15,_0x4f2e2d){return function(_0x13a28d){if(_0x13a28d){return _0x13a28d[_0x3905('0x22')]()[_0x3905('0x21')](function(){_0x246d15[_0x3905('0x18')](0xcc)[_0x3905('0x17')]();});}};}function handleEntityNotFound(_0x306d2a,_0x2de8cc){return function(_0x20dde2){if(!_0x20dde2){_0x306d2a[_0x3905('0x16')](0x194);}return _0x20dde2;};}function handleError(_0x31ef63,_0x3ec119){_0x3ec119=_0x3ec119||0x1f4;return function(_0x1f9493){logger[_0x3905('0x23')](_0x1f9493['stack']);if(_0x1f9493['name']){delete _0x1f9493[_0x3905('0x24')];}_0x31ef63[_0x3905('0x18')](_0x3ec119)['send'](_0x1f9493);};}exports['index']=function(_0x46f983,_0x447909){var _0x52a6bd={},_0x45e8f0={},_0x4e3718={'count':0x0,'rows':[]};var _0x24cad2=_[_0x3905('0x25')](db[_0x3905('0x26')]['rawAttributes'],function(_0x5d1948){return{'name':_0x5d1948[_0x3905('0x27')],'type':_0x5d1948['type'][_0x3905('0x28')]};});_0x45e8f0[_0x3905('0x29')]=_[_0x3905('0x25')](_0x24cad2,'name');_0x45e8f0[_0x3905('0x2a')]=_[_0x3905('0x2b')](_0x46f983[_0x3905('0x2a')]);_0x45e8f0[_0x3905('0x2c')]=_[_0x3905('0x2d')](_0x45e8f0[_0x3905('0x29')],_0x45e8f0[_0x3905('0x2a')]);_0x52a6bd[_0x3905('0x2e')]=_[_0x3905('0x2d')](_0x45e8f0[_0x3905('0x29')],qs[_0x3905('0x2f')](_0x46f983[_0x3905('0x2a')]['fields']));_0x52a6bd['attributes']=_0x52a6bd[_0x3905('0x2e')]['length']?_0x52a6bd[_0x3905('0x2e')]:_0x45e8f0[_0x3905('0x29')];if(!_0x46f983[_0x3905('0x2a')][_0x3905('0x30')](_0x3905('0x31'))){_0x52a6bd['limit']=qs[_0x3905('0x1b')](_0x46f983['query'][_0x3905('0x1b')]);_0x52a6bd[_0x3905('0x1d')]=qs[_0x3905('0x1d')](_0x46f983['query']['offset']);}_0x52a6bd[_0x3905('0x32')]=qs[_0x3905('0x33')](_0x46f983['query'][_0x3905('0x33')]);_0x52a6bd['where']=qs[_0x3905('0x2c')](_[_0x3905('0x34')](_0x46f983[_0x3905('0x2a')],_0x45e8f0['filters']),_0x24cad2);if(_0x46f983[_0x3905('0x2a')][_0x3905('0x35')]){_0x52a6bd[_0x3905('0x36')]=_[_0x3905('0x37')](_0x52a6bd[_0x3905('0x36')],{'$or':_[_0x3905('0x25')](_0x24cad2,function(_0x3e44d5){if(_0x3e44d5[_0x3905('0x38')]!=='VIRTUAL'){var _0x2f7e49={};_0x2f7e49[_0x3e44d5[_0x3905('0x24')]]={'$like':'%'+_0x46f983[_0x3905('0x2a')][_0x3905('0x35')]+'%'};return _0x2f7e49;}})});}_0x52a6bd=_[_0x3905('0x37')]({},_0x52a6bd,_0x46f983[_0x3905('0x39')]);var _0x539457={'where':_0x52a6bd[_0x3905('0x36')]};return db['DeskConfiguration'][_0x3905('0x1c')](_0x539457)['then'](function(_0x2cbc00){_0x4e3718[_0x3905('0x1c')]=_0x2cbc00;if(_0x46f983[_0x3905('0x2a')]['includeAll']){_0x52a6bd['include']=[{'all':!![]}];}return db[_0x3905('0x26')][_0x3905('0x3a')](_0x52a6bd);})['then'](function(_0x397a44){_0x4e3718[_0x3905('0x3b')]=_0x397a44;return _0x4e3718;})['then'](respondWithFilteredResult(_0x447909,_0x52a6bd))[_0x3905('0x3c')](handleError(_0x447909,null));};exports[_0x3905('0x3d')]=function(_0x5f12e8,_0x263b0a){var _0x3ff8f9={'raw':![],'where':{'id':_0x5f12e8[_0x3905('0x3e')]['id']}},_0x2cfcae={};_0x2cfcae[_0x3905('0x29')]=_['keys'](db[_0x3905('0x26')]['rawAttributes']);_0x2cfcae[_0x3905('0x2a')]=_['keys'](_0x5f12e8[_0x3905('0x2a')]);_0x2cfcae[_0x3905('0x2c')]=_['intersection'](_0x2cfcae[_0x3905('0x29')],_0x2cfcae['query']);_0x3ff8f9[_0x3905('0x2e')]=_[_0x3905('0x2d')](_0x2cfcae['model'],qs['fields'](_0x5f12e8[_0x3905('0x2a')][_0x3905('0x2f')]));_0x3ff8f9[_0x3905('0x2e')]=_0x3ff8f9[_0x3905('0x2e')][_0x3905('0x3f')]?_0x3ff8f9[_0x3905('0x2e')]:_0x2cfcae['model'];if(_0x5f12e8[_0x3905('0x2a')][_0x3905('0x40')]){_0x3ff8f9[_0x3905('0x41')]=[{'all':!![]}];}_0x3ff8f9=_[_0x3905('0x37')]({},_0x3ff8f9,_0x5f12e8[_0x3905('0x39')]);return db[_0x3905('0x26')][_0x3905('0x42')](_0x3ff8f9)[_0x3905('0x21')](handleEntityNotFound(_0x263b0a,null))['then'](respondWithResult(_0x263b0a,null))['catch'](handleError(_0x263b0a,null));};exports[_0x3905('0x43')]=function(_0x39241c,_0x21dd22){return db[_0x3905('0x26')]['create'](_0x39241c[_0x3905('0x44')],{})['then'](respondWithResult(_0x21dd22,0xc9))['catch'](handleError(_0x21dd22,null));};exports['update']=function(_0x5847b4,_0x1b089a){if(_0x5847b4[_0x3905('0x44')]['id']){delete _0x5847b4[_0x3905('0x44')]['id'];}return db[_0x3905('0x26')]['find']({'where':{'id':_0x5847b4[_0x3905('0x3e')]['id']}})[_0x3905('0x21')](handleEntityNotFound(_0x1b089a,null))[_0x3905('0x21')](saveUpdates(_0x5847b4[_0x3905('0x44')],null))[_0x3905('0x21')](respondWithResult(_0x1b089a,null))['catch'](handleError(_0x1b089a,null));};exports[_0x3905('0x22')]=function(_0x190aad,_0x46878a){return db[_0x3905('0x26')]['find']({'where':{'id':_0x190aad['params']['id']}})['then'](handleEntityNotFound(_0x46878a,null))[_0x3905('0x21')](removeEntity(_0x46878a,null))[_0x3905('0x3c')](handleError(_0x46878a,null));};exports[_0x3905('0x45')]=function(_0x4c6a8b,_0x542743,_0x263ca3){var _0x524156={};var _0xd29919={};var _0x3f0de2;var _0x4ea33c;return db[_0x3905('0x26')][_0x3905('0x46')]({'where':{'id':_0x4c6a8b[_0x3905('0x3e')]['id']}})[_0x3905('0x21')](handleEntityNotFound(_0x542743,null))[_0x3905('0x21')](function(_0x9e3247){if(_0x9e3247){_0x3f0de2=_0x9e3247;_0xd29919[_0x3905('0x29')]=_[_0x3905('0x2b')](db['DeskField'][_0x3905('0x47')]);_0xd29919[_0x3905('0x2a')]=_[_0x3905('0x2b')](_0x4c6a8b[_0x3905('0x2a')]);_0xd29919[_0x3905('0x2c')]=_['intersection'](_0xd29919[_0x3905('0x29')],_0xd29919[_0x3905('0x2a')]);_0x524156['attributes']=_[_0x3905('0x2d')](_0xd29919[_0x3905('0x29')],qs[_0x3905('0x2f')](_0x4c6a8b['query'][_0x3905('0x2f')]));_0x524156[_0x3905('0x2e')]=_0x524156['attributes'][_0x3905('0x3f')]?_0x524156[_0x3905('0x2e')]:_0xd29919['model'];_0x524156[_0x3905('0x32')]=qs[_0x3905('0x33')](_0x4c6a8b[_0x3905('0x2a')][_0x3905('0x33')]);_0x524156[_0x3905('0x36')]=qs[_0x3905('0x2c')](_[_0x3905('0x34')](_0x4c6a8b[_0x3905('0x2a')],_0xd29919[_0x3905('0x2c')]));if(_0x4c6a8b[_0x3905('0x2a')]['filter']){_0x524156['where']=_[_0x3905('0x37')](_0x524156[_0x3905('0x36')],{'$or':_['map'](_0x524156[_0x3905('0x2e')],function(_0x5cd5b8){var _0x42430c={};_0x42430c[_0x5cd5b8]={'$like':'%'+_0x4c6a8b[_0x3905('0x2a')][_0x3905('0x35')]+'%'};return _0x42430c;})});}_0x524156=_[_0x3905('0x37')]({},_0x524156,_0x4c6a8b[_0x3905('0x39')]);return _0x3f0de2['getFields'](_0x524156);}})[_0x3905('0x21')](function(_0x57d214){if(_0x57d214){_0x4ea33c=_0x57d214[_0x3905('0x3f')];if(!_0x4c6a8b[_0x3905('0x2a')]['hasOwnProperty'](_0x3905('0x31'))){_0x524156[_0x3905('0x1b')]=qs['limit'](_0x4c6a8b[_0x3905('0x2a')][_0x3905('0x1b')]);_0x524156[_0x3905('0x1d')]=qs[_0x3905('0x1d')](_0x4c6a8b['query'][_0x3905('0x1d')]);}return _0x3f0de2[_0x3905('0x45')](_0x524156);}})[_0x3905('0x21')](function(_0x4099b3){if(_0x4099b3){return _0x4099b3?{'count':_0x4ea33c,'rows':_0x4099b3}:null;}})[_0x3905('0x21')](respondWithResult(_0x542743,null))[_0x3905('0x3c')](handleError(_0x542743,null));};exports[_0x3905('0x48')]=function(_0x2b8d0e,_0x431831,_0x2734ec){var _0x1510d5={};var _0x4a9bb0={};var _0x4206ba;var _0x2b3133;return db[_0x3905('0x26')][_0x3905('0x46')]({'where':{'id':_0x2b8d0e[_0x3905('0x3e')]['id']}})[_0x3905('0x21')](handleEntityNotFound(_0x431831,null))['then'](function(_0x40af28){if(_0x40af28){_0x4206ba=_0x40af28;_0x4a9bb0['model']=_[_0x3905('0x2b')](db[_0x3905('0x49')]['rawAttributes']);_0x4a9bb0[_0x3905('0x2a')]=_['keys'](_0x2b8d0e[_0x3905('0x2a')]);_0x4a9bb0['filters']=_['intersection'](_0x4a9bb0[_0x3905('0x29')],_0x4a9bb0[_0x3905('0x2a')]);_0x1510d5[_0x3905('0x2e')]=_['intersection'](_0x4a9bb0[_0x3905('0x29')],qs[_0x3905('0x2f')](_0x2b8d0e[_0x3905('0x2a')]['fields']));_0x1510d5[_0x3905('0x2e')]=_0x1510d5[_0x3905('0x2e')][_0x3905('0x3f')]?_0x1510d5[_0x3905('0x2e')]:_0x4a9bb0['model'];_0x1510d5['order']=qs[_0x3905('0x33')](_0x2b8d0e[_0x3905('0x2a')][_0x3905('0x33')]);_0x1510d5['where']=qs[_0x3905('0x2c')](_[_0x3905('0x34')](_0x2b8d0e[_0x3905('0x2a')],_0x4a9bb0['filters']));if(_0x2b8d0e[_0x3905('0x2a')]['filter']){_0x1510d5['where']=_['merge'](_0x1510d5['where'],{'$or':_['map'](_0x1510d5['attributes'],function(_0x1131be){var _0x2e7cde={};_0x2e7cde[_0x1131be]={'$like':'%'+_0x2b8d0e[_0x3905('0x2a')]['filter']+'%'};return _0x2e7cde;})});}_0x1510d5=_[_0x3905('0x37')]({},_0x1510d5,_0x2b8d0e[_0x3905('0x39')]);return _0x4206ba[_0x3905('0x48')](_0x1510d5);}})[_0x3905('0x21')](function(_0x5d95ee){if(_0x5d95ee){_0x2b3133=_0x5d95ee[_0x3905('0x3f')];if(!_0x2b8d0e[_0x3905('0x2a')]['hasOwnProperty'](_0x3905('0x31'))){_0x1510d5['limit']=qs[_0x3905('0x1b')](_0x2b8d0e[_0x3905('0x2a')][_0x3905('0x1b')]);_0x1510d5[_0x3905('0x1d')]=qs[_0x3905('0x1d')](_0x2b8d0e['query']['offset']);}return _0x4206ba['getSubjects'](_0x1510d5);}})[_0x3905('0x21')](function(_0x428ed8){if(_0x428ed8){return _0x428ed8?{'count':_0x2b3133,'rows':_0x428ed8}:null;}})[_0x3905('0x21')](respondWithResult(_0x431831,null))[_0x3905('0x3c')](handleError(_0x431831,null));};exports[_0x3905('0x4a')]=function(_0x5996c6,_0x24d1d5,_0x1bf0ab){var _0xa9d7cc={};var _0x13f3be={};var _0x10dace;var _0x301176;return db[_0x3905('0x26')]['findOne']({'where':{'id':_0x5996c6[_0x3905('0x3e')]['id']}})[_0x3905('0x21')](handleEntityNotFound(_0x24d1d5,null))[_0x3905('0x21')](function(_0x4650a2){if(_0x4650a2){_0x10dace=_0x4650a2;_0x13f3be[_0x3905('0x29')]=_[_0x3905('0x2b')](db['DeskField']['rawAttributes']);_0x13f3be[_0x3905('0x2a')]=_[_0x3905('0x2b')](_0x5996c6['query']);_0x13f3be['filters']=_[_0x3905('0x2d')](_0x13f3be[_0x3905('0x29')],_0x13f3be[_0x3905('0x2a')]);_0xa9d7cc[_0x3905('0x2e')]=_['intersection'](_0x13f3be[_0x3905('0x29')],qs[_0x3905('0x2f')](_0x5996c6[_0x3905('0x2a')][_0x3905('0x2f')]));_0xa9d7cc['attributes']=_0xa9d7cc['attributes'][_0x3905('0x3f')]?_0xa9d7cc[_0x3905('0x2e')]:_0x13f3be[_0x3905('0x29')];_0xa9d7cc[_0x3905('0x32')]=qs[_0x3905('0x33')](_0x5996c6[_0x3905('0x2a')]['sort']);_0xa9d7cc[_0x3905('0x36')]=qs[_0x3905('0x2c')](_[_0x3905('0x34')](_0x5996c6[_0x3905('0x2a')],_0x13f3be[_0x3905('0x2c')]));if(_0x5996c6[_0x3905('0x2a')][_0x3905('0x35')]){_0xa9d7cc[_0x3905('0x36')]=_[_0x3905('0x37')](_0xa9d7cc[_0x3905('0x36')],{'$or':_[_0x3905('0x25')](_0xa9d7cc[_0x3905('0x2e')],function(_0x37932c){var _0x555932={};_0x555932[_0x37932c]={'$like':'%'+_0x5996c6[_0x3905('0x2a')]['filter']+'%'};return _0x555932;})});}_0xa9d7cc=_[_0x3905('0x37')]({},_0xa9d7cc,_0x5996c6[_0x3905('0x39')]);return _0x10dace[_0x3905('0x4a')](_0xa9d7cc);}})['then'](function(_0x27c0d6){if(_0x27c0d6){_0x301176=_0x27c0d6[_0x3905('0x3f')];if(!_0x5996c6[_0x3905('0x2a')][_0x3905('0x30')](_0x3905('0x31'))){_0xa9d7cc[_0x3905('0x1b')]=qs[_0x3905('0x1b')](_0x5996c6[_0x3905('0x2a')]['limit']);_0xa9d7cc[_0x3905('0x1d')]=qs[_0x3905('0x1d')](_0x5996c6[_0x3905('0x2a')]['offset']);}return _0x10dace['getDescriptions'](_0xa9d7cc);}})['then'](function(_0x347035){if(_0x347035){return _0x347035?{'count':_0x301176,'rows':_0x347035}:null;}})[_0x3905('0x21')](respondWithResult(_0x24d1d5,null))[_0x3905('0x3c')](handleError(_0x24d1d5,null));};exports['getTags']=function(_0x4e74d4,_0x1fd49d,_0x3e3311){var _0x2672e2={};var _0x322f2a={};var _0xeefddf;var _0x19fdd1;return db[_0x3905('0x26')]['findOne']({'where':{'id':_0x4e74d4[_0x3905('0x3e')]['id']}})[_0x3905('0x21')](handleEntityNotFound(_0x1fd49d,null))[_0x3905('0x21')](function(_0x6b67c9){if(_0x6b67c9){_0xeefddf=_0x6b67c9;_0x322f2a[_0x3905('0x29')]=_['keys'](db[_0x3905('0x4b')][_0x3905('0x47')]);_0x322f2a[_0x3905('0x2a')]=_[_0x3905('0x2b')](_0x4e74d4[_0x3905('0x2a')]);_0x322f2a[_0x3905('0x2c')]=_['intersection'](_0x322f2a[_0x3905('0x29')],_0x322f2a[_0x3905('0x2a')]);_0x2672e2[_0x3905('0x2e')]=_[_0x3905('0x2d')](_0x322f2a['model'],qs[_0x3905('0x2f')](_0x4e74d4[_0x3905('0x2a')][_0x3905('0x2f')]));_0x2672e2[_0x3905('0x2e')]=_0x2672e2['attributes']['length']?_0x2672e2[_0x3905('0x2e')]:_0x322f2a['model'];_0x2672e2[_0x3905('0x32')]=qs[_0x3905('0x33')](_0x4e74d4[_0x3905('0x2a')][_0x3905('0x33')]);_0x2672e2['where']=qs[_0x3905('0x2c')](_[_0x3905('0x34')](_0x4e74d4[_0x3905('0x2a')],_0x322f2a[_0x3905('0x2c')]));if(_0x4e74d4[_0x3905('0x2a')][_0x3905('0x35')]){_0x2672e2[_0x3905('0x36')]=_[_0x3905('0x37')](_0x2672e2[_0x3905('0x36')],{'$or':_['map'](_0x2672e2[_0x3905('0x2e')],function(_0x2bfbf4){var _0xbb2e1a={};_0xbb2e1a[_0x2bfbf4]={'$like':'%'+_0x4e74d4[_0x3905('0x2a')]['filter']+'%'};return _0xbb2e1a;})});}_0x2672e2=_['merge']({},_0x2672e2,_0x4e74d4[_0x3905('0x39')]);return _0xeefddf['getTags'](_0x2672e2);}})[_0x3905('0x21')](function(_0x426ebf){if(_0x426ebf){_0x19fdd1=_0x426ebf[_0x3905('0x3f')];if(!_0x4e74d4[_0x3905('0x2a')][_0x3905('0x30')](_0x3905('0x31'))){_0x2672e2[_0x3905('0x1b')]=qs[_0x3905('0x1b')](_0x4e74d4[_0x3905('0x2a')]['limit']);_0x2672e2[_0x3905('0x1d')]=qs[_0x3905('0x1d')](_0x4e74d4[_0x3905('0x2a')][_0x3905('0x1d')]);}return _0xeefddf['getTags'](_0x2672e2);}})[_0x3905('0x21')](function(_0x10a846){if(_0x10a846){return _0x10a846?{'count':_0x19fdd1,'rows':_0x10a846}:null;}})[_0x3905('0x21')](respondWithResult(_0x1fd49d,null))[_0x3905('0x3c')](handleError(_0x1fd49d,null));};exports[_0x3905('0x4c')]=function(_0x480390,_0x16c2b3,_0x544526){if(_0x480390['body']['id']){delete _0x480390[_0x3905('0x44')]['id'];}return db[_0x3905('0x26')]['findOne']({'where':{'id':_0x480390[_0x3905('0x3e')]['id']}})[_0x3905('0x21')](handleEntityNotFound(_0x16c2b3,null))['then'](function(_0x3f24be){if(_0x3f24be){return _0x3f24be[_0x3905('0x4c')](_0x480390[_0x3905('0x44')][_0x3905('0x4d')]||[]);}return null;})[_0x3905('0x21')](respondWithResult(_0x16c2b3,null))[_0x3905('0x3c')](handleError(_0x16c2b3,null));}; \ No newline at end of file +var _0x20b5=['limit','order','sort','where','filter','merge','options','includeAll','rows','params','fields','catch','create','update','body','find','getFields','findOne','DeskField','pick','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','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','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit'];(function(_0x27acd2,_0x37dbd0){var _0x738fca=function(_0x21cb00){while(--_0x21cb00){_0x27acd2['push'](_0x27acd2['shift']());}};_0x738fca(++_0x37dbd0);}(_0x20b5,0x11a));var _0x520b=function(_0x163380,_0x21cc82){_0x163380=_0x163380-0x0;var _0x44afe4=_0x20b5[_0x163380];return _0x44afe4;};'use strict';var emlformat=require(_0x520b('0x0'));var rimraf=require(_0x520b('0x1'));var zipdir=require(_0x520b('0x2'));var jsonpatch=require(_0x520b('0x3'));var rp=require('request-promise');var moment=require(_0x520b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x520b('0x5'));var util=require('util');var path=require(_0x520b('0x6'));var sox=require(_0x520b('0x7'));var csv=require('to-csv');var ejs=require(_0x520b('0x8'));var fs=require('fs');var fs_extra=require(_0x520b('0x9'));var _=require('lodash');var squel=require(_0x520b('0xa'));var crypto=require(_0x520b('0xb'));var jsforce=require(_0x520b('0xc'));var deskjs=require(_0x520b('0xd'));var toCsv=require(_0x520b('0xe'));var querystring=require(_0x520b('0xf'));var Papa=require(_0x520b('0x10'));var Redis=require(_0x520b('0x11'));var authService=require(_0x520b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x520b('0x13'));var hardwareService=require(_0x520b('0x14'));var logger=require(_0x520b('0x15'))(_0x520b('0x16'));var utils=require(_0x520b('0x17'));var config=require(_0x520b('0x18'));var licenseUtil=require(_0x520b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x186889,_0x59418b){_0x59418b=_0x59418b||0xcc;return function(_0x27f75e){if(_0x27f75e){return _0x186889[_0x520b('0x1a')](_0x59418b);}return _0x186889[_0x520b('0x1b')](_0x59418b)[_0x520b('0x1c')]();};}function respondWithResult(_0x3aaac4,_0x39c21c){_0x39c21c=_0x39c21c||0xc8;return function(_0x5eb90a){if(_0x5eb90a){return _0x3aaac4[_0x520b('0x1b')](_0x39c21c)['json'](_0x5eb90a);}};}function respondWithFilteredResult(_0x44369f,_0x162ed5){return function(_0x10b3e9){if(_0x10b3e9){var _0x477f97=typeof _0x162ed5['offset']===_0x520b('0x1d')&&typeof _0x162ed5['limit']===_0x520b('0x1d');var _0xde7488=_0x10b3e9[_0x520b('0x1e')];var _0x2c9e65=_0x477f97?0x0:_0x162ed5[_0x520b('0x1f')];var _0x2236b6=_0x477f97?_0x10b3e9[_0x520b('0x1e')]:_0x162ed5[_0x520b('0x1f')]+_0x162ed5['limit'];var _0x49b7b5;if(_0x2236b6>=_0xde7488){_0x2236b6=_0xde7488;_0x49b7b5=0xc8;}else{_0x49b7b5=0xce;}_0x44369f[_0x520b('0x1b')](_0x49b7b5);return _0x44369f[_0x520b('0x20')](_0x520b('0x21'),_0x2c9e65+'-'+_0x2236b6+'/'+_0xde7488)[_0x520b('0x22')](_0x10b3e9);}return null;};}function patchUpdates(_0xeeb7fd){return function(_0xdc9fd7){try{jsonpatch[_0x520b('0x23')](_0xdc9fd7,_0xeeb7fd,!![]);}catch(_0x548e90){return BPromise['reject'](_0x548e90);}return _0xdc9fd7[_0x520b('0x24')]();};}function saveUpdates(_0x7cb29e,_0x2a46fe){return function(_0x16e5db){if(_0x16e5db){return _0x16e5db['update'](_0x7cb29e)[_0x520b('0x25')](function(_0x423595){return _0x423595;});}return null;};}function removeEntity(_0x4db6f2,_0x3738d0){return function(_0xf492a){if(_0xf492a){return _0xf492a[_0x520b('0x26')]()[_0x520b('0x25')](function(){_0x4db6f2[_0x520b('0x1b')](0xcc)[_0x520b('0x1c')]();});}};}function handleEntityNotFound(_0x1a5629,_0x4fe68a){return function(_0x439d35){if(!_0x439d35){_0x1a5629[_0x520b('0x1a')](0x194);}return _0x439d35;};}function handleError(_0xf8958c,_0x40713f){_0x40713f=_0x40713f||0x1f4;return function(_0x3c58d4){logger[_0x520b('0x27')](_0x3c58d4[_0x520b('0x28')]);if(_0x3c58d4[_0x520b('0x29')]){delete _0x3c58d4[_0x520b('0x29')];}_0xf8958c[_0x520b('0x1b')](_0x40713f)[_0x520b('0x2a')](_0x3c58d4);};}exports[_0x520b('0x2b')]=function(_0x90e5ff,_0x31b52f){var _0xd93189={},_0x3684d8={},_0x1cc05e={'count':0x0,'rows':[]};var _0x88ed8d=_[_0x520b('0x2c')](db[_0x520b('0x2d')][_0x520b('0x2e')],function(_0x5adfbd){return{'name':_0x5adfbd[_0x520b('0x2f')],'type':_0x5adfbd[_0x520b('0x30')][_0x520b('0x31')]};});_0x3684d8[_0x520b('0x32')]=_[_0x520b('0x2c')](_0x88ed8d,'name');_0x3684d8[_0x520b('0x33')]=_[_0x520b('0x34')](_0x90e5ff[_0x520b('0x33')]);_0x3684d8[_0x520b('0x35')]=_[_0x520b('0x36')](_0x3684d8[_0x520b('0x32')],_0x3684d8[_0x520b('0x33')]);_0xd93189[_0x520b('0x37')]=_['intersection'](_0x3684d8['model'],qs['fields'](_0x90e5ff['query']['fields']));_0xd93189['attributes']=_0xd93189['attributes'][_0x520b('0x38')]?_0xd93189[_0x520b('0x37')]:_0x3684d8[_0x520b('0x32')];if(!_0x90e5ff[_0x520b('0x33')]['hasOwnProperty'](_0x520b('0x39'))){_0xd93189[_0x520b('0x3a')]=qs['limit'](_0x90e5ff[_0x520b('0x33')]['limit']);_0xd93189[_0x520b('0x1f')]=qs[_0x520b('0x1f')](_0x90e5ff[_0x520b('0x33')]['offset']);}_0xd93189[_0x520b('0x3b')]=qs[_0x520b('0x3c')](_0x90e5ff[_0x520b('0x33')][_0x520b('0x3c')]);_0xd93189[_0x520b('0x3d')]=qs['filters'](_['pick'](_0x90e5ff[_0x520b('0x33')],_0x3684d8[_0x520b('0x35')]),_0x88ed8d);if(_0x90e5ff['query'][_0x520b('0x3e')]){_0xd93189[_0x520b('0x3d')]=_[_0x520b('0x3f')](_0xd93189[_0x520b('0x3d')],{'$or':_['map'](_0x88ed8d,function(_0x52c894){if(_0x52c894[_0x520b('0x30')]!=='VIRTUAL'){var _0x39fde4={};_0x39fde4[_0x52c894['name']]={'$like':'%'+_0x90e5ff[_0x520b('0x33')][_0x520b('0x3e')]+'%'};return _0x39fde4;}})});}_0xd93189=_[_0x520b('0x3f')]({},_0xd93189,_0x90e5ff[_0x520b('0x40')]);var _0xaa4c7e={'where':_0xd93189[_0x520b('0x3d')]};return db[_0x520b('0x2d')][_0x520b('0x1e')](_0xaa4c7e)[_0x520b('0x25')](function(_0x576527){_0x1cc05e[_0x520b('0x1e')]=_0x576527;if(_0x90e5ff['query'][_0x520b('0x41')]){_0xd93189['include']=[{'all':!![]}];}return db[_0x520b('0x2d')]['findAll'](_0xd93189);})[_0x520b('0x25')](function(_0x3db348){_0x1cc05e[_0x520b('0x42')]=_0x3db348;return _0x1cc05e;})[_0x520b('0x25')](respondWithFilteredResult(_0x31b52f,_0xd93189))['catch'](handleError(_0x31b52f,null));};exports['show']=function(_0x32e6eb,_0x1abfe3){var _0x1c7845={'raw':![],'where':{'id':_0x32e6eb[_0x520b('0x43')]['id']}},_0x11dc5d={};_0x11dc5d[_0x520b('0x32')]=_[_0x520b('0x34')](db[_0x520b('0x2d')][_0x520b('0x2e')]);_0x11dc5d[_0x520b('0x33')]=_[_0x520b('0x34')](_0x32e6eb[_0x520b('0x33')]);_0x11dc5d[_0x520b('0x35')]=_[_0x520b('0x36')](_0x11dc5d[_0x520b('0x32')],_0x11dc5d[_0x520b('0x33')]);_0x1c7845[_0x520b('0x37')]=_[_0x520b('0x36')](_0x11dc5d['model'],qs[_0x520b('0x44')](_0x32e6eb[_0x520b('0x33')]['fields']));_0x1c7845[_0x520b('0x37')]=_0x1c7845['attributes'][_0x520b('0x38')]?_0x1c7845[_0x520b('0x37')]:_0x11dc5d[_0x520b('0x32')];if(_0x32e6eb[_0x520b('0x33')]['includeAll']){_0x1c7845['include']=[{'all':!![]}];}_0x1c7845=_[_0x520b('0x3f')]({},_0x1c7845,_0x32e6eb[_0x520b('0x40')]);return db[_0x520b('0x2d')]['find'](_0x1c7845)[_0x520b('0x25')](handleEntityNotFound(_0x1abfe3,null))['then'](respondWithResult(_0x1abfe3,null))[_0x520b('0x45')](handleError(_0x1abfe3,null));};exports[_0x520b('0x46')]=function(_0x244f39,_0x4bbfeb){return db[_0x520b('0x2d')][_0x520b('0x46')](_0x244f39['body'],{})[_0x520b('0x25')](respondWithResult(_0x4bbfeb,0xc9))[_0x520b('0x45')](handleError(_0x4bbfeb,null));};exports[_0x520b('0x47')]=function(_0x40811e,_0x348797){if(_0x40811e[_0x520b('0x48')]['id']){delete _0x40811e[_0x520b('0x48')]['id'];}return db[_0x520b('0x2d')][_0x520b('0x49')]({'where':{'id':_0x40811e[_0x520b('0x43')]['id']}})[_0x520b('0x25')](handleEntityNotFound(_0x348797,null))[_0x520b('0x25')](saveUpdates(_0x40811e['body'],null))[_0x520b('0x25')](respondWithResult(_0x348797,null))[_0x520b('0x45')](handleError(_0x348797,null));};exports[_0x520b('0x26')]=function(_0x5c4d54,_0x26068c){return db['DeskConfiguration']['find']({'where':{'id':_0x5c4d54[_0x520b('0x43')]['id']}})['then'](handleEntityNotFound(_0x26068c,null))[_0x520b('0x25')](removeEntity(_0x26068c,null))[_0x520b('0x45')](handleError(_0x26068c,null));};exports[_0x520b('0x4a')]=function(_0x49bb41,_0x40d766,_0x5d941d){var _0x412975={};var _0x4f8bf5={};var _0x233d34;var _0x197c4e;return db[_0x520b('0x2d')][_0x520b('0x4b')]({'where':{'id':_0x49bb41[_0x520b('0x43')]['id']}})[_0x520b('0x25')](handleEntityNotFound(_0x40d766,null))['then'](function(_0x2948d6){if(_0x2948d6){_0x233d34=_0x2948d6;_0x4f8bf5['model']=_[_0x520b('0x34')](db[_0x520b('0x4c')][_0x520b('0x2e')]);_0x4f8bf5['query']=_['keys'](_0x49bb41['query']);_0x4f8bf5[_0x520b('0x35')]=_[_0x520b('0x36')](_0x4f8bf5[_0x520b('0x32')],_0x4f8bf5[_0x520b('0x33')]);_0x412975[_0x520b('0x37')]=_[_0x520b('0x36')](_0x4f8bf5[_0x520b('0x32')],qs[_0x520b('0x44')](_0x49bb41[_0x520b('0x33')][_0x520b('0x44')]));_0x412975[_0x520b('0x37')]=_0x412975[_0x520b('0x37')][_0x520b('0x38')]?_0x412975[_0x520b('0x37')]:_0x4f8bf5[_0x520b('0x32')];_0x412975['order']=qs['sort'](_0x49bb41[_0x520b('0x33')][_0x520b('0x3c')]);_0x412975['where']=qs[_0x520b('0x35')](_[_0x520b('0x4d')](_0x49bb41[_0x520b('0x33')],_0x4f8bf5['filters']));if(_0x49bb41[_0x520b('0x33')][_0x520b('0x3e')]){_0x412975[_0x520b('0x3d')]=_[_0x520b('0x3f')](_0x412975[_0x520b('0x3d')],{'$or':_[_0x520b('0x2c')](_0x412975['attributes'],function(_0x47658f){var _0x2560d7={};_0x2560d7[_0x47658f]={'$like':'%'+_0x49bb41[_0x520b('0x33')][_0x520b('0x3e')]+'%'};return _0x2560d7;})});}_0x412975=_[_0x520b('0x3f')]({},_0x412975,_0x49bb41[_0x520b('0x40')]);return _0x233d34['getFields'](_0x412975);}})[_0x520b('0x25')](function(_0x4e1fb9){if(_0x4e1fb9){_0x197c4e=_0x4e1fb9[_0x520b('0x38')];if(!_0x49bb41[_0x520b('0x33')]['hasOwnProperty'](_0x520b('0x39'))){_0x412975['limit']=qs[_0x520b('0x3a')](_0x49bb41['query'][_0x520b('0x3a')]);_0x412975[_0x520b('0x1f')]=qs['offset'](_0x49bb41['query']['offset']);}return _0x233d34[_0x520b('0x4a')](_0x412975);}})[_0x520b('0x25')](function(_0x22cba7){if(_0x22cba7){return _0x22cba7?{'count':_0x197c4e,'rows':_0x22cba7}:null;}})[_0x520b('0x25')](respondWithResult(_0x40d766,null))['catch'](handleError(_0x40d766,null));};exports['getSubjects']=function(_0xf895a1,_0x478585,_0x431ccf){var _0x3f229e={};var _0x3459c3={};var _0x2d7eef;var _0x53297b;return db[_0x520b('0x2d')][_0x520b('0x4b')]({'where':{'id':_0xf895a1['params']['id']}})[_0x520b('0x25')](handleEntityNotFound(_0x478585,null))[_0x520b('0x25')](function(_0x393ec0){if(_0x393ec0){_0x2d7eef=_0x393ec0;_0x3459c3[_0x520b('0x32')]=_[_0x520b('0x34')](db[_0x520b('0x4c')][_0x520b('0x2e')]);_0x3459c3[_0x520b('0x33')]=_[_0x520b('0x34')](_0xf895a1['query']);_0x3459c3[_0x520b('0x35')]=_[_0x520b('0x36')](_0x3459c3[_0x520b('0x32')],_0x3459c3[_0x520b('0x33')]);_0x3f229e[_0x520b('0x37')]=_[_0x520b('0x36')](_0x3459c3[_0x520b('0x32')],qs[_0x520b('0x44')](_0xf895a1[_0x520b('0x33')][_0x520b('0x44')]));_0x3f229e['attributes']=_0x3f229e[_0x520b('0x37')][_0x520b('0x38')]?_0x3f229e['attributes']:_0x3459c3[_0x520b('0x32')];_0x3f229e['order']=qs[_0x520b('0x3c')](_0xf895a1['query'][_0x520b('0x3c')]);_0x3f229e['where']=qs['filters'](_[_0x520b('0x4d')](_0xf895a1['query'],_0x3459c3['filters']));if(_0xf895a1[_0x520b('0x33')]['filter']){_0x3f229e[_0x520b('0x3d')]=_['merge'](_0x3f229e[_0x520b('0x3d')],{'$or':_[_0x520b('0x2c')](_0x3f229e[_0x520b('0x37')],function(_0xe818a1){var _0x552023={};_0x552023[_0xe818a1]={'$like':'%'+_0xf895a1[_0x520b('0x33')][_0x520b('0x3e')]+'%'};return _0x552023;})});}_0x3f229e=_['merge']({},_0x3f229e,_0xf895a1[_0x520b('0x40')]);return _0x2d7eef[_0x520b('0x4e')](_0x3f229e);}})['then'](function(_0x387fa8){if(_0x387fa8){_0x53297b=_0x387fa8[_0x520b('0x38')];if(!_0xf895a1[_0x520b('0x33')][_0x520b('0x4f')](_0x520b('0x39'))){_0x3f229e[_0x520b('0x3a')]=qs[_0x520b('0x3a')](_0xf895a1[_0x520b('0x33')][_0x520b('0x3a')]);_0x3f229e['offset']=qs[_0x520b('0x1f')](_0xf895a1['query'][_0x520b('0x1f')]);}return _0x2d7eef[_0x520b('0x4e')](_0x3f229e);}})['then'](function(_0x2b9988){if(_0x2b9988){return _0x2b9988?{'count':_0x53297b,'rows':_0x2b9988}:null;}})[_0x520b('0x25')](respondWithResult(_0x478585,null))[_0x520b('0x45')](handleError(_0x478585,null));};exports[_0x520b('0x50')]=function(_0x406d58,_0x4bff46,_0xb77b79){var _0x4b27b7={};var _0x4e647={};var _0x5220e4;var _0x1755d3;return db[_0x520b('0x2d')]['findOne']({'where':{'id':_0x406d58['params']['id']}})[_0x520b('0x25')](handleEntityNotFound(_0x4bff46,null))['then'](function(_0x5655e2){if(_0x5655e2){_0x5220e4=_0x5655e2;_0x4e647['model']=_['keys'](db[_0x520b('0x4c')][_0x520b('0x2e')]);_0x4e647[_0x520b('0x33')]=_['keys'](_0x406d58['query']);_0x4e647[_0x520b('0x35')]=_[_0x520b('0x36')](_0x4e647['model'],_0x4e647[_0x520b('0x33')]);_0x4b27b7[_0x520b('0x37')]=_['intersection'](_0x4e647['model'],qs[_0x520b('0x44')](_0x406d58['query'][_0x520b('0x44')]));_0x4b27b7[_0x520b('0x37')]=_0x4b27b7['attributes'][_0x520b('0x38')]?_0x4b27b7['attributes']:_0x4e647[_0x520b('0x32')];_0x4b27b7[_0x520b('0x3b')]=qs[_0x520b('0x3c')](_0x406d58[_0x520b('0x33')][_0x520b('0x3c')]);_0x4b27b7[_0x520b('0x3d')]=qs[_0x520b('0x35')](_['pick'](_0x406d58[_0x520b('0x33')],_0x4e647[_0x520b('0x35')]));if(_0x406d58[_0x520b('0x33')][_0x520b('0x3e')]){_0x4b27b7[_0x520b('0x3d')]=_[_0x520b('0x3f')](_0x4b27b7[_0x520b('0x3d')],{'$or':_['map'](_0x4b27b7['attributes'],function(_0x4e5eb1){var _0x3070f6={};_0x3070f6[_0x4e5eb1]={'$like':'%'+_0x406d58[_0x520b('0x33')][_0x520b('0x3e')]+'%'};return _0x3070f6;})});}_0x4b27b7=_[_0x520b('0x3f')]({},_0x4b27b7,_0x406d58[_0x520b('0x40')]);return _0x5220e4[_0x520b('0x50')](_0x4b27b7);}})[_0x520b('0x25')](function(_0x567e3b){if(_0x567e3b){_0x1755d3=_0x567e3b[_0x520b('0x38')];if(!_0x406d58['query'][_0x520b('0x4f')](_0x520b('0x39'))){_0x4b27b7[_0x520b('0x3a')]=qs['limit'](_0x406d58[_0x520b('0x33')][_0x520b('0x3a')]);_0x4b27b7[_0x520b('0x1f')]=qs[_0x520b('0x1f')](_0x406d58[_0x520b('0x33')]['offset']);}return _0x5220e4['getDescriptions'](_0x4b27b7);}})[_0x520b('0x25')](function(_0x632b78){if(_0x632b78){return _0x632b78?{'count':_0x1755d3,'rows':_0x632b78}:null;}})[_0x520b('0x25')](respondWithResult(_0x4bff46,null))['catch'](handleError(_0x4bff46,null));};exports[_0x520b('0x51')]=function(_0x5d8746,_0x3a9be2,_0x29072d){var _0x528894={};var _0x5b5f06={};var _0x42b2db;var _0x3274d5;return db[_0x520b('0x2d')][_0x520b('0x4b')]({'where':{'id':_0x5d8746['params']['id']}})[_0x520b('0x25')](handleEntityNotFound(_0x3a9be2,null))[_0x520b('0x25')](function(_0x3b7191){if(_0x3b7191){_0x42b2db=_0x3b7191;_0x5b5f06[_0x520b('0x32')]=_[_0x520b('0x34')](db[_0x520b('0x52')][_0x520b('0x2e')]);_0x5b5f06[_0x520b('0x33')]=_['keys'](_0x5d8746[_0x520b('0x33')]);_0x5b5f06[_0x520b('0x35')]=_['intersection'](_0x5b5f06[_0x520b('0x32')],_0x5b5f06[_0x520b('0x33')]);_0x528894[_0x520b('0x37')]=_[_0x520b('0x36')](_0x5b5f06[_0x520b('0x32')],qs[_0x520b('0x44')](_0x5d8746[_0x520b('0x33')][_0x520b('0x44')]));_0x528894[_0x520b('0x37')]=_0x528894['attributes'][_0x520b('0x38')]?_0x528894['attributes']:_0x5b5f06[_0x520b('0x32')];_0x528894['order']=qs[_0x520b('0x3c')](_0x5d8746[_0x520b('0x33')][_0x520b('0x3c')]);_0x528894['where']=qs[_0x520b('0x35')](_[_0x520b('0x4d')](_0x5d8746[_0x520b('0x33')],_0x5b5f06[_0x520b('0x35')]));if(_0x5d8746[_0x520b('0x33')][_0x520b('0x3e')]){_0x528894[_0x520b('0x3d')]=_['merge'](_0x528894[_0x520b('0x3d')],{'$or':_[_0x520b('0x2c')](_0x528894['attributes'],function(_0x4b1d67){var _0x2159d7={};_0x2159d7[_0x4b1d67]={'$like':'%'+_0x5d8746[_0x520b('0x33')][_0x520b('0x3e')]+'%'};return _0x2159d7;})});}_0x528894=_[_0x520b('0x3f')]({},_0x528894,_0x5d8746[_0x520b('0x40')]);return _0x42b2db[_0x520b('0x51')](_0x528894);}})[_0x520b('0x25')](function(_0x38fbb5){if(_0x38fbb5){_0x3274d5=_0x38fbb5[_0x520b('0x38')];if(!_0x5d8746[_0x520b('0x33')][_0x520b('0x4f')](_0x520b('0x39'))){_0x528894[_0x520b('0x3a')]=qs[_0x520b('0x3a')](_0x5d8746[_0x520b('0x33')]['limit']);_0x528894[_0x520b('0x1f')]=qs[_0x520b('0x1f')](_0x5d8746[_0x520b('0x33')][_0x520b('0x1f')]);}return _0x42b2db[_0x520b('0x51')](_0x528894);}})['then'](function(_0x1a1f3e){if(_0x1a1f3e){return _0x1a1f3e?{'count':_0x3274d5,'rows':_0x1a1f3e}:null;}})[_0x520b('0x25')](respondWithResult(_0x3a9be2,null))[_0x520b('0x45')](handleError(_0x3a9be2,null));};exports['setTags']=function(_0xdf4cf4,_0x132290,_0x21e199){if(_0xdf4cf4[_0x520b('0x48')]['id']){delete _0xdf4cf4[_0x520b('0x48')]['id'];}return db[_0x520b('0x2d')][_0x520b('0x4b')]({'where':{'id':_0xdf4cf4[_0x520b('0x43')]['id']}})['then'](handleEntityNotFound(_0x132290,null))[_0x520b('0x25')](function(_0x3aa91b){if(_0x3aa91b){return _0x3aa91b[_0x520b('0x53')](_0xdf4cf4['body'][_0x520b('0x54')]||[]);}return null;})[_0x520b('0x25')](respondWithResult(_0x132290,null))[_0x520b('0x45')](handleError(_0x132290,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 73a1ba4..21d20cf 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 _0xa953=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','define'];(function(_0x3e58ae,_0x41f857){var _0x315b26=function(_0x3b4831){while(--_0x3b4831){_0x3e58ae['push'](_0x3e58ae['shift']());}};_0x315b26(++_0x41f857);}(_0xa953,0x1d0));var _0x3a95=function(_0x121350,_0x361f4d){_0x121350=_0x121350-0x0;var _0x2e21c7=_0xa953[_0x121350];return _0x2e21c7;};'use strict';var _=require(_0x3a95('0x0'));var util=require(_0x3a95('0x1'));var logger=require(_0x3a95('0x2'))(_0x3a95('0x3'));var moment=require('moment');var BPromise=require(_0x3a95('0x4'));var rp=require(_0x3a95('0x5'));var fs=require('fs');var path=require(_0x3a95('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x3a95('0x7')]=function(_0x1ffe5f,_0x29613f){return _0x1ffe5f[_0x3a95('0x8')](_0x3a95('0x9'),attributes,{'tableName':_0x3a95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9063=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x213c71,_0xe432f5){var _0x3453ea=function(_0x172dd7){while(--_0x172dd7){_0x213c71['push'](_0x213c71['shift']());}};_0x3453ea(++_0xe432f5);}(_0x9063,0x1a2));var _0x3906=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x9063[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x3906('0x0'));var util=require(_0x3906('0x1'));var logger=require(_0x3906('0x2'))(_0x3906('0x3'));var moment=require(_0x3906('0x4'));var BPromise=require(_0x3906('0x5'));var rp=require(_0x3906('0x6'));var fs=require('fs');var path=require(_0x3906('0x7'));var rimraf=require('rimraf');var config=require(_0x3906('0x8'));var attributes=require(_0x3906('0x9'));module[_0x3906('0xa')]=function(_0x17c286,_0x79d5ae){return _0x17c286['define']('DeskConfiguration',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 e26e4f6..0e24960 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 _0x5d36=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','DeskConfiguration,\x20%s,\x20%s','message','info'];(function(_0x38651d,_0x5ca1bc){var _0x3f4c9b=function(_0x553aa1){while(--_0x553aa1){_0x38651d['push'](_0x38651d['shift']());}};_0x3f4c9b(++_0x5ca1bc);}(_0x5d36,0x11a));var _0x65d3=function(_0xa81926,_0x38e368){_0xa81926=_0xa81926-0x0;var _0x8177ef=_0x5d36[_0xa81926];return _0x8177ef;};'use strict';var _=require(_0x65d3('0x0'));var util=require(_0x65d3('0x1'));var moment=require(_0x65d3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65d3('0x3'));var db=require(_0x65d3('0x4'))['db'];var utils=require(_0x65d3('0x5'));var logger=require(_0x65d3('0x6'))(_0x65d3('0x7'));var config=require(_0x65d3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x65d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db9c9,_0xbee8a2,_0x33800c){return new BPromise(function(_0x31b558,_0x4e19e2){return client[_0x65d3('0xa')](_0x5db9c9,_0x33800c)[_0x65d3('0xb')](function(_0x30598c){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0xbee8a2,'request\x20sent');logger['debug'](_0x65d3('0xc'),_0xbee8a2,_0x65d3('0xd'),JSON['stringify'](_0x30598c));if(_0x30598c['error']){if(_0x30598c[_0x65d3('0xe')]['code']===0x1f4){logger[_0x65d3('0xe')](_0x65d3('0xf'),_0xbee8a2,_0x30598c[_0x65d3('0xe')][_0x65d3('0x10')]);return _0x4e19e2(_0x30598c[_0x65d3('0xe')]['message']);}logger[_0x65d3('0xe')](_0x65d3('0xf'),_0xbee8a2,_0x30598c[_0x65d3('0xe')][_0x65d3('0x10')]);return _0x31b558(_0x30598c['error'][_0x65d3('0x10')]);}else{logger[_0x65d3('0x11')](_0x65d3('0xf'),_0xbee8a2,_0x65d3('0xd'));_0x31b558(_0x30598c[_0x65d3('0x12')][_0x65d3('0x10')]);}})[_0x65d3('0x13')](function(_0x32e8ef){logger[_0x65d3('0xe')](_0x65d3('0xf'),_0xbee8a2,_0x32e8ef);_0x4e19e2(_0x32e8ef);});});} \ No newline at end of file +var _0xfe39=['../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x39905e,_0x225eb1){var _0x5f49b8=function(_0x5c17ad){while(--_0x5c17ad){_0x39905e['push'](_0x39905e['shift']());}};_0x5f49b8(++_0x225eb1);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xfe39[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var moment=require('moment');var BPromise=require(_0x9fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fe3('0x3'))['db'];var utils=require(_0x9fe3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fe3('0x5'));var jayson=require(_0x9fe3('0x6'));var client=jayson[_0x9fe3('0x7')][_0x9fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc469b7,_0x4183ce,_0x25868f){return new BPromise(function(_0x5a3bd6,_0x211eb2){return client[_0x9fe3('0x9')](_0xc469b7,_0x25868f)[_0x9fe3('0xa')](function(_0x35c391){logger[_0x9fe3('0xb')](_0x9fe3('0xc'),_0x4183ce,'request\x20sent');logger['debug'](_0x9fe3('0xd'),_0x4183ce,_0x9fe3('0xe'),JSON['stringify'](_0x35c391));if(_0x35c391[_0x9fe3('0xf')]){if(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x10')]===0x1f4){logger[_0x9fe3('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x211eb2(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x5a3bd6(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}else{logger[_0x9fe3('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x4183ce,'request\x20sent');_0x5a3bd6(_0x35c391[_0x9fe3('0x12')][_0x9fe3('0x11')]);}})[_0x9fe3('0x13')](function(_0x2d28d4){logger['error'](_0x9fe3('0xc'),_0x4183ce,_0x2d28d4);_0x211eb2(_0x2d28d4);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 37f2980..4fb7ade 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 _0x43fb=['isAuthenticated','index','/:id','show','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x3ce0ef,_0x41278e){var _0x4befe6=function(_0x4a27ea){while(--_0x4a27ea){_0x3ce0ef['push'](_0x3ce0ef['shift']());}};_0x4befe6(++_0x41278e);}(_0x43fb,0x170));var _0xb43f=function(_0x281f37,_0x3db9d1){_0x281f37=_0x281f37-0x0;var _0x5b3cb1=_0x43fb[_0x281f37];return _0x5b3cb1;};'use strict';var multer=require(_0xb43f('0x0'));var util=require(_0xb43f('0x1'));var path=require(_0xb43f('0x2'));var timeout=require(_0xb43f('0x3'));var express=require(_0xb43f('0x4'));var router=express[_0xb43f('0x5')]();var fs_extra=require(_0xb43f('0x6'));var auth=require(_0xb43f('0x7'));var interaction=require(_0xb43f('0x8'));var config=require(_0xb43f('0x9'));var controller=require(_0xb43f('0xa'));router[_0xb43f('0xb')]('/',auth[_0xb43f('0xc')](),controller[_0xb43f('0xd')]);router[_0xb43f('0xb')](_0xb43f('0xe'),auth[_0xb43f('0xc')](),controller[_0xb43f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb43f('0x10')]);router['put']('/:id',auth[_0xb43f('0xc')](),controller[_0xb43f('0x11')]);router[_0xb43f('0x12')](_0xb43f('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2c02=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0x2c02,0x18e));var _0x22c0=function(_0x44bfca,_0x4c4b95){_0x44bfca=_0x44bfca-0x0;var _0x2944e4=_0x2c02[_0x44bfca];return _0x2944e4;};'use strict';var multer=require(_0x22c0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x22c0('0x1'));var express=require('express');var router=express[_0x22c0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x22c0('0x3'));var interaction=require(_0x22c0('0x4'));var config=require(_0x22c0('0x5'));var controller=require(_0x22c0('0x6'));router[_0x22c0('0x7')]('/',auth[_0x22c0('0x8')](),controller[_0x22c0('0x9')]);router['get'](_0x22c0('0xa'),auth[_0x22c0('0x8')](),controller[_0x22c0('0xb')]);router[_0x22c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x22c0('0xd')]);router[_0x22c0('0xe')](_0x22c0('0xa'),auth[_0x22c0('0x8')](),controller[_0x22c0('0xf')]);router[_0x22c0('0x10')](_0x22c0('0xa'),auth[_0x22c0('0x8')](),controller[_0x22c0('0x11')]);module[_0x22c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 779c7f9..ebc5d35 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 _0xe128=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xe128,0x13e));var _0x8e12=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xe128[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0x8e12('0x0'));module[_0x8e12('0x1')]={'type':{'type':Sequelize[_0x8e12('0x2')]('string',_0x8e12('0x3'),_0x8e12('0x4'),_0x8e12('0x5'),_0x8e12('0x6')),'defaultValue':_0x8e12('0x7')},'content':{'type':Sequelize[_0x8e12('0x8')]},'key':{'type':Sequelize[_0x8e12('0x8')]},'keyType':{'type':Sequelize[_0x8e12('0x2')](_0x8e12('0x7'),_0x8e12('0x3'),_0x8e12('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8e12('0x8')]},'nameField':{'type':Sequelize[_0x8e12('0x8')]},'customField':{'type':Sequelize[_0x8e12('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7698=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x177ff1,_0x493fb3){var _0x1a2909=function(_0xd0045f){while(--_0xd0045f){_0x177ff1['push'](_0x177ff1['shift']());}};_0x1a2909(++_0x493fb3);}(_0x7698,0x1ee));var _0x8769=function(_0x3c7c53,_0x489c00){_0x3c7c53=_0x3c7c53-0x0;var _0x1c2077=_0x7698[_0x3c7c53];return _0x1c2077;};'use strict';var Sequelize=require('sequelize');module[_0x8769('0x0')]={'type':{'type':Sequelize[_0x8769('0x1')]('string',_0x8769('0x2'),_0x8769('0x3'),_0x8769('0x4'),_0x8769('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8769('0x6')]},'key':{'type':Sequelize[_0x8769('0x6')]},'keyType':{'type':Sequelize[_0x8769('0x1')]('string','variable',_0x8769('0x3'))},'keyContent':{'type':Sequelize[_0x8769('0x6')]},'idField':{'type':Sequelize[_0x8769('0x6')]},'nameField':{'type':Sequelize[_0x8769('0x6')]},'customField':{'type':Sequelize[_0x8769('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8769('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1a3b2a4..d399d88 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 _0x8838=['bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x41bb69,_0x356c6b){var _0x3f6368=function(_0x5f0dcb){while(--_0x5f0dcb){_0x41bb69['push'](_0x41bb69['shift']());}};_0x3f6368(++_0x356c6b);}(_0x8838,0x90));var _0x8883=function(_0x878045,_0x15401d){_0x878045=_0x878045-0x0;var _0x14d420=_0x8838[_0x878045];return _0x14d420;};'use strict';var emlformat=require(_0x8883('0x0'));var rimraf=require(_0x8883('0x1'));var zipdir=require(_0x8883('0x2'));var jsonpatch=require(_0x8883('0x3'));var rp=require(_0x8883('0x4'));var moment=require(_0x8883('0x5'));var BPromise=require(_0x8883('0x6'));var Mustache=require(_0x8883('0x7'));var util=require(_0x8883('0x8'));var path=require(_0x8883('0x9'));var sox=require(_0x8883('0xa'));var csv=require(_0x8883('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8883('0xc'));var squel=require('squel');var crypto=require(_0x8883('0xd'));var jsforce=require(_0x8883('0xe'));var deskjs=require(_0x8883('0xf'));var toCsv=require(_0x8883('0xb'));var querystring=require(_0x8883('0x10'));var Papa=require(_0x8883('0x11'));var Redis=require(_0x8883('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8883('0x13'));var as=require(_0x8883('0x14'));var hardwareService=require(_0x8883('0x15'));var logger=require(_0x8883('0x16'))('api');var utils=require(_0x8883('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8883('0x18'));var db=require(_0x8883('0x19'))['db'];function respondWithStatusCode(_0x357db6,_0x42dd7f){_0x42dd7f=_0x42dd7f||0xcc;return function(_0x3ad46c){if(_0x3ad46c){return _0x357db6[_0x8883('0x1a')](_0x42dd7f);}return _0x357db6[_0x8883('0x1b')](_0x42dd7f)[_0x8883('0x1c')]();};}function respondWithResult(_0x4663ba,_0x5f5259){_0x5f5259=_0x5f5259||0xc8;return function(_0x37ed54){if(_0x37ed54){return _0x4663ba[_0x8883('0x1b')](_0x5f5259)[_0x8883('0x1d')](_0x37ed54);}};}function respondWithFilteredResult(_0x347575,_0x5b9cba){return function(_0x126280){if(_0x126280){var _0x55e8ab=typeof _0x5b9cba[_0x8883('0x1e')]==='undefined'&&typeof _0x5b9cba[_0x8883('0x1f')]==='undefined';var _0x2ff211=_0x126280[_0x8883('0x20')];var _0x127b5f=_0x55e8ab?0x0:_0x5b9cba[_0x8883('0x1e')];var _0x1ec1b5=_0x55e8ab?_0x126280['count']:_0x5b9cba['offset']+_0x5b9cba[_0x8883('0x1f')];var _0x118c33;if(_0x1ec1b5>=_0x2ff211){_0x1ec1b5=_0x2ff211;_0x118c33=0xc8;}else{_0x118c33=0xce;}_0x347575['status'](_0x118c33);return _0x347575[_0x8883('0x21')](_0x8883('0x22'),_0x127b5f+'-'+_0x1ec1b5+'/'+_0x2ff211)[_0x8883('0x1d')](_0x126280);}return null;};}function patchUpdates(_0x4a7185){return function(_0x1bb80d){try{jsonpatch[_0x8883('0x23')](_0x1bb80d,_0x4a7185,!![]);}catch(_0x10d674){return BPromise[_0x8883('0x24')](_0x10d674);}return _0x1bb80d[_0x8883('0x25')]();};}function saveUpdates(_0x4c2376,_0x2ee36c){return function(_0xbb362f){if(_0xbb362f){return _0xbb362f['update'](_0x4c2376)[_0x8883('0x26')](function(_0x154e5f){return _0x154e5f;});}return null;};}function removeEntity(_0x171d63,_0x51fdd9){return function(_0x3f90e8){if(_0x3f90e8){return _0x3f90e8[_0x8883('0x27')]()[_0x8883('0x26')](function(){_0x171d63[_0x8883('0x1b')](0xcc)[_0x8883('0x1c')]();});}};}function handleEntityNotFound(_0x223412,_0x2b53e5){return function(_0x5d7c59){if(!_0x5d7c59){_0x223412[_0x8883('0x1a')](0x194);}return _0x5d7c59;};}function handleError(_0x576019,_0x1b6c13){_0x1b6c13=_0x1b6c13||0x1f4;return function(_0x5c3a68){logger['error'](_0x5c3a68['stack']);if(_0x5c3a68['name']){delete _0x5c3a68[_0x8883('0x28')];}_0x576019[_0x8883('0x1b')](_0x1b6c13)[_0x8883('0x29')](_0x5c3a68);};}exports['index']=function(_0x21529a,_0x1147ed){var _0x26df5b={},_0x2e772e={},_0x576605={'count':0x0,'rows':[]};var _0x15fcdb=_['map'](db[_0x8883('0x2a')][_0x8883('0x2b')],function(_0x2bdd57){return{'name':_0x2bdd57[_0x8883('0x2c')],'type':_0x2bdd57[_0x8883('0x2d')][_0x8883('0x2e')]};});_0x2e772e[_0x8883('0x2f')]=_['map'](_0x15fcdb,'name');_0x2e772e['query']=_[_0x8883('0x30')](_0x21529a[_0x8883('0x31')]);_0x2e772e[_0x8883('0x32')]=_['intersection'](_0x2e772e[_0x8883('0x2f')],_0x2e772e[_0x8883('0x31')]);_0x26df5b['attributes']=_['intersection'](_0x2e772e[_0x8883('0x2f')],qs['fields'](_0x21529a['query'][_0x8883('0x33')]));_0x26df5b[_0x8883('0x34')]=_0x26df5b['attributes'][_0x8883('0x35')]?_0x26df5b[_0x8883('0x34')]:_0x2e772e[_0x8883('0x2f')];if(!_0x21529a['query'][_0x8883('0x36')](_0x8883('0x37'))){_0x26df5b[_0x8883('0x1f')]=qs[_0x8883('0x1f')](_0x21529a[_0x8883('0x31')][_0x8883('0x1f')]);_0x26df5b[_0x8883('0x1e')]=qs[_0x8883('0x1e')](_0x21529a[_0x8883('0x31')][_0x8883('0x1e')]);}_0x26df5b[_0x8883('0x38')]=qs[_0x8883('0x39')](_0x21529a[_0x8883('0x31')][_0x8883('0x39')]);_0x26df5b[_0x8883('0x3a')]=qs['filters'](_[_0x8883('0x3b')](_0x21529a['query'],_0x2e772e[_0x8883('0x32')]),_0x15fcdb);if(_0x21529a['query'][_0x8883('0x3c')]){_0x26df5b['where']=_[_0x8883('0x3d')](_0x26df5b[_0x8883('0x3a')],{'$or':_['map'](_0x15fcdb,function(_0x2c3965){if(_0x2c3965[_0x8883('0x2d')]!==_0x8883('0x3e')){var _0x480609={};_0x480609[_0x2c3965[_0x8883('0x28')]]={'$like':'%'+_0x21529a[_0x8883('0x31')][_0x8883('0x3c')]+'%'};return _0x480609;}})});}_0x26df5b=_[_0x8883('0x3d')]({},_0x26df5b,_0x21529a[_0x8883('0x3f')]);var _0x21e90c={'where':_0x26df5b[_0x8883('0x3a')]};return db[_0x8883('0x2a')][_0x8883('0x20')](_0x21e90c)[_0x8883('0x26')](function(_0x262ef7){_0x576605[_0x8883('0x20')]=_0x262ef7;if(_0x21529a[_0x8883('0x31')][_0x8883('0x40')]){_0x26df5b['include']=[{'all':!![]}];}return db[_0x8883('0x2a')]['findAll'](_0x26df5b);})[_0x8883('0x26')](function(_0x3626bf){_0x576605[_0x8883('0x41')]=_0x3626bf;return _0x576605;})[_0x8883('0x26')](respondWithFilteredResult(_0x1147ed,_0x26df5b))[_0x8883('0x42')](handleError(_0x1147ed,null));};exports[_0x8883('0x43')]=function(_0x12af4c,_0x27a11a){var _0x5a66de={'raw':!![],'where':{'id':_0x12af4c[_0x8883('0x44')]['id']}},_0x35b867={};_0x35b867[_0x8883('0x2f')]=_[_0x8883('0x30')](db[_0x8883('0x2a')][_0x8883('0x2b')]);_0x35b867[_0x8883('0x31')]=_['keys'](_0x12af4c[_0x8883('0x31')]);_0x35b867[_0x8883('0x32')]=_[_0x8883('0x45')](_0x35b867[_0x8883('0x2f')],_0x35b867['query']);_0x5a66de[_0x8883('0x34')]=_[_0x8883('0x45')](_0x35b867[_0x8883('0x2f')],qs['fields'](_0x12af4c[_0x8883('0x31')]['fields']));_0x5a66de[_0x8883('0x34')]=_0x5a66de['attributes'][_0x8883('0x35')]?_0x5a66de[_0x8883('0x34')]:_0x35b867['model'];if(_0x12af4c['query']['includeAll']){_0x5a66de[_0x8883('0x46')]=[{'all':!![]}];}_0x5a66de=_[_0x8883('0x3d')]({},_0x5a66de,_0x12af4c[_0x8883('0x3f')]);return db['DeskField'][_0x8883('0x47')](_0x5a66de)[_0x8883('0x26')](handleEntityNotFound(_0x27a11a,null))[_0x8883('0x26')](respondWithResult(_0x27a11a,null))[_0x8883('0x42')](handleError(_0x27a11a,null));};exports[_0x8883('0x48')]=function(_0x58fdd8,_0x43683f){return db[_0x8883('0x2a')][_0x8883('0x48')](_0x58fdd8[_0x8883('0x49')],{})[_0x8883('0x26')](respondWithResult(_0x43683f,0xc9))[_0x8883('0x42')](handleError(_0x43683f,null));};exports[_0x8883('0x4a')]=function(_0x21ee60,_0x598086){if(_0x21ee60['body']['id']){delete _0x21ee60[_0x8883('0x49')]['id'];}return db[_0x8883('0x2a')]['find']({'where':{'id':_0x21ee60[_0x8883('0x44')]['id']}})['then'](handleEntityNotFound(_0x598086,null))['then'](saveUpdates(_0x21ee60[_0x8883('0x49')],null))[_0x8883('0x26')](respondWithResult(_0x598086,null))['catch'](handleError(_0x598086,null));};exports[_0x8883('0x27')]=function(_0x153ba6,_0x23f464){return db[_0x8883('0x2a')][_0x8883('0x47')]({'where':{'id':_0x153ba6[_0x8883('0x44')]['id']}})[_0x8883('0x26')](handleEntityNotFound(_0x23f464,null))[_0x8883('0x26')](removeEntity(_0x23f464,null))[_0x8883('0x42')](handleError(_0x23f464,null));}; \ No newline at end of file +var _0x8b52=['../../config/license/util','sendStatus','end','status','offset','limit','count','Content-Range','json','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','DeskField','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x465351,_0x115a2c){var _0x19f941=function(_0x4584d7){while(--_0x4584d7){_0x465351['push'](_0x465351['shift']());}};_0x19f941(++_0x115a2c);}(_0x8b52,0x151));var _0x28b5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8b52[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x28b5('0x0'));var rimraf=require(_0x28b5('0x1'));var zipdir=require(_0x28b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28b5('0x3'));var moment=require(_0x28b5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28b5('0x5'));var util=require(_0x28b5('0x6'));var path=require(_0x28b5('0x7'));var sox=require(_0x28b5('0x8'));var csv=require(_0x28b5('0x9'));var ejs=require(_0x28b5('0xa'));var fs=require('fs');var fs_extra=require(_0x28b5('0xb'));var _=require(_0x28b5('0xc'));var squel=require(_0x28b5('0xd'));var crypto=require('crypto');var jsforce=require(_0x28b5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x28b5('0xf'));var Papa=require(_0x28b5('0x10'));var Redis=require('ioredis');var authService=require(_0x28b5('0x11'));var qs=require(_0x28b5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28b5('0x13'));var logger=require(_0x28b5('0x14'))(_0x28b5('0x15'));var utils=require(_0x28b5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x28b5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc18108,_0x3bd9f3){_0x3bd9f3=_0x3bd9f3||0xcc;return function(_0x5f41b6){if(_0x5f41b6){return _0xc18108[_0x28b5('0x18')](_0x3bd9f3);}return _0xc18108['status'](_0x3bd9f3)[_0x28b5('0x19')]();};}function respondWithResult(_0x4a684e,_0x58f350){_0x58f350=_0x58f350||0xc8;return function(_0xff943a){if(_0xff943a){return _0x4a684e[_0x28b5('0x1a')](_0x58f350)['json'](_0xff943a);}};}function respondWithFilteredResult(_0x2c17c7,_0x26213c){return function(_0x1e4a10){if(_0x1e4a10){var _0x16c115=typeof _0x26213c[_0x28b5('0x1b')]==='undefined'&&typeof _0x26213c[_0x28b5('0x1c')]==='undefined';var _0x7b6900=_0x1e4a10[_0x28b5('0x1d')];var _0xfea919=_0x16c115?0x0:_0x26213c[_0x28b5('0x1b')];var _0x540933=_0x16c115?_0x1e4a10[_0x28b5('0x1d')]:_0x26213c[_0x28b5('0x1b')]+_0x26213c[_0x28b5('0x1c')];var _0x534136;if(_0x540933>=_0x7b6900){_0x540933=_0x7b6900;_0x534136=0xc8;}else{_0x534136=0xce;}_0x2c17c7[_0x28b5('0x1a')](_0x534136);return _0x2c17c7['set'](_0x28b5('0x1e'),_0xfea919+'-'+_0x540933+'/'+_0x7b6900)[_0x28b5('0x1f')](_0x1e4a10);}return null;};}function patchUpdates(_0x2c4cae){return function(_0x386494){try{jsonpatch['apply'](_0x386494,_0x2c4cae,!![]);}catch(_0x3ebe9e){return BPromise[_0x28b5('0x20')](_0x3ebe9e);}return _0x386494[_0x28b5('0x21')]();};}function saveUpdates(_0x32c819,_0x5c453a){return function(_0x4a8893){if(_0x4a8893){return _0x4a8893['update'](_0x32c819)[_0x28b5('0x22')](function(_0x1bf044){return _0x1bf044;});}return null;};}function removeEntity(_0x395feb,_0x740562){return function(_0x8fa4b9){if(_0x8fa4b9){return _0x8fa4b9[_0x28b5('0x23')]()['then'](function(){_0x395feb['status'](0xcc)[_0x28b5('0x19')]();});}};}function handleEntityNotFound(_0x528993,_0x304f72){return function(_0x25fd54){if(!_0x25fd54){_0x528993[_0x28b5('0x18')](0x194);}return _0x25fd54;};}function handleError(_0x18176c,_0x127ab0){_0x127ab0=_0x127ab0||0x1f4;return function(_0x5ae41d){logger['error'](_0x5ae41d[_0x28b5('0x24')]);if(_0x5ae41d[_0x28b5('0x25')]){delete _0x5ae41d[_0x28b5('0x25')];}_0x18176c[_0x28b5('0x1a')](_0x127ab0)[_0x28b5('0x26')](_0x5ae41d);};}exports[_0x28b5('0x27')]=function(_0x2db6f1,_0x1bbe54){var _0x139524={},_0x2a182a={},_0x491b72={'count':0x0,'rows':[]};var _0x2b46f7=_[_0x28b5('0x28')](db['DeskField'][_0x28b5('0x29')],function(_0x330767){return{'name':_0x330767[_0x28b5('0x2a')],'type':_0x330767[_0x28b5('0x2b')][_0x28b5('0x2c')]};});_0x2a182a[_0x28b5('0x2d')]=_[_0x28b5('0x28')](_0x2b46f7,'name');_0x2a182a[_0x28b5('0x2e')]=_['keys'](_0x2db6f1[_0x28b5('0x2e')]);_0x2a182a[_0x28b5('0x2f')]=_[_0x28b5('0x30')](_0x2a182a[_0x28b5('0x2d')],_0x2a182a[_0x28b5('0x2e')]);_0x139524[_0x28b5('0x31')]=_[_0x28b5('0x30')](_0x2a182a[_0x28b5('0x2d')],qs[_0x28b5('0x32')](_0x2db6f1[_0x28b5('0x2e')][_0x28b5('0x32')]));_0x139524[_0x28b5('0x31')]=_0x139524[_0x28b5('0x31')][_0x28b5('0x33')]?_0x139524[_0x28b5('0x31')]:_0x2a182a[_0x28b5('0x2d')];if(!_0x2db6f1['query'][_0x28b5('0x34')]('nolimit')){_0x139524[_0x28b5('0x1c')]=qs[_0x28b5('0x1c')](_0x2db6f1[_0x28b5('0x2e')][_0x28b5('0x1c')]);_0x139524['offset']=qs[_0x28b5('0x1b')](_0x2db6f1[_0x28b5('0x2e')][_0x28b5('0x1b')]);}_0x139524['order']=qs['sort'](_0x2db6f1[_0x28b5('0x2e')][_0x28b5('0x35')]);_0x139524[_0x28b5('0x36')]=qs[_0x28b5('0x2f')](_['pick'](_0x2db6f1[_0x28b5('0x2e')],_0x2a182a[_0x28b5('0x2f')]),_0x2b46f7);if(_0x2db6f1[_0x28b5('0x2e')][_0x28b5('0x37')]){_0x139524[_0x28b5('0x36')]=_[_0x28b5('0x38')](_0x139524[_0x28b5('0x36')],{'$or':_[_0x28b5('0x28')](_0x2b46f7,function(_0x4cc88a){if(_0x4cc88a[_0x28b5('0x2b')]!==_0x28b5('0x39')){var _0x4d3d09={};_0x4d3d09[_0x4cc88a[_0x28b5('0x25')]]={'$like':'%'+_0x2db6f1['query'][_0x28b5('0x37')]+'%'};return _0x4d3d09;}})});}_0x139524=_[_0x28b5('0x38')]({},_0x139524,_0x2db6f1[_0x28b5('0x3a')]);var _0x5e1fb2={'where':_0x139524[_0x28b5('0x36')]};return db[_0x28b5('0x3b')][_0x28b5('0x1d')](_0x5e1fb2)[_0x28b5('0x22')](function(_0x31f620){_0x491b72[_0x28b5('0x1d')]=_0x31f620;if(_0x2db6f1['query'][_0x28b5('0x3c')]){_0x139524[_0x28b5('0x3d')]=[{'all':!![]}];}return db[_0x28b5('0x3b')][_0x28b5('0x3e')](_0x139524);})[_0x28b5('0x22')](function(_0x5c237f){_0x491b72[_0x28b5('0x3f')]=_0x5c237f;return _0x491b72;})[_0x28b5('0x22')](respondWithFilteredResult(_0x1bbe54,_0x139524))[_0x28b5('0x40')](handleError(_0x1bbe54,null));};exports[_0x28b5('0x41')]=function(_0x45bd3c,_0x4bd2e3){var _0x2ac508={'raw':!![],'where':{'id':_0x45bd3c[_0x28b5('0x42')]['id']}},_0x5bee77={};_0x5bee77[_0x28b5('0x2d')]=_[_0x28b5('0x43')](db[_0x28b5('0x3b')]['rawAttributes']);_0x5bee77['query']=_[_0x28b5('0x43')](_0x45bd3c[_0x28b5('0x2e')]);_0x5bee77[_0x28b5('0x2f')]=_[_0x28b5('0x30')](_0x5bee77[_0x28b5('0x2d')],_0x5bee77['query']);_0x2ac508[_0x28b5('0x31')]=_['intersection'](_0x5bee77[_0x28b5('0x2d')],qs[_0x28b5('0x32')](_0x45bd3c[_0x28b5('0x2e')][_0x28b5('0x32')]));_0x2ac508[_0x28b5('0x31')]=_0x2ac508[_0x28b5('0x31')][_0x28b5('0x33')]?_0x2ac508['attributes']:_0x5bee77[_0x28b5('0x2d')];if(_0x45bd3c[_0x28b5('0x2e')][_0x28b5('0x3c')]){_0x2ac508[_0x28b5('0x3d')]=[{'all':!![]}];}_0x2ac508=_[_0x28b5('0x38')]({},_0x2ac508,_0x45bd3c[_0x28b5('0x3a')]);return db[_0x28b5('0x3b')][_0x28b5('0x44')](_0x2ac508)[_0x28b5('0x22')](handleEntityNotFound(_0x4bd2e3,null))['then'](respondWithResult(_0x4bd2e3,null))[_0x28b5('0x40')](handleError(_0x4bd2e3,null));};exports[_0x28b5('0x45')]=function(_0xe46b0a,_0x141f9a){return db['DeskField'][_0x28b5('0x45')](_0xe46b0a[_0x28b5('0x46')],{})[_0x28b5('0x22')](respondWithResult(_0x141f9a,0xc9))[_0x28b5('0x40')](handleError(_0x141f9a,null));};exports[_0x28b5('0x47')]=function(_0xaf449d,_0x3d7fdd){if(_0xaf449d[_0x28b5('0x46')]['id']){delete _0xaf449d[_0x28b5('0x46')]['id'];}return db[_0x28b5('0x3b')][_0x28b5('0x44')]({'where':{'id':_0xaf449d[_0x28b5('0x42')]['id']}})[_0x28b5('0x22')](handleEntityNotFound(_0x3d7fdd,null))[_0x28b5('0x22')](saveUpdates(_0xaf449d['body'],null))['then'](respondWithResult(_0x3d7fdd,null))['catch'](handleError(_0x3d7fdd,null));};exports[_0x28b5('0x23')]=function(_0x97af32,_0x5aaef3){return db[_0x28b5('0x3b')][_0x28b5('0x44')]({'where':{'id':_0x97af32['params']['id']}})[_0x28b5('0x22')](handleEntityNotFound(_0x5aaef3,null))[_0x28b5('0x22')](removeEntity(_0x5aaef3,null))[_0x28b5('0x40')](handleError(_0x5aaef3,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 468ecb1..c0c015d 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 _0xc913=['desk_unique_index','idField','FieldId','lodash','util','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields'];(function(_0x1de95e,_0x38839c){var _0x1ed862=function(_0x2a277b){while(--_0x2a277b){_0x1de95e['push'](_0x1de95e['shift']());}};_0x1ed862(++_0x38839c);}(_0xc913,0x65));var _0x3c91=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc913[_0x432682];return _0x463d05;};'use strict';var _=require(_0x3c91('0x0'));var util=require(_0x3c91('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3c91('0x2'));var rp=require(_0x3c91('0x3'));var fs=require('fs');var path=require(_0x3c91('0x4'));var rimraf=require(_0x3c91('0x5'));var config=require('../../config/environment');var attributes=require(_0x3c91('0x6'));module[_0x3c91('0x7')]=function(_0x2a9800,_0x33a41b){return _0x2a9800[_0x3c91('0x8')](_0x3c91('0x9'),attributes,{'tableName':_0x3c91('0xa'),'paranoid':![],'indexes':[{'name':_0x3c91('0xb'),'fields':[_0x3c91('0xc'),_0x3c91('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88ae=['api','moment','bluebird','request-promise','path','exports','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x88ae,0x105));var _0xe88a=function(_0x2d4f17,_0x377787){_0x2d4f17=_0x2d4f17-0x0;var _0x467237=_0x88ae[_0x2d4f17];return _0x467237;};'use strict';var _=require(_0xe88a('0x0'));var util=require(_0xe88a('0x1'));var logger=require(_0xe88a('0x2'))(_0xe88a('0x3'));var moment=require(_0xe88a('0x4'));var BPromise=require(_0xe88a('0x5'));var rp=require(_0xe88a('0x6'));var fs=require('fs');var path=require(_0xe88a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xe88a('0x8')]=function(_0x3ee331,_0x3c57ec){return _0x3ee331['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xe88a('0x9'),'fields':[_0xe88a('0xa'),_0xe88a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index b7239c8..8e4d635 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 _0xe7bb=['rpc','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x19450f,_0xb7a6e5){var _0x12832c=function(_0x4bcb20){while(--_0x4bcb20){_0x19450f['push'](_0x19450f['shift']());}};_0x12832c(++_0xb7a6e5);}(_0xe7bb,0x111));var _0xbe7b=function(_0x488a41,_0x1a2c5a){_0x488a41=_0x488a41-0x0;var _0x1ea969=_0xe7bb[_0x488a41];return _0x1ea969;};'use strict';var _=require(_0xbe7b('0x0'));var util=require(_0xbe7b('0x1'));var moment=require(_0xbe7b('0x2'));var BPromise=require(_0xbe7b('0x3'));var rs=require(_0xbe7b('0x4'));var fs=require('fs');var Redis=require(_0xbe7b('0x5'));var db=require(_0xbe7b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbe7b('0x7'));var config=require('../../config/environment');var jayson=require(_0xbe7b('0x8'));var client=jayson[_0xbe7b('0x9')][_0xbe7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43aac1,_0x1bba6a,_0xa29594){return new BPromise(function(_0xc0d5d4,_0x6a41b8){return client['request'](_0x43aac1,_0xa29594)[_0xbe7b('0xb')](function(_0x50f2cd){logger[_0xbe7b('0xc')]('DeskField,\x20%s,\x20%s',_0x1bba6a,'request\x20sent');logger['debug'](_0xbe7b('0xd'),_0x1bba6a,_0xbe7b('0xe'),JSON[_0xbe7b('0xf')](_0x50f2cd));if(_0x50f2cd[_0xbe7b('0x10')]){if(_0x50f2cd[_0xbe7b('0x10')][_0xbe7b('0x11')]===0x1f4){logger[_0xbe7b('0x10')](_0xbe7b('0x12'),_0x1bba6a,_0x50f2cd[_0xbe7b('0x10')][_0xbe7b('0x13')]);return _0x6a41b8(_0x50f2cd[_0xbe7b('0x10')][_0xbe7b('0x13')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x1bba6a,_0x50f2cd['error']['message']);return _0xc0d5d4(_0x50f2cd['error'][_0xbe7b('0x13')]);}else{logger['info'](_0xbe7b('0x12'),_0x1bba6a,_0xbe7b('0xe'));_0xc0d5d4(_0x50f2cd['result'][_0xbe7b('0x13')]);}})['catch'](function(_0x234b30){logger[_0xbe7b('0x10')](_0xbe7b('0x12'),_0x1bba6a,_0x234b30);_0x6a41b8(_0x234b30);});});} \ No newline at end of file +var _0xf24d=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf24d,0xfb));var _0xdf24=function(_0x40beac,_0x2e0edd){_0x40beac=_0x40beac-0x0;var _0x21e917=_0xf24d[_0x40beac];return _0x21e917;};'use strict';var _=require(_0xdf24('0x0'));var util=require(_0xdf24('0x1'));var moment=require(_0xdf24('0x2'));var BPromise=require(_0xdf24('0x3'));var rs=require(_0xdf24('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf24('0x5'));var logger=require(_0xdf24('0x6'))('rpc');var config=require(_0xdf24('0x7'));var jayson=require(_0xdf24('0x8'));var client=jayson[_0xdf24('0x9')][_0xdf24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c7861,_0x317188,_0x2188a6){return new BPromise(function(_0x39876a,_0x3d9626){return client['request'](_0x3c7861,_0x2188a6)[_0xdf24('0xb')](function(_0x24ab4c){logger[_0xdf24('0xc')](_0xdf24('0xd'),_0x317188,_0xdf24('0xe'));logger[_0xdf24('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x317188,'request\x20sent',JSON[_0xdf24('0x10')](_0x24ab4c));if(_0x24ab4c['error']){if(_0x24ab4c[_0xdf24('0x11')]['code']===0x1f4){logger[_0xdf24('0x11')]('DeskField,\x20%s,\x20%s',_0x317188,_0x24ab4c['error'][_0xdf24('0x12')]);return _0x3d9626(_0x24ab4c[_0xdf24('0x11')]['message']);}logger[_0xdf24('0x11')](_0xdf24('0xd'),_0x317188,_0x24ab4c[_0xdf24('0x11')][_0xdf24('0x12')]);return _0x39876a(_0x24ab4c['error'][_0xdf24('0x12')]);}else{logger[_0xdf24('0xc')](_0xdf24('0xd'),_0x317188,_0xdf24('0xe'));_0x39876a(_0x24ab4c[_0xdf24('0x13')][_0xdf24('0x12')]);}})[_0xdf24('0x14')](function(_0x3dce2d){logger['error']('DeskField,\x20%s,\x20%s',_0x317188,_0x3dce2d);_0x3d9626(_0x3dce2d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 88fe569..2a3a9cc 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 _0xa768=['../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x390cea,_0x43c078){var _0x14bf80=function(_0x196f3c){while(--_0x196f3c){_0x390cea['push'](_0x390cea['shift']());}};_0x14bf80(++_0x43c078);}(_0xa768,0xa7));var _0x8a76=function(_0x1de164,_0x1ccf5f){_0x1de164=_0x1de164-0x0;var _0x5613b4=_0xa768[_0x1de164];return _0x5613b4;};'use strict';var multer=require(_0x8a76('0x0'));var util=require(_0x8a76('0x1'));var path=require(_0x8a76('0x2'));var timeout=require(_0x8a76('0x3'));var express=require(_0x8a76('0x4'));var router=express[_0x8a76('0x5')]();var fs_extra=require(_0x8a76('0x6'));var auth=require(_0x8a76('0x7'));var interaction=require(_0x8a76('0x8'));var config=require('../../config/environment');var controller=require(_0x8a76('0x9'));router[_0x8a76('0xa')]('/',auth[_0x8a76('0xb')](),controller[_0x8a76('0xc')]);router['get']('/:id',auth[_0x8a76('0xb')](),controller[_0x8a76('0xd')]);router[_0x8a76('0xa')](_0x8a76('0xe'),auth[_0x8a76('0xb')](),controller['getConfigurations']);router[_0x8a76('0xa')](_0x8a76('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x8a76('0x10')]('/',auth[_0x8a76('0xb')](),controller[_0x8a76('0x11')]);router[_0x8a76('0x10')]('/:id/configurations',auth[_0x8a76('0xb')](),controller[_0x8a76('0x12')]);router[_0x8a76('0x13')](_0x8a76('0x14'),auth[_0x8a76('0xb')](),controller[_0x8a76('0x15')]);router[_0x8a76('0x16')](_0x8a76('0x14'),auth['isAuthenticated'](),controller[_0x8a76('0x17')]);module[_0x8a76('0x18')]=router; \ No newline at end of file +var _0x5d65=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','show'];(function(_0x24a956,_0x1a7a4f){var _0x38aac9=function(_0x12d778){while(--_0x12d778){_0x24a956['push'](_0x24a956['shift']());}};_0x38aac9(++_0x1a7a4f);}(_0x5d65,0x14f));var _0x55d6=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x5d65[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x55d6('0x0'));var util=require(_0x55d6('0x1'));var path=require(_0x55d6('0x2'));var timeout=require(_0x55d6('0x3'));var express=require(_0x55d6('0x4'));var router=express[_0x55d6('0x5')]();var fs_extra=require(_0x55d6('0x6'));var auth=require(_0x55d6('0x7'));var interaction=require(_0x55d6('0x8'));var config=require(_0x55d6('0x9'));var controller=require(_0x55d6('0xa'));router['get']('/',auth[_0x55d6('0xb')](),controller[_0x55d6('0xc')]);router[_0x55d6('0xd')]('/:id',auth[_0x55d6('0xb')](),controller[_0x55d6('0xe')]);router[_0x55d6('0xd')](_0x55d6('0xf'),auth[_0x55d6('0xb')](),controller[_0x55d6('0x10')]);router[_0x55d6('0xd')](_0x55d6('0x11'),auth[_0x55d6('0xb')](),controller[_0x55d6('0x12')]);router['post']('/',auth[_0x55d6('0xb')](),controller['create']);router[_0x55d6('0x13')]('/:id/configurations',auth[_0x55d6('0xb')](),controller[_0x55d6('0x14')]);router[_0x55d6('0x15')]('/:id',auth[_0x55d6('0xb')](),controller[_0x55d6('0x16')]);router[_0x55d6('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x55d6('0x18')]);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 15b0628..a68806c 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 _0x078c=['BOOLEAN','sequelize','STRING'];(function(_0x21d7a2,_0x5aecda){var _0x1da981=function(_0x4c86f2){while(--_0x4c86f2){_0x21d7a2['push'](_0x21d7a2['shift']());}};_0x1da981(++_0x5aecda);}(_0x078c,0x19f));var _0xc078=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x078c[_0x12254f];return _0x3a4fa2;};'use strict';var Sequelize=require(_0xc078('0x0'));module['exports']={'name':{'type':Sequelize[_0xc078('0x1')]},'username':{'type':Sequelize[_0xc078('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc078('0x1')]},'tenantId':{'type':Sequelize[_0xc078('0x1')]},'clientId':{'type':Sequelize[_0xc078('0x1')]},'clientSecret':{'type':Sequelize[_0xc078('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc078('0x1')]},'modernAuthentication':{'type':Sequelize[_0xc078('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xca9e=['STRING','BOOLEAN','sequelize','exports'];(function(_0x50fc19,_0x2685e7){var _0x30c392=function(_0x5763f6){while(--_0x5763f6){_0x50fc19['push'](_0x50fc19['shift']());}};_0x30c392(++_0x2685e7);}(_0xca9e,0x136));var _0xeca9=function(_0x2d9b6b,_0x2b81ca){_0x2d9b6b=_0x2d9b6b-0x0;var _0x5b360b=_0xca9e[_0x2d9b6b];return _0x5b360b;};'use strict';var Sequelize=require(_0xeca9('0x0'));module[_0xeca9('0x1')]={'name':{'type':Sequelize[_0xeca9('0x2')]},'username':{'type':Sequelize[_0xeca9('0x2')]},'password':{'type':Sequelize[_0xeca9('0x2')]},'remoteUri':{'type':Sequelize[_0xeca9('0x2')]},'tenantId':{'type':Sequelize[_0xeca9('0x2')]},'clientId':{'type':Sequelize[_0xeca9('0x2')]},'clientSecret':{'type':Sequelize[_0xeca9('0x2')]},'serverUrl':{'type':Sequelize[_0xeca9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeca9('0x2')]},'modernAuthentication':{'type':Sequelize[_0xeca9('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 709050b..01dd93a 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 _0x2b34=['limit','count','Content-Range','then','error','stack','send','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','catch','show','params','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','lastIndexOf','format','ticketType','incident','Incident','title','description','customerid','caseorigincode','regardingobjectid','directioncode','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','password','tenantId','clientId','modernAuthentication','CloudProvider','access_token','data7','remoteUri','POST','/oauth2/token','username','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','all','BooleanAttributeMetadata','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','UserLocalizedLabel','Label',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','DisplayName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined'];(function(_0x17bfae,_0x52023d){var _0x6af798=function(_0x21a0f4){while(--_0x21a0f4){_0x17bfae['push'](_0x17bfae['shift']());}};_0x6af798(++_0x52023d);}(_0x2b34,0xa7));var _0x42b3=function(_0x3c31d1,_0x4d885e){_0x3c31d1=_0x3c31d1-0x0;var _0xe62b4=_0x2b34[_0x3c31d1];return _0xe62b4;};'use strict';var rp=require(_0x42b3('0x0'));var util=require(_0x42b3('0x1'));var _=require('lodash');var qs=require(_0x42b3('0x2'));var logger=require(_0x42b3('0x3'))(_0x42b3('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x42b3('0x5'));function respondWithResult(_0xbba471,_0x31cd9b){_0x31cd9b=_0x31cd9b||0xc8;return function(_0x57032d){if(_0x57032d){return _0xbba471[_0x42b3('0x6')](_0x31cd9b)[_0x42b3('0x7')](_0x57032d);}};}function respondWithFilteredResult(_0x27b785,_0x2d6167){return function(_0xbe9209){if(_0xbe9209){var _0x42d457=typeof _0x2d6167[_0x42b3('0x8')]===_0x42b3('0x9')&&typeof _0x2d6167[_0x42b3('0xa')]===_0x42b3('0x9');var _0x596829=_0xbe9209[_0x42b3('0xb')];var _0x42cd78=_0x42d457?0x0:_0x2d6167[_0x42b3('0x8')];var _0x58bbcd=_0x42d457?_0xbe9209[_0x42b3('0xb')]:_0x2d6167[_0x42b3('0x8')]+_0x2d6167[_0x42b3('0xa')];var _0x1a3372;if(_0x58bbcd>=_0x596829){_0x58bbcd=_0x596829;_0x1a3372=0xc8;}else{_0x1a3372=0xce;}_0x27b785['status'](_0x1a3372);return _0x27b785['set'](_0x42b3('0xc'),_0x42cd78+'-'+_0x58bbcd+'/'+_0x596829)['json'](_0xbe9209);}return null;};}function saveUpdates(_0x330d42){return function(_0x19e1b4){if(_0x19e1b4){return _0x19e1b4['update'](_0x330d42)[_0x42b3('0xd')](function(_0x17bd38){return _0x17bd38;});}return null;};}function removeEntity(_0x2e16aa){return function(_0x3dd782){if(_0x3dd782){return _0x3dd782['destroy']()[_0x42b3('0xd')](function(){_0x2e16aa[_0x42b3('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ffc24){return function(_0x3306c7){if(!_0x3306c7){_0x2ffc24['sendStatus'](0x194);}return _0x3306c7;};}function handleError(_0x40811a,_0x5e9d55){_0x5e9d55=_0x5e9d55||0x1f4;return function(_0x9c3547){logger[_0x42b3('0xe')](_0x9c3547[_0x42b3('0xf')]);if(_0x9c3547['name']){delete _0x9c3547['name'];}_0x40811a[_0x42b3('0x6')](_0x5e9d55)[_0x42b3('0x10')](_0x9c3547);};}exports[_0x42b3('0x11')]=function(_0x4a150a,_0x4a77cb){var _0x132a61={},_0x1d2dd0={},_0x4ee6d6={'count':0x0,'rows':[]};var _0x3234d1=_['map'](db[_0x42b3('0x12')][_0x42b3('0x13')],function(_0x2e0f01){return{'name':_0x2e0f01[_0x42b3('0x14')],'type':_0x2e0f01[_0x42b3('0x15')][_0x42b3('0x16')]};});_0x1d2dd0[_0x42b3('0x17')]=_[_0x42b3('0x18')](_0x3234d1,_0x42b3('0x19'));_0x1d2dd0[_0x42b3('0x1a')]=_[_0x42b3('0x1b')](_0x4a150a[_0x42b3('0x1a')]);_0x1d2dd0[_0x42b3('0x1c')]=_[_0x42b3('0x1d')](_0x1d2dd0['model'],_0x1d2dd0['query']);_0x132a61['attributes']=_[_0x42b3('0x1d')](_0x1d2dd0[_0x42b3('0x17')],qs[_0x42b3('0x1e')](_0x4a150a[_0x42b3('0x1a')][_0x42b3('0x1e')]));_0x132a61[_0x42b3('0x1f')]=_0x132a61['attributes'][_0x42b3('0x20')]?_0x132a61[_0x42b3('0x1f')]:_0x1d2dd0[_0x42b3('0x17')];if(!_0x4a150a['query'][_0x42b3('0x21')](_0x42b3('0x22'))){_0x132a61['limit']=qs[_0x42b3('0xa')](_0x4a150a['query'][_0x42b3('0xa')]);_0x132a61['offset']=qs[_0x42b3('0x8')](_0x4a150a[_0x42b3('0x1a')]['offset']);}_0x132a61[_0x42b3('0x23')]=qs[_0x42b3('0x24')](_0x4a150a['query'][_0x42b3('0x24')]);_0x132a61['where']=qs[_0x42b3('0x1c')](_['pick'](_0x4a150a[_0x42b3('0x1a')],_0x1d2dd0[_0x42b3('0x1c')]),_0x3234d1);if(_0x4a150a['query'][_0x42b3('0x25')]){_0x132a61[_0x42b3('0x26')]=_[_0x42b3('0x27')](_0x132a61['where'],{'$or':_[_0x42b3('0x18')](_0x3234d1,function(_0x4b3d23){if(_0x4b3d23[_0x42b3('0x15')]!=='VIRTUAL'){var _0x2f00b1={};_0x2f00b1[_0x4b3d23[_0x42b3('0x19')]]={'$like':'%'+_0x4a150a[_0x42b3('0x1a')][_0x42b3('0x25')]+'%'};return _0x2f00b1;}})});}_0x132a61=_[_0x42b3('0x27')]({},_0x132a61,_0x4a150a[_0x42b3('0x28')]);var _0x1b272e={'where':_0x132a61['where']};return db[_0x42b3('0x12')][_0x42b3('0xb')](_0x1b272e)[_0x42b3('0xd')](function(_0x53e9ac){_0x4ee6d6[_0x42b3('0xb')]=_0x53e9ac;if(_0x4a150a['query'][_0x42b3('0x29')]){_0x132a61['include']=[{'all':!![]}];}return db[_0x42b3('0x12')][_0x42b3('0x2a')](_0x132a61);})[_0x42b3('0xd')](function(_0x44e944){_0x4ee6d6['rows']=_0x44e944;return _0x4ee6d6;})['then'](respondWithFilteredResult(_0x4a77cb,_0x132a61))[_0x42b3('0x2b')](handleError(_0x4a77cb,null));};exports[_0x42b3('0x2c')]=function(_0x5b1ace,_0x24d742){var _0x5dc762={'raw':![],'where':{'id':_0x5b1ace[_0x42b3('0x2d')]['id']}},_0x5b0c4e={};_0x5b0c4e[_0x42b3('0x17')]=_['keys'](db[_0x42b3('0x12')]['rawAttributes']);_0x5b0c4e[_0x42b3('0x1a')]=_[_0x42b3('0x1b')](_0x5b1ace[_0x42b3('0x1a')]);_0x5b0c4e['filters']=_['intersection'](_0x5b0c4e['model'],_0x5b0c4e['query']);_0x5dc762[_0x42b3('0x1f')]=_[_0x42b3('0x1d')](_0x5b0c4e[_0x42b3('0x17')],qs[_0x42b3('0x1e')](_0x5b1ace[_0x42b3('0x1a')][_0x42b3('0x1e')]));_0x5dc762[_0x42b3('0x1f')]=_0x5dc762[_0x42b3('0x1f')][_0x42b3('0x20')]?_0x5dc762[_0x42b3('0x1f')]:_0x5b0c4e[_0x42b3('0x17')];if(_0x5b1ace['query'][_0x42b3('0x29')]){_0x5dc762['include']=[{'all':!![]}];}_0x5dc762=_[_0x42b3('0x27')]({},_0x5dc762,_0x5b1ace[_0x42b3('0x28')]);return db[_0x42b3('0x12')][_0x42b3('0x2e')](_0x5dc762)['then'](handleEntityNotFound(_0x24d742,null))[_0x42b3('0xd')](respondWithResult(_0x24d742,null))[_0x42b3('0x2b')](handleError(_0x24d742,null));};exports[_0x42b3('0x2f')]=function(_0x458de0,_0x26a8a6){return db[_0x42b3('0x12')]['create'](_0x458de0[_0x42b3('0x30')],{})[_0x42b3('0xd')](respondWithResult(_0x26a8a6,0xc9))['catch'](handleError(_0x26a8a6,null));};exports[_0x42b3('0x31')]=function(_0x329957,_0x4fe47b){if(_0x329957[_0x42b3('0x30')]['id']){delete _0x329957[_0x42b3('0x30')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x329957['params']['id']}})[_0x42b3('0xd')](handleEntityNotFound(_0x4fe47b,null))[_0x42b3('0xd')](saveUpdates(_0x329957['body'],null))['then'](respondWithResult(_0x4fe47b,null))[_0x42b3('0x2b')](handleError(_0x4fe47b,null));};exports[_0x42b3('0x32')]=function(_0x311769,_0x52ceaf){return db[_0x42b3('0x12')][_0x42b3('0x2e')]({'where':{'id':_0x311769[_0x42b3('0x2d')]['id']}})['then'](handleEntityNotFound(_0x52ceaf,null))[_0x42b3('0xd')](removeEntity(_0x52ceaf,null))[_0x42b3('0x2b')](handleError(_0x52ceaf,null));};exports[_0x42b3('0x33')]=function(_0x5305d8,_0x5b962c){var _0x207514={};var _0x47c399={};var _0x4bffc5;var _0x42d409;return db[_0x42b3('0x12')]['findOne']({'where':{'id':_0x5305d8[_0x42b3('0x2d')]['id']}})[_0x42b3('0xd')](handleEntityNotFound(_0x5b962c,null))[_0x42b3('0xd')](function(_0x36a962){if(_0x36a962){_0x4bffc5=_0x36a962;_0x47c399['model']=_[_0x42b3('0x1b')](db[_0x42b3('0x34')][_0x42b3('0x13')]);_0x47c399['query']=_['keys'](_0x5305d8[_0x42b3('0x1a')]);_0x47c399[_0x42b3('0x1c')]=_[_0x42b3('0x1d')](_0x47c399[_0x42b3('0x17')],_0x47c399['query']);_0x207514[_0x42b3('0x1f')]=_[_0x42b3('0x1d')](_0x47c399['model'],qs[_0x42b3('0x1e')](_0x5305d8[_0x42b3('0x1a')][_0x42b3('0x1e')]));_0x207514[_0x42b3('0x1f')]=_0x207514[_0x42b3('0x1f')][_0x42b3('0x20')]?_0x207514[_0x42b3('0x1f')]:_0x47c399[_0x42b3('0x17')];_0x207514[_0x42b3('0x23')]=qs[_0x42b3('0x24')](_0x5305d8[_0x42b3('0x1a')][_0x42b3('0x24')]);_0x207514['where']=qs[_0x42b3('0x1c')](_[_0x42b3('0x35')](_0x5305d8['query'],_0x47c399[_0x42b3('0x1c')]));if(_0x5305d8[_0x42b3('0x1a')][_0x42b3('0x25')]){_0x207514[_0x42b3('0x26')]=_[_0x42b3('0x27')](_0x207514[_0x42b3('0x26')],{'$or':_[_0x42b3('0x18')](_0x207514[_0x42b3('0x1f')],function(_0x433428){var _0x538c5f={};_0x538c5f[_0x433428]={'$like':'%'+_0x5305d8[_0x42b3('0x1a')][_0x42b3('0x25')]+'%'};return _0x538c5f;})});}_0x207514=_[_0x42b3('0x27')]({},_0x207514,_0x5305d8[_0x42b3('0x28')]);return _0x4bffc5[_0x42b3('0x33')](_0x207514);}})[_0x42b3('0xd')](function(_0x24bd34){if(_0x24bd34){_0x42d409=_0x24bd34[_0x42b3('0x20')];if(!_0x5305d8['query'][_0x42b3('0x21')](_0x42b3('0x22'))){_0x207514['limit']=qs[_0x42b3('0xa')](_0x5305d8[_0x42b3('0x1a')]['limit']);_0x207514[_0x42b3('0x8')]=qs[_0x42b3('0x8')](_0x5305d8[_0x42b3('0x1a')]['offset']);}return _0x4bffc5[_0x42b3('0x33')](_0x207514);}})[_0x42b3('0xd')](function(_0x520d06){if(_0x520d06){return _0x520d06?{'count':_0x42d409,'rows':_0x520d06}:null;}})[_0x42b3('0xd')](respondWithResult(_0x5b962c,null))[_0x42b3('0x2b')](handleError(_0x5b962c,null));};exports[_0x42b3('0x36')]=function(_0x3f67f4,_0x549b69){if(_0x3f67f4[_0x42b3('0x30')]['id']){delete _0x3f67f4[_0x42b3('0x30')]['id'];}return db[_0x42b3('0x12')]['findOne']({'where':{'id':_0x3f67f4['params']['id']}})[_0x42b3('0xd')](handleEntityNotFound(_0x549b69,null))['then'](function(_0x1db9be){if(_0x1db9be){_0x3f67f4[_0x42b3('0x30')][_0x42b3('0x37')]=_0x1db9be['id'];_0x3f67f4[_0x42b3('0x30')][_0x42b3('0x38')]=integrations[_0x42b3('0x39')](_0x3f67f4[_0x42b3('0x30')][_0x42b3('0x3a')],_0x3f67f4[_0x42b3('0x30')][_0x42b3('0x15')]);_0x3f67f4[_0x42b3('0x30')]['Descriptions']=integrations[_0x42b3('0x3b')](_0x3f67f4[_0x42b3('0x30')]['channel'],_0x3f67f4['body']['type']);return db['Dynamics365Configuration']['create'](_0x3f67f4[_0x42b3('0x30')],{'include':[{'model':db[_0x42b3('0x3c')],'as':'Subjects'},{'model':db[_0x42b3('0x3c')],'as':_0x42b3('0x3d')}]});}return null;})['then'](respondWithResult(_0x549b69,null))[_0x42b3('0x2b')](handleError(_0x549b69,null));};function sanitizeRemoteUri(_0x23a38f){var _0x4dcc55=_0x23a38f[_0x42b3('0x3e')](-0x1);if(_0x4dcc55==='/')return _0x23a38f['substring'](0x0,_0x23a38f[_0x42b3('0x3f')](_0x4dcc55));return _0x23a38f;}function getWebApiUrl(_0x4a251d){return util[_0x42b3('0x40')]('%s/api/data/v9.0/',_0x4a251d);}exports['getFields']=function(_0x352d20,_0x3d5180){var _0x9e6e2=_0x352d20[_0x42b3('0x1a')][_0x42b3('0x41')];var _0x5ede3d=_0x9e6e2===_0x42b3('0x42')?_0x42b3('0x43'):'PhoneCall';var _0x42f9a8='';var _0x97b7f0='';var _0x3af4d1='';var _0x54315a='';var _0x16adab='';var _0x1fe39b='';var _0x24d895='';var _0x2b3012='';var _0x3aede1=[_0x42b3('0x44'),_0x42b3('0x45'),_0x42b3('0x46'),'ownerid',_0x42b3('0x47'),'subject','phonenumber',_0x42b3('0x48'),_0x42b3('0x49'),_0x42b3('0x4a')];var _0x2ea02e=['accountidname','accountidyominame',_0x42b3('0x4b'),_0x42b3('0x4c'),_0x42b3('0x4d'),_0x42b3('0x4e'),'contractdetailidname',_0x42b3('0x4f'),_0x42b3('0x50'),_0x42b3('0x51'),'createdbyname','createdbyyominame',_0x42b3('0x52'),_0x42b3('0x53'),_0x42b3('0x54'),_0x42b3('0x55'),_0x42b3('0x56'),_0x42b3('0x57'),_0x42b3('0x58'),_0x42b3('0x59'),_0x42b3('0x5a'),'entityimage_url','escalatedon',_0x42b3('0x5b'),_0x42b3('0x5c'),_0x42b3('0x5d'),_0x42b3('0x5e'),_0x42b3('0x5f'),_0x42b3('0x60'),'lastonholdtime','masteridname',_0x42b3('0x61'),_0x42b3('0x62'),_0x42b3('0x63'),_0x42b3('0x64'),'modifiedon',_0x42b3('0x65'),'modifiedonbehalfbyyominame',_0x42b3('0x66'),_0x42b3('0x67'),_0x42b3('0x68'),_0x42b3('0x69'),'overriddencreatedon','owneridname',_0x42b3('0x6a'),_0x42b3('0x6b'),_0x42b3('0x6c'),_0x42b3('0x6d'),'primarycontactidyominame','prioritycodename',_0x42b3('0x6e'),_0x42b3('0x6f'),_0x42b3('0x70'),_0x42b3('0x71'),_0x42b3('0x72'),'responsiblecontactidname','responsiblecontactidyominame','sentimentvalue',_0x42b3('0x73'),_0x42b3('0x74'),_0x42b3('0x75'),'statecode',_0x42b3('0x76'),'subjectidname',_0x42b3('0x77'),_0x42b3('0x78'),_0x42b3('0x79'),'traversedpath',_0x42b3('0x7a'),_0x42b3('0x7b')];var _0x2376d5=_0x3aede1['concat'](_0x2ea02e);return db[_0x42b3('0x12')]['findOne']({'where':{'id':_0x352d20[_0x42b3('0x2d')]['id']},'attributes':['id','username',_0x42b3('0x7c'),'remoteUri',_0x42b3('0x7d'),_0x42b3('0x7e'),'clientSecret',_0x42b3('0x7f')],'include':[{'model':db[_0x42b3('0x80')],'as':_0x42b3('0x80'),'attributes':['id','data5','data7']}]})[_0x42b3('0xd')](handleEntityNotFound(_0x3d5180,null))[_0x42b3('0xd')](function(_0x4a7d25){if(_0x4a7d25){if(_0x4a7d25[_0x42b3('0x7f')]){_0x4a7d25[_0x42b3('0x81')]=_0x4a7d25[_0x42b3('0x80')]['data5'];_0x2b3012=sanitizeRemoteUri(_0x4a7d25[_0x42b3('0x80')][_0x42b3('0x82')]);_0x24d895=getWebApiUrl(_0x2b3012);return _0x4a7d25;}_0x2b3012=sanitizeRemoteUri(_0x4a7d25[_0x42b3('0x83')]);_0x24d895=getWebApiUrl(_0x2b3012);var _0x4bbdb0={'method':_0x42b3('0x84'),'uri':'https://login.microsoftonline.com/'+_0x4a7d25['tenantId']+_0x42b3('0x85'),'form':{'client_id':_0x4a7d25[_0x42b3('0x7e')],'resource':_0x2b3012,'username':_0x4a7d25[_0x42b3('0x86')],'password':_0x4a7d25[_0x42b3('0x7c')],'grant_type':_0x42b3('0x7c'),'client_secret':_0x4a7d25[_0x42b3('0x87')]},'json':!![]};return rp(_0x4bbdb0);}})[_0x42b3('0xd')](function(_0x5cbe8a){_0x1fe39b=_0x5cbe8a[_0x42b3('0x81')];var _0x2eae9e={'method':_0x42b3('0x88'),'uri':encodeURI(_0x24d895+_0x42b3('0x89')+_0x5ede3d+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1fe39b,'If-None-Match':null,'OData-Version':_0x42b3('0x8a')},'json':!![]};return rp(_0x2eae9e);})[_0x42b3('0xd')](function(_0x5aed60){var _0x578b2b=_0x5aed60['value'][0x0];var _0x222685=_0x578b2b['MetadataId'];var _0x11c79a={'method':'GET','uri':_0x24d895+_0x42b3('0x8b')+_0x222685+_0x42b3('0x8c'),'headers':{'Authorization':_0x42b3('0x8d')+_0x1fe39b,'If-None-Match':null,'OData-Version':_0x42b3('0x8a')},'json':!![]};return rp(_0x11c79a);})['then'](function(_0x483363){_0x42f9a8=_0x483363;_0x97b7f0=_0x42f9a8[_0x42b3('0x8e')];_0x97b7f0=_['remove'](_0x97b7f0,function(_0x2e466c){return!_0x2376d5[_0x42b3('0x8f')](_0x2e466c[_0x42b3('0x90')]);});var _0x45a97f=[];var _0x25ea13=[];_0x97b7f0['forEach'](function(_0x15d869){if(_0x15d869[_0x42b3('0x91')]){var _0x124ffb=_0x15d869[_0x42b3('0x91')][_0x42b3('0x92')](_0x15d869[_0x42b3('0x91')][_0x42b3('0x3f')]('.')+0x1);if(_0x124ffb===_0x42b3('0x93')){_0x45a97f[_0x42b3('0x94')](getSelectList(_0x24d895,_0x9e6e2,_0x25ea13,_0x42f9a8[_0x42b3('0x95')],_0x15d869[_0x42b3('0x95')],_0x1fe39b));}}});return Promise[_0x42b3('0x96')](_0x45a97f);})[_0x42b3('0xd')](function(_0x3c099a){_0x3af4d1=_0x3c099a[0x0];var _0x5627e0=[];var _0xa8275b=[];_0x97b7f0['forEach'](function(_0x57ffd3){if(!_['isNil'](_0x57ffd3[_0x42b3('0x91')])){var _0x26d6bb=_0x57ffd3[_0x42b3('0x91')][_0x42b3('0x92')](_0x57ffd3[_0x42b3('0x91')][_0x42b3('0x3f')]('.')+0x1);if(_0x26d6bb===_0x42b3('0x97')){_0x5627e0['push'](getBooleanList(_0x24d895,_0x9e6e2,_0xa8275b,_0x42f9a8[_0x42b3('0x95')],_0x57ffd3[_0x42b3('0x95')],_0x1fe39b));}}});return Promise[_0x42b3('0x96')](_0x5627e0);})[_0x42b3('0xd')](function(_0x4cd458){_0x54315a=_0x4cd458[0x0];var _0x55c007=[];var _0x48823b=[];_0x97b7f0[_0x42b3('0x98')](function(_0x9ea632){if(_0x9ea632[_0x42b3('0x91')]){var _0x5bbf8e=_0x9ea632['@odata.type'][_0x42b3('0x92')](_0x9ea632[_0x42b3('0x91')][_0x42b3('0x3f')]('.')+0x1);if(_0x5bbf8e===_0x42b3('0x99')||_0x5bbf8e===_0x42b3('0x9a')||_0x5bbf8e===_0x42b3('0x9b')||_0x5bbf8e===_0x42b3('0x9c')||_0x5bbf8e===_0x42b3('0x9d')||_0x5bbf8e==='DateTimeAttributeMetadata'||_0x5bbf8e==='StatusAttributeMetadata'||_0x5bbf8e===_0x42b3('0x9e')||_0x5bbf8e===_0x42b3('0x9f')||_0x5bbf8e===_0x42b3('0xa0')){_0x55c007[_0x42b3('0x94')](getInputList(_0x24d895,_0x9e6e2,_0x5bbf8e,_0x48823b,_0x42f9a8[_0x42b3('0x95')],_0x9ea632[_0x42b3('0x95')],_0x1fe39b));}}});return Promise[_0x42b3('0x96')](_0x55c007);})['then'](function(_0x2fc1b4){_0x16adab=_0x2fc1b4[0x0];var _0x3209d9=_0x3af4d1[_0x42b3('0xa1')](_0x54315a)[_0x42b3('0xa1')](_0x16adab);var _0x415a61={'count':_0x3209d9[_0x42b3('0x20')],'rows':_0x3209d9};return _0x415a61;})[_0x42b3('0xd')](respondWithResult(_0x3d5180,null))['catch'](function(_0x3ae33c){var _0x54a044=_0x352d20[_0x42b3('0x1a')]['test']?0x1f4:_0x3ae33c[_0x42b3('0xa2')]||0x1f4;logger[_0x42b3('0xe')](_0x3ae33c[_0x42b3('0xf')]);delete _0x3ae33c[_0x42b3('0x19')];if(_0x54a044===0x191){_0x54a044=0x190;}_0x3d5180[_0x42b3('0x6')](_0x54a044)['send'](_0x352d20['query']['test']?{'message':_0x42b3('0xa3'),'statusCode':_0x3ae33c['statusCode']}:_0x3ae33c);});};function getSelectList(_0x2c330d,_0x1e5f25,_0x37aa64,_0x295f67,_0x221c30,_0x435238){var _0x576ee0={'method':_0x42b3('0x88'),'uri':_0x2c330d+_0x42b3('0x8b')+_0x295f67+')/Attributes('+_0x221c30+_0x42b3('0xa4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x435238,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x576ee0)[_0x42b3('0xd')](function(_0x29bd33){var _0x2cdc88=[];var _0x378633=_0x29bd33[_0x42b3('0xa5')][_0x42b3('0xa6')];_0x378633['forEach'](function(_0x5db44a){_0x2cdc88['push']({'name':_0x5db44a['Label'][_0x42b3('0xa7')][_0x42b3('0xa8')],'value':String(_0x5db44a['Value'])});});var _0x271daf={'id':_0x1e5f25+'_'+_0x29bd33[_0x42b3('0x90')],'name':_0x29bd33['DisplayName']['UserLocalizedLabel'][_0x42b3('0xa8')],'custom':![],'options':_0x2cdc88};_0x37aa64[_0x42b3('0x94')](_0x271daf);return _0x37aa64;});}function getBooleanList(_0x4cd89a,_0x43ba04,_0x2da23b,_0x3bfc89,_0x22d07e,_0x2d213a){var _0x3cbde6={'method':_0x42b3('0x88'),'uri':_0x4cd89a+_0x42b3('0x8b')+_0x3bfc89+_0x42b3('0xa9')+_0x22d07e+_0x42b3('0xaa'),'headers':{'Authorization':'Bearer\x20'+_0x2d213a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3cbde6)['then'](function(_0x3bd82a){var _0x3c3716=[];_0x3c3716[_0x42b3('0x94')]({'name':_0x3bd82a[_0x42b3('0xa5')][_0x42b3('0xab')][_0x42b3('0xa8')][_0x42b3('0xa7')][_0x42b3('0xa8')],'value':_0x42b3('0xac')},{'name':_0x3bd82a['OptionSet'][_0x42b3('0xad')][_0x42b3('0xa8')]['UserLocalizedLabel']['Label'],'value':_0x42b3('0xae')});var _0x1b33cf={'id':_0x43ba04+'_'+_0x3bd82a[_0x42b3('0x90')],'name':_0x3bd82a['DisplayName'][_0x42b3('0xa7')]['Label'],'custom':![],'options':_0x3c3716};_0x2da23b['push'](_0x1b33cf);return _0x2da23b;});}function getInputList(_0x5de114,_0x45400f,_0x3c187c,_0x5c7bee,_0x2ab490,_0x4c397c,_0x63a5b7){var _0x567ae6={'method':_0x42b3('0x88'),'uri':_0x5de114+_0x42b3('0x8b')+_0x2ab490+_0x42b3('0xa9')+_0x4c397c+_0x42b3('0xaf')+_0x3c187c+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x63a5b7,'If-None-Match':null,'OData-Version':_0x42b3('0x8a')},'json':!![]};return rp(_0x567ae6)[_0x42b3('0xd')](function(_0x2caccf){var _0x33177b={'id':_0x45400f+'_'+_0x2caccf[_0x42b3('0x90')],'name':_0x2caccf[_0x42b3('0xb0')][_0x42b3('0xa7')]?_0x2caccf[_0x42b3('0xb0')][_0x42b3('0xa7')]['Label']:_0x2caccf['LogicalName'],'custom':![],'options':[]};_0x5c7bee['push'](_0x33177b);return _0x5c7bee;});} \ No newline at end of file +var _0x094f=['substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','actualserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','remoteUri','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','DecimalAttributeMetadata','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','count','offset','limit','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','catch','show','params','keys','filters','create','body','update','find','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice'];(function(_0xc98be6,_0x4befae){var _0x57b80b=function(_0x536ebf){while(--_0x536ebf){_0xc98be6['push'](_0xc98be6['shift']());}};_0x57b80b(++_0x4befae);}(_0x094f,0x80));var _0xf094=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x094f[_0x344a3f];return _0x264712;};'use strict';var rp=require(_0xf094('0x0'));var util=require(_0xf094('0x1'));var _=require(_0xf094('0x2'));var qs=require(_0xf094('0x3'));var logger=require('../../config/logger')(_0xf094('0x4'));var db=require(_0xf094('0x5'))['db'];var integrations=require(_0xf094('0x6'));function respondWithResult(_0x588cc2,_0x4af4d6){_0x4af4d6=_0x4af4d6||0xc8;return function(_0x2896e0){if(_0x2896e0){return _0x588cc2[_0xf094('0x7')](_0x4af4d6)[_0xf094('0x8')](_0x2896e0);}};}function respondWithFilteredResult(_0x1c421e,_0x507b62){return function(_0xa02b58){if(_0xa02b58){var _0xa00294=typeof _0x507b62['offset']==='undefined'&&typeof _0x507b62['limit']==='undefined';var _0x4cc43f=_0xa02b58[_0xf094('0x9')];var _0x172bce=_0xa00294?0x0:_0x507b62[_0xf094('0xa')];var _0x30ceb2=_0xa00294?_0xa02b58[_0xf094('0x9')]:_0x507b62['offset']+_0x507b62[_0xf094('0xb')];var _0x456da2;if(_0x30ceb2>=_0x4cc43f){_0x30ceb2=_0x4cc43f;_0x456da2=0xc8;}else{_0x456da2=0xce;}_0x1c421e['status'](_0x456da2);return _0x1c421e['set']('Content-Range',_0x172bce+'-'+_0x30ceb2+'/'+_0x4cc43f)[_0xf094('0x8')](_0xa02b58);}return null;};}function saveUpdates(_0x4d99bd){return function(_0x583a23){if(_0x583a23){return _0x583a23['update'](_0x4d99bd)[_0xf094('0xc')](function(_0x5997ea){return _0x5997ea;});}return null;};}function removeEntity(_0x4b97cb){return function(_0x32f64d){if(_0x32f64d){return _0x32f64d[_0xf094('0xd')]()[_0xf094('0xc')](function(){_0x4b97cb[_0xf094('0x7')](0xcc)[_0xf094('0xe')]();});}};}function handleEntityNotFound(_0x187460){return function(_0x51f2af){if(!_0x51f2af){_0x187460['sendStatus'](0x194);}return _0x51f2af;};}function handleError(_0xf589f7,_0x2f12d5){_0x2f12d5=_0x2f12d5||0x1f4;return function(_0x446cca){logger[_0xf094('0xf')](_0x446cca[_0xf094('0x10')]);if(_0x446cca[_0xf094('0x11')]){delete _0x446cca['name'];}_0xf589f7[_0xf094('0x7')](_0x2f12d5)[_0xf094('0x12')](_0x446cca);};}exports[_0xf094('0x13')]=function(_0x4db9f3,_0x550b7f){var _0x5ec15d={},_0x5b3b41={},_0x5b73af={'count':0x0,'rows':[]};var _0x182735=_[_0xf094('0x14')](db['Dynamics365Account'][_0xf094('0x15')],function(_0x28088f){return{'name':_0x28088f[_0xf094('0x16')],'type':_0x28088f[_0xf094('0x17')]['key']};});_0x5b3b41[_0xf094('0x18')]=_[_0xf094('0x14')](_0x182735,'name');_0x5b3b41[_0xf094('0x19')]=_['keys'](_0x4db9f3[_0xf094('0x19')]);_0x5b3b41['filters']=_[_0xf094('0x1a')](_0x5b3b41[_0xf094('0x18')],_0x5b3b41[_0xf094('0x19')]);_0x5ec15d[_0xf094('0x1b')]=_[_0xf094('0x1a')](_0x5b3b41[_0xf094('0x18')],qs[_0xf094('0x1c')](_0x4db9f3['query'][_0xf094('0x1c')]));_0x5ec15d[_0xf094('0x1b')]=_0x5ec15d['attributes'][_0xf094('0x1d')]?_0x5ec15d[_0xf094('0x1b')]:_0x5b3b41[_0xf094('0x18')];if(!_0x4db9f3[_0xf094('0x19')][_0xf094('0x1e')]('nolimit')){_0x5ec15d[_0xf094('0xb')]=qs['limit'](_0x4db9f3['query'][_0xf094('0xb')]);_0x5ec15d[_0xf094('0xa')]=qs[_0xf094('0xa')](_0x4db9f3[_0xf094('0x19')]['offset']);}_0x5ec15d['order']=qs[_0xf094('0x1f')](_0x4db9f3[_0xf094('0x19')][_0xf094('0x1f')]);_0x5ec15d[_0xf094('0x20')]=qs['filters'](_[_0xf094('0x21')](_0x4db9f3['query'],_0x5b3b41['filters']),_0x182735);if(_0x4db9f3[_0xf094('0x19')][_0xf094('0x22')]){_0x5ec15d['where']=_[_0xf094('0x23')](_0x5ec15d[_0xf094('0x20')],{'$or':_[_0xf094('0x14')](_0x182735,function(_0x3f157e){if(_0x3f157e[_0xf094('0x17')]!==_0xf094('0x24')){var _0x259321={};_0x259321[_0x3f157e[_0xf094('0x11')]]={'$like':'%'+_0x4db9f3['query'][_0xf094('0x22')]+'%'};return _0x259321;}})});}_0x5ec15d=_[_0xf094('0x23')]({},_0x5ec15d,_0x4db9f3[_0xf094('0x25')]);var _0x472ae9={'where':_0x5ec15d['where']};return db[_0xf094('0x26')]['count'](_0x472ae9)['then'](function(_0x18d42f){_0x5b73af['count']=_0x18d42f;if(_0x4db9f3['query'][_0xf094('0x27')]){_0x5ec15d[_0xf094('0x28')]=[{'all':!![]}];}return db[_0xf094('0x26')][_0xf094('0x29')](_0x5ec15d);})[_0xf094('0xc')](function(_0x3104d3){_0x5b73af[_0xf094('0x2a')]=_0x3104d3;return _0x5b73af;})[_0xf094('0xc')](respondWithFilteredResult(_0x550b7f,_0x5ec15d))[_0xf094('0x2b')](handleError(_0x550b7f,null));};exports[_0xf094('0x2c')]=function(_0x538b01,_0x4b1666){var _0x4061a4={'raw':![],'where':{'id':_0x538b01[_0xf094('0x2d')]['id']}},_0x39a41c={};_0x39a41c[_0xf094('0x18')]=_[_0xf094('0x2e')](db[_0xf094('0x26')][_0xf094('0x15')]);_0x39a41c['query']=_[_0xf094('0x2e')](_0x538b01[_0xf094('0x19')]);_0x39a41c[_0xf094('0x2f')]=_['intersection'](_0x39a41c[_0xf094('0x18')],_0x39a41c['query']);_0x4061a4[_0xf094('0x1b')]=_[_0xf094('0x1a')](_0x39a41c['model'],qs[_0xf094('0x1c')](_0x538b01[_0xf094('0x19')][_0xf094('0x1c')]));_0x4061a4[_0xf094('0x1b')]=_0x4061a4[_0xf094('0x1b')][_0xf094('0x1d')]?_0x4061a4[_0xf094('0x1b')]:_0x39a41c[_0xf094('0x18')];if(_0x538b01[_0xf094('0x19')]['includeAll']){_0x4061a4['include']=[{'all':!![]}];}_0x4061a4=_[_0xf094('0x23')]({},_0x4061a4,_0x538b01[_0xf094('0x25')]);return db['Dynamics365Account']['find'](_0x4061a4)[_0xf094('0xc')](handleEntityNotFound(_0x4b1666,null))[_0xf094('0xc')](respondWithResult(_0x4b1666,null))[_0xf094('0x2b')](handleError(_0x4b1666,null));};exports['create']=function(_0x262c1e,_0x1f4908){return db['Dynamics365Account'][_0xf094('0x30')](_0x262c1e[_0xf094('0x31')],{})[_0xf094('0xc')](respondWithResult(_0x1f4908,0xc9))[_0xf094('0x2b')](handleError(_0x1f4908,null));};exports[_0xf094('0x32')]=function(_0x2b052f,_0x5869f7){if(_0x2b052f['body']['id']){delete _0x2b052f[_0xf094('0x31')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x2b052f[_0xf094('0x2d')]['id']}})[_0xf094('0xc')](handleEntityNotFound(_0x5869f7,null))[_0xf094('0xc')](saveUpdates(_0x2b052f['body'],null))['then'](respondWithResult(_0x5869f7,null))[_0xf094('0x2b')](handleError(_0x5869f7,null));};exports[_0xf094('0xd')]=function(_0x3316ff,_0x449073){return db[_0xf094('0x26')][_0xf094('0x33')]({'where':{'id':_0x3316ff[_0xf094('0x2d')]['id']}})['then'](handleEntityNotFound(_0x449073,null))[_0xf094('0xc')](removeEntity(_0x449073,null))['catch'](handleError(_0x449073,null));};exports['getConfigurations']=function(_0x4d7e3e,_0x1990e3){var _0x2277b1={};var _0x2c7589={};var _0x295589;var _0x2fe7ce;return db[_0xf094('0x26')][_0xf094('0x34')]({'where':{'id':_0x4d7e3e['params']['id']}})[_0xf094('0xc')](handleEntityNotFound(_0x1990e3,null))[_0xf094('0xc')](function(_0x32370a){if(_0x32370a){_0x295589=_0x32370a;_0x2c7589['model']=_['keys'](db[_0xf094('0x35')]['rawAttributes']);_0x2c7589[_0xf094('0x19')]=_[_0xf094('0x2e')](_0x4d7e3e[_0xf094('0x19')]);_0x2c7589[_0xf094('0x2f')]=_[_0xf094('0x1a')](_0x2c7589[_0xf094('0x18')],_0x2c7589[_0xf094('0x19')]);_0x2277b1['attributes']=_[_0xf094('0x1a')](_0x2c7589['model'],qs[_0xf094('0x1c')](_0x4d7e3e['query'][_0xf094('0x1c')]));_0x2277b1[_0xf094('0x1b')]=_0x2277b1[_0xf094('0x1b')][_0xf094('0x1d')]?_0x2277b1[_0xf094('0x1b')]:_0x2c7589[_0xf094('0x18')];_0x2277b1['order']=qs[_0xf094('0x1f')](_0x4d7e3e[_0xf094('0x19')]['sort']);_0x2277b1[_0xf094('0x20')]=qs[_0xf094('0x2f')](_[_0xf094('0x21')](_0x4d7e3e[_0xf094('0x19')],_0x2c7589[_0xf094('0x2f')]));if(_0x4d7e3e[_0xf094('0x19')]['filter']){_0x2277b1[_0xf094('0x20')]=_[_0xf094('0x23')](_0x2277b1['where'],{'$or':_[_0xf094('0x14')](_0x2277b1[_0xf094('0x1b')],function(_0x5d4df0){var _0x177252={};_0x177252[_0x5d4df0]={'$like':'%'+_0x4d7e3e[_0xf094('0x19')][_0xf094('0x22')]+'%'};return _0x177252;})});}_0x2277b1=_[_0xf094('0x23')]({},_0x2277b1,_0x4d7e3e['options']);return _0x295589[_0xf094('0x36')](_0x2277b1);}})['then'](function(_0x42dc9e){if(_0x42dc9e){_0x2fe7ce=_0x42dc9e[_0xf094('0x1d')];if(!_0x4d7e3e['query'][_0xf094('0x1e')]('nolimit')){_0x2277b1[_0xf094('0xb')]=qs[_0xf094('0xb')](_0x4d7e3e['query'][_0xf094('0xb')]);_0x2277b1[_0xf094('0xa')]=qs[_0xf094('0xa')](_0x4d7e3e[_0xf094('0x19')][_0xf094('0xa')]);}return _0x295589[_0xf094('0x36')](_0x2277b1);}})[_0xf094('0xc')](function(_0x33faaa){if(_0x33faaa){return _0x33faaa?{'count':_0x2fe7ce,'rows':_0x33faaa}:null;}})[_0xf094('0xc')](respondWithResult(_0x1990e3,null))[_0xf094('0x2b')](handleError(_0x1990e3,null));};exports[_0xf094('0x37')]=function(_0x54c62b,_0x19a8ac){if(_0x54c62b['body']['id']){delete _0x54c62b[_0xf094('0x31')]['id'];}return db[_0xf094('0x26')][_0xf094('0x34')]({'where':{'id':_0x54c62b['params']['id']}})[_0xf094('0xc')](handleEntityNotFound(_0x19a8ac,null))[_0xf094('0xc')](function(_0x3438f1){if(_0x3438f1){_0x54c62b[_0xf094('0x31')][_0xf094('0x38')]=_0x3438f1['id'];_0x54c62b[_0xf094('0x31')][_0xf094('0x39')]=integrations[_0xf094('0x3a')](_0x54c62b['body'][_0xf094('0x3b')],_0x54c62b['body'][_0xf094('0x17')]);_0x54c62b[_0xf094('0x31')][_0xf094('0x3c')]=integrations[_0xf094('0x3d')](_0x54c62b[_0xf094('0x31')][_0xf094('0x3b')],_0x54c62b[_0xf094('0x31')][_0xf094('0x17')]);return db[_0xf094('0x35')][_0xf094('0x30')](_0x54c62b[_0xf094('0x31')],{'include':[{'model':db['Dynamics365Field'],'as':_0xf094('0x39')},{'model':db[_0xf094('0x3e')],'as':_0xf094('0x3c')}]});}return null;})[_0xf094('0xc')](respondWithResult(_0x19a8ac,null))[_0xf094('0x2b')](handleError(_0x19a8ac,null));};function sanitizeRemoteUri(_0x3964bb){var _0x5b93ae=_0x3964bb[_0xf094('0x3f')](-0x1);if(_0x5b93ae==='/')return _0x3964bb[_0xf094('0x40')](0x0,_0x3964bb[_0xf094('0x41')](_0x5b93ae));return _0x3964bb;}function getWebApiUrl(_0x91619d){return util[_0xf094('0x42')]('%s/api/data/v9.0/',_0x91619d);}exports[_0xf094('0x43')]=function(_0x388cb8,_0x5d3474){var _0x447b3c=_0x388cb8[_0xf094('0x19')][_0xf094('0x44')];var _0x3867a6=_0x447b3c===_0xf094('0x45')?_0xf094('0x46'):_0xf094('0x47');var _0x48f335='';var _0x63b645='';var _0x3f195d='';var _0x525b16='';var _0x2670a5='';var _0x2f84ae='';var _0x570cc0='';var _0x3ace28='';var _0xd5c336=['title',_0xf094('0x48'),_0xf094('0x49'),'ownerid',_0xf094('0x4a'),_0xf094('0x4b'),_0xf094('0x4c'),_0xf094('0x4d'),_0xf094('0x4e'),_0xf094('0x4f')];var _0x38333e=['accountidname','accountidyominame',_0xf094('0x50'),'billedserviceunits',_0xf094('0x51'),'contactidyominame',_0xf094('0x52'),'contractidname',_0xf094('0x53'),'createdbyexternalpartyyominame',_0xf094('0x54'),_0xf094('0x55'),_0xf094('0x56'),_0xf094('0x57'),_0xf094('0x58'),_0xf094('0x59'),_0xf094('0x5a'),_0xf094('0x5b'),_0xf094('0x5c'),_0xf094('0x5d'),'entityimage_timestamp','entityimage_url',_0xf094('0x5e'),_0xf094('0x5f'),_0xf094('0x60'),_0xf094('0x61'),_0xf094('0x62'),_0xf094('0x63'),_0xf094('0x64'),_0xf094('0x65'),_0xf094('0x66'),_0xf094('0x67'),'modifiedbyexternalpartyyominame',_0xf094('0x68'),_0xf094('0x69'),_0xf094('0x6a'),_0xf094('0x6b'),'modifiedonbehalfbyyominame',_0xf094('0x6c'),_0xf094('0x6d'),_0xf094('0x6e'),_0xf094('0x6f'),_0xf094('0x70'),_0xf094('0x71'),_0xf094('0x72'),_0xf094('0x73'),_0xf094('0x74'),_0xf094('0x75'),_0xf094('0x76'),_0xf094('0x77'),_0xf094('0x78'),_0xf094('0x79'),_0xf094('0x7a'),_0xf094('0x7b'),_0xf094('0x7c'),_0xf094('0x7d'),_0xf094('0x7e'),_0xf094('0x7f'),_0xf094('0x80'),_0xf094('0x81'),_0xf094('0x82'),_0xf094('0x83'),_0xf094('0x84'),_0xf094('0x85'),_0xf094('0x86'),_0xf094('0x87'),'transactioncurrencyidname',_0xf094('0x88'),'utcconversiontimezonecode',_0xf094('0x89')];var _0x1d34af=_0xd5c336[_0xf094('0x8a')](_0x38333e);return db['Dynamics365Account'][_0xf094('0x34')]({'where':{'id':_0x388cb8[_0xf094('0x2d')]['id']},'attributes':['id',_0xf094('0x8b'),_0xf094('0x8c'),'remoteUri',_0xf094('0x8d'),_0xf094('0x8e'),_0xf094('0x8f'),_0xf094('0x90')],'include':[{'model':db[_0xf094('0x91')],'as':_0xf094('0x91'),'attributes':['id',_0xf094('0x92'),'data7']}]})['then'](handleEntityNotFound(_0x5d3474,null))[_0xf094('0xc')](function(_0x49e42a){if(_0x49e42a){if(_0x49e42a[_0xf094('0x90')]){_0x49e42a[_0xf094('0x93')]=_0x49e42a['CloudProvider'][_0xf094('0x92')];_0x3ace28=sanitizeRemoteUri(_0x49e42a[_0xf094('0x91')][_0xf094('0x94')]);_0x570cc0=getWebApiUrl(_0x3ace28);return _0x49e42a;}_0x3ace28=sanitizeRemoteUri(_0x49e42a[_0xf094('0x95')]);_0x570cc0=getWebApiUrl(_0x3ace28);var _0x16e602={'method':_0xf094('0x96'),'uri':'https://login.microsoftonline.com/'+_0x49e42a[_0xf094('0x8d')]+_0xf094('0x97'),'form':{'client_id':_0x49e42a[_0xf094('0x8e')],'resource':_0x3ace28,'username':_0x49e42a['username'],'password':_0x49e42a[_0xf094('0x8c')],'grant_type':_0xf094('0x8c'),'client_secret':_0x49e42a[_0xf094('0x8f')]},'json':!![]};return rp(_0x16e602);}})['then'](function(_0x2085eb){_0x2f84ae=_0x2085eb[_0xf094('0x93')];var _0x34c7db={'method':_0xf094('0x98'),'uri':encodeURI(_0x570cc0+_0xf094('0x99')+_0x3867a6+'\x27'),'headers':{'Authorization':_0xf094('0x9a')+_0x2f84ae,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x34c7db);})[_0xf094('0xc')](function(_0x491050){var _0x1d943b=_0x491050[_0xf094('0x9b')][0x0];var _0x3f8546=_0x1d943b[_0xf094('0x9c')];var _0x21996a={'method':'GET','uri':_0x570cc0+'EntityDefinitions('+_0x3f8546+_0xf094('0x9d'),'headers':{'Authorization':_0xf094('0x9a')+_0x2f84ae,'If-None-Match':null,'OData-Version':_0xf094('0x9e')},'json':!![]};return rp(_0x21996a);})[_0xf094('0xc')](function(_0x30eec0){_0x48f335=_0x30eec0;_0x63b645=_0x48f335[_0xf094('0x9f')];_0x63b645=_['remove'](_0x63b645,function(_0x1e7cfb){return!_0x1d34af['includes'](_0x1e7cfb[_0xf094('0xa0')]);});var _0x17dddd=[];var _0x6475f6=[];_0x63b645[_0xf094('0xa1')](function(_0x2f7665){if(_0x2f7665[_0xf094('0xa2')]){var _0x49ffce=_0x2f7665[_0xf094('0xa2')][_0xf094('0x40')](_0x2f7665['@odata.type'][_0xf094('0x41')]('.')+0x1);if(_0x49ffce===_0xf094('0xa3')){_0x17dddd['push'](getSelectList(_0x570cc0,_0x447b3c,_0x6475f6,_0x48f335[_0xf094('0x9c')],_0x2f7665[_0xf094('0x9c')],_0x2f84ae));}}});return Promise[_0xf094('0xa4')](_0x17dddd);})[_0xf094('0xc')](function(_0x1f83bb){_0x3f195d=_0x1f83bb[0x0];var _0x396c44=[];var _0x39a2de=[];_0x63b645[_0xf094('0xa1')](function(_0x5c8081){if(!_[_0xf094('0xa5')](_0x5c8081[_0xf094('0xa2')])){var _0x27f7d9=_0x5c8081[_0xf094('0xa2')]['substring'](_0x5c8081[_0xf094('0xa2')][_0xf094('0x41')]('.')+0x1);if(_0x27f7d9===_0xf094('0xa6')){_0x396c44[_0xf094('0xa7')](getBooleanList(_0x570cc0,_0x447b3c,_0x39a2de,_0x48f335['MetadataId'],_0x5c8081[_0xf094('0x9c')],_0x2f84ae));}}});return Promise[_0xf094('0xa4')](_0x396c44);})['then'](function(_0x19a0d6){_0x525b16=_0x19a0d6[0x0];var _0x390f20=[];var _0x1f14e3=[];_0x63b645['forEach'](function(_0xfa5188){if(_0xfa5188[_0xf094('0xa2')]){var _0x5eac45=_0xfa5188[_0xf094('0xa2')][_0xf094('0x40')](_0xfa5188[_0xf094('0xa2')][_0xf094('0x41')]('.')+0x1);if(_0x5eac45===_0xf094('0xa8')||_0x5eac45===_0xf094('0xa9')||_0x5eac45===_0xf094('0xaa')||_0x5eac45===_0xf094('0xab')||_0x5eac45===_0xf094('0xac')||_0x5eac45===_0xf094('0xad')||_0x5eac45==='StatusAttributeMetadata'||_0x5eac45==='EntityNameAttributeMetadata'||_0x5eac45==='StateAttributeMetadata'||_0x5eac45===_0xf094('0xae')){_0x390f20[_0xf094('0xa7')](getInputList(_0x570cc0,_0x447b3c,_0x5eac45,_0x1f14e3,_0x48f335[_0xf094('0x9c')],_0xfa5188['MetadataId'],_0x2f84ae));}}});return Promise[_0xf094('0xa4')](_0x390f20);})['then'](function(_0x232323){_0x2670a5=_0x232323[0x0];var _0x5cb82f=_0x3f195d[_0xf094('0x8a')](_0x525b16)[_0xf094('0x8a')](_0x2670a5);var _0x3124c3={'count':_0x5cb82f[_0xf094('0x1d')],'rows':_0x5cb82f};return _0x3124c3;})['then'](respondWithResult(_0x5d3474,null))[_0xf094('0x2b')](function(_0x1124cb){var _0x10efd0=_0x388cb8[_0xf094('0x19')][_0xf094('0xaf')]?0x1f4:_0x1124cb[_0xf094('0xb0')]||0x1f4;logger[_0xf094('0xf')](_0x1124cb[_0xf094('0x10')]);delete _0x1124cb['name'];if(_0x10efd0===0x191){_0x10efd0=0x190;}_0x5d3474[_0xf094('0x7')](_0x10efd0)[_0xf094('0x12')](_0x388cb8[_0xf094('0x19')][_0xf094('0xaf')]?{'message':'Wrong\x20credentials','statusCode':_0x1124cb[_0xf094('0xb0')]}:_0x1124cb);});};function getSelectList(_0x3bf949,_0x2cbe80,_0xcf3da4,_0x3ac5d7,_0x5abd75,_0x2bdd63){var _0x500268={'method':_0xf094('0x98'),'uri':_0x3bf949+_0xf094('0xb1')+_0x3ac5d7+_0xf094('0xb2')+_0x5abd75+_0xf094('0xb3')+_0xf094('0xb4'),'headers':{'Authorization':_0xf094('0x9a')+_0x2bdd63,'If-None-Match':null,'OData-Version':_0xf094('0x9e')},'json':!![]};return rp(_0x500268)[_0xf094('0xc')](function(_0x5d7819){var _0x354192=[];var _0x5dfece=_0x5d7819[_0xf094('0xb5')][_0xf094('0xb6')];_0x5dfece[_0xf094('0xa1')](function(_0x4a9555){_0x354192['push']({'name':_0x4a9555[_0xf094('0xb7')]['UserLocalizedLabel']['Label'],'value':String(_0x4a9555[_0xf094('0xb8')])});});var _0x346008={'id':_0x2cbe80+'_'+_0x5d7819[_0xf094('0xa0')],'name':_0x5d7819[_0xf094('0xb9')][_0xf094('0xba')]['Label'],'custom':![],'options':_0x354192};_0xcf3da4[_0xf094('0xa7')](_0x346008);return _0xcf3da4;});}function getBooleanList(_0x2fc431,_0x1a086e,_0x56abb9,_0x36b3fe,_0x267034,_0x40e1e6){var _0x37d557={'method':_0xf094('0x98'),'uri':_0x2fc431+'EntityDefinitions('+_0x36b3fe+_0xf094('0xb2')+_0x267034+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xf094('0x9a')+_0x40e1e6,'If-None-Match':null,'OData-Version':_0xf094('0x9e')},'json':!![]};return rp(_0x37d557)[_0xf094('0xc')](function(_0x1297f7){var _0x569dfc=[];_0x569dfc[_0xf094('0xa7')]({'name':_0x1297f7[_0xf094('0xb5')]['TrueOption'][_0xf094('0xb7')]['UserLocalizedLabel'][_0xf094('0xb7')],'value':_0xf094('0xbb')},{'name':_0x1297f7[_0xf094('0xb5')][_0xf094('0xbc')][_0xf094('0xb7')]['UserLocalizedLabel'][_0xf094('0xb7')],'value':_0xf094('0xbd')});var _0x166779={'id':_0x1a086e+'_'+_0x1297f7[_0xf094('0xa0')],'name':_0x1297f7[_0xf094('0xb9')][_0xf094('0xba')][_0xf094('0xb7')],'custom':![],'options':_0x569dfc};_0x56abb9['push'](_0x166779);return _0x56abb9;});}function getInputList(_0x59cfc3,_0x50b522,_0x54aeb9,_0x55ad2b,_0x193d2d,_0x3f86f1,_0x5ac9dc){var _0x5542ec={'method':_0xf094('0x98'),'uri':_0x59cfc3+_0xf094('0xb1')+_0x193d2d+_0xf094('0xb2')+_0x3f86f1+_0xf094('0xbe')+_0x54aeb9+_0xf094('0xbf'),'headers':{'Authorization':_0xf094('0x9a')+_0x5ac9dc,'If-None-Match':null,'OData-Version':_0xf094('0x9e')},'json':!![]};return rp(_0x5542ec)[_0xf094('0xc')](function(_0x495e94){var _0x5f2a1e={'id':_0x50b522+'_'+_0x495e94[_0xf094('0xa0')],'name':_0x495e94[_0xf094('0xb9')][_0xf094('0xba')]?_0x495e94['DisplayName'][_0xf094('0xba')]['Label']:_0x495e94[_0xf094('0xa0')],'custom':![],'options':[]};_0x55ad2b['push'](_0x5f2a1e);return _0x55ad2b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5df1246..cb7513d 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x2277f2,_0x2c2c92){var _0x141eaa=function(_0xdb8f51){while(--_0xdb8f51){_0x2277f2['push'](_0x2277f2['shift']());}};_0x141eaa(++_0x2c2c92);}(_0x757a,0xde));var _0xa757=function(_0x2e2545,_0x53087a){_0x2e2545=_0x2e2545-0x0;var _0xa87c8b=_0x757a[_0x2e2545];return _0xa87c8b;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x374a0e,_0x313fc8){var _0x192043=function(_0x1321da){while(--_0x1321da){_0x374a0e['push'](_0x374a0e['shift']());}};_0x192043(++_0x313fc8);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xb7e7[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 3c79ced..1547cff 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 _0xc648=['findAll','options','raw','where','limit','map','include','attributes','model','ShowDynamics365Account','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','info','result','catch','GetDynamics365Account','Dynamics365Account'];(function(_0x39b2c3,_0x85dc28){var _0x2e08a3=function(_0x40a064){while(--_0x40a064){_0x39b2c3['push'](_0x39b2c3['shift']());}};_0x2e08a3(++_0x85dc28);}(_0xc648,0x172));var _0x8c64=function(_0x21b3fe,_0x345865){_0x21b3fe=_0x21b3fe-0x0;var _0x5764e0=_0xc648[_0x21b3fe];return _0x5764e0;};'use strict';var _=require(_0x8c64('0x0'));var util=require(_0x8c64('0x1'));var moment=require(_0x8c64('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c64('0x3'));var fs=require('fs');var Redis=require(_0x8c64('0x4'));var db=require(_0x8c64('0x5'))['db'];var utils=require(_0x8c64('0x6'));var logger=require(_0x8c64('0x7'))(_0x8c64('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c64('0x9'));var client=jayson['client'][_0x8c64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x847478,_0x5de7a4,_0x14980b){return new BPromise(function(_0x3b2d5c,_0x423d04){return client[_0x8c64('0xb')](_0x847478,_0x14980b)[_0x8c64('0xc')](function(_0x48d0a2){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5de7a4,'request\x20sent');logger[_0x8c64('0xd')](_0x8c64('0xe'),_0x5de7a4,_0x8c64('0xf'),JSON[_0x8c64('0x10')](_0x48d0a2));if(_0x48d0a2[_0x8c64('0x11')]){if(_0x48d0a2[_0x8c64('0x11')][_0x8c64('0x12')]===0x1f4){logger[_0x8c64('0x11')](_0x8c64('0x13'),_0x5de7a4,_0x48d0a2[_0x8c64('0x11')][_0x8c64('0x14')]);return _0x423d04(_0x48d0a2[_0x8c64('0x11')][_0x8c64('0x14')]);}logger[_0x8c64('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5de7a4,_0x48d0a2[_0x8c64('0x11')][_0x8c64('0x14')]);return _0x3b2d5c(_0x48d0a2[_0x8c64('0x11')][_0x8c64('0x14')]);}else{logger[_0x8c64('0x15')](_0x8c64('0x13'),_0x5de7a4,_0x8c64('0xf'));_0x3b2d5c(_0x48d0a2[_0x8c64('0x16')][_0x8c64('0x14')]);}})[_0x8c64('0x17')](function(_0x443a15){logger['error'](_0x8c64('0x13'),_0x5de7a4,_0x443a15);_0x423d04(_0x443a15);});});}exports[_0x8c64('0x18')]=function(_0x387cec){var _0xeb390a=this;return new Promise(function(_0x1deca4,_0x2002a0){return db[_0x8c64('0x19')][_0x8c64('0x1a')]({'raw':_0x387cec[_0x8c64('0x1b')]?_0x387cec['options'][_0x8c64('0x1c')]===undefined?!![]:![]:!![],'where':_0x387cec['options']?_0x387cec[_0x8c64('0x1b')][_0x8c64('0x1d')]||null:null,'attributes':_0x387cec['options']?_0x387cec[_0x8c64('0x1b')]['attributes']||null:null,'limit':_0x387cec[_0x8c64('0x1b')]?_0x387cec[_0x8c64('0x1b')][_0x8c64('0x1e')]||null:null,'include':_0x387cec[_0x8c64('0x1b')]?_0x387cec[_0x8c64('0x1b')]['include']?_[_0x8c64('0x1f')](_0x387cec[_0x8c64('0x1b')][_0x8c64('0x20')],function(_0x8eb4a){return{'model':db[_0x8eb4a['model']],'as':_0x8eb4a['as'],'attributes':_0x8eb4a[_0x8c64('0x21')],'include':_0x8eb4a[_0x8c64('0x20')]?_[_0x8c64('0x1f')](_0x8eb4a[_0x8c64('0x20')],function(_0x310b69){return{'model':db[_0x310b69[_0x8c64('0x22')]],'as':_0x310b69['as'],'attributes':_0x310b69['attributes'],'include':_0x310b69['include']?_[_0x8c64('0x1f')](_0x310b69[_0x8c64('0x20')],function(_0x43a419){return{'model':db[_0x43a419[_0x8c64('0x22')]],'as':_0x43a419['as'],'attributes':_0x43a419[_0x8c64('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8c64('0xc')](function(_0x5d331c){logger[_0x8c64('0x15')]('GetDynamics365Account',_0x387cec);logger[_0x8c64('0xd')](_0x8c64('0x18'),_0x387cec,JSON[_0x8c64('0x10')](_0x5d331c));_0x1deca4(_0x5d331c);})[_0x8c64('0x17')](function(_0x53bc96){logger[_0x8c64('0x11')](_0x8c64('0x18'),_0x53bc96[_0x8c64('0x14')],_0x387cec);_0x2002a0(_0xeb390a[_0x8c64('0x11')](0x1f4,_0x53bc96[_0x8c64('0x14')]));});});};exports[_0x8c64('0x23')]=function(_0x3b1fc0){var _0x56d432=this;return new Promise(function(_0x1b6a82,_0x3b6907){return db[_0x8c64('0x19')]['find']({'raw':_0x3b1fc0['options']?_0x3b1fc0[_0x8c64('0x1b')][_0x8c64('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b1fc0[_0x8c64('0x1b')]?_0x3b1fc0[_0x8c64('0x1b')][_0x8c64('0x1d')]||null:null,'attributes':_0x3b1fc0[_0x8c64('0x1b')]?_0x3b1fc0['options'][_0x8c64('0x21')]||null:null,'include':_0x3b1fc0['options']?_0x3b1fc0['options']['include']?_['map'](_0x3b1fc0[_0x8c64('0x1b')][_0x8c64('0x20')],function(_0x5f4a90){return{'model':db[_0x5f4a90['model']],'as':_0x5f4a90['as'],'attributes':_0x5f4a90['attributes'],'include':_0x5f4a90[_0x8c64('0x20')]?_[_0x8c64('0x1f')](_0x5f4a90[_0x8c64('0x20')],function(_0x12e98c){return{'model':db[_0x12e98c[_0x8c64('0x22')]],'as':_0x12e98c['as'],'attributes':_0x12e98c[_0x8c64('0x21')],'include':_0x12e98c['include']?_[_0x8c64('0x1f')](_0x12e98c[_0x8c64('0x20')],function(_0x496205){return{'model':db[_0x496205[_0x8c64('0x22')]],'as':_0x496205['as'],'attributes':_0x496205[_0x8c64('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8c64('0xc')](function(_0x183252){logger[_0x8c64('0x15')]('ShowDynamics365Account',_0x3b1fc0);logger[_0x8c64('0xd')](_0x8c64('0x23'),_0x3b1fc0,JSON['stringify'](_0x183252));_0x1b6a82(_0x183252);})[_0x8c64('0x17')](function(_0x195b2c){logger[_0x8c64('0x11')]('ShowDynamics365Account',_0x195b2c[_0x8c64('0x14')],_0x3b1fc0);_0x3b6907(_0x56d432[_0x8c64('0x11')](0x1f4,_0x195b2c[_0x8c64('0x14')]));});});}; \ No newline at end of file +var _0x5e35=['model','GetDynamics365Account','ShowDynamics365Account','find','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','Dynamics365Account','options','raw','attributes','include','map'];(function(_0x3fb2b6,_0x505be5){var _0x420547=function(_0x30d1d5){while(--_0x30d1d5){_0x3fb2b6['push'](_0x3fb2b6['shift']());}};_0x420547(++_0x505be5);}(_0x5e35,0x198));var _0x55e3=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x5e35[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x55e3('0x0'));var util=require(_0x55e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x55e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55e3('0x3'))['db'];var utils=require(_0x55e3('0x4'));var logger=require(_0x55e3('0x5'))(_0x55e3('0x6'));var config=require(_0x55e3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x55e3('0x8')][_0x55e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3304b0,_0x362366,_0x3bf238){return new BPromise(function(_0x10ba78,_0x5ef486){return client[_0x55e3('0xa')](_0x3304b0,_0x3bf238)[_0x55e3('0xb')](function(_0x474b47){logger['info'](_0x55e3('0xc'),_0x362366,_0x55e3('0xd'));logger[_0x55e3('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x362366,_0x55e3('0xd'),JSON['stringify'](_0x474b47));if(_0x474b47[_0x55e3('0xf')]){if(_0x474b47['error']['code']===0x1f4){logger['error'](_0x55e3('0xc'),_0x362366,_0x474b47[_0x55e3('0xf')][_0x55e3('0x10')]);return _0x5ef486(_0x474b47[_0x55e3('0xf')]['message']);}logger[_0x55e3('0xf')](_0x55e3('0xc'),_0x362366,_0x474b47[_0x55e3('0xf')]['message']);return _0x10ba78(_0x474b47['error'][_0x55e3('0x10')]);}else{logger[_0x55e3('0x11')](_0x55e3('0xc'),_0x362366,'request\x20sent');_0x10ba78(_0x474b47[_0x55e3('0x12')][_0x55e3('0x10')]);}})[_0x55e3('0x13')](function(_0x57985f){logger[_0x55e3('0xf')](_0x55e3('0xc'),_0x362366,_0x57985f);_0x5ef486(_0x57985f);});});}exports['GetDynamics365Account']=function(_0x463096){var _0x359b6b=this;return new Promise(function(_0xc5427d,_0x2a18f8){return db[_0x55e3('0x14')]['findAll']({'raw':_0x463096[_0x55e3('0x15')]?_0x463096[_0x55e3('0x15')][_0x55e3('0x16')]===undefined?!![]:![]:!![],'where':_0x463096[_0x55e3('0x15')]?_0x463096[_0x55e3('0x15')]['where']||null:null,'attributes':_0x463096['options']?_0x463096[_0x55e3('0x15')][_0x55e3('0x17')]||null:null,'limit':_0x463096['options']?_0x463096[_0x55e3('0x15')]['limit']||null:null,'include':_0x463096['options']?_0x463096[_0x55e3('0x15')][_0x55e3('0x18')]?_[_0x55e3('0x19')](_0x463096[_0x55e3('0x15')]['include'],function(_0xfa4df7){return{'model':db[_0xfa4df7['model']],'as':_0xfa4df7['as'],'attributes':_0xfa4df7[_0x55e3('0x17')],'include':_0xfa4df7[_0x55e3('0x18')]?_[_0x55e3('0x19')](_0xfa4df7[_0x55e3('0x18')],function(_0x2b9281){return{'model':db[_0x2b9281['model']],'as':_0x2b9281['as'],'attributes':_0x2b9281[_0x55e3('0x17')],'include':_0x2b9281[_0x55e3('0x18')]?_[_0x55e3('0x19')](_0x2b9281['include'],function(_0xed218f){return{'model':db[_0xed218f[_0x55e3('0x1a')]],'as':_0xed218f['as'],'attributes':_0xed218f[_0x55e3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x55e3('0xb')](function(_0x1c92fa){logger[_0x55e3('0x11')](_0x55e3('0x1b'),_0x463096);logger['debug']('GetDynamics365Account',_0x463096,JSON['stringify'](_0x1c92fa));_0xc5427d(_0x1c92fa);})['catch'](function(_0x1b918e){logger[_0x55e3('0xf')](_0x55e3('0x1b'),_0x1b918e[_0x55e3('0x10')],_0x463096);_0x2a18f8(_0x359b6b[_0x55e3('0xf')](0x1f4,_0x1b918e[_0x55e3('0x10')]));});});};exports[_0x55e3('0x1c')]=function(_0x483b45){var _0x521364=this;return new Promise(function(_0x33c882,_0x530812){return db['Dynamics365Account'][_0x55e3('0x1d')]({'raw':_0x483b45[_0x55e3('0x15')]?_0x483b45[_0x55e3('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x483b45[_0x55e3('0x15')]?_0x483b45['options']['where']||null:null,'attributes':_0x483b45['options']?_0x483b45[_0x55e3('0x15')][_0x55e3('0x17')]||null:null,'include':_0x483b45[_0x55e3('0x15')]?_0x483b45[_0x55e3('0x15')][_0x55e3('0x18')]?_[_0x55e3('0x19')](_0x483b45['options'][_0x55e3('0x18')],function(_0x91d37d){return{'model':db[_0x91d37d[_0x55e3('0x1a')]],'as':_0x91d37d['as'],'attributes':_0x91d37d[_0x55e3('0x17')],'include':_0x91d37d[_0x55e3('0x18')]?_[_0x55e3('0x19')](_0x91d37d[_0x55e3('0x18')],function(_0x5760e5){return{'model':db[_0x5760e5[_0x55e3('0x1a')]],'as':_0x5760e5['as'],'attributes':_0x5760e5[_0x55e3('0x17')],'include':_0x5760e5[_0x55e3('0x18')]?_['map'](_0x5760e5['include'],function(_0x4fd922){return{'model':db[_0x4fd922[_0x55e3('0x1a')]],'as':_0x4fd922['as'],'attributes':_0x4fd922[_0x55e3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x55e3('0xb')](function(_0xffee27){logger[_0x55e3('0x11')](_0x55e3('0x1c'),_0x483b45);logger['debug']('ShowDynamics365Account',_0x483b45,JSON[_0x55e3('0x1e')](_0xffee27));_0x33c882(_0xffee27);})[_0x55e3('0x13')](function(_0x53f60){logger[_0x55e3('0xf')](_0x55e3('0x1c'),_0x53f60['message'],_0x483b45);_0x530812(_0x521364[_0x55e3('0xf')](0x1f4,_0x53f60[_0x55e3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 2da4588..ad5e8ae 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 _0xf597=['getDescriptions','post','create','put','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x7a2a2f,_0x26057a){var _0x4fbb2a=function(_0xd5e52f){while(--_0xd5e52f){_0x7a2a2f['push'](_0x7a2a2f['shift']());}};_0x4fbb2a(++_0x26057a);}(_0xf597,0xfc));var _0x7f59=function(_0x435f34,_0x26e1de){_0x435f34=_0x435f34-0x0;var _0x37f4a4=_0xf597[_0x435f34];return _0x37f4a4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7f59('0x0'));var express=require(_0x7f59('0x1'));var router=express[_0x7f59('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7f59('0x3'));var interaction=require(_0x7f59('0x4'));var config=require('../../config/environment');var controller=require(_0x7f59('0x5'));router[_0x7f59('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7f59('0x7'),auth[_0x7f59('0x8')](),controller['show']);router[_0x7f59('0x6')](_0x7f59('0x9'),auth['isAuthenticated'](),controller[_0x7f59('0xa')]);router[_0x7f59('0x6')](_0x7f59('0xb'),auth[_0x7f59('0x8')](),controller[_0x7f59('0xc')]);router[_0x7f59('0x6')](_0x7f59('0xd'),auth['isAuthenticated'](),controller[_0x7f59('0xe')]);router[_0x7f59('0xf')]('/',auth[_0x7f59('0x8')](),controller[_0x7f59('0x10')]);router[_0x7f59('0x11')]('/:id',auth[_0x7f59('0x8')](),controller['update']);router['delete'](_0x7f59('0x7'),auth[_0x7f59('0x8')](),controller['destroy']);module[_0x7f59('0x12')]=router; \ No newline at end of file +var _0x10ff=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','multer','connect-timeout','express','fs-extra'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x10ff,0x1b5));var _0xf10f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x10ff[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf10f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf10f('0x1'));var express=require(_0xf10f('0x2'));var router=express['Router']();var fs_extra=require(_0xf10f('0x3'));var auth=require(_0xf10f('0x4'));var interaction=require(_0xf10f('0x5'));var config=require(_0xf10f('0x6'));var controller=require(_0xf10f('0x7'));router[_0xf10f('0x8')]('/',auth[_0xf10f('0x9')](),controller[_0xf10f('0xa')]);router[_0xf10f('0x8')](_0xf10f('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf10f('0xc'),auth[_0xf10f('0x9')](),controller['getFields']);router[_0xf10f('0x8')](_0xf10f('0xd'),auth['isAuthenticated'](),controller[_0xf10f('0xe')]);router[_0xf10f('0x8')]('/:id/descriptions',auth[_0xf10f('0x9')](),controller[_0xf10f('0xf')]);router[_0xf10f('0x10')]('/',auth['isAuthenticated'](),controller[_0xf10f('0x11')]);router['put'](_0xf10f('0xb'),auth['isAuthenticated'](),controller[_0xf10f('0x12')]);router[_0xf10f('0x13')](_0xf10f('0xb'),auth[_0xf10f('0x9')](),controller[_0xf10f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9f02662..f4eaaf0 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 _0x1f8b=['ENUM','contact','nothing','sequelize','STRING','phonecall','incident'];(function(_0x3200df,_0x30b37f){var _0x2c13df=function(_0x4ddc0f){while(--_0x4ddc0f){_0x3200df['push'](_0x3200df['shift']());}};_0x2c13df(++_0x30b37f);}(_0x1f8b,0xab));var _0xb1f8=function(_0x570398,_0x2ec8c3){_0x570398=_0x570398-0x0;var _0x4c58ff=_0x1f8b[_0x570398];return _0x4c58ff;};'use strict';var Sequelize=require(_0xb1f8('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1f8('0x1')]},'description':{'type':Sequelize[_0xb1f8('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0xb1f8('0x2')),'defaultValue':_0xb1f8('0x3')},'moduleCreate':{'type':Sequelize[_0xb1f8('0x4')](_0xb1f8('0x5'),_0xb1f8('0x6')),'defaultValue':_0xb1f8('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb1f8('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9e53=['STRING','ENUM','incident','phonecall','contact','nothing','sequelize','exports'];(function(_0x581d17,_0x951b0a){var _0x2014bb=function(_0x44fb08){while(--_0x44fb08){_0x581d17['push'](_0x581d17['shift']());}};_0x2014bb(++_0x951b0a);}(_0x9e53,0xc6));var _0x39e5=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x9e53[_0x580b15];return _0x1adb1b;};'use strict';var Sequelize=require(_0x39e5('0x0'));module[_0x39e5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x39e5('0x2')]},'ticketType':{'type':Sequelize[_0x39e5('0x3')](_0x39e5('0x4'),_0x39e5('0x5')),'defaultValue':_0x39e5('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x39e5('0x6'),_0x39e5('0x7')),'defaultValue':_0x39e5('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x39e5('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 58286b0..528820c 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 _0x08d5=['Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','options','include','findAll','rows','keys','includeAll','merge','find','create','body','params','catch','getFields','Dynamics365Field','sort','filter','findOne','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x93d231,_0x50d6c2){var _0x364b65=function(_0x3f403d){while(--_0x3f403d){_0x93d231['push'](_0x93d231['shift']());}};_0x364b65(++_0x50d6c2);}(_0x08d5,0x125));var _0x508d=function(_0x266693,_0x2d185a){_0x266693=_0x266693-0x0;var _0x6585ab=_0x08d5[_0x266693];return _0x6585ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x508d('0x0'));var zipdir=require(_0x508d('0x1'));var jsonpatch=require(_0x508d('0x2'));var rp=require(_0x508d('0x3'));var moment=require(_0x508d('0x4'));var BPromise=require(_0x508d('0x5'));var Mustache=require(_0x508d('0x6'));var util=require(_0x508d('0x7'));var path=require(_0x508d('0x8'));var sox=require(_0x508d('0x9'));var csv=require(_0x508d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x508d('0xb'));var _=require(_0x508d('0xc'));var squel=require('squel');var crypto=require(_0x508d('0xd'));var jsforce=require(_0x508d('0xe'));var deskjs=require(_0x508d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x508d('0x10'));var Papa=require(_0x508d('0x11'));var Redis=require(_0x508d('0x12'));var authService=require(_0x508d('0x13'));var qs=require(_0x508d('0x14'));var as=require(_0x508d('0x15'));var hardwareService=require(_0x508d('0x16'));var logger=require(_0x508d('0x17'))(_0x508d('0x18'));var utils=require('../../config/utils');var config=require(_0x508d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x508d('0x1a'))['db'];function respondWithStatusCode(_0x3730c0,_0x51e0e8){_0x51e0e8=_0x51e0e8||0xcc;return function(_0x3b1db8){if(_0x3b1db8){return _0x3730c0[_0x508d('0x1b')](_0x51e0e8);}return _0x3730c0[_0x508d('0x1c')](_0x51e0e8)[_0x508d('0x1d')]();};}function respondWithResult(_0x297d0b,_0x5e3b94){_0x5e3b94=_0x5e3b94||0xc8;return function(_0x2ee7e3){if(_0x2ee7e3){return _0x297d0b[_0x508d('0x1c')](_0x5e3b94)[_0x508d('0x1e')](_0x2ee7e3);}};}function respondWithFilteredResult(_0x5c2f97,_0x445ec2){return function(_0x2c35b5){if(_0x2c35b5){var _0x10113b=typeof _0x445ec2[_0x508d('0x1f')]==='undefined'&&typeof _0x445ec2[_0x508d('0x20')]==='undefined';var _0xd429da=_0x2c35b5[_0x508d('0x21')];var _0x28ccb3=_0x10113b?0x0:_0x445ec2[_0x508d('0x1f')];var _0x284fdf=_0x10113b?_0x2c35b5[_0x508d('0x21')]:_0x445ec2[_0x508d('0x1f')]+_0x445ec2[_0x508d('0x20')];var _0x2182d1;if(_0x284fdf>=_0xd429da){_0x284fdf=_0xd429da;_0x2182d1=0xc8;}else{_0x2182d1=0xce;}_0x5c2f97[_0x508d('0x1c')](_0x2182d1);return _0x5c2f97[_0x508d('0x22')](_0x508d('0x23'),_0x28ccb3+'-'+_0x284fdf+'/'+_0xd429da)[_0x508d('0x1e')](_0x2c35b5);}return null;};}function patchUpdates(_0x3b8550){return function(_0x3daedb){try{jsonpatch[_0x508d('0x24')](_0x3daedb,_0x3b8550,!![]);}catch(_0x5e4cab){return BPromise[_0x508d('0x25')](_0x5e4cab);}return _0x3daedb[_0x508d('0x26')]();};}function saveUpdates(_0x53fa85,_0x1fb4c0){return function(_0x592633){if(_0x592633){return _0x592633[_0x508d('0x27')](_0x53fa85)['then'](function(_0x533235){return _0x533235;});}return null;};}function removeEntity(_0x58344d,_0x5c48e6){return function(_0x52e0a0){if(_0x52e0a0){return _0x52e0a0[_0x508d('0x28')]()[_0x508d('0x29')](function(){_0x58344d[_0x508d('0x1c')](0xcc)[_0x508d('0x1d')]();});}};}function handleEntityNotFound(_0x3dbc0d,_0x30a574){return function(_0x4b9c4c){if(!_0x4b9c4c){_0x3dbc0d[_0x508d('0x1b')](0x194);}return _0x4b9c4c;};}function handleError(_0x460c5b,_0x500ec3){_0x500ec3=_0x500ec3||0x1f4;return function(_0x57ce42){logger['error'](_0x57ce42['stack']);if(_0x57ce42[_0x508d('0x2a')]){delete _0x57ce42[_0x508d('0x2a')];}_0x460c5b[_0x508d('0x1c')](_0x500ec3)[_0x508d('0x2b')](_0x57ce42);};}exports[_0x508d('0x2c')]=function(_0xc49e5c,_0x417160){var _0x29ba9f={},_0x2c6931={},_0xc3ab93={'count':0x0,'rows':[]};var _0x227bdb=_[_0x508d('0x2d')](db[_0x508d('0x2e')][_0x508d('0x2f')],function(_0x51a145){return{'name':_0x51a145[_0x508d('0x30')],'type':_0x51a145[_0x508d('0x31')][_0x508d('0x32')]};});_0x2c6931[_0x508d('0x33')]=_[_0x508d('0x2d')](_0x227bdb,_0x508d('0x2a'));_0x2c6931[_0x508d('0x34')]=_['keys'](_0xc49e5c[_0x508d('0x34')]);_0x2c6931['filters']=_[_0x508d('0x35')](_0x2c6931[_0x508d('0x33')],_0x2c6931[_0x508d('0x34')]);_0x29ba9f[_0x508d('0x36')]=_[_0x508d('0x35')](_0x2c6931[_0x508d('0x33')],qs[_0x508d('0x37')](_0xc49e5c[_0x508d('0x34')][_0x508d('0x37')]));_0x29ba9f[_0x508d('0x36')]=_0x29ba9f[_0x508d('0x36')][_0x508d('0x38')]?_0x29ba9f[_0x508d('0x36')]:_0x2c6931[_0x508d('0x33')];if(!_0xc49e5c[_0x508d('0x34')][_0x508d('0x39')](_0x508d('0x3a'))){_0x29ba9f[_0x508d('0x20')]=qs['limit'](_0xc49e5c['query'][_0x508d('0x20')]);_0x29ba9f[_0x508d('0x1f')]=qs['offset'](_0xc49e5c[_0x508d('0x34')][_0x508d('0x1f')]);}_0x29ba9f[_0x508d('0x3b')]=qs['sort'](_0xc49e5c[_0x508d('0x34')]['sort']);_0x29ba9f[_0x508d('0x3c')]=qs[_0x508d('0x3d')](_[_0x508d('0x3e')](_0xc49e5c['query'],_0x2c6931[_0x508d('0x3d')]),_0x227bdb);if(_0xc49e5c[_0x508d('0x34')]['filter']){_0x29ba9f['where']=_['merge'](_0x29ba9f[_0x508d('0x3c')],{'$or':_['map'](_0x227bdb,function(_0x44f50e){if(_0x44f50e[_0x508d('0x31')]!=='VIRTUAL'){var _0x59fa1d={};_0x59fa1d[_0x44f50e[_0x508d('0x2a')]]={'$like':'%'+_0xc49e5c[_0x508d('0x34')]['filter']+'%'};return _0x59fa1d;}})});}_0x29ba9f=_['merge']({},_0x29ba9f,_0xc49e5c[_0x508d('0x3f')]);var _0x1207c3={'where':_0x29ba9f[_0x508d('0x3c')]};return db[_0x508d('0x2e')][_0x508d('0x21')](_0x1207c3)[_0x508d('0x29')](function(_0x124816){_0xc3ab93[_0x508d('0x21')]=_0x124816;if(_0xc49e5c[_0x508d('0x34')]['includeAll']){_0x29ba9f[_0x508d('0x40')]=[{'all':!![]}];}return db[_0x508d('0x2e')][_0x508d('0x41')](_0x29ba9f);})[_0x508d('0x29')](function(_0x2bf1d6){_0xc3ab93[_0x508d('0x42')]=_0x2bf1d6;return _0xc3ab93;})['then'](respondWithFilteredResult(_0x417160,_0x29ba9f))['catch'](handleError(_0x417160,null));};exports['show']=function(_0x4377d3,_0x2b4945){var _0x4d63ee={'raw':![],'where':{'id':_0x4377d3['params']['id']}},_0x4aae3={};_0x4aae3[_0x508d('0x33')]=_[_0x508d('0x43')](db[_0x508d('0x2e')]['rawAttributes']);_0x4aae3['query']=_[_0x508d('0x43')](_0x4377d3[_0x508d('0x34')]);_0x4aae3[_0x508d('0x3d')]=_[_0x508d('0x35')](_0x4aae3['model'],_0x4aae3[_0x508d('0x34')]);_0x4d63ee[_0x508d('0x36')]=_[_0x508d('0x35')](_0x4aae3[_0x508d('0x33')],qs['fields'](_0x4377d3[_0x508d('0x34')][_0x508d('0x37')]));_0x4d63ee[_0x508d('0x36')]=_0x4d63ee[_0x508d('0x36')][_0x508d('0x38')]?_0x4d63ee[_0x508d('0x36')]:_0x4aae3[_0x508d('0x33')];if(_0x4377d3[_0x508d('0x34')][_0x508d('0x44')]){_0x4d63ee[_0x508d('0x40')]=[{'all':!![]}];}_0x4d63ee=_[_0x508d('0x45')]({},_0x4d63ee,_0x4377d3[_0x508d('0x3f')]);return db[_0x508d('0x2e')][_0x508d('0x46')](_0x4d63ee)[_0x508d('0x29')](handleEntityNotFound(_0x2b4945,null))['then'](respondWithResult(_0x2b4945,null))['catch'](handleError(_0x2b4945,null));};exports['create']=function(_0x1f8f32,_0x595453){return db[_0x508d('0x2e')][_0x508d('0x47')](_0x1f8f32[_0x508d('0x48')],{})[_0x508d('0x29')](respondWithResult(_0x595453,0xc9))['catch'](handleError(_0x595453,null));};exports[_0x508d('0x27')]=function(_0x23b553,_0x9d3984){if(_0x23b553[_0x508d('0x48')]['id']){delete _0x23b553[_0x508d('0x48')]['id'];}return db[_0x508d('0x2e')]['find']({'where':{'id':_0x23b553[_0x508d('0x49')]['id']}})[_0x508d('0x29')](handleEntityNotFound(_0x9d3984,null))[_0x508d('0x29')](saveUpdates(_0x23b553['body'],null))[_0x508d('0x29')](respondWithResult(_0x9d3984,null))[_0x508d('0x4a')](handleError(_0x9d3984,null));};exports['destroy']=function(_0x71c1a3,_0x5e8ed8){return db[_0x508d('0x2e')][_0x508d('0x46')]({'where':{'id':_0x71c1a3[_0x508d('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e8ed8,null))[_0x508d('0x29')](removeEntity(_0x5e8ed8,null))[_0x508d('0x4a')](handleError(_0x5e8ed8,null));};exports[_0x508d('0x4b')]=function(_0x350896,_0x44f093,_0x5ed14e){var _0x2f939a={};var _0x4165a4={};var _0x239b89;var _0x3c2a34;return db[_0x508d('0x2e')]['findOne']({'where':{'id':_0x350896['params']['id']}})['then'](handleEntityNotFound(_0x44f093,null))[_0x508d('0x29')](function(_0x452428){if(_0x452428){_0x239b89=_0x452428;_0x4165a4[_0x508d('0x33')]=_[_0x508d('0x43')](db[_0x508d('0x4c')]['rawAttributes']);_0x4165a4[_0x508d('0x34')]=_[_0x508d('0x43')](_0x350896['query']);_0x4165a4[_0x508d('0x3d')]=_[_0x508d('0x35')](_0x4165a4[_0x508d('0x33')],_0x4165a4[_0x508d('0x34')]);_0x2f939a[_0x508d('0x36')]=_[_0x508d('0x35')](_0x4165a4[_0x508d('0x33')],qs[_0x508d('0x37')](_0x350896[_0x508d('0x34')][_0x508d('0x37')]));_0x2f939a[_0x508d('0x36')]=_0x2f939a['attributes'][_0x508d('0x38')]?_0x2f939a[_0x508d('0x36')]:_0x4165a4[_0x508d('0x33')];_0x2f939a['order']=qs[_0x508d('0x4d')](_0x350896[_0x508d('0x34')][_0x508d('0x4d')]);_0x2f939a[_0x508d('0x3c')]=qs[_0x508d('0x3d')](_[_0x508d('0x3e')](_0x350896[_0x508d('0x34')],_0x4165a4[_0x508d('0x3d')]));if(_0x350896['query'][_0x508d('0x4e')]){_0x2f939a[_0x508d('0x3c')]=_['merge'](_0x2f939a[_0x508d('0x3c')],{'$or':_[_0x508d('0x2d')](_0x2f939a[_0x508d('0x36')],function(_0x4379f2){var _0xb5b47f={};_0xb5b47f[_0x4379f2]={'$like':'%'+_0x350896[_0x508d('0x34')][_0x508d('0x4e')]+'%'};return _0xb5b47f;})});}_0x2f939a=_[_0x508d('0x45')]({},_0x2f939a,_0x350896[_0x508d('0x3f')]);return _0x239b89[_0x508d('0x4b')](_0x2f939a);}})['then'](function(_0x281178){if(_0x281178){_0x3c2a34=_0x281178['length'];if(!_0x350896[_0x508d('0x34')]['hasOwnProperty']('nolimit')){_0x2f939a[_0x508d('0x20')]=qs['limit'](_0x350896['query'][_0x508d('0x20')]);_0x2f939a[_0x508d('0x1f')]=qs[_0x508d('0x1f')](_0x350896[_0x508d('0x34')][_0x508d('0x1f')]);}return _0x239b89['getFields'](_0x2f939a);}})[_0x508d('0x29')](function(_0x25b61b){if(_0x25b61b){return _0x25b61b?{'count':_0x3c2a34,'rows':_0x25b61b}:null;}})[_0x508d('0x29')](respondWithResult(_0x44f093,null))[_0x508d('0x4a')](handleError(_0x44f093,null));};exports['getSubjects']=function(_0x416f98,_0x43ac8c,_0x4d6ef7){var _0x20f018={};var _0x577af0={};var _0x18d528;var _0x5ecab7;return db[_0x508d('0x2e')][_0x508d('0x4f')]({'where':{'id':_0x416f98['params']['id']}})[_0x508d('0x29')](handleEntityNotFound(_0x43ac8c,null))[_0x508d('0x29')](function(_0x5d1d4a){if(_0x5d1d4a){_0x18d528=_0x5d1d4a;_0x577af0[_0x508d('0x33')]=_['keys'](db[_0x508d('0x4c')][_0x508d('0x2f')]);_0x577af0[_0x508d('0x34')]=_[_0x508d('0x43')](_0x416f98[_0x508d('0x34')]);_0x577af0['filters']=_[_0x508d('0x35')](_0x577af0['model'],_0x577af0[_0x508d('0x34')]);_0x20f018['attributes']=_[_0x508d('0x35')](_0x577af0['model'],qs[_0x508d('0x37')](_0x416f98['query']['fields']));_0x20f018[_0x508d('0x36')]=_0x20f018[_0x508d('0x36')][_0x508d('0x38')]?_0x20f018[_0x508d('0x36')]:_0x577af0['model'];_0x20f018[_0x508d('0x3b')]=qs[_0x508d('0x4d')](_0x416f98[_0x508d('0x34')][_0x508d('0x4d')]);_0x20f018[_0x508d('0x3c')]=qs[_0x508d('0x3d')](_[_0x508d('0x3e')](_0x416f98[_0x508d('0x34')],_0x577af0[_0x508d('0x3d')]));if(_0x416f98[_0x508d('0x34')]['filter']){_0x20f018[_0x508d('0x3c')]=_[_0x508d('0x45')](_0x20f018[_0x508d('0x3c')],{'$or':_[_0x508d('0x2d')](_0x20f018['attributes'],function(_0x3a7567){var _0xe5144c={};_0xe5144c[_0x3a7567]={'$like':'%'+_0x416f98[_0x508d('0x34')]['filter']+'%'};return _0xe5144c;})});}_0x20f018=_[_0x508d('0x45')]({},_0x20f018,_0x416f98[_0x508d('0x3f')]);return _0x18d528[_0x508d('0x50')](_0x20f018);}})[_0x508d('0x29')](function(_0x2ab216){if(_0x2ab216){_0x5ecab7=_0x2ab216[_0x508d('0x38')];if(!_0x416f98['query'][_0x508d('0x39')]('nolimit')){_0x20f018['limit']=qs[_0x508d('0x20')](_0x416f98[_0x508d('0x34')][_0x508d('0x20')]);_0x20f018['offset']=qs[_0x508d('0x1f')](_0x416f98['query']['offset']);}return _0x18d528[_0x508d('0x50')](_0x20f018);}})[_0x508d('0x29')](function(_0x143d8b){if(_0x143d8b){return _0x143d8b?{'count':_0x5ecab7,'rows':_0x143d8b}:null;}})[_0x508d('0x29')](respondWithResult(_0x43ac8c,null))['catch'](handleError(_0x43ac8c,null));};exports['getDescriptions']=function(_0x4cb596,_0x2fbf77,_0x262567){var _0x37e0a1={};var _0x22163e={};var _0x3769fc;var _0x2e9c43;return db[_0x508d('0x2e')]['findOne']({'where':{'id':_0x4cb596[_0x508d('0x49')]['id']}})[_0x508d('0x29')](handleEntityNotFound(_0x2fbf77,null))[_0x508d('0x29')](function(_0x29e7a4){if(_0x29e7a4){_0x3769fc=_0x29e7a4;_0x22163e[_0x508d('0x33')]=_[_0x508d('0x43')](db[_0x508d('0x4c')][_0x508d('0x2f')]);_0x22163e[_0x508d('0x34')]=_[_0x508d('0x43')](_0x4cb596[_0x508d('0x34')]);_0x22163e[_0x508d('0x3d')]=_['intersection'](_0x22163e[_0x508d('0x33')],_0x22163e[_0x508d('0x34')]);_0x37e0a1['attributes']=_['intersection'](_0x22163e['model'],qs[_0x508d('0x37')](_0x4cb596[_0x508d('0x34')][_0x508d('0x37')]));_0x37e0a1['attributes']=_0x37e0a1['attributes'][_0x508d('0x38')]?_0x37e0a1[_0x508d('0x36')]:_0x22163e[_0x508d('0x33')];_0x37e0a1[_0x508d('0x3b')]=qs[_0x508d('0x4d')](_0x4cb596[_0x508d('0x34')][_0x508d('0x4d')]);_0x37e0a1['where']=qs['filters'](_[_0x508d('0x3e')](_0x4cb596[_0x508d('0x34')],_0x22163e[_0x508d('0x3d')]));if(_0x4cb596[_0x508d('0x34')][_0x508d('0x4e')]){_0x37e0a1['where']=_[_0x508d('0x45')](_0x37e0a1[_0x508d('0x3c')],{'$or':_[_0x508d('0x2d')](_0x37e0a1[_0x508d('0x36')],function(_0x472bbc){var _0x205934={};_0x205934[_0x472bbc]={'$like':'%'+_0x4cb596['query'][_0x508d('0x4e')]+'%'};return _0x205934;})});}_0x37e0a1=_[_0x508d('0x45')]({},_0x37e0a1,_0x4cb596[_0x508d('0x3f')]);return _0x3769fc[_0x508d('0x51')](_0x37e0a1);}})['then'](function(_0x2ae2b7){if(_0x2ae2b7){_0x2e9c43=_0x2ae2b7[_0x508d('0x38')];if(!_0x4cb596['query'][_0x508d('0x39')](_0x508d('0x3a'))){_0x37e0a1['limit']=qs[_0x508d('0x20')](_0x4cb596['query']['limit']);_0x37e0a1[_0x508d('0x1f')]=qs[_0x508d('0x1f')](_0x4cb596[_0x508d('0x34')][_0x508d('0x1f')]);}return _0x3769fc[_0x508d('0x51')](_0x37e0a1);}})[_0x508d('0x29')](function(_0x1611a6){if(_0x1611a6){return _0x1611a6?{'count':_0x2e9c43,'rows':_0x1611a6}:null;}})[_0x508d('0x29')](respondWithResult(_0x2fbf77,null))['catch'](handleError(_0x2fbf77,null));}; \ No newline at end of file +var _0xa02e=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','keys','find','body','findOne','Dynamics365Field','length','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes'];(function(_0x885692,_0x2d01a0){var _0x5addcd=function(_0x4101a1){while(--_0x4101a1){_0x885692['push'](_0x885692['shift']());}};_0x5addcd(++_0x2d01a0);}(_0xa02e,0xbb));var _0xea02=function(_0x48ca5b,_0x1ad69e){_0x48ca5b=_0x48ca5b-0x0;var _0x354a06=_0xa02e[_0x48ca5b];return _0x354a06;};'use strict';var emlformat=require(_0xea02('0x0'));var rimraf=require(_0xea02('0x1'));var zipdir=require(_0xea02('0x2'));var jsonpatch=require(_0xea02('0x3'));var rp=require('request-promise');var moment=require(_0xea02('0x4'));var BPromise=require(_0xea02('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xea02('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea02('0x7'));var squel=require(_0xea02('0x8'));var crypto=require('crypto');var jsforce=require(_0xea02('0x9'));var deskjs=require(_0xea02('0xa'));var toCsv=require(_0xea02('0xb'));var querystring=require(_0xea02('0xc'));var Papa=require(_0xea02('0xd'));var Redis=require(_0xea02('0xe'));var authService=require(_0xea02('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xea02('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea02('0x11'))(_0xea02('0x12'));var utils=require(_0xea02('0x13'));var config=require(_0xea02('0x14'));var licenseUtil=require(_0xea02('0x15'));var db=require(_0xea02('0x16'))['db'];function respondWithStatusCode(_0x2ddc0f,_0x26d1be){_0x26d1be=_0x26d1be||0xcc;return function(_0x4dc53f){if(_0x4dc53f){return _0x2ddc0f[_0xea02('0x17')](_0x26d1be);}return _0x2ddc0f[_0xea02('0x18')](_0x26d1be)[_0xea02('0x19')]();};}function respondWithResult(_0x2cf55d,_0x45af7f){_0x45af7f=_0x45af7f||0xc8;return function(_0x47dac1){if(_0x47dac1){return _0x2cf55d[_0xea02('0x18')](_0x45af7f)[_0xea02('0x1a')](_0x47dac1);}};}function respondWithFilteredResult(_0x6bb0cc,_0x4016eb){return function(_0x546f96){if(_0x546f96){var _0x4ececc=typeof _0x4016eb[_0xea02('0x1b')]===_0xea02('0x1c')&&typeof _0x4016eb[_0xea02('0x1d')]==='undefined';var _0xdaea33=_0x546f96[_0xea02('0x1e')];var _0x11fd31=_0x4ececc?0x0:_0x4016eb['offset'];var _0x1cfe6b=_0x4ececc?_0x546f96[_0xea02('0x1e')]:_0x4016eb[_0xea02('0x1b')]+_0x4016eb[_0xea02('0x1d')];var _0x23c901;if(_0x1cfe6b>=_0xdaea33){_0x1cfe6b=_0xdaea33;_0x23c901=0xc8;}else{_0x23c901=0xce;}_0x6bb0cc[_0xea02('0x18')](_0x23c901);return _0x6bb0cc[_0xea02('0x1f')]('Content-Range',_0x11fd31+'-'+_0x1cfe6b+'/'+_0xdaea33)[_0xea02('0x1a')](_0x546f96);}return null;};}function patchUpdates(_0x36cb0b){return function(_0x524887){try{jsonpatch['apply'](_0x524887,_0x36cb0b,!![]);}catch(_0x31ea0b){return BPromise[_0xea02('0x20')](_0x31ea0b);}return _0x524887[_0xea02('0x21')]();};}function saveUpdates(_0x1ea9ff,_0xa32a1b){return function(_0x26d78c){if(_0x26d78c){return _0x26d78c[_0xea02('0x22')](_0x1ea9ff)[_0xea02('0x23')](function(_0x2c97e3){return _0x2c97e3;});}return null;};}function removeEntity(_0x1e0a28,_0x43b67b){return function(_0x24afba){if(_0x24afba){return _0x24afba[_0xea02('0x24')]()[_0xea02('0x23')](function(){_0x1e0a28[_0xea02('0x18')](0xcc)[_0xea02('0x19')]();});}};}function handleEntityNotFound(_0x33d7ed,_0x1da770){return function(_0x2e895d){if(!_0x2e895d){_0x33d7ed['sendStatus'](0x194);}return _0x2e895d;};}function handleError(_0x4cd08d,_0x41fa7f){_0x41fa7f=_0x41fa7f||0x1f4;return function(_0x3834af){logger[_0xea02('0x25')](_0x3834af[_0xea02('0x26')]);if(_0x3834af[_0xea02('0x27')]){delete _0x3834af['name'];}_0x4cd08d[_0xea02('0x18')](_0x41fa7f)[_0xea02('0x28')](_0x3834af);};}exports[_0xea02('0x29')]=function(_0x16952f,_0x29553a){var _0x1b1c1b={},_0x4d1efe={},_0x172424={'count':0x0,'rows':[]};var _0x32c73f=_['map'](db['Dynamics365Configuration'][_0xea02('0x2a')],function(_0x3e2271){return{'name':_0x3e2271[_0xea02('0x2b')],'type':_0x3e2271[_0xea02('0x2c')][_0xea02('0x2d')]};});_0x4d1efe[_0xea02('0x2e')]=_[_0xea02('0x2f')](_0x32c73f,_0xea02('0x27'));_0x4d1efe[_0xea02('0x30')]=_['keys'](_0x16952f[_0xea02('0x30')]);_0x4d1efe[_0xea02('0x31')]=_[_0xea02('0x32')](_0x4d1efe[_0xea02('0x2e')],_0x4d1efe[_0xea02('0x30')]);_0x1b1c1b['attributes']=_[_0xea02('0x32')](_0x4d1efe[_0xea02('0x2e')],qs[_0xea02('0x33')](_0x16952f[_0xea02('0x30')][_0xea02('0x33')]));_0x1b1c1b[_0xea02('0x34')]=_0x1b1c1b[_0xea02('0x34')]['length']?_0x1b1c1b[_0xea02('0x34')]:_0x4d1efe[_0xea02('0x2e')];if(!_0x16952f[_0xea02('0x30')][_0xea02('0x35')](_0xea02('0x36'))){_0x1b1c1b['limit']=qs[_0xea02('0x1d')](_0x16952f['query'][_0xea02('0x1d')]);_0x1b1c1b[_0xea02('0x1b')]=qs['offset'](_0x16952f[_0xea02('0x30')]['offset']);}_0x1b1c1b[_0xea02('0x37')]=qs[_0xea02('0x38')](_0x16952f['query'][_0xea02('0x38')]);_0x1b1c1b[_0xea02('0x39')]=qs[_0xea02('0x31')](_[_0xea02('0x3a')](_0x16952f['query'],_0x4d1efe[_0xea02('0x31')]),_0x32c73f);if(_0x16952f[_0xea02('0x30')][_0xea02('0x3b')]){_0x1b1c1b[_0xea02('0x39')]=_[_0xea02('0x3c')](_0x1b1c1b[_0xea02('0x39')],{'$or':_['map'](_0x32c73f,function(_0x385b91){if(_0x385b91['type']!==_0xea02('0x3d')){var _0x39d1e9={};_0x39d1e9[_0x385b91['name']]={'$like':'%'+_0x16952f[_0xea02('0x30')][_0xea02('0x3b')]+'%'};return _0x39d1e9;}})});}_0x1b1c1b=_[_0xea02('0x3c')]({},_0x1b1c1b,_0x16952f[_0xea02('0x3e')]);var _0x41635b={'where':_0x1b1c1b[_0xea02('0x39')]};return db[_0xea02('0x3f')]['count'](_0x41635b)[_0xea02('0x23')](function(_0xc42dff){_0x172424[_0xea02('0x1e')]=_0xc42dff;if(_0x16952f[_0xea02('0x30')][_0xea02('0x40')]){_0x1b1c1b[_0xea02('0x41')]=[{'all':!![]}];}return db[_0xea02('0x3f')][_0xea02('0x42')](_0x1b1c1b);})['then'](function(_0x53bba9){_0x172424[_0xea02('0x43')]=_0x53bba9;return _0x172424;})[_0xea02('0x23')](respondWithFilteredResult(_0x29553a,_0x1b1c1b))[_0xea02('0x44')](handleError(_0x29553a,null));};exports[_0xea02('0x45')]=function(_0x5a1829,_0x4e9598){var _0x136ba1={'raw':![],'where':{'id':_0x5a1829[_0xea02('0x46')]['id']}},_0x3803d7={};_0x3803d7[_0xea02('0x2e')]=_[_0xea02('0x47')](db[_0xea02('0x3f')][_0xea02('0x2a')]);_0x3803d7[_0xea02('0x30')]=_['keys'](_0x5a1829[_0xea02('0x30')]);_0x3803d7[_0xea02('0x31')]=_[_0xea02('0x32')](_0x3803d7[_0xea02('0x2e')],_0x3803d7[_0xea02('0x30')]);_0x136ba1[_0xea02('0x34')]=_[_0xea02('0x32')](_0x3803d7[_0xea02('0x2e')],qs[_0xea02('0x33')](_0x5a1829['query']['fields']));_0x136ba1[_0xea02('0x34')]=_0x136ba1[_0xea02('0x34')]['length']?_0x136ba1[_0xea02('0x34')]:_0x3803d7['model'];if(_0x5a1829[_0xea02('0x30')][_0xea02('0x40')]){_0x136ba1[_0xea02('0x41')]=[{'all':!![]}];}_0x136ba1=_['merge']({},_0x136ba1,_0x5a1829[_0xea02('0x3e')]);return db[_0xea02('0x3f')][_0xea02('0x48')](_0x136ba1)[_0xea02('0x23')](handleEntityNotFound(_0x4e9598,null))[_0xea02('0x23')](respondWithResult(_0x4e9598,null))[_0xea02('0x44')](handleError(_0x4e9598,null));};exports['create']=function(_0x4bc510,_0x4713a2){return db[_0xea02('0x3f')]['create'](_0x4bc510[_0xea02('0x49')],{})[_0xea02('0x23')](respondWithResult(_0x4713a2,0xc9))['catch'](handleError(_0x4713a2,null));};exports[_0xea02('0x22')]=function(_0x4fcd7b,_0x2be6f0){if(_0x4fcd7b[_0xea02('0x49')]['id']){delete _0x4fcd7b['body']['id'];}return db[_0xea02('0x3f')]['find']({'where':{'id':_0x4fcd7b[_0xea02('0x46')]['id']}})[_0xea02('0x23')](handleEntityNotFound(_0x2be6f0,null))['then'](saveUpdates(_0x4fcd7b[_0xea02('0x49')],null))['then'](respondWithResult(_0x2be6f0,null))[_0xea02('0x44')](handleError(_0x2be6f0,null));};exports[_0xea02('0x24')]=function(_0x25c4a9,_0x232c3c){return db[_0xea02('0x3f')][_0xea02('0x48')]({'where':{'id':_0x25c4a9[_0xea02('0x46')]['id']}})[_0xea02('0x23')](handleEntityNotFound(_0x232c3c,null))[_0xea02('0x23')](removeEntity(_0x232c3c,null))[_0xea02('0x44')](handleError(_0x232c3c,null));};exports['getFields']=function(_0x2ea3e6,_0x5a72e3,_0x1a0585){var _0x2cd9d6={};var _0x27293c={};var _0x432931;var _0xfb0c0;return db[_0xea02('0x3f')][_0xea02('0x4a')]({'where':{'id':_0x2ea3e6[_0xea02('0x46')]['id']}})[_0xea02('0x23')](handleEntityNotFound(_0x5a72e3,null))['then'](function(_0x4e5e0c){if(_0x4e5e0c){_0x432931=_0x4e5e0c;_0x27293c['model']=_[_0xea02('0x47')](db[_0xea02('0x4b')]['rawAttributes']);_0x27293c[_0xea02('0x30')]=_[_0xea02('0x47')](_0x2ea3e6[_0xea02('0x30')]);_0x27293c[_0xea02('0x31')]=_[_0xea02('0x32')](_0x27293c[_0xea02('0x2e')],_0x27293c[_0xea02('0x30')]);_0x2cd9d6[_0xea02('0x34')]=_['intersection'](_0x27293c['model'],qs[_0xea02('0x33')](_0x2ea3e6['query'][_0xea02('0x33')]));_0x2cd9d6[_0xea02('0x34')]=_0x2cd9d6[_0xea02('0x34')][_0xea02('0x4c')]?_0x2cd9d6[_0xea02('0x34')]:_0x27293c['model'];_0x2cd9d6[_0xea02('0x37')]=qs['sort'](_0x2ea3e6[_0xea02('0x30')][_0xea02('0x38')]);_0x2cd9d6[_0xea02('0x39')]=qs[_0xea02('0x31')](_[_0xea02('0x3a')](_0x2ea3e6[_0xea02('0x30')],_0x27293c[_0xea02('0x31')]));if(_0x2ea3e6[_0xea02('0x30')][_0xea02('0x3b')]){_0x2cd9d6['where']=_[_0xea02('0x3c')](_0x2cd9d6['where'],{'$or':_['map'](_0x2cd9d6[_0xea02('0x34')],function(_0x56c64c){var _0x43bb58={};_0x43bb58[_0x56c64c]={'$like':'%'+_0x2ea3e6[_0xea02('0x30')]['filter']+'%'};return _0x43bb58;})});}_0x2cd9d6=_[_0xea02('0x3c')]({},_0x2cd9d6,_0x2ea3e6[_0xea02('0x3e')]);return _0x432931[_0xea02('0x4d')](_0x2cd9d6);}})['then'](function(_0x50cd33){if(_0x50cd33){_0xfb0c0=_0x50cd33[_0xea02('0x4c')];if(!_0x2ea3e6[_0xea02('0x30')][_0xea02('0x35')](_0xea02('0x36'))){_0x2cd9d6[_0xea02('0x1d')]=qs[_0xea02('0x1d')](_0x2ea3e6['query']['limit']);_0x2cd9d6[_0xea02('0x1b')]=qs['offset'](_0x2ea3e6[_0xea02('0x30')][_0xea02('0x1b')]);}return _0x432931['getFields'](_0x2cd9d6);}})[_0xea02('0x23')](function(_0xf0e3fa){if(_0xf0e3fa){return _0xf0e3fa?{'count':_0xfb0c0,'rows':_0xf0e3fa}:null;}})[_0xea02('0x23')](respondWithResult(_0x5a72e3,null))['catch'](handleError(_0x5a72e3,null));};exports[_0xea02('0x4e')]=function(_0x3cf245,_0x45b1ee,_0x1f6605){var _0x4d2d07={};var _0x1fd794={};var _0x19118b;var _0x138f5e;return db['Dynamics365Configuration'][_0xea02('0x4a')]({'where':{'id':_0x3cf245[_0xea02('0x46')]['id']}})[_0xea02('0x23')](handleEntityNotFound(_0x45b1ee,null))['then'](function(_0x54b2e2){if(_0x54b2e2){_0x19118b=_0x54b2e2;_0x1fd794['model']=_['keys'](db['Dynamics365Field'][_0xea02('0x2a')]);_0x1fd794[_0xea02('0x30')]=_[_0xea02('0x47')](_0x3cf245[_0xea02('0x30')]);_0x1fd794[_0xea02('0x31')]=_[_0xea02('0x32')](_0x1fd794[_0xea02('0x2e')],_0x1fd794[_0xea02('0x30')]);_0x4d2d07[_0xea02('0x34')]=_[_0xea02('0x32')](_0x1fd794[_0xea02('0x2e')],qs[_0xea02('0x33')](_0x3cf245['query'][_0xea02('0x33')]));_0x4d2d07[_0xea02('0x34')]=_0x4d2d07['attributes'][_0xea02('0x4c')]?_0x4d2d07[_0xea02('0x34')]:_0x1fd794[_0xea02('0x2e')];_0x4d2d07[_0xea02('0x37')]=qs[_0xea02('0x38')](_0x3cf245[_0xea02('0x30')][_0xea02('0x38')]);_0x4d2d07[_0xea02('0x39')]=qs[_0xea02('0x31')](_[_0xea02('0x3a')](_0x3cf245[_0xea02('0x30')],_0x1fd794[_0xea02('0x31')]));if(_0x3cf245[_0xea02('0x30')][_0xea02('0x3b')]){_0x4d2d07[_0xea02('0x39')]=_[_0xea02('0x3c')](_0x4d2d07[_0xea02('0x39')],{'$or':_[_0xea02('0x2f')](_0x4d2d07[_0xea02('0x34')],function(_0xbb58a7){var _0x55bf3d={};_0x55bf3d[_0xbb58a7]={'$like':'%'+_0x3cf245[_0xea02('0x30')][_0xea02('0x3b')]+'%'};return _0x55bf3d;})});}_0x4d2d07=_[_0xea02('0x3c')]({},_0x4d2d07,_0x3cf245[_0xea02('0x3e')]);return _0x19118b[_0xea02('0x4e')](_0x4d2d07);}})[_0xea02('0x23')](function(_0x2e11d9){if(_0x2e11d9){_0x138f5e=_0x2e11d9[_0xea02('0x4c')];if(!_0x3cf245[_0xea02('0x30')][_0xea02('0x35')]('nolimit')){_0x4d2d07[_0xea02('0x1d')]=qs[_0xea02('0x1d')](_0x3cf245[_0xea02('0x30')]['limit']);_0x4d2d07[_0xea02('0x1b')]=qs[_0xea02('0x1b')](_0x3cf245[_0xea02('0x30')][_0xea02('0x1b')]);}return _0x19118b[_0xea02('0x4e')](_0x4d2d07);}})[_0xea02('0x23')](function(_0x5d80e6){if(_0x5d80e6){return _0x5d80e6?{'count':_0x138f5e,'rows':_0x5d80e6}:null;}})[_0xea02('0x23')](respondWithResult(_0x45b1ee,null))[_0xea02('0x44')](handleError(_0x45b1ee,null));};exports[_0xea02('0x4f')]=function(_0x4664a2,_0x58aa2d,_0x2db504){var _0x55a1a9={};var _0x3ff6a3={};var _0x1abbc7;var _0x268e41;return db[_0xea02('0x3f')][_0xea02('0x4a')]({'where':{'id':_0x4664a2[_0xea02('0x46')]['id']}})[_0xea02('0x23')](handleEntityNotFound(_0x58aa2d,null))['then'](function(_0x1a6283){if(_0x1a6283){_0x1abbc7=_0x1a6283;_0x3ff6a3[_0xea02('0x2e')]=_[_0xea02('0x47')](db[_0xea02('0x4b')][_0xea02('0x2a')]);_0x3ff6a3['query']=_[_0xea02('0x47')](_0x4664a2[_0xea02('0x30')]);_0x3ff6a3[_0xea02('0x31')]=_[_0xea02('0x32')](_0x3ff6a3['model'],_0x3ff6a3[_0xea02('0x30')]);_0x55a1a9[_0xea02('0x34')]=_[_0xea02('0x32')](_0x3ff6a3[_0xea02('0x2e')],qs['fields'](_0x4664a2[_0xea02('0x30')][_0xea02('0x33')]));_0x55a1a9['attributes']=_0x55a1a9[_0xea02('0x34')][_0xea02('0x4c')]?_0x55a1a9['attributes']:_0x3ff6a3[_0xea02('0x2e')];_0x55a1a9[_0xea02('0x37')]=qs['sort'](_0x4664a2[_0xea02('0x30')][_0xea02('0x38')]);_0x55a1a9['where']=qs['filters'](_[_0xea02('0x3a')](_0x4664a2[_0xea02('0x30')],_0x3ff6a3[_0xea02('0x31')]));if(_0x4664a2[_0xea02('0x30')][_0xea02('0x3b')]){_0x55a1a9[_0xea02('0x39')]=_[_0xea02('0x3c')](_0x55a1a9[_0xea02('0x39')],{'$or':_[_0xea02('0x2f')](_0x55a1a9[_0xea02('0x34')],function(_0xcac17f){var _0x2f7958={};_0x2f7958[_0xcac17f]={'$like':'%'+_0x4664a2[_0xea02('0x30')][_0xea02('0x3b')]+'%'};return _0x2f7958;})});}_0x55a1a9=_[_0xea02('0x3c')]({},_0x55a1a9,_0x4664a2[_0xea02('0x3e')]);return _0x1abbc7[_0xea02('0x4f')](_0x55a1a9);}})[_0xea02('0x23')](function(_0x3ccc65){if(_0x3ccc65){_0x268e41=_0x3ccc65['length'];if(!_0x4664a2['query']['hasOwnProperty'](_0xea02('0x36'))){_0x55a1a9[_0xea02('0x1d')]=qs['limit'](_0x4664a2[_0xea02('0x30')]['limit']);_0x55a1a9[_0xea02('0x1b')]=qs['offset'](_0x4664a2[_0xea02('0x30')][_0xea02('0x1b')]);}return _0x1abbc7[_0xea02('0x4f')](_0x55a1a9);}})['then'](function(_0x287b99){if(_0x287b99){return _0x287b99?{'count':_0x268e41,'rows':_0x287b99}:null;}})[_0xea02('0x23')](respondWithResult(_0x58aa2d,null))[_0xea02('0x44')](handleError(_0x58aa2d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index cdc71fb..0f9f5b3 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 _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x493b70,_0x168e73){var _0x4c2355=function(_0x1e0247){while(--_0x1e0247){_0x493b70['push'](_0x493b70['shift']());}};_0x4c2355(++_0x168e73);}(_0x008c,0x188));var _0xc008=function(_0x2683d4,_0x1148c2){_0x2683d4=_0x2683d4-0x0;var _0x493266=_0x008c[_0x2683d4];return _0x493266;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x3b64ae,_0x2c4e93){var _0x1506b8=function(_0x2591d7){while(--_0x2591d7){_0x3b64ae['push'](_0x3b64ae['shift']());}};_0x1506b8(++_0x2c4e93);}(_0x3e74,0x175));var _0x43e7=function(_0x3eb6a5,_0xe82ab8){_0x3eb6a5=_0x3eb6a5-0x0;var _0x417b40=_0x3e74[_0x3eb6a5];return _0x417b40;};'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/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 2425b8f..290e825 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 _0x5b25=['Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5b25,0xbd));var _0x55b2=function(_0x100ad3,_0x387855){_0x100ad3=_0x100ad3-0x0;var _0x12c38b=_0x5b25[_0x100ad3];return _0x12c38b;};'use strict';var _=require(_0x55b2('0x0'));var util=require('util');var moment=require(_0x55b2('0x1'));var BPromise=require(_0x55b2('0x2'));var rs=require(_0x55b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x55b2('0x4'));var logger=require('../../config/logger')(_0x55b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x55b2('0x6'));var client=jayson[_0x55b2('0x7')][_0x55b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd24374,_0x13b913,_0xc1f7fc){return new BPromise(function(_0x28a40c,_0x31bab0){return client[_0x55b2('0x9')](_0xd24374,_0xc1f7fc)[_0x55b2('0xa')](function(_0x32832){logger['info'](_0x55b2('0xb'),_0x13b913,'request\x20sent');logger['debug'](_0x55b2('0xc'),_0x13b913,_0x55b2('0xd'),JSON['stringify'](_0x32832));if(_0x32832['error']){if(_0x32832[_0x55b2('0xe')][_0x55b2('0xf')]===0x1f4){logger[_0x55b2('0xe')](_0x55b2('0xb'),_0x13b913,_0x32832['error']['message']);return _0x31bab0(_0x32832['error']['message']);}logger['error'](_0x55b2('0xb'),_0x13b913,_0x32832[_0x55b2('0xe')][_0x55b2('0x10')]);return _0x28a40c(_0x32832[_0x55b2('0xe')]['message']);}else{logger[_0x55b2('0x11')](_0x55b2('0xb'),_0x13b913,_0x55b2('0xd'));_0x28a40c(_0x32832[_0x55b2('0x12')][_0x55b2('0x10')]);}})[_0x55b2('0x13')](function(_0x53b15c){logger[_0x55b2('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x13b913,_0x53b15c);_0x31bab0(_0x53b15c);});});} \ No newline at end of file +var _0x5497=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0x5497,0x106));var _0x7549=function(_0x4f66,_0x4c4a2e){_0x4f66=_0x4f66-0x0;var _0x4e3d42=_0x5497[_0x4f66];return _0x4e3d42;};'use strict';var _=require(_0x7549('0x0'));var util=require(_0x7549('0x1'));var moment=require(_0x7549('0x2'));var BPromise=require(_0x7549('0x3'));var rs=require(_0x7549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7549('0x5'));var logger=require(_0x7549('0x6'))(_0x7549('0x7'));var config=require(_0x7549('0x8'));var jayson=require(_0x7549('0x9'));var client=jayson[_0x7549('0xa')][_0x7549('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5de9a1,_0x267d15,_0x371112){return new BPromise(function(_0x25246b,_0x15fb87){return client[_0x7549('0xc')](_0x5de9a1,_0x371112)[_0x7549('0xd')](function(_0x28635d){logger[_0x7549('0xe')](_0x7549('0xf'),_0x267d15,_0x7549('0x10'));logger[_0x7549('0x11')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x267d15,_0x7549('0x10'),JSON[_0x7549('0x12')](_0x28635d));if(_0x28635d['error']){if(_0x28635d['error']['code']===0x1f4){logger['error'](_0x7549('0xf'),_0x267d15,_0x28635d[_0x7549('0x13')][_0x7549('0x14')]);return _0x15fb87(_0x28635d[_0x7549('0x13')][_0x7549('0x14')]);}logger['error'](_0x7549('0xf'),_0x267d15,_0x28635d[_0x7549('0x13')][_0x7549('0x14')]);return _0x25246b(_0x28635d[_0x7549('0x13')][_0x7549('0x14')]);}else{logger[_0x7549('0xe')](_0x7549('0xf'),_0x267d15,'request\x20sent');_0x25246b(_0x28635d['result'][_0x7549('0x14')]);}})[_0x7549('0x15')](function(_0x381371){logger[_0x7549('0x13')](_0x7549('0xf'),_0x267d15,_0x381371);_0x15fb87(_0x381371);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index cf9a9f4..771b256 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 _0xf9d6=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x5e26c4,_0x4e9e9e){var _0x30a643=function(_0x3d06d1){while(--_0x3d06d1){_0x5e26c4['push'](_0x5e26c4['shift']());}};_0x30a643(++_0x4e9e9e);}(_0xf9d6,0xc4));var _0x6f9d=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0xf9d6[_0x3efe87];return _0x56a4cc;};'use strict';var multer=require(_0x6f9d('0x0'));var util=require('util');var path=require(_0x6f9d('0x1'));var timeout=require(_0x6f9d('0x2'));var express=require(_0x6f9d('0x3'));var router=express[_0x6f9d('0x4')]();var fs_extra=require(_0x6f9d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6f9d('0x6'));var config=require(_0x6f9d('0x7'));var controller=require(_0x6f9d('0x8'));router[_0x6f9d('0x9')]('/',auth[_0x6f9d('0xa')](),controller[_0x6f9d('0xb')]);router[_0x6f9d('0x9')](_0x6f9d('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6f9d('0xa')](),controller[_0x6f9d('0xd')]);router[_0x6f9d('0xe')](_0x6f9d('0xc'),auth[_0x6f9d('0xa')](),controller[_0x6f9d('0xf')]);router[_0x6f9d('0x10')](_0x6f9d('0xc'),auth[_0x6f9d('0xa')](),controller[_0x6f9d('0x11')]);module[_0x6f9d('0x12')]=router; \ No newline at end of file +var _0x3b8c=['update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3b8c,0xa3));var _0xc3b8=function(_0x5a70e8,_0x3f02b5){_0x5a70e8=_0x5a70e8-0x0;var _0x32eac5=_0x3b8c[_0x5a70e8];return _0x32eac5;};'use strict';var multer=require('multer');var util=require(_0xc3b8('0x0'));var path=require(_0xc3b8('0x1'));var timeout=require(_0xc3b8('0x2'));var express=require(_0xc3b8('0x3'));var router=express[_0xc3b8('0x4')]();var fs_extra=require(_0xc3b8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc3b8('0x6'));var config=require(_0xc3b8('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xc3b8('0x8')]('/',auth[_0xc3b8('0x9')](),controller['index']);router[_0xc3b8('0x8')](_0xc3b8('0xa'),auth[_0xc3b8('0x9')](),controller[_0xc3b8('0xb')]);router['post']('/',auth[_0xc3b8('0x9')](),controller['create']);router[_0xc3b8('0xc')](_0xc3b8('0xa'),auth[_0xc3b8('0x9')](),controller[_0xc3b8('0xd')]);router['delete']('/:id',auth[_0xc3b8('0x9')](),controller[_0xc3b8('0xe')]);module[_0xc3b8('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 647ea2b..8877485 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 _0x8ca1=['BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x1aa59b,_0x26612c){var _0x33011c=function(_0x29d625){while(--_0x29d625){_0x1aa59b['push'](_0x1aa59b['shift']());}};_0x33011c(++_0x26612c);}(_0x8ca1,0x1cc));var _0x18ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ca1[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x18ca('0x0'));module['exports']={'type':{'type':Sequelize[_0x18ca('0x1')](_0x18ca('0x2'),_0x18ca('0x3'),'customVariable',_0x18ca('0x4'),_0x18ca('0x5')),'defaultValue':_0x18ca('0x2')},'content':{'type':Sequelize[_0x18ca('0x6')]},'key':{'type':Sequelize[_0x18ca('0x6')]},'keyType':{'type':Sequelize[_0x18ca('0x1')](_0x18ca('0x2'),_0x18ca('0x3'),_0x18ca('0x7'))},'keyContent':{'type':Sequelize[_0x18ca('0x6')]},'idField':{'type':Sequelize[_0x18ca('0x6')]},'nameField':{'type':Sequelize[_0x18ca('0x6')]},'customField':{'type':Sequelize[_0x18ca('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18ca('0x6')]}}; \ No newline at end of file +var _0x7418=['BOOLEAN','sequelize','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x2c065c,_0x4a5679){var _0x1a512c=function(_0x49e249){while(--_0x49e249){_0x2c065c['push'](_0x2c065c['shift']());}};_0x1a512c(++_0x4a5679);}(_0x7418,0x1d9));var _0x8741=function(_0x22d8a0,_0x554412){_0x22d8a0=_0x22d8a0-0x0;var _0xb8e3e5=_0x7418[_0x22d8a0];return _0xb8e3e5;};'use strict';var Sequelize=require(_0x8741('0x0'));module['exports']={'type':{'type':Sequelize[_0x8741('0x1')](_0x8741('0x2'),_0x8741('0x3'),'customVariable',_0x8741('0x4'),'picklist'),'defaultValue':_0x8741('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8741('0x5')]},'keyType':{'type':Sequelize[_0x8741('0x1')](_0x8741('0x2'),_0x8741('0x3'),_0x8741('0x6'))},'keyContent':{'type':Sequelize[_0x8741('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8741('0x5')]},'customField':{'type':Sequelize[_0x8741('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8741('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 4720bfb..ac04474 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 _0xd45a=['apply','reject','save','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','then','include','findAll','show','params','includeAll','find','create','body','catch','update','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x5638df,_0x38872c){var _0x4d06c2=function(_0x17195b){while(--_0x17195b){_0x5638df['push'](_0x5638df['shift']());}};_0x4d06c2(++_0x38872c);}(_0xd45a,0x1de));var _0xad45=function(_0x3341ee,_0xafd0a3){_0x3341ee=_0x3341ee-0x0;var _0x29afd4=_0xd45a[_0x3341ee];return _0x29afd4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad45('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xad45('0x1'));var moment=require(_0xad45('0x2'));var BPromise=require(_0xad45('0x3'));var Mustache=require(_0xad45('0x4'));var util=require(_0xad45('0x5'));var path=require(_0xad45('0x6'));var sox=require(_0xad45('0x7'));var csv=require(_0xad45('0x8'));var ejs=require(_0xad45('0x9'));var fs=require('fs');var fs_extra=require(_0xad45('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xad45('0xb'));var deskjs=require(_0xad45('0xc'));var toCsv=require(_0xad45('0x8'));var querystring=require('querystring');var Papa=require(_0xad45('0xd'));var Redis=require('ioredis');var authService=require(_0xad45('0xe'));var qs=require(_0xad45('0xf'));var as=require(_0xad45('0x10'));var hardwareService=require(_0xad45('0x11'));var logger=require(_0xad45('0x12'))('api');var utils=require(_0xad45('0x13'));var config=require(_0xad45('0x14'));var licenseUtil=require(_0xad45('0x15'));var db=require(_0xad45('0x16'))['db'];function respondWithStatusCode(_0x2f69d3,_0x560b66){_0x560b66=_0x560b66||0xcc;return function(_0x22f240){if(_0x22f240){return _0x2f69d3[_0xad45('0x17')](_0x560b66);}return _0x2f69d3[_0xad45('0x18')](_0x560b66)[_0xad45('0x19')]();};}function respondWithResult(_0x1bc972,_0x306bee){_0x306bee=_0x306bee||0xc8;return function(_0x557ba0){if(_0x557ba0){return _0x1bc972['status'](_0x306bee)[_0xad45('0x1a')](_0x557ba0);}};}function respondWithFilteredResult(_0x71319b,_0x4f6f82){return function(_0x384b96){if(_0x384b96){var _0x53c197=typeof _0x4f6f82[_0xad45('0x1b')]===_0xad45('0x1c')&&typeof _0x4f6f82['limit']===_0xad45('0x1c');var _0x386af7=_0x384b96[_0xad45('0x1d')];var _0x9e8d20=_0x53c197?0x0:_0x4f6f82[_0xad45('0x1b')];var _0x1c31ef=_0x53c197?_0x384b96[_0xad45('0x1d')]:_0x4f6f82[_0xad45('0x1b')]+_0x4f6f82[_0xad45('0x1e')];var _0x2cec43;if(_0x1c31ef>=_0x386af7){_0x1c31ef=_0x386af7;_0x2cec43=0xc8;}else{_0x2cec43=0xce;}_0x71319b[_0xad45('0x18')](_0x2cec43);return _0x71319b[_0xad45('0x1f')](_0xad45('0x20'),_0x9e8d20+'-'+_0x1c31ef+'/'+_0x386af7)[_0xad45('0x1a')](_0x384b96);}return null;};}function patchUpdates(_0x232c3f){return function(_0xfd94b3){try{jsonpatch[_0xad45('0x21')](_0xfd94b3,_0x232c3f,!![]);}catch(_0x3c8c65){return BPromise[_0xad45('0x22')](_0x3c8c65);}return _0xfd94b3[_0xad45('0x23')]();};}function saveUpdates(_0x451a45,_0x3872a6){return function(_0x44c3e3){if(_0x44c3e3){return _0x44c3e3['update'](_0x451a45)['then'](function(_0x4dbbd4){return _0x4dbbd4;});}return null;};}function removeEntity(_0x1f3daf,_0x3ef018){return function(_0x5f28a8){if(_0x5f28a8){return _0x5f28a8[_0xad45('0x24')]()['then'](function(){_0x1f3daf['status'](0xcc)[_0xad45('0x19')]();});}};}function handleEntityNotFound(_0x4e72ff,_0x5b6919){return function(_0x359b40){if(!_0x359b40){_0x4e72ff[_0xad45('0x17')](0x194);}return _0x359b40;};}function handleError(_0x59f399,_0x1496ee){_0x1496ee=_0x1496ee||0x1f4;return function(_0x59a91e){logger[_0xad45('0x25')](_0x59a91e[_0xad45('0x26')]);if(_0x59a91e[_0xad45('0x27')]){delete _0x59a91e[_0xad45('0x27')];}_0x59f399['status'](_0x1496ee)[_0xad45('0x28')](_0x59a91e);};}exports[_0xad45('0x29')]=function(_0x137124,_0x3ba2b3){var _0x4260d5={},_0xfaa26b={},_0xc5549e={'count':0x0,'rows':[]};var _0x55a4dd=_[_0xad45('0x2a')](db[_0xad45('0x2b')][_0xad45('0x2c')],function(_0x5a9575){return{'name':_0x5a9575[_0xad45('0x2d')],'type':_0x5a9575[_0xad45('0x2e')]['key']};});_0xfaa26b['model']=_[_0xad45('0x2a')](_0x55a4dd,_0xad45('0x27'));_0xfaa26b[_0xad45('0x2f')]=_[_0xad45('0x30')](_0x137124['query']);_0xfaa26b[_0xad45('0x31')]=_[_0xad45('0x32')](_0xfaa26b['model'],_0xfaa26b[_0xad45('0x2f')]);_0x4260d5['attributes']=_['intersection'](_0xfaa26b[_0xad45('0x33')],qs['fields'](_0x137124[_0xad45('0x2f')][_0xad45('0x34')]));_0x4260d5['attributes']=_0x4260d5[_0xad45('0x35')][_0xad45('0x36')]?_0x4260d5[_0xad45('0x35')]:_0xfaa26b[_0xad45('0x33')];if(!_0x137124['query'][_0xad45('0x37')](_0xad45('0x38'))){_0x4260d5['limit']=qs[_0xad45('0x1e')](_0x137124[_0xad45('0x2f')][_0xad45('0x1e')]);_0x4260d5['offset']=qs['offset'](_0x137124[_0xad45('0x2f')]['offset']);}_0x4260d5['order']=qs[_0xad45('0x39')](_0x137124[_0xad45('0x2f')][_0xad45('0x39')]);_0x4260d5[_0xad45('0x3a')]=qs['filters'](_['pick'](_0x137124[_0xad45('0x2f')],_0xfaa26b[_0xad45('0x31')]),_0x55a4dd);if(_0x137124[_0xad45('0x2f')][_0xad45('0x3b')]){_0x4260d5[_0xad45('0x3a')]=_['merge'](_0x4260d5['where'],{'$or':_[_0xad45('0x2a')](_0x55a4dd,function(_0x7bf743){if(_0x7bf743[_0xad45('0x2e')]!==_0xad45('0x3c')){var _0xff133b={};_0xff133b[_0x7bf743[_0xad45('0x27')]]={'$like':'%'+_0x137124[_0xad45('0x2f')]['filter']+'%'};return _0xff133b;}})});}_0x4260d5=_[_0xad45('0x3d')]({},_0x4260d5,_0x137124['options']);var _0x4c7479={'where':_0x4260d5['where']};return db[_0xad45('0x2b')][_0xad45('0x1d')](_0x4c7479)[_0xad45('0x3e')](function(_0x538a00){_0xc5549e['count']=_0x538a00;if(_0x137124[_0xad45('0x2f')]['includeAll']){_0x4260d5[_0xad45('0x3f')]=[{'all':!![]}];}return db[_0xad45('0x2b')][_0xad45('0x40')](_0x4260d5);})[_0xad45('0x3e')](function(_0x137ebf){_0xc5549e['rows']=_0x137ebf;return _0xc5549e;})[_0xad45('0x3e')](respondWithFilteredResult(_0x3ba2b3,_0x4260d5))['catch'](handleError(_0x3ba2b3,null));};exports[_0xad45('0x41')]=function(_0x49f26c,_0x1c524a){var _0x34b280={'raw':!![],'where':{'id':_0x49f26c[_0xad45('0x42')]['id']}},_0x10dbfb={};_0x10dbfb[_0xad45('0x33')]=_[_0xad45('0x30')](db[_0xad45('0x2b')]['rawAttributes']);_0x10dbfb[_0xad45('0x2f')]=_[_0xad45('0x30')](_0x49f26c[_0xad45('0x2f')]);_0x10dbfb[_0xad45('0x31')]=_[_0xad45('0x32')](_0x10dbfb['model'],_0x10dbfb['query']);_0x34b280[_0xad45('0x35')]=_[_0xad45('0x32')](_0x10dbfb['model'],qs[_0xad45('0x34')](_0x49f26c[_0xad45('0x2f')][_0xad45('0x34')]));_0x34b280[_0xad45('0x35')]=_0x34b280[_0xad45('0x35')][_0xad45('0x36')]?_0x34b280['attributes']:_0x10dbfb[_0xad45('0x33')];if(_0x49f26c[_0xad45('0x2f')][_0xad45('0x43')]){_0x34b280[_0xad45('0x3f')]=[{'all':!![]}];}_0x34b280=_[_0xad45('0x3d')]({},_0x34b280,_0x49f26c['options']);return db['Dynamics365Field'][_0xad45('0x44')](_0x34b280)[_0xad45('0x3e')](handleEntityNotFound(_0x1c524a,null))[_0xad45('0x3e')](respondWithResult(_0x1c524a,null))['catch'](handleError(_0x1c524a,null));};exports[_0xad45('0x45')]=function(_0x587cc1,_0x45d6ad){return db[_0xad45('0x2b')][_0xad45('0x45')](_0x587cc1[_0xad45('0x46')],{})[_0xad45('0x3e')](respondWithResult(_0x45d6ad,0xc9))[_0xad45('0x47')](handleError(_0x45d6ad,null));};exports[_0xad45('0x48')]=function(_0x1d6170,_0x26ad62){if(_0x1d6170[_0xad45('0x46')]['id']){delete _0x1d6170['body']['id'];}return db['Dynamics365Field'][_0xad45('0x44')]({'where':{'id':_0x1d6170[_0xad45('0x42')]['id']}})[_0xad45('0x3e')](handleEntityNotFound(_0x26ad62,null))['then'](saveUpdates(_0x1d6170[_0xad45('0x46')],null))['then'](respondWithResult(_0x26ad62,null))['catch'](handleError(_0x26ad62,null));};exports['destroy']=function(_0x95acbf,_0x4f8292){return db[_0xad45('0x2b')][_0xad45('0x44')]({'where':{'id':_0x95acbf[_0xad45('0x42')]['id']}})[_0xad45('0x3e')](handleEntityNotFound(_0x4f8292,null))[_0xad45('0x3e')](removeEntity(_0x4f8292,null))[_0xad45('0x47')](handleError(_0x4f8292,null));}; \ No newline at end of file +var _0x32e2=['where','merge','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','rimraf','zip-dir','request-promise','bluebird','util','path','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/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','Content-Range','apply','reject','save','update','destroy','then','end','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x3ac5e2,_0x3e9e01){var _0x297b42=function(_0x16cbfc){while(--_0x16cbfc){_0x3ac5e2['push'](_0x3ac5e2['shift']());}};_0x297b42(++_0x3e9e01);}(_0x32e2,0xdc));var _0x232e=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0x32e2[_0x36b400];return _0x4d47bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x232e('0x0'));var zipdir=require(_0x232e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x232e('0x2'));var moment=require('moment');var BPromise=require(_0x232e('0x3'));var Mustache=require('mustache');var util=require(_0x232e('0x4'));var path=require(_0x232e('0x5'));var sox=require('sox');var csv=require(_0x232e('0x6'));var ejs=require(_0x232e('0x7'));var fs=require('fs');var fs_extra=require(_0x232e('0x8'));var _=require(_0x232e('0x9'));var squel=require(_0x232e('0xa'));var crypto=require('crypto');var jsforce=require(_0x232e('0xb'));var deskjs=require(_0x232e('0xc'));var toCsv=require(_0x232e('0x6'));var querystring=require(_0x232e('0xd'));var Papa=require(_0x232e('0xe'));var Redis=require('ioredis');var authService=require(_0x232e('0xf'));var qs=require(_0x232e('0x10'));var as=require(_0x232e('0x11'));var hardwareService=require(_0x232e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x232e('0x13'));var config=require(_0x232e('0x14'));var licenseUtil=require(_0x232e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11fe4a,_0x157e51){_0x157e51=_0x157e51||0xcc;return function(_0x18c130){if(_0x18c130){return _0x11fe4a[_0x232e('0x16')](_0x157e51);}return _0x11fe4a[_0x232e('0x17')](_0x157e51)['end']();};}function respondWithResult(_0xee56e4,_0x2f396c){_0x2f396c=_0x2f396c||0xc8;return function(_0x36c019){if(_0x36c019){return _0xee56e4[_0x232e('0x17')](_0x2f396c)[_0x232e('0x18')](_0x36c019);}};}function respondWithFilteredResult(_0x72d84d,_0x5273d2){return function(_0x337226){if(_0x337226){var _0x2c27dd=typeof _0x5273d2[_0x232e('0x19')]==='undefined'&&typeof _0x5273d2['limit']==='undefined';var _0xa57f32=_0x337226[_0x232e('0x1a')];var _0x527945=_0x2c27dd?0x0:_0x5273d2[_0x232e('0x19')];var _0xbf564d=_0x2c27dd?_0x337226[_0x232e('0x1a')]:_0x5273d2[_0x232e('0x19')]+_0x5273d2[_0x232e('0x1b')];var _0x23738d;if(_0xbf564d>=_0xa57f32){_0xbf564d=_0xa57f32;_0x23738d=0xc8;}else{_0x23738d=0xce;}_0x72d84d[_0x232e('0x17')](_0x23738d);return _0x72d84d['set'](_0x232e('0x1c'),_0x527945+'-'+_0xbf564d+'/'+_0xa57f32)[_0x232e('0x18')](_0x337226);}return null;};}function patchUpdates(_0x1d4caf){return function(_0x3facb4){try{jsonpatch[_0x232e('0x1d')](_0x3facb4,_0x1d4caf,!![]);}catch(_0xa8df06){return BPromise[_0x232e('0x1e')](_0xa8df06);}return _0x3facb4[_0x232e('0x1f')]();};}function saveUpdates(_0x44c251,_0x5bd292){return function(_0x167535){if(_0x167535){return _0x167535[_0x232e('0x20')](_0x44c251)['then'](function(_0x100fad){return _0x100fad;});}return null;};}function removeEntity(_0x2d3705,_0x12aeb9){return function(_0xf3079d){if(_0xf3079d){return _0xf3079d[_0x232e('0x21')]()[_0x232e('0x22')](function(){_0x2d3705['status'](0xcc)[_0x232e('0x23')]();});}};}function handleEntityNotFound(_0x3e30db,_0xf3f433){return function(_0x26ee4c){if(!_0x26ee4c){_0x3e30db[_0x232e('0x16')](0x194);}return _0x26ee4c;};}function handleError(_0x3b4052,_0x1042b1){_0x1042b1=_0x1042b1||0x1f4;return function(_0x5f1222){logger['error'](_0x5f1222['stack']);if(_0x5f1222[_0x232e('0x24')]){delete _0x5f1222[_0x232e('0x24')];}_0x3b4052['status'](_0x1042b1)[_0x232e('0x25')](_0x5f1222);};}exports['index']=function(_0x462b33,_0x397c8d){var _0x3d13b9={},_0x26552d={},_0x34fbb8={'count':0x0,'rows':[]};var _0x363903=_[_0x232e('0x26')](db[_0x232e('0x27')][_0x232e('0x28')],function(_0x10c9c5){return{'name':_0x10c9c5[_0x232e('0x29')],'type':_0x10c9c5[_0x232e('0x2a')][_0x232e('0x2b')]};});_0x26552d['model']=_['map'](_0x363903,_0x232e('0x24'));_0x26552d[_0x232e('0x2c')]=_[_0x232e('0x2d')](_0x462b33[_0x232e('0x2c')]);_0x26552d[_0x232e('0x2e')]=_[_0x232e('0x2f')](_0x26552d[_0x232e('0x30')],_0x26552d['query']);_0x3d13b9[_0x232e('0x31')]=_['intersection'](_0x26552d[_0x232e('0x30')],qs[_0x232e('0x32')](_0x462b33[_0x232e('0x2c')][_0x232e('0x32')]));_0x3d13b9['attributes']=_0x3d13b9[_0x232e('0x31')]['length']?_0x3d13b9['attributes']:_0x26552d[_0x232e('0x30')];if(!_0x462b33[_0x232e('0x2c')][_0x232e('0x33')](_0x232e('0x34'))){_0x3d13b9[_0x232e('0x1b')]=qs[_0x232e('0x1b')](_0x462b33[_0x232e('0x2c')][_0x232e('0x1b')]);_0x3d13b9[_0x232e('0x19')]=qs['offset'](_0x462b33[_0x232e('0x2c')][_0x232e('0x19')]);}_0x3d13b9['order']=qs[_0x232e('0x35')](_0x462b33['query'][_0x232e('0x35')]);_0x3d13b9['where']=qs[_0x232e('0x2e')](_[_0x232e('0x36')](_0x462b33[_0x232e('0x2c')],_0x26552d['filters']),_0x363903);if(_0x462b33[_0x232e('0x2c')][_0x232e('0x37')]){_0x3d13b9[_0x232e('0x38')]=_[_0x232e('0x39')](_0x3d13b9['where'],{'$or':_[_0x232e('0x26')](_0x363903,function(_0x326579){if(_0x326579[_0x232e('0x2a')]!=='VIRTUAL'){var _0x5af201={};_0x5af201[_0x326579[_0x232e('0x24')]]={'$like':'%'+_0x462b33[_0x232e('0x2c')][_0x232e('0x37')]+'%'};return _0x5af201;}})});}_0x3d13b9=_[_0x232e('0x39')]({},_0x3d13b9,_0x462b33['options']);var _0x2ee7e8={'where':_0x3d13b9[_0x232e('0x38')]};return db[_0x232e('0x27')][_0x232e('0x1a')](_0x2ee7e8)[_0x232e('0x22')](function(_0x1e288b){_0x34fbb8[_0x232e('0x1a')]=_0x1e288b;if(_0x462b33['query'][_0x232e('0x3a')]){_0x3d13b9[_0x232e('0x3b')]=[{'all':!![]}];}return db[_0x232e('0x27')][_0x232e('0x3c')](_0x3d13b9);})['then'](function(_0x213dee){_0x34fbb8[_0x232e('0x3d')]=_0x213dee;return _0x34fbb8;})['then'](respondWithFilteredResult(_0x397c8d,_0x3d13b9))[_0x232e('0x3e')](handleError(_0x397c8d,null));};exports[_0x232e('0x3f')]=function(_0x33258f,_0x10e8c9){var _0x1cc564={'raw':!![],'where':{'id':_0x33258f['params']['id']}},_0xcfdd91={};_0xcfdd91[_0x232e('0x30')]=_['keys'](db['Dynamics365Field'][_0x232e('0x28')]);_0xcfdd91[_0x232e('0x2c')]=_[_0x232e('0x2d')](_0x33258f[_0x232e('0x2c')]);_0xcfdd91[_0x232e('0x2e')]=_[_0x232e('0x2f')](_0xcfdd91[_0x232e('0x30')],_0xcfdd91['query']);_0x1cc564[_0x232e('0x31')]=_[_0x232e('0x2f')](_0xcfdd91[_0x232e('0x30')],qs[_0x232e('0x32')](_0x33258f[_0x232e('0x2c')][_0x232e('0x32')]));_0x1cc564[_0x232e('0x31')]=_0x1cc564[_0x232e('0x31')][_0x232e('0x40')]?_0x1cc564['attributes']:_0xcfdd91['model'];if(_0x33258f['query'][_0x232e('0x3a')]){_0x1cc564[_0x232e('0x3b')]=[{'all':!![]}];}_0x1cc564=_[_0x232e('0x39')]({},_0x1cc564,_0x33258f['options']);return db[_0x232e('0x27')][_0x232e('0x41')](_0x1cc564)['then'](handleEntityNotFound(_0x10e8c9,null))['then'](respondWithResult(_0x10e8c9,null))[_0x232e('0x3e')](handleError(_0x10e8c9,null));};exports['create']=function(_0x66e61e,_0xbd8dea){return db[_0x232e('0x27')][_0x232e('0x42')](_0x66e61e[_0x232e('0x43')],{})['then'](respondWithResult(_0xbd8dea,0xc9))['catch'](handleError(_0xbd8dea,null));};exports['update']=function(_0x527722,_0x14f371){if(_0x527722[_0x232e('0x43')]['id']){delete _0x527722[_0x232e('0x43')]['id'];}return db['Dynamics365Field'][_0x232e('0x41')]({'where':{'id':_0x527722[_0x232e('0x44')]['id']}})['then'](handleEntityNotFound(_0x14f371,null))[_0x232e('0x22')](saveUpdates(_0x527722[_0x232e('0x43')],null))[_0x232e('0x22')](respondWithResult(_0x14f371,null))['catch'](handleError(_0x14f371,null));};exports[_0x232e('0x21')]=function(_0x41a5be,_0x122890){return db[_0x232e('0x27')]['find']({'where':{'id':_0x41a5be[_0x232e('0x44')]['id']}})['then'](handleEntityNotFound(_0x122890,null))[_0x232e('0x22')](removeEntity(_0x122890,null))[_0x232e('0x3e')](handleError(_0x122890,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2db4fb1..3afdd41 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 _0x868f=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x13f5fc,_0x393965){var _0x1afa25=function(_0x492cd6){while(--_0x492cd6){_0x13f5fc['push'](_0x13f5fc['shift']());}};_0x1afa25(++_0x393965);}(_0x868f,0x1e1));var _0xf868=function(_0x11ac31,_0x4863a2){_0x11ac31=_0x11ac31-0x0;var _0x528099=_0x868f[_0x11ac31];return _0x528099;};'use strict';var _=require(_0xf868('0x0'));var util=require(_0xf868('0x1'));var logger=require(_0xf868('0x2'))('api');var moment=require(_0xf868('0x3'));var BPromise=require(_0xf868('0x4'));var rp=require(_0xf868('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf868('0x6'));var config=require(_0xf868('0x7'));var attributes=require(_0xf868('0x8'));module[_0xf868('0x9')]=function(_0x12d030,_0x1db444){return _0x12d030[_0xf868('0xa')]('Dynamics365Field',attributes,{'tableName':_0xf868('0xb'),'paranoid':![],'indexes':[{'name':_0xf868('0xc'),'fields':[_0xf868('0xd'),_0xf868('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x232a=['util','../../config/logger','api','moment','request-promise','../../config/environment','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash'];(function(_0x3851c0,_0x34164d){var _0xf6f68b=function(_0x2b1da3){while(--_0x2b1da3){_0x3851c0['push'](_0x3851c0['shift']());}};_0xf6f68b(++_0x34164d);}(_0x232a,0xa7));var _0xa232=function(_0x287dc2,_0x5d488c){_0x287dc2=_0x287dc2-0x0;var _0xc10e1a=_0x232a[_0x287dc2];return _0xc10e1a;};'use strict';var _=require(_0xa232('0x0'));var util=require(_0xa232('0x1'));var logger=require(_0xa232('0x2'))(_0xa232('0x3'));var moment=require(_0xa232('0x4'));var BPromise=require('bluebird');var rp=require(_0xa232('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa232('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0xa232('0x7')]=function(_0x544b65,_0x5cc833){return _0x544b65['define'](_0xa232('0x8'),attributes,{'tableName':_0xa232('0x9'),'paranoid':![],'indexes':[{'name':_0xa232('0xa'),'fields':[_0xa232('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index c6d5ae1..d3c4817 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 _0x1fdc=['jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xb23c9f,_0x12412f){var _0x2e5230=function(_0x4a5f61){while(--_0x4a5f61){_0xb23c9f['push'](_0xb23c9f['shift']());}};_0x2e5230(++_0x12412f);}(_0x1fdc,0x117));var _0xc1fd=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x1fdc[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xc1fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc1fd('0x1'));var rs=require(_0xc1fd('0x2'));var fs=require('fs');var Redis=require(_0xc1fd('0x3'));var db=require(_0xc1fd('0x4'))['db'];var utils=require(_0xc1fd('0x5'));var logger=require(_0xc1fd('0x6'))(_0xc1fd('0x7'));var config=require(_0xc1fd('0x8'));var jayson=require(_0xc1fd('0x9'));var client=jayson[_0xc1fd('0xa')][_0xc1fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a2dd7,_0x476eac,_0x2c5c9b){return new BPromise(function(_0x1a14ff,_0x21602d){return client[_0xc1fd('0xc')](_0x5a2dd7,_0x2c5c9b)[_0xc1fd('0xd')](function(_0x2805e7){logger[_0xc1fd('0xe')](_0xc1fd('0xf'),_0x476eac,'request\x20sent');logger[_0xc1fd('0x10')](_0xc1fd('0x11'),_0x476eac,_0xc1fd('0x12'),JSON[_0xc1fd('0x13')](_0x2805e7));if(_0x2805e7['error']){if(_0x2805e7[_0xc1fd('0x14')]['code']===0x1f4){logger[_0xc1fd('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x476eac,_0x2805e7[_0xc1fd('0x14')][_0xc1fd('0x15')]);return _0x21602d(_0x2805e7[_0xc1fd('0x14')][_0xc1fd('0x15')]);}logger[_0xc1fd('0x14')](_0xc1fd('0xf'),_0x476eac,_0x2805e7[_0xc1fd('0x14')]['message']);return _0x1a14ff(_0x2805e7['error'][_0xc1fd('0x15')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x476eac,_0xc1fd('0x12'));_0x1a14ff(_0x2805e7[_0xc1fd('0x16')][_0xc1fd('0x15')]);}})[_0xc1fd('0x17')](function(_0x45ee0f){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x476eac,_0x45ee0f);_0x21602d(_0x45ee0f);});});} \ No newline at end of file +var _0x4a8d=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4a8d,0xd2));var _0xd4a8=function(_0x5e6e72,_0x557ff5){_0x5e6e72=_0x5e6e72-0x0;var _0x5d230b=_0x4a8d[_0x5e6e72];return _0x5d230b;};'use strict';var _=require(_0xd4a8('0x0'));var util=require(_0xd4a8('0x1'));var moment=require(_0xd4a8('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4a8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4a8('0x5'))(_0xd4a8('0x6'));var config=require(_0xd4a8('0x7'));var jayson=require(_0xd4a8('0x8'));var client=jayson[_0xd4a8('0x9')][_0xd4a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f4a78,_0x506cf9,_0x4012cb){return new BPromise(function(_0x2cc66e,_0x1bb87f){return client[_0xd4a8('0xb')](_0x1f4a78,_0x4012cb)[_0xd4a8('0xc')](function(_0xd128ac){logger[_0xd4a8('0xd')](_0xd4a8('0xe'),_0x506cf9,_0xd4a8('0xf'));logger['debug'](_0xd4a8('0x10'),_0x506cf9,_0xd4a8('0xf'),JSON[_0xd4a8('0x11')](_0xd128ac));if(_0xd128ac[_0xd4a8('0x12')]){if(_0xd128ac[_0xd4a8('0x12')]['code']===0x1f4){logger[_0xd4a8('0x12')](_0xd4a8('0xe'),_0x506cf9,_0xd128ac['error'][_0xd4a8('0x13')]);return _0x1bb87f(_0xd128ac['error']['message']);}logger[_0xd4a8('0x12')](_0xd4a8('0xe'),_0x506cf9,_0xd128ac['error'][_0xd4a8('0x13')]);return _0x2cc66e(_0xd128ac['error'][_0xd4a8('0x13')]);}else{logger[_0xd4a8('0xd')](_0xd4a8('0xe'),_0x506cf9,'request\x20sent');_0x2cc66e(_0xd128ac[_0xd4a8('0x14')][_0xd4a8('0x13')]);}})['catch'](function(_0x346c18){logger[_0xd4a8('0x12')](_0xd4a8('0xe'),_0x506cf9,_0x346c18);_0x1bb87f(_0x346c18);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 390ff70..fbdc833 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 _0xf606=['exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','/:id/configurations','put','update','delete','destroy'];(function(_0x586527,_0x2d828a){var _0x321bc7=function(_0x514c83){while(--_0x514c83){_0x586527['push'](_0x586527['shift']());}};_0x321bc7(++_0x2d828a);}(_0xf606,0xc9));var _0x6f60=function(_0x155c12,_0x928a07){_0x155c12=_0x155c12-0x0;var _0x3d26f4=_0xf606[_0x155c12];return _0x3d26f4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6f60('0x0'));var express=require(_0x6f60('0x1'));var router=express['Router']();var fs_extra=require(_0x6f60('0x2'));var auth=require(_0x6f60('0x3'));var interaction=require(_0x6f60('0x4'));var config=require('../../config/environment');var controller=require(_0x6f60('0x5'));router[_0x6f60('0x6')]('/',auth[_0x6f60('0x7')](),controller[_0x6f60('0x8')]);router[_0x6f60('0x6')](_0x6f60('0x9'),auth[_0x6f60('0x7')](),controller[_0x6f60('0xa')]);router[_0x6f60('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6f60('0x6')](_0x6f60('0xb'),auth['isAuthenticated'](),controller[_0x6f60('0xc')]);router['post']('/',auth[_0x6f60('0x7')](),controller['create']);router[_0x6f60('0xd')](_0x6f60('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x6f60('0xf')](_0x6f60('0x9'),auth[_0x6f60('0x7')](),controller[_0x6f60('0x10')]);router[_0x6f60('0x11')](_0x6f60('0x9'),auth[_0x6f60('0x7')](),controller[_0x6f60('0x12')]);module[_0x6f60('0x13')]=router; \ No newline at end of file +var _0xc2c2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2cad64,_0x2a699e){var _0x16504b=function(_0x290937){while(--_0x290937){_0x2cad64['push'](_0x2cad64['shift']());}};_0x16504b(++_0x2a699e);}(_0xc2c2,0x154));var _0x2c2c=function(_0x3dbda9,_0x12232c){_0x3dbda9=_0x3dbda9-0x0;var _0x12dd01=_0xc2c2[_0x3dbda9];return _0x12dd01;};'use strict';var multer=require(_0x2c2c('0x0'));var util=require(_0x2c2c('0x1'));var path=require(_0x2c2c('0x2'));var timeout=require(_0x2c2c('0x3'));var express=require(_0x2c2c('0x4'));var router=express[_0x2c2c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2c2c('0x6'));var interaction=require(_0x2c2c('0x7'));var config=require(_0x2c2c('0x8'));var controller=require(_0x2c2c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2c2c('0xa')]);router['get'](_0x2c2c('0xb'),auth[_0x2c2c('0xc')](),controller[_0x2c2c('0xd')]);router[_0x2c2c('0xe')](_0x2c2c('0xf'),auth[_0x2c2c('0xc')](),controller[_0x2c2c('0x10')]);router[_0x2c2c('0xe')]('/:id/fields',auth[_0x2c2c('0xc')](),controller['getFields']);router[_0x2c2c('0x11')]('/',auth[_0x2c2c('0xc')](),controller[_0x2c2c('0x12')]);router[_0x2c2c('0x11')]('/:id/configurations',auth[_0x2c2c('0xc')](),controller['addConfiguration']);router[_0x2c2c('0x13')](_0x2c2c('0xb'),auth[_0x2c2c('0xc')](),controller['update']);router[_0x2c2c('0x14')]('/:id',auth[_0x2c2c('0xc')](),controller[_0x2c2c('0x15')]);module[_0x2c2c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index eeef57a..3bfd30f 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 _0x6a55=['STRING','sequelize'];(function(_0x1dd408,_0x3e8932){var _0x39bd4b=function(_0x317087){while(--_0x317087){_0x1dd408['push'](_0x1dd408['shift']());}};_0x39bd4b(++_0x3e8932);}(_0x6a55,0xdb));var _0x56a5=function(_0x208bc9,_0x4f36f6){_0x208bc9=_0x208bc9-0x0;var _0x2675a8=_0x6a55[_0x208bc9];return _0x2675a8;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x56a5('0x1')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x56a5('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x065e=['sequelize','STRING','username'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x065e,0x1a7));var _0xe065=function(_0xc3212e,_0x30e7ec){_0xc3212e=_0xc3212e-0x0;var _0x2fc81e=_0x065e[_0xc3212e];return _0x2fc81e;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe065('0x1')],'unique':_0xe065('0x2')},'apiKey':{'type':Sequelize[_0xe065('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 4a3493b..10e369a 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 _0x6324=['then','destroy','end','error','name','send','index','FreshdeskAccount','key','model','map','keys','query','intersection','fields','attributes','length','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','requester','subject','description','priority','source','ticket_type','group','company','remove','includes','custom_text','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x781aa2,_0x27b779){var _0x6c19f3=function(_0x3f14a3){while(--_0x3f14a3){_0x781aa2['push'](_0x781aa2['shift']());}};_0x6c19f3(++_0x27b779);}(_0x6324,0x142));var _0x4632=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0x6324[_0x545a3a];return _0x5a5493;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4632('0x18'));function respondWithStatusCode(_0x499d88,_0x4719f7){_0x4719f7=_0x4719f7||0xcc;return function(_0x299073){if(_0x299073){return _0x499d88[_0x4632('0x19')](_0x4719f7);}return _0x499d88[_0x4632('0x1a')](_0x4719f7)['end']();};}function respondWithResult(_0x3ba361,_0x255882){_0x255882=_0x255882||0xc8;return function(_0x3b9901){if(_0x3b9901){return _0x3ba361[_0x4632('0x1a')](_0x255882)[_0x4632('0x1b')](_0x3b9901);}};}function respondWithFilteredResult(_0x5438ab,_0x47b349){return function(_0x2fd7ae){if(_0x2fd7ae){var _0x38bedd=typeof _0x47b349[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x47b349['limit']===_0x4632('0x1d');var _0x113872=_0x2fd7ae[_0x4632('0x1e')];var _0x5b28b7=_0x38bedd?0x0:_0x47b349[_0x4632('0x1c')];var _0x1894bb=_0x38bedd?_0x2fd7ae['count']:_0x47b349['offset']+_0x47b349[_0x4632('0x1f')];var _0x3cf2bd;if(_0x1894bb>=_0x113872){_0x1894bb=_0x113872;_0x3cf2bd=0xc8;}else{_0x3cf2bd=0xce;}_0x5438ab[_0x4632('0x1a')](_0x3cf2bd);return _0x5438ab[_0x4632('0x20')](_0x4632('0x21'),_0x5b28b7+'-'+_0x1894bb+'/'+_0x113872)[_0x4632('0x1b')](_0x2fd7ae);}return null;};}function patchUpdates(_0x9ab826){return function(_0x468ccb){try{jsonpatch[_0x4632('0x22')](_0x468ccb,_0x9ab826,!![]);}catch(_0x3ea0d1){return BPromise[_0x4632('0x23')](_0x3ea0d1);}return _0x468ccb[_0x4632('0x24')]();};}function saveUpdates(_0x2ca6a5,_0x263907){return function(_0x4cfebc){if(_0x4cfebc){return _0x4cfebc[_0x4632('0x25')](_0x2ca6a5)[_0x4632('0x26')](function(_0x3537ed){return _0x3537ed;});}return null;};}function removeEntity(_0x380a9f,_0x1e1b86){return function(_0x38cbbc){if(_0x38cbbc){return _0x38cbbc[_0x4632('0x27')]()[_0x4632('0x26')](function(){_0x380a9f[_0x4632('0x1a')](0xcc)[_0x4632('0x28')]();});}};}function handleEntityNotFound(_0x1b8de0,_0x4af026){return function(_0x2e3428){if(!_0x2e3428){_0x1b8de0[_0x4632('0x19')](0x194);}return _0x2e3428;};}function handleError(_0x372679,_0x22d0f5){_0x22d0f5=_0x22d0f5||0x1f4;return function(_0x2a0b11){logger[_0x4632('0x29')](_0x2a0b11['stack']);if(_0x2a0b11['name']){delete _0x2a0b11[_0x4632('0x2a')];}_0x372679[_0x4632('0x1a')](_0x22d0f5)[_0x4632('0x2b')](_0x2a0b11);};}exports[_0x4632('0x2c')]=function(_0x34079f,_0x119d1b){var _0x3570b2={},_0x5e2ee4={},_0x42d505={'count':0x0,'rows':[]};var _0x135fd2=_['map'](db[_0x4632('0x2d')]['rawAttributes'],function(_0x6599ad){return{'name':_0x6599ad['fieldName'],'type':_0x6599ad['type'][_0x4632('0x2e')]};});_0x5e2ee4[_0x4632('0x2f')]=_[_0x4632('0x30')](_0x135fd2,'name');_0x5e2ee4['query']=_[_0x4632('0x31')](_0x34079f[_0x4632('0x32')]);_0x5e2ee4['filters']=_['intersection'](_0x5e2ee4[_0x4632('0x2f')],_0x5e2ee4[_0x4632('0x32')]);_0x3570b2['attributes']=_[_0x4632('0x33')](_0x5e2ee4[_0x4632('0x2f')],qs[_0x4632('0x34')](_0x34079f[_0x4632('0x32')][_0x4632('0x34')]));_0x3570b2['attributes']=_0x3570b2[_0x4632('0x35')][_0x4632('0x36')]?_0x3570b2['attributes']:_0x5e2ee4['model'];if(!_0x34079f[_0x4632('0x32')]['hasOwnProperty']('nolimit')){_0x3570b2[_0x4632('0x1f')]=qs['limit'](_0x34079f[_0x4632('0x32')][_0x4632('0x1f')]);_0x3570b2[_0x4632('0x1c')]=qs['offset'](_0x34079f[_0x4632('0x32')][_0x4632('0x1c')]);}_0x3570b2[_0x4632('0x37')]=qs[_0x4632('0x38')](_0x34079f[_0x4632('0x32')]['sort']);_0x3570b2['where']=qs[_0x4632('0x39')](_[_0x4632('0x3a')](_0x34079f[_0x4632('0x32')],_0x5e2ee4['filters']),_0x135fd2);if(_0x34079f['query']['filter']){_0x3570b2[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0x3570b2['where'],{'$or':_[_0x4632('0x30')](_0x135fd2,function(_0x20a700){if(_0x20a700[_0x4632('0x3d')]!==_0x4632('0x3e')){var _0x2309f1={};_0x2309f1[_0x20a700[_0x4632('0x2a')]]={'$like':'%'+_0x34079f[_0x4632('0x32')][_0x4632('0x3f')]+'%'};return _0x2309f1;}})});}_0x3570b2=_[_0x4632('0x3c')]({},_0x3570b2,_0x34079f[_0x4632('0x40')]);var _0x1fd3f1={'where':_0x3570b2[_0x4632('0x3b')]};return db['FreshdeskAccount'][_0x4632('0x1e')](_0x1fd3f1)[_0x4632('0x26')](function(_0x4c0e13){_0x42d505[_0x4632('0x1e')]=_0x4c0e13;if(_0x34079f[_0x4632('0x32')]['includeAll']){_0x3570b2[_0x4632('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x4632('0x42')](_0x3570b2);})[_0x4632('0x26')](function(_0x1bfb36){_0x42d505[_0x4632('0x43')]=_0x1bfb36;return _0x42d505;})['then'](respondWithFilteredResult(_0x119d1b,_0x3570b2))[_0x4632('0x44')](handleError(_0x119d1b,null));};exports[_0x4632('0x45')]=function(_0x23ef38,_0x279298){var _0x5cc716={'raw':![],'where':{'id':_0x23ef38[_0x4632('0x46')]['id']}},_0x5b3fa9={};_0x5b3fa9[_0x4632('0x2f')]=_[_0x4632('0x31')](db['FreshdeskAccount'][_0x4632('0x47')]);_0x5b3fa9[_0x4632('0x32')]=_[_0x4632('0x31')](_0x23ef38[_0x4632('0x32')]);_0x5b3fa9[_0x4632('0x39')]=_[_0x4632('0x33')](_0x5b3fa9[_0x4632('0x2f')],_0x5b3fa9['query']);_0x5cc716[_0x4632('0x35')]=_[_0x4632('0x33')](_0x5b3fa9[_0x4632('0x2f')],qs[_0x4632('0x34')](_0x23ef38[_0x4632('0x32')]['fields']));_0x5cc716['attributes']=_0x5cc716[_0x4632('0x35')][_0x4632('0x36')]?_0x5cc716[_0x4632('0x35')]:_0x5b3fa9[_0x4632('0x2f')];if(_0x23ef38['query'][_0x4632('0x48')]){_0x5cc716[_0x4632('0x41')]=[{'all':!![]}];}_0x5cc716=_[_0x4632('0x3c')]({},_0x5cc716,_0x23ef38[_0x4632('0x40')]);return db[_0x4632('0x2d')]['find'](_0x5cc716)[_0x4632('0x26')](handleEntityNotFound(_0x279298,null))[_0x4632('0x26')](respondWithResult(_0x279298,null))[_0x4632('0x44')](handleError(_0x279298,null));};exports[_0x4632('0x49')]=function(_0x3676fa,_0x2eb8b0){return db[_0x4632('0x2d')][_0x4632('0x49')](_0x3676fa[_0x4632('0x4a')],{})[_0x4632('0x26')](respondWithResult(_0x2eb8b0,0xc9))[_0x4632('0x44')](handleError(_0x2eb8b0,null));};exports['update']=function(_0xc3ffd0,_0x1ccadb){if(_0xc3ffd0[_0x4632('0x4a')]['id']){delete _0xc3ffd0['body']['id'];}return db[_0x4632('0x2d')][_0x4632('0x4b')]({'where':{'id':_0xc3ffd0[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x1ccadb,null))[_0x4632('0x26')](saveUpdates(_0xc3ffd0[_0x4632('0x4a')],null))[_0x4632('0x26')](respondWithResult(_0x1ccadb,null))[_0x4632('0x44')](handleError(_0x1ccadb,null));};exports[_0x4632('0x27')]=function(_0x1aa831,_0x4e89e3){return db[_0x4632('0x2d')][_0x4632('0x4b')]({'where':{'id':_0x1aa831['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x4e89e3,null))[_0x4632('0x26')](removeEntity(_0x4e89e3,null))[_0x4632('0x44')](handleError(_0x4e89e3,null));};exports[_0x4632('0x4c')]=function(_0x2c59f5,_0xfeeac0,_0x248dcf){var _0xf4880f={};var _0x31b42d={};var _0x1b66e0;var _0x3e66d8;return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x2c59f5[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0xfeeac0,null))[_0x4632('0x26')](function(_0x32cd35){if(_0x32cd35){_0x1b66e0=_0x32cd35;_0x31b42d[_0x4632('0x2f')]=_[_0x4632('0x31')](db[_0x4632('0x4e')]['rawAttributes']);_0x31b42d[_0x4632('0x32')]=_[_0x4632('0x31')](_0x2c59f5[_0x4632('0x32')]);_0x31b42d[_0x4632('0x39')]=_[_0x4632('0x33')](_0x31b42d[_0x4632('0x2f')],_0x31b42d['query']);_0xf4880f[_0x4632('0x35')]=_[_0x4632('0x33')](_0x31b42d[_0x4632('0x2f')],qs['fields'](_0x2c59f5[_0x4632('0x32')][_0x4632('0x34')]));_0xf4880f['attributes']=_0xf4880f[_0x4632('0x35')][_0x4632('0x36')]?_0xf4880f[_0x4632('0x35')]:_0x31b42d['model'];_0xf4880f[_0x4632('0x37')]=qs[_0x4632('0x38')](_0x2c59f5[_0x4632('0x32')][_0x4632('0x38')]);_0xf4880f[_0x4632('0x3b')]=qs[_0x4632('0x39')](_[_0x4632('0x3a')](_0x2c59f5[_0x4632('0x32')],_0x31b42d[_0x4632('0x39')]));if(_0x2c59f5[_0x4632('0x32')]['filter']){_0xf4880f[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0xf4880f['where'],{'$or':_[_0x4632('0x30')](_0xf4880f['attributes'],function(_0x48e942){var _0xa55d76={};_0xa55d76[_0x48e942]={'$like':'%'+_0x2c59f5[_0x4632('0x32')][_0x4632('0x3f')]+'%'};return _0xa55d76;})});}_0xf4880f=_[_0x4632('0x3c')]({},_0xf4880f,_0x2c59f5[_0x4632('0x40')]);return _0x1b66e0[_0x4632('0x4c')](_0xf4880f);}})[_0x4632('0x26')](function(_0x3e2849){if(_0x3e2849){_0x3e66d8=_0x3e2849[_0x4632('0x36')];if(!_0x2c59f5[_0x4632('0x32')][_0x4632('0x4f')](_0x4632('0x50'))){_0xf4880f[_0x4632('0x1f')]=qs[_0x4632('0x1f')](_0x2c59f5['query']['limit']);_0xf4880f[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x2c59f5[_0x4632('0x32')][_0x4632('0x1c')]);}return _0x1b66e0[_0x4632('0x4c')](_0xf4880f);}})[_0x4632('0x26')](function(_0x5b66ee){if(_0x5b66ee){return _0x5b66ee?{'count':_0x3e66d8,'rows':_0x5b66ee}:null;}})[_0x4632('0x26')](respondWithResult(_0xfeeac0,null))[_0x4632('0x44')](handleError(_0xfeeac0,null));};exports[_0x4632('0x51')]=function(_0x2e4d57,_0x5d1994,_0x529be1){if(_0x2e4d57[_0x4632('0x4a')]['id']){delete _0x2e4d57['body']['id'];}return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x2e4d57[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x5d1994,null))[_0x4632('0x26')](function(_0x5e5669){if(_0x5e5669){_0x2e4d57[_0x4632('0x4a')][_0x4632('0x52')]=_0x5e5669['id'];_0x2e4d57['body']['Subjects']=integrations[_0x4632('0x53')](_0x2e4d57[_0x4632('0x4a')][_0x4632('0x54')],_0x2e4d57[_0x4632('0x4a')]['type']);_0x2e4d57['body']['Descriptions']=integrations[_0x4632('0x55')](_0x2e4d57['body'][_0x4632('0x54')],_0x2e4d57[_0x4632('0x4a')][_0x4632('0x3d')]);return db[_0x4632('0x4e')][_0x4632('0x49')](_0x2e4d57[_0x4632('0x4a')],{'include':[{'model':db[_0x4632('0x56')],'as':_0x4632('0x57')},{'model':db[_0x4632('0x56')],'as':_0x4632('0x58')}]});}return null;})[_0x4632('0x26')](respondWithResult(_0x5d1994,null))[_0x4632('0x44')](handleError(_0x5d1994,null));};exports[_0x4632('0x59')]=function(_0x3d5e65,_0x461700,_0x1b2905){var _0x550c4d='';return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x3d5e65[_0x4632('0x46')]['id']},'attributes':['id',_0x4632('0x5a'),_0x4632('0x5b')]})[_0x4632('0x26')](handleEntityNotFound(_0x461700,null))[_0x4632('0x26')](function(_0x24151e){if(_0x24151e){_0x550c4d=_0x24151e[_0x4632('0x5a')];var _0x33561f=_0x550c4d[_0x4632('0x5c')](-0x1);if(_0x33561f==='/'){_0x550c4d=_0x550c4d[_0x4632('0x5d')](0x0,_0x550c4d[_0x4632('0x5e')](_0x33561f));}return rp({'method':'GET','uri':util[_0x4632('0x5f')](_0x4632('0x60'),_0x550c4d,_0x4632('0x61')),'headers':{'Authorization':util[_0x4632('0x5f')](_0x4632('0x62'),new Buffer(util[_0x4632('0x5f')]('%s:X',_0x24151e[_0x4632('0x5b')]))[_0x4632('0x63')]('base64'))},'json':!![]});}})[_0x4632('0x26')](function(_0x458688){if(_0x458688){var _0x879c8=[_0x4632('0x64'),_0x4632('0x65'),'agent',_0x4632('0x66'),_0x4632('0x1a'),_0x4632('0x67'),'group',_0x4632('0x68'),_0x4632('0x69'),_0x4632('0x6a'),_0x4632('0x6b')];_[_0x4632('0x6c')](_0x458688,function(_0x3a3f3a){return _0x879c8[_0x4632('0x6d')](_0x3a3f3a[_0x4632('0x2a')])||!_0x3a3f3a['default']&&_0x3a3f3a[_0x4632('0x3d')]!==_0x4632('0x6e')&&_0x3a3f3a[_0x4632('0x3d')]!=='custom_dropdown';});return{'count':_0x458688[_0x4632('0x36')],'rows':_[_0x4632('0x30')](_0x458688,function(_0x576d93){return{'id':_0x576d93['name'],'name':_0x576d93[_0x4632('0x6f')],'custom':!_0x576d93[_0x4632('0x70')],'options':_0x576d93['choices']?_[_0x4632('0x30')](_0x576d93[_0x4632('0x71')],function(_0x2f1f22){return{'name':_[_0x4632('0x72')](_0x2f1f22),'value':_0x2f1f22};}):[]};})};}})[_0x4632('0x26')](respondWithResult(_0x461700,null))[_0x4632('0x44')](function(_0x43edfd){var _0x130b52=_0x3d5e65['query'][_0x4632('0x73')]?0x1f4:_0x43edfd[_0x4632('0x74')]||0x1f4;logger[_0x4632('0x29')](_0x4632('0x75'),'getFields',_0x130b52,JSON[_0x4632('0x76')](_0x43edfd));delete _0x43edfd[_0x4632('0x2a')];if(_0x130b52===0x191){_0x130b52=0x190;}_0x461700[_0x4632('0x1a')](_0x130b52)[_0x4632('0x2b')](_0x3d5e65[_0x4632('0x32')]['test']?{'message':_0x4632('0x77'),'statusCode':_0x43edfd[_0x4632('0x74')]}:_0x43edfd);});}; \ No newline at end of file +var _0x25a3=['merge','options','FreshdeskAccount','includeAll','include','findAll','rows','catch','show','keys','create','body','params','find','findOne','pick','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','priority','ticket_type','group','company','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x25a3,0x121));var _0x325a=function(_0x3ac374,_0x4a5aca){_0x3ac374=_0x3ac374-0x0;var _0xc7b061=_0x25a3[_0x3ac374];return _0xc7b061;};'use strict';var emlformat=require(_0x325a('0x0'));var rimraf=require(_0x325a('0x1'));var zipdir=require(_0x325a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x325a('0x3'));var moment=require('moment');var BPromise=require(_0x325a('0x4'));var Mustache=require(_0x325a('0x5'));var util=require(_0x325a('0x6'));var path=require('path');var sox=require(_0x325a('0x7'));var csv=require(_0x325a('0x8'));var ejs=require(_0x325a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x325a('0xa'));var crypto=require(_0x325a('0xb'));var jsforce=require(_0x325a('0xc'));var deskjs=require(_0x325a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x325a('0xe'));var Redis=require(_0x325a('0xf'));var authService=require(_0x325a('0x10'));var qs=require(_0x325a('0x11'));var as=require(_0x325a('0x12'));var hardwareService=require(_0x325a('0x13'));var logger=require('../../config/logger')(_0x325a('0x14'));var utils=require(_0x325a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x325a('0x16'));var db=require(_0x325a('0x17'))['db'];var integrations=require(_0x325a('0x18'));function respondWithStatusCode(_0x3e90fe,_0x4e3b88){_0x4e3b88=_0x4e3b88||0xcc;return function(_0x596519){if(_0x596519){return _0x3e90fe[_0x325a('0x19')](_0x4e3b88);}return _0x3e90fe['status'](_0x4e3b88)[_0x325a('0x1a')]();};}function respondWithResult(_0xa8dc3a,_0x3db556){_0x3db556=_0x3db556||0xc8;return function(_0x28d6d3){if(_0x28d6d3){return _0xa8dc3a[_0x325a('0x1b')](_0x3db556)[_0x325a('0x1c')](_0x28d6d3);}};}function respondWithFilteredResult(_0x1d7efc,_0x4412ba){return function(_0x1fd4ec){if(_0x1fd4ec){var _0x1b0f33=typeof _0x4412ba[_0x325a('0x1d')]===_0x325a('0x1e')&&typeof _0x4412ba[_0x325a('0x1f')]===_0x325a('0x1e');var _0x4d934d=_0x1fd4ec[_0x325a('0x20')];var _0x4fbd50=_0x1b0f33?0x0:_0x4412ba['offset'];var _0x34c4c8=_0x1b0f33?_0x1fd4ec[_0x325a('0x20')]:_0x4412ba[_0x325a('0x1d')]+_0x4412ba[_0x325a('0x1f')];var _0x1ea710;if(_0x34c4c8>=_0x4d934d){_0x34c4c8=_0x4d934d;_0x1ea710=0xc8;}else{_0x1ea710=0xce;}_0x1d7efc[_0x325a('0x1b')](_0x1ea710);return _0x1d7efc[_0x325a('0x21')](_0x325a('0x22'),_0x4fbd50+'-'+_0x34c4c8+'/'+_0x4d934d)[_0x325a('0x1c')](_0x1fd4ec);}return null;};}function patchUpdates(_0x1d76b7){return function(_0x36c634){try{jsonpatch[_0x325a('0x23')](_0x36c634,_0x1d76b7,!![]);}catch(_0x5bd4e5){return BPromise[_0x325a('0x24')](_0x5bd4e5);}return _0x36c634[_0x325a('0x25')]();};}function saveUpdates(_0x18e29f,_0x192e83){return function(_0x2535ef){if(_0x2535ef){return _0x2535ef[_0x325a('0x26')](_0x18e29f)['then'](function(_0x36b2ac){return _0x36b2ac;});}return null;};}function removeEntity(_0x4c403d,_0x15b5a6){return function(_0x3e6934){if(_0x3e6934){return _0x3e6934[_0x325a('0x27')]()[_0x325a('0x28')](function(){_0x4c403d[_0x325a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29543e,_0x4b4155){return function(_0x13e86b){if(!_0x13e86b){_0x29543e[_0x325a('0x19')](0x194);}return _0x13e86b;};}function handleError(_0x41d0d2,_0x5ad31d){_0x5ad31d=_0x5ad31d||0x1f4;return function(_0x2ff37a){logger[_0x325a('0x29')](_0x2ff37a[_0x325a('0x2a')]);if(_0x2ff37a[_0x325a('0x2b')]){delete _0x2ff37a[_0x325a('0x2b')];}_0x41d0d2[_0x325a('0x1b')](_0x5ad31d)[_0x325a('0x2c')](_0x2ff37a);};}exports[_0x325a('0x2d')]=function(_0x44468d,_0x5cdfd1){var _0x201e01={},_0x3fa4f6={},_0xb10b39={'count':0x0,'rows':[]};var _0x19a3b0=_[_0x325a('0x2e')](db['FreshdeskAccount'][_0x325a('0x2f')],function(_0x4b1e46){return{'name':_0x4b1e46[_0x325a('0x30')],'type':_0x4b1e46[_0x325a('0x31')]['key']};});_0x3fa4f6[_0x325a('0x32')]=_[_0x325a('0x2e')](_0x19a3b0,_0x325a('0x2b'));_0x3fa4f6[_0x325a('0x33')]=_['keys'](_0x44468d[_0x325a('0x33')]);_0x3fa4f6[_0x325a('0x34')]=_[_0x325a('0x35')](_0x3fa4f6[_0x325a('0x32')],_0x3fa4f6['query']);_0x201e01[_0x325a('0x36')]=_[_0x325a('0x35')](_0x3fa4f6[_0x325a('0x32')],qs[_0x325a('0x37')](_0x44468d[_0x325a('0x33')][_0x325a('0x37')]));_0x201e01['attributes']=_0x201e01[_0x325a('0x36')][_0x325a('0x38')]?_0x201e01['attributes']:_0x3fa4f6[_0x325a('0x32')];if(!_0x44468d[_0x325a('0x33')]['hasOwnProperty'](_0x325a('0x39'))){_0x201e01['limit']=qs[_0x325a('0x1f')](_0x44468d[_0x325a('0x33')][_0x325a('0x1f')]);_0x201e01[_0x325a('0x1d')]=qs['offset'](_0x44468d[_0x325a('0x33')]['offset']);}_0x201e01[_0x325a('0x3a')]=qs['sort'](_0x44468d['query'][_0x325a('0x3b')]);_0x201e01[_0x325a('0x3c')]=qs[_0x325a('0x34')](_['pick'](_0x44468d[_0x325a('0x33')],_0x3fa4f6['filters']),_0x19a3b0);if(_0x44468d[_0x325a('0x33')][_0x325a('0x3d')]){_0x201e01[_0x325a('0x3c')]=_[_0x325a('0x3e')](_0x201e01[_0x325a('0x3c')],{'$or':_[_0x325a('0x2e')](_0x19a3b0,function(_0x10b7bf){if(_0x10b7bf[_0x325a('0x31')]!=='VIRTUAL'){var _0x45b9cc={};_0x45b9cc[_0x10b7bf[_0x325a('0x2b')]]={'$like':'%'+_0x44468d[_0x325a('0x33')][_0x325a('0x3d')]+'%'};return _0x45b9cc;}})});}_0x201e01=_[_0x325a('0x3e')]({},_0x201e01,_0x44468d[_0x325a('0x3f')]);var _0x1adb83={'where':_0x201e01[_0x325a('0x3c')]};return db[_0x325a('0x40')]['count'](_0x1adb83)[_0x325a('0x28')](function(_0x2eed88){_0xb10b39[_0x325a('0x20')]=_0x2eed88;if(_0x44468d[_0x325a('0x33')][_0x325a('0x41')]){_0x201e01[_0x325a('0x42')]=[{'all':!![]}];}return db[_0x325a('0x40')][_0x325a('0x43')](_0x201e01);})[_0x325a('0x28')](function(_0xefcc28){_0xb10b39[_0x325a('0x44')]=_0xefcc28;return _0xb10b39;})['then'](respondWithFilteredResult(_0x5cdfd1,_0x201e01))[_0x325a('0x45')](handleError(_0x5cdfd1,null));};exports[_0x325a('0x46')]=function(_0x415825,_0x128d53){var _0x2750dd={'raw':![],'where':{'id':_0x415825['params']['id']}},_0x39a6f7={};_0x39a6f7[_0x325a('0x32')]=_[_0x325a('0x47')](db[_0x325a('0x40')][_0x325a('0x2f')]);_0x39a6f7[_0x325a('0x33')]=_['keys'](_0x415825[_0x325a('0x33')]);_0x39a6f7[_0x325a('0x34')]=_[_0x325a('0x35')](_0x39a6f7['model'],_0x39a6f7[_0x325a('0x33')]);_0x2750dd[_0x325a('0x36')]=_[_0x325a('0x35')](_0x39a6f7['model'],qs['fields'](_0x415825[_0x325a('0x33')][_0x325a('0x37')]));_0x2750dd[_0x325a('0x36')]=_0x2750dd[_0x325a('0x36')]['length']?_0x2750dd[_0x325a('0x36')]:_0x39a6f7[_0x325a('0x32')];if(_0x415825['query'][_0x325a('0x41')]){_0x2750dd[_0x325a('0x42')]=[{'all':!![]}];}_0x2750dd=_['merge']({},_0x2750dd,_0x415825[_0x325a('0x3f')]);return db[_0x325a('0x40')]['find'](_0x2750dd)[_0x325a('0x28')](handleEntityNotFound(_0x128d53,null))['then'](respondWithResult(_0x128d53,null))['catch'](handleError(_0x128d53,null));};exports[_0x325a('0x48')]=function(_0x26721a,_0x7486ba){return db['FreshdeskAccount'][_0x325a('0x48')](_0x26721a[_0x325a('0x49')],{})['then'](respondWithResult(_0x7486ba,0xc9))['catch'](handleError(_0x7486ba,null));};exports[_0x325a('0x26')]=function(_0x2002c4,_0x5ac946){if(_0x2002c4[_0x325a('0x49')]['id']){delete _0x2002c4['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x2002c4[_0x325a('0x4a')]['id']}})[_0x325a('0x28')](handleEntityNotFound(_0x5ac946,null))['then'](saveUpdates(_0x2002c4[_0x325a('0x49')],null))[_0x325a('0x28')](respondWithResult(_0x5ac946,null))['catch'](handleError(_0x5ac946,null));};exports[_0x325a('0x27')]=function(_0x2d00c4,_0x12a4c6){return db[_0x325a('0x40')][_0x325a('0x4b')]({'where':{'id':_0x2d00c4[_0x325a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12a4c6,null))[_0x325a('0x28')](removeEntity(_0x12a4c6,null))[_0x325a('0x45')](handleError(_0x12a4c6,null));};exports['getConfigurations']=function(_0x189b23,_0x508514,_0x2ed4ed){var _0x264cda={};var _0x2c938a={};var _0x454aca;var _0x2854e6;return db[_0x325a('0x40')][_0x325a('0x4c')]({'where':{'id':_0x189b23[_0x325a('0x4a')]['id']}})[_0x325a('0x28')](handleEntityNotFound(_0x508514,null))[_0x325a('0x28')](function(_0x52a211){if(_0x52a211){_0x454aca=_0x52a211;_0x2c938a[_0x325a('0x32')]=_[_0x325a('0x47')](db['FreshdeskConfiguration'][_0x325a('0x2f')]);_0x2c938a[_0x325a('0x33')]=_[_0x325a('0x47')](_0x189b23[_0x325a('0x33')]);_0x2c938a[_0x325a('0x34')]=_[_0x325a('0x35')](_0x2c938a[_0x325a('0x32')],_0x2c938a[_0x325a('0x33')]);_0x264cda[_0x325a('0x36')]=_[_0x325a('0x35')](_0x2c938a[_0x325a('0x32')],qs[_0x325a('0x37')](_0x189b23[_0x325a('0x33')][_0x325a('0x37')]));_0x264cda['attributes']=_0x264cda[_0x325a('0x36')][_0x325a('0x38')]?_0x264cda[_0x325a('0x36')]:_0x2c938a[_0x325a('0x32')];_0x264cda[_0x325a('0x3a')]=qs[_0x325a('0x3b')](_0x189b23[_0x325a('0x33')][_0x325a('0x3b')]);_0x264cda[_0x325a('0x3c')]=qs[_0x325a('0x34')](_[_0x325a('0x4d')](_0x189b23[_0x325a('0x33')],_0x2c938a['filters']));if(_0x189b23[_0x325a('0x33')][_0x325a('0x3d')]){_0x264cda['where']=_[_0x325a('0x3e')](_0x264cda[_0x325a('0x3c')],{'$or':_[_0x325a('0x2e')](_0x264cda['attributes'],function(_0x55eb10){var _0x44af6b={};_0x44af6b[_0x55eb10]={'$like':'%'+_0x189b23[_0x325a('0x33')][_0x325a('0x3d')]+'%'};return _0x44af6b;})});}_0x264cda=_[_0x325a('0x3e')]({},_0x264cda,_0x189b23[_0x325a('0x3f')]);return _0x454aca[_0x325a('0x4e')](_0x264cda);}})[_0x325a('0x28')](function(_0x12d276){if(_0x12d276){_0x2854e6=_0x12d276['length'];if(!_0x189b23[_0x325a('0x33')][_0x325a('0x4f')](_0x325a('0x39'))){_0x264cda[_0x325a('0x1f')]=qs[_0x325a('0x1f')](_0x189b23[_0x325a('0x33')][_0x325a('0x1f')]);_0x264cda[_0x325a('0x1d')]=qs[_0x325a('0x1d')](_0x189b23[_0x325a('0x33')][_0x325a('0x1d')]);}return _0x454aca[_0x325a('0x4e')](_0x264cda);}})[_0x325a('0x28')](function(_0xcdfbc2){if(_0xcdfbc2){return _0xcdfbc2?{'count':_0x2854e6,'rows':_0xcdfbc2}:null;}})['then'](respondWithResult(_0x508514,null))[_0x325a('0x45')](handleError(_0x508514,null));};exports[_0x325a('0x50')]=function(_0x5c7681,_0x3a7d44,_0x415524){if(_0x5c7681[_0x325a('0x49')]['id']){delete _0x5c7681[_0x325a('0x49')]['id'];}return db[_0x325a('0x40')][_0x325a('0x4c')]({'where':{'id':_0x5c7681['params']['id']}})[_0x325a('0x28')](handleEntityNotFound(_0x3a7d44,null))[_0x325a('0x28')](function(_0x286572){if(_0x286572){_0x5c7681[_0x325a('0x49')][_0x325a('0x51')]=_0x286572['id'];_0x5c7681['body'][_0x325a('0x52')]=integrations[_0x325a('0x53')](_0x5c7681['body']['channel'],_0x5c7681[_0x325a('0x49')]['type']);_0x5c7681['body'][_0x325a('0x54')]=integrations[_0x325a('0x55')](_0x5c7681['body'][_0x325a('0x56')],_0x5c7681[_0x325a('0x49')]['type']);return db[_0x325a('0x57')]['create'](_0x5c7681[_0x325a('0x49')],{'include':[{'model':db[_0x325a('0x58')],'as':_0x325a('0x52')},{'model':db[_0x325a('0x58')],'as':_0x325a('0x54')}]});}return null;})[_0x325a('0x28')](respondWithResult(_0x3a7d44,null))['catch'](handleError(_0x3a7d44,null));};exports[_0x325a('0x59')]=function(_0x2ddfa0,_0x3b9520,_0x5168de){var _0x47e360='';return db['FreshdeskAccount'][_0x325a('0x4c')]({'where':{'id':_0x2ddfa0[_0x325a('0x4a')]['id']},'attributes':['id','remoteUri',_0x325a('0x5a')]})[_0x325a('0x28')](handleEntityNotFound(_0x3b9520,null))['then'](function(_0x423fd5){if(_0x423fd5){_0x47e360=_0x423fd5['remoteUri'];var _0xa1cacf=_0x47e360[_0x325a('0x5b')](-0x1);if(_0xa1cacf==='/'){_0x47e360=_0x47e360[_0x325a('0x5c')](0x0,_0x47e360[_0x325a('0x5d')](_0xa1cacf));}return rp({'method':_0x325a('0x5e'),'uri':util[_0x325a('0x5f')](_0x325a('0x60'),_0x47e360,_0x325a('0x61')),'headers':{'Authorization':util[_0x325a('0x5f')](_0x325a('0x62'),new Buffer(util[_0x325a('0x5f')](_0x325a('0x63'),_0x423fd5[_0x325a('0x5a')]))['toString'](_0x325a('0x64')))},'json':!![]});}})[_0x325a('0x28')](function(_0x54acd0){if(_0x54acd0){var _0x1c5d62=[_0x325a('0x65'),_0x325a('0x66'),'agent','description',_0x325a('0x1b'),_0x325a('0x67'),'group','source',_0x325a('0x68'),_0x325a('0x69'),_0x325a('0x6a')];_['remove'](_0x54acd0,function(_0x1cbe07){return _0x1c5d62[_0x325a('0x6b')](_0x1cbe07['name'])||!_0x1cbe07[_0x325a('0x6c')]&&_0x1cbe07[_0x325a('0x31')]!==_0x325a('0x6d')&&_0x1cbe07[_0x325a('0x31')]!=='custom_dropdown';});return{'count':_0x54acd0[_0x325a('0x38')],'rows':_[_0x325a('0x2e')](_0x54acd0,function(_0x398f31){return{'id':_0x398f31[_0x325a('0x2b')],'name':_0x398f31[_0x325a('0x6e')],'custom':!_0x398f31[_0x325a('0x6c')],'options':_0x398f31[_0x325a('0x6f')]?_[_0x325a('0x2e')](_0x398f31['choices'],function(_0x4c33a4){return{'name':_[_0x325a('0x70')](_0x4c33a4),'value':_0x4c33a4};}):[]};})};}})['then'](respondWithResult(_0x3b9520,null))[_0x325a('0x45')](function(_0x573c8){var _0x32a397=_0x2ddfa0[_0x325a('0x33')][_0x325a('0x71')]?0x1f4:_0x573c8[_0x325a('0x72')]||0x1f4;logger[_0x325a('0x29')](_0x325a('0x73'),_0x325a('0x59'),_0x32a397,JSON[_0x325a('0x74')](_0x573c8));delete _0x573c8[_0x325a('0x2b')];if(_0x32a397===0x191){_0x32a397=0x190;}_0x3b9520[_0x325a('0x1b')](_0x32a397)['send'](_0x2ddfa0[_0x325a('0x33')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x573c8[_0x325a('0x72')]}:_0x573c8);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 61484f3..6948a42 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 _0xdd0e=['../../components/integrations/configuration','exports','int_freshdesk_accounts','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd0e,0x85));var _0xedd0=function(_0x26c7be,_0x30cb00){_0x26c7be=_0x26c7be-0x0;var _0x57375f=_0xdd0e[_0x26c7be];return _0x57375f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xedd0('0x0'))('api');var moment=require('moment');var BPromise=require(_0xedd0('0x1'));var rp=require(_0xedd0('0x2'));var fs=require('fs');var path=require(_0xedd0('0x3'));var rimraf=require(_0xedd0('0x4'));var config=require(_0xedd0('0x5'));var attributes=require(_0xedd0('0x6'));var integrations=require(_0xedd0('0x7'));module[_0xedd0('0x8')]=function(_0x22a564,_0x5e67c5){return _0x22a564['define']('FreshdeskAccount',attributes,{'tableName':_0xedd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2da9=['bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment'];(function(_0x5122c7,_0x50103d){var _0x2b487b=function(_0x332463){while(--_0x332463){_0x5122c7['push'](_0x5122c7['shift']());}};_0x2b487b(++_0x50103d);}(_0x2da9,0x1d0));var _0x92da=function(_0x3c8f5f,_0x4ed370){_0x3c8f5f=_0x3c8f5f-0x0;var _0x4ed868=_0x2da9[_0x3c8f5f];return _0x4ed868;};'use strict';var _=require(_0x92da('0x0'));var util=require('util');var logger=require(_0x92da('0x1'))(_0x92da('0x2'));var moment=require(_0x92da('0x3'));var BPromise=require(_0x92da('0x4'));var rp=require(_0x92da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x92da('0x6'));var attributes=require(_0x92da('0x7'));var integrations=require(_0x92da('0x8'));module[_0x92da('0x9')]=function(_0x59f8be,_0x46b952){return _0x59f8be[_0x92da('0xa')](_0x92da('0xb'),attributes,{'tableName':_0x92da('0xc'),'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 7399fb5..92a32cb 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 _0xcaf8=['client','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','attributes','limit','include','map','model','stringify','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x365b66,_0xaf873){var _0x173b48=function(_0x1e4472){while(--_0x1e4472){_0x365b66['push'](_0x365b66['shift']());}};_0x173b48(++_0xaf873);}(_0xcaf8,0x16d));var _0x8caf=function(_0x487319,_0x291bf1){_0x487319=_0x487319-0x0;var _0x5e0f52=_0xcaf8[_0x487319];return _0x5e0f52;};'use strict';var _=require(_0x8caf('0x0'));var util=require('util');var moment=require(_0x8caf('0x1'));var BPromise=require(_0x8caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8caf('0x3'));var db=require(_0x8caf('0x4'))['db'];var utils=require(_0x8caf('0x5'));var logger=require(_0x8caf('0x6'))(_0x8caf('0x7'));var config=require(_0x8caf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8caf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x68258f,_0x1ba13a,_0x5f0c7f){return new BPromise(function(_0x52b6ef,_0x8deeca){return client['request'](_0x68258f,_0x5f0c7f)[_0x8caf('0xa')](function(_0x2138fe){logger[_0x8caf('0xb')](_0x8caf('0xc'),_0x1ba13a,_0x8caf('0xd'));logger[_0x8caf('0xe')](_0x8caf('0xf'),_0x1ba13a,'request\x20sent',JSON['stringify'](_0x2138fe));if(_0x2138fe[_0x8caf('0x10')]){if(_0x2138fe[_0x8caf('0x10')][_0x8caf('0x11')]===0x1f4){logger[_0x8caf('0x10')](_0x8caf('0xc'),_0x1ba13a,_0x2138fe[_0x8caf('0x10')]['message']);return _0x8deeca(_0x2138fe[_0x8caf('0x10')][_0x8caf('0x12')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x1ba13a,_0x2138fe[_0x8caf('0x10')][_0x8caf('0x12')]);return _0x52b6ef(_0x2138fe['error']['message']);}else{logger[_0x8caf('0xb')](_0x8caf('0xc'),_0x1ba13a,_0x8caf('0xd'));_0x52b6ef(_0x2138fe[_0x8caf('0x13')][_0x8caf('0x12')]);}})[_0x8caf('0x14')](function(_0x19b36f){logger[_0x8caf('0x10')](_0x8caf('0xc'),_0x1ba13a,_0x19b36f);_0x8deeca(_0x19b36f);});});}exports['GetFreshdeskAccount']=function(_0x2316d6){var _0x22953a=this;return new Promise(function(_0x1f0ad4,_0x8971eb){return db['FreshdeskAccount'][_0x8caf('0x15')]({'raw':_0x2316d6['options']?_0x2316d6[_0x8caf('0x16')][_0x8caf('0x17')]===undefined?!![]:![]:!![],'where':_0x2316d6[_0x8caf('0x16')]?_0x2316d6[_0x8caf('0x16')]['where']||null:null,'attributes':_0x2316d6[_0x8caf('0x16')]?_0x2316d6['options'][_0x8caf('0x18')]||null:null,'limit':_0x2316d6[_0x8caf('0x16')]?_0x2316d6[_0x8caf('0x16')][_0x8caf('0x19')]||null:null,'include':_0x2316d6['options']?_0x2316d6[_0x8caf('0x16')][_0x8caf('0x1a')]?_['map'](_0x2316d6['options'][_0x8caf('0x1a')],function(_0x50efd6){return{'model':db[_0x50efd6['model']],'as':_0x50efd6['as'],'attributes':_0x50efd6[_0x8caf('0x18')],'include':_0x50efd6[_0x8caf('0x1a')]?_[_0x8caf('0x1b')](_0x50efd6[_0x8caf('0x1a')],function(_0x2d12d6){return{'model':db[_0x2d12d6[_0x8caf('0x1c')]],'as':_0x2d12d6['as'],'attributes':_0x2d12d6[_0x8caf('0x18')],'include':_0x2d12d6[_0x8caf('0x1a')]?_[_0x8caf('0x1b')](_0x2d12d6[_0x8caf('0x1a')],function(_0x183a51){return{'model':db[_0x183a51['model']],'as':_0x183a51['as'],'attributes':_0x183a51[_0x8caf('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x457a07){logger['info']('GetFreshdeskAccount',_0x2316d6);logger['debug']('GetFreshdeskAccount',_0x2316d6,JSON[_0x8caf('0x1d')](_0x457a07));_0x1f0ad4(_0x457a07);})['catch'](function(_0x153eea){logger['error'](_0x8caf('0x1e'),_0x153eea['message'],_0x2316d6);_0x8971eb(_0x22953a['error'](0x1f4,_0x153eea['message']));});});};exports[_0x8caf('0x1f')]=function(_0x41b5e3){var _0x486c7a=this;return new Promise(function(_0x4c659a,_0x14ce11){return db[_0x8caf('0x20')]['find']({'raw':_0x41b5e3[_0x8caf('0x16')]?_0x41b5e3['options']['raw']===undefined?!![]:![]:!![],'where':_0x41b5e3['options']?_0x41b5e3[_0x8caf('0x16')][_0x8caf('0x21')]||null:null,'attributes':_0x41b5e3[_0x8caf('0x16')]?_0x41b5e3[_0x8caf('0x16')][_0x8caf('0x18')]||null:null,'include':_0x41b5e3[_0x8caf('0x16')]?_0x41b5e3[_0x8caf('0x16')][_0x8caf('0x1a')]?_[_0x8caf('0x1b')](_0x41b5e3['options']['include'],function(_0x1d8827){return{'model':db[_0x1d8827[_0x8caf('0x1c')]],'as':_0x1d8827['as'],'attributes':_0x1d8827['attributes'],'include':_0x1d8827[_0x8caf('0x1a')]?_[_0x8caf('0x1b')](_0x1d8827[_0x8caf('0x1a')],function(_0x555162){return{'model':db[_0x555162[_0x8caf('0x1c')]],'as':_0x555162['as'],'attributes':_0x555162[_0x8caf('0x18')],'include':_0x555162[_0x8caf('0x1a')]?_[_0x8caf('0x1b')](_0x555162[_0x8caf('0x1a')],function(_0x4da844){return{'model':db[_0x4da844[_0x8caf('0x1c')]],'as':_0x4da844['as'],'attributes':_0x4da844[_0x8caf('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8caf('0xa')](function(_0x543843){logger[_0x8caf('0xb')](_0x8caf('0x1f'),_0x41b5e3);logger[_0x8caf('0xe')]('ShowFreshdeskAccount',_0x41b5e3,JSON[_0x8caf('0x1d')](_0x543843));_0x4c659a(_0x543843);})['catch'](function(_0x508295){logger['error'](_0x8caf('0x1f'),_0x508295[_0x8caf('0x12')],_0x41b5e3);_0x14ce11(_0x486c7a['error'](0x1f4,_0x508295[_0x8caf('0x12')]));});});}; \ No newline at end of file +var _0xdbd0=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','catch','findAll','options','where','attributes','map','include','model','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x141c2c,_0x8cf393){var _0x302935=function(_0x513d05){while(--_0x513d05){_0x141c2c['push'](_0x141c2c['shift']());}};_0x302935(++_0x8cf393);}(_0xdbd0,0x88));var _0x0dbd=function(_0x3f12b1,_0x7d3a9c){_0x3f12b1=_0x3f12b1-0x0;var _0xa89515=_0xdbd0[_0x3f12b1];return _0xa89515;};'use strict';var _=require(_0x0dbd('0x0'));var util=require(_0x0dbd('0x1'));var moment=require(_0x0dbd('0x2'));var BPromise=require(_0x0dbd('0x3'));var rs=require(_0x0dbd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dbd('0x5'))['db'];var utils=require(_0x0dbd('0x6'));var logger=require(_0x0dbd('0x7'))('rpc');var config=require(_0x0dbd('0x8'));var jayson=require(_0x0dbd('0x9'));var client=jayson[_0x0dbd('0xa')][_0x0dbd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b653b,_0x47e742,_0xcb72c2){return new BPromise(function(_0x3b3f21,_0x1a957e){return client[_0x0dbd('0xc')](_0x4b653b,_0xcb72c2)[_0x0dbd('0xd')](function(_0x453836){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x47e742,_0x0dbd('0xe'));logger[_0x0dbd('0xf')](_0x0dbd('0x10'),_0x47e742,_0x0dbd('0xe'),JSON[_0x0dbd('0x11')](_0x453836));if(_0x453836[_0x0dbd('0x12')]){if(_0x453836[_0x0dbd('0x12')][_0x0dbd('0x13')]===0x1f4){logger['error'](_0x0dbd('0x14'),_0x47e742,_0x453836[_0x0dbd('0x12')][_0x0dbd('0x15')]);return _0x1a957e(_0x453836['error'][_0x0dbd('0x15')]);}logger[_0x0dbd('0x12')](_0x0dbd('0x14'),_0x47e742,_0x453836[_0x0dbd('0x12')][_0x0dbd('0x15')]);return _0x3b3f21(_0x453836[_0x0dbd('0x12')][_0x0dbd('0x15')]);}else{logger[_0x0dbd('0x16')](_0x0dbd('0x14'),_0x47e742,'request\x20sent');_0x3b3f21(_0x453836['result'][_0x0dbd('0x15')]);}})[_0x0dbd('0x17')](function(_0x5b2a34){logger[_0x0dbd('0x12')](_0x0dbd('0x14'),_0x47e742,_0x5b2a34);_0x1a957e(_0x5b2a34);});});}exports['GetFreshdeskAccount']=function(_0x500fc6){var _0xcbad4b=this;return new Promise(function(_0x23db13,_0x24ac9d){return db['FreshdeskAccount'][_0x0dbd('0x18')]({'raw':_0x500fc6[_0x0dbd('0x19')]?_0x500fc6['options']['raw']===undefined?!![]:![]:!![],'where':_0x500fc6[_0x0dbd('0x19')]?_0x500fc6[_0x0dbd('0x19')][_0x0dbd('0x1a')]||null:null,'attributes':_0x500fc6['options']?_0x500fc6['options'][_0x0dbd('0x1b')]||null:null,'limit':_0x500fc6[_0x0dbd('0x19')]?_0x500fc6['options']['limit']||null:null,'include':_0x500fc6[_0x0dbd('0x19')]?_0x500fc6[_0x0dbd('0x19')]['include']?_[_0x0dbd('0x1c')](_0x500fc6[_0x0dbd('0x19')][_0x0dbd('0x1d')],function(_0x524a84){return{'model':db[_0x524a84[_0x0dbd('0x1e')]],'as':_0x524a84['as'],'attributes':_0x524a84[_0x0dbd('0x1b')],'include':_0x524a84['include']?_[_0x0dbd('0x1c')](_0x524a84[_0x0dbd('0x1d')],function(_0x563185){return{'model':db[_0x563185[_0x0dbd('0x1e')]],'as':_0x563185['as'],'attributes':_0x563185[_0x0dbd('0x1b')],'include':_0x563185['include']?_[_0x0dbd('0x1c')](_0x563185[_0x0dbd('0x1d')],function(_0x66a345){return{'model':db[_0x66a345[_0x0dbd('0x1e')]],'as':_0x66a345['as'],'attributes':_0x66a345[_0x0dbd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0dbd('0xd')](function(_0x4938d9){logger['info']('GetFreshdeskAccount',_0x500fc6);logger[_0x0dbd('0xf')]('GetFreshdeskAccount',_0x500fc6,JSON[_0x0dbd('0x11')](_0x4938d9));_0x23db13(_0x4938d9);})['catch'](function(_0x57fd18){logger[_0x0dbd('0x12')](_0x0dbd('0x1f'),_0x57fd18[_0x0dbd('0x15')],_0x500fc6);_0x24ac9d(_0xcbad4b[_0x0dbd('0x12')](0x1f4,_0x57fd18['message']));});});};exports[_0x0dbd('0x20')]=function(_0x327fba){var _0x1366ce=this;return new Promise(function(_0x52b8ee,_0x467d49){return db[_0x0dbd('0x21')][_0x0dbd('0x22')]({'raw':_0x327fba[_0x0dbd('0x19')]?_0x327fba['options'][_0x0dbd('0x23')]===undefined?!![]:![]:!![],'where':_0x327fba[_0x0dbd('0x19')]?_0x327fba[_0x0dbd('0x19')][_0x0dbd('0x1a')]||null:null,'attributes':_0x327fba['options']?_0x327fba[_0x0dbd('0x19')][_0x0dbd('0x1b')]||null:null,'include':_0x327fba[_0x0dbd('0x19')]?_0x327fba['options'][_0x0dbd('0x1d')]?_[_0x0dbd('0x1c')](_0x327fba[_0x0dbd('0x19')]['include'],function(_0x7252ec){return{'model':db[_0x7252ec['model']],'as':_0x7252ec['as'],'attributes':_0x7252ec[_0x0dbd('0x1b')],'include':_0x7252ec['include']?_['map'](_0x7252ec['include'],function(_0x5a5f09){return{'model':db[_0x5a5f09[_0x0dbd('0x1e')]],'as':_0x5a5f09['as'],'attributes':_0x5a5f09[_0x0dbd('0x1b')],'include':_0x5a5f09['include']?_[_0x0dbd('0x1c')](_0x5a5f09[_0x0dbd('0x1d')],function(_0x5452f0){return{'model':db[_0x5452f0[_0x0dbd('0x1e')]],'as':_0x5452f0['as'],'attributes':_0x5452f0[_0x0dbd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0dbd('0xd')](function(_0x59e81c){logger['info']('ShowFreshdeskAccount',_0x327fba);logger[_0x0dbd('0xf')]('ShowFreshdeskAccount',_0x327fba,JSON['stringify'](_0x59e81c));_0x52b8ee(_0x59e81c);})[_0x0dbd('0x17')](function(_0x47c920){logger[_0x0dbd('0x12')](_0x0dbd('0x20'),_0x47c920[_0x0dbd('0x15')],_0x327fba);_0x467d49(_0x1366ce[_0x0dbd('0x12')](0x1f4,_0x47c920[_0x0dbd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6f64c9d..bf123bc 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 _0x8304=['getDescriptions','/:id/tags','getTags','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects'];(function(_0xd3348b,_0x288d47){var _0x583cdc=function(_0x743e06){while(--_0x743e06){_0xd3348b['push'](_0xd3348b['shift']());}};_0x583cdc(++_0x288d47);}(_0x8304,0xaf));var _0x4830=function(_0x49aadd,_0x5ebd9c){_0x49aadd=_0x49aadd-0x0;var _0x44fb60=_0x8304[_0x49aadd];return _0x44fb60;};'use strict';var multer=require(_0x4830('0x0'));var util=require(_0x4830('0x1'));var path=require(_0x4830('0x2'));var timeout=require(_0x4830('0x3'));var express=require(_0x4830('0x4'));var router=express[_0x4830('0x5')]();var fs_extra=require(_0x4830('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4830('0x7'));var config=require(_0x4830('0x8'));var controller=require(_0x4830('0x9'));router['get']('/',auth[_0x4830('0xa')](),controller[_0x4830('0xb')]);router[_0x4830('0xc')](_0x4830('0xd'),auth[_0x4830('0xa')](),controller[_0x4830('0xe')]);router[_0x4830('0xc')](_0x4830('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x4830('0xc')]('/:id/subjects',auth[_0x4830('0xa')](),controller[_0x4830('0x10')]);router['get']('/:id/descriptions',auth[_0x4830('0xa')](),controller[_0x4830('0x11')]);router[_0x4830('0xc')](_0x4830('0x12'),auth[_0x4830('0xa')](),controller[_0x4830('0x13')]);router['post']('/',auth[_0x4830('0xa')](),controller[_0x4830('0x14')]);router['post'](_0x4830('0x12'),auth[_0x4830('0xa')](),controller['setTags']);router[_0x4830('0x15')](_0x4830('0xd'),auth[_0x4830('0xa')](),controller['update']);router[_0x4830('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4830('0x17')]=router; \ No newline at end of file +var _0x3828=['get','isAuthenticated','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x47d060,_0x4a2b1d){var _0xb2d051=function(_0x3434e7){while(--_0x3434e7){_0x47d060['push'](_0x47d060['shift']());}};_0xb2d051(++_0x4a2b1d);}(_0x3828,0x1d3));var _0x8382=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3828[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x8382('0x0'));var util=require(_0x8382('0x1'));var path=require(_0x8382('0x2'));var timeout=require('connect-timeout');var express=require(_0x8382('0x3'));var router=express[_0x8382('0x4')]();var fs_extra=require(_0x8382('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8382('0x6'));var config=require(_0x8382('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x8382('0x8')]('/',auth[_0x8382('0x9')](),controller['index']);router['get'](_0x8382('0xa'),auth[_0x8382('0x9')](),controller['show']);router[_0x8382('0x8')]('/:id/fields',auth[_0x8382('0x9')](),controller[_0x8382('0xb')]);router[_0x8382('0x8')](_0x8382('0xc'),auth['isAuthenticated'](),controller[_0x8382('0xd')]);router['get'](_0x8382('0xe'),auth[_0x8382('0x9')](),controller[_0x8382('0xf')]);router[_0x8382('0x8')](_0x8382('0x10'),auth[_0x8382('0x9')](),controller[_0x8382('0x11')]);router[_0x8382('0x12')]('/',auth[_0x8382('0x9')](),controller[_0x8382('0x13')]);router[_0x8382('0x12')]('/:id/tags',auth[_0x8382('0x9')](),controller[_0x8382('0x14')]);router[_0x8382('0x15')](_0x8382('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8382('0x16')](_0x8382('0xa'),auth[_0x8382('0x9')](),controller[_0x8382('0x17')]);module[_0x8382('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 75f2c2a..0caac5a 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 _0xfea8=['STRING','sequelize','exports'];(function(_0x4fd8eb,_0x4b2ebe){var _0x35bfc7=function(_0x46b6e3){while(--_0x46b6e3){_0x4fd8eb['push'](_0x4fd8eb['shift']());}};_0x35bfc7(++_0x4b2ebe);}(_0xfea8,0x136));var _0x8fea=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0xfea8[_0x2e41e2];return _0x2844d6;};'use strict';var Sequelize=require(_0x8fea('0x0'));module[_0x8fea('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8fea('0x2')]}}; \ No newline at end of file +var _0x5bc5=['STRING','sequelize'];(function(_0x99d551,_0x42347d){var _0x4427c=function(_0xe9b6fb){while(--_0xe9b6fb){_0x99d551['push'](_0x99d551['shift']());}};_0x4427c(++_0x42347d);}(_0x5bc5,0x17b));var _0x55bc=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x5bc5[_0x10dfdf];return _0x4d857d;};'use strict';var Sequelize=require(_0x55bc('0x0'));module['exports']={'name':{'type':Sequelize[_0x55bc('0x1')]},'description':{'type':Sequelize[_0x55bc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 671f92f..6447cde 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 _0x511c=['options','find','create','body','getFields','findOne','FreshdeskField','getSubjects','rawAttributes','getDescriptions','getTags','Tag','setTags','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','params'];(function(_0x1e5e28,_0x5dac7e){var _0x1b0fa0=function(_0x2f660b){while(--_0x2f660b){_0x1e5e28['push'](_0x1e5e28['shift']());}};_0x1b0fa0(++_0x5dac7e);}(_0x511c,0x1f3));var _0xc511=function(_0x2e6e12,_0x238fc4){_0x2e6e12=_0x2e6e12-0x0;var _0x4bebf6=_0x511c[_0x2e6e12];return _0x4bebf6;};'use strict';var emlformat=require(_0xc511('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc511('0x1'));var rp=require(_0xc511('0x2'));var moment=require(_0xc511('0x3'));var BPromise=require(_0xc511('0x4'));var Mustache=require(_0xc511('0x5'));var util=require('util');var path=require(_0xc511('0x6'));var sox=require(_0xc511('0x7'));var csv=require(_0xc511('0x8'));var ejs=require(_0xc511('0x9'));var fs=require('fs');var fs_extra=require(_0xc511('0xa'));var _=require(_0xc511('0xb'));var squel=require('squel');var crypto=require(_0xc511('0xc'));var jsforce=require(_0xc511('0xd'));var deskjs=require(_0xc511('0xe'));var toCsv=require(_0xc511('0x8'));var querystring=require(_0xc511('0xf'));var Papa=require(_0xc511('0x10'));var Redis=require('ioredis');var authService=require(_0xc511('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc511('0x12'));var logger=require(_0xc511('0x13'))(_0xc511('0x14'));var utils=require(_0xc511('0x15'));var config=require(_0xc511('0x16'));var licenseUtil=require(_0xc511('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5da036,_0x1a8825){_0x1a8825=_0x1a8825||0xcc;return function(_0x11df81){if(_0x11df81){return _0x5da036[_0xc511('0x18')](_0x1a8825);}return _0x5da036['status'](_0x1a8825)[_0xc511('0x19')]();};}function respondWithResult(_0x73b525,_0xc0a652){_0xc0a652=_0xc0a652||0xc8;return function(_0x12ceb8){if(_0x12ceb8){return _0x73b525['status'](_0xc0a652)[_0xc511('0x1a')](_0x12ceb8);}};}function respondWithFilteredResult(_0x2432b9,_0x7fb354){return function(_0x3044af){if(_0x3044af){var _0x5011d8=typeof _0x7fb354[_0xc511('0x1b')]===_0xc511('0x1c')&&typeof _0x7fb354[_0xc511('0x1d')]===_0xc511('0x1c');var _0x38acbc=_0x3044af[_0xc511('0x1e')];var _0x23770c=_0x5011d8?0x0:_0x7fb354[_0xc511('0x1b')];var _0x10cce6=_0x5011d8?_0x3044af['count']:_0x7fb354[_0xc511('0x1b')]+_0x7fb354['limit'];var _0x22f3c3;if(_0x10cce6>=_0x38acbc){_0x10cce6=_0x38acbc;_0x22f3c3=0xc8;}else{_0x22f3c3=0xce;}_0x2432b9[_0xc511('0x1f')](_0x22f3c3);return _0x2432b9[_0xc511('0x20')]('Content-Range',_0x23770c+'-'+_0x10cce6+'/'+_0x38acbc)[_0xc511('0x1a')](_0x3044af);}return null;};}function patchUpdates(_0x5c9aa5){return function(_0x1fe435){try{jsonpatch[_0xc511('0x21')](_0x1fe435,_0x5c9aa5,!![]);}catch(_0x203bef){return BPromise[_0xc511('0x22')](_0x203bef);}return _0x1fe435[_0xc511('0x23')]();};}function saveUpdates(_0x3f5eda,_0x33b256){return function(_0x1ff374){if(_0x1ff374){return _0x1ff374[_0xc511('0x24')](_0x3f5eda)[_0xc511('0x25')](function(_0x43e3e5){return _0x43e3e5;});}return null;};}function removeEntity(_0x5ba793,_0x10b203){return function(_0x30eb25){if(_0x30eb25){return _0x30eb25[_0xc511('0x26')]()[_0xc511('0x25')](function(){_0x5ba793[_0xc511('0x1f')](0xcc)[_0xc511('0x19')]();});}};}function handleEntityNotFound(_0x1b24b8,_0x4ea253){return function(_0x3cba74){if(!_0x3cba74){_0x1b24b8[_0xc511('0x18')](0x194);}return _0x3cba74;};}function handleError(_0x171c76,_0x4eecac){_0x4eecac=_0x4eecac||0x1f4;return function(_0x3c355b){logger[_0xc511('0x27')](_0x3c355b['stack']);if(_0x3c355b[_0xc511('0x28')]){delete _0x3c355b[_0xc511('0x28')];}_0x171c76[_0xc511('0x1f')](_0x4eecac)[_0xc511('0x29')](_0x3c355b);};}exports[_0xc511('0x2a')]=function(_0x214d83,_0x160a45){var _0x26a7c6={},_0x137ba5={},_0x2bdb48={'count':0x0,'rows':[]};var _0x3e6d13=_[_0xc511('0x2b')](db[_0xc511('0x2c')]['rawAttributes'],function(_0x14288a){return{'name':_0x14288a['fieldName'],'type':_0x14288a['type'][_0xc511('0x2d')]};});_0x137ba5[_0xc511('0x2e')]=_['map'](_0x3e6d13,_0xc511('0x28'));_0x137ba5['query']=_[_0xc511('0x2f')](_0x214d83['query']);_0x137ba5['filters']=_[_0xc511('0x30')](_0x137ba5['model'],_0x137ba5[_0xc511('0x31')]);_0x26a7c6['attributes']=_[_0xc511('0x30')](_0x137ba5[_0xc511('0x2e')],qs[_0xc511('0x32')](_0x214d83[_0xc511('0x31')][_0xc511('0x32')]));_0x26a7c6['attributes']=_0x26a7c6[_0xc511('0x33')][_0xc511('0x34')]?_0x26a7c6[_0xc511('0x33')]:_0x137ba5[_0xc511('0x2e')];if(!_0x214d83[_0xc511('0x31')][_0xc511('0x35')](_0xc511('0x36'))){_0x26a7c6[_0xc511('0x1d')]=qs['limit'](_0x214d83[_0xc511('0x31')]['limit']);_0x26a7c6['offset']=qs[_0xc511('0x1b')](_0x214d83['query'][_0xc511('0x1b')]);}_0x26a7c6[_0xc511('0x37')]=qs[_0xc511('0x38')](_0x214d83[_0xc511('0x31')][_0xc511('0x38')]);_0x26a7c6[_0xc511('0x39')]=qs[_0xc511('0x3a')](_[_0xc511('0x3b')](_0x214d83[_0xc511('0x31')],_0x137ba5[_0xc511('0x3a')]),_0x3e6d13);if(_0x214d83[_0xc511('0x31')][_0xc511('0x3c')]){_0x26a7c6['where']=_[_0xc511('0x3d')](_0x26a7c6[_0xc511('0x39')],{'$or':_[_0xc511('0x2b')](_0x3e6d13,function(_0x42b10d){if(_0x42b10d['type']!=='VIRTUAL'){var _0x60efed={};_0x60efed[_0x42b10d[_0xc511('0x28')]]={'$like':'%'+_0x214d83[_0xc511('0x31')][_0xc511('0x3c')]+'%'};return _0x60efed;}})});}_0x26a7c6=_[_0xc511('0x3d')]({},_0x26a7c6,_0x214d83['options']);var _0x4cb082={'where':_0x26a7c6['where']};return db[_0xc511('0x2c')][_0xc511('0x1e')](_0x4cb082)[_0xc511('0x25')](function(_0x372068){_0x2bdb48[_0xc511('0x1e')]=_0x372068;if(_0x214d83[_0xc511('0x31')][_0xc511('0x3e')]){_0x26a7c6[_0xc511('0x3f')]=[{'all':!![]}];}return db[_0xc511('0x2c')][_0xc511('0x40')](_0x26a7c6);})['then'](function(_0x1e8245){_0x2bdb48[_0xc511('0x41')]=_0x1e8245;return _0x2bdb48;})[_0xc511('0x25')](respondWithFilteredResult(_0x160a45,_0x26a7c6))[_0xc511('0x42')](handleError(_0x160a45,null));};exports['show']=function(_0x2ef176,_0x45f08b){var _0x3c61ae={'raw':![],'where':{'id':_0x2ef176[_0xc511('0x43')]['id']}},_0x4a4446={};_0x4a4446['model']=_[_0xc511('0x2f')](db[_0xc511('0x2c')]['rawAttributes']);_0x4a4446[_0xc511('0x31')]=_[_0xc511('0x2f')](_0x2ef176[_0xc511('0x31')]);_0x4a4446[_0xc511('0x3a')]=_[_0xc511('0x30')](_0x4a4446['model'],_0x4a4446[_0xc511('0x31')]);_0x3c61ae['attributes']=_['intersection'](_0x4a4446[_0xc511('0x2e')],qs[_0xc511('0x32')](_0x2ef176[_0xc511('0x31')]['fields']));_0x3c61ae[_0xc511('0x33')]=_0x3c61ae[_0xc511('0x33')][_0xc511('0x34')]?_0x3c61ae[_0xc511('0x33')]:_0x4a4446['model'];if(_0x2ef176[_0xc511('0x31')]['includeAll']){_0x3c61ae['include']=[{'all':!![]}];}_0x3c61ae=_[_0xc511('0x3d')]({},_0x3c61ae,_0x2ef176[_0xc511('0x44')]);return db['FreshdeskConfiguration'][_0xc511('0x45')](_0x3c61ae)[_0xc511('0x25')](handleEntityNotFound(_0x45f08b,null))['then'](respondWithResult(_0x45f08b,null))[_0xc511('0x42')](handleError(_0x45f08b,null));};exports[_0xc511('0x46')]=function(_0x2ac9b5,_0x27d864){return db[_0xc511('0x2c')][_0xc511('0x46')](_0x2ac9b5[_0xc511('0x47')],{})[_0xc511('0x25')](respondWithResult(_0x27d864,0xc9))[_0xc511('0x42')](handleError(_0x27d864,null));};exports[_0xc511('0x24')]=function(_0x35f880,_0x2941b8){if(_0x35f880[_0xc511('0x47')]['id']){delete _0x35f880['body']['id'];}return db[_0xc511('0x2c')][_0xc511('0x45')]({'where':{'id':_0x35f880['params']['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x2941b8,null))[_0xc511('0x25')](saveUpdates(_0x35f880[_0xc511('0x47')],null))[_0xc511('0x25')](respondWithResult(_0x2941b8,null))['catch'](handleError(_0x2941b8,null));};exports['destroy']=function(_0xe0f7ee,_0x17432c){return db[_0xc511('0x2c')]['find']({'where':{'id':_0xe0f7ee[_0xc511('0x43')]['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x17432c,null))['then'](removeEntity(_0x17432c,null))[_0xc511('0x42')](handleError(_0x17432c,null));};exports[_0xc511('0x48')]=function(_0x559d32,_0x4fe17b,_0x569e0a){var _0x9f0d9c={};var _0x4ea756={};var _0x50dffd;var _0x1ec75e;return db[_0xc511('0x2c')]['findOne']({'where':{'id':_0x559d32[_0xc511('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fe17b,null))['then'](function(_0x46e569){if(_0x46e569){_0x50dffd=_0x46e569;_0x4ea756['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x4ea756[_0xc511('0x31')]=_[_0xc511('0x2f')](_0x559d32[_0xc511('0x31')]);_0x4ea756['filters']=_[_0xc511('0x30')](_0x4ea756['model'],_0x4ea756['query']);_0x9f0d9c['attributes']=_[_0xc511('0x30')](_0x4ea756[_0xc511('0x2e')],qs['fields'](_0x559d32[_0xc511('0x31')][_0xc511('0x32')]));_0x9f0d9c[_0xc511('0x33')]=_0x9f0d9c['attributes'][_0xc511('0x34')]?_0x9f0d9c[_0xc511('0x33')]:_0x4ea756[_0xc511('0x2e')];_0x9f0d9c[_0xc511('0x37')]=qs['sort'](_0x559d32[_0xc511('0x31')][_0xc511('0x38')]);_0x9f0d9c[_0xc511('0x39')]=qs[_0xc511('0x3a')](_[_0xc511('0x3b')](_0x559d32[_0xc511('0x31')],_0x4ea756[_0xc511('0x3a')]));if(_0x559d32[_0xc511('0x31')][_0xc511('0x3c')]){_0x9f0d9c[_0xc511('0x39')]=_[_0xc511('0x3d')](_0x9f0d9c['where'],{'$or':_[_0xc511('0x2b')](_0x9f0d9c[_0xc511('0x33')],function(_0x32348e){var _0x1e3515={};_0x1e3515[_0x32348e]={'$like':'%'+_0x559d32[_0xc511('0x31')][_0xc511('0x3c')]+'%'};return _0x1e3515;})});}_0x9f0d9c=_[_0xc511('0x3d')]({},_0x9f0d9c,_0x559d32[_0xc511('0x44')]);return _0x50dffd[_0xc511('0x48')](_0x9f0d9c);}})[_0xc511('0x25')](function(_0x37af77){if(_0x37af77){_0x1ec75e=_0x37af77[_0xc511('0x34')];if(!_0x559d32['query'][_0xc511('0x35')](_0xc511('0x36'))){_0x9f0d9c['limit']=qs[_0xc511('0x1d')](_0x559d32[_0xc511('0x31')][_0xc511('0x1d')]);_0x9f0d9c['offset']=qs[_0xc511('0x1b')](_0x559d32[_0xc511('0x31')][_0xc511('0x1b')]);}return _0x50dffd[_0xc511('0x48')](_0x9f0d9c);}})[_0xc511('0x25')](function(_0x69a973){if(_0x69a973){return _0x69a973?{'count':_0x1ec75e,'rows':_0x69a973}:null;}})[_0xc511('0x25')](respondWithResult(_0x4fe17b,null))[_0xc511('0x42')](handleError(_0x4fe17b,null));};exports['getSubjects']=function(_0x6cde22,_0x4c3806,_0x50843d){var _0x277c4a={};var _0x538054={};var _0x123070;var _0x2bd4aa;return db[_0xc511('0x2c')][_0xc511('0x49')]({'where':{'id':_0x6cde22[_0xc511('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c3806,null))['then'](function(_0x5d6685){if(_0x5d6685){_0x123070=_0x5d6685;_0x538054[_0xc511('0x2e')]=_['keys'](db[_0xc511('0x4a')]['rawAttributes']);_0x538054[_0xc511('0x31')]=_[_0xc511('0x2f')](_0x6cde22['query']);_0x538054[_0xc511('0x3a')]=_[_0xc511('0x30')](_0x538054[_0xc511('0x2e')],_0x538054[_0xc511('0x31')]);_0x277c4a['attributes']=_[_0xc511('0x30')](_0x538054[_0xc511('0x2e')],qs[_0xc511('0x32')](_0x6cde22['query']['fields']));_0x277c4a['attributes']=_0x277c4a[_0xc511('0x33')]['length']?_0x277c4a[_0xc511('0x33')]:_0x538054[_0xc511('0x2e')];_0x277c4a[_0xc511('0x37')]=qs['sort'](_0x6cde22[_0xc511('0x31')][_0xc511('0x38')]);_0x277c4a[_0xc511('0x39')]=qs[_0xc511('0x3a')](_['pick'](_0x6cde22[_0xc511('0x31')],_0x538054[_0xc511('0x3a')]));if(_0x6cde22[_0xc511('0x31')][_0xc511('0x3c')]){_0x277c4a[_0xc511('0x39')]=_[_0xc511('0x3d')](_0x277c4a[_0xc511('0x39')],{'$or':_[_0xc511('0x2b')](_0x277c4a[_0xc511('0x33')],function(_0xe667a3){var _0x35b962={};_0x35b962[_0xe667a3]={'$like':'%'+_0x6cde22[_0xc511('0x31')][_0xc511('0x3c')]+'%'};return _0x35b962;})});}_0x277c4a=_['merge']({},_0x277c4a,_0x6cde22['options']);return _0x123070[_0xc511('0x4b')](_0x277c4a);}})[_0xc511('0x25')](function(_0x717c4f){if(_0x717c4f){_0x2bd4aa=_0x717c4f['length'];if(!_0x6cde22[_0xc511('0x31')][_0xc511('0x35')]('nolimit')){_0x277c4a[_0xc511('0x1d')]=qs['limit'](_0x6cde22['query']['limit']);_0x277c4a['offset']=qs[_0xc511('0x1b')](_0x6cde22[_0xc511('0x31')]['offset']);}return _0x123070[_0xc511('0x4b')](_0x277c4a);}})['then'](function(_0x2b04c7){if(_0x2b04c7){return _0x2b04c7?{'count':_0x2bd4aa,'rows':_0x2b04c7}:null;}})[_0xc511('0x25')](respondWithResult(_0x4c3806,null))[_0xc511('0x42')](handleError(_0x4c3806,null));};exports['getDescriptions']=function(_0xf327f3,_0x5020e2,_0x4965d8){var _0x1d7c8c={};var _0x25ef23={};var _0x3f34b6;var _0x2f51dc;return db[_0xc511('0x2c')][_0xc511('0x49')]({'where':{'id':_0xf327f3[_0xc511('0x43')]['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x5020e2,null))['then'](function(_0x2b5fd8){if(_0x2b5fd8){_0x3f34b6=_0x2b5fd8;_0x25ef23[_0xc511('0x2e')]=_[_0xc511('0x2f')](db[_0xc511('0x4a')][_0xc511('0x4c')]);_0x25ef23[_0xc511('0x31')]=_['keys'](_0xf327f3[_0xc511('0x31')]);_0x25ef23['filters']=_['intersection'](_0x25ef23[_0xc511('0x2e')],_0x25ef23[_0xc511('0x31')]);_0x1d7c8c[_0xc511('0x33')]=_[_0xc511('0x30')](_0x25ef23['model'],qs[_0xc511('0x32')](_0xf327f3['query'][_0xc511('0x32')]));_0x1d7c8c[_0xc511('0x33')]=_0x1d7c8c['attributes']['length']?_0x1d7c8c[_0xc511('0x33')]:_0x25ef23[_0xc511('0x2e')];_0x1d7c8c['order']=qs[_0xc511('0x38')](_0xf327f3[_0xc511('0x31')][_0xc511('0x38')]);_0x1d7c8c['where']=qs[_0xc511('0x3a')](_[_0xc511('0x3b')](_0xf327f3[_0xc511('0x31')],_0x25ef23[_0xc511('0x3a')]));if(_0xf327f3[_0xc511('0x31')][_0xc511('0x3c')]){_0x1d7c8c[_0xc511('0x39')]=_[_0xc511('0x3d')](_0x1d7c8c[_0xc511('0x39')],{'$or':_[_0xc511('0x2b')](_0x1d7c8c[_0xc511('0x33')],function(_0x2730a1){var _0x44d270={};_0x44d270[_0x2730a1]={'$like':'%'+_0xf327f3[_0xc511('0x31')][_0xc511('0x3c')]+'%'};return _0x44d270;})});}_0x1d7c8c=_[_0xc511('0x3d')]({},_0x1d7c8c,_0xf327f3[_0xc511('0x44')]);return _0x3f34b6[_0xc511('0x4d')](_0x1d7c8c);}})['then'](function(_0x1bee66){if(_0x1bee66){_0x2f51dc=_0x1bee66[_0xc511('0x34')];if(!_0xf327f3['query']['hasOwnProperty'](_0xc511('0x36'))){_0x1d7c8c[_0xc511('0x1d')]=qs[_0xc511('0x1d')](_0xf327f3[_0xc511('0x31')][_0xc511('0x1d')]);_0x1d7c8c['offset']=qs[_0xc511('0x1b')](_0xf327f3[_0xc511('0x31')]['offset']);}return _0x3f34b6[_0xc511('0x4d')](_0x1d7c8c);}})[_0xc511('0x25')](function(_0x3525fe){if(_0x3525fe){return _0x3525fe?{'count':_0x2f51dc,'rows':_0x3525fe}:null;}})[_0xc511('0x25')](respondWithResult(_0x5020e2,null))['catch'](handleError(_0x5020e2,null));};exports[_0xc511('0x4e')]=function(_0x1b401a,_0x946c8,_0x51e286){var _0x3a8033={};var _0x561878={};var _0x3485e5;var _0x215529;return db[_0xc511('0x2c')][_0xc511('0x49')]({'where':{'id':_0x1b401a['params']['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x946c8,null))['then'](function(_0x5612e2){if(_0x5612e2){_0x3485e5=_0x5612e2;_0x561878[_0xc511('0x2e')]=_['keys'](db[_0xc511('0x4f')][_0xc511('0x4c')]);_0x561878[_0xc511('0x31')]=_[_0xc511('0x2f')](_0x1b401a[_0xc511('0x31')]);_0x561878['filters']=_['intersection'](_0x561878[_0xc511('0x2e')],_0x561878[_0xc511('0x31')]);_0x3a8033[_0xc511('0x33')]=_['intersection'](_0x561878[_0xc511('0x2e')],qs['fields'](_0x1b401a[_0xc511('0x31')]['fields']));_0x3a8033[_0xc511('0x33')]=_0x3a8033[_0xc511('0x33')][_0xc511('0x34')]?_0x3a8033['attributes']:_0x561878[_0xc511('0x2e')];_0x3a8033[_0xc511('0x37')]=qs[_0xc511('0x38')](_0x1b401a[_0xc511('0x31')]['sort']);_0x3a8033['where']=qs[_0xc511('0x3a')](_[_0xc511('0x3b')](_0x1b401a[_0xc511('0x31')],_0x561878[_0xc511('0x3a')]));if(_0x1b401a[_0xc511('0x31')][_0xc511('0x3c')]){_0x3a8033[_0xc511('0x39')]=_[_0xc511('0x3d')](_0x3a8033[_0xc511('0x39')],{'$or':_[_0xc511('0x2b')](_0x3a8033[_0xc511('0x33')],function(_0x41954c){var _0x2631a5={};_0x2631a5[_0x41954c]={'$like':'%'+_0x1b401a[_0xc511('0x31')][_0xc511('0x3c')]+'%'};return _0x2631a5;})});}_0x3a8033=_[_0xc511('0x3d')]({},_0x3a8033,_0x1b401a['options']);return _0x3485e5[_0xc511('0x4e')](_0x3a8033);}})[_0xc511('0x25')](function(_0x134d75){if(_0x134d75){_0x215529=_0x134d75[_0xc511('0x34')];if(!_0x1b401a['query'][_0xc511('0x35')]('nolimit')){_0x3a8033[_0xc511('0x1d')]=qs['limit'](_0x1b401a[_0xc511('0x31')][_0xc511('0x1d')]);_0x3a8033[_0xc511('0x1b')]=qs[_0xc511('0x1b')](_0x1b401a['query'][_0xc511('0x1b')]);}return _0x3485e5[_0xc511('0x4e')](_0x3a8033);}})[_0xc511('0x25')](function(_0x3b0f69){if(_0x3b0f69){return _0x3b0f69?{'count':_0x215529,'rows':_0x3b0f69}:null;}})['then'](respondWithResult(_0x946c8,null))[_0xc511('0x42')](handleError(_0x946c8,null));};exports[_0xc511('0x50')]=function(_0x5e628d,_0x31c860,_0x139257){if(_0x5e628d[_0xc511('0x47')]['id']){delete _0x5e628d[_0xc511('0x47')]['id'];}return db['FreshdeskConfiguration'][_0xc511('0x49')]({'where':{'id':_0x5e628d['params']['id']}})[_0xc511('0x25')](handleEntityNotFound(_0x31c860,null))['then'](function(_0x389648){if(_0x389648){return _0x389648[_0xc511('0x50')](_0x5e628d['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x31c860,null))[_0xc511('0x42')](handleError(_0x31c860,null));}; \ No newline at end of file +var _0x5deb=['getFields','findOne','FreshdeskField','order','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body'];(function(_0x18a577,_0x25560c){var _0x1cb0c7=function(_0x195eeb){while(--_0x195eeb){_0x18a577['push'](_0x18a577['shift']());}};_0x1cb0c7(++_0x25560c);}(_0x5deb,0x1be));var _0xb5de=function(_0x54bfa9,_0x424d55){_0x54bfa9=_0x54bfa9-0x0;var _0x160e13=_0x5deb[_0x54bfa9];return _0x160e13;};'use strict';var emlformat=require(_0xb5de('0x0'));var rimraf=require(_0xb5de('0x1'));var zipdir=require(_0xb5de('0x2'));var jsonpatch=require(_0xb5de('0x3'));var rp=require(_0xb5de('0x4'));var moment=require(_0xb5de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb5de('0x6'));var util=require(_0xb5de('0x7'));var path=require(_0xb5de('0x8'));var sox=require(_0xb5de('0x9'));var csv=require(_0xb5de('0xa'));var ejs=require(_0xb5de('0xb'));var fs=require('fs');var fs_extra=require(_0xb5de('0xc'));var _=require(_0xb5de('0xd'));var squel=require(_0xb5de('0xe'));var crypto=require(_0xb5de('0xf'));var jsforce=require(_0xb5de('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb5de('0x11'));var authService=require(_0xb5de('0x12'));var qs=require(_0xb5de('0x13'));var as=require(_0xb5de('0x14'));var hardwareService=require(_0xb5de('0x15'));var logger=require(_0xb5de('0x16'))('api');var utils=require(_0xb5de('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb5de('0x18'));var db=require(_0xb5de('0x19'))['db'];function respondWithStatusCode(_0x1780dd,_0x5f5970){_0x5f5970=_0x5f5970||0xcc;return function(_0xf56797){if(_0xf56797){return _0x1780dd[_0xb5de('0x1a')](_0x5f5970);}return _0x1780dd[_0xb5de('0x1b')](_0x5f5970)[_0xb5de('0x1c')]();};}function respondWithResult(_0x424160,_0x2d66b1){_0x2d66b1=_0x2d66b1||0xc8;return function(_0x53b9fc){if(_0x53b9fc){return _0x424160[_0xb5de('0x1b')](_0x2d66b1)[_0xb5de('0x1d')](_0x53b9fc);}};}function respondWithFilteredResult(_0x3727ad,_0x5ebbb9){return function(_0x20dcac){if(_0x20dcac){var _0x43dc43=typeof _0x5ebbb9['offset']===_0xb5de('0x1e')&&typeof _0x5ebbb9[_0xb5de('0x1f')]==='undefined';var _0x5af024=_0x20dcac[_0xb5de('0x20')];var _0xc882b=_0x43dc43?0x0:_0x5ebbb9[_0xb5de('0x21')];var _0x5e82ab=_0x43dc43?_0x20dcac[_0xb5de('0x20')]:_0x5ebbb9[_0xb5de('0x21')]+_0x5ebbb9['limit'];var _0x2af9db;if(_0x5e82ab>=_0x5af024){_0x5e82ab=_0x5af024;_0x2af9db=0xc8;}else{_0x2af9db=0xce;}_0x3727ad[_0xb5de('0x1b')](_0x2af9db);return _0x3727ad['set'](_0xb5de('0x22'),_0xc882b+'-'+_0x5e82ab+'/'+_0x5af024)[_0xb5de('0x1d')](_0x20dcac);}return null;};}function patchUpdates(_0x2033b0){return function(_0xac8228){try{jsonpatch[_0xb5de('0x23')](_0xac8228,_0x2033b0,!![]);}catch(_0x1dc0e5){return BPromise['reject'](_0x1dc0e5);}return _0xac8228[_0xb5de('0x24')]();};}function saveUpdates(_0x21623c,_0x333685){return function(_0x1ba62c){if(_0x1ba62c){return _0x1ba62c[_0xb5de('0x25')](_0x21623c)['then'](function(_0x506c97){return _0x506c97;});}return null;};}function removeEntity(_0x424e32,_0x183466){return function(_0x360595){if(_0x360595){return _0x360595[_0xb5de('0x26')]()[_0xb5de('0x27')](function(){_0x424e32['status'](0xcc)[_0xb5de('0x1c')]();});}};}function handleEntityNotFound(_0x44e7a1,_0x19a19a){return function(_0x130d83){if(!_0x130d83){_0x44e7a1[_0xb5de('0x1a')](0x194);}return _0x130d83;};}function handleError(_0x16bf69,_0x34405a){_0x34405a=_0x34405a||0x1f4;return function(_0x56b8ae){logger[_0xb5de('0x28')](_0x56b8ae[_0xb5de('0x29')]);if(_0x56b8ae[_0xb5de('0x2a')]){delete _0x56b8ae['name'];}_0x16bf69[_0xb5de('0x1b')](_0x34405a)[_0xb5de('0x2b')](_0x56b8ae);};}exports[_0xb5de('0x2c')]=function(_0x1de6f4,_0x4080d7){var _0x1d0e35={},_0x37f8c8={},_0x122f99={'count':0x0,'rows':[]};var _0x1281ff=_[_0xb5de('0x2d')](db[_0xb5de('0x2e')][_0xb5de('0x2f')],function(_0x5dd35e){return{'name':_0x5dd35e[_0xb5de('0x30')],'type':_0x5dd35e['type']['key']};});_0x37f8c8[_0xb5de('0x31')]=_[_0xb5de('0x2d')](_0x1281ff,_0xb5de('0x2a'));_0x37f8c8[_0xb5de('0x32')]=_['keys'](_0x1de6f4[_0xb5de('0x32')]);_0x37f8c8[_0xb5de('0x33')]=_['intersection'](_0x37f8c8[_0xb5de('0x31')],_0x37f8c8[_0xb5de('0x32')]);_0x1d0e35[_0xb5de('0x34')]=_[_0xb5de('0x35')](_0x37f8c8['model'],qs[_0xb5de('0x36')](_0x1de6f4[_0xb5de('0x32')][_0xb5de('0x36')]));_0x1d0e35[_0xb5de('0x34')]=_0x1d0e35[_0xb5de('0x34')][_0xb5de('0x37')]?_0x1d0e35[_0xb5de('0x34')]:_0x37f8c8[_0xb5de('0x31')];if(!_0x1de6f4[_0xb5de('0x32')][_0xb5de('0x38')](_0xb5de('0x39'))){_0x1d0e35[_0xb5de('0x1f')]=qs[_0xb5de('0x1f')](_0x1de6f4[_0xb5de('0x32')][_0xb5de('0x1f')]);_0x1d0e35[_0xb5de('0x21')]=qs[_0xb5de('0x21')](_0x1de6f4[_0xb5de('0x32')][_0xb5de('0x21')]);}_0x1d0e35['order']=qs[_0xb5de('0x3a')](_0x1de6f4['query'][_0xb5de('0x3a')]);_0x1d0e35['where']=qs[_0xb5de('0x33')](_['pick'](_0x1de6f4[_0xb5de('0x32')],_0x37f8c8[_0xb5de('0x33')]),_0x1281ff);if(_0x1de6f4[_0xb5de('0x32')][_0xb5de('0x3b')]){_0x1d0e35[_0xb5de('0x3c')]=_[_0xb5de('0x3d')](_0x1d0e35[_0xb5de('0x3c')],{'$or':_[_0xb5de('0x2d')](_0x1281ff,function(_0x4ad197){if(_0x4ad197[_0xb5de('0x3e')]!==_0xb5de('0x3f')){var _0xf4beb2={};_0xf4beb2[_0x4ad197[_0xb5de('0x2a')]]={'$like':'%'+_0x1de6f4[_0xb5de('0x32')][_0xb5de('0x3b')]+'%'};return _0xf4beb2;}})});}_0x1d0e35=_[_0xb5de('0x3d')]({},_0x1d0e35,_0x1de6f4[_0xb5de('0x40')]);var _0x5d50b7={'where':_0x1d0e35[_0xb5de('0x3c')]};return db['FreshdeskConfiguration'][_0xb5de('0x20')](_0x5d50b7)['then'](function(_0x4e36c6){_0x122f99[_0xb5de('0x20')]=_0x4e36c6;if(_0x1de6f4[_0xb5de('0x32')][_0xb5de('0x41')]){_0x1d0e35[_0xb5de('0x42')]=[{'all':!![]}];}return db[_0xb5de('0x2e')][_0xb5de('0x43')](_0x1d0e35);})[_0xb5de('0x27')](function(_0x26eb13){_0x122f99[_0xb5de('0x44')]=_0x26eb13;return _0x122f99;})['then'](respondWithFilteredResult(_0x4080d7,_0x1d0e35))['catch'](handleError(_0x4080d7,null));};exports[_0xb5de('0x45')]=function(_0x580ef0,_0x4c0ede){var _0x2906ac={'raw':![],'where':{'id':_0x580ef0[_0xb5de('0x46')]['id']}},_0x322b9f={};_0x322b9f[_0xb5de('0x31')]=_[_0xb5de('0x47')](db[_0xb5de('0x2e')]['rawAttributes']);_0x322b9f[_0xb5de('0x32')]=_[_0xb5de('0x47')](_0x580ef0[_0xb5de('0x32')]);_0x322b9f[_0xb5de('0x33')]=_['intersection'](_0x322b9f[_0xb5de('0x31')],_0x322b9f[_0xb5de('0x32')]);_0x2906ac[_0xb5de('0x34')]=_[_0xb5de('0x35')](_0x322b9f[_0xb5de('0x31')],qs[_0xb5de('0x36')](_0x580ef0[_0xb5de('0x32')]['fields']));_0x2906ac[_0xb5de('0x34')]=_0x2906ac['attributes'][_0xb5de('0x37')]?_0x2906ac[_0xb5de('0x34')]:_0x322b9f[_0xb5de('0x31')];if(_0x580ef0[_0xb5de('0x32')]['includeAll']){_0x2906ac[_0xb5de('0x42')]=[{'all':!![]}];}_0x2906ac=_['merge']({},_0x2906ac,_0x580ef0[_0xb5de('0x40')]);return db[_0xb5de('0x2e')][_0xb5de('0x48')](_0x2906ac)[_0xb5de('0x27')](handleEntityNotFound(_0x4c0ede,null))[_0xb5de('0x27')](respondWithResult(_0x4c0ede,null))[_0xb5de('0x49')](handleError(_0x4c0ede,null));};exports[_0xb5de('0x4a')]=function(_0x58a520,_0x5873ae){return db[_0xb5de('0x2e')][_0xb5de('0x4a')](_0x58a520[_0xb5de('0x4b')],{})['then'](respondWithResult(_0x5873ae,0xc9))[_0xb5de('0x49')](handleError(_0x5873ae,null));};exports[_0xb5de('0x25')]=function(_0x27205b,_0x25e771){if(_0x27205b[_0xb5de('0x4b')]['id']){delete _0x27205b['body']['id'];}return db[_0xb5de('0x2e')][_0xb5de('0x48')]({'where':{'id':_0x27205b[_0xb5de('0x46')]['id']}})[_0xb5de('0x27')](handleEntityNotFound(_0x25e771,null))[_0xb5de('0x27')](saveUpdates(_0x27205b['body'],null))[_0xb5de('0x27')](respondWithResult(_0x25e771,null))[_0xb5de('0x49')](handleError(_0x25e771,null));};exports[_0xb5de('0x26')]=function(_0x41b4a1,_0x3ba52e){return db[_0xb5de('0x2e')][_0xb5de('0x48')]({'where':{'id':_0x41b4a1[_0xb5de('0x46')]['id']}})[_0xb5de('0x27')](handleEntityNotFound(_0x3ba52e,null))[_0xb5de('0x27')](removeEntity(_0x3ba52e,null))['catch'](handleError(_0x3ba52e,null));};exports[_0xb5de('0x4c')]=function(_0x2b6581,_0x6b25e6,_0x9a1278){var _0x3af256={};var _0x11c767={};var _0x345aae;var _0x4ef4b9;return db[_0xb5de('0x2e')][_0xb5de('0x4d')]({'where':{'id':_0x2b6581[_0xb5de('0x46')]['id']}})['then'](handleEntityNotFound(_0x6b25e6,null))[_0xb5de('0x27')](function(_0xb45c5d){if(_0xb45c5d){_0x345aae=_0xb45c5d;_0x11c767[_0xb5de('0x31')]=_['keys'](db[_0xb5de('0x4e')][_0xb5de('0x2f')]);_0x11c767[_0xb5de('0x32')]=_[_0xb5de('0x47')](_0x2b6581[_0xb5de('0x32')]);_0x11c767[_0xb5de('0x33')]=_[_0xb5de('0x35')](_0x11c767[_0xb5de('0x31')],_0x11c767[_0xb5de('0x32')]);_0x3af256[_0xb5de('0x34')]=_[_0xb5de('0x35')](_0x11c767['model'],qs[_0xb5de('0x36')](_0x2b6581['query'][_0xb5de('0x36')]));_0x3af256[_0xb5de('0x34')]=_0x3af256['attributes'][_0xb5de('0x37')]?_0x3af256['attributes']:_0x11c767[_0xb5de('0x31')];_0x3af256[_0xb5de('0x4f')]=qs[_0xb5de('0x3a')](_0x2b6581[_0xb5de('0x32')][_0xb5de('0x3a')]);_0x3af256[_0xb5de('0x3c')]=qs[_0xb5de('0x33')](_[_0xb5de('0x50')](_0x2b6581['query'],_0x11c767['filters']));if(_0x2b6581[_0xb5de('0x32')][_0xb5de('0x3b')]){_0x3af256[_0xb5de('0x3c')]=_[_0xb5de('0x3d')](_0x3af256[_0xb5de('0x3c')],{'$or':_[_0xb5de('0x2d')](_0x3af256[_0xb5de('0x34')],function(_0x7f9ade){var _0x204268={};_0x204268[_0x7f9ade]={'$like':'%'+_0x2b6581[_0xb5de('0x32')]['filter']+'%'};return _0x204268;})});}_0x3af256=_[_0xb5de('0x3d')]({},_0x3af256,_0x2b6581[_0xb5de('0x40')]);return _0x345aae[_0xb5de('0x4c')](_0x3af256);}})['then'](function(_0x1a6f5f){if(_0x1a6f5f){_0x4ef4b9=_0x1a6f5f['length'];if(!_0x2b6581['query']['hasOwnProperty'](_0xb5de('0x39'))){_0x3af256[_0xb5de('0x1f')]=qs[_0xb5de('0x1f')](_0x2b6581['query']['limit']);_0x3af256[_0xb5de('0x21')]=qs['offset'](_0x2b6581[_0xb5de('0x32')]['offset']);}return _0x345aae[_0xb5de('0x4c')](_0x3af256);}})['then'](function(_0x3a30e8){if(_0x3a30e8){return _0x3a30e8?{'count':_0x4ef4b9,'rows':_0x3a30e8}:null;}})['then'](respondWithResult(_0x6b25e6,null))[_0xb5de('0x49')](handleError(_0x6b25e6,null));};exports[_0xb5de('0x51')]=function(_0x71e80a,_0x10eeca,_0x207803){var _0xdb67be={};var _0x3688ba={};var _0x196b75;var _0x53375f;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x71e80a[_0xb5de('0x46')]['id']}})[_0xb5de('0x27')](handleEntityNotFound(_0x10eeca,null))[_0xb5de('0x27')](function(_0x2e31b9){if(_0x2e31b9){_0x196b75=_0x2e31b9;_0x3688ba['model']=_['keys'](db[_0xb5de('0x4e')][_0xb5de('0x2f')]);_0x3688ba[_0xb5de('0x32')]=_[_0xb5de('0x47')](_0x71e80a[_0xb5de('0x32')]);_0x3688ba['filters']=_['intersection'](_0x3688ba['model'],_0x3688ba[_0xb5de('0x32')]);_0xdb67be[_0xb5de('0x34')]=_[_0xb5de('0x35')](_0x3688ba[_0xb5de('0x31')],qs[_0xb5de('0x36')](_0x71e80a['query']['fields']));_0xdb67be['attributes']=_0xdb67be['attributes'][_0xb5de('0x37')]?_0xdb67be[_0xb5de('0x34')]:_0x3688ba['model'];_0xdb67be['order']=qs['sort'](_0x71e80a['query'][_0xb5de('0x3a')]);_0xdb67be[_0xb5de('0x3c')]=qs[_0xb5de('0x33')](_[_0xb5de('0x50')](_0x71e80a['query'],_0x3688ba[_0xb5de('0x33')]));if(_0x71e80a[_0xb5de('0x32')]['filter']){_0xdb67be[_0xb5de('0x3c')]=_[_0xb5de('0x3d')](_0xdb67be[_0xb5de('0x3c')],{'$or':_[_0xb5de('0x2d')](_0xdb67be[_0xb5de('0x34')],function(_0x5995f7){var _0x11ade4={};_0x11ade4[_0x5995f7]={'$like':'%'+_0x71e80a['query'][_0xb5de('0x3b')]+'%'};return _0x11ade4;})});}_0xdb67be=_['merge']({},_0xdb67be,_0x71e80a['options']);return _0x196b75['getSubjects'](_0xdb67be);}})[_0xb5de('0x27')](function(_0x50b768){if(_0x50b768){_0x53375f=_0x50b768['length'];if(!_0x71e80a[_0xb5de('0x32')][_0xb5de('0x38')](_0xb5de('0x39'))){_0xdb67be[_0xb5de('0x1f')]=qs[_0xb5de('0x1f')](_0x71e80a[_0xb5de('0x32')][_0xb5de('0x1f')]);_0xdb67be[_0xb5de('0x21')]=qs['offset'](_0x71e80a[_0xb5de('0x32')]['offset']);}return _0x196b75[_0xb5de('0x51')](_0xdb67be);}})[_0xb5de('0x27')](function(_0x4b6dc1){if(_0x4b6dc1){return _0x4b6dc1?{'count':_0x53375f,'rows':_0x4b6dc1}:null;}})[_0xb5de('0x27')](respondWithResult(_0x10eeca,null))['catch'](handleError(_0x10eeca,null));};exports[_0xb5de('0x52')]=function(_0x8d6a72,_0x1d2570,_0x428754){var _0x5d697f={};var _0x23d262={};var _0x25f7be;var _0x1ad64a;return db[_0xb5de('0x2e')][_0xb5de('0x4d')]({'where':{'id':_0x8d6a72['params']['id']}})[_0xb5de('0x27')](handleEntityNotFound(_0x1d2570,null))[_0xb5de('0x27')](function(_0x41ab48){if(_0x41ab48){_0x25f7be=_0x41ab48;_0x23d262['model']=_[_0xb5de('0x47')](db[_0xb5de('0x4e')][_0xb5de('0x2f')]);_0x23d262[_0xb5de('0x32')]=_['keys'](_0x8d6a72['query']);_0x23d262[_0xb5de('0x33')]=_[_0xb5de('0x35')](_0x23d262['model'],_0x23d262[_0xb5de('0x32')]);_0x5d697f[_0xb5de('0x34')]=_[_0xb5de('0x35')](_0x23d262[_0xb5de('0x31')],qs[_0xb5de('0x36')](_0x8d6a72['query'][_0xb5de('0x36')]));_0x5d697f[_0xb5de('0x34')]=_0x5d697f[_0xb5de('0x34')][_0xb5de('0x37')]?_0x5d697f[_0xb5de('0x34')]:_0x23d262[_0xb5de('0x31')];_0x5d697f[_0xb5de('0x4f')]=qs[_0xb5de('0x3a')](_0x8d6a72[_0xb5de('0x32')][_0xb5de('0x3a')]);_0x5d697f[_0xb5de('0x3c')]=qs[_0xb5de('0x33')](_['pick'](_0x8d6a72[_0xb5de('0x32')],_0x23d262[_0xb5de('0x33')]));if(_0x8d6a72[_0xb5de('0x32')]['filter']){_0x5d697f[_0xb5de('0x3c')]=_[_0xb5de('0x3d')](_0x5d697f[_0xb5de('0x3c')],{'$or':_[_0xb5de('0x2d')](_0x5d697f[_0xb5de('0x34')],function(_0x1fe94e){var _0x1b2bc0={};_0x1b2bc0[_0x1fe94e]={'$like':'%'+_0x8d6a72['query'][_0xb5de('0x3b')]+'%'};return _0x1b2bc0;})});}_0x5d697f=_['merge']({},_0x5d697f,_0x8d6a72[_0xb5de('0x40')]);return _0x25f7be[_0xb5de('0x52')](_0x5d697f);}})[_0xb5de('0x27')](function(_0x19eb94){if(_0x19eb94){_0x1ad64a=_0x19eb94[_0xb5de('0x37')];if(!_0x8d6a72[_0xb5de('0x32')]['hasOwnProperty'](_0xb5de('0x39'))){_0x5d697f[_0xb5de('0x1f')]=qs['limit'](_0x8d6a72[_0xb5de('0x32')][_0xb5de('0x1f')]);_0x5d697f[_0xb5de('0x21')]=qs[_0xb5de('0x21')](_0x8d6a72[_0xb5de('0x32')][_0xb5de('0x21')]);}return _0x25f7be[_0xb5de('0x52')](_0x5d697f);}})['then'](function(_0x23513e){if(_0x23513e){return _0x23513e?{'count':_0x1ad64a,'rows':_0x23513e}:null;}})[_0xb5de('0x27')](respondWithResult(_0x1d2570,null))[_0xb5de('0x49')](handleError(_0x1d2570,null));};exports[_0xb5de('0x53')]=function(_0x372235,_0xcfd104,_0x28eede){var _0x2213e1={};var _0xd4af07={};var _0xea8e0d;var _0x4def4c;return db[_0xb5de('0x2e')][_0xb5de('0x4d')]({'where':{'id':_0x372235['params']['id']}})[_0xb5de('0x27')](handleEntityNotFound(_0xcfd104,null))['then'](function(_0x6d4c0a){if(_0x6d4c0a){_0xea8e0d=_0x6d4c0a;_0xd4af07[_0xb5de('0x31')]=_[_0xb5de('0x47')](db[_0xb5de('0x54')]['rawAttributes']);_0xd4af07[_0xb5de('0x32')]=_[_0xb5de('0x47')](_0x372235['query']);_0xd4af07[_0xb5de('0x33')]=_[_0xb5de('0x35')](_0xd4af07['model'],_0xd4af07[_0xb5de('0x32')]);_0x2213e1['attributes']=_[_0xb5de('0x35')](_0xd4af07[_0xb5de('0x31')],qs[_0xb5de('0x36')](_0x372235[_0xb5de('0x32')][_0xb5de('0x36')]));_0x2213e1['attributes']=_0x2213e1[_0xb5de('0x34')][_0xb5de('0x37')]?_0x2213e1[_0xb5de('0x34')]:_0xd4af07[_0xb5de('0x31')];_0x2213e1[_0xb5de('0x4f')]=qs['sort'](_0x372235[_0xb5de('0x32')][_0xb5de('0x3a')]);_0x2213e1[_0xb5de('0x3c')]=qs[_0xb5de('0x33')](_['pick'](_0x372235['query'],_0xd4af07[_0xb5de('0x33')]));if(_0x372235[_0xb5de('0x32')][_0xb5de('0x3b')]){_0x2213e1[_0xb5de('0x3c')]=_[_0xb5de('0x3d')](_0x2213e1['where'],{'$or':_[_0xb5de('0x2d')](_0x2213e1[_0xb5de('0x34')],function(_0x37a602){var _0x38a508={};_0x38a508[_0x37a602]={'$like':'%'+_0x372235[_0xb5de('0x32')][_0xb5de('0x3b')]+'%'};return _0x38a508;})});}_0x2213e1=_[_0xb5de('0x3d')]({},_0x2213e1,_0x372235[_0xb5de('0x40')]);return _0xea8e0d[_0xb5de('0x53')](_0x2213e1);}})[_0xb5de('0x27')](function(_0x2a12d7){if(_0x2a12d7){_0x4def4c=_0x2a12d7[_0xb5de('0x37')];if(!_0x372235[_0xb5de('0x32')]['hasOwnProperty']('nolimit')){_0x2213e1[_0xb5de('0x1f')]=qs['limit'](_0x372235['query'][_0xb5de('0x1f')]);_0x2213e1[_0xb5de('0x21')]=qs[_0xb5de('0x21')](_0x372235[_0xb5de('0x32')]['offset']);}return _0xea8e0d[_0xb5de('0x53')](_0x2213e1);}})[_0xb5de('0x27')](function(_0x363dcd){if(_0x363dcd){return _0x363dcd?{'count':_0x4def4c,'rows':_0x363dcd}:null;}})[_0xb5de('0x27')](respondWithResult(_0xcfd104,null))[_0xb5de('0x49')](handleError(_0xcfd104,null));};exports[_0xb5de('0x55')]=function(_0x5a6ab8,_0x3889c,_0x337471){if(_0x5a6ab8[_0xb5de('0x4b')]['id']){delete _0x5a6ab8[_0xb5de('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0xb5de('0x4d')]({'where':{'id':_0x5a6ab8[_0xb5de('0x46')]['id']}})[_0xb5de('0x27')](handleEntityNotFound(_0x3889c,null))['then'](function(_0x597a4d){if(_0x597a4d){return _0x597a4d[_0xb5de('0x55')](_0x5a6ab8[_0xb5de('0x4b')][_0xb5de('0x56')]||[]);}return null;})[_0xb5de('0x27')](respondWithResult(_0x3889c,null))[_0xb5de('0x49')](handleError(_0x3889c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index ec34ca9..a5db7a6 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 _0x8973=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','api','moment','bluebird','request-promise','path'];(function(_0x57d112,_0x2bdb90){var _0x1c6f72=function(_0x272426){while(--_0x272426){_0x57d112['push'](_0x57d112['shift']());}};_0x1c6f72(++_0x2bdb90);}(_0x8973,0xed));var _0x3897=function(_0x3ffe6d,_0x239957){_0x3ffe6d=_0x3ffe6d-0x0;var _0x2131ad=_0x8973[_0x3ffe6d];return _0x2131ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3897('0x0'));var moment=require(_0x3897('0x1'));var BPromise=require(_0x3897('0x2'));var rp=require(_0x3897('0x3'));var fs=require('fs');var path=require(_0x3897('0x4'));var rimraf=require('rimraf');var config=require(_0x3897('0x5'));var attributes=require(_0x3897('0x6'));module[_0x3897('0x7')]=function(_0x52348e,_0x1336f0){return _0x52348e[_0x3897('0x8')](_0x3897('0x9'),attributes,{'tableName':_0x3897('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd89d=['FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x356aba,_0x22291a){var _0x1e7533=function(_0xe56fe){while(--_0xe56fe){_0x356aba['push'](_0x356aba['shift']());}};_0x1e7533(++_0x22291a);}(_0xd89d,0xf2));var _0xdd89=function(_0x163c97,_0x444c68){_0x163c97=_0x163c97-0x0;var _0x26dad4=_0xd89d[_0x163c97];return _0x26dad4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdd89('0x0'))('api');var moment=require(_0xdd89('0x1'));var BPromise=require(_0xdd89('0x2'));var rp=require(_0xdd89('0x3'));var fs=require('fs');var path=require(_0xdd89('0x4'));var rimraf=require(_0xdd89('0x5'));var config=require(_0xdd89('0x6'));var attributes=require(_0xdd89('0x7'));module[_0xdd89('0x8')]=function(_0x87d75e,_0x467001){return _0x87d75e[_0xdd89('0x9')](_0xdd89('0xa'),attributes,{'tableName':_0xdd89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 586624f..39c0296 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 _0x390d=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x4af8af,_0xd997ca){var _0x128429=function(_0x104708){while(--_0x104708){_0x4af8af['push'](_0x4af8af['shift']());}};_0x128429(++_0xd997ca);}(_0x390d,0x77));var _0xd390=function(_0xbf0dea,_0x1762e4){_0xbf0dea=_0xbf0dea-0x0;var _0x4d17a6=_0x390d[_0xbf0dea];return _0x4d17a6;};'use strict';var _=require(_0xd390('0x0'));var util=require(_0xd390('0x1'));var moment=require('moment');var BPromise=require(_0xd390('0x2'));var rs=require(_0xd390('0x3'));var fs=require('fs');var Redis=require(_0xd390('0x4'));var db=require(_0xd390('0x5'))['db'];var utils=require(_0xd390('0x6'));var logger=require(_0xd390('0x7'))(_0xd390('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd390('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22322b,_0x19ae6a,_0x3b23d1){return new BPromise(function(_0x4f520c,_0x188baa){return client['request'](_0x22322b,_0x3b23d1)[_0xd390('0xa')](function(_0x106817){logger[_0xd390('0xb')](_0xd390('0xc'),_0x19ae6a,_0xd390('0xd'));logger[_0xd390('0xe')](_0xd390('0xf'),_0x19ae6a,_0xd390('0xd'),JSON['stringify'](_0x106817));if(_0x106817[_0xd390('0x10')]){if(_0x106817[_0xd390('0x10')]['code']===0x1f4){logger['error'](_0xd390('0xc'),_0x19ae6a,_0x106817[_0xd390('0x10')][_0xd390('0x11')]);return _0x188baa(_0x106817[_0xd390('0x10')]['message']);}logger[_0xd390('0x10')](_0xd390('0xc'),_0x19ae6a,_0x106817['error']['message']);return _0x4f520c(_0x106817['error'][_0xd390('0x11')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x19ae6a,_0xd390('0xd'));_0x4f520c(_0x106817[_0xd390('0x12')]['message']);}})[_0xd390('0x13')](function(_0x5ad57b){logger[_0xd390('0x10')](_0xd390('0xc'),_0x19ae6a,_0x5ad57b);_0x188baa(_0x5ad57b);});});} \ No newline at end of file +var _0x3a4d=['FreshdeskConfiguration,\x20%s,\x20%s','message','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','code','error'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x3a4d,0x110));var _0xd3a4=function(_0xcba4b6,_0x1ecf6a){_0xcba4b6=_0xcba4b6-0x0;var _0x2bd8bf=_0x3a4d[_0xcba4b6];return _0x2bd8bf;};'use strict';var _=require(_0xd3a4('0x0'));var util=require(_0xd3a4('0x1'));var moment=require(_0xd3a4('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd3a4('0x4'));var logger=require(_0xd3a4('0x5'))(_0xd3a4('0x6'));var config=require(_0xd3a4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371cdc,_0x4081eb,_0x3f1ad9){return new BPromise(function(_0x576cdb,_0x2e041f){return client['request'](_0x371cdc,_0x3f1ad9)[_0xd3a4('0x9')](function(_0x467a8d){logger[_0xd3a4('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4081eb,_0xd3a4('0xb'));logger[_0xd3a4('0xc')](_0xd3a4('0xd'),_0x4081eb,_0xd3a4('0xb'),JSON['stringify'](_0x467a8d));if(_0x467a8d['error']){if(_0x467a8d['error'][_0xd3a4('0xe')]===0x1f4){logger[_0xd3a4('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4081eb,_0x467a8d[_0xd3a4('0xf')]['message']);return _0x2e041f(_0x467a8d[_0xd3a4('0xf')]['message']);}logger['error'](_0xd3a4('0x10'),_0x4081eb,_0x467a8d[_0xd3a4('0xf')][_0xd3a4('0x11')]);return _0x576cdb(_0x467a8d[_0xd3a4('0xf')]['message']);}else{logger[_0xd3a4('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4081eb,_0xd3a4('0xb'));_0x576cdb(_0x467a8d['result'][_0xd3a4('0x11')]);}})['catch'](function(_0x2df4f7){logger[_0xd3a4('0xf')](_0xd3a4('0x10'),_0x4081eb,_0x2df4f7);_0x2e041f(_0x2df4f7);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9858cb6..c4717cd 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 _0xc3b5=['index','/:id','show','post','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x7d466d,_0x489a80){var _0x3e6a40=function(_0x56f889){while(--_0x56f889){_0x7d466d['push'](_0x7d466d['shift']());}};_0x3e6a40(++_0x489a80);}(_0xc3b5,0x74));var _0x5c3b=function(_0x39ac94,_0x305b72){_0x39ac94=_0x39ac94-0x0;var _0x50654b=_0xc3b5[_0x39ac94];return _0x50654b;};'use strict';var multer=require(_0x5c3b('0x0'));var util=require(_0x5c3b('0x1'));var path=require(_0x5c3b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c3b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c3b('0x4'));var interaction=require(_0x5c3b('0x5'));var config=require(_0x5c3b('0x6'));var controller=require(_0x5c3b('0x7'));router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xa')]);router[_0x5c3b('0x8')](_0x5c3b('0xb'),auth['isAuthenticated'](),controller[_0x5c3b('0xc')]);router[_0x5c3b('0xd')]('/',auth[_0x5c3b('0x9')](),controller['create']);router[_0x5c3b('0xe')](_0x5c3b('0xb'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0x10')](_0x5c3b('0xb'),auth[_0x5c3b('0x9')](),controller['destroy']);module[_0x5c3b('0x11')]=router; \ No newline at end of file +var _0xad35=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','util'];(function(_0xf90a9,_0x2541bb){var _0x5dd272=function(_0x3d168f){while(--_0x3d168f){_0xf90a9['push'](_0xf90a9['shift']());}};_0x5dd272(++_0x2541bb);}(_0xad35,0x71));var _0x5ad3=function(_0x128e43,_0x155cc9){_0x128e43=_0x128e43-0x0;var _0x589423=_0xad35[_0x128e43];return _0x589423;};'use strict';var multer=require('multer');var util=require(_0x5ad3('0x0'));var path=require(_0x5ad3('0x1'));var timeout=require(_0x5ad3('0x2'));var express=require(_0x5ad3('0x3'));var router=express[_0x5ad3('0x4')]();var fs_extra=require(_0x5ad3('0x5'));var auth=require(_0x5ad3('0x6'));var interaction=require(_0x5ad3('0x7'));var config=require(_0x5ad3('0x8'));var controller=require(_0x5ad3('0x9'));router[_0x5ad3('0xa')]('/',auth[_0x5ad3('0xb')](),controller['index']);router[_0x5ad3('0xa')]('/:id',auth[_0x5ad3('0xb')](),controller[_0x5ad3('0xc')]);router[_0x5ad3('0xd')]('/',auth[_0x5ad3('0xb')](),controller[_0x5ad3('0xe')]);router['put'](_0x5ad3('0xf'),auth[_0x5ad3('0xb')](),controller['update']);router[_0x5ad3('0x10')](_0x5ad3('0xf'),auth[_0x5ad3('0xb')](),controller[_0x5ad3('0x11')]);module[_0x5ad3('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 fc341c8..4331dad 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 _0xa288=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','exports'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xa288,0x11f));var _0x8a28=function(_0x44b07e,_0x1fb640){_0x44b07e=_0x44b07e-0x0;var _0x26a2a3=_0xa288[_0x44b07e];return _0x26a2a3;};'use strict';var Sequelize=require('sequelize');module[_0x8a28('0x0')]={'type':{'type':Sequelize[_0x8a28('0x1')](_0x8a28('0x2'),_0x8a28('0x3'),_0x8a28('0x4'),_0x8a28('0x5'),'picklist'),'defaultValue':_0x8a28('0x2')},'content':{'type':Sequelize[_0x8a28('0x6')]},'key':{'type':Sequelize[_0x8a28('0x6')]},'keyType':{'type':Sequelize[_0x8a28('0x1')](_0x8a28('0x2'),_0x8a28('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x8a28('0x6')]},'idField':{'type':Sequelize[_0x8a28('0x6')]},'nameField':{'type':Sequelize[_0x8a28('0x6')]},'customField':{'type':Sequelize[_0x8a28('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a28('0x6')]}}; \ No newline at end of file +var _0x02c9=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable'];(function(_0x27cbf1,_0x14613c){var _0x1cfb81=function(_0x2c001a){while(--_0x2c001a){_0x27cbf1['push'](_0x27cbf1['shift']());}};_0x1cfb81(++_0x14613c);}(_0x02c9,0x19c));var _0x902c=function(_0x922b28,_0x4c3e77){_0x922b28=_0x922b28-0x0;var _0x344b39=_0x02c9[_0x922b28];return _0x344b39;};'use strict';var Sequelize=require(_0x902c('0x0'));module[_0x902c('0x1')]={'type':{'type':Sequelize[_0x902c('0x2')](_0x902c('0x3'),'variable','customVariable',_0x902c('0x4'),_0x902c('0x5')),'defaultValue':_0x902c('0x3')},'content':{'type':Sequelize[_0x902c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x902c('0x2')](_0x902c('0x3'),_0x902c('0x7'),_0x902c('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x902c('0x6')]},'nameField':{'type':Sequelize[_0x902c('0x6')]},'customField':{'type':Sequelize[_0x902c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x902c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index aabb215..6bfd4a1 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 _0x4746=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','FreshdeskField','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','intersection','find','create','body','update','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4746,0xc6));var _0x6474=function(_0x52c699,_0x11449f){_0x52c699=_0x52c699-0x0;var _0x2667aa=_0x4746[_0x52c699];return _0x2667aa;};'use strict';var emlformat=require(_0x6474('0x0'));var rimraf=require(_0x6474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6474('0x2'));var rp=require('request-promise');var moment=require(_0x6474('0x3'));var BPromise=require(_0x6474('0x4'));var Mustache=require(_0x6474('0x5'));var util=require(_0x6474('0x6'));var path=require(_0x6474('0x7'));var sox=require('sox');var csv=require(_0x6474('0x8'));var ejs=require(_0x6474('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6474('0xa'));var squel=require(_0x6474('0xb'));var crypto=require(_0x6474('0xc'));var jsforce=require(_0x6474('0xd'));var deskjs=require(_0x6474('0xe'));var toCsv=require(_0x6474('0x8'));var querystring=require('querystring');var Papa=require(_0x6474('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6474('0x10'));var as=require(_0x6474('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6474('0x12'))('api');var utils=require(_0x6474('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6474('0x14'));var db=require(_0x6474('0x15'))['db'];function respondWithStatusCode(_0x5509d2,_0x4936c2){_0x4936c2=_0x4936c2||0xcc;return function(_0x5cf0de){if(_0x5cf0de){return _0x5509d2[_0x6474('0x16')](_0x4936c2);}return _0x5509d2[_0x6474('0x17')](_0x4936c2)[_0x6474('0x18')]();};}function respondWithResult(_0xad1ebe,_0x113aba){_0x113aba=_0x113aba||0xc8;return function(_0x37fe08){if(_0x37fe08){return _0xad1ebe[_0x6474('0x17')](_0x113aba)[_0x6474('0x19')](_0x37fe08);}};}function respondWithFilteredResult(_0x29b935,_0x5cf8fa){return function(_0x5ee279){if(_0x5ee279){var _0x583afa=typeof _0x5cf8fa[_0x6474('0x1a')]===_0x6474('0x1b')&&typeof _0x5cf8fa[_0x6474('0x1c')]===_0x6474('0x1b');var _0x195465=_0x5ee279['count'];var _0x1505fc=_0x583afa?0x0:_0x5cf8fa[_0x6474('0x1a')];var _0xb6ecb6=_0x583afa?_0x5ee279[_0x6474('0x1d')]:_0x5cf8fa[_0x6474('0x1a')]+_0x5cf8fa[_0x6474('0x1c')];var _0x2e33f0;if(_0xb6ecb6>=_0x195465){_0xb6ecb6=_0x195465;_0x2e33f0=0xc8;}else{_0x2e33f0=0xce;}_0x29b935[_0x6474('0x17')](_0x2e33f0);return _0x29b935['set'](_0x6474('0x1e'),_0x1505fc+'-'+_0xb6ecb6+'/'+_0x195465)['json'](_0x5ee279);}return null;};}function patchUpdates(_0xd23b18){return function(_0x1df53c){try{jsonpatch[_0x6474('0x1f')](_0x1df53c,_0xd23b18,!![]);}catch(_0x185760){return BPromise[_0x6474('0x20')](_0x185760);}return _0x1df53c[_0x6474('0x21')]();};}function saveUpdates(_0x382ebf,_0x5d0e5c){return function(_0xf3cd65){if(_0xf3cd65){return _0xf3cd65['update'](_0x382ebf)[_0x6474('0x22')](function(_0x4dc277){return _0x4dc277;});}return null;};}function removeEntity(_0x4ba645,_0x58e024){return function(_0xb67896){if(_0xb67896){return _0xb67896[_0x6474('0x23')]()[_0x6474('0x22')](function(){_0x4ba645[_0x6474('0x17')](0xcc)[_0x6474('0x18')]();});}};}function handleEntityNotFound(_0x4a9cb6,_0x7020fb){return function(_0x388d2d){if(!_0x388d2d){_0x4a9cb6[_0x6474('0x16')](0x194);}return _0x388d2d;};}function handleError(_0x698040,_0x559b33){_0x559b33=_0x559b33||0x1f4;return function(_0x587b7a){logger[_0x6474('0x24')](_0x587b7a[_0x6474('0x25')]);if(_0x587b7a[_0x6474('0x26')]){delete _0x587b7a[_0x6474('0x26')];}_0x698040['status'](_0x559b33)['send'](_0x587b7a);};}exports['index']=function(_0x4b81f3,_0x3333a8){var _0x28d445={},_0x1751bc={},_0x2387e9={'count':0x0,'rows':[]};var _0x52e64b=_[_0x6474('0x27')](db[_0x6474('0x28')][_0x6474('0x29')],function(_0x2e01fa){return{'name':_0x2e01fa[_0x6474('0x2a')],'type':_0x2e01fa[_0x6474('0x2b')][_0x6474('0x2c')]};});_0x1751bc['model']=_[_0x6474('0x27')](_0x52e64b,_0x6474('0x26'));_0x1751bc[_0x6474('0x2d')]=_[_0x6474('0x2e')](_0x4b81f3['query']);_0x1751bc['filters']=_['intersection'](_0x1751bc[_0x6474('0x2f')],_0x1751bc[_0x6474('0x2d')]);_0x28d445[_0x6474('0x30')]=_['intersection'](_0x1751bc[_0x6474('0x2f')],qs[_0x6474('0x31')](_0x4b81f3[_0x6474('0x2d')]['fields']));_0x28d445[_0x6474('0x30')]=_0x28d445[_0x6474('0x30')][_0x6474('0x32')]?_0x28d445['attributes']:_0x1751bc[_0x6474('0x2f')];if(!_0x4b81f3[_0x6474('0x2d')]['hasOwnProperty'](_0x6474('0x33'))){_0x28d445[_0x6474('0x1c')]=qs[_0x6474('0x1c')](_0x4b81f3[_0x6474('0x2d')][_0x6474('0x1c')]);_0x28d445['offset']=qs[_0x6474('0x1a')](_0x4b81f3[_0x6474('0x2d')]['offset']);}_0x28d445['order']=qs[_0x6474('0x34')](_0x4b81f3['query'][_0x6474('0x34')]);_0x28d445[_0x6474('0x35')]=qs[_0x6474('0x36')](_[_0x6474('0x37')](_0x4b81f3[_0x6474('0x2d')],_0x1751bc['filters']),_0x52e64b);if(_0x4b81f3['query'][_0x6474('0x38')]){_0x28d445[_0x6474('0x35')]=_[_0x6474('0x39')](_0x28d445['where'],{'$or':_[_0x6474('0x27')](_0x52e64b,function(_0x4d9ad7){if(_0x4d9ad7[_0x6474('0x2b')]!=='VIRTUAL'){var _0x4c486d={};_0x4c486d[_0x4d9ad7['name']]={'$like':'%'+_0x4b81f3[_0x6474('0x2d')][_0x6474('0x38')]+'%'};return _0x4c486d;}})});}_0x28d445=_[_0x6474('0x39')]({},_0x28d445,_0x4b81f3[_0x6474('0x3a')]);var _0x455069={'where':_0x28d445[_0x6474('0x35')]};return db['FreshdeskField'][_0x6474('0x1d')](_0x455069)[_0x6474('0x22')](function(_0x4c9487){_0x2387e9[_0x6474('0x1d')]=_0x4c9487;if(_0x4b81f3[_0x6474('0x2d')][_0x6474('0x3b')]){_0x28d445['include']=[{'all':!![]}];}return db[_0x6474('0x28')][_0x6474('0x3c')](_0x28d445);})[_0x6474('0x22')](function(_0x47fa33){_0x2387e9['rows']=_0x47fa33;return _0x2387e9;})[_0x6474('0x22')](respondWithFilteredResult(_0x3333a8,_0x28d445))[_0x6474('0x3d')](handleError(_0x3333a8,null));};exports['show']=function(_0x22835c,_0x44ed73){var _0x9bdba5={'raw':!![],'where':{'id':_0x22835c['params']['id']}},_0x1a4bde={};_0x1a4bde['model']=_[_0x6474('0x2e')](db['FreshdeskField'][_0x6474('0x29')]);_0x1a4bde[_0x6474('0x2d')]=_[_0x6474('0x2e')](_0x22835c['query']);_0x1a4bde[_0x6474('0x36')]=_[_0x6474('0x3e')](_0x1a4bde['model'],_0x1a4bde[_0x6474('0x2d')]);_0x9bdba5[_0x6474('0x30')]=_[_0x6474('0x3e')](_0x1a4bde[_0x6474('0x2f')],qs[_0x6474('0x31')](_0x22835c[_0x6474('0x2d')][_0x6474('0x31')]));_0x9bdba5['attributes']=_0x9bdba5[_0x6474('0x30')][_0x6474('0x32')]?_0x9bdba5['attributes']:_0x1a4bde[_0x6474('0x2f')];if(_0x22835c[_0x6474('0x2d')]['includeAll']){_0x9bdba5['include']=[{'all':!![]}];}_0x9bdba5=_['merge']({},_0x9bdba5,_0x22835c['options']);return db[_0x6474('0x28')][_0x6474('0x3f')](_0x9bdba5)[_0x6474('0x22')](handleEntityNotFound(_0x44ed73,null))[_0x6474('0x22')](respondWithResult(_0x44ed73,null))['catch'](handleError(_0x44ed73,null));};exports[_0x6474('0x40')]=function(_0x2d8504,_0x1c411e){return db[_0x6474('0x28')][_0x6474('0x40')](_0x2d8504[_0x6474('0x41')],{})['then'](respondWithResult(_0x1c411e,0xc9))[_0x6474('0x3d')](handleError(_0x1c411e,null));};exports[_0x6474('0x42')]=function(_0x394ff9,_0x495666){if(_0x394ff9[_0x6474('0x41')]['id']){delete _0x394ff9[_0x6474('0x41')]['id'];}return db['FreshdeskField'][_0x6474('0x3f')]({'where':{'id':_0x394ff9[_0x6474('0x43')]['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x495666,null))[_0x6474('0x22')](saveUpdates(_0x394ff9[_0x6474('0x41')],null))[_0x6474('0x22')](respondWithResult(_0x495666,null))[_0x6474('0x3d')](handleError(_0x495666,null));};exports['destroy']=function(_0x27ebf9,_0x3697a0){return db[_0x6474('0x28')]['find']({'where':{'id':_0x27ebf9[_0x6474('0x43')]['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x3697a0,null))[_0x6474('0x22')](removeEntity(_0x3697a0,null))['catch'](handleError(_0x3697a0,null));}; \ No newline at end of file +var _0x6f0d=['params','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','update','destroy','then','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2ecc2a,_0x33362d){_0x2ecc2a=_0x2ecc2a-0x0;var _0x1898f1=_0x6f0d[_0x2ecc2a];return _0x1898f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];function respondWithStatusCode(_0x306aad,_0x45973d){_0x45973d=_0x45973d||0xcc;return function(_0x109655){if(_0x109655){return _0x306aad[_0xd6f0('0x19')](_0x45973d);}return _0x306aad[_0xd6f0('0x1a')](_0x45973d)[_0xd6f0('0x1b')]();};}function respondWithResult(_0x246dad,_0x4ab979){_0x4ab979=_0x4ab979||0xc8;return function(_0x2b3f32){if(_0x2b3f32){return _0x246dad[_0xd6f0('0x1a')](_0x4ab979)['json'](_0x2b3f32);}};}function respondWithFilteredResult(_0x419b7e,_0x593abe){return function(_0x3f4851){if(_0x3f4851){var _0x154e3e=typeof _0x593abe[_0xd6f0('0x1c')]===_0xd6f0('0x1d')&&typeof _0x593abe[_0xd6f0('0x1e')]===_0xd6f0('0x1d');var _0x25da0c=_0x3f4851[_0xd6f0('0x1f')];var _0x2e71bd=_0x154e3e?0x0:_0x593abe[_0xd6f0('0x1c')];var _0x23ab6c=_0x154e3e?_0x3f4851[_0xd6f0('0x1f')]:_0x593abe[_0xd6f0('0x1c')]+_0x593abe[_0xd6f0('0x1e')];var _0x1f43d7;if(_0x23ab6c>=_0x25da0c){_0x23ab6c=_0x25da0c;_0x1f43d7=0xc8;}else{_0x1f43d7=0xce;}_0x419b7e[_0xd6f0('0x1a')](_0x1f43d7);return _0x419b7e['set']('Content-Range',_0x2e71bd+'-'+_0x23ab6c+'/'+_0x25da0c)[_0xd6f0('0x20')](_0x3f4851);}return null;};}function patchUpdates(_0x264104){return function(_0x1158dc){try{jsonpatch['apply'](_0x1158dc,_0x264104,!![]);}catch(_0x67afa7){return BPromise[_0xd6f0('0x21')](_0x67afa7);}return _0x1158dc['save']();};}function saveUpdates(_0x86dde0,_0x515687){return function(_0x1ee584){if(_0x1ee584){return _0x1ee584[_0xd6f0('0x22')](_0x86dde0)['then'](function(_0xb9e820){return _0xb9e820;});}return null;};}function removeEntity(_0x45e99c,_0x5ea2dd){return function(_0x3dbdc3){if(_0x3dbdc3){return _0x3dbdc3[_0xd6f0('0x23')]()[_0xd6f0('0x24')](function(){_0x45e99c['status'](0xcc)[_0xd6f0('0x1b')]();});}};}function handleEntityNotFound(_0x3dc166,_0x5ecb16){return function(_0xcea0ae){if(!_0xcea0ae){_0x3dc166['sendStatus'](0x194);}return _0xcea0ae;};}function handleError(_0x2042d5,_0x3fb5c3){_0x3fb5c3=_0x3fb5c3||0x1f4;return function(_0x1630dc){logger[_0xd6f0('0x25')](_0x1630dc[_0xd6f0('0x26')]);if(_0x1630dc[_0xd6f0('0x27')]){delete _0x1630dc[_0xd6f0('0x27')];}_0x2042d5[_0xd6f0('0x1a')](_0x3fb5c3)['send'](_0x1630dc);};}exports[_0xd6f0('0x28')]=function(_0x1982d3,_0x55656c){var _0x38a3e9={},_0x385947={},_0x27db5e={'count':0x0,'rows':[]};var _0xb61222=_[_0xd6f0('0x29')](db[_0xd6f0('0x2a')][_0xd6f0('0x2b')],function(_0x3151f8){return{'name':_0x3151f8[_0xd6f0('0x2c')],'type':_0x3151f8[_0xd6f0('0x2d')][_0xd6f0('0x2e')]};});_0x385947[_0xd6f0('0x2f')]=_[_0xd6f0('0x29')](_0xb61222,_0xd6f0('0x27'));_0x385947[_0xd6f0('0x30')]=_[_0xd6f0('0x31')](_0x1982d3[_0xd6f0('0x30')]);_0x385947[_0xd6f0('0x32')]=_[_0xd6f0('0x33')](_0x385947[_0xd6f0('0x2f')],_0x385947[_0xd6f0('0x30')]);_0x38a3e9[_0xd6f0('0x34')]=_['intersection'](_0x385947[_0xd6f0('0x2f')],qs['fields'](_0x1982d3['query'][_0xd6f0('0x35')]));_0x38a3e9[_0xd6f0('0x34')]=_0x38a3e9[_0xd6f0('0x34')][_0xd6f0('0x36')]?_0x38a3e9[_0xd6f0('0x34')]:_0x385947['model'];if(!_0x1982d3[_0xd6f0('0x30')]['hasOwnProperty'](_0xd6f0('0x37'))){_0x38a3e9[_0xd6f0('0x1e')]=qs[_0xd6f0('0x1e')](_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x1e')]);_0x38a3e9['offset']=qs['offset'](_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x1c')]);}_0x38a3e9['order']=qs[_0xd6f0('0x38')](_0x1982d3['query'][_0xd6f0('0x38')]);_0x38a3e9[_0xd6f0('0x39')]=qs[_0xd6f0('0x32')](_[_0xd6f0('0x3a')](_0x1982d3[_0xd6f0('0x30')],_0x385947[_0xd6f0('0x32')]),_0xb61222);if(_0x1982d3[_0xd6f0('0x30')]['filter']){_0x38a3e9['where']=_[_0xd6f0('0x3b')](_0x38a3e9[_0xd6f0('0x39')],{'$or':_[_0xd6f0('0x29')](_0xb61222,function(_0x5c2d9a){if(_0x5c2d9a['type']!==_0xd6f0('0x3c')){var _0x2def01={};_0x2def01[_0x5c2d9a[_0xd6f0('0x27')]]={'$like':'%'+_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x3d')]+'%'};return _0x2def01;}})});}_0x38a3e9=_[_0xd6f0('0x3b')]({},_0x38a3e9,_0x1982d3[_0xd6f0('0x3e')]);var _0x64359c={'where':_0x38a3e9['where']};return db[_0xd6f0('0x2a')][_0xd6f0('0x1f')](_0x64359c)[_0xd6f0('0x24')](function(_0x3964e6){_0x27db5e['count']=_0x3964e6;if(_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x3f')]){_0x38a3e9[_0xd6f0('0x40')]=[{'all':!![]}];}return db[_0xd6f0('0x2a')][_0xd6f0('0x41')](_0x38a3e9);})['then'](function(_0x332809){_0x27db5e[_0xd6f0('0x42')]=_0x332809;return _0x27db5e;})[_0xd6f0('0x24')](respondWithFilteredResult(_0x55656c,_0x38a3e9))['catch'](handleError(_0x55656c,null));};exports[_0xd6f0('0x43')]=function(_0x1ddc40,_0x4b8cc7){var _0x516ffd={'raw':!![],'where':{'id':_0x1ddc40[_0xd6f0('0x44')]['id']}},_0x9cffd4={};_0x9cffd4[_0xd6f0('0x2f')]=_['keys'](db[_0xd6f0('0x2a')][_0xd6f0('0x2b')]);_0x9cffd4['query']=_[_0xd6f0('0x31')](_0x1ddc40[_0xd6f0('0x30')]);_0x9cffd4[_0xd6f0('0x32')]=_[_0xd6f0('0x33')](_0x9cffd4['model'],_0x9cffd4[_0xd6f0('0x30')]);_0x516ffd[_0xd6f0('0x34')]=_[_0xd6f0('0x33')](_0x9cffd4[_0xd6f0('0x2f')],qs[_0xd6f0('0x35')](_0x1ddc40[_0xd6f0('0x30')][_0xd6f0('0x35')]));_0x516ffd[_0xd6f0('0x34')]=_0x516ffd['attributes'][_0xd6f0('0x36')]?_0x516ffd[_0xd6f0('0x34')]:_0x9cffd4['model'];if(_0x1ddc40[_0xd6f0('0x30')][_0xd6f0('0x3f')]){_0x516ffd[_0xd6f0('0x40')]=[{'all':!![]}];}_0x516ffd=_[_0xd6f0('0x3b')]({},_0x516ffd,_0x1ddc40['options']);return db[_0xd6f0('0x2a')][_0xd6f0('0x45')](_0x516ffd)['then'](handleEntityNotFound(_0x4b8cc7,null))['then'](respondWithResult(_0x4b8cc7,null))[_0xd6f0('0x46')](handleError(_0x4b8cc7,null));};exports['create']=function(_0x35a8f5,_0x61b354){return db[_0xd6f0('0x2a')]['create'](_0x35a8f5[_0xd6f0('0x47')],{})[_0xd6f0('0x24')](respondWithResult(_0x61b354,0xc9))[_0xd6f0('0x46')](handleError(_0x61b354,null));};exports[_0xd6f0('0x22')]=function(_0xc4147e,_0x4c42ce){if(_0xc4147e[_0xd6f0('0x47')]['id']){delete _0xc4147e['body']['id'];}return db[_0xd6f0('0x2a')][_0xd6f0('0x45')]({'where':{'id':_0xc4147e[_0xd6f0('0x44')]['id']}})[_0xd6f0('0x24')](handleEntityNotFound(_0x4c42ce,null))['then'](saveUpdates(_0xc4147e['body'],null))[_0xd6f0('0x24')](respondWithResult(_0x4c42ce,null))[_0xd6f0('0x46')](handleError(_0x4c42ce,null));};exports['destroy']=function(_0xa68b18,_0x56c448){return db[_0xd6f0('0x2a')][_0xd6f0('0x45')]({'where':{'id':_0xa68b18[_0xd6f0('0x44')]['id']}})[_0xd6f0('0x24')](handleEntityNotFound(_0x56c448,null))[_0xd6f0('0x24')](removeEntity(_0x56c448,null))['catch'](handleError(_0x56c448,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f85765b..17cf7bb 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 _0xb5c2=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x13f7fe,_0x694584){var _0x662449=function(_0x2cf065){while(--_0x2cf065){_0x13f7fe['push'](_0x13f7fe['shift']());}};_0x662449(++_0x694584);}(_0xb5c2,0x1ce));var _0x2b5c=function(_0x5e1a7b,_0x6c81eb){_0x5e1a7b=_0x5e1a7b-0x0;var _0x3d484e=_0xb5c2[_0x5e1a7b];return _0x3d484e;};'use strict';var _=require('lodash');var util=require(_0x2b5c('0x0'));var logger=require(_0x2b5c('0x1'))(_0x2b5c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b5c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b5c('0x4'));var config=require(_0x2b5c('0x5'));var attributes=require(_0x2b5c('0x6'));module[_0x2b5c('0x7')]=function(_0x3ada80,_0x5c642a){return _0x3ada80[_0x2b5c('0x8')](_0x2b5c('0x9'),attributes,{'tableName':_0x2b5c('0xa'),'paranoid':![],'indexes':[{'name':_0x2b5c('0xb'),'fields':[_0x2b5c('0xc'),_0x2b5c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6250=['FieldId','util','../../config/logger','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField'];(function(_0x536037,_0x2b2515){var _0x1484eb=function(_0x4584ee){while(--_0x4584ee){_0x536037['push'](_0x536037['shift']());}};_0x1484eb(++_0x2b2515);}(_0x6250,0x85));var _0x0625=function(_0x10c038,_0x52b5ec){_0x10c038=_0x10c038-0x0;var _0x461d40=_0x6250[_0x10c038];return _0x461d40;};'use strict';var _=require('lodash');var util=require(_0x0625('0x0'));var logger=require(_0x0625('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0625('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0625('0x3'));var config=require(_0x0625('0x4'));var attributes=require(_0x0625('0x5'));module[_0x0625('0x6')]=function(_0x44cc7e,_0x7ed7c){return _0x44cc7e[_0x0625('0x7')](_0x0625('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x0625('0x9'),'fields':[_0x0625('0xa'),_0x0625('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 bbb2847..96d3ed7 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 _0x1f65=['FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','debug'];(function(_0x15c618,_0x5c5af3){var _0x25f38d=function(_0x2575d1){while(--_0x2575d1){_0x15c618['push'](_0x15c618['shift']());}};_0x25f38d(++_0x5c5af3);}(_0x1f65,0xe9));var _0x51f6=function(_0x217b17,_0x35fc8d){_0x217b17=_0x217b17-0x0;var _0x150d1b=_0x1f65[_0x217b17];return _0x150d1b;};'use strict';var _=require('lodash');var util=require(_0x51f6('0x0'));var moment=require(_0x51f6('0x1'));var BPromise=require(_0x51f6('0x2'));var rs=require(_0x51f6('0x3'));var fs=require('fs');var Redis=require(_0x51f6('0x4'));var db=require(_0x51f6('0x5'))['db'];var utils=require(_0x51f6('0x6'));var logger=require(_0x51f6('0x7'))(_0x51f6('0x8'));var config=require(_0x51f6('0x9'));var jayson=require(_0x51f6('0xa'));var client=jayson[_0x51f6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d834,_0x3ed11c,_0x2aeb4e){return new BPromise(function(_0xbbaa28,_0x57f9ba){return client[_0x51f6('0xc')](_0x40d834,_0x2aeb4e)[_0x51f6('0xd')](function(_0xcf5ee1){logger[_0x51f6('0xe')](_0x51f6('0xf'),_0x3ed11c,'request\x20sent');logger[_0x51f6('0x10')](_0x51f6('0x11'),_0x3ed11c,'request\x20sent',JSON[_0x51f6('0x12')](_0xcf5ee1));if(_0xcf5ee1[_0x51f6('0x13')]){if(_0xcf5ee1[_0x51f6('0x13')][_0x51f6('0x14')]===0x1f4){logger[_0x51f6('0x13')](_0x51f6('0xf'),_0x3ed11c,_0xcf5ee1[_0x51f6('0x13')]['message']);return _0x57f9ba(_0xcf5ee1[_0x51f6('0x13')][_0x51f6('0x15')]);}logger[_0x51f6('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x3ed11c,_0xcf5ee1['error'][_0x51f6('0x15')]);return _0xbbaa28(_0xcf5ee1[_0x51f6('0x13')][_0x51f6('0x15')]);}else{logger[_0x51f6('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x3ed11c,_0x51f6('0x16'));_0xbbaa28(_0xcf5ee1[_0x51f6('0x17')][_0x51f6('0x15')]);}})[_0x51f6('0x18')](function(_0x57cdaf){logger[_0x51f6('0x13')](_0x51f6('0xf'),_0x3ed11c,_0x57cdaf);_0x57f9ba(_0x57cdaf);});});} \ No newline at end of file +var _0x302f=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x302f,0x1aa));var _0xf302=function(_0x52788d,_0x3c67ca){_0x52788d=_0x52788d-0x0;var _0x5c7576=_0x302f[_0x52788d];return _0x5c7576;};'use strict';var _=require('lodash');var util=require(_0xf302('0x0'));var moment=require(_0xf302('0x1'));var BPromise=require(_0xf302('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf302('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf302('0x4'))(_0xf302('0x5'));var config=require(_0xf302('0x6'));var jayson=require(_0xf302('0x7'));var client=jayson[_0xf302('0x8')][_0xf302('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x423c9e,_0x469cab,_0x386cb6){return new BPromise(function(_0x5d5691,_0x5d49c5){return client[_0xf302('0xa')](_0x423c9e,_0x386cb6)[_0xf302('0xb')](function(_0x3bbaa5){logger[_0xf302('0xc')](_0xf302('0xd'),_0x469cab,_0xf302('0xe'));logger[_0xf302('0xf')](_0xf302('0x10'),_0x469cab,_0xf302('0xe'),JSON[_0xf302('0x11')](_0x3bbaa5));if(_0x3bbaa5[_0xf302('0x12')]){if(_0x3bbaa5[_0xf302('0x12')][_0xf302('0x13')]===0x1f4){logger[_0xf302('0x12')](_0xf302('0xd'),_0x469cab,_0x3bbaa5['error'][_0xf302('0x14')]);return _0x5d49c5(_0x3bbaa5[_0xf302('0x12')][_0xf302('0x14')]);}logger[_0xf302('0x12')](_0xf302('0xd'),_0x469cab,_0x3bbaa5[_0xf302('0x12')][_0xf302('0x14')]);return _0x5d5691(_0x3bbaa5[_0xf302('0x12')][_0xf302('0x14')]);}else{logger[_0xf302('0xc')](_0xf302('0xd'),_0x469cab,'request\x20sent');_0x5d5691(_0x3bbaa5[_0xf302('0x15')][_0xf302('0x14')]);}})[_0xf302('0x16')](function(_0x1ee23c){logger['error'](_0xf302('0xd'),_0x469cab,_0x1ee23c);_0x5d49c5(_0x1ee23c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9a6ff70..b9d3bbf 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x282b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x282b,0xec));var _0xb282=function(_0x39b5f8,_0x5dd5d4){_0x39b5f8=_0x39b5f8-0x0;var _0xb3314a=_0x282b[_0x39b5f8];return _0xb3314a;};'use strict';var multer=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var path=require(_0xb282('0x2'));var timeout=require(_0xb282('0x3'));var express=require(_0xb282('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb282('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb282('0x6'));var controller=require(_0xb282('0x7'));router[_0xb282('0x8')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xa')]);router[_0xb282('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb282('0xb')]);router[_0xb282('0x8')]('/:id/configurations',auth[_0xb282('0x9')](),controller[_0xb282('0xc')]);router[_0xb282('0x8')](_0xb282('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xb282('0xe')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xf')]);router[_0xb282('0xe')](_0xb282('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb282('0x11')](_0xb282('0x12'),auth[_0xb282('0x9')](),controller[_0xb282('0x13')]);router[_0xb282('0x14')]('/:id',auth[_0xb282('0x9')](),controller['destroy']);module[_0xb282('0x15')]=router; \ No newline at end of file +var _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(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x757a,0xde));var _0xa757=function(_0x14b1ae,_0x27a672){_0x14b1ae=_0x14b1ae-0x0;var _0x302184=_0x757a[_0x14b1ae];return _0x302184;};'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 dc98773..799c70b 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 _0xeb3b=['sequelize','exports','STRING'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0xeb3b[_0x42e4d7];return _0x346cd8;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')]},'description':{'type':Sequelize[_0xbeb3('0x2')]},'username':{'type':Sequelize[_0xbeb3('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbeb3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xffd6=['exports','STRING','username','sequelize'];(function(_0x1d4848,_0x5975f3){var _0x43a2b8=function(_0x38a2d3){while(--_0x38a2d3){_0x1d4848['push'](_0x1d4848['shift']());}};_0x43a2b8(++_0x5975f3);}(_0xffd6,0x97));var _0x6ffd=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xffd6[_0x45fc6a];return _0x14bcfd;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6ffd('0x3')},'apiKey':{'type':Sequelize[_0x6ffd('0x2')]},'remoteUri':{'type':Sequelize[_0x6ffd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6ffd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e507a90..da1aa35 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 _0x082b=['ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','stack','send','index','map','FreshsalesAccount','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','name','then','include','catch','show','params','length','includeAll','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','addConfiguration','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','remoteUri','apiKey','username','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x31f491,_0x1203e2){var _0x5bc8bb=function(_0x32bdb5){while(--_0x32bdb5){_0x31f491['push'](_0x31f491['shift']());}};_0x5bc8bb(++_0x1203e2);}(_0x082b,0x17f));var _0xb082=function(_0x317b2e,_0x165181){_0x317b2e=_0x317b2e-0x0;var _0x1a30d6=_0x082b[_0x317b2e];return _0x1a30d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb082('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb082('0x1'));var rp=require(_0xb082('0x2'));var moment=require(_0xb082('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb082('0x4'));var util=require(_0xb082('0x5'));var path=require(_0xb082('0x6'));var sox=require(_0xb082('0x7'));var csv=require(_0xb082('0x8'));var ejs=require(_0xb082('0x9'));var fs=require('fs');var fs_extra=require(_0xb082('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb082('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb082('0xc'));var toCsv=require(_0xb082('0x8'));var querystring=require(_0xb082('0xd'));var Papa=require('papaparse');var Redis=require(_0xb082('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb082('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb082('0x10'))(_0xb082('0x11'));var utils=require('../../config/utils');var config=require(_0xb082('0x12'));var licenseUtil=require(_0xb082('0x13'));var db=require(_0xb082('0x14'))['db'];var integrations=require(_0xb082('0x15'));function respondWithStatusCode(_0x48a38d,_0x30a2b3){_0x30a2b3=_0x30a2b3||0xcc;return function(_0x2991fc){if(_0x2991fc){return _0x48a38d[_0xb082('0x16')](_0x30a2b3);}return _0x48a38d['status'](_0x30a2b3)['end']();};}function respondWithResult(_0x34a942,_0x1ac8ef){_0x1ac8ef=_0x1ac8ef||0xc8;return function(_0x3a9179){if(_0x3a9179){return _0x34a942[_0xb082('0x17')](_0x1ac8ef)['json'](_0x3a9179);}};}function respondWithFilteredResult(_0x4651b3,_0x4ba050){return function(_0xe1146c){if(_0xe1146c){var _0x9a3cd4=typeof _0x4ba050[_0xb082('0x18')]===_0xb082('0x19')&&typeof _0x4ba050[_0xb082('0x1a')]===_0xb082('0x19');var _0xa1ee28=_0xe1146c[_0xb082('0x1b')];var _0x2d5c4c=_0x9a3cd4?0x0:_0x4ba050[_0xb082('0x18')];var _0x3c56ce=_0x9a3cd4?_0xe1146c['count']:_0x4ba050[_0xb082('0x18')]+_0x4ba050['limit'];var _0x5855dd;if(_0x3c56ce>=_0xa1ee28){_0x3c56ce=_0xa1ee28;_0x5855dd=0xc8;}else{_0x5855dd=0xce;}_0x4651b3[_0xb082('0x17')](_0x5855dd);return _0x4651b3[_0xb082('0x1c')]('Content-Range',_0x2d5c4c+'-'+_0x3c56ce+'/'+_0xa1ee28)['json'](_0xe1146c);}return null;};}function patchUpdates(_0x5f542d){return function(_0x29ca33){try{jsonpatch[_0xb082('0x1d')](_0x29ca33,_0x5f542d,!![]);}catch(_0xe73fb4){return BPromise[_0xb082('0x1e')](_0xe73fb4);}return _0x29ca33[_0xb082('0x1f')]();};}function saveUpdates(_0x32aa70,_0x48ccce){return function(_0x3df69a){if(_0x3df69a){return _0x3df69a[_0xb082('0x20')](_0x32aa70)['then'](function(_0x146b66){return _0x146b66;});}return null;};}function removeEntity(_0x1e2318,_0x571022){return function(_0x1822ff){if(_0x1822ff){return _0x1822ff[_0xb082('0x21')]()['then'](function(){_0x1e2318['status'](0xcc)[_0xb082('0x22')]();});}};}function handleEntityNotFound(_0x771d96,_0x4ab218){return function(_0x25825b){if(!_0x25825b){_0x771d96[_0xb082('0x16')](0x194);}return _0x25825b;};}function handleError(_0x22c779,_0x3725a8){_0x3725a8=_0x3725a8||0x1f4;return function(_0x14e879){logger['error'](_0x14e879[_0xb082('0x23')]);if(_0x14e879['name']){delete _0x14e879['name'];}_0x22c779[_0xb082('0x17')](_0x3725a8)[_0xb082('0x24')](_0x14e879);};}exports[_0xb082('0x25')]=function(_0x4dbfbd,_0x2591fc){var _0x2e7ff0={},_0x3bc6dd={},_0x17bbf8={'count':0x0,'rows':[]};var _0xdea9c3=_[_0xb082('0x26')](db[_0xb082('0x27')]['rawAttributes'],function(_0x47c2ae){return{'name':_0x47c2ae[_0xb082('0x28')],'type':_0x47c2ae['type'][_0xb082('0x29')]};});_0x3bc6dd['model']=_['map'](_0xdea9c3,'name');_0x3bc6dd[_0xb082('0x2a')]=_[_0xb082('0x2b')](_0x4dbfbd[_0xb082('0x2a')]);_0x3bc6dd['filters']=_[_0xb082('0x2c')](_0x3bc6dd[_0xb082('0x2d')],_0x3bc6dd['query']);_0x2e7ff0[_0xb082('0x2e')]=_['intersection'](_0x3bc6dd[_0xb082('0x2d')],qs['fields'](_0x4dbfbd[_0xb082('0x2a')][_0xb082('0x2f')]));_0x2e7ff0[_0xb082('0x2e')]=_0x2e7ff0[_0xb082('0x2e')]['length']?_0x2e7ff0['attributes']:_0x3bc6dd[_0xb082('0x2d')];if(!_0x4dbfbd[_0xb082('0x2a')][_0xb082('0x30')](_0xb082('0x31'))){_0x2e7ff0['limit']=qs['limit'](_0x4dbfbd[_0xb082('0x2a')][_0xb082('0x1a')]);_0x2e7ff0[_0xb082('0x18')]=qs['offset'](_0x4dbfbd[_0xb082('0x2a')][_0xb082('0x18')]);}_0x2e7ff0[_0xb082('0x32')]=qs[_0xb082('0x33')](_0x4dbfbd['query'][_0xb082('0x33')]);_0x2e7ff0[_0xb082('0x34')]=qs['filters'](_[_0xb082('0x35')](_0x4dbfbd[_0xb082('0x2a')],_0x3bc6dd[_0xb082('0x36')]),_0xdea9c3);if(_0x4dbfbd[_0xb082('0x2a')][_0xb082('0x37')]){_0x2e7ff0[_0xb082('0x34')]=_[_0xb082('0x38')](_0x2e7ff0[_0xb082('0x34')],{'$or':_['map'](_0xdea9c3,function(_0xa7a207){if(_0xa7a207[_0xb082('0x39')]!==_0xb082('0x3a')){var _0x152668={};_0x152668[_0xa7a207[_0xb082('0x3b')]]={'$like':'%'+_0x4dbfbd[_0xb082('0x2a')][_0xb082('0x37')]+'%'};return _0x152668;}})});}_0x2e7ff0=_[_0xb082('0x38')]({},_0x2e7ff0,_0x4dbfbd['options']);var _0x60c4d7={'where':_0x2e7ff0['where']};return db[_0xb082('0x27')][_0xb082('0x1b')](_0x60c4d7)[_0xb082('0x3c')](function(_0x4568a6){_0x17bbf8[_0xb082('0x1b')]=_0x4568a6;if(_0x4dbfbd[_0xb082('0x2a')]['includeAll']){_0x2e7ff0[_0xb082('0x3d')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x2e7ff0);})[_0xb082('0x3c')](function(_0x31141d){_0x17bbf8['rows']=_0x31141d;return _0x17bbf8;})[_0xb082('0x3c')](respondWithFilteredResult(_0x2591fc,_0x2e7ff0))[_0xb082('0x3e')](handleError(_0x2591fc,null));};exports[_0xb082('0x3f')]=function(_0x57ef1a,_0x5a857b){var _0x1274eb={'raw':![],'where':{'id':_0x57ef1a[_0xb082('0x40')]['id']}},_0x4e92bb={};_0x4e92bb[_0xb082('0x2d')]=_[_0xb082('0x2b')](db['FreshsalesAccount']['rawAttributes']);_0x4e92bb[_0xb082('0x2a')]=_[_0xb082('0x2b')](_0x57ef1a['query']);_0x4e92bb[_0xb082('0x36')]=_['intersection'](_0x4e92bb[_0xb082('0x2d')],_0x4e92bb[_0xb082('0x2a')]);_0x1274eb[_0xb082('0x2e')]=_[_0xb082('0x2c')](_0x4e92bb[_0xb082('0x2d')],qs[_0xb082('0x2f')](_0x57ef1a[_0xb082('0x2a')]['fields']));_0x1274eb[_0xb082('0x2e')]=_0x1274eb['attributes'][_0xb082('0x41')]?_0x1274eb[_0xb082('0x2e')]:_0x4e92bb[_0xb082('0x2d')];if(_0x57ef1a[_0xb082('0x2a')][_0xb082('0x42')]){_0x1274eb['include']=[{'all':!![]}];}_0x1274eb=_[_0xb082('0x38')]({},_0x1274eb,_0x57ef1a['options']);return db['FreshsalesAccount'][_0xb082('0x43')](_0x1274eb)[_0xb082('0x3c')](handleEntityNotFound(_0x5a857b,null))[_0xb082('0x3c')](respondWithResult(_0x5a857b,null))['catch'](handleError(_0x5a857b,null));};exports['create']=function(_0x16d0fd,_0x45f8bd){return db[_0xb082('0x27')][_0xb082('0x44')](_0x16d0fd[_0xb082('0x45')],{})['then'](respondWithResult(_0x45f8bd,0xc9))[_0xb082('0x3e')](handleError(_0x45f8bd,null));};exports[_0xb082('0x20')]=function(_0x30f8d0,_0x8ca472){if(_0x30f8d0['body']['id']){delete _0x30f8d0['body']['id'];}return db['FreshsalesAccount'][_0xb082('0x43')]({'where':{'id':_0x30f8d0['params']['id']}})[_0xb082('0x3c')](handleEntityNotFound(_0x8ca472,null))[_0xb082('0x3c')](saveUpdates(_0x30f8d0[_0xb082('0x45')],null))[_0xb082('0x3c')](respondWithResult(_0x8ca472,null))[_0xb082('0x3e')](handleError(_0x8ca472,null));};exports[_0xb082('0x21')]=function(_0x1b6c64,_0x28db00){return db[_0xb082('0x27')][_0xb082('0x43')]({'where':{'id':_0x1b6c64['params']['id']}})[_0xb082('0x3c')](handleEntityNotFound(_0x28db00,null))[_0xb082('0x3c')](removeEntity(_0x28db00,null))['catch'](handleError(_0x28db00,null));};exports[_0xb082('0x46')]=function(_0x57a5ba,_0x3b4a6e,_0x18dccf){var _0x3160bf={};var _0x2a7155={};var _0x1de7ae;var _0x1e8b8f;return db[_0xb082('0x27')][_0xb082('0x47')]({'where':{'id':_0x57a5ba['params']['id']}})[_0xb082('0x3c')](handleEntityNotFound(_0x3b4a6e,null))['then'](function(_0x514496){if(_0x514496){_0x1de7ae=_0x514496;_0x2a7155['model']=_[_0xb082('0x2b')](db[_0xb082('0x48')][_0xb082('0x49')]);_0x2a7155['query']=_[_0xb082('0x2b')](_0x57a5ba['query']);_0x2a7155[_0xb082('0x36')]=_[_0xb082('0x2c')](_0x2a7155[_0xb082('0x2d')],_0x2a7155[_0xb082('0x2a')]);_0x3160bf[_0xb082('0x2e')]=_[_0xb082('0x2c')](_0x2a7155[_0xb082('0x2d')],qs[_0xb082('0x2f')](_0x57a5ba[_0xb082('0x2a')][_0xb082('0x2f')]));_0x3160bf[_0xb082('0x2e')]=_0x3160bf['attributes'][_0xb082('0x41')]?_0x3160bf[_0xb082('0x2e')]:_0x2a7155['model'];_0x3160bf[_0xb082('0x32')]=qs[_0xb082('0x33')](_0x57a5ba[_0xb082('0x2a')]['sort']);_0x3160bf[_0xb082('0x34')]=qs[_0xb082('0x36')](_[_0xb082('0x35')](_0x57a5ba[_0xb082('0x2a')],_0x2a7155[_0xb082('0x36')]));if(_0x57a5ba[_0xb082('0x2a')][_0xb082('0x37')]){_0x3160bf[_0xb082('0x34')]=_['merge'](_0x3160bf[_0xb082('0x34')],{'$or':_[_0xb082('0x26')](_0x3160bf[_0xb082('0x2e')],function(_0x18e9be){var _0x42764c={};_0x42764c[_0x18e9be]={'$like':'%'+_0x57a5ba[_0xb082('0x2a')][_0xb082('0x37')]+'%'};return _0x42764c;})});}_0x3160bf=_['merge']({},_0x3160bf,_0x57a5ba['options']);return _0x1de7ae[_0xb082('0x46')](_0x3160bf);}})[_0xb082('0x3c')](function(_0x2daec4){if(_0x2daec4){_0x1e8b8f=_0x2daec4[_0xb082('0x41')];if(!_0x57a5ba[_0xb082('0x2a')]['hasOwnProperty'](_0xb082('0x31'))){_0x3160bf['limit']=qs['limit'](_0x57a5ba['query'][_0xb082('0x1a')]);_0x3160bf[_0xb082('0x18')]=qs[_0xb082('0x18')](_0x57a5ba['query']['offset']);}return _0x1de7ae['getConfigurations'](_0x3160bf);}})[_0xb082('0x3c')](function(_0x5a28c2){if(_0x5a28c2){return _0x5a28c2?{'count':_0x1e8b8f,'rows':_0x5a28c2}:null;}})['then'](respondWithResult(_0x3b4a6e,null))[_0xb082('0x3e')](handleError(_0x3b4a6e,null));};exports[_0xb082('0x4a')]=function(_0x4294a9,_0x491908,_0x42859b){if(_0x4294a9[_0xb082('0x45')]['id']){delete _0x4294a9[_0xb082('0x45')]['id'];}return db[_0xb082('0x27')][_0xb082('0x47')]({'where':{'id':_0x4294a9[_0xb082('0x40')]['id']}})['then'](handleEntityNotFound(_0x491908,null))['then'](function(_0x791b9f){if(_0x791b9f){_0x4294a9[_0xb082('0x45')]['AccountId']=_0x791b9f['id'];_0x4294a9[_0xb082('0x45')][_0xb082('0x4b')]=integrations['getSubjects'](_0x4294a9[_0xb082('0x45')][_0xb082('0x4c')],_0x4294a9[_0xb082('0x45')][_0xb082('0x39')]);_0x4294a9[_0xb082('0x45')][_0xb082('0x4d')]=integrations[_0xb082('0x4e')](_0x4294a9[_0xb082('0x45')][_0xb082('0x4c')],_0x4294a9[_0xb082('0x45')][_0xb082('0x39')]);return db[_0xb082('0x48')][_0xb082('0x44')](_0x4294a9[_0xb082('0x45')],{'include':[{'model':db[_0xb082('0x4f')],'as':'Subjects'},{'model':db[_0xb082('0x4f')],'as':_0xb082('0x4d')}]});}return null;})['then'](respondWithResult(_0x491908,null))[_0xb082('0x3e')](handleError(_0x491908,null));};exports['getFields']=function(_0x12cb78,_0x492b52,_0x2cbb37){var _0x451e31='';var _0x23b031='';return db[_0xb082('0x27')]['findOne']({'where':{'id':_0x12cb78[_0xb082('0x40')]['id']},'attributes':['id','username',_0xb082('0x50'),_0xb082('0x51')]})[_0xb082('0x3c')](handleEntityNotFound(_0x492b52,null))[_0xb082('0x3c')](function(_0x170ea4){if(_0x170ea4){_0x23b031=_0x170ea4[_0xb082('0x52')];_0x451e31=_0x170ea4['remoteUri'];var _0x5384d9=_0x170ea4[_0xb082('0x50')]['slice'](-0x1);if(_0x5384d9==='/'){_0x451e31=_0x451e31['substring'](0x0,_0x451e31[_0xb082('0x53')](_0x5384d9));}return rp({'method':_0xb082('0x54'),'uri':util[_0xb082('0x55')](_0xb082('0x56'),_0x451e31,_0xb082('0x57')),'headers':{'Authorization':_0xb082('0x58')+_0x170ea4['apiKey']},'json':!![]});}})[_0xb082('0x3c')](function(_0x1b2d9b){if(_0x1b2d9b){var _0x28519d=_0x1b2d9b[_0xb082('0x59')];var _0x261436=![];var _0x350a26=null;for(_0x350a26=0x0;_0x350a26<_0x28519d[_0xb082('0x41')];_0x350a26++){if(_0x28519d[_0x350a26][_0xb082('0x5a')]===_0x23b031){_0x261436=!![];}}if(_0x261436){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb082('0x5b')});}}})['then'](respondWithResult(_0x492b52,null))[_0xb082('0x3e')](function(_0x8e074b){var _0x5ec647=_0x12cb78[_0xb082('0x2a')][_0xb082('0x5c')]?0x1f4:_0x8e074b[_0xb082('0x5d')]||0x1f4;logger[_0xb082('0x5e')](_0xb082('0x5f'),_0xb082('0x60'),_0x5ec647,JSON['stringify'](_0x8e074b));delete _0x8e074b['name'];if(_0x5ec647===0x191){_0x5ec647=0x190;}_0x492b52['status'](_0x5ec647)[_0xb082('0x24')](_0x12cb78[_0xb082('0x2a')][_0xb082('0x5c')]?{'message':_0xb082('0x61'),'statusCode':_0x8e074b['statusCode']}:_0x8e074b);});}; \ No newline at end of file +var _0xe168=['reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','length','merge','body','update','find','params','getConfigurations','findOne','FreshsalesConfiguration','order','pick','addConfiguration','AccountId','getSubjects','channel','create','FreshsalesField','Descriptions','getFields','remoteUri','apiKey','username','slice','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x5d0d60,_0x1a7010){var _0x94f865=function(_0x20aaab){while(--_0x20aaab){_0x5d0d60['push'](_0x5d0d60['shift']());}};_0x94f865(++_0x1a7010);}(_0xe168,0x1dc));var _0x8e16=function(_0x5cfd12,_0x2b2935){_0x5cfd12=_0x5cfd12-0x0;var _0x1b4b38=_0xe168[_0x5cfd12];return _0x1b4b38;};'use strict';var emlformat=require(_0x8e16('0x0'));var rimraf=require(_0x8e16('0x1'));var zipdir=require(_0x8e16('0x2'));var jsonpatch=require(_0x8e16('0x3'));var rp=require(_0x8e16('0x4'));var moment=require(_0x8e16('0x5'));var BPromise=require(_0x8e16('0x6'));var Mustache=require(_0x8e16('0x7'));var util=require(_0x8e16('0x8'));var path=require('path');var sox=require(_0x8e16('0x9'));var csv=require(_0x8e16('0xa'));var ejs=require(_0x8e16('0xb'));var fs=require('fs');var fs_extra=require(_0x8e16('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8e16('0xd'));var deskjs=require(_0x8e16('0xe'));var toCsv=require(_0x8e16('0xa'));var querystring=require(_0x8e16('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e16('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e16('0x11'));var logger=require(_0x8e16('0x12'))(_0x8e16('0x13'));var utils=require(_0x8e16('0x14'));var config=require(_0x8e16('0x15'));var licenseUtil=require(_0x8e16('0x16'));var db=require(_0x8e16('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xec9c1b,_0x327238){_0x327238=_0x327238||0xcc;return function(_0x5d6e10){if(_0x5d6e10){return _0xec9c1b[_0x8e16('0x18')](_0x327238);}return _0xec9c1b[_0x8e16('0x19')](_0x327238)[_0x8e16('0x1a')]();};}function respondWithResult(_0x5c8bf7,_0x3c6b99){_0x3c6b99=_0x3c6b99||0xc8;return function(_0x271d1f){if(_0x271d1f){return _0x5c8bf7['status'](_0x3c6b99)[_0x8e16('0x1b')](_0x271d1f);}};}function respondWithFilteredResult(_0x5a5a3e,_0x5be05f){return function(_0x58476f){if(_0x58476f){var _0x4ae258=typeof _0x5be05f[_0x8e16('0x1c')]===_0x8e16('0x1d')&&typeof _0x5be05f[_0x8e16('0x1e')]===_0x8e16('0x1d');var _0x49ffba=_0x58476f['count'];var _0x38eb17=_0x4ae258?0x0:_0x5be05f[_0x8e16('0x1c')];var _0xfc1666=_0x4ae258?_0x58476f[_0x8e16('0x1f')]:_0x5be05f[_0x8e16('0x1c')]+_0x5be05f[_0x8e16('0x1e')];var _0x191df4;if(_0xfc1666>=_0x49ffba){_0xfc1666=_0x49ffba;_0x191df4=0xc8;}else{_0x191df4=0xce;}_0x5a5a3e['status'](_0x191df4);return _0x5a5a3e[_0x8e16('0x20')](_0x8e16('0x21'),_0x38eb17+'-'+_0xfc1666+'/'+_0x49ffba)[_0x8e16('0x1b')](_0x58476f);}return null;};}function patchUpdates(_0x59f7d3){return function(_0x18760b){try{jsonpatch['apply'](_0x18760b,_0x59f7d3,!![]);}catch(_0x39b0e6){return BPromise[_0x8e16('0x22')](_0x39b0e6);}return _0x18760b[_0x8e16('0x23')]();};}function saveUpdates(_0x385f3f,_0x28b3ef){return function(_0x24372a){if(_0x24372a){return _0x24372a['update'](_0x385f3f)[_0x8e16('0x24')](function(_0xc24f16){return _0xc24f16;});}return null;};}function removeEntity(_0x21bbab,_0x1df7bf){return function(_0x19f907){if(_0x19f907){return _0x19f907[_0x8e16('0x25')]()[_0x8e16('0x24')](function(){_0x21bbab[_0x8e16('0x19')](0xcc)[_0x8e16('0x1a')]();});}};}function handleEntityNotFound(_0x25d727,_0x3538af){return function(_0x199608){if(!_0x199608){_0x25d727['sendStatus'](0x194);}return _0x199608;};}function handleError(_0x3bb67c,_0x55301f){_0x55301f=_0x55301f||0x1f4;return function(_0x1b0606){logger[_0x8e16('0x26')](_0x1b0606[_0x8e16('0x27')]);if(_0x1b0606[_0x8e16('0x28')]){delete _0x1b0606[_0x8e16('0x28')];}_0x3bb67c[_0x8e16('0x19')](_0x55301f)[_0x8e16('0x29')](_0x1b0606);};}exports[_0x8e16('0x2a')]=function(_0x54b3a4,_0xe1d867){var _0x2cd69f={},_0x166fb1={},_0xa0eec4={'count':0x0,'rows':[]};var _0x407302=_[_0x8e16('0x2b')](db[_0x8e16('0x2c')][_0x8e16('0x2d')],function(_0x14b70b){return{'name':_0x14b70b['fieldName'],'type':_0x14b70b[_0x8e16('0x2e')][_0x8e16('0x2f')]};});_0x166fb1[_0x8e16('0x30')]=_[_0x8e16('0x2b')](_0x407302,_0x8e16('0x28'));_0x166fb1[_0x8e16('0x31')]=_['keys'](_0x54b3a4['query']);_0x166fb1[_0x8e16('0x32')]=_[_0x8e16('0x33')](_0x166fb1[_0x8e16('0x30')],_0x166fb1[_0x8e16('0x31')]);_0x2cd69f[_0x8e16('0x34')]=_['intersection'](_0x166fb1['model'],qs[_0x8e16('0x35')](_0x54b3a4[_0x8e16('0x31')][_0x8e16('0x35')]));_0x2cd69f[_0x8e16('0x34')]=_0x2cd69f[_0x8e16('0x34')]['length']?_0x2cd69f[_0x8e16('0x34')]:_0x166fb1[_0x8e16('0x30')];if(!_0x54b3a4[_0x8e16('0x31')][_0x8e16('0x36')](_0x8e16('0x37'))){_0x2cd69f[_0x8e16('0x1e')]=qs[_0x8e16('0x1e')](_0x54b3a4['query'][_0x8e16('0x1e')]);_0x2cd69f[_0x8e16('0x1c')]=qs[_0x8e16('0x1c')](_0x54b3a4[_0x8e16('0x31')]['offset']);}_0x2cd69f['order']=qs[_0x8e16('0x38')](_0x54b3a4[_0x8e16('0x31')][_0x8e16('0x38')]);_0x2cd69f[_0x8e16('0x39')]=qs[_0x8e16('0x32')](_['pick'](_0x54b3a4[_0x8e16('0x31')],_0x166fb1['filters']),_0x407302);if(_0x54b3a4['query']['filter']){_0x2cd69f[_0x8e16('0x39')]=_['merge'](_0x2cd69f[_0x8e16('0x39')],{'$or':_[_0x8e16('0x2b')](_0x407302,function(_0x8124ed){if(_0x8124ed[_0x8e16('0x2e')]!==_0x8e16('0x3a')){var _0x951ff={};_0x951ff[_0x8124ed[_0x8e16('0x28')]]={'$like':'%'+_0x54b3a4['query'][_0x8e16('0x3b')]+'%'};return _0x951ff;}})});}_0x2cd69f=_['merge']({},_0x2cd69f,_0x54b3a4[_0x8e16('0x3c')]);var _0x5212c2={'where':_0x2cd69f[_0x8e16('0x39')]};return db[_0x8e16('0x2c')]['count'](_0x5212c2)['then'](function(_0x32e062){_0xa0eec4[_0x8e16('0x1f')]=_0x32e062;if(_0x54b3a4[_0x8e16('0x31')][_0x8e16('0x3d')]){_0x2cd69f[_0x8e16('0x3e')]=[{'all':!![]}];}return db[_0x8e16('0x2c')][_0x8e16('0x3f')](_0x2cd69f);})['then'](function(_0x3874e9){_0xa0eec4[_0x8e16('0x40')]=_0x3874e9;return _0xa0eec4;})[_0x8e16('0x24')](respondWithFilteredResult(_0xe1d867,_0x2cd69f))[_0x8e16('0x41')](handleError(_0xe1d867,null));};exports['show']=function(_0x2520c9,_0x582c84){var _0x227075={'raw':![],'where':{'id':_0x2520c9['params']['id']}},_0x1082c5={};_0x1082c5['model']=_[_0x8e16('0x42')](db[_0x8e16('0x2c')][_0x8e16('0x2d')]);_0x1082c5[_0x8e16('0x31')]=_[_0x8e16('0x42')](_0x2520c9[_0x8e16('0x31')]);_0x1082c5[_0x8e16('0x32')]=_['intersection'](_0x1082c5['model'],_0x1082c5[_0x8e16('0x31')]);_0x227075[_0x8e16('0x34')]=_['intersection'](_0x1082c5[_0x8e16('0x30')],qs['fields'](_0x2520c9[_0x8e16('0x31')][_0x8e16('0x35')]));_0x227075[_0x8e16('0x34')]=_0x227075[_0x8e16('0x34')][_0x8e16('0x43')]?_0x227075[_0x8e16('0x34')]:_0x1082c5[_0x8e16('0x30')];if(_0x2520c9[_0x8e16('0x31')]['includeAll']){_0x227075[_0x8e16('0x3e')]=[{'all':!![]}];}_0x227075=_[_0x8e16('0x44')]({},_0x227075,_0x2520c9[_0x8e16('0x3c')]);return db[_0x8e16('0x2c')]['find'](_0x227075)['then'](handleEntityNotFound(_0x582c84,null))['then'](respondWithResult(_0x582c84,null))[_0x8e16('0x41')](handleError(_0x582c84,null));};exports['create']=function(_0x413c03,_0x508bad){return db[_0x8e16('0x2c')]['create'](_0x413c03[_0x8e16('0x45')],{})[_0x8e16('0x24')](respondWithResult(_0x508bad,0xc9))[_0x8e16('0x41')](handleError(_0x508bad,null));};exports[_0x8e16('0x46')]=function(_0x21f264,_0x35038a){if(_0x21f264[_0x8e16('0x45')]['id']){delete _0x21f264[_0x8e16('0x45')]['id'];}return db[_0x8e16('0x2c')][_0x8e16('0x47')]({'where':{'id':_0x21f264[_0x8e16('0x48')]['id']}})['then'](handleEntityNotFound(_0x35038a,null))[_0x8e16('0x24')](saveUpdates(_0x21f264[_0x8e16('0x45')],null))[_0x8e16('0x24')](respondWithResult(_0x35038a,null))[_0x8e16('0x41')](handleError(_0x35038a,null));};exports[_0x8e16('0x25')]=function(_0x29d47e,_0x208afd){return db[_0x8e16('0x2c')][_0x8e16('0x47')]({'where':{'id':_0x29d47e[_0x8e16('0x48')]['id']}})[_0x8e16('0x24')](handleEntityNotFound(_0x208afd,null))[_0x8e16('0x24')](removeEntity(_0x208afd,null))[_0x8e16('0x41')](handleError(_0x208afd,null));};exports[_0x8e16('0x49')]=function(_0x6e4f83,_0x222793,_0x259207){var _0x39a7d5={};var _0x255074={};var _0x4b1b9a;var _0x4f199c;return db['FreshsalesAccount'][_0x8e16('0x4a')]({'where':{'id':_0x6e4f83['params']['id']}})[_0x8e16('0x24')](handleEntityNotFound(_0x222793,null))['then'](function(_0x221068){if(_0x221068){_0x4b1b9a=_0x221068;_0x255074[_0x8e16('0x30')]=_[_0x8e16('0x42')](db[_0x8e16('0x4b')][_0x8e16('0x2d')]);_0x255074['query']=_[_0x8e16('0x42')](_0x6e4f83[_0x8e16('0x31')]);_0x255074[_0x8e16('0x32')]=_[_0x8e16('0x33')](_0x255074[_0x8e16('0x30')],_0x255074[_0x8e16('0x31')]);_0x39a7d5['attributes']=_[_0x8e16('0x33')](_0x255074[_0x8e16('0x30')],qs[_0x8e16('0x35')](_0x6e4f83[_0x8e16('0x31')][_0x8e16('0x35')]));_0x39a7d5[_0x8e16('0x34')]=_0x39a7d5['attributes']['length']?_0x39a7d5['attributes']:_0x255074[_0x8e16('0x30')];_0x39a7d5[_0x8e16('0x4c')]=qs['sort'](_0x6e4f83['query']['sort']);_0x39a7d5[_0x8e16('0x39')]=qs[_0x8e16('0x32')](_[_0x8e16('0x4d')](_0x6e4f83[_0x8e16('0x31')],_0x255074[_0x8e16('0x32')]));if(_0x6e4f83['query'][_0x8e16('0x3b')]){_0x39a7d5[_0x8e16('0x39')]=_[_0x8e16('0x44')](_0x39a7d5[_0x8e16('0x39')],{'$or':_['map'](_0x39a7d5[_0x8e16('0x34')],function(_0x5602fe){var _0x215bf7={};_0x215bf7[_0x5602fe]={'$like':'%'+_0x6e4f83['query'][_0x8e16('0x3b')]+'%'};return _0x215bf7;})});}_0x39a7d5=_[_0x8e16('0x44')]({},_0x39a7d5,_0x6e4f83[_0x8e16('0x3c')]);return _0x4b1b9a['getConfigurations'](_0x39a7d5);}})[_0x8e16('0x24')](function(_0x901634){if(_0x901634){_0x4f199c=_0x901634['length'];if(!_0x6e4f83['query'][_0x8e16('0x36')](_0x8e16('0x37'))){_0x39a7d5['limit']=qs[_0x8e16('0x1e')](_0x6e4f83[_0x8e16('0x31')][_0x8e16('0x1e')]);_0x39a7d5['offset']=qs[_0x8e16('0x1c')](_0x6e4f83[_0x8e16('0x31')]['offset']);}return _0x4b1b9a[_0x8e16('0x49')](_0x39a7d5);}})[_0x8e16('0x24')](function(_0x55cd6f){if(_0x55cd6f){return _0x55cd6f?{'count':_0x4f199c,'rows':_0x55cd6f}:null;}})[_0x8e16('0x24')](respondWithResult(_0x222793,null))[_0x8e16('0x41')](handleError(_0x222793,null));};exports[_0x8e16('0x4e')]=function(_0x4958dc,_0x2485f1,_0x269e7d){if(_0x4958dc[_0x8e16('0x45')]['id']){delete _0x4958dc[_0x8e16('0x45')]['id'];}return db[_0x8e16('0x2c')][_0x8e16('0x4a')]({'where':{'id':_0x4958dc[_0x8e16('0x48')]['id']}})[_0x8e16('0x24')](handleEntityNotFound(_0x2485f1,null))[_0x8e16('0x24')](function(_0x4a3165){if(_0x4a3165){_0x4958dc[_0x8e16('0x45')][_0x8e16('0x4f')]=_0x4a3165['id'];_0x4958dc[_0x8e16('0x45')]['Subjects']=integrations[_0x8e16('0x50')](_0x4958dc[_0x8e16('0x45')][_0x8e16('0x51')],_0x4958dc[_0x8e16('0x45')]['type']);_0x4958dc[_0x8e16('0x45')]['Descriptions']=integrations['getDescriptions'](_0x4958dc[_0x8e16('0x45')][_0x8e16('0x51')],_0x4958dc[_0x8e16('0x45')][_0x8e16('0x2e')]);return db[_0x8e16('0x4b')][_0x8e16('0x52')](_0x4958dc[_0x8e16('0x45')],{'include':[{'model':db[_0x8e16('0x53')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x8e16('0x54')}]});}return null;})['then'](respondWithResult(_0x2485f1,null))[_0x8e16('0x41')](handleError(_0x2485f1,null));};exports[_0x8e16('0x55')]=function(_0x35615e,_0x8500b0,_0x2963d9){var _0x1b153c='';var _0x64cc8a='';return db['FreshsalesAccount'][_0x8e16('0x4a')]({'where':{'id':_0x35615e[_0x8e16('0x48')]['id']},'attributes':['id','username',_0x8e16('0x56'),_0x8e16('0x57')]})[_0x8e16('0x24')](handleEntityNotFound(_0x8500b0,null))[_0x8e16('0x24')](function(_0xf0b731){if(_0xf0b731){_0x64cc8a=_0xf0b731[_0x8e16('0x58')];_0x1b153c=_0xf0b731[_0x8e16('0x56')];var _0x5bef8a=_0xf0b731[_0x8e16('0x56')][_0x8e16('0x59')](-0x1);if(_0x5bef8a==='/'){_0x1b153c=_0x1b153c[_0x8e16('0x5a')](0x0,_0x1b153c[_0x8e16('0x5b')](_0x5bef8a));}return rp({'method':_0x8e16('0x5c'),'uri':util[_0x8e16('0x5d')](_0x8e16('0x5e'),_0x1b153c,'/api/selector/owners'),'headers':{'Authorization':_0x8e16('0x5f')+_0xf0b731[_0x8e16('0x57')]},'json':!![]});}})['then'](function(_0x6571e5){if(_0x6571e5){var _0xf9a30=_0x6571e5['users'];var _0x5918e3=![];var _0x5715e3=null;for(_0x5715e3=0x0;_0x5715e3<_0xf9a30[_0x8e16('0x43')];_0x5715e3++){if(_0xf9a30[_0x5715e3][_0x8e16('0x60')]===_0x64cc8a){_0x5918e3=!![];}}if(_0x5918e3){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8e16('0x24')](respondWithResult(_0x8500b0,null))[_0x8e16('0x41')](function(_0x4fd46d){var _0x1d8888=_0x35615e['query'][_0x8e16('0x61')]?0x1f4:_0x4fd46d[_0x8e16('0x62')]||0x1f4;logger[_0x8e16('0x26')](_0x8e16('0x63'),_0x8e16('0x55'),_0x1d8888,JSON[_0x8e16('0x64')](_0x4fd46d));delete _0x4fd46d[_0x8e16('0x28')];if(_0x1d8888===0x191){_0x1d8888=0x190;}_0x8500b0['status'](_0x1d8888)['send'](_0x35615e[_0x8e16('0x31')][_0x8e16('0x61')]?{'message':_0x8e16('0x65'),'statusCode':_0x4fd46d[_0x8e16('0x62')]}:_0x4fd46d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 6ee82e9..059c715 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 _0x4fb4=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','util','../../config/logger','api'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4fb4,0x190));var _0x44fb=function(_0x302206,_0x39f56b){_0x302206=_0x302206-0x0;var _0x464e9b=_0x4fb4[_0x302206];return _0x464e9b;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var logger=require(_0x44fb('0x1'))(_0x44fb('0x2'));var moment=require(_0x44fb('0x3'));var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var attributes=require(_0x44fb('0x8'));var integrations=require(_0x44fb('0x9'));module[_0x44fb('0xa')]=function(_0x173e70,_0x464af5){return _0x173e70[_0x44fb('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x44fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','../../config/logger','api','moment','bluebird','path'];(function(_0x27a544,_0x4c38e1){var _0x312f88=function(_0x198d5e){while(--_0x198d5e){_0x27a544['push'](_0x27a544['shift']());}};_0x312f88(++_0x4c38e1);}(_0x0424,0x159));var _0x4042=function(_0x23e4cf,_0x12704d){_0x23e4cf=_0x23e4cf-0x0;var _0x2bd35a=_0x0424[_0x23e4cf];return _0x2bd35a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));var integrations=require(_0x4042('0x6'));module[_0x4042('0x7')]=function(_0xc0fba0,_0x3abaf1){return _0xc0fba0[_0x4042('0x8')](_0x4042('0x9'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 03d5793..b56eba6 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 _0x5204=['catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','include','model','map','then','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5204,0xdf));var _0x4520=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x5204[_0x310d10];return _0x1fb8af;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')]({'raw':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4['options'][_0x4520('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e00f4['options']?_0x2e00f4['options']['where']||null:null,'attributes':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'limit':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4[_0x4520('0x1a')]['limit']||null:null,'include':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4[_0x4520('0x1a')][_0x4520('0x1d')]?_['map'](_0x2e00f4[_0x4520('0x1a')][_0x4520('0x1d')],function(_0x24eacd){return{'model':db[_0x24eacd[_0x4520('0x1e')]],'as':_0x24eacd['as'],'attributes':_0x24eacd[_0x4520('0x1c')],'include':_0x24eacd['include']?_[_0x4520('0x1f')](_0x24eacd[_0x4520('0x1d')],function(_0x3532aa){return{'model':db[_0x3532aa[_0x4520('0x1e')]],'as':_0x3532aa['as'],'attributes':_0x3532aa['attributes'],'include':_0x3532aa[_0x4520('0x1d')]?_[_0x4520('0x1f')](_0x3532aa[_0x4520('0x1d')],function(_0x21e1f3){return{'model':db[_0x21e1f3[_0x4520('0x1e')]],'as':_0x21e1f3['as'],'attributes':_0x21e1f3[_0x4520('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4520('0x20')](function(_0x195c58){logger[_0x4520('0xc')](_0x4520('0x17'),_0x2e00f4);logger['debug'](_0x4520('0x17'),_0x2e00f4,JSON['stringify'](_0x195c58));_0x4ba69f(_0x195c58);})[_0x4520('0x16')](function(_0x14778a){logger[_0x4520('0x12')](_0x4520('0x17'),_0x14778a[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x14778a['message']));});});};exports[_0x4520('0x21')]=function(_0x508c05){var _0x2585eb=this;return new Promise(function(_0x4a6755,_0xf6caff){return db['FreshsalesAccount'][_0x4520('0x22')]({'raw':_0x508c05['options']?_0x508c05['options'][_0x4520('0x1b')]===undefined?!![]:![]:!![],'where':_0x508c05[_0x4520('0x1a')]?_0x508c05[_0x4520('0x1a')]['where']||null:null,'attributes':_0x508c05[_0x4520('0x1a')]?_0x508c05[_0x4520('0x1a')][_0x4520('0x1c')]||null:null,'include':_0x508c05[_0x4520('0x1a')]?_0x508c05['options']['include']?_[_0x4520('0x1f')](_0x508c05[_0x4520('0x1a')]['include'],function(_0x779e94){return{'model':db[_0x779e94[_0x4520('0x1e')]],'as':_0x779e94['as'],'attributes':_0x779e94[_0x4520('0x1c')],'include':_0x779e94[_0x4520('0x1d')]?_[_0x4520('0x1f')](_0x779e94[_0x4520('0x1d')],function(_0x550a0f){return{'model':db[_0x550a0f[_0x4520('0x1e')]],'as':_0x550a0f['as'],'attributes':_0x550a0f[_0x4520('0x1c')],'include':_0x550a0f['include']?_[_0x4520('0x1f')](_0x550a0f['include'],function(_0x8bf557){return{'model':db[_0x8bf557[_0x4520('0x1e')]],'as':_0x8bf557['as'],'attributes':_0x8bf557['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5527a6){logger[_0x4520('0xc')](_0x4520('0x21'),_0x508c05);logger[_0x4520('0xf')](_0x4520('0x21'),_0x508c05,JSON[_0x4520('0x11')](_0x5527a6));_0x4a6755(_0x5527a6);})[_0x4520('0x16')](function(_0x3bfc83){logger['error'](_0x4520('0x21'),_0x3bfc83[_0x4520('0x14')],_0x508c05);_0xf6caff(_0x2585eb[_0x4520('0x12')](0x1f4,_0x3bfc83['message']));});});}; \ No newline at end of file +var _0xed1c=['model','ShowFreshsalesAccount','find','debug','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','include','map'];(function(_0x416bed,_0xca08f8){var _0x3466d4=function(_0x4bfc07){while(--_0x4bfc07){_0x416bed['push'](_0x416bed['shift']());}};_0x3466d4(++_0xca08f8);}(_0xed1c,0xe4));var _0xced1=function(_0x166436,_0x522fe3){_0x166436=_0x166436-0x0;var _0x27b22f=_0xed1c[_0x166436];return _0x27b22f;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});}exports[_0xced1('0x14')]=function(_0x5a563a){var _0x56fc50=this;return new Promise(function(_0x2a92c8,_0x111fb0){return db[_0xced1('0x15')]['findAll']({'raw':_0x5a563a[_0xced1('0x16')]?_0x5a563a[_0xced1('0x16')][_0xced1('0x17')]===undefined?!![]:![]:!![],'where':_0x5a563a['options']?_0x5a563a[_0xced1('0x16')][_0xced1('0x18')]||null:null,'attributes':_0x5a563a[_0xced1('0x16')]?_0x5a563a['options'][_0xced1('0x19')]||null:null,'limit':_0x5a563a[_0xced1('0x16')]?_0x5a563a[_0xced1('0x16')]['limit']||null:null,'include':_0x5a563a['options']?_0x5a563a[_0xced1('0x16')][_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x5a563a[_0xced1('0x16')][_0xced1('0x1a')],function(_0x49c8b9){return{'model':db[_0x49c8b9[_0xced1('0x1c')]],'as':_0x49c8b9['as'],'attributes':_0x49c8b9[_0xced1('0x19')],'include':_0x49c8b9['include']?_['map'](_0x49c8b9[_0xced1('0x1a')],function(_0x258c9a){return{'model':db[_0x258c9a[_0xced1('0x1c')]],'as':_0x258c9a['as'],'attributes':_0x258c9a[_0xced1('0x19')],'include':_0x258c9a[_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x258c9a['include'],function(_0x181f6e){return{'model':db[_0x181f6e[_0xced1('0x1c')]],'as':_0x181f6e['as'],'attributes':_0x181f6e[_0xced1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced1('0xa')](function(_0x34dd2e){logger[_0xced1('0xb')](_0xced1('0x14'),_0x5a563a);logger['debug'](_0xced1('0x14'),_0x5a563a,JSON['stringify'](_0x34dd2e));_0x2a92c8(_0x34dd2e);})[_0xced1('0x13')](function(_0x2c2269){logger[_0xced1('0xf')](_0xced1('0x14'),_0x2c2269['message'],_0x5a563a);_0x111fb0(_0x56fc50['error'](0x1f4,_0x2c2269[_0xced1('0x11')]));});});};exports[_0xced1('0x1d')]=function(_0x2bc785){var _0x4ea07e=this;return new Promise(function(_0x573146,_0x543c47){return db[_0xced1('0x15')][_0xced1('0x1e')]({'raw':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')][_0xced1('0x18')]||null:null,'attributes':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')][_0xced1('0x19')]||null:null,'include':_0x2bc785[_0xced1('0x16')]?_0x2bc785['options']['include']?_[_0xced1('0x1b')](_0x2bc785[_0xced1('0x16')][_0xced1('0x1a')],function(_0x7ebeb3){return{'model':db[_0x7ebeb3[_0xced1('0x1c')]],'as':_0x7ebeb3['as'],'attributes':_0x7ebeb3[_0xced1('0x19')],'include':_0x7ebeb3['include']?_['map'](_0x7ebeb3['include'],function(_0x4d305c){return{'model':db[_0x4d305c[_0xced1('0x1c')]],'as':_0x4d305c['as'],'attributes':_0x4d305c[_0xced1('0x19')],'include':_0x4d305c[_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x4d305c[_0xced1('0x1a')],function(_0x1c36fa){return{'model':db[_0x1c36fa[_0xced1('0x1c')]],'as':_0x1c36fa['as'],'attributes':_0x1c36fa[_0xced1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced1('0xa')](function(_0x3dfd2f){logger[_0xced1('0xb')](_0xced1('0x1d'),_0x2bc785);logger[_0xced1('0x1f')]('ShowFreshsalesAccount',_0x2bc785,JSON[_0xced1('0xe')](_0x3dfd2f));_0x573146(_0x3dfd2f);})[_0xced1('0x13')](function(_0x1116de){logger[_0xced1('0xf')](_0xced1('0x1d'),_0x1116de[_0xced1('0x11')],_0x2bc785);_0x543c47(_0x4ea07e['error'](0x1f4,_0x1116de[_0xced1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 91dd97b..13a942d 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 _0x00b3=['getSubjects','getDescriptions','getFields','post','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x00b3,0x13a));var _0x300b=function(_0x3f8288,_0x442f1b){_0x3f8288=_0x3f8288-0x0;var _0x2aa38b=_0x00b3[_0x3f8288];return _0x2aa38b;};'use strict';var multer=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var path=require('path');var timeout=require(_0x300b('0x2'));var express=require(_0x300b('0x3'));var router=express[_0x300b('0x4')]();var fs_extra=require(_0x300b('0x5'));var auth=require(_0x300b('0x6'));var interaction=require(_0x300b('0x7'));var config=require(_0x300b('0x8'));var controller=require(_0x300b('0x9'));router[_0x300b('0xa')]('/',auth['isAuthenticated'](),controller[_0x300b('0xb')]);router[_0x300b('0xa')](_0x300b('0xc'),auth[_0x300b('0xd')](),controller[_0x300b('0xe')]);router[_0x300b('0xa')](_0x300b('0xf'),auth[_0x300b('0xd')](),controller[_0x300b('0x10')]);router['get']('/:id/descriptions',auth[_0x300b('0xd')](),controller[_0x300b('0x11')]);router[_0x300b('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x300b('0x12')]);router[_0x300b('0x13')]('/',auth[_0x300b('0xd')](),controller['create']);router[_0x300b('0x14')](_0x300b('0xc'),auth[_0x300b('0xd')](),controller['update']);router['delete'](_0x300b('0xc'),auth[_0x300b('0xd')](),controller['destroy']);module[_0x300b('0x15')]=router; \ No newline at end of file +var _0xa5dc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','multer','util','path'];(function(_0x4fb8ee,_0x431280){var _0x1f2f75=function(_0x1da04a){while(--_0x1da04a){_0x4fb8ee['push'](_0x4fb8ee['shift']());}};_0x1f2f75(++_0x431280);}(_0xa5dc,0x1e0));var _0xca5d=function(_0xe2070e,_0x3a8903){_0xe2070e=_0xe2070e-0x0;var _0x377eee=_0xa5dc[_0xe2070e];return _0x377eee;};'use strict';var multer=require(_0xca5d('0x0'));var util=require(_0xca5d('0x1'));var path=require(_0xca5d('0x2'));var timeout=require('connect-timeout');var express=require(_0xca5d('0x3'));var router=express[_0xca5d('0x4')]();var fs_extra=require(_0xca5d('0x5'));var auth=require(_0xca5d('0x6'));var interaction=require(_0xca5d('0x7'));var config=require(_0xca5d('0x8'));var controller=require(_0xca5d('0x9'));router[_0xca5d('0xa')]('/',auth[_0xca5d('0xb')](),controller[_0xca5d('0xc')]);router['get'](_0xca5d('0xd'),auth[_0xca5d('0xb')](),controller['show']);router[_0xca5d('0xa')](_0xca5d('0xe'),auth[_0xca5d('0xb')](),controller[_0xca5d('0xf')]);router[_0xca5d('0xa')](_0xca5d('0x10'),auth[_0xca5d('0xb')](),controller[_0xca5d('0x11')]);router[_0xca5d('0xa')](_0xca5d('0x12'),auth[_0xca5d('0xb')](),controller[_0xca5d('0x13')]);router[_0xca5d('0x14')]('/',auth[_0xca5d('0xb')](),controller[_0xca5d('0x15')]);router[_0xca5d('0x16')](_0xca5d('0xd'),auth[_0xca5d('0xb')](),controller['update']);router['delete'](_0xca5d('0xd'),auth[_0xca5d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a6b2136..9181ee7 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 _0xdf3e=['exports','STRING','sequelize'];(function(_0x339485,_0x59cb2b){var _0x3450c3=function(_0x44258a){while(--_0x44258a){_0x339485['push'](_0x339485['shift']());}};_0x3450c3(++_0x59cb2b);}(_0xdf3e,0x10a));var _0xedf3=function(_0x49fb98,_0x410fbe){_0x49fb98=_0x49fb98-0x0;var _0x1d5cde=_0xdf3e[_0x49fb98];return _0x1d5cde;};'use strict';var Sequelize=require(_0xedf3('0x0'));module[_0xedf3('0x1')]={'name':{'type':Sequelize[_0xedf3('0x2')]},'description':{'type':Sequelize[_0xedf3('0x2')]}}; \ No newline at end of file +var _0xc4b0=['STRING','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc4b0,0xe5));var _0x0c4b=function(_0x2af11a,_0x443532){_0x2af11a=_0x2af11a-0x0;var _0x40d52e=_0xc4b0[_0x2af11a];return _0x40d52e;};'use strict';var Sequelize=require(_0x0c4b('0x0'));module[_0x0c4b('0x1')]={'name':{'type':Sequelize[_0x0c4b('0x2')]},'description':{'type':Sequelize[_0x0c4b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 2b7ad92..c0d0aa5 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 _0x131b=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','params','include','find','create','body','catch','getSubjects','findOne','hasOwnProperty','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','moment','bluebird','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/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x563ccb,_0x4779d3){var _0x387855=function(_0x30f465){while(--_0x30f465){_0x563ccb['push'](_0x563ccb['shift']());}};_0x387855(++_0x4779d3);}(_0x131b,0x1c2));var _0xb131=function(_0x5bc4ca,_0x21f738){_0x5bc4ca=_0x5bc4ca-0x0;var _0x12bf3b=_0x131b[_0x5bc4ca];return _0x12bf3b;};'use strict';var emlformat=require(_0xb131('0x0'));var rimraf=require(_0xb131('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb131('0x2'));var BPromise=require(_0xb131('0x3'));var Mustache=require(_0xb131('0x4'));var util=require(_0xb131('0x5'));var path=require(_0xb131('0x6'));var sox=require(_0xb131('0x7'));var csv=require(_0xb131('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb131('0x9'));var _=require(_0xb131('0xa'));var squel=require(_0xb131('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb131('0xc'));var toCsv=require(_0xb131('0x8'));var querystring=require('querystring');var Papa=require(_0xb131('0xd'));var Redis=require(_0xb131('0xe'));var authService=require(_0xb131('0xf'));var qs=require(_0xb131('0x10'));var as=require(_0xb131('0x11'));var hardwareService=require(_0xb131('0x12'));var logger=require(_0xb131('0x13'))(_0xb131('0x14'));var utils=require(_0xb131('0x15'));var config=require(_0xb131('0x16'));var licenseUtil=require(_0xb131('0x17'));var db=require(_0xb131('0x18'))['db'];function respondWithStatusCode(_0x4ffbcf,_0x37e218){_0x37e218=_0x37e218||0xcc;return function(_0x1b0fdb){if(_0x1b0fdb){return _0x4ffbcf[_0xb131('0x19')](_0x37e218);}return _0x4ffbcf[_0xb131('0x1a')](_0x37e218)[_0xb131('0x1b')]();};}function respondWithResult(_0x269cb1,_0x395f8a){_0x395f8a=_0x395f8a||0xc8;return function(_0x79cde0){if(_0x79cde0){return _0x269cb1[_0xb131('0x1a')](_0x395f8a)[_0xb131('0x1c')](_0x79cde0);}};}function respondWithFilteredResult(_0x321613,_0x1a4a32){return function(_0x1134b4){if(_0x1134b4){var _0x2a90cb=typeof _0x1a4a32['offset']===_0xb131('0x1d')&&typeof _0x1a4a32[_0xb131('0x1e')]===_0xb131('0x1d');var _0x4e5ed1=_0x1134b4[_0xb131('0x1f')];var _0x2ea20c=_0x2a90cb?0x0:_0x1a4a32[_0xb131('0x20')];var _0x1aa933=_0x2a90cb?_0x1134b4['count']:_0x1a4a32['offset']+_0x1a4a32['limit'];var _0x4a559b;if(_0x1aa933>=_0x4e5ed1){_0x1aa933=_0x4e5ed1;_0x4a559b=0xc8;}else{_0x4a559b=0xce;}_0x321613['status'](_0x4a559b);return _0x321613[_0xb131('0x21')](_0xb131('0x22'),_0x2ea20c+'-'+_0x1aa933+'/'+_0x4e5ed1)[_0xb131('0x1c')](_0x1134b4);}return null;};}function patchUpdates(_0x3f65c8){return function(_0x59b176){try{jsonpatch[_0xb131('0x23')](_0x59b176,_0x3f65c8,!![]);}catch(_0x24aed4){return BPromise['reject'](_0x24aed4);}return _0x59b176['save']();};}function saveUpdates(_0x4cf5ce,_0x55871f){return function(_0x3c588b){if(_0x3c588b){return _0x3c588b[_0xb131('0x24')](_0x4cf5ce)[_0xb131('0x25')](function(_0x1016ce){return _0x1016ce;});}return null;};}function removeEntity(_0x3323a8,_0x437d7f){return function(_0x177f9e){if(_0x177f9e){return _0x177f9e[_0xb131('0x26')]()['then'](function(){_0x3323a8[_0xb131('0x1a')](0xcc)[_0xb131('0x1b')]();});}};}function handleEntityNotFound(_0x22fa15,_0x17d3a2){return function(_0x101da1){if(!_0x101da1){_0x22fa15[_0xb131('0x19')](0x194);}return _0x101da1;};}function handleError(_0x2eae3f,_0x374e27){_0x374e27=_0x374e27||0x1f4;return function(_0x394435){logger[_0xb131('0x27')](_0x394435['stack']);if(_0x394435[_0xb131('0x28')]){delete _0x394435[_0xb131('0x28')];}_0x2eae3f[_0xb131('0x1a')](_0x374e27)[_0xb131('0x29')](_0x394435);};}exports[_0xb131('0x2a')]=function(_0x184a0f,_0x3f567a){var _0x18189c={},_0x2ab764={},_0x2f8665={'count':0x0,'rows':[]};var _0x12dabd=_[_0xb131('0x2b')](db[_0xb131('0x2c')][_0xb131('0x2d')],function(_0x55e66b){return{'name':_0x55e66b[_0xb131('0x2e')],'type':_0x55e66b[_0xb131('0x2f')][_0xb131('0x30')]};});_0x2ab764[_0xb131('0x31')]=_[_0xb131('0x2b')](_0x12dabd,'name');_0x2ab764['query']=_[_0xb131('0x32')](_0x184a0f[_0xb131('0x33')]);_0x2ab764[_0xb131('0x34')]=_[_0xb131('0x35')](_0x2ab764['model'],_0x2ab764['query']);_0x18189c['attributes']=_['intersection'](_0x2ab764[_0xb131('0x31')],qs[_0xb131('0x36')](_0x184a0f['query']['fields']));_0x18189c[_0xb131('0x37')]=_0x18189c['attributes'][_0xb131('0x38')]?_0x18189c[_0xb131('0x37')]:_0x2ab764[_0xb131('0x31')];if(!_0x184a0f['query']['hasOwnProperty'](_0xb131('0x39'))){_0x18189c[_0xb131('0x1e')]=qs[_0xb131('0x1e')](_0x184a0f[_0xb131('0x33')][_0xb131('0x1e')]);_0x18189c['offset']=qs['offset'](_0x184a0f[_0xb131('0x33')][_0xb131('0x20')]);}_0x18189c[_0xb131('0x3a')]=qs[_0xb131('0x3b')](_0x184a0f[_0xb131('0x33')][_0xb131('0x3b')]);_0x18189c['where']=qs[_0xb131('0x34')](_[_0xb131('0x3c')](_0x184a0f['query'],_0x2ab764[_0xb131('0x34')]),_0x12dabd);if(_0x184a0f[_0xb131('0x33')][_0xb131('0x3d')]){_0x18189c[_0xb131('0x3e')]=_['merge'](_0x18189c[_0xb131('0x3e')],{'$or':_[_0xb131('0x2b')](_0x12dabd,function(_0x4c418d){if(_0x4c418d['type']!=='VIRTUAL'){var _0x4e9b41={};_0x4e9b41[_0x4c418d[_0xb131('0x28')]]={'$like':'%'+_0x184a0f[_0xb131('0x33')][_0xb131('0x3d')]+'%'};return _0x4e9b41;}})});}_0x18189c=_[_0xb131('0x3f')]({},_0x18189c,_0x184a0f[_0xb131('0x40')]);var _0x2f61ab={'where':_0x18189c[_0xb131('0x3e')]};return db[_0xb131('0x2c')][_0xb131('0x1f')](_0x2f61ab)['then'](function(_0x584bbc){_0x2f8665[_0xb131('0x1f')]=_0x584bbc;if(_0x184a0f[_0xb131('0x33')][_0xb131('0x41')]){_0x18189c['include']=[{'all':!![]}];}return db[_0xb131('0x2c')]['findAll'](_0x18189c);})[_0xb131('0x25')](function(_0x3b9f92){_0x2f8665[_0xb131('0x42')]=_0x3b9f92;return _0x2f8665;})['then'](respondWithFilteredResult(_0x3f567a,_0x18189c))['catch'](handleError(_0x3f567a,null));};exports['show']=function(_0x11c192,_0x3ad8ef){var _0x427673={'raw':![],'where':{'id':_0x11c192[_0xb131('0x43')]['id']}},_0x56c7b8={};_0x56c7b8[_0xb131('0x31')]=_['keys'](db[_0xb131('0x2c')][_0xb131('0x2d')]);_0x56c7b8[_0xb131('0x33')]=_[_0xb131('0x32')](_0x11c192[_0xb131('0x33')]);_0x56c7b8['filters']=_[_0xb131('0x35')](_0x56c7b8[_0xb131('0x31')],_0x56c7b8['query']);_0x427673[_0xb131('0x37')]=_[_0xb131('0x35')](_0x56c7b8['model'],qs['fields'](_0x11c192[_0xb131('0x33')]['fields']));_0x427673['attributes']=_0x427673[_0xb131('0x37')]['length']?_0x427673[_0xb131('0x37')]:_0x56c7b8['model'];if(_0x11c192['query'][_0xb131('0x41')]){_0x427673[_0xb131('0x44')]=[{'all':!![]}];}_0x427673=_['merge']({},_0x427673,_0x11c192[_0xb131('0x40')]);return db[_0xb131('0x2c')][_0xb131('0x45')](_0x427673)[_0xb131('0x25')](handleEntityNotFound(_0x3ad8ef,null))[_0xb131('0x25')](respondWithResult(_0x3ad8ef,null))['catch'](handleError(_0x3ad8ef,null));};exports[_0xb131('0x46')]=function(_0x3f0a2d,_0x594933){return db[_0xb131('0x2c')]['create'](_0x3f0a2d[_0xb131('0x47')],{})[_0xb131('0x25')](respondWithResult(_0x594933,0xc9))[_0xb131('0x48')](handleError(_0x594933,null));};exports[_0xb131('0x24')]=function(_0x3e60b8,_0x3c7702){if(_0x3e60b8['body']['id']){delete _0x3e60b8[_0xb131('0x47')]['id'];}return db[_0xb131('0x2c')][_0xb131('0x45')]({'where':{'id':_0x3e60b8['params']['id']}})[_0xb131('0x25')](handleEntityNotFound(_0x3c7702,null))[_0xb131('0x25')](saveUpdates(_0x3e60b8[_0xb131('0x47')],null))[_0xb131('0x25')](respondWithResult(_0x3c7702,null))[_0xb131('0x48')](handleError(_0x3c7702,null));};exports['destroy']=function(_0x5a5f25,_0x5a90ba){return db['FreshsalesConfiguration'][_0xb131('0x45')]({'where':{'id':_0x5a5f25[_0xb131('0x43')]['id']}})[_0xb131('0x25')](handleEntityNotFound(_0x5a90ba,null))['then'](removeEntity(_0x5a90ba,null))[_0xb131('0x48')](handleError(_0x5a90ba,null));};exports[_0xb131('0x49')]=function(_0x27cbbd,_0x478fa5,_0x5816ca){var _0x406503={};var _0x26953d={};var _0x365894;var _0x16ea3b;return db[_0xb131('0x2c')][_0xb131('0x4a')]({'where':{'id':_0x27cbbd[_0xb131('0x43')]['id']}})[_0xb131('0x25')](handleEntityNotFound(_0x478fa5,null))[_0xb131('0x25')](function(_0x1d896e){if(_0x1d896e){_0x365894=_0x1d896e;_0x26953d[_0xb131('0x31')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x26953d[_0xb131('0x33')]=_['keys'](_0x27cbbd[_0xb131('0x33')]);_0x26953d[_0xb131('0x34')]=_[_0xb131('0x35')](_0x26953d['model'],_0x26953d[_0xb131('0x33')]);_0x406503[_0xb131('0x37')]=_[_0xb131('0x35')](_0x26953d[_0xb131('0x31')],qs[_0xb131('0x36')](_0x27cbbd[_0xb131('0x33')][_0xb131('0x36')]));_0x406503['attributes']=_0x406503[_0xb131('0x37')][_0xb131('0x38')]?_0x406503[_0xb131('0x37')]:_0x26953d[_0xb131('0x31')];_0x406503[_0xb131('0x3a')]=qs['sort'](_0x27cbbd[_0xb131('0x33')]['sort']);_0x406503[_0xb131('0x3e')]=qs[_0xb131('0x34')](_[_0xb131('0x3c')](_0x27cbbd[_0xb131('0x33')],_0x26953d[_0xb131('0x34')]));if(_0x27cbbd['query']['filter']){_0x406503[_0xb131('0x3e')]=_[_0xb131('0x3f')](_0x406503[_0xb131('0x3e')],{'$or':_[_0xb131('0x2b')](_0x406503[_0xb131('0x37')],function(_0x3caf06){var _0x31f952={};_0x31f952[_0x3caf06]={'$like':'%'+_0x27cbbd[_0xb131('0x33')]['filter']+'%'};return _0x31f952;})});}_0x406503=_[_0xb131('0x3f')]({},_0x406503,_0x27cbbd[_0xb131('0x40')]);return _0x365894[_0xb131('0x49')](_0x406503);}})[_0xb131('0x25')](function(_0x423e56){if(_0x423e56){_0x16ea3b=_0x423e56[_0xb131('0x38')];if(!_0x27cbbd[_0xb131('0x33')][_0xb131('0x4b')](_0xb131('0x39'))){_0x406503[_0xb131('0x1e')]=qs[_0xb131('0x1e')](_0x27cbbd[_0xb131('0x33')][_0xb131('0x1e')]);_0x406503['offset']=qs[_0xb131('0x20')](_0x27cbbd[_0xb131('0x33')][_0xb131('0x20')]);}return _0x365894[_0xb131('0x49')](_0x406503);}})[_0xb131('0x25')](function(_0x16e270){if(_0x16e270){return _0x16e270?{'count':_0x16ea3b,'rows':_0x16e270}:null;}})[_0xb131('0x25')](respondWithResult(_0x478fa5,null))[_0xb131('0x48')](handleError(_0x478fa5,null));};exports[_0xb131('0x4c')]=function(_0x25661f,_0x37680e,_0x60e0c6){var _0x5484dd={};var _0x2f16e8={};var _0x560ea7;var _0x487753;return db[_0xb131('0x2c')][_0xb131('0x4a')]({'where':{'id':_0x25661f['params']['id']}})[_0xb131('0x25')](handleEntityNotFound(_0x37680e,null))[_0xb131('0x25')](function(_0x38c6c3){if(_0x38c6c3){_0x560ea7=_0x38c6c3;_0x2f16e8[_0xb131('0x31')]=_[_0xb131('0x32')](db[_0xb131('0x4d')][_0xb131('0x2d')]);_0x2f16e8['query']=_[_0xb131('0x32')](_0x25661f[_0xb131('0x33')]);_0x2f16e8[_0xb131('0x34')]=_[_0xb131('0x35')](_0x2f16e8[_0xb131('0x31')],_0x2f16e8[_0xb131('0x33')]);_0x5484dd['attributes']=_['intersection'](_0x2f16e8[_0xb131('0x31')],qs[_0xb131('0x36')](_0x25661f[_0xb131('0x33')][_0xb131('0x36')]));_0x5484dd[_0xb131('0x37')]=_0x5484dd[_0xb131('0x37')][_0xb131('0x38')]?_0x5484dd[_0xb131('0x37')]:_0x2f16e8[_0xb131('0x31')];_0x5484dd[_0xb131('0x3a')]=qs['sort'](_0x25661f[_0xb131('0x33')][_0xb131('0x3b')]);_0x5484dd[_0xb131('0x3e')]=qs[_0xb131('0x34')](_[_0xb131('0x3c')](_0x25661f[_0xb131('0x33')],_0x2f16e8['filters']));if(_0x25661f['query'][_0xb131('0x3d')]){_0x5484dd[_0xb131('0x3e')]=_[_0xb131('0x3f')](_0x5484dd['where'],{'$or':_['map'](_0x5484dd[_0xb131('0x37')],function(_0x54b7a1){var _0x4f72b8={};_0x4f72b8[_0x54b7a1]={'$like':'%'+_0x25661f[_0xb131('0x33')][_0xb131('0x3d')]+'%'};return _0x4f72b8;})});}_0x5484dd=_[_0xb131('0x3f')]({},_0x5484dd,_0x25661f[_0xb131('0x40')]);return _0x560ea7[_0xb131('0x4c')](_0x5484dd);}})[_0xb131('0x25')](function(_0x164abc){if(_0x164abc){_0x487753=_0x164abc[_0xb131('0x38')];if(!_0x25661f[_0xb131('0x33')][_0xb131('0x4b')]('nolimit')){_0x5484dd['limit']=qs[_0xb131('0x1e')](_0x25661f[_0xb131('0x33')][_0xb131('0x1e')]);_0x5484dd[_0xb131('0x20')]=qs[_0xb131('0x20')](_0x25661f[_0xb131('0x33')]['offset']);}return _0x560ea7[_0xb131('0x4c')](_0x5484dd);}})[_0xb131('0x25')](function(_0x2b4bce){if(_0x2b4bce){return _0x2b4bce?{'count':_0x487753,'rows':_0x2b4bce}:null;}})[_0xb131('0x25')](respondWithResult(_0x37680e,null))['catch'](handleError(_0x37680e,null));};exports[_0xb131('0x4e')]=function(_0x5f426f,_0x4ec297,_0x1475fa){var _0x421519={};var _0x5ae095={};var _0x525651;var _0x56e45a;return db[_0xb131('0x2c')]['findOne']({'where':{'id':_0x5f426f[_0xb131('0x43')]['id']}})[_0xb131('0x25')](handleEntityNotFound(_0x4ec297,null))[_0xb131('0x25')](function(_0xc54181){if(_0xc54181){_0x525651=_0xc54181;_0x5ae095[_0xb131('0x31')]=_[_0xb131('0x32')](db['FreshsalesField'][_0xb131('0x2d')]);_0x5ae095[_0xb131('0x33')]=_[_0xb131('0x32')](_0x5f426f[_0xb131('0x33')]);_0x5ae095[_0xb131('0x34')]=_['intersection'](_0x5ae095[_0xb131('0x31')],_0x5ae095[_0xb131('0x33')]);_0x421519[_0xb131('0x37')]=_[_0xb131('0x35')](_0x5ae095['model'],qs['fields'](_0x5f426f[_0xb131('0x33')][_0xb131('0x36')]));_0x421519[_0xb131('0x37')]=_0x421519[_0xb131('0x37')]['length']?_0x421519[_0xb131('0x37')]:_0x5ae095['model'];_0x421519[_0xb131('0x3a')]=qs[_0xb131('0x3b')](_0x5f426f[_0xb131('0x33')]['sort']);_0x421519[_0xb131('0x3e')]=qs[_0xb131('0x34')](_[_0xb131('0x3c')](_0x5f426f['query'],_0x5ae095[_0xb131('0x34')]));if(_0x5f426f['query'][_0xb131('0x3d')]){_0x421519[_0xb131('0x3e')]=_[_0xb131('0x3f')](_0x421519[_0xb131('0x3e')],{'$or':_[_0xb131('0x2b')](_0x421519[_0xb131('0x37')],function(_0x3cd464){var _0x25787e={};_0x25787e[_0x3cd464]={'$like':'%'+_0x5f426f[_0xb131('0x33')][_0xb131('0x3d')]+'%'};return _0x25787e;})});}_0x421519=_[_0xb131('0x3f')]({},_0x421519,_0x5f426f[_0xb131('0x40')]);return _0x525651[_0xb131('0x4e')](_0x421519);}})[_0xb131('0x25')](function(_0x2780eb){if(_0x2780eb){_0x56e45a=_0x2780eb['length'];if(!_0x5f426f['query'][_0xb131('0x4b')](_0xb131('0x39'))){_0x421519[_0xb131('0x1e')]=qs[_0xb131('0x1e')](_0x5f426f[_0xb131('0x33')]['limit']);_0x421519[_0xb131('0x20')]=qs[_0xb131('0x20')](_0x5f426f[_0xb131('0x33')][_0xb131('0x20')]);}return _0x525651[_0xb131('0x4e')](_0x421519);}})[_0xb131('0x25')](function(_0x258799){if(_0x258799){return _0x258799?{'count':_0x56e45a,'rows':_0x258799}:null;}})[_0xb131('0x25')](respondWithResult(_0x4ec297,null))[_0xb131('0x48')](handleError(_0x4ec297,null));}; \ No newline at end of file +var _0xfd58=['where','pick','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','findAll','params','rawAttributes','include','catch','create','body','find','getSubjects','findOne','hasOwnProperty','getDescriptions','getFields','FreshsalesField','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','fieldName','type','model','keys','filters','attributes','intersection','fields','query','length','nolimit','order','sort'];(function(_0x202055,_0x3e4838){var _0x5314a5=function(_0x5de5b5){while(--_0x5de5b5){_0x202055['push'](_0x202055['shift']());}};_0x5314a5(++_0x3e4838);}(_0xfd58,0x14e));var _0x8fd5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd58[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8fd5('0x0'));var zipdir=require(_0x8fd5('0x1'));var jsonpatch=require(_0x8fd5('0x2'));var rp=require(_0x8fd5('0x3'));var moment=require(_0x8fd5('0x4'));var BPromise=require(_0x8fd5('0x5'));var Mustache=require(_0x8fd5('0x6'));var util=require(_0x8fd5('0x7'));var path=require(_0x8fd5('0x8'));var sox=require(_0x8fd5('0x9'));var csv=require(_0x8fd5('0xa'));var ejs=require(_0x8fd5('0xb'));var fs=require('fs');var fs_extra=require(_0x8fd5('0xc'));var _=require(_0x8fd5('0xd'));var squel=require('squel');var crypto=require(_0x8fd5('0xe'));var jsforce=require(_0x8fd5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8fd5('0xa'));var querystring=require(_0x8fd5('0x10'));var Papa=require(_0x8fd5('0x11'));var Redis=require(_0x8fd5('0x12'));var authService=require(_0x8fd5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8fd5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8fd5('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8fd5('0x16'));var db=require(_0x8fd5('0x17'))['db'];function respondWithStatusCode(_0x468696,_0x9a34b7){_0x9a34b7=_0x9a34b7||0xcc;return function(_0x391149){if(_0x391149){return _0x468696['sendStatus'](_0x9a34b7);}return _0x468696[_0x8fd5('0x18')](_0x9a34b7)[_0x8fd5('0x19')]();};}function respondWithResult(_0x4e5b27,_0x37dd8f){_0x37dd8f=_0x37dd8f||0xc8;return function(_0x2dac09){if(_0x2dac09){return _0x4e5b27['status'](_0x37dd8f)[_0x8fd5('0x1a')](_0x2dac09);}};}function respondWithFilteredResult(_0x58c6e0,_0x5f1fde){return function(_0x1b79ef){if(_0x1b79ef){var _0x10d242=typeof _0x5f1fde[_0x8fd5('0x1b')]===_0x8fd5('0x1c')&&typeof _0x5f1fde[_0x8fd5('0x1d')]===_0x8fd5('0x1c');var _0x4aeaaf=_0x1b79ef[_0x8fd5('0x1e')];var _0x1b63e6=_0x10d242?0x0:_0x5f1fde['offset'];var _0x1c38b4=_0x10d242?_0x1b79ef[_0x8fd5('0x1e')]:_0x5f1fde[_0x8fd5('0x1b')]+_0x5f1fde[_0x8fd5('0x1d')];var _0x48083a;if(_0x1c38b4>=_0x4aeaaf){_0x1c38b4=_0x4aeaaf;_0x48083a=0xc8;}else{_0x48083a=0xce;}_0x58c6e0[_0x8fd5('0x18')](_0x48083a);return _0x58c6e0[_0x8fd5('0x1f')](_0x8fd5('0x20'),_0x1b63e6+'-'+_0x1c38b4+'/'+_0x4aeaaf)[_0x8fd5('0x1a')](_0x1b79ef);}return null;};}function patchUpdates(_0x322527){return function(_0x32e80d){try{jsonpatch[_0x8fd5('0x21')](_0x32e80d,_0x322527,!![]);}catch(_0x420166){return BPromise[_0x8fd5('0x22')](_0x420166);}return _0x32e80d['save']();};}function saveUpdates(_0x373a11,_0x2eed55){return function(_0xf70270){if(_0xf70270){return _0xf70270[_0x8fd5('0x23')](_0x373a11)[_0x8fd5('0x24')](function(_0x1c17d4){return _0x1c17d4;});}return null;};}function removeEntity(_0x1ae72a,_0x9d7eb0){return function(_0x3e7369){if(_0x3e7369){return _0x3e7369[_0x8fd5('0x25')]()[_0x8fd5('0x24')](function(){_0x1ae72a[_0x8fd5('0x18')](0xcc)[_0x8fd5('0x19')]();});}};}function handleEntityNotFound(_0x3c6796,_0x273278){return function(_0x19132c){if(!_0x19132c){_0x3c6796[_0x8fd5('0x26')](0x194);}return _0x19132c;};}function handleError(_0x44cb26,_0x35f633){_0x35f633=_0x35f633||0x1f4;return function(_0xadf9b2){logger[_0x8fd5('0x27')](_0xadf9b2[_0x8fd5('0x28')]);if(_0xadf9b2[_0x8fd5('0x29')]){delete _0xadf9b2['name'];}_0x44cb26[_0x8fd5('0x18')](_0x35f633)['send'](_0xadf9b2);};}exports['index']=function(_0x32885f,_0x25ab30){var _0x4f11c5={},_0x168f4c={},_0x54d02f={'count':0x0,'rows':[]};var _0x2ce673=_[_0x8fd5('0x2a')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x5b7647){return{'name':_0x5b7647[_0x8fd5('0x2b')],'type':_0x5b7647[_0x8fd5('0x2c')]['key']};});_0x168f4c[_0x8fd5('0x2d')]=_[_0x8fd5('0x2a')](_0x2ce673,_0x8fd5('0x29'));_0x168f4c['query']=_[_0x8fd5('0x2e')](_0x32885f['query']);_0x168f4c[_0x8fd5('0x2f')]=_['intersection'](_0x168f4c[_0x8fd5('0x2d')],_0x168f4c['query']);_0x4f11c5[_0x8fd5('0x30')]=_[_0x8fd5('0x31')](_0x168f4c[_0x8fd5('0x2d')],qs[_0x8fd5('0x32')](_0x32885f[_0x8fd5('0x33')][_0x8fd5('0x32')]));_0x4f11c5['attributes']=_0x4f11c5[_0x8fd5('0x30')][_0x8fd5('0x34')]?_0x4f11c5[_0x8fd5('0x30')]:_0x168f4c[_0x8fd5('0x2d')];if(!_0x32885f['query']['hasOwnProperty'](_0x8fd5('0x35'))){_0x4f11c5[_0x8fd5('0x1d')]=qs['limit'](_0x32885f['query']['limit']);_0x4f11c5[_0x8fd5('0x1b')]=qs[_0x8fd5('0x1b')](_0x32885f[_0x8fd5('0x33')][_0x8fd5('0x1b')]);}_0x4f11c5[_0x8fd5('0x36')]=qs[_0x8fd5('0x37')](_0x32885f[_0x8fd5('0x33')][_0x8fd5('0x37')]);_0x4f11c5[_0x8fd5('0x38')]=qs[_0x8fd5('0x2f')](_[_0x8fd5('0x39')](_0x32885f[_0x8fd5('0x33')],_0x168f4c[_0x8fd5('0x2f')]),_0x2ce673);if(_0x32885f[_0x8fd5('0x33')][_0x8fd5('0x3a')]){_0x4f11c5[_0x8fd5('0x38')]=_[_0x8fd5('0x3b')](_0x4f11c5['where'],{'$or':_[_0x8fd5('0x2a')](_0x2ce673,function(_0x42d993){if(_0x42d993['type']!==_0x8fd5('0x3c')){var _0x13efb8={};_0x13efb8[_0x42d993[_0x8fd5('0x29')]]={'$like':'%'+_0x32885f[_0x8fd5('0x33')][_0x8fd5('0x3a')]+'%'};return _0x13efb8;}})});}_0x4f11c5=_['merge']({},_0x4f11c5,_0x32885f[_0x8fd5('0x3d')]);var _0x2470f8={'where':_0x4f11c5[_0x8fd5('0x38')]};return db[_0x8fd5('0x3e')]['count'](_0x2470f8)[_0x8fd5('0x24')](function(_0x7a09ee){_0x54d02f[_0x8fd5('0x1e')]=_0x7a09ee;if(_0x32885f[_0x8fd5('0x33')][_0x8fd5('0x3f')]){_0x4f11c5['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x8fd5('0x40')](_0x4f11c5);})[_0x8fd5('0x24')](function(_0x317b41){_0x54d02f['rows']=_0x317b41;return _0x54d02f;})[_0x8fd5('0x24')](respondWithFilteredResult(_0x25ab30,_0x4f11c5))['catch'](handleError(_0x25ab30,null));};exports['show']=function(_0x2d1fe8,_0xcf7518){var _0x4fc9fa={'raw':![],'where':{'id':_0x2d1fe8[_0x8fd5('0x41')]['id']}},_0x162cc9={};_0x162cc9[_0x8fd5('0x2d')]=_[_0x8fd5('0x2e')](db[_0x8fd5('0x3e')][_0x8fd5('0x42')]);_0x162cc9[_0x8fd5('0x33')]=_[_0x8fd5('0x2e')](_0x2d1fe8[_0x8fd5('0x33')]);_0x162cc9['filters']=_[_0x8fd5('0x31')](_0x162cc9['model'],_0x162cc9['query']);_0x4fc9fa[_0x8fd5('0x30')]=_[_0x8fd5('0x31')](_0x162cc9['model'],qs['fields'](_0x2d1fe8[_0x8fd5('0x33')][_0x8fd5('0x32')]));_0x4fc9fa[_0x8fd5('0x30')]=_0x4fc9fa['attributes'][_0x8fd5('0x34')]?_0x4fc9fa['attributes']:_0x162cc9[_0x8fd5('0x2d')];if(_0x2d1fe8[_0x8fd5('0x33')][_0x8fd5('0x3f')]){_0x4fc9fa[_0x8fd5('0x43')]=[{'all':!![]}];}_0x4fc9fa=_[_0x8fd5('0x3b')]({},_0x4fc9fa,_0x2d1fe8[_0x8fd5('0x3d')]);return db[_0x8fd5('0x3e')]['find'](_0x4fc9fa)[_0x8fd5('0x24')](handleEntityNotFound(_0xcf7518,null))[_0x8fd5('0x24')](respondWithResult(_0xcf7518,null))[_0x8fd5('0x44')](handleError(_0xcf7518,null));};exports[_0x8fd5('0x45')]=function(_0x18d21f,_0x16db10){return db[_0x8fd5('0x3e')]['create'](_0x18d21f[_0x8fd5('0x46')],{})['then'](respondWithResult(_0x16db10,0xc9))[_0x8fd5('0x44')](handleError(_0x16db10,null));};exports['update']=function(_0xa12dc7,_0x3071cd){if(_0xa12dc7[_0x8fd5('0x46')]['id']){delete _0xa12dc7[_0x8fd5('0x46')]['id'];}return db[_0x8fd5('0x3e')][_0x8fd5('0x47')]({'where':{'id':_0xa12dc7[_0x8fd5('0x41')]['id']}})[_0x8fd5('0x24')](handleEntityNotFound(_0x3071cd,null))['then'](saveUpdates(_0xa12dc7[_0x8fd5('0x46')],null))[_0x8fd5('0x24')](respondWithResult(_0x3071cd,null))[_0x8fd5('0x44')](handleError(_0x3071cd,null));};exports[_0x8fd5('0x25')]=function(_0x1d1898,_0x5f3f4b){return db[_0x8fd5('0x3e')][_0x8fd5('0x47')]({'where':{'id':_0x1d1898[_0x8fd5('0x41')]['id']}})['then'](handleEntityNotFound(_0x5f3f4b,null))[_0x8fd5('0x24')](removeEntity(_0x5f3f4b,null))[_0x8fd5('0x44')](handleError(_0x5f3f4b,null));};exports[_0x8fd5('0x48')]=function(_0x33662f,_0x3acc4b,_0x326f72){var _0x8a164c={};var _0x4c2481={};var _0x4859e9;var _0x958ed8;return db[_0x8fd5('0x3e')][_0x8fd5('0x49')]({'where':{'id':_0x33662f[_0x8fd5('0x41')]['id']}})['then'](handleEntityNotFound(_0x3acc4b,null))[_0x8fd5('0x24')](function(_0x1ef7b5){if(_0x1ef7b5){_0x4859e9=_0x1ef7b5;_0x4c2481[_0x8fd5('0x2d')]=_[_0x8fd5('0x2e')](db['FreshsalesField'][_0x8fd5('0x42')]);_0x4c2481[_0x8fd5('0x33')]=_[_0x8fd5('0x2e')](_0x33662f[_0x8fd5('0x33')]);_0x4c2481['filters']=_[_0x8fd5('0x31')](_0x4c2481[_0x8fd5('0x2d')],_0x4c2481['query']);_0x8a164c['attributes']=_[_0x8fd5('0x31')](_0x4c2481[_0x8fd5('0x2d')],qs[_0x8fd5('0x32')](_0x33662f[_0x8fd5('0x33')]['fields']));_0x8a164c[_0x8fd5('0x30')]=_0x8a164c[_0x8fd5('0x30')][_0x8fd5('0x34')]?_0x8a164c[_0x8fd5('0x30')]:_0x4c2481[_0x8fd5('0x2d')];_0x8a164c[_0x8fd5('0x36')]=qs[_0x8fd5('0x37')](_0x33662f[_0x8fd5('0x33')][_0x8fd5('0x37')]);_0x8a164c['where']=qs[_0x8fd5('0x2f')](_['pick'](_0x33662f[_0x8fd5('0x33')],_0x4c2481['filters']));if(_0x33662f['query']['filter']){_0x8a164c[_0x8fd5('0x38')]=_[_0x8fd5('0x3b')](_0x8a164c['where'],{'$or':_[_0x8fd5('0x2a')](_0x8a164c[_0x8fd5('0x30')],function(_0x5edd4e){var _0xe56e67={};_0xe56e67[_0x5edd4e]={'$like':'%'+_0x33662f[_0x8fd5('0x33')][_0x8fd5('0x3a')]+'%'};return _0xe56e67;})});}_0x8a164c=_[_0x8fd5('0x3b')]({},_0x8a164c,_0x33662f['options']);return _0x4859e9['getSubjects'](_0x8a164c);}})[_0x8fd5('0x24')](function(_0x376a0c){if(_0x376a0c){_0x958ed8=_0x376a0c['length'];if(!_0x33662f['query'][_0x8fd5('0x4a')]('nolimit')){_0x8a164c['limit']=qs['limit'](_0x33662f['query'][_0x8fd5('0x1d')]);_0x8a164c[_0x8fd5('0x1b')]=qs[_0x8fd5('0x1b')](_0x33662f[_0x8fd5('0x33')][_0x8fd5('0x1b')]);}return _0x4859e9[_0x8fd5('0x48')](_0x8a164c);}})[_0x8fd5('0x24')](function(_0x545cbc){if(_0x545cbc){return _0x545cbc?{'count':_0x958ed8,'rows':_0x545cbc}:null;}})[_0x8fd5('0x24')](respondWithResult(_0x3acc4b,null))[_0x8fd5('0x44')](handleError(_0x3acc4b,null));};exports['getDescriptions']=function(_0x353922,_0x39c73c,_0x2fb25b){var _0x4c6101={};var _0x325ffb={};var _0xdc6fda;var _0x55f60a;return db[_0x8fd5('0x3e')][_0x8fd5('0x49')]({'where':{'id':_0x353922['params']['id']}})[_0x8fd5('0x24')](handleEntityNotFound(_0x39c73c,null))[_0x8fd5('0x24')](function(_0xab786e){if(_0xab786e){_0xdc6fda=_0xab786e;_0x325ffb[_0x8fd5('0x2d')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x325ffb[_0x8fd5('0x33')]=_[_0x8fd5('0x2e')](_0x353922[_0x8fd5('0x33')]);_0x325ffb[_0x8fd5('0x2f')]=_['intersection'](_0x325ffb[_0x8fd5('0x2d')],_0x325ffb[_0x8fd5('0x33')]);_0x4c6101['attributes']=_[_0x8fd5('0x31')](_0x325ffb[_0x8fd5('0x2d')],qs[_0x8fd5('0x32')](_0x353922[_0x8fd5('0x33')][_0x8fd5('0x32')]));_0x4c6101['attributes']=_0x4c6101['attributes'][_0x8fd5('0x34')]?_0x4c6101[_0x8fd5('0x30')]:_0x325ffb['model'];_0x4c6101[_0x8fd5('0x36')]=qs[_0x8fd5('0x37')](_0x353922['query']['sort']);_0x4c6101[_0x8fd5('0x38')]=qs[_0x8fd5('0x2f')](_[_0x8fd5('0x39')](_0x353922[_0x8fd5('0x33')],_0x325ffb[_0x8fd5('0x2f')]));if(_0x353922[_0x8fd5('0x33')][_0x8fd5('0x3a')]){_0x4c6101[_0x8fd5('0x38')]=_['merge'](_0x4c6101[_0x8fd5('0x38')],{'$or':_['map'](_0x4c6101['attributes'],function(_0x2d0c78){var _0x49bd12={};_0x49bd12[_0x2d0c78]={'$like':'%'+_0x353922[_0x8fd5('0x33')][_0x8fd5('0x3a')]+'%'};return _0x49bd12;})});}_0x4c6101=_[_0x8fd5('0x3b')]({},_0x4c6101,_0x353922[_0x8fd5('0x3d')]);return _0xdc6fda[_0x8fd5('0x4b')](_0x4c6101);}})[_0x8fd5('0x24')](function(_0x2a1cf6){if(_0x2a1cf6){_0x55f60a=_0x2a1cf6[_0x8fd5('0x34')];if(!_0x353922['query']['hasOwnProperty'](_0x8fd5('0x35'))){_0x4c6101[_0x8fd5('0x1d')]=qs['limit'](_0x353922[_0x8fd5('0x33')][_0x8fd5('0x1d')]);_0x4c6101[_0x8fd5('0x1b')]=qs[_0x8fd5('0x1b')](_0x353922[_0x8fd5('0x33')][_0x8fd5('0x1b')]);}return _0xdc6fda[_0x8fd5('0x4b')](_0x4c6101);}})[_0x8fd5('0x24')](function(_0x59770a){if(_0x59770a){return _0x59770a?{'count':_0x55f60a,'rows':_0x59770a}:null;}})['then'](respondWithResult(_0x39c73c,null))['catch'](handleError(_0x39c73c,null));};exports[_0x8fd5('0x4c')]=function(_0x4878b2,_0x544889,_0x524639){var _0x29a372={};var _0x144456={};var _0x12e7d6;var _0x1144da;return db[_0x8fd5('0x3e')][_0x8fd5('0x49')]({'where':{'id':_0x4878b2[_0x8fd5('0x41')]['id']}})[_0x8fd5('0x24')](handleEntityNotFound(_0x544889,null))['then'](function(_0x178ef3){if(_0x178ef3){_0x12e7d6=_0x178ef3;_0x144456['model']=_[_0x8fd5('0x2e')](db[_0x8fd5('0x4d')][_0x8fd5('0x42')]);_0x144456[_0x8fd5('0x33')]=_[_0x8fd5('0x2e')](_0x4878b2[_0x8fd5('0x33')]);_0x144456['filters']=_[_0x8fd5('0x31')](_0x144456[_0x8fd5('0x2d')],_0x144456['query']);_0x29a372[_0x8fd5('0x30')]=_[_0x8fd5('0x31')](_0x144456[_0x8fd5('0x2d')],qs['fields'](_0x4878b2[_0x8fd5('0x33')][_0x8fd5('0x32')]));_0x29a372['attributes']=_0x29a372['attributes'][_0x8fd5('0x34')]?_0x29a372[_0x8fd5('0x30')]:_0x144456[_0x8fd5('0x2d')];_0x29a372[_0x8fd5('0x36')]=qs[_0x8fd5('0x37')](_0x4878b2[_0x8fd5('0x33')]['sort']);_0x29a372[_0x8fd5('0x38')]=qs[_0x8fd5('0x2f')](_[_0x8fd5('0x39')](_0x4878b2['query'],_0x144456[_0x8fd5('0x2f')]));if(_0x4878b2[_0x8fd5('0x33')][_0x8fd5('0x3a')]){_0x29a372[_0x8fd5('0x38')]=_[_0x8fd5('0x3b')](_0x29a372['where'],{'$or':_['map'](_0x29a372[_0x8fd5('0x30')],function(_0x54acf7){var _0x3cfd52={};_0x3cfd52[_0x54acf7]={'$like':'%'+_0x4878b2['query']['filter']+'%'};return _0x3cfd52;})});}_0x29a372=_[_0x8fd5('0x3b')]({},_0x29a372,_0x4878b2[_0x8fd5('0x3d')]);return _0x12e7d6['getFields'](_0x29a372);}})[_0x8fd5('0x24')](function(_0x1f46ce){if(_0x1f46ce){_0x1144da=_0x1f46ce['length'];if(!_0x4878b2[_0x8fd5('0x33')]['hasOwnProperty'](_0x8fd5('0x35'))){_0x29a372['limit']=qs[_0x8fd5('0x1d')](_0x4878b2['query'][_0x8fd5('0x1d')]);_0x29a372[_0x8fd5('0x1b')]=qs['offset'](_0x4878b2[_0x8fd5('0x33')][_0x8fd5('0x1b')]);}return _0x12e7d6[_0x8fd5('0x4c')](_0x29a372);}})[_0x8fd5('0x24')](function(_0x543f2d){if(_0x543f2d){return _0x543f2d?{'count':_0x1144da,'rows':_0x543f2d}:null;}})[_0x8fd5('0x24')](respondWithResult(_0x544889,null))[_0x8fd5('0x44')](handleError(_0x544889,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 8615c68..bb5a9ec 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 _0x8c6f=['define','FreshsalesConfiguration','util','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes'];(function(_0x437b7c,_0x4037fc){var _0x1ee024=function(_0x102a21){while(--_0x102a21){_0x437b7c['push'](_0x437b7c['shift']());}};_0x1ee024(++_0x4037fc);}(_0x8c6f,0x6a));var _0xf8c6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8c6f[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xf8c6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf8c6('0x1'));var BPromise=require('bluebird');var rp=require(_0xf8c6('0x2'));var fs=require('fs');var path=require(_0xf8c6('0x3'));var rimraf=require(_0xf8c6('0x4'));var config=require('../../config/environment');var attributes=require(_0xf8c6('0x5'));module['exports']=function(_0x5d4f1e,_0x454211){return _0x5d4f1e[_0xf8c6('0x6')](_0xf8c6('0x7'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a60=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x54c194,_0x40a287){var _0x4a7009=function(_0x40488b){while(--_0x40488b){_0x54c194['push'](_0x54c194['shift']());}};_0x4a7009(++_0x40a287);}(_0x8a60,0xd0));var _0x08a6=function(_0x1c8491,_0x335e02){_0x1c8491=_0x1c8491-0x0;var _0x2a9aae=_0x8a60[_0x1c8491];return _0x2a9aae;};'use strict';var _=require(_0x08a6('0x0'));var util=require(_0x08a6('0x1'));var logger=require('../../config/logger')(_0x08a6('0x2'));var moment=require(_0x08a6('0x3'));var BPromise=require(_0x08a6('0x4'));var rp=require(_0x08a6('0x5'));var fs=require('fs');var path=require(_0x08a6('0x6'));var rimraf=require(_0x08a6('0x7'));var config=require('../../config/environment');var attributes=require(_0x08a6('0x8'));module[_0x08a6('0x9')]=function(_0x184df3,_0x2439cc){return _0x184df3[_0x08a6('0xa')](_0x08a6('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 3fad745..36c6244 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 _0x329a=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x1b3660,_0x4c0b8e){var _0x481edc=function(_0x1446b1){while(--_0x1446b1){_0x1b3660['push'](_0x1b3660['shift']());}};_0x481edc(++_0x4c0b8e);}(_0x329a,0xaf));var _0xa329=function(_0x633afc,_0x432d38){_0x633afc=_0x633afc-0x0;var _0x46adfd=_0x329a[_0x633afc];return _0x46adfd;};'use strict';var _=require(_0xa329('0x0'));var util=require(_0xa329('0x1'));var moment=require(_0xa329('0x2'));var BPromise=require('bluebird');var rs=require(_0xa329('0x3'));var fs=require('fs');var Redis=require(_0xa329('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa329('0x5'));var logger=require(_0xa329('0x6'))(_0xa329('0x7'));var config=require('../../config/environment');var jayson=require(_0xa329('0x8'));var client=jayson[_0xa329('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17463d,_0x125b76,_0x69fa65){return new BPromise(function(_0x28affe,_0x229d30){return client[_0xa329('0xa')](_0x17463d,_0x69fa65)[_0xa329('0xb')](function(_0xcd5c18){logger[_0xa329('0xc')](_0xa329('0xd'),_0x125b76,_0xa329('0xe'));logger[_0xa329('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x125b76,_0xa329('0xe'),JSON[_0xa329('0x10')](_0xcd5c18));if(_0xcd5c18[_0xa329('0x11')]){if(_0xcd5c18['error'][_0xa329('0x12')]===0x1f4){logger[_0xa329('0x11')](_0xa329('0xd'),_0x125b76,_0xcd5c18[_0xa329('0x11')][_0xa329('0x13')]);return _0x229d30(_0xcd5c18['error'][_0xa329('0x13')]);}logger[_0xa329('0x11')](_0xa329('0xd'),_0x125b76,_0xcd5c18[_0xa329('0x11')][_0xa329('0x13')]);return _0x28affe(_0xcd5c18[_0xa329('0x11')]['message']);}else{logger[_0xa329('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x125b76,_0xa329('0xe'));_0x28affe(_0xcd5c18['result'][_0xa329('0x13')]);}})[_0xa329('0x14')](function(_0x49abe9){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x125b76,_0x49abe9);_0x229d30(_0x49abe9);});});} \ No newline at end of file +var _0x8c82=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3a853d,_0x1c62fb){var _0x436119=function(_0x17c7b7){while(--_0x17c7b7){_0x3a853d['push'](_0x3a853d['shift']());}};_0x436119(++_0x1c62fb);}(_0x8c82,0x13b));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x28c8('0x0'));var util=require('util');var moment=require(_0x28c8('0x1'));var BPromise=require(_0x28c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28c8('0x3'));var db=require(_0x28c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x28c8('0x5'))(_0x28c8('0x6'));var config=require(_0x28c8('0x7'));var jayson=require(_0x28c8('0x8'));var client=jayson[_0x28c8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x542e17,_0x1fb04a,_0x2492d9){return new BPromise(function(_0x5e1bc4,_0x28e310){return client['request'](_0x542e17,_0x2492d9)[_0x28c8('0xa')](function(_0x44f12c){logger['info'](_0x28c8('0xb'),_0x1fb04a,_0x28c8('0xc'));logger[_0x28c8('0xd')](_0x28c8('0xe'),_0x1fb04a,_0x28c8('0xc'),JSON[_0x28c8('0xf')](_0x44f12c));if(_0x44f12c[_0x28c8('0x10')]){if(_0x44f12c['error'][_0x28c8('0x11')]===0x1f4){logger[_0x28c8('0x10')](_0x28c8('0xb'),_0x1fb04a,_0x44f12c['error']['message']);return _0x28e310(_0x44f12c[_0x28c8('0x10')][_0x28c8('0x12')]);}logger[_0x28c8('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1fb04a,_0x44f12c[_0x28c8('0x10')][_0x28c8('0x12')]);return _0x5e1bc4(_0x44f12c['error'][_0x28c8('0x12')]);}else{logger[_0x28c8('0x13')](_0x28c8('0xb'),_0x1fb04a,'request\x20sent');_0x5e1bc4(_0x44f12c[_0x28c8('0x14')][_0x28c8('0x12')]);}})[_0x28c8('0x15')](function(_0x40a23c){logger[_0x28c8('0x10')](_0x28c8('0xb'),_0x1fb04a,_0x40a23c);_0x28e310(_0x40a23c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 54f9b30..5ccb984 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 _0xe148=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show'];(function(_0x195ab0,_0x273e02){var _0x59414a=function(_0xdd2cf8){while(--_0xdd2cf8){_0x195ab0['push'](_0x195ab0['shift']());}};_0x59414a(++_0x273e02);}(_0xe148,0x9e));var _0x8e14=function(_0x598b6f,_0x55690f){_0x598b6f=_0x598b6f-0x0;var _0x40959f=_0xe148[_0x598b6f];return _0x40959f;};'use strict';var multer=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var path=require('path');var timeout=require(_0x8e14('0x2'));var express=require(_0x8e14('0x3'));var router=express['Router']();var fs_extra=require(_0x8e14('0x4'));var auth=require(_0x8e14('0x5'));var interaction=require(_0x8e14('0x6'));var config=require(_0x8e14('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x8e14('0x8')](),controller[_0x8e14('0x9')]);router['get'](_0x8e14('0xa'),auth[_0x8e14('0x8')](),controller[_0x8e14('0xb')]);router[_0x8e14('0xc')]('/',auth['isAuthenticated'](),controller[_0x8e14('0xd')]);router['put'](_0x8e14('0xa'),auth[_0x8e14('0x8')](),controller['update']);router[_0x8e14('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8e14('0xf')]);module[_0x8e14('0x10')]=router; \ No newline at end of file +var _0x5fc7=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x275910,_0x3d8c92){var _0x41d702=function(_0x428a29){while(--_0x428a29){_0x275910['push'](_0x275910['shift']());}};_0x41d702(++_0x3d8c92);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x5fc7[_0x19dd7a];return _0x3feb6a;};'use strict';var multer=require(_0x75fc('0x0'));var util=require(_0x75fc('0x1'));var path=require(_0x75fc('0x2'));var timeout=require(_0x75fc('0x3'));var express=require(_0x75fc('0x4'));var router=express[_0x75fc('0x5')]();var fs_extra=require(_0x75fc('0x6'));var auth=require(_0x75fc('0x7'));var interaction=require(_0x75fc('0x8'));var config=require(_0x75fc('0x9'));var controller=require(_0x75fc('0xa'));router[_0x75fc('0xb')]('/',auth['isAuthenticated'](),controller[_0x75fc('0xc')]);router[_0x75fc('0xb')](_0x75fc('0xd'),auth[_0x75fc('0xe')](),controller[_0x75fc('0xf')]);router[_0x75fc('0x10')]('/',auth[_0x75fc('0xe')](),controller[_0x75fc('0x11')]);router[_0x75fc('0x12')](_0x75fc('0xd'),auth['isAuthenticated'](),controller[_0x75fc('0x13')]);router[_0x75fc('0x14')](_0x75fc('0xd'),auth[_0x75fc('0xe')](),controller['destroy']);module[_0x75fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 33642b2..59d8037 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 _0x7bc4=['picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x7bc4,0x100));var _0x47bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7bc4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x47bc('0x0'));module['exports']={'type':{'type':Sequelize[_0x47bc('0x1')](_0x47bc('0x2'),'variable',_0x47bc('0x3'),_0x47bc('0x4'),_0x47bc('0x5')),'defaultValue':_0x47bc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x47bc('0x6')]},'keyType':{'type':Sequelize[_0x47bc('0x1')](_0x47bc('0x2'),_0x47bc('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x47bc('0x6')]},'idField':{'type':Sequelize[_0x47bc('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x47bc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x47bc('0x6')]}}; \ No newline at end of file +var _0xff73=['picklist','STRING','sequelize','ENUM','string','variable','keyValue'];(function(_0x2affa1,_0x1d5ce6){var _0x4171be=function(_0x5b6fe1){while(--_0x5b6fe1){_0x2affa1['push'](_0x2affa1['shift']());}};_0x4171be(++_0x1d5ce6);}(_0xff73,0x152));var _0x3ff7=function(_0x3b59aa,_0x7a990b){_0x3b59aa=_0x3b59aa-0x0;var _0x5cad80=_0xff73[_0x3b59aa];return _0x5cad80;};'use strict';var Sequelize=require(_0x3ff7('0x0'));module['exports']={'type':{'type':Sequelize[_0x3ff7('0x1')](_0x3ff7('0x2'),_0x3ff7('0x3'),'customVariable',_0x3ff7('0x4'),_0x3ff7('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3ff7('0x6')]},'key':{'type':Sequelize[_0x3ff7('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3ff7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3ff7('0x6')]},'idField':{'type':Sequelize[_0x3ff7('0x6')]},'nameField':{'type':Sequelize[_0x3ff7('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3ff7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 482597b..37c9f88 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 _0x818a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','includeAll','include','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x18de3f,_0x4cf0a1){var _0x28a348=function(_0x2ecfde){while(--_0x2ecfde){_0x18de3f['push'](_0x18de3f['shift']());}};_0x28a348(++_0x4cf0a1);}(_0x818a,0x89));var _0xa818=function(_0xd02def,_0x144f25){_0xd02def=_0xd02def-0x0;var _0x2e8374=_0x818a[_0xd02def];return _0x2e8374;};'use strict';var emlformat=require(_0xa818('0x0'));var rimraf=require(_0xa818('0x1'));var zipdir=require(_0xa818('0x2'));var jsonpatch=require(_0xa818('0x3'));var rp=require('request-promise');var moment=require(_0xa818('0x4'));var BPromise=require(_0xa818('0x5'));var Mustache=require(_0xa818('0x6'));var util=require(_0xa818('0x7'));var path=require(_0xa818('0x8'));var sox=require(_0xa818('0x9'));var csv=require('to-csv');var ejs=require(_0xa818('0xa'));var fs=require('fs');var fs_extra=require(_0xa818('0xb'));var _=require(_0xa818('0xc'));var squel=require('squel');var crypto=require(_0xa818('0xd'));var jsforce=require(_0xa818('0xe'));var deskjs=require(_0xa818('0xf'));var toCsv=require(_0xa818('0x10'));var querystring=require(_0xa818('0x11'));var Papa=require(_0xa818('0x12'));var Redis=require(_0xa818('0x13'));var authService=require(_0xa818('0x14'));var qs=require(_0xa818('0x15'));var as=require(_0xa818('0x16'));var hardwareService=require(_0xa818('0x17'));var logger=require(_0xa818('0x18'))('api');var utils=require(_0xa818('0x19'));var config=require(_0xa818('0x1a'));var licenseUtil=require(_0xa818('0x1b'));var db=require(_0xa818('0x1c'))['db'];function respondWithStatusCode(_0x542486,_0x4d37b3){_0x4d37b3=_0x4d37b3||0xcc;return function(_0x3532e8){if(_0x3532e8){return _0x542486[_0xa818('0x1d')](_0x4d37b3);}return _0x542486[_0xa818('0x1e')](_0x4d37b3)[_0xa818('0x1f')]();};}function respondWithResult(_0x29c8c7,_0x4298c0){_0x4298c0=_0x4298c0||0xc8;return function(_0x5679cc){if(_0x5679cc){return _0x29c8c7[_0xa818('0x1e')](_0x4298c0)[_0xa818('0x20')](_0x5679cc);}};}function respondWithFilteredResult(_0x1ed506,_0x4a24b){return function(_0x23c0fe){if(_0x23c0fe){var _0x26e07e=typeof _0x4a24b[_0xa818('0x21')]===_0xa818('0x22')&&typeof _0x4a24b[_0xa818('0x23')]===_0xa818('0x22');var _0x520cad=_0x23c0fe[_0xa818('0x24')];var _0x58777e=_0x26e07e?0x0:_0x4a24b['offset'];var _0xb4d1e1=_0x26e07e?_0x23c0fe[_0xa818('0x24')]:_0x4a24b[_0xa818('0x21')]+_0x4a24b[_0xa818('0x23')];var _0x3f2f56;if(_0xb4d1e1>=_0x520cad){_0xb4d1e1=_0x520cad;_0x3f2f56=0xc8;}else{_0x3f2f56=0xce;}_0x1ed506['status'](_0x3f2f56);return _0x1ed506[_0xa818('0x25')](_0xa818('0x26'),_0x58777e+'-'+_0xb4d1e1+'/'+_0x520cad)['json'](_0x23c0fe);}return null;};}function patchUpdates(_0x1e74a7){return function(_0xe44453){try{jsonpatch['apply'](_0xe44453,_0x1e74a7,!![]);}catch(_0x5513e9){return BPromise[_0xa818('0x27')](_0x5513e9);}return _0xe44453[_0xa818('0x28')]();};}function saveUpdates(_0x4db7c5,_0x46a944){return function(_0x23c9ca){if(_0x23c9ca){return _0x23c9ca['update'](_0x4db7c5)[_0xa818('0x29')](function(_0x2fa112){return _0x2fa112;});}return null;};}function removeEntity(_0x5dcb52,_0x29c793){return function(_0x5aa1d5){if(_0x5aa1d5){return _0x5aa1d5[_0xa818('0x2a')]()[_0xa818('0x29')](function(){_0x5dcb52[_0xa818('0x1e')](0xcc)[_0xa818('0x1f')]();});}};}function handleEntityNotFound(_0x5967e9,_0x2ded5e){return function(_0x3d2bf7){if(!_0x3d2bf7){_0x5967e9[_0xa818('0x1d')](0x194);}return _0x3d2bf7;};}function handleError(_0x3e9663,_0x57dc66){_0x57dc66=_0x57dc66||0x1f4;return function(_0x96d753){logger[_0xa818('0x2b')](_0x96d753[_0xa818('0x2c')]);if(_0x96d753[_0xa818('0x2d')]){delete _0x96d753[_0xa818('0x2d')];}_0x3e9663[_0xa818('0x1e')](_0x57dc66)[_0xa818('0x2e')](_0x96d753);};}exports['index']=function(_0x2cb4a,_0x55be71){var _0x4777ea={},_0x4aa4a7={},_0x2c8aac={'count':0x0,'rows':[]};var _0x384df3=_[_0xa818('0x2f')](db[_0xa818('0x30')][_0xa818('0x31')],function(_0x2d157e){return{'name':_0x2d157e['fieldName'],'type':_0x2d157e[_0xa818('0x32')][_0xa818('0x33')]};});_0x4aa4a7[_0xa818('0x34')]=_[_0xa818('0x2f')](_0x384df3,'name');_0x4aa4a7[_0xa818('0x35')]=_[_0xa818('0x36')](_0x2cb4a[_0xa818('0x35')]);_0x4aa4a7[_0xa818('0x37')]=_[_0xa818('0x38')](_0x4aa4a7[_0xa818('0x34')],_0x4aa4a7['query']);_0x4777ea['attributes']=_[_0xa818('0x38')](_0x4aa4a7[_0xa818('0x34')],qs[_0xa818('0x39')](_0x2cb4a[_0xa818('0x35')][_0xa818('0x39')]));_0x4777ea[_0xa818('0x3a')]=_0x4777ea['attributes']['length']?_0x4777ea['attributes']:_0x4aa4a7[_0xa818('0x34')];if(!_0x2cb4a[_0xa818('0x35')][_0xa818('0x3b')]('nolimit')){_0x4777ea[_0xa818('0x23')]=qs['limit'](_0x2cb4a['query']['limit']);_0x4777ea[_0xa818('0x21')]=qs[_0xa818('0x21')](_0x2cb4a['query']['offset']);}_0x4777ea[_0xa818('0x3c')]=qs[_0xa818('0x3d')](_0x2cb4a[_0xa818('0x35')]['sort']);_0x4777ea[_0xa818('0x3e')]=qs['filters'](_[_0xa818('0x3f')](_0x2cb4a[_0xa818('0x35')],_0x4aa4a7['filters']),_0x384df3);if(_0x2cb4a[_0xa818('0x35')]['filter']){_0x4777ea[_0xa818('0x3e')]=_[_0xa818('0x40')](_0x4777ea[_0xa818('0x3e')],{'$or':_[_0xa818('0x2f')](_0x384df3,function(_0x27d193){if(_0x27d193[_0xa818('0x32')]!==_0xa818('0x41')){var _0x17751d={};_0x17751d[_0x27d193[_0xa818('0x2d')]]={'$like':'%'+_0x2cb4a[_0xa818('0x35')][_0xa818('0x42')]+'%'};return _0x17751d;}})});}_0x4777ea=_['merge']({},_0x4777ea,_0x2cb4a[_0xa818('0x43')]);var _0x565996={'where':_0x4777ea[_0xa818('0x3e')]};return db[_0xa818('0x30')]['count'](_0x565996)[_0xa818('0x29')](function(_0x463268){_0x2c8aac[_0xa818('0x24')]=_0x463268;if(_0x2cb4a[_0xa818('0x35')]['includeAll']){_0x4777ea['include']=[{'all':!![]}];}return db[_0xa818('0x30')][_0xa818('0x44')](_0x4777ea);})[_0xa818('0x29')](function(_0x581df8){_0x2c8aac[_0xa818('0x45')]=_0x581df8;return _0x2c8aac;})['then'](respondWithFilteredResult(_0x55be71,_0x4777ea))[_0xa818('0x46')](handleError(_0x55be71,null));};exports['show']=function(_0x5198ff,_0x1e17ea){var _0x59a021={'raw':!![],'where':{'id':_0x5198ff['params']['id']}},_0x3d566d={};_0x3d566d['model']=_[_0xa818('0x36')](db[_0xa818('0x30')][_0xa818('0x31')]);_0x3d566d[_0xa818('0x35')]=_[_0xa818('0x36')](_0x5198ff[_0xa818('0x35')]);_0x3d566d[_0xa818('0x37')]=_['intersection'](_0x3d566d['model'],_0x3d566d[_0xa818('0x35')]);_0x59a021[_0xa818('0x3a')]=_[_0xa818('0x38')](_0x3d566d[_0xa818('0x34')],qs[_0xa818('0x39')](_0x5198ff[_0xa818('0x35')][_0xa818('0x39')]));_0x59a021['attributes']=_0x59a021[_0xa818('0x3a')]['length']?_0x59a021[_0xa818('0x3a')]:_0x3d566d['model'];if(_0x5198ff[_0xa818('0x35')][_0xa818('0x47')]){_0x59a021[_0xa818('0x48')]=[{'all':!![]}];}_0x59a021=_[_0xa818('0x40')]({},_0x59a021,_0x5198ff['options']);return db['FreshsalesField']['find'](_0x59a021)[_0xa818('0x29')](handleEntityNotFound(_0x1e17ea,null))['then'](respondWithResult(_0x1e17ea,null))[_0xa818('0x46')](handleError(_0x1e17ea,null));};exports[_0xa818('0x49')]=function(_0xbbed4b,_0x3432ed){return db['FreshsalesField'][_0xa818('0x49')](_0xbbed4b['body'],{})[_0xa818('0x29')](respondWithResult(_0x3432ed,0xc9))[_0xa818('0x46')](handleError(_0x3432ed,null));};exports[_0xa818('0x4a')]=function(_0x441ae7,_0x4c9897){if(_0x441ae7[_0xa818('0x4b')]['id']){delete _0x441ae7['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x441ae7[_0xa818('0x4c')]['id']}})[_0xa818('0x29')](handleEntityNotFound(_0x4c9897,null))[_0xa818('0x29')](saveUpdates(_0x441ae7[_0xa818('0x4b')],null))[_0xa818('0x29')](respondWithResult(_0x4c9897,null))[_0xa818('0x46')](handleError(_0x4c9897,null));};exports[_0xa818('0x2a')]=function(_0x588beb,_0x51a66e){return db[_0xa818('0x30')]['find']({'where':{'id':_0x588beb[_0xa818('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51a66e,null))[_0xa818('0x29')](removeEntity(_0x51a66e,null))[_0xa818('0x46')](handleError(_0x51a66e,null));}; \ No newline at end of file +var _0x8aef=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','save','update','destroy','then','error','name','send','fieldName','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','FreshsalesField','includeAll','include','findAll','rows','params','rawAttributes','length','options','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xdea1ee,_0x2d2841){var _0x96c530=function(_0x4e743b){while(--_0x4e743b){_0xdea1ee['push'](_0xdea1ee['shift']());}};_0x96c530(++_0x2d2841);}(_0x8aef,0x1e0));var _0xf8ae=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x8aef[_0x2fc012];return _0x2891f9;};'use strict';var emlformat=require(_0xf8ae('0x0'));var rimraf=require(_0xf8ae('0x1'));var zipdir=require(_0xf8ae('0x2'));var jsonpatch=require(_0xf8ae('0x3'));var rp=require(_0xf8ae('0x4'));var moment=require('moment');var BPromise=require(_0xf8ae('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf8ae('0x6'));var csv=require('to-csv');var ejs=require(_0xf8ae('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8ae('0x8'));var squel=require(_0xf8ae('0x9'));var crypto=require(_0xf8ae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf8ae('0xb'));var toCsv=require(_0xf8ae('0xc'));var querystring=require(_0xf8ae('0xd'));var Papa=require(_0xf8ae('0xe'));var Redis=require(_0xf8ae('0xf'));var authService=require(_0xf8ae('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8ae('0x11'))(_0xf8ae('0x12'));var utils=require(_0xf8ae('0x13'));var config=require(_0xf8ae('0x14'));var licenseUtil=require(_0xf8ae('0x15'));var db=require(_0xf8ae('0x16'))['db'];function respondWithStatusCode(_0x35eb1d,_0x5d8498){_0x5d8498=_0x5d8498||0xcc;return function(_0x530e66){if(_0x530e66){return _0x35eb1d[_0xf8ae('0x17')](_0x5d8498);}return _0x35eb1d[_0xf8ae('0x18')](_0x5d8498)[_0xf8ae('0x19')]();};}function respondWithResult(_0x4f0658,_0x405db6){_0x405db6=_0x405db6||0xc8;return function(_0x51a0d2){if(_0x51a0d2){return _0x4f0658['status'](_0x405db6)[_0xf8ae('0x1a')](_0x51a0d2);}};}function respondWithFilteredResult(_0x48161f,_0x35a77f){return function(_0x15390b){if(_0x15390b){var _0x103d6e=typeof _0x35a77f['offset']==='undefined'&&typeof _0x35a77f['limit']===_0xf8ae('0x1b');var _0xd92397=_0x15390b[_0xf8ae('0x1c')];var _0x5dc3c5=_0x103d6e?0x0:_0x35a77f[_0xf8ae('0x1d')];var _0xa6b0a5=_0x103d6e?_0x15390b[_0xf8ae('0x1c')]:_0x35a77f[_0xf8ae('0x1d')]+_0x35a77f[_0xf8ae('0x1e')];var _0x531bfb;if(_0xa6b0a5>=_0xd92397){_0xa6b0a5=_0xd92397;_0x531bfb=0xc8;}else{_0x531bfb=0xce;}_0x48161f[_0xf8ae('0x18')](_0x531bfb);return _0x48161f[_0xf8ae('0x1f')]('Content-Range',_0x5dc3c5+'-'+_0xa6b0a5+'/'+_0xd92397)[_0xf8ae('0x1a')](_0x15390b);}return null;};}function patchUpdates(_0x5bc224){return function(_0x4736db){try{jsonpatch[_0xf8ae('0x20')](_0x4736db,_0x5bc224,!![]);}catch(_0x1c6137){return BPromise['reject'](_0x1c6137);}return _0x4736db[_0xf8ae('0x21')]();};}function saveUpdates(_0x19ffe2,_0x25b261){return function(_0x11dbfb){if(_0x11dbfb){return _0x11dbfb[_0xf8ae('0x22')](_0x19ffe2)['then'](function(_0x1755f0){return _0x1755f0;});}return null;};}function removeEntity(_0x4d3827,_0x4e1503){return function(_0x574ffc){if(_0x574ffc){return _0x574ffc[_0xf8ae('0x23')]()[_0xf8ae('0x24')](function(){_0x4d3827['status'](0xcc)[_0xf8ae('0x19')]();});}};}function handleEntityNotFound(_0x4b9871,_0x328c11){return function(_0x5b3d82){if(!_0x5b3d82){_0x4b9871[_0xf8ae('0x17')](0x194);}return _0x5b3d82;};}function handleError(_0xd3be79,_0x12a4e7){_0x12a4e7=_0x12a4e7||0x1f4;return function(_0x5788ae){logger[_0xf8ae('0x25')](_0x5788ae['stack']);if(_0x5788ae[_0xf8ae('0x26')]){delete _0x5788ae[_0xf8ae('0x26')];}_0xd3be79[_0xf8ae('0x18')](_0x12a4e7)[_0xf8ae('0x27')](_0x5788ae);};}exports['index']=function(_0x4e6491,_0x2f732d){var _0x22d000={},_0x4bf56d={},_0x2fbec0={'count':0x0,'rows':[]};var _0x53717b=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x9bd38b){return{'name':_0x9bd38b[_0xf8ae('0x28')],'type':_0x9bd38b['type']['key']};});_0x4bf56d['model']=_[_0xf8ae('0x29')](_0x53717b,_0xf8ae('0x26'));_0x4bf56d[_0xf8ae('0x2a')]=_[_0xf8ae('0x2b')](_0x4e6491[_0xf8ae('0x2a')]);_0x4bf56d['filters']=_['intersection'](_0x4bf56d['model'],_0x4bf56d[_0xf8ae('0x2a')]);_0x22d000[_0xf8ae('0x2c')]=_[_0xf8ae('0x2d')](_0x4bf56d[_0xf8ae('0x2e')],qs[_0xf8ae('0x2f')](_0x4e6491[_0xf8ae('0x2a')][_0xf8ae('0x2f')]));_0x22d000[_0xf8ae('0x2c')]=_0x22d000[_0xf8ae('0x2c')]['length']?_0x22d000[_0xf8ae('0x2c')]:_0x4bf56d['model'];if(!_0x4e6491[_0xf8ae('0x2a')][_0xf8ae('0x30')](_0xf8ae('0x31'))){_0x22d000[_0xf8ae('0x1e')]=qs[_0xf8ae('0x1e')](_0x4e6491[_0xf8ae('0x2a')][_0xf8ae('0x1e')]);_0x22d000[_0xf8ae('0x1d')]=qs[_0xf8ae('0x1d')](_0x4e6491[_0xf8ae('0x2a')][_0xf8ae('0x1d')]);}_0x22d000['order']=qs[_0xf8ae('0x32')](_0x4e6491[_0xf8ae('0x2a')][_0xf8ae('0x32')]);_0x22d000[_0xf8ae('0x33')]=qs[_0xf8ae('0x34')](_[_0xf8ae('0x35')](_0x4e6491['query'],_0x4bf56d[_0xf8ae('0x34')]),_0x53717b);if(_0x4e6491[_0xf8ae('0x2a')][_0xf8ae('0x36')]){_0x22d000['where']=_[_0xf8ae('0x37')](_0x22d000[_0xf8ae('0x33')],{'$or':_['map'](_0x53717b,function(_0x37e18a){if(_0x37e18a[_0xf8ae('0x38')]!==_0xf8ae('0x39')){var _0x9f7a98={};_0x9f7a98[_0x37e18a[_0xf8ae('0x26')]]={'$like':'%'+_0x4e6491['query'][_0xf8ae('0x36')]+'%'};return _0x9f7a98;}})});}_0x22d000=_[_0xf8ae('0x37')]({},_0x22d000,_0x4e6491['options']);var _0x5c0ffb={'where':_0x22d000[_0xf8ae('0x33')]};return db[_0xf8ae('0x3a')]['count'](_0x5c0ffb)[_0xf8ae('0x24')](function(_0x3ca28e){_0x2fbec0[_0xf8ae('0x1c')]=_0x3ca28e;if(_0x4e6491[_0xf8ae('0x2a')][_0xf8ae('0x3b')]){_0x22d000[_0xf8ae('0x3c')]=[{'all':!![]}];}return db[_0xf8ae('0x3a')][_0xf8ae('0x3d')](_0x22d000);})[_0xf8ae('0x24')](function(_0x39731f){_0x2fbec0[_0xf8ae('0x3e')]=_0x39731f;return _0x2fbec0;})[_0xf8ae('0x24')](respondWithFilteredResult(_0x2f732d,_0x22d000))['catch'](handleError(_0x2f732d,null));};exports['show']=function(_0xdfbbe2,_0x4b7f95){var _0x5cd628={'raw':!![],'where':{'id':_0xdfbbe2[_0xf8ae('0x3f')]['id']}},_0x5ad7fb={};_0x5ad7fb[_0xf8ae('0x2e')]=_['keys'](db['FreshsalesField'][_0xf8ae('0x40')]);_0x5ad7fb['query']=_['keys'](_0xdfbbe2[_0xf8ae('0x2a')]);_0x5ad7fb[_0xf8ae('0x34')]=_['intersection'](_0x5ad7fb['model'],_0x5ad7fb[_0xf8ae('0x2a')]);_0x5cd628[_0xf8ae('0x2c')]=_['intersection'](_0x5ad7fb[_0xf8ae('0x2e')],qs['fields'](_0xdfbbe2[_0xf8ae('0x2a')]['fields']));_0x5cd628['attributes']=_0x5cd628['attributes'][_0xf8ae('0x41')]?_0x5cd628[_0xf8ae('0x2c')]:_0x5ad7fb[_0xf8ae('0x2e')];if(_0xdfbbe2[_0xf8ae('0x2a')]['includeAll']){_0x5cd628[_0xf8ae('0x3c')]=[{'all':!![]}];}_0x5cd628=_[_0xf8ae('0x37')]({},_0x5cd628,_0xdfbbe2[_0xf8ae('0x42')]);return db[_0xf8ae('0x3a')][_0xf8ae('0x43')](_0x5cd628)[_0xf8ae('0x24')](handleEntityNotFound(_0x4b7f95,null))[_0xf8ae('0x24')](respondWithResult(_0x4b7f95,null))['catch'](handleError(_0x4b7f95,null));};exports[_0xf8ae('0x44')]=function(_0x204fdd,_0x2d9c58){return db[_0xf8ae('0x3a')][_0xf8ae('0x44')](_0x204fdd[_0xf8ae('0x45')],{})[_0xf8ae('0x24')](respondWithResult(_0x2d9c58,0xc9))[_0xf8ae('0x46')](handleError(_0x2d9c58,null));};exports[_0xf8ae('0x22')]=function(_0x91e565,_0x2cb075){if(_0x91e565[_0xf8ae('0x45')]['id']){delete _0x91e565[_0xf8ae('0x45')]['id'];}return db[_0xf8ae('0x3a')][_0xf8ae('0x43')]({'where':{'id':_0x91e565['params']['id']}})[_0xf8ae('0x24')](handleEntityNotFound(_0x2cb075,null))[_0xf8ae('0x24')](saveUpdates(_0x91e565[_0xf8ae('0x45')],null))[_0xf8ae('0x24')](respondWithResult(_0x2cb075,null))['catch'](handleError(_0x2cb075,null));};exports[_0xf8ae('0x23')]=function(_0x39c53b,_0x3c1fb2){return db['FreshsalesField'][_0xf8ae('0x43')]({'where':{'id':_0x39c53b['params']['id']}})[_0xf8ae('0x24')](handleEntityNotFound(_0x3c1fb2,null))[_0xf8ae('0x24')](removeEntity(_0x3c1fb2,null))['catch'](handleError(_0x3c1fb2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 8c1701c..e310846 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 _0x2ace=['exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x4da4f5,_0x32c9bd){var _0x38ef44=function(_0x2e64aa){while(--_0x2e64aa){_0x4da4f5['push'](_0x4da4f5['shift']());}};_0x38ef44(++_0x32c9bd);}(_0x2ace,0x17e));var _0xe2ac=function(_0x56355a,_0x138baf){_0x56355a=_0x56355a-0x0;var _0x573afa=_0x2ace[_0x56355a];return _0x573afa;};'use strict';var _=require('lodash');var util=require(_0xe2ac('0x0'));var logger=require(_0xe2ac('0x1'))(_0xe2ac('0x2'));var moment=require('moment');var BPromise=require(_0xe2ac('0x3'));var rp=require(_0xe2ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2ac('0x5'));var config=require(_0xe2ac('0x6'));var attributes=require(_0xe2ac('0x7'));module[_0xe2ac('0x8')]=function(_0x386b18,_0x46e9f3){return _0x386b18[_0xe2ac('0x9')](_0xe2ac('0xa'),attributes,{'tableName':_0xe2ac('0xb'),'paranoid':![],'indexes':[{'name':_0xe2ac('0xc'),'fields':[_0xe2ac('0xd'),_0xe2ac('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1678=['int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x1678,0x17b));var _0x8167=function(_0x3fa008,_0x3fb7fc){_0x3fa008=_0x3fa008-0x0;var _0x367efd=_0x1678[_0x3fa008];return _0x367efd;};'use strict';var _=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var logger=require(_0x8167('0x2'))(_0x8167('0x3'));var moment=require(_0x8167('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8167('0x5'));var rimraf=require(_0x8167('0x6'));var config=require(_0x8167('0x7'));var attributes=require(_0x8167('0x8'));module[_0x8167('0x9')]=function(_0xa9fd75,_0x30f248){return _0xa9fd75['define'](_0x8167('0xa'),attributes,{'tableName':_0x8167('0xb'),'paranoid':![],'indexes':[{'name':_0x8167('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 2178486..47906a6 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x4975,0x86));var _0x5497=function(_0x153d13,_0x44ee9d){_0x153d13=_0x153d13-0x0;var _0x4a3c41=_0x4975[_0x153d13];return _0x4a3c41;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ 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(_0x2f6641,_0x258c00){var _0x103625=function(_0x204573){while(--_0x204573){_0x2f6641['push'](_0x2f6641['shift']());}};_0x103625(++_0x258c00);}(_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 00a0db2..d560b57 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(_0x51178d,_0x3f3cf2){var _0x531533=function(_0x1e83d8){while(--_0x1e83d8){_0x51178d['push'](_0x51178d['shift']());}};_0x531533(++_0x3f3cf2);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5818c8,_0xbdfd48){var _0x219ce5=function(_0x10157c){while(--_0x10157c){_0x5818c8['push'](_0x5818c8['shift']());}};_0x219ce5(++_0xbdfd48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 f8edbd6..d76c0fb 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 _0xb53e=['exports','STRING','integrationTab','newTab','sequelize'];(function(_0x3b24d8,_0x26f8cc){var _0x358302=function(_0x5be028){while(--_0x5be028){_0x3b24d8['push'](_0x3b24d8['shift']());}};_0x358302(++_0x26f8cc);}(_0xb53e,0xa9));var _0xeb53=function(_0x541b36,_0x5c7fbc){_0x541b36=_0x541b36-0x0;var _0x1b7ea3=_0xb53e[_0x541b36];return _0x1b7ea3;};'use strict';var Sequelize=require(_0xeb53('0x0'));module[_0xeb53('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb53('0x2')]},'username':{'type':Sequelize[_0xeb53('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xeb53('0x2')]},'password':{'type':Sequelize[_0xeb53('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xeb53('0x2')]},'securityToken':{'type':Sequelize[_0xeb53('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xeb53('0x3'),_0xeb53('0x4')),'defaultValue':_0xeb53('0x3')}}; \ No newline at end of file +var _0x9962=['STRING','ENUM','newTab','integrationTab','sequelize'];(function(_0x3c910d,_0x3b5566){var _0x4927fa=function(_0xc98564){while(--_0xc98564){_0x3c910d['push'](_0x3c910d['shift']());}};_0x4927fa(++_0x3b5566);}(_0x9962,0xb8));var _0x2996=function(_0x9e782f,_0x3213e0){_0x9e782f=_0x9e782f-0x0;var _0x2bc4a8=_0x9962[_0x9e782f];return _0x2bc4a8;};'use strict';var Sequelize=require(_0x2996('0x0'));module['exports']={'name':{'type':Sequelize[_0x2996('0x1')]},'description':{'type':Sequelize[_0x2996('0x1')]},'username':{'type':Sequelize[_0x2996('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x2996('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2996('0x1')]},'clientSecret':{'type':Sequelize[_0x2996('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2996('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2996('0x2')]('integrationTab',_0x2996('0x3')),'defaultValue':_0x2996('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b1638dc..ff63c23 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 _0xe102=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','then','include','rows','catch','show','params','keys','length','includeAll','options','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','substring','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','picklist','boolean','email','textarea','includes','custom','label','value','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis'];(function(_0xdae6b9,_0x370831){var _0x4f7567=function(_0x2b96b6){while(--_0x2b96b6){_0xdae6b9['push'](_0xdae6b9['shift']());}};_0x4f7567(++_0x370831);}(_0xe102,0x69));var _0x2e10=function(_0x59d88f,_0x279056){_0x59d88f=_0x59d88f-0x0;var _0x21c32f=_0xe102[_0x59d88f];return _0x21c32f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e10('0x0'));var zipdir=require(_0x2e10('0x1'));var jsonpatch=require(_0x2e10('0x2'));var rp=require(_0x2e10('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2e10('0x4'));var util=require(_0x2e10('0x5'));var path=require(_0x2e10('0x6'));var sox=require('sox');var csv=require(_0x2e10('0x7'));var ejs=require(_0x2e10('0x8'));var fs=require('fs');var fs_extra=require(_0x2e10('0x9'));var _=require(_0x2e10('0xa'));var squel=require(_0x2e10('0xb'));var crypto=require(_0x2e10('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2e10('0xd'));var Papa=require(_0x2e10('0xe'));var Redis=require(_0x2e10('0xf'));var authService=require(_0x2e10('0x10'));var qs=require(_0x2e10('0x11'));var as=require(_0x2e10('0x12'));var hardwareService=require(_0x2e10('0x13'));var logger=require('../../config/logger')(_0x2e10('0x14'));var utils=require(_0x2e10('0x15'));var config=require(_0x2e10('0x16'));var licenseUtil=require(_0x2e10('0x17'));var db=require(_0x2e10('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x41f0b4,_0x5b5e9c){_0x5b5e9c=_0x5b5e9c||0xcc;return function(_0x4ed30c){if(_0x4ed30c){return _0x41f0b4[_0x2e10('0x19')](_0x5b5e9c);}return _0x41f0b4[_0x2e10('0x1a')](_0x5b5e9c)[_0x2e10('0x1b')]();};}function respondWithResult(_0x2323cf,_0x1bbaab){_0x1bbaab=_0x1bbaab||0xc8;return function(_0x437703){if(_0x437703){return _0x2323cf[_0x2e10('0x1a')](_0x1bbaab)['json'](_0x437703);}};}function respondWithFilteredResult(_0x17b139,_0x35df87){return function(_0x9f958){if(_0x9f958){var _0x3c3658=typeof _0x35df87['offset']===_0x2e10('0x1c')&&typeof _0x35df87[_0x2e10('0x1d')]==='undefined';var _0x551869=_0x9f958[_0x2e10('0x1e')];var _0xfddfc0=_0x3c3658?0x0:_0x35df87[_0x2e10('0x1f')];var _0x44be6e=_0x3c3658?_0x9f958['count']:_0x35df87['offset']+_0x35df87[_0x2e10('0x1d')];var _0x474e37;if(_0x44be6e>=_0x551869){_0x44be6e=_0x551869;_0x474e37=0xc8;}else{_0x474e37=0xce;}_0x17b139[_0x2e10('0x1a')](_0x474e37);return _0x17b139[_0x2e10('0x20')](_0x2e10('0x21'),_0xfddfc0+'-'+_0x44be6e+'/'+_0x551869)['json'](_0x9f958);}return null;};}function patchUpdates(_0x304e9d){return function(_0x3b8a83){try{jsonpatch[_0x2e10('0x22')](_0x3b8a83,_0x304e9d,!![]);}catch(_0x3bb9d8){return BPromise[_0x2e10('0x23')](_0x3bb9d8);}return _0x3b8a83[_0x2e10('0x24')]();};}function saveUpdates(_0x1a0d6e,_0x4c6d04){return function(_0x51dabe){if(_0x51dabe){return _0x51dabe[_0x2e10('0x25')](_0x1a0d6e)['then'](function(_0x2c5470){return _0x2c5470;});}return null;};}function removeEntity(_0x1f7d86,_0x392d21){return function(_0x2f1211){if(_0x2f1211){return _0x2f1211['destroy']()['then'](function(){_0x1f7d86[_0x2e10('0x1a')](0xcc)[_0x2e10('0x1b')]();});}};}function handleEntityNotFound(_0x22ead2,_0x36a040){return function(_0x2adab7){if(!_0x2adab7){_0x22ead2[_0x2e10('0x19')](0x194);}return _0x2adab7;};}function handleError(_0x3aed75,_0x8c4642){_0x8c4642=_0x8c4642||0x1f4;return function(_0x4f3e15){logger[_0x2e10('0x26')](_0x4f3e15[_0x2e10('0x27')]);if(_0x4f3e15['name']){delete _0x4f3e15[_0x2e10('0x28')];}_0x3aed75[_0x2e10('0x1a')](_0x8c4642)[_0x2e10('0x29')](_0x4f3e15);};}exports[_0x2e10('0x2a')]=function(_0x2e3fa2,_0x27aef2){var _0x1dc9ca={},_0x2dce87={},_0x50bbee={'count':0x0,'rows':[]};var _0x317427=_[_0x2e10('0x2b')](db[_0x2e10('0x2c')][_0x2e10('0x2d')],function(_0x49a2dc){return{'name':_0x49a2dc[_0x2e10('0x2e')],'type':_0x49a2dc[_0x2e10('0x2f')][_0x2e10('0x30')]};});_0x2dce87[_0x2e10('0x31')]=_['map'](_0x317427,_0x2e10('0x28'));_0x2dce87[_0x2e10('0x32')]=_['keys'](_0x2e3fa2[_0x2e10('0x32')]);_0x2dce87[_0x2e10('0x33')]=_[_0x2e10('0x34')](_0x2dce87[_0x2e10('0x31')],_0x2dce87[_0x2e10('0x32')]);_0x1dc9ca['attributes']=_[_0x2e10('0x34')](_0x2dce87[_0x2e10('0x31')],qs[_0x2e10('0x35')](_0x2e3fa2[_0x2e10('0x32')][_0x2e10('0x35')]));_0x1dc9ca[_0x2e10('0x36')]=_0x1dc9ca[_0x2e10('0x36')]['length']?_0x1dc9ca[_0x2e10('0x36')]:_0x2dce87[_0x2e10('0x31')];if(!_0x2e3fa2['query'][_0x2e10('0x37')](_0x2e10('0x38'))){_0x1dc9ca[_0x2e10('0x1d')]=qs[_0x2e10('0x1d')](_0x2e3fa2[_0x2e10('0x32')]['limit']);_0x1dc9ca['offset']=qs[_0x2e10('0x1f')](_0x2e3fa2[_0x2e10('0x32')][_0x2e10('0x1f')]);}_0x1dc9ca[_0x2e10('0x39')]=qs['sort'](_0x2e3fa2['query'][_0x2e10('0x3a')]);_0x1dc9ca['where']=qs['filters'](_['pick'](_0x2e3fa2[_0x2e10('0x32')],_0x2dce87[_0x2e10('0x33')]),_0x317427);if(_0x2e3fa2['query']['filter']){_0x1dc9ca[_0x2e10('0x3b')]=_['merge'](_0x1dc9ca[_0x2e10('0x3b')],{'$or':_[_0x2e10('0x2b')](_0x317427,function(_0x39545d){if(_0x39545d[_0x2e10('0x2f')]!==_0x2e10('0x3c')){var _0x45f914={};_0x45f914[_0x39545d['name']]={'$like':'%'+_0x2e3fa2[_0x2e10('0x32')][_0x2e10('0x3d')]+'%'};return _0x45f914;}})});}_0x1dc9ca=_[_0x2e10('0x3e')]({},_0x1dc9ca,_0x2e3fa2['options']);var _0x2eb374={'where':_0x1dc9ca[_0x2e10('0x3b')]};return db[_0x2e10('0x2c')][_0x2e10('0x1e')](_0x2eb374)[_0x2e10('0x3f')](function(_0x58b4d5){_0x50bbee[_0x2e10('0x1e')]=_0x58b4d5;if(_0x2e3fa2[_0x2e10('0x32')]['includeAll']){_0x1dc9ca[_0x2e10('0x40')]=[{'all':!![]}];}return db[_0x2e10('0x2c')]['findAll'](_0x1dc9ca);})[_0x2e10('0x3f')](function(_0x196a1f){_0x50bbee[_0x2e10('0x41')]=_0x196a1f;return _0x50bbee;})['then'](respondWithFilteredResult(_0x27aef2,_0x1dc9ca))[_0x2e10('0x42')](handleError(_0x27aef2,null));};exports[_0x2e10('0x43')]=function(_0x39e316,_0x2f7179){var _0x50598f={'raw':![],'where':{'id':_0x39e316[_0x2e10('0x44')]['id']}},_0x5a447e={};_0x5a447e[_0x2e10('0x31')]=_[_0x2e10('0x45')](db['SalesforceAccount'][_0x2e10('0x2d')]);_0x5a447e[_0x2e10('0x32')]=_[_0x2e10('0x45')](_0x39e316[_0x2e10('0x32')]);_0x5a447e['filters']=_[_0x2e10('0x34')](_0x5a447e['model'],_0x5a447e['query']);_0x50598f[_0x2e10('0x36')]=_['intersection'](_0x5a447e[_0x2e10('0x31')],qs[_0x2e10('0x35')](_0x39e316['query']['fields']));_0x50598f[_0x2e10('0x36')]=_0x50598f[_0x2e10('0x36')][_0x2e10('0x46')]?_0x50598f[_0x2e10('0x36')]:_0x5a447e[_0x2e10('0x31')];if(_0x39e316[_0x2e10('0x32')][_0x2e10('0x47')]){_0x50598f['include']=[{'all':!![]}];}_0x50598f=_['merge']({},_0x50598f,_0x39e316[_0x2e10('0x48')]);return db[_0x2e10('0x2c')][_0x2e10('0x49')](_0x50598f)[_0x2e10('0x3f')](handleEntityNotFound(_0x2f7179,null))[_0x2e10('0x3f')](respondWithResult(_0x2f7179,null))['catch'](handleError(_0x2f7179,null));};exports['create']=function(_0x3ceb77,_0x310d67){return db[_0x2e10('0x2c')][_0x2e10('0x4a')](_0x3ceb77[_0x2e10('0x4b')],{})[_0x2e10('0x3f')](respondWithResult(_0x310d67,0xc9))[_0x2e10('0x42')](handleError(_0x310d67,null));};exports[_0x2e10('0x25')]=function(_0x2ec021,_0x4acfda){if(_0x2ec021[_0x2e10('0x4b')]['id']){delete _0x2ec021[_0x2e10('0x4b')]['id'];}return db[_0x2e10('0x2c')][_0x2e10('0x49')]({'where':{'id':_0x2ec021[_0x2e10('0x44')]['id']}})[_0x2e10('0x3f')](handleEntityNotFound(_0x4acfda,null))[_0x2e10('0x3f')](saveUpdates(_0x2ec021[_0x2e10('0x4b')],null))[_0x2e10('0x3f')](respondWithResult(_0x4acfda,null))['catch'](handleError(_0x4acfda,null));};exports[_0x2e10('0x4c')]=function(_0x4b80fa,_0x35c7ae){return db[_0x2e10('0x2c')][_0x2e10('0x49')]({'where':{'id':_0x4b80fa[_0x2e10('0x44')]['id']}})[_0x2e10('0x3f')](handleEntityNotFound(_0x35c7ae,null))[_0x2e10('0x3f')](removeEntity(_0x35c7ae,null))[_0x2e10('0x42')](handleError(_0x35c7ae,null));};exports[_0x2e10('0x4d')]=function(_0x52d9e8,_0x35d43b,_0x2acbca){var _0xa43cc4={};var _0x4921ab={};var _0x272736;var _0x52da19;return db[_0x2e10('0x2c')][_0x2e10('0x4e')]({'where':{'id':_0x52d9e8[_0x2e10('0x44')]['id']}})[_0x2e10('0x3f')](handleEntityNotFound(_0x35d43b,null))[_0x2e10('0x3f')](function(_0x4236a5){if(_0x4236a5){_0x272736=_0x4236a5;_0x4921ab[_0x2e10('0x31')]=_[_0x2e10('0x45')](db[_0x2e10('0x4f')]['rawAttributes']);_0x4921ab['query']=_[_0x2e10('0x45')](_0x52d9e8['query']);_0x4921ab[_0x2e10('0x33')]=_[_0x2e10('0x34')](_0x4921ab[_0x2e10('0x31')],_0x4921ab['query']);_0xa43cc4[_0x2e10('0x36')]=_[_0x2e10('0x34')](_0x4921ab[_0x2e10('0x31')],qs[_0x2e10('0x35')](_0x52d9e8[_0x2e10('0x32')]['fields']));_0xa43cc4['attributes']=_0xa43cc4[_0x2e10('0x36')][_0x2e10('0x46')]?_0xa43cc4[_0x2e10('0x36')]:_0x4921ab[_0x2e10('0x31')];_0xa43cc4[_0x2e10('0x39')]=qs[_0x2e10('0x3a')](_0x52d9e8[_0x2e10('0x32')][_0x2e10('0x3a')]);_0xa43cc4[_0x2e10('0x3b')]=qs[_0x2e10('0x33')](_[_0x2e10('0x50')](_0x52d9e8['query'],_0x4921ab['filters']));if(_0x52d9e8[_0x2e10('0x32')][_0x2e10('0x3d')]){_0xa43cc4[_0x2e10('0x3b')]=_[_0x2e10('0x3e')](_0xa43cc4['where'],{'$or':_[_0x2e10('0x2b')](_0xa43cc4[_0x2e10('0x36')],function(_0x1bd201){var _0x9f53ac={};_0x9f53ac[_0x1bd201]={'$like':'%'+_0x52d9e8['query'][_0x2e10('0x3d')]+'%'};return _0x9f53ac;})});}_0xa43cc4=_[_0x2e10('0x3e')]({},_0xa43cc4,_0x52d9e8[_0x2e10('0x48')]);return _0x272736[_0x2e10('0x4d')](_0xa43cc4);}})[_0x2e10('0x3f')](function(_0x53033c){if(_0x53033c){_0x52da19=_0x53033c['length'];if(!_0x52d9e8['query'][_0x2e10('0x37')](_0x2e10('0x38'))){_0xa43cc4[_0x2e10('0x1d')]=qs[_0x2e10('0x1d')](_0x52d9e8[_0x2e10('0x32')][_0x2e10('0x1d')]);_0xa43cc4['offset']=qs[_0x2e10('0x1f')](_0x52d9e8['query'][_0x2e10('0x1f')]);}return _0x272736[_0x2e10('0x4d')](_0xa43cc4);}})['then'](function(_0x5dd639){if(_0x5dd639){return _0x5dd639?{'count':_0x52da19,'rows':_0x5dd639}:null;}})[_0x2e10('0x3f')](respondWithResult(_0x35d43b,null))['catch'](handleError(_0x35d43b,null));};exports[_0x2e10('0x51')]=function(_0x39d260,_0x54acb6,_0x49cd28){if(_0x39d260[_0x2e10('0x4b')]['id']){delete _0x39d260['body']['id'];}return db[_0x2e10('0x2c')]['findOne']({'where':{'id':_0x39d260[_0x2e10('0x44')]['id']}})[_0x2e10('0x3f')](handleEntityNotFound(_0x54acb6,null))[_0x2e10('0x3f')](function(_0x281784){if(_0x281784){_0x39d260['body'][_0x2e10('0x52')]=_0x281784['id'];_0x39d260[_0x2e10('0x4b')][_0x2e10('0x53')]=integrations[_0x2e10('0x54')](_0x39d260[_0x2e10('0x4b')][_0x2e10('0x55')],_0x39d260[_0x2e10('0x4b')][_0x2e10('0x2f')]);_0x39d260[_0x2e10('0x4b')]['Descriptions']=integrations[_0x2e10('0x56')](_0x39d260[_0x2e10('0x4b')]['channel'],_0x39d260[_0x2e10('0x4b')][_0x2e10('0x2f')]);return db[_0x2e10('0x4f')][_0x2e10('0x4a')](_0x39d260['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x2e10('0x57')],'as':_0x2e10('0x58')}]});}return null;})[_0x2e10('0x3f')](respondWithResult(_0x54acb6,null))['catch'](handleError(_0x54acb6,null));};exports[_0x2e10('0x59')]=function(_0x571a97,_0x102ca3,_0x52f83d){var _0xc724da;var _0x2932ea='';var _0x250249=_0x2e10('0x5a');return db['SalesforceAccount'][_0x2e10('0x4e')]({'where':{'id':_0x571a97['params']['id']},'attributes':['id',_0x2e10('0x5b'),_0x2e10('0x5c'),_0x2e10('0x5d'),_0x2e10('0x5e'),'password',_0x2e10('0x5f')]})[_0x2e10('0x3f')](handleEntityNotFound(_0x102ca3,null))[_0x2e10('0x3f')](function(_0x4f512e){if(_0x4f512e){_0x2932ea=_0x4f512e[_0x2e10('0x5b')];var _0x4a67af=_0x2932ea['slice'](-0x1);if(_0x4a67af==='/'){_0x2932ea=_0x2932ea[_0x2e10('0x60')](0x0,_0x2932ea['lastIndexOf'](_0x4a67af));}_0xc724da=new jsforce[(_0x2e10('0x61'))]({'oauth2':{'loginUrl':_0x2932ea,'clientId':_0x4f512e[_0x2e10('0x5c')],'clientSecret':_0x4f512e['clientSecret']}});return _0xc724da[_0x2e10('0x62')](_0x4f512e[_0x2e10('0x5e')],_0x4f512e['password'][_0x2e10('0x63')](_0x4f512e['securityToken']));}})[_0x2e10('0x3f')](function(_0x20d261){if(_0x20d261){if(!_[_0x2e10('0x64')](_0x571a97[_0x2e10('0x32')][_0x2e10('0x65')])){_0x250249=_0x571a97[_0x2e10('0x32')][_0x2e10('0x65')];}return _0xc724da[_0x2e10('0x66')](_0x250249)[_0x2e10('0x67')]();}})[_0x2e10('0x3f')](function(_0x46dd13){var _0x4607fd=[_0x2e10('0x68'),'ActivityDate','IsReminderSet',_0x2e10('0x69'),_0x2e10('0x6a'),'Description'];var _0x2dd0db=['string','int',_0x2e10('0x6b'),_0x2e10('0x6c'),_0x2e10('0x6d'),_0x2e10('0x6e'),'phone'];if(_0x46dd13){_['remove'](_0x46dd13[_0x2e10('0x35')],function(_0x38f624){return _0x4607fd[_0x2e10('0x6f')](_0x38f624[_0x2e10('0x28')])||!_0x2dd0db[_0x2e10('0x6f')](_0x38f624[_0x2e10('0x2f')]);});return{'count':_0x46dd13[_0x2e10('0x35')][_0x2e10('0x46')],'rows':_[_0x2e10('0x2b')](_0x46dd13[_0x2e10('0x35')],function(_0x3ecc08){return{'id':_0x3ecc08[_0x2e10('0x28')],'name':_0x3ecc08['label'],'custom':_0x3ecc08[_0x2e10('0x70')],'options':_0x3ecc08['picklistValues'][_0x2e10('0x46')]>0x0?_[_0x2e10('0x2b')](_0x3ecc08['picklistValues'],function(_0xd72412){return{'name':_0xd72412[_0x2e10('0x71')],'value':_0xd72412[_0x2e10('0x72')]};}):_0x3ecc08[_0x2e10('0x2f')]==_0x2e10('0x6c')?[{'name':_0x2e10('0x73'),'value':_0x2e10('0x74')},{'name':_0x2e10('0x75'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x102ca3,null))[_0x2e10('0x42')](function(_0x42ad4){var _0x5db7b5=_0x571a97['query'][_0x2e10('0x76')]?0x1f4:_0x42ad4['statusCode']||0x1f4;logger['error'](_0x2e10('0x77'),_0x2e10('0x59'),_0x5db7b5,JSON['stringify'](_0x42ad4));delete _0x42ad4[_0x2e10('0x28')];if(_0x5db7b5===0x191){_0x5db7b5=0x190;}_0x102ca3['status'](_0x5db7b5)[_0x2e10('0x29')](_0x571a97[_0x2e10('0x32')]['test']?{'message':_0x2e10('0x78'),'statusCode':_0x42ad4['statusCode']}:_0x42ad4);});}; \ No newline at end of file +var _0xaa4b=['login','concat','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','index','map','SalesforceAccount','rawAttributes','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','Connection'];(function(_0x100573,_0x91e515){var _0x11cb6c=function(_0x3e1dd2){while(--_0x3e1dd2){_0x100573['push'](_0x100573['shift']());}};_0x11cb6c(++_0x91e515);}(_0xaa4b,0x188));var _0xbaa4=function(_0x295d18,_0x59d858){_0x295d18=_0x295d18-0x0;var _0x1cc1f1=_0xaa4b[_0x295d18];return _0x1cc1f1;};'use strict';var emlformat=require(_0xbaa4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbaa4('0x1'));var jsonpatch=require(_0xbaa4('0x2'));var rp=require(_0xbaa4('0x3'));var moment=require(_0xbaa4('0x4'));var BPromise=require(_0xbaa4('0x5'));var Mustache=require(_0xbaa4('0x6'));var util=require(_0xbaa4('0x7'));var path=require('path');var sox=require(_0xbaa4('0x8'));var csv=require(_0xbaa4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbaa4('0xa'));var _=require(_0xbaa4('0xb'));var squel=require('squel');var crypto=require(_0xbaa4('0xc'));var jsforce=require(_0xbaa4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbaa4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbaa4('0xf'));var hardwareService=require(_0xbaa4('0x10'));var logger=require('../../config/logger')(_0xbaa4('0x11'));var utils=require(_0xbaa4('0x12'));var config=require(_0xbaa4('0x13'));var licenseUtil=require(_0xbaa4('0x14'));var db=require(_0xbaa4('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x31a493,_0x9d85bb){_0x9d85bb=_0x9d85bb||0xcc;return function(_0x557bd0){if(_0x557bd0){return _0x31a493['sendStatus'](_0x9d85bb);}return _0x31a493[_0xbaa4('0x16')](_0x9d85bb)[_0xbaa4('0x17')]();};}function respondWithResult(_0x3cf072,_0x15a459){_0x15a459=_0x15a459||0xc8;return function(_0x934153){if(_0x934153){return _0x3cf072['status'](_0x15a459)[_0xbaa4('0x18')](_0x934153);}};}function respondWithFilteredResult(_0x58a238,_0xc2950){return function(_0x57237d){if(_0x57237d){var _0x25120b=typeof _0xc2950[_0xbaa4('0x19')]==='undefined'&&typeof _0xc2950[_0xbaa4('0x1a')]===_0xbaa4('0x1b');var _0x5c9a68=_0x57237d[_0xbaa4('0x1c')];var _0x1bd2aa=_0x25120b?0x0:_0xc2950[_0xbaa4('0x19')];var _0x457651=_0x25120b?_0x57237d['count']:_0xc2950[_0xbaa4('0x19')]+_0xc2950[_0xbaa4('0x1a')];var _0x1a2218;if(_0x457651>=_0x5c9a68){_0x457651=_0x5c9a68;_0x1a2218=0xc8;}else{_0x1a2218=0xce;}_0x58a238[_0xbaa4('0x16')](_0x1a2218);return _0x58a238[_0xbaa4('0x1d')](_0xbaa4('0x1e'),_0x1bd2aa+'-'+_0x457651+'/'+_0x5c9a68)[_0xbaa4('0x18')](_0x57237d);}return null;};}function patchUpdates(_0x2fdd44){return function(_0x372c2c){try{jsonpatch[_0xbaa4('0x1f')](_0x372c2c,_0x2fdd44,!![]);}catch(_0x179992){return BPromise['reject'](_0x179992);}return _0x372c2c['save']();};}function saveUpdates(_0x2d7e96,_0x3e3f6a){return function(_0x572b4c){if(_0x572b4c){return _0x572b4c[_0xbaa4('0x20')](_0x2d7e96)[_0xbaa4('0x21')](function(_0x1c568d){return _0x1c568d;});}return null;};}function removeEntity(_0x298bfb,_0x49c2f1){return function(_0x133e24){if(_0x133e24){return _0x133e24[_0xbaa4('0x22')]()['then'](function(){_0x298bfb[_0xbaa4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f5e1,_0x107f89){return function(_0x28d7d3){if(!_0x28d7d3){_0x22f5e1[_0xbaa4('0x23')](0x194);}return _0x28d7d3;};}function handleError(_0x2d1474,_0x79c61){_0x79c61=_0x79c61||0x1f4;return function(_0xb7458d){logger[_0xbaa4('0x24')](_0xb7458d['stack']);if(_0xb7458d['name']){delete _0xb7458d[_0xbaa4('0x25')];}_0x2d1474['status'](_0x79c61)['send'](_0xb7458d);};}exports[_0xbaa4('0x26')]=function(_0x3bb426,_0x3df811){var _0x5a8eec={},_0x1cb1b9={},_0x8e587f={'count':0x0,'rows':[]};var _0x12eaa0=_[_0xbaa4('0x27')](db[_0xbaa4('0x28')][_0xbaa4('0x29')],function(_0x1bfdef){return{'name':_0x1bfdef['fieldName'],'type':_0x1bfdef['type']['key']};});_0x1cb1b9['model']=_[_0xbaa4('0x27')](_0x12eaa0,_0xbaa4('0x25'));_0x1cb1b9[_0xbaa4('0x2a')]=_['keys'](_0x3bb426[_0xbaa4('0x2a')]);_0x1cb1b9[_0xbaa4('0x2b')]=_[_0xbaa4('0x2c')](_0x1cb1b9[_0xbaa4('0x2d')],_0x1cb1b9[_0xbaa4('0x2a')]);_0x5a8eec['attributes']=_[_0xbaa4('0x2c')](_0x1cb1b9['model'],qs[_0xbaa4('0x2e')](_0x3bb426[_0xbaa4('0x2a')][_0xbaa4('0x2e')]));_0x5a8eec[_0xbaa4('0x2f')]=_0x5a8eec[_0xbaa4('0x2f')][_0xbaa4('0x30')]?_0x5a8eec['attributes']:_0x1cb1b9[_0xbaa4('0x2d')];if(!_0x3bb426['query'][_0xbaa4('0x31')](_0xbaa4('0x32'))){_0x5a8eec[_0xbaa4('0x1a')]=qs[_0xbaa4('0x1a')](_0x3bb426[_0xbaa4('0x2a')][_0xbaa4('0x1a')]);_0x5a8eec[_0xbaa4('0x19')]=qs[_0xbaa4('0x19')](_0x3bb426[_0xbaa4('0x2a')]['offset']);}_0x5a8eec[_0xbaa4('0x33')]=qs[_0xbaa4('0x34')](_0x3bb426['query'][_0xbaa4('0x34')]);_0x5a8eec[_0xbaa4('0x35')]=qs[_0xbaa4('0x2b')](_[_0xbaa4('0x36')](_0x3bb426['query'],_0x1cb1b9[_0xbaa4('0x2b')]),_0x12eaa0);if(_0x3bb426[_0xbaa4('0x2a')]['filter']){_0x5a8eec[_0xbaa4('0x35')]=_[_0xbaa4('0x37')](_0x5a8eec['where'],{'$or':_[_0xbaa4('0x27')](_0x12eaa0,function(_0x282e87){if(_0x282e87[_0xbaa4('0x38')]!==_0xbaa4('0x39')){var _0xcc60fd={};_0xcc60fd[_0x282e87[_0xbaa4('0x25')]]={'$like':'%'+_0x3bb426[_0xbaa4('0x2a')][_0xbaa4('0x3a')]+'%'};return _0xcc60fd;}})});}_0x5a8eec=_[_0xbaa4('0x37')]({},_0x5a8eec,_0x3bb426[_0xbaa4('0x3b')]);var _0x4cb90e={'where':_0x5a8eec[_0xbaa4('0x35')]};return db[_0xbaa4('0x28')][_0xbaa4('0x1c')](_0x4cb90e)[_0xbaa4('0x21')](function(_0x3cb7d0){_0x8e587f[_0xbaa4('0x1c')]=_0x3cb7d0;if(_0x3bb426['query'][_0xbaa4('0x3c')]){_0x5a8eec[_0xbaa4('0x3d')]=[{'all':!![]}];}return db[_0xbaa4('0x28')][_0xbaa4('0x3e')](_0x5a8eec);})[_0xbaa4('0x21')](function(_0x2e37ed){_0x8e587f[_0xbaa4('0x3f')]=_0x2e37ed;return _0x8e587f;})['then'](respondWithFilteredResult(_0x3df811,_0x5a8eec))[_0xbaa4('0x40')](handleError(_0x3df811,null));};exports[_0xbaa4('0x41')]=function(_0x159455,_0x1c93fe){var _0x4574b6={'raw':![],'where':{'id':_0x159455['params']['id']}},_0x1f988d={};_0x1f988d[_0xbaa4('0x2d')]=_[_0xbaa4('0x42')](db['SalesforceAccount'][_0xbaa4('0x29')]);_0x1f988d[_0xbaa4('0x2a')]=_[_0xbaa4('0x42')](_0x159455[_0xbaa4('0x2a')]);_0x1f988d['filters']=_['intersection'](_0x1f988d[_0xbaa4('0x2d')],_0x1f988d[_0xbaa4('0x2a')]);_0x4574b6['attributes']=_[_0xbaa4('0x2c')](_0x1f988d['model'],qs['fields'](_0x159455[_0xbaa4('0x2a')][_0xbaa4('0x2e')]));_0x4574b6[_0xbaa4('0x2f')]=_0x4574b6[_0xbaa4('0x2f')][_0xbaa4('0x30')]?_0x4574b6[_0xbaa4('0x2f')]:_0x1f988d['model'];if(_0x159455['query'][_0xbaa4('0x3c')]){_0x4574b6[_0xbaa4('0x3d')]=[{'all':!![]}];}_0x4574b6=_[_0xbaa4('0x37')]({},_0x4574b6,_0x159455[_0xbaa4('0x3b')]);return db[_0xbaa4('0x28')][_0xbaa4('0x43')](_0x4574b6)[_0xbaa4('0x21')](handleEntityNotFound(_0x1c93fe,null))[_0xbaa4('0x21')](respondWithResult(_0x1c93fe,null))['catch'](handleError(_0x1c93fe,null));};exports[_0xbaa4('0x44')]=function(_0x52a8ad,_0x310fbe){return db['SalesforceAccount'][_0xbaa4('0x44')](_0x52a8ad[_0xbaa4('0x45')],{})[_0xbaa4('0x21')](respondWithResult(_0x310fbe,0xc9))[_0xbaa4('0x40')](handleError(_0x310fbe,null));};exports[_0xbaa4('0x20')]=function(_0x4ce0b5,_0x365d95){if(_0x4ce0b5[_0xbaa4('0x45')]['id']){delete _0x4ce0b5['body']['id'];}return db[_0xbaa4('0x28')][_0xbaa4('0x43')]({'where':{'id':_0x4ce0b5[_0xbaa4('0x46')]['id']}})[_0xbaa4('0x21')](handleEntityNotFound(_0x365d95,null))[_0xbaa4('0x21')](saveUpdates(_0x4ce0b5[_0xbaa4('0x45')],null))[_0xbaa4('0x21')](respondWithResult(_0x365d95,null))[_0xbaa4('0x40')](handleError(_0x365d95,null));};exports[_0xbaa4('0x22')]=function(_0x44b107,_0x308ea7){return db['SalesforceAccount']['find']({'where':{'id':_0x44b107[_0xbaa4('0x46')]['id']}})['then'](handleEntityNotFound(_0x308ea7,null))[_0xbaa4('0x21')](removeEntity(_0x308ea7,null))[_0xbaa4('0x40')](handleError(_0x308ea7,null));};exports[_0xbaa4('0x47')]=function(_0x1136b7,_0x68c4b5,_0x1ec2b7){var _0xe6b68={};var _0x504432={};var _0x457976;var _0x52e43e;return db['SalesforceAccount']['findOne']({'where':{'id':_0x1136b7[_0xbaa4('0x46')]['id']}})[_0xbaa4('0x21')](handleEntityNotFound(_0x68c4b5,null))[_0xbaa4('0x21')](function(_0x2358f8){if(_0x2358f8){_0x457976=_0x2358f8;_0x504432[_0xbaa4('0x2d')]=_[_0xbaa4('0x42')](db[_0xbaa4('0x48')][_0xbaa4('0x29')]);_0x504432['query']=_[_0xbaa4('0x42')](_0x1136b7[_0xbaa4('0x2a')]);_0x504432[_0xbaa4('0x2b')]=_[_0xbaa4('0x2c')](_0x504432[_0xbaa4('0x2d')],_0x504432[_0xbaa4('0x2a')]);_0xe6b68[_0xbaa4('0x2f')]=_[_0xbaa4('0x2c')](_0x504432[_0xbaa4('0x2d')],qs[_0xbaa4('0x2e')](_0x1136b7[_0xbaa4('0x2a')][_0xbaa4('0x2e')]));_0xe6b68[_0xbaa4('0x2f')]=_0xe6b68[_0xbaa4('0x2f')][_0xbaa4('0x30')]?_0xe6b68[_0xbaa4('0x2f')]:_0x504432[_0xbaa4('0x2d')];_0xe6b68[_0xbaa4('0x33')]=qs[_0xbaa4('0x34')](_0x1136b7[_0xbaa4('0x2a')][_0xbaa4('0x34')]);_0xe6b68[_0xbaa4('0x35')]=qs[_0xbaa4('0x2b')](_[_0xbaa4('0x36')](_0x1136b7[_0xbaa4('0x2a')],_0x504432['filters']));if(_0x1136b7[_0xbaa4('0x2a')][_0xbaa4('0x3a')]){_0xe6b68['where']=_[_0xbaa4('0x37')](_0xe6b68[_0xbaa4('0x35')],{'$or':_[_0xbaa4('0x27')](_0xe6b68[_0xbaa4('0x2f')],function(_0x1b7120){var _0x29b98e={};_0x29b98e[_0x1b7120]={'$like':'%'+_0x1136b7[_0xbaa4('0x2a')][_0xbaa4('0x3a')]+'%'};return _0x29b98e;})});}_0xe6b68=_[_0xbaa4('0x37')]({},_0xe6b68,_0x1136b7[_0xbaa4('0x3b')]);return _0x457976[_0xbaa4('0x47')](_0xe6b68);}})[_0xbaa4('0x21')](function(_0x38c605){if(_0x38c605){_0x52e43e=_0x38c605[_0xbaa4('0x30')];if(!_0x1136b7[_0xbaa4('0x2a')][_0xbaa4('0x31')](_0xbaa4('0x32'))){_0xe6b68[_0xbaa4('0x1a')]=qs[_0xbaa4('0x1a')](_0x1136b7[_0xbaa4('0x2a')][_0xbaa4('0x1a')]);_0xe6b68['offset']=qs[_0xbaa4('0x19')](_0x1136b7[_0xbaa4('0x2a')][_0xbaa4('0x19')]);}return _0x457976[_0xbaa4('0x47')](_0xe6b68);}})[_0xbaa4('0x21')](function(_0x339cbe){if(_0x339cbe){return _0x339cbe?{'count':_0x52e43e,'rows':_0x339cbe}:null;}})[_0xbaa4('0x21')](respondWithResult(_0x68c4b5,null))[_0xbaa4('0x40')](handleError(_0x68c4b5,null));};exports[_0xbaa4('0x49')]=function(_0x3d9e18,_0x294002,_0x559595){if(_0x3d9e18[_0xbaa4('0x45')]['id']){delete _0x3d9e18['body']['id'];}return db[_0xbaa4('0x28')][_0xbaa4('0x4a')]({'where':{'id':_0x3d9e18[_0xbaa4('0x46')]['id']}})[_0xbaa4('0x21')](handleEntityNotFound(_0x294002,null))[_0xbaa4('0x21')](function(_0x23e75a){if(_0x23e75a){_0x3d9e18[_0xbaa4('0x45')][_0xbaa4('0x4b')]=_0x23e75a['id'];_0x3d9e18[_0xbaa4('0x45')][_0xbaa4('0x4c')]=integrations[_0xbaa4('0x4d')](_0x3d9e18[_0xbaa4('0x45')][_0xbaa4('0x4e')],_0x3d9e18[_0xbaa4('0x45')][_0xbaa4('0x38')]);_0x3d9e18[_0xbaa4('0x45')][_0xbaa4('0x4f')]=integrations[_0xbaa4('0x50')](_0x3d9e18[_0xbaa4('0x45')][_0xbaa4('0x4e')],_0x3d9e18[_0xbaa4('0x45')]['type']);return db[_0xbaa4('0x48')][_0xbaa4('0x44')](_0x3d9e18[_0xbaa4('0x45')],{'include':[{'model':db[_0xbaa4('0x51')],'as':_0xbaa4('0x4c')},{'model':db[_0xbaa4('0x51')],'as':_0xbaa4('0x4f')}]});}return null;})[_0xbaa4('0x21')](respondWithResult(_0x294002,null))[_0xbaa4('0x40')](handleError(_0x294002,null));};exports[_0xbaa4('0x52')]=function(_0x4a48a8,_0x1a6d6b,_0x41b10e){var _0x576fe6;var _0x387608='';var _0x36a964=_0xbaa4('0x53');return db[_0xbaa4('0x28')][_0xbaa4('0x4a')]({'where':{'id':_0x4a48a8['params']['id']},'attributes':['id',_0xbaa4('0x54'),_0xbaa4('0x55'),_0xbaa4('0x56'),_0xbaa4('0x57'),_0xbaa4('0x58'),_0xbaa4('0x59')]})[_0xbaa4('0x21')](handleEntityNotFound(_0x1a6d6b,null))[_0xbaa4('0x21')](function(_0x531aa4){if(_0x531aa4){_0x387608=_0x531aa4[_0xbaa4('0x54')];var _0x346f7f=_0x387608[_0xbaa4('0x5a')](-0x1);if(_0x346f7f==='/'){_0x387608=_0x387608['substring'](0x0,_0x387608['lastIndexOf'](_0x346f7f));}_0x576fe6=new jsforce[(_0xbaa4('0x5b'))]({'oauth2':{'loginUrl':_0x387608,'clientId':_0x531aa4[_0xbaa4('0x55')],'clientSecret':_0x531aa4[_0xbaa4('0x56')]}});return _0x576fe6[_0xbaa4('0x5c')](_0x531aa4[_0xbaa4('0x57')],_0x531aa4[_0xbaa4('0x58')][_0xbaa4('0x5d')](_0x531aa4[_0xbaa4('0x59')]));}})[_0xbaa4('0x21')](function(_0x834d9e){if(_0x834d9e){if(!_['isNil'](_0x4a48a8['query']['ticketType'])){_0x36a964=_0x4a48a8[_0xbaa4('0x2a')]['ticketType'];}return _0x576fe6[_0xbaa4('0x5e')](_0x36a964)[_0xbaa4('0x5f')]();}})[_0xbaa4('0x21')](function(_0x5d53d9){var _0xb8d48e=[_0xbaa4('0x60'),_0xbaa4('0x61'),_0xbaa4('0x62'),_0xbaa4('0x63'),'Subject',_0xbaa4('0x64')];var _0x522f0e=[_0xbaa4('0x65'),'int',_0xbaa4('0x66'),_0xbaa4('0x67'),_0xbaa4('0x68'),_0xbaa4('0x69'),_0xbaa4('0x6a')];if(_0x5d53d9){_['remove'](_0x5d53d9[_0xbaa4('0x2e')],function(_0x3c116d){return _0xb8d48e[_0xbaa4('0x6b')](_0x3c116d[_0xbaa4('0x25')])||!_0x522f0e[_0xbaa4('0x6b')](_0x3c116d[_0xbaa4('0x38')]);});return{'count':_0x5d53d9['fields'][_0xbaa4('0x30')],'rows':_[_0xbaa4('0x27')](_0x5d53d9[_0xbaa4('0x2e')],function(_0x12ffb0){return{'id':_0x12ffb0[_0xbaa4('0x25')],'name':_0x12ffb0[_0xbaa4('0x6c')],'custom':_0x12ffb0[_0xbaa4('0x6d')],'options':_0x12ffb0[_0xbaa4('0x6e')]['length']>0x0?_[_0xbaa4('0x27')](_0x12ffb0['picklistValues'],function(_0x5f2896){return{'name':_0x5f2896[_0xbaa4('0x6c')],'value':_0x5f2896['value']};}):_0x12ffb0['type']==_0xbaa4('0x67')?[{'name':_0xbaa4('0x6f'),'value':_0xbaa4('0x70')},{'name':_0xbaa4('0x71'),'value':_0xbaa4('0x72')}]:[]};})};}})['then'](respondWithResult(_0x1a6d6b,null))[_0xbaa4('0x40')](function(_0x34c51b){var _0x26b14b=_0x4a48a8[_0xbaa4('0x2a')][_0xbaa4('0x73')]?0x1f4:_0x34c51b[_0xbaa4('0x74')]||0x1f4;logger[_0xbaa4('0x24')](_0xbaa4('0x75'),_0xbaa4('0x52'),_0x26b14b,JSON[_0xbaa4('0x76')](_0x34c51b));delete _0x34c51b[_0xbaa4('0x25')];if(_0x26b14b===0x191){_0x26b14b=0x190;}_0x1a6d6b[_0xbaa4('0x16')](_0x26b14b)[_0xbaa4('0x77')](_0x4a48a8[_0xbaa4('0x2a')][_0xbaa4('0x73')]?{'message':_0xbaa4('0x78'),'statusCode':_0x34c51b[_0xbaa4('0x74')]}:_0x34c51b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4d6c89e..a79edc6 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 _0xd52a=['rimraf','../../config/environment','./intSalesforceAccount.attributes','SalesforceAccount','util','api','moment','bluebird','path'];(function(_0x58ee96,_0x5affd5){var _0xb346aa=function(_0x245b1a){while(--_0x245b1a){_0x58ee96['push'](_0x58ee96['shift']());}};_0xb346aa(++_0x5affd5);}(_0xd52a,0xca));var _0xad52=function(_0x3c9d0c,_0x1eff4c){_0x3c9d0c=_0x3c9d0c-0x0;var _0x29791d=_0xd52a[_0x3c9d0c];return _0x29791d;};'use strict';var _=require('lodash');var util=require(_0xad52('0x0'));var logger=require('../../config/logger')(_0xad52('0x1'));var moment=require(_0xad52('0x2'));var BPromise=require(_0xad52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad52('0x4'));var rimraf=require(_0xad52('0x5'));var config=require(_0xad52('0x6'));var attributes=require(_0xad52('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x51bdaa,_0x1ad70b){return _0x51bdaa['define'](_0xad52('0x8'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5cc=['./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x25e90b,_0x23f6fc){var _0x2aeb6c=function(_0x2ff23b){while(--_0x2ff23b){_0x25e90b['push'](_0x25e90b['shift']());}};_0x2aeb6c(++_0x23f6fc);}(_0xd5cc,0xfb));var _0xcd5c=function(_0x4ba3e1,_0x4a7eec){_0x4ba3e1=_0x4ba3e1-0x0;var _0x13353d=_0xd5cc[_0x4ba3e1];return _0x13353d;};'use strict';var _=require(_0xcd5c('0x0'));var util=require(_0xcd5c('0x1'));var logger=require(_0xcd5c('0x2'))(_0xcd5c('0x3'));var moment=require(_0xcd5c('0x4'));var BPromise=require(_0xcd5c('0x5'));var rp=require(_0xcd5c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd5c('0x7'));var config=require(_0xcd5c('0x8'));var attributes=require(_0xcd5c('0x9'));var integrations=require(_0xcd5c('0xa'));module['exports']=function(_0x573214,_0x159004){return _0x573214[_0xcd5c('0xb')]('SalesforceAccount',attributes,{'tableName':_0xcd5c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index da5a5d7..e7202a1 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 _0xbbfd=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include','model','map','then','ShowSalesforceAccount','util','moment'];(function(_0x3b8bf8,_0x59e09f){var _0x481a4a=function(_0x3b6bf3){while(--_0x3b6bf3){_0x3b8bf8['push'](_0x3b8bf8['shift']());}};_0x481a4a(++_0x59e09f);}(_0xbbfd,0x86));var _0xdbbf=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xbbfd[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0xdbbf('0x0'));var moment=require(_0xdbbf('0x1'));var BPromise=require(_0xdbbf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbbf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdbbf('0x4'));var logger=require(_0xdbbf('0x5'))(_0xdbbf('0x6'));var config=require(_0xdbbf('0x7'));var jayson=require(_0xdbbf('0x8'));var client=jayson[_0xdbbf('0x9')][_0xdbbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25e686,_0x43d608,_0x183384){return new BPromise(function(_0x4ddd53,_0x7aa75c){return client[_0xdbbf('0xb')](_0x25e686,_0x183384)['then'](function(_0x14f591){logger[_0xdbbf('0xc')](_0xdbbf('0xd'),_0x43d608,_0xdbbf('0xe'));logger[_0xdbbf('0xf')](_0xdbbf('0x10'),_0x43d608,_0xdbbf('0xe'),JSON[_0xdbbf('0x11')](_0x14f591));if(_0x14f591['error']){if(_0x14f591['error'][_0xdbbf('0x12')]===0x1f4){logger[_0xdbbf('0x13')](_0xdbbf('0xd'),_0x43d608,_0x14f591['error'][_0xdbbf('0x14')]);return _0x7aa75c(_0x14f591[_0xdbbf('0x13')][_0xdbbf('0x14')]);}logger[_0xdbbf('0x13')](_0xdbbf('0xd'),_0x43d608,_0x14f591[_0xdbbf('0x13')]['message']);return _0x4ddd53(_0x14f591[_0xdbbf('0x13')]['message']);}else{logger[_0xdbbf('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x43d608,_0xdbbf('0xe'));_0x4ddd53(_0x14f591['result'][_0xdbbf('0x14')]);}})[_0xdbbf('0x15')](function(_0x51528a){logger[_0xdbbf('0x13')](_0xdbbf('0xd'),_0x43d608,_0x51528a);_0x7aa75c(_0x51528a);});});}exports[_0xdbbf('0x16')]=function(_0x4faec3){var _0x1bb79b=this;return new Promise(function(_0x4f6412,_0x539f12){return db[_0xdbbf('0x17')]['findAll']({'raw':_0x4faec3[_0xdbbf('0x18')]?_0x4faec3['options'][_0xdbbf('0x19')]===undefined?!![]:![]:!![],'where':_0x4faec3['options']?_0x4faec3[_0xdbbf('0x18')][_0xdbbf('0x1a')]||null:null,'attributes':_0x4faec3[_0xdbbf('0x18')]?_0x4faec3['options'][_0xdbbf('0x1b')]||null:null,'limit':_0x4faec3[_0xdbbf('0x18')]?_0x4faec3[_0xdbbf('0x18')][_0xdbbf('0x1c')]||null:null,'include':_0x4faec3[_0xdbbf('0x18')]?_0x4faec3[_0xdbbf('0x18')][_0xdbbf('0x1d')]?_['map'](_0x4faec3['options'][_0xdbbf('0x1d')],function(_0x1b44e){return{'model':db[_0x1b44e[_0xdbbf('0x1e')]],'as':_0x1b44e['as'],'attributes':_0x1b44e['attributes'],'include':_0x1b44e[_0xdbbf('0x1d')]?_[_0xdbbf('0x1f')](_0x1b44e[_0xdbbf('0x1d')],function(_0x31d534){return{'model':db[_0x31d534[_0xdbbf('0x1e')]],'as':_0x31d534['as'],'attributes':_0x31d534[_0xdbbf('0x1b')],'include':_0x31d534['include']?_['map'](_0x31d534['include'],function(_0x44e5d0){return{'model':db[_0x44e5d0[_0xdbbf('0x1e')]],'as':_0x44e5d0['as'],'attributes':_0x44e5d0[_0xdbbf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdbbf('0x20')](function(_0x254e81){logger[_0xdbbf('0xc')](_0xdbbf('0x16'),_0x4faec3);logger[_0xdbbf('0xf')](_0xdbbf('0x16'),_0x4faec3,JSON[_0xdbbf('0x11')](_0x254e81));_0x4f6412(_0x254e81);})[_0xdbbf('0x15')](function(_0xb0ec27){logger[_0xdbbf('0x13')](_0xdbbf('0x16'),_0xb0ec27[_0xdbbf('0x14')],_0x4faec3);_0x539f12(_0x1bb79b[_0xdbbf('0x13')](0x1f4,_0xb0ec27['message']));});});};exports[_0xdbbf('0x21')]=function(_0x410089){var _0x5d089d=this;return new Promise(function(_0x4f2c78,_0x16018d){return db['SalesforceAccount']['find']({'raw':_0x410089['options']?_0x410089[_0xdbbf('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x410089['options']?_0x410089[_0xdbbf('0x18')][_0xdbbf('0x1a')]||null:null,'attributes':_0x410089['options']?_0x410089['options'][_0xdbbf('0x1b')]||null:null,'include':_0x410089[_0xdbbf('0x18')]?_0x410089[_0xdbbf('0x18')]['include']?_[_0xdbbf('0x1f')](_0x410089[_0xdbbf('0x18')][_0xdbbf('0x1d')],function(_0x3f7aa7){return{'model':db[_0x3f7aa7['model']],'as':_0x3f7aa7['as'],'attributes':_0x3f7aa7['attributes'],'include':_0x3f7aa7[_0xdbbf('0x1d')]?_[_0xdbbf('0x1f')](_0x3f7aa7[_0xdbbf('0x1d')],function(_0xb67e6d){return{'model':db[_0xb67e6d[_0xdbbf('0x1e')]],'as':_0xb67e6d['as'],'attributes':_0xb67e6d[_0xdbbf('0x1b')],'include':_0xb67e6d[_0xdbbf('0x1d')]?_['map'](_0xb67e6d[_0xdbbf('0x1d')],function(_0x3a2f2e){return{'model':db[_0x3a2f2e[_0xdbbf('0x1e')]],'as':_0x3a2f2e['as'],'attributes':_0x3a2f2e['attributes']};}):[]};}):[]};}):[]:[]})[_0xdbbf('0x20')](function(_0x303816){logger[_0xdbbf('0xc')](_0xdbbf('0x21'),_0x410089);logger[_0xdbbf('0xf')](_0xdbbf('0x21'),_0x410089,JSON['stringify'](_0x303816));_0x4f2c78(_0x303816);})[_0xdbbf('0x15')](function(_0x21b012){logger['error'](_0xdbbf('0x21'),_0x21b012['message'],_0x410089);_0x16018d(_0x5d089d['error'](0x1f4,_0x21b012[_0xdbbf('0x14')]));});});}; \ No newline at end of file +var _0x713f=['debug','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1b91c7,_0x539acd){var _0xbbe014=function(_0x57ff15){while(--_0x57ff15){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0xbbe014(++_0x539acd);}(_0x713f,0xed));var _0xf713=function(_0x11daaf,_0x40a85d){_0x11daaf=_0x11daaf-0x0;var _0x3dfb17=_0x713f[_0x11daaf];return _0x3dfb17;};'use strict';var _=require(_0xf713('0x0'));var util=require(_0xf713('0x1'));var moment=require(_0xf713('0x2'));var BPromise=require(_0xf713('0x3'));var rs=require(_0xf713('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf713('0x5'))['db'];var utils=require(_0xf713('0x6'));var logger=require(_0xf713('0x7'))(_0xf713('0x8'));var config=require('../../config/environment');var jayson=require(_0xf713('0x9'));var client=jayson[_0xf713('0xa')][_0xf713('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e2561,_0x1c9433,_0x475e7c){return new BPromise(function(_0x469952,_0x168387){return client['request'](_0x5e2561,_0x475e7c)['then'](function(_0x3b6bac){logger[_0xf713('0xc')](_0xf713('0xd'),_0x1c9433,_0xf713('0xe'));logger[_0xf713('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1c9433,_0xf713('0xe'),JSON[_0xf713('0x10')](_0x3b6bac));if(_0x3b6bac[_0xf713('0x11')]){if(_0x3b6bac[_0xf713('0x11')][_0xf713('0x12')]===0x1f4){logger[_0xf713('0x11')](_0xf713('0xd'),_0x1c9433,_0x3b6bac[_0xf713('0x11')][_0xf713('0x13')]);return _0x168387(_0x3b6bac[_0xf713('0x11')][_0xf713('0x13')]);}logger[_0xf713('0x11')](_0xf713('0xd'),_0x1c9433,_0x3b6bac['error']['message']);return _0x469952(_0x3b6bac[_0xf713('0x11')][_0xf713('0x13')]);}else{logger[_0xf713('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x1c9433,_0xf713('0xe'));_0x469952(_0x3b6bac[_0xf713('0x14')][_0xf713('0x13')]);}})[_0xf713('0x15')](function(_0x2ebee0){logger[_0xf713('0x11')](_0xf713('0xd'),_0x1c9433,_0x2ebee0);_0x168387(_0x2ebee0);});});}exports[_0xf713('0x16')]=function(_0x202276){var _0x57ff4f=this;return new Promise(function(_0x45201f,_0x168010){return db[_0xf713('0x17')][_0xf713('0x18')]({'raw':_0x202276[_0xf713('0x19')]?_0x202276[_0xf713('0x19')][_0xf713('0x1a')]===undefined?!![]:![]:!![],'where':_0x202276['options']?_0x202276[_0xf713('0x19')][_0xf713('0x1b')]||null:null,'attributes':_0x202276['options']?_0x202276[_0xf713('0x19')]['attributes']||null:null,'limit':_0x202276['options']?_0x202276[_0xf713('0x19')][_0xf713('0x1c')]||null:null,'include':_0x202276[_0xf713('0x19')]?_0x202276[_0xf713('0x19')][_0xf713('0x1d')]?_[_0xf713('0x1e')](_0x202276[_0xf713('0x19')][_0xf713('0x1d')],function(_0x355a85){return{'model':db[_0x355a85[_0xf713('0x1f')]],'as':_0x355a85['as'],'attributes':_0x355a85[_0xf713('0x20')],'include':_0x355a85['include']?_[_0xf713('0x1e')](_0x355a85[_0xf713('0x1d')],function(_0x501511){return{'model':db[_0x501511[_0xf713('0x1f')]],'as':_0x501511['as'],'attributes':_0x501511[_0xf713('0x20')],'include':_0x501511['include']?_[_0xf713('0x1e')](_0x501511[_0xf713('0x1d')],function(_0x5a1081){return{'model':db[_0x5a1081['model']],'as':_0x5a1081['as'],'attributes':_0x5a1081[_0xf713('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf713('0x21')](function(_0x15e99d){logger[_0xf713('0xc')](_0xf713('0x16'),_0x202276);logger[_0xf713('0xf')](_0xf713('0x16'),_0x202276,JSON[_0xf713('0x10')](_0x15e99d));_0x45201f(_0x15e99d);})['catch'](function(_0x52794b){logger[_0xf713('0x11')](_0xf713('0x16'),_0x52794b['message'],_0x202276);_0x168010(_0x57ff4f[_0xf713('0x11')](0x1f4,_0x52794b['message']));});});};exports[_0xf713('0x22')]=function(_0x5f204c){var _0x2c7429=this;return new Promise(function(_0x37d72c,_0x464a11){return db[_0xf713('0x17')][_0xf713('0x23')]({'raw':_0x5f204c[_0xf713('0x19')]?_0x5f204c['options'][_0xf713('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f204c[_0xf713('0x19')]?_0x5f204c[_0xf713('0x19')]['where']||null:null,'attributes':_0x5f204c[_0xf713('0x19')]?_0x5f204c[_0xf713('0x19')][_0xf713('0x20')]||null:null,'include':_0x5f204c[_0xf713('0x19')]?_0x5f204c[_0xf713('0x19')][_0xf713('0x1d')]?_[_0xf713('0x1e')](_0x5f204c[_0xf713('0x19')]['include'],function(_0x5e9dda){return{'model':db[_0x5e9dda[_0xf713('0x1f')]],'as':_0x5e9dda['as'],'attributes':_0x5e9dda[_0xf713('0x20')],'include':_0x5e9dda[_0xf713('0x1d')]?_[_0xf713('0x1e')](_0x5e9dda['include'],function(_0x56f8a0){return{'model':db[_0x56f8a0[_0xf713('0x1f')]],'as':_0x56f8a0['as'],'attributes':_0x56f8a0[_0xf713('0x20')],'include':_0x56f8a0[_0xf713('0x1d')]?_[_0xf713('0x1e')](_0x56f8a0['include'],function(_0xcfc316){return{'model':db[_0xcfc316[_0xf713('0x1f')]],'as':_0xcfc316['as'],'attributes':_0xcfc316[_0xf713('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf713('0x21')](function(_0x5ce88c){logger[_0xf713('0xc')](_0xf713('0x22'),_0x5f204c);logger['debug'](_0xf713('0x22'),_0x5f204c,JSON[_0xf713('0x10')](_0x5ce88c));_0x37d72c(_0x5ce88c);})[_0xf713('0x15')](function(_0x4396d7){logger[_0xf713('0x11')]('ShowSalesforceAccount',_0x4396d7[_0xf713('0x13')],_0x5f204c);_0x464a11(_0x2c7429[_0xf713('0x11')](0x1f4,_0x4396d7['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f97e0b2..0a9b24b 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x148b05,_0x5ab027){var _0x5150a6=function(_0x5d7918){while(--_0x5d7918){_0x148b05['push'](_0x148b05['shift']());}};_0x5150a6(++_0x5ab027);}(_0xadb5,0xad));var _0x5adb=function(_0x1ead0f,_0x3f1b85){_0x1ead0f=_0x1ead0f-0x0;var _0x34597f=_0xadb5[_0x1ead0f];return _0x34597f;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0x12c713,_0x36343c){_0x12c713=_0x12c713-0x0;var _0x3e1ece=_0x2032[_0x12c713];return _0x3e1ece;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 4458fcc..4bcb985 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 _0x7501=['Case','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task'];(function(_0x140154,_0x82a270){var _0xb2e80b=function(_0x571776){while(--_0x571776){_0x140154['push'](_0x140154['shift']());}};_0xb2e80b(++_0x82a270);}(_0x7501,0xcc));var _0x1750=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x7501[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0x1750('0x0'));module[_0x1750('0x1')]={'name':{'type':Sequelize[_0x1750('0x2')]},'description':{'type':Sequelize[_0x1750('0x2')]},'ticketType':{'type':Sequelize[_0x1750('0x3')](_0x1750('0x4'),_0x1750('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x1750('0x3')]('contact_lead',_0x1750('0x6'),_0x1750('0x7'),_0x1750('0x8'),_0x1750('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x1750('0x3')](_0x1750('0xa'),_0x1750('0x6'),_0x1750('0x7'),'account'),'defaultValue':_0x1750('0x7')},'leadId':{'type':Sequelize[_0x1750('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x1750('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x1750('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x1750('0x2')]}}; \ No newline at end of file +var _0x185f=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x185f,0x1a4));var _0xf185=function(_0x24f988,_0x515e43){_0x24f988=_0x24f988-0x0;var _0x2377b1=_0x185f[_0x24f988];return _0x2377b1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf185('0x0')]},'ticketType':{'type':Sequelize[_0xf185('0x1')](_0xf185('0x2'),_0xf185('0x3')),'defaultValue':_0xf185('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0xf185('0x4'),_0xf185('0x5'),_0xf185('0x6'),_0xf185('0x7'),_0xf185('0x8')),'defaultValue':_0xf185('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0xf185('0x9'),_0xf185('0x5'),_0xf185('0x6'),_0xf185('0x8')),'defaultValue':_0xf185('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xf185('0x0')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xf185('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 5069f6f..b484c01 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 _0x0c92=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','getFields','pick','getSubjects','findOne','SalesforceField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','fieldName','type','key','model','map','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge'];(function(_0x17ff1a,_0x3d0102){var _0x2437b6=function(_0x1d93e0){while(--_0x1d93e0){_0x17ff1a['push'](_0x17ff1a['shift']());}};_0x2437b6(++_0x3d0102);}(_0x0c92,0x1af));var _0x20c9=function(_0x53210a,_0x4a49f1){_0x53210a=_0x53210a-0x0;var _0x82411c=_0x0c92[_0x53210a];return _0x82411c;};'use strict';var emlformat=require(_0x20c9('0x0'));var rimraf=require(_0x20c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20c9('0x2'));var rp=require(_0x20c9('0x3'));var moment=require(_0x20c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20c9('0x5'));var util=require(_0x20c9('0x6'));var path=require('path');var sox=require(_0x20c9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20c9('0x8'));var squel=require(_0x20c9('0x9'));var crypto=require(_0x20c9('0xa'));var jsforce=require(_0x20c9('0xb'));var deskjs=require(_0x20c9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x20c9('0xd'));var Papa=require(_0x20c9('0xe'));var Redis=require(_0x20c9('0xf'));var authService=require(_0x20c9('0x10'));var qs=require(_0x20c9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20c9('0x12'));var logger=require(_0x20c9('0x13'))(_0x20c9('0x14'));var utils=require(_0x20c9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x20c9('0x16'));var db=require(_0x20c9('0x17'))['db'];function respondWithStatusCode(_0xeb0446,_0x3eb8ad){_0x3eb8ad=_0x3eb8ad||0xcc;return function(_0x303810){if(_0x303810){return _0xeb0446[_0x20c9('0x18')](_0x3eb8ad);}return _0xeb0446[_0x20c9('0x19')](_0x3eb8ad)[_0x20c9('0x1a')]();};}function respondWithResult(_0x209df4,_0x11e4b9){_0x11e4b9=_0x11e4b9||0xc8;return function(_0x2a28b7){if(_0x2a28b7){return _0x209df4[_0x20c9('0x19')](_0x11e4b9)[_0x20c9('0x1b')](_0x2a28b7);}};}function respondWithFilteredResult(_0x2ec743,_0x3b7b06){return function(_0x5785a5){if(_0x5785a5){var _0x18a7ff=typeof _0x3b7b06[_0x20c9('0x1c')]===_0x20c9('0x1d')&&typeof _0x3b7b06[_0x20c9('0x1e')]===_0x20c9('0x1d');var _0xe27838=_0x5785a5[_0x20c9('0x1f')];var _0x9652e5=_0x18a7ff?0x0:_0x3b7b06['offset'];var _0x143864=_0x18a7ff?_0x5785a5['count']:_0x3b7b06['offset']+_0x3b7b06[_0x20c9('0x1e')];var _0x161ec5;if(_0x143864>=_0xe27838){_0x143864=_0xe27838;_0x161ec5=0xc8;}else{_0x161ec5=0xce;}_0x2ec743[_0x20c9('0x19')](_0x161ec5);return _0x2ec743['set'](_0x20c9('0x20'),_0x9652e5+'-'+_0x143864+'/'+_0xe27838)['json'](_0x5785a5);}return null;};}function patchUpdates(_0xd7f84f){return function(_0x1202e2){try{jsonpatch['apply'](_0x1202e2,_0xd7f84f,!![]);}catch(_0x117df4){return BPromise[_0x20c9('0x21')](_0x117df4);}return _0x1202e2[_0x20c9('0x22')]();};}function saveUpdates(_0x17eaea,_0x3aa626){return function(_0x2b95a4){if(_0x2b95a4){return _0x2b95a4[_0x20c9('0x23')](_0x17eaea)[_0x20c9('0x24')](function(_0x139ed){return _0x139ed;});}return null;};}function removeEntity(_0x323e68,_0x2b1b50){return function(_0x3c0f98){if(_0x3c0f98){return _0x3c0f98[_0x20c9('0x25')]()[_0x20c9('0x24')](function(){_0x323e68[_0x20c9('0x19')](0xcc)[_0x20c9('0x1a')]();});}};}function handleEntityNotFound(_0x3d9192,_0x6811ba){return function(_0x5c98ae){if(!_0x5c98ae){_0x3d9192[_0x20c9('0x18')](0x194);}return _0x5c98ae;};}function handleError(_0x43667f,_0x22a5e1){_0x22a5e1=_0x22a5e1||0x1f4;return function(_0x3b2581){logger[_0x20c9('0x26')](_0x3b2581[_0x20c9('0x27')]);if(_0x3b2581['name']){delete _0x3b2581[_0x20c9('0x28')];}_0x43667f[_0x20c9('0x19')](_0x22a5e1)[_0x20c9('0x29')](_0x3b2581);};}exports[_0x20c9('0x2a')]=function(_0x5ad06e,_0x17c734){var _0x365b15={},_0x1566be={},_0x12da76={'count':0x0,'rows':[]};var _0x110e5d=_['map'](db[_0x20c9('0x2b')]['rawAttributes'],function(_0x3f3d8d){return{'name':_0x3f3d8d[_0x20c9('0x2c')],'type':_0x3f3d8d[_0x20c9('0x2d')][_0x20c9('0x2e')]};});_0x1566be[_0x20c9('0x2f')]=_[_0x20c9('0x30')](_0x110e5d,_0x20c9('0x28'));_0x1566be['query']=_['keys'](_0x5ad06e['query']);_0x1566be['filters']=_[_0x20c9('0x31')](_0x1566be[_0x20c9('0x2f')],_0x1566be[_0x20c9('0x32')]);_0x365b15[_0x20c9('0x33')]=_[_0x20c9('0x31')](_0x1566be[_0x20c9('0x2f')],qs[_0x20c9('0x34')](_0x5ad06e[_0x20c9('0x32')][_0x20c9('0x34')]));_0x365b15[_0x20c9('0x33')]=_0x365b15[_0x20c9('0x33')]['length']?_0x365b15['attributes']:_0x1566be['model'];if(!_0x5ad06e['query'][_0x20c9('0x35')](_0x20c9('0x36'))){_0x365b15[_0x20c9('0x1e')]=qs[_0x20c9('0x1e')](_0x5ad06e[_0x20c9('0x32')][_0x20c9('0x1e')]);_0x365b15[_0x20c9('0x1c')]=qs[_0x20c9('0x1c')](_0x5ad06e['query'][_0x20c9('0x1c')]);}_0x365b15[_0x20c9('0x37')]=qs[_0x20c9('0x38')](_0x5ad06e[_0x20c9('0x32')][_0x20c9('0x38')]);_0x365b15[_0x20c9('0x39')]=qs['filters'](_['pick'](_0x5ad06e[_0x20c9('0x32')],_0x1566be[_0x20c9('0x3a')]),_0x110e5d);if(_0x5ad06e['query'][_0x20c9('0x3b')]){_0x365b15['where']=_[_0x20c9('0x3c')](_0x365b15[_0x20c9('0x39')],{'$or':_[_0x20c9('0x30')](_0x110e5d,function(_0x5c5b86){if(_0x5c5b86[_0x20c9('0x2d')]!==_0x20c9('0x3d')){var _0xe5fd1e={};_0xe5fd1e[_0x5c5b86[_0x20c9('0x28')]]={'$like':'%'+_0x5ad06e[_0x20c9('0x32')]['filter']+'%'};return _0xe5fd1e;}})});}_0x365b15=_[_0x20c9('0x3c')]({},_0x365b15,_0x5ad06e[_0x20c9('0x3e')]);var _0x3c6d57={'where':_0x365b15[_0x20c9('0x39')]};return db[_0x20c9('0x2b')][_0x20c9('0x1f')](_0x3c6d57)['then'](function(_0xd81280){_0x12da76[_0x20c9('0x1f')]=_0xd81280;if(_0x5ad06e[_0x20c9('0x32')][_0x20c9('0x3f')]){_0x365b15[_0x20c9('0x40')]=[{'all':!![]}];}return db[_0x20c9('0x2b')][_0x20c9('0x41')](_0x365b15);})[_0x20c9('0x24')](function(_0x9cbda7){_0x12da76[_0x20c9('0x42')]=_0x9cbda7;return _0x12da76;})[_0x20c9('0x24')](respondWithFilteredResult(_0x17c734,_0x365b15))[_0x20c9('0x43')](handleError(_0x17c734,null));};exports[_0x20c9('0x44')]=function(_0x49ffcd,_0xd46028){var _0xb9933a={'raw':![],'where':{'id':_0x49ffcd[_0x20c9('0x45')]['id']}},_0x1e0bfb={};_0x1e0bfb[_0x20c9('0x2f')]=_[_0x20c9('0x46')](db[_0x20c9('0x2b')][_0x20c9('0x47')]);_0x1e0bfb['query']=_[_0x20c9('0x46')](_0x49ffcd[_0x20c9('0x32')]);_0x1e0bfb[_0x20c9('0x3a')]=_['intersection'](_0x1e0bfb[_0x20c9('0x2f')],_0x1e0bfb[_0x20c9('0x32')]);_0xb9933a[_0x20c9('0x33')]=_[_0x20c9('0x31')](_0x1e0bfb[_0x20c9('0x2f')],qs[_0x20c9('0x34')](_0x49ffcd['query'][_0x20c9('0x34')]));_0xb9933a[_0x20c9('0x33')]=_0xb9933a[_0x20c9('0x33')][_0x20c9('0x48')]?_0xb9933a[_0x20c9('0x33')]:_0x1e0bfb['model'];if(_0x49ffcd['query'][_0x20c9('0x3f')]){_0xb9933a[_0x20c9('0x40')]=[{'all':!![]}];}_0xb9933a=_[_0x20c9('0x3c')]({},_0xb9933a,_0x49ffcd['options']);return db[_0x20c9('0x2b')][_0x20c9('0x49')](_0xb9933a)[_0x20c9('0x24')](handleEntityNotFound(_0xd46028,null))['then'](respondWithResult(_0xd46028,null))[_0x20c9('0x43')](handleError(_0xd46028,null));};exports[_0x20c9('0x4a')]=function(_0x2df337,_0x4c2a1d){return db['SalesforceConfiguration'][_0x20c9('0x4a')](_0x2df337[_0x20c9('0x4b')],{})[_0x20c9('0x24')](respondWithResult(_0x4c2a1d,0xc9))[_0x20c9('0x43')](handleError(_0x4c2a1d,null));};exports[_0x20c9('0x23')]=function(_0x593739,_0x4a4b6b){if(_0x593739[_0x20c9('0x4b')]['id']){delete _0x593739[_0x20c9('0x4b')]['id'];}return db[_0x20c9('0x2b')][_0x20c9('0x49')]({'where':{'id':_0x593739[_0x20c9('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a4b6b,null))[_0x20c9('0x24')](saveUpdates(_0x593739[_0x20c9('0x4b')],null))[_0x20c9('0x24')](respondWithResult(_0x4a4b6b,null))['catch'](handleError(_0x4a4b6b,null));};exports[_0x20c9('0x25')]=function(_0x715792,_0x1e865a){return db['SalesforceConfiguration'][_0x20c9('0x49')]({'where':{'id':_0x715792[_0x20c9('0x45')]['id']}})[_0x20c9('0x24')](handleEntityNotFound(_0x1e865a,null))[_0x20c9('0x24')](removeEntity(_0x1e865a,null))[_0x20c9('0x43')](handleError(_0x1e865a,null));};exports[_0x20c9('0x4c')]=function(_0x17132e,_0x55e51f,_0x14ca1c){var _0x1ab707={};var _0x27ff22={};var _0x7ba981;var _0x3be063;return db[_0x20c9('0x2b')]['findOne']({'where':{'id':_0x17132e[_0x20c9('0x45')]['id']}})['then'](handleEntityNotFound(_0x55e51f,null))[_0x20c9('0x24')](function(_0x56ac26){if(_0x56ac26){_0x7ba981=_0x56ac26;_0x27ff22[_0x20c9('0x2f')]=_[_0x20c9('0x46')](db['SalesforceField'][_0x20c9('0x47')]);_0x27ff22['query']=_[_0x20c9('0x46')](_0x17132e[_0x20c9('0x32')]);_0x27ff22['filters']=_[_0x20c9('0x31')](_0x27ff22[_0x20c9('0x2f')],_0x27ff22[_0x20c9('0x32')]);_0x1ab707['attributes']=_[_0x20c9('0x31')](_0x27ff22['model'],qs[_0x20c9('0x34')](_0x17132e['query'][_0x20c9('0x34')]));_0x1ab707[_0x20c9('0x33')]=_0x1ab707[_0x20c9('0x33')]['length']?_0x1ab707[_0x20c9('0x33')]:_0x27ff22[_0x20c9('0x2f')];_0x1ab707[_0x20c9('0x37')]=qs[_0x20c9('0x38')](_0x17132e['query'][_0x20c9('0x38')]);_0x1ab707['where']=qs[_0x20c9('0x3a')](_[_0x20c9('0x4d')](_0x17132e[_0x20c9('0x32')],_0x27ff22['filters']));if(_0x17132e[_0x20c9('0x32')]['filter']){_0x1ab707[_0x20c9('0x39')]=_['merge'](_0x1ab707[_0x20c9('0x39')],{'$or':_['map'](_0x1ab707[_0x20c9('0x33')],function(_0x1c272f){var _0x36e751={};_0x36e751[_0x1c272f]={'$like':'%'+_0x17132e[_0x20c9('0x32')][_0x20c9('0x3b')]+'%'};return _0x36e751;})});}_0x1ab707=_[_0x20c9('0x3c')]({},_0x1ab707,_0x17132e['options']);return _0x7ba981[_0x20c9('0x4c')](_0x1ab707);}})[_0x20c9('0x24')](function(_0x5a75af){if(_0x5a75af){_0x3be063=_0x5a75af[_0x20c9('0x48')];if(!_0x17132e[_0x20c9('0x32')][_0x20c9('0x35')](_0x20c9('0x36'))){_0x1ab707[_0x20c9('0x1e')]=qs[_0x20c9('0x1e')](_0x17132e[_0x20c9('0x32')][_0x20c9('0x1e')]);_0x1ab707[_0x20c9('0x1c')]=qs[_0x20c9('0x1c')](_0x17132e[_0x20c9('0x32')][_0x20c9('0x1c')]);}return _0x7ba981['getFields'](_0x1ab707);}})[_0x20c9('0x24')](function(_0x445cd2){if(_0x445cd2){return _0x445cd2?{'count':_0x3be063,'rows':_0x445cd2}:null;}})['then'](respondWithResult(_0x55e51f,null))[_0x20c9('0x43')](handleError(_0x55e51f,null));};exports[_0x20c9('0x4e')]=function(_0x3cdf33,_0x58c9f8,_0x539041){var _0x28f67c={};var _0x4a4e41={};var _0x482794;var _0x5787bb;return db[_0x20c9('0x2b')][_0x20c9('0x4f')]({'where':{'id':_0x3cdf33[_0x20c9('0x45')]['id']}})[_0x20c9('0x24')](handleEntityNotFound(_0x58c9f8,null))[_0x20c9('0x24')](function(_0xcef66a){if(_0xcef66a){_0x482794=_0xcef66a;_0x4a4e41[_0x20c9('0x2f')]=_[_0x20c9('0x46')](db[_0x20c9('0x50')][_0x20c9('0x47')]);_0x4a4e41['query']=_[_0x20c9('0x46')](_0x3cdf33['query']);_0x4a4e41[_0x20c9('0x3a')]=_[_0x20c9('0x31')](_0x4a4e41['model'],_0x4a4e41[_0x20c9('0x32')]);_0x28f67c[_0x20c9('0x33')]=_['intersection'](_0x4a4e41[_0x20c9('0x2f')],qs[_0x20c9('0x34')](_0x3cdf33['query'][_0x20c9('0x34')]));_0x28f67c[_0x20c9('0x33')]=_0x28f67c['attributes'][_0x20c9('0x48')]?_0x28f67c[_0x20c9('0x33')]:_0x4a4e41['model'];_0x28f67c[_0x20c9('0x37')]=qs[_0x20c9('0x38')](_0x3cdf33['query']['sort']);_0x28f67c[_0x20c9('0x39')]=qs[_0x20c9('0x3a')](_[_0x20c9('0x4d')](_0x3cdf33[_0x20c9('0x32')],_0x4a4e41[_0x20c9('0x3a')]));if(_0x3cdf33[_0x20c9('0x32')][_0x20c9('0x3b')]){_0x28f67c[_0x20c9('0x39')]=_[_0x20c9('0x3c')](_0x28f67c[_0x20c9('0x39')],{'$or':_[_0x20c9('0x30')](_0x28f67c[_0x20c9('0x33')],function(_0x5e219e){var _0x193ad7={};_0x193ad7[_0x5e219e]={'$like':'%'+_0x3cdf33['query'][_0x20c9('0x3b')]+'%'};return _0x193ad7;})});}_0x28f67c=_['merge']({},_0x28f67c,_0x3cdf33[_0x20c9('0x3e')]);return _0x482794[_0x20c9('0x4e')](_0x28f67c);}})['then'](function(_0x2e2c91){if(_0x2e2c91){_0x5787bb=_0x2e2c91['length'];if(!_0x3cdf33[_0x20c9('0x32')][_0x20c9('0x35')]('nolimit')){_0x28f67c[_0x20c9('0x1e')]=qs['limit'](_0x3cdf33[_0x20c9('0x32')]['limit']);_0x28f67c['offset']=qs[_0x20c9('0x1c')](_0x3cdf33[_0x20c9('0x32')][_0x20c9('0x1c')]);}return _0x482794['getSubjects'](_0x28f67c);}})[_0x20c9('0x24')](function(_0x1c472b){if(_0x1c472b){return _0x1c472b?{'count':_0x5787bb,'rows':_0x1c472b}:null;}})['then'](respondWithResult(_0x58c9f8,null))[_0x20c9('0x43')](handleError(_0x58c9f8,null));};exports[_0x20c9('0x51')]=function(_0x4d598e,_0x4a566d,_0x65287e){var _0x7f8d96={};var _0x9d3f88={};var _0x50b7e9;var _0x2159ff;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4d598e[_0x20c9('0x45')]['id']}})[_0x20c9('0x24')](handleEntityNotFound(_0x4a566d,null))[_0x20c9('0x24')](function(_0x3c7145){if(_0x3c7145){_0x50b7e9=_0x3c7145;_0x9d3f88['model']=_[_0x20c9('0x46')](db[_0x20c9('0x50')][_0x20c9('0x47')]);_0x9d3f88[_0x20c9('0x32')]=_[_0x20c9('0x46')](_0x4d598e['query']);_0x9d3f88[_0x20c9('0x3a')]=_['intersection'](_0x9d3f88[_0x20c9('0x2f')],_0x9d3f88[_0x20c9('0x32')]);_0x7f8d96[_0x20c9('0x33')]=_[_0x20c9('0x31')](_0x9d3f88[_0x20c9('0x2f')],qs[_0x20c9('0x34')](_0x4d598e[_0x20c9('0x32')][_0x20c9('0x34')]));_0x7f8d96[_0x20c9('0x33')]=_0x7f8d96[_0x20c9('0x33')][_0x20c9('0x48')]?_0x7f8d96[_0x20c9('0x33')]:_0x9d3f88[_0x20c9('0x2f')];_0x7f8d96[_0x20c9('0x37')]=qs['sort'](_0x4d598e[_0x20c9('0x32')][_0x20c9('0x38')]);_0x7f8d96[_0x20c9('0x39')]=qs[_0x20c9('0x3a')](_[_0x20c9('0x4d')](_0x4d598e[_0x20c9('0x32')],_0x9d3f88['filters']));if(_0x4d598e['query'][_0x20c9('0x3b')]){_0x7f8d96[_0x20c9('0x39')]=_[_0x20c9('0x3c')](_0x7f8d96[_0x20c9('0x39')],{'$or':_['map'](_0x7f8d96[_0x20c9('0x33')],function(_0x1b29fd){var _0x5d5619={};_0x5d5619[_0x1b29fd]={'$like':'%'+_0x4d598e['query'][_0x20c9('0x3b')]+'%'};return _0x5d5619;})});}_0x7f8d96=_[_0x20c9('0x3c')]({},_0x7f8d96,_0x4d598e[_0x20c9('0x3e')]);return _0x50b7e9['getDescriptions'](_0x7f8d96);}})['then'](function(_0x217a5a){if(_0x217a5a){_0x2159ff=_0x217a5a['length'];if(!_0x4d598e[_0x20c9('0x32')]['hasOwnProperty'](_0x20c9('0x36'))){_0x7f8d96[_0x20c9('0x1e')]=qs[_0x20c9('0x1e')](_0x4d598e[_0x20c9('0x32')][_0x20c9('0x1e')]);_0x7f8d96[_0x20c9('0x1c')]=qs[_0x20c9('0x1c')](_0x4d598e[_0x20c9('0x32')][_0x20c9('0x1c')]);}return _0x50b7e9[_0x20c9('0x51')](_0x7f8d96);}})[_0x20c9('0x24')](function(_0x544601){if(_0x544601){return _0x544601?{'count':_0x2159ff,'rows':_0x544601}:null;}})['then'](respondWithResult(_0x4a566d,null))[_0x20c9('0x43')](handleError(_0x4a566d,null));}; \ No newline at end of file +var _0xed23=['json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','show','includeAll','options','find','create','body','catch','destroy','getFields','findOne','params','SalesforceField','length','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end'];(function(_0x28f99c,_0xfdc16c){var _0x423678=function(_0x4b55c4){while(--_0x4b55c4){_0x28f99c['push'](_0x28f99c['shift']());}};_0x423678(++_0xfdc16c);}(_0xed23,0x172));var _0x3ed2=function(_0x21eaff,_0x329825){_0x21eaff=_0x21eaff-0x0;var _0x5ac009=_0xed23[_0x21eaff];return _0x5ac009;};'use strict';var emlformat=require(_0x3ed2('0x0'));var rimraf=require(_0x3ed2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ed2('0x2'));var rp=require(_0x3ed2('0x3'));var moment=require('moment');var BPromise=require(_0x3ed2('0x4'));var Mustache=require(_0x3ed2('0x5'));var util=require(_0x3ed2('0x6'));var path=require('path');var sox=require(_0x3ed2('0x7'));var csv=require(_0x3ed2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ed2('0x9'));var _=require(_0x3ed2('0xa'));var squel=require(_0x3ed2('0xb'));var crypto=require('crypto');var jsforce=require(_0x3ed2('0xc'));var deskjs=require(_0x3ed2('0xd'));var toCsv=require(_0x3ed2('0x8'));var querystring=require(_0x3ed2('0xe'));var Papa=require('papaparse');var Redis=require(_0x3ed2('0xf'));var authService=require(_0x3ed2('0x10'));var qs=require(_0x3ed2('0x11'));var as=require(_0x3ed2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ed2('0x13'))(_0x3ed2('0x14'));var utils=require('../../config/utils');var config=require(_0x3ed2('0x15'));var licenseUtil=require(_0x3ed2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d7c1e,_0x46f308){_0x46f308=_0x46f308||0xcc;return function(_0x473aff){if(_0x473aff){return _0x4d7c1e['sendStatus'](_0x46f308);}return _0x4d7c1e[_0x3ed2('0x17')](_0x46f308)[_0x3ed2('0x18')]();};}function respondWithResult(_0x155e1e,_0xf10005){_0xf10005=_0xf10005||0xc8;return function(_0x48de98){if(_0x48de98){return _0x155e1e['status'](_0xf10005)[_0x3ed2('0x19')](_0x48de98);}};}function respondWithFilteredResult(_0x54f9ac,_0x3878ff){return function(_0x3e5d39){if(_0x3e5d39){var _0x1a69df=typeof _0x3878ff['offset']===_0x3ed2('0x1a')&&typeof _0x3878ff[_0x3ed2('0x1b')]==='undefined';var _0x463448=_0x3e5d39['count'];var _0x96d818=_0x1a69df?0x0:_0x3878ff[_0x3ed2('0x1c')];var _0x3cc3d9=_0x1a69df?_0x3e5d39[_0x3ed2('0x1d')]:_0x3878ff[_0x3ed2('0x1c')]+_0x3878ff['limit'];var _0x164ab2;if(_0x3cc3d9>=_0x463448){_0x3cc3d9=_0x463448;_0x164ab2=0xc8;}else{_0x164ab2=0xce;}_0x54f9ac[_0x3ed2('0x17')](_0x164ab2);return _0x54f9ac['set'](_0x3ed2('0x1e'),_0x96d818+'-'+_0x3cc3d9+'/'+_0x463448)[_0x3ed2('0x19')](_0x3e5d39);}return null;};}function patchUpdates(_0x28c2fb){return function(_0x30af6e){try{jsonpatch[_0x3ed2('0x1f')](_0x30af6e,_0x28c2fb,!![]);}catch(_0x29d2a5){return BPromise[_0x3ed2('0x20')](_0x29d2a5);}return _0x30af6e[_0x3ed2('0x21')]();};}function saveUpdates(_0x38d7e2,_0x199b62){return function(_0x172f8a){if(_0x172f8a){return _0x172f8a['update'](_0x38d7e2)['then'](function(_0x1ae760){return _0x1ae760;});}return null;};}function removeEntity(_0x187097,_0x5df78e){return function(_0x3873c5){if(_0x3873c5){return _0x3873c5['destroy']()[_0x3ed2('0x22')](function(){_0x187097[_0x3ed2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x138ec8,_0x411c5f){return function(_0x77925e){if(!_0x77925e){_0x138ec8[_0x3ed2('0x23')](0x194);}return _0x77925e;};}function handleError(_0xc112d7,_0x13d04e){_0x13d04e=_0x13d04e||0x1f4;return function(_0x5f482c){logger[_0x3ed2('0x24')](_0x5f482c['stack']);if(_0x5f482c['name']){delete _0x5f482c[_0x3ed2('0x25')];}_0xc112d7['status'](_0x13d04e)[_0x3ed2('0x26')](_0x5f482c);};}exports[_0x3ed2('0x27')]=function(_0x1eddda,_0x29e131){var _0x26b7d7={},_0x1c5d47={},_0x5e558e={'count':0x0,'rows':[]};var _0x4edd42=_[_0x3ed2('0x28')](db[_0x3ed2('0x29')][_0x3ed2('0x2a')],function(_0x1480bb){return{'name':_0x1480bb[_0x3ed2('0x2b')],'type':_0x1480bb['type'][_0x3ed2('0x2c')]};});_0x1c5d47['model']=_[_0x3ed2('0x28')](_0x4edd42,_0x3ed2('0x25'));_0x1c5d47['query']=_[_0x3ed2('0x2d')](_0x1eddda['query']);_0x1c5d47[_0x3ed2('0x2e')]=_[_0x3ed2('0x2f')](_0x1c5d47[_0x3ed2('0x30')],_0x1c5d47['query']);_0x26b7d7['attributes']=_[_0x3ed2('0x2f')](_0x1c5d47[_0x3ed2('0x30')],qs['fields'](_0x1eddda[_0x3ed2('0x31')][_0x3ed2('0x32')]));_0x26b7d7[_0x3ed2('0x33')]=_0x26b7d7[_0x3ed2('0x33')]['length']?_0x26b7d7[_0x3ed2('0x33')]:_0x1c5d47[_0x3ed2('0x30')];if(!_0x1eddda['query'][_0x3ed2('0x34')](_0x3ed2('0x35'))){_0x26b7d7[_0x3ed2('0x1b')]=qs['limit'](_0x1eddda[_0x3ed2('0x31')]['limit']);_0x26b7d7['offset']=qs[_0x3ed2('0x1c')](_0x1eddda[_0x3ed2('0x31')][_0x3ed2('0x1c')]);}_0x26b7d7[_0x3ed2('0x36')]=qs[_0x3ed2('0x37')](_0x1eddda['query'][_0x3ed2('0x37')]);_0x26b7d7[_0x3ed2('0x38')]=qs[_0x3ed2('0x2e')](_[_0x3ed2('0x39')](_0x1eddda[_0x3ed2('0x31')],_0x1c5d47[_0x3ed2('0x2e')]),_0x4edd42);if(_0x1eddda['query'][_0x3ed2('0x3a')]){_0x26b7d7[_0x3ed2('0x38')]=_[_0x3ed2('0x3b')](_0x26b7d7[_0x3ed2('0x38')],{'$or':_[_0x3ed2('0x28')](_0x4edd42,function(_0x5ec9a1){if(_0x5ec9a1[_0x3ed2('0x3c')]!==_0x3ed2('0x3d')){var _0x373eb1={};_0x373eb1[_0x5ec9a1[_0x3ed2('0x25')]]={'$like':'%'+_0x1eddda['query'][_0x3ed2('0x3a')]+'%'};return _0x373eb1;}})});}_0x26b7d7=_[_0x3ed2('0x3b')]({},_0x26b7d7,_0x1eddda['options']);var _0x3ab47c={'where':_0x26b7d7['where']};return db[_0x3ed2('0x29')][_0x3ed2('0x1d')](_0x3ab47c)[_0x3ed2('0x22')](function(_0x457286){_0x5e558e[_0x3ed2('0x1d')]=_0x457286;if(_0x1eddda[_0x3ed2('0x31')]['includeAll']){_0x26b7d7[_0x3ed2('0x3e')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x3ed2('0x3f')](_0x26b7d7);})[_0x3ed2('0x22')](function(_0x258d9d){_0x5e558e['rows']=_0x258d9d;return _0x5e558e;})[_0x3ed2('0x22')](respondWithFilteredResult(_0x29e131,_0x26b7d7))['catch'](handleError(_0x29e131,null));};exports[_0x3ed2('0x40')]=function(_0x25caf0,_0x43d409){var _0x5e9457={'raw':![],'where':{'id':_0x25caf0['params']['id']}},_0x283a87={};_0x283a87[_0x3ed2('0x30')]=_[_0x3ed2('0x2d')](db[_0x3ed2('0x29')][_0x3ed2('0x2a')]);_0x283a87[_0x3ed2('0x31')]=_[_0x3ed2('0x2d')](_0x25caf0[_0x3ed2('0x31')]);_0x283a87[_0x3ed2('0x2e')]=_[_0x3ed2('0x2f')](_0x283a87[_0x3ed2('0x30')],_0x283a87[_0x3ed2('0x31')]);_0x5e9457[_0x3ed2('0x33')]=_[_0x3ed2('0x2f')](_0x283a87[_0x3ed2('0x30')],qs[_0x3ed2('0x32')](_0x25caf0[_0x3ed2('0x31')][_0x3ed2('0x32')]));_0x5e9457[_0x3ed2('0x33')]=_0x5e9457[_0x3ed2('0x33')]['length']?_0x5e9457['attributes']:_0x283a87['model'];if(_0x25caf0[_0x3ed2('0x31')][_0x3ed2('0x41')]){_0x5e9457[_0x3ed2('0x3e')]=[{'all':!![]}];}_0x5e9457=_[_0x3ed2('0x3b')]({},_0x5e9457,_0x25caf0[_0x3ed2('0x42')]);return db[_0x3ed2('0x29')][_0x3ed2('0x43')](_0x5e9457)['then'](handleEntityNotFound(_0x43d409,null))['then'](respondWithResult(_0x43d409,null))['catch'](handleError(_0x43d409,null));};exports[_0x3ed2('0x44')]=function(_0x1a25a0,_0x4de105){return db[_0x3ed2('0x29')][_0x3ed2('0x44')](_0x1a25a0[_0x3ed2('0x45')],{})[_0x3ed2('0x22')](respondWithResult(_0x4de105,0xc9))[_0x3ed2('0x46')](handleError(_0x4de105,null));};exports['update']=function(_0x595bf8,_0x2c53b2){if(_0x595bf8[_0x3ed2('0x45')]['id']){delete _0x595bf8[_0x3ed2('0x45')]['id'];}return db[_0x3ed2('0x29')][_0x3ed2('0x43')]({'where':{'id':_0x595bf8['params']['id']}})[_0x3ed2('0x22')](handleEntityNotFound(_0x2c53b2,null))[_0x3ed2('0x22')](saveUpdates(_0x595bf8[_0x3ed2('0x45')],null))[_0x3ed2('0x22')](respondWithResult(_0x2c53b2,null))[_0x3ed2('0x46')](handleError(_0x2c53b2,null));};exports[_0x3ed2('0x47')]=function(_0x429822,_0x466a63){return db[_0x3ed2('0x29')][_0x3ed2('0x43')]({'where':{'id':_0x429822['params']['id']}})[_0x3ed2('0x22')](handleEntityNotFound(_0x466a63,null))['then'](removeEntity(_0x466a63,null))[_0x3ed2('0x46')](handleError(_0x466a63,null));};exports[_0x3ed2('0x48')]=function(_0x29ee3e,_0x1f202f,_0x4e60d7){var _0x1ddd53={};var _0x1bbe5e={};var _0x110368;var _0x2bcfe9;return db[_0x3ed2('0x29')][_0x3ed2('0x49')]({'where':{'id':_0x29ee3e[_0x3ed2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f202f,null))['then'](function(_0x55043d){if(_0x55043d){_0x110368=_0x55043d;_0x1bbe5e['model']=_[_0x3ed2('0x2d')](db[_0x3ed2('0x4b')][_0x3ed2('0x2a')]);_0x1bbe5e[_0x3ed2('0x31')]=_['keys'](_0x29ee3e[_0x3ed2('0x31')]);_0x1bbe5e['filters']=_[_0x3ed2('0x2f')](_0x1bbe5e[_0x3ed2('0x30')],_0x1bbe5e['query']);_0x1ddd53['attributes']=_[_0x3ed2('0x2f')](_0x1bbe5e[_0x3ed2('0x30')],qs[_0x3ed2('0x32')](_0x29ee3e[_0x3ed2('0x31')][_0x3ed2('0x32')]));_0x1ddd53[_0x3ed2('0x33')]=_0x1ddd53[_0x3ed2('0x33')][_0x3ed2('0x4c')]?_0x1ddd53[_0x3ed2('0x33')]:_0x1bbe5e['model'];_0x1ddd53[_0x3ed2('0x36')]=qs[_0x3ed2('0x37')](_0x29ee3e[_0x3ed2('0x31')][_0x3ed2('0x37')]);_0x1ddd53[_0x3ed2('0x38')]=qs[_0x3ed2('0x2e')](_[_0x3ed2('0x39')](_0x29ee3e['query'],_0x1bbe5e[_0x3ed2('0x2e')]));if(_0x29ee3e[_0x3ed2('0x31')][_0x3ed2('0x3a')]){_0x1ddd53[_0x3ed2('0x38')]=_['merge'](_0x1ddd53['where'],{'$or':_['map'](_0x1ddd53[_0x3ed2('0x33')],function(_0x5ee20a){var _0x46f1c1={};_0x46f1c1[_0x5ee20a]={'$like':'%'+_0x29ee3e[_0x3ed2('0x31')][_0x3ed2('0x3a')]+'%'};return _0x46f1c1;})});}_0x1ddd53=_[_0x3ed2('0x3b')]({},_0x1ddd53,_0x29ee3e[_0x3ed2('0x42')]);return _0x110368[_0x3ed2('0x48')](_0x1ddd53);}})['then'](function(_0x4d92e3){if(_0x4d92e3){_0x2bcfe9=_0x4d92e3[_0x3ed2('0x4c')];if(!_0x29ee3e['query']['hasOwnProperty'](_0x3ed2('0x35'))){_0x1ddd53[_0x3ed2('0x1b')]=qs[_0x3ed2('0x1b')](_0x29ee3e[_0x3ed2('0x31')][_0x3ed2('0x1b')]);_0x1ddd53['offset']=qs[_0x3ed2('0x1c')](_0x29ee3e['query'][_0x3ed2('0x1c')]);}return _0x110368['getFields'](_0x1ddd53);}})['then'](function(_0x23712e){if(_0x23712e){return _0x23712e?{'count':_0x2bcfe9,'rows':_0x23712e}:null;}})[_0x3ed2('0x22')](respondWithResult(_0x1f202f,null))[_0x3ed2('0x46')](handleError(_0x1f202f,null));};exports[_0x3ed2('0x4d')]=function(_0x464a8f,_0x1f3427,_0x1c26df){var _0x3cec46={};var _0x3c2c08={};var _0x53b611;var _0x4d76eb;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x464a8f[_0x3ed2('0x4a')]['id']}})[_0x3ed2('0x22')](handleEntityNotFound(_0x1f3427,null))['then'](function(_0x2c1982){if(_0x2c1982){_0x53b611=_0x2c1982;_0x3c2c08[_0x3ed2('0x30')]=_[_0x3ed2('0x2d')](db[_0x3ed2('0x4b')][_0x3ed2('0x2a')]);_0x3c2c08[_0x3ed2('0x31')]=_[_0x3ed2('0x2d')](_0x464a8f[_0x3ed2('0x31')]);_0x3c2c08[_0x3ed2('0x2e')]=_['intersection'](_0x3c2c08[_0x3ed2('0x30')],_0x3c2c08['query']);_0x3cec46[_0x3ed2('0x33')]=_['intersection'](_0x3c2c08[_0x3ed2('0x30')],qs['fields'](_0x464a8f[_0x3ed2('0x31')][_0x3ed2('0x32')]));_0x3cec46[_0x3ed2('0x33')]=_0x3cec46[_0x3ed2('0x33')]['length']?_0x3cec46[_0x3ed2('0x33')]:_0x3c2c08[_0x3ed2('0x30')];_0x3cec46[_0x3ed2('0x36')]=qs['sort'](_0x464a8f['query'][_0x3ed2('0x37')]);_0x3cec46[_0x3ed2('0x38')]=qs[_0x3ed2('0x2e')](_['pick'](_0x464a8f['query'],_0x3c2c08['filters']));if(_0x464a8f[_0x3ed2('0x31')][_0x3ed2('0x3a')]){_0x3cec46[_0x3ed2('0x38')]=_[_0x3ed2('0x3b')](_0x3cec46['where'],{'$or':_[_0x3ed2('0x28')](_0x3cec46[_0x3ed2('0x33')],function(_0x21e7f2){var _0x36c525={};_0x36c525[_0x21e7f2]={'$like':'%'+_0x464a8f['query'][_0x3ed2('0x3a')]+'%'};return _0x36c525;})});}_0x3cec46=_[_0x3ed2('0x3b')]({},_0x3cec46,_0x464a8f[_0x3ed2('0x42')]);return _0x53b611[_0x3ed2('0x4d')](_0x3cec46);}})[_0x3ed2('0x22')](function(_0x2c5bfa){if(_0x2c5bfa){_0x4d76eb=_0x2c5bfa[_0x3ed2('0x4c')];if(!_0x464a8f[_0x3ed2('0x31')][_0x3ed2('0x34')](_0x3ed2('0x35'))){_0x3cec46[_0x3ed2('0x1b')]=qs[_0x3ed2('0x1b')](_0x464a8f[_0x3ed2('0x31')][_0x3ed2('0x1b')]);_0x3cec46[_0x3ed2('0x1c')]=qs[_0x3ed2('0x1c')](_0x464a8f[_0x3ed2('0x31')][_0x3ed2('0x1c')]);}return _0x53b611['getSubjects'](_0x3cec46);}})[_0x3ed2('0x22')](function(_0x6d139a){if(_0x6d139a){return _0x6d139a?{'count':_0x4d76eb,'rows':_0x6d139a}:null;}})[_0x3ed2('0x22')](respondWithResult(_0x1f3427,null))[_0x3ed2('0x46')](handleError(_0x1f3427,null));};exports[_0x3ed2('0x4e')]=function(_0x1f6fea,_0x21018f,_0xf70180){var _0x3a1a58={};var _0x1f8487={};var _0x2e5be2;var _0x5d5231;return db[_0x3ed2('0x29')][_0x3ed2('0x49')]({'where':{'id':_0x1f6fea[_0x3ed2('0x4a')]['id']}})[_0x3ed2('0x22')](handleEntityNotFound(_0x21018f,null))['then'](function(_0x35d9a3){if(_0x35d9a3){_0x2e5be2=_0x35d9a3;_0x1f8487[_0x3ed2('0x30')]=_['keys'](db[_0x3ed2('0x4b')][_0x3ed2('0x2a')]);_0x1f8487['query']=_[_0x3ed2('0x2d')](_0x1f6fea['query']);_0x1f8487[_0x3ed2('0x2e')]=_[_0x3ed2('0x2f')](_0x1f8487[_0x3ed2('0x30')],_0x1f8487['query']);_0x3a1a58['attributes']=_[_0x3ed2('0x2f')](_0x1f8487[_0x3ed2('0x30')],qs[_0x3ed2('0x32')](_0x1f6fea[_0x3ed2('0x31')][_0x3ed2('0x32')]));_0x3a1a58[_0x3ed2('0x33')]=_0x3a1a58[_0x3ed2('0x33')][_0x3ed2('0x4c')]?_0x3a1a58[_0x3ed2('0x33')]:_0x1f8487[_0x3ed2('0x30')];_0x3a1a58[_0x3ed2('0x36')]=qs[_0x3ed2('0x37')](_0x1f6fea[_0x3ed2('0x31')][_0x3ed2('0x37')]);_0x3a1a58['where']=qs[_0x3ed2('0x2e')](_['pick'](_0x1f6fea[_0x3ed2('0x31')],_0x1f8487[_0x3ed2('0x2e')]));if(_0x1f6fea[_0x3ed2('0x31')][_0x3ed2('0x3a')]){_0x3a1a58[_0x3ed2('0x38')]=_['merge'](_0x3a1a58[_0x3ed2('0x38')],{'$or':_[_0x3ed2('0x28')](_0x3a1a58[_0x3ed2('0x33')],function(_0x7a7b92){var _0x13b384={};_0x13b384[_0x7a7b92]={'$like':'%'+_0x1f6fea[_0x3ed2('0x31')][_0x3ed2('0x3a')]+'%'};return _0x13b384;})});}_0x3a1a58=_[_0x3ed2('0x3b')]({},_0x3a1a58,_0x1f6fea['options']);return _0x2e5be2['getDescriptions'](_0x3a1a58);}})['then'](function(_0x4c7865){if(_0x4c7865){_0x5d5231=_0x4c7865[_0x3ed2('0x4c')];if(!_0x1f6fea[_0x3ed2('0x31')][_0x3ed2('0x34')](_0x3ed2('0x35'))){_0x3a1a58[_0x3ed2('0x1b')]=qs[_0x3ed2('0x1b')](_0x1f6fea[_0x3ed2('0x31')][_0x3ed2('0x1b')]);_0x3a1a58[_0x3ed2('0x1c')]=qs['offset'](_0x1f6fea[_0x3ed2('0x31')]['offset']);}return _0x2e5be2['getDescriptions'](_0x3a1a58);}})[_0x3ed2('0x22')](function(_0x369527){if(_0x369527){return _0x369527?{'count':_0x5d5231,'rows':_0x369527}:null;}})['then'](respondWithResult(_0x21018f,null))[_0x3ed2('0x46')](handleError(_0x21018f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index dc23472..faeee8a 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 _0x76cb=['path','../../config/environment','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4233b9,_0x39607b){var _0x2c1431=function(_0x6e4ca6){while(--_0x6e4ca6){_0x4233b9['push'](_0x4233b9['shift']());}};_0x2c1431(++_0x39607b);}(_0x76cb,0x1e9));var _0xb76c=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x76cb[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0xb76c('0x0'));var util=require(_0xb76c('0x1'));var logger=require(_0xb76c('0x2'))(_0xb76c('0x3'));var moment=require('moment');var BPromise=require(_0xb76c('0x4'));var rp=require(_0xb76c('0x5'));var fs=require('fs');var path=require(_0xb76c('0x6'));var rimraf=require('rimraf');var config=require(_0xb76c('0x7'));var attributes=require(_0xb76c('0x8'));module[_0xb76c('0x9')]=function(_0x2fcd24,_0x4ca505){return _0x2fcd24['define']('SalesforceConfiguration',attributes,{'tableName':_0xb76c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5793=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','util','../../config/logger','api','moment','bluebird'];(function(_0x3b14a8,_0x2de21f){var _0x12bdc9=function(_0x2c485f){while(--_0x2c485f){_0x3b14a8['push'](_0x3b14a8['shift']());}};_0x12bdc9(++_0x2de21f);}(_0x5793,0x16f));var _0x3579=function(_0x1ced8b,_0x459894){_0x1ced8b=_0x1ced8b-0x0;var _0xf29fbb=_0x5793[_0x1ced8b];return _0xf29fbb;};'use strict';var _=require('lodash');var util=require(_0x3579('0x0'));var logger=require(_0x3579('0x1'))(_0x3579('0x2'));var moment=require(_0x3579('0x3'));var BPromise=require(_0x3579('0x4'));var rp=require(_0x3579('0x5'));var fs=require('fs');var path=require(_0x3579('0x6'));var rimraf=require(_0x3579('0x7'));var config=require(_0x3579('0x8'));var attributes=require(_0x3579('0x9'));module[_0x3579('0xa')]=function(_0x1cf17f,_0x2010e5){return _0x1cf17f[_0x3579('0xb')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 8eef3bc..6d3f5f6 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 _0xd781=['../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xd5c23f,_0x4d1924){var _0x1a0710=function(_0x4d1c30){while(--_0x4d1c30){_0xd5c23f['push'](_0xd5c23f['shift']());}};_0x1a0710(++_0x4d1924);}(_0xd781,0xb6));var _0x1d78=function(_0x227dc8,_0x10bbc5){_0x227dc8=_0x227dc8-0x0;var _0x46b2ae=_0xd781[_0x227dc8];return _0x46b2ae;};'use strict';var _=require(_0x1d78('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d78('0x1'));var fs=require('fs');var Redis=require(_0x1d78('0x2'));var db=require(_0x1d78('0x3'))['db'];var utils=require(_0x1d78('0x4'));var logger=require(_0x1d78('0x5'))(_0x1d78('0x6'));var config=require(_0x1d78('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d78('0x8')][_0x1d78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58b49a,_0x2f94f4,_0x2e09fe){return new BPromise(function(_0x2b5fef,_0x5d14d3){return client[_0x1d78('0xa')](_0x58b49a,_0x2e09fe)[_0x1d78('0xb')](function(_0x3c2882){logger[_0x1d78('0xc')](_0x1d78('0xd'),_0x2f94f4,_0x1d78('0xe'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x2f94f4,'request\x20sent',JSON[_0x1d78('0xf')](_0x3c2882));if(_0x3c2882[_0x1d78('0x10')]){if(_0x3c2882[_0x1d78('0x10')][_0x1d78('0x11')]===0x1f4){logger[_0x1d78('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2f94f4,_0x3c2882[_0x1d78('0x10')][_0x1d78('0x12')]);return _0x5d14d3(_0x3c2882[_0x1d78('0x10')][_0x1d78('0x12')]);}logger[_0x1d78('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2f94f4,_0x3c2882[_0x1d78('0x10')]['message']);return _0x2b5fef(_0x3c2882[_0x1d78('0x10')][_0x1d78('0x12')]);}else{logger[_0x1d78('0xc')](_0x1d78('0xd'),_0x2f94f4,_0x1d78('0xe'));_0x2b5fef(_0x3c2882[_0x1d78('0x13')][_0x1d78('0x12')]);}})[_0x1d78('0x14')](function(_0x2482fb){logger['error'](_0x1d78('0xd'),_0x2f94f4,_0x2482fb);_0x5d14d3(_0x2482fb);});});} \ No newline at end of file +var _0xa534=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0xa534,0xbe));var _0x4a53=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xa534[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x4a53('0x0'));var util=require(_0x4a53('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a53('0x2'));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(_0x4a53('0x3'));var jayson=require(_0x4a53('0x4'));var client=jayson[_0x4a53('0x5')][_0x4a53('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x12930f,_0x2b7f3e,_0x20d631){return new BPromise(function(_0x1d8e2e,_0x5623a4){return client[_0x4a53('0x7')](_0x12930f,_0x20d631)[_0x4a53('0x8')](function(_0x710517){logger[_0x4a53('0x9')](_0x4a53('0xa'),_0x2b7f3e,_0x4a53('0xb'));logger[_0x4a53('0xc')](_0x4a53('0xd'),_0x2b7f3e,_0x4a53('0xb'),JSON[_0x4a53('0xe')](_0x710517));if(_0x710517[_0x4a53('0xf')]){if(_0x710517[_0x4a53('0xf')][_0x4a53('0x10')]===0x1f4){logger['error'](_0x4a53('0xa'),_0x2b7f3e,_0x710517['error'][_0x4a53('0x11')]);return _0x5623a4(_0x710517[_0x4a53('0xf')]['message']);}logger['error'](_0x4a53('0xa'),_0x2b7f3e,_0x710517['error'][_0x4a53('0x11')]);return _0x1d8e2e(_0x710517[_0x4a53('0xf')]['message']);}else{logger[_0x4a53('0x9')](_0x4a53('0xa'),_0x2b7f3e,_0x4a53('0xb'));_0x1d8e2e(_0x710517[_0x4a53('0x12')]['message']);}})[_0x4a53('0x13')](function(_0x2364d0){logger[_0x4a53('0xf')](_0x4a53('0xa'),_0x2b7f3e,_0x2364d0);_0x5623a4(_0x2364d0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 63f1754..c212f81 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 _0x1ead=['fs-extra','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x50aa9b,_0x4575b6){var _0x7d7918=function(_0x7912e5){while(--_0x7912e5){_0x50aa9b['push'](_0x50aa9b['shift']());}};_0x7d7918(++_0x4575b6);}(_0x1ead,0xd8));var _0xd1ea=function(_0x25dc10,_0x44ee29){_0x25dc10=_0x25dc10-0x0;var _0x4c1d61=_0x1ead[_0x25dc10];return _0x4c1d61;};'use strict';var multer=require(_0xd1ea('0x0'));var util=require('util');var path=require(_0xd1ea('0x1'));var timeout=require(_0xd1ea('0x2'));var express=require(_0xd1ea('0x3'));var router=express[_0xd1ea('0x4')]();var fs_extra=require(_0xd1ea('0x5'));var auth=require(_0xd1ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd1ea('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd1ea('0x8')]);router['get'](_0xd1ea('0x9'),auth[_0xd1ea('0xa')](),controller['show']);router[_0xd1ea('0xb')]('/',auth[_0xd1ea('0xa')](),controller[_0xd1ea('0xc')]);router[_0xd1ea('0xd')](_0xd1ea('0x9'),auth[_0xd1ea('0xa')](),controller[_0xd1ea('0xe')]);router['delete'](_0xd1ea('0x9'),auth[_0xd1ea('0xa')](),controller[_0xd1ea('0xf')]);module[_0xd1ea('0x10')]=router; \ No newline at end of file +var _0x5bb3=['show','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x5bb3,0x116));var _0x35bb=function(_0x22da18,_0x1e10d4){_0x22da18=_0x22da18-0x0;var _0x49c023=_0x5bb3[_0x22da18];return _0x49c023;};'use strict';var multer=require(_0x35bb('0x0'));var util=require(_0x35bb('0x1'));var path=require(_0x35bb('0x2'));var timeout=require('connect-timeout');var express=require(_0x35bb('0x3'));var router=express['Router']();var fs_extra=require(_0x35bb('0x4'));var auth=require(_0x35bb('0x5'));var interaction=require(_0x35bb('0x6'));var config=require(_0x35bb('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x35bb('0x8')](),controller[_0x35bb('0x9')]);router['get'](_0x35bb('0xa'),auth[_0x35bb('0x8')](),controller[_0x35bb('0xb')]);router['post']('/',auth[_0x35bb('0x8')](),controller[_0x35bb('0xc')]);router[_0x35bb('0xd')](_0x35bb('0xa'),auth[_0x35bb('0x8')](),controller[_0x35bb('0xe')]);router['delete'](_0x35bb('0xa'),auth['isAuthenticated'](),controller[_0x35bb('0xf')]);module[_0x35bb('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 7cc5a94..4644249 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 _0x1f7e=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x2689ae,_0x1f194b){var _0xb751e6=function(_0x1fb1d2){while(--_0x1fb1d2){_0x2689ae['push'](_0x2689ae['shift']());}};_0xb751e6(++_0x1f194b);}(_0x1f7e,0x185));var _0xe1f7=function(_0x58f713,_0x26b142){_0x58f713=_0x58f713-0x0;var _0x1807ac=_0x1f7e[_0x58f713];return _0x1807ac;};'use strict';var Sequelize=require(_0xe1f7('0x0'));module[_0xe1f7('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe1f7('0x2'),_0xe1f7('0x3'),_0xe1f7('0x4'),_0xe1f7('0x5'),_0xe1f7('0x6')),'defaultValue':_0xe1f7('0x2')},'content':{'type':Sequelize[_0xe1f7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe1f7('0x8')](_0xe1f7('0x2'),_0xe1f7('0x3'),_0xe1f7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe1f7('0x7')]},'variableName':{'type':Sequelize[_0xe1f7('0x7')]}}; \ No newline at end of file +var _0x266d=['ENUM','customVariable','picklist','string','STRING','variable','sequelize'];(function(_0xdd7389,_0x487607){var _0x3c46e0=function(_0x24c6fe){while(--_0x24c6fe){_0xdd7389['push'](_0xdd7389['shift']());}};_0x3c46e0(++_0x487607);}(_0x266d,0x125));var _0xd266=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x266d[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xd266('0x0'));module['exports']={'type':{'type':Sequelize[_0xd266('0x1')]('string','variable',_0xd266('0x2'),'keyValue',_0xd266('0x3')),'defaultValue':_0xd266('0x4')},'content':{'type':Sequelize[_0xd266('0x5')]},'key':{'type':Sequelize[_0xd266('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xd266('0x4'),_0xd266('0x6'),_0xd266('0x2'))},'keyContent':{'type':Sequelize[_0xd266('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xd266('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2489186..4942448 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 _0xa2fb=['pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','rimraf','fast-json-patch','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters'];(function(_0x39095f,_0x503621){var _0xb5fd16=function(_0x31ee0b){while(--_0x31ee0b){_0x39095f['push'](_0x39095f['shift']());}};_0xb5fd16(++_0x503621);}(_0xa2fb,0xa3));var _0xba2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2fb[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba2f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba2f('0x1'));var rp=require('request-promise');var moment=require(_0xba2f('0x2'));var BPromise=require(_0xba2f('0x3'));var Mustache=require('mustache');var util=require(_0xba2f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xba2f('0x5'));var ejs=require(_0xba2f('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba2f('0x7'));var squel=require(_0xba2f('0x8'));var crypto=require(_0xba2f('0x9'));var jsforce=require(_0xba2f('0xa'));var deskjs=require(_0xba2f('0xb'));var toCsv=require(_0xba2f('0x5'));var querystring=require(_0xba2f('0xc'));var Papa=require(_0xba2f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba2f('0xe'));var as=require(_0xba2f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba2f('0x10'))(_0xba2f('0x11'));var utils=require('../../config/utils');var config=require(_0xba2f('0x12'));var licenseUtil=require(_0xba2f('0x13'));var db=require(_0xba2f('0x14'))['db'];function respondWithStatusCode(_0x1ee882,_0x29bca9){_0x29bca9=_0x29bca9||0xcc;return function(_0x3b8539){if(_0x3b8539){return _0x1ee882['sendStatus'](_0x29bca9);}return _0x1ee882[_0xba2f('0x15')](_0x29bca9)[_0xba2f('0x16')]();};}function respondWithResult(_0x4a89f4,_0x2adc48){_0x2adc48=_0x2adc48||0xc8;return function(_0x380614){if(_0x380614){return _0x4a89f4['status'](_0x2adc48)[_0xba2f('0x17')](_0x380614);}};}function respondWithFilteredResult(_0x48666a,_0x186909){return function(_0x172815){if(_0x172815){var _0x3e3d92=typeof _0x186909[_0xba2f('0x18')]===_0xba2f('0x19')&&typeof _0x186909[_0xba2f('0x1a')]===_0xba2f('0x19');var _0x3a2be3=_0x172815[_0xba2f('0x1b')];var _0x5e738f=_0x3e3d92?0x0:_0x186909['offset'];var _0x3e25b6=_0x3e3d92?_0x172815[_0xba2f('0x1b')]:_0x186909[_0xba2f('0x18')]+_0x186909[_0xba2f('0x1a')];var _0x3b34a5;if(_0x3e25b6>=_0x3a2be3){_0x3e25b6=_0x3a2be3;_0x3b34a5=0xc8;}else{_0x3b34a5=0xce;}_0x48666a[_0xba2f('0x15')](_0x3b34a5);return _0x48666a['set'](_0xba2f('0x1c'),_0x5e738f+'-'+_0x3e25b6+'/'+_0x3a2be3)[_0xba2f('0x17')](_0x172815);}return null;};}function patchUpdates(_0x1f9c90){return function(_0x1764bf){try{jsonpatch[_0xba2f('0x1d')](_0x1764bf,_0x1f9c90,!![]);}catch(_0x4f04cf){return BPromise['reject'](_0x4f04cf);}return _0x1764bf[_0xba2f('0x1e')]();};}function saveUpdates(_0x23fe35,_0x30a659){return function(_0x5b88d1){if(_0x5b88d1){return _0x5b88d1[_0xba2f('0x1f')](_0x23fe35)[_0xba2f('0x20')](function(_0xbcc644){return _0xbcc644;});}return null;};}function removeEntity(_0x2ff04b,_0xdf0326){return function(_0x48e16b){if(_0x48e16b){return _0x48e16b[_0xba2f('0x21')]()['then'](function(){_0x2ff04b[_0xba2f('0x15')](0xcc)[_0xba2f('0x16')]();});}};}function handleEntityNotFound(_0x1b1319,_0x409e56){return function(_0x1e061f){if(!_0x1e061f){_0x1b1319[_0xba2f('0x22')](0x194);}return _0x1e061f;};}function handleError(_0xacff09,_0x5c8f03){_0x5c8f03=_0x5c8f03||0x1f4;return function(_0x43a27c){logger[_0xba2f('0x23')](_0x43a27c[_0xba2f('0x24')]);if(_0x43a27c[_0xba2f('0x25')]){delete _0x43a27c[_0xba2f('0x25')];}_0xacff09[_0xba2f('0x15')](_0x5c8f03)[_0xba2f('0x26')](_0x43a27c);};}exports[_0xba2f('0x27')]=function(_0x2763cd,_0x1ae141){var _0x16e231={},_0xe9a2={},_0x13a509={'count':0x0,'rows':[]};var _0x584a51=_[_0xba2f('0x28')](db[_0xba2f('0x29')][_0xba2f('0x2a')],function(_0x5291b3){return{'name':_0x5291b3[_0xba2f('0x2b')],'type':_0x5291b3[_0xba2f('0x2c')][_0xba2f('0x2d')]};});_0xe9a2[_0xba2f('0x2e')]=_[_0xba2f('0x28')](_0x584a51,'name');_0xe9a2[_0xba2f('0x2f')]=_['keys'](_0x2763cd[_0xba2f('0x2f')]);_0xe9a2['filters']=_[_0xba2f('0x30')](_0xe9a2[_0xba2f('0x2e')],_0xe9a2[_0xba2f('0x2f')]);_0x16e231[_0xba2f('0x31')]=_[_0xba2f('0x30')](_0xe9a2[_0xba2f('0x2e')],qs[_0xba2f('0x32')](_0x2763cd[_0xba2f('0x2f')][_0xba2f('0x32')]));_0x16e231[_0xba2f('0x31')]=_0x16e231[_0xba2f('0x31')][_0xba2f('0x33')]?_0x16e231[_0xba2f('0x31')]:_0xe9a2[_0xba2f('0x2e')];if(!_0x2763cd[_0xba2f('0x2f')][_0xba2f('0x34')]('nolimit')){_0x16e231['limit']=qs[_0xba2f('0x1a')](_0x2763cd[_0xba2f('0x2f')][_0xba2f('0x1a')]);_0x16e231[_0xba2f('0x18')]=qs[_0xba2f('0x18')](_0x2763cd[_0xba2f('0x2f')]['offset']);}_0x16e231[_0xba2f('0x35')]=qs[_0xba2f('0x36')](_0x2763cd[_0xba2f('0x2f')][_0xba2f('0x36')]);_0x16e231['where']=qs[_0xba2f('0x37')](_[_0xba2f('0x38')](_0x2763cd[_0xba2f('0x2f')],_0xe9a2['filters']),_0x584a51);if(_0x2763cd[_0xba2f('0x2f')][_0xba2f('0x39')]){_0x16e231[_0xba2f('0x3a')]=_[_0xba2f('0x3b')](_0x16e231[_0xba2f('0x3a')],{'$or':_[_0xba2f('0x28')](_0x584a51,function(_0x419f94){if(_0x419f94[_0xba2f('0x2c')]!==_0xba2f('0x3c')){var _0x4daf72={};_0x4daf72[_0x419f94[_0xba2f('0x25')]]={'$like':'%'+_0x2763cd[_0xba2f('0x2f')]['filter']+'%'};return _0x4daf72;}})});}_0x16e231=_[_0xba2f('0x3b')]({},_0x16e231,_0x2763cd['options']);var _0xa2e712={'where':_0x16e231['where']};return db[_0xba2f('0x29')][_0xba2f('0x1b')](_0xa2e712)['then'](function(_0xe9fed6){_0x13a509[_0xba2f('0x1b')]=_0xe9fed6;if(_0x2763cd[_0xba2f('0x2f')]['includeAll']){_0x16e231[_0xba2f('0x3d')]=[{'all':!![]}];}return db['SalesforceField'][_0xba2f('0x3e')](_0x16e231);})['then'](function(_0x165038){_0x13a509[_0xba2f('0x3f')]=_0x165038;return _0x13a509;})['then'](respondWithFilteredResult(_0x1ae141,_0x16e231))[_0xba2f('0x40')](handleError(_0x1ae141,null));};exports[_0xba2f('0x41')]=function(_0x29f304,_0x357c18){var _0x73a7a6={'raw':!![],'where':{'id':_0x29f304[_0xba2f('0x42')]['id']}},_0x105070={};_0x105070[_0xba2f('0x2e')]=_[_0xba2f('0x43')](db[_0xba2f('0x29')][_0xba2f('0x2a')]);_0x105070[_0xba2f('0x2f')]=_['keys'](_0x29f304['query']);_0x105070[_0xba2f('0x37')]=_[_0xba2f('0x30')](_0x105070[_0xba2f('0x2e')],_0x105070[_0xba2f('0x2f')]);_0x73a7a6['attributes']=_[_0xba2f('0x30')](_0x105070[_0xba2f('0x2e')],qs[_0xba2f('0x32')](_0x29f304['query'][_0xba2f('0x32')]));_0x73a7a6[_0xba2f('0x31')]=_0x73a7a6['attributes'][_0xba2f('0x33')]?_0x73a7a6['attributes']:_0x105070[_0xba2f('0x2e')];if(_0x29f304['query'][_0xba2f('0x44')]){_0x73a7a6[_0xba2f('0x3d')]=[{'all':!![]}];}_0x73a7a6=_['merge']({},_0x73a7a6,_0x29f304[_0xba2f('0x45')]);return db['SalesforceField'][_0xba2f('0x46')](_0x73a7a6)['then'](handleEntityNotFound(_0x357c18,null))[_0xba2f('0x20')](respondWithResult(_0x357c18,null))[_0xba2f('0x40')](handleError(_0x357c18,null));};exports[_0xba2f('0x47')]=function(_0x140bb9,_0x2df623){return db[_0xba2f('0x29')]['create'](_0x140bb9[_0xba2f('0x48')],{})['then'](respondWithResult(_0x2df623,0xc9))[_0xba2f('0x40')](handleError(_0x2df623,null));};exports[_0xba2f('0x1f')]=function(_0x53473f,_0x5b0cc8){if(_0x53473f['body']['id']){delete _0x53473f[_0xba2f('0x48')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x53473f[_0xba2f('0x42')]['id']}})[_0xba2f('0x20')](handleEntityNotFound(_0x5b0cc8,null))[_0xba2f('0x20')](saveUpdates(_0x53473f[_0xba2f('0x48')],null))[_0xba2f('0x20')](respondWithResult(_0x5b0cc8,null))[_0xba2f('0x40')](handleError(_0x5b0cc8,null));};exports[_0xba2f('0x21')]=function(_0x2a5403,_0x57d50f){return db['SalesforceField']['find']({'where':{'id':_0x2a5403[_0xba2f('0x42')]['id']}})[_0xba2f('0x20')](handleEntityNotFound(_0x57d50f,null))[_0xba2f('0x20')](removeEntity(_0x57d50f,null))[_0xba2f('0x40')](handleError(_0x57d50f,null));}; \ No newline at end of file +var _0xae7f=['where','pick','filter','merge','VIRTUAL','SalesforceField','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xae7f,0xf5));var _0xfae7=function(_0x541a62,_0x40b36d){_0x541a62=_0x541a62-0x0;var _0x456123=_0xae7f[_0x541a62];return _0x456123;};'use strict';var emlformat=require(_0xfae7('0x0'));var rimraf=require(_0xfae7('0x1'));var zipdir=require(_0xfae7('0x2'));var jsonpatch=require(_0xfae7('0x3'));var rp=require('request-promise');var moment=require(_0xfae7('0x4'));var BPromise=require(_0xfae7('0x5'));var Mustache=require(_0xfae7('0x6'));var util=require('util');var path=require(_0xfae7('0x7'));var sox=require(_0xfae7('0x8'));var csv=require('to-csv');var ejs=require(_0xfae7('0x9'));var fs=require('fs');var fs_extra=require(_0xfae7('0xa'));var _=require(_0xfae7('0xb'));var squel=require(_0xfae7('0xc'));var crypto=require(_0xfae7('0xd'));var jsforce=require(_0xfae7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfae7('0xf'));var Redis=require(_0xfae7('0x10'));var authService=require(_0xfae7('0x11'));var qs=require(_0xfae7('0x12'));var as=require(_0xfae7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfae7('0x14'))(_0xfae7('0x15'));var utils=require(_0xfae7('0x16'));var config=require(_0xfae7('0x17'));var licenseUtil=require(_0xfae7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b82b0,_0x3a9534){_0x3a9534=_0x3a9534||0xcc;return function(_0x33c670){if(_0x33c670){return _0x1b82b0[_0xfae7('0x19')](_0x3a9534);}return _0x1b82b0['status'](_0x3a9534)[_0xfae7('0x1a')]();};}function respondWithResult(_0x5c0844,_0x2f54c9){_0x2f54c9=_0x2f54c9||0xc8;return function(_0x3b881c){if(_0x3b881c){return _0x5c0844['status'](_0x2f54c9)[_0xfae7('0x1b')](_0x3b881c);}};}function respondWithFilteredResult(_0x14c699,_0x38e03e){return function(_0x1afefd){if(_0x1afefd){var _0xbf573a=typeof _0x38e03e[_0xfae7('0x1c')]===_0xfae7('0x1d')&&typeof _0x38e03e[_0xfae7('0x1e')]===_0xfae7('0x1d');var _0x1c3e32=_0x1afefd['count'];var _0x288446=_0xbf573a?0x0:_0x38e03e[_0xfae7('0x1c')];var _0x1637e5=_0xbf573a?_0x1afefd[_0xfae7('0x1f')]:_0x38e03e[_0xfae7('0x1c')]+_0x38e03e[_0xfae7('0x1e')];var _0x574814;if(_0x1637e5>=_0x1c3e32){_0x1637e5=_0x1c3e32;_0x574814=0xc8;}else{_0x574814=0xce;}_0x14c699[_0xfae7('0x20')](_0x574814);return _0x14c699[_0xfae7('0x21')](_0xfae7('0x22'),_0x288446+'-'+_0x1637e5+'/'+_0x1c3e32)[_0xfae7('0x1b')](_0x1afefd);}return null;};}function patchUpdates(_0x5b93cb){return function(_0x16dc40){try{jsonpatch[_0xfae7('0x23')](_0x16dc40,_0x5b93cb,!![]);}catch(_0x4920c6){return BPromise['reject'](_0x4920c6);}return _0x16dc40['save']();};}function saveUpdates(_0x155ce9,_0x9c2523){return function(_0x1b3750){if(_0x1b3750){return _0x1b3750[_0xfae7('0x24')](_0x155ce9)[_0xfae7('0x25')](function(_0x49d910){return _0x49d910;});}return null;};}function removeEntity(_0x1aa7f0,_0x4b30a3){return function(_0x1caec5){if(_0x1caec5){return _0x1caec5[_0xfae7('0x26')]()[_0xfae7('0x25')](function(){_0x1aa7f0[_0xfae7('0x20')](0xcc)[_0xfae7('0x1a')]();});}};}function handleEntityNotFound(_0x2fbccf,_0x526dcb){return function(_0x1255f5){if(!_0x1255f5){_0x2fbccf[_0xfae7('0x19')](0x194);}return _0x1255f5;};}function handleError(_0x49e733,_0x302ec9){_0x302ec9=_0x302ec9||0x1f4;return function(_0x219098){logger[_0xfae7('0x27')](_0x219098[_0xfae7('0x28')]);if(_0x219098[_0xfae7('0x29')]){delete _0x219098[_0xfae7('0x29')];}_0x49e733[_0xfae7('0x20')](_0x302ec9)[_0xfae7('0x2a')](_0x219098);};}exports[_0xfae7('0x2b')]=function(_0x1e0406,_0x577978){var _0x618872={},_0xc2dd7={},_0x1d913a={'count':0x0,'rows':[]};var _0x4a146b=_[_0xfae7('0x2c')](db['SalesforceField'][_0xfae7('0x2d')],function(_0x213545){return{'name':_0x213545[_0xfae7('0x2e')],'type':_0x213545[_0xfae7('0x2f')][_0xfae7('0x30')]};});_0xc2dd7['model']=_[_0xfae7('0x2c')](_0x4a146b,_0xfae7('0x29'));_0xc2dd7[_0xfae7('0x31')]=_[_0xfae7('0x32')](_0x1e0406[_0xfae7('0x31')]);_0xc2dd7[_0xfae7('0x33')]=_[_0xfae7('0x34')](_0xc2dd7[_0xfae7('0x35')],_0xc2dd7[_0xfae7('0x31')]);_0x618872['attributes']=_[_0xfae7('0x34')](_0xc2dd7[_0xfae7('0x35')],qs[_0xfae7('0x36')](_0x1e0406[_0xfae7('0x31')][_0xfae7('0x36')]));_0x618872['attributes']=_0x618872[_0xfae7('0x37')][_0xfae7('0x38')]?_0x618872[_0xfae7('0x37')]:_0xc2dd7['model'];if(!_0x1e0406[_0xfae7('0x31')]['hasOwnProperty'](_0xfae7('0x39'))){_0x618872['limit']=qs[_0xfae7('0x1e')](_0x1e0406[_0xfae7('0x31')]['limit']);_0x618872[_0xfae7('0x1c')]=qs['offset'](_0x1e0406[_0xfae7('0x31')][_0xfae7('0x1c')]);}_0x618872['order']=qs[_0xfae7('0x3a')](_0x1e0406[_0xfae7('0x31')][_0xfae7('0x3a')]);_0x618872[_0xfae7('0x3b')]=qs[_0xfae7('0x33')](_[_0xfae7('0x3c')](_0x1e0406[_0xfae7('0x31')],_0xc2dd7[_0xfae7('0x33')]),_0x4a146b);if(_0x1e0406[_0xfae7('0x31')][_0xfae7('0x3d')]){_0x618872[_0xfae7('0x3b')]=_[_0xfae7('0x3e')](_0x618872[_0xfae7('0x3b')],{'$or':_[_0xfae7('0x2c')](_0x4a146b,function(_0x588c1f){if(_0x588c1f[_0xfae7('0x2f')]!==_0xfae7('0x3f')){var _0x45ab3a={};_0x45ab3a[_0x588c1f['name']]={'$like':'%'+_0x1e0406[_0xfae7('0x31')][_0xfae7('0x3d')]+'%'};return _0x45ab3a;}})});}_0x618872=_[_0xfae7('0x3e')]({},_0x618872,_0x1e0406['options']);var _0x4084bd={'where':_0x618872[_0xfae7('0x3b')]};return db[_0xfae7('0x40')][_0xfae7('0x1f')](_0x4084bd)['then'](function(_0xe2ea24){_0x1d913a['count']=_0xe2ea24;if(_0x1e0406[_0xfae7('0x31')][_0xfae7('0x41')]){_0x618872['include']=[{'all':!![]}];}return db[_0xfae7('0x40')][_0xfae7('0x42')](_0x618872);})['then'](function(_0x288c2a){_0x1d913a[_0xfae7('0x43')]=_0x288c2a;return _0x1d913a;})['then'](respondWithFilteredResult(_0x577978,_0x618872))[_0xfae7('0x44')](handleError(_0x577978,null));};exports[_0xfae7('0x45')]=function(_0x513340,_0x35285d){var _0x97f9be={'raw':!![],'where':{'id':_0x513340[_0xfae7('0x46')]['id']}},_0x59a1df={};_0x59a1df[_0xfae7('0x35')]=_[_0xfae7('0x32')](db[_0xfae7('0x40')]['rawAttributes']);_0x59a1df['query']=_[_0xfae7('0x32')](_0x513340['query']);_0x59a1df['filters']=_[_0xfae7('0x34')](_0x59a1df[_0xfae7('0x35')],_0x59a1df[_0xfae7('0x31')]);_0x97f9be[_0xfae7('0x37')]=_[_0xfae7('0x34')](_0x59a1df['model'],qs['fields'](_0x513340[_0xfae7('0x31')][_0xfae7('0x36')]));_0x97f9be[_0xfae7('0x37')]=_0x97f9be['attributes'][_0xfae7('0x38')]?_0x97f9be[_0xfae7('0x37')]:_0x59a1df[_0xfae7('0x35')];if(_0x513340['query'][_0xfae7('0x41')]){_0x97f9be[_0xfae7('0x47')]=[{'all':!![]}];}_0x97f9be=_['merge']({},_0x97f9be,_0x513340[_0xfae7('0x48')]);return db[_0xfae7('0x40')][_0xfae7('0x49')](_0x97f9be)['then'](handleEntityNotFound(_0x35285d,null))[_0xfae7('0x25')](respondWithResult(_0x35285d,null))[_0xfae7('0x44')](handleError(_0x35285d,null));};exports[_0xfae7('0x4a')]=function(_0x541e5d,_0x403528){return db[_0xfae7('0x40')][_0xfae7('0x4a')](_0x541e5d[_0xfae7('0x4b')],{})[_0xfae7('0x25')](respondWithResult(_0x403528,0xc9))['catch'](handleError(_0x403528,null));};exports['update']=function(_0x45dfef,_0x183d40){if(_0x45dfef[_0xfae7('0x4b')]['id']){delete _0x45dfef['body']['id'];}return db[_0xfae7('0x40')][_0xfae7('0x49')]({'where':{'id':_0x45dfef[_0xfae7('0x46')]['id']}})[_0xfae7('0x25')](handleEntityNotFound(_0x183d40,null))[_0xfae7('0x25')](saveUpdates(_0x45dfef[_0xfae7('0x4b')],null))['then'](respondWithResult(_0x183d40,null))[_0xfae7('0x44')](handleError(_0x183d40,null));};exports['destroy']=function(_0x14e65c,_0x323c6b){return db[_0xfae7('0x40')][_0xfae7('0x49')]({'where':{'id':_0x14e65c[_0xfae7('0x46')]['id']}})[_0xfae7('0x25')](handleEntityNotFound(_0x323c6b,null))[_0xfae7('0x25')](removeEntity(_0x323c6b,null))[_0xfae7('0x44')](handleError(_0x323c6b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ffae91f..c545e5e 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 _0x98c2=['path','rimraf','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x32c6bd,_0x1f2151){var _0x2ed60d=function(_0x3ff86f){while(--_0x3ff86f){_0x32c6bd['push'](_0x32c6bd['shift']());}};_0x2ed60d(++_0x1f2151);}(_0x98c2,0xd9));var _0x298c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x98c2[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x298c('0x0'));var util=require(_0x298c('0x1'));var logger=require(_0x298c('0x2'))(_0x298c('0x3'));var moment=require(_0x298c('0x4'));var BPromise=require(_0x298c('0x5'));var rp=require(_0x298c('0x6'));var fs=require('fs');var path=require(_0x298c('0x7'));var rimraf=require(_0x298c('0x8'));var config=require('../../config/environment');var attributes=require(_0x298c('0x9'));module[_0x298c('0xa')]=function(_0x2ae0c7,_0x43887d){return _0x2ae0c7[_0x298c('0xb')]('SalesforceField',attributes,{'tableName':_0x298c('0xc'),'paranoid':![],'indexes':[{'name':_0x298c('0xd'),'fields':[_0x298c('0xe'),_0x298c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84ec=['util','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x3de629,_0x240939){var _0x239e30=function(_0x3ef5af){while(--_0x3ef5af){_0x3de629['push'](_0x3de629['shift']());}};_0x239e30(++_0x240939);}(_0x84ec,0x8b));var _0xc84e=function(_0x3d80bd,_0x41985e){_0x3d80bd=_0x3d80bd-0x0;var _0x3f7b26=_0x84ec[_0x3d80bd];return _0x3f7b26;};'use strict';var _=require(_0xc84e('0x0'));var util=require(_0xc84e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc84e('0x2'));var rp=require(_0xc84e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc84e('0x4'));var config=require(_0xc84e('0x5'));var attributes=require(_0xc84e('0x6'));module[_0xc84e('0x7')]=function(_0x2d1177,_0x963cb9){return _0x2d1177[_0xc84e('0x8')](_0xc84e('0x9'),attributes,{'tableName':_0xc84e('0xa'),'paranoid':![],'indexes':[{'name':_0xc84e('0xb'),'fields':[_0xc84e('0xc'),_0xc84e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index ea64cad..809b9cc 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 _0x6f40=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xee755f,_0x2437bf){var _0x186cd2=function(_0x1a2d22){while(--_0x1a2d22){_0xee755f['push'](_0xee755f['shift']());}};_0x186cd2(++_0x2437bf);}(_0x6f40,0x9d));var _0x06f4=function(_0x1db498,_0x4589c4){_0x1db498=_0x1db498-0x0;var _0x5a171f=_0x6f40[_0x1db498];return _0x5a171f;};'use strict';var _=require('lodash');var util=require(_0x06f4('0x0'));var moment=require(_0x06f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x06f4('0x2'));var fs=require('fs');var Redis=require(_0x06f4('0x3'));var db=require(_0x06f4('0x4'))['db'];var utils=require(_0x06f4('0x5'));var logger=require(_0x06f4('0x6'))(_0x06f4('0x7'));var config=require(_0x06f4('0x8'));var jayson=require(_0x06f4('0x9'));var client=jayson[_0x06f4('0xa')][_0x06f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52ef9f,_0x1909af,_0x53c89d){return new BPromise(function(_0x43acca,_0x2aff57){return client[_0x06f4('0xc')](_0x52ef9f,_0x53c89d)[_0x06f4('0xd')](function(_0x3c153b){logger[_0x06f4('0xe')](_0x06f4('0xf'),_0x1909af,_0x06f4('0x10'));logger['debug'](_0x06f4('0x11'),_0x1909af,'request\x20sent',JSON[_0x06f4('0x12')](_0x3c153b));if(_0x3c153b[_0x06f4('0x13')]){if(_0x3c153b[_0x06f4('0x13')][_0x06f4('0x14')]===0x1f4){logger[_0x06f4('0x13')]('SalesforceField,\x20%s,\x20%s',_0x1909af,_0x3c153b['error'][_0x06f4('0x15')]);return _0x2aff57(_0x3c153b[_0x06f4('0x13')][_0x06f4('0x15')]);}logger[_0x06f4('0x13')]('SalesforceField,\x20%s,\x20%s',_0x1909af,_0x3c153b[_0x06f4('0x13')]['message']);return _0x43acca(_0x3c153b[_0x06f4('0x13')][_0x06f4('0x15')]);}else{logger[_0x06f4('0xe')]('SalesforceField,\x20%s,\x20%s',_0x1909af,_0x06f4('0x10'));_0x43acca(_0x3c153b[_0x06f4('0x16')]['message']);}})[_0x06f4('0x17')](function(_0xeeb82e){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1909af,_0xeeb82e);_0x2aff57(_0xeeb82e);});});} \ No newline at end of file +var _0xa704=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa704,0x10b));var _0x4a70=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xa704[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require(_0x4a70('0x0'));var util=require('util');var moment=require(_0x4a70('0x1'));var BPromise=require(_0x4a70('0x2'));var rs=require(_0x4a70('0x3'));var fs=require('fs');var Redis=require(_0x4a70('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a70('0x5'));var logger=require('../../config/logger')(_0x4a70('0x6'));var config=require(_0x4a70('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa34124,_0x58f59a,_0x1d292a){return new BPromise(function(_0x5de1e6,_0xb6f353){return client[_0x4a70('0x8')](_0xa34124,_0x1d292a)[_0x4a70('0x9')](function(_0x15c907){logger[_0x4a70('0xa')](_0x4a70('0xb'),_0x58f59a,_0x4a70('0xc'));logger['debug'](_0x4a70('0xd'),_0x58f59a,'request\x20sent',JSON[_0x4a70('0xe')](_0x15c907));if(_0x15c907[_0x4a70('0xf')]){if(_0x15c907[_0x4a70('0xf')]['code']===0x1f4){logger[_0x4a70('0xf')](_0x4a70('0xb'),_0x58f59a,_0x15c907['error'][_0x4a70('0x10')]);return _0xb6f353(_0x15c907['error'][_0x4a70('0x10')]);}logger[_0x4a70('0xf')](_0x4a70('0xb'),_0x58f59a,_0x15c907['error'][_0x4a70('0x10')]);return _0x5de1e6(_0x15c907['error'][_0x4a70('0x10')]);}else{logger[_0x4a70('0xa')](_0x4a70('0xb'),_0x58f59a,_0x4a70('0xc'));_0x5de1e6(_0x15c907[_0x4a70('0x11')][_0x4a70('0x10')]);}})[_0x4a70('0x12')](function(_0x5aa6a6){logger[_0x4a70('0xf')](_0x4a70('0xb'),_0x58f59a,_0x5aa6a6);_0xb6f353(_0x5aa6a6);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 0976a67..fa44c84 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 _0x630e=['index','/:id','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x630e,0x1af));var _0xe630=function(_0x5354d7,_0x374ea3){_0x5354d7=_0x5354d7-0x0;var _0x260119=_0x630e[_0x5354d7];return _0x260119;};'use strict';var multer=require(_0xe630('0x0'));var util=require('util');var path=require(_0xe630('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe630('0x2')]();var fs_extra=require(_0xe630('0x3'));var auth=require(_0xe630('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe630('0x5'));var controller=require(_0xe630('0x6'));router[_0xe630('0x7')]('/',auth[_0xe630('0x8')](),controller[_0xe630('0x9')]);router['get'](_0xe630('0xa'),auth[_0xe630('0x8')](),controller['show']);router[_0xe630('0x7')]('/:id/configurations',auth[_0xe630('0x8')](),controller[_0xe630('0xb')]);router[_0xe630('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe630('0xc')]);router[_0xe630('0xd')]('/',auth[_0xe630('0x8')](),controller[_0xe630('0xe')]);router['post'](_0xe630('0xf'),auth[_0xe630('0x8')](),controller[_0xe630('0x10')]);router[_0xe630('0x11')](_0xe630('0xa'),auth[_0xe630('0x8')](),controller[_0xe630('0x12')]);router[_0xe630('0x13')](_0xe630('0xa'),auth[_0xe630('0x8')](),controller[_0xe630('0x14')]);module[_0xe630('0x15')]=router; \ No newline at end of file +var _0xd245=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','delete','destroy'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd245,0xd3));var _0x5d24=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xd245[_0x4709c8];return _0x478cdd;};'use strict';var multer=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var path=require(_0x5d24('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d24('0x3'));var router=express[_0x5d24('0x4')]();var fs_extra=require(_0x5d24('0x5'));var auth=require(_0x5d24('0x6'));var interaction=require(_0x5d24('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x5d24('0x8')](),controller['index']);router[_0x5d24('0x9')](_0x5d24('0xa'),auth[_0x5d24('0x8')](),controller[_0x5d24('0xb')]);router[_0x5d24('0x9')](_0x5d24('0xc'),auth['isAuthenticated'](),controller[_0x5d24('0xd')]);router['get']('/:id/fields',auth[_0x5d24('0x8')](),controller[_0x5d24('0xe')]);router[_0x5d24('0xf')]('/',auth[_0x5d24('0x8')](),controller['create']);router['post'](_0x5d24('0xc'),auth['isAuthenticated'](),controller[_0x5d24('0x10')]);router[_0x5d24('0x11')]('/:id',auth[_0x5d24('0x8')](),controller['update']);router[_0x5d24('0x12')]('/:id',auth[_0x5d24('0x8')](),controller[_0x5d24('0x13')]);module[_0x5d24('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 1bb5f47..6252053 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 _0x6361=['username','remoteUri','sequelize','exports','STRING'];(function(_0x263a09,_0x1054e3){var _0x38dd46=function(_0x4acf2){while(--_0x4acf2){_0x263a09['push'](_0x263a09['shift']());}};_0x38dd46(++_0x1054e3);}(_0x6361,0xd4));var _0x1636=function(_0x45e626,_0x4c54e8){_0x45e626=_0x45e626-0x0;var _0x4e56d4=_0x6361[_0x45e626];return _0x4e56d4;};'use strict';var Sequelize=require(_0x1636('0x0'));module[_0x1636('0x1')]={'name':{'type':Sequelize[_0x1636('0x2')]},'description':{'type':Sequelize[_0x1636('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1636('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1636('0x2')]},'remoteUri':{'type':Sequelize[_0x1636('0x2')],'unique':_0x1636('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5a27=['STRING','username','remoteUri','sequelize','exports'];(function(_0x527059,_0x224ffb){var _0x44ed63=function(_0xa60c93){while(--_0xa60c93){_0x527059['push'](_0x527059['shift']());}};_0x44ed63(++_0x224ffb);}(_0x5a27,0x12a));var _0x75a2=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x5a27[_0x38c699];return _0x3b1ded;};'use strict';var Sequelize=require(_0x75a2('0x0'));module[_0x75a2('0x1')]={'name':{'type':Sequelize[_0x75a2('0x2')]},'description':{'type':Sequelize[_0x75a2('0x2')]},'username':{'type':Sequelize[_0x75a2('0x2')],'unique':_0x75a2('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x75a2('0x2')]},'remoteUri':{'type':Sequelize[_0x75a2('0x2')],'unique':_0x75a2('0x4')},'serverUrl':{'type':Sequelize[_0x75a2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a346621..fc1f037 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 _0x8eaf=['path','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','end','status','json','offset','limit','set','Content-Range','reject','then','sendStatus','error','stack','name','index','map','ServicenowAccount','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','body','update','destroy','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','create','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','incident_state','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','resolved_at','caller_id','short_description','delivery_task','work_start','assignment_group','additional_assignee_list','sys_class_name','parent_incident','contact_type','urgency','problem_id','company','reassignment_count','activity_due','severity','comments','sla_due','approval','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','password','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','assign','remove','includes','forEach','label','push','log','TCL:\x20_object','internalType','concat','ServiceNow\x20error:\x20','statusCode','send','test','Wrong\x20credentials','boolean','true','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x871d6e,_0x1b5ffb){var _0x2203fd=function(_0x5789a0){while(--_0x5789a0){_0x871d6e['push'](_0x871d6e['shift']());}};_0x2203fd(++_0x1b5ffb);}(_0x8eaf,0x155));var _0xf8ea=function(_0x572d5b,_0x9e92fc){_0x572d5b=_0x572d5b-0x0;var _0x3adc72=_0x8eaf[_0x572d5b];return _0x3adc72;};'use strict';var emlformat=require(_0xf8ea('0x0'));var rimraf=require(_0xf8ea('0x1'));var zipdir=require(_0xf8ea('0x2'));var jsonpatch=require(_0xf8ea('0x3'));var rp=require(_0xf8ea('0x4'));var moment=require(_0xf8ea('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf8ea('0x6'));var util=require('util');var path=require(_0xf8ea('0x7'));var sox=require('sox');var csv=require(_0xf8ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8ea('0x9'));var _=require(_0xf8ea('0xa'));var squel=require(_0xf8ea('0xb'));var crypto=require('crypto');var jsforce=require(_0xf8ea('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf8ea('0x8'));var querystring=require('querystring');var Papa=require(_0xf8ea('0xd'));var Redis=require('ioredis');var authService=require(_0xf8ea('0xe'));var qs=require(_0xf8ea('0xf'));var as=require(_0xf8ea('0x10'));var hardwareService=require(_0xf8ea('0x11'));var logger=require(_0xf8ea('0x12'))(_0xf8ea('0x13'));var utils=require(_0xf8ea('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf8ea('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf8ea('0x16'));function respondWithStatusCode(_0x19960d,_0x16aee9){_0x16aee9=_0x16aee9||0xcc;return function(_0x265235){if(_0x265235){return _0x19960d['sendStatus'](_0x16aee9);}return _0x19960d['status'](_0x16aee9)[_0xf8ea('0x17')]();};}function respondWithResult(_0x50d23c,_0xc1132a){_0xc1132a=_0xc1132a||0xc8;return function(_0x1fdbf5){if(_0x1fdbf5){return _0x50d23c[_0xf8ea('0x18')](_0xc1132a)[_0xf8ea('0x19')](_0x1fdbf5);}};}function respondWithFilteredResult(_0x3fedbc,_0x38b555){return function(_0x1b5e1a){if(_0x1b5e1a){var _0x73f7ff=typeof _0x38b555[_0xf8ea('0x1a')]==='undefined'&&typeof _0x38b555[_0xf8ea('0x1b')]==='undefined';var _0x35cf7f=_0x1b5e1a['count'];var _0x8df4db=_0x73f7ff?0x0:_0x38b555[_0xf8ea('0x1a')];var _0x3e1a59=_0x73f7ff?_0x1b5e1a['count']:_0x38b555['offset']+_0x38b555['limit'];var _0xe5d234;if(_0x3e1a59>=_0x35cf7f){_0x3e1a59=_0x35cf7f;_0xe5d234=0xc8;}else{_0xe5d234=0xce;}_0x3fedbc[_0xf8ea('0x18')](_0xe5d234);return _0x3fedbc[_0xf8ea('0x1c')](_0xf8ea('0x1d'),_0x8df4db+'-'+_0x3e1a59+'/'+_0x35cf7f)[_0xf8ea('0x19')](_0x1b5e1a);}return null;};}function patchUpdates(_0x14b9a9){return function(_0x1ce004){try{jsonpatch['apply'](_0x1ce004,_0x14b9a9,!![]);}catch(_0x13bff9){return BPromise[_0xf8ea('0x1e')](_0x13bff9);}return _0x1ce004['save']();};}function saveUpdates(_0x52fbff,_0x482f35){return function(_0x5057f8){if(_0x5057f8){return _0x5057f8['update'](_0x52fbff)[_0xf8ea('0x1f')](function(_0x9fe72e){return _0x9fe72e;});}return null;};}function removeEntity(_0x433ec0,_0x1d9f5b){return function(_0x29cd41){if(_0x29cd41){return _0x29cd41['destroy']()[_0xf8ea('0x1f')](function(){_0x433ec0[_0xf8ea('0x18')](0xcc)[_0xf8ea('0x17')]();});}};}function handleEntityNotFound(_0x42cf67,_0x282618){return function(_0x2a5b64){if(!_0x2a5b64){_0x42cf67[_0xf8ea('0x20')](0x194);}return _0x2a5b64;};}function handleError(_0x251093,_0x44652a){_0x44652a=_0x44652a||0x1f4;return function(_0x14c53c){logger[_0xf8ea('0x21')](_0x14c53c[_0xf8ea('0x22')]);if(_0x14c53c[_0xf8ea('0x23')]){delete _0x14c53c[_0xf8ea('0x23')];}_0x251093[_0xf8ea('0x18')](_0x44652a)['send'](_0x14c53c);};}exports[_0xf8ea('0x24')]=function(_0x5ae99f,_0x1a66b4){var _0x435476={},_0x273187={},_0x2fa71c={'count':0x0,'rows':[]};var _0x58fa74=_[_0xf8ea('0x25')](db[_0xf8ea('0x26')]['rawAttributes'],function(_0x1a996b){return{'name':_0x1a996b[_0xf8ea('0x27')],'type':_0x1a996b[_0xf8ea('0x28')][_0xf8ea('0x29')]};});_0x273187[_0xf8ea('0x2a')]=_[_0xf8ea('0x25')](_0x58fa74,'name');_0x273187['query']=_[_0xf8ea('0x2b')](_0x5ae99f['query']);_0x273187[_0xf8ea('0x2c')]=_[_0xf8ea('0x2d')](_0x273187['model'],_0x273187[_0xf8ea('0x2e')]);_0x435476['attributes']=_[_0xf8ea('0x2d')](_0x273187[_0xf8ea('0x2a')],qs[_0xf8ea('0x2f')](_0x5ae99f[_0xf8ea('0x2e')][_0xf8ea('0x2f')]));_0x435476[_0xf8ea('0x30')]=_0x435476['attributes'][_0xf8ea('0x31')]?_0x435476[_0xf8ea('0x30')]:_0x273187['model'];if(!_0x5ae99f[_0xf8ea('0x2e')]['hasOwnProperty'](_0xf8ea('0x32'))){_0x435476[_0xf8ea('0x1b')]=qs[_0xf8ea('0x1b')](_0x5ae99f[_0xf8ea('0x2e')][_0xf8ea('0x1b')]);_0x435476[_0xf8ea('0x1a')]=qs[_0xf8ea('0x1a')](_0x5ae99f[_0xf8ea('0x2e')][_0xf8ea('0x1a')]);}_0x435476[_0xf8ea('0x33')]=qs[_0xf8ea('0x34')](_0x5ae99f['query'][_0xf8ea('0x34')]);_0x435476[_0xf8ea('0x35')]=qs['filters'](_[_0xf8ea('0x36')](_0x5ae99f[_0xf8ea('0x2e')],_0x273187[_0xf8ea('0x2c')]),_0x58fa74);if(_0x5ae99f[_0xf8ea('0x2e')][_0xf8ea('0x37')]){_0x435476['where']=_[_0xf8ea('0x38')](_0x435476[_0xf8ea('0x35')],{'$or':_[_0xf8ea('0x25')](_0x58fa74,function(_0x2b3e99){if(_0x2b3e99[_0xf8ea('0x28')]!==_0xf8ea('0x39')){var _0x3a3095={};_0x3a3095[_0x2b3e99['name']]={'$like':'%'+_0x5ae99f[_0xf8ea('0x2e')][_0xf8ea('0x37')]+'%'};return _0x3a3095;}})});}_0x435476=_[_0xf8ea('0x38')]({},_0x435476,_0x5ae99f['options']);var _0x5ef7e5={'where':_0x435476[_0xf8ea('0x35')]};return db[_0xf8ea('0x26')]['count'](_0x5ef7e5)[_0xf8ea('0x1f')](function(_0x232f73){_0x2fa71c['count']=_0x232f73;if(_0x5ae99f[_0xf8ea('0x2e')][_0xf8ea('0x3a')]){_0x435476[_0xf8ea('0x3b')]=[{'all':!![]}];}return db[_0xf8ea('0x26')][_0xf8ea('0x3c')](_0x435476);})[_0xf8ea('0x1f')](function(_0x10f34d){_0x2fa71c[_0xf8ea('0x3d')]=_0x10f34d;return _0x2fa71c;})['then'](respondWithFilteredResult(_0x1a66b4,_0x435476))[_0xf8ea('0x3e')](handleError(_0x1a66b4,null));};exports[_0xf8ea('0x3f')]=function(_0x1625c4,_0x5ceb0e){var _0x30daf6={'raw':![],'where':{'id':_0x1625c4[_0xf8ea('0x40')]['id']}},_0x811c71={};_0x811c71[_0xf8ea('0x2a')]=_[_0xf8ea('0x2b')](db[_0xf8ea('0x26')][_0xf8ea('0x41')]);_0x811c71['query']=_[_0xf8ea('0x2b')](_0x1625c4[_0xf8ea('0x2e')]);_0x811c71[_0xf8ea('0x2c')]=_[_0xf8ea('0x2d')](_0x811c71[_0xf8ea('0x2a')],_0x811c71[_0xf8ea('0x2e')]);_0x30daf6[_0xf8ea('0x30')]=_['intersection'](_0x811c71[_0xf8ea('0x2a')],qs[_0xf8ea('0x2f')](_0x1625c4['query'][_0xf8ea('0x2f')]));_0x30daf6['attributes']=_0x30daf6['attributes'][_0xf8ea('0x31')]?_0x30daf6[_0xf8ea('0x30')]:_0x811c71[_0xf8ea('0x2a')];if(_0x1625c4['query'][_0xf8ea('0x3a')]){_0x30daf6['include']=[{'all':!![]}];}_0x30daf6=_[_0xf8ea('0x38')]({},_0x30daf6,_0x1625c4[_0xf8ea('0x42')]);return db[_0xf8ea('0x26')][_0xf8ea('0x43')](_0x30daf6)[_0xf8ea('0x1f')](handleEntityNotFound(_0x5ceb0e,null))[_0xf8ea('0x1f')](respondWithResult(_0x5ceb0e,null))[_0xf8ea('0x3e')](handleError(_0x5ceb0e,null));};exports['create']=function(_0x31fa1c,_0x58d065){return db['ServicenowAccount']['create'](_0x31fa1c[_0xf8ea('0x44')],{})['then'](respondWithResult(_0x58d065,0xc9))[_0xf8ea('0x3e')](handleError(_0x58d065,null));};exports[_0xf8ea('0x45')]=function(_0x38f1b6,_0x3e42ca){if(_0x38f1b6[_0xf8ea('0x44')]['id']){delete _0x38f1b6[_0xf8ea('0x44')]['id'];}return db[_0xf8ea('0x26')]['find']({'where':{'id':_0x38f1b6[_0xf8ea('0x40')]['id']}})[_0xf8ea('0x1f')](handleEntityNotFound(_0x3e42ca,null))[_0xf8ea('0x1f')](saveUpdates(_0x38f1b6[_0xf8ea('0x44')],null))[_0xf8ea('0x1f')](respondWithResult(_0x3e42ca,null))[_0xf8ea('0x3e')](handleError(_0x3e42ca,null));};exports[_0xf8ea('0x46')]=function(_0x695fa,_0x224783){return db[_0xf8ea('0x26')][_0xf8ea('0x43')]({'where':{'id':_0x695fa[_0xf8ea('0x40')]['id']}})['then'](handleEntityNotFound(_0x224783,null))[_0xf8ea('0x1f')](removeEntity(_0x224783,null))[_0xf8ea('0x3e')](handleError(_0x224783,null));};exports[_0xf8ea('0x47')]=function(_0x4e053d,_0xcf1449,_0x463a50){var _0x26ec89={};var _0x4576fc={};var _0x53a58b;var _0x4b4a14;return db[_0xf8ea('0x26')][_0xf8ea('0x48')]({'where':{'id':_0x4e053d[_0xf8ea('0x40')]['id']}})[_0xf8ea('0x1f')](handleEntityNotFound(_0xcf1449,null))[_0xf8ea('0x1f')](function(_0x3245e2){if(_0x3245e2){_0x53a58b=_0x3245e2;_0x4576fc[_0xf8ea('0x2a')]=_[_0xf8ea('0x2b')](db[_0xf8ea('0x49')][_0xf8ea('0x41')]);_0x4576fc[_0xf8ea('0x2e')]=_[_0xf8ea('0x2b')](_0x4e053d[_0xf8ea('0x2e')]);_0x4576fc[_0xf8ea('0x2c')]=_[_0xf8ea('0x2d')](_0x4576fc[_0xf8ea('0x2a')],_0x4576fc['query']);_0x26ec89[_0xf8ea('0x30')]=_[_0xf8ea('0x2d')](_0x4576fc[_0xf8ea('0x2a')],qs[_0xf8ea('0x2f')](_0x4e053d[_0xf8ea('0x2e')][_0xf8ea('0x2f')]));_0x26ec89[_0xf8ea('0x30')]=_0x26ec89['attributes'][_0xf8ea('0x31')]?_0x26ec89['attributes']:_0x4576fc['model'];_0x26ec89[_0xf8ea('0x33')]=qs['sort'](_0x4e053d[_0xf8ea('0x2e')][_0xf8ea('0x34')]);_0x26ec89['where']=qs['filters'](_[_0xf8ea('0x36')](_0x4e053d['query'],_0x4576fc[_0xf8ea('0x2c')]));if(_0x4e053d[_0xf8ea('0x2e')][_0xf8ea('0x37')]){_0x26ec89[_0xf8ea('0x35')]=_[_0xf8ea('0x38')](_0x26ec89[_0xf8ea('0x35')],{'$or':_[_0xf8ea('0x25')](_0x26ec89[_0xf8ea('0x30')],function(_0x3ff254){var _0x5956ea={};_0x5956ea[_0x3ff254]={'$like':'%'+_0x4e053d[_0xf8ea('0x2e')][_0xf8ea('0x37')]+'%'};return _0x5956ea;})});}_0x26ec89=_[_0xf8ea('0x38')]({},_0x26ec89,_0x4e053d[_0xf8ea('0x42')]);return _0x53a58b['getConfigurations'](_0x26ec89);}})[_0xf8ea('0x1f')](function(_0x1d0ca3){if(_0x1d0ca3){_0x4b4a14=_0x1d0ca3[_0xf8ea('0x31')];if(!_0x4e053d['query'][_0xf8ea('0x4a')](_0xf8ea('0x32'))){_0x26ec89[_0xf8ea('0x1b')]=qs[_0xf8ea('0x1b')](_0x4e053d[_0xf8ea('0x2e')][_0xf8ea('0x1b')]);_0x26ec89['offset']=qs[_0xf8ea('0x1a')](_0x4e053d[_0xf8ea('0x2e')][_0xf8ea('0x1a')]);}return _0x53a58b[_0xf8ea('0x47')](_0x26ec89);}})[_0xf8ea('0x1f')](function(_0x370245){if(_0x370245){return _0x370245?{'count':_0x4b4a14,'rows':_0x370245}:null;}})['then'](respondWithResult(_0xcf1449,null))['catch'](handleError(_0xcf1449,null));};exports[_0xf8ea('0x4b')]=function(_0x5c6ddf,_0x1adceb,_0x7b8548){if(_0x5c6ddf[_0xf8ea('0x44')]['id']){delete _0x5c6ddf[_0xf8ea('0x44')]['id'];}return db[_0xf8ea('0x26')][_0xf8ea('0x48')]({'where':{'id':_0x5c6ddf[_0xf8ea('0x40')]['id']}})[_0xf8ea('0x1f')](handleEntityNotFound(_0x1adceb,null))[_0xf8ea('0x1f')](function(_0x2f54e8){if(_0x2f54e8){_0x5c6ddf['body'][_0xf8ea('0x4c')]=_0x2f54e8['id'];_0x5c6ddf['body']['Subjects']=integrations[_0xf8ea('0x4d')](_0x5c6ddf[_0xf8ea('0x44')]['channel'],_0x5c6ddf[_0xf8ea('0x44')]['type']);_0x5c6ddf['body'][_0xf8ea('0x4e')]=integrations[_0xf8ea('0x4f')](_0x5c6ddf['body'][_0xf8ea('0x50')],_0x5c6ddf[_0xf8ea('0x44')][_0xf8ea('0x28')]);return db[_0xf8ea('0x49')][_0xf8ea('0x51')](_0x5c6ddf[_0xf8ea('0x44')],{'include':[{'model':db[_0xf8ea('0x52')],'as':'Subjects'},{'model':db[_0xf8ea('0x52')],'as':_0xf8ea('0x4e')}]});}return null;})['then'](respondWithResult(_0x1adceb,null))[_0xf8ea('0x3e')](handleError(_0x1adceb,null));};exports[_0xf8ea('0x53')]=function(_0x4de1d4,_0x104d05,_0xaddef4){var _0x551d1d=[_0xf8ea('0x54'),'hold_reason',_0xf8ea('0x55'),_0xf8ea('0x56'),_0xf8ea('0x57'),'notify',_0xf8ea('0x58'),'severity',_0xf8ea('0x59')];var _0x5e701e=['parent','made_sla',_0xf8ea('0x5a'),_0xf8ea('0x5b'),_0xf8ea('0x5c'),_0xf8ea('0x5d'),_0xf8ea('0x5e'),_0xf8ea('0x5f'),_0xf8ea('0x60'),_0xf8ea('0x61'),_0xf8ea('0x62'),'sys_updated_by',_0xf8ea('0x63'),_0xf8ea('0x64'),_0xf8ea('0x65'),'sys_domain',_0xf8ea('0x66'),_0xf8ea('0x67'),_0xf8ea('0x55'),'order',_0xf8ea('0x68'),_0xf8ea('0x69'),_0xf8ea('0x6a'),_0xf8ea('0x6b'),_0xf8ea('0x6c'),'active',_0xf8ea('0x6d'),_0xf8ea('0x6e'),_0xf8ea('0x6f'),_0xf8ea('0x70'),_0xf8ea('0x71'),_0xf8ea('0x72'),'expected_start',_0xf8ea('0x73'),'business_duration',_0xf8ea('0x74'),'work_end','reopened_time',_0xf8ea('0x75'),_0xf8ea('0x76'),'approval_set','subcategory','work_notes',_0xf8ea('0x77'),'close_code','correlation_display',_0xf8ea('0x78'),_0xf8ea('0x79'),_0xf8ea('0x7a'),'business_stc',_0xf8ea('0x7b'),'description','calendar_duration','notify',_0xf8ea('0x7c'),'close_notes','closed_by','follow_up',_0xf8ea('0x7d'),'sys_id',_0xf8ea('0x7e'),'reopened_by',_0xf8ea('0x58'),_0xf8ea('0x7f'),_0xf8ea('0x80'),_0xf8ea('0x81'),_0xf8ea('0x82'),_0xf8ea('0x83'),'assigned_to',_0xf8ea('0x84'),_0xf8ea('0x85'),_0xf8ea('0x86'),_0xf8ea('0x87'),'comments_and_work_notes',_0xf8ea('0x88'),_0xf8ea('0x89'),'reopen_count','sys_tags',_0xf8ea('0x8a'),_0xf8ea('0x8b'),_0xf8ea('0x8c'),_0xf8ea('0x8d'),_0xf8ea('0x59')];var _0x14d51c='';var _0x4280bc='';var _0x4ba8d7=[];var _0x3bfb3f='';var _0x58bbf4='';var _0x3b7b15=[];var _0x9121b6='';var _0x5f3d89='';var _0xd7e9fe={};var _0x1daf34='';return db[_0xf8ea('0x26')][_0xf8ea('0x48')]({'where':{'id':_0x4de1d4[_0xf8ea('0x40')]['id']},'attributes':['id','username',_0xf8ea('0x8e'),'email',_0xf8ea('0x8f'),'serverUrl']})[_0xf8ea('0x1f')](handleEntityNotFound(_0x104d05,null))['then'](function(_0xa37696){if(_0xa37696){_0x1daf34=_0xa37696[_0xf8ea('0x8f')];var _0x551731=_0x1daf34[_0xf8ea('0x90')](-0x1);if(_0x551731==='/'){_0x1daf34=_0x1daf34[_0xf8ea('0x91')](0x0,_0x1daf34['lastIndexOf'](_0x551731));}_0x5f3d89=util[_0xf8ea('0x92')](_0xf8ea('0x93'),_0x1daf34);_0x9121b6=util[_0xf8ea('0x92')](_0xf8ea('0x94'),_0x1daf34);_0xd7e9fe={'user':_0xa37696['username'],'pass':_0xa37696[_0xf8ea('0x8e')]};var _0x389c0f={'method':'GET','uri':_0x5f3d89+_0xf8ea('0x95'),'auth':_0xd7e9fe,'json':!![]};return rp(_0x389c0f);}})[_0xf8ea('0x1f')](function(_0x17a534){if(_0x17a534[_0xf8ea('0x96')][_0xf8ea('0x31')]>0x0){_0x14d51c=_0x17a534[_0xf8ea('0x96')];}console['log']('incident\x20table\x20objects',_0x14d51c);_0x3b7b15=[];_0x4280bc=Object[_0xf8ea('0x97')]([],_0x14d51c);_[_0xf8ea('0x98')](_0x4280bc,function(_0x2746ff){return!_0x551d1d[_0xf8ea('0x99')](_0x2746ff[_0xf8ea('0x23')]);});_0x4280bc[_0xf8ea('0x9a')](function(_0x17cddc){var _0x14f28b=createFieldObject(_0x9121b6,_0xd7e9fe,_0x17cddc['internalType'],_0x17cddc[_0xf8ea('0x23')],_0x17cddc[_0xf8ea('0x9b')],![]);_0x3b7b15[_0xf8ea('0x9c')](_0x14f28b);});return Promise['all'](_0x3b7b15);})['then'](function(_0x24f720){_0x4ba8d7=_0x24f720;_0x3bfb3f=Object['assign']([],_0x14d51c);console[_0xf8ea('0x9d')](_0xf8ea('0x9e'),_0x14d51c);_['remove'](_0x3bfb3f,function(_0x54deba){return _0x5e701e['includes'](_0x54deba[_0xf8ea('0x23')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3bfb3f);_0x3b7b15=[];_0x3bfb3f[_0xf8ea('0x9a')](function(_0x1a6cd1){var _0x1f223c=createFieldObject(_0x9121b6,_0xd7e9fe,_0x1a6cd1[_0xf8ea('0x9f')],_0x1a6cd1['name'],_0x1a6cd1[_0xf8ea('0x9b')],!![]);_0x3b7b15[_0xf8ea('0x9c')](_0x1f223c);});return Promise['all'](_0x3b7b15);})['then'](function(_0x5121d3){_0x58bbf4=_0x5121d3;var _0x2e36c3=_0x4ba8d7[_0xf8ea('0xa0')](_0x58bbf4);return{'count':_0x2e36c3['length'],'rows':_0x2e36c3};})[_0xf8ea('0x1f')](respondWithResult(_0x104d05,null))[_0xf8ea('0x3e')](function(_0x3773a0){console[_0xf8ea('0x9d')](_0xf8ea('0xa1')+_0x3773a0);var _0x27a9c6=_0x4de1d4[_0xf8ea('0x2e')]['test']?0x1f4:_0x3773a0[_0xf8ea('0xa2')]||0x1f4;logger[_0xf8ea('0x21')](_0x3773a0[_0xf8ea('0x22')]);delete _0x3773a0[_0xf8ea('0x23')];if(_0x27a9c6===0x191){_0x27a9c6=0x190;}_0x104d05[_0xf8ea('0x18')](_0x27a9c6)[_0xf8ea('0xa3')](_0x4de1d4['query'][_0xf8ea('0xa4')]?{'message':_0xf8ea('0xa5'),'statusCode':_0x3773a0['statusCode']}:_0x3773a0);});};function createFieldObject(_0x2517ec,_0x428cb4,_0x1e1997,_0x3887fc,_0x465a80,_0x2ec6db){return new Promise(function(_0x26efe9,_0x28e1d0){var _0xe71e3a={'id':_0x3887fc,'name':_0x465a80,'custom':_0x2ec6db};if(_0x1e1997===_0xf8ea('0xa6')){_0xe71e3a['options']=[{'name':'True','value':_0xf8ea('0xa7')},{'name':_0xf8ea('0xa8'),'value':'false'}];_0x26efe9(_0xe71e3a);}else{var _0x2f896b={'method':_0xf8ea('0xa9'),'uri':_0x2517ec+_0xf8ea('0xaa')+_0x3887fc,'auth':_0x428cb4,'json':!![]};return rp(_0x2f896b)[_0xf8ea('0x1f')](function(_0x477749){var _0x3e7ab5=[];if(_0x477749[_0xf8ea('0x96')][_0xf8ea('0x31')]>0x0){_0x477749[_0xf8ea('0x96')][_0xf8ea('0x9a')](function(_0x30ce68){if(_0x30ce68[_0xf8ea('0xab')]===_0xf8ea('0xac')){var _0x6bd4dd={'name':_0x30ce68[_0xf8ea('0x9b')],'value':_0x30ce68[_0xf8ea('0xad')]};_0x3e7ab5[_0xf8ea('0x9c')](_0x6bd4dd);}});}_0xe71e3a[_0xf8ea('0x42')]=_0x3e7ab5;if(_0xe71e3a[_0xf8ea('0x42')][_0xf8ea('0x31')]>0x0){_0x26efe9(_0xe71e3a);}else{if(_0x2ec6db==![]){_0x26efe9();}else{_0x26efe9(_0xe71e3a);}}});}});} \ No newline at end of file +var _0x7c93=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','keys','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','username','GET','result','log','incident\x20table\x20objects','remove','forEach','internalType','label','all','assign','TCL:\x20_object','includes','push','concat','ServiceNow\x20error:\x20','test','statusCode','error','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x49a4d1,_0x2bc356){var _0x13699d=function(_0x12f762){while(--_0x12f762){_0x49a4d1['push'](_0x49a4d1['shift']());}};_0x13699d(++_0x2bc356);}(_0x7c93,0x165));var _0x37c9=function(_0xb43734,_0x858446){_0xb43734=_0xb43734-0x0;var _0x1431db=_0x7c93[_0xb43734];return _0x1431db;};'use strict';var emlformat=require(_0x37c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x37c9('0x1'));var jsonpatch=require(_0x37c9('0x2'));var rp=require('request-promise');var moment=require(_0x37c9('0x3'));var BPromise=require(_0x37c9('0x4'));var Mustache=require(_0x37c9('0x5'));var util=require(_0x37c9('0x6'));var path=require(_0x37c9('0x7'));var sox=require(_0x37c9('0x8'));var csv=require(_0x37c9('0x9'));var ejs=require(_0x37c9('0xa'));var fs=require('fs');var fs_extra=require(_0x37c9('0xb'));var _=require(_0x37c9('0xc'));var squel=require(_0x37c9('0xd'));var crypto=require(_0x37c9('0xe'));var jsforce=require(_0x37c9('0xf'));var deskjs=require(_0x37c9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x37c9('0x11'));var Papa=require(_0x37c9('0x12'));var Redis=require('ioredis');var authService=require(_0x37c9('0x13'));var qs=require(_0x37c9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37c9('0x15'));var logger=require('../../config/logger')(_0x37c9('0x16'));var utils=require('../../config/utils');var config=require(_0x37c9('0x17'));var licenseUtil=require(_0x37c9('0x18'));var db=require(_0x37c9('0x19'))['db'];var integrations=require(_0x37c9('0x1a'));function respondWithStatusCode(_0x56415a,_0x1e894b){_0x1e894b=_0x1e894b||0xcc;return function(_0x594ed1){if(_0x594ed1){return _0x56415a['sendStatus'](_0x1e894b);}return _0x56415a[_0x37c9('0x1b')](_0x1e894b)[_0x37c9('0x1c')]();};}function respondWithResult(_0x453e82,_0x39af8a){_0x39af8a=_0x39af8a||0xc8;return function(_0x23f0d5){if(_0x23f0d5){return _0x453e82['status'](_0x39af8a)[_0x37c9('0x1d')](_0x23f0d5);}};}function respondWithFilteredResult(_0x510575,_0x4315b7){return function(_0x20d8ed){if(_0x20d8ed){var _0x2f4f24=typeof _0x4315b7[_0x37c9('0x1e')]==='undefined'&&typeof _0x4315b7[_0x37c9('0x1f')]===_0x37c9('0x20');var _0x74e510=_0x20d8ed['count'];var _0x2ff253=_0x2f4f24?0x0:_0x4315b7['offset'];var _0x1d53c1=_0x2f4f24?_0x20d8ed[_0x37c9('0x21')]:_0x4315b7[_0x37c9('0x1e')]+_0x4315b7[_0x37c9('0x1f')];var _0x4ce029;if(_0x1d53c1>=_0x74e510){_0x1d53c1=_0x74e510;_0x4ce029=0xc8;}else{_0x4ce029=0xce;}_0x510575[_0x37c9('0x1b')](_0x4ce029);return _0x510575[_0x37c9('0x22')](_0x37c9('0x23'),_0x2ff253+'-'+_0x1d53c1+'/'+_0x74e510)[_0x37c9('0x1d')](_0x20d8ed);}return null;};}function patchUpdates(_0x265c47){return function(_0x2ef49e){try{jsonpatch['apply'](_0x2ef49e,_0x265c47,!![]);}catch(_0xfbba97){return BPromise[_0x37c9('0x24')](_0xfbba97);}return _0x2ef49e[_0x37c9('0x25')]();};}function saveUpdates(_0x4b68f0,_0x2a5f4b){return function(_0x5d1530){if(_0x5d1530){return _0x5d1530[_0x37c9('0x26')](_0x4b68f0)[_0x37c9('0x27')](function(_0x2e90d0){return _0x2e90d0;});}return null;};}function removeEntity(_0x468b56,_0x3f7479){return function(_0x1687bd){if(_0x1687bd){return _0x1687bd[_0x37c9('0x28')]()[_0x37c9('0x27')](function(){_0x468b56[_0x37c9('0x1b')](0xcc)[_0x37c9('0x1c')]();});}};}function handleEntityNotFound(_0xdbbd10,_0x27ca2d){return function(_0x5d00c3){if(!_0x5d00c3){_0xdbbd10[_0x37c9('0x29')](0x194);}return _0x5d00c3;};}function handleError(_0x4540c3,_0x4f9b8a){_0x4f9b8a=_0x4f9b8a||0x1f4;return function(_0x50b74a){logger['error'](_0x50b74a[_0x37c9('0x2a')]);if(_0x50b74a[_0x37c9('0x2b')]){delete _0x50b74a[_0x37c9('0x2b')];}_0x4540c3[_0x37c9('0x1b')](_0x4f9b8a)[_0x37c9('0x2c')](_0x50b74a);};}exports['index']=function(_0xa1196e,_0x1596ce){var _0x31c8ef={},_0x271c3d={},_0x2a7d40={'count':0x0,'rows':[]};var _0x156e66=_[_0x37c9('0x2d')](db[_0x37c9('0x2e')][_0x37c9('0x2f')],function(_0x6ab19f){return{'name':_0x6ab19f[_0x37c9('0x30')],'type':_0x6ab19f['type'][_0x37c9('0x31')]};});_0x271c3d['model']=_[_0x37c9('0x2d')](_0x156e66,_0x37c9('0x2b'));_0x271c3d['query']=_[_0x37c9('0x32')](_0xa1196e['query']);_0x271c3d[_0x37c9('0x33')]=_[_0x37c9('0x34')](_0x271c3d[_0x37c9('0x35')],_0x271c3d[_0x37c9('0x36')]);_0x31c8ef[_0x37c9('0x37')]=_[_0x37c9('0x34')](_0x271c3d[_0x37c9('0x35')],qs[_0x37c9('0x38')](_0xa1196e[_0x37c9('0x36')][_0x37c9('0x38')]));_0x31c8ef[_0x37c9('0x37')]=_0x31c8ef[_0x37c9('0x37')]['length']?_0x31c8ef[_0x37c9('0x37')]:_0x271c3d[_0x37c9('0x35')];if(!_0xa1196e[_0x37c9('0x36')]['hasOwnProperty'](_0x37c9('0x39'))){_0x31c8ef[_0x37c9('0x1f')]=qs[_0x37c9('0x1f')](_0xa1196e['query'][_0x37c9('0x1f')]);_0x31c8ef[_0x37c9('0x1e')]=qs['offset'](_0xa1196e[_0x37c9('0x36')][_0x37c9('0x1e')]);}_0x31c8ef[_0x37c9('0x3a')]=qs['sort'](_0xa1196e[_0x37c9('0x36')][_0x37c9('0x3b')]);_0x31c8ef[_0x37c9('0x3c')]=qs[_0x37c9('0x33')](_[_0x37c9('0x3d')](_0xa1196e['query'],_0x271c3d[_0x37c9('0x33')]),_0x156e66);if(_0xa1196e['query'][_0x37c9('0x3e')]){_0x31c8ef[_0x37c9('0x3c')]=_['merge'](_0x31c8ef[_0x37c9('0x3c')],{'$or':_['map'](_0x156e66,function(_0x313b79){if(_0x313b79[_0x37c9('0x3f')]!==_0x37c9('0x40')){var _0x2044a2={};_0x2044a2[_0x313b79[_0x37c9('0x2b')]]={'$like':'%'+_0xa1196e['query'][_0x37c9('0x3e')]+'%'};return _0x2044a2;}})});}_0x31c8ef=_[_0x37c9('0x41')]({},_0x31c8ef,_0xa1196e[_0x37c9('0x42')]);var _0x41e896={'where':_0x31c8ef[_0x37c9('0x3c')]};return db['ServicenowAccount'][_0x37c9('0x21')](_0x41e896)[_0x37c9('0x27')](function(_0x309936){_0x2a7d40[_0x37c9('0x21')]=_0x309936;if(_0xa1196e[_0x37c9('0x36')]['includeAll']){_0x31c8ef[_0x37c9('0x43')]=[{'all':!![]}];}return db[_0x37c9('0x2e')][_0x37c9('0x44')](_0x31c8ef);})[_0x37c9('0x27')](function(_0x3cf324){_0x2a7d40[_0x37c9('0x45')]=_0x3cf324;return _0x2a7d40;})[_0x37c9('0x27')](respondWithFilteredResult(_0x1596ce,_0x31c8ef))[_0x37c9('0x46')](handleError(_0x1596ce,null));};exports[_0x37c9('0x47')]=function(_0x12de2c,_0x293ade){var _0x187c8c={'raw':![],'where':{'id':_0x12de2c[_0x37c9('0x48')]['id']}},_0x3886f9={};_0x3886f9[_0x37c9('0x35')]=_[_0x37c9('0x32')](db[_0x37c9('0x2e')]['rawAttributes']);_0x3886f9['query']=_[_0x37c9('0x32')](_0x12de2c['query']);_0x3886f9[_0x37c9('0x33')]=_[_0x37c9('0x34')](_0x3886f9[_0x37c9('0x35')],_0x3886f9[_0x37c9('0x36')]);_0x187c8c[_0x37c9('0x37')]=_[_0x37c9('0x34')](_0x3886f9[_0x37c9('0x35')],qs[_0x37c9('0x38')](_0x12de2c['query']['fields']));_0x187c8c['attributes']=_0x187c8c[_0x37c9('0x37')][_0x37c9('0x49')]?_0x187c8c[_0x37c9('0x37')]:_0x3886f9[_0x37c9('0x35')];if(_0x12de2c[_0x37c9('0x36')][_0x37c9('0x4a')]){_0x187c8c[_0x37c9('0x43')]=[{'all':!![]}];}_0x187c8c=_[_0x37c9('0x41')]({},_0x187c8c,_0x12de2c[_0x37c9('0x42')]);return db[_0x37c9('0x2e')][_0x37c9('0x4b')](_0x187c8c)[_0x37c9('0x27')](handleEntityNotFound(_0x293ade,null))[_0x37c9('0x27')](respondWithResult(_0x293ade,null))[_0x37c9('0x46')](handleError(_0x293ade,null));};exports[_0x37c9('0x4c')]=function(_0x109268,_0x1c536d){return db['ServicenowAccount'][_0x37c9('0x4c')](_0x109268['body'],{})[_0x37c9('0x27')](respondWithResult(_0x1c536d,0xc9))[_0x37c9('0x46')](handleError(_0x1c536d,null));};exports[_0x37c9('0x26')]=function(_0x97f6c8,_0x231fcb){if(_0x97f6c8[_0x37c9('0x4d')]['id']){delete _0x97f6c8['body']['id'];}return db[_0x37c9('0x2e')]['find']({'where':{'id':_0x97f6c8[_0x37c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x231fcb,null))[_0x37c9('0x27')](saveUpdates(_0x97f6c8[_0x37c9('0x4d')],null))[_0x37c9('0x27')](respondWithResult(_0x231fcb,null))[_0x37c9('0x46')](handleError(_0x231fcb,null));};exports[_0x37c9('0x28')]=function(_0x5a1216,_0xb2cbd5){return db[_0x37c9('0x2e')]['find']({'where':{'id':_0x5a1216['params']['id']}})[_0x37c9('0x27')](handleEntityNotFound(_0xb2cbd5,null))[_0x37c9('0x27')](removeEntity(_0xb2cbd5,null))['catch'](handleError(_0xb2cbd5,null));};exports[_0x37c9('0x4e')]=function(_0x33c99d,_0x9034a7,_0x25361d){var _0x2888ab={};var _0x17d67e={};var _0x9983a1;var _0xcd75c9;return db[_0x37c9('0x2e')]['findOne']({'where':{'id':_0x33c99d[_0x37c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x9034a7,null))[_0x37c9('0x27')](function(_0x5b652d){if(_0x5b652d){_0x9983a1=_0x5b652d;_0x17d67e[_0x37c9('0x35')]=_[_0x37c9('0x32')](db['ServicenowConfiguration']['rawAttributes']);_0x17d67e[_0x37c9('0x36')]=_[_0x37c9('0x32')](_0x33c99d['query']);_0x17d67e[_0x37c9('0x33')]=_[_0x37c9('0x34')](_0x17d67e[_0x37c9('0x35')],_0x17d67e[_0x37c9('0x36')]);_0x2888ab[_0x37c9('0x37')]=_['intersection'](_0x17d67e[_0x37c9('0x35')],qs[_0x37c9('0x38')](_0x33c99d[_0x37c9('0x36')]['fields']));_0x2888ab['attributes']=_0x2888ab['attributes'][_0x37c9('0x49')]?_0x2888ab['attributes']:_0x17d67e[_0x37c9('0x35')];_0x2888ab['order']=qs[_0x37c9('0x3b')](_0x33c99d[_0x37c9('0x36')][_0x37c9('0x3b')]);_0x2888ab[_0x37c9('0x3c')]=qs['filters'](_[_0x37c9('0x3d')](_0x33c99d[_0x37c9('0x36')],_0x17d67e[_0x37c9('0x33')]));if(_0x33c99d['query'][_0x37c9('0x3e')]){_0x2888ab[_0x37c9('0x3c')]=_['merge'](_0x2888ab[_0x37c9('0x3c')],{'$or':_[_0x37c9('0x2d')](_0x2888ab[_0x37c9('0x37')],function(_0x5397f4){var _0x3201bc={};_0x3201bc[_0x5397f4]={'$like':'%'+_0x33c99d[_0x37c9('0x36')][_0x37c9('0x3e')]+'%'};return _0x3201bc;})});}_0x2888ab=_[_0x37c9('0x41')]({},_0x2888ab,_0x33c99d['options']);return _0x9983a1[_0x37c9('0x4e')](_0x2888ab);}})[_0x37c9('0x27')](function(_0x5c0155){if(_0x5c0155){_0xcd75c9=_0x5c0155['length'];if(!_0x33c99d[_0x37c9('0x36')]['hasOwnProperty'](_0x37c9('0x39'))){_0x2888ab[_0x37c9('0x1f')]=qs['limit'](_0x33c99d[_0x37c9('0x36')]['limit']);_0x2888ab[_0x37c9('0x1e')]=qs['offset'](_0x33c99d[_0x37c9('0x36')][_0x37c9('0x1e')]);}return _0x9983a1[_0x37c9('0x4e')](_0x2888ab);}})[_0x37c9('0x27')](function(_0x54f6e4){if(_0x54f6e4){return _0x54f6e4?{'count':_0xcd75c9,'rows':_0x54f6e4}:null;}})[_0x37c9('0x27')](respondWithResult(_0x9034a7,null))[_0x37c9('0x46')](handleError(_0x9034a7,null));};exports[_0x37c9('0x4f')]=function(_0x1c3303,_0x525adb,_0x39cf38){if(_0x1c3303[_0x37c9('0x4d')]['id']){delete _0x1c3303['body']['id'];}return db['ServicenowAccount'][_0x37c9('0x50')]({'where':{'id':_0x1c3303[_0x37c9('0x48')]['id']}})[_0x37c9('0x27')](handleEntityNotFound(_0x525adb,null))['then'](function(_0x106ae7){if(_0x106ae7){_0x1c3303[_0x37c9('0x4d')][_0x37c9('0x51')]=_0x106ae7['id'];_0x1c3303[_0x37c9('0x4d')][_0x37c9('0x52')]=integrations[_0x37c9('0x53')](_0x1c3303['body'][_0x37c9('0x54')],_0x1c3303['body'][_0x37c9('0x3f')]);_0x1c3303[_0x37c9('0x4d')][_0x37c9('0x55')]=integrations[_0x37c9('0x56')](_0x1c3303[_0x37c9('0x4d')][_0x37c9('0x54')],_0x1c3303[_0x37c9('0x4d')]['type']);return db['ServicenowConfiguration'][_0x37c9('0x4c')](_0x1c3303[_0x37c9('0x4d')],{'include':[{'model':db['ServicenowField'],'as':_0x37c9('0x52')},{'model':db[_0x37c9('0x57')],'as':_0x37c9('0x55')}]});}return null;})[_0x37c9('0x27')](respondWithResult(_0x525adb,null))[_0x37c9('0x46')](handleError(_0x525adb,null));};exports[_0x37c9('0x58')]=function(_0x165eaa,_0x1996ac,_0x472d05){var _0x414588=['made_sla',_0x37c9('0x59'),'knowledge',_0x37c9('0x5a'),_0x37c9('0x5b'),_0x37c9('0x5c'),_0x37c9('0x5d'),_0x37c9('0x5e'),_0x37c9('0x5f')];var _0x54cac4=[_0x37c9('0x60'),'made_sla',_0x37c9('0x61'),_0x37c9('0x62'),_0x37c9('0x63'),_0x37c9('0x64'),'child_incidents',_0x37c9('0x59'),'approval_history',_0x37c9('0x65'),_0x37c9('0x66'),_0x37c9('0x67'),_0x37c9('0x68'),_0x37c9('0x69'),_0x37c9('0x6a'),'sys_domain',_0x37c9('0x6b'),_0x37c9('0x6c'),'knowledge',_0x37c9('0x3a'),_0x37c9('0x6d'),_0x37c9('0x6e'),'cmdb_ci',_0x37c9('0x6f'),_0x37c9('0x70'),_0x37c9('0x71'),'work_notes_list',_0x37c9('0x72'),_0x37c9('0x73'),_0x37c9('0x74'),_0x37c9('0x75'),'time_worked','expected_start','opened_at','business_duration','group_list',_0x37c9('0x76'),_0x37c9('0x77'),_0x37c9('0x78'),_0x37c9('0x79'),_0x37c9('0x7a'),'subcategory',_0x37c9('0x7b'),_0x37c9('0x7c'),_0x37c9('0x5b'),'correlation_display',_0x37c9('0x7d'),_0x37c9('0x7e'),'assignment_group',_0x37c9('0x7f'),_0x37c9('0x80'),_0x37c9('0x81'),_0x37c9('0x82'),_0x37c9('0x5c'),_0x37c9('0x83'),'close_notes','closed_by',_0x37c9('0x84'),_0x37c9('0x85'),_0x37c9('0x86'),_0x37c9('0x87'),'reopened_by',_0x37c9('0x5d'),_0x37c9('0x88'),_0x37c9('0x89'),'company',_0x37c9('0x8a'),_0x37c9('0x8b'),_0x37c9('0x8c'),_0x37c9('0x5e'),_0x37c9('0x8d'),_0x37c9('0x8e'),'approval',_0x37c9('0x8f'),'due_date',_0x37c9('0x90'),'reopen_count',_0x37c9('0x91'),_0x37c9('0x92'),_0x37c9('0x93'),_0x37c9('0x94'),'location',_0x37c9('0x5f')];var _0x451ce0='';var _0x3f7e12='';var _0x36a6e9=[];var _0x1e3085='';var _0x5405c2='';var _0x1b0358=[];var _0x11a490='';var _0x44bea4='';var _0x1cb71a={};var _0x390aa3='';return db[_0x37c9('0x2e')]['findOne']({'where':{'id':_0x165eaa[_0x37c9('0x48')]['id']},'attributes':['id','username',_0x37c9('0x95'),_0x37c9('0x96'),_0x37c9('0x97'),_0x37c9('0x98')]})[_0x37c9('0x27')](handleEntityNotFound(_0x1996ac,null))[_0x37c9('0x27')](function(_0x137e64){if(_0x137e64){_0x390aa3=_0x137e64['remoteUri'];var _0x457b7e=_0x390aa3[_0x37c9('0x99')](-0x1);if(_0x457b7e==='/'){_0x390aa3=_0x390aa3[_0x37c9('0x9a')](0x0,_0x390aa3[_0x37c9('0x9b')](_0x457b7e));}_0x44bea4=util['format']('%s/api/now/doc/table/schema/',_0x390aa3);_0x11a490=util['format']('%s/api/now/table/',_0x390aa3);_0x1cb71a={'user':_0x137e64[_0x37c9('0x9c')],'pass':_0x137e64['password']};var _0x20a90a={'method':_0x37c9('0x9d'),'uri':_0x44bea4+'incident?sysparm_display_value=all','auth':_0x1cb71a,'json':!![]};return rp(_0x20a90a);}})['then'](function(_0x32e06a){if(_0x32e06a[_0x37c9('0x9e')][_0x37c9('0x49')]>0x0){_0x451ce0=_0x32e06a[_0x37c9('0x9e')];}console[_0x37c9('0x9f')](_0x37c9('0xa0'),_0x451ce0);_0x1b0358=[];_0x3f7e12=Object['assign']([],_0x451ce0);_[_0x37c9('0xa1')](_0x3f7e12,function(_0x50f725){return!_0x414588['includes'](_0x50f725[_0x37c9('0x2b')]);});_0x3f7e12[_0x37c9('0xa2')](function(_0x1ef363){var _0xa8f6e1=createFieldObject(_0x11a490,_0x1cb71a,_0x1ef363[_0x37c9('0xa3')],_0x1ef363[_0x37c9('0x2b')],_0x1ef363[_0x37c9('0xa4')],![]);_0x1b0358['push'](_0xa8f6e1);});return Promise[_0x37c9('0xa5')](_0x1b0358);})['then'](function(_0x5d4bab){_0x36a6e9=_0x5d4bab;_0x1e3085=Object[_0x37c9('0xa6')]([],_0x451ce0);console[_0x37c9('0x9f')](_0x37c9('0xa7'),_0x451ce0);_['remove'](_0x1e3085,function(_0x14b2cd){return _0x54cac4[_0x37c9('0xa8')](_0x14b2cd[_0x37c9('0x2b')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1e3085);_0x1b0358=[];_0x1e3085[_0x37c9('0xa2')](function(_0x35dc44){var _0x58cc71=createFieldObject(_0x11a490,_0x1cb71a,_0x35dc44[_0x37c9('0xa3')],_0x35dc44[_0x37c9('0x2b')],_0x35dc44[_0x37c9('0xa4')],!![]);_0x1b0358[_0x37c9('0xa9')](_0x58cc71);});return Promise['all'](_0x1b0358);})[_0x37c9('0x27')](function(_0x248fe2){_0x5405c2=_0x248fe2;var _0x4557bc=_0x36a6e9[_0x37c9('0xaa')](_0x5405c2);return{'count':_0x4557bc[_0x37c9('0x49')],'rows':_0x4557bc};})[_0x37c9('0x27')](respondWithResult(_0x1996ac,null))[_0x37c9('0x46')](function(_0x41330b){console[_0x37c9('0x9f')](_0x37c9('0xab')+_0x41330b);var _0x8b4770=_0x165eaa[_0x37c9('0x36')][_0x37c9('0xac')]?0x1f4:_0x41330b[_0x37c9('0xad')]||0x1f4;logger[_0x37c9('0xae')](_0x41330b[_0x37c9('0x2a')]);delete _0x41330b[_0x37c9('0x2b')];if(_0x8b4770===0x191){_0x8b4770=0x190;}_0x1996ac['status'](_0x8b4770)[_0x37c9('0x2c')](_0x165eaa['query'][_0x37c9('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x41330b[_0x37c9('0xad')]}:_0x41330b);});};function createFieldObject(_0x3753bd,_0x4bb143,_0x5172eb,_0x17fd1e,_0x33b4f1,_0x4382cf){return new Promise(function(_0x4ac72f,_0xaebedb){var _0x2f38f1={'id':_0x17fd1e,'name':_0x33b4f1,'custom':_0x4382cf};if(_0x5172eb===_0x37c9('0xaf')){_0x2f38f1['options']=[{'name':_0x37c9('0xb0'),'value':_0x37c9('0xb1')},{'name':_0x37c9('0xb2'),'value':'false'}];_0x4ac72f(_0x2f38f1);}else{var _0x393d57={'method':'GET','uri':_0x3753bd+_0x37c9('0xb3')+_0x17fd1e,'auth':_0x4bb143,'json':!![]};return rp(_0x393d57)['then'](function(_0x5b6c50){var _0x10338e=[];if(_0x5b6c50['result']['length']>0x0){_0x5b6c50[_0x37c9('0x9e')]['forEach'](function(_0x156e0b){if(_0x156e0b[_0x37c9('0xb4')]===_0x37c9('0xb5')){var _0x1ac46e={'name':_0x156e0b[_0x37c9('0xa4')],'value':_0x156e0b['value']};_0x10338e[_0x37c9('0xa9')](_0x1ac46e);}});}_0x2f38f1[_0x37c9('0x42')]=_0x10338e;if(_0x2f38f1[_0x37c9('0x42')][_0x37c9('0x49')]>0x0){_0x4ac72f(_0x2f38f1);}else{if(_0x4382cf==![]){_0x4ac72f();}else{_0x4ac72f(_0x2f38f1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4fbfa11..21ff7a0 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 _0x53ec=['path','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x53ec,0x192));var _0xc53e=function(_0x91fbc7,_0x207e4c){_0x91fbc7=_0x91fbc7-0x0;var _0x32a811=_0x53ec[_0x91fbc7];return _0x32a811;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('ServicenowAccount',attributes,{'tableName':_0xc53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['exports','define','ServicenowAccount','lodash','util','../../config/logger','api','bluebird','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x32c788,_0x23355d){var _0x593478=function(_0x1408bb){while(--_0x1408bb){_0x32c788['push'](_0x32c788['shift']());}};_0x593478(++_0x23355d);}(_0x4c60,0xc1));var _0x04c6=function(_0x784498,_0x53d13f){_0x784498=_0x784498-0x0;var _0x21038e=_0x4c60[_0x784498];return _0x21038e;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));var integrations=require(_0x04c6('0x6'));module[_0x04c6('0x7')]=function(_0x12bd5d,_0x2b9041){return _0x12bd5d[_0x04c6('0x8')](_0x04c6('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 8b6cc1c..6e8e8f9 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 _0xb663=['ShowServicenowAccount','ServicenowAccount','find','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','findAll','options','attributes','limit','include','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb663,0xd0));var _0x3b66=function(_0x3c5b45,_0x5ec647){_0x3c5b45=_0x3c5b45-0x0;var _0x320b6c=_0xb663[_0x3c5b45];return _0x320b6c;};'use strict';var _=require(_0x3b66('0x0'));var util=require(_0x3b66('0x1'));var moment=require(_0x3b66('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b66('0x3'));var fs=require('fs');var Redis=require(_0x3b66('0x4'));var db=require(_0x3b66('0x5'))['db'];var utils=require(_0x3b66('0x6'));var logger=require(_0x3b66('0x7'))(_0x3b66('0x8'));var config=require(_0x3b66('0x9'));var jayson=require(_0x3b66('0xa'));var client=jayson['client'][_0x3b66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e9732,_0x5327cf,_0x45cec7){return new BPromise(function(_0x3d9720,_0x12e5c4){return client['request'](_0x3e9732,_0x45cec7)[_0x3b66('0xc')](function(_0x5bfdfa){logger[_0x3b66('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x5327cf,_0x3b66('0xe'));logger[_0x3b66('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5327cf,_0x3b66('0xe'),JSON[_0x3b66('0x10')](_0x5bfdfa));if(_0x5bfdfa[_0x3b66('0x11')]){if(_0x5bfdfa['error'][_0x3b66('0x12')]===0x1f4){logger[_0x3b66('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x5327cf,_0x5bfdfa[_0x3b66('0x11')][_0x3b66('0x13')]);return _0x12e5c4(_0x5bfdfa['error'][_0x3b66('0x13')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5327cf,_0x5bfdfa[_0x3b66('0x11')][_0x3b66('0x13')]);return _0x3d9720(_0x5bfdfa['error'][_0x3b66('0x13')]);}else{logger[_0x3b66('0xd')](_0x3b66('0x14'),_0x5327cf,_0x3b66('0xe'));_0x3d9720(_0x5bfdfa[_0x3b66('0x15')][_0x3b66('0x13')]);}})[_0x3b66('0x16')](function(_0x3edbde){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5327cf,_0x3edbde);_0x12e5c4(_0x3edbde);});});}exports[_0x3b66('0x17')]=function(_0x2355f4){var _0x25c8f7=this;return new Promise(function(_0x50c779,_0xf11aac){return db['ServicenowAccount'][_0x3b66('0x18')]({'raw':_0x2355f4[_0x3b66('0x19')]?_0x2355f4['options']['raw']===undefined?!![]:![]:!![],'where':_0x2355f4[_0x3b66('0x19')]?_0x2355f4[_0x3b66('0x19')]['where']||null:null,'attributes':_0x2355f4[_0x3b66('0x19')]?_0x2355f4[_0x3b66('0x19')][_0x3b66('0x1a')]||null:null,'limit':_0x2355f4[_0x3b66('0x19')]?_0x2355f4[_0x3b66('0x19')][_0x3b66('0x1b')]||null:null,'include':_0x2355f4[_0x3b66('0x19')]?_0x2355f4['options'][_0x3b66('0x1c')]?_[_0x3b66('0x1d')](_0x2355f4[_0x3b66('0x19')]['include'],function(_0x172e9f){return{'model':db[_0x172e9f['model']],'as':_0x172e9f['as'],'attributes':_0x172e9f[_0x3b66('0x1a')],'include':_0x172e9f[_0x3b66('0x1c')]?_[_0x3b66('0x1d')](_0x172e9f['include'],function(_0x14df2f){return{'model':db[_0x14df2f['model']],'as':_0x14df2f['as'],'attributes':_0x14df2f[_0x3b66('0x1a')],'include':_0x14df2f['include']?_[_0x3b66('0x1d')](_0x14df2f[_0x3b66('0x1c')],function(_0x1dfb21){return{'model':db[_0x1dfb21['model']],'as':_0x1dfb21['as'],'attributes':_0x1dfb21[_0x3b66('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1238ff){logger[_0x3b66('0xd')](_0x3b66('0x17'),_0x2355f4);logger[_0x3b66('0xf')]('GetServicenowAccount',_0x2355f4,JSON['stringify'](_0x1238ff));_0x50c779(_0x1238ff);})[_0x3b66('0x16')](function(_0x16bc78){logger[_0x3b66('0x11')]('GetServicenowAccount',_0x16bc78[_0x3b66('0x13')],_0x2355f4);_0xf11aac(_0x25c8f7['error'](0x1f4,_0x16bc78[_0x3b66('0x13')]));});});};exports[_0x3b66('0x1e')]=function(_0x352f1a){var _0x2d5ed2=this;return new Promise(function(_0x54d5ed,_0x391d3c){return db[_0x3b66('0x1f')][_0x3b66('0x20')]({'raw':_0x352f1a[_0x3b66('0x19')]?_0x352f1a[_0x3b66('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x352f1a[_0x3b66('0x19')]?_0x352f1a[_0x3b66('0x19')]['where']||null:null,'attributes':_0x352f1a[_0x3b66('0x19')]?_0x352f1a[_0x3b66('0x19')][_0x3b66('0x1a')]||null:null,'include':_0x352f1a[_0x3b66('0x19')]?_0x352f1a[_0x3b66('0x19')]['include']?_[_0x3b66('0x1d')](_0x352f1a[_0x3b66('0x19')]['include'],function(_0x3276e8){return{'model':db[_0x3276e8[_0x3b66('0x21')]],'as':_0x3276e8['as'],'attributes':_0x3276e8[_0x3b66('0x1a')],'include':_0x3276e8[_0x3b66('0x1c')]?_[_0x3b66('0x1d')](_0x3276e8[_0x3b66('0x1c')],function(_0x36721d){return{'model':db[_0x36721d['model']],'as':_0x36721d['as'],'attributes':_0x36721d[_0x3b66('0x1a')],'include':_0x36721d[_0x3b66('0x1c')]?_[_0x3b66('0x1d')](_0x36721d[_0x3b66('0x1c')],function(_0x49c6d8){return{'model':db[_0x49c6d8[_0x3b66('0x21')]],'as':_0x49c6d8['as'],'attributes':_0x49c6d8[_0x3b66('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3b66('0xc')](function(_0x4c141d){logger['info'](_0x3b66('0x1e'),_0x352f1a);logger[_0x3b66('0xf')]('ShowServicenowAccount',_0x352f1a,JSON['stringify'](_0x4c141d));_0x54d5ed(_0x4c141d);})['catch'](function(_0x52b9e5){logger[_0x3b66('0x11')](_0x3b66('0x1e'),_0x52b9e5[_0x3b66('0x13')],_0x352f1a);_0x391d3c(_0x2d5ed2[_0x3b66('0x11')](0x1f4,_0x52b9e5[_0x3b66('0x13')]));});});}; \ No newline at end of file +var _0xc0de=['stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','request','info','debug','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowServicenowAccount','ServicenowAccount'];(function(_0x4e93d3,_0x2bd1b2){var _0x54b788=function(_0x133f75){while(--_0x133f75){_0x4e93d3['push'](_0x4e93d3['shift']());}};_0x54b788(++_0x2bd1b2);}(_0xc0de,0x121));var _0xec0d=function(_0x57e3af,_0x45d577){_0x57e3af=_0x57e3af-0x0;var _0x18a5ce=_0xc0de[_0x57e3af];return _0x18a5ce;};'use strict';var _=require(_0xec0d('0x0'));var util=require(_0xec0d('0x1'));var moment=require(_0xec0d('0x2'));var BPromise=require(_0xec0d('0x3'));var rs=require(_0xec0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec0d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec0d('0x6'));var config=require('../../config/environment');var jayson=require(_0xec0d('0x7'));var client=jayson[_0xec0d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301935,_0x5ec990,_0x54f61f){return new BPromise(function(_0x10f25e,_0x4630ec){return client[_0xec0d('0x9')](_0x301935,_0x54f61f)['then'](function(_0x33644a){logger[_0xec0d('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x5ec990,'request\x20sent');logger[_0xec0d('0xb')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5ec990,'request\x20sent',JSON['stringify'](_0x33644a));if(_0x33644a[_0xec0d('0xc')]){if(_0x33644a[_0xec0d('0xc')][_0xec0d('0xd')]===0x1f4){logger['error'](_0xec0d('0xe'),_0x5ec990,_0x33644a[_0xec0d('0xc')][_0xec0d('0xf')]);return _0x4630ec(_0x33644a[_0xec0d('0xc')][_0xec0d('0xf')]);}logger[_0xec0d('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x5ec990,_0x33644a[_0xec0d('0xc')][_0xec0d('0xf')]);return _0x10f25e(_0x33644a[_0xec0d('0xc')][_0xec0d('0xf')]);}else{logger[_0xec0d('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x5ec990,'request\x20sent');_0x10f25e(_0x33644a[_0xec0d('0x10')][_0xec0d('0xf')]);}})[_0xec0d('0x11')](function(_0xd92809){logger['error'](_0xec0d('0xe'),_0x5ec990,_0xd92809);_0x4630ec(_0xd92809);});});}exports[_0xec0d('0x12')]=function(_0x540a7f){var _0xb57cdc=this;return new Promise(function(_0x37ff96,_0x45d500){return db['ServicenowAccount'][_0xec0d('0x13')]({'raw':_0x540a7f[_0xec0d('0x14')]?_0x540a7f[_0xec0d('0x14')][_0xec0d('0x15')]===undefined?!![]:![]:!![],'where':_0x540a7f['options']?_0x540a7f[_0xec0d('0x14')][_0xec0d('0x16')]||null:null,'attributes':_0x540a7f[_0xec0d('0x14')]?_0x540a7f[_0xec0d('0x14')][_0xec0d('0x17')]||null:null,'limit':_0x540a7f['options']?_0x540a7f['options'][_0xec0d('0x18')]||null:null,'include':_0x540a7f[_0xec0d('0x14')]?_0x540a7f['options'][_0xec0d('0x19')]?_['map'](_0x540a7f['options'][_0xec0d('0x19')],function(_0x3a5ed3){return{'model':db[_0x3a5ed3[_0xec0d('0x1a')]],'as':_0x3a5ed3['as'],'attributes':_0x3a5ed3[_0xec0d('0x17')],'include':_0x3a5ed3[_0xec0d('0x19')]?_[_0xec0d('0x1b')](_0x3a5ed3['include'],function(_0x52b257){return{'model':db[_0x52b257[_0xec0d('0x1a')]],'as':_0x52b257['as'],'attributes':_0x52b257['attributes'],'include':_0x52b257[_0xec0d('0x19')]?_[_0xec0d('0x1b')](_0x52b257[_0xec0d('0x19')],function(_0x7add6){return{'model':db[_0x7add6['model']],'as':_0x7add6['as'],'attributes':_0x7add6[_0xec0d('0x17')]};}):[]};}):[]};}):[]:[]})[_0xec0d('0x1c')](function(_0x196859){logger[_0xec0d('0xa')](_0xec0d('0x12'),_0x540a7f);logger[_0xec0d('0xb')](_0xec0d('0x12'),_0x540a7f,JSON['stringify'](_0x196859));_0x37ff96(_0x196859);})['catch'](function(_0x41315f){logger[_0xec0d('0xc')](_0xec0d('0x12'),_0x41315f[_0xec0d('0xf')],_0x540a7f);_0x45d500(_0xb57cdc['error'](0x1f4,_0x41315f[_0xec0d('0xf')]));});});};exports[_0xec0d('0x1d')]=function(_0x22e6aa){var _0x1359f9=this;return new Promise(function(_0x18875e,_0x59d250){return db[_0xec0d('0x1e')]['find']({'raw':_0x22e6aa[_0xec0d('0x14')]?_0x22e6aa[_0xec0d('0x14')][_0xec0d('0x15')]===undefined?!![]:![]:!![],'where':_0x22e6aa[_0xec0d('0x14')]?_0x22e6aa[_0xec0d('0x14')][_0xec0d('0x16')]||null:null,'attributes':_0x22e6aa[_0xec0d('0x14')]?_0x22e6aa[_0xec0d('0x14')][_0xec0d('0x17')]||null:null,'include':_0x22e6aa[_0xec0d('0x14')]?_0x22e6aa[_0xec0d('0x14')][_0xec0d('0x19')]?_[_0xec0d('0x1b')](_0x22e6aa[_0xec0d('0x14')]['include'],function(_0x3f4f9a){return{'model':db[_0x3f4f9a[_0xec0d('0x1a')]],'as':_0x3f4f9a['as'],'attributes':_0x3f4f9a[_0xec0d('0x17')],'include':_0x3f4f9a['include']?_[_0xec0d('0x1b')](_0x3f4f9a[_0xec0d('0x19')],function(_0x209105){return{'model':db[_0x209105['model']],'as':_0x209105['as'],'attributes':_0x209105['attributes'],'include':_0x209105[_0xec0d('0x19')]?_[_0xec0d('0x1b')](_0x209105['include'],function(_0x1e73c3){return{'model':db[_0x1e73c3[_0xec0d('0x1a')]],'as':_0x1e73c3['as'],'attributes':_0x1e73c3[_0xec0d('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x292d0b){logger[_0xec0d('0xa')](_0xec0d('0x1d'),_0x22e6aa);logger[_0xec0d('0xb')](_0xec0d('0x1d'),_0x22e6aa,JSON[_0xec0d('0x1f')](_0x292d0b));_0x18875e(_0x292d0b);})[_0xec0d('0x11')](function(_0x41872d){logger[_0xec0d('0xc')](_0xec0d('0x1d'),_0x41872d['message'],_0x22e6aa);_0x59d250(_0x1359f9[_0xec0d('0xc')](0x1f4,_0x41872d['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8b115eb..ff85d96 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 _0x5c0a=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update'];(function(_0x1abd31,_0x1448d6){var _0x5e86c=function(_0x12c187){while(--_0x12c187){_0x1abd31['push'](_0x1abd31['shift']());}};_0x5e86c(++_0x1448d6);}(_0x5c0a,0x1c4));var _0xa5c0=function(_0x1b0c7c,_0x468383){_0x1b0c7c=_0x1b0c7c-0x0;var _0x44f649=_0x5c0a[_0x1b0c7c];return _0x44f649;};'use strict';var multer=require(_0xa5c0('0x0'));var util=require(_0xa5c0('0x1'));var path=require(_0xa5c0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa5c0('0x3'));var router=express[_0xa5c0('0x4')]();var fs_extra=require(_0xa5c0('0x5'));var auth=require(_0xa5c0('0x6'));var interaction=require(_0xa5c0('0x7'));var config=require(_0xa5c0('0x8'));var controller=require(_0xa5c0('0x9'));router[_0xa5c0('0xa')]('/',auth[_0xa5c0('0xb')](),controller[_0xa5c0('0xc')]);router[_0xa5c0('0xa')](_0xa5c0('0xd'),auth[_0xa5c0('0xb')](),controller[_0xa5c0('0xe')]);router['get'](_0xa5c0('0xf'),auth[_0xa5c0('0xb')](),controller[_0xa5c0('0x10')]);router[_0xa5c0('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xa5c0('0x11')]);router[_0xa5c0('0xa')](_0xa5c0('0x12'),auth[_0xa5c0('0xb')](),controller[_0xa5c0('0x13')]);router['post']('/',auth[_0xa5c0('0xb')](),controller[_0xa5c0('0x14')]);router[_0xa5c0('0x15')]('/:id',auth[_0xa5c0('0xb')](),controller[_0xa5c0('0x16')]);router[_0xa5c0('0x17')]('/:id',auth[_0xa5c0('0xb')](),controller[_0xa5c0('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6c5c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x30b47a,_0x184a6d){var _0x5831a6=function(_0x119a3f){while(--_0x119a3f){_0x30b47a['push'](_0x30b47a['shift']());}};_0x5831a6(++_0x184a6d);}(_0x6c5c,0x110));var _0xc6c5=function(_0x47c3e0,_0x47ae08){_0x47c3e0=_0x47c3e0-0x0;var _0x5e2f81=_0x6c5c[_0x47c3e0];return _0x5e2f81;};'use strict';var multer=require(_0xc6c5('0x0'));var util=require('util');var path=require(_0xc6c5('0x1'));var timeout=require(_0xc6c5('0x2'));var express=require(_0xc6c5('0x3'));var router=express['Router']();var fs_extra=require(_0xc6c5('0x4'));var auth=require(_0xc6c5('0x5'));var interaction=require(_0xc6c5('0x6'));var config=require(_0xc6c5('0x7'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xc6c5('0x8')](),controller[_0xc6c5('0x9')]);router[_0xc6c5('0xa')](_0xc6c5('0xb'),auth[_0xc6c5('0x8')](),controller['show']);router[_0xc6c5('0xa')](_0xc6c5('0xc'),auth[_0xc6c5('0x8')](),controller[_0xc6c5('0xd')]);router['get']('/:id/subjects',auth[_0xc6c5('0x8')](),controller[_0xc6c5('0xe')]);router[_0xc6c5('0xa')](_0xc6c5('0xf'),auth[_0xc6c5('0x8')](),controller[_0xc6c5('0x10')]);router[_0xc6c5('0x11')]('/',auth[_0xc6c5('0x8')](),controller[_0xc6c5('0x12')]);router[_0xc6c5('0x13')](_0xc6c5('0xb'),auth[_0xc6c5('0x8')](),controller['update']);router[_0xc6c5('0x14')](_0xc6c5('0xb'),auth[_0xc6c5('0x8')](),controller[_0xc6c5('0x15')]);module[_0xc6c5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 217d32c..71ee4df 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 _0x5b7c=['sequelize','exports','STRING'];(function(_0x41fee1,_0x5977d3){var _0xbb7c97=function(_0x183389){while(--_0x183389){_0x41fee1['push'](_0x41fee1['shift']());}};_0xbb7c97(++_0x5977d3);}(_0x5b7c,0x1e0));var _0xc5b7=function(_0x250ce0,_0x11b7d7){_0x250ce0=_0x250ce0-0x0;var _0x48fb88=_0x5b7c[_0x250ce0];return _0x48fb88;};'use strict';var Sequelize=require(_0xc5b7('0x0'));module[_0xc5b7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc5b7('0x2')]}}; \ No newline at end of file +var _0x87e7=['exports','STRING','sequelize'];(function(_0x4e2cab,_0x27eb77){var _0xc4a809=function(_0x3fc604){while(--_0x3fc604){_0x4e2cab['push'](_0x4e2cab['shift']());}};_0xc4a809(++_0x27eb77);}(_0x87e7,0x1f1));var _0x787e=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x87e7[_0x5466ab];return _0x40751a;};'use strict';var Sequelize=require(_0x787e('0x0'));module[_0x787e('0x1')]={'name':{'type':Sequelize[_0x787e('0x2')]},'description':{'type':Sequelize[_0x787e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d03f580..12e80e5 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 _0xf0dd=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','params','includeAll','catch','create','body','find','hasOwnProperty','nolimit','getFields','getSubjects','findOne','ServicenowField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5beb85,_0x4c823f){var _0x3c8b7f=function(_0x15616a){while(--_0x15616a){_0x5beb85['push'](_0x5beb85['shift']());}};_0x3c8b7f(++_0x4c823f);}(_0xf0dd,0x129));var _0xdf0d=function(_0x13f731,_0x1c061a){_0x13f731=_0x13f731-0x0;var _0x3ac7d7=_0xf0dd[_0x13f731];return _0x3ac7d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf0d('0x0'));var zipdir=require(_0xdf0d('0x1'));var jsonpatch=require(_0xdf0d('0x2'));var rp=require(_0xdf0d('0x3'));var moment=require(_0xdf0d('0x4'));var BPromise=require(_0xdf0d('0x5'));var Mustache=require(_0xdf0d('0x6'));var util=require(_0xdf0d('0x7'));var path=require('path');var sox=require(_0xdf0d('0x8'));var csv=require('to-csv');var ejs=require(_0xdf0d('0x9'));var fs=require('fs');var fs_extra=require(_0xdf0d('0xa'));var _=require(_0xdf0d('0xb'));var squel=require(_0xdf0d('0xc'));var crypto=require(_0xdf0d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdf0d('0xe'));var toCsv=require(_0xdf0d('0xf'));var querystring=require(_0xdf0d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdf0d('0x11'));var as=require(_0xdf0d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf0d('0x13'))(_0xdf0d('0x14'));var utils=require('../../config/utils');var config=require(_0xdf0d('0x15'));var licenseUtil=require(_0xdf0d('0x16'));var db=require(_0xdf0d('0x17'))['db'];function respondWithStatusCode(_0x5605cc,_0x23bd1b){_0x23bd1b=_0x23bd1b||0xcc;return function(_0x23203e){if(_0x23203e){return _0x5605cc['sendStatus'](_0x23bd1b);}return _0x5605cc[_0xdf0d('0x18')](_0x23bd1b)[_0xdf0d('0x19')]();};}function respondWithResult(_0x54cb5b,_0x5ba20c){_0x5ba20c=_0x5ba20c||0xc8;return function(_0x1fe167){if(_0x1fe167){return _0x54cb5b['status'](_0x5ba20c)[_0xdf0d('0x1a')](_0x1fe167);}};}function respondWithFilteredResult(_0x56d169,_0x25f56e){return function(_0x122817){if(_0x122817){var _0x2dca9c=typeof _0x25f56e[_0xdf0d('0x1b')]===_0xdf0d('0x1c')&&typeof _0x25f56e['limit']===_0xdf0d('0x1c');var _0x3f816b=_0x122817['count'];var _0x11d586=_0x2dca9c?0x0:_0x25f56e[_0xdf0d('0x1b')];var _0x3883c4=_0x2dca9c?_0x122817[_0xdf0d('0x1d')]:_0x25f56e[_0xdf0d('0x1b')]+_0x25f56e[_0xdf0d('0x1e')];var _0x46b694;if(_0x3883c4>=_0x3f816b){_0x3883c4=_0x3f816b;_0x46b694=0xc8;}else{_0x46b694=0xce;}_0x56d169[_0xdf0d('0x18')](_0x46b694);return _0x56d169[_0xdf0d('0x1f')](_0xdf0d('0x20'),_0x11d586+'-'+_0x3883c4+'/'+_0x3f816b)[_0xdf0d('0x1a')](_0x122817);}return null;};}function patchUpdates(_0x518401){return function(_0x21a0c1){try{jsonpatch[_0xdf0d('0x21')](_0x21a0c1,_0x518401,!![]);}catch(_0x28e54f){return BPromise[_0xdf0d('0x22')](_0x28e54f);}return _0x21a0c1[_0xdf0d('0x23')]();};}function saveUpdates(_0x18377b,_0x35353d){return function(_0x1ac63d){if(_0x1ac63d){return _0x1ac63d['update'](_0x18377b)[_0xdf0d('0x24')](function(_0x28ec3d){return _0x28ec3d;});}return null;};}function removeEntity(_0x2cb2c3,_0x6c0e14){return function(_0x1cc828){if(_0x1cc828){return _0x1cc828[_0xdf0d('0x25')]()[_0xdf0d('0x24')](function(){_0x2cb2c3[_0xdf0d('0x18')](0xcc)[_0xdf0d('0x19')]();});}};}function handleEntityNotFound(_0x459950,_0x2b4c71){return function(_0x17481a){if(!_0x17481a){_0x459950['sendStatus'](0x194);}return _0x17481a;};}function handleError(_0x49e387,_0x2e1151){_0x2e1151=_0x2e1151||0x1f4;return function(_0x311ccb){logger[_0xdf0d('0x26')](_0x311ccb[_0xdf0d('0x27')]);if(_0x311ccb[_0xdf0d('0x28')]){delete _0x311ccb['name'];}_0x49e387[_0xdf0d('0x18')](_0x2e1151)['send'](_0x311ccb);};}exports[_0xdf0d('0x29')]=function(_0x34f07f,_0x9b71d8){var _0x4f9759={},_0x348178={},_0x482120={'count':0x0,'rows':[]};var _0x2d399b=_[_0xdf0d('0x2a')](db[_0xdf0d('0x2b')][_0xdf0d('0x2c')],function(_0x3d38c4){return{'name':_0x3d38c4[_0xdf0d('0x2d')],'type':_0x3d38c4[_0xdf0d('0x2e')]['key']};});_0x348178[_0xdf0d('0x2f')]=_[_0xdf0d('0x2a')](_0x2d399b,_0xdf0d('0x28'));_0x348178[_0xdf0d('0x30')]=_[_0xdf0d('0x31')](_0x34f07f['query']);_0x348178[_0xdf0d('0x32')]=_[_0xdf0d('0x33')](_0x348178[_0xdf0d('0x2f')],_0x348178[_0xdf0d('0x30')]);_0x4f9759[_0xdf0d('0x34')]=_[_0xdf0d('0x33')](_0x348178[_0xdf0d('0x2f')],qs[_0xdf0d('0x35')](_0x34f07f['query'][_0xdf0d('0x35')]));_0x4f9759['attributes']=_0x4f9759[_0xdf0d('0x34')][_0xdf0d('0x36')]?_0x4f9759['attributes']:_0x348178[_0xdf0d('0x2f')];if(!_0x34f07f['query']['hasOwnProperty']('nolimit')){_0x4f9759['limit']=qs[_0xdf0d('0x1e')](_0x34f07f['query'][_0xdf0d('0x1e')]);_0x4f9759[_0xdf0d('0x1b')]=qs[_0xdf0d('0x1b')](_0x34f07f[_0xdf0d('0x30')][_0xdf0d('0x1b')]);}_0x4f9759[_0xdf0d('0x37')]=qs[_0xdf0d('0x38')](_0x34f07f['query']['sort']);_0x4f9759['where']=qs[_0xdf0d('0x32')](_[_0xdf0d('0x39')](_0x34f07f[_0xdf0d('0x30')],_0x348178['filters']),_0x2d399b);if(_0x34f07f[_0xdf0d('0x30')][_0xdf0d('0x3a')]){_0x4f9759['where']=_[_0xdf0d('0x3b')](_0x4f9759[_0xdf0d('0x3c')],{'$or':_['map'](_0x2d399b,function(_0x2c9232){if(_0x2c9232[_0xdf0d('0x2e')]!==_0xdf0d('0x3d')){var _0x50d133={};_0x50d133[_0x2c9232[_0xdf0d('0x28')]]={'$like':'%'+_0x34f07f[_0xdf0d('0x30')][_0xdf0d('0x3a')]+'%'};return _0x50d133;}})});}_0x4f9759=_[_0xdf0d('0x3b')]({},_0x4f9759,_0x34f07f[_0xdf0d('0x3e')]);var _0x1c612a={'where':_0x4f9759[_0xdf0d('0x3c')]};return db[_0xdf0d('0x2b')]['count'](_0x1c612a)['then'](function(_0x208df3){_0x482120[_0xdf0d('0x1d')]=_0x208df3;if(_0x34f07f['query']['includeAll']){_0x4f9759[_0xdf0d('0x3f')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xdf0d('0x40')](_0x4f9759);})['then'](function(_0x510a34){_0x482120[_0xdf0d('0x41')]=_0x510a34;return _0x482120;})[_0xdf0d('0x24')](respondWithFilteredResult(_0x9b71d8,_0x4f9759))['catch'](handleError(_0x9b71d8,null));};exports['show']=function(_0x2a7603,_0x43e19f){var _0x5a748e={'raw':![],'where':{'id':_0x2a7603[_0xdf0d('0x42')]['id']}},_0x1d09ea={};_0x1d09ea['model']=_[_0xdf0d('0x31')](db['ServicenowConfiguration']['rawAttributes']);_0x1d09ea[_0xdf0d('0x30')]=_[_0xdf0d('0x31')](_0x2a7603['query']);_0x1d09ea[_0xdf0d('0x32')]=_['intersection'](_0x1d09ea['model'],_0x1d09ea[_0xdf0d('0x30')]);_0x5a748e[_0xdf0d('0x34')]=_[_0xdf0d('0x33')](_0x1d09ea['model'],qs['fields'](_0x2a7603['query'][_0xdf0d('0x35')]));_0x5a748e[_0xdf0d('0x34')]=_0x5a748e[_0xdf0d('0x34')]['length']?_0x5a748e[_0xdf0d('0x34')]:_0x1d09ea['model'];if(_0x2a7603[_0xdf0d('0x30')][_0xdf0d('0x43')]){_0x5a748e[_0xdf0d('0x3f')]=[{'all':!![]}];}_0x5a748e=_[_0xdf0d('0x3b')]({},_0x5a748e,_0x2a7603[_0xdf0d('0x3e')]);return db['ServicenowConfiguration']['find'](_0x5a748e)[_0xdf0d('0x24')](handleEntityNotFound(_0x43e19f,null))['then'](respondWithResult(_0x43e19f,null))[_0xdf0d('0x44')](handleError(_0x43e19f,null));};exports[_0xdf0d('0x45')]=function(_0x24d49c,_0x508014){return db['ServicenowConfiguration'][_0xdf0d('0x45')](_0x24d49c[_0xdf0d('0x46')],{})[_0xdf0d('0x24')](respondWithResult(_0x508014,0xc9))[_0xdf0d('0x44')](handleError(_0x508014,null));};exports['update']=function(_0x540013,_0x388773){if(_0x540013[_0xdf0d('0x46')]['id']){delete _0x540013[_0xdf0d('0x46')]['id'];}return db[_0xdf0d('0x2b')]['find']({'where':{'id':_0x540013[_0xdf0d('0x42')]['id']}})[_0xdf0d('0x24')](handleEntityNotFound(_0x388773,null))[_0xdf0d('0x24')](saveUpdates(_0x540013[_0xdf0d('0x46')],null))[_0xdf0d('0x24')](respondWithResult(_0x388773,null))[_0xdf0d('0x44')](handleError(_0x388773,null));};exports['destroy']=function(_0x3adb34,_0x4b68ac){return db['ServicenowConfiguration'][_0xdf0d('0x47')]({'where':{'id':_0x3adb34['params']['id']}})[_0xdf0d('0x24')](handleEntityNotFound(_0x4b68ac,null))[_0xdf0d('0x24')](removeEntity(_0x4b68ac,null))[_0xdf0d('0x44')](handleError(_0x4b68ac,null));};exports['getFields']=function(_0x971319,_0x490761,_0x2d5c73){var _0xbd388f={};var _0xc033d1={};var _0x2b1d52;var _0x4f2619;return db[_0xdf0d('0x2b')]['findOne']({'where':{'id':_0x971319[_0xdf0d('0x42')]['id']}})['then'](handleEntityNotFound(_0x490761,null))[_0xdf0d('0x24')](function(_0x3c52f2){if(_0x3c52f2){_0x2b1d52=_0x3c52f2;_0xc033d1[_0xdf0d('0x2f')]=_[_0xdf0d('0x31')](db['ServicenowField'][_0xdf0d('0x2c')]);_0xc033d1[_0xdf0d('0x30')]=_[_0xdf0d('0x31')](_0x971319[_0xdf0d('0x30')]);_0xc033d1[_0xdf0d('0x32')]=_[_0xdf0d('0x33')](_0xc033d1[_0xdf0d('0x2f')],_0xc033d1['query']);_0xbd388f[_0xdf0d('0x34')]=_['intersection'](_0xc033d1[_0xdf0d('0x2f')],qs[_0xdf0d('0x35')](_0x971319[_0xdf0d('0x30')]['fields']));_0xbd388f[_0xdf0d('0x34')]=_0xbd388f['attributes'][_0xdf0d('0x36')]?_0xbd388f[_0xdf0d('0x34')]:_0xc033d1[_0xdf0d('0x2f')];_0xbd388f[_0xdf0d('0x37')]=qs[_0xdf0d('0x38')](_0x971319[_0xdf0d('0x30')][_0xdf0d('0x38')]);_0xbd388f[_0xdf0d('0x3c')]=qs[_0xdf0d('0x32')](_[_0xdf0d('0x39')](_0x971319['query'],_0xc033d1[_0xdf0d('0x32')]));if(_0x971319[_0xdf0d('0x30')][_0xdf0d('0x3a')]){_0xbd388f['where']=_[_0xdf0d('0x3b')](_0xbd388f[_0xdf0d('0x3c')],{'$or':_[_0xdf0d('0x2a')](_0xbd388f[_0xdf0d('0x34')],function(_0x4c4cdf){var _0x1a1bc5={};_0x1a1bc5[_0x4c4cdf]={'$like':'%'+_0x971319[_0xdf0d('0x30')][_0xdf0d('0x3a')]+'%'};return _0x1a1bc5;})});}_0xbd388f=_['merge']({},_0xbd388f,_0x971319['options']);return _0x2b1d52['getFields'](_0xbd388f);}})['then'](function(_0x7f2aa3){if(_0x7f2aa3){_0x4f2619=_0x7f2aa3[_0xdf0d('0x36')];if(!_0x971319[_0xdf0d('0x30')][_0xdf0d('0x48')](_0xdf0d('0x49'))){_0xbd388f[_0xdf0d('0x1e')]=qs[_0xdf0d('0x1e')](_0x971319[_0xdf0d('0x30')]['limit']);_0xbd388f[_0xdf0d('0x1b')]=qs[_0xdf0d('0x1b')](_0x971319[_0xdf0d('0x30')][_0xdf0d('0x1b')]);}return _0x2b1d52[_0xdf0d('0x4a')](_0xbd388f);}})[_0xdf0d('0x24')](function(_0x353ded){if(_0x353ded){return _0x353ded?{'count':_0x4f2619,'rows':_0x353ded}:null;}})['then'](respondWithResult(_0x490761,null))[_0xdf0d('0x44')](handleError(_0x490761,null));};exports[_0xdf0d('0x4b')]=function(_0x2ebd2d,_0x7bca8e,_0x1c4135){var _0x2dd52b={};var _0x232c75={};var _0x3a274d;var _0x48ec7b;return db[_0xdf0d('0x2b')][_0xdf0d('0x4c')]({'where':{'id':_0x2ebd2d[_0xdf0d('0x42')]['id']}})[_0xdf0d('0x24')](handleEntityNotFound(_0x7bca8e,null))[_0xdf0d('0x24')](function(_0x268d8e){if(_0x268d8e){_0x3a274d=_0x268d8e;_0x232c75[_0xdf0d('0x2f')]=_[_0xdf0d('0x31')](db[_0xdf0d('0x4d')][_0xdf0d('0x2c')]);_0x232c75[_0xdf0d('0x30')]=_[_0xdf0d('0x31')](_0x2ebd2d['query']);_0x232c75[_0xdf0d('0x32')]=_['intersection'](_0x232c75['model'],_0x232c75[_0xdf0d('0x30')]);_0x2dd52b[_0xdf0d('0x34')]=_[_0xdf0d('0x33')](_0x232c75[_0xdf0d('0x2f')],qs[_0xdf0d('0x35')](_0x2ebd2d[_0xdf0d('0x30')][_0xdf0d('0x35')]));_0x2dd52b[_0xdf0d('0x34')]=_0x2dd52b['attributes']['length']?_0x2dd52b[_0xdf0d('0x34')]:_0x232c75['model'];_0x2dd52b[_0xdf0d('0x37')]=qs['sort'](_0x2ebd2d[_0xdf0d('0x30')][_0xdf0d('0x38')]);_0x2dd52b['where']=qs[_0xdf0d('0x32')](_[_0xdf0d('0x39')](_0x2ebd2d[_0xdf0d('0x30')],_0x232c75['filters']));if(_0x2ebd2d[_0xdf0d('0x30')]['filter']){_0x2dd52b[_0xdf0d('0x3c')]=_[_0xdf0d('0x3b')](_0x2dd52b[_0xdf0d('0x3c')],{'$or':_[_0xdf0d('0x2a')](_0x2dd52b[_0xdf0d('0x34')],function(_0x159d22){var _0x41566d={};_0x41566d[_0x159d22]={'$like':'%'+_0x2ebd2d[_0xdf0d('0x30')][_0xdf0d('0x3a')]+'%'};return _0x41566d;})});}_0x2dd52b=_[_0xdf0d('0x3b')]({},_0x2dd52b,_0x2ebd2d[_0xdf0d('0x3e')]);return _0x3a274d[_0xdf0d('0x4b')](_0x2dd52b);}})['then'](function(_0xa4d860){if(_0xa4d860){_0x48ec7b=_0xa4d860[_0xdf0d('0x36')];if(!_0x2ebd2d['query']['hasOwnProperty'](_0xdf0d('0x49'))){_0x2dd52b[_0xdf0d('0x1e')]=qs[_0xdf0d('0x1e')](_0x2ebd2d[_0xdf0d('0x30')][_0xdf0d('0x1e')]);_0x2dd52b[_0xdf0d('0x1b')]=qs[_0xdf0d('0x1b')](_0x2ebd2d[_0xdf0d('0x30')][_0xdf0d('0x1b')]);}return _0x3a274d['getSubjects'](_0x2dd52b);}})['then'](function(_0x51c716){if(_0x51c716){return _0x51c716?{'count':_0x48ec7b,'rows':_0x51c716}:null;}})[_0xdf0d('0x24')](respondWithResult(_0x7bca8e,null))[_0xdf0d('0x44')](handleError(_0x7bca8e,null));};exports[_0xdf0d('0x4e')]=function(_0xfd64d2,_0x386ad2,_0x501789){var _0x55bd4a={};var _0x3e9bcb={};var _0x186858;var _0x5a2a29;return db['ServicenowConfiguration'][_0xdf0d('0x4c')]({'where':{'id':_0xfd64d2[_0xdf0d('0x42')]['id']}})[_0xdf0d('0x24')](handleEntityNotFound(_0x386ad2,null))[_0xdf0d('0x24')](function(_0x2dc973){if(_0x2dc973){_0x186858=_0x2dc973;_0x3e9bcb['model']=_[_0xdf0d('0x31')](db[_0xdf0d('0x4d')][_0xdf0d('0x2c')]);_0x3e9bcb[_0xdf0d('0x30')]=_[_0xdf0d('0x31')](_0xfd64d2[_0xdf0d('0x30')]);_0x3e9bcb[_0xdf0d('0x32')]=_[_0xdf0d('0x33')](_0x3e9bcb[_0xdf0d('0x2f')],_0x3e9bcb[_0xdf0d('0x30')]);_0x55bd4a['attributes']=_[_0xdf0d('0x33')](_0x3e9bcb[_0xdf0d('0x2f')],qs['fields'](_0xfd64d2[_0xdf0d('0x30')][_0xdf0d('0x35')]));_0x55bd4a[_0xdf0d('0x34')]=_0x55bd4a[_0xdf0d('0x34')][_0xdf0d('0x36')]?_0x55bd4a[_0xdf0d('0x34')]:_0x3e9bcb['model'];_0x55bd4a[_0xdf0d('0x37')]=qs[_0xdf0d('0x38')](_0xfd64d2['query'][_0xdf0d('0x38')]);_0x55bd4a[_0xdf0d('0x3c')]=qs['filters'](_[_0xdf0d('0x39')](_0xfd64d2['query'],_0x3e9bcb[_0xdf0d('0x32')]));if(_0xfd64d2['query'][_0xdf0d('0x3a')]){_0x55bd4a[_0xdf0d('0x3c')]=_[_0xdf0d('0x3b')](_0x55bd4a['where'],{'$or':_[_0xdf0d('0x2a')](_0x55bd4a[_0xdf0d('0x34')],function(_0x49b385){var _0x2da14a={};_0x2da14a[_0x49b385]={'$like':'%'+_0xfd64d2[_0xdf0d('0x30')][_0xdf0d('0x3a')]+'%'};return _0x2da14a;})});}_0x55bd4a=_[_0xdf0d('0x3b')]({},_0x55bd4a,_0xfd64d2[_0xdf0d('0x3e')]);return _0x186858[_0xdf0d('0x4e')](_0x55bd4a);}})['then'](function(_0x3ec1b5){if(_0x3ec1b5){_0x5a2a29=_0x3ec1b5[_0xdf0d('0x36')];if(!_0xfd64d2['query'][_0xdf0d('0x48')](_0xdf0d('0x49'))){_0x55bd4a[_0xdf0d('0x1e')]=qs[_0xdf0d('0x1e')](_0xfd64d2['query']['limit']);_0x55bd4a[_0xdf0d('0x1b')]=qs[_0xdf0d('0x1b')](_0xfd64d2[_0xdf0d('0x30')]['offset']);}return _0x186858[_0xdf0d('0x4e')](_0x55bd4a);}})[_0xdf0d('0x24')](function(_0x483d94){if(_0x483d94){return _0x483d94?{'count':_0x5a2a29,'rows':_0x483d94}:null;}})[_0xdf0d('0x24')](respondWithResult(_0x386ad2,null))['catch'](handleError(_0x386ad2,null));}; \ No newline at end of file +var _0xfa89=['getSubjects','findOne','getDescriptions','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','save','update','destroy','then','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','options','findAll','rows','params','find','create','body','catch','ServicenowField','order','getFields'];(function(_0xc8cf57,_0x212a8f){var _0x18b9fb=function(_0x1d4a9c){while(--_0x1d4a9c){_0xc8cf57['push'](_0xc8cf57['shift']());}};_0x18b9fb(++_0x212a8f);}(_0xfa89,0x1d7));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9fa8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9fa8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9fa8('0x2'));var BPromise=require(_0x9fa8('0x3'));var Mustache=require(_0x9fa8('0x4'));var util=require('util');var path=require(_0x9fa8('0x5'));var sox=require('sox');var csv=require(_0x9fa8('0x6'));var ejs=require(_0x9fa8('0x7'));var fs=require('fs');var fs_extra=require(_0x9fa8('0x8'));var _=require(_0x9fa8('0x9'));var squel=require(_0x9fa8('0xa'));var crypto=require(_0x9fa8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fa8('0xc'));var toCsv=require(_0x9fa8('0x6'));var querystring=require(_0x9fa8('0xd'));var Papa=require(_0x9fa8('0xe'));var Redis=require(_0x9fa8('0xf'));var authService=require(_0x9fa8('0x10'));var qs=require(_0x9fa8('0x11'));var as=require(_0x9fa8('0x12'));var hardwareService=require(_0x9fa8('0x13'));var logger=require(_0x9fa8('0x14'))(_0x9fa8('0x15'));var utils=require(_0x9fa8('0x16'));var config=require(_0x9fa8('0x17'));var licenseUtil=require(_0x9fa8('0x18'));var db=require(_0x9fa8('0x19'))['db'];function respondWithStatusCode(_0x20e49b,_0x56d2e6){_0x56d2e6=_0x56d2e6||0xcc;return function(_0x4790b9){if(_0x4790b9){return _0x20e49b[_0x9fa8('0x1a')](_0x56d2e6);}return _0x20e49b[_0x9fa8('0x1b')](_0x56d2e6)[_0x9fa8('0x1c')]();};}function respondWithResult(_0x55b5b4,_0x40cf8f){_0x40cf8f=_0x40cf8f||0xc8;return function(_0x40eaa1){if(_0x40eaa1){return _0x55b5b4[_0x9fa8('0x1b')](_0x40cf8f)[_0x9fa8('0x1d')](_0x40eaa1);}};}function respondWithFilteredResult(_0x17911b,_0x249441){return function(_0x2414de){if(_0x2414de){var _0x4d69a7=typeof _0x249441[_0x9fa8('0x1e')]==='undefined'&&typeof _0x249441['limit']===_0x9fa8('0x1f');var _0x5e1822=_0x2414de[_0x9fa8('0x20')];var _0x3b8821=_0x4d69a7?0x0:_0x249441[_0x9fa8('0x1e')];var _0x3c0afe=_0x4d69a7?_0x2414de[_0x9fa8('0x20')]:_0x249441['offset']+_0x249441['limit'];var _0x100f0c;if(_0x3c0afe>=_0x5e1822){_0x3c0afe=_0x5e1822;_0x100f0c=0xc8;}else{_0x100f0c=0xce;}_0x17911b['status'](_0x100f0c);return _0x17911b[_0x9fa8('0x21')]('Content-Range',_0x3b8821+'-'+_0x3c0afe+'/'+_0x5e1822)[_0x9fa8('0x1d')](_0x2414de);}return null;};}function patchUpdates(_0x717a8e){return function(_0x46601e){try{jsonpatch[_0x9fa8('0x22')](_0x46601e,_0x717a8e,!![]);}catch(_0x4e0da7){return BPromise['reject'](_0x4e0da7);}return _0x46601e[_0x9fa8('0x23')]();};}function saveUpdates(_0x4c87be,_0x462959){return function(_0x495a25){if(_0x495a25){return _0x495a25[_0x9fa8('0x24')](_0x4c87be)['then'](function(_0xceb24e){return _0xceb24e;});}return null;};}function removeEntity(_0x340c39,_0x440322){return function(_0x4b36a4){if(_0x4b36a4){return _0x4b36a4[_0x9fa8('0x25')]()[_0x9fa8('0x26')](function(){_0x340c39[_0x9fa8('0x1b')](0xcc)[_0x9fa8('0x1c')]();});}};}function handleEntityNotFound(_0x54692d,_0x17d16e){return function(_0x12a39f){if(!_0x12a39f){_0x54692d['sendStatus'](0x194);}return _0x12a39f;};}function handleError(_0x432b2e,_0x2fcf45){_0x2fcf45=_0x2fcf45||0x1f4;return function(_0x4e4bce){logger['error'](_0x4e4bce[_0x9fa8('0x27')]);if(_0x4e4bce[_0x9fa8('0x28')]){delete _0x4e4bce[_0x9fa8('0x28')];}_0x432b2e[_0x9fa8('0x1b')](_0x2fcf45)[_0x9fa8('0x29')](_0x4e4bce);};}exports[_0x9fa8('0x2a')]=function(_0x24fa4f,_0x328e4c){var _0x976c7f={},_0x5a6a23={},_0xe6c464={'count':0x0,'rows':[]};var _0x372077=_['map'](db[_0x9fa8('0x2b')][_0x9fa8('0x2c')],function(_0x25220c){return{'name':_0x25220c[_0x9fa8('0x2d')],'type':_0x25220c['type'][_0x9fa8('0x2e')]};});_0x5a6a23[_0x9fa8('0x2f')]=_[_0x9fa8('0x30')](_0x372077,_0x9fa8('0x28'));_0x5a6a23[_0x9fa8('0x31')]=_[_0x9fa8('0x32')](_0x24fa4f[_0x9fa8('0x31')]);_0x5a6a23['filters']=_[_0x9fa8('0x33')](_0x5a6a23[_0x9fa8('0x2f')],_0x5a6a23[_0x9fa8('0x31')]);_0x976c7f[_0x9fa8('0x34')]=_[_0x9fa8('0x33')](_0x5a6a23[_0x9fa8('0x2f')],qs[_0x9fa8('0x35')](_0x24fa4f[_0x9fa8('0x31')][_0x9fa8('0x35')]));_0x976c7f[_0x9fa8('0x34')]=_0x976c7f['attributes'][_0x9fa8('0x36')]?_0x976c7f[_0x9fa8('0x34')]:_0x5a6a23[_0x9fa8('0x2f')];if(!_0x24fa4f['query'][_0x9fa8('0x37')](_0x9fa8('0x38'))){_0x976c7f[_0x9fa8('0x39')]=qs[_0x9fa8('0x39')](_0x24fa4f[_0x9fa8('0x31')][_0x9fa8('0x39')]);_0x976c7f[_0x9fa8('0x1e')]=qs[_0x9fa8('0x1e')](_0x24fa4f[_0x9fa8('0x31')][_0x9fa8('0x1e')]);}_0x976c7f['order']=qs[_0x9fa8('0x3a')](_0x24fa4f[_0x9fa8('0x31')]['sort']);_0x976c7f[_0x9fa8('0x3b')]=qs['filters'](_[_0x9fa8('0x3c')](_0x24fa4f[_0x9fa8('0x31')],_0x5a6a23[_0x9fa8('0x3d')]),_0x372077);if(_0x24fa4f[_0x9fa8('0x31')][_0x9fa8('0x3e')]){_0x976c7f[_0x9fa8('0x3b')]=_[_0x9fa8('0x3f')](_0x976c7f[_0x9fa8('0x3b')],{'$or':_[_0x9fa8('0x30')](_0x372077,function(_0x2e85b0){if(_0x2e85b0['type']!=='VIRTUAL'){var _0x3e1b81={};_0x3e1b81[_0x2e85b0[_0x9fa8('0x28')]]={'$like':'%'+_0x24fa4f[_0x9fa8('0x31')][_0x9fa8('0x3e')]+'%'};return _0x3e1b81;}})});}_0x976c7f=_[_0x9fa8('0x3f')]({},_0x976c7f,_0x24fa4f[_0x9fa8('0x40')]);var _0x1a235b={'where':_0x976c7f['where']};return db[_0x9fa8('0x2b')][_0x9fa8('0x20')](_0x1a235b)[_0x9fa8('0x26')](function(_0x89d4ae){_0xe6c464['count']=_0x89d4ae;if(_0x24fa4f['query']['includeAll']){_0x976c7f['include']=[{'all':!![]}];}return db[_0x9fa8('0x2b')][_0x9fa8('0x41')](_0x976c7f);})[_0x9fa8('0x26')](function(_0x43cf4b){_0xe6c464[_0x9fa8('0x42')]=_0x43cf4b;return _0xe6c464;})['then'](respondWithFilteredResult(_0x328e4c,_0x976c7f))['catch'](handleError(_0x328e4c,null));};exports['show']=function(_0xef5111,_0x4f32e0){var _0x4d45fe={'raw':![],'where':{'id':_0xef5111[_0x9fa8('0x43')]['id']}},_0x31c759={};_0x31c759[_0x9fa8('0x2f')]=_[_0x9fa8('0x32')](db['ServicenowConfiguration']['rawAttributes']);_0x31c759[_0x9fa8('0x31')]=_[_0x9fa8('0x32')](_0xef5111[_0x9fa8('0x31')]);_0x31c759['filters']=_['intersection'](_0x31c759[_0x9fa8('0x2f')],_0x31c759['query']);_0x4d45fe['attributes']=_[_0x9fa8('0x33')](_0x31c759['model'],qs['fields'](_0xef5111[_0x9fa8('0x31')]['fields']));_0x4d45fe['attributes']=_0x4d45fe[_0x9fa8('0x34')][_0x9fa8('0x36')]?_0x4d45fe['attributes']:_0x31c759[_0x9fa8('0x2f')];if(_0xef5111[_0x9fa8('0x31')]['includeAll']){_0x4d45fe['include']=[{'all':!![]}];}_0x4d45fe=_[_0x9fa8('0x3f')]({},_0x4d45fe,_0xef5111[_0x9fa8('0x40')]);return db[_0x9fa8('0x2b')][_0x9fa8('0x44')](_0x4d45fe)[_0x9fa8('0x26')](handleEntityNotFound(_0x4f32e0,null))['then'](respondWithResult(_0x4f32e0,null))['catch'](handleError(_0x4f32e0,null));};exports[_0x9fa8('0x45')]=function(_0x3bf66d,_0x5700ee){return db['ServicenowConfiguration']['create'](_0x3bf66d[_0x9fa8('0x46')],{})[_0x9fa8('0x26')](respondWithResult(_0x5700ee,0xc9))[_0x9fa8('0x47')](handleError(_0x5700ee,null));};exports[_0x9fa8('0x24')]=function(_0x14a81f,_0x49b667){if(_0x14a81f[_0x9fa8('0x46')]['id']){delete _0x14a81f[_0x9fa8('0x46')]['id'];}return db[_0x9fa8('0x2b')][_0x9fa8('0x44')]({'where':{'id':_0x14a81f[_0x9fa8('0x43')]['id']}})[_0x9fa8('0x26')](handleEntityNotFound(_0x49b667,null))['then'](saveUpdates(_0x14a81f[_0x9fa8('0x46')],null))[_0x9fa8('0x26')](respondWithResult(_0x49b667,null))[_0x9fa8('0x47')](handleError(_0x49b667,null));};exports['destroy']=function(_0x2b7d75,_0x32faf2){return db[_0x9fa8('0x2b')][_0x9fa8('0x44')]({'where':{'id':_0x2b7d75[_0x9fa8('0x43')]['id']}})[_0x9fa8('0x26')](handleEntityNotFound(_0x32faf2,null))[_0x9fa8('0x26')](removeEntity(_0x32faf2,null))[_0x9fa8('0x47')](handleError(_0x32faf2,null));};exports['getFields']=function(_0x5dd621,_0x57a98b,_0x5c32d7){var _0x565bf9={};var _0x184bb3={};var _0x37d16c;var _0x8274c1;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x5dd621[_0x9fa8('0x43')]['id']}})[_0x9fa8('0x26')](handleEntityNotFound(_0x57a98b,null))[_0x9fa8('0x26')](function(_0x42d40b){if(_0x42d40b){_0x37d16c=_0x42d40b;_0x184bb3[_0x9fa8('0x2f')]=_[_0x9fa8('0x32')](db[_0x9fa8('0x48')][_0x9fa8('0x2c')]);_0x184bb3[_0x9fa8('0x31')]=_[_0x9fa8('0x32')](_0x5dd621[_0x9fa8('0x31')]);_0x184bb3[_0x9fa8('0x3d')]=_[_0x9fa8('0x33')](_0x184bb3['model'],_0x184bb3[_0x9fa8('0x31')]);_0x565bf9[_0x9fa8('0x34')]=_['intersection'](_0x184bb3['model'],qs[_0x9fa8('0x35')](_0x5dd621['query'][_0x9fa8('0x35')]));_0x565bf9['attributes']=_0x565bf9[_0x9fa8('0x34')][_0x9fa8('0x36')]?_0x565bf9[_0x9fa8('0x34')]:_0x184bb3['model'];_0x565bf9[_0x9fa8('0x49')]=qs[_0x9fa8('0x3a')](_0x5dd621[_0x9fa8('0x31')]['sort']);_0x565bf9[_0x9fa8('0x3b')]=qs['filters'](_[_0x9fa8('0x3c')](_0x5dd621[_0x9fa8('0x31')],_0x184bb3[_0x9fa8('0x3d')]));if(_0x5dd621[_0x9fa8('0x31')][_0x9fa8('0x3e')]){_0x565bf9['where']=_[_0x9fa8('0x3f')](_0x565bf9['where'],{'$or':_['map'](_0x565bf9[_0x9fa8('0x34')],function(_0xdc48a5){var _0x1f4084={};_0x1f4084[_0xdc48a5]={'$like':'%'+_0x5dd621[_0x9fa8('0x31')][_0x9fa8('0x3e')]+'%'};return _0x1f4084;})});}_0x565bf9=_[_0x9fa8('0x3f')]({},_0x565bf9,_0x5dd621['options']);return _0x37d16c[_0x9fa8('0x4a')](_0x565bf9);}})[_0x9fa8('0x26')](function(_0x5dea32){if(_0x5dea32){_0x8274c1=_0x5dea32[_0x9fa8('0x36')];if(!_0x5dd621[_0x9fa8('0x31')][_0x9fa8('0x37')](_0x9fa8('0x38'))){_0x565bf9[_0x9fa8('0x39')]=qs['limit'](_0x5dd621[_0x9fa8('0x31')][_0x9fa8('0x39')]);_0x565bf9[_0x9fa8('0x1e')]=qs['offset'](_0x5dd621[_0x9fa8('0x31')]['offset']);}return _0x37d16c[_0x9fa8('0x4a')](_0x565bf9);}})['then'](function(_0x55fa82){if(_0x55fa82){return _0x55fa82?{'count':_0x8274c1,'rows':_0x55fa82}:null;}})[_0x9fa8('0x26')](respondWithResult(_0x57a98b,null))[_0x9fa8('0x47')](handleError(_0x57a98b,null));};exports[_0x9fa8('0x4b')]=function(_0x1670e0,_0x30e052,_0x33f19e){var _0x13754e={};var _0x464168={};var _0x547e4b;var _0x2a40dd;return db[_0x9fa8('0x2b')][_0x9fa8('0x4c')]({'where':{'id':_0x1670e0[_0x9fa8('0x43')]['id']}})[_0x9fa8('0x26')](handleEntityNotFound(_0x30e052,null))[_0x9fa8('0x26')](function(_0x541693){if(_0x541693){_0x547e4b=_0x541693;_0x464168[_0x9fa8('0x2f')]=_[_0x9fa8('0x32')](db[_0x9fa8('0x48')]['rawAttributes']);_0x464168[_0x9fa8('0x31')]=_[_0x9fa8('0x32')](_0x1670e0['query']);_0x464168[_0x9fa8('0x3d')]=_['intersection'](_0x464168['model'],_0x464168[_0x9fa8('0x31')]);_0x13754e[_0x9fa8('0x34')]=_['intersection'](_0x464168[_0x9fa8('0x2f')],qs[_0x9fa8('0x35')](_0x1670e0[_0x9fa8('0x31')]['fields']));_0x13754e[_0x9fa8('0x34')]=_0x13754e[_0x9fa8('0x34')][_0x9fa8('0x36')]?_0x13754e[_0x9fa8('0x34')]:_0x464168['model'];_0x13754e[_0x9fa8('0x49')]=qs[_0x9fa8('0x3a')](_0x1670e0['query'][_0x9fa8('0x3a')]);_0x13754e['where']=qs[_0x9fa8('0x3d')](_[_0x9fa8('0x3c')](_0x1670e0[_0x9fa8('0x31')],_0x464168['filters']));if(_0x1670e0[_0x9fa8('0x31')][_0x9fa8('0x3e')]){_0x13754e[_0x9fa8('0x3b')]=_[_0x9fa8('0x3f')](_0x13754e[_0x9fa8('0x3b')],{'$or':_['map'](_0x13754e[_0x9fa8('0x34')],function(_0xc944f8){var _0x26de01={};_0x26de01[_0xc944f8]={'$like':'%'+_0x1670e0[_0x9fa8('0x31')][_0x9fa8('0x3e')]+'%'};return _0x26de01;})});}_0x13754e=_['merge']({},_0x13754e,_0x1670e0['options']);return _0x547e4b[_0x9fa8('0x4b')](_0x13754e);}})[_0x9fa8('0x26')](function(_0xb11848){if(_0xb11848){_0x2a40dd=_0xb11848[_0x9fa8('0x36')];if(!_0x1670e0[_0x9fa8('0x31')]['hasOwnProperty'](_0x9fa8('0x38'))){_0x13754e['limit']=qs[_0x9fa8('0x39')](_0x1670e0[_0x9fa8('0x31')][_0x9fa8('0x39')]);_0x13754e['offset']=qs[_0x9fa8('0x1e')](_0x1670e0[_0x9fa8('0x31')][_0x9fa8('0x1e')]);}return _0x547e4b[_0x9fa8('0x4b')](_0x13754e);}})[_0x9fa8('0x26')](function(_0x43d15b){if(_0x43d15b){return _0x43d15b?{'count':_0x2a40dd,'rows':_0x43d15b}:null;}})['then'](respondWithResult(_0x30e052,null))[_0x9fa8('0x47')](handleError(_0x30e052,null));};exports[_0x9fa8('0x4d')]=function(_0x306f8b,_0x2cecb8,_0x47a901){var _0x78be69={};var _0x2c421e={};var _0x4f3b9f;var _0x56ad39;return db[_0x9fa8('0x2b')][_0x9fa8('0x4c')]({'where':{'id':_0x306f8b[_0x9fa8('0x43')]['id']}})[_0x9fa8('0x26')](handleEntityNotFound(_0x2cecb8,null))[_0x9fa8('0x26')](function(_0x1d7b0b){if(_0x1d7b0b){_0x4f3b9f=_0x1d7b0b;_0x2c421e['model']=_[_0x9fa8('0x32')](db[_0x9fa8('0x48')][_0x9fa8('0x2c')]);_0x2c421e[_0x9fa8('0x31')]=_['keys'](_0x306f8b['query']);_0x2c421e[_0x9fa8('0x3d')]=_[_0x9fa8('0x33')](_0x2c421e[_0x9fa8('0x2f')],_0x2c421e['query']);_0x78be69[_0x9fa8('0x34')]=_[_0x9fa8('0x33')](_0x2c421e['model'],qs[_0x9fa8('0x35')](_0x306f8b[_0x9fa8('0x31')]['fields']));_0x78be69[_0x9fa8('0x34')]=_0x78be69[_0x9fa8('0x34')][_0x9fa8('0x36')]?_0x78be69[_0x9fa8('0x34')]:_0x2c421e[_0x9fa8('0x2f')];_0x78be69[_0x9fa8('0x49')]=qs[_0x9fa8('0x3a')](_0x306f8b[_0x9fa8('0x31')][_0x9fa8('0x3a')]);_0x78be69[_0x9fa8('0x3b')]=qs[_0x9fa8('0x3d')](_[_0x9fa8('0x3c')](_0x306f8b['query'],_0x2c421e[_0x9fa8('0x3d')]));if(_0x306f8b[_0x9fa8('0x31')][_0x9fa8('0x3e')]){_0x78be69['where']=_[_0x9fa8('0x3f')](_0x78be69['where'],{'$or':_[_0x9fa8('0x30')](_0x78be69['attributes'],function(_0x409ab){var _0x14f5d1={};_0x14f5d1[_0x409ab]={'$like':'%'+_0x306f8b[_0x9fa8('0x31')][_0x9fa8('0x3e')]+'%'};return _0x14f5d1;})});}_0x78be69=_[_0x9fa8('0x3f')]({},_0x78be69,_0x306f8b[_0x9fa8('0x40')]);return _0x4f3b9f[_0x9fa8('0x4d')](_0x78be69);}})[_0x9fa8('0x26')](function(_0x470f6d){if(_0x470f6d){_0x56ad39=_0x470f6d[_0x9fa8('0x36')];if(!_0x306f8b['query'][_0x9fa8('0x37')](_0x9fa8('0x38'))){_0x78be69[_0x9fa8('0x39')]=qs[_0x9fa8('0x39')](_0x306f8b[_0x9fa8('0x31')][_0x9fa8('0x39')]);_0x78be69[_0x9fa8('0x1e')]=qs[_0x9fa8('0x1e')](_0x306f8b[_0x9fa8('0x31')]['offset']);}return _0x4f3b9f[_0x9fa8('0x4d')](_0x78be69);}})[_0x9fa8('0x26')](function(_0x5ed5c1){if(_0x5ed5c1){return _0x5ed5c1?{'count':_0x56ad39,'rows':_0x5ed5c1}:null;}})[_0x9fa8('0x26')](respondWithResult(_0x2cecb8,null))['catch'](handleError(_0x2cecb8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f1f6ebe..91cbe25 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 _0xdaa8=['api','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x12c262,_0x25f1b5){var _0x34577f=function(_0x5bc218){while(--_0x5bc218){_0x12c262['push'](_0x12c262['shift']());}};_0x34577f(++_0x25f1b5);}(_0xdaa8,0xe4));var _0x8daa=function(_0x1f9897,_0xb170a){_0x1f9897=_0x1f9897-0x0;var _0x1a2965=_0xdaa8[_0x1f9897];return _0x1a2965;};'use strict';var _=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var logger=require(_0x8daa('0x2'))(_0x8daa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8daa('0x4'));module[_0x8daa('0x5')]=function(_0x46f753,_0x4d2392){return _0x46f753['define'](_0x8daa('0x6'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d3=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x48d6c2,_0x1ce5d2){var _0x39eeb1=function(_0xa992a7){while(--_0xa992a7){_0x48d6c2['push'](_0x48d6c2['shift']());}};_0x39eeb1(++_0x1ce5d2);}(_0x01d3,0xa2));var _0x301d=function(_0x4e8cec,_0x579240){_0x4e8cec=_0x4e8cec-0x0;var _0x24dcdb=_0x01d3[_0x4e8cec];return _0x24dcdb;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var logger=require(_0x301d('0x2'))(_0x301d('0x3'));var moment=require('moment');var BPromise=require(_0x301d('0x4'));var rp=require(_0x301d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x301d('0x6'));var config=require(_0x301d('0x7'));var attributes=require(_0x301d('0x8'));module[_0x301d('0x9')]=function(_0x5d1462,_0x318074){return _0x5d1462[_0x301d('0xa')](_0x301d('0xb'),attributes,{'tableName':_0x301d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 6cafa52..6221279 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 _0xceca=['result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x31ed2f,_0x55811f){var _0x501756=function(_0x476774){while(--_0x476774){_0x31ed2f['push'](_0x31ed2f['shift']());}};_0x501756(++_0x55811f);}(_0xceca,0xfd));var _0xacec=function(_0x58c4b4,_0x59c465){_0x58c4b4=_0x58c4b4-0x0;var _0x22214e=_0xceca[_0x58c4b4];return _0x22214e;};'use strict';var _=require(_0xacec('0x0'));var util=require('util');var moment=require(_0xacec('0x1'));var BPromise=require(_0xacec('0x2'));var rs=require(_0xacec('0x3'));var fs=require('fs');var Redis=require(_0xacec('0x4'));var db=require(_0xacec('0x5'))['db'];var utils=require(_0xacec('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xacec('0x7'));var jayson=require(_0xacec('0x8'));var client=jayson[_0xacec('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d025a,_0x4b381a,_0x357272){return new BPromise(function(_0x25c526,_0x159d88){return client[_0xacec('0xa')](_0x5d025a,_0x357272)[_0xacec('0xb')](function(_0x567257){logger[_0xacec('0xc')](_0xacec('0xd'),_0x4b381a,_0xacec('0xe'));logger[_0xacec('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4b381a,_0xacec('0xe'),JSON[_0xacec('0x10')](_0x567257));if(_0x567257[_0xacec('0x11')]){if(_0x567257['error'][_0xacec('0x12')]===0x1f4){logger[_0xacec('0x11')](_0xacec('0xd'),_0x4b381a,_0x567257[_0xacec('0x11')][_0xacec('0x13')]);return _0x159d88(_0x567257[_0xacec('0x11')][_0xacec('0x13')]);}logger[_0xacec('0x11')](_0xacec('0xd'),_0x4b381a,_0x567257[_0xacec('0x11')][_0xacec('0x13')]);return _0x25c526(_0x567257['error'][_0xacec('0x13')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x4b381a,_0xacec('0xe'));_0x25c526(_0x567257[_0xacec('0x14')][_0xacec('0x13')]);}})['catch'](function(_0x34247e){logger[_0xacec('0x11')](_0xacec('0xd'),_0x4b381a,_0x34247e);_0x159d88(_0x34247e);});});} \ No newline at end of file +var _0x18c6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1b5b56,_0x1188bc){var _0x28bcb3=function(_0x30372a){while(--_0x30372a){_0x1b5b56['push'](_0x1b5b56['shift']());}};_0x28bcb3(++_0x1188bc);}(_0x18c6,0x74));var _0x618c=function(_0x1179c8,_0x6b7d8e){_0x1179c8=_0x1179c8-0x0;var _0x585359=_0x18c6[_0x1179c8];return _0x585359;};'use strict';var _=require('lodash');var util=require(_0x618c('0x0'));var moment=require(_0x618c('0x1'));var BPromise=require(_0x618c('0x2'));var rs=require(_0x618c('0x3'));var fs=require('fs');var Redis=require(_0x618c('0x4'));var db=require(_0x618c('0x5'))['db'];var utils=require(_0x618c('0x6'));var logger=require(_0x618c('0x7'))('rpc');var config=require(_0x618c('0x8'));var jayson=require(_0x618c('0x9'));var client=jayson[_0x618c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18cc6e,_0x4304c4,_0x22a02c){return new BPromise(function(_0x1629bc,_0x37e349){return client[_0x618c('0xb')](_0x18cc6e,_0x22a02c)[_0x618c('0xc')](function(_0x3770ea){logger[_0x618c('0xd')](_0x618c('0xe'),_0x4304c4,_0x618c('0xf'));logger[_0x618c('0x10')](_0x618c('0x11'),_0x4304c4,_0x618c('0xf'),JSON[_0x618c('0x12')](_0x3770ea));if(_0x3770ea[_0x618c('0x13')]){if(_0x3770ea[_0x618c('0x13')][_0x618c('0x14')]===0x1f4){logger[_0x618c('0x13')](_0x618c('0xe'),_0x4304c4,_0x3770ea[_0x618c('0x13')][_0x618c('0x15')]);return _0x37e349(_0x3770ea[_0x618c('0x13')][_0x618c('0x15')]);}logger[_0x618c('0x13')](_0x618c('0xe'),_0x4304c4,_0x3770ea[_0x618c('0x13')][_0x618c('0x15')]);return _0x1629bc(_0x3770ea[_0x618c('0x13')][_0x618c('0x15')]);}else{logger[_0x618c('0xd')](_0x618c('0xe'),_0x4304c4,_0x618c('0xf'));_0x1629bc(_0x3770ea[_0x618c('0x16')]['message']);}})[_0x618c('0x17')](function(_0x58c4f4){logger[_0x618c('0x13')](_0x618c('0xe'),_0x4304c4,_0x58c4f4);_0x37e349(_0x58c4f4);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 762ced9..6be1b2a 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 _0xa53b=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa53b,0x1ce));var _0xba53=function(_0x36012b,_0x3746b3){_0x36012b=_0x36012b-0x0;var _0x23049b=_0xa53b[_0x36012b];return _0x23049b;};'use strict';var multer=require(_0xba53('0x0'));var util=require(_0xba53('0x1'));var path=require(_0xba53('0x2'));var timeout=require(_0xba53('0x3'));var express=require('express');var router=express[_0xba53('0x4')]();var fs_extra=require(_0xba53('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xba53('0x6'));var config=require('../../config/environment');var controller=require(_0xba53('0x7'));router[_0xba53('0x8')]('/',auth[_0xba53('0x9')](),controller[_0xba53('0xa')]);router['get'](_0xba53('0xb'),auth[_0xba53('0x9')](),controller[_0xba53('0xc')]);router[_0xba53('0xd')]('/',auth[_0xba53('0x9')](),controller[_0xba53('0xe')]);router['put'](_0xba53('0xb'),auth[_0xba53('0x9')](),controller[_0xba53('0xf')]);router['delete']('/:id',auth[_0xba53('0x9')](),controller[_0xba53('0x10')]);module[_0xba53('0x11')]=router; \ No newline at end of file +var _0xf5be=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','create','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0xf5be,0x1b0));var _0xef5b=function(_0x194408,_0xea3d21){_0x194408=_0x194408-0x0;var _0x1f3c02=_0xf5be[_0x194408];return _0x1f3c02;};'use strict';var multer=require('multer');var util=require(_0xef5b('0x0'));var path=require(_0xef5b('0x1'));var timeout=require(_0xef5b('0x2'));var express=require(_0xef5b('0x3'));var router=express[_0xef5b('0x4')]();var fs_extra=require(_0xef5b('0x5'));var auth=require(_0xef5b('0x6'));var interaction=require(_0xef5b('0x7'));var config=require(_0xef5b('0x8'));var controller=require(_0xef5b('0x9'));router[_0xef5b('0xa')]('/',auth['isAuthenticated'](),controller[_0xef5b('0xb')]);router['get'](_0xef5b('0xc'),auth[_0xef5b('0xd')](),controller[_0xef5b('0xe')]);router[_0xef5b('0xf')]('/',auth['isAuthenticated'](),controller[_0xef5b('0x10')]);router['put'](_0xef5b('0xc'),auth[_0xef5b('0xd')](),controller['update']);router[_0xef5b('0x11')](_0xef5b('0xc'),auth[_0xef5b('0xd')](),controller['destroy']);module[_0xef5b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 37f1d95..8043ac8 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 _0xcad6=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x21824c,_0x49f68c){var _0x3e3d3a=function(_0x40aa20){while(--_0x40aa20){_0x21824c['push'](_0x21824c['shift']());}};_0x3e3d3a(++_0x49f68c);}(_0xcad6,0x19d));var _0x6cad=function(_0x455612,_0xf181a5){_0x455612=_0x455612-0x0;var _0x17771c=_0xcad6[_0x455612];return _0x17771c;};'use strict';var Sequelize=require('sequelize');module[_0x6cad('0x0')]={'type':{'type':Sequelize[_0x6cad('0x1')](_0x6cad('0x2'),_0x6cad('0x3'),_0x6cad('0x4'),'keyValue','picklist'),'defaultValue':_0x6cad('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6cad('0x5')]},'keyType':{'type':Sequelize[_0x6cad('0x1')]('string',_0x6cad('0x3'),_0x6cad('0x4'))},'keyContent':{'type':Sequelize[_0x6cad('0x5')]},'idField':{'type':Sequelize[_0x6cad('0x5')]},'nameField':{'type':Sequelize[_0x6cad('0x5')]},'customField':{'type':Sequelize[_0x6cad('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6cad('0x5')]}}; \ No newline at end of file +var _0x4bf9=['STRING','BOOLEAN','sequelize','ENUM','variable','keyValue','picklist','string'];(function(_0x540d8d,_0x5e4de2){var _0x721bcb=function(_0x52b002){while(--_0x52b002){_0x540d8d['push'](_0x540d8d['shift']());}};_0x721bcb(++_0x5e4de2);}(_0x4bf9,0x92));var _0x94bf=function(_0x4acb12,_0x1af405){_0x4acb12=_0x4acb12-0x0;var _0x13543a=_0x4bf9[_0x4acb12];return _0x13543a;};'use strict';var Sequelize=require(_0x94bf('0x0'));module['exports']={'type':{'type':Sequelize[_0x94bf('0x1')]('string',_0x94bf('0x2'),'customVariable',_0x94bf('0x3'),_0x94bf('0x4')),'defaultValue':_0x94bf('0x5')},'content':{'type':Sequelize[_0x94bf('0x6')]},'key':{'type':Sequelize[_0x94bf('0x6')]},'keyType':{'type':Sequelize[_0x94bf('0x1')](_0x94bf('0x5'),_0x94bf('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x94bf('0x6')]},'idField':{'type':Sequelize[_0x94bf('0x6')]},'nameField':{'type':Sequelize[_0x94bf('0x6')]},'customField':{'type':Sequelize[_0x94bf('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x94bf('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 3e12afd..32ae6c9 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 _0xac92=['reject','save','update','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','create','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply'];(function(_0x2f4a34,_0x5ac966){var _0x1328db=function(_0x2a152f){while(--_0x2a152f){_0x2f4a34['push'](_0x2f4a34['shift']());}};_0x1328db(++_0x5ac966);}(_0xac92,0x74));var _0x2ac9=function(_0x11e15e,_0x22dee8){_0x11e15e=_0x11e15e-0x0;var _0x3eebde=_0xac92[_0x11e15e];return _0x3eebde;};'use strict';var emlformat=require(_0x2ac9('0x0'));var rimraf=require(_0x2ac9('0x1'));var zipdir=require(_0x2ac9('0x2'));var jsonpatch=require(_0x2ac9('0x3'));var rp=require('request-promise');var moment=require(_0x2ac9('0x4'));var BPromise=require(_0x2ac9('0x5'));var Mustache=require(_0x2ac9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2ac9('0x7'));var csv=require('to-csv');var ejs=require(_0x2ac9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ac9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2ac9('0xa'));var deskjs=require(_0x2ac9('0xb'));var toCsv=require(_0x2ac9('0xc'));var querystring=require(_0x2ac9('0xd'));var Papa=require(_0x2ac9('0xe'));var Redis=require(_0x2ac9('0xf'));var authService=require(_0x2ac9('0x10'));var qs=require(_0x2ac9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ac9('0x12'));var logger=require(_0x2ac9('0x13'))(_0x2ac9('0x14'));var utils=require(_0x2ac9('0x15'));var config=require(_0x2ac9('0x16'));var licenseUtil=require(_0x2ac9('0x17'));var db=require(_0x2ac9('0x18'))['db'];function respondWithStatusCode(_0x2736c4,_0x26ec0c){_0x26ec0c=_0x26ec0c||0xcc;return function(_0x5ac39c){if(_0x5ac39c){return _0x2736c4[_0x2ac9('0x19')](_0x26ec0c);}return _0x2736c4[_0x2ac9('0x1a')](_0x26ec0c)['end']();};}function respondWithResult(_0x421f1d,_0x5373f4){_0x5373f4=_0x5373f4||0xc8;return function(_0x2e437a){if(_0x2e437a){return _0x421f1d[_0x2ac9('0x1a')](_0x5373f4)[_0x2ac9('0x1b')](_0x2e437a);}};}function respondWithFilteredResult(_0x146944,_0x283f68){return function(_0x10b318){if(_0x10b318){var _0xa30dfb=typeof _0x283f68[_0x2ac9('0x1c')]===_0x2ac9('0x1d')&&typeof _0x283f68[_0x2ac9('0x1e')]==='undefined';var _0x54ec88=_0x10b318['count'];var _0x51dfed=_0xa30dfb?0x0:_0x283f68[_0x2ac9('0x1c')];var _0x2c8af2=_0xa30dfb?_0x10b318[_0x2ac9('0x1f')]:_0x283f68[_0x2ac9('0x1c')]+_0x283f68['limit'];var _0x565898;if(_0x2c8af2>=_0x54ec88){_0x2c8af2=_0x54ec88;_0x565898=0xc8;}else{_0x565898=0xce;}_0x146944['status'](_0x565898);return _0x146944[_0x2ac9('0x20')]('Content-Range',_0x51dfed+'-'+_0x2c8af2+'/'+_0x54ec88)[_0x2ac9('0x1b')](_0x10b318);}return null;};}function patchUpdates(_0x2b507e){return function(_0x4c93fa){try{jsonpatch[_0x2ac9('0x21')](_0x4c93fa,_0x2b507e,!![]);}catch(_0x3102a6){return BPromise[_0x2ac9('0x22')](_0x3102a6);}return _0x4c93fa[_0x2ac9('0x23')]();};}function saveUpdates(_0x23bcab,_0x35d08f){return function(_0x510b69){if(_0x510b69){return _0x510b69[_0x2ac9('0x24')](_0x23bcab)['then'](function(_0x1ab21b){return _0x1ab21b;});}return null;};}function removeEntity(_0x18031c,_0xf60770){return function(_0x361588){if(_0x361588){return _0x361588['destroy']()[_0x2ac9('0x25')](function(){_0x18031c[_0x2ac9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c10e0,_0x324d33){return function(_0x9fc75a){if(!_0x9fc75a){_0x5c10e0[_0x2ac9('0x19')](0x194);}return _0x9fc75a;};}function handleError(_0x244d0b,_0x2ebb60){_0x2ebb60=_0x2ebb60||0x1f4;return function(_0xf189a8){logger[_0x2ac9('0x26')](_0xf189a8[_0x2ac9('0x27')]);if(_0xf189a8[_0x2ac9('0x28')]){delete _0xf189a8[_0x2ac9('0x28')];}_0x244d0b['status'](_0x2ebb60)[_0x2ac9('0x29')](_0xf189a8);};}exports[_0x2ac9('0x2a')]=function(_0x1ed878,_0x3b157b){var _0xd293f={},_0x43f041={},_0x3d5dd9={'count':0x0,'rows':[]};var _0x38d965=_[_0x2ac9('0x2b')](db[_0x2ac9('0x2c')][_0x2ac9('0x2d')],function(_0x21afed){return{'name':_0x21afed[_0x2ac9('0x2e')],'type':_0x21afed[_0x2ac9('0x2f')][_0x2ac9('0x30')]};});_0x43f041['model']=_[_0x2ac9('0x2b')](_0x38d965,_0x2ac9('0x28'));_0x43f041[_0x2ac9('0x31')]=_['keys'](_0x1ed878[_0x2ac9('0x31')]);_0x43f041['filters']=_[_0x2ac9('0x32')](_0x43f041[_0x2ac9('0x33')],_0x43f041[_0x2ac9('0x31')]);_0xd293f[_0x2ac9('0x34')]=_[_0x2ac9('0x32')](_0x43f041[_0x2ac9('0x33')],qs[_0x2ac9('0x35')](_0x1ed878[_0x2ac9('0x31')][_0x2ac9('0x35')]));_0xd293f[_0x2ac9('0x34')]=_0xd293f[_0x2ac9('0x34')][_0x2ac9('0x36')]?_0xd293f['attributes']:_0x43f041['model'];if(!_0x1ed878[_0x2ac9('0x31')]['hasOwnProperty'](_0x2ac9('0x37'))){_0xd293f[_0x2ac9('0x1e')]=qs[_0x2ac9('0x1e')](_0x1ed878[_0x2ac9('0x31')][_0x2ac9('0x1e')]);_0xd293f[_0x2ac9('0x1c')]=qs['offset'](_0x1ed878[_0x2ac9('0x31')][_0x2ac9('0x1c')]);}_0xd293f[_0x2ac9('0x38')]=qs[_0x2ac9('0x39')](_0x1ed878[_0x2ac9('0x31')][_0x2ac9('0x39')]);_0xd293f[_0x2ac9('0x3a')]=qs[_0x2ac9('0x3b')](_[_0x2ac9('0x3c')](_0x1ed878[_0x2ac9('0x31')],_0x43f041[_0x2ac9('0x3b')]),_0x38d965);if(_0x1ed878[_0x2ac9('0x31')][_0x2ac9('0x3d')]){_0xd293f['where']=_[_0x2ac9('0x3e')](_0xd293f['where'],{'$or':_[_0x2ac9('0x2b')](_0x38d965,function(_0x311b0a){if(_0x311b0a[_0x2ac9('0x2f')]!==_0x2ac9('0x3f')){var _0x41917c={};_0x41917c[_0x311b0a[_0x2ac9('0x28')]]={'$like':'%'+_0x1ed878[_0x2ac9('0x31')][_0x2ac9('0x3d')]+'%'};return _0x41917c;}})});}_0xd293f=_['merge']({},_0xd293f,_0x1ed878[_0x2ac9('0x40')]);var _0x403012={'where':_0xd293f['where']};return db[_0x2ac9('0x2c')][_0x2ac9('0x1f')](_0x403012)[_0x2ac9('0x25')](function(_0x28af4e){_0x3d5dd9[_0x2ac9('0x1f')]=_0x28af4e;if(_0x1ed878[_0x2ac9('0x31')][_0x2ac9('0x41')]){_0xd293f[_0x2ac9('0x42')]=[{'all':!![]}];}return db[_0x2ac9('0x2c')][_0x2ac9('0x43')](_0xd293f);})[_0x2ac9('0x25')](function(_0x3216af){_0x3d5dd9[_0x2ac9('0x44')]=_0x3216af;return _0x3d5dd9;})[_0x2ac9('0x25')](respondWithFilteredResult(_0x3b157b,_0xd293f))['catch'](handleError(_0x3b157b,null));};exports['show']=function(_0x44ec21,_0xe45e88){var _0x3174d6={'raw':!![],'where':{'id':_0x44ec21[_0x2ac9('0x45')]['id']}},_0x3f2a62={};_0x3f2a62['model']=_[_0x2ac9('0x46')](db['ServicenowField'][_0x2ac9('0x2d')]);_0x3f2a62['query']=_[_0x2ac9('0x46')](_0x44ec21[_0x2ac9('0x31')]);_0x3f2a62[_0x2ac9('0x3b')]=_[_0x2ac9('0x32')](_0x3f2a62[_0x2ac9('0x33')],_0x3f2a62['query']);_0x3174d6[_0x2ac9('0x34')]=_[_0x2ac9('0x32')](_0x3f2a62['model'],qs[_0x2ac9('0x35')](_0x44ec21[_0x2ac9('0x31')]['fields']));_0x3174d6[_0x2ac9('0x34')]=_0x3174d6['attributes'][_0x2ac9('0x36')]?_0x3174d6[_0x2ac9('0x34')]:_0x3f2a62[_0x2ac9('0x33')];if(_0x44ec21[_0x2ac9('0x31')][_0x2ac9('0x41')]){_0x3174d6[_0x2ac9('0x42')]=[{'all':!![]}];}_0x3174d6=_[_0x2ac9('0x3e')]({},_0x3174d6,_0x44ec21[_0x2ac9('0x40')]);return db[_0x2ac9('0x2c')][_0x2ac9('0x47')](_0x3174d6)[_0x2ac9('0x25')](handleEntityNotFound(_0xe45e88,null))[_0x2ac9('0x25')](respondWithResult(_0xe45e88,null))['catch'](handleError(_0xe45e88,null));};exports[_0x2ac9('0x48')]=function(_0x383afa,_0x2205ad){return db[_0x2ac9('0x2c')][_0x2ac9('0x48')](_0x383afa['body'],{})[_0x2ac9('0x25')](respondWithResult(_0x2205ad,0xc9))[_0x2ac9('0x49')](handleError(_0x2205ad,null));};exports[_0x2ac9('0x24')]=function(_0x14e76f,_0x28cbd5){if(_0x14e76f[_0x2ac9('0x4a')]['id']){delete _0x14e76f[_0x2ac9('0x4a')]['id'];}return db[_0x2ac9('0x2c')][_0x2ac9('0x47')]({'where':{'id':_0x14e76f[_0x2ac9('0x45')]['id']}})[_0x2ac9('0x25')](handleEntityNotFound(_0x28cbd5,null))[_0x2ac9('0x25')](saveUpdates(_0x14e76f[_0x2ac9('0x4a')],null))[_0x2ac9('0x25')](respondWithResult(_0x28cbd5,null))['catch'](handleError(_0x28cbd5,null));};exports['destroy']=function(_0x10dc5a,_0xc10205){return db[_0x2ac9('0x2c')][_0x2ac9('0x47')]({'where':{'id':_0x10dc5a['params']['id']}})['then'](handleEntityNotFound(_0xc10205,null))['then'](removeEntity(_0xc10205,null))[_0x2ac9('0x49')](handleError(_0xc10205,null));}; \ No newline at end of file +var _0xd42d=['end','offset','limit','count','Content-Range','json','reject','save','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','../../mysqldb','sendStatus','status'];(function(_0x49b695,_0x3de243){var _0x121214=function(_0x1dc649){while(--_0x1dc649){_0x49b695['push'](_0x49b695['shift']());}};_0x121214(++_0x3de243);}(_0xd42d,0xc2));var _0xdd42=function(_0x4d81c5,_0x131026){_0x4d81c5=_0x4d81c5-0x0;var _0x245b9e=_0xd42d[_0x4d81c5];return _0x245b9e;};'use strict';var emlformat=require(_0xdd42('0x0'));var rimraf=require(_0xdd42('0x1'));var zipdir=require(_0xdd42('0x2'));var jsonpatch=require(_0xdd42('0x3'));var rp=require(_0xdd42('0x4'));var moment=require(_0xdd42('0x5'));var BPromise=require(_0xdd42('0x6'));var Mustache=require(_0xdd42('0x7'));var util=require(_0xdd42('0x8'));var path=require('path');var sox=require(_0xdd42('0x9'));var csv=require(_0xdd42('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd42('0xb'));var squel=require(_0xdd42('0xc'));var crypto=require(_0xdd42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdd42('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdd42('0xf'));var Redis=require('ioredis');var authService=require(_0xdd42('0x10'));var qs=require(_0xdd42('0x11'));var as=require(_0xdd42('0x12'));var hardwareService=require(_0xdd42('0x13'));var logger=require(_0xdd42('0x14'))(_0xdd42('0x15'));var utils=require(_0xdd42('0x16'));var config=require(_0xdd42('0x17'));var licenseUtil=require(_0xdd42('0x18'));var db=require(_0xdd42('0x19'))['db'];function respondWithStatusCode(_0x23a370,_0x18c16d){_0x18c16d=_0x18c16d||0xcc;return function(_0x5d35af){if(_0x5d35af){return _0x23a370[_0xdd42('0x1a')](_0x18c16d);}return _0x23a370[_0xdd42('0x1b')](_0x18c16d)[_0xdd42('0x1c')]();};}function respondWithResult(_0x1b4418,_0x33b998){_0x33b998=_0x33b998||0xc8;return function(_0x17c4e1){if(_0x17c4e1){return _0x1b4418[_0xdd42('0x1b')](_0x33b998)['json'](_0x17c4e1);}};}function respondWithFilteredResult(_0x1eccbf,_0x4ada81){return function(_0x20e748){if(_0x20e748){var _0x44f836=typeof _0x4ada81[_0xdd42('0x1d')]==='undefined'&&typeof _0x4ada81[_0xdd42('0x1e')]==='undefined';var _0x2ad4e9=_0x20e748[_0xdd42('0x1f')];var _0x4d8cbe=_0x44f836?0x0:_0x4ada81[_0xdd42('0x1d')];var _0x429d1e=_0x44f836?_0x20e748[_0xdd42('0x1f')]:_0x4ada81[_0xdd42('0x1d')]+_0x4ada81[_0xdd42('0x1e')];var _0x41d346;if(_0x429d1e>=_0x2ad4e9){_0x429d1e=_0x2ad4e9;_0x41d346=0xc8;}else{_0x41d346=0xce;}_0x1eccbf[_0xdd42('0x1b')](_0x41d346);return _0x1eccbf['set'](_0xdd42('0x20'),_0x4d8cbe+'-'+_0x429d1e+'/'+_0x2ad4e9)[_0xdd42('0x21')](_0x20e748);}return null;};}function patchUpdates(_0x52df9a){return function(_0x22f966){try{jsonpatch['apply'](_0x22f966,_0x52df9a,!![]);}catch(_0x5b1a73){return BPromise[_0xdd42('0x22')](_0x5b1a73);}return _0x22f966[_0xdd42('0x23')]();};}function saveUpdates(_0x3445a7,_0x56d34b){return function(_0x4ab317){if(_0x4ab317){return _0x4ab317['update'](_0x3445a7)['then'](function(_0x2712dd){return _0x2712dd;});}return null;};}function removeEntity(_0x45d6a6,_0x4711ee){return function(_0x203a24){if(_0x203a24){return _0x203a24[_0xdd42('0x24')]()['then'](function(){_0x45d6a6[_0xdd42('0x1b')](0xcc)[_0xdd42('0x1c')]();});}};}function handleEntityNotFound(_0x9a0abe,_0x850cdf){return function(_0x5ad51e){if(!_0x5ad51e){_0x9a0abe[_0xdd42('0x1a')](0x194);}return _0x5ad51e;};}function handleError(_0x45a00e,_0x528d83){_0x528d83=_0x528d83||0x1f4;return function(_0x4e5192){logger[_0xdd42('0x25')](_0x4e5192[_0xdd42('0x26')]);if(_0x4e5192[_0xdd42('0x27')]){delete _0x4e5192[_0xdd42('0x27')];}_0x45a00e[_0xdd42('0x1b')](_0x528d83)[_0xdd42('0x28')](_0x4e5192);};}exports[_0xdd42('0x29')]=function(_0x5c6864,_0x297e35){var _0xf6d22f={},_0x253683={},_0x3724ae={'count':0x0,'rows':[]};var _0x713ea6=_['map'](db[_0xdd42('0x2a')][_0xdd42('0x2b')],function(_0x1028f9){return{'name':_0x1028f9['fieldName'],'type':_0x1028f9[_0xdd42('0x2c')][_0xdd42('0x2d')]};});_0x253683[_0xdd42('0x2e')]=_[_0xdd42('0x2f')](_0x713ea6,_0xdd42('0x27'));_0x253683[_0xdd42('0x30')]=_[_0xdd42('0x31')](_0x5c6864[_0xdd42('0x30')]);_0x253683[_0xdd42('0x32')]=_[_0xdd42('0x33')](_0x253683['model'],_0x253683[_0xdd42('0x30')]);_0xf6d22f[_0xdd42('0x34')]=_[_0xdd42('0x33')](_0x253683[_0xdd42('0x2e')],qs[_0xdd42('0x35')](_0x5c6864[_0xdd42('0x30')]['fields']));_0xf6d22f[_0xdd42('0x34')]=_0xf6d22f[_0xdd42('0x34')][_0xdd42('0x36')]?_0xf6d22f['attributes']:_0x253683['model'];if(!_0x5c6864[_0xdd42('0x30')][_0xdd42('0x37')]('nolimit')){_0xf6d22f[_0xdd42('0x1e')]=qs[_0xdd42('0x1e')](_0x5c6864[_0xdd42('0x30')][_0xdd42('0x1e')]);_0xf6d22f[_0xdd42('0x1d')]=qs[_0xdd42('0x1d')](_0x5c6864[_0xdd42('0x30')]['offset']);}_0xf6d22f[_0xdd42('0x38')]=qs['sort'](_0x5c6864['query'][_0xdd42('0x39')]);_0xf6d22f[_0xdd42('0x3a')]=qs[_0xdd42('0x32')](_[_0xdd42('0x3b')](_0x5c6864[_0xdd42('0x30')],_0x253683[_0xdd42('0x32')]),_0x713ea6);if(_0x5c6864[_0xdd42('0x30')]['filter']){_0xf6d22f[_0xdd42('0x3a')]=_['merge'](_0xf6d22f['where'],{'$or':_[_0xdd42('0x2f')](_0x713ea6,function(_0x4f4a5a){if(_0x4f4a5a[_0xdd42('0x2c')]!==_0xdd42('0x3c')){var _0x551b47={};_0x551b47[_0x4f4a5a['name']]={'$like':'%'+_0x5c6864['query'][_0xdd42('0x3d')]+'%'};return _0x551b47;}})});}_0xf6d22f=_[_0xdd42('0x3e')]({},_0xf6d22f,_0x5c6864['options']);var _0x5f476b={'where':_0xf6d22f[_0xdd42('0x3a')]};return db['ServicenowField'][_0xdd42('0x1f')](_0x5f476b)[_0xdd42('0x3f')](function(_0x40d09d){_0x3724ae[_0xdd42('0x1f')]=_0x40d09d;if(_0x5c6864['query'][_0xdd42('0x40')]){_0xf6d22f[_0xdd42('0x41')]=[{'all':!![]}];}return db[_0xdd42('0x2a')][_0xdd42('0x42')](_0xf6d22f);})[_0xdd42('0x3f')](function(_0x54c381){_0x3724ae[_0xdd42('0x43')]=_0x54c381;return _0x3724ae;})[_0xdd42('0x3f')](respondWithFilteredResult(_0x297e35,_0xf6d22f))[_0xdd42('0x44')](handleError(_0x297e35,null));};exports[_0xdd42('0x45')]=function(_0x3efda8,_0x4bae9d){var _0x1cf93e={'raw':!![],'where':{'id':_0x3efda8[_0xdd42('0x46')]['id']}},_0x40ad12={};_0x40ad12['model']=_[_0xdd42('0x31')](db[_0xdd42('0x2a')]['rawAttributes']);_0x40ad12['query']=_[_0xdd42('0x31')](_0x3efda8['query']);_0x40ad12[_0xdd42('0x32')]=_[_0xdd42('0x33')](_0x40ad12[_0xdd42('0x2e')],_0x40ad12[_0xdd42('0x30')]);_0x1cf93e[_0xdd42('0x34')]=_[_0xdd42('0x33')](_0x40ad12[_0xdd42('0x2e')],qs[_0xdd42('0x35')](_0x3efda8[_0xdd42('0x30')][_0xdd42('0x35')]));_0x1cf93e[_0xdd42('0x34')]=_0x1cf93e[_0xdd42('0x34')][_0xdd42('0x36')]?_0x1cf93e[_0xdd42('0x34')]:_0x40ad12[_0xdd42('0x2e')];if(_0x3efda8[_0xdd42('0x30')][_0xdd42('0x40')]){_0x1cf93e['include']=[{'all':!![]}];}_0x1cf93e=_[_0xdd42('0x3e')]({},_0x1cf93e,_0x3efda8['options']);return db[_0xdd42('0x2a')][_0xdd42('0x47')](_0x1cf93e)[_0xdd42('0x3f')](handleEntityNotFound(_0x4bae9d,null))[_0xdd42('0x3f')](respondWithResult(_0x4bae9d,null))[_0xdd42('0x44')](handleError(_0x4bae9d,null));};exports[_0xdd42('0x48')]=function(_0x5652a9,_0x396d13){return db[_0xdd42('0x2a')]['create'](_0x5652a9[_0xdd42('0x49')],{})[_0xdd42('0x3f')](respondWithResult(_0x396d13,0xc9))[_0xdd42('0x44')](handleError(_0x396d13,null));};exports['update']=function(_0x4aeb0f,_0x26ea08){if(_0x4aeb0f[_0xdd42('0x49')]['id']){delete _0x4aeb0f[_0xdd42('0x49')]['id'];}return db[_0xdd42('0x2a')][_0xdd42('0x47')]({'where':{'id':_0x4aeb0f[_0xdd42('0x46')]['id']}})[_0xdd42('0x3f')](handleEntityNotFound(_0x26ea08,null))[_0xdd42('0x3f')](saveUpdates(_0x4aeb0f['body'],null))[_0xdd42('0x3f')](respondWithResult(_0x26ea08,null))[_0xdd42('0x44')](handleError(_0x26ea08,null));};exports[_0xdd42('0x24')]=function(_0x2e804d,_0x4d751e){return db[_0xdd42('0x2a')][_0xdd42('0x47')]({'where':{'id':_0x2e804d['params']['id']}})['then'](handleEntityNotFound(_0x4d751e,null))[_0xdd42('0x3f')](removeEntity(_0x4d751e,null))[_0xdd42('0x44')](handleError(_0x4d751e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 569b033..5248090 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 _0xd5e5=['./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e01f8,_0x29cb21){var _0x1604cf=function(_0x181b94){while(--_0x181b94){_0x5e01f8['push'](_0x5e01f8['shift']());}};_0x1604cf(++_0x29cb21);}(_0xd5e5,0x1c7));var _0x5d5e=function(_0x1ec8f9,_0x22f5e7){_0x1ec8f9=_0x1ec8f9-0x0;var _0x17cd3d=_0xd5e5[_0x1ec8f9];return _0x17cd3d;};'use strict';var _=require(_0x5d5e('0x0'));var util=require(_0x5d5e('0x1'));var logger=require(_0x5d5e('0x2'))('api');var moment=require(_0x5d5e('0x3'));var BPromise=require(_0x5d5e('0x4'));var rp=require(_0x5d5e('0x5'));var fs=require('fs');var path=require(_0x5d5e('0x6'));var rimraf=require(_0x5d5e('0x7'));var config=require(_0x5d5e('0x8'));var attributes=require(_0x5d5e('0x9'));module[_0x5d5e('0xa')]=function(_0x1b107e,_0x14c034){return _0x1b107e[_0x5d5e('0xb')]('ServicenowField',attributes,{'tableName':_0x5d5e('0xc'),'paranoid':![],'indexes':[{'name':_0x5d5e('0xd'),'fields':[_0x5d5e('0xe'),_0x5d5e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xace8=['../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3e45a6,_0x576195){var _0x4751f7=function(_0x14d175){while(--_0x14d175){_0x3e45a6['push'](_0x3e45a6['shift']());}};_0x4751f7(++_0x576195);}(_0xace8,0x88));var _0x8ace=function(_0x27f157,_0x5055df){_0x27f157=_0x27f157-0x0;var _0x3d765=_0xace8[_0x27f157];return _0x3d765;};'use strict';var _=require(_0x8ace('0x0'));var util=require(_0x8ace('0x1'));var logger=require(_0x8ace('0x2'))(_0x8ace('0x3'));var moment=require(_0x8ace('0x4'));var BPromise=require(_0x8ace('0x5'));var rp=require(_0x8ace('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ace('0x7'));var config=require(_0x8ace('0x8'));var attributes=require(_0x8ace('0x9'));module['exports']=function(_0x56b566,_0x571c6c){return _0x56b566[_0x8ace('0xa')](_0x8ace('0xb'),attributes,{'tableName':_0x8ace('0xc'),'paranoid':![],'indexes':[{'name':_0x8ace('0xd'),'fields':[_0x8ace('0xe'),_0x8ace('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 42f5977..0663f1e 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x16fa0c,_0x211a76){var _0x27e477=function(_0x530653){while(--_0x530653){_0x16fa0c['push'](_0x16fa0c['shift']());}};_0x27e477(++_0x211a76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 4b76c78..0d6379a 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(_0x21c40c,_0x4ef1ad){var _0xe6e080=function(_0x59e7df){while(--_0x59e7df){_0x21c40c['push'](_0x21c40c['shift']());}};_0xe6e080(++_0x4ef1ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x1bd162,_0x4e49c0){var _0x462838=function(_0x52d3e6){while(--_0x52d3e6){_0x1bd162['push'](_0x1bd162['shift']());}};_0x462838(++_0x4e49c0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 c736762..f32630d 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(_0x3d145d,_0x10f557){var _0x4195dd=function(_0x37a93d){while(--_0x37a93d){_0x3d145d['push'](_0x3d145d['shift']());}};_0x4195dd(++_0x10f557);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x100c69,_0x3ab91c){var _0x160855=function(_0x5d45e3){while(--_0x5d45e3){_0x100c69['push'](_0x100c69['shift']());}};_0x160855(++_0x3ab91c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 c702492..5aa6fa2 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 _0x6dc6=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','error','stack','name','send','map','SugarcrmAccount','fieldName','type','query','intersection','model','attributes','fields','length','order','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','rawAttributes','options','create','body','find','params','getConfigurations','findOne','keys','SugarcrmConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','POST','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','stringify','values','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis'];(function(_0x34720e,_0x4bf2cf){var _0x44c126=function(_0x1cb532){while(--_0x1cb532){_0x34720e['push'](_0x34720e['shift']());}};_0x44c126(++_0x4bf2cf);}(_0x6dc6,0x14a));var _0x66dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6dc6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x66dc('0x0'));var rimraf=require(_0x66dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x66dc('0x2'));var moment=require(_0x66dc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x66dc('0x4'));var util=require(_0x66dc('0x5'));var path=require(_0x66dc('0x6'));var sox=require(_0x66dc('0x7'));var csv=require('to-csv');var ejs=require(_0x66dc('0x8'));var fs=require('fs');var fs_extra=require(_0x66dc('0x9'));var _=require(_0x66dc('0xa'));var squel=require(_0x66dc('0xb'));var crypto=require(_0x66dc('0xc'));var jsforce=require(_0x66dc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x66dc('0xe'));var querystring=require(_0x66dc('0xf'));var Papa=require(_0x66dc('0x10'));var Redis=require(_0x66dc('0x11'));var authService=require(_0x66dc('0x12'));var qs=require(_0x66dc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66dc('0x14'));var logger=require(_0x66dc('0x15'))(_0x66dc('0x16'));var utils=require(_0x66dc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x66dc('0x18'));var db=require(_0x66dc('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x510e51,_0x2326af){_0x2326af=_0x2326af||0xcc;return function(_0x2fd260){if(_0x2fd260){return _0x510e51[_0x66dc('0x1a')](_0x2326af);}return _0x510e51[_0x66dc('0x1b')](_0x2326af)[_0x66dc('0x1c')]();};}function respondWithResult(_0x2d4aea,_0x310013){_0x310013=_0x310013||0xc8;return function(_0x28e223){if(_0x28e223){return _0x2d4aea[_0x66dc('0x1b')](_0x310013)[_0x66dc('0x1d')](_0x28e223);}};}function respondWithFilteredResult(_0x291262,_0x4cb04b){return function(_0x113ee8){if(_0x113ee8){var _0x3cb743=typeof _0x4cb04b[_0x66dc('0x1e')]===_0x66dc('0x1f')&&typeof _0x4cb04b['limit']==='undefined';var _0x328812=_0x113ee8[_0x66dc('0x20')];var _0x2a448f=_0x3cb743?0x0:_0x4cb04b[_0x66dc('0x1e')];var _0x29cdea=_0x3cb743?_0x113ee8[_0x66dc('0x20')]:_0x4cb04b[_0x66dc('0x1e')]+_0x4cb04b[_0x66dc('0x21')];var _0x219f25;if(_0x29cdea>=_0x328812){_0x29cdea=_0x328812;_0x219f25=0xc8;}else{_0x219f25=0xce;}_0x291262[_0x66dc('0x1b')](_0x219f25);return _0x291262[_0x66dc('0x22')]('Content-Range',_0x2a448f+'-'+_0x29cdea+'/'+_0x328812)['json'](_0x113ee8);}return null;};}function patchUpdates(_0x23a137){return function(_0x205bee){try{jsonpatch[_0x66dc('0x23')](_0x205bee,_0x23a137,!![]);}catch(_0x1e2d8f){return BPromise['reject'](_0x1e2d8f);}return _0x205bee[_0x66dc('0x24')]();};}function saveUpdates(_0x4e25df,_0x29a9c0){return function(_0xed62aa){if(_0xed62aa){return _0xed62aa['update'](_0x4e25df)[_0x66dc('0x25')](function(_0x187747){return _0x187747;});}return null;};}function removeEntity(_0x59b372,_0x87c547){return function(_0x3b7af3){if(_0x3b7af3){return _0x3b7af3[_0x66dc('0x26')]()['then'](function(){_0x59b372[_0x66dc('0x1b')](0xcc)[_0x66dc('0x1c')]();});}};}function handleEntityNotFound(_0x2dbeef,_0x4213e4){return function(_0x5ce751){if(!_0x5ce751){_0x2dbeef[_0x66dc('0x1a')](0x194);}return _0x5ce751;};}function handleError(_0x10e7d7,_0x500544){_0x500544=_0x500544||0x1f4;return function(_0x4ffa30){logger[_0x66dc('0x27')](_0x4ffa30[_0x66dc('0x28')]);if(_0x4ffa30['name']){delete _0x4ffa30[_0x66dc('0x29')];}_0x10e7d7[_0x66dc('0x1b')](_0x500544)[_0x66dc('0x2a')](_0x4ffa30);};}exports['index']=function(_0x508cde,_0x37595d){var _0x19ba65={},_0x7a8f0d={},_0x13c13a={'count':0x0,'rows':[]};var _0x53ca82=_[_0x66dc('0x2b')](db[_0x66dc('0x2c')]['rawAttributes'],function(_0x548b61){return{'name':_0x548b61[_0x66dc('0x2d')],'type':_0x548b61[_0x66dc('0x2e')]['key']};});_0x7a8f0d['model']=_[_0x66dc('0x2b')](_0x53ca82,'name');_0x7a8f0d[_0x66dc('0x2f')]=_['keys'](_0x508cde[_0x66dc('0x2f')]);_0x7a8f0d['filters']=_[_0x66dc('0x30')](_0x7a8f0d[_0x66dc('0x31')],_0x7a8f0d[_0x66dc('0x2f')]);_0x19ba65[_0x66dc('0x32')]=_['intersection'](_0x7a8f0d[_0x66dc('0x31')],qs[_0x66dc('0x33')](_0x508cde['query'][_0x66dc('0x33')]));_0x19ba65[_0x66dc('0x32')]=_0x19ba65[_0x66dc('0x32')][_0x66dc('0x34')]?_0x19ba65[_0x66dc('0x32')]:_0x7a8f0d[_0x66dc('0x31')];if(!_0x508cde[_0x66dc('0x2f')]['hasOwnProperty']('nolimit')){_0x19ba65['limit']=qs[_0x66dc('0x21')](_0x508cde[_0x66dc('0x2f')]['limit']);_0x19ba65[_0x66dc('0x1e')]=qs[_0x66dc('0x1e')](_0x508cde[_0x66dc('0x2f')]['offset']);}_0x19ba65[_0x66dc('0x35')]=qs[_0x66dc('0x36')](_0x508cde[_0x66dc('0x2f')][_0x66dc('0x36')]);_0x19ba65[_0x66dc('0x37')]=qs[_0x66dc('0x38')](_[_0x66dc('0x39')](_0x508cde['query'],_0x7a8f0d[_0x66dc('0x38')]),_0x53ca82);if(_0x508cde[_0x66dc('0x2f')]['filter']){_0x19ba65[_0x66dc('0x37')]=_['merge'](_0x19ba65[_0x66dc('0x37')],{'$or':_['map'](_0x53ca82,function(_0x419405){if(_0x419405[_0x66dc('0x2e')]!==_0x66dc('0x3a')){var _0x293a69={};_0x293a69[_0x419405[_0x66dc('0x29')]]={'$like':'%'+_0x508cde[_0x66dc('0x2f')][_0x66dc('0x3b')]+'%'};return _0x293a69;}})});}_0x19ba65=_[_0x66dc('0x3c')]({},_0x19ba65,_0x508cde['options']);var _0x40ff37={'where':_0x19ba65[_0x66dc('0x37')]};return db[_0x66dc('0x2c')][_0x66dc('0x20')](_0x40ff37)[_0x66dc('0x25')](function(_0x58b341){_0x13c13a[_0x66dc('0x20')]=_0x58b341;if(_0x508cde[_0x66dc('0x2f')][_0x66dc('0x3d')]){_0x19ba65[_0x66dc('0x3e')]=[{'all':!![]}];}return db[_0x66dc('0x2c')]['findAll'](_0x19ba65);})[_0x66dc('0x25')](function(_0x18cf26){_0x13c13a[_0x66dc('0x3f')]=_0x18cf26;return _0x13c13a;})[_0x66dc('0x25')](respondWithFilteredResult(_0x37595d,_0x19ba65))[_0x66dc('0x40')](handleError(_0x37595d,null));};exports[_0x66dc('0x41')]=function(_0x2a7efe,_0x54a915){var _0x7009e={'raw':![],'where':{'id':_0x2a7efe['params']['id']}},_0x20772d={};_0x20772d['model']=_['keys'](db[_0x66dc('0x2c')][_0x66dc('0x42')]);_0x20772d[_0x66dc('0x2f')]=_['keys'](_0x2a7efe[_0x66dc('0x2f')]);_0x20772d[_0x66dc('0x38')]=_['intersection'](_0x20772d[_0x66dc('0x31')],_0x20772d['query']);_0x7009e['attributes']=_[_0x66dc('0x30')](_0x20772d[_0x66dc('0x31')],qs[_0x66dc('0x33')](_0x2a7efe[_0x66dc('0x2f')][_0x66dc('0x33')]));_0x7009e['attributes']=_0x7009e[_0x66dc('0x32')][_0x66dc('0x34')]?_0x7009e['attributes']:_0x20772d['model'];if(_0x2a7efe['query'][_0x66dc('0x3d')]){_0x7009e[_0x66dc('0x3e')]=[{'all':!![]}];}_0x7009e=_[_0x66dc('0x3c')]({},_0x7009e,_0x2a7efe[_0x66dc('0x43')]);return db[_0x66dc('0x2c')]['find'](_0x7009e)[_0x66dc('0x25')](handleEntityNotFound(_0x54a915,null))[_0x66dc('0x25')](respondWithResult(_0x54a915,null))['catch'](handleError(_0x54a915,null));};exports[_0x66dc('0x44')]=function(_0x5be1cb,_0x470a8b){return db['SugarcrmAccount'][_0x66dc('0x44')](_0x5be1cb['body'],{})[_0x66dc('0x25')](respondWithResult(_0x470a8b,0xc9))['catch'](handleError(_0x470a8b,null));};exports['update']=function(_0x1a4772,_0x296b39){if(_0x1a4772[_0x66dc('0x45')]['id']){delete _0x1a4772[_0x66dc('0x45')]['id'];}return db[_0x66dc('0x2c')][_0x66dc('0x46')]({'where':{'id':_0x1a4772[_0x66dc('0x47')]['id']}})[_0x66dc('0x25')](handleEntityNotFound(_0x296b39,null))[_0x66dc('0x25')](saveUpdates(_0x1a4772['body'],null))[_0x66dc('0x25')](respondWithResult(_0x296b39,null))[_0x66dc('0x40')](handleError(_0x296b39,null));};exports['destroy']=function(_0x569958,_0x74fcdb){return db['SugarcrmAccount'][_0x66dc('0x46')]({'where':{'id':_0x569958[_0x66dc('0x47')]['id']}})[_0x66dc('0x25')](handleEntityNotFound(_0x74fcdb,null))['then'](removeEntity(_0x74fcdb,null))[_0x66dc('0x40')](handleError(_0x74fcdb,null));};exports[_0x66dc('0x48')]=function(_0x583a6c,_0x2fd0cd,_0x602de3){var _0x235b4b={};var _0x9e6382={};var _0x2ce02e;var _0x1418e3;return db['SugarcrmAccount'][_0x66dc('0x49')]({'where':{'id':_0x583a6c['params']['id']}})[_0x66dc('0x25')](handleEntityNotFound(_0x2fd0cd,null))[_0x66dc('0x25')](function(_0x231d2e){if(_0x231d2e){_0x2ce02e=_0x231d2e;_0x9e6382['model']=_[_0x66dc('0x4a')](db[_0x66dc('0x4b')][_0x66dc('0x42')]);_0x9e6382[_0x66dc('0x2f')]=_['keys'](_0x583a6c[_0x66dc('0x2f')]);_0x9e6382[_0x66dc('0x38')]=_['intersection'](_0x9e6382['model'],_0x9e6382[_0x66dc('0x2f')]);_0x235b4b['attributes']=_['intersection'](_0x9e6382['model'],qs[_0x66dc('0x33')](_0x583a6c['query'][_0x66dc('0x33')]));_0x235b4b['attributes']=_0x235b4b[_0x66dc('0x32')][_0x66dc('0x34')]?_0x235b4b[_0x66dc('0x32')]:_0x9e6382[_0x66dc('0x31')];_0x235b4b[_0x66dc('0x35')]=qs['sort'](_0x583a6c['query']['sort']);_0x235b4b[_0x66dc('0x37')]=qs[_0x66dc('0x38')](_[_0x66dc('0x39')](_0x583a6c['query'],_0x9e6382[_0x66dc('0x38')]));if(_0x583a6c[_0x66dc('0x2f')][_0x66dc('0x3b')]){_0x235b4b[_0x66dc('0x37')]=_['merge'](_0x235b4b[_0x66dc('0x37')],{'$or':_['map'](_0x235b4b[_0x66dc('0x32')],function(_0x1a4ff8){var _0x253098={};_0x253098[_0x1a4ff8]={'$like':'%'+_0x583a6c['query'][_0x66dc('0x3b')]+'%'};return _0x253098;})});}_0x235b4b=_[_0x66dc('0x3c')]({},_0x235b4b,_0x583a6c[_0x66dc('0x43')]);return _0x2ce02e['getConfigurations'](_0x235b4b);}})[_0x66dc('0x25')](function(_0x1efc9c){if(_0x1efc9c){_0x1418e3=_0x1efc9c[_0x66dc('0x34')];if(!_0x583a6c[_0x66dc('0x2f')][_0x66dc('0x4c')](_0x66dc('0x4d'))){_0x235b4b[_0x66dc('0x21')]=qs[_0x66dc('0x21')](_0x583a6c[_0x66dc('0x2f')][_0x66dc('0x21')]);_0x235b4b[_0x66dc('0x1e')]=qs[_0x66dc('0x1e')](_0x583a6c[_0x66dc('0x2f')][_0x66dc('0x1e')]);}return _0x2ce02e[_0x66dc('0x48')](_0x235b4b);}})[_0x66dc('0x25')](function(_0x59e834){if(_0x59e834){return _0x59e834?{'count':_0x1418e3,'rows':_0x59e834}:null;}})[_0x66dc('0x25')](respondWithResult(_0x2fd0cd,null))[_0x66dc('0x40')](handleError(_0x2fd0cd,null));};exports[_0x66dc('0x4e')]=function(_0x2f1725,_0x3c6c74,_0x291fdc){if(_0x2f1725[_0x66dc('0x45')]['id']){delete _0x2f1725[_0x66dc('0x45')]['id'];}return db[_0x66dc('0x2c')]['findOne']({'where':{'id':_0x2f1725['params']['id']}})['then'](handleEntityNotFound(_0x3c6c74,null))[_0x66dc('0x25')](function(_0x10fa3c){if(_0x10fa3c){_0x2f1725[_0x66dc('0x45')][_0x66dc('0x4f')]=_0x10fa3c['id'];_0x2f1725[_0x66dc('0x45')]['Subjects']=integrations[_0x66dc('0x50')](_0x2f1725['body'][_0x66dc('0x51')],_0x2f1725[_0x66dc('0x45')][_0x66dc('0x2e')]);_0x2f1725['body'][_0x66dc('0x52')]=integrations['getDescriptions'](_0x2f1725['body']['channel'],_0x2f1725['body'][_0x66dc('0x2e')]);return db[_0x66dc('0x4b')]['create'](_0x2f1725[_0x66dc('0x45')],{'include':[{'model':db['SugarcrmField'],'as':_0x66dc('0x53')},{'model':db['SugarcrmField'],'as':_0x66dc('0x52')}]});}return null;})['then'](respondWithResult(_0x3c6c74,null))[_0x66dc('0x40')](handleError(_0x3c6c74,null));};exports[_0x66dc('0x54')]=function(_0x1aa0e0,_0x3e94dd,_0x399786){var _0x14a7e0='';var _0x1195a5=['id',_0x66dc('0x29'),_0x66dc('0x55'),_0x66dc('0x56'),'description','date_start',_0x66dc('0x57'),_0x66dc('0x58'),'parent_id',_0x66dc('0x59'),_0x66dc('0x5a'),_0x66dc('0x5b')];return db[_0x66dc('0x2c')][_0x66dc('0x49')]({'where':{'id':_0x1aa0e0['params']['id']},'attributes':['id',_0x66dc('0x5c'),_0x66dc('0x5d'),'remoteUri']})[_0x66dc('0x25')](handleEntityNotFound(_0x3e94dd,null))[_0x66dc('0x25')](function(_0x1fab34){if(_0x1fab34){_0x14a7e0=_0x1fab34[_0x66dc('0x5e')];var _0x2d050d=_0x14a7e0[_0x66dc('0x5f')](-0x1);if(_0x2d050d==='/'){_0x14a7e0=_0x14a7e0['substring'](0x0,_0x14a7e0['lastIndexOf'](_0x2d050d));}return rp({'method':_0x66dc('0x60'),'uri':util['format']('%s%s',_0x14a7e0,_0x66dc('0x61')),'json':!![],'form':{'method':_0x66dc('0x62'),'input_type':'JSON','response_type':_0x66dc('0x63'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1fab34[_0x66dc('0x5c')],'password':_0x1fab34[_0x66dc('0x5d')],'encryption':_0x66dc('0x64')},'application':_0x66dc('0x65')})}});}})['then'](function(_0x1088fc){if(_0x1088fc&&_0x1088fc[_0x66dc('0x29')]!==_0x66dc('0x66')&&_0x1088fc['name']!==_0x66dc('0x67')){return rp({'method':_0x66dc('0x60'),'uri':util[_0x66dc('0x68')]('%s%s',_0x14a7e0,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x66dc('0x63'),'response_type':_0x66dc('0x63'),'rest_data':JSON[_0x66dc('0x69')]({'session':_0x1088fc['id'],'module_name':'Calls'})}})[_0x66dc('0x25')](function(_0x4c33c5){if(_0x4c33c5){var _0x4dfa37=_[_0x66dc('0x6a')](_0x4c33c5['module_fields']);_[_0x66dc('0x6b')](_0x4dfa37,function(_0x4f5a00){return _0x1195a5[_0x66dc('0x6c')](_0x4f5a00[_0x66dc('0x29')]);});return{'count':_0x4dfa37['length'],'rows':_['map'](_0x4dfa37,function(_0x51e895){return{'id':_0x51e895[_0x66dc('0x29')],'name':_0x51e895[_0x66dc('0x6d')],'custom':_[_0x66dc('0x6e')](_0x51e895[_0x66dc('0x29')],'_c')?!![]:![],'options':_0x51e895[_0x66dc('0x43')]?_['map'](_[_0x66dc('0x6a')](_0x51e895[_0x66dc('0x43')]),function(_0x19e79c){return{'name':_0x19e79c[_0x66dc('0x6f')],'value':_0x19e79c[_0x66dc('0x29')]};}):[]};})};}})[_0x66dc('0x25')](respondWithResult(_0x3e94dd,null))['catch'](function(_0x3a23d1){var _0x472069=_0x1aa0e0['query'][_0x66dc('0x70')]?0x1f4:_0x3a23d1[_0x66dc('0x71')]||0x1f4;logger['error'](_0x66dc('0x72'),_0x66dc('0x54'),_0x472069,JSON['stringify'](_0x3a23d1));delete _0x3a23d1[_0x66dc('0x29')];if(_0x472069===0x191){_0x472069=0x190;}_0x3e94dd[_0x66dc('0x1b')](_0x472069)['send'](_0x1aa0e0[_0x66dc('0x2f')][_0x66dc('0x70')]?{'message':_0x66dc('0x73'),'statusCode':_0x3a23d1[_0x66dc('0x71')]}:_0x3a23d1);});}else{var _0x10a8fc=0x1f4;_0x3e94dd[_0x66dc('0x1b')](_0x10a8fc)[_0x66dc('0x2a')]({'message':_0x66dc('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xe9bc=['format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','%s%s','Calls','module_fields','endsWith','values','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','params','merge','find','catch','body','getConfigurations','SugarcrmConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','create','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','lastIndexOf','POST'];(function(_0x378b4e,_0x1e99f7){var _0x127a34=function(_0x1535e6){while(--_0x1535e6){_0x378b4e['push'](_0x378b4e['shift']());}};_0x127a34(++_0x1e99f7);}(_0xe9bc,0x16f));var _0xce9b=function(_0x2b52a0,_0x12f1d7){_0x2b52a0=_0x2b52a0-0x0;var _0x4a47f3=_0xe9bc[_0x2b52a0];return _0x4a47f3;};'use strict';var emlformat=require(_0xce9b('0x0'));var rimraf=require(_0xce9b('0x1'));var zipdir=require(_0xce9b('0x2'));var jsonpatch=require(_0xce9b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce9b('0x4'));var Mustache=require(_0xce9b('0x5'));var util=require(_0xce9b('0x6'));var path=require(_0xce9b('0x7'));var sox=require(_0xce9b('0x8'));var csv=require(_0xce9b('0x9'));var ejs=require(_0xce9b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce9b('0xb'));var squel=require('squel');var crypto=require(_0xce9b('0xc'));var jsforce=require(_0xce9b('0xd'));var deskjs=require(_0xce9b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xce9b('0xf'));var Papa=require('papaparse');var Redis=require(_0xce9b('0x10'));var authService=require(_0xce9b('0x11'));var qs=require(_0xce9b('0x12'));var as=require(_0xce9b('0x13'));var hardwareService=require(_0xce9b('0x14'));var logger=require(_0xce9b('0x15'))(_0xce9b('0x16'));var utils=require(_0xce9b('0x17'));var config=require(_0xce9b('0x18'));var licenseUtil=require(_0xce9b('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xce9b('0x1a'));function respondWithStatusCode(_0x1062f1,_0x3c3feb){_0x3c3feb=_0x3c3feb||0xcc;return function(_0xa9efe4){if(_0xa9efe4){return _0x1062f1[_0xce9b('0x1b')](_0x3c3feb);}return _0x1062f1[_0xce9b('0x1c')](_0x3c3feb)[_0xce9b('0x1d')]();};}function respondWithResult(_0x5517e6,_0x44ece1){_0x44ece1=_0x44ece1||0xc8;return function(_0x4a1edb){if(_0x4a1edb){return _0x5517e6[_0xce9b('0x1c')](_0x44ece1)[_0xce9b('0x1e')](_0x4a1edb);}};}function respondWithFilteredResult(_0x3362ed,_0x122488){return function(_0x352e56){if(_0x352e56){var _0x118063=typeof _0x122488[_0xce9b('0x1f')]===_0xce9b('0x20')&&typeof _0x122488[_0xce9b('0x21')]==='undefined';var _0x3d28b7=_0x352e56[_0xce9b('0x22')];var _0x2948e9=_0x118063?0x0:_0x122488[_0xce9b('0x1f')];var _0x31fd2d=_0x118063?_0x352e56[_0xce9b('0x22')]:_0x122488[_0xce9b('0x1f')]+_0x122488['limit'];var _0x3b1397;if(_0x31fd2d>=_0x3d28b7){_0x31fd2d=_0x3d28b7;_0x3b1397=0xc8;}else{_0x3b1397=0xce;}_0x3362ed['status'](_0x3b1397);return _0x3362ed['set'](_0xce9b('0x23'),_0x2948e9+'-'+_0x31fd2d+'/'+_0x3d28b7)[_0xce9b('0x1e')](_0x352e56);}return null;};}function patchUpdates(_0x2a4a82){return function(_0x6ea784){try{jsonpatch[_0xce9b('0x24')](_0x6ea784,_0x2a4a82,!![]);}catch(_0x2cd824){return BPromise['reject'](_0x2cd824);}return _0x6ea784[_0xce9b('0x25')]();};}function saveUpdates(_0x46a3cb,_0x1020a5){return function(_0x1e3944){if(_0x1e3944){return _0x1e3944[_0xce9b('0x26')](_0x46a3cb)[_0xce9b('0x27')](function(_0x3da075){return _0x3da075;});}return null;};}function removeEntity(_0x40398e,_0xdacf4e){return function(_0x1b2235){if(_0x1b2235){return _0x1b2235[_0xce9b('0x28')]()[_0xce9b('0x27')](function(){_0x40398e[_0xce9b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5fb3,_0x34e49f){return function(_0x1bd4cf){if(!_0x1bd4cf){_0x2a5fb3['sendStatus'](0x194);}return _0x1bd4cf;};}function handleError(_0x330de6,_0x565781){_0x565781=_0x565781||0x1f4;return function(_0x50e71d){logger['error'](_0x50e71d[_0xce9b('0x29')]);if(_0x50e71d[_0xce9b('0x2a')]){delete _0x50e71d[_0xce9b('0x2a')];}_0x330de6[_0xce9b('0x1c')](_0x565781)[_0xce9b('0x2b')](_0x50e71d);};}exports[_0xce9b('0x2c')]=function(_0x59f7b8,_0x40df37){var _0x1e03d3={},_0x231835={},_0x21bb2b={'count':0x0,'rows':[]};var _0x2b0adc=_[_0xce9b('0x2d')](db['SugarcrmAccount'][_0xce9b('0x2e')],function(_0x196c8f){return{'name':_0x196c8f[_0xce9b('0x2f')],'type':_0x196c8f[_0xce9b('0x30')]['key']};});_0x231835[_0xce9b('0x31')]=_[_0xce9b('0x2d')](_0x2b0adc,'name');_0x231835[_0xce9b('0x32')]=_[_0xce9b('0x33')](_0x59f7b8[_0xce9b('0x32')]);_0x231835[_0xce9b('0x34')]=_[_0xce9b('0x35')](_0x231835[_0xce9b('0x31')],_0x231835[_0xce9b('0x32')]);_0x1e03d3[_0xce9b('0x36')]=_[_0xce9b('0x35')](_0x231835[_0xce9b('0x31')],qs[_0xce9b('0x37')](_0x59f7b8[_0xce9b('0x32')][_0xce9b('0x37')]));_0x1e03d3[_0xce9b('0x36')]=_0x1e03d3[_0xce9b('0x36')][_0xce9b('0x38')]?_0x1e03d3['attributes']:_0x231835[_0xce9b('0x31')];if(!_0x59f7b8[_0xce9b('0x32')][_0xce9b('0x39')](_0xce9b('0x3a'))){_0x1e03d3[_0xce9b('0x21')]=qs['limit'](_0x59f7b8[_0xce9b('0x32')][_0xce9b('0x21')]);_0x1e03d3[_0xce9b('0x1f')]=qs[_0xce9b('0x1f')](_0x59f7b8[_0xce9b('0x32')][_0xce9b('0x1f')]);}_0x1e03d3[_0xce9b('0x3b')]=qs[_0xce9b('0x3c')](_0x59f7b8[_0xce9b('0x32')][_0xce9b('0x3c')]);_0x1e03d3[_0xce9b('0x3d')]=qs['filters'](_[_0xce9b('0x3e')](_0x59f7b8[_0xce9b('0x32')],_0x231835[_0xce9b('0x34')]),_0x2b0adc);if(_0x59f7b8[_0xce9b('0x32')][_0xce9b('0x3f')]){_0x1e03d3[_0xce9b('0x3d')]=_['merge'](_0x1e03d3[_0xce9b('0x3d')],{'$or':_[_0xce9b('0x2d')](_0x2b0adc,function(_0xcd12f0){if(_0xcd12f0['type']!==_0xce9b('0x40')){var _0x4ee1d3={};_0x4ee1d3[_0xcd12f0[_0xce9b('0x2a')]]={'$like':'%'+_0x59f7b8['query']['filter']+'%'};return _0x4ee1d3;}})});}_0x1e03d3=_['merge']({},_0x1e03d3,_0x59f7b8[_0xce9b('0x41')]);var _0x4a64c2={'where':_0x1e03d3[_0xce9b('0x3d')]};return db[_0xce9b('0x42')][_0xce9b('0x22')](_0x4a64c2)[_0xce9b('0x27')](function(_0x470aab){_0x21bb2b['count']=_0x470aab;if(_0x59f7b8[_0xce9b('0x32')][_0xce9b('0x43')]){_0x1e03d3[_0xce9b('0x44')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xce9b('0x45')](_0x1e03d3);})[_0xce9b('0x27')](function(_0x471c8f){_0x21bb2b['rows']=_0x471c8f;return _0x21bb2b;})['then'](respondWithFilteredResult(_0x40df37,_0x1e03d3))['catch'](handleError(_0x40df37,null));};exports['show']=function(_0x48760e,_0xe79137){var _0x4628fd={'raw':![],'where':{'id':_0x48760e[_0xce9b('0x46')]['id']}},_0x4d3255={};_0x4d3255[_0xce9b('0x31')]=_[_0xce9b('0x33')](db['SugarcrmAccount'][_0xce9b('0x2e')]);_0x4d3255[_0xce9b('0x32')]=_['keys'](_0x48760e[_0xce9b('0x32')]);_0x4d3255['filters']=_[_0xce9b('0x35')](_0x4d3255['model'],_0x4d3255[_0xce9b('0x32')]);_0x4628fd[_0xce9b('0x36')]=_[_0xce9b('0x35')](_0x4d3255['model'],qs['fields'](_0x48760e[_0xce9b('0x32')][_0xce9b('0x37')]));_0x4628fd[_0xce9b('0x36')]=_0x4628fd[_0xce9b('0x36')][_0xce9b('0x38')]?_0x4628fd[_0xce9b('0x36')]:_0x4d3255[_0xce9b('0x31')];if(_0x48760e['query'][_0xce9b('0x43')]){_0x4628fd[_0xce9b('0x44')]=[{'all':!![]}];}_0x4628fd=_[_0xce9b('0x47')]({},_0x4628fd,_0x48760e[_0xce9b('0x41')]);return db[_0xce9b('0x42')][_0xce9b('0x48')](_0x4628fd)[_0xce9b('0x27')](handleEntityNotFound(_0xe79137,null))[_0xce9b('0x27')](respondWithResult(_0xe79137,null))[_0xce9b('0x49')](handleError(_0xe79137,null));};exports['create']=function(_0x11d4f1,_0x58f96c){return db[_0xce9b('0x42')]['create'](_0x11d4f1[_0xce9b('0x4a')],{})['then'](respondWithResult(_0x58f96c,0xc9))[_0xce9b('0x49')](handleError(_0x58f96c,null));};exports[_0xce9b('0x26')]=function(_0x364bef,_0x468a3e){if(_0x364bef[_0xce9b('0x4a')]['id']){delete _0x364bef[_0xce9b('0x4a')]['id'];}return db['SugarcrmAccount'][_0xce9b('0x48')]({'where':{'id':_0x364bef[_0xce9b('0x46')]['id']}})['then'](handleEntityNotFound(_0x468a3e,null))[_0xce9b('0x27')](saveUpdates(_0x364bef[_0xce9b('0x4a')],null))[_0xce9b('0x27')](respondWithResult(_0x468a3e,null))[_0xce9b('0x49')](handleError(_0x468a3e,null));};exports[_0xce9b('0x28')]=function(_0x707bc3,_0x152c0c){return db[_0xce9b('0x42')]['find']({'where':{'id':_0x707bc3[_0xce9b('0x46')]['id']}})[_0xce9b('0x27')](handleEntityNotFound(_0x152c0c,null))['then'](removeEntity(_0x152c0c,null))[_0xce9b('0x49')](handleError(_0x152c0c,null));};exports[_0xce9b('0x4b')]=function(_0x2a618d,_0x269e81,_0x4aa8d3){var _0x17fa96={};var _0x412e96={};var _0x5de604;var _0x5dd9d1;return db[_0xce9b('0x42')]['findOne']({'where':{'id':_0x2a618d[_0xce9b('0x46')]['id']}})[_0xce9b('0x27')](handleEntityNotFound(_0x269e81,null))[_0xce9b('0x27')](function(_0x4cf471){if(_0x4cf471){_0x5de604=_0x4cf471;_0x412e96[_0xce9b('0x31')]=_[_0xce9b('0x33')](db[_0xce9b('0x4c')]['rawAttributes']);_0x412e96[_0xce9b('0x32')]=_[_0xce9b('0x33')](_0x2a618d['query']);_0x412e96[_0xce9b('0x34')]=_[_0xce9b('0x35')](_0x412e96[_0xce9b('0x31')],_0x412e96['query']);_0x17fa96['attributes']=_[_0xce9b('0x35')](_0x412e96[_0xce9b('0x31')],qs[_0xce9b('0x37')](_0x2a618d[_0xce9b('0x32')]['fields']));_0x17fa96[_0xce9b('0x36')]=_0x17fa96['attributes']['length']?_0x17fa96[_0xce9b('0x36')]:_0x412e96[_0xce9b('0x31')];_0x17fa96[_0xce9b('0x3b')]=qs[_0xce9b('0x3c')](_0x2a618d[_0xce9b('0x32')][_0xce9b('0x3c')]);_0x17fa96[_0xce9b('0x3d')]=qs['filters'](_[_0xce9b('0x3e')](_0x2a618d[_0xce9b('0x32')],_0x412e96[_0xce9b('0x34')]));if(_0x2a618d['query'][_0xce9b('0x3f')]){_0x17fa96[_0xce9b('0x3d')]=_[_0xce9b('0x47')](_0x17fa96[_0xce9b('0x3d')],{'$or':_[_0xce9b('0x2d')](_0x17fa96['attributes'],function(_0x516d62){var _0x41bf10={};_0x41bf10[_0x516d62]={'$like':'%'+_0x2a618d[_0xce9b('0x32')]['filter']+'%'};return _0x41bf10;})});}_0x17fa96=_['merge']({},_0x17fa96,_0x2a618d[_0xce9b('0x41')]);return _0x5de604['getConfigurations'](_0x17fa96);}})[_0xce9b('0x27')](function(_0xb9f19a){if(_0xb9f19a){_0x5dd9d1=_0xb9f19a[_0xce9b('0x38')];if(!_0x2a618d[_0xce9b('0x32')][_0xce9b('0x39')](_0xce9b('0x3a'))){_0x17fa96['limit']=qs[_0xce9b('0x21')](_0x2a618d[_0xce9b('0x32')][_0xce9b('0x21')]);_0x17fa96['offset']=qs[_0xce9b('0x1f')](_0x2a618d[_0xce9b('0x32')][_0xce9b('0x1f')]);}return _0x5de604[_0xce9b('0x4b')](_0x17fa96);}})[_0xce9b('0x27')](function(_0x3b220d){if(_0x3b220d){return _0x3b220d?{'count':_0x5dd9d1,'rows':_0x3b220d}:null;}})['then'](respondWithResult(_0x269e81,null))['catch'](handleError(_0x269e81,null));};exports[_0xce9b('0x4d')]=function(_0x5a70fa,_0x491e41,_0x2f2deb){if(_0x5a70fa[_0xce9b('0x4a')]['id']){delete _0x5a70fa[_0xce9b('0x4a')]['id'];}return db[_0xce9b('0x42')][_0xce9b('0x4e')]({'where':{'id':_0x5a70fa[_0xce9b('0x46')]['id']}})[_0xce9b('0x27')](handleEntityNotFound(_0x491e41,null))[_0xce9b('0x27')](function(_0x28c8ac){if(_0x28c8ac){_0x5a70fa[_0xce9b('0x4a')][_0xce9b('0x4f')]=_0x28c8ac['id'];_0x5a70fa[_0xce9b('0x4a')][_0xce9b('0x50')]=integrations[_0xce9b('0x51')](_0x5a70fa[_0xce9b('0x4a')]['channel'],_0x5a70fa[_0xce9b('0x4a')]['type']);_0x5a70fa['body'][_0xce9b('0x52')]=integrations['getDescriptions'](_0x5a70fa['body'][_0xce9b('0x53')],_0x5a70fa['body']['type']);return db['SugarcrmConfiguration'][_0xce9b('0x54')](_0x5a70fa[_0xce9b('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0xce9b('0x50')},{'model':db[_0xce9b('0x55')],'as':_0xce9b('0x52')}]});}return null;})['then'](respondWithResult(_0x491e41,null))['catch'](handleError(_0x491e41,null));};exports[_0xce9b('0x56')]=function(_0x37e104,_0x34cb7d,_0x3456aa){var _0x3182f5='';var _0x27e122=['id',_0xce9b('0x2a'),_0xce9b('0x57'),_0xce9b('0x58'),'description',_0xce9b('0x59'),_0xce9b('0x5a'),_0xce9b('0x5b'),_0xce9b('0x5c'),_0xce9b('0x5d'),_0xce9b('0x5e'),_0xce9b('0x5f')];return db[_0xce9b('0x42')][_0xce9b('0x4e')]({'where':{'id':_0x37e104[_0xce9b('0x46')]['id']},'attributes':['id',_0xce9b('0x60'),_0xce9b('0x61'),_0xce9b('0x62')]})['then'](handleEntityNotFound(_0x34cb7d,null))['then'](function(_0x4d68ae){if(_0x4d68ae){_0x3182f5=_0x4d68ae['remoteUri'];var _0x5bbd3c=_0x3182f5['slice'](-0x1);if(_0x5bbd3c==='/'){_0x3182f5=_0x3182f5['substring'](0x0,_0x3182f5[_0xce9b('0x63')](_0x5bbd3c));}return rp({'method':_0xce9b('0x64'),'uri':util[_0xce9b('0x65')]('%s%s',_0x3182f5,_0xce9b('0x66')),'json':!![],'form':{'method':_0xce9b('0x67'),'input_type':'JSON','response_type':_0xce9b('0x68'),'rest_data':JSON[_0xce9b('0x69')]({'user_auth':{'user_name':_0x4d68ae[_0xce9b('0x60')],'password':_0x4d68ae[_0xce9b('0x61')],'encryption':_0xce9b('0x6a')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x4feb16){if(_0x4feb16&&_0x4feb16[_0xce9b('0x2a')]!==_0xce9b('0x6b')&&_0x4feb16[_0xce9b('0x2a')]!=='Password\x20Expired'){return rp({'method':_0xce9b('0x64'),'uri':util['format'](_0xce9b('0x6c'),_0x3182f5,_0xce9b('0x66')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xce9b('0x68'),'response_type':_0xce9b('0x68'),'rest_data':JSON[_0xce9b('0x69')]({'session':_0x4feb16['id'],'module_name':_0xce9b('0x6d')})}})[_0xce9b('0x27')](function(_0x25a19c){if(_0x25a19c){var _0x5d2864=_['values'](_0x25a19c[_0xce9b('0x6e')]);_['remove'](_0x5d2864,function(_0x5759b3){return _0x27e122['includes'](_0x5759b3['name']);});return{'count':_0x5d2864[_0xce9b('0x38')],'rows':_[_0xce9b('0x2d')](_0x5d2864,function(_0x1c2f67){return{'id':_0x1c2f67[_0xce9b('0x2a')],'name':_0x1c2f67['label'],'custom':_[_0xce9b('0x6f')](_0x1c2f67[_0xce9b('0x2a')],'_c')?!![]:![],'options':_0x1c2f67[_0xce9b('0x41')]?_['map'](_[_0xce9b('0x70')](_0x1c2f67[_0xce9b('0x41')]),function(_0x1bb317){return{'name':_0x1bb317['value'],'value':_0x1bb317[_0xce9b('0x2a')]};}):[]};})};}})[_0xce9b('0x27')](respondWithResult(_0x34cb7d,null))['catch'](function(_0x2600d6){var _0x114f9e=_0x37e104['query'][_0xce9b('0x71')]?0x1f4:_0x2600d6[_0xce9b('0x72')]||0x1f4;logger[_0xce9b('0x73')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x114f9e,JSON[_0xce9b('0x69')](_0x2600d6));delete _0x2600d6[_0xce9b('0x2a')];if(_0x114f9e===0x191){_0x114f9e=0x190;}_0x34cb7d[_0xce9b('0x1c')](_0x114f9e)['send'](_0x37e104[_0xce9b('0x32')][_0xce9b('0x71')]?{'message':_0xce9b('0x74'),'statusCode':_0x2600d6['statusCode']}:_0x2600d6);});}else{var _0x551e7a=0x1f4;_0x34cb7d['status'](_0x551e7a)[_0xce9b('0x2b')]({'message':'Wrong\x20credentials','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 f340297..0ebdebf 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 _0x5255=['lodash','../../config/logger','moment','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x342a01,_0x149856){var _0x3612a1=function(_0x17f122){while(--_0x17f122){_0x342a01['push'](_0x342a01['shift']());}};_0x3612a1(++_0x149856);}(_0x5255,0xd1));var _0x5525=function(_0x1924e4,_0x30afef){_0x1924e4=_0x1924e4-0x0;var _0x51a6bc=_0x5255[_0x1924e4];return _0x51a6bc;};'use strict';var _=require(_0x5525('0x0'));var util=require('util');var logger=require(_0x5525('0x1'))('api');var moment=require(_0x5525('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5525('0x3'));var config=require(_0x5525('0x4'));var attributes=require(_0x5525('0x5'));var integrations=require(_0x5525('0x6'));module[_0x5525('0x7')]=function(_0x46037f,_0x214256){return _0x46037f[_0x5525('0x8')](_0x5525('0x9'),attributes,{'tableName':_0x5525('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15fc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','int_sugarcrm_accounts'];(function(_0x4612f6,_0x2291c8){var _0x4f5f16=function(_0x5dd442){while(--_0x5dd442){_0x4612f6['push'](_0x4612f6['shift']());}};_0x4f5f16(++_0x2291c8);}(_0x15fc,0x8f));var _0xc15f=function(_0x39f237,_0x20c4be){_0x39f237=_0x39f237-0x0;var _0x3fb158=_0x15fc[_0x39f237];return _0x3fb158;};'use strict';var _=require('lodash');var util=require(_0xc15f('0x0'));var logger=require(_0xc15f('0x1'))(_0xc15f('0x2'));var moment=require(_0xc15f('0x3'));var BPromise=require(_0xc15f('0x4'));var rp=require(_0xc15f('0x5'));var fs=require('fs');var path=require(_0xc15f('0x6'));var rimraf=require(_0xc15f('0x7'));var config=require(_0xc15f('0x8'));var attributes=require(_0xc15f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xc15f('0xa')]=function(_0x46a525,_0x156845){return _0x46a525[_0xc15f('0xb')]('SugarcrmAccount',attributes,{'tableName':_0xc15f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 9f7bda3..94b29fc 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 _0x9171=['include','map','model','attributes','debug','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','limit'];(function(_0x3d604c,_0x264b68){var _0x378a49=function(_0x5be492){while(--_0x5be492){_0x3d604c['push'](_0x3d604c['shift']());}};_0x378a49(++_0x264b68);}(_0x9171,0x92));var _0x1917=function(_0x1b27d6,_0x5c627e){_0x1b27d6=_0x1b27d6-0x0;var _0xa58743=_0x9171[_0x1b27d6];return _0xa58743;};'use strict';var _=require(_0x1917('0x0'));var util=require(_0x1917('0x1'));var moment=require(_0x1917('0x2'));var BPromise=require(_0x1917('0x3'));var rs=require(_0x1917('0x4'));var fs=require('fs');var Redis=require(_0x1917('0x5'));var db=require(_0x1917('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1917('0x7'))(_0x1917('0x8'));var config=require('../../config/environment');var jayson=require(_0x1917('0x9'));var client=jayson[_0x1917('0xa')][_0x1917('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3259f0,_0x29e4d7,_0x208288){return new BPromise(function(_0xfe4420,_0x3aa46e){return client[_0x1917('0xc')](_0x3259f0,_0x208288)[_0x1917('0xd')](function(_0x382189){logger[_0x1917('0xe')](_0x1917('0xf'),_0x29e4d7,_0x1917('0x10'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x29e4d7,_0x1917('0x10'),JSON[_0x1917('0x11')](_0x382189));if(_0x382189['error']){if(_0x382189[_0x1917('0x12')][_0x1917('0x13')]===0x1f4){logger['error'](_0x1917('0xf'),_0x29e4d7,_0x382189[_0x1917('0x12')]['message']);return _0x3aa46e(_0x382189[_0x1917('0x12')][_0x1917('0x14')]);}logger[_0x1917('0x12')](_0x1917('0xf'),_0x29e4d7,_0x382189[_0x1917('0x12')][_0x1917('0x14')]);return _0xfe4420(_0x382189['error'][_0x1917('0x14')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x29e4d7,_0x1917('0x10'));_0xfe4420(_0x382189[_0x1917('0x15')]['message']);}})[_0x1917('0x16')](function(_0x394161){logger[_0x1917('0x12')](_0x1917('0xf'),_0x29e4d7,_0x394161);_0x3aa46e(_0x394161);});});}exports[_0x1917('0x17')]=function(_0x2d55e4){var _0x64160a=this;return new Promise(function(_0x15a583,_0x37a2df){return db['SugarcrmAccount'][_0x1917('0x18')]({'raw':_0x2d55e4[_0x1917('0x19')]?_0x2d55e4[_0x1917('0x19')][_0x1917('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d55e4[_0x1917('0x19')]?_0x2d55e4[_0x1917('0x19')][_0x1917('0x1b')]||null:null,'attributes':_0x2d55e4[_0x1917('0x19')]?_0x2d55e4['options']['attributes']||null:null,'limit':_0x2d55e4[_0x1917('0x19')]?_0x2d55e4[_0x1917('0x19')][_0x1917('0x1c')]||null:null,'include':_0x2d55e4[_0x1917('0x19')]?_0x2d55e4[_0x1917('0x19')][_0x1917('0x1d')]?_[_0x1917('0x1e')](_0x2d55e4['options'][_0x1917('0x1d')],function(_0x366bc8){return{'model':db[_0x366bc8[_0x1917('0x1f')]],'as':_0x366bc8['as'],'attributes':_0x366bc8['attributes'],'include':_0x366bc8[_0x1917('0x1d')]?_[_0x1917('0x1e')](_0x366bc8[_0x1917('0x1d')],function(_0x3b9685){return{'model':db[_0x3b9685['model']],'as':_0x3b9685['as'],'attributes':_0x3b9685['attributes'],'include':_0x3b9685[_0x1917('0x1d')]?_[_0x1917('0x1e')](_0x3b9685['include'],function(_0x1eab14){return{'model':db[_0x1eab14[_0x1917('0x1f')]],'as':_0x1eab14['as'],'attributes':_0x1eab14[_0x1917('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b4692){logger['info']('GetSugarcrmAccount',_0x2d55e4);logger[_0x1917('0x21')]('GetSugarcrmAccount',_0x2d55e4,JSON[_0x1917('0x11')](_0x5b4692));_0x15a583(_0x5b4692);})['catch'](function(_0x57b982){logger[_0x1917('0x12')](_0x1917('0x17'),_0x57b982[_0x1917('0x14')],_0x2d55e4);_0x37a2df(_0x64160a[_0x1917('0x12')](0x1f4,_0x57b982[_0x1917('0x14')]));});});};exports[_0x1917('0x22')]=function(_0x15d2cd){var _0x28779c=this;return new Promise(function(_0x128690,_0x4f71c5){return db['SugarcrmAccount']['find']({'raw':_0x15d2cd['options']?_0x15d2cd[_0x1917('0x19')][_0x1917('0x1a')]===undefined?!![]:![]:!![],'where':_0x15d2cd[_0x1917('0x19')]?_0x15d2cd[_0x1917('0x19')][_0x1917('0x1b')]||null:null,'attributes':_0x15d2cd[_0x1917('0x19')]?_0x15d2cd[_0x1917('0x19')]['attributes']||null:null,'include':_0x15d2cd[_0x1917('0x19')]?_0x15d2cd[_0x1917('0x19')][_0x1917('0x1d')]?_['map'](_0x15d2cd[_0x1917('0x19')][_0x1917('0x1d')],function(_0x1dbe1b){return{'model':db[_0x1dbe1b[_0x1917('0x1f')]],'as':_0x1dbe1b['as'],'attributes':_0x1dbe1b[_0x1917('0x20')],'include':_0x1dbe1b[_0x1917('0x1d')]?_[_0x1917('0x1e')](_0x1dbe1b[_0x1917('0x1d')],function(_0x794c9a){return{'model':db[_0x794c9a[_0x1917('0x1f')]],'as':_0x794c9a['as'],'attributes':_0x794c9a[_0x1917('0x20')],'include':_0x794c9a['include']?_[_0x1917('0x1e')](_0x794c9a[_0x1917('0x1d')],function(_0x1e2b5e){return{'model':db[_0x1e2b5e[_0x1917('0x1f')]],'as':_0x1e2b5e['as'],'attributes':_0x1e2b5e[_0x1917('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1917('0xd')](function(_0x174d88){logger[_0x1917('0xe')]('ShowSugarcrmAccount',_0x15d2cd);logger[_0x1917('0x21')](_0x1917('0x22'),_0x15d2cd,JSON[_0x1917('0x11')](_0x174d88));_0x128690(_0x174d88);})['catch'](function(_0x468330){logger[_0x1917('0x12')]('ShowSugarcrmAccount',_0x468330[_0x1917('0x14')],_0x15d2cd);_0x4f71c5(_0x28779c[_0x1917('0x12')](0x1f4,_0x468330[_0x1917('0x14')]));});});}; \ No newline at end of file +var _0x6b05=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','info','ShowSugarcrmAccount','find','stringify','util','moment'];(function(_0x43929b,_0x2fcfd3){var _0x266f29=function(_0x587bb1){while(--_0x587bb1){_0x43929b['push'](_0x43929b['shift']());}};_0x266f29(++_0x2fcfd3);}(_0x6b05,0x130));var _0x56b0=function(_0xb1af0f,_0x4203cd){_0xb1af0f=_0xb1af0f-0x0;var _0x3c89b1=_0x6b05[_0xb1af0f];return _0x3c89b1;};'use strict';var _=require('lodash');var util=require(_0x56b0('0x0'));var moment=require(_0x56b0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56b0('0x2'));var db=require(_0x56b0('0x3'))['db'];var utils=require(_0x56b0('0x4'));var logger=require('../../config/logger')(_0x56b0('0x5'));var config=require(_0x56b0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x56b0('0x7')][_0x56b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4efabc,_0x5b2421,_0x74c629){return new BPromise(function(_0xec5c,_0x2aba7e){return client[_0x56b0('0x9')](_0x4efabc,_0x74c629)[_0x56b0('0xa')](function(_0x62464d){logger['info'](_0x56b0('0xb'),_0x5b2421,'request\x20sent');logger[_0x56b0('0xc')](_0x56b0('0xd'),_0x5b2421,_0x56b0('0xe'),JSON['stringify'](_0x62464d));if(_0x62464d['error']){if(_0x62464d['error'][_0x56b0('0xf')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5b2421,_0x62464d[_0x56b0('0x10')][_0x56b0('0x11')]);return _0x2aba7e(_0x62464d[_0x56b0('0x10')]['message']);}logger[_0x56b0('0x10')](_0x56b0('0xb'),_0x5b2421,_0x62464d[_0x56b0('0x10')]['message']);return _0xec5c(_0x62464d[_0x56b0('0x10')][_0x56b0('0x11')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5b2421,_0x56b0('0xe'));_0xec5c(_0x62464d[_0x56b0('0x12')][_0x56b0('0x11')]);}})[_0x56b0('0x13')](function(_0x40de4a){logger[_0x56b0('0x10')](_0x56b0('0xb'),_0x5b2421,_0x40de4a);_0x2aba7e(_0x40de4a);});});}exports[_0x56b0('0x14')]=function(_0x22c8ff){var _0x1165b1=this;return new Promise(function(_0x1d1301,_0x10315a){return db[_0x56b0('0x15')][_0x56b0('0x16')]({'raw':_0x22c8ff['options']?_0x22c8ff[_0x56b0('0x17')][_0x56b0('0x18')]===undefined?!![]:![]:!![],'where':_0x22c8ff[_0x56b0('0x17')]?_0x22c8ff['options'][_0x56b0('0x19')]||null:null,'attributes':_0x22c8ff[_0x56b0('0x17')]?_0x22c8ff['options'][_0x56b0('0x1a')]||null:null,'limit':_0x22c8ff['options']?_0x22c8ff[_0x56b0('0x17')]['limit']||null:null,'include':_0x22c8ff[_0x56b0('0x17')]?_0x22c8ff[_0x56b0('0x17')][_0x56b0('0x1b')]?_['map'](_0x22c8ff[_0x56b0('0x17')]['include'],function(_0x25d60c){return{'model':db[_0x25d60c['model']],'as':_0x25d60c['as'],'attributes':_0x25d60c[_0x56b0('0x1a')],'include':_0x25d60c[_0x56b0('0x1b')]?_[_0x56b0('0x1c')](_0x25d60c['include'],function(_0x2bcecc){return{'model':db[_0x2bcecc[_0x56b0('0x1d')]],'as':_0x2bcecc['as'],'attributes':_0x2bcecc['attributes'],'include':_0x2bcecc[_0x56b0('0x1b')]?_[_0x56b0('0x1c')](_0x2bcecc[_0x56b0('0x1b')],function(_0x319797){return{'model':db[_0x319797[_0x56b0('0x1d')]],'as':_0x319797['as'],'attributes':_0x319797[_0x56b0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x56b0('0xa')](function(_0x586914){logger[_0x56b0('0x1e')]('GetSugarcrmAccount',_0x22c8ff);logger[_0x56b0('0xc')](_0x56b0('0x14'),_0x22c8ff,JSON['stringify'](_0x586914));_0x1d1301(_0x586914);})[_0x56b0('0x13')](function(_0x24dcec){logger['error'](_0x56b0('0x14'),_0x24dcec[_0x56b0('0x11')],_0x22c8ff);_0x10315a(_0x1165b1[_0x56b0('0x10')](0x1f4,_0x24dcec[_0x56b0('0x11')]));});});};exports[_0x56b0('0x1f')]=function(_0xfa28a4){var _0x4070b6=this;return new Promise(function(_0x3eb14a,_0x3dda06){return db[_0x56b0('0x15')][_0x56b0('0x20')]({'raw':_0xfa28a4[_0x56b0('0x17')]?_0xfa28a4[_0x56b0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xfa28a4['options']?_0xfa28a4[_0x56b0('0x17')][_0x56b0('0x19')]||null:null,'attributes':_0xfa28a4[_0x56b0('0x17')]?_0xfa28a4['options'][_0x56b0('0x1a')]||null:null,'include':_0xfa28a4[_0x56b0('0x17')]?_0xfa28a4['options'][_0x56b0('0x1b')]?_['map'](_0xfa28a4['options'][_0x56b0('0x1b')],function(_0x3569ad){return{'model':db[_0x3569ad[_0x56b0('0x1d')]],'as':_0x3569ad['as'],'attributes':_0x3569ad[_0x56b0('0x1a')],'include':_0x3569ad['include']?_[_0x56b0('0x1c')](_0x3569ad[_0x56b0('0x1b')],function(_0x3587d5){return{'model':db[_0x3587d5[_0x56b0('0x1d')]],'as':_0x3587d5['as'],'attributes':_0x3587d5['attributes'],'include':_0x3587d5[_0x56b0('0x1b')]?_[_0x56b0('0x1c')](_0x3587d5[_0x56b0('0x1b')],function(_0x292c09){return{'model':db[_0x292c09[_0x56b0('0x1d')]],'as':_0x292c09['as'],'attributes':_0x292c09[_0x56b0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x56b0('0xa')](function(_0x1eeec0){logger[_0x56b0('0x1e')]('ShowSugarcrmAccount',_0xfa28a4);logger['debug'](_0x56b0('0x1f'),_0xfa28a4,JSON[_0x56b0('0x21')](_0x1eeec0));_0x3eb14a(_0x1eeec0);})[_0x56b0('0x13')](function(_0x5e6272){logger[_0x56b0('0x10')]('ShowSugarcrmAccount',_0x5e6272[_0x56b0('0x11')],_0xfa28a4);_0x3dda06(_0x4070b6[_0x56b0('0x10')](0x1f4,_0x5e6272[_0x56b0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bddd88d..91f8bd7 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 _0x0580=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put'];(function(_0x43f8bf,_0x504e4b){var _0x338e63=function(_0x342a72){while(--_0x342a72){_0x43f8bf['push'](_0x43f8bf['shift']());}};_0x338e63(++_0x504e4b);}(_0x0580,0x1d0));var _0x0058=function(_0x2e2710,_0x3d5386){_0x2e2710=_0x2e2710-0x0;var _0x45a87e=_0x0580[_0x2e2710];return _0x45a87e;};'use strict';var multer=require(_0x0058('0x0'));var util=require(_0x0058('0x1'));var path=require(_0x0058('0x2'));var timeout=require('connect-timeout');var express=require(_0x0058('0x3'));var router=express[_0x0058('0x4')]();var fs_extra=require(_0x0058('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0058('0x6'));var config=require(_0x0058('0x7'));var controller=require(_0x0058('0x8'));router[_0x0058('0x9')]('/',auth[_0x0058('0xa')](),controller[_0x0058('0xb')]);router[_0x0058('0x9')](_0x0058('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0058('0x9')](_0x0058('0xd'),auth[_0x0058('0xa')](),controller['getFields']);router[_0x0058('0x9')](_0x0058('0xe'),auth[_0x0058('0xa')](),controller['getSubjects']);router[_0x0058('0x9')](_0x0058('0xf'),auth[_0x0058('0xa')](),controller['getDescriptions']);router[_0x0058('0x10')]('/',auth['isAuthenticated'](),controller[_0x0058('0x11')]);router[_0x0058('0x12')](_0x0058('0xc'),auth['isAuthenticated'](),controller[_0x0058('0x13')]);router[_0x0058('0x14')](_0x0058('0xc'),auth['isAuthenticated'](),controller[_0x0058('0x15')]);module[_0x0058('0x16')]=router; \ No newline at end of file +var _0x9f4b=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy'];(function(_0x5a1343,_0x61a61b){var _0x161cb6=function(_0x131919){while(--_0x131919){_0x5a1343['push'](_0x5a1343['shift']());}};_0x161cb6(++_0x61a61b);}(_0x9f4b,0x188));var _0xb9f4=function(_0x10db91,_0x44f379){_0x10db91=_0x10db91-0x0;var _0x39088a=_0x9f4b[_0x10db91];return _0x39088a;};'use strict';var multer=require(_0xb9f4('0x0'));var util=require(_0xb9f4('0x1'));var path=require('path');var timeout=require(_0xb9f4('0x2'));var express=require('express');var router=express[_0xb9f4('0x3')]();var fs_extra=require(_0xb9f4('0x4'));var auth=require(_0xb9f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb9f4('0x6'));var controller=require(_0xb9f4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb9f4('0x8')]);router[_0xb9f4('0x9')](_0xb9f4('0xa'),auth['isAuthenticated'](),controller[_0xb9f4('0xb')]);router[_0xb9f4('0x9')](_0xb9f4('0xc'),auth[_0xb9f4('0xd')](),controller['getFields']);router[_0xb9f4('0x9')](_0xb9f4('0xe'),auth[_0xb9f4('0xd')](),controller[_0xb9f4('0xf')]);router[_0xb9f4('0x9')](_0xb9f4('0x10'),auth[_0xb9f4('0xd')](),controller[_0xb9f4('0x11')]);router['post']('/',auth[_0xb9f4('0xd')](),controller[_0xb9f4('0x12')]);router[_0xb9f4('0x13')](_0xb9f4('0xa'),auth[_0xb9f4('0xd')](),controller['update']);router[_0xb9f4('0x14')](_0xb9f4('0xa'),auth['isAuthenticated'](),controller[_0xb9f4('0x15')]);module[_0xb9f4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 48d7071..b7396bf 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 _0x560c=['STRING','sequelize','exports'];(function(_0x23935f,_0x38a18f){var _0x2d235f=function(_0x1e1d1f){while(--_0x1e1d1f){_0x23935f['push'](_0x23935f['shift']());}};_0x2d235f(++_0x38a18f);}(_0x560c,0x175));var _0xc560=function(_0x5e6102,_0x3a2767){_0x5e6102=_0x5e6102-0x0;var _0x33a6f6=_0x560c[_0x5e6102];return _0x33a6f6;};'use strict';var Sequelize=require(_0xc560('0x0'));module[_0xc560('0x1')]={'name':{'type':Sequelize[_0xc560('0x2')]},'description':{'type':Sequelize[_0xc560('0x2')]}}; \ No newline at end of file +var _0x4eb9=['sequelize','exports','STRING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4eb9,0x87));var _0x94eb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4eb9[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x94eb('0x0'));module[_0x94eb('0x1')]={'name':{'type':Sequelize[_0x94eb('0x2')]},'description':{'type':Sequelize[_0x94eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 30f9b23..08a4501 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 _0x6e42=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','nolimit','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','keys','intersection','length','includeAll','find','create','body','update','params','getFields','SugarcrmField','order','pick','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x4d286f,_0x2fe897){var _0x597506=function(_0x48903a){while(--_0x48903a){_0x4d286f['push'](_0x4d286f['shift']());}};_0x597506(++_0x2fe897);}(_0x6e42,0x9a));var _0x26e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e42[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x26e4('0x0'));var rimraf=require(_0x26e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26e4('0x2'));var rp=require(_0x26e4('0x3'));var moment=require(_0x26e4('0x4'));var BPromise=require(_0x26e4('0x5'));var Mustache=require(_0x26e4('0x6'));var util=require(_0x26e4('0x7'));var path=require(_0x26e4('0x8'));var sox=require(_0x26e4('0x9'));var csv=require(_0x26e4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26e4('0xb'));var _=require(_0x26e4('0xc'));var squel=require(_0x26e4('0xd'));var crypto=require(_0x26e4('0xe'));var jsforce=require(_0x26e4('0xf'));var deskjs=require(_0x26e4('0x10'));var toCsv=require(_0x26e4('0xa'));var querystring=require(_0x26e4('0x11'));var Papa=require(_0x26e4('0x12'));var Redis=require(_0x26e4('0x13'));var authService=require(_0x26e4('0x14'));var qs=require(_0x26e4('0x15'));var as=require(_0x26e4('0x16'));var hardwareService=require(_0x26e4('0x17'));var logger=require(_0x26e4('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x26e4('0x19'));var db=require(_0x26e4('0x1a'))['db'];function respondWithStatusCode(_0x922ef0,_0x1b517f){_0x1b517f=_0x1b517f||0xcc;return function(_0x29435c){if(_0x29435c){return _0x922ef0[_0x26e4('0x1b')](_0x1b517f);}return _0x922ef0[_0x26e4('0x1c')](_0x1b517f)['end']();};}function respondWithResult(_0x19c64b,_0x292323){_0x292323=_0x292323||0xc8;return function(_0x11da64){if(_0x11da64){return _0x19c64b[_0x26e4('0x1c')](_0x292323)[_0x26e4('0x1d')](_0x11da64);}};}function respondWithFilteredResult(_0x508d2e,_0x57ded1){return function(_0x3a8bc6){if(_0x3a8bc6){var _0x5d4e15=typeof _0x57ded1['offset']===_0x26e4('0x1e')&&typeof _0x57ded1[_0x26e4('0x1f')]==='undefined';var _0x437011=_0x3a8bc6['count'];var _0x49d834=_0x5d4e15?0x0:_0x57ded1['offset'];var _0x2942c8=_0x5d4e15?_0x3a8bc6[_0x26e4('0x20')]:_0x57ded1[_0x26e4('0x21')]+_0x57ded1[_0x26e4('0x1f')];var _0x4ed682;if(_0x2942c8>=_0x437011){_0x2942c8=_0x437011;_0x4ed682=0xc8;}else{_0x4ed682=0xce;}_0x508d2e[_0x26e4('0x1c')](_0x4ed682);return _0x508d2e[_0x26e4('0x22')](_0x26e4('0x23'),_0x49d834+'-'+_0x2942c8+'/'+_0x437011)['json'](_0x3a8bc6);}return null;};}function patchUpdates(_0x49b9f4){return function(_0x4ea7b9){try{jsonpatch[_0x26e4('0x24')](_0x4ea7b9,_0x49b9f4,!![]);}catch(_0x59ab06){return BPromise['reject'](_0x59ab06);}return _0x4ea7b9[_0x26e4('0x25')]();};}function saveUpdates(_0x1d0dd4,_0x52475e){return function(_0x33f53a){if(_0x33f53a){return _0x33f53a['update'](_0x1d0dd4)[_0x26e4('0x26')](function(_0x57f88e){return _0x57f88e;});}return null;};}function removeEntity(_0x506c61,_0x332689){return function(_0x4aa6af){if(_0x4aa6af){return _0x4aa6af[_0x26e4('0x27')]()[_0x26e4('0x26')](function(){_0x506c61[_0x26e4('0x1c')](0xcc)[_0x26e4('0x28')]();});}};}function handleEntityNotFound(_0x1f93ff,_0x37afae){return function(_0x523cae){if(!_0x523cae){_0x1f93ff[_0x26e4('0x1b')](0x194);}return _0x523cae;};}function handleError(_0x262915,_0xeffb46){_0xeffb46=_0xeffb46||0x1f4;return function(_0x3928bb){logger[_0x26e4('0x29')](_0x3928bb[_0x26e4('0x2a')]);if(_0x3928bb[_0x26e4('0x2b')]){delete _0x3928bb[_0x26e4('0x2b')];}_0x262915[_0x26e4('0x1c')](_0xeffb46)['send'](_0x3928bb);};}exports[_0x26e4('0x2c')]=function(_0x16abc2,_0x2c4d77){var _0x3ba328={},_0x2780c3={},_0x17eb23={'count':0x0,'rows':[]};var _0x5129c8=_[_0x26e4('0x2d')](db[_0x26e4('0x2e')][_0x26e4('0x2f')],function(_0x58f11a){return{'name':_0x58f11a[_0x26e4('0x30')],'type':_0x58f11a[_0x26e4('0x31')][_0x26e4('0x32')]};});_0x2780c3[_0x26e4('0x33')]=_[_0x26e4('0x2d')](_0x5129c8,_0x26e4('0x2b'));_0x2780c3['query']=_['keys'](_0x16abc2[_0x26e4('0x34')]);_0x2780c3[_0x26e4('0x35')]=_['intersection'](_0x2780c3['model'],_0x2780c3[_0x26e4('0x34')]);_0x3ba328[_0x26e4('0x36')]=_['intersection'](_0x2780c3[_0x26e4('0x33')],qs[_0x26e4('0x37')](_0x16abc2[_0x26e4('0x34')][_0x26e4('0x37')]));_0x3ba328[_0x26e4('0x36')]=_0x3ba328[_0x26e4('0x36')]['length']?_0x3ba328[_0x26e4('0x36')]:_0x2780c3[_0x26e4('0x33')];if(!_0x16abc2[_0x26e4('0x34')]['hasOwnProperty'](_0x26e4('0x38'))){_0x3ba328['limit']=qs[_0x26e4('0x1f')](_0x16abc2['query']['limit']);_0x3ba328[_0x26e4('0x21')]=qs[_0x26e4('0x21')](_0x16abc2['query'][_0x26e4('0x21')]);}_0x3ba328['order']=qs[_0x26e4('0x39')](_0x16abc2[_0x26e4('0x34')]['sort']);_0x3ba328[_0x26e4('0x3a')]=qs[_0x26e4('0x35')](_['pick'](_0x16abc2[_0x26e4('0x34')],_0x2780c3[_0x26e4('0x35')]),_0x5129c8);if(_0x16abc2['query'][_0x26e4('0x3b')]){_0x3ba328[_0x26e4('0x3a')]=_['merge'](_0x3ba328[_0x26e4('0x3a')],{'$or':_[_0x26e4('0x2d')](_0x5129c8,function(_0xf77f46){if(_0xf77f46[_0x26e4('0x31')]!==_0x26e4('0x3c')){var _0x212d30={};_0x212d30[_0xf77f46[_0x26e4('0x2b')]]={'$like':'%'+_0x16abc2['query']['filter']+'%'};return _0x212d30;}})});}_0x3ba328=_[_0x26e4('0x3d')]({},_0x3ba328,_0x16abc2[_0x26e4('0x3e')]);var _0x305cad={'where':_0x3ba328[_0x26e4('0x3a')]};return db[_0x26e4('0x2e')][_0x26e4('0x20')](_0x305cad)['then'](function(_0x57f149){_0x17eb23['count']=_0x57f149;if(_0x16abc2[_0x26e4('0x34')]['includeAll']){_0x3ba328[_0x26e4('0x3f')]=[{'all':!![]}];}return db[_0x26e4('0x2e')][_0x26e4('0x40')](_0x3ba328);})[_0x26e4('0x26')](function(_0x11461f){_0x17eb23[_0x26e4('0x41')]=_0x11461f;return _0x17eb23;})[_0x26e4('0x26')](respondWithFilteredResult(_0x2c4d77,_0x3ba328))[_0x26e4('0x42')](handleError(_0x2c4d77,null));};exports['show']=function(_0x40baf9,_0x12b158){var _0x1ccce0={'raw':![],'where':{'id':_0x40baf9['params']['id']}},_0x13f046={};_0x13f046[_0x26e4('0x33')]=_['keys'](db[_0x26e4('0x2e')][_0x26e4('0x2f')]);_0x13f046[_0x26e4('0x34')]=_[_0x26e4('0x43')](_0x40baf9[_0x26e4('0x34')]);_0x13f046[_0x26e4('0x35')]=_[_0x26e4('0x44')](_0x13f046[_0x26e4('0x33')],_0x13f046[_0x26e4('0x34')]);_0x1ccce0[_0x26e4('0x36')]=_[_0x26e4('0x44')](_0x13f046[_0x26e4('0x33')],qs[_0x26e4('0x37')](_0x40baf9[_0x26e4('0x34')]['fields']));_0x1ccce0[_0x26e4('0x36')]=_0x1ccce0[_0x26e4('0x36')][_0x26e4('0x45')]?_0x1ccce0[_0x26e4('0x36')]:_0x13f046[_0x26e4('0x33')];if(_0x40baf9[_0x26e4('0x34')][_0x26e4('0x46')]){_0x1ccce0['include']=[{'all':!![]}];}_0x1ccce0=_['merge']({},_0x1ccce0,_0x40baf9[_0x26e4('0x3e')]);return db[_0x26e4('0x2e')][_0x26e4('0x47')](_0x1ccce0)[_0x26e4('0x26')](handleEntityNotFound(_0x12b158,null))[_0x26e4('0x26')](respondWithResult(_0x12b158,null))['catch'](handleError(_0x12b158,null));};exports['create']=function(_0x326229,_0x425c61){return db[_0x26e4('0x2e')][_0x26e4('0x48')](_0x326229[_0x26e4('0x49')],{})[_0x26e4('0x26')](respondWithResult(_0x425c61,0xc9))[_0x26e4('0x42')](handleError(_0x425c61,null));};exports[_0x26e4('0x4a')]=function(_0xdd154,_0x10fb02){if(_0xdd154[_0x26e4('0x49')]['id']){delete _0xdd154[_0x26e4('0x49')]['id'];}return db[_0x26e4('0x2e')][_0x26e4('0x47')]({'where':{'id':_0xdd154[_0x26e4('0x4b')]['id']}})[_0x26e4('0x26')](handleEntityNotFound(_0x10fb02,null))[_0x26e4('0x26')](saveUpdates(_0xdd154[_0x26e4('0x49')],null))[_0x26e4('0x26')](respondWithResult(_0x10fb02,null))['catch'](handleError(_0x10fb02,null));};exports[_0x26e4('0x27')]=function(_0x18bda7,_0x1e1546){return db[_0x26e4('0x2e')][_0x26e4('0x47')]({'where':{'id':_0x18bda7[_0x26e4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e1546,null))[_0x26e4('0x26')](removeEntity(_0x1e1546,null))[_0x26e4('0x42')](handleError(_0x1e1546,null));};exports[_0x26e4('0x4c')]=function(_0x2e3c46,_0x4ab715,_0x9b9159){var _0x825080={};var _0x3899cf={};var _0x3814e2;var _0x2c39d0;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2e3c46[_0x26e4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ab715,null))[_0x26e4('0x26')](function(_0x25de95){if(_0x25de95){_0x3814e2=_0x25de95;_0x3899cf[_0x26e4('0x33')]=_[_0x26e4('0x43')](db[_0x26e4('0x4d')][_0x26e4('0x2f')]);_0x3899cf[_0x26e4('0x34')]=_['keys'](_0x2e3c46[_0x26e4('0x34')]);_0x3899cf[_0x26e4('0x35')]=_['intersection'](_0x3899cf[_0x26e4('0x33')],_0x3899cf[_0x26e4('0x34')]);_0x825080[_0x26e4('0x36')]=_[_0x26e4('0x44')](_0x3899cf[_0x26e4('0x33')],qs[_0x26e4('0x37')](_0x2e3c46[_0x26e4('0x34')][_0x26e4('0x37')]));_0x825080[_0x26e4('0x36')]=_0x825080['attributes'][_0x26e4('0x45')]?_0x825080[_0x26e4('0x36')]:_0x3899cf[_0x26e4('0x33')];_0x825080[_0x26e4('0x4e')]=qs[_0x26e4('0x39')](_0x2e3c46[_0x26e4('0x34')][_0x26e4('0x39')]);_0x825080['where']=qs[_0x26e4('0x35')](_[_0x26e4('0x4f')](_0x2e3c46[_0x26e4('0x34')],_0x3899cf[_0x26e4('0x35')]));if(_0x2e3c46[_0x26e4('0x34')][_0x26e4('0x3b')]){_0x825080[_0x26e4('0x3a')]=_[_0x26e4('0x3d')](_0x825080[_0x26e4('0x3a')],{'$or':_['map'](_0x825080[_0x26e4('0x36')],function(_0x427d4a){var _0x10fa0e={};_0x10fa0e[_0x427d4a]={'$like':'%'+_0x2e3c46['query']['filter']+'%'};return _0x10fa0e;})});}_0x825080=_[_0x26e4('0x3d')]({},_0x825080,_0x2e3c46[_0x26e4('0x3e')]);return _0x3814e2[_0x26e4('0x4c')](_0x825080);}})[_0x26e4('0x26')](function(_0x3d7b52){if(_0x3d7b52){_0x2c39d0=_0x3d7b52[_0x26e4('0x45')];if(!_0x2e3c46[_0x26e4('0x34')][_0x26e4('0x50')](_0x26e4('0x38'))){_0x825080[_0x26e4('0x1f')]=qs['limit'](_0x2e3c46['query'][_0x26e4('0x1f')]);_0x825080[_0x26e4('0x21')]=qs[_0x26e4('0x21')](_0x2e3c46[_0x26e4('0x34')][_0x26e4('0x21')]);}return _0x3814e2['getFields'](_0x825080);}})['then'](function(_0x5dc7bb){if(_0x5dc7bb){return _0x5dc7bb?{'count':_0x2c39d0,'rows':_0x5dc7bb}:null;}})[_0x26e4('0x26')](respondWithResult(_0x4ab715,null))['catch'](handleError(_0x4ab715,null));};exports[_0x26e4('0x51')]=function(_0x4a7a56,_0x3ce925,_0x53a252){var _0x269ea1={};var _0x492f0c={};var _0x25e146;var _0x7c6bda;return db[_0x26e4('0x2e')][_0x26e4('0x52')]({'where':{'id':_0x4a7a56[_0x26e4('0x4b')]['id']}})[_0x26e4('0x26')](handleEntityNotFound(_0x3ce925,null))[_0x26e4('0x26')](function(_0x3c3130){if(_0x3c3130){_0x25e146=_0x3c3130;_0x492f0c[_0x26e4('0x33')]=_[_0x26e4('0x43')](db[_0x26e4('0x4d')]['rawAttributes']);_0x492f0c['query']=_[_0x26e4('0x43')](_0x4a7a56[_0x26e4('0x34')]);_0x492f0c['filters']=_[_0x26e4('0x44')](_0x492f0c[_0x26e4('0x33')],_0x492f0c[_0x26e4('0x34')]);_0x269ea1['attributes']=_[_0x26e4('0x44')](_0x492f0c[_0x26e4('0x33')],qs[_0x26e4('0x37')](_0x4a7a56[_0x26e4('0x34')][_0x26e4('0x37')]));_0x269ea1[_0x26e4('0x36')]=_0x269ea1['attributes'][_0x26e4('0x45')]?_0x269ea1[_0x26e4('0x36')]:_0x492f0c[_0x26e4('0x33')];_0x269ea1[_0x26e4('0x4e')]=qs['sort'](_0x4a7a56['query'][_0x26e4('0x39')]);_0x269ea1[_0x26e4('0x3a')]=qs[_0x26e4('0x35')](_['pick'](_0x4a7a56['query'],_0x492f0c[_0x26e4('0x35')]));if(_0x4a7a56[_0x26e4('0x34')][_0x26e4('0x3b')]){_0x269ea1[_0x26e4('0x3a')]=_[_0x26e4('0x3d')](_0x269ea1[_0x26e4('0x3a')],{'$or':_[_0x26e4('0x2d')](_0x269ea1[_0x26e4('0x36')],function(_0xd106d3){var _0x3352ab={};_0x3352ab[_0xd106d3]={'$like':'%'+_0x4a7a56['query']['filter']+'%'};return _0x3352ab;})});}_0x269ea1=_['merge']({},_0x269ea1,_0x4a7a56[_0x26e4('0x3e')]);return _0x25e146[_0x26e4('0x51')](_0x269ea1);}})['then'](function(_0x1b4981){if(_0x1b4981){_0x7c6bda=_0x1b4981['length'];if(!_0x4a7a56['query'][_0x26e4('0x50')](_0x26e4('0x38'))){_0x269ea1['limit']=qs['limit'](_0x4a7a56[_0x26e4('0x34')][_0x26e4('0x1f')]);_0x269ea1[_0x26e4('0x21')]=qs['offset'](_0x4a7a56[_0x26e4('0x34')][_0x26e4('0x21')]);}return _0x25e146[_0x26e4('0x51')](_0x269ea1);}})['then'](function(_0x266c56){if(_0x266c56){return _0x266c56?{'count':_0x7c6bda,'rows':_0x266c56}:null;}})[_0x26e4('0x26')](respondWithResult(_0x3ce925,null))['catch'](handleError(_0x3ce925,null));};exports['getDescriptions']=function(_0x301e41,_0x392c50,_0x1ce647){var _0x39fcb8={};var _0x2505d1={};var _0x3dd57b;var _0x14f8ac;return db[_0x26e4('0x2e')]['findOne']({'where':{'id':_0x301e41[_0x26e4('0x4b')]['id']}})[_0x26e4('0x26')](handleEntityNotFound(_0x392c50,null))[_0x26e4('0x26')](function(_0x5f096c){if(_0x5f096c){_0x3dd57b=_0x5f096c;_0x2505d1[_0x26e4('0x33')]=_[_0x26e4('0x43')](db[_0x26e4('0x4d')]['rawAttributes']);_0x2505d1[_0x26e4('0x34')]=_['keys'](_0x301e41[_0x26e4('0x34')]);_0x2505d1['filters']=_[_0x26e4('0x44')](_0x2505d1[_0x26e4('0x33')],_0x2505d1[_0x26e4('0x34')]);_0x39fcb8['attributes']=_[_0x26e4('0x44')](_0x2505d1[_0x26e4('0x33')],qs[_0x26e4('0x37')](_0x301e41['query'][_0x26e4('0x37')]));_0x39fcb8[_0x26e4('0x36')]=_0x39fcb8[_0x26e4('0x36')][_0x26e4('0x45')]?_0x39fcb8[_0x26e4('0x36')]:_0x2505d1[_0x26e4('0x33')];_0x39fcb8[_0x26e4('0x4e')]=qs['sort'](_0x301e41[_0x26e4('0x34')]['sort']);_0x39fcb8['where']=qs['filters'](_[_0x26e4('0x4f')](_0x301e41[_0x26e4('0x34')],_0x2505d1[_0x26e4('0x35')]));if(_0x301e41[_0x26e4('0x34')]['filter']){_0x39fcb8[_0x26e4('0x3a')]=_[_0x26e4('0x3d')](_0x39fcb8[_0x26e4('0x3a')],{'$or':_[_0x26e4('0x2d')](_0x39fcb8['attributes'],function(_0x30174e){var _0x290bdf={};_0x290bdf[_0x30174e]={'$like':'%'+_0x301e41[_0x26e4('0x34')][_0x26e4('0x3b')]+'%'};return _0x290bdf;})});}_0x39fcb8=_['merge']({},_0x39fcb8,_0x301e41[_0x26e4('0x3e')]);return _0x3dd57b[_0x26e4('0x53')](_0x39fcb8);}})[_0x26e4('0x26')](function(_0x2313a4){if(_0x2313a4){_0x14f8ac=_0x2313a4[_0x26e4('0x45')];if(!_0x301e41[_0x26e4('0x34')][_0x26e4('0x50')](_0x26e4('0x38'))){_0x39fcb8[_0x26e4('0x1f')]=qs[_0x26e4('0x1f')](_0x301e41[_0x26e4('0x34')]['limit']);_0x39fcb8[_0x26e4('0x21')]=qs[_0x26e4('0x21')](_0x301e41['query']['offset']);}return _0x3dd57b['getDescriptions'](_0x39fcb8);}})['then'](function(_0x366726){if(_0x366726){return _0x366726?{'count':_0x14f8ac,'rows':_0x366726}:null;}})['then'](respondWithResult(_0x392c50,null))[_0x26e4('0x42')](handleError(_0x392c50,null));}; \ No newline at end of file +var _0xe0c2=['catch','create','body','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','length','find'];(function(_0x55f8b4,_0x401c05){var _0x2dfd72=function(_0x5d92cf){while(--_0x5d92cf){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2dfd72(++_0x401c05);}(_0xe0c2,0xea));var _0x2e0c=function(_0x2acd0f,_0x3ac736){_0x2acd0f=_0x2acd0f-0x0;var _0x434b3e=_0xe0c2[_0x2acd0f];return _0x434b3e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2e0c('0x0'));var jsonpatch=require(_0x2e0c('0x1'));var rp=require(_0x2e0c('0x2'));var moment=require(_0x2e0c('0x3'));var BPromise=require(_0x2e0c('0x4'));var Mustache=require(_0x2e0c('0x5'));var util=require(_0x2e0c('0x6'));var path=require(_0x2e0c('0x7'));var sox=require(_0x2e0c('0x8'));var csv=require(_0x2e0c('0x9'));var ejs=require(_0x2e0c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e0c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2e0c('0xc'));var deskjs=require(_0x2e0c('0xd'));var toCsv=require(_0x2e0c('0x9'));var querystring=require(_0x2e0c('0xe'));var Papa=require(_0x2e0c('0xf'));var Redis=require(_0x2e0c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2e0c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e0c('0x12'));var logger=require(_0x2e0c('0x13'))(_0x2e0c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2e0c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x103123,_0x1b8d38){_0x1b8d38=_0x1b8d38||0xcc;return function(_0x34f777){if(_0x34f777){return _0x103123[_0x2e0c('0x16')](_0x1b8d38);}return _0x103123[_0x2e0c('0x17')](_0x1b8d38)[_0x2e0c('0x18')]();};}function respondWithResult(_0x179a61,_0x2f5c6e){_0x2f5c6e=_0x2f5c6e||0xc8;return function(_0x41e39e){if(_0x41e39e){return _0x179a61[_0x2e0c('0x17')](_0x2f5c6e)[_0x2e0c('0x19')](_0x41e39e);}};}function respondWithFilteredResult(_0x1f7855,_0x2b43e5){return function(_0x174ef5){if(_0x174ef5){var _0x4cbf1e=typeof _0x2b43e5[_0x2e0c('0x1a')]===_0x2e0c('0x1b')&&typeof _0x2b43e5[_0x2e0c('0x1c')]===_0x2e0c('0x1b');var _0x195062=_0x174ef5[_0x2e0c('0x1d')];var _0x596534=_0x4cbf1e?0x0:_0x2b43e5[_0x2e0c('0x1a')];var _0x10aa48=_0x4cbf1e?_0x174ef5[_0x2e0c('0x1d')]:_0x2b43e5[_0x2e0c('0x1a')]+_0x2b43e5[_0x2e0c('0x1c')];var _0x38a62a;if(_0x10aa48>=_0x195062){_0x10aa48=_0x195062;_0x38a62a=0xc8;}else{_0x38a62a=0xce;}_0x1f7855[_0x2e0c('0x17')](_0x38a62a);return _0x1f7855['set']('Content-Range',_0x596534+'-'+_0x10aa48+'/'+_0x195062)[_0x2e0c('0x19')](_0x174ef5);}return null;};}function patchUpdates(_0x14fbd9){return function(_0x3ab997){try{jsonpatch[_0x2e0c('0x1e')](_0x3ab997,_0x14fbd9,!![]);}catch(_0x43c5e6){return BPromise[_0x2e0c('0x1f')](_0x43c5e6);}return _0x3ab997[_0x2e0c('0x20')]();};}function saveUpdates(_0x36996f,_0x323e5a){return function(_0x4437e2){if(_0x4437e2){return _0x4437e2[_0x2e0c('0x21')](_0x36996f)['then'](function(_0x373fa0){return _0x373fa0;});}return null;};}function removeEntity(_0x351f33,_0x5089f6){return function(_0x443e36){if(_0x443e36){return _0x443e36[_0x2e0c('0x22')]()[_0x2e0c('0x23')](function(){_0x351f33[_0x2e0c('0x17')](0xcc)[_0x2e0c('0x18')]();});}};}function handleEntityNotFound(_0x591938,_0x536a8f){return function(_0x53db80){if(!_0x53db80){_0x591938[_0x2e0c('0x16')](0x194);}return _0x53db80;};}function handleError(_0x32093f,_0x27f2f2){_0x27f2f2=_0x27f2f2||0x1f4;return function(_0x4d961a){logger[_0x2e0c('0x24')](_0x4d961a[_0x2e0c('0x25')]);if(_0x4d961a[_0x2e0c('0x26')]){delete _0x4d961a['name'];}_0x32093f[_0x2e0c('0x17')](_0x27f2f2)['send'](_0x4d961a);};}exports['index']=function(_0x522922,_0x579bc9){var _0x5eb661={},_0x539251={},_0x4739c9={'count':0x0,'rows':[]};var _0x33ad6b=_[_0x2e0c('0x27')](db[_0x2e0c('0x28')][_0x2e0c('0x29')],function(_0x2c95b5){return{'name':_0x2c95b5[_0x2e0c('0x2a')],'type':_0x2c95b5[_0x2e0c('0x2b')]['key']};});_0x539251[_0x2e0c('0x2c')]=_[_0x2e0c('0x27')](_0x33ad6b,'name');_0x539251[_0x2e0c('0x2d')]=_[_0x2e0c('0x2e')](_0x522922['query']);_0x539251[_0x2e0c('0x2f')]=_[_0x2e0c('0x30')](_0x539251[_0x2e0c('0x2c')],_0x539251['query']);_0x5eb661[_0x2e0c('0x31')]=_['intersection'](_0x539251[_0x2e0c('0x2c')],qs[_0x2e0c('0x32')](_0x522922[_0x2e0c('0x2d')][_0x2e0c('0x32')]));_0x5eb661[_0x2e0c('0x31')]=_0x5eb661[_0x2e0c('0x31')]['length']?_0x5eb661['attributes']:_0x539251[_0x2e0c('0x2c')];if(!_0x522922[_0x2e0c('0x2d')][_0x2e0c('0x33')](_0x2e0c('0x34'))){_0x5eb661['limit']=qs[_0x2e0c('0x1c')](_0x522922[_0x2e0c('0x2d')][_0x2e0c('0x1c')]);_0x5eb661['offset']=qs[_0x2e0c('0x1a')](_0x522922[_0x2e0c('0x2d')][_0x2e0c('0x1a')]);}_0x5eb661['order']=qs[_0x2e0c('0x35')](_0x522922[_0x2e0c('0x2d')][_0x2e0c('0x35')]);_0x5eb661[_0x2e0c('0x36')]=qs[_0x2e0c('0x2f')](_[_0x2e0c('0x37')](_0x522922['query'],_0x539251[_0x2e0c('0x2f')]),_0x33ad6b);if(_0x522922[_0x2e0c('0x2d')][_0x2e0c('0x38')]){_0x5eb661[_0x2e0c('0x36')]=_[_0x2e0c('0x39')](_0x5eb661[_0x2e0c('0x36')],{'$or':_[_0x2e0c('0x27')](_0x33ad6b,function(_0x50913a){if(_0x50913a[_0x2e0c('0x2b')]!==_0x2e0c('0x3a')){var _0x478b4f={};_0x478b4f[_0x50913a[_0x2e0c('0x26')]]={'$like':'%'+_0x522922[_0x2e0c('0x2d')]['filter']+'%'};return _0x478b4f;}})});}_0x5eb661=_['merge']({},_0x5eb661,_0x522922[_0x2e0c('0x3b')]);var _0xeaf1d={'where':_0x5eb661[_0x2e0c('0x36')]};return db[_0x2e0c('0x28')][_0x2e0c('0x1d')](_0xeaf1d)['then'](function(_0x13741d){_0x4739c9[_0x2e0c('0x1d')]=_0x13741d;if(_0x522922[_0x2e0c('0x2d')]['includeAll']){_0x5eb661[_0x2e0c('0x3c')]=[{'all':!![]}];}return db[_0x2e0c('0x28')][_0x2e0c('0x3d')](_0x5eb661);})[_0x2e0c('0x23')](function(_0x2588b7){_0x4739c9['rows']=_0x2588b7;return _0x4739c9;})['then'](respondWithFilteredResult(_0x579bc9,_0x5eb661))['catch'](handleError(_0x579bc9,null));};exports[_0x2e0c('0x3e')]=function(_0x59c516,_0x38650f){var _0x4fa767={'raw':![],'where':{'id':_0x59c516[_0x2e0c('0x3f')]['id']}},_0x7b2d4d={};_0x7b2d4d[_0x2e0c('0x2c')]=_[_0x2e0c('0x2e')](db[_0x2e0c('0x28')][_0x2e0c('0x29')]);_0x7b2d4d[_0x2e0c('0x2d')]=_[_0x2e0c('0x2e')](_0x59c516[_0x2e0c('0x2d')]);_0x7b2d4d[_0x2e0c('0x2f')]=_[_0x2e0c('0x30')](_0x7b2d4d[_0x2e0c('0x2c')],_0x7b2d4d[_0x2e0c('0x2d')]);_0x4fa767[_0x2e0c('0x31')]=_[_0x2e0c('0x30')](_0x7b2d4d[_0x2e0c('0x2c')],qs['fields'](_0x59c516[_0x2e0c('0x2d')]['fields']));_0x4fa767[_0x2e0c('0x31')]=_0x4fa767['attributes'][_0x2e0c('0x40')]?_0x4fa767[_0x2e0c('0x31')]:_0x7b2d4d[_0x2e0c('0x2c')];if(_0x59c516[_0x2e0c('0x2d')]['includeAll']){_0x4fa767[_0x2e0c('0x3c')]=[{'all':!![]}];}_0x4fa767=_[_0x2e0c('0x39')]({},_0x4fa767,_0x59c516['options']);return db['SugarcrmConfiguration'][_0x2e0c('0x41')](_0x4fa767)['then'](handleEntityNotFound(_0x38650f,null))[_0x2e0c('0x23')](respondWithResult(_0x38650f,null))[_0x2e0c('0x42')](handleError(_0x38650f,null));};exports[_0x2e0c('0x43')]=function(_0x58321c,_0x46e8f9){return db[_0x2e0c('0x28')][_0x2e0c('0x43')](_0x58321c['body'],{})[_0x2e0c('0x23')](respondWithResult(_0x46e8f9,0xc9))[_0x2e0c('0x42')](handleError(_0x46e8f9,null));};exports['update']=function(_0x460388,_0x2bc589){if(_0x460388[_0x2e0c('0x44')]['id']){delete _0x460388[_0x2e0c('0x44')]['id'];}return db[_0x2e0c('0x28')][_0x2e0c('0x41')]({'where':{'id':_0x460388[_0x2e0c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2bc589,null))['then'](saveUpdates(_0x460388[_0x2e0c('0x44')],null))['then'](respondWithResult(_0x2bc589,null))['catch'](handleError(_0x2bc589,null));};exports[_0x2e0c('0x22')]=function(_0x230ce7,_0x86b65b){return db[_0x2e0c('0x28')][_0x2e0c('0x41')]({'where':{'id':_0x230ce7[_0x2e0c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x86b65b,null))['then'](removeEntity(_0x86b65b,null))['catch'](handleError(_0x86b65b,null));};exports[_0x2e0c('0x45')]=function(_0x528197,_0x53bcb5,_0x4d16f6){var _0x576258={};var _0x53834f={};var _0x7e6908;var _0x80f5ac;return db[_0x2e0c('0x28')][_0x2e0c('0x46')]({'where':{'id':_0x528197[_0x2e0c('0x3f')]['id']}})[_0x2e0c('0x23')](handleEntityNotFound(_0x53bcb5,null))[_0x2e0c('0x23')](function(_0x3aafdb){if(_0x3aafdb){_0x7e6908=_0x3aafdb;_0x53834f['model']=_[_0x2e0c('0x2e')](db[_0x2e0c('0x47')][_0x2e0c('0x29')]);_0x53834f[_0x2e0c('0x2d')]=_[_0x2e0c('0x2e')](_0x528197[_0x2e0c('0x2d')]);_0x53834f['filters']=_[_0x2e0c('0x30')](_0x53834f[_0x2e0c('0x2c')],_0x53834f[_0x2e0c('0x2d')]);_0x576258[_0x2e0c('0x31')]=_[_0x2e0c('0x30')](_0x53834f[_0x2e0c('0x2c')],qs['fields'](_0x528197[_0x2e0c('0x2d')][_0x2e0c('0x32')]));_0x576258[_0x2e0c('0x31')]=_0x576258[_0x2e0c('0x31')][_0x2e0c('0x40')]?_0x576258[_0x2e0c('0x31')]:_0x53834f[_0x2e0c('0x2c')];_0x576258[_0x2e0c('0x48')]=qs[_0x2e0c('0x35')](_0x528197[_0x2e0c('0x2d')][_0x2e0c('0x35')]);_0x576258['where']=qs[_0x2e0c('0x2f')](_[_0x2e0c('0x37')](_0x528197[_0x2e0c('0x2d')],_0x53834f[_0x2e0c('0x2f')]));if(_0x528197[_0x2e0c('0x2d')]['filter']){_0x576258['where']=_['merge'](_0x576258['where'],{'$or':_['map'](_0x576258[_0x2e0c('0x31')],function(_0xae32cc){var _0x546903={};_0x546903[_0xae32cc]={'$like':'%'+_0x528197[_0x2e0c('0x2d')]['filter']+'%'};return _0x546903;})});}_0x576258=_[_0x2e0c('0x39')]({},_0x576258,_0x528197[_0x2e0c('0x3b')]);return _0x7e6908['getFields'](_0x576258);}})[_0x2e0c('0x23')](function(_0x2ca759){if(_0x2ca759){_0x80f5ac=_0x2ca759[_0x2e0c('0x40')];if(!_0x528197['query'][_0x2e0c('0x33')](_0x2e0c('0x34'))){_0x576258[_0x2e0c('0x1c')]=qs[_0x2e0c('0x1c')](_0x528197[_0x2e0c('0x2d')]['limit']);_0x576258[_0x2e0c('0x1a')]=qs[_0x2e0c('0x1a')](_0x528197['query'][_0x2e0c('0x1a')]);}return _0x7e6908[_0x2e0c('0x45')](_0x576258);}})['then'](function(_0x14aaff){if(_0x14aaff){return _0x14aaff?{'count':_0x80f5ac,'rows':_0x14aaff}:null;}})[_0x2e0c('0x23')](respondWithResult(_0x53bcb5,null))[_0x2e0c('0x42')](handleError(_0x53bcb5,null));};exports[_0x2e0c('0x49')]=function(_0x4c9448,_0x1e54cc,_0x2d4d83){var _0x46d3f5={};var _0x60b7ad={};var _0x1ff494;var _0x520f40;return db[_0x2e0c('0x28')][_0x2e0c('0x46')]({'where':{'id':_0x4c9448[_0x2e0c('0x3f')]['id']}})[_0x2e0c('0x23')](handleEntityNotFound(_0x1e54cc,null))[_0x2e0c('0x23')](function(_0x533fa2){if(_0x533fa2){_0x1ff494=_0x533fa2;_0x60b7ad[_0x2e0c('0x2c')]=_[_0x2e0c('0x2e')](db[_0x2e0c('0x47')][_0x2e0c('0x29')]);_0x60b7ad[_0x2e0c('0x2d')]=_[_0x2e0c('0x2e')](_0x4c9448[_0x2e0c('0x2d')]);_0x60b7ad[_0x2e0c('0x2f')]=_[_0x2e0c('0x30')](_0x60b7ad[_0x2e0c('0x2c')],_0x60b7ad[_0x2e0c('0x2d')]);_0x46d3f5['attributes']=_[_0x2e0c('0x30')](_0x60b7ad[_0x2e0c('0x2c')],qs[_0x2e0c('0x32')](_0x4c9448[_0x2e0c('0x2d')][_0x2e0c('0x32')]));_0x46d3f5[_0x2e0c('0x31')]=_0x46d3f5[_0x2e0c('0x31')][_0x2e0c('0x40')]?_0x46d3f5['attributes']:_0x60b7ad[_0x2e0c('0x2c')];_0x46d3f5['order']=qs[_0x2e0c('0x35')](_0x4c9448[_0x2e0c('0x2d')][_0x2e0c('0x35')]);_0x46d3f5[_0x2e0c('0x36')]=qs[_0x2e0c('0x2f')](_[_0x2e0c('0x37')](_0x4c9448['query'],_0x60b7ad['filters']));if(_0x4c9448[_0x2e0c('0x2d')][_0x2e0c('0x38')]){_0x46d3f5[_0x2e0c('0x36')]=_[_0x2e0c('0x39')](_0x46d3f5['where'],{'$or':_[_0x2e0c('0x27')](_0x46d3f5[_0x2e0c('0x31')],function(_0x50fd37){var _0x400a52={};_0x400a52[_0x50fd37]={'$like':'%'+_0x4c9448['query'][_0x2e0c('0x38')]+'%'};return _0x400a52;})});}_0x46d3f5=_['merge']({},_0x46d3f5,_0x4c9448[_0x2e0c('0x3b')]);return _0x1ff494[_0x2e0c('0x49')](_0x46d3f5);}})[_0x2e0c('0x23')](function(_0x30a427){if(_0x30a427){_0x520f40=_0x30a427[_0x2e0c('0x40')];if(!_0x4c9448[_0x2e0c('0x2d')][_0x2e0c('0x33')](_0x2e0c('0x34'))){_0x46d3f5[_0x2e0c('0x1c')]=qs[_0x2e0c('0x1c')](_0x4c9448[_0x2e0c('0x2d')][_0x2e0c('0x1c')]);_0x46d3f5['offset']=qs['offset'](_0x4c9448[_0x2e0c('0x2d')][_0x2e0c('0x1a')]);}return _0x1ff494[_0x2e0c('0x49')](_0x46d3f5);}})[_0x2e0c('0x23')](function(_0x4fa1d7){if(_0x4fa1d7){return _0x4fa1d7?{'count':_0x520f40,'rows':_0x4fa1d7}:null;}})[_0x2e0c('0x23')](respondWithResult(_0x1e54cc,null))['catch'](handleError(_0x1e54cc,null));};exports[_0x2e0c('0x4a')]=function(_0xf1bc80,_0x1c2ce8,_0x4cb20e){var _0x2177a5={};var _0x549fea={};var _0xa2e956;var _0x1a7743;return db[_0x2e0c('0x28')][_0x2e0c('0x46')]({'where':{'id':_0xf1bc80[_0x2e0c('0x3f')]['id']}})[_0x2e0c('0x23')](handleEntityNotFound(_0x1c2ce8,null))[_0x2e0c('0x23')](function(_0x1f5dc0){if(_0x1f5dc0){_0xa2e956=_0x1f5dc0;_0x549fea['model']=_['keys'](db[_0x2e0c('0x47')][_0x2e0c('0x29')]);_0x549fea[_0x2e0c('0x2d')]=_[_0x2e0c('0x2e')](_0xf1bc80[_0x2e0c('0x2d')]);_0x549fea['filters']=_['intersection'](_0x549fea['model'],_0x549fea['query']);_0x2177a5[_0x2e0c('0x31')]=_[_0x2e0c('0x30')](_0x549fea[_0x2e0c('0x2c')],qs[_0x2e0c('0x32')](_0xf1bc80[_0x2e0c('0x2d')][_0x2e0c('0x32')]));_0x2177a5[_0x2e0c('0x31')]=_0x2177a5[_0x2e0c('0x31')][_0x2e0c('0x40')]?_0x2177a5['attributes']:_0x549fea[_0x2e0c('0x2c')];_0x2177a5[_0x2e0c('0x48')]=qs[_0x2e0c('0x35')](_0xf1bc80[_0x2e0c('0x2d')][_0x2e0c('0x35')]);_0x2177a5[_0x2e0c('0x36')]=qs[_0x2e0c('0x2f')](_[_0x2e0c('0x37')](_0xf1bc80[_0x2e0c('0x2d')],_0x549fea[_0x2e0c('0x2f')]));if(_0xf1bc80['query']['filter']){_0x2177a5[_0x2e0c('0x36')]=_['merge'](_0x2177a5[_0x2e0c('0x36')],{'$or':_[_0x2e0c('0x27')](_0x2177a5[_0x2e0c('0x31')],function(_0x39a506){var _0x112525={};_0x112525[_0x39a506]={'$like':'%'+_0xf1bc80[_0x2e0c('0x2d')][_0x2e0c('0x38')]+'%'};return _0x112525;})});}_0x2177a5=_['merge']({},_0x2177a5,_0xf1bc80[_0x2e0c('0x3b')]);return _0xa2e956[_0x2e0c('0x4a')](_0x2177a5);}})[_0x2e0c('0x23')](function(_0x286c40){if(_0x286c40){_0x1a7743=_0x286c40[_0x2e0c('0x40')];if(!_0xf1bc80[_0x2e0c('0x2d')][_0x2e0c('0x33')](_0x2e0c('0x34'))){_0x2177a5[_0x2e0c('0x1c')]=qs[_0x2e0c('0x1c')](_0xf1bc80[_0x2e0c('0x2d')][_0x2e0c('0x1c')]);_0x2177a5[_0x2e0c('0x1a')]=qs[_0x2e0c('0x1a')](_0xf1bc80[_0x2e0c('0x2d')]['offset']);}return _0xa2e956[_0x2e0c('0x4a')](_0x2177a5);}})[_0x2e0c('0x23')](function(_0x5b1860){if(_0x5b1860){return _0x5b1860?{'count':_0x1a7743,'rows':_0x5b1860}:null;}})[_0x2e0c('0x23')](respondWithResult(_0x1c2ce8,null))[_0x2e0c('0x42')](handleError(_0x1c2ce8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 66972a0..97917ab 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 _0xc611=['path','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc611,0x96));var _0x1c61=function(_0x243966,_0x515c0f){_0x243966=_0x243966-0x0;var _0x637519=_0xc611[_0x243966];return _0x637519;};'use strict';var _=require('lodash');var util=require(_0x1c61('0x0'));var logger=require(_0x1c61('0x1'))(_0x1c61('0x2'));var moment=require(_0x1c61('0x3'));var BPromise=require(_0x1c61('0x4'));var rp=require(_0x1c61('0x5'));var fs=require('fs');var path=require(_0x1c61('0x6'));var rimraf=require('rimraf');var config=require(_0x1c61('0x7'));var attributes=require(_0x1c61('0x8'));module['exports']=function(_0x1219db,_0x52e235){return _0x1219db[_0x1c61('0x9')](_0x1c61('0xa'),attributes,{'tableName':_0x1c61('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bf5=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x1bf5,0x122));var _0x51bf=function(_0x21bc06,_0x34364a){_0x21bc06=_0x21bc06-0x0;var _0x40d8b9=_0x1bf5[_0x21bc06];return _0x40d8b9;};'use strict';var _=require(_0x51bf('0x0'));var util=require(_0x51bf('0x1'));var logger=require(_0x51bf('0x2'))(_0x51bf('0x3'));var moment=require(_0x51bf('0x4'));var BPromise=require(_0x51bf('0x5'));var rp=require(_0x51bf('0x6'));var fs=require('fs');var path=require(_0x51bf('0x7'));var rimraf=require(_0x51bf('0x8'));var config=require(_0x51bf('0x9'));var attributes=require(_0x51bf('0xa'));module[_0x51bf('0xb')]=function(_0x4576e8,_0x1cca15){return _0x4576e8[_0x51bf('0xc')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 9c9a98b..4e8af49 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 _0x49fd=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result'];(function(_0x4a41ad,_0x2e6e57){var _0xab1724=function(_0x155448){while(--_0x155448){_0x4a41ad['push'](_0x4a41ad['shift']());}};_0xab1724(++_0x2e6e57);}(_0x49fd,0x166));var _0xd49f=function(_0x1c304a,_0x10b839){_0x1c304a=_0x1c304a-0x0;var _0x23074e=_0x49fd[_0x1c304a];return _0x23074e;};'use strict';var _=require('lodash');var util=require(_0xd49f('0x0'));var moment=require(_0xd49f('0x1'));var BPromise=require(_0xd49f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd49f('0x3'));var db=require(_0xd49f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd49f('0x5'))(_0xd49f('0x6'));var config=require(_0xd49f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd49f('0x8')][_0xd49f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c0313,_0x141bf3,_0x45b572){return new BPromise(function(_0x4f4894,_0x24f162){return client[_0xd49f('0xa')](_0x2c0313,_0x45b572)[_0xd49f('0xb')](function(_0x426422){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x141bf3,_0xd49f('0xc'));logger[_0xd49f('0xd')](_0xd49f('0xe'),_0x141bf3,'request\x20sent',JSON['stringify'](_0x426422));if(_0x426422[_0xd49f('0xf')]){if(_0x426422['error'][_0xd49f('0x10')]===0x1f4){logger[_0xd49f('0xf')](_0xd49f('0x11'),_0x141bf3,_0x426422[_0xd49f('0xf')]['message']);return _0x24f162(_0x426422[_0xd49f('0xf')][_0xd49f('0x12')]);}logger[_0xd49f('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x141bf3,_0x426422['error'][_0xd49f('0x12')]);return _0x4f4894(_0x426422[_0xd49f('0xf')][_0xd49f('0x12')]);}else{logger['info'](_0xd49f('0x11'),_0x141bf3,_0xd49f('0xc'));_0x4f4894(_0x426422[_0xd49f('0x13')][_0xd49f('0x12')]);}})[_0xd49f('0x14')](function(_0x2a9a57){logger[_0xd49f('0xf')](_0xd49f('0x11'),_0x141bf3,_0x2a9a57);_0x24f162(_0x2a9a57);});});} \ No newline at end of file +var _0xffb9=['rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56e96c,_0x32f6ce){var _0x406a8a=function(_0x130be7){while(--_0x130be7){_0x56e96c['push'](_0x56e96c['shift']());}};_0x406a8a(++_0x32f6ce);}(_0xffb9,0x19d));var _0x9ffb=function(_0x29d88a,_0x519495){_0x29d88a=_0x29d88a-0x0;var _0x9f46f3=_0xffb9[_0x29d88a];return _0x9f46f3;};'use strict';var _=require('lodash');var util=require(_0x9ffb('0x0'));var moment=require(_0x9ffb('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ffb('0x2'))['db'];var utils=require(_0x9ffb('0x3'));var logger=require(_0x9ffb('0x4'))(_0x9ffb('0x5'));var config=require(_0x9ffb('0x6'));var jayson=require(_0x9ffb('0x7'));var client=jayson[_0x9ffb('0x8')][_0x9ffb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x557e20,_0x44dc2b,_0x46d9d8){return new BPromise(function(_0x5b4dca,_0x16affe){return client[_0x9ffb('0xa')](_0x557e20,_0x46d9d8)[_0x9ffb('0xb')](function(_0x5da73e){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x44dc2b,_0x9ffb('0xc'));logger[_0x9ffb('0xd')](_0x9ffb('0xe'),_0x44dc2b,_0x9ffb('0xc'),JSON[_0x9ffb('0xf')](_0x5da73e));if(_0x5da73e[_0x9ffb('0x10')]){if(_0x5da73e[_0x9ffb('0x10')][_0x9ffb('0x11')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x44dc2b,_0x5da73e[_0x9ffb('0x10')][_0x9ffb('0x12')]);return _0x16affe(_0x5da73e[_0x9ffb('0x10')]['message']);}logger[_0x9ffb('0x10')](_0x9ffb('0x13'),_0x44dc2b,_0x5da73e[_0x9ffb('0x10')]['message']);return _0x5b4dca(_0x5da73e[_0x9ffb('0x10')][_0x9ffb('0x12')]);}else{logger[_0x9ffb('0x14')](_0x9ffb('0x13'),_0x44dc2b,_0x9ffb('0xc'));_0x5b4dca(_0x5da73e['result'][_0x9ffb('0x12')]);}})[_0x9ffb('0x15')](function(_0x210acd){logger[_0x9ffb('0x10')](_0x9ffb('0x13'),_0x44dc2b,_0x210acd);_0x16affe(_0x210acd);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 45593d4..43b053b 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 _0xc781=['put','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','get','/:id','show','create'];(function(_0x2f97bd,_0x32d1e8){var _0x48f371=function(_0x43b2e3){while(--_0x43b2e3){_0x2f97bd['push'](_0x2f97bd['shift']());}};_0x48f371(++_0x32d1e8);}(_0xc781,0x110));var _0x1c78=function(_0x555530,_0xbb2c43){_0x555530=_0x555530-0x0;var _0x5409e9=_0xc781[_0x555530];return _0x5409e9;};'use strict';var multer=require('multer');var util=require(_0x1c78('0x0'));var path=require(_0x1c78('0x1'));var timeout=require(_0x1c78('0x2'));var express=require(_0x1c78('0x3'));var router=express['Router']();var fs_extra=require(_0x1c78('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1c78('0x5'));var config=require(_0x1c78('0x6'));var controller=require(_0x1c78('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c78('0x8')]);router[_0x1c78('0x9')](_0x1c78('0xa'),auth['isAuthenticated'](),controller[_0x1c78('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1c78('0xc')]);router[_0x1c78('0xd')]('/:id',auth[_0x1c78('0xe')](),controller[_0x1c78('0xf')]);router[_0x1c78('0x10')]('/:id',auth[_0x1c78('0xe')](),controller[_0x1c78('0x11')]);module[_0x1c78('0x12')]=router; \ No newline at end of file +var _0x11d2=['multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','put','exports'];(function(_0x4a248b,_0x29e290){var _0x565f8c=function(_0x3944b1){while(--_0x3944b1){_0x4a248b['push'](_0x4a248b['shift']());}};_0x565f8c(++_0x29e290);}(_0x11d2,0xfc));var _0x211d=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x11d2[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0x211d('0x0'));var util=require(_0x211d('0x1'));var path=require(_0x211d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x211d('0x3'));var interaction=require(_0x211d('0x4'));var config=require(_0x211d('0x5'));var controller=require(_0x211d('0x6'));router[_0x211d('0x7')]('/',auth[_0x211d('0x8')](),controller['index']);router[_0x211d('0x7')](_0x211d('0x9'),auth[_0x211d('0x8')](),controller[_0x211d('0xa')]);router[_0x211d('0xb')]('/',auth[_0x211d('0x8')](),controller['create']);router[_0x211d('0xc')](_0x211d('0x9'),auth[_0x211d('0x8')](),controller['update']);router['delete'](_0x211d('0x9'),auth[_0x211d('0x8')](),controller['destroy']);module[_0x211d('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 88b222a..12a4e37 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 _0x50e7=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0xcc5354,_0x4af9aa){var _0x10f0e1=function(_0x3d3b9e){while(--_0x3d3b9e){_0xcc5354['push'](_0xcc5354['shift']());}};_0x10f0e1(++_0x4af9aa);}(_0x50e7,0xe7));var _0x750e=function(_0x5a67ed,_0x28b5b0){_0x5a67ed=_0x5a67ed-0x0;var _0x3b0744=_0x50e7[_0x5a67ed];return _0x3b0744;};'use strict';var Sequelize=require(_0x750e('0x0'));module[_0x750e('0x1')]={'type':{'type':Sequelize[_0x750e('0x2')](_0x750e('0x3'),_0x750e('0x4'),_0x750e('0x5'),_0x750e('0x6'),_0x750e('0x7')),'defaultValue':_0x750e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x750e('0x2')](_0x750e('0x3'),_0x750e('0x4'),_0x750e('0x5'))},'keyContent':{'type':Sequelize[_0x750e('0x8')]},'idField':{'type':Sequelize[_0x750e('0x8')]},'nameField':{'type':Sequelize[_0x750e('0x8')]},'customField':{'type':Sequelize[_0x750e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x750e('0x8')]}}; \ No newline at end of file +var _0x747a=['BOOLEAN','sequelize','exports','variable','customVariable','picklist','string','ENUM','STRING'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x747a,0xfd));var _0xa747=function(_0x531f8d,_0x264155){_0x531f8d=_0x531f8d-0x0;var _0x5cfda3=_0x747a[_0x531f8d];return _0x5cfda3;};'use strict';var Sequelize=require(_0xa747('0x0'));module[_0xa747('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xa747('0x2'),_0xa747('0x3'),'keyValue',_0xa747('0x4')),'defaultValue':_0xa747('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa747('0x6')]('string',_0xa747('0x2'),_0xa747('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa747('0x7')]},'nameField':{'type':Sequelize[_0xa747('0x7')]},'customField':{'type':Sequelize[_0xa747('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa747('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 31f71da..4e22417 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 _0xfe22=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','map','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','params','SugarcrmField','options','find','create','body','destroy','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1c9728,_0x4cfe7a){var _0x422529=function(_0x1dc5b4){while(--_0x1dc5b4){_0x1c9728['push'](_0x1c9728['shift']());}};_0x422529(++_0x4cfe7a);}(_0xfe22,0x1cb));var _0x2fe2=function(_0x2dcd2b,_0x889cc9){_0x2dcd2b=_0x2dcd2b-0x0;var _0x5c0229=_0xfe22[_0x2dcd2b];return _0x5c0229;};'use strict';var emlformat=require(_0x2fe2('0x0'));var rimraf=require(_0x2fe2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2fe2('0x2'));var moment=require('moment');var BPromise=require(_0x2fe2('0x3'));var Mustache=require('mustache');var util=require(_0x2fe2('0x4'));var path=require(_0x2fe2('0x5'));var sox=require(_0x2fe2('0x6'));var csv=require(_0x2fe2('0x7'));var ejs=require(_0x2fe2('0x8'));var fs=require('fs');var fs_extra=require(_0x2fe2('0x9'));var _=require(_0x2fe2('0xa'));var squel=require('squel');var crypto=require(_0x2fe2('0xb'));var jsforce=require(_0x2fe2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2fe2('0xd'));var Papa=require(_0x2fe2('0xe'));var Redis=require(_0x2fe2('0xf'));var authService=require(_0x2fe2('0x10'));var qs=require(_0x2fe2('0x11'));var as=require(_0x2fe2('0x12'));var hardwareService=require(_0x2fe2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2fe2('0x14'));var config=require(_0x2fe2('0x15'));var licenseUtil=require(_0x2fe2('0x16'));var db=require(_0x2fe2('0x17'))['db'];function respondWithStatusCode(_0x24820c,_0x375981){_0x375981=_0x375981||0xcc;return function(_0x1ffe38){if(_0x1ffe38){return _0x24820c[_0x2fe2('0x18')](_0x375981);}return _0x24820c['status'](_0x375981)['end']();};}function respondWithResult(_0x88844e,_0x3e34bf){_0x3e34bf=_0x3e34bf||0xc8;return function(_0x4e079f){if(_0x4e079f){return _0x88844e[_0x2fe2('0x19')](_0x3e34bf)[_0x2fe2('0x1a')](_0x4e079f);}};}function respondWithFilteredResult(_0x598898,_0x4b4d24){return function(_0x19d70e){if(_0x19d70e){var _0x15651a=typeof _0x4b4d24[_0x2fe2('0x1b')]===_0x2fe2('0x1c')&&typeof _0x4b4d24[_0x2fe2('0x1d')]===_0x2fe2('0x1c');var _0x43fbbb=_0x19d70e[_0x2fe2('0x1e')];var _0x3224b7=_0x15651a?0x0:_0x4b4d24['offset'];var _0x2c400f=_0x15651a?_0x19d70e['count']:_0x4b4d24[_0x2fe2('0x1b')]+_0x4b4d24[_0x2fe2('0x1d')];var _0x3754d6;if(_0x2c400f>=_0x43fbbb){_0x2c400f=_0x43fbbb;_0x3754d6=0xc8;}else{_0x3754d6=0xce;}_0x598898[_0x2fe2('0x19')](_0x3754d6);return _0x598898[_0x2fe2('0x1f')]('Content-Range',_0x3224b7+'-'+_0x2c400f+'/'+_0x43fbbb)[_0x2fe2('0x1a')](_0x19d70e);}return null;};}function patchUpdates(_0xeee5f3){return function(_0x4b084b){try{jsonpatch[_0x2fe2('0x20')](_0x4b084b,_0xeee5f3,!![]);}catch(_0x3a06c9){return BPromise[_0x2fe2('0x21')](_0x3a06c9);}return _0x4b084b['save']();};}function saveUpdates(_0x3a234f,_0x3fa8e7){return function(_0x4ff928){if(_0x4ff928){return _0x4ff928[_0x2fe2('0x22')](_0x3a234f)[_0x2fe2('0x23')](function(_0x6c61bd){return _0x6c61bd;});}return null;};}function removeEntity(_0x135c09,_0x59469e){return function(_0x4adc14){if(_0x4adc14){return _0x4adc14['destroy']()['then'](function(){_0x135c09[_0x2fe2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x394d54,_0x509762){return function(_0xefa240){if(!_0xefa240){_0x394d54['sendStatus'](0x194);}return _0xefa240;};}function handleError(_0x14e210,_0x549e46){_0x549e46=_0x549e46||0x1f4;return function(_0x12dbc8){logger[_0x2fe2('0x24')](_0x12dbc8['stack']);if(_0x12dbc8[_0x2fe2('0x25')]){delete _0x12dbc8['name'];}_0x14e210[_0x2fe2('0x19')](_0x549e46)['send'](_0x12dbc8);};}exports['index']=function(_0x500b70,_0xf195e5){var _0x5ad0cc={},_0x11ea2f={},_0x43a450={'count':0x0,'rows':[]};var _0x59058e=_[_0x2fe2('0x26')](db['SugarcrmField']['rawAttributes'],function(_0x49bbcd){return{'name':_0x49bbcd[_0x2fe2('0x27')],'type':_0x49bbcd['type']['key']};});_0x11ea2f[_0x2fe2('0x28')]=_[_0x2fe2('0x26')](_0x59058e,'name');_0x11ea2f[_0x2fe2('0x29')]=_[_0x2fe2('0x2a')](_0x500b70[_0x2fe2('0x29')]);_0x11ea2f[_0x2fe2('0x2b')]=_['intersection'](_0x11ea2f[_0x2fe2('0x28')],_0x11ea2f[_0x2fe2('0x29')]);_0x5ad0cc[_0x2fe2('0x2c')]=_[_0x2fe2('0x2d')](_0x11ea2f[_0x2fe2('0x28')],qs[_0x2fe2('0x2e')](_0x500b70[_0x2fe2('0x29')]['fields']));_0x5ad0cc[_0x2fe2('0x2c')]=_0x5ad0cc[_0x2fe2('0x2c')][_0x2fe2('0x2f')]?_0x5ad0cc[_0x2fe2('0x2c')]:_0x11ea2f[_0x2fe2('0x28')];if(!_0x500b70[_0x2fe2('0x29')][_0x2fe2('0x30')](_0x2fe2('0x31'))){_0x5ad0cc[_0x2fe2('0x1d')]=qs[_0x2fe2('0x1d')](_0x500b70[_0x2fe2('0x29')]['limit']);_0x5ad0cc[_0x2fe2('0x1b')]=qs[_0x2fe2('0x1b')](_0x500b70[_0x2fe2('0x29')]['offset']);}_0x5ad0cc['order']=qs[_0x2fe2('0x32')](_0x500b70[_0x2fe2('0x29')][_0x2fe2('0x32')]);_0x5ad0cc[_0x2fe2('0x33')]=qs[_0x2fe2('0x2b')](_[_0x2fe2('0x34')](_0x500b70['query'],_0x11ea2f['filters']),_0x59058e);if(_0x500b70[_0x2fe2('0x29')][_0x2fe2('0x35')]){_0x5ad0cc[_0x2fe2('0x33')]=_[_0x2fe2('0x36')](_0x5ad0cc['where'],{'$or':_[_0x2fe2('0x26')](_0x59058e,function(_0x54ff89){if(_0x54ff89[_0x2fe2('0x37')]!==_0x2fe2('0x38')){var _0x56ab9f={};_0x56ab9f[_0x54ff89['name']]={'$like':'%'+_0x500b70['query'][_0x2fe2('0x35')]+'%'};return _0x56ab9f;}})});}_0x5ad0cc=_[_0x2fe2('0x36')]({},_0x5ad0cc,_0x500b70['options']);var _0x2dab88={'where':_0x5ad0cc['where']};return db['SugarcrmField']['count'](_0x2dab88)[_0x2fe2('0x23')](function(_0x58eeca){_0x43a450['count']=_0x58eeca;if(_0x500b70['query'][_0x2fe2('0x39')]){_0x5ad0cc[_0x2fe2('0x3a')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x5ad0cc);})[_0x2fe2('0x23')](function(_0x52b308){_0x43a450[_0x2fe2('0x3b')]=_0x52b308;return _0x43a450;})[_0x2fe2('0x23')](respondWithFilteredResult(_0xf195e5,_0x5ad0cc))[_0x2fe2('0x3c')](handleError(_0xf195e5,null));};exports['show']=function(_0x1d97d5,_0x3d914b){var _0x574fcc={'raw':!![],'where':{'id':_0x1d97d5[_0x2fe2('0x3d')]['id']}},_0x2390a6={};_0x2390a6[_0x2fe2('0x28')]=_['keys'](db[_0x2fe2('0x3e')]['rawAttributes']);_0x2390a6[_0x2fe2('0x29')]=_['keys'](_0x1d97d5[_0x2fe2('0x29')]);_0x2390a6[_0x2fe2('0x2b')]=_['intersection'](_0x2390a6['model'],_0x2390a6[_0x2fe2('0x29')]);_0x574fcc[_0x2fe2('0x2c')]=_[_0x2fe2('0x2d')](_0x2390a6[_0x2fe2('0x28')],qs[_0x2fe2('0x2e')](_0x1d97d5[_0x2fe2('0x29')][_0x2fe2('0x2e')]));_0x574fcc[_0x2fe2('0x2c')]=_0x574fcc[_0x2fe2('0x2c')][_0x2fe2('0x2f')]?_0x574fcc['attributes']:_0x2390a6[_0x2fe2('0x28')];if(_0x1d97d5[_0x2fe2('0x29')][_0x2fe2('0x39')]){_0x574fcc['include']=[{'all':!![]}];}_0x574fcc=_[_0x2fe2('0x36')]({},_0x574fcc,_0x1d97d5[_0x2fe2('0x3f')]);return db[_0x2fe2('0x3e')][_0x2fe2('0x40')](_0x574fcc)[_0x2fe2('0x23')](handleEntityNotFound(_0x3d914b,null))[_0x2fe2('0x23')](respondWithResult(_0x3d914b,null))[_0x2fe2('0x3c')](handleError(_0x3d914b,null));};exports[_0x2fe2('0x41')]=function(_0x17e071,_0x99fd5a){return db['SugarcrmField'][_0x2fe2('0x41')](_0x17e071[_0x2fe2('0x42')],{})[_0x2fe2('0x23')](respondWithResult(_0x99fd5a,0xc9))[_0x2fe2('0x3c')](handleError(_0x99fd5a,null));};exports[_0x2fe2('0x22')]=function(_0x157ce9,_0x2e1d9f){if(_0x157ce9[_0x2fe2('0x42')]['id']){delete _0x157ce9[_0x2fe2('0x42')]['id'];}return db[_0x2fe2('0x3e')][_0x2fe2('0x40')]({'where':{'id':_0x157ce9['params']['id']}})[_0x2fe2('0x23')](handleEntityNotFound(_0x2e1d9f,null))[_0x2fe2('0x23')](saveUpdates(_0x157ce9[_0x2fe2('0x42')],null))['then'](respondWithResult(_0x2e1d9f,null))[_0x2fe2('0x3c')](handleError(_0x2e1d9f,null));};exports[_0x2fe2('0x43')]=function(_0x2b63fb,_0x57153a){return db[_0x2fe2('0x3e')][_0x2fe2('0x40')]({'where':{'id':_0x2b63fb['params']['id']}})['then'](handleEntityNotFound(_0x57153a,null))[_0x2fe2('0x23')](removeEntity(_0x57153a,null))[_0x2fe2('0x3c')](handleError(_0x57153a,null));}; \ No newline at end of file +var _0xa129=['key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','include','findAll','rows','catch','params','intersection','includeAll','merge','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type'];(function(_0x50470f,_0x1e0719){var _0x45e97c=function(_0xe1218d){while(--_0xe1218d){_0x50470f['push'](_0x50470f['shift']());}};_0x45e97c(++_0x1e0719);}(_0xa129,0xf4));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9a12('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a12('0x1'));var jsonpatch=require(_0x9a12('0x2'));var rp=require(_0x9a12('0x3'));var moment=require(_0x9a12('0x4'));var BPromise=require(_0x9a12('0x5'));var Mustache=require(_0x9a12('0x6'));var util=require('util');var path=require(_0x9a12('0x7'));var sox=require(_0x9a12('0x8'));var csv=require(_0x9a12('0x9'));var ejs=require(_0x9a12('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a12('0xb'));var squel=require('squel');var crypto=require(_0x9a12('0xc'));var jsforce=require(_0x9a12('0xd'));var deskjs=require(_0x9a12('0xe'));var toCsv=require(_0x9a12('0x9'));var querystring=require(_0x9a12('0xf'));var Papa=require(_0x9a12('0x10'));var Redis=require(_0x9a12('0x11'));var authService=require(_0x9a12('0x12'));var qs=require(_0x9a12('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a12('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9a12('0x15'));var licenseUtil=require(_0x9a12('0x16'));var db=require(_0x9a12('0x17'))['db'];function respondWithStatusCode(_0x3997c0,_0x1483fd){_0x1483fd=_0x1483fd||0xcc;return function(_0x592352){if(_0x592352){return _0x3997c0[_0x9a12('0x18')](_0x1483fd);}return _0x3997c0[_0x9a12('0x19')](_0x1483fd)[_0x9a12('0x1a')]();};}function respondWithResult(_0x42e2ff,_0x4ce5a5){_0x4ce5a5=_0x4ce5a5||0xc8;return function(_0x1bf31a){if(_0x1bf31a){return _0x42e2ff['status'](_0x4ce5a5)[_0x9a12('0x1b')](_0x1bf31a);}};}function respondWithFilteredResult(_0x32e9c5,_0x2348da){return function(_0x77f2a0){if(_0x77f2a0){var _0x470d3e=typeof _0x2348da[_0x9a12('0x1c')]===_0x9a12('0x1d')&&typeof _0x2348da[_0x9a12('0x1e')]===_0x9a12('0x1d');var _0x4ef182=_0x77f2a0['count'];var _0x23b90d=_0x470d3e?0x0:_0x2348da['offset'];var _0x4482de=_0x470d3e?_0x77f2a0[_0x9a12('0x1f')]:_0x2348da['offset']+_0x2348da[_0x9a12('0x1e')];var _0x2e8dfa;if(_0x4482de>=_0x4ef182){_0x4482de=_0x4ef182;_0x2e8dfa=0xc8;}else{_0x2e8dfa=0xce;}_0x32e9c5[_0x9a12('0x19')](_0x2e8dfa);return _0x32e9c5[_0x9a12('0x20')](_0x9a12('0x21'),_0x23b90d+'-'+_0x4482de+'/'+_0x4ef182)['json'](_0x77f2a0);}return null;};}function patchUpdates(_0x103a4d){return function(_0x17cbef){try{jsonpatch[_0x9a12('0x22')](_0x17cbef,_0x103a4d,!![]);}catch(_0x496640){return BPromise[_0x9a12('0x23')](_0x496640);}return _0x17cbef['save']();};}function saveUpdates(_0x323459,_0xb7040b){return function(_0x3c8c12){if(_0x3c8c12){return _0x3c8c12[_0x9a12('0x24')](_0x323459)['then'](function(_0x274be2){return _0x274be2;});}return null;};}function removeEntity(_0xde98d9,_0x4aaec6){return function(_0x1e9b37){if(_0x1e9b37){return _0x1e9b37[_0x9a12('0x25')]()[_0x9a12('0x26')](function(){_0xde98d9[_0x9a12('0x19')](0xcc)[_0x9a12('0x1a')]();});}};}function handleEntityNotFound(_0x4810a4,_0x3ed2c6){return function(_0xd8d12f){if(!_0xd8d12f){_0x4810a4[_0x9a12('0x18')](0x194);}return _0xd8d12f;};}function handleError(_0x2e5362,_0x5bdf02){_0x5bdf02=_0x5bdf02||0x1f4;return function(_0x24955f){logger[_0x9a12('0x27')](_0x24955f[_0x9a12('0x28')]);if(_0x24955f[_0x9a12('0x29')]){delete _0x24955f[_0x9a12('0x29')];}_0x2e5362['status'](_0x5bdf02)['send'](_0x24955f);};}exports[_0x9a12('0x2a')]=function(_0x131181,_0x3a1fae){var _0x1ac3f3={},_0x35075a={},_0x977943={'count':0x0,'rows':[]};var _0x3277ed=_[_0x9a12('0x2b')](db[_0x9a12('0x2c')][_0x9a12('0x2d')],function(_0x5ed645){return{'name':_0x5ed645[_0x9a12('0x2e')],'type':_0x5ed645[_0x9a12('0x2f')][_0x9a12('0x30')]};});_0x35075a[_0x9a12('0x31')]=_[_0x9a12('0x2b')](_0x3277ed,_0x9a12('0x29'));_0x35075a['query']=_['keys'](_0x131181[_0x9a12('0x32')]);_0x35075a[_0x9a12('0x33')]=_['intersection'](_0x35075a[_0x9a12('0x31')],_0x35075a[_0x9a12('0x32')]);_0x1ac3f3[_0x9a12('0x34')]=_['intersection'](_0x35075a[_0x9a12('0x31')],qs[_0x9a12('0x35')](_0x131181[_0x9a12('0x32')][_0x9a12('0x35')]));_0x1ac3f3['attributes']=_0x1ac3f3['attributes'][_0x9a12('0x36')]?_0x1ac3f3[_0x9a12('0x34')]:_0x35075a['model'];if(!_0x131181[_0x9a12('0x32')]['hasOwnProperty'](_0x9a12('0x37'))){_0x1ac3f3['limit']=qs['limit'](_0x131181[_0x9a12('0x32')][_0x9a12('0x1e')]);_0x1ac3f3[_0x9a12('0x1c')]=qs[_0x9a12('0x1c')](_0x131181['query']['offset']);}_0x1ac3f3[_0x9a12('0x38')]=qs[_0x9a12('0x39')](_0x131181[_0x9a12('0x32')][_0x9a12('0x39')]);_0x1ac3f3[_0x9a12('0x3a')]=qs[_0x9a12('0x33')](_['pick'](_0x131181[_0x9a12('0x32')],_0x35075a[_0x9a12('0x33')]),_0x3277ed);if(_0x131181[_0x9a12('0x32')][_0x9a12('0x3b')]){_0x1ac3f3['where']=_['merge'](_0x1ac3f3[_0x9a12('0x3a')],{'$or':_[_0x9a12('0x2b')](_0x3277ed,function(_0x2527c7){if(_0x2527c7[_0x9a12('0x2f')]!==_0x9a12('0x3c')){var _0x2eec9b={};_0x2eec9b[_0x2527c7[_0x9a12('0x29')]]={'$like':'%'+_0x131181[_0x9a12('0x32')][_0x9a12('0x3b')]+'%'};return _0x2eec9b;}})});}_0x1ac3f3=_['merge']({},_0x1ac3f3,_0x131181['options']);var _0x105560={'where':_0x1ac3f3[_0x9a12('0x3a')]};return db[_0x9a12('0x2c')][_0x9a12('0x1f')](_0x105560)[_0x9a12('0x26')](function(_0x12fabd){_0x977943['count']=_0x12fabd;if(_0x131181[_0x9a12('0x32')]['includeAll']){_0x1ac3f3[_0x9a12('0x3d')]=[{'all':!![]}];}return db[_0x9a12('0x2c')][_0x9a12('0x3e')](_0x1ac3f3);})[_0x9a12('0x26')](function(_0x288224){_0x977943[_0x9a12('0x3f')]=_0x288224;return _0x977943;})[_0x9a12('0x26')](respondWithFilteredResult(_0x3a1fae,_0x1ac3f3))[_0x9a12('0x40')](handleError(_0x3a1fae,null));};exports['show']=function(_0x43af1b,_0x4169b4){var _0x120411={'raw':!![],'where':{'id':_0x43af1b[_0x9a12('0x41')]['id']}},_0x1a5193={};_0x1a5193[_0x9a12('0x31')]=_['keys'](db[_0x9a12('0x2c')][_0x9a12('0x2d')]);_0x1a5193[_0x9a12('0x32')]=_['keys'](_0x43af1b[_0x9a12('0x32')]);_0x1a5193['filters']=_[_0x9a12('0x42')](_0x1a5193[_0x9a12('0x31')],_0x1a5193[_0x9a12('0x32')]);_0x120411[_0x9a12('0x34')]=_[_0x9a12('0x42')](_0x1a5193[_0x9a12('0x31')],qs[_0x9a12('0x35')](_0x43af1b[_0x9a12('0x32')][_0x9a12('0x35')]));_0x120411[_0x9a12('0x34')]=_0x120411['attributes'][_0x9a12('0x36')]?_0x120411[_0x9a12('0x34')]:_0x1a5193[_0x9a12('0x31')];if(_0x43af1b[_0x9a12('0x32')][_0x9a12('0x43')]){_0x120411['include']=[{'all':!![]}];}_0x120411=_[_0x9a12('0x44')]({},_0x120411,_0x43af1b[_0x9a12('0x45')]);return db[_0x9a12('0x2c')][_0x9a12('0x46')](_0x120411)['then'](handleEntityNotFound(_0x4169b4,null))['then'](respondWithResult(_0x4169b4,null))[_0x9a12('0x40')](handleError(_0x4169b4,null));};exports[_0x9a12('0x47')]=function(_0x2e1668,_0x3b3618){return db[_0x9a12('0x2c')][_0x9a12('0x47')](_0x2e1668[_0x9a12('0x48')],{})[_0x9a12('0x26')](respondWithResult(_0x3b3618,0xc9))[_0x9a12('0x40')](handleError(_0x3b3618,null));};exports[_0x9a12('0x24')]=function(_0x1b2305,_0xe016ce){if(_0x1b2305[_0x9a12('0x48')]['id']){delete _0x1b2305[_0x9a12('0x48')]['id'];}return db[_0x9a12('0x2c')]['find']({'where':{'id':_0x1b2305[_0x9a12('0x41')]['id']}})[_0x9a12('0x26')](handleEntityNotFound(_0xe016ce,null))[_0x9a12('0x26')](saveUpdates(_0x1b2305[_0x9a12('0x48')],null))[_0x9a12('0x26')](respondWithResult(_0xe016ce,null))['catch'](handleError(_0xe016ce,null));};exports[_0x9a12('0x25')]=function(_0x4cb876,_0x5252f3){return db[_0x9a12('0x2c')]['find']({'where':{'id':_0x4cb876[_0x9a12('0x41')]['id']}})[_0x9a12('0x26')](handleEntityNotFound(_0x5252f3,null))[_0x9a12('0x26')](removeEntity(_0x5252f3,null))[_0x9a12('0x40')](handleError(_0x5252f3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4268cff..0ecc6ce 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 _0xb39e=['int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','SugarcrmField'];(function(_0x2fc393,_0x28ef34){var _0x30036=function(_0x1bf317){while(--_0x1bf317){_0x2fc393['push'](_0x2fc393['shift']());}};_0x30036(++_0x28ef34);}(_0xb39e,0xff));var _0xeb39=function(_0xcd07c,_0x8f566c){_0xcd07c=_0xcd07c-0x0;var _0xb99e27=_0xb39e[_0xcd07c];return _0xb99e27;};'use strict';var _=require(_0xeb39('0x0'));var util=require(_0xeb39('0x1'));var logger=require('../../config/logger')(_0xeb39('0x2'));var moment=require(_0xeb39('0x3'));var BPromise=require(_0xeb39('0x4'));var rp=require(_0xeb39('0x5'));var fs=require('fs');var path=require(_0xeb39('0x6'));var rimraf=require(_0xeb39('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0xeb39('0x8')]=function(_0x1ff49b,_0x3106cb){return _0x1ff49b[_0xeb39('0x9')](_0xeb39('0xa'),attributes,{'tableName':_0xeb39('0xb'),'paranoid':![],'indexes':[{'name':_0xeb39('0xc'),'fields':['idField',_0xeb39('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f80=['./intSugarcrmField.attributes','exports','define','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2664c0,_0x2a75d1){var _0x312b33=function(_0x4304c8){while(--_0x4304c8){_0x2664c0['push'](_0x2664c0['shift']());}};_0x312b33(++_0x2a75d1);}(_0x6f80,0x1b5));var _0x06f8=function(_0x492801,_0x39de84){_0x492801=_0x492801-0x0;var _0x276377=_0x6f80[_0x492801];return _0x276377;};'use strict';var _=require(_0x06f8('0x0'));var util=require(_0x06f8('0x1'));var logger=require(_0x06f8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x06f8('0x3'));var rp=require(_0x06f8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06f8('0x5'));var config=require(_0x06f8('0x6'));var attributes=require(_0x06f8('0x7'));module[_0x06f8('0x8')]=function(_0x1aa40f,_0x29b73a){return _0x1aa40f[_0x06f8('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x06f8('0xa'),_0x06f8('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 fd2f580..26eb165 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 _0xa8cb=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x28aaed,_0x4e388e){var _0x97967=function(_0x49266c){while(--_0x49266c){_0x28aaed['push'](_0x28aaed['shift']());}};_0x97967(++_0x4e388e);}(_0xa8cb,0xc8));var _0xba8c=function(_0x21ab24,_0x5849aa){_0x21ab24=_0x21ab24-0x0;var _0x41f411=_0xa8cb[_0x21ab24];return _0x41f411;};'use strict';var _=require(_0xba8c('0x0'));var util=require('util');var moment=require(_0xba8c('0x1'));var BPromise=require(_0xba8c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba8c('0x3'));var db=require(_0xba8c('0x4'))['db'];var utils=require(_0xba8c('0x5'));var logger=require(_0xba8c('0x6'))(_0xba8c('0x7'));var config=require(_0xba8c('0x8'));var jayson=require(_0xba8c('0x9'));var client=jayson['client'][_0xba8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26c229,_0x54cbeb,_0x47261e){return new BPromise(function(_0x4fa543,_0xaa8f51){return client[_0xba8c('0xb')](_0x26c229,_0x47261e)[_0xba8c('0xc')](function(_0xa0dce8){logger[_0xba8c('0xd')](_0xba8c('0xe'),_0x54cbeb,_0xba8c('0xf'));logger[_0xba8c('0x10')](_0xba8c('0x11'),_0x54cbeb,_0xba8c('0xf'),JSON['stringify'](_0xa0dce8));if(_0xa0dce8['error']){if(_0xa0dce8['error'][_0xba8c('0x12')]===0x1f4){logger[_0xba8c('0x13')](_0xba8c('0xe'),_0x54cbeb,_0xa0dce8[_0xba8c('0x13')]['message']);return _0xaa8f51(_0xa0dce8[_0xba8c('0x13')][_0xba8c('0x14')]);}logger[_0xba8c('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x54cbeb,_0xa0dce8['error']['message']);return _0x4fa543(_0xa0dce8[_0xba8c('0x13')][_0xba8c('0x14')]);}else{logger[_0xba8c('0xd')](_0xba8c('0xe'),_0x54cbeb,_0xba8c('0xf'));_0x4fa543(_0xa0dce8[_0xba8c('0x15')][_0xba8c('0x14')]);}})['catch'](function(_0x3b2a24){logger[_0xba8c('0x13')](_0xba8c('0xe'),_0x54cbeb,_0x3b2a24);_0xaa8f51(_0x3b2a24);});});} \ No newline at end of file +var _0x6a61=['debug','request\x20sent','code','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s'];(function(_0x4c9b5b,_0x4681eb){var _0x2104e1=function(_0x427c66){while(--_0x427c66){_0x4c9b5b['push'](_0x4c9b5b['shift']());}};_0x2104e1(++_0x4681eb);}(_0x6a61,0x160));var _0x16a6=function(_0x5ec0a4,_0xc13c7f){_0x5ec0a4=_0x5ec0a4-0x0;var _0x49540d=_0x6a61[_0x5ec0a4];return _0x49540d;};'use strict';var _=require(_0x16a6('0x0'));var util=require(_0x16a6('0x1'));var moment=require(_0x16a6('0x2'));var BPromise=require(_0x16a6('0x3'));var rs=require(_0x16a6('0x4'));var fs=require('fs');var Redis=require(_0x16a6('0x5'));var db=require(_0x16a6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x16a6('0x7'))(_0x16a6('0x8'));var config=require(_0x16a6('0x9'));var jayson=require(_0x16a6('0xa'));var client=jayson[_0x16a6('0xb')][_0x16a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4462dd,_0x14445a,_0x143239){return new BPromise(function(_0x3ea66b,_0x18e9cd){return client[_0x16a6('0xd')](_0x4462dd,_0x143239)[_0x16a6('0xe')](function(_0x75f52a){logger['info'](_0x16a6('0xf'),_0x14445a,'request\x20sent');logger[_0x16a6('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x14445a,_0x16a6('0x11'),JSON['stringify'](_0x75f52a));if(_0x75f52a['error']){if(_0x75f52a['error'][_0x16a6('0x12')]===0x1f4){logger['error'](_0x16a6('0xf'),_0x14445a,_0x75f52a[_0x16a6('0x13')]['message']);return _0x18e9cd(_0x75f52a[_0x16a6('0x13')][_0x16a6('0x14')]);}logger['error'](_0x16a6('0xf'),_0x14445a,_0x75f52a[_0x16a6('0x13')]['message']);return _0x3ea66b(_0x75f52a[_0x16a6('0x13')][_0x16a6('0x14')]);}else{logger[_0x16a6('0x15')](_0x16a6('0xf'),_0x14445a,_0x16a6('0x11'));_0x3ea66b(_0x75f52a[_0x16a6('0x16')]['message']);}})['catch'](function(_0x54fe8b){logger[_0x16a6('0x13')](_0x16a6('0xf'),_0x14445a,_0x54fe8b);_0x18e9cd(_0x54fe8b);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 30271cf..2661037 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 _0xba92=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xebbd4f,_0x231ad6){var _0x8489cb=function(_0x25da09){while(--_0x25da09){_0xebbd4f['push'](_0xebbd4f['shift']());}};_0x8489cb(++_0x231ad6);}(_0xba92,0xe9));var _0x2ba9=function(_0x1fcdaa,_0xb8006b){_0x1fcdaa=_0x1fcdaa-0x0;var _0x183edb=_0xba92[_0x1fcdaa];return _0x183edb;};'use strict';var multer=require(_0x2ba9('0x0'));var util=require(_0x2ba9('0x1'));var path=require(_0x2ba9('0x2'));var timeout=require(_0x2ba9('0x3'));var express=require(_0x2ba9('0x4'));var router=express[_0x2ba9('0x5')]();var fs_extra=require(_0x2ba9('0x6'));var auth=require(_0x2ba9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2ba9('0x8'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x2ba9('0x9')](),controller[_0x2ba9('0xa')]);router[_0x2ba9('0xb')](_0x2ba9('0xc'),auth['isAuthenticated'](),controller[_0x2ba9('0xd')]);router[_0x2ba9('0xb')](_0x2ba9('0xe'),auth[_0x2ba9('0x9')](),controller[_0x2ba9('0xf')]);router[_0x2ba9('0xb')](_0x2ba9('0x10'),auth[_0x2ba9('0x9')](),controller[_0x2ba9('0x11')]);router[_0x2ba9('0x12')]('/',auth[_0x2ba9('0x9')](),controller[_0x2ba9('0x13')]);router[_0x2ba9('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x2ba9('0x14')](_0x2ba9('0xc'),auth[_0x2ba9('0x9')](),controller[_0x2ba9('0x15')]);router['delete'](_0x2ba9('0xc'),auth[_0x2ba9('0x9')](),controller[_0x2ba9('0x16')]);module[_0x2ba9('0x17')]=router; \ No newline at end of file +var _0x5530=['/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index'];(function(_0x538a20,_0x5c14d6){var _0xec72f5=function(_0x582321){while(--_0x582321){_0x538a20['push'](_0x538a20['shift']());}};_0xec72f5(++_0x5c14d6);}(_0x5530,0xa7));var _0x0553=function(_0xfc4ab8,_0x5df9d0){_0xfc4ab8=_0xfc4ab8-0x0;var _0x5ed755=_0x5530[_0xfc4ab8];return _0x5ed755;};'use strict';var multer=require(_0x0553('0x0'));var util=require('util');var path=require(_0x0553('0x1'));var timeout=require(_0x0553('0x2'));var express=require(_0x0553('0x3'));var router=express[_0x0553('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0553('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0553('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x0553('0x7')]('/',auth['isAuthenticated'](),controller[_0x0553('0x8')]);router[_0x0553('0x7')](_0x0553('0x9'),auth[_0x0553('0xa')](),controller['show']);router['get'](_0x0553('0xb'),auth[_0x0553('0xa')](),controller[_0x0553('0xc')]);router[_0x0553('0x7')](_0x0553('0xd'),auth[_0x0553('0xa')](),controller[_0x0553('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0553('0xf')]);router[_0x0553('0x10')](_0x0553('0xb'),auth[_0x0553('0xa')](),controller[_0x0553('0x11')]);router[_0x0553('0x12')](_0x0553('0x9'),auth[_0x0553('0xa')](),controller[_0x0553('0x13')]);router[_0x0553('0x14')]('/:id',auth[_0x0553('0xa')](),controller['destroy']);module[_0x0553('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 92369fb..711d364 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 _0x2714=['STRING','HelpDesk'];(function(_0x3a7f7e,_0x101395){var _0x41bbc9=function(_0x3b5d50){while(--_0x3b5d50){_0x3a7f7e['push'](_0x3a7f7e['shift']());}};_0x41bbc9(++_0x101395);}(_0x2714,0x118));var _0x4271=function(_0x291f2a,_0xd9c2e){_0x291f2a=_0x291f2a-0x0;var _0x26ac1c=_0x2714[_0x291f2a];return _0x26ac1c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4271('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4271('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4271('0x0')],'allowNull':![],'defaultValue':_0x4271('0x1')},'remoteUri':{'type':Sequelize[_0x4271('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4271('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4271('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x8cdf=['exports','STRING','sequelize'];(function(_0x386306,_0x1363c9){var _0xcb23d=function(_0x1fc525){while(--_0x1fc525){_0x386306['push'](_0x386306['shift']());}};_0xcb23d(++_0x1363c9);}(_0x8cdf,0x134));var _0xf8cd=function(_0x549ef3,_0x19bc63){_0x549ef3=_0x549ef3-0x0;var _0x16d550=_0x8cdf[_0x549ef3];return _0x16d550;};'use strict';var Sequelize=require(_0xf8cd('0x0'));module[_0xf8cd('0x1')]={'name':{'type':Sequelize[_0xf8cd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf8cd('0x2')]},'username':{'type':Sequelize[_0xf8cd('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf8cd('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xf8cd('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf8cd('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f3dede4..6cb2ea5 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 _0x0a98=['remove','includes','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','error','stack','send','map','VtigerAccount','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','filter','nolimit','addConfiguration','AccountId','Subjects','channel','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','describe','result','sessionName','autogenerated'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x0a98,0x87));var _0x80a9=function(_0x229cb9,_0x231d31){_0x229cb9=_0x229cb9-0x0;var _0x54934e=_0x0a98[_0x229cb9];return _0x54934e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80a9('0x0'));var zipdir=require(_0x80a9('0x1'));var jsonpatch=require(_0x80a9('0x2'));var rp=require(_0x80a9('0x3'));var moment=require('moment');var BPromise=require(_0x80a9('0x4'));var Mustache=require(_0x80a9('0x5'));var util=require(_0x80a9('0x6'));var path=require(_0x80a9('0x7'));var sox=require(_0x80a9('0x8'));var csv=require(_0x80a9('0x9'));var ejs=require(_0x80a9('0xa'));var fs=require('fs');var fs_extra=require(_0x80a9('0xb'));var _=require(_0x80a9('0xc'));var squel=require(_0x80a9('0xd'));var crypto=require('crypto');var jsforce=require(_0x80a9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x80a9('0xf'));var Papa=require(_0x80a9('0x10'));var Redis=require(_0x80a9('0x11'));var authService=require(_0x80a9('0x12'));var qs=require(_0x80a9('0x13'));var as=require(_0x80a9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x80a9('0x15'));var licenseUtil=require(_0x80a9('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x80a9('0x17'));function respondWithStatusCode(_0x2656a5,_0x587bf4){_0x587bf4=_0x587bf4||0xcc;return function(_0x55a054){if(_0x55a054){return _0x2656a5['sendStatus'](_0x587bf4);}return _0x2656a5[_0x80a9('0x18')](_0x587bf4)[_0x80a9('0x19')]();};}function respondWithResult(_0x2e57dd,_0x2d7d4f){_0x2d7d4f=_0x2d7d4f||0xc8;return function(_0x3a3fa9){if(_0x3a3fa9){return _0x2e57dd[_0x80a9('0x18')](_0x2d7d4f)[_0x80a9('0x1a')](_0x3a3fa9);}};}function respondWithFilteredResult(_0x4bdcbd,_0x3c62bc){return function(_0xb65343){if(_0xb65343){var _0x5969af=typeof _0x3c62bc[_0x80a9('0x1b')]===_0x80a9('0x1c')&&typeof _0x3c62bc[_0x80a9('0x1d')]===_0x80a9('0x1c');var _0x5bced1=_0xb65343[_0x80a9('0x1e')];var _0x3debc9=_0x5969af?0x0:_0x3c62bc[_0x80a9('0x1b')];var _0x57d6df=_0x5969af?_0xb65343[_0x80a9('0x1e')]:_0x3c62bc['offset']+_0x3c62bc[_0x80a9('0x1d')];var _0xd9261f;if(_0x57d6df>=_0x5bced1){_0x57d6df=_0x5bced1;_0xd9261f=0xc8;}else{_0xd9261f=0xce;}_0x4bdcbd[_0x80a9('0x18')](_0xd9261f);return _0x4bdcbd[_0x80a9('0x1f')]('Content-Range',_0x3debc9+'-'+_0x57d6df+'/'+_0x5bced1)[_0x80a9('0x1a')](_0xb65343);}return null;};}function patchUpdates(_0x5e8a19){return function(_0x48d5c9){try{jsonpatch['apply'](_0x48d5c9,_0x5e8a19,!![]);}catch(_0x654e6b){return BPromise[_0x80a9('0x20')](_0x654e6b);}return _0x48d5c9[_0x80a9('0x21')]();};}function saveUpdates(_0x4f99d8,_0x22b024){return function(_0x1ca0fd){if(_0x1ca0fd){return _0x1ca0fd[_0x80a9('0x22')](_0x4f99d8)[_0x80a9('0x23')](function(_0x1630f6){return _0x1630f6;});}return null;};}function removeEntity(_0x1c88c8,_0x9d9487){return function(_0x41cde3){if(_0x41cde3){return _0x41cde3[_0x80a9('0x24')]()[_0x80a9('0x23')](function(){_0x1c88c8['status'](0xcc)[_0x80a9('0x19')]();});}};}function handleEntityNotFound(_0x5f5c09,_0x4d4baf){return function(_0x10c696){if(!_0x10c696){_0x5f5c09[_0x80a9('0x25')](0x194);}return _0x10c696;};}function handleError(_0x1c418c,_0x5bf404){_0x5bf404=_0x5bf404||0x1f4;return function(_0x27cc0b){logger[_0x80a9('0x26')](_0x27cc0b[_0x80a9('0x27')]);if(_0x27cc0b['name']){delete _0x27cc0b['name'];}_0x1c418c['status'](_0x5bf404)[_0x80a9('0x28')](_0x27cc0b);};}exports['index']=function(_0x3fcf37,_0x1939a3){var _0x1d9eae={},_0x5b2709={},_0x4bce5c={'count':0x0,'rows':[]};var _0x38bcad=_[_0x80a9('0x29')](db[_0x80a9('0x2a')][_0x80a9('0x2b')],function(_0x295714){return{'name':_0x295714[_0x80a9('0x2c')],'type':_0x295714[_0x80a9('0x2d')][_0x80a9('0x2e')]};});_0x5b2709['model']=_[_0x80a9('0x29')](_0x38bcad,_0x80a9('0x2f'));_0x5b2709[_0x80a9('0x30')]=_[_0x80a9('0x31')](_0x3fcf37[_0x80a9('0x30')]);_0x5b2709[_0x80a9('0x32')]=_[_0x80a9('0x33')](_0x5b2709[_0x80a9('0x34')],_0x5b2709[_0x80a9('0x30')]);_0x1d9eae[_0x80a9('0x35')]=_[_0x80a9('0x33')](_0x5b2709[_0x80a9('0x34')],qs[_0x80a9('0x36')](_0x3fcf37['query'][_0x80a9('0x36')]));_0x1d9eae[_0x80a9('0x35')]=_0x1d9eae[_0x80a9('0x35')][_0x80a9('0x37')]?_0x1d9eae[_0x80a9('0x35')]:_0x5b2709[_0x80a9('0x34')];if(!_0x3fcf37[_0x80a9('0x30')][_0x80a9('0x38')]('nolimit')){_0x1d9eae['limit']=qs[_0x80a9('0x1d')](_0x3fcf37['query'][_0x80a9('0x1d')]);_0x1d9eae['offset']=qs['offset'](_0x3fcf37[_0x80a9('0x30')][_0x80a9('0x1b')]);}_0x1d9eae[_0x80a9('0x39')]=qs[_0x80a9('0x3a')](_0x3fcf37[_0x80a9('0x30')][_0x80a9('0x3a')]);_0x1d9eae[_0x80a9('0x3b')]=qs[_0x80a9('0x32')](_[_0x80a9('0x3c')](_0x3fcf37['query'],_0x5b2709['filters']),_0x38bcad);if(_0x3fcf37[_0x80a9('0x30')]['filter']){_0x1d9eae[_0x80a9('0x3b')]=_[_0x80a9('0x3d')](_0x1d9eae['where'],{'$or':_[_0x80a9('0x29')](_0x38bcad,function(_0x45366a){if(_0x45366a[_0x80a9('0x2d')]!==_0x80a9('0x3e')){var _0x55bc75={};_0x55bc75[_0x45366a[_0x80a9('0x2f')]]={'$like':'%'+_0x3fcf37[_0x80a9('0x30')]['filter']+'%'};return _0x55bc75;}})});}_0x1d9eae=_['merge']({},_0x1d9eae,_0x3fcf37['options']);var _0x32cad0={'where':_0x1d9eae[_0x80a9('0x3b')]};return db[_0x80a9('0x2a')]['count'](_0x32cad0)['then'](function(_0x19cf3d){_0x4bce5c[_0x80a9('0x1e')]=_0x19cf3d;if(_0x3fcf37[_0x80a9('0x30')][_0x80a9('0x3f')]){_0x1d9eae[_0x80a9('0x40')]=[{'all':!![]}];}return db[_0x80a9('0x2a')][_0x80a9('0x41')](_0x1d9eae);})['then'](function(_0x5d3be8){_0x4bce5c[_0x80a9('0x42')]=_0x5d3be8;return _0x4bce5c;})[_0x80a9('0x23')](respondWithFilteredResult(_0x1939a3,_0x1d9eae))[_0x80a9('0x43')](handleError(_0x1939a3,null));};exports[_0x80a9('0x44')]=function(_0x520968,_0x5dab81){var _0x5f5312={'raw':![],'where':{'id':_0x520968[_0x80a9('0x45')]['id']}},_0x48d8c5={};_0x48d8c5['model']=_[_0x80a9('0x31')](db[_0x80a9('0x2a')]['rawAttributes']);_0x48d8c5['query']=_[_0x80a9('0x31')](_0x520968['query']);_0x48d8c5[_0x80a9('0x32')]=_[_0x80a9('0x33')](_0x48d8c5['model'],_0x48d8c5[_0x80a9('0x30')]);_0x5f5312[_0x80a9('0x35')]=_[_0x80a9('0x33')](_0x48d8c5[_0x80a9('0x34')],qs[_0x80a9('0x36')](_0x520968[_0x80a9('0x30')][_0x80a9('0x36')]));_0x5f5312[_0x80a9('0x35')]=_0x5f5312['attributes']['length']?_0x5f5312[_0x80a9('0x35')]:_0x48d8c5[_0x80a9('0x34')];if(_0x520968[_0x80a9('0x30')][_0x80a9('0x3f')]){_0x5f5312[_0x80a9('0x40')]=[{'all':!![]}];}_0x5f5312=_[_0x80a9('0x3d')]({},_0x5f5312,_0x520968[_0x80a9('0x46')]);return db[_0x80a9('0x2a')][_0x80a9('0x47')](_0x5f5312)['then'](handleEntityNotFound(_0x5dab81,null))[_0x80a9('0x23')](respondWithResult(_0x5dab81,null))['catch'](handleError(_0x5dab81,null));};exports[_0x80a9('0x48')]=function(_0x5d4dfe,_0x33c345){return db[_0x80a9('0x2a')][_0x80a9('0x48')](_0x5d4dfe[_0x80a9('0x49')],{})[_0x80a9('0x23')](respondWithResult(_0x33c345,0xc9))[_0x80a9('0x43')](handleError(_0x33c345,null));};exports[_0x80a9('0x22')]=function(_0x129489,_0x4c4eea){if(_0x129489[_0x80a9('0x49')]['id']){delete _0x129489[_0x80a9('0x49')]['id'];}return db[_0x80a9('0x2a')]['find']({'where':{'id':_0x129489[_0x80a9('0x45')]['id']}})[_0x80a9('0x23')](handleEntityNotFound(_0x4c4eea,null))[_0x80a9('0x23')](saveUpdates(_0x129489[_0x80a9('0x49')],null))[_0x80a9('0x23')](respondWithResult(_0x4c4eea,null))[_0x80a9('0x43')](handleError(_0x4c4eea,null));};exports[_0x80a9('0x24')]=function(_0x399df1,_0x5bbca6){return db[_0x80a9('0x2a')][_0x80a9('0x47')]({'where':{'id':_0x399df1[_0x80a9('0x45')]['id']}})[_0x80a9('0x23')](handleEntityNotFound(_0x5bbca6,null))[_0x80a9('0x23')](removeEntity(_0x5bbca6,null))[_0x80a9('0x43')](handleError(_0x5bbca6,null));};exports[_0x80a9('0x4a')]=function(_0x354262,_0x1034fb,_0x5ee157){var _0x37f893={};var _0x4d6419={};var _0x10ded;var _0x56c7c9;return db[_0x80a9('0x2a')][_0x80a9('0x4b')]({'where':{'id':_0x354262[_0x80a9('0x45')]['id']}})[_0x80a9('0x23')](handleEntityNotFound(_0x1034fb,null))['then'](function(_0x548e1c){if(_0x548e1c){_0x10ded=_0x548e1c;_0x4d6419['model']=_[_0x80a9('0x31')](db[_0x80a9('0x4c')][_0x80a9('0x2b')]);_0x4d6419[_0x80a9('0x30')]=_[_0x80a9('0x31')](_0x354262[_0x80a9('0x30')]);_0x4d6419['filters']=_[_0x80a9('0x33')](_0x4d6419['model'],_0x4d6419[_0x80a9('0x30')]);_0x37f893[_0x80a9('0x35')]=_[_0x80a9('0x33')](_0x4d6419[_0x80a9('0x34')],qs[_0x80a9('0x36')](_0x354262[_0x80a9('0x30')][_0x80a9('0x36')]));_0x37f893['attributes']=_0x37f893[_0x80a9('0x35')][_0x80a9('0x37')]?_0x37f893['attributes']:_0x4d6419[_0x80a9('0x34')];_0x37f893[_0x80a9('0x39')]=qs[_0x80a9('0x3a')](_0x354262[_0x80a9('0x30')][_0x80a9('0x3a')]);_0x37f893[_0x80a9('0x3b')]=qs[_0x80a9('0x32')](_[_0x80a9('0x3c')](_0x354262[_0x80a9('0x30')],_0x4d6419['filters']));if(_0x354262['query'][_0x80a9('0x4d')]){_0x37f893[_0x80a9('0x3b')]=_['merge'](_0x37f893[_0x80a9('0x3b')],{'$or':_[_0x80a9('0x29')](_0x37f893[_0x80a9('0x35')],function(_0x4e59a8){var _0x496a01={};_0x496a01[_0x4e59a8]={'$like':'%'+_0x354262['query'][_0x80a9('0x4d')]+'%'};return _0x496a01;})});}_0x37f893=_['merge']({},_0x37f893,_0x354262[_0x80a9('0x46')]);return _0x10ded[_0x80a9('0x4a')](_0x37f893);}})[_0x80a9('0x23')](function(_0x2e7bb2){if(_0x2e7bb2){_0x56c7c9=_0x2e7bb2['length'];if(!_0x354262['query'][_0x80a9('0x38')](_0x80a9('0x4e'))){_0x37f893[_0x80a9('0x1d')]=qs['limit'](_0x354262[_0x80a9('0x30')][_0x80a9('0x1d')]);_0x37f893[_0x80a9('0x1b')]=qs[_0x80a9('0x1b')](_0x354262['query'][_0x80a9('0x1b')]);}return _0x10ded[_0x80a9('0x4a')](_0x37f893);}})['then'](function(_0x8efed){if(_0x8efed){return _0x8efed?{'count':_0x56c7c9,'rows':_0x8efed}:null;}})[_0x80a9('0x23')](respondWithResult(_0x1034fb,null))[_0x80a9('0x43')](handleError(_0x1034fb,null));};exports[_0x80a9('0x4f')]=function(_0x28107f,_0x1fb97a,_0x2daa46){if(_0x28107f[_0x80a9('0x49')]['id']){delete _0x28107f[_0x80a9('0x49')]['id'];}return db[_0x80a9('0x2a')][_0x80a9('0x4b')]({'where':{'id':_0x28107f['params']['id']}})['then'](handleEntityNotFound(_0x1fb97a,null))['then'](function(_0x48703e){if(_0x48703e){_0x28107f[_0x80a9('0x49')][_0x80a9('0x50')]=_0x48703e['id'];_0x28107f[_0x80a9('0x49')][_0x80a9('0x51')]=integrations['getSubjects'](_0x28107f['body'][_0x80a9('0x52')],_0x28107f['body']['type']);_0x28107f[_0x80a9('0x49')]['Descriptions']=integrations[_0x80a9('0x53')](_0x28107f['body'][_0x80a9('0x52')],_0x28107f[_0x80a9('0x49')][_0x80a9('0x2d')]);return db[_0x80a9('0x4c')]['create'](_0x28107f['body'],{'include':[{'model':db[_0x80a9('0x54')],'as':_0x80a9('0x51')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1fb97a,null))['catch'](handleError(_0x1fb97a,null));};var md5=require(_0x80a9('0x55'));exports[_0x80a9('0x56')]=function(_0x17741f,_0x3fbf1f,_0x59771e){var _0x10335a=null;var _0x415673=null;var _0x186908=null;var _0x1919ee=null;var _0x464d4a='';return db['VtigerAccount'][_0x80a9('0x4b')]({'where':{'id':_0x17741f[_0x80a9('0x45')]['id']},'attributes':['id',_0x80a9('0x2f'),_0x80a9('0x57'),_0x80a9('0x58'),_0x80a9('0x59'),_0x80a9('0x5a'),'serverUrl','accessKey']})[_0x80a9('0x23')](handleEntityNotFound(_0x3fbf1f,null))['then'](function(_0x120308){if(_0x120308){_0x10335a=_0x120308[_0x80a9('0x57')];_0x415673=_0x120308[_0x80a9('0x5b')];_0x186908=_0x120308[_0x80a9('0x59')];_0x464d4a=_0x120308['remoteUri'];var _0x45d5c8=_0x464d4a['slice'](-0x1);if(_0x45d5c8==='/'){_0x464d4a=_0x464d4a['substring'](0x0,_0x464d4a[_0x80a9('0x5c')](_0x45d5c8));}_0x1919ee=util[_0x80a9('0x5d')](_0x80a9('0x5e'),_0x464d4a);var _0x2ac23f={'method':_0x80a9('0x5f'),'uri':_0x1919ee,'qs':{'operation':_0x80a9('0x60'),'username':_0x120308['username']},'json':!![]};return rp(_0x2ac23f);}})['then'](function(_0x2f6913){if(_0x2f6913['success']){var _0x1359c6={'method':_0x80a9('0x61'),'uri':_0x1919ee,'form':{'operation':_0x80a9('0x62'),'username':_0x10335a,'accessKey':md5(_0x2f6913['result'][_0x80a9('0x63')]+_0x415673)},'json':!![]};return rp(_0x1359c6);}})[_0x80a9('0x23')](function(_0x346bfc){if(_0x346bfc[_0x80a9('0x64')]){var _0x44e755={'method':_0x80a9('0x5f'),'uri':_0x1919ee,'qs':{'operation':_0x80a9('0x65'),'username':_0x10335a,'sessionName':_0x346bfc[_0x80a9('0x66')][_0x80a9('0x67')],'elementType':_0x186908},'json':!![]};return rp(_0x44e755);}})[_0x80a9('0x23')](function(_0x32b85){if(_0x32b85['success']){var _0xfacb70=[_0x80a9('0x68'),'reference','owner'];_[_0x80a9('0x69')](_0x32b85['result'][_0x80a9('0x36')],function(_0x2c8ec9){return _0xfacb70[_0x80a9('0x6a')](_0x2c8ec9[_0x80a9('0x2d')][_0x80a9('0x2f')]);});_[_0x80a9('0x69')](_0x32b85[_0x80a9('0x66')][_0x80a9('0x36')],function(_0x1beaba){return _0x1beaba['editable']===_0x80a9('0x6b');});return{'count':_0x32b85[_0x80a9('0x66')][_0x80a9('0x36')][_0x80a9('0x37')],'rows':_[_0x80a9('0x29')](_0x32b85[_0x80a9('0x66')][_0x80a9('0x36')],function(_0x239492){return{'id':_0x239492[_0x80a9('0x2f')],'name':_0x239492[_0x80a9('0x6c')],'custom':_[_0x80a9('0x6d')](_0x239492[_0x80a9('0x2f')],_0x80a9('0x6e'))?!![]:![],'options':_0x239492[_0x80a9('0x2d')]['name']===_0x80a9('0x6f')&&_0x239492[_0x80a9('0x2d')][_0x80a9('0x70')][_0x80a9('0x37')]>0x0?_[_0x80a9('0x29')](_0x239492[_0x80a9('0x2d')]['picklistValues'],function(_0x19ff8){return{'name':_0x19ff8[_0x80a9('0x6c')],'value':_0x19ff8[_0x80a9('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x3fbf1f,null))[_0x80a9('0x43')](function(_0x537548){console[_0x80a9('0x72')](_0x80a9('0x73')+_0x537548);var _0x5b5a68=_0x17741f[_0x80a9('0x30')][_0x80a9('0x74')]?0x1f4:_0x537548['statusCode']||0x1f4;logger[_0x80a9('0x26')](_0x80a9('0x75'),'getFields',_0x5b5a68,JSON[_0x80a9('0x76')](_0x537548));delete _0x537548[_0x80a9('0x2f')];if(_0x5b5a68===0x191){_0x5b5a68=0x190;}_0x3fbf1f[_0x80a9('0x18')](_0x5b5a68)[_0x80a9('0x28')](_0x17741f['query'][_0x80a9('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x537548[_0x80a9('0x77')]}:_0x537548);});}; \ No newline at end of file +var _0x98f7=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','update','findOne','VtigerConfiguration','hasOwnProperty','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','getFields','username','moduleName','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','result','autogenerated','owner','remove','includes','false','label','startsWith','picklist','picklistValues','value','vTiger\x20error:\x20','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2de905,_0x198ee8){var _0x251152=function(_0x5d7ad3){while(--_0x5d7ad3){_0x2de905['push'](_0x2de905['shift']());}};_0x251152(++_0x198ee8);}(_0x98f7,0x1a8));var _0x798f=function(_0x35c46b,_0xb32428){_0x35c46b=_0x35c46b-0x0;var _0x49ac37=_0x98f7[_0x35c46b];return _0x49ac37;};'use strict';var emlformat=require(_0x798f('0x0'));var rimraf=require(_0x798f('0x1'));var zipdir=require(_0x798f('0x2'));var jsonpatch=require(_0x798f('0x3'));var rp=require(_0x798f('0x4'));var moment=require(_0x798f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x798f('0x6'));var path=require(_0x798f('0x7'));var sox=require(_0x798f('0x8'));var csv=require(_0x798f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x798f('0xa'));var squel=require(_0x798f('0xb'));var crypto=require(_0x798f('0xc'));var jsforce=require(_0x798f('0xd'));var deskjs=require(_0x798f('0xe'));var toCsv=require(_0x798f('0x9'));var querystring=require(_0x798f('0xf'));var Papa=require(_0x798f('0x10'));var Redis=require(_0x798f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x798f('0x12'));var as=require(_0x798f('0x13'));var hardwareService=require(_0x798f('0x14'));var logger=require(_0x798f('0x15'))(_0x798f('0x16'));var utils=require(_0x798f('0x17'));var config=require(_0x798f('0x18'));var licenseUtil=require(_0x798f('0x19'));var db=require(_0x798f('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x13ec06,_0x5b69f4){_0x5b69f4=_0x5b69f4||0xcc;return function(_0x261854){if(_0x261854){return _0x13ec06[_0x798f('0x1b')](_0x5b69f4);}return _0x13ec06[_0x798f('0x1c')](_0x5b69f4)[_0x798f('0x1d')]();};}function respondWithResult(_0x33806f,_0x2582e0){_0x2582e0=_0x2582e0||0xc8;return function(_0x59e08b){if(_0x59e08b){return _0x33806f['status'](_0x2582e0)[_0x798f('0x1e')](_0x59e08b);}};}function respondWithFilteredResult(_0x2b134a,_0x44dd3b){return function(_0x38de59){if(_0x38de59){var _0x59b94f=typeof _0x44dd3b[_0x798f('0x1f')]===_0x798f('0x20')&&typeof _0x44dd3b[_0x798f('0x21')]===_0x798f('0x20');var _0x3b5f98=_0x38de59[_0x798f('0x22')];var _0x2c6cef=_0x59b94f?0x0:_0x44dd3b['offset'];var _0x2bf2f2=_0x59b94f?_0x38de59['count']:_0x44dd3b[_0x798f('0x1f')]+_0x44dd3b['limit'];var _0x990413;if(_0x2bf2f2>=_0x3b5f98){_0x2bf2f2=_0x3b5f98;_0x990413=0xc8;}else{_0x990413=0xce;}_0x2b134a[_0x798f('0x1c')](_0x990413);return _0x2b134a[_0x798f('0x23')]('Content-Range',_0x2c6cef+'-'+_0x2bf2f2+'/'+_0x3b5f98)[_0x798f('0x1e')](_0x38de59);}return null;};}function patchUpdates(_0x2d0a41){return function(_0x228080){try{jsonpatch[_0x798f('0x24')](_0x228080,_0x2d0a41,!![]);}catch(_0x24a4bf){return BPromise[_0x798f('0x25')](_0x24a4bf);}return _0x228080[_0x798f('0x26')]();};}function saveUpdates(_0x10bf8f,_0x4222ae){return function(_0x22fbef){if(_0x22fbef){return _0x22fbef['update'](_0x10bf8f)['then'](function(_0x18fbd8){return _0x18fbd8;});}return null;};}function removeEntity(_0x51484f,_0x42d765){return function(_0x2dbd38){if(_0x2dbd38){return _0x2dbd38[_0x798f('0x27')]()[_0x798f('0x28')](function(){_0x51484f[_0x798f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cc613,_0x496169){return function(_0x9ac20){if(!_0x9ac20){_0x4cc613[_0x798f('0x1b')](0x194);}return _0x9ac20;};}function handleError(_0x1258dd,_0x18a05f){_0x18a05f=_0x18a05f||0x1f4;return function(_0x4b91b0){logger[_0x798f('0x29')](_0x4b91b0[_0x798f('0x2a')]);if(_0x4b91b0[_0x798f('0x2b')]){delete _0x4b91b0[_0x798f('0x2b')];}_0x1258dd[_0x798f('0x1c')](_0x18a05f)[_0x798f('0x2c')](_0x4b91b0);};}exports[_0x798f('0x2d')]=function(_0x5e8bec,_0x3673e9){var _0x33d9c0={},_0x25643c={},_0x5c6338={'count':0x0,'rows':[]};var _0x3367ae=_[_0x798f('0x2e')](db[_0x798f('0x2f')][_0x798f('0x30')],function(_0xef86d3){return{'name':_0xef86d3[_0x798f('0x31')],'type':_0xef86d3[_0x798f('0x32')][_0x798f('0x33')]};});_0x25643c[_0x798f('0x34')]=_[_0x798f('0x2e')](_0x3367ae,'name');_0x25643c[_0x798f('0x35')]=_[_0x798f('0x36')](_0x5e8bec[_0x798f('0x35')]);_0x25643c[_0x798f('0x37')]=_[_0x798f('0x38')](_0x25643c[_0x798f('0x34')],_0x25643c['query']);_0x33d9c0[_0x798f('0x39')]=_['intersection'](_0x25643c[_0x798f('0x34')],qs[_0x798f('0x3a')](_0x5e8bec[_0x798f('0x35')][_0x798f('0x3a')]));_0x33d9c0[_0x798f('0x39')]=_0x33d9c0[_0x798f('0x39')][_0x798f('0x3b')]?_0x33d9c0[_0x798f('0x39')]:_0x25643c['model'];if(!_0x5e8bec[_0x798f('0x35')]['hasOwnProperty'](_0x798f('0x3c'))){_0x33d9c0[_0x798f('0x21')]=qs[_0x798f('0x21')](_0x5e8bec['query'][_0x798f('0x21')]);_0x33d9c0[_0x798f('0x1f')]=qs[_0x798f('0x1f')](_0x5e8bec[_0x798f('0x35')][_0x798f('0x1f')]);}_0x33d9c0[_0x798f('0x3d')]=qs['sort'](_0x5e8bec[_0x798f('0x35')][_0x798f('0x3e')]);_0x33d9c0['where']=qs[_0x798f('0x37')](_[_0x798f('0x3f')](_0x5e8bec[_0x798f('0x35')],_0x25643c[_0x798f('0x37')]),_0x3367ae);if(_0x5e8bec[_0x798f('0x35')][_0x798f('0x40')]){_0x33d9c0[_0x798f('0x41')]=_[_0x798f('0x42')](_0x33d9c0[_0x798f('0x41')],{'$or':_[_0x798f('0x2e')](_0x3367ae,function(_0x2ddbf5){if(_0x2ddbf5[_0x798f('0x32')]!==_0x798f('0x43')){var _0x41e5e4={};_0x41e5e4[_0x2ddbf5[_0x798f('0x2b')]]={'$like':'%'+_0x5e8bec[_0x798f('0x35')][_0x798f('0x40')]+'%'};return _0x41e5e4;}})});}_0x33d9c0=_[_0x798f('0x42')]({},_0x33d9c0,_0x5e8bec[_0x798f('0x44')]);var _0x3b09d1={'where':_0x33d9c0['where']};return db[_0x798f('0x2f')][_0x798f('0x22')](_0x3b09d1)[_0x798f('0x28')](function(_0x4b4e76){_0x5c6338[_0x798f('0x22')]=_0x4b4e76;if(_0x5e8bec[_0x798f('0x35')][_0x798f('0x45')]){_0x33d9c0['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x798f('0x46')](_0x33d9c0);})[_0x798f('0x28')](function(_0x40930d){_0x5c6338[_0x798f('0x47')]=_0x40930d;return _0x5c6338;})['then'](respondWithFilteredResult(_0x3673e9,_0x33d9c0))['catch'](handleError(_0x3673e9,null));};exports[_0x798f('0x48')]=function(_0x199d83,_0x3b1208){var _0x5e63fc={'raw':![],'where':{'id':_0x199d83[_0x798f('0x49')]['id']}},_0x13d40a={};_0x13d40a['model']=_[_0x798f('0x36')](db[_0x798f('0x2f')][_0x798f('0x30')]);_0x13d40a[_0x798f('0x35')]=_['keys'](_0x199d83[_0x798f('0x35')]);_0x13d40a[_0x798f('0x37')]=_[_0x798f('0x38')](_0x13d40a['model'],_0x13d40a[_0x798f('0x35')]);_0x5e63fc[_0x798f('0x39')]=_['intersection'](_0x13d40a[_0x798f('0x34')],qs[_0x798f('0x3a')](_0x199d83[_0x798f('0x35')][_0x798f('0x3a')]));_0x5e63fc[_0x798f('0x39')]=_0x5e63fc[_0x798f('0x39')][_0x798f('0x3b')]?_0x5e63fc[_0x798f('0x39')]:_0x13d40a['model'];if(_0x199d83[_0x798f('0x35')]['includeAll']){_0x5e63fc[_0x798f('0x4a')]=[{'all':!![]}];}_0x5e63fc=_['merge']({},_0x5e63fc,_0x199d83[_0x798f('0x44')]);return db[_0x798f('0x2f')][_0x798f('0x4b')](_0x5e63fc)[_0x798f('0x28')](handleEntityNotFound(_0x3b1208,null))['then'](respondWithResult(_0x3b1208,null))[_0x798f('0x4c')](handleError(_0x3b1208,null));};exports[_0x798f('0x4d')]=function(_0x557cb8,_0x4ff2e5){return db[_0x798f('0x2f')]['create'](_0x557cb8[_0x798f('0x4e')],{})[_0x798f('0x28')](respondWithResult(_0x4ff2e5,0xc9))[_0x798f('0x4c')](handleError(_0x4ff2e5,null));};exports[_0x798f('0x4f')]=function(_0x2e84da,_0x572f65){if(_0x2e84da['body']['id']){delete _0x2e84da[_0x798f('0x4e')]['id'];}return db[_0x798f('0x2f')][_0x798f('0x4b')]({'where':{'id':_0x2e84da[_0x798f('0x49')]['id']}})[_0x798f('0x28')](handleEntityNotFound(_0x572f65,null))[_0x798f('0x28')](saveUpdates(_0x2e84da[_0x798f('0x4e')],null))[_0x798f('0x28')](respondWithResult(_0x572f65,null))[_0x798f('0x4c')](handleError(_0x572f65,null));};exports[_0x798f('0x27')]=function(_0x222cf8,_0xe41bdb){return db['VtigerAccount'][_0x798f('0x4b')]({'where':{'id':_0x222cf8[_0x798f('0x49')]['id']}})['then'](handleEntityNotFound(_0xe41bdb,null))[_0x798f('0x28')](removeEntity(_0xe41bdb,null))[_0x798f('0x4c')](handleError(_0xe41bdb,null));};exports['getConfigurations']=function(_0x3ae00a,_0x38a06c,_0x50fd46){var _0x3f738c={};var _0x5b9361={};var _0x44925f;var _0x17baff;return db[_0x798f('0x2f')][_0x798f('0x50')]({'where':{'id':_0x3ae00a[_0x798f('0x49')]['id']}})[_0x798f('0x28')](handleEntityNotFound(_0x38a06c,null))[_0x798f('0x28')](function(_0x45a561){if(_0x45a561){_0x44925f=_0x45a561;_0x5b9361[_0x798f('0x34')]=_[_0x798f('0x36')](db[_0x798f('0x51')][_0x798f('0x30')]);_0x5b9361['query']=_[_0x798f('0x36')](_0x3ae00a[_0x798f('0x35')]);_0x5b9361[_0x798f('0x37')]=_[_0x798f('0x38')](_0x5b9361[_0x798f('0x34')],_0x5b9361[_0x798f('0x35')]);_0x3f738c['attributes']=_['intersection'](_0x5b9361[_0x798f('0x34')],qs['fields'](_0x3ae00a[_0x798f('0x35')][_0x798f('0x3a')]));_0x3f738c[_0x798f('0x39')]=_0x3f738c[_0x798f('0x39')][_0x798f('0x3b')]?_0x3f738c[_0x798f('0x39')]:_0x5b9361[_0x798f('0x34')];_0x3f738c['order']=qs[_0x798f('0x3e')](_0x3ae00a[_0x798f('0x35')][_0x798f('0x3e')]);_0x3f738c[_0x798f('0x41')]=qs[_0x798f('0x37')](_[_0x798f('0x3f')](_0x3ae00a[_0x798f('0x35')],_0x5b9361[_0x798f('0x37')]));if(_0x3ae00a[_0x798f('0x35')]['filter']){_0x3f738c['where']=_[_0x798f('0x42')](_0x3f738c['where'],{'$or':_[_0x798f('0x2e')](_0x3f738c[_0x798f('0x39')],function(_0x13b619){var _0x593370={};_0x593370[_0x13b619]={'$like':'%'+_0x3ae00a['query'][_0x798f('0x40')]+'%'};return _0x593370;})});}_0x3f738c=_[_0x798f('0x42')]({},_0x3f738c,_0x3ae00a['options']);return _0x44925f['getConfigurations'](_0x3f738c);}})[_0x798f('0x28')](function(_0x2278d1){if(_0x2278d1){_0x17baff=_0x2278d1['length'];if(!_0x3ae00a[_0x798f('0x35')][_0x798f('0x52')](_0x798f('0x3c'))){_0x3f738c['limit']=qs['limit'](_0x3ae00a[_0x798f('0x35')]['limit']);_0x3f738c[_0x798f('0x1f')]=qs[_0x798f('0x1f')](_0x3ae00a[_0x798f('0x35')][_0x798f('0x1f')]);}return _0x44925f[_0x798f('0x53')](_0x3f738c);}})['then'](function(_0x4073a6){if(_0x4073a6){return _0x4073a6?{'count':_0x17baff,'rows':_0x4073a6}:null;}})[_0x798f('0x28')](respondWithResult(_0x38a06c,null))[_0x798f('0x4c')](handleError(_0x38a06c,null));};exports[_0x798f('0x54')]=function(_0x15d7d5,_0x3f0343,_0x22b734){if(_0x15d7d5[_0x798f('0x4e')]['id']){delete _0x15d7d5[_0x798f('0x4e')]['id'];}return db[_0x798f('0x2f')]['findOne']({'where':{'id':_0x15d7d5[_0x798f('0x49')]['id']}})[_0x798f('0x28')](handleEntityNotFound(_0x3f0343,null))[_0x798f('0x28')](function(_0x3907b2){if(_0x3907b2){_0x15d7d5[_0x798f('0x4e')][_0x798f('0x55')]=_0x3907b2['id'];_0x15d7d5[_0x798f('0x4e')]['Subjects']=integrations[_0x798f('0x56')](_0x15d7d5['body'][_0x798f('0x57')],_0x15d7d5[_0x798f('0x4e')][_0x798f('0x32')]);_0x15d7d5[_0x798f('0x4e')][_0x798f('0x58')]=integrations[_0x798f('0x59')](_0x15d7d5[_0x798f('0x4e')][_0x798f('0x57')],_0x15d7d5[_0x798f('0x4e')]['type']);return db['VtigerConfiguration'][_0x798f('0x4d')](_0x15d7d5[_0x798f('0x4e')],{'include':[{'model':db[_0x798f('0x5a')],'as':_0x798f('0x5b')},{'model':db[_0x798f('0x5a')],'as':_0x798f('0x58')}]});}return null;})[_0x798f('0x28')](respondWithResult(_0x3f0343,null))[_0x798f('0x4c')](handleError(_0x3f0343,null));};var md5=require('md5');exports[_0x798f('0x5c')]=function(_0x52c3a8,_0x57b4f9,_0x735d4a){var _0x38fb31=null;var _0x253ac4=null;var _0x2e2939=null;var _0x35fc82=null;var _0x4327d7='';return db['VtigerAccount'][_0x798f('0x50')]({'where':{'id':_0x52c3a8[_0x798f('0x49')]['id']},'attributes':['id',_0x798f('0x2b'),_0x798f('0x5d'),'description',_0x798f('0x5e'),'remoteUri',_0x798f('0x5f'),_0x798f('0x60')]})[_0x798f('0x28')](handleEntityNotFound(_0x57b4f9,null))[_0x798f('0x28')](function(_0x5645fd){if(_0x5645fd){_0x38fb31=_0x5645fd[_0x798f('0x5d')];_0x253ac4=_0x5645fd[_0x798f('0x60')];_0x2e2939=_0x5645fd['moduleName'];_0x4327d7=_0x5645fd['remoteUri'];var _0x18092a=_0x4327d7[_0x798f('0x61')](-0x1);if(_0x18092a==='/'){_0x4327d7=_0x4327d7[_0x798f('0x62')](0x0,_0x4327d7['lastIndexOf'](_0x18092a));}_0x35fc82=util[_0x798f('0x63')](_0x798f('0x64'),_0x4327d7);var _0x499edc={'method':_0x798f('0x65'),'uri':_0x35fc82,'qs':{'operation':_0x798f('0x66'),'username':_0x5645fd['username']},'json':!![]};return rp(_0x499edc);}})[_0x798f('0x28')](function(_0x449b18){if(_0x449b18[_0x798f('0x67')]){var _0x1bc378={'method':_0x798f('0x68'),'uri':_0x35fc82,'form':{'operation':_0x798f('0x69'),'username':_0x38fb31,'accessKey':md5(_0x449b18['result'][_0x798f('0x6a')]+_0x253ac4)},'json':!![]};return rp(_0x1bc378);}})['then'](function(_0x265f3b){if(_0x265f3b[_0x798f('0x67')]){var _0x4a0c8b={'method':_0x798f('0x65'),'uri':_0x35fc82,'qs':{'operation':_0x798f('0x6b'),'username':_0x38fb31,'sessionName':_0x265f3b[_0x798f('0x6c')]['sessionName'],'elementType':_0x2e2939},'json':!![]};return rp(_0x4a0c8b);}})[_0x798f('0x28')](function(_0x50633b){if(_0x50633b[_0x798f('0x67')]){var _0x1ebd31=[_0x798f('0x6d'),'reference',_0x798f('0x6e')];_[_0x798f('0x6f')](_0x50633b[_0x798f('0x6c')][_0x798f('0x3a')],function(_0x12108b){return _0x1ebd31[_0x798f('0x70')](_0x12108b['type'][_0x798f('0x2b')]);});_[_0x798f('0x6f')](_0x50633b[_0x798f('0x6c')][_0x798f('0x3a')],function(_0x2164a0){return _0x2164a0['editable']===_0x798f('0x71');});return{'count':_0x50633b[_0x798f('0x6c')][_0x798f('0x3a')]['length'],'rows':_[_0x798f('0x2e')](_0x50633b[_0x798f('0x6c')][_0x798f('0x3a')],function(_0x485748){return{'id':_0x485748['name'],'name':_0x485748[_0x798f('0x72')],'custom':_[_0x798f('0x73')](_0x485748[_0x798f('0x2b')],'cf_')?!![]:![],'options':_0x485748[_0x798f('0x32')][_0x798f('0x2b')]===_0x798f('0x74')&&_0x485748['type'][_0x798f('0x75')][_0x798f('0x3b')]>0x0?_[_0x798f('0x2e')](_0x485748[_0x798f('0x32')]['picklistValues'],function(_0xc418c9){return{'name':_0xc418c9[_0x798f('0x72')],'value':_0xc418c9[_0x798f('0x76')]};}):[]};})};}})['then'](respondWithResult(_0x57b4f9,null))[_0x798f('0x4c')](function(_0x53ac03){console['log'](_0x798f('0x77')+_0x53ac03);var _0x23110c=_0x52c3a8[_0x798f('0x35')]['test']?0x1f4:_0x53ac03['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x23110c,JSON[_0x798f('0x78')](_0x53ac03));delete _0x53ac03[_0x798f('0x2b')];if(_0x23110c===0x191){_0x23110c=0x190;}_0x57b4f9['status'](_0x23110c)[_0x798f('0x2c')](_0x52c3a8[_0x798f('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x53ac03['statusCode']}:_0x53ac03);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 0f5ce6a..15d86e8 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 _0xeaa5=['path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeaa5,0xf1));var _0x5eaa=function(_0x43c8bc,_0x5f226e){_0x43c8bc=_0x43c8bc-0x0;var _0x3d51f7=_0xeaa5[_0x43c8bc];return _0x3d51f7;};'use strict';var _=require(_0x5eaa('0x0'));var util=require(_0x5eaa('0x1'));var logger=require(_0x5eaa('0x2'))(_0x5eaa('0x3'));var moment=require(_0x5eaa('0x4'));var BPromise=require('bluebird');var rp=require(_0x5eaa('0x5'));var fs=require('fs');var path=require(_0x5eaa('0x6'));var rimraf=require(_0x5eaa('0x7'));var config=require(_0x5eaa('0x8'));var attributes=require(_0x5eaa('0x9'));var integrations=require(_0x5eaa('0xa'));module['exports']=function(_0x338b97,_0x1b0627){return _0x338b97[_0x5eaa('0xb')]('VtigerAccount',attributes,{'tableName':_0x5eaa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4ae=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x3569ae,_0x3c6f42){var _0x5eb875=function(_0x204a24){while(--_0x204a24){_0x3569ae['push'](_0x3569ae['shift']());}};_0x5eb875(++_0x3c6f42);}(_0xd4ae,0x181));var _0xed4a=function(_0x2a9153,_0x44fd73){_0x2a9153=_0x2a9153-0x0;var _0x2f6615=_0xd4ae[_0x2a9153];return _0x2f6615;};'use strict';var _=require(_0xed4a('0x0'));var util=require(_0xed4a('0x1'));var logger=require(_0xed4a('0x2'))(_0xed4a('0x3'));var moment=require(_0xed4a('0x4'));var BPromise=require(_0xed4a('0x5'));var rp=require(_0xed4a('0x6'));var fs=require('fs');var path=require(_0xed4a('0x7'));var rimraf=require(_0xed4a('0x8'));var config=require(_0xed4a('0x9'));var attributes=require(_0xed4a('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xed4a('0xb')]=function(_0x502e4b,_0x4bc09c){return _0x502e4b[_0xed4a('0xc')](_0xed4a('0xd'),attributes,{'tableName':_0xed4a('0xe'),'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 247755b..627d9f3 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 _0xd4f4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x53fe9f,_0x3d80a4){var _0x3040e5=function(_0x38e2c5){while(--_0x38e2c5){_0x53fe9f['push'](_0x53fe9f['shift']());}};_0x3040e5(++_0x3d80a4);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x33ae6e,_0x2b71b4){_0x33ae6e=_0x33ae6e-0x0;var _0x195abf=_0xd4f4[_0x33ae6e];return _0x195abf;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});}exports[_0x4d4f('0x17')]=function(_0x51dcf1){var _0x5dbbeb=this;return new Promise(function(_0x519501,_0x5a58af){return db['VtigerAccount'][_0x4d4f('0x18')]({'raw':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1b')]||null:null,'attributes':_0x51dcf1['options']?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1c')]||null:null,'limit':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1d')]||null:null,'include':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1e')]?_['map'](_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1e')],function(_0x2d2fb3){return{'model':db[_0x2d2fb3[_0x4d4f('0x1f')]],'as':_0x2d2fb3['as'],'attributes':_0x2d2fb3[_0x4d4f('0x1c')],'include':_0x2d2fb3['include']?_[_0x4d4f('0x20')](_0x2d2fb3[_0x4d4f('0x1e')],function(_0x1cf365){return{'model':db[_0x1cf365[_0x4d4f('0x1f')]],'as':_0x1cf365['as'],'attributes':_0x1cf365['attributes'],'include':_0x1cf365['include']?_[_0x4d4f('0x20')](_0x1cf365[_0x4d4f('0x1e')],function(_0xa2492c){return{'model':db[_0xa2492c[_0x4d4f('0x1f')]],'as':_0xa2492c['as'],'attributes':_0xa2492c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x380ebf){logger[_0x4d4f('0xd')](_0x4d4f('0x17'),_0x51dcf1);logger['debug'](_0x4d4f('0x17'),_0x51dcf1,JSON['stringify'](_0x380ebf));_0x519501(_0x380ebf);})[_0x4d4f('0x16')](function(_0x333a40){logger['error'](_0x4d4f('0x17'),_0x333a40[_0x4d4f('0x15')],_0x51dcf1);_0x5a58af(_0x5dbbeb[_0x4d4f('0x13')](0x1f4,_0x333a40[_0x4d4f('0x15')]));});});};exports[_0x4d4f('0x21')]=function(_0x43a704){var _0x4c69cb=this;return new Promise(function(_0x36eede,_0x4578b6){return db[_0x4d4f('0x22')][_0x4d4f('0x23')]({'raw':_0x43a704[_0x4d4f('0x19')]?_0x43a704['options'][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')]['where']||null:null,'attributes':_0x43a704['options']?_0x43a704['options'][_0x4d4f('0x1c')]||null:null,'include':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')][_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x43a704['options'][_0x4d4f('0x1e')],function(_0x1ab7c4){return{'model':db[_0x1ab7c4[_0x4d4f('0x1f')]],'as':_0x1ab7c4['as'],'attributes':_0x1ab7c4['attributes'],'include':_0x1ab7c4[_0x4d4f('0x1e')]?_['map'](_0x1ab7c4[_0x4d4f('0x1e')],function(_0x2f18df){return{'model':db[_0x2f18df[_0x4d4f('0x1f')]],'as':_0x2f18df['as'],'attributes':_0x2f18df[_0x4d4f('0x1c')],'include':_0x2f18df[_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x2f18df[_0x4d4f('0x1e')],function(_0x461900){return{'model':db[_0x461900['model']],'as':_0x461900['as'],'attributes':_0x461900['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x559441){logger['info'](_0x4d4f('0x21'),_0x43a704);logger[_0x4d4f('0x10')](_0x4d4f('0x21'),_0x43a704,JSON[_0x4d4f('0x12')](_0x559441));_0x36eede(_0x559441);})[_0x4d4f('0x16')](function(_0x56eed8){logger[_0x4d4f('0x13')](_0x4d4f('0x21'),_0x56eed8['message'],_0x43a704);_0x4578b6(_0x4c69cb[_0x4d4f('0x13')](0x1f4,_0x56eed8[_0x4d4f('0x15')]));});});}; \ No newline at end of file +var _0xee5b=['map','model','attributes','catch','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','include'];(function(_0xfc2644,_0x4a3b13){var _0x4873b7=function(_0x4a99ac){while(--_0x4a99ac){_0xfc2644['push'](_0xfc2644['shift']());}};_0x4873b7(++_0x4a3b13);}(_0xee5b,0x1f4));var _0xbee5=function(_0x47b846,_0x3b00e5){_0x47b846=_0x47b846-0x0;var _0x53c201=_0xee5b[_0x47b846];return _0x53c201;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')]({'raw':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')]['attributes']||null:null,'limit':_0x538460['options']?_0x538460[_0xbee5('0x18')]['limit']||null:null,'include':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')],function(_0x359ccf){return{'model':db[_0x359ccf[_0xbee5('0x1d')]],'as':_0x359ccf['as'],'attributes':_0x359ccf[_0xbee5('0x1e')],'include':_0x359ccf['include']?_['map'](_0x359ccf['include'],function(_0x519473){return{'model':db[_0x519473['model']],'as':_0x519473['as'],'attributes':_0x519473[_0xbee5('0x1e')],'include':_0x519473[_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x519473[_0xbee5('0x1b')],function(_0x169042){return{'model':db[_0x169042[_0xbee5('0x1d')]],'as':_0x169042['as'],'attributes':_0x169042[_0xbee5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b50f){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger[_0xbee5('0xd')](_0xbee5('0x15'),_0x538460,JSON['stringify'](_0x36b50f));_0x3c3f4e(_0x36b50f);})[_0xbee5('0x1f')](function(_0x15ffb1){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x15ffb1[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x15ffb1[_0xbee5('0x13')]));});});};exports[_0xbee5('0x20')]=function(_0x2ccb91){var _0x59c2e4=this;return new Promise(function(_0x22df5f,_0x5b10a6){return db[_0xbee5('0x16')]['find']({'raw':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91['options'][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x2ccb91['options']?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')]['attributes']||null:null,'include':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x2ccb91['options'][_0xbee5('0x1b')],function(_0x28f8e3){return{'model':db[_0x28f8e3[_0xbee5('0x1d')]],'as':_0x28f8e3['as'],'attributes':_0x28f8e3[_0xbee5('0x1e')],'include':_0x28f8e3['include']?_[_0xbee5('0x1c')](_0x28f8e3[_0xbee5('0x1b')],function(_0x3e854){return{'model':db[_0x3e854[_0xbee5('0x1d')]],'as':_0x3e854['as'],'attributes':_0x3e854['attributes'],'include':_0x3e854[_0xbee5('0x1b')]?_['map'](_0x3e854[_0xbee5('0x1b')],function(_0x58a2e3){return{'model':db[_0x58a2e3['model']],'as':_0x58a2e3['as'],'attributes':_0x58a2e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xbee5('0xa')](function(_0x315523){logger[_0xbee5('0xb')](_0xbee5('0x20'),_0x2ccb91);logger[_0xbee5('0xd')](_0xbee5('0x20'),_0x2ccb91,JSON[_0xbee5('0x10')](_0x315523));_0x22df5f(_0x315523);})[_0xbee5('0x1f')](function(_0x58452a){logger[_0xbee5('0x11')]('ShowVtigerAccount',_0x58452a[_0xbee5('0x13')],_0x2ccb91);_0x5b10a6(_0x59c2e4[_0xbee5('0x11')](0x1f4,_0x58452a[_0xbee5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 2769acb..65ae6ec 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 _0x242f=['exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy'];(function(_0x28a680,_0x2a7d2a){var _0xbd41c2=function(_0x387ca6){while(--_0x387ca6){_0x28a680['push'](_0x28a680['shift']());}};_0xbd41c2(++_0x2a7d2a);}(_0x242f,0x12c));var _0xf242=function(_0x2b372c,_0x1ecdfe){_0x2b372c=_0x2b372c-0x0;var _0x519cef=_0x242f[_0x2b372c];return _0x519cef;};'use strict';var multer=require(_0xf242('0x0'));var util=require(_0xf242('0x1'));var path=require(_0xf242('0x2'));var timeout=require(_0xf242('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf242('0x4'));var config=require(_0xf242('0x5'));var controller=require(_0xf242('0x6'));router['get']('/',auth[_0xf242('0x7')](),controller['index']);router['get'](_0xf242('0x8'),auth[_0xf242('0x7')](),controller[_0xf242('0x9')]);router[_0xf242('0xa')](_0xf242('0xb'),auth[_0xf242('0x7')](),controller[_0xf242('0xc')]);router['get'](_0xf242('0xd'),auth[_0xf242('0x7')](),controller[_0xf242('0xe')]);router[_0xf242('0xa')]('/:id/descriptions',auth[_0xf242('0x7')](),controller[_0xf242('0xf')]);router[_0xf242('0x10')]('/',auth[_0xf242('0x7')](),controller[_0xf242('0x11')]);router[_0xf242('0x12')](_0xf242('0x8'),auth[_0xf242('0x7')](),controller[_0xf242('0x13')]);router[_0xf242('0x14')](_0xf242('0x8'),auth[_0xf242('0x7')](),controller[_0xf242('0x15')]);module[_0xf242('0x16')]=router; \ No newline at end of file +var _0x2a8f=['getDescriptions','post','create','put','update','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects'];(function(_0x16e243,_0x356355){var _0x506a2a=function(_0x5d4fe7){while(--_0x5d4fe7){_0x16e243['push'](_0x16e243['shift']());}};_0x506a2a(++_0x356355);}(_0x2a8f,0xe4));var _0xf2a8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2a8f[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf2a8('0x0')]();var fs_extra=require(_0xf2a8('0x1'));var auth=require(_0xf2a8('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf2a8('0x3'));var controller=require(_0xf2a8('0x4'));router[_0xf2a8('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf2a8('0x6'),auth['isAuthenticated'](),controller[_0xf2a8('0x7')]);router[_0xf2a8('0x5')](_0xf2a8('0x8'),auth[_0xf2a8('0x9')](),controller['getFields']);router['get'](_0xf2a8('0xa'),auth[_0xf2a8('0x9')](),controller[_0xf2a8('0xb')]);router[_0xf2a8('0x5')]('/:id/descriptions',auth[_0xf2a8('0x9')](),controller[_0xf2a8('0xc')]);router[_0xf2a8('0xd')]('/',auth[_0xf2a8('0x9')](),controller[_0xf2a8('0xe')]);router[_0xf2a8('0xf')](_0xf2a8('0x6'),auth[_0xf2a8('0x9')](),controller[_0xf2a8('0x10')]);router[_0xf2a8('0x11')](_0xf2a8('0x6'),auth[_0xf2a8('0x9')](),controller[_0xf2a8('0x12')]);module[_0xf2a8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4e50499..345b397 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 _0x2a53=['sequelize','STRING'];(function(_0x410c92,_0x385255){var _0x6323cb=function(_0x43d881){while(--_0x43d881){_0x410c92['push'](_0x410c92['shift']());}};_0x6323cb(++_0x385255);}(_0x2a53,0x1ac));var _0x32a5=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x2a53[_0x525b28];return _0x180178;};'use strict';var Sequelize=require(_0x32a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x32a5('0x1')]}}; \ No newline at end of file +var _0xe8dd=['sequelize','exports','STRING'];(function(_0x563cc5,_0xaa4e13){var _0x5268ca=function(_0x5c595d){while(--_0x5c595d){_0x563cc5['push'](_0x563cc5['shift']());}};_0x5268ca(++_0xaa4e13);}(_0xe8dd,0x1e9));var _0xde8d=function(_0x1dd66d,_0x2d8ec5){_0x1dd66d=_0x1dd66d-0x0;var _0x468a54=_0xe8dd[_0x1dd66d];return _0x468a54;};'use strict';var Sequelize=require(_0xde8d('0x0'));module[_0xde8d('0x1')]={'name':{'type':Sequelize[_0xde8d('0x2')]},'description':{'type':Sequelize[_0xde8d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a63ea10..857f0fe 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 _0x885e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','body','find','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x4f7fc6,_0x554d2f){var _0x235170=function(_0x489da4){while(--_0x489da4){_0x4f7fc6['push'](_0x4f7fc6['shift']());}};_0x235170(++_0x554d2f);}(_0x885e,0xe4));var _0xe885=function(_0x299fcd,_0x5df90b){_0x299fcd=_0x299fcd-0x0;var _0x344bb5=_0x885e[_0x299fcd];return _0x344bb5;};'use strict';var emlformat=require(_0xe885('0x0'));var rimraf=require(_0xe885('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe885('0x2'));var rp=require(_0xe885('0x3'));var moment=require(_0xe885('0x4'));var BPromise=require(_0xe885('0x5'));var Mustache=require(_0xe885('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe885('0x7'));var csv=require(_0xe885('0x8'));var ejs=require(_0xe885('0x9'));var fs=require('fs');var fs_extra=require(_0xe885('0xa'));var _=require('lodash');var squel=require(_0xe885('0xb'));var crypto=require('crypto');var jsforce=require(_0xe885('0xc'));var deskjs=require(_0xe885('0xd'));var toCsv=require(_0xe885('0x8'));var querystring=require(_0xe885('0xe'));var Papa=require(_0xe885('0xf'));var Redis=require(_0xe885('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe885('0x11'));var as=require(_0xe885('0x12'));var hardwareService=require(_0xe885('0x13'));var logger=require(_0xe885('0x14'))(_0xe885('0x15'));var utils=require(_0xe885('0x16'));var config=require(_0xe885('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe885('0x18'))['db'];function respondWithStatusCode(_0x5a9697,_0x457e0f){_0x457e0f=_0x457e0f||0xcc;return function(_0x2fc609){if(_0x2fc609){return _0x5a9697[_0xe885('0x19')](_0x457e0f);}return _0x5a9697[_0xe885('0x1a')](_0x457e0f)[_0xe885('0x1b')]();};}function respondWithResult(_0x5c7442,_0x51c10d){_0x51c10d=_0x51c10d||0xc8;return function(_0x497c18){if(_0x497c18){return _0x5c7442[_0xe885('0x1a')](_0x51c10d)[_0xe885('0x1c')](_0x497c18);}};}function respondWithFilteredResult(_0x2bf6a9,_0x443399){return function(_0x494738){if(_0x494738){var _0x516a0f=typeof _0x443399[_0xe885('0x1d')]==='undefined'&&typeof _0x443399[_0xe885('0x1e')]===_0xe885('0x1f');var _0x4176a4=_0x494738[_0xe885('0x20')];var _0x25a002=_0x516a0f?0x0:_0x443399[_0xe885('0x1d')];var _0x4f5045=_0x516a0f?_0x494738[_0xe885('0x20')]:_0x443399[_0xe885('0x1d')]+_0x443399[_0xe885('0x1e')];var _0x4142a2;if(_0x4f5045>=_0x4176a4){_0x4f5045=_0x4176a4;_0x4142a2=0xc8;}else{_0x4142a2=0xce;}_0x2bf6a9[_0xe885('0x1a')](_0x4142a2);return _0x2bf6a9[_0xe885('0x21')](_0xe885('0x22'),_0x25a002+'-'+_0x4f5045+'/'+_0x4176a4)['json'](_0x494738);}return null;};}function patchUpdates(_0x159624){return function(_0x7ed861){try{jsonpatch[_0xe885('0x23')](_0x7ed861,_0x159624,!![]);}catch(_0x30cc04){return BPromise[_0xe885('0x24')](_0x30cc04);}return _0x7ed861[_0xe885('0x25')]();};}function saveUpdates(_0x221832,_0x4375ff){return function(_0x84a30f){if(_0x84a30f){return _0x84a30f[_0xe885('0x26')](_0x221832)[_0xe885('0x27')](function(_0x6d229a){return _0x6d229a;});}return null;};}function removeEntity(_0x581f03,_0x5b7f07){return function(_0x3e5868){if(_0x3e5868){return _0x3e5868[_0xe885('0x28')]()[_0xe885('0x27')](function(){_0x581f03[_0xe885('0x1a')](0xcc)[_0xe885('0x1b')]();});}};}function handleEntityNotFound(_0x50dd42,_0x249abc){return function(_0x1cac46){if(!_0x1cac46){_0x50dd42[_0xe885('0x19')](0x194);}return _0x1cac46;};}function handleError(_0x4b4049,_0x524190){_0x524190=_0x524190||0x1f4;return function(_0x2ba36e){logger[_0xe885('0x29')](_0x2ba36e[_0xe885('0x2a')]);if(_0x2ba36e[_0xe885('0x2b')]){delete _0x2ba36e[_0xe885('0x2b')];}_0x4b4049['status'](_0x524190)['send'](_0x2ba36e);};}exports[_0xe885('0x2c')]=function(_0xa4916f,_0x1701bd){var _0x4bbbcb={},_0x370a10={},_0x1d7c84={'count':0x0,'rows':[]};var _0x2b56a8=_[_0xe885('0x2d')](db[_0xe885('0x2e')][_0xe885('0x2f')],function(_0x1187c0){return{'name':_0x1187c0[_0xe885('0x30')],'type':_0x1187c0[_0xe885('0x31')]['key']};});_0x370a10['model']=_[_0xe885('0x2d')](_0x2b56a8,_0xe885('0x2b'));_0x370a10[_0xe885('0x32')]=_['keys'](_0xa4916f['query']);_0x370a10[_0xe885('0x33')]=_[_0xe885('0x34')](_0x370a10[_0xe885('0x35')],_0x370a10[_0xe885('0x32')]);_0x4bbbcb[_0xe885('0x36')]=_[_0xe885('0x34')](_0x370a10[_0xe885('0x35')],qs['fields'](_0xa4916f[_0xe885('0x32')]['fields']));_0x4bbbcb['attributes']=_0x4bbbcb['attributes'][_0xe885('0x37')]?_0x4bbbcb[_0xe885('0x36')]:_0x370a10[_0xe885('0x35')];if(!_0xa4916f['query'][_0xe885('0x38')](_0xe885('0x39'))){_0x4bbbcb[_0xe885('0x1e')]=qs[_0xe885('0x1e')](_0xa4916f[_0xe885('0x32')]['limit']);_0x4bbbcb['offset']=qs[_0xe885('0x1d')](_0xa4916f['query'][_0xe885('0x1d')]);}_0x4bbbcb[_0xe885('0x3a')]=qs[_0xe885('0x3b')](_0xa4916f[_0xe885('0x32')][_0xe885('0x3b')]);_0x4bbbcb['where']=qs[_0xe885('0x33')](_[_0xe885('0x3c')](_0xa4916f['query'],_0x370a10['filters']),_0x2b56a8);if(_0xa4916f['query'][_0xe885('0x3d')]){_0x4bbbcb[_0xe885('0x3e')]=_[_0xe885('0x3f')](_0x4bbbcb[_0xe885('0x3e')],{'$or':_['map'](_0x2b56a8,function(_0x116428){if(_0x116428[_0xe885('0x31')]!==_0xe885('0x40')){var _0x3ec257={};_0x3ec257[_0x116428['name']]={'$like':'%'+_0xa4916f['query']['filter']+'%'};return _0x3ec257;}})});}_0x4bbbcb=_[_0xe885('0x3f')]({},_0x4bbbcb,_0xa4916f[_0xe885('0x41')]);var _0x442ca4={'where':_0x4bbbcb[_0xe885('0x3e')]};return db[_0xe885('0x2e')][_0xe885('0x20')](_0x442ca4)[_0xe885('0x27')](function(_0x45870a){_0x1d7c84[_0xe885('0x20')]=_0x45870a;if(_0xa4916f[_0xe885('0x32')][_0xe885('0x42')]){_0x4bbbcb[_0xe885('0x43')]=[{'all':!![]}];}return db[_0xe885('0x2e')][_0xe885('0x44')](_0x4bbbcb);})[_0xe885('0x27')](function(_0x49f74c){_0x1d7c84[_0xe885('0x45')]=_0x49f74c;return _0x1d7c84;})['then'](respondWithFilteredResult(_0x1701bd,_0x4bbbcb))[_0xe885('0x46')](handleError(_0x1701bd,null));};exports[_0xe885('0x47')]=function(_0x5a710c,_0x51898d){var _0x7a2219={'raw':![],'where':{'id':_0x5a710c[_0xe885('0x48')]['id']}},_0x3339f4={};_0x3339f4[_0xe885('0x35')]=_[_0xe885('0x49')](db[_0xe885('0x2e')][_0xe885('0x2f')]);_0x3339f4[_0xe885('0x32')]=_[_0xe885('0x49')](_0x5a710c[_0xe885('0x32')]);_0x3339f4[_0xe885('0x33')]=_[_0xe885('0x34')](_0x3339f4[_0xe885('0x35')],_0x3339f4[_0xe885('0x32')]);_0x7a2219[_0xe885('0x36')]=_['intersection'](_0x3339f4[_0xe885('0x35')],qs['fields'](_0x5a710c[_0xe885('0x32')][_0xe885('0x4a')]));_0x7a2219['attributes']=_0x7a2219[_0xe885('0x36')][_0xe885('0x37')]?_0x7a2219[_0xe885('0x36')]:_0x3339f4['model'];if(_0x5a710c['query'][_0xe885('0x42')]){_0x7a2219[_0xe885('0x43')]=[{'all':!![]}];}_0x7a2219=_[_0xe885('0x3f')]({},_0x7a2219,_0x5a710c[_0xe885('0x41')]);return db[_0xe885('0x2e')]['find'](_0x7a2219)[_0xe885('0x27')](handleEntityNotFound(_0x51898d,null))[_0xe885('0x27')](respondWithResult(_0x51898d,null))[_0xe885('0x46')](handleError(_0x51898d,null));};exports['create']=function(_0x4dad7c,_0x51a285){return db[_0xe885('0x2e')]['create'](_0x4dad7c[_0xe885('0x4b')],{})[_0xe885('0x27')](respondWithResult(_0x51a285,0xc9))[_0xe885('0x46')](handleError(_0x51a285,null));};exports[_0xe885('0x26')]=function(_0x20fcee,_0x5d736c){if(_0x20fcee[_0xe885('0x4b')]['id']){delete _0x20fcee['body']['id'];}return db[_0xe885('0x2e')][_0xe885('0x4c')]({'where':{'id':_0x20fcee[_0xe885('0x48')]['id']}})[_0xe885('0x27')](handleEntityNotFound(_0x5d736c,null))[_0xe885('0x27')](saveUpdates(_0x20fcee[_0xe885('0x4b')],null))[_0xe885('0x27')](respondWithResult(_0x5d736c,null))[_0xe885('0x46')](handleError(_0x5d736c,null));};exports[_0xe885('0x28')]=function(_0x5f4531,_0x11ce41){return db[_0xe885('0x2e')]['find']({'where':{'id':_0x5f4531['params']['id']}})['then'](handleEntityNotFound(_0x11ce41,null))[_0xe885('0x27')](removeEntity(_0x11ce41,null))[_0xe885('0x46')](handleError(_0x11ce41,null));};exports[_0xe885('0x4d')]=function(_0x3b866b,_0x4194a8,_0x17fddc){var _0x46484c={};var _0x4cae2c={};var _0x4aaf05;var _0x1ab4e3;return db[_0xe885('0x2e')][_0xe885('0x4e')]({'where':{'id':_0x3b866b[_0xe885('0x48')]['id']}})['then'](handleEntityNotFound(_0x4194a8,null))[_0xe885('0x27')](function(_0x1dda6b){if(_0x1dda6b){_0x4aaf05=_0x1dda6b;_0x4cae2c[_0xe885('0x35')]=_[_0xe885('0x49')](db[_0xe885('0x4f')]['rawAttributes']);_0x4cae2c[_0xe885('0x32')]=_[_0xe885('0x49')](_0x3b866b[_0xe885('0x32')]);_0x4cae2c[_0xe885('0x33')]=_[_0xe885('0x34')](_0x4cae2c['model'],_0x4cae2c[_0xe885('0x32')]);_0x46484c['attributes']=_['intersection'](_0x4cae2c[_0xe885('0x35')],qs[_0xe885('0x4a')](_0x3b866b[_0xe885('0x32')][_0xe885('0x4a')]));_0x46484c['attributes']=_0x46484c[_0xe885('0x36')][_0xe885('0x37')]?_0x46484c[_0xe885('0x36')]:_0x4cae2c[_0xe885('0x35')];_0x46484c[_0xe885('0x3a')]=qs[_0xe885('0x3b')](_0x3b866b[_0xe885('0x32')][_0xe885('0x3b')]);_0x46484c[_0xe885('0x3e')]=qs[_0xe885('0x33')](_[_0xe885('0x3c')](_0x3b866b[_0xe885('0x32')],_0x4cae2c[_0xe885('0x33')]));if(_0x3b866b[_0xe885('0x32')][_0xe885('0x3d')]){_0x46484c[_0xe885('0x3e')]=_[_0xe885('0x3f')](_0x46484c[_0xe885('0x3e')],{'$or':_[_0xe885('0x2d')](_0x46484c['attributes'],function(_0xbc0bc7){var _0x478168={};_0x478168[_0xbc0bc7]={'$like':'%'+_0x3b866b[_0xe885('0x32')]['filter']+'%'};return _0x478168;})});}_0x46484c=_[_0xe885('0x3f')]({},_0x46484c,_0x3b866b[_0xe885('0x41')]);return _0x4aaf05[_0xe885('0x4d')](_0x46484c);}})[_0xe885('0x27')](function(_0xa7ce6e){if(_0xa7ce6e){_0x1ab4e3=_0xa7ce6e[_0xe885('0x37')];if(!_0x3b866b[_0xe885('0x32')][_0xe885('0x38')](_0xe885('0x39'))){_0x46484c['limit']=qs[_0xe885('0x1e')](_0x3b866b['query'][_0xe885('0x1e')]);_0x46484c[_0xe885('0x1d')]=qs['offset'](_0x3b866b[_0xe885('0x32')]['offset']);}return _0x4aaf05[_0xe885('0x4d')](_0x46484c);}})[_0xe885('0x27')](function(_0x3cb43d){if(_0x3cb43d){return _0x3cb43d?{'count':_0x1ab4e3,'rows':_0x3cb43d}:null;}})[_0xe885('0x27')](respondWithResult(_0x4194a8,null))[_0xe885('0x46')](handleError(_0x4194a8,null));};exports['getSubjects']=function(_0x34e600,_0xace6fd,_0x299143){var _0xc6adec={};var _0x250945={};var _0x401288;var _0xfc6c9f;return db['VtigerConfiguration'][_0xe885('0x4e')]({'where':{'id':_0x34e600['params']['id']}})['then'](handleEntityNotFound(_0xace6fd,null))[_0xe885('0x27')](function(_0x10424b){if(_0x10424b){_0x401288=_0x10424b;_0x250945[_0xe885('0x35')]=_[_0xe885('0x49')](db[_0xe885('0x4f')]['rawAttributes']);_0x250945[_0xe885('0x32')]=_['keys'](_0x34e600[_0xe885('0x32')]);_0x250945[_0xe885('0x33')]=_['intersection'](_0x250945[_0xe885('0x35')],_0x250945[_0xe885('0x32')]);_0xc6adec['attributes']=_[_0xe885('0x34')](_0x250945[_0xe885('0x35')],qs[_0xe885('0x4a')](_0x34e600['query']['fields']));_0xc6adec[_0xe885('0x36')]=_0xc6adec['attributes']['length']?_0xc6adec[_0xe885('0x36')]:_0x250945[_0xe885('0x35')];_0xc6adec[_0xe885('0x3a')]=qs[_0xe885('0x3b')](_0x34e600[_0xe885('0x32')][_0xe885('0x3b')]);_0xc6adec[_0xe885('0x3e')]=qs[_0xe885('0x33')](_[_0xe885('0x3c')](_0x34e600['query'],_0x250945[_0xe885('0x33')]));if(_0x34e600[_0xe885('0x32')][_0xe885('0x3d')]){_0xc6adec[_0xe885('0x3e')]=_[_0xe885('0x3f')](_0xc6adec[_0xe885('0x3e')],{'$or':_[_0xe885('0x2d')](_0xc6adec['attributes'],function(_0x7262a7){var _0x4076a8={};_0x4076a8[_0x7262a7]={'$like':'%'+_0x34e600[_0xe885('0x32')][_0xe885('0x3d')]+'%'};return _0x4076a8;})});}_0xc6adec=_['merge']({},_0xc6adec,_0x34e600[_0xe885('0x41')]);return _0x401288['getSubjects'](_0xc6adec);}})['then'](function(_0x440602){if(_0x440602){_0xfc6c9f=_0x440602[_0xe885('0x37')];if(!_0x34e600[_0xe885('0x32')][_0xe885('0x38')](_0xe885('0x39'))){_0xc6adec[_0xe885('0x1e')]=qs[_0xe885('0x1e')](_0x34e600[_0xe885('0x32')][_0xe885('0x1e')]);_0xc6adec['offset']=qs[_0xe885('0x1d')](_0x34e600[_0xe885('0x32')][_0xe885('0x1d')]);}return _0x401288[_0xe885('0x50')](_0xc6adec);}})['then'](function(_0x4b15f6){if(_0x4b15f6){return _0x4b15f6?{'count':_0xfc6c9f,'rows':_0x4b15f6}:null;}})[_0xe885('0x27')](respondWithResult(_0xace6fd,null))['catch'](handleError(_0xace6fd,null));};exports[_0xe885('0x51')]=function(_0x54ad49,_0x1bfb8d,_0x9175d4){var _0x416c34={};var _0x4d79b8={};var _0x1d2e02;var _0x3351b4;return db[_0xe885('0x2e')][_0xe885('0x4e')]({'where':{'id':_0x54ad49[_0xe885('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bfb8d,null))[_0xe885('0x27')](function(_0x4a4bbe){if(_0x4a4bbe){_0x1d2e02=_0x4a4bbe;_0x4d79b8[_0xe885('0x35')]=_[_0xe885('0x49')](db[_0xe885('0x4f')][_0xe885('0x2f')]);_0x4d79b8[_0xe885('0x32')]=_[_0xe885('0x49')](_0x54ad49['query']);_0x4d79b8['filters']=_[_0xe885('0x34')](_0x4d79b8[_0xe885('0x35')],_0x4d79b8['query']);_0x416c34[_0xe885('0x36')]=_[_0xe885('0x34')](_0x4d79b8[_0xe885('0x35')],qs[_0xe885('0x4a')](_0x54ad49[_0xe885('0x32')]['fields']));_0x416c34['attributes']=_0x416c34[_0xe885('0x36')]['length']?_0x416c34[_0xe885('0x36')]:_0x4d79b8['model'];_0x416c34[_0xe885('0x3a')]=qs[_0xe885('0x3b')](_0x54ad49['query'][_0xe885('0x3b')]);_0x416c34['where']=qs[_0xe885('0x33')](_[_0xe885('0x3c')](_0x54ad49[_0xe885('0x32')],_0x4d79b8[_0xe885('0x33')]));if(_0x54ad49[_0xe885('0x32')][_0xe885('0x3d')]){_0x416c34[_0xe885('0x3e')]=_[_0xe885('0x3f')](_0x416c34['where'],{'$or':_[_0xe885('0x2d')](_0x416c34[_0xe885('0x36')],function(_0x2ae91d){var _0x1331ba={};_0x1331ba[_0x2ae91d]={'$like':'%'+_0x54ad49[_0xe885('0x32')]['filter']+'%'};return _0x1331ba;})});}_0x416c34=_['merge']({},_0x416c34,_0x54ad49[_0xe885('0x41')]);return _0x1d2e02[_0xe885('0x51')](_0x416c34);}})[_0xe885('0x27')](function(_0x24b0dd){if(_0x24b0dd){_0x3351b4=_0x24b0dd[_0xe885('0x37')];if(!_0x54ad49[_0xe885('0x32')][_0xe885('0x38')](_0xe885('0x39'))){_0x416c34[_0xe885('0x1e')]=qs[_0xe885('0x1e')](_0x54ad49['query'][_0xe885('0x1e')]);_0x416c34[_0xe885('0x1d')]=qs[_0xe885('0x1d')](_0x54ad49[_0xe885('0x32')][_0xe885('0x1d')]);}return _0x1d2e02[_0xe885('0x51')](_0x416c34);}})[_0xe885('0x27')](function(_0x41604f){if(_0x41604f){return _0x41604f?{'count':_0x3351b4,'rows':_0x41604f}:null;}})['then'](respondWithResult(_0x1bfb8d,null))[_0xe885('0x46')](handleError(_0x1bfb8d,null));}; \ No newline at end of file +var _0xa132=['fields','length','nolimit','sort','pick','filter','merge','where','type','include','findAll','rows','catch','params','find','create','body','update','findOne','VtigerField','order','options','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xa132,0x196));var _0x2a13=function(_0x4bc2f5,_0x4c5fe7){_0x4bc2f5=_0x4bc2f5-0x0;var _0x11aa74=_0xa132[_0x4bc2f5];return _0x11aa74;};'use strict';var emlformat=require(_0x2a13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a13('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a13('0x2'));var moment=require(_0x2a13('0x3'));var BPromise=require(_0x2a13('0x4'));var Mustache=require('mustache');var util=require(_0x2a13('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2a13('0x6'));var ejs=require(_0x2a13('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a13('0x8'));var squel=require(_0x2a13('0x9'));var crypto=require('crypto');var jsforce=require(_0x2a13('0xa'));var deskjs=require(_0x2a13('0xb'));var toCsv=require(_0x2a13('0x6'));var querystring=require(_0x2a13('0xc'));var Papa=require(_0x2a13('0xd'));var Redis=require('ioredis');var authService=require(_0x2a13('0xe'));var qs=require(_0x2a13('0xf'));var as=require(_0x2a13('0x10'));var hardwareService=require(_0x2a13('0x11'));var logger=require('../../config/logger')(_0x2a13('0x12'));var utils=require(_0x2a13('0x13'));var config=require(_0x2a13('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x327130,_0x14ab68){_0x14ab68=_0x14ab68||0xcc;return function(_0x1c6297){if(_0x1c6297){return _0x327130[_0x2a13('0x15')](_0x14ab68);}return _0x327130[_0x2a13('0x16')](_0x14ab68)[_0x2a13('0x17')]();};}function respondWithResult(_0x2aa0c3,_0x4b9a18){_0x4b9a18=_0x4b9a18||0xc8;return function(_0x4b0b40){if(_0x4b0b40){return _0x2aa0c3['status'](_0x4b9a18)['json'](_0x4b0b40);}};}function respondWithFilteredResult(_0x50dc80,_0x12570f){return function(_0x26ff1f){if(_0x26ff1f){var _0x528b01=typeof _0x12570f[_0x2a13('0x18')]==='undefined'&&typeof _0x12570f[_0x2a13('0x19')]===_0x2a13('0x1a');var _0x469d81=_0x26ff1f[_0x2a13('0x1b')];var _0x207950=_0x528b01?0x0:_0x12570f['offset'];var _0xcdc4f4=_0x528b01?_0x26ff1f[_0x2a13('0x1b')]:_0x12570f[_0x2a13('0x18')]+_0x12570f[_0x2a13('0x19')];var _0x6b2803;if(_0xcdc4f4>=_0x469d81){_0xcdc4f4=_0x469d81;_0x6b2803=0xc8;}else{_0x6b2803=0xce;}_0x50dc80['status'](_0x6b2803);return _0x50dc80[_0x2a13('0x1c')](_0x2a13('0x1d'),_0x207950+'-'+_0xcdc4f4+'/'+_0x469d81)[_0x2a13('0x1e')](_0x26ff1f);}return null;};}function patchUpdates(_0x42f4a2){return function(_0x18ab7f){try{jsonpatch[_0x2a13('0x1f')](_0x18ab7f,_0x42f4a2,!![]);}catch(_0x37a567){return BPromise[_0x2a13('0x20')](_0x37a567);}return _0x18ab7f[_0x2a13('0x21')]();};}function saveUpdates(_0x30e4d7,_0x2c8885){return function(_0x3e1a6e){if(_0x3e1a6e){return _0x3e1a6e['update'](_0x30e4d7)[_0x2a13('0x22')](function(_0x2e8b00){return _0x2e8b00;});}return null;};}function removeEntity(_0x23d0ec,_0x5043f4){return function(_0xd11f4b){if(_0xd11f4b){return _0xd11f4b[_0x2a13('0x23')]()['then'](function(){_0x23d0ec[_0x2a13('0x16')](0xcc)[_0x2a13('0x17')]();});}};}function handleEntityNotFound(_0x5a7c96,_0x25b438){return function(_0x19df00){if(!_0x19df00){_0x5a7c96['sendStatus'](0x194);}return _0x19df00;};}function handleError(_0x4940b6,_0x31ef91){_0x31ef91=_0x31ef91||0x1f4;return function(_0xe34aa){logger[_0x2a13('0x24')](_0xe34aa['stack']);if(_0xe34aa[_0x2a13('0x25')]){delete _0xe34aa[_0x2a13('0x25')];}_0x4940b6[_0x2a13('0x16')](_0x31ef91)[_0x2a13('0x26')](_0xe34aa);};}exports[_0x2a13('0x27')]=function(_0x16bc54,_0x3c6a99){var _0x127974={},_0x47c158={},_0x3b5302={'count':0x0,'rows':[]};var _0x37babe=_[_0x2a13('0x28')](db[_0x2a13('0x29')][_0x2a13('0x2a')],function(_0x2b2632){return{'name':_0x2b2632['fieldName'],'type':_0x2b2632['type'][_0x2a13('0x2b')]};});_0x47c158[_0x2a13('0x2c')]=_[_0x2a13('0x28')](_0x37babe,_0x2a13('0x25'));_0x47c158[_0x2a13('0x2d')]=_[_0x2a13('0x2e')](_0x16bc54[_0x2a13('0x2d')]);_0x47c158[_0x2a13('0x2f')]=_[_0x2a13('0x30')](_0x47c158['model'],_0x47c158[_0x2a13('0x2d')]);_0x127974[_0x2a13('0x31')]=_[_0x2a13('0x30')](_0x47c158['model'],qs['fields'](_0x16bc54['query'][_0x2a13('0x32')]));_0x127974[_0x2a13('0x31')]=_0x127974[_0x2a13('0x31')][_0x2a13('0x33')]?_0x127974[_0x2a13('0x31')]:_0x47c158[_0x2a13('0x2c')];if(!_0x16bc54[_0x2a13('0x2d')]['hasOwnProperty'](_0x2a13('0x34'))){_0x127974[_0x2a13('0x19')]=qs[_0x2a13('0x19')](_0x16bc54[_0x2a13('0x2d')][_0x2a13('0x19')]);_0x127974[_0x2a13('0x18')]=qs['offset'](_0x16bc54['query'][_0x2a13('0x18')]);}_0x127974['order']=qs[_0x2a13('0x35')](_0x16bc54[_0x2a13('0x2d')][_0x2a13('0x35')]);_0x127974['where']=qs['filters'](_[_0x2a13('0x36')](_0x16bc54[_0x2a13('0x2d')],_0x47c158['filters']),_0x37babe);if(_0x16bc54[_0x2a13('0x2d')][_0x2a13('0x37')]){_0x127974['where']=_[_0x2a13('0x38')](_0x127974[_0x2a13('0x39')],{'$or':_[_0x2a13('0x28')](_0x37babe,function(_0x4bc208){if(_0x4bc208[_0x2a13('0x3a')]!=='VIRTUAL'){var _0x5ae1ec={};_0x5ae1ec[_0x4bc208[_0x2a13('0x25')]]={'$like':'%'+_0x16bc54[_0x2a13('0x2d')]['filter']+'%'};return _0x5ae1ec;}})});}_0x127974=_['merge']({},_0x127974,_0x16bc54['options']);var _0x27cc7a={'where':_0x127974[_0x2a13('0x39')]};return db[_0x2a13('0x29')][_0x2a13('0x1b')](_0x27cc7a)[_0x2a13('0x22')](function(_0x29b2f4){_0x3b5302['count']=_0x29b2f4;if(_0x16bc54['query']['includeAll']){_0x127974[_0x2a13('0x3b')]=[{'all':!![]}];}return db[_0x2a13('0x29')][_0x2a13('0x3c')](_0x127974);})[_0x2a13('0x22')](function(_0x210ac5){_0x3b5302[_0x2a13('0x3d')]=_0x210ac5;return _0x3b5302;})[_0x2a13('0x22')](respondWithFilteredResult(_0x3c6a99,_0x127974))[_0x2a13('0x3e')](handleError(_0x3c6a99,null));};exports['show']=function(_0x2e9d88,_0x215490){var _0x36378c={'raw':![],'where':{'id':_0x2e9d88[_0x2a13('0x3f')]['id']}},_0x11493b={};_0x11493b[_0x2a13('0x2c')]=_['keys'](db['VtigerConfiguration'][_0x2a13('0x2a')]);_0x11493b['query']=_[_0x2a13('0x2e')](_0x2e9d88[_0x2a13('0x2d')]);_0x11493b[_0x2a13('0x2f')]=_[_0x2a13('0x30')](_0x11493b['model'],_0x11493b[_0x2a13('0x2d')]);_0x36378c[_0x2a13('0x31')]=_[_0x2a13('0x30')](_0x11493b['model'],qs[_0x2a13('0x32')](_0x2e9d88['query'][_0x2a13('0x32')]));_0x36378c[_0x2a13('0x31')]=_0x36378c[_0x2a13('0x31')][_0x2a13('0x33')]?_0x36378c[_0x2a13('0x31')]:_0x11493b[_0x2a13('0x2c')];if(_0x2e9d88['query']['includeAll']){_0x36378c[_0x2a13('0x3b')]=[{'all':!![]}];}_0x36378c=_[_0x2a13('0x38')]({},_0x36378c,_0x2e9d88['options']);return db['VtigerConfiguration'][_0x2a13('0x40')](_0x36378c)[_0x2a13('0x22')](handleEntityNotFound(_0x215490,null))[_0x2a13('0x22')](respondWithResult(_0x215490,null))[_0x2a13('0x3e')](handleError(_0x215490,null));};exports[_0x2a13('0x41')]=function(_0x4d381a,_0x171c81){return db[_0x2a13('0x29')][_0x2a13('0x41')](_0x4d381a[_0x2a13('0x42')],{})[_0x2a13('0x22')](respondWithResult(_0x171c81,0xc9))[_0x2a13('0x3e')](handleError(_0x171c81,null));};exports[_0x2a13('0x43')]=function(_0x5b38b,_0x27a3a8){if(_0x5b38b['body']['id']){delete _0x5b38b['body']['id'];}return db[_0x2a13('0x29')][_0x2a13('0x40')]({'where':{'id':_0x5b38b[_0x2a13('0x3f')]['id']}})['then'](handleEntityNotFound(_0x27a3a8,null))[_0x2a13('0x22')](saveUpdates(_0x5b38b[_0x2a13('0x42')],null))[_0x2a13('0x22')](respondWithResult(_0x27a3a8,null))[_0x2a13('0x3e')](handleError(_0x27a3a8,null));};exports['destroy']=function(_0x231861,_0x30b34d){return db[_0x2a13('0x29')][_0x2a13('0x40')]({'where':{'id':_0x231861[_0x2a13('0x3f')]['id']}})[_0x2a13('0x22')](handleEntityNotFound(_0x30b34d,null))['then'](removeEntity(_0x30b34d,null))[_0x2a13('0x3e')](handleError(_0x30b34d,null));};exports['getFields']=function(_0x510dce,_0x29b236,_0x238548){var _0x9bc9ac={};var _0x468be5={};var _0x571fd3;var _0x10bedf;return db[_0x2a13('0x29')][_0x2a13('0x44')]({'where':{'id':_0x510dce[_0x2a13('0x3f')]['id']}})[_0x2a13('0x22')](handleEntityNotFound(_0x29b236,null))[_0x2a13('0x22')](function(_0x465ff1){if(_0x465ff1){_0x571fd3=_0x465ff1;_0x468be5[_0x2a13('0x2c')]=_[_0x2a13('0x2e')](db[_0x2a13('0x45')][_0x2a13('0x2a')]);_0x468be5[_0x2a13('0x2d')]=_[_0x2a13('0x2e')](_0x510dce['query']);_0x468be5['filters']=_[_0x2a13('0x30')](_0x468be5['model'],_0x468be5[_0x2a13('0x2d')]);_0x9bc9ac['attributes']=_[_0x2a13('0x30')](_0x468be5['model'],qs[_0x2a13('0x32')](_0x510dce['query'][_0x2a13('0x32')]));_0x9bc9ac[_0x2a13('0x31')]=_0x9bc9ac[_0x2a13('0x31')][_0x2a13('0x33')]?_0x9bc9ac[_0x2a13('0x31')]:_0x468be5[_0x2a13('0x2c')];_0x9bc9ac[_0x2a13('0x46')]=qs[_0x2a13('0x35')](_0x510dce[_0x2a13('0x2d')][_0x2a13('0x35')]);_0x9bc9ac[_0x2a13('0x39')]=qs[_0x2a13('0x2f')](_[_0x2a13('0x36')](_0x510dce[_0x2a13('0x2d')],_0x468be5[_0x2a13('0x2f')]));if(_0x510dce[_0x2a13('0x2d')]['filter']){_0x9bc9ac[_0x2a13('0x39')]=_['merge'](_0x9bc9ac[_0x2a13('0x39')],{'$or':_['map'](_0x9bc9ac[_0x2a13('0x31')],function(_0x4f41ab){var _0x56b1de={};_0x56b1de[_0x4f41ab]={'$like':'%'+_0x510dce['query'][_0x2a13('0x37')]+'%'};return _0x56b1de;})});}_0x9bc9ac=_['merge']({},_0x9bc9ac,_0x510dce[_0x2a13('0x47')]);return _0x571fd3[_0x2a13('0x48')](_0x9bc9ac);}})[_0x2a13('0x22')](function(_0x46a6b0){if(_0x46a6b0){_0x10bedf=_0x46a6b0[_0x2a13('0x33')];if(!_0x510dce['query'][_0x2a13('0x49')](_0x2a13('0x34'))){_0x9bc9ac[_0x2a13('0x19')]=qs[_0x2a13('0x19')](_0x510dce[_0x2a13('0x2d')][_0x2a13('0x19')]);_0x9bc9ac[_0x2a13('0x18')]=qs['offset'](_0x510dce[_0x2a13('0x2d')][_0x2a13('0x18')]);}return _0x571fd3[_0x2a13('0x48')](_0x9bc9ac);}})[_0x2a13('0x22')](function(_0x4568e3){if(_0x4568e3){return _0x4568e3?{'count':_0x10bedf,'rows':_0x4568e3}:null;}})[_0x2a13('0x22')](respondWithResult(_0x29b236,null))[_0x2a13('0x3e')](handleError(_0x29b236,null));};exports['getSubjects']=function(_0x263c0d,_0x5ac2c8,_0x3a4297){var _0x1033b3={};var _0x17b92c={};var _0x37e073;var _0x36986e;return db['VtigerConfiguration'][_0x2a13('0x44')]({'where':{'id':_0x263c0d[_0x2a13('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5ac2c8,null))['then'](function(_0x244ca4){if(_0x244ca4){_0x37e073=_0x244ca4;_0x17b92c[_0x2a13('0x2c')]=_[_0x2a13('0x2e')](db['VtigerField'][_0x2a13('0x2a')]);_0x17b92c[_0x2a13('0x2d')]=_[_0x2a13('0x2e')](_0x263c0d[_0x2a13('0x2d')]);_0x17b92c['filters']=_[_0x2a13('0x30')](_0x17b92c['model'],_0x17b92c['query']);_0x1033b3[_0x2a13('0x31')]=_['intersection'](_0x17b92c[_0x2a13('0x2c')],qs['fields'](_0x263c0d['query'][_0x2a13('0x32')]));_0x1033b3[_0x2a13('0x31')]=_0x1033b3[_0x2a13('0x31')]['length']?_0x1033b3[_0x2a13('0x31')]:_0x17b92c[_0x2a13('0x2c')];_0x1033b3[_0x2a13('0x46')]=qs[_0x2a13('0x35')](_0x263c0d[_0x2a13('0x2d')]['sort']);_0x1033b3[_0x2a13('0x39')]=qs['filters'](_['pick'](_0x263c0d[_0x2a13('0x2d')],_0x17b92c[_0x2a13('0x2f')]));if(_0x263c0d['query'][_0x2a13('0x37')]){_0x1033b3['where']=_[_0x2a13('0x38')](_0x1033b3[_0x2a13('0x39')],{'$or':_[_0x2a13('0x28')](_0x1033b3[_0x2a13('0x31')],function(_0x507598){var _0x54d546={};_0x54d546[_0x507598]={'$like':'%'+_0x263c0d['query'][_0x2a13('0x37')]+'%'};return _0x54d546;})});}_0x1033b3=_[_0x2a13('0x38')]({},_0x1033b3,_0x263c0d[_0x2a13('0x47')]);return _0x37e073['getSubjects'](_0x1033b3);}})[_0x2a13('0x22')](function(_0x186849){if(_0x186849){_0x36986e=_0x186849[_0x2a13('0x33')];if(!_0x263c0d[_0x2a13('0x2d')][_0x2a13('0x49')](_0x2a13('0x34'))){_0x1033b3[_0x2a13('0x19')]=qs[_0x2a13('0x19')](_0x263c0d['query'][_0x2a13('0x19')]);_0x1033b3['offset']=qs[_0x2a13('0x18')](_0x263c0d[_0x2a13('0x2d')][_0x2a13('0x18')]);}return _0x37e073[_0x2a13('0x4a')](_0x1033b3);}})[_0x2a13('0x22')](function(_0x4f41b6){if(_0x4f41b6){return _0x4f41b6?{'count':_0x36986e,'rows':_0x4f41b6}:null;}})[_0x2a13('0x22')](respondWithResult(_0x5ac2c8,null))[_0x2a13('0x3e')](handleError(_0x5ac2c8,null));};exports[_0x2a13('0x4b')]=function(_0x470dec,_0x23a451,_0x5ebd14){var _0xe17fff={};var _0x51a8ba={};var _0x846403;var _0x36acdd;return db[_0x2a13('0x29')][_0x2a13('0x44')]({'where':{'id':_0x470dec[_0x2a13('0x3f')]['id']}})['then'](handleEntityNotFound(_0x23a451,null))[_0x2a13('0x22')](function(_0x27d9f7){if(_0x27d9f7){_0x846403=_0x27d9f7;_0x51a8ba[_0x2a13('0x2c')]=_[_0x2a13('0x2e')](db['VtigerField'][_0x2a13('0x2a')]);_0x51a8ba[_0x2a13('0x2d')]=_[_0x2a13('0x2e')](_0x470dec[_0x2a13('0x2d')]);_0x51a8ba[_0x2a13('0x2f')]=_[_0x2a13('0x30')](_0x51a8ba[_0x2a13('0x2c')],_0x51a8ba[_0x2a13('0x2d')]);_0xe17fff['attributes']=_[_0x2a13('0x30')](_0x51a8ba['model'],qs[_0x2a13('0x32')](_0x470dec[_0x2a13('0x2d')]['fields']));_0xe17fff['attributes']=_0xe17fff[_0x2a13('0x31')][_0x2a13('0x33')]?_0xe17fff[_0x2a13('0x31')]:_0x51a8ba['model'];_0xe17fff[_0x2a13('0x46')]=qs[_0x2a13('0x35')](_0x470dec[_0x2a13('0x2d')][_0x2a13('0x35')]);_0xe17fff[_0x2a13('0x39')]=qs[_0x2a13('0x2f')](_[_0x2a13('0x36')](_0x470dec[_0x2a13('0x2d')],_0x51a8ba[_0x2a13('0x2f')]));if(_0x470dec[_0x2a13('0x2d')][_0x2a13('0x37')]){_0xe17fff['where']=_[_0x2a13('0x38')](_0xe17fff[_0x2a13('0x39')],{'$or':_[_0x2a13('0x28')](_0xe17fff[_0x2a13('0x31')],function(_0xb22a7e){var _0x56bbde={};_0x56bbde[_0xb22a7e]={'$like':'%'+_0x470dec[_0x2a13('0x2d')][_0x2a13('0x37')]+'%'};return _0x56bbde;})});}_0xe17fff=_[_0x2a13('0x38')]({},_0xe17fff,_0x470dec['options']);return _0x846403[_0x2a13('0x4b')](_0xe17fff);}})['then'](function(_0x2815b6){if(_0x2815b6){_0x36acdd=_0x2815b6[_0x2a13('0x33')];if(!_0x470dec[_0x2a13('0x2d')][_0x2a13('0x49')](_0x2a13('0x34'))){_0xe17fff[_0x2a13('0x19')]=qs[_0x2a13('0x19')](_0x470dec[_0x2a13('0x2d')][_0x2a13('0x19')]);_0xe17fff['offset']=qs[_0x2a13('0x18')](_0x470dec[_0x2a13('0x2d')]['offset']);}return _0x846403[_0x2a13('0x4b')](_0xe17fff);}})[_0x2a13('0x22')](function(_0xdb393){if(_0xdb393){return _0xdb393?{'count':_0x36acdd,'rows':_0xdb393}:null;}})[_0x2a13('0x22')](respondWithResult(_0x23a451,null))[_0x2a13('0x3e')](handleError(_0x23a451,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8cfc7e0..0d3da87 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 _0x8658=['moment','path','../../config/environment','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger'];(function(_0x3bf618,_0xea4027){var _0x4e9307=function(_0x5848c5){while(--_0x5848c5){_0x3bf618['push'](_0x3bf618['shift']());}};_0x4e9307(++_0xea4027);}(_0x8658,0x1a6));var _0x8865=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x8658[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x8865('0x0'));var logger=require(_0x8865('0x1'))('api');var moment=require(_0x8865('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8865('0x3'));var rimraf=require('rimraf');var config=require(_0x8865('0x4'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x395a0c,_0xf26fc){return _0x395a0c[_0x8865('0x5')](_0x8865('0x6'),attributes,{'tableName':_0x8865('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c06=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','bluebird'];(function(_0x3b166b,_0x2c8ba1){var _0x579602=function(_0x8d7abc){while(--_0x8d7abc){_0x3b166b['push'](_0x3b166b['shift']());}};_0x579602(++_0x2c8ba1);}(_0x9c06,0x6a));var _0x69c0=function(_0x383d43,_0x3a51f6){_0x383d43=_0x383d43-0x0;var _0x5d75e6=_0x9c06[_0x383d43];return _0x5d75e6;};'use strict';var _=require(_0x69c0('0x0'));var util=require(_0x69c0('0x1'));var logger=require('../../config/logger')(_0x69c0('0x2'));var moment=require('moment');var BPromise=require(_0x69c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69c0('0x4'));var rimraf=require(_0x69c0('0x5'));var config=require(_0x69c0('0x6'));var attributes=require(_0x69c0('0x7'));module[_0x69c0('0x8')]=function(_0x2e8603,_0x1f4751){return _0x2e8603['define'](_0x69c0('0x9'),attributes,{'tableName':_0x69c0('0xa'),'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 a612fbb..75ee269 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 _0xf6f8=['message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf6f8,0xfa));var _0x8f6f=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xf6f8[_0x556bb1];return _0x45455f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8f6f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f6f('0x1'));var db=require(_0x8f6f('0x2'))['db'];var utils=require(_0x8f6f('0x3'));var logger=require(_0x8f6f('0x4'))(_0x8f6f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8f6f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2d1dcb,_0x176a44,_0x2cba20){return new BPromise(function(_0x414923,_0x5b42d7){return client[_0x8f6f('0x7')](_0x2d1dcb,_0x2cba20)[_0x8f6f('0x8')](function(_0x361dd1){logger[_0x8f6f('0x9')](_0x8f6f('0xa'),_0x176a44,'request\x20sent');logger[_0x8f6f('0xb')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x176a44,_0x8f6f('0xc'),JSON[_0x8f6f('0xd')](_0x361dd1));if(_0x361dd1[_0x8f6f('0xe')]){if(_0x361dd1[_0x8f6f('0xe')][_0x8f6f('0xf')]===0x1f4){logger['error'](_0x8f6f('0xa'),_0x176a44,_0x361dd1[_0x8f6f('0xe')][_0x8f6f('0x10')]);return _0x5b42d7(_0x361dd1[_0x8f6f('0xe')][_0x8f6f('0x10')]);}logger['error'](_0x8f6f('0xa'),_0x176a44,_0x361dd1['error'][_0x8f6f('0x10')]);return _0x414923(_0x361dd1[_0x8f6f('0xe')][_0x8f6f('0x10')]);}else{logger[_0x8f6f('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x176a44,_0x8f6f('0xc'));_0x414923(_0x361dd1[_0x8f6f('0x11')]['message']);}})[_0x8f6f('0x12')](function(_0x3ad286){logger[_0x8f6f('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x176a44,_0x3ad286);_0x5b42d7(_0x3ad286);});});} \ No newline at end of file +var _0x7374=['../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x21e034,_0x59fc14){var _0x1faab3=function(_0x2bd3ba){while(--_0x2bd3ba){_0x21e034['push'](_0x21e034['shift']());}};_0x1faab3(++_0x59fc14);}(_0x7374,0xe5));var _0x4737=function(_0x3588d8,_0x500a65){_0x3588d8=_0x3588d8-0x0;var _0x3bbf69=_0x7374[_0x3588d8];return _0x3bbf69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4737('0x0'));var BPromise=require('bluebird');var rs=require(_0x4737('0x1'));var fs=require('fs');var Redis=require(_0x4737('0x2'));var db=require(_0x4737('0x3'))['db'];var utils=require(_0x4737('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4737('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4737('0x6')][_0x4737('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28142f,_0x177733,_0x128f46){return new BPromise(function(_0x6dbc30,_0xf9b74b){return client[_0x4737('0x8')](_0x28142f,_0x128f46)[_0x4737('0x9')](function(_0x491d40){logger[_0x4737('0xa')](_0x4737('0xb'),_0x177733,_0x4737('0xc'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x177733,_0x4737('0xc'),JSON[_0x4737('0xd')](_0x491d40));if(_0x491d40[_0x4737('0xe')]){if(_0x491d40['error']['code']===0x1f4){logger[_0x4737('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x177733,_0x491d40[_0x4737('0xe')]['message']);return _0xf9b74b(_0x491d40['error'][_0x4737('0xf')]);}logger[_0x4737('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x177733,_0x491d40['error'][_0x4737('0xf')]);return _0x6dbc30(_0x491d40[_0x4737('0xe')][_0x4737('0xf')]);}else{logger[_0x4737('0xa')](_0x4737('0xb'),_0x177733,'request\x20sent');_0x6dbc30(_0x491d40[_0x4737('0x10')][_0x4737('0xf')]);}})[_0x4737('0x11')](function(_0x5a41d6){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x177733,_0x5a41d6);_0xf9b74b(_0x5a41d6);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7c722bf..c148bac 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 _0xe23c=['get','isAuthenticated','index','post','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x1b678d,_0x27f948){var _0x36fe59=function(_0x4336cc){while(--_0x4336cc){_0x1b678d['push'](_0x1b678d['shift']());}};_0x36fe59(++_0x27f948);}(_0xe23c,0x1e9));var _0xce23=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0xe23c[_0x17b0d4];return _0x2d02c7;};'use strict';var multer=require(_0xce23('0x0'));var util=require(_0xce23('0x1'));var path=require(_0xce23('0x2'));var timeout=require(_0xce23('0x3'));var express=require(_0xce23('0x4'));var router=express[_0xce23('0x5')]();var fs_extra=require(_0xce23('0x6'));var auth=require(_0xce23('0x7'));var interaction=require(_0xce23('0x8'));var config=require(_0xce23('0x9'));var controller=require(_0xce23('0xa'));router[_0xce23('0xb')]('/',auth[_0xce23('0xc')](),controller[_0xce23('0xd')]);router['get']('/:id',auth[_0xce23('0xc')](),controller['show']);router[_0xce23('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xce23('0xf')]('/:id',auth[_0xce23('0xc')](),controller[_0xce23('0x10')]);router['delete'](_0xce23('0x11'),auth[_0xce23('0xc')](),controller[_0xce23('0x12')]);module[_0xce23('0x13')]=router; \ No newline at end of file +var _0x6cb0=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','util'];(function(_0xdf897a,_0xd23b65){var _0x3243dc=function(_0x4b6e7e){while(--_0x4b6e7e){_0xdf897a['push'](_0xdf897a['shift']());}};_0x3243dc(++_0xd23b65);}(_0x6cb0,0x98));var _0x06cb=function(_0x4e3bd3,_0x4f9cc4){_0x4e3bd3=_0x4e3bd3-0x0;var _0x1fb687=_0x6cb0[_0x4e3bd3];return _0x1fb687;};'use strict';var multer=require('multer');var util=require(_0x06cb('0x0'));var path=require(_0x06cb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x06cb('0x2')]();var fs_extra=require(_0x06cb('0x3'));var auth=require(_0x06cb('0x4'));var interaction=require(_0x06cb('0x5'));var config=require('../../config/environment');var controller=require(_0x06cb('0x6'));router[_0x06cb('0x7')]('/',auth[_0x06cb('0x8')](),controller['index']);router[_0x06cb('0x7')]('/:id',auth[_0x06cb('0x8')](),controller[_0x06cb('0x9')]);router[_0x06cb('0xa')]('/',auth['isAuthenticated'](),controller[_0x06cb('0xb')]);router['put'](_0x06cb('0xc'),auth['isAuthenticated'](),controller[_0x06cb('0xd')]);router[_0x06cb('0xe')](_0x06cb('0xc'),auth[_0x06cb('0x8')](),controller[_0x06cb('0xf')]);module[_0x06cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 75ea816..c3e35bd 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 _0x8dab=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x314397,_0x1943d5){var _0x44dbf3=function(_0x161490){while(--_0x161490){_0x314397['push'](_0x314397['shift']());}};_0x44dbf3(++_0x1943d5);}(_0x8dab,0xaa));var _0xb8da=function(_0x3b07db,_0x4da958){_0x3b07db=_0x3b07db-0x0;var _0x585ee1=_0x8dab[_0x3b07db];return _0x585ee1;};'use strict';var Sequelize=require(_0xb8da('0x0'));module[_0xb8da('0x1')]={'type':{'type':Sequelize[_0xb8da('0x2')](_0xb8da('0x3'),_0xb8da('0x4'),_0xb8da('0x5'),_0xb8da('0x6'),'picklist'),'defaultValue':_0xb8da('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb8da('0x7')]},'keyType':{'type':Sequelize[_0xb8da('0x2')](_0xb8da('0x3'),_0xb8da('0x4'),_0xb8da('0x5'))},'keyContent':{'type':Sequelize[_0xb8da('0x7')]},'idField':{'type':Sequelize[_0xb8da('0x7')]},'nameField':{'type':Sequelize[_0xb8da('0x7')]},'customField':{'type':Sequelize[_0xb8da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x698a=['picklist','string','STRING','BOOLEAN','exports','ENUM','variable','customVariable'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x698a,0x94));var _0xa698=function(_0xf6bb7d,_0x8af4f5){_0xf6bb7d=_0xf6bb7d-0x0;var _0x132764=_0x698a[_0xf6bb7d];return _0x132764;};'use strict';var Sequelize=require('sequelize');module[_0xa698('0x0')]={'type':{'type':Sequelize[_0xa698('0x1')]('string',_0xa698('0x2'),_0xa698('0x3'),'keyValue',_0xa698('0x4')),'defaultValue':_0xa698('0x5')},'content':{'type':Sequelize[_0xa698('0x6')]},'key':{'type':Sequelize[_0xa698('0x6')]},'keyType':{'type':Sequelize[_0xa698('0x1')]('string',_0xa698('0x2'),_0xa698('0x3'))},'keyContent':{'type':Sequelize[_0xa698('0x6')]},'idField':{'type':Sequelize[_0xa698('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa698('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa698('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0f691d9..a7e43a0 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 _0xb927=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','params','intersection','find','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x520d4b,_0x187f44){var _0x13788c=function(_0x53ed71){while(--_0x53ed71){_0x520d4b['push'](_0x520d4b['shift']());}};_0x13788c(++_0x187f44);}(_0xb927,0x87));var _0x7b92=function(_0x1eab60,_0x35549b){_0x1eab60=_0x1eab60-0x0;var _0x558708=_0xb927[_0x1eab60];return _0x558708;};'use strict';var emlformat=require(_0x7b92('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b92('0x1'));var jsonpatch=require(_0x7b92('0x2'));var rp=require(_0x7b92('0x3'));var moment=require(_0x7b92('0x4'));var BPromise=require(_0x7b92('0x5'));var Mustache=require(_0x7b92('0x6'));var util=require(_0x7b92('0x7'));var path=require(_0x7b92('0x8'));var sox=require(_0x7b92('0x9'));var csv=require(_0x7b92('0xa'));var ejs=require(_0x7b92('0xb'));var fs=require('fs');var fs_extra=require(_0x7b92('0xc'));var _=require('lodash');var squel=require(_0x7b92('0xd'));var crypto=require(_0x7b92('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7b92('0xf'));var Papa=require(_0x7b92('0x10'));var Redis=require(_0x7b92('0x11'));var authService=require(_0x7b92('0x12'));var qs=require(_0x7b92('0x13'));var as=require(_0x7b92('0x14'));var hardwareService=require(_0x7b92('0x15'));var logger=require(_0x7b92('0x16'))('api');var utils=require(_0x7b92('0x17'));var config=require(_0x7b92('0x18'));var licenseUtil=require(_0x7b92('0x19'));var db=require(_0x7b92('0x1a'))['db'];function respondWithStatusCode(_0x47cd46,_0x1af7b1){_0x1af7b1=_0x1af7b1||0xcc;return function(_0x32691b){if(_0x32691b){return _0x47cd46[_0x7b92('0x1b')](_0x1af7b1);}return _0x47cd46[_0x7b92('0x1c')](_0x1af7b1)['end']();};}function respondWithResult(_0x4af940,_0xcbc358){_0xcbc358=_0xcbc358||0xc8;return function(_0x3646e4){if(_0x3646e4){return _0x4af940[_0x7b92('0x1c')](_0xcbc358)[_0x7b92('0x1d')](_0x3646e4);}};}function respondWithFilteredResult(_0x134b05,_0x1f0def){return function(_0x339fd1){if(_0x339fd1){var _0x5890bf=typeof _0x1f0def['offset']===_0x7b92('0x1e')&&typeof _0x1f0def[_0x7b92('0x1f')]===_0x7b92('0x1e');var _0x3e9738=_0x339fd1[_0x7b92('0x20')];var _0x5e79da=_0x5890bf?0x0:_0x1f0def['offset'];var _0x254b80=_0x5890bf?_0x339fd1[_0x7b92('0x20')]:_0x1f0def[_0x7b92('0x21')]+_0x1f0def['limit'];var _0x3487b8;if(_0x254b80>=_0x3e9738){_0x254b80=_0x3e9738;_0x3487b8=0xc8;}else{_0x3487b8=0xce;}_0x134b05[_0x7b92('0x1c')](_0x3487b8);return _0x134b05[_0x7b92('0x22')](_0x7b92('0x23'),_0x5e79da+'-'+_0x254b80+'/'+_0x3e9738)[_0x7b92('0x1d')](_0x339fd1);}return null;};}function patchUpdates(_0x16d379){return function(_0x1296fa){try{jsonpatch['apply'](_0x1296fa,_0x16d379,!![]);}catch(_0x2d07ca){return BPromise[_0x7b92('0x24')](_0x2d07ca);}return _0x1296fa['save']();};}function saveUpdates(_0x131e0c,_0x27cf0d){return function(_0x336106){if(_0x336106){return _0x336106['update'](_0x131e0c)['then'](function(_0x3c0793){return _0x3c0793;});}return null;};}function removeEntity(_0x411ac3,_0x3caa12){return function(_0x3fa5c5){if(_0x3fa5c5){return _0x3fa5c5[_0x7b92('0x25')]()[_0x7b92('0x26')](function(){_0x411ac3[_0x7b92('0x1c')](0xcc)[_0x7b92('0x27')]();});}};}function handleEntityNotFound(_0x46bdd6,_0x5822d4){return function(_0x42cdeb){if(!_0x42cdeb){_0x46bdd6[_0x7b92('0x1b')](0x194);}return _0x42cdeb;};}function handleError(_0x5d14d8,_0x4c59f4){_0x4c59f4=_0x4c59f4||0x1f4;return function(_0x2c081b){logger[_0x7b92('0x28')](_0x2c081b[_0x7b92('0x29')]);if(_0x2c081b[_0x7b92('0x2a')]){delete _0x2c081b[_0x7b92('0x2a')];}_0x5d14d8['status'](_0x4c59f4)[_0x7b92('0x2b')](_0x2c081b);};}exports[_0x7b92('0x2c')]=function(_0x3f7bd3,_0x113d1b){var _0x21336d={},_0x4175ee={},_0x4ff3c1={'count':0x0,'rows':[]};var _0x2788b6=_['map'](db['VtigerField'][_0x7b92('0x2d')],function(_0x56a3f3){return{'name':_0x56a3f3[_0x7b92('0x2e')],'type':_0x56a3f3['type'][_0x7b92('0x2f')]};});_0x4175ee[_0x7b92('0x30')]=_[_0x7b92('0x31')](_0x2788b6,_0x7b92('0x2a'));_0x4175ee[_0x7b92('0x32')]=_[_0x7b92('0x33')](_0x3f7bd3['query']);_0x4175ee[_0x7b92('0x34')]=_['intersection'](_0x4175ee[_0x7b92('0x30')],_0x4175ee[_0x7b92('0x32')]);_0x21336d['attributes']=_['intersection'](_0x4175ee[_0x7b92('0x30')],qs[_0x7b92('0x35')](_0x3f7bd3[_0x7b92('0x32')][_0x7b92('0x35')]));_0x21336d[_0x7b92('0x36')]=_0x21336d[_0x7b92('0x36')][_0x7b92('0x37')]?_0x21336d[_0x7b92('0x36')]:_0x4175ee[_0x7b92('0x30')];if(!_0x3f7bd3[_0x7b92('0x32')][_0x7b92('0x38')](_0x7b92('0x39'))){_0x21336d[_0x7b92('0x1f')]=qs['limit'](_0x3f7bd3[_0x7b92('0x32')]['limit']);_0x21336d['offset']=qs[_0x7b92('0x21')](_0x3f7bd3['query'][_0x7b92('0x21')]);}_0x21336d[_0x7b92('0x3a')]=qs[_0x7b92('0x3b')](_0x3f7bd3[_0x7b92('0x32')][_0x7b92('0x3b')]);_0x21336d[_0x7b92('0x3c')]=qs['filters'](_[_0x7b92('0x3d')](_0x3f7bd3[_0x7b92('0x32')],_0x4175ee[_0x7b92('0x34')]),_0x2788b6);if(_0x3f7bd3[_0x7b92('0x32')][_0x7b92('0x3e')]){_0x21336d[_0x7b92('0x3c')]=_[_0x7b92('0x3f')](_0x21336d[_0x7b92('0x3c')],{'$or':_[_0x7b92('0x31')](_0x2788b6,function(_0x4cb791){if(_0x4cb791[_0x7b92('0x40')]!==_0x7b92('0x41')){var _0x44406d={};_0x44406d[_0x4cb791['name']]={'$like':'%'+_0x3f7bd3[_0x7b92('0x32')]['filter']+'%'};return _0x44406d;}})});}_0x21336d=_[_0x7b92('0x3f')]({},_0x21336d,_0x3f7bd3[_0x7b92('0x42')]);var _0x58b928={'where':_0x21336d[_0x7b92('0x3c')]};return db[_0x7b92('0x43')]['count'](_0x58b928)[_0x7b92('0x26')](function(_0xa5b927){_0x4ff3c1[_0x7b92('0x20')]=_0xa5b927;if(_0x3f7bd3[_0x7b92('0x32')][_0x7b92('0x44')]){_0x21336d[_0x7b92('0x45')]=[{'all':!![]}];}return db[_0x7b92('0x43')][_0x7b92('0x46')](_0x21336d);})[_0x7b92('0x26')](function(_0xe122da){_0x4ff3c1[_0x7b92('0x47')]=_0xe122da;return _0x4ff3c1;})['then'](respondWithFilteredResult(_0x113d1b,_0x21336d))[_0x7b92('0x48')](handleError(_0x113d1b,null));};exports['show']=function(_0x21b2c5,_0x51f76f){var _0x3f194d={'raw':!![],'where':{'id':_0x21b2c5[_0x7b92('0x49')]['id']}},_0x221caa={};_0x221caa['model']=_['keys'](db[_0x7b92('0x43')][_0x7b92('0x2d')]);_0x221caa['query']=_['keys'](_0x21b2c5[_0x7b92('0x32')]);_0x221caa['filters']=_[_0x7b92('0x4a')](_0x221caa[_0x7b92('0x30')],_0x221caa[_0x7b92('0x32')]);_0x3f194d[_0x7b92('0x36')]=_[_0x7b92('0x4a')](_0x221caa[_0x7b92('0x30')],qs['fields'](_0x21b2c5[_0x7b92('0x32')]['fields']));_0x3f194d['attributes']=_0x3f194d[_0x7b92('0x36')][_0x7b92('0x37')]?_0x3f194d[_0x7b92('0x36')]:_0x221caa[_0x7b92('0x30')];if(_0x21b2c5['query'][_0x7b92('0x44')]){_0x3f194d[_0x7b92('0x45')]=[{'all':!![]}];}_0x3f194d=_[_0x7b92('0x3f')]({},_0x3f194d,_0x21b2c5[_0x7b92('0x42')]);return db[_0x7b92('0x43')][_0x7b92('0x4b')](_0x3f194d)[_0x7b92('0x26')](handleEntityNotFound(_0x51f76f,null))[_0x7b92('0x26')](respondWithResult(_0x51f76f,null))[_0x7b92('0x48')](handleError(_0x51f76f,null));};exports[_0x7b92('0x4c')]=function(_0x39f43e,_0x38484b){return db[_0x7b92('0x43')][_0x7b92('0x4c')](_0x39f43e['body'],{})[_0x7b92('0x26')](respondWithResult(_0x38484b,0xc9))[_0x7b92('0x48')](handleError(_0x38484b,null));};exports[_0x7b92('0x4d')]=function(_0x2c565f,_0x54a4cb){if(_0x2c565f[_0x7b92('0x4e')]['id']){delete _0x2c565f[_0x7b92('0x4e')]['id'];}return db[_0x7b92('0x43')]['find']({'where':{'id':_0x2c565f['params']['id']}})[_0x7b92('0x26')](handleEntityNotFound(_0x54a4cb,null))[_0x7b92('0x26')](saveUpdates(_0x2c565f[_0x7b92('0x4e')],null))[_0x7b92('0x26')](respondWithResult(_0x54a4cb,null))[_0x7b92('0x48')](handleError(_0x54a4cb,null));};exports['destroy']=function(_0x44b10a,_0x2844d9){return db[_0x7b92('0x43')][_0x7b92('0x4b')]({'where':{'id':_0x44b10a[_0x7b92('0x49')]['id']}})['then'](handleEntityNotFound(_0x2844d9,null))[_0x7b92('0x26')](removeEntity(_0x2844d9,null))[_0x7b92('0x48')](handleError(_0x2844d9,null));}; \ No newline at end of file +var _0x78ba=['create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','VtigerField','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','show','params','rawAttributes','includeAll','find','catch'];(function(_0x5547da,_0x1dbd91){var _0x53a783=function(_0x2cba74){while(--_0x2cba74){_0x5547da['push'](_0x5547da['shift']());}};_0x53a783(++_0x1dbd91);}(_0x78ba,0x1be));var _0xa78b=function(_0x47bc49,_0x294526){_0x47bc49=_0x47bc49-0x0;var _0x174582=_0x78ba[_0x47bc49];return _0x174582;};'use strict';var emlformat=require(_0xa78b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa78b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa78b('0x2'));var moment=require(_0xa78b('0x3'));var BPromise=require(_0xa78b('0x4'));var Mustache=require('mustache');var util=require(_0xa78b('0x5'));var path=require(_0xa78b('0x6'));var sox=require(_0xa78b('0x7'));var csv=require(_0xa78b('0x8'));var ejs=require(_0xa78b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa78b('0xa'));var crypto=require(_0xa78b('0xb'));var jsforce=require(_0xa78b('0xc'));var deskjs=require(_0xa78b('0xd'));var toCsv=require(_0xa78b('0x8'));var querystring=require(_0xa78b('0xe'));var Papa=require('papaparse');var Redis=require(_0xa78b('0xf'));var authService=require(_0xa78b('0x10'));var qs=require(_0xa78b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa78b('0x12'));var logger=require('../../config/logger')(_0xa78b('0x13'));var utils=require(_0xa78b('0x14'));var config=require(_0xa78b('0x15'));var licenseUtil=require(_0xa78b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41a9b2,_0x57ab18){_0x57ab18=_0x57ab18||0xcc;return function(_0x4fbf98){if(_0x4fbf98){return _0x41a9b2[_0xa78b('0x17')](_0x57ab18);}return _0x41a9b2[_0xa78b('0x18')](_0x57ab18)[_0xa78b('0x19')]();};}function respondWithResult(_0x36260e,_0x42836e){_0x42836e=_0x42836e||0xc8;return function(_0x4a1ffc){if(_0x4a1ffc){return _0x36260e[_0xa78b('0x18')](_0x42836e)[_0xa78b('0x1a')](_0x4a1ffc);}};}function respondWithFilteredResult(_0x2745b4,_0x27a71f){return function(_0x3a0f6f){if(_0x3a0f6f){var _0xa5e063=typeof _0x27a71f['offset']===_0xa78b('0x1b')&&typeof _0x27a71f['limit']===_0xa78b('0x1b');var _0x2d4577=_0x3a0f6f[_0xa78b('0x1c')];var _0x34b0b0=_0xa5e063?0x0:_0x27a71f[_0xa78b('0x1d')];var _0x596f8c=_0xa5e063?_0x3a0f6f[_0xa78b('0x1c')]:_0x27a71f[_0xa78b('0x1d')]+_0x27a71f[_0xa78b('0x1e')];var _0x3e13de;if(_0x596f8c>=_0x2d4577){_0x596f8c=_0x2d4577;_0x3e13de=0xc8;}else{_0x3e13de=0xce;}_0x2745b4[_0xa78b('0x18')](_0x3e13de);return _0x2745b4[_0xa78b('0x1f')](_0xa78b('0x20'),_0x34b0b0+'-'+_0x596f8c+'/'+_0x2d4577)[_0xa78b('0x1a')](_0x3a0f6f);}return null;};}function patchUpdates(_0x5184a9){return function(_0x96883c){try{jsonpatch[_0xa78b('0x21')](_0x96883c,_0x5184a9,!![]);}catch(_0x20dcdd){return BPromise[_0xa78b('0x22')](_0x20dcdd);}return _0x96883c[_0xa78b('0x23')]();};}function saveUpdates(_0x149a0a,_0x18bba5){return function(_0x305644){if(_0x305644){return _0x305644[_0xa78b('0x24')](_0x149a0a)[_0xa78b('0x25')](function(_0x1b2367){return _0x1b2367;});}return null;};}function removeEntity(_0x4e1c88,_0x20c751){return function(_0x58296b){if(_0x58296b){return _0x58296b[_0xa78b('0x26')]()['then'](function(){_0x4e1c88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31accc,_0x56dfd8){return function(_0xb00367){if(!_0xb00367){_0x31accc[_0xa78b('0x17')](0x194);}return _0xb00367;};}function handleError(_0x4ee08c,_0x145e24){_0x145e24=_0x145e24||0x1f4;return function(_0x305b19){logger[_0xa78b('0x27')](_0x305b19[_0xa78b('0x28')]);if(_0x305b19['name']){delete _0x305b19[_0xa78b('0x29')];}_0x4ee08c[_0xa78b('0x18')](_0x145e24)['send'](_0x305b19);};}exports[_0xa78b('0x2a')]=function(_0x1690b0,_0x252ff9){var _0x121364={},_0x117697={},_0x5e7db8={'count':0x0,'rows':[]};var _0x35a377=_['map'](db[_0xa78b('0x2b')]['rawAttributes'],function(_0x9ac6a1){return{'name':_0x9ac6a1[_0xa78b('0x2c')],'type':_0x9ac6a1[_0xa78b('0x2d')]['key']};});_0x117697['model']=_[_0xa78b('0x2e')](_0x35a377,_0xa78b('0x29'));_0x117697[_0xa78b('0x2f')]=_[_0xa78b('0x30')](_0x1690b0[_0xa78b('0x2f')]);_0x117697['filters']=_[_0xa78b('0x31')](_0x117697[_0xa78b('0x32')],_0x117697[_0xa78b('0x2f')]);_0x121364[_0xa78b('0x33')]=_[_0xa78b('0x31')](_0x117697['model'],qs[_0xa78b('0x34')](_0x1690b0[_0xa78b('0x2f')]['fields']));_0x121364[_0xa78b('0x33')]=_0x121364['attributes'][_0xa78b('0x35')]?_0x121364[_0xa78b('0x33')]:_0x117697['model'];if(!_0x1690b0[_0xa78b('0x2f')]['hasOwnProperty'](_0xa78b('0x36'))){_0x121364[_0xa78b('0x1e')]=qs['limit'](_0x1690b0[_0xa78b('0x2f')][_0xa78b('0x1e')]);_0x121364[_0xa78b('0x1d')]=qs['offset'](_0x1690b0['query'][_0xa78b('0x1d')]);}_0x121364[_0xa78b('0x37')]=qs[_0xa78b('0x38')](_0x1690b0['query'][_0xa78b('0x38')]);_0x121364[_0xa78b('0x39')]=qs['filters'](_[_0xa78b('0x3a')](_0x1690b0[_0xa78b('0x2f')],_0x117697[_0xa78b('0x3b')]),_0x35a377);if(_0x1690b0[_0xa78b('0x2f')][_0xa78b('0x3c')]){_0x121364['where']=_[_0xa78b('0x3d')](_0x121364[_0xa78b('0x39')],{'$or':_[_0xa78b('0x2e')](_0x35a377,function(_0x334612){if(_0x334612['type']!==_0xa78b('0x3e')){var _0x33d7c9={};_0x33d7c9[_0x334612[_0xa78b('0x29')]]={'$like':'%'+_0x1690b0[_0xa78b('0x2f')][_0xa78b('0x3c')]+'%'};return _0x33d7c9;}})});}_0x121364=_['merge']({},_0x121364,_0x1690b0[_0xa78b('0x3f')]);var _0x23fd31={'where':_0x121364[_0xa78b('0x39')]};return db[_0xa78b('0x2b')][_0xa78b('0x1c')](_0x23fd31)[_0xa78b('0x25')](function(_0x7ba99d){_0x5e7db8[_0xa78b('0x1c')]=_0x7ba99d;if(_0x1690b0[_0xa78b('0x2f')]['includeAll']){_0x121364[_0xa78b('0x40')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x121364);})['then'](function(_0x494b80){_0x5e7db8[_0xa78b('0x41')]=_0x494b80;return _0x5e7db8;})[_0xa78b('0x25')](respondWithFilteredResult(_0x252ff9,_0x121364))['catch'](handleError(_0x252ff9,null));};exports[_0xa78b('0x42')]=function(_0x5b463f,_0x5908ff){var _0x5bdb95={'raw':!![],'where':{'id':_0x5b463f[_0xa78b('0x43')]['id']}},_0xf35a9c={};_0xf35a9c['model']=_[_0xa78b('0x30')](db[_0xa78b('0x2b')][_0xa78b('0x44')]);_0xf35a9c[_0xa78b('0x2f')]=_[_0xa78b('0x30')](_0x5b463f['query']);_0xf35a9c[_0xa78b('0x3b')]=_[_0xa78b('0x31')](_0xf35a9c[_0xa78b('0x32')],_0xf35a9c['query']);_0x5bdb95[_0xa78b('0x33')]=_[_0xa78b('0x31')](_0xf35a9c[_0xa78b('0x32')],qs[_0xa78b('0x34')](_0x5b463f[_0xa78b('0x2f')][_0xa78b('0x34')]));_0x5bdb95[_0xa78b('0x33')]=_0x5bdb95[_0xa78b('0x33')][_0xa78b('0x35')]?_0x5bdb95[_0xa78b('0x33')]:_0xf35a9c[_0xa78b('0x32')];if(_0x5b463f['query'][_0xa78b('0x45')]){_0x5bdb95[_0xa78b('0x40')]=[{'all':!![]}];}_0x5bdb95=_[_0xa78b('0x3d')]({},_0x5bdb95,_0x5b463f['options']);return db['VtigerField'][_0xa78b('0x46')](_0x5bdb95)['then'](handleEntityNotFound(_0x5908ff,null))[_0xa78b('0x25')](respondWithResult(_0x5908ff,null))[_0xa78b('0x47')](handleError(_0x5908ff,null));};exports[_0xa78b('0x48')]=function(_0x220310,_0x1e0e25){return db[_0xa78b('0x2b')]['create'](_0x220310[_0xa78b('0x49')],{})[_0xa78b('0x25')](respondWithResult(_0x1e0e25,0xc9))['catch'](handleError(_0x1e0e25,null));};exports[_0xa78b('0x24')]=function(_0x26197c,_0x4a0c32){if(_0x26197c[_0xa78b('0x49')]['id']){delete _0x26197c[_0xa78b('0x49')]['id'];}return db[_0xa78b('0x2b')]['find']({'where':{'id':_0x26197c[_0xa78b('0x43')]['id']}})[_0xa78b('0x25')](handleEntityNotFound(_0x4a0c32,null))[_0xa78b('0x25')](saveUpdates(_0x26197c[_0xa78b('0x49')],null))[_0xa78b('0x25')](respondWithResult(_0x4a0c32,null))[_0xa78b('0x47')](handleError(_0x4a0c32,null));};exports[_0xa78b('0x26')]=function(_0xc24955,_0x473b4b){return db[_0xa78b('0x2b')]['find']({'where':{'id':_0xc24955['params']['id']}})[_0xa78b('0x25')](handleEntityNotFound(_0x473b4b,null))[_0xa78b('0x25')](removeEntity(_0x473b4b,null))[_0xa78b('0x47')](handleError(_0x473b4b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3bbd50d..c731620 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 _0xafa0=['VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','../../config/logger','api','moment','path','rimraf','./intVtigerField.attributes','exports','define'];(function(_0x5bf731,_0x2e8c57){var _0x8cdfe6=function(_0x4d1ca4){while(--_0x4d1ca4){_0x5bf731['push'](_0x5bf731['shift']());}};_0x8cdfe6(++_0x2e8c57);}(_0xafa0,0x7c));var _0x0afa=function(_0x182dea,_0x888597){_0x182dea=_0x182dea-0x0;var _0x146f7d=_0xafa0[_0x182dea];return _0x146f7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0afa('0x0'))(_0x0afa('0x1'));var moment=require(_0x0afa('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0afa('0x3'));var rimraf=require(_0x0afa('0x4'));var config=require('../../config/environment');var attributes=require(_0x0afa('0x5'));module[_0x0afa('0x6')]=function(_0x3dab02,_0x20beda){return _0x3dab02[_0x0afa('0x7')](_0x0afa('0x8'),attributes,{'tableName':_0x0afa('0x9'),'paranoid':![],'indexes':[{'name':_0x0afa('0xa'),'fields':['idField',_0x0afa('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a46=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','idField','FieldId'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x5a46,0x68));var _0x65a4=function(_0x19ba79,_0x57cb16){_0x19ba79=_0x19ba79-0x0;var _0x966d6c=_0x5a46[_0x19ba79];return _0x966d6c;};'use strict';var _=require(_0x65a4('0x0'));var util=require(_0x65a4('0x1'));var logger=require(_0x65a4('0x2'))('api');var moment=require(_0x65a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x65a4('0x4'));var fs=require('fs');var path=require(_0x65a4('0x5'));var rimraf=require(_0x65a4('0x6'));var config=require('../../config/environment');var attributes=require(_0x65a4('0x7'));module[_0x65a4('0x8')]=function(_0x45930e,_0x17511d){return _0x45930e['define'](_0x65a4('0x9'),attributes,{'tableName':_0x65a4('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x65a4('0xb'),_0x65a4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 5bbc334..7ed4fc7 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 _0x0e83=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x369419,_0x3ba44f){var _0x34c545=function(_0x6ea6a3){while(--_0x6ea6a3){_0x369419['push'](_0x369419['shift']());}};_0x34c545(++_0x3ba44f);}(_0x0e83,0xad));var _0x30e8=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x0e83[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x30e8('0x0'));var util=require(_0x30e8('0x1'));var moment=require(_0x30e8('0x2'));var BPromise=require(_0x30e8('0x3'));var rs=require(_0x30e8('0x4'));var fs=require('fs');var Redis=require(_0x30e8('0x5'));var db=require(_0x30e8('0x6'))['db'];var utils=require(_0x30e8('0x7'));var logger=require(_0x30e8('0x8'))(_0x30e8('0x9'));var config=require(_0x30e8('0xa'));var jayson=require(_0x30e8('0xb'));var client=jayson[_0x30e8('0xc')][_0x30e8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4a846b,_0x526970,_0x3f69bf){return new BPromise(function(_0x50e903,_0x2d045a){return client[_0x30e8('0xe')](_0x4a846b,_0x3f69bf)[_0x30e8('0xf')](function(_0x2ce375){logger[_0x30e8('0x10')]('VtigerField,\x20%s,\x20%s',_0x526970,_0x30e8('0x11'));logger['debug'](_0x30e8('0x12'),_0x526970,_0x30e8('0x11'),JSON[_0x30e8('0x13')](_0x2ce375));if(_0x2ce375[_0x30e8('0x14')]){if(_0x2ce375['error']['code']===0x1f4){logger[_0x30e8('0x14')](_0x30e8('0x15'),_0x526970,_0x2ce375[_0x30e8('0x14')][_0x30e8('0x16')]);return _0x2d045a(_0x2ce375[_0x30e8('0x14')][_0x30e8('0x16')]);}logger[_0x30e8('0x14')](_0x30e8('0x15'),_0x526970,_0x2ce375[_0x30e8('0x14')]['message']);return _0x50e903(_0x2ce375[_0x30e8('0x14')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x526970,_0x30e8('0x11'));_0x50e903(_0x2ce375[_0x30e8('0x17')][_0x30e8('0x16')]);}})[_0x30e8('0x18')](function(_0x4a13af){logger[_0x30e8('0x14')](_0x30e8('0x15'),_0x526970,_0x4a13af);_0x2d045a(_0x4a13af);});});} \ No newline at end of file +var _0x9885=['then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x18e9f9,_0x4313c2){var _0x32922f=function(_0x2c3e81){while(--_0x2c3e81){_0x18e9f9['push'](_0x18e9f9['shift']());}};_0x32922f(++_0x4313c2);}(_0x9885,0x191));var _0x5988=function(_0x448faa,_0x12957d){_0x448faa=_0x448faa-0x0;var _0x5851f7=_0x9885[_0x448faa];return _0x5851f7;};'use strict';var _=require(_0x5988('0x0'));var util=require(_0x5988('0x1'));var moment=require(_0x5988('0x2'));var BPromise=require(_0x5988('0x3'));var rs=require(_0x5988('0x4'));var fs=require('fs');var Redis=require(_0x5988('0x5'));var db=require(_0x5988('0x6'))['db'];var utils=require(_0x5988('0x7'));var logger=require('../../config/logger')(_0x5988('0x8'));var config=require(_0x5988('0x9'));var jayson=require(_0x5988('0xa'));var client=jayson['client'][_0x5988('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x394436,_0x556bed,_0x4af41f){return new BPromise(function(_0x4888b6,_0x4bd76b){return client[_0x5988('0xc')](_0x394436,_0x4af41f)[_0x5988('0xd')](function(_0x12973c){logger[_0x5988('0xe')](_0x5988('0xf'),_0x556bed,_0x5988('0x10'));logger[_0x5988('0x11')](_0x5988('0x12'),_0x556bed,_0x5988('0x10'),JSON[_0x5988('0x13')](_0x12973c));if(_0x12973c[_0x5988('0x14')]){if(_0x12973c[_0x5988('0x14')][_0x5988('0x15')]===0x1f4){logger[_0x5988('0x14')](_0x5988('0xf'),_0x556bed,_0x12973c[_0x5988('0x14')]['message']);return _0x4bd76b(_0x12973c['error'][_0x5988('0x16')]);}logger[_0x5988('0x14')](_0x5988('0xf'),_0x556bed,_0x12973c['error'][_0x5988('0x16')]);return _0x4888b6(_0x12973c[_0x5988('0x14')][_0x5988('0x16')]);}else{logger[_0x5988('0xe')](_0x5988('0xf'),_0x556bed,_0x5988('0x10'));_0x4888b6(_0x12973c['result'][_0x5988('0x16')]);}})['catch'](function(_0x4702b6){logger[_0x5988('0x14')](_0x5988('0xf'),_0x556bed,_0x4702b6);_0x4bd76b(_0x4702b6);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 83085c5..42695d7 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 _0xb016=['/:id','update','delete','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','create','post'];(function(_0x5b80ff,_0x38517e){var _0x3cb5f5=function(_0x5566dd){while(--_0x5566dd){_0x5b80ff['push'](_0x5b80ff['shift']());}};_0x3cb5f5(++_0x38517e);}(_0xb016,0x159));var _0x6b01=function(_0x1ec856,_0x28c28d){_0x1ec856=_0x1ec856-0x0;var _0x2fe0b0=_0xb016[_0x1ec856];return _0x2fe0b0;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id/configurations',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0x7')](_0x6b01('0xc'),auth[_0x6b01('0x8')](),controller['getFields']);router['post']('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0xd')]);router[_0x6b01('0xe')]('/:id/configurations',auth[_0x6b01('0x8')](),controller['addConfiguration']);router['put'](_0x6b01('0xf'),auth['isAuthenticated'](),controller[_0x6b01('0x10')]);router[_0x6b01('0x11')]('/:id',auth[_0x6b01('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x563f=['exports','util','path','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0x563f,0x86));var _0xf563=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x563f[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xf563('0x0'));var path=require(_0xf563('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf563('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf563('0x3'));var config=require(_0xf563('0x4'));var controller=require(_0xf563('0x5'));router[_0xf563('0x6')]('/',auth[_0xf563('0x7')](),controller['index']);router[_0xf563('0x6')](_0xf563('0x8'),auth[_0xf563('0x7')](),controller[_0xf563('0x9')]);router[_0xf563('0x6')](_0xf563('0xa'),auth[_0xf563('0x7')](),controller[_0xf563('0xb')]);router[_0xf563('0x6')](_0xf563('0xc'),auth[_0xf563('0x7')](),controller[_0xf563('0xd')]);router[_0xf563('0xe')]('/',auth[_0xf563('0x7')](),controller['create']);router[_0xf563('0xe')](_0xf563('0xa'),auth[_0xf563('0x7')](),controller[_0xf563('0xf')]);router[_0xf563('0x10')](_0xf563('0x8'),auth[_0xf563('0x7')](),controller[_0xf563('0x11')]);router['delete'](_0xf563('0x8'),auth[_0xf563('0x7')](),controller['destroy']);module[_0xf563('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1c34449..addf1b8 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 _0x4991=['STRING','username','remoteUri','ENUM','password','integrationTab','newTab','sequelize'];(function(_0x401c21,_0x2e16d5){var _0x1a320e=function(_0x48065e){while(--_0x48065e){_0x401c21['push'](_0x401c21['shift']());}};_0x1a320e(++_0x2e16d5);}(_0x4991,0xf7));var _0x1499=function(_0x2fb7da,_0x8f5462){_0x2fb7da=_0x2fb7da-0x0;var _0x1cf459=_0x4991[_0x2fb7da];return _0x1cf459;};'use strict';var Sequelize=require(_0x1499('0x0'));module['exports']={'name':{'type':Sequelize[_0x1499('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1499('0x1')],'unique':_0x1499('0x2')},'password':{'type':Sequelize[_0x1499('0x1')]},'token':{'type':Sequelize[_0x1499('0x1')]},'remoteUri':{'type':Sequelize[_0x1499('0x1')],'unique':_0x1499('0x3')},'authType':{'type':Sequelize[_0x1499('0x4')](_0x1499('0x5'),'token'),'defaultValue':_0x1499('0x5')},'serverUrl':{'type':Sequelize[_0x1499('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1499('0x4')](_0x1499('0x6'),_0x1499('0x7')),'defaultValue':_0x1499('0x6')}}; \ No newline at end of file +var _0xd959=['password','token','integrationTab','newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x2fd02e,_0x8ebcc5){var _0x4d7f54=function(_0x1437c0){while(--_0x1437c0){_0x2fd02e['push'](_0x2fd02e['shift']());}};_0x4d7f54(++_0x8ebcc5);}(_0xd959,0x94));var _0x9d95=function(_0x4be2c0,_0x3a8f8d){_0x4be2c0=_0x4be2c0-0x0;var _0x21275d=_0xd959[_0x4be2c0];return _0x21275d;};'use strict';var Sequelize=require(_0x9d95('0x0'));module[_0x9d95('0x1')]={'name':{'type':Sequelize[_0x9d95('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9d95('0x2')],'unique':_0x9d95('0x3')},'password':{'type':Sequelize[_0x9d95('0x2')]},'token':{'type':Sequelize[_0x9d95('0x2')]},'remoteUri':{'type':Sequelize[_0x9d95('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x9d95('0x4')](_0x9d95('0x5'),_0x9d95('0x6')),'defaultValue':_0x9d95('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9d95('0x4')](_0x9d95('0x7'),_0x9d95('0x8')),'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 ae6fccd..d4487bc 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 _0x065e=['filter','merge','where','VIRTUAL','name','options','include','findAll','rows','catch','show','keys','intersection','includeAll','find','create','body','params','findOne','ZendeskConfiguration','rawAttributes','getConfigurations','nolimit','addConfiguration','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','statusCode','stringify','test','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','ZendeskAccount','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x5a15af,_0x4b40b){var _0x28f0b1=function(_0x37a9d3){while(--_0x37a9d3){_0x5a15af['push'](_0x5a15af['shift']());}};_0x28f0b1(++_0x4b40b);}(_0x065e,0x1a7));var _0xe065=function(_0x5758ea,_0x221181){_0x5758ea=_0x5758ea-0x0;var _0x37ff80=_0x065e[_0x5758ea];return _0x37ff80;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];var integrations=require(_0xe065('0x16'));function respondWithStatusCode(_0xf5ab44,_0x5bd30f){_0x5bd30f=_0x5bd30f||0xcc;return function(_0x3aa3be){if(_0x3aa3be){return _0xf5ab44[_0xe065('0x17')](_0x5bd30f);}return _0xf5ab44[_0xe065('0x18')](_0x5bd30f)[_0xe065('0x19')]();};}function respondWithResult(_0x29297b,_0x541985){_0x541985=_0x541985||0xc8;return function(_0x3d3557){if(_0x3d3557){return _0x29297b[_0xe065('0x18')](_0x541985)[_0xe065('0x1a')](_0x3d3557);}};}function respondWithFilteredResult(_0xc5ef4f,_0x434e07){return function(_0x352206){if(_0x352206){var _0x2e5feb=typeof _0x434e07['offset']===_0xe065('0x1b')&&typeof _0x434e07[_0xe065('0x1c')]==='undefined';var _0x2bfec0=_0x352206[_0xe065('0x1d')];var _0x397f05=_0x2e5feb?0x0:_0x434e07[_0xe065('0x1e')];var _0x1e7177=_0x2e5feb?_0x352206[_0xe065('0x1d')]:_0x434e07[_0xe065('0x1e')]+_0x434e07['limit'];var _0x45479e;if(_0x1e7177>=_0x2bfec0){_0x1e7177=_0x2bfec0;_0x45479e=0xc8;}else{_0x45479e=0xce;}_0xc5ef4f['status'](_0x45479e);return _0xc5ef4f[_0xe065('0x1f')](_0xe065('0x20'),_0x397f05+'-'+_0x1e7177+'/'+_0x2bfec0)['json'](_0x352206);}return null;};}function patchUpdates(_0x1c6567){return function(_0x587d47){try{jsonpatch[_0xe065('0x21')](_0x587d47,_0x1c6567,!![]);}catch(_0x5fe80){return BPromise[_0xe065('0x22')](_0x5fe80);}return _0x587d47[_0xe065('0x23')]();};}function saveUpdates(_0x3ecd13,_0x105cb2){return function(_0x22a0cb){if(_0x22a0cb){return _0x22a0cb[_0xe065('0x24')](_0x3ecd13)[_0xe065('0x25')](function(_0x5081a3){return _0x5081a3;});}return null;};}function removeEntity(_0x7208af,_0x43b712){return function(_0x44ec95){if(_0x44ec95){return _0x44ec95[_0xe065('0x26')]()['then'](function(){_0x7208af['status'](0xcc)[_0xe065('0x19')]();});}};}function handleEntityNotFound(_0x530dc0,_0x14e6b6){return function(_0x27e669){if(!_0x27e669){_0x530dc0[_0xe065('0x17')](0x194);}return _0x27e669;};}function handleError(_0x15b598,_0x418731){_0x418731=_0x418731||0x1f4;return function(_0x3ec154){logger[_0xe065('0x27')](_0x3ec154[_0xe065('0x28')]);if(_0x3ec154['name']){delete _0x3ec154['name'];}_0x15b598[_0xe065('0x18')](_0x418731)[_0xe065('0x29')](_0x3ec154);};}exports[_0xe065('0x2a')]=function(_0x441e96,_0x5b1220){var _0x23f573={},_0x55ecaa={},_0x522420={'count':0x0,'rows':[]};var _0x182743=_[_0xe065('0x2b')](db[_0xe065('0x2c')]['rawAttributes'],function(_0x883747){return{'name':_0x883747['fieldName'],'type':_0x883747[_0xe065('0x2d')][_0xe065('0x2e')]};});_0x55ecaa[_0xe065('0x2f')]=_[_0xe065('0x2b')](_0x182743,'name');_0x55ecaa[_0xe065('0x30')]=_['keys'](_0x441e96[_0xe065('0x30')]);_0x55ecaa[_0xe065('0x31')]=_['intersection'](_0x55ecaa[_0xe065('0x2f')],_0x55ecaa['query']);_0x23f573[_0xe065('0x32')]=_['intersection'](_0x55ecaa[_0xe065('0x2f')],qs[_0xe065('0x33')](_0x441e96[_0xe065('0x30')][_0xe065('0x33')]));_0x23f573['attributes']=_0x23f573[_0xe065('0x32')][_0xe065('0x34')]?_0x23f573[_0xe065('0x32')]:_0x55ecaa[_0xe065('0x2f')];if(!_0x441e96[_0xe065('0x30')][_0xe065('0x35')]('nolimit')){_0x23f573[_0xe065('0x1c')]=qs[_0xe065('0x1c')](_0x441e96['query'][_0xe065('0x1c')]);_0x23f573[_0xe065('0x1e')]=qs[_0xe065('0x1e')](_0x441e96[_0xe065('0x30')][_0xe065('0x1e')]);}_0x23f573[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x441e96['query'][_0xe065('0x37')]);_0x23f573['where']=qs[_0xe065('0x31')](_[_0xe065('0x38')](_0x441e96[_0xe065('0x30')],_0x55ecaa[_0xe065('0x31')]),_0x182743);if(_0x441e96[_0xe065('0x30')][_0xe065('0x39')]){_0x23f573['where']=_[_0xe065('0x3a')](_0x23f573[_0xe065('0x3b')],{'$or':_[_0xe065('0x2b')](_0x182743,function(_0x4c6a77){if(_0x4c6a77[_0xe065('0x2d')]!==_0xe065('0x3c')){var _0x1b273d={};_0x1b273d[_0x4c6a77[_0xe065('0x3d')]]={'$like':'%'+_0x441e96[_0xe065('0x30')]['filter']+'%'};return _0x1b273d;}})});}_0x23f573=_[_0xe065('0x3a')]({},_0x23f573,_0x441e96[_0xe065('0x3e')]);var _0x5d4f19={'where':_0x23f573[_0xe065('0x3b')]};return db['ZendeskAccount'][_0xe065('0x1d')](_0x5d4f19)[_0xe065('0x25')](function(_0x4a3152){_0x522420[_0xe065('0x1d')]=_0x4a3152;if(_0x441e96[_0xe065('0x30')]['includeAll']){_0x23f573[_0xe065('0x3f')]=[{'all':!![]}];}return db[_0xe065('0x2c')][_0xe065('0x40')](_0x23f573);})[_0xe065('0x25')](function(_0x3a617c){_0x522420[_0xe065('0x41')]=_0x3a617c;return _0x522420;})[_0xe065('0x25')](respondWithFilteredResult(_0x5b1220,_0x23f573))[_0xe065('0x42')](handleError(_0x5b1220,null));};exports[_0xe065('0x43')]=function(_0x445738,_0x326493){var _0x4364c3={'raw':![],'where':{'id':_0x445738['params']['id']}},_0x137627={};_0x137627['model']=_[_0xe065('0x44')](db[_0xe065('0x2c')]['rawAttributes']);_0x137627[_0xe065('0x30')]=_[_0xe065('0x44')](_0x445738[_0xe065('0x30')]);_0x137627[_0xe065('0x31')]=_[_0xe065('0x45')](_0x137627[_0xe065('0x2f')],_0x137627[_0xe065('0x30')]);_0x4364c3[_0xe065('0x32')]=_[_0xe065('0x45')](_0x137627['model'],qs[_0xe065('0x33')](_0x445738[_0xe065('0x30')][_0xe065('0x33')]));_0x4364c3['attributes']=_0x4364c3[_0xe065('0x32')][_0xe065('0x34')]?_0x4364c3[_0xe065('0x32')]:_0x137627[_0xe065('0x2f')];if(_0x445738['query'][_0xe065('0x46')]){_0x4364c3[_0xe065('0x3f')]=[{'all':!![]}];}_0x4364c3=_[_0xe065('0x3a')]({},_0x4364c3,_0x445738[_0xe065('0x3e')]);return db[_0xe065('0x2c')][_0xe065('0x47')](_0x4364c3)[_0xe065('0x25')](handleEntityNotFound(_0x326493,null))['then'](respondWithResult(_0x326493,null))[_0xe065('0x42')](handleError(_0x326493,null));};exports[_0xe065('0x48')]=function(_0x335744,_0xe9f589){return db[_0xe065('0x2c')][_0xe065('0x48')](_0x335744[_0xe065('0x49')],{})['then'](respondWithResult(_0xe9f589,0xc9))[_0xe065('0x42')](handleError(_0xe9f589,null));};exports['update']=function(_0x45fe1f,_0x2d2e63){if(_0x45fe1f[_0xe065('0x49')]['id']){delete _0x45fe1f['body']['id'];}return db[_0xe065('0x2c')][_0xe065('0x47')]({'where':{'id':_0x45fe1f[_0xe065('0x4a')]['id']}})[_0xe065('0x25')](handleEntityNotFound(_0x2d2e63,null))[_0xe065('0x25')](saveUpdates(_0x45fe1f[_0xe065('0x49')],null))[_0xe065('0x25')](respondWithResult(_0x2d2e63,null))[_0xe065('0x42')](handleError(_0x2d2e63,null));};exports[_0xe065('0x26')]=function(_0x2ca55a,_0x3f91a2){return db[_0xe065('0x2c')][_0xe065('0x47')]({'where':{'id':_0x2ca55a['params']['id']}})['then'](handleEntityNotFound(_0x3f91a2,null))['then'](removeEntity(_0x3f91a2,null))[_0xe065('0x42')](handleError(_0x3f91a2,null));};exports['getConfigurations']=function(_0x105bf7,_0x2c5e42,_0x5a7a98){var _0x480aec={};var _0x45a60e={};var _0x20272a;var _0x5cce78;return db[_0xe065('0x2c')][_0xe065('0x4b')]({'where':{'id':_0x105bf7[_0xe065('0x4a')]['id']}})[_0xe065('0x25')](handleEntityNotFound(_0x2c5e42,null))[_0xe065('0x25')](function(_0x1ea568){if(_0x1ea568){_0x20272a=_0x1ea568;_0x45a60e[_0xe065('0x2f')]=_[_0xe065('0x44')](db[_0xe065('0x4c')][_0xe065('0x4d')]);_0x45a60e['query']=_[_0xe065('0x44')](_0x105bf7[_0xe065('0x30')]);_0x45a60e[_0xe065('0x31')]=_[_0xe065('0x45')](_0x45a60e['model'],_0x45a60e[_0xe065('0x30')]);_0x480aec[_0xe065('0x32')]=_[_0xe065('0x45')](_0x45a60e[_0xe065('0x2f')],qs['fields'](_0x105bf7[_0xe065('0x30')][_0xe065('0x33')]));_0x480aec[_0xe065('0x32')]=_0x480aec['attributes'][_0xe065('0x34')]?_0x480aec[_0xe065('0x32')]:_0x45a60e[_0xe065('0x2f')];_0x480aec[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x105bf7[_0xe065('0x30')][_0xe065('0x37')]);_0x480aec[_0xe065('0x3b')]=qs[_0xe065('0x31')](_['pick'](_0x105bf7[_0xe065('0x30')],_0x45a60e['filters']));if(_0x105bf7[_0xe065('0x30')][_0xe065('0x39')]){_0x480aec[_0xe065('0x3b')]=_['merge'](_0x480aec['where'],{'$or':_['map'](_0x480aec[_0xe065('0x32')],function(_0x380664){var _0x82a39f={};_0x82a39f[_0x380664]={'$like':'%'+_0x105bf7[_0xe065('0x30')][_0xe065('0x39')]+'%'};return _0x82a39f;})});}_0x480aec=_[_0xe065('0x3a')]({},_0x480aec,_0x105bf7[_0xe065('0x3e')]);return _0x20272a[_0xe065('0x4e')](_0x480aec);}})[_0xe065('0x25')](function(_0x3169fa){if(_0x3169fa){_0x5cce78=_0x3169fa[_0xe065('0x34')];if(!_0x105bf7['query']['hasOwnProperty'](_0xe065('0x4f'))){_0x480aec[_0xe065('0x1c')]=qs['limit'](_0x105bf7[_0xe065('0x30')]['limit']);_0x480aec['offset']=qs[_0xe065('0x1e')](_0x105bf7[_0xe065('0x30')][_0xe065('0x1e')]);}return _0x20272a[_0xe065('0x4e')](_0x480aec);}})[_0xe065('0x25')](function(_0x817baf){if(_0x817baf){return _0x817baf?{'count':_0x5cce78,'rows':_0x817baf}:null;}})[_0xe065('0x25')](respondWithResult(_0x2c5e42,null))['catch'](handleError(_0x2c5e42,null));};exports[_0xe065('0x50')]=function(_0x265c5e,_0xaef095,_0xb3591e){if(_0x265c5e[_0xe065('0x49')]['id']){delete _0x265c5e['body']['id'];}return db[_0xe065('0x2c')][_0xe065('0x4b')]({'where':{'id':_0x265c5e[_0xe065('0x4a')]['id']}})[_0xe065('0x25')](handleEntityNotFound(_0xaef095,null))[_0xe065('0x25')](function(_0xfce2e){if(_0xfce2e){_0x265c5e['body']['AccountId']=_0xfce2e['id'];_0x265c5e['body']['Subjects']=integrations['getSubjects'](_0x265c5e[_0xe065('0x49')][_0xe065('0x51')],_0x265c5e[_0xe065('0x49')][_0xe065('0x2d')]);_0x265c5e[_0xe065('0x49')][_0xe065('0x52')]=integrations[_0xe065('0x53')](_0x265c5e[_0xe065('0x49')]['channel'],_0x265c5e['body'][_0xe065('0x2d')]);return db[_0xe065('0x4c')][_0xe065('0x48')](_0x265c5e['body'],{'include':[{'model':db[_0xe065('0x54')],'as':_0xe065('0x55')},{'model':db[_0xe065('0x54')],'as':_0xe065('0x52')}]});}return null;})[_0xe065('0x25')](respondWithResult(_0xaef095,null))[_0xe065('0x42')](handleError(_0xaef095,null));};exports[_0xe065('0x56')]=function(_0x199ca3,_0x27863d,_0xecef2){var _0x213feb='';return db[_0xe065('0x2c')][_0xe065('0x4b')]({'where':{'id':_0x199ca3[_0xe065('0x4a')]['id']},'attributes':['id',_0xe065('0x57'),_0xe065('0x58'),_0xe065('0x59'),_0xe065('0x5a'),'remoteUri']})[_0xe065('0x25')](handleEntityNotFound(_0x27863d,null))[_0xe065('0x25')](function(_0x233a43){if(_0x233a43){_0x213feb=_0x233a43[_0xe065('0x5b')];var _0x36b88d=_0x213feb[_0xe065('0x5c')](-0x1);if(_0x36b88d==='/'){_0x213feb=_0x213feb[_0xe065('0x5d')](0x0,_0x213feb[_0xe065('0x5e')](_0x36b88d));}var _0x3364c7={'method':_0xe065('0x5f'),'uri':util[_0xe065('0x60')](_0xe065('0x61'),_0x213feb,_0xe065('0x62')),'json':!![]};switch(_0x233a43[_0xe065('0x5a')]){case _0xe065('0x58'):_0x3364c7[_0xe065('0x63')]={'Authorization':util[_0xe065('0x60')]('Basic\x20%s',new Buffer(util[_0xe065('0x60')](_0xe065('0x64'),_0x233a43[_0xe065('0x57')],_0x233a43[_0xe065('0x58')]))[_0xe065('0x65')](_0xe065('0x66')))};break;case _0xe065('0x59'):_0x3364c7[_0xe065('0x63')]={'Authorization':util[_0xe065('0x60')](_0xe065('0x67'),new Buffer(util['format']('%s/token:%s',_0x233a43[_0xe065('0x57')],_0x233a43['token']))[_0xe065('0x65')]('base64'))};break;default:throw new db[(_0xe065('0x68'))][(_0xe065('0x69'))](_0xe065('0x6a'));}return rp(_0x3364c7);}})[_0xe065('0x25')](function(_0x42cb90){if(_0x42cb90){var _0x3318d4=[_0xe065('0x6b'),_0xe065('0x6c'),_0xe065('0x6d'),'assignee'];_[_0xe065('0x6e')](_0x42cb90[_0xe065('0x62')],function(_0x134d0a){return _0x3318d4[_0xe065('0x6f')](_0x134d0a['type']);});return{'count':_0x42cb90[_0xe065('0x62')][_0xe065('0x34')],'rows':_[_0xe065('0x2b')](_0x42cb90['ticket_fields'],function(_0x200d25){return{'id':_0x200d25['id'],'name':_0x200d25[_0xe065('0x70')]>0x7?_0x200d25[_0xe065('0x71')]:_0x200d25['type'],'custom':_0x200d25[_0xe065('0x70')]>0x7?!![]:![],'options':_0x200d25[_0xe065('0x72')]?_0x200d25['system_field_options']:_0x200d25['custom_field_options']?_0x200d25[_0xe065('0x73')]:[]};})};}})[_0xe065('0x25')](respondWithResult(_0x27863d,null))[_0xe065('0x42')](function(_0x3f3878){var _0x260588=_0x199ca3['query']['test']?0x1f4:_0x3f3878[_0xe065('0x74')]||0x1f4;logger[_0xe065('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xe065('0x56'),_0x260588,JSON[_0xe065('0x75')](_0x3f3878));delete _0x3f3878[_0xe065('0x3d')];if(_0x260588===0x191){_0x260588=0x190;}_0x27863d[_0xe065('0x18')](_0x260588)[_0xe065('0x29')](_0x199ca3[_0xe065('0x30')][_0xe065('0x76')]?{'message':_0xe065('0x77'),'statusCode':_0x3f3878[_0xe065('0x74')]}:_0x3f3878);});}; \ No newline at end of file +var _0x351d=['Subjects','Descriptions','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','%s/%s','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','stack','index','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','ZendeskAccount','includeAll','findAll','catch','params','include','find','create','body','update','findOne','ZendeskConfiguration','order','sort','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','channel','ZendeskField'];(function(_0x3578f7,_0x596166){var _0x2af14c=function(_0x12fee0){while(--_0x12fee0){_0x3578f7['push'](_0x3578f7['shift']());}};_0x2af14c(++_0x596166);}(_0x351d,0x90));var _0xd351=function(_0x220476,_0x33807c){_0x220476=_0x220476-0x0;var _0x29cf54=_0x351d[_0x220476];return _0x29cf54;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd351('0x13'));function respondWithStatusCode(_0x15549a,_0x23445f){_0x23445f=_0x23445f||0xcc;return function(_0x1eb2a9){if(_0x1eb2a9){return _0x15549a['sendStatus'](_0x23445f);}return _0x15549a[_0xd351('0x14')](_0x23445f)[_0xd351('0x15')]();};}function respondWithResult(_0x597d7c,_0xc5a145){_0xc5a145=_0xc5a145||0xc8;return function(_0xb106ef){if(_0xb106ef){return _0x597d7c[_0xd351('0x14')](_0xc5a145)[_0xd351('0x16')](_0xb106ef);}};}function respondWithFilteredResult(_0x3867fb,_0x4d238c){return function(_0x9f790f){if(_0x9f790f){var _0x49d8bb=typeof _0x4d238c['offset']===_0xd351('0x17')&&typeof _0x4d238c['limit']===_0xd351('0x17');var _0x1de35f=_0x9f790f[_0xd351('0x18')];var _0x4c6693=_0x49d8bb?0x0:_0x4d238c[_0xd351('0x19')];var _0x2bfc53=_0x49d8bb?_0x9f790f[_0xd351('0x18')]:_0x4d238c[_0xd351('0x19')]+_0x4d238c['limit'];var _0xc2d2c0;if(_0x2bfc53>=_0x1de35f){_0x2bfc53=_0x1de35f;_0xc2d2c0=0xc8;}else{_0xc2d2c0=0xce;}_0x3867fb['status'](_0xc2d2c0);return _0x3867fb['set'](_0xd351('0x1a'),_0x4c6693+'-'+_0x2bfc53+'/'+_0x1de35f)['json'](_0x9f790f);}return null;};}function patchUpdates(_0x33b1e5){return function(_0x2d75dd){try{jsonpatch[_0xd351('0x1b')](_0x2d75dd,_0x33b1e5,!![]);}catch(_0x42631b){return BPromise[_0xd351('0x1c')](_0x42631b);}return _0x2d75dd['save']();};}function saveUpdates(_0x18625b,_0xbbc58){return function(_0x241265){if(_0x241265){return _0x241265['update'](_0x18625b)[_0xd351('0x1d')](function(_0x2d9aa0){return _0x2d9aa0;});}return null;};}function removeEntity(_0x365bbc,_0x59fb6d){return function(_0x1ce279){if(_0x1ce279){return _0x1ce279[_0xd351('0x1e')]()[_0xd351('0x1d')](function(){_0x365bbc[_0xd351('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f7f3,_0x483c92){return function(_0x358bff){if(!_0x358bff){_0x40f7f3[_0xd351('0x1f')](0x194);}return _0x358bff;};}function handleError(_0x54f471,_0x2648d0){_0x2648d0=_0x2648d0||0x1f4;return function(_0x55b4d3){logger['error'](_0x55b4d3[_0xd351('0x20')]);if(_0x55b4d3['name']){delete _0x55b4d3['name'];}_0x54f471[_0xd351('0x14')](_0x2648d0)['send'](_0x55b4d3);};}exports[_0xd351('0x21')]=function(_0x2ddae8,_0x407b50){var _0x4d3f48={},_0x71ce9c={},_0x4aa902={'count':0x0,'rows':[]};var _0x1c826b=_['map'](db['ZendeskAccount'][_0xd351('0x22')],function(_0x38c82f){return{'name':_0x38c82f[_0xd351('0x23')],'type':_0x38c82f[_0xd351('0x24')]['key']};});_0x71ce9c[_0xd351('0x25')]=_[_0xd351('0x26')](_0x1c826b,_0xd351('0x27'));_0x71ce9c[_0xd351('0x28')]=_[_0xd351('0x29')](_0x2ddae8[_0xd351('0x28')]);_0x71ce9c[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],_0x71ce9c['query']);_0x4d3f48[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x2ddae8['query'][_0xd351('0x2d')]));_0x4d3f48[_0xd351('0x2c')]=_0x4d3f48[_0xd351('0x2c')][_0xd351('0x2e')]?_0x4d3f48[_0xd351('0x2c')]:_0x71ce9c[_0xd351('0x25')];if(!_0x2ddae8[_0xd351('0x28')][_0xd351('0x2f')](_0xd351('0x30'))){_0x4d3f48['limit']=qs['limit'](_0x2ddae8[_0xd351('0x28')][_0xd351('0x31')]);_0x4d3f48[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x2ddae8[_0xd351('0x28')][_0xd351('0x19')]);}_0x4d3f48['order']=qs['sort'](_0x2ddae8[_0xd351('0x28')]['sort']);_0x4d3f48[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x2ddae8[_0xd351('0x28')],_0x71ce9c[_0xd351('0x2a')]),_0x1c826b);if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]){_0x4d3f48[_0xd351('0x32')]=_[_0xd351('0x35')](_0x4d3f48[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x1c826b,function(_0x4b15db){if(_0x4b15db[_0xd351('0x24')]!=='VIRTUAL'){var _0x22631={};_0x22631[_0x4b15db[_0xd351('0x27')]]={'$like':'%'+_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]+'%'};return _0x22631;}})});}_0x4d3f48=_[_0xd351('0x35')]({},_0x4d3f48,_0x2ddae8[_0xd351('0x36')]);var _0x545bfc={'where':_0x4d3f48[_0xd351('0x32')]};return db[_0xd351('0x37')]['count'](_0x545bfc)[_0xd351('0x1d')](function(_0x2d8ea8){_0x4aa902[_0xd351('0x18')]=_0x2d8ea8;if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x38')]){_0x4d3f48['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xd351('0x39')](_0x4d3f48);})[_0xd351('0x1d')](function(_0x5dae6d){_0x4aa902['rows']=_0x5dae6d;return _0x4aa902;})[_0xd351('0x1d')](respondWithFilteredResult(_0x407b50,_0x4d3f48))[_0xd351('0x3a')](handleError(_0x407b50,null));};exports['show']=function(_0x570d57,_0x46af23){var _0x18f9d1={'raw':![],'where':{'id':_0x570d57[_0xd351('0x3b')]['id']}},_0x3b8526={};_0x3b8526[_0xd351('0x25')]=_[_0xd351('0x29')](db[_0xd351('0x37')][_0xd351('0x22')]);_0x3b8526[_0xd351('0x28')]=_['keys'](_0x570d57['query']);_0x3b8526[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],_0x3b8526[_0xd351('0x28')]);_0x18f9d1[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x570d57[_0xd351('0x28')][_0xd351('0x2d')]));_0x18f9d1[_0xd351('0x2c')]=_0x18f9d1[_0xd351('0x2c')][_0xd351('0x2e')]?_0x18f9d1[_0xd351('0x2c')]:_0x3b8526[_0xd351('0x25')];if(_0x570d57[_0xd351('0x28')]['includeAll']){_0x18f9d1[_0xd351('0x3c')]=[{'all':!![]}];}_0x18f9d1=_[_0xd351('0x35')]({},_0x18f9d1,_0x570d57[_0xd351('0x36')]);return db['ZendeskAccount'][_0xd351('0x3d')](_0x18f9d1)[_0xd351('0x1d')](handleEntityNotFound(_0x46af23,null))[_0xd351('0x1d')](respondWithResult(_0x46af23,null))[_0xd351('0x3a')](handleError(_0x46af23,null));};exports[_0xd351('0x3e')]=function(_0x5bc86a,_0x5adea4){return db['ZendeskAccount'][_0xd351('0x3e')](_0x5bc86a[_0xd351('0x3f')],{})['then'](respondWithResult(_0x5adea4,0xc9))['catch'](handleError(_0x5adea4,null));};exports[_0xd351('0x40')]=function(_0x444206,_0x2af877){if(_0x444206['body']['id']){delete _0x444206[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')]['find']({'where':{'id':_0x444206[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2af877,null))[_0xd351('0x1d')](saveUpdates(_0x444206[_0xd351('0x3f')],null))['then'](respondWithResult(_0x2af877,null))['catch'](handleError(_0x2af877,null));};exports[_0xd351('0x1e')]=function(_0x58ce5a,_0xf9f375){return db[_0xd351('0x37')][_0xd351('0x3d')]({'where':{'id':_0x58ce5a['params']['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0xf9f375,null))['then'](removeEntity(_0xf9f375,null))['catch'](handleError(_0xf9f375,null));};exports['getConfigurations']=function(_0x7e4bad,_0x292af3,_0x334029){var _0x5a2e9b={};var _0x554e3a={};var _0x1748f0;var _0x42f248;return db['ZendeskAccount'][_0xd351('0x41')]({'where':{'id':_0x7e4bad[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x292af3,null))[_0xd351('0x1d')](function(_0x59ab0f){if(_0x59ab0f){_0x1748f0=_0x59ab0f;_0x554e3a[_0xd351('0x25')]=_['keys'](db[_0xd351('0x42')][_0xd351('0x22')]);_0x554e3a[_0xd351('0x28')]=_[_0xd351('0x29')](_0x7e4bad[_0xd351('0x28')]);_0x554e3a[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x554e3a['model'],_0x554e3a['query']);_0x5a2e9b[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x554e3a['model'],qs[_0xd351('0x2d')](_0x7e4bad[_0xd351('0x28')][_0xd351('0x2d')]));_0x5a2e9b['attributes']=_0x5a2e9b[_0xd351('0x2c')]['length']?_0x5a2e9b['attributes']:_0x554e3a[_0xd351('0x25')];_0x5a2e9b[_0xd351('0x43')]=qs['sort'](_0x7e4bad[_0xd351('0x28')][_0xd351('0x44')]);_0x5a2e9b[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x7e4bad[_0xd351('0x28')],_0x554e3a['filters']));if(_0x7e4bad[_0xd351('0x28')][_0xd351('0x34')]){_0x5a2e9b[_0xd351('0x32')]=_[_0xd351('0x35')](_0x5a2e9b[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x5a2e9b[_0xd351('0x2c')],function(_0x4b2029){var _0x24dcdb={};_0x24dcdb[_0x4b2029]={'$like':'%'+_0x7e4bad['query'][_0xd351('0x34')]+'%'};return _0x24dcdb;})});}_0x5a2e9b=_[_0xd351('0x35')]({},_0x5a2e9b,_0x7e4bad[_0xd351('0x36')]);return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x4eaf18){if(_0x4eaf18){_0x42f248=_0x4eaf18[_0xd351('0x2e')];if(!_0x7e4bad['query'][_0xd351('0x2f')](_0xd351('0x30'))){_0x5a2e9b[_0xd351('0x31')]=qs[_0xd351('0x31')](_0x7e4bad[_0xd351('0x28')]['limit']);_0x5a2e9b['offset']=qs[_0xd351('0x19')](_0x7e4bad[_0xd351('0x28')]['offset']);}return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x2718e9){if(_0x2718e9){return _0x2718e9?{'count':_0x42f248,'rows':_0x2718e9}:null;}})['then'](respondWithResult(_0x292af3,null))[_0xd351('0x3a')](handleError(_0x292af3,null));};exports[_0xd351('0x46')]=function(_0x284d12,_0x5dbdef,_0x5d13ec){if(_0x284d12['body']['id']){delete _0x284d12[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x284d12[_0xd351('0x3b')]['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0x5dbdef,null))[_0xd351('0x1d')](function(_0x2c83fe){if(_0x2c83fe){_0x284d12['body'][_0xd351('0x47')]=_0x2c83fe['id'];_0x284d12['body']['Subjects']=integrations[_0xd351('0x48')](_0x284d12[_0xd351('0x3f')]['channel'],_0x284d12[_0xd351('0x3f')]['type']);_0x284d12['body']['Descriptions']=integrations[_0xd351('0x49')](_0x284d12[_0xd351('0x3f')][_0xd351('0x4a')],_0x284d12['body'][_0xd351('0x24')]);return db[_0xd351('0x42')][_0xd351('0x3e')](_0x284d12[_0xd351('0x3f')],{'include':[{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4c')},{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4d')}]});}return null;})[_0xd351('0x1d')](respondWithResult(_0x5dbdef,null))[_0xd351('0x3a')](handleError(_0x5dbdef,null));};exports[_0xd351('0x4e')]=function(_0x4d20af,_0x2fcede,_0x2d59a5){var _0x431e91='';return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x4d20af[_0xd351('0x3b')]['id']},'attributes':['id','username',_0xd351('0x4f'),_0xd351('0x50'),'authType','remoteUri']})[_0xd351('0x1d')](handleEntityNotFound(_0x2fcede,null))[_0xd351('0x1d')](function(_0x44dc58){if(_0x44dc58){_0x431e91=_0x44dc58[_0xd351('0x51')];var _0x1db455=_0x431e91[_0xd351('0x52')](-0x1);if(_0x1db455==='/'){_0x431e91=_0x431e91[_0xd351('0x53')](0x0,_0x431e91[_0xd351('0x54')](_0x1db455));}var _0x3ce2b9={'method':'GET','uri':util[_0xd351('0x55')](_0xd351('0x56'),_0x431e91,'ticket_fields'),'json':!![]};switch(_0x44dc58[_0xd351('0x57')]){case'password':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util['format'](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5a'),_0x44dc58[_0xd351('0x5b')],_0x44dc58[_0xd351('0x4f')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;case'token':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util[_0xd351('0x55')](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5e'),_0x44dc58['username'],_0x44dc58[_0xd351('0x50')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;default:throw new db['Sequelize'][(_0xd351('0x5f'))](_0xd351('0x60'));}return rp(_0x3ce2b9);}})[_0xd351('0x1d')](function(_0x3f0d27){if(_0x3f0d27){var _0x3635ad=[_0xd351('0x61'),_0xd351('0x62'),_0xd351('0x63'),_0xd351('0x64')];_['remove'](_0x3f0d27[_0xd351('0x65')],function(_0x190a00){return _0x3635ad['includes'](_0x190a00[_0xd351('0x24')]);});return{'count':_0x3f0d27['ticket_fields']['length'],'rows':_['map'](_0x3f0d27[_0xd351('0x65')],function(_0x3367f8){return{'id':_0x3367f8['id'],'name':_0x3367f8[_0xd351('0x66')]>0x7?_0x3367f8['title']:_0x3367f8[_0xd351('0x24')],'custom':_0x3367f8['position']>0x7?!![]:![],'options':_0x3367f8[_0xd351('0x67')]?_0x3367f8['system_field_options']:_0x3367f8[_0xd351('0x68')]?_0x3367f8[_0xd351('0x68')]:[]};})};}})[_0xd351('0x1d')](respondWithResult(_0x2fcede,null))[_0xd351('0x3a')](function(_0x35b148){var _0x1bb955=_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?0x1f4:_0x35b148[_0xd351('0x6a')]||0x1f4;logger[_0xd351('0x6b')](_0xd351('0x6c'),_0xd351('0x4e'),_0x1bb955,JSON['stringify'](_0x35b148));delete _0x35b148[_0xd351('0x27')];if(_0x1bb955===0x191){_0x1bb955=0x190;}_0x2fcede[_0xd351('0x14')](_0x1bb955)[_0xd351('0x6d')](_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x35b148[_0xd351('0x6a')]}:_0x35b148);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8fa6642..21cbcb0 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 _0xab74=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x30e07b,_0x598b6d){var _0x4bf97e=function(_0x1d2ca2){while(--_0x1d2ca2){_0x30e07b['push'](_0x30e07b['shift']());}};_0x4bf97e(++_0x598b6d);}(_0xab74,0x13f));var _0x4ab7=function(_0xf177ab,_0x2c2552){_0xf177ab=_0xf177ab-0x0;var _0x180634=_0xab74[_0xf177ab];return _0x180634;};'use strict';var _=require(_0x4ab7('0x0'));var util=require('util');var logger=require(_0x4ab7('0x1'))('api');var moment=require(_0x4ab7('0x2'));var BPromise=require(_0x4ab7('0x3'));var rp=require(_0x4ab7('0x4'));var fs=require('fs');var path=require(_0x4ab7('0x5'));var rimraf=require(_0x4ab7('0x6'));var config=require('../../config/environment');var attributes=require(_0x4ab7('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5a6d24,_0x5716b5){return _0x5a6d24[_0x4ab7('0x8')](_0x4ab7('0x9'),attributes,{'tableName':_0x4ab7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa70a=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1e5ad0,_0x58ffe3){var _0x46da3b=function(_0x37d2f6){while(--_0x37d2f6){_0x1e5ad0['push'](_0x1e5ad0['shift']());}};_0x46da3b(++_0x58ffe3);}(_0xa70a,0x1c0));var _0xaa70=function(_0x1c1a4d,_0x46b403){_0x1c1a4d=_0x1c1a4d-0x0;var _0x3c17ea=_0xa70a[_0x1c1a4d];return _0x3c17ea;};'use strict';var _=require(_0xaa70('0x0'));var util=require(_0xaa70('0x1'));var logger=require(_0xaa70('0x2'))(_0xaa70('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa70('0x4'));var fs=require('fs');var path=require(_0xaa70('0x5'));var rimraf=require(_0xaa70('0x6'));var config=require(_0xaa70('0x7'));var attributes=require(_0xaa70('0x8'));var integrations=require(_0xaa70('0x9'));module[_0xaa70('0xa')]=function(_0x47fb20,_0x5345be){return _0x47fb20['define'](_0xaa70('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 6cdb4f0..9fcb459 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 _0xd98d=['error','code','message','result','catch','GetZendeskAccount','findAll','raw','options','where','attributes','limit','include','map','model','ShowZendeskAccount','ZendeskAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xd98d,0x1ee));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdd98('0x0'));var util=require(_0xdd98('0x1'));var moment=require('moment');var BPromise=require(_0xdd98('0x2'));var rs=require(_0xdd98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd98('0x4'))['db'];var utils=require(_0xdd98('0x5'));var logger=require(_0xdd98('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdd98('0x7')][_0xdd98('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47a4ee,_0x37bd48,_0x1b51a5){return new BPromise(function(_0x2e1f4a,_0x8c5ccc){return client[_0xdd98('0x9')](_0x47a4ee,_0x1b51a5)[_0xdd98('0xa')](function(_0x1cdb73){logger[_0xdd98('0xb')](_0xdd98('0xc'),_0x37bd48,_0xdd98('0xd'));logger[_0xdd98('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x37bd48,_0xdd98('0xd'),JSON[_0xdd98('0xf')](_0x1cdb73));if(_0x1cdb73[_0xdd98('0x10')]){if(_0x1cdb73[_0xdd98('0x10')][_0xdd98('0x11')]===0x1f4){logger[_0xdd98('0x10')](_0xdd98('0xc'),_0x37bd48,_0x1cdb73['error'][_0xdd98('0x12')]);return _0x8c5ccc(_0x1cdb73['error'][_0xdd98('0x12')]);}logger[_0xdd98('0x10')](_0xdd98('0xc'),_0x37bd48,_0x1cdb73[_0xdd98('0x10')][_0xdd98('0x12')]);return _0x2e1f4a(_0x1cdb73[_0xdd98('0x10')][_0xdd98('0x12')]);}else{logger[_0xdd98('0xb')](_0xdd98('0xc'),_0x37bd48,'request\x20sent');_0x2e1f4a(_0x1cdb73[_0xdd98('0x13')][_0xdd98('0x12')]);}})[_0xdd98('0x14')](function(_0x48c9f8){logger[_0xdd98('0x10')](_0xdd98('0xc'),_0x37bd48,_0x48c9f8);_0x8c5ccc(_0x48c9f8);});});}exports[_0xdd98('0x15')]=function(_0x3708fd){var _0x6aa6ae=this;return new Promise(function(_0x464726,_0x51e90d){return db['ZendeskAccount'][_0xdd98('0x16')]({'raw':_0x3708fd['options']?_0x3708fd['options'][_0xdd98('0x17')]===undefined?!![]:![]:!![],'where':_0x3708fd['options']?_0x3708fd[_0xdd98('0x18')][_0xdd98('0x19')]||null:null,'attributes':_0x3708fd[_0xdd98('0x18')]?_0x3708fd[_0xdd98('0x18')][_0xdd98('0x1a')]||null:null,'limit':_0x3708fd[_0xdd98('0x18')]?_0x3708fd['options'][_0xdd98('0x1b')]||null:null,'include':_0x3708fd[_0xdd98('0x18')]?_0x3708fd[_0xdd98('0x18')][_0xdd98('0x1c')]?_[_0xdd98('0x1d')](_0x3708fd[_0xdd98('0x18')][_0xdd98('0x1c')],function(_0x13b590){return{'model':db[_0x13b590['model']],'as':_0x13b590['as'],'attributes':_0x13b590[_0xdd98('0x1a')],'include':_0x13b590[_0xdd98('0x1c')]?_[_0xdd98('0x1d')](_0x13b590[_0xdd98('0x1c')],function(_0x2fd916){return{'model':db[_0x2fd916[_0xdd98('0x1e')]],'as':_0x2fd916['as'],'attributes':_0x2fd916[_0xdd98('0x1a')],'include':_0x2fd916[_0xdd98('0x1c')]?_[_0xdd98('0x1d')](_0x2fd916[_0xdd98('0x1c')],function(_0x4a8645){return{'model':db[_0x4a8645[_0xdd98('0x1e')]],'as':_0x4a8645['as'],'attributes':_0x4a8645[_0xdd98('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdd98('0xa')](function(_0x45a9a4){logger[_0xdd98('0xb')](_0xdd98('0x15'),_0x3708fd);logger[_0xdd98('0xe')](_0xdd98('0x15'),_0x3708fd,JSON[_0xdd98('0xf')](_0x45a9a4));_0x464726(_0x45a9a4);})[_0xdd98('0x14')](function(_0x7a3596){logger[_0xdd98('0x10')](_0xdd98('0x15'),_0x7a3596['message'],_0x3708fd);_0x51e90d(_0x6aa6ae[_0xdd98('0x10')](0x1f4,_0x7a3596[_0xdd98('0x12')]));});});};exports[_0xdd98('0x1f')]=function(_0x44d68c){var _0x94b5cd=this;return new Promise(function(_0x4af9ce,_0x3d1197){return db[_0xdd98('0x20')][_0xdd98('0x21')]({'raw':_0x44d68c[_0xdd98('0x18')]?_0x44d68c['options']['raw']===undefined?!![]:![]:!![],'where':_0x44d68c[_0xdd98('0x18')]?_0x44d68c['options'][_0xdd98('0x19')]||null:null,'attributes':_0x44d68c[_0xdd98('0x18')]?_0x44d68c[_0xdd98('0x18')]['attributes']||null:null,'include':_0x44d68c[_0xdd98('0x18')]?_0x44d68c[_0xdd98('0x18')][_0xdd98('0x1c')]?_[_0xdd98('0x1d')](_0x44d68c['options']['include'],function(_0x4a14dd){return{'model':db[_0x4a14dd[_0xdd98('0x1e')]],'as':_0x4a14dd['as'],'attributes':_0x4a14dd[_0xdd98('0x1a')],'include':_0x4a14dd[_0xdd98('0x1c')]?_[_0xdd98('0x1d')](_0x4a14dd[_0xdd98('0x1c')],function(_0x44f8d0){return{'model':db[_0x44f8d0[_0xdd98('0x1e')]],'as':_0x44f8d0['as'],'attributes':_0x44f8d0['attributes'],'include':_0x44f8d0[_0xdd98('0x1c')]?_[_0xdd98('0x1d')](_0x44f8d0[_0xdd98('0x1c')],function(_0x52205c){return{'model':db[_0x52205c[_0xdd98('0x1e')]],'as':_0x52205c['as'],'attributes':_0x52205c[_0xdd98('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdd98('0xa')](function(_0x8a19a0){logger['info'](_0xdd98('0x1f'),_0x44d68c);logger['debug']('ShowZendeskAccount',_0x44d68c,JSON[_0xdd98('0xf')](_0x8a19a0));_0x4af9ce(_0x8a19a0);})[_0xdd98('0x14')](function(_0x14eea7){logger[_0xdd98('0x10')](_0xdd98('0x1f'),_0x14eea7[_0xdd98('0x12')],_0x44d68c);_0x3d1197(_0x94b5cd[_0xdd98('0x10')](0x1f4,_0x14eea7[_0xdd98('0x12')]));});});}; \ No newline at end of file +var _0x8c4e=['client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','model','map','include','ShowZendeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x489312,_0x1100cd){var _0x2c2830=function(_0x401063){while(--_0x401063){_0x489312['push'](_0x489312['shift']());}};_0x2c2830(++_0x1100cd);}(_0x8c4e,0x117));var _0xe8c4=function(_0x5403a9,_0x237d0a){_0x5403a9=_0x5403a9-0x0;var _0x516080=_0x8c4e[_0x5403a9];return _0x516080;};'use strict';var _=require(_0xe8c4('0x0'));var util=require(_0xe8c4('0x1'));var moment=require('moment');var BPromise=require(_0xe8c4('0x2'));var rs=require(_0xe8c4('0x3'));var fs=require('fs');var Redis=require(_0xe8c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8c4('0x5'));var logger=require(_0xe8c4('0x6'))(_0xe8c4('0x7'));var config=require('../../config/environment');var jayson=require(_0xe8c4('0x8'));var client=jayson[_0xe8c4('0x9')][_0xe8c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x110e6d,_0x271793,_0xe4822e){return new BPromise(function(_0x59c97f,_0xdc3396){return client[_0xe8c4('0xb')](_0x110e6d,_0xe4822e)[_0xe8c4('0xc')](function(_0x4404a2){logger[_0xe8c4('0xd')](_0xe8c4('0xe'),_0x271793,_0xe8c4('0xf'));logger[_0xe8c4('0x10')](_0xe8c4('0x11'),_0x271793,_0xe8c4('0xf'),JSON[_0xe8c4('0x12')](_0x4404a2));if(_0x4404a2[_0xe8c4('0x13')]){if(_0x4404a2['error'][_0xe8c4('0x14')]===0x1f4){logger[_0xe8c4('0x13')](_0xe8c4('0xe'),_0x271793,_0x4404a2[_0xe8c4('0x13')][_0xe8c4('0x15')]);return _0xdc3396(_0x4404a2[_0xe8c4('0x13')]['message']);}logger[_0xe8c4('0x13')](_0xe8c4('0xe'),_0x271793,_0x4404a2[_0xe8c4('0x13')]['message']);return _0x59c97f(_0x4404a2[_0xe8c4('0x13')][_0xe8c4('0x15')]);}else{logger['info'](_0xe8c4('0xe'),_0x271793,_0xe8c4('0xf'));_0x59c97f(_0x4404a2[_0xe8c4('0x16')][_0xe8c4('0x15')]);}})[_0xe8c4('0x17')](function(_0x10774b){logger[_0xe8c4('0x13')](_0xe8c4('0xe'),_0x271793,_0x10774b);_0xdc3396(_0x10774b);});});}exports[_0xe8c4('0x18')]=function(_0x147d3f){var _0x329813=this;return new Promise(function(_0x2e2c66,_0x253539){return db[_0xe8c4('0x19')][_0xe8c4('0x1a')]({'raw':_0x147d3f[_0xe8c4('0x1b')]?_0x147d3f[_0xe8c4('0x1b')][_0xe8c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x147d3f[_0xe8c4('0x1b')]?_0x147d3f['options'][_0xe8c4('0x1d')]||null:null,'attributes':_0x147d3f[_0xe8c4('0x1b')]?_0x147d3f[_0xe8c4('0x1b')][_0xe8c4('0x1e')]||null:null,'limit':_0x147d3f[_0xe8c4('0x1b')]?_0x147d3f[_0xe8c4('0x1b')]['limit']||null:null,'include':_0x147d3f[_0xe8c4('0x1b')]?_0x147d3f[_0xe8c4('0x1b')]['include']?_['map'](_0x147d3f[_0xe8c4('0x1b')]['include'],function(_0x228e07){return{'model':db[_0x228e07[_0xe8c4('0x1f')]],'as':_0x228e07['as'],'attributes':_0x228e07[_0xe8c4('0x1e')],'include':_0x228e07['include']?_[_0xe8c4('0x20')](_0x228e07[_0xe8c4('0x21')],function(_0x28cd56){return{'model':db[_0x28cd56[_0xe8c4('0x1f')]],'as':_0x28cd56['as'],'attributes':_0x28cd56['attributes'],'include':_0x28cd56[_0xe8c4('0x21')]?_[_0xe8c4('0x20')](_0x28cd56['include'],function(_0x1d1f52){return{'model':db[_0x1d1f52['model']],'as':_0x1d1f52['as'],'attributes':_0x1d1f52[_0xe8c4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe8c4('0xc')](function(_0x5ea8a7){logger[_0xe8c4('0xd')](_0xe8c4('0x18'),_0x147d3f);logger[_0xe8c4('0x10')](_0xe8c4('0x18'),_0x147d3f,JSON[_0xe8c4('0x12')](_0x5ea8a7));_0x2e2c66(_0x5ea8a7);})[_0xe8c4('0x17')](function(_0xdb0c4b){logger['error'](_0xe8c4('0x18'),_0xdb0c4b[_0xe8c4('0x15')],_0x147d3f);_0x253539(_0x329813['error'](0x1f4,_0xdb0c4b[_0xe8c4('0x15')]));});});};exports[_0xe8c4('0x22')]=function(_0x283bb8){var _0x33667c=this;return new Promise(function(_0x3dd506,_0x4fa47b){return db[_0xe8c4('0x19')][_0xe8c4('0x23')]({'raw':_0x283bb8[_0xe8c4('0x1b')]?_0x283bb8['options'][_0xe8c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x283bb8[_0xe8c4('0x1b')]?_0x283bb8[_0xe8c4('0x1b')][_0xe8c4('0x1d')]||null:null,'attributes':_0x283bb8[_0xe8c4('0x1b')]?_0x283bb8[_0xe8c4('0x1b')][_0xe8c4('0x1e')]||null:null,'include':_0x283bb8[_0xe8c4('0x1b')]?_0x283bb8[_0xe8c4('0x1b')]['include']?_['map'](_0x283bb8[_0xe8c4('0x1b')][_0xe8c4('0x21')],function(_0x232526){return{'model':db[_0x232526[_0xe8c4('0x1f')]],'as':_0x232526['as'],'attributes':_0x232526[_0xe8c4('0x1e')],'include':_0x232526[_0xe8c4('0x21')]?_[_0xe8c4('0x20')](_0x232526[_0xe8c4('0x21')],function(_0x5a0d25){return{'model':db[_0x5a0d25['model']],'as':_0x5a0d25['as'],'attributes':_0x5a0d25[_0xe8c4('0x1e')],'include':_0x5a0d25['include']?_[_0xe8c4('0x20')](_0x5a0d25[_0xe8c4('0x21')],function(_0x54d14d){return{'model':db[_0x54d14d[_0xe8c4('0x1f')]],'as':_0x54d14d['as'],'attributes':_0x54d14d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe8c4('0xc')](function(_0x18c3fa){logger[_0xe8c4('0xd')](_0xe8c4('0x22'),_0x283bb8);logger[_0xe8c4('0x10')](_0xe8c4('0x22'),_0x283bb8,JSON[_0xe8c4('0x12')](_0x18c3fa));_0x3dd506(_0x18c3fa);})[_0xe8c4('0x17')](function(_0x1334d1){logger[_0xe8c4('0x13')](_0xe8c4('0x22'),_0x1334d1[_0xe8c4('0x15')],_0x283bb8);_0x4fa47b(_0x33667c[_0xe8c4('0x13')](0x1f4,_0x1334d1[_0xe8c4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 51dbf44..3ff9c6c 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x19592c,_0x1e7d81){var _0x5618a2=function(_0x5c1ac2){while(--_0x5c1ac2){_0x19592c['push'](_0x19592c['shift']());}};_0x5618a2(++_0x1e7d81);}(_0xe706,0xa3));var _0x6e70=function(_0x109b6e,_0xbf489f){_0x109b6e=_0x109b6e-0x0;var _0x1e8595=_0xe706[_0x109b6e];return _0x1e8595;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x27f4cd,_0x141f75){var _0x2ba602=function(_0x22df3c){while(--_0x22df3c){_0x27f4cd['push'](_0x27f4cd['shift']());}};_0x2ba602(++_0x141f75);}(_0x757a,0xde));var _0xa757=function(_0x41052a,_0x157b27){_0x41052a=_0x41052a-0x0;var _0x31dd43=_0x757a[_0x41052a];return _0x31dd43;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 37a525f..81b1ba0 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 _0xca5a=['STRING','exports'];(function(_0x272c93,_0x9adc7f){var _0x42b778=function(_0xb8287c){while(--_0xb8287c){_0x272c93['push'](_0x272c93['shift']());}};_0x42b778(++_0x9adc7f);}(_0xca5a,0x167));var _0xaca5=function(_0x32a032,_0x1b373b){_0x32a032=_0x32a032-0x0;var _0x24a388=_0xca5a[_0x32a032];return _0x24a388;};'use strict';var Sequelize=require('sequelize');module[_0xaca5('0x0')]={'name':{'type':Sequelize[_0xaca5('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ad8=['exports','STRING','sequelize'];(function(_0x355fb1,_0x7b9ceb){var _0x4ee0f9=function(_0x492b75){while(--_0x492b75){_0x355fb1['push'](_0x355fb1['shift']());}};_0x4ee0f9(++_0x7b9ceb);}(_0x8ad8,0x10a));var _0x88ad=function(_0x50cea5,_0x3ca132){_0x50cea5=_0x50cea5-0x0;var _0x24c178=_0x8ad8[_0x50cea5];return _0x24c178;};'use strict';var Sequelize=require(_0x88ad('0x0'));module[_0x88ad('0x1')]={'name':{'type':Sequelize[_0x88ad('0x2')]},'description':{'type':Sequelize[_0x88ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4a758df..300b780 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 _0x63c5=['destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','findAll','rows','catch','show','params','find','create','body','getFields','hasOwnProperty','getSubjects','findOne','ZendeskField','order','getDescriptions','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update'];(function(_0x927314,_0xb0a950){var _0x95af00=function(_0x2f7561){while(--_0x2f7561){_0x927314['push'](_0x927314['shift']());}};_0x95af00(++_0xb0a950);}(_0x63c5,0x1b9));var _0x563c=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x63c5[_0x2f57b2];return _0x5ace77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x563c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x563c('0x1'));var rp=require(_0x563c('0x2'));var moment=require('moment');var BPromise=require(_0x563c('0x3'));var Mustache=require(_0x563c('0x4'));var util=require('util');var path=require(_0x563c('0x5'));var sox=require(_0x563c('0x6'));var csv=require(_0x563c('0x7'));var ejs=require(_0x563c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563c('0x9'));var squel=require(_0x563c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x563c('0x7'));var querystring=require(_0x563c('0xb'));var Papa=require(_0x563c('0xc'));var Redis=require(_0x563c('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x563c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x563c('0xf'))('api');var utils=require(_0x563c('0x10'));var config=require(_0x563c('0x11'));var licenseUtil=require(_0x563c('0x12'));var db=require(_0x563c('0x13'))['db'];function respondWithStatusCode(_0x5b3f5a,_0x219303){_0x219303=_0x219303||0xcc;return function(_0x1e9401){if(_0x1e9401){return _0x5b3f5a[_0x563c('0x14')](_0x219303);}return _0x5b3f5a[_0x563c('0x15')](_0x219303)[_0x563c('0x16')]();};}function respondWithResult(_0x4491d3,_0xe9d369){_0xe9d369=_0xe9d369||0xc8;return function(_0x4db4b8){if(_0x4db4b8){return _0x4491d3[_0x563c('0x15')](_0xe9d369)[_0x563c('0x17')](_0x4db4b8);}};}function respondWithFilteredResult(_0xa31a4a,_0x1495d2){return function(_0x3ade99){if(_0x3ade99){var _0x5c5cb4=typeof _0x1495d2['offset']==='undefined'&&typeof _0x1495d2[_0x563c('0x18')]===_0x563c('0x19');var _0x42ca6f=_0x3ade99[_0x563c('0x1a')];var _0x5d9af1=_0x5c5cb4?0x0:_0x1495d2[_0x563c('0x1b')];var _0x1fc3bc=_0x5c5cb4?_0x3ade99[_0x563c('0x1a')]:_0x1495d2[_0x563c('0x1b')]+_0x1495d2[_0x563c('0x18')];var _0x2d5058;if(_0x1fc3bc>=_0x42ca6f){_0x1fc3bc=_0x42ca6f;_0x2d5058=0xc8;}else{_0x2d5058=0xce;}_0xa31a4a[_0x563c('0x15')](_0x2d5058);return _0xa31a4a[_0x563c('0x1c')](_0x563c('0x1d'),_0x5d9af1+'-'+_0x1fc3bc+'/'+_0x42ca6f)['json'](_0x3ade99);}return null;};}function patchUpdates(_0x3c911a){return function(_0x1929b9){try{jsonpatch['apply'](_0x1929b9,_0x3c911a,!![]);}catch(_0x7e9d14){return BPromise[_0x563c('0x1e')](_0x7e9d14);}return _0x1929b9[_0x563c('0x1f')]();};}function saveUpdates(_0x5205cb,_0x132eca){return function(_0x49a666){if(_0x49a666){return _0x49a666[_0x563c('0x20')](_0x5205cb)['then'](function(_0x112bee){return _0x112bee;});}return null;};}function removeEntity(_0x5994a9,_0x44fd6f){return function(_0x1fb522){if(_0x1fb522){return _0x1fb522[_0x563c('0x21')]()[_0x563c('0x22')](function(){_0x5994a9[_0x563c('0x15')](0xcc)[_0x563c('0x16')]();});}};}function handleEntityNotFound(_0x342761,_0x1bc056){return function(_0x131955){if(!_0x131955){_0x342761['sendStatus'](0x194);}return _0x131955;};}function handleError(_0x580ccb,_0x26c4c9){_0x26c4c9=_0x26c4c9||0x1f4;return function(_0x2f6d0f){logger[_0x563c('0x23')](_0x2f6d0f[_0x563c('0x24')]);if(_0x2f6d0f['name']){delete _0x2f6d0f[_0x563c('0x25')];}_0x580ccb[_0x563c('0x15')](_0x26c4c9)[_0x563c('0x26')](_0x2f6d0f);};}exports['index']=function(_0x236237,_0x10a658){var _0x3f9447={},_0xdc0486={},_0x12ff98={'count':0x0,'rows':[]};var _0x1e2025=_[_0x563c('0x27')](db['ZendeskConfiguration'][_0x563c('0x28')],function(_0x241d81){return{'name':_0x241d81[_0x563c('0x29')],'type':_0x241d81[_0x563c('0x2a')][_0x563c('0x2b')]};});_0xdc0486['model']=_['map'](_0x1e2025,_0x563c('0x25'));_0xdc0486['query']=_[_0x563c('0x2c')](_0x236237[_0x563c('0x2d')]);_0xdc0486[_0x563c('0x2e')]=_[_0x563c('0x2f')](_0xdc0486[_0x563c('0x30')],_0xdc0486[_0x563c('0x2d')]);_0x3f9447['attributes']=_[_0x563c('0x2f')](_0xdc0486['model'],qs[_0x563c('0x31')](_0x236237['query']['fields']));_0x3f9447[_0x563c('0x32')]=_0x3f9447[_0x563c('0x32')][_0x563c('0x33')]?_0x3f9447[_0x563c('0x32')]:_0xdc0486[_0x563c('0x30')];if(!_0x236237[_0x563c('0x2d')]['hasOwnProperty'](_0x563c('0x34'))){_0x3f9447['limit']=qs['limit'](_0x236237['query'][_0x563c('0x18')]);_0x3f9447[_0x563c('0x1b')]=qs[_0x563c('0x1b')](_0x236237[_0x563c('0x2d')][_0x563c('0x1b')]);}_0x3f9447['order']=qs[_0x563c('0x35')](_0x236237[_0x563c('0x2d')]['sort']);_0x3f9447[_0x563c('0x36')]=qs[_0x563c('0x2e')](_[_0x563c('0x37')](_0x236237['query'],_0xdc0486[_0x563c('0x2e')]),_0x1e2025);if(_0x236237[_0x563c('0x2d')][_0x563c('0x38')]){_0x3f9447[_0x563c('0x36')]=_[_0x563c('0x39')](_0x3f9447[_0x563c('0x36')],{'$or':_[_0x563c('0x27')](_0x1e2025,function(_0x11915b){if(_0x11915b[_0x563c('0x2a')]!==_0x563c('0x3a')){var _0x47019d={};_0x47019d[_0x11915b[_0x563c('0x25')]]={'$like':'%'+_0x236237[_0x563c('0x2d')][_0x563c('0x38')]+'%'};return _0x47019d;}})});}_0x3f9447=_[_0x563c('0x39')]({},_0x3f9447,_0x236237[_0x563c('0x3b')]);var _0x49690a={'where':_0x3f9447[_0x563c('0x36')]};return db[_0x563c('0x3c')][_0x563c('0x1a')](_0x49690a)[_0x563c('0x22')](function(_0xc1cb4e){_0x12ff98[_0x563c('0x1a')]=_0xc1cb4e;if(_0x236237['query'][_0x563c('0x3d')]){_0x3f9447['include']=[{'all':!![]}];}return db[_0x563c('0x3c')][_0x563c('0x3e')](_0x3f9447);})[_0x563c('0x22')](function(_0x540109){_0x12ff98[_0x563c('0x3f')]=_0x540109;return _0x12ff98;})[_0x563c('0x22')](respondWithFilteredResult(_0x10a658,_0x3f9447))[_0x563c('0x40')](handleError(_0x10a658,null));};exports[_0x563c('0x41')]=function(_0x15394e,_0x391057){var _0x364f16={'raw':![],'where':{'id':_0x15394e[_0x563c('0x42')]['id']}},_0x6caf89={};_0x6caf89[_0x563c('0x30')]=_['keys'](db['ZendeskConfiguration'][_0x563c('0x28')]);_0x6caf89[_0x563c('0x2d')]=_[_0x563c('0x2c')](_0x15394e[_0x563c('0x2d')]);_0x6caf89[_0x563c('0x2e')]=_['intersection'](_0x6caf89['model'],_0x6caf89[_0x563c('0x2d')]);_0x364f16[_0x563c('0x32')]=_[_0x563c('0x2f')](_0x6caf89[_0x563c('0x30')],qs[_0x563c('0x31')](_0x15394e['query'][_0x563c('0x31')]));_0x364f16['attributes']=_0x364f16[_0x563c('0x32')]['length']?_0x364f16['attributes']:_0x6caf89[_0x563c('0x30')];if(_0x15394e[_0x563c('0x2d')][_0x563c('0x3d')]){_0x364f16['include']=[{'all':!![]}];}_0x364f16=_['merge']({},_0x364f16,_0x15394e['options']);return db['ZendeskConfiguration'][_0x563c('0x43')](_0x364f16)['then'](handleEntityNotFound(_0x391057,null))['then'](respondWithResult(_0x391057,null))[_0x563c('0x40')](handleError(_0x391057,null));};exports[_0x563c('0x44')]=function(_0x234659,_0x373673){return db[_0x563c('0x3c')][_0x563c('0x44')](_0x234659[_0x563c('0x45')],{})[_0x563c('0x22')](respondWithResult(_0x373673,0xc9))[_0x563c('0x40')](handleError(_0x373673,null));};exports[_0x563c('0x20')]=function(_0x57dc5c,_0x6ce29c){if(_0x57dc5c['body']['id']){delete _0x57dc5c['body']['id'];}return db[_0x563c('0x3c')][_0x563c('0x43')]({'where':{'id':_0x57dc5c[_0x563c('0x42')]['id']}})[_0x563c('0x22')](handleEntityNotFound(_0x6ce29c,null))['then'](saveUpdates(_0x57dc5c[_0x563c('0x45')],null))[_0x563c('0x22')](respondWithResult(_0x6ce29c,null))[_0x563c('0x40')](handleError(_0x6ce29c,null));};exports['destroy']=function(_0x142376,_0x1c923b){return db[_0x563c('0x3c')][_0x563c('0x43')]({'where':{'id':_0x142376[_0x563c('0x42')]['id']}})[_0x563c('0x22')](handleEntityNotFound(_0x1c923b,null))[_0x563c('0x22')](removeEntity(_0x1c923b,null))[_0x563c('0x40')](handleError(_0x1c923b,null));};exports[_0x563c('0x46')]=function(_0x47e59b,_0x5e9ffc,_0x556800){var _0x24049a={};var _0x370210={};var _0x30fd32;var _0x32b5c6;return db[_0x563c('0x3c')]['findOne']({'where':{'id':_0x47e59b[_0x563c('0x42')]['id']}})[_0x563c('0x22')](handleEntityNotFound(_0x5e9ffc,null))['then'](function(_0x465d58){if(_0x465d58){_0x30fd32=_0x465d58;_0x370210['model']=_[_0x563c('0x2c')](db['ZendeskField'][_0x563c('0x28')]);_0x370210['query']=_[_0x563c('0x2c')](_0x47e59b[_0x563c('0x2d')]);_0x370210[_0x563c('0x2e')]=_['intersection'](_0x370210[_0x563c('0x30')],_0x370210[_0x563c('0x2d')]);_0x24049a['attributes']=_[_0x563c('0x2f')](_0x370210[_0x563c('0x30')],qs[_0x563c('0x31')](_0x47e59b[_0x563c('0x2d')][_0x563c('0x31')]));_0x24049a[_0x563c('0x32')]=_0x24049a[_0x563c('0x32')]['length']?_0x24049a[_0x563c('0x32')]:_0x370210[_0x563c('0x30')];_0x24049a['order']=qs['sort'](_0x47e59b[_0x563c('0x2d')][_0x563c('0x35')]);_0x24049a[_0x563c('0x36')]=qs[_0x563c('0x2e')](_[_0x563c('0x37')](_0x47e59b[_0x563c('0x2d')],_0x370210[_0x563c('0x2e')]));if(_0x47e59b[_0x563c('0x2d')][_0x563c('0x38')]){_0x24049a[_0x563c('0x36')]=_[_0x563c('0x39')](_0x24049a[_0x563c('0x36')],{'$or':_['map'](_0x24049a['attributes'],function(_0x5a0c12){var _0x397922={};_0x397922[_0x5a0c12]={'$like':'%'+_0x47e59b['query']['filter']+'%'};return _0x397922;})});}_0x24049a=_[_0x563c('0x39')]({},_0x24049a,_0x47e59b['options']);return _0x30fd32[_0x563c('0x46')](_0x24049a);}})[_0x563c('0x22')](function(_0x1599a9){if(_0x1599a9){_0x32b5c6=_0x1599a9[_0x563c('0x33')];if(!_0x47e59b[_0x563c('0x2d')][_0x563c('0x47')](_0x563c('0x34'))){_0x24049a[_0x563c('0x18')]=qs[_0x563c('0x18')](_0x47e59b[_0x563c('0x2d')][_0x563c('0x18')]);_0x24049a['offset']=qs[_0x563c('0x1b')](_0x47e59b[_0x563c('0x2d')][_0x563c('0x1b')]);}return _0x30fd32[_0x563c('0x46')](_0x24049a);}})[_0x563c('0x22')](function(_0xdc3870){if(_0xdc3870){return _0xdc3870?{'count':_0x32b5c6,'rows':_0xdc3870}:null;}})[_0x563c('0x22')](respondWithResult(_0x5e9ffc,null))[_0x563c('0x40')](handleError(_0x5e9ffc,null));};exports[_0x563c('0x48')]=function(_0x4a24df,_0x10a853,_0x11b07b){var _0x55c15b={};var _0x283054={};var _0x206031;var _0x4f794e;return db[_0x563c('0x3c')][_0x563c('0x49')]({'where':{'id':_0x4a24df[_0x563c('0x42')]['id']}})['then'](handleEntityNotFound(_0x10a853,null))[_0x563c('0x22')](function(_0xa0e281){if(_0xa0e281){_0x206031=_0xa0e281;_0x283054['model']=_[_0x563c('0x2c')](db[_0x563c('0x4a')][_0x563c('0x28')]);_0x283054[_0x563c('0x2d')]=_[_0x563c('0x2c')](_0x4a24df[_0x563c('0x2d')]);_0x283054[_0x563c('0x2e')]=_[_0x563c('0x2f')](_0x283054['model'],_0x283054['query']);_0x55c15b[_0x563c('0x32')]=_[_0x563c('0x2f')](_0x283054['model'],qs[_0x563c('0x31')](_0x4a24df[_0x563c('0x2d')][_0x563c('0x31')]));_0x55c15b['attributes']=_0x55c15b[_0x563c('0x32')][_0x563c('0x33')]?_0x55c15b[_0x563c('0x32')]:_0x283054[_0x563c('0x30')];_0x55c15b[_0x563c('0x4b')]=qs['sort'](_0x4a24df[_0x563c('0x2d')]['sort']);_0x55c15b[_0x563c('0x36')]=qs[_0x563c('0x2e')](_[_0x563c('0x37')](_0x4a24df[_0x563c('0x2d')],_0x283054['filters']));if(_0x4a24df[_0x563c('0x2d')][_0x563c('0x38')]){_0x55c15b[_0x563c('0x36')]=_['merge'](_0x55c15b[_0x563c('0x36')],{'$or':_[_0x563c('0x27')](_0x55c15b[_0x563c('0x32')],function(_0x3124fb){var _0x1947f3={};_0x1947f3[_0x3124fb]={'$like':'%'+_0x4a24df['query'][_0x563c('0x38')]+'%'};return _0x1947f3;})});}_0x55c15b=_[_0x563c('0x39')]({},_0x55c15b,_0x4a24df[_0x563c('0x3b')]);return _0x206031[_0x563c('0x48')](_0x55c15b);}})[_0x563c('0x22')](function(_0x19c086){if(_0x19c086){_0x4f794e=_0x19c086[_0x563c('0x33')];if(!_0x4a24df[_0x563c('0x2d')][_0x563c('0x47')](_0x563c('0x34'))){_0x55c15b[_0x563c('0x18')]=qs[_0x563c('0x18')](_0x4a24df[_0x563c('0x2d')][_0x563c('0x18')]);_0x55c15b[_0x563c('0x1b')]=qs[_0x563c('0x1b')](_0x4a24df['query'][_0x563c('0x1b')]);}return _0x206031[_0x563c('0x48')](_0x55c15b);}})[_0x563c('0x22')](function(_0x37e05){if(_0x37e05){return _0x37e05?{'count':_0x4f794e,'rows':_0x37e05}:null;}})[_0x563c('0x22')](respondWithResult(_0x10a853,null))[_0x563c('0x40')](handleError(_0x10a853,null));};exports['getDescriptions']=function(_0x5ef88d,_0x22b726,_0x29d579){var _0xd013d5={};var _0x1005ca={};var _0x529ce7;var _0x4d44dc;return db[_0x563c('0x3c')][_0x563c('0x49')]({'where':{'id':_0x5ef88d[_0x563c('0x42')]['id']}})[_0x563c('0x22')](handleEntityNotFound(_0x22b726,null))['then'](function(_0x2b3ef9){if(_0x2b3ef9){_0x529ce7=_0x2b3ef9;_0x1005ca['model']=_[_0x563c('0x2c')](db['ZendeskField'][_0x563c('0x28')]);_0x1005ca['query']=_[_0x563c('0x2c')](_0x5ef88d[_0x563c('0x2d')]);_0x1005ca[_0x563c('0x2e')]=_[_0x563c('0x2f')](_0x1005ca['model'],_0x1005ca['query']);_0xd013d5['attributes']=_[_0x563c('0x2f')](_0x1005ca[_0x563c('0x30')],qs['fields'](_0x5ef88d[_0x563c('0x2d')][_0x563c('0x31')]));_0xd013d5[_0x563c('0x32')]=_0xd013d5['attributes'][_0x563c('0x33')]?_0xd013d5[_0x563c('0x32')]:_0x1005ca[_0x563c('0x30')];_0xd013d5[_0x563c('0x4b')]=qs[_0x563c('0x35')](_0x5ef88d['query']['sort']);_0xd013d5[_0x563c('0x36')]=qs[_0x563c('0x2e')](_[_0x563c('0x37')](_0x5ef88d['query'],_0x1005ca['filters']));if(_0x5ef88d[_0x563c('0x2d')]['filter']){_0xd013d5['where']=_[_0x563c('0x39')](_0xd013d5['where'],{'$or':_[_0x563c('0x27')](_0xd013d5[_0x563c('0x32')],function(_0x75edd6){var _0x3e63b0={};_0x3e63b0[_0x75edd6]={'$like':'%'+_0x5ef88d[_0x563c('0x2d')][_0x563c('0x38')]+'%'};return _0x3e63b0;})});}_0xd013d5=_['merge']({},_0xd013d5,_0x5ef88d[_0x563c('0x3b')]);return _0x529ce7[_0x563c('0x4c')](_0xd013d5);}})['then'](function(_0x3efa06){if(_0x3efa06){_0x4d44dc=_0x3efa06[_0x563c('0x33')];if(!_0x5ef88d[_0x563c('0x2d')][_0x563c('0x47')]('nolimit')){_0xd013d5[_0x563c('0x18')]=qs[_0x563c('0x18')](_0x5ef88d[_0x563c('0x2d')]['limit']);_0xd013d5[_0x563c('0x1b')]=qs[_0x563c('0x1b')](_0x5ef88d[_0x563c('0x2d')]['offset']);}return _0x529ce7['getDescriptions'](_0xd013d5);}})[_0x563c('0x22')](function(_0x24655d){if(_0x24655d){return _0x24655d?{'count':_0x4d44dc,'rows':_0x24655d}:null;}})['then'](respondWithResult(_0x22b726,null))[_0x563c('0x40')](handleError(_0x22b726,null));};exports['getTags']=function(_0x12ab41,_0x4ab043,_0x355566){var _0x4e9d49={};var _0x12700d={};var _0x2f839c;var _0x3b2471;return db[_0x563c('0x3c')][_0x563c('0x49')]({'where':{'id':_0x12ab41[_0x563c('0x42')]['id']}})[_0x563c('0x22')](handleEntityNotFound(_0x4ab043,null))['then'](function(_0x3722d1){if(_0x3722d1){_0x2f839c=_0x3722d1;_0x12700d[_0x563c('0x30')]=_[_0x563c('0x2c')](db['Tag'][_0x563c('0x28')]);_0x12700d[_0x563c('0x2d')]=_[_0x563c('0x2c')](_0x12ab41[_0x563c('0x2d')]);_0x12700d[_0x563c('0x2e')]=_[_0x563c('0x2f')](_0x12700d[_0x563c('0x30')],_0x12700d[_0x563c('0x2d')]);_0x4e9d49[_0x563c('0x32')]=_[_0x563c('0x2f')](_0x12700d[_0x563c('0x30')],qs[_0x563c('0x31')](_0x12ab41['query']['fields']));_0x4e9d49[_0x563c('0x32')]=_0x4e9d49[_0x563c('0x32')][_0x563c('0x33')]?_0x4e9d49[_0x563c('0x32')]:_0x12700d['model'];_0x4e9d49[_0x563c('0x4b')]=qs[_0x563c('0x35')](_0x12ab41['query'][_0x563c('0x35')]);_0x4e9d49['where']=qs[_0x563c('0x2e')](_['pick'](_0x12ab41[_0x563c('0x2d')],_0x12700d['filters']));if(_0x12ab41[_0x563c('0x2d')][_0x563c('0x38')]){_0x4e9d49[_0x563c('0x36')]=_[_0x563c('0x39')](_0x4e9d49[_0x563c('0x36')],{'$or':_[_0x563c('0x27')](_0x4e9d49[_0x563c('0x32')],function(_0x1075a6){var _0x53aa1c={};_0x53aa1c[_0x1075a6]={'$like':'%'+_0x12ab41[_0x563c('0x2d')][_0x563c('0x38')]+'%'};return _0x53aa1c;})});}_0x4e9d49=_[_0x563c('0x39')]({},_0x4e9d49,_0x12ab41[_0x563c('0x3b')]);return _0x2f839c['getTags'](_0x4e9d49);}})['then'](function(_0xb23d5e){if(_0xb23d5e){_0x3b2471=_0xb23d5e[_0x563c('0x33')];if(!_0x12ab41[_0x563c('0x2d')][_0x563c('0x47')]('nolimit')){_0x4e9d49[_0x563c('0x18')]=qs[_0x563c('0x18')](_0x12ab41['query']['limit']);_0x4e9d49[_0x563c('0x1b')]=qs[_0x563c('0x1b')](_0x12ab41[_0x563c('0x2d')][_0x563c('0x1b')]);}return _0x2f839c['getTags'](_0x4e9d49);}})['then'](function(_0x3ac72e){if(_0x3ac72e){return _0x3ac72e?{'count':_0x3b2471,'rows':_0x3ac72e}:null;}})['then'](respondWithResult(_0x4ab043,null))['catch'](handleError(_0x4ab043,null));};exports[_0x563c('0x4d')]=function(_0x572e1e,_0x3d3390,_0x20a7b9){if(_0x572e1e[_0x563c('0x45')]['id']){delete _0x572e1e['body']['id'];}return db[_0x563c('0x3c')]['findOne']({'where':{'id':_0x572e1e[_0x563c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d3390,null))[_0x563c('0x22')](function(_0x46d295){if(_0x46d295){return _0x46d295['setTags'](_0x572e1e['body'][_0x563c('0x4e')]||[]);}return null;})[_0x563c('0x22')](respondWithResult(_0x3d3390,null))[_0x563c('0x40')](handleError(_0x3d3390,null));}; \ No newline at end of file +var _0x6e74=['setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','keys','find','catch','create','body','findOne','ZendeskField','getFields','hasOwnProperty','nolimit','getSubjects','getTags','Tag'];(function(_0x489dbe,_0x234f3a){var _0x4afdc6=function(_0x12f744){while(--_0x12f744){_0x489dbe['push'](_0x489dbe['shift']());}};_0x4afdc6(++_0x234f3a);}(_0x6e74,0x196));var _0x46e7=function(_0x8c8fd6,_0x4f7eca){_0x8c8fd6=_0x8c8fd6-0x0;var _0x1cf12d=_0x6e74[_0x8c8fd6];return _0x1cf12d;};'use strict';var emlformat=require(_0x46e7('0x0'));var rimraf=require(_0x46e7('0x1'));var zipdir=require(_0x46e7('0x2'));var jsonpatch=require(_0x46e7('0x3'));var rp=require(_0x46e7('0x4'));var moment=require(_0x46e7('0x5'));var BPromise=require(_0x46e7('0x6'));var Mustache=require(_0x46e7('0x7'));var util=require(_0x46e7('0x8'));var path=require(_0x46e7('0x9'));var sox=require(_0x46e7('0xa'));var csv=require(_0x46e7('0xb'));var ejs=require(_0x46e7('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x46e7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x46e7('0xb'));var querystring=require('querystring');var Papa=require(_0x46e7('0xe'));var Redis=require(_0x46e7('0xf'));var authService=require(_0x46e7('0x10'));var qs=require(_0x46e7('0x11'));var as=require(_0x46e7('0x12'));var hardwareService=require(_0x46e7('0x13'));var logger=require(_0x46e7('0x14'))('api');var utils=require(_0x46e7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x46e7('0x16'));var db=require(_0x46e7('0x17'))['db'];function respondWithStatusCode(_0x3d9837,_0x3b889b){_0x3b889b=_0x3b889b||0xcc;return function(_0x24089d){if(_0x24089d){return _0x3d9837[_0x46e7('0x18')](_0x3b889b);}return _0x3d9837['status'](_0x3b889b)[_0x46e7('0x19')]();};}function respondWithResult(_0x4e275b,_0x35cc40){_0x35cc40=_0x35cc40||0xc8;return function(_0x16b685){if(_0x16b685){return _0x4e275b[_0x46e7('0x1a')](_0x35cc40)[_0x46e7('0x1b')](_0x16b685);}};}function respondWithFilteredResult(_0x121666,_0x166367){return function(_0x3d4824){if(_0x3d4824){var _0x545966=typeof _0x166367[_0x46e7('0x1c')]==='undefined'&&typeof _0x166367[_0x46e7('0x1d')]===_0x46e7('0x1e');var _0x93419b=_0x3d4824[_0x46e7('0x1f')];var _0x2146d5=_0x545966?0x0:_0x166367[_0x46e7('0x1c')];var _0x4763d2=_0x545966?_0x3d4824[_0x46e7('0x1f')]:_0x166367[_0x46e7('0x1c')]+_0x166367[_0x46e7('0x1d')];var _0x3b1459;if(_0x4763d2>=_0x93419b){_0x4763d2=_0x93419b;_0x3b1459=0xc8;}else{_0x3b1459=0xce;}_0x121666[_0x46e7('0x1a')](_0x3b1459);return _0x121666[_0x46e7('0x20')](_0x46e7('0x21'),_0x2146d5+'-'+_0x4763d2+'/'+_0x93419b)[_0x46e7('0x1b')](_0x3d4824);}return null;};}function patchUpdates(_0xc6bd1f){return function(_0xfc6b9d){try{jsonpatch[_0x46e7('0x22')](_0xfc6b9d,_0xc6bd1f,!![]);}catch(_0x274059){return BPromise[_0x46e7('0x23')](_0x274059);}return _0xfc6b9d[_0x46e7('0x24')]();};}function saveUpdates(_0x419c5e,_0x4aff86){return function(_0x3e54ac){if(_0x3e54ac){return _0x3e54ac[_0x46e7('0x25')](_0x419c5e)[_0x46e7('0x26')](function(_0x2c871c){return _0x2c871c;});}return null;};}function removeEntity(_0x5efdb1,_0x36bfbb){return function(_0x2fd748){if(_0x2fd748){return _0x2fd748['destroy']()[_0x46e7('0x26')](function(){_0x5efdb1[_0x46e7('0x1a')](0xcc)[_0x46e7('0x19')]();});}};}function handleEntityNotFound(_0x3aa585,_0x10205a){return function(_0x17dcc8){if(!_0x17dcc8){_0x3aa585[_0x46e7('0x18')](0x194);}return _0x17dcc8;};}function handleError(_0x1ae75e,_0x7f6b5d){_0x7f6b5d=_0x7f6b5d||0x1f4;return function(_0x4ebfbe){logger[_0x46e7('0x27')](_0x4ebfbe['stack']);if(_0x4ebfbe['name']){delete _0x4ebfbe[_0x46e7('0x28')];}_0x1ae75e[_0x46e7('0x1a')](_0x7f6b5d)['send'](_0x4ebfbe);};}exports[_0x46e7('0x29')]=function(_0x30d037,_0x25cbf7){var _0x19663f={},_0x49436b={},_0x720ab6={'count':0x0,'rows':[]};var _0x1d8914=_[_0x46e7('0x2a')](db[_0x46e7('0x2b')][_0x46e7('0x2c')],function(_0x40bf0e){return{'name':_0x40bf0e[_0x46e7('0x2d')],'type':_0x40bf0e['type'][_0x46e7('0x2e')]};});_0x49436b[_0x46e7('0x2f')]=_[_0x46e7('0x2a')](_0x1d8914,'name');_0x49436b[_0x46e7('0x30')]=_['keys'](_0x30d037[_0x46e7('0x30')]);_0x49436b[_0x46e7('0x31')]=_[_0x46e7('0x32')](_0x49436b[_0x46e7('0x2f')],_0x49436b['query']);_0x19663f[_0x46e7('0x33')]=_[_0x46e7('0x32')](_0x49436b['model'],qs[_0x46e7('0x34')](_0x30d037['query'][_0x46e7('0x34')]));_0x19663f[_0x46e7('0x33')]=_0x19663f[_0x46e7('0x33')][_0x46e7('0x35')]?_0x19663f[_0x46e7('0x33')]:_0x49436b['model'];if(!_0x30d037[_0x46e7('0x30')]['hasOwnProperty']('nolimit')){_0x19663f['limit']=qs['limit'](_0x30d037['query'][_0x46e7('0x1d')]);_0x19663f[_0x46e7('0x1c')]=qs[_0x46e7('0x1c')](_0x30d037[_0x46e7('0x30')]['offset']);}_0x19663f[_0x46e7('0x36')]=qs[_0x46e7('0x37')](_0x30d037[_0x46e7('0x30')]['sort']);_0x19663f[_0x46e7('0x38')]=qs[_0x46e7('0x31')](_[_0x46e7('0x39')](_0x30d037[_0x46e7('0x30')],_0x49436b[_0x46e7('0x31')]),_0x1d8914);if(_0x30d037[_0x46e7('0x30')][_0x46e7('0x3a')]){_0x19663f[_0x46e7('0x38')]=_[_0x46e7('0x3b')](_0x19663f[_0x46e7('0x38')],{'$or':_['map'](_0x1d8914,function(_0x38afde){if(_0x38afde[_0x46e7('0x3c')]!==_0x46e7('0x3d')){var _0x5afc91={};_0x5afc91[_0x38afde[_0x46e7('0x28')]]={'$like':'%'+_0x30d037[_0x46e7('0x30')][_0x46e7('0x3a')]+'%'};return _0x5afc91;}})});}_0x19663f=_[_0x46e7('0x3b')]({},_0x19663f,_0x30d037[_0x46e7('0x3e')]);var _0x540c31={'where':_0x19663f[_0x46e7('0x38')]};return db[_0x46e7('0x2b')][_0x46e7('0x1f')](_0x540c31)[_0x46e7('0x26')](function(_0x56bd01){_0x720ab6[_0x46e7('0x1f')]=_0x56bd01;if(_0x30d037[_0x46e7('0x30')][_0x46e7('0x3f')]){_0x19663f['include']=[{'all':!![]}];}return db[_0x46e7('0x2b')][_0x46e7('0x40')](_0x19663f);})[_0x46e7('0x26')](function(_0x37d1f7){_0x720ab6['rows']=_0x37d1f7;return _0x720ab6;})['then'](respondWithFilteredResult(_0x25cbf7,_0x19663f))['catch'](handleError(_0x25cbf7,null));};exports[_0x46e7('0x41')]=function(_0x5b37bb,_0x25b5d0){var _0x2d8f93={'raw':![],'where':{'id':_0x5b37bb[_0x46e7('0x42')]['id']}},_0x1ab87e={};_0x1ab87e['model']=_[_0x46e7('0x43')](db[_0x46e7('0x2b')][_0x46e7('0x2c')]);_0x1ab87e[_0x46e7('0x30')]=_[_0x46e7('0x43')](_0x5b37bb[_0x46e7('0x30')]);_0x1ab87e[_0x46e7('0x31')]=_[_0x46e7('0x32')](_0x1ab87e[_0x46e7('0x2f')],_0x1ab87e[_0x46e7('0x30')]);_0x2d8f93[_0x46e7('0x33')]=_[_0x46e7('0x32')](_0x1ab87e['model'],qs['fields'](_0x5b37bb[_0x46e7('0x30')][_0x46e7('0x34')]));_0x2d8f93['attributes']=_0x2d8f93[_0x46e7('0x33')][_0x46e7('0x35')]?_0x2d8f93['attributes']:_0x1ab87e[_0x46e7('0x2f')];if(_0x5b37bb[_0x46e7('0x30')][_0x46e7('0x3f')]){_0x2d8f93['include']=[{'all':!![]}];}_0x2d8f93=_[_0x46e7('0x3b')]({},_0x2d8f93,_0x5b37bb[_0x46e7('0x3e')]);return db[_0x46e7('0x2b')][_0x46e7('0x44')](_0x2d8f93)[_0x46e7('0x26')](handleEntityNotFound(_0x25b5d0,null))[_0x46e7('0x26')](respondWithResult(_0x25b5d0,null))[_0x46e7('0x45')](handleError(_0x25b5d0,null));};exports[_0x46e7('0x46')]=function(_0x3dcbcb,_0x18f375){return db[_0x46e7('0x2b')][_0x46e7('0x46')](_0x3dcbcb[_0x46e7('0x47')],{})['then'](respondWithResult(_0x18f375,0xc9))[_0x46e7('0x45')](handleError(_0x18f375,null));};exports['update']=function(_0x1b29fa,_0x14b9bc){if(_0x1b29fa['body']['id']){delete _0x1b29fa['body']['id'];}return db[_0x46e7('0x2b')][_0x46e7('0x44')]({'where':{'id':_0x1b29fa[_0x46e7('0x42')]['id']}})[_0x46e7('0x26')](handleEntityNotFound(_0x14b9bc,null))[_0x46e7('0x26')](saveUpdates(_0x1b29fa['body'],null))[_0x46e7('0x26')](respondWithResult(_0x14b9bc,null))[_0x46e7('0x45')](handleError(_0x14b9bc,null));};exports['destroy']=function(_0x13c10c,_0x51510a){return db[_0x46e7('0x2b')][_0x46e7('0x44')]({'where':{'id':_0x13c10c[_0x46e7('0x42')]['id']}})[_0x46e7('0x26')](handleEntityNotFound(_0x51510a,null))['then'](removeEntity(_0x51510a,null))['catch'](handleError(_0x51510a,null));};exports['getFields']=function(_0x39a309,_0x331ebc,_0x392f17){var _0x2986d0={};var _0xbeab51={};var _0x277dae;var _0x4fa209;return db['ZendeskConfiguration'][_0x46e7('0x48')]({'where':{'id':_0x39a309[_0x46e7('0x42')]['id']}})[_0x46e7('0x26')](handleEntityNotFound(_0x331ebc,null))['then'](function(_0x6a460d){if(_0x6a460d){_0x277dae=_0x6a460d;_0xbeab51[_0x46e7('0x2f')]=_[_0x46e7('0x43')](db[_0x46e7('0x49')]['rawAttributes']);_0xbeab51[_0x46e7('0x30')]=_[_0x46e7('0x43')](_0x39a309[_0x46e7('0x30')]);_0xbeab51[_0x46e7('0x31')]=_[_0x46e7('0x32')](_0xbeab51[_0x46e7('0x2f')],_0xbeab51[_0x46e7('0x30')]);_0x2986d0[_0x46e7('0x33')]=_['intersection'](_0xbeab51['model'],qs[_0x46e7('0x34')](_0x39a309[_0x46e7('0x30')][_0x46e7('0x34')]));_0x2986d0[_0x46e7('0x33')]=_0x2986d0[_0x46e7('0x33')][_0x46e7('0x35')]?_0x2986d0[_0x46e7('0x33')]:_0xbeab51[_0x46e7('0x2f')];_0x2986d0[_0x46e7('0x36')]=qs['sort'](_0x39a309[_0x46e7('0x30')][_0x46e7('0x37')]);_0x2986d0[_0x46e7('0x38')]=qs[_0x46e7('0x31')](_[_0x46e7('0x39')](_0x39a309['query'],_0xbeab51[_0x46e7('0x31')]));if(_0x39a309[_0x46e7('0x30')]['filter']){_0x2986d0[_0x46e7('0x38')]=_[_0x46e7('0x3b')](_0x2986d0[_0x46e7('0x38')],{'$or':_['map'](_0x2986d0[_0x46e7('0x33')],function(_0xd7f405){var _0x5974fa={};_0x5974fa[_0xd7f405]={'$like':'%'+_0x39a309[_0x46e7('0x30')][_0x46e7('0x3a')]+'%'};return _0x5974fa;})});}_0x2986d0=_[_0x46e7('0x3b')]({},_0x2986d0,_0x39a309['options']);return _0x277dae[_0x46e7('0x4a')](_0x2986d0);}})[_0x46e7('0x26')](function(_0x13761f){if(_0x13761f){_0x4fa209=_0x13761f['length'];if(!_0x39a309[_0x46e7('0x30')][_0x46e7('0x4b')](_0x46e7('0x4c'))){_0x2986d0[_0x46e7('0x1d')]=qs[_0x46e7('0x1d')](_0x39a309[_0x46e7('0x30')]['limit']);_0x2986d0[_0x46e7('0x1c')]=qs[_0x46e7('0x1c')](_0x39a309[_0x46e7('0x30')][_0x46e7('0x1c')]);}return _0x277dae[_0x46e7('0x4a')](_0x2986d0);}})[_0x46e7('0x26')](function(_0x2bd853){if(_0x2bd853){return _0x2bd853?{'count':_0x4fa209,'rows':_0x2bd853}:null;}})[_0x46e7('0x26')](respondWithResult(_0x331ebc,null))[_0x46e7('0x45')](handleError(_0x331ebc,null));};exports[_0x46e7('0x4d')]=function(_0x4e8cac,_0x2b7fc2,_0x13c65d){var _0x43cfec={};var _0x1e679a={};var _0x2c690b;var _0x57da2e;return db[_0x46e7('0x2b')][_0x46e7('0x48')]({'where':{'id':_0x4e8cac['params']['id']}})[_0x46e7('0x26')](handleEntityNotFound(_0x2b7fc2,null))[_0x46e7('0x26')](function(_0x167806){if(_0x167806){_0x2c690b=_0x167806;_0x1e679a[_0x46e7('0x2f')]=_[_0x46e7('0x43')](db[_0x46e7('0x49')][_0x46e7('0x2c')]);_0x1e679a[_0x46e7('0x30')]=_[_0x46e7('0x43')](_0x4e8cac[_0x46e7('0x30')]);_0x1e679a[_0x46e7('0x31')]=_[_0x46e7('0x32')](_0x1e679a[_0x46e7('0x2f')],_0x1e679a[_0x46e7('0x30')]);_0x43cfec[_0x46e7('0x33')]=_[_0x46e7('0x32')](_0x1e679a[_0x46e7('0x2f')],qs[_0x46e7('0x34')](_0x4e8cac[_0x46e7('0x30')][_0x46e7('0x34')]));_0x43cfec['attributes']=_0x43cfec['attributes'][_0x46e7('0x35')]?_0x43cfec['attributes']:_0x1e679a[_0x46e7('0x2f')];_0x43cfec[_0x46e7('0x36')]=qs['sort'](_0x4e8cac[_0x46e7('0x30')][_0x46e7('0x37')]);_0x43cfec['where']=qs['filters'](_[_0x46e7('0x39')](_0x4e8cac[_0x46e7('0x30')],_0x1e679a[_0x46e7('0x31')]));if(_0x4e8cac[_0x46e7('0x30')]['filter']){_0x43cfec[_0x46e7('0x38')]=_[_0x46e7('0x3b')](_0x43cfec['where'],{'$or':_['map'](_0x43cfec['attributes'],function(_0x4ade58){var _0x255bbc={};_0x255bbc[_0x4ade58]={'$like':'%'+_0x4e8cac[_0x46e7('0x30')][_0x46e7('0x3a')]+'%'};return _0x255bbc;})});}_0x43cfec=_['merge']({},_0x43cfec,_0x4e8cac[_0x46e7('0x3e')]);return _0x2c690b[_0x46e7('0x4d')](_0x43cfec);}})[_0x46e7('0x26')](function(_0x5a5695){if(_0x5a5695){_0x57da2e=_0x5a5695['length'];if(!_0x4e8cac[_0x46e7('0x30')]['hasOwnProperty'](_0x46e7('0x4c'))){_0x43cfec[_0x46e7('0x1d')]=qs[_0x46e7('0x1d')](_0x4e8cac[_0x46e7('0x30')][_0x46e7('0x1d')]);_0x43cfec['offset']=qs['offset'](_0x4e8cac[_0x46e7('0x30')][_0x46e7('0x1c')]);}return _0x2c690b['getSubjects'](_0x43cfec);}})[_0x46e7('0x26')](function(_0xb237e2){if(_0xb237e2){return _0xb237e2?{'count':_0x57da2e,'rows':_0xb237e2}:null;}})[_0x46e7('0x26')](respondWithResult(_0x2b7fc2,null))['catch'](handleError(_0x2b7fc2,null));};exports['getDescriptions']=function(_0x4c8675,_0x22c0e2,_0x2ef08b){var _0x2e4227={};var _0x42e747={};var _0x2a015a;var _0x2ceafb;return db[_0x46e7('0x2b')][_0x46e7('0x48')]({'where':{'id':_0x4c8675[_0x46e7('0x42')]['id']}})[_0x46e7('0x26')](handleEntityNotFound(_0x22c0e2,null))[_0x46e7('0x26')](function(_0x349b3b){if(_0x349b3b){_0x2a015a=_0x349b3b;_0x42e747['model']=_[_0x46e7('0x43')](db[_0x46e7('0x49')][_0x46e7('0x2c')]);_0x42e747[_0x46e7('0x30')]=_[_0x46e7('0x43')](_0x4c8675['query']);_0x42e747['filters']=_[_0x46e7('0x32')](_0x42e747[_0x46e7('0x2f')],_0x42e747['query']);_0x2e4227[_0x46e7('0x33')]=_[_0x46e7('0x32')](_0x42e747[_0x46e7('0x2f')],qs['fields'](_0x4c8675['query']['fields']));_0x2e4227[_0x46e7('0x33')]=_0x2e4227[_0x46e7('0x33')][_0x46e7('0x35')]?_0x2e4227['attributes']:_0x42e747[_0x46e7('0x2f')];_0x2e4227[_0x46e7('0x36')]=qs[_0x46e7('0x37')](_0x4c8675[_0x46e7('0x30')][_0x46e7('0x37')]);_0x2e4227[_0x46e7('0x38')]=qs['filters'](_['pick'](_0x4c8675[_0x46e7('0x30')],_0x42e747['filters']));if(_0x4c8675[_0x46e7('0x30')]['filter']){_0x2e4227[_0x46e7('0x38')]=_['merge'](_0x2e4227[_0x46e7('0x38')],{'$or':_[_0x46e7('0x2a')](_0x2e4227[_0x46e7('0x33')],function(_0x33ff93){var _0x531aa4={};_0x531aa4[_0x33ff93]={'$like':'%'+_0x4c8675['query'][_0x46e7('0x3a')]+'%'};return _0x531aa4;})});}_0x2e4227=_['merge']({},_0x2e4227,_0x4c8675[_0x46e7('0x3e')]);return _0x2a015a['getDescriptions'](_0x2e4227);}})[_0x46e7('0x26')](function(_0x37148b){if(_0x37148b){_0x2ceafb=_0x37148b[_0x46e7('0x35')];if(!_0x4c8675[_0x46e7('0x30')][_0x46e7('0x4b')](_0x46e7('0x4c'))){_0x2e4227['limit']=qs[_0x46e7('0x1d')](_0x4c8675[_0x46e7('0x30')][_0x46e7('0x1d')]);_0x2e4227[_0x46e7('0x1c')]=qs[_0x46e7('0x1c')](_0x4c8675[_0x46e7('0x30')][_0x46e7('0x1c')]);}return _0x2a015a['getDescriptions'](_0x2e4227);}})['then'](function(_0xb1652c){if(_0xb1652c){return _0xb1652c?{'count':_0x2ceafb,'rows':_0xb1652c}:null;}})[_0x46e7('0x26')](respondWithResult(_0x22c0e2,null))[_0x46e7('0x45')](handleError(_0x22c0e2,null));};exports[_0x46e7('0x4e')]=function(_0x18ca59,_0x4e866e,_0x426092){var _0x23b0c5={};var _0x11661d={};var _0xd5edd7;var _0x3495d4;return db[_0x46e7('0x2b')][_0x46e7('0x48')]({'where':{'id':_0x18ca59[_0x46e7('0x42')]['id']}})[_0x46e7('0x26')](handleEntityNotFound(_0x4e866e,null))[_0x46e7('0x26')](function(_0x4d34c1){if(_0x4d34c1){_0xd5edd7=_0x4d34c1;_0x11661d['model']=_[_0x46e7('0x43')](db[_0x46e7('0x4f')]['rawAttributes']);_0x11661d[_0x46e7('0x30')]=_[_0x46e7('0x43')](_0x18ca59[_0x46e7('0x30')]);_0x11661d[_0x46e7('0x31')]=_[_0x46e7('0x32')](_0x11661d[_0x46e7('0x2f')],_0x11661d[_0x46e7('0x30')]);_0x23b0c5[_0x46e7('0x33')]=_['intersection'](_0x11661d[_0x46e7('0x2f')],qs['fields'](_0x18ca59[_0x46e7('0x30')][_0x46e7('0x34')]));_0x23b0c5[_0x46e7('0x33')]=_0x23b0c5[_0x46e7('0x33')][_0x46e7('0x35')]?_0x23b0c5[_0x46e7('0x33')]:_0x11661d[_0x46e7('0x2f')];_0x23b0c5[_0x46e7('0x36')]=qs[_0x46e7('0x37')](_0x18ca59['query'][_0x46e7('0x37')]);_0x23b0c5[_0x46e7('0x38')]=qs[_0x46e7('0x31')](_[_0x46e7('0x39')](_0x18ca59[_0x46e7('0x30')],_0x11661d[_0x46e7('0x31')]));if(_0x18ca59[_0x46e7('0x30')][_0x46e7('0x3a')]){_0x23b0c5[_0x46e7('0x38')]=_['merge'](_0x23b0c5[_0x46e7('0x38')],{'$or':_[_0x46e7('0x2a')](_0x23b0c5['attributes'],function(_0x1326c0){var _0x3f1797={};_0x3f1797[_0x1326c0]={'$like':'%'+_0x18ca59['query'][_0x46e7('0x3a')]+'%'};return _0x3f1797;})});}_0x23b0c5=_[_0x46e7('0x3b')]({},_0x23b0c5,_0x18ca59[_0x46e7('0x3e')]);return _0xd5edd7[_0x46e7('0x4e')](_0x23b0c5);}})[_0x46e7('0x26')](function(_0x2023ba){if(_0x2023ba){_0x3495d4=_0x2023ba[_0x46e7('0x35')];if(!_0x18ca59['query'][_0x46e7('0x4b')](_0x46e7('0x4c'))){_0x23b0c5[_0x46e7('0x1d')]=qs['limit'](_0x18ca59['query'][_0x46e7('0x1d')]);_0x23b0c5[_0x46e7('0x1c')]=qs['offset'](_0x18ca59[_0x46e7('0x30')][_0x46e7('0x1c')]);}return _0xd5edd7[_0x46e7('0x4e')](_0x23b0c5);}})[_0x46e7('0x26')](function(_0x4c1658){if(_0x4c1658){return _0x4c1658?{'count':_0x3495d4,'rows':_0x4c1658}:null;}})['then'](respondWithResult(_0x4e866e,null))[_0x46e7('0x45')](handleError(_0x4e866e,null));};exports[_0x46e7('0x50')]=function(_0x3433a4,_0x5139aa,_0x599a52){if(_0x3433a4[_0x46e7('0x47')]['id']){delete _0x3433a4['body']['id'];}return db[_0x46e7('0x2b')]['findOne']({'where':{'id':_0x3433a4[_0x46e7('0x42')]['id']}})[_0x46e7('0x26')](handleEntityNotFound(_0x5139aa,null))[_0x46e7('0x26')](function(_0x628873){if(_0x628873){return _0x628873[_0x46e7('0x50')](_0x3433a4[_0x46e7('0x47')]['ids']||[]);}return null;})[_0x46e7('0x26')](respondWithResult(_0x5139aa,null))[_0x46e7('0x45')](handleError(_0x5139aa,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index d2cf1ba..c88bda0 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 _0x4cf8=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b1827,_0x28cf3d){var _0x1f6acf=function(_0x1927be){while(--_0x1927be){_0x2b1827['push'](_0x2b1827['shift']());}};_0x1f6acf(++_0x28cf3d);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x4cf8[_0x448f8];return _0xa73126;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('ZendeskConfiguration',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['int_zendesk_configurations','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0xfbfb3a,_0x362c75){var _0x3f7f5a=function(_0x26eb28){while(--_0x26eb28){_0xfbfb3a['push'](_0xfbfb3a['shift']());}};_0x3f7f5a(++_0x362c75);}(_0x2032,0xd9));var _0x2203=function(_0x30cf17,_0x2fed35){_0x30cf17=_0x30cf17-0x0;var _0x2587cb=_0x2032[_0x30cf17];return _0x2587cb;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 093ec6b..91627fe 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 _0x908b=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x908b,0x19c));var _0xb908=function(_0x5a4eeb,_0x233e80){_0x5a4eeb=_0x5a4eeb-0x0;var _0x5ff476=_0x908b[_0x5a4eeb];return _0x5ff476;};'use strict';var _=require(_0xb908('0x0'));var util=require(_0xb908('0x1'));var moment=require(_0xb908('0x2'));var BPromise=require(_0xb908('0x3'));var rs=require(_0xb908('0x4'));var fs=require('fs');var Redis=require(_0xb908('0x5'));var db=require(_0xb908('0x6'))['db'];var utils=require(_0xb908('0x7'));var logger=require(_0xb908('0x8'))(_0xb908('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb908('0xa')][_0xb908('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x405ebe,_0x5027f3,_0x576d85){return new BPromise(function(_0x4fc33b,_0x526c69){return client[_0xb908('0xc')](_0x405ebe,_0x576d85)[_0xb908('0xd')](function(_0x203d9a){logger[_0xb908('0xe')](_0xb908('0xf'),_0x5027f3,_0xb908('0x10'));logger[_0xb908('0x11')](_0xb908('0x12'),_0x5027f3,_0xb908('0x10'),JSON[_0xb908('0x13')](_0x203d9a));if(_0x203d9a[_0xb908('0x14')]){if(_0x203d9a[_0xb908('0x14')][_0xb908('0x15')]===0x1f4){logger[_0xb908('0x14')](_0xb908('0xf'),_0x5027f3,_0x203d9a[_0xb908('0x14')][_0xb908('0x16')]);return _0x526c69(_0x203d9a[_0xb908('0x14')]['message']);}logger[_0xb908('0x14')](_0xb908('0xf'),_0x5027f3,_0x203d9a[_0xb908('0x14')][_0xb908('0x16')]);return _0x4fc33b(_0x203d9a['error'][_0xb908('0x16')]);}else{logger['info'](_0xb908('0xf'),_0x5027f3,'request\x20sent');_0x4fc33b(_0x203d9a[_0xb908('0x17')][_0xb908('0x16')]);}})[_0xb908('0x18')](function(_0x428afa){logger[_0xb908('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5027f3,_0x428afa);_0x526c69(_0x428afa);});});} \ No newline at end of file +var _0x390c=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x5cec00,_0x979dd0){var _0x15fbf7=function(_0x50a3f0){while(--_0x50a3f0){_0x5cec00['push'](_0x5cec00['shift']());}};_0x15fbf7(++_0x979dd0);}(_0x390c,0x81));var _0xc390=function(_0x840cef,_0xa6acd8){_0x840cef=_0x840cef-0x0;var _0x2427dc=_0x390c[_0x840cef];return _0x2427dc;};'use strict';var _=require('lodash');var util=require(_0xc390('0x0'));var moment=require(_0xc390('0x1'));var BPromise=require(_0xc390('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc390('0x3'));var db=require(_0xc390('0x4'))['db'];var utils=require(_0xc390('0x5'));var logger=require('../../config/logger')(_0xc390('0x6'));var config=require(_0xc390('0x7'));var jayson=require(_0xc390('0x8'));var client=jayson[_0xc390('0x9')][_0xc390('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35188d,_0x15de58,_0x2cd7cc){return new BPromise(function(_0xc9910e,_0x39def6){return client[_0xc390('0xb')](_0x35188d,_0x2cd7cc)[_0xc390('0xc')](function(_0x1d1aa5){logger[_0xc390('0xd')](_0xc390('0xe'),_0x15de58,'request\x20sent');logger[_0xc390('0xf')](_0xc390('0x10'),_0x15de58,_0xc390('0x11'),JSON[_0xc390('0x12')](_0x1d1aa5));if(_0x1d1aa5['error']){if(_0x1d1aa5[_0xc390('0x13')][_0xc390('0x14')]===0x1f4){logger[_0xc390('0x13')](_0xc390('0xe'),_0x15de58,_0x1d1aa5[_0xc390('0x13')]['message']);return _0x39def6(_0x1d1aa5[_0xc390('0x13')][_0xc390('0x15')]);}logger['error'](_0xc390('0xe'),_0x15de58,_0x1d1aa5[_0xc390('0x13')][_0xc390('0x15')]);return _0xc9910e(_0x1d1aa5[_0xc390('0x13')]['message']);}else{logger[_0xc390('0xd')](_0xc390('0xe'),_0x15de58,'request\x20sent');_0xc9910e(_0x1d1aa5[_0xc390('0x16')]['message']);}})[_0xc390('0x17')](function(_0x5b5e6f){logger[_0xc390('0x13')](_0xc390('0xe'),_0x15de58,_0x5b5e6f);_0x39def6(_0x5b5e6f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7fa0a34..7c5db7b 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 _0xde87=['/:id','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','post','create'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0xde87,0x193));var _0x7de8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde87[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7de8('0x0'));var util=require(_0x7de8('0x1'));var path=require(_0x7de8('0x2'));var timeout=require(_0x7de8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7de8('0x4'));var auth=require(_0x7de8('0x5'));var interaction=require(_0x7de8('0x6'));var config=require('../../config/environment');var controller=require(_0x7de8('0x7'));router[_0x7de8('0x8')]('/',auth[_0x7de8('0x9')](),controller[_0x7de8('0xa')]);router['get']('/:id',auth[_0x7de8('0x9')](),controller['show']);router[_0x7de8('0xb')]('/',auth[_0x7de8('0x9')](),controller[_0x7de8('0xc')]);router['put'](_0x7de8('0xd'),auth[_0x7de8('0x9')](),controller['update']);router[_0x7de8('0xe')](_0x7de8('0xd'),auth[_0x7de8('0x9')](),controller['destroy']);module[_0x7de8('0xf')]=router; \ No newline at end of file +var _0xa3fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x1cb21a,_0x4bc8d7){var _0x2d80b2=function(_0x7f2e25){while(--_0x7f2e25){_0x1cb21a['push'](_0x1cb21a['shift']());}};_0x2d80b2(++_0x4bc8d7);}(_0xa3fe,0xd7));var _0xea3f=function(_0x5caafa,_0x45346b){_0x5caafa=_0x5caafa-0x0;var _0x176a7c=_0xa3fe[_0x5caafa];return _0x176a7c;};'use strict';var multer=require(_0xea3f('0x0'));var util=require(_0xea3f('0x1'));var path=require('path');var timeout=require(_0xea3f('0x2'));var express=require(_0xea3f('0x3'));var router=express[_0xea3f('0x4')]();var fs_extra=require(_0xea3f('0x5'));var auth=require(_0xea3f('0x6'));var interaction=require(_0xea3f('0x7'));var config=require(_0xea3f('0x8'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xea3f('0x9')](),controller['index']);router['get'](_0xea3f('0xa'),auth['isAuthenticated'](),controller[_0xea3f('0xb')]);router['post']('/',auth[_0xea3f('0x9')](),controller[_0xea3f('0xc')]);router[_0xea3f('0xd')](_0xea3f('0xa'),auth[_0xea3f('0x9')](),controller[_0xea3f('0xe')]);router['delete']('/:id',auth[_0xea3f('0x9')](),controller[_0xea3f('0xf')]);module[_0xea3f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 94cc0d9..356f5a5 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 _0xb7e8=['sequelize','string','variable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x3116c9,_0x1db034){var _0x2ca671=function(_0x24dae4){while(--_0x24dae4){_0x3116c9['push'](_0x3116c9['shift']());}};_0x2ca671(++_0x1db034);}(_0xb7e8,0x1c7));var _0x8b7e=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0xb7e8[_0x1057a3];return _0x131cdb;};'use strict';var Sequelize=require(_0x8b7e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x8b7e('0x1'),_0x8b7e('0x2'),'customVariable',_0x8b7e('0x3'),'picklist'),'defaultValue':_0x8b7e('0x1')},'content':{'type':Sequelize[_0x8b7e('0x4')]},'key':{'type':Sequelize[_0x8b7e('0x4')]},'keyType':{'type':Sequelize[_0x8b7e('0x5')](_0x8b7e('0x1'),_0x8b7e('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x8b7e('0x4')]},'idField':{'type':Sequelize[_0x8b7e('0x4')]},'nameField':{'type':Sequelize[_0x8b7e('0x4')]},'customField':{'type':Sequelize[_0x8b7e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b7e('0x4')]}}; \ No newline at end of file +var _0xaa3e=['variable','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0x2c541c,_0x5227f7){var _0x4656a7=function(_0x481cfb){while(--_0x481cfb){_0x2c541c['push'](_0x2c541c['shift']());}};_0x4656a7(++_0x5227f7);}(_0xaa3e,0x7d));var _0xeaa3=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xaa3e[_0x5e8c32];return _0x595f7b;};'use strict';var Sequelize=require(_0xeaa3('0x0'));module['exports']={'type':{'type':Sequelize[_0xeaa3('0x1')](_0xeaa3('0x2'),_0xeaa3('0x3'),'customVariable','keyValue',_0xeaa3('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeaa3('0x5')]},'key':{'type':Sequelize[_0xeaa3('0x5')]},'keyType':{'type':Sequelize[_0xeaa3('0x1')](_0xeaa3('0x2'),_0xeaa3('0x3'),_0xeaa3('0x6'))},'keyContent':{'type':Sequelize[_0xeaa3('0x5')]},'idField':{'type':Sequelize[_0xeaa3('0x5')]},'nameField':{'type':Sequelize[_0xeaa3('0x5')]},'customField':{'type':Sequelize[_0xeaa3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeaa3('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e5fb646..5a81f46 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 _0x8d59=['query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','ZendeskField','rows','catch','show','params','find','create','update','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','name','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection'];(function(_0x309551,_0x51879e){var _0x54bce3=function(_0x433af8){while(--_0x433af8){_0x309551['push'](_0x309551['shift']());}};_0x54bce3(++_0x51879e);}(_0x8d59,0xa5));var _0x98d5=function(_0x5734ac,_0x14105e){_0x5734ac=_0x5734ac-0x0;var _0x538ad6=_0x8d59[_0x5734ac];return _0x538ad6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98d5('0x0'));var zipdir=require(_0x98d5('0x1'));var jsonpatch=require(_0x98d5('0x2'));var rp=require('request-promise');var moment=require(_0x98d5('0x3'));var BPromise=require(_0x98d5('0x4'));var Mustache=require(_0x98d5('0x5'));var util=require('util');var path=require(_0x98d5('0x6'));var sox=require(_0x98d5('0x7'));var csv=require(_0x98d5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98d5('0x9'));var squel=require(_0x98d5('0xa'));var crypto=require(_0x98d5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x98d5('0xc'));var toCsv=require(_0x98d5('0x8'));var querystring=require(_0x98d5('0xd'));var Papa=require(_0x98d5('0xe'));var Redis=require(_0x98d5('0xf'));var authService=require(_0x98d5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98d5('0x11'));var logger=require(_0x98d5('0x12'))('api');var utils=require(_0x98d5('0x13'));var config=require(_0x98d5('0x14'));var licenseUtil=require(_0x98d5('0x15'));var db=require(_0x98d5('0x16'))['db'];function respondWithStatusCode(_0x4cf63d,_0x5af53f){_0x5af53f=_0x5af53f||0xcc;return function(_0x959e09){if(_0x959e09){return _0x4cf63d['sendStatus'](_0x5af53f);}return _0x4cf63d[_0x98d5('0x17')](_0x5af53f)['end']();};}function respondWithResult(_0x4a3e8e,_0x31a878){_0x31a878=_0x31a878||0xc8;return function(_0x50bbd7){if(_0x50bbd7){return _0x4a3e8e['status'](_0x31a878)[_0x98d5('0x18')](_0x50bbd7);}};}function respondWithFilteredResult(_0x362123,_0x25fe09){return function(_0x5b998f){if(_0x5b998f){var _0x59b487=typeof _0x25fe09['offset']==='undefined'&&typeof _0x25fe09[_0x98d5('0x19')]==='undefined';var _0x537115=_0x5b998f[_0x98d5('0x1a')];var _0x3bb2e1=_0x59b487?0x0:_0x25fe09[_0x98d5('0x1b')];var _0x42074d=_0x59b487?_0x5b998f[_0x98d5('0x1a')]:_0x25fe09['offset']+_0x25fe09[_0x98d5('0x19')];var _0x2dcc11;if(_0x42074d>=_0x537115){_0x42074d=_0x537115;_0x2dcc11=0xc8;}else{_0x2dcc11=0xce;}_0x362123['status'](_0x2dcc11);return _0x362123[_0x98d5('0x1c')](_0x98d5('0x1d'),_0x3bb2e1+'-'+_0x42074d+'/'+_0x537115)[_0x98d5('0x18')](_0x5b998f);}return null;};}function patchUpdates(_0x54df61){return function(_0x392e62){try{jsonpatch[_0x98d5('0x1e')](_0x392e62,_0x54df61,!![]);}catch(_0x4adf43){return BPromise[_0x98d5('0x1f')](_0x4adf43);}return _0x392e62[_0x98d5('0x20')]();};}function saveUpdates(_0x2fc183,_0x294300){return function(_0x3976b1){if(_0x3976b1){return _0x3976b1['update'](_0x2fc183)['then'](function(_0x1d7420){return _0x1d7420;});}return null;};}function removeEntity(_0x12d30d,_0xed61ab){return function(_0x19912e){if(_0x19912e){return _0x19912e[_0x98d5('0x21')]()[_0x98d5('0x22')](function(){_0x12d30d[_0x98d5('0x17')](0xcc)[_0x98d5('0x23')]();});}};}function handleEntityNotFound(_0x2246c6,_0x17b902){return function(_0x7f7328){if(!_0x7f7328){_0x2246c6[_0x98d5('0x24')](0x194);}return _0x7f7328;};}function handleError(_0x44f098,_0x5a488b){_0x5a488b=_0x5a488b||0x1f4;return function(_0x2cae66){logger[_0x98d5('0x25')](_0x2cae66['stack']);if(_0x2cae66[_0x98d5('0x26')]){delete _0x2cae66[_0x98d5('0x26')];}_0x44f098[_0x98d5('0x17')](_0x5a488b)['send'](_0x2cae66);};}exports['index']=function(_0x4d794b,_0x3a3d81){var _0xebc457={},_0x532ea4={},_0x22ce1f={'count':0x0,'rows':[]};var _0x27d433=_[_0x98d5('0x27')](db['ZendeskField'][_0x98d5('0x28')],function(_0x21f21b){return{'name':_0x21f21b[_0x98d5('0x29')],'type':_0x21f21b[_0x98d5('0x2a')][_0x98d5('0x2b')]};});_0x532ea4[_0x98d5('0x2c')]=_[_0x98d5('0x27')](_0x27d433,_0x98d5('0x26'));_0x532ea4['query']=_[_0x98d5('0x2d')](_0x4d794b['query']);_0x532ea4[_0x98d5('0x2e')]=_[_0x98d5('0x2f')](_0x532ea4[_0x98d5('0x2c')],_0x532ea4[_0x98d5('0x30')]);_0xebc457[_0x98d5('0x31')]=_[_0x98d5('0x2f')](_0x532ea4[_0x98d5('0x2c')],qs[_0x98d5('0x32')](_0x4d794b[_0x98d5('0x30')][_0x98d5('0x32')]));_0xebc457[_0x98d5('0x31')]=_0xebc457[_0x98d5('0x31')][_0x98d5('0x33')]?_0xebc457[_0x98d5('0x31')]:_0x532ea4[_0x98d5('0x2c')];if(!_0x4d794b[_0x98d5('0x30')][_0x98d5('0x34')]('nolimit')){_0xebc457['limit']=qs[_0x98d5('0x19')](_0x4d794b['query'][_0x98d5('0x19')]);_0xebc457['offset']=qs[_0x98d5('0x1b')](_0x4d794b[_0x98d5('0x30')][_0x98d5('0x1b')]);}_0xebc457[_0x98d5('0x35')]=qs[_0x98d5('0x36')](_0x4d794b['query'][_0x98d5('0x36')]);_0xebc457['where']=qs['filters'](_[_0x98d5('0x37')](_0x4d794b[_0x98d5('0x30')],_0x532ea4[_0x98d5('0x2e')]),_0x27d433);if(_0x4d794b[_0x98d5('0x30')][_0x98d5('0x38')]){_0xebc457[_0x98d5('0x39')]=_[_0x98d5('0x3a')](_0xebc457[_0x98d5('0x39')],{'$or':_[_0x98d5('0x27')](_0x27d433,function(_0x4e439e){if(_0x4e439e[_0x98d5('0x2a')]!=='VIRTUAL'){var _0x2ee5da={};_0x2ee5da[_0x4e439e['name']]={'$like':'%'+_0x4d794b[_0x98d5('0x30')][_0x98d5('0x38')]+'%'};return _0x2ee5da;}})});}_0xebc457=_[_0x98d5('0x3a')]({},_0xebc457,_0x4d794b[_0x98d5('0x3b')]);var _0x48d73e={'where':_0xebc457[_0x98d5('0x39')]};return db['ZendeskField'][_0x98d5('0x1a')](_0x48d73e)[_0x98d5('0x22')](function(_0xd9b73f){_0x22ce1f[_0x98d5('0x1a')]=_0xd9b73f;if(_0x4d794b[_0x98d5('0x30')][_0x98d5('0x3c')]){_0xebc457[_0x98d5('0x3d')]=[{'all':!![]}];}return db[_0x98d5('0x3e')]['findAll'](_0xebc457);})['then'](function(_0x2d2eca){_0x22ce1f[_0x98d5('0x3f')]=_0x2d2eca;return _0x22ce1f;})[_0x98d5('0x22')](respondWithFilteredResult(_0x3a3d81,_0xebc457))[_0x98d5('0x40')](handleError(_0x3a3d81,null));};exports[_0x98d5('0x41')]=function(_0x59918a,_0x3d048e){var _0x186207={'raw':!![],'where':{'id':_0x59918a[_0x98d5('0x42')]['id']}},_0xa82efd={};_0xa82efd[_0x98d5('0x2c')]=_[_0x98d5('0x2d')](db[_0x98d5('0x3e')][_0x98d5('0x28')]);_0xa82efd[_0x98d5('0x30')]=_['keys'](_0x59918a[_0x98d5('0x30')]);_0xa82efd[_0x98d5('0x2e')]=_[_0x98d5('0x2f')](_0xa82efd[_0x98d5('0x2c')],_0xa82efd[_0x98d5('0x30')]);_0x186207[_0x98d5('0x31')]=_[_0x98d5('0x2f')](_0xa82efd[_0x98d5('0x2c')],qs[_0x98d5('0x32')](_0x59918a['query'][_0x98d5('0x32')]));_0x186207[_0x98d5('0x31')]=_0x186207['attributes'][_0x98d5('0x33')]?_0x186207[_0x98d5('0x31')]:_0xa82efd[_0x98d5('0x2c')];if(_0x59918a[_0x98d5('0x30')][_0x98d5('0x3c')]){_0x186207[_0x98d5('0x3d')]=[{'all':!![]}];}_0x186207=_[_0x98d5('0x3a')]({},_0x186207,_0x59918a[_0x98d5('0x3b')]);return db[_0x98d5('0x3e')][_0x98d5('0x43')](_0x186207)[_0x98d5('0x22')](handleEntityNotFound(_0x3d048e,null))[_0x98d5('0x22')](respondWithResult(_0x3d048e,null))['catch'](handleError(_0x3d048e,null));};exports['create']=function(_0x1e5513,_0x308659){return db[_0x98d5('0x3e')][_0x98d5('0x44')](_0x1e5513['body'],{})[_0x98d5('0x22')](respondWithResult(_0x308659,0xc9))[_0x98d5('0x40')](handleError(_0x308659,null));};exports[_0x98d5('0x45')]=function(_0x18e5f1,_0x48b2f4){if(_0x18e5f1[_0x98d5('0x46')]['id']){delete _0x18e5f1[_0x98d5('0x46')]['id'];}return db[_0x98d5('0x3e')]['find']({'where':{'id':_0x18e5f1['params']['id']}})[_0x98d5('0x22')](handleEntityNotFound(_0x48b2f4,null))[_0x98d5('0x22')](saveUpdates(_0x18e5f1['body'],null))[_0x98d5('0x22')](respondWithResult(_0x48b2f4,null))[_0x98d5('0x40')](handleError(_0x48b2f4,null));};exports[_0x98d5('0x21')]=function(_0x1ef88f,_0x2d5173){return db['ZendeskField'][_0x98d5('0x43')]({'where':{'id':_0x1ef88f['params']['id']}})[_0x98d5('0x22')](handleEntityNotFound(_0x2d5173,null))['then'](removeEntity(_0x2d5173,null))[_0x98d5('0x40')](handleError(_0x2d5173,null));}; \ No newline at end of file +var _0x93e7=['includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','ZendeskField','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','count'];(function(_0x554494,_0x462f8a){var _0x34d6c1=function(_0x43ae88){while(--_0x43ae88){_0x554494['push'](_0x554494['shift']());}};_0x34d6c1(++_0x462f8a);}(_0x93e7,0x9e));var _0x793e=function(_0x294f3d,_0x1b0f82){_0x294f3d=_0x294f3d-0x0;var _0x2c8f6c=_0x93e7[_0x294f3d];return _0x2c8f6c;};'use strict';var emlformat=require(_0x793e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x793e('0x1'));var jsonpatch=require(_0x793e('0x2'));var rp=require('request-promise');var moment=require(_0x793e('0x3'));var BPromise=require(_0x793e('0x4'));var Mustache=require(_0x793e('0x5'));var util=require(_0x793e('0x6'));var path=require('path');var sox=require(_0x793e('0x7'));var csv=require('to-csv');var ejs=require(_0x793e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x793e('0x9'));var squel=require('squel');var crypto=require(_0x793e('0xa'));var jsforce=require(_0x793e('0xb'));var deskjs=require(_0x793e('0xc'));var toCsv=require(_0x793e('0xd'));var querystring=require(_0x793e('0xe'));var Papa=require(_0x793e('0xf'));var Redis=require(_0x793e('0x10'));var authService=require(_0x793e('0x11'));var qs=require(_0x793e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x793e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x793e('0x14'));var db=require(_0x793e('0x15'))['db'];function respondWithStatusCode(_0x57709f,_0x6a5f34){_0x6a5f34=_0x6a5f34||0xcc;return function(_0x2e2efe){if(_0x2e2efe){return _0x57709f[_0x793e('0x16')](_0x6a5f34);}return _0x57709f[_0x793e('0x17')](_0x6a5f34)[_0x793e('0x18')]();};}function respondWithResult(_0x410914,_0x1c7c58){_0x1c7c58=_0x1c7c58||0xc8;return function(_0x3a0952){if(_0x3a0952){return _0x410914[_0x793e('0x17')](_0x1c7c58)[_0x793e('0x19')](_0x3a0952);}};}function respondWithFilteredResult(_0x1121e5,_0x36686c){return function(_0x418b5f){if(_0x418b5f){var _0x18990a=typeof _0x36686c[_0x793e('0x1a')]===_0x793e('0x1b')&&typeof _0x36686c[_0x793e('0x1c')]===_0x793e('0x1b');var _0xeacea6=_0x418b5f['count'];var _0x3b38ef=_0x18990a?0x0:_0x36686c[_0x793e('0x1a')];var _0x4ba056=_0x18990a?_0x418b5f['count']:_0x36686c['offset']+_0x36686c[_0x793e('0x1c')];var _0x2f0494;if(_0x4ba056>=_0xeacea6){_0x4ba056=_0xeacea6;_0x2f0494=0xc8;}else{_0x2f0494=0xce;}_0x1121e5[_0x793e('0x17')](_0x2f0494);return _0x1121e5[_0x793e('0x1d')](_0x793e('0x1e'),_0x3b38ef+'-'+_0x4ba056+'/'+_0xeacea6)[_0x793e('0x19')](_0x418b5f);}return null;};}function patchUpdates(_0x1af167){return function(_0x9413f9){try{jsonpatch[_0x793e('0x1f')](_0x9413f9,_0x1af167,!![]);}catch(_0x31413a){return BPromise[_0x793e('0x20')](_0x31413a);}return _0x9413f9[_0x793e('0x21')]();};}function saveUpdates(_0x1596bf,_0xed37e){return function(_0x33fe28){if(_0x33fe28){return _0x33fe28[_0x793e('0x22')](_0x1596bf)[_0x793e('0x23')](function(_0x4be20c){return _0x4be20c;});}return null;};}function removeEntity(_0x59a4ff,_0xc259c8){return function(_0x36840f){if(_0x36840f){return _0x36840f['destroy']()[_0x793e('0x23')](function(){_0x59a4ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b37a,_0x59b191){return function(_0x5203aa){if(!_0x5203aa){_0x55b37a[_0x793e('0x16')](0x194);}return _0x5203aa;};}function handleError(_0x74048a,_0x4c7816){_0x4c7816=_0x4c7816||0x1f4;return function(_0x361a87){logger[_0x793e('0x24')](_0x361a87[_0x793e('0x25')]);if(_0x361a87[_0x793e('0x26')]){delete _0x361a87[_0x793e('0x26')];}_0x74048a[_0x793e('0x17')](_0x4c7816)[_0x793e('0x27')](_0x361a87);};}exports[_0x793e('0x28')]=function(_0x597c7d,_0xfe7fb9){var _0x48edff={},_0x4a45ae={},_0x530316={'count':0x0,'rows':[]};var _0xeb38af=_['map'](db[_0x793e('0x29')]['rawAttributes'],function(_0x2bebef){return{'name':_0x2bebef[_0x793e('0x2a')],'type':_0x2bebef['type']['key']};});_0x4a45ae[_0x793e('0x2b')]=_['map'](_0xeb38af,_0x793e('0x26'));_0x4a45ae[_0x793e('0x2c')]=_[_0x793e('0x2d')](_0x597c7d['query']);_0x4a45ae[_0x793e('0x2e')]=_[_0x793e('0x2f')](_0x4a45ae[_0x793e('0x2b')],_0x4a45ae[_0x793e('0x2c')]);_0x48edff[_0x793e('0x30')]=_['intersection'](_0x4a45ae[_0x793e('0x2b')],qs[_0x793e('0x31')](_0x597c7d[_0x793e('0x2c')][_0x793e('0x31')]));_0x48edff['attributes']=_0x48edff[_0x793e('0x30')][_0x793e('0x32')]?_0x48edff[_0x793e('0x30')]:_0x4a45ae[_0x793e('0x2b')];if(!_0x597c7d[_0x793e('0x2c')]['hasOwnProperty'](_0x793e('0x33'))){_0x48edff[_0x793e('0x1c')]=qs[_0x793e('0x1c')](_0x597c7d[_0x793e('0x2c')][_0x793e('0x1c')]);_0x48edff[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0x597c7d[_0x793e('0x2c')]['offset']);}_0x48edff[_0x793e('0x34')]=qs[_0x793e('0x35')](_0x597c7d[_0x793e('0x2c')][_0x793e('0x35')]);_0x48edff[_0x793e('0x36')]=qs[_0x793e('0x2e')](_['pick'](_0x597c7d[_0x793e('0x2c')],_0x4a45ae[_0x793e('0x2e')]),_0xeb38af);if(_0x597c7d[_0x793e('0x2c')][_0x793e('0x37')]){_0x48edff[_0x793e('0x36')]=_[_0x793e('0x38')](_0x48edff[_0x793e('0x36')],{'$or':_[_0x793e('0x39')](_0xeb38af,function(_0x57fdec){if(_0x57fdec[_0x793e('0x3a')]!==_0x793e('0x3b')){var _0x397af4={};_0x397af4[_0x57fdec[_0x793e('0x26')]]={'$like':'%'+_0x597c7d[_0x793e('0x2c')][_0x793e('0x37')]+'%'};return _0x397af4;}})});}_0x48edff=_['merge']({},_0x48edff,_0x597c7d['options']);var _0x2d4037={'where':_0x48edff[_0x793e('0x36')]};return db[_0x793e('0x29')][_0x793e('0x3c')](_0x2d4037)[_0x793e('0x23')](function(_0x28343b){_0x530316[_0x793e('0x3c')]=_0x28343b;if(_0x597c7d[_0x793e('0x2c')][_0x793e('0x3d')]){_0x48edff[_0x793e('0x3e')]=[{'all':!![]}];}return db[_0x793e('0x29')][_0x793e('0x3f')](_0x48edff);})[_0x793e('0x23')](function(_0x1f3059){_0x530316[_0x793e('0x40')]=_0x1f3059;return _0x530316;})[_0x793e('0x23')](respondWithFilteredResult(_0xfe7fb9,_0x48edff))[_0x793e('0x41')](handleError(_0xfe7fb9,null));};exports[_0x793e('0x42')]=function(_0x1bec3d,_0xd0a349){var _0x10f99e={'raw':!![],'where':{'id':_0x1bec3d[_0x793e('0x43')]['id']}},_0x42883d={};_0x42883d[_0x793e('0x2b')]=_['keys'](db[_0x793e('0x29')]['rawAttributes']);_0x42883d['query']=_[_0x793e('0x2d')](_0x1bec3d[_0x793e('0x2c')]);_0x42883d[_0x793e('0x2e')]=_[_0x793e('0x2f')](_0x42883d[_0x793e('0x2b')],_0x42883d[_0x793e('0x2c')]);_0x10f99e[_0x793e('0x30')]=_[_0x793e('0x2f')](_0x42883d[_0x793e('0x2b')],qs['fields'](_0x1bec3d['query'][_0x793e('0x31')]));_0x10f99e[_0x793e('0x30')]=_0x10f99e[_0x793e('0x30')][_0x793e('0x32')]?_0x10f99e['attributes']:_0x42883d[_0x793e('0x2b')];if(_0x1bec3d[_0x793e('0x2c')][_0x793e('0x3d')]){_0x10f99e[_0x793e('0x3e')]=[{'all':!![]}];}_0x10f99e=_['merge']({},_0x10f99e,_0x1bec3d[_0x793e('0x44')]);return db[_0x793e('0x29')][_0x793e('0x45')](_0x10f99e)[_0x793e('0x23')](handleEntityNotFound(_0xd0a349,null))[_0x793e('0x23')](respondWithResult(_0xd0a349,null))['catch'](handleError(_0xd0a349,null));};exports['create']=function(_0x5cb3a8,_0x494921){return db[_0x793e('0x29')][_0x793e('0x46')](_0x5cb3a8[_0x793e('0x47')],{})[_0x793e('0x23')](respondWithResult(_0x494921,0xc9))['catch'](handleError(_0x494921,null));};exports[_0x793e('0x22')]=function(_0x794076,_0x112645){if(_0x794076['body']['id']){delete _0x794076[_0x793e('0x47')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x794076[_0x793e('0x43')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x112645,null))[_0x793e('0x23')](saveUpdates(_0x794076[_0x793e('0x47')],null))['then'](respondWithResult(_0x112645,null))[_0x793e('0x41')](handleError(_0x112645,null));};exports[_0x793e('0x48')]=function(_0x1e1b94,_0x363bf0){return db['ZendeskField']['find']({'where':{'id':_0x1e1b94['params']['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x363bf0,null))[_0x793e('0x23')](removeEntity(_0x363bf0,null))[_0x793e('0x41')](handleError(_0x363bf0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 8a677d7..56744f2 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 _0xa19f=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId','moment','bluebird'];(function(_0x1e6ed7,_0x547958){var _0x57952f=function(_0x86eef){while(--_0x86eef){_0x1e6ed7['push'](_0x1e6ed7['shift']());}};_0x57952f(++_0x547958);}(_0xa19f,0xc4));var _0xfa19=function(_0x246916,_0x43d19e){_0x246916=_0x246916-0x0;var _0x41800b=_0xa19f[_0x246916];return _0x41800b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfa19('0x0'));var BPromise=require(_0xfa19('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa19('0x2'));var rimraf=require(_0xfa19('0x3'));var config=require(_0xfa19('0x4'));var attributes=require(_0xfa19('0x5'));module[_0xfa19('0x6')]=function(_0x8c848d,_0x26b5f9){return _0x8c848d['define'](_0xfa19('0x7'),attributes,{'tableName':_0xfa19('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xfa19('0x9'),_0xfa19('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe06a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xe06a,0x19d));var _0xae06=function(_0x3ee8e7,_0xbd037a){_0x3ee8e7=_0x3ee8e7-0x0;var _0x44d046=_0xe06a[_0x3ee8e7];return _0x44d046;};'use strict';var _=require(_0xae06('0x0'));var util=require(_0xae06('0x1'));var logger=require(_0xae06('0x2'))('api');var moment=require(_0xae06('0x3'));var BPromise=require(_0xae06('0x4'));var rp=require(_0xae06('0x5'));var fs=require('fs');var path=require(_0xae06('0x6'));var rimraf=require(_0xae06('0x7'));var config=require(_0xae06('0x8'));var attributes=require(_0xae06('0x9'));module[_0xae06('0xa')]=function(_0x3c3ea9,_0x195b74){return _0x3c3ea9[_0xae06('0xb')](_0xae06('0xc'),attributes,{'tableName':_0xae06('0xd'),'paranoid':![],'indexes':[{'name':_0xae06('0xe'),'fields':['idField',_0xae06('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 19976ff..7ecd758 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 _0x4148=['http','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x4148,0x172));var _0x8414=function(_0x5e913f,_0x265fc0){_0x5e913f=_0x5e913f-0x0;var _0x472cc4=_0x4148[_0x5e913f];return _0x472cc4;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var moment=require(_0x8414('0x2'));var BPromise=require('bluebird');var rs=require(_0x8414('0x3'));var fs=require('fs');var Redis=require(_0x8414('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8414('0x5'));var logger=require('../../config/logger')(_0x8414('0x6'));var config=require(_0x8414('0x7'));var jayson=require(_0x8414('0x8'));var client=jayson[_0x8414('0x9')][_0x8414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26b97c,_0x2dbdc9,_0x2f9237){return new BPromise(function(_0x40e096,_0x13e2af){return client['request'](_0x26b97c,_0x2f9237)[_0x8414('0xb')](function(_0x4e177f){logger['info'](_0x8414('0xc'),_0x2dbdc9,'request\x20sent');logger[_0x8414('0xd')](_0x8414('0xe'),_0x2dbdc9,'request\x20sent',JSON['stringify'](_0x4e177f));if(_0x4e177f[_0x8414('0xf')]){if(_0x4e177f[_0x8414('0xf')][_0x8414('0x10')]===0x1f4){logger[_0x8414('0xf')](_0x8414('0xc'),_0x2dbdc9,_0x4e177f['error'][_0x8414('0x11')]);return _0x13e2af(_0x4e177f[_0x8414('0xf')][_0x8414('0x11')]);}logger['error'](_0x8414('0xc'),_0x2dbdc9,_0x4e177f[_0x8414('0xf')]['message']);return _0x40e096(_0x4e177f['error'][_0x8414('0x11')]);}else{logger[_0x8414('0x12')](_0x8414('0xc'),_0x2dbdc9,'request\x20sent');_0x40e096(_0x4e177f['result'][_0x8414('0x11')]);}})['catch'](function(_0x26d018){logger[_0x8414('0xf')](_0x8414('0xc'),_0x2dbdc9,_0x26d018);_0x13e2af(_0x26d018);});});} \ No newline at end of file +var _0x0872=['stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x0872,0x195));var _0x2087=function(_0x3b0ff8,_0x18f70a){_0x3b0ff8=_0x3b0ff8-0x0;var _0x310f4b=_0x0872[_0x3b0ff8];return _0x310f4b;};'use strict';var _=require(_0x2087('0x0'));var util=require(_0x2087('0x1'));var moment=require('moment');var BPromise=require(_0x2087('0x2'));var rs=require(_0x2087('0x3'));var fs=require('fs');var Redis=require(_0x2087('0x4'));var db=require(_0x2087('0x5'))['db'];var utils=require(_0x2087('0x6'));var logger=require(_0x2087('0x7'))(_0x2087('0x8'));var config=require(_0x2087('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2087('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cf196,_0x604961,_0x2ddedb){return new BPromise(function(_0x26d446,_0x5d6738){return client[_0x2087('0xb')](_0x3cf196,_0x2ddedb)['then'](function(_0x956daa){logger['info'](_0x2087('0xc'),_0x604961,_0x2087('0xd'));logger['debug'](_0x2087('0xe'),_0x604961,_0x2087('0xd'),JSON[_0x2087('0xf')](_0x956daa));if(_0x956daa['error']){if(_0x956daa[_0x2087('0x10')][_0x2087('0x11')]===0x1f4){logger[_0x2087('0x10')](_0x2087('0xc'),_0x604961,_0x956daa[_0x2087('0x10')][_0x2087('0x12')]);return _0x5d6738(_0x956daa[_0x2087('0x10')]['message']);}logger[_0x2087('0x10')]('ZendeskField,\x20%s,\x20%s',_0x604961,_0x956daa[_0x2087('0x10')]['message']);return _0x26d446(_0x956daa['error'][_0x2087('0x12')]);}else{logger[_0x2087('0x13')](_0x2087('0xc'),_0x604961,_0x2087('0xd'));_0x26d446(_0x956daa['result'][_0x2087('0x12')]);}})['catch'](function(_0x567b6b){logger[_0x2087('0x10')](_0x2087('0xc'),_0x604961,_0x567b6b);_0x5d6738(_0x567b6b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ff78d83..87b9abf 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 _0xbc7e=['getConfigurations','/:id/fields','getFields','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations'];(function(_0x1bbfec,_0x557099){var _0x2750b9=function(_0x19df1c){while(--_0x19df1c){_0x1bbfec['push'](_0x1bbfec['shift']());}};_0x2750b9(++_0x557099);}(_0xbc7e,0x129));var _0xebc7=function(_0x4e9fb4,_0x66b89){_0x4e9fb4=_0x4e9fb4-0x0;var _0x160386=_0xbc7e[_0x4e9fb4];return _0x160386;};'use strict';var multer=require(_0xebc7('0x0'));var util=require(_0xebc7('0x1'));var path=require(_0xebc7('0x2'));var timeout=require(_0xebc7('0x3'));var express=require(_0xebc7('0x4'));var router=express[_0xebc7('0x5')]();var fs_extra=require(_0xebc7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xebc7('0x7'));var config=require(_0xebc7('0x8'));var controller=require(_0xebc7('0x9'));router['get']('/',auth[_0xebc7('0xa')](),controller[_0xebc7('0xb')]);router[_0xebc7('0xc')]('/:id',auth[_0xebc7('0xa')](),controller[_0xebc7('0xd')]);router[_0xebc7('0xc')](_0xebc7('0xe'),auth[_0xebc7('0xa')](),controller[_0xebc7('0xf')]);router[_0xebc7('0xc')](_0xebc7('0x10'),auth['isAuthenticated'](),controller[_0xebc7('0x11')]);router[_0xebc7('0x12')]('/',auth[_0xebc7('0xa')](),controller['create']);router[_0xebc7('0x12')](_0xebc7('0xe'),auth[_0xebc7('0xa')](),controller['addConfiguration']);router[_0xebc7('0x13')](_0xebc7('0x14'),auth['isAuthenticated'](),controller[_0xebc7('0x15')]);router[_0xebc7('0x16')](_0xebc7('0x14'),auth[_0xebc7('0xa')](),controller[_0xebc7('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5f58=['/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id/configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f58,0x1a6));var _0x85f5=function(_0x354ab1,_0xec5b21){_0x354ab1=_0x354ab1-0x0;var _0x9918a1=_0x5f58[_0x354ab1];return _0x9918a1;};'use strict';var multer=require(_0x85f5('0x0'));var util=require('util');var path=require(_0x85f5('0x1'));var timeout=require(_0x85f5('0x2'));var express=require(_0x85f5('0x3'));var router=express[_0x85f5('0x4')]();var fs_extra=require(_0x85f5('0x5'));var auth=require(_0x85f5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x85f5('0x7'));var controller=require(_0x85f5('0x8'));router[_0x85f5('0x9')]('/',auth[_0x85f5('0xa')](),controller[_0x85f5('0xb')]);router['get']('/:id',auth[_0x85f5('0xa')](),controller[_0x85f5('0xc')]);router[_0x85f5('0x9')]('/:id/configurations',auth[_0x85f5('0xa')](),controller[_0x85f5('0xd')]);router[_0x85f5('0x9')]('/:id/fields',auth[_0x85f5('0xa')](),controller[_0x85f5('0xe')]);router[_0x85f5('0xf')]('/',auth[_0x85f5('0xa')](),controller[_0x85f5('0x10')]);router[_0x85f5('0xf')](_0x85f5('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x85f5('0x12'),auth[_0x85f5('0xa')](),controller[_0x85f5('0x13')]);router[_0x85f5('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x85f5('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 39e3a83..8ffdaa4 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 _0xb4e6=['sequelize','STRING'];(function(_0x3e2408,_0x3f5ad5){var _0x4cb923=function(_0x352341){while(--_0x352341){_0x3e2408['push'](_0x3e2408['shift']());}};_0x4cb923(++_0x3f5ad5);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0xb4e6[_0x57486e];return _0x5f110b;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'host':{'type':Sequelize[_0x6b4e('0x1')]},'zone':{'type':Sequelize[_0x6b4e('0x1')]},'clientId':{'type':Sequelize[_0x6b4e('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4e('0x1')]},'serverUrl':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6b4e('0x1')]}}; \ No newline at end of file +var _0x99e9=['exports','STRING'];(function(_0x383a93,_0x5baf82){var _0x2c00ee=function(_0x7a6aa5){while(--_0x7a6aa5){_0x383a93['push'](_0x383a93['shift']());}};_0x2c00ee(++_0x5baf82);}(_0x99e9,0xb4));var _0x999e=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x99e9[_0x16b992];return _0x385c78;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5d4a48f..1b287ef 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 _0xb6c8=['params','getConfigurations','findOne','ZohoConfiguration','order','filter','addConfiguration','Subjects','type','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','host','serverUrl','code','zoho.eu','com','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','system_mandatory','push','display_label','picklist','pick_list_values','test','statusCode','error','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','options','include','findAll','show','keys','includeAll','find','create','body','catch'];(function(_0x1acc2d,_0x1cfdac){var _0x1cc820=function(_0x4b7492){while(--_0x4b7492){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0x1cc820(++_0x1cfdac);}(_0xb6c8,0x1b1));var _0x8b6c=function(_0x12a8d4,_0xa6e278){_0x12a8d4=_0x12a8d4-0x0;var _0x53226e=_0xb6c8[_0x12a8d4];return _0x53226e;};'use strict';var emlformat=require(_0x8b6c('0x0'));var rimraf=require(_0x8b6c('0x1'));var zipdir=require(_0x8b6c('0x2'));var jsonpatch=require(_0x8b6c('0x3'));var rp=require(_0x8b6c('0x4'));var moment=require(_0x8b6c('0x5'));var BPromise=require(_0x8b6c('0x6'));var Mustache=require('mustache');var util=require(_0x8b6c('0x7'));var path=require(_0x8b6c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b6c('0x9'));var fs=require('fs');var fs_extra=require(_0x8b6c('0xa'));var _=require(_0x8b6c('0xb'));var squel=require(_0x8b6c('0xc'));var crypto=require(_0x8b6c('0xd'));var jsforce=require(_0x8b6c('0xe'));var deskjs=require(_0x8b6c('0xf'));var toCsv=require(_0x8b6c('0x10'));var querystring=require(_0x8b6c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b6c('0x12'));var qs=require(_0x8b6c('0x13'));var as=require(_0x8b6c('0x14'));var hardwareService=require(_0x8b6c('0x15'));var logger=require('../../config/logger')(_0x8b6c('0x16'));var utils=require(_0x8b6c('0x17'));var config=require(_0x8b6c('0x18'));var licenseUtil=require(_0x8b6c('0x19'));var db=require(_0x8b6c('0x1a'))['db'];var integrations=require(_0x8b6c('0x1b'));function respondWithStatusCode(_0x5970a5,_0x1de38f){_0x1de38f=_0x1de38f||0xcc;return function(_0x17d8e0){if(_0x17d8e0){return _0x5970a5['sendStatus'](_0x1de38f);}return _0x5970a5['status'](_0x1de38f)[_0x8b6c('0x1c')]();};}function respondWithResult(_0x3fee6,_0x5ecaad){_0x5ecaad=_0x5ecaad||0xc8;return function(_0xb6ab9d){if(_0xb6ab9d){return _0x3fee6[_0x8b6c('0x1d')](_0x5ecaad)[_0x8b6c('0x1e')](_0xb6ab9d);}};}function respondWithFilteredResult(_0x2a2b40,_0x3ea09e){return function(_0xc22b5f){if(_0xc22b5f){var _0x4b2e71=typeof _0x3ea09e['offset']==='undefined'&&typeof _0x3ea09e['limit']===_0x8b6c('0x1f');var _0xea6df1=_0xc22b5f[_0x8b6c('0x20')];var _0xc05619=_0x4b2e71?0x0:_0x3ea09e[_0x8b6c('0x21')];var _0x17ac15=_0x4b2e71?_0xc22b5f[_0x8b6c('0x20')]:_0x3ea09e[_0x8b6c('0x21')]+_0x3ea09e[_0x8b6c('0x22')];var _0x33c024;if(_0x17ac15>=_0xea6df1){_0x17ac15=_0xea6df1;_0x33c024=0xc8;}else{_0x33c024=0xce;}_0x2a2b40[_0x8b6c('0x1d')](_0x33c024);return _0x2a2b40[_0x8b6c('0x23')](_0x8b6c('0x24'),_0xc05619+'-'+_0x17ac15+'/'+_0xea6df1)[_0x8b6c('0x1e')](_0xc22b5f);}return null;};}function patchUpdates(_0x2eae54){return function(_0x49aa78){try{jsonpatch[_0x8b6c('0x25')](_0x49aa78,_0x2eae54,!![]);}catch(_0x20a9f8){return BPromise[_0x8b6c('0x26')](_0x20a9f8);}return _0x49aa78[_0x8b6c('0x27')]();};}function saveUpdates(_0x291509,_0x3d7dc5){return function(_0x291256){if(_0x291256){return _0x291256[_0x8b6c('0x28')](_0x291509)[_0x8b6c('0x29')](function(_0x4dd1a6){return _0x4dd1a6;});}return null;};}function removeEntity(_0x1ee2dc,_0xad9483){return function(_0x4030f0){if(_0x4030f0){return _0x4030f0[_0x8b6c('0x2a')]()['then'](function(){_0x1ee2dc[_0x8b6c('0x1d')](0xcc)[_0x8b6c('0x1c')]();});}};}function handleEntityNotFound(_0x10454f,_0x14cc32){return function(_0x2ceebb){if(!_0x2ceebb){_0x10454f[_0x8b6c('0x2b')](0x194);}return _0x2ceebb;};}function handleError(_0x2da418,_0x5ad18c){_0x5ad18c=_0x5ad18c||0x1f4;return function(_0x270b58){logger['error'](_0x270b58[_0x8b6c('0x2c')]);if(_0x270b58[_0x8b6c('0x2d')]){delete _0x270b58['name'];}_0x2da418['status'](_0x5ad18c)['send'](_0x270b58);};}exports[_0x8b6c('0x2e')]=function(_0x286b5d,_0x29f8bf){var _0x3e3dc6={},_0x31c1ce={},_0x48ebc4={'count':0x0,'rows':[]};var _0x414ca7=_[_0x8b6c('0x2f')](db[_0x8b6c('0x30')][_0x8b6c('0x31')],function(_0x4cb1f9){return{'name':_0x4cb1f9[_0x8b6c('0x32')],'type':_0x4cb1f9['type'][_0x8b6c('0x33')]};});_0x31c1ce[_0x8b6c('0x34')]=_['map'](_0x414ca7,_0x8b6c('0x2d'));_0x31c1ce[_0x8b6c('0x35')]=_['keys'](_0x286b5d[_0x8b6c('0x35')]);_0x31c1ce['filters']=_[_0x8b6c('0x36')](_0x31c1ce[_0x8b6c('0x34')],_0x31c1ce['query']);_0x3e3dc6[_0x8b6c('0x37')]=_[_0x8b6c('0x36')](_0x31c1ce[_0x8b6c('0x34')],qs['fields'](_0x286b5d['query'][_0x8b6c('0x38')]));_0x3e3dc6['attributes']=_0x3e3dc6[_0x8b6c('0x37')][_0x8b6c('0x39')]?_0x3e3dc6[_0x8b6c('0x37')]:_0x31c1ce[_0x8b6c('0x34')];if(!_0x286b5d[_0x8b6c('0x35')][_0x8b6c('0x3a')](_0x8b6c('0x3b'))){_0x3e3dc6[_0x8b6c('0x22')]=qs[_0x8b6c('0x22')](_0x286b5d[_0x8b6c('0x35')][_0x8b6c('0x22')]);_0x3e3dc6[_0x8b6c('0x21')]=qs[_0x8b6c('0x21')](_0x286b5d[_0x8b6c('0x35')][_0x8b6c('0x21')]);}_0x3e3dc6['order']=qs[_0x8b6c('0x3c')](_0x286b5d['query'][_0x8b6c('0x3c')]);_0x3e3dc6[_0x8b6c('0x3d')]=qs[_0x8b6c('0x3e')](_['pick'](_0x286b5d[_0x8b6c('0x35')],_0x31c1ce[_0x8b6c('0x3e')]),_0x414ca7);if(_0x286b5d['query']['filter']){_0x3e3dc6['where']=_[_0x8b6c('0x3f')](_0x3e3dc6[_0x8b6c('0x3d')],{'$or':_['map'](_0x414ca7,function(_0x40b6af){if(_0x40b6af['type']!==_0x8b6c('0x40')){var _0x58244b={};_0x58244b[_0x40b6af[_0x8b6c('0x2d')]]={'$like':'%'+_0x286b5d[_0x8b6c('0x35')]['filter']+'%'};return _0x58244b;}})});}_0x3e3dc6=_['merge']({},_0x3e3dc6,_0x286b5d[_0x8b6c('0x41')]);var _0x430417={'where':_0x3e3dc6[_0x8b6c('0x3d')]};return db[_0x8b6c('0x30')][_0x8b6c('0x20')](_0x430417)[_0x8b6c('0x29')](function(_0x321c87){_0x48ebc4[_0x8b6c('0x20')]=_0x321c87;if(_0x286b5d[_0x8b6c('0x35')]['includeAll']){_0x3e3dc6[_0x8b6c('0x42')]=[{'all':!![]}];}return db[_0x8b6c('0x30')][_0x8b6c('0x43')](_0x3e3dc6);})[_0x8b6c('0x29')](function(_0x457563){_0x48ebc4['rows']=_0x457563;return _0x48ebc4;})[_0x8b6c('0x29')](respondWithFilteredResult(_0x29f8bf,_0x3e3dc6))['catch'](handleError(_0x29f8bf,null));};exports[_0x8b6c('0x44')]=function(_0x5019bb,_0x4bab66){var _0xddd986={'raw':![],'where':{'id':_0x5019bb['params']['id']}},_0x2764c5={};_0x2764c5[_0x8b6c('0x34')]=_[_0x8b6c('0x45')](db['ZohoAccount'][_0x8b6c('0x31')]);_0x2764c5[_0x8b6c('0x35')]=_[_0x8b6c('0x45')](_0x5019bb['query']);_0x2764c5[_0x8b6c('0x3e')]=_[_0x8b6c('0x36')](_0x2764c5[_0x8b6c('0x34')],_0x2764c5['query']);_0xddd986[_0x8b6c('0x37')]=_[_0x8b6c('0x36')](_0x2764c5[_0x8b6c('0x34')],qs['fields'](_0x5019bb[_0x8b6c('0x35')][_0x8b6c('0x38')]));_0xddd986[_0x8b6c('0x37')]=_0xddd986[_0x8b6c('0x37')][_0x8b6c('0x39')]?_0xddd986[_0x8b6c('0x37')]:_0x2764c5[_0x8b6c('0x34')];if(_0x5019bb[_0x8b6c('0x35')][_0x8b6c('0x46')]){_0xddd986[_0x8b6c('0x42')]=[{'all':!![]}];}_0xddd986=_[_0x8b6c('0x3f')]({},_0xddd986,_0x5019bb[_0x8b6c('0x41')]);return db[_0x8b6c('0x30')][_0x8b6c('0x47')](_0xddd986)[_0x8b6c('0x29')](handleEntityNotFound(_0x4bab66,null))[_0x8b6c('0x29')](respondWithResult(_0x4bab66,null))['catch'](handleError(_0x4bab66,null));};exports['create']=function(_0x287d8b,_0x3dd35a){return db[_0x8b6c('0x30')][_0x8b6c('0x48')](_0x287d8b[_0x8b6c('0x49')],{})[_0x8b6c('0x29')](respondWithResult(_0x3dd35a,0xc9))[_0x8b6c('0x4a')](handleError(_0x3dd35a,null));};exports[_0x8b6c('0x28')]=function(_0x1eea36,_0x1cd6c6){if(_0x1eea36['body']['id']){delete _0x1eea36[_0x8b6c('0x49')]['id'];}return db[_0x8b6c('0x30')][_0x8b6c('0x47')]({'where':{'id':_0x1eea36[_0x8b6c('0x4b')]['id']}})[_0x8b6c('0x29')](handleEntityNotFound(_0x1cd6c6,null))[_0x8b6c('0x29')](saveUpdates(_0x1eea36['body'],null))[_0x8b6c('0x29')](respondWithResult(_0x1cd6c6,null))['catch'](handleError(_0x1cd6c6,null));};exports[_0x8b6c('0x2a')]=function(_0x1b5286,_0x5e5be2){return db[_0x8b6c('0x30')][_0x8b6c('0x47')]({'where':{'id':_0x1b5286[_0x8b6c('0x4b')]['id']}})[_0x8b6c('0x29')](handleEntityNotFound(_0x5e5be2,null))['then'](removeEntity(_0x5e5be2,null))[_0x8b6c('0x4a')](handleError(_0x5e5be2,null));};exports[_0x8b6c('0x4c')]=function(_0x409ad8,_0x40ef87,_0x5bf932){var _0x2e535e={};var _0x572e0a={};var _0x5c249c;var _0x4747e7;return db['ZohoAccount'][_0x8b6c('0x4d')]({'where':{'id':_0x409ad8[_0x8b6c('0x4b')]['id']}})[_0x8b6c('0x29')](handleEntityNotFound(_0x40ef87,null))[_0x8b6c('0x29')](function(_0x36c0c2){if(_0x36c0c2){_0x5c249c=_0x36c0c2;_0x572e0a[_0x8b6c('0x34')]=_['keys'](db[_0x8b6c('0x4e')][_0x8b6c('0x31')]);_0x572e0a[_0x8b6c('0x35')]=_[_0x8b6c('0x45')](_0x409ad8['query']);_0x572e0a[_0x8b6c('0x3e')]=_['intersection'](_0x572e0a[_0x8b6c('0x34')],_0x572e0a[_0x8b6c('0x35')]);_0x2e535e[_0x8b6c('0x37')]=_[_0x8b6c('0x36')](_0x572e0a[_0x8b6c('0x34')],qs[_0x8b6c('0x38')](_0x409ad8['query']['fields']));_0x2e535e[_0x8b6c('0x37')]=_0x2e535e[_0x8b6c('0x37')][_0x8b6c('0x39')]?_0x2e535e[_0x8b6c('0x37')]:_0x572e0a[_0x8b6c('0x34')];_0x2e535e[_0x8b6c('0x4f')]=qs['sort'](_0x409ad8[_0x8b6c('0x35')]['sort']);_0x2e535e[_0x8b6c('0x3d')]=qs['filters'](_['pick'](_0x409ad8[_0x8b6c('0x35')],_0x572e0a[_0x8b6c('0x3e')]));if(_0x409ad8[_0x8b6c('0x35')][_0x8b6c('0x50')]){_0x2e535e['where']=_['merge'](_0x2e535e['where'],{'$or':_[_0x8b6c('0x2f')](_0x2e535e[_0x8b6c('0x37')],function(_0x1348af){var _0xfe8b2f={};_0xfe8b2f[_0x1348af]={'$like':'%'+_0x409ad8[_0x8b6c('0x35')]['filter']+'%'};return _0xfe8b2f;})});}_0x2e535e=_[_0x8b6c('0x3f')]({},_0x2e535e,_0x409ad8[_0x8b6c('0x41')]);return _0x5c249c['getConfigurations'](_0x2e535e);}})['then'](function(_0x2e6af3){if(_0x2e6af3){_0x4747e7=_0x2e6af3['length'];if(!_0x409ad8[_0x8b6c('0x35')][_0x8b6c('0x3a')]('nolimit')){_0x2e535e[_0x8b6c('0x22')]=qs[_0x8b6c('0x22')](_0x409ad8[_0x8b6c('0x35')]['limit']);_0x2e535e[_0x8b6c('0x21')]=qs[_0x8b6c('0x21')](_0x409ad8[_0x8b6c('0x35')][_0x8b6c('0x21')]);}return _0x5c249c['getConfigurations'](_0x2e535e);}})['then'](function(_0xcc2ec7){if(_0xcc2ec7){return _0xcc2ec7?{'count':_0x4747e7,'rows':_0xcc2ec7}:null;}})[_0x8b6c('0x29')](respondWithResult(_0x40ef87,null))[_0x8b6c('0x4a')](handleError(_0x40ef87,null));};exports[_0x8b6c('0x51')]=function(_0x501f11,_0x195349,_0x35021a){if(_0x501f11[_0x8b6c('0x49')]['id']){delete _0x501f11[_0x8b6c('0x49')]['id'];}return db[_0x8b6c('0x30')][_0x8b6c('0x4d')]({'where':{'id':_0x501f11[_0x8b6c('0x4b')]['id']}})[_0x8b6c('0x29')](handleEntityNotFound(_0x195349,null))[_0x8b6c('0x29')](function(_0x5b3796){if(_0x5b3796){_0x501f11[_0x8b6c('0x49')]['AccountId']=_0x5b3796['id'];_0x501f11[_0x8b6c('0x49')][_0x8b6c('0x52')]=integrations['getSubjects'](_0x501f11[_0x8b6c('0x49')]['channel'],_0x501f11['body'][_0x8b6c('0x53')]);_0x501f11[_0x8b6c('0x49')]['Descriptions']=integrations[_0x8b6c('0x54')](_0x501f11[_0x8b6c('0x49')]['channel'],_0x501f11[_0x8b6c('0x49')][_0x8b6c('0x53')]);return db[_0x8b6c('0x4e')][_0x8b6c('0x48')](_0x501f11['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x8b6c('0x55')],'as':_0x8b6c('0x56')}]});}return null;})['then'](respondWithResult(_0x195349,null))['catch'](handleError(_0x195349,null));};function getAccessToken(_0x3fc6dd){return new Promise(function(_0x1bfbc4,_0x2bbe17){var _0x18e330;switch(_0x3fc6dd[_0x8b6c('0x57')]){case'US':_0x18e330='https://accounts.zoho.com';break;case'AU':_0x18e330='https://accounts.zoho.com.au';break;case'EU':_0x18e330=_0x8b6c('0x58');break;case'IN':_0x18e330='https://accounts.zoho.in';break;case'CN':_0x18e330=_0x8b6c('0x59');break;default:_0x18e330=_0x8b6c('0x58');break;}var _0x58b484={'method':_0x8b6c('0x5a'),'uri':_0x18e330+_0x8b6c('0x5b'),'qs':{'refresh_token':_0x3fc6dd[_0x8b6c('0x5c')],'client_id':_0x3fc6dd[_0x8b6c('0x5d')],'client_secret':_0x3fc6dd[_0x8b6c('0x5e')],'grant_type':_0x8b6c('0x5f')},'json':!![]};return rp(_0x58b484)[_0x8b6c('0x29')](function(_0x34dfb3){if(_0x34dfb3[_0x8b6c('0x60')]){_0x1bfbc4(_0x34dfb3[_0x8b6c('0x60')]);}else{_0x2bbe17('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x8b6c('0x4a')](function(_0x456014){_0x2bbe17(_0x456014);});});}exports['getFields']=function(_0x1c3bc5,_0x5ee424,_0x4ed4a8){var _0x5a450b,_0x4e76cc,_0x4f9425,_0x34d161,_0x6c0b89;return db[_0x8b6c('0x30')]['findOne']({'where':{'id':_0x1c3bc5[_0x8b6c('0x4b')]['id']},'attributes':['id',_0x8b6c('0x61'),_0x8b6c('0x57'),_0x8b6c('0x5d'),_0x8b6c('0x5e'),_0x8b6c('0x62'),_0x8b6c('0x63'),_0x8b6c('0x5c')]})[_0x8b6c('0x29')](handleEntityNotFound(_0x5ee424,null))['then'](function(_0x52cee7){_0x6c0b89=_0x52cee7;_0x5a450b=_0x6c0b89['host'];_0x4e76cc=_0x5a450b===_0x8b6c('0x64')?'eu':_0x8b6c('0x65');_0x4f9425=_0x6c0b89[_0x8b6c('0x62')];var _0xe6b31d=_0x4f9425['slice'](-0x1);if(_0xe6b31d==='/'||_0xe6b31d==='\x5c'||_0xe6b31d===':'){_0x4f9425=_0x4f9425[_0x8b6c('0x66')](0x0,_0x4f9425['lastIndexOf'](_0xe6b31d));}if(!_0x6c0b89[_0x8b6c('0x5c')]){throw new Error(_0x8b6c('0x67'));}return getAccessToken(_0x6c0b89);})[_0x8b6c('0x29')](function(_0xf0cc81){if(_0xf0cc81){return rp({'method':_0x8b6c('0x68'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4e76cc),'qs':{'module':_0x8b6c('0x69')},'headers':{'Authorization':_0x8b6c('0x6a')+_0xf0cc81},'json':!![]});}})[_0x8b6c('0x29')](function(_0x3a03d2){if(_0x3a03d2){if(_0x3a03d2['response']&&_0x3a03d2['response']['error']){throw new Error(_0x3a03d2[_0x8b6c('0x6b')]['error']['message']);}var _0xc1cf=[];var _0x5607ed=[];var _0x456d18=[_0x8b6c('0x6c'),_0x8b6c('0x6d'),_0x8b6c('0x6e'),_0x8b6c('0x6f'),'Call_Duration',_0x8b6c('0x70'),_0x8b6c('0x71'),_0x8b6c('0x72')];_0x5607ed=_[_0x8b6c('0x73')](_0x3a03d2[_0x8b6c('0x38')],function(_0x3562c8){return _0x456d18['includes'](_0x3562c8['api_name']);});for(var _0x46d8b8=0x0;_0x46d8b8<_0x5607ed['length'];_0x46d8b8++){if(_0x5607ed[_0x46d8b8][_0x8b6c('0x74')]===![]){_0xc1cf[_0x8b6c('0x75')]({'id':_0x5607ed[_0x46d8b8]['id'],'name':_0x5607ed[_0x46d8b8][_0x8b6c('0x76')],'custom':_0x5607ed[_0x46d8b8]['custom_field'],'options':_0x5607ed[_0x46d8b8]['data_type']===_0x8b6c('0x77')&&_0x5607ed[_0x46d8b8]['pick_list_values'][_0x8b6c('0x39')]>-0x1?_[_0x8b6c('0x2f')](_0x5607ed[_0x46d8b8][_0x8b6c('0x78')],function(_0x587245){return{'name':_0x587245,'value':_0x587245};}):[]});}}return{'count':_0xc1cf[_0x8b6c('0x39')],'rows':_0xc1cf};}else{return{'count':0x0,'rows':[]};}})[_0x8b6c('0x29')](respondWithResult(_0x5ee424,null))[_0x8b6c('0x4a')](function(_0x2556d8){var _0x5a8202=_0x1c3bc5['query'][_0x8b6c('0x79')]?0x1f4:_0x2556d8[_0x8b6c('0x7a')]||0x1f4;logger[_0x8b6c('0x7b')]('getFields,\x20%s,\x20%s,\x20%s',_0x8b6c('0x7c'),_0x5a8202,JSON[_0x8b6c('0x7d')](_0x2556d8));delete _0x2556d8[_0x8b6c('0x2d')];if(_0x5a8202===0x191){_0x5a8202=0x190;}_0x5ee424[_0x8b6c('0x1d')](_0x5a8202)['send'](_0x1c3bc5[_0x8b6c('0x35')]['test']?{'message':_0x8b6c('0x7e'),'statusCode':_0x2556d8[_0x8b6c('0x7a')]}:_0x2556d8);});}; \ No newline at end of file +var _0xd31a=['limit','count','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','include','ZohoAccount','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','merge','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0xd31a,0x177));var _0xad31=function(_0x8130af,_0x5a0e78){_0x8130af=_0x8130af-0x0;var _0x20ac43=_0xd31a[_0x8130af];return _0x20ac43;};'use strict';var emlformat=require(_0xad31('0x0'));var rimraf=require(_0xad31('0x1'));var zipdir=require(_0xad31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad31('0x3'));var moment=require('moment');var BPromise=require(_0xad31('0x4'));var Mustache=require('mustache');var util=require(_0xad31('0x5'));var path=require('path');var sox=require(_0xad31('0x6'));var csv=require(_0xad31('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad31('0x8'));var _=require(_0xad31('0x9'));var squel=require(_0xad31('0xa'));var crypto=require(_0xad31('0xb'));var jsforce=require(_0xad31('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xad31('0x7'));var querystring=require(_0xad31('0xd'));var Papa=require(_0xad31('0xe'));var Redis=require(_0xad31('0xf'));var authService=require(_0xad31('0x10'));var qs=require(_0xad31('0x11'));var as=require(_0xad31('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad31('0x13'))(_0xad31('0x14'));var utils=require('../../config/utils');var config=require(_0xad31('0x15'));var licenseUtil=require(_0xad31('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x44abea,_0x5c2640){_0x5c2640=_0x5c2640||0xcc;return function(_0x294473){if(_0x294473){return _0x44abea[_0xad31('0x17')](_0x5c2640);}return _0x44abea['status'](_0x5c2640)['end']();};}function respondWithResult(_0x3de9d8,_0x39bbfe){_0x39bbfe=_0x39bbfe||0xc8;return function(_0x302647){if(_0x302647){return _0x3de9d8[_0xad31('0x18')](_0x39bbfe)['json'](_0x302647);}};}function respondWithFilteredResult(_0x5305c0,_0x3a5950){return function(_0x10cb02){if(_0x10cb02){var _0x55b9ab=typeof _0x3a5950[_0xad31('0x19')]===_0xad31('0x1a')&&typeof _0x3a5950[_0xad31('0x1b')]==='undefined';var _0x46009d=_0x10cb02[_0xad31('0x1c')];var _0x4ffa3a=_0x55b9ab?0x0:_0x3a5950[_0xad31('0x19')];var _0xb2e58a=_0x55b9ab?_0x10cb02[_0xad31('0x1c')]:_0x3a5950[_0xad31('0x19')]+_0x3a5950[_0xad31('0x1b')];var _0x2591e9;if(_0xb2e58a>=_0x46009d){_0xb2e58a=_0x46009d;_0x2591e9=0xc8;}else{_0x2591e9=0xce;}_0x5305c0[_0xad31('0x18')](_0x2591e9);return _0x5305c0['set'](_0xad31('0x1d'),_0x4ffa3a+'-'+_0xb2e58a+'/'+_0x46009d)[_0xad31('0x1e')](_0x10cb02);}return null;};}function patchUpdates(_0x3beaf7){return function(_0x353f74){try{jsonpatch[_0xad31('0x1f')](_0x353f74,_0x3beaf7,!![]);}catch(_0x23cd08){return BPromise[_0xad31('0x20')](_0x23cd08);}return _0x353f74[_0xad31('0x21')]();};}function saveUpdates(_0x17efe5,_0x2f7431){return function(_0xe990e1){if(_0xe990e1){return _0xe990e1['update'](_0x17efe5)[_0xad31('0x22')](function(_0x5d2432){return _0x5d2432;});}return null;};}function removeEntity(_0x34b57c,_0x50a2ea){return function(_0x5cc707){if(_0x5cc707){return _0x5cc707[_0xad31('0x23')]()[_0xad31('0x22')](function(){_0x34b57c[_0xad31('0x18')](0xcc)[_0xad31('0x24')]();});}};}function handleEntityNotFound(_0x4df66e,_0x4f7cc6){return function(_0x3c7403){if(!_0x3c7403){_0x4df66e[_0xad31('0x17')](0x194);}return _0x3c7403;};}function handleError(_0x36a2e6,_0xf92114){_0xf92114=_0xf92114||0x1f4;return function(_0x3ced76){logger[_0xad31('0x25')](_0x3ced76[_0xad31('0x26')]);if(_0x3ced76[_0xad31('0x27')]){delete _0x3ced76[_0xad31('0x27')];}_0x36a2e6[_0xad31('0x18')](_0xf92114)[_0xad31('0x28')](_0x3ced76);};}exports['index']=function(_0x57c176,_0x425641){var _0xc314f6={},_0x1af63e={},_0x5ed865={'count':0x0,'rows':[]};var _0x24a25c=_[_0xad31('0x29')](db['ZohoAccount'][_0xad31('0x2a')],function(_0x1744fe){return{'name':_0x1744fe[_0xad31('0x2b')],'type':_0x1744fe[_0xad31('0x2c')][_0xad31('0x2d')]};});_0x1af63e[_0xad31('0x2e')]=_[_0xad31('0x29')](_0x24a25c,_0xad31('0x27'));_0x1af63e[_0xad31('0x2f')]=_[_0xad31('0x30')](_0x57c176['query']);_0x1af63e[_0xad31('0x31')]=_['intersection'](_0x1af63e[_0xad31('0x2e')],_0x1af63e[_0xad31('0x2f')]);_0xc314f6['attributes']=_[_0xad31('0x32')](_0x1af63e[_0xad31('0x2e')],qs[_0xad31('0x33')](_0x57c176[_0xad31('0x2f')][_0xad31('0x33')]));_0xc314f6[_0xad31('0x34')]=_0xc314f6[_0xad31('0x34')][_0xad31('0x35')]?_0xc314f6[_0xad31('0x34')]:_0x1af63e[_0xad31('0x2e')];if(!_0x57c176['query'][_0xad31('0x36')](_0xad31('0x37'))){_0xc314f6['limit']=qs['limit'](_0x57c176[_0xad31('0x2f')][_0xad31('0x1b')]);_0xc314f6[_0xad31('0x19')]=qs['offset'](_0x57c176[_0xad31('0x2f')]['offset']);}_0xc314f6[_0xad31('0x38')]=qs[_0xad31('0x39')](_0x57c176[_0xad31('0x2f')][_0xad31('0x39')]);_0xc314f6[_0xad31('0x3a')]=qs['filters'](_['pick'](_0x57c176['query'],_0x1af63e[_0xad31('0x31')]),_0x24a25c);if(_0x57c176[_0xad31('0x2f')]['filter']){_0xc314f6[_0xad31('0x3a')]=_['merge'](_0xc314f6[_0xad31('0x3a')],{'$or':_['map'](_0x24a25c,function(_0xbf378d){if(_0xbf378d['type']!==_0xad31('0x3b')){var _0x593012={};_0x593012[_0xbf378d[_0xad31('0x27')]]={'$like':'%'+_0x57c176['query'][_0xad31('0x3c')]+'%'};return _0x593012;}})});}_0xc314f6=_['merge']({},_0xc314f6,_0x57c176[_0xad31('0x3d')]);var _0x3f3f59={'where':_0xc314f6[_0xad31('0x3a')]};return db['ZohoAccount'][_0xad31('0x1c')](_0x3f3f59)[_0xad31('0x22')](function(_0x34eea0){_0x5ed865['count']=_0x34eea0;if(_0x57c176['query'][_0xad31('0x3e')]){_0xc314f6[_0xad31('0x3f')]=[{'all':!![]}];}return db[_0xad31('0x40')]['findAll'](_0xc314f6);})[_0xad31('0x22')](function(_0x284531){_0x5ed865[_0xad31('0x41')]=_0x284531;return _0x5ed865;})[_0xad31('0x22')](respondWithFilteredResult(_0x425641,_0xc314f6))[_0xad31('0x42')](handleError(_0x425641,null));};exports[_0xad31('0x43')]=function(_0x2ca2f3,_0x3b1d4f){var _0x477994={'raw':![],'where':{'id':_0x2ca2f3[_0xad31('0x44')]['id']}},_0x261295={};_0x261295['model']=_[_0xad31('0x30')](db[_0xad31('0x40')][_0xad31('0x2a')]);_0x261295[_0xad31('0x2f')]=_[_0xad31('0x30')](_0x2ca2f3[_0xad31('0x2f')]);_0x261295[_0xad31('0x31')]=_[_0xad31('0x32')](_0x261295['model'],_0x261295[_0xad31('0x2f')]);_0x477994[_0xad31('0x34')]=_[_0xad31('0x32')](_0x261295[_0xad31('0x2e')],qs['fields'](_0x2ca2f3[_0xad31('0x2f')]['fields']));_0x477994['attributes']=_0x477994[_0xad31('0x34')][_0xad31('0x35')]?_0x477994[_0xad31('0x34')]:_0x261295[_0xad31('0x2e')];if(_0x2ca2f3['query'][_0xad31('0x3e')]){_0x477994[_0xad31('0x3f')]=[{'all':!![]}];}_0x477994=_['merge']({},_0x477994,_0x2ca2f3[_0xad31('0x3d')]);return db[_0xad31('0x40')][_0xad31('0x45')](_0x477994)[_0xad31('0x22')](handleEntityNotFound(_0x3b1d4f,null))[_0xad31('0x22')](respondWithResult(_0x3b1d4f,null))['catch'](handleError(_0x3b1d4f,null));};exports[_0xad31('0x46')]=function(_0x276240,_0x56f308){return db[_0xad31('0x40')][_0xad31('0x46')](_0x276240[_0xad31('0x47')],{})['then'](respondWithResult(_0x56f308,0xc9))[_0xad31('0x42')](handleError(_0x56f308,null));};exports[_0xad31('0x48')]=function(_0x3ba798,_0x36987c){if(_0x3ba798[_0xad31('0x47')]['id']){delete _0x3ba798[_0xad31('0x47')]['id'];}return db[_0xad31('0x40')][_0xad31('0x45')]({'where':{'id':_0x3ba798[_0xad31('0x44')]['id']}})['then'](handleEntityNotFound(_0x36987c,null))[_0xad31('0x22')](saveUpdates(_0x3ba798['body'],null))['then'](respondWithResult(_0x36987c,null))['catch'](handleError(_0x36987c,null));};exports[_0xad31('0x23')]=function(_0x4c9f28,_0x13935b){return db[_0xad31('0x40')][_0xad31('0x45')]({'where':{'id':_0x4c9f28[_0xad31('0x44')]['id']}})[_0xad31('0x22')](handleEntityNotFound(_0x13935b,null))[_0xad31('0x22')](removeEntity(_0x13935b,null))[_0xad31('0x42')](handleError(_0x13935b,null));};exports[_0xad31('0x49')]=function(_0x5dce87,_0x2ab2ac,_0x1e77de){var _0x56109a={};var _0x471189={};var _0x3204df;var _0x3d2247;return db['ZohoAccount'][_0xad31('0x4a')]({'where':{'id':_0x5dce87[_0xad31('0x44')]['id']}})[_0xad31('0x22')](handleEntityNotFound(_0x2ab2ac,null))[_0xad31('0x22')](function(_0x1a381d){if(_0x1a381d){_0x3204df=_0x1a381d;_0x471189[_0xad31('0x2e')]=_[_0xad31('0x30')](db[_0xad31('0x4b')]['rawAttributes']);_0x471189[_0xad31('0x2f')]=_[_0xad31('0x30')](_0x5dce87[_0xad31('0x2f')]);_0x471189[_0xad31('0x31')]=_[_0xad31('0x32')](_0x471189['model'],_0x471189[_0xad31('0x2f')]);_0x56109a[_0xad31('0x34')]=_[_0xad31('0x32')](_0x471189['model'],qs[_0xad31('0x33')](_0x5dce87['query'][_0xad31('0x33')]));_0x56109a[_0xad31('0x34')]=_0x56109a[_0xad31('0x34')][_0xad31('0x35')]?_0x56109a[_0xad31('0x34')]:_0x471189['model'];_0x56109a['order']=qs[_0xad31('0x39')](_0x5dce87[_0xad31('0x2f')][_0xad31('0x39')]);_0x56109a[_0xad31('0x3a')]=qs[_0xad31('0x31')](_['pick'](_0x5dce87[_0xad31('0x2f')],_0x471189[_0xad31('0x31')]));if(_0x5dce87[_0xad31('0x2f')][_0xad31('0x3c')]){_0x56109a['where']=_[_0xad31('0x4c')](_0x56109a[_0xad31('0x3a')],{'$or':_[_0xad31('0x29')](_0x56109a[_0xad31('0x34')],function(_0x1dec7f){var _0x5dd26e={};_0x5dd26e[_0x1dec7f]={'$like':'%'+_0x5dce87[_0xad31('0x2f')][_0xad31('0x3c')]+'%'};return _0x5dd26e;})});}_0x56109a=_[_0xad31('0x4c')]({},_0x56109a,_0x5dce87['options']);return _0x3204df[_0xad31('0x49')](_0x56109a);}})['then'](function(_0x5d5ab8){if(_0x5d5ab8){_0x3d2247=_0x5d5ab8[_0xad31('0x35')];if(!_0x5dce87[_0xad31('0x2f')][_0xad31('0x36')]('nolimit')){_0x56109a['limit']=qs[_0xad31('0x1b')](_0x5dce87['query'][_0xad31('0x1b')]);_0x56109a[_0xad31('0x19')]=qs[_0xad31('0x19')](_0x5dce87[_0xad31('0x2f')]['offset']);}return _0x3204df['getConfigurations'](_0x56109a);}})[_0xad31('0x22')](function(_0x563011){if(_0x563011){return _0x563011?{'count':_0x3d2247,'rows':_0x563011}:null;}})[_0xad31('0x22')](respondWithResult(_0x2ab2ac,null))[_0xad31('0x42')](handleError(_0x2ab2ac,null));};exports[_0xad31('0x4d')]=function(_0x420950,_0x5b61ce,_0xfc0af3){if(_0x420950['body']['id']){delete _0x420950[_0xad31('0x47')]['id'];}return db[_0xad31('0x40')][_0xad31('0x4a')]({'where':{'id':_0x420950[_0xad31('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b61ce,null))['then'](function(_0x266a17){if(_0x266a17){_0x420950['body'][_0xad31('0x4e')]=_0x266a17['id'];_0x420950[_0xad31('0x47')]['Subjects']=integrations[_0xad31('0x4f')](_0x420950[_0xad31('0x47')]['channel'],_0x420950[_0xad31('0x47')]['type']);_0x420950['body'][_0xad31('0x50')]=integrations[_0xad31('0x51')](_0x420950['body'][_0xad31('0x52')],_0x420950['body'][_0xad31('0x2c')]);return db[_0xad31('0x4b')][_0xad31('0x46')](_0x420950[_0xad31('0x47')],{'include':[{'model':db[_0xad31('0x53')],'as':'Subjects'},{'model':db[_0xad31('0x53')],'as':_0xad31('0x50')}]});}return null;})[_0xad31('0x22')](respondWithResult(_0x5b61ce,null))[_0xad31('0x42')](handleError(_0x5b61ce,null));};function getAccessToken(_0x1ecda0){return new Promise(function(_0x105883,_0x4041e8){var _0x365a9a;switch(_0x1ecda0[_0xad31('0x54')]){case'US':_0x365a9a=_0xad31('0x55');break;case'AU':_0x365a9a=_0xad31('0x56');break;case'EU':_0x365a9a='https://accounts.zoho.eu';break;case'IN':_0x365a9a='https://accounts.zoho.in';break;case'CN':_0x365a9a=_0xad31('0x57');break;default:_0x365a9a=_0xad31('0x58');break;}var _0x1d81ca={'method':_0xad31('0x59'),'uri':_0x365a9a+_0xad31('0x5a'),'qs':{'refresh_token':_0x1ecda0[_0xad31('0x5b')],'client_id':_0x1ecda0[_0xad31('0x5c')],'client_secret':_0x1ecda0[_0xad31('0x5d')],'grant_type':_0xad31('0x5e')},'json':!![]};return rp(_0x1d81ca)[_0xad31('0x22')](function(_0xc94df8){if(_0xc94df8[_0xad31('0x5f')]){_0x105883(_0xc94df8[_0xad31('0x5f')]);}else{_0x4041e8(_0xad31('0x60'));}})[_0xad31('0x42')](function(_0x1e1eb){_0x4041e8(_0x1e1eb);});});}exports['getFields']=function(_0x112b80,_0x32b898,_0x3d710d){var _0x96e4ea,_0x3c88df,_0x5d9c03,_0x1868d9,_0x4d22af;return db[_0xad31('0x40')][_0xad31('0x4a')]({'where':{'id':_0x112b80[_0xad31('0x44')]['id']},'attributes':['id',_0xad31('0x61'),_0xad31('0x54'),_0xad31('0x5c'),'clientSecret',_0xad31('0x62'),_0xad31('0x63'),_0xad31('0x5b')]})[_0xad31('0x22')](handleEntityNotFound(_0x32b898,null))[_0xad31('0x22')](function(_0x295da4){_0x4d22af=_0x295da4;_0x96e4ea=_0x4d22af[_0xad31('0x61')];_0x3c88df=_0x96e4ea===_0xad31('0x64')?'eu':_0xad31('0x65');_0x5d9c03=_0x4d22af[_0xad31('0x62')];var _0x548688=_0x5d9c03[_0xad31('0x66')](-0x1);if(_0x548688==='/'||_0x548688==='\x5c'||_0x548688===':'){_0x5d9c03=_0x5d9c03[_0xad31('0x67')](0x0,_0x5d9c03[_0xad31('0x68')](_0x548688));}if(!_0x4d22af[_0xad31('0x5b')]){throw new Error(_0xad31('0x69'));}return getAccessToken(_0x4d22af);})[_0xad31('0x22')](function(_0x572ee8){if(_0x572ee8){return rp({'method':_0xad31('0x6a'),'uri':util[_0xad31('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3c88df),'qs':{'module':_0xad31('0x6c')},'headers':{'Authorization':_0xad31('0x6d')+_0x572ee8},'json':!![]});}})[_0xad31('0x22')](function(_0x4a5792){if(_0x4a5792){if(_0x4a5792[_0xad31('0x6e')]&&_0x4a5792[_0xad31('0x6e')][_0xad31('0x25')]){throw new Error(_0x4a5792['response'][_0xad31('0x25')]['message']);}var _0x5f3942=[];var _0x461353=[];var _0xc3c360=[_0xad31('0x6f'),_0xad31('0x70'),_0xad31('0x71'),_0xad31('0x72'),_0xad31('0x73'),_0xad31('0x74'),_0xad31('0x75'),_0xad31('0x76')];_0x461353=_[_0xad31('0x77')](_0x4a5792[_0xad31('0x33')],function(_0x6a6640){return _0xc3c360[_0xad31('0x78')](_0x6a6640[_0xad31('0x79')]);});for(var _0x192429=0x0;_0x192429<_0x461353[_0xad31('0x35')];_0x192429++){if(_0x461353[_0x192429][_0xad31('0x7a')]===![]){_0x5f3942['push']({'id':_0x461353[_0x192429]['id'],'name':_0x461353[_0x192429][_0xad31('0x7b')],'custom':_0x461353[_0x192429][_0xad31('0x7c')],'options':_0x461353[_0x192429][_0xad31('0x7d')]===_0xad31('0x7e')&&_0x461353[_0x192429][_0xad31('0x7f')][_0xad31('0x35')]>-0x1?_[_0xad31('0x29')](_0x461353[_0x192429]['pick_list_values'],function(_0x2ed3b9){return{'name':_0x2ed3b9,'value':_0x2ed3b9};}):[]});}}return{'count':_0x5f3942[_0xad31('0x35')],'rows':_0x5f3942};}else{return{'count':0x0,'rows':[]};}})[_0xad31('0x22')](respondWithResult(_0x32b898,null))['catch'](function(_0x4505bc){var _0x46081f=_0x112b80[_0xad31('0x2f')][_0xad31('0x80')]?0x1f4:_0x4505bc[_0xad31('0x81')]||0x1f4;logger['error'](_0xad31('0x82'),_0xad31('0x83'),_0x46081f,JSON[_0xad31('0x84')](_0x4505bc));delete _0x4505bc['name'];if(_0x46081f===0x191){_0x46081f=0x190;}_0x32b898[_0xad31('0x18')](_0x46081f)[_0xad31('0x28')](_0x112b80['query']['test']?{'message':_0xad31('0x85'),'statusCode':_0x4505bc['statusCode']}:_0x4505bc);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 73b07a3..9e97f35 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 _0x67ed=['https://accounts.zoho.com.cn','refreshToken','info','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','host','slice','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','zone','substring','lastIndexOf','https://accounts.zoho.com'];(function(_0x16685d,_0x47b526){var _0x4bf6a0=function(_0x2073d2){while(--_0x2073d2){_0x16685d['push'](_0x16685d['shift']());}};_0x4bf6a0(++_0x47b526);}(_0x67ed,0x81));var _0xd67e=function(_0xe6d839,_0xbce361){_0xe6d839=_0xe6d839-0x0;var _0x17de2f=_0x67ed[_0xe6d839];return _0x17de2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd67e('0x0'))(_0xd67e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd67e('0x2'));var fs=require('fs');var path=require(_0xd67e('0x3'));var rimraf=require(_0xd67e('0x4'));var config=require(_0xd67e('0x5'));var attributes=require(_0xd67e('0x6'));var integrations=require(_0xd67e('0x7'));module[_0xd67e('0x8')]=function(_0xb718af,_0x25dc92){return _0xb718af['define'](_0xd67e('0x9'),attributes,{'tableName':_0xd67e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18456d,_0x58f429,_0x523a03){if(_0x18456d['changed']('zone')||_0x18456d[_0xd67e('0xb')](_0xd67e('0xc'))||_0x18456d[_0xd67e('0xb')](_0xd67e('0xd'))||_0x18456d[_0xd67e('0xb')]('clientSecret')||_0x18456d['changed'](_0xd67e('0xe'))||_0x18456d['changed'](_0xd67e('0xf'))){var _0x252df0,_0x59739e;_0x252df0=_0x18456d[_0xd67e('0xc')];var _0x11e9a6=_0x252df0[_0xd67e('0x10')](-0x1);if(_0x11e9a6==='/'||_0x11e9a6==='\x5c'||_0x11e9a6===':'){_0x252df0=_0x252df0['substring'](0x0,_0x252df0['lastIndexOf'](_0x11e9a6));}switch(_0x18456d['zone']){case'US':_0x59739e='https://accounts.zoho.com';break;case'AU':_0x59739e=_0xd67e('0x11');break;case'IN':_0x59739e=_0xd67e('0x12');break;case'CN':_0x59739e='https://accounts.zoho.com.cn';break;default:_0x59739e=_0xd67e('0x13');break;}var _0x42aa8c={'method':_0xd67e('0x14'),'uri':_0x59739e+_0xd67e('0x15'),'form':{'grant_type':_0xd67e('0x16'),'client_id':_0x18456d[_0xd67e('0xd')],'client_secret':_0x18456d[_0xd67e('0x17')],'redirect_uri':_0x18456d[_0xd67e('0xc')],'code':_0x18456d[_0xd67e('0xe')]},'headers':{'Content-Type':_0xd67e('0x18')}};return rp(_0x42aa8c)[_0xd67e('0x19')](function(_0x148946){var _0x764cf7=JSON[_0xd67e('0x1a')](_0x148946);if(_0x764cf7['refresh_token']){_0x18456d['refreshToken']=_0x764cf7[_0xd67e('0x1b')];logger['info'](util['format'](_0xd67e('0x1c'),_0x18456d[_0xd67e('0x1d')],_0x18456d['id']));}else{logger['error'](util[_0xd67e('0x1e')](_0xd67e('0x1f'),_0x18456d[_0xd67e('0x1d')],_0x18456d['id']),util[_0xd67e('0x20')](_0x764cf7,{'showHidden':![],'depth':null}));}return _0x523a03(null,_0x58f429);})[_0xd67e('0x21')](function(_0x31b0f6){logger[_0xd67e('0x22')](util[_0xd67e('0x1e')](_0xd67e('0x1f'),_0x18456d[_0xd67e('0x1d')],_0x18456d['id']),util[_0xd67e('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x523a03(_0x31b0f6);});}else{return _0x523a03(null,_0x58f429);}},'beforeUpdate':function(_0x4a2d6a,_0x3bbb7d,_0x5de80c){if(_0x4a2d6a[_0xd67e('0xb')](_0xd67e('0x23'))||_0x4a2d6a[_0xd67e('0xb')]('serverUrl')||_0x4a2d6a['changed'](_0xd67e('0xd'))||_0x4a2d6a['changed'](_0xd67e('0x17'))||_0x4a2d6a[_0xd67e('0xb')]('code')||_0x4a2d6a[_0xd67e('0xb')](_0xd67e('0xf'))){var _0x29c067,_0x5cc153;_0x29c067=_0x4a2d6a['serverUrl'];var _0x1451a6=_0x29c067[_0xd67e('0x10')](-0x1);if(_0x1451a6==='/'||_0x1451a6==='\x5c'||_0x1451a6===':'){_0x29c067=_0x29c067[_0xd67e('0x24')](0x0,_0x29c067[_0xd67e('0x25')](_0x1451a6));}switch(_0x4a2d6a[_0xd67e('0x23')]){case'US':_0x5cc153=_0xd67e('0x26');break;case'AU':_0x5cc153='https://accounts.zoho.com.au';break;case'IN':_0x5cc153='https://accounts.zoho.in';break;case'CN':_0x5cc153=_0xd67e('0x27');break;default:_0x5cc153='https://accounts.zoho.eu';break;}var _0x57fdcb={'method':_0xd67e('0x14'),'uri':_0x5cc153+'/oauth/v2/token','form':{'grant_type':_0xd67e('0x16'),'client_id':_0x4a2d6a[_0xd67e('0xd')],'client_secret':_0x4a2d6a[_0xd67e('0x17')],'redirect_uri':_0x4a2d6a[_0xd67e('0xc')],'code':_0x4a2d6a[_0xd67e('0xe')]},'headers':{'Content-Type':_0xd67e('0x18')}};return rp(_0x57fdcb)[_0xd67e('0x19')](function(_0xd9ecee){var _0x4da3e8=JSON['parse'](_0xd9ecee);if(_0x4da3e8['refresh_token']){_0x4a2d6a[_0xd67e('0x28')]=_0x4da3e8[_0xd67e('0x1b')];logger[_0xd67e('0x29')](util[_0xd67e('0x1e')](_0xd67e('0x1c'),_0x4a2d6a['name'],_0x4a2d6a['id']));}else{logger[_0xd67e('0x22')](util[_0xd67e('0x1e')](_0xd67e('0x1f'),_0x4a2d6a[_0xd67e('0x1d')],_0x4a2d6a['id']),util[_0xd67e('0x20')](_0x4da3e8,{'showHidden':![],'depth':null}));}return _0x5de80c(null,_0x3bbb7d);})[_0xd67e('0x21')](function(_0x2a6fe8){logger[_0xd67e('0x22')](util[_0xd67e('0x1e')](_0xd67e('0x1f'),_0x4a2d6a[_0xd67e('0x1d')],_0x4a2d6a['id']),util[_0xd67e('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x5de80c(_0x2a6fe8);});}else{return _0x5de80c(null,_0x3bbb7d);}}}});}; \ No newline at end of file +var _0x62cf=['refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com.au','https://accounts.zoho.eu','parse','catch','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','application/x-www-form-urlencoded','then'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x62cf,0x81));var _0xf62c=function(_0x44fca9,_0xec4377){_0x44fca9=_0x44fca9-0x0;var _0x5b5904=_0x62cf[_0x44fca9];return _0x5b5904;};'use strict';var _=require(_0xf62c('0x0'));var util=require('util');var logger=require(_0xf62c('0x1'))('api');var moment=require(_0xf62c('0x2'));var BPromise=require(_0xf62c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var attributes=require(_0xf62c('0x6'));var integrations=require(_0xf62c('0x7'));module[_0xf62c('0x8')]=function(_0x40487e,_0x45749c){return _0x40487e[_0xf62c('0x9')](_0xf62c('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x181f87,_0x4e0655,_0x34fdf0){if(_0x181f87[_0xf62c('0xb')](_0xf62c('0xc'))||_0x181f87[_0xf62c('0xb')](_0xf62c('0xd'))||_0x181f87[_0xf62c('0xb')](_0xf62c('0xe'))||_0x181f87[_0xf62c('0xb')](_0xf62c('0xf'))||_0x181f87[_0xf62c('0xb')](_0xf62c('0x10'))||_0x181f87['changed'](_0xf62c('0x11'))){var _0x5c07d3,_0x4ead27;_0x5c07d3=_0x181f87[_0xf62c('0xd')];var _0x8489c0=_0x5c07d3['slice'](-0x1);if(_0x8489c0==='/'||_0x8489c0==='\x5c'||_0x8489c0===':'){_0x5c07d3=_0x5c07d3[_0xf62c('0x12')](0x0,_0x5c07d3[_0xf62c('0x13')](_0x8489c0));}switch(_0x181f87['zone']){case'US':_0x4ead27=_0xf62c('0x14');break;case'AU':_0x4ead27='https://accounts.zoho.com.au';break;case'IN':_0x4ead27=_0xf62c('0x15');break;case'CN':_0x4ead27=_0xf62c('0x16');break;default:_0x4ead27='https://accounts.zoho.eu';break;}var _0x3c748a={'method':_0xf62c('0x17'),'uri':_0x4ead27+'/oauth/v2/token','form':{'grant_type':_0xf62c('0x18'),'client_id':_0x181f87[_0xf62c('0xe')],'client_secret':_0x181f87[_0xf62c('0xf')],'redirect_uri':_0x181f87['serverUrl'],'code':_0x181f87[_0xf62c('0x10')]},'headers':{'Content-Type':_0xf62c('0x19')}};return rp(_0x3c748a)[_0xf62c('0x1a')](function(_0x329c3c){var _0x32a7c3=JSON['parse'](_0x329c3c);if(_0x32a7c3[_0xf62c('0x1b')]){_0x181f87[_0xf62c('0x1c')]=_0x32a7c3[_0xf62c('0x1b')];logger['info'](util['format'](_0xf62c('0x1d'),_0x181f87[_0xf62c('0x1e')],_0x181f87['id']));}else{logger[_0xf62c('0x1f')](util[_0xf62c('0x20')](_0xf62c('0x21'),_0x181f87['name'],_0x181f87['id']),util['inspect'](_0x32a7c3,{'showHidden':![],'depth':null}));}return _0x34fdf0(null,_0x4e0655);})['catch'](function(_0x11fda3){logger[_0xf62c('0x1f')](util[_0xf62c('0x20')](_0xf62c('0x21'),_0x181f87[_0xf62c('0x1e')],_0x181f87['id']),util[_0xf62c('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x34fdf0(_0x11fda3);});}else{return _0x34fdf0(null,_0x4e0655);}},'beforeUpdate':function(_0x5c048f,_0x33b572,_0x120077){if(_0x5c048f[_0xf62c('0xb')]('zone')||_0x5c048f['changed']('serverUrl')||_0x5c048f['changed'](_0xf62c('0xe'))||_0x5c048f['changed'](_0xf62c('0xf'))||_0x5c048f['changed'](_0xf62c('0x10'))||_0x5c048f['changed'](_0xf62c('0x11'))){var _0x41c49f,_0x439f48;_0x41c49f=_0x5c048f[_0xf62c('0xd')];var _0xbaa5a0=_0x41c49f['slice'](-0x1);if(_0xbaa5a0==='/'||_0xbaa5a0==='\x5c'||_0xbaa5a0===':'){_0x41c49f=_0x41c49f[_0xf62c('0x12')](0x0,_0x41c49f[_0xf62c('0x13')](_0xbaa5a0));}switch(_0x5c048f[_0xf62c('0xc')]){case'US':_0x439f48=_0xf62c('0x14');break;case'AU':_0x439f48=_0xf62c('0x23');break;case'IN':_0x439f48=_0xf62c('0x15');break;case'CN':_0x439f48=_0xf62c('0x16');break;default:_0x439f48=_0xf62c('0x24');break;}var _0x19b820={'method':_0xf62c('0x17'),'uri':_0x439f48+'/oauth/v2/token','form':{'grant_type':_0xf62c('0x18'),'client_id':_0x5c048f[_0xf62c('0xe')],'client_secret':_0x5c048f['clientSecret'],'redirect_uri':_0x5c048f[_0xf62c('0xd')],'code':_0x5c048f['code']},'headers':{'Content-Type':_0xf62c('0x19')}};return rp(_0x19b820)[_0xf62c('0x1a')](function(_0x515292){var _0x5e7590=JSON[_0xf62c('0x25')](_0x515292);if(_0x5e7590[_0xf62c('0x1b')]){_0x5c048f['refreshToken']=_0x5e7590[_0xf62c('0x1b')];logger['info'](util[_0xf62c('0x20')](_0xf62c('0x1d'),_0x5c048f[_0xf62c('0x1e')],_0x5c048f['id']));}else{logger[_0xf62c('0x1f')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5c048f[_0xf62c('0x1e')],_0x5c048f['id']),util['inspect'](_0x5e7590,{'showHidden':![],'depth':null}));}return _0x120077(null,_0x33b572);})[_0xf62c('0x26')](function(_0x5deddd){logger[_0xf62c('0x1f')](util[_0xf62c('0x20')](_0xf62c('0x21'),_0x5c048f[_0xf62c('0x1e')],_0x5c048f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x120077(_0x5deddd);});}else{return _0x120077(null,_0x33b572);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f2819b0..acd5fa3 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 _0xc931=['result','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model','debug','stringify','ShowZohoAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','error','code','message','ZohoAccount,\x20%s,\x20%s'];(function(_0x54adfc,_0x124a51){var _0x484a4b=function(_0x129dfd){while(--_0x129dfd){_0x54adfc['push'](_0x54adfc['shift']());}};_0x484a4b(++_0x124a51);}(_0xc931,0x19c));var _0x1c93=function(_0x42e435,_0x27dc76){_0x42e435=_0x42e435-0x0;var _0x12608d=_0xc931[_0x42e435];return _0x12608d;};'use strict';var _=require(_0x1c93('0x0'));var util=require(_0x1c93('0x1'));var moment=require('moment');var BPromise=require(_0x1c93('0x2'));var rs=require(_0x1c93('0x3'));var fs=require('fs');var Redis=require(_0x1c93('0x4'));var db=require(_0x1c93('0x5'))['db'];var utils=require(_0x1c93('0x6'));var logger=require(_0x1c93('0x7'))(_0x1c93('0x8'));var config=require(_0x1c93('0x9'));var jayson=require(_0x1c93('0xa'));var client=jayson['client'][_0x1c93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8e337c,_0x7caf6c,_0x51d00e){return new BPromise(function(_0x2324b6,_0x2f6582){return client[_0x1c93('0xc')](_0x8e337c,_0x51d00e)[_0x1c93('0xd')](function(_0x2f04b4){logger[_0x1c93('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x7caf6c,_0x1c93('0xf'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x7caf6c,'request\x20sent',JSON['stringify'](_0x2f04b4));if(_0x2f04b4[_0x1c93('0x10')]){if(_0x2f04b4[_0x1c93('0x10')][_0x1c93('0x11')]===0x1f4){logger[_0x1c93('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x7caf6c,_0x2f04b4[_0x1c93('0x10')][_0x1c93('0x12')]);return _0x2f6582(_0x2f04b4[_0x1c93('0x10')]['message']);}logger[_0x1c93('0x10')](_0x1c93('0x13'),_0x7caf6c,_0x2f04b4[_0x1c93('0x10')][_0x1c93('0x12')]);return _0x2324b6(_0x2f04b4[_0x1c93('0x10')][_0x1c93('0x12')]);}else{logger[_0x1c93('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x7caf6c,'request\x20sent');_0x2324b6(_0x2f04b4[_0x1c93('0x14')][_0x1c93('0x12')]);}})[_0x1c93('0x15')](function(_0x6939c6){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x7caf6c,_0x6939c6);_0x2f6582(_0x6939c6);});});}exports[_0x1c93('0x16')]=function(_0x185286){var _0x33a73e=this;return new Promise(function(_0x173af4,_0x195839){return db[_0x1c93('0x17')]['findAll']({'raw':_0x185286['options']?_0x185286['options']['raw']===undefined?!![]:![]:!![],'where':_0x185286[_0x1c93('0x18')]?_0x185286[_0x1c93('0x18')][_0x1c93('0x19')]||null:null,'attributes':_0x185286[_0x1c93('0x18')]?_0x185286[_0x1c93('0x18')][_0x1c93('0x1a')]||null:null,'limit':_0x185286[_0x1c93('0x18')]?_0x185286[_0x1c93('0x18')][_0x1c93('0x1b')]||null:null,'include':_0x185286[_0x1c93('0x18')]?_0x185286[_0x1c93('0x18')][_0x1c93('0x1c')]?_[_0x1c93('0x1d')](_0x185286[_0x1c93('0x18')][_0x1c93('0x1c')],function(_0x4bfa0b){return{'model':db[_0x4bfa0b[_0x1c93('0x1e')]],'as':_0x4bfa0b['as'],'attributes':_0x4bfa0b[_0x1c93('0x1a')],'include':_0x4bfa0b['include']?_[_0x1c93('0x1d')](_0x4bfa0b[_0x1c93('0x1c')],function(_0x331885){return{'model':db[_0x331885[_0x1c93('0x1e')]],'as':_0x331885['as'],'attributes':_0x331885[_0x1c93('0x1a')],'include':_0x331885[_0x1c93('0x1c')]?_[_0x1c93('0x1d')](_0x331885[_0x1c93('0x1c')],function(_0x1dd93b){return{'model':db[_0x1dd93b[_0x1c93('0x1e')]],'as':_0x1dd93b['as'],'attributes':_0x1dd93b['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c93('0xd')](function(_0x5ca28a){logger[_0x1c93('0xe')](_0x1c93('0x16'),_0x185286);logger[_0x1c93('0x1f')](_0x1c93('0x16'),_0x185286,JSON[_0x1c93('0x20')](_0x5ca28a));_0x173af4(_0x5ca28a);})[_0x1c93('0x15')](function(_0x2832e8){logger['error']('GetZohoAccount',_0x2832e8[_0x1c93('0x12')],_0x185286);_0x195839(_0x33a73e[_0x1c93('0x10')](0x1f4,_0x2832e8[_0x1c93('0x12')]));});});};exports[_0x1c93('0x21')]=function(_0x14577e){var _0x400288=this;return new Promise(function(_0x24f573,_0x44f1ad){return db['ZohoAccount'][_0x1c93('0x22')]({'raw':_0x14577e[_0x1c93('0x18')]?_0x14577e['options'][_0x1c93('0x23')]===undefined?!![]:![]:!![],'where':_0x14577e[_0x1c93('0x18')]?_0x14577e[_0x1c93('0x18')]['where']||null:null,'attributes':_0x14577e[_0x1c93('0x18')]?_0x14577e[_0x1c93('0x18')][_0x1c93('0x1a')]||null:null,'include':_0x14577e[_0x1c93('0x18')]?_0x14577e[_0x1c93('0x18')][_0x1c93('0x1c')]?_[_0x1c93('0x1d')](_0x14577e[_0x1c93('0x18')][_0x1c93('0x1c')],function(_0x5588a0){return{'model':db[_0x5588a0[_0x1c93('0x1e')]],'as':_0x5588a0['as'],'attributes':_0x5588a0[_0x1c93('0x1a')],'include':_0x5588a0[_0x1c93('0x1c')]?_[_0x1c93('0x1d')](_0x5588a0[_0x1c93('0x1c')],function(_0x54e822){return{'model':db[_0x54e822['model']],'as':_0x54e822['as'],'attributes':_0x54e822[_0x1c93('0x1a')],'include':_0x54e822[_0x1c93('0x1c')]?_['map'](_0x54e822[_0x1c93('0x1c')],function(_0x1fe494){return{'model':db[_0x1fe494[_0x1c93('0x1e')]],'as':_0x1fe494['as'],'attributes':_0x1fe494[_0x1c93('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1c93('0xd')](function(_0x21d311){logger[_0x1c93('0xe')](_0x1c93('0x21'),_0x14577e);logger[_0x1c93('0x1f')]('ShowZohoAccount',_0x14577e,JSON[_0x1c93('0x20')](_0x21d311));_0x24f573(_0x21d311);})['catch'](function(_0x340782){logger[_0x1c93('0x10')]('ShowZohoAccount',_0x340782[_0x1c93('0x12')],_0x14577e);_0x44f1ad(_0x400288[_0x1c93('0x10')](0x1f4,_0x340782[_0x1c93('0x12')]));});});}; \ No newline at end of file +var _0x1131=['catch','GetZohoAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowZohoAccount','ZohoAccount','where','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x30a64d,_0x351426){var _0x56c565=function(_0x548161){while(--_0x548161){_0x30a64d['push'](_0x30a64d['shift']());}};_0x56c565(++_0x351426);}(_0x1131,0x71));var _0x1113=function(_0x1581bc,_0x23b9de){_0x1581bc=_0x1581bc-0x0;var _0x5e7936=_0x1131[_0x1581bc];return _0x5e7936;};'use strict';var _=require('lodash');var util=require(_0x1113('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1113('0x1'));var db=require(_0x1113('0x2'))['db'];var utils=require(_0x1113('0x3'));var logger=require(_0x1113('0x4'))(_0x1113('0x5'));var config=require(_0x1113('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1113('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f76a7,_0x500c86,_0x502a53){return new BPromise(function(_0x458f86,_0x53a218){return client[_0x1113('0x8')](_0x1f76a7,_0x502a53)[_0x1113('0x9')](function(_0x3e20dd){logger[_0x1113('0xa')](_0x1113('0xb'),_0x500c86,'request\x20sent');logger['debug'](_0x1113('0xc'),_0x500c86,_0x1113('0xd'),JSON[_0x1113('0xe')](_0x3e20dd));if(_0x3e20dd['error']){if(_0x3e20dd[_0x1113('0xf')][_0x1113('0x10')]===0x1f4){logger['error'](_0x1113('0xb'),_0x500c86,_0x3e20dd[_0x1113('0xf')][_0x1113('0x11')]);return _0x53a218(_0x3e20dd[_0x1113('0xf')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x500c86,_0x3e20dd['error'][_0x1113('0x11')]);return _0x458f86(_0x3e20dd[_0x1113('0xf')][_0x1113('0x11')]);}else{logger[_0x1113('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x500c86,_0x1113('0xd'));_0x458f86(_0x3e20dd[_0x1113('0x12')][_0x1113('0x11')]);}})[_0x1113('0x13')](function(_0x1cadcb){logger[_0x1113('0xf')](_0x1113('0xb'),_0x500c86,_0x1cadcb);_0x53a218(_0x1cadcb);});});}exports[_0x1113('0x14')]=function(_0x2fc97b){var _0x1fa6ed=this;return new Promise(function(_0x52cbcd,_0x5a878a){return db['ZohoAccount'][_0x1113('0x15')]({'raw':_0x2fc97b['options']?_0x2fc97b[_0x1113('0x16')][_0x1113('0x17')]===undefined?!![]:![]:!![],'where':_0x2fc97b['options']?_0x2fc97b['options']['where']||null:null,'attributes':_0x2fc97b['options']?_0x2fc97b[_0x1113('0x16')][_0x1113('0x18')]||null:null,'limit':_0x2fc97b[_0x1113('0x16')]?_0x2fc97b[_0x1113('0x16')][_0x1113('0x19')]||null:null,'include':_0x2fc97b[_0x1113('0x16')]?_0x2fc97b[_0x1113('0x16')][_0x1113('0x1a')]?_[_0x1113('0x1b')](_0x2fc97b['options'][_0x1113('0x1a')],function(_0x357726){return{'model':db[_0x357726[_0x1113('0x1c')]],'as':_0x357726['as'],'attributes':_0x357726['attributes'],'include':_0x357726[_0x1113('0x1a')]?_['map'](_0x357726[_0x1113('0x1a')],function(_0x46b4d5){return{'model':db[_0x46b4d5[_0x1113('0x1c')]],'as':_0x46b4d5['as'],'attributes':_0x46b4d5[_0x1113('0x18')],'include':_0x46b4d5['include']?_[_0x1113('0x1b')](_0x46b4d5[_0x1113('0x1a')],function(_0x389410){return{'model':db[_0x389410[_0x1113('0x1c')]],'as':_0x389410['as'],'attributes':_0x389410['attributes']};}):[]};}):[]};}):[]:[]})[_0x1113('0x9')](function(_0x3e4b26){logger[_0x1113('0xa')]('GetZohoAccount',_0x2fc97b);logger[_0x1113('0x1d')](_0x1113('0x14'),_0x2fc97b,JSON[_0x1113('0xe')](_0x3e4b26));_0x52cbcd(_0x3e4b26);})['catch'](function(_0x190299){logger[_0x1113('0xf')](_0x1113('0x14'),_0x190299[_0x1113('0x11')],_0x2fc97b);_0x5a878a(_0x1fa6ed[_0x1113('0xf')](0x1f4,_0x190299[_0x1113('0x11')]));});});};exports[_0x1113('0x1e')]=function(_0x26b2be){var _0x28b5d0=this;return new Promise(function(_0x14dd61,_0xdab083){return db[_0x1113('0x1f')]['find']({'raw':_0x26b2be['options']?_0x26b2be[_0x1113('0x16')][_0x1113('0x17')]===undefined?!![]:![]:!![],'where':_0x26b2be['options']?_0x26b2be[_0x1113('0x16')][_0x1113('0x20')]||null:null,'attributes':_0x26b2be['options']?_0x26b2be[_0x1113('0x16')][_0x1113('0x18')]||null:null,'include':_0x26b2be['options']?_0x26b2be[_0x1113('0x16')][_0x1113('0x1a')]?_[_0x1113('0x1b')](_0x26b2be[_0x1113('0x16')]['include'],function(_0x52e0c2){return{'model':db[_0x52e0c2[_0x1113('0x1c')]],'as':_0x52e0c2['as'],'attributes':_0x52e0c2[_0x1113('0x18')],'include':_0x52e0c2['include']?_[_0x1113('0x1b')](_0x52e0c2['include'],function(_0x337b13){return{'model':db[_0x337b13[_0x1113('0x1c')]],'as':_0x337b13['as'],'attributes':_0x337b13[_0x1113('0x18')],'include':_0x337b13[_0x1113('0x1a')]?_[_0x1113('0x1b')](_0x337b13[_0x1113('0x1a')],function(_0x5b387b){return{'model':db[_0x5b387b[_0x1113('0x1c')]],'as':_0x5b387b['as'],'attributes':_0x5b387b['attributes']};}):[]};}):[]};}):[]:[]})[_0x1113('0x9')](function(_0x1df78e){logger['info'](_0x1113('0x1e'),_0x26b2be);logger['debug'](_0x1113('0x1e'),_0x26b2be,JSON[_0x1113('0xe')](_0x1df78e));_0x14dd61(_0x1df78e);})['catch'](function(_0x31e8e0){logger['error'](_0x1113('0x1e'),_0x31e8e0[_0x1113('0x11')],_0x26b2be);_0xdab083(_0x28b5d0[_0x1113('0xf')](0x1f4,_0x31e8e0['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 3d92d58..12b5de8 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 _0x123f=['fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','/:id','get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','multer','express','Router'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x123f,0x1c9));var _0xf123=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x123f[_0x4063a4];return _0x17908d;};'use strict';var multer=require(_0xf123('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf123('0x1'));var router=express[_0xf123('0x2')]();var fs_extra=require(_0xf123('0x3'));var auth=require(_0xf123('0x4'));var interaction=require(_0xf123('0x5'));var config=require('../../config/environment');var controller=require(_0xf123('0x6'));router['get']('/',auth[_0xf123('0x7')](),controller['index']);router['get'](_0xf123('0x8'),auth[_0xf123('0x7')](),controller['show']);router[_0xf123('0x9')](_0xf123('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0xf123('0x9')](_0xf123('0xb'),auth[_0xf123('0x7')](),controller[_0xf123('0xc')]);router[_0xf123('0x9')](_0xf123('0xd'),auth[_0xf123('0x7')](),controller[_0xf123('0xe')]);router[_0xf123('0xf')]('/',auth[_0xf123('0x7')](),controller[_0xf123('0x10')]);router[_0xf123('0x11')](_0xf123('0x8'),auth[_0xf123('0x7')](),controller['update']);router[_0xf123('0x12')](_0xf123('0x8'),auth[_0xf123('0x7')](),controller[_0xf123('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9853=['../../components/auth/service','./intZohoConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','fs-extra'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9853,0x86));var _0x3985=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0x9853[_0x562362];return _0x3a18ce;};'use strict';var multer=require(_0x3985('0x0'));var util=require(_0x3985('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3985('0x2'));var router=express['Router']();var fs_extra=require(_0x3985('0x3'));var auth=require(_0x3985('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3985('0x5'));router[_0x3985('0x6')]('/',auth['isAuthenticated'](),controller[_0x3985('0x7')]);router['get']('/:id',auth[_0x3985('0x8')](),controller[_0x3985('0x9')]);router[_0x3985('0x6')](_0x3985('0xa'),auth[_0x3985('0x8')](),controller[_0x3985('0xb')]);router[_0x3985('0x6')](_0x3985('0xc'),auth[_0x3985('0x8')](),controller['getSubjects']);router[_0x3985('0x6')](_0x3985('0xd'),auth['isAuthenticated'](),controller[_0x3985('0xe')]);router[_0x3985('0xf')]('/',auth[_0x3985('0x8')](),controller[_0x3985('0x10')]);router[_0x3985('0x11')](_0x3985('0x12'),auth[_0x3985('0x8')](),controller[_0x3985('0x13')]);router[_0x3985('0x14')](_0x3985('0x12'),auth[_0x3985('0x8')](),controller[_0x3985('0x15')]);module[_0x3985('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f9bba1a..18193cb 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 _0x85e9=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x6ea8a2,_0x561d6c){var _0x4fe938=function(_0x1efa6c){while(--_0x1efa6c){_0x6ea8a2['push'](_0x6ea8a2['shift']());}};_0x4fe938(++_0x561d6c);}(_0x85e9,0x185));var _0x985e=function(_0x52026b,_0x5da76d){_0x52026b=_0x52026b-0x0;var _0x5196fa=_0x85e9[_0x52026b];return _0x5196fa;};'use strict';var Sequelize=require(_0x985e('0x0'));module[_0x985e('0x1')]={'name':{'type':Sequelize[_0x985e('0x2')]},'moduleCreate':{'type':Sequelize[_0x985e('0x3')](_0x985e('0x4'),_0x985e('0x5'),_0x985e('0x6')),'defaultValue':_0x985e('0x4')},'moduleSearch':{'type':Sequelize[_0x985e('0x3')](_0x985e('0x7'),'contact',_0x985e('0x4')),'defaultValue':_0x985e('0x7')},'description':{'type':Sequelize[_0x985e('0x2')]}}; \ No newline at end of file +var _0x645e=['nothing','contact','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x645e,0x16b));var _0xe645=function(_0x306f97,_0x1894a3){_0x306f97=_0x306f97-0x0;var _0x53837d=_0x645e[_0x306f97];return _0x53837d;};'use strict';var Sequelize=require(_0xe645('0x0'));module[_0xe645('0x1')]={'name':{'type':Sequelize[_0xe645('0x2')]},'moduleCreate':{'type':Sequelize[_0xe645('0x3')](_0xe645('0x4'),'contact',_0xe645('0x5')),'defaultValue':_0xe645('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xe645('0x6'),'lead'),'defaultValue':_0xe645('0x7')},'description':{'type':Sequelize[_0xe645('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2aa7f6d..80bbc5c 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 _0xfae6=['destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','merge','type','VIRTUAL','where','include','findAll','rows','catch','params','options','find','create','body','getFields','findOne','ZohoField','length','order','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xfae6,0x7a));var _0x6fae=function(_0x3b3861,_0x8b0f28){_0x3b3861=_0x3b3861-0x0;var _0x5175f2=_0xfae6[_0x3b3861];return _0x5175f2;};'use strict';var emlformat=require(_0x6fae('0x0'));var rimraf=require(_0x6fae('0x1'));var zipdir=require(_0x6fae('0x2'));var jsonpatch=require(_0x6fae('0x3'));var rp=require(_0x6fae('0x4'));var moment=require('moment');var BPromise=require(_0x6fae('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6fae('0x6'));var csv=require('to-csv');var ejs=require(_0x6fae('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6fae('0x8'));var squel=require('squel');var crypto=require(_0x6fae('0x9'));var jsforce=require(_0x6fae('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6fae('0xb'));var querystring=require(_0x6fae('0xc'));var Papa=require(_0x6fae('0xd'));var Redis=require('ioredis');var authService=require(_0x6fae('0xe'));var qs=require(_0x6fae('0xf'));var as=require(_0x6fae('0x10'));var hardwareService=require(_0x6fae('0x11'));var logger=require('../../config/logger')(_0x6fae('0x12'));var utils=require(_0x6fae('0x13'));var config=require(_0x6fae('0x14'));var licenseUtil=require(_0x6fae('0x15'));var db=require(_0x6fae('0x16'))['db'];function respondWithStatusCode(_0x464286,_0x191022){_0x191022=_0x191022||0xcc;return function(_0x2885b0){if(_0x2885b0){return _0x464286[_0x6fae('0x17')](_0x191022);}return _0x464286[_0x6fae('0x18')](_0x191022)[_0x6fae('0x19')]();};}function respondWithResult(_0x54a703,_0x563558){_0x563558=_0x563558||0xc8;return function(_0xfe30d8){if(_0xfe30d8){return _0x54a703['status'](_0x563558)[_0x6fae('0x1a')](_0xfe30d8);}};}function respondWithFilteredResult(_0x1242b6,_0x1e6566){return function(_0x5deb63){if(_0x5deb63){var _0x1950b0=typeof _0x1e6566[_0x6fae('0x1b')]===_0x6fae('0x1c')&&typeof _0x1e6566[_0x6fae('0x1d')]===_0x6fae('0x1c');var _0x5b863f=_0x5deb63[_0x6fae('0x1e')];var _0x431876=_0x1950b0?0x0:_0x1e6566[_0x6fae('0x1b')];var _0x480bcb=_0x1950b0?_0x5deb63[_0x6fae('0x1e')]:_0x1e6566[_0x6fae('0x1b')]+_0x1e6566[_0x6fae('0x1d')];var _0x1e949b;if(_0x480bcb>=_0x5b863f){_0x480bcb=_0x5b863f;_0x1e949b=0xc8;}else{_0x1e949b=0xce;}_0x1242b6[_0x6fae('0x18')](_0x1e949b);return _0x1242b6[_0x6fae('0x1f')](_0x6fae('0x20'),_0x431876+'-'+_0x480bcb+'/'+_0x5b863f)['json'](_0x5deb63);}return null;};}function patchUpdates(_0x13a96d){return function(_0x2918a6){try{jsonpatch[_0x6fae('0x21')](_0x2918a6,_0x13a96d,!![]);}catch(_0x5531c9){return BPromise[_0x6fae('0x22')](_0x5531c9);}return _0x2918a6[_0x6fae('0x23')]();};}function saveUpdates(_0xae5f19,_0x46eaef){return function(_0x71329d){if(_0x71329d){return _0x71329d[_0x6fae('0x24')](_0xae5f19)[_0x6fae('0x25')](function(_0x59c96c){return _0x59c96c;});}return null;};}function removeEntity(_0x10fe35,_0x453f79){return function(_0x18b8c1){if(_0x18b8c1){return _0x18b8c1[_0x6fae('0x26')]()[_0x6fae('0x25')](function(){_0x10fe35[_0x6fae('0x18')](0xcc)[_0x6fae('0x19')]();});}};}function handleEntityNotFound(_0x1b52a7,_0x317a47){return function(_0x4ebc47){if(!_0x4ebc47){_0x1b52a7[_0x6fae('0x17')](0x194);}return _0x4ebc47;};}function handleError(_0x202c72,_0x2fad3f){_0x2fad3f=_0x2fad3f||0x1f4;return function(_0x2b1eef){logger[_0x6fae('0x27')](_0x2b1eef[_0x6fae('0x28')]);if(_0x2b1eef[_0x6fae('0x29')]){delete _0x2b1eef[_0x6fae('0x29')];}_0x202c72[_0x6fae('0x18')](_0x2fad3f)[_0x6fae('0x2a')](_0x2b1eef);};}exports[_0x6fae('0x2b')]=function(_0x4a7780,_0x28997a){var _0x39606a={},_0x65a3a9={},_0x246a97={'count':0x0,'rows':[]};var _0x4f6a20=_[_0x6fae('0x2c')](db[_0x6fae('0x2d')][_0x6fae('0x2e')],function(_0x153449){return{'name':_0x153449['fieldName'],'type':_0x153449['type'][_0x6fae('0x2f')]};});_0x65a3a9[_0x6fae('0x30')]=_['map'](_0x4f6a20,_0x6fae('0x29'));_0x65a3a9['query']=_[_0x6fae('0x31')](_0x4a7780[_0x6fae('0x32')]);_0x65a3a9[_0x6fae('0x33')]=_['intersection'](_0x65a3a9['model'],_0x65a3a9[_0x6fae('0x32')]);_0x39606a['attributes']=_[_0x6fae('0x34')](_0x65a3a9['model'],qs[_0x6fae('0x35')](_0x4a7780[_0x6fae('0x32')][_0x6fae('0x35')]));_0x39606a[_0x6fae('0x36')]=_0x39606a[_0x6fae('0x36')]['length']?_0x39606a['attributes']:_0x65a3a9[_0x6fae('0x30')];if(!_0x4a7780['query'][_0x6fae('0x37')](_0x6fae('0x38'))){_0x39606a[_0x6fae('0x1d')]=qs['limit'](_0x4a7780[_0x6fae('0x32')][_0x6fae('0x1d')]);_0x39606a[_0x6fae('0x1b')]=qs[_0x6fae('0x1b')](_0x4a7780[_0x6fae('0x32')]['offset']);}_0x39606a['order']=qs['sort'](_0x4a7780[_0x6fae('0x32')][_0x6fae('0x39')]);_0x39606a['where']=qs[_0x6fae('0x33')](_['pick'](_0x4a7780[_0x6fae('0x32')],_0x65a3a9[_0x6fae('0x33')]),_0x4f6a20);if(_0x4a7780[_0x6fae('0x32')][_0x6fae('0x3a')]){_0x39606a['where']=_[_0x6fae('0x3b')](_0x39606a['where'],{'$or':_['map'](_0x4f6a20,function(_0x1ae0e9){if(_0x1ae0e9[_0x6fae('0x3c')]!==_0x6fae('0x3d')){var _0x33875b={};_0x33875b[_0x1ae0e9['name']]={'$like':'%'+_0x4a7780[_0x6fae('0x32')]['filter']+'%'};return _0x33875b;}})});}_0x39606a=_[_0x6fae('0x3b')]({},_0x39606a,_0x4a7780['options']);var _0x54197d={'where':_0x39606a[_0x6fae('0x3e')]};return db[_0x6fae('0x2d')][_0x6fae('0x1e')](_0x54197d)[_0x6fae('0x25')](function(_0x54ed74){_0x246a97[_0x6fae('0x1e')]=_0x54ed74;if(_0x4a7780[_0x6fae('0x32')]['includeAll']){_0x39606a[_0x6fae('0x3f')]=[{'all':!![]}];}return db[_0x6fae('0x2d')][_0x6fae('0x40')](_0x39606a);})[_0x6fae('0x25')](function(_0x5d7c0f){_0x246a97[_0x6fae('0x41')]=_0x5d7c0f;return _0x246a97;})[_0x6fae('0x25')](respondWithFilteredResult(_0x28997a,_0x39606a))[_0x6fae('0x42')](handleError(_0x28997a,null));};exports['show']=function(_0x265451,_0x11de9b){var _0xfa1b5={'raw':![],'where':{'id':_0x265451[_0x6fae('0x43')]['id']}},_0xc6464c={};_0xc6464c['model']=_['keys'](db['ZohoConfiguration'][_0x6fae('0x2e')]);_0xc6464c[_0x6fae('0x32')]=_[_0x6fae('0x31')](_0x265451[_0x6fae('0x32')]);_0xc6464c[_0x6fae('0x33')]=_[_0x6fae('0x34')](_0xc6464c['model'],_0xc6464c[_0x6fae('0x32')]);_0xfa1b5[_0x6fae('0x36')]=_[_0x6fae('0x34')](_0xc6464c[_0x6fae('0x30')],qs['fields'](_0x265451[_0x6fae('0x32')]['fields']));_0xfa1b5[_0x6fae('0x36')]=_0xfa1b5[_0x6fae('0x36')]['length']?_0xfa1b5[_0x6fae('0x36')]:_0xc6464c['model'];if(_0x265451['query']['includeAll']){_0xfa1b5[_0x6fae('0x3f')]=[{'all':!![]}];}_0xfa1b5=_[_0x6fae('0x3b')]({},_0xfa1b5,_0x265451[_0x6fae('0x44')]);return db[_0x6fae('0x2d')][_0x6fae('0x45')](_0xfa1b5)['then'](handleEntityNotFound(_0x11de9b,null))['then'](respondWithResult(_0x11de9b,null))[_0x6fae('0x42')](handleError(_0x11de9b,null));};exports[_0x6fae('0x46')]=function(_0x1809a5,_0xca2e4c){return db['ZohoConfiguration'][_0x6fae('0x46')](_0x1809a5[_0x6fae('0x47')],{})[_0x6fae('0x25')](respondWithResult(_0xca2e4c,0xc9))[_0x6fae('0x42')](handleError(_0xca2e4c,null));};exports[_0x6fae('0x24')]=function(_0x724bbc,_0x1aec7c){if(_0x724bbc[_0x6fae('0x47')]['id']){delete _0x724bbc[_0x6fae('0x47')]['id'];}return db[_0x6fae('0x2d')]['find']({'where':{'id':_0x724bbc[_0x6fae('0x43')]['id']}})[_0x6fae('0x25')](handleEntityNotFound(_0x1aec7c,null))[_0x6fae('0x25')](saveUpdates(_0x724bbc[_0x6fae('0x47')],null))['then'](respondWithResult(_0x1aec7c,null))[_0x6fae('0x42')](handleError(_0x1aec7c,null));};exports[_0x6fae('0x26')]=function(_0x458ebe,_0x246e12){return db[_0x6fae('0x2d')][_0x6fae('0x45')]({'where':{'id':_0x458ebe[_0x6fae('0x43')]['id']}})[_0x6fae('0x25')](handleEntityNotFound(_0x246e12,null))[_0x6fae('0x25')](removeEntity(_0x246e12,null))[_0x6fae('0x42')](handleError(_0x246e12,null));};exports[_0x6fae('0x48')]=function(_0x2f8b2b,_0x50d325,_0x4bf2a7){var _0x3699b3={};var _0x1126fa={};var _0x4c7a33;var _0x124c36;return db[_0x6fae('0x2d')][_0x6fae('0x49')]({'where':{'id':_0x2f8b2b[_0x6fae('0x43')]['id']}})['then'](handleEntityNotFound(_0x50d325,null))[_0x6fae('0x25')](function(_0x547a99){if(_0x547a99){_0x4c7a33=_0x547a99;_0x1126fa['model']=_[_0x6fae('0x31')](db[_0x6fae('0x4a')]['rawAttributes']);_0x1126fa[_0x6fae('0x32')]=_[_0x6fae('0x31')](_0x2f8b2b[_0x6fae('0x32')]);_0x1126fa[_0x6fae('0x33')]=_[_0x6fae('0x34')](_0x1126fa['model'],_0x1126fa[_0x6fae('0x32')]);_0x3699b3[_0x6fae('0x36')]=_[_0x6fae('0x34')](_0x1126fa[_0x6fae('0x30')],qs[_0x6fae('0x35')](_0x2f8b2b[_0x6fae('0x32')][_0x6fae('0x35')]));_0x3699b3[_0x6fae('0x36')]=_0x3699b3['attributes'][_0x6fae('0x4b')]?_0x3699b3['attributes']:_0x1126fa[_0x6fae('0x30')];_0x3699b3[_0x6fae('0x4c')]=qs[_0x6fae('0x39')](_0x2f8b2b[_0x6fae('0x32')][_0x6fae('0x39')]);_0x3699b3[_0x6fae('0x3e')]=qs[_0x6fae('0x33')](_['pick'](_0x2f8b2b[_0x6fae('0x32')],_0x1126fa[_0x6fae('0x33')]));if(_0x2f8b2b[_0x6fae('0x32')][_0x6fae('0x3a')]){_0x3699b3[_0x6fae('0x3e')]=_[_0x6fae('0x3b')](_0x3699b3['where'],{'$or':_[_0x6fae('0x2c')](_0x3699b3[_0x6fae('0x36')],function(_0x9621ea){var _0x4d07a1={};_0x4d07a1[_0x9621ea]={'$like':'%'+_0x2f8b2b['query'][_0x6fae('0x3a')]+'%'};return _0x4d07a1;})});}_0x3699b3=_[_0x6fae('0x3b')]({},_0x3699b3,_0x2f8b2b[_0x6fae('0x44')]);return _0x4c7a33['getFields'](_0x3699b3);}})['then'](function(_0x343a90){if(_0x343a90){_0x124c36=_0x343a90[_0x6fae('0x4b')];if(!_0x2f8b2b[_0x6fae('0x32')][_0x6fae('0x37')](_0x6fae('0x38'))){_0x3699b3[_0x6fae('0x1d')]=qs[_0x6fae('0x1d')](_0x2f8b2b['query'][_0x6fae('0x1d')]);_0x3699b3[_0x6fae('0x1b')]=qs[_0x6fae('0x1b')](_0x2f8b2b[_0x6fae('0x32')][_0x6fae('0x1b')]);}return _0x4c7a33[_0x6fae('0x48')](_0x3699b3);}})['then'](function(_0x5d2776){if(_0x5d2776){return _0x5d2776?{'count':_0x124c36,'rows':_0x5d2776}:null;}})[_0x6fae('0x25')](respondWithResult(_0x50d325,null))[_0x6fae('0x42')](handleError(_0x50d325,null));};exports[_0x6fae('0x4d')]=function(_0x24834b,_0x548b6c,_0x3b5ac1){var _0x113601={};var _0x4f529d={};var _0x544145;var _0x402431;return db[_0x6fae('0x2d')][_0x6fae('0x49')]({'where':{'id':_0x24834b['params']['id']}})['then'](handleEntityNotFound(_0x548b6c,null))[_0x6fae('0x25')](function(_0xdb951b){if(_0xdb951b){_0x544145=_0xdb951b;_0x4f529d[_0x6fae('0x30')]=_[_0x6fae('0x31')](db[_0x6fae('0x4a')][_0x6fae('0x2e')]);_0x4f529d[_0x6fae('0x32')]=_['keys'](_0x24834b[_0x6fae('0x32')]);_0x4f529d[_0x6fae('0x33')]=_[_0x6fae('0x34')](_0x4f529d[_0x6fae('0x30')],_0x4f529d['query']);_0x113601[_0x6fae('0x36')]=_[_0x6fae('0x34')](_0x4f529d['model'],qs[_0x6fae('0x35')](_0x24834b['query'][_0x6fae('0x35')]));_0x113601[_0x6fae('0x36')]=_0x113601[_0x6fae('0x36')]['length']?_0x113601['attributes']:_0x4f529d[_0x6fae('0x30')];_0x113601[_0x6fae('0x4c')]=qs[_0x6fae('0x39')](_0x24834b[_0x6fae('0x32')][_0x6fae('0x39')]);_0x113601[_0x6fae('0x3e')]=qs[_0x6fae('0x33')](_[_0x6fae('0x4e')](_0x24834b[_0x6fae('0x32')],_0x4f529d['filters']));if(_0x24834b[_0x6fae('0x32')][_0x6fae('0x3a')]){_0x113601['where']=_[_0x6fae('0x3b')](_0x113601['where'],{'$or':_[_0x6fae('0x2c')](_0x113601[_0x6fae('0x36')],function(_0x3992ca){var _0x56a66f={};_0x56a66f[_0x3992ca]={'$like':'%'+_0x24834b[_0x6fae('0x32')][_0x6fae('0x3a')]+'%'};return _0x56a66f;})});}_0x113601=_['merge']({},_0x113601,_0x24834b[_0x6fae('0x44')]);return _0x544145[_0x6fae('0x4d')](_0x113601);}})[_0x6fae('0x25')](function(_0x575338){if(_0x575338){_0x402431=_0x575338[_0x6fae('0x4b')];if(!_0x24834b[_0x6fae('0x32')][_0x6fae('0x37')](_0x6fae('0x38'))){_0x113601['limit']=qs[_0x6fae('0x1d')](_0x24834b['query'][_0x6fae('0x1d')]);_0x113601['offset']=qs[_0x6fae('0x1b')](_0x24834b['query'][_0x6fae('0x1b')]);}return _0x544145['getSubjects'](_0x113601);}})['then'](function(_0x2d3f8a){if(_0x2d3f8a){return _0x2d3f8a?{'count':_0x402431,'rows':_0x2d3f8a}:null;}})[_0x6fae('0x25')](respondWithResult(_0x548b6c,null))['catch'](handleError(_0x548b6c,null));};exports[_0x6fae('0x4f')]=function(_0x4da0d9,_0x211a68,_0x11b5a9){var _0x2c02ce={};var _0x493ab8={};var _0x1f9f0a;var _0x39be6f;return db[_0x6fae('0x2d')][_0x6fae('0x49')]({'where':{'id':_0x4da0d9['params']['id']}})[_0x6fae('0x25')](handleEntityNotFound(_0x211a68,null))[_0x6fae('0x25')](function(_0x5b8325){if(_0x5b8325){_0x1f9f0a=_0x5b8325;_0x493ab8['model']=_['keys'](db[_0x6fae('0x4a')][_0x6fae('0x2e')]);_0x493ab8['query']=_['keys'](_0x4da0d9[_0x6fae('0x32')]);_0x493ab8[_0x6fae('0x33')]=_[_0x6fae('0x34')](_0x493ab8[_0x6fae('0x30')],_0x493ab8['query']);_0x2c02ce['attributes']=_['intersection'](_0x493ab8['model'],qs[_0x6fae('0x35')](_0x4da0d9[_0x6fae('0x32')][_0x6fae('0x35')]));_0x2c02ce[_0x6fae('0x36')]=_0x2c02ce[_0x6fae('0x36')]['length']?_0x2c02ce[_0x6fae('0x36')]:_0x493ab8[_0x6fae('0x30')];_0x2c02ce[_0x6fae('0x4c')]=qs[_0x6fae('0x39')](_0x4da0d9['query'][_0x6fae('0x39')]);_0x2c02ce[_0x6fae('0x3e')]=qs[_0x6fae('0x33')](_[_0x6fae('0x4e')](_0x4da0d9[_0x6fae('0x32')],_0x493ab8[_0x6fae('0x33')]));if(_0x4da0d9[_0x6fae('0x32')][_0x6fae('0x3a')]){_0x2c02ce['where']=_['merge'](_0x2c02ce['where'],{'$or':_[_0x6fae('0x2c')](_0x2c02ce['attributes'],function(_0x1963a4){var _0x2cc99d={};_0x2cc99d[_0x1963a4]={'$like':'%'+_0x4da0d9[_0x6fae('0x32')][_0x6fae('0x3a')]+'%'};return _0x2cc99d;})});}_0x2c02ce=_[_0x6fae('0x3b')]({},_0x2c02ce,_0x4da0d9[_0x6fae('0x44')]);return _0x1f9f0a[_0x6fae('0x4f')](_0x2c02ce);}})[_0x6fae('0x25')](function(_0x5f5591){if(_0x5f5591){_0x39be6f=_0x5f5591[_0x6fae('0x4b')];if(!_0x4da0d9[_0x6fae('0x32')][_0x6fae('0x37')](_0x6fae('0x38'))){_0x2c02ce[_0x6fae('0x1d')]=qs[_0x6fae('0x1d')](_0x4da0d9['query'][_0x6fae('0x1d')]);_0x2c02ce['offset']=qs['offset'](_0x4da0d9[_0x6fae('0x32')]['offset']);}return _0x1f9f0a[_0x6fae('0x4f')](_0x2c02ce);}})[_0x6fae('0x25')](function(_0x360884){if(_0x360884){return _0x360884?{'count':_0x39be6f,'rows':_0x360884}:null;}})['then'](respondWithResult(_0x211a68,null))[_0x6fae('0x42')](handleError(_0x211a68,null));}; \ No newline at end of file +var _0x1545=['include','rows','show','params','rawAttributes','length','includeAll','find','create','body','catch','update','getFields','ZohoField','order','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','destroy','then','end','error','stack','name','map','ZohoConfiguration','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x1545,0x1e7));var _0x5154=function(_0x598efc,_0x5e971c){_0x598efc=_0x598efc-0x0;var _0x435e4f=_0x1545[_0x598efc];return _0x435e4f;};'use strict';var emlformat=require(_0x5154('0x0'));var rimraf=require(_0x5154('0x1'));var zipdir=require(_0x5154('0x2'));var jsonpatch=require(_0x5154('0x3'));var rp=require(_0x5154('0x4'));var moment=require(_0x5154('0x5'));var BPromise=require(_0x5154('0x6'));var Mustache=require(_0x5154('0x7'));var util=require(_0x5154('0x8'));var path=require(_0x5154('0x9'));var sox=require(_0x5154('0xa'));var csv=require(_0x5154('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5154('0xc'));var _=require('lodash');var squel=require(_0x5154('0xd'));var crypto=require(_0x5154('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5154('0xb'));var querystring=require('querystring');var Papa=require(_0x5154('0xf'));var Redis=require(_0x5154('0x10'));var authService=require(_0x5154('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5154('0x12'));var hardwareService=require(_0x5154('0x13'));var logger=require('../../config/logger')(_0x5154('0x14'));var utils=require(_0x5154('0x15'));var config=require(_0x5154('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5154('0x17'))['db'];function respondWithStatusCode(_0x177a58,_0x35849c){_0x35849c=_0x35849c||0xcc;return function(_0x28c7e6){if(_0x28c7e6){return _0x177a58[_0x5154('0x18')](_0x35849c);}return _0x177a58[_0x5154('0x19')](_0x35849c)['end']();};}function respondWithResult(_0xb02dac,_0x2381b8){_0x2381b8=_0x2381b8||0xc8;return function(_0x3874ec){if(_0x3874ec){return _0xb02dac[_0x5154('0x19')](_0x2381b8)[_0x5154('0x1a')](_0x3874ec);}};}function respondWithFilteredResult(_0x18cb39,_0x23869b){return function(_0x4efff0){if(_0x4efff0){var _0x279820=typeof _0x23869b[_0x5154('0x1b')]==='undefined'&&typeof _0x23869b[_0x5154('0x1c')]===_0x5154('0x1d');var _0x7e7e47=_0x4efff0[_0x5154('0x1e')];var _0x2671ec=_0x279820?0x0:_0x23869b['offset'];var _0x73e0b5=_0x279820?_0x4efff0[_0x5154('0x1e')]:_0x23869b['offset']+_0x23869b[_0x5154('0x1c')];var _0x1f549e;if(_0x73e0b5>=_0x7e7e47){_0x73e0b5=_0x7e7e47;_0x1f549e=0xc8;}else{_0x1f549e=0xce;}_0x18cb39[_0x5154('0x19')](_0x1f549e);return _0x18cb39[_0x5154('0x1f')]('Content-Range',_0x2671ec+'-'+_0x73e0b5+'/'+_0x7e7e47)[_0x5154('0x1a')](_0x4efff0);}return null;};}function patchUpdates(_0xfc1001){return function(_0xd8757){try{jsonpatch[_0x5154('0x20')](_0xd8757,_0xfc1001,!![]);}catch(_0x446dd6){return BPromise['reject'](_0x446dd6);}return _0xd8757['save']();};}function saveUpdates(_0x5cd776,_0x3e250e){return function(_0xaca195){if(_0xaca195){return _0xaca195['update'](_0x5cd776)['then'](function(_0x5d8c6c){return _0x5d8c6c;});}return null;};}function removeEntity(_0x3a2d00,_0x534615){return function(_0x27adae){if(_0x27adae){return _0x27adae[_0x5154('0x21')]()[_0x5154('0x22')](function(){_0x3a2d00[_0x5154('0x19')](0xcc)[_0x5154('0x23')]();});}};}function handleEntityNotFound(_0x5de8df,_0xcd5aa0){return function(_0x19b725){if(!_0x19b725){_0x5de8df['sendStatus'](0x194);}return _0x19b725;};}function handleError(_0x42ed94,_0x2861c0){_0x2861c0=_0x2861c0||0x1f4;return function(_0xee6934){logger[_0x5154('0x24')](_0xee6934[_0x5154('0x25')]);if(_0xee6934[_0x5154('0x26')]){delete _0xee6934['name'];}_0x42ed94[_0x5154('0x19')](_0x2861c0)['send'](_0xee6934);};}exports['index']=function(_0x54bd33,_0xb4f7ac){var _0x51081={},_0x42bccb={},_0x3ceb62={'count':0x0,'rows':[]};var _0x3cdfe5=_[_0x5154('0x27')](db[_0x5154('0x28')]['rawAttributes'],function(_0x447be1){return{'name':_0x447be1[_0x5154('0x29')],'type':_0x447be1[_0x5154('0x2a')][_0x5154('0x2b')]};});_0x42bccb[_0x5154('0x2c')]=_[_0x5154('0x27')](_0x3cdfe5,'name');_0x42bccb['query']=_[_0x5154('0x2d')](_0x54bd33[_0x5154('0x2e')]);_0x42bccb['filters']=_[_0x5154('0x2f')](_0x42bccb[_0x5154('0x2c')],_0x42bccb['query']);_0x51081[_0x5154('0x30')]=_[_0x5154('0x2f')](_0x42bccb['model'],qs['fields'](_0x54bd33['query'][_0x5154('0x31')]));_0x51081[_0x5154('0x30')]=_0x51081[_0x5154('0x30')]['length']?_0x51081['attributes']:_0x42bccb[_0x5154('0x2c')];if(!_0x54bd33[_0x5154('0x2e')]['hasOwnProperty'](_0x5154('0x32'))){_0x51081[_0x5154('0x1c')]=qs[_0x5154('0x1c')](_0x54bd33[_0x5154('0x2e')][_0x5154('0x1c')]);_0x51081[_0x5154('0x1b')]=qs[_0x5154('0x1b')](_0x54bd33[_0x5154('0x2e')][_0x5154('0x1b')]);}_0x51081['order']=qs[_0x5154('0x33')](_0x54bd33[_0x5154('0x2e')]['sort']);_0x51081[_0x5154('0x34')]=qs[_0x5154('0x35')](_[_0x5154('0x36')](_0x54bd33[_0x5154('0x2e')],_0x42bccb[_0x5154('0x35')]),_0x3cdfe5);if(_0x54bd33[_0x5154('0x2e')]['filter']){_0x51081[_0x5154('0x34')]=_[_0x5154('0x37')](_0x51081['where'],{'$or':_[_0x5154('0x27')](_0x3cdfe5,function(_0x2a7dbc){if(_0x2a7dbc[_0x5154('0x2a')]!==_0x5154('0x38')){var _0x1dfb53={};_0x1dfb53[_0x2a7dbc[_0x5154('0x26')]]={'$like':'%'+_0x54bd33[_0x5154('0x2e')][_0x5154('0x39')]+'%'};return _0x1dfb53;}})});}_0x51081=_[_0x5154('0x37')]({},_0x51081,_0x54bd33[_0x5154('0x3a')]);var _0x2c0c32={'where':_0x51081[_0x5154('0x34')]};return db['ZohoConfiguration'][_0x5154('0x1e')](_0x2c0c32)[_0x5154('0x22')](function(_0x4d2dae){_0x3ceb62[_0x5154('0x1e')]=_0x4d2dae;if(_0x54bd33[_0x5154('0x2e')]['includeAll']){_0x51081[_0x5154('0x3b')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x51081);})[_0x5154('0x22')](function(_0x3d7e2e){_0x3ceb62[_0x5154('0x3c')]=_0x3d7e2e;return _0x3ceb62;})['then'](respondWithFilteredResult(_0xb4f7ac,_0x51081))['catch'](handleError(_0xb4f7ac,null));};exports[_0x5154('0x3d')]=function(_0x798bfd,_0x425176){var _0x116ccc={'raw':![],'where':{'id':_0x798bfd[_0x5154('0x3e')]['id']}},_0x1623e7={};_0x1623e7[_0x5154('0x2c')]=_[_0x5154('0x2d')](db[_0x5154('0x28')][_0x5154('0x3f')]);_0x1623e7[_0x5154('0x2e')]=_[_0x5154('0x2d')](_0x798bfd[_0x5154('0x2e')]);_0x1623e7[_0x5154('0x35')]=_['intersection'](_0x1623e7[_0x5154('0x2c')],_0x1623e7['query']);_0x116ccc[_0x5154('0x30')]=_[_0x5154('0x2f')](_0x1623e7[_0x5154('0x2c')],qs[_0x5154('0x31')](_0x798bfd[_0x5154('0x2e')][_0x5154('0x31')]));_0x116ccc[_0x5154('0x30')]=_0x116ccc['attributes'][_0x5154('0x40')]?_0x116ccc[_0x5154('0x30')]:_0x1623e7[_0x5154('0x2c')];if(_0x798bfd[_0x5154('0x2e')][_0x5154('0x41')]){_0x116ccc[_0x5154('0x3b')]=[{'all':!![]}];}_0x116ccc=_[_0x5154('0x37')]({},_0x116ccc,_0x798bfd['options']);return db[_0x5154('0x28')][_0x5154('0x42')](_0x116ccc)[_0x5154('0x22')](handleEntityNotFound(_0x425176,null))[_0x5154('0x22')](respondWithResult(_0x425176,null))['catch'](handleError(_0x425176,null));};exports[_0x5154('0x43')]=function(_0x1e3a53,_0x2d8eca){return db['ZohoConfiguration'][_0x5154('0x43')](_0x1e3a53[_0x5154('0x44')],{})[_0x5154('0x22')](respondWithResult(_0x2d8eca,0xc9))[_0x5154('0x45')](handleError(_0x2d8eca,null));};exports[_0x5154('0x46')]=function(_0x3b41e0,_0x1ce92f){if(_0x3b41e0['body']['id']){delete _0x3b41e0[_0x5154('0x44')]['id'];}return db[_0x5154('0x28')][_0x5154('0x42')]({'where':{'id':_0x3b41e0[_0x5154('0x3e')]['id']}})[_0x5154('0x22')](handleEntityNotFound(_0x1ce92f,null))[_0x5154('0x22')](saveUpdates(_0x3b41e0['body'],null))['then'](respondWithResult(_0x1ce92f,null))['catch'](handleError(_0x1ce92f,null));};exports[_0x5154('0x21')]=function(_0x52d49b,_0x2c98c8){return db['ZohoConfiguration'][_0x5154('0x42')]({'where':{'id':_0x52d49b[_0x5154('0x3e')]['id']}})[_0x5154('0x22')](handleEntityNotFound(_0x2c98c8,null))[_0x5154('0x22')](removeEntity(_0x2c98c8,null))['catch'](handleError(_0x2c98c8,null));};exports[_0x5154('0x47')]=function(_0x51d763,_0x92064b,_0x5381f3){var _0xc5622b={};var _0x5283b0={};var _0x540a7f;var _0x14fd43;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x51d763['params']['id']}})['then'](handleEntityNotFound(_0x92064b,null))[_0x5154('0x22')](function(_0xee19a5){if(_0xee19a5){_0x540a7f=_0xee19a5;_0x5283b0['model']=_[_0x5154('0x2d')](db[_0x5154('0x48')][_0x5154('0x3f')]);_0x5283b0[_0x5154('0x2e')]=_[_0x5154('0x2d')](_0x51d763[_0x5154('0x2e')]);_0x5283b0[_0x5154('0x35')]=_[_0x5154('0x2f')](_0x5283b0[_0x5154('0x2c')],_0x5283b0[_0x5154('0x2e')]);_0xc5622b[_0x5154('0x30')]=_[_0x5154('0x2f')](_0x5283b0[_0x5154('0x2c')],qs[_0x5154('0x31')](_0x51d763[_0x5154('0x2e')][_0x5154('0x31')]));_0xc5622b[_0x5154('0x30')]=_0xc5622b[_0x5154('0x30')][_0x5154('0x40')]?_0xc5622b['attributes']:_0x5283b0['model'];_0xc5622b[_0x5154('0x49')]=qs[_0x5154('0x33')](_0x51d763[_0x5154('0x2e')]['sort']);_0xc5622b[_0x5154('0x34')]=qs['filters'](_[_0x5154('0x36')](_0x51d763[_0x5154('0x2e')],_0x5283b0[_0x5154('0x35')]));if(_0x51d763[_0x5154('0x2e')]['filter']){_0xc5622b[_0x5154('0x34')]=_[_0x5154('0x37')](_0xc5622b[_0x5154('0x34')],{'$or':_['map'](_0xc5622b['attributes'],function(_0x3eaddb){var _0x4cac47={};_0x4cac47[_0x3eaddb]={'$like':'%'+_0x51d763[_0x5154('0x2e')][_0x5154('0x39')]+'%'};return _0x4cac47;})});}_0xc5622b=_[_0x5154('0x37')]({},_0xc5622b,_0x51d763[_0x5154('0x3a')]);return _0x540a7f[_0x5154('0x47')](_0xc5622b);}})[_0x5154('0x22')](function(_0x5e93be){if(_0x5e93be){_0x14fd43=_0x5e93be[_0x5154('0x40')];if(!_0x51d763[_0x5154('0x2e')][_0x5154('0x4a')](_0x5154('0x32'))){_0xc5622b['limit']=qs[_0x5154('0x1c')](_0x51d763[_0x5154('0x2e')][_0x5154('0x1c')]);_0xc5622b[_0x5154('0x1b')]=qs[_0x5154('0x1b')](_0x51d763['query'][_0x5154('0x1b')]);}return _0x540a7f['getFields'](_0xc5622b);}})[_0x5154('0x22')](function(_0x4b1eec){if(_0x4b1eec){return _0x4b1eec?{'count':_0x14fd43,'rows':_0x4b1eec}:null;}})[_0x5154('0x22')](respondWithResult(_0x92064b,null))['catch'](handleError(_0x92064b,null));};exports[_0x5154('0x4b')]=function(_0x54079d,_0x462363,_0xe524d3){var _0x23957e={};var _0x1b26c3={};var _0x4bf091;var _0x385b55;return db[_0x5154('0x28')][_0x5154('0x4c')]({'where':{'id':_0x54079d['params']['id']}})[_0x5154('0x22')](handleEntityNotFound(_0x462363,null))['then'](function(_0x5148fb){if(_0x5148fb){_0x4bf091=_0x5148fb;_0x1b26c3[_0x5154('0x2c')]=_[_0x5154('0x2d')](db[_0x5154('0x48')][_0x5154('0x3f')]);_0x1b26c3[_0x5154('0x2e')]=_[_0x5154('0x2d')](_0x54079d[_0x5154('0x2e')]);_0x1b26c3['filters']=_['intersection'](_0x1b26c3[_0x5154('0x2c')],_0x1b26c3['query']);_0x23957e['attributes']=_[_0x5154('0x2f')](_0x1b26c3[_0x5154('0x2c')],qs[_0x5154('0x31')](_0x54079d['query']['fields']));_0x23957e[_0x5154('0x30')]=_0x23957e[_0x5154('0x30')]['length']?_0x23957e[_0x5154('0x30')]:_0x1b26c3[_0x5154('0x2c')];_0x23957e['order']=qs['sort'](_0x54079d[_0x5154('0x2e')][_0x5154('0x33')]);_0x23957e['where']=qs[_0x5154('0x35')](_[_0x5154('0x36')](_0x54079d[_0x5154('0x2e')],_0x1b26c3[_0x5154('0x35')]));if(_0x54079d['query'][_0x5154('0x39')]){_0x23957e[_0x5154('0x34')]=_[_0x5154('0x37')](_0x23957e['where'],{'$or':_[_0x5154('0x27')](_0x23957e[_0x5154('0x30')],function(_0x24dd6f){var _0x3aa858={};_0x3aa858[_0x24dd6f]={'$like':'%'+_0x54079d['query'][_0x5154('0x39')]+'%'};return _0x3aa858;})});}_0x23957e=_[_0x5154('0x37')]({},_0x23957e,_0x54079d['options']);return _0x4bf091['getSubjects'](_0x23957e);}})['then'](function(_0x2ae9d3){if(_0x2ae9d3){_0x385b55=_0x2ae9d3[_0x5154('0x40')];if(!_0x54079d['query']['hasOwnProperty'](_0x5154('0x32'))){_0x23957e['limit']=qs['limit'](_0x54079d[_0x5154('0x2e')]['limit']);_0x23957e[_0x5154('0x1b')]=qs[_0x5154('0x1b')](_0x54079d[_0x5154('0x2e')][_0x5154('0x1b')]);}return _0x4bf091[_0x5154('0x4b')](_0x23957e);}})['then'](function(_0x570fb9){if(_0x570fb9){return _0x570fb9?{'count':_0x385b55,'rows':_0x570fb9}:null;}})['then'](respondWithResult(_0x462363,null))[_0x5154('0x45')](handleError(_0x462363,null));};exports['getDescriptions']=function(_0x1aade5,_0x5e5182,_0x11203d){var _0x5bec67={};var _0x1ffb4f={};var _0x2c1758;var _0x5d31a4;return db['ZohoConfiguration'][_0x5154('0x4c')]({'where':{'id':_0x1aade5[_0x5154('0x3e')]['id']}})[_0x5154('0x22')](handleEntityNotFound(_0x5e5182,null))[_0x5154('0x22')](function(_0x3cf746){if(_0x3cf746){_0x2c1758=_0x3cf746;_0x1ffb4f[_0x5154('0x2c')]=_[_0x5154('0x2d')](db[_0x5154('0x48')][_0x5154('0x3f')]);_0x1ffb4f[_0x5154('0x2e')]=_['keys'](_0x1aade5[_0x5154('0x2e')]);_0x1ffb4f['filters']=_[_0x5154('0x2f')](_0x1ffb4f[_0x5154('0x2c')],_0x1ffb4f[_0x5154('0x2e')]);_0x5bec67[_0x5154('0x30')]=_[_0x5154('0x2f')](_0x1ffb4f[_0x5154('0x2c')],qs[_0x5154('0x31')](_0x1aade5['query'][_0x5154('0x31')]));_0x5bec67[_0x5154('0x30')]=_0x5bec67['attributes'][_0x5154('0x40')]?_0x5bec67[_0x5154('0x30')]:_0x1ffb4f['model'];_0x5bec67['order']=qs['sort'](_0x1aade5[_0x5154('0x2e')][_0x5154('0x33')]);_0x5bec67[_0x5154('0x34')]=qs[_0x5154('0x35')](_[_0x5154('0x36')](_0x1aade5[_0x5154('0x2e')],_0x1ffb4f['filters']));if(_0x1aade5[_0x5154('0x2e')][_0x5154('0x39')]){_0x5bec67[_0x5154('0x34')]=_[_0x5154('0x37')](_0x5bec67[_0x5154('0x34')],{'$or':_[_0x5154('0x27')](_0x5bec67[_0x5154('0x30')],function(_0x31a4d0){var _0x31b793={};_0x31b793[_0x31a4d0]={'$like':'%'+_0x1aade5[_0x5154('0x2e')][_0x5154('0x39')]+'%'};return _0x31b793;})});}_0x5bec67=_[_0x5154('0x37')]({},_0x5bec67,_0x1aade5[_0x5154('0x3a')]);return _0x2c1758[_0x5154('0x4d')](_0x5bec67);}})[_0x5154('0x22')](function(_0x54483b){if(_0x54483b){_0x5d31a4=_0x54483b[_0x5154('0x40')];if(!_0x1aade5[_0x5154('0x2e')][_0x5154('0x4a')](_0x5154('0x32'))){_0x5bec67['limit']=qs[_0x5154('0x1c')](_0x1aade5[_0x5154('0x2e')][_0x5154('0x1c')]);_0x5bec67[_0x5154('0x1b')]=qs[_0x5154('0x1b')](_0x1aade5[_0x5154('0x2e')]['offset']);}return _0x2c1758[_0x5154('0x4d')](_0x5bec67);}})[_0x5154('0x22')](function(_0x3d0a02){if(_0x3d0a02){return _0x3d0a02?{'count':_0x5d31a4,'rows':_0x3d0a02}:null;}})[_0x5154('0x22')](respondWithResult(_0x5e5182,null))[_0x5154('0x45')](handleError(_0x5e5182,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2e2ba1d..9cedc94 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 _0x9277=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration'];(function(_0x59f05c,_0x25c31f){var _0x342224=function(_0x4545e8){while(--_0x4545e8){_0x59f05c['push'](_0x59f05c['shift']());}};_0x342224(++_0x25c31f);}(_0x9277,0xb4));var _0x7927=function(_0x49677a,_0x197e86){_0x49677a=_0x49677a-0x0;var _0x115408=_0x9277[_0x49677a];return _0x115408;};'use strict';var _=require(_0x7927('0x0'));var util=require(_0x7927('0x1'));var logger=require(_0x7927('0x2'))('api');var moment=require(_0x7927('0x3'));var BPromise=require(_0x7927('0x4'));var rp=require(_0x7927('0x5'));var fs=require('fs');var path=require(_0x7927('0x6'));var rimraf=require(_0x7927('0x7'));var config=require(_0x7927('0x8'));var attributes=require(_0x7927('0x9'));module[_0x7927('0xa')]=function(_0x2c9701,_0x1ae8ee){return _0x2c9701['define'](_0x7927('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c25=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x26b74e,_0x28eada){var _0x41f8fa=function(_0x3313d1){while(--_0x3313d1){_0x26b74e['push'](_0x26b74e['shift']());}};_0x41f8fa(++_0x28eada);}(_0x8c25,0x110));var _0x58c2=function(_0x498d79,_0x4a9a67){_0x498d79=_0x498d79-0x0;var _0x331b6f=_0x8c25[_0x498d79];return _0x331b6f;};'use strict';var _=require(_0x58c2('0x0'));var util=require('util');var logger=require(_0x58c2('0x1'))(_0x58c2('0x2'));var moment=require(_0x58c2('0x3'));var BPromise=require(_0x58c2('0x4'));var rp=require(_0x58c2('0x5'));var fs=require('fs');var path=require(_0x58c2('0x6'));var rimraf=require('rimraf');var config=require(_0x58c2('0x7'));var attributes=require(_0x58c2('0x8'));module[_0x58c2('0x9')]=function(_0x5df484,_0x37fc41){return _0x5df484[_0x58c2('0xa')](_0x58c2('0xb'),attributes,{'tableName':_0x58c2('0xc'),'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 e895c8b..fffa860 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 _0xfb81=['result','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x49e3e0,_0x52ebc5){var _0x4c7b63=function(_0x279204){while(--_0x279204){_0x49e3e0['push'](_0x49e3e0['shift']());}};_0x4c7b63(++_0x52ebc5);}(_0xfb81,0x1a5));var _0x1fb8=function(_0x4d12c0,_0x19f3af){_0x4d12c0=_0x4d12c0-0x0;var _0x216508=_0xfb81[_0x4d12c0];return _0x216508;};'use strict';var _=require(_0x1fb8('0x0'));var util=require(_0x1fb8('0x1'));var moment=require(_0x1fb8('0x2'));var BPromise=require(_0x1fb8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1fb8('0x5'))('rpc');var config=require(_0x1fb8('0x6'));var jayson=require(_0x1fb8('0x7'));var client=jayson[_0x1fb8('0x8')][_0x1fb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56ccaa,_0x5452af,_0x4521cb){return new BPromise(function(_0x349df7,_0x39fb8e){return client[_0x1fb8('0xa')](_0x56ccaa,_0x4521cb)[_0x1fb8('0xb')](function(_0x454bb9){logger[_0x1fb8('0xc')](_0x1fb8('0xd'),_0x5452af,_0x1fb8('0xe'));logger[_0x1fb8('0xf')](_0x1fb8('0x10'),_0x5452af,'request\x20sent',JSON['stringify'](_0x454bb9));if(_0x454bb9[_0x1fb8('0x11')]){if(_0x454bb9[_0x1fb8('0x11')][_0x1fb8('0x12')]===0x1f4){logger[_0x1fb8('0x11')](_0x1fb8('0xd'),_0x5452af,_0x454bb9[_0x1fb8('0x11')][_0x1fb8('0x13')]);return _0x39fb8e(_0x454bb9[_0x1fb8('0x11')][_0x1fb8('0x13')]);}logger[_0x1fb8('0x11')](_0x1fb8('0xd'),_0x5452af,_0x454bb9['error']['message']);return _0x349df7(_0x454bb9['error']['message']);}else{logger['info'](_0x1fb8('0xd'),_0x5452af,_0x1fb8('0xe'));_0x349df7(_0x454bb9[_0x1fb8('0x14')][_0x1fb8('0x13')]);}})['catch'](function(_0x5bdaab){logger[_0x1fb8('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x5452af,_0x5bdaab);_0x39fb8e(_0x5bdaab);});});} \ No newline at end of file +var _0xd8bd=['info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5cbd0f,_0x184f29){var _0x6117a5=function(_0x1433e8){while(--_0x1433e8){_0x5cbd0f['push'](_0x5cbd0f['shift']());}};_0x6117a5(++_0x184f29);}(_0xd8bd,0x8c));var _0xdd8b=function(_0x489ba3,_0x120fc1){_0x489ba3=_0x489ba3-0x0;var _0x5a80a0=_0xd8bd[_0x489ba3];return _0x5a80a0;};'use strict';var _=require(_0xdd8b('0x0'));var util=require(_0xdd8b('0x1'));var moment=require(_0xdd8b('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd8b('0x3'));var fs=require('fs');var Redis=require(_0xdd8b('0x4'));var db=require(_0xdd8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd8b('0x6'))(_0xdd8b('0x7'));var config=require(_0xdd8b('0x8'));var jayson=require(_0xdd8b('0x9'));var client=jayson[_0xdd8b('0xa')][_0xdd8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4354cf,_0x3ee7b2,_0x498711){return new BPromise(function(_0x3ea881,_0x353379){return client[_0xdd8b('0xc')](_0x4354cf,_0x498711)[_0xdd8b('0xd')](function(_0x174efb){logger[_0xdd8b('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3ee7b2,_0xdd8b('0xf'));logger[_0xdd8b('0x10')](_0xdd8b('0x11'),_0x3ee7b2,_0xdd8b('0xf'),JSON['stringify'](_0x174efb));if(_0x174efb[_0xdd8b('0x12')]){if(_0x174efb['error']['code']===0x1f4){logger[_0xdd8b('0x12')](_0xdd8b('0x13'),_0x3ee7b2,_0x174efb['error'][_0xdd8b('0x14')]);return _0x353379(_0x174efb['error'][_0xdd8b('0x14')]);}logger[_0xdd8b('0x12')](_0xdd8b('0x13'),_0x3ee7b2,_0x174efb[_0xdd8b('0x12')][_0xdd8b('0x14')]);return _0x3ea881(_0x174efb[_0xdd8b('0x12')]['message']);}else{logger[_0xdd8b('0xe')](_0xdd8b('0x13'),_0x3ee7b2,'request\x20sent');_0x3ea881(_0x174efb[_0xdd8b('0x15')]['message']);}})['catch'](function(_0xd6f8a2){logger['error'](_0xdd8b('0x13'),_0x3ee7b2,_0xd6f8a2);_0x353379(_0xd6f8a2);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index bbb3b6a..15c007c 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 _0xd08d=['./intZohoField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x35c922,_0x41c722){var _0x2c987f=function(_0x5eb1f8){while(--_0x5eb1f8){_0x35c922['push'](_0x35c922['shift']());}};_0x2c987f(++_0x41c722);}(_0xd08d,0xe6));var _0xdd08=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd08d[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0xdd08('0x0'));var util=require(_0xdd08('0x1'));var path=require(_0xdd08('0x2'));var timeout=require(_0xdd08('0x3'));var express=require(_0xdd08('0x4'));var router=express[_0xdd08('0x5')]();var fs_extra=require(_0xdd08('0x6'));var auth=require(_0xdd08('0x7'));var interaction=require(_0xdd08('0x8'));var config=require(_0xdd08('0x9'));var controller=require(_0xdd08('0xa'));router[_0xdd08('0xb')]('/',auth[_0xdd08('0xc')](),controller[_0xdd08('0xd')]);router[_0xdd08('0xb')](_0xdd08('0xe'),auth[_0xdd08('0xc')](),controller[_0xdd08('0xf')]);router['post']('/',auth[_0xdd08('0xc')](),controller['create']);router[_0xdd08('0x10')](_0xdd08('0xe'),auth[_0xdd08('0xc')](),controller['update']);router[_0xdd08('0x11')](_0xdd08('0xe'),auth['isAuthenticated'](),controller[_0xdd08('0x12')]);module[_0xdd08('0x13')]=router; \ No newline at end of file +var _0xe91e=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','path'];(function(_0x515b8f,_0x36bac5){var _0x8a3c03=function(_0x323def){while(--_0x323def){_0x515b8f['push'](_0x515b8f['shift']());}};_0x8a3c03(++_0x36bac5);}(_0xe91e,0x196));var _0xee91=function(_0x32e264,_0x41cee8){_0x32e264=_0x32e264-0x0;var _0x1d7175=_0xe91e[_0x32e264];return _0x1d7175;};'use strict';var multer=require('multer');var util=require(_0xee91('0x0'));var path=require(_0xee91('0x1'));var timeout=require(_0xee91('0x2'));var express=require(_0xee91('0x3'));var router=express['Router']();var fs_extra=require(_0xee91('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xee91('0x5'));var config=require(_0xee91('0x6'));var controller=require('./intZohoField.controller');router[_0xee91('0x7')]('/',auth[_0xee91('0x8')](),controller[_0xee91('0x9')]);router[_0xee91('0x7')](_0xee91('0xa'),auth[_0xee91('0x8')](),controller[_0xee91('0xb')]);router[_0xee91('0xc')]('/',auth[_0xee91('0x8')](),controller[_0xee91('0xd')]);router[_0xee91('0xe')](_0xee91('0xa'),auth[_0xee91('0x8')](),controller['update']);router['delete'](_0xee91('0xa'),auth[_0xee91('0x8')](),controller[_0xee91('0xf')]);module[_0xee91('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b61eeae..755102b 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 _0x790f=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0x790f,0x81));var _0xf790=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x790f[_0x1aab74];return _0x396af2;};'use strict';var Sequelize=require('sequelize');module[_0xf790('0x0')]={'type':{'type':Sequelize['ENUM'](_0xf790('0x1'),_0xf790('0x2'),_0xf790('0x3'),_0xf790('0x4'),_0xf790('0x5')),'defaultValue':_0xf790('0x1')},'content':{'type':Sequelize[_0xf790('0x6')]},'key':{'type':Sequelize[_0xf790('0x6')]},'keyType':{'type':Sequelize[_0xf790('0x7')]('string',_0xf790('0x2'),_0xf790('0x3'))},'keyContent':{'type':Sequelize[_0xf790('0x6')]},'idField':{'type':Sequelize[_0xf790('0x6')]},'nameField':{'type':Sequelize[_0xf790('0x6')]},'customField':{'type':Sequelize[_0xf790('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c83=['keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6c83,0xb9));var _0x36c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c83[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x36c8('0x0'));module[_0x36c8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x36c8('0x2'),'variable',_0x36c8('0x3'),_0x36c8('0x4'),'picklist'),'defaultValue':_0x36c8('0x2')},'content':{'type':Sequelize[_0x36c8('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x36c8('0x6')]('string',_0x36c8('0x7'),_0x36c8('0x3'))},'keyContent':{'type':Sequelize[_0x36c8('0x5')]},'idField':{'type':Sequelize[_0x36c8('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x36c8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36c8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f61da84..720cef4 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 _0x7f96=['length','options','create','body','params','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show'];(function(_0x41b934,_0x23518a){var _0x10c248=function(_0x1fd5b7){while(--_0x1fd5b7){_0x41b934['push'](_0x41b934['shift']());}};_0x10c248(++_0x23518a);}(_0x7f96,0xa0));var _0x67f9=function(_0x293093,_0x217de5){_0x293093=_0x293093-0x0;var _0x4bfa88=_0x7f96[_0x293093];return _0x4bfa88;};'use strict';var emlformat=require(_0x67f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67f9('0x1'));var jsonpatch=require(_0x67f9('0x2'));var rp=require(_0x67f9('0x3'));var moment=require(_0x67f9('0x4'));var BPromise=require(_0x67f9('0x5'));var Mustache=require(_0x67f9('0x6'));var util=require(_0x67f9('0x7'));var path=require(_0x67f9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x67f9('0x9'));var fs=require('fs');var fs_extra=require(_0x67f9('0xa'));var _=require(_0x67f9('0xb'));var squel=require(_0x67f9('0xc'));var crypto=require(_0x67f9('0xd'));var jsforce=require(_0x67f9('0xe'));var deskjs=require(_0x67f9('0xf'));var toCsv=require(_0x67f9('0x10'));var querystring=require(_0x67f9('0x11'));var Papa=require('papaparse');var Redis=require(_0x67f9('0x12'));var authService=require(_0x67f9('0x13'));var qs=require(_0x67f9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x67f9('0x15'));var logger=require(_0x67f9('0x16'))(_0x67f9('0x17'));var utils=require(_0x67f9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x67f9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d8dda,_0xd4e1b8){_0xd4e1b8=_0xd4e1b8||0xcc;return function(_0x1cacf5){if(_0x1cacf5){return _0x4d8dda[_0x67f9('0x1a')](_0xd4e1b8);}return _0x4d8dda['status'](_0xd4e1b8)['end']();};}function respondWithResult(_0x399450,_0x117b08){_0x117b08=_0x117b08||0xc8;return function(_0x30f216){if(_0x30f216){return _0x399450[_0x67f9('0x1b')](_0x117b08)[_0x67f9('0x1c')](_0x30f216);}};}function respondWithFilteredResult(_0x19b00f,_0x129ffd){return function(_0x2411c8){if(_0x2411c8){var _0x308114=typeof _0x129ffd[_0x67f9('0x1d')]==='undefined'&&typeof _0x129ffd[_0x67f9('0x1e')]===_0x67f9('0x1f');var _0x7795fe=_0x2411c8['count'];var _0x2a2a0b=_0x308114?0x0:_0x129ffd[_0x67f9('0x1d')];var _0x2f2481=_0x308114?_0x2411c8[_0x67f9('0x20')]:_0x129ffd['offset']+_0x129ffd[_0x67f9('0x1e')];var _0x71a3c1;if(_0x2f2481>=_0x7795fe){_0x2f2481=_0x7795fe;_0x71a3c1=0xc8;}else{_0x71a3c1=0xce;}_0x19b00f[_0x67f9('0x1b')](_0x71a3c1);return _0x19b00f[_0x67f9('0x21')](_0x67f9('0x22'),_0x2a2a0b+'-'+_0x2f2481+'/'+_0x7795fe)[_0x67f9('0x1c')](_0x2411c8);}return null;};}function patchUpdates(_0x395ca4){return function(_0x2984c6){try{jsonpatch[_0x67f9('0x23')](_0x2984c6,_0x395ca4,!![]);}catch(_0x9fdee7){return BPromise[_0x67f9('0x24')](_0x9fdee7);}return _0x2984c6[_0x67f9('0x25')]();};}function saveUpdates(_0x1db21f,_0x4e8c49){return function(_0x5c55d1){if(_0x5c55d1){return _0x5c55d1[_0x67f9('0x26')](_0x1db21f)[_0x67f9('0x27')](function(_0x294b2b){return _0x294b2b;});}return null;};}function removeEntity(_0x31d144,_0x3cd690){return function(_0xf816f2){if(_0xf816f2){return _0xf816f2[_0x67f9('0x28')]()['then'](function(){_0x31d144['status'](0xcc)[_0x67f9('0x29')]();});}};}function handleEntityNotFound(_0xde7101,_0x4b0936){return function(_0x51d5cc){if(!_0x51d5cc){_0xde7101[_0x67f9('0x1a')](0x194);}return _0x51d5cc;};}function handleError(_0x5337c3,_0x1b09aa){_0x1b09aa=_0x1b09aa||0x1f4;return function(_0x34c7a8){logger[_0x67f9('0x2a')](_0x34c7a8['stack']);if(_0x34c7a8[_0x67f9('0x2b')]){delete _0x34c7a8[_0x67f9('0x2b')];}_0x5337c3[_0x67f9('0x1b')](_0x1b09aa)[_0x67f9('0x2c')](_0x34c7a8);};}exports[_0x67f9('0x2d')]=function(_0x5adce9,_0x2351c4){var _0x435b9f={},_0x5d7b6f={},_0x46511c={'count':0x0,'rows':[]};var _0x5538cc=_[_0x67f9('0x2e')](db[_0x67f9('0x2f')][_0x67f9('0x30')],function(_0x156313){return{'name':_0x156313[_0x67f9('0x31')],'type':_0x156313[_0x67f9('0x32')][_0x67f9('0x33')]};});_0x5d7b6f[_0x67f9('0x34')]=_[_0x67f9('0x2e')](_0x5538cc,'name');_0x5d7b6f['query']=_[_0x67f9('0x35')](_0x5adce9[_0x67f9('0x36')]);_0x5d7b6f[_0x67f9('0x37')]=_[_0x67f9('0x38')](_0x5d7b6f[_0x67f9('0x34')],_0x5d7b6f[_0x67f9('0x36')]);_0x435b9f['attributes']=_[_0x67f9('0x38')](_0x5d7b6f[_0x67f9('0x34')],qs['fields'](_0x5adce9[_0x67f9('0x36')][_0x67f9('0x39')]));_0x435b9f[_0x67f9('0x3a')]=_0x435b9f[_0x67f9('0x3a')]['length']?_0x435b9f[_0x67f9('0x3a')]:_0x5d7b6f['model'];if(!_0x5adce9[_0x67f9('0x36')][_0x67f9('0x3b')]('nolimit')){_0x435b9f[_0x67f9('0x1e')]=qs['limit'](_0x5adce9[_0x67f9('0x36')][_0x67f9('0x1e')]);_0x435b9f['offset']=qs['offset'](_0x5adce9[_0x67f9('0x36')][_0x67f9('0x1d')]);}_0x435b9f['order']=qs[_0x67f9('0x3c')](_0x5adce9[_0x67f9('0x36')][_0x67f9('0x3c')]);_0x435b9f[_0x67f9('0x3d')]=qs[_0x67f9('0x37')](_[_0x67f9('0x3e')](_0x5adce9[_0x67f9('0x36')],_0x5d7b6f['filters']),_0x5538cc);if(_0x5adce9[_0x67f9('0x36')][_0x67f9('0x3f')]){_0x435b9f[_0x67f9('0x3d')]=_[_0x67f9('0x40')](_0x435b9f[_0x67f9('0x3d')],{'$or':_[_0x67f9('0x2e')](_0x5538cc,function(_0x21df41){if(_0x21df41['type']!=='VIRTUAL'){var _0x2e906={};_0x2e906[_0x21df41[_0x67f9('0x2b')]]={'$like':'%'+_0x5adce9['query'][_0x67f9('0x3f')]+'%'};return _0x2e906;}})});}_0x435b9f=_[_0x67f9('0x40')]({},_0x435b9f,_0x5adce9['options']);var _0x32bafd={'where':_0x435b9f['where']};return db['ZohoField'][_0x67f9('0x20')](_0x32bafd)['then'](function(_0x49001c){_0x46511c[_0x67f9('0x20')]=_0x49001c;if(_0x5adce9['query'][_0x67f9('0x41')]){_0x435b9f[_0x67f9('0x42')]=[{'all':!![]}];}return db[_0x67f9('0x2f')][_0x67f9('0x43')](_0x435b9f);})[_0x67f9('0x27')](function(_0x3c971b){_0x46511c[_0x67f9('0x44')]=_0x3c971b;return _0x46511c;})[_0x67f9('0x27')](respondWithFilteredResult(_0x2351c4,_0x435b9f))[_0x67f9('0x45')](handleError(_0x2351c4,null));};exports[_0x67f9('0x46')]=function(_0xde9fd7,_0x579b2b){var _0x4d0d37={'raw':!![],'where':{'id':_0xde9fd7['params']['id']}},_0x1f861f={};_0x1f861f['model']=_['keys'](db[_0x67f9('0x2f')][_0x67f9('0x30')]);_0x1f861f[_0x67f9('0x36')]=_[_0x67f9('0x35')](_0xde9fd7[_0x67f9('0x36')]);_0x1f861f['filters']=_[_0x67f9('0x38')](_0x1f861f[_0x67f9('0x34')],_0x1f861f['query']);_0x4d0d37[_0x67f9('0x3a')]=_[_0x67f9('0x38')](_0x1f861f[_0x67f9('0x34')],qs[_0x67f9('0x39')](_0xde9fd7[_0x67f9('0x36')]['fields']));_0x4d0d37['attributes']=_0x4d0d37[_0x67f9('0x3a')][_0x67f9('0x47')]?_0x4d0d37[_0x67f9('0x3a')]:_0x1f861f[_0x67f9('0x34')];if(_0xde9fd7[_0x67f9('0x36')][_0x67f9('0x41')]){_0x4d0d37[_0x67f9('0x42')]=[{'all':!![]}];}_0x4d0d37=_['merge']({},_0x4d0d37,_0xde9fd7[_0x67f9('0x48')]);return db[_0x67f9('0x2f')]['find'](_0x4d0d37)[_0x67f9('0x27')](handleEntityNotFound(_0x579b2b,null))[_0x67f9('0x27')](respondWithResult(_0x579b2b,null))[_0x67f9('0x45')](handleError(_0x579b2b,null));};exports['create']=function(_0x570a4b,_0x21ecd1){return db[_0x67f9('0x2f')][_0x67f9('0x49')](_0x570a4b[_0x67f9('0x4a')],{})[_0x67f9('0x27')](respondWithResult(_0x21ecd1,0xc9))[_0x67f9('0x45')](handleError(_0x21ecd1,null));};exports[_0x67f9('0x26')]=function(_0x2475f5,_0x34dc3d){if(_0x2475f5[_0x67f9('0x4a')]['id']){delete _0x2475f5[_0x67f9('0x4a')]['id'];}return db[_0x67f9('0x2f')]['find']({'where':{'id':_0x2475f5[_0x67f9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x34dc3d,null))[_0x67f9('0x27')](saveUpdates(_0x2475f5['body'],null))[_0x67f9('0x27')](respondWithResult(_0x34dc3d,null))['catch'](handleError(_0x34dc3d,null));};exports[_0x67f9('0x28')]=function(_0x48cbf5,_0x33adc2){return db[_0x67f9('0x2f')][_0x67f9('0x4c')]({'where':{'id':_0x48cbf5[_0x67f9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33adc2,null))['then'](removeEntity(_0x33adc2,null))[_0x67f9('0x45')](handleError(_0x33adc2,null));}; \ No newline at end of file +var _0x3117=['end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','length','include','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x3117,0x1af));var _0x7311=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0x3117[_0x576d8a];return _0x3dc3ef;};'use strict';var emlformat=require(_0x7311('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7311('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7311('0x2'));var moment=require(_0x7311('0x3'));var BPromise=require(_0x7311('0x4'));var Mustache=require('mustache');var util=require(_0x7311('0x5'));var path=require(_0x7311('0x6'));var sox=require('sox');var csv=require(_0x7311('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7311('0x8'));var _=require(_0x7311('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7311('0xa'));var toCsv=require(_0x7311('0x7'));var querystring=require(_0x7311('0xb'));var Papa=require(_0x7311('0xc'));var Redis=require(_0x7311('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7311('0xe'));var as=require(_0x7311('0xf'));var hardwareService=require(_0x7311('0x10'));var logger=require(_0x7311('0x11'))(_0x7311('0x12'));var utils=require(_0x7311('0x13'));var config=require(_0x7311('0x14'));var licenseUtil=require(_0x7311('0x15'));var db=require(_0x7311('0x16'))['db'];function respondWithStatusCode(_0x1370fd,_0x57c5b9){_0x57c5b9=_0x57c5b9||0xcc;return function(_0x14c2be){if(_0x14c2be){return _0x1370fd[_0x7311('0x17')](_0x57c5b9);}return _0x1370fd[_0x7311('0x18')](_0x57c5b9)[_0x7311('0x19')]();};}function respondWithResult(_0x25047f,_0x25ed9d){_0x25ed9d=_0x25ed9d||0xc8;return function(_0xb69d34){if(_0xb69d34){return _0x25047f['status'](_0x25ed9d)[_0x7311('0x1a')](_0xb69d34);}};}function respondWithFilteredResult(_0x1e8c53,_0x514336){return function(_0x3fecb0){if(_0x3fecb0){var _0x1b4d5a=typeof _0x514336[_0x7311('0x1b')]==='undefined'&&typeof _0x514336[_0x7311('0x1c')]===_0x7311('0x1d');var _0x27b961=_0x3fecb0[_0x7311('0x1e')];var _0x1042c4=_0x1b4d5a?0x0:_0x514336['offset'];var _0x2c2cff=_0x1b4d5a?_0x3fecb0[_0x7311('0x1e')]:_0x514336[_0x7311('0x1b')]+_0x514336[_0x7311('0x1c')];var _0x3fb8b7;if(_0x2c2cff>=_0x27b961){_0x2c2cff=_0x27b961;_0x3fb8b7=0xc8;}else{_0x3fb8b7=0xce;}_0x1e8c53[_0x7311('0x18')](_0x3fb8b7);return _0x1e8c53[_0x7311('0x1f')]('Content-Range',_0x1042c4+'-'+_0x2c2cff+'/'+_0x27b961)[_0x7311('0x1a')](_0x3fecb0);}return null;};}function patchUpdates(_0x19c5c5){return function(_0x2d1750){try{jsonpatch[_0x7311('0x20')](_0x2d1750,_0x19c5c5,!![]);}catch(_0x2870eb){return BPromise[_0x7311('0x21')](_0x2870eb);}return _0x2d1750[_0x7311('0x22')]();};}function saveUpdates(_0x2f983b,_0x3617ff){return function(_0x1c621a){if(_0x1c621a){return _0x1c621a[_0x7311('0x23')](_0x2f983b)[_0x7311('0x24')](function(_0x25ba57){return _0x25ba57;});}return null;};}function removeEntity(_0x404351,_0xf2cc8d){return function(_0x1b0f90){if(_0x1b0f90){return _0x1b0f90[_0x7311('0x25')]()[_0x7311('0x24')](function(){_0x404351[_0x7311('0x18')](0xcc)[_0x7311('0x19')]();});}};}function handleEntityNotFound(_0x2df9da,_0x60b56a){return function(_0x9f581f){if(!_0x9f581f){_0x2df9da[_0x7311('0x17')](0x194);}return _0x9f581f;};}function handleError(_0x42b088,_0xc84554){_0xc84554=_0xc84554||0x1f4;return function(_0xe2dcac){logger[_0x7311('0x26')](_0xe2dcac[_0x7311('0x27')]);if(_0xe2dcac[_0x7311('0x28')]){delete _0xe2dcac[_0x7311('0x28')];}_0x42b088[_0x7311('0x18')](_0xc84554)[_0x7311('0x29')](_0xe2dcac);};}exports[_0x7311('0x2a')]=function(_0x5f40ff,_0x1cd7b7){var _0x5c1146={},_0x336436={},_0xf2c94a={'count':0x0,'rows':[]};var _0x1dfdac=_[_0x7311('0x2b')](db[_0x7311('0x2c')][_0x7311('0x2d')],function(_0x11815c){return{'name':_0x11815c[_0x7311('0x2e')],'type':_0x11815c[_0x7311('0x2f')][_0x7311('0x30')]};});_0x336436[_0x7311('0x31')]=_[_0x7311('0x2b')](_0x1dfdac,_0x7311('0x28'));_0x336436[_0x7311('0x32')]=_['keys'](_0x5f40ff[_0x7311('0x32')]);_0x336436['filters']=_[_0x7311('0x33')](_0x336436[_0x7311('0x31')],_0x336436[_0x7311('0x32')]);_0x5c1146['attributes']=_[_0x7311('0x33')](_0x336436[_0x7311('0x31')],qs['fields'](_0x5f40ff[_0x7311('0x32')][_0x7311('0x34')]));_0x5c1146[_0x7311('0x35')]=_0x5c1146[_0x7311('0x35')]['length']?_0x5c1146[_0x7311('0x35')]:_0x336436[_0x7311('0x31')];if(!_0x5f40ff[_0x7311('0x32')][_0x7311('0x36')](_0x7311('0x37'))){_0x5c1146[_0x7311('0x1c')]=qs[_0x7311('0x1c')](_0x5f40ff[_0x7311('0x32')][_0x7311('0x1c')]);_0x5c1146[_0x7311('0x1b')]=qs[_0x7311('0x1b')](_0x5f40ff[_0x7311('0x32')][_0x7311('0x1b')]);}_0x5c1146[_0x7311('0x38')]=qs[_0x7311('0x39')](_0x5f40ff[_0x7311('0x32')][_0x7311('0x39')]);_0x5c1146[_0x7311('0x3a')]=qs[_0x7311('0x3b')](_[_0x7311('0x3c')](_0x5f40ff[_0x7311('0x32')],_0x336436[_0x7311('0x3b')]),_0x1dfdac);if(_0x5f40ff['query'][_0x7311('0x3d')]){_0x5c1146[_0x7311('0x3a')]=_[_0x7311('0x3e')](_0x5c1146[_0x7311('0x3a')],{'$or':_[_0x7311('0x2b')](_0x1dfdac,function(_0x503be1){if(_0x503be1[_0x7311('0x2f')]!==_0x7311('0x3f')){var _0x50d4a9={};_0x50d4a9[_0x503be1[_0x7311('0x28')]]={'$like':'%'+_0x5f40ff['query']['filter']+'%'};return _0x50d4a9;}})});}_0x5c1146=_[_0x7311('0x3e')]({},_0x5c1146,_0x5f40ff[_0x7311('0x40')]);var _0x109880={'where':_0x5c1146[_0x7311('0x3a')]};return db[_0x7311('0x2c')][_0x7311('0x1e')](_0x109880)[_0x7311('0x24')](function(_0x45a9be){_0xf2c94a[_0x7311('0x1e')]=_0x45a9be;if(_0x5f40ff[_0x7311('0x32')][_0x7311('0x41')]){_0x5c1146['include']=[{'all':!![]}];}return db[_0x7311('0x2c')][_0x7311('0x42')](_0x5c1146);})['then'](function(_0x59bef){_0xf2c94a['rows']=_0x59bef;return _0xf2c94a;})[_0x7311('0x24')](respondWithFilteredResult(_0x1cd7b7,_0x5c1146))['catch'](handleError(_0x1cd7b7,null));};exports[_0x7311('0x43')]=function(_0x230469,_0x4d9369){var _0x30dd86={'raw':!![],'where':{'id':_0x230469[_0x7311('0x44')]['id']}},_0x2bfcf6={};_0x2bfcf6[_0x7311('0x31')]=_[_0x7311('0x45')](db[_0x7311('0x2c')][_0x7311('0x2d')]);_0x2bfcf6[_0x7311('0x32')]=_[_0x7311('0x45')](_0x230469[_0x7311('0x32')]);_0x2bfcf6[_0x7311('0x3b')]=_[_0x7311('0x33')](_0x2bfcf6[_0x7311('0x31')],_0x2bfcf6[_0x7311('0x32')]);_0x30dd86['attributes']=_[_0x7311('0x33')](_0x2bfcf6[_0x7311('0x31')],qs['fields'](_0x230469[_0x7311('0x32')][_0x7311('0x34')]));_0x30dd86['attributes']=_0x30dd86[_0x7311('0x35')][_0x7311('0x46')]?_0x30dd86[_0x7311('0x35')]:_0x2bfcf6['model'];if(_0x230469['query'][_0x7311('0x41')]){_0x30dd86[_0x7311('0x47')]=[{'all':!![]}];}_0x30dd86=_['merge']({},_0x30dd86,_0x230469[_0x7311('0x40')]);return db[_0x7311('0x2c')][_0x7311('0x48')](_0x30dd86)[_0x7311('0x24')](handleEntityNotFound(_0x4d9369,null))[_0x7311('0x24')](respondWithResult(_0x4d9369,null))[_0x7311('0x49')](handleError(_0x4d9369,null));};exports[_0x7311('0x4a')]=function(_0x4096c5,_0x37341e){return db[_0x7311('0x2c')]['create'](_0x4096c5[_0x7311('0x4b')],{})[_0x7311('0x24')](respondWithResult(_0x37341e,0xc9))[_0x7311('0x49')](handleError(_0x37341e,null));};exports[_0x7311('0x23')]=function(_0x1112fc,_0x13eb68){if(_0x1112fc[_0x7311('0x4b')]['id']){delete _0x1112fc[_0x7311('0x4b')]['id'];}return db[_0x7311('0x2c')]['find']({'where':{'id':_0x1112fc[_0x7311('0x44')]['id']}})[_0x7311('0x24')](handleEntityNotFound(_0x13eb68,null))[_0x7311('0x24')](saveUpdates(_0x1112fc[_0x7311('0x4b')],null))[_0x7311('0x24')](respondWithResult(_0x13eb68,null))[_0x7311('0x49')](handleError(_0x13eb68,null));};exports[_0x7311('0x25')]=function(_0x5d0218,_0x2b4512){return db[_0x7311('0x2c')][_0x7311('0x48')]({'where':{'id':_0x5d0218[_0x7311('0x44')]['id']}})[_0x7311('0x24')](handleEntityNotFound(_0x2b4512,null))[_0x7311('0x24')](removeEntity(_0x2b4512,null))[_0x7311('0x49')](handleError(_0x2b4512,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index eb72bb1..4ffde57 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 _0x9f0e=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x4fd270,_0x56c4cf){var _0x10634b=function(_0x32d4d0){while(--_0x32d4d0){_0x4fd270['push'](_0x4fd270['shift']());}};_0x10634b(++_0x56c4cf);}(_0x9f0e,0x116));var _0xe9f0=function(_0x28569e,_0x48b31b){_0x28569e=_0x28569e-0x0;var _0x14638a=_0x9f0e[_0x28569e];return _0x14638a;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));module[_0xe9f0('0x9')]=function(_0x50313d,_0x5b87c1){return _0x50313d[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':_0xe9f0('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xe9f0('0xd'),_0xe9f0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xf2e3[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index f62d0c0..09d214a 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 _0xa9db=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x54677a,_0x275426){var _0x21634c=function(_0x30a682){while(--_0x30a682){_0x54677a['push'](_0x54677a['shift']());}};_0x21634c(++_0x275426);}(_0xa9db,0x15f));var _0xba9d=function(_0x4e681f,_0xcba301){_0x4e681f=_0x4e681f-0x0;var _0x352643=_0xa9db[_0x4e681f];return _0x352643;};'use strict';var _=require(_0xba9d('0x0'));var util=require(_0xba9d('0x1'));var moment=require(_0xba9d('0x2'));var BPromise=require(_0xba9d('0x3'));var rs=require(_0xba9d('0x4'));var fs=require('fs');var Redis=require(_0xba9d('0x5'));var db=require(_0xba9d('0x6'))['db'];var utils=require(_0xba9d('0x7'));var logger=require(_0xba9d('0x8'))(_0xba9d('0x9'));var config=require(_0xba9d('0xa'));var jayson=require(_0xba9d('0xb'));var client=jayson[_0xba9d('0xc')][_0xba9d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xafaa77,_0x2fcb97,_0x53fc0c){return new BPromise(function(_0x57dda0,_0xf690ed){return client[_0xba9d('0xe')](_0xafaa77,_0x53fc0c)[_0xba9d('0xf')](function(_0x5f596d){logger[_0xba9d('0x10')](_0xba9d('0x11'),_0x2fcb97,_0xba9d('0x12'));logger[_0xba9d('0x13')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x2fcb97,_0xba9d('0x12'),JSON[_0xba9d('0x14')](_0x5f596d));if(_0x5f596d[_0xba9d('0x15')]){if(_0x5f596d[_0xba9d('0x15')]['code']===0x1f4){logger[_0xba9d('0x15')](_0xba9d('0x11'),_0x2fcb97,_0x5f596d[_0xba9d('0x15')]['message']);return _0xf690ed(_0x5f596d[_0xba9d('0x15')]['message']);}logger[_0xba9d('0x15')]('ZohoField,\x20%s,\x20%s',_0x2fcb97,_0x5f596d['error']['message']);return _0x57dda0(_0x5f596d[_0xba9d('0x15')][_0xba9d('0x16')]);}else{logger[_0xba9d('0x10')]('ZohoField,\x20%s,\x20%s',_0x2fcb97,_0xba9d('0x12'));_0x57dda0(_0x5f596d[_0xba9d('0x17')][_0xba9d('0x16')]);}})[_0xba9d('0x18')](function(_0x306405){logger[_0xba9d('0x15')]('ZohoField,\x20%s,\x20%s',_0x2fcb97,_0x306405);_0xf690ed(_0x306405);});});} \ No newline at end of file +var _0x9f4c=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','result','catch'];(function(_0x3a6e99,_0x2427a1){var _0x17941a=function(_0x805563){while(--_0x805563){_0x3a6e99['push'](_0x3a6e99['shift']());}};_0x17941a(++_0x2427a1);}(_0x9f4c,0xf2));var _0xc9f4=function(_0x114c24,_0x478050){_0x114c24=_0x114c24-0x0;var _0x1d731a=_0x9f4c[_0x114c24];return _0x1d731a;};'use strict';var _=require('lodash');var util=require(_0xc9f4('0x0'));var moment=require(_0xc9f4('0x1'));var BPromise=require(_0xc9f4('0x2'));var rs=require(_0xc9f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9f4('0x4'))['db'];var utils=require(_0xc9f4('0x5'));var logger=require(_0xc9f4('0x6'))('rpc');var config=require(_0xc9f4('0x7'));var jayson=require(_0xc9f4('0x8'));var client=jayson[_0xc9f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd40561,_0x5080be,_0x2f38df){return new BPromise(function(_0xcb117,_0x4ab160){return client[_0xc9f4('0xa')](_0xd40561,_0x2f38df)[_0xc9f4('0xb')](function(_0x6ef222){logger[_0xc9f4('0xc')]('ZohoField,\x20%s,\x20%s',_0x5080be,_0xc9f4('0xd'));logger[_0xc9f4('0xe')](_0xc9f4('0xf'),_0x5080be,'request\x20sent',JSON['stringify'](_0x6ef222));if(_0x6ef222[_0xc9f4('0x10')]){if(_0x6ef222['error'][_0xc9f4('0x11')]===0x1f4){logger[_0xc9f4('0x10')](_0xc9f4('0x12'),_0x5080be,_0x6ef222[_0xc9f4('0x10')][_0xc9f4('0x13')]);return _0x4ab160(_0x6ef222[_0xc9f4('0x10')][_0xc9f4('0x13')]);}logger[_0xc9f4('0x10')](_0xc9f4('0x12'),_0x5080be,_0x6ef222[_0xc9f4('0x10')]['message']);return _0xcb117(_0x6ef222[_0xc9f4('0x10')]['message']);}else{logger[_0xc9f4('0xc')](_0xc9f4('0x12'),_0x5080be,_0xc9f4('0xd'));_0xcb117(_0x6ef222[_0xc9f4('0x14')]['message']);}})[_0xc9f4('0x15')](function(_0x8f48a9){logger[_0xc9f4('0x10')](_0xc9f4('0x12'),_0x5080be,_0x8f48a9);_0x4ab160(_0x8f48a9);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9ae54d1..442fd86 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(_0x161cb1,_0x7930a){var _0x36dd92=function(_0x5efe8a){while(--_0x5efe8a){_0x161cb1['push'](_0x161cb1['shift']());}};_0x36dd92(++_0x7930a);}(_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 +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3f08f6,_0x1bb8dd){var _0x27a23c=function(_0x2c08a0){while(--_0x2c08a0){_0x3f08f6['push'](_0x3f08f6['shift']());}};_0x27a23c(++_0x1bb8dd);}(_0xedd9,0xfc));var _0x9edd=function(_0x539bea,_0x53eb92){_0x539bea=_0x539bea-0x0;var _0x196e38=_0xedd9[_0x539bea];return _0x196e38;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 665ff0c..464f700 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 _0xab2d=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0xb4956f,_0x45cb33){var _0x1188ea=function(_0x3a2670){while(--_0x3a2670){_0xb4956f['push'](_0xb4956f['shift']());}};_0x1188ea(++_0x45cb33);}(_0xab2d,0x85));var _0xdab2=function(_0x57e88b,_0x1fb1f4){_0x57e88b=_0x57e88b-0x0;var _0xd7bd73=_0xab2d[_0x57e88b];return _0xd7bd73;};'use strict';var Sequelize=require(_0xdab2('0x0'));module[_0xdab2('0x1')]={'name':{'type':Sequelize[_0xdab2('0x2')],'allowNull':![],'unique':_0xdab2('0x3')},'version':{'type':Sequelize[_0xdab2('0x2')],'allowNull':![],'unique':_0xdab2('0x3')},'main':{'type':Sequelize[_0xdab2('0x2')],'defaultValue':_0xdab2('0x4')},'filename':{'type':Sequelize[_0xdab2('0x2')]},'path':{'type':Sequelize[_0xdab2('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xdab2('0x5')]},'active':{'type':Sequelize[_0xdab2('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xdab2('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xdab2('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xdab2('0x2')]},'title':{'type':Sequelize[_0xdab2('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xdab2('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x21c1=['unique_name_and_version','app.js','INTEGER','BOOLEAN','STRING'];(function(_0x142201,_0x5dbbcd){var _0xc9f994=function(_0x30a743){while(--_0x30a743){_0x142201['push'](_0x142201['shift']());}};_0xc9f994(++_0x5dbbcd);}(_0x21c1,0xef));var _0x121c=function(_0x470e39,_0x4ea849){_0x470e39=_0x470e39-0x0;var _0x5a67b5=_0x21c1[_0x470e39];return _0x5a67b5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x121c('0x0')],'allowNull':![],'unique':_0x121c('0x1')},'version':{'type':Sequelize[_0x121c('0x0')],'allowNull':![],'unique':_0x121c('0x1')},'main':{'type':Sequelize[_0x121c('0x0')],'defaultValue':_0x121c('0x2')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x121c('0x0')]},'type':{'type':Sequelize[_0x121c('0x0')]},'size':{'type':Sequelize[_0x121c('0x3')]},'active':{'type':Sequelize[_0x121c('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x121c('0x0')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x121c('0x0')],'unique':'state'},'description':{'type':Sequelize[_0x121c('0x0')]},'title':{'type':Sequelize[_0x121c('0x0')]},'remoteUri':{'type':Sequelize[_0x121c('0x0')]},'link':{'type':Sequelize[_0x121c('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 2c7933b..96b239b 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 _0x53ec=['count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','Integration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x53ec,0x192));var _0xc53e=function(_0x3b0042,_0x8e7550){_0x3b0042=_0x3b0042-0x0;var _0x41bf57=_0x53ec[_0x3b0042];return _0x41bf57;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));}; \ No newline at end of file +var _0x5fab=['querystring','papaparse','../../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','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x2c5435,_0x1bbff8){var _0x1f7ffe=function(_0x5c6ac3){while(--_0x5c6ac3){_0x2c5435['push'](_0x2c5435['shift']());}};_0x1f7ffe(++_0x1bbff8);}(_0x5fab,0x177));var _0xb5fa=function(_0xdbf14f,_0x4bfcc4){_0xdbf14f=_0xdbf14f-0x0;var _0x3e58a2=_0x5fab[_0xdbf14f];return _0x3e58a2;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['Integration'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['Integration'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2edc869..511903f 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 _0x42b5=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','integrations','lodash','util','../../config/logger','api','moment'];(function(_0x48317f,_0x12895a){var _0x4d1cce=function(_0x3942da){while(--_0x3942da){_0x48317f['push'](_0x48317f['shift']());}};_0x4d1cce(++_0x12895a);}(_0x42b5,0x8a));var _0x542b=function(_0x381a28,_0x4eb359){_0x381a28=_0x381a28-0x0;var _0x5e572d=_0x42b5[_0x381a28];return _0x5e572d;};'use strict';var _=require(_0x542b('0x0'));var util=require(_0x542b('0x1'));var logger=require(_0x542b('0x2'))(_0x542b('0x3'));var moment=require(_0x542b('0x4'));var BPromise=require(_0x542b('0x5'));var rp=require(_0x542b('0x6'));var fs=require('fs');var path=require(_0x542b('0x7'));var rimraf=require(_0x542b('0x8'));var config=require(_0x542b('0x9'));var attributes=require('./integration.attributes');module[_0x542b('0xa')]=function(_0x5c1e2f,_0xdb9302){return _0x5c1e2f[_0x542b('0xb')]('Integration',attributes,{'tableName':_0x542b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0c1=['request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','integrations','api','moment','bluebird'];(function(_0xb855a6,_0x32074a){var _0x5b57bd=function(_0x296c67){while(--_0x296c67){_0xb855a6['push'](_0xb855a6['shift']());}};_0x5b57bd(++_0x32074a);}(_0xa0c1,0x7f));var _0x1a0c=function(_0x4eee0c,_0x5607b9){_0x4eee0c=_0x4eee0c-0x0;var _0x3e8820=_0xa0c1[_0x4eee0c];return _0x3e8820;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1a0c('0x0'));var moment=require(_0x1a0c('0x1'));var BPromise=require(_0x1a0c('0x2'));var rp=require(_0x1a0c('0x3'));var fs=require('fs');var path=require(_0x1a0c('0x4'));var rimraf=require(_0x1a0c('0x5'));var config=require(_0x1a0c('0x6'));var attributes=require(_0x1a0c('0x7'));module[_0x1a0c('0x8')]=function(_0x50756,_0x4612d1){return _0x50756['define']('Integration',attributes,{'tableName':_0x1a0c('0x9'),'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 428404c..517c3fc 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4e839d,_0x44020a){var _0x575d1a=function(_0x2adc1d){while(--_0x2adc1d){_0x4e839d['push'](_0x4e839d['shift']());}};_0x575d1a(++_0x44020a);}(_0xadb5,0xad));var _0x5adb=function(_0x5bec12,_0x2140f3){_0x5bec12=_0x5bec12-0x0;var _0x2b0516=_0xadb5[_0x5bec12];return _0x2b0516;};'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']('Integration,\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 _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x5ce515,_0x2c53bc){var _0xcdb139=function(_0x3c346b){while(--_0x3c346b){_0x5ce515['push'](_0x5ce515['shift']());}};_0xcdb139(++_0x2c53bc);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1823f6,_0x29142a){_0x1823f6=_0x1823f6-0x0;var _0x3eb6f1=_0x9f0e[_0x1823f6];return _0x3eb6f1;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index f7139d7..9fd9474 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x5b21c5,_0x201c44){var _0x27378c=function(_0x38761b){while(--_0x38761b){_0x5b21c5['push'](_0x5b21c5['shift']());}};_0x27378c(++_0x201c44);}(_0xef0f,0x168));var _0xfef0=function(_0x4aca12,_0x335d87){_0x4aca12=_0x4aca12-0x0;var _0xf0f91=_0xef0f[_0x4aca12];return _0xf0f91;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x383798,_0x4f16fe){var _0x2555b2=function(_0x3f61df){while(--_0x3f61df){_0x383798['push'](_0x383798['shift']());}};_0x2555b2(++_0x4f16fe);}(_0x7880,0x1f4));var _0x0788=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0x7880[_0x5c7525];return _0x2e2ec8;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 489188e..01577ca 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 _0xe150=['TEXT','RECEIVED','FAILED','sequelize','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x1db347,_0x50526b){var _0x4ec95f=function(_0x311de3){while(--_0x311de3){_0x1db347['push'](_0x1db347['shift']());}};_0x4ec95f(++_0x50526b);}(_0xe150,0xb3));var _0x0e15=function(_0x5a4ebb,_0x5459d6){_0x5a4ebb=_0x5a4ebb-0x0;var _0xbb2a27=_0xe150[_0x5a4ebb];return _0xbb2a27;};'use strict';var Sequelize=require(_0x0e15('0x0'));module['exports']={'integration':{'type':Sequelize[_0x0e15('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x0e15('0x1')]},'ticketId':{'type':Sequelize[_0x0e15('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x0e15('0x1')]},'uniqueid':{'type':Sequelize[_0x0e15('0x1')]},'calleridnum':{'type':Sequelize[_0x0e15('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0e15('0x1')]},'interface':{'type':Sequelize[_0x0e15('0x1')]},'membername':{'type':Sequelize[_0x0e15('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x0e15('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0e15('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x0e15('0x4')]},'agentacw':{'type':Sequelize[_0x0e15('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0e15('0x4')]},'reason':{'type':Sequelize[_0x0e15('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0e15('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0e15('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0e15('0x2')]},'lastevent':{'type':Sequelize[_0x0e15('0x1')]},'channel':{'type':Sequelize[_0x0e15('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0e15('0x1')]},'connectedlinename':{'type':Sequelize[_0x0e15('0x1')]},'language':{'type':Sequelize[_0x0e15('0x1')]},'accountcode':{'type':Sequelize[_0x0e15('0x1')]},'context':{'type':Sequelize[_0x0e15('0x1')]},'exten':{'type':Sequelize[_0x0e15('0x1')]},'priority':{'type':Sequelize[_0x0e15('0x1')]},'destchannel':{'type':Sequelize[_0x0e15('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0e15('0x1')]},'destcalleridname':{'type':Sequelize[_0x0e15('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x0e15('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x0e15('0x1')]},'destlanguage':{'type':Sequelize[_0x0e15('0x1')]},'destaccountcode':{'type':Sequelize[_0x0e15('0x1')]},'destcontext':{'type':Sequelize[_0x0e15('0x1')]},'destexten':{'type':Sequelize[_0x0e15('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x0e15('0x1')]},'messageId':{'type':Sequelize[_0x0e15('0x1')]},'inReplyTo':{'type':Sequelize[_0x0e15('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x0e15('0x1')]},'to':{'type':Sequelize[_0x0e15('0x1')]},'cc':{'type':Sequelize[_0x0e15('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x0e15('0x5')]},'text':{'type':Sequelize[_0x0e15('0x5')]},'status':{'type':Sequelize['ENUM']('SENT','SENDING',_0x0e15('0x6'),_0x0e15('0x7'))},'url':{'type':Sequelize[_0x0e15('0x1')]},'app':{'type':Sequelize[_0x0e15('0x1')]},'appdata':{'type':Sequelize[_0x0e15('0x1')]},'projectId':{'type':Sequelize[_0x0e15('0x4')]}}; \ No newline at end of file +var _0x638d=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x638d,0x1e2));var _0xd638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd638('0x0'));module[_0xd638('0x1')]={'integration':{'type':Sequelize[_0xd638('0x2')]},'eventChannel':{'type':Sequelize[_0xd638('0x2')]},'exitStatus':{'type':Sequelize[_0xd638('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xd638('0x3')]},'contacts':{'type':Sequelize[_0xd638('0x2')]},'uniqueid':{'type':Sequelize[_0xd638('0x2')]},'calleridnum':{'type':Sequelize[_0xd638('0x2')]},'calleridname':{'type':Sequelize[_0xd638('0x2')]},'queue':{'type':Sequelize[_0xd638('0x2')]},'interface':{'type':Sequelize[_0xd638('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd638('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd638('0x3')]},'agentcomplete':{'type':Sequelize[_0xd638('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd638('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xd638('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd638('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xd638('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xd638('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd638('0x2')]},'channel':{'type':Sequelize[_0xd638('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd638('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd638('0x2')]},'context':{'type':Sequelize[_0xd638('0x2')]},'exten':{'type':Sequelize[_0xd638('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd638('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd638('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd638('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd638('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd638('0x2')]},'destlanguage':{'type':Sequelize[_0xd638('0x2')]},'destaccountcode':{'type':Sequelize[_0xd638('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd638('0x2')]},'destpriority':{'type':Sequelize[_0xd638('0x2')]},'destuniqueid':{'type':Sequelize[_0xd638('0x2')]},'messageId':{'type':Sequelize[_0xd638('0x2')]},'inReplyTo':{'type':Sequelize[_0xd638('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xd638('0x2')]},'to':{'type':Sequelize[_0xd638('0x2')]},'cc':{'type':Sequelize[_0xd638('0x2')]},'attachment':{'type':Sequelize[_0xd638('0x6')]},'html':{'type':Sequelize[_0xd638('0x6')]},'text':{'type':Sequelize[_0xd638('0x6')]},'status':{'type':Sequelize[_0xd638('0x7')](_0xd638('0x8'),_0xd638('0x9'),_0xd638('0xa'),_0xd638('0xb'))},'url':{'type':Sequelize[_0xd638('0x2')]},'app':{'type':Sequelize[_0xd638('0x2')]},'appdata':{'type':Sequelize[_0xd638('0x2')]},'projectId':{'type':Sequelize[_0xd638('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 7ff3b30..f21ea1b 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 _0xd0ad=['include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','save','destroy','then','sendStatus','error','name','index','IntegrationReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x22521b,_0x1b15fb){var _0x5a72f5=function(_0x413b78){while(--_0x413b78){_0x22521b['push'](_0x22521b['shift']());}};_0x5a72f5(++_0x1b15fb);}(_0xd0ad,0xa3));var _0xdd0a=function(_0x170983,_0x3ab9ac){_0x170983=_0x170983-0x0;var _0x423d9a=_0xd0ad[_0x170983];return _0x423d9a;};'use strict';var emlformat=require(_0xdd0a('0x0'));var rimraf=require(_0xdd0a('0x1'));var zipdir=require(_0xdd0a('0x2'));var jsonpatch=require(_0xdd0a('0x3'));var rp=require(_0xdd0a('0x4'));var moment=require(_0xdd0a('0x5'));var BPromise=require(_0xdd0a('0x6'));var Mustache=require(_0xdd0a('0x7'));var util=require(_0xdd0a('0x8'));var path=require(_0xdd0a('0x9'));var sox=require(_0xdd0a('0xa'));var csv=require(_0xdd0a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd0a('0xc'));var squel=require(_0xdd0a('0xd'));var crypto=require('crypto');var jsforce=require(_0xdd0a('0xe'));var deskjs=require(_0xdd0a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdd0a('0x10'));var qs=require(_0xdd0a('0x11'));var as=require(_0xdd0a('0x12'));var hardwareService=require(_0xdd0a('0x13'));var logger=require('../../config/logger')(_0xdd0a('0x14'));var utils=require(_0xdd0a('0x15'));var config=require(_0xdd0a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd0a('0x17'))['db'];function respondWithStatusCode(_0x210c71,_0x255b39){_0x255b39=_0x255b39||0xcc;return function(_0xaffcb5){if(_0xaffcb5){return _0x210c71['sendStatus'](_0x255b39);}return _0x210c71[_0xdd0a('0x18')](_0x255b39)[_0xdd0a('0x19')]();};}function respondWithResult(_0x1e44a5,_0x44072c){_0x44072c=_0x44072c||0xc8;return function(_0x416b00){if(_0x416b00){return _0x1e44a5[_0xdd0a('0x18')](_0x44072c)['json'](_0x416b00);}};}function respondWithFilteredResult(_0x3d9670,_0x23c422){return function(_0x299192){if(_0x299192){var _0x503cbc=typeof _0x23c422['offset']===_0xdd0a('0x1a')&&typeof _0x23c422[_0xdd0a('0x1b')]==='undefined';var _0x346622=_0x299192[_0xdd0a('0x1c')];var _0x607919=_0x503cbc?0x0:_0x23c422[_0xdd0a('0x1d')];var _0xf9d6bb=_0x503cbc?_0x299192[_0xdd0a('0x1c')]:_0x23c422['offset']+_0x23c422[_0xdd0a('0x1b')];var _0x1c5f95;if(_0xf9d6bb>=_0x346622){_0xf9d6bb=_0x346622;_0x1c5f95=0xc8;}else{_0x1c5f95=0xce;}_0x3d9670[_0xdd0a('0x18')](_0x1c5f95);return _0x3d9670[_0xdd0a('0x1e')]('Content-Range',_0x607919+'-'+_0xf9d6bb+'/'+_0x346622)[_0xdd0a('0x1f')](_0x299192);}return null;};}function patchUpdates(_0x528dcf){return function(_0x18c650){try{jsonpatch[_0xdd0a('0x20')](_0x18c650,_0x528dcf,!![]);}catch(_0x3db3d9){return BPromise['reject'](_0x3db3d9);}return _0x18c650[_0xdd0a('0x21')]();};}function saveUpdates(_0x15ac5f,_0x2856c6){return function(_0x2978e4){if(_0x2978e4){return _0x2978e4['update'](_0x15ac5f)['then'](function(_0x444cb6){return _0x444cb6;});}return null;};}function removeEntity(_0x595680,_0xb2c733){return function(_0x56343a){if(_0x56343a){return _0x56343a[_0xdd0a('0x22')]()[_0xdd0a('0x23')](function(){_0x595680['status'](0xcc)[_0xdd0a('0x19')]();});}};}function handleEntityNotFound(_0x41e681,_0x425c2b){return function(_0x17efee){if(!_0x17efee){_0x41e681[_0xdd0a('0x24')](0x194);}return _0x17efee;};}function handleError(_0xdb5fe8,_0x28ec67){_0x28ec67=_0x28ec67||0x1f4;return function(_0x2c93be){logger[_0xdd0a('0x25')](_0x2c93be['stack']);if(_0x2c93be[_0xdd0a('0x26')]){delete _0x2c93be[_0xdd0a('0x26')];}_0xdb5fe8[_0xdd0a('0x18')](_0x28ec67)['send'](_0x2c93be);};}exports[_0xdd0a('0x27')]=function(_0x20eec5,_0x107db8){var _0x529471={},_0x39ba31={},_0x2858a1={'count':0x0,'rows':[]};var _0x23a364=_['map'](db[_0xdd0a('0x28')][_0xdd0a('0x29')],function(_0x40367a){return{'name':_0x40367a[_0xdd0a('0x2a')],'type':_0x40367a[_0xdd0a('0x2b')][_0xdd0a('0x2c')]};});_0x39ba31[_0xdd0a('0x2d')]=_[_0xdd0a('0x2e')](_0x23a364,_0xdd0a('0x26'));_0x39ba31[_0xdd0a('0x2f')]=_[_0xdd0a('0x30')](_0x20eec5[_0xdd0a('0x2f')]);_0x39ba31[_0xdd0a('0x31')]=_[_0xdd0a('0x32')](_0x39ba31[_0xdd0a('0x2d')],_0x39ba31[_0xdd0a('0x2f')]);_0x529471[_0xdd0a('0x33')]=_[_0xdd0a('0x32')](_0x39ba31[_0xdd0a('0x2d')],qs[_0xdd0a('0x34')](_0x20eec5['query'][_0xdd0a('0x34')]));_0x529471[_0xdd0a('0x33')]=_0x529471[_0xdd0a('0x33')][_0xdd0a('0x35')]?_0x529471[_0xdd0a('0x33')]:_0x39ba31[_0xdd0a('0x2d')];if(!_0x20eec5[_0xdd0a('0x2f')][_0xdd0a('0x36')](_0xdd0a('0x37'))){_0x529471[_0xdd0a('0x1b')]=qs['limit'](_0x20eec5['query'][_0xdd0a('0x1b')]);_0x529471[_0xdd0a('0x1d')]=qs['offset'](_0x20eec5[_0xdd0a('0x2f')]['offset']);}_0x529471[_0xdd0a('0x38')]=qs[_0xdd0a('0x39')](_0x20eec5['query'][_0xdd0a('0x39')]);_0x529471[_0xdd0a('0x3a')]=qs[_0xdd0a('0x31')](_[_0xdd0a('0x3b')](_0x20eec5[_0xdd0a('0x2f')],_0x39ba31['filters']),_0x23a364);if(_0x20eec5[_0xdd0a('0x2f')][_0xdd0a('0x3c')]){_0x529471[_0xdd0a('0x3a')]=_[_0xdd0a('0x3d')](_0x529471['where'],{'$or':_[_0xdd0a('0x2e')](_0x23a364,function(_0x27e26b){if(_0x27e26b[_0xdd0a('0x2b')]!==_0xdd0a('0x3e')){var _0x34c122={};_0x34c122[_0x27e26b[_0xdd0a('0x26')]]={'$like':'%'+_0x20eec5[_0xdd0a('0x2f')]['filter']+'%'};return _0x34c122;}})});}_0x529471=_[_0xdd0a('0x3d')]({},_0x529471,_0x20eec5[_0xdd0a('0x3f')]);var _0x2f39e5={'where':_0x529471[_0xdd0a('0x3a')]};return db[_0xdd0a('0x28')][_0xdd0a('0x1c')](_0x2f39e5)[_0xdd0a('0x23')](function(_0x4d0eea){_0x2858a1['count']=_0x4d0eea;if(_0x20eec5['query'][_0xdd0a('0x40')]){_0x529471[_0xdd0a('0x41')]=[{'all':!![]}];}return db[_0xdd0a('0x28')][_0xdd0a('0x42')](_0x529471);})['then'](function(_0x1848db){_0x2858a1[_0xdd0a('0x43')]=_0x1848db;return _0x2858a1;})[_0xdd0a('0x23')](respondWithFilteredResult(_0x107db8,_0x529471))[_0xdd0a('0x44')](handleError(_0x107db8,null));};exports[_0xdd0a('0x45')]=function(_0x35380e,_0x4fcbd3){var _0x1f2719={'raw':![],'where':{'id':_0x35380e[_0xdd0a('0x46')]['id']}},_0xcc33f0={};_0xcc33f0[_0xdd0a('0x2d')]=_[_0xdd0a('0x30')](db[_0xdd0a('0x28')][_0xdd0a('0x29')]);_0xcc33f0['query']=_[_0xdd0a('0x30')](_0x35380e['query']);_0xcc33f0[_0xdd0a('0x31')]=_[_0xdd0a('0x32')](_0xcc33f0[_0xdd0a('0x2d')],_0xcc33f0['query']);_0x1f2719[_0xdd0a('0x33')]=_['intersection'](_0xcc33f0[_0xdd0a('0x2d')],qs['fields'](_0x35380e[_0xdd0a('0x2f')][_0xdd0a('0x34')]));_0x1f2719[_0xdd0a('0x33')]=_0x1f2719[_0xdd0a('0x33')][_0xdd0a('0x35')]?_0x1f2719[_0xdd0a('0x33')]:_0xcc33f0['model'];if(_0x35380e[_0xdd0a('0x2f')][_0xdd0a('0x40')]){_0x1f2719[_0xdd0a('0x41')]=[{'all':!![]}];}_0x1f2719=_['merge']({},_0x1f2719,_0x35380e[_0xdd0a('0x3f')]);return db[_0xdd0a('0x28')][_0xdd0a('0x47')](_0x1f2719)[_0xdd0a('0x23')](handleEntityNotFound(_0x4fcbd3,null))[_0xdd0a('0x23')](respondWithResult(_0x4fcbd3,null))['catch'](handleError(_0x4fcbd3,null));};exports[_0xdd0a('0x48')]=function(_0x3a035f,_0x25fed1){return db['IntegrationReport'][_0xdd0a('0x48')](_0x3a035f[_0xdd0a('0x49')],{})[_0xdd0a('0x23')](respondWithResult(_0x25fed1,0xc9))[_0xdd0a('0x44')](handleError(_0x25fed1,null));};exports[_0xdd0a('0x4a')]=function(_0xb618ba,_0x132912){if(_0xb618ba[_0xdd0a('0x49')]['id']){delete _0xb618ba[_0xdd0a('0x49')]['id'];}return db['IntegrationReport'][_0xdd0a('0x47')]({'where':{'id':_0xb618ba['params']['id']}})[_0xdd0a('0x23')](handleEntityNotFound(_0x132912,null))[_0xdd0a('0x23')](saveUpdates(_0xb618ba[_0xdd0a('0x49')],null))[_0xdd0a('0x23')](respondWithResult(_0x132912,null))[_0xdd0a('0x44')](handleError(_0x132912,null));};exports['destroy']=function(_0x495c09,_0x11bca7){return db['IntegrationReport'][_0xdd0a('0x47')]({'where':{'id':_0x495c09['params']['id']}})['then'](handleEntityNotFound(_0x11bca7,null))[_0xdd0a('0x23')](removeEntity(_0x11bca7,null))['catch'](handleError(_0x11bca7,null));};exports[_0xdd0a('0x4b')]=function(_0x3e065a,_0x3918cb){return db['IntegrationReport'][_0xdd0a('0x4b')]()[_0xdd0a('0x23')](respondWithResult(_0x3918cb,null))['catch'](handleError(_0x3918cb,null));}; \ No newline at end of file +var _0x727a=['stack','name','map','IntegrationReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','show','length','includeAll','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','error'];(function(_0x382219,_0x42b9e7){var _0x291eba=function(_0x225760){while(--_0x225760){_0x382219['push'](_0x382219['shift']());}};_0x291eba(++_0x42b9e7);}(_0x727a,0xfe));var _0xa727=function(_0x1190c2,_0x2c078b){_0x1190c2=_0x1190c2-0x0;var _0x6ec988=_0x727a[_0x1190c2];return _0x6ec988;};'use strict';var emlformat=require(_0xa727('0x0'));var rimraf=require(_0xa727('0x1'));var zipdir=require(_0xa727('0x2'));var jsonpatch=require(_0xa727('0x3'));var rp=require(_0xa727('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa727('0x5'));var util=require(_0xa727('0x6'));var path=require(_0xa727('0x7'));var sox=require(_0xa727('0x8'));var csv=require(_0xa727('0x9'));var ejs=require(_0xa727('0xa'));var fs=require('fs');var fs_extra=require(_0xa727('0xb'));var _=require(_0xa727('0xc'));var squel=require(_0xa727('0xd'));var crypto=require(_0xa727('0xe'));var jsforce=require(_0xa727('0xf'));var deskjs=require(_0xa727('0x10'));var toCsv=require(_0xa727('0x9'));var querystring=require(_0xa727('0x11'));var Papa=require(_0xa727('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa727('0x13'));var as=require(_0xa727('0x14'));var hardwareService=require(_0xa727('0x15'));var logger=require(_0xa727('0x16'))('api');var utils=require(_0xa727('0x17'));var config=require(_0xa727('0x18'));var licenseUtil=require(_0xa727('0x19'));var db=require(_0xa727('0x1a'))['db'];function respondWithStatusCode(_0x1d9df9,_0x468d44){_0x468d44=_0x468d44||0xcc;return function(_0x39942f){if(_0x39942f){return _0x1d9df9[_0xa727('0x1b')](_0x468d44);}return _0x1d9df9[_0xa727('0x1c')](_0x468d44)['end']();};}function respondWithResult(_0x9b3b3f,_0x2a1f0b){_0x2a1f0b=_0x2a1f0b||0xc8;return function(_0x807379){if(_0x807379){return _0x9b3b3f[_0xa727('0x1c')](_0x2a1f0b)[_0xa727('0x1d')](_0x807379);}};}function respondWithFilteredResult(_0x5200d7,_0xf15738){return function(_0x236c53){if(_0x236c53){var _0x511c7a=typeof _0xf15738[_0xa727('0x1e')]===_0xa727('0x1f')&&typeof _0xf15738[_0xa727('0x20')]===_0xa727('0x1f');var _0x5bc682=_0x236c53['count'];var _0x11230a=_0x511c7a?0x0:_0xf15738['offset'];var _0x3b46a8=_0x511c7a?_0x236c53[_0xa727('0x21')]:_0xf15738['offset']+_0xf15738[_0xa727('0x20')];var _0x41ac9b;if(_0x3b46a8>=_0x5bc682){_0x3b46a8=_0x5bc682;_0x41ac9b=0xc8;}else{_0x41ac9b=0xce;}_0x5200d7[_0xa727('0x1c')](_0x41ac9b);return _0x5200d7[_0xa727('0x22')]('Content-Range',_0x11230a+'-'+_0x3b46a8+'/'+_0x5bc682)[_0xa727('0x1d')](_0x236c53);}return null;};}function patchUpdates(_0x2b41d2){return function(_0x1b941e){try{jsonpatch[_0xa727('0x23')](_0x1b941e,_0x2b41d2,!![]);}catch(_0x333c0e){return BPromise['reject'](_0x333c0e);}return _0x1b941e[_0xa727('0x24')]();};}function saveUpdates(_0x27ed6f,_0x388344){return function(_0x9a32d2){if(_0x9a32d2){return _0x9a32d2[_0xa727('0x25')](_0x27ed6f)[_0xa727('0x26')](function(_0x4ba6ed){return _0x4ba6ed;});}return null;};}function removeEntity(_0x58f90d,_0x46d522){return function(_0x1d384b){if(_0x1d384b){return _0x1d384b[_0xa727('0x27')]()[_0xa727('0x26')](function(){_0x58f90d[_0xa727('0x1c')](0xcc)[_0xa727('0x28')]();});}};}function handleEntityNotFound(_0x4875ea,_0x205414){return function(_0x3c4702){if(!_0x3c4702){_0x4875ea[_0xa727('0x1b')](0x194);}return _0x3c4702;};}function handleError(_0x45e117,_0x8cc2a1){_0x8cc2a1=_0x8cc2a1||0x1f4;return function(_0x1194cc){logger[_0xa727('0x29')](_0x1194cc[_0xa727('0x2a')]);if(_0x1194cc[_0xa727('0x2b')]){delete _0x1194cc['name'];}_0x45e117[_0xa727('0x1c')](_0x8cc2a1)['send'](_0x1194cc);};}exports['index']=function(_0x3e7eb1,_0x5cc67d){var _0x12e15e={},_0x5d4bf8={},_0x37b650={'count':0x0,'rows':[]};var _0x1c46b8=_[_0xa727('0x2c')](db[_0xa727('0x2d')][_0xa727('0x2e')],function(_0x1f1b23){return{'name':_0x1f1b23['fieldName'],'type':_0x1f1b23[_0xa727('0x2f')]['key']};});_0x5d4bf8[_0xa727('0x30')]=_[_0xa727('0x2c')](_0x1c46b8,_0xa727('0x2b'));_0x5d4bf8[_0xa727('0x31')]=_[_0xa727('0x32')](_0x3e7eb1[_0xa727('0x31')]);_0x5d4bf8[_0xa727('0x33')]=_['intersection'](_0x5d4bf8[_0xa727('0x30')],_0x5d4bf8['query']);_0x12e15e['attributes']=_[_0xa727('0x34')](_0x5d4bf8[_0xa727('0x30')],qs[_0xa727('0x35')](_0x3e7eb1[_0xa727('0x31')][_0xa727('0x35')]));_0x12e15e[_0xa727('0x36')]=_0x12e15e[_0xa727('0x36')]['length']?_0x12e15e['attributes']:_0x5d4bf8[_0xa727('0x30')];if(!_0x3e7eb1[_0xa727('0x31')]['hasOwnProperty'](_0xa727('0x37'))){_0x12e15e[_0xa727('0x20')]=qs[_0xa727('0x20')](_0x3e7eb1[_0xa727('0x31')][_0xa727('0x20')]);_0x12e15e[_0xa727('0x1e')]=qs[_0xa727('0x1e')](_0x3e7eb1['query'][_0xa727('0x1e')]);}_0x12e15e[_0xa727('0x38')]=qs['sort'](_0x3e7eb1[_0xa727('0x31')][_0xa727('0x39')]);_0x12e15e['where']=qs['filters'](_['pick'](_0x3e7eb1[_0xa727('0x31')],_0x5d4bf8[_0xa727('0x33')]),_0x1c46b8);if(_0x3e7eb1[_0xa727('0x31')][_0xa727('0x3a')]){_0x12e15e[_0xa727('0x3b')]=_['merge'](_0x12e15e[_0xa727('0x3b')],{'$or':_[_0xa727('0x2c')](_0x1c46b8,function(_0x4c1b95){if(_0x4c1b95[_0xa727('0x2f')]!==_0xa727('0x3c')){var _0x36495a={};_0x36495a[_0x4c1b95[_0xa727('0x2b')]]={'$like':'%'+_0x3e7eb1[_0xa727('0x31')][_0xa727('0x3a')]+'%'};return _0x36495a;}})});}_0x12e15e=_[_0xa727('0x3d')]({},_0x12e15e,_0x3e7eb1[_0xa727('0x3e')]);var _0x5a3022={'where':_0x12e15e[_0xa727('0x3b')]};return db['IntegrationReport'][_0xa727('0x21')](_0x5a3022)['then'](function(_0x36bc15){_0x37b650[_0xa727('0x21')]=_0x36bc15;if(_0x3e7eb1[_0xa727('0x31')]['includeAll']){_0x12e15e[_0xa727('0x3f')]=[{'all':!![]}];}return db[_0xa727('0x2d')][_0xa727('0x40')](_0x12e15e);})[_0xa727('0x26')](function(_0x355b45){_0x37b650['rows']=_0x355b45;return _0x37b650;})[_0xa727('0x26')](respondWithFilteredResult(_0x5cc67d,_0x12e15e))['catch'](handleError(_0x5cc67d,null));};exports[_0xa727('0x41')]=function(_0xd1b9a6,_0x313db0){var _0x2be648={'raw':![],'where':{'id':_0xd1b9a6['params']['id']}},_0x1c9011={};_0x1c9011[_0xa727('0x30')]=_[_0xa727('0x32')](db['IntegrationReport'][_0xa727('0x2e')]);_0x1c9011[_0xa727('0x31')]=_[_0xa727('0x32')](_0xd1b9a6['query']);_0x1c9011[_0xa727('0x33')]=_['intersection'](_0x1c9011['model'],_0x1c9011[_0xa727('0x31')]);_0x2be648[_0xa727('0x36')]=_[_0xa727('0x34')](_0x1c9011[_0xa727('0x30')],qs[_0xa727('0x35')](_0xd1b9a6[_0xa727('0x31')][_0xa727('0x35')]));_0x2be648[_0xa727('0x36')]=_0x2be648[_0xa727('0x36')][_0xa727('0x42')]?_0x2be648[_0xa727('0x36')]:_0x1c9011[_0xa727('0x30')];if(_0xd1b9a6[_0xa727('0x31')][_0xa727('0x43')]){_0x2be648[_0xa727('0x3f')]=[{'all':!![]}];}_0x2be648=_[_0xa727('0x3d')]({},_0x2be648,_0xd1b9a6[_0xa727('0x3e')]);return db['IntegrationReport'][_0xa727('0x44')](_0x2be648)[_0xa727('0x26')](handleEntityNotFound(_0x313db0,null))[_0xa727('0x26')](respondWithResult(_0x313db0,null))['catch'](handleError(_0x313db0,null));};exports[_0xa727('0x45')]=function(_0x3a958a,_0x2e86b4){return db[_0xa727('0x2d')][_0xa727('0x45')](_0x3a958a['body'],{})[_0xa727('0x26')](respondWithResult(_0x2e86b4,0xc9))[_0xa727('0x46')](handleError(_0x2e86b4,null));};exports[_0xa727('0x25')]=function(_0x4d44d2,_0x469c4d){if(_0x4d44d2[_0xa727('0x47')]['id']){delete _0x4d44d2[_0xa727('0x47')]['id'];}return db['IntegrationReport'][_0xa727('0x44')]({'where':{'id':_0x4d44d2['params']['id']}})[_0xa727('0x26')](handleEntityNotFound(_0x469c4d,null))[_0xa727('0x26')](saveUpdates(_0x4d44d2[_0xa727('0x47')],null))['then'](respondWithResult(_0x469c4d,null))[_0xa727('0x46')](handleError(_0x469c4d,null));};exports[_0xa727('0x27')]=function(_0x3c876b,_0x3fe956){return db[_0xa727('0x2d')][_0xa727('0x44')]({'where':{'id':_0x3c876b[_0xa727('0x48')]['id']}})[_0xa727('0x26')](handleEntityNotFound(_0x3fe956,null))[_0xa727('0x26')](removeEntity(_0x3fe956,null))[_0xa727('0x46')](handleError(_0x3fe956,null));};exports['describe']=function(_0x32cb26,_0x54fab3){return db['IntegrationReport'][_0xa727('0x49')]()[_0xa727('0x26')](respondWithResult(_0x54fab3,null))[_0xa727('0x46')](handleError(_0x54fab3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9cacbcf..4e51fce 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 _0xb275=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport','report_integration'];(function(_0x3b91ad,_0x4feee7){var _0x36f0cc=function(_0x59dbc4){while(--_0x59dbc4){_0x3b91ad['push'](_0x3b91ad['shift']());}};_0x36f0cc(++_0x4feee7);}(_0xb275,0x142));var _0x5b27=function(_0x143313,_0x42c0f0){_0x143313=_0x143313-0x0;var _0x16c08c=_0xb275[_0x143313];return _0x16c08c;};'use strict';var _=require(_0x5b27('0x0'));var util=require(_0x5b27('0x1'));var logger=require(_0x5b27('0x2'))(_0x5b27('0x3'));var moment=require(_0x5b27('0x4'));var BPromise=require(_0x5b27('0x5'));var rp=require(_0x5b27('0x6'));var fs=require('fs');var path=require(_0x5b27('0x7'));var rimraf=require(_0x5b27('0x8'));var config=require(_0x5b27('0x9'));var attributes=require('./integrationReport.attributes');module[_0x5b27('0xa')]=function(_0x364ed1,_0x5d16a2){return _0x364ed1[_0x5b27('0xb')](_0x5b27('0xc'),attributes,{'tableName':_0x5b27('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb012=['rimraf','../../config/environment','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0xb012,0x17f));var _0x2b01=function(_0x2ef72b,_0x1637ca){_0x2ef72b=_0x2ef72b-0x0;var _0x10f8ac=_0xb012[_0x2ef72b];return _0x10f8ac;};'use strict';var _=require(_0x2b01('0x0'));var util=require(_0x2b01('0x1'));var logger=require(_0x2b01('0x2'))(_0x2b01('0x3'));var moment=require(_0x2b01('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b01('0x5'));var fs=require('fs');var path=require(_0x2b01('0x6'));var rimraf=require(_0x2b01('0x7'));var config=require(_0x2b01('0x8'));var attributes=require('./integrationReport.attributes');module[_0x2b01('0x9')]=function(_0x17c9cf,_0x19e37c){return _0x17c9cf[_0x2b01('0xa')](_0x2b01('0xb'),attributes,{'tableName':_0x2b01('0xc'),'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 e4cd163..21581d8 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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x50aeab,_0x53f3d8){var _0x4a9a0a=function(_0x3bb43e){while(--_0x3bb43e){_0x50aeab['push'](_0x50aeab['shift']());}};_0x4a9a0a(++_0x53f3d8);}(_0x1261,0x144));var _0x1126=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0x1261[_0x5c811c];return _0x5df3af;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x414933,_0x508e49){_0x414933=_0x414933-0x0;var _0x33d114=_0x7a54[_0x414933];return _0x33d114;};'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 37fc44e..c5857f4 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 _0x482d=['show','/:id/sub_intervals','getIntervals','post','isAuthenticated','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x482d,0x16c));var _0xd482=function(_0x31a68f,_0xcab3d6){_0x31a68f=_0x31a68f-0x0;var _0x54efc2=_0x482d[_0x31a68f];return _0x54efc2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd482('0x0'));var timeout=require(_0xd482('0x1'));var express=require(_0xd482('0x2'));var router=express[_0xd482('0x3')]();var fs_extra=require(_0xd482('0x4'));var auth=require(_0xd482('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd482('0x6'));var controller=require(_0xd482('0x7'));router[_0xd482('0x8')]('/',auth['isAuthenticated'](),controller[_0xd482('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd482('0xa')]);router[_0xd482('0x8')](_0xd482('0xb'),auth['isAuthenticated'](),controller[_0xd482('0xc')]);router[_0xd482('0xd')]('/',auth[_0xd482('0xe')](),controller[_0xd482('0xf')]);router[_0xd482('0xd')](_0xd482('0xb'),auth[_0xd482('0xe')](),controller[_0xd482('0x10')]);router['post'](_0xd482('0x11'),auth[_0xd482('0xe')](),controller[_0xd482('0x12')]);router[_0xd482('0x13')]('/:id',auth[_0xd482('0xe')](),controller[_0xd482('0x14')]);router[_0xd482('0x15')]('/:id',auth[_0xd482('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2cd0=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','update','delete','destroy','exports','multer','util'];(function(_0x13c45f,_0x398dc5){var _0x4533e1=function(_0x408dfd){while(--_0x408dfd){_0x13c45f['push'](_0x13c45f['shift']());}};_0x4533e1(++_0x398dc5);}(_0x2cd0,0x8a));var _0x02cd=function(_0xca11fe,_0x33eb73){_0xca11fe=_0xca11fe-0x0;var _0x55bcd0=_0x2cd0[_0xca11fe];return _0x55bcd0;};'use strict';var multer=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02cd('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x02cd('0x3'));var interaction=require(_0x02cd('0x4'));var config=require(_0x02cd('0x5'));var controller=require(_0x02cd('0x6'));router[_0x02cd('0x7')]('/',auth[_0x02cd('0x8')](),controller[_0x02cd('0x9')]);router[_0x02cd('0x7')](_0x02cd('0xa'),auth[_0x02cd('0x8')](),controller['show']);router[_0x02cd('0x7')](_0x02cd('0xb'),auth[_0x02cd('0x8')](),controller[_0x02cd('0xc')]);router[_0x02cd('0xd')]('/',auth[_0x02cd('0x8')](),controller[_0x02cd('0xe')]);router[_0x02cd('0xd')](_0x02cd('0xb'),auth[_0x02cd('0x8')](),controller['addInterval']);router['post'](_0x02cd('0xf'),auth[_0x02cd('0x8')](),controller['addIntervals']);router['put'](_0x02cd('0xa'),auth['isAuthenticated'](),controller[_0x02cd('0x10')]);router[_0x02cd('0x11')](_0x02cd('0xa'),auth[_0x02cd('0x8')](),controller[_0x02cd('0x12')]);module[_0x02cd('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 1c13099..951453f 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 _0xe672=['exports','STRING'];(function(_0x99b901,_0x301891){var _0x4bfa86=function(_0x36a20b){while(--_0x36a20b){_0x99b901['push'](_0x99b901['shift']());}};_0x4bfa86(++_0x301891);}(_0xe672,0x1d0));var _0x2e67=function(_0x4bb3e0,_0x1e1dda){_0x4bb3e0=_0x4bb3e0-0x0;var _0x2ae0f6=_0xe672[_0x4bb3e0];return _0x2ae0f6;};'use strict';var Sequelize=require('sequelize');module[_0x2e67('0x0')]={'name':{'type':Sequelize[_0x2e67('0x1')]},'description':{'type':Sequelize[_0x2e67('0x1')]},'interval':{'type':Sequelize[_0x2e67('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xbbf3=['exports','STRING','sequelize'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xbbf3,0x1d3));var _0x3bbf=function(_0x3f471f,_0x3e2d11){_0x3f471f=_0x3f471f-0x0;var _0x5e167a=_0xbbf3[_0x3f471f];return _0x5e167a;};'use strict';var Sequelize=require(_0x3bbf('0x0'));module[_0x3bbf('0x1')]={'name':{'type':Sequelize[_0x3bbf('0x2')]},'description':{'type':Sequelize[_0x3bbf('0x2')]},'interval':{'type':Sequelize[_0x3bbf('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 a7e8e17..d1b82c2 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 _0x0485=['crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','params','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel'];(function(_0x4164e3,_0x12837c){var _0x5e0596=function(_0x5a6e1c){while(--_0x5a6e1c){_0x4164e3['push'](_0x4164e3['shift']());}};_0x5e0596(++_0x12837c);}(_0x0485,0x1ad));var _0x5048=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x0485[_0x3e531a];return _0x3c2574;};'use strict';var emlformat=require(_0x5048('0x0'));var rimraf=require(_0x5048('0x1'));var zipdir=require(_0x5048('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5048('0x3'));var BPromise=require(_0x5048('0x4'));var Mustache=require(_0x5048('0x5'));var util=require(_0x5048('0x6'));var path=require('path');var sox=require(_0x5048('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5048('0x8'));var _=require(_0x5048('0x9'));var squel=require(_0x5048('0xa'));var crypto=require(_0x5048('0xb'));var jsforce=require(_0x5048('0xc'));var deskjs=require(_0x5048('0xd'));var toCsv=require(_0x5048('0xe'));var querystring=require(_0x5048('0xf'));var Papa=require('papaparse');var Redis=require(_0x5048('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5048('0x11'));var as=require(_0x5048('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5048('0x13'));var utils=require(_0x5048('0x14'));var config=require(_0x5048('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5048('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2ae998,_0x3392bb){_0x3392bb=_0x3392bb||0xcc;return function(_0x448232){if(_0x448232){return _0x2ae998['sendStatus'](_0x3392bb);}return _0x2ae998[_0x5048('0x17')](_0x3392bb)[_0x5048('0x18')]();};}function respondWithResult(_0x3f1354,_0x3e7b27){_0x3e7b27=_0x3e7b27||0xc8;return function(_0x1d5e4d){if(_0x1d5e4d){return _0x3f1354[_0x5048('0x17')](_0x3e7b27)[_0x5048('0x19')](_0x1d5e4d);}};}function respondWithFilteredResult(_0x333a37,_0x45f908){return function(_0x1938ab){if(_0x1938ab){var _0x491a47=typeof _0x45f908[_0x5048('0x1a')]===_0x5048('0x1b')&&typeof _0x45f908[_0x5048('0x1c')]===_0x5048('0x1b');var _0x34ec95=_0x1938ab[_0x5048('0x1d')];var _0x20d560=_0x491a47?0x0:_0x45f908['offset'];var _0x3945ef=_0x491a47?_0x1938ab['count']:_0x45f908['offset']+_0x45f908[_0x5048('0x1c')];var _0x3fe625;if(_0x3945ef>=_0x34ec95){_0x3945ef=_0x34ec95;_0x3fe625=0xc8;}else{_0x3fe625=0xce;}_0x333a37[_0x5048('0x17')](_0x3fe625);return _0x333a37[_0x5048('0x1e')](_0x5048('0x1f'),_0x20d560+'-'+_0x3945ef+'/'+_0x34ec95)['json'](_0x1938ab);}return null;};}function patchUpdates(_0x353bdc){return function(_0x1a12bc){try{jsonpatch[_0x5048('0x20')](_0x1a12bc,_0x353bdc,!![]);}catch(_0x5b8061){return BPromise[_0x5048('0x21')](_0x5b8061);}return _0x1a12bc['save']();};}function saveUpdates(_0x479d60,_0x3215a6){return function(_0x546631){if(_0x546631){return _0x546631[_0x5048('0x22')](_0x479d60)[_0x5048('0x23')](function(_0x35706e){return _0x35706e;});}return null;};}function removeEntity(_0x4560ba,_0x56a53a){return function(_0x2f0f1d){if(_0x2f0f1d){return _0x2f0f1d[_0x5048('0x24')]()[_0x5048('0x23')](function(){var _0x4b0ee6=_0x2f0f1d[_0x5048('0x25')]({'plain':!![]});var _0x1731f4=_0x5048('0x26');return db[_0x5048('0x27')][_0x5048('0x24')]({'where':{'type':_0x1731f4,'resourceId':_0x4b0ee6['id']}})[_0x5048('0x23')](function(){return _0x2f0f1d;});})['then'](function(){_0x4560ba[_0x5048('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17ad7c,_0x30738f){return function(_0x2b5d5b){if(!_0x2b5d5b){_0x17ad7c[_0x5048('0x28')](0x194);}return _0x2b5d5b;};}function handleError(_0x5845a5,_0x1ac1f0){_0x1ac1f0=_0x1ac1f0||0x1f4;return function(_0x3047af){logger['error'](_0x3047af['stack']);if(_0x3047af[_0x5048('0x29')]){delete _0x3047af[_0x5048('0x29')];}_0x5845a5[_0x5048('0x17')](_0x1ac1f0)['send'](_0x3047af);};}exports[_0x5048('0x2a')]=function(_0xe3c9d4,_0x17b5fe){var _0x1ded41={},_0x1bea7f={},_0x332aeb={'count':0x0,'rows':[]};var _0x492cbd=_[_0x5048('0x2b')](db[_0x5048('0x2c')][_0x5048('0x2d')],function(_0x3ceb6c){return{'name':_0x3ceb6c[_0x5048('0x2e')],'type':_0x3ceb6c[_0x5048('0x2f')][_0x5048('0x30')]};});_0x1bea7f[_0x5048('0x31')]=_[_0x5048('0x2b')](_0x492cbd,_0x5048('0x29'));_0x1bea7f[_0x5048('0x32')]=_['keys'](_0xe3c9d4[_0x5048('0x32')]);_0x1bea7f['filters']=_[_0x5048('0x33')](_0x1bea7f[_0x5048('0x31')],_0x1bea7f[_0x5048('0x32')]);_0x1ded41[_0x5048('0x34')]=_[_0x5048('0x33')](_0x1bea7f[_0x5048('0x31')],qs['fields'](_0xe3c9d4[_0x5048('0x32')][_0x5048('0x35')]));_0x1ded41[_0x5048('0x34')]=_0x1ded41['attributes'][_0x5048('0x36')]?_0x1ded41[_0x5048('0x34')]:_0x1bea7f[_0x5048('0x31')];if(!_0xe3c9d4[_0x5048('0x32')][_0x5048('0x37')](_0x5048('0x38'))){_0x1ded41[_0x5048('0x1c')]=qs['limit'](_0xe3c9d4[_0x5048('0x32')][_0x5048('0x1c')]);_0x1ded41[_0x5048('0x1a')]=qs[_0x5048('0x1a')](_0xe3c9d4['query'][_0x5048('0x1a')]);}_0x1ded41[_0x5048('0x39')]=qs[_0x5048('0x3a')](_0xe3c9d4[_0x5048('0x32')][_0x5048('0x3a')]);_0x1ded41[_0x5048('0x3b')]=qs[_0x5048('0x3c')](_['pick'](_0xe3c9d4[_0x5048('0x32')],_0x1bea7f[_0x5048('0x3c')]),_0x492cbd);if(_0xe3c9d4[_0x5048('0x32')][_0x5048('0x3d')]){_0x1ded41[_0x5048('0x3b')]=_[_0x5048('0x3e')](_0x1ded41[_0x5048('0x3b')],{'$or':_['map'](_0x492cbd,function(_0x80f00b){if(_0x80f00b[_0x5048('0x2f')]!==_0x5048('0x3f')){var _0x3ac735={};_0x3ac735[_0x80f00b[_0x5048('0x29')]]={'$like':'%'+_0xe3c9d4['query']['filter']+'%'};return _0x3ac735;}})});}_0x1ded41=_[_0x5048('0x3e')]({},_0x1ded41,_0xe3c9d4[_0x5048('0x40')]);var _0x2fe692={'where':_0x1ded41[_0x5048('0x3b')]};return db[_0x5048('0x2c')][_0x5048('0x1d')](_0x2fe692)[_0x5048('0x23')](function(_0x29ac70){_0x332aeb[_0x5048('0x1d')]=_0x29ac70;if(_0xe3c9d4['query'][_0x5048('0x41')]){_0x1ded41[_0x5048('0x42')]=[{'all':!![]}];}return db[_0x5048('0x2c')][_0x5048('0x43')](_0x1ded41);})[_0x5048('0x23')](function(_0x293c2e){_0x332aeb[_0x5048('0x44')]=_0x293c2e;return _0x332aeb;})[_0x5048('0x23')](respondWithFilteredResult(_0x17b5fe,_0x1ded41))[_0x5048('0x45')](handleError(_0x17b5fe,null));};exports[_0x5048('0x46')]=function(_0x5ca15d,_0x35e16c){var _0x22450d={'raw':!![],'where':{'id':_0x5ca15d['params']['id']}},_0x364693={};_0x364693[_0x5048('0x31')]=_[_0x5048('0x47')](db[_0x5048('0x2c')]['rawAttributes']);_0x364693['query']=_[_0x5048('0x47')](_0x5ca15d[_0x5048('0x32')]);_0x364693[_0x5048('0x3c')]=_[_0x5048('0x33')](_0x364693[_0x5048('0x31')],_0x364693['query']);_0x22450d[_0x5048('0x34')]=_[_0x5048('0x33')](_0x364693['model'],qs[_0x5048('0x35')](_0x5ca15d[_0x5048('0x32')]['fields']));_0x22450d[_0x5048('0x34')]=_0x22450d['attributes'][_0x5048('0x36')]?_0x22450d[_0x5048('0x34')]:_0x364693['model'];if(_0x5ca15d[_0x5048('0x32')][_0x5048('0x41')]){_0x22450d[_0x5048('0x42')]=[{'all':!![]}];}_0x22450d=_[_0x5048('0x3e')]({},_0x22450d,_0x5ca15d[_0x5048('0x40')]);return db[_0x5048('0x2c')][_0x5048('0x48')](_0x22450d)[_0x5048('0x23')](handleEntityNotFound(_0x35e16c,null))[_0x5048('0x23')](respondWithResult(_0x35e16c,null))[_0x5048('0x45')](handleError(_0x35e16c,null));};exports['create']=function(_0x155885,_0x47ccce){return db[_0x5048('0x2c')][_0x5048('0x49')](_0x155885[_0x5048('0x4a')],{})[_0x5048('0x23')](function(_0x2ebeea){var _0x4b12fc=_0x155885['user'][_0x5048('0x25')]({'plain':!![]});if(!_0x4b12fc)throw new Error(_0x5048('0x4b'));if(_0x4b12fc['role']===_0x5048('0x4c')){var _0x8e12a=_0x2ebeea[_0x5048('0x25')]({'plain':!![]});var _0x2d8388=_0x5048('0x26');return db['UserProfileSection'][_0x5048('0x48')]({'where':{'name':_0x2d8388,'userProfileId':_0x4b12fc[_0x5048('0x4d')]},'raw':!![]})['then'](function(_0x3757c3){if(_0x3757c3&&_0x3757c3[_0x5048('0x4e')]===0x0){return db[_0x5048('0x27')][_0x5048('0x49')]({'name':_0x8e12a[_0x5048('0x29')],'resourceId':_0x8e12a['id'],'type':_0x3757c3[_0x5048('0x29')],'sectionId':_0x3757c3['id']},{})['then'](function(){return _0x2ebeea;});}else{return _0x2ebeea;}})['catch'](function(_0x2c0fe1){logger[_0x5048('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c0fe1);throw _0x2c0fe1;});}return _0x2ebeea;})[_0x5048('0x23')](respondWithResult(_0x47ccce,0xc9))[_0x5048('0x45')](handleError(_0x47ccce,null));};exports[_0x5048('0x22')]=function(_0x484054,_0x2fc3d4){if(_0x484054[_0x5048('0x4a')]['id']){delete _0x484054[_0x5048('0x4a')]['id'];}return db[_0x5048('0x2c')]['find']({'where':{'id':_0x484054[_0x5048('0x50')]['id']}})[_0x5048('0x23')](handleEntityNotFound(_0x2fc3d4,null))[_0x5048('0x23')](saveUpdates(_0x484054[_0x5048('0x4a')],null))['then'](respondWithResult(_0x2fc3d4,null))[_0x5048('0x45')](handleError(_0x2fc3d4,null));};exports[_0x5048('0x24')]=function(_0x379487,_0x197312){return db['Interval'][_0x5048('0x48')]({'where':{'id':_0x379487['params']['id']}})[_0x5048('0x23')](handleEntityNotFound(_0x197312,null))[_0x5048('0x23')](removeEntity(_0x197312,null))[_0x5048('0x45')](handleError(_0x197312,null));};exports['addInterval']=function(_0x407475,_0x26edd4,_0x1ccce4){if(_0x407475[_0x5048('0x4a')]['id']){delete _0x407475['body']['id'];}return db['Interval'][_0x5048('0x48')]({'where':{'id':_0x407475[_0x5048('0x50')]['id']}})[_0x5048('0x23')](handleEntityNotFound(_0x26edd4,null))['then'](function(_0x57a8a5){if(_0x57a8a5){_0x407475['body'][_0x5048('0x51')]=_0x57a8a5['id'];return db[_0x5048('0x2c')][_0x5048('0x49')](_0x407475[_0x5048('0x4a')]);}})['then'](respondWithResult(_0x26edd4,null))[_0x5048('0x45')](handleError(_0x26edd4,null));};exports[_0x5048('0x52')]=function(_0x26f27b,_0x382cf2,_0x50da4f){var _0x5d2c06={};var _0x531660={};var _0x3b6f35;var _0x150837;return db[_0x5048('0x2c')][_0x5048('0x53')]({'where':{'id':_0x26f27b[_0x5048('0x50')]['id']}})[_0x5048('0x23')](handleEntityNotFound(_0x382cf2,null))[_0x5048('0x23')](function(_0x340f1d){if(_0x340f1d){_0x3b6f35=_0x340f1d;_0x531660[_0x5048('0x31')]=_['keys'](db[_0x5048('0x2c')][_0x5048('0x2d')]);_0x531660[_0x5048('0x32')]=_[_0x5048('0x47')](_0x26f27b['query']);_0x531660[_0x5048('0x3c')]=_[_0x5048('0x33')](_0x531660[_0x5048('0x31')],_0x531660['query']);_0x5d2c06[_0x5048('0x34')]=_[_0x5048('0x33')](_0x531660['model'],qs[_0x5048('0x35')](_0x26f27b[_0x5048('0x32')]['fields']));_0x5d2c06[_0x5048('0x34')]=_0x5d2c06[_0x5048('0x34')][_0x5048('0x36')]?_0x5d2c06['attributes']:_0x531660[_0x5048('0x31')];_0x5d2c06[_0x5048('0x39')]=qs[_0x5048('0x3a')](_0x26f27b[_0x5048('0x32')][_0x5048('0x3a')]);_0x5d2c06[_0x5048('0x3b')]=qs[_0x5048('0x3c')](_[_0x5048('0x54')](_0x26f27b['query'],_0x531660[_0x5048('0x3c')]));if(_0x26f27b[_0x5048('0x32')][_0x5048('0x3d')]){_0x5d2c06[_0x5048('0x3b')]=_['merge'](_0x5d2c06['where'],{'$or':_['map'](_0x5d2c06[_0x5048('0x34')],function(_0x4d83c5){var _0x5f1343={};_0x5f1343[_0x4d83c5]={'$like':'%'+_0x26f27b[_0x5048('0x32')]['filter']+'%'};return _0x5f1343;})});}_0x5d2c06=_['merge']({},_0x5d2c06,_0x26f27b[_0x5048('0x40')]);return _0x3b6f35[_0x5048('0x52')](_0x5d2c06);}})[_0x5048('0x23')](function(_0x512510){if(_0x512510){_0x150837=_0x512510[_0x5048('0x36')];if(!_0x26f27b[_0x5048('0x32')]['hasOwnProperty'](_0x5048('0x38'))){_0x5d2c06['limit']=qs['limit'](_0x26f27b[_0x5048('0x32')][_0x5048('0x1c')]);_0x5d2c06[_0x5048('0x1a')]=qs[_0x5048('0x1a')](_0x26f27b[_0x5048('0x32')][_0x5048('0x1a')]);}return _0x3b6f35['getIntervals'](_0x5d2c06);}})['then'](function(_0x26997f){if(_0x26997f){return _0x26997f?{'count':_0x150837,'rows':_0x26997f}:null;}})['then'](respondWithResult(_0x382cf2,null))[_0x5048('0x45')](handleError(_0x382cf2,null));};exports[_0x5048('0x55')]=function(_0x5916a7,_0x27ff9c,_0x43f42e){return db[_0x5048('0x2c')]['findOne']({'where':{'id':_0x5916a7[_0x5048('0x50')]['id']}})['then'](handleEntityNotFound(_0x27ff9c,null))[_0x5048('0x23')](function(_0x329794){if(_0x329794){return db[_0x5048('0x56')][_0x5048('0x57')](function(_0x5a1f65){return db[_0x5048('0x2c')][_0x5048('0x24')]({'where':{'IntervalId':_0x5916a7[_0x5048('0x50')]['id']},'transaction':_0x5a1f65})['then'](function(_0x51db11){var _0x48d834=_['map'](_0x5916a7[_0x5048('0x4a')],function(_0x331fec){delete _0x331fec['id'];_0x331fec[_0x5048('0x51')]=_0x5916a7['params']['id'];return _0x331fec;});return db[_0x5048('0x2c')]['bulkCreate'](_0x48d834,{'transaction':_0x5a1f65});});})[_0x5048('0x23')](function(){return db[_0x5048('0x2c')][_0x5048('0x43')]({'where':{'IntervalId':_0x5916a7[_0x5048('0x50')]['id']}});});}})[_0x5048('0x23')](respondWithResult(_0x27ff9c,null))[_0x5048('0x45')](handleError(_0x27ff9c,null));}; \ No newline at end of file +var _0xcc8b=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','stack','name','send','index','map','Interval','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','length','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json'];(function(_0x510660,_0x117f9b){var _0x4f7923=function(_0x188921){while(--_0x188921){_0x510660['push'](_0x510660['shift']());}};_0x4f7923(++_0x117f9b);}(_0xcc8b,0x9c));var _0xbcc8=function(_0xab2e6a,_0x23670e){_0xab2e6a=_0xab2e6a-0x0;var _0x2582e7=_0xcc8b[_0xab2e6a];return _0x2582e7;};'use strict';var emlformat=require(_0xbcc8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcc8('0x1'));var jsonpatch=require(_0xbcc8('0x2'));var rp=require(_0xbcc8('0x3'));var moment=require(_0xbcc8('0x4'));var BPromise=require(_0xbcc8('0x5'));var Mustache=require(_0xbcc8('0x6'));var util=require(_0xbcc8('0x7'));var path=require(_0xbcc8('0x8'));var sox=require(_0xbcc8('0x9'));var csv=require(_0xbcc8('0xa'));var ejs=require(_0xbcc8('0xb'));var fs=require('fs');var fs_extra=require(_0xbcc8('0xc'));var _=require(_0xbcc8('0xd'));var squel=require(_0xbcc8('0xe'));var crypto=require(_0xbcc8('0xf'));var jsforce=require(_0xbcc8('0x10'));var deskjs=require(_0xbcc8('0x11'));var toCsv=require('to-csv');var querystring=require(_0xbcc8('0x12'));var Papa=require('papaparse');var Redis=require(_0xbcc8('0x13'));var authService=require(_0xbcc8('0x14'));var qs=require(_0xbcc8('0x15'));var as=require(_0xbcc8('0x16'));var hardwareService=require(_0xbcc8('0x17'));var logger=require('../../config/logger')(_0xbcc8('0x18'));var utils=require(_0xbcc8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbcc8('0x1a'));var db=require(_0xbcc8('0x1b'))['db'];var extensions=require(_0xbcc8('0x1c'));function respondWithStatusCode(_0x4f5e35,_0xc1a2f3){_0xc1a2f3=_0xc1a2f3||0xcc;return function(_0x454b16){if(_0x454b16){return _0x4f5e35[_0xbcc8('0x1d')](_0xc1a2f3);}return _0x4f5e35['status'](_0xc1a2f3)['end']();};}function respondWithResult(_0x234fce,_0x4e825e){_0x4e825e=_0x4e825e||0xc8;return function(_0x33e322){if(_0x33e322){return _0x234fce[_0xbcc8('0x1e')](_0x4e825e)[_0xbcc8('0x1f')](_0x33e322);}};}function respondWithFilteredResult(_0x537bf6,_0x4a48c1){return function(_0x301131){if(_0x301131){var _0x25cc10=typeof _0x4a48c1[_0xbcc8('0x20')]===_0xbcc8('0x21')&&typeof _0x4a48c1['limit']===_0xbcc8('0x21');var _0x1206bf=_0x301131['count'];var _0xb940bf=_0x25cc10?0x0:_0x4a48c1['offset'];var _0x386666=_0x25cc10?_0x301131[_0xbcc8('0x22')]:_0x4a48c1[_0xbcc8('0x20')]+_0x4a48c1['limit'];var _0x1c1bbd;if(_0x386666>=_0x1206bf){_0x386666=_0x1206bf;_0x1c1bbd=0xc8;}else{_0x1c1bbd=0xce;}_0x537bf6[_0xbcc8('0x1e')](_0x1c1bbd);return _0x537bf6[_0xbcc8('0x23')](_0xbcc8('0x24'),_0xb940bf+'-'+_0x386666+'/'+_0x1206bf)[_0xbcc8('0x1f')](_0x301131);}return null;};}function patchUpdates(_0x4630ed){return function(_0x747564){try{jsonpatch[_0xbcc8('0x25')](_0x747564,_0x4630ed,!![]);}catch(_0x495568){return BPromise[_0xbcc8('0x26')](_0x495568);}return _0x747564[_0xbcc8('0x27')]();};}function saveUpdates(_0x12a6dd,_0x3a6dcf){return function(_0x4c134e){if(_0x4c134e){return _0x4c134e[_0xbcc8('0x28')](_0x12a6dd)[_0xbcc8('0x29')](function(_0x24c3ca){return _0x24c3ca;});}return null;};}function removeEntity(_0x47e869,_0x3f96b2){return function(_0x518c86){if(_0x518c86){return _0x518c86[_0xbcc8('0x2a')]()[_0xbcc8('0x29')](function(){var _0x170a9b=_0x518c86[_0xbcc8('0x2b')]({'plain':!![]});var _0x4cfc93=_0xbcc8('0x2c');return db[_0xbcc8('0x2d')][_0xbcc8('0x2a')]({'where':{'type':_0x4cfc93,'resourceId':_0x170a9b['id']}})[_0xbcc8('0x29')](function(){return _0x518c86;});})[_0xbcc8('0x29')](function(){_0x47e869[_0xbcc8('0x1e')](0xcc)[_0xbcc8('0x2e')]();});}};}function handleEntityNotFound(_0x37185c,_0x1b869e){return function(_0x4b87a2){if(!_0x4b87a2){_0x37185c['sendStatus'](0x194);}return _0x4b87a2;};}function handleError(_0x4175f6,_0x593150){_0x593150=_0x593150||0x1f4;return function(_0x143a3c){logger['error'](_0x143a3c[_0xbcc8('0x2f')]);if(_0x143a3c[_0xbcc8('0x30')]){delete _0x143a3c[_0xbcc8('0x30')];}_0x4175f6[_0xbcc8('0x1e')](_0x593150)[_0xbcc8('0x31')](_0x143a3c);};}exports[_0xbcc8('0x32')]=function(_0x303d7a,_0x3ee763){var _0x5b7320={},_0x2c02c5={},_0x275247={'count':0x0,'rows':[]};var _0x880b67=_[_0xbcc8('0x33')](db[_0xbcc8('0x34')][_0xbcc8('0x35')],function(_0x369fc4){return{'name':_0x369fc4['fieldName'],'type':_0x369fc4['type'][_0xbcc8('0x36')]};});_0x2c02c5[_0xbcc8('0x37')]=_[_0xbcc8('0x33')](_0x880b67,_0xbcc8('0x30'));_0x2c02c5[_0xbcc8('0x38')]=_[_0xbcc8('0x39')](_0x303d7a['query']);_0x2c02c5[_0xbcc8('0x3a')]=_[_0xbcc8('0x3b')](_0x2c02c5[_0xbcc8('0x37')],_0x2c02c5[_0xbcc8('0x38')]);_0x5b7320[_0xbcc8('0x3c')]=_[_0xbcc8('0x3b')](_0x2c02c5[_0xbcc8('0x37')],qs['fields'](_0x303d7a['query'][_0xbcc8('0x3d')]));_0x5b7320[_0xbcc8('0x3c')]=_0x5b7320[_0xbcc8('0x3c')]['length']?_0x5b7320['attributes']:_0x2c02c5[_0xbcc8('0x37')];if(!_0x303d7a['query'][_0xbcc8('0x3e')](_0xbcc8('0x3f'))){_0x5b7320[_0xbcc8('0x40')]=qs[_0xbcc8('0x40')](_0x303d7a[_0xbcc8('0x38')][_0xbcc8('0x40')]);_0x5b7320[_0xbcc8('0x20')]=qs[_0xbcc8('0x20')](_0x303d7a['query'][_0xbcc8('0x20')]);}_0x5b7320[_0xbcc8('0x41')]=qs['sort'](_0x303d7a[_0xbcc8('0x38')][_0xbcc8('0x42')]);_0x5b7320[_0xbcc8('0x43')]=qs[_0xbcc8('0x3a')](_['pick'](_0x303d7a[_0xbcc8('0x38')],_0x2c02c5[_0xbcc8('0x3a')]),_0x880b67);if(_0x303d7a[_0xbcc8('0x38')][_0xbcc8('0x44')]){_0x5b7320[_0xbcc8('0x43')]=_[_0xbcc8('0x45')](_0x5b7320[_0xbcc8('0x43')],{'$or':_[_0xbcc8('0x33')](_0x880b67,function(_0x2c614b){if(_0x2c614b['type']!=='VIRTUAL'){var _0x414d22={};_0x414d22[_0x2c614b[_0xbcc8('0x30')]]={'$like':'%'+_0x303d7a[_0xbcc8('0x38')][_0xbcc8('0x44')]+'%'};return _0x414d22;}})});}_0x5b7320=_['merge']({},_0x5b7320,_0x303d7a[_0xbcc8('0x46')]);var _0x4ad6e3={'where':_0x5b7320[_0xbcc8('0x43')]};return db[_0xbcc8('0x34')][_0xbcc8('0x22')](_0x4ad6e3)[_0xbcc8('0x29')](function(_0x1cd2e9){_0x275247['count']=_0x1cd2e9;if(_0x303d7a['query'][_0xbcc8('0x47')]){_0x5b7320[_0xbcc8('0x48')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x5b7320);})[_0xbcc8('0x29')](function(_0x20e783){_0x275247[_0xbcc8('0x49')]=_0x20e783;return _0x275247;})[_0xbcc8('0x29')](respondWithFilteredResult(_0x3ee763,_0x5b7320))['catch'](handleError(_0x3ee763,null));};exports[_0xbcc8('0x4a')]=function(_0x2722c7,_0x3eebd2){var _0x38e4a5={'raw':!![],'where':{'id':_0x2722c7[_0xbcc8('0x4b')]['id']}},_0x19b276={};_0x19b276['model']=_[_0xbcc8('0x39')](db[_0xbcc8('0x34')]['rawAttributes']);_0x19b276[_0xbcc8('0x38')]=_['keys'](_0x2722c7[_0xbcc8('0x38')]);_0x19b276[_0xbcc8('0x3a')]=_[_0xbcc8('0x3b')](_0x19b276[_0xbcc8('0x37')],_0x19b276[_0xbcc8('0x38')]);_0x38e4a5[_0xbcc8('0x3c')]=_['intersection'](_0x19b276[_0xbcc8('0x37')],qs[_0xbcc8('0x3d')](_0x2722c7[_0xbcc8('0x38')][_0xbcc8('0x3d')]));_0x38e4a5[_0xbcc8('0x3c')]=_0x38e4a5[_0xbcc8('0x3c')][_0xbcc8('0x4c')]?_0x38e4a5[_0xbcc8('0x3c')]:_0x19b276['model'];if(_0x2722c7[_0xbcc8('0x38')][_0xbcc8('0x47')]){_0x38e4a5[_0xbcc8('0x48')]=[{'all':!![]}];}_0x38e4a5=_['merge']({},_0x38e4a5,_0x2722c7[_0xbcc8('0x46')]);return db['Interval'][_0xbcc8('0x4d')](_0x38e4a5)[_0xbcc8('0x29')](handleEntityNotFound(_0x3eebd2,null))['then'](respondWithResult(_0x3eebd2,null))['catch'](handleError(_0x3eebd2,null));};exports[_0xbcc8('0x4e')]=function(_0x5ee194,_0x33e4b7){return db[_0xbcc8('0x34')][_0xbcc8('0x4e')](_0x5ee194[_0xbcc8('0x4f')],{})[_0xbcc8('0x29')](function(_0x200aeb){var _0x8fc962=_0x5ee194[_0xbcc8('0x50')][_0xbcc8('0x2b')]({'plain':!![]});if(!_0x8fc962)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8fc962[_0xbcc8('0x51')]===_0xbcc8('0x50')){var _0x415f88=_0x200aeb['get']({'plain':!![]});var _0x32c36c='Intervals';return db[_0xbcc8('0x52')][_0xbcc8('0x4d')]({'where':{'name':_0x32c36c,'userProfileId':_0x8fc962['userProfileId']},'raw':!![]})['then'](function(_0x14a158){if(_0x14a158&&_0x14a158[_0xbcc8('0x53')]===0x0){return db[_0xbcc8('0x2d')][_0xbcc8('0x4e')]({'name':_0x415f88['name'],'resourceId':_0x415f88['id'],'type':_0x14a158[_0xbcc8('0x30')],'sectionId':_0x14a158['id']},{})[_0xbcc8('0x29')](function(){return _0x200aeb;});}else{return _0x200aeb;}})['catch'](function(_0x5d05e8){logger['error'](_0xbcc8('0x54'),_0x5d05e8);throw _0x5d05e8;});}return _0x200aeb;})['then'](respondWithResult(_0x33e4b7,0xc9))['catch'](handleError(_0x33e4b7,null));};exports[_0xbcc8('0x28')]=function(_0x179c46,_0x2f3e19){if(_0x179c46['body']['id']){delete _0x179c46[_0xbcc8('0x4f')]['id'];}return db[_0xbcc8('0x34')][_0xbcc8('0x4d')]({'where':{'id':_0x179c46[_0xbcc8('0x4b')]['id']}})[_0xbcc8('0x29')](handleEntityNotFound(_0x2f3e19,null))[_0xbcc8('0x29')](saveUpdates(_0x179c46[_0xbcc8('0x4f')],null))[_0xbcc8('0x29')](respondWithResult(_0x2f3e19,null))[_0xbcc8('0x55')](handleError(_0x2f3e19,null));};exports[_0xbcc8('0x2a')]=function(_0x5c715d,_0x21644f){return db['Interval'][_0xbcc8('0x4d')]({'where':{'id':_0x5c715d['params']['id']}})['then'](handleEntityNotFound(_0x21644f,null))[_0xbcc8('0x29')](removeEntity(_0x21644f,null))[_0xbcc8('0x55')](handleError(_0x21644f,null));};exports[_0xbcc8('0x56')]=function(_0x2812de,_0x345dfb,_0x5c9dff){if(_0x2812de[_0xbcc8('0x4f')]['id']){delete _0x2812de[_0xbcc8('0x4f')]['id'];}return db['Interval']['find']({'where':{'id':_0x2812de['params']['id']}})[_0xbcc8('0x29')](handleEntityNotFound(_0x345dfb,null))[_0xbcc8('0x29')](function(_0x3412c4){if(_0x3412c4){_0x2812de[_0xbcc8('0x4f')][_0xbcc8('0x57')]=_0x3412c4['id'];return db[_0xbcc8('0x34')][_0xbcc8('0x4e')](_0x2812de[_0xbcc8('0x4f')]);}})[_0xbcc8('0x29')](respondWithResult(_0x345dfb,null))['catch'](handleError(_0x345dfb,null));};exports[_0xbcc8('0x58')]=function(_0x2672f2,_0x359919,_0x3a19aa){var _0x2ae7f3={};var _0x5cc58d={};var _0x13637d;var _0x151e5f;return db[_0xbcc8('0x34')][_0xbcc8('0x59')]({'where':{'id':_0x2672f2[_0xbcc8('0x4b')]['id']}})[_0xbcc8('0x29')](handleEntityNotFound(_0x359919,null))['then'](function(_0x3deb4a){if(_0x3deb4a){_0x13637d=_0x3deb4a;_0x5cc58d[_0xbcc8('0x37')]=_['keys'](db[_0xbcc8('0x34')][_0xbcc8('0x35')]);_0x5cc58d['query']=_[_0xbcc8('0x39')](_0x2672f2[_0xbcc8('0x38')]);_0x5cc58d[_0xbcc8('0x3a')]=_[_0xbcc8('0x3b')](_0x5cc58d[_0xbcc8('0x37')],_0x5cc58d[_0xbcc8('0x38')]);_0x2ae7f3['attributes']=_[_0xbcc8('0x3b')](_0x5cc58d[_0xbcc8('0x37')],qs[_0xbcc8('0x3d')](_0x2672f2[_0xbcc8('0x38')][_0xbcc8('0x3d')]));_0x2ae7f3[_0xbcc8('0x3c')]=_0x2ae7f3[_0xbcc8('0x3c')][_0xbcc8('0x4c')]?_0x2ae7f3[_0xbcc8('0x3c')]:_0x5cc58d[_0xbcc8('0x37')];_0x2ae7f3[_0xbcc8('0x41')]=qs[_0xbcc8('0x42')](_0x2672f2[_0xbcc8('0x38')][_0xbcc8('0x42')]);_0x2ae7f3[_0xbcc8('0x43')]=qs['filters'](_['pick'](_0x2672f2[_0xbcc8('0x38')],_0x5cc58d[_0xbcc8('0x3a')]));if(_0x2672f2[_0xbcc8('0x38')][_0xbcc8('0x44')]){_0x2ae7f3['where']=_[_0xbcc8('0x45')](_0x2ae7f3[_0xbcc8('0x43')],{'$or':_[_0xbcc8('0x33')](_0x2ae7f3['attributes'],function(_0x25e34b){var _0x48256b={};_0x48256b[_0x25e34b]={'$like':'%'+_0x2672f2[_0xbcc8('0x38')][_0xbcc8('0x44')]+'%'};return _0x48256b;})});}_0x2ae7f3=_['merge']({},_0x2ae7f3,_0x2672f2[_0xbcc8('0x46')]);return _0x13637d[_0xbcc8('0x58')](_0x2ae7f3);}})[_0xbcc8('0x29')](function(_0x168722){if(_0x168722){_0x151e5f=_0x168722['length'];if(!_0x2672f2[_0xbcc8('0x38')][_0xbcc8('0x3e')](_0xbcc8('0x3f'))){_0x2ae7f3[_0xbcc8('0x40')]=qs[_0xbcc8('0x40')](_0x2672f2['query'][_0xbcc8('0x40')]);_0x2ae7f3['offset']=qs[_0xbcc8('0x20')](_0x2672f2['query'][_0xbcc8('0x20')]);}return _0x13637d['getIntervals'](_0x2ae7f3);}})['then'](function(_0x18f62a){if(_0x18f62a){return _0x18f62a?{'count':_0x151e5f,'rows':_0x18f62a}:null;}})[_0xbcc8('0x29')](respondWithResult(_0x359919,null))[_0xbcc8('0x55')](handleError(_0x359919,null));};exports[_0xbcc8('0x5a')]=function(_0x20f08d,_0x2ca5c4,_0x1e6aeb){return db[_0xbcc8('0x34')]['findOne']({'where':{'id':_0x20f08d[_0xbcc8('0x4b')]['id']}})[_0xbcc8('0x29')](handleEntityNotFound(_0x2ca5c4,null))[_0xbcc8('0x29')](function(_0x5687b5){if(_0x5687b5){return db[_0xbcc8('0x5b')]['transaction'](function(_0x518c00){return db[_0xbcc8('0x34')][_0xbcc8('0x2a')]({'where':{'IntervalId':_0x20f08d[_0xbcc8('0x4b')]['id']},'transaction':_0x518c00})[_0xbcc8('0x29')](function(_0x49191a){var _0x543cac=_[_0xbcc8('0x33')](_0x20f08d[_0xbcc8('0x4f')],function(_0x5092d6){delete _0x5092d6['id'];_0x5092d6[_0xbcc8('0x57')]=_0x20f08d[_0xbcc8('0x4b')]['id'];return _0x5092d6;});return db[_0xbcc8('0x34')][_0xbcc8('0x5c')](_0x543cac,{'transaction':_0x518c00});});})[_0xbcc8('0x29')](function(){return db[_0xbcc8('0x34')][_0xbcc8('0x5d')]({'where':{'IntervalId':_0x20f08d[_0xbcc8('0x4b')]['id']}});});}})[_0xbcc8('0x29')](respondWithResult(_0x2ca5c4,null))[_0xbcc8('0x55')](handleError(_0x2ca5c4,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index e070ddf..dad38ea 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 _0x9ebf=['ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','exports','define','tools_intervals','rewrite','string','interval','getIntervals','all','map'];(function(_0x55107e,_0x210c83){var _0x118ef9=function(_0x3f5282){while(--_0x3f5282){_0x55107e['push'](_0x55107e['shift']());}};_0x118ef9(++_0x210c83);}(_0x9ebf,0x195));var _0xf9eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9ebf[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xf9eb('0x0'));var iftime=require(_0xf9eb('0x1'))['iftime'];module[_0xf9eb('0x2')]=function(_0x14a474){return _0x14a474[_0xf9eb('0x3')]('Interval',attributes,{'tableName':_0xf9eb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5db166){extensions[_0xf9eb('0x5')](_0x14a474,_0x5db166);},'afterBulkCreate':function(_0x881931,_0x217583,_0x10e14e){_0x10e14e();extensions['rewrite'](_0x14a474,_0x881931[0x0]);},'afterUpdate':function(_0x3a342a){extensions[_0xf9eb('0x5')](_0x14a474,_0x3a342a);},'afterDestroy':function(_0x285b64){extensions[_0xf9eb('0x5')](_0x14a474,_0x285b64);}},'instanceMethods':{'ifTime':function(_0x547c46=undefined,_0x90f837=new Date()){if(typeof this['interval']===_0xf9eb('0x6')){return iftime(this[_0xf9eb('0x7')],_0x547c46,_0x90f837);}else{return this[_0xf9eb('0x8')]()['then'](function(_0x5872fa){return Promise[_0xf9eb('0x9')](_0x5872fa[_0xf9eb('0xa')](function(_0x59bc74){return _0x59bc74[_0xf9eb('0xb')](_0x547c46,_0x90f837);}));})['then'](function(_0xaf184d){return _0xaf184d[_0xf9eb('0xc')](function(_0x82580b,_0x380538){return _0x82580b||_0x380538;},![]);});}}}});}; \ No newline at end of file +var _0x0a96=['getIntervals','then','all','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','define','Interval','rewrite','interval'];(function(_0x49f907,_0x21a524){var _0x299b40=function(_0x18f7a1){while(--_0x18f7a1){_0x49f907['push'](_0x49f907['shift']());}};_0x299b40(++_0x21a524);}(_0x0a96,0x1b5));var _0x60a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a96[_0x321bb2];return _0x9c12ed;};'use strict';var attributes=require(_0x60a9('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x60a9('0x1'))[_0x60a9('0x2')];module['exports']=function(_0x18f1d5){return _0x18f1d5[_0x60a9('0x3')](_0x60a9('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x40a079){extensions[_0x60a9('0x5')](_0x18f1d5,_0x40a079);},'afterBulkCreate':function(_0xcec383,_0x135a9a,_0x2b4c94){_0x2b4c94();extensions[_0x60a9('0x5')](_0x18f1d5,_0xcec383[0x0]);},'afterUpdate':function(_0x360d9f){extensions[_0x60a9('0x5')](_0x18f1d5,_0x360d9f);},'afterDestroy':function(_0x20b7d8){extensions[_0x60a9('0x5')](_0x18f1d5,_0x20b7d8);}},'instanceMethods':{'ifTime':function(_0x25af57=undefined,_0x176df4=new Date()){if(typeof this[_0x60a9('0x6')]==='string'){return iftime(this[_0x60a9('0x6')],_0x25af57,_0x176df4);}else{return this[_0x60a9('0x7')]()[_0x60a9('0x8')](function(_0x260e99){return Promise[_0x60a9('0x9')](_0x260e99['map'](function(_0x3260c8){return _0x3260c8[_0x60a9('0xa')](_0x25af57,_0x176df4);}));})[_0x60a9('0x8')](function(_0xd578a4){return _0xd578a4[_0x60a9('0xb')](function(_0xaa6437,_0x1d1695){return _0xaa6437||_0x1d1695;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4e28938..f8ac054 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 _0xad02=['../../utils/iftime','../../config/logger','rpc','Interval','options','raw','where','limit','include','map','model','attributes','info','GetInterval','debug','stringify','catch','error','message','find','ShowInterval','findAll','all','ifTime','then','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb'];(function(_0x22be56,_0x2f3019){var _0x493b49=function(_0x382ddb){while(--_0x382ddb){_0x22be56['push'](_0x22be56['shift']());}};_0x493b49(++_0x2f3019);}(_0xad02,0x105));var _0x2ad0=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0xad02[_0x211bc3];return _0x34c9a2;};'use strict';var _=require(_0x2ad0('0x0'));var util=require(_0x2ad0('0x1'));var db=require(_0x2ad0('0x2'))['db'];var iftime=require(_0x2ad0('0x3'))['iftime'];var logger=require(_0x2ad0('0x4'))(_0x2ad0('0x5'));exports['GetInterval']=function(_0x2e77a3){var _0x36c633=this;return new Promise(function(_0x235d19,_0x255943){return db[_0x2ad0('0x6')]['findAll']({'raw':_0x2e77a3[_0x2ad0('0x7')]?_0x2e77a3['options'][_0x2ad0('0x8')]===undefined?!![]:![]:!![],'where':_0x2e77a3['options']?_0x2e77a3[_0x2ad0('0x7')][_0x2ad0('0x9')]||null:null,'attributes':_0x2e77a3[_0x2ad0('0x7')]?_0x2e77a3[_0x2ad0('0x7')]['attributes']||null:null,'limit':_0x2e77a3[_0x2ad0('0x7')]?_0x2e77a3[_0x2ad0('0x7')][_0x2ad0('0xa')]||null:null,'include':_0x2e77a3[_0x2ad0('0x7')]?_0x2e77a3[_0x2ad0('0x7')][_0x2ad0('0xb')]?_[_0x2ad0('0xc')](_0x2e77a3['options'][_0x2ad0('0xb')],function(_0x1262bc){return{'model':db[_0x1262bc[_0x2ad0('0xd')]],'as':_0x1262bc['as'],'attributes':_0x1262bc['attributes'],'include':_0x1262bc[_0x2ad0('0xb')]?_['map'](_0x1262bc[_0x2ad0('0xb')],function(_0x324590){return{'model':db[_0x324590['model']],'as':_0x324590['as'],'attributes':_0x324590['attributes'],'include':_0x324590['include']?_[_0x2ad0('0xc')](_0x324590['include'],function(_0x4bdfd5){return{'model':db[_0x4bdfd5[_0x2ad0('0xd')]],'as':_0x4bdfd5['as'],'attributes':_0x4bdfd5[_0x2ad0('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f87b){logger[_0x2ad0('0xf')](_0x2ad0('0x10'),_0x2e77a3);logger[_0x2ad0('0x11')](_0x2ad0('0x10'),_0x2e77a3,JSON[_0x2ad0('0x12')](_0x28f87b));_0x235d19(_0x28f87b);})[_0x2ad0('0x13')](function(_0x4dee34){logger[_0x2ad0('0x14')]('GetInterval',_0x4dee34[_0x2ad0('0x15')],_0x2e77a3);_0x255943(_0x36c633[_0x2ad0('0x14')](0x1f4,_0x4dee34[_0x2ad0('0x15')]));});});};exports['ShowInterval']=function(_0x356d81){var _0x18d323=this;return new Promise(function(_0x1a6545,_0x260d23){return db[_0x2ad0('0x6')][_0x2ad0('0x16')]({'raw':_0x356d81[_0x2ad0('0x7')]?_0x356d81[_0x2ad0('0x7')][_0x2ad0('0x8')]===undefined?!![]:![]:!![],'where':_0x356d81[_0x2ad0('0x7')]?_0x356d81[_0x2ad0('0x7')][_0x2ad0('0x9')]||null:null,'attributes':_0x356d81[_0x2ad0('0x7')]?_0x356d81[_0x2ad0('0x7')][_0x2ad0('0xe')]||null:null,'include':_0x356d81[_0x2ad0('0x7')]?_0x356d81[_0x2ad0('0x7')]['include']?_[_0x2ad0('0xc')](_0x356d81[_0x2ad0('0x7')][_0x2ad0('0xb')],function(_0x489551){return{'model':db[_0x489551[_0x2ad0('0xd')]],'as':_0x489551['as'],'attributes':_0x489551[_0x2ad0('0xe')],'include':_0x489551[_0x2ad0('0xb')]?_['map'](_0x489551[_0x2ad0('0xb')],function(_0x233853){return{'model':db[_0x233853['model']],'as':_0x233853['as'],'attributes':_0x233853['attributes'],'include':_0x233853[_0x2ad0('0xb')]?_[_0x2ad0('0xc')](_0x233853[_0x2ad0('0xb')],function(_0x5dffc2){return{'model':db[_0x5dffc2['model']],'as':_0x5dffc2['as'],'attributes':_0x5dffc2[_0x2ad0('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x231cb5){logger[_0x2ad0('0xf')](_0x2ad0('0x17'),_0x356d81);logger[_0x2ad0('0x11')](_0x2ad0('0x17'),_0x356d81,JSON[_0x2ad0('0x12')](_0x231cb5));_0x1a6545(_0x231cb5);})[_0x2ad0('0x13')](function(_0x13c378){logger['error'](_0x2ad0('0x17'),_0x13c378[_0x2ad0('0x15')],_0x356d81);_0x260d23(_0x18d323['error'](0x1f4,_0x13c378[_0x2ad0('0x15')]));});});};function checkArrayOfIntervals(_0x3c8dd2,_0x580855){var _0x5d9ba7=[];return db[_0x2ad0('0x6')][_0x2ad0('0x18')]({'where':{'id':_0x3c8dd2}})['then'](function(_0x53cb11){_0x5d9ba7=_0x53cb11;return Promise[_0x2ad0('0x19')](_0x5d9ba7[_0x2ad0('0xc')](function(_0x5333ea){return _0x5333ea[_0x2ad0('0x1a')](_0x580855);}));})[_0x2ad0('0x1b')](function(_0x5bb3d2){var _0x571edb=_0x5bb3d2[_0x2ad0('0x1c')](function(_0x413efd,_0x19ece9){return _0x413efd||_0x19ece9;},![]);logger[_0x2ad0('0xf')](util[_0x2ad0('0x1d')](_0x2ad0('0x1e'),_0x5d9ba7['map'](function(_0xc4e154){return _0xc4e154[_0x2ad0('0x1f')];})[_0x2ad0('0x20')](',\x20'),_0x5d9ba7['map'](function(_0x1c5cd2){return _0x1c5cd2['id'];})['join'](',\x20')));return _0x571edb;});}function checkSingleInterval(_0x50e830,_0x4471af){return db['Interval'][_0x2ad0('0x21')](_0x50e830)['then'](function(_0x288086){if(_0x288086){logger[_0x2ad0('0xf')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x288086['name'],_0x288086['id']));return _0x288086[_0x2ad0('0x1a')](_0x4471af);}});}exports[_0x2ad0('0x22')]=function(_0x4b65e6){var _0x49eb8d=_0x4b65e6['intervalIds'];var _0x4c15eb=Array[_0x2ad0('0x23')](_0x4b65e6['intervals'])?_0x4b65e6['intervals']:typeof _0x4b65e6[_0x2ad0('0x24')]===_0x2ad0('0x25')?[_0x4b65e6[_0x2ad0('0x24')]]:[];var _0x278069=_0x4b65e6['timezone']||undefined;var _0x512565=![];if(_0x4c15eb[_0x2ad0('0x26')]){logger['info'](util[_0x2ad0('0x1d')](_0x2ad0('0x27'),_0x4c15eb[_0x2ad0('0x20')](';\x20')));}if(_0x278069){logger[_0x2ad0('0xf')](util[_0x2ad0('0x1d')](_0x2ad0('0x28'),_0x278069));}logger[_0x2ad0('0x11')](_0x2ad0('0x29'),_0x512565);logger[_0x2ad0('0x2a')](_0x2ad0('0x22'),_0x4b65e6);return Promise[_0x2ad0('0x2b')]()[_0x2ad0('0x1b')](function(){if(Array[_0x2ad0('0x23')](_0x49eb8d)){return checkArrayOfIntervals(_0x49eb8d,_0x278069);}else if(_0x49eb8d){return checkSingleInterval(_0x49eb8d,_0x278069);}})[_0x2ad0('0x1b')](function(_0x37da72){var _0x119757=_0x4c15eb[_0x2ad0('0x1c')](function(_0x15dd9f,_0x421125){return _0x15dd9f||iftime(_0x421125,_0x278069);},![]);_0x512565=_0x37da72||_0x119757;return _0x512565;})['catch'](function(_0x78ad0c){logger['error'](_0x2ad0('0x22'),_0x4b65e6,_0x78ad0c);throw this[_0x2ad0('0x14')](0x1f4,_0x78ad0c[_0x2ad0('0x15')]);});}; \ No newline at end of file +var _0x77d2=['util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','options','attributes','include','model','map','then','info','stringify','error','message','ShowInterval','find','raw','where','debug','catch','findAll','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','string','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','lodash'];(function(_0x1abff9,_0x4521c6){var _0x10335b=function(_0xa09aec){while(--_0xa09aec){_0x1abff9['push'](_0x1abff9['shift']());}};_0x10335b(++_0x4521c6);}(_0x77d2,0x11e));var _0x277d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x77d2[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x277d('0x0'));var util=require(_0x277d('0x1'));var db=require(_0x277d('0x2'))['db'];var iftime=require(_0x277d('0x3'))['iftime'];var logger=require(_0x277d('0x4'))(_0x277d('0x5'));exports[_0x277d('0x6')]=function(_0x3b9509){var _0x25ac5a=this;return new Promise(function(_0x33fff7,_0x56c07a){return db[_0x277d('0x7')]['findAll']({'raw':_0x3b9509[_0x277d('0x8')]?_0x3b9509[_0x277d('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x3b9509[_0x277d('0x8')]?_0x3b9509[_0x277d('0x8')]['where']||null:null,'attributes':_0x3b9509['options']?_0x3b9509[_0x277d('0x8')][_0x277d('0x9')]||null:null,'limit':_0x3b9509[_0x277d('0x8')]?_0x3b9509['options']['limit']||null:null,'include':_0x3b9509[_0x277d('0x8')]?_0x3b9509[_0x277d('0x8')][_0x277d('0xa')]?_['map'](_0x3b9509[_0x277d('0x8')][_0x277d('0xa')],function(_0x186e5f){return{'model':db[_0x186e5f[_0x277d('0xb')]],'as':_0x186e5f['as'],'attributes':_0x186e5f[_0x277d('0x9')],'include':_0x186e5f[_0x277d('0xa')]?_[_0x277d('0xc')](_0x186e5f[_0x277d('0xa')],function(_0x1b071c){return{'model':db[_0x1b071c[_0x277d('0xb')]],'as':_0x1b071c['as'],'attributes':_0x1b071c[_0x277d('0x9')],'include':_0x1b071c[_0x277d('0xa')]?_['map'](_0x1b071c[_0x277d('0xa')],function(_0x2a2a41){return{'model':db[_0x2a2a41['model']],'as':_0x2a2a41['as'],'attributes':_0x2a2a41[_0x277d('0x9')]};}):[]};}):[]};}):[]:[]})[_0x277d('0xd')](function(_0x172029){logger[_0x277d('0xe')](_0x277d('0x6'),_0x3b9509);logger['debug'](_0x277d('0x6'),_0x3b9509,JSON[_0x277d('0xf')](_0x172029));_0x33fff7(_0x172029);})['catch'](function(_0x3b4956){logger[_0x277d('0x10')](_0x277d('0x6'),_0x3b4956[_0x277d('0x11')],_0x3b9509);_0x56c07a(_0x25ac5a[_0x277d('0x10')](0x1f4,_0x3b4956[_0x277d('0x11')]));});});};exports[_0x277d('0x12')]=function(_0x2e835d){var _0x34555f=this;return new Promise(function(_0x33f247,_0x353912){return db['Interval'][_0x277d('0x13')]({'raw':_0x2e835d[_0x277d('0x8')]?_0x2e835d['options'][_0x277d('0x14')]===undefined?!![]:![]:!![],'where':_0x2e835d[_0x277d('0x8')]?_0x2e835d['options'][_0x277d('0x15')]||null:null,'attributes':_0x2e835d[_0x277d('0x8')]?_0x2e835d[_0x277d('0x8')][_0x277d('0x9')]||null:null,'include':_0x2e835d['options']?_0x2e835d[_0x277d('0x8')]['include']?_[_0x277d('0xc')](_0x2e835d[_0x277d('0x8')][_0x277d('0xa')],function(_0x10dc39){return{'model':db[_0x10dc39[_0x277d('0xb')]],'as':_0x10dc39['as'],'attributes':_0x10dc39[_0x277d('0x9')],'include':_0x10dc39[_0x277d('0xa')]?_[_0x277d('0xc')](_0x10dc39['include'],function(_0x5362eb){return{'model':db[_0x5362eb[_0x277d('0xb')]],'as':_0x5362eb['as'],'attributes':_0x5362eb['attributes'],'include':_0x5362eb[_0x277d('0xa')]?_[_0x277d('0xc')](_0x5362eb[_0x277d('0xa')],function(_0x2da211){return{'model':db[_0x2da211[_0x277d('0xb')]],'as':_0x2da211['as'],'attributes':_0x2da211[_0x277d('0x9')]};}):[]};}):[]};}):[]:[]})[_0x277d('0xd')](function(_0x2d68ea){logger['info'](_0x277d('0x12'),_0x2e835d);logger[_0x277d('0x16')](_0x277d('0x12'),_0x2e835d,JSON[_0x277d('0xf')](_0x2d68ea));_0x33f247(_0x2d68ea);})[_0x277d('0x17')](function(_0x3e9418){logger[_0x277d('0x10')]('ShowInterval',_0x3e9418['message'],_0x2e835d);_0x353912(_0x34555f[_0x277d('0x10')](0x1f4,_0x3e9418['message']));});});};function checkArrayOfIntervals(_0x1c96e0,_0x2bd8ef){var _0x39f748=[];return db[_0x277d('0x7')][_0x277d('0x18')]({'where':{'id':_0x1c96e0}})['then'](function(_0x85788d){_0x39f748=_0x85788d;return Promise[_0x277d('0x19')](_0x39f748[_0x277d('0xc')](function(_0x5899b0){return _0x5899b0[_0x277d('0x1a')](_0x2bd8ef);}));})['then'](function(_0x3be99a){var _0x212de6=_0x3be99a[_0x277d('0x1b')](function(_0x1e22b9,_0x4f20dd){return _0x1e22b9||_0x4f20dd;},![]);logger['info'](util[_0x277d('0x1c')](_0x277d('0x1d'),_0x39f748[_0x277d('0xc')](function(_0x3dc6f0){return _0x3dc6f0[_0x277d('0x1e')];})['join'](',\x20'),_0x39f748[_0x277d('0xc')](function(_0x463a81){return _0x463a81['id'];})['join'](',\x20')));return _0x212de6;});}function checkSingleInterval(_0x2c789a,_0x19ff21){return db[_0x277d('0x7')][_0x277d('0x1f')](_0x2c789a)[_0x277d('0xd')](function(_0x379480){if(_0x379480){logger[_0x277d('0xe')](util['format'](_0x277d('0x20'),_0x379480[_0x277d('0x1e')],_0x379480['id']));return _0x379480['ifTime'](_0x19ff21);}});}exports[_0x277d('0x21')]=function(_0x2a48a4){var _0x562c7c=_0x2a48a4['intervalIds'];var _0x24d38d=Array[_0x277d('0x22')](_0x2a48a4[_0x277d('0x23')])?_0x2a48a4[_0x277d('0x23')]:typeof _0x2a48a4['intervals']===_0x277d('0x24')?[_0x2a48a4[_0x277d('0x23')]]:[];var _0x2ffe8a=_0x2a48a4['timezone']||undefined;var _0xbcaa84=![];if(_0x24d38d[_0x277d('0x25')]){logger[_0x277d('0xe')](util[_0x277d('0x1c')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x24d38d['join'](';\x20')));}if(_0x2ffe8a){logger[_0x277d('0xe')](util[_0x277d('0x1c')](_0x277d('0x26'),_0x2ffe8a));}logger['debug'](_0x277d('0x27'),_0xbcaa84);logger[_0x277d('0x28')](_0x277d('0x21'),_0x2a48a4);return Promise['resolve']()[_0x277d('0xd')](function(){if(Array[_0x277d('0x22')](_0x562c7c)){return checkArrayOfIntervals(_0x562c7c,_0x2ffe8a);}else if(_0x562c7c){return checkSingleInterval(_0x562c7c,_0x2ffe8a);}})[_0x277d('0xd')](function(_0x2a7f6d){var _0x1b889d=_0x24d38d[_0x277d('0x1b')](function(_0x39f0db,_0xe4177b){return _0x39f0db||iftime(_0xe4177b,_0x2ffe8a);},![]);_0xbcaa84=_0x2a7f6d||_0x1b889d;return _0xbcaa84;})[_0x277d('0x17')](function(_0x1a41f5){logger[_0x277d('0x10')](_0x277d('0x21'),_0x2a48a4,_0x1a41f5);throw this[_0x277d('0x10')](0x1f4,_0x1a41f5[_0x277d('0x11')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 730b3b9..d4d975c 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xb10b,0x12a));var _0xbb10=function(_0x339702,_0x465d98){_0x339702=_0x339702-0x0;var _0x55cc03=_0xb10b[_0x339702];return _0x55cc03;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x335f34,_0x528991){var _0x5a9ca6=function(_0x253a89){while(--_0x253a89){_0x335f34['push'](_0x335f34['shift']());}};_0x5a9ca6(++_0x528991);}(_0x2032,0xd9));var _0x2203=function(_0x1b8c83,_0xdf251f){_0x1b8c83=_0x1b8c83-0x0;var _0x401676=_0x2032[_0x1b8c83];return _0x401676;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 2cb1195..1287622 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 _0xa7b6=['remoteAddress','bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','toString','base64','request','utf8','data','end','status','statusCode','json','parse','error','write','openIssue','body','headers','socket','connection'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0xa7b6,0x159));var _0x6a7b=function(_0x827d61,_0x127d23){_0x827d61=_0x827d61-0x0;var _0x3d2398=_0xa7b6[_0x827d61];return _0x3d2398;};'use strict';var BPromise=require(_0x6a7b('0x0'));var https=require(_0x6a7b('0x1'));var logger=require(_0x6a7b('0x2'))(_0x6a7b('0x3'));var USERNAME=_0x6a7b('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x10aefc,_0x932d6f){var _0x149bc1={'fields':{'project':{'key':_0x10aefc[_0x6a7b('0x5')]||_0x6a7b('0x6')},'summary':(_0x10aefc[_0x6a7b('0x7')]||_0x6a7b('0x8'))+_0x6a7b('0x9')+_0x10aefc['ip'],'description':_0x10aefc[_0x6a7b('0xa')]||JSON[_0x6a7b('0xb')](_0x10aefc),'issuetype':{'name':_0x10aefc[_0x6a7b('0xc')]||_0x6a7b('0xd')}}};_0x149bc1[_0x6a7b('0xe')]['customfield_11500']=_0x10aefc[_0x6a7b('0xf')];_0x149bc1[_0x6a7b('0xe')][_0x6a7b('0x10')]=_0x10aefc[_0x6a7b('0x11')];_0x149bc1[_0x6a7b('0xe')]['customfield_11502']=_0x10aefc[_0x6a7b('0x12')];_0x149bc1[_0x6a7b('0xe')][_0x6a7b('0x13')]=_0x10aefc[_0x6a7b('0x14')];_0x149bc1['fields']['customfield_11504']=_0x10aefc[_0x6a7b('0x15')];_0x149bc1['fields'][_0x6a7b('0x16')]=_0x10aefc['ip'];var _0xc45add={'host':_0x6a7b('0x17'),'port':0x1bb,'path':_0x6a7b('0x18'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x6a7b('0x19')](_0x6a7b('0x1a'))}};var _0x4f3206=JSON['stringify'](_0x149bc1);var _0x1c1f6c=https[_0x6a7b('0x1b')](_0xc45add,function(_0x58e155){_0x58e155['setEncoding'](_0x6a7b('0x1c'));var _0xb77a94='';_0x58e155['on'](_0x6a7b('0x1d'),function(_0x13278b){_0xb77a94+=_0x13278b;});_0x58e155['on'](_0x6a7b('0x1e'),function(){if(_0x932d6f){return _0x932d6f[_0x6a7b('0x1f')](_0x58e155[_0x6a7b('0x20')])[_0x6a7b('0x21')](JSON[_0x6a7b('0x22')](_0xb77a94));}});});_0x1c1f6c['on'](_0x6a7b('0x23'),function(_0x4cec13){if(_0x932d6f){return _0x932d6f[_0x6a7b('0x1f')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x1c1f6c[_0x6a7b('0x24')](_0x4f3206);_0x1c1f6c[_0x6a7b('0x1e')]();}exports[_0x6a7b('0x25')]=openIssue;exports['send']=function(_0x3befa1,_0x26ecfa){_0x3befa1[_0x6a7b('0x26')]['ip']=_0x3befa1[_0x6a7b('0x27')]['x-forwarded-for']||_0x3befa1['connection']['remoteAddress']||_0x3befa1[_0x6a7b('0x28')]['remoteAddress']||_0x3befa1[_0x6a7b('0x29')][_0x6a7b('0x28')][_0x6a7b('0x2a')];return openIssue(_0x3befa1['body'],_0x26ecfa);}; \ No newline at end of file +var _0xbf69=['socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','POST','application/json','Basic\x20','base64','stringify','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','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress'];(function(_0x45a88d,_0x34c17b){var _0xc4423e=function(_0x3eefb5){while(--_0x3eefb5){_0x45a88d['push'](_0x45a88d['shift']());}};_0xc4423e(++_0x34c17b);}(_0xbf69,0x199));var _0x9bf6=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xbf69[_0x5d860f];return _0x236490;};'use strict';var BPromise=require(_0x9bf6('0x0'));var https=require(_0x9bf6('0x1'));var logger=require(_0x9bf6('0x2'))(_0x9bf6('0x3'));var USERNAME=_0x9bf6('0x4');var PASSWORD=_0x9bf6('0x5');function openIssue(_0x290611,_0x5af968){var _0xa51752={'fields':{'project':{'key':_0x290611[_0x9bf6('0x6')]||_0x9bf6('0x7')},'summary':(_0x290611[_0x9bf6('0x8')]||_0x9bf6('0x9'))+_0x9bf6('0xa')+_0x290611['ip'],'description':_0x290611[_0x9bf6('0xb')]||JSON['stringify'](_0x290611),'issuetype':{'name':_0x290611[_0x9bf6('0xc')]||_0x9bf6('0xd')}}};_0xa51752['fields'][_0x9bf6('0xe')]=_0x290611[_0x9bf6('0xf')];_0xa51752[_0x9bf6('0x10')][_0x9bf6('0x11')]=_0x290611[_0x9bf6('0x12')];_0xa51752[_0x9bf6('0x10')][_0x9bf6('0x13')]=_0x290611[_0x9bf6('0x14')];_0xa51752[_0x9bf6('0x10')]['customfield_11503']=_0x290611[_0x9bf6('0x15')];_0xa51752[_0x9bf6('0x10')][_0x9bf6('0x16')]=_0x290611[_0x9bf6('0x17')];_0xa51752['fields'][_0x9bf6('0x18')]=_0x290611['ip'];var _0x50c9d9={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x9bf6('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x9bf6('0x1a'),'Authorization':_0x9bf6('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9bf6('0x1c'))}};var _0x2188c2=JSON[_0x9bf6('0x1d')](_0xa51752);var _0x55d7fb=https[_0x9bf6('0x1e')](_0x50c9d9,function(_0x33bacc){_0x33bacc[_0x9bf6('0x1f')](_0x9bf6('0x20'));var _0x31b963='';_0x33bacc['on'](_0x9bf6('0x21'),function(_0x1834ba){_0x31b963+=_0x1834ba;});_0x33bacc['on'](_0x9bf6('0x22'),function(){if(_0x5af968){return _0x5af968[_0x9bf6('0x23')](_0x33bacc[_0x9bf6('0x24')])[_0x9bf6('0x25')](JSON[_0x9bf6('0x26')](_0x31b963));}});});_0x55d7fb['on'](_0x9bf6('0x27'),function(_0xb34e01){if(_0x5af968){return _0x5af968[_0x9bf6('0x23')](0x1f4)[_0x9bf6('0x25')]({'errors':[{'message':_0x9bf6('0x28'),'type':_0x9bf6('0x29')}]});}});_0x55d7fb[_0x9bf6('0x2a')](_0x2188c2);_0x55d7fb[_0x9bf6('0x22')]();}exports[_0x9bf6('0x2b')]=openIssue;exports[_0x9bf6('0x2c')]=function(_0x208bea,_0x150a1a){_0x208bea[_0x9bf6('0x2d')]['ip']=_0x208bea[_0x9bf6('0x2e')][_0x9bf6('0x2f')]||_0x208bea[_0x9bf6('0x30')][_0x9bf6('0x31')]||_0x208bea[_0x9bf6('0x32')][_0x9bf6('0x31')]||_0x208bea['connection'][_0x9bf6('0x32')]['remoteAddress'];return openIssue(_0x208bea[_0x9bf6('0x2d')],_0x150a1a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2ca0e15..2fa9849 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 _0xbdb7=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get','describe','show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3cffb3,_0x284b2d){var _0x57a846=function(_0x32a354){while(--_0x32a354){_0x3cffb3['push'](_0x3cffb3['shift']());}};_0x57a846(++_0x284b2d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1d34e3,_0x4f5844){_0x1d34e3=_0x1d34e3-0x0;var _0x34266b=_0xbdb7[_0x1d34e3];return _0x34266b;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')]('/',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')](_0x7bdb('0x12'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0x14')]);module[_0x7bdb('0x15')]=router; \ No newline at end of file +var _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x1146e2,_0xe1b759){var _0x2a66cd=function(_0x1aa8c4){while(--_0x1aa8c4){_0x1146e2['push'](_0x1146e2['shift']());}};_0x2a66cd(++_0xe1b759);}(_0xbec5,0xe5));var _0x5bec=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xbec5[_0x38b14f];return _0x22a324;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c8f5bba..544fc41 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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x4d12fd,_0x23aa7a){_0x4d12fd=_0x4d12fd-0x0;var _0x15811a=_0x7a54[_0x4d12fd];return _0x15811a;};'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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x2e9277,_0x3a2fea){_0x2e9277=_0x2e9277-0x0;var _0xd415d7=_0x7a54[_0x2e9277];return _0xd415d7;};'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 081ae2f..e4af953 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 _0xce50=['api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce50,0x1d8));var _0x0ce5=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xce50[_0x45783c];return _0x1161da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ce5('0x0'));var zipdir=require(_0x0ce5('0x1'));var jsonpatch=require(_0x0ce5('0x2'));var rp=require(_0x0ce5('0x3'));var moment=require(_0x0ce5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ce5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0ce5('0x6'));var ejs=require(_0x0ce5('0x7'));var fs=require('fs');var fs_extra=require(_0x0ce5('0x8'));var _=require(_0x0ce5('0x9'));var squel=require('squel');var crypto=require(_0x0ce5('0xa'));var jsforce=require(_0x0ce5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0ce5('0x6'));var querystring=require('querystring');var Papa=require(_0x0ce5('0xc'));var Redis=require(_0x0ce5('0xd'));var authService=require(_0x0ce5('0xe'));var qs=require(_0x0ce5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ce5('0x10'));var logger=require(_0x0ce5('0x11'))(_0x0ce5('0x12'));var utils=require(_0x0ce5('0x13'));var config=require(_0x0ce5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x529265,_0x59c22e){_0x59c22e=_0x59c22e||0xcc;return function(_0xb530fa){if(_0xb530fa){return _0x529265[_0x0ce5('0x15')](_0x59c22e);}return _0x529265[_0x0ce5('0x16')](_0x59c22e)['end']();};}function respondWithResult(_0x85bbb,_0x117fa9){_0x117fa9=_0x117fa9||0xc8;return function(_0x5f4317){if(_0x5f4317){return _0x85bbb[_0x0ce5('0x16')](_0x117fa9)['json'](_0x5f4317);}};}function respondWithFilteredResult(_0x1ece6f,_0x1dd856){return function(_0x3b5a36){if(_0x3b5a36){var _0x13ce5a=typeof _0x1dd856[_0x0ce5('0x17')]===_0x0ce5('0x18')&&typeof _0x1dd856[_0x0ce5('0x19')]===_0x0ce5('0x18');var _0x5eab29=_0x3b5a36[_0x0ce5('0x1a')];var _0x4292ce=_0x13ce5a?0x0:_0x1dd856['offset'];var _0x4f5e0b=_0x13ce5a?_0x3b5a36[_0x0ce5('0x1a')]:_0x1dd856['offset']+_0x1dd856[_0x0ce5('0x19')];var _0x477451;if(_0x4f5e0b>=_0x5eab29){_0x4f5e0b=_0x5eab29;_0x477451=0xc8;}else{_0x477451=0xce;}_0x1ece6f[_0x0ce5('0x16')](_0x477451);return _0x1ece6f[_0x0ce5('0x1b')](_0x0ce5('0x1c'),_0x4292ce+'-'+_0x4f5e0b+'/'+_0x5eab29)[_0x0ce5('0x1d')](_0x3b5a36);}return null;};}function patchUpdates(_0x57d9da){return function(_0x2cc733){try{jsonpatch[_0x0ce5('0x1e')](_0x2cc733,_0x57d9da,!![]);}catch(_0x1a1b8a){return BPromise[_0x0ce5('0x1f')](_0x1a1b8a);}return _0x2cc733['save']();};}function saveUpdates(_0x20f520,_0x4e8e46){return function(_0x16ff16){if(_0x16ff16){return _0x16ff16[_0x0ce5('0x20')](_0x20f520)[_0x0ce5('0x21')](function(_0x78be90){return _0x78be90;});}return null;};}function removeEntity(_0x334e7d,_0xbb1a2c){return function(_0x3ca9de){if(_0x3ca9de){return _0x3ca9de[_0x0ce5('0x22')]()[_0x0ce5('0x21')](function(){_0x334e7d[_0x0ce5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5392a4,_0x2332d4){return function(_0x56ef06){if(!_0x56ef06){_0x5392a4['sendStatus'](0x194);}return _0x56ef06;};}function handleError(_0x73f240,_0x564276){_0x564276=_0x564276||0x1f4;return function(_0x2c7414){logger[_0x0ce5('0x23')](_0x2c7414['stack']);if(_0x2c7414['name']){delete _0x2c7414[_0x0ce5('0x24')];}_0x73f240[_0x0ce5('0x16')](_0x564276)['send'](_0x2c7414);};}exports[_0x0ce5('0x25')]=function(_0x470fb6,_0x3d7153){var _0x54a385={},_0x55aa97={},_0x343137={'count':0x0,'rows':[]};var _0x28080b=_[_0x0ce5('0x26')](db[_0x0ce5('0x27')][_0x0ce5('0x28')],function(_0x44dabc){return{'name':_0x44dabc[_0x0ce5('0x29')],'type':_0x44dabc[_0x0ce5('0x2a')][_0x0ce5('0x2b')]};});_0x55aa97[_0x0ce5('0x2c')]=_[_0x0ce5('0x26')](_0x28080b,_0x0ce5('0x24'));_0x55aa97[_0x0ce5('0x2d')]=_[_0x0ce5('0x2e')](_0x470fb6[_0x0ce5('0x2d')]);_0x55aa97[_0x0ce5('0x2f')]=_[_0x0ce5('0x30')](_0x55aa97[_0x0ce5('0x2c')],_0x55aa97[_0x0ce5('0x2d')]);_0x54a385[_0x0ce5('0x31')]=_[_0x0ce5('0x30')](_0x55aa97[_0x0ce5('0x2c')],qs['fields'](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x32')]));_0x54a385[_0x0ce5('0x31')]=_0x54a385['attributes'][_0x0ce5('0x33')]?_0x54a385[_0x0ce5('0x31')]:_0x55aa97[_0x0ce5('0x2c')];if(!_0x470fb6[_0x0ce5('0x2d')]['hasOwnProperty'](_0x0ce5('0x34'))){_0x54a385[_0x0ce5('0x19')]=qs[_0x0ce5('0x19')](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x19')]);_0x54a385[_0x0ce5('0x17')]=qs[_0x0ce5('0x17')](_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x17')]);}_0x54a385[_0x0ce5('0x35')]=qs[_0x0ce5('0x36')](_0x470fb6[_0x0ce5('0x2d')]['sort']);_0x54a385[_0x0ce5('0x37')]=qs[_0x0ce5('0x2f')](_[_0x0ce5('0x38')](_0x470fb6['query'],_0x55aa97[_0x0ce5('0x2f')]),_0x28080b);if(_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x39')]){_0x54a385[_0x0ce5('0x37')]=_['merge'](_0x54a385[_0x0ce5('0x37')],{'$or':_['map'](_0x28080b,function(_0x27cbee){if(_0x27cbee['type']!=='VIRTUAL'){var _0x3b30a4={};_0x3b30a4[_0x27cbee[_0x0ce5('0x24')]]={'$like':'%'+_0x470fb6[_0x0ce5('0x2d')]['filter']+'%'};return _0x3b30a4;}})});}_0x54a385=_[_0x0ce5('0x3a')]({},_0x54a385,_0x470fb6[_0x0ce5('0x3b')]);var _0x245ac6={'where':_0x54a385[_0x0ce5('0x37')]};return db['JscriptyAnswerReport'][_0x0ce5('0x1a')](_0x245ac6)[_0x0ce5('0x21')](function(_0x238f52){_0x343137[_0x0ce5('0x1a')]=_0x238f52;if(_0x470fb6[_0x0ce5('0x2d')][_0x0ce5('0x3c')]){_0x54a385['include']=[{'all':!![]}];}return db[_0x0ce5('0x27')][_0x0ce5('0x3d')](_0x54a385);})[_0x0ce5('0x21')](function(_0x1fa06f){_0x343137[_0x0ce5('0x3e')]=_0x1fa06f;return _0x343137;})[_0x0ce5('0x21')](respondWithFilteredResult(_0x3d7153,_0x54a385))[_0x0ce5('0x3f')](handleError(_0x3d7153,null));};exports[_0x0ce5('0x40')]=function(_0xa9b36a,_0x48ebfc){var _0x5e280c={'raw':!![],'where':{'id':_0xa9b36a[_0x0ce5('0x41')]['id']}},_0x1a16b7={};_0x1a16b7['model']=_['keys'](db[_0x0ce5('0x27')][_0x0ce5('0x28')]);_0x1a16b7[_0x0ce5('0x2d')]=_[_0x0ce5('0x2e')](_0xa9b36a[_0x0ce5('0x2d')]);_0x1a16b7[_0x0ce5('0x2f')]=_[_0x0ce5('0x30')](_0x1a16b7[_0x0ce5('0x2c')],_0x1a16b7[_0x0ce5('0x2d')]);_0x5e280c[_0x0ce5('0x31')]=_['intersection'](_0x1a16b7['model'],qs['fields'](_0xa9b36a[_0x0ce5('0x2d')][_0x0ce5('0x32')]));_0x5e280c[_0x0ce5('0x31')]=_0x5e280c[_0x0ce5('0x31')][_0x0ce5('0x33')]?_0x5e280c[_0x0ce5('0x31')]:_0x1a16b7['model'];if(_0xa9b36a[_0x0ce5('0x2d')][_0x0ce5('0x3c')]){_0x5e280c[_0x0ce5('0x42')]=[{'all':!![]}];}_0x5e280c=_[_0x0ce5('0x3a')]({},_0x5e280c,_0xa9b36a['options']);return db[_0x0ce5('0x27')]['find'](_0x5e280c)['then'](handleEntityNotFound(_0x48ebfc,null))[_0x0ce5('0x21')](respondWithResult(_0x48ebfc,null))[_0x0ce5('0x3f')](handleError(_0x48ebfc,null));};exports[_0x0ce5('0x43')]=function(_0xf1fc01,_0x3a3ec5){return db[_0x0ce5('0x27')][_0x0ce5('0x43')](_0xf1fc01[_0x0ce5('0x44')],{})[_0x0ce5('0x21')](respondWithResult(_0x3a3ec5,0xc9))[_0x0ce5('0x3f')](handleError(_0x3a3ec5,null));};exports[_0x0ce5('0x20')]=function(_0x40e47c,_0x5629f4){if(_0x40e47c[_0x0ce5('0x44')]['id']){delete _0x40e47c['body']['id'];}return db[_0x0ce5('0x27')]['find']({'where':{'id':_0x40e47c['params']['id']}})['then'](handleEntityNotFound(_0x5629f4,null))[_0x0ce5('0x21')](saveUpdates(_0x40e47c['body'],null))['then'](respondWithResult(_0x5629f4,null))['catch'](handleError(_0x5629f4,null));};exports[_0x0ce5('0x22')]=function(_0x3cd81a,_0x1a9ce4){return db[_0x0ce5('0x27')]['find']({'where':{'id':_0x3cd81a['params']['id']}})[_0x0ce5('0x21')](handleEntityNotFound(_0x1a9ce4,null))[_0x0ce5('0x21')](removeEntity(_0x1a9ce4,null))[_0x0ce5('0x3f')](handleError(_0x1a9ce4,null));};exports[_0x0ce5('0x45')]=function(_0x4256e3,_0x30571c){return db[_0x0ce5('0x27')][_0x0ce5('0x45')]()[_0x0ce5('0x21')](respondWithResult(_0x30571c,null))[_0x0ce5('0x3f')](handleError(_0x30571c,null));}; \ No newline at end of file +var _0x8f9d=['describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','save','update','then','destroy','stack','name','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','fields','includeAll','include','find','create','body'];(function(_0x1e6e0f,_0x145b99){var _0x100aa4=function(_0x2746fb){while(--_0x2746fb){_0x1e6e0f['push'](_0x1e6e0f['shift']());}};_0x100aa4(++_0x145b99);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xd8f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8f9('0x2'));var moment=require(_0xd8f9('0x3'));var BPromise=require(_0xd8f9('0x4'));var Mustache=require(_0xd8f9('0x5'));var util=require(_0xd8f9('0x6'));var path=require(_0xd8f9('0x7'));var sox=require(_0xd8f9('0x8'));var csv=require('to-csv');var ejs=require(_0xd8f9('0x9'));var fs=require('fs');var fs_extra=require(_0xd8f9('0xa'));var _=require(_0xd8f9('0xb'));var squel=require(_0xd8f9('0xc'));var crypto=require(_0xd8f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd8f9('0xe'));var toCsv=require(_0xd8f9('0xf'));var querystring=require('querystring');var Papa=require(_0xd8f9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8f9('0x11'));var as=require(_0xd8f9('0x12'));var hardwareService=require(_0xd8f9('0x13'));var logger=require(_0xd8f9('0x14'))(_0xd8f9('0x15'));var utils=require(_0xd8f9('0x16'));var config=require(_0xd8f9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8f9('0x18'))['db'];function respondWithStatusCode(_0x56e0d6,_0x39aca0){_0x39aca0=_0x39aca0||0xcc;return function(_0x45aba0){if(_0x45aba0){return _0x56e0d6[_0xd8f9('0x19')](_0x39aca0);}return _0x56e0d6['status'](_0x39aca0)[_0xd8f9('0x1a')]();};}function respondWithResult(_0x3df6d2,_0x4cfebf){_0x4cfebf=_0x4cfebf||0xc8;return function(_0x223f10){if(_0x223f10){return _0x3df6d2['status'](_0x4cfebf)[_0xd8f9('0x1b')](_0x223f10);}};}function respondWithFilteredResult(_0x1525d6,_0x234901){return function(_0x10369c){if(_0x10369c){var _0x3a3a41=typeof _0x234901[_0xd8f9('0x1c')]===_0xd8f9('0x1d')&&typeof _0x234901['limit']==='undefined';var _0x284a1a=_0x10369c[_0xd8f9('0x1e')];var _0x4d5b8d=_0x3a3a41?0x0:_0x234901[_0xd8f9('0x1c')];var _0x47bdea=_0x3a3a41?_0x10369c[_0xd8f9('0x1e')]:_0x234901['offset']+_0x234901['limit'];var _0x58956e;if(_0x47bdea>=_0x284a1a){_0x47bdea=_0x284a1a;_0x58956e=0xc8;}else{_0x58956e=0xce;}_0x1525d6[_0xd8f9('0x1f')](_0x58956e);return _0x1525d6['set'](_0xd8f9('0x20'),_0x4d5b8d+'-'+_0x47bdea+'/'+_0x284a1a)[_0xd8f9('0x1b')](_0x10369c);}return null;};}function patchUpdates(_0x58ea35){return function(_0x3204b3){try{jsonpatch[_0xd8f9('0x21')](_0x3204b3,_0x58ea35,!![]);}catch(_0x45b2e3){return BPromise['reject'](_0x45b2e3);}return _0x3204b3[_0xd8f9('0x22')]();};}function saveUpdates(_0x260807,_0x164bf6){return function(_0x36d740){if(_0x36d740){return _0x36d740[_0xd8f9('0x23')](_0x260807)[_0xd8f9('0x24')](function(_0x4c5808){return _0x4c5808;});}return null;};}function removeEntity(_0x39fedc,_0xbd09da){return function(_0x1fcd45){if(_0x1fcd45){return _0x1fcd45[_0xd8f9('0x25')]()[_0xd8f9('0x24')](function(){_0x39fedc['status'](0xcc)[_0xd8f9('0x1a')]();});}};}function handleEntityNotFound(_0x1d6796,_0x28854a){return function(_0xd15475){if(!_0xd15475){_0x1d6796[_0xd8f9('0x19')](0x194);}return _0xd15475;};}function handleError(_0x9e1d6d,_0x175123){_0x175123=_0x175123||0x1f4;return function(_0x461880){logger['error'](_0x461880[_0xd8f9('0x26')]);if(_0x461880[_0xd8f9('0x27')]){delete _0x461880[_0xd8f9('0x27')];}_0x9e1d6d['status'](_0x175123)['send'](_0x461880);};}exports['index']=function(_0x3f85a2,_0x2c25c2){var _0x5050a4={},_0x2bda39={},_0x210cd1={'count':0x0,'rows':[]};var _0x5da878=_[_0xd8f9('0x28')](db[_0xd8f9('0x29')][_0xd8f9('0x2a')],function(_0x4caa27){return{'name':_0x4caa27[_0xd8f9('0x2b')],'type':_0x4caa27['type'][_0xd8f9('0x2c')]};});_0x2bda39[_0xd8f9('0x2d')]=_['map'](_0x5da878,_0xd8f9('0x27'));_0x2bda39['query']=_[_0xd8f9('0x2e')](_0x3f85a2[_0xd8f9('0x2f')]);_0x2bda39[_0xd8f9('0x30')]=_[_0xd8f9('0x31')](_0x2bda39[_0xd8f9('0x2d')],_0x2bda39[_0xd8f9('0x2f')]);_0x5050a4[_0xd8f9('0x32')]=_['intersection'](_0x2bda39[_0xd8f9('0x2d')],qs['fields'](_0x3f85a2['query']['fields']));_0x5050a4['attributes']=_0x5050a4[_0xd8f9('0x32')][_0xd8f9('0x33')]?_0x5050a4[_0xd8f9('0x32')]:_0x2bda39[_0xd8f9('0x2d')];if(!_0x3f85a2[_0xd8f9('0x2f')]['hasOwnProperty']('nolimit')){_0x5050a4[_0xd8f9('0x34')]=qs[_0xd8f9('0x34')](_0x3f85a2['query'][_0xd8f9('0x34')]);_0x5050a4[_0xd8f9('0x1c')]=qs[_0xd8f9('0x1c')](_0x3f85a2['query']['offset']);}_0x5050a4['order']=qs['sort'](_0x3f85a2[_0xd8f9('0x2f')][_0xd8f9('0x35')]);_0x5050a4[_0xd8f9('0x36')]=qs[_0xd8f9('0x30')](_[_0xd8f9('0x37')](_0x3f85a2['query'],_0x2bda39[_0xd8f9('0x30')]),_0x5da878);if(_0x3f85a2[_0xd8f9('0x2f')][_0xd8f9('0x38')]){_0x5050a4[_0xd8f9('0x36')]=_[_0xd8f9('0x39')](_0x5050a4[_0xd8f9('0x36')],{'$or':_[_0xd8f9('0x28')](_0x5da878,function(_0x262e7c){if(_0x262e7c[_0xd8f9('0x3a')]!==_0xd8f9('0x3b')){var _0x2a94d6={};_0x2a94d6[_0x262e7c['name']]={'$like':'%'+_0x3f85a2[_0xd8f9('0x2f')][_0xd8f9('0x38')]+'%'};return _0x2a94d6;}})});}_0x5050a4=_[_0xd8f9('0x39')]({},_0x5050a4,_0x3f85a2[_0xd8f9('0x3c')]);var _0x4af643={'where':_0x5050a4[_0xd8f9('0x36')]};return db[_0xd8f9('0x29')][_0xd8f9('0x1e')](_0x4af643)[_0xd8f9('0x24')](function(_0x1ab301){_0x210cd1[_0xd8f9('0x1e')]=_0x1ab301;if(_0x3f85a2['query']['includeAll']){_0x5050a4['include']=[{'all':!![]}];}return db[_0xd8f9('0x29')][_0xd8f9('0x3d')](_0x5050a4);})[_0xd8f9('0x24')](function(_0x1d8e5d){_0x210cd1[_0xd8f9('0x3e')]=_0x1d8e5d;return _0x210cd1;})[_0xd8f9('0x24')](respondWithFilteredResult(_0x2c25c2,_0x5050a4))[_0xd8f9('0x3f')](handleError(_0x2c25c2,null));};exports[_0xd8f9('0x40')]=function(_0x30e9aa,_0x5ed1b7){var _0x4aabbe={'raw':!![],'where':{'id':_0x30e9aa[_0xd8f9('0x41')]['id']}},_0x433d06={};_0x433d06[_0xd8f9('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xd8f9('0x2a')]);_0x433d06[_0xd8f9('0x2f')]=_[_0xd8f9('0x2e')](_0x30e9aa['query']);_0x433d06[_0xd8f9('0x30')]=_[_0xd8f9('0x31')](_0x433d06[_0xd8f9('0x2d')],_0x433d06[_0xd8f9('0x2f')]);_0x4aabbe[_0xd8f9('0x32')]=_[_0xd8f9('0x31')](_0x433d06[_0xd8f9('0x2d')],qs[_0xd8f9('0x42')](_0x30e9aa[_0xd8f9('0x2f')]['fields']));_0x4aabbe['attributes']=_0x4aabbe['attributes'][_0xd8f9('0x33')]?_0x4aabbe[_0xd8f9('0x32')]:_0x433d06[_0xd8f9('0x2d')];if(_0x30e9aa[_0xd8f9('0x2f')][_0xd8f9('0x43')]){_0x4aabbe[_0xd8f9('0x44')]=[{'all':!![]}];}_0x4aabbe=_[_0xd8f9('0x39')]({},_0x4aabbe,_0x30e9aa[_0xd8f9('0x3c')]);return db[_0xd8f9('0x29')][_0xd8f9('0x45')](_0x4aabbe)[_0xd8f9('0x24')](handleEntityNotFound(_0x5ed1b7,null))[_0xd8f9('0x24')](respondWithResult(_0x5ed1b7,null))[_0xd8f9('0x3f')](handleError(_0x5ed1b7,null));};exports['create']=function(_0x395f6b,_0x1cc33e){return db[_0xd8f9('0x29')][_0xd8f9('0x46')](_0x395f6b['body'],{})[_0xd8f9('0x24')](respondWithResult(_0x1cc33e,0xc9))['catch'](handleError(_0x1cc33e,null));};exports['update']=function(_0x39fe25,_0x14e622){if(_0x39fe25[_0xd8f9('0x47')]['id']){delete _0x39fe25[_0xd8f9('0x47')]['id'];}return db[_0xd8f9('0x29')][_0xd8f9('0x45')]({'where':{'id':_0x39fe25[_0xd8f9('0x41')]['id']}})[_0xd8f9('0x24')](handleEntityNotFound(_0x14e622,null))[_0xd8f9('0x24')](saveUpdates(_0x39fe25[_0xd8f9('0x47')],null))['then'](respondWithResult(_0x14e622,null))['catch'](handleError(_0x14e622,null));};exports['destroy']=function(_0x1bb936,_0x3d2485){return db['JscriptyAnswerReport'][_0xd8f9('0x45')]({'where':{'id':_0x1bb936[_0xd8f9('0x41')]['id']}})[_0xd8f9('0x24')](handleEntityNotFound(_0x3d2485,null))[_0xd8f9('0x24')](removeEntity(_0x3d2485,null))[_0xd8f9('0x3f')](handleError(_0x3d2485,null));};exports[_0xd8f9('0x48')]=function(_0x455278,_0x705bd3){return db['JscriptyAnswerReport'][_0xd8f9('0x48')]()[_0xd8f9('0x24')](respondWithResult(_0x705bd3,null))[_0xd8f9('0x3f')](handleError(_0x705bd3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 5a1c5dd..dee87e0 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 _0x0ef9=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ef9,0x7c));var _0x90ef=function(_0xf237f7,_0xb11ac){_0xf237f7=_0xf237f7-0x0;var _0x2c183b=_0x0ef9[_0xf237f7];return _0x2c183b;};'use strict';var _=require(_0x90ef('0x0'));var util=require(_0x90ef('0x1'));var logger=require(_0x90ef('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x90ef('0x3'));var fs=require('fs');var path=require(_0x90ef('0x4'));var rimraf=require(_0x90ef('0x5'));var config=require(_0x90ef('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x90ef('0x7')]=function(_0x2444c8,_0x42717a){return _0x2444c8[_0x90ef('0x8')](_0x90ef('0x9'),attributes,{'tableName':_0x90ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x320a=['JscriptyAnswerReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x595717,_0xd0ab0e){var _0x412d49=function(_0x39796e){while(--_0x39796e){_0x595717['push'](_0x595717['shift']());}};_0x412d49(++_0xd0ab0e);}(_0x320a,0x9d));var _0xa320=function(_0x20d122,_0x195d2c){_0x20d122=_0x20d122-0x0;var _0x4d3d0b=_0x320a[_0x20d122];return _0x4d3d0b;};'use strict';var _=require(_0xa320('0x0'));var util=require(_0xa320('0x1'));var logger=require(_0xa320('0x2'))(_0xa320('0x3'));var moment=require(_0xa320('0x4'));var BPromise=require(_0xa320('0x5'));var rp=require(_0xa320('0x6'));var fs=require('fs');var path=require(_0xa320('0x7'));var rimraf=require(_0xa320('0x8'));var config=require(_0xa320('0x9'));var attributes=require(_0xa320('0xa'));module[_0xa320('0xb')]=function(_0x3361f0,_0x4beefc){return _0x3361f0['define'](_0xa320('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 5343a88..62f632d 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 _0x1b6b=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2601e0,_0x12a636){var _0x578e64=function(_0x5d65dc){while(--_0x5d65dc){_0x2601e0['push'](_0x2601e0['shift']());}};_0x578e64(++_0x12a636);}(_0x1b6b,0x189));var _0xb1b6=function(_0x38433e,_0x138f68){_0x38433e=_0x38433e-0x0;var _0x37edac=_0x1b6b[_0x38433e];return _0x37edac;};'use strict';var _=require(_0xb1b6('0x0'));var util=require(_0xb1b6('0x1'));var moment=require(_0xb1b6('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1b6('0x3'));var fs=require('fs');var Redis=require(_0xb1b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1b6('0x5'));var logger=require('../../config/logger')(_0xb1b6('0x6'));var config=require('../../config/environment');var jayson=require(_0xb1b6('0x7'));var client=jayson[_0xb1b6('0x8')][_0xb1b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ae91e,_0x5ce678,_0x54e49c){return new BPromise(function(_0x1d729b,_0x25fe54){return client[_0xb1b6('0xa')](_0x3ae91e,_0x54e49c)[_0xb1b6('0xb')](function(_0x342144){logger[_0xb1b6('0xc')](_0xb1b6('0xd'),_0x5ce678,_0xb1b6('0xe'));logger[_0xb1b6('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5ce678,_0xb1b6('0xe'),JSON[_0xb1b6('0x10')](_0x342144));if(_0x342144[_0xb1b6('0x11')]){if(_0x342144[_0xb1b6('0x11')][_0xb1b6('0x12')]===0x1f4){logger[_0xb1b6('0x11')](_0xb1b6('0xd'),_0x5ce678,_0x342144[_0xb1b6('0x11')][_0xb1b6('0x13')]);return _0x25fe54(_0x342144[_0xb1b6('0x11')][_0xb1b6('0x13')]);}logger['error'](_0xb1b6('0xd'),_0x5ce678,_0x342144[_0xb1b6('0x11')][_0xb1b6('0x13')]);return _0x1d729b(_0x342144[_0xb1b6('0x11')][_0xb1b6('0x13')]);}else{logger['info'](_0xb1b6('0xd'),_0x5ce678,_0xb1b6('0xe'));_0x1d729b(_0x342144[_0xb1b6('0x14')]['message']);}})[_0xb1b6('0x15')](function(_0x16e260){logger[_0xb1b6('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5ce678,_0x16e260);_0x25fe54(_0x16e260);});});} \ No newline at end of file +var _0xbc8a=['error','code','message','info','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x1d53cb,_0x4cf3f1){var _0x1de5fe=function(_0x438bbf){while(--_0x438bbf){_0x1d53cb['push'](_0x1d53cb['shift']());}};_0x1de5fe(++_0x4cf3f1);}(_0xbc8a,0x1ab));var _0xabc8=function(_0x493fc9,_0x597cf9){_0x493fc9=_0x493fc9-0x0;var _0x3a90c3=_0xbc8a[_0x493fc9];return _0x3a90c3;};'use strict';var _=require('lodash');var util=require(_0xabc8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xabc8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabc8('0x2'))['db'];var utils=require(_0xabc8('0x3'));var logger=require(_0xabc8('0x4'))(_0xabc8('0x5'));var config=require(_0xabc8('0x6'));var jayson=require(_0xabc8('0x7'));var client=jayson[_0xabc8('0x8')][_0xabc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46f0f7,_0x4f515d,_0xafc6a8){return new BPromise(function(_0x84a5ca,_0x5319e4){return client['request'](_0x46f0f7,_0xafc6a8)[_0xabc8('0xa')](function(_0x5b823d){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f515d,_0xabc8('0xb'));logger[_0xabc8('0xc')](_0xabc8('0xd'),_0x4f515d,'request\x20sent',JSON['stringify'](_0x5b823d));if(_0x5b823d[_0xabc8('0xe')]){if(_0x5b823d['error'][_0xabc8('0xf')]===0x1f4){logger[_0xabc8('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f515d,_0x5b823d['error'][_0xabc8('0x10')]);return _0x5319e4(_0x5b823d[_0xabc8('0xe')][_0xabc8('0x10')]);}logger[_0xabc8('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f515d,_0x5b823d[_0xabc8('0xe')][_0xabc8('0x10')]);return _0x84a5ca(_0x5b823d['error'][_0xabc8('0x10')]);}else{logger[_0xabc8('0x11')](_0xabc8('0x12'),_0x4f515d,_0xabc8('0xb'));_0x84a5ca(_0x5b823d[_0xabc8('0x13')][_0xabc8('0x10')]);}})[_0xabc8('0x14')](function(_0x41a1de){logger[_0xabc8('0xe')](_0xabc8('0x12'),_0x4f515d,_0x41a1de);_0x5319e4(_0x41a1de);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3e1f2a1..e2fde4d 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 _0x6ea9=['connect-timeout','Router','fs-extra','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','post','/:id/clone','clone','put','exports','path'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0x6ea9,0x11d));var _0x96ea=function(_0xf94d07,_0x10eff3){_0xf94d07=_0xf94d07-0x0;var _0x4e4ff9=_0x6ea9[_0xf94d07];return _0x4e4ff9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x96ea('0x0'));var timeout=require(_0x96ea('0x1'));var express=require('express');var router=express[_0x96ea('0x2')]();var fs_extra=require(_0x96ea('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96ea('0x4'));var config=require('../../config/environment');var controller=require(_0x96ea('0x5'));router[_0x96ea('0x6')]('/',auth[_0x96ea('0x7')](),controller[_0x96ea('0x8')]);router[_0x96ea('0x6')](_0x96ea('0x9'),auth[_0x96ea('0x7')](),controller[_0x96ea('0xa')]);router[_0x96ea('0x6')]('/:id/sessions',auth[_0x96ea('0x7')](),controller[_0x96ea('0xb')]);router['get'](_0x96ea('0xc'),auth[_0x96ea('0x7')](),controller[_0x96ea('0xd')]);router['get'](_0x96ea('0xe'),auth[_0x96ea('0x7')](),timeout(_0x96ea('0xf')),controller['getSummary']);router['post']('/',auth[_0x96ea('0x7')](),controller[_0x96ea('0x10')]);router[_0x96ea('0x11')](_0x96ea('0x12'),auth[_0x96ea('0x7')](),controller[_0x96ea('0x13')]);router[_0x96ea('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x96ea('0x9'),auth[_0x96ea('0x7')](),controller['destroy']);module[_0x96ea('0x15')]=router; \ No newline at end of file +var _0xd49a=['isAuthenticated','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','put','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','/:id/sessions'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xd49a,0x7f));var _0xad49=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd49a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xad49('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xad49('0x1'));var router=express[_0xad49('0x2')]();var fs_extra=require(_0xad49('0x3'));var auth=require(_0xad49('0x4'));var interaction=require(_0xad49('0x5'));var config=require('../../config/environment');var controller=require(_0xad49('0x6'));router[_0xad49('0x7')]('/',auth['isAuthenticated'](),controller[_0xad49('0x8')]);router[_0xad49('0x7')](_0xad49('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xad49('0x7')](_0xad49('0xa'),auth[_0xad49('0xb')](),controller[_0xad49('0xc')]);router[_0xad49('0x7')](_0xad49('0xd'),auth['isAuthenticated'](),controller[_0xad49('0xe')]);router['get'](_0xad49('0xf'),auth['isAuthenticated'](),timeout(_0xad49('0x10')),controller[_0xad49('0x11')]);router[_0xad49('0x12')]('/',auth[_0xad49('0xb')](),controller['create']);router[_0xad49('0x12')](_0xad49('0x13'),auth[_0xad49('0xb')](),controller['clone']);router[_0xad49('0x14')](_0xad49('0x9'),auth[_0xad49('0xb')](),controller['update']);router[_0xad49('0x15')](_0xad49('0x9'),auth['isAuthenticated'](),controller[_0xad49('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d3e956a..cf7afb0 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 _0xa207=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name','long','setDataValue','formData','stringify'];(function(_0x43fe7c,_0x1dc4a9){var _0x264eac=function(_0x8bf1e1){while(--_0x8bf1e1){_0x43fe7c['push'](_0x43fe7c['shift']());}};_0x264eac(++_0x1dc4a9);}(_0xa207,0x19b));var _0x7a20=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xa207[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x7a20('0x0'));var _=require(_0x7a20('0x1'));var util=require(_0x7a20('0x2'));module[_0x7a20('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x7a20('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x7a20('0x5')),'set':function(_0x462071){if(_['isObjectLike'](_0x462071)){this[_0x7a20('0x6')](_0x7a20('0x7'),JSON[_0x7a20('0x8')](_0x462071));}else if(_[_0x7a20('0x9')](_0x462071)){this[_0x7a20('0x6')](_0x7a20('0x7'),_0x462071);}else{this[_0x7a20('0x6')](_0x7a20('0x7'),util[_0x7a20('0xa')](_0x7a20('0xb'),this['getDataValue'](_0x7a20('0x4'))||'',this[_0x7a20('0xc')](_0x7a20('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7a20('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7a20('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x7724=['BOOLEAN','sequelize','lodash','util','STRING','name','long','isObjectLike','setDataValue','stringify','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x3459be,_0x394a71){var _0x525b72=function(_0x5e0810){while(--_0x5e0810){_0x3459be['push'](_0x3459be['shift']());}};_0x525b72(++_0x394a71);}(_0x7724,0x14b));var _0x4772=function(_0x125eb3,_0x4171a9){_0x125eb3=_0x125eb3-0x0;var _0x1b19c5=_0x7724[_0x125eb3];return _0x1b19c5;};'use strict';var Sequelize=require(_0x4772('0x0'));var _=require(_0x4772('0x1'));var util=require(_0x4772('0x2'));module['exports']={'name':{'type':Sequelize[_0x4772('0x3')],'unique':_0x4772('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x4772('0x5')),'set':function(_0x3bd932){if(_[_0x4772('0x6')](_0x3bd932)){this[_0x4772('0x7')]('formData',JSON[_0x4772('0x8')](_0x3bd932));}else if(_['isString'](_0x3bd932)){this[_0x4772('0x7')]('formData',_0x3bd932);}else{this[_0x4772('0x7')](_0x4772('0x9'),util[_0x4772('0xa')](_0x4772('0xb'),this[_0x4772('0xc')]('name')||'',this[_0x4772('0xc')](_0x4772('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4772('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4772('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f159acc..edd35ad 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 _0xb7aa=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','role','Projects','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','index','map','JscriptyProject','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create'];(function(_0x275472,_0x2c9de8){var _0x1490b8=function(_0x16a9a7){while(--_0x16a9a7){_0x275472['push'](_0x275472['shift']());}};_0x1490b8(++_0x2c9de8);}(_0xb7aa,0x11a));var _0xab7a=function(_0xd26c43,_0x3873a2){_0xd26c43=_0xd26c43-0x0;var _0x2978a8=_0xb7aa[_0xd26c43];return _0x2978a8;};'use strict';var emlformat=require(_0xab7a('0x0'));var rimraf=require(_0xab7a('0x1'));var zipdir=require(_0xab7a('0x2'));var jsonpatch=require(_0xab7a('0x3'));var rp=require(_0xab7a('0x4'));var moment=require(_0xab7a('0x5'));var BPromise=require(_0xab7a('0x6'));var Mustache=require(_0xab7a('0x7'));var util=require(_0xab7a('0x8'));var path=require(_0xab7a('0x9'));var sox=require('sox');var csv=require(_0xab7a('0xa'));var ejs=require(_0xab7a('0xb'));var fs=require('fs');var fs_extra=require(_0xab7a('0xc'));var _=require(_0xab7a('0xd'));var squel=require('squel');var crypto=require(_0xab7a('0xe'));var jsforce=require(_0xab7a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xab7a('0xa'));var querystring=require(_0xab7a('0x10'));var Papa=require(_0xab7a('0x11'));var Redis=require(_0xab7a('0x12'));var authService=require(_0xab7a('0x13'));var qs=require(_0xab7a('0x14'));var as=require(_0xab7a('0x15'));var hardwareService=require(_0xab7a('0x16'));var logger=require(_0xab7a('0x17'))(_0xab7a('0x18'));var utils=require('../../config/utils');var config=require(_0xab7a('0x19'));var licenseUtil=require(_0xab7a('0x1a'));var db=require(_0xab7a('0x1b'))['db'];function respondWithStatusCode(_0x45cd8e,_0x591638){_0x591638=_0x591638||0xcc;return function(_0x28e5de){if(_0x28e5de){return _0x45cd8e[_0xab7a('0x1c')](_0x591638);}return _0x45cd8e[_0xab7a('0x1d')](_0x591638)[_0xab7a('0x1e')]();};}function respondWithResult(_0x4847a0,_0x35c1b4){_0x35c1b4=_0x35c1b4||0xc8;return function(_0x1cc43f){if(_0x1cc43f){return _0x4847a0['status'](_0x35c1b4)[_0xab7a('0x1f')](_0x1cc43f);}};}function respondWithFilteredResult(_0xe7cc00,_0x1f75ba){return function(_0x8ddb0d){if(_0x8ddb0d){var _0x30146c=typeof _0x1f75ba['offset']===_0xab7a('0x20')&&typeof _0x1f75ba[_0xab7a('0x21')]==='undefined';var _0x203980=_0x8ddb0d[_0xab7a('0x22')];var _0x187f51=_0x30146c?0x0:_0x1f75ba[_0xab7a('0x23')];var _0x10b630=_0x30146c?_0x8ddb0d[_0xab7a('0x22')]:_0x1f75ba[_0xab7a('0x23')]+_0x1f75ba['limit'];var _0x41f3c0;if(_0x10b630>=_0x203980){_0x10b630=_0x203980;_0x41f3c0=0xc8;}else{_0x41f3c0=0xce;}_0xe7cc00[_0xab7a('0x1d')](_0x41f3c0);return _0xe7cc00[_0xab7a('0x24')](_0xab7a('0x25'),_0x187f51+'-'+_0x10b630+'/'+_0x203980)[_0xab7a('0x1f')](_0x8ddb0d);}return null;};}function patchUpdates(_0x37e3bc){return function(_0x2179b5){try{jsonpatch[_0xab7a('0x26')](_0x2179b5,_0x37e3bc,!![]);}catch(_0x169988){return BPromise[_0xab7a('0x27')](_0x169988);}return _0x2179b5[_0xab7a('0x28')]();};}function saveUpdates(_0x5b7ee4,_0x4b65f0){return function(_0x5c4c3e){if(_0x5c4c3e){return _0x5c4c3e[_0xab7a('0x29')](_0x5b7ee4)[_0xab7a('0x2a')](function(_0x33f484){return _0x33f484;});}return null;};}function removeEntity(_0xcc84c6,_0x41ecb5){return function(_0x8c1e1f){if(_0x8c1e1f){return _0x8c1e1f[_0xab7a('0x2b')]()['then'](function(){var _0x4d2ad4=_0x8c1e1f[_0xab7a('0x2c')]({'plain':!![]});var _0x4a13dd='Projects';return db[_0xab7a('0x2d')]['destroy']({'where':{'type':_0x4a13dd,'resourceId':_0x4d2ad4['id']}})[_0xab7a('0x2a')](function(){return _0x8c1e1f;});})[_0xab7a('0x2a')](function(){_0xcc84c6[_0xab7a('0x1d')](0xcc)[_0xab7a('0x1e')]();});}};}function handleEntityNotFound(_0x2b0885,_0x5bd2b2){return function(_0x14fbee){if(!_0x14fbee){_0x2b0885[_0xab7a('0x1c')](0x194);}return _0x14fbee;};}function handleError(_0x26c106,_0x4e4514){_0x4e4514=_0x4e4514||0x1f4;return function(_0x42f40b){logger[_0xab7a('0x2e')](_0x42f40b[_0xab7a('0x2f')]);if(_0x42f40b['name']){delete _0x42f40b['name'];}_0x26c106[_0xab7a('0x1d')](_0x4e4514)['send'](_0x42f40b);};}exports[_0xab7a('0x30')]=function(_0x3dfbaf,_0x5a1eb4){var _0x14065b={},_0x3d31a1={},_0x467dce={'count':0x0,'rows':[]};var _0x6e0d82=_[_0xab7a('0x31')](db[_0xab7a('0x32')]['rawAttributes'],function(_0x44ba02){return{'name':_0x44ba02['fieldName'],'type':_0x44ba02[_0xab7a('0x33')][_0xab7a('0x34')]};});_0x3d31a1[_0xab7a('0x35')]=_['map'](_0x6e0d82,_0xab7a('0x36'));_0x3d31a1['query']=_[_0xab7a('0x37')](_0x3dfbaf[_0xab7a('0x38')]);_0x3d31a1[_0xab7a('0x39')]=_[_0xab7a('0x3a')](_0x3d31a1[_0xab7a('0x35')],_0x3d31a1[_0xab7a('0x38')]);_0x14065b[_0xab7a('0x3b')]=_[_0xab7a('0x3a')](_0x3d31a1['model'],qs[_0xab7a('0x3c')](_0x3dfbaf[_0xab7a('0x38')][_0xab7a('0x3c')]));_0x14065b[_0xab7a('0x3b')]=_0x14065b['attributes'][_0xab7a('0x3d')]?_0x14065b[_0xab7a('0x3b')]:_0x3d31a1[_0xab7a('0x35')];if(!_0x3dfbaf['query'][_0xab7a('0x3e')](_0xab7a('0x3f'))){_0x14065b[_0xab7a('0x21')]=qs[_0xab7a('0x21')](_0x3dfbaf['query'][_0xab7a('0x21')]);_0x14065b[_0xab7a('0x23')]=qs[_0xab7a('0x23')](_0x3dfbaf['query']['offset']);}_0x14065b[_0xab7a('0x40')]=qs['sort'](_0x3dfbaf[_0xab7a('0x38')][_0xab7a('0x41')]);_0x14065b['where']=qs['filters'](_[_0xab7a('0x42')](_0x3dfbaf[_0xab7a('0x38')],_0x3d31a1[_0xab7a('0x39')]),_0x6e0d82);if(_0x3dfbaf[_0xab7a('0x38')]['filter']){_0x14065b['where']=_[_0xab7a('0x43')](_0x14065b[_0xab7a('0x44')],{'$or':_[_0xab7a('0x31')](_0x6e0d82,function(_0x42f2db){if(_0x42f2db['type']!==_0xab7a('0x45')){var _0xcac61={};_0xcac61[_0x42f2db[_0xab7a('0x36')]]={'$like':'%'+_0x3dfbaf['query'][_0xab7a('0x46')]+'%'};return _0xcac61;}})});}_0x14065b=_[_0xab7a('0x43')]({},_0x14065b,_0x3dfbaf[_0xab7a('0x47')]);var _0x9cfc25={'where':_0x14065b['where']};return db[_0xab7a('0x32')]['count'](_0x9cfc25)[_0xab7a('0x2a')](function(_0x1bf286){_0x467dce[_0xab7a('0x22')]=_0x1bf286;if(_0x3dfbaf['query'][_0xab7a('0x48')]){_0x14065b[_0xab7a('0x49')]=[{'all':!![]}];}return db[_0xab7a('0x32')][_0xab7a('0x4a')](_0x14065b);})['then'](function(_0x2ddf18){_0x467dce[_0xab7a('0x4b')]=_0x2ddf18;return _0x467dce;})[_0xab7a('0x2a')](respondWithFilteredResult(_0x5a1eb4,_0x14065b))[_0xab7a('0x4c')](handleError(_0x5a1eb4,null));};exports['show']=function(_0x111d2a,_0x5c03b5){var _0x2fe553={'raw':![],'where':{'id':_0x111d2a[_0xab7a('0x4d')]['id']}},_0x4d980a={};_0x4d980a[_0xab7a('0x35')]=_['keys'](db[_0xab7a('0x32')][_0xab7a('0x4e')]);_0x4d980a[_0xab7a('0x38')]=_[_0xab7a('0x37')](_0x111d2a[_0xab7a('0x38')]);_0x4d980a[_0xab7a('0x39')]=_['intersection'](_0x4d980a['model'],_0x4d980a[_0xab7a('0x38')]);_0x2fe553[_0xab7a('0x3b')]=_[_0xab7a('0x3a')](_0x4d980a[_0xab7a('0x35')],qs[_0xab7a('0x3c')](_0x111d2a[_0xab7a('0x38')][_0xab7a('0x3c')]));_0x2fe553[_0xab7a('0x3b')]=_0x2fe553[_0xab7a('0x3b')][_0xab7a('0x3d')]?_0x2fe553[_0xab7a('0x3b')]:_0x4d980a[_0xab7a('0x35')];if(_0x111d2a['query']['includeAll']){_0x2fe553[_0xab7a('0x49')]=[{'all':!![]}];}_0x2fe553=_[_0xab7a('0x43')]({},_0x2fe553,_0x111d2a[_0xab7a('0x47')]);return db['JscriptyProject'][_0xab7a('0x4f')](_0x2fe553)['then'](handleEntityNotFound(_0x5c03b5,null))[_0xab7a('0x2a')](respondWithResult(_0x5c03b5,null))[_0xab7a('0x4c')](handleError(_0x5c03b5,null));};exports['create']=function(_0x49438f,_0x5081e6){return db[_0xab7a('0x32')][_0xab7a('0x50')](_0x49438f['body'],{})['then'](function(_0x16bbeb){var _0x2028c5=_0x49438f[_0xab7a('0x51')][_0xab7a('0x2c')]({'plain':!![]});if(!_0x2028c5)throw new Error(_0xab7a('0x52'));if(_0x2028c5['role']==='user'){var _0x10d1ca=_0x16bbeb['get']({'plain':!![]});var _0x46486a='Projects';return db[_0xab7a('0x53')][_0xab7a('0x4f')]({'where':{'name':_0x46486a,'userProfileId':_0x2028c5[_0xab7a('0x54')]},'raw':!![]})[_0xab7a('0x2a')](function(_0x2b7f52){if(_0x2b7f52&&_0x2b7f52[_0xab7a('0x55')]===0x0){return db[_0xab7a('0x2d')][_0xab7a('0x50')]({'name':_0x10d1ca[_0xab7a('0x36')],'resourceId':_0x10d1ca['id'],'type':_0x2b7f52[_0xab7a('0x36')],'sectionId':_0x2b7f52['id']},{})[_0xab7a('0x2a')](function(){return _0x16bbeb;});}else{return _0x16bbeb;}})['catch'](function(_0x3bfdae){logger[_0xab7a('0x2e')](_0xab7a('0x56'),_0x3bfdae);throw _0x3bfdae;});}return _0x16bbeb;})[_0xab7a('0x2a')](respondWithResult(_0x5081e6,0xc9))['catch'](handleError(_0x5081e6,null));};exports['clone']=function(_0x4d6b10,_0x196a49){var _0x114dc6={'where':{'id':_0x4d6b10[_0xab7a('0x4d')]['id']}},_0x49f75e={};_0x49f75e[_0xab7a('0x35')]=_[_0xab7a('0x37')](db[_0xab7a('0x32')][_0xab7a('0x4e')]);_0x114dc6[_0xab7a('0x3b')]=_[_0xab7a('0x3a')](_0x49f75e[_0xab7a('0x35')],qs[_0xab7a('0x3c')](_0x4d6b10[_0xab7a('0x38')][_0xab7a('0x3c')]));_0x114dc6[_0xab7a('0x3b')]=_0x114dc6['attributes']['length']?_0x114dc6[_0xab7a('0x3b')]:_0x49f75e[_0xab7a('0x35')];if(_0x4d6b10[_0xab7a('0x38')]['includeAll']){_0x114dc6[_0xab7a('0x49')]=[{'all':!![]}];}_0x114dc6=_['merge']({},_0x114dc6,_0x4d6b10[_0xab7a('0x47')]);return db['JscriptyProject'][_0xab7a('0x4f')](_0x114dc6)['then'](handleEntityNotFound(_0x196a49,null))[_0xab7a('0x2a')](function(_0x392163){if(_0x392163){var _0x23c26e=_0x392163[_0xab7a('0x2c')]({'plain':!![]});_0x23c26e=qs[_0xab7a('0x57')](_0x23c26e,['id',_0xab7a('0x58'),_0xab7a('0x59')]);_0x4d6b10[_0xab7a('0x5a')]=_[_0xab7a('0x57')](_0x4d6b10['body'],['id','createdAt','updatedAt']);return db[_0xab7a('0x32')][_0xab7a('0x50')](_['merge'](_0x23c26e,_0x4d6b10[_0xab7a('0x5a')]),{'include':_0x4d6b10[_0xab7a('0x38')][_0xab7a('0x48')]?[{'all':!![]}]:undefined})[_0xab7a('0x2a')](function(_0x14fb46){var _0x107677=_0x4d6b10[_0xab7a('0x51')]['get']({'plain':!![]});if(!_0x107677)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x107677[_0xab7a('0x5b')]===_0xab7a('0x51')){var _0x2f6789=_0x14fb46[_0xab7a('0x2c')]({'plain':!![]});var _0xcd280a=_0xab7a('0x5c');return db[_0xab7a('0x53')][_0xab7a('0x4f')]({'where':{'name':_0xcd280a,'userProfileId':_0x107677[_0xab7a('0x54')]},'raw':!![]})[_0xab7a('0x2a')](function(_0x272dde){if(_0x272dde&&_0x272dde['autoAssociation']===0x0){return db[_0xab7a('0x2d')]['create']({'name':_0x2f6789[_0xab7a('0x36')],'resourceId':_0x2f6789['id'],'type':_0x272dde[_0xab7a('0x36')],'sectionId':_0x272dde['id']},{})[_0xab7a('0x2a')](function(){return _0x14fb46;});}else{return _0x14fb46;}})['catch'](function(_0x520c83){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x520c83);throw _0x520c83;});}return _0x14fb46;});}})[_0xab7a('0x2a')](respondWithResult(_0x196a49,0xc9))[_0xab7a('0x4c')](handleError(_0x196a49,null));};exports['update']=function(_0x40d487,_0xaae5c2){if(_0x40d487[_0xab7a('0x5a')]['id']){delete _0x40d487[_0xab7a('0x5a')]['id'];}return db[_0xab7a('0x32')][_0xab7a('0x4f')]({'where':{'id':_0x40d487[_0xab7a('0x4d')]['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0xaae5c2,null))[_0xab7a('0x2a')](saveUpdates(_0x40d487[_0xab7a('0x5a')],null))['then'](respondWithResult(_0xaae5c2,null))[_0xab7a('0x4c')](handleError(_0xaae5c2,null));};exports[_0xab7a('0x2b')]=function(_0x45cd4b,_0x2fa811){return db[_0xab7a('0x32')]['find']({'where':{'id':_0x45cd4b[_0xab7a('0x4d')]['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0x2fa811,null))[_0xab7a('0x2a')](removeEntity(_0x2fa811,null))['catch'](handleError(_0x2fa811,null));};exports['getSessions']=function(_0x40d4f0,_0x4cc81a,_0x26282e){var _0x5d2fb1={'raw':!![],'where':{}};var _0x143d9c={};var _0x265d51={'count':0x0,'rows':[]};return db[_0xab7a('0x32')][_0xab7a('0x5d')]({'where':{'id':_0x40d4f0[_0xab7a('0x4d')]['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0x4cc81a,null))[_0xab7a('0x2a')](function(_0x4e3431){if(_0x4e3431){_0x143d9c['model']=_[_0xab7a('0x37')](db[_0xab7a('0x5e')][_0xab7a('0x4e')]);_0x143d9c['query']=_[_0xab7a('0x37')](_0x40d4f0['query']);_0x143d9c[_0xab7a('0x39')]=_[_0xab7a('0x3a')](_0x143d9c[_0xab7a('0x35')],_0x143d9c[_0xab7a('0x38')]);_0x5d2fb1[_0xab7a('0x3b')]=_[_0xab7a('0x3a')](_0x143d9c[_0xab7a('0x35')],qs[_0xab7a('0x3c')](_0x40d4f0[_0xab7a('0x38')]['fields']));_0x5d2fb1[_0xab7a('0x3b')]=_0x5d2fb1[_0xab7a('0x3b')][_0xab7a('0x3d')]?_0x5d2fb1['attributes']:_0x143d9c[_0xab7a('0x35')];if(!_0x40d4f0[_0xab7a('0x38')][_0xab7a('0x3e')](_0xab7a('0x3f'))){_0x5d2fb1[_0xab7a('0x21')]=qs[_0xab7a('0x21')](_0x40d4f0[_0xab7a('0x38')][_0xab7a('0x21')]);_0x5d2fb1[_0xab7a('0x23')]=qs[_0xab7a('0x23')](_0x40d4f0[_0xab7a('0x38')][_0xab7a('0x23')]);}_0x5d2fb1[_0xab7a('0x40')]=qs[_0xab7a('0x41')](_0x40d4f0['query']['sort']);_0x5d2fb1[_0xab7a('0x44')]=qs[_0xab7a('0x39')](_['pick'](_0x40d4f0[_0xab7a('0x38')],_0x143d9c['filters']));_0x5d2fb1[_0xab7a('0x44')]['ProjectId']=_0x4e3431['id'];if(_0x40d4f0[_0xab7a('0x38')][_0xab7a('0x46')]){_0x5d2fb1[_0xab7a('0x44')]=_[_0xab7a('0x43')](_0x5d2fb1[_0xab7a('0x44')],{'$or':_[_0xab7a('0x31')](_0x5d2fb1[_0xab7a('0x3b')],function(_0xedf13b){var _0x57fa58={};_0x57fa58[_0xedf13b]={'$like':'%'+_0x40d4f0[_0xab7a('0x38')][_0xab7a('0x46')]+'%'};return _0x57fa58;})});}_0x5d2fb1=_['merge']({},_0x5d2fb1,_0x40d4f0[_0xab7a('0x47')]);return db[_0xab7a('0x5e')]['count']({'where':_0x5d2fb1[_0xab7a('0x44')]})['then'](function(_0x16c29f){_0x265d51[_0xab7a('0x22')]=_0x16c29f;if(_0x40d4f0['query']['includeAll']){_0x5d2fb1['include']=[{'all':!![]}];}return db[_0xab7a('0x5e')][_0xab7a('0x4a')](_0x5d2fb1);})[_0xab7a('0x2a')](function(_0x536376){_0x265d51['rows']=_0x536376;return _0x265d51;});}})[_0xab7a('0x2a')](respondWithFilteredResult(_0x4cc81a,_0x5d2fb1))[_0xab7a('0x4c')](handleError(_0x4cc81a,null));};exports[_0xab7a('0x5f')]=function(_0x4a520f,_0x2bb411,_0x39cf71){var _0x4db498={'raw':!![],'where':{}};var _0x58930a={};var _0x2ccb5c={'count':0x0,'rows':[]};return db[_0xab7a('0x32')][_0xab7a('0x5d')]({'where':{'id':_0x4a520f[_0xab7a('0x4d')]['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0x2bb411,null))[_0xab7a('0x2a')](function(_0x3f3556){if(_0x3f3556){_0x58930a[_0xab7a('0x35')]=_[_0xab7a('0x37')](db[_0xab7a('0x60')][_0xab7a('0x4e')]);_0x58930a[_0xab7a('0x38')]=_[_0xab7a('0x37')](_0x4a520f[_0xab7a('0x38')]);_0x58930a[_0xab7a('0x39')]=_[_0xab7a('0x3a')](_0x58930a[_0xab7a('0x35')],_0x58930a[_0xab7a('0x38')]);_0x4db498[_0xab7a('0x3b')]=_[_0xab7a('0x3a')](_0x58930a[_0xab7a('0x35')],qs[_0xab7a('0x3c')](_0x4a520f[_0xab7a('0x38')][_0xab7a('0x3c')]));_0x4db498[_0xab7a('0x3b')]=_0x4db498[_0xab7a('0x3b')][_0xab7a('0x3d')]?_0x4db498[_0xab7a('0x3b')]:_0x58930a[_0xab7a('0x35')];if(!_0x4a520f[_0xab7a('0x38')]['hasOwnProperty'](_0xab7a('0x3f'))){_0x4db498['limit']=qs[_0xab7a('0x21')](_0x4a520f[_0xab7a('0x38')][_0xab7a('0x21')]);_0x4db498[_0xab7a('0x23')]=qs[_0xab7a('0x23')](_0x4a520f[_0xab7a('0x38')][_0xab7a('0x23')]);}_0x4db498['order']=qs['sort'](_0x4a520f[_0xab7a('0x38')][_0xab7a('0x41')]);_0x4db498[_0xab7a('0x44')]=qs[_0xab7a('0x39')](_[_0xab7a('0x42')](_0x4a520f[_0xab7a('0x38')],_0x58930a['filters']));_0x4db498[_0xab7a('0x44')][_0xab7a('0x61')]=_0x3f3556['id'];if(_0x4a520f['query'][_0xab7a('0x46')]){_0x4db498[_0xab7a('0x44')]=_[_0xab7a('0x43')](_0x4db498['where'],{'$or':_[_0xab7a('0x31')](_0x4db498['attributes'],function(_0x16f9ee){var _0x41ad8a={};_0x41ad8a[_0x16f9ee]={'$like':'%'+_0x4a520f['query'][_0xab7a('0x46')]+'%'};return _0x41ad8a;})});}_0x4db498=_[_0xab7a('0x43')]({},_0x4db498,_0x4a520f[_0xab7a('0x47')]);return db[_0xab7a('0x60')][_0xab7a('0x22')]({'where':_0x4db498['where']})['then'](function(_0xdf83a4){_0x2ccb5c[_0xab7a('0x22')]=_0xdf83a4;if(_0x4a520f[_0xab7a('0x38')][_0xab7a('0x48')]){_0x4db498[_0xab7a('0x49')]=[{'all':!![]}];}return db[_0xab7a('0x60')][_0xab7a('0x4a')](_0x4db498);})[_0xab7a('0x2a')](function(_0x1e5ed0){_0x2ccb5c[_0xab7a('0x4b')]=_0x1e5ed0;return _0x2ccb5c;});}})[_0xab7a('0x2a')](respondWithFilteredResult(_0x2bb411,_0x4db498))['catch'](handleError(_0x2bb411,null));};function char(_0x61ef85){return _0xab7a('0x62')===typeof _0x61ef85?String[_0xab7a('0x63')][_0xab7a('0x26')](null,arguments):_0x61ef85;}function needsEncapsulation(_0x1cf7ee){return!!_0x1cf7ee&&(_0x1cf7ee[_0xab7a('0x64')]()[_0xab7a('0x65')](char(0xd))>=0x0||_0x1cf7ee['toString']()[_0xab7a('0x65')](char(0xa))>=0x0||_0x1cf7ee[_0xab7a('0x64')]()['indexOf'](char(0x2c))>=0x0||_0x1cf7ee[_0xab7a('0x64')]()[_0xab7a('0x65')](char(0x22))>=0x0);}function encapsulate(_0x11525b){var _0x2cf4a5=char(0x22),_0x46f7ce='\x5c'+char(0x22),_0xca579d=_0x11525b[_0xab7a('0x64')]()[_0xab7a('0x66')](new RegExp(_0x2cf4a5,'g'),_0x46f7ce);return _0x2cf4a5+_0xca579d+_0x2cf4a5;}exports['getSummary']=function(_0x2fe982,_0x517b3a,_0x24257a){var _0x52538e,_0x1e1bc0;var _0x48e1b2={'where':{'ProjectId':_0x2fe982[_0xab7a('0x4d')]['id']}};if(_0x2fe982[_0xab7a('0x38')][_0xab7a('0x67')]){_0x48e1b2['where'][_0xab7a('0x68')]=JSON[_0xab7a('0x69')](_0x2fe982[_0xab7a('0x38')][_0xab7a('0x67')]);}return db[_0xab7a('0x5e')][_0xab7a('0x4a')](_0x48e1b2)[_0xab7a('0x2a')](handleEntityNotFound(_0x517b3a,null))[_0xab7a('0x2a')](function(_0x4161bd){if(_0x4161bd){_0x52538e=_0x4161bd;return db[_0xab7a('0x6a')][_0xab7a('0x4a')]({'where':{'SessionId':{'$in':_[_0xab7a('0x31')](_0x52538e,'id')},'ProjectId':_0x2fe982[_0xab7a('0x4d')]['id']},'order':_0xab7a('0x6b')});}})['then'](handleEntityNotFound(_0x517b3a,null))[_0xab7a('0x2a')](function(_0x108b88){if(_0x108b88){_0x1e1bc0=_0x108b88;var _0x3348a5={};for(var _0x3fb7a5=0x0,_0x1731fc=_0x1e1bc0['length'];_0x3fb7a5<_0x1731fc;_0x3fb7a5++){if(!_0x3348a5[_0xab7a('0x3e')](_0x1e1bc0[_0x3fb7a5][_0xab7a('0x6c')])){_0x3348a5[_0x1e1bc0[_0x3fb7a5][_0xab7a('0x6c')]]=needsEncapsulation(_0x1e1bc0[_0x3fb7a5]['question'])?encapsulate(_0x1e1bc0[_0x3fb7a5][_0xab7a('0x6d')]):_0x1e1bc0[_0x3fb7a5][_0xab7a('0x6d')];}}var _0x4e3a05=[],_0x2abfe7={};for(var _0x2506b9=0x0,_0x1a3548=_0x52538e[_0xab7a('0x3d')];_0x2506b9<_0x1a3548;_0x2506b9++){_0x2abfe7={'ProjectId':_0x2fe982[_0xab7a('0x4d')]['id'],'SessionId':_0x52538e[_0x2506b9]['id'],'StartTime':moment(_0x52538e[_0x2506b9]['starttime'])[_0xab7a('0x6e')](_0xab7a('0x6f'))};for(var _0x4685ce=0x0,_0x122ce3=_0x1e1bc0['length'];_0x4685ce<_0x122ce3;_0x4685ce++){if(_0x1e1bc0[_0x4685ce][_0xab7a('0x70')]==_0x52538e[_0x2506b9]['id']&&_0x3348a5[_0xab7a('0x3e')](_0x1e1bc0[_0x4685ce][_0xab7a('0x6c')])){_0x2abfe7[_0x3348a5[_0x1e1bc0[_0x4685ce][_0xab7a('0x6c')]]]=_0x1e1bc0[_0x4685ce]['answer'];}}for(var _0x5bef94 in _0x3348a5){if(!_0x2abfe7['hasOwnProperty'](_0x3348a5[_0x5bef94])){_0x2abfe7[_0x3348a5[_0x5bef94]]=null;}}_0x4e3a05['push'](_0x2abfe7);}return _0x4e3a05;}})[_0xab7a('0x2a')](function(_0x140cf2){if(!_[_0xab7a('0x71')](_0x140cf2)){var _0x533e5b=toCsv(_0x140cf2);var _0x27e329=Date['now']();fs[_0xab7a('0x72')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2fe982[_0xab7a('0x4d')]['id'],_0x27e329),_0x533e5b);_0x517b3a[_0xab7a('0x73')](_0xab7a('0x74'),_0xab7a('0x75')+util[_0xab7a('0x6e')](_0xab7a('0x76'),_0x2fe982[_0xab7a('0x4d')]['id'],_0x27e329));_0x517b3a['setHeader'](_0xab7a('0x77'),_0xab7a('0x78'));return _0x517b3a['download'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2fe982[_0xab7a('0x4d')]['id'],_0x27e329));}else{return _0x517b3a[_0xab7a('0x1c')](0xcc);}})['catch'](handleError(_0x517b3a,null));}; \ No newline at end of file +var _0xb921=['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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','UserProfileResource','error','name','index','map','JscriptyProject','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','omit','updatedAt','createdAt','userProfileId','getSessions','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','indexOf','toString','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x355cc4,_0x1e7d69){var _0x4b740c=function(_0x5dda48){while(--_0x5dda48){_0x355cc4['push'](_0x355cc4['shift']());}};_0x4b740c(++_0x1e7d69);}(_0xb921,0x16a));var _0x1b92=function(_0x16c0a7,_0x1aa7ac){_0x16c0a7=_0x16c0a7-0x0;var _0x5e6020=_0xb921[_0x16c0a7];return _0x5e6020;};'use strict';var emlformat=require(_0x1b92('0x0'));var rimraf=require(_0x1b92('0x1'));var zipdir=require(_0x1b92('0x2'));var jsonpatch=require(_0x1b92('0x3'));var rp=require(_0x1b92('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b92('0x5'));var util=require(_0x1b92('0x6'));var path=require(_0x1b92('0x7'));var sox=require(_0x1b92('0x8'));var csv=require(_0x1b92('0x9'));var ejs=require(_0x1b92('0xa'));var fs=require('fs');var fs_extra=require(_0x1b92('0xb'));var _=require(_0x1b92('0xc'));var squel=require(_0x1b92('0xd'));var crypto=require(_0x1b92('0xe'));var jsforce=require(_0x1b92('0xf'));var deskjs=require(_0x1b92('0x10'));var toCsv=require(_0x1b92('0x9'));var querystring=require(_0x1b92('0x11'));var Papa=require(_0x1b92('0x12'));var Redis=require('ioredis');var authService=require(_0x1b92('0x13'));var qs=require(_0x1b92('0x14'));var as=require(_0x1b92('0x15'));var hardwareService=require(_0x1b92('0x16'));var logger=require(_0x1b92('0x17'))(_0x1b92('0x18'));var utils=require(_0x1b92('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1b92('0x1a'));var db=require(_0x1b92('0x1b'))['db'];function respondWithStatusCode(_0x5a1ca5,_0x81cbe0){_0x81cbe0=_0x81cbe0||0xcc;return function(_0x29a7ed){if(_0x29a7ed){return _0x5a1ca5[_0x1b92('0x1c')](_0x81cbe0);}return _0x5a1ca5[_0x1b92('0x1d')](_0x81cbe0)[_0x1b92('0x1e')]();};}function respondWithResult(_0x290be6,_0x1d33bf){_0x1d33bf=_0x1d33bf||0xc8;return function(_0x4bbb76){if(_0x4bbb76){return _0x290be6[_0x1b92('0x1d')](_0x1d33bf)['json'](_0x4bbb76);}};}function respondWithFilteredResult(_0x1a559b,_0x511a97){return function(_0x694d4f){if(_0x694d4f){var _0x523285=typeof _0x511a97[_0x1b92('0x1f')]===_0x1b92('0x20')&&typeof _0x511a97[_0x1b92('0x21')]==='undefined';var _0x2d171f=_0x694d4f[_0x1b92('0x22')];var _0x289523=_0x523285?0x0:_0x511a97[_0x1b92('0x1f')];var _0x4368dc=_0x523285?_0x694d4f['count']:_0x511a97[_0x1b92('0x1f')]+_0x511a97[_0x1b92('0x21')];var _0x30b0d8;if(_0x4368dc>=_0x2d171f){_0x4368dc=_0x2d171f;_0x30b0d8=0xc8;}else{_0x30b0d8=0xce;}_0x1a559b['status'](_0x30b0d8);return _0x1a559b[_0x1b92('0x23')](_0x1b92('0x24'),_0x289523+'-'+_0x4368dc+'/'+_0x2d171f)[_0x1b92('0x25')](_0x694d4f);}return null;};}function patchUpdates(_0x4bfc51){return function(_0x1d9d28){try{jsonpatch['apply'](_0x1d9d28,_0x4bfc51,!![]);}catch(_0x39ef4e){return BPromise[_0x1b92('0x26')](_0x39ef4e);}return _0x1d9d28['save']();};}function saveUpdates(_0x4ea25f,_0x34c5c9){return function(_0x311487){if(_0x311487){return _0x311487[_0x1b92('0x27')](_0x4ea25f)[_0x1b92('0x28')](function(_0x41fc82){return _0x41fc82;});}return null;};}function removeEntity(_0x186030,_0x48cdf1){return function(_0x3be220){if(_0x3be220){return _0x3be220[_0x1b92('0x29')]()[_0x1b92('0x28')](function(){var _0x39dcaa=_0x3be220['get']({'plain':!![]});var _0x3f0e1b='Projects';return db[_0x1b92('0x2a')][_0x1b92('0x29')]({'where':{'type':_0x3f0e1b,'resourceId':_0x39dcaa['id']}})[_0x1b92('0x28')](function(){return _0x3be220;});})[_0x1b92('0x28')](function(){_0x186030[_0x1b92('0x1d')](0xcc)[_0x1b92('0x1e')]();});}};}function handleEntityNotFound(_0xa56a28,_0x44f379){return function(_0x4edbce){if(!_0x4edbce){_0xa56a28['sendStatus'](0x194);}return _0x4edbce;};}function handleError(_0x54d92c,_0x229c44){_0x229c44=_0x229c44||0x1f4;return function(_0x525d05){logger[_0x1b92('0x2b')](_0x525d05['stack']);if(_0x525d05[_0x1b92('0x2c')]){delete _0x525d05[_0x1b92('0x2c')];}_0x54d92c[_0x1b92('0x1d')](_0x229c44)['send'](_0x525d05);};}exports[_0x1b92('0x2d')]=function(_0x6f9678,_0x55eafd){var _0x544105={},_0x477498={},_0x3740e1={'count':0x0,'rows':[]};var _0x165f93=_[_0x1b92('0x2e')](db[_0x1b92('0x2f')]['rawAttributes'],function(_0x1f38f3){return{'name':_0x1f38f3[_0x1b92('0x30')],'type':_0x1f38f3[_0x1b92('0x31')][_0x1b92('0x32')]};});_0x477498[_0x1b92('0x33')]=_[_0x1b92('0x2e')](_0x165f93,_0x1b92('0x2c'));_0x477498['query']=_[_0x1b92('0x34')](_0x6f9678[_0x1b92('0x35')]);_0x477498['filters']=_[_0x1b92('0x36')](_0x477498[_0x1b92('0x33')],_0x477498[_0x1b92('0x35')]);_0x544105['attributes']=_[_0x1b92('0x36')](_0x477498[_0x1b92('0x33')],qs['fields'](_0x6f9678['query'][_0x1b92('0x37')]));_0x544105[_0x1b92('0x38')]=_0x544105[_0x1b92('0x38')][_0x1b92('0x39')]?_0x544105['attributes']:_0x477498['model'];if(!_0x6f9678['query'][_0x1b92('0x3a')](_0x1b92('0x3b'))){_0x544105[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x21')]);_0x544105[_0x1b92('0x1f')]=qs['offset'](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x544105['order']=qs[_0x1b92('0x3c')](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x544105[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x6f9678[_0x1b92('0x35')],_0x477498[_0x1b92('0x3e')]),_0x165f93);if(_0x6f9678[_0x1b92('0x35')][_0x1b92('0x40')]){_0x544105['where']=_[_0x1b92('0x41')](_0x544105['where'],{'$or':_[_0x1b92('0x2e')](_0x165f93,function(_0x588b3c){if(_0x588b3c[_0x1b92('0x31')]!==_0x1b92('0x42')){var _0x25e709={};_0x25e709[_0x588b3c[_0x1b92('0x2c')]]={'$like':'%'+_0x6f9678[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x25e709;}})});}_0x544105=_[_0x1b92('0x41')]({},_0x544105,_0x6f9678[_0x1b92('0x43')]);var _0x46b06b={'where':_0x544105['where']};return db[_0x1b92('0x2f')]['count'](_0x46b06b)[_0x1b92('0x28')](function(_0x1e945){_0x3740e1[_0x1b92('0x22')]=_0x1e945;if(_0x6f9678[_0x1b92('0x35')]['includeAll']){_0x544105[_0x1b92('0x44')]=[{'all':!![]}];}return db[_0x1b92('0x2f')][_0x1b92('0x45')](_0x544105);})[_0x1b92('0x28')](function(_0xd3f7b0){_0x3740e1[_0x1b92('0x46')]=_0xd3f7b0;return _0x3740e1;})['then'](respondWithFilteredResult(_0x55eafd,_0x544105))[_0x1b92('0x47')](handleError(_0x55eafd,null));};exports[_0x1b92('0x48')]=function(_0x2dcd14,_0x1cb316){var _0x3f77c3={'raw':![],'where':{'id':_0x2dcd14['params']['id']}},_0x2bb12f={};_0x2bb12f[_0x1b92('0x33')]=_[_0x1b92('0x34')](db['JscriptyProject'][_0x1b92('0x49')]);_0x2bb12f['query']=_[_0x1b92('0x34')](_0x2dcd14[_0x1b92('0x35')]);_0x2bb12f[_0x1b92('0x3e')]=_['intersection'](_0x2bb12f[_0x1b92('0x33')],_0x2bb12f[_0x1b92('0x35')]);_0x3f77c3['attributes']=_['intersection'](_0x2bb12f['model'],qs[_0x1b92('0x37')](_0x2dcd14[_0x1b92('0x35')][_0x1b92('0x37')]));_0x3f77c3[_0x1b92('0x38')]=_0x3f77c3[_0x1b92('0x38')][_0x1b92('0x39')]?_0x3f77c3['attributes']:_0x2bb12f[_0x1b92('0x33')];if(_0x2dcd14[_0x1b92('0x35')]['includeAll']){_0x3f77c3[_0x1b92('0x44')]=[{'all':!![]}];}_0x3f77c3=_[_0x1b92('0x41')]({},_0x3f77c3,_0x2dcd14[_0x1b92('0x43')]);return db['JscriptyProject'][_0x1b92('0x4a')](_0x3f77c3)[_0x1b92('0x28')](handleEntityNotFound(_0x1cb316,null))[_0x1b92('0x28')](respondWithResult(_0x1cb316,null))[_0x1b92('0x47')](handleError(_0x1cb316,null));};exports[_0x1b92('0x4b')]=function(_0x5ac096,_0x142d28){return db[_0x1b92('0x2f')][_0x1b92('0x4b')](_0x5ac096[_0x1b92('0x4c')],{})[_0x1b92('0x28')](function(_0x515292){var _0x5c5ebf=_0x5ac096[_0x1b92('0x4d')][_0x1b92('0x4e')]({'plain':!![]});if(!_0x5c5ebf)throw new Error(_0x1b92('0x4f'));if(_0x5c5ebf[_0x1b92('0x50')]==='user'){var _0x4e0954=_0x515292[_0x1b92('0x4e')]({'plain':!![]});var _0x5e10fa=_0x1b92('0x51');return db[_0x1b92('0x52')][_0x1b92('0x4a')]({'where':{'name':_0x5e10fa,'userProfileId':_0x5c5ebf['userProfileId']},'raw':!![]})[_0x1b92('0x28')](function(_0x559e3c){if(_0x559e3c&&_0x559e3c[_0x1b92('0x53')]===0x0){return db[_0x1b92('0x2a')][_0x1b92('0x4b')]({'name':_0x4e0954[_0x1b92('0x2c')],'resourceId':_0x4e0954['id'],'type':_0x559e3c[_0x1b92('0x2c')],'sectionId':_0x559e3c['id']},{})[_0x1b92('0x28')](function(){return _0x515292;});}else{return _0x515292;}})['catch'](function(_0x140202){logger['error'](_0x1b92('0x54'),_0x140202);throw _0x140202;});}return _0x515292;})[_0x1b92('0x28')](respondWithResult(_0x142d28,0xc9))[_0x1b92('0x47')](handleError(_0x142d28,null));};exports[_0x1b92('0x55')]=function(_0x376a9c,_0x3cab8e){var _0x306395={'where':{'id':_0x376a9c[_0x1b92('0x56')]['id']}},_0x32d994={};_0x32d994[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x2f')][_0x1b92('0x49')]);_0x306395[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x32d994[_0x1b92('0x33')],qs[_0x1b92('0x37')](_0x376a9c[_0x1b92('0x35')][_0x1b92('0x37')]));_0x306395[_0x1b92('0x38')]=_0x306395['attributes'][_0x1b92('0x39')]?_0x306395[_0x1b92('0x38')]:_0x32d994['model'];if(_0x376a9c[_0x1b92('0x35')][_0x1b92('0x57')]){_0x306395['include']=[{'all':!![]}];}_0x306395=_['merge']({},_0x306395,_0x376a9c[_0x1b92('0x43')]);return db[_0x1b92('0x2f')]['find'](_0x306395)[_0x1b92('0x28')](handleEntityNotFound(_0x3cab8e,null))[_0x1b92('0x28')](function(_0x1519d7){if(_0x1519d7){var _0x33069d=_0x1519d7[_0x1b92('0x4e')]({'plain':!![]});_0x33069d=qs[_0x1b92('0x58')](_0x33069d,['id','createdAt',_0x1b92('0x59')]);_0x376a9c['body']=_['omit'](_0x376a9c[_0x1b92('0x4c')],['id',_0x1b92('0x5a'),_0x1b92('0x59')]);return db[_0x1b92('0x2f')][_0x1b92('0x4b')](_[_0x1b92('0x41')](_0x33069d,_0x376a9c[_0x1b92('0x4c')]),{'include':_0x376a9c[_0x1b92('0x35')][_0x1b92('0x57')]?[{'all':!![]}]:undefined})[_0x1b92('0x28')](function(_0x587956){var _0x3ad925=_0x376a9c[_0x1b92('0x4d')][_0x1b92('0x4e')]({'plain':!![]});if(!_0x3ad925)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ad925['role']===_0x1b92('0x4d')){var _0x1b5c91=_0x587956[_0x1b92('0x4e')]({'plain':!![]});var _0x456f8c=_0x1b92('0x51');return db[_0x1b92('0x52')][_0x1b92('0x4a')]({'where':{'name':_0x456f8c,'userProfileId':_0x3ad925[_0x1b92('0x5b')]},'raw':!![]})[_0x1b92('0x28')](function(_0x406dd4){if(_0x406dd4&&_0x406dd4[_0x1b92('0x53')]===0x0){return db[_0x1b92('0x2a')]['create']({'name':_0x1b5c91[_0x1b92('0x2c')],'resourceId':_0x1b5c91['id'],'type':_0x406dd4[_0x1b92('0x2c')],'sectionId':_0x406dd4['id']},{})['then'](function(){return _0x587956;});}else{return _0x587956;}})[_0x1b92('0x47')](function(_0x46d1e9){logger['error'](_0x1b92('0x54'),_0x46d1e9);throw _0x46d1e9;});}return _0x587956;});}})[_0x1b92('0x28')](respondWithResult(_0x3cab8e,0xc9))[_0x1b92('0x47')](handleError(_0x3cab8e,null));};exports[_0x1b92('0x27')]=function(_0x2540d2,_0x590426){if(_0x2540d2['body']['id']){delete _0x2540d2['body']['id'];}return db['JscriptyProject'][_0x1b92('0x4a')]({'where':{'id':_0x2540d2[_0x1b92('0x56')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x590426,null))[_0x1b92('0x28')](saveUpdates(_0x2540d2['body'],null))[_0x1b92('0x28')](respondWithResult(_0x590426,null))[_0x1b92('0x47')](handleError(_0x590426,null));};exports['destroy']=function(_0x31977e,_0x51a2a1){return db['JscriptyProject'][_0x1b92('0x4a')]({'where':{'id':_0x31977e['params']['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x51a2a1,null))[_0x1b92('0x28')](removeEntity(_0x51a2a1,null))[_0x1b92('0x47')](handleError(_0x51a2a1,null));};exports[_0x1b92('0x5c')]=function(_0x197a4b,_0xd092bb,_0x5b408e){var _0x1e5951={'raw':!![],'where':{}};var _0x1bab85={};var _0xc0a853={'count':0x0,'rows':[]};return db[_0x1b92('0x2f')][_0x1b92('0x5d')]({'where':{'id':_0x197a4b['params']['id']}})['then'](handleEntityNotFound(_0xd092bb,null))[_0x1b92('0x28')](function(_0x22e1b2){if(_0x22e1b2){_0x1bab85[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x5e')][_0x1b92('0x49')]);_0x1bab85[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0x197a4b[_0x1b92('0x35')]);_0x1bab85['filters']=_[_0x1b92('0x36')](_0x1bab85[_0x1b92('0x33')],_0x1bab85[_0x1b92('0x35')]);_0x1e5951[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x1bab85[_0x1b92('0x33')],qs[_0x1b92('0x37')](_0x197a4b['query'][_0x1b92('0x37')]));_0x1e5951['attributes']=_0x1e5951['attributes'][_0x1b92('0x39')]?_0x1e5951[_0x1b92('0x38')]:_0x1bab85[_0x1b92('0x33')];if(!_0x197a4b[_0x1b92('0x35')]['hasOwnProperty']('nolimit')){_0x1e5951[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x197a4b['query'][_0x1b92('0x21')]);_0x1e5951[_0x1b92('0x1f')]=qs[_0x1b92('0x1f')](_0x197a4b[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x1e5951[_0x1b92('0x5f')]=qs['sort'](_0x197a4b[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x1e5951[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x197a4b['query'],_0x1bab85[_0x1b92('0x3e')]));_0x1e5951[_0x1b92('0x3d')][_0x1b92('0x60')]=_0x22e1b2['id'];if(_0x197a4b[_0x1b92('0x35')]['filter']){_0x1e5951[_0x1b92('0x3d')]=_[_0x1b92('0x41')](_0x1e5951['where'],{'$or':_[_0x1b92('0x2e')](_0x1e5951[_0x1b92('0x38')],function(_0x23958a){var _0x2fb82b={};_0x2fb82b[_0x23958a]={'$like':'%'+_0x197a4b[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x2fb82b;})});}_0x1e5951=_['merge']({},_0x1e5951,_0x197a4b[_0x1b92('0x43')]);return db[_0x1b92('0x5e')][_0x1b92('0x22')]({'where':_0x1e5951[_0x1b92('0x3d')]})[_0x1b92('0x28')](function(_0x2fa5d9){_0xc0a853[_0x1b92('0x22')]=_0x2fa5d9;if(_0x197a4b['query'][_0x1b92('0x57')]){_0x1e5951[_0x1b92('0x44')]=[{'all':!![]}];}return db[_0x1b92('0x5e')]['findAll'](_0x1e5951);})[_0x1b92('0x28')](function(_0x17bde5){_0xc0a853[_0x1b92('0x46')]=_0x17bde5;return _0xc0a853;});}})[_0x1b92('0x28')](respondWithFilteredResult(_0xd092bb,_0x1e5951))[_0x1b92('0x47')](handleError(_0xd092bb,null));};exports[_0x1b92('0x61')]=function(_0x685d82,_0x452284,_0x5c6586){var _0x334e3a={'raw':!![],'where':{}};var _0x558978={};var _0x22b84e={'count':0x0,'rows':[]};return db[_0x1b92('0x2f')][_0x1b92('0x5d')]({'where':{'id':_0x685d82[_0x1b92('0x56')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x452284,null))['then'](function(_0x1b74f3){if(_0x1b74f3){_0x558978[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x62')][_0x1b92('0x49')]);_0x558978[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0x685d82[_0x1b92('0x35')]);_0x558978[_0x1b92('0x3e')]=_[_0x1b92('0x36')](_0x558978['model'],_0x558978[_0x1b92('0x35')]);_0x334e3a[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x558978['model'],qs[_0x1b92('0x37')](_0x685d82[_0x1b92('0x35')]['fields']));_0x334e3a[_0x1b92('0x38')]=_0x334e3a['attributes'][_0x1b92('0x39')]?_0x334e3a['attributes']:_0x558978['model'];if(!_0x685d82['query'][_0x1b92('0x3a')](_0x1b92('0x3b'))){_0x334e3a[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x685d82[_0x1b92('0x35')]['limit']);_0x334e3a[_0x1b92('0x1f')]=qs[_0x1b92('0x1f')](_0x685d82[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x334e3a[_0x1b92('0x5f')]=qs['sort'](_0x685d82[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x334e3a[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x685d82[_0x1b92('0x35')],_0x558978[_0x1b92('0x3e')]));_0x334e3a[_0x1b92('0x3d')]['ProjectId']=_0x1b74f3['id'];if(_0x685d82[_0x1b92('0x35')]['filter']){_0x334e3a[_0x1b92('0x3d')]=_['merge'](_0x334e3a[_0x1b92('0x3d')],{'$or':_[_0x1b92('0x2e')](_0x334e3a['attributes'],function(_0xb08603){var _0x21466a={};_0x21466a[_0xb08603]={'$like':'%'+_0x685d82[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x21466a;})});}_0x334e3a=_[_0x1b92('0x41')]({},_0x334e3a,_0x685d82[_0x1b92('0x43')]);return db[_0x1b92('0x62')][_0x1b92('0x22')]({'where':_0x334e3a[_0x1b92('0x3d')]})['then'](function(_0x159bc8){_0x22b84e[_0x1b92('0x22')]=_0x159bc8;if(_0x685d82[_0x1b92('0x35')]['includeAll']){_0x334e3a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x334e3a);})[_0x1b92('0x28')](function(_0x22ea06){_0x22b84e[_0x1b92('0x46')]=_0x22ea06;return _0x22b84e;});}})['then'](respondWithFilteredResult(_0x452284,_0x334e3a))[_0x1b92('0x47')](handleError(_0x452284,null));};function char(_0x121aac){return _0x1b92('0x63')===typeof _0x121aac?String[_0x1b92('0x64')][_0x1b92('0x65')](null,arguments):_0x121aac;}function needsEncapsulation(_0x341b0d){return!!_0x341b0d&&(_0x341b0d['toString']()[_0x1b92('0x66')](char(0xd))>=0x0||_0x341b0d[_0x1b92('0x67')]()[_0x1b92('0x66')](char(0xa))>=0x0||_0x341b0d['toString']()[_0x1b92('0x66')](char(0x2c))>=0x0||_0x341b0d[_0x1b92('0x67')]()[_0x1b92('0x66')](char(0x22))>=0x0);}function encapsulate(_0x41b264){var _0x550cb4=char(0x22),_0x4d8dd1='\x5c'+char(0x22),_0x9fd44d=_0x41b264[_0x1b92('0x67')]()[_0x1b92('0x68')](new RegExp(_0x550cb4,'g'),_0x4d8dd1);return _0x550cb4+_0x9fd44d+_0x550cb4;}exports[_0x1b92('0x69')]=function(_0x2624ef,_0x5befe5,_0x43f256){var _0xf2629a,_0x40b0a3;var _0x186d97={'where':{'ProjectId':_0x2624ef[_0x1b92('0x56')]['id']}};if(_0x2624ef[_0x1b92('0x35')][_0x1b92('0x6a')]){_0x186d97[_0x1b92('0x3d')][_0x1b92('0x6b')]=JSON[_0x1b92('0x6c')](_0x2624ef[_0x1b92('0x35')][_0x1b92('0x6a')]);}return db[_0x1b92('0x5e')][_0x1b92('0x45')](_0x186d97)['then'](handleEntityNotFound(_0x5befe5,null))[_0x1b92('0x28')](function(_0x3ab527){if(_0x3ab527){_0xf2629a=_0x3ab527;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_['map'](_0xf2629a,'id')},'ProjectId':_0x2624ef[_0x1b92('0x56')]['id']},'order':_0x1b92('0x6d')});}})['then'](handleEntityNotFound(_0x5befe5,null))[_0x1b92('0x28')](function(_0x37c820){if(_0x37c820){_0x40b0a3=_0x37c820;var _0x319aca={};for(var _0x51133b=0x0,_0xdfaaff=_0x40b0a3[_0x1b92('0x39')];_0x51133b<_0xdfaaff;_0x51133b++){if(!_0x319aca[_0x1b92('0x3a')](_0x40b0a3[_0x51133b][_0x1b92('0x6e')])){_0x319aca[_0x40b0a3[_0x51133b][_0x1b92('0x6e')]]=needsEncapsulation(_0x40b0a3[_0x51133b][_0x1b92('0x6f')])?encapsulate(_0x40b0a3[_0x51133b]['question']):_0x40b0a3[_0x51133b][_0x1b92('0x6f')];}}var _0x172083=[],_0x1d7232={};for(var _0x51cd82=0x0,_0x418a0c=_0xf2629a[_0x1b92('0x39')];_0x51cd82<_0x418a0c;_0x51cd82++){_0x1d7232={'ProjectId':_0x2624ef['params']['id'],'SessionId':_0xf2629a[_0x51cd82]['id'],'StartTime':moment(_0xf2629a[_0x51cd82][_0x1b92('0x6b')])[_0x1b92('0x70')](_0x1b92('0x71'))};for(var _0x2b3fa0=0x0,_0x7e13b0=_0x40b0a3[_0x1b92('0x39')];_0x2b3fa0<_0x7e13b0;_0x2b3fa0++){if(_0x40b0a3[_0x2b3fa0][_0x1b92('0x72')]==_0xf2629a[_0x51cd82]['id']&&_0x319aca[_0x1b92('0x3a')](_0x40b0a3[_0x2b3fa0]['questionId'])){_0x1d7232[_0x319aca[_0x40b0a3[_0x2b3fa0][_0x1b92('0x6e')]]]=_0x40b0a3[_0x2b3fa0]['answer'];}}for(var _0x34ad43 in _0x319aca){if(!_0x1d7232['hasOwnProperty'](_0x319aca[_0x34ad43])){_0x1d7232[_0x319aca[_0x34ad43]]=null;}}_0x172083[_0x1b92('0x73')](_0x1d7232);}return _0x172083;}})[_0x1b92('0x28')](function(_0x1bbdb1){if(!_[_0x1b92('0x74')](_0x1bbdb1)){var _0x1b4733=toCsv(_0x1bbdb1);var _0x3573fb=Date['now']();fs[_0x1b92('0x75')](util[_0x1b92('0x70')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2624ef[_0x1b92('0x56')]['id'],_0x3573fb),_0x1b4733);_0x5befe5[_0x1b92('0x76')](_0x1b92('0x77'),_0x1b92('0x78')+util['format'](_0x1b92('0x79'),_0x2624ef[_0x1b92('0x56')]['id'],_0x3573fb));_0x5befe5[_0x1b92('0x76')](_0x1b92('0x7a'),_0x1b92('0x7b'));return _0x5befe5['download'](util[_0x1b92('0x70')](_0x1b92('0x7c'),_0x2624ef['params']['id'],_0x3573fb));}else{return _0x5befe5[_0x1b92('0x1c')](0xcc);}})['catch'](handleError(_0x5befe5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index add0d0d..84261f0 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 _0x56da=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x353410,_0x479602){var _0x24a1ec=function(_0x54b3f6){while(--_0x54b3f6){_0x353410['push'](_0x353410['shift']());}};_0x24a1ec(++_0x479602);}(_0x56da,0x119));var _0xa56d=function(_0x426711,_0x12264c){_0x426711=_0x426711-0x0;var _0x592991=_0x56da[_0x426711];return _0x592991;};'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 +var _0x39b3=['define','JscriptyProject','jscripty_projects','lodash','api','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x31ed41,_0x223f14){var _0x349a3d=function(_0x1cd0ef){while(--_0x1cd0ef){_0x31ed41['push'](_0x31ed41['shift']());}};_0x349a3d(++_0x223f14);}(_0x39b3,0xc9));var _0x339b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x39b3[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x339b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x339b('0x1'));var moment=require('moment');var BPromise=require(_0x339b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x339b('0x3'));var rimraf=require(_0x339b('0x4'));var config=require(_0x339b('0x5'));var attributes=require(_0x339b('0x6'));module[_0x339b('0x7')]=function(_0x3021b1,_0x2394e2){return _0x3021b1[_0x339b('0x8')](_0x339b('0x9'),attributes,{'tableName':_0x339b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 7213dba..7666821 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x2aefff,_0x26a24b){var _0x4e4534=function(_0x592416){while(--_0x592416){_0x2aefff['push'](_0x2aefff['shift']());}};_0x4e4534(++_0x26a24b);}(_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);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0xda3f,0xec));var _0xfda3=function(_0x3ac89d,_0x14e082){_0x3ac89d=_0x3ac89d-0x0;var _0x454fb7=_0xda3f[_0x3ac89d];return _0x454fb7;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b1aee19..01553aa 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 _0xe5f0=['./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14f9f9,_0x531bbf){var _0x55ab80=function(_0x4b29fb){while(--_0x4b29fb){_0x14f9f9['push'](_0x14f9f9['shift']());}};_0x55ab80(++_0x531bbf);}(_0xe5f0,0x1f0));var _0x0e5f=function(_0x416e2a,_0x13c0ab){_0x416e2a=_0x416e2a-0x0;var _0x2610a9=_0xe5f0[_0x416e2a];return _0x2610a9;};'use strict';var multer=require('multer');var util=require(_0x0e5f('0x0'));var path=require('path');var timeout=require(_0x0e5f('0x1'));var express=require(_0x0e5f('0x2'));var router=express[_0x0e5f('0x3')]();var fs_extra=require(_0x0e5f('0x4'));var auth=require(_0x0e5f('0x5'));var interaction=require(_0x0e5f('0x6'));var config=require(_0x0e5f('0x7'));var controller=require(_0x0e5f('0x8'));router['get']('/',auth[_0x0e5f('0x9')](),controller[_0x0e5f('0xa')]);router[_0x0e5f('0xb')](_0x0e5f('0xc'),auth[_0x0e5f('0x9')](),controller[_0x0e5f('0xd')]);router[_0x0e5f('0xb')](_0x0e5f('0xe'),auth[_0x0e5f('0x9')](),controller[_0x0e5f('0xf')]);router[_0x0e5f('0x10')]('/',auth['isAuthenticated'](),controller[_0x0e5f('0x11')]);router['put'](_0x0e5f('0xe'),auth[_0x0e5f('0x9')](),controller[_0x0e5f('0x12')]);router['delete'](_0x0e5f('0xe'),auth[_0x0e5f('0x9')](),controller[_0x0e5f('0x13')]);module[_0x0e5f('0x14')]=router; \ No newline at end of file +var _0xeb5b=['delete','util','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put'];(function(_0x4387e5,_0x186f86){var _0xe4f03c=function(_0x5c8242){while(--_0x5c8242){_0x4387e5['push'](_0x4387e5['shift']());}};_0xe4f03c(++_0x186f86);}(_0xeb5b,0xa1));var _0xbeb5=function(_0x3227b7,_0x5922b5){_0x3227b7=_0x3227b7-0x0;var _0x258c38=_0xeb5b[_0x3227b7];return _0x258c38;};'use strict';var multer=require('multer');var util=require(_0xbeb5('0x0'));var path=require(_0xbeb5('0x1'));var timeout=require(_0xbeb5('0x2'));var express=require(_0xbeb5('0x3'));var router=express[_0xbeb5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbeb5('0x5'));var config=require('../../config/environment');var controller=require(_0xbeb5('0x6'));router[_0xbeb5('0x7')]('/',auth[_0xbeb5('0x8')](),controller['index']);router[_0xbeb5('0x7')](_0xbeb5('0x9'),auth[_0xbeb5('0x8')](),controller[_0xbeb5('0xa')]);router[_0xbeb5('0x7')](_0xbeb5('0xb'),auth[_0xbeb5('0x8')](),controller[_0xbeb5('0xc')]);router['post']('/',auth[_0xbeb5('0x8')](),controller[_0xbeb5('0xd')]);router[_0xbeb5('0xe')](_0xbeb5('0xb'),auth[_0xbeb5('0x8')](),controller['update']);router[_0xbeb5('0xf')](_0xbeb5('0xb'),auth[_0xbeb5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index bdcd254..d11e421 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x1f2830,_0x51e9cf){_0x1f2830=_0x1f2830-0x0;var _0x4fbcdf=_0x7a54[_0x1f2830];return _0x4fbcdf;};'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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x4d24dc,_0x32ba81){_0x4d24dc=_0x4d24dc-0x0;var _0x5dbc30=_0x7a54[_0x4d24dc];return _0x5dbc30;};'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 fd6ac94..5f7de1b 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 _0xeff4=['find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params'];(function(_0x6f6685,_0x2b71e6){var _0x80a30f=function(_0x40d9c8){while(--_0x40d9c8){_0x6f6685['push'](_0x6f6685['shift']());}};_0x80a30f(++_0x2b71e6);}(_0xeff4,0xe5));var _0x4eff=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0xeff4[_0x4599b6];return _0x2e014c;};'use strict';var emlformat=require(_0x4eff('0x0'));var rimraf=require(_0x4eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4eff('0x2'));var moment=require(_0x4eff('0x3'));var BPromise=require(_0x4eff('0x4'));var Mustache=require(_0x4eff('0x5'));var util=require('util');var path=require(_0x4eff('0x6'));var sox=require(_0x4eff('0x7'));var csv=require(_0x4eff('0x8'));var ejs=require(_0x4eff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eff('0xa'));var squel=require(_0x4eff('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4eff('0xc'));var toCsv=require(_0x4eff('0x8'));var querystring=require(_0x4eff('0xd'));var Papa=require(_0x4eff('0xe'));var Redis=require(_0x4eff('0xf'));var authService=require(_0x4eff('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4eff('0x11'));var hardwareService=require(_0x4eff('0x12'));var logger=require(_0x4eff('0x13'))(_0x4eff('0x14'));var utils=require(_0x4eff('0x15'));var config=require(_0x4eff('0x16'));var licenseUtil=require(_0x4eff('0x17'));var db=require(_0x4eff('0x18'))['db'];function respondWithStatusCode(_0x31d4bf,_0x534351){_0x534351=_0x534351||0xcc;return function(_0x5d4d17){if(_0x5d4d17){return _0x31d4bf[_0x4eff('0x19')](_0x534351);}return _0x31d4bf[_0x4eff('0x1a')](_0x534351)[_0x4eff('0x1b')]();};}function respondWithResult(_0x30569e,_0x1d6c71){_0x1d6c71=_0x1d6c71||0xc8;return function(_0x5edbc7){if(_0x5edbc7){return _0x30569e[_0x4eff('0x1a')](_0x1d6c71)[_0x4eff('0x1c')](_0x5edbc7);}};}function respondWithFilteredResult(_0x4b2207,_0x463e0e){return function(_0xdd9201){if(_0xdd9201){var _0x44e7fc=typeof _0x463e0e[_0x4eff('0x1d')]===_0x4eff('0x1e')&&typeof _0x463e0e['limit']===_0x4eff('0x1e');var _0x1d7bcd=_0xdd9201[_0x4eff('0x1f')];var _0x218468=_0x44e7fc?0x0:_0x463e0e['offset'];var _0x314d20=_0x44e7fc?_0xdd9201['count']:_0x463e0e[_0x4eff('0x1d')]+_0x463e0e[_0x4eff('0x20')];var _0x508569;if(_0x314d20>=_0x1d7bcd){_0x314d20=_0x1d7bcd;_0x508569=0xc8;}else{_0x508569=0xce;}_0x4b2207[_0x4eff('0x1a')](_0x508569);return _0x4b2207[_0x4eff('0x21')](_0x4eff('0x22'),_0x218468+'-'+_0x314d20+'/'+_0x1d7bcd)[_0x4eff('0x1c')](_0xdd9201);}return null;};}function patchUpdates(_0x2647b2){return function(_0xa0e712){try{jsonpatch[_0x4eff('0x23')](_0xa0e712,_0x2647b2,!![]);}catch(_0x39b038){return BPromise[_0x4eff('0x24')](_0x39b038);}return _0xa0e712[_0x4eff('0x25')]();};}function saveUpdates(_0x1c3cf7,_0x4a5fdc){return function(_0xcc607f){if(_0xcc607f){return _0xcc607f[_0x4eff('0x26')](_0x1c3cf7)['then'](function(_0x2535a8){return _0x2535a8;});}return null;};}function removeEntity(_0x53b3f0,_0x2d9db4){return function(_0x2dc480){if(_0x2dc480){return _0x2dc480[_0x4eff('0x27')]()[_0x4eff('0x28')](function(){_0x53b3f0[_0x4eff('0x1a')](0xcc)[_0x4eff('0x1b')]();});}};}function handleEntityNotFound(_0x3483ac,_0x37bfb0){return function(_0x53cc84){if(!_0x53cc84){_0x3483ac[_0x4eff('0x19')](0x194);}return _0x53cc84;};}function handleError(_0x574378,_0x5a9523){_0x5a9523=_0x5a9523||0x1f4;return function(_0x46b541){logger[_0x4eff('0x29')](_0x46b541['stack']);if(_0x46b541[_0x4eff('0x2a')]){delete _0x46b541[_0x4eff('0x2a')];}_0x574378[_0x4eff('0x1a')](_0x5a9523)[_0x4eff('0x2b')](_0x46b541);};}exports['index']=function(_0x4f097a,_0x49a020){var _0x3f05e2={},_0x2dd357={},_0x3a18d6={'count':0x0,'rows':[]};var _0x31dddd=_['map'](db['JscriptyQuestionReport'][_0x4eff('0x2c')],function(_0x4ba8e4){return{'name':_0x4ba8e4[_0x4eff('0x2d')],'type':_0x4ba8e4[_0x4eff('0x2e')]['key']};});_0x2dd357['model']=_['map'](_0x31dddd,_0x4eff('0x2a'));_0x2dd357['query']=_[_0x4eff('0x2f')](_0x4f097a[_0x4eff('0x30')]);_0x2dd357[_0x4eff('0x31')]=_[_0x4eff('0x32')](_0x2dd357[_0x4eff('0x33')],_0x2dd357['query']);_0x3f05e2['attributes']=_['intersection'](_0x2dd357['model'],qs[_0x4eff('0x34')](_0x4f097a[_0x4eff('0x30')][_0x4eff('0x34')]));_0x3f05e2[_0x4eff('0x35')]=_0x3f05e2[_0x4eff('0x35')]['length']?_0x3f05e2[_0x4eff('0x35')]:_0x2dd357[_0x4eff('0x33')];if(!_0x4f097a['query'][_0x4eff('0x36')](_0x4eff('0x37'))){_0x3f05e2['limit']=qs[_0x4eff('0x20')](_0x4f097a[_0x4eff('0x30')][_0x4eff('0x20')]);_0x3f05e2[_0x4eff('0x1d')]=qs[_0x4eff('0x1d')](_0x4f097a[_0x4eff('0x30')][_0x4eff('0x1d')]);}_0x3f05e2[_0x4eff('0x38')]=qs[_0x4eff('0x39')](_0x4f097a[_0x4eff('0x30')][_0x4eff('0x39')]);_0x3f05e2[_0x4eff('0x3a')]=qs[_0x4eff('0x31')](_[_0x4eff('0x3b')](_0x4f097a[_0x4eff('0x30')],_0x2dd357[_0x4eff('0x31')]),_0x31dddd);if(_0x4f097a['query'][_0x4eff('0x3c')]){_0x3f05e2[_0x4eff('0x3a')]=_[_0x4eff('0x3d')](_0x3f05e2[_0x4eff('0x3a')],{'$or':_['map'](_0x31dddd,function(_0x373337){if(_0x373337[_0x4eff('0x2e')]!==_0x4eff('0x3e')){var _0x114317={};_0x114317[_0x373337[_0x4eff('0x2a')]]={'$like':'%'+_0x4f097a[_0x4eff('0x30')][_0x4eff('0x3c')]+'%'};return _0x114317;}})});}_0x3f05e2=_['merge']({},_0x3f05e2,_0x4f097a['options']);var _0x4458f8={'where':_0x3f05e2[_0x4eff('0x3a')]};return db[_0x4eff('0x3f')][_0x4eff('0x1f')](_0x4458f8)[_0x4eff('0x28')](function(_0x4bc54a){_0x3a18d6[_0x4eff('0x1f')]=_0x4bc54a;if(_0x4f097a[_0x4eff('0x30')][_0x4eff('0x40')]){_0x3f05e2[_0x4eff('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x4eff('0x42')](_0x3f05e2);})[_0x4eff('0x28')](function(_0x56ae8a){_0x3a18d6[_0x4eff('0x43')]=_0x56ae8a;return _0x3a18d6;})[_0x4eff('0x28')](respondWithFilteredResult(_0x49a020,_0x3f05e2))[_0x4eff('0x44')](handleError(_0x49a020,null));};exports[_0x4eff('0x45')]=function(_0x2995f8,_0x4ba583){var _0x1adb0c={'raw':!![],'where':{'id':_0x2995f8[_0x4eff('0x46')]['id']}},_0x2e09ce={};_0x2e09ce[_0x4eff('0x33')]=_[_0x4eff('0x2f')](db[_0x4eff('0x3f')]['rawAttributes']);_0x2e09ce[_0x4eff('0x30')]=_['keys'](_0x2995f8[_0x4eff('0x30')]);_0x2e09ce[_0x4eff('0x31')]=_[_0x4eff('0x32')](_0x2e09ce['model'],_0x2e09ce[_0x4eff('0x30')]);_0x1adb0c['attributes']=_[_0x4eff('0x32')](_0x2e09ce[_0x4eff('0x33')],qs[_0x4eff('0x34')](_0x2995f8[_0x4eff('0x30')][_0x4eff('0x34')]));_0x1adb0c[_0x4eff('0x35')]=_0x1adb0c[_0x4eff('0x35')]['length']?_0x1adb0c[_0x4eff('0x35')]:_0x2e09ce['model'];if(_0x2995f8[_0x4eff('0x30')][_0x4eff('0x40')]){_0x1adb0c[_0x4eff('0x41')]=[{'all':!![]}];}_0x1adb0c=_[_0x4eff('0x3d')]({},_0x1adb0c,_0x2995f8['options']);return db[_0x4eff('0x3f')][_0x4eff('0x47')](_0x1adb0c)[_0x4eff('0x28')](handleEntityNotFound(_0x4ba583,null))[_0x4eff('0x28')](respondWithResult(_0x4ba583,null))[_0x4eff('0x44')](handleError(_0x4ba583,null));};exports[_0x4eff('0x48')]=function(_0x12e30e,_0x5ebccb){return db[_0x4eff('0x3f')][_0x4eff('0x48')](_0x12e30e[_0x4eff('0x49')],{})['then'](respondWithResult(_0x5ebccb,0xc9))[_0x4eff('0x44')](handleError(_0x5ebccb,null));};exports[_0x4eff('0x26')]=function(_0x1e3ee5,_0x4e03b4){if(_0x1e3ee5['body']['id']){delete _0x1e3ee5[_0x4eff('0x49')]['id'];}return db[_0x4eff('0x3f')][_0x4eff('0x47')]({'where':{'id':_0x1e3ee5[_0x4eff('0x46')]['id']}})[_0x4eff('0x28')](handleEntityNotFound(_0x4e03b4,null))['then'](saveUpdates(_0x1e3ee5[_0x4eff('0x49')],null))[_0x4eff('0x28')](respondWithResult(_0x4e03b4,null))[_0x4eff('0x44')](handleError(_0x4e03b4,null));};exports[_0x4eff('0x27')]=function(_0x2666c8,_0xf8b83){return db[_0x4eff('0x3f')][_0x4eff('0x47')]({'where':{'id':_0x2666c8['params']['id']}})[_0x4eff('0x28')](handleEntityNotFound(_0xf8b83,null))[_0x4eff('0x28')](removeEntity(_0xf8b83,null))[_0x4eff('0x44')](handleError(_0xf8b83,null));};exports[_0x4eff('0x4a')]=function(_0x5c329c,_0x3d14c7){return db[_0x4eff('0x3f')]['describe']()[_0x4eff('0x28')](respondWithResult(_0x3d14c7,null))[_0x4eff('0x44')](handleError(_0x3d14c7,null));}; \ No newline at end of file +var _0xcf54=['order','where','filters','pick','filter','JscriptyQuestionReport','includeAll','include','findAll','params','rawAttributes','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x14eb10,_0x3f39b5){var _0x531df3=function(_0x4d62c6){while(--_0x4d62c6){_0x14eb10['push'](_0x14eb10['shift']());}};_0x531df3(++_0x3f39b5);}(_0xcf54,0x135));var _0x4cf5=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0xcf54[_0x5c6022];return _0x4ab5af;};'use strict';var emlformat=require(_0x4cf5('0x0'));var rimraf=require(_0x4cf5('0x1'));var zipdir=require(_0x4cf5('0x2'));var jsonpatch=require(_0x4cf5('0x3'));var rp=require('request-promise');var moment=require(_0x4cf5('0x4'));var BPromise=require(_0x4cf5('0x5'));var Mustache=require(_0x4cf5('0x6'));var util=require(_0x4cf5('0x7'));var path=require(_0x4cf5('0x8'));var sox=require(_0x4cf5('0x9'));var csv=require(_0x4cf5('0xa'));var ejs=require(_0x4cf5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4cf5('0xc'));var crypto=require('crypto');var jsforce=require(_0x4cf5('0xd'));var deskjs=require(_0x4cf5('0xe'));var toCsv=require(_0x4cf5('0xa'));var querystring=require('querystring');var Papa=require(_0x4cf5('0xf'));var Redis=require('ioredis');var authService=require(_0x4cf5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4cf5('0x11'));var hardwareService=require(_0x4cf5('0x12'));var logger=require(_0x4cf5('0x13'))(_0x4cf5('0x14'));var utils=require('../../config/utils');var config=require(_0x4cf5('0x15'));var licenseUtil=require(_0x4cf5('0x16'));var db=require(_0x4cf5('0x17'))['db'];function respondWithStatusCode(_0x2b9ace,_0x492a91){_0x492a91=_0x492a91||0xcc;return function(_0x2cc580){if(_0x2cc580){return _0x2b9ace[_0x4cf5('0x18')](_0x492a91);}return _0x2b9ace[_0x4cf5('0x19')](_0x492a91)[_0x4cf5('0x1a')]();};}function respondWithResult(_0x4f88f1,_0x44adc4){_0x44adc4=_0x44adc4||0xc8;return function(_0x1e884d){if(_0x1e884d){return _0x4f88f1['status'](_0x44adc4)[_0x4cf5('0x1b')](_0x1e884d);}};}function respondWithFilteredResult(_0x42b8cf,_0x1794d2){return function(_0x353776){if(_0x353776){var _0x40f488=typeof _0x1794d2[_0x4cf5('0x1c')]===_0x4cf5('0x1d')&&typeof _0x1794d2[_0x4cf5('0x1e')]==='undefined';var _0x5ef92c=_0x353776[_0x4cf5('0x1f')];var _0x150b9c=_0x40f488?0x0:_0x1794d2[_0x4cf5('0x1c')];var _0x4bd17f=_0x40f488?_0x353776['count']:_0x1794d2[_0x4cf5('0x1c')]+_0x1794d2['limit'];var _0x13fa3a;if(_0x4bd17f>=_0x5ef92c){_0x4bd17f=_0x5ef92c;_0x13fa3a=0xc8;}else{_0x13fa3a=0xce;}_0x42b8cf[_0x4cf5('0x19')](_0x13fa3a);return _0x42b8cf[_0x4cf5('0x20')](_0x4cf5('0x21'),_0x150b9c+'-'+_0x4bd17f+'/'+_0x5ef92c)['json'](_0x353776);}return null;};}function patchUpdates(_0x34599f){return function(_0x564990){try{jsonpatch[_0x4cf5('0x22')](_0x564990,_0x34599f,!![]);}catch(_0x41e86a){return BPromise[_0x4cf5('0x23')](_0x41e86a);}return _0x564990[_0x4cf5('0x24')]();};}function saveUpdates(_0x8dbe92,_0x408cbb){return function(_0x35d042){if(_0x35d042){return _0x35d042[_0x4cf5('0x25')](_0x8dbe92)[_0x4cf5('0x26')](function(_0xba7f38){return _0xba7f38;});}return null;};}function removeEntity(_0x3d7283,_0xd9751a){return function(_0x5b4b09){if(_0x5b4b09){return _0x5b4b09[_0x4cf5('0x27')]()[_0x4cf5('0x26')](function(){_0x3d7283[_0x4cf5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a981,_0x537927){return function(_0x1ab650){if(!_0x1ab650){_0x32a981[_0x4cf5('0x18')](0x194);}return _0x1ab650;};}function handleError(_0x2f4bb9,_0x378557){_0x378557=_0x378557||0x1f4;return function(_0x2c90a1){logger[_0x4cf5('0x28')](_0x2c90a1['stack']);if(_0x2c90a1[_0x4cf5('0x29')]){delete _0x2c90a1['name'];}_0x2f4bb9[_0x4cf5('0x19')](_0x378557)[_0x4cf5('0x2a')](_0x2c90a1);};}exports[_0x4cf5('0x2b')]=function(_0x3da1ec,_0x1b91b2){var _0x235cf7={},_0x43e877={},_0x36e0ab={'count':0x0,'rows':[]};var _0xa8fffe=_[_0x4cf5('0x2c')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x167f7c){return{'name':_0x167f7c['fieldName'],'type':_0x167f7c[_0x4cf5('0x2d')][_0x4cf5('0x2e')]};});_0x43e877[_0x4cf5('0x2f')]=_['map'](_0xa8fffe,'name');_0x43e877[_0x4cf5('0x30')]=_[_0x4cf5('0x31')](_0x3da1ec['query']);_0x43e877['filters']=_[_0x4cf5('0x32')](_0x43e877['model'],_0x43e877[_0x4cf5('0x30')]);_0x235cf7[_0x4cf5('0x33')]=_[_0x4cf5('0x32')](_0x43e877[_0x4cf5('0x2f')],qs[_0x4cf5('0x34')](_0x3da1ec[_0x4cf5('0x30')][_0x4cf5('0x34')]));_0x235cf7[_0x4cf5('0x33')]=_0x235cf7[_0x4cf5('0x33')][_0x4cf5('0x35')]?_0x235cf7[_0x4cf5('0x33')]:_0x43e877[_0x4cf5('0x2f')];if(!_0x3da1ec[_0x4cf5('0x30')][_0x4cf5('0x36')](_0x4cf5('0x37'))){_0x235cf7[_0x4cf5('0x1e')]=qs[_0x4cf5('0x1e')](_0x3da1ec[_0x4cf5('0x30')][_0x4cf5('0x1e')]);_0x235cf7[_0x4cf5('0x1c')]=qs[_0x4cf5('0x1c')](_0x3da1ec['query'][_0x4cf5('0x1c')]);}_0x235cf7[_0x4cf5('0x38')]=qs['sort'](_0x3da1ec[_0x4cf5('0x30')]['sort']);_0x235cf7[_0x4cf5('0x39')]=qs[_0x4cf5('0x3a')](_[_0x4cf5('0x3b')](_0x3da1ec[_0x4cf5('0x30')],_0x43e877[_0x4cf5('0x3a')]),_0xa8fffe);if(_0x3da1ec['query'][_0x4cf5('0x3c')]){_0x235cf7[_0x4cf5('0x39')]=_['merge'](_0x235cf7['where'],{'$or':_[_0x4cf5('0x2c')](_0xa8fffe,function(_0x88615a){if(_0x88615a['type']!=='VIRTUAL'){var _0x54dda4={};_0x54dda4[_0x88615a['name']]={'$like':'%'+_0x3da1ec[_0x4cf5('0x30')][_0x4cf5('0x3c')]+'%'};return _0x54dda4;}})});}_0x235cf7=_['merge']({},_0x235cf7,_0x3da1ec['options']);var _0xe80e4a={'where':_0x235cf7[_0x4cf5('0x39')]};return db[_0x4cf5('0x3d')][_0x4cf5('0x1f')](_0xe80e4a)['then'](function(_0x563c69){_0x36e0ab[_0x4cf5('0x1f')]=_0x563c69;if(_0x3da1ec[_0x4cf5('0x30')][_0x4cf5('0x3e')]){_0x235cf7[_0x4cf5('0x3f')]=[{'all':!![]}];}return db[_0x4cf5('0x3d')][_0x4cf5('0x40')](_0x235cf7);})[_0x4cf5('0x26')](function(_0x4a9216){_0x36e0ab['rows']=_0x4a9216;return _0x36e0ab;})[_0x4cf5('0x26')](respondWithFilteredResult(_0x1b91b2,_0x235cf7))['catch'](handleError(_0x1b91b2,null));};exports['show']=function(_0x5880e1,_0x3eb77a){var _0x5e212e={'raw':!![],'where':{'id':_0x5880e1[_0x4cf5('0x41')]['id']}},_0x423840={};_0x423840[_0x4cf5('0x2f')]=_[_0x4cf5('0x31')](db[_0x4cf5('0x3d')][_0x4cf5('0x42')]);_0x423840[_0x4cf5('0x30')]=_[_0x4cf5('0x31')](_0x5880e1['query']);_0x423840[_0x4cf5('0x3a')]=_[_0x4cf5('0x32')](_0x423840[_0x4cf5('0x2f')],_0x423840[_0x4cf5('0x30')]);_0x5e212e['attributes']=_[_0x4cf5('0x32')](_0x423840[_0x4cf5('0x2f')],qs['fields'](_0x5880e1['query']['fields']));_0x5e212e[_0x4cf5('0x33')]=_0x5e212e['attributes']['length']?_0x5e212e[_0x4cf5('0x33')]:_0x423840['model'];if(_0x5880e1[_0x4cf5('0x30')][_0x4cf5('0x3e')]){_0x5e212e[_0x4cf5('0x3f')]=[{'all':!![]}];}_0x5e212e=_['merge']({},_0x5e212e,_0x5880e1[_0x4cf5('0x43')]);return db['JscriptyQuestionReport'][_0x4cf5('0x44')](_0x5e212e)[_0x4cf5('0x26')](handleEntityNotFound(_0x3eb77a,null))[_0x4cf5('0x26')](respondWithResult(_0x3eb77a,null))['catch'](handleError(_0x3eb77a,null));};exports[_0x4cf5('0x45')]=function(_0x32a55,_0x2ffcc7){return db[_0x4cf5('0x3d')][_0x4cf5('0x45')](_0x32a55[_0x4cf5('0x46')],{})[_0x4cf5('0x26')](respondWithResult(_0x2ffcc7,0xc9))[_0x4cf5('0x47')](handleError(_0x2ffcc7,null));};exports[_0x4cf5('0x25')]=function(_0x22df94,_0x1a7abe){if(_0x22df94[_0x4cf5('0x46')]['id']){delete _0x22df94['body']['id'];}return db[_0x4cf5('0x3d')][_0x4cf5('0x44')]({'where':{'id':_0x22df94[_0x4cf5('0x41')]['id']}})[_0x4cf5('0x26')](handleEntityNotFound(_0x1a7abe,null))[_0x4cf5('0x26')](saveUpdates(_0x22df94['body'],null))[_0x4cf5('0x26')](respondWithResult(_0x1a7abe,null))[_0x4cf5('0x47')](handleError(_0x1a7abe,null));};exports['destroy']=function(_0xe1ddd4,_0x2db0b4){return db[_0x4cf5('0x3d')]['find']({'where':{'id':_0xe1ddd4['params']['id']}})['then'](handleEntityNotFound(_0x2db0b4,null))[_0x4cf5('0x26')](removeEntity(_0x2db0b4,null))[_0x4cf5('0x47')](handleError(_0x2db0b4,null));};exports[_0x4cf5('0x48')]=function(_0x57c846,_0x15bd67){return db[_0x4cf5('0x3d')][_0x4cf5('0x48')]()['then'](respondWithResult(_0x15bd67,null))[_0x4cf5('0x47')](handleError(_0x15bd67,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 15a5f76..6d41c7c 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 _0xf896=['path','rimraf','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','bluebird'];(function(_0x1ed99c,_0x52bb43){var _0x19c308=function(_0x57fe15){while(--_0x57fe15){_0x1ed99c['push'](_0x1ed99c['shift']());}};_0x19c308(++_0x52bb43);}(_0xf896,0xf6));var _0x6f89=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xf896[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x6f89('0x0'));var util=require('util');var logger=require(_0x6f89('0x1'))(_0x6f89('0x2'));var moment=require('moment');var BPromise=require(_0x6f89('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f89('0x4'));var rimraf=require(_0x6f89('0x5'));var config=require(_0x6f89('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x6f89('0x7')]=function(_0x82b6cb,_0x4051eb){return _0x82b6cb['define'](_0x6f89('0x8'),attributes,{'tableName':_0x6f89('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ff=['bluebird','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','../../config/logger','api','moment'];(function(_0x4ea127,_0x582710){var _0x6958bd=function(_0x5cfe33){while(--_0x5cfe33){_0x4ea127['push'](_0x4ea127['shift']());}};_0x6958bd(++_0x582710);}(_0xe2ff,0x129));var _0xfe2f=function(_0x2bd8f2,_0x4884df){_0x2bd8f2=_0x2bd8f2-0x0;var _0x559526=_0xe2ff[_0x2bd8f2];return _0x559526;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe2f('0x0'))(_0xfe2f('0x1'));var moment=require(_0xfe2f('0x2'));var BPromise=require(_0xfe2f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe2f('0x4'));var config=require('../../config/environment');var attributes=require(_0xfe2f('0x5'));module[_0xfe2f('0x6')]=function(_0x4a5b0c,_0x4d3155){return _0x4a5b0c[_0xfe2f('0x7')](_0xfe2f('0x8'),attributes,{'tableName':_0xfe2f('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 6e40a9f..5f0a3bc 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 _0xc0ae=['http','then','info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xc0ae,0x106));var _0xec0a=function(_0x4e82ae,_0x281fbf){_0x4e82ae=_0x4e82ae-0x0;var _0x7af32f=_0xc0ae[_0x4e82ae];return _0x7af32f;};'use strict';var _=require(_0xec0a('0x0'));var util=require('util');var moment=require(_0xec0a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec0a('0x2'));var db=require(_0xec0a('0x3'))['db'];var utils=require(_0xec0a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xec0a('0x5'));var jayson=require(_0xec0a('0x6'));var client=jayson[_0xec0a('0x7')][_0xec0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x149352,_0xf851e7,_0x4260b0){return new BPromise(function(_0x3188af,_0x217744){return client['request'](_0x149352,_0x4260b0)[_0xec0a('0x9')](function(_0x3b492d){logger[_0xec0a('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xf851e7,_0xec0a('0xb'));logger['debug'](_0xec0a('0xc'),_0xf851e7,_0xec0a('0xb'),JSON[_0xec0a('0xd')](_0x3b492d));if(_0x3b492d[_0xec0a('0xe')]){if(_0x3b492d[_0xec0a('0xe')]['code']===0x1f4){logger[_0xec0a('0xe')](_0xec0a('0xf'),_0xf851e7,_0x3b492d['error'][_0xec0a('0x10')]);return _0x217744(_0x3b492d[_0xec0a('0xe')]['message']);}logger[_0xec0a('0xe')](_0xec0a('0xf'),_0xf851e7,_0x3b492d['error'][_0xec0a('0x10')]);return _0x3188af(_0x3b492d[_0xec0a('0xe')]['message']);}else{logger[_0xec0a('0xa')](_0xec0a('0xf'),_0xf851e7,'request\x20sent');_0x3188af(_0x3b492d[_0xec0a('0x11')]['message']);}})['catch'](function(_0x10b52f){logger[_0xec0a('0xe')](_0xec0a('0xf'),_0xf851e7,_0x10b52f);_0x217744(_0x10b52f);});});} \ No newline at end of file +var _0xa977=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info'];(function(_0x3217d3,_0xf66fcf){var _0x260f43=function(_0x2b4a34){while(--_0x2b4a34){_0x3217d3['push'](_0x3217d3['shift']());}};_0x260f43(++_0xf66fcf);}(_0xa977,0x71));var _0x7a97=function(_0x263698,_0x6849d){_0x263698=_0x263698-0x0;var _0x2f7d86=_0xa977[_0x263698];return _0x2f7d86;};'use strict';var _=require(_0x7a97('0x0'));var util=require(_0x7a97('0x1'));var moment=require(_0x7a97('0x2'));var BPromise=require(_0x7a97('0x3'));var rs=require(_0x7a97('0x4'));var fs=require('fs');var Redis=require(_0x7a97('0x5'));var db=require(_0x7a97('0x6'))['db'];var utils=require(_0x7a97('0x7'));var logger=require(_0x7a97('0x8'))('rpc');var config=require(_0x7a97('0x9'));var jayson=require(_0x7a97('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x513a0e,_0x44b0f5,_0x5cdf25){return new BPromise(function(_0x29fe00,_0x30d15b){return client[_0x7a97('0xb')](_0x513a0e,_0x5cdf25)['then'](function(_0x5acb69){logger[_0x7a97('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x44b0f5,_0x7a97('0xd'));logger[_0x7a97('0xe')](_0x7a97('0xf'),_0x44b0f5,_0x7a97('0xd'),JSON[_0x7a97('0x10')](_0x5acb69));if(_0x5acb69['error']){if(_0x5acb69[_0x7a97('0x11')]['code']===0x1f4){logger[_0x7a97('0x11')](_0x7a97('0x12'),_0x44b0f5,_0x5acb69[_0x7a97('0x11')]['message']);return _0x30d15b(_0x5acb69['error'][_0x7a97('0x13')]);}logger[_0x7a97('0x11')](_0x7a97('0x12'),_0x44b0f5,_0x5acb69[_0x7a97('0x11')][_0x7a97('0x13')]);return _0x29fe00(_0x5acb69[_0x7a97('0x11')]['message']);}else{logger[_0x7a97('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x44b0f5,_0x7a97('0xd'));_0x29fe00(_0x5acb69['result'][_0x7a97('0x13')]);}})[_0x7a97('0x14')](function(_0x3c7025){logger[_0x7a97('0x11')](_0x7a97('0x12'),_0x44b0f5,_0x3c7025);_0x30d15b(_0x3c7025);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 075130c..3c1be5a 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 _0x994a=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/questions','getQuestions','post','create','put','update'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x994a,0xe4));var _0xa994=function(_0x38ed86,_0x222e95){_0x38ed86=_0x38ed86-0x0;var _0x2ddc5d=_0x994a[_0x38ed86];return _0x2ddc5d;};'use strict';var multer=require(_0xa994('0x0'));var util=require('util');var path=require(_0xa994('0x1'));var timeout=require(_0xa994('0x2'));var express=require(_0xa994('0x3'));var router=express[_0xa994('0x4')]();var fs_extra=require(_0xa994('0x5'));var auth=require(_0xa994('0x6'));var interaction=require(_0xa994('0x7'));var config=require(_0xa994('0x8'));var controller=require(_0xa994('0x9'));router[_0xa994('0xa')]('/',auth['isAuthenticated'](),controller[_0xa994('0xb')]);router[_0xa994('0xa')](_0xa994('0xc'),auth[_0xa994('0xd')](),controller[_0xa994('0xe')]);router[_0xa994('0xa')](_0xa994('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa994('0x10'),auth['isAuthenticated'](),controller[_0xa994('0x11')]);router[_0xa994('0x12')]('/',auth['isAuthenticated'](),controller[_0xa994('0x13')]);router[_0xa994('0x14')]('/:id',auth[_0xa994('0xd')](),controller[_0xa994('0x15')]);router[_0xa994('0x16')]('/:id',auth[_0xa994('0xd')](),controller[_0xa994('0x17')]);module[_0xa994('0x18')]=router; \ No newline at end of file +var _0xb0a4=['connect-timeout','fs-extra','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','/describe','describe','get','show','/:id/questions','getQuestions','post','create','put','/:id','update','destroy','exports','util','path'];(function(_0x3ec412,_0x4e05a2){var _0x48a1d1=function(_0x39acc7){while(--_0x39acc7){_0x3ec412['push'](_0x3ec412['shift']());}};_0x48a1d1(++_0x4e05a2);}(_0xb0a4,0x1a2));var _0x4b0a=function(_0x428e09,_0xcc22d4){_0x428e09=_0x428e09-0x0;var _0x52199f=_0xb0a4[_0x428e09];return _0x52199f;};'use strict';var multer=require('multer');var util=require(_0x4b0a('0x0'));var path=require(_0x4b0a('0x1'));var timeout=require(_0x4b0a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4b0a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b0a('0x4'));var controller=require(_0x4b0a('0x5'));router['get']('/',auth[_0x4b0a('0x6')](),controller['index']);router['get'](_0x4b0a('0x7'),auth['isAuthenticated'](),controller[_0x4b0a('0x8')]);router[_0x4b0a('0x9')]('/:id',auth[_0x4b0a('0x6')](),controller[_0x4b0a('0xa')]);router[_0x4b0a('0x9')](_0x4b0a('0xb'),auth[_0x4b0a('0x6')](),controller[_0x4b0a('0xc')]);router[_0x4b0a('0xd')]('/',auth['isAuthenticated'](),controller[_0x4b0a('0xe')]);router[_0x4b0a('0xf')](_0x4b0a('0x10'),auth['isAuthenticated'](),controller[_0x4b0a('0x11')]);router['delete']('/:id',auth[_0x4b0a('0x6')](),controller[_0x4b0a('0x12')]);module[_0x4b0a('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 31f0684..194e63b 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 _0x926f=['setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE'];(function(_0x1e0482,_0x1989fe){var _0x4ef83f=function(_0x2a3b4b){while(--_0x2a3b4b){_0x1e0482['push'](_0x1e0482['shift']());}};_0x4ef83f(++_0x1989fe);}(_0x926f,0x19b));var _0xf926=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x926f[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0xf926('0x0'));var Sequelize=require(_0xf926('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xf926('0x2')],'set':function(_0x5a0f95){this[_0xf926('0x3')](_0xf926('0x4'),_0x5a0f95);this['setDataValue']('endtime',moment()[_0xf926('0x5')](_0xf926('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf926('0x7')]},'projectname':{'type':Sequelize[_0xf926('0x7')]},'queue':{'type':Sequelize[_0xf926('0x7')]},'uniqueid':{'type':Sequelize[_0xf926('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xf926('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xacfb=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','setDataValue','starttime'];(function(_0x4a232c,_0x4db76b){var _0xb5807f=function(_0x2e1e16){while(--_0x2e1e16){_0x4a232c['push'](_0x4a232c['shift']());}};_0xb5807f(++_0x4db76b);}(_0xacfb,0x95));var _0xbacf=function(_0x57b10c,_0x5aa79d){_0x57b10c=_0x57b10c-0x0;var _0x1778ff=_0xacfb[_0x57b10c];return _0x1778ff;};'use strict';var moment=require('moment');var Sequelize=require(_0xbacf('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xbacf('0x1')],'set':function(_0x44eb05){this[_0xbacf('0x2')](_0xbacf('0x3'),_0x44eb05);this[_0xbacf('0x2')](_0xbacf('0x4'),moment()[_0xbacf('0x5')](_0xbacf('0x6')));}},'endtime':{'type':Sequelize[_0xbacf('0x1')]},'membername':{'type':Sequelize[_0xbacf('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xbacf('0x7')]},'uniqueid':{'type':Sequelize[_0xbacf('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbacf('0x7')]},'completed':{'type':Sequelize[_0xbacf('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2a0f128..53587ce 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 _0x06c9=['end','json','offset','undefined','count','limit','save','update','then','destroy','sendStatus','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','findOne','JscriptyQuestionReport','hasOwnProperty','order','SessionId','options','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x322ffc,_0x222893){var _0x3a4469=function(_0x30e261){while(--_0x30e261){_0x322ffc['push'](_0x322ffc['shift']());}};_0x3a4469(++_0x222893);}(_0x06c9,0x84));var _0x906c=function(_0xe83131,_0xc831da){_0xe83131=_0xe83131-0x0;var _0x1d8af4=_0x06c9[_0xe83131];return _0x1d8af4;};'use strict';var emlformat=require(_0x906c('0x0'));var rimraf=require(_0x906c('0x1'));var zipdir=require(_0x906c('0x2'));var jsonpatch=require(_0x906c('0x3'));var rp=require(_0x906c('0x4'));var moment=require(_0x906c('0x5'));var BPromise=require(_0x906c('0x6'));var Mustache=require(_0x906c('0x7'));var util=require(_0x906c('0x8'));var path=require(_0x906c('0x9'));var sox=require(_0x906c('0xa'));var csv=require('to-csv');var ejs=require(_0x906c('0xb'));var fs=require('fs');var fs_extra=require(_0x906c('0xc'));var _=require(_0x906c('0xd'));var squel=require(_0x906c('0xe'));var crypto=require(_0x906c('0xf'));var jsforce=require(_0x906c('0x10'));var deskjs=require(_0x906c('0x11'));var toCsv=require(_0x906c('0x12'));var querystring=require(_0x906c('0x13'));var Papa=require(_0x906c('0x14'));var Redis=require(_0x906c('0x15'));var authService=require(_0x906c('0x16'));var qs=require(_0x906c('0x17'));var as=require(_0x906c('0x18'));var hardwareService=require(_0x906c('0x19'));var logger=require('../../config/logger')(_0x906c('0x1a'));var utils=require(_0x906c('0x1b'));var config=require(_0x906c('0x1c'));var licenseUtil=require(_0x906c('0x1d'));var db=require(_0x906c('0x1e'))['db'];function respondWithStatusCode(_0x408d7c,_0x345af3){_0x345af3=_0x345af3||0xcc;return function(_0x4d6c48){if(_0x4d6c48){return _0x408d7c['sendStatus'](_0x345af3);}return _0x408d7c[_0x906c('0x1f')](_0x345af3)[_0x906c('0x20')]();};}function respondWithResult(_0x16e13e,_0x4a5370){_0x4a5370=_0x4a5370||0xc8;return function(_0x4addb2){if(_0x4addb2){return _0x16e13e[_0x906c('0x1f')](_0x4a5370)[_0x906c('0x21')](_0x4addb2);}};}function respondWithFilteredResult(_0x28dd73,_0x5ebf74){return function(_0x259463){if(_0x259463){var _0x27975e=typeof _0x5ebf74[_0x906c('0x22')]===_0x906c('0x23')&&typeof _0x5ebf74['limit']===_0x906c('0x23');var _0x468cc9=_0x259463['count'];var _0x25588f=_0x27975e?0x0:_0x5ebf74['offset'];var _0x54f2f5=_0x27975e?_0x259463[_0x906c('0x24')]:_0x5ebf74['offset']+_0x5ebf74[_0x906c('0x25')];var _0x1fa3c3;if(_0x54f2f5>=_0x468cc9){_0x54f2f5=_0x468cc9;_0x1fa3c3=0xc8;}else{_0x1fa3c3=0xce;}_0x28dd73[_0x906c('0x1f')](_0x1fa3c3);return _0x28dd73['set']('Content-Range',_0x25588f+'-'+_0x54f2f5+'/'+_0x468cc9)[_0x906c('0x21')](_0x259463);}return null;};}function patchUpdates(_0x3a84d0){return function(_0x2e852a){try{jsonpatch['apply'](_0x2e852a,_0x3a84d0,!![]);}catch(_0x14074a){return BPromise['reject'](_0x14074a);}return _0x2e852a[_0x906c('0x26')]();};}function saveUpdates(_0x2146dc,_0x410337){return function(_0x3ffa21){if(_0x3ffa21){return _0x3ffa21[_0x906c('0x27')](_0x2146dc)[_0x906c('0x28')](function(_0x3b5c47){return _0x3b5c47;});}return null;};}function removeEntity(_0x4126ea,_0x4acd1e){return function(_0x2af5c7){if(_0x2af5c7){return _0x2af5c7[_0x906c('0x29')]()[_0x906c('0x28')](function(){_0x4126ea[_0x906c('0x1f')](0xcc)[_0x906c('0x20')]();});}};}function handleEntityNotFound(_0x13108a,_0x4f00da){return function(_0x301ee4){if(!_0x301ee4){_0x13108a[_0x906c('0x2a')](0x194);}return _0x301ee4;};}function handleError(_0x2ff521,_0x5a3717){_0x5a3717=_0x5a3717||0x1f4;return function(_0xad25e8){logger['error'](_0xad25e8['stack']);if(_0xad25e8[_0x906c('0x2b')]){delete _0xad25e8[_0x906c('0x2b')];}_0x2ff521[_0x906c('0x1f')](_0x5a3717)['send'](_0xad25e8);};}exports[_0x906c('0x2c')]=function(_0x439c5d,_0x52a3d1){var _0x3f7064={},_0x150a5a={},_0x1a7498={'count':0x0,'rows':[]};var _0x589dbe=_[_0x906c('0x2d')](db[_0x906c('0x2e')][_0x906c('0x2f')],function(_0x5dcf03){return{'name':_0x5dcf03[_0x906c('0x30')],'type':_0x5dcf03[_0x906c('0x31')][_0x906c('0x32')]};});_0x150a5a['model']=_['map'](_0x589dbe,_0x906c('0x2b'));_0x150a5a[_0x906c('0x33')]=_[_0x906c('0x34')](_0x439c5d[_0x906c('0x33')]);_0x150a5a[_0x906c('0x35')]=_['intersection'](_0x150a5a[_0x906c('0x36')],_0x150a5a[_0x906c('0x33')]);_0x3f7064[_0x906c('0x37')]=_[_0x906c('0x38')](_0x150a5a[_0x906c('0x36')],qs[_0x906c('0x39')](_0x439c5d[_0x906c('0x33')][_0x906c('0x39')]));_0x3f7064[_0x906c('0x37')]=_0x3f7064[_0x906c('0x37')][_0x906c('0x3a')]?_0x3f7064['attributes']:_0x150a5a[_0x906c('0x36')];if(!_0x439c5d['query']['hasOwnProperty'](_0x906c('0x3b'))){_0x3f7064[_0x906c('0x25')]=qs[_0x906c('0x25')](_0x439c5d[_0x906c('0x33')][_0x906c('0x25')]);_0x3f7064[_0x906c('0x22')]=qs['offset'](_0x439c5d[_0x906c('0x33')][_0x906c('0x22')]);}_0x3f7064['order']=qs[_0x906c('0x3c')](_0x439c5d[_0x906c('0x33')][_0x906c('0x3c')]);_0x3f7064[_0x906c('0x3d')]=qs[_0x906c('0x35')](_[_0x906c('0x3e')](_0x439c5d[_0x906c('0x33')],_0x150a5a[_0x906c('0x35')]),_0x589dbe);if(_0x439c5d['query'][_0x906c('0x3f')]){_0x3f7064[_0x906c('0x3d')]=_['merge'](_0x3f7064['where'],{'$or':_['map'](_0x589dbe,function(_0x5dba15){if(_0x5dba15['type']!=='VIRTUAL'){var _0x58c50c={};_0x58c50c[_0x5dba15[_0x906c('0x2b')]]={'$like':'%'+_0x439c5d[_0x906c('0x33')][_0x906c('0x3f')]+'%'};return _0x58c50c;}})});}_0x3f7064=_['merge']({},_0x3f7064,_0x439c5d['options']);var _0x12feda={'where':_0x3f7064['where']};return db[_0x906c('0x2e')][_0x906c('0x24')](_0x12feda)['then'](function(_0x1e2882){_0x1a7498[_0x906c('0x24')]=_0x1e2882;if(_0x439c5d[_0x906c('0x33')][_0x906c('0x40')]){_0x3f7064[_0x906c('0x41')]=[{'all':!![]}];}return db[_0x906c('0x2e')]['findAll'](_0x3f7064);})['then'](function(_0x3a937d){_0x1a7498[_0x906c('0x42')]=_0x3a937d;return _0x1a7498;})[_0x906c('0x28')](respondWithFilteredResult(_0x52a3d1,_0x3f7064))[_0x906c('0x43')](handleError(_0x52a3d1,null));};exports[_0x906c('0x44')]=function(_0x46f5d9,_0x19de97){var _0x26a06b={'raw':!![],'where':{'id':_0x46f5d9[_0x906c('0x45')]['id']}},_0x7b4154={};_0x7b4154['model']=_[_0x906c('0x34')](db[_0x906c('0x2e')][_0x906c('0x2f')]);_0x7b4154[_0x906c('0x33')]=_[_0x906c('0x34')](_0x46f5d9[_0x906c('0x33')]);_0x7b4154[_0x906c('0x35')]=_[_0x906c('0x38')](_0x7b4154[_0x906c('0x36')],_0x7b4154[_0x906c('0x33')]);_0x26a06b[_0x906c('0x37')]=_[_0x906c('0x38')](_0x7b4154['model'],qs[_0x906c('0x39')](_0x46f5d9[_0x906c('0x33')]['fields']));_0x26a06b[_0x906c('0x37')]=_0x26a06b[_0x906c('0x37')]['length']?_0x26a06b[_0x906c('0x37')]:_0x7b4154[_0x906c('0x36')];if(_0x46f5d9['query'][_0x906c('0x40')]){_0x26a06b[_0x906c('0x41')]=[{'all':!![]}];}_0x26a06b=_[_0x906c('0x46')]({},_0x26a06b,_0x46f5d9['options']);return db[_0x906c('0x2e')][_0x906c('0x47')](_0x26a06b)[_0x906c('0x28')](handleEntityNotFound(_0x19de97,null))['then'](respondWithResult(_0x19de97,null))['catch'](handleError(_0x19de97,null));};exports[_0x906c('0x48')]=function(_0xff46e0,_0x3f356d){return db['JscriptySessionReport'][_0x906c('0x48')](_0xff46e0[_0x906c('0x49')],{})['then'](respondWithResult(_0x3f356d,0xc9))[_0x906c('0x43')](handleError(_0x3f356d,null));};exports[_0x906c('0x27')]=function(_0x1568ce,_0x7930fd){if(_0x1568ce[_0x906c('0x49')]['id']){delete _0x1568ce[_0x906c('0x49')]['id'];}return db[_0x906c('0x2e')]['find']({'where':{'id':_0x1568ce[_0x906c('0x45')]['id']}})['then'](handleEntityNotFound(_0x7930fd,null))['then'](saveUpdates(_0x1568ce[_0x906c('0x49')],null))[_0x906c('0x28')](respondWithResult(_0x7930fd,null))[_0x906c('0x43')](handleError(_0x7930fd,null));};exports[_0x906c('0x29')]=function(_0x2c4825,_0x1374a5){return db[_0x906c('0x2e')][_0x906c('0x47')]({'where':{'id':_0x2c4825[_0x906c('0x45')]['id']}})[_0x906c('0x28')](handleEntityNotFound(_0x1374a5,null))[_0x906c('0x28')](removeEntity(_0x1374a5,null))[_0x906c('0x43')](handleError(_0x1374a5,null));};exports[_0x906c('0x4a')]=function(_0x33d92f,_0x2296a3){return db['JscriptySessionReport'][_0x906c('0x4a')]()['then'](respondWithResult(_0x2296a3,null))[_0x906c('0x43')](handleError(_0x2296a3,null));};exports['getQuestions']=function(_0x10d757,_0x5c9c84,_0xbaa3c4){var _0x2953fc={'raw':!![],'where':{}};var _0x1447bf={};var _0x5d9374={'count':0x0,'rows':[]};return db[_0x906c('0x2e')][_0x906c('0x4b')]({'where':{'id':_0x10d757[_0x906c('0x45')]['id']}})[_0x906c('0x28')](handleEntityNotFound(_0x5c9c84,null))[_0x906c('0x28')](function(_0x596d48){if(_0x596d48){_0x1447bf[_0x906c('0x36')]=_[_0x906c('0x34')](db[_0x906c('0x4c')]['rawAttributes']);_0x1447bf[_0x906c('0x33')]=_[_0x906c('0x34')](_0x10d757[_0x906c('0x33')]);_0x1447bf[_0x906c('0x35')]=_[_0x906c('0x38')](_0x1447bf['model'],_0x1447bf[_0x906c('0x33')]);_0x2953fc[_0x906c('0x37')]=_['intersection'](_0x1447bf['model'],qs[_0x906c('0x39')](_0x10d757['query'][_0x906c('0x39')]));_0x2953fc[_0x906c('0x37')]=_0x2953fc[_0x906c('0x37')][_0x906c('0x3a')]?_0x2953fc['attributes']:_0x1447bf[_0x906c('0x36')];if(!_0x10d757[_0x906c('0x33')][_0x906c('0x4d')](_0x906c('0x3b'))){_0x2953fc[_0x906c('0x25')]=qs['limit'](_0x10d757[_0x906c('0x33')][_0x906c('0x25')]);_0x2953fc['offset']=qs[_0x906c('0x22')](_0x10d757[_0x906c('0x33')][_0x906c('0x22')]);}_0x2953fc[_0x906c('0x4e')]=qs[_0x906c('0x3c')](_0x10d757['query'][_0x906c('0x3c')]);_0x2953fc['where']=qs[_0x906c('0x35')](_[_0x906c('0x3e')](_0x10d757['query'],_0x1447bf['filters']));_0x2953fc[_0x906c('0x3d')][_0x906c('0x4f')]=_0x596d48['id'];if(_0x10d757[_0x906c('0x33')][_0x906c('0x3f')]){_0x2953fc['where']=_[_0x906c('0x46')](_0x2953fc['where'],{'$or':_[_0x906c('0x2d')](_0x2953fc[_0x906c('0x37')],function(_0x1bc296){var _0x3ae47a={};_0x3ae47a[_0x1bc296]={'$like':'%'+_0x10d757['query'][_0x906c('0x3f')]+'%'};return _0x3ae47a;})});}_0x2953fc=_[_0x906c('0x46')]({},_0x2953fc,_0x10d757[_0x906c('0x50')]);return db[_0x906c('0x4c')][_0x906c('0x24')]({'where':_0x2953fc[_0x906c('0x3d')]})[_0x906c('0x28')](function(_0x338e05){_0x5d9374[_0x906c('0x24')]=_0x338e05;if(_0x10d757[_0x906c('0x33')][_0x906c('0x40')]){_0x2953fc[_0x906c('0x41')]=[{'all':!![]}];}return db[_0x906c('0x4c')][_0x906c('0x51')](_0x2953fc);})[_0x906c('0x28')](function(_0x2a2620){_0x5d9374[_0x906c('0x42')]=_0x2a2620;return _0x5d9374;});}})['then'](respondWithFilteredResult(_0x5c9c84,_0x2953fc))[_0x906c('0x43')](handleError(_0x5c9c84,null));}; \ No newline at end of file +var _0x7523=['fields','length','hasOwnProperty','order','sort','filter','where','merge','includeAll','JscriptySessionReport','catch','show','params','keys','options','find','create','body','describe','getQuestions','findOne','nolimit','SessionId','JscriptyQuestionReport','include','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes'];(function(_0x1a3396,_0x51bef0){var _0x1e8cc6=function(_0x56be40){while(--_0x56be40){_0x1a3396['push'](_0x1a3396['shift']());}};_0x1e8cc6(++_0x51bef0);}(_0x7523,0x104));var _0x3752=function(_0x53e740,_0xeb56c4){_0x53e740=_0x53e740-0x0;var _0xda0db6=_0x7523[_0x53e740];return _0xda0db6;};'use strict';var emlformat=require(_0x3752('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3752('0x1'));var jsonpatch=require(_0x3752('0x2'));var rp=require(_0x3752('0x3'));var moment=require(_0x3752('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3752('0x5'));var csv=require('to-csv');var ejs=require(_0x3752('0x6'));var fs=require('fs');var fs_extra=require(_0x3752('0x7'));var _=require(_0x3752('0x8'));var squel=require(_0x3752('0x9'));var crypto=require('crypto');var jsforce=require(_0x3752('0xa'));var deskjs=require(_0x3752('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3752('0xc'));var Papa=require(_0x3752('0xd'));var Redis=require(_0x3752('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3752('0xf'));var as=require(_0x3752('0x10'));var hardwareService=require(_0x3752('0x11'));var logger=require(_0x3752('0x12'))(_0x3752('0x13'));var utils=require(_0x3752('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3752('0x15'));var db=require(_0x3752('0x16'))['db'];function respondWithStatusCode(_0x18038c,_0x24ab67){_0x24ab67=_0x24ab67||0xcc;return function(_0x7a4769){if(_0x7a4769){return _0x18038c[_0x3752('0x17')](_0x24ab67);}return _0x18038c[_0x3752('0x18')](_0x24ab67)[_0x3752('0x19')]();};}function respondWithResult(_0x42f623,_0x63e2e8){_0x63e2e8=_0x63e2e8||0xc8;return function(_0x1ef5f9){if(_0x1ef5f9){return _0x42f623['status'](_0x63e2e8)[_0x3752('0x1a')](_0x1ef5f9);}};}function respondWithFilteredResult(_0x1510de,_0x5e8948){return function(_0x3b86bc){if(_0x3b86bc){var _0x1a0288=typeof _0x5e8948[_0x3752('0x1b')]==='undefined'&&typeof _0x5e8948[_0x3752('0x1c')]===_0x3752('0x1d');var _0x21e4f2=_0x3b86bc['count'];var _0x51a31d=_0x1a0288?0x0:_0x5e8948[_0x3752('0x1b')];var _0x13ddff=_0x1a0288?_0x3b86bc[_0x3752('0x1e')]:_0x5e8948[_0x3752('0x1b')]+_0x5e8948[_0x3752('0x1c')];var _0x59f604;if(_0x13ddff>=_0x21e4f2){_0x13ddff=_0x21e4f2;_0x59f604=0xc8;}else{_0x59f604=0xce;}_0x1510de[_0x3752('0x18')](_0x59f604);return _0x1510de[_0x3752('0x1f')](_0x3752('0x20'),_0x51a31d+'-'+_0x13ddff+'/'+_0x21e4f2)[_0x3752('0x1a')](_0x3b86bc);}return null;};}function patchUpdates(_0x349ce6){return function(_0x4462d7){try{jsonpatch[_0x3752('0x21')](_0x4462d7,_0x349ce6,!![]);}catch(_0x17f8cc){return BPromise[_0x3752('0x22')](_0x17f8cc);}return _0x4462d7['save']();};}function saveUpdates(_0x31937c,_0x4e9644){return function(_0x2c82a2){if(_0x2c82a2){return _0x2c82a2[_0x3752('0x23')](_0x31937c)[_0x3752('0x24')](function(_0x5649e3){return _0x5649e3;});}return null;};}function removeEntity(_0x58ce26,_0x20a117){return function(_0x1ec571){if(_0x1ec571){return _0x1ec571[_0x3752('0x25')]()[_0x3752('0x24')](function(){_0x58ce26[_0x3752('0x18')](0xcc)[_0x3752('0x19')]();});}};}function handleEntityNotFound(_0x7b2676,_0x43cba9){return function(_0x31abe6){if(!_0x31abe6){_0x7b2676['sendStatus'](0x194);}return _0x31abe6;};}function handleError(_0x3127eb,_0x9df465){_0x9df465=_0x9df465||0x1f4;return function(_0x4838d3){logger[_0x3752('0x26')](_0x4838d3[_0x3752('0x27')]);if(_0x4838d3['name']){delete _0x4838d3[_0x3752('0x28')];}_0x3127eb[_0x3752('0x18')](_0x9df465)[_0x3752('0x29')](_0x4838d3);};}exports['index']=function(_0x2bed70,_0x5f484c){var _0x2401e1={},_0x368897={},_0xed157e={'count':0x0,'rows':[]};var _0x3e5c19=_['map'](db['JscriptySessionReport'][_0x3752('0x2a')],function(_0x2b8d3c){return{'name':_0x2b8d3c[_0x3752('0x2b')],'type':_0x2b8d3c[_0x3752('0x2c')][_0x3752('0x2d')]};});_0x368897['model']=_[_0x3752('0x2e')](_0x3e5c19,_0x3752('0x28'));_0x368897[_0x3752('0x2f')]=_['keys'](_0x2bed70[_0x3752('0x2f')]);_0x368897[_0x3752('0x30')]=_[_0x3752('0x31')](_0x368897[_0x3752('0x32')],_0x368897[_0x3752('0x2f')]);_0x2401e1[_0x3752('0x33')]=_['intersection'](_0x368897[_0x3752('0x32')],qs['fields'](_0x2bed70[_0x3752('0x2f')][_0x3752('0x34')]));_0x2401e1[_0x3752('0x33')]=_0x2401e1[_0x3752('0x33')][_0x3752('0x35')]?_0x2401e1['attributes']:_0x368897[_0x3752('0x32')];if(!_0x2bed70[_0x3752('0x2f')][_0x3752('0x36')]('nolimit')){_0x2401e1[_0x3752('0x1c')]=qs[_0x3752('0x1c')](_0x2bed70[_0x3752('0x2f')][_0x3752('0x1c')]);_0x2401e1[_0x3752('0x1b')]=qs[_0x3752('0x1b')](_0x2bed70['query'][_0x3752('0x1b')]);}_0x2401e1[_0x3752('0x37')]=qs['sort'](_0x2bed70[_0x3752('0x2f')][_0x3752('0x38')]);_0x2401e1['where']=qs[_0x3752('0x30')](_['pick'](_0x2bed70[_0x3752('0x2f')],_0x368897[_0x3752('0x30')]),_0x3e5c19);if(_0x2bed70[_0x3752('0x2f')][_0x3752('0x39')]){_0x2401e1[_0x3752('0x3a')]=_['merge'](_0x2401e1[_0x3752('0x3a')],{'$or':_['map'](_0x3e5c19,function(_0x4212cc){if(_0x4212cc[_0x3752('0x2c')]!=='VIRTUAL'){var _0x1732ff={};_0x1732ff[_0x4212cc[_0x3752('0x28')]]={'$like':'%'+_0x2bed70['query']['filter']+'%'};return _0x1732ff;}})});}_0x2401e1=_[_0x3752('0x3b')]({},_0x2401e1,_0x2bed70['options']);var _0x3bbbd1={'where':_0x2401e1['where']};return db['JscriptySessionReport'][_0x3752('0x1e')](_0x3bbbd1)[_0x3752('0x24')](function(_0x1b9a7c){_0xed157e[_0x3752('0x1e')]=_0x1b9a7c;if(_0x2bed70[_0x3752('0x2f')][_0x3752('0x3c')]){_0x2401e1['include']=[{'all':!![]}];}return db[_0x3752('0x3d')]['findAll'](_0x2401e1);})['then'](function(_0x3c7b36){_0xed157e['rows']=_0x3c7b36;return _0xed157e;})['then'](respondWithFilteredResult(_0x5f484c,_0x2401e1))[_0x3752('0x3e')](handleError(_0x5f484c,null));};exports[_0x3752('0x3f')]=function(_0x15d42a,_0x4a885c){var _0x565446={'raw':!![],'where':{'id':_0x15d42a[_0x3752('0x40')]['id']}},_0x15458d={};_0x15458d[_0x3752('0x32')]=_[_0x3752('0x41')](db[_0x3752('0x3d')][_0x3752('0x2a')]);_0x15458d[_0x3752('0x2f')]=_[_0x3752('0x41')](_0x15d42a[_0x3752('0x2f')]);_0x15458d[_0x3752('0x30')]=_['intersection'](_0x15458d[_0x3752('0x32')],_0x15458d[_0x3752('0x2f')]);_0x565446[_0x3752('0x33')]=_['intersection'](_0x15458d[_0x3752('0x32')],qs[_0x3752('0x34')](_0x15d42a['query'][_0x3752('0x34')]));_0x565446[_0x3752('0x33')]=_0x565446['attributes'][_0x3752('0x35')]?_0x565446['attributes']:_0x15458d['model'];if(_0x15d42a[_0x3752('0x2f')]['includeAll']){_0x565446['include']=[{'all':!![]}];}_0x565446=_[_0x3752('0x3b')]({},_0x565446,_0x15d42a[_0x3752('0x42')]);return db[_0x3752('0x3d')][_0x3752('0x43')](_0x565446)['then'](handleEntityNotFound(_0x4a885c,null))['then'](respondWithResult(_0x4a885c,null))['catch'](handleError(_0x4a885c,null));};exports['create']=function(_0x2780d9,_0x4b3ef0){return db[_0x3752('0x3d')][_0x3752('0x44')](_0x2780d9[_0x3752('0x45')],{})[_0x3752('0x24')](respondWithResult(_0x4b3ef0,0xc9))[_0x3752('0x3e')](handleError(_0x4b3ef0,null));};exports['update']=function(_0x205f7c,_0x59fdba){if(_0x205f7c[_0x3752('0x45')]['id']){delete _0x205f7c['body']['id'];}return db[_0x3752('0x3d')]['find']({'where':{'id':_0x205f7c[_0x3752('0x40')]['id']}})['then'](handleEntityNotFound(_0x59fdba,null))['then'](saveUpdates(_0x205f7c[_0x3752('0x45')],null))[_0x3752('0x24')](respondWithResult(_0x59fdba,null))['catch'](handleError(_0x59fdba,null));};exports[_0x3752('0x25')]=function(_0x5854e9,_0x1ca909){return db['JscriptySessionReport'][_0x3752('0x43')]({'where':{'id':_0x5854e9['params']['id']}})[_0x3752('0x24')](handleEntityNotFound(_0x1ca909,null))[_0x3752('0x24')](removeEntity(_0x1ca909,null))['catch'](handleError(_0x1ca909,null));};exports[_0x3752('0x46')]=function(_0x12d966,_0x5a8a4c){return db[_0x3752('0x3d')][_0x3752('0x46')]()['then'](respondWithResult(_0x5a8a4c,null))[_0x3752('0x3e')](handleError(_0x5a8a4c,null));};exports[_0x3752('0x47')]=function(_0x437fa0,_0x2a3e58,_0x557244){var _0x4ddb63={'raw':!![],'where':{}};var _0x59b192={};var _0x5b7235={'count':0x0,'rows':[]};return db[_0x3752('0x3d')][_0x3752('0x48')]({'where':{'id':_0x437fa0[_0x3752('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a3e58,null))[_0x3752('0x24')](function(_0x45d33c){if(_0x45d33c){_0x59b192[_0x3752('0x32')]=_[_0x3752('0x41')](db['JscriptyQuestionReport']['rawAttributes']);_0x59b192[_0x3752('0x2f')]=_[_0x3752('0x41')](_0x437fa0[_0x3752('0x2f')]);_0x59b192[_0x3752('0x30')]=_[_0x3752('0x31')](_0x59b192['model'],_0x59b192[_0x3752('0x2f')]);_0x4ddb63[_0x3752('0x33')]=_['intersection'](_0x59b192[_0x3752('0x32')],qs[_0x3752('0x34')](_0x437fa0[_0x3752('0x2f')][_0x3752('0x34')]));_0x4ddb63['attributes']=_0x4ddb63[_0x3752('0x33')][_0x3752('0x35')]?_0x4ddb63[_0x3752('0x33')]:_0x59b192[_0x3752('0x32')];if(!_0x437fa0[_0x3752('0x2f')][_0x3752('0x36')](_0x3752('0x49'))){_0x4ddb63[_0x3752('0x1c')]=qs[_0x3752('0x1c')](_0x437fa0[_0x3752('0x2f')][_0x3752('0x1c')]);_0x4ddb63[_0x3752('0x1b')]=qs['offset'](_0x437fa0['query'][_0x3752('0x1b')]);}_0x4ddb63[_0x3752('0x37')]=qs['sort'](_0x437fa0[_0x3752('0x2f')][_0x3752('0x38')]);_0x4ddb63[_0x3752('0x3a')]=qs[_0x3752('0x30')](_['pick'](_0x437fa0['query'],_0x59b192[_0x3752('0x30')]));_0x4ddb63[_0x3752('0x3a')][_0x3752('0x4a')]=_0x45d33c['id'];if(_0x437fa0[_0x3752('0x2f')][_0x3752('0x39')]){_0x4ddb63[_0x3752('0x3a')]=_[_0x3752('0x3b')](_0x4ddb63[_0x3752('0x3a')],{'$or':_['map'](_0x4ddb63[_0x3752('0x33')],function(_0x1b3a0e){var _0x46f334={};_0x46f334[_0x1b3a0e]={'$like':'%'+_0x437fa0['query'][_0x3752('0x39')]+'%'};return _0x46f334;})});}_0x4ddb63=_['merge']({},_0x4ddb63,_0x437fa0[_0x3752('0x42')]);return db[_0x3752('0x4b')][_0x3752('0x1e')]({'where':_0x4ddb63[_0x3752('0x3a')]})[_0x3752('0x24')](function(_0x3ae324){_0x5b7235[_0x3752('0x1e')]=_0x3ae324;if(_0x437fa0[_0x3752('0x2f')][_0x3752('0x3c')]){_0x4ddb63[_0x3752('0x4c')]=[{'all':!![]}];}return db[_0x3752('0x4b')][_0x3752('0x4d')](_0x4ddb63);})['then'](function(_0x4507c7){_0x5b7235['rows']=_0x4507c7;return _0x5b7235;});}})['then'](respondWithFilteredResult(_0x2a3e58,_0x4ddb63))['catch'](handleError(_0x2a3e58,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ada3a6f..ee87d80 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 _0xd101=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd101,0xc1));var _0x1d10=function(_0x3d2273,_0x1d7c69){_0x3d2273=_0x3d2273-0x0;var _0x4309dc=_0xd101[_0x3d2273];return _0x4309dc;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var logger=require(_0x1d10('0x1'))(_0x1d10('0x2'));var moment=require(_0x1d10('0x3'));var BPromise=require(_0x1d10('0x4'));var rp=require(_0x1d10('0x5'));var fs=require('fs');var path=require(_0x1d10('0x6'));var rimraf=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0x1d10('0x9')]=function(_0x203072,_0x2a4e2d){return _0x203072[_0x1d10('0xa')](_0x1d10('0xb'),attributes,{'tableName':_0x1d10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9d=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x46add2,_0x4346d4){var _0x226d64=function(_0x11ae18){while(--_0x11ae18){_0x46add2['push'](_0x46add2['shift']());}};_0x226d64(++_0x4346d4);}(_0x8f9d,0x93));var _0xd8f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f9d[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 4444e66..fac8679 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 _0x3e24=['info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0x3e24,0x167));var _0x43e2=function(_0x5533b9,_0x4e4fda){_0x5533b9=_0x5533b9-0x0;var _0x3f0335=_0x3e24[_0x5533b9];return _0x3f0335;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});} \ No newline at end of file +var _0x5204=['rpc','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5204,0xdf));var _0x4520=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x5204[_0x5db99b];return _0x4b2d0e;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 295586c..acef3a8 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 _0xf450=['/download_log_file','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update'];(function(_0x3f3277,_0x4b6659){var _0x224348=function(_0x44919a){while(--_0x44919a){_0x3f3277['push'](_0x3f3277['shift']());}};_0x224348(++_0x4b6659);}(_0xf450,0x192));var _0x0f45=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf450[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x0f45('0x0'));var path=require(_0x0f45('0x1'));var timeout=require(_0x0f45('0x2'));var express=require(_0x0f45('0x3'));var router=express[_0x0f45('0x4')]();var fs_extra=require(_0x0f45('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0f45('0x6'));var config=require(_0x0f45('0x7'));var controller=require(_0x0f45('0x8'));router[_0x0f45('0x9')]('/',controller[_0x0f45('0xa')]);router['put'](_0x0f45('0xb'),auth[_0x0f45('0xc')](),controller[_0x0f45('0xd')]);router['get'](_0x0f45('0xe'),auth[_0x0f45('0xc')](),controller['downloadLogFile']);module[_0x0f45('0xf')]=router; \ No newline at end of file +var _0xc8db=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','put','/:id','isAuthenticated','get','/download_log_file','exports','multer','path','connect-timeout'];(function(_0x44c824,_0x19dd71){var _0x33e86b=function(_0x26a098){while(--_0x26a098){_0x44c824['push'](_0x44c824['shift']());}};_0x33e86b(++_0x19dd71);}(_0xc8db,0xed));var _0xbc8d=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc8db[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0xbc8d('0x0'));var util=require('util');var path=require(_0xbc8d('0x1'));var timeout=require(_0xbc8d('0x2'));var express=require(_0xbc8d('0x3'));var router=express[_0xbc8d('0x4')]();var fs_extra=require(_0xbc8d('0x5'));var auth=require(_0xbc8d('0x6'));var interaction=require(_0xbc8d('0x7'));var config=require(_0xbc8d('0x8'));var controller=require('./license.controller');router['get']('/',controller[_0xbc8d('0x9')]);router[_0xbc8d('0xa')](_0xbc8d('0xb'),auth[_0xbc8d('0xc')](),controller['update']);router[_0xbc8d('0xd')](_0xbc8d('0xe'),auth[_0xbc8d('0xc')](),controller['downloadLogFile']);module[_0xbc8d('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index fefa2bf..528e3c6 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 _0xb41b=['STRING'];(function(_0x3ee28f,_0x136b17){var _0x6e7832=function(_0x1709a0){while(--_0x1709a0){_0x3ee28f['push'](_0x3ee28f['shift']());}};_0x6e7832(++_0x136b17);}(_0xb41b,0x191));var _0xbb41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb41b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xbb41('0x0')]},'data2':{'type':Sequelize[_0xbb41('0x0')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ee8=['STRING','exports'];(function(_0x18901b,_0xb5473e){var _0x489aa7=function(_0x267cf1){while(--_0x267cf1){_0x18901b['push'](_0x18901b['shift']());}};_0x489aa7(++_0xb5473e);}(_0x8ee8,0xd9));var _0x88ee=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x8ee8[_0x215dc8];return _0x583ea3;};'use strict';var Sequelize=require('sequelize');module[_0x88ee('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x88ee('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 14dcb55..22fb3bf 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 _0xa480=['offset','undefined','count','set','apply','reject','save','destroy','then','error','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','update','body','find','params','get','key','demo','catch','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x5d53b7,_0x14e6cf){var _0x5bad85=function(_0x39ba5e){while(--_0x39ba5e){_0x5d53b7['push'](_0x5d53b7['shift']());}};_0x5bad85(++_0x14e6cf);}(_0xa480,0x153));var _0x0a48=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0xa480[_0x10f6e8];return _0x35bb3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a48('0x0'));var zipdir=require(_0x0a48('0x1'));var jsonpatch=require(_0x0a48('0x2'));var rp=require(_0x0a48('0x3'));var moment=require(_0x0a48('0x4'));var BPromise=require(_0x0a48('0x5'));var Mustache=require('mustache');var util=require(_0x0a48('0x6'));var path=require(_0x0a48('0x7'));var sox=require(_0x0a48('0x8'));var csv=require('to-csv');var ejs=require(_0x0a48('0x9'));var fs=require('fs');var fs_extra=require(_0x0a48('0xa'));var _=require('lodash');var squel=require(_0x0a48('0xb'));var crypto=require(_0x0a48('0xc'));var jsforce=require(_0x0a48('0xd'));var deskjs=require(_0x0a48('0xe'));var toCsv=require(_0x0a48('0xf'));var querystring=require(_0x0a48('0x10'));var Papa=require(_0x0a48('0x11'));var Redis=require('ioredis');var authService=require(_0x0a48('0x12'));var qs=require(_0x0a48('0x13'));var as=require(_0x0a48('0x14'));var hardwareService=require(_0x0a48('0x15'));var logger=require(_0x0a48('0x16'))(_0x0a48('0x17'));var utils=require('../../config/utils');var config=require(_0x0a48('0x18'));var licenseUtil=require(_0x0a48('0x19'));var db=require(_0x0a48('0x1a'))['db'];function respondWithStatusCode(_0x22aef1,_0x35e67e){_0x35e67e=_0x35e67e||0xcc;return function(_0x3cb082){if(_0x3cb082){return _0x22aef1[_0x0a48('0x1b')](_0x35e67e);}return _0x22aef1['status'](_0x35e67e)[_0x0a48('0x1c')]();};}function respondWithResult(_0x3af816,_0x20d854){_0x20d854=_0x20d854||0xc8;return function(_0x30997d){if(_0x30997d){return _0x3af816[_0x0a48('0x1d')](_0x20d854)[_0x0a48('0x1e')](_0x30997d);}};}function respondWithFilteredResult(_0x35b54f,_0x587286){return function(_0x2831b4){if(_0x2831b4){var _0x5c99c7=typeof _0x587286[_0x0a48('0x1f')]===_0x0a48('0x20')&&typeof _0x587286['limit']===_0x0a48('0x20');var _0xf61682=_0x2831b4[_0x0a48('0x21')];var _0x56b97e=_0x5c99c7?0x0:_0x587286[_0x0a48('0x1f')];var _0x401d70=_0x5c99c7?_0x2831b4[_0x0a48('0x21')]:_0x587286[_0x0a48('0x1f')]+_0x587286['limit'];var _0x396e66;if(_0x401d70>=_0xf61682){_0x401d70=_0xf61682;_0x396e66=0xc8;}else{_0x396e66=0xce;}_0x35b54f[_0x0a48('0x1d')](_0x396e66);return _0x35b54f[_0x0a48('0x22')]('Content-Range',_0x56b97e+'-'+_0x401d70+'/'+_0xf61682)[_0x0a48('0x1e')](_0x2831b4);}return null;};}function patchUpdates(_0x254410){return function(_0x16730d){try{jsonpatch[_0x0a48('0x23')](_0x16730d,_0x254410,!![]);}catch(_0x94d45a){return BPromise[_0x0a48('0x24')](_0x94d45a);}return _0x16730d[_0x0a48('0x25')]();};}function saveUpdates(_0x4505a1,_0x4e043e){return function(_0xc757a9){if(_0xc757a9){return _0xc757a9['update'](_0x4505a1)['then'](function(_0x2de756){return _0x2de756;});}return null;};}function removeEntity(_0x54bab3,_0x18e02e){return function(_0x5d861b){if(_0x5d861b){return _0x5d861b[_0x0a48('0x26')]()[_0x0a48('0x27')](function(){_0x54bab3['status'](0xcc)[_0x0a48('0x1c')]();});}};}function handleEntityNotFound(_0x5ca62e,_0x547ef6){return function(_0x49c166){if(!_0x49c166){_0x5ca62e[_0x0a48('0x1b')](0x194);}return _0x49c166;};}function handleError(_0x5991d2,_0x39125a){_0x39125a=_0x39125a||0x1f4;return function(_0xd2e7fc){logger[_0x0a48('0x28')](_0xd2e7fc['stack']);if(_0xd2e7fc[_0x0a48('0x29')]){delete _0xd2e7fc[_0x0a48('0x29')];}_0x5991d2[_0x0a48('0x1d')](_0x39125a)[_0x0a48('0x2a')](_0xd2e7fc);};}var utilLicense=require(_0x0a48('0x19'));exports[_0x0a48('0x2b')]=function(_0x25ab24,_0x40cd3e){var _0xe2b95e={'raw':!![],'where':{'id':0x1}},_0x1a463b={};_0x1a463b[_0x0a48('0x2c')]=_[_0x0a48('0x2d')](db[_0x0a48('0x2e')][_0x0a48('0x2f')]);_0x1a463b[_0x0a48('0x30')]=_[_0x0a48('0x2d')](_0x25ab24[_0x0a48('0x30')]);_0x1a463b[_0x0a48('0x31')]=_[_0x0a48('0x32')](_0x1a463b['model'],_0x1a463b[_0x0a48('0x30')]);_0xe2b95e[_0x0a48('0x33')]=_['intersection'](_0x1a463b['model'],qs['fields'](_0x25ab24[_0x0a48('0x30')][_0x0a48('0x34')]));_0xe2b95e['attributes']=_0xe2b95e[_0x0a48('0x33')][_0x0a48('0x35')]?_0xe2b95e[_0x0a48('0x33')]:_0x1a463b[_0x0a48('0x2c')];_0xe2b95e=_[_0x0a48('0x36')]({},_0xe2b95e,_0x25ab24[_0x0a48('0x37')]);return utilLicense['getLicense'](_0xe2b95e)['then'](respondWithResult(_0x40cd3e,null))['catch'](handleError(_0x40cd3e,null));};exports[_0x0a48('0x38')]=function(_0x92f5f7,_0x512c7b){if(_0x92f5f7[_0x0a48('0x39')]['id']){delete _0x92f5f7[_0x0a48('0x39')]['id'];}return db[_0x0a48('0x2e')][_0x0a48('0x3a')]({'where':{'id':_0x92f5f7[_0x0a48('0x3b')]['id']}})[_0x0a48('0x27')](handleEntityNotFound(_0x512c7b,null))['then'](function(_0xcfb62e){var _0x5d2dae=_0xcfb62e[_0x0a48('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x5d2dae,_0x92f5f7[_0x0a48('0x39')][_0x0a48('0x3d')]);})['then'](function(_0x3e48cd){if(!_0x3e48cd[_0x0a48('0x3e')]){return saveUpdates(_0x92f5f7['body'],null);}return _0x3e48cd;})['then'](respondWithResult(_0x512c7b,null))[_0x0a48('0x3f')](handleError(_0x512c7b,null));};exports['downloadLogFile']=function(_0x55dab9,_0x4c9fa3){var _0x2d051a=_0x0a48('0x40');var _0x49c628=path[_0x0a48('0x41')](_0x0a48('0x42'),_0x0a48('0x43'),_0x0a48('0x44'),_0x2d051a);_0x4c9fa3[_0x0a48('0x45')](_0x0a48('0x46'),'attachment;\x20filename='+_0x2d051a);_0x4c9fa3[_0x0a48('0x22')](_0x0a48('0x47'),_0x0a48('0x48'));_0x4c9fa3[_0x0a48('0x49')](_0x49c628);}; \ No newline at end of file +var _0xdb53=['../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','send','index','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','catch','body','License','find','params','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','download','zip-dir','fast-json-patch','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x196dad,_0x46c9be){var _0x2a57f9=function(_0x3e2550){while(--_0x3e2550){_0x196dad['push'](_0x196dad['shift']());}};_0x2a57f9(++_0x46c9be);}(_0xdb53,0x177));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3db5('0x0'));var jsonpatch=require(_0x3db5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3db5('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3db5('0x3'));var sox=require(_0x3db5('0x4'));var csv=require('to-csv');var ejs=require(_0x3db5('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3db5('0x6'));var squel=require('squel');var crypto=require(_0x3db5('0x7'));var jsforce=require(_0x3db5('0x8'));var deskjs=require(_0x3db5('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3db5('0xa'));var Redis=require(_0x3db5('0xb'));var authService=require(_0x3db5('0xc'));var qs=require(_0x3db5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3db5('0xe'))('api');var utils=require(_0x3db5('0xf'));var config=require(_0x3db5('0x10'));var licenseUtil=require(_0x3db5('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3afe82,_0x1e4659){_0x1e4659=_0x1e4659||0xcc;return function(_0x463c57){if(_0x463c57){return _0x3afe82['sendStatus'](_0x1e4659);}return _0x3afe82[_0x3db5('0x12')](_0x1e4659)[_0x3db5('0x13')]();};}function respondWithResult(_0x5d4386,_0x3709ed){_0x3709ed=_0x3709ed||0xc8;return function(_0x14fa67){if(_0x14fa67){return _0x5d4386[_0x3db5('0x12')](_0x3709ed)[_0x3db5('0x14')](_0x14fa67);}};}function respondWithFilteredResult(_0x18a4bd,_0x1e4cd7){return function(_0x3e19ff){if(_0x3e19ff){var _0x22226d=typeof _0x1e4cd7[_0x3db5('0x15')]===_0x3db5('0x16')&&typeof _0x1e4cd7[_0x3db5('0x17')]==='undefined';var _0x28451a=_0x3e19ff[_0x3db5('0x18')];var _0x193240=_0x22226d?0x0:_0x1e4cd7[_0x3db5('0x15')];var _0x32f4aa=_0x22226d?_0x3e19ff[_0x3db5('0x18')]:_0x1e4cd7[_0x3db5('0x15')]+_0x1e4cd7[_0x3db5('0x17')];var _0x28ead0;if(_0x32f4aa>=_0x28451a){_0x32f4aa=_0x28451a;_0x28ead0=0xc8;}else{_0x28ead0=0xce;}_0x18a4bd[_0x3db5('0x12')](_0x28ead0);return _0x18a4bd['set'](_0x3db5('0x19'),_0x193240+'-'+_0x32f4aa+'/'+_0x28451a)[_0x3db5('0x14')](_0x3e19ff);}return null;};}function patchUpdates(_0x166048){return function(_0x1b6936){try{jsonpatch[_0x3db5('0x1a')](_0x1b6936,_0x166048,!![]);}catch(_0x275ef9){return BPromise[_0x3db5('0x1b')](_0x275ef9);}return _0x1b6936[_0x3db5('0x1c')]();};}function saveUpdates(_0x4040b1,_0x641394){return function(_0xda9c1d){if(_0xda9c1d){return _0xda9c1d[_0x3db5('0x1d')](_0x4040b1)['then'](function(_0x24ac32){return _0x24ac32;});}return null;};}function removeEntity(_0x223878,_0x399a86){return function(_0x48658e){if(_0x48658e){return _0x48658e[_0x3db5('0x1e')]()[_0x3db5('0x1f')](function(){_0x223878[_0x3db5('0x12')](0xcc)[_0x3db5('0x13')]();});}};}function handleEntityNotFound(_0x1ed235,_0x4b8105){return function(_0x537e4c){if(!_0x537e4c){_0x1ed235[_0x3db5('0x20')](0x194);}return _0x537e4c;};}function handleError(_0x109bcc,_0x335ce5){_0x335ce5=_0x335ce5||0x1f4;return function(_0x565b53){logger[_0x3db5('0x21')](_0x565b53[_0x3db5('0x22')]);if(_0x565b53['name']){delete _0x565b53['name'];}_0x109bcc[_0x3db5('0x12')](_0x335ce5)[_0x3db5('0x23')](_0x565b53);};}var utilLicense=require('../../config/license/util');exports[_0x3db5('0x24')]=function(_0x1b6460,_0x3a48ca){var _0xb9cee4={'raw':!![],'where':{'id':0x1}},_0x1d905c={};_0x1d905c[_0x3db5('0x25')]=_['keys'](db['License'][_0x3db5('0x26')]);_0x1d905c[_0x3db5('0x27')]=_[_0x3db5('0x28')](_0x1b6460[_0x3db5('0x27')]);_0x1d905c[_0x3db5('0x29')]=_[_0x3db5('0x2a')](_0x1d905c['model'],_0x1d905c[_0x3db5('0x27')]);_0xb9cee4[_0x3db5('0x2b')]=_[_0x3db5('0x2a')](_0x1d905c[_0x3db5('0x25')],qs[_0x3db5('0x2c')](_0x1b6460[_0x3db5('0x27')][_0x3db5('0x2c')]));_0xb9cee4[_0x3db5('0x2b')]=_0xb9cee4[_0x3db5('0x2b')][_0x3db5('0x2d')]?_0xb9cee4[_0x3db5('0x2b')]:_0x1d905c[_0x3db5('0x25')];_0xb9cee4=_[_0x3db5('0x2e')]({},_0xb9cee4,_0x1b6460[_0x3db5('0x2f')]);return utilLicense['getLicense'](_0xb9cee4)[_0x3db5('0x1f')](respondWithResult(_0x3a48ca,null))[_0x3db5('0x30')](handleError(_0x3a48ca,null));};exports[_0x3db5('0x1d')]=function(_0x14d3ae,_0x5ef372){if(_0x14d3ae[_0x3db5('0x31')]['id']){delete _0x14d3ae[_0x3db5('0x31')]['id'];}return db[_0x3db5('0x32')][_0x3db5('0x33')]({'where':{'id':_0x14d3ae[_0x3db5('0x34')]['id']}})[_0x3db5('0x1f')](handleEntityNotFound(_0x5ef372,null))[_0x3db5('0x1f')](function(_0x1ae9f0){var _0x4908ad=_0x1ae9f0['get']({'plain':!![]});return utilLicense[_0x3db5('0x35')](_0x4908ad,_0x14d3ae[_0x3db5('0x31')][_0x3db5('0x36')]);})['then'](function(_0x8ce060){if(!_0x8ce060['demo']){return saveUpdates(_0x14d3ae['body'],null);}return _0x8ce060;})['then'](respondWithResult(_0x5ef372,null))[_0x3db5('0x30')](handleError(_0x5ef372,null));};exports[_0x3db5('0x37')]=function(_0x35c422,_0x3fa2e7){var _0x31ec33=_0x3db5('0x38');var _0x19660f=path[_0x3db5('0x39')](_0x3db5('0x3a'),_0x3db5('0x3b'),'xcally',_0x31ec33);_0x3fa2e7[_0x3db5('0x3c')](_0x3db5('0x3d'),_0x3db5('0x3e')+_0x31ec33);_0x3fa2e7['set'](_0x3db5('0x3f'),'text/plain');_0x3fa2e7[_0x3db5('0x40')](_0x19660f);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index aaa4cd7..1a4330f 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 _0x6741=['api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','License','license','util','../../config/logger'];(function(_0xcd199c,_0xc4bf77){var _0x3a701f=function(_0x36fba1){while(--_0x36fba1){_0xcd199c['push'](_0xcd199c['shift']());}};_0x3a701f(++_0xc4bf77);}(_0x6741,0x136));var _0x1674=function(_0x571206,_0xc4baa1){_0x571206=_0x571206-0x0;var _0x5bbca9=_0x6741[_0x571206];return _0x5bbca9;};'use strict';var _=require('lodash');var util=require(_0x1674('0x0'));var logger=require(_0x1674('0x1'))(_0x1674('0x2'));var moment=require(_0x1674('0x3'));var BPromise=require(_0x1674('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1674('0x5'));var rimraf=require(_0x1674('0x6'));var config=require(_0x1674('0x7'));var attributes=require(_0x1674('0x8'));module[_0x1674('0x9')]=function(_0x5a5ab8,_0x239332){return _0x5a5ab8['define'](_0x1674('0xa'),attributes,{'tableName':_0x1674('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd12d=['lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x8ce506,_0x517f30){var _0x23c8e5=function(_0x1d048e){while(--_0x1d048e){_0x8ce506['push'](_0x8ce506['shift']());}};_0x23c8e5(++_0x517f30);}(_0xd12d,0x1cb));var _0xdd12=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd12d[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xdd12('0x0'));var util=require('util');var logger=require(_0xdd12('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd12('0x2'));var fs=require('fs');var path=require(_0xdd12('0x3'));var rimraf=require(_0xdd12('0x4'));var config=require(_0xdd12('0x5'));var attributes=require(_0xdd12('0x6'));module[_0xdd12('0x7')]=function(_0x2f3134,_0x58e6bb){return _0x2f3134[_0xdd12('0x8')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index f070d35..f53897b 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 _0xb71b=['then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','request'];(function(_0x3cb374,_0x3ddfc0){var _0x173d17=function(_0x1de0b1){while(--_0x1de0b1){_0x3cb374['push'](_0x3cb374['shift']());}};_0x173d17(++_0x3ddfc0);}(_0xb71b,0x102));var _0xbb71=function(_0x292bec,_0x3c251c){_0x292bec=_0x292bec-0x0;var _0x376583=_0xb71b[_0x292bec];return _0x376583;};'use strict';var _=require('lodash');var util=require(_0xbb71('0x0'));var moment=require(_0xbb71('0x1'));var BPromise=require(_0xbb71('0x2'));var rs=require(_0xbb71('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbb71('0x4'));var config=require(_0xbb71('0x5'));var jayson=require(_0xbb71('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b6517,_0x142233,_0x81ec06){return new BPromise(function(_0x4f4edd,_0x51b5e2){return client[_0xbb71('0x7')](_0x2b6517,_0x81ec06)[_0xbb71('0x8')](function(_0x35868d){logger[_0xbb71('0x9')](_0xbb71('0xa'),_0x142233,_0xbb71('0xb'));logger[_0xbb71('0xc')](_0xbb71('0xd'),_0x142233,_0xbb71('0xb'),JSON[_0xbb71('0xe')](_0x35868d));if(_0x35868d['error']){if(_0x35868d[_0xbb71('0xf')][_0xbb71('0x10')]===0x1f4){logger[_0xbb71('0xf')](_0xbb71('0xa'),_0x142233,_0x35868d['error'][_0xbb71('0x11')]);return _0x51b5e2(_0x35868d[_0xbb71('0xf')][_0xbb71('0x11')]);}logger[_0xbb71('0xf')](_0xbb71('0xa'),_0x142233,_0x35868d[_0xbb71('0xf')]['message']);return _0x4f4edd(_0x35868d[_0xbb71('0xf')][_0xbb71('0x11')]);}else{logger[_0xbb71('0x9')](_0xbb71('0xa'),_0x142233,_0xbb71('0xb'));_0x4f4edd(_0x35868d['result']['message']);}})[_0xbb71('0x12')](function(_0x1f51a9){logger[_0xbb71('0xf')]('License,\x20%s,\x20%s',_0x142233,_0x1f51a9);_0x51b5e2(_0x1f51a9);});});} \ No newline at end of file +var _0xde17=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2308a3,_0x3cd7f1){var _0x311322=function(_0x4030be){while(--_0x4030be){_0x2308a3['push'](_0x2308a3['shift']());}};_0x311322(++_0x3cd7f1);}(_0xde17,0x114));var _0x7de1=function(_0x4857e0,_0x1d2fe0){_0x4857e0=_0x4857e0-0x0;var _0x53896e=_0xde17[_0x4857e0];return _0x53896e;};'use strict';var _=require(_0x7de1('0x0'));var util=require(_0x7de1('0x1'));var moment=require(_0x7de1('0x2'));var BPromise=require(_0x7de1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7de1('0x4'))['db'];var utils=require(_0x7de1('0x5'));var logger=require(_0x7de1('0x6'))(_0x7de1('0x7'));var config=require(_0x7de1('0x8'));var jayson=require(_0x7de1('0x9'));var client=jayson[_0x7de1('0xa')][_0x7de1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19c5ad,_0x255ea5,_0x1bab6b){return new BPromise(function(_0x5aa875,_0xb1a56c){return client[_0x7de1('0xc')](_0x19c5ad,_0x1bab6b)[_0x7de1('0xd')](function(_0x223bcc){logger[_0x7de1('0xe')](_0x7de1('0xf'),_0x255ea5,_0x7de1('0x10'));logger[_0x7de1('0x11')](_0x7de1('0x12'),_0x255ea5,'request\x20sent',JSON[_0x7de1('0x13')](_0x223bcc));if(_0x223bcc[_0x7de1('0x14')]){if(_0x223bcc[_0x7de1('0x14')][_0x7de1('0x15')]===0x1f4){logger[_0x7de1('0x14')]('License,\x20%s,\x20%s',_0x255ea5,_0x223bcc[_0x7de1('0x14')]['message']);return _0xb1a56c(_0x223bcc[_0x7de1('0x14')][_0x7de1('0x16')]);}logger[_0x7de1('0x14')]('License,\x20%s,\x20%s',_0x255ea5,_0x223bcc[_0x7de1('0x14')][_0x7de1('0x16')]);return _0x5aa875(_0x223bcc[_0x7de1('0x14')]['message']);}else{logger[_0x7de1('0xe')]('License,\x20%s,\x20%s',_0x255ea5,_0x7de1('0x10'));_0x5aa875(_0x223bcc[_0x7de1('0x17')][_0x7de1('0x16')]);}})[_0x7de1('0x18')](function(_0x52cc80){logger[_0x7de1('0x14')](_0x7de1('0xf'),_0x255ea5,_0x52cc80);_0xb1a56c(_0x52cc80);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6d004ba..dba26bf 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 _0xf250=['/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','verifySmtp','getAgents','post','addDisposition','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id','destroy','removeAgents','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions'];(function(_0x1539fc,_0x1dc147){var _0x586493=function(_0x278eb1){while(--_0x278eb1){_0x1539fc['push'](_0x1539fc['shift']());}};_0x586493(++_0x1dc147);}(_0xf250,0x87));var _0x0f25=function(_0x588dd2,_0x5c8152){_0x588dd2=_0x588dd2-0x0;var _0x4f208e=_0xf250[_0x588dd2];return _0x4f208e;};'use strict';var multer=require(_0x0f25('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0f25('0x1'));var express=require(_0x0f25('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0f25('0x3'));var interaction=require(_0x0f25('0x4'));var config=require(_0x0f25('0x5'));var controller=require(_0x0f25('0x6'));router[_0x0f25('0x7')]('/',auth[_0x0f25('0x8')](),controller[_0x0f25('0x9')]);router[_0x0f25('0x7')](_0x0f25('0xa'),auth[_0x0f25('0x8')](),controller[_0x0f25('0xb')]);router[_0x0f25('0x7')]('/:id',auth[_0x0f25('0x8')](),controller[_0x0f25('0xc')]);router[_0x0f25('0x7')](_0x0f25('0xd'),auth[_0x0f25('0x8')](),controller[_0x0f25('0xe')]);router[_0x0f25('0x7')](_0x0f25('0xf'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x10')]);router[_0x0f25('0x7')](_0x0f25('0x11'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x12')]);router[_0x0f25('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x0f25('0x13')]);router[_0x0f25('0x7')](_0x0f25('0x14'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x15')]);router[_0x0f25('0x7')](_0x0f25('0x16'),auth[_0x0f25('0x8')](),controller['getApplications']);router['get'](_0x0f25('0x17'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x18')]);router['get']('/:id/verify',auth[_0x0f25('0x8')](),controller[_0x0f25('0x19')]);router[_0x0f25('0x7')]('/:id/users',auth[_0x0f25('0x8')](),controller[_0x0f25('0x1a')]);router[_0x0f25('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0f25('0x1c')]);router['post'](_0x0f25('0xf'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0f25('0x1e')]);router[_0x0f25('0x1b')]('/:id/in_servers',auth[_0x0f25('0x8')](),controller['addImap']);router[_0x0f25('0x1b')](_0x0f25('0x1f'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x20')]);router[_0x0f25('0x1b')]('/:id/interactions',auth[_0x0f25('0x8')](),controller[_0x0f25('0x21')]);router[_0x0f25('0x1b')](_0x0f25('0x16'),auth['isAuthenticated'](),controller[_0x0f25('0x22')]);router[_0x0f25('0x1b')](_0x0f25('0x23'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x24')]);router['post'](_0x0f25('0x25'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x26')]);router[_0x0f25('0x27')]('/:id',auth['isAuthenticated'](),controller[_0x0f25('0x28')]);router[_0x0f25('0x29')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0f25('0x2a')]);router[_0x0f25('0x29')](_0x0f25('0xf'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x2b')]);router[_0x0f25('0x29')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0f25('0x2c')]);router[_0x0f25('0x29')]('/:id/out_servers',auth[_0x0f25('0x8')](),controller[_0x0f25('0x2d')]);router[_0x0f25('0x29')](_0x0f25('0x2e'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x2f')]);router['delete'](_0x0f25('0x25'),auth[_0x0f25('0x8')](),controller[_0x0f25('0x30')]);module[_0x0f25('0x31')]=router; \ No newline at end of file +var _0xa179=['getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','/:id/users','getAgents','addDisposition','post','addAnswer','addImap','addInteraction','/:id/send','addAgents','removeDispositions','delete','removeAnswers','removeImap','/:id','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers'];(function(_0x2dcb9a,_0x185507){var _0x48343b=function(_0x106fb9){while(--_0x106fb9){_0x2dcb9a['push'](_0x2dcb9a['shift']());}};_0x48343b(++_0x185507);}(_0xa179,0x131));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9a17('0x0'));var util=require(_0x9a17('0x1'));var path=require(_0x9a17('0x2'));var timeout=require(_0x9a17('0x3'));var express=require(_0x9a17('0x4'));var router=express[_0x9a17('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x9a17('0x6')]('/',auth[_0x9a17('0x7')](),controller['index']);router[_0x9a17('0x6')](_0x9a17('0x8'),auth['isAuthenticated'](),controller[_0x9a17('0x9')]);router['get']('/:id',auth[_0x9a17('0x7')](),controller[_0x9a17('0xa')]);router[_0x9a17('0x6')](_0x9a17('0xb'),auth[_0x9a17('0x7')](),controller[_0x9a17('0xc')]);router[_0x9a17('0x6')](_0x9a17('0xd'),auth[_0x9a17('0x7')](),controller['getAnswers']);router['get'](_0x9a17('0xe'),auth[_0x9a17('0x7')](),controller[_0x9a17('0xf')]);router[_0x9a17('0x6')](_0x9a17('0x10'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x11')]);router[_0x9a17('0x6')](_0x9a17('0x12'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x13')]);router[_0x9a17('0x6')](_0x9a17('0x14'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x9a17('0x15'),auth[_0x9a17('0x7')](),controller['getMessages']);router[_0x9a17('0x6')](_0x9a17('0x16'),auth[_0x9a17('0x7')](),controller['verifySmtp']);router[_0x9a17('0x6')](_0x9a17('0x17'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x18')]);router['post'](_0x9a17('0xb'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x19')]);router[_0x9a17('0x1a')](_0x9a17('0xd'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x1b')]);router[_0x9a17('0x1a')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9a17('0xe'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x1c')]);router['post'](_0x9a17('0x10'),auth[_0x9a17('0x7')](),controller['addSmtp']);router['post'](_0x9a17('0x12'),auth['isAuthenticated'](),controller[_0x9a17('0x1d')]);router[_0x9a17('0x1a')](_0x9a17('0x14'),auth[_0x9a17('0x7')](),controller['addApplications']);router[_0x9a17('0x1a')](_0x9a17('0x1e'),auth[_0x9a17('0x7')](),controller['send']);router[_0x9a17('0x1a')]('/:id/users',auth[_0x9a17('0x7')](),controller[_0x9a17('0x1f')]);router['put']('/:id',auth[_0x9a17('0x7')](),controller['update']);router['delete'](_0x9a17('0xb'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x20')]);router[_0x9a17('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9a17('0x22')]);router[_0x9a17('0x21')](_0x9a17('0xe'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x23')]);router[_0x9a17('0x21')](_0x9a17('0x10'),auth[_0x9a17('0x7')](),controller['removeSmtp']);router[_0x9a17('0x21')](_0x9a17('0x24'),auth[_0x9a17('0x7')](),controller[_0x9a17('0x25')]);router['delete'](_0x9a17('0x17'),auth['isAuthenticated'](),controller[_0x9a17('0x26')]);module[_0x9a17('0x27')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e9bf831..a12d1e3 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 _0xc939=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','INTEGER','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2b22c0,_0x4cb8f8){var _0x45c8ef=function(_0x4f2828){while(--_0x4f2828){_0x2b22c0['push'](_0x2b22c0['shift']());}};_0x45c8ef(++_0x4cb8f8);}(_0xc939,0x106));var _0x9c93=function(_0x31e470,_0x288dfa){_0x31e470=_0x31e470-0x0;var _0x52c4c9=_0xc939[_0x31e470];return _0x52c4c9;};'use strict';var Sequelize=require(_0x9c93('0x0'));module[_0x9c93('0x1')]={'description':{'type':Sequelize[_0x9c93('0x2')]},'name':{'type':Sequelize[_0x9c93('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x9c93('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9c93('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x9c93('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9c93('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x9c93('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9c93('0x5')],'defaultValue':function(){return _0x9c93('0x6');}},'notificationSound':{'type':Sequelize[_0x9c93('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9c93('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c93('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9c93('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c93('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c93('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c93('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c93('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9c93('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x28e2a4){if(!_0x28e2a4)this[_0x9c93('0x8')](_0x9c93('0x9'),null);this['setDataValue'](_0x9c93('0xa'),_0x28e2a4);}},'provider':{'type':Sequelize[_0x9c93('0xb')](_0x9c93('0xc'),_0x9c93('0xd'),_0x9c93('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x9c93('0xf')](_0x9c93('0x10')))return _0x9c93('0x11');return this[_0x9c93('0xf')](_0x9c93('0x10'));},'set':function(_0xc80c14){if(_0xc80c14===_0x9c93('0x11'))_0xc80c14=null;return this['setDataValue']('provider',_0xc80c14);}}}; \ No newline at end of file +var _0xae72=['Arial,Helvetica,sans-serif','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT'];(function(_0x52f802,_0x525f42){var _0x424630=function(_0x1342d7){while(--_0x1342d7){_0x52f802['push'](_0x52f802['shift']());}};_0x424630(++_0x525f42);}(_0xae72,0x11c));var _0x2ae7=function(_0x1956c9,_0x2ad6b4){_0x1956c9=_0x1956c9-0x0;var _0x499d4=_0xae72[_0x1956c9];return _0x499d4;};'use strict';var Sequelize=require('sequelize');module[_0x2ae7('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2ae7('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x2ae7('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x2ae7('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2ae7('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x2ae7('0x3')]},'markAsUnread':{'type':Sequelize[_0x2ae7('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2ae7('0x1')],'allowNull':![],'defaultValue':_0x2ae7('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2ae7('0x3')],'defaultValue':function(){return _0x2ae7('0x5');}},'notificationSound':{'type':Sequelize[_0x2ae7('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2ae7('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2ae7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2ae7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2ae7('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2ae7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2ae7('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2ae7('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x2ae7('0x2')],'defaultValue':![],'comment':_0x2ae7('0x8'),'set':function(_0x5b9dba){if(!_0x5b9dba)this[_0x2ae7('0x9')](_0x2ae7('0xa'),null);this[_0x2ae7('0x9')](_0x2ae7('0xb'),_0x5b9dba);}},'provider':{'type':Sequelize[_0x2ae7('0xc')](_0x2ae7('0xd'),'hotmail',_0x2ae7('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x2ae7('0xf')](_0x2ae7('0x10')))return _0x2ae7('0x11');return this[_0x2ae7('0xf')](_0x2ae7('0x10'));},'set':function(_0x1f1c16){if(_0x1f1c16===_0x2ae7('0x11'))_0x1f1c16=null;return this[_0x2ae7('0x9')](_0x2ae7('0x10'),_0x1f1c16);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 88c3e47..bb3e947 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 _0x71bc=['color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','sendStatus','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','out','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','isArray','userMailAccount:remove','getAgents','moment','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','json','update','destroy','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','params','MailServerOut','intersection','length','includeAll','options','find','body','provider','describe','MailAccountId','Disposition','create','findOne','hasOwnProperty','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags'];(function(_0x250ec0,_0x11d6b3){var _0x4e8a99=function(_0x386238){while(--_0x386238){_0x250ec0['push'](_0x250ec0['shift']());}};_0x4e8a99(++_0x11d6b3);}(_0x71bc,0x1bf));var _0xc71b=function(_0x315366,_0x1f27ae){_0x315366=_0x315366-0x0;var _0x307d3b=_0x71bc[_0x315366];return _0x307d3b;};'use strict';var moment=require(_0xc71b('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xc71b('0x1'));var _=require(_0xc71b('0x2'));var juice=require(_0xc71b('0x3'));var Redis=require(_0xc71b('0x4'));var qs=require(_0xc71b('0x5'));var logger=require(_0xc71b('0x6'))(_0xc71b('0x7'));var config=require(_0xc71b('0x8'));var db=require(_0xc71b('0x9'))['db'];config[_0xc71b('0xa')]=_['defaults'](config[_0xc71b('0xa')],{'host':_0xc71b('0xb'),'port':0x18eb});var socket=require(_0xc71b('0xc'))(new Redis(config[_0xc71b('0xa')]));require(_0xc71b('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc71b('0xe')][_0xc71b('0xf')]({'port':0x232b});function respondWithRpcPromise(_0xd99b4a,_0x364887,_0x8f3b48,_0x2c648f){return new BPromise(function(_0x1fc46d,_0x407e77){var _0x49b147=_0x2c648f||client;return _0x49b147[_0xc71b('0x10')](_0xd99b4a,_0x8f3b48)[_0xc71b('0x11')](function(_0xe5557b){logger[_0xc71b('0x12')](_0xc71b('0x13'),_0x364887,'request\x20sent');logger[_0xc71b('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x364887,_0xc71b('0x15'),JSON[_0xc71b('0x16')](_0xe5557b));if(_0xe5557b[_0xc71b('0x17')]){if(_0xe5557b[_0xc71b('0x17')][_0xc71b('0x18')]===0x1f4){logger['error'](_0xc71b('0x13'),_0x364887,_0xe5557b[_0xc71b('0x17')]['message']);return _0x407e77(_0xe5557b['error'][_0xc71b('0x19')]);}logger[_0xc71b('0x17')](_0xc71b('0x13'),_0x364887,_0xe5557b['error'][_0xc71b('0x19')]);return _0x1fc46d(_0xe5557b[_0xc71b('0x17')][_0xc71b('0x19')]);}else{logger[_0xc71b('0x12')](_0xc71b('0x13'),_0x364887,_0xc71b('0x15'));_0x1fc46d(_0xe5557b[_0xc71b('0x1a')]['message']);}})[_0xc71b('0x1b')](function(_0x450838){logger[_0xc71b('0x17')](_0xc71b('0x13'),_0x364887,_0x450838);_0x407e77(_0x450838);});});}function respondWithStatusCode(_0x29b72c,_0x4b918e){_0x4b918e=_0x4b918e||0xcc;return function(_0x469f25){if(_0x469f25){return _0x29b72c['sendStatus'](_0x4b918e);}return _0x29b72c[_0xc71b('0x1c')](_0x4b918e)[_0xc71b('0x1d')]();};}function respondWithResult(_0x538d4f,_0x5bfc26){_0x5bfc26=_0x5bfc26||0xc8;return function(_0x4afc77){if(_0x4afc77){return _0x538d4f[_0xc71b('0x1c')](_0x5bfc26)['json'](_0x4afc77);}};}function respondWithFilteredResult(_0x5952b2,_0xf6fc51){return function(_0x247db4){if(_0x247db4){var _0x5c126c=typeof _0xf6fc51[_0xc71b('0x1e')]===_0xc71b('0x1f')&&typeof _0xf6fc51[_0xc71b('0x20')]==='undefined';var _0x53d41c=_0x247db4[_0xc71b('0x21')];var _0x22b83b=_0x5c126c?0x0:_0xf6fc51[_0xc71b('0x1e')];var _0x1341e2=_0x5c126c?_0x247db4[_0xc71b('0x21')]:_0xf6fc51['offset']+_0xf6fc51[_0xc71b('0x20')];var _0x2b1626;if(_0x1341e2>=_0x53d41c){_0x1341e2=_0x53d41c;_0x2b1626=0xc8;}else{_0x2b1626=0xce;}_0x5952b2[_0xc71b('0x1c')](_0x2b1626);return _0x5952b2[_0xc71b('0x22')]('Content-Range',_0x22b83b+'-'+_0x1341e2+'/'+_0x53d41c)[_0xc71b('0x23')](_0x247db4);}return null;};}function saveUpdates(_0x8c695c){return function(_0x5c374e){if(_0x5c374e){return _0x5c374e[_0xc71b('0x24')](_0x8c695c)[_0xc71b('0x11')](function(_0x2ded1a){return _0x2ded1a;});}return null;};}function removeEntity(_0x5567d2){return function(_0x5bc7f1){if(_0x5bc7f1){return _0x5bc7f1[_0xc71b('0x25')]()[_0xc71b('0x11')](function(){var _0x1ad734=_0x5bc7f1['get']({'plain':!![]});var _0x4ce7b0='MailAccounts';return db['UserProfileResource'][_0xc71b('0x25')]({'where':{'type':_0x4ce7b0,'resourceId':_0x1ad734['id']}})[_0xc71b('0x11')](function(){return _0x5bc7f1;});})[_0xc71b('0x11')](function(){_0x5567d2[_0xc71b('0x1c')](0xcc)[_0xc71b('0x1d')]();});}};}function handleEntityNotFound(_0x415b19){return function(_0x37b525){if(!_0x37b525){_0x415b19['sendStatus'](0x194);}return _0x37b525;};}function handleError(_0x56d1d1,_0x220656){_0x220656=_0x220656||0x1f4;return function(_0xb7b873){logger[_0xc71b('0x17')](_0xb7b873[_0xc71b('0x26')]);if(_0xb7b873[_0xc71b('0x27')]){delete _0xb7b873[_0xc71b('0x27')];}_0x56d1d1[_0xc71b('0x1c')](_0x220656)[_0xc71b('0x28')](_0xb7b873);};}function getImapHost(_0x3c742a){switch(_0x3c742a){case _0xc71b('0x29'):return'imap.gmail.com';case _0xc71b('0x2a'):return _0xc71b('0x2b');case _0xc71b('0x2c'):return _0xc71b('0x2d');case _0xc71b('0x2e'):return _0xc71b('0x2f');}throw new Error(_0xc71b('0x30'),_0x3c742a);}function getSmtpHost(_0x1d20ba){switch(_0x1d20ba){case _0xc71b('0x29'):return _0xc71b('0x31');case _0xc71b('0x2a'):return _0xc71b('0x32');case _0xc71b('0x2c'):return _0xc71b('0x33');case _0xc71b('0x2e'):return _0xc71b('0x34');}throw new Error(_0xc71b('0x30'),_0x1d20ba);}function getAuthenticationOptions(_0x1e0c71,_0x4574ed){var _0x43620e={};var _0x200283={};if(_0x1e0c71){_0x43620e[_0xc71b('0x35')]=_0x200283[_0xc71b('0x35')]=_0x4574ed['username'];_0x43620e[_0xc71b('0x36')]=_0x200283[_0xc71b('0x37')]=_0x4574ed['password'];if(_0x4574ed[_0xc71b('0x38')]){_0x43620e[_0xc71b('0x38')]=_0x200283['modernAuthentication']=!![];_0x43620e['CloudProviderId']=_0x200283[_0xc71b('0x39')]=_0x4574ed[_0xc71b('0x39')];_0x43620e['password']=_0x200283[_0xc71b('0x37')]=null;}else{_0x43620e[_0xc71b('0x39')]=_0x200283[_0xc71b('0x39')]=null;}_0x43620e[_0xc71b('0x3a')]=getImapHost(_0x1e0c71);_0x43620e[_0xc71b('0x3b')]=0x3e1;_0x200283[_0xc71b('0x3a')]=getSmtpHost(_0x1e0c71);_0x200283[_0xc71b('0x3b')]=0x24b;_0x200283[_0xc71b('0x3c')]=![];_0x43620e[_0xc71b('0x3d')]=_0x200283['service']=null;}else{if(_0x4574ed[_0xc71b('0x3e')]){_0x43620e[_0xc71b('0x35')]=_0x200283[_0xc71b('0x35')]=_0x4574ed['username'];_0x43620e[_0xc71b('0x36')]=_0x200283[_0xc71b('0x37')]=_0x4574ed[_0xc71b('0x36')];}else{_0x43620e[_0xc71b('0x3e')]=_0x200283[_0xc71b('0x3e')]=![];_0x43620e[_0xc71b('0x35')]=_0x200283[_0xc71b('0x35')]=null;_0x43620e[_0xc71b('0x36')]=_0x200283[_0xc71b('0x37')]=null;}_0x43620e['host']=_0x4574ed[_0xc71b('0x3f')]['host'];_0x43620e[_0xc71b('0x3b')]=_0x4574ed['Imap'][_0xc71b('0x3b')];_0x200283[_0xc71b('0x3a')]=_0x4574ed[_0xc71b('0x40')][_0xc71b('0x3a')];_0x200283['port']=_0x4574ed[_0xc71b('0x40')][_0xc71b('0x3b')];}return{'Imap':_0x43620e,'Smtp':_0x200283};}exports[_0xc71b('0x41')]=function(_0xdd1f0b,_0x43e158){var _0x53d047={'include':[{'model':db[_0xc71b('0x42')],'as':_0xc71b('0x3f')},{'model':db['MailServerOut'],'as':_0xc71b('0x40')},{'model':db[_0xc71b('0x43')],'as':_0xc71b('0x44')}]},_0x6e6cb5={},_0x412af3={'count':0x0,'rows':[]};var _0x180098=_[_0xc71b('0x45')](db[_0xc71b('0x46')][_0xc71b('0x47')],function(_0x140b90){return{'name':_0x140b90[_0xc71b('0x48')],'type':_0x140b90['type'][_0xc71b('0x49')]};});_0x6e6cb5['model']=_[_0xc71b('0x45')](_0x180098,'name');_0x6e6cb5[_0xc71b('0x4a')]=_[_0xc71b('0x4b')](_0xdd1f0b[_0xc71b('0x4a')]);_0x6e6cb5[_0xc71b('0x4c')]=_['intersection'](_0x6e6cb5[_0xc71b('0x4d')],_0x6e6cb5['query']);_0x53d047[_0xc71b('0x4e')]=_['intersection'](_0x6e6cb5[_0xc71b('0x4d')],qs[_0xc71b('0x4f')](_0xdd1f0b[_0xc71b('0x4a')]['fields']));_0x53d047['attributes']=_0x53d047[_0xc71b('0x4e')]['length']?_0x53d047[_0xc71b('0x4e')]:_0x6e6cb5[_0xc71b('0x4d')];if(!_0xdd1f0b[_0xc71b('0x4a')]['hasOwnProperty'](_0xc71b('0x50'))){_0x53d047[_0xc71b('0x20')]=qs[_0xc71b('0x20')](_0xdd1f0b[_0xc71b('0x4a')][_0xc71b('0x20')]);_0x53d047[_0xc71b('0x1e')]=qs[_0xc71b('0x1e')](_0xdd1f0b['query'][_0xc71b('0x1e')]);}_0x53d047['order']=qs[_0xc71b('0x51')](_0xdd1f0b[_0xc71b('0x4a')]['sort']);_0x53d047[_0xc71b('0x52')]=qs[_0xc71b('0x4c')](_[_0xc71b('0x53')](_0xdd1f0b[_0xc71b('0x4a')],_0x6e6cb5[_0xc71b('0x4c')]),_0x180098);if(_0xdd1f0b[_0xc71b('0x4a')][_0xc71b('0x54')]){_0x53d047['where']=_[_0xc71b('0x55')](_0x53d047[_0xc71b('0x52')],{'$or':_[_0xc71b('0x45')](_0x180098,function(_0x4e533c){if(_0x4e533c[_0xc71b('0x56')]!==_0xc71b('0x57')){var _0xd93a8a={};_0xd93a8a[_0x4e533c[_0xc71b('0x27')]]={'$like':'%'+_0xdd1f0b[_0xc71b('0x4a')][_0xc71b('0x54')]+'%'};return _0xd93a8a;}})});}_0x53d047=_[_0xc71b('0x55')]({},_0x53d047,_0xdd1f0b['options']);var _0x1689c8={'where':_0x53d047[_0xc71b('0x52')]};return db[_0xc71b('0x46')][_0xc71b('0x21')](_0x1689c8)[_0xc71b('0x11')](function(_0x5b7f34){_0x412af3[_0xc71b('0x21')]=_0x5b7f34;if(_0xdd1f0b['query']['includeAll']){_0x53d047[_0xc71b('0x58')]=[{'all':!![]}];}return db['MailAccount'][_0xc71b('0x59')](_0x53d047);})[_0xc71b('0x11')](function(_0x1e79f6){_0x412af3[_0xc71b('0x5a')]=_0x1e79f6;return _0x412af3;})['then'](respondWithFilteredResult(_0x43e158,_0x53d047))['catch'](handleError(_0x43e158,null));};exports['show']=function(_0x25b447,_0x3f990a){var _0x3abb91={'raw':![],'where':{'id':_0x25b447[_0xc71b('0x5b')]['id']},'include':[{'model':db[_0xc71b('0x42')],'as':_0xc71b('0x3f')},{'model':db[_0xc71b('0x5c')],'as':_0xc71b('0x40')},{'model':db['Pause'],'as':_0xc71b('0x44')}]},_0x50ebbd={};_0x50ebbd[_0xc71b('0x4d')]=_['keys'](db[_0xc71b('0x46')][_0xc71b('0x47')]);_0x50ebbd[_0xc71b('0x4a')]=_['keys'](_0x25b447[_0xc71b('0x4a')]);_0x50ebbd['filters']=_[_0xc71b('0x5d')](_0x50ebbd['model'],_0x50ebbd['query']);_0x3abb91[_0xc71b('0x4e')]=_[_0xc71b('0x5d')](_0x50ebbd[_0xc71b('0x4d')],qs['fields'](_0x25b447[_0xc71b('0x4a')][_0xc71b('0x4f')]));_0x3abb91[_0xc71b('0x4e')]=_0x3abb91[_0xc71b('0x4e')][_0xc71b('0x5e')]?_0x3abb91[_0xc71b('0x4e')]:_0x50ebbd[_0xc71b('0x4d')];if(_0x25b447[_0xc71b('0x4a')][_0xc71b('0x5f')]){_0x3abb91[_0xc71b('0x58')]=[{'all':!![]}];}_0x3abb91=_['merge']({},_0x3abb91,_0x25b447[_0xc71b('0x60')]);return db['MailAccount'][_0xc71b('0x61')](_0x3abb91)['then'](handleEntityNotFound(_0x3f990a,null))[_0xc71b('0x11')](respondWithResult(_0x3f990a,null))[_0xc71b('0x1b')](handleError(_0x3f990a,null));};exports[_0xc71b('0x24')]=function(_0x5505a8,_0x21f01b){if(_0x5505a8[_0xc71b('0x62')]['id']){delete _0x5505a8[_0xc71b('0x62')]['id'];}var _0x223ac0=_0x5505a8[_0xc71b('0x62')][_0xc71b('0x63')]==='custom'?null:_0x5505a8[_0xc71b('0x62')][_0xc71b('0x63')];var _0xec2f00=_0x5505a8[_0xc71b('0x62')]['Imap']||{};var _0x3250b1=_0x5505a8[_0xc71b('0x62')][_0xc71b('0x40')]||{};if(_0x223ac0){_0xec2f00['host']=getImapHost(_0x223ac0);_0xec2f00['port']=0x3e1;_0x3250b1['host']=getSmtpHost(_0x223ac0);_0x3250b1['port']=0x24b;_0x3250b1[_0xc71b('0x3c')]=![];}if(_0x3250b1[_0xc71b('0x38')]){_0x3250b1[_0xc71b('0x3c')]=![];}else{_0x3250b1['CloudProviderId']=null;}if(!_0xec2f00[_0xc71b('0x38')])_0xec2f00[_0xc71b('0x39')]=null;_0x5505a8[_0xc71b('0x62')][_0xc71b('0x3f')]=_0xec2f00;_0x5505a8[_0xc71b('0x62')][_0xc71b('0x40')]=_0x3250b1;return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x5505a8[_0xc71b('0x5b')]['id']},'include':[{'model':db[_0xc71b('0x42')],'as':'Imap'},{'model':db[_0xc71b('0x5c')],'as':_0xc71b('0x40')},{'model':db[_0xc71b('0x43')],'as':'mandatoryDispositionPause'}]})[_0xc71b('0x11')](handleEntityNotFound(_0x21f01b,null))[_0xc71b('0x11')](function(_0x29ff2d){if(!_0x29ff2d)throw new Error('Mail\x20Account\x20not\x20found');if(_0x29ff2d[_0xc71b('0x3d')])delete _0x5505a8[_0xc71b('0x62')][_0xc71b('0x3f')];return _0x29ff2d;})[_0xc71b('0x11')](saveUpdates(_0x5505a8['body'],null))[_0xc71b('0x11')](function(_0x474c9a){if(!_0x5505a8[_0xc71b('0x62')][_0xc71b('0x3f')])return _0x474c9a;return db['MailServerIn']['update'](_0x5505a8[_0xc71b('0x62')][_0xc71b('0x3f')],{'where':{'MailAccountId':_0x474c9a['id']}})[_0xc71b('0x11')](function(){return _0x474c9a;});})[_0xc71b('0x11')](function(_0x388b7d){if(!_0x5505a8['body']['Smtp'])return _0x388b7d;return db[_0xc71b('0x5c')][_0xc71b('0x24')](_0x5505a8[_0xc71b('0x62')]['Smtp'],{'where':{'MailAccountId':_0x388b7d['id']}})[_0xc71b('0x11')](function(){return _0x388b7d;});})[_0xc71b('0x11')](respondWithResult(_0x21f01b,null))[_0xc71b('0x1b')](handleError(_0x21f01b,null));};exports[_0xc71b('0x64')]=function(_0x5a299e,_0x5536d2){return db[_0xc71b('0x46')]['describe']()[_0xc71b('0x11')](respondWithResult(_0x5536d2,null))[_0xc71b('0x1b')](handleError(_0x5536d2,null));};exports['addDisposition']=function(_0x140499,_0x16c954){if(_0x140499[_0xc71b('0x62')]['id']){delete _0x140499[_0xc71b('0x62')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x140499[_0xc71b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x16c954,null))[_0xc71b('0x11')](function(_0x53ee06){if(_0x53ee06){_0x140499['body'][_0xc71b('0x65')]=_0x53ee06['id'];return db[_0xc71b('0x66')][_0xc71b('0x67')](_0x140499[_0xc71b('0x62')]);}})[_0xc71b('0x11')](respondWithResult(_0x16c954,null))[_0xc71b('0x1b')](handleError(_0x16c954,null));};exports['getDispositions']=function(_0x4381f2,_0x401e87){var _0x4616af={'raw':![],'where':{}};var _0x1f3049={};var _0x43ade9={'count':0x0,'rows':[]};return db[_0xc71b('0x46')][_0xc71b('0x68')]({'where':{'id':_0x4381f2['params']['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x401e87,null))[_0xc71b('0x11')](function(_0x704723){if(_0x704723){_0x1f3049[_0xc71b('0x4d')]=_[_0xc71b('0x4b')](db[_0xc71b('0x66')][_0xc71b('0x47')]);_0x1f3049[_0xc71b('0x4a')]=_[_0xc71b('0x4b')](_0x4381f2['query']);_0x1f3049[_0xc71b('0x4c')]=_['intersection'](_0x1f3049[_0xc71b('0x4d')],_0x1f3049[_0xc71b('0x4a')]);_0x4616af['attributes']=_[_0xc71b('0x5d')](_0x1f3049[_0xc71b('0x4d')],qs['fields'](_0x4381f2[_0xc71b('0x4a')][_0xc71b('0x4f')]));_0x4616af[_0xc71b('0x4e')]=_0x4616af['attributes'][_0xc71b('0x5e')]?_0x4616af[_0xc71b('0x4e')]:_0x1f3049[_0xc71b('0x4d')];if(!_0x4381f2[_0xc71b('0x4a')][_0xc71b('0x69')](_0xc71b('0x50'))){_0x4616af[_0xc71b('0x20')]=qs[_0xc71b('0x20')](_0x4381f2[_0xc71b('0x4a')][_0xc71b('0x20')]);_0x4616af[_0xc71b('0x1e')]=qs[_0xc71b('0x1e')](_0x4381f2[_0xc71b('0x4a')][_0xc71b('0x1e')]);}_0x4616af[_0xc71b('0x6a')]=qs['sort'](_0x4381f2[_0xc71b('0x4a')][_0xc71b('0x51')]);_0x4616af[_0xc71b('0x52')]=qs[_0xc71b('0x4c')](_[_0xc71b('0x53')](_0x4381f2[_0xc71b('0x4a')],_0x1f3049['filters']));_0x4616af[_0xc71b('0x52')][_0xc71b('0x65')]=_0x704723['id'];if(_0x4381f2[_0xc71b('0x4a')][_0xc71b('0x54')]){_0x4616af[_0xc71b('0x52')]=_[_0xc71b('0x55')](_0x4616af[_0xc71b('0x52')],{'$or':_['map'](_0x4616af[_0xc71b('0x4e')],function(_0x5d9b45){var _0x5f5582={};_0x5f5582[_0x5d9b45]={'$like':'%'+_0x4381f2[_0xc71b('0x4a')][_0xc71b('0x54')]+'%'};return _0x5f5582;})});}_0x4616af=_[_0xc71b('0x55')]({},_0x4616af,_0x4381f2['options']);return db[_0xc71b('0x66')][_0xc71b('0x21')]({'where':_0x4616af[_0xc71b('0x52')]})['then'](function(_0x4b5e5d){_0x43ade9['count']=_0x4b5e5d;if(_0x4381f2[_0xc71b('0x4a')][_0xc71b('0x5f')]){_0x4616af[_0xc71b('0x58')]=[{'all':!![]}];}return db[_0xc71b('0x66')][_0xc71b('0x59')](_0x4616af);})[_0xc71b('0x11')](function(_0x18f1ea){_0x43ade9['rows']=_0x18f1ea;return _0x43ade9;});}})[_0xc71b('0x11')](respondWithFilteredResult(_0x401e87,_0x4616af))[_0xc71b('0x1b')](handleError(_0x401e87,null));};exports[_0xc71b('0x6b')]=function(_0x54a4e7,_0x4c6670){return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x54a4e7[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x4c6670,null))['then'](function(_0x2a069a){if(_0x2a069a){return _0x2a069a[_0xc71b('0x6b')](_0x54a4e7[_0xc71b('0x4a')][_0xc71b('0x6c')]);}})[_0xc71b('0x11')](respondWithStatusCode(_0x4c6670,null))['catch'](handleError(_0x4c6670,null));};exports[_0xc71b('0x6d')]=function(_0x2ae6b4,_0x325985){if(_0x2ae6b4[_0xc71b('0x62')]['id']){delete _0x2ae6b4[_0xc71b('0x62')]['id'];}return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x2ae6b4[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x325985,null))[_0xc71b('0x11')](function(_0x49e520){if(_0x49e520){_0x2ae6b4['body'][_0xc71b('0x65')]=_0x49e520['id'];return db[_0xc71b('0x6e')]['create'](_0x2ae6b4['body']);}})['then'](respondWithResult(_0x325985,null))['catch'](handleError(_0x325985,null));};exports['getAnswers']=function(_0x3d750d,_0x4b5d1d){var _0x2fd156={'raw':![],'where':{}};var _0x49e283={};var _0x45cb1a={'count':0x0,'rows':[]};return db[_0xc71b('0x46')][_0xc71b('0x68')]({'where':{'id':_0x3d750d[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x4b5d1d,null))[_0xc71b('0x11')](function(_0x524f57){if(_0x524f57){_0x49e283[_0xc71b('0x4d')]=_['keys'](db[_0xc71b('0x6e')][_0xc71b('0x47')]);_0x49e283[_0xc71b('0x4a')]=_[_0xc71b('0x4b')](_0x3d750d[_0xc71b('0x4a')]);_0x49e283['filters']=_[_0xc71b('0x5d')](_0x49e283[_0xc71b('0x4d')],_0x49e283[_0xc71b('0x4a')]);_0x2fd156['attributes']=_[_0xc71b('0x5d')](_0x49e283['model'],qs['fields'](_0x3d750d['query'][_0xc71b('0x4f')]));_0x2fd156[_0xc71b('0x4e')]=_0x2fd156['attributes']['length']?_0x2fd156[_0xc71b('0x4e')]:_0x49e283[_0xc71b('0x4d')];if(!_0x3d750d['query'][_0xc71b('0x69')](_0xc71b('0x50'))){_0x2fd156[_0xc71b('0x20')]=qs[_0xc71b('0x20')](_0x3d750d[_0xc71b('0x4a')][_0xc71b('0x20')]);_0x2fd156[_0xc71b('0x1e')]=qs[_0xc71b('0x1e')](_0x3d750d[_0xc71b('0x4a')][_0xc71b('0x1e')]);}_0x2fd156[_0xc71b('0x6a')]=qs[_0xc71b('0x51')](_0x3d750d[_0xc71b('0x4a')][_0xc71b('0x51')]);_0x2fd156['where']=qs[_0xc71b('0x4c')](_[_0xc71b('0x53')](_0x3d750d[_0xc71b('0x4a')],_0x49e283['filters']));_0x2fd156[_0xc71b('0x52')][_0xc71b('0x65')]=_0x524f57['id'];if(_0x3d750d[_0xc71b('0x4a')][_0xc71b('0x54')]){_0x2fd156[_0xc71b('0x52')]=_[_0xc71b('0x55')](_0x2fd156[_0xc71b('0x52')],{'$or':_[_0xc71b('0x45')](_0x2fd156[_0xc71b('0x4e')],function(_0x331f32){var _0x1f4121={};_0x1f4121[_0x331f32]={'$like':'%'+_0x3d750d['query'][_0xc71b('0x54')]+'%'};return _0x1f4121;})});}_0x2fd156=_[_0xc71b('0x55')]({},_0x2fd156,_0x3d750d['options']);return db['CannedAnswer']['count']({'where':_0x2fd156['where']})[_0xc71b('0x11')](function(_0x5db0b8){_0x45cb1a[_0xc71b('0x21')]=_0x5db0b8;if(_0x3d750d[_0xc71b('0x4a')][_0xc71b('0x5f')]){_0x2fd156['include']=[{'all':!![]}];}return db[_0xc71b('0x6e')]['findAll'](_0x2fd156);})[_0xc71b('0x11')](function(_0x1ae922){_0x45cb1a[_0xc71b('0x5a')]=_0x1ae922;return _0x45cb1a;});}})['then'](respondWithFilteredResult(_0x4b5d1d,_0x2fd156))[_0xc71b('0x1b')](handleError(_0x4b5d1d,null));};exports[_0xc71b('0x6f')]=function(_0x214dc6,_0x4785ae){return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x214dc6['params']['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x4785ae,null))[_0xc71b('0x11')](function(_0x51823f){if(_0x51823f){return _0x51823f['removeAnswers'](_0x214dc6[_0xc71b('0x4a')][_0xc71b('0x6c')]);}})['then'](respondWithStatusCode(_0x4785ae,null))['catch'](handleError(_0x4785ae,null));};exports[_0xc71b('0x67')]=function(_0x147eff,_0x2106a8){var _0x4832fc={'name':_0x147eff['body'][_0xc71b('0x27')],'key':_0x147eff[_0xc71b('0x62')][_0xc71b('0x49')],'provider':_0x147eff[_0xc71b('0x62')][_0xc71b('0x63')]==='custom'?null:_0x147eff[_0xc71b('0x62')][_0xc71b('0x63')],'email':_0x147eff[_0xc71b('0x62')]['email'],'ListId':_0x147eff[_0xc71b('0x62')][_0xc71b('0x70')],'active':!_['isNil'](_0x147eff[_0xc71b('0x62')][_0xc71b('0x71')])?_0x147eff[_0xc71b('0x62')][_0xc71b('0x71')]:!![],'description':_0x147eff['body'][_0xc71b('0x72')]||null};var _0x2c167a=getAuthenticationOptions(_0x4832fc['provider'],_0x147eff[_0xc71b('0x62')]);_0x4832fc[_0xc71b('0x3f')]=_0x2c167a[_0xc71b('0x3f')];_0x4832fc[_0xc71b('0x40')]=_0x2c167a['Smtp'];return db['MailAccount']['create'](_0x4832fc,{'include':[{'model':db[_0xc71b('0x5c')],'as':_0xc71b('0x40')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xc71b('0x11')](function(_0x4ac0a1){var _0x19f411=_0x147eff[_0xc71b('0x35')][_0xc71b('0x73')]({'plain':!![]});if(!_0x19f411)throw new Error(_0xc71b('0x74'));if(_0x19f411[_0xc71b('0x75')]===_0xc71b('0x35')){var _0x53a19e=_0x4ac0a1['get']({'plain':!![]});return db[_0xc71b('0x76')][_0xc71b('0x61')]({'where':{'name':_0xc71b('0x77'),'userProfileId':_0x19f411[_0xc71b('0x78')]},'raw':!![]})[_0xc71b('0x11')](function(_0x42d809){if(_0x42d809&&_0x42d809[_0xc71b('0x79')]===0x0){return db[_0xc71b('0x7a')][_0xc71b('0x67')]({'name':_0x53a19e[_0xc71b('0x27')],'resourceId':_0x53a19e['id'],'type':_0x42d809[_0xc71b('0x27')],'sectionId':_0x42d809['id']},{})[_0xc71b('0x11')](function(){return _0x4ac0a1;});}else{return _0x4ac0a1;}})[_0xc71b('0x1b')](function(_0x3f18c5){logger['error'](_0xc71b('0x7b'),_0x3f18c5);throw _0x3f18c5;});}return _0x4ac0a1;})['then'](respondWithResult(_0x2106a8,0xc9))['catch'](handleError(_0x2106a8,null));};exports['getImap']=function(_0x37e840,_0x37542e){return db[_0xc71b('0x46')][_0xc71b('0x68')]({'where':{'id':_0x37e840[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x37542e,null))[_0xc71b('0x11')](function(_0x11e097){if(_0x11e097){return _0x11e097[_0xc71b('0x7c')]();}return null;})[_0xc71b('0x11')](respondWithResult(_0x37542e,null))[_0xc71b('0x1b')](handleError(_0x37542e,null));};exports[_0xc71b('0x7d')]=function(_0x1da377,_0x32ddd7){if(_0x1da377[_0xc71b('0x62')]['id']){delete _0x1da377[_0xc71b('0x62')]['id'];}return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x1da377[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x32ddd7,null))[_0xc71b('0x11')](function(_0x78c4a9){if(_0x78c4a9){_0x1da377[_0xc71b('0x62')]['MailAccountId']=_0x78c4a9['id'];return db['MailServerIn']['create'](_0x1da377[_0xc71b('0x62')]);}})['then'](respondWithResult(_0x32ddd7,null))[_0xc71b('0x1b')](handleError(_0x32ddd7,null));};exports[_0xc71b('0x7e')]=function(_0x515ae3,_0xed3047){return db[_0xc71b('0x46')][_0xc71b('0x68')]({'where':{'id':_0x515ae3[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0xed3047,null))[_0xc71b('0x11')](function(_0x4d8e4f){if(_0x4d8e4f){return _0x4d8e4f[_0xc71b('0x7f')](null);}return null;})[_0xc71b('0x11')](respondWithStatusCode(_0xed3047,null))[_0xc71b('0x1b')](handleError(_0xed3047,null));};exports['getSmtp']=function(_0x4b267c,_0x2fbb83){return db['MailAccount']['findOne']({'where':{'id':_0x4b267c[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x2fbb83,null))[_0xc71b('0x11')](function(_0x3961f4){if(_0x3961f4){return _0x3961f4[_0xc71b('0x80')]();}return null;})[_0xc71b('0x11')](respondWithResult(_0x2fbb83,null))[_0xc71b('0x1b')](handleError(_0x2fbb83,null));};exports[_0xc71b('0x81')]=function(_0x315d3d,_0x2d9d59){if(_0x315d3d[_0xc71b('0x62')]['id']){delete _0x315d3d[_0xc71b('0x62')]['id'];}return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x315d3d[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x2d9d59,null))[_0xc71b('0x11')](function(_0x332fde){if(_0x332fde){_0x315d3d[_0xc71b('0x62')][_0xc71b('0x65')]=_0x332fde['id'];return db[_0xc71b('0x5c')][_0xc71b('0x67')](_0x315d3d[_0xc71b('0x62')]);}})['then'](respondWithResult(_0x2d9d59,null))[_0xc71b('0x1b')](handleError(_0x2d9d59,null));};exports[_0xc71b('0x82')]=function(_0x2234d6,_0x142906){return db[_0xc71b('0x46')][_0xc71b('0x68')]({'where':{'id':_0x2234d6[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x142906,null))[_0xc71b('0x11')](function(_0x94d8b6){if(_0x94d8b6){return _0x94d8b6['setSmtp'](null);}return null;})[_0xc71b('0x11')](respondWithStatusCode(_0x142906,null))[_0xc71b('0x1b')](handleError(_0x142906,null));};exports[_0xc71b('0x83')]=function(_0x3fd81d,_0x337921){return db[_0xc71b('0x84')][_0xc71b('0x61')]({'where':{'id':_0x3fd81d[_0xc71b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x337921,null))[_0xc71b('0x11')](function(_0x31eaf4){if(_0x31eaf4){return _0x31eaf4[_0xc71b('0x83')](_0x3fd81d[_0xc71b('0x62')][_0xc71b('0x6c')],_[_0xc71b('0x85')](_0x3fd81d[_0xc71b('0x62')],[_0xc71b('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x337921,null))[_0xc71b('0x1b')](handleError(_0x337921,null));};exports[_0xc71b('0x86')]=function(_0xa482db,_0x98052c){var _0x1d2af3={'raw':![],'where':{}};var _0x54cd9c={};var _0x28e1e9={'count':0x0,'rows':[]};return db[_0xc71b('0x46')][_0xc71b('0x68')]({'where':{'id':_0xa482db[_0xc71b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x98052c,null))[_0xc71b('0x11')](function(_0x13009b){if(_0x13009b){_0x54cd9c[_0xc71b('0x4d')]=_['keys'](db[_0xc71b('0x84')][_0xc71b('0x47')]);_0x54cd9c[_0xc71b('0x4a')]=_['keys'](_0xa482db[_0xc71b('0x4a')]);_0x54cd9c[_0xc71b('0x4c')]=_['intersection'](_0x54cd9c[_0xc71b('0x4d')],_0x54cd9c[_0xc71b('0x4a')]);_0x1d2af3[_0xc71b('0x4e')]=_['intersection'](_0x54cd9c[_0xc71b('0x4d')],qs[_0xc71b('0x4f')](_0xa482db[_0xc71b('0x4a')]['fields']));_0x1d2af3['attributes']=_0x1d2af3[_0xc71b('0x4e')][_0xc71b('0x5e')]?_0x1d2af3[_0xc71b('0x4e')]:_0x54cd9c[_0xc71b('0x4d')];if(!_0xa482db[_0xc71b('0x4a')][_0xc71b('0x69')]('nolimit')){_0x1d2af3[_0xc71b('0x20')]=qs[_0xc71b('0x20')](_0xa482db['query'][_0xc71b('0x20')]);_0x1d2af3['offset']=qs[_0xc71b('0x1e')](_0xa482db['query'][_0xc71b('0x1e')]);}_0x1d2af3[_0xc71b('0x6a')]=qs[_0xc71b('0x51')](_0xa482db[_0xc71b('0x4a')][_0xc71b('0x51')]);_0x1d2af3[_0xc71b('0x52')]=qs['filters'](_['pick'](_0xa482db[_0xc71b('0x4a')],_0x54cd9c['filters']));_0x1d2af3[_0xc71b('0x52')]['MailAccountId']=_0x13009b['id'];if(_0xa482db[_0xc71b('0x4a')][_0xc71b('0x54')]){_0x1d2af3[_0xc71b('0x52')]=_[_0xc71b('0x55')](_0x1d2af3[_0xc71b('0x52')],{'$or':_[_0xc71b('0x45')](_0x1d2af3['attributes'],function(_0xc6e4db){var _0x38ceb8={};_0x38ceb8[_0xc6e4db]={'$like':'%'+_0xa482db[_0xc71b('0x4a')]['filter']+'%'};return _0x38ceb8;})});}_0x1d2af3=_[_0xc71b('0x55')]({},_0x1d2af3,_0xa482db[_0xc71b('0x60')]);return db[_0xc71b('0x84')]['count']({'where':_0x1d2af3[_0xc71b('0x52')]})[_0xc71b('0x11')](function(_0x5e9ece){_0x28e1e9[_0xc71b('0x21')]=_0x5e9ece;if(_0xa482db['query'][_0xc71b('0x5f')]){_0x1d2af3[_0xc71b('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xc71b('0x87')],'as':_0xc71b('0x88'),'attributes':[_0xc71b('0x27'),_0xc71b('0x89'),_0xc71b('0x8a')],'required':![]},{'model':db[_0xc71b('0x8b')],'as':_0xc71b('0x8c'),'attributes':['id','name',_0xc71b('0x8d')],'where':_0xa482db[_0xc71b('0x4a')][_0xc71b('0x8e')]?{'id':_0xa482db[_0xc71b('0x4a')][_0xc71b('0x8e')]}:undefined,'required':_0xa482db['query'][_0xc71b('0x8e')]?!![]:![]}];}return db[_0xc71b('0x84')]['findAll'](_0x1d2af3);})[_0xc71b('0x11')](function(_0x390ece){_0x28e1e9[_0xc71b('0x5a')]=_0x390ece;return _0x28e1e9;});}})[_0xc71b('0x11')](respondWithFilteredResult(_0x98052c,_0x1d2af3))[_0xc71b('0x1b')](handleError(_0x98052c,null));};exports['addApplications']=function addApplications(_0x243d28,_0x44ca8d){var _0x4d80d8=_0x243d28[_0xc71b('0x5b')]['id'];var _0x4c6807=_0x243d28['body'];var _0x569d7d=0xc8;var _0x118f90=null;return db[_0xc71b('0x8f')][_0xc71b('0x90')]({'isolationLevel':db[_0xc71b('0x8f')][_0xc71b('0x91')][_0xc71b('0x92')][_0xc71b('0x93')]},function(_0x5ebd10){return db[_0xc71b('0x46')][_0xc71b('0x68')]({'where':{'id':_0x4d80d8},'transaction':_0x5ebd10})[_0xc71b('0x11')](function(_0x5407f7){if(_0x5407f7){return db['MailApplication'][_0xc71b('0x25')]({'where':{'MailAccountId':_0x4d80d8},'transaction':_0x5ebd10})[_0xc71b('0x11')](function(){var _0x43f774=_['map'](_0x4c6807,function(_0x2b74c1){_0x2b74c1[_0xc71b('0x65')]=_0x4d80d8;return _0x2b74c1;});return db[_0xc71b('0x94')]['bulkCreate'](_0x43f774,{'transaction':_0x5ebd10});});}else{_0x569d7d=0x194;_0x118f90=[];}});})[_0xc71b('0x11')](function(){if(_0x569d7d!==0x194){return db[_0xc71b('0x94')][_0xc71b('0x95')]({'where':{'MailAccountId':_0x4d80d8},'order':_0xc71b('0x96')})[_0xc71b('0x11')](function(_0x2bf631){_0x118f90=_0x2bf631;});}})['catch'](function(_0x4d13ce){_0x569d7d=0x1f4;logger[_0xc71b('0x17')](_0x4d13ce[_0xc71b('0x26')]);if(_0x4d13ce[_0xc71b('0x27')]){delete _0x4d13ce['name'];}_0x118f90=_0x4d13ce;})[_0xc71b('0x97')](function(){if(_0x118f90===null){_0x44ca8d[_0xc71b('0x98')](_0x569d7d);}else{if(_0x569d7d===0x1f4){_0x44ca8d[_0xc71b('0x1c')](_0x569d7d)['send'](_0x118f90);}else{_0x44ca8d[_0xc71b('0x1c')](_0x569d7d)[_0xc71b('0x23')](_0x118f90);}}});};exports[_0xc71b('0x99')]=function(_0x2f3d43,_0x4622ac){var _0x485bde={};var _0x527d05={};var _0x3aad81;var _0x4977a2;return db['MailAccount'][_0xc71b('0x68')]({'where':{'id':_0x2f3d43['params']['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x4622ac,null))[_0xc71b('0x11')](function(_0x4b8714){if(_0x4b8714){_0x3aad81=_0x4b8714;_0x527d05[_0xc71b('0x4d')]=_['keys'](db[_0xc71b('0x94')][_0xc71b('0x47')]);_0x527d05[_0xc71b('0x4a')]=_[_0xc71b('0x4b')](_0x2f3d43[_0xc71b('0x4a')]);_0x527d05['filters']=_[_0xc71b('0x5d')](_0x527d05[_0xc71b('0x4d')],_0x527d05[_0xc71b('0x4a')]);_0x485bde[_0xc71b('0x4e')]=_[_0xc71b('0x5d')](_0x527d05[_0xc71b('0x4d')],qs[_0xc71b('0x4f')](_0x2f3d43[_0xc71b('0x4a')][_0xc71b('0x4f')]));_0x485bde[_0xc71b('0x4e')]=_0x485bde[_0xc71b('0x4e')][_0xc71b('0x5e')]?_0x485bde[_0xc71b('0x4e')]:_0x527d05[_0xc71b('0x4d')];_0x485bde[_0xc71b('0x6a')]=qs[_0xc71b('0x51')](_0x2f3d43[_0xc71b('0x4a')]['sort']);_0x485bde[_0xc71b('0x52')]=qs[_0xc71b('0x4c')](_[_0xc71b('0x53')](_0x2f3d43[_0xc71b('0x4a')],_0x527d05[_0xc71b('0x4c')]));if(_0x2f3d43[_0xc71b('0x4a')][_0xc71b('0x54')]){_0x485bde[_0xc71b('0x52')]=_[_0xc71b('0x55')](_0x485bde[_0xc71b('0x52')],{'$or':_[_0xc71b('0x45')](_0x485bde['attributes'],function(_0xe2bf95){var _0x4cf82e={};_0x4cf82e[_0xe2bf95]={'$like':'%'+_0x2f3d43['query'][_0xc71b('0x54')]+'%'};return _0x4cf82e;})});}_0x485bde=_['merge']({},_0x485bde,_0x2f3d43[_0xc71b('0x60')]);return _0x3aad81[_0xc71b('0x99')](_0x485bde);}})['then'](function(_0x310f6f){if(_0x310f6f){_0x4977a2=_0x310f6f['length'];if(!_0x2f3d43[_0xc71b('0x4a')][_0xc71b('0x69')](_0xc71b('0x50'))){_0x485bde[_0xc71b('0x20')]=qs[_0xc71b('0x20')](_0x2f3d43[_0xc71b('0x4a')][_0xc71b('0x20')]);_0x485bde[_0xc71b('0x1e')]=qs[_0xc71b('0x1e')](_0x2f3d43[_0xc71b('0x4a')][_0xc71b('0x1e')]);}return _0x3aad81[_0xc71b('0x99')](_0x485bde);}})[_0xc71b('0x11')](function(_0x456732){if(_0x456732){return _0x456732?{'count':_0x4977a2,'rows':_0x456732}:null;}})[_0xc71b('0x11')](respondWithResult(_0x4622ac,null))[_0xc71b('0x1b')](handleError(_0x4622ac,null));};exports[_0xc71b('0x9a')]=function(_0xadc517,_0x34c375){var _0x528e0c={'raw':!![],'where':{}};var _0x303f94={};var _0x134035={'count':0x0,'rows':[]};return db[_0xc71b('0x46')][_0xc71b('0x68')]({'where':{'id':_0xadc517['params']['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x34c375,null))[_0xc71b('0x11')](function(_0x44e7ba){if(_0x44e7ba){_0x303f94['model']=_[_0xc71b('0x4b')](db[_0xc71b('0x9b')]['rawAttributes']);_0x303f94['query']=_[_0xc71b('0x4b')](_0xadc517[_0xc71b('0x4a')]);_0x303f94[_0xc71b('0x4c')]=_[_0xc71b('0x5d')](_0x303f94[_0xc71b('0x4d')],_0x303f94[_0xc71b('0x4a')]);_0x528e0c[_0xc71b('0x4e')]=_[_0xc71b('0x5d')](_0x303f94['model'],qs[_0xc71b('0x4f')](_0xadc517['query'][_0xc71b('0x4f')]));_0x528e0c[_0xc71b('0x4e')]=_0x528e0c['attributes'][_0xc71b('0x5e')]?_0x528e0c[_0xc71b('0x4e')]:_0x303f94[_0xc71b('0x4d')];if(!_0xadc517[_0xc71b('0x4a')][_0xc71b('0x69')](_0xc71b('0x50'))){_0x528e0c[_0xc71b('0x20')]=qs[_0xc71b('0x20')](_0xadc517[_0xc71b('0x4a')]['limit']);_0x528e0c[_0xc71b('0x1e')]=qs[_0xc71b('0x1e')](_0xadc517['query'][_0xc71b('0x1e')]);}_0x528e0c[_0xc71b('0x6a')]=qs[_0xc71b('0x51')](_0xadc517[_0xc71b('0x4a')][_0xc71b('0x51')]);_0x528e0c[_0xc71b('0x52')]=qs['filters'](_['pick'](_0xadc517[_0xc71b('0x4a')],_0x303f94[_0xc71b('0x4c')]));_0x528e0c['where']['MailAccountId']=_0x44e7ba['id'];if(_0xadc517[_0xc71b('0x4a')]['filter']){_0x528e0c[_0xc71b('0x52')]=_[_0xc71b('0x55')](_0x528e0c[_0xc71b('0x52')],{'$or':_['map'](_0x528e0c[_0xc71b('0x4e')],function(_0x476c2a){var _0x5a0b65={};_0x5a0b65[_0x476c2a]={'$like':'%'+_0xadc517[_0xc71b('0x4a')][_0xc71b('0x54')]+'%'};return _0x5a0b65;})});}if(_0xadc517[_0xc71b('0x4a')][_0xc71b('0x9c')]){var _0xdb8a23=_0xadc517['query'][_0xc71b('0x9c')][_0xc71b('0x9d')](',');var _0x551e2b={};_0x551e2b[_0xdb8a23[0x0]]={'$gte':moment(_0xdb8a23[0x1])[_0xc71b('0x9e')](_0xc71b('0x9f'))};_0x528e0c[_0xc71b('0x52')]=_['merge'](_0x528e0c[_0xc71b('0x52')],_0x551e2b);}_0x528e0c=_['merge']({},_0x528e0c,_0xadc517[_0xc71b('0x60')]);return db[_0xc71b('0x9b')]['count']({'where':_0x528e0c[_0xc71b('0x52')]})[_0xc71b('0x11')](function(_0x1571b0){_0x134035['count']=_0x1571b0;if(_0xadc517['query'][_0xc71b('0x5f')]){_0x528e0c[_0xc71b('0x58')]=[{'all':!![]}];}return db[_0xc71b('0x9b')][_0xc71b('0x59')](_0x528e0c);})[_0xc71b('0x11')](function(_0x14b218){if(_0xadc517[_0xc71b('0x4a')][_0xc71b('0xa0')]===_0xc71b('0xa1')){for(var _0x347440=0x0;_0x347440<_0x14b218[_0xc71b('0x5e')];_0x347440++){_0x14b218[_0x347440][_0xc71b('0x62')]=juice(_0x14b218[_0x347440][_0xc71b('0x62')]);}}_0x134035[_0xc71b('0x5a')]=_0x14b218;return _0x134035;});}})[_0xc71b('0x11')](respondWithFilteredResult(_0x34c375,_0x528e0c))[_0xc71b('0x1b')](handleError(_0x34c375,null));};exports[_0xc71b('0x28')]=function(_0x2b26f1,_0x20ff0e){var _0x5863a8,_0x5514e4={},_0x5baeb1;if(_0x2b26f1[_0xc71b('0x62')]['to']){_0x5baeb1=_0x2b26f1[_0xc71b('0x62')]['to'][_0xc71b('0x9d')](',')[0x0];}return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x2b26f1[_0xc71b('0x5b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xc71b('0xa2')],'as':_0xc71b('0xa3'),'where':{'email':_0x5baeb1},'limit':0x1,'order':[[_0xc71b('0xa4'),_0xc71b('0xa5')]]}]},{'model':db[_0xc71b('0x5c')],'as':_0xc71b('0x40'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc71b('0xa6'),'raw':!![]}]}]})[_0xc71b('0x11')](handleEntityNotFound(_0x20ff0e,null))[_0xc71b('0x11')](function(_0x5c069f){if(!_0x5c069f)return;_0x5863a8=_0x5c069f;if(!_0x5c069f[_0xc71b('0x40')])throw new Error(_0xc71b('0xa7'));if(_[_0xc71b('0xa8')](_0x2b26f1[_0xc71b('0x62')][_0xc71b('0xa9')])){_0x2b26f1['body'][_0xc71b('0xa9')]=util[_0xc71b('0x9e')](_0xc71b('0xaa'),_0x5c069f[_0xc71b('0x27')],_0x5c069f[_0xc71b('0xab')]||_0x5c069f['Smtp'][_0xc71b('0x35')]);}if(_0x2b26f1[_0xc71b('0x62')]['attachments']&&_0x2b26f1[_0xc71b('0x62')]['attachments'][_0xc71b('0x5e')]){for(var _0x646fb8=0x0;_0x646fb8<_0x2b26f1[_0xc71b('0x62')][_0xc71b('0xac')]['length'];_0x646fb8+=0x1){_0x2b26f1[_0xc71b('0x62')][_0xc71b('0xac')][_0x646fb8]={'filename':_0x2b26f1[_0xc71b('0x62')][_0xc71b('0xac')][_0x646fb8][_0xc71b('0x27')],'path':path[_0xc71b('0xad')](config['root'],_0xc71b('0xae'),_0x2b26f1[_0xc71b('0x62')][_0xc71b('0xac')][_0x646fb8][_0xc71b('0xaf')])};}}var _0x35072b=_0x5c069f[_0xc71b('0xb0')]();return respondWithRpcPromise(_0xc71b('0xb1'),_0xc71b('0xb2'),{'account':_0x35072b,'message':_0x2b26f1['body']});})[_0xc71b('0x11')](function(_0x2d14fd){if(!_0x2d14fd)return;_0x5514e4=_0x2d14fd;if(!_0x5863a8[_0xc71b('0xb3')])throw new Error(_0xc71b('0xb4'));if(_0x5863a8[_0xc71b('0xb3')][_0xc71b('0xa3')][_0xc71b('0x5e')])return _0x5863a8[_0xc71b('0xb3')][_0xc71b('0xa3')][0x0];return db['CmContact'][_0xc71b('0x67')](_['defaults'](_0x2b26f1[_0xc71b('0x62')],{'firstName':_0x2b26f1[_0xc71b('0x62')]['to'],'email':_0x2b26f1['body']['to'],'phone':_0x2b26f1[_0xc71b('0x62')]['to'],'ListId':_0x5863a8['ListId']}));})[_0xc71b('0x11')](function(_0x3d42f3){if(!_0x3d42f3)return;var _0x3f2794={'UserId':_0x2b26f1[_0xc71b('0x35')]['id'],'ContactId':_0x3d42f3['id'],'MailAccountId':_0x5863a8['id'],'inReplyTo':_0x5514e4[_0xc71b('0xb5')],'to':_0x2b26f1[_0xc71b('0x62')]['from'],'cc':_0x2b26f1[_0xc71b('0x62')]['cc'],'subject':_0x2b26f1['body'][_0xc71b('0xb6')],'attach':_0x2b26f1[_0xc71b('0x62')]['attach'],'firstMsgDirection':_0xc71b('0xb7'),'lastMsgAt':moment()[_0xc71b('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xc71b('0xb7'),'Messages':[_[_0xc71b('0x55')](_0x2b26f1['body'],{'messageId':_0x5514e4['messageId'],'sentAt':moment()[_0xc71b('0x9e')](_0xc71b('0x9f')),'read':!![],'MailAccountId':_0x5863a8['id'],'UserId':_0x2b26f1['user']['id'],'ContactId':_0x3d42f3['id']})]};if(_0x2b26f1[_0xc71b('0x62')]['Interaction']){_0x3f2794=_[_0xc71b('0x55')](_0x3f2794,_0x2b26f1[_0xc71b('0x62')]['Interaction']);}return db[_0xc71b('0x84')][_0xc71b('0x67')](_0x3f2794,{'include':[{'model':db['MailMessage'],'as':_0xc71b('0xb8')}]});})['then'](respondWithResult(_0x20ff0e,null))[_0xc71b('0x1b')](handleError(_0x20ff0e,null));};exports['verifySmtp']=function(_0x4d44c2,_0x150cec){return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x4d44c2[_0xc71b('0x5b')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xc71b('0x40'),'raw':!![],'include':[{'model':db[_0xc71b('0xa6')],'as':'CloudProvider','raw':!![]}]}]})[_0xc71b('0x11')](handleEntityNotFound(_0x150cec,null))[_0xc71b('0x11')](function(_0x55b0cb){if(!_0x55b0cb[_0xc71b('0x40')])return;var _0x34e541=_0x55b0cb[_0xc71b('0xb0')]();return respondWithRpcPromise(_0xc71b('0xb9'),_0xc71b('0xba'),{'account':_0x34e541});})['then'](respondWithResult(_0x150cec,null))[_0xc71b('0x1b')](handleError(_0x150cec,null));};exports[_0xc71b('0x25')]=function(_0x226ca4,_0x483540){return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x226ca4[_0xc71b('0x5b')]['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x483540,null))['then'](function(_0x3a96ca){if(_0x3a96ca&&_0x3a96ca[_0xc71b('0x3d')]){throw new db[(_0xc71b('0xbb'))][(_0xc71b('0xbc'))](_0xc71b('0xbd'));}return _0x3a96ca;})['then'](removeEntity(_0x483540,null))[_0xc71b('0x1b')](handleError(_0x483540,null));};exports[_0xc71b('0xbe')]=function(_0x4ff771,_0x34f404){return db[_0xc71b('0x46')][_0xc71b('0x61')]({'where':{'id':_0x4ff771['params']['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x34f404,null))['then'](function(_0x2a15f9){if(_0x2a15f9){return _0x2a15f9[_0xc71b('0xbe')](_0x4ff771[_0xc71b('0x62')][_0xc71b('0x6c')],_[_0xc71b('0x85')](_0x4ff771['body'],['ids','id'])||{})[_0xc71b('0xbf')](function(_0x479237){for(var _0x5ede9d=0x0;_0x5ede9d<_0x4ff771[_0xc71b('0x62')][_0xc71b('0x6c')][_0xc71b('0x5e')];_0x5ede9d+=0x1){socket[_0xc71b('0xc0')]('userMailAccount:save',{'UserId':Number(_0x4ff771['body'][_0xc71b('0x6c')][_0x5ede9d]),'MailAccountId':Number(_0x4ff771[_0xc71b('0x5b')]['id'])});}return _0x479237;});}})[_0xc71b('0x11')](respondWithResult(_0x34f404,null))['catch'](handleError(_0x34f404,null));};exports['removeAgents']=function(_0x160cf6,_0x4e03a4){return db['MailAccount'][_0xc71b('0x61')]({'where':{'id':_0x160cf6['params']['id']}})[_0xc71b('0x11')](handleEntityNotFound(_0x4e03a4,null))[_0xc71b('0x11')](function(_0x774fe8){if(_0x774fe8){return _0x774fe8['removeAgents'](_0x160cf6[_0xc71b('0x4a')][_0xc71b('0x6c')])[_0xc71b('0x11')](function(){if(_[_0xc71b('0xc1')](_0x160cf6[_0xc71b('0x4a')][_0xc71b('0x6c')])){for(var _0x4e897c=0x0;_0x4e897c<_0x160cf6[_0xc71b('0x4a')][_0xc71b('0x6c')][_0xc71b('0x5e')];_0x4e897c+=0x1){socket[_0xc71b('0xc0')](_0xc71b('0xc2'),{'UserId':Number(_0x160cf6['query'][_0xc71b('0x6c')][_0x4e897c]),'MailAccountId':Number(_0x160cf6[_0xc71b('0x5b')]['id'])});}}else{socket[_0xc71b('0xc0')](_0xc71b('0xc2'),{'UserId':Number(_0x160cf6[_0xc71b('0x4a')]['ids']),'MailAccountId':Number(_0x160cf6[_0xc71b('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e03a4,null))[_0xc71b('0x1b')](handleError(_0x4e03a4,null));};exports[_0xc71b('0xc3')]=function(_0x36d0b8,_0x4679e6){var _0x534228={};var _0x22aadb={};var _0x255471;var _0x183ba7;return db['MailAccount'][_0xc71b('0x68')]({'where':{'id':_0x36d0b8[_0xc71b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4679e6,null))[_0xc71b('0x11')](function(_0x11e9e8){if(_0x11e9e8){_0x255471=_0x11e9e8;_0x22aadb[_0xc71b('0x4d')]=_[_0xc71b('0x4b')](db[_0xc71b('0x87')][_0xc71b('0x47')]);_0x22aadb[_0xc71b('0x4a')]=_[_0xc71b('0x4b')](_0x36d0b8['query']);_0x22aadb[_0xc71b('0x4c')]=_[_0xc71b('0x5d')](_0x22aadb[_0xc71b('0x4d')],_0x22aadb[_0xc71b('0x4a')]);_0x534228[_0xc71b('0x4e')]=_[_0xc71b('0x5d')](_0x22aadb[_0xc71b('0x4d')],qs[_0xc71b('0x4f')](_0x36d0b8['query'][_0xc71b('0x4f')]));_0x534228['attributes']=_0x534228['attributes'][_0xc71b('0x5e')]?_0x534228[_0xc71b('0x4e')]:_0x22aadb['model'];_0x534228['order']=qs['sort'](_0x36d0b8[_0xc71b('0x4a')][_0xc71b('0x51')]);_0x534228[_0xc71b('0x52')]=qs[_0xc71b('0x4c')](_[_0xc71b('0x53')](_0x36d0b8['query'],_0x22aadb['filters']));if(_0x36d0b8[_0xc71b('0x4a')][_0xc71b('0x54')]){_0x534228[_0xc71b('0x52')]=_[_0xc71b('0x55')](_0x534228['where'],{'$or':_[_0xc71b('0x45')](_0x534228[_0xc71b('0x4e')],function(_0x1b7e7e){var _0x2e34ec={};_0x2e34ec[_0x1b7e7e]={'$like':'%'+_0x36d0b8[_0xc71b('0x4a')][_0xc71b('0x54')]+'%'};return _0x2e34ec;})});}_0x534228=_[_0xc71b('0x55')]({},_0x534228,_0x36d0b8['options']);return _0x255471[_0xc71b('0xc3')](_0x534228);}})[_0xc71b('0x11')](function(_0x441c60){if(_0x441c60){_0x183ba7=_0x441c60[_0xc71b('0x5e')];if(!_0x36d0b8[_0xc71b('0x4a')][_0xc71b('0x69')](_0xc71b('0x50'))){_0x534228['limit']=qs[_0xc71b('0x20')](_0x36d0b8[_0xc71b('0x4a')][_0xc71b('0x20')]);_0x534228[_0xc71b('0x1e')]=qs[_0xc71b('0x1e')](_0x36d0b8[_0xc71b('0x4a')]['offset']);}return _0x255471['getAgents'](_0x534228);}})[_0xc71b('0x11')](function(_0xb0ba04){if(_0xb0ba04){return _0xb0ba04?{'count':_0x183ba7,'rows':_0xb0ba04}:null;}})[_0xc71b('0x11')](respondWithResult(_0x4679e6,null))[_0xc71b('0x1b')](handleError(_0x4679e6,null));}; \ No newline at end of file +var _0xe288=['CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','List','Contacts','DESC','CloudProvider','from','attachments','join','root','basename','getSmtpOptions','SendMail','List\x20not\x20found','attach','out','messageId','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove','User','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','UserProfileResource','then','end','sendStatus','name','send','gmail','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','include','find','body','provider','params','Mail\x20Account\x20not\x20found','describe','addDisposition','create','getDispositions','findOne','Disposition','hasOwnProperty','MailAccountId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction'];(function(_0x59f655,_0x1c12aa){var _0x1dbb6e=function(_0x3f048a){while(--_0x3f048a){_0x59f655['push'](_0x59f655['shift']());}};_0x1dbb6e(++_0x1c12aa);}(_0xe288,0x104));var _0x8e28=function(_0x137e81,_0x3541c4){_0x137e81=_0x137e81-0x0;var _0x5f14e1=_0xe288[_0x137e81];return _0x5f14e1;};'use strict';var moment=require(_0x8e28('0x0'));var BPromise=require(_0x8e28('0x1'));var util=require(_0x8e28('0x2'));var path=require(_0x8e28('0x3'));var _=require(_0x8e28('0x4'));var juice=require(_0x8e28('0x5'));var Redis=require(_0x8e28('0x6'));var qs=require(_0x8e28('0x7'));var logger=require(_0x8e28('0x8'))(_0x8e28('0x9'));var config=require('../../config/environment');var db=require(_0x8e28('0xa'))['db'];config[_0x8e28('0xb')]=_[_0x8e28('0xc')](config[_0x8e28('0xb')],{'host':_0x8e28('0xd'),'port':0x18eb});var socket=require(_0x8e28('0xe'))(new Redis(config['redis']));require(_0x8e28('0xf'))[_0x8e28('0x10')](socket);var jayson=require(_0x8e28('0x11'));var client=jayson[_0x8e28('0x12')][_0x8e28('0x13')]({'port':0x232b});function respondWithRpcPromise(_0x171a63,_0x28bf71,_0x30bd4b,_0x554cab){return new BPromise(function(_0x42cd6b,_0x328375){var _0x1a50d2=_0x554cab||client;return _0x1a50d2['request'](_0x171a63,_0x30bd4b)['then'](function(_0xf00f93){logger[_0x8e28('0x14')](_0x8e28('0x15'),_0x28bf71,_0x8e28('0x16'));logger['debug'](_0x8e28('0x17'),_0x28bf71,'request\x20sent',JSON[_0x8e28('0x18')](_0xf00f93));if(_0xf00f93['error']){if(_0xf00f93[_0x8e28('0x19')]['code']===0x1f4){logger[_0x8e28('0x19')]('MailAccount,\x20%s,\x20%s',_0x28bf71,_0xf00f93[_0x8e28('0x19')][_0x8e28('0x1a')]);return _0x328375(_0xf00f93[_0x8e28('0x19')][_0x8e28('0x1a')]);}logger[_0x8e28('0x19')]('MailAccount,\x20%s,\x20%s',_0x28bf71,_0xf00f93['error'][_0x8e28('0x1a')]);return _0x42cd6b(_0xf00f93[_0x8e28('0x19')]['message']);}else{logger[_0x8e28('0x14')](_0x8e28('0x15'),_0x28bf71,'request\x20sent');_0x42cd6b(_0xf00f93[_0x8e28('0x1b')][_0x8e28('0x1a')]);}})['catch'](function(_0x444dac){logger[_0x8e28('0x19')](_0x8e28('0x15'),_0x28bf71,_0x444dac);_0x328375(_0x444dac);});});}function respondWithStatusCode(_0x3c0faa,_0x2d5b2f){_0x2d5b2f=_0x2d5b2f||0xcc;return function(_0x4e8c7d){if(_0x4e8c7d){return _0x3c0faa['sendStatus'](_0x2d5b2f);}return _0x3c0faa[_0x8e28('0x1c')](_0x2d5b2f)['end']();};}function respondWithResult(_0x3306ab,_0x59aeed){_0x59aeed=_0x59aeed||0xc8;return function(_0x213cd2){if(_0x213cd2){return _0x3306ab[_0x8e28('0x1c')](_0x59aeed)[_0x8e28('0x1d')](_0x213cd2);}};}function respondWithFilteredResult(_0x5a25c8,_0x5eef11){return function(_0x55ac67){if(_0x55ac67){var _0x3b5f5f=typeof _0x5eef11[_0x8e28('0x1e')]==='undefined'&&typeof _0x5eef11[_0x8e28('0x1f')]===_0x8e28('0x20');var _0x59b8b9=_0x55ac67['count'];var _0x949d92=_0x3b5f5f?0x0:_0x5eef11['offset'];var _0x2c2a91=_0x3b5f5f?_0x55ac67[_0x8e28('0x21')]:_0x5eef11[_0x8e28('0x1e')]+_0x5eef11['limit'];var _0x4fa764;if(_0x2c2a91>=_0x59b8b9){_0x2c2a91=_0x59b8b9;_0x4fa764=0xc8;}else{_0x4fa764=0xce;}_0x5a25c8[_0x8e28('0x1c')](_0x4fa764);return _0x5a25c8[_0x8e28('0x22')](_0x8e28('0x23'),_0x949d92+'-'+_0x2c2a91+'/'+_0x59b8b9)[_0x8e28('0x1d')](_0x55ac67);}return null;};}function saveUpdates(_0x45c644){return function(_0x449197){if(_0x449197){return _0x449197[_0x8e28('0x24')](_0x45c644)['then'](function(_0x1eaae8){return _0x1eaae8;});}return null;};}function removeEntity(_0x32f93b){return function(_0x2f6c54){if(_0x2f6c54){return _0x2f6c54[_0x8e28('0x25')]()['then'](function(){var _0x5ebae6=_0x2f6c54[_0x8e28('0x26')]({'plain':!![]});var _0x22d336='MailAccounts';return db[_0x8e28('0x27')][_0x8e28('0x25')]({'where':{'type':_0x22d336,'resourceId':_0x5ebae6['id']}})[_0x8e28('0x28')](function(){return _0x2f6c54;});})[_0x8e28('0x28')](function(){_0x32f93b[_0x8e28('0x1c')](0xcc)[_0x8e28('0x29')]();});}};}function handleEntityNotFound(_0x252b6c){return function(_0xd600ee){if(!_0xd600ee){_0x252b6c[_0x8e28('0x2a')](0x194);}return _0xd600ee;};}function handleError(_0x2b9d35,_0x5c1357){_0x5c1357=_0x5c1357||0x1f4;return function(_0x243fed){logger[_0x8e28('0x19')](_0x243fed['stack']);if(_0x243fed[_0x8e28('0x2b')]){delete _0x243fed[_0x8e28('0x2b')];}_0x2b9d35[_0x8e28('0x1c')](_0x5c1357)[_0x8e28('0x2c')](_0x243fed);};}function getImapHost(_0x987336){switch(_0x987336){case _0x8e28('0x2d'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x8e28('0x2e'):return _0x8e28('0x2f');case _0x8e28('0x30'):return _0x8e28('0x31');}throw new Error(_0x8e28('0x32'),_0x987336);}function getSmtpHost(_0x33e4e7){switch(_0x33e4e7){case _0x8e28('0x2d'):return _0x8e28('0x33');case _0x8e28('0x34'):return _0x8e28('0x35');case'hotmail':return _0x8e28('0x36');case'outlook365':return _0x8e28('0x37');}throw new Error('Unknown\x20email\x20service\x20provider',_0x33e4e7);}function getAuthenticationOptions(_0x7e06a,_0x74d0f6){var _0x274781={};var _0x4d3f52={};if(_0x7e06a){_0x274781[_0x8e28('0x38')]=_0x4d3f52['user']=_0x74d0f6[_0x8e28('0x39')];_0x274781[_0x8e28('0x3a')]=_0x4d3f52['pass']=_0x74d0f6[_0x8e28('0x3a')];if(_0x74d0f6['modernAuthentication']){_0x274781[_0x8e28('0x3b')]=_0x4d3f52[_0x8e28('0x3b')]=!![];_0x274781[_0x8e28('0x3c')]=_0x4d3f52[_0x8e28('0x3c')]=_0x74d0f6['CloudProviderId'];_0x274781[_0x8e28('0x3a')]=_0x4d3f52[_0x8e28('0x3d')]=null;}else{_0x274781[_0x8e28('0x3c')]=_0x4d3f52[_0x8e28('0x3c')]=null;}_0x274781['host']=getImapHost(_0x7e06a);_0x274781[_0x8e28('0x3e')]=0x3e1;_0x4d3f52[_0x8e28('0x3f')]=getSmtpHost(_0x7e06a);_0x4d3f52[_0x8e28('0x3e')]=0x24b;_0x4d3f52[_0x8e28('0x40')]=![];_0x274781['service']=_0x4d3f52[_0x8e28('0x41')]=null;}else{if(_0x74d0f6[_0x8e28('0x42')]){_0x274781['user']=_0x4d3f52[_0x8e28('0x38')]=_0x74d0f6[_0x8e28('0x39')];_0x274781[_0x8e28('0x3a')]=_0x4d3f52[_0x8e28('0x3d')]=_0x74d0f6[_0x8e28('0x3a')];}else{_0x274781[_0x8e28('0x42')]=_0x4d3f52[_0x8e28('0x42')]=![];_0x274781['user']=_0x4d3f52[_0x8e28('0x38')]=null;_0x274781[_0x8e28('0x3a')]=_0x4d3f52[_0x8e28('0x3d')]=null;}_0x274781['host']=_0x74d0f6[_0x8e28('0x43')]['host'];_0x274781[_0x8e28('0x3e')]=_0x74d0f6[_0x8e28('0x43')][_0x8e28('0x3e')];_0x4d3f52[_0x8e28('0x3f')]=_0x74d0f6[_0x8e28('0x44')][_0x8e28('0x3f')];_0x4d3f52[_0x8e28('0x3e')]=_0x74d0f6[_0x8e28('0x44')][_0x8e28('0x3e')];}return{'Imap':_0x274781,'Smtp':_0x4d3f52};}exports[_0x8e28('0x45')]=function(_0x503fe8,_0xeb78f7){var _0x1a3cd6={'include':[{'model':db[_0x8e28('0x46')],'as':_0x8e28('0x43')},{'model':db[_0x8e28('0x47')],'as':_0x8e28('0x44')},{'model':db[_0x8e28('0x48')],'as':_0x8e28('0x49')}]},_0x533dae={},_0x333467={'count':0x0,'rows':[]};var _0x20521d=_['map'](db[_0x8e28('0x4a')][_0x8e28('0x4b')],function(_0x5b59df){return{'name':_0x5b59df[_0x8e28('0x4c')],'type':_0x5b59df[_0x8e28('0x4d')][_0x8e28('0x4e')]};});_0x533dae[_0x8e28('0x4f')]=_['map'](_0x20521d,'name');_0x533dae[_0x8e28('0x50')]=_[_0x8e28('0x51')](_0x503fe8[_0x8e28('0x50')]);_0x533dae['filters']=_[_0x8e28('0x52')](_0x533dae[_0x8e28('0x4f')],_0x533dae[_0x8e28('0x50')]);_0x1a3cd6[_0x8e28('0x53')]=_[_0x8e28('0x52')](_0x533dae[_0x8e28('0x4f')],qs[_0x8e28('0x54')](_0x503fe8[_0x8e28('0x50')]['fields']));_0x1a3cd6['attributes']=_0x1a3cd6[_0x8e28('0x53')][_0x8e28('0x55')]?_0x1a3cd6[_0x8e28('0x53')]:_0x533dae[_0x8e28('0x4f')];if(!_0x503fe8[_0x8e28('0x50')]['hasOwnProperty'](_0x8e28('0x56'))){_0x1a3cd6['limit']=qs[_0x8e28('0x1f')](_0x503fe8[_0x8e28('0x50')][_0x8e28('0x1f')]);_0x1a3cd6[_0x8e28('0x1e')]=qs[_0x8e28('0x1e')](_0x503fe8[_0x8e28('0x50')]['offset']);}_0x1a3cd6[_0x8e28('0x57')]=qs[_0x8e28('0x58')](_0x503fe8['query'][_0x8e28('0x58')]);_0x1a3cd6['where']=qs[_0x8e28('0x59')](_[_0x8e28('0x5a')](_0x503fe8['query'],_0x533dae[_0x8e28('0x59')]),_0x20521d);if(_0x503fe8[_0x8e28('0x50')]['filter']){_0x1a3cd6[_0x8e28('0x5b')]=_[_0x8e28('0x5c')](_0x1a3cd6[_0x8e28('0x5b')],{'$or':_[_0x8e28('0x5d')](_0x20521d,function(_0x55e7e4){if(_0x55e7e4[_0x8e28('0x4d')]!==_0x8e28('0x5e')){var _0x3afadd={};_0x3afadd[_0x55e7e4['name']]={'$like':'%'+_0x503fe8['query'][_0x8e28('0x5f')]+'%'};return _0x3afadd;}})});}_0x1a3cd6=_['merge']({},_0x1a3cd6,_0x503fe8[_0x8e28('0x60')]);var _0x411362={'where':_0x1a3cd6[_0x8e28('0x5b')]};return db[_0x8e28('0x4a')][_0x8e28('0x21')](_0x411362)[_0x8e28('0x28')](function(_0x50f5b4){_0x333467[_0x8e28('0x21')]=_0x50f5b4;if(_0x503fe8[_0x8e28('0x50')][_0x8e28('0x61')]){_0x1a3cd6['include']=[{'all':!![]}];}return db[_0x8e28('0x4a')][_0x8e28('0x62')](_0x1a3cd6);})['then'](function(_0xc5726d){_0x333467[_0x8e28('0x63')]=_0xc5726d;return _0x333467;})[_0x8e28('0x28')](respondWithFilteredResult(_0xeb78f7,_0x1a3cd6))[_0x8e28('0x64')](handleError(_0xeb78f7,null));};exports[_0x8e28('0x65')]=function(_0x26fd22,_0x38f69c){var _0x500625={'raw':![],'where':{'id':_0x26fd22['params']['id']},'include':[{'model':db[_0x8e28('0x46')],'as':_0x8e28('0x43')},{'model':db['MailServerOut'],'as':_0x8e28('0x44')},{'model':db['Pause'],'as':_0x8e28('0x49')}]},_0x36b8a3={};_0x36b8a3[_0x8e28('0x4f')]=_['keys'](db['MailAccount'][_0x8e28('0x4b')]);_0x36b8a3[_0x8e28('0x50')]=_[_0x8e28('0x51')](_0x26fd22['query']);_0x36b8a3[_0x8e28('0x59')]=_['intersection'](_0x36b8a3[_0x8e28('0x4f')],_0x36b8a3[_0x8e28('0x50')]);_0x500625['attributes']=_[_0x8e28('0x52')](_0x36b8a3[_0x8e28('0x4f')],qs[_0x8e28('0x54')](_0x26fd22['query'][_0x8e28('0x54')]));_0x500625[_0x8e28('0x53')]=_0x500625[_0x8e28('0x53')][_0x8e28('0x55')]?_0x500625[_0x8e28('0x53')]:_0x36b8a3[_0x8e28('0x4f')];if(_0x26fd22[_0x8e28('0x50')][_0x8e28('0x61')]){_0x500625[_0x8e28('0x66')]=[{'all':!![]}];}_0x500625=_[_0x8e28('0x5c')]({},_0x500625,_0x26fd22[_0x8e28('0x60')]);return db[_0x8e28('0x4a')][_0x8e28('0x67')](_0x500625)[_0x8e28('0x28')](handleEntityNotFound(_0x38f69c,null))[_0x8e28('0x28')](respondWithResult(_0x38f69c,null))[_0x8e28('0x64')](handleError(_0x38f69c,null));};exports['update']=function(_0x21a7f6,_0x490581){if(_0x21a7f6[_0x8e28('0x68')]['id']){delete _0x21a7f6[_0x8e28('0x68')]['id'];}var _0x273a65=_0x21a7f6[_0x8e28('0x68')][_0x8e28('0x69')]==='custom'?null:_0x21a7f6[_0x8e28('0x68')][_0x8e28('0x69')];var _0x4a8671=_0x21a7f6[_0x8e28('0x68')][_0x8e28('0x43')]||{};var _0xff0500=_0x21a7f6['body'][_0x8e28('0x44')]||{};if(_0x273a65){_0x4a8671[_0x8e28('0x3f')]=getImapHost(_0x273a65);_0x4a8671[_0x8e28('0x3e')]=0x3e1;_0xff0500[_0x8e28('0x3f')]=getSmtpHost(_0x273a65);_0xff0500['port']=0x24b;_0xff0500['secure']=![];}if(_0xff0500[_0x8e28('0x3b')]){_0xff0500[_0x8e28('0x40')]=![];}else{_0xff0500['CloudProviderId']=null;}if(!_0x4a8671[_0x8e28('0x3b')])_0x4a8671['CloudProviderId']=null;_0x21a7f6['body'][_0x8e28('0x43')]=_0x4a8671;_0x21a7f6[_0x8e28('0x68')][_0x8e28('0x44')]=_0xff0500;return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0x21a7f6[_0x8e28('0x6a')]['id']},'include':[{'model':db[_0x8e28('0x46')],'as':_0x8e28('0x43')},{'model':db['MailServerOut'],'as':_0x8e28('0x44')},{'model':db[_0x8e28('0x48')],'as':_0x8e28('0x49')}]})[_0x8e28('0x28')](handleEntityNotFound(_0x490581,null))[_0x8e28('0x28')](function(_0x3736ca){if(!_0x3736ca)throw new Error(_0x8e28('0x6b'));if(_0x3736ca['service'])delete _0x21a7f6[_0x8e28('0x68')][_0x8e28('0x43')];return _0x3736ca;})[_0x8e28('0x28')](saveUpdates(_0x21a7f6[_0x8e28('0x68')],null))['then'](function(_0x7dce1){if(!_0x21a7f6[_0x8e28('0x68')][_0x8e28('0x43')])return _0x7dce1;return db[_0x8e28('0x46')][_0x8e28('0x24')](_0x21a7f6['body'][_0x8e28('0x43')],{'where':{'MailAccountId':_0x7dce1['id']}})[_0x8e28('0x28')](function(){return _0x7dce1;});})[_0x8e28('0x28')](function(_0x46dee7){if(!_0x21a7f6[_0x8e28('0x68')]['Smtp'])return _0x46dee7;return db[_0x8e28('0x47')][_0x8e28('0x24')](_0x21a7f6[_0x8e28('0x68')][_0x8e28('0x44')],{'where':{'MailAccountId':_0x46dee7['id']}})[_0x8e28('0x28')](function(){return _0x46dee7;});})[_0x8e28('0x28')](respondWithResult(_0x490581,null))[_0x8e28('0x64')](handleError(_0x490581,null));};exports['describe']=function(_0x2383fa,_0x12ce68){return db[_0x8e28('0x4a')][_0x8e28('0x6c')]()[_0x8e28('0x28')](respondWithResult(_0x12ce68,null))[_0x8e28('0x64')](handleError(_0x12ce68,null));};exports[_0x8e28('0x6d')]=function(_0x46f9c7,_0x140a6a){if(_0x46f9c7['body']['id']){delete _0x46f9c7[_0x8e28('0x68')]['id'];}return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0x46f9c7[_0x8e28('0x6a')]['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x140a6a,null))['then'](function(_0x15ac93){if(_0x15ac93){_0x46f9c7[_0x8e28('0x68')]['MailAccountId']=_0x15ac93['id'];return db['Disposition'][_0x8e28('0x6e')](_0x46f9c7[_0x8e28('0x68')]);}})['then'](respondWithResult(_0x140a6a,null))['catch'](handleError(_0x140a6a,null));};exports[_0x8e28('0x6f')]=function(_0x32492f,_0x3d9907){var _0x59df3c={'raw':![],'where':{}};var _0x1e4ff0={};var _0x2b2fc7={'count':0x0,'rows':[]};return db[_0x8e28('0x4a')][_0x8e28('0x70')]({'where':{'id':_0x32492f['params']['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x3d9907,null))['then'](function(_0xa55e96){if(_0xa55e96){_0x1e4ff0[_0x8e28('0x4f')]=_[_0x8e28('0x51')](db[_0x8e28('0x71')][_0x8e28('0x4b')]);_0x1e4ff0[_0x8e28('0x50')]=_['keys'](_0x32492f['query']);_0x1e4ff0[_0x8e28('0x59')]=_[_0x8e28('0x52')](_0x1e4ff0[_0x8e28('0x4f')],_0x1e4ff0[_0x8e28('0x50')]);_0x59df3c[_0x8e28('0x53')]=_[_0x8e28('0x52')](_0x1e4ff0[_0x8e28('0x4f')],qs[_0x8e28('0x54')](_0x32492f[_0x8e28('0x50')]['fields']));_0x59df3c[_0x8e28('0x53')]=_0x59df3c[_0x8e28('0x53')]['length']?_0x59df3c['attributes']:_0x1e4ff0[_0x8e28('0x4f')];if(!_0x32492f['query'][_0x8e28('0x72')](_0x8e28('0x56'))){_0x59df3c[_0x8e28('0x1f')]=qs[_0x8e28('0x1f')](_0x32492f['query']['limit']);_0x59df3c['offset']=qs['offset'](_0x32492f['query']['offset']);}_0x59df3c[_0x8e28('0x57')]=qs['sort'](_0x32492f[_0x8e28('0x50')][_0x8e28('0x58')]);_0x59df3c['where']=qs['filters'](_['pick'](_0x32492f[_0x8e28('0x50')],_0x1e4ff0[_0x8e28('0x59')]));_0x59df3c[_0x8e28('0x5b')][_0x8e28('0x73')]=_0xa55e96['id'];if(_0x32492f['query']['filter']){_0x59df3c[_0x8e28('0x5b')]=_[_0x8e28('0x5c')](_0x59df3c[_0x8e28('0x5b')],{'$or':_[_0x8e28('0x5d')](_0x59df3c[_0x8e28('0x53')],function(_0x23f5d3){var _0x5a47f0={};_0x5a47f0[_0x23f5d3]={'$like':'%'+_0x32492f[_0x8e28('0x50')][_0x8e28('0x5f')]+'%'};return _0x5a47f0;})});}_0x59df3c=_[_0x8e28('0x5c')]({},_0x59df3c,_0x32492f['options']);return db[_0x8e28('0x71')][_0x8e28('0x21')]({'where':_0x59df3c[_0x8e28('0x5b')]})[_0x8e28('0x28')](function(_0x320607){_0x2b2fc7[_0x8e28('0x21')]=_0x320607;if(_0x32492f[_0x8e28('0x50')][_0x8e28('0x61')]){_0x59df3c[_0x8e28('0x66')]=[{'all':!![]}];}return db[_0x8e28('0x71')][_0x8e28('0x62')](_0x59df3c);})[_0x8e28('0x28')](function(_0x4ff94d){_0x2b2fc7[_0x8e28('0x63')]=_0x4ff94d;return _0x2b2fc7;});}})[_0x8e28('0x28')](respondWithFilteredResult(_0x3d9907,_0x59df3c))['catch'](handleError(_0x3d9907,null));};exports[_0x8e28('0x74')]=function(_0x10e067,_0x380d93){return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0x10e067[_0x8e28('0x6a')]['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x380d93,null))[_0x8e28('0x28')](function(_0xdfea2){if(_0xdfea2){return _0xdfea2[_0x8e28('0x74')](_0x10e067[_0x8e28('0x50')]['ids']);}})[_0x8e28('0x28')](respondWithStatusCode(_0x380d93,null))['catch'](handleError(_0x380d93,null));};exports[_0x8e28('0x75')]=function(_0x47855f,_0x5ea888){if(_0x47855f[_0x8e28('0x68')]['id']){delete _0x47855f[_0x8e28('0x68')]['id'];}return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0x47855f[_0x8e28('0x6a')]['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x5ea888,null))[_0x8e28('0x28')](function(_0x37a6ef){if(_0x37a6ef){_0x47855f[_0x8e28('0x68')][_0x8e28('0x73')]=_0x37a6ef['id'];return db[_0x8e28('0x76')][_0x8e28('0x6e')](_0x47855f[_0x8e28('0x68')]);}})['then'](respondWithResult(_0x5ea888,null))[_0x8e28('0x64')](handleError(_0x5ea888,null));};exports['getAnswers']=function(_0x5dc4d1,_0x3c3462){var _0xc9dcf7={'raw':![],'where':{}};var _0x4a842e={};var _0x11b714={'count':0x0,'rows':[]};return db[_0x8e28('0x4a')][_0x8e28('0x70')]({'where':{'id':_0x5dc4d1['params']['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x3c3462,null))[_0x8e28('0x28')](function(_0x5648fd){if(_0x5648fd){_0x4a842e[_0x8e28('0x4f')]=_[_0x8e28('0x51')](db[_0x8e28('0x76')][_0x8e28('0x4b')]);_0x4a842e['query']=_['keys'](_0x5dc4d1[_0x8e28('0x50')]);_0x4a842e[_0x8e28('0x59')]=_[_0x8e28('0x52')](_0x4a842e[_0x8e28('0x4f')],_0x4a842e[_0x8e28('0x50')]);_0xc9dcf7[_0x8e28('0x53')]=_[_0x8e28('0x52')](_0x4a842e[_0x8e28('0x4f')],qs[_0x8e28('0x54')](_0x5dc4d1[_0x8e28('0x50')][_0x8e28('0x54')]));_0xc9dcf7['attributes']=_0xc9dcf7[_0x8e28('0x53')][_0x8e28('0x55')]?_0xc9dcf7[_0x8e28('0x53')]:_0x4a842e[_0x8e28('0x4f')];if(!_0x5dc4d1['query']['hasOwnProperty']('nolimit')){_0xc9dcf7[_0x8e28('0x1f')]=qs['limit'](_0x5dc4d1[_0x8e28('0x50')][_0x8e28('0x1f')]);_0xc9dcf7[_0x8e28('0x1e')]=qs['offset'](_0x5dc4d1[_0x8e28('0x50')][_0x8e28('0x1e')]);}_0xc9dcf7['order']=qs[_0x8e28('0x58')](_0x5dc4d1[_0x8e28('0x50')][_0x8e28('0x58')]);_0xc9dcf7[_0x8e28('0x5b')]=qs[_0x8e28('0x59')](_[_0x8e28('0x5a')](_0x5dc4d1[_0x8e28('0x50')],_0x4a842e[_0x8e28('0x59')]));_0xc9dcf7[_0x8e28('0x5b')]['MailAccountId']=_0x5648fd['id'];if(_0x5dc4d1[_0x8e28('0x50')][_0x8e28('0x5f')]){_0xc9dcf7[_0x8e28('0x5b')]=_['merge'](_0xc9dcf7[_0x8e28('0x5b')],{'$or':_[_0x8e28('0x5d')](_0xc9dcf7[_0x8e28('0x53')],function(_0x8dadfe){var _0x5a9fcb={};_0x5a9fcb[_0x8dadfe]={'$like':'%'+_0x5dc4d1[_0x8e28('0x50')][_0x8e28('0x5f')]+'%'};return _0x5a9fcb;})});}_0xc9dcf7=_[_0x8e28('0x5c')]({},_0xc9dcf7,_0x5dc4d1[_0x8e28('0x60')]);return db['CannedAnswer']['count']({'where':_0xc9dcf7[_0x8e28('0x5b')]})[_0x8e28('0x28')](function(_0x54ef0f){_0x11b714['count']=_0x54ef0f;if(_0x5dc4d1[_0x8e28('0x50')][_0x8e28('0x61')]){_0xc9dcf7[_0x8e28('0x66')]=[{'all':!![]}];}return db[_0x8e28('0x76')][_0x8e28('0x62')](_0xc9dcf7);})[_0x8e28('0x28')](function(_0x4dc39a){_0x11b714[_0x8e28('0x63')]=_0x4dc39a;return _0x11b714;});}})[_0x8e28('0x28')](respondWithFilteredResult(_0x3c3462,_0xc9dcf7))[_0x8e28('0x64')](handleError(_0x3c3462,null));};exports[_0x8e28('0x77')]=function(_0x3af47b,_0x5b5c44){return db[_0x8e28('0x4a')]['find']({'where':{'id':_0x3af47b[_0x8e28('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5b5c44,null))['then'](function(_0x16f9b2){if(_0x16f9b2){return _0x16f9b2[_0x8e28('0x77')](_0x3af47b[_0x8e28('0x50')][_0x8e28('0x78')]);}})[_0x8e28('0x28')](respondWithStatusCode(_0x5b5c44,null))[_0x8e28('0x64')](handleError(_0x5b5c44,null));};exports['create']=function(_0x37c4c1,_0x21e36b){var _0x54a8a2={'name':_0x37c4c1['body'][_0x8e28('0x2b')],'key':_0x37c4c1[_0x8e28('0x68')]['key'],'provider':_0x37c4c1[_0x8e28('0x68')]['provider']==='custom'?null:_0x37c4c1[_0x8e28('0x68')][_0x8e28('0x69')],'email':_0x37c4c1[_0x8e28('0x68')][_0x8e28('0x79')],'ListId':_0x37c4c1[_0x8e28('0x68')][_0x8e28('0x7a')],'active':!_[_0x8e28('0x7b')](_0x37c4c1[_0x8e28('0x68')]['active'])?_0x37c4c1[_0x8e28('0x68')][_0x8e28('0x7c')]:!![],'description':_0x37c4c1[_0x8e28('0x68')][_0x8e28('0x7d')]||null};var _0x1239d9=getAuthenticationOptions(_0x54a8a2[_0x8e28('0x69')],_0x37c4c1[_0x8e28('0x68')]);_0x54a8a2['Imap']=_0x1239d9[_0x8e28('0x43')];_0x54a8a2[_0x8e28('0x44')]=_0x1239d9[_0x8e28('0x44')];return db[_0x8e28('0x4a')][_0x8e28('0x6e')](_0x54a8a2,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x8e28('0x46')],'as':_0x8e28('0x43')}]})[_0x8e28('0x28')](function(_0x52a2c8){var _0x22c977=_0x37c4c1['user'][_0x8e28('0x26')]({'plain':!![]});if(!_0x22c977)throw new Error(_0x8e28('0x7e'));if(_0x22c977[_0x8e28('0x7f')]===_0x8e28('0x38')){var _0x2ad586=_0x52a2c8[_0x8e28('0x26')]({'plain':!![]});return db[_0x8e28('0x80')][_0x8e28('0x67')]({'where':{'name':_0x8e28('0x81'),'userProfileId':_0x22c977[_0x8e28('0x82')]},'raw':!![]})[_0x8e28('0x28')](function(_0x486637){if(_0x486637&&_0x486637['autoAssociation']===0x0){return db[_0x8e28('0x27')][_0x8e28('0x6e')]({'name':_0x2ad586[_0x8e28('0x2b')],'resourceId':_0x2ad586['id'],'type':_0x486637[_0x8e28('0x2b')],'sectionId':_0x486637['id']},{})[_0x8e28('0x28')](function(){return _0x52a2c8;});}else{return _0x52a2c8;}})[_0x8e28('0x64')](function(_0x210941){logger['error'](_0x8e28('0x83'),_0x210941);throw _0x210941;});}return _0x52a2c8;})[_0x8e28('0x28')](respondWithResult(_0x21e36b,0xc9))[_0x8e28('0x64')](handleError(_0x21e36b,null));};exports['getImap']=function(_0xc0ae73,_0x54d50e){return db['MailAccount'][_0x8e28('0x70')]({'where':{'id':_0xc0ae73[_0x8e28('0x6a')]['id']}})['then'](handleEntityNotFound(_0x54d50e,null))[_0x8e28('0x28')](function(_0x2879e6){if(_0x2879e6){return _0x2879e6[_0x8e28('0x84')]();}return null;})[_0x8e28('0x28')](respondWithResult(_0x54d50e,null))['catch'](handleError(_0x54d50e,null));};exports[_0x8e28('0x85')]=function(_0x2acf9c,_0x3f9307){if(_0x2acf9c[_0x8e28('0x68')]['id']){delete _0x2acf9c[_0x8e28('0x68')]['id'];}return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0x2acf9c['params']['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x3f9307,null))[_0x8e28('0x28')](function(_0x2f143a){if(_0x2f143a){_0x2acf9c[_0x8e28('0x68')][_0x8e28('0x73')]=_0x2f143a['id'];return db['MailServerIn'][_0x8e28('0x6e')](_0x2acf9c[_0x8e28('0x68')]);}})[_0x8e28('0x28')](respondWithResult(_0x3f9307,null))['catch'](handleError(_0x3f9307,null));};exports['removeImap']=function(_0x3ed902,_0x633b12){return db[_0x8e28('0x4a')][_0x8e28('0x70')]({'where':{'id':_0x3ed902['params']['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x633b12,null))[_0x8e28('0x28')](function(_0x3cfb48){if(_0x3cfb48){return _0x3cfb48[_0x8e28('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x633b12,null))[_0x8e28('0x64')](handleError(_0x633b12,null));};exports['getSmtp']=function(_0x1e802a,_0x483df4){return db[_0x8e28('0x4a')][_0x8e28('0x70')]({'where':{'id':_0x1e802a['params']['id']}})['then'](handleEntityNotFound(_0x483df4,null))[_0x8e28('0x28')](function(_0x4e181f){if(_0x4e181f){return _0x4e181f[_0x8e28('0x87')]();}return null;})['then'](respondWithResult(_0x483df4,null))['catch'](handleError(_0x483df4,null));};exports[_0x8e28('0x88')]=function(_0x1eb3e4,_0x2f695a){if(_0x1eb3e4[_0x8e28('0x68')]['id']){delete _0x1eb3e4[_0x8e28('0x68')]['id'];}return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0x1eb3e4['params']['id']}})['then'](handleEntityNotFound(_0x2f695a,null))[_0x8e28('0x28')](function(_0x14bb65){if(_0x14bb65){_0x1eb3e4[_0x8e28('0x68')][_0x8e28('0x73')]=_0x14bb65['id'];return db[_0x8e28('0x47')][_0x8e28('0x6e')](_0x1eb3e4['body']);}})[_0x8e28('0x28')](respondWithResult(_0x2f695a,null))[_0x8e28('0x64')](handleError(_0x2f695a,null));};exports[_0x8e28('0x89')]=function(_0x3e2294,_0x48e795){return db[_0x8e28('0x4a')][_0x8e28('0x70')]({'where':{'id':_0x3e2294[_0x8e28('0x6a')]['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x48e795,null))['then'](function(_0xc01f8e){if(_0xc01f8e){return _0xc01f8e[_0x8e28('0x8a')](null);}return null;})[_0x8e28('0x28')](respondWithStatusCode(_0x48e795,null))[_0x8e28('0x64')](handleError(_0x48e795,null));};exports[_0x8e28('0x8b')]=function(_0x2abbdc,_0x2da065){return db['MailInteraction'][_0x8e28('0x67')]({'where':{'id':_0x2abbdc['params']['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x2da065,null))[_0x8e28('0x28')](function(_0x4575d9){if(_0x4575d9){return _0x4575d9['addInteraction'](_0x2abbdc[_0x8e28('0x68')]['ids'],_[_0x8e28('0x8c')](_0x2abbdc['body'],['ids','id'])||{});}})[_0x8e28('0x28')](respondWithResult(_0x2da065,null))[_0x8e28('0x64')](handleError(_0x2da065,null));};exports['getInteractions']=function(_0x4a2ad0,_0x2e69e3){var _0x474f5c={'raw':![],'where':{}};var _0x120836={};var _0x4f62d4={'count':0x0,'rows':[]};return db['MailAccount'][_0x8e28('0x70')]({'where':{'id':_0x4a2ad0['params']['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x2e69e3,null))[_0x8e28('0x28')](function(_0x83832){if(_0x83832){_0x120836[_0x8e28('0x4f')]=_[_0x8e28('0x51')](db[_0x8e28('0x8d')]['rawAttributes']);_0x120836[_0x8e28('0x50')]=_[_0x8e28('0x51')](_0x4a2ad0[_0x8e28('0x50')]);_0x120836[_0x8e28('0x59')]=_[_0x8e28('0x52')](_0x120836[_0x8e28('0x4f')],_0x120836['query']);_0x474f5c['attributes']=_[_0x8e28('0x52')](_0x120836[_0x8e28('0x4f')],qs['fields'](_0x4a2ad0['query'][_0x8e28('0x54')]));_0x474f5c[_0x8e28('0x53')]=_0x474f5c[_0x8e28('0x53')][_0x8e28('0x55')]?_0x474f5c['attributes']:_0x120836['model'];if(!_0x4a2ad0['query'][_0x8e28('0x72')](_0x8e28('0x56'))){_0x474f5c[_0x8e28('0x1f')]=qs[_0x8e28('0x1f')](_0x4a2ad0[_0x8e28('0x50')]['limit']);_0x474f5c['offset']=qs['offset'](_0x4a2ad0['query']['offset']);}_0x474f5c[_0x8e28('0x57')]=qs[_0x8e28('0x58')](_0x4a2ad0[_0x8e28('0x50')]['sort']);_0x474f5c[_0x8e28('0x5b')]=qs['filters'](_[_0x8e28('0x5a')](_0x4a2ad0['query'],_0x120836['filters']));_0x474f5c['where']['MailAccountId']=_0x83832['id'];if(_0x4a2ad0[_0x8e28('0x50')][_0x8e28('0x5f')]){_0x474f5c['where']=_[_0x8e28('0x5c')](_0x474f5c[_0x8e28('0x5b')],{'$or':_['map'](_0x474f5c['attributes'],function(_0x3c3acb){var _0xe90e37={};_0xe90e37[_0x3c3acb]={'$like':'%'+_0x4a2ad0[_0x8e28('0x50')][_0x8e28('0x5f')]+'%'};return _0xe90e37;})});}_0x474f5c=_[_0x8e28('0x5c')]({},_0x474f5c,_0x4a2ad0[_0x8e28('0x60')]);return db[_0x8e28('0x8d')]['count']({'where':_0x474f5c[_0x8e28('0x5b')]})[_0x8e28('0x28')](function(_0xcfcd6f){_0x4f62d4[_0x8e28('0x21')]=_0xcfcd6f;if(_0x4a2ad0[_0x8e28('0x50')][_0x8e28('0x61')]){_0x474f5c['include']=[{'model':db[_0x8e28('0x8e')],'as':_0x8e28('0x8f'),'required':![]},{'model':db['User'],'as':_0x8e28('0x90'),'attributes':[_0x8e28('0x2b'),_0x8e28('0x91'),_0x8e28('0x92')],'required':![]},{'model':db[_0x8e28('0x93')],'as':_0x8e28('0x94'),'attributes':['id','name',_0x8e28('0x95')],'where':_0x4a2ad0[_0x8e28('0x50')][_0x8e28('0x96')]?{'id':_0x4a2ad0[_0x8e28('0x50')]['tag']}:undefined,'required':_0x4a2ad0[_0x8e28('0x50')][_0x8e28('0x96')]?!![]:![]}];}return db['MailInteraction'][_0x8e28('0x62')](_0x474f5c);})[_0x8e28('0x28')](function(_0x3daf39){_0x4f62d4[_0x8e28('0x63')]=_0x3daf39;return _0x4f62d4;});}})[_0x8e28('0x28')](respondWithFilteredResult(_0x2e69e3,_0x474f5c))[_0x8e28('0x64')](handleError(_0x2e69e3,null));};exports[_0x8e28('0x97')]=function addApplications(_0x4017df,_0x1df5be){var _0x2d045e=_0x4017df[_0x8e28('0x6a')]['id'];var _0x3cf2d2=_0x4017df[_0x8e28('0x68')];var _0x7071b9=0xc8;var _0x30660e=null;return db[_0x8e28('0x98')][_0x8e28('0x99')]({'isolationLevel':db[_0x8e28('0x98')][_0x8e28('0x9a')][_0x8e28('0x9b')][_0x8e28('0x9c')]},function(_0x14e607){return db[_0x8e28('0x4a')][_0x8e28('0x70')]({'where':{'id':_0x2d045e},'transaction':_0x14e607})['then'](function(_0x39c4fa){if(_0x39c4fa){return db['MailApplication'][_0x8e28('0x25')]({'where':{'MailAccountId':_0x2d045e},'transaction':_0x14e607})[_0x8e28('0x28')](function(){var _0x1b495d=_[_0x8e28('0x5d')](_0x3cf2d2,function(_0x243726){_0x243726[_0x8e28('0x73')]=_0x2d045e;return _0x243726;});return db[_0x8e28('0x9d')][_0x8e28('0x9e')](_0x1b495d,{'transaction':_0x14e607});});}else{_0x7071b9=0x194;_0x30660e=[];}});})[_0x8e28('0x28')](function(){if(_0x7071b9!==0x194){return db[_0x8e28('0x9d')][_0x8e28('0x9f')]({'where':{'MailAccountId':_0x2d045e},'order':_0x8e28('0xa0')})['then'](function(_0x3ade85){_0x30660e=_0x3ade85;});}})['catch'](function(_0x5e2dfa){_0x7071b9=0x1f4;logger['error'](_0x5e2dfa[_0x8e28('0xa1')]);if(_0x5e2dfa[_0x8e28('0x2b')]){delete _0x5e2dfa[_0x8e28('0x2b')];}_0x30660e=_0x5e2dfa;})[_0x8e28('0xa2')](function(){if(_0x30660e===null){_0x1df5be[_0x8e28('0x2a')](_0x7071b9);}else{if(_0x7071b9===0x1f4){_0x1df5be[_0x8e28('0x1c')](_0x7071b9)[_0x8e28('0x2c')](_0x30660e);}else{_0x1df5be['status'](_0x7071b9)['json'](_0x30660e);}}});};exports['getApplications']=function(_0x349426,_0x2e2a13){var _0x4ace01={};var _0x34e23f={};var _0xf38088;var _0x3c096e;return db[_0x8e28('0x4a')]['findOne']({'where':{'id':_0x349426['params']['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x2e2a13,null))[_0x8e28('0x28')](function(_0x334f96){if(_0x334f96){_0xf38088=_0x334f96;_0x34e23f['model']=_[_0x8e28('0x51')](db[_0x8e28('0x9d')][_0x8e28('0x4b')]);_0x34e23f[_0x8e28('0x50')]=_[_0x8e28('0x51')](_0x349426['query']);_0x34e23f[_0x8e28('0x59')]=_[_0x8e28('0x52')](_0x34e23f[_0x8e28('0x4f')],_0x34e23f['query']);_0x4ace01[_0x8e28('0x53')]=_[_0x8e28('0x52')](_0x34e23f['model'],qs['fields'](_0x349426[_0x8e28('0x50')]['fields']));_0x4ace01[_0x8e28('0x53')]=_0x4ace01[_0x8e28('0x53')]['length']?_0x4ace01[_0x8e28('0x53')]:_0x34e23f[_0x8e28('0x4f')];_0x4ace01['order']=qs[_0x8e28('0x58')](_0x349426[_0x8e28('0x50')]['sort']);_0x4ace01[_0x8e28('0x5b')]=qs[_0x8e28('0x59')](_['pick'](_0x349426[_0x8e28('0x50')],_0x34e23f['filters']));if(_0x349426[_0x8e28('0x50')][_0x8e28('0x5f')]){_0x4ace01[_0x8e28('0x5b')]=_[_0x8e28('0x5c')](_0x4ace01['where'],{'$or':_['map'](_0x4ace01[_0x8e28('0x53')],function(_0x3a5576){var _0x5a1bc2={};_0x5a1bc2[_0x3a5576]={'$like':'%'+_0x349426[_0x8e28('0x50')]['filter']+'%'};return _0x5a1bc2;})});}_0x4ace01=_['merge']({},_0x4ace01,_0x349426['options']);return _0xf38088['getApplications'](_0x4ace01);}})[_0x8e28('0x28')](function(_0x2eafcc){if(_0x2eafcc){_0x3c096e=_0x2eafcc[_0x8e28('0x55')];if(!_0x349426['query'][_0x8e28('0x72')](_0x8e28('0x56'))){_0x4ace01['limit']=qs[_0x8e28('0x1f')](_0x349426[_0x8e28('0x50')]['limit']);_0x4ace01[_0x8e28('0x1e')]=qs[_0x8e28('0x1e')](_0x349426['query'][_0x8e28('0x1e')]);}return _0xf38088[_0x8e28('0xa3')](_0x4ace01);}})['then'](function(_0x4458cd){if(_0x4458cd){return _0x4458cd?{'count':_0x3c096e,'rows':_0x4458cd}:null;}})[_0x8e28('0x28')](respondWithResult(_0x2e2a13,null))[_0x8e28('0x64')](handleError(_0x2e2a13,null));};exports[_0x8e28('0xa4')]=function(_0x2e39b8,_0x4f22e5){var _0x203954={'raw':!![],'where':{}};var _0x189104={};var _0xf1454c={'count':0x0,'rows':[]};return db[_0x8e28('0x4a')]['findOne']({'where':{'id':_0x2e39b8[_0x8e28('0x6a')]['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x4f22e5,null))[_0x8e28('0x28')](function(_0x4f7d98){if(_0x4f7d98){_0x189104['model']=_[_0x8e28('0x51')](db['MailMessage'][_0x8e28('0x4b')]);_0x189104['query']=_[_0x8e28('0x51')](_0x2e39b8[_0x8e28('0x50')]);_0x189104['filters']=_[_0x8e28('0x52')](_0x189104['model'],_0x189104[_0x8e28('0x50')]);_0x203954['attributes']=_[_0x8e28('0x52')](_0x189104[_0x8e28('0x4f')],qs[_0x8e28('0x54')](_0x2e39b8['query'][_0x8e28('0x54')]));_0x203954[_0x8e28('0x53')]=_0x203954['attributes'][_0x8e28('0x55')]?_0x203954[_0x8e28('0x53')]:_0x189104[_0x8e28('0x4f')];if(!_0x2e39b8[_0x8e28('0x50')]['hasOwnProperty'](_0x8e28('0x56'))){_0x203954[_0x8e28('0x1f')]=qs[_0x8e28('0x1f')](_0x2e39b8[_0x8e28('0x50')]['limit']);_0x203954['offset']=qs[_0x8e28('0x1e')](_0x2e39b8['query']['offset']);}_0x203954[_0x8e28('0x57')]=qs['sort'](_0x2e39b8['query']['sort']);_0x203954[_0x8e28('0x5b')]=qs[_0x8e28('0x59')](_[_0x8e28('0x5a')](_0x2e39b8['query'],_0x189104[_0x8e28('0x59')]));_0x203954[_0x8e28('0x5b')]['MailAccountId']=_0x4f7d98['id'];if(_0x2e39b8[_0x8e28('0x50')][_0x8e28('0x5f')]){_0x203954[_0x8e28('0x5b')]=_['merge'](_0x203954[_0x8e28('0x5b')],{'$or':_[_0x8e28('0x5d')](_0x203954[_0x8e28('0x53')],function(_0x48881f){var _0x502f26={};_0x502f26[_0x48881f]={'$like':'%'+_0x2e39b8[_0x8e28('0x50')][_0x8e28('0x5f')]+'%'};return _0x502f26;})});}if(_0x2e39b8['query'][_0x8e28('0xa5')]){var _0x1a6d60=_0x2e39b8['query'][_0x8e28('0xa5')]['split'](',');var _0x341f69={};_0x341f69[_0x1a6d60[0x0]]={'$gte':moment(_0x1a6d60[0x1])[_0x8e28('0xa6')](_0x8e28('0xa7'))};_0x203954[_0x8e28('0x5b')]=_[_0x8e28('0x5c')](_0x203954[_0x8e28('0x5b')],_0x341f69);}_0x203954=_[_0x8e28('0x5c')]({},_0x203954,_0x2e39b8[_0x8e28('0x60')]);return db[_0x8e28('0xa8')][_0x8e28('0x21')]({'where':_0x203954[_0x8e28('0x5b')]})['then'](function(_0x15b39c){_0xf1454c[_0x8e28('0x21')]=_0x15b39c;if(_0x2e39b8[_0x8e28('0x50')]['includeAll']){_0x203954['include']=[{'all':!![]}];}return db[_0x8e28('0xa8')][_0x8e28('0x62')](_0x203954);})[_0x8e28('0x28')](function(_0x378d09){if(_0x2e39b8[_0x8e28('0x50')][_0x8e28('0xa9')]===_0x8e28('0xaa')){for(var _0xfcf647=0x0;_0xfcf647<_0x378d09['length'];_0xfcf647++){_0x378d09[_0xfcf647][_0x8e28('0x68')]=juice(_0x378d09[_0xfcf647][_0x8e28('0x68')]);}}_0xf1454c[_0x8e28('0x63')]=_0x378d09;return _0xf1454c;});}})['then'](respondWithFilteredResult(_0x4f22e5,_0x203954))['catch'](handleError(_0x4f22e5,null));};exports['send']=function(_0x25bbf1,_0x188e62){var _0x9687ea,_0x1c9a79={},_0x4c3d1e;if(_0x25bbf1[_0x8e28('0x68')]['to']){_0x4c3d1e=_0x25bbf1[_0x8e28('0x68')]['to'][_0x8e28('0xab')](',')[0x0];}return db['MailAccount'][_0x8e28('0x67')]({'where':{'id':_0x25bbf1[_0x8e28('0x6a')]['id']},'include':[{'model':db['CmList'],'as':_0x8e28('0xac'),'include':[{'model':db[_0x8e28('0x8e')],'as':_0x8e28('0xad'),'where':{'email':_0x4c3d1e},'limit':0x1,'order':[['updatedAt',_0x8e28('0xae')]]}]},{'model':db[_0x8e28('0x47')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8e28('0xaf')],'as':_0x8e28('0xaf'),'raw':!![]}]}]})[_0x8e28('0x28')](handleEntityNotFound(_0x188e62,null))[_0x8e28('0x28')](function(_0x3075ee){if(!_0x3075ee)return;_0x9687ea=_0x3075ee;if(!_0x3075ee['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x8e28('0x7b')](_0x25bbf1[_0x8e28('0x68')][_0x8e28('0xb0')])){_0x25bbf1[_0x8e28('0x68')][_0x8e28('0xb0')]=util[_0x8e28('0xa6')]('%s\x20<%s>',_0x3075ee[_0x8e28('0x2b')],_0x3075ee['email']||_0x3075ee[_0x8e28('0x44')][_0x8e28('0x38')]);}if(_0x25bbf1[_0x8e28('0x68')][_0x8e28('0xb1')]&&_0x25bbf1[_0x8e28('0x68')][_0x8e28('0xb1')][_0x8e28('0x55')]){for(var _0x110d2d=0x0;_0x110d2d<_0x25bbf1['body'][_0x8e28('0xb1')]['length'];_0x110d2d+=0x1){_0x25bbf1['body'][_0x8e28('0xb1')][_0x110d2d]={'filename':_0x25bbf1['body']['attachments'][_0x110d2d][_0x8e28('0x2b')],'path':path[_0x8e28('0xb2')](config[_0x8e28('0xb3')],'server/files/attachments',_0x25bbf1['body'][_0x8e28('0xb1')][_0x110d2d][_0x8e28('0xb4')])};}}var _0x4ac09a=_0x3075ee[_0x8e28('0xb5')]();return respondWithRpcPromise(_0x8e28('0xb6'),'sendMail',{'account':_0x4ac09a,'message':_0x25bbf1[_0x8e28('0x68')]});})[_0x8e28('0x28')](function(_0x1dbf99){if(!_0x1dbf99)return;_0x1c9a79=_0x1dbf99;if(!_0x9687ea[_0x8e28('0xac')])throw new Error(_0x8e28('0xb7'));if(_0x9687ea[_0x8e28('0xac')][_0x8e28('0xad')][_0x8e28('0x55')])return _0x9687ea[_0x8e28('0xac')][_0x8e28('0xad')][0x0];return db[_0x8e28('0x8e')][_0x8e28('0x6e')](_[_0x8e28('0xc')](_0x25bbf1[_0x8e28('0x68')],{'firstName':_0x25bbf1[_0x8e28('0x68')]['to'],'email':_0x25bbf1['body']['to'],'phone':_0x25bbf1['body']['to'],'ListId':_0x9687ea[_0x8e28('0x7a')]}));})[_0x8e28('0x28')](function(_0xaefea2){if(!_0xaefea2)return;var _0x3dceb7={'UserId':_0x25bbf1[_0x8e28('0x38')]['id'],'ContactId':_0xaefea2['id'],'MailAccountId':_0x9687ea['id'],'inReplyTo':_0x1c9a79['messageId'],'to':_0x25bbf1[_0x8e28('0x68')][_0x8e28('0xb0')],'cc':_0x25bbf1[_0x8e28('0x68')]['cc'],'subject':_0x25bbf1[_0x8e28('0x68')]['subject'],'attach':_0x25bbf1[_0x8e28('0x68')][_0x8e28('0xb8')],'firstMsgDirection':_0x8e28('0xb9'),'lastMsgAt':moment()[_0x8e28('0xa6')](_0x8e28('0xa7')),'lastMsgDirection':_0x8e28('0xb9'),'Messages':[_['merge'](_0x25bbf1[_0x8e28('0x68')],{'messageId':_0x1c9a79[_0x8e28('0xba')],'sentAt':moment()['format'](_0x8e28('0xa7')),'read':!![],'MailAccountId':_0x9687ea['id'],'UserId':_0x25bbf1[_0x8e28('0x38')]['id'],'ContactId':_0xaefea2['id']})]};if(_0x25bbf1[_0x8e28('0x68')][_0x8e28('0xbb')]){_0x3dceb7=_['merge'](_0x3dceb7,_0x25bbf1[_0x8e28('0x68')]['Interaction']);}return db[_0x8e28('0x8d')][_0x8e28('0x6e')](_0x3dceb7,{'include':[{'model':db[_0x8e28('0xa8')],'as':_0x8e28('0xbc')}]});})['then'](respondWithResult(_0x188e62,null))[_0x8e28('0x64')](handleError(_0x188e62,null));};exports[_0x8e28('0xbd')]=function(_0x52e0c2,_0x320bf6){return db['MailAccount'][_0x8e28('0x67')]({'where':{'id':_0x52e0c2[_0x8e28('0x6a')]['id']},'include':[{'model':db[_0x8e28('0x47')],'as':_0x8e28('0x44'),'raw':!![],'include':[{'model':db[_0x8e28('0xaf')],'as':_0x8e28('0xaf'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x320bf6,null))['then'](function(_0x5792fb){if(!_0x5792fb['Smtp'])return;var _0x2fb3e0=_0x5792fb['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x8e28('0xbd'),{'account':_0x2fb3e0});})[_0x8e28('0x28')](respondWithResult(_0x320bf6,null))[_0x8e28('0x64')](handleError(_0x320bf6,null));};exports[_0x8e28('0x25')]=function(_0x147b3e,_0x53c9bd){return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0x147b3e['params']['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x53c9bd,null))[_0x8e28('0x28')](function(_0x12b4f8){if(_0x12b4f8&&_0x12b4f8[_0x8e28('0x41')]){throw new db[(_0x8e28('0xbe'))][(_0x8e28('0xbf'))](_0x8e28('0xc0'));}return _0x12b4f8;})[_0x8e28('0x28')](removeEntity(_0x53c9bd,null))[_0x8e28('0x64')](handleError(_0x53c9bd,null));};exports[_0x8e28('0xc1')]=function(_0x308008,_0x1ed2c1){return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0x308008[_0x8e28('0x6a')]['id']}})['then'](handleEntityNotFound(_0x1ed2c1,null))[_0x8e28('0x28')](function(_0x72cf4b){if(_0x72cf4b){return _0x72cf4b[_0x8e28('0xc1')](_0x308008[_0x8e28('0x68')][_0x8e28('0x78')],_[_0x8e28('0x8c')](_0x308008[_0x8e28('0x68')],['ids','id'])||{})[_0x8e28('0xc2')](function(_0xa2a09c){for(var _0x57a34d=0x0;_0x57a34d<_0x308008[_0x8e28('0x68')][_0x8e28('0x78')][_0x8e28('0x55')];_0x57a34d+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x308008[_0x8e28('0x68')]['ids'][_0x57a34d]),'MailAccountId':Number(_0x308008[_0x8e28('0x6a')]['id'])});}return _0xa2a09c;});}})[_0x8e28('0x28')](respondWithResult(_0x1ed2c1,null))[_0x8e28('0x64')](handleError(_0x1ed2c1,null));};exports[_0x8e28('0xc3')]=function(_0xbc539b,_0x32eaf7){return db[_0x8e28('0x4a')][_0x8e28('0x67')]({'where':{'id':_0xbc539b[_0x8e28('0x6a')]['id']}})['then'](handleEntityNotFound(_0x32eaf7,null))[_0x8e28('0x28')](function(_0x1c8bb3){if(_0x1c8bb3){return _0x1c8bb3[_0x8e28('0xc3')](_0xbc539b['query'][_0x8e28('0x78')])[_0x8e28('0x28')](function(){if(_[_0x8e28('0xc4')](_0xbc539b[_0x8e28('0x50')][_0x8e28('0x78')])){for(var _0x3428c2=0x0;_0x3428c2<_0xbc539b[_0x8e28('0x50')]['ids'][_0x8e28('0x55')];_0x3428c2+=0x1){socket[_0x8e28('0xc5')](_0x8e28('0xc6'),{'UserId':Number(_0xbc539b[_0x8e28('0x50')][_0x8e28('0x78')][_0x3428c2]),'MailAccountId':Number(_0xbc539b[_0x8e28('0x6a')]['id'])});}}else{socket[_0x8e28('0xc5')](_0x8e28('0xc6'),{'UserId':Number(_0xbc539b[_0x8e28('0x50')]['ids']),'MailAccountId':Number(_0xbc539b[_0x8e28('0x6a')]['id'])});}});}})['then'](respondWithStatusCode(_0x32eaf7,null))[_0x8e28('0x64')](handleError(_0x32eaf7,null));};exports['getAgents']=function(_0x279ac9,_0x129078){var _0x1e3c40={};var _0x57f343={};var _0x5e0f9f;var _0x143d1f;return db['MailAccount'][_0x8e28('0x70')]({'where':{'id':_0x279ac9[_0x8e28('0x6a')]['id']}})[_0x8e28('0x28')](handleEntityNotFound(_0x129078,null))[_0x8e28('0x28')](function(_0x57a81b){if(_0x57a81b){_0x5e0f9f=_0x57a81b;_0x57f343[_0x8e28('0x4f')]=_['keys'](db[_0x8e28('0xc7')][_0x8e28('0x4b')]);_0x57f343[_0x8e28('0x50')]=_['keys'](_0x279ac9[_0x8e28('0x50')]);_0x57f343[_0x8e28('0x59')]=_[_0x8e28('0x52')](_0x57f343['model'],_0x57f343[_0x8e28('0x50')]);_0x1e3c40['attributes']=_[_0x8e28('0x52')](_0x57f343[_0x8e28('0x4f')],qs[_0x8e28('0x54')](_0x279ac9[_0x8e28('0x50')]['fields']));_0x1e3c40['attributes']=_0x1e3c40[_0x8e28('0x53')][_0x8e28('0x55')]?_0x1e3c40[_0x8e28('0x53')]:_0x57f343[_0x8e28('0x4f')];_0x1e3c40['order']=qs['sort'](_0x279ac9[_0x8e28('0x50')][_0x8e28('0x58')]);_0x1e3c40[_0x8e28('0x5b')]=qs['filters'](_[_0x8e28('0x5a')](_0x279ac9['query'],_0x57f343[_0x8e28('0x59')]));if(_0x279ac9[_0x8e28('0x50')]['filter']){_0x1e3c40[_0x8e28('0x5b')]=_[_0x8e28('0x5c')](_0x1e3c40[_0x8e28('0x5b')],{'$or':_['map'](_0x1e3c40[_0x8e28('0x53')],function(_0x597c89){var _0x15a769={};_0x15a769[_0x597c89]={'$like':'%'+_0x279ac9['query'][_0x8e28('0x5f')]+'%'};return _0x15a769;})});}_0x1e3c40=_['merge']({},_0x1e3c40,_0x279ac9[_0x8e28('0x60')]);return _0x5e0f9f[_0x8e28('0xc8')](_0x1e3c40);}})[_0x8e28('0x28')](function(_0x142a31){if(_0x142a31){_0x143d1f=_0x142a31[_0x8e28('0x55')];if(!_0x279ac9[_0x8e28('0x50')]['hasOwnProperty'](_0x8e28('0x56'))){_0x1e3c40['limit']=qs[_0x8e28('0x1f')](_0x279ac9[_0x8e28('0x50')][_0x8e28('0x1f')]);_0x1e3c40[_0x8e28('0x1e')]=qs[_0x8e28('0x1e')](_0x279ac9[_0x8e28('0x50')]['offset']);}return _0x5e0f9f['getAgents'](_0x1e3c40);}})[_0x8e28('0x28')](function(_0x1b5233){if(_0x1b5233){return _0x1b5233?{'count':_0x143d1f,'rows':_0x1b5233}:null;}})[_0x8e28('0x28')](respondWithResult(_0x129078,null))['catch'](handleError(_0x129078,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index f109397..12ad668 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 _0x8af6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8af6,0x76));var _0x68af=function(_0x3199a6,_0x11f74d){_0x3199a6=_0x3199a6-0x0;var _0x4ed8cf=_0x8af6[_0x3199a6];return _0x4ed8cf;};'use strict';var EventEmitter=require(_0x68af('0x0'));var MailAccount=require(_0x68af('0x1'))['db'][_0x68af('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x68af('0x3')](0x0);var events={'afterCreate':_0x68af('0x4'),'afterUpdate':_0x68af('0x5'),'afterDestroy':_0x68af('0x6')};function emitEvent(_0xe2ba54){return function(_0x1f8b3a,_0x3d1c16,_0x52bd87){MailAccountEvents[_0x68af('0x7')](_0xe2ba54+':'+_0x1f8b3a['id'],_0x1f8b3a);MailAccountEvents['emit'](_0xe2ba54,_0x1f8b3a);_0x52bd87(null);};}for(var e in events){if(events[_0x68af('0x8')](e)){var event=events[e];MailAccount[_0x68af('0x9')](e,emitEvent(event));}}module[_0x68af('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x8325=['exports','events','MailAccount','save','remove','emit','hasOwnProperty','hook'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x8325,0x1f1));var _0x5832=function(_0x3d8d9e,_0xc398ec){_0x3d8d9e=_0x3d8d9e-0x0;var _0x37a5ff=_0x8325[_0x3d8d9e];return _0x37a5ff;};'use strict';var EventEmitter=require(_0x5832('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x5832('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5832('0x2'),'afterUpdate':'update','afterDestroy':_0x5832('0x3')};function emitEvent(_0x39ae55){return function(_0x17bd8b,_0x24e83e,_0x5bfa64){MailAccountEvents['emit'](_0x39ae55+':'+_0x17bd8b['id'],_0x17bd8b);MailAccountEvents[_0x5832('0x4')](_0x39ae55,_0x17bd8b);_0x5bfa64(null);};}for(var e in events){if(events[_0x5832('0x5')](e)){var event=events[e];MailAccount[_0x5832('0x6')](e,emitEvent(event));}}module[_0x5832('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 80b316f..7ef3197 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 _0xad96=['authentication','modernAuthentication','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','define','mail_accounts','custom','service','host','Smtp','port','secure'];(function(_0xaf19eb,_0x2239f2){var _0xb92519=function(_0x53f467){while(--_0x53f467){_0xaf19eb['push'](_0xaf19eb['shift']());}};_0xb92519(++_0x2239f2);}(_0xad96,0x1b0));var _0x6ad9=function(_0xdf0c09,_0x8fbdd5){_0xdf0c09=_0xdf0c09-0x0;var _0x48f3c6=_0xad96[_0xdf0c09];return _0x48f3c6;};'use strict';var attributes=require(_0x6ad9('0x0'));module[_0x6ad9('0x1')]=function(_0x326a97){return _0x326a97[_0x6ad9('0x2')]('MailAccount',attributes,{'tableName':_0x6ad9('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x30d258=this;var _0x135e5c={'id':_0x30d258['id'],'tls':{'rejectUnauthorized':![]}};if(_0x30d258['provider']!==_0x6ad9('0x4')){_0x135e5c[_0x6ad9('0x5')]=_0x30d258['provider'];}else{_0x135e5c[_0x6ad9('0x6')]=_0x30d258[_0x6ad9('0x7')][_0x6ad9('0x6')];_0x135e5c['port']=_0x30d258[_0x6ad9('0x7')][_0x6ad9('0x8')];_0x135e5c['secure']=_0x30d258[_0x6ad9('0x7')][_0x6ad9('0x9')];}if(_0x30d258[_0x6ad9('0x7')][_0x6ad9('0xa')]){if(_0x30d258[_0x6ad9('0x7')][_0x6ad9('0xb')]){if(!_0x30d258['Smtp']['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x135e5c['auth']={'type':_0x6ad9('0xc'),'user':_0x30d258[_0x6ad9('0x7')][_0x6ad9('0xd')],'accessToken':_0x30d258[_0x6ad9('0x7')][_0x6ad9('0xe')][_0x6ad9('0xf')]};}else{_0x135e5c['auth']={'user':_0x30d258['Smtp']['user'],'pass':_0x30d258['Smtp'][_0x6ad9('0x10')]};}}return _0x135e5c;}}});}; \ No newline at end of file +var _0xa28f=['./mailAccount.attributes','exports','MailAccount','provider','service','host','port','Smtp','secure','authentication','auth','user','CloudProvider','data5','pass'];(function(_0x11cadb,_0x110faa){var _0x2fb14b=function(_0x3f2015){while(--_0x3f2015){_0x11cadb['push'](_0x11cadb['shift']());}};_0x2fb14b(++_0x110faa);}(_0xa28f,0x1d1));var _0xfa28=function(_0x3cd005,_0x4c995a){_0x3cd005=_0x3cd005-0x0;var _0x3e7d8b=_0xa28f[_0x3cd005];return _0x3e7d8b;};'use strict';var attributes=require(_0xfa28('0x0'));module[_0xfa28('0x1')]=function(_0xb7a56f){return _0xb7a56f['define'](_0xfa28('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x34e97d=this;var _0x3fad6b={'id':_0x34e97d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x34e97d[_0xfa28('0x3')]!=='custom'){_0x3fad6b[_0xfa28('0x4')]=_0x34e97d[_0xfa28('0x3')];}else{_0x3fad6b[_0xfa28('0x5')]=_0x34e97d['Smtp']['host'];_0x3fad6b[_0xfa28('0x6')]=_0x34e97d[_0xfa28('0x7')][_0xfa28('0x6')];_0x3fad6b['secure']=_0x34e97d['Smtp'][_0xfa28('0x8')];}if(_0x34e97d[_0xfa28('0x7')][_0xfa28('0x9')]){if(_0x34e97d[_0xfa28('0x7')]['modernAuthentication']){if(!_0x34e97d[_0xfa28('0x7')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x3fad6b[_0xfa28('0xa')]={'type':'OAuth2','user':_0x34e97d[_0xfa28('0x7')][_0xfa28('0xb')],'accessToken':_0x34e97d[_0xfa28('0x7')][_0xfa28('0xc')][_0xfa28('0xd')]};}else{_0x3fad6b[_0xfa28('0xa')]={'user':_0x34e97d[_0xfa28('0x7')]['user'],'pass':_0x34e97d[_0xfa28('0x7')][_0xfa28('0xe')]};}}return _0x3fad6b;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f56ad11..19f41dd 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 _0xa751=['from','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','applications','list','orderBy','priority','autoclose','push','*,*,*,*','create','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','update','subject','interaction','created','attachments','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','include','map','model','GetMailAccount','MailAccount','find','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','body','isNil'];(function(_0x47a4c3,_0x507001){var _0x5206a8=function(_0x28c0d6){while(--_0x28c0d6){_0x47a4c3['push'](_0x47a4c3['shift']());}};_0x5206a8(++_0x507001);}(_0xa751,0x175));var _0x1a75=function(_0x552ec1,_0x3347e4){_0x552ec1=_0x552ec1-0x0;var _0x28d3ea=_0xa751[_0x552ec1];return _0x28d3ea;};'use strict';var _=require(_0x1a75('0x0'));var moment=require(_0x1a75('0x1'));var BPromise=require(_0x1a75('0x2'));var rs=require(_0x1a75('0x3'));var Redis=require('ioredis');var db=require(_0x1a75('0x4'))['db'];var logger=require('../../config/logger')(_0x1a75('0x5'));var config=require(_0x1a75('0x6'));var jayson=require(_0x1a75('0x7'));var client=jayson['client'][_0x1a75('0x8')]({'port':0x232c});config[_0x1a75('0x9')]=_[_0x1a75('0xa')](config[_0x1a75('0x9')],{'host':_0x1a75('0xb'),'port':0x18eb});var socket=require(_0x1a75('0xc'))(new Redis(config[_0x1a75('0x9')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4f77c2,_0x41aa8f,_0x377b3b){return new BPromise(function(_0x1d7819,_0x271286){return client[_0x1a75('0xd')](_0x4f77c2,_0x377b3b)[_0x1a75('0xe')](function(_0x2d61d2){logger[_0x1a75('0xf')]('MailAccount,\x20%s,\x20%s',_0x41aa8f,'request\x20sent');logger['debug'](_0x1a75('0x10'),_0x41aa8f,_0x1a75('0x11'),JSON[_0x1a75('0x12')](_0x2d61d2));if(_0x2d61d2[_0x1a75('0x13')]){if(_0x2d61d2['error']['code']===0x1f4){logger[_0x1a75('0x13')](_0x1a75('0x14'),_0x41aa8f,_0x2d61d2['error'][_0x1a75('0x15')]);return _0x271286(_0x2d61d2[_0x1a75('0x13')]['message']);}logger[_0x1a75('0x13')](_0x1a75('0x14'),_0x41aa8f,_0x2d61d2[_0x1a75('0x13')]['message']);return _0x1d7819(_0x2d61d2['error']['message']);}else{logger[_0x1a75('0xf')](_0x1a75('0x14'),_0x41aa8f,_0x1a75('0x11'));_0x1d7819(_0x2d61d2[_0x1a75('0x16')][_0x1a75('0x15')]);}})[_0x1a75('0x17')](function(_0x47f384){logger[_0x1a75('0x13')]('MailAccount,\x20%s,\x20%s',_0x41aa8f,_0x47f384);_0x271286(_0x47f384);});});}exports['GetMailAccount']=function(_0x42df2c){var _0x3928b7=this;return new Promise(function(_0x5ae0f4,_0x42d283){return db['MailAccount'][_0x1a75('0x18')]({'raw':_0x42df2c[_0x1a75('0x19')]?_0x42df2c[_0x1a75('0x19')][_0x1a75('0x1a')]===undefined?!![]:![]:!![],'where':_0x42df2c[_0x1a75('0x19')]?_0x42df2c[_0x1a75('0x19')]['where']||null:null,'attributes':_0x42df2c[_0x1a75('0x19')]?_0x42df2c['options'][_0x1a75('0x1b')]||null:null,'limit':_0x42df2c[_0x1a75('0x19')]?_0x42df2c[_0x1a75('0x19')]['limit']||null:null,'include':_0x42df2c[_0x1a75('0x19')]?_0x42df2c['options'][_0x1a75('0x1c')]?_[_0x1a75('0x1d')](_0x42df2c[_0x1a75('0x19')]['include'],function(_0x9fe9fe){return{'model':db[_0x9fe9fe[_0x1a75('0x1e')]],'as':_0x9fe9fe['as'],'attributes':_0x9fe9fe['attributes'],'include':_0x9fe9fe[_0x1a75('0x1c')]?_[_0x1a75('0x1d')](_0x9fe9fe['include'],function(_0x168e06){return{'model':db[_0x168e06[_0x1a75('0x1e')]],'as':_0x168e06['as'],'attributes':_0x168e06[_0x1a75('0x1b')],'include':_0x168e06[_0x1a75('0x1c')]?_['map'](_0x168e06[_0x1a75('0x1c')],function(_0x2744ab){return{'model':db[_0x2744ab[_0x1a75('0x1e')]],'as':_0x2744ab['as'],'attributes':_0x2744ab[_0x1a75('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1a75('0xe')](function(_0x9e66b9){logger[_0x1a75('0xf')](_0x1a75('0x1f'),_0x42df2c);logger['debug']('GetMailAccount',_0x42df2c,JSON[_0x1a75('0x12')](_0x9e66b9));_0x5ae0f4(_0x9e66b9);})[_0x1a75('0x17')](function(_0x1a0359){logger[_0x1a75('0x13')](_0x1a75('0x1f'),_0x1a0359[_0x1a75('0x15')],_0x42df2c);_0x42d283(_0x3928b7[_0x1a75('0x13')](0x1f4,_0x1a0359[_0x1a75('0x15')]));});});};exports['ShowMailAccount']=function(_0x4d6f8d){var _0x4c30d5=this;return new Promise(function(_0xdef8cb,_0x291789){return db[_0x1a75('0x20')][_0x1a75('0x21')]({'raw':_0x4d6f8d['options']?_0x4d6f8d['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d6f8d[_0x1a75('0x19')]?_0x4d6f8d[_0x1a75('0x19')]['where']||null:null,'attributes':_0x4d6f8d['options']?_0x4d6f8d[_0x1a75('0x19')]['attributes']||null:null,'include':_0x4d6f8d[_0x1a75('0x19')]?_0x4d6f8d[_0x1a75('0x19')][_0x1a75('0x1c')]?_['map'](_0x4d6f8d['options'][_0x1a75('0x1c')],function(_0x2a2a44){return{'model':db[_0x2a2a44[_0x1a75('0x1e')]],'as':_0x2a2a44['as'],'attributes':_0x2a2a44[_0x1a75('0x1b')],'include':_0x2a2a44[_0x1a75('0x1c')]?_[_0x1a75('0x1d')](_0x2a2a44[_0x1a75('0x1c')],function(_0x3231bb){return{'model':db[_0x3231bb[_0x1a75('0x1e')]],'as':_0x3231bb['as'],'attributes':_0x3231bb[_0x1a75('0x1b')],'include':_0x3231bb[_0x1a75('0x1c')]?_[_0x1a75('0x1d')](_0x3231bb[_0x1a75('0x1c')],function(_0x37ce1f){return{'model':db[_0x37ce1f[_0x1a75('0x1e')]],'as':_0x37ce1f['as'],'attributes':_0x37ce1f[_0x1a75('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc203ad){if(_0x4d6f8d['options']['smtp']===!![])_0xc203ad[_0x1a75('0x22')](_0x1a75('0x23'),_0xc203ad[_0x1a75('0x24')]());logger[_0x1a75('0xf')](_0x1a75('0x25'),_0x4d6f8d);logger['debug'](_0x1a75('0x25'),_0x4d6f8d,JSON[_0x1a75('0x12')](_0xc203ad));_0xdef8cb(_0xc203ad);})[_0x1a75('0x17')](function(_0x32c064){logger[_0x1a75('0x13')]('ShowMailAccount',_0x32c064[_0x1a75('0x15')],_0x4d6f8d);_0x291789(_0x4c30d5['error'](0x1f4,_0x32c064[_0x1a75('0x15')]));});});};exports[_0x1a75('0x26')]=function(_0x2c6a9c){var _0x41c983=this;return new Promise(function(_0x269ed6,_0x26f836){var _0xa5002c={'body':_0x2c6a9c['body'],'channel':'mail'};var _0x25e2e5=_['difference'](_[_0x1a75('0x27')](db[_0x1a75('0x28')][_0x1a75('0x29')]),['createdAt',_0x1a75('0x2a'),_0x1a75('0x2b'),_0x1a75('0x2c')]);var _0x5a2c51=![];if(_0x2c6a9c[_0x1a75('0x2d')]['id']){delete _0x2c6a9c[_0x1a75('0x2d')]['id'];}if(_[_0x1a75('0x2e')](_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x2f')])){return _0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,_0x1a75('0x30')));}if(_['isNil'](_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x2d')])||_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x2d')]===''){return _0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1a75('0x2e')](_0x2c6a9c[_0x1a75('0x2d')]['mapKey'])){return _0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25e2e5));}if(!_[_0x1a75('0x31')](_0x25e2e5,_0x2c6a9c['body'][_0x1a75('0x32')])){return _0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,_0x1a75('0x33')+_0x25e2e5));}var _0x14d113={};_0x14d113[_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x32')]]=_0x2c6a9c[_0x1a75('0x2d')]['from'];return db[_0x1a75('0x20')]['find']({'where':{'id':_0x2c6a9c[_0x1a75('0x34')]['id']},'include':[{'model':db[_0x1a75('0x35')],'as':_0x1a75('0x36'),'include':[{'model':db[_0x1a75('0x28')],'as':_0x1a75('0x37'),'where':_0x14d113,'limit':0x1,'order':[[_0x1a75('0x2a'),_0x1a75('0x38')]]}]},{'model':db[_0x1a75('0x39')],'as':'Applications'},{'model':db[_0x1a75('0x3a')],'as':_0x1a75('0x3b'),'include':[{'model':db[_0x1a75('0x3c')],'as':_0x1a75('0x3c')}]}]})[_0x1a75('0xe')](function(_0x1b76d){if(_0x1b76d&&_0x1b76d[_0x1a75('0x36')]){var _0x12b298=_0x1b76d[_0x1a75('0x3d')]({'plain':!![]});_0xa5002c[_0x1a75('0x34')]=_[_0x1a75('0x3e')](_0x12b298,[_0x1a75('0x3f'),_0x1a75('0x36')]);_0xa5002c[_0x1a75('0x34')][_0x1a75('0x23')]=_0x1b76d['getSmtpOptions']();_0xa5002c[_0x1a75('0x40')]=_0x12b298[_0x1a75('0x3f')];_0xa5002c[_0x1a75('0x41')]=_0x12b298[_0x1a75('0x36')];_0xa5002c[_0x1a75('0x40')]=_[_0x1a75('0x42')](_0xa5002c[_0x1a75('0x40')],[_0x1a75('0x43')],['asc']);if(_0xa5002c[_0x1a75('0x34')]&&_0xa5002c['account'][_0x1a75('0x44')]){_0xa5002c[_0x1a75('0x40')][_0x1a75('0x45')]({'id':0x0,'priority':_0xa5002c['applications']['length']+0x1,'app':'close','appdata':_0x1a75('0x44'),'interval':_0x1a75('0x46')});}if(_0xa5002c[_0x1a75('0x34')][_0x1a75('0x3f')]){delete _0xa5002c[_0x1a75('0x34')]['Applications'];}if(_0xa5002c[_0x1a75('0x34')][_0x1a75('0x36')]){delete _0xa5002c[_0x1a75('0x34')][_0x1a75('0x36')];}if(_0x12b298[_0x1a75('0x36')][_0x1a75('0x37')]['length']){return _0x12b298['List']['Contacts'][0x0];}var _0xba704c=_[_0x1a75('0xa')](_0x2c6a9c[_0x1a75('0x2d')],{'firstName':_0x2c6a9c['body']['from'],'ListId':_0x12b298[_0x1a75('0x2c')]});_0xba704c[_0x2c6a9c[_0x1a75('0x2d')]['mapKey']]=_0x2c6a9c[_0x1a75('0x2d')]['from'];return db['CmContact'][_0x1a75('0x47')](_0xba704c);}else{throw new Error(_0x1a75('0x48'));}})['then'](function(_0x11a069){_0xa5002c[_0x1a75('0x49')]=_0x11a069;if(_0x11a069){if(!_0x2c6a9c['body'][_0x1a75('0x15')][_0x1a75('0x4a')]){_0x2c6a9c[_0x1a75('0x2d')]['message'][_0x1a75('0x4a')]=rs['generate']()+'\x20'+_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['from'];}var _0xd5f80b={'ContactId':_0x11a069['id'],'MailAccountId':_0x2c6a9c[_0x1a75('0x34')]['id'],'inReplyTo':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['messageId'],'to':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['from'],'cc':_0x2c6a9c[_0x1a75('0x2d')]['message']['cc'],'subject':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['subject'],'attach':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x4b')],'lastMsgAt':moment()[_0x1a75('0x4c')](_0x1a75('0x4d')),'lastMsgDirection':'in'};return db[_0x1a75('0x4e')]['find']({'where':{'closed':![],'MailAccountId':_0x2c6a9c[_0x1a75('0x34')]['id']},'include':[{'model':db[_0x1a75('0x4f')],'as':_0x1a75('0x50'),'attributes':[_0x1a75('0x4a')],'where':{'messageId':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x51')]}}]})['then'](function(_0x3b4da2){if(_0x3b4da2){return[_0x3b4da2,![]];}return db['MailInteraction'][_0x1a75('0x47')](_0xd5f80b)[_0x1a75('0xe')](function(_0x4fa838){return[_0x4fa838,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x315bcb,_0x2b7a3f){if(_0x315bcb){_0x5a2c51=_0x2b7a3f;if(!_0x2b7a3f){return _0x315bcb[_0x1a75('0x52')]({'inReplyTo':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x4a')],'to':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x2f')],'cc':_0x2c6a9c[_0x1a75('0x2d')]['message']['cc'],'subject':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x53')],'attach':_0x315bcb[_0x1a75('0x4b')]?_0x315bcb[_0x1a75('0x4b')]:_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x4b')],'substatus':null,'substatusAt':moment()[_0x1a75('0x4c')](_0x1a75('0x4d')),'lastMsgAt':moment()[_0x1a75('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x315bcb;}}})['then'](function(_0x58ea57){_0xa5002c['interaction']=_0x58ea57[_0x1a75('0x3d')]({'plain':!![]});_0xa5002c[_0x1a75('0x54')][_0x1a75('0x55')]=_0x5a2c51;return db[_0x1a75('0x4f')][_0x1a75('0x47')]({'body':_0x2c6a9c[_0x1a75('0x2d')]['body'],'MailAccountId':_0x2c6a9c[_0x1a75('0x34')]['id'],'MailInteractionId':_0x58ea57['id'],'direction':'in','ContactId':_0xa5002c[_0x1a75('0x49')]['id'],'messageId':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['messageId'],'from':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x2f')],'to':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['to'],'cc':_0x2c6a9c[_0x1a75('0x2d')]['message']['cc'],'subject':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['subject'],'attach':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['attach'],'Attachments':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x56')],'originTo':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x57')],'originCc':_0x2c6a9c[_0x1a75('0x2d')]['message'][_0x1a75('0x58')],'bcc':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x59')],'ChatWebsiteId':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['ChatWebsiteId']||null,'originChannel':_0x2c6a9c['body']['message'][_0x1a75('0x5a')]||'Email','ChatOfflineMessageId':_0x2c6a9c[_0x1a75('0x2d')]['message'][_0x1a75('0x5b')]||null},{'include':[{'model':db[_0x1a75('0x5c')],'as':_0x1a75('0x5d')}]});})[_0x1a75('0xe')](function(_0x54120d){_0xa5002c[_0x1a75('0x15')]=_0x54120d;if(!_0xa5002c[_0x1a75('0x54')][_0x1a75('0x5e')]){return;}return db[_0x1a75('0x5f')][_0x1a75('0x21')]({'attributes':['id',_0x1a75('0x60')],'where':{'id':_0xa5002c[_0x1a75('0x54')][_0x1a75('0x5e')]}});})[_0x1a75('0xe')](function(_0x28658f){if(_0x28658f){_0xa5002c[_0x1a75('0x40')][_0x1a75('0x61')]({'id':0x0,'priority':0x0,'app':_0x1a75('0x62'),'appdata':_0x28658f['name']+','+(_0xa5002c[_0x1a75('0x34')]['waitForTheAssignedAgent']||0xa),'interval':_0x1a75('0x46')});}if(!_0xa5002c[_0x1a75('0x54')][_0x1a75('0x63')]){return;}return db[_0x1a75('0x64')][_0x1a75('0x21')]({'attributes':['id',_0x1a75('0x60')],'where':{'id':_0xa5002c[_0x1a75('0x54')][_0x1a75('0x63')]}});})[_0x1a75('0xe')](function(_0x4f72ad){if(_0x4f72ad){_0xa5002c['applications'][_0x1a75('0x61')]({'id':0x0,'priority':0x1,'app':_0x1a75('0x65'),'appdata':_0x4f72ad['name']+','+(_0xa5002c[_0x1a75('0x34')][_0x1a75('0x66')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1a75('0x67'),_0x1a75('0x68'),_0xa5002c);})[_0x1a75('0xe')](function(_0x53c8eb){_0x269ed6(_0x53c8eb);})[_0x1a75('0x17')](function(_0xd063a8){_0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,_0xd063a8[_0x1a75('0x15')]));});});}; \ No newline at end of file +var _0x0309=['omit','Applications','account','list','applications','orderBy','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Contact\x20not\x20found','spread','update','interaction','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','where','attributes','include','map','model','ShowMailAccount','find','setDataValue','getSmtpOptions','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','MailApplication','MailServerOut','CloudProvider','List','get'];(function(_0x5ddacc,_0x3ed785){var _0x5b5e21=function(_0xf461d4){while(--_0xf461d4){_0x5ddacc['push'](_0x5ddacc['shift']());}};_0x5b5e21(++_0x3ed785);}(_0x0309,0x165));var _0x9030=function(_0x193be8,_0x2fc916){_0x193be8=_0x193be8-0x0;var _0x4fec40=_0x0309[_0x193be8];return _0x4fec40;};'use strict';var _=require(_0x9030('0x0'));var moment=require('moment');var BPromise=require(_0x9030('0x1'));var rs=require('randomstring');var Redis=require(_0x9030('0x2'));var db=require(_0x9030('0x3'))['db'];var logger=require(_0x9030('0x4'))(_0x9030('0x5'));var config=require(_0x9030('0x6'));var jayson=require(_0x9030('0x7'));var client=jayson[_0x9030('0x8')]['http']({'port':0x232c});config['redis']=_[_0x9030('0x9')](config[_0x9030('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9030('0xb'))(new Redis(config['redis']));require(_0x9030('0xc'))[_0x9030('0xd')](socket);function respondWithRpcPromise(_0x289add,_0x5711b4,_0xe2c28b){return new BPromise(function(_0x1da9ec,_0x337b86){return client['request'](_0x289add,_0xe2c28b)[_0x9030('0xe')](function(_0x21bc06){logger[_0x9030('0xf')](_0x9030('0x10'),_0x5711b4,_0x9030('0x11'));logger[_0x9030('0x12')](_0x9030('0x13'),_0x5711b4,'request\x20sent',JSON[_0x9030('0x14')](_0x21bc06));if(_0x21bc06[_0x9030('0x15')]){if(_0x21bc06[_0x9030('0x15')][_0x9030('0x16')]===0x1f4){logger['error'](_0x9030('0x10'),_0x5711b4,_0x21bc06[_0x9030('0x15')][_0x9030('0x17')]);return _0x337b86(_0x21bc06[_0x9030('0x15')][_0x9030('0x17')]);}logger[_0x9030('0x15')](_0x9030('0x10'),_0x5711b4,_0x21bc06[_0x9030('0x15')][_0x9030('0x17')]);return _0x1da9ec(_0x21bc06['error'][_0x9030('0x17')]);}else{logger[_0x9030('0xf')](_0x9030('0x10'),_0x5711b4,_0x9030('0x11'));_0x1da9ec(_0x21bc06[_0x9030('0x18')][_0x9030('0x17')]);}})[_0x9030('0x19')](function(_0x28c035){logger[_0x9030('0x15')](_0x9030('0x10'),_0x5711b4,_0x28c035);_0x337b86(_0x28c035);});});}exports[_0x9030('0x1a')]=function(_0x41d506){var _0x372716=this;return new Promise(function(_0x243e7d,_0x1e5988){return db[_0x9030('0x1b')][_0x9030('0x1c')]({'raw':_0x41d506['options']?_0x41d506['options'][_0x9030('0x1d')]===undefined?!![]:![]:!![],'where':_0x41d506[_0x9030('0x1e')]?_0x41d506['options'][_0x9030('0x1f')]||null:null,'attributes':_0x41d506[_0x9030('0x1e')]?_0x41d506[_0x9030('0x1e')][_0x9030('0x20')]||null:null,'limit':_0x41d506['options']?_0x41d506[_0x9030('0x1e')]['limit']||null:null,'include':_0x41d506['options']?_0x41d506[_0x9030('0x1e')][_0x9030('0x21')]?_[_0x9030('0x22')](_0x41d506['options'][_0x9030('0x21')],function(_0x408ce6){return{'model':db[_0x408ce6[_0x9030('0x23')]],'as':_0x408ce6['as'],'attributes':_0x408ce6[_0x9030('0x20')],'include':_0x408ce6[_0x9030('0x21')]?_['map'](_0x408ce6[_0x9030('0x21')],function(_0x455eeb){return{'model':db[_0x455eeb[_0x9030('0x23')]],'as':_0x455eeb['as'],'attributes':_0x455eeb[_0x9030('0x20')],'include':_0x455eeb[_0x9030('0x21')]?_[_0x9030('0x22')](_0x455eeb[_0x9030('0x21')],function(_0x2112cf){return{'model':db[_0x2112cf[_0x9030('0x23')]],'as':_0x2112cf['as'],'attributes':_0x2112cf[_0x9030('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9030('0xe')](function(_0x1d0c5c){logger[_0x9030('0xf')](_0x9030('0x1a'),_0x41d506);logger['debug'](_0x9030('0x1a'),_0x41d506,JSON['stringify'](_0x1d0c5c));_0x243e7d(_0x1d0c5c);})[_0x9030('0x19')](function(_0x5b745a){logger[_0x9030('0x15')](_0x9030('0x1a'),_0x5b745a[_0x9030('0x17')],_0x41d506);_0x1e5988(_0x372716['error'](0x1f4,_0x5b745a[_0x9030('0x17')]));});});};exports[_0x9030('0x24')]=function(_0x3b70ff){var _0xb2ff18=this;return new Promise(function(_0xe2f7c1,_0x14619b){return db[_0x9030('0x1b')][_0x9030('0x25')]({'raw':_0x3b70ff[_0x9030('0x1e')]?_0x3b70ff[_0x9030('0x1e')][_0x9030('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b70ff[_0x9030('0x1e')]?_0x3b70ff[_0x9030('0x1e')][_0x9030('0x1f')]||null:null,'attributes':_0x3b70ff[_0x9030('0x1e')]?_0x3b70ff[_0x9030('0x1e')][_0x9030('0x20')]||null:null,'include':_0x3b70ff[_0x9030('0x1e')]?_0x3b70ff['options']['include']?_[_0x9030('0x22')](_0x3b70ff[_0x9030('0x1e')]['include'],function(_0x58cea7){return{'model':db[_0x58cea7[_0x9030('0x23')]],'as':_0x58cea7['as'],'attributes':_0x58cea7[_0x9030('0x20')],'include':_0x58cea7[_0x9030('0x21')]?_[_0x9030('0x22')](_0x58cea7['include'],function(_0xc8123e){return{'model':db[_0xc8123e['model']],'as':_0xc8123e['as'],'attributes':_0xc8123e[_0x9030('0x20')],'include':_0xc8123e[_0x9030('0x21')]?_['map'](_0xc8123e[_0x9030('0x21')],function(_0x19c515){return{'model':db[_0x19c515[_0x9030('0x23')]],'as':_0x19c515['as'],'attributes':_0x19c515['attributes']};}):[]};}):[]};}):[]:[]})[_0x9030('0xe')](function(_0x4864d4){if(_0x3b70ff[_0x9030('0x1e')]['smtp']===!![])_0x4864d4[_0x9030('0x26')]('smtpOptions',_0x4864d4[_0x9030('0x27')]());logger[_0x9030('0xf')](_0x9030('0x24'),_0x3b70ff);logger[_0x9030('0x12')](_0x9030('0x24'),_0x3b70ff,JSON[_0x9030('0x14')](_0x4864d4));_0xe2f7c1(_0x4864d4);})[_0x9030('0x19')](function(_0x429850){logger[_0x9030('0x15')]('ShowMailAccount',_0x429850[_0x9030('0x17')],_0x3b70ff);_0x14619b(_0xb2ff18[_0x9030('0x15')](0x1f4,_0x429850[_0x9030('0x17')]));});});};exports['NotifyMailAccount']=function(_0x72dd20){var _0x281b89=this;return new Promise(function(_0x3ebb74,_0x1a9ee5){var _0x5df7eb={'body':_0x72dd20[_0x9030('0x28')],'channel':_0x9030('0x29')};var _0x2709a8=_['difference'](_[_0x9030('0x2a')](db[_0x9030('0x2b')][_0x9030('0x2c')]),[_0x9030('0x2d'),_0x9030('0x2e'),'CompanyId',_0x9030('0x2f')]);var _0x4c7272=![];if(_0x72dd20[_0x9030('0x28')]['id']){delete _0x72dd20[_0x9030('0x28')]['id'];}if(_[_0x9030('0x30')](_0x72dd20[_0x9030('0x28')][_0x9030('0x31')])){return _0x1a9ee5(_0x281b89[_0x9030('0x15')](0x1f4,_0x9030('0x32')));}if(_[_0x9030('0x30')](_0x72dd20['body'][_0x9030('0x28')])||_0x72dd20[_0x9030('0x28')][_0x9030('0x28')]===''){return _0x1a9ee5(_0x281b89[_0x9030('0x15')](0x1f4,_0x9030('0x33')));}if(_[_0x9030('0x30')](_0x72dd20[_0x9030('0x28')][_0x9030('0x34')])){return _0x1a9ee5(_0x281b89[_0x9030('0x15')](0x1f4,_0x9030('0x35')+_0x2709a8));}if(!_[_0x9030('0x36')](_0x2709a8,_0x72dd20[_0x9030('0x28')][_0x9030('0x34')])){return _0x1a9ee5(_0x281b89[_0x9030('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2709a8));}var _0x4725e5={};_0x4725e5[_0x72dd20[_0x9030('0x28')]['mapKey']]=_0x72dd20[_0x9030('0x28')][_0x9030('0x31')];return db[_0x9030('0x1b')]['find']({'where':{'id':_0x72dd20['account']['id']},'include':[{'model':db[_0x9030('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0x9030('0x38'),'where':_0x4725e5,'limit':0x1,'order':[[_0x9030('0x2e'),_0x9030('0x39')]]}]},{'model':db[_0x9030('0x3a')],'as':'Applications'},{'model':db[_0x9030('0x3b')],'as':'Smtp','include':[{'model':db[_0x9030('0x3c')],'as':_0x9030('0x3c')}]}]})[_0x9030('0xe')](function(_0x513ee4){if(_0x513ee4&&_0x513ee4[_0x9030('0x3d')]){var _0xf54697=_0x513ee4[_0x9030('0x3e')]({'plain':!![]});_0x5df7eb['account']=_[_0x9030('0x3f')](_0xf54697,[_0x9030('0x40'),'List']);_0x5df7eb[_0x9030('0x41')]['smtpOptions']=_0x513ee4[_0x9030('0x27')]();_0x5df7eb['applications']=_0xf54697[_0x9030('0x40')];_0x5df7eb[_0x9030('0x42')]=_0xf54697[_0x9030('0x3d')];_0x5df7eb[_0x9030('0x43')]=_[_0x9030('0x44')](_0x5df7eb[_0x9030('0x43')],['priority'],[_0x9030('0x45')]);if(_0x5df7eb[_0x9030('0x41')]&&_0x5df7eb[_0x9030('0x41')][_0x9030('0x46')]){_0x5df7eb[_0x9030('0x43')]['push']({'id':0x0,'priority':_0x5df7eb['applications'][_0x9030('0x47')]+0x1,'app':_0x9030('0x48'),'appdata':_0x9030('0x46'),'interval':_0x9030('0x49')});}if(_0x5df7eb[_0x9030('0x41')][_0x9030('0x40')]){delete _0x5df7eb[_0x9030('0x41')][_0x9030('0x40')];}if(_0x5df7eb[_0x9030('0x41')][_0x9030('0x3d')]){delete _0x5df7eb[_0x9030('0x41')][_0x9030('0x3d')];}if(_0xf54697[_0x9030('0x3d')]['Contacts'][_0x9030('0x47')]){return _0xf54697[_0x9030('0x3d')]['Contacts'][0x0];}var _0x5c4218=_[_0x9030('0x9')](_0x72dd20[_0x9030('0x28')],{'firstName':_0x72dd20[_0x9030('0x28')][_0x9030('0x31')],'ListId':_0xf54697[_0x9030('0x2f')]});_0x5c4218[_0x72dd20[_0x9030('0x28')]['mapKey']]=_0x72dd20['body'][_0x9030('0x31')];return db[_0x9030('0x2b')][_0x9030('0x4a')](_0x5c4218);}else{throw new Error(_0x9030('0x4b'));}})['then'](function(_0x30710d){_0x5df7eb[_0x9030('0x4c')]=_0x30710d;if(_0x30710d){if(!_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x4d')]){_0x72dd20['body']['message'][_0x9030('0x4d')]=rs[_0x9030('0x4e')]()+'\x20'+_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x31')];}var _0x17bf72={'ContactId':_0x30710d['id'],'MailAccountId':_0x72dd20[_0x9030('0x41')]['id'],'inReplyTo':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x4d')],'to':_0x72dd20['body'][_0x9030('0x17')][_0x9030('0x31')],'cc':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')]['cc'],'subject':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x4f')],'attach':_0x72dd20['body']['message'][_0x9030('0x50')],'lastMsgAt':moment()[_0x9030('0x51')](_0x9030('0x52')),'lastMsgDirection':'in'};return db[_0x9030('0x53')][_0x9030('0x25')]({'where':{'closed':![],'MailAccountId':_0x72dd20[_0x9030('0x41')]['id']},'include':[{'model':db[_0x9030('0x54')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x72dd20['body'][_0x9030('0x17')]['inReplyTo']}}]})[_0x9030('0xe')](function(_0x54f34a){if(_0x54f34a){return[_0x54f34a,![]];}return db[_0x9030('0x53')][_0x9030('0x4a')](_0x17bf72)[_0x9030('0xe')](function(_0xb4b84e){return[_0xb4b84e,!![]];});});}else{throw new Error(_0x9030('0x55'));}})[_0x9030('0x56')](function(_0x3f46de,_0x404d20){if(_0x3f46de){_0x4c7272=_0x404d20;if(!_0x404d20){return _0x3f46de[_0x9030('0x57')]({'inReplyTo':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x4d')],'to':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')]['from'],'cc':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')]['cc'],'subject':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x4f')],'attach':_0x3f46de[_0x9030('0x50')]?_0x3f46de['attach']:_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x50')],'substatus':null,'substatusAt':moment()[_0x9030('0x51')](_0x9030('0x52')),'lastMsgAt':moment()['format'](_0x9030('0x52')),'lastMsgDirection':'in'});}else{return _0x3f46de;}}})[_0x9030('0xe')](function(_0x2bea48){_0x5df7eb['interaction']=_0x2bea48[_0x9030('0x3e')]({'plain':!![]});_0x5df7eb[_0x9030('0x58')]['created']=_0x4c7272;return db['MailMessage']['create']({'body':_0x72dd20[_0x9030('0x28')][_0x9030('0x28')],'MailAccountId':_0x72dd20[_0x9030('0x41')]['id'],'MailInteractionId':_0x2bea48['id'],'direction':'in','ContactId':_0x5df7eb[_0x9030('0x4c')]['id'],'messageId':_0x72dd20[_0x9030('0x28')]['message'][_0x9030('0x4d')],'from':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x31')],'to':_0x72dd20['body'][_0x9030('0x17')]['to'],'cc':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')]['cc'],'subject':_0x72dd20['body'][_0x9030('0x17')][_0x9030('0x4f')],'attach':_0x72dd20['body'][_0x9030('0x17')][_0x9030('0x50')],'Attachments':_0x72dd20[_0x9030('0x28')]['message'][_0x9030('0x59')],'originTo':_0x72dd20['body'][_0x9030('0x17')][_0x9030('0x5a')],'originCc':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x5b')],'bcc':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')]['bcc'],'ChatWebsiteId':_0x72dd20[_0x9030('0x28')]['message'][_0x9030('0x5c')]||null,'originChannel':_0x72dd20[_0x9030('0x28')][_0x9030('0x17')][_0x9030('0x5d')]||_0x9030('0x5e'),'ChatOfflineMessageId':_0x72dd20['body']['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x9030('0x5f')],'as':_0x9030('0x60')}]});})[_0x9030('0xe')](function(_0x50fb8c){_0x5df7eb[_0x9030('0x17')]=_0x50fb8c;if(!_0x5df7eb[_0x9030('0x58')][_0x9030('0x61')]){return;}return db['User'][_0x9030('0x25')]({'attributes':['id',_0x9030('0x62')],'where':{'id':_0x5df7eb[_0x9030('0x58')][_0x9030('0x61')]}});})[_0x9030('0xe')](function(_0x588042){if(_0x588042){_0x5df7eb[_0x9030('0x43')][_0x9030('0x63')]({'id':0x0,'priority':0x0,'app':_0x9030('0x64'),'appdata':_0x588042['name']+','+(_0x5df7eb[_0x9030('0x41')][_0x9030('0x65')]||0xa),'interval':_0x9030('0x49')});}if(!_0x5df7eb[_0x9030('0x58')]['queueId']){return;}return db['MailQueue'][_0x9030('0x25')]({'attributes':['id',_0x9030('0x62')],'where':{'id':_0x5df7eb[_0x9030('0x58')][_0x9030('0x66')]}});})[_0x9030('0xe')](function(_0x59e5fe){if(_0x59e5fe){_0x5df7eb[_0x9030('0x43')][_0x9030('0x63')]({'id':0x0,'priority':0x1,'app':_0x9030('0x67'),'appdata':_0x59e5fe[_0x9030('0x62')]+','+(_0x5df7eb[_0x9030('0x41')]['waitForTheAssignedQueue']||0x12c),'interval':_0x9030('0x49')});}return respondWithRpcPromise('Start',_0x9030('0x68'),_0x5df7eb);})[_0x9030('0xe')](function(_0x351265){_0x3ebb74(_0x351265);})['catch'](function(_0x513184){_0x1a9ee5(_0x281b89[_0x9030('0x15')](0x1f4,_0x513184[_0x9030('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index c36b76c..6919ec3 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 _0xa413=['remove','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x2d1ffe,_0x4125e8){var _0x59b029=function(_0x3589fb){while(--_0x3589fb){_0x2d1ffe['push'](_0x2d1ffe['shift']());}};_0x59b029(++_0x4125e8);}(_0xa413,0x1e5));var _0x3a41=function(_0x465bba,_0x1e476f){_0x465bba=_0x465bba-0x0;var _0x2acb77=_0xa413[_0x465bba];return _0x2acb77;};'use strict';var MailAccountEvents=require(_0x3a41('0x0'));var events=['save',_0x3a41('0x1'),'update'];function createListener(_0x2c56a5,_0x2d706d){return function(_0x5cf826){_0x2d706d['emit'](_0x2c56a5,_0x5cf826);};}function removeListener(_0x32a053,_0x212eb6){return function(){MailAccountEvents[_0x3a41('0x2')](_0x32a053,_0x212eb6);};}exports[_0x3a41('0x3')]=function(_0x25d3e0){for(var _0x1af004=0x0,_0x45f6d2=events[_0x3a41('0x4')];_0x1af004<_0x45f6d2;_0x1af004++){var _0xca7253=events[_0x1af004];var _0x473cd2=createListener(_0x3a41('0x5')+_0xca7253,_0x25d3e0);MailAccountEvents['on'](_0xca7253,_0x473cd2);}}; \ No newline at end of file +var _0x9652=['mailAccount:','./mailAccount.events','save','update','removeListener','length'];(function(_0x33f31b,_0x550ae9){var _0x33514e=function(_0x266538){while(--_0x266538){_0x33f31b['push'](_0x33f31b['shift']());}};_0x33514e(++_0x550ae9);}(_0x9652,0xaf));var _0x2965=function(_0x360584,_0x4d5cbc){_0x360584=_0x360584-0x0;var _0x3d18c3=_0x9652[_0x360584];return _0x3d18c3;};'use strict';var MailAccountEvents=require(_0x2965('0x0'));var events=[_0x2965('0x1'),'remove',_0x2965('0x2')];function createListener(_0x451968,_0xbf6422){return function(_0x4013e4){_0xbf6422['emit'](_0x451968,_0x4013e4);};}function removeListener(_0x4867df,_0x3e26b6){return function(){MailAccountEvents[_0x2965('0x3')](_0x4867df,_0x3e26b6);};}exports['register']=function(_0x5205c7){for(var _0x4c347e=0x0,_0x694054=events[_0x2965('0x4')];_0x4c347e<_0x694054;_0x4c347e++){var _0x31e39f=events[_0x4c347e];var _0x3be4b1=createListener(_0x2965('0x5')+_0x31e39f,_0x5205c7);MailAccountEvents['on'](_0x31e39f,_0x3be4b1);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9360a80..9f9512b 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 _0x6f90=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','put','update','delete','destroy','exports','multer','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6f90,0xc4));var _0x06f9=function(_0xee453a,_0x4e125a){_0xee453a=_0xee453a-0x0;var _0x1431ac=_0x6f90[_0xee453a];return _0x1431ac;};'use strict';var multer=require(_0x06f9('0x0'));var util=require(_0x06f9('0x1'));var path=require(_0x06f9('0x2'));var timeout=require(_0x06f9('0x3'));var express=require(_0x06f9('0x4'));var router=express[_0x06f9('0x5')]();var fs_extra=require(_0x06f9('0x6'));var auth=require(_0x06f9('0x7'));var interaction=require(_0x06f9('0x8'));var config=require(_0x06f9('0x9'));var controller=require(_0x06f9('0xa'));router[_0x06f9('0xb')]('/:id',auth[_0x06f9('0xc')](),controller['show']);router[_0x06f9('0xd')]('/:id',auth[_0x06f9('0xc')](),controller[_0x06f9('0xe')]);router[_0x06f9('0xf')]('/:id',auth[_0x06f9('0xc')](),controller[_0x06f9('0x10')]);module[_0x06f9('0x11')]=router; \ No newline at end of file +var _0xd26b=['/:id','isAuthenticated','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3bec81,_0x1ce782){var _0x28f720=function(_0xb12ac6){while(--_0xb12ac6){_0x3bec81['push'](_0x3bec81['shift']());}};_0x28f720(++_0x1ce782);}(_0xd26b,0x1d4));var _0xbd26=function(_0x4a7e27,_0x1e94fb){_0x4a7e27=_0x4a7e27-0x0;var _0x391f82=_0xd26b[_0x4a7e27];return _0x391f82;};'use strict';var multer=require('multer');var util=require(_0xbd26('0x0'));var path=require(_0xbd26('0x1'));var timeout=require(_0xbd26('0x2'));var express=require(_0xbd26('0x3'));var router=express[_0xbd26('0x4')]();var fs_extra=require(_0xbd26('0x5'));var auth=require(_0xbd26('0x6'));var interaction=require(_0xbd26('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0xbd26('0x8'),auth[_0xbd26('0x9')](),controller['show']);router[_0xbd26('0xa')](_0xbd26('0x8'),auth[_0xbd26('0x9')](),controller[_0xbd26('0xb')]);router['delete'](_0xbd26('0x8'),auth[_0xbd26('0x9')](),controller[_0xbd26('0xc')]);module[_0xbd26('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b919035..b6e6f32 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 _0xd388=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x48f187,_0x167678){var _0x3473db=function(_0x4241d7){while(--_0x4241d7){_0x48f187['push'](_0x48f187['shift']());}};_0x3473db(++_0x167678);}(_0xd388,0x6f));var _0x8d38=function(_0x4476ba,_0x5596c4){_0x4476ba=_0x4476ba-0x0;var _0x283ca8=_0xd388[_0x4476ba];return _0x283ca8;};'use strict';var Sequelize=require(_0x8d38('0x0'));module[_0x8d38('0x1')]={'priority':{'type':Sequelize[_0x8d38('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8d38('0x3')],'allowNull':![],'defaultValue':_0x8d38('0x4')},'appdata':{'type':Sequelize[_0x8d38('0x5')]()},'description':{'type':Sequelize[_0x8d38('0x3')]},'interval':{'type':Sequelize[_0x8d38('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2028=['INTEGER','STRING','noop','*,*,*,*'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2028,0x64));var _0x8202=function(_0x38b58f,_0x9586bd){_0x38b58f=_0x38b58f-0x0;var _0x35e3db=_0x2028[_0x38b58f];return _0x35e3db;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8202('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x8202('0x1')],'allowNull':![],'defaultValue':_0x8202('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8202('0x1')]},'interval':{'type':Sequelize[_0x8202('0x1')],'defaultValue':_0x8202('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5da3a10..dbdd7d9 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 _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x524d1f,_0x3f922f){var _0x2e29b0=function(_0x2af430){while(--_0x2af430){_0x524d1f['push'](_0x524d1f['shift']());}};_0x2e29b0(++_0x3f922f);}(_0xac4a,0x13f));var _0xaac4=function(_0x5261c9,_0x44b8b7){_0x5261c9=_0x5261c9-0x0;var _0x11c4d9=_0xac4a[_0x5261c9];return _0x11c4d9;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0xb819a5,_0x40af38){var _0x27a3a0=function(_0x12d8ef){while(--_0x12d8ef){_0xb819a5['push'](_0xb819a5['shift']());}};_0x27a3a0(++_0x40af38);}(_0x70e0,0x17b));var _0x070e=function(_0x11df04,_0x23f6b6){_0x11df04=_0x11df04-0x0;var _0x106901=_0x70e0[_0x11df04];return _0x106901;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1149664..483636e 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 _0xe2f2=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x2c5490,_0x5d2ee0){var _0x527dc8=function(_0x1b55fa){while(--_0x1b55fa){_0x2c5490['push'](_0x2c5490['shift']());}};_0x527dc8(++_0x5d2ee0);}(_0xe2f2,0x151));var _0x2e2f=function(_0x172ba7,_0x36d6a3){_0x172ba7=_0x172ba7-0x0;var _0x39172f=_0xe2f2[_0x172ba7];return _0x39172f;};'use strict';var _=require(_0x2e2f('0x0'));var util=require(_0x2e2f('0x1'));var logger=require(_0x2e2f('0x2'))('api');var moment=require(_0x2e2f('0x3'));var BPromise=require(_0x2e2f('0x4'));var rp=require(_0x2e2f('0x5'));var fs=require('fs');var path=require(_0x2e2f('0x6'));var rimraf=require(_0x2e2f('0x7'));var config=require(_0x2e2f('0x8'));var attributes=require(_0x2e2f('0x9'));module[_0x2e2f('0xa')]=function(_0x123569,_0x381ec0){return _0x123569[_0x2e2f('0xb')](_0x2e2f('0xc'),attributes,{'tableName':_0x2e2f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e2f('0xe'),'collate':_0x2e2f('0xf')});}; \ No newline at end of file +var _0x6fa6=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xffd240,_0x8b852a){var _0xb486b9=function(_0x1ced1d){while(--_0x1ced1d){_0xffd240['push'](_0xffd240['shift']());}};_0xb486b9(++_0x8b852a);}(_0x6fa6,0xa6));var _0x66fa=function(_0x225865,_0x5811a4){_0x225865=_0x225865-0x0;var _0x560c35=_0x6fa6[_0x225865];return _0x560c35;};'use strict';var _=require(_0x66fa('0x0'));var util=require(_0x66fa('0x1'));var logger=require(_0x66fa('0x2'))(_0x66fa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x66fa('0x4'));var fs=require('fs');var path=require(_0x66fa('0x5'));var rimraf=require(_0x66fa('0x6'));var config=require(_0x66fa('0x7'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x395464,_0x1423cc){return _0x395464['define'](_0x66fa('0x8'),attributes,{'tableName':_0x66fa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x66fa('0xa'),'collate':_0x66fa('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index b4ca94d..c919ef3 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 _0x0e99=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','then','debug','util'];(function(_0x5e1087,_0x21c60b){var _0x453be6=function(_0x39a008){while(--_0x39a008){_0x5e1087['push'](_0x5e1087['shift']());}};_0x453be6(++_0x21c60b);}(_0x0e99,0xb9));var _0x90e9=function(_0x10eb11,_0x1c2aaa){_0x10eb11=_0x10eb11-0x0;var _0x1aad42=_0x0e99[_0x10eb11];return _0x1aad42;};'use strict';var _=require('lodash');var util=require(_0x90e9('0x0'));var moment=require(_0x90e9('0x1'));var BPromise=require(_0x90e9('0x2'));var rs=require(_0x90e9('0x3'));var fs=require('fs');var Redis=require(_0x90e9('0x4'));var db=require(_0x90e9('0x5'))['db'];var utils=require(_0x90e9('0x6'));var logger=require(_0x90e9('0x7'))(_0x90e9('0x8'));var config=require('../../config/environment');var jayson=require(_0x90e9('0x9'));var client=jayson[_0x90e9('0xa')][_0x90e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32db92,_0x3e8de9,_0x577537){return new BPromise(function(_0x4ad134,_0x463c17){return client[_0x90e9('0xc')](_0x32db92,_0x577537)['then'](function(_0x1c5e7b){logger[_0x90e9('0xd')](_0x90e9('0xe'),_0x3e8de9,_0x90e9('0xf'));logger['debug'](_0x90e9('0x10'),_0x3e8de9,_0x90e9('0xf'),JSON[_0x90e9('0x11')](_0x1c5e7b));if(_0x1c5e7b['error']){if(_0x1c5e7b[_0x90e9('0x12')][_0x90e9('0x13')]===0x1f4){logger[_0x90e9('0x12')](_0x90e9('0xe'),_0x3e8de9,_0x1c5e7b['error']['message']);return _0x463c17(_0x1c5e7b[_0x90e9('0x12')][_0x90e9('0x14')]);}logger[_0x90e9('0x12')]('MailApplication,\x20%s,\x20%s',_0x3e8de9,_0x1c5e7b['error'][_0x90e9('0x14')]);return _0x4ad134(_0x1c5e7b['error'][_0x90e9('0x14')]);}else{logger[_0x90e9('0xd')](_0x90e9('0xe'),_0x3e8de9,'request\x20sent');_0x4ad134(_0x1c5e7b['result'][_0x90e9('0x14')]);}})['catch'](function(_0xddb876){logger[_0x90e9('0x12')]('MailApplication,\x20%s,\x20%s',_0x3e8de9,_0xddb876);_0x463c17(_0xddb876);});});}exports[_0x90e9('0x15')]=function(_0x1725e3){var _0x372781=this;return new Promise(function(_0x4c6825,_0x5f20b7){return db[_0x90e9('0x16')][_0x90e9('0x17')](_0x1725e3['body'],{'raw':_0x1725e3[_0x90e9('0x18')]?_0x1725e3['options'][_0x90e9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1725e3[_0x90e9('0x18')]?_0x1725e3[_0x90e9('0x18')][_0x90e9('0x1a')]||null:null,'attributes':_0x1725e3[_0x90e9('0x18')]?_0x1725e3['options'][_0x90e9('0x1b')]||null:null,'limit':_0x1725e3[_0x90e9('0x18')]?_0x1725e3['options'][_0x90e9('0x1c')]||null:null})[_0x90e9('0x1d')](function(_0x581038){logger[_0x90e9('0xd')](_0x90e9('0x15'),_0x1725e3);logger[_0x90e9('0x1e')](_0x90e9('0x15'),_0x1725e3,JSON['stringify'](_0x581038));_0x4c6825(_0x581038);})['catch'](function(_0x435d87){logger[_0x90e9('0x12')](_0x90e9('0x15'),_0x435d87[_0x90e9('0x14')],_0x1725e3);_0x5f20b7(_0x372781[_0x90e9('0x12')](0x1f4,_0x435d87[_0x90e9('0x14')]));});});}; \ No newline at end of file +var _0x21ad=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailApplication,\x20%s,\x20%s','catch','UpdateMailApplication','MailApplication','body','options','where','limit','then','lodash','moment'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x21ad,0x85));var _0xd21a=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x21ad[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0xd21a('0x0'));var util=require('util');var moment=require(_0xd21a('0x1'));var BPromise=require(_0xd21a('0x2'));var rs=require(_0xd21a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd21a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd21a('0x5'));var config=require(_0xd21a('0x6'));var jayson=require(_0xd21a('0x7'));var client=jayson[_0xd21a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25e0e4,_0x1c7fe9,_0xd4ad66){return new BPromise(function(_0x5f2195,_0x210f2f){return client[_0xd21a('0x9')](_0x25e0e4,_0xd4ad66)['then'](function(_0xf51795){logger[_0xd21a('0xa')]('MailApplication,\x20%s,\x20%s',_0x1c7fe9,_0xd21a('0xb'));logger[_0xd21a('0xc')](_0xd21a('0xd'),_0x1c7fe9,_0xd21a('0xb'),JSON[_0xd21a('0xe')](_0xf51795));if(_0xf51795[_0xd21a('0xf')]){if(_0xf51795['error'][_0xd21a('0x10')]===0x1f4){logger[_0xd21a('0xf')]('MailApplication,\x20%s,\x20%s',_0x1c7fe9,_0xf51795[_0xd21a('0xf')][_0xd21a('0x11')]);return _0x210f2f(_0xf51795[_0xd21a('0xf')][_0xd21a('0x11')]);}logger[_0xd21a('0xf')](_0xd21a('0x12'),_0x1c7fe9,_0xf51795[_0xd21a('0xf')]['message']);return _0x5f2195(_0xf51795['error'][_0xd21a('0x11')]);}else{logger[_0xd21a('0xa')](_0xd21a('0x12'),_0x1c7fe9,_0xd21a('0xb'));_0x5f2195(_0xf51795['result'][_0xd21a('0x11')]);}})[_0xd21a('0x13')](function(_0x4c6258){logger[_0xd21a('0xf')](_0xd21a('0x12'),_0x1c7fe9,_0x4c6258);_0x210f2f(_0x4c6258);});});}exports[_0xd21a('0x14')]=function(_0x357e71){var _0x3c7ca5=this;return new Promise(function(_0x4c3d6d,_0x2d354a){return db[_0xd21a('0x15')]['update'](_0x357e71[_0xd21a('0x16')],{'raw':_0x357e71[_0xd21a('0x17')]?_0x357e71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x357e71[_0xd21a('0x17')]?_0x357e71[_0xd21a('0x17')][_0xd21a('0x18')]||null:null,'attributes':_0x357e71[_0xd21a('0x17')]?_0x357e71[_0xd21a('0x17')]['attributes']||null:null,'limit':_0x357e71[_0xd21a('0x17')]?_0x357e71[_0xd21a('0x17')][_0xd21a('0x19')]||null:null})[_0xd21a('0x1a')](function(_0x36f680){logger[_0xd21a('0xa')](_0xd21a('0x14'),_0x357e71);logger[_0xd21a('0xc')](_0xd21a('0x14'),_0x357e71,JSON['stringify'](_0x36f680));_0x4c3d6d(_0x36f680);})[_0xd21a('0x13')](function(_0x10d12c){logger['error']('UpdateMailApplication',_0x10d12c['message'],_0x357e71);_0x2d354a(_0x3c7ca5[_0xd21a('0xf')](0x1f4,_0x10d12c[_0xd21a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 30739aa..0425fb3 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 _0x97b5=['put','/:id','mailinteraction:destroy','destroy','/:id/tags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','post','addMessage','tracked','mail','addTags'];(function(_0x52e7fc,_0x43b394){var _0xc34163=function(_0x14bbef){while(--_0x14bbef){_0x52e7fc['push'](_0x52e7fc['shift']());}};_0xc34163(++_0x43b394);}(_0x97b5,0x186));var _0x597b=function(_0x114bcc,_0xda36dc){_0x114bcc=_0x114bcc-0x0;var _0x24c4c4=_0x97b5[_0x114bcc];return _0x24c4c4;};'use strict';var express=require(_0x597b('0x0'));var router=express[_0x597b('0x1')]();var auth=require(_0x597b('0x2'));var interaction=require(_0x597b('0x3'));var controller=require(_0x597b('0x4'));router[_0x597b('0x5')]('/',auth['isAuthenticated'](),controller[_0x597b('0x6')]);router[_0x597b('0x5')](_0x597b('0x7'),auth[_0x597b('0x8')](),controller[_0x597b('0x9')]);router[_0x597b('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x597b('0xa')]);router[_0x597b('0x5')](_0x597b('0xb'),auth['isAuthenticated'](),controller[_0x597b('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x597b('0x8')](),controller['create']);router[_0x597b('0xd')](_0x597b('0xb'),auth[_0x597b('0x8')](),controller[_0x597b('0xe')]);router[_0x597b('0xd')]('/:id/tags',auth[_0x597b('0x8')](),interaction[_0x597b('0xf')](_0x597b('0x10'),'mailinteraction:addtags'),controller[_0x597b('0x11')]);router[_0x597b('0x12')](_0x597b('0x13'),auth[_0x597b('0x8')](),interaction[_0x597b('0xf')](_0x597b('0x10'),'mailinteraction:update'),controller['update']);router['delete'](_0x597b('0x13'),auth['isAuthenticated'](),interaction[_0x597b('0xf')]('mail',_0x597b('0x14')),controller[_0x597b('0x15')]);router['delete'](_0x597b('0x16'),auth[_0x597b('0x8')](),controller['removeTags']);module[_0x597b('0x17')]=router; \ No newline at end of file +var _0xab01=['Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','download','create','post','addMessage','tracked','mail','addTags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports'];(function(_0x3025d0,_0x5777a9){var _0x7fbc20=function(_0x229876){while(--_0x229876){_0x3025d0['push'](_0x3025d0['shift']());}};_0x7fbc20(++_0x5777a9);}(_0xab01,0x1cb));var _0x1ab0=function(_0x2e7279,_0x28dd44){_0x2e7279=_0x2e7279-0x0;var _0x2e95a9=_0xab01[_0x2e7279];return _0x2e95a9;};'use strict';var express=require('express');var router=express[_0x1ab0('0x0')]();var auth=require(_0x1ab0('0x1'));var interaction=require(_0x1ab0('0x2'));var controller=require(_0x1ab0('0x3'));router['get']('/',auth[_0x1ab0('0x4')](),controller[_0x1ab0('0x5')]);router[_0x1ab0('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x1ab0('0x7')]);router[_0x1ab0('0x6')](_0x1ab0('0x8'),auth[_0x1ab0('0x4')](),controller['show']);router['get'](_0x1ab0('0x9'),auth[_0x1ab0('0x4')](),controller[_0x1ab0('0xa')]);router[_0x1ab0('0x6')]('/:id/download',auth[_0x1ab0('0x4')](),controller[_0x1ab0('0xb')]);router['post']('/',auth[_0x1ab0('0x4')](),controller[_0x1ab0('0xc')]);router[_0x1ab0('0xd')]('/:id/messages',auth[_0x1ab0('0x4')](),controller[_0x1ab0('0xe')]);router[_0x1ab0('0xd')]('/:id/tags',auth[_0x1ab0('0x4')](),interaction[_0x1ab0('0xf')](_0x1ab0('0x10'),'mailinteraction:addtags'),controller[_0x1ab0('0x11')]);router[_0x1ab0('0x12')]('/:id',auth['isAuthenticated'](),interaction[_0x1ab0('0xf')](_0x1ab0('0x10'),_0x1ab0('0x13')),controller[_0x1ab0('0x14')]);router['delete'](_0x1ab0('0x8'),auth[_0x1ab0('0x4')](),interaction[_0x1ab0('0xf')](_0x1ab0('0x10'),_0x1ab0('0x15')),controller[_0x1ab0('0x16')]);router[_0x1ab0('0x17')](_0x1ab0('0x18'),auth['isAuthenticated'](),controller[_0x1ab0('0x19')]);module[_0x1ab0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 8c69e00..6235cf9 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 _0x1465=['DATE','STRING','TEXT','long','ENUM','out','BOOLEAN'];(function(_0x3872b4,_0x555952){var _0x4eff1b=function(_0x1e649f){while(--_0x1e649f){_0x3872b4['push'](_0x3872b4['shift']());}};_0x4eff1b(++_0x555952);}(_0x1465,0x99));var _0x5146=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0x1465[_0xc69f39];return _0x93be41;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x5146('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5146('0x1')]},'disposition':{'type':Sequelize[_0x5146('0x2')]},'secondDisposition':{'type':Sequelize[_0x5146('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5146('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x5146('0x2')](0x1fe)},'to':{'type':Sequelize[_0x5146('0x2')]},'cc':{'type':Sequelize[_0x5146('0x3')](_0x5146('0x4'))},'subject':{'type':Sequelize[_0x5146('0x3')]()},'attach':{'type':Sequelize[_0x5146('0x0')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x5146('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x5146('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x5146('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5146('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x5146('0x5')]('in',_0x5146('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5146('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd5b1=['DATE','STRING','TEXT','long','BOOLEAN','ENUM','out','INTEGER','sequelize'];(function(_0x1fbad0,_0x347796){var _0x53bcac=function(_0x2ef1d2){while(--_0x2ef1d2){_0x1fbad0['push'](_0x1fbad0['shift']());}};_0x53bcac(++_0x347796);}(_0xd5b1,0x143));var _0x1d5b=function(_0x25f7c7,_0x1e9498){_0x25f7c7=_0x25f7c7-0x0;var _0x1f7ccf=_0xd5b1[_0x25f7c7];return _0x1f7ccf;};'use strict';var Sequelize=require(_0x1d5b('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1d5b('0x1')]},'disposition':{'type':Sequelize[_0x1d5b('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1d5b('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1d5b('0x2')](0x1fe)},'to':{'type':Sequelize[_0x1d5b('0x2')]},'cc':{'type':Sequelize[_0x1d5b('0x3')](_0x1d5b('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x1d5b('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1d5b('0x1')]},'substatus':{'type':Sequelize[_0x1d5b('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x1d5b('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x1d5b('0x6')]('in',_0x1d5b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1d5b('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1d5b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1d5b('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1d5b('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 8d45b13..8a8e02d 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 _0x69e5=['eml-format','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','destroy','then','error','stack','name','index','map','MailInteraction','type','key','getOptions','findAll','mail','user','catch','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','update','describe','addMessage','omit','ids','getMessages','findOne','MailMessage','length','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','spread','color','emit','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','readFileSync','build','writeFileSync','message%d.eml'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69e5,0x150));var _0x569e=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x69e5[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0x569e('0x0'));var rimraf=require(_0x569e('0x1'));var zipdir=require(_0x569e('0x2'));var moment=require(_0x569e('0x3'));var BPromise=require('bluebird');var util=require(_0x569e('0x4'));var path=require(_0x569e('0x5'));var fs=require('fs');var _=require(_0x569e('0x6'));var juice=require('juice');var Redis=require(_0x569e('0x7'));var interaction=require(_0x569e('0x8'));var qs=require(_0x569e('0x9'));var logger=require('../../config/logger')(_0x569e('0xa'));var config=require(_0x569e('0xb'));var db=require(_0x569e('0xc'))['db'];var htmlEntities=require(_0x569e('0xd'));config[_0x569e('0xe')]=_['defaults'](config[_0x569e('0xe')],{'host':_0x569e('0xf'),'port':0x18eb});var socket=require(_0x569e('0x10'))(new Redis(config[_0x569e('0xe')]));require('./mailInteraction.socket')[_0x569e('0x11')](socket);function respondWithStatusCode(_0x438477,_0x2c5b2e){_0x2c5b2e=_0x2c5b2e||0xcc;return function(_0x2b7315){if(_0x2b7315){return _0x438477[_0x569e('0x12')](_0x2c5b2e);}return _0x438477[_0x569e('0x13')](_0x2c5b2e)[_0x569e('0x14')]();};}function respondWithResult(_0x245ef8,_0x13eb4c){_0x13eb4c=_0x13eb4c||0xc8;return function(_0x27cefc){if(_0x27cefc){return _0x245ef8[_0x569e('0x13')](_0x13eb4c)['json'](_0x27cefc);}};}function respondWithFilteredResult(_0x1710e9,_0x2d9a86){return function(_0x309e9e){if(_0x309e9e){var _0x2fd7e8=typeof _0x2d9a86['offset']===_0x569e('0x15')&&typeof _0x2d9a86['limit']===_0x569e('0x15');var _0x29c0e0=_0x309e9e[_0x569e('0x16')];var _0x153ad1=_0x2fd7e8?0x0:_0x2d9a86[_0x569e('0x17')];var _0x5a867c=_0x2fd7e8?_0x309e9e['count']:_0x2d9a86['offset']+_0x2d9a86[_0x569e('0x18')];var _0x4b4edb;if(_0x5a867c>=_0x29c0e0){_0x5a867c=_0x29c0e0;_0x4b4edb=0xc8;}else{_0x4b4edb=0xce;}_0x1710e9[_0x569e('0x13')](_0x4b4edb);return _0x1710e9[_0x569e('0x19')](_0x569e('0x1a'),_0x153ad1+'-'+_0x5a867c+'/'+_0x29c0e0)[_0x569e('0x1b')](_0x309e9e);}return null;};}function saveUpdates(_0x10a2ee){return function(_0x205ae3){if(_0x205ae3){return _0x205ae3['update'](_0x10a2ee)['then'](function(_0x3d270c){return _0x3d270c;});}return null;};}function removeEntity(_0xa6c316){return function(_0x5648ad){if(_0x5648ad){return _0x5648ad[_0x569e('0x1c')]()[_0x569e('0x1d')](function(){_0xa6c316[_0x569e('0x13')](0xcc)[_0x569e('0x14')]();});}};}function handleEntityNotFound(_0x125b63){return function(_0x18b239){if(!_0x18b239){_0x125b63[_0x569e('0x12')](0x194);}return _0x18b239;};}function handleError(_0x288215,_0xef15eb){_0xef15eb=_0xef15eb||0x1f4;return function(_0x44a84f){logger[_0x569e('0x1e')](_0x44a84f[_0x569e('0x1f')]);if(_0x44a84f[_0x569e('0x20')]){delete _0x44a84f[_0x569e('0x20')];}_0x288215[_0x569e('0x13')](_0xef15eb)['send'](_0x44a84f);};}exports[_0x569e('0x21')]=function(_0x18f8e8,_0x2b1584){var _0x45fbbb={};var _0x2d6a0b=_[_0x569e('0x22')](db[_0x569e('0x23')]['rawAttributes'],function(_0x1e3746){return{'name':_0x1e3746['fieldName'],'type':_0x1e3746[_0x569e('0x24')][_0x569e('0x25')]};});_0x45fbbb=qs[_0x569e('0x26')](_0x2d6a0b,_0x18f8e8);return interaction[_0x569e('0x27')](_0x569e('0x28'),_0x18f8e8['query'],_0x18f8e8[_0x569e('0x29')],_0x45fbbb,_0x2d6a0b)['then'](respondWithFilteredResult(_0x2b1584,_0x45fbbb))[_0x569e('0x2a')](handleError(_0x2b1584,null));};exports[_0x569e('0x2b')]=function(_0x2a818f,_0x512ec7){var _0x206796={'raw':![],'where':{'id':_0x2a818f[_0x569e('0x2c')]['id']}},_0x319b92={};_0x319b92[_0x569e('0x2d')]=_[_0x569e('0x2e')](db[_0x569e('0x23')][_0x569e('0x2f')]);_0x319b92[_0x569e('0x30')]=_[_0x569e('0x2e')](_0x2a818f[_0x569e('0x30')]);_0x319b92[_0x569e('0x31')]=_['intersection'](_0x319b92['model'],_0x319b92[_0x569e('0x30')]);_0x206796['attributes']=_[_0x569e('0x32')](_0x319b92[_0x569e('0x2d')],qs[_0x569e('0x33')](_0x2a818f[_0x569e('0x30')][_0x569e('0x33')]));_0x206796['attributes']=_0x206796[_0x569e('0x34')]['length']?_0x206796[_0x569e('0x34')]:_0x319b92['model'];if(_0x2a818f[_0x569e('0x30')][_0x569e('0x35')]){_0x206796[_0x569e('0x36')]=[{'all':!![]}];}_0x206796=_[_0x569e('0x37')]({},_0x206796,_0x2a818f[_0x569e('0x38')]);return db['MailInteraction'][_0x569e('0x39')](_0x206796)[_0x569e('0x1d')](handleEntityNotFound(_0x512ec7,null))[_0x569e('0x1d')](respondWithResult(_0x512ec7,null))[_0x569e('0x2a')](handleError(_0x512ec7,null));};exports[_0x569e('0x3a')]=function(_0x3b9d8b,_0x1e99a5){return db['MailInteraction'][_0x569e('0x3a')](_0x3b9d8b[_0x569e('0x3b')],{})[_0x569e('0x1d')](respondWithResult(_0x1e99a5,0xc9))[_0x569e('0x2a')](handleError(_0x1e99a5,null));};exports[_0x569e('0x3c')]=function(_0x3821a9,_0x52667b){if(_0x3821a9[_0x569e('0x3b')]['id']){delete _0x3821a9['body']['id'];}return db[_0x569e('0x23')][_0x569e('0x39')]({'where':{'id':_0x3821a9[_0x569e('0x2c')]['id']}})[_0x569e('0x1d')](handleEntityNotFound(_0x52667b,null))[_0x569e('0x1d')](saveUpdates(_0x3821a9['body'],null))['then'](respondWithResult(_0x52667b,null))[_0x569e('0x2a')](handleError(_0x52667b,null));};exports[_0x569e('0x1c')]=function(_0x17affb,_0x4f1431){return db['MailInteraction'][_0x569e('0x39')]({'where':{'id':_0x17affb['params']['id']}})['then'](handleEntityNotFound(_0x4f1431,null))[_0x569e('0x1d')](removeEntity(_0x4f1431,null))[_0x569e('0x2a')](handleError(_0x4f1431,null));};exports[_0x569e('0x3d')]=function(_0x305780,_0x504933){return db['MailInteraction'][_0x569e('0x3d')]()[_0x569e('0x1d')](respondWithResult(_0x504933,null))[_0x569e('0x2a')](handleError(_0x504933,null));};exports['addMessage']=function(_0x4a480c,_0x166bff){return db['MailMessage']['find']({'where':{'id':_0x4a480c[_0x569e('0x2c')]['id']}})[_0x569e('0x1d')](handleEntityNotFound(_0x166bff,null))[_0x569e('0x1d')](function(_0x62d25d){if(_0x62d25d){return _0x62d25d[_0x569e('0x3e')](_0x4a480c[_0x569e('0x3b')]['ids'],_[_0x569e('0x3f')](_0x4a480c[_0x569e('0x3b')],[_0x569e('0x40'),'id'])||{});}})[_0x569e('0x1d')](respondWithResult(_0x166bff,null))[_0x569e('0x2a')](handleError(_0x166bff,null));};exports[_0x569e('0x41')]=function(_0x2bb3b5,_0x4f5931){var _0x4a708e={'raw':![],'where':{}};var _0x3b6307={};var _0x420584={'count':0x0,'rows':[]};return db['MailInteraction'][_0x569e('0x42')]({'where':{'id':_0x2bb3b5[_0x569e('0x2c')]['id']}})[_0x569e('0x1d')](handleEntityNotFound(_0x4f5931,null))[_0x569e('0x1d')](function(_0x4b9a09){if(_0x4b9a09){_0x3b6307['model']=_[_0x569e('0x2e')](db[_0x569e('0x43')][_0x569e('0x2f')]);_0x3b6307['query']=_[_0x569e('0x2e')](_0x2bb3b5[_0x569e('0x30')]);_0x3b6307[_0x569e('0x31')]=_[_0x569e('0x32')](_0x3b6307[_0x569e('0x2d')],_0x3b6307[_0x569e('0x30')]);_0x4a708e['attributes']=_[_0x569e('0x32')](_0x3b6307[_0x569e('0x2d')],qs[_0x569e('0x33')](_0x2bb3b5['query'][_0x569e('0x33')]));_0x4a708e[_0x569e('0x34')]=_0x4a708e['attributes'][_0x569e('0x44')]?_0x4a708e[_0x569e('0x34')]:_0x3b6307[_0x569e('0x2d')];if(!_0x2bb3b5[_0x569e('0x30')][_0x569e('0x45')](_0x569e('0x46'))){_0x4a708e[_0x569e('0x18')]=qs['limit'](_0x2bb3b5[_0x569e('0x30')][_0x569e('0x18')]);_0x4a708e['offset']=qs[_0x569e('0x17')](_0x2bb3b5[_0x569e('0x30')][_0x569e('0x17')]);}_0x4a708e[_0x569e('0x47')]=qs['sort'](_0x2bb3b5[_0x569e('0x30')][_0x569e('0x48')]);_0x4a708e['where']=qs[_0x569e('0x31')](_['pick'](_0x2bb3b5[_0x569e('0x30')],_0x3b6307[_0x569e('0x31')]));_0x4a708e[_0x569e('0x49')][_0x569e('0x4a')]=_0x4b9a09['id'];if(_0x2bb3b5['query'][_0x569e('0x4b')]){_0x4a708e[_0x569e('0x49')]=_['merge'](_0x4a708e[_0x569e('0x49')],{'$or':_[_0x569e('0x22')](_0x4a708e[_0x569e('0x34')],function(_0x483375){var _0x41344c={};_0x41344c[_0x483375]={'$like':'%'+_0x2bb3b5['query'][_0x569e('0x4b')]+'%'};return _0x41344c;})});}if(_0x2bb3b5[_0x569e('0x30')][_0x569e('0x4c')]){var _0xd29793=_0x2bb3b5[_0x569e('0x30')][_0x569e('0x4c')][_0x569e('0x4d')](',');var _0x20383d={};_0x20383d[_0xd29793[0x0]]={'$gte':moment(_0xd29793[0x1])[_0x569e('0x4e')](_0x569e('0x4f'))};_0x4a708e[_0x569e('0x49')]=_['merge'](_0x4a708e[_0x569e('0x49')],_0x20383d);}_0x4a708e=_['merge']({},_0x4a708e,_0x2bb3b5['options']);return db[_0x569e('0x43')][_0x569e('0x16')]({'where':_0x4a708e['where']})[_0x569e('0x1d')](function(_0xfbd472){_0x420584[_0x569e('0x16')]=_0xfbd472;if(_0x2bb3b5[_0x569e('0x30')][_0x569e('0x35')]){_0x4a708e[_0x569e('0x36')]=[{'all':!![]}];}return db[_0x569e('0x43')]['findAll'](_0x4a708e);})[_0x569e('0x1d')](function(_0x56a2a5){if(_0x2bb3b5['query'][_0x569e('0x50')]==='true'){for(var _0x12d90d=0x0;_0x12d90d<_0x56a2a5[_0x569e('0x44')];_0x12d90d++){_0x56a2a5[_0x12d90d][_0x569e('0x3b')]=juice(_0x56a2a5[_0x12d90d][_0x569e('0x3b')]);}}_0x420584[_0x569e('0x51')]=_0x56a2a5;return _0x420584;});}})[_0x569e('0x1d')](respondWithFilteredResult(_0x4f5931,_0x4a708e))[_0x569e('0x2a')](handleError(_0x4f5931,null));};exports['addTags']=function(_0xed217b,_0x5e0a5f){return db[_0x569e('0x23')][_0x569e('0x39')]({'where':{'id':_0xed217b[_0x569e('0x2c')]['id']}})[_0x569e('0x1d')](handleEntityNotFound(_0x5e0a5f,null))[_0x569e('0x1d')](function(_0x25cf82){if(_0x25cf82){return _0x25cf82['setTags'](_0xed217b[_0x569e('0x3b')][_0x569e('0x40')],_[_0x569e('0x3f')](_0xed217b[_0x569e('0x3b')],[_0x569e('0x40'),'id'])||{})[_0x569e('0x52')](function(){return db['Tag']['findAll']({'attributes':['id',_0x569e('0x20'),_0x569e('0x53')],'where':{'id':_0xed217b[_0x569e('0x3b')][_0x569e('0x40')]}});})[_0x569e('0x1d')](function(_0xd8d047){socket[_0x569e('0x54')](_0x569e('0x55'),{'id':Number(_0xed217b[_0x569e('0x2c')]['id']),'tags':_0xd8d047||[]});return{'id':Number(_0xed217b[_0x569e('0x2c')]['id']),'tags':_0xd8d047||[]};});}})[_0x569e('0x1d')](respondWithResult(_0x5e0a5f,null))[_0x569e('0x2a')](handleError(_0x5e0a5f,null));};exports[_0x569e('0x56')]=function(_0x2c8647,_0x92f9f4){return db['MailInteraction'][_0x569e('0x39')]({'where':{'id':_0x2c8647[_0x569e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x92f9f4,null))[_0x569e('0x1d')](function(_0x57a4ed){if(_0x57a4ed){return _0x57a4ed['removeTags'](_0x2c8647[_0x569e('0x30')][_0x569e('0x40')]);}})[_0x569e('0x1d')](respondWithStatusCode(_0x92f9f4,null))[_0x569e('0x2a')](handleError(_0x92f9f4,null));};exports[_0x569e('0x57')]=function(_0x16b797,_0x3c5af2){var _0xd3e7ca=moment()['unix']()['toString']();var _0x24fef2=path[_0x569e('0x58')](config[_0x569e('0x59')],_0x569e('0x5a'),_0x569e('0x5b'),_0x569e('0x5c'));var _0x7560aa=path[_0x569e('0x58')](config[_0x569e('0x59')],_0x569e('0x5a'),'files',_0x569e('0x5d'));var _0x5eaff4=path[_0x569e('0x58')](_0x24fef2,_0xd3e7ca);var _0x57784f=util['format'](_0x569e('0x5e'),_0x16b797[_0x569e('0x2c')]['id'],_0xd3e7ca);var _0x10235b=path[_0x569e('0x58')](_0x24fef2,_0x57784f);var _0x43ea98=[];if(_0x16b797[_0x569e('0x30')][_0x569e('0x5d')]){_0x43ea98[_0x569e('0x5f')]({'model':db[_0x569e('0x60')],'as':_0x569e('0x61'),'raw':!![]});}var _0xc32d36=[{'model':db[_0x569e('0x43')],'as':_0x569e('0x62'),'attributes':['id',_0x569e('0x3b'),_0x569e('0x63'),'to','cc',_0x569e('0x64'),_0x569e('0x65'),_0x569e('0x66')],'where':{'secret':![]},'order':qs[_0x569e('0x48')]('id'),'include':_0x43ea98}];return db[_0x569e('0x23')][_0x569e('0x39')]({'where':{'id':_0x16b797[_0x569e('0x2c')]['id']},'include':_0xc32d36})[_0x569e('0x1d')](handleEntityNotFound(_0x3c5af2,null))['then'](function(_0x243d1a){if(_0x243d1a&&_0x243d1a['Messages']){var _0x2d9771=_0x243d1a['get']({'plain':!![]});fs['mkdirSync'](_0x5eaff4);return BPromise[_0x569e('0x67')](_0x2d9771[_0x569e('0x62')],function(_0xf4e550,_0x163f2a){var _0x1b0a6a={'from':_0xf4e550['from'],'to':_0xf4e550['to']||_0x569e('0x68'),'subject':_0xf4e550[_0x569e('0x65')],'html':htmlEntities['decode'](_0xf4e550[_0x569e('0x3b')]),'headers':{'Date':moment(_0xf4e550[_0x569e('0x66')])[_0x569e('0x4e')](_0x569e('0x69'))},'attachments':[]};if(_0xf4e550['cc']){_0x1b0a6a[_0x569e('0x6a')]['Cc']=_0xf4e550['cc'];}if(_0xf4e550[_0x569e('0x64')]){_0x1b0a6a[_0x569e('0x6a')]['Bcc']=_0xf4e550[_0x569e('0x64')];}return new BPromise(function(_0x254468,_0x3f697a){if(_0xf4e550[_0x569e('0x61')]){for(var _0x1af99f=0x0;_0x1af99f<_0xf4e550['Attachments'][_0x569e('0x44')];_0x1af99f++){var _0x33c360=_0xf4e550[_0x569e('0x61')][_0x1af99f];var _0x3e9063=path[_0x569e('0x58')](_0x7560aa,_0x33c360['basename']);if(fs[_0x569e('0x6b')](_0x3e9063)){_0x1b0a6a[_0x569e('0x5d')]['push']({'name':_0x33c360[_0x569e('0x20')],'contentType':_0x33c360['type'],'data':fs[_0x569e('0x6c')](_0x3e9063)});}}}emlformat[_0x569e('0x6d')](_0x1b0a6a,function(_0x58a632,_0x1cbcf6){if(_0x58a632)return _0x3f697a(_0x58a632);fs[_0x569e('0x6e')](path['join'](_0x5eaff4,util['format'](_0x569e('0x6f'),_0x163f2a)),_0x1cbcf6);return _0x254468(_0x1cbcf6);});});})[_0x569e('0x1d')](function(){return new BPromise(function(_0x4e8d94,_0x3bcf7d){zipdir(_0x5eaff4,{'saveTo':_0x10235b},function(_0x51b699,_0x19a79a){if(_0x51b699)return _0x3bcf7d(_0x51b699);return _0x4e8d94(_0x19a79a);});})['then'](function(){return new BPromise(function(_0x4422f5,_0x403842){rimraf(_0x5eaff4,function(_0x18da40){if(_0x18da40)_0x403842(_0x18da40);return _0x4422f5();});});})[_0x569e('0x1d')](function(){return _0x3c5af2['download'](_0x10235b,_0x57784f,function(_0x96e4b7){if(!_0x96e4b7)fs['unlinkSync'](_0x10235b);});});});}else{return _0x3c5af2[_0x569e('0x12')](0xc8);}})[_0x569e('0x2a')](handleError(_0x3c5af2,null));}; \ No newline at end of file +var _0x79ac=['set','Content-Range','update','then','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','key','findAll','query','user','catch','show','params','model','keys','intersection','fields','attributes','length','include','merge','create','body','destroy','find','describe','addMessage','MailMessage','omit','ids','filters','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','$gte','split','includeAll','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','push','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','from','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','type','writeFileSync','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79ac,0x139));var _0xc79a=function(_0xab9e4c,_0x33d184){_0xab9e4c=_0xab9e4c-0x0;var _0x4a94c4=_0x79ac[_0xab9e4c];return _0x4a94c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc79a('0x0'));var zipdir=require(_0xc79a('0x1'));var moment=require('moment');var BPromise=require(_0xc79a('0x2'));var util=require(_0xc79a('0x3'));var path=require(_0xc79a('0x4'));var fs=require('fs');var _=require(_0xc79a('0x5'));var juice=require(_0xc79a('0x6'));var Redis=require(_0xc79a('0x7'));var interaction=require(_0xc79a('0x8'));var qs=require(_0xc79a('0x9'));var logger=require(_0xc79a('0xa'))('api');var config=require(_0xc79a('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xc79a('0xc'));config[_0xc79a('0xd')]=_[_0xc79a('0xe')](config[_0xc79a('0xd')],{'host':_0xc79a('0xf'),'port':0x18eb});var socket=require(_0xc79a('0x10'))(new Redis(config[_0xc79a('0xd')]));require(_0xc79a('0x11'))['register'](socket);function respondWithStatusCode(_0x1ce2d7,_0x12b377){_0x12b377=_0x12b377||0xcc;return function(_0x14fae1){if(_0x14fae1){return _0x1ce2d7[_0xc79a('0x12')](_0x12b377);}return _0x1ce2d7['status'](_0x12b377)[_0xc79a('0x13')]();};}function respondWithResult(_0x406ded,_0x56c659){_0x56c659=_0x56c659||0xc8;return function(_0x420329){if(_0x420329){return _0x406ded[_0xc79a('0x14')](_0x56c659)[_0xc79a('0x15')](_0x420329);}};}function respondWithFilteredResult(_0x2f7700,_0x331f9a){return function(_0x175353){if(_0x175353){var _0x555dd3=typeof _0x331f9a['offset']===_0xc79a('0x16')&&typeof _0x331f9a[_0xc79a('0x17')]===_0xc79a('0x16');var _0xe3d495=_0x175353[_0xc79a('0x18')];var _0x30011d=_0x555dd3?0x0:_0x331f9a[_0xc79a('0x19')];var _0x10225a=_0x555dd3?_0x175353['count']:_0x331f9a[_0xc79a('0x19')]+_0x331f9a[_0xc79a('0x17')];var _0x4fd198;if(_0x10225a>=_0xe3d495){_0x10225a=_0xe3d495;_0x4fd198=0xc8;}else{_0x4fd198=0xce;}_0x2f7700[_0xc79a('0x14')](_0x4fd198);return _0x2f7700[_0xc79a('0x1a')](_0xc79a('0x1b'),_0x30011d+'-'+_0x10225a+'/'+_0xe3d495)[_0xc79a('0x15')](_0x175353);}return null;};}function saveUpdates(_0x35781e){return function(_0x57a5be){if(_0x57a5be){return _0x57a5be[_0xc79a('0x1c')](_0x35781e)[_0xc79a('0x1d')](function(_0x449251){return _0x449251;});}return null;};}function removeEntity(_0x3a04ae){return function(_0x31a2d8){if(_0x31a2d8){return _0x31a2d8['destroy']()[_0xc79a('0x1d')](function(){_0x3a04ae[_0xc79a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e8587){return function(_0x4adf80){if(!_0x4adf80){_0x3e8587['sendStatus'](0x194);}return _0x4adf80;};}function handleError(_0x21c4c8,_0x574c4a){_0x574c4a=_0x574c4a||0x1f4;return function(_0x48f194){logger[_0xc79a('0x1e')](_0x48f194[_0xc79a('0x1f')]);if(_0x48f194[_0xc79a('0x20')]){delete _0x48f194[_0xc79a('0x20')];}_0x21c4c8['status'](_0x574c4a)['send'](_0x48f194);};}exports[_0xc79a('0x21')]=function(_0x5e21b8,_0x34c960){var _0x34dc12={};var _0x14efb2=_[_0xc79a('0x22')](db[_0xc79a('0x23')][_0xc79a('0x24')],function(_0x5ee3a1){return{'name':_0x5ee3a1[_0xc79a('0x25')],'type':_0x5ee3a1['type'][_0xc79a('0x26')]};});_0x34dc12=qs['getOptions'](_0x14efb2,_0x5e21b8);return interaction[_0xc79a('0x27')]('mail',_0x5e21b8[_0xc79a('0x28')],_0x5e21b8[_0xc79a('0x29')],_0x34dc12,_0x14efb2)[_0xc79a('0x1d')](respondWithFilteredResult(_0x34c960,_0x34dc12))[_0xc79a('0x2a')](handleError(_0x34c960,null));};exports[_0xc79a('0x2b')]=function(_0x2064cc,_0x5b14f6){var _0x5935b6={'raw':![],'where':{'id':_0x2064cc[_0xc79a('0x2c')]['id']}},_0x5c9952={};_0x5c9952[_0xc79a('0x2d')]=_[_0xc79a('0x2e')](db[_0xc79a('0x23')][_0xc79a('0x24')]);_0x5c9952[_0xc79a('0x28')]=_[_0xc79a('0x2e')](_0x2064cc[_0xc79a('0x28')]);_0x5c9952['filters']=_[_0xc79a('0x2f')](_0x5c9952[_0xc79a('0x2d')],_0x5c9952['query']);_0x5935b6['attributes']=_[_0xc79a('0x2f')](_0x5c9952['model'],qs[_0xc79a('0x30')](_0x2064cc[_0xc79a('0x28')][_0xc79a('0x30')]));_0x5935b6[_0xc79a('0x31')]=_0x5935b6[_0xc79a('0x31')][_0xc79a('0x32')]?_0x5935b6[_0xc79a('0x31')]:_0x5c9952['model'];if(_0x2064cc[_0xc79a('0x28')]['includeAll']){_0x5935b6[_0xc79a('0x33')]=[{'all':!![]}];}_0x5935b6=_[_0xc79a('0x34')]({},_0x5935b6,_0x2064cc['options']);return db[_0xc79a('0x23')]['find'](_0x5935b6)[_0xc79a('0x1d')](handleEntityNotFound(_0x5b14f6,null))[_0xc79a('0x1d')](respondWithResult(_0x5b14f6,null))['catch'](handleError(_0x5b14f6,null));};exports[_0xc79a('0x35')]=function(_0x171888,_0x45f31c){return db[_0xc79a('0x23')]['create'](_0x171888['body'],{})[_0xc79a('0x1d')](respondWithResult(_0x45f31c,0xc9))[_0xc79a('0x2a')](handleError(_0x45f31c,null));};exports[_0xc79a('0x1c')]=function(_0x2450a0,_0x7c943c){if(_0x2450a0[_0xc79a('0x36')]['id']){delete _0x2450a0[_0xc79a('0x36')]['id'];}return db[_0xc79a('0x23')]['find']({'where':{'id':_0x2450a0['params']['id']}})['then'](handleEntityNotFound(_0x7c943c,null))[_0xc79a('0x1d')](saveUpdates(_0x2450a0[_0xc79a('0x36')],null))[_0xc79a('0x1d')](respondWithResult(_0x7c943c,null))[_0xc79a('0x2a')](handleError(_0x7c943c,null));};exports[_0xc79a('0x37')]=function(_0x41b308,_0x29bd6c){return db[_0xc79a('0x23')][_0xc79a('0x38')]({'where':{'id':_0x41b308[_0xc79a('0x2c')]['id']}})[_0xc79a('0x1d')](handleEntityNotFound(_0x29bd6c,null))[_0xc79a('0x1d')](removeEntity(_0x29bd6c,null))['catch'](handleError(_0x29bd6c,null));};exports[_0xc79a('0x39')]=function(_0x536600,_0x4d0788){return db[_0xc79a('0x23')][_0xc79a('0x39')]()[_0xc79a('0x1d')](respondWithResult(_0x4d0788,null))[_0xc79a('0x2a')](handleError(_0x4d0788,null));};exports[_0xc79a('0x3a')]=function(_0x35bc89,_0x2c5413){return db[_0xc79a('0x3b')][_0xc79a('0x38')]({'where':{'id':_0x35bc89[_0xc79a('0x2c')]['id']}})[_0xc79a('0x1d')](handleEntityNotFound(_0x2c5413,null))[_0xc79a('0x1d')](function(_0x2f6ed1){if(_0x2f6ed1){return _0x2f6ed1['addMessage'](_0x35bc89[_0xc79a('0x36')]['ids'],_[_0xc79a('0x3c')](_0x35bc89[_0xc79a('0x36')],[_0xc79a('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x2c5413,null))[_0xc79a('0x2a')](handleError(_0x2c5413,null));};exports['getMessages']=function(_0x1a264f,_0xd5031f){var _0x3f0e01={'raw':![],'where':{}};var _0xd32401={};var _0x3553f8={'count':0x0,'rows':[]};return db[_0xc79a('0x23')]['findOne']({'where':{'id':_0x1a264f[_0xc79a('0x2c')]['id']}})['then'](handleEntityNotFound(_0xd5031f,null))[_0xc79a('0x1d')](function(_0x473c93){if(_0x473c93){_0xd32401['model']=_['keys'](db['MailMessage'][_0xc79a('0x24')]);_0xd32401[_0xc79a('0x28')]=_['keys'](_0x1a264f[_0xc79a('0x28')]);_0xd32401[_0xc79a('0x3e')]=_['intersection'](_0xd32401[_0xc79a('0x2d')],_0xd32401[_0xc79a('0x28')]);_0x3f0e01[_0xc79a('0x31')]=_[_0xc79a('0x2f')](_0xd32401[_0xc79a('0x2d')],qs['fields'](_0x1a264f[_0xc79a('0x28')][_0xc79a('0x30')]));_0x3f0e01['attributes']=_0x3f0e01[_0xc79a('0x31')][_0xc79a('0x32')]?_0x3f0e01[_0xc79a('0x31')]:_0xd32401['model'];if(!_0x1a264f['query'][_0xc79a('0x3f')](_0xc79a('0x40'))){_0x3f0e01['limit']=qs[_0xc79a('0x17')](_0x1a264f[_0xc79a('0x28')][_0xc79a('0x17')]);_0x3f0e01[_0xc79a('0x19')]=qs[_0xc79a('0x19')](_0x1a264f['query'][_0xc79a('0x19')]);}_0x3f0e01[_0xc79a('0x41')]=qs[_0xc79a('0x42')](_0x1a264f[_0xc79a('0x28')][_0xc79a('0x42')]);_0x3f0e01[_0xc79a('0x43')]=qs[_0xc79a('0x3e')](_['pick'](_0x1a264f[_0xc79a('0x28')],_0xd32401['filters']));_0x3f0e01[_0xc79a('0x43')][_0xc79a('0x44')]=_0x473c93['id'];if(_0x1a264f[_0xc79a('0x28')][_0xc79a('0x45')]){_0x3f0e01['where']=_['merge'](_0x3f0e01[_0xc79a('0x43')],{'$or':_[_0xc79a('0x22')](_0x3f0e01[_0xc79a('0x31')],function(_0x2ae084){var _0x366dfd={};_0x366dfd[_0x2ae084]={'$like':'%'+_0x1a264f['query'][_0xc79a('0x45')]+'%'};return _0x366dfd;})});}if(_0x1a264f[_0xc79a('0x28')]['$gte']){var _0x5beee0=_0x1a264f[_0xc79a('0x28')][_0xc79a('0x46')][_0xc79a('0x47')](',');var _0x3a1454={};_0x3a1454[_0x5beee0[0x0]]={'$gte':moment(_0x5beee0[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3f0e01['where']=_[_0xc79a('0x34')](_0x3f0e01[_0xc79a('0x43')],_0x3a1454);}_0x3f0e01=_[_0xc79a('0x34')]({},_0x3f0e01,_0x1a264f['options']);return db[_0xc79a('0x3b')][_0xc79a('0x18')]({'where':_0x3f0e01[_0xc79a('0x43')]})[_0xc79a('0x1d')](function(_0x5a7e27){_0x3553f8['count']=_0x5a7e27;if(_0x1a264f['query'][_0xc79a('0x48')]){_0x3f0e01[_0xc79a('0x33')]=[{'all':!![]}];}return db[_0xc79a('0x3b')][_0xc79a('0x27')](_0x3f0e01);})[_0xc79a('0x1d')](function(_0x1dd05e){if(_0x1a264f['query'][_0xc79a('0x49')]===_0xc79a('0x4a')){for(var _0x2e71f3=0x0;_0x2e71f3<_0x1dd05e[_0xc79a('0x32')];_0x2e71f3++){_0x1dd05e[_0x2e71f3]['body']=juice(_0x1dd05e[_0x2e71f3][_0xc79a('0x36')]);}}_0x3553f8[_0xc79a('0x4b')]=_0x1dd05e;return _0x3553f8;});}})[_0xc79a('0x1d')](respondWithFilteredResult(_0xd5031f,_0x3f0e01))[_0xc79a('0x2a')](handleError(_0xd5031f,null));};exports[_0xc79a('0x4c')]=function(_0x1936d6,_0x129935){return db[_0xc79a('0x23')][_0xc79a('0x38')]({'where':{'id':_0x1936d6[_0xc79a('0x2c')]['id']}})['then'](handleEntityNotFound(_0x129935,null))[_0xc79a('0x1d')](function(_0x2746aa){if(_0x2746aa){return _0x2746aa[_0xc79a('0x4d')](_0x1936d6['body']['ids'],_[_0xc79a('0x3c')](_0x1936d6['body'],[_0xc79a('0x3d'),'id'])||{})[_0xc79a('0x4e')](function(){return db[_0xc79a('0x4f')]['findAll']({'attributes':['id',_0xc79a('0x20'),_0xc79a('0x50')],'where':{'id':_0x1936d6[_0xc79a('0x36')][_0xc79a('0x3d')]}});})[_0xc79a('0x1d')](function(_0x68949d){socket[_0xc79a('0x51')](_0xc79a('0x52'),{'id':Number(_0x1936d6[_0xc79a('0x2c')]['id']),'tags':_0x68949d||[]});return{'id':Number(_0x1936d6[_0xc79a('0x2c')]['id']),'tags':_0x68949d||[]};});}})['then'](respondWithResult(_0x129935,null))['catch'](handleError(_0x129935,null));};exports['removeTags']=function(_0x25687e,_0xa0577a){return db[_0xc79a('0x23')][_0xc79a('0x38')]({'where':{'id':_0x25687e[_0xc79a('0x2c')]['id']}})[_0xc79a('0x1d')](handleEntityNotFound(_0xa0577a,null))['then'](function(_0x57a02e){if(_0x57a02e){return _0x57a02e[_0xc79a('0x53')](_0x25687e[_0xc79a('0x28')][_0xc79a('0x3d')]);}})['then'](respondWithStatusCode(_0xa0577a,null))[_0xc79a('0x2a')](handleError(_0xa0577a,null));};exports[_0xc79a('0x54')]=function(_0x2f9432,_0x1f2044){var _0x5cf89d=moment()['unix']()[_0xc79a('0x55')]();var _0xd72530=path[_0xc79a('0x56')](config[_0xc79a('0x57')],_0xc79a('0x58'),'files',_0xc79a('0x59'));var _0x242471=path['join'](config['root'],'server',_0xc79a('0x5a'),_0xc79a('0x5b'));var _0x2a90ef=path[_0xc79a('0x56')](_0xd72530,_0x5cf89d);var _0x23f519=util[_0xc79a('0x5c')](_0xc79a('0x5d'),_0x2f9432[_0xc79a('0x2c')]['id'],_0x5cf89d);var _0x5ccd25=path['join'](_0xd72530,_0x23f519);var _0x3f256c=[];if(_0x2f9432['query'][_0xc79a('0x5b')]){_0x3f256c[_0xc79a('0x5e')]({'model':db['Attachment'],'as':_0xc79a('0x5f'),'raw':!![]});}var _0x5689f9=[{'model':db[_0xc79a('0x3b')],'as':_0xc79a('0x60'),'attributes':['id','body','from','to','cc',_0xc79a('0x61'),_0xc79a('0x62'),_0xc79a('0x63')],'where':{'secret':![]},'order':qs[_0xc79a('0x42')]('id'),'include':_0x3f256c}];return db[_0xc79a('0x23')][_0xc79a('0x38')]({'where':{'id':_0x2f9432[_0xc79a('0x2c')]['id']},'include':_0x5689f9})[_0xc79a('0x1d')](handleEntityNotFound(_0x1f2044,null))[_0xc79a('0x1d')](function(_0x5818bd){if(_0x5818bd&&_0x5818bd[_0xc79a('0x60')]){var _0x3ac1ae=_0x5818bd[_0xc79a('0x64')]({'plain':!![]});fs[_0xc79a('0x65')](_0x2a90ef);return BPromise['each'](_0x3ac1ae[_0xc79a('0x60')],function(_0x3c2f20,_0x3edf5a){var _0x593672={'from':_0x3c2f20[_0xc79a('0x66')],'to':_0x3c2f20['to']||_0xc79a('0x67'),'subject':_0x3c2f20[_0xc79a('0x62')],'html':htmlEntities[_0xc79a('0x68')](_0x3c2f20[_0xc79a('0x36')]),'headers':{'Date':moment(_0x3c2f20['createdAt'])[_0xc79a('0x5c')](_0xc79a('0x69'))},'attachments':[]};if(_0x3c2f20['cc']){_0x593672['headers']['Cc']=_0x3c2f20['cc'];}if(_0x3c2f20[_0xc79a('0x61')]){_0x593672[_0xc79a('0x6a')][_0xc79a('0x6b')]=_0x3c2f20[_0xc79a('0x61')];}return new BPromise(function(_0x3a2d3f,_0x5b131a){if(_0x3c2f20[_0xc79a('0x5f')]){for(var _0x250f91=0x0;_0x250f91<_0x3c2f20['Attachments'][_0xc79a('0x32')];_0x250f91++){var _0x132df2=_0x3c2f20[_0xc79a('0x5f')][_0x250f91];var _0x1a19f6=path[_0xc79a('0x56')](_0x242471,_0x132df2[_0xc79a('0x6c')]);if(fs[_0xc79a('0x6d')](_0x1a19f6)){_0x593672[_0xc79a('0x5b')]['push']({'name':_0x132df2['name'],'contentType':_0x132df2[_0xc79a('0x6e')],'data':fs['readFileSync'](_0x1a19f6)});}}}emlformat['build'](_0x593672,function(_0x2a9872,_0x2e99cb){if(_0x2a9872)return _0x5b131a(_0x2a9872);fs[_0xc79a('0x6f')](path['join'](_0x2a90ef,util[_0xc79a('0x5c')]('message%d.eml',_0x3edf5a)),_0x2e99cb);return _0x3a2d3f(_0x2e99cb);});});})[_0xc79a('0x1d')](function(){return new BPromise(function(_0x539268,_0x3ba9e1){zipdir(_0x2a90ef,{'saveTo':_0x5ccd25},function(_0x93c902,_0x5ed9ed){if(_0x93c902)return _0x3ba9e1(_0x93c902);return _0x539268(_0x5ed9ed);});})[_0xc79a('0x1d')](function(){return new BPromise(function(_0x1ec195,_0x49c84d){rimraf(_0x2a90ef,function(_0x8b5be6){if(_0x8b5be6)_0x49c84d(_0x8b5be6);return _0x1ec195();});});})[_0xc79a('0x1d')](function(){return _0x1f2044[_0xc79a('0x54')](_0x5ccd25,_0x23f519,function(_0x2753fe){if(!_0x2753fe)fs[_0xc79a('0x70')](_0x5ccd25);});});});}else{return _0x1f2044[_0xc79a('0x12')](0xc8);}})[_0xc79a('0x2a')](handleError(_0x1f2044,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 4788085..a333a91 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 _0x40a6=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','save','remove','getUsers','then','Users','map','findAll','unreadMessages'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x40a6,0xc7));var _0x640a=function(_0x575179,_0x52210c){_0x575179=_0x575179-0x0;var _0x50462=_0x40a6[_0x575179];return _0x50462;};'use strict';var EventEmitter=require(_0x640a('0x0'));var MailInteraction=require(_0x640a('0x1'))['db'][_0x640a('0x2')];var MailMessage=require(_0x640a('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x640a('0x3'),'afterUpdate':'update','afterDestroy':_0x640a('0x4')};function emitEvent(_0x3b2075){return function(_0x4d2cda,_0x855aef,_0x2c5311){_0x4d2cda[_0x640a('0x5')]({'attributes':['id'],'raw':!![]})[_0x640a('0x6')](function(_0x2006cf){_0x4d2cda['setDataValue'](_0x640a('0x7'),_0x2006cf[_0x640a('0x8')](function(_0x2f81de){return{'id':_0x2f81de['id']};}));return MailMessage[_0x640a('0x9')]({'where':{'MailInteractionId':_0x4d2cda['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3e6ee2){_0x4d2cda['setDataValue'](_0x640a('0xa'),_0x3e6ee2['length']);MailInteractionEvents[_0x640a('0xb')](_0x3b2075+':'+_0x4d2cda['id'],_0x4d2cda);MailInteractionEvents[_0x640a('0xb')](_0x3b2075,_0x4d2cda);_0x2c5311(null);})[_0x640a('0xc')](_0x2c5311(null));};}for(var e in events){if(events[_0x640a('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x640a('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x2f3a=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x170310,_0x31acf9){var _0x1b6006=function(_0x294e50){while(--_0x294e50){_0x170310['push'](_0x170310['shift']());}};_0x1b6006(++_0x31acf9);}(_0x2f3a,0x7d));var _0xa2f3=function(_0x21c7d8,_0x594e61){_0x21c7d8=_0x21c7d8-0x0;var _0x5c71ab=_0x2f3a[_0x21c7d8];return _0x5c71ab;};'use strict';var EventEmitter=require(_0xa2f3('0x0'));var MailInteraction=require(_0xa2f3('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xa2f3('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa2f3('0x3')](0x0);var events={'afterCreate':_0xa2f3('0x4'),'afterUpdate':_0xa2f3('0x5'),'afterDestroy':_0xa2f3('0x6')};function emitEvent(_0x430a7d){return function(_0x4cf752,_0x5600c4,_0x1c44fb){_0x4cf752['getUsers']({'attributes':['id'],'raw':!![]})[_0xa2f3('0x7')](function(_0x4e94fe){_0x4cf752[_0xa2f3('0x8')]('Users',_0x4e94fe[_0xa2f3('0x9')](function(_0x21c66e){return{'id':_0x21c66e['id']};}));return MailMessage[_0xa2f3('0xa')]({'where':{'MailInteractionId':_0x4cf752['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa2f3('0x7')](function(_0x1dc19e){_0x4cf752[_0xa2f3('0x8')](_0xa2f3('0xb'),_0x1dc19e[_0xa2f3('0xc')]);MailInteractionEvents[_0xa2f3('0xd')](_0x430a7d+':'+_0x4cf752['id'],_0x4cf752);MailInteractionEvents['emit'](_0x430a7d,_0x4cf752);_0x1c44fb(null);})[_0xa2f3('0xe')](_0x1c44fb(null));};}for(var e in events){if(events[_0xa2f3('0xf')](e)){var event=events[e];MailInteraction[_0xa2f3('0x10')](e,emitEvent(event));}}module[_0xa2f3('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 6287fca..db04ffe 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 _0xacf2=['request-promise','rimraf','../../config/environment','define','mail_interactions','fti_mail_interactions','FULLTEXT','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatus','substatusAt','models','get','MailMessage','update','then','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0xacf2,0x127));var _0x2acf=function(_0x151553,_0x295f9c){_0x151553=_0x151553-0x0;var _0x1a0ad6=_0xacf2[_0x151553];return _0x1a0ad6;};'use strict';var _=require('lodash');var util=require(_0x2acf('0x0'));var logger=require(_0x2acf('0x1'))(_0x2acf('0x2'));var moment=require(_0x2acf('0x3'));var BPromise=require(_0x2acf('0x4'));var rp=require(_0x2acf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2acf('0x6'));var config=require(_0x2acf('0x7'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x2f0cb7,_0x3cb69b){return _0x2f0cb7[_0x2acf('0x8')]('MailInteraction',attributes,{'tableName':_0x2acf('0x9'),'paranoid':![],'indexes':[{'name':_0x2acf('0xa'),'fields':['subject','to'],'type':_0x2acf('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e0070,_0x2f46e7,_0x136c49){if(_0x1e0070['substatus']){_0x1e0070['substatusAt']=moment()['format'](_0x2acf('0xc'));}if(_0x1e0070[_0x2acf('0xd')]){_0x1e0070[_0x2acf('0xe')]=moment()[_0x2acf('0xf')](_0x2acf('0xc'));}_0x136c49(null,_0x2f46e7);},'beforeUpdate':function(_0x28e68e,_0x10dee9,_0xe0af36){if(_0x28e68e['changed']('substatus')){_0x28e68e['substatusAt']=_0x28e68e['substatus']?moment()[_0x2acf('0xf')](_0x2acf('0xc')):null;}if(_0x28e68e[_0x2acf('0x10')](_0x2acf('0xd'))){_0x28e68e['closedAt']=moment()[_0x2acf('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x28e68e[_0x2acf('0x11')]=null;_0x28e68e[_0x2acf('0x12')]=null;}_0xe0af36(null,_0x28e68e);},'afterUpdate':function(_0x11a76f,_0x37aaa3,_0x244506){var _0x388c96=_0x2f0cb7[_0x2acf('0x13')];var _0x4e764a=_0x11a76f[_0x2acf('0x14')]({'plain':!![]});if(_0x4e764a[_0x2acf('0xd')]){return _0x388c96[_0x2acf('0x15')][_0x2acf('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4e764a['id']}})[_0x2acf('0x17')](function(){_0x244506();})['catch'](function(_0x40c9e6){_0x244506(_0x40c9e6);});}else{_0x244506();}}},'charset':'utf8mb4','collate':_0x2acf('0x18')});}; \ No newline at end of file +var _0x8353=['api','moment','path','../../config/environment','exports','define','mail_interactions','fti_mail_interactions','subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatusAt','models','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x359e72,_0x115705){var _0x192750=function(_0x48c528){while(--_0x48c528){_0x359e72['push'](_0x359e72['shift']());}};_0x192750(++_0x115705);}(_0x8353,0xb5));var _0x3835=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8353[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x3835('0x0'));var util=require(_0x3835('0x1'));var logger=require(_0x3835('0x2'))(_0x3835('0x3'));var moment=require(_0x3835('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3835('0x5'));var rimraf=require('rimraf');var config=require(_0x3835('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x3835('0x7')]=function(_0x5bf290,_0x5db348){return _0x5bf290[_0x3835('0x8')]('MailInteraction',attributes,{'tableName':_0x3835('0x9'),'paranoid':![],'indexes':[{'name':_0x3835('0xa'),'fields':[_0x3835('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3133be,_0x938d40,_0x513247){if(_0x3133be[_0x3835('0xc')]){_0x3133be['substatusAt']=moment()[_0x3835('0xd')](_0x3835('0xe'));}if(_0x3133be[_0x3835('0xf')]){_0x3133be['closedAt']=moment()[_0x3835('0xd')](_0x3835('0xe'));}_0x513247(null,_0x938d40);},'beforeUpdate':function(_0x1926f4,_0x339a11,_0x97811c){if(_0x1926f4['changed']('substatus')){_0x1926f4['substatusAt']=_0x1926f4[_0x3835('0xc')]?moment()[_0x3835('0xd')](_0x3835('0xe')):null;}if(_0x1926f4[_0x3835('0x10')](_0x3835('0xf'))){_0x1926f4['closedAt']=moment()['format'](_0x3835('0xe'));_0x1926f4[_0x3835('0xc')]=null;_0x1926f4[_0x3835('0x11')]=null;}_0x97811c(null,_0x1926f4);},'afterUpdate':function(_0xad04c8,_0x2b607f,_0x483e3d){var _0x258727=_0x5bf290[_0x3835('0x12')];var _0x24b4ea=_0xad04c8['get']({'plain':!![]});if(_0x24b4ea[_0x3835('0xf')]){return _0x258727[_0x3835('0x13')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x24b4ea['id']}})[_0x3835('0x14')](function(){_0x483e3d();})['catch'](function(_0x7d3885){_0x483e3d(_0x7d3885);});}else{_0x483e3d();}}},'charset':_0x3835('0x15'),'collate':_0x3835('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 99b4ac7..ea22cde 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 _0xaae7=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xaae7,0xa8));var _0x7aae=function(_0x48e722,_0x4cbf5e){_0x48e722=_0x48e722-0x0;var _0x140b3b=_0xaae7[_0x48e722];return _0x140b3b;};'use strict';var _=require(_0x7aae('0x0'));var util=require(_0x7aae('0x1'));var moment=require(_0x7aae('0x2'));var BPromise=require(_0x7aae('0x3'));var rs=require(_0x7aae('0x4'));var fs=require('fs');var Redis=require(_0x7aae('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7aae('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7aae('0x7'));var jayson=require(_0x7aae('0x8'));var client=jayson[_0x7aae('0x9')][_0x7aae('0xa')]({'port':0x232a});config[_0x7aae('0xb')]=_[_0x7aae('0xc')](config[_0x7aae('0xb')],{'host':_0x7aae('0xd'),'port':0x18eb});var socket=require(_0x7aae('0xe'))(new Redis(config['redis']));require(_0x7aae('0xf'))['register'](socket);function respondWithRpcPromise(_0x1217c5,_0x516d37,_0x28c2e0){return new BPromise(function(_0x11a1c3,_0x8747e0){return client[_0x7aae('0x10')](_0x1217c5,_0x28c2e0)['then'](function(_0x43811b){logger[_0x7aae('0x11')](_0x7aae('0x12'),_0x516d37,'request\x20sent');logger[_0x7aae('0x13')](_0x7aae('0x14'),_0x516d37,_0x7aae('0x15'),JSON[_0x7aae('0x16')](_0x43811b));if(_0x43811b[_0x7aae('0x17')]){if(_0x43811b[_0x7aae('0x17')][_0x7aae('0x18')]===0x1f4){logger[_0x7aae('0x17')](_0x7aae('0x12'),_0x516d37,_0x43811b[_0x7aae('0x17')]['message']);return _0x8747e0(_0x43811b[_0x7aae('0x17')][_0x7aae('0x19')]);}logger['error'](_0x7aae('0x12'),_0x516d37,_0x43811b[_0x7aae('0x17')][_0x7aae('0x19')]);return _0x11a1c3(_0x43811b[_0x7aae('0x17')][_0x7aae('0x19')]);}else{logger[_0x7aae('0x11')](_0x7aae('0x12'),_0x516d37,'request\x20sent');_0x11a1c3(_0x43811b['result'][_0x7aae('0x19')]);}})[_0x7aae('0x1a')](function(_0x1a9cb9){logger[_0x7aae('0x17')](_0x7aae('0x12'),_0x516d37,_0x1a9cb9);_0x8747e0(_0x1a9cb9);});});}exports[_0x7aae('0x1b')]=function(_0x466f6f){var _0x40b67d=this;return new Promise(function(_0x2a4231,_0x3d07bc){return db[_0x7aae('0x1c')][_0x7aae('0x1d')](_0x466f6f[_0x7aae('0x1e')],{'raw':_0x466f6f[_0x7aae('0x1f')]?_0x466f6f[_0x7aae('0x1f')][_0x7aae('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466f6f[_0x7aae('0x1f')]?_0x466f6f[_0x7aae('0x1f')][_0x7aae('0x21')]||null:null,'attributes':_0x466f6f[_0x7aae('0x1f')]?_0x466f6f[_0x7aae('0x1f')][_0x7aae('0x22')]||null:null,'limit':_0x466f6f[_0x7aae('0x1f')]?_0x466f6f[_0x7aae('0x1f')][_0x7aae('0x23')]||null:null})[_0x7aae('0x24')](function(_0x11b3f4){logger[_0x7aae('0x11')](_0x7aae('0x1b'),_0x466f6f);logger[_0x7aae('0x13')](_0x7aae('0x1b'),_0x466f6f,JSON[_0x7aae('0x16')](_0x11b3f4));_0x2a4231(_0x11b3f4);})['catch'](function(_0x1f830d){logger[_0x7aae('0x17')](_0x7aae('0x1b'),_0x1f830d['message'],_0x466f6f);_0x3d07bc(_0x40b67d[_0x7aae('0x17')](0x1f4,_0x1f830d['message']));});});};exports[_0x7aae('0x25')]=function(_0x301e23){return new Promise(function(_0x33034e,_0x8f16b5){return db[_0x7aae('0x1c')]['find']({'where':_0x301e23[_0x7aae('0x1f')]?_0x301e23['options'][_0x7aae('0x21')]||null:null})[_0x7aae('0x24')](function(_0x9ed567){if(_0x9ed567){return _0x9ed567[_0x7aae('0x26')](_0x301e23[_0x7aae('0x1e')][_0x7aae('0x27')],_[_0x7aae('0x28')](_0x301e23[_0x7aae('0x1e')],[_0x7aae('0x27'),'id'])||{});}})[_0x7aae('0x29')](function(_0x341d50){logger[_0x7aae('0x11')](_0x7aae('0x2a'),_0x301e23);logger[_0x7aae('0x13')](_0x7aae('0x2a'),_0x301e23,JSON['stringify'](_0x341d50));_0x33034e(_0x341d50);})['catch'](function(_0x15f1b8){logger[_0x7aae('0x17')](_0x7aae('0x2a'),_0x15f1b8[_0x7aae('0x19')],_0x301e23);_0x8f16b5(_this[_0x7aae('0x17')](0x1f4,_0x15f1b8['message']));});});}; \ No newline at end of file +var _0xef96=['UpdateMailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message','catch'];(function(_0x168bee,_0x3e9972){var _0xdaf476=function(_0x451aa5){while(--_0x451aa5){_0x168bee['push'](_0x168bee['shift']());}};_0xdaf476(++_0x3e9972);}(_0xef96,0x162));var _0x6ef9=function(_0x4b4401,_0x71b9ed){_0x4b4401=_0x4b4401-0x0;var _0x143545=_0xef96[_0x4b4401];return _0x143545;};'use strict';var _=require(_0x6ef9('0x0'));var util=require(_0x6ef9('0x1'));var moment=require(_0x6ef9('0x2'));var BPromise=require(_0x6ef9('0x3'));var rs=require(_0x6ef9('0x4'));var fs=require('fs');var Redis=require(_0x6ef9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ef9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ef9('0x7'));var client=jayson[_0x6ef9('0x8')][_0x6ef9('0x9')]({'port':0x232a});config['redis']=_[_0x6ef9('0xa')](config['redis'],{'host':_0x6ef9('0xb'),'port':0x18eb});var socket=require(_0x6ef9('0xc'))(new Redis(config[_0x6ef9('0xd')]));require('./mailInteraction.socket')[_0x6ef9('0xe')](socket);function respondWithRpcPromise(_0x4ccb23,_0xb9346c,_0x418b1d){return new BPromise(function(_0x46734b,_0x5aee3b){return client[_0x6ef9('0xf')](_0x4ccb23,_0x418b1d)[_0x6ef9('0x10')](function(_0xcee555){logger[_0x6ef9('0x11')]('MailInteraction,\x20%s,\x20%s',_0xb9346c,_0x6ef9('0x12'));logger[_0x6ef9('0x13')](_0x6ef9('0x14'),_0xb9346c,_0x6ef9('0x12'),JSON[_0x6ef9('0x15')](_0xcee555));if(_0xcee555[_0x6ef9('0x16')]){if(_0xcee555[_0x6ef9('0x16')]['code']===0x1f4){logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);return _0x5aee3b(_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);}logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0xcee555[_0x6ef9('0x16')]['message']);return _0x46734b(_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0xb9346c,_0x6ef9('0x12'));_0x46734b(_0xcee555['result'][_0x6ef9('0x18')]);}})[_0x6ef9('0x19')](function(_0x9b792d){logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0x9b792d);_0x5aee3b(_0x9b792d);});});}exports[_0x6ef9('0x1a')]=function(_0x493cdd){var _0x56fabb=this;return new Promise(function(_0x1ac999,_0x243de4){return db['MailInteraction'][_0x6ef9('0x1b')](_0x493cdd[_0x6ef9('0x1c')],{'raw':_0x493cdd[_0x6ef9('0x1d')]?_0x493cdd[_0x6ef9('0x1d')][_0x6ef9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493cdd[_0x6ef9('0x1d')]?_0x493cdd[_0x6ef9('0x1d')]['where']||null:null,'attributes':_0x493cdd['options']?_0x493cdd[_0x6ef9('0x1d')][_0x6ef9('0x1f')]||null:null,'limit':_0x493cdd['options']?_0x493cdd['options'][_0x6ef9('0x20')]||null:null})['then'](function(_0x19a6c5){logger[_0x6ef9('0x11')](_0x6ef9('0x1a'),_0x493cdd);logger[_0x6ef9('0x13')](_0x6ef9('0x1a'),_0x493cdd,JSON[_0x6ef9('0x15')](_0x19a6c5));_0x1ac999(_0x19a6c5);})[_0x6ef9('0x19')](function(_0x4f6c85){logger[_0x6ef9('0x16')]('UpdateMailInteraction',_0x4f6c85[_0x6ef9('0x18')],_0x493cdd);_0x243de4(_0x56fabb[_0x6ef9('0x16')](0x1f4,_0x4f6c85[_0x6ef9('0x18')]));});});};exports[_0x6ef9('0x21')]=function(_0x351dce){return new Promise(function(_0x205b74,_0x212d32){return db['MailInteraction']['find']({'where':_0x351dce['options']?_0x351dce['options']['where']||null:null})[_0x6ef9('0x10')](function(_0x4fa37c){if(_0x4fa37c){return _0x4fa37c[_0x6ef9('0x22')](_0x351dce['body'][_0x6ef9('0x23')],_[_0x6ef9('0x24')](_0x351dce[_0x6ef9('0x1c')],[_0x6ef9('0x23'),'id'])||{});}})['spread'](function(_0x545bad){logger[_0x6ef9('0x11')](_0x6ef9('0x25'),_0x351dce);logger['debug'](_0x6ef9('0x25'),_0x351dce,JSON['stringify'](_0x545bad));_0x205b74(_0x545bad);})[_0x6ef9('0x19')](function(_0x20bde7){logger[_0x6ef9('0x16')]('AddTags',_0x20bde7[_0x6ef9('0x18')],_0x351dce);_0x212d32(_this[_0x6ef9('0x16')](0x1f4,_0x20bde7['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 83b9bc8..b1746fb 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 _0x2e22=['length','mailInteraction:','./mailInteraction.events','save','remove','removeListener','register'];(function(_0x179f83,_0x211ea6){var _0x32980c=function(_0x51f794){while(--_0x51f794){_0x179f83['push'](_0x179f83['shift']());}};_0x32980c(++_0x211ea6);}(_0x2e22,0x128));var _0x22e2=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x2e22[_0xbc1a4b];return _0x108b87;};'use strict';var MailInteractionEvents=require(_0x22e2('0x0'));var events=[_0x22e2('0x1'),_0x22e2('0x2'),'update'];function createListener(_0x3e94ec,_0x33aeff){return function(_0x44be94){_0x33aeff['emit'](_0x3e94ec,_0x44be94);};}function removeListener(_0x266b45,_0x24f3d){return function(){MailInteractionEvents[_0x22e2('0x3')](_0x266b45,_0x24f3d);};}exports[_0x22e2('0x4')]=function(_0x46e163){for(var _0x3162b6=0x0,_0x43f6bd=events[_0x22e2('0x5')];_0x3162b6<_0x43f6bd;_0x3162b6++){var _0x3a4b16=events[_0x3162b6];var _0x318a51=createListener(_0x22e2('0x6')+_0x3a4b16,_0x46e163);MailInteractionEvents['on'](_0x3a4b16,_0x318a51);}}; \ No newline at end of file +var _0xc615=['save','remove','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x1dd8a4,_0x57f9a){var _0x13fb51=function(_0x2d86d9){while(--_0x2d86d9){_0x1dd8a4['push'](_0x1dd8a4['shift']());}};_0x13fb51(++_0x57f9a);}(_0xc615,0x1a0));var _0x5c61=function(_0x40597a,_0x30410d){_0x40597a=_0x40597a-0x0;var _0x423296=_0xc615[_0x40597a];return _0x423296;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x5c61('0x0'),_0x5c61('0x1'),_0x5c61('0x2')];function createListener(_0x263d4d,_0x2e43fe){return function(_0x34068c){_0x2e43fe[_0x5c61('0x3')](_0x263d4d,_0x34068c);};}function removeListener(_0x266625,_0x58b030){return function(){MailInteractionEvents[_0x5c61('0x4')](_0x266625,_0x58b030);};}exports[_0x5c61('0x5')]=function(_0x36353e){for(var _0xbcc2a8=0x0,_0x7cf506=events[_0x5c61('0x6')];_0xbcc2a8<_0x7cf506;_0xbcc2a8++){var _0x104e13=events[_0xbcc2a8];var _0x66a627=createListener(_0x5c61('0x7')+_0x104e13,_0x36353e);MailInteractionEvents['on'](_0x104e13,_0x66a627);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9bfd511..d634d04 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 _0xceb0=['../../components/interaction/service','get','isAuthenticated','index','/describe','show','download','post','tracked','mail','mailmessage:create','put','/:id','update','/:id/accept','reject','delete','destroy','exports','express','fs-extra','../../components/auth/service'];(function(_0xce58c9,_0x5e10ab){var _0x55cd1c=function(_0x50d18c){while(--_0x50d18c){_0xce58c9['push'](_0xce58c9['shift']());}};_0x55cd1c(++_0x5e10ab);}(_0xceb0,0x173));var _0x0ceb=function(_0x2cdff7,_0x16f6dd){_0x2cdff7=_0x2cdff7-0x0;var _0x7485b3=_0xceb0[_0x2cdff7];return _0x7485b3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ceb('0x0'));var router=express['Router']();var fs_extra=require(_0x0ceb('0x1'));var auth=require(_0x0ceb('0x2'));var interaction=require(_0x0ceb('0x3'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x0ceb('0x4')]('/',auth[_0x0ceb('0x5')](),controller[_0x0ceb('0x6')]);router['get'](_0x0ceb('0x7'),auth[_0x0ceb('0x5')](),controller['describe']);router[_0x0ceb('0x4')]('/:id',auth[_0x0ceb('0x5')](),controller[_0x0ceb('0x8')]);router[_0x0ceb('0x4')]('/:id/download',auth['isAuthenticated'](),controller[_0x0ceb('0x9')]);router[_0x0ceb('0xa')]('/',auth[_0x0ceb('0x5')](),interaction[_0x0ceb('0xb')](_0x0ceb('0xc'),_0x0ceb('0xd')),controller['create']);router[_0x0ceb('0xe')](_0x0ceb('0xf'),auth[_0x0ceb('0x5')](),controller[_0x0ceb('0x10')]);router[_0x0ceb('0xe')](_0x0ceb('0x11'),auth[_0x0ceb('0x5')](),controller['accept']);router[_0x0ceb('0xe')]('/:id/reject',auth['isAuthenticated'](),controller[_0x0ceb('0x12')]);router[_0x0ceb('0x13')](_0x0ceb('0xf'),auth['isAuthenticated'](),controller[_0x0ceb('0x14')]);module[_0x0ceb('0x15')]=router; \ No newline at end of file +var _0xadb4=['/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','download','post','tracked','mail','create','put'];(function(_0x446027,_0x4366cf){var _0x59cc01=function(_0x4a1f49){while(--_0x4a1f49){_0x446027['push'](_0x446027['shift']());}};_0x59cc01(++_0x4366cf);}(_0xadb4,0x1b6));var _0x4adb=function(_0x2d4709,_0x58e9e4){_0x2d4709=_0x2d4709-0x0;var _0x3f7d4a=_0xadb4[_0x2d4709];return _0x3f7d4a;};'use strict';var multer=require(_0x4adb('0x0'));var util=require(_0x4adb('0x1'));var path=require('path');var timeout=require(_0x4adb('0x2'));var express=require(_0x4adb('0x3'));var router=express[_0x4adb('0x4')]();var fs_extra=require(_0x4adb('0x5'));var auth=require(_0x4adb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4adb('0x7'));var controller=require(_0x4adb('0x8'));router[_0x4adb('0x9')]('/',auth[_0x4adb('0xa')](),controller['index']);router[_0x4adb('0x9')](_0x4adb('0xb'),auth[_0x4adb('0xa')](),controller[_0x4adb('0xc')]);router[_0x4adb('0x9')](_0x4adb('0xd'),auth['isAuthenticated'](),controller[_0x4adb('0xe')]);router[_0x4adb('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x4adb('0xf')]);router[_0x4adb('0x10')]('/',auth[_0x4adb('0xa')](),interaction[_0x4adb('0x11')](_0x4adb('0x12'),'mailmessage:create'),controller[_0x4adb('0x13')]);router[_0x4adb('0x14')](_0x4adb('0xd'),auth[_0x4adb('0xa')](),controller['update']);router[_0x4adb('0x14')](_0x4adb('0x15'),auth[_0x4adb('0xa')](),controller[_0x4adb('0x16')]);router['put'](_0x4adb('0x17'),auth[_0x4adb('0xa')](),controller[_0x4adb('0x18')]);router[_0x4adb('0x19')]('/:id',auth[_0x4adb('0xa')](),controller['destroy']);module[_0x4adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index e60425f..eb18851 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 _0xb722=['Email','Chat','sequelize','lodash','long','TEXT','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x4d7056,_0x41cdd8){var _0x2afa2e=function(_0x3a796a){while(--_0x3a796a){_0x4d7056['push'](_0x4d7056['shift']());}};_0x2afa2e(++_0x41cdd8);}(_0xb722,0xda));var _0x2b72=function(_0x5d1122,_0x3d152a){_0x5d1122=_0x5d1122-0x0;var _0x334a52=_0xb722[_0x5d1122];return _0x334a52;};'use strict';var Sequelize=require(_0x2b72('0x0'));var _=require(_0x2b72('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2b72('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2b72('0x3')]('medium')},'read':{'type':Sequelize[_0x2b72('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2b72('0x5')]('in','out'),'defaultValue':_0x2b72('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2b72('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2b72('0x3')](_0x2b72('0x2'))},'cc':{'type':Sequelize[_0x2b72('0x3')]('long')},'bcc':{'type':Sequelize[_0x2b72('0x3')](_0x2b72('0x2'))},'subject':{'type':Sequelize[_0x2b72('0x3')]},'sentAt':{'type':Sequelize[_0x2b72('0x8')]},'attach':{'type':Sequelize[_0x2b72('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2b72('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2b72('0x8')]},'originTo':{'type':Sequelize[_0x2b72('0x3')]('long')},'originCc':{'type':Sequelize[_0x2b72('0x3')](_0x2b72('0x2'))},'originChannel':{'type':Sequelize[_0x2b72('0x5')](_0x2b72('0xa'),_0x2b72('0xb')),'defaultValue':_0x2b72('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xdbff=['Chat','lodash','exports','TEXT','ENUM','out','STRING','long','DATE','INTEGER','BOOLEAN','Email'];(function(_0x516510,_0x48f18a){var _0x5c5246=function(_0x3ea365){while(--_0x3ea365){_0x516510['push'](_0x516510['shift']());}};_0x5c5246(++_0x48f18a);}(_0xdbff,0x151));var _0xfdbf=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0xdbff[_0x4bb145];return _0x4db596;};'use strict';var Sequelize=require('sequelize');var _=require(_0xfdbf('0x0'));module[_0xfdbf('0x1')]={'body':{'type':Sequelize[_0xfdbf('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfdbf('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfdbf('0x3')]('in','out'),'defaultValue':_0xfdbf('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfdbf('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xfdbf('0x2')]('long')},'cc':{'type':Sequelize[_0xfdbf('0x2')](_0xfdbf('0x6'))},'bcc':{'type':Sequelize[_0xfdbf('0x2')]('long')},'subject':{'type':Sequelize[_0xfdbf('0x2')]},'sentAt':{'type':Sequelize[_0xfdbf('0x7')]},'attach':{'type':Sequelize[_0xfdbf('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfdbf('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfdbf('0x7')]},'originTo':{'type':Sequelize[_0xfdbf('0x2')](_0xfdbf('0x6'))},'originCc':{'type':Sequelize['TEXT'](_0xfdbf('0x6'))},'originChannel':{'type':Sequelize[_0xfdbf('0x3')](_0xfdbf('0xa'),_0xfdbf('0xb')),'defaultValue':_0xfdbf('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 7cb1523..f57d4c8 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 _0x5059=['Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','moment','bluebird','util','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','status','json','offset','undefined','limit','count','update','destroy','end','sendStatus','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','MailMessage','include','rows','show','params','includeAll','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','defaults','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','fullname','motionChannel','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','subject','createdAt'];(function(_0x4ffcad,_0x2ab220){var _0x4d9876=function(_0x3d19bc){while(--_0x3d19bc){_0x4ffcad['push'](_0x4ffcad['shift']());}};_0x4d9876(++_0x2ab220);}(_0x5059,0x1e2));var _0x9505=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x5059[_0x2aa48b];return _0x48caf8;};'use strict';var emlformat=require('eml-format');var moment=require(_0x9505('0x0'));var BPromise=require(_0x9505('0x1'));var util=require(_0x9505('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x9505('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x9505('0x4'));var qs=require(_0x9505('0x5'));var logger=require(_0x9505('0x6'))(_0x9505('0x7'));var interaction_log=require(_0x9505('0x6'))('mail-interactions');var config=require(_0x9505('0x8'));var db=require(_0x9505('0x9'))['db'];config[_0x9505('0xa')]=_['defaults'](config['redis'],{'host':_0x9505('0xb'),'port':0x18eb});var socket=require(_0x9505('0xc'))(new Redis(config['redis']));var htmlEntities=require(_0x9505('0xd'));require('./mailMessage.socket')[_0x9505('0xe')](socket);var jayson=require(_0x9505('0xf'));var client=jayson[_0x9505('0x10')][_0x9505('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x9505('0x11')]({'port':0x232b});var client9002=jayson[_0x9505('0x10')][_0x9505('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x32b02c,_0x1b4b2d,_0x162912,_0x586378){return new BPromise(function(_0x646b18,_0x37c203){var _0x50a571=_0x586378||client;return _0x50a571[_0x9505('0x12')](_0x32b02c,_0x162912)[_0x9505('0x13')](function(_0x2b5868){logger[_0x9505('0x14')](_0x9505('0x15'),_0x1b4b2d,_0x9505('0x16'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x1b4b2d,_0x9505('0x16'),JSON['stringify'](_0x2b5868));if(_0x2b5868[_0x9505('0x17')]){if(_0x2b5868[_0x9505('0x17')]['code']===0x1f4){logger[_0x9505('0x17')]('MailMessage,\x20%s,\x20%s',_0x1b4b2d,_0x2b5868[_0x9505('0x17')][_0x9505('0x18')]);return _0x37c203(_0x2b5868[_0x9505('0x17')]['message']);}logger[_0x9505('0x17')](_0x9505('0x15'),_0x1b4b2d,_0x2b5868[_0x9505('0x17')][_0x9505('0x18')]);return _0x646b18(_0x2b5868[_0x9505('0x17')][_0x9505('0x18')]);}else{logger[_0x9505('0x14')](_0x9505('0x15'),_0x1b4b2d,'request\x20sent');_0x646b18(_0x2b5868[_0x9505('0x19')]['message']);}})[_0x9505('0x1a')](function(_0x44b9b0){logger[_0x9505('0x17')](_0x9505('0x15'),_0x1b4b2d,_0x44b9b0);_0x37c203(_0x44b9b0);});});}function respondWithResult(_0xa3dee2,_0x159ddf){_0x159ddf=_0x159ddf||0xc8;return function(_0x10eff3){if(_0x10eff3){return _0xa3dee2[_0x9505('0x1b')](_0x159ddf)[_0x9505('0x1c')](_0x10eff3);}};}function respondWithFilteredResult(_0xcae50f,_0x3c296d){return function(_0xda8bc8){if(_0xda8bc8){var _0x368a13=typeof _0x3c296d[_0x9505('0x1d')]===_0x9505('0x1e')&&typeof _0x3c296d[_0x9505('0x1f')]===_0x9505('0x1e');var _0x47cf8e=_0xda8bc8[_0x9505('0x20')];var _0x4d1a30=_0x368a13?0x0:_0x3c296d[_0x9505('0x1d')];var _0x395584=_0x368a13?_0xda8bc8['count']:_0x3c296d[_0x9505('0x1d')]+_0x3c296d[_0x9505('0x1f')];var _0x219704;if(_0x395584>=_0x47cf8e){_0x395584=_0x47cf8e;_0x219704=0xc8;}else{_0x219704=0xce;}_0xcae50f['status'](_0x219704);return _0xcae50f['set']('Content-Range',_0x4d1a30+'-'+_0x395584+'/'+_0x47cf8e)['json'](_0xda8bc8);}return null;};}function saveUpdates(_0x311247){return function(_0x39b576){if(_0x39b576){return _0x39b576[_0x9505('0x21')](_0x311247)['then'](function(_0x52dc9d){return _0x52dc9d;});}return null;};}function removeEntity(_0x560877){return function(_0x5b451e){if(_0x5b451e){return _0x5b451e[_0x9505('0x22')]()['then'](function(){_0x560877['status'](0xcc)[_0x9505('0x23')]();});}};}function handleEntityNotFound(_0x1dd380){return function(_0x38b773){if(!_0x38b773){_0x1dd380[_0x9505('0x24')](0x194);}return _0x38b773;};}function handleError(_0x303555,_0x40a53b){_0x40a53b=_0x40a53b||0x1f4;return function(_0x3b6120){logger[_0x9505('0x17')](_0x3b6120['stack']);if(_0x3b6120[_0x9505('0x25')]){delete _0x3b6120[_0x9505('0x25')];}_0x303555[_0x9505('0x1b')](_0x40a53b)['send'](_0x3b6120);};}exports[_0x9505('0x26')]=function(_0x53da02,_0x3b17ca){var _0x5d2c15={},_0x11198a={},_0x3ef2b1={'count':0x0,'rows':[]};var _0x309a79=_[_0x9505('0x27')](db['MailMessage'][_0x9505('0x28')],function(_0x4a3f01){return{'name':_0x4a3f01[_0x9505('0x29')],'type':_0x4a3f01[_0x9505('0x2a')][_0x9505('0x2b')]};});_0x11198a[_0x9505('0x2c')]=_['map'](_0x309a79,'name');_0x11198a[_0x9505('0x2d')]=_[_0x9505('0x2e')](_0x53da02[_0x9505('0x2d')]);_0x11198a['filters']=_['intersection'](_0x11198a['model'],_0x11198a[_0x9505('0x2d')]);_0x5d2c15['attributes']=_[_0x9505('0x2f')](_0x11198a['model'],qs[_0x9505('0x30')](_0x53da02[_0x9505('0x2d')]['fields']));_0x5d2c15['attributes']=_0x5d2c15[_0x9505('0x31')][_0x9505('0x32')]?_0x5d2c15[_0x9505('0x31')]:_0x11198a[_0x9505('0x2c')];if(!_0x53da02[_0x9505('0x2d')][_0x9505('0x33')](_0x9505('0x34'))){_0x5d2c15[_0x9505('0x1f')]=qs['limit'](_0x53da02[_0x9505('0x2d')][_0x9505('0x1f')]);_0x5d2c15[_0x9505('0x1d')]=qs[_0x9505('0x1d')](_0x53da02[_0x9505('0x2d')][_0x9505('0x1d')]);}_0x5d2c15[_0x9505('0x35')]=qs['sort'](_0x53da02[_0x9505('0x2d')][_0x9505('0x36')]);_0x5d2c15[_0x9505('0x37')]=qs[_0x9505('0x38')](_[_0x9505('0x39')](_0x53da02[_0x9505('0x2d')],_0x11198a['filters']),_0x309a79);if(_0x53da02['query']['filter']){_0x5d2c15[_0x9505('0x37')]=_['merge'](_0x5d2c15[_0x9505('0x37')],{'$or':_[_0x9505('0x27')](_0x309a79,function(_0xa74d7c){if(_0xa74d7c['type']!==_0x9505('0x3a')){var _0x45d843={};_0x45d843[_0xa74d7c['name']]={'$like':'%'+_0x53da02[_0x9505('0x2d')][_0x9505('0x3b')]+'%'};return _0x45d843;}})});}_0x5d2c15=_[_0x9505('0x3c')]({},_0x5d2c15,_0x53da02[_0x9505('0x3d')]);var _0x101ca5={'where':_0x5d2c15[_0x9505('0x37')]};return db[_0x9505('0x3e')][_0x9505('0x20')](_0x101ca5)[_0x9505('0x13')](function(_0x32eedc){_0x3ef2b1[_0x9505('0x20')]=_0x32eedc;if(_0x53da02[_0x9505('0x2d')]['includeAll']){_0x5d2c15[_0x9505('0x3f')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5d2c15);})['then'](function(_0x39fb52){_0x3ef2b1[_0x9505('0x40')]=_0x39fb52;return _0x3ef2b1;})[_0x9505('0x13')](respondWithFilteredResult(_0x3b17ca,_0x5d2c15))[_0x9505('0x1a')](handleError(_0x3b17ca,null));};exports[_0x9505('0x41')]=function(_0x10e416,_0x471a08){var _0x51e2d6={'raw':!![],'where':{'id':_0x10e416[_0x9505('0x42')]['id']}},_0x24d0ba={};_0x24d0ba['model']=_['keys'](db[_0x9505('0x3e')][_0x9505('0x28')]);_0x24d0ba['query']=_['keys'](_0x10e416[_0x9505('0x2d')]);_0x24d0ba['filters']=_['intersection'](_0x24d0ba[_0x9505('0x2c')],_0x24d0ba[_0x9505('0x2d')]);_0x51e2d6[_0x9505('0x31')]=_[_0x9505('0x2f')](_0x24d0ba[_0x9505('0x2c')],qs[_0x9505('0x30')](_0x10e416[_0x9505('0x2d')][_0x9505('0x30')]));_0x51e2d6[_0x9505('0x31')]=_0x51e2d6['attributes'][_0x9505('0x32')]?_0x51e2d6[_0x9505('0x31')]:_0x24d0ba[_0x9505('0x2c')];if(_0x10e416[_0x9505('0x2d')][_0x9505('0x43')]){_0x51e2d6['include']=[{'all':!![]}];}_0x51e2d6=_[_0x9505('0x3c')]({},_0x51e2d6,_0x10e416[_0x9505('0x3d')]);return db['MailMessage'][_0x9505('0x44')](_0x51e2d6)['then'](handleEntityNotFound(_0x471a08,null))[_0x9505('0x13')](respondWithResult(_0x471a08,null))[_0x9505('0x1a')](handleError(_0x471a08,null));};exports[_0x9505('0x21')]=function(_0x42197b,_0x558f03){if(_0x42197b[_0x9505('0x45')]['id']){delete _0x42197b['body']['id'];}return db[_0x9505('0x3e')][_0x9505('0x44')]({'where':{'id':_0x42197b[_0x9505('0x42')]['id']}})[_0x9505('0x13')](handleEntityNotFound(_0x558f03,null))['then'](saveUpdates(_0x42197b['body'],null))[_0x9505('0x13')](respondWithResult(_0x558f03,null))['catch'](handleError(_0x558f03,null));};exports[_0x9505('0x22')]=function(_0xf6d9c7,_0x2bf2a9){return db['MailMessage'][_0x9505('0x44')]({'where':{'id':_0xf6d9c7[_0x9505('0x42')]['id']}})[_0x9505('0x13')](handleEntityNotFound(_0x2bf2a9,null))[_0x9505('0x13')](removeEntity(_0x2bf2a9,null))['catch'](handleError(_0x2bf2a9,null));};exports[_0x9505('0x46')]=function(_0x34286f,_0x4855d6){return db[_0x9505('0x3e')][_0x9505('0x46')]()[_0x9505('0x13')](respondWithResult(_0x4855d6,null))[_0x9505('0x1a')](handleError(_0x4855d6,null));};exports['create']=function(_0x29e1b7,_0x12b0dc){return db['MailMessage'][_0x9505('0x47')](_0x29e1b7[_0x9505('0x45')])[_0x9505('0x13')](function(_0x2b9346){if(_0x2b9346){if(_0x2b9346[_0x9505('0x48')]===_0x9505('0x49')&&!_0x2b9346[_0x9505('0x4a')]){var _0x1630ee,_0x1040bd,_0x546f62;if(_0x29e1b7[_0x9505('0x45')]['to']){_0x1040bd=_0x29e1b7[_0x9505('0x45')]['to'][_0x9505('0x4b')](',')[0x0];}return db[_0x9505('0x4c')][_0x9505('0x4d')]({'where':{'id':_0x2b9346['MailAccountId']},'include':[{'model':db[_0x9505('0x4e')],'as':_0x9505('0x4f'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x1040bd},'limit':0x1,'order':[[_0x9505('0x50'),'DESC']]}]},{'model':db[_0x9505('0x51')],'as':_0x9505('0x52'),'raw':!![],'include':[{'model':db[_0x9505('0x53')],'as':_0x9505('0x53'),'raw':!![]}]}]})[_0x9505('0x13')](function(_0x559634){_0x1630ee=_0x559634;if(!_0x1630ee||!_0x1630ee[_0x9505('0x52')])return;var _0x51ff8f=_0x1630ee[_0x9505('0x54')]();if(_0x29e1b7[_0x9505('0x45')][_0x9505('0x55')]&&_0x29e1b7['body'][_0x9505('0x55')][_0x9505('0x32')]){for(var _0x5e31f8=0x0;_0x5e31f8<_0x29e1b7[_0x9505('0x45')][_0x9505('0x55')]['length'];_0x5e31f8+=0x1){_0x29e1b7[_0x9505('0x45')]['attachments'][_0x5e31f8]={'filename':_0x29e1b7[_0x9505('0x45')]['attachments'][_0x5e31f8][_0x9505('0x25')],'path':path[_0x9505('0x56')](config[_0x9505('0x57')],_0x9505('0x58'),_0x29e1b7[_0x9505('0x45')][_0x9505('0x55')][_0x5e31f8][_0x9505('0x59')])};}}_0x546f62={'account':_0x51ff8f,'message':_0x29e1b7['body']};return;})[_0x9505('0x13')](function(){if(_0x1630ee[_0x9505('0x4f')]){if(_0x1630ee[_0x9505('0x4f')]['Contacts'][_0x9505('0x32')]){return _0x1630ee[_0x9505('0x4f')][_0x9505('0x5a')][0x0];}else{return db['CmContact'][_0x9505('0x47')](_[_0x9505('0x5b')](_0x29e1b7['body'],{'firstName':_0x29e1b7[_0x9505('0x45')]['to'],'email':_0x29e1b7[_0x9505('0x45')]['to'],'phone':_0x29e1b7[_0x9505('0x45')]['to'],'ListId':_0x1630ee['ListId']}));}}else{throw new Error(_0x9505('0x5c'));}})[_0x9505('0x13')](function(){if(_0x546f62){return respondWithRpcPromise('SendMail',_0x9505('0x5d'),_0x546f62,client9003)[_0x9505('0x13')](function(_0x160a5c){return _0x2b9346[_0x9505('0x21')]({'read':!![],'messageId':_0x160a5c[_0x9505('0x5e')],'sentAt':moment()[_0x9505('0x5f')](_0x9505('0x60'))});})[_0x9505('0x1a')](function(_0x36386c){logger[_0x9505('0x17')]('%s',JSON[_0x9505('0x61')](_0x36386c));return _0x2b9346;});}return _0x2b9346;});}return _0x2b9346;}})['then'](respondWithResult(_0x12b0dc,0xc9))[_0x9505('0x1a')](handleError(_0x12b0dc,null));};exports['accept']=function(_0x57f7cd,_0x176d10){var _0x1b3fd6={'agent':{},'channel':'mail'};if(_0x57f7cd[_0x9505('0x45')]['id']){delete _0x57f7cd['body']['id'];}_0x57f7cd[_0x9505('0x45')]['read']=!![];_0x57f7cd[_0x9505('0x45')][_0x9505('0x62')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x57f7cd[_0x9505('0x45')]['UserId']=_0x57f7cd[_0x9505('0x45')][_0x9505('0x63')]||_0x57f7cd[_0x9505('0x64')]['id'];_0x1b3fd6[_0x9505('0x65')]['id']=_0x57f7cd[_0x9505('0x45')]['UserId'];return db['MailMessage'][_0x9505('0x44')]({'where':{'id':_0x57f7cd[_0x9505('0x42')]['id'],'UserId':null}})[_0x9505('0x13')](handleEntityNotFound(_0x176d10,null))['then'](saveUpdates(_0x57f7cd['body'],null))['then'](function(_0x4073fd){if(_0x4073fd){_0x1b3fd6[_0x9505('0x18')]=_0x4073fd[_0x9505('0x66')]({'plain':!![]});return db[_0x9505('0x67')][_0x9505('0x44')]({'where':{'id':_0x4073fd[_0x9505('0x68')]}});}return null;})[_0x9505('0x13')](handleEntityNotFound(_0x176d10,null))[_0x9505('0x13')](function(_0x4f225a){if(_0x4f225a){return _0x4f225a[_0x9505('0x21')]({'UserId':_0x57f7cd[_0x9505('0x45')][_0x9505('0x63')],'read1stAt':_[_0x9505('0x69')](_0x4f225a[_0x9505('0x6a')])?moment()[_0x9505('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9505('0x13')](function(_0x1b2b43){if(_0x1b2b43){_0x1b3fd6[_0x9505('0x6b')]=_0x1b2b43[_0x9505('0x66')]({'plain':!![]});interaction_log[_0x9505('0x14')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57f7cd[_0x9505('0x64')]['id'],_0x57f7cd[_0x9505('0x64')][_0x9505('0x25')],_0x57f7cd[_0x9505('0x64')][_0x9505('0x6c')],_0x1b3fd6[_0x9505('0x6b')]['id'],_0x57f7cd['body']?JSON[_0x9505('0x61')](_0x57f7cd[_0x9505('0x45')]):'null');return respondWithRpcPromise(_0x9505('0x6d'),_0x9505('0x6e'),_0x1b3fd6);}return null;})[_0x9505('0x13')](function(_0x2ef9ce){var _0x199946=_0x9505('0x6f')+_0x2ef9ce['message'][_0x9505('0x70')];return db[_0x9505('0x71')][_0x9505('0x2d')](_0x199946,{'type':db['Sequelize'][_0x9505('0x72')][_0x9505('0x73')],'raw':!![]})['then'](function(_0x1b7a53){return _0x1b7a53;});})['then'](function(_0x2eae42){if(_0x2eae42){_0x1b3fd6['message'][_0x9505('0x74')]=_0x2eae42[0x0];if(!_0x57f7cd[_0x9505('0x45')]['UserId'])return;return db[_0x9505('0x75')][_0x9505('0x44')]({'where':{'id':_0x57f7cd[_0x9505('0x45')]['UserId'],'role':_0x9505('0x65')},'attributes':['id',_0x9505('0x25'),'fullname',_0x9505('0x76'),_0x9505('0x77')],'raw':!![]});}return null;})[_0x9505('0x13')](function(_0x197445){if(!_0x197445)return null;_0x1b3fd6[_0x9505('0x18')][_0x9505('0x65')]=_0x197445;return _0x1b3fd6;})['then'](function(_0x1645c8){if(_0x1645c8){if(_0x57f7cd[_0x9505('0x45')]['manual']){_0x1b3fd6[_0x9505('0x18')][_0x9505('0x78')]=util[_0x9505('0x5f')](_0x9505('0x79'),_0x57f7cd['user'][_0x9505('0x25')]);_0x1b3fd6['message'][_0x9505('0x7a')]=_0x1b3fd6[_0x9505('0x7a')];_0x1b3fd6[_0x9505('0x18')]['motionChannel']=_0x1b3fd6[_0x9505('0x7a')];_0x1b3fd6[_0x9505('0x18')][_0x9505('0x7b')]='accept';_0x1b3fd6['message'][_0x9505('0x45')]=htmlToText[_0x9505('0x7c')](_0x1b3fd6[_0x9505('0x18')][_0x9505('0x45')]);return respondWithRpcPromise(_0x9505('0x7d'),_0x9505('0x7d'),{'event':_0x9505('0x7e'),'message':_0x1b3fd6[_0x9505('0x18')]},client9002)[_0x9505('0x13')](function(){return _0x1b3fd6;});}return _0x1b3fd6;}return null;})['then'](respondWithResult(_0x176d10,null))[_0x9505('0x1a')](handleError(_0x176d10,null));};exports[_0x9505('0x7f')]=function(_0x483234,_0x6cd5ab){var _0x486c52={'agent':{},'channel':_0x9505('0x80')};if(_0x483234[_0x9505('0x45')]['id']){delete _0x483234[_0x9505('0x45')]['id'];}_0x483234[_0x9505('0x45')]['UserId']=_0x483234[_0x9505('0x45')]['UserId']||_0x483234[_0x9505('0x64')]['id'];_0x486c52[_0x9505('0x65')]['id']=_0x483234[_0x9505('0x45')][_0x9505('0x63')];return db[_0x9505('0x3e')][_0x9505('0x44')]({'where':{'id':_0x483234[_0x9505('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x6cd5ab,null))[_0x9505('0x13')](function(_0x565b4e){if(_0x565b4e){_0x486c52['message']=_0x565b4e[_0x9505('0x66')]({'plain':!![]});return db[_0x9505('0x67')][_0x9505('0x44')]({'where':{'id':_0x565b4e[_0x9505('0x68')]}});}return null;})[_0x9505('0x13')](handleEntityNotFound(_0x6cd5ab,null))[_0x9505('0x13')](function(_0x31fc0c){if(_0x31fc0c){_0x486c52[_0x9505('0x6b')]=_0x31fc0c[_0x9505('0x66')]({'plain':!![]});interaction_log[_0x9505('0x14')](_0x9505('0x81'),_0x483234[_0x9505('0x64')]['id'],_0x483234[_0x9505('0x64')][_0x9505('0x25')],_0x483234[_0x9505('0x64')][_0x9505('0x6c')],_0x486c52[_0x9505('0x6b')]['id'],_0x483234[_0x9505('0x45')]?JSON['stringify'](_0x483234[_0x9505('0x45')]):_0x9505('0x82'));return respondWithRpcPromise(_0x9505('0x83'),_0x9505('0x84'),_0x486c52);}return null;})[_0x9505('0x13')](function(_0x53bcff){var _0x550f8a=_0x9505('0x6f')+_0x53bcff['message'][_0x9505('0x70')];return db['sequelize'][_0x9505('0x2d')](_0x550f8a,{'type':db[_0x9505('0x85')][_0x9505('0x72')]['SELECT'],'raw':!![]})[_0x9505('0x13')](function(_0x2c90a2){return _0x2c90a2;});})[_0x9505('0x13')](function(_0x1736c7){if(_0x1736c7){_0x486c52['message'][_0x9505('0x74')]=_0x1736c7[0x0];if(!_0x483234[_0x9505('0x45')]['UserId'])return;return db[_0x9505('0x75')][_0x9505('0x44')]({'where':{'id':_0x483234[_0x9505('0x45')]['UserId'],'role':'agent'},'attributes':['id','name',_0x9505('0x86'),'email',_0x9505('0x77')],'raw':!![]});}return null;})[_0x9505('0x13')](function(_0x56c5b0){if(!_0x56c5b0)return null;_0x486c52[_0x9505('0x18')]['agent']=_0x56c5b0;return _0x486c52;})[_0x9505('0x13')](function(_0x5e1b6e){if(_0x5e1b6e){_0x5e1b6e[_0x9505('0x18')][_0x9505('0x78')]=util[_0x9505('0x5f')](_0x9505('0x79'),_0x483234['user']['name']);_0x5e1b6e['message'][_0x9505('0x7a')]=_0x486c52[_0x9505('0x7a')];_0x5e1b6e[_0x9505('0x18')][_0x9505('0x87')]=_0x486c52['channel'];_0x5e1b6e[_0x9505('0x18')][_0x9505('0x7b')]='reject';_0x5e1b6e[_0x9505('0x18')][_0x9505('0x45')]=htmlToText['fromString'](_0x486c52[_0x9505('0x18')][_0x9505('0x45')]);respondWithRpcPromise(_0x9505('0x7d'),_0x9505('0x7d'),{'event':_0x9505('0x88'),'message':_0x5e1b6e[_0x9505('0x18')]},client9002);return _0x486c52;}return null;})[_0x9505('0x13')](respondWithResult(_0x6cd5ab,null))[_0x9505('0x1a')](handleError(_0x6cd5ab,null));};exports[_0x9505('0x89')]=function(_0x36bf20,_0x59a4b8){var _0x287fb3=moment()[_0x9505('0x8a')]()['toString']();var _0x5c9ec1=path['join'](config[_0x9505('0x57')],_0x9505('0x8b'),_0x9505('0x8c'),_0x9505('0x8d'));var _0x5ce783=path[_0x9505('0x56')](config[_0x9505('0x57')],_0x9505('0x8b'),_0x9505('0x8c'),_0x9505('0x55'));var _0x19edf9=util['format'](_0x9505('0x8e'),_0x287fb3);return db[_0x9505('0x3e')][_0x9505('0x44')]({'where':{'id':_0x36bf20[_0x9505('0x42')]['id']},'attributes':['id','body',_0x9505('0x8f'),'to','cc','bcc',_0x9505('0x90'),_0x9505('0x91')],'include':_0x36bf20[_0x9505('0x2d')][_0x9505('0x55')]?[{'model':db['Attachment'],'as':_0x9505('0x92')}]:undefined})[_0x9505('0x13')](handleEntityNotFound(_0x59a4b8,null))[_0x9505('0x13')](function(_0x58975c){if(_0x58975c){var _0x227275=_0x58975c;var _0x4025c8={'from':_0x227275[_0x9505('0x8f')],'to':_0x227275['to'],'subject':_0x227275['subject'],'html':htmlEntities[_0x9505('0x93')](_0x227275[_0x9505('0x45')]),'headers':{'Date':moment(_0x227275[_0x9505('0x91')])[_0x9505('0x5f')](_0x9505('0x94'))},'attachments':[]};if(_0x58975c['cc']){_0x4025c8[_0x9505('0x95')]['Cc']=_0x58975c['cc'];}if(_0x58975c[_0x9505('0x96')]){_0x4025c8[_0x9505('0x95')][_0x9505('0x97')]=_0x58975c[_0x9505('0x96')];}return new BPromise(function(_0x19454e,_0x50b083){if(_0x58975c[_0x9505('0x92')]){for(var _0x38677f=0x0;_0x38677f<_0x58975c['Attachments']['length'];_0x38677f++){var _0x5a5039=_0x58975c[_0x9505('0x92')][_0x38677f];var _0x1049d7=path[_0x9505('0x56')](_0x5ce783,_0x5a5039['basename']);if(fs[_0x9505('0x98')](_0x1049d7)){_0x4025c8[_0x9505('0x55')][_0x9505('0x99')]({'name':_0x5a5039['name'],'contentType':_0x5a5039[_0x9505('0x2a')],'data':fs[_0x9505('0x9a')](_0x1049d7)});}}}emlformat['build'](_0x4025c8,function(_0x5e7455,_0x2637fc){if(_0x5e7455)return _0x50b083(_0x5e7455);fs[_0x9505('0x9b')](path[_0x9505('0x56')](_0x5c9ec1,_0x19edf9),_0x2637fc);return _0x19454e(_0x2637fc);});});}})[_0x9505('0x13')](function(_0x61c933){if(_0x61c933){return _0x59a4b8['download'](path[_0x9505('0x56')](_0x5c9ec1,_0x19edf9),_0x19edf9,function(_0x82369e){if(!_0x82369e)fs[_0x9505('0x9c')](path[_0x9505('0x56')](_0x5c9ec1,_0x19edf9));});}})[_0x9505('0x1a')](handleError(_0x59a4b8,null));}; \ No newline at end of file +var _0x8057=['motionChannel','event','accept','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','download','unix','server','files','tmp','message-%s.eml','from','subject','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','include','find','body','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','List','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','user','agent','UserId','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel'];(function(_0x9390d0,_0x1c1feb){var _0x455bd2=function(_0xe194c7){while(--_0xe194c7){_0x9390d0['push'](_0x9390d0['shift']());}};_0x455bd2(++_0x1c1feb);}(_0x8057,0xbe));var _0x7805=function(_0x42df87,_0x2dd2a9){_0x42df87=_0x42df87-0x0;var _0xebd657=_0x8057[_0x42df87];return _0xebd657;};'use strict';var emlformat=require(_0x7805('0x0'));var moment=require(_0x7805('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7805('0x2'));var fs=require('fs');var _=require(_0x7805('0x3'));var Redis=require(_0x7805('0x4'));var htmlToText=require(_0x7805('0x5'));var qs=require(_0x7805('0x6'));var logger=require(_0x7805('0x7'))(_0x7805('0x8'));var interaction_log=require(_0x7805('0x7'))(_0x7805('0x9'));var config=require(_0x7805('0xa'));var db=require(_0x7805('0xb'))['db'];config[_0x7805('0xc')]=_[_0x7805('0xd')](config['redis'],{'host':_0x7805('0xe'),'port':0x18eb});var socket=require(_0x7805('0xf'))(new Redis(config[_0x7805('0xc')]));var htmlEntities=require('html-entities');require(_0x7805('0x10'))[_0x7805('0x11')](socket);var jayson=require(_0x7805('0x12'));var client=jayson['client'][_0x7805('0x13')]({'port':0x232c});var client9003=jayson[_0x7805('0x14')][_0x7805('0x13')]({'port':0x232b});var client9002=jayson[_0x7805('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f06c5,_0x4aca50,_0x82bc36,_0x3342f1){return new BPromise(function(_0x30313c,_0x9a63e2){var _0xa57966=_0x3342f1||client;return _0xa57966['request'](_0x2f06c5,_0x82bc36)[_0x7805('0x15')](function(_0x1e61db){logger[_0x7805('0x16')](_0x7805('0x17'),_0x4aca50,_0x7805('0x18'));logger[_0x7805('0x19')](_0x7805('0x1a'),_0x4aca50,_0x7805('0x18'),JSON[_0x7805('0x1b')](_0x1e61db));if(_0x1e61db['error']){if(_0x1e61db[_0x7805('0x1c')]['code']===0x1f4){logger[_0x7805('0x1c')](_0x7805('0x17'),_0x4aca50,_0x1e61db['error'][_0x7805('0x1d')]);return _0x9a63e2(_0x1e61db[_0x7805('0x1c')][_0x7805('0x1d')]);}logger[_0x7805('0x1c')]('MailMessage,\x20%s,\x20%s',_0x4aca50,_0x1e61db[_0x7805('0x1c')]['message']);return _0x30313c(_0x1e61db[_0x7805('0x1c')]['message']);}else{logger[_0x7805('0x16')](_0x7805('0x17'),_0x4aca50,_0x7805('0x18'));_0x30313c(_0x1e61db[_0x7805('0x1e')][_0x7805('0x1d')]);}})[_0x7805('0x1f')](function(_0x1fda88){logger['error'](_0x7805('0x17'),_0x4aca50,_0x1fda88);_0x9a63e2(_0x1fda88);});});}function respondWithResult(_0x18bcf4,_0xd049d0){_0xd049d0=_0xd049d0||0xc8;return function(_0x20db80){if(_0x20db80){return _0x18bcf4[_0x7805('0x20')](_0xd049d0)[_0x7805('0x21')](_0x20db80);}};}function respondWithFilteredResult(_0x90e9d,_0x41b5db){return function(_0x3b3c97){if(_0x3b3c97){var _0x1b5388=typeof _0x41b5db[_0x7805('0x22')]===_0x7805('0x23')&&typeof _0x41b5db[_0x7805('0x24')]===_0x7805('0x23');var _0x55fa0a=_0x3b3c97[_0x7805('0x25')];var _0x416708=_0x1b5388?0x0:_0x41b5db[_0x7805('0x22')];var _0x3ed5ec=_0x1b5388?_0x3b3c97[_0x7805('0x25')]:_0x41b5db['offset']+_0x41b5db[_0x7805('0x24')];var _0x22590e;if(_0x3ed5ec>=_0x55fa0a){_0x3ed5ec=_0x55fa0a;_0x22590e=0xc8;}else{_0x22590e=0xce;}_0x90e9d[_0x7805('0x20')](_0x22590e);return _0x90e9d[_0x7805('0x26')](_0x7805('0x27'),_0x416708+'-'+_0x3ed5ec+'/'+_0x55fa0a)['json'](_0x3b3c97);}return null;};}function saveUpdates(_0x1f8202){return function(_0x8a1ce3){if(_0x8a1ce3){return _0x8a1ce3[_0x7805('0x28')](_0x1f8202)[_0x7805('0x15')](function(_0x4b094b){return _0x4b094b;});}return null;};}function removeEntity(_0x3b6514){return function(_0x17eb26){if(_0x17eb26){return _0x17eb26[_0x7805('0x29')]()[_0x7805('0x15')](function(){_0x3b6514[_0x7805('0x20')](0xcc)[_0x7805('0x2a')]();});}};}function handleEntityNotFound(_0x1b06c1){return function(_0x248680){if(!_0x248680){_0x1b06c1[_0x7805('0x2b')](0x194);}return _0x248680;};}function handleError(_0x5d3fa0,_0x270674){_0x270674=_0x270674||0x1f4;return function(_0x304ff4){logger[_0x7805('0x1c')](_0x304ff4[_0x7805('0x2c')]);if(_0x304ff4[_0x7805('0x2d')]){delete _0x304ff4['name'];}_0x5d3fa0[_0x7805('0x20')](_0x270674)[_0x7805('0x2e')](_0x304ff4);};}exports[_0x7805('0x2f')]=function(_0x21519a,_0x1f632a){var _0x166668={},_0xb56a19={},_0x2b3f97={'count':0x0,'rows':[]};var _0x2ea85e=_[_0x7805('0x30')](db[_0x7805('0x31')][_0x7805('0x32')],function(_0x11e47d){return{'name':_0x11e47d[_0x7805('0x33')],'type':_0x11e47d[_0x7805('0x34')][_0x7805('0x35')]};});_0xb56a19['model']=_[_0x7805('0x30')](_0x2ea85e,_0x7805('0x2d'));_0xb56a19[_0x7805('0x36')]=_[_0x7805('0x37')](_0x21519a[_0x7805('0x36')]);_0xb56a19[_0x7805('0x38')]=_[_0x7805('0x39')](_0xb56a19['model'],_0xb56a19[_0x7805('0x36')]);_0x166668['attributes']=_[_0x7805('0x39')](_0xb56a19[_0x7805('0x3a')],qs[_0x7805('0x3b')](_0x21519a[_0x7805('0x36')][_0x7805('0x3b')]));_0x166668[_0x7805('0x3c')]=_0x166668[_0x7805('0x3c')][_0x7805('0x3d')]?_0x166668['attributes']:_0xb56a19[_0x7805('0x3a')];if(!_0x21519a[_0x7805('0x36')][_0x7805('0x3e')](_0x7805('0x3f'))){_0x166668[_0x7805('0x24')]=qs['limit'](_0x21519a['query'][_0x7805('0x24')]);_0x166668['offset']=qs[_0x7805('0x22')](_0x21519a['query'][_0x7805('0x22')]);}_0x166668[_0x7805('0x40')]=qs['sort'](_0x21519a[_0x7805('0x36')]['sort']);_0x166668['where']=qs[_0x7805('0x38')](_[_0x7805('0x41')](_0x21519a[_0x7805('0x36')],_0xb56a19['filters']),_0x2ea85e);if(_0x21519a[_0x7805('0x36')][_0x7805('0x42')]){_0x166668['where']=_[_0x7805('0x43')](_0x166668['where'],{'$or':_[_0x7805('0x30')](_0x2ea85e,function(_0x16b0eb){if(_0x16b0eb['type']!==_0x7805('0x44')){var _0x47a191={};_0x47a191[_0x16b0eb[_0x7805('0x2d')]]={'$like':'%'+_0x21519a[_0x7805('0x36')][_0x7805('0x42')]+'%'};return _0x47a191;}})});}_0x166668=_[_0x7805('0x43')]({},_0x166668,_0x21519a[_0x7805('0x45')]);var _0x3f915a={'where':_0x166668[_0x7805('0x46')]};return db[_0x7805('0x31')][_0x7805('0x25')](_0x3f915a)[_0x7805('0x15')](function(_0x2a405a){_0x2b3f97['count']=_0x2a405a;if(_0x21519a['query'][_0x7805('0x47')]){_0x166668['include']=[{'all':!![]}];}return db[_0x7805('0x31')][_0x7805('0x48')](_0x166668);})['then'](function(_0x46dd74){_0x2b3f97[_0x7805('0x49')]=_0x46dd74;return _0x2b3f97;})[_0x7805('0x15')](respondWithFilteredResult(_0x1f632a,_0x166668))['catch'](handleError(_0x1f632a,null));};exports[_0x7805('0x4a')]=function(_0x4e8a51,_0x2b8c8e){var _0x542296={'raw':!![],'where':{'id':_0x4e8a51['params']['id']}},_0x4019af={};_0x4019af[_0x7805('0x3a')]=_[_0x7805('0x37')](db[_0x7805('0x31')]['rawAttributes']);_0x4019af['query']=_[_0x7805('0x37')](_0x4e8a51[_0x7805('0x36')]);_0x4019af[_0x7805('0x38')]=_[_0x7805('0x39')](_0x4019af[_0x7805('0x3a')],_0x4019af[_0x7805('0x36')]);_0x542296['attributes']=_[_0x7805('0x39')](_0x4019af['model'],qs[_0x7805('0x3b')](_0x4e8a51[_0x7805('0x36')][_0x7805('0x3b')]));_0x542296[_0x7805('0x3c')]=_0x542296[_0x7805('0x3c')]['length']?_0x542296[_0x7805('0x3c')]:_0x4019af[_0x7805('0x3a')];if(_0x4e8a51[_0x7805('0x36')][_0x7805('0x47')]){_0x542296[_0x7805('0x4b')]=[{'all':!![]}];}_0x542296=_[_0x7805('0x43')]({},_0x542296,_0x4e8a51[_0x7805('0x45')]);return db[_0x7805('0x31')][_0x7805('0x4c')](_0x542296)[_0x7805('0x15')](handleEntityNotFound(_0x2b8c8e,null))['then'](respondWithResult(_0x2b8c8e,null))[_0x7805('0x1f')](handleError(_0x2b8c8e,null));};exports[_0x7805('0x28')]=function(_0x6bd917,_0x275388){if(_0x6bd917['body']['id']){delete _0x6bd917[_0x7805('0x4d')]['id'];}return db[_0x7805('0x31')][_0x7805('0x4c')]({'where':{'id':_0x6bd917[_0x7805('0x4e')]['id']}})['then'](handleEntityNotFound(_0x275388,null))[_0x7805('0x15')](saveUpdates(_0x6bd917['body'],null))[_0x7805('0x15')](respondWithResult(_0x275388,null))[_0x7805('0x1f')](handleError(_0x275388,null));};exports[_0x7805('0x29')]=function(_0x1f4bf7,_0x24cc2a){return db[_0x7805('0x31')][_0x7805('0x4c')]({'where':{'id':_0x1f4bf7[_0x7805('0x4e')]['id']}})['then'](handleEntityNotFound(_0x24cc2a,null))[_0x7805('0x15')](removeEntity(_0x24cc2a,null))['catch'](handleError(_0x24cc2a,null));};exports[_0x7805('0x4f')]=function(_0x384016,_0x4cf16a){return db['MailMessage']['describe']()[_0x7805('0x15')](respondWithResult(_0x4cf16a,null))[_0x7805('0x1f')](handleError(_0x4cf16a,null));};exports[_0x7805('0x50')]=function(_0x20a653,_0x5d8558){return db['MailMessage']['create'](_0x20a653[_0x7805('0x4d')])[_0x7805('0x15')](function(_0x1bab94){if(_0x1bab94){if(_0x1bab94[_0x7805('0x51')]===_0x7805('0x52')&&!_0x1bab94[_0x7805('0x53')]){var _0x1a7208,_0x5a7189,_0x419679;if(_0x20a653[_0x7805('0x4d')]['to']){_0x5a7189=_0x20a653[_0x7805('0x4d')]['to'][_0x7805('0x54')](',')[0x0];}return db[_0x7805('0x55')][_0x7805('0x56')]({'where':{'id':_0x1bab94[_0x7805('0x57')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7805('0x58')],'as':_0x7805('0x59'),'where':{'email':_0x5a7189},'limit':0x1,'order':[['updatedAt',_0x7805('0x5a')]]}]},{'model':db[_0x7805('0x5b')],'as':_0x7805('0x5c'),'raw':!![],'include':[{'model':db[_0x7805('0x5d')],'as':_0x7805('0x5d'),'raw':!![]}]}]})[_0x7805('0x15')](function(_0x59a007){_0x1a7208=_0x59a007;if(!_0x1a7208||!_0x1a7208[_0x7805('0x5c')])return;var _0x47e17f=_0x1a7208[_0x7805('0x5e')]();if(_0x20a653['body']['attachments']&&_0x20a653[_0x7805('0x4d')][_0x7805('0x5f')][_0x7805('0x3d')]){for(var _0x39a6d7=0x0;_0x39a6d7<_0x20a653['body'][_0x7805('0x5f')]['length'];_0x39a6d7+=0x1){_0x20a653[_0x7805('0x4d')][_0x7805('0x5f')][_0x39a6d7]={'filename':_0x20a653[_0x7805('0x4d')][_0x7805('0x5f')][_0x39a6d7][_0x7805('0x2d')],'path':path[_0x7805('0x60')](config[_0x7805('0x61')],'server/files/attachments',_0x20a653[_0x7805('0x4d')][_0x7805('0x5f')][_0x39a6d7][_0x7805('0x62')])};}}_0x419679={'account':_0x47e17f,'message':_0x20a653[_0x7805('0x4d')]};return;})['then'](function(){if(_0x1a7208['List']){if(_0x1a7208[_0x7805('0x63')][_0x7805('0x59')][_0x7805('0x3d')]){return _0x1a7208[_0x7805('0x63')][_0x7805('0x59')][0x0];}else{return db[_0x7805('0x58')][_0x7805('0x50')](_['defaults'](_0x20a653['body'],{'firstName':_0x20a653[_0x7805('0x4d')]['to'],'email':_0x20a653[_0x7805('0x4d')]['to'],'phone':_0x20a653[_0x7805('0x4d')]['to'],'ListId':_0x1a7208['ListId']}));}}else{throw new Error(_0x7805('0x64'));}})['then'](function(){if(_0x419679){return respondWithRpcPromise(_0x7805('0x65'),_0x7805('0x66'),_0x419679,client9003)[_0x7805('0x15')](function(_0x338dd0){return _0x1bab94[_0x7805('0x28')]({'read':!![],'messageId':_0x338dd0[_0x7805('0x67')],'sentAt':moment()[_0x7805('0x68')](_0x7805('0x69'))});})['catch'](function(_0x491cd1){logger[_0x7805('0x1c')]('%s',JSON['stringify'](_0x491cd1));return _0x1bab94;});}return _0x1bab94;});}return _0x1bab94;}})[_0x7805('0x15')](respondWithResult(_0x5d8558,0xc9))[_0x7805('0x1f')](handleError(_0x5d8558,null));};exports['accept']=function(_0x1a408f,_0xfe35c3){var _0x1164dd={'agent':{},'channel':_0x7805('0x6a')};if(_0x1a408f[_0x7805('0x4d')]['id']){delete _0x1a408f[_0x7805('0x4d')]['id'];}_0x1a408f[_0x7805('0x4d')][_0x7805('0x6b')]=!![];_0x1a408f[_0x7805('0x4d')]['readAt']=moment()[_0x7805('0x68')](_0x7805('0x69'));_0x1a408f[_0x7805('0x4d')]['UserId']=_0x1a408f['body']['UserId']||_0x1a408f[_0x7805('0x6c')]['id'];_0x1164dd[_0x7805('0x6d')]['id']=_0x1a408f[_0x7805('0x4d')][_0x7805('0x6e')];return db['MailMessage'][_0x7805('0x4c')]({'where':{'id':_0x1a408f[_0x7805('0x4e')]['id'],'UserId':null}})[_0x7805('0x15')](handleEntityNotFound(_0xfe35c3,null))['then'](saveUpdates(_0x1a408f['body'],null))['then'](function(_0x3a2a56){if(_0x3a2a56){_0x1164dd[_0x7805('0x1d')]=_0x3a2a56['get']({'plain':!![]});return db[_0x7805('0x6f')][_0x7805('0x4c')]({'where':{'id':_0x3a2a56[_0x7805('0x70')]}});}return null;})[_0x7805('0x15')](handleEntityNotFound(_0xfe35c3,null))[_0x7805('0x15')](function(_0x40e0b6){if(_0x40e0b6){return _0x40e0b6[_0x7805('0x28')]({'UserId':_0x1a408f[_0x7805('0x4d')]['UserId'],'read1stAt':_[_0x7805('0x71')](_0x40e0b6[_0x7805('0x72')])?moment()[_0x7805('0x68')](_0x7805('0x69')):undefined});}return null;})[_0x7805('0x15')](function(_0x109f83){if(_0x109f83){_0x1164dd[_0x7805('0x73')]=_0x109f83[_0x7805('0x74')]({'plain':!![]});interaction_log[_0x7805('0x16')](_0x7805('0x75'),_0x1a408f[_0x7805('0x6c')]['id'],_0x1a408f[_0x7805('0x6c')][_0x7805('0x2d')],_0x1a408f[_0x7805('0x6c')][_0x7805('0x76')],_0x1164dd[_0x7805('0x73')]['id'],_0x1a408f[_0x7805('0x4d')]?JSON[_0x7805('0x1b')](_0x1a408f['body']):'null');return respondWithRpcPromise(_0x7805('0x77'),_0x7805('0x78'),_0x1164dd);}return null;})[_0x7805('0x15')](function(_0xefaf05){var _0x57a59d=_0x7805('0x79')+_0xefaf05[_0x7805('0x1d')][_0x7805('0x7a')];return db[_0x7805('0x7b')][_0x7805('0x36')](_0x57a59d,{'type':db[_0x7805('0x7c')]['QueryTypes'][_0x7805('0x7d')],'raw':!![]})['then'](function(_0x1f0484){return _0x1f0484;});})[_0x7805('0x15')](function(_0x4df845){if(_0x4df845){_0x1164dd[_0x7805('0x1d')][_0x7805('0x7e')]=_0x4df845[0x0];if(!_0x1a408f[_0x7805('0x4d')][_0x7805('0x6e')])return;return db[_0x7805('0x7f')][_0x7805('0x4c')]({'where':{'id':_0x1a408f[_0x7805('0x4d')][_0x7805('0x6e')],'role':_0x7805('0x6d')},'attributes':['id',_0x7805('0x2d'),_0x7805('0x80'),_0x7805('0x81'),_0x7805('0x82')],'raw':!![]});}return null;})['then'](function(_0x7c7755){if(!_0x7c7755)return null;_0x1164dd['message'][_0x7805('0x6d')]=_0x7c7755;return _0x1164dd;})[_0x7805('0x15')](function(_0x18a73e){if(_0x18a73e){if(_0x1a408f['body']['manual']){_0x1164dd[_0x7805('0x1d')][_0x7805('0x83')]=util['format'](_0x7805('0x84'),_0x1a408f[_0x7805('0x6c')][_0x7805('0x2d')]);_0x1164dd[_0x7805('0x1d')]['channel']=_0x1164dd[_0x7805('0x85')];_0x1164dd[_0x7805('0x1d')][_0x7805('0x86')]=_0x1164dd['channel'];_0x1164dd[_0x7805('0x1d')][_0x7805('0x87')]=_0x7805('0x88');_0x1164dd[_0x7805('0x1d')][_0x7805('0x4d')]=htmlToText[_0x7805('0x89')](_0x1164dd[_0x7805('0x1d')]['body']);return respondWithRpcPromise('EventManager',_0x7805('0x8a'),{'event':'acceptmessage','message':_0x1164dd[_0x7805('0x1d')]},client9002)[_0x7805('0x15')](function(){return _0x1164dd;});}return _0x1164dd;}return null;})[_0x7805('0x15')](respondWithResult(_0xfe35c3,null))[_0x7805('0x1f')](handleError(_0xfe35c3,null));};exports[_0x7805('0x8b')]=function(_0x44fa16,_0x3170ea){var _0x2d62fb={'agent':{},'channel':'mail'};if(_0x44fa16[_0x7805('0x4d')]['id']){delete _0x44fa16[_0x7805('0x4d')]['id'];}_0x44fa16[_0x7805('0x4d')][_0x7805('0x6e')]=_0x44fa16['body'][_0x7805('0x6e')]||_0x44fa16[_0x7805('0x6c')]['id'];_0x2d62fb[_0x7805('0x6d')]['id']=_0x44fa16[_0x7805('0x4d')][_0x7805('0x6e')];return db['MailMessage'][_0x7805('0x4c')]({'where':{'id':_0x44fa16[_0x7805('0x4e')]['id'],'UserId':null}})[_0x7805('0x15')](handleEntityNotFound(_0x3170ea,null))[_0x7805('0x15')](function(_0x5cc948){if(_0x5cc948){_0x2d62fb[_0x7805('0x1d')]=_0x5cc948[_0x7805('0x74')]({'plain':!![]});return db[_0x7805('0x6f')][_0x7805('0x4c')]({'where':{'id':_0x5cc948['MailInteractionId']}});}return null;})[_0x7805('0x15')](handleEntityNotFound(_0x3170ea,null))[_0x7805('0x15')](function(_0x56aa2a){if(_0x56aa2a){_0x2d62fb[_0x7805('0x73')]=_0x56aa2a['get']({'plain':!![]});interaction_log[_0x7805('0x16')](_0x7805('0x8c'),_0x44fa16[_0x7805('0x6c')]['id'],_0x44fa16[_0x7805('0x6c')]['name'],_0x44fa16['user'][_0x7805('0x76')],_0x2d62fb[_0x7805('0x73')]['id'],_0x44fa16[_0x7805('0x4d')]?JSON[_0x7805('0x1b')](_0x44fa16[_0x7805('0x4d')]):_0x7805('0x8d'));return respondWithRpcPromise(_0x7805('0x8e'),'rejectMessage',_0x2d62fb);}return null;})[_0x7805('0x15')](function(_0x3de4c8){var _0x3be77a=_0x7805('0x79')+_0x3de4c8[_0x7805('0x1d')][_0x7805('0x7a')];return db[_0x7805('0x7b')][_0x7805('0x36')](_0x3be77a,{'type':db[_0x7805('0x7c')]['QueryTypes'][_0x7805('0x7d')],'raw':!![]})['then'](function(_0x9df108){return _0x9df108;});})[_0x7805('0x15')](function(_0x5cdc1d){if(_0x5cdc1d){_0x2d62fb[_0x7805('0x1d')][_0x7805('0x7e')]=_0x5cdc1d[0x0];if(!_0x44fa16[_0x7805('0x4d')][_0x7805('0x6e')])return;return db['User']['find']({'where':{'id':_0x44fa16[_0x7805('0x4d')][_0x7805('0x6e')],'role':_0x7805('0x6d')},'attributes':['id',_0x7805('0x2d'),_0x7805('0x80'),_0x7805('0x81'),'internal'],'raw':!![]});}return null;})[_0x7805('0x15')](function(_0x292f18){if(!_0x292f18)return null;_0x2d62fb[_0x7805('0x1d')]['agent']=_0x292f18;return _0x2d62fb;})[_0x7805('0x15')](function(_0x562a3b){if(_0x562a3b){_0x562a3b[_0x7805('0x1d')][_0x7805('0x83')]=util[_0x7805('0x68')]('SIP/%s',_0x44fa16['user'][_0x7805('0x2d')]);_0x562a3b[_0x7805('0x1d')][_0x7805('0x85')]=_0x2d62fb[_0x7805('0x85')];_0x562a3b[_0x7805('0x1d')]['motionChannel']=_0x2d62fb[_0x7805('0x85')];_0x562a3b[_0x7805('0x1d')][_0x7805('0x87')]=_0x7805('0x8b');_0x562a3b[_0x7805('0x1d')][_0x7805('0x4d')]=htmlToText[_0x7805('0x89')](_0x2d62fb[_0x7805('0x1d')]['body']);respondWithRpcPromise('EventManager',_0x7805('0x8a'),{'event':'rejectmessage','message':_0x562a3b[_0x7805('0x1d')]},client9002);return _0x2d62fb;}return null;})[_0x7805('0x15')](respondWithResult(_0x3170ea,null))[_0x7805('0x1f')](handleError(_0x3170ea,null));};exports[_0x7805('0x8f')]=function(_0x5dc9ca,_0x94e938){var _0x2d39d8=moment()[_0x7805('0x90')]()['toString']();var _0x3ce195=path[_0x7805('0x60')](config[_0x7805('0x61')],_0x7805('0x91'),_0x7805('0x92'),_0x7805('0x93'));var _0x2a7068=path[_0x7805('0x60')](config['root'],_0x7805('0x91'),_0x7805('0x92'),_0x7805('0x5f'));var _0xfb1749=util[_0x7805('0x68')](_0x7805('0x94'),_0x2d39d8);return db['MailMessage'][_0x7805('0x4c')]({'where':{'id':_0x5dc9ca[_0x7805('0x4e')]['id']},'attributes':['id','body',_0x7805('0x95'),'to','cc','bcc',_0x7805('0x96'),'createdAt'],'include':_0x5dc9ca[_0x7805('0x36')]['attachments']?[{'model':db[_0x7805('0x97')],'as':_0x7805('0x98')}]:undefined})[_0x7805('0x15')](handleEntityNotFound(_0x94e938,null))[_0x7805('0x15')](function(_0x14a495){if(_0x14a495){var _0x331007=_0x14a495;var _0x4cccba={'from':_0x331007[_0x7805('0x95')],'to':_0x331007['to'],'subject':_0x331007[_0x7805('0x96')],'html':htmlEntities[_0x7805('0x99')](_0x331007[_0x7805('0x4d')]),'headers':{'Date':moment(_0x331007['createdAt'])[_0x7805('0x68')](_0x7805('0x9a'))},'attachments':[]};if(_0x14a495['cc']){_0x4cccba[_0x7805('0x9b')]['Cc']=_0x14a495['cc'];}if(_0x14a495[_0x7805('0x9c')]){_0x4cccba[_0x7805('0x9b')]['Bcc']=_0x14a495[_0x7805('0x9c')];}return new BPromise(function(_0x4738ba,_0xd05618){if(_0x14a495['Attachments']){for(var _0x33e5de=0x0;_0x33e5de<_0x14a495[_0x7805('0x98')][_0x7805('0x3d')];_0x33e5de++){var _0x321345=_0x14a495[_0x7805('0x98')][_0x33e5de];var _0x771708=path[_0x7805('0x60')](_0x2a7068,_0x321345['basename']);if(fs[_0x7805('0x9d')](_0x771708)){_0x4cccba[_0x7805('0x5f')]['push']({'name':_0x321345[_0x7805('0x2d')],'contentType':_0x321345[_0x7805('0x34')],'data':fs[_0x7805('0x9e')](_0x771708)});}}}emlformat[_0x7805('0x9f')](_0x4cccba,function(_0x4768f4,_0x2bc002){if(_0x4768f4)return _0xd05618(_0x4768f4);fs[_0x7805('0xa0')](path[_0x7805('0x60')](_0x3ce195,_0xfb1749),_0x2bc002);return _0x4738ba(_0x2bc002);});});}})['then'](function(_0x503e64){if(_0x503e64){return _0x94e938[_0x7805('0x8f')](path['join'](_0x3ce195,_0xfb1749),_0xfb1749,function(_0x609af0){if(!_0x609af0)fs[_0x7805('0xa1')](path['join'](_0x3ce195,_0xfb1749));});}})['catch'](handleError(_0x94e938,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3e7722f..fcb568d 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 _0x5ae2=['../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x5ae2,0x132));var _0x25ae=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x5ae2[_0x1b5aea];return _0x51cae9;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x25ae('0x0'))['db'][_0x25ae('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x25ae('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x25ae('0x3'),'afterDestroy':_0x25ae('0x4')};function emitEvent(_0x3e183d){return function(_0xaac12,_0x44786a,_0x435dbc){MailMessageEvents[_0x25ae('0x5')](_0x3e183d+':'+_0xaac12['id'],_0xaac12);MailMessageEvents['emit'](_0x3e183d,_0xaac12);_0x435dbc(null);};}for(var e in events){if(events[_0x25ae('0x6')](e)){var event=events[e];MailMessage[_0x25ae('0x7')](e,emitEvent(event));}}module[_0x25ae('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x4d29=['hook','exports','MailMessage','update','emit','hasOwnProperty'];(function(_0x44b271,_0x295951){var _0x45d142=function(_0xeb11ac){while(--_0xeb11ac){_0x44b271['push'](_0x44b271['shift']());}};_0x45d142(++_0x295951);}(_0x4d29,0x16a));var _0x94d2=function(_0x3b6ab6,_0xc4cad2){_0x3b6ab6=_0x3b6ab6-0x0;var _0x371847=_0x4d29[_0x3b6ab6];return _0x371847;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x94d2('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x94d2('0x1'),'afterDestroy':'remove'};function emitEvent(_0x2cbbe8){return function(_0x3005e0,_0xbaad54,_0x551eda){MailMessageEvents[_0x94d2('0x2')](_0x2cbbe8+':'+_0x3005e0['id'],_0x3005e0);MailMessageEvents[_0x94d2('0x2')](_0x2cbbe8,_0x3005e0);_0x551eda(null);};}for(var e in events){if(events[_0x94d2('0x3')](e)){var event=events[e];MailMessage[_0x94d2('0x4')](e,emitEvent(event));}}module[_0x94d2('0x5')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index eed91cc..9c6fa60 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 _0xc466=['mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','isNil','UserId','findOne','MailInteractionId','then','catch','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage'];(function(_0x4a49e3,_0xa04db3){var _0x126278=function(_0x535242){while(--_0x535242){_0x4a49e3['push'](_0x4a49e3['shift']());}};_0x126278(++_0xa04db3);}(_0xc466,0x12a));var _0x6c46=function(_0x270c34,_0x4db5c9){_0x270c34=_0x270c34-0x0;var _0x4eccaf=_0xc466[_0x270c34];return _0x4eccaf;};'use strict';var _=require(_0x6c46('0x0'));var util=require(_0x6c46('0x1'));var logger=require('../../config/logger')(_0x6c46('0x2'));var moment=require('moment');var BPromise=require(_0x6c46('0x3'));var rp=require(_0x6c46('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x6c46('0x5'));var rimraf=require(_0x6c46('0x6'));var config=require(_0x6c46('0x7'));var attributes=require(_0x6c46('0x8'));module[_0x6c46('0x9')]=function(_0x5ed201,_0x3dc617){return _0x5ed201[_0x6c46('0xa')](_0x6c46('0xb'),attributes,{'tableName':_0x6c46('0xc'),'paranoid':![],'indexes':[{'name':_0x6c46('0xd'),'fields':[_0x6c46('0xd')]},{'name':_0x6c46('0xe'),'fields':[_0x6c46('0xf'),_0x6c46('0x10')],'type':_0x6c46('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5948d0,_0x5257a4,_0x83949){if(_0x5948d0[_0x6c46('0x12')]){_0x5948d0[_0x6c46('0xf')]=htmlToText[_0x6c46('0x13')](_0x5948d0[_0x6c46('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x83949(null,_0x5257a4);},'afterCreate':function(_0x29e35c,_0x2ed48b,_0x1de5c0){var _0x5dab6f=_0x5ed201[_0x6c46('0x14')];var _0x484082=_0x29e35c['get']({'plain':!![]});if(_0x484082[_0x6c46('0x15')][_0x6c46('0x16')]()==='in'||_0x484082['direction'][_0x6c46('0x16')]()===_0x6c46('0x17')&&!_0x484082['secret']&&!_[_0x6c46('0x18')](_0x484082[_0x6c46('0x19')])){_0x5dab6f['MailInteraction'][_0x6c46('0x1a')]({'where':{'id':_0x484082[_0x6c46('0x1b')]}})[_0x6c46('0x1c')](function(_0x5d4bcd){if(_0x5d4bcd){_0x5d4bcd['update']({'lastMsgAt':_0x484082['createdAt'],'lastMsgDirection':_0x484082[_0x6c46('0x15')][_0x6c46('0x16')]()});}})[_0x6c46('0x1d')](function(_0x4b1945){console['error'](_0x4b1945);});}_0x1de5c0();}},'charset':_0x6c46('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0e34=['plainBody','subject','body','fromString','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path','./mailMessage.attributes','exports','messageId','fti_mail_messages'];(function(_0x157cbe,_0x1175cd){var _0x7299de=function(_0x6e67bd){while(--_0x6e67bd){_0x157cbe['push'](_0x157cbe['shift']());}};_0x7299de(++_0x1175cd);}(_0x0e34,0xf4));var _0x40e3=function(_0x5e11bd,_0x28c83b){_0x5e11bd=_0x5e11bd-0x0;var _0x9a0cf0=_0x0e34[_0x5e11bd];return _0x9a0cf0;};'use strict';var _=require(_0x40e3('0x0'));var util=require(_0x40e3('0x1'));var logger=require(_0x40e3('0x2'))('api');var moment=require(_0x40e3('0x3'));var BPromise=require(_0x40e3('0x4'));var rp=require(_0x40e3('0x5'));var htmlToText=require(_0x40e3('0x6'));var fs=require('fs');var path=require(_0x40e3('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x40e3('0x8'));module[_0x40e3('0x9')]=function(_0x3aa3ee,_0x462d58){return _0x3aa3ee['define']('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x40e3('0xa'),'fields':[_0x40e3('0xa')]},{'name':_0x40e3('0xb'),'fields':[_0x40e3('0xc'),_0x40e3('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x483463,_0xc62682,_0x141427){if(_0x483463[_0x40e3('0xe')]){_0x483463['plainBody']=htmlToText[_0x40e3('0xf')](_0x483463[_0x40e3('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x141427(null,_0xc62682);},'afterCreate':function(_0x2048b9,_0x59fd9d,_0x2357ad){var _0x2e8d0b=_0x3aa3ee[_0x40e3('0x10')];var _0x5848c1=_0x2048b9[_0x40e3('0x11')]({'plain':!![]});if(_0x5848c1['direction'][_0x40e3('0x12')]()==='in'||_0x5848c1[_0x40e3('0x13')][_0x40e3('0x12')]()===_0x40e3('0x14')&&!_0x5848c1[_0x40e3('0x15')]&&!_[_0x40e3('0x16')](_0x5848c1[_0x40e3('0x17')])){_0x2e8d0b['MailInteraction'][_0x40e3('0x18')]({'where':{'id':_0x5848c1[_0x40e3('0x19')]}})[_0x40e3('0x1a')](function(_0x30adaf){if(_0x30adaf){_0x30adaf[_0x40e3('0x1b')]({'lastMsgAt':_0x5848c1[_0x40e3('0x1c')],'lastMsgDirection':_0x5848c1[_0x40e3('0x13')]['toLowerCase']()});}})[_0x40e3('0x1d')](function(_0x3a3c45){console['error'](_0x3a3c45);});}_0x2357ad();}},'charset':_0x40e3('0x1e'),'collate':_0x40e3('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index de7c9f1..a6cfca9 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 _0x351d=['rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x47c055,_0x29d3aa){var _0x5f4d02=function(_0x3c7413){while(--_0x3c7413){_0x47c055['push'](_0x47c055['shift']());}};_0x5f4d02(++_0x29d3aa);}(_0x351d,0x90));var _0xd351=function(_0x64763b,_0x59ecaa){_0x64763b=_0x64763b-0x0;var _0x59106f=_0x351d[_0x64763b];return _0x59106f;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});config['redis']=_[_0xd351('0xa')](config[_0xd351('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd351('0xc'))(new Redis(config[_0xd351('0xb')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x44bf81,_0x4904b4,_0x34cfc7){return new BPromise(function(_0x39b8c8,_0x5949a4){return client[_0xd351('0xd')](_0x44bf81,_0x34cfc7)[_0xd351('0xe')](function(_0x4ebca1){logger[_0xd351('0xf')]('MailMessage,\x20%s,\x20%s',_0x4904b4,'request\x20sent');logger[_0xd351('0x10')](_0xd351('0x11'),_0x4904b4,_0xd351('0x12'),JSON[_0xd351('0x13')](_0x4ebca1));if(_0x4ebca1['error']){if(_0x4ebca1[_0xd351('0x14')][_0xd351('0x15')]===0x1f4){logger['error'](_0xd351('0x16'),_0x4904b4,_0x4ebca1[_0xd351('0x14')][_0xd351('0x17')]);return _0x5949a4(_0x4ebca1[_0xd351('0x14')][_0xd351('0x17')]);}logger['error'](_0xd351('0x16'),_0x4904b4,_0x4ebca1['error']['message']);return _0x39b8c8(_0x4ebca1[_0xd351('0x14')]['message']);}else{logger[_0xd351('0xf')](_0xd351('0x16'),_0x4904b4,_0xd351('0x12'));_0x39b8c8(_0x4ebca1['result'][_0xd351('0x17')]);}})[_0xd351('0x18')](function(_0x77985a){logger[_0xd351('0x14')]('MailMessage,\x20%s,\x20%s',_0x4904b4,_0x77985a);_0x5949a4(_0x77985a);});});}exports[_0xd351('0x19')]=function(_0x4abbed){var _0x48fa9b=this;return new Promise(function(_0x37d3ac,_0x4a427b){return db[_0xd351('0x1a')][_0xd351('0x1b')](_0x4abbed[_0xd351('0x1c')],{'raw':_0x4abbed[_0xd351('0x1d')]?_0x4abbed[_0xd351('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xd351('0xe')](function(_0xbbc58){logger[_0xd351('0xf')]('CreateMailMessage',_0x4abbed);logger[_0xd351('0x10')](_0xd351('0x19'),_0x4abbed,JSON[_0xd351('0x13')](_0xbbc58));_0x37d3ac(_0xbbc58);})['catch'](function(_0x1ce279){logger[_0xd351('0x14')](_0xd351('0x19'),_0x1ce279[_0xd351('0x17')],_0x4abbed);_0x4a427b(_0x48fa9b['error'](0x1f4,_0x1ce279[_0xd351('0x17')]));});});}; \ No newline at end of file +var _0x8f59=['redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','create','body','options','raw','then','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x16e690,_0x5d4683){var _0x3beb56=function(_0x547cf5){while(--_0x547cf5){_0x16e690['push'](_0x16e690['shift']());}};_0x3beb56(++_0x5d4683);}(_0x8f59,0x11d));var _0x98f5=function(_0x3727ae,_0x165f88){_0x3727ae=_0x3727ae-0x0;var _0x1c3f01=_0x8f59[_0x3727ae];return _0x1c3f01;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});config[_0x98f5('0xc')]=_['defaults'](config['redis'],{'host':_0x98f5('0xd'),'port':0x18eb});var socket=require(_0x98f5('0xe'))(new Redis(config[_0x98f5('0xc')]));require('./mailMessage.socket')[_0x98f5('0xf')](socket);function respondWithRpcPromise(_0x31b669,_0x227cf3,_0x39e85d){return new BPromise(function(_0x4c4abc,_0x26a0fc){return client['request'](_0x31b669,_0x39e85d)['then'](function(_0x3cf4b2){logger[_0x98f5('0x10')]('MailMessage,\x20%s,\x20%s',_0x227cf3,_0x98f5('0x11'));logger[_0x98f5('0x12')](_0x98f5('0x13'),_0x227cf3,_0x98f5('0x11'),JSON[_0x98f5('0x14')](_0x3cf4b2));if(_0x3cf4b2[_0x98f5('0x15')]){if(_0x3cf4b2['error'][_0x98f5('0x16')]===0x1f4){logger[_0x98f5('0x15')]('MailMessage,\x20%s,\x20%s',_0x227cf3,_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);return _0x26a0fc(_0x3cf4b2[_0x98f5('0x15')]['message']);}logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x3cf4b2[_0x98f5('0x15')]['message']);return _0x4c4abc(_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);}else{logger['info'](_0x98f5('0x18'),_0x227cf3,'request\x20sent');_0x4c4abc(_0x3cf4b2[_0x98f5('0x19')][_0x98f5('0x17')]);}})[_0x98f5('0x1a')](function(_0x11b6d4){logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x11b6d4);_0x26a0fc(_0x11b6d4);});});}exports['CreateMailMessage']=function(_0xf88f34){var _0x5500a2=this;return new Promise(function(_0xd1209d,_0x191f23){return db['MailMessage'][_0x98f5('0x1b')](_0xf88f34[_0x98f5('0x1c')],{'raw':_0xf88f34[_0x98f5('0x1d')]?_0xf88f34[_0x98f5('0x1d')][_0x98f5('0x1e')]===undefined?!![]:![]:!![]})[_0x98f5('0x1f')](function(_0x38b46d){logger['info'](_0x98f5('0x20'),_0xf88f34);logger['debug'](_0x98f5('0x20'),_0xf88f34,JSON['stringify'](_0x38b46d));_0xd1209d(_0x38b46d);})[_0x98f5('0x1a')](function(_0x40c69b){logger[_0x98f5('0x15')](_0x98f5('0x20'),_0x40c69b[_0x98f5('0x17')],_0xf88f34);_0x191f23(_0x5500a2[_0x98f5('0x15')](0x1f4,_0x40c69b[_0x98f5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index f9a98b7..72d29c6 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 _0xbe1e=['register','length','./mailMessage.events','remove','update','emit'];(function(_0x55d70d,_0x32fa55){var _0x41dbc4=function(_0x16c38c){while(--_0x16c38c){_0x55d70d['push'](_0x55d70d['shift']());}};_0x41dbc4(++_0x32fa55);}(_0xbe1e,0xf8));var _0xebe1=function(_0x197272,_0x1deba3){_0x197272=_0x197272-0x0;var _0x16da9d=_0xbe1e[_0x197272];return _0x16da9d;};'use strict';var MailMessageEvents=require(_0xebe1('0x0'));var events=['save',_0xebe1('0x1'),_0xebe1('0x2')];function createListener(_0x4f2774,_0x3d4e47){return function(_0x4dde38){_0x3d4e47[_0xebe1('0x3')](_0x4f2774,_0x4dde38);};}function removeListener(_0x2ce061,_0x50f23b){return function(){MailMessageEvents['removeListener'](_0x2ce061,_0x50f23b);};}exports[_0xebe1('0x4')]=function(_0x4d6eed){for(var _0x4237f7=0x0,_0x2dd3f5=events[_0xebe1('0x5')];_0x4237f7<_0x2dd3f5;_0x4237f7++){var _0x4fed16=events[_0x4237f7];var _0xcdf421=createListener('mailMessage:'+_0x4fed16,_0x4d6eed);MailMessageEvents['on'](_0x4fed16,_0xcdf421);}}; \ No newline at end of file +var _0x64c4=['update','emit','removeListener','register','length','./mailMessage.events','save'];(function(_0xc8f398,_0x181b18){var _0x531f9d=function(_0x5b872b){while(--_0x5b872b){_0xc8f398['push'](_0xc8f398['shift']());}};_0x531f9d(++_0x181b18);}(_0x64c4,0x155));var _0x464c=function(_0x407145,_0x27938e){_0x407145=_0x407145-0x0;var _0x3a2580=_0x64c4[_0x407145];return _0x3a2580;};'use strict';var MailMessageEvents=require(_0x464c('0x0'));var events=[_0x464c('0x1'),'remove',_0x464c('0x2')];function createListener(_0x39b513,_0x5887b4){return function(_0x246dbf){_0x5887b4[_0x464c('0x3')](_0x39b513,_0x246dbf);};}function removeListener(_0x5816da,_0x1ec016){return function(){MailMessageEvents[_0x464c('0x4')](_0x5816da,_0x1ec016);};}exports[_0x464c('0x5')]=function(_0x4dd936){for(var _0x179641=0x0,_0x2613e5=events[_0x464c('0x6')];_0x179641<_0x2613e5;_0x179641++){var _0x114b37=events[_0x179641];var _0x529bec=createListener('mailMessage:'+_0x114b37,_0x4dd936);MailMessageEvents['on'](_0x114b37,_0x529bec);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c988e03..77f3ee6 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 _0x7bda=['index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x5941d4,_0x87102){var _0xcfd015=function(_0x45ae77){while(--_0x45ae77){_0x5941d4['push'](_0x5941d4['shift']());}};_0xcfd015(++_0x87102);}(_0x7bda,0x122));var _0xa7bd=function(_0x3eb084,_0x32d225){_0x3eb084=_0x3eb084-0x0;var _0x389edf=_0x7bda[_0x3eb084];return _0x389edf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa7bd('0x0'));var timeout=require(_0xa7bd('0x1'));var express=require(_0xa7bd('0x2'));var router=express[_0xa7bd('0x3')]();var fs_extra=require(_0xa7bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa7bd('0x5'));var config=require(_0xa7bd('0x6'));var controller=require(_0xa7bd('0x7'));router[_0xa7bd('0x8')]('/',auth[_0xa7bd('0x9')](),controller[_0xa7bd('0xa')]);router['get'](_0xa7bd('0xb'),auth[_0xa7bd('0x9')](),controller[_0xa7bd('0xc')]);router[_0xa7bd('0x8')](_0xa7bd('0xd'),auth[_0xa7bd('0x9')](),controller[_0xa7bd('0xe')]);router[_0xa7bd('0x8')](_0xa7bd('0xf'),auth[_0xa7bd('0x9')](),controller[_0xa7bd('0x10')]);router['get'](_0xa7bd('0x11'),auth[_0xa7bd('0x9')](),controller[_0xa7bd('0x12')]);router[_0xa7bd('0x8')](_0xa7bd('0x13'),auth[_0xa7bd('0x9')](),controller[_0xa7bd('0x14')]);router[_0xa7bd('0x15')]('/',auth[_0xa7bd('0x9')](),controller[_0xa7bd('0x16')]);router[_0xa7bd('0x15')](_0xa7bd('0x11'),auth[_0xa7bd('0x9')](),controller[_0xa7bd('0x17')]);router['post'](_0xa7bd('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa7bd('0x18')]('/:id',auth[_0xa7bd('0x9')](),controller[_0xa7bd('0x19')]);router[_0xa7bd('0x1a')](_0xa7bd('0xd'),auth[_0xa7bd('0x9')](),controller[_0xa7bd('0x1b')]);router[_0xa7bd('0x1a')](_0xa7bd('0x11'),auth[_0xa7bd('0x9')](),controller[_0xa7bd('0x1c')]);router[_0xa7bd('0x1a')](_0xa7bd('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa7bd('0x1d')]=router; \ No newline at end of file +var _0x041e=['index','/describe','isAuthenticated','describe','/:id','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x041e,0x135));var _0xe041=function(_0x1943e7,_0x4cf8a0){_0x1943e7=_0x1943e7-0x0;var _0x35f579=_0x041e[_0x1943e7];return _0x35f579;};'use strict';var multer=require(_0xe041('0x0'));var util=require(_0xe041('0x1'));var path=require(_0xe041('0x2'));var timeout=require(_0xe041('0x3'));var express=require(_0xe041('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe041('0x5'));var interaction=require(_0xe041('0x6'));var config=require(_0xe041('0x7'));var controller=require(_0xe041('0x8'));router[_0xe041('0x9')]('/',auth['isAuthenticated'](),controller[_0xe041('0xa')]);router[_0xe041('0x9')](_0xe041('0xb'),auth[_0xe041('0xc')](),controller[_0xe041('0xd')]);router['get'](_0xe041('0xe'),auth[_0xe041('0xc')](),controller['show']);router[_0xe041('0x9')]('/:id/members',auth[_0xe041('0xc')](),controller['getMembers']);router[_0xe041('0x9')](_0xe041('0xf'),auth[_0xe041('0xc')](),controller[_0xe041('0x10')]);router[_0xe041('0x9')]('/:id/users',auth[_0xe041('0xc')](),controller[_0xe041('0x11')]);router[_0xe041('0x12')]('/',auth[_0xe041('0xc')](),controller['create']);router[_0xe041('0x12')]('/:id/teams',auth[_0xe041('0xc')](),controller[_0xe041('0x13')]);router['post'](_0xe041('0x14'),auth[_0xe041('0xc')](),controller[_0xe041('0x15')]);router[_0xe041('0x16')](_0xe041('0xe'),auth[_0xe041('0xc')](),controller[_0xe041('0x17')]);router['delete'](_0xe041('0xe'),auth[_0xe041('0xc')](),controller[_0xe041('0x18')]);router['delete']('/:id/teams',auth[_0xe041('0xc')](),controller[_0xe041('0x19')]);router[_0xe041('0x1a')](_0xe041('0x14'),auth[_0xe041('0xc')](),controller[_0xe041('0x1b')]);module[_0xe041('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7e6ec0e..43efe83 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 _0xb87a=['roundrobin','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x5bd89d,_0x44c858){var _0x128907=function(_0x4919b9){while(--_0x4919b9){_0x5bd89d['push'](_0x5bd89d['shift']());}};_0x128907(++_0x44c858);}(_0xb87a,0xe1));var _0xab87=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb87a[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require('sequelize');module[_0xab87('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xab87('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab87('0x2')]},'timeout':{'type':Sequelize[_0xab87('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xab87('0x4'),_0xab87('0x5'),_0xab87('0x6'))}}; \ No newline at end of file +var _0xfc2e=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x4e462d,_0x2c20ad){var _0x5289cf=function(_0x38f4ef){while(--_0x38f4ef){_0x4e462d['push'](_0x4e462d['shift']());}};_0x5289cf(++_0x2c20ad);}(_0xfc2e,0x9a));var _0xefc2=function(_0x7b124c,_0x626296){_0x7b124c=_0x7b124c-0x0;var _0x33ec83=_0xfc2e[_0x7b124c];return _0x33ec83;};'use strict';var Sequelize=require(_0xefc2('0x0'));module[_0xefc2('0x1')]={'name':{'type':Sequelize[_0xefc2('0x2')],'unique':_0xefc2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xefc2('0x2')]},'timeout':{'type':Sequelize[_0xefc2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xefc2('0x5'),_0xefc2('0x6'),_0xefc2('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 394a3d1..24ba61f 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 _0xf945=['clone','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction','removeTeams','emit','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','localhost','redis','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','MailQueues','UserProfileResource','end','name','map','MailQueue','fieldName','type','key','where','include','query','catch','show','model','keys','filters','intersection','attributes','fields','length','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserMailQueue','rawAttributes','nolimit','order','sort','pick','MailQueueId','filter','findAll','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?'];(function(_0xab074a,_0x471549){var _0x58b309=function(_0x5e9a35){while(--_0x5e9a35){_0xab074a['push'](_0xab074a['shift']());}};_0x58b309(++_0x471549);}(_0xf945,0x8c));var _0x5f94=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf945[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require(_0x5f94('0x0'));var util=require(_0x5f94('0x1'));var _=require(_0x5f94('0x2'));var squel=require(_0x5f94('0x3'));var Redis=require(_0x5f94('0x4'));var qs=require(_0x5f94('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x5f94('0x6'));var db=require(_0x5f94('0x7'))['db'];config['redis']=_[_0x5f94('0x8')](config['redis'],{'host':_0x5f94('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f94('0xa')]));require(_0x5f94('0xb'))[_0x5f94('0xc')](socket);function respondWithStatusCode(_0x1a6e9e,_0x18c755){_0x18c755=_0x18c755||0xcc;return function(_0x210ff4){if(_0x210ff4){return _0x1a6e9e[_0x5f94('0xd')](_0x18c755);}return _0x1a6e9e[_0x5f94('0xe')](_0x18c755)['end']();};}function respondWithResult(_0x187ed4,_0x4181e6){_0x4181e6=_0x4181e6||0xc8;return function(_0x4a06e2){if(_0x4a06e2){return _0x187ed4[_0x5f94('0xe')](_0x4181e6)[_0x5f94('0xf')](_0x4a06e2);}};}function respondWithFilteredResult(_0x46b6a0,_0x1b7332){return function(_0x5bf742){if(_0x5bf742){var _0xa759c=typeof _0x1b7332[_0x5f94('0x10')]===_0x5f94('0x11')&&typeof _0x1b7332[_0x5f94('0x12')]===_0x5f94('0x11');var _0x5d903d=_0x5bf742[_0x5f94('0x13')];var _0xc2d926=_0xa759c?0x0:_0x1b7332[_0x5f94('0x10')];var _0x572e4d=_0xa759c?_0x5bf742['count']:_0x1b7332[_0x5f94('0x10')]+_0x1b7332[_0x5f94('0x12')];var _0x3ab307;if(_0x572e4d>=_0x5d903d){_0x572e4d=_0x5d903d;_0x3ab307=0xc8;}else{_0x3ab307=0xce;}_0x46b6a0[_0x5f94('0xe')](_0x3ab307);return _0x46b6a0[_0x5f94('0x14')](_0x5f94('0x15'),_0xc2d926+'-'+_0x572e4d+'/'+_0x5d903d)[_0x5f94('0xf')](_0x5bf742);}return null;};}function saveUpdates(_0x206f89){return function(_0x25ef7d){if(_0x25ef7d){return _0x25ef7d['update'](_0x206f89)[_0x5f94('0x16')](function(_0x559750){return _0x559750;});}return null;};}function removeEntity(_0x411fca){return function(_0x11756f){if(_0x11756f){return _0x11756f[_0x5f94('0x17')]()[_0x5f94('0x16')](function(){var _0x4b54ab=_0x11756f[_0x5f94('0x18')]({'plain':!![]});var _0x251631=_0x5f94('0x19');return db[_0x5f94('0x1a')][_0x5f94('0x17')]({'where':{'type':_0x251631,'resourceId':_0x4b54ab['id']}})['then'](function(){return _0x11756f;});})[_0x5f94('0x16')](function(){_0x411fca[_0x5f94('0xe')](0xcc)[_0x5f94('0x1b')]();});}};}function handleEntityNotFound(_0x450d1f){return function(_0x303e36){if(!_0x303e36){_0x450d1f[_0x5f94('0xd')](0x194);}return _0x303e36;};}function handleError(_0x441354,_0x28c8d1){_0x28c8d1=_0x28c8d1||0x1f4;return function(_0x26b41c){logger['error'](_0x26b41c['stack']);if(_0x26b41c[_0x5f94('0x1c')]){delete _0x26b41c[_0x5f94('0x1c')];}_0x441354['status'](_0x28c8d1)['send'](_0x26b41c);};}exports['index']=function(_0x42f99e,_0x30ad2f){var _0x21355b={};var _0x2a37da={'count':0x0,'rows':[]};var _0x5089aa=_[_0x5f94('0x1d')](db[_0x5f94('0x1e')]['rawAttributes'],function(_0x469e4d){return{'name':_0x469e4d[_0x5f94('0x1f')],'type':_0x469e4d[_0x5f94('0x20')][_0x5f94('0x21')]};});_0x21355b=qs['getOptions'](_0x5089aa,_0x42f99e);var _0x4a9b57={'where':_0x21355b[_0x5f94('0x22')]};return db[_0x5f94('0x1e')][_0x5f94('0x13')](_0x4a9b57)[_0x5f94('0x16')](function(_0x499eb4){_0x2a37da['count']=_0x499eb4;_0x21355b['include']=qs[_0x5f94('0x23')](_0x42f99e[_0x5f94('0x24')]);return db['MailQueue']['findAll'](_0x21355b);})[_0x5f94('0x16')](function(_0x4eb0de){_0x2a37da['rows']=_0x4eb0de;return _0x2a37da;})[_0x5f94('0x16')](respondWithFilteredResult(_0x30ad2f,_0x21355b))[_0x5f94('0x25')](handleError(_0x30ad2f,null));};exports[_0x5f94('0x26')]=function(_0x39af37,_0x502fbe){var _0x133fb4={'raw':!![],'where':{'id':_0x39af37['params']['id']}},_0x315f8b={};_0x315f8b[_0x5f94('0x27')]=_[_0x5f94('0x28')](db[_0x5f94('0x1e')]['rawAttributes']);_0x315f8b[_0x5f94('0x24')]=_['keys'](_0x39af37[_0x5f94('0x24')]);_0x315f8b[_0x5f94('0x29')]=_[_0x5f94('0x2a')](_0x315f8b[_0x5f94('0x27')],_0x315f8b['query']);_0x133fb4[_0x5f94('0x2b')]=_[_0x5f94('0x2a')](_0x315f8b[_0x5f94('0x27')],qs['fields'](_0x39af37[_0x5f94('0x24')][_0x5f94('0x2c')]));_0x133fb4[_0x5f94('0x2b')]=_0x133fb4[_0x5f94('0x2b')][_0x5f94('0x2d')]?_0x133fb4[_0x5f94('0x2b')]:_0x315f8b['model'];if(_0x39af37[_0x5f94('0x24')]['includeAll']){_0x133fb4[_0x5f94('0x23')]=[{'all':!![]}];}_0x133fb4=_[_0x5f94('0x2e')]({},_0x133fb4,_0x39af37[_0x5f94('0x2f')]);return db[_0x5f94('0x1e')][_0x5f94('0x30')](_0x133fb4)[_0x5f94('0x16')](handleEntityNotFound(_0x502fbe,null))['then'](respondWithResult(_0x502fbe,null))[_0x5f94('0x25')](handleError(_0x502fbe,null));};exports[_0x5f94('0x31')]=function(_0x41a039,_0x1d6340){return db[_0x5f94('0x1e')]['create'](_0x41a039[_0x5f94('0x32')],{})[_0x5f94('0x16')](function(_0x1bc426){var _0x307268=_0x41a039[_0x5f94('0x33')][_0x5f94('0x18')]({'plain':!![]});if(!_0x307268)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x307268[_0x5f94('0x34')]===_0x5f94('0x33')){var _0x4f337e=_0x1bc426['get']({'plain':!![]});var _0x70be2b=_0x5f94('0x19');return db[_0x5f94('0x35')][_0x5f94('0x30')]({'where':{'name':_0x70be2b,'userProfileId':_0x307268[_0x5f94('0x36')]},'raw':!![]})['then'](function(_0x335b8b){if(_0x335b8b&&_0x335b8b[_0x5f94('0x37')]===0x0){return db[_0x5f94('0x1a')][_0x5f94('0x31')]({'name':_0x4f337e[_0x5f94('0x1c')],'resourceId':_0x4f337e['id'],'type':_0x335b8b[_0x5f94('0x1c')],'sectionId':_0x335b8b['id']},{})['then'](function(){return _0x1bc426;});}else{return _0x1bc426;}})['catch'](function(_0x3f61f1){logger['error'](_0x5f94('0x38'),_0x3f61f1);throw _0x3f61f1;});}return _0x1bc426;})[_0x5f94('0x16')](respondWithResult(_0x1d6340,0xc9))[_0x5f94('0x25')](handleError(_0x1d6340,null));};exports['update']=function(_0x4accc8,_0x45f74b){if(_0x4accc8[_0x5f94('0x32')]['id']){delete _0x4accc8[_0x5f94('0x32')]['id'];}return db[_0x5f94('0x1e')][_0x5f94('0x30')]({'where':{'id':_0x4accc8['params']['id']}})['then'](handleEntityNotFound(_0x45f74b,null))[_0x5f94('0x16')](saveUpdates(_0x4accc8[_0x5f94('0x32')],null))[_0x5f94('0x16')](respondWithResult(_0x45f74b,null))[_0x5f94('0x25')](handleError(_0x45f74b,null));};exports['destroy']=function(_0x5cc531,_0x59025f){return db[_0x5f94('0x1e')][_0x5f94('0x30')]({'where':{'id':_0x5cc531[_0x5f94('0x39')]['id']}})[_0x5f94('0x16')](handleEntityNotFound(_0x59025f,null))['then'](removeEntity(_0x59025f,null))[_0x5f94('0x25')](handleError(_0x59025f,null));};exports[_0x5f94('0x3a')]=function(_0x1414a7,_0x4dfa11){return db[_0x5f94('0x1e')][_0x5f94('0x3a')]()[_0x5f94('0x16')](respondWithResult(_0x4dfa11,null))[_0x5f94('0x25')](handleError(_0x4dfa11,null));};exports[_0x5f94('0x3b')]=function(_0x4fcf88,_0x3189da){var _0x517578={'raw':!![],'where':{}},_0x539a4b={},_0x4df9df;return db[_0x5f94('0x1e')]['findOne']({'where':{'id':_0x4fcf88[_0x5f94('0x39')]['id']}})['then'](handleEntityNotFound(_0x3189da,null))[_0x5f94('0x16')](function(_0x34193a){if(_0x34193a){_0x4df9df=_0x34193a[_0x5f94('0x18')]({'plain':!![]});_0x539a4b[_0x5f94('0x27')]=_['keys'](db[_0x5f94('0x3c')][_0x5f94('0x3d')]);_0x539a4b['query']=_[_0x5f94('0x28')](_0x4fcf88['query']);_0x539a4b['filters']=_['intersection'](_0x539a4b['model'],_0x539a4b[_0x5f94('0x24')]);_0x517578[_0x5f94('0x2b')]=_[_0x5f94('0x2a')](_0x539a4b['model'],qs['fields'](_0x4fcf88['query']['fields']));_0x517578[_0x5f94('0x2b')]=_0x517578[_0x5f94('0x2b')][_0x5f94('0x2d')]?_0x517578[_0x5f94('0x2b')]:_0x539a4b['model'];if(!_0x4fcf88[_0x5f94('0x24')]['hasOwnProperty'](_0x5f94('0x3e'))){_0x517578['limit']=qs[_0x5f94('0x12')](_0x4fcf88[_0x5f94('0x24')][_0x5f94('0x12')]);_0x517578[_0x5f94('0x10')]=qs[_0x5f94('0x10')](_0x4fcf88[_0x5f94('0x24')][_0x5f94('0x10')]);}_0x517578[_0x5f94('0x3f')]=qs[_0x5f94('0x40')](_0x4fcf88['query'][_0x5f94('0x40')]);_0x517578[_0x5f94('0x22')]=qs[_0x5f94('0x29')](_[_0x5f94('0x41')](_0x4fcf88[_0x5f94('0x24')],_0x539a4b[_0x5f94('0x29')]));_0x517578['where'][_0x5f94('0x42')]=_0x34193a['id'];if(_0x4fcf88[_0x5f94('0x24')][_0x5f94('0x43')]){_0x517578[_0x5f94('0x22')]=_[_0x5f94('0x2e')](_0x517578[_0x5f94('0x22')],{'$or':_[_0x5f94('0x1d')](_0x517578[_0x5f94('0x2b')],function(_0x2d79bd){var _0x46a91c={};_0x46a91c[_0x2d79bd]={'$like':'%'+_0x4fcf88[_0x5f94('0x24')]['filter']+'%'};return _0x46a91c;})});}_0x517578=_[_0x5f94('0x2e')]({},_0x517578,_0x4fcf88[_0x5f94('0x2f')]);return db['UserMailQueue'][_0x5f94('0x44')](_0x517578);}})[_0x5f94('0x16')](function(_0x1c7651){if(_0x1c7651){return db[_0x5f94('0x45')][_0x5f94('0x46')]({'where':{'id':_[_0x5f94('0x1d')](_0x1c7651,'UserId'),'role':_0x5f94('0x47')},'attributes':['id',_0x5f94('0x1c'),_0x5f94('0x48'),_0x5f94('0x49'),_0x5f94('0x4a')]});}})['then'](function(_0x5c6fb4){if(_0x5c6fb4){return{'count':_0x5c6fb4[_0x5f94('0x13')],'rows':_['map'](_0x5c6fb4['rows'],function(_0x536e53){return{'membername':_0x536e53[_0x5f94('0x1c')],'UserId':_0x536e53['id'],'queue_name':_0x4df9df[_0x5f94('0x1c')],'MailQueueId':_0x4df9df['id'],'interface':util[_0x5f94('0x4b')](_0x5f94('0x4c'),'SIP',_0x536e53[_0x5f94('0x1c')]),'penalty':0x0,'paused':_0x536e53['mailPause'],'createdAt':_0x536e53[_0x5f94('0x4a')],'updatedAt':_0x536e53[_0x5f94('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3189da,_0x517578))['catch'](handleError(_0x3189da,null));};exports[_0x5f94('0x4d')]=function(_0x120275,_0x1f335f){var _0x2f5f4f={};var _0x173755={};var _0x19e612;var _0x4b6bae;return db[_0x5f94('0x1e')][_0x5f94('0x4e')]({'where':{'id':_0x120275['params']['id']}})[_0x5f94('0x16')](handleEntityNotFound(_0x1f335f,null))[_0x5f94('0x16')](function(_0x3bfec5){if(_0x3bfec5){_0x19e612=_0x3bfec5;_0x173755[_0x5f94('0x27')]=_['keys'](db[_0x5f94('0x4f')][_0x5f94('0x3d')]);_0x173755[_0x5f94('0x24')]=_['keys'](_0x120275[_0x5f94('0x24')]);_0x173755['filters']=_[_0x5f94('0x2a')](_0x173755[_0x5f94('0x27')],_0x173755['query']);_0x2f5f4f[_0x5f94('0x2b')]=_[_0x5f94('0x2a')](_0x173755[_0x5f94('0x27')],qs[_0x5f94('0x2c')](_0x120275[_0x5f94('0x24')][_0x5f94('0x2c')]));_0x2f5f4f[_0x5f94('0x2b')]=_0x2f5f4f['attributes'][_0x5f94('0x2d')]?_0x2f5f4f[_0x5f94('0x2b')]:_0x173755['model'];_0x2f5f4f[_0x5f94('0x3f')]=qs[_0x5f94('0x40')](_0x120275['query']['sort']);_0x2f5f4f[_0x5f94('0x22')]=qs[_0x5f94('0x29')](_['pick'](_0x120275['query'],_0x173755[_0x5f94('0x29')]));if(_0x120275[_0x5f94('0x24')]['filter']){_0x2f5f4f[_0x5f94('0x22')]=_[_0x5f94('0x2e')](_0x2f5f4f['where'],{'$or':_[_0x5f94('0x1d')](_0x2f5f4f[_0x5f94('0x2b')],function(_0x3ca18f){var _0x133510={};_0x133510[_0x3ca18f]={'$like':'%'+_0x120275[_0x5f94('0x24')][_0x5f94('0x43')]+'%'};return _0x133510;})});}_0x2f5f4f=_[_0x5f94('0x2e')]({},_0x2f5f4f,_0x120275['options']);return _0x19e612[_0x5f94('0x4d')](_0x2f5f4f);}})[_0x5f94('0x16')](function(_0x2e0b28){if(_0x2e0b28){_0x4b6bae=_0x2e0b28[_0x5f94('0x2d')];if(!_0x120275[_0x5f94('0x24')][_0x5f94('0x50')](_0x5f94('0x3e'))){_0x2f5f4f[_0x5f94('0x12')]=qs['limit'](_0x120275[_0x5f94('0x24')]['limit']);_0x2f5f4f['offset']=qs[_0x5f94('0x10')](_0x120275[_0x5f94('0x24')]['offset']);}return _0x19e612[_0x5f94('0x4d')](_0x2f5f4f);}})[_0x5f94('0x16')](function(_0x59feca){if(_0x59feca){return _0x59feca?{'count':_0x4b6bae,'rows':_0x59feca}:null;}})[_0x5f94('0x16')](respondWithResult(_0x1f335f,null))[_0x5f94('0x25')](handleError(_0x1f335f,null));};exports[_0x5f94('0x51')]=function(_0x1aa1cc,_0x50d4cd){var _0x14a2df=_0x1aa1cc['body'][_0x5f94('0x52')];return db['Team'][_0x5f94('0x44')]({'where':{'id':_0x14a2df},'attributes':['id'],'include':[{'model':db[_0x5f94('0x45')],'as':_0x5f94('0x53'),'attributes':['id','name',_0x5f94('0x54'),_0x5f94('0x55'),_0x5f94('0x56')],'raw':!![]}]})[_0x5f94('0x16')](function(_0x5dfaaa){if(_0x5dfaaa){var _0x22372c=_[_0x5f94('0x57')](_0x5dfaaa,function(_0x316c1e){var _0x5d619e=_0x316c1e['get']({'plain':!![]});return _0x5d619e[_0x5f94('0x53')];});return db[_0x5f94('0x1e')][_0x5f94('0x30')]({'where':{'id':_0x1aa1cc[_0x5f94('0x39')]['id']}})[_0x5f94('0x16')](function(_0x4fa4ce){return db[_0x5f94('0x58')]['transaction'](function(_0x185217){return _0x4fa4ce[_0x5f94('0x51')](_0x14a2df,{'transaction':_0x185217})['then'](function(){return BPromise[_0x5f94('0x59')](_0x22372c,function(_0x35decc){return db[_0x5f94('0x3c')][_0x5f94('0x5a')]({'where':{'UserId':_0x35decc['id'],'MailQueueId':_0x1aa1cc[_0x5f94('0x39')]['id']},'transaction':_0x185217});});})[_0x5f94('0x16')](function(){_0x22372c[_0x5f94('0x5b')](function(_0x394986){socket['emit'](_0x5f94('0x5c'),{'UserId':_0x394986['id'],'MailQueueId':_0x4fa4ce['id']});});});});});}})['then'](respondWithStatusCode(_0x50d4cd,null))[_0x5f94('0x25')](handleError(_0x50d4cd,null));};exports['removeTeams']=function(_0x1f19e8,_0x5efe1d){return db[_0x5f94('0x4f')]['findAll']({'where':{'id':_0x1f19e8[_0x5f94('0x24')][_0x5f94('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5f94('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5efe1d,null))['then'](function(_0x49febb){var _0x377244=_[_0x5f94('0x1d')](_0x49febb,'id');var _0x308e63=[];var _0xf51ce6=[];var _0x1ace0a=squel[_0x5f94('0x5d')]();_0x1ace0a[_0x5f94('0x5e')](_0x5f94('0x5f'))[_0x5f94('0x60')](_0x5f94('0x61'),'tq')[_0x5f94('0x62')](_0x5f94('0x63'),'ut',_0x5f94('0x64'))[_0x5f94('0x22')](_0x5f94('0x65'),_0x1f19e8[_0x5f94('0x39')]['id']);for(var _0x1d5074=0x0;_0x1d5074<_0x49febb['length'];_0x1d5074+=0x1){let _0x3db431=_0x49febb[_0x1d5074];for(var _0x1bc19c=0x0;_0x1bc19c<_0x3db431[_0x5f94('0x53')][_0x5f94('0x2d')];_0x1bc19c+=0x1){let _0x52d9d5=_0x3db431['Agents'][_0x1bc19c];var _0x528aac=_0x1ace0a[_0x5f94('0x66')]();_0x528aac[_0x5f94('0x22')]('ut.UserId\x20=\x20?',_0x52d9d5['id']);_0xf51ce6['push'](db[_0x5f94('0x58')]['query'](_0x528aac[_0x5f94('0x67')](),{'type':db[_0x5f94('0x58')][_0x5f94('0x68')][_0x5f94('0x69')]})[_0x5f94('0x16')](function(_0x2320c8){if(_0x2320c8['length']===0x1){return _0x52d9d5['id'];}else{var _0x25220b=_[_0x5f94('0x6a')](_[_0x5f94('0x1d')](_0x2320c8,_0x5f94('0x6b')),function(_0xe474f6){return _[_0x5f94('0x6c')](_0x377244,_0xe474f6);});if(_0x25220b){return _0x52d9d5['id'];}}}));}}return BPromise['all'](_0xf51ce6)[_0x5f94('0x16')](function(_0x314f10){_0x308e63=_(_0x308e63)[_0x5f94('0x6d')](_0x314f10)[_0x5f94('0x6e')]()['value']();return db[_0x5f94('0x1e')][_0x5f94('0x30')]({'where':{'id':_0x1f19e8[_0x5f94('0x39')]['id']}})['then'](function(_0x3f6fb0){return db['sequelize'][_0x5f94('0x6f')](function(_0x283edd){return _0x3f6fb0[_0x5f94('0x70')](_0x1f19e8['query'][_0x5f94('0x52')],{'transaction':_0x283edd})[_0x5f94('0x16')](function(){if(!_['isEmpty'](_0x308e63)){return _0x3f6fb0['removeAgents'](_0x308e63,{'transaction':_0x283edd});}})[_0x5f94('0x16')](function(){_0x308e63['forEach'](function(_0x4fa7ff){socket[_0x5f94('0x71')](_0x5f94('0x72'),{'UserId':_0x4fa7ff,'MailQueueId':_0x3f6fb0['id']});});});});});});})['then'](respondWithStatusCode(_0x5efe1d,null))[_0x5f94('0x25')](handleError(_0x5efe1d,null));};exports[_0x5f94('0x73')]=function(_0x52b745,_0x5700ab){return db[_0x5f94('0x1e')][_0x5f94('0x30')]({'where':{'id':_0x52b745[_0x5f94('0x39')]['id']}})[_0x5f94('0x16')](handleEntityNotFound(_0x5700ab,null))['then'](function(_0x2187d1){if(_0x2187d1){return _0x2187d1['addAgents'](_0x52b745[_0x5f94('0x32')][_0x5f94('0x52')],_[_0x5f94('0x74')](_0x52b745[_0x5f94('0x32')],[_0x5f94('0x52'),'id'])||{})[_0x5f94('0x75')](function(_0x474268){for(var _0x1d09d9=0x0;_0x1d09d9<_0x52b745[_0x5f94('0x32')]['ids'][_0x5f94('0x2d')];_0x1d09d9+=0x1){socket[_0x5f94('0x71')](_0x5f94('0x5c'),{'UserId':Number(_0x52b745[_0x5f94('0x32')][_0x5f94('0x52')][_0x1d09d9]),'MailQueueId':Number(_0x52b745['params']['id'])});}return _0x474268;});}})[_0x5f94('0x16')](respondWithResult(_0x5700ab,null))[_0x5f94('0x25')](handleError(_0x5700ab,null));};exports[_0x5f94('0x76')]=function(_0x2410d8,_0x1fa487){return db[_0x5f94('0x1e')][_0x5f94('0x30')]({'where':{'id':_0x2410d8[_0x5f94('0x39')]['id']}})[_0x5f94('0x16')](handleEntityNotFound(_0x1fa487,null))[_0x5f94('0x16')](function(_0x1cedf3){if(_0x1cedf3){return _0x1cedf3[_0x5f94('0x76')](_0x2410d8[_0x5f94('0x24')][_0x5f94('0x52')])[_0x5f94('0x16')](function(){if(_[_0x5f94('0x77')](_0x2410d8[_0x5f94('0x24')][_0x5f94('0x52')])){for(var _0x25e206=0x0;_0x25e206<_0x2410d8[_0x5f94('0x24')][_0x5f94('0x52')]['length'];_0x25e206+=0x1){socket[_0x5f94('0x71')](_0x5f94('0x72'),{'UserId':Number(_0x2410d8[_0x5f94('0x24')][_0x5f94('0x52')][_0x25e206]),'MailQueueId':Number(_0x2410d8[_0x5f94('0x39')]['id'])});}}else{socket[_0x5f94('0x71')](_0x5f94('0x72'),{'UserId':Number(_0x2410d8['query'][_0x5f94('0x52')]),'MailQueueId':Number(_0x2410d8[_0x5f94('0x39')]['id'])});}});}})['then'](respondWithStatusCode(_0x1fa487,null))[_0x5f94('0x25')](handleError(_0x1fa487,null));};exports[_0x5f94('0x78')]=function(_0x53b8b5,_0x2e2bd5){var _0x53bf1c={};var _0x5d2f92={};var _0x18acd7;var _0x55cd74;return db[_0x5f94('0x1e')][_0x5f94('0x4e')]({'where':{'id':_0x53b8b5[_0x5f94('0x39')]['id']}})['then'](handleEntityNotFound(_0x2e2bd5,null))[_0x5f94('0x16')](function(_0x3afaf4){if(_0x3afaf4){_0x18acd7=_0x3afaf4;_0x5d2f92[_0x5f94('0x27')]=_[_0x5f94('0x28')](db[_0x5f94('0x45')][_0x5f94('0x3d')]);_0x5d2f92[_0x5f94('0x24')]=_[_0x5f94('0x28')](_0x53b8b5['query']);_0x5d2f92[_0x5f94('0x29')]=_['intersection'](_0x5d2f92[_0x5f94('0x27')],_0x5d2f92[_0x5f94('0x24')]);_0x53bf1c[_0x5f94('0x2b')]=_[_0x5f94('0x2a')](_0x5d2f92[_0x5f94('0x27')],qs[_0x5f94('0x2c')](_0x53b8b5[_0x5f94('0x24')][_0x5f94('0x2c')]));_0x53bf1c['attributes']=_0x53bf1c[_0x5f94('0x2b')][_0x5f94('0x2d')]?_0x53bf1c[_0x5f94('0x2b')]:_0x5d2f92['model'];_0x53bf1c['order']=qs[_0x5f94('0x40')](_0x53b8b5[_0x5f94('0x24')][_0x5f94('0x40')]);_0x53bf1c[_0x5f94('0x22')]=qs[_0x5f94('0x29')](_[_0x5f94('0x41')](_0x53b8b5[_0x5f94('0x24')],_0x5d2f92['filters']));if(_0x53b8b5[_0x5f94('0x24')][_0x5f94('0x43')]){_0x53bf1c[_0x5f94('0x22')]=_['merge'](_0x53bf1c[_0x5f94('0x22')],{'$or':_[_0x5f94('0x1d')](_0x53bf1c[_0x5f94('0x2b')],function(_0x299431){var _0x3e4736={};_0x3e4736[_0x299431]={'$like':'%'+_0x53b8b5[_0x5f94('0x24')][_0x5f94('0x43')]+'%'};return _0x3e4736;})});}_0x53bf1c=_[_0x5f94('0x2e')]({},_0x53bf1c,_0x53b8b5[_0x5f94('0x2f')]);return _0x18acd7['getAgents'](_0x53bf1c);}})['then'](function(_0x437024){if(_0x437024){_0x55cd74=_0x437024['length'];if(!_0x53b8b5[_0x5f94('0x24')][_0x5f94('0x50')]('nolimit')){_0x53bf1c[_0x5f94('0x12')]=qs[_0x5f94('0x12')](_0x53b8b5['query'][_0x5f94('0x12')]);_0x53bf1c['offset']=qs[_0x5f94('0x10')](_0x53b8b5[_0x5f94('0x24')]['offset']);}return _0x18acd7[_0x5f94('0x78')](_0x53bf1c);}})[_0x5f94('0x16')](function(_0xcd5b3){if(_0xcd5b3){return _0xcd5b3?{'count':_0x55cd74,'rows':_0xcd5b3}:null;}})[_0x5f94('0x16')](respondWithResult(_0x2e2bd5,null))[_0x5f94('0x25')](handleError(_0x2e2bd5,null));}; \ No newline at end of file +var _0xff68=['../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','update','then','destroy','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','rows','show','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','limit','order','sort','pick','MailQueueId','filter','User','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','field','tq.TeamId','join','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','removeAgents','isArray','getAgents','bluebird','lodash','squel'];(function(_0x475342,_0x8ed514){var _0xda6666=function(_0xef625a){while(--_0xef625a){_0x475342['push'](_0x475342['shift']());}};_0xda6666(++_0x8ed514);}(_0xff68,0xed));var _0x8ff6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xff68[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x8ff6('0x0'));var util=require('util');var _=require(_0x8ff6('0x1'));var squel=require(_0x8ff6('0x2'));var Redis=require('ioredis');var qs=require(_0x8ff6('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x8ff6('0x4'));var db=require(_0x8ff6('0x5'))['db'];config[_0x8ff6('0x6')]=_[_0x8ff6('0x7')](config[_0x8ff6('0x6')],{'host':_0x8ff6('0x8'),'port':0x18eb});var socket=require(_0x8ff6('0x9'))(new Redis(config[_0x8ff6('0x6')]));require('./mailQueue.socket')[_0x8ff6('0xa')](socket);function respondWithStatusCode(_0x331529,_0x5342cd){_0x5342cd=_0x5342cd||0xcc;return function(_0x9fbbbc){if(_0x9fbbbc){return _0x331529[_0x8ff6('0xb')](_0x5342cd);}return _0x331529[_0x8ff6('0xc')](_0x5342cd)[_0x8ff6('0xd')]();};}function respondWithResult(_0x19813e,_0x5cdefa){_0x5cdefa=_0x5cdefa||0xc8;return function(_0x318c8d){if(_0x318c8d){return _0x19813e[_0x8ff6('0xc')](_0x5cdefa)[_0x8ff6('0xe')](_0x318c8d);}};}function respondWithFilteredResult(_0x54271a,_0x1f382c){return function(_0x1b1657){if(_0x1b1657){var _0x1651c3=typeof _0x1f382c[_0x8ff6('0xf')]===_0x8ff6('0x10')&&typeof _0x1f382c['limit']===_0x8ff6('0x10');var _0x578e5d=_0x1b1657[_0x8ff6('0x11')];var _0x4266dc=_0x1651c3?0x0:_0x1f382c[_0x8ff6('0xf')];var _0x317334=_0x1651c3?_0x1b1657[_0x8ff6('0x11')]:_0x1f382c[_0x8ff6('0xf')]+_0x1f382c['limit'];var _0x485ef9;if(_0x317334>=_0x578e5d){_0x317334=_0x578e5d;_0x485ef9=0xc8;}else{_0x485ef9=0xce;}_0x54271a[_0x8ff6('0xc')](_0x485ef9);return _0x54271a['set'](_0x8ff6('0x12'),_0x4266dc+'-'+_0x317334+'/'+_0x578e5d)[_0x8ff6('0xe')](_0x1b1657);}return null;};}function saveUpdates(_0x36b7f9){return function(_0x58ba42){if(_0x58ba42){return _0x58ba42[_0x8ff6('0x13')](_0x36b7f9)[_0x8ff6('0x14')](function(_0x26debb){return _0x26debb;});}return null;};}function removeEntity(_0x55a8fb){return function(_0x46cd1b){if(_0x46cd1b){return _0x46cd1b[_0x8ff6('0x15')]()[_0x8ff6('0x14')](function(){var _0x581391=_0x46cd1b['get']({'plain':!![]});var _0x2c24dc=_0x8ff6('0x16');return db[_0x8ff6('0x17')][_0x8ff6('0x15')]({'where':{'type':_0x2c24dc,'resourceId':_0x581391['id']}})[_0x8ff6('0x14')](function(){return _0x46cd1b;});})[_0x8ff6('0x14')](function(){_0x55a8fb[_0x8ff6('0xc')](0xcc)[_0x8ff6('0xd')]();});}};}function handleEntityNotFound(_0x3a27ad){return function(_0x2326a1){if(!_0x2326a1){_0x3a27ad[_0x8ff6('0xb')](0x194);}return _0x2326a1;};}function handleError(_0x34ff57,_0x566c9b){_0x566c9b=_0x566c9b||0x1f4;return function(_0x3a9d3a){logger[_0x8ff6('0x18')](_0x3a9d3a['stack']);if(_0x3a9d3a[_0x8ff6('0x19')]){delete _0x3a9d3a[_0x8ff6('0x19')];}_0x34ff57[_0x8ff6('0xc')](_0x566c9b)[_0x8ff6('0x1a')](_0x3a9d3a);};}exports[_0x8ff6('0x1b')]=function(_0x43a6b8,_0x1f72cb){var _0x3bd02e={};var _0x1e8339={'count':0x0,'rows':[]};var _0x32cd45=_[_0x8ff6('0x1c')](db[_0x8ff6('0x1d')][_0x8ff6('0x1e')],function(_0x389e6a){return{'name':_0x389e6a[_0x8ff6('0x1f')],'type':_0x389e6a[_0x8ff6('0x20')][_0x8ff6('0x21')]};});_0x3bd02e=qs['getOptions'](_0x32cd45,_0x43a6b8);var _0x1dc5fe={'where':_0x3bd02e[_0x8ff6('0x22')]};return db[_0x8ff6('0x1d')][_0x8ff6('0x11')](_0x1dc5fe)['then'](function(_0x20de6e){_0x1e8339[_0x8ff6('0x11')]=_0x20de6e;_0x3bd02e[_0x8ff6('0x23')]=qs[_0x8ff6('0x23')](_0x43a6b8[_0x8ff6('0x24')]);return db[_0x8ff6('0x1d')][_0x8ff6('0x25')](_0x3bd02e);})['then'](function(_0x26be5d){_0x1e8339[_0x8ff6('0x26')]=_0x26be5d;return _0x1e8339;})[_0x8ff6('0x14')](respondWithFilteredResult(_0x1f72cb,_0x3bd02e))['catch'](handleError(_0x1f72cb,null));};exports[_0x8ff6('0x27')]=function(_0x290a39,_0x65458){var _0x148afb={'raw':!![],'where':{'id':_0x290a39['params']['id']}},_0x514070={};_0x514070[_0x8ff6('0x28')]=_[_0x8ff6('0x29')](db['MailQueue']['rawAttributes']);_0x514070[_0x8ff6('0x24')]=_[_0x8ff6('0x29')](_0x290a39[_0x8ff6('0x24')]);_0x514070[_0x8ff6('0x2a')]=_[_0x8ff6('0x2b')](_0x514070[_0x8ff6('0x28')],_0x514070[_0x8ff6('0x24')]);_0x148afb['attributes']=_[_0x8ff6('0x2b')](_0x514070['model'],qs[_0x8ff6('0x2c')](_0x290a39[_0x8ff6('0x24')][_0x8ff6('0x2c')]));_0x148afb[_0x8ff6('0x2d')]=_0x148afb[_0x8ff6('0x2d')][_0x8ff6('0x2e')]?_0x148afb[_0x8ff6('0x2d')]:_0x514070['model'];if(_0x290a39[_0x8ff6('0x24')][_0x8ff6('0x2f')]){_0x148afb[_0x8ff6('0x23')]=[{'all':!![]}];}_0x148afb=_[_0x8ff6('0x30')]({},_0x148afb,_0x290a39[_0x8ff6('0x31')]);return db[_0x8ff6('0x1d')][_0x8ff6('0x32')](_0x148afb)[_0x8ff6('0x14')](handleEntityNotFound(_0x65458,null))[_0x8ff6('0x14')](respondWithResult(_0x65458,null))[_0x8ff6('0x33')](handleError(_0x65458,null));};exports['create']=function(_0x66745f,_0x427b2a){return db['MailQueue'][_0x8ff6('0x34')](_0x66745f[_0x8ff6('0x35')],{})['then'](function(_0x38908e){var _0x249369=_0x66745f[_0x8ff6('0x36')][_0x8ff6('0x37')]({'plain':!![]});if(!_0x249369)throw new Error(_0x8ff6('0x38'));if(_0x249369[_0x8ff6('0x39')]===_0x8ff6('0x36')){var _0x538586=_0x38908e[_0x8ff6('0x37')]({'plain':!![]});var _0x25c140=_0x8ff6('0x16');return db[_0x8ff6('0x3a')]['find']({'where':{'name':_0x25c140,'userProfileId':_0x249369[_0x8ff6('0x3b')]},'raw':!![]})['then'](function(_0x101641){if(_0x101641&&_0x101641[_0x8ff6('0x3c')]===0x0){return db['UserProfileResource'][_0x8ff6('0x34')]({'name':_0x538586[_0x8ff6('0x19')],'resourceId':_0x538586['id'],'type':_0x101641[_0x8ff6('0x19')],'sectionId':_0x101641['id']},{})[_0x8ff6('0x14')](function(){return _0x38908e;});}else{return _0x38908e;}})['catch'](function(_0x250172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x250172);throw _0x250172;});}return _0x38908e;})[_0x8ff6('0x14')](respondWithResult(_0x427b2a,0xc9))[_0x8ff6('0x33')](handleError(_0x427b2a,null));};exports['update']=function(_0x43b1e2,_0x5a1480){if(_0x43b1e2[_0x8ff6('0x35')]['id']){delete _0x43b1e2[_0x8ff6('0x35')]['id'];}return db[_0x8ff6('0x1d')][_0x8ff6('0x32')]({'where':{'id':_0x43b1e2['params']['id']}})[_0x8ff6('0x14')](handleEntityNotFound(_0x5a1480,null))['then'](saveUpdates(_0x43b1e2[_0x8ff6('0x35')],null))[_0x8ff6('0x14')](respondWithResult(_0x5a1480,null))[_0x8ff6('0x33')](handleError(_0x5a1480,null));};exports[_0x8ff6('0x15')]=function(_0x214951,_0x980933){return db[_0x8ff6('0x1d')]['find']({'where':{'id':_0x214951[_0x8ff6('0x3d')]['id']}})[_0x8ff6('0x14')](handleEntityNotFound(_0x980933,null))[_0x8ff6('0x14')](removeEntity(_0x980933,null))[_0x8ff6('0x33')](handleError(_0x980933,null));};exports[_0x8ff6('0x3e')]=function(_0x9377ca,_0x2cb8a9){return db[_0x8ff6('0x1d')][_0x8ff6('0x3e')]()[_0x8ff6('0x14')](respondWithResult(_0x2cb8a9,null))[_0x8ff6('0x33')](handleError(_0x2cb8a9,null));};exports['getMembers']=function(_0x2d2b04,_0x5f5b4b){var _0x11129c={'raw':!![],'where':{}},_0x3403b4={},_0x2eff36;return db[_0x8ff6('0x1d')][_0x8ff6('0x3f')]({'where':{'id':_0x2d2b04[_0x8ff6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5f5b4b,null))[_0x8ff6('0x14')](function(_0x490b2e){if(_0x490b2e){_0x2eff36=_0x490b2e[_0x8ff6('0x37')]({'plain':!![]});_0x3403b4[_0x8ff6('0x28')]=_['keys'](db[_0x8ff6('0x40')][_0x8ff6('0x1e')]);_0x3403b4['query']=_[_0x8ff6('0x29')](_0x2d2b04[_0x8ff6('0x24')]);_0x3403b4[_0x8ff6('0x2a')]=_[_0x8ff6('0x2b')](_0x3403b4[_0x8ff6('0x28')],_0x3403b4['query']);_0x11129c[_0x8ff6('0x2d')]=_['intersection'](_0x3403b4[_0x8ff6('0x28')],qs[_0x8ff6('0x2c')](_0x2d2b04[_0x8ff6('0x24')][_0x8ff6('0x2c')]));_0x11129c[_0x8ff6('0x2d')]=_0x11129c['attributes']['length']?_0x11129c['attributes']:_0x3403b4[_0x8ff6('0x28')];if(!_0x2d2b04[_0x8ff6('0x24')][_0x8ff6('0x41')](_0x8ff6('0x42'))){_0x11129c[_0x8ff6('0x43')]=qs[_0x8ff6('0x43')](_0x2d2b04['query'][_0x8ff6('0x43')]);_0x11129c[_0x8ff6('0xf')]=qs[_0x8ff6('0xf')](_0x2d2b04[_0x8ff6('0x24')][_0x8ff6('0xf')]);}_0x11129c[_0x8ff6('0x44')]=qs['sort'](_0x2d2b04['query'][_0x8ff6('0x45')]);_0x11129c[_0x8ff6('0x22')]=qs[_0x8ff6('0x2a')](_[_0x8ff6('0x46')](_0x2d2b04[_0x8ff6('0x24')],_0x3403b4[_0x8ff6('0x2a')]));_0x11129c[_0x8ff6('0x22')][_0x8ff6('0x47')]=_0x490b2e['id'];if(_0x2d2b04[_0x8ff6('0x24')][_0x8ff6('0x48')]){_0x11129c[_0x8ff6('0x22')]=_['merge'](_0x11129c['where'],{'$or':_[_0x8ff6('0x1c')](_0x11129c[_0x8ff6('0x2d')],function(_0x5e92c4){var _0x2c9487={};_0x2c9487[_0x5e92c4]={'$like':'%'+_0x2d2b04[_0x8ff6('0x24')][_0x8ff6('0x48')]+'%'};return _0x2c9487;})});}_0x11129c=_['merge']({},_0x11129c,_0x2d2b04[_0x8ff6('0x31')]);return db[_0x8ff6('0x40')]['findAll'](_0x11129c);}})[_0x8ff6('0x14')](function(_0x4006f3){if(_0x4006f3){return db[_0x8ff6('0x49')]['findAndCountAll']({'where':{'id':_[_0x8ff6('0x1c')](_0x4006f3,'UserId'),'role':_0x8ff6('0x4a')},'attributes':['id',_0x8ff6('0x19'),_0x8ff6('0x4b'),_0x8ff6('0x4c'),_0x8ff6('0x4d')]});}})[_0x8ff6('0x14')](function(_0x3143b4){if(_0x3143b4){return{'count':_0x3143b4[_0x8ff6('0x11')],'rows':_['map'](_0x3143b4[_0x8ff6('0x26')],function(_0x3a74aa){return{'membername':_0x3a74aa[_0x8ff6('0x19')],'UserId':_0x3a74aa['id'],'queue_name':_0x2eff36['name'],'MailQueueId':_0x2eff36['id'],'interface':util[_0x8ff6('0x4e')](_0x8ff6('0x4f'),_0x8ff6('0x50'),_0x3a74aa[_0x8ff6('0x19')]),'penalty':0x0,'paused':_0x3a74aa['mailPause'],'createdAt':_0x3a74aa[_0x8ff6('0x4d')],'updatedAt':_0x3a74aa[_0x8ff6('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8ff6('0x14')](respondWithFilteredResult(_0x5f5b4b,_0x11129c))['catch'](handleError(_0x5f5b4b,null));};exports[_0x8ff6('0x51')]=function(_0x3b4a21,_0x36ac83){var _0x7cdae3={};var _0x368f72={};var _0x2a7416;var _0x719561;return db[_0x8ff6('0x1d')]['findOne']({'where':{'id':_0x3b4a21['params']['id']}})['then'](handleEntityNotFound(_0x36ac83,null))['then'](function(_0x773888){if(_0x773888){_0x2a7416=_0x773888;_0x368f72['model']=_[_0x8ff6('0x29')](db[_0x8ff6('0x52')][_0x8ff6('0x1e')]);_0x368f72[_0x8ff6('0x24')]=_[_0x8ff6('0x29')](_0x3b4a21[_0x8ff6('0x24')]);_0x368f72[_0x8ff6('0x2a')]=_[_0x8ff6('0x2b')](_0x368f72[_0x8ff6('0x28')],_0x368f72[_0x8ff6('0x24')]);_0x7cdae3[_0x8ff6('0x2d')]=_[_0x8ff6('0x2b')](_0x368f72[_0x8ff6('0x28')],qs[_0x8ff6('0x2c')](_0x3b4a21[_0x8ff6('0x24')][_0x8ff6('0x2c')]));_0x7cdae3[_0x8ff6('0x2d')]=_0x7cdae3['attributes']['length']?_0x7cdae3[_0x8ff6('0x2d')]:_0x368f72['model'];_0x7cdae3['order']=qs[_0x8ff6('0x45')](_0x3b4a21[_0x8ff6('0x24')][_0x8ff6('0x45')]);_0x7cdae3[_0x8ff6('0x22')]=qs[_0x8ff6('0x2a')](_['pick'](_0x3b4a21['query'],_0x368f72[_0x8ff6('0x2a')]));if(_0x3b4a21[_0x8ff6('0x24')][_0x8ff6('0x48')]){_0x7cdae3[_0x8ff6('0x22')]=_[_0x8ff6('0x30')](_0x7cdae3['where'],{'$or':_[_0x8ff6('0x1c')](_0x7cdae3['attributes'],function(_0x1b53dd){var _0x4193cb={};_0x4193cb[_0x1b53dd]={'$like':'%'+_0x3b4a21[_0x8ff6('0x24')][_0x8ff6('0x48')]+'%'};return _0x4193cb;})});}_0x7cdae3=_[_0x8ff6('0x30')]({},_0x7cdae3,_0x3b4a21[_0x8ff6('0x31')]);return _0x2a7416[_0x8ff6('0x51')](_0x7cdae3);}})[_0x8ff6('0x14')](function(_0x339f8c){if(_0x339f8c){_0x719561=_0x339f8c[_0x8ff6('0x2e')];if(!_0x3b4a21['query'][_0x8ff6('0x41')](_0x8ff6('0x42'))){_0x7cdae3[_0x8ff6('0x43')]=qs[_0x8ff6('0x43')](_0x3b4a21['query']['limit']);_0x7cdae3[_0x8ff6('0xf')]=qs[_0x8ff6('0xf')](_0x3b4a21['query'][_0x8ff6('0xf')]);}return _0x2a7416['getTeams'](_0x7cdae3);}})[_0x8ff6('0x14')](function(_0x49d81d){if(_0x49d81d){return _0x49d81d?{'count':_0x719561,'rows':_0x49d81d}:null;}})[_0x8ff6('0x14')](respondWithResult(_0x36ac83,null))[_0x8ff6('0x33')](handleError(_0x36ac83,null));};exports['addTeams']=function(_0x286101,_0x56594c){var _0x3362b1=_0x286101[_0x8ff6('0x35')][_0x8ff6('0x53')];return db[_0x8ff6('0x52')]['findAll']({'where':{'id':_0x3362b1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8ff6('0x54'),'attributes':['id',_0x8ff6('0x19'),_0x8ff6('0x55'),_0x8ff6('0x56'),'interface'],'raw':!![]}]})[_0x8ff6('0x14')](function(_0x5d80e4){if(_0x5d80e4){var _0x58974e=_[_0x8ff6('0x57')](_0x5d80e4,function(_0x92f289){var _0x26067c=_0x92f289[_0x8ff6('0x37')]({'plain':!![]});return _0x26067c[_0x8ff6('0x54')];});return db[_0x8ff6('0x1d')][_0x8ff6('0x32')]({'where':{'id':_0x286101[_0x8ff6('0x3d')]['id']}})[_0x8ff6('0x14')](function(_0x4b17ae){return db[_0x8ff6('0x58')][_0x8ff6('0x59')](function(_0x3c62c8){return _0x4b17ae[_0x8ff6('0x5a')](_0x3362b1,{'transaction':_0x3c62c8})[_0x8ff6('0x14')](function(){return BPromise[_0x8ff6('0x5b')](_0x58974e,function(_0x519bad){return db[_0x8ff6('0x40')][_0x8ff6('0x5c')]({'where':{'UserId':_0x519bad['id'],'MailQueueId':_0x286101[_0x8ff6('0x3d')]['id']},'transaction':_0x3c62c8});});})[_0x8ff6('0x14')](function(){_0x58974e[_0x8ff6('0x5d')](function(_0x420c03){socket[_0x8ff6('0x5e')]('userMailQueue:save',{'UserId':_0x420c03['id'],'MailQueueId':_0x4b17ae['id']});});});});});}})[_0x8ff6('0x14')](respondWithStatusCode(_0x56594c,null))[_0x8ff6('0x33')](handleError(_0x56594c,null));};exports['removeTeams']=function(_0x54d3b4,_0x219bb1){return db[_0x8ff6('0x52')][_0x8ff6('0x25')]({'where':{'id':_0x54d3b4['query'][_0x8ff6('0x53')]},'attributes':['id'],'include':[{'model':db[_0x8ff6('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x219bb1,null))[_0x8ff6('0x14')](function(_0x28fad4){var _0x123cc6=_['map'](_0x28fad4,'id');var _0x2ea066=[];var _0x29d46a=[];var _0x278574=squel['select']();_0x278574[_0x8ff6('0x5f')](_0x8ff6('0x60'))['from']('team_has_mail_queues','tq')[_0x8ff6('0x61')](_0x8ff6('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8ff6('0x63'),_0x54d3b4[_0x8ff6('0x3d')]['id']);for(var _0x357afb=0x0;_0x357afb<_0x28fad4[_0x8ff6('0x2e')];_0x357afb+=0x1){let _0x4247fd=_0x28fad4[_0x357afb];for(var _0x4d8453=0x0;_0x4d8453<_0x4247fd[_0x8ff6('0x54')][_0x8ff6('0x2e')];_0x4d8453+=0x1){let _0x33f1cc=_0x4247fd[_0x8ff6('0x54')][_0x4d8453];var _0x4a178d=_0x278574[_0x8ff6('0x64')]();_0x4a178d[_0x8ff6('0x22')]('ut.UserId\x20=\x20?',_0x33f1cc['id']);_0x29d46a[_0x8ff6('0x65')](db['sequelize'][_0x8ff6('0x24')](_0x4a178d[_0x8ff6('0x66')](),{'type':db[_0x8ff6('0x58')][_0x8ff6('0x67')][_0x8ff6('0x68')]})[_0x8ff6('0x14')](function(_0x179d72){if(_0x179d72['length']===0x1){return _0x33f1cc['id'];}else{var _0x51621a=_[_0x8ff6('0x69')](_[_0x8ff6('0x1c')](_0x179d72,_0x8ff6('0x6a')),function(_0x5e878f){return _[_0x8ff6('0x6b')](_0x123cc6,_0x5e878f);});if(_0x51621a){return _0x33f1cc['id'];}}}));}}return BPromise['all'](_0x29d46a)[_0x8ff6('0x14')](function(_0x5c88b4){_0x2ea066=_(_0x2ea066)[_0x8ff6('0x6c')](_0x5c88b4)[_0x8ff6('0x6d')]()['value']();return db[_0x8ff6('0x1d')]['find']({'where':{'id':_0x54d3b4[_0x8ff6('0x3d')]['id']}})['then'](function(_0x23fb4f){return db[_0x8ff6('0x58')]['transaction'](function(_0x4a679){return _0x23fb4f[_0x8ff6('0x6e')](_0x54d3b4['query'][_0x8ff6('0x53')],{'transaction':_0x4a679})[_0x8ff6('0x14')](function(){if(!_[_0x8ff6('0x6f')](_0x2ea066)){return _0x23fb4f['removeAgents'](_0x2ea066,{'transaction':_0x4a679});}})['then'](function(){_0x2ea066[_0x8ff6('0x5d')](function(_0x203784){socket[_0x8ff6('0x5e')](_0x8ff6('0x70'),{'UserId':_0x203784,'MailQueueId':_0x23fb4f['id']});});});});});});})[_0x8ff6('0x14')](respondWithStatusCode(_0x219bb1,null))['catch'](handleError(_0x219bb1,null));};exports[_0x8ff6('0x71')]=function(_0x5e0b19,_0x1b2702){return db[_0x8ff6('0x1d')]['find']({'where':{'id':_0x5e0b19[_0x8ff6('0x3d')]['id']}})[_0x8ff6('0x14')](handleEntityNotFound(_0x1b2702,null))[_0x8ff6('0x14')](function(_0x1699e2){if(_0x1699e2){return _0x1699e2[_0x8ff6('0x71')](_0x5e0b19[_0x8ff6('0x35')][_0x8ff6('0x53')],_[_0x8ff6('0x72')](_0x5e0b19[_0x8ff6('0x35')],[_0x8ff6('0x53'),'id'])||{})[_0x8ff6('0x73')](function(_0x190e5e){for(var _0x1231bf=0x0;_0x1231bf<_0x5e0b19[_0x8ff6('0x35')][_0x8ff6('0x53')][_0x8ff6('0x2e')];_0x1231bf+=0x1){socket['emit'](_0x8ff6('0x74'),{'UserId':Number(_0x5e0b19[_0x8ff6('0x35')]['ids'][_0x1231bf]),'MailQueueId':Number(_0x5e0b19[_0x8ff6('0x3d')]['id'])});}return _0x190e5e;});}})[_0x8ff6('0x14')](respondWithResult(_0x1b2702,null))[_0x8ff6('0x33')](handleError(_0x1b2702,null));};exports[_0x8ff6('0x75')]=function(_0x49a532,_0x4af981){return db[_0x8ff6('0x1d')][_0x8ff6('0x32')]({'where':{'id':_0x49a532[_0x8ff6('0x3d')]['id']}})[_0x8ff6('0x14')](handleEntityNotFound(_0x4af981,null))[_0x8ff6('0x14')](function(_0x36e140){if(_0x36e140){return _0x36e140[_0x8ff6('0x75')](_0x49a532[_0x8ff6('0x24')][_0x8ff6('0x53')])[_0x8ff6('0x14')](function(){if(_[_0x8ff6('0x76')](_0x49a532[_0x8ff6('0x24')]['ids'])){for(var _0x5d706e=0x0;_0x5d706e<_0x49a532[_0x8ff6('0x24')][_0x8ff6('0x53')][_0x8ff6('0x2e')];_0x5d706e+=0x1){socket['emit'](_0x8ff6('0x70'),{'UserId':Number(_0x49a532[_0x8ff6('0x24')][_0x8ff6('0x53')][_0x5d706e]),'MailQueueId':Number(_0x49a532[_0x8ff6('0x3d')]['id'])});}}else{socket['emit'](_0x8ff6('0x70'),{'UserId':Number(_0x49a532['query'][_0x8ff6('0x53')]),'MailQueueId':Number(_0x49a532['params']['id'])});}});}})[_0x8ff6('0x14')](respondWithStatusCode(_0x4af981,null))[_0x8ff6('0x33')](handleError(_0x4af981,null));};exports[_0x8ff6('0x77')]=function(_0x114385,_0x813212){var _0xcbd975={};var _0x2af35b={};var _0x1f9160;var _0x11ce0d;return db[_0x8ff6('0x1d')][_0x8ff6('0x3f')]({'where':{'id':_0x114385['params']['id']}})[_0x8ff6('0x14')](handleEntityNotFound(_0x813212,null))[_0x8ff6('0x14')](function(_0x2ef2df){if(_0x2ef2df){_0x1f9160=_0x2ef2df;_0x2af35b[_0x8ff6('0x28')]=_['keys'](db[_0x8ff6('0x49')][_0x8ff6('0x1e')]);_0x2af35b[_0x8ff6('0x24')]=_['keys'](_0x114385[_0x8ff6('0x24')]);_0x2af35b['filters']=_['intersection'](_0x2af35b[_0x8ff6('0x28')],_0x2af35b['query']);_0xcbd975['attributes']=_['intersection'](_0x2af35b[_0x8ff6('0x28')],qs[_0x8ff6('0x2c')](_0x114385[_0x8ff6('0x24')][_0x8ff6('0x2c')]));_0xcbd975[_0x8ff6('0x2d')]=_0xcbd975['attributes'][_0x8ff6('0x2e')]?_0xcbd975['attributes']:_0x2af35b[_0x8ff6('0x28')];_0xcbd975[_0x8ff6('0x44')]=qs['sort'](_0x114385[_0x8ff6('0x24')][_0x8ff6('0x45')]);_0xcbd975['where']=qs[_0x8ff6('0x2a')](_[_0x8ff6('0x46')](_0x114385['query'],_0x2af35b[_0x8ff6('0x2a')]));if(_0x114385[_0x8ff6('0x24')][_0x8ff6('0x48')]){_0xcbd975[_0x8ff6('0x22')]=_[_0x8ff6('0x30')](_0xcbd975[_0x8ff6('0x22')],{'$or':_[_0x8ff6('0x1c')](_0xcbd975['attributes'],function(_0x41ea45){var _0xc358cd={};_0xc358cd[_0x41ea45]={'$like':'%'+_0x114385[_0x8ff6('0x24')][_0x8ff6('0x48')]+'%'};return _0xc358cd;})});}_0xcbd975=_[_0x8ff6('0x30')]({},_0xcbd975,_0x114385[_0x8ff6('0x31')]);return _0x1f9160['getAgents'](_0xcbd975);}})[_0x8ff6('0x14')](function(_0x250887){if(_0x250887){_0x11ce0d=_0x250887[_0x8ff6('0x2e')];if(!_0x114385[_0x8ff6('0x24')][_0x8ff6('0x41')](_0x8ff6('0x42'))){_0xcbd975[_0x8ff6('0x43')]=qs[_0x8ff6('0x43')](_0x114385[_0x8ff6('0x24')][_0x8ff6('0x43')]);_0xcbd975['offset']=qs[_0x8ff6('0xf')](_0x114385[_0x8ff6('0x24')][_0x8ff6('0xf')]);}return _0x1f9160[_0x8ff6('0x77')](_0xcbd975);}})['then'](function(_0x55518b){if(_0x55518b){return _0x55518b?{'count':_0x11ce0d,'rows':_0x55518b}:null;}})[_0x8ff6('0x14')](respondWithResult(_0x813212,null))[_0x8ff6('0x33')](handleError(_0x813212,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ad4f47f..e5f8a13 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 _0xb310=['hook','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb310,0x119));var _0x0b31=function(_0xc5dad6,_0x39422c){_0xc5dad6=_0xc5dad6-0x0;var _0x143bec=_0xb310[_0xc5dad6];return _0x143bec;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x0b31('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0b31('0x1')](0x0);var events={'afterCreate':_0x0b31('0x2'),'afterUpdate':_0x0b31('0x3'),'afterDestroy':_0x0b31('0x4')};function emitEvent(_0x5f4474){return function(_0x320876,_0xa74774,_0x414fbf){MailQueueEvents[_0x0b31('0x5')](_0x5f4474+':'+_0x320876['id'],_0x320876);MailQueueEvents['emit'](_0x5f4474,_0x320876);_0x414fbf(null);};}for(var e in events){if(events[_0x0b31('0x6')](e)){var event=events[e];MailQueue[_0x0b31('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xcf48=['exports','../../mysqldb','MailQueue','save','remove','emit','hook'];(function(_0x4fa4fd,_0x4c656b){var _0x3c50d0=function(_0x223600){while(--_0x223600){_0x4fa4fd['push'](_0x4fa4fd['shift']());}};_0x3c50d0(++_0x4c656b);}(_0xcf48,0x119));var _0x8cf4=function(_0x444353,_0x3c2897){_0x444353=_0x444353-0x0;var _0x397884=_0xcf48[_0x444353];return _0x397884;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x8cf4('0x0'))['db'][_0x8cf4('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8cf4('0x2'),'afterUpdate':'update','afterDestroy':_0x8cf4('0x3')};function emitEvent(_0x23d28e){return function(_0x164e8d,_0x145eba,_0xaa3d96){MailQueueEvents[_0x8cf4('0x4')](_0x23d28e+':'+_0x164e8d['id'],_0x164e8d);MailQueueEvents['emit'](_0x23d28e,_0x164e8d);_0xaa3d96(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x8cf4('0x5')](e,emitEvent(event));}}module[_0x8cf4('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 28314c7..cef8682 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 _0xb2fa=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','mail_queues','lodash','util'];(function(_0x4645bd,_0x1ad4c){var _0x59ebbb=function(_0x42f66f){while(--_0x42f66f){_0x4645bd['push'](_0x4645bd['shift']());}};_0x59ebbb(++_0x1ad4c);}(_0xb2fa,0xb4));var _0xab2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb2fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xab2f('0x0'));var util=require(_0xab2f('0x1'));var logger=require('../../config/logger')(_0xab2f('0x2'));var moment=require(_0xab2f('0x3'));var BPromise=require(_0xab2f('0x4'));var rp=require(_0xab2f('0x5'));var fs=require('fs');var path=require(_0xab2f('0x6'));var rimraf=require(_0xab2f('0x7'));var config=require(_0xab2f('0x8'));var attributes=require(_0xab2f('0x9'));module[_0xab2f('0xa')]=function(_0x22f4aa,_0x389428){return _0x22f4aa[_0xab2f('0xb')]('MailQueue',attributes,{'tableName':_0xab2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94b0=['moment','bluebird','rimraf','../../config/environment','./mailQueue.attributes','define','mail_queues','lodash','../../config/logger','api'];(function(_0x4e6f9f,_0x1a9c5a){var _0x3a4bd9=function(_0x42f509){while(--_0x42f509){_0x4e6f9f['push'](_0x4e6f9f['shift']());}};_0x3a4bd9(++_0x1a9c5a);}(_0x94b0,0x183));var _0x094b=function(_0x3094e9,_0xc47d36){_0x3094e9=_0x3094e9-0x0;var _0x49b1e0=_0x94b0[_0x3094e9];return _0x49b1e0;};'use strict';var _=require(_0x094b('0x0'));var util=require('util');var logger=require(_0x094b('0x1'))(_0x094b('0x2'));var moment=require(_0x094b('0x3'));var BPromise=require(_0x094b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x094b('0x5'));var config=require(_0x094b('0x6'));var attributes=require(_0x094b('0x7'));module['exports']=function(_0x18eddd,_0x42fb06){return _0x18eddd[_0x094b('0x8')]('MailQueue',attributes,{'tableName':_0x094b('0x9'),'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 c468000..3819ffe 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 _0x3087=['GetMailQueue','MailQueue','findAll','options','where','attributes','limit','map','model','include','debug','find','raw','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x3926a0,_0x73cdce){var _0x316440=function(_0x2e64){while(--_0x2e64){_0x3926a0['push'](_0x3926a0['shift']());}};_0x316440(++_0x73cdce);}(_0x3087,0xe5));var _0x7308=function(_0x54cdbd,_0x11a1c4){_0x54cdbd=_0x54cdbd-0x0;var _0x49f3fc=_0x3087[_0x54cdbd];return _0x49f3fc;};'use strict';var _=require(_0x7308('0x0'));var util=require(_0x7308('0x1'));var moment=require(_0x7308('0x2'));var BPromise=require(_0x7308('0x3'));var rs=require(_0x7308('0x4'));var fs=require('fs');var Redis=require(_0x7308('0x5'));var db=require(_0x7308('0x6'))['db'];var utils=require(_0x7308('0x7'));var logger=require(_0x7308('0x8'))(_0x7308('0x9'));var config=require(_0x7308('0xa'));var jayson=require(_0x7308('0xb'));var client=jayson[_0x7308('0xc')][_0x7308('0xd')]({'port':0x232a});config[_0x7308('0xe')]=_[_0x7308('0xf')](config[_0x7308('0xe')],{'host':_0x7308('0x10'),'port':0x18eb});var socket=require(_0x7308('0x11'))(new Redis(config[_0x7308('0xe')]));require('./mailQueue.socket')[_0x7308('0x12')](socket);function respondWithRpcPromise(_0x3b3420,_0x5887d0,_0x4bab21){return new BPromise(function(_0x2269f4,_0x33dc3d){return client[_0x7308('0x13')](_0x3b3420,_0x4bab21)[_0x7308('0x14')](function(_0x4c7131){logger[_0x7308('0x15')](_0x7308('0x16'),_0x5887d0,_0x7308('0x17'));logger['debug'](_0x7308('0x18'),_0x5887d0,_0x7308('0x17'),JSON['stringify'](_0x4c7131));if(_0x4c7131[_0x7308('0x19')]){if(_0x4c7131[_0x7308('0x19')][_0x7308('0x1a')]===0x1f4){logger[_0x7308('0x19')](_0x7308('0x16'),_0x5887d0,_0x4c7131[_0x7308('0x19')][_0x7308('0x1b')]);return _0x33dc3d(_0x4c7131[_0x7308('0x19')]['message']);}logger[_0x7308('0x19')](_0x7308('0x16'),_0x5887d0,_0x4c7131[_0x7308('0x19')][_0x7308('0x1b')]);return _0x2269f4(_0x4c7131[_0x7308('0x19')][_0x7308('0x1b')]);}else{logger[_0x7308('0x15')](_0x7308('0x16'),_0x5887d0,_0x7308('0x17'));_0x2269f4(_0x4c7131['result']['message']);}})[_0x7308('0x1c')](function(_0x27411b){logger[_0x7308('0x19')](_0x7308('0x16'),_0x5887d0,_0x27411b);_0x33dc3d(_0x27411b);});});}exports[_0x7308('0x1d')]=function(_0x10170d){var _0x3cefec=this;return new Promise(function(_0x5f26d3,_0x4b0830){return db[_0x7308('0x1e')][_0x7308('0x1f')]({'raw':_0x10170d[_0x7308('0x20')]?_0x10170d[_0x7308('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x10170d[_0x7308('0x20')]?_0x10170d[_0x7308('0x20')][_0x7308('0x21')]||null:null,'attributes':_0x10170d[_0x7308('0x20')]?_0x10170d['options'][_0x7308('0x22')]||null:null,'limit':_0x10170d[_0x7308('0x20')]?_0x10170d[_0x7308('0x20')][_0x7308('0x23')]||null:null,'include':_0x10170d[_0x7308('0x20')]?_0x10170d[_0x7308('0x20')]['include']?_[_0x7308('0x24')](_0x10170d[_0x7308('0x20')]['include'],function(_0x203ca2){return{'model':db[_0x203ca2[_0x7308('0x25')]],'as':_0x203ca2['as'],'attributes':_0x203ca2['attributes'],'include':_0x203ca2['include']?_['map'](_0x203ca2[_0x7308('0x26')],function(_0x356de5){return{'model':db[_0x356de5[_0x7308('0x25')]],'as':_0x356de5['as'],'attributes':_0x356de5[_0x7308('0x22')],'include':_0x356de5[_0x7308('0x26')]?_['map'](_0x356de5[_0x7308('0x26')],function(_0x2dfad0){return{'model':db[_0x2dfad0[_0x7308('0x25')]],'as':_0x2dfad0['as'],'attributes':_0x2dfad0['attributes']};}):[]};}):[]};}):[]:[]})[_0x7308('0x14')](function(_0x271d6c){logger[_0x7308('0x15')]('GetMailQueue',_0x10170d);logger[_0x7308('0x27')](_0x7308('0x1d'),_0x10170d,JSON['stringify'](_0x271d6c));_0x5f26d3(_0x271d6c);})[_0x7308('0x1c')](function(_0xaf2be5){logger[_0x7308('0x19')](_0x7308('0x1d'),_0xaf2be5[_0x7308('0x1b')],_0x10170d);_0x4b0830(_0x3cefec[_0x7308('0x19')](0x1f4,_0xaf2be5[_0x7308('0x1b')]));});});};exports['ShowMailQueue']=function(_0x2c062f){var _0xc2a88=this;return new Promise(function(_0x5b6812,_0x49d39f){return db[_0x7308('0x1e')][_0x7308('0x28')]({'raw':_0x2c062f[_0x7308('0x20')]?_0x2c062f[_0x7308('0x20')][_0x7308('0x29')]===undefined?!![]:![]:!![],'where':_0x2c062f['options']?_0x2c062f['options']['where']||null:null,'attributes':_0x2c062f[_0x7308('0x20')]?_0x2c062f[_0x7308('0x20')][_0x7308('0x22')]||null:null,'include':_0x2c062f[_0x7308('0x20')]?_0x2c062f[_0x7308('0x20')][_0x7308('0x26')]?_[_0x7308('0x24')](_0x2c062f['options'][_0x7308('0x26')],function(_0x47575b){return{'model':db[_0x47575b[_0x7308('0x25')]],'as':_0x47575b['as'],'attributes':_0x47575b[_0x7308('0x22')],'include':_0x47575b[_0x7308('0x26')]?_[_0x7308('0x24')](_0x47575b[_0x7308('0x26')],function(_0x277343){return{'model':db[_0x277343[_0x7308('0x25')]],'as':_0x277343['as'],'attributes':_0x277343[_0x7308('0x22')],'include':_0x277343['include']?_[_0x7308('0x24')](_0x277343[_0x7308('0x26')],function(_0x8c0c88){return{'model':db[_0x8c0c88[_0x7308('0x25')]],'as':_0x8c0c88['as'],'attributes':_0x8c0c88[_0x7308('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7308('0x14')](function(_0x50b029){logger[_0x7308('0x15')]('ShowMailQueue',_0x2c062f);logger[_0x7308('0x27')]('ShowMailQueue',_0x2c062f,JSON['stringify'](_0x50b029));_0x5b6812(_0x50b029);})['catch'](function(_0x4e1ce5){logger[_0x7308('0x19')](_0x7308('0x2a'),_0x4e1ce5[_0x7308('0x1b')],_0x2c062f);_0x49d39f(_0xc2a88['error'](0x1f4,_0x4e1ce5[_0x7308('0x1b')]));});});}; \ No newline at end of file +var _0x16bf=['message','result','catch','GetMailQueue','findAll','options','raw','attributes','limit','map','include','model','ShowMailQueue','MailQueue','find','where','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3a9f32,_0x3092f4){var _0x473794=function(_0x5e0e8e){while(--_0x5e0e8e){_0x3a9f32['push'](_0x3a9f32['shift']());}};_0x473794(++_0x3092f4);}(_0x16bf,0x178));var _0xf16b=function(_0x22d21b,_0x1da63c){_0x22d21b=_0x22d21b-0x0;var _0x124785=_0x16bf[_0x22d21b];return _0x124785;};'use strict';var _=require('lodash');var util=require(_0xf16b('0x0'));var moment=require('moment');var BPromise=require(_0xf16b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf16b('0x2'));var db=require(_0xf16b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf16b('0x4'))(_0xf16b('0x5'));var config=require(_0xf16b('0x6'));var jayson=require(_0xf16b('0x7'));var client=jayson[_0xf16b('0x8')]['http']({'port':0x232a});config[_0xf16b('0x9')]=_[_0xf16b('0xa')](config['redis'],{'host':_0xf16b('0xb'),'port':0x18eb});var socket=require(_0xf16b('0xc'))(new Redis(config[_0xf16b('0x9')]));require(_0xf16b('0xd'))[_0xf16b('0xe')](socket);function respondWithRpcPromise(_0x539f86,_0x2f1b6b,_0xf1934e){return new BPromise(function(_0x42ddec,_0x12387f){return client['request'](_0x539f86,_0xf1934e)[_0xf16b('0xf')](function(_0x11eaf4){logger[_0xf16b('0x10')](_0xf16b('0x11'),_0x2f1b6b,_0xf16b('0x12'));logger[_0xf16b('0x13')](_0xf16b('0x14'),_0x2f1b6b,'request\x20sent',JSON[_0xf16b('0x15')](_0x11eaf4));if(_0x11eaf4[_0xf16b('0x16')]){if(_0x11eaf4['error'][_0xf16b('0x17')]===0x1f4){logger[_0xf16b('0x16')]('MailQueue,\x20%s,\x20%s',_0x2f1b6b,_0x11eaf4['error'][_0xf16b('0x18')]);return _0x12387f(_0x11eaf4['error'][_0xf16b('0x18')]);}logger[_0xf16b('0x16')](_0xf16b('0x11'),_0x2f1b6b,_0x11eaf4[_0xf16b('0x16')][_0xf16b('0x18')]);return _0x42ddec(_0x11eaf4['error']['message']);}else{logger['info'](_0xf16b('0x11'),_0x2f1b6b,_0xf16b('0x12'));_0x42ddec(_0x11eaf4[_0xf16b('0x19')][_0xf16b('0x18')]);}})[_0xf16b('0x1a')](function(_0xb313ca){logger['error']('MailQueue,\x20%s,\x20%s',_0x2f1b6b,_0xb313ca);_0x12387f(_0xb313ca);});});}exports[_0xf16b('0x1b')]=function(_0x5a5340){var _0x3f314a=this;return new Promise(function(_0x461d34,_0x349f22){return db['MailQueue'][_0xf16b('0x1c')]({'raw':_0x5a5340[_0xf16b('0x1d')]?_0x5a5340['options'][_0xf16b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a5340['options']?_0x5a5340[_0xf16b('0x1d')]['where']||null:null,'attributes':_0x5a5340[_0xf16b('0x1d')]?_0x5a5340[_0xf16b('0x1d')][_0xf16b('0x1f')]||null:null,'limit':_0x5a5340['options']?_0x5a5340['options'][_0xf16b('0x20')]||null:null,'include':_0x5a5340[_0xf16b('0x1d')]?_0x5a5340[_0xf16b('0x1d')]['include']?_[_0xf16b('0x21')](_0x5a5340[_0xf16b('0x1d')][_0xf16b('0x22')],function(_0x2e4e83){return{'model':db[_0x2e4e83[_0xf16b('0x23')]],'as':_0x2e4e83['as'],'attributes':_0x2e4e83[_0xf16b('0x1f')],'include':_0x2e4e83['include']?_['map'](_0x2e4e83[_0xf16b('0x22')],function(_0x45f409){return{'model':db[_0x45f409[_0xf16b('0x23')]],'as':_0x45f409['as'],'attributes':_0x45f409[_0xf16b('0x1f')],'include':_0x45f409[_0xf16b('0x22')]?_['map'](_0x45f409[_0xf16b('0x22')],function(_0x138d1a){return{'model':db[_0x138d1a['model']],'as':_0x138d1a['as'],'attributes':_0x138d1a[_0xf16b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf16b('0xf')](function(_0x54b4d7){logger[_0xf16b('0x10')](_0xf16b('0x1b'),_0x5a5340);logger[_0xf16b('0x13')](_0xf16b('0x1b'),_0x5a5340,JSON[_0xf16b('0x15')](_0x54b4d7));_0x461d34(_0x54b4d7);})[_0xf16b('0x1a')](function(_0x4601e8){logger['error'](_0xf16b('0x1b'),_0x4601e8[_0xf16b('0x18')],_0x5a5340);_0x349f22(_0x3f314a[_0xf16b('0x16')](0x1f4,_0x4601e8[_0xf16b('0x18')]));});});};exports[_0xf16b('0x24')]=function(_0x34b50c){var _0x4663b5=this;return new Promise(function(_0x232d3c,_0x2f980f){return db[_0xf16b('0x25')][_0xf16b('0x26')]({'raw':_0x34b50c['options']?_0x34b50c[_0xf16b('0x1d')][_0xf16b('0x1e')]===undefined?!![]:![]:!![],'where':_0x34b50c[_0xf16b('0x1d')]?_0x34b50c[_0xf16b('0x1d')][_0xf16b('0x27')]||null:null,'attributes':_0x34b50c['options']?_0x34b50c[_0xf16b('0x1d')]['attributes']||null:null,'include':_0x34b50c[_0xf16b('0x1d')]?_0x34b50c['options'][_0xf16b('0x22')]?_[_0xf16b('0x21')](_0x34b50c['options'][_0xf16b('0x22')],function(_0x19af0f){return{'model':db[_0x19af0f[_0xf16b('0x23')]],'as':_0x19af0f['as'],'attributes':_0x19af0f[_0xf16b('0x1f')],'include':_0x19af0f[_0xf16b('0x22')]?_[_0xf16b('0x21')](_0x19af0f[_0xf16b('0x22')],function(_0x1ef999){return{'model':db[_0x1ef999['model']],'as':_0x1ef999['as'],'attributes':_0x1ef999[_0xf16b('0x1f')],'include':_0x1ef999[_0xf16b('0x22')]?_[_0xf16b('0x21')](_0x1ef999[_0xf16b('0x22')],function(_0x1b759c){return{'model':db[_0x1b759c[_0xf16b('0x23')]],'as':_0x1b759c['as'],'attributes':_0x1b759c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x53600d){logger[_0xf16b('0x10')](_0xf16b('0x24'),_0x34b50c);logger[_0xf16b('0x13')]('ShowMailQueue',_0x34b50c,JSON[_0xf16b('0x15')](_0x53600d));_0x232d3c(_0x53600d);})['catch'](function(_0x350829){logger[_0xf16b('0x16')](_0xf16b('0x24'),_0x350829[_0xf16b('0x18')],_0x34b50c);_0x2f980f(_0x4663b5['error'](0x1f4,_0x350829['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index feafd5c..26bb102 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 _0xbae9=['remove','update','emit','removeListener','register','./mailQueue.events'];(function(_0x5d7bc0,_0x42bc22){var _0x435687=function(_0x1b9615){while(--_0x1b9615){_0x5d7bc0['push'](_0x5d7bc0['shift']());}};_0x435687(++_0x42bc22);}(_0xbae9,0x197));var _0x9bae=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0xbae9[_0x4a04de];return _0xbbe018;};'use strict';var MailQueueEvents=require(_0x9bae('0x0'));var events=['save',_0x9bae('0x1'),_0x9bae('0x2')];function createListener(_0x569943,_0x5289e6){return function(_0x5eb3c){_0x5289e6[_0x9bae('0x3')](_0x569943,_0x5eb3c);};}function removeListener(_0xfa459a,_0x1c15f3){return function(){MailQueueEvents[_0x9bae('0x4')](_0xfa459a,_0x1c15f3);};}exports[_0x9bae('0x5')]=function(_0x4f91fc){for(var _0x1453ed=0x0,_0x53b7f1=events['length'];_0x1453ed<_0x53b7f1;_0x1453ed++){var _0x570517=events[_0x1453ed];var _0x2468fc=createListener('mailQueue:'+_0x570517,_0x4f91fc);MailQueueEvents['on'](_0x570517,_0x2468fc);}}; \ No newline at end of file +var _0x36f9=['remove','update','emit','removeListener','register','length','mailQueue:','save'];(function(_0x295a5c,_0xfd0b5){var _0x53339e=function(_0x5ee71d){while(--_0x5ee71d){_0x295a5c['push'](_0x295a5c['shift']());}};_0x53339e(++_0xfd0b5);}(_0x36f9,0x7f));var _0x936f=function(_0x115cf7,_0x54d11e){_0x115cf7=_0x115cf7-0x0;var _0x4e21aa=_0x36f9[_0x115cf7];return _0x4e21aa;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x936f('0x0'),_0x936f('0x1'),_0x936f('0x2')];function createListener(_0x40e389,_0x284fd3){return function(_0x135b83){_0x284fd3[_0x936f('0x3')](_0x40e389,_0x135b83);};}function removeListener(_0x2de60c,_0x1637b3){return function(){MailQueueEvents[_0x936f('0x4')](_0x2de60c,_0x1637b3);};}exports[_0x936f('0x5')]=function(_0x290b95){for(var _0xb2ab68=0x0,_0x361746=events[_0x936f('0x6')];_0xb2ab68<_0x361746;_0xb2ab68++){var _0x15846e=events[_0xb2ab68];var _0x5b5848=createListener(_0x936f('0x7')+_0x15846e,_0x290b95);MailQueueEvents['on'](_0x15846e,_0x5b5848);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b80d1de..4776422 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 _0x0005=['fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x1ed92b,_0x59a2aa){var _0x20a8df=function(_0x3af8f9){while(--_0x3af8f9){_0x1ed92b['push'](_0x1ed92b['shift']());}};_0x20a8df(++_0x59a2aa);}(_0x0005,0xfb));var _0x5000=function(_0xc1f6b2,_0x1bfe51){_0xc1f6b2=_0xc1f6b2-0x0;var _0x32e937=_0x0005[_0xc1f6b2];return _0x32e937;};'use strict';var multer=require(_0x5000('0x0'));var util=require(_0x5000('0x1'));var path=require(_0x5000('0x2'));var timeout=require(_0x5000('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5000('0x4'));var auth=require(_0x5000('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5000('0x6'));var controller=require(_0x5000('0x7'));router[_0x5000('0x8')]('/',auth[_0x5000('0x9')](),controller['index']);router[_0x5000('0x8')]('/describe',auth[_0x5000('0x9')](),controller['describe']);router['get'](_0x5000('0xa'),auth[_0x5000('0x9')](),controller[_0x5000('0xb')]);router[_0x5000('0xc')]('/',auth[_0x5000('0x9')](),controller[_0x5000('0xd')]);router[_0x5000('0xe')](_0x5000('0xa'),auth[_0x5000('0x9')](),controller['update']);router[_0x5000('0xf')](_0x5000('0xa'),auth[_0x5000('0x9')](),controller['destroy']);module[_0x5000('0x10')]=router; \ No newline at end of file +var _0x2b75=['express','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x126bc5,_0x1461e7){var _0x2ab694=function(_0xb62184){while(--_0xb62184){_0x126bc5['push'](_0x126bc5['shift']());}};_0x2ab694(++_0x1461e7);}(_0x2b75,0x141));var _0x52b7=function(_0x49238c,_0x5e67d7){_0x49238c=_0x49238c-0x0;var _0x5271cb=_0x2b75[_0x49238c];return _0x5271cb;};'use strict';var multer=require('multer');var util=require(_0x52b7('0x0'));var path=require(_0x52b7('0x1'));var timeout=require(_0x52b7('0x2'));var express=require(_0x52b7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x52b7('0x4'));var config=require(_0x52b7('0x5'));var controller=require(_0x52b7('0x6'));router[_0x52b7('0x7')]('/',auth[_0x52b7('0x8')](),controller[_0x52b7('0x9')]);router['get'](_0x52b7('0xa'),auth['isAuthenticated'](),controller[_0x52b7('0xb')]);router[_0x52b7('0x7')](_0x52b7('0xc'),auth[_0x52b7('0x8')](),controller['show']);router['post']('/',auth[_0x52b7('0x8')](),controller[_0x52b7('0xd')]);router[_0x52b7('0xe')](_0x52b7('0xc'),auth[_0x52b7('0x8')](),controller['update']);router[_0x52b7('0xf')](_0x52b7('0xc'),auth[_0x52b7('0x8')](),controller[_0x52b7('0x10')]);module[_0x52b7('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 88828c6..16e52cb 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 _0x18ec=['exports','STRING','DATE','moment','sequelize'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x18ec,0x1ac));var _0xc18e=function(_0x4261f8,_0x302a3b){_0x4261f8=_0x4261f8-0x0;var _0x10e63f=_0x18ec[_0x4261f8];return _0x10e63f;};'use strict';var moment=require(_0xc18e('0x0'));var Sequelize=require(_0xc18e('0x1'));module[_0xc18e('0x2')]={'uniqueid':{'type':Sequelize[_0xc18e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc18e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc18e('0x4')]},'acceptAt':{'type':Sequelize[_0xc18e('0x4')]},'exitAt':{'type':Sequelize[_0xc18e('0x4')]},'reason':{'type':Sequelize[_0xc18e('0x3')]}}; \ No newline at end of file +var _0x6dc0=['moment','exports','STRING','DATE'];(function(_0xa03892,_0x3646d0){var _0x5209be=function(_0x19a7e1){while(--_0x19a7e1){_0xa03892['push'](_0xa03892['shift']());}};_0x5209be(++_0x3646d0);}(_0x6dc0,0x18c));var _0x06dc=function(_0x3306b6,_0x42e90b){_0x3306b6=_0x3306b6-0x0;var _0x47340a=_0x6dc0[_0x3306b6];return _0x47340a;};'use strict';var moment=require(_0x06dc('0x0'));var Sequelize=require('sequelize');module[_0x06dc('0x1')]={'uniqueid':{'type':Sequelize[_0x06dc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x06dc('0x2')]},'joinAt':{'type':Sequelize[_0x06dc('0x3')]},'leaveAt':{'type':Sequelize[_0x06dc('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x06dc('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index d9586ae..04686f5 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 _0x0b0e=['merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x43abd4,_0x33370c){var _0x4af221=function(_0x49d153){while(--_0x49d153){_0x43abd4['push'](_0x43abd4['shift']());}};_0x4af221(++_0x33370c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x0b0e[_0x54c9dd];return _0x855156;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['MailQueueReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['MailQueueReport'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['MailQueueReport']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));};exports[_0xe0b0('0x4a')]=function(_0x54cf7b,_0x4b65d1){return db[_0xe0b0('0x2a')][_0xe0b0('0x4a')]()[_0xe0b0('0x23')](respondWithResult(_0x4b65d1,null))[_0xe0b0('0x43')](handleError(_0x4b65d1,null));}; \ No newline at end of file +var _0x8aad=['sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x3637ee,_0x3de607){var _0x34633=function(_0x2ffd98){while(--_0x2ffd98){_0x3637ee['push'](_0x3637ee['shift']());}};_0x34633(++_0x3de607);}(_0x8aad,0x146));var _0xd8aa=function(_0x1ed249,_0x1ea53d){_0x1ed249=_0x1ed249-0x0;var _0xc5cac0=_0x8aad[_0x1ed249];return _0xc5cac0;};'use strict';var emlformat=require(_0xd8aa('0x0'));var rimraf=require(_0xd8aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8aa('0x2'));var rp=require('request-promise');var moment=require(_0xd8aa('0x3'));var BPromise=require(_0xd8aa('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8aa('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8aa('0x6'));var fs=require('fs');var fs_extra=require(_0xd8aa('0x7'));var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xd'));var authService=require(_0xd8aa('0xe'));var qs=require(_0xd8aa('0xf'));var as=require(_0xd8aa('0x10'));var hardwareService=require(_0xd8aa('0x11'));var logger=require('../../config/logger')(_0xd8aa('0x12'));var utils=require(_0xd8aa('0x13'));var config=require(_0xd8aa('0x14'));var licenseUtil=require(_0xd8aa('0x15'));var db=require(_0xd8aa('0x16'))['db'];function respondWithStatusCode(_0x6ec0eb,_0x549fad){_0x549fad=_0x549fad||0xcc;return function(_0x1e7db8){if(_0x1e7db8){return _0x6ec0eb[_0xd8aa('0x17')](_0x549fad);}return _0x6ec0eb[_0xd8aa('0x18')](_0x549fad)['end']();};}function respondWithResult(_0x5a8c79,_0x275eff){_0x275eff=_0x275eff||0xc8;return function(_0x319ffe){if(_0x319ffe){return _0x5a8c79[_0xd8aa('0x18')](_0x275eff)['json'](_0x319ffe);}};}function respondWithFilteredResult(_0x2678ed,_0x180c56){return function(_0x39b5bc){if(_0x39b5bc){var _0x404ed6=typeof _0x180c56['offset']===_0xd8aa('0x19')&&typeof _0x180c56[_0xd8aa('0x1a')]==='undefined';var _0x16d5c6=_0x39b5bc[_0xd8aa('0x1b')];var _0x32e2cd=_0x404ed6?0x0:_0x180c56[_0xd8aa('0x1c')];var _0x2d34ac=_0x404ed6?_0x39b5bc['count']:_0x180c56[_0xd8aa('0x1c')]+_0x180c56[_0xd8aa('0x1a')];var _0xb156e6;if(_0x2d34ac>=_0x16d5c6){_0x2d34ac=_0x16d5c6;_0xb156e6=0xc8;}else{_0xb156e6=0xce;}_0x2678ed[_0xd8aa('0x18')](_0xb156e6);return _0x2678ed['set'](_0xd8aa('0x1d'),_0x32e2cd+'-'+_0x2d34ac+'/'+_0x16d5c6)[_0xd8aa('0x1e')](_0x39b5bc);}return null;};}function patchUpdates(_0x46d69b){return function(_0x3588ee){try{jsonpatch[_0xd8aa('0x1f')](_0x3588ee,_0x46d69b,!![]);}catch(_0x4fe5d8){return BPromise[_0xd8aa('0x20')](_0x4fe5d8);}return _0x3588ee[_0xd8aa('0x21')]();};}function saveUpdates(_0xc4f55c,_0x5910b3){return function(_0xa7cf85){if(_0xa7cf85){return _0xa7cf85[_0xd8aa('0x22')](_0xc4f55c)[_0xd8aa('0x23')](function(_0x290849){return _0x290849;});}return null;};}function removeEntity(_0x3ef3a9,_0x16758a){return function(_0x1f64f8){if(_0x1f64f8){return _0x1f64f8[_0xd8aa('0x24')]()[_0xd8aa('0x23')](function(){_0x3ef3a9[_0xd8aa('0x18')](0xcc)[_0xd8aa('0x25')]();});}};}function handleEntityNotFound(_0x370d6f,_0x26cc66){return function(_0x5f1027){if(!_0x5f1027){_0x370d6f[_0xd8aa('0x17')](0x194);}return _0x5f1027;};}function handleError(_0x59eb3f,_0xd4d204){_0xd4d204=_0xd4d204||0x1f4;return function(_0x1f6ab2){logger[_0xd8aa('0x26')](_0x1f6ab2[_0xd8aa('0x27')]);if(_0x1f6ab2[_0xd8aa('0x28')]){delete _0x1f6ab2[_0xd8aa('0x28')];}_0x59eb3f[_0xd8aa('0x18')](_0xd4d204)[_0xd8aa('0x29')](_0x1f6ab2);};}exports['index']=function(_0x1f2a28,_0x34b792){var _0x214393={},_0x49a7c8={},_0x19a59d={'count':0x0,'rows':[]};var _0x51c6f4=_[_0xd8aa('0x2a')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')],function(_0x168a2e){return{'name':_0x168a2e[_0xd8aa('0x2d')],'type':_0x168a2e[_0xd8aa('0x2e')][_0xd8aa('0x2f')]};});_0x49a7c8[_0xd8aa('0x30')]=_['map'](_0x51c6f4,_0xd8aa('0x28'));_0x49a7c8[_0xd8aa('0x31')]=_[_0xd8aa('0x32')](_0x1f2a28[_0xd8aa('0x31')]);_0x49a7c8[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],_0x49a7c8[_0xd8aa('0x31')]);_0x214393['attributes']=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],qs[_0xd8aa('0x35')](_0x1f2a28['query'][_0xd8aa('0x35')]));_0x214393[_0xd8aa('0x36')]=_0x214393[_0xd8aa('0x36')][_0xd8aa('0x37')]?_0x214393[_0xd8aa('0x36')]:_0x49a7c8[_0xd8aa('0x30')];if(!_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x38')](_0xd8aa('0x39'))){_0x214393['limit']=qs[_0xd8aa('0x1a')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1a')]);_0x214393[_0xd8aa('0x1c')]=qs[_0xd8aa('0x1c')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1c')]);}_0x214393[_0xd8aa('0x3a')]=qs[_0xd8aa('0x3b')](_0x1f2a28['query'][_0xd8aa('0x3b')]);_0x214393['where']=qs[_0xd8aa('0x33')](_[_0xd8aa('0x3c')](_0x1f2a28['query'],_0x49a7c8[_0xd8aa('0x33')]),_0x51c6f4);if(_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]){_0x214393[_0xd8aa('0x3e')]=_[_0xd8aa('0x3f')](_0x214393['where'],{'$or':_['map'](_0x51c6f4,function(_0x25145c){if(_0x25145c['type']!==_0xd8aa('0x40')){var _0x7a6df2={};_0x7a6df2[_0x25145c[_0xd8aa('0x28')]]={'$like':'%'+_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]+'%'};return _0x7a6df2;}})});}_0x214393=_[_0xd8aa('0x3f')]({},_0x214393,_0x1f2a28[_0xd8aa('0x41')]);var _0x3b0220={'where':_0x214393[_0xd8aa('0x3e')]};return db[_0xd8aa('0x2b')][_0xd8aa('0x1b')](_0x3b0220)['then'](function(_0x17ebb4){_0x19a59d[_0xd8aa('0x1b')]=_0x17ebb4;if(_0x1f2a28[_0xd8aa('0x31')]['includeAll']){_0x214393[_0xd8aa('0x42')]=[{'all':!![]}];}return db[_0xd8aa('0x2b')][_0xd8aa('0x43')](_0x214393);})[_0xd8aa('0x23')](function(_0x3a0284){_0x19a59d[_0xd8aa('0x44')]=_0x3a0284;return _0x19a59d;})[_0xd8aa('0x23')](respondWithFilteredResult(_0x34b792,_0x214393))[_0xd8aa('0x45')](handleError(_0x34b792,null));};exports[_0xd8aa('0x46')]=function(_0x3f5857,_0x20c7a0){var _0x3ec42f={'raw':!![],'where':{'id':_0x3f5857[_0xd8aa('0x47')]['id']}},_0x3b26c9={};_0x3b26c9[_0xd8aa('0x30')]=_[_0xd8aa('0x32')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')]);_0x3b26c9['query']=_[_0xd8aa('0x32')](_0x3f5857[_0xd8aa('0x31')]);_0x3b26c9[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x3b26c9[_0xd8aa('0x30')],_0x3b26c9[_0xd8aa('0x31')]);_0x3ec42f['attributes']=_[_0xd8aa('0x34')](_0x3b26c9['model'],qs[_0xd8aa('0x35')](_0x3f5857['query'][_0xd8aa('0x35')]));_0x3ec42f['attributes']=_0x3ec42f['attributes'][_0xd8aa('0x37')]?_0x3ec42f[_0xd8aa('0x36')]:_0x3b26c9[_0xd8aa('0x30')];if(_0x3f5857[_0xd8aa('0x31')][_0xd8aa('0x48')]){_0x3ec42f[_0xd8aa('0x42')]=[{'all':!![]}];}_0x3ec42f=_['merge']({},_0x3ec42f,_0x3f5857[_0xd8aa('0x41')]);return db[_0xd8aa('0x2b')][_0xd8aa('0x49')](_0x3ec42f)[_0xd8aa('0x23')](handleEntityNotFound(_0x20c7a0,null))[_0xd8aa('0x23')](respondWithResult(_0x20c7a0,null))['catch'](handleError(_0x20c7a0,null));};exports['create']=function(_0x58cf42,_0x1fd1dc){return db[_0xd8aa('0x2b')][_0xd8aa('0x4a')](_0x58cf42[_0xd8aa('0x4b')],{})[_0xd8aa('0x23')](respondWithResult(_0x1fd1dc,0xc9))[_0xd8aa('0x45')](handleError(_0x1fd1dc,null));};exports['update']=function(_0x221e2b,_0x241e23){if(_0x221e2b['body']['id']){delete _0x221e2b[_0xd8aa('0x4b')]['id'];}return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x221e2b['params']['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x241e23,null))[_0xd8aa('0x23')](saveUpdates(_0x221e2b[_0xd8aa('0x4b')],null))[_0xd8aa('0x23')](respondWithResult(_0x241e23,null))[_0xd8aa('0x45')](handleError(_0x241e23,null));};exports[_0xd8aa('0x24')]=function(_0x4f494d,_0x566d52){return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x4f494d[_0xd8aa('0x47')]['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x566d52,null))[_0xd8aa('0x23')](removeEntity(_0x566d52,null))[_0xd8aa('0x45')](handleError(_0x566d52,null));};exports[_0xd8aa('0x4c')]=function(_0x4f9d21,_0x9db7e3){return db[_0xd8aa('0x2b')]['describe']()[_0xd8aa('0x23')](respondWithResult(_0x9db7e3,null))['catch'](handleError(_0x9db7e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b7dffa4..39b98bb 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 _0xc40e=['uniqueid','util','../../config/logger','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x1b91b4,_0x301b8f){var _0x8c2bb6=function(_0x50cf26){while(--_0x50cf26){_0x1b91b4['push'](_0x1b91b4['shift']());}};_0x8c2bb6(++_0x301b8f);}(_0xc40e,0xb1));var _0xec40=function(_0x85e15f,_0x223e59){_0x85e15f=_0x85e15f-0x0;var _0x60ac92=_0xc40e[_0x85e15f];return _0x60ac92;};'use strict';var _=require('lodash');var util=require(_0xec40('0x0'));var logger=require(_0xec40('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec40('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec40('0x3'));var config=require(_0xec40('0x4'));var attributes=require(_0xec40('0x5'));module[_0xec40('0x6')]=function(_0x3f23a6,_0x4b7b5e){return _0x3f23a6[_0xec40('0x7')](_0xec40('0x8'),attributes,{'tableName':_0xec40('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xec40('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa76b=['MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa76b,0xdf));var _0xba76=function(_0x15ce67,_0x2effec){_0x15ce67=_0x15ce67-0x0;var _0x3f8160=_0xa76b[_0x15ce67];return _0x3f8160;};'use strict';var _=require(_0xba76('0x0'));var util=require(_0xba76('0x1'));var logger=require(_0xba76('0x2'))(_0xba76('0x3'));var moment=require(_0xba76('0x4'));var BPromise=require(_0xba76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba76('0x6'));var rimraf=require(_0xba76('0x7'));var config=require(_0xba76('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0xba76('0x9')]=function(_0x2ed2db,_0x3858bb){return _0x2ed2db[_0xba76('0xa')](_0xba76('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xba76('0xc'),'fields':[_0xba76('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e5b276c..d4afa5c 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x5a7904,_0x5bba42){var _0xd549a8=function(_0x52a897){while(--_0x52a897){_0x5a7904['push'](_0x5a7904['shift']());}};_0xd549a8(++_0x5bba42);}(_0xadb5,0xad));var _0x5adb=function(_0x1aa965,_0x26fdf9){_0x1aa965=_0x1aa965-0x0;var _0x292250=_0xadb5[_0x1aa965];return _0x292250;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _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(_0x1d060f,_0xf00e8e){var _0x5ab952=function(_0x4ea75a){while(--_0x4ea75a){_0x1d060f['push'](_0x1d060f['shift']());}};_0x5ab952(++_0xf00e8e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c22825b..3181f8b 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(_0x4aca28,_0x4ab42c){var _0x1946a0=function(_0x42c5cd){while(--_0x42c5cd){_0x4aca28['push'](_0x4aca28['shift']());}};_0x1946a0(++_0x4ab42c);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x10002f,_0xad989){var _0x3b4ef3=function(_0x55782e){while(--_0x55782e){_0x10002f['push'](_0x10002f['shift']());}};_0x3b4ef3(++_0xad989);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0xcb91[_0x2a5099];return _0x2802f1;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index f05c564..a0efdcc 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 _0xe693=['INTEGER','BOOLEAN','INBOX','sequelize','exports','STRING'];(function(_0x55daf2,_0x1b48de){var _0x1c8500=function(_0x4686b5){while(--_0x4686b5){_0x55daf2['push'](_0x55daf2['shift']());}};_0x1c8500(++_0x1b48de);}(_0xe693,0x19b));var _0x3e69=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xe693[_0x2300c7];return _0x23f720;};'use strict';var Sequelize=require(_0x3e69('0x0'));module[_0x3e69('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x3e69('0x2')]},'password':{'type':Sequelize[_0x3e69('0x2')]},'port':{'type':Sequelize[_0x3e69('0x3')]},'tls':{'type':Sequelize[_0x3e69('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3e69('0x2')],'defaultValue':_0x3e69('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x3e69('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9f0a=['BOOLEAN','INTEGER','INBOX','sequelize','STRING'];(function(_0x3f7c0d,_0x883b5){var _0x1d9d40=function(_0x2bf762){while(--_0x2bf762){_0x3f7c0d['push'](_0x3f7c0d['shift']());}};_0x1d9d40(++_0x883b5);}(_0x9f0a,0x1e8));var _0xa9f0=function(_0x435129,_0x496bd6){_0x435129=_0x435129-0x0;var _0x304dc3=_0x9f0a[_0x435129];return _0x304dc3;};'use strict';var Sequelize=require(_0xa9f0('0x0'));module['exports']={'description':{'type':Sequelize[_0xa9f0('0x1')]},'host':{'type':Sequelize[_0xa9f0('0x1')]},'authentication':{'type':Sequelize[_0xa9f0('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa9f0('0x1')]},'password':{'type':Sequelize[_0xa9f0('0x1')]},'port':{'type':Sequelize[_0xa9f0('0x3')]},'tls':{'type':Sequelize[_0xa9f0('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xa9f0('0x4')},'connTimeout':{'type':Sequelize[_0xa9f0('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa9f0('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xa9f0('0x1')]},'modernAuthentication':{'type':Sequelize[_0xa9f0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ab24a6c..dd2337c 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 _0xa57e=['define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x4acca9,_0x4d8d80){var _0x470cc9=function(_0x5b647a){while(--_0x5b647a){_0x4acca9['push'](_0x4acca9['shift']());}};_0x470cc9(++_0x4d8d80);}(_0xa57e,0xb9));var _0xea57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa57e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xea57('0x0'));var util=require('util');var logger=require(_0xea57('0x1'))(_0xea57('0x2'));var moment=require(_0xea57('0x3'));var BPromise=require(_0xea57('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea57('0x5'));var rimraf=require(_0xea57('0x6'));var config=require(_0xea57('0x7'));var attributes=require(_0xea57('0x8'));module[_0xea57('0x9')]=function(_0x16dd6d,_0x55965c){return _0x16dd6d[_0xea57('0xa')](_0xea57('0xb'),attributes,{'tableName':_0xea57('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae5b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xae5b,0x15c));var _0xbae5=function(_0x18aa56,_0x1a3f3a){_0x18aa56=_0x18aa56-0x0;var _0x3a1798=_0xae5b[_0x18aa56];return _0x3a1798;};'use strict';var _=require(_0xbae5('0x0'));var util=require(_0xbae5('0x1'));var logger=require(_0xbae5('0x2'))(_0xbae5('0x3'));var moment=require(_0xbae5('0x4'));var BPromise=require(_0xbae5('0x5'));var rp=require(_0xbae5('0x6'));var fs=require('fs');var path=require(_0xbae5('0x7'));var rimraf=require(_0xbae5('0x8'));var config=require(_0xbae5('0x9'));var attributes=require(_0xbae5('0xa'));module['exports']=function(_0x29a277,_0x3fed4d){return _0x29a277[_0xbae5('0xb')](_0xbae5('0xc'),attributes,{'tableName':_0xbae5('0xd'),'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 577178b..6a662fe 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 _0x9ddd=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','where','include','model','attributes','map','stringify','lodash','util','bluebird','randomstring'];(function(_0x162f2c,_0x3f6808){var _0x428fb8=function(_0x538e21){while(--_0x538e21){_0x162f2c['push'](_0x162f2c['shift']());}};_0x428fb8(++_0x3f6808);}(_0x9ddd,0xbc));var _0xd9dd=function(_0x1b279e,_0x3d9fff){_0x1b279e=_0x1b279e-0x0;var _0x58ad0e=_0x9ddd[_0x1b279e];return _0x58ad0e;};'use strict';var _=require(_0xd9dd('0x0'));var util=require(_0xd9dd('0x1'));var moment=require('moment');var BPromise=require(_0xd9dd('0x2'));var rs=require(_0xd9dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9dd('0x5'))(_0xd9dd('0x6'));var config=require(_0xd9dd('0x7'));var jayson=require(_0xd9dd('0x8'));var client=jayson[_0xd9dd('0x9')][_0xd9dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2afd8a,_0xb1f20c,_0x4bad9c){return new BPromise(function(_0x3b3c98,_0x367549){return client[_0xd9dd('0xb')](_0x2afd8a,_0x4bad9c)[_0xd9dd('0xc')](function(_0x412b94){logger[_0xd9dd('0xd')](_0xd9dd('0xe'),_0xb1f20c,_0xd9dd('0xf'));logger[_0xd9dd('0x10')](_0xd9dd('0x11'),_0xb1f20c,'request\x20sent',JSON['stringify'](_0x412b94));if(_0x412b94['error']){if(_0x412b94[_0xd9dd('0x12')][_0xd9dd('0x13')]===0x1f4){logger[_0xd9dd('0x12')](_0xd9dd('0xe'),_0xb1f20c,_0x412b94[_0xd9dd('0x12')][_0xd9dd('0x14')]);return _0x367549(_0x412b94['error'][_0xd9dd('0x14')]);}logger[_0xd9dd('0x12')](_0xd9dd('0xe'),_0xb1f20c,_0x412b94['error'][_0xd9dd('0x14')]);return _0x3b3c98(_0x412b94[_0xd9dd('0x12')]['message']);}else{logger['info'](_0xd9dd('0xe'),_0xb1f20c,_0xd9dd('0xf'));_0x3b3c98(_0x412b94['result'][_0xd9dd('0x14')]);}})[_0xd9dd('0x15')](function(_0x52ef0c){logger[_0xd9dd('0x12')](_0xd9dd('0xe'),_0xb1f20c,_0x52ef0c);_0x367549(_0x52ef0c);});});}exports[_0xd9dd('0x16')]=function(_0x3ef53a){var _0x55f0ec=this;return new Promise(function(_0x213aaf,_0x242a1e){return db[_0xd9dd('0x17')][_0xd9dd('0x18')]({'raw':_0x3ef53a['options']?_0x3ef53a[_0xd9dd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3ef53a[_0xd9dd('0x19')]?_0x3ef53a[_0xd9dd('0x19')][_0xd9dd('0x1a')]||null:null,'attributes':_0x3ef53a[_0xd9dd('0x19')]?_0x3ef53a[_0xd9dd('0x19')]['attributes']||null:null,'limit':_0x3ef53a[_0xd9dd('0x19')]?_0x3ef53a[_0xd9dd('0x19')]['limit']||null:null,'include':_0x3ef53a[_0xd9dd('0x19')]?_0x3ef53a['options'][_0xd9dd('0x1b')]?_['map'](_0x3ef53a[_0xd9dd('0x19')][_0xd9dd('0x1b')],function(_0x521ad7){return{'model':db[_0x521ad7[_0xd9dd('0x1c')]],'as':_0x521ad7['as'],'attributes':_0x521ad7[_0xd9dd('0x1d')],'include':_0x521ad7['include']?_['map'](_0x521ad7[_0xd9dd('0x1b')],function(_0x53168d){return{'model':db[_0x53168d[_0xd9dd('0x1c')]],'as':_0x53168d['as'],'attributes':_0x53168d[_0xd9dd('0x1d')],'include':_0x53168d[_0xd9dd('0x1b')]?_[_0xd9dd('0x1e')](_0x53168d[_0xd9dd('0x1b')],function(_0x219715){return{'model':db[_0x219715[_0xd9dd('0x1c')]],'as':_0x219715['as'],'attributes':_0x219715[_0xd9dd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd9dd('0xc')](function(_0xb07cea){logger[_0xd9dd('0xd')](_0xd9dd('0x16'),_0x3ef53a);logger[_0xd9dd('0x10')](_0xd9dd('0x16'),_0x3ef53a,JSON[_0xd9dd('0x1f')](_0xb07cea));_0x213aaf(_0xb07cea);})['catch'](function(_0x3624c0){logger['error'](_0xd9dd('0x16'),_0x3624c0[_0xd9dd('0x14')],_0x3ef53a);_0x242a1e(_0x55f0ec[_0xd9dd('0x12')](0x1f4,_0x3624c0[_0xd9dd('0x14')]));});});}; \ No newline at end of file +var _0x51a8=['result','catch','MailServerIn','options','raw','where','attributes','limit','include','model','map','GetMailServerIn','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x51a8,0xec));var _0x851a=function(_0x4f9edc,_0x260bbe){_0x4f9edc=_0x4f9edc-0x0;var _0x411798=_0x51a8[_0x4f9edc];return _0x411798;};'use strict';var _=require(_0x851a('0x0'));var util=require(_0x851a('0x1'));var moment=require('moment');var BPromise=require(_0x851a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x851a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x851a('0x4'));var logger=require(_0x851a('0x5'))(_0x851a('0x6'));var config=require(_0x851a('0x7'));var jayson=require(_0x851a('0x8'));var client=jayson['client'][_0x851a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4775c2,_0x233c96,_0x2814c6){return new BPromise(function(_0x16363c,_0x1d16d7){return client[_0x851a('0xa')](_0x4775c2,_0x2814c6)[_0x851a('0xb')](function(_0x1c6dd8){logger['info'](_0x851a('0xc'),_0x233c96,_0x851a('0xd'));logger['debug'](_0x851a('0xe'),_0x233c96,_0x851a('0xd'),JSON[_0x851a('0xf')](_0x1c6dd8));if(_0x1c6dd8[_0x851a('0x10')]){if(_0x1c6dd8['error'][_0x851a('0x11')]===0x1f4){logger[_0x851a('0x10')](_0x851a('0xc'),_0x233c96,_0x1c6dd8[_0x851a('0x10')][_0x851a('0x12')]);return _0x1d16d7(_0x1c6dd8[_0x851a('0x10')][_0x851a('0x12')]);}logger[_0x851a('0x10')](_0x851a('0xc'),_0x233c96,_0x1c6dd8[_0x851a('0x10')][_0x851a('0x12')]);return _0x16363c(_0x1c6dd8[_0x851a('0x10')][_0x851a('0x12')]);}else{logger[_0x851a('0x13')](_0x851a('0xc'),_0x233c96,_0x851a('0xd'));_0x16363c(_0x1c6dd8[_0x851a('0x14')][_0x851a('0x12')]);}})[_0x851a('0x15')](function(_0x1a9141){logger[_0x851a('0x10')](_0x851a('0xc'),_0x233c96,_0x1a9141);_0x1d16d7(_0x1a9141);});});}exports['GetMailServerIn']=function(_0x53b4ce){var _0x41f977=this;return new Promise(function(_0x4c9d2f,_0x467013){return db[_0x851a('0x16')]['findAll']({'raw':_0x53b4ce[_0x851a('0x17')]?_0x53b4ce[_0x851a('0x17')][_0x851a('0x18')]===undefined?!![]:![]:!![],'where':_0x53b4ce[_0x851a('0x17')]?_0x53b4ce[_0x851a('0x17')][_0x851a('0x19')]||null:null,'attributes':_0x53b4ce[_0x851a('0x17')]?_0x53b4ce[_0x851a('0x17')][_0x851a('0x1a')]||null:null,'limit':_0x53b4ce[_0x851a('0x17')]?_0x53b4ce['options'][_0x851a('0x1b')]||null:null,'include':_0x53b4ce[_0x851a('0x17')]?_0x53b4ce[_0x851a('0x17')][_0x851a('0x1c')]?_['map'](_0x53b4ce['options'][_0x851a('0x1c')],function(_0x52d153){return{'model':db[_0x52d153[_0x851a('0x1d')]],'as':_0x52d153['as'],'attributes':_0x52d153[_0x851a('0x1a')],'include':_0x52d153[_0x851a('0x1c')]?_[_0x851a('0x1e')](_0x52d153['include'],function(_0x4ff49c){return{'model':db[_0x4ff49c[_0x851a('0x1d')]],'as':_0x4ff49c['as'],'attributes':_0x4ff49c[_0x851a('0x1a')],'include':_0x4ff49c['include']?_['map'](_0x4ff49c[_0x851a('0x1c')],function(_0x4075bc){return{'model':db[_0x4075bc[_0x851a('0x1d')]],'as':_0x4075bc['as'],'attributes':_0x4075bc[_0x851a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x851a('0xb')](function(_0x4bce08){logger['info']('GetMailServerIn',_0x53b4ce);logger['debug'](_0x851a('0x1f'),_0x53b4ce,JSON[_0x851a('0xf')](_0x4bce08));_0x4c9d2f(_0x4bce08);})[_0x851a('0x15')](function(_0x40b809){logger[_0x851a('0x10')](_0x851a('0x1f'),_0x40b809[_0x851a('0x12')],_0x53b4ce);_0x467013(_0x41f977[_0x851a('0x10')](0x1f4,_0x40b809[_0x851a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 89ca5e4..befeeaa 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7a54,0x106));var _0x47a5=function(_0x47256d,_0x325a9b){_0x47256d=_0x47256d-0x0;var _0xb337b5=_0x7a54[_0x47256d];return _0xb337b5;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 18d98e0..5be6dfc 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 _0x96cc=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x134bfc,_0x144d5f){var _0x2f4dcc=function(_0x56cf22){while(--_0x56cf22){_0x134bfc['push'](_0x134bfc['shift']());}};_0x2f4dcc(++_0x144d5f);}(_0x96cc,0x16c));var _0xc96c=function(_0x2ea725,_0x429ede){_0x2ea725=_0x2ea725-0x0;var _0x33fb61=_0x96cc[_0x2ea725];return _0x33fb61;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'description':{'type':Sequelize[_0xc96c('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xc96c('0x1')]},'pass':{'type':Sequelize[_0xc96c('0x1')]},'port':{'type':Sequelize[_0xc96c('0x2')]},'secure':{'type':Sequelize[_0xc96c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xc96c('0x1')]},'authentication':{'type':Sequelize[_0xc96c('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xc96c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa74f=['BOOLEAN','STRING','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa74f,0x9a));var _0xfa74=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xa74f[_0x416cdc];return _0x1931ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xfa74('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfa74('0x0')]},'port':{'type':Sequelize[_0xfa74('0x1')]},'secure':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xfa74('0x0')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 8292989..2ed5721 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 _0x09c9=['hasOwnProperty','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length'];(function(_0x1c4e6f,_0x52b734){var _0x22a907=function(_0xd72b95){while(--_0xd72b95){_0x1c4e6f['push'](_0x1c4e6f['shift']());}};_0x22a907(++_0x52b734);}(_0x09c9,0x1ce));var _0x909c=function(_0x17cdd6,_0x94ae6d){_0x17cdd6=_0x17cdd6-0x0;var _0x42970a=_0x09c9[_0x17cdd6];return _0x42970a;};'use strict';var emlformat=require(_0x909c('0x0'));var rimraf=require(_0x909c('0x1'));var zipdir=require(_0x909c('0x2'));var jsonpatch=require(_0x909c('0x3'));var rp=require(_0x909c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x909c('0x5'));var util=require(_0x909c('0x6'));var path=require('path');var sox=require(_0x909c('0x7'));var csv=require(_0x909c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x909c('0x9'));var squel=require('squel');var crypto=require(_0x909c('0xa'));var jsforce=require(_0x909c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x909c('0xc'));var Papa=require(_0x909c('0xd'));var Redis=require(_0x909c('0xe'));var authService=require(_0x909c('0xf'));var qs=require(_0x909c('0x10'));var as=require(_0x909c('0x11'));var hardwareService=require(_0x909c('0x12'));var logger=require('../../config/logger')(_0x909c('0x13'));var utils=require(_0x909c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x909c('0x15'));var db=require(_0x909c('0x16'))['db'];function respondWithStatusCode(_0xcf0e42,_0x1737a7){_0x1737a7=_0x1737a7||0xcc;return function(_0x436be7){if(_0x436be7){return _0xcf0e42[_0x909c('0x17')](_0x1737a7);}return _0xcf0e42[_0x909c('0x18')](_0x1737a7)[_0x909c('0x19')]();};}function respondWithResult(_0x5c094d,_0x38a092){_0x38a092=_0x38a092||0xc8;return function(_0x159c5d){if(_0x159c5d){return _0x5c094d['status'](_0x38a092)[_0x909c('0x1a')](_0x159c5d);}};}function respondWithFilteredResult(_0x39cd77,_0xbbd2df){return function(_0x18f92a){if(_0x18f92a){var _0x2bbfa5=typeof _0xbbd2df[_0x909c('0x1b')]==='undefined'&&typeof _0xbbd2df[_0x909c('0x1c')]===_0x909c('0x1d');var _0xb5b30d=_0x18f92a[_0x909c('0x1e')];var _0x5d7224=_0x2bbfa5?0x0:_0xbbd2df[_0x909c('0x1b')];var _0x1a40b4=_0x2bbfa5?_0x18f92a[_0x909c('0x1e')]:_0xbbd2df[_0x909c('0x1b')]+_0xbbd2df[_0x909c('0x1c')];var _0x415016;if(_0x1a40b4>=_0xb5b30d){_0x1a40b4=_0xb5b30d;_0x415016=0xc8;}else{_0x415016=0xce;}_0x39cd77[_0x909c('0x18')](_0x415016);return _0x39cd77[_0x909c('0x1f')](_0x909c('0x20'),_0x5d7224+'-'+_0x1a40b4+'/'+_0xb5b30d)['json'](_0x18f92a);}return null;};}function patchUpdates(_0x4ff6fd){return function(_0x1542b3){try{jsonpatch[_0x909c('0x21')](_0x1542b3,_0x4ff6fd,!![]);}catch(_0x512ec5){return BPromise[_0x909c('0x22')](_0x512ec5);}return _0x1542b3['save']();};}function saveUpdates(_0x37c223,_0x514be0){return function(_0x39a85c){if(_0x39a85c){return _0x39a85c[_0x909c('0x23')](_0x37c223)[_0x909c('0x24')](function(_0x160457){return _0x160457;});}return null;};}function removeEntity(_0x4c95dc,_0x6662e6){return function(_0x3e2931){if(_0x3e2931){return _0x3e2931['destroy']()[_0x909c('0x24')](function(){_0x4c95dc[_0x909c('0x18')](0xcc)[_0x909c('0x19')]();});}};}function handleEntityNotFound(_0x21a627,_0x899c6d){return function(_0x1fe4c3){if(!_0x1fe4c3){_0x21a627[_0x909c('0x17')](0x194);}return _0x1fe4c3;};}function handleError(_0x23be9b,_0x73fc15){_0x73fc15=_0x73fc15||0x1f4;return function(_0x3238d7){logger[_0x909c('0x25')](_0x3238d7[_0x909c('0x26')]);if(_0x3238d7['name']){delete _0x3238d7['name'];}_0x23be9b[_0x909c('0x18')](_0x73fc15)[_0x909c('0x27')](_0x3238d7);};}exports[_0x909c('0x28')]=function(_0x3c7f0a,_0xf4096e){var _0x33d6b3={},_0x57dd41={},_0x30f73b={'count':0x0,'rows':[]};var _0x3f6fbb=_[_0x909c('0x29')](db[_0x909c('0x2a')][_0x909c('0x2b')],function(_0x3dd70b){return{'name':_0x3dd70b[_0x909c('0x2c')],'type':_0x3dd70b[_0x909c('0x2d')][_0x909c('0x2e')]};});_0x57dd41[_0x909c('0x2f')]=_[_0x909c('0x29')](_0x3f6fbb,_0x909c('0x30'));_0x57dd41[_0x909c('0x31')]=_[_0x909c('0x32')](_0x3c7f0a[_0x909c('0x31')]);_0x57dd41[_0x909c('0x33')]=_[_0x909c('0x34')](_0x57dd41[_0x909c('0x2f')],_0x57dd41[_0x909c('0x31')]);_0x33d6b3['attributes']=_[_0x909c('0x34')](_0x57dd41[_0x909c('0x2f')],qs[_0x909c('0x35')](_0x3c7f0a[_0x909c('0x31')][_0x909c('0x35')]));_0x33d6b3[_0x909c('0x36')]=_0x33d6b3[_0x909c('0x36')][_0x909c('0x37')]?_0x33d6b3[_0x909c('0x36')]:_0x57dd41[_0x909c('0x2f')];if(!_0x3c7f0a[_0x909c('0x31')][_0x909c('0x38')]('nolimit')){_0x33d6b3[_0x909c('0x1c')]=qs[_0x909c('0x1c')](_0x3c7f0a[_0x909c('0x31')][_0x909c('0x1c')]);_0x33d6b3['offset']=qs[_0x909c('0x1b')](_0x3c7f0a['query'][_0x909c('0x1b')]);}_0x33d6b3[_0x909c('0x39')]=qs[_0x909c('0x3a')](_0x3c7f0a['query'][_0x909c('0x3a')]);_0x33d6b3['where']=qs[_0x909c('0x33')](_[_0x909c('0x3b')](_0x3c7f0a['query'],_0x57dd41['filters']),_0x3f6fbb);if(_0x3c7f0a[_0x909c('0x31')]['filter']){_0x33d6b3[_0x909c('0x3c')]=_[_0x909c('0x3d')](_0x33d6b3[_0x909c('0x3c')],{'$or':_[_0x909c('0x29')](_0x3f6fbb,function(_0x5bf5c6){if(_0x5bf5c6[_0x909c('0x2d')]!=='VIRTUAL'){var _0x3ab37b={};_0x3ab37b[_0x5bf5c6[_0x909c('0x30')]]={'$like':'%'+_0x3c7f0a[_0x909c('0x31')][_0x909c('0x3e')]+'%'};return _0x3ab37b;}})});}_0x33d6b3=_[_0x909c('0x3d')]({},_0x33d6b3,_0x3c7f0a[_0x909c('0x3f')]);var _0x453c87={'where':_0x33d6b3[_0x909c('0x3c')]};return db[_0x909c('0x2a')]['count'](_0x453c87)[_0x909c('0x24')](function(_0x508619){_0x30f73b[_0x909c('0x1e')]=_0x508619;if(_0x3c7f0a['query'][_0x909c('0x40')]){_0x33d6b3[_0x909c('0x41')]=[{'all':!![]}];}return db[_0x909c('0x2a')][_0x909c('0x42')](_0x33d6b3);})[_0x909c('0x24')](function(_0xd1d411){_0x30f73b['rows']=_0xd1d411;return _0x30f73b;})[_0x909c('0x24')](respondWithFilteredResult(_0xf4096e,_0x33d6b3))[_0x909c('0x43')](handleError(_0xf4096e,null));};exports[_0x909c('0x44')]=function(_0x4d4cc8,_0x3f3b22){var _0x4d7f94={'raw':!![],'where':{'id':_0x4d4cc8[_0x909c('0x45')]['id']}},_0x210709={};_0x210709['model']=_[_0x909c('0x32')](db[_0x909c('0x2a')][_0x909c('0x2b')]);_0x210709[_0x909c('0x31')]=_[_0x909c('0x32')](_0x4d4cc8[_0x909c('0x31')]);_0x210709[_0x909c('0x33')]=_['intersection'](_0x210709[_0x909c('0x2f')],_0x210709[_0x909c('0x31')]);_0x4d7f94[_0x909c('0x36')]=_[_0x909c('0x34')](_0x210709[_0x909c('0x2f')],qs[_0x909c('0x35')](_0x4d4cc8[_0x909c('0x31')][_0x909c('0x35')]));_0x4d7f94[_0x909c('0x36')]=_0x4d7f94[_0x909c('0x36')]['length']?_0x4d7f94['attributes']:_0x210709[_0x909c('0x2f')];if(_0x4d4cc8[_0x909c('0x31')][_0x909c('0x40')]){_0x4d7f94[_0x909c('0x41')]=[{'all':!![]}];}_0x4d7f94=_[_0x909c('0x3d')]({},_0x4d7f94,_0x4d4cc8[_0x909c('0x3f')]);return db['MailServerOut'][_0x909c('0x46')](_0x4d7f94)[_0x909c('0x24')](handleEntityNotFound(_0x3f3b22,null))[_0x909c('0x24')](respondWithResult(_0x3f3b22,null))[_0x909c('0x43')](handleError(_0x3f3b22,null));};exports[_0x909c('0x47')]=function(_0x6175d6,_0x14909d){return db[_0x909c('0x2a')][_0x909c('0x47')](_0x6175d6['body'],{})[_0x909c('0x24')](respondWithResult(_0x14909d,0xc9))[_0x909c('0x43')](handleError(_0x14909d,null));};exports[_0x909c('0x23')]=function(_0x18958b,_0x4732c9){if(_0x18958b['body']['id']){delete _0x18958b[_0x909c('0x48')]['id'];}return db['MailServerOut'][_0x909c('0x46')]({'where':{'id':_0x18958b[_0x909c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4732c9,null))[_0x909c('0x24')](saveUpdates(_0x18958b[_0x909c('0x48')],null))[_0x909c('0x24')](respondWithResult(_0x4732c9,null))['catch'](handleError(_0x4732c9,null));};exports[_0x909c('0x49')]=function(_0x269adf,_0x301e17){return db[_0x909c('0x2a')][_0x909c('0x46')]({'where':{'id':_0x269adf[_0x909c('0x45')]['id']}})[_0x909c('0x24')](handleEntityNotFound(_0x301e17,null))['then'](removeEntity(_0x301e17,null))['catch'](handleError(_0x301e17,null));}; \ No newline at end of file +var _0x5c28=['findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','map','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','name','filter','options','MailServerOut','includeAll','include'];(function(_0x1a0396,_0x7ee349){var _0xfefa06=function(_0x2e24a0){while(--_0x2e24a0){_0x1a0396['push'](_0x1a0396['shift']());}};_0xfefa06(++_0x7ee349);}(_0x5c28,0x124));var _0x85c2=function(_0x5baa47,_0x3d1f3d){_0x5baa47=_0x5baa47-0x0;var _0x3cd15f=_0x5c28[_0x5baa47];return _0x3cd15f;};'use strict';var emlformat=require(_0x85c2('0x0'));var rimraf=require(_0x85c2('0x1'));var zipdir=require(_0x85c2('0x2'));var jsonpatch=require(_0x85c2('0x3'));var rp=require(_0x85c2('0x4'));var moment=require('moment');var BPromise=require(_0x85c2('0x5'));var Mustache=require(_0x85c2('0x6'));var util=require('util');var path=require(_0x85c2('0x7'));var sox=require(_0x85c2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x85c2('0x9'));var crypto=require('crypto');var jsforce=require(_0x85c2('0xa'));var deskjs=require(_0x85c2('0xb'));var toCsv=require(_0x85c2('0xc'));var querystring=require(_0x85c2('0xd'));var Papa=require(_0x85c2('0xe'));var Redis=require(_0x85c2('0xf'));var authService=require(_0x85c2('0x10'));var qs=require(_0x85c2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x85c2('0x12'));var utils=require('../../config/utils');var config=require(_0x85c2('0x13'));var licenseUtil=require(_0x85c2('0x14'));var db=require(_0x85c2('0x15'))['db'];function respondWithStatusCode(_0x39ae92,_0x46ee83){_0x46ee83=_0x46ee83||0xcc;return function(_0xd6b594){if(_0xd6b594){return _0x39ae92['sendStatus'](_0x46ee83);}return _0x39ae92[_0x85c2('0x16')](_0x46ee83)[_0x85c2('0x17')]();};}function respondWithResult(_0x18a0de,_0x41533b){_0x41533b=_0x41533b||0xc8;return function(_0x9b062a){if(_0x9b062a){return _0x18a0de['status'](_0x41533b)[_0x85c2('0x18')](_0x9b062a);}};}function respondWithFilteredResult(_0x3d336c,_0x6c9944){return function(_0x277a9a){if(_0x277a9a){var _0x140640=typeof _0x6c9944['offset']==='undefined'&&typeof _0x6c9944[_0x85c2('0x19')]===_0x85c2('0x1a');var _0xdbf0ee=_0x277a9a['count'];var _0x32844f=_0x140640?0x0:_0x6c9944['offset'];var _0x3e55e0=_0x140640?_0x277a9a[_0x85c2('0x1b')]:_0x6c9944[_0x85c2('0x1c')]+_0x6c9944[_0x85c2('0x19')];var _0x23ac2c;if(_0x3e55e0>=_0xdbf0ee){_0x3e55e0=_0xdbf0ee;_0x23ac2c=0xc8;}else{_0x23ac2c=0xce;}_0x3d336c['status'](_0x23ac2c);return _0x3d336c['set'](_0x85c2('0x1d'),_0x32844f+'-'+_0x3e55e0+'/'+_0xdbf0ee)['json'](_0x277a9a);}return null;};}function patchUpdates(_0xf59a77){return function(_0x32e598){try{jsonpatch[_0x85c2('0x1e')](_0x32e598,_0xf59a77,!![]);}catch(_0x31eac6){return BPromise[_0x85c2('0x1f')](_0x31eac6);}return _0x32e598[_0x85c2('0x20')]();};}function saveUpdates(_0x30eeed,_0xcfe362){return function(_0x32b812){if(_0x32b812){return _0x32b812[_0x85c2('0x21')](_0x30eeed)[_0x85c2('0x22')](function(_0x310be8){return _0x310be8;});}return null;};}function removeEntity(_0x5aeefc,_0xcd0f72){return function(_0x574e52){if(_0x574e52){return _0x574e52[_0x85c2('0x23')]()[_0x85c2('0x22')](function(){_0x5aeefc[_0x85c2('0x16')](0xcc)[_0x85c2('0x17')]();});}};}function handleEntityNotFound(_0x39d77d,_0x267a1e){return function(_0x53504f){if(!_0x53504f){_0x39d77d[_0x85c2('0x24')](0x194);}return _0x53504f;};}function handleError(_0x8ecf85,_0x54e9f8){_0x54e9f8=_0x54e9f8||0x1f4;return function(_0x3b34a8){logger[_0x85c2('0x25')](_0x3b34a8[_0x85c2('0x26')]);if(_0x3b34a8['name']){delete _0x3b34a8['name'];}_0x8ecf85[_0x85c2('0x16')](_0x54e9f8)['send'](_0x3b34a8);};}exports['index']=function(_0x25ebe8,_0xc1ba2f){var _0x29ba2e={},_0x2f0517={},_0x2a4d5a={'count':0x0,'rows':[]};var _0x218377=_[_0x85c2('0x27')](db['MailServerOut']['rawAttributes'],function(_0x2d5e5f){return{'name':_0x2d5e5f[_0x85c2('0x28')],'type':_0x2d5e5f[_0x85c2('0x29')]['key']};});_0x2f0517[_0x85c2('0x2a')]=_[_0x85c2('0x27')](_0x218377,'name');_0x2f0517[_0x85c2('0x2b')]=_[_0x85c2('0x2c')](_0x25ebe8[_0x85c2('0x2b')]);_0x2f0517['filters']=_[_0x85c2('0x2d')](_0x2f0517['model'],_0x2f0517[_0x85c2('0x2b')]);_0x29ba2e['attributes']=_['intersection'](_0x2f0517[_0x85c2('0x2a')],qs[_0x85c2('0x2e')](_0x25ebe8[_0x85c2('0x2b')][_0x85c2('0x2e')]));_0x29ba2e[_0x85c2('0x2f')]=_0x29ba2e[_0x85c2('0x2f')][_0x85c2('0x30')]?_0x29ba2e['attributes']:_0x2f0517[_0x85c2('0x2a')];if(!_0x25ebe8[_0x85c2('0x2b')]['hasOwnProperty'](_0x85c2('0x31'))){_0x29ba2e[_0x85c2('0x19')]=qs[_0x85c2('0x19')](_0x25ebe8[_0x85c2('0x2b')][_0x85c2('0x19')]);_0x29ba2e[_0x85c2('0x1c')]=qs[_0x85c2('0x1c')](_0x25ebe8['query']['offset']);}_0x29ba2e[_0x85c2('0x32')]=qs[_0x85c2('0x33')](_0x25ebe8['query'][_0x85c2('0x33')]);_0x29ba2e['where']=qs['filters'](_[_0x85c2('0x34')](_0x25ebe8[_0x85c2('0x2b')],_0x2f0517[_0x85c2('0x35')]),_0x218377);if(_0x25ebe8[_0x85c2('0x2b')]['filter']){_0x29ba2e[_0x85c2('0x36')]=_[_0x85c2('0x37')](_0x29ba2e[_0x85c2('0x36')],{'$or':_[_0x85c2('0x27')](_0x218377,function(_0x37e44d){if(_0x37e44d[_0x85c2('0x29')]!==_0x85c2('0x38')){var _0x5be5a1={};_0x5be5a1[_0x37e44d[_0x85c2('0x39')]]={'$like':'%'+_0x25ebe8[_0x85c2('0x2b')][_0x85c2('0x3a')]+'%'};return _0x5be5a1;}})});}_0x29ba2e=_[_0x85c2('0x37')]({},_0x29ba2e,_0x25ebe8[_0x85c2('0x3b')]);var _0x54556e={'where':_0x29ba2e[_0x85c2('0x36')]};return db[_0x85c2('0x3c')][_0x85c2('0x1b')](_0x54556e)[_0x85c2('0x22')](function(_0x13b176){_0x2a4d5a[_0x85c2('0x1b')]=_0x13b176;if(_0x25ebe8[_0x85c2('0x2b')][_0x85c2('0x3d')]){_0x29ba2e[_0x85c2('0x3e')]=[{'all':!![]}];}return db[_0x85c2('0x3c')][_0x85c2('0x3f')](_0x29ba2e);})[_0x85c2('0x22')](function(_0x505614){_0x2a4d5a[_0x85c2('0x40')]=_0x505614;return _0x2a4d5a;})[_0x85c2('0x22')](respondWithFilteredResult(_0xc1ba2f,_0x29ba2e))[_0x85c2('0x41')](handleError(_0xc1ba2f,null));};exports[_0x85c2('0x42')]=function(_0x28d951,_0x13bbe7){var _0x5901b5={'raw':!![],'where':{'id':_0x28d951[_0x85c2('0x43')]['id']}},_0x4d9f7e={};_0x4d9f7e[_0x85c2('0x2a')]=_[_0x85c2('0x2c')](db[_0x85c2('0x3c')]['rawAttributes']);_0x4d9f7e['query']=_['keys'](_0x28d951[_0x85c2('0x2b')]);_0x4d9f7e[_0x85c2('0x35')]=_[_0x85c2('0x2d')](_0x4d9f7e[_0x85c2('0x2a')],_0x4d9f7e[_0x85c2('0x2b')]);_0x5901b5[_0x85c2('0x2f')]=_[_0x85c2('0x2d')](_0x4d9f7e[_0x85c2('0x2a')],qs[_0x85c2('0x2e')](_0x28d951['query'][_0x85c2('0x2e')]));_0x5901b5[_0x85c2('0x2f')]=_0x5901b5[_0x85c2('0x2f')]['length']?_0x5901b5['attributes']:_0x4d9f7e[_0x85c2('0x2a')];if(_0x28d951[_0x85c2('0x2b')][_0x85c2('0x3d')]){_0x5901b5[_0x85c2('0x3e')]=[{'all':!![]}];}_0x5901b5=_[_0x85c2('0x37')]({},_0x5901b5,_0x28d951[_0x85c2('0x3b')]);return db['MailServerOut'][_0x85c2('0x44')](_0x5901b5)[_0x85c2('0x22')](handleEntityNotFound(_0x13bbe7,null))[_0x85c2('0x22')](respondWithResult(_0x13bbe7,null))['catch'](handleError(_0x13bbe7,null));};exports[_0x85c2('0x45')]=function(_0x4874c4,_0x46edf9){return db[_0x85c2('0x3c')][_0x85c2('0x45')](_0x4874c4[_0x85c2('0x46')],{})['then'](respondWithResult(_0x46edf9,0xc9))[_0x85c2('0x41')](handleError(_0x46edf9,null));};exports[_0x85c2('0x21')]=function(_0x922dfd,_0x2f4ca3){if(_0x922dfd[_0x85c2('0x46')]['id']){delete _0x922dfd[_0x85c2('0x46')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x922dfd[_0x85c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f4ca3,null))['then'](saveUpdates(_0x922dfd[_0x85c2('0x46')],null))[_0x85c2('0x22')](respondWithResult(_0x2f4ca3,null))['catch'](handleError(_0x2f4ca3,null));};exports[_0x85c2('0x23')]=function(_0x441ab6,_0x39bc4c){return db[_0x85c2('0x3c')][_0x85c2('0x44')]({'where':{'id':_0x441ab6[_0x85c2('0x43')]['id']}})[_0x85c2('0x22')](handleEntityNotFound(_0x39bc4c,null))[_0x85c2('0x22')](removeEntity(_0x39bc4c,null))[_0x85c2('0x41')](handleError(_0x39bc4c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 3da8f65..9ffc0fe 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 _0x3268=['bluebird','request-promise','path','rimraf','../../config/environment','MailServerOut','lodash','util','../../config/logger','api'];(function(_0x1729f0,_0x45e936){var _0x24d0ba=function(_0x5ed3fd){while(--_0x5ed3fd){_0x1729f0['push'](_0x1729f0['shift']());}};_0x24d0ba(++_0x45e936);}(_0x3268,0x100));var _0x8326=function(_0x1bb9fe,_0x164e17){_0x1bb9fe=_0x1bb9fe-0x0;var _0xf9d52a=_0x3268[_0x1bb9fe];return _0xf9d52a;};'use strict';var _=require(_0x8326('0x0'));var util=require(_0x8326('0x1'));var logger=require(_0x8326('0x2'))(_0x8326('0x3'));var moment=require('moment');var BPromise=require(_0x8326('0x4'));var rp=require(_0x8326('0x5'));var fs=require('fs');var path=require(_0x8326('0x6'));var rimraf=require(_0x8326('0x7'));var config=require(_0x8326('0x8'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x199cd3,_0xb6cb14){return _0x199cd3['define'](_0x8326('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3224=['../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3bd058,_0x589e62){var _0x49a71a=function(_0x3a65ee){while(--_0x3a65ee){_0x3bd058['push'](_0x3bd058['shift']());}};_0x49a71a(++_0x589e62);}(_0x3224,0x148));var _0x4322=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x3224[_0x47568e];return _0x33815b;};'use strict';var _=require(_0x4322('0x0'));var util=require(_0x4322('0x1'));var logger=require(_0x4322('0x2'))(_0x4322('0x3'));var moment=require(_0x4322('0x4'));var BPromise=require(_0x4322('0x5'));var rp=require(_0x4322('0x6'));var fs=require('fs');var path=require(_0x4322('0x7'));var rimraf=require('rimraf');var config=require(_0x4322('0x8'));var attributes=require(_0x4322('0x9'));module[_0x4322('0xa')]=function(_0x383e1e,_0x4336fe){return _0x383e1e[_0x4322('0xb')](_0x4322('0xc'),attributes,{'tableName':_0x4322('0xd'),'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 d873aa1..2d786bc 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x7127ba,_0x2ccec2){_0x7127ba=_0x7127ba-0x0;var _0x3ca752=_0x7a54[_0x7127ba];return _0x3ca752;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x605980,_0x324097){var _0x3eb7b2=function(_0x57fb70){while(--_0x57fb70){_0x605980['push'](_0x605980['shift']());}};_0x3eb7b2(++_0x324097);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'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 4e2f56d..ad0f2bb 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 _0x9038=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0xda118a,_0x2688c9){var _0x3f86fa=function(_0x8a8727){while(--_0x8a8727){_0xda118a['push'](_0xda118a['shift']());}};_0x3f86fa(++_0x2688c9);}(_0x9038,0x15d));var _0x8903=function(_0x387b9b,_0x177bce){_0x387b9b=_0x387b9b-0x0;var _0x33dc4e=_0x9038[_0x387b9b];return _0x33dc4e;};'use strict';var multer=require(_0x8903('0x0'));var util=require(_0x8903('0x1'));var path=require(_0x8903('0x2'));var timeout=require(_0x8903('0x3'));var express=require(_0x8903('0x4'));var router=express['Router']();var fs_extra=require(_0x8903('0x5'));var auth=require(_0x8903('0x6'));var interaction=require(_0x8903('0x7'));var config=require(_0x8903('0x8'));var controller=require(_0x8903('0x9'));router[_0x8903('0xa')]('/',auth[_0x8903('0xb')](),controller['index']);router[_0x8903('0xa')](_0x8903('0xc'),auth[_0x8903('0xb')](),controller[_0x8903('0xd')]);router[_0x8903('0xa')](_0x8903('0xe'),auth[_0x8903('0xb')](),controller[_0x8903('0xf')]);router[_0x8903('0x10')]('/',auth['isAuthenticated'](),controller[_0x8903('0x11')]);router[_0x8903('0x12')](_0x8903('0xe'),auth[_0x8903('0xb')](),controller[_0x8903('0x13')]);router[_0x8903('0x14')](_0x8903('0xe'),auth[_0x8903('0xb')](),controller[_0x8903('0x15')]);module[_0x8903('0x16')]=router; \ No newline at end of file +var _0x1367=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x1367,0x1f2));var _0x7136=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0x1367[_0x90f34f];return _0x4b18cf;};'use strict';var multer=require('multer');var util=require(_0x7136('0x0'));var path=require(_0x7136('0x1'));var timeout=require(_0x7136('0x2'));var express=require(_0x7136('0x3'));var router=express[_0x7136('0x4')]();var fs_extra=require(_0x7136('0x5'));var auth=require(_0x7136('0x6'));var interaction=require(_0x7136('0x7'));var config=require(_0x7136('0x8'));var controller=require(_0x7136('0x9'));router[_0x7136('0xa')]('/',auth[_0x7136('0xb')](),controller[_0x7136('0xc')]);router[_0x7136('0xa')](_0x7136('0xd'),auth[_0x7136('0xb')](),controller[_0x7136('0xe')]);router[_0x7136('0xa')](_0x7136('0xf'),auth[_0x7136('0xb')](),controller[_0x7136('0x10')]);router[_0x7136('0x11')]('/',auth['isAuthenticated'](),controller[_0x7136('0x12')]);router[_0x7136('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7136('0x14')]);router[_0x7136('0x15')](_0x7136('0xf'),auth['isAuthenticated'](),controller[_0x7136('0x16')]);module[_0x7136('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a204452..f606e77 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 _0x6ec2=['sequelize','exports','STRING','name'];(function(_0x5f0195,_0x901e6){var _0x336e87=function(_0x21af61){while(--_0x21af61){_0x5f0195['push'](_0x5f0195['shift']());}};_0x336e87(++_0x901e6);}(_0x6ec2,0x78));var _0x26ec=function(_0x26b2db,_0x46dcb4){_0x26b2db=_0x26b2db-0x0;var _0x5eb8ed=_0x6ec2[_0x26b2db];return _0x5eb8ed;};'use strict';var Sequelize=require(_0x26ec('0x0'));module[_0x26ec('0x1')]={'name':{'type':Sequelize[_0x26ec('0x2')],'unique':_0x26ec('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x26ec('0x2')]}}; \ No newline at end of file +var _0x27a0=['STRING','name','exports'];(function(_0x789b06,_0x38e1b0){var _0x22ff8b=function(_0x1bccb2){while(--_0x1bccb2){_0x789b06['push'](_0x789b06['shift']());}};_0x22ff8b(++_0x38e1b0);}(_0x27a0,0xbf));var _0x027a=function(_0x124397,_0x20709){_0x124397=_0x124397-0x0;var _0x14ecc7=_0x27a0[_0x124397];return _0x14ecc7;};'use strict';var Sequelize=require('sequelize');module[_0x027a('0x0')]={'name':{'type':Sequelize[_0x027a('0x1')],'unique':_0x027a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x027a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 483a5b1..0f50de7 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 _0x8880=['name','send','index','map','MailSubstatus','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0xe04a32,_0x5275d3){var _0x101a34=function(_0x17650d){while(--_0x17650d){_0xe04a32['push'](_0xe04a32['shift']());}};_0x101a34(++_0x5275d3);}(_0x8880,0x1a3));var _0x0888=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0x8880[_0x33bcdb];return _0x18a9bf;};'use strict';var emlformat=require(_0x0888('0x0'));var rimraf=require(_0x0888('0x1'));var zipdir=require(_0x0888('0x2'));var jsonpatch=require(_0x0888('0x3'));var rp=require(_0x0888('0x4'));var moment=require(_0x0888('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0888('0x6'));var util=require(_0x0888('0x7'));var path=require(_0x0888('0x8'));var sox=require(_0x0888('0x9'));var csv=require('to-csv');var ejs=require(_0x0888('0xa'));var fs=require('fs');var fs_extra=require(_0x0888('0xb'));var _=require('lodash');var squel=require(_0x0888('0xc'));var crypto=require(_0x0888('0xd'));var jsforce=require(_0x0888('0xe'));var deskjs=require(_0x0888('0xf'));var toCsv=require(_0x0888('0x10'));var querystring=require(_0x0888('0x11'));var Papa=require(_0x0888('0x12'));var Redis=require(_0x0888('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0888('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0888('0x15'));var utils=require(_0x0888('0x16'));var config=require(_0x0888('0x17'));var licenseUtil=require(_0x0888('0x18'));var db=require(_0x0888('0x19'))['db'];function respondWithStatusCode(_0x47744d,_0x3f6a52){_0x3f6a52=_0x3f6a52||0xcc;return function(_0x51495b){if(_0x51495b){return _0x47744d[_0x0888('0x1a')](_0x3f6a52);}return _0x47744d['status'](_0x3f6a52)[_0x0888('0x1b')]();};}function respondWithResult(_0x198b58,_0x1c96c9){_0x1c96c9=_0x1c96c9||0xc8;return function(_0xa12e08){if(_0xa12e08){return _0x198b58[_0x0888('0x1c')](_0x1c96c9)[_0x0888('0x1d')](_0xa12e08);}};}function respondWithFilteredResult(_0x19c137,_0x1ab000){return function(_0x3c8bd6){if(_0x3c8bd6){var _0x1261cc=typeof _0x1ab000['offset']===_0x0888('0x1e')&&typeof _0x1ab000[_0x0888('0x1f')]===_0x0888('0x1e');var _0x130956=_0x3c8bd6[_0x0888('0x20')];var _0x10f9c6=_0x1261cc?0x0:_0x1ab000['offset'];var _0x2dbe5d=_0x1261cc?_0x3c8bd6[_0x0888('0x20')]:_0x1ab000[_0x0888('0x21')]+_0x1ab000['limit'];var _0x571193;if(_0x2dbe5d>=_0x130956){_0x2dbe5d=_0x130956;_0x571193=0xc8;}else{_0x571193=0xce;}_0x19c137[_0x0888('0x1c')](_0x571193);return _0x19c137[_0x0888('0x22')](_0x0888('0x23'),_0x10f9c6+'-'+_0x2dbe5d+'/'+_0x130956)[_0x0888('0x1d')](_0x3c8bd6);}return null;};}function patchUpdates(_0x1f3a8b){return function(_0x46ee46){try{jsonpatch[_0x0888('0x24')](_0x46ee46,_0x1f3a8b,!![]);}catch(_0x43ce7f){return BPromise[_0x0888('0x25')](_0x43ce7f);}return _0x46ee46[_0x0888('0x26')]();};}function saveUpdates(_0x549568,_0x348e65){return function(_0xdccb27){if(_0xdccb27){return _0xdccb27[_0x0888('0x27')](_0x549568)[_0x0888('0x28')](function(_0x114cb1){return _0x114cb1;});}return null;};}function removeEntity(_0x552747,_0x190adb){return function(_0x517cc5){if(_0x517cc5){return _0x517cc5['destroy']()['then'](function(){_0x552747[_0x0888('0x1c')](0xcc)[_0x0888('0x1b')]();});}};}function handleEntityNotFound(_0x47a7bc,_0xf109b1){return function(_0x342977){if(!_0x342977){_0x47a7bc['sendStatus'](0x194);}return _0x342977;};}function handleError(_0x54140e,_0x341a9a){_0x341a9a=_0x341a9a||0x1f4;return function(_0x27b416){logger[_0x0888('0x29')](_0x27b416[_0x0888('0x2a')]);if(_0x27b416[_0x0888('0x2b')]){delete _0x27b416[_0x0888('0x2b')];}_0x54140e[_0x0888('0x1c')](_0x341a9a)[_0x0888('0x2c')](_0x27b416);};}exports[_0x0888('0x2d')]=function(_0x482e8d,_0x51d627){var _0x240bc9={},_0x51cc82={},_0x5b9526={'count':0x0,'rows':[]};var _0x19bc45=_[_0x0888('0x2e')](db[_0x0888('0x2f')][_0x0888('0x30')],function(_0x120cae){return{'name':_0x120cae['fieldName'],'type':_0x120cae[_0x0888('0x31')]['key']};});_0x51cc82[_0x0888('0x32')]=_['map'](_0x19bc45,'name');_0x51cc82[_0x0888('0x33')]=_[_0x0888('0x34')](_0x482e8d[_0x0888('0x33')]);_0x51cc82[_0x0888('0x35')]=_[_0x0888('0x36')](_0x51cc82[_0x0888('0x32')],_0x51cc82['query']);_0x240bc9[_0x0888('0x37')]=_['intersection'](_0x51cc82[_0x0888('0x32')],qs[_0x0888('0x38')](_0x482e8d[_0x0888('0x33')]['fields']));_0x240bc9[_0x0888('0x37')]=_0x240bc9[_0x0888('0x37')][_0x0888('0x39')]?_0x240bc9[_0x0888('0x37')]:_0x51cc82[_0x0888('0x32')];if(!_0x482e8d[_0x0888('0x33')]['hasOwnProperty']('nolimit')){_0x240bc9['limit']=qs[_0x0888('0x1f')](_0x482e8d['query'][_0x0888('0x1f')]);_0x240bc9[_0x0888('0x21')]=qs[_0x0888('0x21')](_0x482e8d['query'][_0x0888('0x21')]);}_0x240bc9[_0x0888('0x3a')]=qs['sort'](_0x482e8d[_0x0888('0x33')][_0x0888('0x3b')]);_0x240bc9[_0x0888('0x3c')]=qs[_0x0888('0x35')](_[_0x0888('0x3d')](_0x482e8d[_0x0888('0x33')],_0x51cc82[_0x0888('0x35')]),_0x19bc45);if(_0x482e8d['query'][_0x0888('0x3e')]){_0x240bc9[_0x0888('0x3c')]=_[_0x0888('0x3f')](_0x240bc9[_0x0888('0x3c')],{'$or':_[_0x0888('0x2e')](_0x19bc45,function(_0x276301){if(_0x276301[_0x0888('0x31')]!==_0x0888('0x40')){var _0x420bd6={};_0x420bd6[_0x276301[_0x0888('0x2b')]]={'$like':'%'+_0x482e8d['query'][_0x0888('0x3e')]+'%'};return _0x420bd6;}})});}_0x240bc9=_[_0x0888('0x3f')]({},_0x240bc9,_0x482e8d[_0x0888('0x41')]);var _0x39b6ea={'where':_0x240bc9[_0x0888('0x3c')]};return db[_0x0888('0x2f')][_0x0888('0x20')](_0x39b6ea)['then'](function(_0x1b112b){_0x5b9526[_0x0888('0x20')]=_0x1b112b;if(_0x482e8d[_0x0888('0x33')][_0x0888('0x42')]){_0x240bc9['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x0888('0x43')](_0x240bc9);})[_0x0888('0x28')](function(_0x5564a2){_0x5b9526[_0x0888('0x44')]=_0x5564a2;return _0x5b9526;})[_0x0888('0x28')](respondWithFilteredResult(_0x51d627,_0x240bc9))['catch'](handleError(_0x51d627,null));};exports['show']=function(_0x4e10d2,_0x501156){var _0x5defa4={'raw':!![],'where':{'id':_0x4e10d2[_0x0888('0x45')]['id']}},_0x540ef6={};_0x540ef6[_0x0888('0x32')]=_[_0x0888('0x34')](db[_0x0888('0x2f')][_0x0888('0x30')]);_0x540ef6[_0x0888('0x33')]=_[_0x0888('0x34')](_0x4e10d2[_0x0888('0x33')]);_0x540ef6[_0x0888('0x35')]=_[_0x0888('0x36')](_0x540ef6[_0x0888('0x32')],_0x540ef6[_0x0888('0x33')]);_0x5defa4[_0x0888('0x37')]=_[_0x0888('0x36')](_0x540ef6[_0x0888('0x32')],qs[_0x0888('0x38')](_0x4e10d2['query'][_0x0888('0x38')]));_0x5defa4[_0x0888('0x37')]=_0x5defa4['attributes']['length']?_0x5defa4[_0x0888('0x37')]:_0x540ef6[_0x0888('0x32')];if(_0x4e10d2[_0x0888('0x33')][_0x0888('0x42')]){_0x5defa4[_0x0888('0x46')]=[{'all':!![]}];}_0x5defa4=_[_0x0888('0x3f')]({},_0x5defa4,_0x4e10d2['options']);return db[_0x0888('0x2f')]['find'](_0x5defa4)[_0x0888('0x28')](handleEntityNotFound(_0x501156,null))[_0x0888('0x28')](respondWithResult(_0x501156,null))[_0x0888('0x47')](handleError(_0x501156,null));};exports['create']=function(_0x4fe278,_0x1f5096){return db[_0x0888('0x2f')][_0x0888('0x48')](_0x4fe278[_0x0888('0x49')],{})[_0x0888('0x28')](respondWithResult(_0x1f5096,0xc9))['catch'](handleError(_0x1f5096,null));};exports[_0x0888('0x27')]=function(_0x361ff8,_0x46dc09){if(_0x361ff8[_0x0888('0x49')]['id']){delete _0x361ff8[_0x0888('0x49')]['id'];}return db[_0x0888('0x2f')][_0x0888('0x4a')]({'where':{'id':_0x361ff8[_0x0888('0x45')]['id']}})[_0x0888('0x28')](handleEntityNotFound(_0x46dc09,null))[_0x0888('0x28')](saveUpdates(_0x361ff8[_0x0888('0x49')],null))[_0x0888('0x28')](respondWithResult(_0x46dc09,null))['catch'](handleError(_0x46dc09,null));};exports[_0x0888('0x4b')]=function(_0x506216,_0x2ace05){return db[_0x0888('0x2f')]['find']({'where':{'id':_0x506216['params']['id']}})[_0x0888('0x28')](handleEntityNotFound(_0x2ace05,null))['then'](removeEntity(_0x2ace05,null))[_0x0888('0x47')](handleError(_0x2ace05,null));};exports['describe']=function(_0x12626b,_0x193984){return db[_0x0888('0x2f')][_0x0888('0x4c')]()['then'](respondWithResult(_0x193984,null))[_0x0888('0x47')](handleError(_0x193984,null));}; \ No newline at end of file +var _0xdf7f=['moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','then','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x31aaa0,_0x1b3e80){var _0x23d27b=function(_0x24cf39){while(--_0x24cf39){_0x31aaa0['push'](_0x31aaa0['shift']());}};_0x23d27b(++_0x1b3e80);}(_0xdf7f,0x123));var _0xfdf7=function(_0x4a8e20,_0x4a1d74){_0x4a8e20=_0x4a8e20-0x0;var _0x11be0f=_0xdf7f[_0x4a8e20];return _0x11be0f;};'use strict';var emlformat=require(_0xfdf7('0x0'));var rimraf=require(_0xfdf7('0x1'));var zipdir=require(_0xfdf7('0x2'));var jsonpatch=require(_0xfdf7('0x3'));var rp=require(_0xfdf7('0x4'));var moment=require(_0xfdf7('0x5'));var BPromise=require(_0xfdf7('0x6'));var Mustache=require('mustache');var util=require(_0xfdf7('0x7'));var path=require('path');var sox=require(_0xfdf7('0x8'));var csv=require(_0xfdf7('0x9'));var ejs=require(_0xfdf7('0xa'));var fs=require('fs');var fs_extra=require(_0xfdf7('0xb'));var _=require(_0xfdf7('0xc'));var squel=require('squel');var crypto=require(_0xfdf7('0xd'));var jsforce=require(_0xfdf7('0xe'));var deskjs=require(_0xfdf7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfdf7('0x10'));var Redis=require('ioredis');var authService=require(_0xfdf7('0x11'));var qs=require(_0xfdf7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfdf7('0x13'))(_0xfdf7('0x14'));var utils=require(_0xfdf7('0x15'));var config=require(_0xfdf7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfdf7('0x17'))['db'];function respondWithStatusCode(_0x2628a9,_0x2844e2){_0x2844e2=_0x2844e2||0xcc;return function(_0x5b6bc3){if(_0x5b6bc3){return _0x2628a9[_0xfdf7('0x18')](_0x2844e2);}return _0x2628a9[_0xfdf7('0x19')](_0x2844e2)[_0xfdf7('0x1a')]();};}function respondWithResult(_0x24bd1a,_0x10a0cc){_0x10a0cc=_0x10a0cc||0xc8;return function(_0x273857){if(_0x273857){return _0x24bd1a['status'](_0x10a0cc)[_0xfdf7('0x1b')](_0x273857);}};}function respondWithFilteredResult(_0x49acc5,_0x248469){return function(_0x13a23b){if(_0x13a23b){var _0x482638=typeof _0x248469[_0xfdf7('0x1c')]===_0xfdf7('0x1d')&&typeof _0x248469[_0xfdf7('0x1e')]===_0xfdf7('0x1d');var _0x8db126=_0x13a23b[_0xfdf7('0x1f')];var _0x42b374=_0x482638?0x0:_0x248469[_0xfdf7('0x1c')];var _0x43e200=_0x482638?_0x13a23b['count']:_0x248469[_0xfdf7('0x1c')]+_0x248469[_0xfdf7('0x1e')];var _0x2746d2;if(_0x43e200>=_0x8db126){_0x43e200=_0x8db126;_0x2746d2=0xc8;}else{_0x2746d2=0xce;}_0x49acc5['status'](_0x2746d2);return _0x49acc5[_0xfdf7('0x20')](_0xfdf7('0x21'),_0x42b374+'-'+_0x43e200+'/'+_0x8db126)[_0xfdf7('0x1b')](_0x13a23b);}return null;};}function patchUpdates(_0x1ea708){return function(_0x4bdc3d){try{jsonpatch[_0xfdf7('0x22')](_0x4bdc3d,_0x1ea708,!![]);}catch(_0x3d0d75){return BPromise[_0xfdf7('0x23')](_0x3d0d75);}return _0x4bdc3d['save']();};}function saveUpdates(_0x1e6e01,_0x544a95){return function(_0x1996e1){if(_0x1996e1){return _0x1996e1[_0xfdf7('0x24')](_0x1e6e01)['then'](function(_0x40f1f8){return _0x40f1f8;});}return null;};}function removeEntity(_0x3a32b0,_0x306167){return function(_0x2e8116){if(_0x2e8116){return _0x2e8116[_0xfdf7('0x25')]()['then'](function(){_0x3a32b0[_0xfdf7('0x19')](0xcc)[_0xfdf7('0x1a')]();});}};}function handleEntityNotFound(_0xc9f94e,_0x2e4ae0){return function(_0xe05ad6){if(!_0xe05ad6){_0xc9f94e[_0xfdf7('0x18')](0x194);}return _0xe05ad6;};}function handleError(_0x4227c6,_0x4e2c78){_0x4e2c78=_0x4e2c78||0x1f4;return function(_0x46e3ab){logger[_0xfdf7('0x26')](_0x46e3ab['stack']);if(_0x46e3ab[_0xfdf7('0x27')]){delete _0x46e3ab[_0xfdf7('0x27')];}_0x4227c6[_0xfdf7('0x19')](_0x4e2c78)[_0xfdf7('0x28')](_0x46e3ab);};}exports['index']=function(_0x32b3c6,_0x3d4fe3){var _0x1cdd9b={},_0x3230c={},_0x2296ae={'count':0x0,'rows':[]};var _0x165db0=_[_0xfdf7('0x29')](db['MailSubstatus'][_0xfdf7('0x2a')],function(_0x3bf03c){return{'name':_0x3bf03c['fieldName'],'type':_0x3bf03c[_0xfdf7('0x2b')][_0xfdf7('0x2c')]};});_0x3230c[_0xfdf7('0x2d')]=_[_0xfdf7('0x29')](_0x165db0,'name');_0x3230c[_0xfdf7('0x2e')]=_[_0xfdf7('0x2f')](_0x32b3c6['query']);_0x3230c[_0xfdf7('0x30')]=_[_0xfdf7('0x31')](_0x3230c['model'],_0x3230c[_0xfdf7('0x2e')]);_0x1cdd9b[_0xfdf7('0x32')]=_[_0xfdf7('0x31')](_0x3230c[_0xfdf7('0x2d')],qs[_0xfdf7('0x33')](_0x32b3c6[_0xfdf7('0x2e')][_0xfdf7('0x33')]));_0x1cdd9b['attributes']=_0x1cdd9b[_0xfdf7('0x32')][_0xfdf7('0x34')]?_0x1cdd9b[_0xfdf7('0x32')]:_0x3230c['model'];if(!_0x32b3c6[_0xfdf7('0x2e')]['hasOwnProperty'](_0xfdf7('0x35'))){_0x1cdd9b[_0xfdf7('0x1e')]=qs[_0xfdf7('0x1e')](_0x32b3c6[_0xfdf7('0x2e')][_0xfdf7('0x1e')]);_0x1cdd9b[_0xfdf7('0x1c')]=qs[_0xfdf7('0x1c')](_0x32b3c6[_0xfdf7('0x2e')][_0xfdf7('0x1c')]);}_0x1cdd9b[_0xfdf7('0x36')]=qs[_0xfdf7('0x37')](_0x32b3c6[_0xfdf7('0x2e')]['sort']);_0x1cdd9b[_0xfdf7('0x38')]=qs[_0xfdf7('0x30')](_[_0xfdf7('0x39')](_0x32b3c6[_0xfdf7('0x2e')],_0x3230c[_0xfdf7('0x30')]),_0x165db0);if(_0x32b3c6[_0xfdf7('0x2e')][_0xfdf7('0x3a')]){_0x1cdd9b[_0xfdf7('0x38')]=_[_0xfdf7('0x3b')](_0x1cdd9b[_0xfdf7('0x38')],{'$or':_[_0xfdf7('0x29')](_0x165db0,function(_0x3b5785){if(_0x3b5785[_0xfdf7('0x2b')]!==_0xfdf7('0x3c')){var _0x1f7f1f={};_0x1f7f1f[_0x3b5785[_0xfdf7('0x27')]]={'$like':'%'+_0x32b3c6['query']['filter']+'%'};return _0x1f7f1f;}})});}_0x1cdd9b=_['merge']({},_0x1cdd9b,_0x32b3c6[_0xfdf7('0x3d')]);var _0x35849d={'where':_0x1cdd9b[_0xfdf7('0x38')]};return db[_0xfdf7('0x3e')][_0xfdf7('0x1f')](_0x35849d)[_0xfdf7('0x3f')](function(_0x163885){_0x2296ae[_0xfdf7('0x1f')]=_0x163885;if(_0x32b3c6[_0xfdf7('0x2e')]['includeAll']){_0x1cdd9b[_0xfdf7('0x40')]=[{'all':!![]}];}return db[_0xfdf7('0x3e')]['findAll'](_0x1cdd9b);})[_0xfdf7('0x3f')](function(_0x1e748f){_0x2296ae[_0xfdf7('0x41')]=_0x1e748f;return _0x2296ae;})[_0xfdf7('0x3f')](respondWithFilteredResult(_0x3d4fe3,_0x1cdd9b))[_0xfdf7('0x42')](handleError(_0x3d4fe3,null));};exports[_0xfdf7('0x43')]=function(_0x3e2f87,_0x32b640){var _0x1a4101={'raw':!![],'where':{'id':_0x3e2f87[_0xfdf7('0x44')]['id']}},_0x2f434={};_0x2f434[_0xfdf7('0x2d')]=_[_0xfdf7('0x2f')](db['MailSubstatus'][_0xfdf7('0x2a')]);_0x2f434[_0xfdf7('0x2e')]=_[_0xfdf7('0x2f')](_0x3e2f87[_0xfdf7('0x2e')]);_0x2f434[_0xfdf7('0x30')]=_[_0xfdf7('0x31')](_0x2f434[_0xfdf7('0x2d')],_0x2f434['query']);_0x1a4101['attributes']=_[_0xfdf7('0x31')](_0x2f434['model'],qs['fields'](_0x3e2f87[_0xfdf7('0x2e')][_0xfdf7('0x33')]));_0x1a4101[_0xfdf7('0x32')]=_0x1a4101[_0xfdf7('0x32')]['length']?_0x1a4101[_0xfdf7('0x32')]:_0x2f434[_0xfdf7('0x2d')];if(_0x3e2f87[_0xfdf7('0x2e')][_0xfdf7('0x45')]){_0x1a4101[_0xfdf7('0x40')]=[{'all':!![]}];}_0x1a4101=_[_0xfdf7('0x3b')]({},_0x1a4101,_0x3e2f87[_0xfdf7('0x3d')]);return db[_0xfdf7('0x3e')][_0xfdf7('0x46')](_0x1a4101)['then'](handleEntityNotFound(_0x32b640,null))['then'](respondWithResult(_0x32b640,null))['catch'](handleError(_0x32b640,null));};exports[_0xfdf7('0x47')]=function(_0x52ab89,_0x14041b){return db[_0xfdf7('0x3e')]['create'](_0x52ab89[_0xfdf7('0x48')],{})[_0xfdf7('0x3f')](respondWithResult(_0x14041b,0xc9))[_0xfdf7('0x42')](handleError(_0x14041b,null));};exports[_0xfdf7('0x24')]=function(_0x2367f1,_0x150388){if(_0x2367f1[_0xfdf7('0x48')]['id']){delete _0x2367f1[_0xfdf7('0x48')]['id'];}return db[_0xfdf7('0x3e')][_0xfdf7('0x46')]({'where':{'id':_0x2367f1['params']['id']}})[_0xfdf7('0x3f')](handleEntityNotFound(_0x150388,null))[_0xfdf7('0x3f')](saveUpdates(_0x2367f1['body'],null))[_0xfdf7('0x3f')](respondWithResult(_0x150388,null))[_0xfdf7('0x42')](handleError(_0x150388,null));};exports[_0xfdf7('0x25')]=function(_0x4b6659,_0x2d5ff1){return db[_0xfdf7('0x3e')]['find']({'where':{'id':_0x4b6659[_0xfdf7('0x44')]['id']}})[_0xfdf7('0x3f')](handleEntityNotFound(_0x2d5ff1,null))[_0xfdf7('0x3f')](removeEntity(_0x2d5ff1,null))[_0xfdf7('0x42')](handleError(_0x2d5ff1,null));};exports[_0xfdf7('0x49')]=function(_0x5d9c8d,_0x44c94c){return db['MailSubstatus']['describe']()[_0xfdf7('0x3f')](respondWithResult(_0x44c94c,null))[_0xfdf7('0x42')](handleError(_0x44c94c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 4e76d8c..a5eb537 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 _0x02e6=['hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02e6,0xfb));var _0x602e=function(_0x381539,_0x1ca517){_0x381539=_0x381539-0x0;var _0x25caea=_0x02e6[_0x381539];return _0x25caea;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x602e('0x0'))['db'][_0x602e('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x602e('0x2')](0x0);var events={'afterUpdate':_0x602e('0x3')};function emitEvent(_0xf853b6){return function(_0x6c419b,_0x14f389,_0x2ebd8f){MailSubstatusEvents[_0x602e('0x4')](_0xf853b6+':'+_0x6c419b['id'],_0x6c419b);MailSubstatusEvents[_0x602e('0x4')](_0xf853b6,_0x6c419b);_0x2ebd8f(null);};}for(var e in events){if(events[_0x602e('0x5')](e)){var event=events[e];MailSubstatus[_0x602e('0x6')](e,emitEvent(event));}}module[_0x602e('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x4463=['MailSubstatus','update','emit','hasOwnProperty','hook','events'];(function(_0x2958f8,_0x1b8fda){var _0x1a02c0=function(_0x47642c){while(--_0x47642c){_0x2958f8['push'](_0x2958f8['shift']());}};_0x1a02c0(++_0x1b8fda);}(_0x4463,0x1bb));var _0x3446=function(_0x3f2031,_0x2dbd6f){_0x3f2031=_0x3f2031-0x0;var _0x37eaf4=_0x4463[_0x3f2031];return _0x37eaf4;};'use strict';var EventEmitter=require(_0x3446('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x3446('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x3446('0x2')};function emitEvent(_0x229dea){return function(_0x5824ad,_0x152f9e,_0x2a24a8){MailSubstatusEvents[_0x3446('0x3')](_0x229dea+':'+_0x5824ad['id'],_0x5824ad);MailSubstatusEvents[_0x3446('0x3')](_0x229dea,_0x5824ad);_0x2a24a8(null);};}for(var e in events){if(events[_0x3446('0x4')](e)){var event=events[e];MailSubstatus[_0x3446('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c6e83fe..747a20a 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 _0x53ba=['Condition','update','mailSubstatus','_previousDataValues','name','catch','./mailSubstatus.attributes','exports','models','MailSubstatus'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x53ba,0x1be));var _0xa53b=function(_0x4ab973,_0x55141c){_0x4ab973=_0x4ab973-0x0;var _0x514b9f=_0x53ba[_0x4ab973];return _0x514b9f;};'use strict';var attributes=require(_0xa53b('0x0'));module[_0xa53b('0x1')]=function(_0x1455a4){var _0xe091f7=_0x1455a4[_0xa53b('0x2')];return _0x1455a4['define'](_0xa53b('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x35c1c3,_0x1a2650,_0x434f38){return _0xe091f7[_0xa53b('0x4')][_0xa53b('0x5')]({'value':_0x35c1c3['name']},{'where':{'field':_0xa53b('0x6'),'value':_0x35c1c3[_0xa53b('0x7')][_0xa53b('0x8')]}})['then'](function(){_0x434f38();})[_0xa53b('0x9')](function(_0x5abc35){_0x434f38(_0x5abc35);});}}});}; \ No newline at end of file +var _0x2807=['./mailSubstatus.attributes','exports','models','define','MailSubstatus','update','name','mailSubstatus','_previousDataValues','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2807,0x154));var _0x7280=function(_0x2263cc,_0x2e1dc9){_0x2263cc=_0x2263cc-0x0;var _0x1ba214=_0x2807[_0x2263cc];return _0x1ba214;};'use strict';var attributes=require(_0x7280('0x0'));module[_0x7280('0x1')]=function(_0x243876){var _0x1b6c57=_0x243876[_0x7280('0x2')];return _0x243876[_0x7280('0x3')](_0x7280('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1deba4,_0x2d0150,_0xf9f011){return _0x1b6c57['Condition'][_0x7280('0x5')]({'value':_0x1deba4[_0x7280('0x6')]},{'where':{'field':_0x7280('0x7'),'value':_0x1deba4[_0x7280('0x8')][_0x7280('0x6')]}})['then'](function(){_0xf9f011();})[_0x7280('0x9')](function(_0x53145f){_0xf9f011(_0x53145f);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index e3a3390..8cb273e 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 _0xffaa=['randomstring','ioredis','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','util','moment','bluebird'];(function(_0x4550d8,_0x2fe772){var _0x7ef01f=function(_0x5c7c9e){while(--_0x5c7c9e){_0x4550d8['push'](_0x4550d8['shift']());}};_0x7ef01f(++_0x2fe772);}(_0xffaa,0xe1));var _0xaffa=function(_0x53bc2b,_0x151a50){_0x53bc2b=_0x53bc2b-0x0;var _0xe39936=_0xffaa[_0x53bc2b];return _0xe39936;};'use strict';var _=require('lodash');var util=require(_0xaffa('0x0'));var moment=require(_0xaffa('0x1'));var BPromise=require(_0xaffa('0x2'));var rs=require(_0xaffa('0x3'));var fs=require('fs');var Redis=require(_0xaffa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaffa('0x5'));var config=require('../../config/environment');var jayson=require(_0xaffa('0x6'));var client=jayson[_0xaffa('0x7')][_0xaffa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54b368,_0x3c100c,_0x5c0850){return new BPromise(function(_0x1f0c7f,_0x36ac74){return client[_0xaffa('0x9')](_0x54b368,_0x5c0850)[_0xaffa('0xa')](function(_0x1a346e){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x3c100c,_0xaffa('0xb'));logger[_0xaffa('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x3c100c,_0xaffa('0xb'),JSON[_0xaffa('0xd')](_0x1a346e));if(_0x1a346e[_0xaffa('0xe')]){if(_0x1a346e['error'][_0xaffa('0xf')]===0x1f4){logger[_0xaffa('0xe')](_0xaffa('0x10'),_0x3c100c,_0x1a346e['error'][_0xaffa('0x11')]);return _0x36ac74(_0x1a346e['error'][_0xaffa('0x11')]);}logger[_0xaffa('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x3c100c,_0x1a346e[_0xaffa('0xe')][_0xaffa('0x11')]);return _0x1f0c7f(_0x1a346e['error'][_0xaffa('0x11')]);}else{logger[_0xaffa('0x12')](_0xaffa('0x10'),_0x3c100c,'request\x20sent');_0x1f0c7f(_0x1a346e['result'][_0xaffa('0x11')]);}})['catch'](function(_0x34bc08){logger[_0xaffa('0xe')](_0xaffa('0x10'),_0x3c100c,_0x34bc08);_0x36ac74(_0x34bc08);});});} \ No newline at end of file +var _0x7523=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4dc4a8,_0x4b99a6){var _0x3cab18=function(_0x5ee5a8){while(--_0x5ee5a8){_0x4dc4a8['push'](_0x4dc4a8['shift']());}};_0x3cab18(++_0x4b99a6);}(_0x7523,0x189));var _0x3752=function(_0x19f2a9,_0x5ccbc4){_0x19f2a9=_0x19f2a9-0x0;var _0xb1bb3f=_0x7523[_0x19f2a9];return _0xb1bb3f;};'use strict';var _=require(_0x3752('0x0'));var util=require(_0x3752('0x1'));var moment=require(_0x3752('0x2'));var BPromise=require('bluebird');var rs=require(_0x3752('0x3'));var fs=require('fs');var Redis=require(_0x3752('0x4'));var db=require(_0x3752('0x5'))['db'];var utils=require(_0x3752('0x6'));var logger=require(_0x3752('0x7'))(_0x3752('0x8'));var config=require(_0x3752('0x9'));var jayson=require(_0x3752('0xa'));var client=jayson[_0x3752('0xb')][_0x3752('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21a91e,_0x5b5865,_0x3fc628){return new BPromise(function(_0x224262,_0x385f7e){return client['request'](_0x21a91e,_0x3fc628)['then'](function(_0xda3d47){logger['info'](_0x3752('0xd'),_0x5b5865,_0x3752('0xe'));logger['debug'](_0x3752('0xf'),_0x5b5865,_0x3752('0xe'),JSON['stringify'](_0xda3d47));if(_0xda3d47[_0x3752('0x10')]){if(_0xda3d47['error'][_0x3752('0x11')]===0x1f4){logger[_0x3752('0x10')](_0x3752('0xd'),_0x5b5865,_0xda3d47['error']['message']);return _0x385f7e(_0xda3d47[_0x3752('0x10')][_0x3752('0x12')]);}logger['error'](_0x3752('0xd'),_0x5b5865,_0xda3d47[_0x3752('0x10')][_0x3752('0x12')]);return _0x224262(_0xda3d47[_0x3752('0x10')][_0x3752('0x12')]);}else{logger[_0x3752('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x5b5865,_0x3752('0xe'));_0x224262(_0xda3d47[_0x3752('0x14')][_0x3752('0x12')]);}})['catch'](function(_0x4f6cd8){logger[_0x3752('0x10')](_0x3752('0xd'),_0x5b5865,_0x4f6cd8);_0x385f7e(_0x4f6cd8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 9d59658..0d76fce 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 _0xdf17=['/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','index'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xdf17,0x1c2));var _0x7df1=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xdf17[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x7df1('0x0'));var util=require(_0x7df1('0x1'));var path=require(_0x7df1('0x2'));var timeout=require(_0x7df1('0x3'));var express=require(_0x7df1('0x4'));var router=express[_0x7df1('0x5')]();var fs_extra=require(_0x7df1('0x6'));var auth=require(_0x7df1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7df1('0x8'));var controller=require(_0x7df1('0x9'));router[_0x7df1('0xa')]('/',auth['isAuthenticated'](),controller[_0x7df1('0xb')]);router[_0x7df1('0xa')](_0x7df1('0xc'),auth[_0x7df1('0xd')](),controller[_0x7df1('0xe')]);router[_0x7df1('0xa')](_0x7df1('0xf'),auth[_0x7df1('0xd')](),controller[_0x7df1('0x10')]);router['post']('/',auth[_0x7df1('0xd')](),controller[_0x7df1('0x11')]);router[_0x7df1('0x12')](_0x7df1('0xf'),auth[_0x7df1('0xd')](),controller[_0x7df1('0x13')]);router[_0x7df1('0x14')]('/:id',auth[_0x7df1('0xd')](),controller['destroy']);module[_0x7df1('0x15')]=router; \ No newline at end of file +var _0xc4ec=['index','/describe','describe','show','create','put','/:id','update','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x5e0bde,_0x4b112b){var _0x5b95ff=function(_0x4c519e){while(--_0x4c519e){_0x5e0bde['push'](_0x5e0bde['shift']());}};_0x5b95ff(++_0x4b112b);}(_0xc4ec,0x1a0));var _0xcc4e=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0xc4ec[_0x4de1b1];return _0x639f27;};'use strict';var multer=require(_0xcc4e('0x0'));var util=require(_0xcc4e('0x1'));var path=require('path');var timeout=require(_0xcc4e('0x2'));var express=require(_0xcc4e('0x3'));var router=express['Router']();var fs_extra=require(_0xcc4e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcc4e('0x5'));var config=require('../../config/environment');var controller=require(_0xcc4e('0x6'));router[_0xcc4e('0x7')]('/',auth[_0xcc4e('0x8')](),controller[_0xcc4e('0x9')]);router[_0xcc4e('0x7')](_0xcc4e('0xa'),auth[_0xcc4e('0x8')](),controller[_0xcc4e('0xb')]);router['get']('/:id',auth[_0xcc4e('0x8')](),controller[_0xcc4e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcc4e('0xd')]);router[_0xcc4e('0xe')](_0xcc4e('0xf'),auth[_0xcc4e('0x8')](),controller[_0xcc4e('0x10')]);router['delete'](_0xcc4e('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 7109460..804da6d 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2f167e,_0x38473d){var _0x30ba5f=function(_0x348744){while(--_0x348744){_0x2f167e['push'](_0x2f167e['shift']());}};_0x30ba5f(++_0x38473d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 708259a..b258f31 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 _0xb76d=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','MailTransferReport','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb76d,0x167));var _0xdb76=function(_0x38d64a,_0x42a6e1){_0x38d64a=_0x38d64a-0x0;var _0x32194f=_0xb76d[_0x38d64a];return _0x32194f;};'use strict';var emlformat=require(_0xdb76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb76('0x1'));var jsonpatch=require(_0xdb76('0x2'));var rp=require(_0xdb76('0x3'));var moment=require(_0xdb76('0x4'));var BPromise=require(_0xdb76('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdb76('0x6'));var csv=require(_0xdb76('0x7'));var ejs=require(_0xdb76('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb76('0x9'));var squel=require(_0xdb76('0xa'));var crypto=require(_0xdb76('0xb'));var jsforce=require(_0xdb76('0xc'));var deskjs=require(_0xdb76('0xd'));var toCsv=require(_0xdb76('0x7'));var querystring=require(_0xdb76('0xe'));var Papa=require(_0xdb76('0xf'));var Redis=require('ioredis');var authService=require(_0xdb76('0x10'));var qs=require(_0xdb76('0x11'));var as=require(_0xdb76('0x12'));var hardwareService=require(_0xdb76('0x13'));var logger=require(_0xdb76('0x14'))('api');var utils=require(_0xdb76('0x15'));var config=require(_0xdb76('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb76('0x17'))['db'];function respondWithStatusCode(_0x253efd,_0x848878){_0x848878=_0x848878||0xcc;return function(_0xf925a){if(_0xf925a){return _0x253efd[_0xdb76('0x18')](_0x848878);}return _0x253efd[_0xdb76('0x19')](_0x848878)['end']();};}function respondWithResult(_0x53cc4c,_0xdfda77){_0xdfda77=_0xdfda77||0xc8;return function(_0x3abdfb){if(_0x3abdfb){return _0x53cc4c['status'](_0xdfda77)[_0xdb76('0x1a')](_0x3abdfb);}};}function respondWithFilteredResult(_0x401b6e,_0x3d8ac6){return function(_0x3dfd5d){if(_0x3dfd5d){var _0x10abb0=typeof _0x3d8ac6[_0xdb76('0x1b')]==='undefined'&&typeof _0x3d8ac6[_0xdb76('0x1c')]==='undefined';var _0x225837=_0x3dfd5d[_0xdb76('0x1d')];var _0x3527a7=_0x10abb0?0x0:_0x3d8ac6[_0xdb76('0x1b')];var _0x172f3a=_0x10abb0?_0x3dfd5d[_0xdb76('0x1d')]:_0x3d8ac6[_0xdb76('0x1b')]+_0x3d8ac6[_0xdb76('0x1c')];var _0x5b9343;if(_0x172f3a>=_0x225837){_0x172f3a=_0x225837;_0x5b9343=0xc8;}else{_0x5b9343=0xce;}_0x401b6e[_0xdb76('0x19')](_0x5b9343);return _0x401b6e['set'](_0xdb76('0x1e'),_0x3527a7+'-'+_0x172f3a+'/'+_0x225837)[_0xdb76('0x1a')](_0x3dfd5d);}return null;};}function patchUpdates(_0x330ceb){return function(_0x522e1d){try{jsonpatch[_0xdb76('0x1f')](_0x522e1d,_0x330ceb,!![]);}catch(_0x3840b9){return BPromise[_0xdb76('0x20')](_0x3840b9);}return _0x522e1d[_0xdb76('0x21')]();};}function saveUpdates(_0x368c9e,_0x1d0c49){return function(_0x36e85e){if(_0x36e85e){return _0x36e85e[_0xdb76('0x22')](_0x368c9e)[_0xdb76('0x23')](function(_0x50fe9d){return _0x50fe9d;});}return null;};}function removeEntity(_0x545393,_0x40b676){return function(_0x330d81){if(_0x330d81){return _0x330d81[_0xdb76('0x24')]()[_0xdb76('0x23')](function(){_0x545393[_0xdb76('0x19')](0xcc)[_0xdb76('0x25')]();});}};}function handleEntityNotFound(_0x2f3c4a,_0x28d323){return function(_0x2f3f7c){if(!_0x2f3f7c){_0x2f3c4a['sendStatus'](0x194);}return _0x2f3f7c;};}function handleError(_0x5ca5f8,_0x516544){_0x516544=_0x516544||0x1f4;return function(_0x1412bc){logger['error'](_0x1412bc[_0xdb76('0x26')]);if(_0x1412bc[_0xdb76('0x27')]){delete _0x1412bc[_0xdb76('0x27')];}_0x5ca5f8['status'](_0x516544)[_0xdb76('0x28')](_0x1412bc);};}exports[_0xdb76('0x29')]=function(_0x4733a9,_0x22a639){var _0x2776cd={},_0x208044={},_0x45467f={'count':0x0,'rows':[]};var _0x1827b3=_[_0xdb76('0x2a')](db['MailTransferReport'][_0xdb76('0x2b')],function(_0x249e53){return{'name':_0x249e53[_0xdb76('0x2c')],'type':_0x249e53[_0xdb76('0x2d')][_0xdb76('0x2e')]};});_0x208044[_0xdb76('0x2f')]=_[_0xdb76('0x2a')](_0x1827b3,_0xdb76('0x27'));_0x208044[_0xdb76('0x30')]=_[_0xdb76('0x31')](_0x4733a9[_0xdb76('0x30')]);_0x208044[_0xdb76('0x32')]=_[_0xdb76('0x33')](_0x208044[_0xdb76('0x2f')],_0x208044[_0xdb76('0x30')]);_0x2776cd[_0xdb76('0x34')]=_[_0xdb76('0x33')](_0x208044[_0xdb76('0x2f')],qs[_0xdb76('0x35')](_0x4733a9[_0xdb76('0x30')][_0xdb76('0x35')]));_0x2776cd['attributes']=_0x2776cd['attributes'][_0xdb76('0x36')]?_0x2776cd[_0xdb76('0x34')]:_0x208044[_0xdb76('0x2f')];if(!_0x4733a9['query'][_0xdb76('0x37')]('nolimit')){_0x2776cd['limit']=qs['limit'](_0x4733a9[_0xdb76('0x30')]['limit']);_0x2776cd[_0xdb76('0x1b')]=qs[_0xdb76('0x1b')](_0x4733a9[_0xdb76('0x30')][_0xdb76('0x1b')]);}_0x2776cd[_0xdb76('0x38')]=qs[_0xdb76('0x39')](_0x4733a9[_0xdb76('0x30')][_0xdb76('0x39')]);_0x2776cd[_0xdb76('0x3a')]=qs[_0xdb76('0x32')](_[_0xdb76('0x3b')](_0x4733a9[_0xdb76('0x30')],_0x208044['filters']),_0x1827b3);if(_0x4733a9[_0xdb76('0x30')][_0xdb76('0x3c')]){_0x2776cd['where']=_[_0xdb76('0x3d')](_0x2776cd['where'],{'$or':_['map'](_0x1827b3,function(_0x245701){if(_0x245701[_0xdb76('0x2d')]!=='VIRTUAL'){var _0x515a60={};_0x515a60[_0x245701['name']]={'$like':'%'+_0x4733a9[_0xdb76('0x30')][_0xdb76('0x3c')]+'%'};return _0x515a60;}})});}_0x2776cd=_['merge']({},_0x2776cd,_0x4733a9['options']);var _0x535562={'where':_0x2776cd[_0xdb76('0x3a')]};return db[_0xdb76('0x3e')][_0xdb76('0x1d')](_0x535562)['then'](function(_0x272b0c){_0x45467f[_0xdb76('0x1d')]=_0x272b0c;if(_0x4733a9[_0xdb76('0x30')][_0xdb76('0x3f')]){_0x2776cd[_0xdb76('0x40')]=[{'all':!![]}];}return db['MailTransferReport'][_0xdb76('0x41')](_0x2776cd);})[_0xdb76('0x23')](function(_0x233fc1){_0x45467f['rows']=_0x233fc1;return _0x45467f;})['then'](respondWithFilteredResult(_0x22a639,_0x2776cd))[_0xdb76('0x42')](handleError(_0x22a639,null));};exports[_0xdb76('0x43')]=function(_0x5c8fda,_0x1becb5){var _0x3f1390={'raw':!![],'where':{'id':_0x5c8fda[_0xdb76('0x44')]['id']}},_0x1ebc5f={};_0x1ebc5f[_0xdb76('0x2f')]=_['keys'](db['MailTransferReport'][_0xdb76('0x2b')]);_0x1ebc5f[_0xdb76('0x30')]=_[_0xdb76('0x31')](_0x5c8fda[_0xdb76('0x30')]);_0x1ebc5f[_0xdb76('0x32')]=_[_0xdb76('0x33')](_0x1ebc5f[_0xdb76('0x2f')],_0x1ebc5f['query']);_0x3f1390[_0xdb76('0x34')]=_['intersection'](_0x1ebc5f[_0xdb76('0x2f')],qs[_0xdb76('0x35')](_0x5c8fda[_0xdb76('0x30')][_0xdb76('0x35')]));_0x3f1390[_0xdb76('0x34')]=_0x3f1390['attributes'][_0xdb76('0x36')]?_0x3f1390[_0xdb76('0x34')]:_0x1ebc5f[_0xdb76('0x2f')];if(_0x5c8fda[_0xdb76('0x30')][_0xdb76('0x3f')]){_0x3f1390[_0xdb76('0x40')]=[{'all':!![]}];}_0x3f1390=_[_0xdb76('0x3d')]({},_0x3f1390,_0x5c8fda[_0xdb76('0x45')]);return db[_0xdb76('0x3e')]['find'](_0x3f1390)[_0xdb76('0x23')](handleEntityNotFound(_0x1becb5,null))[_0xdb76('0x23')](respondWithResult(_0x1becb5,null))[_0xdb76('0x42')](handleError(_0x1becb5,null));};exports[_0xdb76('0x46')]=function(_0x1293c6,_0x5ce67c){return db[_0xdb76('0x3e')][_0xdb76('0x46')](_0x1293c6[_0xdb76('0x47')],{})[_0xdb76('0x23')](respondWithResult(_0x5ce67c,0xc9))[_0xdb76('0x42')](handleError(_0x5ce67c,null));};exports[_0xdb76('0x22')]=function(_0x421e91,_0x1032d3){if(_0x421e91['body']['id']){delete _0x421e91[_0xdb76('0x47')]['id'];}return db[_0xdb76('0x3e')][_0xdb76('0x48')]({'where':{'id':_0x421e91[_0xdb76('0x44')]['id']}})[_0xdb76('0x23')](handleEntityNotFound(_0x1032d3,null))[_0xdb76('0x23')](saveUpdates(_0x421e91[_0xdb76('0x47')],null))['then'](respondWithResult(_0x1032d3,null))['catch'](handleError(_0x1032d3,null));};exports['destroy']=function(_0x9d6443,_0x145774){return db['MailTransferReport'][_0xdb76('0x48')]({'where':{'id':_0x9d6443[_0xdb76('0x44')]['id']}})[_0xdb76('0x23')](handleEntityNotFound(_0x145774,null))[_0xdb76('0x23')](removeEntity(_0x145774,null))[_0xdb76('0x42')](handleError(_0x145774,null));};exports[_0xdb76('0x49')]=function(_0x17e50f,_0x4e911b){return db[_0xdb76('0x3e')][_0xdb76('0x49')]()[_0xdb76('0x23')](respondWithResult(_0x4e911b,null))['catch'](handleError(_0x4e911b,null));}; \ No newline at end of file +var _0xd8ec=['fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','then','error','name','index','map','MailTransferReport','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','update','describe','rimraf','zip-dir'];(function(_0x13d58b,_0x4ed10e){var _0x40eca1=function(_0x19b101){while(--_0x19b101){_0x13d58b['push'](_0x13d58b['shift']());}};_0x40eca1(++_0x4ed10e);}(_0xd8ec,0x116));var _0xcd8e=function(_0x36f99f,_0x10dfa2){_0x36f99f=_0x36f99f-0x0;var _0x85cb3b=_0xd8ec[_0x36f99f];return _0x85cb3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd8e('0x0'));var zipdir=require(_0xcd8e('0x1'));var jsonpatch=require(_0xcd8e('0x2'));var rp=require(_0xcd8e('0x3'));var moment=require(_0xcd8e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcd8e('0x5'));var path=require(_0xcd8e('0x6'));var sox=require(_0xcd8e('0x7'));var csv=require(_0xcd8e('0x8'));var ejs=require(_0xcd8e('0x9'));var fs=require('fs');var fs_extra=require(_0xcd8e('0xa'));var _=require(_0xcd8e('0xb'));var squel=require(_0xcd8e('0xc'));var crypto=require(_0xcd8e('0xd'));var jsforce=require(_0xcd8e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcd8e('0xf'));var Redis=require(_0xcd8e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd8e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd8e('0x12'))(_0xcd8e('0x13'));var utils=require(_0xcd8e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd8e('0x15'))['db'];function respondWithStatusCode(_0x39e800,_0xb7dfe4){_0xb7dfe4=_0xb7dfe4||0xcc;return function(_0x54ce15){if(_0x54ce15){return _0x39e800[_0xcd8e('0x16')](_0xb7dfe4);}return _0x39e800[_0xcd8e('0x17')](_0xb7dfe4)[_0xcd8e('0x18')]();};}function respondWithResult(_0x10ee67,_0x38625a){_0x38625a=_0x38625a||0xc8;return function(_0x2ec172){if(_0x2ec172){return _0x10ee67['status'](_0x38625a)[_0xcd8e('0x19')](_0x2ec172);}};}function respondWithFilteredResult(_0x570a9d,_0x4ba3ef){return function(_0x588c74){if(_0x588c74){var _0x4f2047=typeof _0x4ba3ef[_0xcd8e('0x1a')]===_0xcd8e('0x1b')&&typeof _0x4ba3ef[_0xcd8e('0x1c')]==='undefined';var _0x458df2=_0x588c74[_0xcd8e('0x1d')];var _0x77936f=_0x4f2047?0x0:_0x4ba3ef[_0xcd8e('0x1a')];var _0x3b1fdd=_0x4f2047?_0x588c74[_0xcd8e('0x1d')]:_0x4ba3ef[_0xcd8e('0x1a')]+_0x4ba3ef['limit'];var _0x44e015;if(_0x3b1fdd>=_0x458df2){_0x3b1fdd=_0x458df2;_0x44e015=0xc8;}else{_0x44e015=0xce;}_0x570a9d['status'](_0x44e015);return _0x570a9d['set']('Content-Range',_0x77936f+'-'+_0x3b1fdd+'/'+_0x458df2)[_0xcd8e('0x19')](_0x588c74);}return null;};}function patchUpdates(_0x482d71){return function(_0x5a690b){try{jsonpatch[_0xcd8e('0x1e')](_0x5a690b,_0x482d71,!![]);}catch(_0x40c2b5){return BPromise[_0xcd8e('0x1f')](_0x40c2b5);}return _0x5a690b[_0xcd8e('0x20')]();};}function saveUpdates(_0x2ab59,_0x3ecb58){return function(_0x9c6c20){if(_0x9c6c20){return _0x9c6c20['update'](_0x2ab59)['then'](function(_0xe1a671){return _0xe1a671;});}return null;};}function removeEntity(_0x58ef98,_0x563aa6){return function(_0x17c000){if(_0x17c000){return _0x17c000[_0xcd8e('0x21')]()[_0xcd8e('0x22')](function(){_0x58ef98[_0xcd8e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a123,_0x4f0b5a){return function(_0x145371){if(!_0x145371){_0x54a123['sendStatus'](0x194);}return _0x145371;};}function handleError(_0x3244e2,_0x77049e){_0x77049e=_0x77049e||0x1f4;return function(_0x2ea5f0){logger[_0xcd8e('0x23')](_0x2ea5f0['stack']);if(_0x2ea5f0[_0xcd8e('0x24')]){delete _0x2ea5f0[_0xcd8e('0x24')];}_0x3244e2[_0xcd8e('0x17')](_0x77049e)['send'](_0x2ea5f0);};}exports[_0xcd8e('0x25')]=function(_0x51c1a4,_0x3e0eaf){var _0xa6d43f={},_0x435b6a={},_0xef7de8={'count':0x0,'rows':[]};var _0x28f70a=_[_0xcd8e('0x26')](db[_0xcd8e('0x27')]['rawAttributes'],function(_0x7dfbbb){return{'name':_0x7dfbbb[_0xcd8e('0x28')],'type':_0x7dfbbb['type'][_0xcd8e('0x29')]};});_0x435b6a['model']=_[_0xcd8e('0x26')](_0x28f70a,'name');_0x435b6a[_0xcd8e('0x2a')]=_['keys'](_0x51c1a4[_0xcd8e('0x2a')]);_0x435b6a[_0xcd8e('0x2b')]=_[_0xcd8e('0x2c')](_0x435b6a[_0xcd8e('0x2d')],_0x435b6a[_0xcd8e('0x2a')]);_0xa6d43f[_0xcd8e('0x2e')]=_['intersection'](_0x435b6a[_0xcd8e('0x2d')],qs['fields'](_0x51c1a4[_0xcd8e('0x2a')][_0xcd8e('0x2f')]));_0xa6d43f[_0xcd8e('0x2e')]=_0xa6d43f[_0xcd8e('0x2e')][_0xcd8e('0x30')]?_0xa6d43f[_0xcd8e('0x2e')]:_0x435b6a[_0xcd8e('0x2d')];if(!_0x51c1a4[_0xcd8e('0x2a')]['hasOwnProperty'](_0xcd8e('0x31'))){_0xa6d43f['limit']=qs[_0xcd8e('0x1c')](_0x51c1a4[_0xcd8e('0x2a')][_0xcd8e('0x1c')]);_0xa6d43f[_0xcd8e('0x1a')]=qs[_0xcd8e('0x1a')](_0x51c1a4[_0xcd8e('0x2a')][_0xcd8e('0x1a')]);}_0xa6d43f[_0xcd8e('0x32')]=qs[_0xcd8e('0x33')](_0x51c1a4[_0xcd8e('0x2a')][_0xcd8e('0x33')]);_0xa6d43f['where']=qs[_0xcd8e('0x2b')](_[_0xcd8e('0x34')](_0x51c1a4[_0xcd8e('0x2a')],_0x435b6a[_0xcd8e('0x2b')]),_0x28f70a);if(_0x51c1a4[_0xcd8e('0x2a')][_0xcd8e('0x35')]){_0xa6d43f[_0xcd8e('0x36')]=_[_0xcd8e('0x37')](_0xa6d43f[_0xcd8e('0x36')],{'$or':_[_0xcd8e('0x26')](_0x28f70a,function(_0x39bfdb){if(_0x39bfdb[_0xcd8e('0x38')]!==_0xcd8e('0x39')){var _0x414759={};_0x414759[_0x39bfdb['name']]={'$like':'%'+_0x51c1a4[_0xcd8e('0x2a')][_0xcd8e('0x35')]+'%'};return _0x414759;}})});}_0xa6d43f=_['merge']({},_0xa6d43f,_0x51c1a4[_0xcd8e('0x3a')]);var _0x50e435={'where':_0xa6d43f[_0xcd8e('0x36')]};return db[_0xcd8e('0x27')][_0xcd8e('0x1d')](_0x50e435)[_0xcd8e('0x22')](function(_0x246ad4){_0xef7de8[_0xcd8e('0x1d')]=_0x246ad4;if(_0x51c1a4[_0xcd8e('0x2a')][_0xcd8e('0x3b')]){_0xa6d43f[_0xcd8e('0x3c')]=[{'all':!![]}];}return db[_0xcd8e('0x27')]['findAll'](_0xa6d43f);})[_0xcd8e('0x22')](function(_0x1ff9df){_0xef7de8[_0xcd8e('0x3d')]=_0x1ff9df;return _0xef7de8;})[_0xcd8e('0x22')](respondWithFilteredResult(_0x3e0eaf,_0xa6d43f))[_0xcd8e('0x3e')](handleError(_0x3e0eaf,null));};exports['show']=function(_0xaec6af,_0x33050c){var _0x346722={'raw':!![],'where':{'id':_0xaec6af[_0xcd8e('0x3f')]['id']}},_0x53b1bc={};_0x53b1bc['model']=_['keys'](db[_0xcd8e('0x27')][_0xcd8e('0x40')]);_0x53b1bc['query']=_['keys'](_0xaec6af[_0xcd8e('0x2a')]);_0x53b1bc['filters']=_['intersection'](_0x53b1bc[_0xcd8e('0x2d')],_0x53b1bc[_0xcd8e('0x2a')]);_0x346722[_0xcd8e('0x2e')]=_['intersection'](_0x53b1bc['model'],qs[_0xcd8e('0x2f')](_0xaec6af[_0xcd8e('0x2a')][_0xcd8e('0x2f')]));_0x346722[_0xcd8e('0x2e')]=_0x346722['attributes']['length']?_0x346722[_0xcd8e('0x2e')]:_0x53b1bc['model'];if(_0xaec6af[_0xcd8e('0x2a')][_0xcd8e('0x3b')]){_0x346722[_0xcd8e('0x3c')]=[{'all':!![]}];}_0x346722=_[_0xcd8e('0x37')]({},_0x346722,_0xaec6af['options']);return db[_0xcd8e('0x27')][_0xcd8e('0x41')](_0x346722)['then'](handleEntityNotFound(_0x33050c,null))['then'](respondWithResult(_0x33050c,null))[_0xcd8e('0x3e')](handleError(_0x33050c,null));};exports[_0xcd8e('0x42')]=function(_0x14cae6,_0x36bc12){return db[_0xcd8e('0x27')][_0xcd8e('0x42')](_0x14cae6[_0xcd8e('0x43')],{})['then'](respondWithResult(_0x36bc12,0xc9))['catch'](handleError(_0x36bc12,null));};exports[_0xcd8e('0x44')]=function(_0x52737c,_0x357ce0){if(_0x52737c[_0xcd8e('0x43')]['id']){delete _0x52737c[_0xcd8e('0x43')]['id'];}return db['MailTransferReport'][_0xcd8e('0x41')]({'where':{'id':_0x52737c[_0xcd8e('0x3f')]['id']}})[_0xcd8e('0x22')](handleEntityNotFound(_0x357ce0,null))[_0xcd8e('0x22')](saveUpdates(_0x52737c['body'],null))[_0xcd8e('0x22')](respondWithResult(_0x357ce0,null))[_0xcd8e('0x3e')](handleError(_0x357ce0,null));};exports[_0xcd8e('0x21')]=function(_0x47ccf7,_0x14fa97){return db[_0xcd8e('0x27')][_0xcd8e('0x41')]({'where':{'id':_0x47ccf7[_0xcd8e('0x3f')]['id']}})[_0xcd8e('0x22')](handleEntityNotFound(_0x14fa97,null))[_0xcd8e('0x22')](removeEntity(_0x14fa97,null))[_0xcd8e('0x3e')](handleError(_0x14fa97,null));};exports[_0xcd8e('0x45')]=function(_0x3a8b52,_0x36a9b2){return db[_0xcd8e('0x27')][_0xcd8e('0x45')]()[_0xcd8e('0x22')](respondWithResult(_0x36a9b2,null))[_0xcd8e('0x3e')](handleError(_0x36a9b2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c178ee0..13f38a2 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 _0xe28f=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','uniqueid','lodash'];(function(_0xb65193,_0x13d94d){var _0x12eeb4=function(_0x526c9c){while(--_0x526c9c){_0xb65193['push'](_0xb65193['shift']());}};_0x12eeb4(++_0x13d94d);}(_0xe28f,0x1e9));var _0xfe28=function(_0x33fbd5,_0x4a762c){_0x33fbd5=_0x33fbd5-0x0;var _0x2d9f07=_0xe28f[_0x33fbd5];return _0x2d9f07;};'use strict';var _=require(_0xfe28('0x0'));var util=require(_0xfe28('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfe28('0x2'));var BPromise=require(_0xfe28('0x3'));var rp=require(_0xfe28('0x4'));var fs=require('fs');var path=require(_0xfe28('0x5'));var rimraf=require(_0xfe28('0x6'));var config=require(_0xfe28('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0xfe28('0x8')]=function(_0x17f1c6,_0x56605b){return _0x17f1c6['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xfe28('0x9'),'fields':[_0xfe28('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x919e=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xc7ac70,_0x3576e9){var _0x566465=function(_0x5c5988){while(--_0x5c5988){_0xc7ac70['push'](_0xc7ac70['shift']());}};_0x566465(++_0x3576e9);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var logger=require(_0xe919('0x2'))('api');var moment=require(_0xe919('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe919('0x4'));var rimraf=require(_0xe919('0x5'));var config=require(_0xe919('0x6'));var attributes=require(_0xe919('0x7'));module[_0xe919('0x8')]=function(_0x5a27ad,_0x1225a5){return _0x5a27ad['define'](_0xe919('0x9'),attributes,{'tableName':_0xe919('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe919('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 44022e2..edebb7c 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 _0x6c0a=['rpc','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../config/logger'];(function(_0x3301e0,_0x10917c){var _0x86efad=function(_0x2399d2){while(--_0x2399d2){_0x3301e0['push'](_0x3301e0['shift']());}};_0x86efad(++_0x10917c);}(_0x6c0a,0x164));var _0xa6c0=function(_0x5d7b18,_0x3fbbaa){_0x5d7b18=_0x5d7b18-0x0;var _0x119a14=_0x6c0a[_0x5d7b18];return _0x119a14;};'use strict';var _=require(_0xa6c0('0x0'));var util=require(_0xa6c0('0x1'));var moment=require(_0xa6c0('0x2'));var BPromise=require(_0xa6c0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa6c0('0x4'))(_0xa6c0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa6c0('0x6')][_0xa6c0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1b6a41,_0x53a3fe,_0x36f97e){return new BPromise(function(_0x38654d,_0x4961bd){return client[_0xa6c0('0x8')](_0x1b6a41,_0x36f97e)['then'](function(_0x4b4fa7){logger[_0xa6c0('0x9')](_0xa6c0('0xa'),_0x53a3fe,_0xa6c0('0xb'));logger[_0xa6c0('0xc')](_0xa6c0('0xd'),_0x53a3fe,_0xa6c0('0xb'),JSON[_0xa6c0('0xe')](_0x4b4fa7));if(_0x4b4fa7[_0xa6c0('0xf')]){if(_0x4b4fa7['error'][_0xa6c0('0x10')]===0x1f4){logger['error'](_0xa6c0('0xa'),_0x53a3fe,_0x4b4fa7[_0xa6c0('0xf')][_0xa6c0('0x11')]);return _0x4961bd(_0x4b4fa7[_0xa6c0('0xf')][_0xa6c0('0x11')]);}logger['error'](_0xa6c0('0xa'),_0x53a3fe,_0x4b4fa7[_0xa6c0('0xf')][_0xa6c0('0x11')]);return _0x38654d(_0x4b4fa7[_0xa6c0('0xf')][_0xa6c0('0x11')]);}else{logger[_0xa6c0('0x9')](_0xa6c0('0xa'),_0x53a3fe,'request\x20sent');_0x38654d(_0x4b4fa7['result'][_0xa6c0('0x11')]);}})[_0xa6c0('0x12')](function(_0x4d8927){logger[_0xa6c0('0xf')](_0xa6c0('0xa'),_0x53a3fe,_0x4d8927);_0x4961bd(_0x4d8927);});});} \ No newline at end of file +var _0x549c=['http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ded5f,_0x1a5f3b){var _0x38375f=function(_0x32f28b){while(--_0x32f28b){_0x2ded5f['push'](_0x2ded5f['shift']());}};_0x38375f(++_0x1a5f3b);}(_0x549c,0x13f));var _0xc549=function(_0x4ac946,_0x3d8fab){_0x4ac946=_0x4ac946-0x0;var _0xfe1b85=_0x549c[_0x4ac946];return _0xfe1b85;};'use strict';var _=require(_0xc549('0x0'));var util=require(_0xc549('0x1'));var moment=require('moment');var BPromise=require(_0xc549('0x2'));var rs=require(_0xc549('0x3'));var fs=require('fs');var Redis=require(_0xc549('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc549('0x5'));var logger=require(_0xc549('0x6'))(_0xc549('0x7'));var config=require(_0xc549('0x8'));var jayson=require(_0xc549('0x9'));var client=jayson[_0xc549('0xa')][_0xc549('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c27ee,_0x41728b,_0x2df4db){return new BPromise(function(_0x11ebfa,_0x593614){return client[_0xc549('0xc')](_0x1c27ee,_0x2df4db)[_0xc549('0xd')](function(_0x129827){logger[_0xc549('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x41728b,_0xc549('0xf'));logger[_0xc549('0x10')](_0xc549('0x11'),_0x41728b,'request\x20sent',JSON[_0xc549('0x12')](_0x129827));if(_0x129827[_0xc549('0x13')]){if(_0x129827[_0xc549('0x13')]['code']===0x1f4){logger[_0xc549('0x13')](_0xc549('0x14'),_0x41728b,_0x129827[_0xc549('0x13')][_0xc549('0x15')]);return _0x593614(_0x129827[_0xc549('0x13')]['message']);}logger[_0xc549('0x13')](_0xc549('0x14'),_0x41728b,_0x129827['error'][_0xc549('0x15')]);return _0x11ebfa(_0x129827[_0xc549('0x13')][_0xc549('0x15')]);}else{logger[_0xc549('0xe')](_0xc549('0x14'),_0x41728b,_0xc549('0xf'));_0x11ebfa(_0x129827['result'][_0xc549('0x15')]);}})['catch'](function(_0x2bd3f5){logger[_0xc549('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x41728b,_0x2bd3f5);_0x593614(_0x2bd3f5);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index dbdf84d..d8cae0d 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 _0x943f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','describe','/:id','show','post','create','update','destroy','multer','util','path'];(function(_0x2ff427,_0x926e62){var _0x548a93=function(_0x4f2e79){while(--_0x4f2e79){_0x2ff427['push'](_0x2ff427['shift']());}};_0x548a93(++_0x926e62);}(_0x943f,0x96));var _0xf943=function(_0x4dd3e9,_0x4782dc){_0x4dd3e9=_0x4dd3e9-0x0;var _0x2ec6d8=_0x943f[_0x4dd3e9];return _0x2ec6d8;};'use strict';var multer=require(_0xf943('0x0'));var util=require(_0xf943('0x1'));var path=require(_0xf943('0x2'));var timeout=require('connect-timeout');var express=require(_0xf943('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf943('0x4'));var interaction=require(_0xf943('0x5'));var config=require(_0xf943('0x6'));var controller=require(_0xf943('0x7'));router[_0xf943('0x8')]('/',auth[_0xf943('0x9')](),controller['index']);router[_0xf943('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf943('0xa')]);router[_0xf943('0x8')](_0xf943('0xb'),auth[_0xf943('0x9')](),controller[_0xf943('0xc')]);router[_0xf943('0xd')]('/',auth['isAuthenticated'](),controller[_0xf943('0xe')]);router['put'](_0xf943('0xb'),auth[_0xf943('0x9')](),controller[_0xf943('0xf')]);router['delete'](_0xf943('0xb'),auth[_0xf943('0x9')](),controller[_0xf943('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2542=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','express'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x2542,0x1b5));var _0x2254=function(_0x876408,_0x2df29f){_0x876408=_0x876408-0x0;var _0x1fa441=_0x2542[_0x876408];return _0x1fa441;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require('connect-timeout');var express=require(_0x2254('0x3'));var router=express[_0x2254('0x4')]();var fs_extra=require(_0x2254('0x5'));var auth=require(_0x2254('0x6'));var interaction=require(_0x2254('0x7'));var config=require(_0x2254('0x8'));var controller=require('./memberReport.controller');router[_0x2254('0x9')]('/',auth[_0x2254('0xa')](),controller['index']);router['get'](_0x2254('0xb'),auth[_0x2254('0xa')](),controller[_0x2254('0xc')]);router[_0x2254('0x9')]('/:id',auth[_0x2254('0xa')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')]('/',auth[_0x2254('0xa')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')](_0x2254('0x11'),auth[_0x2254('0xa')](),controller[_0x2254('0x12')]);router['delete'](_0x2254('0x11'),auth[_0x2254('0xa')](),controller[_0x2254('0x13')]);module[_0x2254('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 9a05a01..14236d5 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 _0x9939=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','INTEGER'];(function(_0xef08c4,_0x1f8b82){var _0x5968d7=function(_0x1c58dd){while(--_0x1c58dd){_0xef08c4['push'](_0xef08c4['shift']());}};_0x5968d7(++_0x1f8b82);}(_0x9939,0x15e));var _0x9993=function(_0x1f27f1,_0x36c6c6){_0x1f27f1=_0x1f27f1-0x0;var _0x3d2f40=_0x9939[_0x1f27f1];return _0x3d2f40;};'use strict';var Sequelize=require(_0x9993('0x0'));var moment=require(_0x9993('0x1'));module[_0x9993('0x2')]={'channel':{'type':Sequelize[_0x9993('0x3')]},'membername':{'type':Sequelize[_0x9993('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9993('0x3')],'defaultValue':_0x9993('0x4'),'comment':_0x9993('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x9993('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x15de94){var _0x1b5f4e=moment(_0x15de94);var _0x5b7ce6=moment(this['getDataValue']('enterAt'));var _0x4c3df1=_0x1b5f4e['diff'](_0x5b7ce6,'seconds');this[_0x9993('0x7')](_0x9993('0x8'),_0x15de94);this[_0x9993('0x7')](_0x9993('0x9'),_0x4c3df1>=0x0?_0x4c3df1:null);}},'data1':{'type':Sequelize[_0x9993('0x3')],'comment':_0x9993('0xa')},'data2':{'type':Sequelize[_0x9993('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x9993('0x3')],'comment':_0x9993('0xb')},'data4':{'type':Sequelize[_0x9993('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x9993('0x3')],'comment':_0x9993('0xc')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9993('0xd')]},'uniqueid':{'type':Sequelize[_0x9993('0x3')]}}; \ No newline at end of file +var _0x0ae5=['exitAt','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds'];(function(_0x3fa59c,_0x2302f9){var _0x239a2c=function(_0x410d0f){while(--_0x410d0f){_0x3fa59c['push'](_0x3fa59c['shift']());}};_0x239a2c(++_0x2302f9);}(_0x0ae5,0x1b7));var _0x50ae=function(_0x20de98,_0x2ef701){_0x20de98=_0x20de98-0x0;var _0xdc9590=_0x0ae5[_0x20de98];return _0xdc9590;};'use strict';var Sequelize=require(_0x50ae('0x0'));var moment=require('moment');module[_0x50ae('0x1')]={'channel':{'type':Sequelize[_0x50ae('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x50ae('0x2')]},'type':{'type':Sequelize[_0x50ae('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x50ae('0x3')},'duration':{'type':Sequelize[_0x50ae('0x4')]},'enterAt':{'type':Sequelize[_0x50ae('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5b9909){var _0x462195=moment(_0x5b9909);var _0x4be5d6=moment(this[_0x50ae('0x6')](_0x50ae('0x7')));var _0x58c884=_0x462195['diff'](_0x4be5d6,_0x50ae('0x8'));this['setDataValue'](_0x50ae('0x9'),_0x5b9909);this['setDataValue']('duration',_0x58c884>=0x0?_0x58c884:null);}},'data1':{'type':Sequelize[_0x50ae('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x50ae('0x2')],'comment':_0x50ae('0xa')},'data3':{'type':Sequelize[_0x50ae('0x2')],'comment':_0x50ae('0xb')},'data4':{'type':Sequelize['STRING'],'comment':_0x50ae('0xc')},'data5':{'type':Sequelize[_0x50ae('0x2')],'comment':_0x50ae('0xd')},'role':{'type':Sequelize[_0x50ae('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x50ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index a6e6764..fe50cf9 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(_0x401961,_0x1b5a20){var _0x157ef9=function(_0x3f5f51){while(--_0x3f5f51){_0x401961['push'](_0x401961['shift']());}};_0x157ef9(++_0x1b5a20);}(_0x3e74,0x175));var _0x43e7=function(_0x250573,_0x2d6de0){_0x250573=_0x250573-0x0;var _0x31b0bf=_0x3e74[_0x250573];return _0x31b0bf;};'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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x55ca,0x126));var _0xa55c=function(_0x315d84,_0x3dacc3){_0x315d84=_0x315d84-0x0;var _0x560da1=_0x55ca[_0x315d84];return _0x560da1;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6b9df0e..476ca76 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 _0x4a33=['./memberReport.attributes','define','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x2e7a4f,_0x333364){var _0x29c20d=function(_0x19ae79){while(--_0x19ae79){_0x2e7a4f['push'](_0x2e7a4f['shift']());}};_0x29c20d(++_0x333364);}(_0x4a33,0x199));var _0x34a3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4a33[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x34a3('0x0'));var logger=require(_0x34a3('0x1'))(_0x34a3('0x2'));var moment=require(_0x34a3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34a3('0x4'));var rimraf=require(_0x34a3('0x5'));var config=require(_0x34a3('0x6'));var attributes=require(_0x34a3('0x7'));module['exports']=function(_0x122173,_0x5aa4b6){return _0x122173[_0x34a3('0x8')]('MemberReport',attributes,{'tableName':_0x34a3('0x9'),'paranoid':![],'indexes':[{'name':_0x34a3('0xa'),'fields':[_0x34a3('0xb'),_0x34a3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8caf=['request-promise','path','rimraf','MemberReport','report_member','membername_interface','membername','lodash','util','api','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8caf,0x16f));var _0xf8ca=function(_0x2d2f17,_0x2bd8a9){_0x2d2f17=_0x2d2f17-0x0;var _0x5a49ae=_0x8caf[_0x2d2f17];return _0x5a49ae;};'use strict';var _=require(_0xf8ca('0x0'));var util=require(_0xf8ca('0x1'));var logger=require('../../config/logger')(_0xf8ca('0x2'));var moment=require(_0xf8ca('0x3'));var BPromise=require(_0xf8ca('0x4'));var rp=require(_0xf8ca('0x5'));var fs=require('fs');var path=require(_0xf8ca('0x6'));var rimraf=require(_0xf8ca('0x7'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module['exports']=function(_0x5808d5,_0x1ebd7e){return _0x5808d5['define'](_0xf8ca('0x8'),attributes,{'tableName':_0xf8ca('0x9'),'paranoid':![],'indexes':[{'name':_0xf8ca('0xa'),'fields':[_0xf8ca('0xb'),'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 196f5cc..bc13268 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 _0x7278=['../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x7278,0x161));var _0x8727=function(_0x25d8be,_0x4d08d7){_0x25d8be=_0x25d8be-0x0;var _0x1a0f4a=_0x7278[_0x25d8be];return _0x1a0f4a;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var moment=require(_0x8727('0x2'));var BPromise=require(_0x8727('0x3'));var rs=require(_0x8727('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8727('0x5'))['db'];var utils=require(_0x8727('0x6'));var logger=require(_0x8727('0x7'))(_0x8727('0x8'));var config=require(_0x8727('0x9'));var jayson=require(_0x8727('0xa'));var client=jayson[_0x8727('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd1902,_0x2f491c,_0xffd783){return new BPromise(function(_0x435911,_0x4160c3){return client['request'](_0xfd1902,_0xffd783)['then'](function(_0x4df6f8){logger[_0x8727('0xc')](_0x8727('0xd'),_0x2f491c,_0x8727('0xe'));logger[_0x8727('0xf')](_0x8727('0x10'),_0x2f491c,_0x8727('0xe'),JSON[_0x8727('0x11')](_0x4df6f8));if(_0x4df6f8[_0x8727('0x12')]){if(_0x4df6f8['error'][_0x8727('0x13')]===0x1f4){logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x4df6f8['error'][_0x8727('0x14')]);return _0x4160c3(_0x4df6f8[_0x8727('0x12')]['message']);}logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x4df6f8[_0x8727('0x12')][_0x8727('0x14')]);return _0x435911(_0x4df6f8[_0x8727('0x12')][_0x8727('0x14')]);}else{logger[_0x8727('0xc')](_0x8727('0xd'),_0x2f491c,_0x8727('0xe'));_0x435911(_0x4df6f8[_0x8727('0x15')]['message']);}})[_0x8727('0x16')](function(_0x1f9538){logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x1f9538);_0x4160c3(_0x1f9538);});});}exports[_0x8727('0x17')]=function(_0xba0af5){var _0x533e6d=this;return new Promise(function(_0x575d29,_0x1a90ed){return db['MemberReport'][_0x8727('0x18')]({'raw':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1a')]===undefined?!![]:![]:!![],'where':_0xba0af5[_0x8727('0x19')]?_0xba0af5['options'][_0x8727('0x1b')]||null:null,'attributes':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1c')]||null:null,'limit':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1d')]||null:null,'include':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1e')]?_[_0x8727('0x1f')](_0xba0af5[_0x8727('0x19')]['include'],function(_0x464a32){return{'model':db[_0x464a32[_0x8727('0x20')]],'as':_0x464a32['as'],'attributes':_0x464a32['attributes'],'include':_0x464a32['include']?_[_0x8727('0x1f')](_0x464a32[_0x8727('0x1e')],function(_0x15e8bf){return{'model':db[_0x15e8bf['model']],'as':_0x15e8bf['as'],'attributes':_0x15e8bf[_0x8727('0x1c')],'include':_0x15e8bf[_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x15e8bf[_0x8727('0x1e')],function(_0x2c8cd5){return{'model':db[_0x2c8cd5[_0x8727('0x20')]],'as':_0x2c8cd5['as'],'attributes':_0x2c8cd5[_0x8727('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x21')](function(_0x5d03f2){logger[_0x8727('0xc')](_0x8727('0x17'),_0xba0af5);logger['debug'](_0x8727('0x17'),_0xba0af5,JSON[_0x8727('0x11')](_0x5d03f2));_0x575d29(_0x5d03f2);})[_0x8727('0x16')](function(_0x228ca9){logger[_0x8727('0x12')](_0x8727('0x17'),_0x228ca9['message'],_0xba0af5);_0x1a90ed(_0x533e6d[_0x8727('0x12')](0x1f4,_0x228ca9['message']));});});};exports[_0x8727('0x22')]=function(_0x47e9f9){var _0x44ed83=this;return new Promise(function(_0x391d60,_0x152a53){return db[_0x8727('0x23')][_0x8727('0x24')](_0x47e9f9[_0x8727('0x25')],{'raw':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9['options'][_0x8727('0x1a')]===undefined?!![]:![]:!![]})[_0x8727('0x21')](function(_0x4728c9){logger[_0x8727('0xc')](_0x8727('0x22'),_0x47e9f9);logger[_0x8727('0xf')](_0x8727('0x22'),_0x47e9f9,JSON[_0x8727('0x11')](_0x4728c9));_0x391d60(_0x4728c9);})[_0x8727('0x16')](function(_0x4435c9){logger[_0x8727('0x12')](_0x8727('0x22'),_0x4435c9['message'],_0x47e9f9);_0x152a53(_0x44ed83['error'](0x1f4,_0x4435c9[_0x8727('0x14')]));});});};exports[_0x8727('0x26')]=function(_0x38a61f){var _0x477ae2=this;return new Promise(function(_0x52220f,_0xf8f9e2){return db[_0x8727('0x23')][_0x8727('0x27')](_0x38a61f[_0x8727('0x25')],{'raw':_0x38a61f[_0x8727('0x19')]?_0x38a61f['options'][_0x8727('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38a61f[_0x8727('0x19')]?_0x38a61f[_0x8727('0x19')][_0x8727('0x1b')]||null:null,'attributes':_0x38a61f[_0x8727('0x19')]?_0x38a61f[_0x8727('0x19')][_0x8727('0x1c')]||null:null,'limit':_0x38a61f[_0x8727('0x19')]?_0x38a61f[_0x8727('0x19')][_0x8727('0x1d')]||null:null})[_0x8727('0x21')](function(_0x308c1d){logger['info'](_0x8727('0x26'),_0x38a61f);logger[_0x8727('0xf')](_0x8727('0x26'),_0x38a61f,JSON[_0x8727('0x11')](_0x308c1d));_0x52220f(_0x308c1d);})[_0x8727('0x16')](function(_0x2c60b0){logger[_0x8727('0x12')](_0x8727('0x26'),_0x2c60b0[_0x8727('0x14')],_0x38a61f);_0xf8f9e2(_0x477ae2[_0x8727('0x12')](0x1f4,_0x2c60b0[_0x8727('0x14')]));});});}; \ No newline at end of file +var _0xcfcb=['create','body','UpdateMemberReport','update','where','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','info','result','catch','GetMemberReport','MemberReport','options','raw','attributes','limit','include','map','model','CreateMemberReport'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xcfcb[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0xbcfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbcfc('0x1'));var fs=require('fs');var Redis=require(_0xbcfc('0x2'));var db=require(_0xbcfc('0x3'))['db'];var utils=require(_0xbcfc('0x4'));var logger=require(_0xbcfc('0x5'))(_0xbcfc('0x6'));var config=require(_0xbcfc('0x7'));var jayson=require(_0xbcfc('0x8'));var client=jayson[_0xbcfc('0x9')][_0xbcfc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4056a8,_0x42052a,_0x2a57ad){return new BPromise(function(_0x349e53,_0x29b308){return client[_0xbcfc('0xb')](_0x4056a8,_0x2a57ad)[_0xbcfc('0xc')](function(_0x47c569){logger['info']('MemberReport,\x20%s,\x20%s',_0x42052a,'request\x20sent');logger[_0xbcfc('0xd')](_0xbcfc('0xe'),_0x42052a,_0xbcfc('0xf'),JSON[_0xbcfc('0x10')](_0x47c569));if(_0x47c569[_0xbcfc('0x11')]){if(_0x47c569[_0xbcfc('0x11')][_0xbcfc('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x42052a,_0x47c569[_0xbcfc('0x11')][_0xbcfc('0x13')]);return _0x29b308(_0x47c569['error'][_0xbcfc('0x13')]);}logger['error'](_0xbcfc('0x14'),_0x42052a,_0x47c569[_0xbcfc('0x11')]['message']);return _0x349e53(_0x47c569[_0xbcfc('0x11')][_0xbcfc('0x13')]);}else{logger[_0xbcfc('0x15')](_0xbcfc('0x14'),_0x42052a,_0xbcfc('0xf'));_0x349e53(_0x47c569[_0xbcfc('0x16')]['message']);}})[_0xbcfc('0x17')](function(_0x125773){logger['error'](_0xbcfc('0x14'),_0x42052a,_0x125773);_0x29b308(_0x125773);});});}exports[_0xbcfc('0x18')]=function(_0x521978){var _0x5550a6=this;return new Promise(function(_0x15abcf,_0x1f581d){return db[_0xbcfc('0x19')]['findAll']({'raw':_0x521978[_0xbcfc('0x1a')]?_0x521978[_0xbcfc('0x1a')][_0xbcfc('0x1b')]===undefined?!![]:![]:!![],'where':_0x521978[_0xbcfc('0x1a')]?_0x521978[_0xbcfc('0x1a')]['where']||null:null,'attributes':_0x521978[_0xbcfc('0x1a')]?_0x521978[_0xbcfc('0x1a')][_0xbcfc('0x1c')]||null:null,'limit':_0x521978['options']?_0x521978['options'][_0xbcfc('0x1d')]||null:null,'include':_0x521978[_0xbcfc('0x1a')]?_0x521978[_0xbcfc('0x1a')][_0xbcfc('0x1e')]?_[_0xbcfc('0x1f')](_0x521978[_0xbcfc('0x1a')][_0xbcfc('0x1e')],function(_0x52f9c4){return{'model':db[_0x52f9c4[_0xbcfc('0x20')]],'as':_0x52f9c4['as'],'attributes':_0x52f9c4[_0xbcfc('0x1c')],'include':_0x52f9c4['include']?_[_0xbcfc('0x1f')](_0x52f9c4['include'],function(_0x9a013f){return{'model':db[_0x9a013f[_0xbcfc('0x20')]],'as':_0x9a013f['as'],'attributes':_0x9a013f['attributes'],'include':_0x9a013f[_0xbcfc('0x1e')]?_[_0xbcfc('0x1f')](_0x9a013f[_0xbcfc('0x1e')],function(_0x3db2ec){return{'model':db[_0x3db2ec[_0xbcfc('0x20')]],'as':_0x3db2ec['as'],'attributes':_0x3db2ec[_0xbcfc('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcf366e){logger['info'](_0xbcfc('0x18'),_0x521978);logger['debug'](_0xbcfc('0x18'),_0x521978,JSON[_0xbcfc('0x10')](_0xcf366e));_0x15abcf(_0xcf366e);})[_0xbcfc('0x17')](function(_0x2d5219){logger[_0xbcfc('0x11')](_0xbcfc('0x18'),_0x2d5219[_0xbcfc('0x13')],_0x521978);_0x1f581d(_0x5550a6[_0xbcfc('0x11')](0x1f4,_0x2d5219[_0xbcfc('0x13')]));});});};exports[_0xbcfc('0x21')]=function(_0xfc665d){var _0x580ecc=this;return new Promise(function(_0x183cdb,_0x4f1b94){return db[_0xbcfc('0x19')][_0xbcfc('0x22')](_0xfc665d[_0xbcfc('0x23')],{'raw':_0xfc665d[_0xbcfc('0x1a')]?_0xfc665d[_0xbcfc('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xbcfc('0xc')](function(_0x236637){logger[_0xbcfc('0x15')](_0xbcfc('0x21'),_0xfc665d);logger[_0xbcfc('0xd')]('CreateMemberReport',_0xfc665d,JSON[_0xbcfc('0x10')](_0x236637));_0x183cdb(_0x236637);})[_0xbcfc('0x17')](function(_0x5e57b3){logger[_0xbcfc('0x11')](_0xbcfc('0x21'),_0x5e57b3['message'],_0xfc665d);_0x4f1b94(_0x580ecc['error'](0x1f4,_0x5e57b3[_0xbcfc('0x13')]));});});};exports[_0xbcfc('0x24')]=function(_0x257024){var _0x2cbdac=this;return new Promise(function(_0x18d520,_0xd85c5d){return db[_0xbcfc('0x19')][_0xbcfc('0x25')](_0x257024[_0xbcfc('0x23')],{'raw':_0x257024[_0xbcfc('0x1a')]?_0x257024['options'][_0xbcfc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x257024[_0xbcfc('0x1a')]?_0x257024['options'][_0xbcfc('0x26')]||null:null,'attributes':_0x257024['options']?_0x257024[_0xbcfc('0x1a')][_0xbcfc('0x1c')]||null:null,'limit':_0x257024[_0xbcfc('0x1a')]?_0x257024['options']['limit']||null:null})[_0xbcfc('0xc')](function(_0xfe8fdd){logger[_0xbcfc('0x15')]('UpdateMemberReport',_0x257024);logger[_0xbcfc('0xd')](_0xbcfc('0x24'),_0x257024,JSON['stringify'](_0xfe8fdd));_0x18d520(_0xfe8fdd);})['catch'](function(_0x4c9fb4){logger['error']('UpdateMemberReport',_0x4c9fb4['message'],_0x257024);_0xd85c5d(_0x2cbdac['error'](0x1f4,_0x4c9fb4[_0xbcfc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0525552..df26cd8 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 _0x1ed2=['multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x5ce6b6,_0x380285){var _0x9cc4e1=function(_0x5a0913){while(--_0x5a0913){_0x5ce6b6['push'](_0x5ce6b6['shift']());}};_0x9cc4e1(++_0x380285);}(_0x1ed2,0x136));var _0x21ed=function(_0x10acb2,_0x3ca870){_0x10acb2=_0x10acb2-0x0;var _0x186379=_0x1ed2[_0x10acb2];return _0x186379;};'use strict';var multer=require(_0x21ed('0x0'));var util=require('util');var path=require(_0x21ed('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x21ed('0x2'));var auth=require(_0x21ed('0x3'));var interaction=require(_0x21ed('0x4'));var config=require(_0x21ed('0x5'));var controller=require(_0x21ed('0x6'));router[_0x21ed('0x7')]('/',controller[_0x21ed('0x8')]);module[_0x21ed('0x9')]=router; \ No newline at end of file +var _0x6a56=['index','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x15c03f,_0x3e201d){var _0x5b9ff1=function(_0x1df280){while(--_0x1df280){_0x15c03f['push'](_0x15c03f['shift']());}};_0x5b9ff1(++_0x3e201d);}(_0x6a56,0x182));var _0x66a5=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x6a56[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require(_0x66a5('0x0'));var util=require(_0x66a5('0x1'));var path=require(_0x66a5('0x2'));var timeout=require(_0x66a5('0x3'));var express=require(_0x66a5('0x4'));var router=express[_0x66a5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x66a5('0x6'));var interaction=require(_0x66a5('0x7'));var config=require('../../config/environment');var controller=require(_0x66a5('0x8'));router[_0x66a5('0x9')]('/',controller[_0x66a5('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 6faa705..6a45f09 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 _0x081c=['exports','STRING','version','sequelize'];(function(_0x1d5cfa,_0x57efb0){var _0x19a273=function(_0x2fe3f5){while(--_0x2fe3f5){_0x1d5cfa['push'](_0x1d5cfa['shift']());}};_0x19a273(++_0x57efb0);}(_0x081c,0x127));var _0xc081=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0x081c[_0x923ab6];return _0x484752;};'use strict';var Sequelize=require(_0xc081('0x0'));module[_0xc081('0x1')]={'version':{'type':Sequelize[_0xc081('0x2')],'unique':_0xc081('0x3')}}; \ No newline at end of file +var _0x8da1=['exports','STRING','version'];(function(_0x29696a,_0x29c101){var _0x35d205=function(_0x3bf8b1){while(--_0x3bf8b1){_0x29696a['push'](_0x29696a['shift']());}};_0x35d205(++_0x29c101);}(_0x8da1,0xc9));var _0x18da=function(_0x545150,_0x2c2b6c){_0x545150=_0x545150-0x0;var _0xff7fd6=_0x8da1[_0x545150];return _0xff7fd6;};'use strict';var Sequelize=require('sequelize');module[_0x18da('0x0')]={'version':{'type':Sequelize[_0x18da('0x1')],'unique':_0x18da('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ac2c9e4..be74ef1 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 _0x8b49=['destroy','end','error','stack','name','send','map','Migration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x48ca8b,_0x500751){var _0x52c57a=function(_0x3b3b4f){while(--_0x3b3b4f){_0x48ca8b['push'](_0x48ca8b['shift']());}};_0x52c57a(++_0x500751);}(_0x8b49,0x6d));var _0x98b4=function(_0x47c39d,_0x3eea90){_0x47c39d=_0x47c39d-0x0;var _0xd41416=_0x8b49[_0x47c39d];return _0xd41416;};'use strict';var emlformat=require(_0x98b4('0x0'));var rimraf=require(_0x98b4('0x1'));var zipdir=require(_0x98b4('0x2'));var jsonpatch=require(_0x98b4('0x3'));var rp=require(_0x98b4('0x4'));var moment=require(_0x98b4('0x5'));var BPromise=require(_0x98b4('0x6'));var Mustache=require(_0x98b4('0x7'));var util=require(_0x98b4('0x8'));var path=require(_0x98b4('0x9'));var sox=require(_0x98b4('0xa'));var csv=require(_0x98b4('0xb'));var ejs=require(_0x98b4('0xc'));var fs=require('fs');var fs_extra=require(_0x98b4('0xd'));var _=require('lodash');var squel=require(_0x98b4('0xe'));var crypto=require(_0x98b4('0xf'));var jsforce=require(_0x98b4('0x10'));var deskjs=require(_0x98b4('0x11'));var toCsv=require(_0x98b4('0xb'));var querystring=require(_0x98b4('0x12'));var Papa=require(_0x98b4('0x13'));var Redis=require(_0x98b4('0x14'));var authService=require(_0x98b4('0x15'));var qs=require(_0x98b4('0x16'));var as=require(_0x98b4('0x17'));var hardwareService=require(_0x98b4('0x18'));var logger=require(_0x98b4('0x19'))('api');var utils=require(_0x98b4('0x1a'));var config=require(_0x98b4('0x1b'));var licenseUtil=require(_0x98b4('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48dc8b,_0x588a1a){_0x588a1a=_0x588a1a||0xcc;return function(_0x8d0ba){if(_0x8d0ba){return _0x48dc8b[_0x98b4('0x1d')](_0x588a1a);}return _0x48dc8b[_0x98b4('0x1e')](_0x588a1a)['end']();};}function respondWithResult(_0x1a3e2a,_0x4759bf){_0x4759bf=_0x4759bf||0xc8;return function(_0x50ab76){if(_0x50ab76){return _0x1a3e2a[_0x98b4('0x1e')](_0x4759bf)[_0x98b4('0x1f')](_0x50ab76);}};}function respondWithFilteredResult(_0xd00704,_0x55c6ef){return function(_0x3b2463){if(_0x3b2463){var _0x51c4e4=typeof _0x55c6ef['offset']===_0x98b4('0x20')&&typeof _0x55c6ef[_0x98b4('0x21')]===_0x98b4('0x20');var _0x2d8f50=_0x3b2463['count'];var _0x58b526=_0x51c4e4?0x0:_0x55c6ef[_0x98b4('0x22')];var _0x4e2c69=_0x51c4e4?_0x3b2463[_0x98b4('0x23')]:_0x55c6ef[_0x98b4('0x22')]+_0x55c6ef[_0x98b4('0x21')];var _0x14478a;if(_0x4e2c69>=_0x2d8f50){_0x4e2c69=_0x2d8f50;_0x14478a=0xc8;}else{_0x14478a=0xce;}_0xd00704[_0x98b4('0x1e')](_0x14478a);return _0xd00704[_0x98b4('0x24')](_0x98b4('0x25'),_0x58b526+'-'+_0x4e2c69+'/'+_0x2d8f50)[_0x98b4('0x1f')](_0x3b2463);}return null;};}function patchUpdates(_0x5d706){return function(_0x2d5364){try{jsonpatch[_0x98b4('0x26')](_0x2d5364,_0x5d706,!![]);}catch(_0x259610){return BPromise[_0x98b4('0x27')](_0x259610);}return _0x2d5364[_0x98b4('0x28')]();};}function saveUpdates(_0x226830,_0x8dcb9e){return function(_0x57d712){if(_0x57d712){return _0x57d712[_0x98b4('0x29')](_0x226830)[_0x98b4('0x2a')](function(_0x30c0f0){return _0x30c0f0;});}return null;};}function removeEntity(_0x18eb88,_0x18d74e){return function(_0x7d364f){if(_0x7d364f){return _0x7d364f[_0x98b4('0x2b')]()[_0x98b4('0x2a')](function(){_0x18eb88[_0x98b4('0x1e')](0xcc)[_0x98b4('0x2c')]();});}};}function handleEntityNotFound(_0x1fd48f,_0x2720d7){return function(_0x11bcfb){if(!_0x11bcfb){_0x1fd48f['sendStatus'](0x194);}return _0x11bcfb;};}function handleError(_0x2287e3,_0x1c0b7b){_0x1c0b7b=_0x1c0b7b||0x1f4;return function(_0x24fba6){logger[_0x98b4('0x2d')](_0x24fba6[_0x98b4('0x2e')]);if(_0x24fba6[_0x98b4('0x2f')]){delete _0x24fba6[_0x98b4('0x2f')];}_0x2287e3[_0x98b4('0x1e')](_0x1c0b7b)[_0x98b4('0x30')](_0x24fba6);};}exports['index']=function(_0x1ba8b2,_0x2a7cbf){var _0xe465c6={},_0xbe0bd7={},_0x59323f={'count':0x0,'rows':[]};var _0x3e5253=_[_0x98b4('0x31')](db[_0x98b4('0x32')][_0x98b4('0x33')],function(_0x190b41){return{'name':_0x190b41['fieldName'],'type':_0x190b41['type'][_0x98b4('0x34')]};});_0xbe0bd7[_0x98b4('0x35')]=_[_0x98b4('0x31')](_0x3e5253,_0x98b4('0x2f'));_0xbe0bd7[_0x98b4('0x36')]=_[_0x98b4('0x37')](_0x1ba8b2[_0x98b4('0x36')]);_0xbe0bd7[_0x98b4('0x38')]=_['intersection'](_0xbe0bd7[_0x98b4('0x35')],_0xbe0bd7[_0x98b4('0x36')]);_0xe465c6['attributes']=_[_0x98b4('0x39')](_0xbe0bd7[_0x98b4('0x35')],qs[_0x98b4('0x3a')](_0x1ba8b2[_0x98b4('0x36')][_0x98b4('0x3a')]));_0xe465c6[_0x98b4('0x3b')]=_0xe465c6['attributes'][_0x98b4('0x3c')]?_0xe465c6[_0x98b4('0x3b')]:_0xbe0bd7['model'];if(!_0x1ba8b2[_0x98b4('0x36')][_0x98b4('0x3d')](_0x98b4('0x3e'))){_0xe465c6['limit']=qs['limit'](_0x1ba8b2[_0x98b4('0x36')][_0x98b4('0x21')]);_0xe465c6[_0x98b4('0x22')]=qs[_0x98b4('0x22')](_0x1ba8b2[_0x98b4('0x36')][_0x98b4('0x22')]);}_0xe465c6[_0x98b4('0x3f')]=qs['sort'](_0x1ba8b2[_0x98b4('0x36')][_0x98b4('0x40')]);_0xe465c6[_0x98b4('0x41')]=qs['filters'](_[_0x98b4('0x42')](_0x1ba8b2['query'],_0xbe0bd7[_0x98b4('0x38')]),_0x3e5253);if(_0x1ba8b2['query'][_0x98b4('0x43')]){_0xe465c6[_0x98b4('0x41')]=_[_0x98b4('0x44')](_0xe465c6[_0x98b4('0x41')],{'$or':_[_0x98b4('0x31')](_0x3e5253,function(_0x6b0a0b){if(_0x6b0a0b[_0x98b4('0x45')]!==_0x98b4('0x46')){var _0x48e69f={};_0x48e69f[_0x6b0a0b[_0x98b4('0x2f')]]={'$like':'%'+_0x1ba8b2[_0x98b4('0x36')][_0x98b4('0x43')]+'%'};return _0x48e69f;}})});}_0xe465c6=_[_0x98b4('0x44')]({},_0xe465c6,_0x1ba8b2[_0x98b4('0x47')]);var _0x325d1b={'where':_0xe465c6[_0x98b4('0x41')]};return db[_0x98b4('0x32')][_0x98b4('0x23')](_0x325d1b)[_0x98b4('0x2a')](function(_0x1f7a64){_0x59323f[_0x98b4('0x23')]=_0x1f7a64;if(_0x1ba8b2[_0x98b4('0x36')][_0x98b4('0x48')]){_0xe465c6[_0x98b4('0x49')]=[{'all':!![]}];}return db[_0x98b4('0x32')][_0x98b4('0x4a')](_0xe465c6);})[_0x98b4('0x2a')](function(_0x1a2ad4){_0x59323f[_0x98b4('0x4b')]=_0x1a2ad4;return _0x59323f;})['then'](respondWithFilteredResult(_0x2a7cbf,_0xe465c6))['catch'](handleError(_0x2a7cbf,null));}; \ No newline at end of file +var _0x4d45=['include','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map','Migration','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll'];(function(_0x30f761,_0x5a7c56){var _0x16bbc9=function(_0x4880e4){while(--_0x4880e4){_0x30f761['push'](_0x30f761['shift']());}};_0x16bbc9(++_0x5a7c56);}(_0x4d45,0x19a));var _0x54d4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4d45[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x54d4('0x0'));var rimraf=require(_0x54d4('0x1'));var zipdir=require(_0x54d4('0x2'));var jsonpatch=require(_0x54d4('0x3'));var rp=require('request-promise');var moment=require(_0x54d4('0x4'));var BPromise=require(_0x54d4('0x5'));var Mustache=require(_0x54d4('0x6'));var util=require(_0x54d4('0x7'));var path=require(_0x54d4('0x8'));var sox=require(_0x54d4('0x9'));var csv=require('to-csv');var ejs=require(_0x54d4('0xa'));var fs=require('fs');var fs_extra=require(_0x54d4('0xb'));var _=require(_0x54d4('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x54d4('0xd'));var deskjs=require(_0x54d4('0xe'));var toCsv=require(_0x54d4('0xf'));var querystring=require(_0x54d4('0x10'));var Papa=require(_0x54d4('0x11'));var Redis=require(_0x54d4('0x12'));var authService=require(_0x54d4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x54d4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x54d4('0x15'));var utils=require('../../config/utils');var config=require(_0x54d4('0x16'));var licenseUtil=require(_0x54d4('0x17'));var db=require(_0x54d4('0x18'))['db'];function respondWithStatusCode(_0x9c386d,_0x365ac0){_0x365ac0=_0x365ac0||0xcc;return function(_0x4869a1){if(_0x4869a1){return _0x9c386d[_0x54d4('0x19')](_0x365ac0);}return _0x9c386d['status'](_0x365ac0)[_0x54d4('0x1a')]();};}function respondWithResult(_0x58c54f,_0x1ef214){_0x1ef214=_0x1ef214||0xc8;return function(_0x110a6b){if(_0x110a6b){return _0x58c54f[_0x54d4('0x1b')](_0x1ef214)['json'](_0x110a6b);}};}function respondWithFilteredResult(_0x416c5c,_0x10571f){return function(_0x38fb77){if(_0x38fb77){var _0x25d9e3=typeof _0x10571f[_0x54d4('0x1c')]===_0x54d4('0x1d')&&typeof _0x10571f['limit']===_0x54d4('0x1d');var _0xcf67d2=_0x38fb77[_0x54d4('0x1e')];var _0x21066e=_0x25d9e3?0x0:_0x10571f[_0x54d4('0x1c')];var _0x8e25bc=_0x25d9e3?_0x38fb77[_0x54d4('0x1e')]:_0x10571f['offset']+_0x10571f[_0x54d4('0x1f')];var _0xd784c3;if(_0x8e25bc>=_0xcf67d2){_0x8e25bc=_0xcf67d2;_0xd784c3=0xc8;}else{_0xd784c3=0xce;}_0x416c5c['status'](_0xd784c3);return _0x416c5c[_0x54d4('0x20')]('Content-Range',_0x21066e+'-'+_0x8e25bc+'/'+_0xcf67d2)[_0x54d4('0x21')](_0x38fb77);}return null;};}function patchUpdates(_0x15ab39){return function(_0x2b91a1){try{jsonpatch[_0x54d4('0x22')](_0x2b91a1,_0x15ab39,!![]);}catch(_0x45edff){return BPromise[_0x54d4('0x23')](_0x45edff);}return _0x2b91a1[_0x54d4('0x24')]();};}function saveUpdates(_0x15fa97,_0x2fa838){return function(_0x418f78){if(_0x418f78){return _0x418f78[_0x54d4('0x25')](_0x15fa97)[_0x54d4('0x26')](function(_0x2dd664){return _0x2dd664;});}return null;};}function removeEntity(_0x2048b8,_0x452a02){return function(_0x322304){if(_0x322304){return _0x322304[_0x54d4('0x27')]()[_0x54d4('0x26')](function(){_0x2048b8['status'](0xcc)[_0x54d4('0x1a')]();});}};}function handleEntityNotFound(_0x674563,_0x5e57a0){return function(_0x1eb335){if(!_0x1eb335){_0x674563[_0x54d4('0x19')](0x194);}return _0x1eb335;};}function handleError(_0x43649d,_0x5bdc9e){_0x5bdc9e=_0x5bdc9e||0x1f4;return function(_0x122e9c){logger[_0x54d4('0x28')](_0x122e9c['stack']);if(_0x122e9c['name']){delete _0x122e9c[_0x54d4('0x29')];}_0x43649d['status'](_0x5bdc9e)[_0x54d4('0x2a')](_0x122e9c);};}exports[_0x54d4('0x2b')]=function(_0x12d90b,_0x36df6c){var _0x53592a={},_0x6f6d8e={},_0x3847b6={'count':0x0,'rows':[]};var _0xa351f=_[_0x54d4('0x2c')](db[_0x54d4('0x2d')][_0x54d4('0x2e')],function(_0x1cb3ae){return{'name':_0x1cb3ae[_0x54d4('0x2f')],'type':_0x1cb3ae[_0x54d4('0x30')]['key']};});_0x6f6d8e[_0x54d4('0x31')]=_[_0x54d4('0x2c')](_0xa351f,'name');_0x6f6d8e['query']=_[_0x54d4('0x32')](_0x12d90b[_0x54d4('0x33')]);_0x6f6d8e[_0x54d4('0x34')]=_['intersection'](_0x6f6d8e[_0x54d4('0x31')],_0x6f6d8e[_0x54d4('0x33')]);_0x53592a[_0x54d4('0x35')]=_[_0x54d4('0x36')](_0x6f6d8e['model'],qs[_0x54d4('0x37')](_0x12d90b[_0x54d4('0x33')][_0x54d4('0x37')]));_0x53592a['attributes']=_0x53592a['attributes'][_0x54d4('0x38')]?_0x53592a[_0x54d4('0x35')]:_0x6f6d8e[_0x54d4('0x31')];if(!_0x12d90b[_0x54d4('0x33')][_0x54d4('0x39')](_0x54d4('0x3a'))){_0x53592a[_0x54d4('0x1f')]=qs[_0x54d4('0x1f')](_0x12d90b['query'][_0x54d4('0x1f')]);_0x53592a['offset']=qs[_0x54d4('0x1c')](_0x12d90b[_0x54d4('0x33')][_0x54d4('0x1c')]);}_0x53592a['order']=qs['sort'](_0x12d90b['query'][_0x54d4('0x3b')]);_0x53592a[_0x54d4('0x3c')]=qs['filters'](_[_0x54d4('0x3d')](_0x12d90b[_0x54d4('0x33')],_0x6f6d8e['filters']),_0xa351f);if(_0x12d90b['query']['filter']){_0x53592a[_0x54d4('0x3c')]=_[_0x54d4('0x3e')](_0x53592a[_0x54d4('0x3c')],{'$or':_['map'](_0xa351f,function(_0x6ccce){if(_0x6ccce[_0x54d4('0x30')]!=='VIRTUAL'){var _0x5751c8={};_0x5751c8[_0x6ccce[_0x54d4('0x29')]]={'$like':'%'+_0x12d90b[_0x54d4('0x33')][_0x54d4('0x3f')]+'%'};return _0x5751c8;}})});}_0x53592a=_[_0x54d4('0x3e')]({},_0x53592a,_0x12d90b[_0x54d4('0x40')]);var _0x382374={'where':_0x53592a[_0x54d4('0x3c')]};return db[_0x54d4('0x2d')][_0x54d4('0x1e')](_0x382374)[_0x54d4('0x26')](function(_0x5bfe31){_0x3847b6[_0x54d4('0x1e')]=_0x5bfe31;if(_0x12d90b['query'][_0x54d4('0x41')]){_0x53592a[_0x54d4('0x42')]=[{'all':!![]}];}return db['Migration'][_0x54d4('0x43')](_0x53592a);})[_0x54d4('0x26')](function(_0x59a4a6){_0x3847b6['rows']=_0x59a4a6;return _0x3847b6;})[_0x54d4('0x26')](respondWithFilteredResult(_0x36df6c,_0x53592a))['catch'](handleError(_0x36df6c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b230441..e86dcab 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 _0xa030=['migrations','lodash','util','../../config/logger','bluebird','path','../../config/environment','./migration.attributes','exports','Migration'];(function(_0x11270b,_0x560c84){var _0x24de95=function(_0x11c333){while(--_0x11c333){_0x11270b['push'](_0x11270b['shift']());}};_0x24de95(++_0x560c84);}(_0xa030,0x1eb));var _0x0a03=function(_0x397c5c,_0xbaa355){_0x397c5c=_0x397c5c-0x0;var _0x168688=_0xa030[_0x397c5c];return _0x168688;};'use strict';var _=require(_0x0a03('0x0'));var util=require(_0x0a03('0x1'));var logger=require(_0x0a03('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a03('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a03('0x4'));var rimraf=require('rimraf');var config=require(_0x0a03('0x5'));var attributes=require(_0x0a03('0x6'));module[_0x0a03('0x7')]=function(_0x7c45bb,_0x58eefb){return _0x7c45bb['define'](_0x0a03('0x8'),attributes,{'tableName':_0x0a03('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9730=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','Migration','migrations','../../config/logger'];(function(_0x2fbb8c,_0x15bc93){var _0x1005b4=function(_0x1a3f97){while(--_0x1a3f97){_0x2fbb8c['push'](_0x2fbb8c['shift']());}};_0x1005b4(++_0x15bc93);}(_0x9730,0x179));var _0x0973=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9730[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0973('0x0'))('api');var moment=require('moment');var BPromise=require(_0x0973('0x1'));var rp=require(_0x0973('0x2'));var fs=require('fs');var path=require(_0x0973('0x3'));var rimraf=require(_0x0973('0x4'));var config=require(_0x0973('0x5'));var attributes=require(_0x0973('0x6'));module['exports']=function(_0x2d1b15,_0x2615b9){return _0x2d1b15['define'](_0x0973('0x7'),attributes,{'tableName':_0x0973('0x8'),'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 afce700..fb7e59b 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 _0x8aa7=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x11e6d0,_0x137a46){var _0x5858c3=function(_0x29114b){while(--_0x29114b){_0x11e6d0['push'](_0x11e6d0['shift']());}};_0x5858c3(++_0x137a46);}(_0x8aa7,0xb6));var _0x78aa=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x8aa7[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var moment=require(_0x78aa('0x1'));var BPromise=require(_0x78aa('0x2'));var rs=require(_0x78aa('0x3'));var fs=require('fs');var Redis=require(_0x78aa('0x4'));var db=require(_0x78aa('0x5'))['db'];var utils=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var jayson=require(_0x78aa('0x9'));var client=jayson[_0x78aa('0xa')][_0x78aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369ee7,_0x462a9a,_0xa79008){return new BPromise(function(_0x2368ac,_0x460488){return client[_0x78aa('0xc')](_0x369ee7,_0xa79008)[_0x78aa('0xd')](function(_0x45d377){logger[_0x78aa('0xe')](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));logger[_0x78aa('0x11')](_0x78aa('0x12'),_0x462a9a,_0x78aa('0x10'),JSON['stringify'](_0x45d377));if(_0x45d377['error']){if(_0x45d377[_0x78aa('0x13')][_0x78aa('0x14')]===0x1f4){logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x460488(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x2368ac(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}else{logger['info'](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));_0x2368ac(_0x45d377[_0x78aa('0x16')][_0x78aa('0x15')]);}})[_0x78aa('0x17')](function(_0x2897f8){logger['error']('Migration,\x20%s,\x20%s',_0x462a9a,_0x2897f8);_0x460488(_0x2897f8);});});} \ No newline at end of file +var _0x97f5=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4e8792,_0x57650d){var _0x40eb4e=function(_0x94d30e){while(--_0x94d30e){_0x4e8792['push'](_0x4e8792['shift']());}};_0x40eb4e(++_0x57650d);}(_0x97f5,0x72));var _0x597f=function(_0x573e12,_0x474369){_0x573e12=_0x573e12-0x0;var _0xf362c6=_0x97f5[_0x573e12];return _0xf362c6;};'use strict';var _=require(_0x597f('0x0'));var util=require(_0x597f('0x1'));var moment=require(_0x597f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x597f('0x3'));var db=require(_0x597f('0x4'))['db'];var utils=require(_0x597f('0x5'));var logger=require(_0x597f('0x6'))(_0x597f('0x7'));var config=require(_0x597f('0x8'));var jayson=require(_0x597f('0x9'));var client=jayson[_0x597f('0xa')][_0x597f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f4eb9,_0x22b5d0,_0x20f0fc){return new BPromise(function(_0x1098e6,_0x40b1cd){return client[_0x597f('0xc')](_0x5f4eb9,_0x20f0fc)[_0x597f('0xd')](function(_0x5b293a){logger[_0x597f('0xe')](_0x597f('0xf'),_0x22b5d0,_0x597f('0x10'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x22b5d0,_0x597f('0x10'),JSON['stringify'](_0x5b293a));if(_0x5b293a[_0x597f('0x11')]){if(_0x5b293a[_0x597f('0x11')][_0x597f('0x12')]===0x1f4){logger['error'](_0x597f('0xf'),_0x22b5d0,_0x5b293a[_0x597f('0x11')][_0x597f('0x13')]);return _0x40b1cd(_0x5b293a[_0x597f('0x11')][_0x597f('0x13')]);}logger[_0x597f('0x11')](_0x597f('0xf'),_0x22b5d0,_0x5b293a[_0x597f('0x11')][_0x597f('0x13')]);return _0x1098e6(_0x5b293a[_0x597f('0x11')][_0x597f('0x13')]);}else{logger[_0x597f('0xe')](_0x597f('0xf'),_0x22b5d0,'request\x20sent');_0x1098e6(_0x5b293a[_0x597f('0x14')][_0x597f('0x13')]);}})[_0x597f('0x15')](function(_0x55eed9){logger[_0x597f('0x11')]('Migration,\x20%s,\x20%s',_0x22b5d0,_0x55eed9);_0x40b1cd(_0x55eed9);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 9832524..4c5f253 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 _0xa5c9=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','index','post','put','/:id','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5c9,0x143));var _0x9a5c=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xa5c9[_0x450689];return _0x46ffb0;};'use strict';var multer=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var path=require(_0x9a5c('0x2'));var timeout=require(_0x9a5c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a5c('0x4'));var auth=require(_0x9a5c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router[_0x9a5c('0x6')]('/',auth[_0x9a5c('0x7')](),controller[_0x9a5c('0x8')]);router[_0x9a5c('0x6')]('/:id',auth[_0x9a5c('0x7')](),controller['show']);router[_0x9a5c('0x9')]('/',auth[_0x9a5c('0x7')](),controller['create']);router[_0x9a5c('0xa')](_0x9a5c('0xb'),auth[_0x9a5c('0x7')](),controller['update']);router['delete'](_0x9a5c('0xb'),auth[_0x9a5c('0x7')](),controller[_0x9a5c('0xc')]);module[_0x9a5c('0xd')]=router; \ No newline at end of file +var _0x3157=['../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x552e59,_0x5c4591){var _0x5e15ad=function(_0x1af238){while(--_0x1af238){_0x552e59['push'](_0x552e59['shift']());}};_0x5e15ad(++_0x5c4591);}(_0x3157,0x198));var _0x7315=function(_0x1aa3f2,_0x46c393){_0x1aa3f2=_0x1aa3f2-0x0;var _0x71bc9e=_0x3157[_0x1aa3f2];return _0x71bc9e;};'use strict';var multer=require(_0x7315('0x0'));var util=require(_0x7315('0x1'));var path=require(_0x7315('0x2'));var timeout=require(_0x7315('0x3'));var express=require('express');var router=express[_0x7315('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7315('0x5'));var interaction=require(_0x7315('0x6'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0x7315('0x7')]('/',auth[_0x7315('0x8')](),controller[_0x7315('0x9')]);router['get'](_0x7315('0xa'),auth[_0x7315('0x8')](),controller['show']);router[_0x7315('0xb')]('/',auth[_0x7315('0x8')](),controller[_0x7315('0xc')]);router[_0x7315('0xd')]('/:id',auth[_0x7315('0x8')](),controller[_0x7315('0xe')]);router[_0x7315('0xf')](_0x7315('0xa'),auth['isAuthenticated'](),controller[_0x7315('0x10')]);module[_0x7315('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index e4dc2e2..6f25043 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 _0xffd7=['localnet','turn','STRING','sequelize','exports','ENUM'];(function(_0x92116d,_0xa6ee1b){var _0xfe4f60=function(_0x1f052d){while(--_0x1f052d){_0x92116d['push'](_0x92116d['shift']());}};_0xfe4f60(++_0xa6ee1b);}(_0xffd7,0x1c5));var _0x7ffd=function(_0x5617c1,_0x5abdc2){_0x5617c1=_0x5617c1-0x0;var _0x318d3b=_0xffd7[_0x5617c1];return _0x318d3b;};'use strict';var Sequelize=require(_0x7ffd('0x0'));module[_0x7ffd('0x1')]={'type':{'type':Sequelize[_0x7ffd('0x2')](_0x7ffd('0x3'),'externip','stun',_0x7ffd('0x4'))},'value':{'type':Sequelize[_0x7ffd('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b56=['ENUM','localnet','stun','turn','STRING','exports'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0x6b56,0x149));var _0x66b5=function(_0x9d9558,_0x35c6fc){_0x9d9558=_0x9d9558-0x0;var _0x3f2690=_0x6b56[_0x9d9558];return _0x3f2690;};'use strict';var Sequelize=require('sequelize');module[_0x66b5('0x0')]={'type':{'type':Sequelize[_0x66b5('0x1')](_0x66b5('0x2'),'externip',_0x66b5('0x3'),_0x66b5('0x4'))},'value':{'type':Sequelize[_0x66b5('0x5')]},'username':{'type':Sequelize[_0x66b5('0x5')]},'password':{'type':Sequelize[_0x66b5('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ee5e45d..6f92f39 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 _0x737b=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','keys','includeAll','include','create','body','toUpperCase','STUN','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','chan_sip.so','update','params','readFileSync','server/files/templates/network.ejs','format','toLowerCase','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','../../config/logger','jayson/promise','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','offset','undefined','limit','count','status','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key'];(function(_0x11caa2,_0x34221c){var _0x475eb4=function(_0x4a5a80){while(--_0x4a5a80){_0x11caa2['push'](_0x11caa2['shift']());}};_0x475eb4(++_0x34221c);}(_0x737b,0x179));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xb737('0x0'));var path=require(_0xb737('0x1'));var ejs=require(_0xb737('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xb737('0x3'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xb737('0x4'));var client=jayson['client'][_0xb737('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2fcd10,_0x5f29f2,_0x4ce713,_0xbdb520){return new Promise(function(_0x466ac6,_0x26d650){var _0x484e7d=_0xbdb520||client;return _0x484e7d[_0xb737('0x6')](_0x2fcd10,_0x4ce713)[_0xb737('0x7')](function(_0x78cad6){logger[_0xb737('0x8')](_0xb737('0x9'),_0x5f29f2,_0xb737('0xa'));logger[_0xb737('0xb')](_0xb737('0xc'),_0x5f29f2,'request\x20sent',JSON[_0xb737('0xd')](_0x78cad6));if(_0x78cad6[_0xb737('0xe')]){if(_0x78cad6[_0xb737('0xe')][_0xb737('0xf')]===0x1f4){logger[_0xb737('0xe')](_0xb737('0x9'),_0x5f29f2,_0x78cad6['error'][_0xb737('0x10')]);return _0x26d650(_0x78cad6[_0xb737('0xe')][_0xb737('0x10')]);}logger[_0xb737('0xe')](_0xb737('0x9'),_0x5f29f2,_0x78cad6['error']['message']);return _0x466ac6(_0x78cad6[_0xb737('0xe')][_0xb737('0x10')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x5f29f2,_0xb737('0xa'));_0x466ac6(_0x78cad6[_0xb737('0x11')][_0xb737('0x10')]);}})[_0xb737('0x12')](function(_0x198eda){logger['error'](_0xb737('0x9'),_0x5f29f2,_0x198eda);_0x26d650(_0x198eda);});});}function respondWithResult(_0x717388,_0x5aad0f){_0x5aad0f=_0x5aad0f||0xc8;return function(_0x184d87){if(_0x184d87){return _0x717388['status'](_0x5aad0f)['json'](_0x184d87);}};}function respondWithFilteredResult(_0x25caac,_0x4a1111){return function(_0x37f8ca){if(_0x37f8ca){var _0x444c4c=typeof _0x4a1111[_0xb737('0x13')]===_0xb737('0x14')&&typeof _0x4a1111[_0xb737('0x15')]===_0xb737('0x14');var _0x131af1=_0x37f8ca[_0xb737('0x16')];var _0x461c74=_0x444c4c?0x0:_0x4a1111[_0xb737('0x13')];var _0x112f70=_0x444c4c?_0x37f8ca[_0xb737('0x16')]:_0x4a1111[_0xb737('0x13')]+_0x4a1111[_0xb737('0x15')];var _0x279c4c;if(_0x112f70>=_0x131af1){_0x112f70=_0x131af1;_0x279c4c=0xc8;}else{_0x279c4c=0xce;}_0x25caac[_0xb737('0x17')](_0x279c4c);return _0x25caac[_0xb737('0x18')](_0xb737('0x19'),_0x461c74+'-'+_0x112f70+'/'+_0x131af1)['json'](_0x37f8ca);}return null;};}function saveUpdates(_0xd7db87){return function(_0x395865){if(_0x395865){return _0x395865['update'](_0xd7db87)[_0xb737('0x7')](function(_0x2631a7){return _0x2631a7;});}return null;};}function removeEntity(_0x44d289){return function(_0x57c721){if(_0x57c721){return _0x57c721[_0xb737('0x1a')]()[_0xb737('0x7')](function(){_0x44d289[_0xb737('0x17')](0xcc)[_0xb737('0x1b')]();});}};}function handleEntityNotFound(_0x39c5cc){return function(_0x24abc8){if(!_0x24abc8){_0x39c5cc[_0xb737('0x1c')](0x194);}return _0x24abc8;};}function handleError(_0x1958d8,_0x26f9c8){_0x26f9c8=_0x26f9c8||0x1f4;return function(_0x2754fc){logger[_0xb737('0xe')](_0x2754fc[_0xb737('0x1d')]);if(_0x2754fc[_0xb737('0x1e')]){delete _0x2754fc[_0xb737('0x1e')];}_0x1958d8['status'](_0x26f9c8)[_0xb737('0x1f')](_0x2754fc);};}exports[_0xb737('0x20')]=function(_0x99e974,_0x38aa5b){var _0x499399={},_0x5bd5cd={},_0x9db64a={'count':0x0,'rows':[]};var _0x195479=_[_0xb737('0x21')](db[_0xb737('0x22')][_0xb737('0x23')],function(_0x321d0c){return{'name':_0x321d0c[_0xb737('0x24')],'type':_0x321d0c['type'][_0xb737('0x25')]};});_0x5bd5cd[_0xb737('0x26')]=_[_0xb737('0x21')](_0x195479,_0xb737('0x1e'));_0x5bd5cd[_0xb737('0x27')]=_['keys'](_0x99e974[_0xb737('0x27')]);_0x5bd5cd[_0xb737('0x28')]=_[_0xb737('0x29')](_0x5bd5cd[_0xb737('0x26')],_0x5bd5cd[_0xb737('0x27')]);_0x499399[_0xb737('0x2a')]=_[_0xb737('0x29')](_0x5bd5cd[_0xb737('0x26')],qs[_0xb737('0x2b')](_0x99e974[_0xb737('0x27')]['fields']));_0x499399[_0xb737('0x2a')]=_0x499399[_0xb737('0x2a')][_0xb737('0x2c')]?_0x499399[_0xb737('0x2a')]:_0x5bd5cd[_0xb737('0x26')];if(!_0x99e974['query'][_0xb737('0x2d')]('nolimit')){_0x499399[_0xb737('0x15')]=qs[_0xb737('0x15')](_0x99e974[_0xb737('0x27')]['limit']);_0x499399[_0xb737('0x13')]=qs[_0xb737('0x13')](_0x99e974[_0xb737('0x27')]['offset']);}_0x499399[_0xb737('0x2e')]=qs[_0xb737('0x2f')](_0x99e974[_0xb737('0x27')][_0xb737('0x2f')]);_0x499399[_0xb737('0x30')]=qs[_0xb737('0x28')](_[_0xb737('0x31')](_0x99e974[_0xb737('0x27')],_0x5bd5cd[_0xb737('0x28')]),_0x195479);if(_0x99e974[_0xb737('0x27')][_0xb737('0x32')]){_0x499399['where']=_[_0xb737('0x33')](_0x499399[_0xb737('0x30')],{'$or':_[_0xb737('0x21')](_0x195479,function(_0x5e0ea7){if(_0x5e0ea7[_0xb737('0x34')]!==_0xb737('0x35')){var _0x14bfa5={};_0x14bfa5[_0x5e0ea7[_0xb737('0x1e')]]={'$like':'%'+_0x99e974[_0xb737('0x27')][_0xb737('0x32')]+'%'};return _0x14bfa5;}})});}_0x499399=_[_0xb737('0x33')]({},_0x499399,_0x99e974[_0xb737('0x36')]);var _0x1583fc={'where':_0x499399[_0xb737('0x30')]};return db['Network']['count'](_0x1583fc)[_0xb737('0x7')](function(_0x218175){_0x9db64a[_0xb737('0x16')]=_0x218175;if(_0x99e974[_0xb737('0x27')]['includeAll']){_0x499399['include']=[{'all':!![]}];}return db['Network'][_0xb737('0x37')](_0x499399);})[_0xb737('0x7')](function(_0x4338a4){_0x9db64a['rows']=_0x4338a4;return _0x9db64a;})['then'](respondWithFilteredResult(_0x38aa5b,_0x499399))['catch'](handleError(_0x38aa5b,null));};exports['show']=function(_0x317403,_0x4860d6){var _0x11c49c={'raw':!![],'where':{'id':_0x317403['params']['id']}},_0x56c321={};_0x56c321['model']=_[_0xb737('0x38')](db['Network'][_0xb737('0x23')]);_0x56c321[_0xb737('0x27')]=_[_0xb737('0x38')](_0x317403[_0xb737('0x27')]);_0x56c321['filters']=_[_0xb737('0x29')](_0x56c321['model'],_0x56c321['query']);_0x11c49c[_0xb737('0x2a')]=_[_0xb737('0x29')](_0x56c321[_0xb737('0x26')],qs[_0xb737('0x2b')](_0x317403[_0xb737('0x27')][_0xb737('0x2b')]));_0x11c49c[_0xb737('0x2a')]=_0x11c49c[_0xb737('0x2a')][_0xb737('0x2c')]?_0x11c49c[_0xb737('0x2a')]:_0x56c321[_0xb737('0x26')];if(_0x317403[_0xb737('0x27')][_0xb737('0x39')]){_0x11c49c[_0xb737('0x3a')]=[{'all':!![]}];}_0x11c49c=_['merge']({},_0x11c49c,_0x317403[_0xb737('0x36')]);return db['Network']['find'](_0x11c49c)[_0xb737('0x7')](handleEntityNotFound(_0x4860d6,null))[_0xb737('0x7')](respondWithResult(_0x4860d6,null))[_0xb737('0x12')](handleError(_0x4860d6,null));};exports[_0xb737('0x3b')]=function(_0x2c79f4,_0x419f33){var _0x370749;return db[_0xb737('0x22')][_0xb737('0x3b')](_0x2c79f4[_0xb737('0x3c')],{'raw':!![]})[_0xb737('0x7')](function(_0x198a8d){_0x370749=_0x198a8d;return db['Network'][_0xb737('0x37')]({'where':{'type':_0x2c79f4[_0xb737('0x3c')][_0xb737('0x34')]},'raw':!![]});})[_0xb737('0x7')](function(_0xdbc591){if(_0x370749[_0xb737('0x34')][_0xb737('0x3d')]()==_0xb737('0x3e')){var _0x62c495=fs['readFileSync'](path['join'](config['root'],_0xb737('0x3f')),_0xb737('0x40'));var _0x425089=ejs[_0xb737('0x41')](_0x62c495,{'networks':_0xdbc591||[]});fs[_0xb737('0x42')](_0xb737('0x43'),_0x425089);return respondWithRpcPromise(_0xb737('0x44'),_0xb737('0x3b'),{'module':_0xb737('0x45')});}else if(_0x370749[_0xb737('0x34')][_0xb737('0x3d')]()==_0xb737('0x46')){var _0x2791bd=fs['readFileSync'](path[_0xb737('0x47')](config[_0xb737('0x48')],_0xb737('0x49')),_0xb737('0x40'));var _0x2cbbfa=ejs[_0xb737('0x41')](_0x2791bd,{'networks':_0xdbc591||[]});fs[_0xb737('0x42')](_0xb737('0x4a'),_0x2cbbfa);return respondWithRpcPromise('Reload',_0xb737('0x3b'),{'module':_0xb737('0x45')});}else{var _0x330231=fs['readFileSync'](path[_0xb737('0x47')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x215911=ejs[_0xb737('0x41')](_0x330231,{'networks':_0xdbc591||[]});fs[_0xb737('0x42')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x2c79f4[_0xb737('0x3c')][_0xb737('0x34')]['toLowerCase']()),_0x215911);return respondWithRpcPromise(_0xb737('0x44'),_0xb737('0x3b'),{'module':_0xb737('0x4b')});}})[_0xb737('0x7')](function(){return _0x370749;})[_0xb737('0x7')](respondWithResult(_0x419f33,0xc9))[_0xb737('0x12')](handleError(_0x419f33,null));};exports[_0xb737('0x4c')]=function(_0x31e848,_0x506a15){var _0x13f51a;return db[_0xb737('0x22')]['find']({'where':{'id':_0x31e848[_0xb737('0x4d')]['id']}})[_0xb737('0x7')](handleEntityNotFound(_0x506a15,null))[_0xb737('0x7')](saveUpdates(_0x31e848['body'],null))[_0xb737('0x7')](function(_0x18b2d7){if(_0x18b2d7){_0x13f51a=_0x18b2d7;return db[_0xb737('0x22')][_0xb737('0x37')]({'where':{'type':_0x13f51a['type']},'raw':!![]});}return null;})[_0xb737('0x7')](function(_0x3bead5){if(_0x13f51a['type'][_0xb737('0x3d')]()==_0xb737('0x3e')){var _0x155ff8=fs[_0xb737('0x4e')](path[_0xb737('0x47')](config[_0xb737('0x48')],_0xb737('0x3f')),_0xb737('0x40'));var _0x14124b=ejs[_0xb737('0x41')](_0x155ff8,{'networks':_0x3bead5||[]});fs['writeFileSync'](_0xb737('0x43'),_0x14124b);return respondWithRpcPromise('Reload',_0xb737('0x4c'),{'module':_0xb737('0x45')});}else if(_0x13f51a[_0xb737('0x34')][_0xb737('0x3d')]()==_0xb737('0x46')){var _0x429b28=fs['readFileSync'](path[_0xb737('0x47')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xb737('0x40'));var _0x17ba3e=ejs[_0xb737('0x41')](_0x429b28,{'networks':_0x3bead5||[]});fs[_0xb737('0x42')](_0xb737('0x4a'),_0x17ba3e);return respondWithRpcPromise(_0xb737('0x44'),'update',{'module':_0xb737('0x45')});}else{var _0x45364b=fs[_0xb737('0x4e')](path[_0xb737('0x47')](config['root'],_0xb737('0x4f')),_0xb737('0x40'));var _0x13b636=ejs[_0xb737('0x41')](_0x45364b,{'networks':_0x3bead5||[]});fs[_0xb737('0x42')](util[_0xb737('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x31e848[_0xb737('0x3c')][_0xb737('0x34')][_0xb737('0x51')]()),_0x13b636);return respondWithRpcPromise(_0xb737('0x44'),_0xb737('0x4c'),{'module':'chan_sip.so'});}})[_0xb737('0x7')](function(_0x40f58a){if(_0x40f58a){return _0x13f51a;}return null;})[_0xb737('0x7')](respondWithResult(_0x506a15,null))[_0xb737('0x12')](handleError(_0x506a15,null));};exports[_0xb737('0x1a')]=function(_0x81700f,_0x427207){var _0x29e922;return db['Network']['find']({'where':{'id':_0x81700f['params']['id']}})[_0xb737('0x7')](function(_0x555332){_0x29e922=_0x555332;return _0x555332;})[_0xb737('0x7')](handleEntityNotFound(_0x427207,null))['then'](removeEntity(_0x427207,null))[_0xb737('0x7')](function(){if(_0x29e922){return db[_0xb737('0x22')][_0xb737('0x37')]({'where':{'type':_0x29e922[_0xb737('0x34')]},'raw':!![]});}})[_0xb737('0x7')](function(_0x9819c8){if(_0x29e922[_0xb737('0x34')][_0xb737('0x3d')]()=='STUN'){var _0x135e61=fs[_0xb737('0x4e')](path['join'](config[_0xb737('0x48')],'server/files/templates/stun_multiple.ejs'),_0xb737('0x40'));var _0x565622=ejs[_0xb737('0x41')](_0x135e61,{'networks':_0x9819c8||[]});fs[_0xb737('0x42')](_0xb737('0x43'),_0x565622);return respondWithRpcPromise('Reload',_0xb737('0x1a'),{'module':_0xb737('0x45')});}else if(_0x29e922[_0xb737('0x34')][_0xb737('0x3d')]()==_0xb737('0x46')){var _0x201293=fs[_0xb737('0x4e')](path[_0xb737('0x47')](config[_0xb737('0x48')],'server/files/templates/turn_multiple.ejs'),_0xb737('0x40'));var _0x5a4375=ejs[_0xb737('0x41')](_0x201293,{'networks':_0x9819c8||[]});fs[_0xb737('0x42')](_0xb737('0x4a'),_0x5a4375);return respondWithRpcPromise(_0xb737('0x44'),_0xb737('0x1a'),{'module':'res_stun_monitor.so'});}else{var _0x1465d7=fs[_0xb737('0x4e')](path['join'](config[_0xb737('0x48')],_0xb737('0x4f')),_0xb737('0x40'));var _0x1e2410=ejs[_0xb737('0x41')](_0x1465d7,{'networks':_0x9819c8||[]});fs[_0xb737('0x42')](util[_0xb737('0x50')](_0xb737('0x52'),_0x29e922['type'][_0xb737('0x51')]()),_0x1e2410);return respondWithRpcPromise(_0xb737('0x44'),_0xb737('0x1a'),{'module':_0xb737('0x4b')});}})[_0xb737('0x12')](handleError(_0x427207,null));}; \ No newline at end of file +var _0x799e=['Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filters','filter','where','VIRTUAL','merge','Network','includeAll','include','show','params','keys','options','body','toUpperCase','readFileSync','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','create','TURN','root','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','find','findAll','server/files/templates/turn_multiple.ejs','chan_sip.so','path','ejs','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x799e,0x18b));var _0xe799=function(_0x3b6388,_0x4d787e){_0x3b6388=_0x3b6388-0x0;var _0x445216=_0x799e[_0x3b6388];return _0x445216;};'use strict';var util=require('util');var path=require(_0xe799('0x0'));var ejs=require(_0xe799('0x1'));var fs=require('fs');var _=require('lodash');var qs=require(_0xe799('0x2'));var logger=require(_0xe799('0x3'))(_0xe799('0x4'));var config=require('../../config/environment');var db=require(_0xe799('0x5'))['db'];var jayson=require(_0xe799('0x6'));var client=jayson[_0xe799('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25f747,_0x105482,_0x2312a9,_0x4e26b0){return new Promise(function(_0x127cf3,_0x151722){var _0xd4b0b8=_0x4e26b0||client;return _0xd4b0b8['request'](_0x25f747,_0x2312a9)[_0xe799('0x8')](function(_0x5379a0){logger[_0xe799('0x9')]('Network,\x20%s,\x20%s',_0x105482,_0xe799('0xa'));logger[_0xe799('0xb')](_0xe799('0xc'),_0x105482,'request\x20sent',JSON[_0xe799('0xd')](_0x5379a0));if(_0x5379a0[_0xe799('0xe')]){if(_0x5379a0[_0xe799('0xe')]['code']===0x1f4){logger[_0xe799('0xe')](_0xe799('0xf'),_0x105482,_0x5379a0[_0xe799('0xe')][_0xe799('0x10')]);return _0x151722(_0x5379a0[_0xe799('0xe')]['message']);}logger[_0xe799('0xe')](_0xe799('0xf'),_0x105482,_0x5379a0['error'][_0xe799('0x10')]);return _0x127cf3(_0x5379a0['error'][_0xe799('0x10')]);}else{logger[_0xe799('0x9')](_0xe799('0xf'),_0x105482,_0xe799('0xa'));_0x127cf3(_0x5379a0[_0xe799('0x11')][_0xe799('0x10')]);}})[_0xe799('0x12')](function(_0x3ff8b7){logger[_0xe799('0xe')](_0xe799('0xf'),_0x105482,_0x3ff8b7);_0x151722(_0x3ff8b7);});});}function respondWithResult(_0x289641,_0x2fdffb){_0x2fdffb=_0x2fdffb||0xc8;return function(_0x3729d6){if(_0x3729d6){return _0x289641[_0xe799('0x13')](_0x2fdffb)[_0xe799('0x14')](_0x3729d6);}};}function respondWithFilteredResult(_0x10def2,_0x4bc910){return function(_0x34ddb8){if(_0x34ddb8){var _0x328794=typeof _0x4bc910[_0xe799('0x15')]===_0xe799('0x16')&&typeof _0x4bc910[_0xe799('0x17')]==='undefined';var _0x27c4cf=_0x34ddb8[_0xe799('0x18')];var _0x2c05bb=_0x328794?0x0:_0x4bc910[_0xe799('0x15')];var _0x1677dc=_0x328794?_0x34ddb8[_0xe799('0x18')]:_0x4bc910[_0xe799('0x15')]+_0x4bc910[_0xe799('0x17')];var _0x2f3ebf;if(_0x1677dc>=_0x27c4cf){_0x1677dc=_0x27c4cf;_0x2f3ebf=0xc8;}else{_0x2f3ebf=0xce;}_0x10def2['status'](_0x2f3ebf);return _0x10def2['set']('Content-Range',_0x2c05bb+'-'+_0x1677dc+'/'+_0x27c4cf)[_0xe799('0x14')](_0x34ddb8);}return null;};}function saveUpdates(_0x5074fd){return function(_0x325ee1){if(_0x325ee1){return _0x325ee1[_0xe799('0x19')](_0x5074fd)[_0xe799('0x8')](function(_0x5f454b){return _0x5f454b;});}return null;};}function removeEntity(_0x5d2d9d){return function(_0x3de31e){if(_0x3de31e){return _0x3de31e[_0xe799('0x1a')]()['then'](function(){_0x5d2d9d[_0xe799('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fa3c3){return function(_0x47a33d){if(!_0x47a33d){_0x1fa3c3[_0xe799('0x1b')](0x194);}return _0x47a33d;};}function handleError(_0x157419,_0x2668c4){_0x2668c4=_0x2668c4||0x1f4;return function(_0x34d255){logger[_0xe799('0xe')](_0x34d255[_0xe799('0x1c')]);if(_0x34d255[_0xe799('0x1d')]){delete _0x34d255[_0xe799('0x1d')];}_0x157419[_0xe799('0x13')](_0x2668c4)[_0xe799('0x1e')](_0x34d255);};}exports[_0xe799('0x1f')]=function(_0x247cec,_0x907b65){var _0x50414d={},_0x49b7e6={},_0x143c42={'count':0x0,'rows':[]};var _0x77c3aa=_[_0xe799('0x20')](db['Network'][_0xe799('0x21')],function(_0x2bffff){return{'name':_0x2bffff[_0xe799('0x22')],'type':_0x2bffff[_0xe799('0x23')][_0xe799('0x24')]};});_0x49b7e6[_0xe799('0x25')]=_[_0xe799('0x20')](_0x77c3aa,_0xe799('0x1d'));_0x49b7e6[_0xe799('0x26')]=_['keys'](_0x247cec['query']);_0x49b7e6['filters']=_['intersection'](_0x49b7e6[_0xe799('0x25')],_0x49b7e6[_0xe799('0x26')]);_0x50414d[_0xe799('0x27')]=_[_0xe799('0x28')](_0x49b7e6[_0xe799('0x25')],qs[_0xe799('0x29')](_0x247cec[_0xe799('0x26')]['fields']));_0x50414d[_0xe799('0x27')]=_0x50414d['attributes'][_0xe799('0x2a')]?_0x50414d[_0xe799('0x27')]:_0x49b7e6[_0xe799('0x25')];if(!_0x247cec[_0xe799('0x26')][_0xe799('0x2b')](_0xe799('0x2c'))){_0x50414d[_0xe799('0x17')]=qs['limit'](_0x247cec['query']['limit']);_0x50414d[_0xe799('0x15')]=qs[_0xe799('0x15')](_0x247cec['query'][_0xe799('0x15')]);}_0x50414d[_0xe799('0x2d')]=qs['sort'](_0x247cec['query']['sort']);_0x50414d['where']=qs['filters'](_[_0xe799('0x2e')](_0x247cec[_0xe799('0x26')],_0x49b7e6[_0xe799('0x2f')]),_0x77c3aa);if(_0x247cec['query'][_0xe799('0x30')]){_0x50414d['where']=_['merge'](_0x50414d[_0xe799('0x31')],{'$or':_['map'](_0x77c3aa,function(_0x5372fc){if(_0x5372fc['type']!==_0xe799('0x32')){var _0x52e670={};_0x52e670[_0x5372fc[_0xe799('0x1d')]]={'$like':'%'+_0x247cec[_0xe799('0x26')][_0xe799('0x30')]+'%'};return _0x52e670;}})});}_0x50414d=_[_0xe799('0x33')]({},_0x50414d,_0x247cec['options']);var _0x43f182={'where':_0x50414d[_0xe799('0x31')]};return db[_0xe799('0x34')][_0xe799('0x18')](_0x43f182)['then'](function(_0x678087){_0x143c42[_0xe799('0x18')]=_0x678087;if(_0x247cec['query'][_0xe799('0x35')]){_0x50414d[_0xe799('0x36')]=[{'all':!![]}];}return db[_0xe799('0x34')]['findAll'](_0x50414d);})[_0xe799('0x8')](function(_0x162693){_0x143c42['rows']=_0x162693;return _0x143c42;})[_0xe799('0x8')](respondWithFilteredResult(_0x907b65,_0x50414d))[_0xe799('0x12')](handleError(_0x907b65,null));};exports[_0xe799('0x37')]=function(_0xe69ccc,_0x353f65){var _0x3921e1={'raw':!![],'where':{'id':_0xe69ccc[_0xe799('0x38')]['id']}},_0x2a2fd3={};_0x2a2fd3[_0xe799('0x25')]=_[_0xe799('0x39')](db['Network']['rawAttributes']);_0x2a2fd3[_0xe799('0x26')]=_[_0xe799('0x39')](_0xe69ccc[_0xe799('0x26')]);_0x2a2fd3[_0xe799('0x2f')]=_[_0xe799('0x28')](_0x2a2fd3[_0xe799('0x25')],_0x2a2fd3[_0xe799('0x26')]);_0x3921e1[_0xe799('0x27')]=_[_0xe799('0x28')](_0x2a2fd3[_0xe799('0x25')],qs['fields'](_0xe69ccc[_0xe799('0x26')][_0xe799('0x29')]));_0x3921e1['attributes']=_0x3921e1[_0xe799('0x27')][_0xe799('0x2a')]?_0x3921e1[_0xe799('0x27')]:_0x2a2fd3[_0xe799('0x25')];if(_0xe69ccc['query']['includeAll']){_0x3921e1['include']=[{'all':!![]}];}_0x3921e1=_[_0xe799('0x33')]({},_0x3921e1,_0xe69ccc[_0xe799('0x3a')]);return db['Network']['find'](_0x3921e1)[_0xe799('0x8')](handleEntityNotFound(_0x353f65,null))[_0xe799('0x8')](respondWithResult(_0x353f65,null))[_0xe799('0x12')](handleError(_0x353f65,null));};exports['create']=function(_0x27b1cd,_0x57a96d){var _0x5d453f;return db[_0xe799('0x34')]['create'](_0x27b1cd[_0xe799('0x3b')],{'raw':!![]})[_0xe799('0x8')](function(_0x5b0909){_0x5d453f=_0x5b0909;return db[_0xe799('0x34')]['findAll']({'where':{'type':_0x27b1cd['body'][_0xe799('0x23')]},'raw':!![]});})['then'](function(_0x351900){if(_0x5d453f[_0xe799('0x23')][_0xe799('0x3c')]()=='STUN'){var _0x13bea3=fs[_0xe799('0x3d')](path['join'](config['root'],_0xe799('0x3e')),_0xe799('0x3f'));var _0x58abf9=ejs[_0xe799('0x40')](_0x13bea3,{'networks':_0x351900||[]});fs[_0xe799('0x41')](_0xe799('0x42'),_0x58abf9);return respondWithRpcPromise(_0xe799('0x43'),_0xe799('0x44'),{'module':'res_stun_monitor.so'});}else if(_0x5d453f[_0xe799('0x23')][_0xe799('0x3c')]()==_0xe799('0x45')){var _0x1fa792=fs[_0xe799('0x3d')](path['join'](config[_0xe799('0x46')],'server/files/templates/turn_multiple.ejs'),_0xe799('0x3f'));var _0x576d6d=ejs[_0xe799('0x40')](_0x1fa792,{'networks':_0x351900||[]});fs[_0xe799('0x41')](_0xe799('0x47'),_0x576d6d);return respondWithRpcPromise(_0xe799('0x43'),_0xe799('0x44'),{'module':_0xe799('0x48')});}else{var _0x11fbb0=fs[_0xe799('0x3d')](path[_0xe799('0x49')](config[_0xe799('0x46')],_0xe799('0x4a')),_0xe799('0x3f'));var _0x32d4f7=ejs['render'](_0x11fbb0,{'networks':_0x351900||[]});fs['writeFileSync'](util[_0xe799('0x4b')](_0xe799('0x4c'),_0x27b1cd[_0xe799('0x3b')][_0xe799('0x23')][_0xe799('0x4d')]()),_0x32d4f7);return respondWithRpcPromise('Reload',_0xe799('0x44'),{'module':'chan_sip.so'});}})[_0xe799('0x8')](function(){return _0x5d453f;})[_0xe799('0x8')](respondWithResult(_0x57a96d,0xc9))[_0xe799('0x12')](handleError(_0x57a96d,null));};exports['update']=function(_0x54260f,_0x49602e){var _0x10abb7;return db[_0xe799('0x34')][_0xe799('0x4e')]({'where':{'id':_0x54260f[_0xe799('0x38')]['id']}})[_0xe799('0x8')](handleEntityNotFound(_0x49602e,null))[_0xe799('0x8')](saveUpdates(_0x54260f[_0xe799('0x3b')],null))[_0xe799('0x8')](function(_0x222398){if(_0x222398){_0x10abb7=_0x222398;return db[_0xe799('0x34')][_0xe799('0x4f')]({'where':{'type':_0x10abb7[_0xe799('0x23')]},'raw':!![]});}return null;})[_0xe799('0x8')](function(_0x5349ea){if(_0x10abb7[_0xe799('0x23')][_0xe799('0x3c')]()=='STUN'){var _0x4c391e=fs[_0xe799('0x3d')](path[_0xe799('0x49')](config[_0xe799('0x46')],_0xe799('0x3e')),_0xe799('0x3f'));var _0x4520d1=ejs['render'](_0x4c391e,{'networks':_0x5349ea||[]});fs[_0xe799('0x41')](_0xe799('0x42'),_0x4520d1);return respondWithRpcPromise('Reload',_0xe799('0x19'),{'module':_0xe799('0x48')});}else if(_0x10abb7[_0xe799('0x23')][_0xe799('0x3c')]()==_0xe799('0x45')){var _0x3688e2=fs[_0xe799('0x3d')](path[_0xe799('0x49')](config[_0xe799('0x46')],_0xe799('0x50')),_0xe799('0x3f'));var _0x6bc7c3=ejs[_0xe799('0x40')](_0x3688e2,{'networks':_0x5349ea||[]});fs[_0xe799('0x41')]('/etc/asterisk/turn_xcally.conf',_0x6bc7c3);return respondWithRpcPromise(_0xe799('0x43'),_0xe799('0x19'),{'module':_0xe799('0x48')});}else{var _0x2e3c3d=fs['readFileSync'](path['join'](config['root'],_0xe799('0x4a')),'utf8');var _0x3ac454=ejs[_0xe799('0x40')](_0x2e3c3d,{'networks':_0x5349ea||[]});fs[_0xe799('0x41')](util[_0xe799('0x4b')](_0xe799('0x4c'),_0x54260f[_0xe799('0x3b')][_0xe799('0x23')][_0xe799('0x4d')]()),_0x3ac454);return respondWithRpcPromise(_0xe799('0x43'),_0xe799('0x19'),{'module':_0xe799('0x51')});}})['then'](function(_0x100863){if(_0x100863){return _0x10abb7;}return null;})[_0xe799('0x8')](respondWithResult(_0x49602e,null))[_0xe799('0x12')](handleError(_0x49602e,null));};exports['destroy']=function(_0x6cc937,_0x3bdef6){var _0x3f2e66;return db['Network'][_0xe799('0x4e')]({'where':{'id':_0x6cc937[_0xe799('0x38')]['id']}})[_0xe799('0x8')](function(_0x12b30d){_0x3f2e66=_0x12b30d;return _0x12b30d;})[_0xe799('0x8')](handleEntityNotFound(_0x3bdef6,null))[_0xe799('0x8')](removeEntity(_0x3bdef6,null))[_0xe799('0x8')](function(){if(_0x3f2e66){return db['Network'][_0xe799('0x4f')]({'where':{'type':_0x3f2e66[_0xe799('0x23')]},'raw':!![]});}})[_0xe799('0x8')](function(_0x2e4376){if(_0x3f2e66[_0xe799('0x23')][_0xe799('0x3c')]()=='STUN'){var _0x2d218c=fs[_0xe799('0x3d')](path['join'](config[_0xe799('0x46')],'server/files/templates/stun_multiple.ejs'),_0xe799('0x3f'));var _0x24d34d=ejs[_0xe799('0x40')](_0x2d218c,{'networks':_0x2e4376||[]});fs['writeFileSync'](_0xe799('0x42'),_0x24d34d);return respondWithRpcPromise(_0xe799('0x43'),_0xe799('0x1a'),{'module':'res_stun_monitor.so'});}else if(_0x3f2e66[_0xe799('0x23')][_0xe799('0x3c')]()==_0xe799('0x45')){var _0x10ae82=fs[_0xe799('0x3d')](path[_0xe799('0x49')](config[_0xe799('0x46')],'server/files/templates/turn_multiple.ejs'),_0xe799('0x3f'));var _0x3baa2c=ejs['render'](_0x10ae82,{'networks':_0x2e4376||[]});fs[_0xe799('0x41')](_0xe799('0x47'),_0x3baa2c);return respondWithRpcPromise('Reload',_0xe799('0x1a'),{'module':_0xe799('0x48')});}else{var _0x4a7e9c=fs[_0xe799('0x3d')](path['join'](config[_0xe799('0x46')],'server/files/templates/network.ejs'),'utf8');var _0xefd3c3=ejs[_0xe799('0x40')](_0x4a7e9c,{'networks':_0x2e4376||[]});fs[_0xe799('0x41')](util[_0xe799('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x3f2e66[_0xe799('0x23')]['toLowerCase']()),_0xefd3c3);return respondWithRpcPromise(_0xe799('0x43'),_0xe799('0x1a'),{'module':_0xe799('0x51')});}})[_0xe799('0x12')](handleError(_0x3bdef6,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b3bd2d2..8edf0cd 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 _0x5b02=['define','Network','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x57a186,_0x57142a){var _0x3a6323=function(_0x2801d4){while(--_0x2801d4){_0x57a186['push'](_0x57a186['shift']());}};_0x3a6323(++_0x57142a);}(_0x5b02,0xe9));var _0x25b0=function(_0x3086bc,_0x58d580){_0x3086bc=_0x3086bc-0x0;var _0x277998=_0x5b02[_0x3086bc];return _0x277998;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd382=['request-promise','path','rimraf','../../config/environment','define','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd382,0x1b6));var _0x2d38=function(_0x5b3193,_0x4e9ba6){_0x5b3193=_0x5b3193-0x0;var _0x4d2687=_0xd382[_0x5b3193];return _0x4d2687;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))(_0x2d38('0x3'));var moment=require(_0x2d38('0x4'));var BPromise=require(_0x2d38('0x5'));var rp=require(_0x2d38('0x6'));var fs=require('fs');var path=require(_0x2d38('0x7'));var rimraf=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x5a8219,_0x30106c){return _0x5a8219[_0x2d38('0xa')]('Network',attributes,{'tableName':_0x2d38('0xb'),'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 67fc872..6ec25fb 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(_0x41bf8d,_0x1e01b4){var _0x5e14d8=function(_0xc1d438){while(--_0xc1d438){_0x41bf8d['push'](_0x41bf8d['shift']());}};_0x5e14d8(++_0x1e01b4);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0xb33b93,_0x7b67a){_0xb33b93=_0xb33b93-0x0;var _0x1cc0d2=_0x7a54[_0xb33b93];return _0x1cc0d2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ffe1272..d874278 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 _0x4955=['/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions'];(function(_0x1ec2c1,_0x505a52){var _0x2d1f9e=function(_0x1e78c7){while(--_0x1e78c7){_0x1ec2c1['push'](_0x1ec2c1['shift']());}};_0x2d1f9e(++_0x505a52);}(_0x4955,0xb3));var _0x5495=function(_0x58d808,_0x5e605d){_0x58d808=_0x58d808-0x0;var _0x3c9f9d=_0x4955[_0x58d808];return _0x3c9f9d;};'use strict';var multer=require(_0x5495('0x0'));var util=require('util');var path=require(_0x5495('0x1'));var timeout=require('connect-timeout');var express=require(_0x5495('0x2'));var router=express[_0x5495('0x3')]();var fs_extra=require(_0x5495('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5495('0x5'));var config=require(_0x5495('0x6'));var controller=require(_0x5495('0x7'));router[_0x5495('0x8')]('/',auth[_0x5495('0x9')](),controller[_0x5495('0xa')]);router[_0x5495('0x8')](_0x5495('0xb'),auth[_0x5495('0x9')](),controller[_0x5495('0xc')]);router[_0x5495('0x8')]('/:id',auth[_0x5495('0x9')](),controller[_0x5495('0xd')]);router[_0x5495('0x8')](_0x5495('0xe'),auth[_0x5495('0x9')](),controller[_0x5495('0xf')]);router['get'](_0x5495('0x10'),auth[_0x5495('0x9')](),controller[_0x5495('0x11')]);router[_0x5495('0x8')]('/:id/applications',auth[_0x5495('0x9')](),controller[_0x5495('0x12')]);router[_0x5495('0x8')](_0x5495('0x13'),auth['isAuthenticated'](),controller[_0x5495('0x14')]);router[_0x5495('0x8')](_0x5495('0x15'),auth[_0x5495('0x9')](),controller[_0x5495('0x16')]);router[_0x5495('0x17')]('/',auth[_0x5495('0x9')](),controller[_0x5495('0x18')]);router['post'](_0x5495('0xe'),auth[_0x5495('0x9')](),controller[_0x5495('0x19')]);router['post']('/:id/canned_answers',auth[_0x5495('0x9')](),controller[_0x5495('0x1a')]);router[_0x5495('0x17')](_0x5495('0x1b'),controller[_0x5495('0x1c')]);router['post'](_0x5495('0x1d'),auth[_0x5495('0x9')](),controller['addApplications']);router['post'](_0x5495('0x15'),auth[_0x5495('0x9')](),controller['addAgents']);router['post'](_0x5495('0x1e'),auth[_0x5495('0x9')](),controller[_0x5495('0x1f')]);router[_0x5495('0x20')](_0x5495('0x21'),auth['isAuthenticated'](),controller[_0x5495('0x22')]);router[_0x5495('0x23')](_0x5495('0x21'),auth[_0x5495('0x9')](),controller[_0x5495('0x24')]);router[_0x5495('0x23')]('/:id/dispositions',auth[_0x5495('0x9')](),controller['removeDispositions']);router['delete'](_0x5495('0x10'),auth[_0x5495('0x9')](),controller[_0x5495('0x25')]);router[_0x5495('0x23')](_0x5495('0x15'),auth[_0x5495('0x9')](),controller[_0x5495('0x26')]);module[_0x5495('0x27')]=router; \ No newline at end of file +var _0x60ca=['../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x315f08,_0x868d9b){var _0x183d0b=function(_0x538592){while(--_0x538592){_0x315f08['push'](_0x315f08['shift']());}};_0x183d0b(++_0x868d9b);}(_0x60ca,0xae));var _0xa60c=function(_0x58491e,_0x17a969){_0x58491e=_0x58491e-0x0;var _0x31b99a=_0x60ca[_0x58491e];return _0x31b99a;};'use strict';var multer=require('multer');var util=require(_0xa60c('0x0'));var path=require(_0xa60c('0x1'));var timeout=require(_0xa60c('0x2'));var express=require(_0xa60c('0x3'));var router=express[_0xa60c('0x4')]();var fs_extra=require(_0xa60c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa60c('0x6'));var controller=require(_0xa60c('0x7'));router[_0xa60c('0x8')]('/',auth[_0xa60c('0x9')](),controller[_0xa60c('0xa')]);router[_0xa60c('0x8')]('/describe',auth[_0xa60c('0x9')](),controller[_0xa60c('0xb')]);router['get'](_0xa60c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa60c('0x8')](_0xa60c('0xd'),auth[_0xa60c('0x9')](),controller[_0xa60c('0xe')]);router[_0xa60c('0x8')](_0xa60c('0xf'),auth[_0xa60c('0x9')](),controller['getAnswers']);router[_0xa60c('0x8')](_0xa60c('0x10'),auth[_0xa60c('0x9')](),controller[_0xa60c('0x11')]);router[_0xa60c('0x8')](_0xa60c('0x12'),auth[_0xa60c('0x9')](),controller[_0xa60c('0x13')]);router[_0xa60c('0x8')](_0xa60c('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa60c('0x15')]('/',auth['isAuthenticated'](),controller[_0xa60c('0x16')]);router[_0xa60c('0x15')](_0xa60c('0xd'),auth[_0xa60c('0x9')](),controller[_0xa60c('0x17')]);router[_0xa60c('0x15')]('/:id/canned_answers',auth[_0xa60c('0x9')](),controller['addAnswer']);router[_0xa60c('0x15')](_0xa60c('0x18'),controller[_0xa60c('0x19')]);router[_0xa60c('0x15')](_0xa60c('0x10'),auth['isAuthenticated'](),controller[_0xa60c('0x1a')]);router[_0xa60c('0x15')](_0xa60c('0x14'),auth[_0xa60c('0x9')](),controller[_0xa60c('0x1b')]);router[_0xa60c('0x15')](_0xa60c('0x1c'),auth[_0xa60c('0x9')](),controller['send']);router[_0xa60c('0x1d')]('/:id',auth[_0xa60c('0x9')](),controller[_0xa60c('0x1e')]);router[_0xa60c('0x1f')]('/:id',auth[_0xa60c('0x9')](),controller[_0xa60c('0x20')]);router[_0xa60c('0x1f')](_0xa60c('0xd'),auth['isAuthenticated'](),controller[_0xa60c('0x21')]);router[_0xa60c('0x1f')](_0xa60c('0xf'),auth[_0xa60c('0x9')](),controller[_0xa60c('0x22')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xa60c('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index dcf57c2..9959cf6 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 _0xcbd9=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x259860,_0x21cc63){var _0x5d246f=function(_0x10d591){while(--_0x10d591){_0x259860['push'](_0x259860['shift']());}};_0x5d246f(++_0x21cc63);}(_0xcbd9,0xd8));var _0x9cbd=function(_0x1258e1,_0x720726){_0x1258e1=_0x1258e1-0x0;var _0x587af7=_0xcbd9[_0x1258e1];return _0x587af7;};'use strict';var Sequelize=require(_0x9cbd('0x0'));var rs=require(_0x9cbd('0x1'));module[_0x9cbd('0x2')]={'name':{'type':Sequelize[_0x9cbd('0x3')],'unique':_0x9cbd('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x9cbd('0x3')],'defaultValue':function(){return rs[_0x9cbd('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9cbd('0x6')],'defaultValue':function(){return _0x9cbd('0x7');}},'notificationSound':{'type':Sequelize[_0x9cbd('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9cbd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9cbd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9cbd('0x3')]},'queueTransfer':{'type':Sequelize[_0x9cbd('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9cbd('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9cbd('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9cbd('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x9cbd('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x9cbd('0x8')],'defaultValue':![],'comment':_0x9cbd('0xb'),'set':function(_0x5c9720){if(!_0x5c9720)this[_0x9cbd('0xc')](_0x9cbd('0xd'),null);this['setDataValue'](_0x9cbd('0xe'),_0x5c9720);}}}; \ No newline at end of file +var _0x59c7=['randomstring','exports','name','STRING','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x59c7,0x6b));var _0x759c=function(_0x784a26,_0x1c5dd6){_0x784a26=_0x784a26-0x0;var _0x31d14d=_0x59c7[_0x784a26];return _0x31d14d;};'use strict';var Sequelize=require(_0x759c('0x0'));var rs=require(_0x759c('0x1'));module[_0x759c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x759c('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x759c('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x759c('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x759c('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x759c('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x759c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x759c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x759c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x759c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x759c('0x4')]},'queueTransfer':{'type':Sequelize[_0x759c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x759c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x759c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x759c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x759c('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x9666b8){if(!_0x9666b8)this['setDataValue'](_0x759c('0x9'),null);this[_0x759c('0xa')](_0x759c('0xb'),_0x9666b8);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f788410..089530d 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 _0xcf71=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','sendStatus','stack','name','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','updatedAt','OpenchannelApplication','List','account','applications','Applications','list','orderBy','priority','asc','Contacts','defaults','CmContact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','send','getApplications','internal','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x1244cb,_0x2aa242){var _0x1746d1=function(_0x2ae275){while(--_0x2ae275){_0x1244cb['push'](_0x1244cb['shift']());}};_0x1746d1(++_0x2aa242);}(_0xcf71,0xba));var _0x1cf7=function(_0x25bc3d,_0x19ad33){_0x25bc3d=_0x25bc3d-0x0;var _0x3c5aa9=_0xcf71[_0x25bc3d];return _0x3c5aa9;};'use strict';var emlformat=require(_0x1cf7('0x0'));var rimraf=require(_0x1cf7('0x1'));var zipdir=require(_0x1cf7('0x2'));var jsonpatch=require(_0x1cf7('0x3'));var rp=require('request-promise');var moment=require(_0x1cf7('0x4'));var BPromise=require(_0x1cf7('0x5'));var Mustache=require(_0x1cf7('0x6'));var util=require(_0x1cf7('0x7'));var path=require(_0x1cf7('0x8'));var sox=require(_0x1cf7('0x9'));var csv=require(_0x1cf7('0xa'));var ejs=require(_0x1cf7('0xb'));var fs=require('fs');var fs_extra=require(_0x1cf7('0xc'));var _=require(_0x1cf7('0xd'));var squel=require(_0x1cf7('0xe'));var crypto=require(_0x1cf7('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1cf7('0xa'));var querystring=require(_0x1cf7('0x10'));var Papa=require(_0x1cf7('0x11'));var Redis=require('ioredis');var authService=require(_0x1cf7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1cf7('0x13'));var logger=require(_0x1cf7('0x14'))(_0x1cf7('0x15'));var utils=require(_0x1cf7('0x16'));var config=require(_0x1cf7('0x17'));var licenseUtil=require(_0x1cf7('0x18'));var db=require('../../mysqldb')['db'];config[_0x1cf7('0x19')]=_['defaults'](config[_0x1cf7('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1cf7('0x1a'))(new Redis(config[_0x1cf7('0x19')]));require('./openchannelAccount.socket')[_0x1cf7('0x1b')](socket);var jayson=require(_0x1cf7('0x1c'));var client=jayson[_0x1cf7('0x1d')][_0x1cf7('0x1e')]({'port':0x232c});var client9002=jayson[_0x1cf7('0x1d')][_0x1cf7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x769ee3,_0x172915,_0x17cec6,_0x36653f){return new BPromise(function(_0x2a3671,_0x148f07){var _0x3f762b=_0x36653f||client;return _0x3f762b['request'](_0x769ee3,_0x17cec6)[_0x1cf7('0x1f')](function(_0x1a8a23){logger[_0x1cf7('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x172915,_0x1cf7('0x21'));logger[_0x1cf7('0x22')](_0x1cf7('0x23'),_0x172915,'request\x20sent',JSON[_0x1cf7('0x24')](_0x1a8a23));if(_0x1a8a23[_0x1cf7('0x25')]){if(_0x1a8a23[_0x1cf7('0x25')][_0x1cf7('0x26')]===0x1f4){logger[_0x1cf7('0x25')](_0x1cf7('0x27'),_0x172915,_0x1a8a23[_0x1cf7('0x25')][_0x1cf7('0x28')]);return _0x148f07(_0x1a8a23[_0x1cf7('0x25')][_0x1cf7('0x28')]);}logger['error'](_0x1cf7('0x27'),_0x172915,_0x1a8a23[_0x1cf7('0x25')][_0x1cf7('0x28')]);return _0x2a3671(_0x1a8a23[_0x1cf7('0x25')][_0x1cf7('0x28')]);}else{logger[_0x1cf7('0x20')](_0x1cf7('0x27'),_0x172915,_0x1cf7('0x21'));_0x2a3671(_0x1a8a23['result']['message']);}})['catch'](function(_0x3af3e8){logger['error'](_0x1cf7('0x27'),_0x172915,_0x3af3e8);_0x148f07(_0x3af3e8);});});}function respondWithStatusCode(_0x45add9,_0x3db370){_0x3db370=_0x3db370||0xcc;return function(_0x1ce3ae){if(_0x1ce3ae){return _0x45add9['sendStatus'](_0x3db370);}return _0x45add9['status'](_0x3db370)[_0x1cf7('0x29')]();};}function respondWithResult(_0x4273de,_0x1a9b20){_0x1a9b20=_0x1a9b20||0xc8;return function(_0x43b316){if(_0x43b316){return _0x4273de[_0x1cf7('0x2a')](_0x1a9b20)[_0x1cf7('0x2b')](_0x43b316);}};}function respondWithFilteredResult(_0x131e8b,_0x5e2047){return function(_0x125c48){if(_0x125c48){var _0x5c6fee=typeof _0x5e2047[_0x1cf7('0x2c')]===_0x1cf7('0x2d')&&typeof _0x5e2047[_0x1cf7('0x2e')]===_0x1cf7('0x2d');var _0x3c56a1=_0x125c48[_0x1cf7('0x2f')];var _0x369a35=_0x5c6fee?0x0:_0x5e2047[_0x1cf7('0x2c')];var _0x5754e8=_0x5c6fee?_0x125c48['count']:_0x5e2047[_0x1cf7('0x2c')]+_0x5e2047[_0x1cf7('0x2e')];var _0x290539;if(_0x5754e8>=_0x3c56a1){_0x5754e8=_0x3c56a1;_0x290539=0xc8;}else{_0x290539=0xce;}_0x131e8b[_0x1cf7('0x2a')](_0x290539);return _0x131e8b[_0x1cf7('0x30')]('Content-Range',_0x369a35+'-'+_0x5754e8+'/'+_0x3c56a1)[_0x1cf7('0x2b')](_0x125c48);}return null;};}function patchUpdates(_0x5d33b1){return function(_0x38add7){try{jsonpatch[_0x1cf7('0x31')](_0x38add7,_0x5d33b1,!![]);}catch(_0x5dd929){return BPromise[_0x1cf7('0x32')](_0x5dd929);}return _0x38add7[_0x1cf7('0x33')]();};}function saveUpdates(_0x29a731,_0x3f3aa7){return function(_0xbdfa9c){if(_0xbdfa9c){return _0xbdfa9c[_0x1cf7('0x34')](_0x29a731)['then'](function(_0xa8a129){return _0xa8a129;});}return null;};}function removeEntity(_0x51a962,_0x5aa6ed){return function(_0x3f634c){if(_0x3f634c){return _0x3f634c[_0x1cf7('0x35')]()[_0x1cf7('0x1f')](function(){var _0x302f02=_0x3f634c[_0x1cf7('0x36')]({'plain':!![]});var _0x4017c6='OpenchannelAccounts';return db['UserProfileResource'][_0x1cf7('0x35')]({'where':{'type':_0x4017c6,'resourceId':_0x302f02['id']}})[_0x1cf7('0x1f')](function(){return _0x3f634c;});})[_0x1cf7('0x1f')](function(){_0x51a962[_0x1cf7('0x2a')](0xcc)[_0x1cf7('0x29')]();});}};}function handleEntityNotFound(_0x429713,_0x4536d8){return function(_0xb39bbf){if(!_0xb39bbf){_0x429713[_0x1cf7('0x37')](0x194);}return _0xb39bbf;};}function handleError(_0x4212c1,_0x5afa86){_0x5afa86=_0x5afa86||0x1f4;return function(_0x43035d){logger['error'](_0x43035d[_0x1cf7('0x38')]);if(_0x43035d[_0x1cf7('0x39')]){delete _0x43035d['name'];}_0x4212c1['status'](_0x5afa86)['send'](_0x43035d);};}exports['index']=function(_0x233a3c,_0x197497){var _0x359d9d={'include':[{'model':db[_0x1cf7('0x3a')],'as':_0x1cf7('0x3b')}]},_0x301837={},_0x104204={'count':0x0,'rows':[]};var _0x7cfd70=_['map'](db[_0x1cf7('0x3c')][_0x1cf7('0x3d')],function(_0x3986cb){return{'name':_0x3986cb[_0x1cf7('0x3e')],'type':_0x3986cb[_0x1cf7('0x3f')][_0x1cf7('0x40')]};});_0x301837[_0x1cf7('0x41')]=_[_0x1cf7('0x42')](_0x7cfd70,_0x1cf7('0x39'));_0x301837[_0x1cf7('0x43')]=_[_0x1cf7('0x44')](_0x233a3c[_0x1cf7('0x43')]);_0x301837[_0x1cf7('0x45')]=_['intersection'](_0x301837[_0x1cf7('0x41')],_0x301837[_0x1cf7('0x43')]);_0x359d9d[_0x1cf7('0x46')]=_[_0x1cf7('0x47')](_0x301837['model'],qs[_0x1cf7('0x48')](_0x233a3c['query'][_0x1cf7('0x48')]));_0x359d9d[_0x1cf7('0x46')]=_0x359d9d[_0x1cf7('0x46')][_0x1cf7('0x49')]?_0x359d9d[_0x1cf7('0x46')]:_0x301837[_0x1cf7('0x41')];if(!_0x233a3c[_0x1cf7('0x43')][_0x1cf7('0x4a')]('nolimit')){_0x359d9d[_0x1cf7('0x2e')]=qs[_0x1cf7('0x2e')](_0x233a3c[_0x1cf7('0x43')][_0x1cf7('0x2e')]);_0x359d9d[_0x1cf7('0x2c')]=qs[_0x1cf7('0x2c')](_0x233a3c[_0x1cf7('0x43')][_0x1cf7('0x2c')]);}_0x359d9d[_0x1cf7('0x4b')]=qs['sort'](_0x233a3c[_0x1cf7('0x43')][_0x1cf7('0x4c')]);_0x359d9d[_0x1cf7('0x4d')]=qs['filters'](_[_0x1cf7('0x4e')](_0x233a3c[_0x1cf7('0x43')],_0x301837[_0x1cf7('0x45')]),_0x7cfd70);if(_0x233a3c[_0x1cf7('0x43')][_0x1cf7('0x4f')]){_0x359d9d[_0x1cf7('0x4d')]=_[_0x1cf7('0x50')](_0x359d9d[_0x1cf7('0x4d')],{'$or':_['map'](_0x7cfd70,function(_0x296e94){if(_0x296e94[_0x1cf7('0x3f')]!==_0x1cf7('0x51')){var _0x2885b0={};_0x2885b0[_0x296e94[_0x1cf7('0x39')]]={'$like':'%'+_0x233a3c[_0x1cf7('0x43')][_0x1cf7('0x4f')]+'%'};return _0x2885b0;}})});}_0x359d9d=_[_0x1cf7('0x50')]({},_0x359d9d,_0x233a3c[_0x1cf7('0x52')]);var _0x4f27fc={'where':_0x359d9d[_0x1cf7('0x4d')]};return db[_0x1cf7('0x3c')]['count'](_0x4f27fc)[_0x1cf7('0x1f')](function(_0x2087fe){_0x104204[_0x1cf7('0x2f')]=_0x2087fe;if(_0x233a3c[_0x1cf7('0x43')][_0x1cf7('0x53')]){_0x359d9d[_0x1cf7('0x54')]=[{'all':!![]}];}return db[_0x1cf7('0x3c')][_0x1cf7('0x55')](_0x359d9d);})['then'](function(_0x4c291c){_0x104204[_0x1cf7('0x56')]=_0x4c291c;return _0x104204;})[_0x1cf7('0x1f')](respondWithFilteredResult(_0x197497,_0x359d9d))[_0x1cf7('0x57')](handleError(_0x197497,null));};exports[_0x1cf7('0x58')]=function(_0x3e5be8,_0xf963a3){var _0x31d078={'raw':![],'where':{'id':_0x3e5be8[_0x1cf7('0x59')]['id']},'include':[{'model':db[_0x1cf7('0x3a')],'as':_0x1cf7('0x3b')}]},_0x17b51b={};_0x17b51b[_0x1cf7('0x41')]=_[_0x1cf7('0x44')](db[_0x1cf7('0x3c')]['rawAttributes']);_0x17b51b[_0x1cf7('0x43')]=_[_0x1cf7('0x44')](_0x3e5be8['query']);_0x17b51b[_0x1cf7('0x45')]=_[_0x1cf7('0x47')](_0x17b51b[_0x1cf7('0x41')],_0x17b51b[_0x1cf7('0x43')]);_0x31d078['attributes']=_[_0x1cf7('0x47')](_0x17b51b[_0x1cf7('0x41')],qs[_0x1cf7('0x48')](_0x3e5be8['query']['fields']));_0x31d078[_0x1cf7('0x46')]=_0x31d078[_0x1cf7('0x46')][_0x1cf7('0x49')]?_0x31d078[_0x1cf7('0x46')]:_0x17b51b[_0x1cf7('0x41')];if(_0x3e5be8[_0x1cf7('0x43')][_0x1cf7('0x53')]){_0x31d078['include']=[{'all':!![]}];}_0x31d078=_[_0x1cf7('0x50')]({},_0x31d078,_0x3e5be8['options']);return db[_0x1cf7('0x3c')][_0x1cf7('0x5a')](_0x31d078)['then'](handleEntityNotFound(_0xf963a3,null))[_0x1cf7('0x1f')](respondWithResult(_0xf963a3,null))[_0x1cf7('0x57')](handleError(_0xf963a3,null));};exports[_0x1cf7('0x5b')]=function(_0x1da8aa,_0x551b8c){return db[_0x1cf7('0x3c')][_0x1cf7('0x5b')](_0x1da8aa[_0x1cf7('0x5c')],{})[_0x1cf7('0x1f')](function(_0x4c515e){var _0x24850c=_0x1da8aa[_0x1cf7('0x5d')][_0x1cf7('0x36')]({'plain':!![]});if(!_0x24850c)throw new Error(_0x1cf7('0x5e'));if(_0x24850c[_0x1cf7('0x5f')]==='user'){var _0x42084c=_0x4c515e[_0x1cf7('0x36')]({'plain':!![]});var _0x55d0d7='OpenchannelAccounts';return db[_0x1cf7('0x60')]['find']({'where':{'name':_0x55d0d7,'userProfileId':_0x24850c[_0x1cf7('0x61')]},'raw':!![]})[_0x1cf7('0x1f')](function(_0x11a844){if(_0x11a844&&_0x11a844[_0x1cf7('0x62')]===0x0){return db['UserProfileResource'][_0x1cf7('0x5b')]({'name':_0x42084c[_0x1cf7('0x39')],'resourceId':_0x42084c['id'],'type':_0x11a844[_0x1cf7('0x39')],'sectionId':_0x11a844['id']},{})[_0x1cf7('0x1f')](function(){return _0x4c515e;});}else{return _0x4c515e;}})[_0x1cf7('0x57')](function(_0x2b76f5){logger[_0x1cf7('0x25')](_0x1cf7('0x63'),_0x2b76f5);throw _0x2b76f5;});}return _0x4c515e;})[_0x1cf7('0x1f')](respondWithResult(_0x551b8c,0xc9))[_0x1cf7('0x57')](handleError(_0x551b8c,null));};exports['update']=function(_0x53833a,_0x4adacb){if(_0x53833a[_0x1cf7('0x5c')]['id']){delete _0x53833a[_0x1cf7('0x5c')]['id'];}return db[_0x1cf7('0x3c')][_0x1cf7('0x5a')]({'where':{'id':_0x53833a[_0x1cf7('0x59')]['id']},'include':[{'model':db[_0x1cf7('0x3a')],'as':_0x1cf7('0x3b')}]})[_0x1cf7('0x1f')](handleEntityNotFound(_0x4adacb,null))[_0x1cf7('0x1f')](saveUpdates(_0x53833a['body'],null))[_0x1cf7('0x1f')](respondWithResult(_0x4adacb,null))['catch'](handleError(_0x4adacb,null));};exports[_0x1cf7('0x35')]=function(_0x4b08e6,_0xc3f899){return db[_0x1cf7('0x3c')]['find']({'where':{'id':_0x4b08e6[_0x1cf7('0x59')]['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0xc3f899,null))['then'](removeEntity(_0xc3f899,null))[_0x1cf7('0x57')](handleError(_0xc3f899,null));};exports['describe']=function(_0x43329b,_0x2ff636){return db[_0x1cf7('0x3c')][_0x1cf7('0x64')]()['then'](respondWithResult(_0x2ff636,null))[_0x1cf7('0x57')](handleError(_0x2ff636,null));};exports[_0x1cf7('0x65')]=function(_0x190cf7,_0x5356a5,_0x559857){if(_0x190cf7[_0x1cf7('0x5c')]['id']){delete _0x190cf7[_0x1cf7('0x5c')]['id'];}return db[_0x1cf7('0x3c')][_0x1cf7('0x5a')]({'where':{'id':_0x190cf7[_0x1cf7('0x59')]['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x5356a5,null))[_0x1cf7('0x1f')](function(_0x5de5a8){if(_0x5de5a8){_0x190cf7[_0x1cf7('0x5c')][_0x1cf7('0x66')]=_0x5de5a8['id'];return db[_0x1cf7('0x67')][_0x1cf7('0x5b')](_0x190cf7[_0x1cf7('0x5c')]);}})[_0x1cf7('0x1f')](respondWithResult(_0x5356a5,null))[_0x1cf7('0x57')](handleError(_0x5356a5,null));};exports[_0x1cf7('0x68')]=function(_0x59d7f4,_0xe2da0,_0x5e551b){var _0x31d573={'raw':![],'where':{}};var _0x2675d2={};var _0x288b7c={'count':0x0,'rows':[]};return db[_0x1cf7('0x3c')]['findOne']({'where':{'id':_0x59d7f4['params']['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0xe2da0,null))[_0x1cf7('0x1f')](function(_0x1cdd0f){if(_0x1cdd0f){_0x2675d2[_0x1cf7('0x41')]=_['keys'](db[_0x1cf7('0x67')][_0x1cf7('0x3d')]);_0x2675d2[_0x1cf7('0x43')]=_[_0x1cf7('0x44')](_0x59d7f4[_0x1cf7('0x43')]);_0x2675d2[_0x1cf7('0x45')]=_['intersection'](_0x2675d2[_0x1cf7('0x41')],_0x2675d2['query']);_0x31d573[_0x1cf7('0x46')]=_[_0x1cf7('0x47')](_0x2675d2['model'],qs[_0x1cf7('0x48')](_0x59d7f4[_0x1cf7('0x43')][_0x1cf7('0x48')]));_0x31d573[_0x1cf7('0x46')]=_0x31d573[_0x1cf7('0x46')][_0x1cf7('0x49')]?_0x31d573[_0x1cf7('0x46')]:_0x2675d2[_0x1cf7('0x41')];if(!_0x59d7f4['query'][_0x1cf7('0x4a')](_0x1cf7('0x69'))){_0x31d573[_0x1cf7('0x2e')]=qs[_0x1cf7('0x2e')](_0x59d7f4[_0x1cf7('0x43')][_0x1cf7('0x2e')]);_0x31d573['offset']=qs[_0x1cf7('0x2c')](_0x59d7f4[_0x1cf7('0x43')]['offset']);}_0x31d573[_0x1cf7('0x4b')]=qs['sort'](_0x59d7f4[_0x1cf7('0x43')][_0x1cf7('0x4c')]);_0x31d573[_0x1cf7('0x4d')]=qs[_0x1cf7('0x45')](_[_0x1cf7('0x4e')](_0x59d7f4[_0x1cf7('0x43')],_0x2675d2['filters']));_0x31d573['where'][_0x1cf7('0x66')]=_0x1cdd0f['id'];if(_0x59d7f4['query'][_0x1cf7('0x4f')]){_0x31d573[_0x1cf7('0x4d')]=_[_0x1cf7('0x50')](_0x31d573[_0x1cf7('0x4d')],{'$or':_[_0x1cf7('0x42')](_0x31d573[_0x1cf7('0x46')],function(_0x18513d){var _0x1324cd={};_0x1324cd[_0x18513d]={'$like':'%'+_0x59d7f4[_0x1cf7('0x43')][_0x1cf7('0x4f')]+'%'};return _0x1324cd;})});}_0x31d573=_[_0x1cf7('0x50')]({},_0x31d573,_0x59d7f4[_0x1cf7('0x52')]);return db[_0x1cf7('0x67')][_0x1cf7('0x2f')]({'where':_0x31d573[_0x1cf7('0x4d')]})['then'](function(_0x371bc8){_0x288b7c[_0x1cf7('0x2f')]=_0x371bc8;if(_0x59d7f4[_0x1cf7('0x43')]['includeAll']){_0x31d573['include']=[{'all':!![]}];}return db[_0x1cf7('0x67')][_0x1cf7('0x55')](_0x31d573);})[_0x1cf7('0x1f')](function(_0x56f8d1){_0x288b7c['rows']=_0x56f8d1;return _0x288b7c;});}})['then'](respondWithFilteredResult(_0xe2da0,_0x31d573))[_0x1cf7('0x57')](handleError(_0xe2da0,null));};exports[_0x1cf7('0x6a')]=function(_0x178883,_0x1bb265,_0x210812){return db[_0x1cf7('0x3c')][_0x1cf7('0x5a')]({'where':{'id':_0x178883['params']['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x1bb265,null))['then'](function(_0x542079){if(_0x542079){return _0x542079[_0x1cf7('0x6a')](_0x178883['query'][_0x1cf7('0x6b')]);}})[_0x1cf7('0x1f')](respondWithStatusCode(_0x1bb265,null))[_0x1cf7('0x57')](handleError(_0x1bb265,null));};exports[_0x1cf7('0x6c')]=function(_0x321f1f,_0x36b6e5,_0x54b923){if(_0x321f1f[_0x1cf7('0x5c')]['id']){delete _0x321f1f[_0x1cf7('0x5c')]['id'];}return db[_0x1cf7('0x3c')][_0x1cf7('0x5a')]({'where':{'id':_0x321f1f[_0x1cf7('0x59')]['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x36b6e5,null))['then'](function(_0xc56e75){if(_0xc56e75){_0x321f1f[_0x1cf7('0x5c')][_0x1cf7('0x66')]=_0xc56e75['id'];return db[_0x1cf7('0x6d')][_0x1cf7('0x5b')](_0x321f1f[_0x1cf7('0x5c')]);}})['then'](respondWithResult(_0x36b6e5,null))[_0x1cf7('0x57')](handleError(_0x36b6e5,null));};exports['getAnswers']=function(_0x2abf2a,_0x5200b2,_0x15160c){var _0xb31af9={'raw':![],'where':{}};var _0x330a8a={};var _0x3359b6={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2abf2a[_0x1cf7('0x59')]['id']}})['then'](handleEntityNotFound(_0x5200b2,null))[_0x1cf7('0x1f')](function(_0x1fbdc3){if(_0x1fbdc3){_0x330a8a[_0x1cf7('0x41')]=_[_0x1cf7('0x44')](db[_0x1cf7('0x6d')][_0x1cf7('0x3d')]);_0x330a8a[_0x1cf7('0x43')]=_[_0x1cf7('0x44')](_0x2abf2a[_0x1cf7('0x43')]);_0x330a8a[_0x1cf7('0x45')]=_[_0x1cf7('0x47')](_0x330a8a[_0x1cf7('0x41')],_0x330a8a['query']);_0xb31af9[_0x1cf7('0x46')]=_[_0x1cf7('0x47')](_0x330a8a['model'],qs[_0x1cf7('0x48')](_0x2abf2a[_0x1cf7('0x43')][_0x1cf7('0x48')]));_0xb31af9[_0x1cf7('0x46')]=_0xb31af9[_0x1cf7('0x46')][_0x1cf7('0x49')]?_0xb31af9[_0x1cf7('0x46')]:_0x330a8a['model'];if(!_0x2abf2a[_0x1cf7('0x43')]['hasOwnProperty'](_0x1cf7('0x69'))){_0xb31af9[_0x1cf7('0x2e')]=qs['limit'](_0x2abf2a[_0x1cf7('0x43')]['limit']);_0xb31af9[_0x1cf7('0x2c')]=qs[_0x1cf7('0x2c')](_0x2abf2a[_0x1cf7('0x43')][_0x1cf7('0x2c')]);}_0xb31af9[_0x1cf7('0x4b')]=qs[_0x1cf7('0x4c')](_0x2abf2a['query'][_0x1cf7('0x4c')]);_0xb31af9['where']=qs['filters'](_['pick'](_0x2abf2a['query'],_0x330a8a[_0x1cf7('0x45')]));_0xb31af9[_0x1cf7('0x4d')][_0x1cf7('0x66')]=_0x1fbdc3['id'];if(_0x2abf2a[_0x1cf7('0x43')][_0x1cf7('0x4f')]){_0xb31af9[_0x1cf7('0x4d')]=_['merge'](_0xb31af9[_0x1cf7('0x4d')],{'$or':_[_0x1cf7('0x42')](_0xb31af9[_0x1cf7('0x46')],function(_0xa4ef96){var _0xe652d9={};_0xe652d9[_0xa4ef96]={'$like':'%'+_0x2abf2a[_0x1cf7('0x43')][_0x1cf7('0x4f')]+'%'};return _0xe652d9;})});}_0xb31af9=_[_0x1cf7('0x50')]({},_0xb31af9,_0x2abf2a['options']);return db['CannedAnswer']['count']({'where':_0xb31af9[_0x1cf7('0x4d')]})[_0x1cf7('0x1f')](function(_0x1cf707){_0x3359b6['count']=_0x1cf707;if(_0x2abf2a[_0x1cf7('0x43')][_0x1cf7('0x53')]){_0xb31af9[_0x1cf7('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1cf7('0x55')](_0xb31af9);})[_0x1cf7('0x1f')](function(_0x41806c){_0x3359b6['rows']=_0x41806c;return _0x3359b6;});}})[_0x1cf7('0x1f')](respondWithFilteredResult(_0x5200b2,_0xb31af9))[_0x1cf7('0x57')](handleError(_0x5200b2,null));};exports[_0x1cf7('0x6e')]=function(_0x41e3f2,_0x35894a,_0x428d31){return db['OpenchannelAccount'][_0x1cf7('0x5a')]({'where':{'id':_0x41e3f2[_0x1cf7('0x59')]['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x35894a,null))[_0x1cf7('0x1f')](function(_0x299903){if(_0x299903){return _0x299903[_0x1cf7('0x6e')](_0x41e3f2['query']['ids']);}})[_0x1cf7('0x1f')](respondWithStatusCode(_0x35894a,null))[_0x1cf7('0x57')](handleError(_0x35894a,null));};exports[_0x1cf7('0x6f')]=function(_0xfb7d17,_0x5c70bf,_0x540d4a){var _0x244f8b={'body':_0xfb7d17[_0x1cf7('0x5c')],'channel':_0x1cf7('0x70')};var _0x5f77c3=[];var _0x1cfe13=[];var _0x211182={};var _0x47ecb1=![];return db['CmContact'][_0x1cf7('0x64')]()[_0x1cf7('0x1f')](function(_0x2e7600){if(!_0x2e7600){throw new db[(_0x1cf7('0x71'))][(_0x1cf7('0x72'))](_0x1cf7('0x73'));}_0x5f77c3=_['difference'](_[_0x1cf7('0x44')](_0x2e7600),['createdAt','updatedAt']);_0x1cfe13=_[_0x1cf7('0x74')](_[_0x1cf7('0x44')](_0x2e7600),['createdAt','updatedAt',_0x1cf7('0x75'),_0x1cf7('0x76')]);if(_0xfb7d17[_0x1cf7('0x5c')]['id']){delete _0xfb7d17[_0x1cf7('0x5c')]['id'];}if(_[_0x1cf7('0x77')](_0xfb7d17[_0x1cf7('0x5c')]['from'])){throw new db[(_0x1cf7('0x71'))][(_0x1cf7('0x72'))](_0x1cf7('0x78'));}if(_['isNil'](_0xfb7d17[_0x1cf7('0x5c')]['body'])||_0xfb7d17['body'][_0x1cf7('0x5c')]===''){throw new db[(_0x1cf7('0x71'))][(_0x1cf7('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x79')])){throw new db[(_0x1cf7('0x71'))][(_0x1cf7('0x72'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1cfe13);}if(!_[_0x1cf7('0x7a')](_0x1cfe13,_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x79')])){throw new db[(_0x1cf7('0x71'))][(_0x1cf7('0x72'))](_0x1cf7('0x7b')+_0x1cfe13);}_0x211182[_0xfb7d17['body'][_0x1cf7('0x79')]]=_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x7c')];})[_0x1cf7('0x1f')](function(){return db[_0x1cf7('0x3c')][_0x1cf7('0x5a')]({'where':{'id':_0xfb7d17['params']['id']},'include':[{'model':db[_0x1cf7('0x7d')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x211182,'limit':0x1,'order':[[_0x1cf7('0x7e'),'DESC']]}]},{'model':db[_0x1cf7('0x7f')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x5c70bf,null))[_0x1cf7('0x1f')](function(_0x1646a6){if(_0x1646a6&&_0x1646a6[_0x1cf7('0x80')]){_0x244f8b[_0x1cf7('0x81')]=_0x1646a6;_0x244f8b[_0x1cf7('0x82')]=_0x1646a6[_0x1cf7('0x83')];_0x244f8b[_0x1cf7('0x84')]=_0x1646a6['List'];_0x244f8b[_0x1cf7('0x82')]=_[_0x1cf7('0x85')](_0x244f8b['applications'],[_0x1cf7('0x86')],[_0x1cf7('0x87')]);if(_0x244f8b[_0x1cf7('0x81')][_0x1cf7('0x83')]){delete _0x244f8b[_0x1cf7('0x81')][_0x1cf7('0x83')];}if(_0x244f8b[_0x1cf7('0x81')][_0x1cf7('0x80')]&&_0x244f8b[_0x1cf7('0x81')][_0x1cf7('0x80')][_0x1cf7('0x88')][_0x1cf7('0x49')]){return _0x244f8b[_0x1cf7('0x81')][_0x1cf7('0x80')][_0x1cf7('0x88')][0x0];}var _0x167350=_[_0x1cf7('0x89')](_0xfb7d17[_0x1cf7('0x5c')],{'firstName':_0xfb7d17[_0x1cf7('0x5c')]['from'],'ListId':_0x1646a6[_0x1cf7('0x76')]});_0x167350[_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x79')]]=_0xfb7d17['body']['from'];return db[_0x1cf7('0x8a')][_0x1cf7('0x5b')](_0x167350,{'fields':_0x5f77c3,'raw':!![]});}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x5c70bf,null))[_0x1cf7('0x1f')](function(_0xdc7e53){_0x244f8b['contact']=_0xdc7e53;if(_0xdc7e53){var _0xef5d7d={'ContactId':_0xdc7e53['id'],'OpenchannelAccountId':_0xfb7d17[_0x1cf7('0x59')]['id'],'from':(_0xdc7e53[_0x1cf7('0x8b')]||'')+'\x20'+(_0xdc7e53[_0x1cf7('0x8c')]||'')};var _0x31f874={'OpenchannelAccountId':_0xfb7d17[_0x1cf7('0x59')]['id'],'closed':![]};if(_0xfb7d17['body'][_0x1cf7('0x8d')]){_0x31f874[_0x1cf7('0x8d')]=_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x8d')];return db['OpenchannelInteraction'][_0x1cf7('0x5a')]({'where':_0x31f874})[_0x1cf7('0x1f')](function(_0x22664c){if(_0x22664c){return[_0x22664c,![]];}_0xef5d7d[_0x1cf7('0x8d')]=_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x8d')];_0xef5d7d[_0x1cf7('0x8e')]=_0xfb7d17[_0x1cf7('0x5c')]['externalUrl'];return db['OpenchannelInteraction'][_0x1cf7('0x5b')](_0xef5d7d)[_0x1cf7('0x1f')](function(_0x1af422){return[_0x1af422,!![]];});});}else{_0x31f874['threadId']=null;}_0x31f874[_0x1cf7('0x8f')]=_0xdc7e53['id'];return db[_0x1cf7('0x90')]['find']({'where':_0x31f874})[_0x1cf7('0x1f')](function(_0x41790d){if(_0x41790d){return[_0x41790d,![]];}return db[_0x1cf7('0x90')][_0x1cf7('0x5b')](_0xef5d7d)[_0x1cf7('0x1f')](function(_0x27cdf1){return[_0x27cdf1,!![]];});});}})[_0x1cf7('0x91')](function(_0x39810a,_0x31671a){if(_0x39810a){_0x47ecb1=_0x31671a;if(!_0x31671a){var _0x4f75f8={'from':(_0x244f8b[_0x1cf7('0x92')][_0x1cf7('0x8b')]||'')+'\x20'+(_0x244f8b[_0x1cf7('0x92')][_0x1cf7('0x8c')]||'')};if(_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x8d')]&&_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x93')]&&_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x8d')]!=_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x93')]){_0x4f75f8[_0x1cf7('0x8d')]=_0xfb7d17[_0x1cf7('0x5c')]['messageId'];}return _0x39810a[_0x1cf7('0x34')](_0x4f75f8);}else{return _0x39810a;}}})['then'](function(_0x11a9d2){_0x244f8b[_0x1cf7('0x94')]=_0x11a9d2['get']({'plain':!![]});_0x244f8b[_0x1cf7('0x94')][_0x1cf7('0x95')]=_0x47ecb1;if(_0x244f8b[_0x1cf7('0x94')]['created']){if(_0x244f8b[_0x1cf7('0x81')][_0x1cf7('0x96')]){_0x244f8b[_0x1cf7('0x82')]['push']({'id':0x0,'priority':_0x244f8b['applications']['length']+0x1,'app':_0x1cf7('0x97'),'appdata':_0x1cf7('0x98'),'interval':_0x1cf7('0x99')});}}return db[_0x1cf7('0x9a')][_0x1cf7('0x5b')]({'body':_0xfb7d17['body'][_0x1cf7('0x5c')],'OpenchannelAccountId':_0xfb7d17[_0x1cf7('0x59')]['id'],'OpenchannelInteractionId':_0x11a9d2['id'],'direction':'in','ContactId':_0x244f8b[_0x1cf7('0x92')]['id'],'AttachmentId':_0xfb7d17[_0x1cf7('0x5c')][_0x1cf7('0x9b')]});})[_0x1cf7('0x1f')](function(_0x492145){_0x244f8b[_0x1cf7('0x28')]=_0x492145;if(!_0x244f8b['interaction'][_0x1cf7('0x9c')])return;return db[_0x1cf7('0x9d')][_0x1cf7('0x5a')]({'attributes':['id',_0x1cf7('0x39')],'where':{'id':_0x244f8b[_0x1cf7('0x94')][_0x1cf7('0x9c')]}});})['then'](function(_0x2d0141){if(_0x2d0141){_0x244f8b[_0x1cf7('0x82')][_0x1cf7('0x9e')]({'id':0x0,'priority':0x0,'app':_0x1cf7('0x9f'),'appdata':_0x2d0141[_0x1cf7('0x39')]+','+(_0x244f8b[_0x1cf7('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0x1cf7('0x99')});}if(!_0x244f8b[_0x1cf7('0x94')][_0x1cf7('0xa0')])return;return db[_0x1cf7('0xa1')]['find']({'attributes':['id',_0x1cf7('0x39')],'where':{'id':_0x244f8b[_0x1cf7('0x94')][_0x1cf7('0xa0')]}});})[_0x1cf7('0x1f')](function(_0x36f4e3){if(_0x36f4e3){_0x244f8b[_0x1cf7('0x82')][_0x1cf7('0x9e')]({'id':0x0,'priority':0x1,'app':_0x1cf7('0xa2'),'appdata':_0x36f4e3['name']+','+(_0x244f8b[_0x1cf7('0x81')][_0x1cf7('0xa3')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1cf7('0xa4'),_0x1cf7('0xa5'),_0x244f8b);})[_0x1cf7('0x1f')](function(_0x423fc0){respondWithRpcPromise(_0x1cf7('0xa6'),'EventManager',{'event':'notify','message':_0x423fc0},client9002);return _0x423fc0;})['then'](respondWithResult(_0x5c70bf,null))['catch'](handleError(_0x5c70bf,null));};exports['addApplications']=function(_0xb8eb4a,_0x4c3adf){var _0x838b36=_0xb8eb4a[_0x1cf7('0x59')]['id'];var _0x124026=_0xb8eb4a[_0x1cf7('0x5c')];var _0x18cb48=0xc8;var _0x47e06c=null;return db['sequelize'][_0x1cf7('0xa7')]({'isolationLevel':db[_0x1cf7('0xa8')][_0x1cf7('0xa9')][_0x1cf7('0xaa')][_0x1cf7('0xab')]},function(_0xeaf9ee){return db['OpenchannelAccount'][_0x1cf7('0xac')]({'where':{'id':_0x838b36},'transaction':_0xeaf9ee})[_0x1cf7('0x1f')](function(_0x44d24a){if(_0x44d24a){return db[_0x1cf7('0x7f')][_0x1cf7('0x35')]({'where':{'OpenchannelAccountId':_0x838b36},'transaction':_0xeaf9ee})[_0x1cf7('0x1f')](function(){var _0x5bd5d1=_['map'](_0x124026,function(_0x5d0955){_0x5d0955[_0x1cf7('0x66')]=_0x838b36;return _0x5d0955;});return db[_0x1cf7('0x7f')]['bulkCreate'](_0x5bd5d1,{'transaction':_0xeaf9ee});});}else{_0x18cb48=0x194;_0x47e06c=[];}});})[_0x1cf7('0x1f')](function(){if(_0x18cb48!==0x194){return db[_0x1cf7('0x7f')][_0x1cf7('0xad')]({'where':{'OpenchannelAccountId':_0x838b36},'order':_0x1cf7('0x86')})[_0x1cf7('0x1f')](function(_0x24fec9){_0x47e06c=_0x24fec9;});}})[_0x1cf7('0x57')](function(_0x3e768d){_0x18cb48=0x1f4;logger[_0x1cf7('0x25')](_0x3e768d[_0x1cf7('0x38')]);if(_0x3e768d[_0x1cf7('0x39')]){delete _0x3e768d[_0x1cf7('0x39')];}_0x47e06c=_0x3e768d;})['finally'](function(){if(_0x47e06c===null){_0x4c3adf[_0x1cf7('0x37')](_0x18cb48);}else{if(_0x18cb48===0x1f4){_0x4c3adf['status'](_0x18cb48)[_0x1cf7('0xae')](_0x47e06c);}else{_0x4c3adf['status'](_0x18cb48)[_0x1cf7('0x2b')](_0x47e06c);}}});};exports[_0x1cf7('0xaf')]=function(_0x46ebc9,_0x1c4b6a,_0x7ed764){var _0x20e4d8={};var _0x557b20={};var _0x327f95;var _0x16fe4c;return db['OpenchannelAccount'][_0x1cf7('0xac')]({'where':{'id':_0x46ebc9['params']['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x1c4b6a,null))['then'](function(_0x175e48){if(_0x175e48){_0x327f95=_0x175e48;_0x557b20[_0x1cf7('0x41')]=_[_0x1cf7('0x44')](db['OpenchannelApplication'][_0x1cf7('0x3d')]);_0x557b20['query']=_[_0x1cf7('0x44')](_0x46ebc9['query']);_0x557b20[_0x1cf7('0x45')]=_[_0x1cf7('0x47')](_0x557b20[_0x1cf7('0x41')],_0x557b20[_0x1cf7('0x43')]);_0x20e4d8[_0x1cf7('0x46')]=_[_0x1cf7('0x47')](_0x557b20['model'],qs[_0x1cf7('0x48')](_0x46ebc9[_0x1cf7('0x43')][_0x1cf7('0x48')]));_0x20e4d8[_0x1cf7('0x46')]=_0x20e4d8[_0x1cf7('0x46')][_0x1cf7('0x49')]?_0x20e4d8[_0x1cf7('0x46')]:_0x557b20[_0x1cf7('0x41')];_0x20e4d8[_0x1cf7('0x4b')]=qs[_0x1cf7('0x4c')](_0x46ebc9[_0x1cf7('0x43')][_0x1cf7('0x4c')]);_0x20e4d8[_0x1cf7('0x4d')]=qs[_0x1cf7('0x45')](_[_0x1cf7('0x4e')](_0x46ebc9[_0x1cf7('0x43')],_0x557b20[_0x1cf7('0x45')]));if(_0x46ebc9[_0x1cf7('0x43')]['filter']){_0x20e4d8[_0x1cf7('0x4d')]=_[_0x1cf7('0x50')](_0x20e4d8[_0x1cf7('0x4d')],{'$or':_[_0x1cf7('0x42')](_0x20e4d8['attributes'],function(_0x279a75){var _0x5232c2={};_0x5232c2[_0x279a75]={'$like':'%'+_0x46ebc9[_0x1cf7('0x43')][_0x1cf7('0x4f')]+'%'};return _0x5232c2;})});}_0x20e4d8=_[_0x1cf7('0x50')]({},_0x20e4d8,_0x46ebc9[_0x1cf7('0x52')]);return _0x327f95[_0x1cf7('0xaf')](_0x20e4d8);}})[_0x1cf7('0x1f')](function(_0x568174){if(_0x568174){_0x16fe4c=_0x568174[_0x1cf7('0x49')];if(!_0x46ebc9[_0x1cf7('0x43')]['hasOwnProperty'](_0x1cf7('0x69'))){_0x20e4d8[_0x1cf7('0x2e')]=qs['limit'](_0x46ebc9['query']['limit']);_0x20e4d8[_0x1cf7('0x2c')]=qs[_0x1cf7('0x2c')](_0x46ebc9['query'][_0x1cf7('0x2c')]);}return _0x327f95[_0x1cf7('0xaf')](_0x20e4d8);}})[_0x1cf7('0x1f')](function(_0x4e974c){if(_0x4e974c){return _0x4e974c?{'count':_0x16fe4c,'rows':_0x4e974c}:null;}})[_0x1cf7('0x1f')](respondWithResult(_0x1c4b6a,null))['catch'](handleError(_0x1c4b6a,null));};exports['getInteractions']=function(_0x47b463,_0x4d4398,_0x3adeb9){var _0x30ed71={'raw':![],'where':{}};var _0x1af906={};var _0x7b0a2c={'count':0x0,'rows':[]};return db[_0x1cf7('0x3c')]['findOne']({'where':{'id':_0x47b463[_0x1cf7('0x59')]['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x4d4398,null))['then'](function(_0x3d9116){if(_0x3d9116){_0x1af906[_0x1cf7('0x41')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x1af906['query']=_[_0x1cf7('0x44')](_0x47b463['query']);_0x1af906['filters']=_['intersection'](_0x1af906['model'],_0x1af906[_0x1cf7('0x43')]);_0x30ed71[_0x1cf7('0x46')]=_[_0x1cf7('0x47')](_0x1af906[_0x1cf7('0x41')],qs[_0x1cf7('0x48')](_0x47b463[_0x1cf7('0x43')][_0x1cf7('0x48')]));_0x30ed71[_0x1cf7('0x46')]=_0x30ed71[_0x1cf7('0x46')][_0x1cf7('0x49')]?_0x30ed71[_0x1cf7('0x46')]:_0x1af906[_0x1cf7('0x41')];if(!_0x47b463[_0x1cf7('0x43')][_0x1cf7('0x4a')]('nolimit')){_0x30ed71[_0x1cf7('0x2e')]=qs[_0x1cf7('0x2e')](_0x47b463[_0x1cf7('0x43')]['limit']);_0x30ed71[_0x1cf7('0x2c')]=qs['offset'](_0x47b463[_0x1cf7('0x43')]['offset']);}_0x30ed71['order']=qs[_0x1cf7('0x4c')](_0x47b463[_0x1cf7('0x43')][_0x1cf7('0x4c')]);_0x30ed71[_0x1cf7('0x4d')]=qs[_0x1cf7('0x45')](_[_0x1cf7('0x4e')](_0x47b463[_0x1cf7('0x43')],_0x1af906[_0x1cf7('0x45')]));_0x30ed71[_0x1cf7('0x4d')]['OpenchannelAccountId']=_0x3d9116['id'];if(_0x47b463['query'][_0x1cf7('0x4f')]){_0x30ed71[_0x1cf7('0x4d')]=_['merge'](_0x30ed71[_0x1cf7('0x4d')],{'$or':_[_0x1cf7('0x42')](_0x30ed71['attributes'],function(_0x2b1323){var _0x2852e3={};_0x2852e3[_0x2b1323]={'$like':'%'+_0x47b463[_0x1cf7('0x43')][_0x1cf7('0x4f')]+'%'};return _0x2852e3;})});}_0x30ed71=_[_0x1cf7('0x50')]({},_0x30ed71,_0x47b463[_0x1cf7('0x52')]);return db['OpenchannelInteraction']['count']({'where':_0x30ed71[_0x1cf7('0x4d')]})['then'](function(_0x5af050){_0x7b0a2c[_0x1cf7('0x2f')]=_0x5af050;if(_0x47b463[_0x1cf7('0x43')][_0x1cf7('0x53')]){_0x30ed71[_0x1cf7('0x54')]=[{'model':db[_0x1cf7('0x8a')],'as':'Contact','required':![]},{'model':db[_0x1cf7('0x9d')],'as':'Owner','attributes':[_0x1cf7('0x39'),'fullname',_0x1cf7('0xb0')],'required':![]},{'model':db['Tag'],'as':_0x1cf7('0xb1'),'attributes':['id',_0x1cf7('0x39'),'color'],'where':_0x47b463[_0x1cf7('0x43')][_0x1cf7('0xb2')]?{'id':_0x47b463[_0x1cf7('0x43')][_0x1cf7('0xb2')]}:undefined,'required':_0x47b463['query'][_0x1cf7('0xb2')]?!![]:![]}];}return db[_0x1cf7('0x90')][_0x1cf7('0x55')](_0x30ed71);})[_0x1cf7('0x1f')](function(_0x6a61f){_0x7b0a2c[_0x1cf7('0x56')]=_0x6a61f;return _0x7b0a2c;});}})[_0x1cf7('0x1f')](respondWithFilteredResult(_0x4d4398,_0x30ed71))[_0x1cf7('0x57')](handleError(_0x4d4398,null));};exports[_0x1cf7('0xb3')]=function(_0x56c280,_0x2bda5c,_0x4050f5){return db[_0x1cf7('0x3c')][_0x1cf7('0x5a')]({'where':{'id':_0x56c280[_0x1cf7('0x59')]['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x2bda5c,null))[_0x1cf7('0x1f')](function(_0x942e31){if(_0x942e31){return _0x942e31['addAgents'](_0x56c280[_0x1cf7('0x5c')][_0x1cf7('0x6b')],_[_0x1cf7('0xb4')](_0x56c280[_0x1cf7('0x5c')],['ids','id'])||{})[_0x1cf7('0x91')](function(_0xdb1f3f){for(var _0x539e92=0x0;_0x539e92<_0x56c280[_0x1cf7('0x5c')][_0x1cf7('0x6b')][_0x1cf7('0x49')];_0x539e92+=0x1){socket[_0x1cf7('0xb5')](_0x1cf7('0xb6'),{'UserId':Number(_0x56c280[_0x1cf7('0x5c')][_0x1cf7('0x6b')][_0x539e92]),'OpenchannelAccountId':Number(_0x56c280['params']['id'])});}return _0xdb1f3f;});}})[_0x1cf7('0x1f')](respondWithResult(_0x2bda5c,null))[_0x1cf7('0x57')](handleError(_0x2bda5c,null));};exports['removeAgents']=function(_0x3de620,_0x505720,_0x325b4a){return db['OpenchannelAccount'][_0x1cf7('0x5a')]({'where':{'id':_0x3de620[_0x1cf7('0x59')]['id']}})[_0x1cf7('0x1f')](handleEntityNotFound(_0x505720,null))[_0x1cf7('0x1f')](function(_0x22ad17){if(_0x22ad17){return _0x22ad17['removeAgents'](_0x3de620['query'][_0x1cf7('0x6b')])[_0x1cf7('0x1f')](function(){if(_[_0x1cf7('0xb7')](_0x3de620[_0x1cf7('0x43')][_0x1cf7('0x6b')])){for(var _0x975853=0x0;_0x975853<_0x3de620[_0x1cf7('0x43')][_0x1cf7('0x6b')]['length'];_0x975853+=0x1){socket[_0x1cf7('0xb5')](_0x1cf7('0xb8'),{'UserId':Number(_0x3de620[_0x1cf7('0x43')]['ids'][_0x975853]),'OpenchannelAccountId':Number(_0x3de620[_0x1cf7('0x59')]['id'])});}}else{socket['emit'](_0x1cf7('0xb8'),{'UserId':Number(_0x3de620[_0x1cf7('0x43')]['ids']),'OpenchannelAccountId':Number(_0x3de620[_0x1cf7('0x59')]['id'])});}});}})[_0x1cf7('0x1f')](respondWithStatusCode(_0x505720,null))[_0x1cf7('0x57')](handleError(_0x505720,null));};exports['getAgents']=function(_0x1d4ffe,_0x400f7e,_0x7d0b92){var _0x292658={};var _0xfe4ea4={};var _0x18e52a;var _0x54b94e;return db['OpenchannelAccount'][_0x1cf7('0xac')]({'where':{'id':_0x1d4ffe[_0x1cf7('0x59')]['id']}})['then'](handleEntityNotFound(_0x400f7e,null))[_0x1cf7('0x1f')](function(_0x3428a3){if(_0x3428a3){_0x18e52a=_0x3428a3;_0xfe4ea4[_0x1cf7('0x41')]=_[_0x1cf7('0x44')](db[_0x1cf7('0x9d')][_0x1cf7('0x3d')]);_0xfe4ea4[_0x1cf7('0x43')]=_[_0x1cf7('0x44')](_0x1d4ffe[_0x1cf7('0x43')]);_0xfe4ea4['filters']=_['intersection'](_0xfe4ea4[_0x1cf7('0x41')],_0xfe4ea4[_0x1cf7('0x43')]);_0x292658[_0x1cf7('0x46')]=_[_0x1cf7('0x47')](_0xfe4ea4['model'],qs['fields'](_0x1d4ffe[_0x1cf7('0x43')][_0x1cf7('0x48')]));_0x292658[_0x1cf7('0x46')]=_0x292658[_0x1cf7('0x46')][_0x1cf7('0x49')]?_0x292658[_0x1cf7('0x46')]:_0xfe4ea4['model'];_0x292658[_0x1cf7('0x4b')]=qs[_0x1cf7('0x4c')](_0x1d4ffe[_0x1cf7('0x43')][_0x1cf7('0x4c')]);_0x292658[_0x1cf7('0x4d')]=qs[_0x1cf7('0x45')](_[_0x1cf7('0x4e')](_0x1d4ffe[_0x1cf7('0x43')],_0xfe4ea4[_0x1cf7('0x45')]));if(_0x1d4ffe['query'][_0x1cf7('0x4f')]){_0x292658[_0x1cf7('0x4d')]=_[_0x1cf7('0x50')](_0x292658['where'],{'$or':_[_0x1cf7('0x42')](_0x292658[_0x1cf7('0x46')],function(_0x384ffb){var _0x64967a={};_0x64967a[_0x384ffb]={'$like':'%'+_0x1d4ffe['query'][_0x1cf7('0x4f')]+'%'};return _0x64967a;})});}_0x292658=_[_0x1cf7('0x50')]({},_0x292658,_0x1d4ffe['options']);return _0x18e52a['getAgents'](_0x292658);}})['then'](function(_0x59c973){if(_0x59c973){_0x54b94e=_0x59c973[_0x1cf7('0x49')];if(!_0x1d4ffe[_0x1cf7('0x43')][_0x1cf7('0x4a')](_0x1cf7('0x69'))){_0x292658[_0x1cf7('0x2e')]=qs[_0x1cf7('0x2e')](_0x1d4ffe[_0x1cf7('0x43')][_0x1cf7('0x2e')]);_0x292658[_0x1cf7('0x2c')]=qs[_0x1cf7('0x2c')](_0x1d4ffe[_0x1cf7('0x43')][_0x1cf7('0x2c')]);}return _0x18e52a[_0x1cf7('0xb9')](_0x292658);}})[_0x1cf7('0x1f')](function(_0x1bb787){if(_0x1bb787){return _0x1bb787?{'count':_0x54b94e,'rows':_0x1bb787}:null;}})[_0x1cf7('0x1f')](respondWithResult(_0x400f7e,null))['catch'](handleError(_0x400f7e,null));};exports['send']=function(_0x504ed6,_0x5b4a68,_0x497b37){var _0x5228f1,_0x501f64,_0x46b8d4;if(_[_0x1cf7('0x77')](_0x504ed6[_0x1cf7('0x5c')][_0x1cf7('0x5c')])||_0x504ed6['body']['body']===''){throw new db[(_0x1cf7('0x71'))][(_0x1cf7('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1cf7('0x77')](_0x504ed6[_0x1cf7('0x5c')]['to'])){}_0x5228f1=_0x504ed6['body']['to'];return db[_0x1cf7('0x3c')][_0x1cf7('0xac')]({'where':{'id':_0x504ed6[_0x1cf7('0x59')]['id']}})['then'](handleEntityNotFound(_0x5b4a68,null))[_0x1cf7('0x1f')](function(_0x3e56f1){if(_0x3e56f1){return db[_0x1cf7('0x3c')][_0x1cf7('0x5a')]({'where':{'id':_0x3e56f1['id']},'include':[{'model':db['CmList'],'as':_0x1cf7('0x80'),'include':[{'model':db[_0x1cf7('0x8a')],'as':_0x1cf7('0x88'),'where':{[_0x3e56f1[_0x1cf7('0x79')]]:_0x5228f1},'limit':0x1,'order':[[_0x1cf7('0x7e'),_0x1cf7('0xba')]]}]}]})['then'](handleEntityNotFound(_0x5b4a68,null))[_0x1cf7('0x1f')](function(_0x3b3a82){if(_0x3b3a82&&_0x3b3a82[_0x1cf7('0x80')]){_0x501f64=_0x3b3a82[_0x1cf7('0x36')]({'plain':!![]});if(_0x501f64[_0x1cf7('0x80')]&&_0x501f64[_0x1cf7('0x80')][_0x1cf7('0x88')]['length']){return _0x501f64[_0x1cf7('0x80')]['Contacts'][0x0];}return db[_0x1cf7('0x8a')][_0x1cf7('0x5b')](_['defaults'](_0x504ed6[_0x1cf7('0x5c')],{'firstName':_0x5228f1,[_0x3b3a82[_0x1cf7('0x79')]]:_0x5228f1,'phone':_0x5228f1,'ListId':_0x501f64[_0x1cf7('0x76')]}));}})['then'](handleEntityNotFound(_0x5b4a68,null))[_0x1cf7('0x1f')](function(_0x4ed611){if(_0x4ed611){_0x46b8d4=_0x4ed611;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x46b8d4['id'],'closed':![],'OpenchannelAccountId':_0x501f64['id']}})[_0x1cf7('0x1f')](function(_0x1da68c){if(_0x1da68c){return[_0x1da68c,![]];}return db[_0x1cf7('0x90')]['create']({'UserId':_0x504ed6['user']['id'],'ContactId':_0x46b8d4['id'],'OpenchannelAccountId':_0x501f64['id'],'lastMsgDirection':_0x1cf7('0xbb'),'firstMsgDirection':'out','Messages':[_[_0x1cf7('0x50')](_0x504ed6[_0x1cf7('0x5c')],{'read':![],'body':_0x504ed6[_0x1cf7('0x5c')]['body'],'OpenchannelAccountId':_0x501f64['id'],'UserId':_0x504ed6[_0x1cf7('0x5d')]['id'],'ContactId':_0x46b8d4['id']})]},{'include':[{'model':db[_0x1cf7('0x9a')],'as':_0x1cf7('0xbc')}]})['then'](function(_0x494c16){return[_0x494c16,!![]];});});}})[_0x1cf7('0x91')](function(_0x5835f7,_0x5cd15f){if(_0x5cd15f){return _0x5835f7;}return db['OpenchannelMessage'][_0x1cf7('0x5b')](_[_0x1cf7('0x50')](_0x504ed6[_0x1cf7('0x5c')],{'read':![],'body':_0x504ed6[_0x1cf7('0x5c')][_0x1cf7('0x5c')],'OpenchannelAccountId':_0x501f64['id'],'OpenchannelInteractionId':_0x5835f7['id'],'UserId':_0x504ed6[_0x1cf7('0x5d')]['id'],'ContactId':_0x46b8d4['id']}))['then'](function(_0x556f22){_0x5835f7['dataValues'][_0x1cf7('0xbc')]=[];_0x5835f7[_0x1cf7('0xbd')][_0x1cf7('0xbc')][_0x1cf7('0xbe')](_0x556f22[_0x1cf7('0xbd')]);return _0x5835f7;});});}})[_0x1cf7('0x1f')](respondWithResult(_0x5b4a68,null))['catch'](handleError(_0x5b4a68,null));}; \ No newline at end of file +var _0x933c=['end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','OpenchannelAccount','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','keys','rawAttributes','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','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','OpenchannelApplication','List','applications','Applications','list','orderBy','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','internal','Tag','Tags','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x933c,0x99));var _0xc933=function(_0xc12aa8,_0x583423){_0xc12aa8=_0xc12aa8-0x0;var _0x2802bc=_0x933c[_0xc12aa8];return _0x2802bc;};'use strict';var emlformat=require(_0xc933('0x0'));var rimraf=require(_0xc933('0x1'));var zipdir=require(_0xc933('0x2'));var jsonpatch=require(_0xc933('0x3'));var rp=require(_0xc933('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc933('0x5'));var util=require(_0xc933('0x6'));var path=require(_0xc933('0x7'));var sox=require(_0xc933('0x8'));var csv=require(_0xc933('0x9'));var ejs=require(_0xc933('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc933('0xb'));var squel=require('squel');var crypto=require(_0xc933('0xc'));var jsforce=require(_0xc933('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc933('0xe'));var Papa=require(_0xc933('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc933('0x10'));var as=require(_0xc933('0x11'));var hardwareService=require(_0xc933('0x12'));var logger=require(_0xc933('0x13'))(_0xc933('0x14'));var utils=require(_0xc933('0x15'));var config=require(_0xc933('0x16'));var licenseUtil=require(_0xc933('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc933('0x18')](config[_0xc933('0x19')],{'host':_0xc933('0x1a'),'port':0x18eb});var socket=require(_0xc933('0x1b'))(new Redis(config[_0xc933('0x19')]));require('./openchannelAccount.socket')[_0xc933('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc933('0x1d')][_0xc933('0x1e')]({'port':0x232c});var client9002=jayson[_0xc933('0x1d')][_0xc933('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x490452,_0x12a97b,_0x4d8f14,_0x4bdbe8){return new BPromise(function(_0x776634,_0x42b06a){var _0xb76659=_0x4bdbe8||client;return _0xb76659[_0xc933('0x1f')](_0x490452,_0x4d8f14)[_0xc933('0x20')](function(_0x2ba124){logger[_0xc933('0x21')](_0xc933('0x22'),_0x12a97b,_0xc933('0x23'));logger[_0xc933('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x12a97b,_0xc933('0x23'),JSON[_0xc933('0x25')](_0x2ba124));if(_0x2ba124[_0xc933('0x26')]){if(_0x2ba124[_0xc933('0x26')][_0xc933('0x27')]===0x1f4){logger[_0xc933('0x26')](_0xc933('0x22'),_0x12a97b,_0x2ba124[_0xc933('0x26')]['message']);return _0x42b06a(_0x2ba124[_0xc933('0x26')][_0xc933('0x28')]);}logger[_0xc933('0x26')](_0xc933('0x22'),_0x12a97b,_0x2ba124[_0xc933('0x26')]['message']);return _0x776634(_0x2ba124[_0xc933('0x26')][_0xc933('0x28')]);}else{logger[_0xc933('0x21')](_0xc933('0x22'),_0x12a97b,_0xc933('0x23'));_0x776634(_0x2ba124['result'][_0xc933('0x28')]);}})[_0xc933('0x29')](function(_0x5ede22){logger['error'](_0xc933('0x22'),_0x12a97b,_0x5ede22);_0x42b06a(_0x5ede22);});});}function respondWithStatusCode(_0x454715,_0x31ac8b){_0x31ac8b=_0x31ac8b||0xcc;return function(_0x1afada){if(_0x1afada){return _0x454715['sendStatus'](_0x31ac8b);}return _0x454715[_0xc933('0x2a')](_0x31ac8b)[_0xc933('0x2b')]();};}function respondWithResult(_0x519ede,_0x1a9004){_0x1a9004=_0x1a9004||0xc8;return function(_0x202244){if(_0x202244){return _0x519ede['status'](_0x1a9004)['json'](_0x202244);}};}function respondWithFilteredResult(_0x4628ec,_0x5d7b77){return function(_0x8598f7){if(_0x8598f7){var _0xaad361=typeof _0x5d7b77['offset']===_0xc933('0x2c')&&typeof _0x5d7b77[_0xc933('0x2d')]===_0xc933('0x2c');var _0x5055c7=_0x8598f7[_0xc933('0x2e')];var _0x39e652=_0xaad361?0x0:_0x5d7b77[_0xc933('0x2f')];var _0x5ab52a=_0xaad361?_0x8598f7[_0xc933('0x2e')]:_0x5d7b77[_0xc933('0x2f')]+_0x5d7b77[_0xc933('0x2d')];var _0x21fcd1;if(_0x5ab52a>=_0x5055c7){_0x5ab52a=_0x5055c7;_0x21fcd1=0xc8;}else{_0x21fcd1=0xce;}_0x4628ec[_0xc933('0x2a')](_0x21fcd1);return _0x4628ec[_0xc933('0x30')](_0xc933('0x31'),_0x39e652+'-'+_0x5ab52a+'/'+_0x5055c7)[_0xc933('0x32')](_0x8598f7);}return null;};}function patchUpdates(_0x594503){return function(_0x12e1af){try{jsonpatch['apply'](_0x12e1af,_0x594503,!![]);}catch(_0x2ceaff){return BPromise[_0xc933('0x33')](_0x2ceaff);}return _0x12e1af[_0xc933('0x34')]();};}function saveUpdates(_0x45fa89,_0x56eb1f){return function(_0x5c04a8){if(_0x5c04a8){return _0x5c04a8[_0xc933('0x35')](_0x45fa89)[_0xc933('0x20')](function(_0x3a7471){return _0x3a7471;});}return null;};}function removeEntity(_0x4ce9f7,_0x2831e4){return function(_0x1d559a){if(_0x1d559a){return _0x1d559a[_0xc933('0x36')]()[_0xc933('0x20')](function(){var _0x6f737f=_0x1d559a[_0xc933('0x37')]({'plain':!![]});var _0xa48d70=_0xc933('0x38');return db[_0xc933('0x39')]['destroy']({'where':{'type':_0xa48d70,'resourceId':_0x6f737f['id']}})[_0xc933('0x20')](function(){return _0x1d559a;});})[_0xc933('0x20')](function(){_0x4ce9f7[_0xc933('0x2a')](0xcc)[_0xc933('0x2b')]();});}};}function handleEntityNotFound(_0x566635,_0x1530eb){return function(_0x42dc86){if(!_0x42dc86){_0x566635[_0xc933('0x3a')](0x194);}return _0x42dc86;};}function handleError(_0x204347,_0x8769b6){_0x8769b6=_0x8769b6||0x1f4;return function(_0x4652fb){logger[_0xc933('0x26')](_0x4652fb[_0xc933('0x3b')]);if(_0x4652fb[_0xc933('0x3c')]){delete _0x4652fb[_0xc933('0x3c')];}_0x204347['status'](_0x8769b6)[_0xc933('0x3d')](_0x4652fb);};}exports[_0xc933('0x3e')]=function(_0x2087af,_0x3905fc){var _0x4d7ed7={'include':[{'model':db[_0xc933('0x3f')],'as':'mandatoryDispositionPause'}]},_0x2b39ae={},_0x59138a={'count':0x0,'rows':[]};var _0xc053cb=_['map'](db[_0xc933('0x40')]['rawAttributes'],function(_0x4c06da){return{'name':_0x4c06da[_0xc933('0x41')],'type':_0x4c06da[_0xc933('0x42')][_0xc933('0x43')]};});_0x2b39ae['model']=_[_0xc933('0x44')](_0xc053cb,_0xc933('0x3c'));_0x2b39ae[_0xc933('0x45')]=_['keys'](_0x2087af[_0xc933('0x45')]);_0x2b39ae[_0xc933('0x46')]=_[_0xc933('0x47')](_0x2b39ae[_0xc933('0x48')],_0x2b39ae[_0xc933('0x45')]);_0x4d7ed7[_0xc933('0x49')]=_[_0xc933('0x47')](_0x2b39ae['model'],qs[_0xc933('0x4a')](_0x2087af[_0xc933('0x45')]['fields']));_0x4d7ed7[_0xc933('0x49')]=_0x4d7ed7[_0xc933('0x49')][_0xc933('0x4b')]?_0x4d7ed7[_0xc933('0x49')]:_0x2b39ae[_0xc933('0x48')];if(!_0x2087af[_0xc933('0x45')][_0xc933('0x4c')](_0xc933('0x4d'))){_0x4d7ed7[_0xc933('0x2d')]=qs[_0xc933('0x2d')](_0x2087af['query'][_0xc933('0x2d')]);_0x4d7ed7[_0xc933('0x2f')]=qs[_0xc933('0x2f')](_0x2087af[_0xc933('0x45')][_0xc933('0x2f')]);}_0x4d7ed7[_0xc933('0x4e')]=qs[_0xc933('0x4f')](_0x2087af[_0xc933('0x45')]['sort']);_0x4d7ed7[_0xc933('0x50')]=qs[_0xc933('0x46')](_[_0xc933('0x51')](_0x2087af['query'],_0x2b39ae[_0xc933('0x46')]),_0xc053cb);if(_0x2087af[_0xc933('0x45')][_0xc933('0x52')]){_0x4d7ed7[_0xc933('0x50')]=_[_0xc933('0x53')](_0x4d7ed7[_0xc933('0x50')],{'$or':_[_0xc933('0x44')](_0xc053cb,function(_0x382c7d){if(_0x382c7d['type']!=='VIRTUAL'){var _0x33c6f2={};_0x33c6f2[_0x382c7d[_0xc933('0x3c')]]={'$like':'%'+_0x2087af['query'][_0xc933('0x52')]+'%'};return _0x33c6f2;}})});}_0x4d7ed7=_[_0xc933('0x53')]({},_0x4d7ed7,_0x2087af[_0xc933('0x54')]);var _0x72884f={'where':_0x4d7ed7[_0xc933('0x50')]};return db['OpenchannelAccount'][_0xc933('0x2e')](_0x72884f)['then'](function(_0x5d81bc){_0x59138a[_0xc933('0x2e')]=_0x5d81bc;if(_0x2087af['query'][_0xc933('0x55')]){_0x4d7ed7[_0xc933('0x56')]=[{'all':!![]}];}return db[_0xc933('0x40')][_0xc933('0x57')](_0x4d7ed7);})[_0xc933('0x20')](function(_0x5a2e8e){_0x59138a[_0xc933('0x58')]=_0x5a2e8e;return _0x59138a;})['then'](respondWithFilteredResult(_0x3905fc,_0x4d7ed7))[_0xc933('0x29')](handleError(_0x3905fc,null));};exports[_0xc933('0x59')]=function(_0x389f04,_0x2b2eab){var _0x293946={'raw':![],'where':{'id':_0x389f04['params']['id']},'include':[{'model':db['Pause'],'as':_0xc933('0x5a')}]},_0x4b0215={};_0x4b0215[_0xc933('0x48')]=_[_0xc933('0x5b')](db['OpenchannelAccount'][_0xc933('0x5c')]);_0x4b0215[_0xc933('0x45')]=_[_0xc933('0x5b')](_0x389f04[_0xc933('0x45')]);_0x4b0215[_0xc933('0x46')]=_[_0xc933('0x47')](_0x4b0215['model'],_0x4b0215[_0xc933('0x45')]);_0x293946[_0xc933('0x49')]=_['intersection'](_0x4b0215[_0xc933('0x48')],qs[_0xc933('0x4a')](_0x389f04[_0xc933('0x45')][_0xc933('0x4a')]));_0x293946['attributes']=_0x293946[_0xc933('0x49')][_0xc933('0x4b')]?_0x293946[_0xc933('0x49')]:_0x4b0215['model'];if(_0x389f04[_0xc933('0x45')]['includeAll']){_0x293946[_0xc933('0x56')]=[{'all':!![]}];}_0x293946=_[_0xc933('0x53')]({},_0x293946,_0x389f04[_0xc933('0x54')]);return db['OpenchannelAccount'][_0xc933('0x5d')](_0x293946)[_0xc933('0x20')](handleEntityNotFound(_0x2b2eab,null))[_0xc933('0x20')](respondWithResult(_0x2b2eab,null))[_0xc933('0x29')](handleError(_0x2b2eab,null));};exports[_0xc933('0x5e')]=function(_0xe89b60,_0x5a3f7e){return db['OpenchannelAccount'][_0xc933('0x5e')](_0xe89b60['body'],{})[_0xc933('0x20')](function(_0x583d99){var _0x1a828e=_0xe89b60[_0xc933('0x5f')][_0xc933('0x37')]({'plain':!![]});if(!_0x1a828e)throw new Error(_0xc933('0x60'));if(_0x1a828e['role']===_0xc933('0x5f')){var _0x5c23a4=_0x583d99[_0xc933('0x37')]({'plain':!![]});var _0x4ed421='OpenchannelAccounts';return db[_0xc933('0x61')]['find']({'where':{'name':_0x4ed421,'userProfileId':_0x1a828e[_0xc933('0x62')]},'raw':!![]})[_0xc933('0x20')](function(_0x83e284){if(_0x83e284&&_0x83e284[_0xc933('0x63')]===0x0){return db[_0xc933('0x39')][_0xc933('0x5e')]({'name':_0x5c23a4[_0xc933('0x3c')],'resourceId':_0x5c23a4['id'],'type':_0x83e284[_0xc933('0x3c')],'sectionId':_0x83e284['id']},{})['then'](function(){return _0x583d99;});}else{return _0x583d99;}})[_0xc933('0x29')](function(_0x53c0ac){logger['error'](_0xc933('0x64'),_0x53c0ac);throw _0x53c0ac;});}return _0x583d99;})[_0xc933('0x20')](respondWithResult(_0x5a3f7e,0xc9))[_0xc933('0x29')](handleError(_0x5a3f7e,null));};exports[_0xc933('0x35')]=function(_0x5b21d7,_0xc02ec0){if(_0x5b21d7[_0xc933('0x65')]['id']){delete _0x5b21d7['body']['id'];}return db[_0xc933('0x40')][_0xc933('0x5d')]({'where':{'id':_0x5b21d7[_0xc933('0x66')]['id']},'include':[{'model':db[_0xc933('0x3f')],'as':_0xc933('0x5a')}]})[_0xc933('0x20')](handleEntityNotFound(_0xc02ec0,null))[_0xc933('0x20')](saveUpdates(_0x5b21d7[_0xc933('0x65')],null))[_0xc933('0x20')](respondWithResult(_0xc02ec0,null))['catch'](handleError(_0xc02ec0,null));};exports[_0xc933('0x36')]=function(_0xca7a9e,_0x544887){return db[_0xc933('0x40')]['find']({'where':{'id':_0xca7a9e[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x544887,null))['then'](removeEntity(_0x544887,null))[_0xc933('0x29')](handleError(_0x544887,null));};exports[_0xc933('0x67')]=function(_0xf2efbe,_0x2d01e7){return db[_0xc933('0x40')][_0xc933('0x67')]()[_0xc933('0x20')](respondWithResult(_0x2d01e7,null))['catch'](handleError(_0x2d01e7,null));};exports[_0xc933('0x68')]=function(_0x32eef3,_0x57ea90,_0xb3ea8d){if(_0x32eef3[_0xc933('0x65')]['id']){delete _0x32eef3[_0xc933('0x65')]['id'];}return db[_0xc933('0x40')][_0xc933('0x5d')]({'where':{'id':_0x32eef3[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x57ea90,null))['then'](function(_0x5dbd81){if(_0x5dbd81){_0x32eef3[_0xc933('0x65')][_0xc933('0x69')]=_0x5dbd81['id'];return db[_0xc933('0x6a')][_0xc933('0x5e')](_0x32eef3[_0xc933('0x65')]);}})[_0xc933('0x20')](respondWithResult(_0x57ea90,null))['catch'](handleError(_0x57ea90,null));};exports[_0xc933('0x6b')]=function(_0x1a2521,_0x143c0f,_0x3aefad){var _0x319677={'raw':![],'where':{}};var _0x1c0704={};var _0x3285b7={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc933('0x6c')]({'where':{'id':_0x1a2521['params']['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x143c0f,null))['then'](function(_0xa897e){if(_0xa897e){_0x1c0704[_0xc933('0x48')]=_['keys'](db[_0xc933('0x6a')][_0xc933('0x5c')]);_0x1c0704['query']=_[_0xc933('0x5b')](_0x1a2521[_0xc933('0x45')]);_0x1c0704[_0xc933('0x46')]=_[_0xc933('0x47')](_0x1c0704[_0xc933('0x48')],_0x1c0704[_0xc933('0x45')]);_0x319677[_0xc933('0x49')]=_[_0xc933('0x47')](_0x1c0704['model'],qs[_0xc933('0x4a')](_0x1a2521['query'][_0xc933('0x4a')]));_0x319677['attributes']=_0x319677[_0xc933('0x49')][_0xc933('0x4b')]?_0x319677[_0xc933('0x49')]:_0x1c0704[_0xc933('0x48')];if(!_0x1a2521[_0xc933('0x45')][_0xc933('0x4c')](_0xc933('0x4d'))){_0x319677['limit']=qs[_0xc933('0x2d')](_0x1a2521[_0xc933('0x45')][_0xc933('0x2d')]);_0x319677[_0xc933('0x2f')]=qs['offset'](_0x1a2521[_0xc933('0x45')][_0xc933('0x2f')]);}_0x319677[_0xc933('0x4e')]=qs[_0xc933('0x4f')](_0x1a2521[_0xc933('0x45')]['sort']);_0x319677[_0xc933('0x50')]=qs[_0xc933('0x46')](_[_0xc933('0x51')](_0x1a2521[_0xc933('0x45')],_0x1c0704[_0xc933('0x46')]));_0x319677['where']['OpenchannelAccountId']=_0xa897e['id'];if(_0x1a2521[_0xc933('0x45')]['filter']){_0x319677[_0xc933('0x50')]=_[_0xc933('0x53')](_0x319677['where'],{'$or':_[_0xc933('0x44')](_0x319677[_0xc933('0x49')],function(_0x46c24c){var _0x3ccce3={};_0x3ccce3[_0x46c24c]={'$like':'%'+_0x1a2521[_0xc933('0x45')]['filter']+'%'};return _0x3ccce3;})});}_0x319677=_['merge']({},_0x319677,_0x1a2521[_0xc933('0x54')]);return db[_0xc933('0x6a')]['count']({'where':_0x319677[_0xc933('0x50')]})[_0xc933('0x20')](function(_0x45a4c5){_0x3285b7[_0xc933('0x2e')]=_0x45a4c5;if(_0x1a2521[_0xc933('0x45')][_0xc933('0x55')]){_0x319677[_0xc933('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xc933('0x57')](_0x319677);})[_0xc933('0x20')](function(_0xedbdb1){_0x3285b7['rows']=_0xedbdb1;return _0x3285b7;});}})[_0xc933('0x20')](respondWithFilteredResult(_0x143c0f,_0x319677))[_0xc933('0x29')](handleError(_0x143c0f,null));};exports['removeDispositions']=function(_0x4439ee,_0x4df710,_0x12174f){return db[_0xc933('0x40')][_0xc933('0x5d')]({'where':{'id':_0x4439ee[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x4df710,null))[_0xc933('0x20')](function(_0x4a42ec){if(_0x4a42ec){return _0x4a42ec[_0xc933('0x6d')](_0x4439ee[_0xc933('0x45')][_0xc933('0x6e')]);}})[_0xc933('0x20')](respondWithStatusCode(_0x4df710,null))[_0xc933('0x29')](handleError(_0x4df710,null));};exports[_0xc933('0x6f')]=function(_0x33a263,_0x5eb105,_0x1af35e){if(_0x33a263[_0xc933('0x65')]['id']){delete _0x33a263[_0xc933('0x65')]['id'];}return db[_0xc933('0x40')]['find']({'where':{'id':_0x33a263[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x5eb105,null))[_0xc933('0x20')](function(_0xf36671){if(_0xf36671){_0x33a263[_0xc933('0x65')][_0xc933('0x69')]=_0xf36671['id'];return db[_0xc933('0x70')][_0xc933('0x5e')](_0x33a263[_0xc933('0x65')]);}})[_0xc933('0x20')](respondWithResult(_0x5eb105,null))[_0xc933('0x29')](handleError(_0x5eb105,null));};exports[_0xc933('0x71')]=function(_0x282731,_0x33d2e0,_0x3b0f18){var _0x190f4a={'raw':![],'where':{}};var _0x4bae4a={};var _0xb40750={'count':0x0,'rows':[]};return db[_0xc933('0x40')][_0xc933('0x6c')]({'where':{'id':_0x282731[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x33d2e0,null))[_0xc933('0x20')](function(_0x2d219a){if(_0x2d219a){_0x4bae4a[_0xc933('0x48')]=_[_0xc933('0x5b')](db[_0xc933('0x70')]['rawAttributes']);_0x4bae4a[_0xc933('0x45')]=_[_0xc933('0x5b')](_0x282731[_0xc933('0x45')]);_0x4bae4a[_0xc933('0x46')]=_[_0xc933('0x47')](_0x4bae4a[_0xc933('0x48')],_0x4bae4a[_0xc933('0x45')]);_0x190f4a['attributes']=_[_0xc933('0x47')](_0x4bae4a[_0xc933('0x48')],qs[_0xc933('0x4a')](_0x282731[_0xc933('0x45')][_0xc933('0x4a')]));_0x190f4a[_0xc933('0x49')]=_0x190f4a['attributes'][_0xc933('0x4b')]?_0x190f4a['attributes']:_0x4bae4a[_0xc933('0x48')];if(!_0x282731[_0xc933('0x45')][_0xc933('0x4c')](_0xc933('0x4d'))){_0x190f4a[_0xc933('0x2d')]=qs[_0xc933('0x2d')](_0x282731[_0xc933('0x45')]['limit']);_0x190f4a[_0xc933('0x2f')]=qs[_0xc933('0x2f')](_0x282731[_0xc933('0x45')]['offset']);}_0x190f4a[_0xc933('0x4e')]=qs[_0xc933('0x4f')](_0x282731['query'][_0xc933('0x4f')]);_0x190f4a[_0xc933('0x50')]=qs[_0xc933('0x46')](_[_0xc933('0x51')](_0x282731[_0xc933('0x45')],_0x4bae4a[_0xc933('0x46')]));_0x190f4a[_0xc933('0x50')]['OpenchannelAccountId']=_0x2d219a['id'];if(_0x282731['query']['filter']){_0x190f4a[_0xc933('0x50')]=_['merge'](_0x190f4a['where'],{'$or':_[_0xc933('0x44')](_0x190f4a[_0xc933('0x49')],function(_0x4989c5){var _0x3f58f5={};_0x3f58f5[_0x4989c5]={'$like':'%'+_0x282731[_0xc933('0x45')][_0xc933('0x52')]+'%'};return _0x3f58f5;})});}_0x190f4a=_[_0xc933('0x53')]({},_0x190f4a,_0x282731['options']);return db[_0xc933('0x70')]['count']({'where':_0x190f4a[_0xc933('0x50')]})[_0xc933('0x20')](function(_0x69336){_0xb40750['count']=_0x69336;if(_0x282731[_0xc933('0x45')][_0xc933('0x55')]){_0x190f4a[_0xc933('0x56')]=[{'all':!![]}];}return db[_0xc933('0x70')][_0xc933('0x57')](_0x190f4a);})['then'](function(_0x16fc0a){_0xb40750['rows']=_0x16fc0a;return _0xb40750;});}})['then'](respondWithFilteredResult(_0x33d2e0,_0x190f4a))[_0xc933('0x29')](handleError(_0x33d2e0,null));};exports[_0xc933('0x72')]=function(_0x52a1a3,_0x30b19f,_0x45aaf5){return db[_0xc933('0x40')][_0xc933('0x5d')]({'where':{'id':_0x52a1a3[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x30b19f,null))[_0xc933('0x20')](function(_0x4d32fe){if(_0x4d32fe){return _0x4d32fe[_0xc933('0x72')](_0x52a1a3[_0xc933('0x45')][_0xc933('0x6e')]);}})[_0xc933('0x20')](respondWithStatusCode(_0x30b19f,null))[_0xc933('0x29')](handleError(_0x30b19f,null));};exports['notify']=function(_0x423074,_0x59e515,_0x204f0f){var _0x137e02={'body':_0x423074[_0xc933('0x65')],'channel':_0xc933('0x73')};var _0x4b4380=[];var _0x9e7db6=[];var _0x37da6f={};var _0x5bfd94=![];return db[_0xc933('0x74')][_0xc933('0x67')]()[_0xc933('0x20')](function(_0x420081){if(!_0x420081){throw new db['Sequelize'][(_0xc933('0x75'))](_0xc933('0x76'));}_0x4b4380=_[_0xc933('0x77')](_['keys'](_0x420081),['createdAt',_0xc933('0x78')]);_0x9e7db6=_[_0xc933('0x77')](_[_0xc933('0x5b')](_0x420081),[_0xc933('0x79'),_0xc933('0x78'),_0xc933('0x7a'),_0xc933('0x7b')]);if(_0x423074['body']['id']){delete _0x423074[_0xc933('0x65')]['id'];}if(_[_0xc933('0x7c')](_0x423074[_0xc933('0x65')]['from'])){throw new db[(_0xc933('0x7d'))][(_0xc933('0x75'))](_0xc933('0x7e'));}if(_['isNil'](_0x423074['body']['body'])||_0x423074[_0xc933('0x65')][_0xc933('0x65')]===''){throw new db[(_0xc933('0x7d'))][(_0xc933('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc933('0x7c')](_0x423074[_0xc933('0x65')][_0xc933('0x7f')])){throw new db[(_0xc933('0x7d'))][(_0xc933('0x75'))](_0xc933('0x80')+_0x9e7db6);}if(!_[_0xc933('0x81')](_0x9e7db6,_0x423074[_0xc933('0x65')][_0xc933('0x7f')])){throw new db[(_0xc933('0x7d'))]['ValidationError'](_0xc933('0x82')+_0x9e7db6);}_0x37da6f[_0x423074['body']['mapKey']]=_0x423074[_0xc933('0x65')][_0xc933('0x83')];})[_0xc933('0x20')](function(){return db[_0xc933('0x40')]['find']({'where':{'id':_0x423074[_0xc933('0x66')]['id']},'include':[{'model':db[_0xc933('0x84')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc933('0x85'),'where':_0x37da6f,'limit':0x1,'order':[[_0xc933('0x78'),_0xc933('0x86')]]}]},{'model':db[_0xc933('0x87')],'as':'Applications'}]});})[_0xc933('0x20')](handleEntityNotFound(_0x59e515,null))[_0xc933('0x20')](function(_0x20c47a){if(_0x20c47a&&_0x20c47a[_0xc933('0x88')]){_0x137e02['account']=_0x20c47a;_0x137e02[_0xc933('0x89')]=_0x20c47a[_0xc933('0x8a')];_0x137e02[_0xc933('0x8b')]=_0x20c47a['List'];_0x137e02['applications']=_[_0xc933('0x8c')](_0x137e02[_0xc933('0x89')],[_0xc933('0x8d')],[_0xc933('0x8e')]);if(_0x137e02[_0xc933('0x8f')][_0xc933('0x8a')]){delete _0x137e02[_0xc933('0x8f')][_0xc933('0x8a')];}if(_0x137e02[_0xc933('0x8f')]['List']&&_0x137e02['account']['List'][_0xc933('0x85')][_0xc933('0x4b')]){return _0x137e02[_0xc933('0x8f')][_0xc933('0x88')]['Contacts'][0x0];}var _0x2f482c=_[_0xc933('0x18')](_0x423074[_0xc933('0x65')],{'firstName':_0x423074[_0xc933('0x65')][_0xc933('0x83')],'ListId':_0x20c47a[_0xc933('0x7b')]});_0x2f482c[_0x423074[_0xc933('0x65')][_0xc933('0x7f')]]=_0x423074[_0xc933('0x65')]['from'];return db[_0xc933('0x74')][_0xc933('0x5e')](_0x2f482c,{'fields':_0x4b4380,'raw':!![]});}})['then'](handleEntityNotFound(_0x59e515,null))[_0xc933('0x20')](function(_0x28dbf6){_0x137e02[_0xc933('0x90')]=_0x28dbf6;if(_0x28dbf6){var _0x24839b={'ContactId':_0x28dbf6['id'],'OpenchannelAccountId':_0x423074[_0xc933('0x66')]['id'],'from':(_0x28dbf6[_0xc933('0x91')]||'')+'\x20'+(_0x28dbf6[_0xc933('0x92')]||'')};var _0x5de9d1={'OpenchannelAccountId':_0x423074[_0xc933('0x66')]['id'],'closed':![]};if(_0x423074[_0xc933('0x65')][_0xc933('0x93')]){_0x5de9d1[_0xc933('0x93')]=_0x423074[_0xc933('0x65')]['threadId'];return db[_0xc933('0x94')][_0xc933('0x5d')]({'where':_0x5de9d1})[_0xc933('0x20')](function(_0x191cce){if(_0x191cce){return[_0x191cce,![]];}_0x24839b[_0xc933('0x93')]=_0x423074[_0xc933('0x65')]['threadId'];_0x24839b['externalUrl']=_0x423074[_0xc933('0x65')][_0xc933('0x95')];return db[_0xc933('0x94')][_0xc933('0x5e')](_0x24839b)[_0xc933('0x20')](function(_0x56d032){return[_0x56d032,!![]];});});}else{_0x5de9d1[_0xc933('0x93')]=null;}_0x5de9d1['ContactId']=_0x28dbf6['id'];return db[_0xc933('0x94')][_0xc933('0x5d')]({'where':_0x5de9d1})[_0xc933('0x20')](function(_0x21b064){if(_0x21b064){return[_0x21b064,![]];}return db['OpenchannelInteraction'][_0xc933('0x5e')](_0x24839b)[_0xc933('0x20')](function(_0x2946a7){return[_0x2946a7,!![]];});});}})[_0xc933('0x96')](function(_0x24fa4c,_0x262285){if(_0x24fa4c){_0x5bfd94=_0x262285;if(!_0x262285){var _0x3402e6={'from':(_0x137e02['contact'][_0xc933('0x91')]||'')+'\x20'+(_0x137e02[_0xc933('0x90')][_0xc933('0x92')]||'')};if(_0x423074['body'][_0xc933('0x93')]&&_0x423074[_0xc933('0x65')][_0xc933('0x97')]&&_0x423074[_0xc933('0x65')][_0xc933('0x93')]!=_0x423074['body'][_0xc933('0x97')]){_0x3402e6[_0xc933('0x93')]=_0x423074[_0xc933('0x65')][_0xc933('0x97')];}return _0x24fa4c[_0xc933('0x35')](_0x3402e6);}else{return _0x24fa4c;}}})[_0xc933('0x20')](function(_0x29dbc5){_0x137e02[_0xc933('0x98')]=_0x29dbc5['get']({'plain':!![]});_0x137e02[_0xc933('0x98')][_0xc933('0x99')]=_0x5bfd94;if(_0x137e02[_0xc933('0x98')][_0xc933('0x99')]){if(_0x137e02[_0xc933('0x8f')][_0xc933('0x9a')]){_0x137e02[_0xc933('0x89')][_0xc933('0x9b')]({'id':0x0,'priority':_0x137e02['applications'][_0xc933('0x4b')]+0x1,'app':_0xc933('0x9c'),'appdata':'unmanaged','interval':_0xc933('0x9d')});}}return db[_0xc933('0x9e')][_0xc933('0x5e')]({'body':_0x423074[_0xc933('0x65')][_0xc933('0x65')],'OpenchannelAccountId':_0x423074['params']['id'],'OpenchannelInteractionId':_0x29dbc5['id'],'direction':'in','ContactId':_0x137e02['contact']['id'],'AttachmentId':_0x423074['body'][_0xc933('0x9f')]});})['then'](function(_0x1f7709){_0x137e02[_0xc933('0x28')]=_0x1f7709;if(!_0x137e02[_0xc933('0x98')][_0xc933('0xa0')])return;return db[_0xc933('0xa1')][_0xc933('0x5d')]({'attributes':['id',_0xc933('0x3c')],'where':{'id':_0x137e02['interaction']['UserId']}});})[_0xc933('0x20')](function(_0x4b8a16){if(_0x4b8a16){_0x137e02[_0xc933('0x89')][_0xc933('0xa2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b8a16[_0xc933('0x3c')]+','+(_0x137e02[_0xc933('0x8f')]['waitForTheAssignedAgent']||0xa),'interval':_0xc933('0x9d')});}if(!_0x137e02['interaction'][_0xc933('0xa3')])return;return db[_0xc933('0xa4')][_0xc933('0x5d')]({'attributes':['id','name'],'where':{'id':_0x137e02[_0xc933('0x98')]['queueId']}});})[_0xc933('0x20')](function(_0x309872){if(_0x309872){_0x137e02[_0xc933('0x89')][_0xc933('0xa2')]({'id':0x0,'priority':0x1,'app':_0xc933('0xa5'),'appdata':_0x309872[_0xc933('0x3c')]+','+(_0x137e02['account'][_0xc933('0xa6')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc933('0xa7'),_0xc933('0xa8'),_0x137e02);})[_0xc933('0x20')](function(_0x5922bc){respondWithRpcPromise(_0xc933('0xa9'),_0xc933('0xa9'),{'event':'notify','message':_0x5922bc},client9002);return _0x5922bc;})[_0xc933('0x20')](respondWithResult(_0x59e515,null))['catch'](handleError(_0x59e515,null));};exports[_0xc933('0xaa')]=function(_0x32538e,_0x4b6c04){var _0x11e3c8=_0x32538e[_0xc933('0x66')]['id'];var _0x26638d=_0x32538e[_0xc933('0x65')];var _0x2ce7b2=0xc8;var _0x3df96c=null;return db[_0xc933('0xab')]['transaction']({'isolationLevel':db[_0xc933('0xab')][_0xc933('0xac')][_0xc933('0xad')][_0xc933('0xae')]},function(_0x432f4d){return db[_0xc933('0x40')][_0xc933('0x6c')]({'where':{'id':_0x11e3c8},'transaction':_0x432f4d})[_0xc933('0x20')](function(_0x40c1c1){if(_0x40c1c1){return db[_0xc933('0x87')][_0xc933('0x36')]({'where':{'OpenchannelAccountId':_0x11e3c8},'transaction':_0x432f4d})['then'](function(){var _0x153ea8=_[_0xc933('0x44')](_0x26638d,function(_0x3d42b7){_0x3d42b7[_0xc933('0x69')]=_0x11e3c8;return _0x3d42b7;});return db[_0xc933('0x87')][_0xc933('0xaf')](_0x153ea8,{'transaction':_0x432f4d});});}else{_0x2ce7b2=0x194;_0x3df96c=[];}});})[_0xc933('0x20')](function(){if(_0x2ce7b2!==0x194){return db['OpenchannelApplication'][_0xc933('0xb0')]({'where':{'OpenchannelAccountId':_0x11e3c8},'order':'priority'})[_0xc933('0x20')](function(_0x55b73b){_0x3df96c=_0x55b73b;});}})[_0xc933('0x29')](function(_0x5d463d){_0x2ce7b2=0x1f4;logger[_0xc933('0x26')](_0x5d463d['stack']);if(_0x5d463d['name']){delete _0x5d463d['name'];}_0x3df96c=_0x5d463d;})[_0xc933('0xb1')](function(){if(_0x3df96c===null){_0x4b6c04[_0xc933('0x3a')](_0x2ce7b2);}else{if(_0x2ce7b2===0x1f4){_0x4b6c04[_0xc933('0x2a')](_0x2ce7b2)['send'](_0x3df96c);}else{_0x4b6c04[_0xc933('0x2a')](_0x2ce7b2)['json'](_0x3df96c);}}});};exports[_0xc933('0xb2')]=function(_0x5426a7,_0x1682ef,_0x2ec4bd){var _0x98f1c3={};var _0x5c1a5e={};var _0x261d5f;var _0x3a8ddb;return db[_0xc933('0x40')][_0xc933('0x6c')]({'where':{'id':_0x5426a7[_0xc933('0x66')]['id']}})['then'](handleEntityNotFound(_0x1682ef,null))[_0xc933('0x20')](function(_0x4c8c3f){if(_0x4c8c3f){_0x261d5f=_0x4c8c3f;_0x5c1a5e[_0xc933('0x48')]=_[_0xc933('0x5b')](db[_0xc933('0x87')][_0xc933('0x5c')]);_0x5c1a5e['query']=_[_0xc933('0x5b')](_0x5426a7[_0xc933('0x45')]);_0x5c1a5e['filters']=_['intersection'](_0x5c1a5e[_0xc933('0x48')],_0x5c1a5e[_0xc933('0x45')]);_0x98f1c3[_0xc933('0x49')]=_[_0xc933('0x47')](_0x5c1a5e[_0xc933('0x48')],qs[_0xc933('0x4a')](_0x5426a7['query'][_0xc933('0x4a')]));_0x98f1c3['attributes']=_0x98f1c3['attributes']['length']?_0x98f1c3['attributes']:_0x5c1a5e['model'];_0x98f1c3[_0xc933('0x4e')]=qs[_0xc933('0x4f')](_0x5426a7[_0xc933('0x45')][_0xc933('0x4f')]);_0x98f1c3['where']=qs['filters'](_['pick'](_0x5426a7['query'],_0x5c1a5e[_0xc933('0x46')]));if(_0x5426a7[_0xc933('0x45')][_0xc933('0x52')]){_0x98f1c3[_0xc933('0x50')]=_['merge'](_0x98f1c3['where'],{'$or':_[_0xc933('0x44')](_0x98f1c3[_0xc933('0x49')],function(_0x5d1c2b){var _0x37622f={};_0x37622f[_0x5d1c2b]={'$like':'%'+_0x5426a7[_0xc933('0x45')][_0xc933('0x52')]+'%'};return _0x37622f;})});}_0x98f1c3=_[_0xc933('0x53')]({},_0x98f1c3,_0x5426a7['options']);return _0x261d5f[_0xc933('0xb2')](_0x98f1c3);}})[_0xc933('0x20')](function(_0x4b7d01){if(_0x4b7d01){_0x3a8ddb=_0x4b7d01[_0xc933('0x4b')];if(!_0x5426a7[_0xc933('0x45')][_0xc933('0x4c')](_0xc933('0x4d'))){_0x98f1c3[_0xc933('0x2d')]=qs['limit'](_0x5426a7['query'][_0xc933('0x2d')]);_0x98f1c3['offset']=qs[_0xc933('0x2f')](_0x5426a7['query'][_0xc933('0x2f')]);}return _0x261d5f[_0xc933('0xb2')](_0x98f1c3);}})[_0xc933('0x20')](function(_0x148acd){if(_0x148acd){return _0x148acd?{'count':_0x3a8ddb,'rows':_0x148acd}:null;}})['then'](respondWithResult(_0x1682ef,null))['catch'](handleError(_0x1682ef,null));};exports['getInteractions']=function(_0x14f5d2,_0x9b86d9,_0x5b03b8){var _0x111b68={'raw':![],'where':{}};var _0x2c997e={};var _0x5accbb={'count':0x0,'rows':[]};return db[_0xc933('0x40')][_0xc933('0x6c')]({'where':{'id':_0x14f5d2[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x9b86d9,null))[_0xc933('0x20')](function(_0x684c9a){if(_0x684c9a){_0x2c997e['model']=_['keys'](db[_0xc933('0x94')][_0xc933('0x5c')]);_0x2c997e[_0xc933('0x45')]=_[_0xc933('0x5b')](_0x14f5d2[_0xc933('0x45')]);_0x2c997e[_0xc933('0x46')]=_[_0xc933('0x47')](_0x2c997e[_0xc933('0x48')],_0x2c997e[_0xc933('0x45')]);_0x111b68['attributes']=_[_0xc933('0x47')](_0x2c997e[_0xc933('0x48')],qs['fields'](_0x14f5d2[_0xc933('0x45')][_0xc933('0x4a')]));_0x111b68[_0xc933('0x49')]=_0x111b68[_0xc933('0x49')]['length']?_0x111b68[_0xc933('0x49')]:_0x2c997e[_0xc933('0x48')];if(!_0x14f5d2[_0xc933('0x45')]['hasOwnProperty'](_0xc933('0x4d'))){_0x111b68[_0xc933('0x2d')]=qs[_0xc933('0x2d')](_0x14f5d2['query'][_0xc933('0x2d')]);_0x111b68[_0xc933('0x2f')]=qs[_0xc933('0x2f')](_0x14f5d2['query'][_0xc933('0x2f')]);}_0x111b68[_0xc933('0x4e')]=qs[_0xc933('0x4f')](_0x14f5d2[_0xc933('0x45')][_0xc933('0x4f')]);_0x111b68[_0xc933('0x50')]=qs['filters'](_[_0xc933('0x51')](_0x14f5d2['query'],_0x2c997e[_0xc933('0x46')]));_0x111b68['where'][_0xc933('0x69')]=_0x684c9a['id'];if(_0x14f5d2['query'][_0xc933('0x52')]){_0x111b68['where']=_[_0xc933('0x53')](_0x111b68[_0xc933('0x50')],{'$or':_[_0xc933('0x44')](_0x111b68[_0xc933('0x49')],function(_0x23d083){var _0x4a4bee={};_0x4a4bee[_0x23d083]={'$like':'%'+_0x14f5d2[_0xc933('0x45')][_0xc933('0x52')]+'%'};return _0x4a4bee;})});}_0x111b68=_[_0xc933('0x53')]({},_0x111b68,_0x14f5d2[_0xc933('0x54')]);return db[_0xc933('0x94')][_0xc933('0x2e')]({'where':_0x111b68[_0xc933('0x50')]})[_0xc933('0x20')](function(_0x3bd320){_0x5accbb[_0xc933('0x2e')]=_0x3bd320;if(_0x14f5d2[_0xc933('0x45')]['includeAll']){_0x111b68[_0xc933('0x56')]=[{'model':db['CmContact'],'as':_0xc933('0xb3'),'required':![]},{'model':db['User'],'as':_0xc933('0xb4'),'attributes':['name','fullname',_0xc933('0xb5')],'required':![]},{'model':db[_0xc933('0xb6')],'as':_0xc933('0xb7'),'attributes':['id',_0xc933('0x3c'),'color'],'where':_0x14f5d2[_0xc933('0x45')][_0xc933('0xb8')]?{'id':_0x14f5d2[_0xc933('0x45')][_0xc933('0xb8')]}:undefined,'required':_0x14f5d2['query'][_0xc933('0xb8')]?!![]:![]}];}return db[_0xc933('0x94')][_0xc933('0x57')](_0x111b68);})[_0xc933('0x20')](function(_0x4a261d){_0x5accbb[_0xc933('0x58')]=_0x4a261d;return _0x5accbb;});}})[_0xc933('0x20')](respondWithFilteredResult(_0x9b86d9,_0x111b68))[_0xc933('0x29')](handleError(_0x9b86d9,null));};exports[_0xc933('0xb9')]=function(_0x395e0a,_0x39e4ee,_0x2af5bf){return db['OpenchannelAccount'][_0xc933('0x5d')]({'where':{'id':_0x395e0a[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x39e4ee,null))[_0xc933('0x20')](function(_0x5569db){if(_0x5569db){return _0x5569db[_0xc933('0xb9')](_0x395e0a[_0xc933('0x65')][_0xc933('0x6e')],_[_0xc933('0xba')](_0x395e0a[_0xc933('0x65')],['ids','id'])||{})[_0xc933('0x96')](function(_0x28eba4){for(var _0x4d50bf=0x0;_0x4d50bf<_0x395e0a[_0xc933('0x65')][_0xc933('0x6e')][_0xc933('0x4b')];_0x4d50bf+=0x1){socket['emit'](_0xc933('0xbb'),{'UserId':Number(_0x395e0a[_0xc933('0x65')][_0xc933('0x6e')][_0x4d50bf]),'OpenchannelAccountId':Number(_0x395e0a[_0xc933('0x66')]['id'])});}return _0x28eba4;});}})[_0xc933('0x20')](respondWithResult(_0x39e4ee,null))[_0xc933('0x29')](handleError(_0x39e4ee,null));};exports[_0xc933('0xbc')]=function(_0xbaea1b,_0x12bff7,_0x48dd36){return db[_0xc933('0x40')][_0xc933('0x5d')]({'where':{'id':_0xbaea1b[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x12bff7,null))[_0xc933('0x20')](function(_0x35000f){if(_0x35000f){return _0x35000f['removeAgents'](_0xbaea1b['query'][_0xc933('0x6e')])[_0xc933('0x20')](function(){if(_[_0xc933('0xbd')](_0xbaea1b['query'][_0xc933('0x6e')])){for(var _0x207833=0x0;_0x207833<_0xbaea1b['query'][_0xc933('0x6e')][_0xc933('0x4b')];_0x207833+=0x1){socket[_0xc933('0xbe')]('userOpenchannelAccount:remove',{'UserId':Number(_0xbaea1b[_0xc933('0x45')][_0xc933('0x6e')][_0x207833]),'OpenchannelAccountId':Number(_0xbaea1b[_0xc933('0x66')]['id'])});}}else{socket[_0xc933('0xbe')]('userOpenchannelAccount:remove',{'UserId':Number(_0xbaea1b[_0xc933('0x45')]['ids']),'OpenchannelAccountId':Number(_0xbaea1b['params']['id'])});}});}})[_0xc933('0x20')](respondWithStatusCode(_0x12bff7,null))[_0xc933('0x29')](handleError(_0x12bff7,null));};exports[_0xc933('0xbf')]=function(_0x7fc2d,_0x2f9a09,_0x93e9ce){var _0x42634f={};var _0x48bed3={};var _0x42afc6;var _0x34c661;return db[_0xc933('0x40')][_0xc933('0x6c')]({'where':{'id':_0x7fc2d[_0xc933('0x66')]['id']}})[_0xc933('0x20')](handleEntityNotFound(_0x2f9a09,null))[_0xc933('0x20')](function(_0x4aacef){if(_0x4aacef){_0x42afc6=_0x4aacef;_0x48bed3[_0xc933('0x48')]=_[_0xc933('0x5b')](db['User'][_0xc933('0x5c')]);_0x48bed3[_0xc933('0x45')]=_[_0xc933('0x5b')](_0x7fc2d['query']);_0x48bed3['filters']=_[_0xc933('0x47')](_0x48bed3[_0xc933('0x48')],_0x48bed3[_0xc933('0x45')]);_0x42634f[_0xc933('0x49')]=_['intersection'](_0x48bed3[_0xc933('0x48')],qs[_0xc933('0x4a')](_0x7fc2d[_0xc933('0x45')][_0xc933('0x4a')]));_0x42634f[_0xc933('0x49')]=_0x42634f[_0xc933('0x49')][_0xc933('0x4b')]?_0x42634f[_0xc933('0x49')]:_0x48bed3[_0xc933('0x48')];_0x42634f[_0xc933('0x4e')]=qs[_0xc933('0x4f')](_0x7fc2d['query'][_0xc933('0x4f')]);_0x42634f[_0xc933('0x50')]=qs[_0xc933('0x46')](_[_0xc933('0x51')](_0x7fc2d[_0xc933('0x45')],_0x48bed3['filters']));if(_0x7fc2d[_0xc933('0x45')][_0xc933('0x52')]){_0x42634f[_0xc933('0x50')]=_[_0xc933('0x53')](_0x42634f['where'],{'$or':_[_0xc933('0x44')](_0x42634f[_0xc933('0x49')],function(_0x279533){var _0x24132b={};_0x24132b[_0x279533]={'$like':'%'+_0x7fc2d[_0xc933('0x45')]['filter']+'%'};return _0x24132b;})});}_0x42634f=_['merge']({},_0x42634f,_0x7fc2d[_0xc933('0x54')]);return _0x42afc6[_0xc933('0xbf')](_0x42634f);}})[_0xc933('0x20')](function(_0x4e0dde){if(_0x4e0dde){_0x34c661=_0x4e0dde['length'];if(!_0x7fc2d['query'][_0xc933('0x4c')](_0xc933('0x4d'))){_0x42634f[_0xc933('0x2d')]=qs['limit'](_0x7fc2d[_0xc933('0x45')][_0xc933('0x2d')]);_0x42634f['offset']=qs[_0xc933('0x2f')](_0x7fc2d[_0xc933('0x45')][_0xc933('0x2f')]);}return _0x42afc6[_0xc933('0xbf')](_0x42634f);}})[_0xc933('0x20')](function(_0x35c9ab){if(_0x35c9ab){return _0x35c9ab?{'count':_0x34c661,'rows':_0x35c9ab}:null;}})[_0xc933('0x20')](respondWithResult(_0x2f9a09,null))[_0xc933('0x29')](handleError(_0x2f9a09,null));};exports[_0xc933('0x3d')]=function(_0x2cc6d0,_0x34c218,_0x4748f9){var _0x46fe62,_0x58a662,_0x4a38d0;if(_['isNil'](_0x2cc6d0[_0xc933('0x65')]['body'])||_0x2cc6d0[_0xc933('0x65')][_0xc933('0x65')]===''){throw new db[(_0xc933('0x7d'))][(_0xc933('0x75'))](_0xc933('0xc0'));}if(_[_0xc933('0x7c')](_0x2cc6d0[_0xc933('0x65')]['to'])){}_0x46fe62=_0x2cc6d0[_0xc933('0x65')]['to'];return db[_0xc933('0x40')][_0xc933('0x6c')]({'where':{'id':_0x2cc6d0[_0xc933('0x66')]['id']}})['then'](handleEntityNotFound(_0x34c218,null))[_0xc933('0x20')](function(_0x175165){if(_0x175165){return db[_0xc933('0x40')][_0xc933('0x5d')]({'where':{'id':_0x175165['id']},'include':[{'model':db[_0xc933('0x84')],'as':_0xc933('0x88'),'include':[{'model':db[_0xc933('0x74')],'as':_0xc933('0x85'),'where':{[_0x175165[_0xc933('0x7f')]]:_0x46fe62},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xc933('0x20')](handleEntityNotFound(_0x34c218,null))['then'](function(_0x1b15f8){if(_0x1b15f8&&_0x1b15f8[_0xc933('0x88')]){_0x58a662=_0x1b15f8[_0xc933('0x37')]({'plain':!![]});if(_0x58a662['List']&&_0x58a662[_0xc933('0x88')][_0xc933('0x85')][_0xc933('0x4b')]){return _0x58a662['List'][_0xc933('0x85')][0x0];}return db['CmContact'][_0xc933('0x5e')](_[_0xc933('0x18')](_0x2cc6d0[_0xc933('0x65')],{'firstName':_0x46fe62,[_0x1b15f8[_0xc933('0x7f')]]:_0x46fe62,'phone':_0x46fe62,'ListId':_0x58a662[_0xc933('0x7b')]}));}})[_0xc933('0x20')](handleEntityNotFound(_0x34c218,null))[_0xc933('0x20')](function(_0x56a0d6){if(_0x56a0d6){_0x4a38d0=_0x56a0d6;return db['OpenchannelInteraction'][_0xc933('0x5d')]({'where':{'ContactId':_0x4a38d0['id'],'closed':![],'OpenchannelAccountId':_0x58a662['id']}})[_0xc933('0x20')](function(_0x4818dc){if(_0x4818dc){return[_0x4818dc,![]];}return db[_0xc933('0x94')][_0xc933('0x5e')]({'UserId':_0x2cc6d0[_0xc933('0x5f')]['id'],'ContactId':_0x4a38d0['id'],'OpenchannelAccountId':_0x58a662['id'],'lastMsgDirection':'out','firstMsgDirection':_0xc933('0xc1'),'Messages':[_[_0xc933('0x53')](_0x2cc6d0['body'],{'read':![],'body':_0x2cc6d0[_0xc933('0x65')][_0xc933('0x65')],'OpenchannelAccountId':_0x58a662['id'],'UserId':_0x2cc6d0[_0xc933('0x5f')]['id'],'ContactId':_0x4a38d0['id']})]},{'include':[{'model':db[_0xc933('0x9e')],'as':_0xc933('0xc2')}]})[_0xc933('0x20')](function(_0x202845){return[_0x202845,!![]];});});}})[_0xc933('0x96')](function(_0x4bdf26,_0x4bdf17){if(_0x4bdf17){return _0x4bdf26;}return db[_0xc933('0x9e')][_0xc933('0x5e')](_[_0xc933('0x53')](_0x2cc6d0[_0xc933('0x65')],{'read':![],'body':_0x2cc6d0[_0xc933('0x65')][_0xc933('0x65')],'OpenchannelAccountId':_0x58a662['id'],'OpenchannelInteractionId':_0x4bdf26['id'],'UserId':_0x2cc6d0['user']['id'],'ContactId':_0x4a38d0['id']}))[_0xc933('0x20')](function(_0x1177b5){_0x4bdf26[_0xc933('0xc3')][_0xc933('0xc2')]=[];_0x4bdf26[_0xc933('0xc3')][_0xc933('0xc2')][_0xc933('0x9b')](_0x1177b5[_0xc933('0xc3')]);return _0x4bdf26;});});}})[_0xc933('0x20')](respondWithResult(_0x34c218,null))[_0xc933('0x29')](handleError(_0x34c218,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index aec2fbc..af9ac5f 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 _0x4ea3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x779e96,_0x12508f){var _0x3ce41e=function(_0x4c052){while(--_0x4c052){_0x779e96['push'](_0x779e96['shift']());}};_0x3ce41e(++_0x12508f);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x34ea('0x0'));var OpenchannelAccount=require(_0x34ea('0x1'))['db'][_0x34ea('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x34ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x34ea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x269d4c){return function(_0x571f1b,_0x5e5a84,_0x2ce955){OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c+':'+_0x571f1b['id'],_0x571f1b);OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c,_0x571f1b);_0x2ce955(null);};}for(var e in events){if(events[_0x34ea('0x6')](e)){var event=events[e];OpenchannelAccount[_0x34ea('0x7')](e,emitEvent(event));}}module[_0x34ea('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xa75b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x26063d,_0x5c9abc){var _0x4b2809=function(_0x3e623e){while(--_0x3e623e){_0x26063d['push'](_0x26063d['shift']());}};_0x4b2809(++_0x5c9abc);}(_0xa75b,0x170));var _0xba75=function(_0x2e1d14,_0x28d1c1){_0x2e1d14=_0x2e1d14-0x0;var _0x3fe405=_0xa75b[_0x2e1d14];return _0x3fe405;};'use strict';var EventEmitter=require(_0xba75('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xba75('0x1')](0x0);var events={'afterCreate':_0xba75('0x2'),'afterUpdate':_0xba75('0x3'),'afterDestroy':_0xba75('0x4')};function emitEvent(_0x1760c0){return function(_0x336606,_0x152269,_0x398bd5){OpenchannelAccountEvents[_0xba75('0x5')](_0x1760c0+':'+_0x336606['id'],_0x336606);OpenchannelAccountEvents[_0xba75('0x5')](_0x1760c0,_0x336606);_0x398bd5(null);};}for(var e in events){if(events[_0xba75('0x6')](e)){var event=events[e];OpenchannelAccount[_0xba75('0x7')](e,emitEvent(event));}}module[_0xba75('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index c664fe9..fbac767 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(_0x39dc12,_0x553009){var _0x509fae=function(_0x96604d){while(--_0x96604d){_0x39dc12['push'](_0x39dc12['shift']());}};_0x509fae(++_0x553009);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x424332,_0x30d8fd){var _0x19f650=function(_0x57c3da){while(--_0x57c3da){_0x424332['push'](_0x424332['shift']());}};_0x19f650(++_0x30d8fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 3163e00..9866dc2 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 _0x3c81=['bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2ae618,_0x3e835f){var _0x504260=function(_0xb1031c){while(--_0xb1031c){_0x2ae618['push'](_0x2ae618['shift']());}};_0x504260(++_0x3e835f);}(_0x3c81,0x102));var _0x13c8=function(_0x331ed6,_0x2ad2c8){_0x331ed6=_0x331ed6-0x0;var _0x1b125b=_0x3c81[_0x331ed6];return _0x1b125b;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});config[_0x13c8('0x9')]=_[_0x13c8('0xa')](config['redis'],{'host':_0x13c8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13c8('0x9')]));require(_0x13c8('0xc'))[_0x13c8('0xd')](socket);function respondWithRpcPromise(_0x30b4d6,_0xaa58b6,_0x13c717){return new BPromise(function(_0x29074d,_0x2ce95a){return client[_0x13c8('0xe')](_0x30b4d6,_0x13c717)[_0x13c8('0xf')](function(_0x3ca0a6){logger[_0x13c8('0x10')](_0x13c8('0x11'),_0xaa58b6,_0x13c8('0x12'));logger['debug'](_0x13c8('0x13'),_0xaa58b6,_0x13c8('0x12'),JSON[_0x13c8('0x14')](_0x3ca0a6));if(_0x3ca0a6[_0x13c8('0x15')]){if(_0x3ca0a6['error'][_0x13c8('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xaa58b6,_0x3ca0a6['error'][_0x13c8('0x17')]);return _0x2ce95a(_0x3ca0a6['error'][_0x13c8('0x17')]);}logger[_0x13c8('0x15')](_0x13c8('0x11'),_0xaa58b6,_0x3ca0a6[_0x13c8('0x15')]['message']);return _0x29074d(_0x3ca0a6[_0x13c8('0x15')][_0x13c8('0x17')]);}else{logger[_0x13c8('0x10')](_0x13c8('0x11'),_0xaa58b6,_0x13c8('0x12'));_0x29074d(_0x3ca0a6[_0x13c8('0x18')][_0x13c8('0x17')]);}})[_0x13c8('0x19')](function(_0x34fbc0){logger[_0x13c8('0x15')](_0x13c8('0x11'),_0xaa58b6,_0x34fbc0);_0x2ce95a(_0x34fbc0);});});} \ No newline at end of file +var _0x7d25=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','redis','defaults','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xb33744,_0x1f0251){var _0x4472a0=function(_0x4a323c){while(--_0x4a323c){_0xb33744['push'](_0xb33744['shift']());}};_0x4472a0(++_0x1f0251);}(_0x7d25,0x8a));var _0x57d2=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x7d25[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});config[_0x57d2('0x8')]=_[_0x57d2('0x9')](config[_0x57d2('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57d2('0x8')]));require('./openchannelAccount.socket')[_0x57d2('0xa')](socket);function respondWithRpcPromise(_0x5153c2,_0xa04872,_0x485438){return new BPromise(function(_0x429301,_0x1a86db){return client[_0x57d2('0xb')](_0x5153c2,_0x485438)[_0x57d2('0xc')](function(_0x2e8e12){logger[_0x57d2('0xd')](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));logger[_0x57d2('0x10')](_0x57d2('0x11'),_0xa04872,_0x57d2('0xf'),JSON[_0x57d2('0x12')](_0x2e8e12));if(_0x2e8e12[_0x57d2('0x13')]){if(_0x2e8e12[_0x57d2('0x13')][_0x57d2('0x14')]===0x1f4){logger[_0x57d2('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x1a86db(_0x2e8e12[_0x57d2('0x13')]['message']);}logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x429301(_0x2e8e12['error'][_0x57d2('0x15')]);}else{logger['info'](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));_0x429301(_0x2e8e12[_0x57d2('0x16')]['message']);}})['catch'](function(_0xbaeda8){logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0xbaeda8);_0x1a86db(_0xbaeda8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 70fbee5..4427d04 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 _0x407f=['length','openchannelAccount:','update','emit','removeListener','register'];(function(_0x23b478,_0x3e738a){var _0x11648e=function(_0x5be1f4){while(--_0x5be1f4){_0x23b478['push'](_0x23b478['shift']());}};_0x11648e(++_0x3e738a);}(_0x407f,0xc2));var _0xf407=function(_0x475dce,_0x1754ff){_0x475dce=_0x475dce-0x0;var _0x40687a=_0x407f[_0x475dce];return _0x40687a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove',_0xf407('0x0')];function createListener(_0x2fcdc7,_0x6a58dd){return function(_0x1ec297){_0x6a58dd[_0xf407('0x1')](_0x2fcdc7,_0x1ec297);};}function removeListener(_0x886ba,_0x185726){return function(){OpenchannelAccountEvents[_0xf407('0x2')](_0x886ba,_0x185726);};}exports[_0xf407('0x3')]=function(_0x160f5c){for(var _0x438076=0x0,_0x2bce9d=events[_0xf407('0x4')];_0x438076<_0x2bce9d;_0x438076++){var _0x3ac774=events[_0x438076];var _0x38ee37=createListener(_0xf407('0x5')+_0x3ac774,_0x160f5c);OpenchannelAccountEvents['on'](_0x3ac774,_0x38ee37);}}; \ No newline at end of file +var _0xfecd=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','remove','update'];(function(_0x3d3d60,_0x249f5a){var _0xfe2809=function(_0x584ef2){while(--_0x584ef2){_0x3d3d60['push'](_0x3d3d60['shift']());}};_0xfe2809(++_0x249f5a);}(_0xfecd,0x107));var _0xdfec=function(_0x3942e8,_0xd52464){_0x3942e8=_0x3942e8-0x0;var _0x2d98cf=_0xfecd[_0x3942e8];return _0x2d98cf;};'use strict';var OpenchannelAccountEvents=require(_0xdfec('0x0'));var events=['save',_0xdfec('0x1'),_0xdfec('0x2')];function createListener(_0x5a23aa,_0x412b00){return function(_0x2fb9f4){_0x412b00['emit'](_0x5a23aa,_0x2fb9f4);};}function removeListener(_0x46bda1,_0x51658b){return function(){OpenchannelAccountEvents[_0xdfec('0x3')](_0x46bda1,_0x51658b);};}exports[_0xdfec('0x4')]=function(_0x10ca9b){for(var _0x4d0fa6=0x0,_0x2f35a8=events[_0xdfec('0x5')];_0x4d0fa6<_0x2f35a8;_0x4d0fa6++){var _0x40782c=events[_0x4d0fa6];var _0x81175c=createListener(_0xdfec('0x6')+_0x40782c,_0x10ca9b);OpenchannelAccountEvents['on'](_0x40782c,_0x81175c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4781713..7584523 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 _0x5432=['isAuthenticated','post','create','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x5432,0x128));var _0x2543=function(_0x22dfb8,_0xe41a3c){_0x22dfb8=_0x22dfb8-0x0;var _0x7ec95a=_0x5432[_0x22dfb8];return _0x7ec95a;};'use strict';var multer=require('multer');var util=require(_0x2543('0x0'));var path=require('path');var timeout=require(_0x2543('0x1'));var express=require(_0x2543('0x2'));var router=express[_0x2543('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2543('0x4'));var config=require(_0x2543('0x5'));var controller=require(_0x2543('0x6'));router[_0x2543('0x7')]('/',auth[_0x2543('0x8')](),controller['index']);router[_0x2543('0x7')]('/:id',auth[_0x2543('0x8')](),controller['show']);router[_0x2543('0x9')]('/',auth['isAuthenticated'](),controller[_0x2543('0xa')]);router[_0x2543('0xb')](_0x2543('0xc'),auth[_0x2543('0x8')](),controller['update']);router[_0x2543('0xd')](_0x2543('0xc'),auth[_0x2543('0x8')](),controller[_0x2543('0xe')]);module[_0x2543('0xf')]=router; \ No newline at end of file +var _0x75f7=['express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x49ab4d,_0x56ef29){var _0x678fed=function(_0x2566d0){while(--_0x2566d0){_0x49ab4d['push'](_0x49ab4d['shift']());}};_0x678fed(++_0x56ef29);}(_0x75f7,0x1ea));var _0x775f=function(_0x260915,_0x1450e7){_0x260915=_0x260915-0x0;var _0x301463=_0x75f7[_0x260915];return _0x301463;};'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('fs-extra');var auth=require(_0x775f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x775f('0x7'));var controller=require(_0x775f('0x8'));router[_0x775f('0x9')]('/',auth[_0x775f('0xa')](),controller[_0x775f('0xb')]);router[_0x775f('0x9')](_0x775f('0xc'),auth[_0x775f('0xa')](),controller[_0x775f('0xd')]);router[_0x775f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x775f('0xf')]('/:id',auth[_0x775f('0xa')](),controller[_0x775f('0x10')]);router[_0x775f('0x11')](_0x775f('0xc'),auth[_0x775f('0xa')](),controller['destroy']);module[_0x775f('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 6512ef6..de364e1 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 _0x8af5=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x10ef65,_0x5eb18a){var _0x5d5fc5=function(_0x23b623){while(--_0x23b623){_0x10ef65['push'](_0x10ef65['shift']());}};_0x5d5fc5(++_0x5eb18a);}(_0x8af5,0x87));var _0x58af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8af5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x58af('0x0'));module[_0x58af('0x1')]={'priority':{'type':Sequelize[_0x58af('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x58af('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x58af('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x58af('0x3')],'defaultValue':_0x58af('0x5')}}; \ No newline at end of file +var _0x84cf=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0x3f374c,_0xa8508f){var _0x40180b=function(_0x17f97c){while(--_0x17f97c){_0x3f374c['push'](_0x3f374c['shift']());}};_0x40180b(++_0xa8508f);}(_0x84cf,0x13d));var _0xf84c=function(_0x258b00,_0x28e9b0){_0x258b00=_0x258b00-0x0;var _0x3ca676=_0x84cf[_0x258b00];return _0x3ca676;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xf84c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xf84c('0x1')],'allowNull':![],'defaultValue':_0xf84c('0x2')},'appdata':{'type':Sequelize[_0xf84c('0x3')]()},'description':{'type':Sequelize[_0xf84c('0x1')]},'interval':{'type':Sequelize[_0xf84c('0x1')],'defaultValue':_0xf84c('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 1b20ecb..6a16780 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 _0x88b9=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x2dcf6e,_0x1e971f){var _0x5c9d78=function(_0x57c1d7){while(--_0x57c1d7){_0x2dcf6e['push'](_0x2dcf6e['shift']());}};_0x5c9d78(++_0x1e971f);}(_0x88b9,0xc2));var _0x988b=function(_0xb543b7,_0x2f90b3){_0xb543b7=_0xb543b7-0x0;var _0x356096=_0x88b9[_0xb543b7];return _0x356096;};'use strict';var emlformat=require(_0x988b('0x0'));var rimraf=require(_0x988b('0x1'));var zipdir=require(_0x988b('0x2'));var jsonpatch=require(_0x988b('0x3'));var rp=require(_0x988b('0x4'));var moment=require(_0x988b('0x5'));var BPromise=require(_0x988b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x988b('0x7'));var sox=require(_0x988b('0x8'));var csv=require(_0x988b('0x9'));var ejs=require(_0x988b('0xa'));var fs=require('fs');var fs_extra=require(_0x988b('0xb'));var _=require(_0x988b('0xc'));var squel=require(_0x988b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x988b('0x9'));var querystring=require(_0x988b('0xe'));var Papa=require(_0x988b('0xf'));var Redis=require(_0x988b('0x10'));var authService=require(_0x988b('0x11'));var qs=require(_0x988b('0x12'));var as=require(_0x988b('0x13'));var hardwareService=require(_0x988b('0x14'));var logger=require(_0x988b('0x15'))(_0x988b('0x16'));var utils=require('../../config/utils');var config=require(_0x988b('0x17'));var licenseUtil=require(_0x988b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2be2c8,_0x2b0947){_0x2b0947=_0x2b0947||0xcc;return function(_0x2fd140){if(_0x2fd140){return _0x2be2c8[_0x988b('0x19')](_0x2b0947);}return _0x2be2c8[_0x988b('0x1a')](_0x2b0947)[_0x988b('0x1b')]();};}function respondWithResult(_0x4bda55,_0x248e2a){_0x248e2a=_0x248e2a||0xc8;return function(_0x2b0680){if(_0x2b0680){return _0x4bda55[_0x988b('0x1a')](_0x248e2a)['json'](_0x2b0680);}};}function respondWithFilteredResult(_0x24ced5,_0x562ba7){return function(_0x513db5){if(_0x513db5){var _0x528919=typeof _0x562ba7[_0x988b('0x1c')]===_0x988b('0x1d')&&typeof _0x562ba7[_0x988b('0x1e')]===_0x988b('0x1d');var _0x17dd3d=_0x513db5[_0x988b('0x1f')];var _0x1c7b68=_0x528919?0x0:_0x562ba7[_0x988b('0x1c')];var _0x542c84=_0x528919?_0x513db5[_0x988b('0x1f')]:_0x562ba7[_0x988b('0x1c')]+_0x562ba7[_0x988b('0x1e')];var _0x813daf;if(_0x542c84>=_0x17dd3d){_0x542c84=_0x17dd3d;_0x813daf=0xc8;}else{_0x813daf=0xce;}_0x24ced5[_0x988b('0x1a')](_0x813daf);return _0x24ced5[_0x988b('0x20')](_0x988b('0x21'),_0x1c7b68+'-'+_0x542c84+'/'+_0x17dd3d)[_0x988b('0x22')](_0x513db5);}return null;};}function patchUpdates(_0x15c38f){return function(_0x51c31e){try{jsonpatch['apply'](_0x51c31e,_0x15c38f,!![]);}catch(_0xafc75e){return BPromise['reject'](_0xafc75e);}return _0x51c31e['save']();};}function saveUpdates(_0x9c22b0,_0x25420f){return function(_0x36d114){if(_0x36d114){return _0x36d114['update'](_0x9c22b0)['then'](function(_0x17ba0b){return _0x17ba0b;});}return null;};}function removeEntity(_0x1cc165,_0x2f4310){return function(_0x391780){if(_0x391780){return _0x391780[_0x988b('0x23')]()[_0x988b('0x24')](function(){_0x1cc165[_0x988b('0x1a')](0xcc)[_0x988b('0x1b')]();});}};}function handleEntityNotFound(_0x81fdee,_0x3517f7){return function(_0x294f58){if(!_0x294f58){_0x81fdee[_0x988b('0x19')](0x194);}return _0x294f58;};}function handleError(_0x57f54d,_0x4d648f){_0x4d648f=_0x4d648f||0x1f4;return function(_0x564c07){logger[_0x988b('0x25')](_0x564c07[_0x988b('0x26')]);if(_0x564c07['name']){delete _0x564c07[_0x988b('0x27')];}_0x57f54d['status'](_0x4d648f)[_0x988b('0x28')](_0x564c07);};}exports[_0x988b('0x29')]=function(_0xb72b9e,_0x10bc00){var _0x193cf7={},_0x36aa68={},_0x1f3f12={'count':0x0,'rows':[]};var _0x5c42ed=_[_0x988b('0x2a')](db[_0x988b('0x2b')][_0x988b('0x2c')],function(_0x1ff82c){return{'name':_0x1ff82c[_0x988b('0x2d')],'type':_0x1ff82c[_0x988b('0x2e')]['key']};});_0x36aa68['model']=_[_0x988b('0x2a')](_0x5c42ed,'name');_0x36aa68[_0x988b('0x2f')]=_[_0x988b('0x30')](_0xb72b9e[_0x988b('0x2f')]);_0x36aa68[_0x988b('0x31')]=_[_0x988b('0x32')](_0x36aa68['model'],_0x36aa68['query']);_0x193cf7[_0x988b('0x33')]=_[_0x988b('0x32')](_0x36aa68[_0x988b('0x34')],qs['fields'](_0xb72b9e[_0x988b('0x2f')][_0x988b('0x35')]));_0x193cf7['attributes']=_0x193cf7[_0x988b('0x33')][_0x988b('0x36')]?_0x193cf7['attributes']:_0x36aa68[_0x988b('0x34')];if(!_0xb72b9e[_0x988b('0x2f')]['hasOwnProperty'](_0x988b('0x37'))){_0x193cf7['limit']=qs[_0x988b('0x1e')](_0xb72b9e[_0x988b('0x2f')][_0x988b('0x1e')]);_0x193cf7['offset']=qs['offset'](_0xb72b9e[_0x988b('0x2f')][_0x988b('0x1c')]);}_0x193cf7[_0x988b('0x38')]=qs['sort'](_0xb72b9e[_0x988b('0x2f')][_0x988b('0x39')]);_0x193cf7[_0x988b('0x3a')]=qs[_0x988b('0x31')](_['pick'](_0xb72b9e[_0x988b('0x2f')],_0x36aa68[_0x988b('0x31')]),_0x5c42ed);if(_0xb72b9e['query'][_0x988b('0x3b')]){_0x193cf7[_0x988b('0x3a')]=_[_0x988b('0x3c')](_0x193cf7[_0x988b('0x3a')],{'$or':_['map'](_0x5c42ed,function(_0x3d4356){if(_0x3d4356[_0x988b('0x2e')]!=='VIRTUAL'){var _0x2aa05f={};_0x2aa05f[_0x3d4356['name']]={'$like':'%'+_0xb72b9e[_0x988b('0x2f')][_0x988b('0x3b')]+'%'};return _0x2aa05f;}})});}_0x193cf7=_[_0x988b('0x3c')]({},_0x193cf7,_0xb72b9e[_0x988b('0x3d')]);var _0x4709bb={'where':_0x193cf7[_0x988b('0x3a')]};return db[_0x988b('0x2b')][_0x988b('0x1f')](_0x4709bb)[_0x988b('0x24')](function(_0x2b1d6d){_0x1f3f12[_0x988b('0x1f')]=_0x2b1d6d;if(_0xb72b9e[_0x988b('0x2f')]['includeAll']){_0x193cf7[_0x988b('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x988b('0x3f')](_0x193cf7);})[_0x988b('0x24')](function(_0xebc829){_0x1f3f12[_0x988b('0x40')]=_0xebc829;return _0x1f3f12;})[_0x988b('0x24')](respondWithFilteredResult(_0x10bc00,_0x193cf7))[_0x988b('0x41')](handleError(_0x10bc00,null));};exports[_0x988b('0x42')]=function(_0x174b05,_0x4978d5){var _0x11de06={'raw':!![],'where':{'id':_0x174b05[_0x988b('0x43')]['id']}},_0x21709c={};_0x21709c[_0x988b('0x34')]=_[_0x988b('0x30')](db[_0x988b('0x2b')][_0x988b('0x2c')]);_0x21709c[_0x988b('0x2f')]=_[_0x988b('0x30')](_0x174b05[_0x988b('0x2f')]);_0x21709c['filters']=_[_0x988b('0x32')](_0x21709c[_0x988b('0x34')],_0x21709c['query']);_0x11de06[_0x988b('0x33')]=_[_0x988b('0x32')](_0x21709c['model'],qs[_0x988b('0x35')](_0x174b05[_0x988b('0x2f')][_0x988b('0x35')]));_0x11de06[_0x988b('0x33')]=_0x11de06[_0x988b('0x33')][_0x988b('0x36')]?_0x11de06['attributes']:_0x21709c['model'];if(_0x174b05[_0x988b('0x2f')][_0x988b('0x44')]){_0x11de06[_0x988b('0x3e')]=[{'all':!![]}];}_0x11de06=_[_0x988b('0x3c')]({},_0x11de06,_0x174b05[_0x988b('0x3d')]);return db[_0x988b('0x2b')]['find'](_0x11de06)[_0x988b('0x24')](handleEntityNotFound(_0x4978d5,null))['then'](respondWithResult(_0x4978d5,null))[_0x988b('0x41')](handleError(_0x4978d5,null));};exports['create']=function(_0x1a6ec4,_0x559848){return db[_0x988b('0x2b')][_0x988b('0x45')](_0x1a6ec4[_0x988b('0x46')],{})[_0x988b('0x24')](respondWithResult(_0x559848,0xc9))[_0x988b('0x41')](handleError(_0x559848,null));};exports[_0x988b('0x47')]=function(_0x5e3414,_0x6aaa0a){if(_0x5e3414['body']['id']){delete _0x5e3414[_0x988b('0x46')]['id'];}return db[_0x988b('0x2b')][_0x988b('0x48')]({'where':{'id':_0x5e3414[_0x988b('0x43')]['id']}})['then'](handleEntityNotFound(_0x6aaa0a,null))[_0x988b('0x24')](saveUpdates(_0x5e3414[_0x988b('0x46')],null))[_0x988b('0x24')](respondWithResult(_0x6aaa0a,null))[_0x988b('0x41')](handleError(_0x6aaa0a,null));};exports['destroy']=function(_0x4d9435,_0x51ff01){return db['OpenchannelApplication']['find']({'where':{'id':_0x4d9435[_0x988b('0x43')]['id']}})[_0x988b('0x24')](handleEntityNotFound(_0x51ff01,null))[_0x988b('0x24')](removeEntity(_0x51ff01,null))[_0x988b('0x41')](handleError(_0x51ff01,null));}; \ No newline at end of file +var _0xf99d=['merge','VIRTUAL','options','then','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','limit','undefined','count','offset','set','json','save','update','destroy','end','error','stack','name','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xf99d,0x1bf));var _0xdf99=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xf99d[_0x166742];return _0xb7814a;};'use strict';var emlformat=require(_0xdf99('0x0'));var rimraf=require(_0xdf99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf99('0x2'));var rp=require(_0xdf99('0x3'));var moment=require(_0xdf99('0x4'));var BPromise=require(_0xdf99('0x5'));var Mustache=require(_0xdf99('0x6'));var util=require(_0xdf99('0x7'));var path=require('path');var sox=require(_0xdf99('0x8'));var csv=require(_0xdf99('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf99('0xa'));var squel=require(_0xdf99('0xb'));var crypto=require('crypto');var jsforce=require(_0xdf99('0xc'));var deskjs=require(_0xdf99('0xd'));var toCsv=require(_0xdf99('0x9'));var querystring=require(_0xdf99('0xe'));var Papa=require(_0xdf99('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdf99('0x10'));var as=require(_0xdf99('0x11'));var hardwareService=require(_0xdf99('0x12'));var logger=require(_0xdf99('0x13'))(_0xdf99('0x14'));var utils=require(_0xdf99('0x15'));var config=require(_0xdf99('0x16'));var licenseUtil=require(_0xdf99('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26e19a,_0x53dd17){_0x53dd17=_0x53dd17||0xcc;return function(_0x2fbc54){if(_0x2fbc54){return _0x26e19a[_0xdf99('0x18')](_0x53dd17);}return _0x26e19a[_0xdf99('0x19')](_0x53dd17)['end']();};}function respondWithResult(_0x133ed0,_0x3f5ae7){_0x3f5ae7=_0x3f5ae7||0xc8;return function(_0x54efd9){if(_0x54efd9){return _0x133ed0[_0xdf99('0x19')](_0x3f5ae7)['json'](_0x54efd9);}};}function respondWithFilteredResult(_0xc7e65c,_0x306916){return function(_0x20c847){if(_0x20c847){var _0x1689e3=typeof _0x306916['offset']==='undefined'&&typeof _0x306916[_0xdf99('0x1a')]===_0xdf99('0x1b');var _0x37cb84=_0x20c847['count'];var _0x48f0bf=_0x1689e3?0x0:_0x306916['offset'];var _0x4af2be=_0x1689e3?_0x20c847[_0xdf99('0x1c')]:_0x306916[_0xdf99('0x1d')]+_0x306916[_0xdf99('0x1a')];var _0x221572;if(_0x4af2be>=_0x37cb84){_0x4af2be=_0x37cb84;_0x221572=0xc8;}else{_0x221572=0xce;}_0xc7e65c[_0xdf99('0x19')](_0x221572);return _0xc7e65c[_0xdf99('0x1e')]('Content-Range',_0x48f0bf+'-'+_0x4af2be+'/'+_0x37cb84)[_0xdf99('0x1f')](_0x20c847);}return null;};}function patchUpdates(_0x14b0aa){return function(_0xfb3da1){try{jsonpatch['apply'](_0xfb3da1,_0x14b0aa,!![]);}catch(_0x4d6cf7){return BPromise['reject'](_0x4d6cf7);}return _0xfb3da1[_0xdf99('0x20')]();};}function saveUpdates(_0x39f8a2,_0x2524df){return function(_0x378354){if(_0x378354){return _0x378354[_0xdf99('0x21')](_0x39f8a2)['then'](function(_0x20c4de){return _0x20c4de;});}return null;};}function removeEntity(_0x4e8799,_0x4fe887){return function(_0x57c046){if(_0x57c046){return _0x57c046[_0xdf99('0x22')]()['then'](function(){_0x4e8799[_0xdf99('0x19')](0xcc)[_0xdf99('0x23')]();});}};}function handleEntityNotFound(_0x45aada,_0x4ddcc8){return function(_0x2d187e){if(!_0x2d187e){_0x45aada['sendStatus'](0x194);}return _0x2d187e;};}function handleError(_0x5ebeca,_0x5b1bd4){_0x5b1bd4=_0x5b1bd4||0x1f4;return function(_0x2193a1){logger[_0xdf99('0x24')](_0x2193a1[_0xdf99('0x25')]);if(_0x2193a1[_0xdf99('0x26')]){delete _0x2193a1[_0xdf99('0x26')];}_0x5ebeca[_0xdf99('0x19')](_0x5b1bd4)['send'](_0x2193a1);};}exports['index']=function(_0x2e26f3,_0x47b020){var _0xf196b0={},_0x222e6a={},_0x2c3520={'count':0x0,'rows':[]};var _0x3b4685=_[_0xdf99('0x27')](db[_0xdf99('0x28')][_0xdf99('0x29')],function(_0x182bd8){return{'name':_0x182bd8[_0xdf99('0x2a')],'type':_0x182bd8[_0xdf99('0x2b')][_0xdf99('0x2c')]};});_0x222e6a[_0xdf99('0x2d')]=_['map'](_0x3b4685,_0xdf99('0x26'));_0x222e6a[_0xdf99('0x2e')]=_[_0xdf99('0x2f')](_0x2e26f3['query']);_0x222e6a['filters']=_[_0xdf99('0x30')](_0x222e6a[_0xdf99('0x2d')],_0x222e6a['query']);_0xf196b0[_0xdf99('0x31')]=_[_0xdf99('0x30')](_0x222e6a[_0xdf99('0x2d')],qs[_0xdf99('0x32')](_0x2e26f3[_0xdf99('0x2e')][_0xdf99('0x32')]));_0xf196b0[_0xdf99('0x31')]=_0xf196b0['attributes']['length']?_0xf196b0[_0xdf99('0x31')]:_0x222e6a['model'];if(!_0x2e26f3['query'][_0xdf99('0x33')]('nolimit')){_0xf196b0[_0xdf99('0x1a')]=qs[_0xdf99('0x1a')](_0x2e26f3[_0xdf99('0x2e')][_0xdf99('0x1a')]);_0xf196b0[_0xdf99('0x1d')]=qs['offset'](_0x2e26f3[_0xdf99('0x2e')][_0xdf99('0x1d')]);}_0xf196b0[_0xdf99('0x34')]=qs['sort'](_0x2e26f3[_0xdf99('0x2e')][_0xdf99('0x35')]);_0xf196b0[_0xdf99('0x36')]=qs[_0xdf99('0x37')](_['pick'](_0x2e26f3[_0xdf99('0x2e')],_0x222e6a['filters']),_0x3b4685);if(_0x2e26f3[_0xdf99('0x2e')][_0xdf99('0x38')]){_0xf196b0[_0xdf99('0x36')]=_[_0xdf99('0x39')](_0xf196b0[_0xdf99('0x36')],{'$or':_[_0xdf99('0x27')](_0x3b4685,function(_0x11ce1c){if(_0x11ce1c[_0xdf99('0x2b')]!==_0xdf99('0x3a')){var _0xa1b124={};_0xa1b124[_0x11ce1c['name']]={'$like':'%'+_0x2e26f3[_0xdf99('0x2e')][_0xdf99('0x38')]+'%'};return _0xa1b124;}})});}_0xf196b0=_['merge']({},_0xf196b0,_0x2e26f3[_0xdf99('0x3b')]);var _0x460ca5={'where':_0xf196b0[_0xdf99('0x36')]};return db['OpenchannelApplication'][_0xdf99('0x1c')](_0x460ca5)[_0xdf99('0x3c')](function(_0x3627e5){_0x2c3520[_0xdf99('0x1c')]=_0x3627e5;if(_0x2e26f3[_0xdf99('0x2e')]['includeAll']){_0xf196b0[_0xdf99('0x3d')]=[{'all':!![]}];}return db[_0xdf99('0x28')][_0xdf99('0x3e')](_0xf196b0);})[_0xdf99('0x3c')](function(_0x5ef773){_0x2c3520[_0xdf99('0x3f')]=_0x5ef773;return _0x2c3520;})[_0xdf99('0x3c')](respondWithFilteredResult(_0x47b020,_0xf196b0))[_0xdf99('0x40')](handleError(_0x47b020,null));};exports[_0xdf99('0x41')]=function(_0x11aa63,_0x1e01a5){var _0xc5b8e1={'raw':!![],'where':{'id':_0x11aa63['params']['id']}},_0x3a770e={};_0x3a770e[_0xdf99('0x2d')]=_[_0xdf99('0x2f')](db['OpenchannelApplication'][_0xdf99('0x29')]);_0x3a770e[_0xdf99('0x2e')]=_[_0xdf99('0x2f')](_0x11aa63[_0xdf99('0x2e')]);_0x3a770e[_0xdf99('0x37')]=_[_0xdf99('0x30')](_0x3a770e['model'],_0x3a770e['query']);_0xc5b8e1[_0xdf99('0x31')]=_[_0xdf99('0x30')](_0x3a770e[_0xdf99('0x2d')],qs[_0xdf99('0x32')](_0x11aa63[_0xdf99('0x2e')][_0xdf99('0x32')]));_0xc5b8e1[_0xdf99('0x31')]=_0xc5b8e1['attributes'][_0xdf99('0x42')]?_0xc5b8e1[_0xdf99('0x31')]:_0x3a770e[_0xdf99('0x2d')];if(_0x11aa63[_0xdf99('0x2e')][_0xdf99('0x43')]){_0xc5b8e1[_0xdf99('0x3d')]=[{'all':!![]}];}_0xc5b8e1=_[_0xdf99('0x39')]({},_0xc5b8e1,_0x11aa63[_0xdf99('0x3b')]);return db[_0xdf99('0x28')][_0xdf99('0x44')](_0xc5b8e1)['then'](handleEntityNotFound(_0x1e01a5,null))['then'](respondWithResult(_0x1e01a5,null))[_0xdf99('0x40')](handleError(_0x1e01a5,null));};exports[_0xdf99('0x45')]=function(_0x1b6797,_0x16787e){return db[_0xdf99('0x28')][_0xdf99('0x45')](_0x1b6797[_0xdf99('0x46')],{})[_0xdf99('0x3c')](respondWithResult(_0x16787e,0xc9))[_0xdf99('0x40')](handleError(_0x16787e,null));};exports['update']=function(_0x1b5662,_0x2e02de){if(_0x1b5662['body']['id']){delete _0x1b5662[_0xdf99('0x46')]['id'];}return db[_0xdf99('0x28')][_0xdf99('0x44')]({'where':{'id':_0x1b5662[_0xdf99('0x47')]['id']}})[_0xdf99('0x3c')](handleEntityNotFound(_0x2e02de,null))[_0xdf99('0x3c')](saveUpdates(_0x1b5662['body'],null))[_0xdf99('0x3c')](respondWithResult(_0x2e02de,null))[_0xdf99('0x40')](handleError(_0x2e02de,null));};exports[_0xdf99('0x22')]=function(_0x266276,_0x27e2a5){return db['OpenchannelApplication']['find']({'where':{'id':_0x266276[_0xdf99('0x47')]['id']}})[_0xdf99('0x3c')](handleEntityNotFound(_0x27e2a5,null))[_0xdf99('0x3c')](removeEntity(_0x27e2a5,null))['catch'](handleError(_0x27e2a5,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9906ad9..5338bf0 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 _0xdb61=['../../config/logger','api','moment','path','rimraf','../../config/environment','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','util'];(function(_0x5b7712,_0x346914){var _0x4fa082=function(_0x2c0018){while(--_0x2c0018){_0x5b7712['push'](_0x5b7712['shift']());}};_0x4fa082(++_0x346914);}(_0xdb61,0x1ad));var _0x1db6=function(_0x209b9d,_0x34b51d){_0x209b9d=_0x209b9d-0x0;var _0xf90900=_0xdb61[_0x209b9d];return _0xf90900;};'use strict';var _=require('lodash');var util=require(_0x1db6('0x0'));var logger=require(_0x1db6('0x1'))(_0x1db6('0x2'));var moment=require(_0x1db6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1db6('0x4'));var rimraf=require(_0x1db6('0x5'));var config=require(_0x1db6('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x1f34b1,_0x2103fa){return _0x1f34b1['define'](_0x1db6('0x7'),attributes,{'tableName':_0x1db6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1db6('0x9')});}; \ No newline at end of file +var _0xea00=['moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0xea00,0x129));var _0x0ea0=function(_0x2bc6aa,_0x58bbcb){_0x2bc6aa=_0x2bc6aa-0x0;var _0x2145ea=_0xea00[_0x2bc6aa];return _0x2145ea;};'use strict';var _=require(_0x0ea0('0x0'));var util=require(_0x0ea0('0x1'));var logger=require('../../config/logger')(_0x0ea0('0x2'));var moment=require(_0x0ea0('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ea0('0x4'));var fs=require('fs');var path=require(_0x0ea0('0x5'));var rimraf=require(_0x0ea0('0x6'));var config=require(_0x0ea0('0x7'));var attributes=require(_0x0ea0('0x8'));module[_0x0ea0('0x9')]=function(_0x1f500f,_0x4bdc45){return _0x1f500f[_0x0ea0('0xa')](_0x0ea0('0xb'),attributes,{'tableName':_0x0ea0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0ea0('0xd'),'collate':_0x0ea0('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a8b0d7d..7aa057f 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 _0x179b=['options','raw','where','attributes','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x179b,0x171));var _0xb179=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x179b[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xb179('0x0'));var util=require('util');var moment=require(_0xb179('0x1'));var BPromise=require(_0xb179('0x2'));var rs=require(_0xb179('0x3'));var fs=require('fs');var Redis=require(_0xb179('0x4'));var db=require(_0xb179('0x5'))['db'];var utils=require(_0xb179('0x6'));var logger=require(_0xb179('0x7'))(_0xb179('0x8'));var config=require(_0xb179('0x9'));var jayson=require(_0xb179('0xa'));var client=jayson[_0xb179('0xb')][_0xb179('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ae1e6,_0x1d573d,_0x1f3434){return new BPromise(function(_0x4691f5,_0x34be63){return client[_0xb179('0xd')](_0x1ae1e6,_0x1f3434)['then'](function(_0x59a451){logger[_0xb179('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x1d573d,_0xb179('0xf'));logger[_0xb179('0x10')](_0xb179('0x11'),_0x1d573d,'request\x20sent',JSON[_0xb179('0x12')](_0x59a451));if(_0x59a451[_0xb179('0x13')]){if(_0x59a451[_0xb179('0x13')][_0xb179('0x14')]===0x1f4){logger[_0xb179('0x13')](_0xb179('0x15'),_0x1d573d,_0x59a451['error'][_0xb179('0x16')]);return _0x34be63(_0x59a451[_0xb179('0x13')][_0xb179('0x16')]);}logger[_0xb179('0x13')](_0xb179('0x15'),_0x1d573d,_0x59a451[_0xb179('0x13')]['message']);return _0x4691f5(_0x59a451['error'][_0xb179('0x16')]);}else{logger[_0xb179('0xe')](_0xb179('0x15'),_0x1d573d,_0xb179('0xf'));_0x4691f5(_0x59a451[_0xb179('0x17')][_0xb179('0x16')]);}})[_0xb179('0x18')](function(_0xeb06c5){logger[_0xb179('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x1d573d,_0xeb06c5);_0x34be63(_0xeb06c5);});});}exports[_0xb179('0x19')]=function(_0x159b9e){var _0x350ffd=this;return new Promise(function(_0x46abd8,_0xf67544){return db[_0xb179('0x1a')]['update'](_0x159b9e['body'],{'raw':_0x159b9e[_0xb179('0x1b')]?_0x159b9e[_0xb179('0x1b')][_0xb179('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x159b9e[_0xb179('0x1b')]?_0x159b9e[_0xb179('0x1b')][_0xb179('0x1d')]||null:null,'attributes':_0x159b9e['options']?_0x159b9e['options'][_0xb179('0x1e')]||null:null,'limit':_0x159b9e[_0xb179('0x1b')]?_0x159b9e[_0xb179('0x1b')][_0xb179('0x1f')]||null:null})[_0xb179('0x20')](function(_0x1a04d2){logger[_0xb179('0xe')](_0xb179('0x19'),_0x159b9e);logger[_0xb179('0x10')](_0xb179('0x19'),_0x159b9e,JSON['stringify'](_0x1a04d2));_0x46abd8(_0x1a04d2);})[_0xb179('0x18')](function(_0x16acfa){logger[_0xb179('0x13')](_0xb179('0x19'),_0x16acfa[_0xb179('0x16')],_0x159b9e);_0xf67544(_0x350ffd['error'](0x1f4,_0x16acfa[_0xb179('0x16')]));});});}; \ No newline at end of file +var _0xae73=['debug','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','info'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0xae73,0x1cc));var _0x3ae7=function(_0x2159e6,_0x55c285){_0x2159e6=_0x2159e6-0x0;var _0x355dbb=_0xae73[_0x2159e6];return _0x355dbb;};'use strict';var _=require('lodash');var util=require(_0x3ae7('0x0'));var moment=require('moment');var BPromise=require(_0x3ae7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ae7('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ae7('0x3'))('rpc');var config=require(_0x3ae7('0x4'));var jayson=require(_0x3ae7('0x5'));var client=jayson['client'][_0x3ae7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x843d57,_0x35db98,_0x475f65){return new BPromise(function(_0x53db7c,_0x28a313){return client['request'](_0x843d57,_0x475f65)[_0x3ae7('0x7')](function(_0x1a1493){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x35db98,_0x3ae7('0x8'));logger['debug'](_0x3ae7('0x9'),_0x35db98,_0x3ae7('0x8'),JSON[_0x3ae7('0xa')](_0x1a1493));if(_0x1a1493[_0x3ae7('0xb')]){if(_0x1a1493[_0x3ae7('0xb')][_0x3ae7('0xc')]===0x1f4){logger[_0x3ae7('0xb')](_0x3ae7('0xd'),_0x35db98,_0x1a1493['error']['message']);return _0x28a313(_0x1a1493[_0x3ae7('0xb')][_0x3ae7('0xe')]);}logger[_0x3ae7('0xb')](_0x3ae7('0xd'),_0x35db98,_0x1a1493['error'][_0x3ae7('0xe')]);return _0x53db7c(_0x1a1493[_0x3ae7('0xb')]['message']);}else{logger['info'](_0x3ae7('0xd'),_0x35db98,_0x3ae7('0x8'));_0x53db7c(_0x1a1493['result']['message']);}})[_0x3ae7('0xf')](function(_0x5e1f07){logger[_0x3ae7('0xb')](_0x3ae7('0xd'),_0x35db98,_0x5e1f07);_0x28a313(_0x5e1f07);});});}exports[_0x3ae7('0x10')]=function(_0x10323e){var _0x34e041=this;return new Promise(function(_0x2ee5cd,_0x3bccd6){return db[_0x3ae7('0x11')][_0x3ae7('0x12')](_0x10323e[_0x3ae7('0x13')],{'raw':_0x10323e[_0x3ae7('0x14')]?_0x10323e[_0x3ae7('0x14')][_0x3ae7('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10323e[_0x3ae7('0x14')]?_0x10323e[_0x3ae7('0x14')][_0x3ae7('0x16')]||null:null,'attributes':_0x10323e[_0x3ae7('0x14')]?_0x10323e[_0x3ae7('0x14')][_0x3ae7('0x17')]||null:null,'limit':_0x10323e[_0x3ae7('0x14')]?_0x10323e[_0x3ae7('0x14')][_0x3ae7('0x18')]||null:null})[_0x3ae7('0x7')](function(_0x2fad82){logger[_0x3ae7('0x19')](_0x3ae7('0x10'),_0x10323e);logger[_0x3ae7('0x1a')](_0x3ae7('0x10'),_0x10323e,JSON[_0x3ae7('0xa')](_0x2fad82));_0x2ee5cd(_0x2fad82);})[_0x3ae7('0xf')](function(_0xf6ac13){logger[_0x3ae7('0xb')]('UpdateOpenchannelApplication',_0xf6ac13[_0x3ae7('0xe')],_0x10323e);_0x3bccd6(_0x34e041[_0x3ae7('0xb')](0x1f4,_0xf6ac13[_0x3ae7('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 6826bff..630b16b 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 _0x2841=['../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','index','get','show','/:id/download','download','create','post','addMessage','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x2841,0x86));var _0x1284=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x2841[_0x4bb581];return _0x316bf5;};'use strict';var multer=require('multer');var util=require(_0x1284('0x0'));var path=require(_0x1284('0x1'));var timeout=require(_0x1284('0x2'));var express=require(_0x1284('0x3'));var router=express[_0x1284('0x4')]();var fs_extra=require(_0x1284('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1284('0x6'));var config=require('../../config/environment');var controller=require(_0x1284('0x7'));router['get']('/',auth[_0x1284('0x8')](),controller[_0x1284('0x9')]);router[_0x1284('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1284('0xa')]('/:id',auth[_0x1284('0x8')](),controller[_0x1284('0xb')]);router[_0x1284('0xa')]('/:id/messages',auth[_0x1284('0x8')](),controller['getMessages']);router['get'](_0x1284('0xc'),auth[_0x1284('0x8')](),controller[_0x1284('0xd')]);router['post']('/',auth[_0x1284('0x8')](),controller[_0x1284('0xe')]);router[_0x1284('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1284('0x10')]);router[_0x1284('0xf')]('/:id/tags',auth[_0x1284('0x8')](),interaction[_0x1284('0x11')](_0x1284('0x12'),'openchannelinteraction:addtags'),controller[_0x1284('0x13')]);router[_0x1284('0x14')](_0x1284('0x15'),auth[_0x1284('0x8')](),interaction[_0x1284('0x11')](_0x1284('0x12'),_0x1284('0x16')),controller['update']);router[_0x1284('0x17')](_0x1284('0x15'),auth[_0x1284('0x8')](),interaction[_0x1284('0x11')](_0x1284('0x12'),_0x1284('0x18')),controller[_0x1284('0x19')]);router[_0x1284('0x17')]('/:id/tags',auth[_0x1284('0x8')](),controller[_0x1284('0x1a')]);module[_0x1284('0x1b')]=router; \ No newline at end of file +var _0x5f48=['/:id/download','download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','destroy','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages'];(function(_0x32e280,_0x22380f){var _0x16ef29=function(_0xc0a589){while(--_0xc0a589){_0x32e280['push'](_0x32e280['shift']());}};_0x16ef29(++_0x22380f);}(_0x5f48,0x194));var _0x85f4=function(_0x422024,_0x28e3b1){_0x422024=_0x422024-0x0;var _0x5d3330=_0x5f48[_0x422024];return _0x5d3330;};'use strict';var multer=require('multer');var util=require(_0x85f4('0x0'));var path=require(_0x85f4('0x1'));var timeout=require(_0x85f4('0x2'));var express=require(_0x85f4('0x3'));var router=express[_0x85f4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x85f4('0x5'));var interaction=require(_0x85f4('0x6'));var config=require(_0x85f4('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x85f4('0x8')]('/',auth[_0x85f4('0x9')](),controller[_0x85f4('0xa')]);router[_0x85f4('0x8')](_0x85f4('0xb'),auth[_0x85f4('0x9')](),controller[_0x85f4('0xc')]);router[_0x85f4('0x8')](_0x85f4('0xd'),auth[_0x85f4('0x9')](),controller['show']);router['get'](_0x85f4('0xe'),auth['isAuthenticated'](),controller[_0x85f4('0xf')]);router[_0x85f4('0x8')](_0x85f4('0x10'),auth[_0x85f4('0x9')](),controller[_0x85f4('0x11')]);router[_0x85f4('0x12')]('/',auth[_0x85f4('0x9')](),controller[_0x85f4('0x13')]);router[_0x85f4('0x12')](_0x85f4('0xe'),auth[_0x85f4('0x9')](),controller['addMessage']);router[_0x85f4('0x12')](_0x85f4('0x14'),auth[_0x85f4('0x9')](),interaction['tracked'](_0x85f4('0x15'),_0x85f4('0x16')),controller['addTags']);router[_0x85f4('0x17')]('/:id',auth[_0x85f4('0x9')](),interaction['tracked'](_0x85f4('0x15'),_0x85f4('0x18')),controller[_0x85f4('0x19')]);router['delete'](_0x85f4('0xd'),auth[_0x85f4('0x9')](),interaction['tracked'](_0x85f4('0x15'),'openchannelinteraction:destroy'),controller[_0x85f4('0x1a')]);router[_0x85f4('0x1b')](_0x85f4('0x14'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 25eab8d..ba94ad9 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 _0x0664=['ENUM','out','BOOLEAN','exports','DATE','STRING'];(function(_0x335cfa,_0x1e7634){var _0xb7a81b=function(_0x36cf8b){while(--_0x36cf8b){_0x335cfa['push'](_0x335cfa['shift']());}};_0xb7a81b(++_0x1e7634);}(_0x0664,0x93));var _0x4066=function(_0x584ef2,_0x27cafd){_0x584ef2=_0x584ef2-0x0;var _0x1067b5=_0x0664[_0x584ef2];return _0x1067b5;};'use strict';var Sequelize=require('sequelize');module[_0x4066('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4066('0x1')]},'disposition':{'type':Sequelize[_0x4066('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4066('0x2')]},'note':{'type':Sequelize[_0x4066('0x2')]},'read1stAt':{'type':Sequelize[_0x4066('0x1')]},'threadId':{'type':Sequelize[_0x4066('0x2')]},'externalUrl':{'type':Sequelize[_0x4066('0x2')]},'lastMsgAt':{'type':Sequelize[_0x4066('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x4066('0x3')]('in',_0x4066('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x4066('0x3')]('in',_0x4066('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x4066('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7d06=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7d06,0x158));var _0x67d0=function(_0x12f173,_0xca653a){_0x12f173=_0x12f173-0x0;var _0x475297=_0x7d06[_0x12f173];return _0x475297;};'use strict';var Sequelize=require(_0x67d0('0x0'));module[_0x67d0('0x1')]={'closed':{'type':Sequelize[_0x67d0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x67d0('0x3')]},'disposition':{'type':Sequelize[_0x67d0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x67d0('0x4')]},'note':{'type':Sequelize[_0x67d0('0x4')]},'read1stAt':{'type':Sequelize[_0x67d0('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x67d0('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x67d0('0x5')]('in',_0x67d0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x67d0('0x5')]('in',_0x67d0('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x67d0('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x67d0('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 68c7959..defb1a9 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 _0xd1ef=['type','key','getOptions','findAll','openchannel','user','query','from','params','model','keys','filters','intersection','attributes','fields','include','options','catch','create','body','find','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','length','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','CmContact','firstName','Attachment','Messages','createdAt','direction','secret','read','Account','User','Owner','mkdirSync','Openchannel','fullname','N.A.','closedAt','disposition','threadId','Private','basename','createReadStream','System','Contact','lastName','out','value','renderFile','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName'];(function(_0x45768,_0x32696e){var _0x33ad93=function(_0x90ada0){while(--_0x90ada0){_0x45768['push'](_0x45768['shift']());}};_0x33ad93(++_0x32696e);}(_0xd1ef,0xdd));var _0xfd1e=function(_0x4c44eb,_0x28441d){_0x4c44eb=_0x4c44eb-0x0;var _0x4be626=_0xd1ef[_0x4c44eb];return _0x4be626;};'use strict';var rimraf=require(_0xfd1e('0x0'));var zipdir=require('zip-dir');var moment=require(_0xfd1e('0x1'));var util=require(_0xfd1e('0x2'));var path=require('path');var ejs=require(_0xfd1e('0x3'));var fs=require('fs');var _=require(_0xfd1e('0x4'));var Redis=require(_0xfd1e('0x5'));var interaction=require(_0xfd1e('0x6'));var qs=require(_0xfd1e('0x7'));var pdf=require(_0xfd1e('0x8'));var logger=require(_0xfd1e('0x9'))(_0xfd1e('0xa'));var config=require('../../config/environment');var db=require(_0xfd1e('0xb'))['db'];config[_0xfd1e('0xc')]=_[_0xfd1e('0xd')](config['redis'],{'host':_0xfd1e('0xe'),'port':0x18eb});var socket=require(_0xfd1e('0xf'))(new Redis(config[_0xfd1e('0xc')]));require('./openchannelInteraction.socket')[_0xfd1e('0x10')](socket);function respondWithStatusCode(_0x281883,_0x25c42c){_0x25c42c=_0x25c42c||0xcc;return function(_0x9f201c){if(_0x9f201c){return _0x281883[_0xfd1e('0x11')](_0x25c42c);}return _0x281883[_0xfd1e('0x12')](_0x25c42c)[_0xfd1e('0x13')]();};}function respondWithResult(_0x25145b,_0x36718d){_0x36718d=_0x36718d||0xc8;return function(_0x305235){if(_0x305235){return _0x25145b[_0xfd1e('0x12')](_0x36718d)[_0xfd1e('0x14')](_0x305235);}};}function respondWithFilteredResult(_0x54cf00,_0x4527ad){return function(_0x42f9cd){if(_0x42f9cd){var _0x396ab1=typeof _0x4527ad['offset']===_0xfd1e('0x15')&&typeof _0x4527ad[_0xfd1e('0x16')]==='undefined';var _0x4fe45e=_0x42f9cd[_0xfd1e('0x17')];var _0x2462fc=_0x396ab1?0x0:_0x4527ad[_0xfd1e('0x18')];var _0x4dbb56=_0x396ab1?_0x42f9cd['count']:_0x4527ad['offset']+_0x4527ad['limit'];var _0x3dd75f;if(_0x4dbb56>=_0x4fe45e){_0x4dbb56=_0x4fe45e;_0x3dd75f=0xc8;}else{_0x3dd75f=0xce;}_0x54cf00['status'](_0x3dd75f);return _0x54cf00[_0xfd1e('0x19')](_0xfd1e('0x1a'),_0x2462fc+'-'+_0x4dbb56+'/'+_0x4fe45e)[_0xfd1e('0x14')](_0x42f9cd);}return null;};}function saveUpdates(_0x2c5df4){return function(_0x360ba2){if(_0x360ba2){return _0x360ba2[_0xfd1e('0x1b')](_0x2c5df4)[_0xfd1e('0x1c')](function(_0x2145d8){return _0x2145d8;});}return null;};}function removeEntity(_0x13222d){return function(_0x15f088){if(_0x15f088){return _0x15f088[_0xfd1e('0x1d')]()[_0xfd1e('0x1c')](function(){_0x13222d[_0xfd1e('0x12')](0xcc)[_0xfd1e('0x13')]();});}};}function handleEntityNotFound(_0x88dba8){return function(_0x30e61a){if(!_0x30e61a){_0x88dba8['sendStatus'](0x194);}return _0x30e61a;};}function handleError(_0x5bf1e5,_0xae7a95){_0xae7a95=_0xae7a95||0x1f4;return function(_0x538550){logger[_0xfd1e('0x1e')](_0x538550[_0xfd1e('0x1f')]);if(_0x538550[_0xfd1e('0x20')]){delete _0x538550['name'];}_0x5bf1e5[_0xfd1e('0x12')](_0xae7a95)[_0xfd1e('0x21')](_0x538550);};}exports[_0xfd1e('0x22')]=function(_0x5d0460,_0x1e6bc0){var _0x25f159={};var _0xd6cde7=_[_0xfd1e('0x23')](db[_0xfd1e('0x24')][_0xfd1e('0x25')],function(_0x3d48ab){return{'name':_0x3d48ab[_0xfd1e('0x26')],'type':_0x3d48ab[_0xfd1e('0x27')][_0xfd1e('0x28')]};});_0x25f159=qs[_0xfd1e('0x29')](_0xd6cde7,_0x5d0460);return interaction[_0xfd1e('0x2a')](_0xfd1e('0x2b'),_0x5d0460['query'],_0x5d0460[_0xfd1e('0x2c')],_0x25f159,_0xd6cde7)[_0xfd1e('0x1c')](respondWithFilteredResult(_0x1e6bc0,_0x25f159))['catch'](handleError(_0x1e6bc0,null));};exports['show']=function(_0x39014a,_0x4580f5){var _0x1662d5={};if(_0x39014a[_0xfd1e('0x2d')]['type']&&_0x39014a['query'][_0xfd1e('0x27')]==='from'){_0x1662d5[_0xfd1e('0x2e')]=_0x39014a[_0xfd1e('0x2f')]['id'];}else{_0x1662d5['id']=_0x39014a[_0xfd1e('0x2f')]['id'];}var _0x3667b2={'raw':![],'where':_0x1662d5},_0x1b42b0={};_0x1b42b0[_0xfd1e('0x30')]=_['keys'](db[_0xfd1e('0x24')][_0xfd1e('0x25')]);_0x1b42b0['query']=_[_0xfd1e('0x31')](_0x39014a['query']);_0x1b42b0[_0xfd1e('0x32')]=_[_0xfd1e('0x33')](_0x1b42b0['model'],_0x1b42b0[_0xfd1e('0x2d')]);_0x3667b2[_0xfd1e('0x34')]=_['intersection'](_0x1b42b0[_0xfd1e('0x30')],qs[_0xfd1e('0x35')](_0x39014a[_0xfd1e('0x2d')][_0xfd1e('0x35')]));_0x3667b2[_0xfd1e('0x34')]=_0x3667b2['attributes']['length']?_0x3667b2['attributes']:_0x1b42b0[_0xfd1e('0x30')];if(_0x39014a['query']['includeAll']){_0x3667b2[_0xfd1e('0x36')]=[{'all':!![]}];}_0x3667b2=_['merge']({},_0x3667b2,_0x39014a[_0xfd1e('0x37')]);return db[_0xfd1e('0x24')]['find'](_0x3667b2)[_0xfd1e('0x1c')](handleEntityNotFound(_0x4580f5,null))['then'](respondWithResult(_0x4580f5,null))[_0xfd1e('0x38')](handleError(_0x4580f5,null));};exports[_0xfd1e('0x39')]=function(_0x4c6988,_0x4b798c){return db[_0xfd1e('0x24')][_0xfd1e('0x39')](_0x4c6988[_0xfd1e('0x3a')],{})[_0xfd1e('0x1c')](respondWithResult(_0x4b798c,0xc9))[_0xfd1e('0x38')](handleError(_0x4b798c,null));};exports[_0xfd1e('0x1b')]=function(_0x16d1af,_0x261975){if(_0x16d1af['body']['id']){delete _0x16d1af[_0xfd1e('0x3a')]['id'];}return db[_0xfd1e('0x24')][_0xfd1e('0x3b')]({'where':{'id':_0x16d1af[_0xfd1e('0x2f')]['id']}})[_0xfd1e('0x1c')](handleEntityNotFound(_0x261975,null))[_0xfd1e('0x1c')](saveUpdates(_0x16d1af[_0xfd1e('0x3a')],null))[_0xfd1e('0x1c')](respondWithResult(_0x261975,null))[_0xfd1e('0x38')](handleError(_0x261975,null));};exports[_0xfd1e('0x1d')]=function(_0x9fbe12,_0x1b843a){return db['OpenchannelInteraction']['find']({'where':{'id':_0x9fbe12[_0xfd1e('0x2f')]['id']}})[_0xfd1e('0x1c')](handleEntityNotFound(_0x1b843a,null))['then'](removeEntity(_0x1b843a,null))[_0xfd1e('0x38')](handleError(_0x1b843a,null));};exports[_0xfd1e('0x3c')]=function(_0x49a436,_0x395597){return db['OpenchannelInteraction'][_0xfd1e('0x3c')]()['then'](respondWithResult(_0x395597,null))[_0xfd1e('0x38')](handleError(_0x395597,null));};exports['addMessage']=function(_0x7067d,_0x35d149){return db[_0xfd1e('0x3d')][_0xfd1e('0x3b')]({'where':{'id':_0x7067d[_0xfd1e('0x2f')]['id']}})[_0xfd1e('0x1c')](handleEntityNotFound(_0x35d149,null))[_0xfd1e('0x1c')](function(_0x2b8550){if(_0x2b8550){return _0x2b8550[_0xfd1e('0x3e')](_0x7067d[_0xfd1e('0x3a')][_0xfd1e('0x3f')],_['omit'](_0x7067d[_0xfd1e('0x3a')],[_0xfd1e('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x35d149,null))[_0xfd1e('0x38')](handleError(_0x35d149,null));};exports[_0xfd1e('0x40')]=function(_0x1fb1f9,_0x1e2213){var _0x2bc71a={'raw':![],'where':{}};var _0x270141={};var _0x414817={'count':0x0,'rows':[]};return db[_0xfd1e('0x24')][_0xfd1e('0x41')]({'where':{'id':_0x1fb1f9['params']['id']}})[_0xfd1e('0x1c')](handleEntityNotFound(_0x1e2213,null))[_0xfd1e('0x1c')](function(_0x92d21){if(_0x92d21){_0x270141[_0xfd1e('0x30')]=_[_0xfd1e('0x31')](db[_0xfd1e('0x3d')][_0xfd1e('0x25')]);_0x270141[_0xfd1e('0x2d')]=_['keys'](_0x1fb1f9[_0xfd1e('0x2d')]);_0x270141['filters']=_[_0xfd1e('0x33')](_0x270141['model'],_0x270141[_0xfd1e('0x2d')]);_0x2bc71a[_0xfd1e('0x34')]=_[_0xfd1e('0x33')](_0x270141[_0xfd1e('0x30')],qs[_0xfd1e('0x35')](_0x1fb1f9['query'][_0xfd1e('0x35')]));_0x2bc71a[_0xfd1e('0x34')]=_0x2bc71a['attributes'][_0xfd1e('0x42')]?_0x2bc71a['attributes']:_0x270141['model'];if(!_0x1fb1f9[_0xfd1e('0x2d')]['hasOwnProperty'](_0xfd1e('0x43'))){_0x2bc71a[_0xfd1e('0x16')]=qs[_0xfd1e('0x16')](_0x1fb1f9[_0xfd1e('0x2d')][_0xfd1e('0x16')]);_0x2bc71a[_0xfd1e('0x18')]=qs['offset'](_0x1fb1f9[_0xfd1e('0x2d')][_0xfd1e('0x18')]);}_0x2bc71a[_0xfd1e('0x44')]=qs[_0xfd1e('0x45')](_0x1fb1f9[_0xfd1e('0x2d')][_0xfd1e('0x45')]);_0x2bc71a[_0xfd1e('0x46')]=qs[_0xfd1e('0x32')](_[_0xfd1e('0x47')](_0x1fb1f9[_0xfd1e('0x2d')],_0x270141[_0xfd1e('0x32')]));_0x2bc71a[_0xfd1e('0x46')][_0xfd1e('0x48')]=_0x92d21['id'];if(_0x1fb1f9['query'][_0xfd1e('0x49')]){_0x2bc71a['where']=_[_0xfd1e('0x4a')](_0x2bc71a[_0xfd1e('0x46')],{'$or':_[_0xfd1e('0x23')](_0x2bc71a['attributes'],function(_0x3b74ac){var _0x3d5f95={};_0x3d5f95[_0x3b74ac]={'$like':'%'+_0x1fb1f9[_0xfd1e('0x2d')][_0xfd1e('0x49')]+'%'};return _0x3d5f95;})});}if(_0x1fb1f9[_0xfd1e('0x2d')][_0xfd1e('0x4b')]){var _0x2962a=_0x1fb1f9['query'][_0xfd1e('0x4b')][_0xfd1e('0x4c')](',');var _0x3a8eaa={};_0x3a8eaa[_0x2962a[0x0]]={'$gte':moment(_0x2962a[0x1])[_0xfd1e('0x4d')](_0xfd1e('0x4e'))};_0x2bc71a[_0xfd1e('0x46')]=_['merge'](_0x2bc71a[_0xfd1e('0x46')],_0x3a8eaa);}_0x2bc71a=_[_0xfd1e('0x4a')]({},_0x2bc71a,_0x1fb1f9[_0xfd1e('0x37')]);return db[_0xfd1e('0x3d')][_0xfd1e('0x17')]({'where':_0x2bc71a[_0xfd1e('0x46')]})[_0xfd1e('0x1c')](function(_0x8d2bac){_0x414817[_0xfd1e('0x17')]=_0x8d2bac;if(_0x1fb1f9[_0xfd1e('0x2d')][_0xfd1e('0x4f')]){_0x2bc71a['include']=[{'all':!![]}];}return db[_0xfd1e('0x3d')]['findAll'](_0x2bc71a);})[_0xfd1e('0x1c')](function(_0x257d92){_0x414817[_0xfd1e('0x50')]=_0x257d92;return _0x414817;});}})[_0xfd1e('0x1c')](respondWithFilteredResult(_0x1e2213,_0x2bc71a))['catch'](handleError(_0x1e2213,null));};exports[_0xfd1e('0x51')]=function(_0x28fd31,_0x5580b3){return db[_0xfd1e('0x24')][_0xfd1e('0x3b')]({'where':{'id':_0x28fd31[_0xfd1e('0x2f')]['id']}})['then'](handleEntityNotFound(_0x5580b3,null))[_0xfd1e('0x1c')](function(_0x243ac0){if(_0x243ac0){return _0x243ac0[_0xfd1e('0x52')](_0x28fd31['body'][_0xfd1e('0x3f')],_['omit'](_0x28fd31['body'],[_0xfd1e('0x3f'),'id'])||{})['spread'](function(){return db[_0xfd1e('0x53')][_0xfd1e('0x2a')]({'attributes':['id',_0xfd1e('0x20'),_0xfd1e('0x54')],'where':{'id':_0x28fd31[_0xfd1e('0x3a')][_0xfd1e('0x3f')]}});})[_0xfd1e('0x1c')](function(_0x3f3860){socket[_0xfd1e('0x55')](_0xfd1e('0x56'),{'id':Number(_0x28fd31[_0xfd1e('0x2f')]['id']),'tags':_0x3f3860||[]});return{'id':Number(_0x28fd31['params']['id']),'tags':_0x3f3860||[]};});}})['then'](respondWithResult(_0x5580b3,null))[_0xfd1e('0x38')](handleError(_0x5580b3,null));};exports[_0xfd1e('0x57')]=function(_0x596649,_0x331128){return db[_0xfd1e('0x24')][_0xfd1e('0x3b')]({'where':{'id':_0x596649[_0xfd1e('0x2f')]['id']}})[_0xfd1e('0x1c')](handleEntityNotFound(_0x331128,null))[_0xfd1e('0x1c')](function(_0x278f33){if(_0x278f33){return _0x278f33['removeTags'](_0x596649[_0xfd1e('0x2d')][_0xfd1e('0x3f')]);}})['then'](respondWithStatusCode(_0x331128,null))[_0xfd1e('0x38')](handleError(_0x331128,null));};exports[_0xfd1e('0x58')]=function(_0x522dc7,_0x13ea09){var _0x30460b=moment()[_0xfd1e('0x59')]()[_0xfd1e('0x5a')]();var _0x11f021=path[_0xfd1e('0x5b')](config[_0xfd1e('0x5c')],'server',_0xfd1e('0x5d'),_0xfd1e('0x5e'));var _0x480df7=path[_0xfd1e('0x5b')](config[_0xfd1e('0x5c')],_0xfd1e('0x5f'),_0xfd1e('0x5d'),_0xfd1e('0x60'));var _0x58b11e=path[_0xfd1e('0x5b')](_0x11f021,_0x30460b);var _0x122266=util[_0xfd1e('0x4d')](_0xfd1e('0x61'),_0x522dc7['params']['id'],_0x30460b);var _0xe157f=path[_0xfd1e('0x5b')](_0x11f021,_0x122266);var _0x20bb68=[];_0x20bb68['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x20bb68[_0xfd1e('0x62')]({'model':db[_0xfd1e('0x63')],'as':'Contact','attributes':['id',_0xfd1e('0x64'),'lastName'],'raw':!![]});if(_0x522dc7[_0xfd1e('0x2d')][_0xfd1e('0x60')]){_0x20bb68[_0xfd1e('0x62')]({'model':db[_0xfd1e('0x65')],'as':_0xfd1e('0x65'),'raw':!![]});}var _0x270b0f=[{'model':db[_0xfd1e('0x3d')],'as':_0xfd1e('0x66'),'attributes':['id',_0xfd1e('0x3a'),_0xfd1e('0x67'),_0xfd1e('0x68'),_0xfd1e('0x69'),_0xfd1e('0x6a')],'include':_0x20bb68}];_0x270b0f['push']({'model':db['OpenchannelAccount'],'as':_0xfd1e('0x6b'),'attributes':['id',_0xfd1e('0x20')]});_0x270b0f[_0xfd1e('0x62')]({'model':db[_0xfd1e('0x6c')],'as':_0xfd1e('0x6d'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xfd1e('0x3b')]({'where':{'id':_0x522dc7[_0xfd1e('0x2f')]['id']},'include':_0x270b0f})['then'](handleEntityNotFound(_0x13ea09,null))[_0xfd1e('0x1c')](function(_0x521617){if(_0x521617){var _0x562986=_0x521617['get']({'plain':!![]});fs[_0xfd1e('0x6e')](_0x58b11e);var _0x4248d8={'channel':_0xfd1e('0x6f'),'account':_0x562986['Account'][_0xfd1e('0x20')],'agent':_0x562986[_0xfd1e('0x6d')]?_0x562986[_0xfd1e('0x6d')][_0xfd1e('0x70')]:_0xfd1e('0x71'),'createdAt':moment(_0x562986[_0xfd1e('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x562986['closed']?moment(_0x562986[_0xfd1e('0x72')])[_0xfd1e('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfd1e('0x5a')]():'','disposition':_0x562986[_0xfd1e('0x73')],'visibility':_0x562986[_0xfd1e('0x74')]?'Public':_0xfd1e('0x75'),'messages':_(_0x562986[_0xfd1e('0x66')])['filter']({'secret':![]})[_0xfd1e('0x23')](function(_0x47a099){if(_0x47a099['Attachment']){var _0x3e8bf4=path[_0xfd1e('0x5b')](_0x480df7,_0x47a099[_0xfd1e('0x65')][_0xfd1e('0x76')]);if(fs['existsSync'](_0x3e8bf4)){fs[_0xfd1e('0x77')](_0x3e8bf4)['pipe'](fs['createWriteStream'](path[_0xfd1e('0x5b')](_0x58b11e,_0x47a099['Attachment']['basename'])));}}return{'date':moment(_0x47a099[_0xfd1e('0x67')])[_0xfd1e('0x4d')](_0xfd1e('0x4e'))[_0xfd1e('0x5a')](),'sender':_0x47a099[_0xfd1e('0x68')]==='out'?_0x47a099['User']?_0x47a099[_0xfd1e('0x6c')][_0xfd1e('0x70')]:_0xfd1e('0x78'):_0x47a099['Contact'][_0xfd1e('0x64')]+(_0x47a099[_0xfd1e('0x79')]['lastName']?'\x20'+_0x47a099[_0xfd1e('0x79')][_0xfd1e('0x7a')]:''),'body':_0x47a099['Attachment']?_0x47a099['Attachment']['basename']:_0x47a099['body'],'direction':_0x47a099[_0xfd1e('0x68')]===_0xfd1e('0x7b')?'A':'C','secret':_0x47a099['secret'],'read':_0x47a099['read'],'attachment':_0x47a099['Attachment']};})[_0xfd1e('0x7c')]()};return ejs[_0xfd1e('0x7d')](path[_0xfd1e('0x5b')](config['root'],_0xfd1e('0x5f'),'views','downloadInteraction.ejs'),{'interaction':_0x4248d8})[_0xfd1e('0x1c')](function(_0x1184ed){var _0x18af88=path[_0xfd1e('0x5b')](_0x58b11e,_0xfd1e('0x7e')+_0x562986['id']+'-'+_0x30460b+_0xfd1e('0x7f'));var _0x124768={'path':_0x18af88,'channel':_0xfd1e('0x6f'),'interactionId':_0x562986['id']};return pdf[_0xfd1e('0x80')](_0x1184ed,_0x124768);})[_0xfd1e('0x1c')](function(){return new Promise(function(_0x4daad9,_0x24d689){zipdir(_0x58b11e,{'saveTo':_0xe157f},function(_0x263295,_0x39c49a){if(_0x263295)return _0x24d689(_0x263295);return _0x4daad9(_0x39c49a);});})['then'](function(){return new Promise(function(_0x5e5dbd,_0x3ea9ad){rimraf(_0x58b11e,function(_0x1dcf66){if(_0x1dcf66)_0x3ea9ad(_0x1dcf66);return _0x5e5dbd();});});})[_0xfd1e('0x1c')](function(){return _0x13ea09[_0xfd1e('0x58')](_0xe157f,_0x122266,function(_0x2a85de){if(_0x2a85de){logger['error'](_0xfd1e('0x81'),_0x2a85de);}else{fs['unlinkSync'](_0xe157f);}});});});}else{return _0x13ea09[_0xfd1e('0x11')](0xc8);}})[_0xfd1e('0x38')](handleError(_0x13ea09,null));}; \ No newline at end of file +var _0x47be=['lastName','push','Attachment','createdAt','direction','read','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','toString','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','firstName','secret','views','transcript-','.pdf','Openchannel','error','unlinkSync','rimraf','zip-dir','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./openchannelInteraction.socket','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','query','user','catch','show','from','params','OpenchannelInteraction','keys','filters','intersection','model','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','fields','nolimit','limit','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname'];(function(_0x3a8b22,_0x1fc614){var _0x303f29=function(_0x27e77e){while(--_0x27e77e){_0x3a8b22['push'](_0x3a8b22['shift']());}};_0x303f29(++_0x1fc614);}(_0x47be,0x1a5));var _0xe47b=function(_0x4e9310,_0x5296e4){_0x4e9310=_0x4e9310-0x0;var _0x346b79=_0x47be[_0x4e9310];return _0x346b79;};'use strict';var rimraf=require(_0xe47b('0x0'));var zipdir=require(_0xe47b('0x1'));var moment=require('moment');var util=require('util');var path=require(_0xe47b('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe47b('0x3'));var Redis=require(_0xe47b('0x4'));var interaction=require(_0xe47b('0x5'));var qs=require(_0xe47b('0x6'));var pdf=require(_0xe47b('0x7'));var logger=require(_0xe47b('0x8'))(_0xe47b('0x9'));var config=require('../../config/environment');var db=require(_0xe47b('0xa'))['db'];config['redis']=_[_0xe47b('0xb')](config[_0xe47b('0xc')],{'host':_0xe47b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe47b('0xc')]));require(_0xe47b('0xe'))['register'](socket);function respondWithStatusCode(_0x309e7f,_0x4f46da){_0x4f46da=_0x4f46da||0xcc;return function(_0x55f4b2){if(_0x55f4b2){return _0x309e7f['sendStatus'](_0x4f46da);}return _0x309e7f[_0xe47b('0xf')](_0x4f46da)[_0xe47b('0x10')]();};}function respondWithResult(_0x18cb48,_0x17adab){_0x17adab=_0x17adab||0xc8;return function(_0x208345){if(_0x208345){return _0x18cb48[_0xe47b('0xf')](_0x17adab)[_0xe47b('0x11')](_0x208345);}};}function respondWithFilteredResult(_0x35943e,_0x49a920){return function(_0x211c00){if(_0x211c00){var _0x3f3a73=typeof _0x49a920[_0xe47b('0x12')]===_0xe47b('0x13')&&typeof _0x49a920['limit']===_0xe47b('0x13');var _0xae99c3=_0x211c00[_0xe47b('0x14')];var _0x15caf7=_0x3f3a73?0x0:_0x49a920[_0xe47b('0x12')];var _0x4476c1=_0x3f3a73?_0x211c00[_0xe47b('0x14')]:_0x49a920[_0xe47b('0x12')]+_0x49a920['limit'];var _0x18312f;if(_0x4476c1>=_0xae99c3){_0x4476c1=_0xae99c3;_0x18312f=0xc8;}else{_0x18312f=0xce;}_0x35943e[_0xe47b('0xf')](_0x18312f);return _0x35943e[_0xe47b('0x15')](_0xe47b('0x16'),_0x15caf7+'-'+_0x4476c1+'/'+_0xae99c3)[_0xe47b('0x11')](_0x211c00);}return null;};}function saveUpdates(_0x9d4805){return function(_0xb116e2){if(_0xb116e2){return _0xb116e2[_0xe47b('0x17')](_0x9d4805)[_0xe47b('0x18')](function(_0x2cbf85){return _0x2cbf85;});}return null;};}function removeEntity(_0x2c903e){return function(_0x5ace7b){if(_0x5ace7b){return _0x5ace7b[_0xe47b('0x19')]()['then'](function(){_0x2c903e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b4d8){return function(_0x361a34){if(!_0x361a34){_0x40b4d8[_0xe47b('0x1a')](0x194);}return _0x361a34;};}function handleError(_0x3a0564,_0x412315){_0x412315=_0x412315||0x1f4;return function(_0x22860f){logger['error'](_0x22860f[_0xe47b('0x1b')]);if(_0x22860f['name']){delete _0x22860f[_0xe47b('0x1c')];}_0x3a0564[_0xe47b('0xf')](_0x412315)[_0xe47b('0x1d')](_0x22860f);};}exports[_0xe47b('0x1e')]=function(_0x4111ef,_0x131f40){var _0x2e2616={};var _0x8505b8=_[_0xe47b('0x1f')](db['OpenchannelInteraction'][_0xe47b('0x20')],function(_0xe8d73a){return{'name':_0xe8d73a[_0xe47b('0x21')],'type':_0xe8d73a[_0xe47b('0x22')][_0xe47b('0x23')]};});_0x2e2616=qs[_0xe47b('0x24')](_0x8505b8,_0x4111ef);return interaction['findAll']('openchannel',_0x4111ef[_0xe47b('0x25')],_0x4111ef[_0xe47b('0x26')],_0x2e2616,_0x8505b8)[_0xe47b('0x18')](respondWithFilteredResult(_0x131f40,_0x2e2616))[_0xe47b('0x27')](handleError(_0x131f40,null));};exports[_0xe47b('0x28')]=function(_0x1b0ed3,_0x44829c){var _0x47244c={};if(_0x1b0ed3[_0xe47b('0x25')][_0xe47b('0x22')]&&_0x1b0ed3[_0xe47b('0x25')]['type']==='from'){_0x47244c[_0xe47b('0x29')]=_0x1b0ed3[_0xe47b('0x2a')]['id'];}else{_0x47244c['id']=_0x1b0ed3[_0xe47b('0x2a')]['id'];}var _0x594a97={'raw':![],'where':_0x47244c},_0x11d65d={};_0x11d65d['model']=_['keys'](db[_0xe47b('0x2b')][_0xe47b('0x20')]);_0x11d65d[_0xe47b('0x25')]=_[_0xe47b('0x2c')](_0x1b0ed3[_0xe47b('0x25')]);_0x11d65d[_0xe47b('0x2d')]=_[_0xe47b('0x2e')](_0x11d65d[_0xe47b('0x2f')],_0x11d65d[_0xe47b('0x25')]);_0x594a97['attributes']=_[_0xe47b('0x2e')](_0x11d65d[_0xe47b('0x2f')],qs['fields'](_0x1b0ed3[_0xe47b('0x25')]['fields']));_0x594a97[_0xe47b('0x30')]=_0x594a97['attributes'][_0xe47b('0x31')]?_0x594a97[_0xe47b('0x30')]:_0x11d65d['model'];if(_0x1b0ed3[_0xe47b('0x25')][_0xe47b('0x32')]){_0x594a97[_0xe47b('0x33')]=[{'all':!![]}];}_0x594a97=_[_0xe47b('0x34')]({},_0x594a97,_0x1b0ed3[_0xe47b('0x35')]);return db[_0xe47b('0x2b')][_0xe47b('0x36')](_0x594a97)[_0xe47b('0x18')](handleEntityNotFound(_0x44829c,null))[_0xe47b('0x18')](respondWithResult(_0x44829c,null))[_0xe47b('0x27')](handleError(_0x44829c,null));};exports[_0xe47b('0x37')]=function(_0x2ebff0,_0x42e862){return db[_0xe47b('0x2b')][_0xe47b('0x37')](_0x2ebff0[_0xe47b('0x38')],{})['then'](respondWithResult(_0x42e862,0xc9))[_0xe47b('0x27')](handleError(_0x42e862,null));};exports[_0xe47b('0x17')]=function(_0x48b0f6,_0x3e8209){if(_0x48b0f6[_0xe47b('0x38')]['id']){delete _0x48b0f6[_0xe47b('0x38')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x48b0f6['params']['id']}})[_0xe47b('0x18')](handleEntityNotFound(_0x3e8209,null))[_0xe47b('0x18')](saveUpdates(_0x48b0f6[_0xe47b('0x38')],null))[_0xe47b('0x18')](respondWithResult(_0x3e8209,null))['catch'](handleError(_0x3e8209,null));};exports[_0xe47b('0x19')]=function(_0x115a15,_0x6471db){return db[_0xe47b('0x2b')][_0xe47b('0x36')]({'where':{'id':_0x115a15[_0xe47b('0x2a')]['id']}})[_0xe47b('0x18')](handleEntityNotFound(_0x6471db,null))[_0xe47b('0x18')](removeEntity(_0x6471db,null))[_0xe47b('0x27')](handleError(_0x6471db,null));};exports[_0xe47b('0x39')]=function(_0x1968eb,_0x35c608){return db[_0xe47b('0x2b')]['describe']()[_0xe47b('0x18')](respondWithResult(_0x35c608,null))[_0xe47b('0x27')](handleError(_0x35c608,null));};exports[_0xe47b('0x3a')]=function(_0x3f7854,_0x2ab7b8){return db[_0xe47b('0x3b')][_0xe47b('0x36')]({'where':{'id':_0x3f7854[_0xe47b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2ab7b8,null))[_0xe47b('0x18')](function(_0x37a236){if(_0x37a236){return _0x37a236['addMessage'](_0x3f7854['body'][_0xe47b('0x3c')],_['omit'](_0x3f7854[_0xe47b('0x38')],[_0xe47b('0x3c'),'id'])||{});}})[_0xe47b('0x18')](respondWithResult(_0x2ab7b8,null))['catch'](handleError(_0x2ab7b8,null));};exports[_0xe47b('0x3d')]=function(_0x3024c6,_0x5ad336){var _0x489479={'raw':![],'where':{}};var _0x342732={};var _0x154d33={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xe47b('0x3e')]({'where':{'id':_0x3024c6[_0xe47b('0x2a')]['id']}})[_0xe47b('0x18')](handleEntityNotFound(_0x5ad336,null))[_0xe47b('0x18')](function(_0x553bad){if(_0x553bad){_0x342732[_0xe47b('0x2f')]=_[_0xe47b('0x2c')](db[_0xe47b('0x3b')][_0xe47b('0x20')]);_0x342732[_0xe47b('0x25')]=_[_0xe47b('0x2c')](_0x3024c6[_0xe47b('0x25')]);_0x342732[_0xe47b('0x2d')]=_[_0xe47b('0x2e')](_0x342732['model'],_0x342732['query']);_0x489479[_0xe47b('0x30')]=_[_0xe47b('0x2e')](_0x342732['model'],qs[_0xe47b('0x3f')](_0x3024c6[_0xe47b('0x25')][_0xe47b('0x3f')]));_0x489479[_0xe47b('0x30')]=_0x489479['attributes']['length']?_0x489479[_0xe47b('0x30')]:_0x342732['model'];if(!_0x3024c6['query']['hasOwnProperty'](_0xe47b('0x40'))){_0x489479[_0xe47b('0x41')]=qs[_0xe47b('0x41')](_0x3024c6[_0xe47b('0x25')][_0xe47b('0x41')]);_0x489479['offset']=qs['offset'](_0x3024c6[_0xe47b('0x25')]['offset']);}_0x489479[_0xe47b('0x42')]=qs[_0xe47b('0x43')](_0x3024c6['query'][_0xe47b('0x43')]);_0x489479[_0xe47b('0x44')]=qs['filters'](_[_0xe47b('0x45')](_0x3024c6[_0xe47b('0x25')],_0x342732['filters']));_0x489479[_0xe47b('0x44')]['OpenchannelInteractionId']=_0x553bad['id'];if(_0x3024c6[_0xe47b('0x25')][_0xe47b('0x46')]){_0x489479[_0xe47b('0x44')]=_[_0xe47b('0x34')](_0x489479[_0xe47b('0x44')],{'$or':_['map'](_0x489479[_0xe47b('0x30')],function(_0x480800){var _0x1f334d={};_0x1f334d[_0x480800]={'$like':'%'+_0x3024c6[_0xe47b('0x25')][_0xe47b('0x46')]+'%'};return _0x1f334d;})});}if(_0x3024c6[_0xe47b('0x25')][_0xe47b('0x47')]){var _0x358152=_0x3024c6[_0xe47b('0x25')]['$gte']['split'](',');var _0x532116={};_0x532116[_0x358152[0x0]]={'$gte':moment(_0x358152[0x1])[_0xe47b('0x48')](_0xe47b('0x49'))};_0x489479['where']=_['merge'](_0x489479['where'],_0x532116);}_0x489479=_[_0xe47b('0x34')]({},_0x489479,_0x3024c6[_0xe47b('0x35')]);return db['OpenchannelMessage']['count']({'where':_0x489479[_0xe47b('0x44')]})[_0xe47b('0x18')](function(_0x27f6c7){_0x154d33['count']=_0x27f6c7;if(_0x3024c6['query'][_0xe47b('0x32')]){_0x489479['include']=[{'all':!![]}];}return db[_0xe47b('0x3b')][_0xe47b('0x4a')](_0x489479);})[_0xe47b('0x18')](function(_0x3fd929){_0x154d33['rows']=_0x3fd929;return _0x154d33;});}})['then'](respondWithFilteredResult(_0x5ad336,_0x489479))[_0xe47b('0x27')](handleError(_0x5ad336,null));};exports[_0xe47b('0x4b')]=function(_0x1fa11e,_0x42204c){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1fa11e['params']['id']}})[_0xe47b('0x18')](handleEntityNotFound(_0x42204c,null))[_0xe47b('0x18')](function(_0x19b12b){if(_0x19b12b){return _0x19b12b[_0xe47b('0x4c')](_0x1fa11e[_0xe47b('0x38')]['ids'],_[_0xe47b('0x4d')](_0x1fa11e[_0xe47b('0x38')],[_0xe47b('0x3c'),'id'])||{})[_0xe47b('0x4e')](function(){return db[_0xe47b('0x4f')][_0xe47b('0x4a')]({'attributes':['id',_0xe47b('0x1c'),_0xe47b('0x50')],'where':{'id':_0x1fa11e['body'][_0xe47b('0x3c')]}});})[_0xe47b('0x18')](function(_0x46fba1){socket[_0xe47b('0x51')](_0xe47b('0x52'),{'id':Number(_0x1fa11e['params']['id']),'tags':_0x46fba1||[]});return{'id':Number(_0x1fa11e[_0xe47b('0x2a')]['id']),'tags':_0x46fba1||[]};});}})[_0xe47b('0x18')](respondWithResult(_0x42204c,null))[_0xe47b('0x27')](handleError(_0x42204c,null));};exports[_0xe47b('0x53')]=function(_0x2a61b1,_0x13880c){return db[_0xe47b('0x2b')][_0xe47b('0x36')]({'where':{'id':_0x2a61b1[_0xe47b('0x2a')]['id']}})[_0xe47b('0x18')](handleEntityNotFound(_0x13880c,null))['then'](function(_0x351129){if(_0x351129){return _0x351129[_0xe47b('0x53')](_0x2a61b1[_0xe47b('0x25')][_0xe47b('0x3c')]);}})[_0xe47b('0x18')](respondWithStatusCode(_0x13880c,null))[_0xe47b('0x27')](handleError(_0x13880c,null));};exports[_0xe47b('0x54')]=function(_0xfe53f0,_0x52ba07){var _0x1fdbcd=moment()[_0xe47b('0x55')]()['toString']();var _0x4833bb=path[_0xe47b('0x56')](config[_0xe47b('0x57')],_0xe47b('0x58'),_0xe47b('0x59'),_0xe47b('0x5a'));var _0x1de5eb=path[_0xe47b('0x56')](config[_0xe47b('0x57')],_0xe47b('0x58'),_0xe47b('0x59'),_0xe47b('0x5b'));var _0x29a750=path[_0xe47b('0x56')](_0x4833bb,_0x1fdbcd);var _0x350d62=util['format'](_0xe47b('0x5c'),_0xfe53f0[_0xe47b('0x2a')]['id'],_0x1fdbcd);var _0x47d97f=path[_0xe47b('0x56')](_0x4833bb,_0x350d62);var _0x521ba7=[];_0x521ba7['push']({'model':db[_0xe47b('0x5d')],'as':'User','attributes':['id',_0xe47b('0x5e')],'raw':!![]});_0x521ba7['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xe47b('0x5f')],'raw':!![]});if(_0xfe53f0[_0xe47b('0x25')][_0xe47b('0x5b')]){_0x521ba7[_0xe47b('0x60')]({'model':db[_0xe47b('0x61')],'as':'Attachment','raw':!![]});}var _0x242620=[{'model':db[_0xe47b('0x3b')],'as':'Messages','attributes':['id',_0xe47b('0x38'),_0xe47b('0x62'),_0xe47b('0x63'),'secret',_0xe47b('0x64')],'include':_0x521ba7}];_0x242620[_0xe47b('0x60')]({'model':db['OpenchannelAccount'],'as':_0xe47b('0x65'),'attributes':['id',_0xe47b('0x1c')]});_0x242620[_0xe47b('0x60')]({'model':db[_0xe47b('0x5d')],'as':_0xe47b('0x66'),'attributes':['id',_0xe47b('0x5e')]});return db[_0xe47b('0x2b')][_0xe47b('0x36')]({'where':{'id':_0xfe53f0[_0xe47b('0x2a')]['id']},'include':_0x242620})[_0xe47b('0x18')](handleEntityNotFound(_0x52ba07,null))[_0xe47b('0x18')](function(_0x148578){if(_0x148578){var _0x6a7c02=_0x148578[_0xe47b('0x67')]({'plain':!![]});fs[_0xe47b('0x68')](_0x29a750);var _0x56277a={'channel':'Openchannel','account':_0x6a7c02[_0xe47b('0x65')]['name'],'agent':_0x6a7c02[_0xe47b('0x66')]?_0x6a7c02[_0xe47b('0x66')][_0xe47b('0x5e')]:_0xe47b('0x69'),'createdAt':moment(_0x6a7c02[_0xe47b('0x62')])[_0xe47b('0x48')](_0xe47b('0x49'))['toString'](),'closedAt':_0x6a7c02[_0xe47b('0x6a')]?moment(_0x6a7c02[_0xe47b('0x6b')])[_0xe47b('0x48')](_0xe47b('0x49'))[_0xe47b('0x6c')]():'','disposition':_0x6a7c02[_0xe47b('0x6d')],'visibility':_0x6a7c02[_0xe47b('0x6e')]?'Public':_0xe47b('0x6f'),'messages':_(_0x6a7c02[_0xe47b('0x70')])[_0xe47b('0x46')]({'secret':![]})[_0xe47b('0x1f')](function(_0x5ec2ff){if(_0x5ec2ff[_0xe47b('0x61')]){var _0x154a7a=path[_0xe47b('0x56')](_0x1de5eb,_0x5ec2ff[_0xe47b('0x61')][_0xe47b('0x71')]);if(fs[_0xe47b('0x72')](_0x154a7a)){fs[_0xe47b('0x73')](_0x154a7a)[_0xe47b('0x74')](fs[_0xe47b('0x75')](path[_0xe47b('0x56')](_0x29a750,_0x5ec2ff[_0xe47b('0x61')][_0xe47b('0x71')])));}}return{'date':moment(_0x5ec2ff[_0xe47b('0x62')])[_0xe47b('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe47b('0x6c')](),'sender':_0x5ec2ff[_0xe47b('0x63')]===_0xe47b('0x76')?_0x5ec2ff['User']?_0x5ec2ff[_0xe47b('0x5d')]['fullname']:_0xe47b('0x77'):_0x5ec2ff[_0xe47b('0x78')][_0xe47b('0x79')]+(_0x5ec2ff[_0xe47b('0x78')][_0xe47b('0x5f')]?'\x20'+_0x5ec2ff['Contact']['lastName']:''),'body':_0x5ec2ff[_0xe47b('0x61')]?_0x5ec2ff[_0xe47b('0x61')][_0xe47b('0x71')]:_0x5ec2ff['body'],'direction':_0x5ec2ff[_0xe47b('0x63')]===_0xe47b('0x76')?'A':'C','secret':_0x5ec2ff[_0xe47b('0x7a')],'read':_0x5ec2ff['read'],'attachment':_0x5ec2ff['Attachment']};})['value']()};return ejs['renderFile'](path['join'](config[_0xe47b('0x57')],_0xe47b('0x58'),_0xe47b('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x56277a})[_0xe47b('0x18')](function(_0x367e1b){var _0xc02496=path[_0xe47b('0x56')](_0x29a750,_0xe47b('0x7c')+_0x6a7c02['id']+'-'+_0x1fdbcd+_0xe47b('0x7d'));var _0x1ba23e={'path':_0xc02496,'channel':_0xe47b('0x7e'),'interactionId':_0x6a7c02['id']};return pdf['createPdfFromHTML'](_0x367e1b,_0x1ba23e);})[_0xe47b('0x18')](function(){return new Promise(function(_0x48c2a6,_0x3eec45){zipdir(_0x29a750,{'saveTo':_0x47d97f},function(_0x3db9ec,_0x3c0b2c){if(_0x3db9ec)return _0x3eec45(_0x3db9ec);return _0x48c2a6(_0x3c0b2c);});})[_0xe47b('0x18')](function(){return new Promise(function(_0x2a7f7e,_0x348ded){rimraf(_0x29a750,function(_0x4e0c44){if(_0x4e0c44)_0x348ded(_0x4e0c44);return _0x2a7f7e();});});})[_0xe47b('0x18')](function(){return _0x52ba07[_0xe47b('0x54')](_0x47d97f,_0x350d62,function(_0x47b038){if(_0x47b038){logger[_0xe47b('0x7f')]('Unable\x20to\x20delete\x20zip\x20file',_0x47b038);}else{fs[_0xe47b('0x80')](_0x47d97f);}});});});}else{return _0x52ba07[_0xe47b('0x1a')](0xc8);}})[_0xe47b('0x27')](handleError(_0x52ba07,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0d4f5d3..b8be92f 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 _0xc6c3=['events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','getUsers','then','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0xc6c3,0x100));var _0x3c6c=function(_0x4894e3,_0x28d91f){_0x4894e3=_0x4894e3-0x0;var _0xfebe68=_0xc6c3[_0x4894e3];return _0xfebe68;};'use strict';var EventEmitter=require(_0x3c6c('0x0'));var OpenchannelInteraction=require(_0x3c6c('0x1'))['db'][_0x3c6c('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x3c6c('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c6c('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x400e58){return function(_0x1e538c,_0x1de75d,_0xbb8ce8){_0x1e538c[_0x3c6c('0x5')]({'attributes':['id'],'raw':!![]})[_0x3c6c('0x6')](function(_0x5aba87){_0x1e538c['setDataValue']('Users',_0x5aba87['map'](function(_0x2d35f9){return{'id':_0x2d35f9['id']};}));return OpenchannelMessage[_0x3c6c('0x7')]({'where':{'OpenchannelInteractionId':_0x1e538c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3c6c('0x6')](function(_0x3bf044){_0x1e538c[_0x3c6c('0x8')](_0x3c6c('0x9'),_0x3bf044[_0x3c6c('0xa')]);OpenchannelInteractionEvents['emit'](_0x400e58+':'+_0x1e538c['id'],_0x1e538c);OpenchannelInteractionEvents[_0x3c6c('0xb')](_0x400e58,_0x1e538c);_0xbb8ce8(null);})[_0x3c6c('0xc')](_0xbb8ce8(null));};}for(var e in events){if(events[_0x3c6c('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x3c6c('0xe')](e,emitEvent(event));}}module[_0x3c6c('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x33d8=['getUsers','then','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x33d8,0x1e6));var _0x833d=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x33d8[_0x1928c9];return _0x51b5fb;};'use strict';var EventEmitter=require(_0x833d('0x0'));var OpenchannelInteraction=require(_0x833d('0x1'))['db'][_0x833d('0x2')];var OpenchannelMessage=require(_0x833d('0x1'))['db'][_0x833d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x833d('0x4')](0x0);var events={'afterCreate':_0x833d('0x5'),'afterUpdate':_0x833d('0x6'),'afterDestroy':_0x833d('0x7')};function emitEvent(_0x4564e1){return function(_0xe674d2,_0x41d19,_0x98846b){_0xe674d2[_0x833d('0x8')]({'attributes':['id'],'raw':!![]})[_0x833d('0x9')](function(_0x324eb3){_0xe674d2['setDataValue']('Users',_0x324eb3[_0x833d('0xa')](function(_0x22a1fe){return{'id':_0x22a1fe['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xe674d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x833d('0x9')](function(_0x1093ca){_0xe674d2[_0x833d('0xb')](_0x833d('0xc'),_0x1093ca[_0x833d('0xd')]);OpenchannelInteractionEvents[_0x833d('0xe')](_0x4564e1+':'+_0xe674d2['id'],_0xe674d2);OpenchannelInteractionEvents[_0x833d('0xe')](_0x4564e1,_0xe674d2);_0x98846b(null);})[_0x833d('0xf')](_0x98846b(null));};}for(var e in events){if(events[_0x833d('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x833d('0x11')](e,emitEvent(event));}}module[_0x833d('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7ba1729..d016180 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 _0xdaff=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0xdaff,0xdb));var _0xfdaf=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdaff[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0xfdaf('0x0'));var logger=require(_0xfdaf('0x1'))(_0xfdaf('0x2'));var moment=require(_0xfdaf('0x3'));var BPromise=require('bluebird');var rp=require(_0xfdaf('0x4'));var fs=require('fs');var path=require(_0xfdaf('0x5'));var rimraf=require(_0xfdaf('0x6'));var config=require(_0xfdaf('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xfdaf('0x8')]=function(_0x3cf95e,_0x40f35a){return _0x3cf95e[_0xfdaf('0x9')](_0xfdaf('0xa'),attributes,{'tableName':_0xfdaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfdaf('0xc'),'collate':_0xfdaf('0xd'),'hooks':{'beforeUpdate':function(_0x44c854,_0x33aa3f,_0x3363cb){if(_0x44c854[_0xfdaf('0xe')]('closed')){_0x44c854[_0xfdaf('0xf')]=moment()['format'](_0xfdaf('0x10'));}_0x3363cb(null,_0x44c854);}}});}; \ No newline at end of file +var _0x7b14=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','bluebird','request-promise','path','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x7b14,0x91));var _0x47b1=function(_0x2ce6cd,_0x4d3a8d){_0x2ce6cd=_0x2ce6cd-0x0;var _0x1543a8=_0x7b14[_0x2ce6cd];return _0x1543a8;};'use strict';var _=require(_0x47b1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x47b1('0x1'));var rp=require(_0x47b1('0x2'));var fs=require('fs');var path=require(_0x47b1('0x3'));var rimraf=require(_0x47b1('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x47b1('0x5')]=function(_0x317a11,_0x465170){return _0x317a11[_0x47b1('0x6')](_0x47b1('0x7'),attributes,{'tableName':_0x47b1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x47b1('0x9'),'collate':_0x47b1('0xa'),'hooks':{'beforeUpdate':function(_0x1f1926,_0x1d3f8a,_0x248b22){if(_0x1f1926['changed']('closed')){_0x1f1926['closedAt']=moment()[_0x47b1('0xb')](_0x47b1('0xc'));}_0x248b22(null,_0x1f1926);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4fa0888..c6b842f 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 _0xaf33=['socket.io-emitter','./openchannelInteraction.socket','register','request','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','update','body','options','raw','where','attributes','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','then','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost'];(function(_0x290a36,_0x561046){var _0xc59237=function(_0x5c0c52){while(--_0x5c0c52){_0x290a36['push'](_0x290a36['shift']());}};_0xc59237(++_0x561046);}(_0xaf33,0x1c0));var _0x3af3=function(_0x4dcac4,_0x10e48a){_0x4dcac4=_0x4dcac4-0x0;var _0x2a238d=_0xaf33[_0x4dcac4];return _0x2a238d;};'use strict';var _=require(_0x3af3('0x0'));var util=require(_0x3af3('0x1'));var moment=require(_0x3af3('0x2'));var BPromise=require(_0x3af3('0x3'));var rs=require(_0x3af3('0x4'));var fs=require('fs');var Redis=require(_0x3af3('0x5'));var db=require(_0x3af3('0x6'))['db'];var utils=require(_0x3af3('0x7'));var logger=require(_0x3af3('0x8'))(_0x3af3('0x9'));var config=require(_0x3af3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3af3('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3af3('0xc')],{'host':_0x3af3('0xd'),'port':0x18eb});var socket=require(_0x3af3('0xe'))(new Redis(config[_0x3af3('0xc')]));require(_0x3af3('0xf'))[_0x3af3('0x10')](socket);function respondWithRpcPromise(_0x5d7049,_0x3e1d60,_0x14ef40){return new BPromise(function(_0x1b0db9,_0x5d4abc){return client[_0x3af3('0x11')](_0x5d7049,_0x14ef40)['then'](function(_0x1f4d15){logger['info'](_0x3af3('0x12'),_0x3e1d60,_0x3af3('0x13'));logger[_0x3af3('0x14')](_0x3af3('0x15'),_0x3e1d60,_0x3af3('0x13'),JSON[_0x3af3('0x16')](_0x1f4d15));if(_0x1f4d15['error']){if(_0x1f4d15[_0x3af3('0x17')]['code']===0x1f4){logger[_0x3af3('0x17')](_0x3af3('0x12'),_0x3e1d60,_0x1f4d15[_0x3af3('0x17')]['message']);return _0x5d4abc(_0x1f4d15[_0x3af3('0x17')][_0x3af3('0x18')]);}logger[_0x3af3('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3e1d60,_0x1f4d15['error'][_0x3af3('0x18')]);return _0x1b0db9(_0x1f4d15[_0x3af3('0x17')]['message']);}else{logger[_0x3af3('0x19')](_0x3af3('0x12'),_0x3e1d60,_0x3af3('0x13'));_0x1b0db9(_0x1f4d15[_0x3af3('0x1a')][_0x3af3('0x18')]);}})['catch'](function(_0x27d6dc){logger['error'](_0x3af3('0x12'),_0x3e1d60,_0x27d6dc);_0x5d4abc(_0x27d6dc);});});}exports['UpdateOpenchannelInteraction']=function(_0x9f5b9b){var _0x533c61=this;return new Promise(function(_0x41e119,_0x1a822b){return db['OpenchannelInteraction'][_0x3af3('0x1b')](_0x9f5b9b[_0x3af3('0x1c')],{'raw':_0x9f5b9b[_0x3af3('0x1d')]?_0x9f5b9b['options'][_0x3af3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9f5b9b[_0x3af3('0x1d')]?_0x9f5b9b[_0x3af3('0x1d')][_0x3af3('0x1f')]||null:null,'attributes':_0x9f5b9b[_0x3af3('0x1d')]?_0x9f5b9b[_0x3af3('0x1d')][_0x3af3('0x20')]||null:null,'limit':_0x9f5b9b['options']?_0x9f5b9b[_0x3af3('0x1d')]['limit']||null:null})['then'](function(_0x2d6baf){logger[_0x3af3('0x19')](_0x3af3('0x21'),_0x9f5b9b);logger[_0x3af3('0x14')](_0x3af3('0x21'),_0x9f5b9b,JSON[_0x3af3('0x16')](_0x2d6baf));_0x41e119(_0x2d6baf);})[_0x3af3('0x22')](function(_0x4bdb4e){logger['error'](_0x3af3('0x21'),_0x4bdb4e[_0x3af3('0x18')],_0x9f5b9b);_0x1a822b(_0x533c61['error'](0x1f4,_0x4bdb4e[_0x3af3('0x18')]));});});};exports[_0x3af3('0x23')]=function(_0x32f789){return new Promise(function(_0x38b50f,_0x54f3cc){return db['OpenchannelInteraction'][_0x3af3('0x24')]({'where':_0x32f789[_0x3af3('0x1d')]?_0x32f789[_0x3af3('0x1d')][_0x3af3('0x1f')]||null:null})[_0x3af3('0x25')](function(_0x32f8b7){if(_0x32f8b7){return _0x32f8b7[_0x3af3('0x26')](_0x32f789['body'][_0x3af3('0x27')],_[_0x3af3('0x28')](_0x32f789[_0x3af3('0x1c')],[_0x3af3('0x27'),'id'])||{});}})['spread'](function(_0x4137eb){logger['info'](_0x3af3('0x29'),_0x32f789);logger[_0x3af3('0x14')](_0x3af3('0x29'),_0x32f789,JSON[_0x3af3('0x16')](_0x4137eb));_0x38b50f(_0x4137eb);})[_0x3af3('0x22')](function(_0x3443d5){logger[_0x3af3('0x17')](_0x3af3('0x29'),_0x3443d5['message'],_0x32f789);_0x54f3cc(_this[_0x3af3('0x17')](0x1f4,_0x3443d5[_0x3af3('0x18')]));});});}; \ No newline at end of file +var _0x4130=['request','then','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','debug','catch','find','addTags','ids','omit','AddTags','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x4130,0x95));var _0x0413=function(_0x2ab62c,_0x25f22a){_0x2ab62c=_0x2ab62c-0x0;var _0x3aef43=_0x4130[_0x2ab62c];return _0x3aef43;};'use strict';var _=require(_0x0413('0x0'));var util=require(_0x0413('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0413('0x2'));var db=require(_0x0413('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0413('0x4'))(_0x0413('0x5'));var config=require(_0x0413('0x6'));var jayson=require(_0x0413('0x7'));var client=jayson['client'][_0x0413('0x8')]({'port':0x232a});config['redis']=_[_0x0413('0x9')](config[_0x0413('0xa')],{'host':_0x0413('0xb'),'port':0x18eb});var socket=require(_0x0413('0xc'))(new Redis(config['redis']));require(_0x0413('0xd'))[_0x0413('0xe')](socket);function respondWithRpcPromise(_0x468a46,_0x433eab,_0x2eb90f){return new BPromise(function(_0x3effc8,_0x46967a){return client[_0x0413('0xf')](_0x468a46,_0x2eb90f)[_0x0413('0x10')](function(_0x574404){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x433eab,_0x0413('0x11'));logger['debug'](_0x0413('0x12'),_0x433eab,_0x0413('0x11'),JSON[_0x0413('0x13')](_0x574404));if(_0x574404[_0x0413('0x14')]){if(_0x574404[_0x0413('0x14')][_0x0413('0x15')]===0x1f4){logger[_0x0413('0x14')](_0x0413('0x16'),_0x433eab,_0x574404[_0x0413('0x14')][_0x0413('0x17')]);return _0x46967a(_0x574404[_0x0413('0x14')][_0x0413('0x17')]);}logger['error'](_0x0413('0x16'),_0x433eab,_0x574404['error']['message']);return _0x3effc8(_0x574404[_0x0413('0x14')][_0x0413('0x17')]);}else{logger[_0x0413('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x433eab,_0x0413('0x11'));_0x3effc8(_0x574404[_0x0413('0x19')][_0x0413('0x17')]);}})['catch'](function(_0x538159){logger[_0x0413('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x433eab,_0x538159);_0x46967a(_0x538159);});});}exports[_0x0413('0x1a')]=function(_0x1689ce){var _0x436e58=this;return new Promise(function(_0x528f8a,_0x3a7706){return db[_0x0413('0x1b')][_0x0413('0x1c')](_0x1689ce[_0x0413('0x1d')],{'raw':_0x1689ce[_0x0413('0x1e')]?_0x1689ce[_0x0413('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1689ce[_0x0413('0x1e')]?_0x1689ce[_0x0413('0x1e')][_0x0413('0x1f')]||null:null,'attributes':_0x1689ce[_0x0413('0x1e')]?_0x1689ce['options'][_0x0413('0x20')]||null:null,'limit':_0x1689ce[_0x0413('0x1e')]?_0x1689ce[_0x0413('0x1e')][_0x0413('0x21')]||null:null})[_0x0413('0x10')](function(_0xd5c999){logger[_0x0413('0x18')](_0x0413('0x1a'),_0x1689ce);logger[_0x0413('0x22')](_0x0413('0x1a'),_0x1689ce,JSON[_0x0413('0x13')](_0xd5c999));_0x528f8a(_0xd5c999);})[_0x0413('0x23')](function(_0x1c0aa1){logger[_0x0413('0x14')](_0x0413('0x1a'),_0x1c0aa1[_0x0413('0x17')],_0x1689ce);_0x3a7706(_0x436e58[_0x0413('0x14')](0x1f4,_0x1c0aa1[_0x0413('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x42fb5c){return new Promise(function(_0x1a042d,_0x1dda8d){return db['OpenchannelInteraction'][_0x0413('0x24')]({'where':_0x42fb5c[_0x0413('0x1e')]?_0x42fb5c[_0x0413('0x1e')]['where']||null:null})[_0x0413('0x10')](function(_0x59d0f6){if(_0x59d0f6){return _0x59d0f6[_0x0413('0x25')](_0x42fb5c[_0x0413('0x1d')][_0x0413('0x26')],_[_0x0413('0x27')](_0x42fb5c[_0x0413('0x1d')],['ids','id'])||{});}})['spread'](function(_0x1db1c9){logger[_0x0413('0x18')](_0x0413('0x28'),_0x42fb5c);logger[_0x0413('0x22')](_0x0413('0x28'),_0x42fb5c,JSON[_0x0413('0x13')](_0x1db1c9));_0x1a042d(_0x1db1c9);})[_0x0413('0x23')](function(_0x367354){logger[_0x0413('0x14')](_0x0413('0x28'),_0x367354[_0x0413('0x17')],_0x42fb5c);_0x1dda8d(_this[_0x0413('0x14')](0x1f4,_0x367354[_0x0413('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 6b8526b..a42d01a 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 _0x6966=['./openchannelInteraction.events','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6966,0x134));var _0x6696=function(_0x818095,_0x387eab){_0x818095=_0x818095-0x0;var _0x19ffaf=_0x6966[_0x818095];return _0x19ffaf;};'use strict';var OpenchannelInteractionEvents=require(_0x6696('0x0'));var events=['save','remove',_0x6696('0x1')];function createListener(_0xe40cb3,_0x5485a8){return function(_0x482d57){_0x5485a8[_0x6696('0x2')](_0xe40cb3,_0x482d57);};}function removeListener(_0x31b7bf,_0x56f09b){return function(){OpenchannelInteractionEvents[_0x6696('0x3')](_0x31b7bf,_0x56f09b);};}exports[_0x6696('0x4')]=function(_0x40da53){for(var _0x231640=0x0,_0x332b23=events[_0x6696('0x5')];_0x231640<_0x332b23;_0x231640++){var _0x41c5d4=events[_0x231640];var _0x6a7f04=createListener(_0x6696('0x6')+_0x41c5d4,_0x40da53);OpenchannelInteractionEvents['on'](_0x41c5d4,_0x6a7f04);}}; \ No newline at end of file +var _0x62a0=['save','remove','update','emit','register','./openchannelInteraction.events'];(function(_0x551ec8,_0xa8e43d){var _0x1e8b9b=function(_0x19aeba){while(--_0x19aeba){_0x551ec8['push'](_0x551ec8['shift']());}};_0x1e8b9b(++_0xa8e43d);}(_0x62a0,0x143));var _0x062a=function(_0x17e652,_0x16a06e){_0x17e652=_0x17e652-0x0;var _0x48bcf2=_0x62a0[_0x17e652];return _0x48bcf2;};'use strict';var OpenchannelInteractionEvents=require(_0x062a('0x0'));var events=[_0x062a('0x1'),_0x062a('0x2'),_0x062a('0x3')];function createListener(_0x1945b4,_0x47091c){return function(_0x33dfcf){_0x47091c[_0x062a('0x4')](_0x1945b4,_0x33dfcf);};}function removeListener(_0x29635a,_0x100dcb){return function(){OpenchannelInteractionEvents['removeListener'](_0x29635a,_0x100dcb);};}exports[_0x062a('0x5')]=function(_0x44687d){for(var _0x31ea49=0x0,_0x1d5df6=events['length'];_0x31ea49<_0x1d5df6;_0x31ea49++){var _0x44680c=events[_0x31ea49];var _0x441636=createListener('openchannelInteraction:'+_0x44680c,_0x44687d);OpenchannelInteractionEvents['on'](_0x44680c,_0x441636);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0543fe4..15d39c2 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x15fb0b,_0x44b92d){var _0x423f50=function(_0x32b8c5){while(--_0x32b8c5){_0x15fb0b['push'](_0x15fb0b['shift']());}};_0x423f50(++_0x44b92d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x1ea1e8,_0x5aa4ad){var _0xd2c012=function(_0x42f8c8){while(--_0x42f8c8){_0x1ea1e8['push'](_0x1ea1e8['shift']());}};_0xd2c012(++_0x5aa4ad);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0862a6e..89eea6a 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 _0x87d9=['STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x440e9c,_0x4bc703){var _0x215d0d=function(_0x5d020f){while(--_0x5d020f){_0x440e9c['push'](_0x440e9c['shift']());}};_0x215d0d(++_0x4bc703);}(_0x87d9,0x143));var _0x987d=function(_0x434ab8,_0x164e29){_0x434ab8=_0x434ab8-0x0;var _0x4173a2=_0x87d9[_0x434ab8];return _0x4173a2;};'use strict';var Sequelize=require(_0x987d('0x0'));module['exports']={'body':{'type':Sequelize[_0x987d('0x1')](_0x987d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x987d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x987d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x987d('0x4')]('in','out'),'defaultValue':_0x987d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x987d('0x6')]},'providerResponse':{'type':Sequelize[_0x987d('0x1')]}}; \ No newline at end of file +var _0xf69c=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x896187,_0x3854e5){var _0x1a55ef=function(_0x443404){while(--_0x443404){_0x896187['push'](_0x896187['shift']());}};_0x1a55ef(++_0x3854e5);}(_0xf69c,0x1e2));var _0xcf69=function(_0x5b4303,_0x225e71){_0x5b4303=_0x5b4303-0x0;var _0x1aacba=_0xf69c[_0x5b4303];return _0x1aacba;};'use strict';var Sequelize=require(_0xcf69('0x0'));module[_0xcf69('0x1')]={'body':{'type':Sequelize[_0xcf69('0x2')](_0xcf69('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xcf69('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf69('0x5')]('in',_0xcf69('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xcf69('0x7')]},'providerName':{'type':Sequelize[_0xcf69('0x8')]},'providerResponse':{'type':Sequelize[_0xcf69('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f5a9bdb..5107621 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 _0x7edb=['update','destroy','end','name','send','index','map','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','OpenchannelMessage','findAll','show','params','rawAttributes','keys','find','create','body','describe','openchannel-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','info','[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','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','QueryTypes','interface','motionChannel','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save'];(function(_0x58a049,_0x1ea1fc){var _0xd2b027=function(_0x3ff364){while(--_0x3ff364){_0x58a049['push'](_0x58a049['shift']());}};_0xd2b027(++_0x1ea1fc);}(_0x7edb,0x158));var _0xb7ed=function(_0x126ba8,_0x2d4230){_0x126ba8=_0x126ba8-0x0;var _0x482522=_0x7edb[_0x126ba8];return _0x482522;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7ed('0x0'));var zipdir=require(_0xb7ed('0x1'));var jsonpatch=require(_0xb7ed('0x2'));var rp=require(_0xb7ed('0x3'));var moment=require(_0xb7ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb7ed('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb7ed('0x6'));var csv=require(_0xb7ed('0x7'));var ejs=require(_0xb7ed('0x8'));var fs=require('fs');var fs_extra=require(_0xb7ed('0x9'));var _=require(_0xb7ed('0xa'));var squel=require(_0xb7ed('0xb'));var crypto=require(_0xb7ed('0xc'));var jsforce=require(_0xb7ed('0xd'));var deskjs=require(_0xb7ed('0xe'));var toCsv=require(_0xb7ed('0x7'));var querystring=require('querystring');var Papa=require(_0xb7ed('0xf'));var Redis=require(_0xb7ed('0x10'));var authService=require(_0xb7ed('0x11'));var qs=require(_0xb7ed('0x12'));var as=require(_0xb7ed('0x13'));var hardwareService=require(_0xb7ed('0x14'));var logger=require(_0xb7ed('0x15'))('api');var utils=require(_0xb7ed('0x16'));var config=require(_0xb7ed('0x17'));var licenseUtil=require(_0xb7ed('0x18'));var db=require(_0xb7ed('0x19'))['db'];config[_0xb7ed('0x1a')]=_['defaults'](config['redis'],{'host':_0xb7ed('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb7ed('0x1a')]));require(_0xb7ed('0x1c'))[_0xb7ed('0x1d')](socket);var jayson=require(_0xb7ed('0x1e'));var client=jayson[_0xb7ed('0x1f')][_0xb7ed('0x20')]({'port':0x232c});var client9002=jayson[_0xb7ed('0x1f')][_0xb7ed('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4046c7,_0x2ea4cf,_0x40ca8a,_0x3e61b8){return new BPromise(function(_0x569fb1,_0x42c9e7){var _0x48d849=_0x3e61b8||client;return _0x48d849[_0xb7ed('0x21')](_0x4046c7,_0x40ca8a)[_0xb7ed('0x22')](function(_0x537d3b){logger['info'](_0xb7ed('0x23'),_0x2ea4cf,_0xb7ed('0x24'));logger[_0xb7ed('0x25')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2ea4cf,_0xb7ed('0x24'),JSON[_0xb7ed('0x26')](_0x537d3b));if(_0x537d3b[_0xb7ed('0x27')]){if(_0x537d3b[_0xb7ed('0x27')]['code']===0x1f4){logger[_0xb7ed('0x27')](_0xb7ed('0x23'),_0x2ea4cf,_0x537d3b[_0xb7ed('0x27')][_0xb7ed('0x28')]);return _0x42c9e7(_0x537d3b[_0xb7ed('0x27')][_0xb7ed('0x28')]);}logger[_0xb7ed('0x27')](_0xb7ed('0x23'),_0x2ea4cf,_0x537d3b['error'][_0xb7ed('0x28')]);return _0x569fb1(_0x537d3b[_0xb7ed('0x27')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2ea4cf,_0xb7ed('0x24'));_0x569fb1(_0x537d3b['result']['message']);}})[_0xb7ed('0x29')](function(_0x5807fd){logger[_0xb7ed('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x2ea4cf,_0x5807fd);_0x42c9e7(_0x5807fd);});});}function respondWithStatusCode(_0xcb0442,_0x2ec849){_0x2ec849=_0x2ec849||0xcc;return function(_0x3e48e8){if(_0x3e48e8){return _0xcb0442[_0xb7ed('0x2a')](_0x2ec849);}return _0xcb0442[_0xb7ed('0x2b')](_0x2ec849)['end']();};}function respondWithResult(_0x578ac0,_0x74eb3c){_0x74eb3c=_0x74eb3c||0xc8;return function(_0x32811f){if(_0x32811f){return _0x578ac0[_0xb7ed('0x2b')](_0x74eb3c)[_0xb7ed('0x2c')](_0x32811f);}};}function respondWithFilteredResult(_0x2f726c,_0x59b080){return function(_0x2ef587){if(_0x2ef587){var _0x43bb8f=typeof _0x59b080['offset']===_0xb7ed('0x2d')&&typeof _0x59b080[_0xb7ed('0x2e')]===_0xb7ed('0x2d');var _0x4aaba3=_0x2ef587[_0xb7ed('0x2f')];var _0x28da94=_0x43bb8f?0x0:_0x59b080[_0xb7ed('0x30')];var _0x1cbcd6=_0x43bb8f?_0x2ef587['count']:_0x59b080[_0xb7ed('0x30')]+_0x59b080['limit'];var _0x108b9a;if(_0x1cbcd6>=_0x4aaba3){_0x1cbcd6=_0x4aaba3;_0x108b9a=0xc8;}else{_0x108b9a=0xce;}_0x2f726c[_0xb7ed('0x2b')](_0x108b9a);return _0x2f726c[_0xb7ed('0x31')](_0xb7ed('0x32'),_0x28da94+'-'+_0x1cbcd6+'/'+_0x4aaba3)[_0xb7ed('0x2c')](_0x2ef587);}return null;};}function patchUpdates(_0x28904c){return function(_0x15c527){try{jsonpatch['apply'](_0x15c527,_0x28904c,!![]);}catch(_0x2ff290){return BPromise['reject'](_0x2ff290);}return _0x15c527[_0xb7ed('0x33')]();};}function saveUpdates(_0x51267e,_0x22246d){return function(_0x17138f){if(_0x17138f){return _0x17138f[_0xb7ed('0x34')](_0x51267e)[_0xb7ed('0x22')](function(_0x5701a5){return _0x5701a5;});}return null;};}function removeEntity(_0x2ef2b4,_0x382275){return function(_0x19215b){if(_0x19215b){return _0x19215b[_0xb7ed('0x35')]()[_0xb7ed('0x22')](function(){_0x2ef2b4['status'](0xcc)[_0xb7ed('0x36')]();});}};}function handleEntityNotFound(_0x3aa52b,_0x1d1fb9){return function(_0xd02f82){if(!_0xd02f82){_0x3aa52b[_0xb7ed('0x2a')](0x194);}return _0xd02f82;};}function handleError(_0x366056,_0x43196e){_0x43196e=_0x43196e||0x1f4;return function(_0x16a6fe){logger[_0xb7ed('0x27')](_0x16a6fe['stack']);if(_0x16a6fe[_0xb7ed('0x37')]){delete _0x16a6fe['name'];}_0x366056[_0xb7ed('0x2b')](_0x43196e)[_0xb7ed('0x38')](_0x16a6fe);};}exports[_0xb7ed('0x39')]=function(_0x5566b3,_0x3bf69e){var _0x2c96af={},_0x1ef126={},_0x382666={'count':0x0,'rows':[]};var _0x21b92f=_[_0xb7ed('0x3a')](db['OpenchannelMessage']['rawAttributes'],function(_0x25e5b0){return{'name':_0x25e5b0['fieldName'],'type':_0x25e5b0[_0xb7ed('0x3b')][_0xb7ed('0x3c')]};});_0x1ef126['model']=_['map'](_0x21b92f,_0xb7ed('0x37'));_0x1ef126[_0xb7ed('0x3d')]=_['keys'](_0x5566b3[_0xb7ed('0x3d')]);_0x1ef126['filters']=_[_0xb7ed('0x3e')](_0x1ef126[_0xb7ed('0x3f')],_0x1ef126[_0xb7ed('0x3d')]);_0x2c96af[_0xb7ed('0x40')]=_['intersection'](_0x1ef126[_0xb7ed('0x3f')],qs[_0xb7ed('0x41')](_0x5566b3['query'][_0xb7ed('0x41')]));_0x2c96af[_0xb7ed('0x40')]=_0x2c96af[_0xb7ed('0x40')][_0xb7ed('0x42')]?_0x2c96af['attributes']:_0x1ef126[_0xb7ed('0x3f')];if(!_0x5566b3[_0xb7ed('0x3d')][_0xb7ed('0x43')](_0xb7ed('0x44'))){_0x2c96af[_0xb7ed('0x2e')]=qs[_0xb7ed('0x2e')](_0x5566b3[_0xb7ed('0x3d')]['limit']);_0x2c96af[_0xb7ed('0x30')]=qs[_0xb7ed('0x30')](_0x5566b3['query'][_0xb7ed('0x30')]);}_0x2c96af['order']=qs['sort'](_0x5566b3['query'][_0xb7ed('0x45')]);_0x2c96af[_0xb7ed('0x46')]=qs[_0xb7ed('0x47')](_[_0xb7ed('0x48')](_0x5566b3['query'],_0x1ef126[_0xb7ed('0x47')]),_0x21b92f);if(_0x5566b3[_0xb7ed('0x3d')][_0xb7ed('0x49')]){_0x2c96af[_0xb7ed('0x46')]=_['merge'](_0x2c96af[_0xb7ed('0x46')],{'$or':_[_0xb7ed('0x3a')](_0x21b92f,function(_0x20f189){if(_0x20f189[_0xb7ed('0x3b')]!==_0xb7ed('0x4a')){var _0x4cc25d={};_0x4cc25d[_0x20f189[_0xb7ed('0x37')]]={'$like':'%'+_0x5566b3[_0xb7ed('0x3d')][_0xb7ed('0x49')]+'%'};return _0x4cc25d;}})});}_0x2c96af=_[_0xb7ed('0x4b')]({},_0x2c96af,_0x5566b3[_0xb7ed('0x4c')]);var _0x30f07f={'where':_0x2c96af[_0xb7ed('0x46')]};return db['OpenchannelMessage'][_0xb7ed('0x2f')](_0x30f07f)['then'](function(_0x117a6c){_0x382666['count']=_0x117a6c;if(_0x5566b3['query'][_0xb7ed('0x4d')]){_0x2c96af[_0xb7ed('0x4e')]=[{'all':!![]}];}return db[_0xb7ed('0x4f')][_0xb7ed('0x50')](_0x2c96af);})['then'](function(_0x4481ef){_0x382666['rows']=_0x4481ef;return _0x382666;})['then'](respondWithFilteredResult(_0x3bf69e,_0x2c96af))[_0xb7ed('0x29')](handleError(_0x3bf69e,null));};exports[_0xb7ed('0x51')]=function(_0x8c5408,_0x219a7f){var _0x30626a={'raw':!![],'where':{'id':_0x8c5408[_0xb7ed('0x52')]['id']}},_0x314b29={};_0x314b29[_0xb7ed('0x3f')]=_['keys'](db[_0xb7ed('0x4f')][_0xb7ed('0x53')]);_0x314b29['query']=_[_0xb7ed('0x54')](_0x8c5408[_0xb7ed('0x3d')]);_0x314b29[_0xb7ed('0x47')]=_['intersection'](_0x314b29[_0xb7ed('0x3f')],_0x314b29['query']);_0x30626a[_0xb7ed('0x40')]=_['intersection'](_0x314b29[_0xb7ed('0x3f')],qs['fields'](_0x8c5408[_0xb7ed('0x3d')]['fields']));_0x30626a[_0xb7ed('0x40')]=_0x30626a[_0xb7ed('0x40')][_0xb7ed('0x42')]?_0x30626a[_0xb7ed('0x40')]:_0x314b29[_0xb7ed('0x3f')];if(_0x8c5408[_0xb7ed('0x3d')][_0xb7ed('0x4d')]){_0x30626a[_0xb7ed('0x4e')]=[{'all':!![]}];}_0x30626a=_[_0xb7ed('0x4b')]({},_0x30626a,_0x8c5408[_0xb7ed('0x4c')]);return db['OpenchannelMessage'][_0xb7ed('0x55')](_0x30626a)[_0xb7ed('0x22')](handleEntityNotFound(_0x219a7f,null))['then'](respondWithResult(_0x219a7f,null))[_0xb7ed('0x29')](handleError(_0x219a7f,null));};exports['create']=function(_0x24ec5c,_0x1c6554){return db[_0xb7ed('0x4f')][_0xb7ed('0x56')](_0x24ec5c[_0xb7ed('0x57')],{})[_0xb7ed('0x22')](respondWithResult(_0x1c6554,0xc9))[_0xb7ed('0x29')](handleError(_0x1c6554,null));};exports[_0xb7ed('0x34')]=function(_0x11f036,_0x4ea1b8){if(_0x11f036['body']['id']){delete _0x11f036[_0xb7ed('0x57')]['id'];}return db[_0xb7ed('0x4f')][_0xb7ed('0x55')]({'where':{'id':_0x11f036[_0xb7ed('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ea1b8,null))['then'](saveUpdates(_0x11f036[_0xb7ed('0x57')],null))['then'](respondWithResult(_0x4ea1b8,null))[_0xb7ed('0x29')](handleError(_0x4ea1b8,null));};exports['destroy']=function(_0x3a739d,_0x1eb2ba){return db['OpenchannelMessage'][_0xb7ed('0x55')]({'where':{'id':_0x3a739d[_0xb7ed('0x52')]['id']}})[_0xb7ed('0x22')](handleEntityNotFound(_0x1eb2ba,null))[_0xb7ed('0x22')](removeEntity(_0x1eb2ba,null))[_0xb7ed('0x29')](handleError(_0x1eb2ba,null));};exports[_0xb7ed('0x58')]=function(_0xf9581c,_0x582a2d){return db[_0xb7ed('0x4f')][_0xb7ed('0x58')]()['then'](respondWithResult(_0x582a2d,null))[_0xb7ed('0x29')](handleError(_0x582a2d,null));};var interaction_log=require('../../config/logger')(_0xb7ed('0x59'));exports['accept']=function(_0x35dfee,_0x1ace5f,_0x82cd8b){var _0x465ee5={'agent':{},'channel':'openchannel'};if(_0x35dfee[_0xb7ed('0x57')]['id']){delete _0x35dfee[_0xb7ed('0x57')]['id'];}_0x35dfee[_0xb7ed('0x57')][_0xb7ed('0x5a')]=!![];_0x35dfee[_0xb7ed('0x57')][_0xb7ed('0x5b')]=moment()[_0xb7ed('0x5c')](_0xb7ed('0x5d'));_0x35dfee[_0xb7ed('0x57')][_0xb7ed('0x5e')]=_0x35dfee['body']['UserId']||_0x35dfee['user']['id'];_0x465ee5[_0xb7ed('0x5f')]['id']=_0x35dfee[_0xb7ed('0x57')][_0xb7ed('0x5e')];return db[_0xb7ed('0x4f')]['find']({'where':{'id':_0x35dfee[_0xb7ed('0x52')]['id'],'UserId':null}})[_0xb7ed('0x22')](handleEntityNotFound(_0x1ace5f,null))[_0xb7ed('0x22')](saveUpdates(_0x35dfee[_0xb7ed('0x57')],null))[_0xb7ed('0x22')](function(_0x5a5ef6){if(_0x5a5ef6){_0x465ee5[_0xb7ed('0x28')]=_0x5a5ef6[_0xb7ed('0x60')]({'plain':!![]});return db[_0xb7ed('0x61')]['find']({'where':{'id':_0x5a5ef6['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1ace5f,null))[_0xb7ed('0x22')](function(_0x4cb8ab){if(_0x4cb8ab){return _0x4cb8ab['update']({'UserId':_0x35dfee[_0xb7ed('0x57')][_0xb7ed('0x5e')],'read1stAt':_[_0xb7ed('0x62')](_0x4cb8ab[_0xb7ed('0x63')])?moment()[_0xb7ed('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5db626){if(_0x5db626){_0x465ee5[_0xb7ed('0x64')]=_0x5db626['get']({'plain':!![]});interaction_log[_0xb7ed('0x65')](_0xb7ed('0x66'),_0x35dfee[_0xb7ed('0x67')]['id'],_0x35dfee[_0xb7ed('0x67')]['name'],_0x35dfee[_0xb7ed('0x67')][_0xb7ed('0x68')],_0x465ee5['interaction']['id'],_0x35dfee[_0xb7ed('0x57')]?JSON['stringify'](_0x35dfee[_0xb7ed('0x57')]):_0xb7ed('0x69'));return respondWithRpcPromise(_0xb7ed('0x6a'),_0xb7ed('0x6b'),_0x465ee5);}return null;})['then'](function(_0x323143){var _0x561c85=_0xb7ed('0x6c')+_0x323143['message'][_0xb7ed('0x6d')];return db['sequelize'][_0xb7ed('0x3d')](_0x561c85,{'type':db[_0xb7ed('0x6e')]['QueryTypes'][_0xb7ed('0x6f')],'raw':!![]})[_0xb7ed('0x22')](function(_0x3ff537){return _0x3ff537;});})[_0xb7ed('0x22')](function(_0x3d780d){if(_0x3d780d){_0x465ee5[_0xb7ed('0x28')][_0xb7ed('0x70')]=_0x3d780d[0x0];if(!_0x35dfee[_0xb7ed('0x57')][_0xb7ed('0x5e')])return;return db[_0xb7ed('0x71')][_0xb7ed('0x55')]({'where':{'id':_0x35dfee[_0xb7ed('0x57')][_0xb7ed('0x5e')],'role':_0xb7ed('0x5f')},'attributes':['id',_0xb7ed('0x37'),_0xb7ed('0x72'),_0xb7ed('0x73'),_0xb7ed('0x74')],'raw':!![]});}return null;})[_0xb7ed('0x22')](function(_0x112ac2){if(!_0x112ac2)return null;_0x465ee5[_0xb7ed('0x28')][_0xb7ed('0x5f')]=_0x112ac2;return _0x465ee5;})['then'](function(_0x2678af){if(_0x2678af){if(_0x35dfee[_0xb7ed('0x57')]['manual']){_0x465ee5[_0xb7ed('0x28')]['interface']=util[_0xb7ed('0x5c')](_0xb7ed('0x75'),_0x35dfee[_0xb7ed('0x67')]['name']);_0x465ee5[_0xb7ed('0x28')][_0xb7ed('0x76')]=_0x465ee5[_0xb7ed('0x76')];_0x465ee5[_0xb7ed('0x28')]['motionChannel']=_0x465ee5[_0xb7ed('0x76')];_0x465ee5[_0xb7ed('0x28')][_0xb7ed('0x77')]=_0xb7ed('0x78');return respondWithRpcPromise(_0xb7ed('0x79'),_0xb7ed('0x79'),{'event':_0xb7ed('0x7a'),'message':_0x465ee5['message']},client9002)[_0xb7ed('0x22')](function(){return _0x465ee5;});}return _0x465ee5;}return null;})[_0xb7ed('0x22')](respondWithResult(_0x1ace5f,null))[_0xb7ed('0x29')](handleError(_0x1ace5f,null));};var interaction_log=require(_0xb7ed('0x15'))(_0xb7ed('0x59'));exports[_0xb7ed('0x7b')]=function(_0x3a4020,_0x4b996c,_0x583be8){var _0x5b392f={'agent':{},'channel':_0xb7ed('0x7c')};if(_0x3a4020[_0xb7ed('0x57')]['id']){delete _0x3a4020[_0xb7ed('0x57')]['id'];}_0x3a4020[_0xb7ed('0x57')][_0xb7ed('0x5e')]=_0x3a4020[_0xb7ed('0x57')]['UserId']||_0x3a4020['user']['id'];_0x5b392f['agent']['id']=_0x3a4020[_0xb7ed('0x57')]['UserId'];return db[_0xb7ed('0x4f')][_0xb7ed('0x55')]({'where':{'id':_0x3a4020[_0xb7ed('0x52')]['id'],'UserId':null}})[_0xb7ed('0x22')](handleEntityNotFound(_0x4b996c,null))[_0xb7ed('0x22')](function(_0x3102b9){if(_0x3102b9){_0x5b392f[_0xb7ed('0x28')]=_0x3102b9['get']({'plain':!![]});return db[_0xb7ed('0x61')][_0xb7ed('0x55')]({'where':{'id':_0x3102b9[_0xb7ed('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x4b996c,null))[_0xb7ed('0x22')](function(_0x11f11a){if(_0x11f11a){_0x5b392f[_0xb7ed('0x64')]=_0x11f11a[_0xb7ed('0x60')]({'plain':!![]});interaction_log['info'](_0xb7ed('0x7e'),_0x3a4020[_0xb7ed('0x67')]['id'],_0x3a4020[_0xb7ed('0x67')]['name'],_0x3a4020['user']['role'],_0x5b392f['interaction']['id'],_0x3a4020[_0xb7ed('0x57')]?JSON[_0xb7ed('0x26')](_0x3a4020[_0xb7ed('0x57')]):_0xb7ed('0x69'));return respondWithRpcPromise('RejectMessage',_0xb7ed('0x7f'),_0x5b392f);}return null;})[_0xb7ed('0x22')](function(_0x3206f9){var _0x17c64f=_0xb7ed('0x6c')+_0x3206f9[_0xb7ed('0x28')][_0xb7ed('0x6d')];return db[_0xb7ed('0x80')]['query'](_0x17c64f,{'type':db[_0xb7ed('0x6e')][_0xb7ed('0x81')][_0xb7ed('0x6f')],'raw':!![]})[_0xb7ed('0x22')](function(_0x21451e){return _0x21451e;});})[_0xb7ed('0x22')](function(_0x2e1f2a){if(_0x2e1f2a){_0x5b392f[_0xb7ed('0x28')][_0xb7ed('0x70')]=_0x2e1f2a[0x0];if(!_0x3a4020[_0xb7ed('0x57')]['UserId'])return;return db[_0xb7ed('0x71')][_0xb7ed('0x55')]({'where':{'id':_0x3a4020['body'][_0xb7ed('0x5e')],'role':_0xb7ed('0x5f')},'attributes':['id',_0xb7ed('0x37'),'fullname',_0xb7ed('0x73'),'internal'],'raw':!![]});}return null;})[_0xb7ed('0x22')](function(_0x28d92f){if(!_0x28d92f)return null;_0x5b392f[_0xb7ed('0x28')]['agent']=_0x28d92f;return _0x5b392f;})[_0xb7ed('0x22')](function(_0x22bb0e){if(_0x22bb0e){_0x22bb0e['message'][_0xb7ed('0x82')]=util[_0xb7ed('0x5c')](_0xb7ed('0x75'),_0x3a4020[_0xb7ed('0x67')]['name']);_0x22bb0e[_0xb7ed('0x28')][_0xb7ed('0x76')]=_0x5b392f[_0xb7ed('0x76')];_0x22bb0e[_0xb7ed('0x28')][_0xb7ed('0x83')]=_0x5b392f[_0xb7ed('0x76')];_0x22bb0e[_0xb7ed('0x28')][_0xb7ed('0x77')]=_0xb7ed('0x7b');respondWithRpcPromise(_0xb7ed('0x79'),_0xb7ed('0x79'),{'event':'rejectmessage','message':_0x22bb0e[_0xb7ed('0x28')]},client9002);return _0x5b392f;}return null;})[_0xb7ed('0x22')](respondWithResult(_0x4b996c,null))[_0xb7ed('0x29')](handleError(_0x4b996c,null));}; \ No newline at end of file +var _0xdd9e=['catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','rejectmessage','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','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x83838,_0x3dbe19){var _0x4ba21d=function(_0x536cc0){while(--_0x536cc0){_0x83838['push'](_0x83838['shift']());}};_0x4ba21d(++_0x3dbe19);}(_0xdd9e,0x1e2));var _0xedd9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdd9e[_0x321bb2];return _0x9c12ed;};'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'];config[_0xedd9('0x19')]=_['defaults'](config['redis'],{'host':_0xedd9('0x1a'),'port':0x18eb});var socket=require(_0xedd9('0x1b'))(new Redis(config[_0xedd9('0x19')]));require('./openchannelMessage.socket')[_0xedd9('0x1c')](socket);var jayson=require(_0xedd9('0x1d'));var client=jayson[_0xedd9('0x1e')][_0xedd9('0x1f')]({'port':0x232c});var client9002=jayson[_0xedd9('0x1e')][_0xedd9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x50f9d2,_0x2178d9,_0x4f23db,_0x356b7a){return new BPromise(function(_0xc6e926,_0x48d9b9){var _0x3fcd78=_0x356b7a||client;return _0x3fcd78[_0xedd9('0x20')](_0x50f9d2,_0x4f23db)[_0xedd9('0x21')](function(_0x25c581){logger[_0xedd9('0x22')](_0xedd9('0x23'),_0x2178d9,'request\x20sent');logger[_0xedd9('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2178d9,_0xedd9('0x25'),JSON[_0xedd9('0x26')](_0x25c581));if(_0x25c581[_0xedd9('0x27')]){if(_0x25c581[_0xedd9('0x27')][_0xedd9('0x28')]===0x1f4){logger[_0xedd9('0x27')](_0xedd9('0x23'),_0x2178d9,_0x25c581[_0xedd9('0x27')][_0xedd9('0x29')]);return _0x48d9b9(_0x25c581['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2178d9,_0x25c581[_0xedd9('0x27')][_0xedd9('0x29')]);return _0xc6e926(_0x25c581[_0xedd9('0x27')][_0xedd9('0x29')]);}else{logger[_0xedd9('0x22')](_0xedd9('0x23'),_0x2178d9,_0xedd9('0x25'));_0xc6e926(_0x25c581['result'][_0xedd9('0x29')]);}})[_0xedd9('0x2a')](function(_0x1b4e01){logger[_0xedd9('0x27')](_0xedd9('0x23'),_0x2178d9,_0x1b4e01);_0x48d9b9(_0x1b4e01);});});}function respondWithStatusCode(_0x385b5b,_0x70166d){_0x70166d=_0x70166d||0xcc;return function(_0x367b1e){if(_0x367b1e){return _0x385b5b[_0xedd9('0x2b')](_0x70166d);}return _0x385b5b[_0xedd9('0x2c')](_0x70166d)[_0xedd9('0x2d')]();};}function respondWithResult(_0xa7007,_0x2a8edf){_0x2a8edf=_0x2a8edf||0xc8;return function(_0x412299){if(_0x412299){return _0xa7007['status'](_0x2a8edf)[_0xedd9('0x2e')](_0x412299);}};}function respondWithFilteredResult(_0x58a08a,_0x3fd360){return function(_0x57131d){if(_0x57131d){var _0x569773=typeof _0x3fd360[_0xedd9('0x2f')]===_0xedd9('0x30')&&typeof _0x3fd360[_0xedd9('0x31')]===_0xedd9('0x30');var _0x5da1e0=_0x57131d[_0xedd9('0x32')];var _0x29cac0=_0x569773?0x0:_0x3fd360[_0xedd9('0x2f')];var _0x26a19e=_0x569773?_0x57131d[_0xedd9('0x32')]:_0x3fd360['offset']+_0x3fd360[_0xedd9('0x31')];var _0x3b8b02;if(_0x26a19e>=_0x5da1e0){_0x26a19e=_0x5da1e0;_0x3b8b02=0xc8;}else{_0x3b8b02=0xce;}_0x58a08a[_0xedd9('0x2c')](_0x3b8b02);return _0x58a08a[_0xedd9('0x33')](_0xedd9('0x34'),_0x29cac0+'-'+_0x26a19e+'/'+_0x5da1e0)[_0xedd9('0x2e')](_0x57131d);}return null;};}function patchUpdates(_0x311f6d){return function(_0x5b19a4){try{jsonpatch[_0xedd9('0x35')](_0x5b19a4,_0x311f6d,!![]);}catch(_0x341c80){return BPromise['reject'](_0x341c80);}return _0x5b19a4[_0xedd9('0x36')]();};}function saveUpdates(_0x44b2c2,_0x4183dc){return function(_0x5daa62){if(_0x5daa62){return _0x5daa62[_0xedd9('0x37')](_0x44b2c2)['then'](function(_0x321862){return _0x321862;});}return null;};}function removeEntity(_0x595616,_0xc8d356){return function(_0x2308f1){if(_0x2308f1){return _0x2308f1[_0xedd9('0x38')]()[_0xedd9('0x21')](function(){_0x595616[_0xedd9('0x2c')](0xcc)[_0xedd9('0x2d')]();});}};}function handleEntityNotFound(_0x5507c0,_0x22616b){return function(_0x12591c){if(!_0x12591c){_0x5507c0[_0xedd9('0x2b')](0x194);}return _0x12591c;};}function handleError(_0x2da21a,_0x31b32e){_0x31b32e=_0x31b32e||0x1f4;return function(_0x15d971){logger[_0xedd9('0x27')](_0x15d971['stack']);if(_0x15d971[_0xedd9('0x39')]){delete _0x15d971[_0xedd9('0x39')];}_0x2da21a['status'](_0x31b32e)[_0xedd9('0x3a')](_0x15d971);};}exports['index']=function(_0x3d5802,_0x2ba738){var _0x397e38={},_0x22bd7e={},_0x36a5c1={'count':0x0,'rows':[]};var _0x430592=_[_0xedd9('0x3b')](db[_0xedd9('0x3c')][_0xedd9('0x3d')],function(_0x4f6154){return{'name':_0x4f6154[_0xedd9('0x3e')],'type':_0x4f6154[_0xedd9('0x3f')][_0xedd9('0x40')]};});_0x22bd7e[_0xedd9('0x41')]=_[_0xedd9('0x3b')](_0x430592,_0xedd9('0x39'));_0x22bd7e[_0xedd9('0x42')]=_[_0xedd9('0x43')](_0x3d5802[_0xedd9('0x42')]);_0x22bd7e[_0xedd9('0x44')]=_[_0xedd9('0x45')](_0x22bd7e[_0xedd9('0x41')],_0x22bd7e[_0xedd9('0x42')]);_0x397e38[_0xedd9('0x46')]=_[_0xedd9('0x45')](_0x22bd7e[_0xedd9('0x41')],qs[_0xedd9('0x47')](_0x3d5802[_0xedd9('0x42')][_0xedd9('0x47')]));_0x397e38[_0xedd9('0x46')]=_0x397e38[_0xedd9('0x46')][_0xedd9('0x48')]?_0x397e38[_0xedd9('0x46')]:_0x22bd7e[_0xedd9('0x41')];if(!_0x3d5802[_0xedd9('0x42')]['hasOwnProperty']('nolimit')){_0x397e38[_0xedd9('0x31')]=qs[_0xedd9('0x31')](_0x3d5802[_0xedd9('0x42')][_0xedd9('0x31')]);_0x397e38['offset']=qs[_0xedd9('0x2f')](_0x3d5802[_0xedd9('0x42')]['offset']);}_0x397e38['order']=qs['sort'](_0x3d5802['query'][_0xedd9('0x49')]);_0x397e38[_0xedd9('0x4a')]=qs[_0xedd9('0x44')](_[_0xedd9('0x4b')](_0x3d5802['query'],_0x22bd7e[_0xedd9('0x44')]),_0x430592);if(_0x3d5802[_0xedd9('0x42')][_0xedd9('0x4c')]){_0x397e38[_0xedd9('0x4a')]=_['merge'](_0x397e38[_0xedd9('0x4a')],{'$or':_[_0xedd9('0x3b')](_0x430592,function(_0x41286e){if(_0x41286e[_0xedd9('0x3f')]!==_0xedd9('0x4d')){var _0x5e2f8f={};_0x5e2f8f[_0x41286e[_0xedd9('0x39')]]={'$like':'%'+_0x3d5802[_0xedd9('0x42')]['filter']+'%'};return _0x5e2f8f;}})});}_0x397e38=_['merge']({},_0x397e38,_0x3d5802['options']);var _0x227cd6={'where':_0x397e38['where']};return db['OpenchannelMessage'][_0xedd9('0x32')](_0x227cd6)['then'](function(_0x5ee99f){_0x36a5c1['count']=_0x5ee99f;if(_0x3d5802[_0xedd9('0x42')][_0xedd9('0x4e')]){_0x397e38[_0xedd9('0x4f')]=[{'all':!![]}];}return db[_0xedd9('0x3c')][_0xedd9('0x50')](_0x397e38);})['then'](function(_0x35f0e1){_0x36a5c1['rows']=_0x35f0e1;return _0x36a5c1;})[_0xedd9('0x21')](respondWithFilteredResult(_0x2ba738,_0x397e38))[_0xedd9('0x2a')](handleError(_0x2ba738,null));};exports[_0xedd9('0x51')]=function(_0x5e7bd2,_0x28ab0a){var _0x4eaec4={'raw':!![],'where':{'id':_0x5e7bd2[_0xedd9('0x52')]['id']}},_0x336334={};_0x336334['model']=_['keys'](db[_0xedd9('0x3c')][_0xedd9('0x3d')]);_0x336334[_0xedd9('0x42')]=_[_0xedd9('0x43')](_0x5e7bd2[_0xedd9('0x42')]);_0x336334[_0xedd9('0x44')]=_['intersection'](_0x336334[_0xedd9('0x41')],_0x336334[_0xedd9('0x42')]);_0x4eaec4[_0xedd9('0x46')]=_[_0xedd9('0x45')](_0x336334['model'],qs[_0xedd9('0x47')](_0x5e7bd2[_0xedd9('0x42')]['fields']));_0x4eaec4[_0xedd9('0x46')]=_0x4eaec4['attributes'][_0xedd9('0x48')]?_0x4eaec4[_0xedd9('0x46')]:_0x336334[_0xedd9('0x41')];if(_0x5e7bd2['query'][_0xedd9('0x4e')]){_0x4eaec4[_0xedd9('0x4f')]=[{'all':!![]}];}_0x4eaec4=_[_0xedd9('0x53')]({},_0x4eaec4,_0x5e7bd2[_0xedd9('0x54')]);return db[_0xedd9('0x3c')][_0xedd9('0x55')](_0x4eaec4)[_0xedd9('0x21')](handleEntityNotFound(_0x28ab0a,null))[_0xedd9('0x21')](respondWithResult(_0x28ab0a,null))['catch'](handleError(_0x28ab0a,null));};exports[_0xedd9('0x56')]=function(_0xd3daa6,_0x1f78b7){return db['OpenchannelMessage']['create'](_0xd3daa6[_0xedd9('0x57')],{})['then'](respondWithResult(_0x1f78b7,0xc9))[_0xedd9('0x2a')](handleError(_0x1f78b7,null));};exports['update']=function(_0x30f0cb,_0xcdf353){if(_0x30f0cb[_0xedd9('0x57')]['id']){delete _0x30f0cb[_0xedd9('0x57')]['id'];}return db[_0xedd9('0x3c')][_0xedd9('0x55')]({'where':{'id':_0x30f0cb['params']['id']}})[_0xedd9('0x21')](handleEntityNotFound(_0xcdf353,null))[_0xedd9('0x21')](saveUpdates(_0x30f0cb[_0xedd9('0x57')],null))[_0xedd9('0x21')](respondWithResult(_0xcdf353,null))[_0xedd9('0x2a')](handleError(_0xcdf353,null));};exports[_0xedd9('0x38')]=function(_0x2af261,_0x38a8c2){return db[_0xedd9('0x3c')][_0xedd9('0x55')]({'where':{'id':_0x2af261[_0xedd9('0x52')]['id']}})[_0xedd9('0x21')](handleEntityNotFound(_0x38a8c2,null))['then'](removeEntity(_0x38a8c2,null))[_0xedd9('0x2a')](handleError(_0x38a8c2,null));};exports[_0xedd9('0x58')]=function(_0x4e9109,_0x428ba8){return db[_0xedd9('0x3c')][_0xedd9('0x58')]()[_0xedd9('0x21')](respondWithResult(_0x428ba8,null))[_0xedd9('0x2a')](handleError(_0x428ba8,null));};var interaction_log=require(_0xedd9('0x14'))(_0xedd9('0x59'));exports[_0xedd9('0x5a')]=function(_0x7b3393,_0x3806e9,_0x28311b){var _0x2670c1={'agent':{},'channel':_0xedd9('0x5b')};if(_0x7b3393['body']['id']){delete _0x7b3393[_0xedd9('0x57')]['id'];}_0x7b3393[_0xedd9('0x57')][_0xedd9('0x5c')]=!![];_0x7b3393[_0xedd9('0x57')][_0xedd9('0x5d')]=moment()['format'](_0xedd9('0x5e'));_0x7b3393[_0xedd9('0x57')][_0xedd9('0x5f')]=_0x7b3393[_0xedd9('0x57')][_0xedd9('0x5f')]||_0x7b3393[_0xedd9('0x60')]['id'];_0x2670c1['agent']['id']=_0x7b3393['body'][_0xedd9('0x5f')];return db['OpenchannelMessage']['find']({'where':{'id':_0x7b3393[_0xedd9('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3806e9,null))[_0xedd9('0x21')](saveUpdates(_0x7b3393[_0xedd9('0x57')],null))[_0xedd9('0x21')](function(_0x26badd){if(_0x26badd){_0x2670c1[_0xedd9('0x29')]=_0x26badd[_0xedd9('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0xedd9('0x55')]({'where':{'id':_0x26badd[_0xedd9('0x62')]}});}return null;})[_0xedd9('0x21')](handleEntityNotFound(_0x3806e9,null))[_0xedd9('0x21')](function(_0x1411b6){if(_0x1411b6){return _0x1411b6['update']({'UserId':_0x7b3393[_0xedd9('0x57')][_0xedd9('0x5f')],'read1stAt':_[_0xedd9('0x63')](_0x1411b6[_0xedd9('0x64')])?moment()['format'](_0xedd9('0x5e')):undefined});}return null;})[_0xedd9('0x21')](function(_0x35c567){if(_0x35c567){_0x2670c1[_0xedd9('0x65')]=_0x35c567[_0xedd9('0x61')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7b3393[_0xedd9('0x60')]['id'],_0x7b3393[_0xedd9('0x60')]['name'],_0x7b3393['user'][_0xedd9('0x66')],_0x2670c1[_0xedd9('0x65')]['id'],_0x7b3393['body']?JSON[_0xedd9('0x26')](_0x7b3393[_0xedd9('0x57')]):_0xedd9('0x67'));return respondWithRpcPromise(_0xedd9('0x68'),_0xedd9('0x69'),_0x2670c1);}return null;})[_0xedd9('0x21')](function(_0x5b363e){var _0x1cf866=_0xedd9('0x6a')+_0x5b363e[_0xedd9('0x29')][_0xedd9('0x6b')];return db[_0xedd9('0x6c')]['query'](_0x1cf866,{'type':db[_0xedd9('0x6d')]['QueryTypes'][_0xedd9('0x6e')],'raw':!![]})[_0xedd9('0x21')](function(_0x4c0bef){return _0x4c0bef;});})['then'](function(_0x3c4813){if(_0x3c4813){_0x2670c1[_0xedd9('0x29')][_0xedd9('0x6f')]=_0x3c4813[0x0];if(!_0x7b3393['body']['UserId'])return;return db[_0xedd9('0x70')]['find']({'where':{'id':_0x7b3393[_0xedd9('0x57')][_0xedd9('0x5f')],'role':_0xedd9('0x71')},'attributes':['id',_0xedd9('0x39'),'fullname','email',_0xedd9('0x72')],'raw':!![]});}return null;})[_0xedd9('0x21')](function(_0x2a0088){if(!_0x2a0088)return null;_0x2670c1[_0xedd9('0x29')]['agent']=_0x2a0088;return _0x2670c1;})[_0xedd9('0x21')](function(_0x23391e){if(_0x23391e){if(_0x7b3393[_0xedd9('0x57')]['manual']){_0x2670c1[_0xedd9('0x29')][_0xedd9('0x73')]=util[_0xedd9('0x74')](_0xedd9('0x75'),_0x7b3393['user'][_0xedd9('0x39')]);_0x2670c1[_0xedd9('0x29')][_0xedd9('0x76')]=_0x2670c1[_0xedd9('0x76')];_0x2670c1[_0xedd9('0x29')][_0xedd9('0x77')]=_0x2670c1[_0xedd9('0x76')];_0x2670c1[_0xedd9('0x29')][_0xedd9('0x78')]=_0xedd9('0x5a');return respondWithRpcPromise(_0xedd9('0x79'),_0xedd9('0x79'),{'event':_0xedd9('0x7a'),'message':_0x2670c1['message']},client9002)[_0xedd9('0x21')](function(){return _0x2670c1;});}return _0x2670c1;}return null;})['then'](respondWithResult(_0x3806e9,null))['catch'](handleError(_0x3806e9,null));};var interaction_log=require(_0xedd9('0x14'))(_0xedd9('0x59'));exports[_0xedd9('0x7b')]=function(_0x9c12aa,_0x1418fd,_0x49d6f5){var _0x622f41={'agent':{},'channel':_0xedd9('0x5b')};if(_0x9c12aa[_0xedd9('0x57')]['id']){delete _0x9c12aa['body']['id'];}_0x9c12aa[_0xedd9('0x57')][_0xedd9('0x5f')]=_0x9c12aa[_0xedd9('0x57')][_0xedd9('0x5f')]||_0x9c12aa[_0xedd9('0x60')]['id'];_0x622f41[_0xedd9('0x71')]['id']=_0x9c12aa[_0xedd9('0x57')][_0xedd9('0x5f')];return db['OpenchannelMessage']['find']({'where':{'id':_0x9c12aa[_0xedd9('0x52')]['id'],'UserId':null}})[_0xedd9('0x21')](handleEntityNotFound(_0x1418fd,null))[_0xedd9('0x21')](function(_0x48f40e){if(_0x48f40e){_0x622f41[_0xedd9('0x29')]=_0x48f40e[_0xedd9('0x61')]({'plain':!![]});return db[_0xedd9('0x7c')][_0xedd9('0x55')]({'where':{'id':_0x48f40e[_0xedd9('0x62')]}});}return null;})[_0xedd9('0x21')](handleEntityNotFound(_0x1418fd,null))[_0xedd9('0x21')](function(_0xc7c785){if(_0xc7c785){_0x622f41[_0xedd9('0x65')]=_0xc7c785['get']({'plain':!![]});interaction_log[_0xedd9('0x22')](_0xedd9('0x7d'),_0x9c12aa[_0xedd9('0x60')]['id'],_0x9c12aa[_0xedd9('0x60')][_0xedd9('0x39')],_0x9c12aa[_0xedd9('0x60')][_0xedd9('0x66')],_0x622f41[_0xedd9('0x65')]['id'],_0x9c12aa[_0xedd9('0x57')]?JSON[_0xedd9('0x26')](_0x9c12aa[_0xedd9('0x57')]):_0xedd9('0x67'));return respondWithRpcPromise(_0xedd9('0x7e'),_0xedd9('0x7f'),_0x622f41);}return null;})['then'](function(_0x33345c){var _0x5a075d=_0xedd9('0x6a')+_0x33345c[_0xedd9('0x29')]['ContactId'];return db[_0xedd9('0x6c')][_0xedd9('0x42')](_0x5a075d,{'type':db[_0xedd9('0x6d')]['QueryTypes'][_0xedd9('0x6e')],'raw':!![]})[_0xedd9('0x21')](function(_0x8376a5){return _0x8376a5;});})['then'](function(_0x445a8e){if(_0x445a8e){_0x622f41[_0xedd9('0x29')][_0xedd9('0x6f')]=_0x445a8e[0x0];if(!_0x9c12aa[_0xedd9('0x57')][_0xedd9('0x5f')])return;return db[_0xedd9('0x70')][_0xedd9('0x55')]({'where':{'id':_0x9c12aa[_0xedd9('0x57')][_0xedd9('0x5f')],'role':_0xedd9('0x71')},'attributes':['id','name',_0xedd9('0x80'),_0xedd9('0x81'),_0xedd9('0x72')],'raw':!![]});}return null;})['then'](function(_0x1bbb5c){if(!_0x1bbb5c)return null;_0x622f41['message']['agent']=_0x1bbb5c;return _0x622f41;})[_0xedd9('0x21')](function(_0x2a5f8d){if(_0x2a5f8d){_0x2a5f8d[_0xedd9('0x29')][_0xedd9('0x73')]=util[_0xedd9('0x74')](_0xedd9('0x75'),_0x9c12aa[_0xedd9('0x60')][_0xedd9('0x39')]);_0x2a5f8d['message']['channel']=_0x622f41[_0xedd9('0x76')];_0x2a5f8d[_0xedd9('0x29')][_0xedd9('0x77')]=_0x622f41[_0xedd9('0x76')];_0x2a5f8d['message']['event']=_0xedd9('0x7b');respondWithRpcPromise(_0xedd9('0x79'),'EventManager',{'event':_0xedd9('0x82'),'message':_0x2a5f8d[_0xedd9('0x29')]},client9002);return _0x622f41;}return null;})[_0xedd9('0x21')](respondWithResult(_0x1418fd,null))[_0xedd9('0x2a')](handleError(_0x1418fd,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 296fb41..b0e7e15 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 _0x2037=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x345aa1,_0x2ad5a7){var _0x4b7d2e=function(_0x3d1e53){while(--_0x3d1e53){_0x345aa1['push'](_0x345aa1['shift']());}};_0x4b7d2e(++_0x2ad5a7);}(_0x2037,0x1b8));var _0x7203=function(_0x3b2e0a,_0x49a3f9){_0x3b2e0a=_0x3b2e0a-0x0;var _0x4a84bd=_0x2037[_0x3b2e0a];return _0x4a84bd;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x7203('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7203('0x1'),'afterDestroy':_0x7203('0x2')};function emitEvent(_0xaddcd0){return function(_0x2af9f7,_0x552bf8,_0x2504da){OpenchannelMessageEvents[_0x7203('0x3')](_0xaddcd0+':'+_0x2af9f7['id'],_0x2af9f7);OpenchannelMessageEvents[_0x7203('0x3')](_0xaddcd0,_0x2af9f7);_0x2504da(null);};}for(var e in events){if(events[_0x7203('0x4')](e)){var event=events[e];OpenchannelMessage[_0x7203('0x5')](e,emitEvent(event));}}module[_0x7203('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x183d=['update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x39cd89,_0x55c240){var _0xc3d16d=function(_0x52469b){while(--_0x52469b){_0x39cd89['push'](_0x39cd89['shift']());}};_0xc3d16d(++_0x55c240);}(_0x183d,0x1ed));var _0xd183=function(_0xb29bef,_0x45aff1){_0xb29bef=_0xb29bef-0x0;var _0x878163=_0x183d[_0xb29bef];return _0x878163;};'use strict';var EventEmitter=require(_0xd183('0x0'));var OpenchannelMessage=require(_0xd183('0x1'))['db'][_0xd183('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd183('0x3'),'afterDestroy':_0xd183('0x4')};function emitEvent(_0x5a087a){return function(_0x3bea64,_0x13db65,_0xe535e2){OpenchannelMessageEvents[_0xd183('0x5')](_0x5a087a+':'+_0x3bea64['id'],_0x3bea64);OpenchannelMessageEvents['emit'](_0x5a087a,_0x3bea64);_0xe535e2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xd183('0x6')](e,emitEvent(event));}}module[_0xd183('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 c5a06c3..4464c98 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 _0x6438=['Interactions','length','Interaction','omit','POST','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','OpenchannelInteractionId','Contact','keys','replyUri','info','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x3caec5,_0xde0d9e){var _0x5a66b0=function(_0x38fcfe){while(--_0x38fcfe){_0x3caec5['push'](_0x3caec5['shift']());}};_0x5a66b0(++_0xde0d9e);}(_0x6438,0x1bd));var _0x8643=function(_0x428f42,_0x23848b){_0x428f42=_0x428f42-0x0;var _0x544725=_0x6438[_0x428f42];return _0x544725;};'use strict';var _=require(_0x8643('0x0'));var util=require('util');var logger=require(_0x8643('0x1'))(_0x8643('0x2'));var moment=require(_0x8643('0x3'));var BPromise=require('bluebird');var rp=require(_0x8643('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8643('0x5'));var config=require(_0x8643('0x6'));var attributes=require(_0x8643('0x7'));module[_0x8643('0x8')]=function(_0x45136f,_0x1ea87f){return _0x45136f[_0x8643('0x9')](_0x8643('0xa'),attributes,{'tableName':_0x8643('0xb'),'paranoid':![],'indexes':[{'name':_0x8643('0xc'),'fields':[_0x8643('0xd')],'type':_0x8643('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16f2e9,_0x34cb47,_0x291d49){var _0x18d2dc=_0x45136f[_0x8643('0xf')];var _0x2620d1=_0x16f2e9[_0x8643('0x10')]({'plain':!![]});if(_0x2620d1[_0x8643('0x11')]['toLowerCase']()==='in'||_0x2620d1[_0x8643('0x11')][_0x8643('0x12')]()===_0x8643('0x13')&&!_0x2620d1[_0x8643('0x14')]&&!_[_0x8643('0x15')](_0x2620d1[_0x8643('0x16')])){_0x18d2dc['OpenchannelInteraction'][_0x8643('0x17')]({'where':{'id':_0x2620d1['OpenchannelInteractionId']}})[_0x8643('0x18')](function(_0x1a62fb){if(_0x1a62fb){_0x1a62fb[_0x8643('0x19')]({'lastMsgAt':_0x2620d1[_0x8643('0x1a')],'lastMsgDirection':_0x2620d1['direction'][_0x8643('0x12')]()});}})[_0x8643('0x1b')](function(_0x5eb484){console[_0x8643('0x1c')](_0x5eb484);});}if(_0x2620d1[_0x8643('0x11')]===_0x8643('0x13')&&!_0x2620d1[_0x8643('0x14')]){var _0x5dae8e;_0x18d2dc[_0x8643('0x1d')][_0x8643('0x1e')]()['then'](function(_0x2cdc2f){return _0x18d2dc[_0x8643('0x1f')][_0x8643('0x20')]({'where':{'id':_0x2620d1[_0x8643('0x21')]},'include':[{'model':_0x18d2dc[_0x8643('0x22')],'as':'Interactions','where':{'id':_0x2620d1[_0x8643('0x23')]},'limit':0x1,'include':[{'model':_0x18d2dc[_0x8643('0x1d')],'as':_0x8643('0x24'),'attributes':_[_0x8643('0x25')](_0x2cdc2f)}]}]});})[_0x8643('0x18')](function(_0x41176e){_0x5dae8e=_0x41176e['get']({'plain':!![]});if(_0x5dae8e&&_0x5dae8e[_0x8643('0x26')]){logger[_0x8643('0x27')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x8643('0x28'),_0x2620d1['id'],_0x5dae8e[_0x8643('0x26')]));if(_0x5dae8e['Interactions']&&_0x5dae8e[_0x8643('0x29')][_0x8643('0x2a')]){_0x2620d1[_0x8643('0x2b')]=_[_0x8643('0x2c')](_0x5dae8e[_0x8643('0x29')][0x0],_0x8643('0x24'));_0x2620d1[_0x8643('0x24')]=_0x5dae8e[_0x8643('0x29')][0x0]['Contact'];}var _0x34cb47={'method':_0x8643('0x2d'),'uri':encodeURI(_0x5dae8e[_0x8643('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x34cb47['method']){case'GET':_0x34cb47['qs']=_0x2620d1;break;case _0x8643('0x2d'):_0x34cb47['body']=_0x2620d1;break;}return rp(_0x34cb47)[_0x8643('0x18')](function(_0x2df73f){logger[_0x8643('0x27')](_0x8643('0x2e'),_0x8643('0x2f'),util[_0x8643('0x30')](_0x8643('0x31'),_0x2620d1['id'],_0x5dae8e[_0x8643('0x26')]));if(_0x2df73f[_0x8643('0xd')]['threadId']&&_0x2df73f['body'][_0x8643('0x32')]!=_0x2620d1[_0x8643('0x2b')][_0x8643('0x32')]){return _0x18d2dc[_0x8643('0x22')][_0x8643('0x19')]({'threadId':_0x2df73f['body'][_0x8643('0x32')]},{'where':{'id':_0x2620d1[_0x8643('0x2b')]['id']}});}else{return;}})[_0x8643('0x18')](function(){return _0x16f2e9['update']({'read':!![]});})[_0x8643('0x1b')](function(_0x3da080){logger[_0x8643('0x1c')](_0x8643('0x2e'),_0x8643('0x2f'),util[_0x8643('0x33')](_0x3da080,{'showHidden':![],'depth':null}));_0x291d49();});}else{_0x291d49();}})['finally'](function(){_0x291d49();});}else{_0x291d49();}}},'charset':_0x8643('0x34'),'collate':_0x8643('0x35')});}; \ No newline at end of file +var _0x804b=['Contact','POST','replyUri','GET','then','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','CmContact','OpenchannelAccount','find','OpenchannelAccountId','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit'];(function(_0xc74170,_0x2cbde8){var _0x34c7bb=function(_0x59b8f3){while(--_0x59b8f3){_0xc74170['push'](_0xc74170['shift']());}};_0x34c7bb(++_0x2cbde8);}(_0x804b,0x140));var _0xb804=function(_0x234a12,_0x5e6df3){_0x234a12=_0x234a12-0x0;var _0x359624=_0x804b[_0x234a12];return _0x359624;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb804('0x0'))(_0xb804('0x1'));var moment=require(_0xb804('0x2'));var BPromise=require(_0xb804('0x3'));var rp=require(_0xb804('0x4'));var fs=require('fs');var path=require(_0xb804('0x5'));var rimraf=require(_0xb804('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0xb804('0x7')]=function(_0x27b5ab,_0x3b1bac){return _0x27b5ab['define'](_0xb804('0x8'),attributes,{'tableName':_0xb804('0x9'),'paranoid':![],'indexes':[{'name':_0xb804('0xa'),'fields':[_0xb804('0xb')],'type':_0xb804('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf8ae7f,_0x23c796,_0x4c43ec){var _0x1b71e0=_0x27b5ab['models'];var _0x4b35e8=_0xf8ae7f[_0xb804('0xd')]({'plain':!![]});if(_0x4b35e8[_0xb804('0xe')][_0xb804('0xf')]()==='in'||_0x4b35e8['direction']['toLowerCase']()===_0xb804('0x10')&&!_0x4b35e8[_0xb804('0x11')]&&!_[_0xb804('0x12')](_0x4b35e8[_0xb804('0x13')])){_0x1b71e0[_0xb804('0x14')][_0xb804('0x15')]({'where':{'id':_0x4b35e8[_0xb804('0x16')]}})['then'](function(_0x57bc8b){if(_0x57bc8b){_0x57bc8b['update']({'lastMsgAt':_0x4b35e8[_0xb804('0x17')],'lastMsgDirection':_0x4b35e8[_0xb804('0xe')][_0xb804('0xf')]()});}})['catch'](function(_0xa357f0){console['error'](_0xa357f0);});}if(_0x4b35e8[_0xb804('0xe')]===_0xb804('0x10')&&!_0x4b35e8[_0xb804('0x11')]){var _0x107e7f;_0x1b71e0[_0xb804('0x18')]['describe']()['then'](function(_0x1d8e7b){return _0x1b71e0[_0xb804('0x19')][_0xb804('0x1a')]({'where':{'id':_0x4b35e8[_0xb804('0x1b')]},'include':[{'model':_0x1b71e0[_0xb804('0x14')],'as':'Interactions','where':{'id':_0x4b35e8[_0xb804('0x16')]},'limit':0x1,'include':[{'model':_0x1b71e0['CmContact'],'as':'Contact','attributes':_[_0xb804('0x1c')](_0x1d8e7b)}]}]});})['then'](function(_0x40dca9){_0x107e7f=_0x40dca9[_0xb804('0xd')]({'plain':!![]});if(_0x107e7f&&_0x107e7f['replyUri']){logger[_0xb804('0x1d')](_0xb804('0x1e'),'afterCreate',util[_0xb804('0x1f')](_0xb804('0x20'),_0x4b35e8['id'],_0x107e7f['replyUri']));if(_0x107e7f[_0xb804('0x21')]&&_0x107e7f['Interactions'][_0xb804('0x22')]){_0x4b35e8[_0xb804('0x23')]=_[_0xb804('0x24')](_0x107e7f[_0xb804('0x21')][0x0],_0xb804('0x25'));_0x4b35e8[_0xb804('0x25')]=_0x107e7f[_0xb804('0x21')][0x0][_0xb804('0x25')];}var _0x23c796={'method':_0xb804('0x26'),'uri':encodeURI(_0x107e7f[_0xb804('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x23c796['method']){case _0xb804('0x28'):_0x23c796['qs']=_0x4b35e8;break;case _0xb804('0x26'):_0x23c796[_0xb804('0xb')]=_0x4b35e8;break;}return rp(_0x23c796)[_0xb804('0x29')](function(_0x19cc16){logger['info'](_0xb804('0x1e'),_0xb804('0x2a'),util['format'](_0xb804('0x2b'),_0x4b35e8['id'],_0x107e7f[_0xb804('0x27')]));if(_0x19cc16[_0xb804('0xb')][_0xb804('0x2c')]&&_0x19cc16[_0xb804('0xb')][_0xb804('0x2c')]!=_0x4b35e8[_0xb804('0x23')][_0xb804('0x2c')]){return _0x1b71e0[_0xb804('0x14')][_0xb804('0x2d')]({'threadId':_0x19cc16['body']['threadId']},{'where':{'id':_0x4b35e8['Interaction']['id']}});}else{return;}})['then'](function(){return _0xf8ae7f[_0xb804('0x2d')]({'read':!![]});})['catch'](function(_0x4a2e80){logger[_0xb804('0x2e')](_0xb804('0x1e'),'afterCreate',util[_0xb804('0x2f')](_0x4a2e80,{'showHidden':![],'depth':null}));_0x4c43ec();});}else{_0x4c43ec();}})[_0xb804('0x30')](function(){_0x4c43ec();});}else{_0x4c43ec();}}},'charset':_0xb804('0x31'),'collate':_0xb804('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 3544fc8..134e8db 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(_0x164e83,_0x3dbe86){var _0x44e063=function(_0x48f285){while(--_0x48f285){_0x164e83['push'](_0x164e83['shift']());}};_0x44e063(++_0x3dbe86);}(_0x5f2f,0x73));var _0xf5f2=function(_0x31f7e3,_0x236b6e){_0x31f7e3=_0x31f7e3-0x0;var _0x1414e9=_0x5f2f[_0x31f7e3];return _0x1414e9;};'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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x46e64f,_0x46d4ec){var _0xc7c58e=function(_0x93a452){while(--_0x93a452){_0x46e64f['push'](_0x46e64f['shift']());}};_0xc7c58e(++_0x46d4ec);}(_0xadb5,0xad));var _0x5adb=function(_0x1f4f37,_0x3c810d){_0x1f4f37=_0x1f4f37-0x0;var _0xa21194=_0xadb5[_0x1f4f37];return _0xa21194;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 080cacc..ddc0a45 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 _0xabd7=['remove','update','length','save'];(function(_0x3e82ae,_0x45a07d){var _0x1d414e=function(_0x59a4e7){while(--_0x59a4e7){_0x3e82ae['push'](_0x3e82ae['shift']());}};_0x1d414e(++_0x45a07d);}(_0xabd7,0x6b));var _0x7abd=function(_0x21fc3a,_0x1d8652){_0x21fc3a=_0x21fc3a-0x0;var _0x3ebc42=_0xabd7[_0x21fc3a];return _0x3ebc42;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x7abd('0x0'),_0x7abd('0x1'),_0x7abd('0x2')];function createListener(_0x401971,_0x26be2a){return function(_0x27948a){_0x26be2a['emit'](_0x401971,_0x27948a);};}function removeListener(_0x168458,_0x354914){return function(){OpenchannelMessageEvents['removeListener'](_0x168458,_0x354914);};}exports['register']=function(_0xc7994e){for(var _0x5a929f=0x0,_0x2e59c4=events[_0x7abd('0x3')];_0x5a929f<_0x2e59c4;_0x5a929f++){var _0x2e4951=events[_0x5a929f];var _0x25599c=createListener('openchannelMessage:'+_0x2e4951,_0xc7994e);OpenchannelMessageEvents['on'](_0x2e4951,_0x25599c);}}; \ No newline at end of file +var _0x5502=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x29ef0d,_0x1c1ff7){var _0x1f928d=function(_0x266f4f){while(--_0x266f4f){_0x29ef0d['push'](_0x29ef0d['shift']());}};_0x1f928d(++_0x1c1ff7);}(_0x5502,0x69));var _0x2550=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x5502[_0x3e112d];return _0x531c31;};'use strict';var OpenchannelMessageEvents=require(_0x2550('0x0'));var events=[_0x2550('0x1'),_0x2550('0x2'),_0x2550('0x3')];function createListener(_0x27c601,_0x426d22){return function(_0x185ad3){_0x426d22[_0x2550('0x4')](_0x27c601,_0x185ad3);};}function removeListener(_0x18739d,_0x30a166){return function(){OpenchannelMessageEvents[_0x2550('0x5')](_0x18739d,_0x30a166);};}exports[_0x2550('0x6')]=function(_0x5f76a9){for(var _0x507b52=0x0,_0x1fdfc5=events['length'];_0x507b52<_0x1fdfc5;_0x507b52++){var _0x51a38d=events[_0x507b52];var _0x410692=createListener(_0x2550('0x7')+_0x51a38d,_0x5f76a9);OpenchannelMessageEvents['on'](_0x51a38d,_0x410692);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index b8856e7..e610030 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 _0x63b4=['/:id/users','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','create','post','addTeams'];(function(_0x32e3e1,_0x5ba02a){var _0x34828c=function(_0x4463b8){while(--_0x4463b8){_0x32e3e1['push'](_0x32e3e1['shift']());}};_0x34828c(++_0x5ba02a);}(_0x63b4,0x1bc));var _0x463b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x63b4[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x463b('0x0'));var path=require('path');var timeout=require(_0x463b('0x1'));var express=require(_0x463b('0x2'));var router=express[_0x463b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x463b('0x4'));var interaction=require(_0x463b('0x5'));var config=require('../../config/environment');var controller=require(_0x463b('0x6'));router[_0x463b('0x7')]('/',auth[_0x463b('0x8')](),controller[_0x463b('0x9')]);router[_0x463b('0x7')](_0x463b('0xa'),auth['isAuthenticated'](),controller[_0x463b('0xb')]);router[_0x463b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x463b('0xc')]);router[_0x463b('0x7')](_0x463b('0xd'),auth[_0x463b('0x8')](),controller[_0x463b('0xe')]);router[_0x463b('0x7')](_0x463b('0xf'),auth[_0x463b('0x8')](),controller[_0x463b('0x10')]);router[_0x463b('0x7')]('/:id/users',auth[_0x463b('0x8')](),controller['getAgents']);router['post']('/',auth[_0x463b('0x8')](),controller[_0x463b('0x11')]);router[_0x463b('0x12')]('/:id/teams',auth[_0x463b('0x8')](),controller[_0x463b('0x13')]);router[_0x463b('0x12')](_0x463b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0x463b('0x15')]('/:id',auth[_0x463b('0x8')](),controller[_0x463b('0x16')]);router[_0x463b('0x17')](_0x463b('0x18'),auth[_0x463b('0x8')](),controller[_0x463b('0x19')]);router[_0x463b('0x17')](_0x463b('0xf'),auth[_0x463b('0x8')](),controller[_0x463b('0x1a')]);router[_0x463b('0x17')]('/:id/users',auth[_0x463b('0x8')](),controller[_0x463b('0x1b')]);module[_0x463b('0x1c')]=router; \ No newline at end of file +var _0x9311=['getTeams','/:id/users','getAgents','post','create','addTeams','/:id','update','destroy','delete','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams'];(function(_0xaef393,_0x3bb479){var _0x180e7e=function(_0x50ab2b){while(--_0x50ab2b){_0xaef393['push'](_0xaef393['shift']());}};_0x180e7e(++_0x3bb479);}(_0x9311,0x141));var _0x1931=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9311[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1931('0x0'));var timeout=require(_0x1931('0x1'));var express=require(_0x1931('0x2'));var router=express[_0x1931('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1931('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1931('0x5'));var controller=require(_0x1931('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1931('0x7')](_0x1931('0x8'),auth[_0x1931('0x9')](),controller[_0x1931('0xa')]);router['get']('/:id',auth[_0x1931('0x9')](),controller[_0x1931('0xb')]);router['get'](_0x1931('0xc'),auth[_0x1931('0x9')](),controller[_0x1931('0xd')]);router[_0x1931('0x7')](_0x1931('0xe'),auth[_0x1931('0x9')](),controller[_0x1931('0xf')]);router[_0x1931('0x7')](_0x1931('0x10'),auth[_0x1931('0x9')](),controller[_0x1931('0x11')]);router[_0x1931('0x12')]('/',auth['isAuthenticated'](),controller[_0x1931('0x13')]);router[_0x1931('0x12')](_0x1931('0xe'),auth['isAuthenticated'](),controller[_0x1931('0x14')]);router['post'](_0x1931('0x10'),auth[_0x1931('0x9')](),controller['addAgents']);router['put'](_0x1931('0x15'),auth[_0x1931('0x9')](),controller[_0x1931('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1931('0x17')]);router[_0x1931('0x18')](_0x1931('0xe'),auth[_0x1931('0x9')](),controller[_0x1931('0x19')]);router[_0x1931('0x18')](_0x1931('0x10'),auth[_0x1931('0x9')](),controller[_0x1931('0x1a')]);module[_0x1931('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 3803811..c4cd150 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 _0x326b=['beepall','roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0x326b,0xca));var _0xb326=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x326b[_0x3eff21];return _0x1945bb;};'use strict';var Sequelize=require(_0xb326('0x0'));module[_0xb326('0x1')]={'name':{'type':Sequelize[_0xb326('0x2')],'unique':_0xb326('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb326('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb326('0x4')](_0xb326('0x5'),_0xb326('0x6'),_0xb326('0x7'))}}; \ No newline at end of file +var _0x77f6=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x426ccf,_0x4fbf52){var _0x243f84=function(_0x4e2e15){while(--_0x4e2e15){_0x426ccf['push'](_0x426ccf['shift']());}};_0x243f84(++_0x4fbf52);}(_0x77f6,0xcd));var _0x677f=function(_0x531d8a,_0x14a0f0){_0x531d8a=_0x531d8a-0x0;var _0x32fabf=_0x77f6[_0x531d8a];return _0x32fabf;};'use strict';var Sequelize=require('sequelize');module[_0x677f('0x0')]={'name':{'type':Sequelize[_0x677f('0x1')],'unique':_0x677f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x677f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x677f('0x4')](_0x677f('0x5'),_0x677f('0x6'),_0x677f('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 808bc4f..664132a 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 _0xab50=['key','where','OpenchannelQueue','include','query','findAll','catch','params','model','keys','filters','intersection','attributes','fields','length','options','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','sort','pick','OpenchannelQueueId','filter','merge','map','UserOpenchannelQueue','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','updatedAt','getTeams','Team','ids','User','Agents','online','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','includes','all','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','nolimit','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','end','json','offset','undefined','limit','count','status','Content-Range','update','destroy','then','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x3e5d7f,_0x5c4ed2){var _0x31d0dd=function(_0x49cdad){while(--_0x49cdad){_0x3e5d7f['push'](_0x3e5d7f['shift']());}};_0x31d0dd(++_0x5c4ed2);}(_0xab50,0x1a2));var _0x0ab5=function(_0x2ee947,_0x2531b0){_0x2ee947=_0x2ee947-0x0;var _0x21bd33=_0xab50[_0x2ee947];return _0x21bd33;};'use strict';var BPromise=require(_0x0ab5('0x0'));var util=require(_0x0ab5('0x1'));var _=require(_0x0ab5('0x2'));var squel=require('squel');var Redis=require(_0x0ab5('0x3'));var qs=require(_0x0ab5('0x4'));var logger=require(_0x0ab5('0x5'))(_0x0ab5('0x6'));var config=require(_0x0ab5('0x7'));var db=require(_0x0ab5('0x8'))['db'];config[_0x0ab5('0x9')]=_['defaults'](config['redis'],{'host':_0x0ab5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x0ab5('0xb')](socket);function respondWithStatusCode(_0x4a1979,_0x2d5da7){_0x2d5da7=_0x2d5da7||0xcc;return function(_0x2a0de6){if(_0x2a0de6){return _0x4a1979['sendStatus'](_0x2d5da7);}return _0x4a1979['status'](_0x2d5da7)[_0x0ab5('0xc')]();};}function respondWithResult(_0x449ece,_0x4c84ba){_0x4c84ba=_0x4c84ba||0xc8;return function(_0x2407dc){if(_0x2407dc){return _0x449ece['status'](_0x4c84ba)[_0x0ab5('0xd')](_0x2407dc);}};}function respondWithFilteredResult(_0x29f640,_0x33e887){return function(_0x40c7cf){if(_0x40c7cf){var _0x477742=typeof _0x33e887[_0x0ab5('0xe')]===_0x0ab5('0xf')&&typeof _0x33e887[_0x0ab5('0x10')]===_0x0ab5('0xf');var _0x480ec1=_0x40c7cf[_0x0ab5('0x11')];var _0x44ca50=_0x477742?0x0:_0x33e887[_0x0ab5('0xe')];var _0x5ac704=_0x477742?_0x40c7cf[_0x0ab5('0x11')]:_0x33e887[_0x0ab5('0xe')]+_0x33e887[_0x0ab5('0x10')];var _0x6ba612;if(_0x5ac704>=_0x480ec1){_0x5ac704=_0x480ec1;_0x6ba612=0xc8;}else{_0x6ba612=0xce;}_0x29f640[_0x0ab5('0x12')](_0x6ba612);return _0x29f640['set'](_0x0ab5('0x13'),_0x44ca50+'-'+_0x5ac704+'/'+_0x480ec1)[_0x0ab5('0xd')](_0x40c7cf);}return null;};}function saveUpdates(_0x2f4a33){return function(_0x5b983c){if(_0x5b983c){return _0x5b983c[_0x0ab5('0x14')](_0x2f4a33)['then'](function(_0x4bdf14){return _0x4bdf14;});}return null;};}function removeEntity(_0x2c312d){return function(_0x13563b){if(_0x13563b){return _0x13563b[_0x0ab5('0x15')]()[_0x0ab5('0x16')](function(){var _0x5d6ef3=_0x13563b[_0x0ab5('0x17')]({'plain':!![]});var _0x1561de=_0x0ab5('0x18');return db[_0x0ab5('0x19')]['destroy']({'where':{'type':_0x1561de,'resourceId':_0x5d6ef3['id']}})[_0x0ab5('0x16')](function(){return _0x13563b;});})[_0x0ab5('0x16')](function(){_0x2c312d['status'](0xcc)[_0x0ab5('0xc')]();});}};}function handleEntityNotFound(_0x405a30){return function(_0x23f4aa){if(!_0x23f4aa){_0x405a30[_0x0ab5('0x1a')](0x194);}return _0x23f4aa;};}function handleError(_0x2d5e36,_0x4fb52b){_0x4fb52b=_0x4fb52b||0x1f4;return function(_0x43ca3d){logger[_0x0ab5('0x1b')](_0x43ca3d[_0x0ab5('0x1c')]);if(_0x43ca3d['name']){delete _0x43ca3d[_0x0ab5('0x1d')];}_0x2d5e36[_0x0ab5('0x12')](_0x4fb52b)[_0x0ab5('0x1e')](_0x43ca3d);};}exports[_0x0ab5('0x1f')]=function(_0x1b8061,_0x2bb179){var _0x13a80a={};var _0x13a8e0={'count':0x0,'rows':[]};var _0x4f7bb7=_['map'](db['OpenchannelQueue'][_0x0ab5('0x20')],function(_0x2e44bc){return{'name':_0x2e44bc[_0x0ab5('0x21')],'type':_0x2e44bc['type'][_0x0ab5('0x22')]};});_0x13a80a=qs['getOptions'](_0x4f7bb7,_0x1b8061);var _0x20b2a0={'where':_0x13a80a[_0x0ab5('0x23')]};return db[_0x0ab5('0x24')][_0x0ab5('0x11')](_0x20b2a0)[_0x0ab5('0x16')](function(_0x174121){_0x13a8e0[_0x0ab5('0x11')]=_0x174121;_0x13a80a['include']=qs[_0x0ab5('0x25')](_0x1b8061[_0x0ab5('0x26')]);return db[_0x0ab5('0x24')][_0x0ab5('0x27')](_0x13a80a);})[_0x0ab5('0x16')](function(_0x7bdd7c){_0x13a8e0['rows']=_0x7bdd7c;return _0x13a8e0;})[_0x0ab5('0x16')](respondWithFilteredResult(_0x2bb179,_0x13a80a))[_0x0ab5('0x28')](handleError(_0x2bb179,null));};exports['show']=function(_0x471338,_0x523230){var _0x434aea={'raw':!![],'where':{'id':_0x471338[_0x0ab5('0x29')]['id']}},_0x2ffa91={};_0x2ffa91[_0x0ab5('0x2a')]=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x2ffa91[_0x0ab5('0x26')]=_[_0x0ab5('0x2b')](_0x471338[_0x0ab5('0x26')]);_0x2ffa91[_0x0ab5('0x2c')]=_[_0x0ab5('0x2d')](_0x2ffa91[_0x0ab5('0x2a')],_0x2ffa91[_0x0ab5('0x26')]);_0x434aea[_0x0ab5('0x2e')]=_[_0x0ab5('0x2d')](_0x2ffa91['model'],qs[_0x0ab5('0x2f')](_0x471338[_0x0ab5('0x26')]['fields']));_0x434aea['attributes']=_0x434aea[_0x0ab5('0x2e')][_0x0ab5('0x30')]?_0x434aea[_0x0ab5('0x2e')]:_0x2ffa91['model'];if(_0x471338[_0x0ab5('0x26')]['includeAll']){_0x434aea[_0x0ab5('0x25')]=[{'all':!![]}];}_0x434aea=_['merge']({},_0x434aea,_0x471338[_0x0ab5('0x31')]);return db[_0x0ab5('0x24')][_0x0ab5('0x32')](_0x434aea)[_0x0ab5('0x16')](handleEntityNotFound(_0x523230,null))[_0x0ab5('0x16')](respondWithResult(_0x523230,null))[_0x0ab5('0x28')](handleError(_0x523230,null));};exports[_0x0ab5('0x33')]=function(_0x4b30cc,_0x13ec97){return db[_0x0ab5('0x24')]['create'](_0x4b30cc[_0x0ab5('0x34')],{})[_0x0ab5('0x16')](function(_0x1fc49e){var _0x1b7b9e=_0x4b30cc[_0x0ab5('0x35')][_0x0ab5('0x17')]({'plain':!![]});if(!_0x1b7b9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b7b9e[_0x0ab5('0x36')]==='user'){var _0x353591=_0x1fc49e[_0x0ab5('0x17')]({'plain':!![]});var _0x58be39='OpenchannelQueues';return db[_0x0ab5('0x37')][_0x0ab5('0x32')]({'where':{'name':_0x58be39,'userProfileId':_0x1b7b9e['userProfileId']},'raw':!![]})['then'](function(_0x2e20e9){if(_0x2e20e9&&_0x2e20e9['autoAssociation']===0x0){return db[_0x0ab5('0x19')][_0x0ab5('0x33')]({'name':_0x353591[_0x0ab5('0x1d')],'resourceId':_0x353591['id'],'type':_0x2e20e9[_0x0ab5('0x1d')],'sectionId':_0x2e20e9['id']},{})[_0x0ab5('0x16')](function(){return _0x1fc49e;});}else{return _0x1fc49e;}})[_0x0ab5('0x28')](function(_0x90bba0){logger['error'](_0x0ab5('0x38'),_0x90bba0);throw _0x90bba0;});}return _0x1fc49e;})['then'](respondWithResult(_0x13ec97,0xc9))[_0x0ab5('0x28')](handleError(_0x13ec97,null));};exports['update']=function(_0x2365d9,_0xf82305){if(_0x2365d9[_0x0ab5('0x34')]['id']){delete _0x2365d9[_0x0ab5('0x34')]['id'];}return db[_0x0ab5('0x24')][_0x0ab5('0x32')]({'where':{'id':_0x2365d9['params']['id']}})[_0x0ab5('0x16')](handleEntityNotFound(_0xf82305,null))[_0x0ab5('0x16')](saveUpdates(_0x2365d9[_0x0ab5('0x34')],null))['then'](respondWithResult(_0xf82305,null))[_0x0ab5('0x28')](handleError(_0xf82305,null));};exports[_0x0ab5('0x15')]=function(_0x1dd7a4,_0x12df9f){return db[_0x0ab5('0x24')][_0x0ab5('0x32')]({'where':{'id':_0x1dd7a4[_0x0ab5('0x29')]['id']}})['then'](handleEntityNotFound(_0x12df9f,null))[_0x0ab5('0x16')](removeEntity(_0x12df9f,null))['catch'](handleError(_0x12df9f,null));};exports['describe']=function(_0x2506d0,_0x30c619){return db['OpenchannelQueue'][_0x0ab5('0x39')]()[_0x0ab5('0x16')](respondWithResult(_0x30c619,null))[_0x0ab5('0x28')](handleError(_0x30c619,null));};exports[_0x0ab5('0x3a')]=function(_0x304d6b,_0x529fd0){var _0x167653={'raw':!![],'where':{}},_0x11e39a={},_0x2016b6;return db[_0x0ab5('0x24')][_0x0ab5('0x3b')]({'where':{'id':_0x304d6b[_0x0ab5('0x29')]['id']}})[_0x0ab5('0x16')](handleEntityNotFound(_0x529fd0,null))[_0x0ab5('0x16')](function(_0x2c3a67){if(_0x2c3a67){_0x2016b6=_0x2c3a67[_0x0ab5('0x17')]({'plain':!![]});_0x11e39a[_0x0ab5('0x2a')]=_[_0x0ab5('0x2b')](db['UserOpenchannelQueue']['rawAttributes']);_0x11e39a[_0x0ab5('0x26')]=_[_0x0ab5('0x2b')](_0x304d6b[_0x0ab5('0x26')]);_0x11e39a[_0x0ab5('0x2c')]=_[_0x0ab5('0x2d')](_0x11e39a['model'],_0x11e39a[_0x0ab5('0x26')]);_0x167653[_0x0ab5('0x2e')]=_['intersection'](_0x11e39a[_0x0ab5('0x2a')],qs[_0x0ab5('0x2f')](_0x304d6b[_0x0ab5('0x26')][_0x0ab5('0x2f')]));_0x167653[_0x0ab5('0x2e')]=_0x167653[_0x0ab5('0x2e')][_0x0ab5('0x30')]?_0x167653['attributes']:_0x11e39a[_0x0ab5('0x2a')];if(!_0x304d6b[_0x0ab5('0x26')][_0x0ab5('0x3c')]('nolimit')){_0x167653[_0x0ab5('0x10')]=qs['limit'](_0x304d6b[_0x0ab5('0x26')][_0x0ab5('0x10')]);_0x167653['offset']=qs[_0x0ab5('0xe')](_0x304d6b[_0x0ab5('0x26')]['offset']);}_0x167653[_0x0ab5('0x3d')]=qs[_0x0ab5('0x3e')](_0x304d6b[_0x0ab5('0x26')][_0x0ab5('0x3e')]);_0x167653[_0x0ab5('0x23')]=qs[_0x0ab5('0x2c')](_[_0x0ab5('0x3f')](_0x304d6b[_0x0ab5('0x26')],_0x11e39a[_0x0ab5('0x2c')]));_0x167653['where'][_0x0ab5('0x40')]=_0x2c3a67['id'];if(_0x304d6b['query'][_0x0ab5('0x41')]){_0x167653['where']=_[_0x0ab5('0x42')](_0x167653[_0x0ab5('0x23')],{'$or':_[_0x0ab5('0x43')](_0x167653[_0x0ab5('0x2e')],function(_0x4feb11){var _0x473beb={};_0x473beb[_0x4feb11]={'$like':'%'+_0x304d6b['query'][_0x0ab5('0x41')]+'%'};return _0x473beb;})});}_0x167653=_[_0x0ab5('0x42')]({},_0x167653,_0x304d6b[_0x0ab5('0x31')]);return db[_0x0ab5('0x44')][_0x0ab5('0x27')](_0x167653);}})[_0x0ab5('0x16')](function(_0x5511d7){if(_0x5511d7){return db['User'][_0x0ab5('0x45')]({'where':{'id':_[_0x0ab5('0x43')](_0x5511d7,_0x0ab5('0x46')),'role':_0x0ab5('0x47')},'attributes':['id',_0x0ab5('0x1d'),_0x0ab5('0x48'),'updatedAt',_0x0ab5('0x49')]});}})[_0x0ab5('0x16')](function(_0x206a99){if(_0x206a99){return{'count':_0x206a99[_0x0ab5('0x11')],'rows':_[_0x0ab5('0x43')](_0x206a99['rows'],function(_0x5af762){return{'membername':_0x5af762[_0x0ab5('0x1d')],'UserId':_0x5af762['id'],'queue_name':_0x2016b6['name'],'OpenchannelQueueId':_0x2016b6['id'],'interface':util[_0x0ab5('0x4a')](_0x0ab5('0x4b'),'SIP',_0x5af762['name']),'penalty':0x0,'paused':_0x5af762[_0x0ab5('0x48')],'createdAt':_0x5af762[_0x0ab5('0x49')],'updatedAt':_0x5af762[_0x0ab5('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x529fd0,_0x167653))[_0x0ab5('0x28')](handleError(_0x529fd0,null));};exports[_0x0ab5('0x4d')]=function(_0x531dca,_0x2e9b6a){var _0x49d4d1={};var _0x1af8a6={};var _0x4ec697;var _0x35f1e6;return db[_0x0ab5('0x24')][_0x0ab5('0x3b')]({'where':{'id':_0x531dca[_0x0ab5('0x29')]['id']}})[_0x0ab5('0x16')](handleEntityNotFound(_0x2e9b6a,null))[_0x0ab5('0x16')](function(_0x7b8ddf){if(_0x7b8ddf){_0x4ec697=_0x7b8ddf;_0x1af8a6[_0x0ab5('0x2a')]=_['keys'](db[_0x0ab5('0x4e')][_0x0ab5('0x20')]);_0x1af8a6[_0x0ab5('0x26')]=_['keys'](_0x531dca[_0x0ab5('0x26')]);_0x1af8a6[_0x0ab5('0x2c')]=_['intersection'](_0x1af8a6[_0x0ab5('0x2a')],_0x1af8a6['query']);_0x49d4d1[_0x0ab5('0x2e')]=_[_0x0ab5('0x2d')](_0x1af8a6[_0x0ab5('0x2a')],qs['fields'](_0x531dca['query'][_0x0ab5('0x2f')]));_0x49d4d1['attributes']=_0x49d4d1[_0x0ab5('0x2e')]['length']?_0x49d4d1[_0x0ab5('0x2e')]:_0x1af8a6[_0x0ab5('0x2a')];_0x49d4d1[_0x0ab5('0x3d')]=qs[_0x0ab5('0x3e')](_0x531dca[_0x0ab5('0x26')][_0x0ab5('0x3e')]);_0x49d4d1[_0x0ab5('0x23')]=qs[_0x0ab5('0x2c')](_[_0x0ab5('0x3f')](_0x531dca[_0x0ab5('0x26')],_0x1af8a6[_0x0ab5('0x2c')]));if(_0x531dca[_0x0ab5('0x26')]['filter']){_0x49d4d1[_0x0ab5('0x23')]=_['merge'](_0x49d4d1[_0x0ab5('0x23')],{'$or':_[_0x0ab5('0x43')](_0x49d4d1[_0x0ab5('0x2e')],function(_0x3dbe0b){var _0x53abb6={};_0x53abb6[_0x3dbe0b]={'$like':'%'+_0x531dca['query'][_0x0ab5('0x41')]+'%'};return _0x53abb6;})});}_0x49d4d1=_[_0x0ab5('0x42')]({},_0x49d4d1,_0x531dca[_0x0ab5('0x31')]);return _0x4ec697[_0x0ab5('0x4d')](_0x49d4d1);}})[_0x0ab5('0x16')](function(_0x2af260){if(_0x2af260){_0x35f1e6=_0x2af260[_0x0ab5('0x30')];if(!_0x531dca['query'][_0x0ab5('0x3c')]('nolimit')){_0x49d4d1[_0x0ab5('0x10')]=qs[_0x0ab5('0x10')](_0x531dca[_0x0ab5('0x26')][_0x0ab5('0x10')]);_0x49d4d1[_0x0ab5('0xe')]=qs[_0x0ab5('0xe')](_0x531dca[_0x0ab5('0x26')][_0x0ab5('0xe')]);}return _0x4ec697[_0x0ab5('0x4d')](_0x49d4d1);}})[_0x0ab5('0x16')](function(_0xac1f5b){if(_0xac1f5b){return _0xac1f5b?{'count':_0x35f1e6,'rows':_0xac1f5b}:null;}})['then'](respondWithResult(_0x2e9b6a,null))[_0x0ab5('0x28')](handleError(_0x2e9b6a,null));};exports['addTeams']=function(_0x1188cd,_0x238d30){var _0x298941=_0x1188cd[_0x0ab5('0x34')][_0x0ab5('0x4f')];return db[_0x0ab5('0x4e')][_0x0ab5('0x27')]({'where':{'id':_0x298941},'attributes':['id'],'include':[{'model':db[_0x0ab5('0x50')],'as':_0x0ab5('0x51'),'attributes':['id',_0x0ab5('0x1d'),_0x0ab5('0x52'),'voicePause','interface'],'raw':!![]}]})[_0x0ab5('0x16')](function(_0x4a097f){if(_0x4a097f){var _0x10109b=_[_0x0ab5('0x53')](_0x4a097f,function(_0x38f0f7){var _0x4ea59e=_0x38f0f7['get']({'plain':!![]});return _0x4ea59e[_0x0ab5('0x51')];});return db[_0x0ab5('0x24')][_0x0ab5('0x32')]({'where':{'id':_0x1188cd[_0x0ab5('0x29')]['id']}})[_0x0ab5('0x16')](function(_0xa69f27){return db['sequelize'][_0x0ab5('0x54')](function(_0x77ff40){return _0xa69f27[_0x0ab5('0x55')](_0x298941,{'transaction':_0x77ff40})[_0x0ab5('0x16')](function(){return BPromise[_0x0ab5('0x56')](_0x10109b,function(_0x12155c){return db['UserOpenchannelQueue'][_0x0ab5('0x57')]({'where':{'UserId':_0x12155c['id'],'OpenchannelQueueId':_0x1188cd[_0x0ab5('0x29')]['id']},'transaction':_0x77ff40});});})[_0x0ab5('0x16')](function(){_0x10109b[_0x0ab5('0x58')](function(_0x4f5282){socket[_0x0ab5('0x59')](_0x0ab5('0x5a'),{'UserId':_0x4f5282['id'],'OpenchannelQueueId':_0xa69f27['id']});});});});});}})[_0x0ab5('0x16')](respondWithStatusCode(_0x238d30,null))[_0x0ab5('0x28')](handleError(_0x238d30,null));};exports[_0x0ab5('0x5b')]=function(_0x44eb3f,_0x3bb9b5){return db[_0x0ab5('0x4e')][_0x0ab5('0x27')]({'where':{'id':_0x44eb3f[_0x0ab5('0x26')][_0x0ab5('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x0ab5('0x50')],'as':_0x0ab5('0x51'),'attributes':['id'],'raw':!![]}]})[_0x0ab5('0x16')](handleEntityNotFound(_0x3bb9b5,null))[_0x0ab5('0x16')](function(_0x39c19c){var _0x31970a=_['map'](_0x39c19c,'id');var _0x150a64=[];var _0x450b0f=[];var _0x1f9f36=squel[_0x0ab5('0x5c')]();_0x1f9f36[_0x0ab5('0x5d')](_0x0ab5('0x5e'))['from'](_0x0ab5('0x5f'),'tq')[_0x0ab5('0x60')](_0x0ab5('0x61'),'ut',_0x0ab5('0x62'))['where']('OpenchannelQueueId\x20=\x20?',_0x44eb3f[_0x0ab5('0x29')]['id']);for(var _0x2bf046=0x0;_0x2bf046<_0x39c19c['length'];_0x2bf046+=0x1){let _0x38b5d2=_0x39c19c[_0x2bf046];for(var _0x307222=0x0;_0x307222<_0x38b5d2[_0x0ab5('0x51')][_0x0ab5('0x30')];_0x307222+=0x1){let _0x1c5e3e=_0x38b5d2[_0x0ab5('0x51')][_0x307222];var _0x20557b=_0x1f9f36['clone']();_0x20557b['where'](_0x0ab5('0x63'),_0x1c5e3e['id']);_0x450b0f['push'](db[_0x0ab5('0x64')][_0x0ab5('0x26')](_0x20557b['toString'](),{'type':db[_0x0ab5('0x64')][_0x0ab5('0x65')][_0x0ab5('0x66')]})[_0x0ab5('0x16')](function(_0x5e6bb4){if(_0x5e6bb4['length']===0x1){return _0x1c5e3e['id'];}else{var _0x2e5751=_[_0x0ab5('0x67')](_[_0x0ab5('0x43')](_0x5e6bb4,'TeamId'),function(_0x21d107){return _[_0x0ab5('0x68')](_0x31970a,_0x21d107);});if(_0x2e5751){return _0x1c5e3e['id'];}}}));}}return BPromise[_0x0ab5('0x69')](_0x450b0f)[_0x0ab5('0x16')](function(_0x128c66){_0x150a64=_(_0x150a64)['union'](_0x128c66)['compact']()['value']();return db[_0x0ab5('0x24')][_0x0ab5('0x32')]({'where':{'id':_0x44eb3f[_0x0ab5('0x29')]['id']}})[_0x0ab5('0x16')](function(_0x412bba){return db[_0x0ab5('0x64')][_0x0ab5('0x54')](function(_0x2b9b00){return _0x412bba[_0x0ab5('0x5b')](_0x44eb3f['query'][_0x0ab5('0x4f')],{'transaction':_0x2b9b00})['then'](function(){if(!_['isEmpty'](_0x150a64)){return _0x412bba[_0x0ab5('0x6a')](_0x150a64,{'transaction':_0x2b9b00});}})[_0x0ab5('0x16')](function(){_0x150a64['forEach'](function(_0x112a63){socket[_0x0ab5('0x59')](_0x0ab5('0x6b'),{'UserId':_0x112a63,'OpenchannelQueueId':_0x412bba['id']});});});});});});})[_0x0ab5('0x16')](respondWithStatusCode(_0x3bb9b5,null))[_0x0ab5('0x28')](handleError(_0x3bb9b5,null));};exports['addAgents']=function(_0x4fbf35,_0x158371){return db[_0x0ab5('0x24')][_0x0ab5('0x32')]({'where':{'id':_0x4fbf35[_0x0ab5('0x29')]['id']}})['then'](handleEntityNotFound(_0x158371,null))['then'](function(_0x121cd4){if(_0x121cd4){return _0x121cd4[_0x0ab5('0x6c')](_0x4fbf35['body'][_0x0ab5('0x4f')],_[_0x0ab5('0x6d')](_0x4fbf35['body'],['ids','id'])||{})[_0x0ab5('0x6e')](function(_0x39299b){for(var _0x876ee=0x0;_0x876ee<_0x4fbf35[_0x0ab5('0x34')]['ids'][_0x0ab5('0x30')];_0x876ee+=0x1){socket[_0x0ab5('0x59')]('userOpenchannelQueue:save',{'UserId':Number(_0x4fbf35['body']['ids'][_0x876ee]),'OpenchannelQueueId':Number(_0x4fbf35[_0x0ab5('0x29')]['id'])});}return _0x39299b;});}})[_0x0ab5('0x16')](respondWithResult(_0x158371,null))['catch'](handleError(_0x158371,null));};exports[_0x0ab5('0x6a')]=function(_0x25eb63,_0xd9c40f){return db['OpenchannelQueue'][_0x0ab5('0x32')]({'where':{'id':_0x25eb63[_0x0ab5('0x29')]['id']}})[_0x0ab5('0x16')](handleEntityNotFound(_0xd9c40f,null))[_0x0ab5('0x16')](function(_0x579e37){if(_0x579e37){return _0x579e37[_0x0ab5('0x6a')](_0x25eb63[_0x0ab5('0x26')][_0x0ab5('0x4f')])[_0x0ab5('0x16')](function(){if(_['isArray'](_0x25eb63[_0x0ab5('0x26')][_0x0ab5('0x4f')])){for(var _0x34ff4a=0x0;_0x34ff4a<_0x25eb63['query'][_0x0ab5('0x4f')][_0x0ab5('0x30')];_0x34ff4a+=0x1){socket[_0x0ab5('0x59')](_0x0ab5('0x6b'),{'UserId':Number(_0x25eb63[_0x0ab5('0x26')][_0x0ab5('0x4f')][_0x34ff4a]),'OpenchannelQueueId':Number(_0x25eb63[_0x0ab5('0x29')]['id'])});}}else{socket[_0x0ab5('0x59')](_0x0ab5('0x6b'),{'UserId':Number(_0x25eb63[_0x0ab5('0x26')][_0x0ab5('0x4f')]),'OpenchannelQueueId':Number(_0x25eb63['params']['id'])});}});}})['then'](respondWithStatusCode(_0xd9c40f,null))[_0x0ab5('0x28')](handleError(_0xd9c40f,null));};exports['getAgents']=function(_0x397ce5,_0x1c8839){var _0x5aa28f={};var _0x1c7b7f={};var _0x488f48;var _0x3d5861;return db[_0x0ab5('0x24')][_0x0ab5('0x3b')]({'where':{'id':_0x397ce5[_0x0ab5('0x29')]['id']}})[_0x0ab5('0x16')](handleEntityNotFound(_0x1c8839,null))['then'](function(_0x13c9b6){if(_0x13c9b6){_0x488f48=_0x13c9b6;_0x1c7b7f[_0x0ab5('0x2a')]=_[_0x0ab5('0x2b')](db[_0x0ab5('0x50')][_0x0ab5('0x20')]);_0x1c7b7f['query']=_[_0x0ab5('0x2b')](_0x397ce5['query']);_0x1c7b7f[_0x0ab5('0x2c')]=_['intersection'](_0x1c7b7f[_0x0ab5('0x2a')],_0x1c7b7f[_0x0ab5('0x26')]);_0x5aa28f[_0x0ab5('0x2e')]=_[_0x0ab5('0x2d')](_0x1c7b7f[_0x0ab5('0x2a')],qs[_0x0ab5('0x2f')](_0x397ce5[_0x0ab5('0x26')][_0x0ab5('0x2f')]));_0x5aa28f[_0x0ab5('0x2e')]=_0x5aa28f['attributes'][_0x0ab5('0x30')]?_0x5aa28f['attributes']:_0x1c7b7f['model'];_0x5aa28f[_0x0ab5('0x3d')]=qs[_0x0ab5('0x3e')](_0x397ce5[_0x0ab5('0x26')][_0x0ab5('0x3e')]);_0x5aa28f[_0x0ab5('0x23')]=qs['filters'](_['pick'](_0x397ce5[_0x0ab5('0x26')],_0x1c7b7f[_0x0ab5('0x2c')]));if(_0x397ce5[_0x0ab5('0x26')][_0x0ab5('0x41')]){_0x5aa28f[_0x0ab5('0x23')]=_[_0x0ab5('0x42')](_0x5aa28f[_0x0ab5('0x23')],{'$or':_[_0x0ab5('0x43')](_0x5aa28f[_0x0ab5('0x2e')],function(_0x550d22){var _0x5316c6={};_0x5316c6[_0x550d22]={'$like':'%'+_0x397ce5['query'][_0x0ab5('0x41')]+'%'};return _0x5316c6;})});}_0x5aa28f=_['merge']({},_0x5aa28f,_0x397ce5['options']);return _0x488f48[_0x0ab5('0x6f')](_0x5aa28f);}})[_0x0ab5('0x16')](function(_0x3cd0a4){if(_0x3cd0a4){_0x3d5861=_0x3cd0a4['length'];if(!_0x397ce5[_0x0ab5('0x26')][_0x0ab5('0x3c')](_0x0ab5('0x70'))){_0x5aa28f[_0x0ab5('0x10')]=qs['limit'](_0x397ce5['query'][_0x0ab5('0x10')]);_0x5aa28f['offset']=qs[_0x0ab5('0xe')](_0x397ce5['query']['offset']);}return _0x488f48[_0x0ab5('0x6f')](_0x5aa28f);}})[_0x0ab5('0x16')](function(_0x2eae95){if(_0x2eae95){return _0x2eae95?{'count':_0x3d5861,'rows':_0x2eae95}:null;}})['then'](respondWithResult(_0x1c8839,null))['catch'](handleError(_0x1c8839,null));}; \ No newline at end of file +var _0x222a=['join','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','../../config/logger','api','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','UserProfileResource','destroy','end','stack','name','send','index','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','catch','params','model','keys','filters','attributes','intersection','fields','length','merge','create','user','role','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','map','filter','options','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','findOne','Team','getTeams','addTeams','ids','online','voicePause','interface','Agents','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','from','team_has_openchannel_queues'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x222a,0x187));var _0xa222=function(_0x59ac38,_0x33fa6f){_0x59ac38=_0x59ac38-0x0;var _0x5ec474=_0x222a[_0x59ac38];return _0x5ec474;};'use strict';var BPromise=require(_0xa222('0x0'));var util=require(_0xa222('0x1'));var _=require(_0xa222('0x2'));var squel=require(_0xa222('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa222('0x4'))(_0xa222('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa222('0x6')]=_['defaults'](config[_0xa222('0x6')],{'host':_0xa222('0x7'),'port':0x18eb});var socket=require(_0xa222('0x8'))(new Redis(config[_0xa222('0x6')]));require(_0xa222('0x9'))[_0xa222('0xa')](socket);function respondWithStatusCode(_0x94b6ed,_0x10ce14){_0x10ce14=_0x10ce14||0xcc;return function(_0x39f760){if(_0x39f760){return _0x94b6ed[_0xa222('0xb')](_0x10ce14);}return _0x94b6ed[_0xa222('0xc')](_0x10ce14)['end']();};}function respondWithResult(_0x2777c0,_0x37ee2d){_0x37ee2d=_0x37ee2d||0xc8;return function(_0x50ab97){if(_0x50ab97){return _0x2777c0[_0xa222('0xc')](_0x37ee2d)[_0xa222('0xd')](_0x50ab97);}};}function respondWithFilteredResult(_0x171368,_0x533e93){return function(_0x221912){if(_0x221912){var _0x541fbd=typeof _0x533e93[_0xa222('0xe')]===_0xa222('0xf')&&typeof _0x533e93[_0xa222('0x10')]===_0xa222('0xf');var _0x4b4605=_0x221912[_0xa222('0x11')];var _0x5da47c=_0x541fbd?0x0:_0x533e93[_0xa222('0xe')];var _0x3fba0c=_0x541fbd?_0x221912[_0xa222('0x11')]:_0x533e93[_0xa222('0xe')]+_0x533e93[_0xa222('0x10')];var _0x5da38e;if(_0x3fba0c>=_0x4b4605){_0x3fba0c=_0x4b4605;_0x5da38e=0xc8;}else{_0x5da38e=0xce;}_0x171368[_0xa222('0xc')](_0x5da38e);return _0x171368[_0xa222('0x12')](_0xa222('0x13'),_0x5da47c+'-'+_0x3fba0c+'/'+_0x4b4605)['json'](_0x221912);}return null;};}function saveUpdates(_0xbbecf3){return function(_0x1ad205){if(_0x1ad205){return _0x1ad205[_0xa222('0x14')](_0xbbecf3)[_0xa222('0x15')](function(_0x1100c5){return _0x1100c5;});}return null;};}function removeEntity(_0x48eb5c){return function(_0x18ba90){if(_0x18ba90){return _0x18ba90['destroy']()['then'](function(){var _0x13390e=_0x18ba90[_0xa222('0x16')]({'plain':!![]});var _0x34927e='OpenchannelQueues';return db[_0xa222('0x17')][_0xa222('0x18')]({'where':{'type':_0x34927e,'resourceId':_0x13390e['id']}})['then'](function(){return _0x18ba90;});})['then'](function(){_0x48eb5c[_0xa222('0xc')](0xcc)[_0xa222('0x19')]();});}};}function handleEntityNotFound(_0x284a1b){return function(_0x1ffb83){if(!_0x1ffb83){_0x284a1b[_0xa222('0xb')](0x194);}return _0x1ffb83;};}function handleError(_0x1c735a,_0x101ac2){_0x101ac2=_0x101ac2||0x1f4;return function(_0x1fd135){logger['error'](_0x1fd135[_0xa222('0x1a')]);if(_0x1fd135['name']){delete _0x1fd135[_0xa222('0x1b')];}_0x1c735a['status'](_0x101ac2)[_0xa222('0x1c')](_0x1fd135);};}exports[_0xa222('0x1d')]=function(_0x6c0070,_0x5b93bc){var _0x28bc56={};var _0x31468d={'count':0x0,'rows':[]};var _0x295d25=_['map'](db[_0xa222('0x1e')][_0xa222('0x1f')],function(_0xdf5816){return{'name':_0xdf5816['fieldName'],'type':_0xdf5816[_0xa222('0x20')][_0xa222('0x21')]};});_0x28bc56=qs[_0xa222('0x22')](_0x295d25,_0x6c0070);var _0x5e3677={'where':_0x28bc56[_0xa222('0x23')]};return db[_0xa222('0x1e')][_0xa222('0x11')](_0x5e3677)[_0xa222('0x15')](function(_0x594b2a){_0x31468d[_0xa222('0x11')]=_0x594b2a;_0x28bc56[_0xa222('0x24')]=qs[_0xa222('0x24')](_0x6c0070[_0xa222('0x25')]);return db[_0xa222('0x1e')][_0xa222('0x26')](_0x28bc56);})[_0xa222('0x15')](function(_0x4cad14){_0x31468d[_0xa222('0x27')]=_0x4cad14;return _0x31468d;})[_0xa222('0x15')](respondWithFilteredResult(_0x5b93bc,_0x28bc56))[_0xa222('0x28')](handleError(_0x5b93bc,null));};exports['show']=function(_0x43f6a8,_0x4ac6ec){var _0x471962={'raw':!![],'where':{'id':_0x43f6a8[_0xa222('0x29')]['id']}},_0x4a5e61={};_0x4a5e61[_0xa222('0x2a')]=_[_0xa222('0x2b')](db[_0xa222('0x1e')][_0xa222('0x1f')]);_0x4a5e61[_0xa222('0x25')]=_[_0xa222('0x2b')](_0x43f6a8['query']);_0x4a5e61[_0xa222('0x2c')]=_['intersection'](_0x4a5e61[_0xa222('0x2a')],_0x4a5e61[_0xa222('0x25')]);_0x471962[_0xa222('0x2d')]=_[_0xa222('0x2e')](_0x4a5e61[_0xa222('0x2a')],qs[_0xa222('0x2f')](_0x43f6a8[_0xa222('0x25')][_0xa222('0x2f')]));_0x471962[_0xa222('0x2d')]=_0x471962[_0xa222('0x2d')][_0xa222('0x30')]?_0x471962[_0xa222('0x2d')]:_0x4a5e61[_0xa222('0x2a')];if(_0x43f6a8['query']['includeAll']){_0x471962[_0xa222('0x24')]=[{'all':!![]}];}_0x471962=_[_0xa222('0x31')]({},_0x471962,_0x43f6a8['options']);return db['OpenchannelQueue']['find'](_0x471962)[_0xa222('0x15')](handleEntityNotFound(_0x4ac6ec,null))[_0xa222('0x15')](respondWithResult(_0x4ac6ec,null))[_0xa222('0x28')](handleError(_0x4ac6ec,null));};exports[_0xa222('0x32')]=function(_0x42d386,_0x4d2876){return db[_0xa222('0x1e')][_0xa222('0x32')](_0x42d386['body'],{})[_0xa222('0x15')](function(_0x44d49e){var _0x5739f0=_0x42d386[_0xa222('0x33')][_0xa222('0x16')]({'plain':!![]});if(!_0x5739f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5739f0[_0xa222('0x34')]===_0xa222('0x33')){var _0x5109ac=_0x44d49e[_0xa222('0x16')]({'plain':!![]});var _0x3bd899=_0xa222('0x35');return db[_0xa222('0x36')][_0xa222('0x37')]({'where':{'name':_0x3bd899,'userProfileId':_0x5739f0[_0xa222('0x38')]},'raw':!![]})['then'](function(_0x29e6c3){if(_0x29e6c3&&_0x29e6c3[_0xa222('0x39')]===0x0){return db[_0xa222('0x17')][_0xa222('0x32')]({'name':_0x5109ac['name'],'resourceId':_0x5109ac['id'],'type':_0x29e6c3[_0xa222('0x1b')],'sectionId':_0x29e6c3['id']},{})[_0xa222('0x15')](function(){return _0x44d49e;});}else{return _0x44d49e;}})[_0xa222('0x28')](function(_0x3d6386){logger[_0xa222('0x3a')](_0xa222('0x3b'),_0x3d6386);throw _0x3d6386;});}return _0x44d49e;})['then'](respondWithResult(_0x4d2876,0xc9))['catch'](handleError(_0x4d2876,null));};exports[_0xa222('0x14')]=function(_0xcfe2dc,_0x5b8aea){if(_0xcfe2dc[_0xa222('0x3c')]['id']){delete _0xcfe2dc[_0xa222('0x3c')]['id'];}return db[_0xa222('0x1e')]['find']({'where':{'id':_0xcfe2dc[_0xa222('0x29')]['id']}})['then'](handleEntityNotFound(_0x5b8aea,null))[_0xa222('0x15')](saveUpdates(_0xcfe2dc[_0xa222('0x3c')],null))[_0xa222('0x15')](respondWithResult(_0x5b8aea,null))['catch'](handleError(_0x5b8aea,null));};exports['destroy']=function(_0x5ae011,_0x517488){return db['OpenchannelQueue']['find']({'where':{'id':_0x5ae011['params']['id']}})[_0xa222('0x15')](handleEntityNotFound(_0x517488,null))['then'](removeEntity(_0x517488,null))[_0xa222('0x28')](handleError(_0x517488,null));};exports[_0xa222('0x3d')]=function(_0x23fd22,_0x2492ee){return db[_0xa222('0x1e')][_0xa222('0x3d')]()['then'](respondWithResult(_0x2492ee,null))[_0xa222('0x28')](handleError(_0x2492ee,null));};exports[_0xa222('0x3e')]=function(_0x44cc53,_0x350d56){var _0x41cb90={'raw':!![],'where':{}},_0x3de45e={},_0xf4e1b9;return db[_0xa222('0x1e')]['findOne']({'where':{'id':_0x44cc53[_0xa222('0x29')]['id']}})[_0xa222('0x15')](handleEntityNotFound(_0x350d56,null))[_0xa222('0x15')](function(_0x221ff0){if(_0x221ff0){_0xf4e1b9=_0x221ff0[_0xa222('0x16')]({'plain':!![]});_0x3de45e['model']=_['keys'](db[_0xa222('0x3f')][_0xa222('0x1f')]);_0x3de45e[_0xa222('0x25')]=_[_0xa222('0x2b')](_0x44cc53[_0xa222('0x25')]);_0x3de45e[_0xa222('0x2c')]=_[_0xa222('0x2e')](_0x3de45e[_0xa222('0x2a')],_0x3de45e[_0xa222('0x25')]);_0x41cb90['attributes']=_['intersection'](_0x3de45e[_0xa222('0x2a')],qs[_0xa222('0x2f')](_0x44cc53[_0xa222('0x25')][_0xa222('0x2f')]));_0x41cb90[_0xa222('0x2d')]=_0x41cb90['attributes'][_0xa222('0x30')]?_0x41cb90[_0xa222('0x2d')]:_0x3de45e[_0xa222('0x2a')];if(!_0x44cc53[_0xa222('0x25')][_0xa222('0x40')](_0xa222('0x41'))){_0x41cb90[_0xa222('0x10')]=qs[_0xa222('0x10')](_0x44cc53[_0xa222('0x25')][_0xa222('0x10')]);_0x41cb90[_0xa222('0xe')]=qs[_0xa222('0xe')](_0x44cc53[_0xa222('0x25')]['offset']);}_0x41cb90[_0xa222('0x42')]=qs[_0xa222('0x43')](_0x44cc53['query'][_0xa222('0x43')]);_0x41cb90[_0xa222('0x23')]=qs[_0xa222('0x2c')](_[_0xa222('0x44')](_0x44cc53[_0xa222('0x25')],_0x3de45e['filters']));_0x41cb90[_0xa222('0x23')][_0xa222('0x45')]=_0x221ff0['id'];if(_0x44cc53[_0xa222('0x25')]['filter']){_0x41cb90[_0xa222('0x23')]=_[_0xa222('0x31')](_0x41cb90[_0xa222('0x23')],{'$or':_[_0xa222('0x46')](_0x41cb90[_0xa222('0x2d')],function(_0x52c4a2){var _0x5c88e6={};_0x5c88e6[_0x52c4a2]={'$like':'%'+_0x44cc53['query'][_0xa222('0x47')]+'%'};return _0x5c88e6;})});}_0x41cb90=_['merge']({},_0x41cb90,_0x44cc53[_0xa222('0x48')]);return db['UserOpenchannelQueue']['findAll'](_0x41cb90);}})[_0xa222('0x15')](function(_0x4fd5d7){if(_0x4fd5d7){return db[_0xa222('0x49')][_0xa222('0x4a')]({'where':{'id':_[_0xa222('0x46')](_0x4fd5d7,_0xa222('0x4b')),'role':_0xa222('0x4c')},'attributes':['id','name',_0xa222('0x4d'),'updatedAt',_0xa222('0x4e')]});}})['then'](function(_0x3620f0){if(_0x3620f0){return{'count':_0x3620f0[_0xa222('0x11')],'rows':_[_0xa222('0x46')](_0x3620f0['rows'],function(_0x403745){return{'membername':_0x403745[_0xa222('0x1b')],'UserId':_0x403745['id'],'queue_name':_0xf4e1b9[_0xa222('0x1b')],'OpenchannelQueueId':_0xf4e1b9['id'],'interface':util[_0xa222('0x4f')](_0xa222('0x50'),_0xa222('0x51'),_0x403745[_0xa222('0x1b')]),'penalty':0x0,'paused':_0x403745['openchannelPause'],'createdAt':_0x403745[_0xa222('0x4e')],'updatedAt':_0x403745[_0xa222('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa222('0x15')](respondWithFilteredResult(_0x350d56,_0x41cb90))[_0xa222('0x28')](handleError(_0x350d56,null));};exports['getTeams']=function(_0x363809,_0x237631){var _0x1a0414={};var _0x1a41e8={};var _0x4a222b;var _0x5679fb;return db['OpenchannelQueue'][_0xa222('0x53')]({'where':{'id':_0x363809['params']['id']}})[_0xa222('0x15')](handleEntityNotFound(_0x237631,null))['then'](function(_0x2757bb){if(_0x2757bb){_0x4a222b=_0x2757bb;_0x1a41e8[_0xa222('0x2a')]=_[_0xa222('0x2b')](db[_0xa222('0x54')][_0xa222('0x1f')]);_0x1a41e8[_0xa222('0x25')]=_[_0xa222('0x2b')](_0x363809[_0xa222('0x25')]);_0x1a41e8[_0xa222('0x2c')]=_[_0xa222('0x2e')](_0x1a41e8['model'],_0x1a41e8[_0xa222('0x25')]);_0x1a0414[_0xa222('0x2d')]=_[_0xa222('0x2e')](_0x1a41e8[_0xa222('0x2a')],qs[_0xa222('0x2f')](_0x363809[_0xa222('0x25')][_0xa222('0x2f')]));_0x1a0414[_0xa222('0x2d')]=_0x1a0414[_0xa222('0x2d')][_0xa222('0x30')]?_0x1a0414[_0xa222('0x2d')]:_0x1a41e8[_0xa222('0x2a')];_0x1a0414[_0xa222('0x42')]=qs['sort'](_0x363809[_0xa222('0x25')][_0xa222('0x43')]);_0x1a0414[_0xa222('0x23')]=qs['filters'](_[_0xa222('0x44')](_0x363809[_0xa222('0x25')],_0x1a41e8[_0xa222('0x2c')]));if(_0x363809[_0xa222('0x25')][_0xa222('0x47')]){_0x1a0414[_0xa222('0x23')]=_[_0xa222('0x31')](_0x1a0414['where'],{'$or':_[_0xa222('0x46')](_0x1a0414[_0xa222('0x2d')],function(_0x45112c){var _0x585e17={};_0x585e17[_0x45112c]={'$like':'%'+_0x363809[_0xa222('0x25')]['filter']+'%'};return _0x585e17;})});}_0x1a0414=_[_0xa222('0x31')]({},_0x1a0414,_0x363809['options']);return _0x4a222b[_0xa222('0x55')](_0x1a0414);}})[_0xa222('0x15')](function(_0x1d6c42){if(_0x1d6c42){_0x5679fb=_0x1d6c42[_0xa222('0x30')];if(!_0x363809['query'][_0xa222('0x40')](_0xa222('0x41'))){_0x1a0414[_0xa222('0x10')]=qs['limit'](_0x363809[_0xa222('0x25')]['limit']);_0x1a0414[_0xa222('0xe')]=qs['offset'](_0x363809[_0xa222('0x25')][_0xa222('0xe')]);}return _0x4a222b['getTeams'](_0x1a0414);}})[_0xa222('0x15')](function(_0x5d0cf3){if(_0x5d0cf3){return _0x5d0cf3?{'count':_0x5679fb,'rows':_0x5d0cf3}:null;}})[_0xa222('0x15')](respondWithResult(_0x237631,null))[_0xa222('0x28')](handleError(_0x237631,null));};exports[_0xa222('0x56')]=function(_0x25f870,_0x32075f){var _0x1ba4c7=_0x25f870[_0xa222('0x3c')][_0xa222('0x57')];return db['Team'][_0xa222('0x26')]({'where':{'id':_0x1ba4c7},'attributes':['id'],'include':[{'model':db[_0xa222('0x49')],'as':'Agents','attributes':['id',_0xa222('0x1b'),_0xa222('0x58'),_0xa222('0x59'),_0xa222('0x5a')],'raw':!![]}]})[_0xa222('0x15')](function(_0x13d5fd){if(_0x13d5fd){var _0x1c2148=_['flatMap'](_0x13d5fd,function(_0x31e353){var _0x3f1ef2=_0x31e353[_0xa222('0x16')]({'plain':!![]});return _0x3f1ef2[_0xa222('0x5b')];});return db[_0xa222('0x1e')]['find']({'where':{'id':_0x25f870[_0xa222('0x29')]['id']}})['then'](function(_0x55d05e){return db['sequelize'][_0xa222('0x5c')](function(_0x48191d){return _0x55d05e[_0xa222('0x56')](_0x1ba4c7,{'transaction':_0x48191d})[_0xa222('0x15')](function(){return BPromise[_0xa222('0x5d')](_0x1c2148,function(_0x530c8f){return db['UserOpenchannelQueue'][_0xa222('0x5e')]({'where':{'UserId':_0x530c8f['id'],'OpenchannelQueueId':_0x25f870['params']['id']},'transaction':_0x48191d});});})[_0xa222('0x15')](function(){_0x1c2148[_0xa222('0x5f')](function(_0x27edba){socket['emit'](_0xa222('0x60'),{'UserId':_0x27edba['id'],'OpenchannelQueueId':_0x55d05e['id']});});});});});}})[_0xa222('0x15')](respondWithStatusCode(_0x32075f,null))[_0xa222('0x28')](handleError(_0x32075f,null));};exports[_0xa222('0x61')]=function(_0x38ef4d,_0x5df07f){return db[_0xa222('0x54')][_0xa222('0x26')]({'where':{'id':_0x38ef4d[_0xa222('0x25')][_0xa222('0x57')]},'attributes':['id'],'include':[{'model':db[_0xa222('0x49')],'as':_0xa222('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xa222('0x15')](handleEntityNotFound(_0x5df07f,null))[_0xa222('0x15')](function(_0x4e2cd0){var _0x2081db=_[_0xa222('0x46')](_0x4e2cd0,'id');var _0x466f81=[];var _0x219391=[];var _0x3bbab3=squel['select']();_0x3bbab3[_0xa222('0x62')]('tq.TeamId')[_0xa222('0x63')](_0xa222('0x64'),'tq')[_0xa222('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa222('0x23')](_0xa222('0x66'),_0x38ef4d[_0xa222('0x29')]['id']);for(var _0xa2013e=0x0;_0xa2013e<_0x4e2cd0['length'];_0xa2013e+=0x1){let _0x1a55c0=_0x4e2cd0[_0xa2013e];for(var _0x2b5404=0x0;_0x2b5404<_0x1a55c0[_0xa222('0x5b')]['length'];_0x2b5404+=0x1){let _0x4b522a=_0x1a55c0['Agents'][_0x2b5404];var _0x1b0162=_0x3bbab3['clone']();_0x1b0162['where'](_0xa222('0x67'),_0x4b522a['id']);_0x219391[_0xa222('0x68')](db[_0xa222('0x69')]['query'](_0x1b0162[_0xa222('0x6a')](),{'type':db[_0xa222('0x69')]['QueryTypes'][_0xa222('0x6b')]})[_0xa222('0x15')](function(_0x4ec4ee){if(_0x4ec4ee[_0xa222('0x30')]===0x1){return _0x4b522a['id'];}else{var _0x3bcb59=_[_0xa222('0x6c')](_[_0xa222('0x46')](_0x4ec4ee,_0xa222('0x6d')),function(_0x2984b5){return _[_0xa222('0x6e')](_0x2081db,_0x2984b5);});if(_0x3bcb59){return _0x4b522a['id'];}}}));}}return BPromise[_0xa222('0x6f')](_0x219391)['then'](function(_0x52c191){_0x466f81=_(_0x466f81)['union'](_0x52c191)[_0xa222('0x70')]()[_0xa222('0x71')]();return db['OpenchannelQueue'][_0xa222('0x37')]({'where':{'id':_0x38ef4d['params']['id']}})[_0xa222('0x15')](function(_0x1dce55){return db[_0xa222('0x69')][_0xa222('0x5c')](function(_0x4587db){return _0x1dce55[_0xa222('0x61')](_0x38ef4d[_0xa222('0x25')][_0xa222('0x57')],{'transaction':_0x4587db})[_0xa222('0x15')](function(){if(!_[_0xa222('0x72')](_0x466f81)){return _0x1dce55[_0xa222('0x73')](_0x466f81,{'transaction':_0x4587db});}})[_0xa222('0x15')](function(){_0x466f81['forEach'](function(_0x2c60e6){socket[_0xa222('0x74')]('userOpenchannelQueue:remove',{'UserId':_0x2c60e6,'OpenchannelQueueId':_0x1dce55['id']});});});});});});})[_0xa222('0x15')](respondWithStatusCode(_0x5df07f,null))['catch'](handleError(_0x5df07f,null));};exports[_0xa222('0x75')]=function(_0x49436f,_0x472a05){return db['OpenchannelQueue']['find']({'where':{'id':_0x49436f[_0xa222('0x29')]['id']}})[_0xa222('0x15')](handleEntityNotFound(_0x472a05,null))['then'](function(_0x482f8c){if(_0x482f8c){return _0x482f8c[_0xa222('0x75')](_0x49436f[_0xa222('0x3c')][_0xa222('0x57')],_[_0xa222('0x76')](_0x49436f['body'],[_0xa222('0x57'),'id'])||{})[_0xa222('0x77')](function(_0x1bc3b3){for(var _0x4a793e=0x0;_0x4a793e<_0x49436f['body'][_0xa222('0x57')]['length'];_0x4a793e+=0x1){socket[_0xa222('0x74')](_0xa222('0x60'),{'UserId':Number(_0x49436f[_0xa222('0x3c')]['ids'][_0x4a793e]),'OpenchannelQueueId':Number(_0x49436f['params']['id'])});}return _0x1bc3b3;});}})[_0xa222('0x15')](respondWithResult(_0x472a05,null))[_0xa222('0x28')](handleError(_0x472a05,null));};exports[_0xa222('0x73')]=function(_0x1927d2,_0x1b8bdd){return db[_0xa222('0x1e')][_0xa222('0x37')]({'where':{'id':_0x1927d2['params']['id']}})[_0xa222('0x15')](handleEntityNotFound(_0x1b8bdd,null))[_0xa222('0x15')](function(_0x51c5e7){if(_0x51c5e7){return _0x51c5e7[_0xa222('0x73')](_0x1927d2['query'][_0xa222('0x57')])['then'](function(){if(_[_0xa222('0x78')](_0x1927d2[_0xa222('0x25')][_0xa222('0x57')])){for(var _0x28aba1=0x0;_0x28aba1<_0x1927d2[_0xa222('0x25')]['ids'][_0xa222('0x30')];_0x28aba1+=0x1){socket['emit'](_0xa222('0x79'),{'UserId':Number(_0x1927d2['query']['ids'][_0x28aba1]),'OpenchannelQueueId':Number(_0x1927d2[_0xa222('0x29')]['id'])});}}else{socket['emit'](_0xa222('0x79'),{'UserId':Number(_0x1927d2['query'][_0xa222('0x57')]),'OpenchannelQueueId':Number(_0x1927d2[_0xa222('0x29')]['id'])});}});}})[_0xa222('0x15')](respondWithStatusCode(_0x1b8bdd,null))[_0xa222('0x28')](handleError(_0x1b8bdd,null));};exports[_0xa222('0x7a')]=function(_0x553bbf,_0x3b87e4){var _0x15c377={};var _0x4243f4={};var _0x57e97d;var _0x45eca6;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x553bbf['params']['id']}})[_0xa222('0x15')](handleEntityNotFound(_0x3b87e4,null))['then'](function(_0x226454){if(_0x226454){_0x57e97d=_0x226454;_0x4243f4[_0xa222('0x2a')]=_['keys'](db[_0xa222('0x49')][_0xa222('0x1f')]);_0x4243f4['query']=_[_0xa222('0x2b')](_0x553bbf[_0xa222('0x25')]);_0x4243f4[_0xa222('0x2c')]=_[_0xa222('0x2e')](_0x4243f4['model'],_0x4243f4[_0xa222('0x25')]);_0x15c377[_0xa222('0x2d')]=_[_0xa222('0x2e')](_0x4243f4[_0xa222('0x2a')],qs[_0xa222('0x2f')](_0x553bbf[_0xa222('0x25')][_0xa222('0x2f')]));_0x15c377[_0xa222('0x2d')]=_0x15c377[_0xa222('0x2d')][_0xa222('0x30')]?_0x15c377[_0xa222('0x2d')]:_0x4243f4[_0xa222('0x2a')];_0x15c377[_0xa222('0x42')]=qs['sort'](_0x553bbf[_0xa222('0x25')][_0xa222('0x43')]);_0x15c377['where']=qs['filters'](_[_0xa222('0x44')](_0x553bbf[_0xa222('0x25')],_0x4243f4[_0xa222('0x2c')]));if(_0x553bbf[_0xa222('0x25')]['filter']){_0x15c377['where']=_['merge'](_0x15c377[_0xa222('0x23')],{'$or':_[_0xa222('0x46')](_0x15c377['attributes'],function(_0x3a1eb6){var _0xca922c={};_0xca922c[_0x3a1eb6]={'$like':'%'+_0x553bbf[_0xa222('0x25')][_0xa222('0x47')]+'%'};return _0xca922c;})});}_0x15c377=_[_0xa222('0x31')]({},_0x15c377,_0x553bbf[_0xa222('0x48')]);return _0x57e97d[_0xa222('0x7a')](_0x15c377);}})[_0xa222('0x15')](function(_0x30dafc){if(_0x30dafc){_0x45eca6=_0x30dafc[_0xa222('0x30')];if(!_0x553bbf[_0xa222('0x25')][_0xa222('0x40')]('nolimit')){_0x15c377[_0xa222('0x10')]=qs[_0xa222('0x10')](_0x553bbf['query'][_0xa222('0x10')]);_0x15c377[_0xa222('0xe')]=qs['offset'](_0x553bbf['query'][_0xa222('0xe')]);}return _0x57e97d[_0xa222('0x7a')](_0x15c377);}})['then'](function(_0x2402dd){if(_0x2402dd){return _0x2402dd?{'count':_0x45eca6,'rows':_0x2402dd}:null;}})[_0xa222('0x15')](respondWithResult(_0x3b87e4,null))[_0xa222('0x28')](handleError(_0x3b87e4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 51ea454..6f1a62d 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 _0x1e23=['hook','exports','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x333895,_0x4c9b74){var _0x1e84a1=function(_0x24a48f){while(--_0x24a48f){_0x333895['push'](_0x333895['shift']());}};_0x1e84a1(++_0x4c9b74);}(_0x1e23,0xca));var _0x31e2=function(_0x4a38bd,_0x141954){_0x4a38bd=_0x4a38bd-0x0;var _0x2a6770=_0x1e23[_0x4a38bd];return _0x2a6770;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x31e2('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x31e2('0x1')](0x0);var events={'afterCreate':_0x31e2('0x2'),'afterUpdate':_0x31e2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2c1880){return function(_0x26bcbd,_0x179753,_0x579c24){OpenchannelQueueEvents[_0x31e2('0x4')](_0x2c1880+':'+_0x26bcbd['id'],_0x26bcbd);OpenchannelQueueEvents[_0x31e2('0x4')](_0x2c1880,_0x26bcbd);_0x579c24(null);};}for(var e in events){if(events[_0x31e2('0x5')](e)){var event=events[e];OpenchannelQueue[_0x31e2('0x6')](e,emitEvent(event));}}module[_0x31e2('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xe0e6=['OpenchannelQueue','setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x2563b7,_0x313b3a){var _0x5b1ffe=function(_0x312065){while(--_0x312065){_0x2563b7['push'](_0x2563b7['shift']());}};_0x5b1ffe(++_0x313b3a);}(_0xe0e6,0xb6));var _0x6e0e=function(_0x1b2e6b,_0x2f97fb){_0x1b2e6b=_0x1b2e6b-0x0;var _0x1dd2aa=_0xe0e6[_0x1b2e6b];return _0x1dd2aa;};'use strict';var EventEmitter=require(_0x6e0e('0x0'));var OpenchannelQueue=require(_0x6e0e('0x1'))['db'][_0x6e0e('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6e0e('0x3')](0x0);var events={'afterCreate':_0x6e0e('0x4'),'afterUpdate':_0x6e0e('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc63c62){return function(_0x16fa44,_0x26e546,_0x59e21f){OpenchannelQueueEvents[_0x6e0e('0x6')](_0xc63c62+':'+_0x16fa44['id'],_0x16fa44);OpenchannelQueueEvents[_0x6e0e('0x6')](_0xc63c62,_0x16fa44);_0x59e21f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x6e0e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 49eb6e8..0c9a091 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 _0xff55=['../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','util','api','moment','request-promise','rimraf'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xff55,0x1bd));var _0x5ff5=function(_0x37432d,_0x580dac){_0x37432d=_0x37432d-0x0;var _0x51ce8d=_0xff55[_0x37432d];return _0x51ce8d;};'use strict';var _=require('lodash');var util=require(_0x5ff5('0x0'));var logger=require('../../config/logger')(_0x5ff5('0x1'));var moment=require(_0x5ff5('0x2'));var BPromise=require('bluebird');var rp=require(_0x5ff5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ff5('0x4'));var config=require(_0x5ff5('0x5'));var attributes=require(_0x5ff5('0x6'));module['exports']=function(_0x42504f,_0x46cc34){return _0x42504f[_0x5ff5('0x7')](_0x5ff5('0x8'),attributes,{'tableName':_0x5ff5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba93=['openchannel_queues','lodash','util','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x406fbe,_0x5d3bd3){var _0x48a9e3=function(_0x525a2b){while(--_0x525a2b){_0x406fbe['push'](_0x406fbe['shift']());}};_0x48a9e3(++_0x5d3bd3);}(_0xba93,0xd3));var _0x3ba9=function(_0x168584,_0x4c1f48){_0x168584=_0x168584-0x0;var _0x3a764d=_0xba93[_0x168584];return _0x3a764d;};'use strict';var _=require(_0x3ba9('0x0'));var util=require(_0x3ba9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3ba9('0x2'));var fs=require('fs');var path=require(_0x3ba9('0x3'));var rimraf=require(_0x3ba9('0x4'));var config=require(_0x3ba9('0x5'));var attributes=require(_0x3ba9('0x6'));module[_0x3ba9('0x7')]=function(_0x49050d,_0x55c5d6){return _0x49050d[_0x3ba9('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x3ba9('0x9'),'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 fd910b7..bf363f8 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 _0xae84=['../../config/environment','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x240ab2,_0x3fefa7){var _0x39357f=function(_0x40b246){while(--_0x40b246){_0x240ab2['push'](_0x240ab2['shift']());}};_0x39357f(++_0x3fefa7);}(_0xae84,0x11e));var _0x4ae8=function(_0x4a7127,_0x323c47){_0x4a7127=_0x4a7127-0x0;var _0x413894=_0xae84[_0x4a7127];return _0x413894;};'use strict';var _=require(_0x4ae8('0x0'));var util=require(_0x4ae8('0x1'));var moment=require(_0x4ae8('0x2'));var BPromise=require(_0x4ae8('0x3'));var rs=require(_0x4ae8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ae8('0x5'))['db'];var utils=require(_0x4ae8('0x6'));var logger=require('../../config/logger')(_0x4ae8('0x7'));var config=require(_0x4ae8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ae8('0x9')][_0x4ae8('0xa')]({'port':0x232a});config[_0x4ae8('0xb')]=_['defaults'](config[_0x4ae8('0xb')],{'host':_0x4ae8('0xc'),'port':0x18eb});var socket=require(_0x4ae8('0xd'))(new Redis(config[_0x4ae8('0xb')]));require(_0x4ae8('0xe'))[_0x4ae8('0xf')](socket);function respondWithRpcPromise(_0x515a99,_0x231b0d,_0x78e7bd){return new BPromise(function(_0x119415,_0xf202f1){return client[_0x4ae8('0x10')](_0x515a99,_0x78e7bd)[_0x4ae8('0x11')](function(_0x3c3872){logger['info'](_0x4ae8('0x12'),_0x231b0d,_0x4ae8('0x13'));logger[_0x4ae8('0x14')](_0x4ae8('0x15'),_0x231b0d,_0x4ae8('0x13'),JSON[_0x4ae8('0x16')](_0x3c3872));if(_0x3c3872[_0x4ae8('0x17')]){if(_0x3c3872[_0x4ae8('0x17')][_0x4ae8('0x18')]===0x1f4){logger[_0x4ae8('0x17')](_0x4ae8('0x12'),_0x231b0d,_0x3c3872[_0x4ae8('0x17')][_0x4ae8('0x19')]);return _0xf202f1(_0x3c3872[_0x4ae8('0x17')][_0x4ae8('0x19')]);}logger[_0x4ae8('0x17')](_0x4ae8('0x12'),_0x231b0d,_0x3c3872[_0x4ae8('0x17')][_0x4ae8('0x19')]);return _0x119415(_0x3c3872['error'][_0x4ae8('0x19')]);}else{logger['info'](_0x4ae8('0x12'),_0x231b0d,_0x4ae8('0x13'));_0x119415(_0x3c3872[_0x4ae8('0x1a')][_0x4ae8('0x19')]);}})['catch'](function(_0x5adbe7){logger[_0x4ae8('0x17')](_0x4ae8('0x12'),_0x231b0d,_0x5adbe7);_0xf202f1(_0x5adbe7);});});}exports[_0x4ae8('0x1b')]=function(_0x16dc49){var _0x1bd9e2=this;return new Promise(function(_0x3ed9f3,_0x2957d7){return db['OpenchannelQueue'][_0x4ae8('0x1c')]({'raw':_0x16dc49[_0x4ae8('0x1d')]?_0x16dc49[_0x4ae8('0x1d')][_0x4ae8('0x1e')]===undefined?!![]:![]:!![],'where':_0x16dc49[_0x4ae8('0x1d')]?_0x16dc49[_0x4ae8('0x1d')][_0x4ae8('0x1f')]||null:null,'attributes':_0x16dc49[_0x4ae8('0x1d')]?_0x16dc49[_0x4ae8('0x1d')][_0x4ae8('0x20')]||null:null,'limit':_0x16dc49[_0x4ae8('0x1d')]?_0x16dc49[_0x4ae8('0x1d')][_0x4ae8('0x21')]||null:null,'include':_0x16dc49[_0x4ae8('0x1d')]?_0x16dc49[_0x4ae8('0x1d')]['include']?_['map'](_0x16dc49[_0x4ae8('0x1d')]['include'],function(_0x253025){return{'model':db[_0x253025['model']],'as':_0x253025['as'],'attributes':_0x253025[_0x4ae8('0x20')],'include':_0x253025[_0x4ae8('0x22')]?_[_0x4ae8('0x23')](_0x253025[_0x4ae8('0x22')],function(_0x24e340){return{'model':db[_0x24e340[_0x4ae8('0x24')]],'as':_0x24e340['as'],'attributes':_0x24e340[_0x4ae8('0x20')],'include':_0x24e340[_0x4ae8('0x22')]?_[_0x4ae8('0x23')](_0x24e340[_0x4ae8('0x22')],function(_0x178922){return{'model':db[_0x178922['model']],'as':_0x178922['as'],'attributes':_0x178922['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x20b4e8){logger[_0x4ae8('0x25')]('GetOpenchannelQueue',_0x16dc49);logger[_0x4ae8('0x14')](_0x4ae8('0x1b'),_0x16dc49,JSON[_0x4ae8('0x16')](_0x20b4e8));_0x3ed9f3(_0x20b4e8);})[_0x4ae8('0x26')](function(_0x6e22bc){logger[_0x4ae8('0x17')](_0x4ae8('0x1b'),_0x6e22bc['message'],_0x16dc49);_0x2957d7(_0x1bd9e2[_0x4ae8('0x17')](0x1f4,_0x6e22bc[_0x4ae8('0x19')]));});});};exports[_0x4ae8('0x27')]=function(_0x5cba7b){var _0x53bf64=this;return new Promise(function(_0x5897e7,_0x4d013e){return db[_0x4ae8('0x28')][_0x4ae8('0x29')]({'raw':_0x5cba7b['options']?_0x5cba7b[_0x4ae8('0x1d')][_0x4ae8('0x1e')]===undefined?!![]:![]:!![],'where':_0x5cba7b['options']?_0x5cba7b[_0x4ae8('0x1d')]['where']||null:null,'attributes':_0x5cba7b[_0x4ae8('0x1d')]?_0x5cba7b['options'][_0x4ae8('0x20')]||null:null,'include':_0x5cba7b[_0x4ae8('0x1d')]?_0x5cba7b[_0x4ae8('0x1d')][_0x4ae8('0x22')]?_['map'](_0x5cba7b[_0x4ae8('0x1d')]['include'],function(_0x3cdd87){return{'model':db[_0x3cdd87['model']],'as':_0x3cdd87['as'],'attributes':_0x3cdd87[_0x4ae8('0x20')],'include':_0x3cdd87['include']?_['map'](_0x3cdd87[_0x4ae8('0x22')],function(_0x5925cd){return{'model':db[_0x5925cd[_0x4ae8('0x24')]],'as':_0x5925cd['as'],'attributes':_0x5925cd['attributes'],'include':_0x5925cd[_0x4ae8('0x22')]?_[_0x4ae8('0x23')](_0x5925cd['include'],function(_0x23b4cd){return{'model':db[_0x23b4cd[_0x4ae8('0x24')]],'as':_0x23b4cd['as'],'attributes':_0x23b4cd[_0x4ae8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4ae8('0x11')](function(_0x417161){logger['info'](_0x4ae8('0x27'),_0x5cba7b);logger['debug'](_0x4ae8('0x27'),_0x5cba7b,JSON[_0x4ae8('0x16')](_0x417161));_0x5897e7(_0x417161);})[_0x4ae8('0x26')](function(_0x309ab1){logger['error'](_0x4ae8('0x27'),_0x309ab1[_0x4ae8('0x19')],_0x5cba7b);_0x4d013e(_0x53bf64[_0x4ae8('0x17')](0x1f4,_0x309ab1[_0x4ae8('0x19')]));});});}; \ No newline at end of file +var _0x633c=['http','redis','defaults','socket.io-emitter','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','OpenchannelQueue','findAll','options','raw','where','attributes','include','model','map','GetOpenchannelQueue','stringify','catch','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x512e14,_0x28ca0c){var _0x3a2ca2=function(_0x31f501){while(--_0x31f501){_0x512e14['push'](_0x512e14['shift']());}};_0x3a2ca2(++_0x28ca0c);}(_0x633c,0xb4));var _0xc633=function(_0x3c8b28,_0xb14056){_0x3c8b28=_0x3c8b28-0x0;var _0x4bbf60=_0x633c[_0x3c8b28];return _0x4bbf60;};'use strict';var _=require(_0xc633('0x0'));var util=require(_0xc633('0x1'));var moment=require('moment');var BPromise=require(_0xc633('0x2'));var rs=require(_0xc633('0x3'));var fs=require('fs');var Redis=require(_0xc633('0x4'));var db=require(_0xc633('0x5'))['db'];var utils=require(_0xc633('0x6'));var logger=require(_0xc633('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc633('0x8'));var client=jayson[_0xc633('0x9')][_0xc633('0xa')]({'port':0x232a});config[_0xc633('0xb')]=_[_0xc633('0xc')](config[_0xc633('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc633('0xd'))(new Redis(config[_0xc633('0xb')]));require('./openchannelQueue.socket')[_0xc633('0xe')](socket);function respondWithRpcPromise(_0x4f8dc5,_0x31824e,_0x546dff){return new BPromise(function(_0x57539f,_0x1a6427){return client['request'](_0x4f8dc5,_0x546dff)[_0xc633('0xf')](function(_0x4a2e79){logger['info'](_0xc633('0x10'),_0x31824e,_0xc633('0x11'));logger[_0xc633('0x12')](_0xc633('0x13'),_0x31824e,_0xc633('0x11'),JSON['stringify'](_0x4a2e79));if(_0x4a2e79[_0xc633('0x14')]){if(_0x4a2e79['error']['code']===0x1f4){logger[_0xc633('0x14')](_0xc633('0x10'),_0x31824e,_0x4a2e79[_0xc633('0x14')]['message']);return _0x1a6427(_0x4a2e79[_0xc633('0x14')][_0xc633('0x15')]);}logger['error'](_0xc633('0x10'),_0x31824e,_0x4a2e79[_0xc633('0x14')]['message']);return _0x57539f(_0x4a2e79[_0xc633('0x14')][_0xc633('0x15')]);}else{logger[_0xc633('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x31824e,_0xc633('0x11'));_0x57539f(_0x4a2e79[_0xc633('0x17')][_0xc633('0x15')]);}})['catch'](function(_0x29037b){logger[_0xc633('0x14')](_0xc633('0x10'),_0x31824e,_0x29037b);_0x1a6427(_0x29037b);});});}exports['GetOpenchannelQueue']=function(_0x106000){var _0x2e41bd=this;return new Promise(function(_0x195311,_0x4e61ac){return db[_0xc633('0x18')][_0xc633('0x19')]({'raw':_0x106000[_0xc633('0x1a')]?_0x106000['options'][_0xc633('0x1b')]===undefined?!![]:![]:!![],'where':_0x106000[_0xc633('0x1a')]?_0x106000[_0xc633('0x1a')][_0xc633('0x1c')]||null:null,'attributes':_0x106000[_0xc633('0x1a')]?_0x106000['options'][_0xc633('0x1d')]||null:null,'limit':_0x106000[_0xc633('0x1a')]?_0x106000[_0xc633('0x1a')]['limit']||null:null,'include':_0x106000[_0xc633('0x1a')]?_0x106000[_0xc633('0x1a')][_0xc633('0x1e')]?_['map'](_0x106000['options']['include'],function(_0x8e21dc){return{'model':db[_0x8e21dc[_0xc633('0x1f')]],'as':_0x8e21dc['as'],'attributes':_0x8e21dc[_0xc633('0x1d')],'include':_0x8e21dc[_0xc633('0x1e')]?_[_0xc633('0x20')](_0x8e21dc['include'],function(_0x5000c9){return{'model':db[_0x5000c9[_0xc633('0x1f')]],'as':_0x5000c9['as'],'attributes':_0x5000c9[_0xc633('0x1d')],'include':_0x5000c9[_0xc633('0x1e')]?_[_0xc633('0x20')](_0x5000c9['include'],function(_0x234473){return{'model':db[_0x234473[_0xc633('0x1f')]],'as':_0x234473['as'],'attributes':_0x234473[_0xc633('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc633('0xf')](function(_0x5712ff){logger[_0xc633('0x16')](_0xc633('0x21'),_0x106000);logger[_0xc633('0x12')]('GetOpenchannelQueue',_0x106000,JSON[_0xc633('0x22')](_0x5712ff));_0x195311(_0x5712ff);})[_0xc633('0x23')](function(_0x57e361){logger['error'](_0xc633('0x21'),_0x57e361[_0xc633('0x15')],_0x106000);_0x4e61ac(_0x2e41bd[_0xc633('0x14')](0x1f4,_0x57e361[_0xc633('0x15')]));});});};exports[_0xc633('0x24')]=function(_0x10c659){var _0x523433=this;return new Promise(function(_0x3c41cf,_0x1c83d6){return db[_0xc633('0x18')][_0xc633('0x25')]({'raw':_0x10c659[_0xc633('0x1a')]?_0x10c659[_0xc633('0x1a')][_0xc633('0x1b')]===undefined?!![]:![]:!![],'where':_0x10c659[_0xc633('0x1a')]?_0x10c659[_0xc633('0x1a')]['where']||null:null,'attributes':_0x10c659[_0xc633('0x1a')]?_0x10c659['options']['attributes']||null:null,'include':_0x10c659[_0xc633('0x1a')]?_0x10c659['options'][_0xc633('0x1e')]?_[_0xc633('0x20')](_0x10c659['options'][_0xc633('0x1e')],function(_0x16ad7a){return{'model':db[_0x16ad7a['model']],'as':_0x16ad7a['as'],'attributes':_0x16ad7a[_0xc633('0x1d')],'include':_0x16ad7a[_0xc633('0x1e')]?_[_0xc633('0x20')](_0x16ad7a[_0xc633('0x1e')],function(_0x4a2381){return{'model':db[_0x4a2381['model']],'as':_0x4a2381['as'],'attributes':_0x4a2381[_0xc633('0x1d')],'include':_0x4a2381['include']?_[_0xc633('0x20')](_0x4a2381['include'],function(_0x4c8b09){return{'model':db[_0x4c8b09[_0xc633('0x1f')]],'as':_0x4c8b09['as'],'attributes':_0x4c8b09[_0xc633('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a3b34){logger[_0xc633('0x16')](_0xc633('0x24'),_0x10c659);logger[_0xc633('0x12')]('ShowOpenchannelQueue',_0x10c659,JSON[_0xc633('0x22')](_0x1a3b34));_0x3c41cf(_0x1a3b34);})[_0xc633('0x23')](function(_0x35b313){logger['error'](_0xc633('0x24'),_0x35b313[_0xc633('0x15')],_0x10c659);_0x1c83d6(_0x523433[_0xc633('0x14')](0x1f4,_0x35b313[_0xc633('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 47dbf44..522af6f 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 _0x1bda=['removeListener','register','length','./openchannelQueue.events','save','remove','update','emit'];(function(_0x116c22,_0x30cbf6){var _0x4a7b78=function(_0x42c264){while(--_0x42c264){_0x116c22['push'](_0x116c22['shift']());}};_0x4a7b78(++_0x30cbf6);}(_0x1bda,0x193));var _0xa1bd=function(_0x4cf663,_0x47eea5){_0x4cf663=_0x4cf663-0x0;var _0x2974da=_0x1bda[_0x4cf663];return _0x2974da;};'use strict';var OpenchannelQueueEvents=require(_0xa1bd('0x0'));var events=[_0xa1bd('0x1'),_0xa1bd('0x2'),_0xa1bd('0x3')];function createListener(_0x19cdf6,_0x2db391){return function(_0x4497f0){_0x2db391[_0xa1bd('0x4')](_0x19cdf6,_0x4497f0);};}function removeListener(_0x3f7ca7,_0x2d6f29){return function(){OpenchannelQueueEvents[_0xa1bd('0x5')](_0x3f7ca7,_0x2d6f29);};}exports[_0xa1bd('0x6')]=function(_0xdc61d1){for(var _0x3f6eb3=0x0,_0x4518b4=events[_0xa1bd('0x7')];_0x3f6eb3<_0x4518b4;_0x3f6eb3++){var _0x579b99=events[_0x3f6eb3];var _0x2c929e=createListener('openchannelQueue:'+_0x579b99,_0xdc61d1);OpenchannelQueueEvents['on'](_0x579b99,_0x2c929e);}}; \ No newline at end of file +var _0x65d4=['removeListener','length','openchannelQueue:','remove','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x65d4,0x8a));var _0x465d=function(_0x9c82d7,_0x350568){_0x9c82d7=_0x9c82d7-0x0;var _0x54ae25=_0x65d4[_0x9c82d7];return _0x54ae25;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x465d('0x0'),_0x465d('0x1')];function createListener(_0x17788c,_0x40292f){return function(_0x2a125c){_0x40292f['emit'](_0x17788c,_0x2a125c);};}function removeListener(_0x3b7d2a,_0x36da70){return function(){OpenchannelQueueEvents[_0x465d('0x2')](_0x3b7d2a,_0x36da70);};}exports['register']=function(_0xc3907d){for(var _0x1133d6=0x0,_0x5967dd=events[_0x465d('0x3')];_0x1133d6<_0x5967dd;_0x1133d6++){var _0x7e5a19=events[_0x1133d6];var _0xa9e28d=createListener(_0x465d('0x4')+_0x7e5a19,_0xc3907d);OpenchannelQueueEvents['on'](_0x7e5a19,_0xa9e28d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 247c58c..8aef53f 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 _0xb24d=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3ac151,_0x290a5f){var _0x2c2844=function(_0x321295){while(--_0x321295){_0x3ac151['push'](_0x3ac151['shift']());}};_0x2c2844(++_0x290a5f);}(_0xb24d,0xa9));var _0xdb24=function(_0x29d78f,_0x2098ba){_0x29d78f=_0x29d78f-0x0;var _0x4cb9a0=_0xb24d[_0x29d78f];return _0x4cb9a0;};'use strict';var multer=require(_0xdb24('0x0'));var util=require(_0xdb24('0x1'));var path=require('path');var timeout=require(_0xdb24('0x2'));var express=require('express');var router=express[_0xdb24('0x3')]();var fs_extra=require(_0xdb24('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdb24('0x5'));var config=require(_0xdb24('0x6'));var controller=require(_0xdb24('0x7'));router[_0xdb24('0x8')]('/',auth[_0xdb24('0x9')](),controller[_0xdb24('0xa')]);router[_0xdb24('0x8')](_0xdb24('0xb'),auth[_0xdb24('0x9')](),controller[_0xdb24('0xc')]);router['get'](_0xdb24('0xd'),auth[_0xdb24('0x9')](),controller[_0xdb24('0xe')]);router[_0xdb24('0xf')]('/',auth[_0xdb24('0x9')](),controller[_0xdb24('0x10')]);router[_0xdb24('0x11')](_0xdb24('0xd'),auth[_0xdb24('0x9')](),controller[_0xdb24('0x12')]);router[_0xdb24('0x13')](_0xdb24('0xd'),auth['isAuthenticated'](),controller[_0xdb24('0x14')]);module[_0xdb24('0x15')]=router; \ No newline at end of file +var _0x9aca=['Router','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','/:id','put','update','delete','exports','path'];(function(_0x5dacda,_0x1cb632){var _0x362c74=function(_0x5d4769){while(--_0x5d4769){_0x5dacda['push'](_0x5dacda['shift']());}};_0x362c74(++_0x1cb632);}(_0x9aca,0x15e));var _0xa9ac=function(_0x202041,_0x46419d){_0x202041=_0x202041-0x0;var _0x30e996=_0x9aca[_0x202041];return _0x30e996;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa9ac('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9ac('0x1')]();var fs_extra=require(_0xa9ac('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9ac('0x3'));var controller=require('./openchannelQueueReport.controller');router[_0xa9ac('0x4')]('/',auth['isAuthenticated'](),controller[_0xa9ac('0x5')]);router[_0xa9ac('0x4')](_0xa9ac('0x6'),auth[_0xa9ac('0x7')](),controller['describe']);router[_0xa9ac('0x4')](_0xa9ac('0x8'),auth[_0xa9ac('0x7')](),controller['show']);router['post']('/',auth[_0xa9ac('0x7')](),controller['create']);router[_0xa9ac('0x9')](_0xa9ac('0x8'),auth['isAuthenticated'](),controller[_0xa9ac('0xa')]);router[_0xa9ac('0xb')]('/:id',auth[_0xa9ac('0x7')](),controller['destroy']);module[_0xa9ac('0xc')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 15e1fbe..a936d03 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 _0x9f17=['moment','exports','STRING','DATE'];(function(_0x294d9e,_0x9139b7){var _0x2b79ca=function(_0x2d56be){while(--_0x2d56be){_0x294d9e['push'](_0x294d9e['shift']());}};_0x2b79ca(++_0x9139b7);}(_0x9f17,0x1f0));var _0x79f1=function(_0x448c59,_0x51a6f8){_0x448c59=_0x448c59-0x0;var _0xe16e83=_0x9f17[_0x448c59];return _0xe16e83;};'use strict';var moment=require(_0x79f1('0x0'));var Sequelize=require('sequelize');module[_0x79f1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x79f1('0x2')]},'joinAt':{'type':Sequelize[_0x79f1('0x3')]},'leaveAt':{'type':Sequelize[_0x79f1('0x3')]},'acceptAt':{'type':Sequelize[_0x79f1('0x3')]},'exitAt':{'type':Sequelize[_0x79f1('0x3')]},'reason':{'type':Sequelize[_0x79f1('0x2')]}}; \ No newline at end of file +var _0x16cc=['sequelize','exports','STRING','DATE'];(function(_0x5dfdb5,_0xef1e0c){var _0x1299d8=function(_0x5248c2){while(--_0x5248c2){_0x5dfdb5['push'](_0x5dfdb5['shift']());}};_0x1299d8(++_0xef1e0c);}(_0x16cc,0x120));var _0xc16c=function(_0x266c78,_0x3a8b1d){_0x266c78=_0x266c78-0x0;var _0x2a86ff=_0x16cc[_0x266c78];return _0x2a86ff;};'use strict';var moment=require('moment');var Sequelize=require(_0xc16c('0x0'));module[_0xc16c('0x1')]={'uniqueid':{'type':Sequelize[_0xc16c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc16c('0x2')]},'joinAt':{'type':Sequelize[_0xc16c('0x3')]},'leaveAt':{'type':Sequelize[_0xc16c('0x3')]},'acceptAt':{'type':Sequelize[_0xc16c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc16c('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 28d3e25..2f86fb5 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 _0xf942=['key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','include','findAll','rows','show','params','rawAttributes','length','includeAll','options','create','body','catch','update','find','destroy','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type'];(function(_0x155555,_0x350cd3){var _0x6a9110=function(_0x34828a){while(--_0x34828a){_0x155555['push'](_0x155555['shift']());}};_0x6a9110(++_0x350cd3);}(_0xf942,0x188));var _0x2f94=function(_0xc310cd,_0x260ef2){_0xc310cd=_0xc310cd-0x0;var _0x1e24bb=_0xf942[_0xc310cd];return _0x1e24bb;};'use strict';var emlformat=require(_0x2f94('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f94('0x1'));var rp=require(_0x2f94('0x2'));var moment=require(_0x2f94('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2f94('0x4'));var util=require(_0x2f94('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2f94('0x6'));var ejs=require(_0x2f94('0x7'));var fs=require('fs');var fs_extra=require(_0x2f94('0x8'));var _=require(_0x2f94('0x9'));var squel=require(_0x2f94('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f94('0xb'));var toCsv=require(_0x2f94('0x6'));var querystring=require(_0x2f94('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2f94('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x2f94('0xe'));var hardwareService=require(_0x2f94('0xf'));var logger=require(_0x2f94('0x10'))('api');var utils=require(_0x2f94('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f94('0x12'))['db'];function respondWithStatusCode(_0x540518,_0x289526){_0x289526=_0x289526||0xcc;return function(_0x5b3ee9){if(_0x5b3ee9){return _0x540518[_0x2f94('0x13')](_0x289526);}return _0x540518['status'](_0x289526)[_0x2f94('0x14')]();};}function respondWithResult(_0x66626f,_0x58406c){_0x58406c=_0x58406c||0xc8;return function(_0xe2b477){if(_0xe2b477){return _0x66626f[_0x2f94('0x15')](_0x58406c)[_0x2f94('0x16')](_0xe2b477);}};}function respondWithFilteredResult(_0x14e6ea,_0x4828b5){return function(_0x5f4dc3){if(_0x5f4dc3){var _0x5a658f=typeof _0x4828b5[_0x2f94('0x17')]===_0x2f94('0x18')&&typeof _0x4828b5[_0x2f94('0x19')]==='undefined';var _0x594de0=_0x5f4dc3[_0x2f94('0x1a')];var _0xcde64b=_0x5a658f?0x0:_0x4828b5[_0x2f94('0x17')];var _0x1e4607=_0x5a658f?_0x5f4dc3['count']:_0x4828b5[_0x2f94('0x17')]+_0x4828b5['limit'];var _0x48875c;if(_0x1e4607>=_0x594de0){_0x1e4607=_0x594de0;_0x48875c=0xc8;}else{_0x48875c=0xce;}_0x14e6ea[_0x2f94('0x15')](_0x48875c);return _0x14e6ea[_0x2f94('0x1b')]('Content-Range',_0xcde64b+'-'+_0x1e4607+'/'+_0x594de0)[_0x2f94('0x16')](_0x5f4dc3);}return null;};}function patchUpdates(_0x5a4507){return function(_0x3f6d3d){try{jsonpatch['apply'](_0x3f6d3d,_0x5a4507,!![]);}catch(_0x55f39a){return BPromise[_0x2f94('0x1c')](_0x55f39a);}return _0x3f6d3d[_0x2f94('0x1d')]();};}function saveUpdates(_0x47cb11,_0x485b31){return function(_0xbfec1e){if(_0xbfec1e){return _0xbfec1e['update'](_0x47cb11)['then'](function(_0x4348c9){return _0x4348c9;});}return null;};}function removeEntity(_0x1e1a35,_0x3945ab){return function(_0x2f9303){if(_0x2f9303){return _0x2f9303['destroy']()[_0x2f94('0x1e')](function(){_0x1e1a35['status'](0xcc)[_0x2f94('0x14')]();});}};}function handleEntityNotFound(_0x246080,_0x252eac){return function(_0x54ea9a){if(!_0x54ea9a){_0x246080[_0x2f94('0x13')](0x194);}return _0x54ea9a;};}function handleError(_0x325fa4,_0x1eb548){_0x1eb548=_0x1eb548||0x1f4;return function(_0x5db88d){logger[_0x2f94('0x1f')](_0x5db88d[_0x2f94('0x20')]);if(_0x5db88d[_0x2f94('0x21')]){delete _0x5db88d[_0x2f94('0x21')];}_0x325fa4[_0x2f94('0x15')](_0x1eb548)[_0x2f94('0x22')](_0x5db88d);};}exports[_0x2f94('0x23')]=function(_0x307d0b,_0x21e704){var _0x8cee70={},_0x2593d1={},_0x4d653c={'count':0x0,'rows':[]};var _0x29816c=_[_0x2f94('0x24')](db[_0x2f94('0x25')]['rawAttributes'],function(_0x494810){return{'name':_0x494810[_0x2f94('0x26')],'type':_0x494810[_0x2f94('0x27')][_0x2f94('0x28')]};});_0x2593d1['model']=_['map'](_0x29816c,_0x2f94('0x21'));_0x2593d1[_0x2f94('0x29')]=_[_0x2f94('0x2a')](_0x307d0b[_0x2f94('0x29')]);_0x2593d1[_0x2f94('0x2b')]=_[_0x2f94('0x2c')](_0x2593d1[_0x2f94('0x2d')],_0x2593d1[_0x2f94('0x29')]);_0x8cee70[_0x2f94('0x2e')]=_[_0x2f94('0x2c')](_0x2593d1[_0x2f94('0x2d')],qs[_0x2f94('0x2f')](_0x307d0b['query'][_0x2f94('0x2f')]));_0x8cee70[_0x2f94('0x2e')]=_0x8cee70[_0x2f94('0x2e')]['length']?_0x8cee70[_0x2f94('0x2e')]:_0x2593d1[_0x2f94('0x2d')];if(!_0x307d0b[_0x2f94('0x29')][_0x2f94('0x30')](_0x2f94('0x31'))){_0x8cee70[_0x2f94('0x19')]=qs[_0x2f94('0x19')](_0x307d0b['query'][_0x2f94('0x19')]);_0x8cee70[_0x2f94('0x17')]=qs[_0x2f94('0x17')](_0x307d0b[_0x2f94('0x29')][_0x2f94('0x17')]);}_0x8cee70[_0x2f94('0x32')]=qs[_0x2f94('0x33')](_0x307d0b[_0x2f94('0x29')][_0x2f94('0x33')]);_0x8cee70['where']=qs[_0x2f94('0x2b')](_[_0x2f94('0x34')](_0x307d0b['query'],_0x2593d1[_0x2f94('0x2b')]),_0x29816c);if(_0x307d0b[_0x2f94('0x29')]['filter']){_0x8cee70[_0x2f94('0x35')]=_['merge'](_0x8cee70[_0x2f94('0x35')],{'$or':_[_0x2f94('0x24')](_0x29816c,function(_0x38fd8e){if(_0x38fd8e[_0x2f94('0x27')]!=='VIRTUAL'){var _0x114eff={};_0x114eff[_0x38fd8e[_0x2f94('0x21')]]={'$like':'%'+_0x307d0b[_0x2f94('0x29')][_0x2f94('0x36')]+'%'};return _0x114eff;}})});}_0x8cee70=_[_0x2f94('0x37')]({},_0x8cee70,_0x307d0b['options']);var _0x527ba1={'where':_0x8cee70[_0x2f94('0x35')]};return db[_0x2f94('0x25')][_0x2f94('0x1a')](_0x527ba1)['then'](function(_0x46adbf){_0x4d653c[_0x2f94('0x1a')]=_0x46adbf;if(_0x307d0b[_0x2f94('0x29')]['includeAll']){_0x8cee70[_0x2f94('0x38')]=[{'all':!![]}];}return db[_0x2f94('0x25')][_0x2f94('0x39')](_0x8cee70);})[_0x2f94('0x1e')](function(_0x1dadaf){_0x4d653c[_0x2f94('0x3a')]=_0x1dadaf;return _0x4d653c;})[_0x2f94('0x1e')](respondWithFilteredResult(_0x21e704,_0x8cee70))['catch'](handleError(_0x21e704,null));};exports[_0x2f94('0x3b')]=function(_0x57d560,_0x8dd839){var _0x1501ca={'raw':!![],'where':{'id':_0x57d560[_0x2f94('0x3c')]['id']}},_0x42a864={};_0x42a864[_0x2f94('0x2d')]=_[_0x2f94('0x2a')](db[_0x2f94('0x25')][_0x2f94('0x3d')]);_0x42a864[_0x2f94('0x29')]=_['keys'](_0x57d560[_0x2f94('0x29')]);_0x42a864['filters']=_[_0x2f94('0x2c')](_0x42a864['model'],_0x42a864['query']);_0x1501ca[_0x2f94('0x2e')]=_[_0x2f94('0x2c')](_0x42a864[_0x2f94('0x2d')],qs[_0x2f94('0x2f')](_0x57d560[_0x2f94('0x29')]['fields']));_0x1501ca[_0x2f94('0x2e')]=_0x1501ca[_0x2f94('0x2e')][_0x2f94('0x3e')]?_0x1501ca[_0x2f94('0x2e')]:_0x42a864[_0x2f94('0x2d')];if(_0x57d560[_0x2f94('0x29')][_0x2f94('0x3f')]){_0x1501ca[_0x2f94('0x38')]=[{'all':!![]}];}_0x1501ca=_[_0x2f94('0x37')]({},_0x1501ca,_0x57d560[_0x2f94('0x40')]);return db[_0x2f94('0x25')]['find'](_0x1501ca)[_0x2f94('0x1e')](handleEntityNotFound(_0x8dd839,null))[_0x2f94('0x1e')](respondWithResult(_0x8dd839,null))['catch'](handleError(_0x8dd839,null));};exports[_0x2f94('0x41')]=function(_0x1eafd8,_0x38139d){return db[_0x2f94('0x25')][_0x2f94('0x41')](_0x1eafd8[_0x2f94('0x42')],{})[_0x2f94('0x1e')](respondWithResult(_0x38139d,0xc9))[_0x2f94('0x43')](handleError(_0x38139d,null));};exports[_0x2f94('0x44')]=function(_0x1378ad,_0x4b8708){if(_0x1378ad['body']['id']){delete _0x1378ad[_0x2f94('0x42')]['id'];}return db[_0x2f94('0x25')][_0x2f94('0x45')]({'where':{'id':_0x1378ad[_0x2f94('0x3c')]['id']}})[_0x2f94('0x1e')](handleEntityNotFound(_0x4b8708,null))['then'](saveUpdates(_0x1378ad['body'],null))[_0x2f94('0x1e')](respondWithResult(_0x4b8708,null))[_0x2f94('0x43')](handleError(_0x4b8708,null));};exports[_0x2f94('0x46')]=function(_0x29689b,_0x3f7f03){return db['OpenchannelQueueReport'][_0x2f94('0x45')]({'where':{'id':_0x29689b[_0x2f94('0x3c')]['id']}})[_0x2f94('0x1e')](handleEntityNotFound(_0x3f7f03,null))[_0x2f94('0x1e')](removeEntity(_0x3f7f03,null))[_0x2f94('0x43')](handleError(_0x3f7f03,null));};exports[_0x2f94('0x47')]=function(_0x2c1f13,_0x4f0e7c){return db[_0x2f94('0x25')][_0x2f94('0x47')]()[_0x2f94('0x1e')](respondWithResult(_0x4f0e7c,null))[_0x2f94('0x43')](handleError(_0x4f0e7c,null));}; \ No newline at end of file +var _0x21f6=['name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/parsers/qs','../../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','save','update','then','destroy','end','error','stack'];(function(_0x3951e0,_0x2fa78){var _0x2da38e=function(_0x282f6a){while(--_0x282f6a){_0x3951e0['push'](_0x3951e0['shift']());}};_0x2da38e(++_0x2fa78);}(_0x21f6,0x199));var _0x621f=function(_0x5f01f2,_0x69bb43){_0x5f01f2=_0x5f01f2-0x0;var _0x724c18=_0x21f6[_0x5f01f2];return _0x724c18;};'use strict';var emlformat=require(_0x621f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x621f('0x1'));var jsonpatch=require(_0x621f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x621f('0x3'));var Mustache=require(_0x621f('0x4'));var util=require(_0x621f('0x5'));var path=require(_0x621f('0x6'));var sox=require(_0x621f('0x7'));var csv=require(_0x621f('0x8'));var ejs=require(_0x621f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x621f('0xa'));var squel=require(_0x621f('0xb'));var crypto=require('crypto');var jsforce=require(_0x621f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x621f('0x8'));var querystring=require('querystring');var Papa=require(_0x621f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x621f('0xe'));var as=require(_0x621f('0xf'));var hardwareService=require(_0x621f('0x10'));var logger=require(_0x621f('0x11'))(_0x621f('0x12'));var utils=require(_0x621f('0x13'));var config=require(_0x621f('0x14'));var licenseUtil=require(_0x621f('0x15'));var db=require(_0x621f('0x16'))['db'];function respondWithStatusCode(_0x152b25,_0x4f7fa0){_0x4f7fa0=_0x4f7fa0||0xcc;return function(_0x35e3f6){if(_0x35e3f6){return _0x152b25[_0x621f('0x17')](_0x4f7fa0);}return _0x152b25[_0x621f('0x18')](_0x4f7fa0)['end']();};}function respondWithResult(_0x507887,_0x3d739e){_0x3d739e=_0x3d739e||0xc8;return function(_0x2265db){if(_0x2265db){return _0x507887[_0x621f('0x18')](_0x3d739e)[_0x621f('0x19')](_0x2265db);}};}function respondWithFilteredResult(_0x54b1a9,_0xae9f7c){return function(_0x4fde94){if(_0x4fde94){var _0x71a30b=typeof _0xae9f7c[_0x621f('0x1a')]==='undefined'&&typeof _0xae9f7c[_0x621f('0x1b')]===_0x621f('0x1c');var _0x1237e6=_0x4fde94[_0x621f('0x1d')];var _0x54a255=_0x71a30b?0x0:_0xae9f7c[_0x621f('0x1a')];var _0x3d1b2e=_0x71a30b?_0x4fde94[_0x621f('0x1d')]:_0xae9f7c[_0x621f('0x1a')]+_0xae9f7c[_0x621f('0x1b')];var _0x210be9;if(_0x3d1b2e>=_0x1237e6){_0x3d1b2e=_0x1237e6;_0x210be9=0xc8;}else{_0x210be9=0xce;}_0x54b1a9['status'](_0x210be9);return _0x54b1a9[_0x621f('0x1e')](_0x621f('0x1f'),_0x54a255+'-'+_0x3d1b2e+'/'+_0x1237e6)[_0x621f('0x19')](_0x4fde94);}return null;};}function patchUpdates(_0x9734ed){return function(_0x4f0fbf){try{jsonpatch[_0x621f('0x20')](_0x4f0fbf,_0x9734ed,!![]);}catch(_0x32ad2b){return BPromise[_0x621f('0x21')](_0x32ad2b);}return _0x4f0fbf[_0x621f('0x22')]();};}function saveUpdates(_0x5c703a,_0x287f4d){return function(_0x428073){if(_0x428073){return _0x428073[_0x621f('0x23')](_0x5c703a)[_0x621f('0x24')](function(_0x2e52da){return _0x2e52da;});}return null;};}function removeEntity(_0x23a956,_0x166b8b){return function(_0x8ebce4){if(_0x8ebce4){return _0x8ebce4[_0x621f('0x25')]()['then'](function(){_0x23a956[_0x621f('0x18')](0xcc)[_0x621f('0x26')]();});}};}function handleEntityNotFound(_0x464dcc,_0x4d5409){return function(_0x53c54f){if(!_0x53c54f){_0x464dcc[_0x621f('0x17')](0x194);}return _0x53c54f;};}function handleError(_0x3f839f,_0x18c12d){_0x18c12d=_0x18c12d||0x1f4;return function(_0x3e95f8){logger[_0x621f('0x27')](_0x3e95f8[_0x621f('0x28')]);if(_0x3e95f8[_0x621f('0x29')]){delete _0x3e95f8['name'];}_0x3f839f[_0x621f('0x18')](_0x18c12d)[_0x621f('0x2a')](_0x3e95f8);};}exports[_0x621f('0x2b')]=function(_0x3283ca,_0x2e24f4){var _0x309479={},_0x277040={},_0x541b8b={'count':0x0,'rows':[]};var _0x4a8aa4=_[_0x621f('0x2c')](db[_0x621f('0x2d')][_0x621f('0x2e')],function(_0xfe02a0){return{'name':_0xfe02a0[_0x621f('0x2f')],'type':_0xfe02a0['type']['key']};});_0x277040[_0x621f('0x30')]=_[_0x621f('0x2c')](_0x4a8aa4,_0x621f('0x29'));_0x277040[_0x621f('0x31')]=_[_0x621f('0x32')](_0x3283ca[_0x621f('0x31')]);_0x277040[_0x621f('0x33')]=_['intersection'](_0x277040[_0x621f('0x30')],_0x277040['query']);_0x309479['attributes']=_[_0x621f('0x34')](_0x277040[_0x621f('0x30')],qs[_0x621f('0x35')](_0x3283ca[_0x621f('0x31')][_0x621f('0x35')]));_0x309479[_0x621f('0x36')]=_0x309479[_0x621f('0x36')][_0x621f('0x37')]?_0x309479[_0x621f('0x36')]:_0x277040['model'];if(!_0x3283ca['query'][_0x621f('0x38')]('nolimit')){_0x309479['limit']=qs[_0x621f('0x1b')](_0x3283ca[_0x621f('0x31')]['limit']);_0x309479[_0x621f('0x1a')]=qs[_0x621f('0x1a')](_0x3283ca[_0x621f('0x31')]['offset']);}_0x309479[_0x621f('0x39')]=qs[_0x621f('0x3a')](_0x3283ca[_0x621f('0x31')][_0x621f('0x3a')]);_0x309479['where']=qs[_0x621f('0x33')](_['pick'](_0x3283ca[_0x621f('0x31')],_0x277040[_0x621f('0x33')]),_0x4a8aa4);if(_0x3283ca[_0x621f('0x31')][_0x621f('0x3b')]){_0x309479[_0x621f('0x3c')]=_['merge'](_0x309479[_0x621f('0x3c')],{'$or':_['map'](_0x4a8aa4,function(_0x1ad4ed){if(_0x1ad4ed[_0x621f('0x3d')]!==_0x621f('0x3e')){var _0x1aca89={};_0x1aca89[_0x1ad4ed[_0x621f('0x29')]]={'$like':'%'+_0x3283ca[_0x621f('0x31')][_0x621f('0x3b')]+'%'};return _0x1aca89;}})});}_0x309479=_[_0x621f('0x3f')]({},_0x309479,_0x3283ca[_0x621f('0x40')]);var _0x1600f9={'where':_0x309479[_0x621f('0x3c')]};return db[_0x621f('0x2d')][_0x621f('0x1d')](_0x1600f9)[_0x621f('0x24')](function(_0x391d9d){_0x541b8b[_0x621f('0x1d')]=_0x391d9d;if(_0x3283ca['query'][_0x621f('0x41')]){_0x309479[_0x621f('0x42')]=[{'all':!![]}];}return db[_0x621f('0x2d')][_0x621f('0x43')](_0x309479);})[_0x621f('0x24')](function(_0x1e8387){_0x541b8b[_0x621f('0x44')]=_0x1e8387;return _0x541b8b;})[_0x621f('0x24')](respondWithFilteredResult(_0x2e24f4,_0x309479))['catch'](handleError(_0x2e24f4,null));};exports[_0x621f('0x45')]=function(_0x23185a,_0x5928bc){var _0x31ca8e={'raw':!![],'where':{'id':_0x23185a[_0x621f('0x46')]['id']}},_0x46e683={};_0x46e683[_0x621f('0x30')]=_[_0x621f('0x32')](db[_0x621f('0x2d')][_0x621f('0x2e')]);_0x46e683[_0x621f('0x31')]=_[_0x621f('0x32')](_0x23185a['query']);_0x46e683[_0x621f('0x33')]=_[_0x621f('0x34')](_0x46e683[_0x621f('0x30')],_0x46e683[_0x621f('0x31')]);_0x31ca8e[_0x621f('0x36')]=_[_0x621f('0x34')](_0x46e683[_0x621f('0x30')],qs[_0x621f('0x35')](_0x23185a['query']['fields']));_0x31ca8e[_0x621f('0x36')]=_0x31ca8e[_0x621f('0x36')]['length']?_0x31ca8e[_0x621f('0x36')]:_0x46e683[_0x621f('0x30')];if(_0x23185a[_0x621f('0x31')]['includeAll']){_0x31ca8e[_0x621f('0x42')]=[{'all':!![]}];}_0x31ca8e=_[_0x621f('0x3f')]({},_0x31ca8e,_0x23185a[_0x621f('0x40')]);return db[_0x621f('0x2d')]['find'](_0x31ca8e)[_0x621f('0x24')](handleEntityNotFound(_0x5928bc,null))[_0x621f('0x24')](respondWithResult(_0x5928bc,null))[_0x621f('0x47')](handleError(_0x5928bc,null));};exports[_0x621f('0x48')]=function(_0x157cfd,_0x262e4f){return db[_0x621f('0x2d')][_0x621f('0x48')](_0x157cfd[_0x621f('0x49')],{})[_0x621f('0x24')](respondWithResult(_0x262e4f,0xc9))[_0x621f('0x47')](handleError(_0x262e4f,null));};exports[_0x621f('0x23')]=function(_0x2b0b46,_0x454f8e){if(_0x2b0b46[_0x621f('0x49')]['id']){delete _0x2b0b46[_0x621f('0x49')]['id'];}return db[_0x621f('0x2d')][_0x621f('0x4a')]({'where':{'id':_0x2b0b46[_0x621f('0x46')]['id']}})[_0x621f('0x24')](handleEntityNotFound(_0x454f8e,null))[_0x621f('0x24')](saveUpdates(_0x2b0b46[_0x621f('0x49')],null))[_0x621f('0x24')](respondWithResult(_0x454f8e,null))[_0x621f('0x47')](handleError(_0x454f8e,null));};exports[_0x621f('0x25')]=function(_0x57152e,_0x1b9140){return db[_0x621f('0x2d')][_0x621f('0x4a')]({'where':{'id':_0x57152e[_0x621f('0x46')]['id']}})[_0x621f('0x24')](handleEntityNotFound(_0x1b9140,null))[_0x621f('0x24')](removeEntity(_0x1b9140,null))[_0x621f('0x47')](handleError(_0x1b9140,null));};exports['describe']=function(_0x47ad0a,_0x5f36ba){return db[_0x621f('0x2d')]['describe']()[_0x621f('0x24')](respondWithResult(_0x5f36ba,null))[_0x621f('0x47')](handleError(_0x5f36ba,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index f0badad..351a47b 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x585b47,_0x1d322b){var _0x53519b=function(_0x54b398){while(--_0x54b398){_0x585b47['push'](_0x585b47['shift']());}};_0x53519b(++_0x1d322b);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c44cc,_0x55f84e){_0x4c44cc=_0x4c44cc-0x0;var _0x366fc1=_0x2ef3[_0x4c44cc];return _0x366fc1;};'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 +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x360735,_0x19bd01){var _0x271b6f=function(_0x2dc59d){while(--_0x2dc59d){_0x360735['push'](_0x360735['shift']());}};_0x271b6f(++_0x19bd01);}(_0xe14b,0x93));var _0xbe14=function(_0x14afaf,_0x1ae7d8){_0x14afaf=_0x14afaf-0x0;var _0x321165=_0xe14b[_0x14afaf];return _0x321165;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index b70f42a..4e6841f 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 _0x0e56=['OpenchannelQueueReport','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','body','options'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x0e56,0xf5));var _0x60e5=function(_0x533437,_0x4d59d1){_0x533437=_0x533437-0x0;var _0x53f4ce=_0x0e56[_0x533437];return _0x53f4ce;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b44b9,_0x5513f2,_0x31765c){return new BPromise(function(_0x3083a0,_0x59389e){return client[_0x60e5('0xb')](_0x1b44b9,_0x31765c)[_0x60e5('0xc')](function(_0x46d531){logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,_0x60e5('0xf'));logger[_0x60e5('0x10')](_0x60e5('0x11'),_0x5513f2,_0x60e5('0xf'),JSON[_0x60e5('0x12')](_0x46d531));if(_0x46d531[_0x60e5('0x13')]){if(_0x46d531[_0x60e5('0x13')][_0x60e5('0x14')]===0x1f4){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x59389e(_0x46d531[_0x60e5('0x13')]['message']);}logger['error'](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x3083a0(_0x46d531[_0x60e5('0x13')][_0x60e5('0x15')]);}else{logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,'request\x20sent');_0x3083a0(_0x46d531[_0x60e5('0x16')][_0x60e5('0x15')]);}})[_0x60e5('0x17')](function(_0x1ed08d){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x1ed08d);_0x59389e(_0x1ed08d);});});}exports[_0x60e5('0x18')]=function(_0x12aee7){var _0x3060b6=this;return new Promise(function(_0x51688a,_0x599dc4){return db['OpenchannelQueueReport']['create'](_0x12aee7[_0x60e5('0x19')],{'raw':_0x12aee7[_0x60e5('0x1a')]?_0x12aee7[_0x60e5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x60e5('0xc')](function(_0x68c78){logger[_0x60e5('0xd')](_0x60e5('0x18'),_0x12aee7);logger[_0x60e5('0x10')](_0x60e5('0x18'),_0x12aee7,JSON[_0x60e5('0x12')](_0x68c78));_0x51688a(_0x68c78);})[_0x60e5('0x17')](function(_0x443665){logger[_0x60e5('0x13')](_0x60e5('0x18'),_0x443665['message'],_0x12aee7);_0x599dc4(_0x3060b6['error'](0x1f4,_0x443665[_0x60e5('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5a2b4d){var _0x2c692d=this;return new Promise(function(_0x58e43b,_0x200da3){return db[_0x60e5('0x1b')][_0x60e5('0x1c')](_0x5a2b4d[_0x60e5('0x19')],{'raw':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2b4d['options']?_0x5a2b4d[_0x60e5('0x1a')][_0x60e5('0x1e')]||null:null,'attributes':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x1f')]||null:null,'limit':_0x5a2b4d[_0x60e5('0x1a')]?_0x5a2b4d['options'][_0x60e5('0x20')]||null:null})[_0x60e5('0xc')](function(_0x46ebed){logger['info'](_0x60e5('0x21'),_0x5a2b4d);logger[_0x60e5('0x10')](_0x60e5('0x21'),_0x5a2b4d,JSON[_0x60e5('0x12')](_0x46ebed));_0x58e43b(_0x46ebed);})[_0x60e5('0x17')](function(_0x40ce94){logger[_0x60e5('0x13')](_0x60e5('0x21'),_0x40ce94[_0x60e5('0x15')],_0x5a2b4d);_0x200da3(_0x2c692d[_0x60e5('0x13')](0x1f4,_0x40ce94[_0x60e5('0x15')]));});});}; \ No newline at end of file +var _0x49f8=['client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','then','stringify','update','raw','where','limit','UpdateOpenchannelQueueReport','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x2c347a,_0x320ac4){var _0x1520f8=function(_0x5779be){while(--_0x5779be){_0x2c347a['push'](_0x2c347a['shift']());}};_0x1520f8(++_0x320ac4);}(_0x49f8,0xff));var _0x849f=function(_0x17ee38,_0x5bdff4){_0x17ee38=_0x17ee38-0x0;var _0x439a4e=_0x49f8[_0x17ee38];return _0x439a4e;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['create'](_0x20bea7[_0x849f('0x14')],{'raw':_0x20bea7[_0x849f('0x15')]?_0x20bea7['options']['raw']===undefined?!![]:![]:!![]})[_0x849f('0x16')](function(_0x11d183){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x17')](_0x11d183));_0x541cd6(_0x11d183);})[_0x849f('0x11')](function(_0x4b29f1){logger[_0x849f('0xd')](_0x849f('0x12'),_0x4b29f1[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529[_0x849f('0xd')](0x1f4,_0x4b29f1[_0x849f('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3a5724){var _0x32be69=this;return new Promise(function(_0x15a41c,_0xe404c6){return db[_0x849f('0x13')][_0x849f('0x18')](_0x3a5724[_0x849f('0x14')],{'raw':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1a')]||null:null,'attributes':_0x3a5724['options']?_0x3a5724[_0x849f('0x15')]['attributes']||null:null,'limit':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1b')]||null:null})[_0x849f('0x16')](function(_0xf0e21f){logger[_0x849f('0x8')]('UpdateOpenchannelQueueReport',_0x3a5724);logger[_0x849f('0xb')](_0x849f('0x1c'),_0x3a5724,JSON[_0x849f('0x17')](_0xf0e21f));_0x15a41c(_0xf0e21f);})['catch'](function(_0x347c93){logger['error'](_0x849f('0x1c'),_0x347c93[_0x849f('0xf')],_0x3a5724);_0xe404c6(_0x32be69[_0x849f('0xd')](0x1f4,_0x347c93[_0x849f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8672c76..feba363 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 _0x2684=['express','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x324af1,_0x1c341d){var _0x43ce71=function(_0x5e6734){while(--_0x5e6734){_0x324af1['push'](_0x324af1['shift']());}};_0x43ce71(++_0x1c341d);}(_0x2684,0x1dc));var _0x4268=function(_0x45b827,_0x5b42a5){_0x45b827=_0x45b827-0x0;var _0x340cab=_0x2684[_0x45b827];return _0x340cab;};'use strict';var multer=require(_0x4268('0x0'));var util=require(_0x4268('0x1'));var path=require(_0x4268('0x2'));var timeout=require(_0x4268('0x3'));var express=require(_0x4268('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4268('0x5'));var config=require(_0x4268('0x6'));var controller=require(_0x4268('0x7'));router[_0x4268('0x8')]('/',auth[_0x4268('0x9')](),controller[_0x4268('0xa')]);router[_0x4268('0x8')](_0x4268('0xb'),auth['isAuthenticated'](),controller[_0x4268('0xc')]);router[_0x4268('0x8')](_0x4268('0xd'),auth['isAuthenticated'](),controller[_0x4268('0xe')]);router[_0x4268('0xf')]('/',auth[_0x4268('0x9')](),controller['create']);router[_0x4268('0x10')](_0x4268('0xd'),auth[_0x4268('0x9')](),controller[_0x4268('0x11')]);router[_0x4268('0x12')](_0x4268('0xd'),auth[_0x4268('0x9')](),controller['destroy']);module[_0x4268('0x13')]=router; \ No newline at end of file +var _0x230f=['get','/:id','create','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','describe'];(function(_0xcee512,_0x687e2b){var _0x222da6=function(_0x65ce4d){while(--_0x65ce4d){_0xcee512['push'](_0xcee512['shift']());}};_0x222da6(++_0x687e2b);}(_0x230f,0x1a9));var _0xf230=function(_0x2f89c0,_0x455702){_0x2f89c0=_0x2f89c0-0x0;var _0x164223=_0x230f[_0x2f89c0];return _0x164223;};'use strict';var multer=require(_0xf230('0x0'));var util=require(_0xf230('0x1'));var path=require(_0xf230('0x2'));var timeout=require(_0xf230('0x3'));var express=require(_0xf230('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf230('0x5'));var interaction=require(_0xf230('0x6'));var config=require('../../config/environment');var controller=require(_0xf230('0x7'));router['get']('/',auth[_0xf230('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xf230('0x9')]);router[_0xf230('0xa')](_0xf230('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf230('0xc')]);router['put']('/:id',auth[_0xf230('0x8')](),controller['update']);router[_0xf230('0xd')](_0xf230('0xb'),auth[_0xf230('0x8')](),controller['destroy']);module[_0xf230('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 73884f5..83f8d51 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x50b52f,_0x44861d){var _0x1dfbdb=function(_0x33dafc){while(--_0x33dafc){_0x50b52f['push'](_0x50b52f['shift']());}};_0x1dfbdb(++_0x44861d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9bde,0xe1));var _0xe9bd=function(_0x203c9f,_0x18cd59){_0x203c9f=_0x203c9f-0x0;var _0x2e9db8=_0x9bde[_0x203c9f];return _0x2e9db8;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c287b0a..9fa2c1e 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 _0x3d3e=['OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','VIRTUAL','merge','options','then','includeAll','include','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3d3e,0x155));var _0xe3d3=function(_0x2e3ca2,_0x207015){_0x2e3ca2=_0x2e3ca2-0x0;var _0x13b0c9=_0x3d3e[_0x2e3ca2];return _0x13b0c9;};'use strict';var emlformat=require(_0xe3d3('0x0'));var rimraf=require(_0xe3d3('0x1'));var zipdir=require(_0xe3d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3d3('0x3'));var moment=require(_0xe3d3('0x4'));var BPromise=require(_0xe3d3('0x5'));var Mustache=require(_0xe3d3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe3d3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3d3('0x8'));var _=require(_0xe3d3('0x9'));var squel=require(_0xe3d3('0xa'));var crypto=require(_0xe3d3('0xb'));var jsforce=require(_0xe3d3('0xc'));var deskjs=require(_0xe3d3('0xd'));var toCsv=require(_0xe3d3('0xe'));var querystring=require(_0xe3d3('0xf'));var Papa=require(_0xe3d3('0x10'));var Redis=require(_0xe3d3('0x11'));var authService=require(_0xe3d3('0x12'));var qs=require(_0xe3d3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3d3('0x14'))(_0xe3d3('0x15'));var utils=require(_0xe3d3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe3d3('0x17'));var db=require(_0xe3d3('0x18'))['db'];function respondWithStatusCode(_0x498351,_0x55b323){_0x55b323=_0x55b323||0xcc;return function(_0x1343ec){if(_0x1343ec){return _0x498351[_0xe3d3('0x19')](_0x55b323);}return _0x498351[_0xe3d3('0x1a')](_0x55b323)[_0xe3d3('0x1b')]();};}function respondWithResult(_0x3b2425,_0x5d134a){_0x5d134a=_0x5d134a||0xc8;return function(_0x99b348){if(_0x99b348){return _0x3b2425[_0xe3d3('0x1a')](_0x5d134a)[_0xe3d3('0x1c')](_0x99b348);}};}function respondWithFilteredResult(_0x5ea506,_0x5c87c3){return function(_0x54c940){if(_0x54c940){var _0xbe5a3b=typeof _0x5c87c3['offset']==='undefined'&&typeof _0x5c87c3['limit']===_0xe3d3('0x1d');var _0x25734e=_0x54c940[_0xe3d3('0x1e')];var _0x4b9463=_0xbe5a3b?0x0:_0x5c87c3['offset'];var _0x107aa1=_0xbe5a3b?_0x54c940[_0xe3d3('0x1e')]:_0x5c87c3['offset']+_0x5c87c3[_0xe3d3('0x1f')];var _0x553667;if(_0x107aa1>=_0x25734e){_0x107aa1=_0x25734e;_0x553667=0xc8;}else{_0x553667=0xce;}_0x5ea506[_0xe3d3('0x1a')](_0x553667);return _0x5ea506[_0xe3d3('0x20')](_0xe3d3('0x21'),_0x4b9463+'-'+_0x107aa1+'/'+_0x25734e)['json'](_0x54c940);}return null;};}function patchUpdates(_0xa93233){return function(_0xd4bc5f){try{jsonpatch[_0xe3d3('0x22')](_0xd4bc5f,_0xa93233,!![]);}catch(_0x3f430e){return BPromise[_0xe3d3('0x23')](_0x3f430e);}return _0xd4bc5f['save']();};}function saveUpdates(_0x4ca764,_0xe3faa8){return function(_0x1a8b24){if(_0x1a8b24){return _0x1a8b24[_0xe3d3('0x24')](_0x4ca764)['then'](function(_0x126615){return _0x126615;});}return null;};}function removeEntity(_0xf363d1,_0x43c88c){return function(_0x4d4d62){if(_0x4d4d62){return _0x4d4d62[_0xe3d3('0x25')]()['then'](function(){_0xf363d1[_0xe3d3('0x1a')](0xcc)[_0xe3d3('0x1b')]();});}};}function handleEntityNotFound(_0x139068,_0x4e5b08){return function(_0x1e0caf){if(!_0x1e0caf){_0x139068[_0xe3d3('0x19')](0x194);}return _0x1e0caf;};}function handleError(_0x1e73fe,_0x471a00){_0x471a00=_0x471a00||0x1f4;return function(_0x1ed21a){logger[_0xe3d3('0x26')](_0x1ed21a[_0xe3d3('0x27')]);if(_0x1ed21a[_0xe3d3('0x28')]){delete _0x1ed21a['name'];}_0x1e73fe[_0xe3d3('0x1a')](_0x471a00)[_0xe3d3('0x29')](_0x1ed21a);};}exports[_0xe3d3('0x2a')]=function(_0x5102a2,_0x4e8908){var _0x512b5d={},_0x2d085f={},_0x4e5c2a={'count':0x0,'rows':[]};var _0x18f54e=_[_0xe3d3('0x2b')](db[_0xe3d3('0x2c')][_0xe3d3('0x2d')],function(_0x5f303a){return{'name':_0x5f303a[_0xe3d3('0x2e')],'type':_0x5f303a[_0xe3d3('0x2f')][_0xe3d3('0x30')]};});_0x2d085f[_0xe3d3('0x31')]=_[_0xe3d3('0x2b')](_0x18f54e,_0xe3d3('0x28'));_0x2d085f[_0xe3d3('0x32')]=_[_0xe3d3('0x33')](_0x5102a2[_0xe3d3('0x32')]);_0x2d085f[_0xe3d3('0x34')]=_['intersection'](_0x2d085f[_0xe3d3('0x31')],_0x2d085f[_0xe3d3('0x32')]);_0x512b5d[_0xe3d3('0x35')]=_[_0xe3d3('0x36')](_0x2d085f[_0xe3d3('0x31')],qs[_0xe3d3('0x37')](_0x5102a2[_0xe3d3('0x32')]['fields']));_0x512b5d[_0xe3d3('0x35')]=_0x512b5d[_0xe3d3('0x35')][_0xe3d3('0x38')]?_0x512b5d[_0xe3d3('0x35')]:_0x2d085f['model'];if(!_0x5102a2[_0xe3d3('0x32')][_0xe3d3('0x39')](_0xe3d3('0x3a'))){_0x512b5d[_0xe3d3('0x1f')]=qs['limit'](_0x5102a2[_0xe3d3('0x32')]['limit']);_0x512b5d[_0xe3d3('0x3b')]=qs[_0xe3d3('0x3b')](_0x5102a2[_0xe3d3('0x32')][_0xe3d3('0x3b')]);}_0x512b5d[_0xe3d3('0x3c')]=qs[_0xe3d3('0x3d')](_0x5102a2[_0xe3d3('0x32')][_0xe3d3('0x3d')]);_0x512b5d['where']=qs['filters'](_[_0xe3d3('0x3e')](_0x5102a2[_0xe3d3('0x32')],_0x2d085f['filters']),_0x18f54e);if(_0x5102a2[_0xe3d3('0x32')][_0xe3d3('0x3f')]){_0x512b5d['where']=_['merge'](_0x512b5d['where'],{'$or':_[_0xe3d3('0x2b')](_0x18f54e,function(_0x2567c6){if(_0x2567c6['type']!==_0xe3d3('0x40')){var _0x312a82={};_0x312a82[_0x2567c6[_0xe3d3('0x28')]]={'$like':'%'+_0x5102a2[_0xe3d3('0x32')][_0xe3d3('0x3f')]+'%'};return _0x312a82;}})});}_0x512b5d=_[_0xe3d3('0x41')]({},_0x512b5d,_0x5102a2[_0xe3d3('0x42')]);var _0x3b7562={'where':_0x512b5d['where']};return db[_0xe3d3('0x2c')][_0xe3d3('0x1e')](_0x3b7562)[_0xe3d3('0x43')](function(_0xa9eaf0){_0x4e5c2a[_0xe3d3('0x1e')]=_0xa9eaf0;if(_0x5102a2['query'][_0xe3d3('0x44')]){_0x512b5d[_0xe3d3('0x45')]=[{'all':!![]}];}return db[_0xe3d3('0x2c')]['findAll'](_0x512b5d);})[_0xe3d3('0x43')](function(_0x509e49){_0x4e5c2a[_0xe3d3('0x46')]=_0x509e49;return _0x4e5c2a;})['then'](respondWithFilteredResult(_0x4e8908,_0x512b5d))['catch'](handleError(_0x4e8908,null));};exports['show']=function(_0x39202a,_0x4913dd){var _0xacf3d4={'raw':!![],'where':{'id':_0x39202a[_0xe3d3('0x47')]['id']}},_0x548422={};_0x548422[_0xe3d3('0x31')]=_[_0xe3d3('0x33')](db[_0xe3d3('0x2c')][_0xe3d3('0x2d')]);_0x548422[_0xe3d3('0x32')]=_[_0xe3d3('0x33')](_0x39202a[_0xe3d3('0x32')]);_0x548422[_0xe3d3('0x34')]=_[_0xe3d3('0x36')](_0x548422[_0xe3d3('0x31')],_0x548422[_0xe3d3('0x32')]);_0xacf3d4['attributes']=_[_0xe3d3('0x36')](_0x548422[_0xe3d3('0x31')],qs['fields'](_0x39202a['query']['fields']));_0xacf3d4[_0xe3d3('0x35')]=_0xacf3d4['attributes'][_0xe3d3('0x38')]?_0xacf3d4['attributes']:_0x548422[_0xe3d3('0x31')];if(_0x39202a[_0xe3d3('0x32')][_0xe3d3('0x44')]){_0xacf3d4[_0xe3d3('0x45')]=[{'all':!![]}];}_0xacf3d4=_[_0xe3d3('0x41')]({},_0xacf3d4,_0x39202a[_0xe3d3('0x42')]);return db[_0xe3d3('0x2c')][_0xe3d3('0x48')](_0xacf3d4)[_0xe3d3('0x43')](handleEntityNotFound(_0x4913dd,null))[_0xe3d3('0x43')](respondWithResult(_0x4913dd,null))[_0xe3d3('0x49')](handleError(_0x4913dd,null));};exports[_0xe3d3('0x4a')]=function(_0xe1486d,_0x5d6041){return db['OpenchannelTransferReport'][_0xe3d3('0x4a')](_0xe1486d['body'],{})[_0xe3d3('0x43')](respondWithResult(_0x5d6041,0xc9))[_0xe3d3('0x49')](handleError(_0x5d6041,null));};exports['update']=function(_0x1b0e55,_0xa4c513){if(_0x1b0e55['body']['id']){delete _0x1b0e55[_0xe3d3('0x4b')]['id'];}return db[_0xe3d3('0x2c')]['find']({'where':{'id':_0x1b0e55[_0xe3d3('0x47')]['id']}})[_0xe3d3('0x43')](handleEntityNotFound(_0xa4c513,null))[_0xe3d3('0x43')](saveUpdates(_0x1b0e55[_0xe3d3('0x4b')],null))[_0xe3d3('0x43')](respondWithResult(_0xa4c513,null))[_0xe3d3('0x49')](handleError(_0xa4c513,null));};exports[_0xe3d3('0x25')]=function(_0x124b4c,_0x373aa9){return db[_0xe3d3('0x2c')]['find']({'where':{'id':_0x124b4c[_0xe3d3('0x47')]['id']}})[_0xe3d3('0x43')](handleEntityNotFound(_0x373aa9,null))[_0xe3d3('0x43')](removeEntity(_0x373aa9,null))[_0xe3d3('0x49')](handleError(_0x373aa9,null));};exports[_0xe3d3('0x4c')]=function(_0x843399,_0x326b58){return db[_0xe3d3('0x2c')]['describe']()[_0xe3d3('0x43')](respondWithResult(_0x326b58,null))[_0xe3d3('0x49')](handleError(_0x326b58,null));}; \ No newline at end of file +var _0xee1b=['findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include'];(function(_0x532338,_0x1fec4a){var _0x2dbd0d=function(_0x102a3f){while(--_0x102a3f){_0x532338['push'](_0x532338['shift']());}};_0x2dbd0d(++_0x1fec4a);}(_0xee1b,0x129));var _0xbee1=function(_0x142883,_0x5e2a69){_0x142883=_0x142883-0x0;var _0x40ec08=_0xee1b[_0x142883];return _0x40ec08;};'use strict';var emlformat=require(_0xbee1('0x0'));var rimraf=require(_0xbee1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbee1('0x2'));var rp=require(_0xbee1('0x3'));var moment=require(_0xbee1('0x4'));var BPromise=require(_0xbee1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbee1('0x6'));var sox=require(_0xbee1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbee1('0x8'));var _=require(_0xbee1('0x9'));var squel=require(_0xbee1('0xa'));var crypto=require(_0xbee1('0xb'));var jsforce=require(_0xbee1('0xc'));var deskjs=require(_0xbee1('0xd'));var toCsv=require(_0xbee1('0xe'));var querystring=require('querystring');var Papa=require(_0xbee1('0xf'));var Redis=require(_0xbee1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbee1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbee1('0x12'))('api');var utils=require(_0xbee1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbee1('0x14'));var db=require(_0xbee1('0x15'))['db'];function respondWithStatusCode(_0x6e84bd,_0x19571c){_0x19571c=_0x19571c||0xcc;return function(_0x1b51e0){if(_0x1b51e0){return _0x6e84bd['sendStatus'](_0x19571c);}return _0x6e84bd[_0xbee1('0x16')](_0x19571c)[_0xbee1('0x17')]();};}function respondWithResult(_0x132467,_0x5543af){_0x5543af=_0x5543af||0xc8;return function(_0x528809){if(_0x528809){return _0x132467[_0xbee1('0x16')](_0x5543af)['json'](_0x528809);}};}function respondWithFilteredResult(_0x2ef406,_0x15569e){return function(_0x4179d7){if(_0x4179d7){var _0x1a4753=typeof _0x15569e[_0xbee1('0x18')]==='undefined'&&typeof _0x15569e[_0xbee1('0x19')]===_0xbee1('0x1a');var _0x17528d=_0x4179d7['count'];var _0x16a143=_0x1a4753?0x0:_0x15569e[_0xbee1('0x18')];var _0x55cfb4=_0x1a4753?_0x4179d7[_0xbee1('0x1b')]:_0x15569e[_0xbee1('0x18')]+_0x15569e[_0xbee1('0x19')];var _0xd7bd29;if(_0x55cfb4>=_0x17528d){_0x55cfb4=_0x17528d;_0xd7bd29=0xc8;}else{_0xd7bd29=0xce;}_0x2ef406[_0xbee1('0x16')](_0xd7bd29);return _0x2ef406[_0xbee1('0x1c')]('Content-Range',_0x16a143+'-'+_0x55cfb4+'/'+_0x17528d)[_0xbee1('0x1d')](_0x4179d7);}return null;};}function patchUpdates(_0x575f91){return function(_0x1ef51a){try{jsonpatch[_0xbee1('0x1e')](_0x1ef51a,_0x575f91,!![]);}catch(_0x43da8c){return BPromise[_0xbee1('0x1f')](_0x43da8c);}return _0x1ef51a[_0xbee1('0x20')]();};}function saveUpdates(_0x4ac918,_0xa3db4e){return function(_0x1c372c){if(_0x1c372c){return _0x1c372c[_0xbee1('0x21')](_0x4ac918)['then'](function(_0x5e6dee){return _0x5e6dee;});}return null;};}function removeEntity(_0x3bb53d,_0x575b42){return function(_0x5a27eb){if(_0x5a27eb){return _0x5a27eb[_0xbee1('0x22')]()[_0xbee1('0x23')](function(){_0x3bb53d['status'](0xcc)[_0xbee1('0x17')]();});}};}function handleEntityNotFound(_0x29035e,_0x275c3b){return function(_0x122fa4){if(!_0x122fa4){_0x29035e['sendStatus'](0x194);}return _0x122fa4;};}function handleError(_0x1ada09,_0x42014b){_0x42014b=_0x42014b||0x1f4;return function(_0x45986a){logger[_0xbee1('0x24')](_0x45986a[_0xbee1('0x25')]);if(_0x45986a['name']){delete _0x45986a[_0xbee1('0x26')];}_0x1ada09[_0xbee1('0x16')](_0x42014b)[_0xbee1('0x27')](_0x45986a);};}exports['index']=function(_0x2360a1,_0x126afb){var _0x573b8f={},_0x50a1cc={},_0x56eb2b={'count':0x0,'rows':[]};var _0x11206e=_[_0xbee1('0x28')](db['OpenchannelTransferReport'][_0xbee1('0x29')],function(_0x18f961){return{'name':_0x18f961['fieldName'],'type':_0x18f961[_0xbee1('0x2a')][_0xbee1('0x2b')]};});_0x50a1cc[_0xbee1('0x2c')]=_[_0xbee1('0x28')](_0x11206e,_0xbee1('0x26'));_0x50a1cc['query']=_[_0xbee1('0x2d')](_0x2360a1['query']);_0x50a1cc[_0xbee1('0x2e')]=_[_0xbee1('0x2f')](_0x50a1cc['model'],_0x50a1cc[_0xbee1('0x30')]);_0x573b8f[_0xbee1('0x31')]=_[_0xbee1('0x2f')](_0x50a1cc[_0xbee1('0x2c')],qs[_0xbee1('0x32')](_0x2360a1[_0xbee1('0x30')][_0xbee1('0x32')]));_0x573b8f[_0xbee1('0x31')]=_0x573b8f[_0xbee1('0x31')][_0xbee1('0x33')]?_0x573b8f[_0xbee1('0x31')]:_0x50a1cc[_0xbee1('0x2c')];if(!_0x2360a1[_0xbee1('0x30')]['hasOwnProperty'](_0xbee1('0x34'))){_0x573b8f[_0xbee1('0x19')]=qs[_0xbee1('0x19')](_0x2360a1[_0xbee1('0x30')][_0xbee1('0x19')]);_0x573b8f['offset']=qs['offset'](_0x2360a1[_0xbee1('0x30')]['offset']);}_0x573b8f[_0xbee1('0x35')]=qs['sort'](_0x2360a1[_0xbee1('0x30')]['sort']);_0x573b8f[_0xbee1('0x36')]=qs[_0xbee1('0x2e')](_[_0xbee1('0x37')](_0x2360a1[_0xbee1('0x30')],_0x50a1cc[_0xbee1('0x2e')]),_0x11206e);if(_0x2360a1[_0xbee1('0x30')][_0xbee1('0x38')]){_0x573b8f[_0xbee1('0x36')]=_[_0xbee1('0x39')](_0x573b8f[_0xbee1('0x36')],{'$or':_[_0xbee1('0x28')](_0x11206e,function(_0x141734){if(_0x141734['type']!==_0xbee1('0x3a')){var _0x4fe541={};_0x4fe541[_0x141734[_0xbee1('0x26')]]={'$like':'%'+_0x2360a1[_0xbee1('0x30')][_0xbee1('0x38')]+'%'};return _0x4fe541;}})});}_0x573b8f=_[_0xbee1('0x39')]({},_0x573b8f,_0x2360a1[_0xbee1('0x3b')]);var _0x37cc9b={'where':_0x573b8f[_0xbee1('0x36')]};return db[_0xbee1('0x3c')][_0xbee1('0x1b')](_0x37cc9b)['then'](function(_0x1ad143){_0x56eb2b[_0xbee1('0x1b')]=_0x1ad143;if(_0x2360a1[_0xbee1('0x30')][_0xbee1('0x3d')]){_0x573b8f[_0xbee1('0x3e')]=[{'all':!![]}];}return db[_0xbee1('0x3c')][_0xbee1('0x3f')](_0x573b8f);})[_0xbee1('0x23')](function(_0x44b28f){_0x56eb2b[_0xbee1('0x40')]=_0x44b28f;return _0x56eb2b;})[_0xbee1('0x23')](respondWithFilteredResult(_0x126afb,_0x573b8f))[_0xbee1('0x41')](handleError(_0x126afb,null));};exports[_0xbee1('0x42')]=function(_0xb8d179,_0x62c175){var _0x5bf2f1={'raw':!![],'where':{'id':_0xb8d179[_0xbee1('0x43')]['id']}},_0x1ff1c9={};_0x1ff1c9['model']=_['keys'](db[_0xbee1('0x3c')][_0xbee1('0x29')]);_0x1ff1c9['query']=_[_0xbee1('0x2d')](_0xb8d179['query']);_0x1ff1c9['filters']=_['intersection'](_0x1ff1c9[_0xbee1('0x2c')],_0x1ff1c9[_0xbee1('0x30')]);_0x5bf2f1[_0xbee1('0x31')]=_[_0xbee1('0x2f')](_0x1ff1c9[_0xbee1('0x2c')],qs[_0xbee1('0x32')](_0xb8d179['query']['fields']));_0x5bf2f1[_0xbee1('0x31')]=_0x5bf2f1[_0xbee1('0x31')]['length']?_0x5bf2f1[_0xbee1('0x31')]:_0x1ff1c9[_0xbee1('0x2c')];if(_0xb8d179['query'][_0xbee1('0x3d')]){_0x5bf2f1[_0xbee1('0x3e')]=[{'all':!![]}];}_0x5bf2f1=_[_0xbee1('0x39')]({},_0x5bf2f1,_0xb8d179[_0xbee1('0x3b')]);return db[_0xbee1('0x3c')]['find'](_0x5bf2f1)[_0xbee1('0x23')](handleEntityNotFound(_0x62c175,null))[_0xbee1('0x23')](respondWithResult(_0x62c175,null))[_0xbee1('0x41')](handleError(_0x62c175,null));};exports[_0xbee1('0x44')]=function(_0x16c389,_0x232f84){return db[_0xbee1('0x3c')]['create'](_0x16c389[_0xbee1('0x45')],{})[_0xbee1('0x23')](respondWithResult(_0x232f84,0xc9))[_0xbee1('0x41')](handleError(_0x232f84,null));};exports[_0xbee1('0x21')]=function(_0x4bd2bb,_0x4f32ad){if(_0x4bd2bb[_0xbee1('0x45')]['id']){delete _0x4bd2bb[_0xbee1('0x45')]['id'];}return db['OpenchannelTransferReport'][_0xbee1('0x46')]({'where':{'id':_0x4bd2bb[_0xbee1('0x43')]['id']}})[_0xbee1('0x23')](handleEntityNotFound(_0x4f32ad,null))[_0xbee1('0x23')](saveUpdates(_0x4bd2bb[_0xbee1('0x45')],null))[_0xbee1('0x23')](respondWithResult(_0x4f32ad,null))['catch'](handleError(_0x4f32ad,null));};exports['destroy']=function(_0x44b4fa,_0x35b951){return db[_0xbee1('0x3c')][_0xbee1('0x46')]({'where':{'id':_0x44b4fa[_0xbee1('0x43')]['id']}})['then'](handleEntityNotFound(_0x35b951,null))[_0xbee1('0x23')](removeEntity(_0x35b951,null))[_0xbee1('0x41')](handleError(_0x35b951,null));};exports[_0xbee1('0x47')]=function(_0x5961fe,_0x2768d2){return db[_0xbee1('0x3c')][_0xbee1('0x47')]()['then'](respondWithResult(_0x2768d2,null))['catch'](handleError(_0x2768d2,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d7ef22d..b7cb909 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 _0x9a71=['util','api','moment','request-promise','path','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x9a71,0x1cb));var _0x19a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19a7('0x0'));var util=require(_0x19a7('0x1'));var logger=require('../../config/logger')(_0x19a7('0x2'));var moment=require(_0x19a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x19a7('0x4'));var fs=require('fs');var path=require(_0x19a7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x19a7('0x6'));module['exports']=function(_0x294221,_0x1fb70f){return _0x294221['define'](_0x19a7('0x7'),attributes,{'tableName':_0x19a7('0x8'),'paranoid':![],'indexes':[{'name':_0x19a7('0x9'),'fields':[_0x19a7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x76cd=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1872be,_0x106b60){var _0x14ae9d=function(_0x4eb463){while(--_0x4eb463){_0x1872be['push'](_0x1872be['shift']());}};_0x14ae9d(++_0x106b60);}(_0x76cd,0x1c6));var _0xd76c=function(_0x15a82a,_0x29d749){_0x15a82a=_0x15a82a-0x0;var _0x286344=_0x76cd[_0x15a82a];return _0x286344;};'use strict';var _=require('lodash');var util=require(_0xd76c('0x0'));var logger=require(_0xd76c('0x1'))(_0xd76c('0x2'));var moment=require(_0xd76c('0x3'));var BPromise=require(_0xd76c('0x4'));var rp=require(_0xd76c('0x5'));var fs=require('fs');var path=require(_0xd76c('0x6'));var rimraf=require('rimraf');var config=require(_0xd76c('0x7'));var attributes=require(_0xd76c('0x8'));module[_0xd76c('0x9')]=function(_0xe20657,_0x4c6e3e){return _0xe20657[_0xd76c('0xa')](_0xd76c('0xb'),attributes,{'tableName':_0xd76c('0xc'),'paranoid':![],'indexes':[{'name':_0xd76c('0xd'),'fields':[_0xd76c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index b29c394..3a6be0f 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 _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x56ac53,_0x36cb99){var _0x1fcf4b=function(_0x477901){while(--_0x477901){_0x56ac53['push'](_0x56ac53['shift']());}};_0x1fcf4b(++_0x36cb99);}(_0xac9d,0x14d));var _0xdac9=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0xac9d[_0x46a671];return _0x526d75;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file +var _0xee14=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x5a8ae7,_0x7b9da5){var _0xc3ef7=function(_0x36c1af){while(--_0x36c1af){_0x5a8ae7['push'](_0x5a8ae7['shift']());}};_0xc3ef7(++_0x7b9da5);}(_0xee14,0x13a));var _0x4ee1=function(_0x4aa4f5,_0x167ab4){_0x4aa4f5=_0x4aa4f5-0x0;var _0x2dc6e4=_0xee14[_0x4aa4f5];return _0x2dc6e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ee1('0x0'));var BPromise=require(_0x4ee1('0x1'));var rs=require(_0x4ee1('0x2'));var fs=require('fs');var Redis=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];var utils=require(_0x4ee1('0x5'));var logger=require(_0x4ee1('0x6'))(_0x4ee1('0x7'));var config=require(_0x4ee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){return client[_0x4ee1('0xa')](_0x327c18,_0x187656)['then'](function(_0x33dbe6){logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));logger[_0x4ee1('0xd')](_0x4ee1('0xe'),_0x3a45a3,_0x4ee1('0xc'),JSON['stringify'](_0x33dbe6));if(_0x33dbe6[_0x4ee1('0xf')]){if(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x10')]===0x1f4){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')]['message']);return _0xdfe9c1(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);return _0x293d5f(_0x33dbe6[_0x4ee1('0xf')][_0x4ee1('0x12')]);}else{logger[_0x4ee1('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a45a3,_0x4ee1('0xc'));_0x293d5f(_0x33dbe6[_0x4ee1('0x13')][_0x4ee1('0x12')]);}})[_0x4ee1('0x14')](function(_0x123c5e){logger[_0x4ee1('0xf')](_0x4ee1('0x11'),_0x3a45a3,_0x123c5e);_0xdfe9c1(_0x123c5e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f50d0b6..9d872f8 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 _0x9657=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x260a08,_0x16c4bf){var _0x2c40a3=function(_0x3967cd){while(--_0x3967cd){_0x260a08['push'](_0x260a08['shift']());}};_0x2c40a3(++_0x16c4bf);}(_0x9657,0x110));var _0x7965=function(_0x10173a,_0x54491b){_0x10173a=_0x10173a-0x0;var _0x4e8515=_0x9657[_0x10173a];return _0x4e8515;};'use strict';var multer=require('multer');var util=require(_0x7965('0x0'));var path=require(_0x7965('0x1'));var timeout=require(_0x7965('0x2'));var express=require(_0x7965('0x3'));var router=express['Router']();var fs_extra=require(_0x7965('0x4'));var auth=require(_0x7965('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x7965('0x6')]('/',auth[_0x7965('0x7')](),controller[_0x7965('0x8')]);router[_0x7965('0x6')](_0x7965('0x9'),auth[_0x7965('0x7')](),controller[_0x7965('0xa')]);router[_0x7965('0xb')]('/',auth[_0x7965('0x7')](),controller[_0x7965('0xc')]);router[_0x7965('0xd')](_0x7965('0x9'),auth['isAuthenticated'](),controller[_0x7965('0xe')]);router['delete'](_0x7965('0x9'),auth[_0x7965('0x7')](),controller[_0x7965('0xf')]);module[_0x7965('0x10')]=router; \ No newline at end of file +var _0x4a3c=['./pause.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xcd40a7,_0x58e78d){var _0x336808=function(_0x198feb){while(--_0x198feb){_0xcd40a7['push'](_0xcd40a7['shift']());}};_0x336808(++_0x58e78d);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x3c54a3,_0x6f957f){_0x3c54a3=_0x3c54a3-0x0;var _0x5c79b8=_0x4a3c[_0x3c54a3];return _0x5c79b8;};'use strict';var multer=require(_0xc4a3('0x0'));var util=require('util');var path=require(_0xc4a3('0x1'));var timeout=require(_0xc4a3('0x2'));var express=require(_0xc4a3('0x3'));var router=express[_0xc4a3('0x4')]();var fs_extra=require(_0xc4a3('0x5'));var auth=require(_0xc4a3('0x6'));var interaction=require(_0xc4a3('0x7'));var config=require('../../config/environment');var controller=require(_0xc4a3('0x8'));router[_0xc4a3('0x9')]('/',auth[_0xc4a3('0xa')](),controller[_0xc4a3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc4a3('0xc')]);router['post']('/',auth[_0xc4a3('0xa')](),controller[_0xc4a3('0xd')]);router[_0xc4a3('0xe')](_0xc4a3('0xf'),auth[_0xc4a3('0xa')](),controller[_0xc4a3('0x10')]);router[_0xc4a3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2cff3a1..d535189 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 _0x99c7=['sequelize','exports','STRING','name'];(function(_0x11e2b0,_0x386c82){var _0x1b9672=function(_0x51096d){while(--_0x51096d){_0x11e2b0['push'](_0x11e2b0['shift']());}};_0x1b9672(++_0x386c82);}(_0x99c7,0x1ec));var _0x799c=function(_0x4e9071,_0x4d33b4){_0x4e9071=_0x4e9071-0x0;var _0x3abeb8=_0x99c7[_0x4e9071];return _0x3abeb8;};'use strict';var Sequelize=require(_0x799c('0x0'));module[_0x799c('0x1')]={'name':{'type':Sequelize[_0x799c('0x2')],'unique':_0x799c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x799c('0x2')]}}; \ No newline at end of file +var _0x198a=['STRING'];(function(_0x1be6ed,_0x5ce971){var _0x2c08de=function(_0x3f6772){while(--_0x3f6772){_0x1be6ed['push'](_0x1be6ed['shift']());}};_0x2c08de(++_0x5ce971);}(_0x198a,0x12d));var _0xa198=function(_0x2838dd,_0x44832b){_0x2838dd=_0x2838dd-0x0;var _0x3ddfb7=_0x198a[_0x2838dd];return _0x3ddfb7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa198('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa198('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 686ab8c..50662f7 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 _0xf1f8=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','Pauses','UserProfileResource','destroy','then','end','error','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId'];(function(_0x57f4bd,_0x1fc4ee){var _0x1f17ba=function(_0x1e2c37){while(--_0x1e2c37){_0x57f4bd['push'](_0x57f4bd['shift']());}};_0x1f17ba(++_0x1fc4ee);}(_0xf1f8,0x13d));var _0x8f1f=function(_0x34178f,_0x167eda){_0x34178f=_0x34178f-0x0;var _0x53553d=_0xf1f8[_0x34178f];return _0x53553d;};'use strict';var emlformat=require(_0x8f1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f1f('0x1'));var jsonpatch=require(_0x8f1f('0x2'));var rp=require(_0x8f1f('0x3'));var moment=require(_0x8f1f('0x4'));var BPromise=require(_0x8f1f('0x5'));var Mustache=require(_0x8f1f('0x6'));var util=require(_0x8f1f('0x7'));var path=require('path');var sox=require(_0x8f1f('0x8'));var csv=require(_0x8f1f('0x9'));var ejs=require(_0x8f1f('0xa'));var fs=require('fs');var fs_extra=require(_0x8f1f('0xb'));var _=require('lodash');var squel=require(_0x8f1f('0xc'));var crypto=require(_0x8f1f('0xd'));var jsforce=require(_0x8f1f('0xe'));var deskjs=require(_0x8f1f('0xf'));var toCsv=require(_0x8f1f('0x9'));var querystring=require(_0x8f1f('0x10'));var Papa=require(_0x8f1f('0x11'));var Redis=require('ioredis');var authService=require(_0x8f1f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8f1f('0x13'));var hardwareService=require(_0x8f1f('0x14'));var logger=require(_0x8f1f('0x15'))('api');var utils=require(_0x8f1f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8f1f('0x17'));var db=require(_0x8f1f('0x18'))['db'];function respondWithStatusCode(_0x1c561a,_0x304697){_0x304697=_0x304697||0xcc;return function(_0x439354){if(_0x439354){return _0x1c561a[_0x8f1f('0x19')](_0x304697);}return _0x1c561a[_0x8f1f('0x1a')](_0x304697)['end']();};}function respondWithResult(_0x3bb790,_0x298f9a){_0x298f9a=_0x298f9a||0xc8;return function(_0x3edfe0){if(_0x3edfe0){return _0x3bb790[_0x8f1f('0x1a')](_0x298f9a)[_0x8f1f('0x1b')](_0x3edfe0);}};}function respondWithFilteredResult(_0x25ed1d,_0x3254af){return function(_0x5ca93a){if(_0x5ca93a){var _0x24239b=typeof _0x3254af[_0x8f1f('0x1c')]===_0x8f1f('0x1d')&&typeof _0x3254af[_0x8f1f('0x1e')]==='undefined';var _0x291b9f=_0x5ca93a['count'];var _0x1b60cf=_0x24239b?0x0:_0x3254af[_0x8f1f('0x1c')];var _0xe34f3=_0x24239b?_0x5ca93a[_0x8f1f('0x1f')]:_0x3254af['offset']+_0x3254af[_0x8f1f('0x1e')];var _0xcbc8ca;if(_0xe34f3>=_0x291b9f){_0xe34f3=_0x291b9f;_0xcbc8ca=0xc8;}else{_0xcbc8ca=0xce;}_0x25ed1d[_0x8f1f('0x1a')](_0xcbc8ca);return _0x25ed1d['set'](_0x8f1f('0x20'),_0x1b60cf+'-'+_0xe34f3+'/'+_0x291b9f)[_0x8f1f('0x1b')](_0x5ca93a);}return null;};}function patchUpdates(_0x54553a){return function(_0x279cfe){try{jsonpatch[_0x8f1f('0x21')](_0x279cfe,_0x54553a,!![]);}catch(_0x1a3a19){return BPromise['reject'](_0x1a3a19);}return _0x279cfe[_0x8f1f('0x22')]();};}function saveUpdates(_0x2bc220,_0x21d226){return function(_0x504dd0){if(_0x504dd0){return _0x504dd0[_0x8f1f('0x23')](_0x2bc220)['then'](function(_0x1422a6){return _0x1422a6;});}return null;};}function removeEntity(_0x477ba8,_0x2ac902){return function(_0x5aa683){if(_0x5aa683){return _0x5aa683['destroy']()['then'](function(){var _0x5dae8d=_0x5aa683[_0x8f1f('0x24')]({'plain':!![]});var _0x18344d=_0x8f1f('0x25');return db[_0x8f1f('0x26')][_0x8f1f('0x27')]({'where':{'type':_0x18344d,'resourceId':_0x5dae8d['id']}})['then'](function(){return _0x5aa683;});})[_0x8f1f('0x28')](function(){_0x477ba8[_0x8f1f('0x1a')](0xcc)[_0x8f1f('0x29')]();});}};}function handleEntityNotFound(_0xc170b4,_0x1defb4){return function(_0x8e2573){if(!_0x8e2573){_0xc170b4[_0x8f1f('0x19')](0x194);}return _0x8e2573;};}function handleError(_0x3871de,_0x3d3b44){_0x3d3b44=_0x3d3b44||0x1f4;return function(_0x39fce6){logger[_0x8f1f('0x2a')](_0x39fce6[_0x8f1f('0x2b')]);if(_0x39fce6['name']){delete _0x39fce6[_0x8f1f('0x2c')];}_0x3871de[_0x8f1f('0x1a')](_0x3d3b44)['send'](_0x39fce6);};}exports[_0x8f1f('0x2d')]=function(_0x3e84bc,_0x2a510e){var _0x231207={},_0x202847={},_0x49eea4={'count':0x0,'rows':[]};var _0x1e1bbc=_[_0x8f1f('0x2e')](db[_0x8f1f('0x2f')][_0x8f1f('0x30')],function(_0x5ae104){return{'name':_0x5ae104[_0x8f1f('0x31')],'type':_0x5ae104[_0x8f1f('0x32')][_0x8f1f('0x33')]};});_0x202847['model']=_[_0x8f1f('0x2e')](_0x1e1bbc,_0x8f1f('0x2c'));_0x202847[_0x8f1f('0x34')]=_[_0x8f1f('0x35')](_0x3e84bc[_0x8f1f('0x34')]);_0x202847[_0x8f1f('0x36')]=_[_0x8f1f('0x37')](_0x202847[_0x8f1f('0x38')],_0x202847['query']);_0x231207[_0x8f1f('0x39')]=_[_0x8f1f('0x37')](_0x202847[_0x8f1f('0x38')],qs['fields'](_0x3e84bc[_0x8f1f('0x34')][_0x8f1f('0x3a')]));_0x231207[_0x8f1f('0x39')]=_0x231207[_0x8f1f('0x39')][_0x8f1f('0x3b')]?_0x231207[_0x8f1f('0x39')]:_0x202847['model'];if(!_0x3e84bc['query']['hasOwnProperty']('nolimit')){_0x231207[_0x8f1f('0x1e')]=qs['limit'](_0x3e84bc[_0x8f1f('0x34')]['limit']);_0x231207[_0x8f1f('0x1c')]=qs[_0x8f1f('0x1c')](_0x3e84bc['query'][_0x8f1f('0x1c')]);}_0x231207['order']=qs['sort'](_0x3e84bc[_0x8f1f('0x34')]['sort']);_0x231207[_0x8f1f('0x3c')]=qs['filters'](_['pick'](_0x3e84bc[_0x8f1f('0x34')],_0x202847['filters']),_0x1e1bbc);if(_0x3e84bc[_0x8f1f('0x34')][_0x8f1f('0x3d')]){_0x231207[_0x8f1f('0x3c')]=_[_0x8f1f('0x3e')](_0x231207['where'],{'$or':_[_0x8f1f('0x2e')](_0x1e1bbc,function(_0x5d12f7){if(_0x5d12f7[_0x8f1f('0x32')]!==_0x8f1f('0x3f')){var _0x412de0={};_0x412de0[_0x5d12f7['name']]={'$like':'%'+_0x3e84bc[_0x8f1f('0x34')]['filter']+'%'};return _0x412de0;}})});}_0x231207=_[_0x8f1f('0x3e')]({},_0x231207,_0x3e84bc[_0x8f1f('0x40')]);var _0x2763b6={'where':_0x231207[_0x8f1f('0x3c')]};return db['Pause']['count'](_0x2763b6)[_0x8f1f('0x28')](function(_0x7c49b4){_0x49eea4[_0x8f1f('0x1f')]=_0x7c49b4;if(_0x3e84bc[_0x8f1f('0x34')]['includeAll']){_0x231207[_0x8f1f('0x41')]=[{'all':!![]}];}return db[_0x8f1f('0x2f')][_0x8f1f('0x42')](_0x231207);})[_0x8f1f('0x28')](function(_0x52b341){_0x49eea4[_0x8f1f('0x43')]=_0x52b341;return _0x49eea4;})['then'](respondWithFilteredResult(_0x2a510e,_0x231207))['catch'](handleError(_0x2a510e,null));};exports['show']=function(_0xd682c4,_0x20ba98){var _0x52d161={'raw':!![],'where':{'id':_0xd682c4[_0x8f1f('0x44')]['id']}},_0x14741e={};_0x14741e[_0x8f1f('0x38')]=_['keys'](db[_0x8f1f('0x2f')][_0x8f1f('0x30')]);_0x14741e[_0x8f1f('0x34')]=_['keys'](_0xd682c4[_0x8f1f('0x34')]);_0x14741e['filters']=_[_0x8f1f('0x37')](_0x14741e['model'],_0x14741e[_0x8f1f('0x34')]);_0x52d161[_0x8f1f('0x39')]=_[_0x8f1f('0x37')](_0x14741e[_0x8f1f('0x38')],qs[_0x8f1f('0x3a')](_0xd682c4[_0x8f1f('0x34')][_0x8f1f('0x3a')]));_0x52d161[_0x8f1f('0x39')]=_0x52d161['attributes']['length']?_0x52d161[_0x8f1f('0x39')]:_0x14741e['model'];if(_0xd682c4[_0x8f1f('0x34')][_0x8f1f('0x45')]){_0x52d161['include']=[{'all':!![]}];}_0x52d161=_[_0x8f1f('0x3e')]({},_0x52d161,_0xd682c4[_0x8f1f('0x40')]);return db[_0x8f1f('0x2f')]['find'](_0x52d161)[_0x8f1f('0x28')](handleEntityNotFound(_0x20ba98,null))[_0x8f1f('0x28')](respondWithResult(_0x20ba98,null))[_0x8f1f('0x46')](handleError(_0x20ba98,null));};exports['create']=function(_0x4e23a9,_0x1e9a9b){return db[_0x8f1f('0x2f')][_0x8f1f('0x47')](_0x4e23a9[_0x8f1f('0x48')],{})[_0x8f1f('0x28')](function(_0x5de0e9){var _0x3f2d29=_0x4e23a9[_0x8f1f('0x49')][_0x8f1f('0x24')]({'plain':!![]});if(!_0x3f2d29)throw new Error(_0x8f1f('0x4a'));if(_0x3f2d29[_0x8f1f('0x4b')]===_0x8f1f('0x49')){var _0x1af4ff=_0x5de0e9[_0x8f1f('0x24')]({'plain':!![]});var _0x378b35=_0x8f1f('0x25');return db['UserProfileSection'][_0x8f1f('0x4c')]({'where':{'name':_0x378b35,'userProfileId':_0x3f2d29[_0x8f1f('0x4d')]},'raw':!![]})[_0x8f1f('0x28')](function(_0xc3aae8){if(_0xc3aae8&&_0xc3aae8['autoAssociation']===0x0){return db[_0x8f1f('0x26')][_0x8f1f('0x47')]({'name':_0x1af4ff[_0x8f1f('0x2c')],'resourceId':_0x1af4ff['id'],'type':_0xc3aae8[_0x8f1f('0x2c')],'sectionId':_0xc3aae8['id']},{})[_0x8f1f('0x28')](function(){return _0x5de0e9;});}else{return _0x5de0e9;}})[_0x8f1f('0x46')](function(_0x306c45){logger[_0x8f1f('0x2a')](_0x8f1f('0x4e'),_0x306c45);throw _0x306c45;});}return _0x5de0e9;})[_0x8f1f('0x28')](respondWithResult(_0x1e9a9b,0xc9))['catch'](handleError(_0x1e9a9b,null));};exports[_0x8f1f('0x23')]=function(_0x2a80d8,_0x27cbf8){if(_0x2a80d8['body']['id']){delete _0x2a80d8['body']['id'];}return db[_0x8f1f('0x2f')][_0x8f1f('0x4c')]({'where':{'id':_0x2a80d8[_0x8f1f('0x44')]['id']}})[_0x8f1f('0x28')](handleEntityNotFound(_0x27cbf8,null))[_0x8f1f('0x28')](saveUpdates(_0x2a80d8[_0x8f1f('0x48')],null))['then'](respondWithResult(_0x27cbf8,null))[_0x8f1f('0x46')](handleError(_0x27cbf8,null));};exports['destroy']=function(_0xdd3b3b,_0x102a7f){return db['Pause']['find']({'where':{'id':_0xdd3b3b[_0x8f1f('0x44')]['id']}})[_0x8f1f('0x28')](handleEntityNotFound(_0x102a7f,null))[_0x8f1f('0x28')](removeEntity(_0x102a7f,null))[_0x8f1f('0x46')](handleError(_0x102a7f,null));}; \ No newline at end of file +var _0x3575=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','get','Pauses','UserProfileResource','destroy','error','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','intersection','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x575b5e,_0x369ce9){var _0x3110b6=function(_0x3371cb){while(--_0x3371cb){_0x575b5e['push'](_0x575b5e['shift']());}};_0x3110b6(++_0x369ce9);}(_0x3575,0x1ea));var _0x5357=function(_0x5dde9b,_0x203652){_0x5dde9b=_0x5dde9b-0x0;var _0x315c22=_0x3575[_0x5dde9b];return _0x315c22;};'use strict';var emlformat=require(_0x5357('0x0'));var rimraf=require(_0x5357('0x1'));var zipdir=require(_0x5357('0x2'));var jsonpatch=require(_0x5357('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5357('0x4'));var Mustache=require(_0x5357('0x5'));var util=require(_0x5357('0x6'));var path=require(_0x5357('0x7'));var sox=require(_0x5357('0x8'));var csv=require('to-csv');var ejs=require(_0x5357('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5357('0xa'));var squel=require(_0x5357('0xb'));var crypto=require(_0x5357('0xc'));var jsforce=require(_0x5357('0xd'));var deskjs=require(_0x5357('0xe'));var toCsv=require(_0x5357('0xf'));var querystring=require(_0x5357('0x10'));var Papa=require(_0x5357('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5357('0x12'));var hardwareService=require(_0x5357('0x13'));var logger=require(_0x5357('0x14'))(_0x5357('0x15'));var utils=require(_0x5357('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5357('0x17'));var db=require(_0x5357('0x18'))['db'];function respondWithStatusCode(_0x485aee,_0x4769e8){_0x4769e8=_0x4769e8||0xcc;return function(_0x1f1156){if(_0x1f1156){return _0x485aee[_0x5357('0x19')](_0x4769e8);}return _0x485aee[_0x5357('0x1a')](_0x4769e8)[_0x5357('0x1b')]();};}function respondWithResult(_0x45940a,_0x350b4f){_0x350b4f=_0x350b4f||0xc8;return function(_0x258b61){if(_0x258b61){return _0x45940a[_0x5357('0x1a')](_0x350b4f)[_0x5357('0x1c')](_0x258b61);}};}function respondWithFilteredResult(_0x357707,_0x301c65){return function(_0x5afbe5){if(_0x5afbe5){var _0x5babfa=typeof _0x301c65[_0x5357('0x1d')]==='undefined'&&typeof _0x301c65[_0x5357('0x1e')]===_0x5357('0x1f');var _0xd40021=_0x5afbe5[_0x5357('0x20')];var _0x38d254=_0x5babfa?0x0:_0x301c65[_0x5357('0x1d')];var _0x31a801=_0x5babfa?_0x5afbe5[_0x5357('0x20')]:_0x301c65[_0x5357('0x1d')]+_0x301c65[_0x5357('0x1e')];var _0x1600a7;if(_0x31a801>=_0xd40021){_0x31a801=_0xd40021;_0x1600a7=0xc8;}else{_0x1600a7=0xce;}_0x357707[_0x5357('0x1a')](_0x1600a7);return _0x357707[_0x5357('0x21')](_0x5357('0x22'),_0x38d254+'-'+_0x31a801+'/'+_0xd40021)['json'](_0x5afbe5);}return null;};}function patchUpdates(_0x479b72){return function(_0x40fea4){try{jsonpatch[_0x5357('0x23')](_0x40fea4,_0x479b72,!![]);}catch(_0x3a1157){return BPromise['reject'](_0x3a1157);}return _0x40fea4[_0x5357('0x24')]();};}function saveUpdates(_0x16b955,_0x2369cc){return function(_0x48d55d){if(_0x48d55d){return _0x48d55d[_0x5357('0x25')](_0x16b955)['then'](function(_0x482bbf){return _0x482bbf;});}return null;};}function removeEntity(_0x5d8b25,_0x2e8507){return function(_0x7486d4){if(_0x7486d4){return _0x7486d4['destroy']()[_0x5357('0x26')](function(){var _0x28283b=_0x7486d4[_0x5357('0x27')]({'plain':!![]});var _0x4939e3=_0x5357('0x28');return db[_0x5357('0x29')][_0x5357('0x2a')]({'where':{'type':_0x4939e3,'resourceId':_0x28283b['id']}})['then'](function(){return _0x7486d4;});})[_0x5357('0x26')](function(){_0x5d8b25[_0x5357('0x1a')](0xcc)[_0x5357('0x1b')]();});}};}function handleEntityNotFound(_0x6036e9,_0x32d871){return function(_0x328a54){if(!_0x328a54){_0x6036e9[_0x5357('0x19')](0x194);}return _0x328a54;};}function handleError(_0x2fc3a1,_0x1e6f4a){_0x1e6f4a=_0x1e6f4a||0x1f4;return function(_0x5469cf){logger[_0x5357('0x2b')](_0x5469cf[_0x5357('0x2c')]);if(_0x5469cf[_0x5357('0x2d')]){delete _0x5469cf[_0x5357('0x2d')];}_0x2fc3a1[_0x5357('0x1a')](_0x1e6f4a)['send'](_0x5469cf);};}exports[_0x5357('0x2e')]=function(_0x25975e,_0x470ec1){var _0x30435d={},_0x4dc1d9={},_0x9144ec={'count':0x0,'rows':[]};var _0x5558a2=_[_0x5357('0x2f')](db[_0x5357('0x30')][_0x5357('0x31')],function(_0x52c6b7){return{'name':_0x52c6b7[_0x5357('0x32')],'type':_0x52c6b7[_0x5357('0x33')][_0x5357('0x34')]};});_0x4dc1d9[_0x5357('0x35')]=_[_0x5357('0x2f')](_0x5558a2,_0x5357('0x2d'));_0x4dc1d9[_0x5357('0x36')]=_[_0x5357('0x37')](_0x25975e[_0x5357('0x36')]);_0x4dc1d9['filters']=_['intersection'](_0x4dc1d9[_0x5357('0x35')],_0x4dc1d9[_0x5357('0x36')]);_0x30435d['attributes']=_['intersection'](_0x4dc1d9[_0x5357('0x35')],qs[_0x5357('0x38')](_0x25975e[_0x5357('0x36')][_0x5357('0x38')]));_0x30435d[_0x5357('0x39')]=_0x30435d[_0x5357('0x39')][_0x5357('0x3a')]?_0x30435d[_0x5357('0x39')]:_0x4dc1d9[_0x5357('0x35')];if(!_0x25975e[_0x5357('0x36')][_0x5357('0x3b')](_0x5357('0x3c'))){_0x30435d[_0x5357('0x1e')]=qs[_0x5357('0x1e')](_0x25975e[_0x5357('0x36')][_0x5357('0x1e')]);_0x30435d[_0x5357('0x1d')]=qs[_0x5357('0x1d')](_0x25975e[_0x5357('0x36')]['offset']);}_0x30435d[_0x5357('0x3d')]=qs[_0x5357('0x3e')](_0x25975e['query'][_0x5357('0x3e')]);_0x30435d[_0x5357('0x3f')]=qs[_0x5357('0x40')](_[_0x5357('0x41')](_0x25975e[_0x5357('0x36')],_0x4dc1d9[_0x5357('0x40')]),_0x5558a2);if(_0x25975e[_0x5357('0x36')][_0x5357('0x42')]){_0x30435d[_0x5357('0x3f')]=_[_0x5357('0x43')](_0x30435d[_0x5357('0x3f')],{'$or':_['map'](_0x5558a2,function(_0x2d48c7){if(_0x2d48c7[_0x5357('0x33')]!=='VIRTUAL'){var _0x3f0252={};_0x3f0252[_0x2d48c7[_0x5357('0x2d')]]={'$like':'%'+_0x25975e[_0x5357('0x36')][_0x5357('0x42')]+'%'};return _0x3f0252;}})});}_0x30435d=_[_0x5357('0x43')]({},_0x30435d,_0x25975e[_0x5357('0x44')]);var _0x3b599c={'where':_0x30435d['where']};return db['Pause'][_0x5357('0x20')](_0x3b599c)[_0x5357('0x26')](function(_0x41386d){_0x9144ec[_0x5357('0x20')]=_0x41386d;if(_0x25975e[_0x5357('0x36')][_0x5357('0x45')]){_0x30435d[_0x5357('0x46')]=[{'all':!![]}];}return db[_0x5357('0x30')][_0x5357('0x47')](_0x30435d);})[_0x5357('0x26')](function(_0x34caca){_0x9144ec['rows']=_0x34caca;return _0x9144ec;})[_0x5357('0x26')](respondWithFilteredResult(_0x470ec1,_0x30435d))['catch'](handleError(_0x470ec1,null));};exports[_0x5357('0x48')]=function(_0x309f32,_0x49292e){var _0x358191={'raw':!![],'where':{'id':_0x309f32[_0x5357('0x49')]['id']}},_0x4d01f1={};_0x4d01f1[_0x5357('0x35')]=_[_0x5357('0x37')](db[_0x5357('0x30')]['rawAttributes']);_0x4d01f1[_0x5357('0x36')]=_['keys'](_0x309f32[_0x5357('0x36')]);_0x4d01f1[_0x5357('0x40')]=_[_0x5357('0x4a')](_0x4d01f1[_0x5357('0x35')],_0x4d01f1['query']);_0x358191['attributes']=_[_0x5357('0x4a')](_0x4d01f1[_0x5357('0x35')],qs[_0x5357('0x38')](_0x309f32[_0x5357('0x36')][_0x5357('0x38')]));_0x358191[_0x5357('0x39')]=_0x358191['attributes'][_0x5357('0x3a')]?_0x358191[_0x5357('0x39')]:_0x4d01f1['model'];if(_0x309f32[_0x5357('0x36')][_0x5357('0x45')]){_0x358191[_0x5357('0x46')]=[{'all':!![]}];}_0x358191=_[_0x5357('0x43')]({},_0x358191,_0x309f32[_0x5357('0x44')]);return db[_0x5357('0x30')][_0x5357('0x4b')](_0x358191)['then'](handleEntityNotFound(_0x49292e,null))[_0x5357('0x26')](respondWithResult(_0x49292e,null))[_0x5357('0x4c')](handleError(_0x49292e,null));};exports[_0x5357('0x4d')]=function(_0xe6ab6e,_0x5ae9a6){return db['Pause'][_0x5357('0x4d')](_0xe6ab6e['body'],{})['then'](function(_0x2648a){var _0x14ce5d=_0xe6ab6e['user'][_0x5357('0x27')]({'plain':!![]});if(!_0x14ce5d)throw new Error(_0x5357('0x4e'));if(_0x14ce5d['role']===_0x5357('0x4f')){var _0x319fee=_0x2648a['get']({'plain':!![]});var _0x4442a3='Pauses';return db[_0x5357('0x50')][_0x5357('0x4b')]({'where':{'name':_0x4442a3,'userProfileId':_0x14ce5d[_0x5357('0x51')]},'raw':!![]})[_0x5357('0x26')](function(_0x28a119){if(_0x28a119&&_0x28a119[_0x5357('0x52')]===0x0){return db[_0x5357('0x29')]['create']({'name':_0x319fee[_0x5357('0x2d')],'resourceId':_0x319fee['id'],'type':_0x28a119[_0x5357('0x2d')],'sectionId':_0x28a119['id']},{})[_0x5357('0x26')](function(){return _0x2648a;});}else{return _0x2648a;}})[_0x5357('0x4c')](function(_0x3d135a){logger[_0x5357('0x2b')](_0x5357('0x53'),_0x3d135a);throw _0x3d135a;});}return _0x2648a;})[_0x5357('0x26')](respondWithResult(_0x5ae9a6,0xc9))[_0x5357('0x4c')](handleError(_0x5ae9a6,null));};exports[_0x5357('0x25')]=function(_0x48f4ee,_0x3b84f1){if(_0x48f4ee[_0x5357('0x54')]['id']){delete _0x48f4ee[_0x5357('0x54')]['id'];}return db[_0x5357('0x30')][_0x5357('0x4b')]({'where':{'id':_0x48f4ee[_0x5357('0x49')]['id']}})[_0x5357('0x26')](handleEntityNotFound(_0x3b84f1,null))[_0x5357('0x26')](saveUpdates(_0x48f4ee['body'],null))[_0x5357('0x26')](respondWithResult(_0x3b84f1,null))[_0x5357('0x4c')](handleError(_0x3b84f1,null));};exports[_0x5357('0x2a')]=function(_0x511fd8,_0x48ff89){return db[_0x5357('0x30')][_0x5357('0x4b')]({'where':{'id':_0x511fd8['params']['id']}})['then'](handleEntityNotFound(_0x48ff89,null))[_0x5357('0x26')](removeEntity(_0x48ff89,null))[_0x5357('0x4c')](handleError(_0x48ff89,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c6e3bca..4407f36 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x7217,0x19e));var _0x7721=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7217[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x19b083,_0x5a3b02){var _0x4b8428=function(_0x5ab4d0){while(--_0x5ab4d0){_0x19b083['push'](_0x19b083['shift']());}};_0x4b8428(++_0x5a3b02);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3dcee8,_0x38beb0){_0x3dcee8=_0x3dcee8-0x0;var _0x3a2390=_0x1cb9[_0x3dcee8];return _0x3a2390;};'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 d424668..8b591cb 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4239c0,_0x156543){var _0x24f79d=function(_0x3c62c2){while(--_0x3c62c2){_0x4239c0['push'](_0x4239c0['shift']());}};_0x24f79d(++_0x156543);}(_0xb10b,0x12a));var _0xbb10=function(_0xba0c2,_0x54cc50){_0xba0c2=_0xba0c2-0x0;var _0x5a9fa0=_0xb10b[_0xba0c2];return _0x5a9fa0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x57a95a,_0x1a5e2e){var _0x114915=function(_0x45014d){while(--_0x45014d){_0x57a95a['push'](_0x57a95a['shift']());}};_0x114915(++_0x1a5e2e);}(_0x7a54,0x106));var _0x47a5=function(_0x41381a,_0x198478){_0x41381a=_0x41381a-0x0;var _0x72d30b=_0x7a54[_0x41381a];return _0x72d30b;};'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 5bb7456..170d001 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 _0x4fdb=['server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','/webhook','webhookGet','get','show','/:id/download','download','diskStorage','root'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x3a3d90,_0x17e9bc){_0x3a3d90=_0x3a3d90-0x0;var _0x3e4b44=_0x4fdb[_0x3a3d90];return _0x3e4b44;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),controller[_0xb4fd('0xc')]);router[_0xb4fd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb4fd('0xe')]);router[_0xb4fd('0xd')](_0xb4fd('0xf'),auth['isAuthenticated'](),controller[_0xb4fd('0x10')]);var upload=multer({'storage':multer[_0xb4fd('0x11')]({'destination':function(_0x2148db,_0x23b08f,_0x306bd4){_0x306bd4(null,path['join'](config[_0xb4fd('0x12')],_0xb4fd('0x13')));},'filename':function(_0x2e8ee1,_0x120c2e,_0x5ba7e1){_0x120c2e[_0xb4fd('0x14')]=_0x120c2e[_0xb4fd('0x14')][_0xb4fd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ba7e1(null,util['format'](_0xb4fd('0x16'),path[_0xb4fd('0x17')](_0x120c2e[_0xb4fd('0x14')],path[_0xb4fd('0x18')](_0x120c2e[_0xb4fd('0x14')])),Date[_0xb4fd('0x19')](),path[_0xb4fd('0x18')](_0x120c2e['originalname'])));}})});router[_0xb4fd('0x1a')]('/',upload[_0xb4fd('0x1b')](_0xb4fd('0x1c')),controller[_0xb4fd('0x1d')]);router[_0xb4fd('0x1a')](_0xb4fd('0xb'),controller[_0xb4fd('0x1e')]);router[_0xb4fd('0x1f')](_0xb4fd('0x20'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0xb4fd('0x22')]=router; \ No newline at end of file +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(_0x459cf3,_0xe42796){var _0x1a7d1a=function(_0x419950){while(--_0x419950){_0x459cf3['push'](_0x459cf3['shift']());}};_0x1a7d1a(++_0xe42796);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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 diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 0fc2252..7683eba 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 _0x8d32=['script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0x8d32,0x104));var _0x28d3=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8d32[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x28d3('0x0'));module[_0x28d3('0x1')]={'name':{'type':Sequelize[_0x28d3('0x2')]},'type':{'type':Sequelize['ENUM'](_0x28d3('0x3'),_0x28d3('0x4'))},'description':{'type':Sequelize[_0x28d3('0x5')]},'version':{'type':Sequelize[_0x28d3('0x5')]},'path':{'type':Sequelize[_0x28d3('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x28d3('0x6')],'defaultValue':0x0,'comment':_0x28d3('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x28d3('0x8'),_0x28d3('0x9'),_0x28d3('0xa'),'never'),'defaultValue':_0x28d3('0xa'),'comment':_0x28d3('0xb')},'icon':{'type':Sequelize[_0x28d3('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x28d3('0x2')]},'scriptName':{'type':Sequelize[_0x28d3('0x2')]},'scriptPath':{'type':Sequelize[_0x28d3('0x2')]}}; \ No newline at end of file +var _0x818b=['STRING','ENUM','html','script','TEXT','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x818b,0xc1));var _0xb818=function(_0x2606d1,_0x4e0d9a){_0x2606d1=_0x2606d1-0x0;var _0x143a82=_0x818b[_0x2606d1];return _0x143a82;};'use strict';var Sequelize=require(_0xb818('0x0'));module[_0xb818('0x1')]={'name':{'type':Sequelize[_0xb818('0x2')]},'type':{'type':Sequelize[_0xb818('0x3')](_0xb818('0x4'),_0xb818('0x5'))},'description':{'type':Sequelize[_0xb818('0x6')]},'version':{'type':Sequelize[_0xb818('0x6')]},'path':{'type':Sequelize[_0xb818('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xb818('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb818('0x3')](_0xb818('0x8'),_0xb818('0x9'),_0xb818('0xa'),_0xb818('0xb')),'defaultValue':_0xb818('0xa'),'comment':_0xb818('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xb818('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xb818('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 999e583..b49aa40 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 _0x10a5=['pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','send','Zip\x20archive\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','sendStatus','webhookPost','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','get','Plugins','UserProfileResource','stack','name','index','map','Plugin','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','keys','length','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x10a5,0x1a1));var _0x510a=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x10a5[_0x456b57];return _0x18f49f;};'use strict';var emlformat=require(_0x510a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x510a('0x1'));var jsonpatch=require(_0x510a('0x2'));var rp=require(_0x510a('0x3'));var moment=require(_0x510a('0x4'));var BPromise=require(_0x510a('0x5'));var Mustache=require(_0x510a('0x6'));var util=require(_0x510a('0x7'));var path=require(_0x510a('0x8'));var sox=require(_0x510a('0x9'));var csv=require(_0x510a('0xa'));var ejs=require(_0x510a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x510a('0xc'));var squel=require('squel');var crypto=require(_0x510a('0xd'));var jsforce=require(_0x510a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x510a('0xa'));var querystring=require(_0x510a('0xf'));var Papa=require('papaparse');var extract=require(_0x510a('0x10'));var rimraf=require('rimraf');var archiver=require(_0x510a('0x11'));var Redis=require(_0x510a('0x12'));var authService=require(_0x510a('0x13'));var qs=require(_0x510a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x510a('0x15'));var config=require(_0x510a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x510a('0x17'))['db'];config[_0x510a('0x18')]=_[_0x510a('0x19')](config[_0x510a('0x18')],{'host':_0x510a('0x1a'),'port':0x18eb});var socket=require(_0x510a('0x1b'))(new Redis(config[_0x510a('0x18')]));require(_0x510a('0x1c'))[_0x510a('0x1d')](socket);function respondWithStatusCode(_0x106e5c,_0x353a39){_0x353a39=_0x353a39||0xcc;return function(_0x1ba7de){if(_0x1ba7de){return _0x106e5c['sendStatus'](_0x353a39);}return _0x106e5c[_0x510a('0x1e')](_0x353a39)[_0x510a('0x1f')]();};}function respondWithResult(_0x451981,_0x43d73f){_0x43d73f=_0x43d73f||0xc8;return function(_0x157133){if(_0x157133){return _0x451981[_0x510a('0x1e')](_0x43d73f)[_0x510a('0x20')](_0x157133);}};}function respondWithFilteredResult(_0x1379b1,_0x3d01ec){return function(_0x561abb){if(_0x561abb){var _0x36a8b0=typeof _0x3d01ec[_0x510a('0x21')]==='undefined'&&typeof _0x3d01ec[_0x510a('0x22')]===_0x510a('0x23');var _0x29cf4f=_0x561abb['count'];var _0x7c061=_0x36a8b0?0x0:_0x3d01ec[_0x510a('0x21')];var _0x58fbe7=_0x36a8b0?_0x561abb['count']:_0x3d01ec['offset']+_0x3d01ec[_0x510a('0x22')];var _0x3f682e;if(_0x58fbe7>=_0x29cf4f){_0x58fbe7=_0x29cf4f;_0x3f682e=0xc8;}else{_0x3f682e=0xce;}_0x1379b1[_0x510a('0x1e')](_0x3f682e);return _0x1379b1[_0x510a('0x24')](_0x510a('0x25'),_0x7c061+'-'+_0x58fbe7+'/'+_0x29cf4f)[_0x510a('0x20')](_0x561abb);}return null;};}function patchUpdates(_0x25c908){return function(_0xa03a0e){try{jsonpatch[_0x510a('0x26')](_0xa03a0e,_0x25c908,!![]);}catch(_0x591752){return BPromise[_0x510a('0x27')](_0x591752);}return _0xa03a0e['save']();};}function saveUpdates(_0x55abd0,_0x5e3844){return function(_0x218c13){if(_0x218c13){return _0x218c13[_0x510a('0x28')](_0x55abd0)[_0x510a('0x29')](function(_0x19ad6e){return _0x19ad6e;});}return null;};}function removeEntity(_0x30222a,_0x422ff6){return function(_0x52c9df){if(_0x52c9df){return _0x52c9df[_0x510a('0x2a')]()['then'](function(){var _0x21a458=_0x52c9df[_0x510a('0x2b')]({'plain':!![]});var _0x3190ea=_0x510a('0x2c');return db[_0x510a('0x2d')][_0x510a('0x2a')]({'where':{'type':_0x3190ea,'resourceId':_0x21a458['id']}})['then'](function(){return _0x52c9df;});})[_0x510a('0x29')](function(){_0x30222a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d3156,_0x5f2df9){return function(_0x45f832){if(!_0x45f832){_0x6d3156['sendStatus'](0x194);}return _0x45f832;};}function handleError(_0x3d939b,_0x2eb9af){_0x2eb9af=_0x2eb9af||0x1f4;return function(_0x44676f){logger['error'](_0x44676f[_0x510a('0x2e')]);if(_0x44676f[_0x510a('0x2f')]){delete _0x44676f[_0x510a('0x2f')];}_0x3d939b[_0x510a('0x1e')](_0x2eb9af)['send'](_0x44676f);};}exports[_0x510a('0x30')]=function(_0x1c22d8,_0x58ab64){var _0xb1b40c={},_0x179ef8={},_0x3b7cbb={'count':0x0,'rows':[]};var _0x328c46=_[_0x510a('0x31')](db[_0x510a('0x32')][_0x510a('0x33')],function(_0x3dfa70){return{'name':_0x3dfa70['fieldName'],'type':_0x3dfa70[_0x510a('0x34')]['key']};});_0x179ef8[_0x510a('0x35')]=_[_0x510a('0x31')](_0x328c46,_0x510a('0x2f'));_0x179ef8[_0x510a('0x36')]=_['keys'](_0x1c22d8[_0x510a('0x36')]);_0x179ef8[_0x510a('0x37')]=_[_0x510a('0x38')](_0x179ef8[_0x510a('0x35')],_0x179ef8[_0x510a('0x36')]);_0xb1b40c[_0x510a('0x39')]=_['intersection'](_0x179ef8[_0x510a('0x35')],qs[_0x510a('0x3a')](_0x1c22d8['query']['fields']));_0xb1b40c[_0x510a('0x39')]=_0xb1b40c['attributes']['length']?_0xb1b40c[_0x510a('0x39')]:_0x179ef8[_0x510a('0x35')];if(!_0x1c22d8[_0x510a('0x36')]['hasOwnProperty'](_0x510a('0x3b'))){_0xb1b40c['limit']=qs[_0x510a('0x22')](_0x1c22d8[_0x510a('0x36')][_0x510a('0x22')]);_0xb1b40c['offset']=qs[_0x510a('0x21')](_0x1c22d8[_0x510a('0x36')]['offset']);}_0xb1b40c[_0x510a('0x3c')]=qs[_0x510a('0x3d')](_0x1c22d8[_0x510a('0x36')]['sort']);_0xb1b40c[_0x510a('0x3e')]=qs[_0x510a('0x37')](_[_0x510a('0x3f')](_0x1c22d8['query'],_0x179ef8[_0x510a('0x37')]),_0x328c46);if(_0x1c22d8['query'][_0x510a('0x40')]){_0xb1b40c[_0x510a('0x3e')]=_[_0x510a('0x41')](_0xb1b40c['where'],{'$or':_[_0x510a('0x31')](_0x328c46,function(_0x9fd300){if(_0x9fd300[_0x510a('0x34')]!==_0x510a('0x42')){var _0x1d44bc={};_0x1d44bc[_0x9fd300[_0x510a('0x2f')]]={'$like':'%'+_0x1c22d8[_0x510a('0x36')][_0x510a('0x40')]+'%'};return _0x1d44bc;}})});}_0xb1b40c=_[_0x510a('0x41')]({},_0xb1b40c,_0x1c22d8[_0x510a('0x43')]);var _0x39c20f={'where':_0xb1b40c[_0x510a('0x3e')]};return db[_0x510a('0x32')][_0x510a('0x44')](_0x39c20f)[_0x510a('0x29')](function(_0x2bcdb4){_0x3b7cbb['count']=_0x2bcdb4;if(_0x1c22d8[_0x510a('0x36')]['includeAll']){_0xb1b40c[_0x510a('0x45')]=[{'all':!![]}];}return db[_0x510a('0x32')][_0x510a('0x46')](_0xb1b40c);})[_0x510a('0x29')](function(_0xe06536){_0x3b7cbb[_0x510a('0x47')]=_0xe06536;return _0x3b7cbb;})[_0x510a('0x29')](respondWithFilteredResult(_0x58ab64,_0xb1b40c))[_0x510a('0x48')](handleError(_0x58ab64,null));};exports[_0x510a('0x49')]=function(_0x32e35b,_0xa09626){var _0x9e4e01={'raw':!![],'where':{'id':_0x32e35b[_0x510a('0x4a')]['id']}},_0x22aecb={};_0x22aecb[_0x510a('0x35')]=_[_0x510a('0x4b')](db[_0x510a('0x32')]['rawAttributes']);_0x22aecb['query']=_[_0x510a('0x4b')](_0x32e35b[_0x510a('0x36')]);_0x22aecb[_0x510a('0x37')]=_[_0x510a('0x38')](_0x22aecb[_0x510a('0x35')],_0x22aecb[_0x510a('0x36')]);_0x9e4e01[_0x510a('0x39')]=_[_0x510a('0x38')](_0x22aecb[_0x510a('0x35')],qs[_0x510a('0x3a')](_0x32e35b[_0x510a('0x36')][_0x510a('0x3a')]));_0x9e4e01[_0x510a('0x39')]=_0x9e4e01[_0x510a('0x39')][_0x510a('0x4c')]?_0x9e4e01[_0x510a('0x39')]:_0x22aecb[_0x510a('0x35')];if(_0x32e35b[_0x510a('0x36')]['includeAll']){_0x9e4e01['include']=[{'all':!![]}];}_0x9e4e01=_[_0x510a('0x41')]({},_0x9e4e01,_0x32e35b[_0x510a('0x43')]);return db[_0x510a('0x32')][_0x510a('0x4d')](_0x9e4e01)['then'](handleEntityNotFound(_0xa09626,null))[_0x510a('0x29')](respondWithResult(_0xa09626,null))[_0x510a('0x48')](handleError(_0xa09626,null));};exports[_0x510a('0x4e')]=function(_0x1f016d,_0x4c7e5a,_0x53c2bf){return db[_0x510a('0x32')]['find']({'where':{'id':_0x1f016d[_0x510a('0x4a')]['id']},'attributes':[_0x510a('0x2f'),_0x510a('0x8')],'raw':!![]})[_0x510a('0x29')](handleEntityNotFound(_0x4c7e5a,null))[_0x510a('0x29')](function(_0x2be822){if(_0x2be822){var _0x37f164=path[_0x510a('0x4f')](config[_0x510a('0x50')],_0x510a('0x51'),util[_0x510a('0x52')](_0x510a('0x53'),path[_0x510a('0x54')](_0x2be822['path'])));var _0x127924=fs[_0x510a('0x55')](_0x37f164);var _0x50692c=archiver(_0x510a('0x56'),{'zlib':{'level':0x9}});_0x50692c['on']('warning',function(_0x33d53c){if(_0x33d53c[_0x510a('0x57')]===_0x510a('0x58')){logger[_0x510a('0x59')](_0x33d53c);}else{throw new db[(_0x510a('0x5a'))]['Error'](_0x510a('0x5b'));}});_0x50692c['on'](_0x510a('0x59'),function(_0x3bda28){throw new db['Sequelize'][(_0x510a('0x5c'))](_0x510a('0x5b'));});_0x50692c[_0x510a('0x5d')](_0x127924);_0x50692c[_0x510a('0x5e')](_0x510a('0x5f'),{'cwd':path[_0x510a('0x4f')](config[_0x510a('0x50')],_0x510a('0x51'),path[_0x510a('0x60')](_0x2be822[_0x510a('0x8')])),'ignore':[path['join'](path[_0x510a('0x54')](_0x2be822[_0x510a('0x8')]),_0x510a('0x61')),path[_0x510a('0x4f')](path[_0x510a('0x54')](_0x2be822['path']),_0x510a('0x62'))],'nodir':!![]})[_0x510a('0x63')]();_0x127924['on'](_0x510a('0x64'),function(){if(!fs[_0x510a('0x65')](_0x37f164)){throw new db['Sequelize'][(_0x510a('0x5c'))](_0x510a('0x66'));}return _0x4c7e5a[_0x510a('0x4e')](_0x37f164,util[_0x510a('0x52')](_0x510a('0x53'),path[_0x510a('0x54')](_0x2be822['path'])),function(_0xc4c59b){if(_0xc4c59b){throw new db[(_0x510a('0x5a'))]['Error'](_0x510a('0x67'));}fs[_0x510a('0x68')](_0x37f164);logger[_0x510a('0x69')]('Download\x20completed');logger['info'](_0x510a('0x6a'));});});}return null;})['catch'](handleError(_0x4c7e5a,null));};exports['upload']=function(_0x440361,_0x50a614,_0x5883fe){var _0x4927ab=path[_0x510a('0x54')](_0x440361[_0x510a('0x6b')][_0x510a('0x6c')],path[_0x510a('0x6d')](_0x440361[_0x510a('0x6b')]['filename']));var _0x35f794=path[_0x510a('0x4f')](config['root'],'server/files/plugins',_0x440361['file'][_0x510a('0x6c')]);var _0x574b7f=path[_0x510a('0x4f')](config[_0x510a('0x50')],'server/files/plugins',_0x4927ab);logger['info'](_0x510a('0x6e'),_0x35f794);logger[_0x510a('0x69')]('Plugin\x20upload\x20destination:\x20%s',_0x574b7f);try{fs[_0x510a('0x6f')](_0x35f794,parseInt(_0x510a('0x70'),0x8));extract(_0x35f794,{'dir':_0x574b7f},function(_0x1d58ae){if(_0x1d58ae){logger[_0x510a('0x59')](_0x1d58ae);handleError(_0x1d58ae,!![]);};var _0x3b000b=fs['readdirSync'](_0x574b7f);if(_0x3b000b['length']>0x1){removeReferences(_0x35f794,_0x574b7f);logger[_0x510a('0x59')](_0x510a('0x71'));return _0x5883fe(new Error(_0x510a('0x71')));}var _0x511dfd=fs['lstatSync'](path['join'](_0x574b7f,_0x3b000b[0x0]));if(_0x511dfd[_0x510a('0x72')]()){removeReferences(_0x35f794,_0x574b7f);logger[_0x510a('0x59')](_0x510a('0x71'));return _0x5883fe(new Error('Invalid\x20plugin\x20structure'));}if(_0x511dfd[_0x510a('0x73')]()){var _0x2e0e6e=fs[_0x510a('0x74')](path[_0x510a('0x4f')](_0x574b7f,_0x3b000b[0x0]));if(_0x2e0e6e['length']===0x0){removeReferences(_0x35f794,_0x574b7f);logger[_0x510a('0x59')](_0x510a('0x71'));return _0x5883fe(new Error(_0x510a('0x71')));}var _0x31421e=_0x2e0e6e[_0x510a('0x75')](function(_0x3d2efd){return _0x3d2efd===_0x510a('0x76');});if(!_0x31421e){return _0x5883fe(new Error(_0x510a('0x77')));}var _0x25d917=fs['readFileSync'](path['join'](_0x574b7f,_0x3b000b[0x0],_0x510a('0x76')));var _0x141e50=JSON[_0x510a('0x78')](_0x25d917);if(_0x510a('0x23')==typeof _0x141e50[_0x510a('0x2f')]){return _0x5883fe(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x141e50[_0x510a('0x34')]){return _0x5883fe(new Error(_0x510a('0x79')));}if(_0x510a('0x23')==typeof _0x141e50['version']){return _0x5883fe(new Error(_0x510a('0x7a')));}if(_0x510a('0x23')==typeof _0x141e50[_0x510a('0x7b')]){return _0x5883fe(new Error(_0x510a('0x7c')));}if(_0x141e50[_0x510a('0x34')]===_0x510a('0x7d')){if(_0x510a('0x23')==typeof _0x141e50[_0x510a('0x7b')][_0x510a('0x7e')]){return _0x5883fe(new Error(_0x510a('0x7f')));}if(_0x510a('0x23')==typeof _0x141e50[_0x510a('0x7b')][_0x510a('0x7e')][_0x510a('0x80')]&&_0x510a('0x23')==typeof _0x141e50['parameters'][_0x510a('0x7e')][_0x510a('0x81')]){return _0x5883fe(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x141e50[_0x510a('0x34')]===_0x510a('0x82')){if('undefined'==typeof _0x141e50['parameters'][_0x510a('0x83')]){return _0x5883fe(new Error(_0x510a('0x84')));}if('undefined'==typeof _0x141e50[_0x510a('0x7b')]['scriptPath']){return _0x5883fe(new Error(_0x510a('0x85')));}}else{return _0x5883fe(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x31569f=_0x141e50[_0x510a('0x2f')];var _0x5d790b=_0x141e50[_0x510a('0x86')];var _0xda20a1=_0x141e50[_0x510a('0x34')];var _0x294afa=_0x141e50[_0x510a('0x87')]?_0x141e50[_0x510a('0x87')]:_0x510a('0x88');var _0x2e2828=_0x141e50['icon']?_0x141e50['icon']:_0x510a('0x89');var _0x59ed0d='';var _0x18a564='';var _0x7d0873='';var _0x180565='';var _0x4ac2b=_0x141e50[_0x510a('0x8a')];if(_0xda20a1===_0x510a('0x7d')){if(_0x510a('0x23')!=typeof _0x141e50[_0x510a('0x7b')]['views'][_0x510a('0x80')]){var _0x2aeb5e=_0x141e50['parameters'][_0x510a('0x7e')][_0x510a('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x510a('0x8b')](_0x2aeb5e)){_0x59ed0d=path[_0x510a('0x4f')](_0x510a('0x8c'),_0x4927ab,_0x3b000b[0x0],_0x2aeb5e);}else{_0x59ed0d=_0x2aeb5e;}}else{logger['info'](_0x510a('0x8d'));}if(_0x510a('0x23')!=typeof _0x141e50['parameters'][_0x510a('0x7e')][_0x510a('0x81')]){var _0x12c1f8=_0x141e50['parameters']['views'][_0x510a('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x510a('0x8b')](_0x12c1f8)){_0x18a564=path[_0x510a('0x4f')]('plugins',_0x4927ab,_0x3b000b[0x0],_0x12c1f8);}else{_0x18a564=_0x12c1f8;}}else{logger[_0x510a('0x69')](_0x510a('0x8e'));}}else if(_0xda20a1==='script'){_0x7d0873=_0x141e50[_0x510a('0x7b')][_0x510a('0x83')];_0x180565=_0x141e50[_0x510a('0x7b')][_0x510a('0x8f')];if(_0x510a('0x23')!=typeof _0x141e50['parameters'][_0x510a('0x7e')]){if(_0x510a('0x23')!=typeof _0x141e50[_0x510a('0x7b')][_0x510a('0x7e')]['admin']){var _0x2aeb5e=_0x141e50['parameters'][_0x510a('0x7e')][_0x510a('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x510a('0x8b')](_0x2aeb5e)){_0x59ed0d=path[_0x510a('0x4f')](_0x510a('0x8c'),_0x4927ab,_0x3b000b[0x0],_0x2aeb5e);}else{_0x59ed0d=_0x2aeb5e;}}if(_0x510a('0x23')!=typeof _0x141e50['parameters'][_0x510a('0x7e')][_0x510a('0x81')]){var _0x12c1f8=_0x141e50[_0x510a('0x7b')]['views'][_0x510a('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x510a('0x8b')](_0x12c1f8)){_0x18a564=path[_0x510a('0x4f')](_0x510a('0x8c'),_0x4927ab,_0x3b000b[0x0],_0x12c1f8);}else{_0x18a564=_0x12c1f8;}}}}var _0x5937c8={'name':_0x31569f,'description':_0x5d790b,'path':path[_0x510a('0x4f')](_0x4927ab,_0x3b000b[0x0]),'type':_0xda20a1,'sidebar':_0x294afa,'icon':_0x2e2828,'adminUrl':_0x59ed0d,'agentUrl':_0x18a564,'scriptName':_0x7d0873,'scriptPath':_0x180565,'version':_0x4ac2b};removeReferences(_0x35f794,null);return db[_0x510a('0x32')][_0x510a('0x90')](_0x5937c8)[_0x510a('0x29')](function(_0x190f59){var _0x458280={'role':_0x440361[_0x510a('0x91')]['role'],'userProfileId':_0x440361[_0x510a('0x91')][_0x510a('0x92')]};if(!_0x458280)throw new Error(_0x510a('0x93'));if(_0x458280[_0x510a('0x94')]===_0x510a('0x95')){var _0x36f9f8=_0x190f59[_0x510a('0x2b')]({'plain':!![]});return db[_0x510a('0x96')]['find']({'where':{'name':_0x510a('0x2c'),'userProfileId':_0x458280[_0x510a('0x92')]},'raw':!![]})[_0x510a('0x29')](function(_0x3111a2){if(_0x3111a2&&_0x3111a2[_0x510a('0x97')]===0x0){return db['UserProfileResource'][_0x510a('0x90')]({'name':_0x36f9f8[_0x510a('0x2f')],'resourceId':_0x36f9f8['id'],'type':_0x3111a2['name'],'sectionId':_0x3111a2['id']},{})[_0x510a('0x29')](function(){return _0x190f59;});}else{return _0x190f59;}})['catch'](function(_0x1a0716){logger[_0x510a('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a0716);throw _0x1a0716;});}return _0x190f59;})[_0x510a('0x29')](respondWithResult(_0x50a614,null))[_0x510a('0x48')](handleError(_0x50a614,null));}});}catch(_0x447e36){_0x50a614['status'](0x1f4)[_0x510a('0x98')](_0x447e36);}};function removeReferences(_0x2d59ac,_0x4b7c0e){try{if(_0x2d59ac){fs['unlinkSync'](_0x2d59ac);logger['info'](_0x510a('0x99'));}if(_0x4b7c0e){rimraf(_0x4b7c0e,function(){});logger[_0x510a('0x69')]('Extracted\x20folder\x20removed');}}catch(_0x5db045){logger[_0x510a('0x59')](_0x5db045);}}exports[_0x510a('0x28')]=function(_0x210c56,_0x4ad1f0,_0x71c6a3){return db['Plugin']['find']({'where':{'id':_0x210c56[_0x510a('0x4a')]['id']}})[_0x510a('0x29')](handleEntityNotFound(_0x4ad1f0,null))[_0x510a('0x29')](saveUpdates(_0x210c56[_0x510a('0x91')],null))['then'](respondWithResult(_0x4ad1f0,null))[_0x510a('0x48')](handleError(_0x4ad1f0,null));};exports[_0x510a('0x9a')]=function(_0x46ba50,_0x5296a3,_0x16de3b){return db['Plugin'][_0x510a('0x4d')]({'where':{'id':_0x46ba50[_0x510a('0x4a')]['id']}})[_0x510a('0x29')](function(_0x45c007){if(_0x45c007){return _0x45c007[_0x510a('0x2a')]();}})[_0x510a('0x29')](function(_0x19b5f9){rimraf(path[_0x510a('0x4f')](config[_0x510a('0x50')],_0x510a('0x51'),path[_0x510a('0x60')](_0x19b5f9[_0x510a('0x8')])),function(){});return _0x19b5f9;})['then'](handleEntityNotFound(_0x5296a3,null))['then'](respondWithStatusCode(_0x5296a3,null))[_0x510a('0x48')](handleError(_0x5296a3,null));};exports[_0x510a('0x9b')]=function(_0x7c4f07,_0x54dc99,_0x1c6e05){return BPromise['resolve']()[_0x510a('0x29')](function(){if(!_0x7c4f07[_0x510a('0x36')][_0x510a('0x8')]){throw new Error(_0x510a('0x9c'));}if(!_0x7c4f07[_0x510a('0x36')][_0x510a('0x9d')]){throw new Error(_0x510a('0x9e'));}var _0x269d8e=_0x7c4f07[_0x510a('0x36')][_0x510a('0x9f')]?_0x7c4f07['query'][_0x510a('0x9f')]+':'+_0x7c4f07[_0x510a('0x36')][_0x510a('0x9d')]:_0x510a('0xa0')+_0x7c4f07['query'][_0x510a('0x9d')];var _0x1536e3=_0x7c4f07['query'][_0x510a('0x20')]?_0x7c4f07[_0x510a('0x36')]['json']:!![];var _0x27ab90=_0x7c4f07[_0x510a('0x36')][_0x510a('0xa1')]?_0x7c4f07['query'][_0x510a('0xa1')]:null;var _0x2f504f={'method':_0x7c4f07['method'],'uri':util[_0x510a('0x52')](_0x510a('0xa2'),_0x269d8e,_0x7c4f07[_0x510a('0x36')]['path']),'json':_0x1536e3,'resolveWithFullResponse':!![],'encoding':_0x27ab90,'qs':_0x7c4f07[_0x510a('0x36')]};if(_0x7c4f07[_0x510a('0xa3')]){_0x2f504f[_0x510a('0xa3')]=_0x7c4f07[_0x510a('0xa3')];if(_0x2f504f[_0x510a('0xa3')][_0x510a('0xa4')]){delete _0x2f504f[_0x510a('0xa3')]['content-length'];}}if(_0x2f504f[_0x510a('0xa3')]['content-type']){delete _0x2f504f['headers'][_0x510a('0xa5')];}return rp(_0x2f504f);})[_0x510a('0x29')](function(_0x43cf6c){if(_0x43cf6c){_0x54dc99['set'](_0x43cf6c[_0x510a('0xa3')]);logger['info'](_0x43cf6c[_0x510a('0x91')]);if(_[_0x510a('0xa6')](_0x7c4f07[_0x510a('0x36')][_0x510a('0x8')],_0x510a('0x4e'))&&_0x43cf6c[_0x510a('0xa7')]==0x1f4){return _0x54dc99['sendStatus'](_0x43cf6c[_0x510a('0xa7')]);}else{return _0x54dc99['status'](_0x43cf6c[_0x510a('0xa7')])[_0x510a('0x98')](_0x43cf6c[_0x510a('0x91')]);}}else{return _0x54dc99[_0x510a('0xa8')](0xc8);}})[_0x510a('0x48')](handleError(_0x54dc99,null));};exports[_0x510a('0xa9')]=function(_0x3ac0ad,_0x2acfe,_0x440ab2){return BPromise['resolve']()[_0x510a('0x29')](function(){if(!_0x3ac0ad[_0x510a('0x36')]['path']){throw new Error(_0x510a('0x9c'));}if(!_0x3ac0ad[_0x510a('0x36')]['port']){throw new Error(_0x510a('0x9e'));}var _0x3eca28=_0x3ac0ad[_0x510a('0x36')][_0x510a('0x9f')]?_0x3ac0ad[_0x510a('0x36')]['hostname']+':'+_0x3ac0ad[_0x510a('0x36')]['port']:_0x510a('0xa0')+_0x3ac0ad[_0x510a('0x36')][_0x510a('0x9d')];var _0x3a4822=_0x3ac0ad['query'][_0x510a('0x20')]?_0x3ac0ad[_0x510a('0x36')]['json']:!![];var _0x1ec356=_0x3ac0ad['query'][_0x510a('0xa1')]?_0x3ac0ad['query'][_0x510a('0xa1')]:null;var _0x1a6976={'method':_0x3ac0ad['method'],'uri':util[_0x510a('0x52')](_0x510a('0xa2'),_0x3eca28,_0x3ac0ad[_0x510a('0x36')][_0x510a('0x8')]),'json':_0x3a4822,'resolveWithFullResponse':!![],'encoding':_0x1ec356,'body':_0x3ac0ad[_0x510a('0x91')]};if(_0x3ac0ad[_0x510a('0xa3')]){_0x1a6976[_0x510a('0xa3')]=_0x3ac0ad[_0x510a('0xa3')];if(_0x1a6976['headers'][_0x510a('0xa4')]){delete _0x1a6976[_0x510a('0xa3')][_0x510a('0xa4')];}}if(_0x1a6976['headers'][_0x510a('0xa5')]){delete _0x1a6976[_0x510a('0xa3')][_0x510a('0xa5')];}return rp(_0x1a6976);})[_0x510a('0x29')](function(_0x2c5696){if(_0x2c5696){_0x2acfe[_0x510a('0x24')](_0x2c5696['headers']);logger[_0x510a('0x69')](_0x2c5696['body']);return _0x2acfe[_0x510a('0x1e')](_0x2c5696[_0x510a('0xa7')])[_0x510a('0x98')](_0x2c5696[_0x510a('0x91')]);}else{return _0x2acfe[_0x510a('0xa8')](0xc8);}})[_0x510a('0x48')](handleError(_0x2acfe,null));}; \ No newline at end of file +var _0x6e3d=['extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','description','sidebar','always','icon','views','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','params','join','root','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename'];(function(_0x318229,_0x31f172){var _0x15aa68=function(_0x15c655){while(--_0x15c655){_0x318229['push'](_0x318229['shift']());}};_0x15aa68(++_0x31f172);}(_0x6e3d,0xf3));var _0xd6e3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6e3d[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xd6e3('0x0'));var rimraf=require(_0xd6e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6e3('0x2'));var rp=require(_0xd6e3('0x3'));var moment=require(_0xd6e3('0x4'));var BPromise=require(_0xd6e3('0x5'));var Mustache=require(_0xd6e3('0x6'));var util=require(_0xd6e3('0x7'));var path=require(_0xd6e3('0x8'));var sox=require(_0xd6e3('0x9'));var csv=require(_0xd6e3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6e3('0xb'));var _=require(_0xd6e3('0xc'));var squel=require('squel');var crypto=require(_0xd6e3('0xd'));var jsforce=require(_0xd6e3('0xe'));var deskjs=require(_0xd6e3('0xf'));var toCsv=require(_0xd6e3('0xa'));var querystring=require(_0xd6e3('0x10'));var Papa=require(_0xd6e3('0x11'));var extract=require(_0xd6e3('0x12'));var rimraf=require(_0xd6e3('0x1'));var archiver=require('archiver');var Redis=require(_0xd6e3('0x13'));var authService=require(_0xd6e3('0x14'));var qs=require(_0xd6e3('0x15'));var as=require(_0xd6e3('0x16'));var hardwareService=require(_0xd6e3('0x17'));var logger=require(_0xd6e3('0x18'))(_0xd6e3('0x19'));var utils=require(_0xd6e3('0x1a'));var config=require(_0xd6e3('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6e3('0x1c'))['db'];config['redis']=_[_0xd6e3('0x1d')](config[_0xd6e3('0x1e')],{'host':_0xd6e3('0x1f'),'port':0x18eb});var socket=require(_0xd6e3('0x20'))(new Redis(config[_0xd6e3('0x1e')]));require(_0xd6e3('0x21'))[_0xd6e3('0x22')](socket);function respondWithStatusCode(_0x60a8cc,_0x2f544e){_0x2f544e=_0x2f544e||0xcc;return function(_0x434a78){if(_0x434a78){return _0x60a8cc[_0xd6e3('0x23')](_0x2f544e);}return _0x60a8cc[_0xd6e3('0x24')](_0x2f544e)[_0xd6e3('0x25')]();};}function respondWithResult(_0x5aab23,_0x32afde){_0x32afde=_0x32afde||0xc8;return function(_0x321781){if(_0x321781){return _0x5aab23['status'](_0x32afde)[_0xd6e3('0x26')](_0x321781);}};}function respondWithFilteredResult(_0x43f1eb,_0x1ddcd9){return function(_0x4de056){if(_0x4de056){var _0x4bf54b=typeof _0x1ddcd9[_0xd6e3('0x27')]===_0xd6e3('0x28')&&typeof _0x1ddcd9['limit']===_0xd6e3('0x28');var _0x170e3c=_0x4de056[_0xd6e3('0x29')];var _0x503e6e=_0x4bf54b?0x0:_0x1ddcd9[_0xd6e3('0x27')];var _0x3b81e6=_0x4bf54b?_0x4de056[_0xd6e3('0x29')]:_0x1ddcd9[_0xd6e3('0x27')]+_0x1ddcd9[_0xd6e3('0x2a')];var _0x4cc7d4;if(_0x3b81e6>=_0x170e3c){_0x3b81e6=_0x170e3c;_0x4cc7d4=0xc8;}else{_0x4cc7d4=0xce;}_0x43f1eb[_0xd6e3('0x24')](_0x4cc7d4);return _0x43f1eb[_0xd6e3('0x2b')](_0xd6e3('0x2c'),_0x503e6e+'-'+_0x3b81e6+'/'+_0x170e3c)['json'](_0x4de056);}return null;};}function patchUpdates(_0x586654){return function(_0x3ac2df){try{jsonpatch[_0xd6e3('0x2d')](_0x3ac2df,_0x586654,!![]);}catch(_0x861efb){return BPromise[_0xd6e3('0x2e')](_0x861efb);}return _0x3ac2df['save']();};}function saveUpdates(_0x16be8f,_0x2d336e){return function(_0x1a74a2){if(_0x1a74a2){return _0x1a74a2[_0xd6e3('0x2f')](_0x16be8f)[_0xd6e3('0x30')](function(_0x26483c){return _0x26483c;});}return null;};}function removeEntity(_0x588e9e,_0x45330c){return function(_0x11b4ba){if(_0x11b4ba){return _0x11b4ba[_0xd6e3('0x31')]()[_0xd6e3('0x30')](function(){var _0x1043a5=_0x11b4ba[_0xd6e3('0x32')]({'plain':!![]});var _0x39be38=_0xd6e3('0x33');return db[_0xd6e3('0x34')][_0xd6e3('0x31')]({'where':{'type':_0x39be38,'resourceId':_0x1043a5['id']}})['then'](function(){return _0x11b4ba;});})[_0xd6e3('0x30')](function(){_0x588e9e[_0xd6e3('0x24')](0xcc)[_0xd6e3('0x25')]();});}};}function handleEntityNotFound(_0x1e74b0,_0x4417da){return function(_0x352e18){if(!_0x352e18){_0x1e74b0[_0xd6e3('0x23')](0x194);}return _0x352e18;};}function handleError(_0x2353fe,_0x348ad5){_0x348ad5=_0x348ad5||0x1f4;return function(_0x4d2ae0){logger[_0xd6e3('0x35')](_0x4d2ae0[_0xd6e3('0x36')]);if(_0x4d2ae0['name']){delete _0x4d2ae0[_0xd6e3('0x37')];}_0x2353fe[_0xd6e3('0x24')](_0x348ad5)[_0xd6e3('0x38')](_0x4d2ae0);};}exports[_0xd6e3('0x39')]=function(_0x399f03,_0x4283e9){var _0x21e947={},_0x13f2ee={},_0x456db9={'count':0x0,'rows':[]};var _0xf489fc=_[_0xd6e3('0x3a')](db[_0xd6e3('0x3b')]['rawAttributes'],function(_0x589e99){return{'name':_0x589e99[_0xd6e3('0x3c')],'type':_0x589e99[_0xd6e3('0x3d')][_0xd6e3('0x3e')]};});_0x13f2ee[_0xd6e3('0x3f')]=_[_0xd6e3('0x3a')](_0xf489fc,'name');_0x13f2ee[_0xd6e3('0x40')]=_['keys'](_0x399f03[_0xd6e3('0x40')]);_0x13f2ee[_0xd6e3('0x41')]=_[_0xd6e3('0x42')](_0x13f2ee[_0xd6e3('0x3f')],_0x13f2ee[_0xd6e3('0x40')]);_0x21e947[_0xd6e3('0x43')]=_['intersection'](_0x13f2ee[_0xd6e3('0x3f')],qs[_0xd6e3('0x44')](_0x399f03[_0xd6e3('0x40')][_0xd6e3('0x44')]));_0x21e947[_0xd6e3('0x43')]=_0x21e947[_0xd6e3('0x43')][_0xd6e3('0x45')]?_0x21e947[_0xd6e3('0x43')]:_0x13f2ee[_0xd6e3('0x3f')];if(!_0x399f03['query'][_0xd6e3('0x46')]('nolimit')){_0x21e947[_0xd6e3('0x2a')]=qs[_0xd6e3('0x2a')](_0x399f03[_0xd6e3('0x40')][_0xd6e3('0x2a')]);_0x21e947[_0xd6e3('0x27')]=qs[_0xd6e3('0x27')](_0x399f03[_0xd6e3('0x40')][_0xd6e3('0x27')]);}_0x21e947[_0xd6e3('0x47')]=qs[_0xd6e3('0x48')](_0x399f03[_0xd6e3('0x40')][_0xd6e3('0x48')]);_0x21e947[_0xd6e3('0x49')]=qs[_0xd6e3('0x41')](_[_0xd6e3('0x4a')](_0x399f03[_0xd6e3('0x40')],_0x13f2ee[_0xd6e3('0x41')]),_0xf489fc);if(_0x399f03[_0xd6e3('0x40')][_0xd6e3('0x4b')]){_0x21e947[_0xd6e3('0x49')]=_[_0xd6e3('0x4c')](_0x21e947[_0xd6e3('0x49')],{'$or':_[_0xd6e3('0x3a')](_0xf489fc,function(_0x4f2efc){if(_0x4f2efc[_0xd6e3('0x3d')]!==_0xd6e3('0x4d')){var _0x2d2b54={};_0x2d2b54[_0x4f2efc['name']]={'$like':'%'+_0x399f03[_0xd6e3('0x40')][_0xd6e3('0x4b')]+'%'};return _0x2d2b54;}})});}_0x21e947=_[_0xd6e3('0x4c')]({},_0x21e947,_0x399f03[_0xd6e3('0x4e')]);var _0x927578={'where':_0x21e947[_0xd6e3('0x49')]};return db['Plugin'][_0xd6e3('0x29')](_0x927578)[_0xd6e3('0x30')](function(_0xdc7bc0){_0x456db9[_0xd6e3('0x29')]=_0xdc7bc0;if(_0x399f03[_0xd6e3('0x40')][_0xd6e3('0x4f')]){_0x21e947[_0xd6e3('0x50')]=[{'all':!![]}];}return db['Plugin'][_0xd6e3('0x51')](_0x21e947);})[_0xd6e3('0x30')](function(_0x17052c){_0x456db9[_0xd6e3('0x52')]=_0x17052c;return _0x456db9;})[_0xd6e3('0x30')](respondWithFilteredResult(_0x4283e9,_0x21e947))[_0xd6e3('0x53')](handleError(_0x4283e9,null));};exports[_0xd6e3('0x54')]=function(_0xfdb1cb,_0x38383e){var _0x38c378={'raw':!![],'where':{'id':_0xfdb1cb['params']['id']}},_0x5c1c97={};_0x5c1c97[_0xd6e3('0x3f')]=_[_0xd6e3('0x55')](db['Plugin'][_0xd6e3('0x56')]);_0x5c1c97[_0xd6e3('0x40')]=_[_0xd6e3('0x55')](_0xfdb1cb[_0xd6e3('0x40')]);_0x5c1c97[_0xd6e3('0x41')]=_[_0xd6e3('0x42')](_0x5c1c97[_0xd6e3('0x3f')],_0x5c1c97[_0xd6e3('0x40')]);_0x38c378[_0xd6e3('0x43')]=_[_0xd6e3('0x42')](_0x5c1c97[_0xd6e3('0x3f')],qs['fields'](_0xfdb1cb[_0xd6e3('0x40')]['fields']));_0x38c378[_0xd6e3('0x43')]=_0x38c378[_0xd6e3('0x43')][_0xd6e3('0x45')]?_0x38c378[_0xd6e3('0x43')]:_0x5c1c97['model'];if(_0xfdb1cb[_0xd6e3('0x40')][_0xd6e3('0x4f')]){_0x38c378['include']=[{'all':!![]}];}_0x38c378=_[_0xd6e3('0x4c')]({},_0x38c378,_0xfdb1cb['options']);return db['Plugin'][_0xd6e3('0x57')](_0x38c378)[_0xd6e3('0x30')](handleEntityNotFound(_0x38383e,null))[_0xd6e3('0x30')](respondWithResult(_0x38383e,null))[_0xd6e3('0x53')](handleError(_0x38383e,null));};exports['download']=function(_0x3eb7bf,_0x33b3ac,_0x3b4d6f){return db[_0xd6e3('0x3b')][_0xd6e3('0x57')]({'where':{'id':_0x3eb7bf[_0xd6e3('0x58')]['id']},'attributes':[_0xd6e3('0x37'),_0xd6e3('0x8')],'raw':!![]})[_0xd6e3('0x30')](handleEntityNotFound(_0x33b3ac,null))['then'](function(_0x1d0fe5){if(_0x1d0fe5){var _0x42b111=path[_0xd6e3('0x59')](config[_0xd6e3('0x5a')],'server/files/plugins',util['format'](_0xd6e3('0x5b'),path[_0xd6e3('0x5c')](_0x1d0fe5[_0xd6e3('0x8')])));var _0x99b0b6=fs[_0xd6e3('0x5d')](_0x42b111);var _0x47cd4a=archiver('zip',{'zlib':{'level':0x9}});_0x47cd4a['on'](_0xd6e3('0x5e'),function(_0x5340e2){if(_0x5340e2[_0xd6e3('0x5f')]===_0xd6e3('0x60')){logger[_0xd6e3('0x35')](_0x5340e2);}else{throw new db[(_0xd6e3('0x61'))][(_0xd6e3('0x62'))](_0xd6e3('0x63'));}});_0x47cd4a['on'](_0xd6e3('0x35'),function(_0x1969e4){throw new db[(_0xd6e3('0x61'))]['Error'](_0xd6e3('0x63'));});_0x47cd4a[_0xd6e3('0x64')](_0x99b0b6);_0x47cd4a[_0xd6e3('0x65')](_0xd6e3('0x66'),{'cwd':path[_0xd6e3('0x59')](config[_0xd6e3('0x5a')],_0xd6e3('0x67'),path[_0xd6e3('0x68')](_0x1d0fe5[_0xd6e3('0x8')])),'ignore':[path['join'](path[_0xd6e3('0x5c')](_0x1d0fe5['path']),_0xd6e3('0x69')),path[_0xd6e3('0x59')](path[_0xd6e3('0x5c')](_0x1d0fe5[_0xd6e3('0x8')]),_0xd6e3('0x6a'))],'nodir':!![]})[_0xd6e3('0x6b')]();_0x99b0b6['on'](_0xd6e3('0x6c'),function(){if(!fs[_0xd6e3('0x6d')](_0x42b111)){throw new db[(_0xd6e3('0x61'))][(_0xd6e3('0x62'))](_0xd6e3('0x6e'));}return _0x33b3ac[_0xd6e3('0x6f')](_0x42b111,util[_0xd6e3('0x70')](_0xd6e3('0x5b'),path[_0xd6e3('0x5c')](_0x1d0fe5[_0xd6e3('0x8')])),function(_0x1e23fa){if(_0x1e23fa){throw new db[(_0xd6e3('0x61'))][(_0xd6e3('0x62'))](_0xd6e3('0x71'));}fs['unlinkSync'](_0x42b111);logger[_0xd6e3('0x72')](_0xd6e3('0x73'));logger[_0xd6e3('0x72')]('Temporary\x20file\x20removed');});});}return null;})[_0xd6e3('0x53')](handleError(_0x33b3ac,null));};exports[_0xd6e3('0x74')]=function(_0x336808,_0x55d656,_0x40faff){var _0x55c155=path[_0xd6e3('0x5c')](_0x336808[_0xd6e3('0x75')][_0xd6e3('0x76')],path[_0xd6e3('0x77')](_0x336808[_0xd6e3('0x75')][_0xd6e3('0x76')]));var _0x3e6257=path[_0xd6e3('0x59')](config[_0xd6e3('0x5a')],_0xd6e3('0x67'),_0x336808[_0xd6e3('0x75')]['filename']);var _0x33230b=path[_0xd6e3('0x59')](config[_0xd6e3('0x5a')],_0xd6e3('0x67'),_0x55c155);logger[_0xd6e3('0x72')](_0xd6e3('0x78'),_0x3e6257);logger[_0xd6e3('0x72')]('Plugin\x20upload\x20destination:\x20%s',_0x33230b);try{fs[_0xd6e3('0x79')](_0x3e6257,parseInt('0777',0x8));extract(_0x3e6257,{'dir':_0x33230b},function(_0x186bb5){if(_0x186bb5){logger['error'](_0x186bb5);handleError(_0x186bb5,!![]);};var _0x307961=fs['readdirSync'](_0x33230b);if(_0x307961[_0xd6e3('0x45')]>0x1){removeReferences(_0x3e6257,_0x33230b);logger[_0xd6e3('0x35')](_0xd6e3('0x7a'));return _0x40faff(new Error(_0xd6e3('0x7a')));}var _0x543d14=fs[_0xd6e3('0x7b')](path['join'](_0x33230b,_0x307961[0x0]));if(_0x543d14[_0xd6e3('0x7c')]()){removeReferences(_0x3e6257,_0x33230b);logger['error'](_0xd6e3('0x7a'));return _0x40faff(new Error('Invalid\x20plugin\x20structure'));}if(_0x543d14['isDirectory']()){var _0x2a38a8=fs[_0xd6e3('0x7d')](path[_0xd6e3('0x59')](_0x33230b,_0x307961[0x0]));if(_0x2a38a8[_0xd6e3('0x45')]===0x0){removeReferences(_0x3e6257,_0x33230b);logger[_0xd6e3('0x35')](_0xd6e3('0x7a'));return _0x40faff(new Error(_0xd6e3('0x7a')));}var _0x3993f5=_0x2a38a8[_0xd6e3('0x7e')](function(_0x5baec2){return _0x5baec2===_0xd6e3('0x7f');});if(!_0x3993f5){return _0x40faff(new Error(_0xd6e3('0x80')));}var _0x375636=fs[_0xd6e3('0x81')](path[_0xd6e3('0x59')](_0x33230b,_0x307961[0x0],_0xd6e3('0x7f')));var _0x14096b=JSON[_0xd6e3('0x82')](_0x375636);if(_0xd6e3('0x28')==typeof _0x14096b['name']){return _0x40faff(new Error(_0xd6e3('0x83')));}if(_0xd6e3('0x28')==typeof _0x14096b[_0xd6e3('0x3d')]){return _0x40faff(new Error(_0xd6e3('0x84')));}if('undefined'==typeof _0x14096b[_0xd6e3('0x85')]){return _0x40faff(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x14096b[_0xd6e3('0x86')]){return _0x40faff(new Error(_0xd6e3('0x87')));}if(_0x14096b[_0xd6e3('0x3d')]===_0xd6e3('0x88')){if('undefined'==typeof _0x14096b[_0xd6e3('0x86')]['views']){return _0x40faff(new Error(_0xd6e3('0x89')));}if(_0xd6e3('0x28')==typeof _0x14096b[_0xd6e3('0x86')]['views']['admin']&&_0xd6e3('0x28')==typeof _0x14096b[_0xd6e3('0x86')]['views'][_0xd6e3('0x8a')]){return _0x40faff(new Error(_0xd6e3('0x8b')));}}else if(_0x14096b[_0xd6e3('0x3d')]==='script'){if(_0xd6e3('0x28')==typeof _0x14096b[_0xd6e3('0x86')][_0xd6e3('0x8c')]){return _0x40faff(new Error(_0xd6e3('0x8d')));}if(_0xd6e3('0x28')==typeof _0x14096b[_0xd6e3('0x86')]['scriptPath']){return _0x40faff(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x40faff(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x138222=_0x14096b[_0xd6e3('0x37')];var _0x236699=_0x14096b[_0xd6e3('0x8e')];var _0x4a0d9d=_0x14096b['type'];var _0x19fed5=_0x14096b['sidebar']?_0x14096b[_0xd6e3('0x8f')]:_0xd6e3('0x90');var _0x3cf95a=_0x14096b[_0xd6e3('0x91')]?_0x14096b[_0xd6e3('0x91')]:'icon-apps';var _0x10bb43='';var _0x147bfb='';var _0x36ef37='';var _0x445275='';var _0x4a64c3=_0x14096b[_0xd6e3('0x85')];if(_0x4a0d9d===_0xd6e3('0x88')){if(_0xd6e3('0x28')!=typeof _0x14096b[_0xd6e3('0x86')][_0xd6e3('0x92')][_0xd6e3('0x93')]){var _0xd5d699=_0x14096b[_0xd6e3('0x86')]['views'][_0xd6e3('0x93')];if(!/^(f|ht)tps?:\/\//i[_0xd6e3('0x94')](_0xd5d699)){_0x10bb43=path[_0xd6e3('0x59')](_0xd6e3('0x95'),_0x55c155,_0x307961[0x0],_0xd5d699);}else{_0x10bb43=_0xd5d699;}}else{logger[_0xd6e3('0x72')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xd6e3('0x28')!=typeof _0x14096b['parameters'][_0xd6e3('0x92')]['agent']){var _0x72c881=_0x14096b[_0xd6e3('0x86')]['views'][_0xd6e3('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xd6e3('0x94')](_0x72c881)){_0x147bfb=path[_0xd6e3('0x59')]('plugins',_0x55c155,_0x307961[0x0],_0x72c881);}else{_0x147bfb=_0x72c881;}}else{logger[_0xd6e3('0x72')](_0xd6e3('0x96'));}}else if(_0x4a0d9d===_0xd6e3('0x97')){_0x36ef37=_0x14096b[_0xd6e3('0x86')]['scriptName'];_0x445275=_0x14096b[_0xd6e3('0x86')][_0xd6e3('0x98')];if(_0xd6e3('0x28')!=typeof _0x14096b['parameters'][_0xd6e3('0x92')]){if(_0xd6e3('0x28')!=typeof _0x14096b[_0xd6e3('0x86')][_0xd6e3('0x92')][_0xd6e3('0x93')]){var _0xd5d699=_0x14096b[_0xd6e3('0x86')][_0xd6e3('0x92')][_0xd6e3('0x93')];if(!/^(f|ht)tps?:\/\//i[_0xd6e3('0x94')](_0xd5d699)){_0x10bb43=path[_0xd6e3('0x59')](_0xd6e3('0x95'),_0x55c155,_0x307961[0x0],_0xd5d699);}else{_0x10bb43=_0xd5d699;}}if(_0xd6e3('0x28')!=typeof _0x14096b['parameters'][_0xd6e3('0x92')]['agent']){var _0x72c881=_0x14096b[_0xd6e3('0x86')][_0xd6e3('0x92')][_0xd6e3('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x72c881)){_0x147bfb=path['join'](_0xd6e3('0x95'),_0x55c155,_0x307961[0x0],_0x72c881);}else{_0x147bfb=_0x72c881;}}}}var _0x4870dc={'name':_0x138222,'description':_0x236699,'path':path[_0xd6e3('0x59')](_0x55c155,_0x307961[0x0]),'type':_0x4a0d9d,'sidebar':_0x19fed5,'icon':_0x3cf95a,'adminUrl':_0x10bb43,'agentUrl':_0x147bfb,'scriptName':_0x36ef37,'scriptPath':_0x445275,'version':_0x4a64c3};removeReferences(_0x3e6257,null);return db[_0xd6e3('0x3b')]['create'](_0x4870dc)[_0xd6e3('0x30')](function(_0x457731){var _0x3f5d28={'role':_0x336808[_0xd6e3('0x99')][_0xd6e3('0x9a')],'userProfileId':_0x336808[_0xd6e3('0x99')][_0xd6e3('0x9b')]};if(!_0x3f5d28)throw new Error(_0xd6e3('0x9c'));if(_0x3f5d28['role']===_0xd6e3('0x9d')){var _0x5add8d=_0x457731[_0xd6e3('0x32')]({'plain':!![]});return db[_0xd6e3('0x9e')][_0xd6e3('0x57')]({'where':{'name':_0xd6e3('0x33'),'userProfileId':_0x3f5d28[_0xd6e3('0x9b')]},'raw':!![]})[_0xd6e3('0x30')](function(_0x1c5220){if(_0x1c5220&&_0x1c5220[_0xd6e3('0x9f')]===0x0){return db['UserProfileResource'][_0xd6e3('0xa0')]({'name':_0x5add8d['name'],'resourceId':_0x5add8d['id'],'type':_0x1c5220[_0xd6e3('0x37')],'sectionId':_0x1c5220['id']},{})[_0xd6e3('0x30')](function(){return _0x457731;});}else{return _0x457731;}})[_0xd6e3('0x53')](function(_0x143606){logger['error'](_0xd6e3('0xa1'),_0x143606);throw _0x143606;});}return _0x457731;})[_0xd6e3('0x30')](respondWithResult(_0x55d656,null))[_0xd6e3('0x53')](handleError(_0x55d656,null));}});}catch(_0x137b1a){_0x55d656[_0xd6e3('0x24')](0x1f4)[_0xd6e3('0x38')](_0x137b1a);}};function removeReferences(_0x3e415f,_0x2a9b3a){try{if(_0x3e415f){fs[_0xd6e3('0xa2')](_0x3e415f);logger[_0xd6e3('0x72')](_0xd6e3('0xa3'));}if(_0x2a9b3a){rimraf(_0x2a9b3a,function(){});logger[_0xd6e3('0x72')](_0xd6e3('0xa4'));}}catch(_0x435063){logger[_0xd6e3('0x35')](_0x435063);}}exports[_0xd6e3('0x2f')]=function(_0x1821fc,_0x5d832f,_0x509d03){return db[_0xd6e3('0x3b')][_0xd6e3('0x57')]({'where':{'id':_0x1821fc[_0xd6e3('0x58')]['id']}})[_0xd6e3('0x30')](handleEntityNotFound(_0x5d832f,null))[_0xd6e3('0x30')](saveUpdates(_0x1821fc[_0xd6e3('0x99')],null))[_0xd6e3('0x30')](respondWithResult(_0x5d832f,null))[_0xd6e3('0x53')](handleError(_0x5d832f,null));};exports[_0xd6e3('0xa5')]=function(_0x563b43,_0x13d66d,_0x494cea){return db['Plugin'][_0xd6e3('0x57')]({'where':{'id':_0x563b43[_0xd6e3('0x58')]['id']}})[_0xd6e3('0x30')](function(_0x4a55fc){if(_0x4a55fc){return _0x4a55fc[_0xd6e3('0x31')]();}})[_0xd6e3('0x30')](function(_0xf087c4){rimraf(path['join'](config[_0xd6e3('0x5a')],_0xd6e3('0x67'),path[_0xd6e3('0x68')](_0xf087c4[_0xd6e3('0x8')])),function(){});return _0xf087c4;})['then'](handleEntityNotFound(_0x13d66d,null))[_0xd6e3('0x30')](respondWithStatusCode(_0x13d66d,null))['catch'](handleError(_0x13d66d,null));};exports[_0xd6e3('0xa6')]=function(_0x4c86ef,_0x3136ef,_0x512d8e){return BPromise[_0xd6e3('0xa7')]()[_0xd6e3('0x30')](function(){if(!_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0x8')]){throw new Error(_0xd6e3('0xa8'));}if(!_0x4c86ef[_0xd6e3('0x40')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x170081=_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0xa9')]?_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0xa9')]+':'+_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0xaa')]:_0xd6e3('0xab')+_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0xaa')];var _0x96926f=_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0x26')]?_0x4c86ef[_0xd6e3('0x40')]['json']:!![];var _0x115255=_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0xac')]?_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0xac')]:null;var _0x250106={'method':_0x4c86ef[_0xd6e3('0xad')],'uri':util[_0xd6e3('0x70')](_0xd6e3('0xae'),_0x170081,_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0x8')]),'json':_0x96926f,'resolveWithFullResponse':!![],'encoding':_0x115255,'qs':_0x4c86ef['query']};if(_0x4c86ef[_0xd6e3('0xaf')]){_0x250106['headers']=_0x4c86ef['headers'];if(_0x250106[_0xd6e3('0xaf')][_0xd6e3('0xb0')]){delete _0x250106[_0xd6e3('0xaf')][_0xd6e3('0xb0')];}}if(_0x250106[_0xd6e3('0xaf')][_0xd6e3('0xb1')]){delete _0x250106[_0xd6e3('0xaf')]['content-type'];}return rp(_0x250106);})['then'](function(_0x5adc1e){if(_0x5adc1e){_0x3136ef[_0xd6e3('0x2b')](_0x5adc1e[_0xd6e3('0xaf')]);logger['info'](_0x5adc1e[_0xd6e3('0x99')]);if(_[_0xd6e3('0xb2')](_0x4c86ef[_0xd6e3('0x40')][_0xd6e3('0x8')],_0xd6e3('0x6f'))&&_0x5adc1e['statusCode']==0x1f4){return _0x3136ef[_0xd6e3('0x23')](_0x5adc1e[_0xd6e3('0xb3')]);}else{return _0x3136ef[_0xd6e3('0x24')](_0x5adc1e['statusCode'])[_0xd6e3('0x38')](_0x5adc1e[_0xd6e3('0x99')]);}}else{return _0x3136ef[_0xd6e3('0x23')](0xc8);}})[_0xd6e3('0x53')](handleError(_0x3136ef,null));};exports[_0xd6e3('0xb4')]=function(_0x478c8a,_0x249dd1,_0x38b59b){return BPromise[_0xd6e3('0xa7')]()[_0xd6e3('0x30')](function(){if(!_0x478c8a[_0xd6e3('0x40')][_0xd6e3('0x8')]){throw new Error(_0xd6e3('0xa8'));}if(!_0x478c8a[_0xd6e3('0x40')][_0xd6e3('0xaa')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x17b0a3=_0x478c8a['query']['hostname']?_0x478c8a['query'][_0xd6e3('0xa9')]+':'+_0x478c8a[_0xd6e3('0x40')][_0xd6e3('0xaa')]:_0xd6e3('0xab')+_0x478c8a['query'][_0xd6e3('0xaa')];var _0x59b973=_0x478c8a[_0xd6e3('0x40')][_0xd6e3('0x26')]?_0x478c8a[_0xd6e3('0x40')][_0xd6e3('0x26')]:!![];var _0x147fa4=_0x478c8a[_0xd6e3('0x40')][_0xd6e3('0xac')]?_0x478c8a['query'][_0xd6e3('0xac')]:null;var _0x5333d3={'method':_0x478c8a[_0xd6e3('0xad')],'uri':util[_0xd6e3('0x70')]('%s%s',_0x17b0a3,_0x478c8a[_0xd6e3('0x40')][_0xd6e3('0x8')]),'json':_0x59b973,'resolveWithFullResponse':!![],'encoding':_0x147fa4,'body':_0x478c8a[_0xd6e3('0x99')]};if(_0x478c8a['headers']){_0x5333d3['headers']=_0x478c8a[_0xd6e3('0xaf')];if(_0x5333d3[_0xd6e3('0xaf')][_0xd6e3('0xb0')]){delete _0x5333d3[_0xd6e3('0xaf')]['content-length'];}}if(_0x5333d3['headers']['content-type']){delete _0x5333d3[_0xd6e3('0xaf')][_0xd6e3('0xb1')];}return rp(_0x5333d3);})[_0xd6e3('0x30')](function(_0x2fc58b){if(_0x2fc58b){_0x249dd1['set'](_0x2fc58b[_0xd6e3('0xaf')]);logger[_0xd6e3('0x72')](_0x2fc58b[_0xd6e3('0x99')]);return _0x249dd1[_0xd6e3('0x24')](_0x2fc58b[_0xd6e3('0xb3')])['send'](_0x2fc58b[_0xd6e3('0x99')]);}else{return _0x249dd1[_0xd6e3('0x23')](0xc8);}})[_0xd6e3('0x53')](handleError(_0x249dd1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5d35a55..35ac3d6 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 _0x423b=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0xd3bd6d,_0x52e574){var _0x2e1ecd=function(_0x17cee2){while(--_0x17cee2){_0xd3bd6d['push'](_0xd3bd6d['shift']());}};_0x2e1ecd(++_0x52e574);}(_0x423b,0x12b));var _0xb423=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x423b[_0x32b542];return _0x554d54;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xb423('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xb423('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb423('0x2'),'afterDestroy':'remove'};function emitEvent(_0x57cd26){return function(_0x50f31a,_0x2fa5da,_0x5f207d){PluginEvents['emit'](_0x57cd26+':'+_0x50f31a['id'],_0x50f31a);PluginEvents[_0xb423('0x3')](_0x57cd26,_0x50f31a);_0x5f207d(null);};}for(var e in events){if(events[_0xb423('0x4')](e)){var event=events[e];Plugin[_0xb423('0x5')](e,emitEvent(event));}}module[_0xb423('0x6')]=PluginEvents; \ No newline at end of file +var _0xd9ef=['hook','exports','events','../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0x416d75,_0x2c8e81){var _0x10af66=function(_0x48f136){while(--_0x48f136){_0x416d75['push'](_0x416d75['shift']());}};_0x10af66(++_0x2c8e81);}(_0xd9ef,0x95));var _0xfd9e=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0xd9ef[_0x7f5123];return _0x10a02a;};'use strict';var EventEmitter=require(_0xfd9e('0x0'));var Plugin=require(_0xfd9e('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xfd9e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xdce9ae){return function(_0x28cfac,_0xe6990b,_0x1b2b0c){PluginEvents[_0xfd9e('0x3')](_0xdce9ae+':'+_0x28cfac['id'],_0x28cfac);PluginEvents[_0xfd9e('0x3')](_0xdce9ae,_0x28cfac);_0x1b2b0c(null);};}for(var e in events){if(events[_0xfd9e('0x4')](e)){var event=events[e];Plugin[_0xfd9e('0x5')](e,emitEvent(event));}}module[_0xfd9e('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 173d142..f828c56 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 _0x54ac=['./plugin.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5d9084,_0x215c91){var _0x28f2cb=function(_0x482b12){while(--_0x482b12){_0x5d9084['push'](_0x5d9084['shift']());}};_0x28f2cb(++_0x215c91);}(_0x54ac,0x12f));var _0xc54a=function(_0xe7d655,_0x184955){_0xe7d655=_0xe7d655-0x0;var _0x3e4804=_0x54ac[_0xe7d655];return _0x3e4804;};'use strict';var _=require(_0xc54a('0x0'));var util=require(_0xc54a('0x1'));var logger=require(_0xc54a('0x2'))(_0xc54a('0x3'));var moment=require(_0xc54a('0x4'));var BPromise=require(_0xc54a('0x5'));var rp=require(_0xc54a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc54a('0x7'));var config=require(_0xc54a('0x8'));var attributes=require(_0xc54a('0x9'));module[_0xc54a('0xa')]=function(_0x43072b,_0x529d21){return _0x43072b[_0xc54a('0xb')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb8b=['rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','util','../../config/logger','moment','bluebird','path'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xcb8b,0xc7));var _0xbcb8=function(_0x38e391,_0x5adde7){_0x38e391=_0x38e391-0x0;var _0x244319=_0xcb8b[_0x38e391];return _0x244319;};'use strict';var _=require('lodash');var util=require(_0xbcb8('0x0'));var logger=require(_0xbcb8('0x1'))('api');var moment=require(_0xbcb8('0x2'));var BPromise=require(_0xbcb8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcb8('0x4'));var rimraf=require(_0xbcb8('0x5'));var config=require(_0xbcb8('0x6'));var attributes=require(_0xbcb8('0x7'));module[_0xbcb8('0x8')]=function(_0x429636,_0x29fbcd){return _0x429636[_0xbcb8('0x9')](_0xbcb8('0xa'),attributes,{'tableName':_0xbcb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 6179142..807543c 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 _0xa5ca=['./plugin.socket','register','request','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','Plugin','body','options','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x13be32,_0x43266c){var _0x2a073b=function(_0x1f63ba){while(--_0x1f63ba){_0x13be32['push'](_0x13be32['shift']());}};_0x2a073b(++_0x43266c);}(_0xa5ca,0x173));var _0xaa5c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa5ca[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var moment=require(_0xaa5c('0x2'));var BPromise=require(_0xaa5c('0x3'));var rs=require(_0xaa5c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa5c('0x6'))('rpc');var config=require(_0xaa5c('0x7'));var jayson=require(_0xaa5c('0x8'));var client=jayson[_0xaa5c('0x9')]['http']({'port':0x232a});config[_0xaa5c('0xa')]=_[_0xaa5c('0xb')](config[_0xaa5c('0xa')],{'host':_0xaa5c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa5c('0xa')]));require(_0xaa5c('0xd'))[_0xaa5c('0xe')](socket);function respondWithRpcPromise(_0x2b4415,_0x237502,_0x45adbe){return new BPromise(function(_0x6df29c,_0xe483d8){return client[_0xaa5c('0xf')](_0x2b4415,_0x45adbe)[_0xaa5c('0x10')](function(_0x4473bb){logger[_0xaa5c('0x11')]('Plugin,\x20%s,\x20%s',_0x237502,'request\x20sent');logger[_0xaa5c('0x12')](_0xaa5c('0x13'),_0x237502,_0xaa5c('0x14'),JSON[_0xaa5c('0x15')](_0x4473bb));if(_0x4473bb[_0xaa5c('0x16')]){if(_0x4473bb[_0xaa5c('0x16')][_0xaa5c('0x17')]===0x1f4){logger['error'](_0xaa5c('0x18'),_0x237502,_0x4473bb[_0xaa5c('0x16')][_0xaa5c('0x19')]);return _0xe483d8(_0x4473bb[_0xaa5c('0x16')][_0xaa5c('0x19')]);}logger[_0xaa5c('0x16')](_0xaa5c('0x18'),_0x237502,_0x4473bb[_0xaa5c('0x16')][_0xaa5c('0x19')]);return _0x6df29c(_0x4473bb[_0xaa5c('0x16')][_0xaa5c('0x19')]);}else{logger[_0xaa5c('0x11')](_0xaa5c('0x18'),_0x237502,_0xaa5c('0x14'));_0x6df29c(_0x4473bb[_0xaa5c('0x1a')][_0xaa5c('0x19')]);}})['catch'](function(_0x1fddcc){logger[_0xaa5c('0x16')]('Plugin,\x20%s,\x20%s',_0x237502,_0x1fddcc);_0xe483d8(_0x1fddcc);});});}exports[_0xaa5c('0x1b')]=function(_0x2733fb){var _0x3268cd=this;return new Promise(function(_0x26726d,_0x58abfb){return db[_0xaa5c('0x1c')]['create'](_0x2733fb[_0xaa5c('0x1d')],{'raw':_0x2733fb[_0xaa5c('0x1e')]?_0x2733fb[_0xaa5c('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xaa5c('0x10')](function(_0x41bb3c){logger[_0xaa5c('0x11')]('CreatePlugin',_0x2733fb);logger[_0xaa5c('0x12')](_0xaa5c('0x1b'),_0x2733fb,JSON[_0xaa5c('0x15')](_0x41bb3c));_0x26726d(_0x41bb3c);})[_0xaa5c('0x1f')](function(_0xa6a1be){logger['error']('CreatePlugin',_0xa6a1be[_0xaa5c('0x19')],_0x2733fb);_0x58abfb(_0x3268cd[_0xaa5c('0x16')](0x1f4,_0xa6a1be[_0xaa5c('0x19')]));});});}; \ No newline at end of file +var _0xbf73=['localhost','socket.io-emitter','register','then','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreatePlugin','create','body','options','raw','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults'];(function(_0x525595,_0x5a70f1){var _0x30c04f=function(_0x219b29){while(--_0x219b29){_0x525595['push'](_0x525595['shift']());}};_0x30c04f(++_0x5a70f1);}(_0xbf73,0x1dc));var _0x3bf7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbf73[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x3bf7('0x0'));var moment=require(_0x3bf7('0x1'));var BPromise=require(_0x3bf7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bf7('0x3'))['db'];var utils=require(_0x3bf7('0x4'));var logger=require(_0x3bf7('0x5'))(_0x3bf7('0x6'));var config=require(_0x3bf7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3bf7('0x8')]=_[_0x3bf7('0x9')](config['redis'],{'host':_0x3bf7('0xa'),'port':0x18eb});var socket=require(_0x3bf7('0xb'))(new Redis(config['redis']));require('./plugin.socket')[_0x3bf7('0xc')](socket);function respondWithRpcPromise(_0x33c476,_0x1a9f5a,_0x50a1cb){return new BPromise(function(_0x4eb8c5,_0x532304){return client['request'](_0x33c476,_0x50a1cb)[_0x3bf7('0xd')](function(_0x588cbb){logger['info'](_0x3bf7('0xe'),_0x1a9f5a,_0x3bf7('0xf'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x1a9f5a,_0x3bf7('0xf'),JSON[_0x3bf7('0x10')](_0x588cbb));if(_0x588cbb[_0x3bf7('0x11')]){if(_0x588cbb[_0x3bf7('0x11')][_0x3bf7('0x12')]===0x1f4){logger['error'](_0x3bf7('0xe'),_0x1a9f5a,_0x588cbb[_0x3bf7('0x11')][_0x3bf7('0x13')]);return _0x532304(_0x588cbb[_0x3bf7('0x11')][_0x3bf7('0x13')]);}logger[_0x3bf7('0x11')](_0x3bf7('0xe'),_0x1a9f5a,_0x588cbb['error'][_0x3bf7('0x13')]);return _0x4eb8c5(_0x588cbb['error'][_0x3bf7('0x13')]);}else{logger[_0x3bf7('0x14')](_0x3bf7('0xe'),_0x1a9f5a,_0x3bf7('0xf'));_0x4eb8c5(_0x588cbb['result'][_0x3bf7('0x13')]);}})[_0x3bf7('0x15')](function(_0x56f13c){logger[_0x3bf7('0x11')](_0x3bf7('0xe'),_0x1a9f5a,_0x56f13c);_0x532304(_0x56f13c);});});}exports[_0x3bf7('0x16')]=function(_0x3a922e){var _0x19a96d=this;return new Promise(function(_0x1a93e9,_0x3c44cc){return db['Plugin'][_0x3bf7('0x17')](_0x3a922e[_0x3bf7('0x18')],{'raw':_0x3a922e[_0x3bf7('0x19')]?_0x3a922e['options'][_0x3bf7('0x1a')]===undefined?!![]:![]:!![]})[_0x3bf7('0xd')](function(_0x3067c6){logger[_0x3bf7('0x14')](_0x3bf7('0x16'),_0x3a922e);logger['debug'](_0x3bf7('0x16'),_0x3a922e,JSON['stringify'](_0x3067c6));_0x1a93e9(_0x3067c6);})[_0x3bf7('0x15')](function(_0x2eef3d){logger['error'](_0x3bf7('0x16'),_0x2eef3d['message'],_0x3a922e);_0x3c44cc(_0x19a96d['error'](0x1f4,_0x2eef3d[_0x3bf7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 6858bf2..314927e 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 _0xb563=['plugin:','./plugin.events','save','remove','update','register','length'];(function(_0x260b48,_0x117977){var _0x3f730b=function(_0x7a1e53){while(--_0x7a1e53){_0x260b48['push'](_0x260b48['shift']());}};_0x3f730b(++_0x117977);}(_0xb563,0x189));var _0x3b56=function(_0x22a9c7,_0x36a73a){_0x22a9c7=_0x22a9c7-0x0;var _0x534b53=_0xb563[_0x22a9c7];return _0x534b53;};'use strict';var PluginEvents=require(_0x3b56('0x0'));var events=[_0x3b56('0x1'),_0x3b56('0x2'),_0x3b56('0x3')];function createListener(_0x3700cc,_0x5aa42e){return function(_0xf4b67b){_0x5aa42e['emit'](_0x3700cc,_0xf4b67b);};}function removeListener(_0x223f3d,_0x40272a){return function(){PluginEvents['removeListener'](_0x223f3d,_0x40272a);};}exports[_0x3b56('0x4')]=function(_0x2c7d0e){for(var _0x495941=0x0,_0x289d73=events[_0x3b56('0x5')];_0x495941<_0x289d73;_0x495941++){var _0x235dc9=events[_0x495941];var _0x3c0835=createListener(_0x3b56('0x6')+_0x235dc9,_0x2c7d0e);PluginEvents['on'](_0x235dc9,_0x3c0835);}}; \ No newline at end of file +var _0xee56=['plugin:','./plugin.events','save','remove','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee56,0x1e4));var _0x6ee5=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xee56[_0x4cc492];return _0x1f36b9;};'use strict';var PluginEvents=require(_0x6ee5('0x0'));var events=[_0x6ee5('0x1'),_0x6ee5('0x2'),'update'];function createListener(_0x50439c,_0x2c74a3){return function(_0x362e9a){_0x2c74a3[_0x6ee5('0x3')](_0x50439c,_0x362e9a);};}function removeListener(_0x3c0da7,_0x18658d){return function(){PluginEvents[_0x6ee5('0x4')](_0x3c0da7,_0x18658d);};}exports[_0x6ee5('0x5')]=function(_0x2356aa){for(var _0x1d2e7a=0x0,_0x44428e=events['length'];_0x1d2e7a<_0x44428e;_0x1d2e7a++){var _0x26ddc0=events[_0x1d2e7a];var _0x15212c=createListener(_0x6ee5('0x6')+_0x26ddc0,_0x2356aa);PluginEvents['on'](_0x26ddc0,_0x15212c);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a2bd7fe..50ac260 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(_0x232c51,_0x59334c){var _0x5ae4a2=function(_0x43ee6d){while(--_0x43ee6d){_0x232c51['push'](_0x232c51['shift']());}};_0x5ae4a2(++_0x59334c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x5e4194,_0x33719b){var _0x9eb876=function(_0x2d26dd){while(--_0x2d26dd){_0x5e4194['push'](_0x5e4194['shift']());}};_0x9eb876(++_0x33719b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 1ddd2fe..7bf47c8 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 _0x6e6c=['script','join','cwd','dirname','chdir','start','dump','update','restart','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','bluebird','sendStatus','status','error','name','send','npm\x20install','info','index','then','reject','express','length','catch','describe','create','body'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e6('0x0'));var pm2=require(_0xc6e6('0x1'));var logger=require('../../config/logger')(_0xc6e6('0x2'));var path=require(_0xc6e6('0x3'));var exec=require('child_process')['exec'];var BPromise=require(_0xc6e6('0x4'));function handleEntityNotFound(_0x5a9e2b,_0x40b7e1){return function(_0x4b13f0){if(!_0x4b13f0){_0x5a9e2b[_0xc6e6('0x5')](0x194);;}return _0x4b13f0;};}function respondWithResult(_0x1182c7,_0x4bf906){_0x4bf906=_0x4bf906||0xc8;return function(_0x301f55){if(_0x301f55){return _0x1182c7[_0xc6e6('0x6')](_0x4bf906)['json'](_0x301f55);}return null;};}function handleError(_0x324706,_0x15d268){_0x15d268=_0x15d268||0x1f4;return function(_0x5a7ef3){logger[_0xc6e6('0x7')](_0x5a7ef3['stack']);if(_0x5a7ef3[_0xc6e6('0x8')]){delete _0x5a7ef3[_0xc6e6('0x8')];}_0x324706[_0xc6e6('0x6')](_0x15d268)[_0xc6e6('0x9')](_0x5a7ef3);};}function execChildProcess(){return new BPromise(function(_0x12596b,_0xbf9ffc){exec(_0xc6e6('0xa'),function(_0x10aae5,_0x2c205d,_0x58540d){logger[_0xc6e6('0xb')](_0x2c205d);logger['info'](_0x58540d);if(_0x10aae5){logger[_0xc6e6('0x7')](_0x10aae5);return _0xbf9ffc(_0x10aae5);}return _0x12596b(_0x2c205d);});});}exports[_0xc6e6('0xc')]=function(_0x33aea0,_0x13c8d5){return pm2['list']()[_0xc6e6('0xd')](function(_0x2bfe7d){if(_0x2bfe7d){var _0x13be73=_[_0xc6e6('0xe')](_0x2bfe7d,function(_0x102673){return _0x102673['name']===_0xc6e6('0xf')||_0x102673[_0xc6e6('0x8')]==='motion2';});return{'rows':_0x13be73,'count':_0x13be73[_0xc6e6('0x10')]};}return null;})[_0xc6e6('0xd')](respondWithResult(_0x13c8d5,null))[_0xc6e6('0x11')](handleError(_0x13c8d5,null));};exports['show']=function(_0x51fd7c,_0x5867bf){return pm2[_0xc6e6('0x12')](_0x51fd7c['params']['id'])[_0xc6e6('0xd')](respondWithResult(_0x5867bf,null))[_0xc6e6('0xd')](handleEntityNotFound(_0x5867bf,null))[_0xc6e6('0x11')](handleError(_0x5867bf,null));};exports[_0xc6e6('0x13')]=function(_0x19e1e4,_0x3a0d83){if(_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x8')]&&_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x15')]){var _0x4a36b6=path[_0xc6e6('0x16')](__dirname,'../../files/plugins',_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x15')]);var _0x2be6fc=process[_0xc6e6('0x17')]();process['chdir'](path[_0xc6e6('0x18')](_0x4a36b6));return execChildProcess()[_0xc6e6('0xd')](function(_0x3a96df){process[_0xc6e6('0x19')](_0x2be6fc);return pm2[_0xc6e6('0x1a')]({'name':_0x19e1e4['body'][_0xc6e6('0x8')],'script':_0x4a36b6});})['then'](function(_0x266786){pm2[_0xc6e6('0x1b')]();return _0x266786[0x0];})[_0xc6e6('0xd')](respondWithResult(_0x3a0d83,0xc9))[_0xc6e6('0x11')](handleError(_0x3a0d83,null));}else{return _0x3a0d83['status'](0x1f4)[_0xc6e6('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xc6e6('0x1c')]=function(_0x534745,_0x267c6a){if(_0x534745[_0xc6e6('0x14')]['id']){delete _0x534745[_0xc6e6('0x14')]['id'];}var _0x41e7c2={'online':_0xc6e6('0x1d'),'stopped':'stop'};if(_0x41e7c2[_0xc6e6('0x1e')](_0x534745[_0xc6e6('0x14')][_0xc6e6('0x6')])){return pm2[_0x41e7c2[_0x534745[_0xc6e6('0x14')]['status']]](_0x534745[_0xc6e6('0x1f')]['id'])['then'](respondWithResult(_0x267c6a,0xc8))[_0xc6e6('0x11')](handleError(_0x267c6a,null));}else{return _0x267c6a[_0xc6e6('0x6')](0x1f4)[_0xc6e6('0x9')]({'message':_0xc6e6('0x20')});}};exports[_0xc6e6('0x21')]=function(_0x402598,_0x43ff9c){if(_0x402598[_0xc6e6('0x14')]['id']){delete _0x402598[_0xc6e6('0x14')]['id'];}if(_0x402598[_0xc6e6('0x1f')]['id']){return pm2[_0xc6e6('0x22')](_0x402598[_0xc6e6('0x1f')]['id'])[_0xc6e6('0xd')](function(_0x410ba5){pm2[_0xc6e6('0x1b')]();return _0x410ba5[0x0];})[_0xc6e6('0xd')](respondWithResult(_0x43ff9c,null))[_0xc6e6('0x11')](handleError(_0x43ff9c,null));}else{return _0x43ff9c['status'](0x1f4)[_0xc6e6('0x9')]({'message':_0xc6e6('0x23')});}}; \ No newline at end of file +var _0x4ded=['name','express','motion2','catch','show','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','params','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','send','info','index','list','then','reject'];(function(_0x574deb,_0x4e0b8e){var _0x3fee34=function(_0x4f52c2){while(--_0x4f52c2){_0x574deb['push'](_0x574deb['shift']());}};_0x3fee34(++_0x4e0b8e);}(_0x4ded,0x116));var _0xd4de=function(_0x4b8dc3,_0x365d55){_0x4b8dc3=_0x4b8dc3-0x0;var _0x45472c=_0x4ded[_0x4b8dc3];return _0x45472c;};'use strict';var _=require(_0xd4de('0x0'));var pm2=require(_0xd4de('0x1'));var logger=require(_0xd4de('0x2'))(_0xd4de('0x3'));var path=require(_0xd4de('0x4'));var exec=require(_0xd4de('0x5'))[_0xd4de('0x6')];var BPromise=require(_0xd4de('0x7'));function handleEntityNotFound(_0x20930f,_0x36d4dd){return function(_0x2e8d86){if(!_0x2e8d86){_0x20930f[_0xd4de('0x8')](0x194);;}return _0x2e8d86;};}function respondWithResult(_0x554a51,_0x23e5b9){_0x23e5b9=_0x23e5b9||0xc8;return function(_0x2433b8){if(_0x2433b8){return _0x554a51[_0xd4de('0x9')](_0x23e5b9)[_0xd4de('0xa')](_0x2433b8);}return null;};}function handleError(_0x4453c2,_0x1e8c35){_0x1e8c35=_0x1e8c35||0x1f4;return function(_0x5c612f){logger[_0xd4de('0xb')](_0x5c612f['stack']);if(_0x5c612f['name']){delete _0x5c612f['name'];}_0x4453c2[_0xd4de('0x9')](_0x1e8c35)[_0xd4de('0xc')](_0x5c612f);};}function execChildProcess(){return new BPromise(function(_0x4e5b10,_0x5b6dc4){exec('npm\x20install',function(_0x29e265,_0x49d931,_0x38ac13){logger[_0xd4de('0xd')](_0x49d931);logger[_0xd4de('0xd')](_0x38ac13);if(_0x29e265){logger[_0xd4de('0xb')](_0x29e265);return _0x5b6dc4(_0x29e265);}return _0x4e5b10(_0x49d931);});});}exports[_0xd4de('0xe')]=function(_0x3af6e0,_0x1dc9d5){return pm2[_0xd4de('0xf')]()[_0xd4de('0x10')](function(_0x37cb9f){if(_0x37cb9f){var _0x691ba9=_[_0xd4de('0x11')](_0x37cb9f,function(_0x164ca0){return _0x164ca0[_0xd4de('0x12')]===_0xd4de('0x13')||_0x164ca0[_0xd4de('0x12')]===_0xd4de('0x14');});return{'rows':_0x691ba9,'count':_0x691ba9['length']};}return null;})['then'](respondWithResult(_0x1dc9d5,null))[_0xd4de('0x15')](handleError(_0x1dc9d5,null));};exports[_0xd4de('0x16')]=function(_0x17b377,_0x428aa2){return pm2['describe'](_0x17b377['params']['id'])[_0xd4de('0x10')](respondWithResult(_0x428aa2,null))['then'](handleEntityNotFound(_0x428aa2,null))[_0xd4de('0x15')](handleError(_0x428aa2,null));};exports[_0xd4de('0x17')]=function(_0x50b9e3,_0xc15081){if(_0x50b9e3['body'][_0xd4de('0x12')]&&_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x19')]){var _0x8e8712=path['join'](__dirname,_0xd4de('0x1a'),_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x19')]);var _0xdb3fc=process[_0xd4de('0x1b')]();process[_0xd4de('0x1c')](path[_0xd4de('0x1d')](_0x8e8712));return execChildProcess()[_0xd4de('0x10')](function(_0x2f9de6){process[_0xd4de('0x1c')](_0xdb3fc);return pm2['start']({'name':_0x50b9e3[_0xd4de('0x18')][_0xd4de('0x12')],'script':_0x8e8712});})[_0xd4de('0x10')](function(_0x22970c){pm2[_0xd4de('0x1e')]();return _0x22970c[0x0];})[_0xd4de('0x10')](respondWithResult(_0xc15081,0xc9))[_0xd4de('0x15')](handleError(_0xc15081,null));}else{return _0xc15081[_0xd4de('0x9')](0x1f4)[_0xd4de('0xc')]({'message':_0xd4de('0x1f')});}};exports[_0xd4de('0x20')]=function(_0xb2d8a1,_0x586126){if(_0xb2d8a1[_0xd4de('0x18')]['id']){delete _0xb2d8a1[_0xd4de('0x18')]['id'];}var _0x5005b0={'online':_0xd4de('0x21'),'stopped':'stop'};if(_0x5005b0[_0xd4de('0x22')](_0xb2d8a1[_0xd4de('0x18')][_0xd4de('0x9')])){return pm2[_0x5005b0[_0xb2d8a1['body'][_0xd4de('0x9')]]](_0xb2d8a1[_0xd4de('0x23')]['id'])[_0xd4de('0x10')](respondWithResult(_0x586126,0xc8))['catch'](handleError(_0x586126,null));}else{return _0x586126[_0xd4de('0x9')](0x1f4)[_0xd4de('0xc')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x5706fe,_0x3f6491){if(_0x5706fe['body']['id']){delete _0x5706fe[_0xd4de('0x18')]['id'];}if(_0x5706fe[_0xd4de('0x23')]['id']){return pm2[_0xd4de('0x24')](_0x5706fe[_0xd4de('0x23')]['id'])['then'](function(_0x3fe6c8){pm2[_0xd4de('0x1e')]();return _0x3fe6c8[0x0];})['then'](respondWithResult(_0x3f6491,null))[_0xd4de('0x15')](handleError(_0x3f6491,null));}else{return _0x3f6491[_0xd4de('0x9')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 44e0c02..cc4ec85 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 _0x73e8=['express','Router','./realtime.controller','/agents','isAuthenticated','getAgents','get','/queues','getQueues','exports'];(function(_0x3bb947,_0x34b6f3){var _0x122b67=function(_0x49cf0a){while(--_0x49cf0a){_0x3bb947['push'](_0x3bb947['shift']());}};_0x122b67(++_0x34b6f3);}(_0x73e8,0xe6));var _0x873e=function(_0x476ad1,_0x5d950f){_0x476ad1=_0x476ad1-0x0;var _0x3ea37f=_0x73e8[_0x476ad1];return _0x3ea37f;};'use strict';var express=require(_0x873e('0x0'));var router=express[_0x873e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x873e('0x2'));router['get'](_0x873e('0x3'),auth[_0x873e('0x4')](),controller[_0x873e('0x5')]);router[_0x873e('0x6')](_0x873e('0x7'),auth[_0x873e('0x4')](),controller[_0x873e('0x8')]);module[_0x873e('0x9')]=router; \ No newline at end of file +var _0xd6d1=['get','/agents','isAuthenticated','getAgents','/queues','getQueues','express','Router','../../components/auth/service','./realtime.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6d1,0x6a));var _0x1d6d=function(_0x630c54,_0x12c462){_0x630c54=_0x630c54-0x0;var _0x496c56=_0xd6d1[_0x630c54];return _0x496c56;};'use strict';var express=require(_0x1d6d('0x0'));var router=express[_0x1d6d('0x1')]();var auth=require(_0x1d6d('0x2'));var controller=require(_0x1d6d('0x3'));router[_0x1d6d('0x4')](_0x1d6d('0x5'),auth[_0x1d6d('0x6')](),controller[_0x1d6d('0x7')]);router['get'](_0x1d6d('0x8'),auth['isAuthenticated'](),controller[_0x1d6d('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index ab00c60..ab65d09 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 _0xb979=['Channel\x20parameter\x20%s\x20is\x20invalid','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','fieldName','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','merge','user','role','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','rows','map','find','getAgentStatus','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','startCase','Queue','rawAttributes','name','type','outbound','dialActive','dialMethod','fields','findAndCountAll','initializeQueues','util','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','APIBadRequestError','../../errors/api','handleError','undefined','limit','offset','count','set','Content-Range','getAgents','getChannels','globalQueueFilter','globalStatusFilter','query','pauseTypeFilter','pause','*pause','resolve','then','isValidChannel','format'];(function(_0x2e5399,_0x26f34c){var _0x4716f6=function(_0x1a63d0){while(--_0x1a63d0){_0x2e5399['push'](_0x2e5399['shift']());}};_0x4716f6(++_0x26f34c);}(_0xb979,0x17c));var _0x9b97=function(_0x5c41a9,_0x877797){_0x5c41a9=_0x5c41a9-0x0;var _0x55e332=_0xb979[_0x5c41a9];return _0x55e332;};'use strict';var _=require('lodash');var util=require(_0x9b97('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0x9b97('0x1'));var qs=require(_0x9b97('0x2'));var utils=require('../../config/utils');var db=require(_0x9b97('0x3'))['db'];var APIBadRequestError=require('../../errors/api')[_0x9b97('0x4')];var APIHandleError=require(_0x9b97('0x5'))[_0x9b97('0x6')];function respondWithFilteredResult(_0x448129,_0x499fc3){return function(_0x54a004){if(_0x54a004){var _0x52a465=typeof _0x499fc3['offset']===_0x9b97('0x7')&&typeof _0x499fc3[_0x9b97('0x8')]==='undefined';var _0x3237b3=_0x54a004['count'];var _0x464a98=_0x52a465?0x0:_0x499fc3[_0x9b97('0x9')];var _0x748d5a=_0x52a465?_0x54a004[_0x9b97('0xa')]:_0x499fc3[_0x9b97('0x9')]+_0x499fc3['limit'];var _0x16b777;if(_0x748d5a>=_0x3237b3){_0x748d5a=_0x3237b3;_0x16b777=0xc8;}else{_0x16b777=0xce;}_0x448129['status'](_0x16b777);return _0x448129[_0x9b97('0xb')](_0x9b97('0xc'),_0x464a98+'-'+_0x748d5a+'/'+_0x3237b3)['json'](_0x54a004);}return null;};}exports[_0x9b97('0xd')]=function(_0x14ed05,_0x25f0ca){var _0x3ef7e7={'count':0x0,'rows':[]};var _0x2dc4e3={};var _0x431f59;var _0x1961d8=utils[_0x9b97('0xe')]();var _0x3be349;var _0x5d283e;var _0x5574ee=_0x14ed05['query'][_0x9b97('0xf')];var _0x2f2b8e=_0x14ed05['query'][_0x9b97('0x10')];var _0x37b79d=_0x14ed05[_0x9b97('0x11')][_0x9b97('0x12')];var _0x21e7b1=_0x2f2b8e===_0x9b97('0x13')||_0x2f2b8e===_0x9b97('0x14')?!![]:![];var _0x170e6a=[];var _0x2a2ae1;var _0x514c4b;Promise[_0x9b97('0x15')]()[_0x9b97('0x16')](function(){if(_0x14ed05['query']['channel']){if(!utils[_0x9b97('0x17')](_0x14ed05['query']['channel'])){throw new APIBadRequestError(util[_0x9b97('0x18')](_0x9b97('0x19'),_0x14ed05[_0x9b97('0x11')][_0x9b97('0x1a')]));}_0x431f59=_0x14ed05[_0x9b97('0x11')][_0x9b97('0x1a')][_0x9b97('0x1b')]();}if(!_0x14ed05[_0x9b97('0x11')][_0x9b97('0x1c')]||!_0x14ed05['query'][_0x9b97('0x1c')][_0x9b97('0x1d')](_0x9b97('0x1e'))){_0x14ed05[_0x9b97('0x11')]['sort']=rta[_0x9b97('0x1f')](_0x14ed05[_0x9b97('0x11')]['sort']);return;}var _0x36819=rta[_0x9b97('0x20')](_0x14ed05[_0x9b97('0x11')][_0x9b97('0x1c')]);_0x14ed05[_0x9b97('0x11')][_0x9b97('0x1c')]=_0x36819['fields'][_0x9b97('0x21')](',');_0x2a2ae1=_0x36819['order'];})[_0x9b97('0x16')](function(){if(!_0x5574ee){return[];}return rta[_0x9b97('0x22')](_0x5574ee,_0x431f59);})[_0x9b97('0x16')](function(_0x3bb5ac){_0x170e6a=_0x3bb5ac;return rta[_0x9b97('0x23')]();})[_0x9b97('0x16')](function(_0x115f04){_0x5d283e=_0x115f04['rows'];if((!_0x2f2b8e||_0x21e7b1)&&!_0x2a2ae1){return _0x170e6a;}if(_0x2a2ae1&&!_0x2f2b8e){return rta[_0x9b97('0x24')](_0x5d283e,_0x170e6a,_0x2a2ae1);}else{return rta[_0x9b97('0x25')](_0x5d283e,_0x170e6a,_0x2f2b8e);}})['then'](function(_0x5ce6ed){_0x170e6a=_0x5ce6ed;var _0x509433=![];if(_0x170e6a[_0x9b97('0x26')]===0x0){if(_0x5574ee||_0x2f2b8e){_0x509433=!![];}if(_0x21e7b1){_0x509433=![];}}if(_0x509433){return _0x3ef7e7;}var _0x256c1e=_['map'](db[_0x9b97('0x27')]['rawAttributes'],function(_0x6be5f6){return{'name':_0x6be5f6[_0x9b97('0x28')],'type':_0x6be5f6['type']['key']};});_0x14ed05[_0x9b97('0x11')]['role']=_0x9b97('0x29');_0x2dc4e3=qs[_0x9b97('0x2a')](_0x256c1e,_0x14ed05);_0x2dc4e3[_0x9b97('0x2b')]=!![];var _0x400c41=[];if(_0x170e6a[_0x9b97('0x26')]>0x0){_0x400c41[_0x9b97('0x2c')]({'id':{'$in':_0x170e6a}});if(_0x2a2ae1&&!_0x2f2b8e){_0x514c4b=[db[_0x9b97('0x2d')][_0x9b97('0x2e')](_0x9b97('0x2f')+_0x170e6a+')')];_0x2dc4e3['order']=_0x514c4b;}}if(_0x21e7b1){_0x1961d8[_0x9b97('0x30')](function(_0x58f3c9){var _0x275e0b=!![];if(_0x2f2b8e===_0x9b97('0x14')&&_0x431f59!==_0x58f3c9){_0x275e0b=![];}_0x400c41[_0x9b97('0x2c')]({[_0x58f3c9+_0x9b97('0x31')]:_0x275e0b});});if(_0x37b79d){_0x400c41[_0x9b97('0x2c')]({'pauseType':_0x37b79d});}}else if(_0x2f2b8e){_0x1961d8['forEach'](function(_0x4e5bd8){_0x400c41[_0x9b97('0x2c')]({[_0x4e5bd8+'Pause']:![]});});}_0x2dc4e3['where']=_[_0x9b97('0x32')](_0x2dc4e3['where'],{'$and':_0x400c41});if(_0x14ed05[_0x9b97('0x33')][_0x9b97('0x34')]===_0x9b97('0x33')){var _0x5f164f={'params':{'id':_0x14ed05[_0x9b97('0x33')][_0x9b97('0x35')]},'query':{'section':_0x9b97('0x36'),'role':_0x9b97('0x29'),'raw':!![],'ids':_0x170e6a,'customSorting':_0x514c4b}};if(_0x14ed05[_0x9b97('0x11')][_0x9b97('0x37')]){_0x5f164f[_0x9b97('0x11')][_0x9b97('0x37')]=!![];}if(_0x21e7b1){_0x5f164f[_0x9b97('0x11')][_0x9b97('0x38')]=_0x400c41;}_0x5f164f['query']=Object[_0x9b97('0x39')](_0x5f164f['query'],_0x14ed05[_0x9b97('0x11')]);return db[_0x9b97('0x3a')][_0x9b97('0x3b')](_0x5f164f);}return db[_0x9b97('0x27')]['findAndCountAll'](_0x2dc4e3);})[_0x9b97('0x16')](function(_0x4a7019){_0x3ef7e7[_0x9b97('0xa')]=_0x4a7019[_0x9b97('0xa')];_0x3be349=_0x4a7019[_0x9b97('0x3c')];return _0x3be349[_0x9b97('0x3d')](function(_0x1ddcda){var _0x529950=_[_0x9b97('0x3e')](_0x5d283e,['id',_0x1ddcda['id']]);if(_0x529950){var _0x5d738f=rta['filterAgentAttributes'](_0x529950);_['merge'](_0x1ddcda,_0x5d738f);}_0x1ddcda[_0x9b97('0x1e')]=rta[_0x9b97('0x3f')](_0x1ddcda);if(_0x1ddcda['globalStatus'][_0x9b97('0x1d')]('pause')){_0x1961d8[_0x9b97('0x30')](function(_0x33ebac){if(_0x1ddcda[_0x33ebac+_0x9b97('0x31')]){if(_0x33ebac===_0x9b97('0x40')){if(_0x1ddcda[_0x9b97('0x41')]!==_0x9b97('0x42')){_0x1ddcda[_0x9b97('0x41')]=_0x9b97('0x13');}}else{_0x1ddcda[_0x33ebac+'Status']=_0x9b97('0x13');}}});}return _0x1ddcda;});})[_0x9b97('0x16')](function(_0x4283e9){if(!_0x2a2ae1||_0x514c4b){return _0x4283e9;}return rta[_0x9b97('0x43')](_0x4283e9,_0x2a2ae1);})[_0x9b97('0x16')](function(_0x3857cc){var _0x4f4833=rta[_0x9b97('0x44')]();_0x3ef7e7['rows']=_0x3857cc[_0x9b97('0x3d')](function(_0x1157fd){return _['pick'](_0x1157fd,_0x4f4833);});return _0x3ef7e7;})[_0x9b97('0x16')](respondWithFilteredResult(_0x25f0ca,_0x2dc4e3))[_0x9b97('0x45')](APIHandleError(_0x25f0ca));};exports['getQueues']=function(_0x5514da,_0x49f73d){var _0x2e1f6b={'count':0x0,'rows':[]};var _0x1810ba={};var _0x1084af;var _0xa1c705;var _0x1db5c6;Promise['resolve']()[_0x9b97('0x16')](function(){if(_0x5514da['query'][_0x9b97('0x1a')]){if(!utils[_0x9b97('0x17')](_0x5514da[_0x9b97('0x11')][_0x9b97('0x1a')])){throw new APIBadRequestError(util[_0x9b97('0x18')](_0x9b97('0x19'),_0x5514da['query'][_0x9b97('0x1a')]));}_0x1084af=_0x5514da[_0x9b97('0x11')][_0x9b97('0x1a')][_0x9b97('0x1b')]();}var _0x2d8cfe=_[_0x9b97('0x46')](_0x1084af)+_0x9b97('0x47');var _0x1f4a57=_[_0x9b97('0x3d')](db[_0x2d8cfe][_0x9b97('0x48')],function(_0x4e5f1e){return{'name':_0x4e5f1e[_0x9b97('0x28')],'type':_0x4e5f1e['type']['key']};});if(!_0x5514da[_0x9b97('0x11')]['fields']){var _0x17fb53=['id',_0x9b97('0x49')];if(_0x1084af===_0x9b97('0x40')){_0x17fb53[_0x9b97('0x2c')]('type');if(_0x5514da['query'][_0x9b97('0x4a')]===_0x9b97('0x4b')){_0x17fb53[_0x9b97('0x2c')]([_0x9b97('0x4c'),_0x9b97('0x4d')]);}}_0x5514da[_0x9b97('0x11')][_0x9b97('0x4e')]=_0x17fb53[_0x9b97('0x21')](',');}_0x1810ba=qs[_0x9b97('0x2a')](_0x1f4a57,_0x5514da);if(_0x5514da['user'][_0x9b97('0x34')]===_0x9b97('0x33')){var _0x3380ea={'params':{'id':_0x5514da['user'][_0x9b97('0x35')]},'query':{'section':_0x1084af===_0x9b97('0x40')&&_0x5514da[_0x9b97('0x11')][_0x9b97('0x4a')]===_0x9b97('0x4b')?'QueueCampaigns':_['startCase'](_0x1084af)+'Queues','type':_0x5514da[_0x9b97('0x11')]['type'],'nolimit':!![],'sort':_0x9b97('0x49'),'filter':_0x5514da[_0x9b97('0x11')]['filter']}};_0x3380ea[_0x9b97('0x11')]=Object['assign'](_0x3380ea[_0x9b97('0x11')],_0x5514da[_0x9b97('0x11')]);delete _0x3380ea[_0x9b97('0x11')]['id'];return db[_0x9b97('0x3a')][_0x9b97('0x3b')](_0x3380ea);}return db[_0x2d8cfe][_0x9b97('0x4f')](_0x1810ba);})['then'](function(_0x3dc931){_0x2e1f6b[_0x9b97('0xa')]=_0x3dc931[_0x9b97('0xa')];_0xa1c705=_0x3dc931[_0x9b97('0x3c')];return rtq['getRealtimeQueues'](_0x5514da,_0x1084af);})[_0x9b97('0x16')](function(_0x4c29a8){_0x1db5c6=_0x4c29a8['rows'];return rtq[_0x9b97('0x50')](_0xa1c705,_0x1db5c6,_0x1084af,_0x5514da[_0x9b97('0x11')][_0x9b97('0x4a')]);})[_0x9b97('0x16')](function(_0x41c459){_0x2e1f6b['rows']=_0x41c459;return _0x2e1f6b;})[_0x9b97('0x16')](respondWithFilteredResult(_0x49f73d,_0x1810ba))[_0x9b97('0x45')](APIHandleError(_0x49f73d));}; \ No newline at end of file +var _0x7219=['getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','toLowerCase','globalStatus','sort','validateSortParameter','fields','join','order','getSortedAgentsIdsByStatus','getAgentIdsByStatus','User','rawAttributes','fieldName','type','role','agent','length','push','sequelize','forEach','Pause','merge','where','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','rows','map','find','includes','voice','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','key','name','outbound','dialMethod','getOptions','Queues','filter','findAndCountAll','getRealtimeQueues','initializeQueues','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','limit','count','offset','status','set','json','getAgents'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x7219,0xe6));var _0x9721=function(_0x2e68c4,_0x56fc8d){_0x2e68c4=_0x2e68c4-0x0;var _0xb5006a=_0x7219[_0x2e68c4];return _0xb5006a;};'use strict';var _=require('lodash');var util=require('util');var rta=require(_0x9721('0x0'));var rtq=require(_0x9721('0x1'));var qs=require(_0x9721('0x2'));var utils=require(_0x9721('0x3'));var db=require(_0x9721('0x4'))['db'];var APIBadRequestError=require(_0x9721('0x5'))[_0x9721('0x6')];var APIHandleError=require(_0x9721('0x5'))[_0x9721('0x7')];function respondWithFilteredResult(_0x52731f,_0x5122f4){return function(_0x3e9612){if(_0x3e9612){var _0x5f2783=typeof _0x5122f4['offset']===_0x9721('0x8')&&typeof _0x5122f4[_0x9721('0x9')]===_0x9721('0x8');var _0x245fe9=_0x3e9612[_0x9721('0xa')];var _0x52f705=_0x5f2783?0x0:_0x5122f4['offset'];var _0x23883f=_0x5f2783?_0x3e9612['count']:_0x5122f4[_0x9721('0xb')]+_0x5122f4[_0x9721('0x9')];var _0x5f1984;if(_0x23883f>=_0x245fe9){_0x23883f=_0x245fe9;_0x5f1984=0xc8;}else{_0x5f1984=0xce;}_0x52731f[_0x9721('0xc')](_0x5f1984);return _0x52731f[_0x9721('0xd')]('Content-Range',_0x52f705+'-'+_0x23883f+'/'+_0x245fe9)[_0x9721('0xe')](_0x3e9612);}return null;};}exports[_0x9721('0xf')]=function(_0x51e853,_0x4f8291){var _0x42c8de={'count':0x0,'rows':[]};var _0x20ccdf={};var _0x31400a;var _0x83f645=utils[_0x9721('0x10')]();var _0x398364;var _0x224938;var _0x4b8f1b=_0x51e853[_0x9721('0x11')]['globalQueueFilter'];var _0xfb9c5e=_0x51e853[_0x9721('0x11')][_0x9721('0x12')];var _0x484979=_0x51e853[_0x9721('0x11')][_0x9721('0x13')];var _0x1d2aa6=_0xfb9c5e===_0x9721('0x14')||_0xfb9c5e===_0x9721('0x15')?!![]:![];var _0x2ca45d=[];var _0x3a094d;var _0x35d006;Promise[_0x9721('0x16')]()[_0x9721('0x17')](function(){if(_0x51e853[_0x9721('0x11')][_0x9721('0x18')]){if(!utils[_0x9721('0x19')](_0x51e853['query'][_0x9721('0x18')])){throw new APIBadRequestError(util[_0x9721('0x1a')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x51e853['query']['channel']));}_0x31400a=_0x51e853[_0x9721('0x11')][_0x9721('0x18')][_0x9721('0x1b')]();}if(!_0x51e853[_0x9721('0x11')]['sort']||!_0x51e853[_0x9721('0x11')]['sort']['includes'](_0x9721('0x1c'))){_0x51e853['query'][_0x9721('0x1d')]=rta[_0x9721('0x1e')](_0x51e853[_0x9721('0x11')][_0x9721('0x1d')]);return;}var _0x58e9d2=rta['getUpdatedSortOptions'](_0x51e853[_0x9721('0x11')][_0x9721('0x1d')]);_0x51e853[_0x9721('0x11')][_0x9721('0x1d')]=_0x58e9d2[_0x9721('0x1f')][_0x9721('0x20')](',');_0x3a094d=_0x58e9d2[_0x9721('0x21')];})[_0x9721('0x17')](function(){if(!_0x4b8f1b){return[];}return rta['getAgentIdsByQueues'](_0x4b8f1b,_0x31400a);})[_0x9721('0x17')](function(_0x5e1d26){_0x2ca45d=_0x5e1d26;return rta['getRealtimeAgents']();})[_0x9721('0x17')](function(_0x2ec697){_0x224938=_0x2ec697['rows'];if((!_0xfb9c5e||_0x1d2aa6)&&!_0x3a094d){return _0x2ca45d;}if(_0x3a094d&&!_0xfb9c5e){return rta[_0x9721('0x22')](_0x224938,_0x2ca45d,_0x3a094d);}else{return rta[_0x9721('0x23')](_0x224938,_0x2ca45d,_0xfb9c5e);}})[_0x9721('0x17')](function(_0x33bd18){_0x2ca45d=_0x33bd18;var _0x352607=![];if(_0x2ca45d['length']===0x0){if(_0x4b8f1b||_0xfb9c5e){_0x352607=!![];}if(_0x1d2aa6){_0x352607=![];}}if(_0x352607){return _0x42c8de;}var _0x4b9c74=_['map'](db[_0x9721('0x24')][_0x9721('0x25')],function(_0x2c5554){return{'name':_0x2c5554[_0x9721('0x26')],'type':_0x2c5554[_0x9721('0x27')]['key']};});_0x51e853[_0x9721('0x11')][_0x9721('0x28')]=_0x9721('0x29');_0x20ccdf=qs['getOptions'](_0x4b9c74,_0x51e853);_0x20ccdf['raw']=!![];var _0x2bdf90=[];if(_0x2ca45d[_0x9721('0x2a')]>0x0){_0x2bdf90[_0x9721('0x2b')]({'id':{'$in':_0x2ca45d}});if(_0x3a094d&&!_0xfb9c5e){_0x35d006=[db[_0x9721('0x2c')]['literal']('FIELD(id,'+_0x2ca45d+')')];_0x20ccdf[_0x9721('0x21')]=_0x35d006;}}if(_0x1d2aa6){_0x83f645[_0x9721('0x2d')](function(_0x4d313a){var _0x5173b6=!![];if(_0xfb9c5e===_0x9721('0x15')&&_0x31400a!==_0x4d313a){_0x5173b6=![];}_0x2bdf90[_0x9721('0x2b')]({[_0x4d313a+_0x9721('0x2e')]:_0x5173b6});});if(_0x484979){_0x2bdf90[_0x9721('0x2b')]({'pauseType':_0x484979});}}else if(_0xfb9c5e){_0x83f645[_0x9721('0x2d')](function(_0x7dfc19){_0x2bdf90[_0x9721('0x2b')]({[_0x7dfc19+_0x9721('0x2e')]:![]});});}_0x20ccdf['where']=_[_0x9721('0x2f')](_0x20ccdf[_0x9721('0x30')],{'$and':_0x2bdf90});if(_0x51e853['user'][_0x9721('0x28')]===_0x9721('0x31')){var _0x210cdc={'params':{'id':_0x51e853[_0x9721('0x31')][_0x9721('0x32')]},'query':{'section':_0x9721('0x33'),'role':_0x9721('0x29'),'raw':!![],'ids':_0x2ca45d,'customSorting':_0x35d006}};if(_0x51e853[_0x9721('0x11')]['online']){_0x210cdc['query'][_0x9721('0x34')]=!![];}if(_0x1d2aa6){_0x210cdc[_0x9721('0x11')][_0x9721('0x35')]=_0x2bdf90;}_0x210cdc['query']=Object[_0x9721('0x36')](_0x210cdc['query'],_0x51e853[_0x9721('0x11')]);return db[_0x9721('0x37')][_0x9721('0x38')](_0x210cdc);}return db[_0x9721('0x24')]['findAndCountAll'](_0x20ccdf);})[_0x9721('0x17')](function(_0x30d0c5){_0x42c8de[_0x9721('0xa')]=_0x30d0c5[_0x9721('0xa')];_0x398364=_0x30d0c5[_0x9721('0x39')];return _0x398364[_0x9721('0x3a')](function(_0x32d58c){var _0x3ac30f=_[_0x9721('0x3b')](_0x224938,['id',_0x32d58c['id']]);if(_0x3ac30f){var _0x209e85=rta['filterAgentAttributes'](_0x3ac30f);_[_0x9721('0x2f')](_0x32d58c,_0x209e85);}_0x32d58c['globalStatus']=rta['getAgentStatus'](_0x32d58c);if(_0x32d58c['globalStatus'][_0x9721('0x3c')](_0x9721('0x14'))){_0x83f645['forEach'](function(_0x15f1f1){if(_0x32d58c[_0x15f1f1+_0x9721('0x2e')]){if(_0x15f1f1===_0x9721('0x3d')){if(_0x32d58c[_0x9721('0x3e')]!=='talking'){_0x32d58c['voiceStatus']='pause';}}else{_0x32d58c[_0x15f1f1+_0x9721('0x3f')]=_0x9721('0x14');}}});}return _0x32d58c;});})[_0x9721('0x17')](function(_0x84cc34){if(!_0x3a094d||_0x35d006){return _0x84cc34;}return rta[_0x9721('0x40')](_0x84cc34,_0x3a094d);})[_0x9721('0x17')](function(_0x492d04){var _0x7641e8=rta[_0x9721('0x41')]();_0x42c8de[_0x9721('0x39')]=_0x492d04[_0x9721('0x3a')](function(_0x418211){return _[_0x9721('0x42')](_0x418211,_0x7641e8);});return _0x42c8de;})[_0x9721('0x17')](respondWithFilteredResult(_0x4f8291,_0x20ccdf))[_0x9721('0x43')](APIHandleError(_0x4f8291));};exports[_0x9721('0x44')]=function(_0x22da70,_0x57daf5){var _0x1f559f={'count':0x0,'rows':[]};var _0x577a57={};var _0x22d480;var _0x570e9d;var _0x25a417;Promise[_0x9721('0x16')]()[_0x9721('0x17')](function(){if(_0x22da70[_0x9721('0x11')]['channel']){if(!utils['isValidChannel'](_0x22da70['query'][_0x9721('0x18')])){throw new APIBadRequestError(util[_0x9721('0x1a')](_0x9721('0x45'),_0x22da70['query'][_0x9721('0x18')]));}_0x22d480=_0x22da70[_0x9721('0x11')]['channel'][_0x9721('0x1b')]();}var _0x57d4fa=_[_0x9721('0x46')](_0x22d480)+_0x9721('0x47');var _0x1dcb9b=_[_0x9721('0x3a')](db[_0x57d4fa]['rawAttributes'],function(_0x1c4908){return{'name':_0x1c4908['fieldName'],'type':_0x1c4908[_0x9721('0x27')][_0x9721('0x48')]};});if(!_0x22da70[_0x9721('0x11')]['fields']){var _0xf2088a=['id',_0x9721('0x49')];if(_0x22d480===_0x9721('0x3d')){_0xf2088a[_0x9721('0x2b')](_0x9721('0x27'));if(_0x22da70[_0x9721('0x11')][_0x9721('0x27')]===_0x9721('0x4a')){_0xf2088a['push'](['dialActive',_0x9721('0x4b')]);}}_0x22da70[_0x9721('0x11')]['fields']=_0xf2088a[_0x9721('0x20')](',');}_0x577a57=qs[_0x9721('0x4c')](_0x1dcb9b,_0x22da70);if(_0x22da70['user'][_0x9721('0x28')]===_0x9721('0x31')){var _0x5d02ed={'params':{'id':_0x22da70[_0x9721('0x31')]['userProfileId']},'query':{'section':_0x22d480===_0x9721('0x3d')&&_0x22da70['query'][_0x9721('0x27')]==='outbound'?'QueueCampaigns':_[_0x9721('0x46')](_0x22d480)+_0x9721('0x4d'),'type':_0x22da70[_0x9721('0x11')][_0x9721('0x27')],'nolimit':!![],'sort':_0x9721('0x49'),'filter':_0x22da70['query'][_0x9721('0x4e')]}};_0x5d02ed[_0x9721('0x11')]=Object[_0x9721('0x36')](_0x5d02ed[_0x9721('0x11')],_0x22da70['query']);delete _0x5d02ed[_0x9721('0x11')]['id'];return db['UserProfile'][_0x9721('0x38')](_0x5d02ed);}return db[_0x57d4fa][_0x9721('0x4f')](_0x577a57);})[_0x9721('0x17')](function(_0xb5ac34){_0x1f559f[_0x9721('0xa')]=_0xb5ac34[_0x9721('0xa')];_0x570e9d=_0xb5ac34[_0x9721('0x39')];return rtq[_0x9721('0x50')](_0x22da70,_0x22d480);})[_0x9721('0x17')](function(_0x47c15a){_0x25a417=_0x47c15a[_0x9721('0x39')];return rtq[_0x9721('0x51')](_0x570e9d,_0x25a417,_0x22d480,_0x22da70['query'][_0x9721('0x27')]);})['then'](function(_0x5d68bb){_0x1f559f['rows']=_0x5d68bb;return _0x1f559f;})[_0x9721('0x17')](respondWithFilteredResult(_0x57daf5,_0x577a57))[_0x9721('0x43')](APIHandleError(_0x57daf5));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 1ebe029..3ad251e 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x46640c,_0x4d27c5){var _0x32fb77=function(_0x2384b6){while(--_0x2384b6){_0x46640c['push'](_0x46640c['shift']());}};_0x32fb77(++_0x4d27c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x21f993,_0x4ef8d4){var _0x292585=function(_0x5296ba){while(--_0x5296ba){_0x21f993['push'](_0x21f993['shift']());}};_0x292585(++_0x4ef8d4);}(_0x70e0,0x17b));var _0x070e=function(_0x44060b,_0x374f1f){_0x44060b=_0x44060b-0x0;var _0x57b6d1=_0x70e0[_0x44060b];return _0x57b6d1;};'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 d5aaab1..4c3bf88 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 _0x30bc=['exports','INTEGER','DATE','STRING','sequelize'];(function(_0x41fb78,_0x406f74){var _0x3a82e0=function(_0xdb6811){while(--_0xdb6811){_0x41fb78['push'](_0x41fb78['shift']());}};_0x3a82e0(++_0x406f74);}(_0x30bc,0x149));var _0xc30b=function(_0x3c0b76,_0x170065){_0x3c0b76=_0x3c0b76-0x0;var _0x51906d=_0x30bc[_0x3c0b76];return _0x51906d;};'use strict';var Sequelize=require(_0xc30b('0x0'));module[_0xc30b('0x1')]={'state':{'type':Sequelize[_0xc30b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xc30b('0x3')]},'uniqueid':{'type':Sequelize[_0xc30b('0x4')]},'starttime':{'type':Sequelize[_0xc30b('0x3')]},'responsetime':{'type':Sequelize[_0xc30b('0x3')]},'ringtime':{'type':Sequelize[_0xc30b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc30b('0x4')]},'campaigntype':{'type':Sequelize[_0xc30b('0x4')]},'membername':{'type':Sequelize[_0xc30b('0x4')]}}; \ No newline at end of file +var _0xc051=['STRING','sequelize','exports','DATE'];(function(_0x48d783,_0xa6344a){var _0x5d4118=function(_0xfd4232){while(--_0xfd4232){_0x48d783['push'](_0x48d783['shift']());}};_0x5d4118(++_0xa6344a);}(_0xc051,0xb5));var _0x1c05=function(_0x254570,_0x3139f5){_0x254570=_0x254570-0x0;var _0x516d5b=_0xc051[_0x254570];return _0x516d5b;};'use strict';var Sequelize=require(_0x1c05('0x0'));module[_0x1c05('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1c05('0x2')]},'uniqueid':{'type':Sequelize[_0x1c05('0x3')]},'starttime':{'type':Sequelize[_0x1c05('0x2')]},'responsetime':{'type':Sequelize[_0x1c05('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1c05('0x3')]},'campaigntype':{'type':Sequelize[_0x1c05('0x3')]},'membername':{'type':Sequelize[_0x1c05('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 90c6bba..3fde66a 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 _0x2f51=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','lodash'];(function(_0x433e7c,_0xf9c606){var _0x2d5248=function(_0x2c8e94){while(--_0x2c8e94){_0x433e7c['push'](_0x433e7c['shift']());}};_0x2d5248(++_0xf9c606);}(_0x2f51,0x8f));var _0x12f5=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2f51[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x12f5('0x0'));var util=require('util');var logger=require(_0x12f5('0x1'))(_0x12f5('0x2'));var moment=require(_0x12f5('0x3'));var BPromise=require(_0x12f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x12f5('0x5'));var config=require(_0x12f5('0x6'));var attributes=require(_0x12f5('0x7'));module[_0x12f5('0x8')]=function(_0x2cbdd9,_0xf3e8fa){return _0x2cbdd9['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf18=['api','moment','bluebird','path','rimraf','../../config/environment','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xdf18,0x1c5));var _0x8df1=function(_0x41bf49,_0x5956e5){_0x41bf49=_0x41bf49-0x0;var _0x29b3c3=_0xdf18[_0x41bf49];return _0x29b3c3;};'use strict';var _=require(_0x8df1('0x0'));var util=require(_0x8df1('0x1'));var logger=require(_0x8df1('0x2'))(_0x8df1('0x3'));var moment=require(_0x8df1('0x4'));var BPromise=require(_0x8df1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8df1('0x6'));var rimraf=require(_0x8df1('0x7'));var config=require(_0x8df1('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x8df1('0x9')]=function(_0x281ef6,_0x19428c){return _0x281ef6['define'](_0x8df1('0xa'),attributes,{'tableName':_0x8df1('0xb'),'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 fdaa92c..d2f907e 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 _0xed25=['options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body'];(function(_0x400282,_0x5a0199){var _0x20684e=function(_0x5e3193){while(--_0x5e3193){_0x400282['push'](_0x400282['shift']());}};_0x20684e(++_0x5a0199);}(_0xed25,0x84));var _0x5ed2=function(_0x131090,_0x4b5e43){_0x131090=_0x131090-0x0;var _0x1e10cf=_0xed25[_0x131090];return _0x1e10cf;};'use strict';var _=require('lodash');var util=require(_0x5ed2('0x0'));var moment=require(_0x5ed2('0x1'));var BPromise=require(_0x5ed2('0x2'));var rs=require(_0x5ed2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ed2('0x4'))['db'];var utils=require(_0x5ed2('0x5'));var logger=require(_0x5ed2('0x6'))(_0x5ed2('0x7'));var config=require(_0x5ed2('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6c6c,_0x5df487,_0x4b0c09){return new BPromise(function(_0x45e8fd,_0x16603b){return client[_0x5ed2('0x9')](_0x3f6c6c,_0x4b0c09)['then'](function(_0x4739da){logger[_0x5ed2('0xa')](_0x5ed2('0xb'),_0x5df487,'request\x20sent');logger[_0x5ed2('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5df487,_0x5ed2('0xd'),JSON[_0x5ed2('0xe')](_0x4739da));if(_0x4739da[_0x5ed2('0xf')]){if(_0x4739da['error'][_0x5ed2('0x10')]===0x1f4){logger[_0x5ed2('0xf')](_0x5ed2('0xb'),_0x5df487,_0x4739da['error']['message']);return _0x16603b(_0x4739da['error']['message']);}logger[_0x5ed2('0xf')](_0x5ed2('0xb'),_0x5df487,_0x4739da[_0x5ed2('0xf')][_0x5ed2('0x11')]);return _0x45e8fd(_0x4739da['error']['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x5df487,_0x5ed2('0xd'));_0x45e8fd(_0x4739da[_0x5ed2('0x12')][_0x5ed2('0x11')]);}})[_0x5ed2('0x13')](function(_0x20d7ff){logger['error'](_0x5ed2('0xb'),_0x5df487,_0x20d7ff);_0x16603b(_0x20d7ff);});});}exports[_0x5ed2('0x14')]=function(_0x5d55a8){var _0x3a6e76=this;return new Promise(function(_0x25dad9,_0x2fe8b7){return db[_0x5ed2('0x15')][_0x5ed2('0x16')](_0x5d55a8[_0x5ed2('0x17')],{'raw':_0x5d55a8[_0x5ed2('0x18')]?_0x5d55a8[_0x5ed2('0x18')][_0x5ed2('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x114ce3){logger['info'](_0x5ed2('0x14'),_0x5d55a8);logger[_0x5ed2('0xc')](_0x5ed2('0x14'),_0x5d55a8,JSON[_0x5ed2('0xe')](_0x114ce3));_0x25dad9(_0x114ce3);})[_0x5ed2('0x13')](function(_0x21e45b){logger[_0x5ed2('0xf')](_0x5ed2('0x14'),_0x21e45b['message'],_0x5d55a8);_0x2fe8b7(_0x3a6e76['error'](0x1f4,_0x21e45b[_0x5ed2('0x11')]));});});}; \ No newline at end of file +var _0xb76c=['code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0xb76c,0x81));var _0xcb76=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0xb76c[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0xcb76('0x0'));var util=require(_0xcb76('0x1'));var moment=require(_0xcb76('0x2'));var BPromise=require(_0xcb76('0x3'));var rs=require(_0xcb76('0x4'));var fs=require('fs');var Redis=require(_0xcb76('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb76('0x6'));var logger=require(_0xcb76('0x7'))('rpc');var config=require(_0xcb76('0x8'));var jayson=require(_0xcb76('0x9'));var client=jayson[_0xcb76('0xa')][_0xcb76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2780,_0x298ffc,_0x441764){return new BPromise(function(_0x4b929b,_0x5c5eaa){return client[_0xcb76('0xc')](_0x5b2780,_0x441764)[_0xcb76('0xd')](function(_0x4aed67){logger[_0xcb76('0xe')](_0xcb76('0xf'),_0x298ffc,'request\x20sent');logger[_0xcb76('0x10')](_0xcb76('0x11'),_0x298ffc,_0xcb76('0x12'),JSON[_0xcb76('0x13')](_0x4aed67));if(_0x4aed67[_0xcb76('0x14')]){if(_0x4aed67[_0xcb76('0x14')][_0xcb76('0x15')]===0x1f4){logger[_0xcb76('0x14')](_0xcb76('0xf'),_0x298ffc,_0x4aed67['error'][_0xcb76('0x16')]);return _0x5c5eaa(_0x4aed67[_0xcb76('0x14')][_0xcb76('0x16')]);}logger['error'](_0xcb76('0xf'),_0x298ffc,_0x4aed67[_0xcb76('0x14')]['message']);return _0x4b929b(_0x4aed67[_0xcb76('0x14')][_0xcb76('0x16')]);}else{logger[_0xcb76('0xe')](_0xcb76('0xf'),_0x298ffc,_0xcb76('0x12'));_0x4b929b(_0x4aed67[_0xcb76('0x17')][_0xcb76('0x16')]);}})[_0xcb76('0x18')](function(_0x27c49b){logger[_0xcb76('0x14')](_0xcb76('0xf'),_0x298ffc,_0x27c49b);_0x5c5eaa(_0x27c49b);});});}exports[_0xcb76('0x19')]=function(_0x17c767){var _0x5177a4=this;return new Promise(function(_0x48e6b7,_0x1b43d4){return db[_0xcb76('0x1a')][_0xcb76('0x1b')](_0x17c767[_0xcb76('0x1c')],{'raw':_0x17c767['options']?_0x17c767['options'][_0xcb76('0x1d')]===undefined?!![]:![]:!![]})[_0xcb76('0xd')](function(_0x5b77e0){logger[_0xcb76('0xe')]('CreateReportAgentPreview',_0x17c767);logger[_0xcb76('0x10')]('CreateReportAgentPreview',_0x17c767,JSON[_0xcb76('0x13')](_0x5b77e0));_0x48e6b7(_0x5b77e0);})[_0xcb76('0x18')](function(_0x1edfce){logger[_0xcb76('0x14')](_0xcb76('0x19'),_0x1edfce[_0xcb76('0x16')],_0x17c767);_0x1b43d4(_0x5177a4['error'](0x1f4,_0x1edfce[_0xcb76('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7493ac7..48b19e5 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 _0x1026=['/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','/agents','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels'];(function(_0x12ae7e,_0x14ed4d){var _0x402e0e=function(_0x27d9ab){while(--_0x27d9ab){_0x12ae7e['push'](_0x12ae7e['shift']());}};_0x402e0e(++_0x14ed4d);}(_0x1026,0x97));var _0x6102=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0x1026[_0x2ecb67];return _0x168079;};'use strict';var multer=require(_0x6102('0x0'));var util=require(_0x6102('0x1'));var path=require(_0x6102('0x2'));var express=require(_0x6102('0x3'));var router=express['Router']();var auth=require(_0x6102('0x4'));var controller=require(_0x6102('0x5'));router[_0x6102('0x6')](_0x6102('0x7'),auth['isAuthenticated'](),controller[_0x6102('0x8')]);router[_0x6102('0x6')](_0x6102('0x9'),auth[_0x6102('0xa')](),controller['voiceChannelMixMonitor']);router[_0x6102('0x6')](_0x6102('0xb'),auth[_0x6102('0xa')](),controller[_0x6102('0xc')]);router[_0x6102('0x6')](_0x6102('0xd'),auth[_0x6102('0xa')](),controller[_0x6102('0xe')]);router['get']('/chat/queues',auth[_0x6102('0xa')](),controller[_0x6102('0xf')]);router['get'](_0x6102('0x10'),auth[_0x6102('0xa')](),controller[_0x6102('0x11')]);router[_0x6102('0x6')](_0x6102('0x12'),auth[_0x6102('0xa')](),controller[_0x6102('0x13')]);router[_0x6102('0x6')](_0x6102('0x14'),auth['isAuthenticated'](),controller[_0x6102('0x15')]);router[_0x6102('0x6')](_0x6102('0x16'),auth[_0x6102('0xa')](),controller[_0x6102('0x17')]);router[_0x6102('0x6')](_0x6102('0x18'),auth[_0x6102('0xa')](),controller[_0x6102('0x19')]);router['get'](_0x6102('0x1a'),auth[_0x6102('0xa')](),controller['faxQueues']);router[_0x6102('0x6')](_0x6102('0x1b'),auth['isAuthenticated'](),controller[_0x6102('0x1c')]);router['get']('/voice/queues/channels',auth[_0x6102('0xa')](),controller[_0x6102('0x1d')]);router[_0x6102('0x6')](_0x6102('0x1e'),auth[_0x6102('0xa')](),controller[_0x6102('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x6102('0x20')]);router[_0x6102('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x6102('0xa')](),controller[_0x6102('0x21')]);router[_0x6102('0x6')](_0x6102('0x22'),auth[_0x6102('0xa')](),controller[_0x6102('0x23')]);router[_0x6102('0x24')](_0x6102('0x22'),auth[_0x6102('0xa')](),controller['updateVoiceQueue']);router[_0x6102('0x6')](_0x6102('0x25'),auth[_0x6102('0xa')](),controller[_0x6102('0x26')]);router[_0x6102('0x6')](_0x6102('0x27'),auth[_0x6102('0xa')](),controller['outboundChannels']);router[_0x6102('0x6')](_0x6102('0x28'),auth['isAuthenticated'](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0x6102('0xa')](),controller[_0x6102('0x29')]);router['get'](_0x6102('0x2a'),auth[_0x6102('0xa')](),controller[_0x6102('0x2b')]);router['get'](_0x6102('0x2c'),auth['isAuthenticated'](),controller[_0x6102('0x2d')]);router['get']('/campaigns',auth[_0x6102('0xa')](),controller[_0x6102('0x2e')]);router[_0x6102('0x6')]('/fax/accounts',auth[_0x6102('0xa')](),controller['faxAccounts']);router['get'](_0x6102('0x2f'),auth[_0x6102('0xa')](),controller[_0x6102('0x30')]);router[_0x6102('0x6')](_0x6102('0x31'),auth[_0x6102('0xa')](),controller[_0x6102('0x32')]);router[_0x6102('0x6')](_0x6102('0x33'),auth[_0x6102('0xa')](),controller[_0x6102('0x34')]);router[_0x6102('0x6')](_0x6102('0x35'),auth['isAuthenticated'](),controller[_0x6102('0x36')]);router[_0x6102('0x6')](_0x6102('0x37'),auth[_0x6102('0xa')](),controller[_0x6102('0x38')]);router[_0x6102('0x6')](_0x6102('0x39'),auth[_0x6102('0xa')](),controller[_0x6102('0x3a')]);router[_0x6102('0x6')](_0x6102('0x3b'),auth[_0x6102('0xa')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x6102('0x3c'),auth[_0x6102('0xa')](),controller[_0x6102('0x3d')](_0x6102('0x3e')));router[_0x6102('0x6')]('/mail/queues/:id',auth[_0x6102('0xa')](),controller['showMailQueues']);router[_0x6102('0x3f')](_0x6102('0x40'),auth[_0x6102('0xa')](),controller[_0x6102('0x3d')](_0x6102('0x41')));router[_0x6102('0x6')](_0x6102('0x42'),auth[_0x6102('0xa')](),controller[_0x6102('0x43')]);router[_0x6102('0x3f')](_0x6102('0x44'),auth['isAuthenticated'](),controller[_0x6102('0x3d')](_0x6102('0x45')));router[_0x6102('0x6')]('/fax/queues/:id',auth[_0x6102('0xa')](),controller['showFaxQueues']);router['post'](_0x6102('0x46'),auth[_0x6102('0xa')](),controller['queueNotify'](_0x6102('0x47')));router['get'](_0x6102('0x48'),auth[_0x6102('0xa')](),controller['showOpenchannelQueues']);router['post'](_0x6102('0x49'),auth[_0x6102('0xa')](),controller[_0x6102('0x3d')]('sms'));router[_0x6102('0x3f')](_0x6102('0x4a'),auth[_0x6102('0xa')](),controller[_0x6102('0x3d')](_0x6102('0x4b')));router[_0x6102('0x6')](_0x6102('0x4c'),auth[_0x6102('0xa')](),controller['showSmsQueues']);router[_0x6102('0x6')](_0x6102('0x4d'),auth[_0x6102('0xa')](),controller[_0x6102('0x4e')]);router[_0x6102('0x3f')]('/agents/:id/notify',auth[_0x6102('0xa')](),controller['agentNotify']);module[_0x6102('0x4f')]=router; \ No newline at end of file +var _0x7c07=['openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','queueNotify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts'];(function(_0x1b962e,_0x349a19){var _0x25a543=function(_0x5f57ac){while(--_0x5f57ac){_0x1b962e['push'](_0x1b962e['shift']());}};_0x25a543(++_0x349a19);}(_0x7c07,0xe2));var _0x77c0=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7c07[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x77c0('0x0'));var util=require(_0x77c0('0x1'));var path=require(_0x77c0('0x2'));var express=require(_0x77c0('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x77c0('0x4'));router[_0x77c0('0x5')](_0x77c0('0x6'),auth['isAuthenticated'](),controller[_0x77c0('0x7')]);router[_0x77c0('0x5')](_0x77c0('0x8'),auth[_0x77c0('0x9')](),controller[_0x77c0('0xa')]);router[_0x77c0('0x5')](_0x77c0('0xb'),auth[_0x77c0('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0x77c0('0x5')](_0x77c0('0xc'),auth['isAuthenticated'](),controller[_0x77c0('0xd')]);router['get'](_0x77c0('0xe'),auth['isAuthenticated'](),controller[_0x77c0('0xf')]);router['get'](_0x77c0('0x10'),auth['isAuthenticated'](),controller[_0x77c0('0x11')]);router[_0x77c0('0x5')](_0x77c0('0x12'),auth['isAuthenticated'](),controller[_0x77c0('0x13')]);router[_0x77c0('0x5')]('/openchannel/queues',auth[_0x77c0('0x9')](),controller[_0x77c0('0x14')]);router['get'](_0x77c0('0x15'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x16')]);router[_0x77c0('0x5')](_0x77c0('0x17'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x18')]);router[_0x77c0('0x5')](_0x77c0('0x19'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x1a')]);router[_0x77c0('0x5')](_0x77c0('0x1b'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x1c')]);router[_0x77c0('0x5')](_0x77c0('0x1d'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x1e')]);router[_0x77c0('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x77c0('0x9')](),controller['voiceQueuesChannel']);router[_0x77c0('0x5')](_0x77c0('0x1f'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x77c0('0x5')](_0x77c0('0x20'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x21')]);router[_0x77c0('0x5')](_0x77c0('0x22'),auth['isAuthenticated'](),controller[_0x77c0('0x23')]);router[_0x77c0('0x24')]('/voice/queues/:id',auth[_0x77c0('0x9')](),controller['updateVoiceQueue']);router[_0x77c0('0x5')](_0x77c0('0x25'),auth[_0x77c0('0x9')](),controller['outbound']);router['get']('/outbound/channels',auth[_0x77c0('0x9')](),controller[_0x77c0('0x26')]);router['get'](_0x77c0('0x27'),auth['isAuthenticated'](),controller[_0x77c0('0x28')]);router[_0x77c0('0x24')](_0x77c0('0x29'),auth['isAuthenticated'](),controller[_0x77c0('0x2a')]);router['get'](_0x77c0('0x2b'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x2c')]);router['get'](_0x77c0('0x2d'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x2e')]);router[_0x77c0('0x5')]('/campaigns',auth[_0x77c0('0x9')](),controller[_0x77c0('0x2f')]);router['get'](_0x77c0('0x30'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x31')]);router[_0x77c0('0x5')](_0x77c0('0x32'),auth['isAuthenticated'](),controller[_0x77c0('0x33')]);router[_0x77c0('0x5')](_0x77c0('0x34'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x35')]);router[_0x77c0('0x5')](_0x77c0('0x36'),auth['isAuthenticated'](),controller[_0x77c0('0x37')]);router[_0x77c0('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0x77c0('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x77c0('0x5')](_0x77c0('0x38'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x39')]);router[_0x77c0('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x77c0('0x9')](),controller[_0x77c0('0x3a')]);router[_0x77c0('0x5')](_0x77c0('0x3b'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x77c0('0x3c')]('/mail/queues/:id/notify',auth[_0x77c0('0x9')](),controller['queueNotify']('mail'));router[_0x77c0('0x5')](_0x77c0('0x3d'),auth[_0x77c0('0x9')](),controller['showMailQueues']);router[_0x77c0('0x3c')](_0x77c0('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0x77c0('0x3f')));router[_0x77c0('0x5')](_0x77c0('0x40'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x41')]);router[_0x77c0('0x3c')](_0x77c0('0x42'),auth['isAuthenticated'](),controller[_0x77c0('0x43')](_0x77c0('0x44')));router[_0x77c0('0x5')](_0x77c0('0x45'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x46')]);router['post'](_0x77c0('0x47'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x43')](_0x77c0('0x48')));router['get'](_0x77c0('0x49'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x4a')]);router[_0x77c0('0x3c')](_0x77c0('0x4b'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x43')]('sms'));router[_0x77c0('0x3c')](_0x77c0('0x4c'),auth[_0x77c0('0x9')](),controller[_0x77c0('0x43')](_0x77c0('0x4d')));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x77c0('0x5')](_0x77c0('0x4e'),auth['isAuthenticated'](),controller[_0x77c0('0x4f')]);router['post']('/agents/:id/notify',auth[_0x77c0('0x9')](),controller[_0x77c0('0x50')]);module[_0x77c0('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 000b7d1..77a4fcd 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x894c05,_0x42cee0){var _0x4e57d6=function(_0x133549){while(--_0x133549){_0x894c05['push'](_0x894c05['shift']());}};_0x4e57d6(++_0x42cee0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x2a97f0,_0x4ea4a2){var _0x4a4dea=function(_0x2e696f){while(--_0x2e696f){_0x2a97f0['push'](_0x2a97f0['shift']());}};_0x4a4dea(++_0x4ea4a2);}(_0xe706,0xa3));var _0x6e70=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0xe706[_0x30f5bb];return _0x1cfc00;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3e2acdd..433185f 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 _0xdea5=['/:id','show','/:id/run','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0x3cd38a,_0x2c63e6){var _0x180b4e=function(_0x452710){while(--_0x452710){_0x3cd38a['push'](_0x3cd38a['shift']());}};_0x180b4e(++_0x2c63e6);}(_0xdea5,0x10d));var _0x5dea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdea5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5dea('0x0'));var util=require(_0x5dea('0x1'));var path=require(_0x5dea('0x2'));var timeout=require(_0x5dea('0x3'));var express=require('express');var router=express[_0x5dea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5dea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5dea('0x6'));var controller=require(_0x5dea('0x7'));router[_0x5dea('0x8')]('/',auth[_0x5dea('0x9')](),controller[_0x5dea('0xa')]);router[_0x5dea('0x8')](_0x5dea('0xb'),auth[_0x5dea('0x9')](),controller[_0x5dea('0xc')]);router[_0x5dea('0x8')](_0x5dea('0xd'),auth[_0x5dea('0x9')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller[_0x5dea('0xe')]);router[_0x5dea('0xf')](_0x5dea('0xb'),auth[_0x5dea('0x9')](),controller[_0x5dea('0x10')]);router[_0x5dea('0x11')]('/:id',auth[_0x5dea('0x9')](),controller[_0x5dea('0x12')]);module[_0x5dea('0x13')]=router; \ No newline at end of file +var _0x0e75=['put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/run','run','post','create'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x0e75,0x1d1));var _0x50e7=function(_0x5c70d0,_0xfeac42){_0x5c70d0=_0x5c70d0-0x0;var _0x484491=_0x0e75[_0x5c70d0];return _0x484491;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x50e7('0x0'));var timeout=require('connect-timeout');var express=require(_0x50e7('0x1'));var router=express[_0x50e7('0x2')]();var fs_extra=require(_0x50e7('0x3'));var auth=require(_0x50e7('0x4'));var interaction=require(_0x50e7('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x50e7('0x6')]('/',auth['isAuthenticated'](),controller[_0x50e7('0x7')]);router['get'](_0x50e7('0x8'),auth[_0x50e7('0x9')](),controller[_0x50e7('0xa')]);router[_0x50e7('0x6')](_0x50e7('0xb'),auth[_0x50e7('0x9')](),controller[_0x50e7('0xc')]);router[_0x50e7('0xd')]('/',auth[_0x50e7('0x9')](),controller[_0x50e7('0xe')]);router[_0x50e7('0xf')](_0x50e7('0x8'),auth['isAuthenticated'](),controller[_0x50e7('0x10')]);router[_0x50e7('0x11')](_0x50e7('0x8'),auth[_0x50e7('0x9')](),controller[_0x50e7('0x12')]);module[_0x50e7('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 67de076..8a7381b 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 _0x4467=['STRING','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','xlsx','custom','BOOLEAN','exports'];(function(_0x23d585,_0x21dd59){var _0x30de05=function(_0x1062a3){while(--_0x1062a3){_0x23d585['push'](_0x23d585['shift']());}};_0x30de05(++_0x21dd59);}(_0x4467,0xef));var _0x7446=function(_0x237a1c,_0x34bd6a){_0x237a1c=_0x237a1c-0x0;var _0x556d1f=_0x4467[_0x237a1c];return _0x556d1f;};'use strict';var Sequelize=require('sequelize');module[_0x7446('0x0')]={'name':{'type':Sequelize[_0x7446('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7446('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x7446('0x2')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7446('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7446('0x4')](_0x7446('0x5'),_0x7446('0x6'),_0x7446('0x7'),_0x7446('0x8'),_0x7446('0x9'),_0x7446('0xa'),_0x7446('0xb')),'allowNull':![],'defaultValue':_0x7446('0x9')},'output':{'type':Sequelize[_0x7446('0x4')](_0x7446('0xc'),'pdf',_0x7446('0xd')),'allowNull':![],'defaultValue':_0x7446('0xc')},'type':{'type':Sequelize[_0x7446('0x4')](_0x7446('0xe'),'default'),'allowNull':![],'defaultValue':_0x7446('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x7446('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa94d=['exports','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','hours','minutes','ENUM','csv','xlsx','custom','default','STRING','TEXT','sequelize'];(function(_0x5b9b16,_0x130bc5){var _0x3cb207=function(_0x4d46c3){while(--_0x4d46c3){_0x5b9b16['push'](_0x5b9b16['shift']());}};_0x3cb207(++_0x130bc5);}(_0xa94d,0x1a3));var _0xda94=function(_0x25771a,_0x5cee97){_0x25771a=_0x25771a-0x0;var _0x588979=_0xa94d[_0x25771a];return _0x588979;};'use strict';var Sequelize=require(_0xda94('0x0'));module[_0xda94('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xda94('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xda94('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xda94('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xda94('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xda94('0x6'),_0xda94('0x7'),_0xda94('0x8'),_0xda94('0x9'),_0xda94('0xa'),_0xda94('0xb'),_0xda94('0xc')),'allowNull':![],'defaultValue':_0xda94('0xa')},'output':{'type':Sequelize[_0xda94('0xd')](_0xda94('0xe'),'pdf',_0xda94('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xda94('0xd')](_0xda94('0x10'),_0xda94('0x11')),'allowNull':![],'defaultValue':_0xda94('0x10')},'sendMail':{'type':Sequelize[_0xda94('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xda94('0x12')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xda94('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xda94('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 f01b678..afcfc6a 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 _0x32c7=['model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','options','includeAll','include','rows','catch','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','body','params','destroy','run','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','Scheduler','UserProfileResource','error','stack','name','send','index','Schedule','fieldName','type'];(function(_0x5040be,_0x3969b5){var _0x5e69c7=function(_0x4eac09){while(--_0x4eac09){_0x5040be['push'](_0x5040be['shift']());}};_0x5e69c7(++_0x3969b5);}(_0x32c7,0xc5));var _0x732c=function(_0x32d328,_0xc8a9d1){_0x32d328=_0x32d328-0x0;var _0x4a6b82=_0x32c7[_0x32d328];return _0x4a6b82;};'use strict';var emlformat=require(_0x732c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x732c('0x1'));var jsonpatch=require(_0x732c('0x2'));var rp=require('request-promise');var moment=require(_0x732c('0x3'));var BPromise=require(_0x732c('0x4'));var Mustache=require(_0x732c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x732c('0x6'));var csv=require(_0x732c('0x7'));var ejs=require(_0x732c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x732c('0x9'));var squel=require(_0x732c('0xa'));var crypto=require('crypto');var jsforce=require(_0x732c('0xb'));var deskjs=require(_0x732c('0xc'));var toCsv=require(_0x732c('0x7'));var querystring=require(_0x732c('0xd'));var Papa=require(_0x732c('0xe'));var Redis=require(_0x732c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x732c('0x10'));var as=require(_0x732c('0x11'));var hardwareService=require(_0x732c('0x12'));var logger=require(_0x732c('0x13'))(_0x732c('0x14'));var utils=require(_0x732c('0x15'));var config=require(_0x732c('0x16'));var licenseUtil=require(_0x732c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26609f,_0x16d0be){_0x16d0be=_0x16d0be||0xcc;return function(_0x2d87be){if(_0x2d87be){return _0x26609f[_0x732c('0x18')](_0x16d0be);}return _0x26609f[_0x732c('0x19')](_0x16d0be)[_0x732c('0x1a')]();};}function respondWithResult(_0x15121b,_0x3756da){_0x3756da=_0x3756da||0xc8;return function(_0x593a55){if(_0x593a55){return _0x15121b[_0x732c('0x19')](_0x3756da)[_0x732c('0x1b')](_0x593a55);}};}function respondWithFilteredResult(_0x4475a8,_0x4a276c){return function(_0x3d0ef0){if(_0x3d0ef0){var _0x2a2e16=typeof _0x4a276c[_0x732c('0x1c')]===_0x732c('0x1d')&&typeof _0x4a276c[_0x732c('0x1e')]==='undefined';var _0x2b5e27=_0x3d0ef0[_0x732c('0x1f')];var _0x4af8b3=_0x2a2e16?0x0:_0x4a276c[_0x732c('0x1c')];var _0xc3a4d2=_0x2a2e16?_0x3d0ef0['count']:_0x4a276c['offset']+_0x4a276c['limit'];var _0x3fe133;if(_0xc3a4d2>=_0x2b5e27){_0xc3a4d2=_0x2b5e27;_0x3fe133=0xc8;}else{_0x3fe133=0xce;}_0x4475a8['status'](_0x3fe133);return _0x4475a8[_0x732c('0x20')](_0x732c('0x21'),_0x4af8b3+'-'+_0xc3a4d2+'/'+_0x2b5e27)[_0x732c('0x1b')](_0x3d0ef0);}return null;};}function patchUpdates(_0x5975f0){return function(_0x595c24){try{jsonpatch[_0x732c('0x22')](_0x595c24,_0x5975f0,!![]);}catch(_0x85dfbd){return BPromise[_0x732c('0x23')](_0x85dfbd);}return _0x595c24[_0x732c('0x24')]();};}function saveUpdates(_0x25dc8f,_0x2316ee){return function(_0x21ee1a){if(_0x21ee1a){return _0x21ee1a[_0x732c('0x25')](_0x25dc8f)[_0x732c('0x26')](function(_0x2c20f0){return _0x2c20f0;});}return null;};}function removeEntity(_0x5232db,_0x3196fe){return function(_0x101f7a){if(_0x101f7a){return _0x101f7a['destroy']()[_0x732c('0x26')](function(){var _0x15c776=_0x101f7a['get']({'plain':!![]});var _0x142765=_0x732c('0x27');return db[_0x732c('0x28')]['destroy']({'where':{'type':_0x142765,'resourceId':_0x15c776['id']}})['then'](function(){return _0x101f7a;});})['then'](function(){_0x5232db[_0x732c('0x19')](0xcc)[_0x732c('0x1a')]();});}};}function handleEntityNotFound(_0x44f23b,_0x100514){return function(_0x3a3907){if(!_0x3a3907){_0x44f23b[_0x732c('0x18')](0x194);}return _0x3a3907;};}function handleError(_0x451d58,_0xb53527){_0xb53527=_0xb53527||0x1f4;return function(_0x32fd61){logger[_0x732c('0x29')](_0x32fd61[_0x732c('0x2a')]);if(_0x32fd61['name']){delete _0x32fd61[_0x732c('0x2b')];}_0x451d58[_0x732c('0x19')](_0xb53527)[_0x732c('0x2c')](_0x32fd61);};}exports[_0x732c('0x2d')]=function(_0x395170,_0x4d272f){var _0x52e5ae={},_0x1b5128={},_0x74d20d={'count':0x0,'rows':[]};var _0x50e4f8=_['map'](db[_0x732c('0x2e')]['rawAttributes'],function(_0x18e2b7){return{'name':_0x18e2b7[_0x732c('0x2f')],'type':_0x18e2b7[_0x732c('0x30')]['key']};});_0x1b5128[_0x732c('0x31')]=_[_0x732c('0x32')](_0x50e4f8,_0x732c('0x2b'));_0x1b5128['query']=_[_0x732c('0x33')](_0x395170[_0x732c('0x34')]);_0x1b5128[_0x732c('0x35')]=_[_0x732c('0x36')](_0x1b5128[_0x732c('0x31')],_0x1b5128[_0x732c('0x34')]);_0x52e5ae[_0x732c('0x37')]=_[_0x732c('0x36')](_0x1b5128[_0x732c('0x31')],qs['fields'](_0x395170[_0x732c('0x34')][_0x732c('0x38')]));_0x52e5ae['attributes']=_0x52e5ae['attributes'][_0x732c('0x39')]?_0x52e5ae[_0x732c('0x37')]:_0x1b5128[_0x732c('0x31')];if(!_0x395170[_0x732c('0x34')][_0x732c('0x3a')](_0x732c('0x3b'))){_0x52e5ae['limit']=qs[_0x732c('0x1e')](_0x395170['query'][_0x732c('0x1e')]);_0x52e5ae[_0x732c('0x1c')]=qs[_0x732c('0x1c')](_0x395170[_0x732c('0x34')][_0x732c('0x1c')]);}_0x52e5ae[_0x732c('0x3c')]=qs[_0x732c('0x3d')](_0x395170[_0x732c('0x34')][_0x732c('0x3d')]);_0x52e5ae['where']=qs[_0x732c('0x35')](_[_0x732c('0x3e')](_0x395170[_0x732c('0x34')],_0x1b5128['filters']),_0x50e4f8);if(_0x395170[_0x732c('0x34')]['filter']){_0x52e5ae['where']=_[_0x732c('0x3f')](_0x52e5ae[_0x732c('0x40')],{'$or':_[_0x732c('0x32')](_0x50e4f8,function(_0x45f83c){if(_0x45f83c[_0x732c('0x30')]!=='VIRTUAL'){var _0x296ac5={};_0x296ac5[_0x45f83c[_0x732c('0x2b')]]={'$like':'%'+_0x395170[_0x732c('0x34')][_0x732c('0x41')]+'%'};return _0x296ac5;}})});}_0x52e5ae=_[_0x732c('0x3f')]({},_0x52e5ae,_0x395170[_0x732c('0x42')]);var _0x340089={'where':_0x52e5ae[_0x732c('0x40')]};return db[_0x732c('0x2e')]['count'](_0x340089)[_0x732c('0x26')](function(_0xf25b08){_0x74d20d[_0x732c('0x1f')]=_0xf25b08;if(_0x395170[_0x732c('0x34')][_0x732c('0x43')]){_0x52e5ae[_0x732c('0x44')]=[{'all':!![]}];}return db[_0x732c('0x2e')]['findAll'](_0x52e5ae);})[_0x732c('0x26')](function(_0x4d3c04){_0x74d20d[_0x732c('0x45')]=_0x4d3c04;return _0x74d20d;})[_0x732c('0x26')](respondWithFilteredResult(_0x4d272f,_0x52e5ae))[_0x732c('0x46')](handleError(_0x4d272f,null));};exports['show']=function(_0x1d4684,_0x59a0f2){var _0x401461={'raw':![],'where':{'id':_0x1d4684['params']['id']}},_0x310708={};_0x310708[_0x732c('0x31')]=_[_0x732c('0x33')](db[_0x732c('0x2e')][_0x732c('0x47')]);_0x310708[_0x732c('0x34')]=_[_0x732c('0x33')](_0x1d4684[_0x732c('0x34')]);_0x310708[_0x732c('0x35')]=_[_0x732c('0x36')](_0x310708[_0x732c('0x31')],_0x310708[_0x732c('0x34')]);_0x401461[_0x732c('0x37')]=_[_0x732c('0x36')](_0x310708[_0x732c('0x31')],qs[_0x732c('0x38')](_0x1d4684['query']['fields']));_0x401461[_0x732c('0x37')]=_0x401461[_0x732c('0x37')][_0x732c('0x39')]?_0x401461[_0x732c('0x37')]:_0x310708[_0x732c('0x31')];if(_0x1d4684[_0x732c('0x34')][_0x732c('0x43')]){_0x401461[_0x732c('0x44')]=[{'all':!![]}];}_0x401461=_['merge']({},_0x401461,_0x1d4684['options']);return db[_0x732c('0x2e')][_0x732c('0x48')](_0x401461)[_0x732c('0x26')](handleEntityNotFound(_0x59a0f2,null))[_0x732c('0x26')](respondWithResult(_0x59a0f2,null))[_0x732c('0x46')](handleError(_0x59a0f2,null));};exports['create']=function(_0x52c4f1,_0x5b3db3){return db['Schedule'][_0x732c('0x49')](_0x52c4f1['body'],{})[_0x732c('0x26')](function(_0x5b5201){var _0x42abdd=_0x52c4f1[_0x732c('0x4a')][_0x732c('0x4b')]({'plain':!![]});if(!_0x42abdd)throw new Error(_0x732c('0x4c'));if(_0x42abdd['role']===_0x732c('0x4a')){var _0x4ed92c=_0x5b5201[_0x732c('0x4b')]({'plain':!![]});var _0x23fc7a=_0x732c('0x27');return db['UserProfileSection'][_0x732c('0x48')]({'where':{'name':_0x23fc7a,'userProfileId':_0x42abdd['userProfileId']},'raw':!![]})['then'](function(_0x115160){if(_0x115160&&_0x115160[_0x732c('0x4d')]===0x0){return db[_0x732c('0x28')][_0x732c('0x49')]({'name':_0x4ed92c['name'],'resourceId':_0x4ed92c['id'],'type':_0x115160['name'],'sectionId':_0x115160['id']},{})['then'](function(){return _0x5b5201;});}else{return _0x5b5201;}})[_0x732c('0x46')](function(_0x5b9b86){logger[_0x732c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b9b86);throw _0x5b9b86;});}return _0x5b5201;})[_0x732c('0x26')](respondWithResult(_0x5b3db3,0xc9))[_0x732c('0x46')](handleError(_0x5b3db3,null));};exports[_0x732c('0x25')]=function(_0x2ffeb1,_0x4f6aa3){if(_0x2ffeb1['body']['id']){delete _0x2ffeb1[_0x732c('0x4e')]['id'];}return db[_0x732c('0x2e')][_0x732c('0x48')]({'where':{'id':_0x2ffeb1[_0x732c('0x4f')]['id']}})[_0x732c('0x26')](handleEntityNotFound(_0x4f6aa3,null))['then'](saveUpdates(_0x2ffeb1[_0x732c('0x4e')],null))[_0x732c('0x26')](respondWithResult(_0x4f6aa3,null))[_0x732c('0x46')](handleError(_0x4f6aa3,null));};exports[_0x732c('0x50')]=function(_0x1fd39a,_0x4e1f52){return db[_0x732c('0x2e')][_0x732c('0x48')]({'where':{'id':_0x1fd39a['params']['id']}})[_0x732c('0x26')](handleEntityNotFound(_0x4e1f52,null))[_0x732c('0x26')](removeEntity(_0x4e1f52,null))[_0x732c('0x46')](handleError(_0x4e1f52,null));};exports[_0x732c('0x51')]=function(_0x3ebc5d,_0x2e51b7,_0x5285ce){var _0x1b879a=require('../../config/schedule');return db[_0x732c('0x2e')][_0x732c('0x48')]({'where':{'id':_0x3ebc5d[_0x732c('0x4f')]['id']},'raw':!![]})[_0x732c('0x26')](handleEntityNotFound(_0x2e51b7,null))[_0x732c('0x26')](function(){_0x1b879a['run'](_0x3ebc5d[_0x732c('0x4f')]['id']);})['then'](respondWithStatusCode(_0x2e51b7,null))[_0x732c('0x46')](handleError(_0x2e51b7,null));}; \ No newline at end of file +var _0x1cf8=['offset','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','keys','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','rimraf','zip-dir','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x1cf8,0x83));var _0x81cf=function(_0x295b61,_0x808c6c){_0x295b61=_0x295b61-0x0;var _0x1f9558=_0x1cf8[_0x295b61];return _0x1f9558;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81cf('0x0'));var zipdir=require(_0x81cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x81cf('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x81cf('0x3'));var sox=require(_0x81cf('0x4'));var csv=require(_0x81cf('0x5'));var ejs=require(_0x81cf('0x6'));var fs=require('fs');var fs_extra=require(_0x81cf('0x7'));var _=require(_0x81cf('0x8'));var squel=require(_0x81cf('0x9'));var crypto=require(_0x81cf('0xa'));var jsforce=require(_0x81cf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x81cf('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x81cf('0xc'));var authService=require(_0x81cf('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x81cf('0xe'));var hardwareService=require(_0x81cf('0xf'));var logger=require(_0x81cf('0x10'))('api');var utils=require(_0x81cf('0x11'));var config=require(_0x81cf('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x81cf('0x13'))['db'];function respondWithStatusCode(_0x58cf49,_0x38d6d4){_0x38d6d4=_0x38d6d4||0xcc;return function(_0x443690){if(_0x443690){return _0x58cf49[_0x81cf('0x14')](_0x38d6d4);}return _0x58cf49[_0x81cf('0x15')](_0x38d6d4)['end']();};}function respondWithResult(_0x42b8b6,_0xe29784){_0xe29784=_0xe29784||0xc8;return function(_0xb37355){if(_0xb37355){return _0x42b8b6[_0x81cf('0x15')](_0xe29784)[_0x81cf('0x16')](_0xb37355);}};}function respondWithFilteredResult(_0xb1df26,_0x38e532){return function(_0x5eb419){if(_0x5eb419){var _0x20db77=typeof _0x38e532['offset']===_0x81cf('0x17')&&typeof _0x38e532['limit']==='undefined';var _0x191d4f=_0x5eb419[_0x81cf('0x18')];var _0x3949ee=_0x20db77?0x0:_0x38e532[_0x81cf('0x19')];var _0x460a72=_0x20db77?_0x5eb419[_0x81cf('0x18')]:_0x38e532[_0x81cf('0x19')]+_0x38e532['limit'];var _0x4ef3f9;if(_0x460a72>=_0x191d4f){_0x460a72=_0x191d4f;_0x4ef3f9=0xc8;}else{_0x4ef3f9=0xce;}_0xb1df26['status'](_0x4ef3f9);return _0xb1df26[_0x81cf('0x1a')](_0x81cf('0x1b'),_0x3949ee+'-'+_0x460a72+'/'+_0x191d4f)[_0x81cf('0x16')](_0x5eb419);}return null;};}function patchUpdates(_0x2926e8){return function(_0x2f1a3c){try{jsonpatch[_0x81cf('0x1c')](_0x2f1a3c,_0x2926e8,!![]);}catch(_0x3cbd16){return BPromise[_0x81cf('0x1d')](_0x3cbd16);}return _0x2f1a3c['save']();};}function saveUpdates(_0x2c2333,_0x1214fc){return function(_0x3d9a1b){if(_0x3d9a1b){return _0x3d9a1b[_0x81cf('0x1e')](_0x2c2333)[_0x81cf('0x1f')](function(_0x42bc8d){return _0x42bc8d;});}return null;};}function removeEntity(_0x557eba,_0x440e9a){return function(_0x25484f){if(_0x25484f){return _0x25484f[_0x81cf('0x20')]()[_0x81cf('0x1f')](function(){var _0x22015a=_0x25484f[_0x81cf('0x21')]({'plain':!![]});var _0x16bd6b=_0x81cf('0x22');return db[_0x81cf('0x23')][_0x81cf('0x20')]({'where':{'type':_0x16bd6b,'resourceId':_0x22015a['id']}})[_0x81cf('0x1f')](function(){return _0x25484f;});})[_0x81cf('0x1f')](function(){_0x557eba[_0x81cf('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2641dd,_0xc9a3bb){return function(_0x24e5b3){if(!_0x24e5b3){_0x2641dd[_0x81cf('0x14')](0x194);}return _0x24e5b3;};}function handleError(_0x300325,_0x3a671e){_0x3a671e=_0x3a671e||0x1f4;return function(_0x4b811a){logger['error'](_0x4b811a[_0x81cf('0x24')]);if(_0x4b811a[_0x81cf('0x25')]){delete _0x4b811a[_0x81cf('0x25')];}_0x300325['status'](_0x3a671e)['send'](_0x4b811a);};}exports[_0x81cf('0x26')]=function(_0x582932,_0x4e86b6){var _0x24a825={},_0x42aee8={},_0x17cf26={'count':0x0,'rows':[]};var _0x548ed6=_[_0x81cf('0x27')](db[_0x81cf('0x28')][_0x81cf('0x29')],function(_0x423056){return{'name':_0x423056[_0x81cf('0x2a')],'type':_0x423056[_0x81cf('0x2b')][_0x81cf('0x2c')]};});_0x42aee8['model']=_[_0x81cf('0x27')](_0x548ed6,_0x81cf('0x25'));_0x42aee8[_0x81cf('0x2d')]=_['keys'](_0x582932[_0x81cf('0x2d')]);_0x42aee8[_0x81cf('0x2e')]=_[_0x81cf('0x2f')](_0x42aee8[_0x81cf('0x30')],_0x42aee8[_0x81cf('0x2d')]);_0x24a825['attributes']=_[_0x81cf('0x2f')](_0x42aee8[_0x81cf('0x30')],qs['fields'](_0x582932[_0x81cf('0x2d')]['fields']));_0x24a825[_0x81cf('0x31')]=_0x24a825['attributes']['length']?_0x24a825[_0x81cf('0x31')]:_0x42aee8[_0x81cf('0x30')];if(!_0x582932[_0x81cf('0x2d')][_0x81cf('0x32')]('nolimit')){_0x24a825[_0x81cf('0x33')]=qs[_0x81cf('0x33')](_0x582932[_0x81cf('0x2d')][_0x81cf('0x33')]);_0x24a825[_0x81cf('0x19')]=qs[_0x81cf('0x19')](_0x582932['query'][_0x81cf('0x19')]);}_0x24a825[_0x81cf('0x34')]=qs['sort'](_0x582932[_0x81cf('0x2d')][_0x81cf('0x35')]);_0x24a825[_0x81cf('0x36')]=qs[_0x81cf('0x2e')](_[_0x81cf('0x37')](_0x582932[_0x81cf('0x2d')],_0x42aee8['filters']),_0x548ed6);if(_0x582932[_0x81cf('0x2d')][_0x81cf('0x38')]){_0x24a825[_0x81cf('0x36')]=_[_0x81cf('0x39')](_0x24a825[_0x81cf('0x36')],{'$or':_[_0x81cf('0x27')](_0x548ed6,function(_0x477a43){if(_0x477a43['type']!==_0x81cf('0x3a')){var _0x570a82={};_0x570a82[_0x477a43[_0x81cf('0x25')]]={'$like':'%'+_0x582932[_0x81cf('0x2d')][_0x81cf('0x38')]+'%'};return _0x570a82;}})});}_0x24a825=_[_0x81cf('0x39')]({},_0x24a825,_0x582932['options']);var _0x2a50dd={'where':_0x24a825['where']};return db[_0x81cf('0x28')][_0x81cf('0x18')](_0x2a50dd)[_0x81cf('0x1f')](function(_0x2945df){_0x17cf26[_0x81cf('0x18')]=_0x2945df;if(_0x582932[_0x81cf('0x2d')][_0x81cf('0x3b')]){_0x24a825['include']=[{'all':!![]}];}return db[_0x81cf('0x28')][_0x81cf('0x3c')](_0x24a825);})[_0x81cf('0x1f')](function(_0x3148fd){_0x17cf26['rows']=_0x3148fd;return _0x17cf26;})[_0x81cf('0x1f')](respondWithFilteredResult(_0x4e86b6,_0x24a825))[_0x81cf('0x3d')](handleError(_0x4e86b6,null));};exports[_0x81cf('0x3e')]=function(_0xdb1e9d,_0x2b243e){var _0x3bffb7={'raw':![],'where':{'id':_0xdb1e9d['params']['id']}},_0x4ff2e2={};_0x4ff2e2[_0x81cf('0x30')]=_[_0x81cf('0x3f')](db[_0x81cf('0x28')][_0x81cf('0x29')]);_0x4ff2e2['query']=_[_0x81cf('0x3f')](_0xdb1e9d[_0x81cf('0x2d')]);_0x4ff2e2[_0x81cf('0x2e')]=_[_0x81cf('0x2f')](_0x4ff2e2['model'],_0x4ff2e2[_0x81cf('0x2d')]);_0x3bffb7['attributes']=_[_0x81cf('0x2f')](_0x4ff2e2[_0x81cf('0x30')],qs[_0x81cf('0x40')](_0xdb1e9d[_0x81cf('0x2d')][_0x81cf('0x40')]));_0x3bffb7[_0x81cf('0x31')]=_0x3bffb7[_0x81cf('0x31')][_0x81cf('0x41')]?_0x3bffb7[_0x81cf('0x31')]:_0x4ff2e2[_0x81cf('0x30')];if(_0xdb1e9d['query'][_0x81cf('0x3b')]){_0x3bffb7[_0x81cf('0x42')]=[{'all':!![]}];}_0x3bffb7=_[_0x81cf('0x39')]({},_0x3bffb7,_0xdb1e9d['options']);return db[_0x81cf('0x28')][_0x81cf('0x43')](_0x3bffb7)[_0x81cf('0x1f')](handleEntityNotFound(_0x2b243e,null))[_0x81cf('0x1f')](respondWithResult(_0x2b243e,null))[_0x81cf('0x3d')](handleError(_0x2b243e,null));};exports[_0x81cf('0x44')]=function(_0x53bc5b,_0x5f2c7b){return db[_0x81cf('0x28')][_0x81cf('0x44')](_0x53bc5b[_0x81cf('0x45')],{})[_0x81cf('0x1f')](function(_0x55cf4a){var _0x4a657e=_0x53bc5b[_0x81cf('0x46')][_0x81cf('0x21')]({'plain':!![]});if(!_0x4a657e)throw new Error(_0x81cf('0x47'));if(_0x4a657e['role']===_0x81cf('0x46')){var _0x24ca24=_0x55cf4a[_0x81cf('0x21')]({'plain':!![]});var _0x3bc798=_0x81cf('0x22');return db[_0x81cf('0x48')][_0x81cf('0x43')]({'where':{'name':_0x3bc798,'userProfileId':_0x4a657e['userProfileId']},'raw':!![]})[_0x81cf('0x1f')](function(_0x24992b){if(_0x24992b&&_0x24992b[_0x81cf('0x49')]===0x0){return db[_0x81cf('0x23')][_0x81cf('0x44')]({'name':_0x24ca24[_0x81cf('0x25')],'resourceId':_0x24ca24['id'],'type':_0x24992b[_0x81cf('0x25')],'sectionId':_0x24992b['id']},{})[_0x81cf('0x1f')](function(){return _0x55cf4a;});}else{return _0x55cf4a;}})[_0x81cf('0x3d')](function(_0x1ef093){logger['error'](_0x81cf('0x4a'),_0x1ef093);throw _0x1ef093;});}return _0x55cf4a;})[_0x81cf('0x1f')](respondWithResult(_0x5f2c7b,0xc9))[_0x81cf('0x3d')](handleError(_0x5f2c7b,null));};exports[_0x81cf('0x1e')]=function(_0x1312bf,_0x57aa0e){if(_0x1312bf[_0x81cf('0x45')]['id']){delete _0x1312bf[_0x81cf('0x45')]['id'];}return db[_0x81cf('0x28')][_0x81cf('0x43')]({'where':{'id':_0x1312bf[_0x81cf('0x4b')]['id']}})[_0x81cf('0x1f')](handleEntityNotFound(_0x57aa0e,null))[_0x81cf('0x1f')](saveUpdates(_0x1312bf[_0x81cf('0x45')],null))[_0x81cf('0x1f')](respondWithResult(_0x57aa0e,null))[_0x81cf('0x3d')](handleError(_0x57aa0e,null));};exports['destroy']=function(_0x4f9916,_0x15a2ed){return db['Schedule'][_0x81cf('0x43')]({'where':{'id':_0x4f9916[_0x81cf('0x4b')]['id']}})[_0x81cf('0x1f')](handleEntityNotFound(_0x15a2ed,null))[_0x81cf('0x1f')](removeEntity(_0x15a2ed,null))[_0x81cf('0x3d')](handleError(_0x15a2ed,null));};exports[_0x81cf('0x4c')]=function(_0x489277,_0x30a220,_0x357e2b){var _0x30a96e=require(_0x81cf('0x4d'));return db['Schedule']['find']({'where':{'id':_0x489277[_0x81cf('0x4b')]['id']},'raw':!![]})[_0x81cf('0x1f')](handleEntityNotFound(_0x30a220,null))[_0x81cf('0x1f')](function(){_0x30a96e[_0x81cf('0x4c')](_0x489277['params']['id']);})['then'](respondWithStatusCode(_0x30a220,null))[_0x81cf('0x3d')](handleError(_0x30a220,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 6c87f44..66335d4 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 _0xd5dd=['request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xd5dd,0x117));var _0xdd5d=function(_0x7163bb,_0xd89f94){_0x7163bb=_0x7163bb-0x0;var _0x5e2c02=_0xd5dd[_0x7163bb];return _0x5e2c02;};'use strict';var _=require(_0xdd5d('0x0'));var util=require(_0xdd5d('0x1'));var logger=require(_0xdd5d('0x2'))(_0xdd5d('0x3'));var moment=require(_0xdd5d('0x4'));var BPromise=require(_0xdd5d('0x5'));var rp=require(_0xdd5d('0x6'));var fs=require('fs');var path=require(_0xdd5d('0x7'));var rimraf=require(_0xdd5d('0x8'));var config=require(_0xdd5d('0x9'));var attributes=require(_0xdd5d('0xa'));module[_0xdd5d('0xb')]=function(_0x17ec75,_0x43de52){return _0x17ec75[_0xdd5d('0xc')](_0xdd5d('0xd'),attributes,{'tableName':_0xdd5d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2a9=['../../config/logger','api','moment','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xe2a9,0x143));var _0x9e2a=function(_0x52d73d,_0x310285){_0x52d73d=_0x52d73d-0x0;var _0x2d47b9=_0xe2a9[_0x52d73d];return _0x2d47b9;};'use strict';var _=require('lodash');var util=require(_0x9e2a('0x0'));var logger=require(_0x9e2a('0x1'))(_0x9e2a('0x2'));var moment=require(_0x9e2a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e2a('0x4'));var rimraf=require(_0x9e2a('0x5'));var config=require(_0x9e2a('0x6'));var attributes=require(_0x9e2a('0x7'));module[_0x9e2a('0x8')]=function(_0x11e548,_0xd17e83){return _0x11e548[_0x9e2a('0x9')](_0x9e2a('0xa'),attributes,{'tableName':_0x9e2a('0xb'),'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 ad71b1a..168d470 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 _0xeaf7=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s'];(function(_0x4bd4e1,_0x516211){var _0x1a165c=function(_0x257ddc){while(--_0x257ddc){_0x4bd4e1['push'](_0x4bd4e1['shift']());}};_0x1a165c(++_0x516211);}(_0xeaf7,0x15d));var _0x7eaf=function(_0x57a031,_0x282e9a){_0x57a031=_0x57a031-0x0;var _0x2a6fc4=_0xeaf7[_0x57a031];return _0x2a6fc4;};'use strict';var _=require(_0x7eaf('0x0'));var util=require(_0x7eaf('0x1'));var moment=require('moment');var BPromise=require(_0x7eaf('0x2'));var rs=require(_0x7eaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7eaf('0x4'))['db'];var utils=require(_0x7eaf('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7eaf('0x6'));var client=jayson[_0x7eaf('0x7')][_0x7eaf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x452a22,_0xf90bfd,_0x3a987e){return new BPromise(function(_0x29212b,_0xf9edae){return client[_0x7eaf('0x9')](_0x452a22,_0x3a987e)['then'](function(_0x36f782){logger[_0x7eaf('0xa')](_0x7eaf('0xb'),_0xf90bfd,_0x7eaf('0xc'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0xf90bfd,_0x7eaf('0xc'),JSON[_0x7eaf('0xd')](_0x36f782));if(_0x36f782[_0x7eaf('0xe')]){if(_0x36f782[_0x7eaf('0xe')][_0x7eaf('0xf')]===0x1f4){logger[_0x7eaf('0xe')](_0x7eaf('0xb'),_0xf90bfd,_0x36f782[_0x7eaf('0xe')]['message']);return _0xf9edae(_0x36f782[_0x7eaf('0xe')]['message']);}logger[_0x7eaf('0xe')]('Schedule,\x20%s,\x20%s',_0xf90bfd,_0x36f782[_0x7eaf('0xe')][_0x7eaf('0x10')]);return _0x29212b(_0x36f782['error'][_0x7eaf('0x10')]);}else{logger[_0x7eaf('0xa')](_0x7eaf('0xb'),_0xf90bfd,_0x7eaf('0xc'));_0x29212b(_0x36f782[_0x7eaf('0x11')][_0x7eaf('0x10')]);}})[_0x7eaf('0x12')](function(_0x48a39d){logger['error'](_0x7eaf('0xb'),_0xf90bfd,_0x48a39d);_0xf9edae(_0x48a39d);});});} \ No newline at end of file +var _0x54e1=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird'];(function(_0x1d5c43,_0x328375){var _0x4d785b=function(_0x53cbc9){while(--_0x53cbc9){_0x1d5c43['push'](_0x1d5c43['shift']());}};_0x4d785b(++_0x328375);}(_0x54e1,0x11a));var _0x154e=function(_0x47aa05,_0x637516){_0x47aa05=_0x47aa05-0x0;var _0x4630a0=_0x54e1[_0x47aa05];return _0x4630a0;};'use strict';var _=require(_0x154e('0x0'));var util=require('util');var moment=require(_0x154e('0x1'));var BPromise=require(_0x154e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x154e('0x3'));var db=require(_0x154e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x154e('0x5'));var config=require(_0x154e('0x6'));var jayson=require(_0x154e('0x7'));var client=jayson[_0x154e('0x8')][_0x154e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c2e36,_0x3f73c1,_0x352c15){return new BPromise(function(_0x137949,_0x28b955){return client[_0x154e('0xa')](_0x4c2e36,_0x352c15)['then'](function(_0x38a231){logger['info'](_0x154e('0xb'),_0x3f73c1,_0x154e('0xc'));logger[_0x154e('0xd')](_0x154e('0xe'),_0x3f73c1,_0x154e('0xc'),JSON['stringify'](_0x38a231));if(_0x38a231[_0x154e('0xf')]){if(_0x38a231[_0x154e('0xf')]['code']===0x1f4){logger[_0x154e('0xf')](_0x154e('0xb'),_0x3f73c1,_0x38a231[_0x154e('0xf')][_0x154e('0x10')]);return _0x28b955(_0x38a231[_0x154e('0xf')][_0x154e('0x10')]);}logger[_0x154e('0xf')](_0x154e('0xb'),_0x3f73c1,_0x38a231['error'][_0x154e('0x10')]);return _0x137949(_0x38a231['error'][_0x154e('0x10')]);}else{logger['info'](_0x154e('0xb'),_0x3f73c1,_0x154e('0xc'));_0x137949(_0x38a231[_0x154e('0x11')][_0x154e('0x10')]);}})[_0x154e('0x12')](function(_0x55550b){logger[_0x154e('0xf')](_0x154e('0xb'),_0x3f73c1,_0x55550b);_0x28b955(_0x55550b);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index eb1a6bc..0eea109 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 _0xdd0d=['get','/describe','/:id','show','/:id/download','download','post','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','isAuthenticated','index'];(function(_0x595c82,_0x241622){var _0x5edc75=function(_0x39eb9f){while(--_0x39eb9f){_0x595c82['push'](_0x595c82['shift']());}};_0x5edc75(++_0x241622);}(_0xdd0d,0x89));var _0xddd0=function(_0x2d1c35,_0x4aacf0){_0x2d1c35=_0x2d1c35-0x0;var _0x21f908=_0xdd0d[_0x2d1c35];return _0x21f908;};'use strict';var multer=require(_0xddd0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xddd0('0x1'));var express=require(_0xddd0('0x2'));var router=express[_0xddd0('0x3')]();var fs_extra=require(_0xddd0('0x4'));var auth=require(_0xddd0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddd0('0x6'));var controller=require(_0xddd0('0x7'));router['get']('/',auth[_0xddd0('0x8')](),controller[_0xddd0('0x9')]);router[_0xddd0('0xa')](_0xddd0('0xb'),auth[_0xddd0('0x8')](),controller['describe']);router[_0xddd0('0xa')](_0xddd0('0xc'),auth[_0xddd0('0x8')](),controller[_0xddd0('0xd')]);router['get'](_0xddd0('0xe'),auth[_0xddd0('0x8')](),controller[_0xddd0('0xf')]);router[_0xddd0('0x10')]('/',auth[_0xddd0('0x8')](),controller[_0xddd0('0x11')]);router['put'](_0xddd0('0xc'),auth['isAuthenticated'](),controller[_0xddd0('0x12')]);router[_0xddd0('0x13')]('/:id',auth[_0xddd0('0x8')](),controller[_0xddd0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8ba4=['put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','describe','download','post','create'];(function(_0x146c5c,_0x5ede3c){var _0x177d13=function(_0x543350){while(--_0x543350){_0x146c5c['push'](_0x146c5c['shift']());}};_0x177d13(++_0x5ede3c);}(_0x8ba4,0x140));var _0x48ba=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x8ba4[_0x3e2fcf];return _0x497db7;};'use strict';var multer=require(_0x48ba('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x48ba('0x1'));var express=require(_0x48ba('0x2'));var router=express[_0x48ba('0x3')]();var fs_extra=require(_0x48ba('0x4'));var auth=require(_0x48ba('0x5'));var interaction=require(_0x48ba('0x6'));var config=require(_0x48ba('0x7'));var controller=require(_0x48ba('0x8'));router[_0x48ba('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x48ba('0xa'),auth[_0x48ba('0xb')](),controller[_0x48ba('0xc')]);router[_0x48ba('0x9')]('/:id',auth[_0x48ba('0xb')](),controller['show']);router['get']('/:id/download',auth[_0x48ba('0xb')](),controller[_0x48ba('0xd')]);router[_0x48ba('0xe')]('/',auth[_0x48ba('0xb')](),controller[_0x48ba('0xf')]);router[_0x48ba('0x10')](_0x48ba('0x11'),auth[_0x48ba('0xb')](),controller[_0x48ba('0x12')]);router[_0x48ba('0x13')](_0x48ba('0x11'),auth[_0x48ba('0xb')](),controller[_0x48ba('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c687001..63fa948 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 _0xf29d=['DATE','startedAt','format','toString','createdAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','closedAt','duration'];(function(_0x1dfa55,_0x1d2007){var _0x893d0e=function(_0x30cace){while(--_0x30cace){_0x1dfa55['push'](_0x1dfa55['shift']());}};_0x893d0e(++_0x1d2007);}(_0xf29d,0xc4));var _0xdf29=function(_0x5c0259,_0xb2407f){_0x5c0259=_0x5c0259-0x0;var _0x2a80cb=_0xf29d[_0x5c0259];return _0x2a80cb;};'use strict';var Sequelize=require(_0xdf29('0x0'));var moment=require(_0xdf29('0x1'));var path=require('path');var config=require(_0xdf29('0x2'));module[_0xdf29('0x3')]={'format':{'type':Sequelize[_0xdf29('0x4')],'get':function(){return this[_0xdf29('0x5')](_0xdf29('0x6'))?path['extname'](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0xdf29('0x7')]},'channel':{'type':Sequelize[_0xdf29('0x7')]},'value':{'type':Sequelize[_0xdf29('0x7')],'set':function(_0x4b648e){var _0x39b352=_0x4b648e[_0xdf29('0x8')](/\\/g,'/');this[_0xdf29('0x9')]('value',_0x39b352);}},'rating':{'type':Sequelize[_0xdf29('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdf29('0xa')],'set':function(_0x1fb3f1){this[_0xdf29('0x9')]('startedAt',moment()['subtract'](_0x1fb3f1,'ms'));this[_0xdf29('0x9')](_0xdf29('0xb'),moment());this['setDataValue'](_0xdf29('0xc'),_0x1fb3f1);}},'startedAt':{'type':Sequelize[_0xdf29('0xd')],'get':function(){return moment(this[_0xdf29('0x5')](_0xdf29('0xe')))[_0xdf29('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xdf29('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xdf29('0x5')](_0xdf29('0xb')))[_0xdf29('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xdf29('0x10')]();}},'createdAt':{'type':Sequelize[_0xdf29('0xd')],'get':function(){return moment(this['getDataValue'](_0xdf29('0x11')))[_0xdf29('0xf')](_0xdf29('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0xdf29('0xd')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xdf29('0xf')](_0xdf29('0x12'))['toString']();}}}; \ No newline at end of file +var _0xd070=['startedAt','subtract','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','closedAt','format','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER'];(function(_0x592cea,_0x4e72f1){var _0x1e9cc6=function(_0x166217){while(--_0x166217){_0x592cea['push'](_0x592cea['shift']());}};_0x1e9cc6(++_0x4e72f1);}(_0xd070,0x8e));var _0x0d07=function(_0x210a24,_0x33f94d){_0x210a24=_0x210a24-0x0;var _0x7d90f1=_0xd070[_0x210a24];return _0x7d90f1;};'use strict';var Sequelize=require(_0x0d07('0x0'));var moment=require('moment');var path=require(_0x0d07('0x1'));var config=require(_0x0d07('0x2'));module[_0x0d07('0x3')]={'format':{'type':Sequelize[_0x0d07('0x4')],'get':function(){return this[_0x0d07('0x5')](_0x0d07('0x6'))?path[_0x0d07('0x7')](this[_0x0d07('0x5')](_0x0d07('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x0d07('0x8')]},'channel':{'type':Sequelize[_0x0d07('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x13d75a){var _0x5a4366=_0x13d75a[_0x0d07('0x9')](/\\/g,'/');this[_0x0d07('0xa')](_0x0d07('0x6'),_0x5a4366);}},'rating':{'type':Sequelize[_0x0d07('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0d07('0xb')],'set':function(_0xc5b04d){this[_0x0d07('0xa')](_0x0d07('0xc'),moment()[_0x0d07('0xd')](_0xc5b04d,'ms'));this[_0x0d07('0xa')]('closedAt',moment());this['setDataValue'](_0x0d07('0xe'),_0xc5b04d);}},'startedAt':{'type':Sequelize[_0x0d07('0xf')],'get':function(){return moment(this['getDataValue'](_0x0d07('0xc')))['format'](_0x0d07('0x10'))[_0x0d07('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0d07('0x5')](_0x0d07('0x12')))[_0x0d07('0x13')](_0x0d07('0x10'))[_0x0d07('0x11')]();}},'createdAt':{'type':Sequelize[_0x0d07('0xf')],'get':function(){return moment(this['getDataValue'](_0x0d07('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0x0d07('0x11')]();}},'updatedAt':{'type':Sequelize[_0x0d07('0xf')],'get':function(){return moment(this[_0x0d07('0x5')](_0x0d07('0x15')))[_0x0d07('0x13')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9c5c6ea..418f754 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 _0x24ca=['server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','ScreenRecording','include','findAll','rows','catch','show','model','includeAll','find','create','body','duration','createdAt','closedAt','params','describe','download','uniqueid','value','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','join'];(function(_0x1205b6,_0x4198df){var _0x3584f2=function(_0xb09535){while(--_0xb09535){_0x1205b6['push'](_0x1205b6['shift']());}};_0x3584f2(++_0x4198df);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x24ca[_0x4d8a8f];return _0xfc4adc;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){_0x346ee8['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x5cc9cb,_0x2365f9){return function(_0x3951ae){if(!_0x3951ae){_0x5cc9cb[_0xa24c('0x29')](0x194);}return _0x3951ae;};}function handleError(_0x51dc3f,_0x1beb55){_0x1beb55=_0x1beb55||0x1f4;return function(_0x31c4d9){logger[_0xa24c('0x2a')](_0x31c4d9[_0xa24c('0x2b')]);if(_0x31c4d9[_0xa24c('0x2c')]){delete _0x31c4d9[_0xa24c('0x2c')];}_0x51dc3f[_0xa24c('0x1b')](_0x1beb55)['send'](_0x31c4d9);};}exports[_0xa24c('0x2d')]=function(_0x28675f,_0x152120){var _0x12dbdc={},_0x5e491e={},_0x21d2a8={'count':0x0,'rows':[]};var _0xc96ce7=_[_0xa24c('0x2e')](db['ScreenRecording'][_0xa24c('0x2f')],function(_0x3dcb1b){return{'name':_0x3dcb1b[_0xa24c('0x30')],'type':_0x3dcb1b['type'][_0xa24c('0x31')]};});_0x5e491e['model']=_[_0xa24c('0x32')](_[_0xa24c('0x2e')](_0xc96ce7,_0xa24c('0x2c')),['format']);_0x5e491e[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x28675f[_0xa24c('0x33')]);_0x5e491e['filters']=_[_0xa24c('0x35')](_0x5e491e['model'],_0x5e491e[_0xa24c('0x33')]);_0x12dbdc[_0xa24c('0x36')]=_['intersection'](_0x5e491e['model'],qs[_0xa24c('0x37')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x37')]));_0x12dbdc[_0xa24c('0x36')]=_0x12dbdc[_0xa24c('0x36')][_0xa24c('0x38')]?_0x12dbdc[_0xa24c('0x36')]:_0x5e491e['model'];if(!_0x28675f[_0xa24c('0x33')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x12dbdc[_0xa24c('0x1e')]=qs[_0xa24c('0x1e')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x1e')]);_0x12dbdc[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x28675f[_0xa24c('0x33')]['offset']);}_0x12dbdc[_0xa24c('0x3b')]=qs[_0xa24c('0x3c')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x3c')]);_0x12dbdc['where']=qs['filters'](_[_0xa24c('0x3d')](_0x28675f['query'],_0x5e491e[_0xa24c('0x3e')]),_0xc96ce7);if(_0x28675f[_0xa24c('0x33')][_0xa24c('0x3f')]){_0x12dbdc[_0xa24c('0x40')]=_[_0xa24c('0x41')](_0x12dbdc['where'],{'$or':_['map'](_0xc96ce7,function(_0x3121e){if(_0x3121e[_0xa24c('0x42')]!==_0xa24c('0x43')){var _0x213dc3={};_0x213dc3[_0x3121e[_0xa24c('0x2c')]]={'$like':'%'+_0x28675f[_0xa24c('0x33')]['filter']+'%'};return _0x213dc3;}})});}_0x12dbdc=_['merge']({},_0x12dbdc,_0x28675f[_0xa24c('0x44')]);var _0x1ce83e={'where':_0x12dbdc[_0xa24c('0x40')]};return db[_0xa24c('0x45')][_0xa24c('0x20')](_0x1ce83e)['then'](function(_0x171c51){_0x21d2a8[_0xa24c('0x20')]=_0x171c51;if(_0x28675f['query']['includeAll']){_0x12dbdc[_0xa24c('0x46')]=[{'all':!![]}];}return db[_0xa24c('0x45')][_0xa24c('0x47')](_0x12dbdc);})['then'](function(_0x58ac8b){_0x21d2a8[_0xa24c('0x48')]=_0x58ac8b;return _0x21d2a8;})[_0xa24c('0x27')](respondWithFilteredResult(_0x152120,_0x12dbdc))[_0xa24c('0x49')](handleError(_0x152120,null));};exports[_0xa24c('0x4a')]=function(_0x3f640e,_0x1b7faf){var _0x23d1e0={'raw':![],'where':{'id':_0x3f640e['params']['id']}},_0x394d19={};_0x394d19['model']=_[_0xa24c('0x34')](db[_0xa24c('0x45')][_0xa24c('0x2f')]);_0x394d19['query']=_[_0xa24c('0x34')](_0x3f640e[_0xa24c('0x33')]);_0x394d19[_0xa24c('0x3e')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],_0x394d19[_0xa24c('0x33')]);_0x23d1e0[_0xa24c('0x36')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],qs[_0xa24c('0x37')](_0x3f640e['query'][_0xa24c('0x37')]));_0x23d1e0[_0xa24c('0x36')]=_0x23d1e0[_0xa24c('0x36')]['length']?_0x23d1e0[_0xa24c('0x36')]:_0x394d19[_0xa24c('0x4b')];if(_0x3f640e[_0xa24c('0x33')][_0xa24c('0x4c')]){_0x23d1e0[_0xa24c('0x46')]=[{'all':!![]}];}_0x23d1e0=_[_0xa24c('0x41')]({},_0x23d1e0,_0x3f640e[_0xa24c('0x44')]);return db[_0xa24c('0x45')][_0xa24c('0x4d')](_0x23d1e0)[_0xa24c('0x27')](handleEntityNotFound(_0x1b7faf,null))[_0xa24c('0x27')](respondWithResult(_0x1b7faf,null))['catch'](handleError(_0x1b7faf,null));};exports[_0xa24c('0x4e')]=function(_0x96b977,_0x42028b){return db[_0xa24c('0x45')][_0xa24c('0x4e')](_0x96b977[_0xa24c('0x4f')],{})[_0xa24c('0x27')](respondWithResult(_0x42028b,0xc9))[_0xa24c('0x49')](handleError(_0x42028b,null));};exports[_0xa24c('0x26')]=function(_0x4f56ae,_0x540da8){if(_0x4f56ae[_0xa24c('0x4f')]['id']){delete _0x4f56ae['body']['id'];}delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x50')];delete _0x4f56ae['body'][_0xa24c('0x51')];delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x52')];delete _0x4f56ae['body']['value'];return db[_0xa24c('0x45')]['find']({'where':{'id':_0x4f56ae[_0xa24c('0x53')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x540da8,null))[_0xa24c('0x27')](saveUpdates(_0x4f56ae[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x540da8,null))[_0xa24c('0x49')](handleError(_0x540da8,null));};exports[_0xa24c('0x54')]=function(_0x286d57,_0x22a0db){return db[_0xa24c('0x45')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x22a0db,null))[_0xa24c('0x49')](handleError(_0x22a0db,null));};exports[_0xa24c('0x55')]=function(_0x513271,_0x5bde94,_0x487cc9){var _0x2da4f0=require('../../components/encryptor');var _0x4757ff=![];var _0x21d0fc={};if(_0x513271['query'][_0xa24c('0x42')]&&_0x513271[_0xa24c('0x33')][_0xa24c('0x42')]===_0xa24c('0x56')){_0x21d0fc[_0xa24c('0x56')]=_0x513271[_0xa24c('0x53')]['id'];}else{_0x21d0fc['id']=_0x513271[_0xa24c('0x53')]['id'];}return db[_0xa24c('0x45')]['find']({'where':_0x21d0fc,'attributes':['id',_0xa24c('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x5bde94,null))['then'](function(_0x565f0a){if(_0x565f0a){var _0x5bd2af=path['join'](config[_0xa24c('0x58')],'server/files/screen_recordings',_0x565f0a[_0xa24c('0x57')]);var _0x3fd3f9=util[_0xa24c('0x59')](_0xa24c('0x5a'),_0x5bd2af);if(fs[_0xa24c('0x5b')](_0x3fd3f9)){_0x4757ff=!![];return _0x2da4f0[_0xa24c('0x5c')](_0x3fd3f9,_0x5bd2af,config[_0xa24c('0x5d')][_0xa24c('0x5e')])[_0xa24c('0x27')](function(){return _0x565f0a;});}return _0x565f0a;}})[_0xa24c('0x27')](function(_0x303b7d){if(_0x303b7d){var _0x37dbbd=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x303b7d['value']);if(!fs[_0xa24c('0x5b')](_0x37dbbd)){throw new db[(_0xa24c('0x61'))]['ValidationError'](_0xa24c('0x62'));}if(_0x303b7d[_0xa24c('0x63')]){return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,_0x303b7d[_0xa24c('0x63')]+path['extname'](_0x37dbbd),function(){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}else{return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,function(_0x5e9631){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}}})[_0xa24c('0x49')](function(_0x2515b1){if(_0x2515b1[_0xa24c('0x64')]===_0xa24c('0x62')){_0x5bde94['status'](0x194)['send'](_0xa24c('0x65'));}else{return handleError(_0x5bde94,null);}});};exports['destroy']=function(_0x52a895,_0xfcc193){return db[_0xa24c('0x45')][_0xa24c('0x4d')]({'where':{'id':_0x52a895['params']['id']}})[_0xa24c('0x27')](function(_0x128e5b){if(_['isNil'](_0x128e5b)){throw new ReferenceError(_0xa24c('0x66'));}return _0x128e5b;})[_0xa24c('0x27')](function(_0x3096bf){var _0x4bee5c=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x3096bf[_0xa24c('0x57')]);logger[_0xa24c('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x4bee5c);if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs[_0xa24c('0x5b')](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}_0x4bee5c=_0x4bee5c+'.cypher';if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs['existsSync'](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}return _0x3096bf;})[_0xa24c('0x27')](function(_0x3a241a){if(!_0x3a241a)throw new InternalError();return _0x3a241a[_0xa24c('0x28')]();})[_0xa24c('0x27')](function(){_0xfcc193[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();})['catch'](handleError(_0xfcc193,null));}; \ No newline at end of file +var _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x1834e4,_0x29af18){var _0x24a0df=function(_0x59b1bb){while(--_0x59b1bb){_0x1834e4['push'](_0x1834e4['shift']());}};_0x24a0df(++_0x29af18);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2ac255,_0x62dd05){_0x2ac255=_0x2ac255-0x0;var _0x8f79c=_0xe5b3[_0x2ac255];return _0x8f79c;};'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(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3fae34f..ef3892f 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 _0x4d08=['bluebird','request-promise','rimraf','../../config/environment','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x4d08,0x8a));var _0x84d0=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0x4d08[_0x55ef8b];return _0x359c84;};'use strict';var _=require(_0x84d0('0x0'));var util=require(_0x84d0('0x1'));var logger=require(_0x84d0('0x2'))(_0x84d0('0x3'));var moment=require(_0x84d0('0x4'));var BPromise=require(_0x84d0('0x5'));var rp=require(_0x84d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84d0('0x7'));var config=require(_0x84d0('0x8'));var attributes=require('./screenRecording.attributes');module[_0x84d0('0x9')]=function(_0x290f6e,_0x4a4b20){return _0x290f6e[_0x84d0('0xa')]('ScreenRecording',attributes,{'tableName':_0x84d0('0xb'),'paranoid':![],'indexes':[{'name':_0x84d0('0xc'),'fields':[_0x84d0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ea5=['api','moment','bluebird','request-promise','../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','../../config/logger'];(function(_0x5df0a2,_0xdb8989){var _0x236e84=function(_0x335887){while(--_0x335887){_0x5df0a2['push'](_0x5df0a2['shift']());}};_0x236e84(++_0xdb8989);}(_0x9ea5,0x82));var _0x59ea=function(_0x2a51c7,_0x1665de){_0x2a51c7=_0x2a51c7-0x0;var _0x4c2aa9=_0x9ea5[_0x2a51c7];return _0x4c2aa9;};'use strict';var _=require(_0x59ea('0x0'));var util=require('util');var logger=require(_0x59ea('0x1'))(_0x59ea('0x2'));var moment=require(_0x59ea('0x3'));var BPromise=require(_0x59ea('0x4'));var rp=require(_0x59ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59ea('0x6'));var attributes=require(_0x59ea('0x7'));module[_0x59ea('0x8')]=function(_0x2c8bcd,_0x2abc27){return _0x2c8bcd['define']('ScreenRecording',attributes,{'tableName':_0x59ea('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x59ea('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c095a10..7198500 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 _0xc6e8=['code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53656a,_0x2e7288){var _0x302f17=function(_0x58032d){while(--_0x58032d){_0x53656a['push'](_0x53656a['shift']());}};_0x302f17(++_0x2e7288);}(_0xc6e8,0x12e));var _0x8c6e=function(_0x15e7f6,_0x59e69b){_0x15e7f6=_0x15e7f6-0x0;var _0x159d8a=_0xc6e8[_0x15e7f6];return _0x159d8a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c6e('0x0'));var BPromise=require(_0x8c6e('0x1'));var rs=require(_0x8c6e('0x2'));var fs=require('fs');var Redis=require(_0x8c6e('0x3'));var db=require(_0x8c6e('0x4'))['db'];var utils=require(_0x8c6e('0x5'));var logger=require(_0x8c6e('0x6'))(_0x8c6e('0x7'));var config=require(_0x8c6e('0x8'));var jayson=require(_0x8c6e('0x9'));var client=jayson[_0x8c6e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25058d,_0x592c97,_0x268737){return new BPromise(function(_0x49059e,_0x247950){return client[_0x8c6e('0xb')](_0x25058d,_0x268737)[_0x8c6e('0xc')](function(_0x31137c){logger[_0x8c6e('0xd')](_0x8c6e('0xe'),_0x592c97,_0x8c6e('0xf'));logger[_0x8c6e('0x10')](_0x8c6e('0x11'),_0x592c97,_0x8c6e('0xf'),JSON[_0x8c6e('0x12')](_0x31137c));if(_0x31137c[_0x8c6e('0x13')]){if(_0x31137c[_0x8c6e('0x13')][_0x8c6e('0x14')]===0x1f4){logger[_0x8c6e('0x13')](_0x8c6e('0xe'),_0x592c97,_0x31137c[_0x8c6e('0x13')][_0x8c6e('0x15')]);return _0x247950(_0x31137c[_0x8c6e('0x13')][_0x8c6e('0x15')]);}logger[_0x8c6e('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x592c97,_0x31137c[_0x8c6e('0x13')]['message']);return _0x49059e(_0x31137c[_0x8c6e('0x13')][_0x8c6e('0x15')]);}else{logger[_0x8c6e('0xd')](_0x8c6e('0xe'),_0x592c97,_0x8c6e('0xf'));_0x49059e(_0x31137c['result'][_0x8c6e('0x15')]);}})[_0x8c6e('0x16')](function(_0x1ce5d7){logger[_0x8c6e('0x13')](_0x8c6e('0xe'),_0x592c97,_0x1ce5d7);_0x247950(_0x1ce5d7);});});} \ No newline at end of file +var _0xb5af=['client','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ff1f6,_0x5baec3){var _0x62f7ba=function(_0x2d2f16){while(--_0x2d2f16){_0x1ff1f6['push'](_0x1ff1f6['shift']());}};_0x62f7ba(++_0x5baec3);}(_0xb5af,0x129));var _0xfb5a=function(_0x5eeb09,_0x17e4c8){_0x5eeb09=_0x5eeb09-0x0;var _0x2bf7ec=_0xb5af[_0x5eeb09];return _0x2bf7ec;};'use strict';var _=require('lodash');var util=require(_0xfb5a('0x0'));var moment=require(_0xfb5a('0x1'));var BPromise=require(_0xfb5a('0x2'));var rs=require(_0xfb5a('0x3'));var fs=require('fs');var Redis=require(_0xfb5a('0x4'));var db=require(_0xfb5a('0x5'))['db'];var utils=require(_0xfb5a('0x6'));var logger=require(_0xfb5a('0x7'))(_0xfb5a('0x8'));var config=require(_0xfb5a('0x9'));var jayson=require(_0xfb5a('0xa'));var client=jayson[_0xfb5a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f67c6,_0x145756,_0xef785d){return new BPromise(function(_0x9eec3b,_0x5182cd){return client['request'](_0x1f67c6,_0xef785d)[_0xfb5a('0xc')](function(_0x3f7856){logger[_0xfb5a('0xd')](_0xfb5a('0xe'),_0x145756,_0xfb5a('0xf'));logger[_0xfb5a('0x10')](_0xfb5a('0x11'),_0x145756,_0xfb5a('0xf'),JSON['stringify'](_0x3f7856));if(_0x3f7856[_0xfb5a('0x12')]){if(_0x3f7856['error'][_0xfb5a('0x13')]===0x1f4){logger[_0xfb5a('0x12')](_0xfb5a('0xe'),_0x145756,_0x3f7856[_0xfb5a('0x12')][_0xfb5a('0x14')]);return _0x5182cd(_0x3f7856[_0xfb5a('0x12')][_0xfb5a('0x14')]);}logger[_0xfb5a('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x145756,_0x3f7856[_0xfb5a('0x12')][_0xfb5a('0x14')]);return _0x9eec3b(_0x3f7856[_0xfb5a('0x12')][_0xfb5a('0x14')]);}else{logger[_0xfb5a('0xd')](_0xfb5a('0xe'),_0x145756,'request\x20sent');_0x9eec3b(_0x3f7856[_0xfb5a('0x15')][_0xfb5a('0x14')]);}})['catch'](function(_0x3e563e){logger[_0xfb5a('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x145756,_0x3e563e);_0x5182cd(_0x3e563e);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index e3a80ca..d50e4cd 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 _0xf169=['addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','logologin','file','addLogoLogin','preferred'];(function(_0x103538,_0x16d9df){var _0x13bd35=function(_0x2cac77){while(--_0x2cac77){_0x103538['push'](_0x103538['shift']());}};_0x13bd35(++_0x16d9df);}(_0xf169,0x1c9));var _0x9f16=function(_0x3eb1d0,_0x28bb49){_0x3eb1d0=_0x3eb1d0-0x0;var _0x2802b7=_0xf169[_0x3eb1d0];return _0x2802b7;};'use strict';var multer=require(_0x9f16('0x0'));var util=require(_0x9f16('0x1'));var path=require(_0x9f16('0x2'));var timeout=require(_0x9f16('0x3'));var express=require(_0x9f16('0x4'));var router=express[_0x9f16('0x5')]();var fs_extra=require(_0x9f16('0x6'));var auth=require(_0x9f16('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9f16('0x8'));var controller=require(_0x9f16('0x9'));router[_0x9f16('0xa')]('/',auth['isAuthenticated'](),controller[_0x9f16('0xb')]);router[_0x9f16('0xa')](_0x9f16('0xc'),controller[_0x9f16('0xd')]);router['get']('/:id',controller[_0x9f16('0xe')]);router['get'](_0x9f16('0xf'),controller[_0x9f16('0x10')]);router[_0x9f16('0xa')](_0x9f16('0x11'),controller['getLogoLogin']);router[_0x9f16('0xa')](_0x9f16('0x12'),controller['gdpr']);router[_0x9f16('0xa')]('/:id/preferred',controller[_0x9f16('0x13')]);router['get'](_0x9f16('0x14'),controller[_0x9f16('0x15')]);var upload=multer({'storage':multer[_0x9f16('0x16')]({'destination':function(_0x4b640b,_0x697eb7,_0x1d1399){_0x1d1399(null,path[_0x9f16('0x17')](config[_0x9f16('0x18')],_0x9f16('0x19')));},'filename':function(_0x57db60,_0x5f2520,_0x6cd559){_0x6cd559(null,util[_0x9f16('0x1a')](_0x9f16('0x1b'),_0x9f16('0x1c'),path[_0x9f16('0x1d')](_0x5f2520[_0x9f16('0x1e')])));}})});router[_0x9f16('0x1f')](_0x9f16('0xf'),upload[_0x9f16('0x20')]('file'),controller[_0x9f16('0x21')]);var upload=multer({'storage':multer[_0x9f16('0x16')]({'destination':function(_0x54d5c9,_0x15c51e,_0x2505c7){_0x2505c7(null,path[_0x9f16('0x17')](config['root'],_0x9f16('0x19')));},'filename':function(_0x3aa5f1,_0x2cf64c,_0xac1cf){_0xac1cf(null,util['format'](_0x9f16('0x1b'),_0x9f16('0x22'),path[_0x9f16('0x1d')](_0x2cf64c['originalname'])));}})});router[_0x9f16('0x1f')]('/:id/logo_login',upload[_0x9f16('0x20')](_0x9f16('0x23')),controller[_0x9f16('0x24')]);var upload=multer({'storage':multer[_0x9f16('0x16')]({'destination':function(_0x1ac938,_0x416a45,_0x5a1a25){_0x5a1a25(null,path['join'](config[_0x9f16('0x18')],_0x9f16('0x19')));},'filename':function(_0x3e0e8f,_0x2cd899,_0xd42bfb){_0xd42bfb(null,util[_0x9f16('0x1a')]('%s%s',_0x9f16('0x25'),path[_0x9f16('0x1d')](_0x2cd899[_0x9f16('0x1e')])));}})});router[_0x9f16('0x1f')]('/:id/preferred',upload[_0x9f16('0x20')](_0x9f16('0x23')),controller[_0x9f16('0x26')]);var upload=multer({'storage':multer[_0x9f16('0x16')]({'destination':function(_0x20b527,_0x111dac,_0x5039d5){_0x5039d5(null,path[_0x9f16('0x17')](config[_0x9f16('0x18')],_0x9f16('0x19')));},'filename':function(_0x336506,_0x124ffb,_0x4eafa1){_0x4eafa1(null,util[_0x9f16('0x1a')]('%s%s',_0x9f16('0x27'),path[_0x9f16('0x1d')](_0x124ffb[_0x9f16('0x1e')])));}})});router[_0x9f16('0x1f')](_0x9f16('0x14'),upload[_0x9f16('0x20')](_0x9f16('0x23')),controller[_0x9f16('0x28')]);router[_0x9f16('0x29')]('/:id',auth[_0x9f16('0x2a')](),controller[_0x9f16('0x2b')]);module[_0x9f16('0x2c')]=router; \ No newline at end of file +var _0x5557=['update','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','post','single','file','addLogo','logologin','originalname','addLogoLogin','preferred','extname','favicon','addFavicon','put'];(function(_0x3f7681,_0x47022e){var _0x51feae=function(_0x9586d6){while(--_0x9586d6){_0x3f7681['push'](_0x3f7681['shift']());}};_0x51feae(++_0x47022e);}(_0x5557,0x1ba));var _0x7555=function(_0x414e73,_0x57569f){_0x414e73=_0x414e73-0x0;var _0x5c3cba=_0x5557[_0x414e73];return _0x5c3cba;};'use strict';var multer=require(_0x7555('0x0'));var util=require('util');var path=require(_0x7555('0x1'));var timeout=require('connect-timeout');var express=require(_0x7555('0x2'));var router=express[_0x7555('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7555('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7555('0x5'));var controller=require(_0x7555('0x6'));router[_0x7555('0x7')]('/',auth[_0x7555('0x8')](),controller[_0x7555('0x9')]);router[_0x7555('0x7')](_0x7555('0xa'),controller[_0x7555('0xb')]);router[_0x7555('0x7')](_0x7555('0xc'),controller[_0x7555('0xd')]);router[_0x7555('0x7')](_0x7555('0xe'),controller['getLogo']);router[_0x7555('0x7')](_0x7555('0xf'),controller[_0x7555('0x10')]);router['get']('/:id/gdpr',controller[_0x7555('0x11')]);router['get']('/:id/preferred',controller[_0x7555('0x12')]);router[_0x7555('0x7')]('/:id/favicon',controller[_0x7555('0x13')]);var upload=multer({'storage':multer[_0x7555('0x14')]({'destination':function(_0x5a395c,_0x369e60,_0x2a6e3d){_0x2a6e3d(null,path[_0x7555('0x15')](config[_0x7555('0x16')],_0x7555('0x17')));},'filename':function(_0x128621,_0x572a7c,_0xd91fdc){_0xd91fdc(null,util[_0x7555('0x18')](_0x7555('0x19'),'logo',path['extname'](_0x572a7c['originalname'])));}})});router[_0x7555('0x1a')]('/:id/logo',upload[_0x7555('0x1b')](_0x7555('0x1c')),controller[_0x7555('0x1d')]);var upload=multer({'storage':multer[_0x7555('0x14')]({'destination':function(_0x4a6fb2,_0x20160e,_0x295a9f){_0x295a9f(null,path[_0x7555('0x15')](config[_0x7555('0x16')],'server/files/images/logos/'));},'filename':function(_0x59d32a,_0xa6b572,_0x46a5b2){_0x46a5b2(null,util['format'](_0x7555('0x19'),_0x7555('0x1e'),path['extname'](_0xa6b572[_0x7555('0x1f')])));}})});router['post']('/:id/logo_login',upload[_0x7555('0x1b')](_0x7555('0x1c')),controller[_0x7555('0x20')]);var upload=multer({'storage':multer[_0x7555('0x14')]({'destination':function(_0x531c67,_0x7fb1b5,_0x44dadf){_0x44dadf(null,path[_0x7555('0x15')](config[_0x7555('0x16')],_0x7555('0x17')));},'filename':function(_0x4d9517,_0x458a88,_0x439361){_0x439361(null,util[_0x7555('0x18')]('%s%s',_0x7555('0x21'),path[_0x7555('0x22')](_0x458a88[_0x7555('0x1f')])));}})});router[_0x7555('0x1a')]('/:id/preferred',upload[_0x7555('0x1b')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x7555('0x14')]({'destination':function(_0xcfbf24,_0x1330cc,_0x212da6){_0x212da6(null,path[_0x7555('0x15')](config[_0x7555('0x16')],_0x7555('0x17')));},'filename':function(_0x26d5d6,_0x241edf,_0x1b69f8){_0x1b69f8(null,util[_0x7555('0x18')](_0x7555('0x19'),_0x7555('0x23'),path['extname'](_0x241edf[_0x7555('0x1f')])));}})});router[_0x7555('0x1a')]('/:id/favicon',upload[_0x7555('0x1b')](_0x7555('0x1c')),controller[_0x7555('0x24')]);router[_0x7555('0x25')]('/:id',auth[_0x7555('0x8')](),controller[_0x7555('0x26')]);module[_0x7555('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8458d0a..6f3c43b 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(_0x54b92c,_0x500f76){var _0x10f3ef=function(_0x376d48){while(--_0x376d48){_0x54b92c['push'](_0x54b92c['shift']());}};_0x10f3ef(++_0x500f76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x30c0ab,_0x5e60df){var _0x7d821=function(_0x367c1d){while(--_0x367c1d){_0x30c0ab['push'](_0x30c0ab['shift']());}};_0x7d821(++_0x5e60df);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b30960f..e4b5fa1 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 _0x2208=['find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultFavicon','root','toLower','join','default','custom','default_logo.svg','existsSync','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','defaultPreferred','gdpr','securePassword','getPreferred','defaultLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','send','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','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','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','findAll','rows','keys','rawAttributes','includeAll','include'];(function(_0x56ac94,_0x11b7e2){var _0x5d8fcc=function(_0xf576d4){while(--_0xf576d4){_0x56ac94['push'](_0x56ac94['shift']());}};_0x5d8fcc(++_0x11b7e2);}(_0x2208,0x11e));var _0x8220=function(_0x3b2194,_0x457abd){_0x3b2194=_0x3b2194-0x0;var _0x31ac0e=_0x2208[_0x3b2194];return _0x31ac0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8220('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8220('0x1'));var rp=require('request-promise');var moment=require(_0x8220('0x2'));var BPromise=require(_0x8220('0x3'));var Mustache=require(_0x8220('0x4'));var util=require(_0x8220('0x5'));var path=require(_0x8220('0x6'));var sox=require(_0x8220('0x7'));var csv=require('to-csv');var ejs=require(_0x8220('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8220('0x9'));var squel=require(_0x8220('0xa'));var crypto=require(_0x8220('0xb'));var jsforce=require(_0x8220('0xc'));var deskjs=require(_0x8220('0xd'));var toCsv=require(_0x8220('0xe'));var querystring=require('querystring');var Papa=require(_0x8220('0xf'));var Redis=require(_0x8220('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8220('0x11'));var as=require(_0x8220('0x12'));var hardwareService=require(_0x8220('0x13'));var logger=require(_0x8220('0x14'))(_0x8220('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8220('0x16'));var db=require(_0x8220('0x17'))['db'];var jayson=require(_0x8220('0x18'));var client=jayson[_0x8220('0x19')][_0x8220('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1bee9c,_0x21342a,_0x217af4,_0x241c30){return new BPromise(function(_0x5b19d4,_0x81c6de){var _0x27fbad=_0x241c30||client;return _0x27fbad[_0x8220('0x1b')](_0x1bee9c,_0x217af4)['then'](function(_0x594df9){logger[_0x8220('0x1c')](_0x8220('0x1d'),_0x21342a,_0x8220('0x1e'));logger[_0x8220('0x1f')](_0x8220('0x20'),_0x21342a,_0x8220('0x1e'),JSON[_0x8220('0x21')](_0x594df9));if(_0x594df9[_0x8220('0x22')]){if(_0x594df9[_0x8220('0x22')]['code']===0x1f4){logger[_0x8220('0x22')](_0x8220('0x1d'),_0x21342a,_0x594df9['error'][_0x8220('0x23')]);return _0x81c6de(_0x594df9['error']['message']);}logger[_0x8220('0x22')]('Setting,\x20%s,\x20%s',_0x21342a,_0x594df9[_0x8220('0x22')][_0x8220('0x23')]);return _0x5b19d4(_0x594df9[_0x8220('0x22')][_0x8220('0x23')]);}else{logger[_0x8220('0x1c')]('Setting,\x20%s,\x20%s',_0x21342a,'request\x20sent');_0x5b19d4(_0x594df9[_0x8220('0x24')][_0x8220('0x23')]);}})[_0x8220('0x25')](function(_0xf56c4e){logger[_0x8220('0x22')](_0x8220('0x1d'),_0x21342a,_0xf56c4e);_0x81c6de(_0xf56c4e);});});}function respondWithStatusCode(_0x22e848,_0x561c5f){_0x561c5f=_0x561c5f||0xcc;return function(_0x382ece){if(_0x382ece){return _0x22e848['sendStatus'](_0x561c5f);}return _0x22e848[_0x8220('0x26')](_0x561c5f)[_0x8220('0x27')]();};}function respondWithResult(_0x287ccf,_0x4fc3cc){_0x4fc3cc=_0x4fc3cc||0xc8;return function(_0x1f0d1a){if(_0x1f0d1a){return _0x287ccf[_0x8220('0x26')](_0x4fc3cc)[_0x8220('0x28')](_0x1f0d1a);}};}function respondWithFilteredResult(_0x39a033,_0x4a0dec){return function(_0x2b31c2){if(_0x2b31c2){var _0x22d222=typeof _0x4a0dec[_0x8220('0x29')]==='undefined'&&typeof _0x4a0dec[_0x8220('0x2a')]===_0x8220('0x2b');var _0x218b23=_0x2b31c2[_0x8220('0x2c')];var _0x154e8c=_0x22d222?0x0:_0x4a0dec['offset'];var _0x254c7a=_0x22d222?_0x2b31c2[_0x8220('0x2c')]:_0x4a0dec[_0x8220('0x29')]+_0x4a0dec[_0x8220('0x2a')];var _0x292fe6;if(_0x254c7a>=_0x218b23){_0x254c7a=_0x218b23;_0x292fe6=0xc8;}else{_0x292fe6=0xce;}_0x39a033[_0x8220('0x26')](_0x292fe6);return _0x39a033[_0x8220('0x2d')](_0x8220('0x2e'),_0x154e8c+'-'+_0x254c7a+'/'+_0x218b23)[_0x8220('0x28')](_0x2b31c2);}return null;};}function patchUpdates(_0x5530cc){return function(_0x46d80b){try{jsonpatch['apply'](_0x46d80b,_0x5530cc,!![]);}catch(_0x112ee4){return BPromise[_0x8220('0x2f')](_0x112ee4);}return _0x46d80b['save']();};}function saveUpdates(_0x4370fa,_0x36b9f4){return function(_0x35dd07){if(_0x35dd07){return _0x35dd07[_0x8220('0x30')](_0x4370fa)[_0x8220('0x31')](function(_0x28b523){return _0x28b523;});}return null;};}function removeEntity(_0x2b3b83,_0x2fed3f){return function(_0x4bb1b6){if(_0x4bb1b6){return _0x4bb1b6[_0x8220('0x32')]()[_0x8220('0x31')](function(){_0x2b3b83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45859c,_0x1b2506){return function(_0x1a5ca2){if(!_0x1a5ca2){_0x45859c['sendStatus'](0x194);}return _0x1a5ca2;};}function handleError(_0x522e8a,_0x291aaa){_0x291aaa=_0x291aaa||0x1f4;return function(_0x292837){logger[_0x8220('0x22')](_0x292837[_0x8220('0x33')]);if(_0x292837['name']){delete _0x292837[_0x8220('0x34')];}_0x522e8a[_0x8220('0x26')](_0x291aaa)['send'](_0x292837);};}exports[_0x8220('0x35')]=function(_0x10af50,_0x4ffaef){var _0xa2972a={},_0x17143c={},_0x301bae={'count':0x0,'rows':[]};var _0x372f6d=_[_0x8220('0x36')](db[_0x8220('0x37')]['rawAttributes'],function(_0x58ed8b){return{'name':_0x58ed8b[_0x8220('0x38')],'type':_0x58ed8b[_0x8220('0x39')][_0x8220('0x3a')]};});_0x17143c[_0x8220('0x3b')]=_[_0x8220('0x36')](_0x372f6d,_0x8220('0x34'));_0x17143c[_0x8220('0x3c')]=_['keys'](_0x10af50[_0x8220('0x3c')]);_0x17143c[_0x8220('0x3d')]=_[_0x8220('0x3e')](_0x17143c['model'],_0x17143c[_0x8220('0x3c')]);_0xa2972a[_0x8220('0x3f')]=_[_0x8220('0x3e')](_0x17143c[_0x8220('0x3b')],qs[_0x8220('0x40')](_0x10af50['query'][_0x8220('0x40')]));_0xa2972a[_0x8220('0x3f')]=_0xa2972a[_0x8220('0x3f')][_0x8220('0x41')]?_0xa2972a[_0x8220('0x3f')]:_0x17143c[_0x8220('0x3b')];if(!_0x10af50[_0x8220('0x3c')][_0x8220('0x42')](_0x8220('0x43'))){_0xa2972a['limit']=qs[_0x8220('0x2a')](_0x10af50[_0x8220('0x3c')][_0x8220('0x2a')]);_0xa2972a[_0x8220('0x29')]=qs[_0x8220('0x29')](_0x10af50[_0x8220('0x3c')][_0x8220('0x29')]);}_0xa2972a['order']=qs[_0x8220('0x44')](_0x10af50[_0x8220('0x3c')][_0x8220('0x44')]);_0xa2972a['where']=qs[_0x8220('0x3d')](_[_0x8220('0x45')](_0x10af50['query'],_0x17143c['filters']),_0x372f6d);if(_0x10af50[_0x8220('0x3c')][_0x8220('0x46')]){_0xa2972a[_0x8220('0x47')]=_[_0x8220('0x48')](_0xa2972a[_0x8220('0x47')],{'$or':_[_0x8220('0x36')](_0x372f6d,function(_0x506a8d){if(_0x506a8d[_0x8220('0x39')]!=='VIRTUAL'){var _0x27c36d={};_0x27c36d[_0x506a8d[_0x8220('0x34')]]={'$like':'%'+_0x10af50[_0x8220('0x3c')][_0x8220('0x46')]+'%'};return _0x27c36d;}})});}_0xa2972a=_[_0x8220('0x48')]({},_0xa2972a,_0x10af50[_0x8220('0x49')]);var _0x3414a9={'where':_0xa2972a[_0x8220('0x47')]};return db[_0x8220('0x37')][_0x8220('0x2c')](_0x3414a9)[_0x8220('0x31')](function(_0x57c4d1){_0x301bae[_0x8220('0x2c')]=_0x57c4d1;if(_0x10af50[_0x8220('0x3c')]['includeAll']){_0xa2972a['include']=[{'all':!![]}];}return db[_0x8220('0x37')][_0x8220('0x4a')](_0xa2972a);})[_0x8220('0x31')](function(_0x22c706){_0x301bae[_0x8220('0x4b')]=_0x22c706;return _0x301bae;})['then'](respondWithFilteredResult(_0x4ffaef,_0xa2972a))[_0x8220('0x25')](handleError(_0x4ffaef,null));};exports['show']=function(_0x5b8187,_0x1b02b5){var _0x3ff0cb={'raw':![],'where':{'id':_0x5b8187['params']['id']}},_0x113e38={};_0x113e38[_0x8220('0x3b')]=_[_0x8220('0x4c')](db[_0x8220('0x37')][_0x8220('0x4d')]);_0x113e38[_0x8220('0x3c')]=_[_0x8220('0x4c')](_0x5b8187[_0x8220('0x3c')]);_0x113e38[_0x8220('0x3d')]=_[_0x8220('0x3e')](_0x113e38[_0x8220('0x3b')],_0x113e38[_0x8220('0x3c')]);_0x3ff0cb[_0x8220('0x3f')]=_[_0x8220('0x3e')](_0x113e38[_0x8220('0x3b')],qs[_0x8220('0x40')](_0x5b8187[_0x8220('0x3c')][_0x8220('0x40')]));_0x3ff0cb[_0x8220('0x3f')]=_0x3ff0cb[_0x8220('0x3f')][_0x8220('0x41')]?_0x3ff0cb[_0x8220('0x3f')]:_0x113e38[_0x8220('0x3b')];if(_0x5b8187[_0x8220('0x3c')][_0x8220('0x4e')]){_0x3ff0cb[_0x8220('0x4f')]=[{'all':!![]}];}_0x3ff0cb=_[_0x8220('0x48')]({},_0x3ff0cb,_0x5b8187['options']);return db[_0x8220('0x37')][_0x8220('0x50')](_0x3ff0cb)[_0x8220('0x31')](handleEntityNotFound(_0x1b02b5,null))[_0x8220('0x31')](respondWithResult(_0x1b02b5,null))['catch'](handleError(_0x1b02b5,null));};exports['update']=function(_0x1cbb41,_0x28cb46){if(_0x1cbb41[_0x8220('0x51')]['id']){delete _0x1cbb41[_0x8220('0x51')]['id'];}return db[_0x8220('0x37')][_0x8220('0x50')]({'where':{'id':_0x1cbb41[_0x8220('0x52')]['id']}})[_0x8220('0x31')](handleEntityNotFound(_0x28cb46,null))[_0x8220('0x31')](saveUpdates(_0x1cbb41[_0x8220('0x51')],null))[_0x8220('0x31')](respondWithResult(_0x28cb46,null))[_0x8220('0x25')](handleError(_0x28cb46,null));};exports[_0x8220('0x53')]=function(_0x3de204,_0x16b54b,_0x281ee9){if(_0x3de204[_0x8220('0x54')]&&_0x3de204[_0x8220('0x54')][_0x8220('0x55')]){_0x3de204['body'][_0x8220('0x56')]=_0x3de204[_0x8220('0x54')][_0x8220('0x55')];}return db['Setting'][_0x8220('0x50')]({'where':{'id':_0x3de204[_0x8220('0x52')]['id']}})[_0x8220('0x31')](handleEntityNotFound(_0x16b54b,null))[_0x8220('0x31')](saveUpdates(_0x3de204[_0x8220('0x51')],null))[_0x8220('0x31')](respondWithResult(_0x16b54b,null))['catch'](handleError(_0x16b54b,null));};exports[_0x8220('0x57')]=function(_0x54227c,_0x4be47b,_0x415baf){if(_0x54227c[_0x8220('0x54')]&&_0x54227c[_0x8220('0x54')][_0x8220('0x55')]){_0x54227c[_0x8220('0x51')][_0x8220('0x58')]=_0x54227c[_0x8220('0x54')]['filename'];}return db['Setting'][_0x8220('0x50')]({'where':{'id':_0x54227c[_0x8220('0x52')]['id']}})[_0x8220('0x31')](handleEntityNotFound(_0x4be47b,null))[_0x8220('0x31')](saveUpdates(_0x54227c[_0x8220('0x51')],null))['then'](respondWithResult(_0x4be47b,null))[_0x8220('0x25')](handleError(_0x4be47b,null));};var utilLicense=require(_0x8220('0x16'));exports[_0x8220('0x59')]=function(_0x27f1ec,_0x4045b4,_0x5e21ec){var _0xb05eb4=_0x8220('0x5a');var _0xf3e21d={'custom':![]};return utilLicense[_0x8220('0x5b')]()['then'](function(_0x1c00f7){if(_0x1c00f7){_0xf3e21d=_0x1c00f7;}return db['Setting']['find']({'where':{'id':_0x27f1ec[_0x8220('0x52')]['id']},'attributes':[_0x8220('0x56'),'loginLogo',_0x8220('0x5c'),_0x8220('0x5d'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x8220('0x5e')],'raw':!![]});})[_0x8220('0x31')](handleEntityNotFound(_0x4045b4,null))['then'](function(_0x39b8e4){if(_0x39b8e4){var _0x43c4a8=_0x39b8e4[_0x8220('0x56')]&&fs['existsSync'](path['join'](config[_0x8220('0x5f')],_0xb05eb4,_[_0x8220('0x60')](_0x39b8e4['logo'])))?path['join'](config[_0x8220('0x5f')],_0xb05eb4,_['toLower'](_0x39b8e4['logo'])):path[_0x8220('0x61')](config[_0x8220('0x5f')],_0xb05eb4,_[_0x8220('0x60')]('default_logo.svg'));var _0x5cffa9=_0x8220('0x62')+_['upperFirst'](_0x8220('0x56'));if(_0x39b8e4[_0x5cffa9]||!_0xf3e21d[_0x8220('0x63')]){_0x43c4a8=path['join'](config['root'],_0xb05eb4,_[_0x8220('0x60')](_0x8220('0x64')));}if(!fs[_0x8220('0x65')](_0x43c4a8)){throw new db[(_0x8220('0x66'))][(_0x8220('0x67'))](_[_0x8220('0x68')](_0x8220('0x56'))+_0x8220('0x69'));}return _0x4045b4[_0x8220('0x6a')](_0x43c4a8);}})[_0x8220('0x25')](handleError(_0x4045b4,null));};var utilLicense=require('../../config/license/util');exports[_0x8220('0x6b')]=function(_0x13c9ee,_0x4ade4b,_0xbf2e54){var _0x1dbaac=_0x8220('0x5a');var _0x5d81b8={'custom':![]};return utilLicense[_0x8220('0x5b')]()[_0x8220('0x31')](function(_0x52faae){if(_0x52faae){_0x5d81b8=_0x52faae;}return db[_0x8220('0x37')][_0x8220('0x50')]({'where':{'id':_0x13c9ee[_0x8220('0x52')]['id']},'attributes':[_0x8220('0x56'),_0x8220('0x58'),_0x8220('0x5c'),_0x8220('0x5d'),'defaultLogo',_0x8220('0x6c'),_0x8220('0x6d'),_0x8220('0x5e')],'raw':!![]});})[_0x8220('0x31')](handleEntityNotFound(_0x4ade4b,null))[_0x8220('0x31')](function(_0x463043){if(_0x463043){var _0x4a58a0=_0x463043[_0x8220('0x58')]&&fs[_0x8220('0x65')](path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x1dbaac,_[_0x8220('0x60')](_0x463043[_0x8220('0x58')])))?path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x1dbaac,_['toLower'](_0x463043[_0x8220('0x58')])):path['join'](config['root'],_0x1dbaac,_[_0x8220('0x60')]('default_loginLogo.svg'));var _0x2431d6='default'+_[_0x8220('0x68')]('loginLogo');if(_0x463043[_0x2431d6]||!_0x5d81b8[_0x8220('0x63')]){_0x4a58a0=path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x1dbaac,_[_0x8220('0x60')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x4a58a0)){throw new db[(_0x8220('0x66'))][(_0x8220('0x67'))](_[_0x8220('0x68')](_0x8220('0x58'))+_0x8220('0x69'));}return _0x4ade4b[_0x8220('0x6a')](_0x4a58a0);}})[_0x8220('0x25')](handleError(_0x4ade4b,null));};exports[_0x8220('0x6e')]=function(_0x14615f,_0x5483ed){return db[_0x8220('0x37')][_0x8220('0x50')]({'where':{'id':_0x14615f[_0x8220('0x52')]['id']},'attributes':[_0x8220('0x6f')]})[_0x8220('0x31')](respondWithResult(_0x5483ed,null))[_0x8220('0x25')](handleError(_0x5483ed,null));};exports['addPreferred']=function(_0x5bb2ac,_0x3cf090,_0x4a25f4){if(_0x5bb2ac[_0x8220('0x54')]&&_0x5bb2ac[_0x8220('0x54')][_0x8220('0x55')]){_0x5bb2ac[_0x8220('0x51')][_0x8220('0x5c')]=_0x5bb2ac[_0x8220('0x54')][_0x8220('0x55')];}return db[_0x8220('0x37')]['find']({'where':{'id':_0x5bb2ac[_0x8220('0x52')]['id']}})['then'](handleEntityNotFound(_0x3cf090,null))[_0x8220('0x31')](saveUpdates(_0x5bb2ac['body'],null))[_0x8220('0x31')](respondWithResult(_0x3cf090,null))[_0x8220('0x25')](handleError(_0x3cf090,null));};var utilLicense=require('../../config/license/util');exports[_0x8220('0x70')]=function(_0x1d5b91,_0x32f68b,_0x23e98c){var _0x498cff=_0x8220('0x5a');var _0x23290a={'custom':![]};return utilLicense[_0x8220('0x5b')]()[_0x8220('0x31')](function(_0x5c1508){if(_0x5c1508){_0x23290a=_0x5c1508;}return db['Setting']['find']({'where':{'id':_0x1d5b91[_0x8220('0x52')]['id']},'attributes':[_0x8220('0x56'),'loginLogo',_0x8220('0x5c'),_0x8220('0x5d'),_0x8220('0x71'),_0x8220('0x6c'),_0x8220('0x6d'),'defaultFavicon'],'raw':!![]});})[_0x8220('0x31')](handleEntityNotFound(_0x32f68b,null))['then'](function(_0x270c34){if(_0x270c34){var _0xd184b7=_0x270c34[_0x8220('0x5c')]&&fs[_0x8220('0x65')](path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x498cff,_['toLower'](_0x270c34[_0x8220('0x5c')])))?path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x498cff,_[_0x8220('0x60')](_0x270c34['preferred'])):path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x498cff,_[_0x8220('0x60')](_0x8220('0x72')));var _0x334321=_0x8220('0x62')+_[_0x8220('0x68')](_0x8220('0x5c'));if(_0x270c34[_0x334321]||!_0x23290a['custom']||!_0x23290a[_0x8220('0x5c')]){_0xd184b7=path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x498cff,_[_0x8220('0x60')](_0x8220('0x72')));}if(!fs[_0x8220('0x65')](_0xd184b7)){throw new db[(_0x8220('0x66'))][(_0x8220('0x67'))](_[_0x8220('0x68')](_0x8220('0x5c'))+_0x8220('0x69'));}return _0x32f68b[_0x8220('0x6a')](_0xd184b7);}})[_0x8220('0x25')](handleError(_0x32f68b,null));};exports[_0x8220('0x73')]=function(_0x54de6a,_0x195c6a,_0x4aa98b){if(_0x54de6a['file']&&_0x54de6a['file'][_0x8220('0x55')]){_0x54de6a[_0x8220('0x51')][_0x8220('0x5d')]=_0x54de6a[_0x8220('0x54')][_0x8220('0x55')];}return db[_0x8220('0x37')]['find']({'where':{'id':_0x54de6a['params']['id']}})[_0x8220('0x31')](handleEntityNotFound(_0x195c6a,null))[_0x8220('0x31')](saveUpdates(_0x54de6a['body'],null))['then'](respondWithResult(_0x195c6a,null))['catch'](handleError(_0x195c6a,null));};var utilLicense=require(_0x8220('0x16'));exports[_0x8220('0x74')]=function(_0x59956b,_0x4aa6f1,_0x30a8fa){var _0x52a842='server/files/images/logos';var _0x5089c5={'custom':![]};return utilLicense['getLicense']()[_0x8220('0x31')](function(_0x59e1ae){if(_0x59e1ae){_0x5089c5=_0x59e1ae;}return db[_0x8220('0x37')][_0x8220('0x50')]({'where':{'id':_0x59956b['params']['id']},'attributes':[_0x8220('0x56'),_0x8220('0x58'),'preferred','favicon',_0x8220('0x71'),_0x8220('0x6c'),_0x8220('0x6d'),_0x8220('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x4aa6f1,null))[_0x8220('0x31')](function(_0x47a357){if(_0x47a357){var _0x81f59b=_0x47a357[_0x8220('0x5d')]&&fs[_0x8220('0x65')](path[_0x8220('0x61')](config['root'],_0x52a842,_['toLower'](_0x47a357['favicon'])))?path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x52a842,_['toLower'](_0x47a357[_0x8220('0x5d')])):path[_0x8220('0x61')](config[_0x8220('0x5f')],_0x52a842,_[_0x8220('0x60')](_0x8220('0x75')));var _0x24e110=_0x8220('0x62')+_['upperFirst']('favicon');if(_0x47a357[_0x24e110]||!_0x5089c5['custom']){_0x81f59b=path['join'](config[_0x8220('0x5f')],_0x52a842,_[_0x8220('0x60')](_0x8220('0x75')));}if(!fs[_0x8220('0x65')](_0x81f59b)){throw new db['Sequelize'][(_0x8220('0x67'))](_[_0x8220('0x68')](_0x8220('0x5d'))+'\x20not\x20found');}return _0x4aa6f1[_0x8220('0x6a')](_0x81f59b);}})[_0x8220('0x25')](handleError(_0x4aa6f1,null));};exports[_0x8220('0x76')]=function(_0x2d1140,_0x32719a){var _0x110d40={'offset':moment()['utcOffset']()};_0x110d40[_0x8220('0x77')]=moment()[_0x8220('0x78')](_0x110d40['offset'])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x32719a['status'](0xc8)[_0x8220('0x79')](_0x110d40);}; \ No newline at end of file +var _0xd3bd=['includeAll','catch','show','length','find','update','body','addLogo','file','filename','logo','params','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultPreferred','existsSync','join','root','toLower','default','default_logo.svg','Sequelize','upperFirst','download','getLogoLogin','defaultLogo','defaultFavicon','default_loginLogo.svg','ValidationError','\x20not\x20found','gdpr','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','end','stack','name','send','index','Setting','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filter','merge','map','options'];(function(_0x29f77f,_0x579ae6){var _0xa49181=function(_0x51b1a8){while(--_0x51b1a8){_0x29f77f['push'](_0x29f77f['shift']());}};_0xa49181(++_0x579ae6);}(_0xd3bd,0xa9));var _0xdd3b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd3bd[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdd3b('0x0'));var rp=require(_0xdd3b('0x1'));var moment=require('moment');var BPromise=require(_0xdd3b('0x2'));var Mustache=require(_0xdd3b('0x3'));var util=require(_0xdd3b('0x4'));var path=require(_0xdd3b('0x5'));var sox=require(_0xdd3b('0x6'));var csv=require(_0xdd3b('0x7'));var ejs=require(_0xdd3b('0x8'));var fs=require('fs');var fs_extra=require(_0xdd3b('0x9'));var _=require('lodash');var squel=require(_0xdd3b('0xa'));var crypto=require(_0xdd3b('0xb'));var jsforce=require(_0xdd3b('0xc'));var deskjs=require(_0xdd3b('0xd'));var toCsv=require(_0xdd3b('0x7'));var querystring=require(_0xdd3b('0xe'));var Papa=require(_0xdd3b('0xf'));var Redis=require('ioredis');var authService=require(_0xdd3b('0x10'));var qs=require(_0xdd3b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd3b('0x12'));var logger=require(_0xdd3b('0x13'))(_0xdd3b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd3b('0x15'));var db=require(_0xdd3b('0x16'))['db'];var jayson=require(_0xdd3b('0x17'));var client=jayson[_0xdd3b('0x18')][_0xdd3b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x37fa5b,_0xc31f73,_0x3fae20,_0x3abef0){return new BPromise(function(_0x52df88,_0x33ee8d){var _0x4fda32=_0x3abef0||client;return _0x4fda32[_0xdd3b('0x1a')](_0x37fa5b,_0x3fae20)[_0xdd3b('0x1b')](function(_0x13943a){logger[_0xdd3b('0x1c')](_0xdd3b('0x1d'),_0xc31f73,_0xdd3b('0x1e'));logger['debug'](_0xdd3b('0x1f'),_0xc31f73,_0xdd3b('0x1e'),JSON[_0xdd3b('0x20')](_0x13943a));if(_0x13943a['error']){if(_0x13943a[_0xdd3b('0x21')][_0xdd3b('0x22')]===0x1f4){logger[_0xdd3b('0x21')]('Setting,\x20%s,\x20%s',_0xc31f73,_0x13943a[_0xdd3b('0x21')][_0xdd3b('0x23')]);return _0x33ee8d(_0x13943a['error']['message']);}logger[_0xdd3b('0x21')](_0xdd3b('0x1d'),_0xc31f73,_0x13943a[_0xdd3b('0x21')][_0xdd3b('0x23')]);return _0x52df88(_0x13943a['error'][_0xdd3b('0x23')]);}else{logger[_0xdd3b('0x1c')]('Setting,\x20%s,\x20%s',_0xc31f73,_0xdd3b('0x1e'));_0x52df88(_0x13943a[_0xdd3b('0x24')][_0xdd3b('0x23')]);}})['catch'](function(_0x595e30){logger[_0xdd3b('0x21')](_0xdd3b('0x1d'),_0xc31f73,_0x595e30);_0x33ee8d(_0x595e30);});});}function respondWithStatusCode(_0x227bf8,_0x2365ae){_0x2365ae=_0x2365ae||0xcc;return function(_0x18e363){if(_0x18e363){return _0x227bf8[_0xdd3b('0x25')](_0x2365ae);}return _0x227bf8[_0xdd3b('0x26')](_0x2365ae)['end']();};}function respondWithResult(_0x359c8d,_0x25d27f){_0x25d27f=_0x25d27f||0xc8;return function(_0x43daea){if(_0x43daea){return _0x359c8d[_0xdd3b('0x26')](_0x25d27f)[_0xdd3b('0x27')](_0x43daea);}};}function respondWithFilteredResult(_0x20986,_0x4d0e52){return function(_0x594306){if(_0x594306){var _0x3811cf=typeof _0x4d0e52[_0xdd3b('0x28')]==='undefined'&&typeof _0x4d0e52[_0xdd3b('0x29')]===_0xdd3b('0x2a');var _0x47612a=_0x594306[_0xdd3b('0x2b')];var _0x20154e=_0x3811cf?0x0:_0x4d0e52[_0xdd3b('0x28')];var _0x26a268=_0x3811cf?_0x594306[_0xdd3b('0x2b')]:_0x4d0e52['offset']+_0x4d0e52[_0xdd3b('0x29')];var _0xfdcca8;if(_0x26a268>=_0x47612a){_0x26a268=_0x47612a;_0xfdcca8=0xc8;}else{_0xfdcca8=0xce;}_0x20986[_0xdd3b('0x26')](_0xfdcca8);return _0x20986[_0xdd3b('0x2c')](_0xdd3b('0x2d'),_0x20154e+'-'+_0x26a268+'/'+_0x47612a)['json'](_0x594306);}return null;};}function patchUpdates(_0x4016a6){return function(_0x62429c){try{jsonpatch[_0xdd3b('0x2e')](_0x62429c,_0x4016a6,!![]);}catch(_0x2034d8){return BPromise[_0xdd3b('0x2f')](_0x2034d8);}return _0x62429c['save']();};}function saveUpdates(_0x3d7780,_0x31be26){return function(_0x1d1cce){if(_0x1d1cce){return _0x1d1cce['update'](_0x3d7780)[_0xdd3b('0x1b')](function(_0x51bf2c){return _0x51bf2c;});}return null;};}function removeEntity(_0x3e655c,_0x4d31fa){return function(_0x49f05e){if(_0x49f05e){return _0x49f05e[_0xdd3b('0x30')]()[_0xdd3b('0x1b')](function(){_0x3e655c['status'](0xcc)[_0xdd3b('0x31')]();});}};}function handleEntityNotFound(_0xa9a21a,_0x420e6c){return function(_0x16dc8b){if(!_0x16dc8b){_0xa9a21a[_0xdd3b('0x25')](0x194);}return _0x16dc8b;};}function handleError(_0xe2fb7e,_0x313e49){_0x313e49=_0x313e49||0x1f4;return function(_0xcb297){logger[_0xdd3b('0x21')](_0xcb297[_0xdd3b('0x32')]);if(_0xcb297[_0xdd3b('0x33')]){delete _0xcb297['name'];}_0xe2fb7e[_0xdd3b('0x26')](_0x313e49)[_0xdd3b('0x34')](_0xcb297);};}exports[_0xdd3b('0x35')]=function(_0x521648,_0x103a39){var _0x35c29a={},_0x55a23a={},_0x3778b4={'count':0x0,'rows':[]};var _0x43f8ba=_['map'](db[_0xdd3b('0x36')][_0xdd3b('0x37')],function(_0x4f0caf){return{'name':_0x4f0caf[_0xdd3b('0x38')],'type':_0x4f0caf['type'][_0xdd3b('0x39')]};});_0x55a23a['model']=_['map'](_0x43f8ba,_0xdd3b('0x33'));_0x55a23a['query']=_[_0xdd3b('0x3a')](_0x521648[_0xdd3b('0x3b')]);_0x55a23a[_0xdd3b('0x3c')]=_[_0xdd3b('0x3d')](_0x55a23a['model'],_0x55a23a[_0xdd3b('0x3b')]);_0x35c29a[_0xdd3b('0x3e')]=_['intersection'](_0x55a23a[_0xdd3b('0x3f')],qs[_0xdd3b('0x40')](_0x521648['query'][_0xdd3b('0x40')]));_0x35c29a[_0xdd3b('0x3e')]=_0x35c29a[_0xdd3b('0x3e')]['length']?_0x35c29a['attributes']:_0x55a23a[_0xdd3b('0x3f')];if(!_0x521648[_0xdd3b('0x3b')][_0xdd3b('0x41')]('nolimit')){_0x35c29a['limit']=qs[_0xdd3b('0x29')](_0x521648[_0xdd3b('0x3b')][_0xdd3b('0x29')]);_0x35c29a['offset']=qs['offset'](_0x521648[_0xdd3b('0x3b')][_0xdd3b('0x28')]);}_0x35c29a[_0xdd3b('0x42')]=qs[_0xdd3b('0x43')](_0x521648[_0xdd3b('0x3b')][_0xdd3b('0x43')]);_0x35c29a[_0xdd3b('0x44')]=qs[_0xdd3b('0x3c')](_['pick'](_0x521648[_0xdd3b('0x3b')],_0x55a23a[_0xdd3b('0x3c')]),_0x43f8ba);if(_0x521648[_0xdd3b('0x3b')][_0xdd3b('0x45')]){_0x35c29a[_0xdd3b('0x44')]=_[_0xdd3b('0x46')](_0x35c29a[_0xdd3b('0x44')],{'$or':_[_0xdd3b('0x47')](_0x43f8ba,function(_0x243c66){if(_0x243c66['type']!=='VIRTUAL'){var _0x1cb4d4={};_0x1cb4d4[_0x243c66['name']]={'$like':'%'+_0x521648[_0xdd3b('0x3b')][_0xdd3b('0x45')]+'%'};return _0x1cb4d4;}})});}_0x35c29a=_[_0xdd3b('0x46')]({},_0x35c29a,_0x521648[_0xdd3b('0x48')]);var _0x21a8c4={'where':_0x35c29a['where']};return db[_0xdd3b('0x36')][_0xdd3b('0x2b')](_0x21a8c4)[_0xdd3b('0x1b')](function(_0x524a78){_0x3778b4['count']=_0x524a78;if(_0x521648['query'][_0xdd3b('0x49')]){_0x35c29a['include']=[{'all':!![]}];}return db[_0xdd3b('0x36')]['findAll'](_0x35c29a);})[_0xdd3b('0x1b')](function(_0x4966f1){_0x3778b4['rows']=_0x4966f1;return _0x3778b4;})['then'](respondWithFilteredResult(_0x103a39,_0x35c29a))[_0xdd3b('0x4a')](handleError(_0x103a39,null));};exports[_0xdd3b('0x4b')]=function(_0x1f8ca2,_0x1d4dab){var _0x4b00b0={'raw':![],'where':{'id':_0x1f8ca2['params']['id']}},_0x28fb6b={};_0x28fb6b[_0xdd3b('0x3f')]=_['keys'](db[_0xdd3b('0x36')][_0xdd3b('0x37')]);_0x28fb6b[_0xdd3b('0x3b')]=_['keys'](_0x1f8ca2[_0xdd3b('0x3b')]);_0x28fb6b[_0xdd3b('0x3c')]=_[_0xdd3b('0x3d')](_0x28fb6b['model'],_0x28fb6b[_0xdd3b('0x3b')]);_0x4b00b0['attributes']=_['intersection'](_0x28fb6b[_0xdd3b('0x3f')],qs['fields'](_0x1f8ca2[_0xdd3b('0x3b')]['fields']));_0x4b00b0['attributes']=_0x4b00b0[_0xdd3b('0x3e')][_0xdd3b('0x4c')]?_0x4b00b0[_0xdd3b('0x3e')]:_0x28fb6b[_0xdd3b('0x3f')];if(_0x1f8ca2[_0xdd3b('0x3b')]['includeAll']){_0x4b00b0['include']=[{'all':!![]}];}_0x4b00b0=_[_0xdd3b('0x46')]({},_0x4b00b0,_0x1f8ca2[_0xdd3b('0x48')]);return db[_0xdd3b('0x36')][_0xdd3b('0x4d')](_0x4b00b0)['then'](handleEntityNotFound(_0x1d4dab,null))['then'](respondWithResult(_0x1d4dab,null))[_0xdd3b('0x4a')](handleError(_0x1d4dab,null));};exports[_0xdd3b('0x4e')]=function(_0x48b9c6,_0x20c241){if(_0x48b9c6[_0xdd3b('0x4f')]['id']){delete _0x48b9c6['body']['id'];}return db[_0xdd3b('0x36')][_0xdd3b('0x4d')]({'where':{'id':_0x48b9c6['params']['id']}})[_0xdd3b('0x1b')](handleEntityNotFound(_0x20c241,null))[_0xdd3b('0x1b')](saveUpdates(_0x48b9c6[_0xdd3b('0x4f')],null))[_0xdd3b('0x1b')](respondWithResult(_0x20c241,null))[_0xdd3b('0x4a')](handleError(_0x20c241,null));};exports[_0xdd3b('0x50')]=function(_0x3c234a,_0x24bcdc,_0x5c7c61){if(_0x3c234a['file']&&_0x3c234a[_0xdd3b('0x51')][_0xdd3b('0x52')]){_0x3c234a[_0xdd3b('0x4f')][_0xdd3b('0x53')]=_0x3c234a[_0xdd3b('0x51')][_0xdd3b('0x52')];}return db['Setting'][_0xdd3b('0x4d')]({'where':{'id':_0x3c234a[_0xdd3b('0x54')]['id']}})[_0xdd3b('0x1b')](handleEntityNotFound(_0x24bcdc,null))[_0xdd3b('0x1b')](saveUpdates(_0x3c234a[_0xdd3b('0x4f')],null))[_0xdd3b('0x1b')](respondWithResult(_0x24bcdc,null))[_0xdd3b('0x4a')](handleError(_0x24bcdc,null));};exports[_0xdd3b('0x55')]=function(_0x3cd9f8,_0x5ca2a4,_0x72f22d){if(_0x3cd9f8[_0xdd3b('0x51')]&&_0x3cd9f8[_0xdd3b('0x51')][_0xdd3b('0x52')]){_0x3cd9f8[_0xdd3b('0x4f')][_0xdd3b('0x56')]=_0x3cd9f8[_0xdd3b('0x51')][_0xdd3b('0x52')];}return db[_0xdd3b('0x36')][_0xdd3b('0x4d')]({'where':{'id':_0x3cd9f8[_0xdd3b('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ca2a4,null))[_0xdd3b('0x1b')](saveUpdates(_0x3cd9f8[_0xdd3b('0x4f')],null))[_0xdd3b('0x1b')](respondWithResult(_0x5ca2a4,null))[_0xdd3b('0x4a')](handleError(_0x5ca2a4,null));};var utilLicense=require(_0xdd3b('0x15'));exports[_0xdd3b('0x57')]=function(_0x48a348,_0x3cc78e,_0x404cf7){var _0x3766e5=_0xdd3b('0x58');var _0x25c65a={'custom':![]};return utilLicense[_0xdd3b('0x59')]()[_0xdd3b('0x1b')](function(_0x5f4271){if(_0x5f4271){_0x25c65a=_0x5f4271;}return db[_0xdd3b('0x36')][_0xdd3b('0x4d')]({'where':{'id':_0x48a348[_0xdd3b('0x54')]['id']},'attributes':[_0xdd3b('0x53'),_0xdd3b('0x56'),_0xdd3b('0x5a'),_0xdd3b('0x5b'),'defaultLogo','defaultLoginLogo',_0xdd3b('0x5c'),'defaultFavicon'],'raw':!![]});})[_0xdd3b('0x1b')](handleEntityNotFound(_0x3cc78e,null))[_0xdd3b('0x1b')](function(_0x50556e){if(_0x50556e){var _0x5db2c8=_0x50556e[_0xdd3b('0x53')]&&fs[_0xdd3b('0x5d')](path[_0xdd3b('0x5e')](config[_0xdd3b('0x5f')],_0x3766e5,_[_0xdd3b('0x60')](_0x50556e[_0xdd3b('0x53')])))?path['join'](config[_0xdd3b('0x5f')],_0x3766e5,_[_0xdd3b('0x60')](_0x50556e[_0xdd3b('0x53')])):path['join'](config[_0xdd3b('0x5f')],_0x3766e5,_['toLower']('default_logo.svg'));var _0x3cfd69=_0xdd3b('0x61')+_['upperFirst'](_0xdd3b('0x53'));if(_0x50556e[_0x3cfd69]||!_0x25c65a['custom']){_0x5db2c8=path[_0xdd3b('0x5e')](config['root'],_0x3766e5,_[_0xdd3b('0x60')](_0xdd3b('0x62')));}if(!fs[_0xdd3b('0x5d')](_0x5db2c8)){throw new db[(_0xdd3b('0x63'))]['ValidationError'](_[_0xdd3b('0x64')](_0xdd3b('0x53'))+'\x20not\x20found');}return _0x3cc78e[_0xdd3b('0x65')](_0x5db2c8);}})['catch'](handleError(_0x3cc78e,null));};var utilLicense=require(_0xdd3b('0x15'));exports[_0xdd3b('0x66')]=function(_0xa28ae,_0xd78c0c,_0x4575fe){var _0x2d0cf9='server/files/images/logos';var _0x4bc1ba={'custom':![]};return utilLicense[_0xdd3b('0x59')]()[_0xdd3b('0x1b')](function(_0x2fab1c){if(_0x2fab1c){_0x4bc1ba=_0x2fab1c;}return db[_0xdd3b('0x36')][_0xdd3b('0x4d')]({'where':{'id':_0xa28ae[_0xdd3b('0x54')]['id']},'attributes':[_0xdd3b('0x53'),'loginLogo',_0xdd3b('0x5a'),_0xdd3b('0x5b'),_0xdd3b('0x67'),'defaultLoginLogo','defaultPreferred',_0xdd3b('0x68')],'raw':!![]});})[_0xdd3b('0x1b')](handleEntityNotFound(_0xd78c0c,null))[_0xdd3b('0x1b')](function(_0xf94d05){if(_0xf94d05){var _0x111a2f=_0xf94d05['loginLogo']&&fs[_0xdd3b('0x5d')](path[_0xdd3b('0x5e')](config[_0xdd3b('0x5f')],_0x2d0cf9,_[_0xdd3b('0x60')](_0xf94d05[_0xdd3b('0x56')])))?path[_0xdd3b('0x5e')](config['root'],_0x2d0cf9,_['toLower'](_0xf94d05['loginLogo'])):path[_0xdd3b('0x5e')](config['root'],_0x2d0cf9,_[_0xdd3b('0x60')]('default_loginLogo.svg'));var _0x4379ee=_0xdd3b('0x61')+_[_0xdd3b('0x64')](_0xdd3b('0x56'));if(_0xf94d05[_0x4379ee]||!_0x4bc1ba['custom']){_0x111a2f=path['join'](config[_0xdd3b('0x5f')],_0x2d0cf9,_[_0xdd3b('0x60')](_0xdd3b('0x69')));}if(!fs['existsSync'](_0x111a2f)){throw new db[(_0xdd3b('0x63'))][(_0xdd3b('0x6a'))](_[_0xdd3b('0x64')](_0xdd3b('0x56'))+_0xdd3b('0x6b'));}return _0xd78c0c[_0xdd3b('0x65')](_0x111a2f);}})[_0xdd3b('0x4a')](handleError(_0xd78c0c,null));};exports[_0xdd3b('0x6c')]=function(_0x53dcfa,_0x8fba0e){return db['Setting']['find']({'where':{'id':_0x53dcfa['params']['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x8fba0e,null))[_0xdd3b('0x4a')](handleError(_0x8fba0e,null));};exports[_0xdd3b('0x6d')]=function(_0x2efb3f,_0x51a076,_0x12f5fa){if(_0x2efb3f[_0xdd3b('0x51')]&&_0x2efb3f[_0xdd3b('0x51')][_0xdd3b('0x52')]){_0x2efb3f[_0xdd3b('0x4f')][_0xdd3b('0x5a')]=_0x2efb3f[_0xdd3b('0x51')]['filename'];}return db[_0xdd3b('0x36')]['find']({'where':{'id':_0x2efb3f['params']['id']}})[_0xdd3b('0x1b')](handleEntityNotFound(_0x51a076,null))[_0xdd3b('0x1b')](saveUpdates(_0x2efb3f[_0xdd3b('0x4f')],null))[_0xdd3b('0x1b')](respondWithResult(_0x51a076,null))[_0xdd3b('0x4a')](handleError(_0x51a076,null));};var utilLicense=require(_0xdd3b('0x15'));exports[_0xdd3b('0x6e')]=function(_0x3f8b08,_0xdb0b1f,_0x117692){var _0x4eb30f='server/files/images/logos';var _0x2d4873={'custom':![]};return utilLicense[_0xdd3b('0x59')]()[_0xdd3b('0x1b')](function(_0x3cbf19){if(_0x3cbf19){_0x2d4873=_0x3cbf19;}return db[_0xdd3b('0x36')][_0xdd3b('0x4d')]({'where':{'id':_0x3f8b08[_0xdd3b('0x54')]['id']},'attributes':[_0xdd3b('0x53'),_0xdd3b('0x56'),_0xdd3b('0x5a'),_0xdd3b('0x5b'),_0xdd3b('0x67'),_0xdd3b('0x6f'),_0xdd3b('0x5c'),_0xdd3b('0x68')],'raw':!![]});})[_0xdd3b('0x1b')](handleEntityNotFound(_0xdb0b1f,null))['then'](function(_0x56e3f0){if(_0x56e3f0){var _0x9fd357=_0x56e3f0['preferred']&&fs['existsSync'](path[_0xdd3b('0x5e')](config[_0xdd3b('0x5f')],_0x4eb30f,_[_0xdd3b('0x60')](_0x56e3f0[_0xdd3b('0x5a')])))?path['join'](config[_0xdd3b('0x5f')],_0x4eb30f,_[_0xdd3b('0x60')](_0x56e3f0[_0xdd3b('0x5a')])):path[_0xdd3b('0x5e')](config[_0xdd3b('0x5f')],_0x4eb30f,_[_0xdd3b('0x60')](_0xdd3b('0x70')));var _0xe897f9='default'+_[_0xdd3b('0x64')](_0xdd3b('0x5a'));if(_0x56e3f0[_0xe897f9]||!_0x2d4873[_0xdd3b('0x71')]||!_0x2d4873[_0xdd3b('0x5a')]){_0x9fd357=path[_0xdd3b('0x5e')](config[_0xdd3b('0x5f')],_0x4eb30f,_['toLower'](_0xdd3b('0x70')));}if(!fs[_0xdd3b('0x5d')](_0x9fd357)){throw new db[(_0xdd3b('0x63'))][(_0xdd3b('0x6a'))](_[_0xdd3b('0x64')](_0xdd3b('0x5a'))+_0xdd3b('0x6b'));}return _0xdb0b1f[_0xdd3b('0x65')](_0x9fd357);}})[_0xdd3b('0x4a')](handleError(_0xdb0b1f,null));};exports[_0xdd3b('0x72')]=function(_0x1d2216,_0x4ead3d,_0xcc1eab){if(_0x1d2216[_0xdd3b('0x51')]&&_0x1d2216[_0xdd3b('0x51')]['filename']){_0x1d2216[_0xdd3b('0x4f')][_0xdd3b('0x5b')]=_0x1d2216[_0xdd3b('0x51')][_0xdd3b('0x52')];}return db[_0xdd3b('0x36')][_0xdd3b('0x4d')]({'where':{'id':_0x1d2216[_0xdd3b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ead3d,null))[_0xdd3b('0x1b')](saveUpdates(_0x1d2216[_0xdd3b('0x4f')],null))[_0xdd3b('0x1b')](respondWithResult(_0x4ead3d,null))[_0xdd3b('0x4a')](handleError(_0x4ead3d,null));};var utilLicense=require(_0xdd3b('0x15'));exports[_0xdd3b('0x73')]=function(_0x3359af,_0x161f23,_0x1245b9){var _0x2c3315=_0xdd3b('0x58');var _0x1e3fb6={'custom':![]};return utilLicense['getLicense']()[_0xdd3b('0x1b')](function(_0x58899b){if(_0x58899b){_0x1e3fb6=_0x58899b;}return db[_0xdd3b('0x36')]['find']({'where':{'id':_0x3359af[_0xdd3b('0x54')]['id']},'attributes':[_0xdd3b('0x53'),_0xdd3b('0x56'),_0xdd3b('0x5a'),'favicon',_0xdd3b('0x67'),_0xdd3b('0x6f'),_0xdd3b('0x5c'),'defaultFavicon'],'raw':!![]});})[_0xdd3b('0x1b')](handleEntityNotFound(_0x161f23,null))[_0xdd3b('0x1b')](function(_0x1c4958){if(_0x1c4958){var _0x9ab619=_0x1c4958[_0xdd3b('0x5b')]&&fs['existsSync'](path[_0xdd3b('0x5e')](config[_0xdd3b('0x5f')],_0x2c3315,_[_0xdd3b('0x60')](_0x1c4958[_0xdd3b('0x5b')])))?path[_0xdd3b('0x5e')](config[_0xdd3b('0x5f')],_0x2c3315,_[_0xdd3b('0x60')](_0x1c4958[_0xdd3b('0x5b')])):path[_0xdd3b('0x5e')](config[_0xdd3b('0x5f')],_0x2c3315,_['toLower'](_0xdd3b('0x74')));var _0x59d40f=_0xdd3b('0x61')+_['upperFirst'](_0xdd3b('0x5b'));if(_0x1c4958[_0x59d40f]||!_0x1e3fb6[_0xdd3b('0x71')]){_0x9ab619=path[_0xdd3b('0x5e')](config['root'],_0x2c3315,_[_0xdd3b('0x60')](_0xdd3b('0x74')));}if(!fs[_0xdd3b('0x5d')](_0x9ab619)){throw new db['Sequelize'][(_0xdd3b('0x6a'))](_[_0xdd3b('0x64')]('favicon')+_0xdd3b('0x6b'));}return _0x161f23[_0xdd3b('0x65')](_0x9ab619);}})['catch'](handleError(_0x161f23,null));};exports[_0xdd3b('0x75')]=function(_0x4be43e,_0x15018d){var _0x5d1279={'offset':moment()[_0xdd3b('0x76')]()};_0x5d1279[_0xdd3b('0x77')]=moment()[_0xdd3b('0x76')](_0x5d1279[_0xdd3b('0x28')])['format'](_0xdd3b('0x78'));return _0x15018d[_0xdd3b('0x26')](0xc8)['send'](_0x5d1279);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 76b9630..7c26dff 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x55ca,0x126));var _0xa55c=function(_0x7b68cc,_0x3f522e){_0x7b68cc=_0x7b68cc-0x0;var _0x36470e=_0x55ca[_0x7b68cc];return _0x36470e;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x58952f,_0xeed25f){var _0x3217ca=function(_0x3fda09){while(--_0x3fda09){_0x58952f['push'](_0x58952f['shift']());}};_0x3217ca(++_0xeed25f);}(_0x008c,0x188));var _0xc008=function(_0x49ca95,_0x50c62b){_0x49ca95=_0x49ca95-0x0;var _0x4699f9=_0x008c[_0x49ca95];return _0x4699f9;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index a81279d..0c0948e 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 _0xf3e1=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','find','options','raw','where','attributes','include','map','model','then','ShowSetting','catch','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e5a73,_0xb07f56){var _0x548c2d=function(_0x2ddd0f){while(--_0x2ddd0f){_0x4e5a73['push'](_0x4e5a73['shift']());}};_0x548c2d(++_0xb07f56);}(_0xf3e1,0x167));var _0x1f3e=function(_0xb61d97,_0x4c11ea){_0xb61d97=_0xb61d97-0x0;var _0x2b20a6=_0xf3e1[_0xb61d97];return _0x2b20a6;};'use strict';var _=require('lodash');var util=require(_0x1f3e('0x0'));var moment=require('moment');var BPromise=require(_0x1f3e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f3e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f3e('0x3'))('rpc');var config=require(_0x1f3e('0x4'));var jayson=require(_0x1f3e('0x5'));var client=jayson[_0x1f3e('0x6')][_0x1f3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2911aa,_0x13f21c,_0x4eefbc){return new BPromise(function(_0x5a12ec,_0x72a2a8){return client[_0x1f3e('0x8')](_0x2911aa,_0x4eefbc)['then'](function(_0x4ab941){logger[_0x1f3e('0x9')](_0x1f3e('0xa'),_0x13f21c,_0x1f3e('0xb'));logger[_0x1f3e('0xc')](_0x1f3e('0xd'),_0x13f21c,'request\x20sent',JSON[_0x1f3e('0xe')](_0x4ab941));if(_0x4ab941[_0x1f3e('0xf')]){if(_0x4ab941[_0x1f3e('0xf')][_0x1f3e('0x10')]===0x1f4){logger[_0x1f3e('0xf')](_0x1f3e('0xa'),_0x13f21c,_0x4ab941[_0x1f3e('0xf')][_0x1f3e('0x11')]);return _0x72a2a8(_0x4ab941[_0x1f3e('0xf')][_0x1f3e('0x11')]);}logger[_0x1f3e('0xf')]('Setting,\x20%s,\x20%s',_0x13f21c,_0x4ab941['error'][_0x1f3e('0x11')]);return _0x5a12ec(_0x4ab941['error'][_0x1f3e('0x11')]);}else{logger[_0x1f3e('0x9')](_0x1f3e('0xa'),_0x13f21c,_0x1f3e('0xb'));_0x5a12ec(_0x4ab941[_0x1f3e('0x12')][_0x1f3e('0x11')]);}})['catch'](function(_0x7f8d95){logger[_0x1f3e('0xf')](_0x1f3e('0xa'),_0x13f21c,_0x7f8d95);_0x72a2a8(_0x7f8d95);});});}exports['ShowSetting']=function(_0x12dece){var _0x4645dc=this;return new Promise(function(_0x1aa3bf,_0x123fa6){return db[_0x1f3e('0x13')][_0x1f3e('0x14')]({'raw':_0x12dece['options']?_0x12dece[_0x1f3e('0x15')][_0x1f3e('0x16')]===undefined?!![]:![]:!![],'where':_0x12dece[_0x1f3e('0x15')]?_0x12dece[_0x1f3e('0x15')][_0x1f3e('0x17')]||null:null,'attributes':_0x12dece[_0x1f3e('0x15')]?_0x12dece[_0x1f3e('0x15')][_0x1f3e('0x18')]||null:null,'include':_0x12dece[_0x1f3e('0x15')]?_0x12dece['options'][_0x1f3e('0x19')]?_[_0x1f3e('0x1a')](_0x12dece['options']['include'],function(_0x2c8d08){return{'model':db[_0x2c8d08[_0x1f3e('0x1b')]],'as':_0x2c8d08['as'],'attributes':_0x2c8d08[_0x1f3e('0x18')],'include':_0x2c8d08[_0x1f3e('0x19')]?_['map'](_0x2c8d08[_0x1f3e('0x19')],function(_0x20e7a8){return{'model':db[_0x20e7a8['model']],'as':_0x20e7a8['as'],'attributes':_0x20e7a8[_0x1f3e('0x18')],'include':_0x20e7a8[_0x1f3e('0x19')]?_[_0x1f3e('0x1a')](_0x20e7a8[_0x1f3e('0x19')],function(_0x3baf49){return{'model':db[_0x3baf49[_0x1f3e('0x1b')]],'as':_0x3baf49['as'],'attributes':_0x3baf49['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f3e('0x1c')](function(_0xb1416a){logger['info']('ShowSetting',_0x12dece);logger[_0x1f3e('0xc')](_0x1f3e('0x1d'),_0x12dece,JSON[_0x1f3e('0xe')](_0xb1416a));_0x1aa3bf(_0xb1416a);})[_0x1f3e('0x1e')](function(_0x4f5556){logger[_0x1f3e('0xf')](_0x1f3e('0x1d'),_0x4f5556['message'],_0x12dece);_0x123fa6(_0x4645dc['error'](0x1f4,_0x4f5556[_0x1f3e('0x11')]));});});}; \ No newline at end of file +var _0x08b6=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','catch','util'];(function(_0x288129,_0x4c92a4){var _0xd73f38=function(_0x37aa17){while(--_0x37aa17){_0x288129['push'](_0x288129['shift']());}};_0xd73f38(++_0x4c92a4);}(_0x08b6,0x128));var _0x608b=function(_0x22d841,_0x3df28a){_0x22d841=_0x22d841-0x0;var _0x23c8bf=_0x08b6[_0x22d841];return _0x23c8bf;};'use strict';var _=require('lodash');var util=require(_0x608b('0x0'));var moment=require(_0x608b('0x1'));var BPromise=require(_0x608b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x608b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x608b('0x4'));var logger=require(_0x608b('0x5'))(_0x608b('0x6'));var config=require(_0x608b('0x7'));var jayson=require(_0x608b('0x8'));var client=jayson['client'][_0x608b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa7f0ca,_0x775fcc,_0x59a4b7){return new BPromise(function(_0x5e8156,_0x5f2090){return client[_0x608b('0xa')](_0xa7f0ca,_0x59a4b7)[_0x608b('0xb')](function(_0x14234a){logger[_0x608b('0xc')](_0x608b('0xd'),_0x775fcc,_0x608b('0xe'));logger[_0x608b('0xf')](_0x608b('0x10'),_0x775fcc,_0x608b('0xe'),JSON[_0x608b('0x11')](_0x14234a));if(_0x14234a[_0x608b('0x12')]){if(_0x14234a[_0x608b('0x12')][_0x608b('0x13')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x775fcc,_0x14234a['error'][_0x608b('0x14')]);return _0x5f2090(_0x14234a[_0x608b('0x12')][_0x608b('0x14')]);}logger[_0x608b('0x12')](_0x608b('0xd'),_0x775fcc,_0x14234a[_0x608b('0x12')][_0x608b('0x14')]);return _0x5e8156(_0x14234a[_0x608b('0x12')][_0x608b('0x14')]);}else{logger[_0x608b('0xc')]('Setting,\x20%s,\x20%s',_0x775fcc,_0x608b('0xe'));_0x5e8156(_0x14234a[_0x608b('0x15')][_0x608b('0x14')]);}})['catch'](function(_0x10614d){logger[_0x608b('0x12')](_0x608b('0xd'),_0x775fcc,_0x10614d);_0x5f2090(_0x10614d);});});}exports[_0x608b('0x16')]=function(_0x572d4c){var _0x2ae5e4=this;return new Promise(function(_0x568fc2,_0x32e2f3){return db[_0x608b('0x17')][_0x608b('0x18')]({'raw':_0x572d4c[_0x608b('0x19')]?_0x572d4c[_0x608b('0x19')][_0x608b('0x1a')]===undefined?!![]:![]:!![],'where':_0x572d4c['options']?_0x572d4c[_0x608b('0x19')][_0x608b('0x1b')]||null:null,'attributes':_0x572d4c[_0x608b('0x19')]?_0x572d4c[_0x608b('0x19')][_0x608b('0x1c')]||null:null,'include':_0x572d4c[_0x608b('0x19')]?_0x572d4c[_0x608b('0x19')][_0x608b('0x1d')]?_[_0x608b('0x1e')](_0x572d4c['options'][_0x608b('0x1d')],function(_0x22c5dc){return{'model':db[_0x22c5dc['model']],'as':_0x22c5dc['as'],'attributes':_0x22c5dc[_0x608b('0x1c')],'include':_0x22c5dc[_0x608b('0x1d')]?_[_0x608b('0x1e')](_0x22c5dc[_0x608b('0x1d')],function(_0xd37004){return{'model':db[_0xd37004[_0x608b('0x1f')]],'as':_0xd37004['as'],'attributes':_0xd37004[_0x608b('0x1c')],'include':_0xd37004[_0x608b('0x1d')]?_[_0x608b('0x1e')](_0xd37004[_0x608b('0x1d')],function(_0x3edd79){return{'model':db[_0x3edd79['model']],'as':_0x3edd79['as'],'attributes':_0x3edd79[_0x608b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x608b('0xb')](function(_0x540adb){logger[_0x608b('0xc')](_0x608b('0x16'),_0x572d4c);logger[_0x608b('0xf')]('ShowSetting',_0x572d4c,JSON[_0x608b('0x11')](_0x540adb));_0x568fc2(_0x540adb);})[_0x608b('0x20')](function(_0x58a434){logger[_0x608b('0x12')]('ShowSetting',_0x58a434['message'],_0x572d4c);_0x32e2f3(_0x2ae5e4['error'](0x1f4,_0x58a434['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 9267ee0..bfd7b39 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x262823,_0xe7a72a){var _0x3c2fc0=function(_0x5325ec){while(--_0x5325ec){_0x262823['push'](_0x262823['shift']());}};_0x3c2fc0(++_0xe7a72a);}(_0x7a54,0x106));var _0x47a5=function(_0x5b247f,_0xbb4e0){_0x5b247f=_0x5b247f-0x0;var _0x58119e=_0x7a54[_0x5b247f];return _0x58119e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x480900,_0x27d4c2){var _0x209064=function(_0x3b6e53){while(--_0x3b6e53){_0x480900['push'](_0x480900['shift']());}};_0x209064(++_0x27d4c2);}(_0x7a54,0x106));var _0x47a5=function(_0x1da152,_0x3f1668){_0x1da152=_0x1da152-0x0;var _0xfaeaf1=_0x7a54[_0x1da152];return _0xfaeaf1;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 48b00e9..174944f 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 _0x6228=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','name','STRING','generate','ENUM','twilio','skebby','clicksend','clickatell','bandwidth','infobip','intelepeer','BOOLEAN'];(function(_0x544757,_0x33341a){var _0x2ea8a1=function(_0x5966ec){while(--_0x5966ec){_0x544757['push'](_0x544757['shift']());}};_0x2ea8a1(++_0x33341a);}(_0x6228,0x64));var _0x8622=function(_0x325caf,_0x6b841c){_0x325caf=_0x325caf-0x0;var _0x5f0360=_0x6228[_0x325caf];return _0x5f0360;};'use strict';var Sequelize=require(_0x8622('0x0'));var rs=require(_0x8622('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8622('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x8622('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8622('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x8622('0x3')],'defaultValue':function(){return rs[_0x8622('0x4')]();}},'phone':{'type':Sequelize[_0x8622('0x3')]},'type':{'type':Sequelize[_0x8622('0x5')](_0x8622('0x6'),_0x8622('0x7'),'connectel',_0x8622('0x8'),'plivo',_0x8622('0x9'),_0x8622('0xa'),'csc',_0x8622('0xb'),_0x8622('0xc'))},'accountSid':{'type':Sequelize[_0x8622('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8622('0x3')]},'smsMethod':{'type':Sequelize[_0x8622('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8622('0x3')]},'password':{'type':Sequelize[_0x8622('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x8622('0x3')]},'accountId':{'type':Sequelize[_0x8622('0x3')]},'senderString':{'type':Sequelize[_0x8622('0x3')]},'deliveryReport':{'type':Sequelize[_0x8622('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x8622('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8622('0xe');}},'notificationSound':{'type':Sequelize[_0x8622('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8622('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8622('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8622('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8622('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8622('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8622('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8622('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8622('0x10'),'set':function(_0xd2ae){if(!_0xd2ae)this['setDataValue'](_0x8622('0x11'),null);this[_0x8622('0x12')]('mandatoryDisposition',_0xd2ae);}}}; \ No newline at end of file +var _0x2133=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','skebby','connectel','clicksend','clickatell','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x2133,0x190));var _0x3213=function(_0x19571f,_0x15a027){_0x19571f=_0x19571f-0x0;var _0x328708=_0x2133[_0x19571f];return _0x328708;};'use strict';var Sequelize=require(_0x3213('0x0'));var rs=require(_0x3213('0x1'));module[_0x3213('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x3213('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x3213('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x3213('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x3213('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3213('0x5')]('twilio',_0x3213('0x6'),_0x3213('0x7'),_0x3213('0x8'),'plivo',_0x3213('0x9'),'bandwidth','csc','infobip',_0x3213('0xa'))},'accountSid':{'type':Sequelize[_0x3213('0x4')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3213('0x4')]},'smsMethod':{'type':Sequelize[_0x3213('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3213('0x4')]},'password':{'type':Sequelize[_0x3213('0x4')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x3213('0x4')]},'senderString':{'type':Sequelize[_0x3213('0x4')]},'deliveryReport':{'type':Sequelize[_0x3213('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x3213('0x4')]},'notificationTemplate':{'type':Sequelize[_0x3213('0xc')],'defaultValue':function(){return _0x3213('0xd');}},'notificationSound':{'type':Sequelize[_0x3213('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3213('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3213('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3213('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3213('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3213('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3213('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3213('0xe')],'comment':_0x3213('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x3213('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x341aa3){if(!_0x341aa3)this[_0x3213('0x10')]('mandatoryDispositionPauseId',null);this[_0x3213('0x10')](_0x3213('0x11'),_0x341aa3);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 488aa31..0fb34a8 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 _0x431e=['autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','sort','include','removeDispositions','addAnswer','CannedAnswer','findOne','removeAnswers','ids','notify','sms','Applications','applications','priority','asc','account','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','From','Body','messageId','skebby','from','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','intelepeer','isNil','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','Contacts','list','SmsInteraction','spread','interaction','autoclose','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','SmsQueue','unshift','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','sendStatus','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','tag','List','DESC','Messages','dataValues','push','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','error_code','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','create','user','UserProfileSection','find'];(function(_0x5642f0,_0x4fd548){var _0x1f2b9c=function(_0x1c1910){while(--_0x1c1910){_0x5642f0['push'](_0x5642f0['shift']());}};_0x1f2b9c(++_0x4fd548);}(_0x431e,0x165));var _0xe431=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x431e[_0x13843f];return _0x1063ae;};'use strict';var emlformat=require(_0xe431('0x0'));var rimraf=require(_0xe431('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe431('0x2'));var rp=require(_0xe431('0x3'));var moment=require('moment');var BPromise=require(_0xe431('0x4'));var Mustache=require(_0xe431('0x5'));var util=require(_0xe431('0x6'));var path=require(_0xe431('0x7'));var sox=require(_0xe431('0x8'));var csv=require(_0xe431('0x9'));var ejs=require(_0xe431('0xa'));var fs=require('fs');var fs_extra=require(_0xe431('0xb'));var _=require(_0xe431('0xc'));var squel=require(_0xe431('0xd'));var crypto=require(_0xe431('0xe'));var jsforce=require(_0xe431('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe431('0x9'));var querystring=require(_0xe431('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe431('0x11'));var qs=require(_0xe431('0x12'));var as=require(_0xe431('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe431('0x14'));var utils=require('../../config/utils');var config=require(_0xe431('0x15'));var licenseUtil=require(_0xe431('0x16'));var db=require(_0xe431('0x17'))['db'];config[_0xe431('0x18')]=_[_0xe431('0x19')](config[_0xe431('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe431('0x1a'))(new Redis(config[_0xe431('0x18')]));require('./smsAccount.socket')[_0xe431('0x1b')](socket);var jayson=require(_0xe431('0x1c'));var client=jayson[_0xe431('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x17f4df,_0x1c8229,_0x4b6e0c,_0x5ed148){return new BPromise(function(_0x49721,_0x1b0602){var _0x42d70d=_0x5ed148||client;return _0x42d70d[_0xe431('0x1e')](_0x17f4df,_0x4b6e0c)[_0xe431('0x1f')](function(_0x3900a6){logger[_0xe431('0x20')](_0xe431('0x21'),_0x1c8229,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1c8229,'request\x20sent',JSON[_0xe431('0x22')](_0x3900a6));if(_0x3900a6['error']){if(_0x3900a6[_0xe431('0x23')][_0xe431('0x24')]===0x1f4){logger[_0xe431('0x23')](_0xe431('0x21'),_0x1c8229,_0x3900a6[_0xe431('0x23')][_0xe431('0x25')]);return _0x1b0602(_0x3900a6['error']['message']);}logger[_0xe431('0x23')](_0xe431('0x21'),_0x1c8229,_0x3900a6[_0xe431('0x23')]['message']);return _0x49721(_0x3900a6[_0xe431('0x23')][_0xe431('0x25')]);}else{logger[_0xe431('0x20')](_0xe431('0x21'),_0x1c8229,_0xe431('0x26'));_0x49721(_0x3900a6['result'][_0xe431('0x25')]);}})[_0xe431('0x27')](function(_0x4833b0){logger[_0xe431('0x23')](_0xe431('0x21'),_0x1c8229,_0x4833b0);_0x1b0602(_0x4833b0);});});}function respondWithStatusCode(_0x2f314c,_0xe19f79){_0xe19f79=_0xe19f79||0xcc;return function(_0x487a19){if(_0x487a19){return _0x2f314c['sendStatus'](_0xe19f79);}return _0x2f314c[_0xe431('0x28')](_0xe19f79)['end']();};}function respondWithResult(_0x159b8c,_0x212cf8){_0x212cf8=_0x212cf8||0xc8;return function(_0xc166e3){if(_0xc166e3){return _0x159b8c['status'](_0x212cf8)[_0xe431('0x29')](_0xc166e3);}};}function respondWithFilteredResult(_0x4010a7,_0x45187a){return function(_0x446d55){if(_0x446d55){var _0x15c703=typeof _0x45187a[_0xe431('0x2a')]===_0xe431('0x2b')&&typeof _0x45187a[_0xe431('0x2c')]===_0xe431('0x2b');var _0x2b6647=_0x446d55[_0xe431('0x2d')];var _0xb5c049=_0x15c703?0x0:_0x45187a[_0xe431('0x2a')];var _0x4db33b=_0x15c703?_0x446d55[_0xe431('0x2d')]:_0x45187a[_0xe431('0x2a')]+_0x45187a[_0xe431('0x2c')];var _0x434ac0;if(_0x4db33b>=_0x2b6647){_0x4db33b=_0x2b6647;_0x434ac0=0xc8;}else{_0x434ac0=0xce;}_0x4010a7[_0xe431('0x28')](_0x434ac0);return _0x4010a7[_0xe431('0x2e')](_0xe431('0x2f'),_0xb5c049+'-'+_0x4db33b+'/'+_0x2b6647)['json'](_0x446d55);}return null;};}function patchUpdates(_0xbf2de2){return function(_0x3ee343){try{jsonpatch[_0xe431('0x30')](_0x3ee343,_0xbf2de2,!![]);}catch(_0x51b75){return BPromise[_0xe431('0x31')](_0x51b75);}return _0x3ee343[_0xe431('0x32')]();};}function saveUpdates(_0xfc1470,_0x1b25fb){return function(_0xd7015f){if(_0xd7015f){return _0xd7015f[_0xe431('0x33')](_0xfc1470)[_0xe431('0x1f')](function(_0x476da8){return _0x476da8;});}return null;};}function removeEntity(_0x2c7860,_0x9eb5f0){return function(_0x679713){if(_0x679713){return _0x679713[_0xe431('0x34')]()[_0xe431('0x1f')](function(){var _0x304303=_0x679713[_0xe431('0x35')]({'plain':!![]});var _0x4f75b5=_0xe431('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x4f75b5,'resourceId':_0x304303['id']}})[_0xe431('0x1f')](function(){return _0x679713;});})[_0xe431('0x1f')](function(){_0x2c7860['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3412c8,_0x35cd80){return function(_0x136f35){if(!_0x136f35){_0x3412c8['sendStatus'](0x194);}return _0x136f35;};}function handleError(_0x2dab11,_0x209cd8){_0x209cd8=_0x209cd8||0x1f4;return function(_0x4f83a2){logger[_0xe431('0x23')](_0x4f83a2[_0xe431('0x37')]);if(_0x4f83a2['name']){delete _0x4f83a2[_0xe431('0x38')];}_0x2dab11[_0xe431('0x28')](_0x209cd8)[_0xe431('0x39')](_0x4f83a2);};}exports['index']=function(_0x1c4436,_0x554829){var _0x4f7d73={'include':[{'model':db[_0xe431('0x3a')],'as':_0xe431('0x3b')}]},_0x853784={},_0x461a4d={'count':0x0,'rows':[]};var _0x4feb69=_[_0xe431('0x3c')](db[_0xe431('0x3d')][_0xe431('0x3e')],function(_0x3dac30){return{'name':_0x3dac30[_0xe431('0x3f')],'type':_0x3dac30[_0xe431('0x40')][_0xe431('0x41')]};});_0x853784[_0xe431('0x42')]=_['map'](_0x4feb69,_0xe431('0x38'));_0x853784[_0xe431('0x43')]=_[_0xe431('0x44')](_0x1c4436['query']);_0x853784[_0xe431('0x45')]=_[_0xe431('0x46')](_0x853784['model'],_0x853784['query']);_0x4f7d73[_0xe431('0x47')]=_['intersection'](_0x853784[_0xe431('0x42')],qs[_0xe431('0x48')](_0x1c4436[_0xe431('0x43')]['fields']));_0x4f7d73[_0xe431('0x47')]=_0x4f7d73[_0xe431('0x47')][_0xe431('0x49')]?_0x4f7d73[_0xe431('0x47')]:_0x853784['model'];if(!_0x1c4436[_0xe431('0x43')][_0xe431('0x4a')](_0xe431('0x4b'))){_0x4f7d73['limit']=qs[_0xe431('0x2c')](_0x1c4436[_0xe431('0x43')]['limit']);_0x4f7d73[_0xe431('0x2a')]=qs[_0xe431('0x2a')](_0x1c4436[_0xe431('0x43')][_0xe431('0x2a')]);}_0x4f7d73[_0xe431('0x4c')]=qs['sort'](_0x1c4436['query']['sort']);_0x4f7d73[_0xe431('0x4d')]=qs[_0xe431('0x45')](_[_0xe431('0x4e')](_0x1c4436['query'],_0x853784[_0xe431('0x45')]),_0x4feb69);if(_0x1c4436[_0xe431('0x43')]['filter']){_0x4f7d73[_0xe431('0x4d')]=_[_0xe431('0x4f')](_0x4f7d73[_0xe431('0x4d')],{'$or':_[_0xe431('0x3c')](_0x4feb69,function(_0x15cb8b){if(_0x15cb8b['type']!==_0xe431('0x50')){var _0x3b35ad={};_0x3b35ad[_0x15cb8b[_0xe431('0x38')]]={'$like':'%'+_0x1c4436[_0xe431('0x43')][_0xe431('0x51')]+'%'};return _0x3b35ad;}})});}_0x4f7d73=_['merge']({},_0x4f7d73,_0x1c4436[_0xe431('0x52')]);var _0x1a5286={'where':_0x4f7d73[_0xe431('0x4d')]};return db[_0xe431('0x3d')][_0xe431('0x2d')](_0x1a5286)[_0xe431('0x1f')](function(_0x2de532){_0x461a4d['count']=_0x2de532;if(_0x1c4436[_0xe431('0x43')][_0xe431('0x53')]){_0x4f7d73['include']=[{'all':!![]}];}return db['SmsAccount'][_0xe431('0x54')](_0x4f7d73);})[_0xe431('0x1f')](function(_0x5a7b01){_0x461a4d[_0xe431('0x55')]=_0x5a7b01;return _0x461a4d;})['then'](respondWithFilteredResult(_0x554829,_0x4f7d73))[_0xe431('0x27')](handleError(_0x554829,null));};exports['show']=function(_0x103c93,_0x14ce05){var _0x273c3d={'raw':![],'where':{'id':_0x103c93[_0xe431('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xe431('0x3b')}]},_0x1649e3={};_0x1649e3[_0xe431('0x42')]=_[_0xe431('0x44')](db[_0xe431('0x3d')][_0xe431('0x3e')]);_0x1649e3[_0xe431('0x43')]=_[_0xe431('0x44')](_0x103c93[_0xe431('0x43')]);_0x1649e3[_0xe431('0x45')]=_[_0xe431('0x46')](_0x1649e3['model'],_0x1649e3[_0xe431('0x43')]);_0x273c3d[_0xe431('0x47')]=_[_0xe431('0x46')](_0x1649e3[_0xe431('0x42')],qs[_0xe431('0x48')](_0x103c93[_0xe431('0x43')][_0xe431('0x48')]));_0x273c3d[_0xe431('0x47')]=_0x273c3d[_0xe431('0x47')]['length']?_0x273c3d[_0xe431('0x47')]:_0x1649e3[_0xe431('0x42')];if(_0x103c93[_0xe431('0x43')][_0xe431('0x53')]){_0x273c3d['include']=[{'all':!![]}];}_0x273c3d=_[_0xe431('0x4f')]({},_0x273c3d,_0x103c93[_0xe431('0x52')]);return db[_0xe431('0x3d')]['find'](_0x273c3d)[_0xe431('0x1f')](handleEntityNotFound(_0x14ce05,null))[_0xe431('0x1f')](respondWithResult(_0x14ce05,null))[_0xe431('0x27')](handleError(_0x14ce05,null));};exports['create']=function(_0x369d36,_0x58f5b){return db['SmsAccount'][_0xe431('0x57')](_0x369d36['body'],{})['then'](function(_0x3a7844){var _0x36efcb=_0x369d36[_0xe431('0x58')][_0xe431('0x35')]({'plain':!![]});if(!_0x36efcb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36efcb['role']===_0xe431('0x58')){var _0x2b979d=_0x3a7844[_0xe431('0x35')]({'plain':!![]});var _0x453ac4=_0xe431('0x36');return db[_0xe431('0x59')][_0xe431('0x5a')]({'where':{'name':_0x453ac4,'userProfileId':_0x36efcb['userProfileId']},'raw':!![]})[_0xe431('0x1f')](function(_0x367e6e){if(_0x367e6e&&_0x367e6e[_0xe431('0x5b')]===0x0){return db['UserProfileResource'][_0xe431('0x57')]({'name':_0x2b979d[_0xe431('0x38')],'resourceId':_0x2b979d['id'],'type':_0x367e6e[_0xe431('0x38')],'sectionId':_0x367e6e['id']},{})[_0xe431('0x1f')](function(){return _0x3a7844;});}else{return _0x3a7844;}})[_0xe431('0x27')](function(_0x4108d0){logger[_0xe431('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4108d0);throw _0x4108d0;});}return _0x3a7844;})['then'](respondWithResult(_0x58f5b,0xc9))[_0xe431('0x27')](handleError(_0x58f5b,null));};exports[_0xe431('0x33')]=function(_0x3e9d0e,_0x14ffa3){if(_0x3e9d0e[_0xe431('0x5c')]['id']){delete _0x3e9d0e[_0xe431('0x5c')]['id'];}return db[_0xe431('0x3d')]['find']({'where':{'id':_0x3e9d0e[_0xe431('0x56')]['id']},'include':[{'model':db[_0xe431('0x3a')],'as':_0xe431('0x3b')}]})[_0xe431('0x1f')](handleEntityNotFound(_0x14ffa3,null))[_0xe431('0x1f')](saveUpdates(_0x3e9d0e[_0xe431('0x5c')],null))['then'](respondWithResult(_0x14ffa3,null))[_0xe431('0x27')](handleError(_0x14ffa3,null));};exports[_0xe431('0x34')]=function(_0x14a257,_0x6ee6aa){return db[_0xe431('0x3d')][_0xe431('0x5a')]({'where':{'id':_0x14a257[_0xe431('0x56')]['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x6ee6aa,null))[_0xe431('0x1f')](removeEntity(_0x6ee6aa,null))[_0xe431('0x27')](handleError(_0x6ee6aa,null));};exports[_0xe431('0x5d')]=function(_0x2f8596,_0x466331){return db[_0xe431('0x3d')][_0xe431('0x5d')]()['then'](respondWithResult(_0x466331,null))['catch'](handleError(_0x466331,null));};exports[_0xe431('0x5e')]=function(_0x48179e,_0x3d5c09,_0x512ee9){if(_0x48179e[_0xe431('0x5c')]['id']){delete _0x48179e[_0xe431('0x5c')]['id'];}return db[_0xe431('0x3d')]['find']({'where':{'id':_0x48179e[_0xe431('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d5c09,null))['then'](function(_0x161f44){if(_0x161f44){_0x48179e[_0xe431('0x5c')][_0xe431('0x5f')]=_0x161f44['id'];return db[_0xe431('0x60')]['create'](_0x48179e[_0xe431('0x5c')]);}})['then'](respondWithResult(_0x3d5c09,null))['catch'](handleError(_0x3d5c09,null));};exports[_0xe431('0x61')]=function(_0x141bc1,_0x47aab3,_0x52cf74){var _0x1dfc39={'raw':![],'where':{}};var _0x640e98={};var _0x1c10f1={'count':0x0,'rows':[]};return db[_0xe431('0x3d')]['findOne']({'where':{'id':_0x141bc1[_0xe431('0x56')]['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x47aab3,null))[_0xe431('0x1f')](function(_0x22db38){if(_0x22db38){_0x640e98[_0xe431('0x42')]=_['keys'](db[_0xe431('0x60')][_0xe431('0x3e')]);_0x640e98[_0xe431('0x43')]=_[_0xe431('0x44')](_0x141bc1['query']);_0x640e98[_0xe431('0x45')]=_['intersection'](_0x640e98[_0xe431('0x42')],_0x640e98[_0xe431('0x43')]);_0x1dfc39[_0xe431('0x47')]=_[_0xe431('0x46')](_0x640e98[_0xe431('0x42')],qs[_0xe431('0x48')](_0x141bc1[_0xe431('0x43')][_0xe431('0x48')]));_0x1dfc39[_0xe431('0x47')]=_0x1dfc39['attributes'][_0xe431('0x49')]?_0x1dfc39[_0xe431('0x47')]:_0x640e98[_0xe431('0x42')];if(!_0x141bc1[_0xe431('0x43')][_0xe431('0x4a')]('nolimit')){_0x1dfc39[_0xe431('0x2c')]=qs[_0xe431('0x2c')](_0x141bc1[_0xe431('0x43')][_0xe431('0x2c')]);_0x1dfc39[_0xe431('0x2a')]=qs[_0xe431('0x2a')](_0x141bc1[_0xe431('0x43')][_0xe431('0x2a')]);}_0x1dfc39[_0xe431('0x4c')]=qs[_0xe431('0x62')](_0x141bc1[_0xe431('0x43')][_0xe431('0x62')]);_0x1dfc39[_0xe431('0x4d')]=qs[_0xe431('0x45')](_['pick'](_0x141bc1[_0xe431('0x43')],_0x640e98[_0xe431('0x45')]));_0x1dfc39['where']['SmsAccountId']=_0x22db38['id'];if(_0x141bc1['query'][_0xe431('0x51')]){_0x1dfc39[_0xe431('0x4d')]=_[_0xe431('0x4f')](_0x1dfc39[_0xe431('0x4d')],{'$or':_[_0xe431('0x3c')](_0x1dfc39['attributes'],function(_0x81c5){var _0x3d208d={};_0x3d208d[_0x81c5]={'$like':'%'+_0x141bc1[_0xe431('0x43')][_0xe431('0x51')]+'%'};return _0x3d208d;})});}_0x1dfc39=_[_0xe431('0x4f')]({},_0x1dfc39,_0x141bc1[_0xe431('0x52')]);return db[_0xe431('0x60')][_0xe431('0x2d')]({'where':_0x1dfc39['where']})[_0xe431('0x1f')](function(_0x2e3725){_0x1c10f1[_0xe431('0x2d')]=_0x2e3725;if(_0x141bc1[_0xe431('0x43')]['includeAll']){_0x1dfc39[_0xe431('0x63')]=[{'all':!![]}];}return db[_0xe431('0x60')][_0xe431('0x54')](_0x1dfc39);})['then'](function(_0x282007){_0x1c10f1[_0xe431('0x55')]=_0x282007;return _0x1c10f1;});}})[_0xe431('0x1f')](respondWithFilteredResult(_0x47aab3,_0x1dfc39))['catch'](handleError(_0x47aab3,null));};exports[_0xe431('0x64')]=function(_0x553f48,_0x1cfa6d,_0x10a8a2){return db[_0xe431('0x3d')][_0xe431('0x5a')]({'where':{'id':_0x553f48['params']['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x1cfa6d,null))[_0xe431('0x1f')](function(_0x1d745d){if(_0x1d745d){return _0x1d745d[_0xe431('0x64')](_0x553f48[_0xe431('0x43')]['ids']);}})[_0xe431('0x1f')](respondWithStatusCode(_0x1cfa6d,null))[_0xe431('0x27')](handleError(_0x1cfa6d,null));};exports[_0xe431('0x65')]=function(_0x4571e4,_0x107a11,_0xff2f95){if(_0x4571e4[_0xe431('0x5c')]['id']){delete _0x4571e4[_0xe431('0x5c')]['id'];}return db[_0xe431('0x3d')]['find']({'where':{'id':_0x4571e4[_0xe431('0x56')]['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x107a11,null))['then'](function(_0x425046){if(_0x425046){_0x4571e4[_0xe431('0x5c')][_0xe431('0x5f')]=_0x425046['id'];return db[_0xe431('0x66')][_0xe431('0x57')](_0x4571e4[_0xe431('0x5c')]);}})[_0xe431('0x1f')](respondWithResult(_0x107a11,null))[_0xe431('0x27')](handleError(_0x107a11,null));};exports['getAnswers']=function(_0x128968,_0x172f5a,_0x54d2d1){var _0x45943b={'raw':![],'where':{}};var _0x3ac2c5={};var _0x248cc1={'count':0x0,'rows':[]};return db[_0xe431('0x3d')][_0xe431('0x67')]({'where':{'id':_0x128968['params']['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x172f5a,null))['then'](function(_0x23d7f3){if(_0x23d7f3){_0x3ac2c5[_0xe431('0x42')]=_['keys'](db[_0xe431('0x66')]['rawAttributes']);_0x3ac2c5[_0xe431('0x43')]=_[_0xe431('0x44')](_0x128968[_0xe431('0x43')]);_0x3ac2c5[_0xe431('0x45')]=_['intersection'](_0x3ac2c5[_0xe431('0x42')],_0x3ac2c5[_0xe431('0x43')]);_0x45943b['attributes']=_[_0xe431('0x46')](_0x3ac2c5[_0xe431('0x42')],qs[_0xe431('0x48')](_0x128968[_0xe431('0x43')][_0xe431('0x48')]));_0x45943b[_0xe431('0x47')]=_0x45943b[_0xe431('0x47')][_0xe431('0x49')]?_0x45943b[_0xe431('0x47')]:_0x3ac2c5[_0xe431('0x42')];if(!_0x128968[_0xe431('0x43')][_0xe431('0x4a')](_0xe431('0x4b'))){_0x45943b[_0xe431('0x2c')]=qs[_0xe431('0x2c')](_0x128968[_0xe431('0x43')][_0xe431('0x2c')]);_0x45943b['offset']=qs[_0xe431('0x2a')](_0x128968[_0xe431('0x43')]['offset']);}_0x45943b[_0xe431('0x4c')]=qs['sort'](_0x128968[_0xe431('0x43')][_0xe431('0x62')]);_0x45943b[_0xe431('0x4d')]=qs[_0xe431('0x45')](_[_0xe431('0x4e')](_0x128968[_0xe431('0x43')],_0x3ac2c5[_0xe431('0x45')]));_0x45943b[_0xe431('0x4d')]['SmsAccountId']=_0x23d7f3['id'];if(_0x128968[_0xe431('0x43')][_0xe431('0x51')]){_0x45943b['where']=_[_0xe431('0x4f')](_0x45943b['where'],{'$or':_['map'](_0x45943b[_0xe431('0x47')],function(_0x51a6fb){var _0x3af54b={};_0x3af54b[_0x51a6fb]={'$like':'%'+_0x128968[_0xe431('0x43')][_0xe431('0x51')]+'%'};return _0x3af54b;})});}_0x45943b=_[_0xe431('0x4f')]({},_0x45943b,_0x128968['options']);return db['CannedAnswer'][_0xe431('0x2d')]({'where':_0x45943b[_0xe431('0x4d')]})[_0xe431('0x1f')](function(_0x3e41c3){_0x248cc1[_0xe431('0x2d')]=_0x3e41c3;if(_0x128968[_0xe431('0x43')]['includeAll']){_0x45943b[_0xe431('0x63')]=[{'all':!![]}];}return db[_0xe431('0x66')][_0xe431('0x54')](_0x45943b);})[_0xe431('0x1f')](function(_0x5e6623){_0x248cc1[_0xe431('0x55')]=_0x5e6623;return _0x248cc1;});}})[_0xe431('0x1f')](respondWithFilteredResult(_0x172f5a,_0x45943b))[_0xe431('0x27')](handleError(_0x172f5a,null));};exports[_0xe431('0x68')]=function(_0x3458f2,_0x26e6c1,_0x217a2d){return db[_0xe431('0x3d')][_0xe431('0x5a')]({'where':{'id':_0x3458f2[_0xe431('0x56')]['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x26e6c1,null))['then'](function(_0x16a42e){if(_0x16a42e){return _0x16a42e[_0xe431('0x68')](_0x3458f2[_0xe431('0x43')][_0xe431('0x69')]);}})[_0xe431('0x1f')](respondWithStatusCode(_0x26e6c1,null))[_0xe431('0x27')](handleError(_0x26e6c1,null));};exports[_0xe431('0x6a')]=function(_0x597348,_0x5c4021,_0x570d01){var _0x31d6b2={'channel':_0xe431('0x6b')};var _0x152039=[];var _0x2e369d=[];var _0x4febde={};return db[_0xe431('0x3d')][_0xe431('0x5a')]({'where':{'id':_0x597348['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xe431('0x6c')}]})[_0xe431('0x1f')](handleEntityNotFound(_0x5c4021,null))[_0xe431('0x1f')](function(_0x2e50e8){_0x31d6b2['account']=_0x2e50e8;_0x31d6b2[_0xe431('0x6d')]=_['orderBy'](_0x2e50e8['Applications'],[_0xe431('0x6e')],[_0xe431('0x6f')]);if(_0x31d6b2[_0xe431('0x70')][_0xe431('0x6c')]){delete _0x31d6b2[_0xe431('0x70')][_0xe431('0x6c')];}return db[_0xe431('0x71')][_0xe431('0x5d')]();})['then'](function(_0x578b15){if(!_0x578b15){throw new db[(_0xe431('0x72'))][(_0xe431('0x73'))]('no\x20available\x20attributes');}_0x152039=_[_0xe431('0x74')](_[_0xe431('0x44')](_0x578b15),[_0xe431('0x75'),_0xe431('0x76')]);_0x2e369d=_['difference'](_[_0xe431('0x44')](_0x578b15),[_0xe431('0x75'),'updatedAt','CompanyId',_0xe431('0x77')]);_0x31d6b2[_0xe431('0x5c')]={'mapKey':_0xe431('0x78')};if(_0x31d6b2['account'][_0xe431('0x40')]){switch(_0x31d6b2['account'][_0xe431('0x40')]){case _0xe431('0x79'):_0x31d6b2['body']['from']=_0x597348[_0xe431('0x5c')][_0xe431('0x7a')];_0x31d6b2['body'][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x7b')];_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7c')]=_0x597348[_0xe431('0x5c')]['MessageSid'];break;case _0xe431('0x7d'):_0x31d6b2['body'][_0xe431('0x7e')]='+'+_0x597348['body'][_0xe431('0x7f')];_0x31d6b2[_0xe431('0x5c')][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x80')];break;case _0xe431('0x81'):_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7e')]=_0x597348['body'][_0xe431('0x7e')];_0x31d6b2['body']['body']=_0x597348[_0xe431('0x5c')]['message'];break;case _0xe431('0x82'):_0x31d6b2['body'][_0xe431('0x7e')]=_0x597348[_0xe431('0x5c')][_0xe431('0x7e')];_0x31d6b2['body'][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x5c')];_0x31d6b2['body'][_0xe431('0x7c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x83')];break;case _0xe431('0x84'):_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7e')]=_0x597348[_0xe431('0x5c')][_0xe431('0x7a')];_0x31d6b2[_0xe431('0x5c')][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x85')];_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x86')];break;case _0xe431('0x87'):_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7e')]='+'+_0x597348[_0xe431('0x5c')][_0xe431('0x88')][0x0][_0xe431('0x7e')];_0x31d6b2['body'][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x88')][0x0][_0xe431('0x80')];_0x31d6b2[_0xe431('0x5c')]['messageId']=_0x597348[_0xe431('0x5c')]['results'][0x0][_0xe431('0x7c')];break;case _0xe431('0x89'):_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7e')]=_0x597348['body'][_0xe431('0x8a')];_0x31d6b2[_0xe431('0x5c')][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')]['segmentedMessage'][_0xe431('0x25')];break;case _0xe431('0x8b'):_0x31d6b2[_0xe431('0x5c')]['from']=_0x597348[_0xe431('0x5c')][_0xe431('0x8c')];_0x31d6b2[_0xe431('0x5c')][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x80')];_0x31d6b2[_0xe431('0x5c')]['messageId']=_0x597348[_0xe431('0x5c')][_0xe431('0x8d')];break;case'bandwidth':_0x31d6b2[_0xe431('0x5c')]['messageId']=_0x597348[_0xe431('0x5c')][0x0]['message']['id'];_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7e')]=_0x597348[_0xe431('0x5c')][0x0][_0xe431('0x25')][_0xe431('0x7e')];_0x31d6b2['body'][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')][0x0][_0xe431('0x25')][_0xe431('0x80')];break;case _0xe431('0x8e'):_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7e')]=_0x597348[_0xe431('0x5c')][_0xe431('0x7e')];_0x31d6b2[_0xe431('0x5c')][_0xe431('0x5c')]=_0x597348[_0xe431('0x5c')][_0xe431('0x25')];_0x31d6b2[_0xe431('0x5c')]['messageId']=_0x597348['body']['refid'];break;}}if(_0x31d6b2['body']['id']){delete _0x31d6b2['body']['id'];}if(_[_0xe431('0x8f')](_0x31d6b2[_0xe431('0x5c')]['from'])){throw new db[(_0xe431('0x72'))][(_0xe431('0x73'))](_0xe431('0x90'));}if(_['isNil'](_0x31d6b2[_0xe431('0x5c')][_0xe431('0x5c')])||_0x31d6b2[_0xe431('0x5c')][_0xe431('0x5c')]===''){throw new db[(_0xe431('0x72'))][(_0xe431('0x73'))](_0xe431('0x91'));}if(_[_0xe431('0x8f')](_0x31d6b2[_0xe431('0x5c')][_0xe431('0x92')])){throw new db[(_0xe431('0x72'))][(_0xe431('0x73'))](_0xe431('0x93')+_0x2e369d);}if(!_['includes'](_0x2e369d,_0x31d6b2[_0xe431('0x5c')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xe431('0x94')+_0x2e369d);}_0x4febde[_0x31d6b2[_0xe431('0x5c')][_0xe431('0x92')]]=_0x31d6b2[_0xe431('0x5c')]['from'];return db[_0xe431('0x95')]['find']({'where':{'id':_0x31d6b2['account'][_0xe431('0x77')]},'include':[{'model':db[_0xe431('0x71')],'as':_0xe431('0x96'),'where':_0x4febde,'limit':0x1,'order':[[_0xe431('0x76'),'DESC']]}]});})[_0xe431('0x1f')](handleEntityNotFound(_0x5c4021,null))[_0xe431('0x1f')](function(_0x54c4d7){if(_0x54c4d7){_0x31d6b2[_0xe431('0x97')]=_['omit'](_0x54c4d7,['Contacts']);if(_0x54c4d7['Contacts'][_0xe431('0x49')]){return _0x54c4d7[_0xe431('0x96')][0x0];}var _0x63ef85=_[_0xe431('0x19')](_0x31d6b2[_0xe431('0x5c')],{'firstName':_0x31d6b2[_0xe431('0x5c')]['from'],'ListId':_0x54c4d7['id']});_0x63ef85[_0x31d6b2[_0xe431('0x5c')][_0xe431('0x92')]]=_0x31d6b2[_0xe431('0x5c')]['from'];return db['CmContact'][_0xe431('0x57')](_0x63ef85,{'fields':_0x152039,'raw':!![]});}})[_0xe431('0x1f')](handleEntityNotFound(_0x5c4021,null))['then'](function(_0x27b4f8){if(_0x27b4f8){_0x31d6b2['contact']=_0x27b4f8;var _0x32c1f1={'ContactId':_0x27b4f8['id'],'phone':_0x31d6b2[_0xe431('0x5c')]['from'],'SmsAccountId':_0x597348['params']['id']};var _0x33d3c0={'ContactId':_0x27b4f8['id'],'SmsAccountId':_0x597348[_0xe431('0x56')]['id'],'closed':![]};return db['SmsInteraction'][_0xe431('0x5a')]({'where':_0x33d3c0})[_0xe431('0x1f')](function(_0x136588){if(_0x136588){return[_0x136588,![]];}return db[_0xe431('0x98')][_0xe431('0x57')](_0x32c1f1)[_0xe431('0x1f')](function(_0x32d511){return[_0x32d511,!![]];});});}})[_0xe431('0x99')](function(_0x4669ec,_0x727de){_0x31d6b2[_0xe431('0x9a')]=_0x4669ec[_0xe431('0x35')]({'plain':!![]});_0x31d6b2['interaction']['created']=![];if(_0x727de){if(_0x31d6b2[_0xe431('0x70')][_0xe431('0x9b')]){_0x31d6b2[_0xe431('0x6d')]['push']({'id':0x0,'priority':_0x31d6b2[_0xe431('0x6d')][_0xe431('0x49')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xe431('0x9c')});}_0x31d6b2['interaction'][_0xe431('0x9d')]=!![];}return db[_0xe431('0x9e')][_0xe431('0x57')]({'phone':_0x31d6b2[_0xe431('0x5c')][_0xe431('0x7e')],'messageId':_0x31d6b2[_0xe431('0x5c')]['messageId'],'body':_0x31d6b2[_0xe431('0x5c')][_0xe431('0x5c')],'SmsAccountId':_0x597348[_0xe431('0x56')]['id'],'SmsInteractionId':_0x4669ec['id'],'direction':'in','ContactId':_0x4669ec[_0xe431('0x9f')],'AttachmentId':_0x31d6b2[_0xe431('0x5c')][_0xe431('0xa0')]});})[_0xe431('0x1f')](function(_0x1e44e7){_0x31d6b2[_0xe431('0x25')]=_0x1e44e7;if(!_0x31d6b2[_0xe431('0x9a')][_0xe431('0xa1')])return;return db[_0xe431('0xa2')][_0xe431('0x5a')]({'attributes':['id',_0xe431('0x38')],'where':{'id':_0x31d6b2[_0xe431('0x9a')]['UserId']}});})[_0xe431('0x1f')](function(_0x99b3d4){if(_0x99b3d4){_0x31d6b2['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xe431('0xa3'),'appdata':_0x99b3d4[_0xe431('0x38')]+','+(_0x31d6b2[_0xe431('0x70')][_0xe431('0xa4')]||0xa),'interval':_0xe431('0x9c')});}if(!_0x31d6b2[_0xe431('0x9a')][_0xe431('0xa5')])return;return db[_0xe431('0xa6')][_0xe431('0x5a')]({'attributes':['id',_0xe431('0x38')],'where':{'id':_0x31d6b2[_0xe431('0x9a')][_0xe431('0xa5')]}});})[_0xe431('0x1f')](function(_0x5e6f9a){if(_0x5e6f9a){_0x31d6b2[_0xe431('0x6d')][_0xe431('0xa7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5e6f9a[_0xe431('0x38')]+','+(_0x31d6b2[_0xe431('0x70')][_0xe431('0xa8')]||0x12c),'interval':_0xe431('0x9c')});}return respondWithRpcPromise('Start',_0xe431('0xa9'),_0x31d6b2);})[_0xe431('0x1f')](function(_0x115aff){if(_0x115aff){var _0xf92fe3=0xc8;var _0x21dc2a=_0xe431('0xaa');logger['info'](_0xe431('0xab'),_0x21dc2a,_0xf92fe3,_0xe431('0xac'));logger['debug'](_0xe431('0xad'),_0x21dc2a,_0xf92fe3,_0xe431('0xac'),JSON[_0xe431('0x22')](_0x115aff));if(_0x31d6b2['account'][_0xe431('0x40')]==='twilio'){return _0x5c4021[_0xe431('0x28')](_0xf92fe3)[_0xe431('0x2e')](_0xe431('0xae'),'text/xml')[_0xe431('0x39')](_0xe431('0xaf'));}else{return _0x5c4021[_0xe431('0x28')](_0xf92fe3)[_0xe431('0x29')](_0x115aff);}}})[_0xe431('0x27')](handleError(_0x5c4021,null));};exports[_0xe431('0xb0')]=function(_0x4b4974,_0x4d241f){var _0xde111c=_0x4b4974[_0xe431('0x56')]['id'];var _0x499f25=_0x4b4974[_0xe431('0x5c')];var _0xf8fd5b=0xc8;var _0x53f047=null;return db[_0xe431('0xb1')][_0xe431('0xb2')]({'isolationLevel':db['sequelize'][_0xe431('0xb3')][_0xe431('0xb4')][_0xe431('0xb5')]},function(_0xfc6a57){return db[_0xe431('0x3d')][_0xe431('0x67')]({'where':{'id':_0xde111c},'transaction':_0xfc6a57})['then'](function(_0x482060){if(_0x482060){return db[_0xe431('0xb6')]['destroy']({'where':{'SmsAccountId':_0xde111c},'transaction':_0xfc6a57})['then'](function(){var _0x1c92cd=_[_0xe431('0x3c')](_0x499f25,function(_0x24716a){_0x24716a[_0xe431('0x5f')]=_0xde111c;return _0x24716a;});return db[_0xe431('0xb6')][_0xe431('0xb7')](_0x1c92cd,{'transaction':_0xfc6a57});});}else{_0xf8fd5b=0x194;_0x53f047=[];}});})[_0xe431('0x1f')](function(){if(_0xf8fd5b!==0x194){return db[_0xe431('0xb6')][_0xe431('0xb8')]({'where':{'SmsAccountId':_0xde111c},'order':_0xe431('0x6e')})[_0xe431('0x1f')](function(_0x587fdb){_0x53f047=_0x587fdb;});}})['catch'](function(_0x15f99b){_0xf8fd5b=0x1f4;logger[_0xe431('0x23')](_0x15f99b[_0xe431('0x37')]);if(_0x15f99b[_0xe431('0x38')]){delete _0x15f99b[_0xe431('0x38')];}_0x53f047=_0x15f99b;})[_0xe431('0xb9')](function(){if(_0x53f047===null){_0x4d241f[_0xe431('0xba')](_0xf8fd5b);}else{if(_0xf8fd5b===0x1f4){_0x4d241f[_0xe431('0x28')](_0xf8fd5b)['send'](_0x53f047);}else{_0x4d241f[_0xe431('0x28')](_0xf8fd5b)[_0xe431('0x29')](_0x53f047);}}});};exports['getApplications']=function(_0x5eb411,_0x9c6c9f,_0x56d654){var _0x3ed5c2={};var _0x5e3094={};var _0x2a65e2;var _0x4069e9;return db[_0xe431('0x3d')][_0xe431('0x67')]({'where':{'id':_0x5eb411['params']['id']}})['then'](handleEntityNotFound(_0x9c6c9f,null))[_0xe431('0x1f')](function(_0x1768f1){if(_0x1768f1){_0x2a65e2=_0x1768f1;_0x5e3094['model']=_[_0xe431('0x44')](db['SmsApplication'][_0xe431('0x3e')]);_0x5e3094[_0xe431('0x43')]=_['keys'](_0x5eb411[_0xe431('0x43')]);_0x5e3094[_0xe431('0x45')]=_[_0xe431('0x46')](_0x5e3094[_0xe431('0x42')],_0x5e3094['query']);_0x3ed5c2[_0xe431('0x47')]=_[_0xe431('0x46')](_0x5e3094[_0xe431('0x42')],qs[_0xe431('0x48')](_0x5eb411[_0xe431('0x43')][_0xe431('0x48')]));_0x3ed5c2[_0xe431('0x47')]=_0x3ed5c2[_0xe431('0x47')][_0xe431('0x49')]?_0x3ed5c2['attributes']:_0x5e3094[_0xe431('0x42')];_0x3ed5c2[_0xe431('0x4c')]=qs[_0xe431('0x62')](_0x5eb411[_0xe431('0x43')][_0xe431('0x62')]);_0x3ed5c2[_0xe431('0x4d')]=qs[_0xe431('0x45')](_[_0xe431('0x4e')](_0x5eb411[_0xe431('0x43')],_0x5e3094[_0xe431('0x45')]));if(_0x5eb411[_0xe431('0x43')][_0xe431('0x51')]){_0x3ed5c2[_0xe431('0x4d')]=_[_0xe431('0x4f')](_0x3ed5c2['where'],{'$or':_[_0xe431('0x3c')](_0x3ed5c2[_0xe431('0x47')],function(_0xd1fcf8){var _0x338d5a={};_0x338d5a[_0xd1fcf8]={'$like':'%'+_0x5eb411[_0xe431('0x43')][_0xe431('0x51')]+'%'};return _0x338d5a;})});}_0x3ed5c2=_['merge']({},_0x3ed5c2,_0x5eb411[_0xe431('0x52')]);return _0x2a65e2[_0xe431('0xbb')](_0x3ed5c2);}})[_0xe431('0x1f')](function(_0x35ef0d){if(_0x35ef0d){_0x4069e9=_0x35ef0d[_0xe431('0x49')];if(!_0x5eb411['query'][_0xe431('0x4a')](_0xe431('0x4b'))){_0x3ed5c2[_0xe431('0x2c')]=qs[_0xe431('0x2c')](_0x5eb411[_0xe431('0x43')][_0xe431('0x2c')]);_0x3ed5c2[_0xe431('0x2a')]=qs['offset'](_0x5eb411[_0xe431('0x43')][_0xe431('0x2a')]);}return _0x2a65e2[_0xe431('0xbb')](_0x3ed5c2);}})[_0xe431('0x1f')](function(_0x4128cb){if(_0x4128cb){return _0x4128cb?{'count':_0x4069e9,'rows':_0x4128cb}:null;}})['then'](respondWithResult(_0x9c6c9f,null))[_0xe431('0x27')](handleError(_0x9c6c9f,null));};exports[_0xe431('0xbc')]=function(_0xce70e,_0x136d14,_0x18c473){var _0x69e606={'raw':![],'where':{}};var _0x450614={};var _0x2402bb={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe431('0x67')]({'where':{'id':_0xce70e[_0xe431('0x56')]['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x136d14,null))[_0xe431('0x1f')](function(_0x1017a4){if(_0x1017a4){_0x450614['model']=_['keys'](db[_0xe431('0x98')][_0xe431('0x3e')]);_0x450614['query']=_['keys'](_0xce70e[_0xe431('0x43')]);_0x450614[_0xe431('0x45')]=_['intersection'](_0x450614['model'],_0x450614[_0xe431('0x43')]);_0x69e606['attributes']=_[_0xe431('0x46')](_0x450614['model'],qs[_0xe431('0x48')](_0xce70e[_0xe431('0x43')][_0xe431('0x48')]));_0x69e606[_0xe431('0x47')]=_0x69e606[_0xe431('0x47')][_0xe431('0x49')]?_0x69e606[_0xe431('0x47')]:_0x450614[_0xe431('0x42')];if(!_0xce70e[_0xe431('0x43')][_0xe431('0x4a')](_0xe431('0x4b'))){_0x69e606['limit']=qs['limit'](_0xce70e[_0xe431('0x43')][_0xe431('0x2c')]);_0x69e606['offset']=qs[_0xe431('0x2a')](_0xce70e[_0xe431('0x43')][_0xe431('0x2a')]);}_0x69e606[_0xe431('0x4c')]=qs['sort'](_0xce70e[_0xe431('0x43')][_0xe431('0x62')]);_0x69e606[_0xe431('0x4d')]=qs[_0xe431('0x45')](_[_0xe431('0x4e')](_0xce70e[_0xe431('0x43')],_0x450614[_0xe431('0x45')]));_0x69e606[_0xe431('0x4d')][_0xe431('0x5f')]=_0x1017a4['id'];if(_0xce70e[_0xe431('0x43')][_0xe431('0x51')]){_0x69e606[_0xe431('0x4d')]=_[_0xe431('0x4f')](_0x69e606['where'],{'$or':_['map'](_0x69e606['attributes'],function(_0x2f8b0b){var _0x5ad664={};_0x5ad664[_0x2f8b0b]={'$like':'%'+_0xce70e[_0xe431('0x43')][_0xe431('0x51')]+'%'};return _0x5ad664;})});}_0x69e606=_['merge']({},_0x69e606,_0xce70e[_0xe431('0x52')]);return db[_0xe431('0x98')][_0xe431('0x2d')]({'where':_0x69e606[_0xe431('0x4d')]})[_0xe431('0x1f')](function(_0x214005){_0x2402bb['count']=_0x214005;if(_0xce70e[_0xe431('0x43')][_0xe431('0x53')]){_0x69e606[_0xe431('0x63')]=[{'model':db[_0xe431('0x71')],'as':'Contact','required':![]},{'model':db[_0xe431('0xa2')],'as':_0xe431('0xbd'),'attributes':[_0xe431('0x38'),_0xe431('0xbe'),_0xe431('0xbf')],'required':![]},{'model':db[_0xe431('0xc0')],'as':_0xe431('0xc1'),'attributes':['id','name','color'],'where':_0xce70e['query'][_0xe431('0xc2')]?{'id':_0xce70e[_0xe431('0x43')][_0xe431('0xc2')]}:undefined,'required':_0xce70e['query'][_0xe431('0xc2')]?!![]:![]}];}return db[_0xe431('0x98')]['findAll'](_0x69e606);})[_0xe431('0x1f')](function(_0x2f31d4){_0x2402bb[_0xe431('0x55')]=_0x2f31d4;return _0x2402bb;});}})[_0xe431('0x1f')](respondWithFilteredResult(_0x136d14,_0x69e606))[_0xe431('0x27')](handleError(_0x136d14,null));};exports[_0xe431('0x39')]=function(_0x204c89,_0x323edc,_0xbc2392){var _0x31600b,_0x39653f,_0x21f256;if(_[_0xe431('0x8f')](_0x204c89[_0xe431('0x5c')][_0xe431('0x5c')])||_0x204c89[_0xe431('0x5c')]['body']===''){throw new db[(_0xe431('0x72'))][(_0xe431('0x73'))](_0xe431('0x91'));}if(_[_0xe431('0x8f')](_0x204c89[_0xe431('0x5c')]['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0x31600b=_0x204c89[_0xe431('0x5c')]['to'];return db[_0xe431('0x3d')][_0xe431('0x5a')]({'where':{'id':_0x204c89[_0xe431('0x56')]['id']},'include':[{'model':db[_0xe431('0x95')],'as':_0xe431('0xc3'),'include':[{'model':db[_0xe431('0x71')],'as':_0xe431('0x96'),'where':{'mobile':_0x31600b},'limit':0x1,'order':[[_0xe431('0x76'),_0xe431('0xc4')]]}]}]})[_0xe431('0x1f')](handleEntityNotFound(_0x323edc,null))['then'](function(_0x5d90b){if(_0x5d90b&&_0x5d90b[_0xe431('0xc3')]){_0x39653f=_0x5d90b[_0xe431('0x35')]({'plain':!![]});if(_0x39653f[_0xe431('0xc3')]&&_0x39653f['List'][_0xe431('0x96')][_0xe431('0x49')]){return _0x39653f['List']['Contacts'][0x0];}return db[_0xe431('0x71')][_0xe431('0x57')](_[_0xe431('0x19')](_0x204c89['body'],{'firstName':_0x31600b,'mobile':_0x31600b,'phone':_0x31600b,'ListId':_0x39653f[_0xe431('0x77')]}));}})[_0xe431('0x1f')](handleEntityNotFound(_0x323edc,null))[_0xe431('0x1f')](function(_0xe135d4){if(_0xe135d4){_0x21f256=_0xe135d4;return db['SmsInteraction'][_0xe431('0x5a')]({'where':{'ContactId':_0x21f256['id'],'closed':![],'SmsAccountId':_0x39653f['id']}})[_0xe431('0x1f')](function(_0xd54e68){if(_0xd54e68){return[_0xd54e68,![]];}return db['SmsInteraction'][_0xe431('0x57')]({'UserId':_0x204c89[_0xe431('0x58')]['id'],'ContactId':_0x21f256['id'],'SmsAccountId':_0x39653f['id'],'phone':_0x31600b,'firstMsgDirection':'out','Messages':[_[_0xe431('0x4f')](_0x204c89['body'],{'read':![],'body':_0x204c89[_0xe431('0x5c')][_0xe431('0x5c')],'phone':_0x31600b,'SmsAccountId':_0x39653f['id'],'UserId':_0x204c89[_0xe431('0x58')]['id'],'ContactId':_0x21f256['id']})]},{'include':[{'model':db[_0xe431('0x9e')],'as':_0xe431('0xc5')}]})[_0xe431('0x1f')](function(_0x250ec1){return[_0x250ec1,!![]];});});}})[_0xe431('0x99')](function(_0x37b99b,_0x47735b){if(_0x47735b){return _0x37b99b;}return db[_0xe431('0x9e')][_0xe431('0x57')](_['merge'](_0x204c89['body'],{'read':![],'body':_0x204c89[_0xe431('0x5c')]['body'],'phone':_0x31600b,'SmsAccountId':_0x39653f['id'],'SmsInteractionId':_0x37b99b['id'],'UserId':_0x204c89[_0xe431('0x58')]['id'],'ContactId':_0x21f256['id']}))['then'](function(_0x29ba90){_0x37b99b['dataValues'][_0xe431('0xc5')]=[];_0x37b99b[_0xe431('0xc6')][_0xe431('0xc5')][_0xe431('0xc7')](_0x29ba90['dataValues']);return _0x37b99b;});})[_0xe431('0x1f')](respondWithResult(_0x323edc,null))[_0xe431('0x27')](handleError(_0x323edc,null));};exports[_0xe431('0x28')]=function(_0x33445b,_0x1843c8,_0x24bf36){if(_0x33445b[_0xe431('0x5c')]['id']){delete _0x33445b['body']['id'];}var _0x57ce07,_0x1279d7,_0x33ad06;return db[_0xe431('0x3d')][_0xe431('0x5a')]({'where':{'id':_0x33445b['params']['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x1843c8,null))[_0xe431('0x1f')](function(_0x568c43){if(_0x568c43){_0x33ad06=_0x568c43;logger[_0xe431('0xc8')](_0xe431('0xab'),'status',_0xe431('0xc9'),_0x568c43[_0xe431('0x40')],util[_0xe431('0xca')](_0x33445b[_0xe431('0x5c')],{'showHidden':![],'depth':null}));switch(_0x568c43[_0xe431('0x40')]){case _0xe431('0x7d'):if(_0x33445b[_0xe431('0x5c')]['skebby_dispatch_id']&&_0x33445b[_0xe431('0x5c')]['status']){_0x1279d7=_0x33445b[_0xe431('0x5c')][_0xe431('0x28')];return db['SmsMessage']['find']({'where':{'messageId':_0x33445b[_0xe431('0x5c')][_0xe431('0xcb')]}});}break;case _0xe431('0x81'):if(_0x33445b[_0xe431('0x5c')][_0xe431('0xcc')]&&_0x33445b[_0xe431('0x5c')][_0xe431('0xcd')]){_0x1279d7=_0x33445b['body'][_0xe431('0xcd')];return db['SmsMessage'][_0xe431('0x5a')]({'where':{'messageId':_0x33445b['body'][_0xe431('0xcc')]}});}break;case'clicksend':if(_0x33445b[_0xe431('0x5c')][_0xe431('0x83')]&&_0x33445b['body'][_0xe431('0xce')]){_0x1279d7=_0x33445b[_0xe431('0x5c')][_0xe431('0xce')];return db[_0xe431('0x9e')][_0xe431('0x5a')]({'where':{'messageId':_0x33445b['body'][_0xe431('0x83')]}});}break;case _0xe431('0x87'):var _0x2dc3a1=_0x33445b[_0xe431('0x5c')]['results'][0x0];if(_0x2dc3a1['messageId']&&_0x2dc3a1['status'][_0xe431('0xcf')]===_0xe431('0xd0')){_0x1279d7=_0x2dc3a1['status']['groupName'];return db['SmsMessage'][_0xe431('0x5a')]({'where':{'messageId':_0x2dc3a1[_0xe431('0x7c')]}});}break;case'clickatell':if(_0x33445b[_0xe431('0x5c')][_0xe431('0x7c')]&&_0x33445b[_0xe431('0x5c')]['status']){_0x1279d7=_0x33445b[_0xe431('0x5c')][_0xe431('0x28')];return db['SmsMessage']['find']({'where':{'messageId':_0x33445b[_0xe431('0x5c')][_0xe431('0x7c')]}});}break;case _0xe431('0xd1'):if(_0x33445b[_0xe431('0x5c')][0x0]['message']['id']){_0x1279d7=_0x33445b[_0xe431('0x5c')][0x0][_0xe431('0x40')];return db[_0xe431('0x9e')]['find']({'where':{'messageId':_0x33445b[_0xe431('0x5c')][0x0][_0xe431('0x25')]['id']}});}break;case _0xe431('0x8e'):if(_0x33445b[_0xe431('0x5c')][_0xe431('0xd2')]&&_0x33445b[_0xe431('0x5c')][_0xe431('0x28')]){_0x1279d7=_0x33445b['body'][_0xe431('0x28')];return db['SmsMessage'][_0xe431('0x5a')]({'where':{'messageId':_0x33445b[_0xe431('0x5c')][_0xe431('0xd2')]}});}break;}}})[_0xe431('0x1f')](handleEntityNotFound(_0x1843c8,null))['then'](function(_0x3c15c3){if(_0x3c15c3){_0x57ce07=_0x3c15c3;switch(_0x33ad06[_0xe431('0x40')]){case _0xe431('0x7d'):if(_0x1279d7==='DELIVERED'){return _0x57ce07[_0xe431('0x33')]({'read':!![]});}else{logger['error'](_0xe431('0xab'),_0xe431('0x28'),'skebby',util[_0xe431('0xca')](_0x33445b[_0xe431('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xe431('0x81'):if(_0x1279d7==='1'){return _0x57ce07[_0xe431('0x33')]({'read':!![]});}else{logger[_0xe431('0x23')](_0xe431('0xab'),_0xe431('0x28'),'skebby',util[_0xe431('0xca')](_0x33445b[_0xe431('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xe431('0x82'):if(!_0x33445b[_0xe431('0x5c')][_0xe431('0xd3')]&&_0x1279d7>=0xc8&&_0x1279d7<=0xce){return _0x57ce07[_0xe431('0x33')]({'read':!![]});}else{logger[_0xe431('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe431('0x28'),'clicksend',util[_0xe431('0xca')](_0x33445b[_0xe431('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xe431('0x87'):var _0x2f01d3=_0x33445b[_0xe431('0x5c')][_0xe431('0x88')][0x0];if(_0x2f01d3[_0xe431('0x28')]['groupName']==='DELIVERED'){return _0x57ce07[_0xe431('0x33')]({'read':!![]});}else{logger[_0xe431('0x23')](_0xe431('0xab'),_0xe431('0x28'),_0xe431('0x87'),util[_0xe431('0xca')](_0x33445b[_0xe431('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xe431('0x8b'):if(_0x1279d7=='DELIVERED_TO_GATEWAY'||_0x1279d7=='RECEIVED_BY_RECIPIENT'){return _0x57ce07[_0xe431('0x33')]({'read':!![]});}else{logger[_0xe431('0x23')](_0xe431('0xab'),_0xe431('0x28'),'clickatell',util[_0xe431('0xca')](_0x33445b[_0xe431('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xe431('0xd1'):if(_0x1279d7=='message-delivered'){return _0x57ce07['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe431('0xd1'),util[_0xe431('0xca')](_0x33445b[_0xe431('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xe431('0x8e'):if(_0x1279d7===_0xe431('0xd4')||_0x1279d7===_0xe431('0xd5')){return _0x57ce07[_0xe431('0x33')]({'read':!![]});}else{logger[_0xe431('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe431('0x28'),'intelepeer',util[_0xe431('0xca')](_0x33445b[_0xe431('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x57ce07;}})[_0xe431('0x1f')](respondWithResult(_0x1843c8,null))[_0xe431('0x27')](handleError(_0x1843c8,null));};exports[_0xe431('0xd6')]=function(_0x3e71ff,_0x4cb95b,_0x507f72){var _0x242bcd,_0x15c4a8,_0x211829;return db[_0xe431('0x3d')][_0xe431('0x5a')]({'where':{'id':_0x3e71ff[_0xe431('0x56')]['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x4cb95b,null))['then'](function(_0x457c3){if(_0x457c3){_0x211829=_0x457c3;logger[_0xe431('0xc8')](_0xe431('0xab'),_0xe431('0x28'),_0xe431('0xc9'),_0x457c3[_0xe431('0x40')],util['inspect'](_0x3e71ff[_0xe431('0x43')],{'showHidden':![],'depth':null}));switch(_0x457c3['type']){case _0xe431('0x89'):if(_0x3e71ff[_0xe431('0x43')]['message-id']&&_0x3e71ff[_0xe431('0x43')]['state']){_0x15c4a8=_0x3e71ff[_0xe431('0x43')][_0xe431('0xd7')];return db['SmsMessage'][_0xe431('0x5a')]({'where':{'messageId':_0x3e71ff[_0xe431('0x43')][_0xe431('0xd8')]}});}break;}}})[_0xe431('0x1f')](handleEntityNotFound(_0x4cb95b,null))[_0xe431('0x1f')](function(_0x31bfa9){if(_0x31bfa9){_0x242bcd=_0x31bfa9;switch(_0x211829[_0xe431('0x40')]){case'csc':if(_0x15c4a8==='2'||_0x15c4a8==='6'){return _0x242bcd[_0xe431('0x33')]({'read':!![]});}else{logger['error'](_0xe431('0xab'),_0xe431('0x28'),_0xe431('0x89'),util[_0xe431('0xca')](_0x3e71ff[_0xe431('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x242bcd;}})['then'](respondWithResult(_0x4cb95b,null))[_0xe431('0x27')](handleError(_0x4cb95b,null));};exports[_0xe431('0xd9')]=function(_0x408b9f,_0x32ddc0,_0x2afc2f){return db['SmsAccount'][_0xe431('0x5a')]({'where':{'id':_0x408b9f[_0xe431('0x56')]['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x32ddc0,null))['then'](function(_0x247307){if(_0x247307){return _0x247307[_0xe431('0xd9')](_0x408b9f[_0xe431('0x5c')][_0xe431('0x69')],_['omit'](_0x408b9f[_0xe431('0x5c')],[_0xe431('0x69'),'id'])||{})[_0xe431('0x99')](function(_0x25b9d5){for(var _0xbb0ce9=0x0;_0xbb0ce9<_0x408b9f[_0xe431('0x5c')][_0xe431('0x69')][_0xe431('0x49')];_0xbb0ce9+=0x1){socket[_0xe431('0xda')](_0xe431('0xdb'),{'UserId':Number(_0x408b9f[_0xe431('0x5c')]['ids'][_0xbb0ce9]),'SmsAccountId':Number(_0x408b9f[_0xe431('0x56')]['id'])});}return _0x25b9d5;});}})[_0xe431('0x1f')](respondWithResult(_0x32ddc0,null))[_0xe431('0x27')](handleError(_0x32ddc0,null));};exports[_0xe431('0xdc')]=function(_0x1d1ef0,_0x5396bf,_0x50a23c){return db[_0xe431('0x3d')]['find']({'where':{'id':_0x1d1ef0[_0xe431('0x56')]['id']}})['then'](handleEntityNotFound(_0x5396bf,null))[_0xe431('0x1f')](function(_0x1b0ff8){if(_0x1b0ff8){return _0x1b0ff8[_0xe431('0xdc')](_0x1d1ef0[_0xe431('0x43')][_0xe431('0x69')])['then'](function(){if(_[_0xe431('0xdd')](_0x1d1ef0[_0xe431('0x43')][_0xe431('0x69')])){for(var _0x473a00=0x0;_0x473a00<_0x1d1ef0['query'][_0xe431('0x69')][_0xe431('0x49')];_0x473a00+=0x1){socket[_0xe431('0xda')](_0xe431('0xde'),{'UserId':Number(_0x1d1ef0[_0xe431('0x43')][_0xe431('0x69')][_0x473a00]),'SmsAccountId':Number(_0x1d1ef0['params']['id'])});}}else{socket[_0xe431('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x1d1ef0[_0xe431('0x43')][_0xe431('0x69')]),'SmsAccountId':Number(_0x1d1ef0[_0xe431('0x56')]['id'])});}});}})[_0xe431('0x1f')](respondWithStatusCode(_0x5396bf,null))[_0xe431('0x27')](handleError(_0x5396bf,null));};exports[_0xe431('0xdf')]=function(_0x3b18d3,_0x343761,_0x229683){var _0x1274d7={};var _0x51c225={};var _0x285cff;var _0x4247ec;return db[_0xe431('0x3d')][_0xe431('0x67')]({'where':{'id':_0x3b18d3['params']['id']}})[_0xe431('0x1f')](handleEntityNotFound(_0x343761,null))['then'](function(_0x47ee99){if(_0x47ee99){_0x285cff=_0x47ee99;_0x51c225[_0xe431('0x42')]=_[_0xe431('0x44')](db[_0xe431('0xa2')][_0xe431('0x3e')]);_0x51c225[_0xe431('0x43')]=_[_0xe431('0x44')](_0x3b18d3[_0xe431('0x43')]);_0x51c225[_0xe431('0x45')]=_[_0xe431('0x46')](_0x51c225[_0xe431('0x42')],_0x51c225[_0xe431('0x43')]);_0x1274d7[_0xe431('0x47')]=_[_0xe431('0x46')](_0x51c225[_0xe431('0x42')],qs[_0xe431('0x48')](_0x3b18d3[_0xe431('0x43')][_0xe431('0x48')]));_0x1274d7[_0xe431('0x47')]=_0x1274d7[_0xe431('0x47')][_0xe431('0x49')]?_0x1274d7[_0xe431('0x47')]:_0x51c225[_0xe431('0x42')];_0x1274d7['order']=qs[_0xe431('0x62')](_0x3b18d3[_0xe431('0x43')][_0xe431('0x62')]);_0x1274d7[_0xe431('0x4d')]=qs[_0xe431('0x45')](_[_0xe431('0x4e')](_0x3b18d3['query'],_0x51c225[_0xe431('0x45')]));if(_0x3b18d3[_0xe431('0x43')][_0xe431('0x51')]){_0x1274d7['where']=_['merge'](_0x1274d7['where'],{'$or':_[_0xe431('0x3c')](_0x1274d7['attributes'],function(_0x3b8b0a){var _0x48101f={};_0x48101f[_0x3b8b0a]={'$like':'%'+_0x3b18d3['query'][_0xe431('0x51')]+'%'};return _0x48101f;})});}_0x1274d7=_['merge']({},_0x1274d7,_0x3b18d3[_0xe431('0x52')]);return _0x285cff['getAgents'](_0x1274d7);}})[_0xe431('0x1f')](function(_0x4849c5){if(_0x4849c5){_0x4247ec=_0x4849c5[_0xe431('0x49')];if(!_0x3b18d3[_0xe431('0x43')]['hasOwnProperty'](_0xe431('0x4b'))){_0x1274d7[_0xe431('0x2c')]=qs[_0xe431('0x2c')](_0x3b18d3['query'][_0xe431('0x2c')]);_0x1274d7[_0xe431('0x2a')]=qs[_0xe431('0x2a')](_0x3b18d3[_0xe431('0x43')][_0xe431('0x2a')]);}return _0x285cff[_0xe431('0xdf')](_0x1274d7);}})[_0xe431('0x1f')](function(_0x352d12){if(_0x352d12){return _0x352d12?{'count':_0x4247ec,'rows':_0x352d12}:null;}})[_0xe431('0x1f')](respondWithResult(_0x343761,null))[_0xe431('0x27')](handleError(_0x343761,null));}; \ No newline at end of file +var _0xf969=['Tag','Tags','color','tag','List','user','out','Messages','dataValues','push','inspect','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','redif','infobip','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','info','catch','status','end','offset','undefined','limit','count','json','apply','update','destroy','UserProfileResource','sendStatus','name','send','index','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','Pause','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','describe','addDisposition','SmsAccountId','Disposition','findOne','includeAll','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','From','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','autoclose','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','SmsQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','getApplications','getInteractions','Contact','fullname'];(function(_0x4de4d5,_0x273848){var _0xe3db20=function(_0x5423f5){while(--_0x5423f5){_0x4de4d5['push'](_0x4de4d5['shift']());}};_0xe3db20(++_0x273848);}(_0xf969,0x1eb));var _0x9f96=function(_0x3588d0,_0x50cbb8){_0x3588d0=_0x3588d0-0x0;var _0xc3897f=_0xf969[_0x3588d0];return _0xc3897f;};'use strict';var emlformat=require(_0x9f96('0x0'));var rimraf=require(_0x9f96('0x1'));var zipdir=require(_0x9f96('0x2'));var jsonpatch=require(_0x9f96('0x3'));var rp=require(_0x9f96('0x4'));var moment=require(_0x9f96('0x5'));var BPromise=require(_0x9f96('0x6'));var Mustache=require('mustache');var util=require(_0x9f96('0x7'));var path=require(_0x9f96('0x8'));var sox=require(_0x9f96('0x9'));var csv=require(_0x9f96('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f96('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9f96('0xc'));var deskjs=require(_0x9f96('0xd'));var toCsv=require(_0x9f96('0xa'));var querystring=require('querystring');var Papa=require(_0x9f96('0xe'));var Redis=require(_0x9f96('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9f96('0x10'));var as=require(_0x9f96('0x11'));var hardwareService=require(_0x9f96('0x12'));var logger=require('../../config/logger')(_0x9f96('0x13'));var utils=require(_0x9f96('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9f96('0x15'));var db=require(_0x9f96('0x16'))['db'];config[_0x9f96('0x17')]=_['defaults'](config[_0x9f96('0x17')],{'host':_0x9f96('0x18'),'port':0x18eb});var socket=require(_0x9f96('0x19'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x9f96('0x1a')](socket);var jayson=require(_0x9f96('0x1b'));var client=jayson[_0x9f96('0x1c')][_0x9f96('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x8621aa,_0x2a0695,_0x3bd690,_0x57b494){return new BPromise(function(_0x1b15f3,_0x550016){var _0x185206=_0x57b494||client;return _0x185206[_0x9f96('0x1e')](_0x8621aa,_0x3bd690)[_0x9f96('0x1f')](function(_0x4cc22e){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2a0695,_0x9f96('0x20'));logger['debug'](_0x9f96('0x21'),_0x2a0695,_0x9f96('0x20'),JSON[_0x9f96('0x22')](_0x4cc22e));if(_0x4cc22e[_0x9f96('0x23')]){if(_0x4cc22e[_0x9f96('0x23')]['code']===0x1f4){logger['error'](_0x9f96('0x24'),_0x2a0695,_0x4cc22e['error'][_0x9f96('0x25')]);return _0x550016(_0x4cc22e[_0x9f96('0x23')][_0x9f96('0x25')]);}logger[_0x9f96('0x23')](_0x9f96('0x24'),_0x2a0695,_0x4cc22e[_0x9f96('0x23')][_0x9f96('0x25')]);return _0x1b15f3(_0x4cc22e[_0x9f96('0x23')][_0x9f96('0x25')]);}else{logger[_0x9f96('0x26')](_0x9f96('0x24'),_0x2a0695,_0x9f96('0x20'));_0x1b15f3(_0x4cc22e['result'][_0x9f96('0x25')]);}})[_0x9f96('0x27')](function(_0x5a1e38){logger[_0x9f96('0x23')](_0x9f96('0x24'),_0x2a0695,_0x5a1e38);_0x550016(_0x5a1e38);});});}function respondWithStatusCode(_0x2e7dac,_0x171eb7){_0x171eb7=_0x171eb7||0xcc;return function(_0xd6753c){if(_0xd6753c){return _0x2e7dac['sendStatus'](_0x171eb7);}return _0x2e7dac[_0x9f96('0x28')](_0x171eb7)[_0x9f96('0x29')]();};}function respondWithResult(_0xfe8cae,_0x3bc12b){_0x3bc12b=_0x3bc12b||0xc8;return function(_0x23d5d4){if(_0x23d5d4){return _0xfe8cae[_0x9f96('0x28')](_0x3bc12b)['json'](_0x23d5d4);}};}function respondWithFilteredResult(_0x45ea7d,_0x5e3d4b){return function(_0xd677de){if(_0xd677de){var _0x597733=typeof _0x5e3d4b[_0x9f96('0x2a')]===_0x9f96('0x2b')&&typeof _0x5e3d4b[_0x9f96('0x2c')]===_0x9f96('0x2b');var _0x1df39b=_0xd677de[_0x9f96('0x2d')];var _0x5e153a=_0x597733?0x0:_0x5e3d4b[_0x9f96('0x2a')];var _0x2c1509=_0x597733?_0xd677de[_0x9f96('0x2d')]:_0x5e3d4b[_0x9f96('0x2a')]+_0x5e3d4b[_0x9f96('0x2c')];var _0x18a272;if(_0x2c1509>=_0x1df39b){_0x2c1509=_0x1df39b;_0x18a272=0xc8;}else{_0x18a272=0xce;}_0x45ea7d['status'](_0x18a272);return _0x45ea7d['set']('Content-Range',_0x5e153a+'-'+_0x2c1509+'/'+_0x1df39b)[_0x9f96('0x2e')](_0xd677de);}return null;};}function patchUpdates(_0x40b196){return function(_0x263bf7){try{jsonpatch[_0x9f96('0x2f')](_0x263bf7,_0x40b196,!![]);}catch(_0x51b194){return BPromise['reject'](_0x51b194);}return _0x263bf7['save']();};}function saveUpdates(_0x5c5085,_0x33168f){return function(_0x34981a){if(_0x34981a){return _0x34981a[_0x9f96('0x30')](_0x5c5085)[_0x9f96('0x1f')](function(_0x1d62ef){return _0x1d62ef;});}return null;};}function removeEntity(_0x3df00a,_0x17350f){return function(_0x16b6e4){if(_0x16b6e4){return _0x16b6e4[_0x9f96('0x31')]()[_0x9f96('0x1f')](function(){var _0x495ff7=_0x16b6e4['get']({'plain':!![]});var _0x5356bc='SmsAccounts';return db[_0x9f96('0x32')][_0x9f96('0x31')]({'where':{'type':_0x5356bc,'resourceId':_0x495ff7['id']}})[_0x9f96('0x1f')](function(){return _0x16b6e4;});})[_0x9f96('0x1f')](function(){_0x3df00a[_0x9f96('0x28')](0xcc)[_0x9f96('0x29')]();});}};}function handleEntityNotFound(_0x593271,_0x220810){return function(_0x486fa8){if(!_0x486fa8){_0x593271[_0x9f96('0x33')](0x194);}return _0x486fa8;};}function handleError(_0x117914,_0x4d05e0){_0x4d05e0=_0x4d05e0||0x1f4;return function(_0x3e683b){logger[_0x9f96('0x23')](_0x3e683b['stack']);if(_0x3e683b[_0x9f96('0x34')]){delete _0x3e683b[_0x9f96('0x34')];}_0x117914[_0x9f96('0x28')](_0x4d05e0)[_0x9f96('0x35')](_0x3e683b);};}exports[_0x9f96('0x36')]=function(_0x2fc1be,_0x5672c0){var _0x48953b={'include':[{'model':db['Pause'],'as':_0x9f96('0x37')}]},_0x729e33={},_0x4e9d97={'count':0x0,'rows':[]};var _0x5d47af=_['map'](db[_0x9f96('0x38')][_0x9f96('0x39')],function(_0x40f97b){return{'name':_0x40f97b[_0x9f96('0x3a')],'type':_0x40f97b[_0x9f96('0x3b')][_0x9f96('0x3c')]};});_0x729e33[_0x9f96('0x3d')]=_[_0x9f96('0x3e')](_0x5d47af,'name');_0x729e33[_0x9f96('0x3f')]=_[_0x9f96('0x40')](_0x2fc1be[_0x9f96('0x3f')]);_0x729e33[_0x9f96('0x41')]=_[_0x9f96('0x42')](_0x729e33['model'],_0x729e33[_0x9f96('0x3f')]);_0x48953b[_0x9f96('0x43')]=_[_0x9f96('0x42')](_0x729e33[_0x9f96('0x3d')],qs[_0x9f96('0x44')](_0x2fc1be[_0x9f96('0x3f')][_0x9f96('0x44')]));_0x48953b[_0x9f96('0x43')]=_0x48953b[_0x9f96('0x43')][_0x9f96('0x45')]?_0x48953b[_0x9f96('0x43')]:_0x729e33[_0x9f96('0x3d')];if(!_0x2fc1be[_0x9f96('0x3f')][_0x9f96('0x46')](_0x9f96('0x47'))){_0x48953b[_0x9f96('0x2c')]=qs[_0x9f96('0x2c')](_0x2fc1be[_0x9f96('0x3f')][_0x9f96('0x2c')]);_0x48953b[_0x9f96('0x2a')]=qs[_0x9f96('0x2a')](_0x2fc1be[_0x9f96('0x3f')][_0x9f96('0x2a')]);}_0x48953b[_0x9f96('0x48')]=qs[_0x9f96('0x49')](_0x2fc1be['query'][_0x9f96('0x49')]);_0x48953b['where']=qs['filters'](_[_0x9f96('0x4a')](_0x2fc1be[_0x9f96('0x3f')],_0x729e33[_0x9f96('0x41')]),_0x5d47af);if(_0x2fc1be[_0x9f96('0x3f')][_0x9f96('0x4b')]){_0x48953b[_0x9f96('0x4c')]=_[_0x9f96('0x4d')](_0x48953b[_0x9f96('0x4c')],{'$or':_[_0x9f96('0x3e')](_0x5d47af,function(_0x16cd16){if(_0x16cd16[_0x9f96('0x3b')]!==_0x9f96('0x4e')){var _0x2f9daa={};_0x2f9daa[_0x16cd16['name']]={'$like':'%'+_0x2fc1be['query']['filter']+'%'};return _0x2f9daa;}})});}_0x48953b=_['merge']({},_0x48953b,_0x2fc1be[_0x9f96('0x4f')]);var _0x4b8715={'where':_0x48953b['where']};return db[_0x9f96('0x38')]['count'](_0x4b8715)[_0x9f96('0x1f')](function(_0x4d7a08){_0x4e9d97[_0x9f96('0x2d')]=_0x4d7a08;if(_0x2fc1be[_0x9f96('0x3f')]['includeAll']){_0x48953b[_0x9f96('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0x9f96('0x51')](_0x48953b);})['then'](function(_0x43dc03){_0x4e9d97[_0x9f96('0x52')]=_0x43dc03;return _0x4e9d97;})[_0x9f96('0x1f')](respondWithFilteredResult(_0x5672c0,_0x48953b))[_0x9f96('0x27')](handleError(_0x5672c0,null));};exports['show']=function(_0x669286,_0x2c6e68){var _0x29878e={'raw':![],'where':{'id':_0x669286['params']['id']},'include':[{'model':db[_0x9f96('0x53')],'as':_0x9f96('0x37')}]},_0x3e70d5={};_0x3e70d5[_0x9f96('0x3d')]=_[_0x9f96('0x40')](db[_0x9f96('0x38')][_0x9f96('0x39')]);_0x3e70d5[_0x9f96('0x3f')]=_[_0x9f96('0x40')](_0x669286[_0x9f96('0x3f')]);_0x3e70d5[_0x9f96('0x41')]=_[_0x9f96('0x42')](_0x3e70d5['model'],_0x3e70d5[_0x9f96('0x3f')]);_0x29878e['attributes']=_[_0x9f96('0x42')](_0x3e70d5[_0x9f96('0x3d')],qs['fields'](_0x669286[_0x9f96('0x3f')][_0x9f96('0x44')]));_0x29878e[_0x9f96('0x43')]=_0x29878e[_0x9f96('0x43')]['length']?_0x29878e[_0x9f96('0x43')]:_0x3e70d5[_0x9f96('0x3d')];if(_0x669286[_0x9f96('0x3f')]['includeAll']){_0x29878e[_0x9f96('0x50')]=[{'all':!![]}];}_0x29878e=_[_0x9f96('0x4d')]({},_0x29878e,_0x669286['options']);return db[_0x9f96('0x38')]['find'](_0x29878e)[_0x9f96('0x1f')](handleEntityNotFound(_0x2c6e68,null))['then'](respondWithResult(_0x2c6e68,null))[_0x9f96('0x27')](handleError(_0x2c6e68,null));};exports[_0x9f96('0x54')]=function(_0x109b85,_0x4e8eda){return db[_0x9f96('0x38')]['create'](_0x109b85['body'],{})[_0x9f96('0x1f')](function(_0x3d6cdd){var _0x261d72=_0x109b85['user']['get']({'plain':!![]});if(!_0x261d72)throw new Error(_0x9f96('0x55'));if(_0x261d72[_0x9f96('0x56')]==='user'){var _0x403cf3=_0x3d6cdd[_0x9f96('0x57')]({'plain':!![]});var _0x23298b=_0x9f96('0x58');return db[_0x9f96('0x59')]['find']({'where':{'name':_0x23298b,'userProfileId':_0x261d72['userProfileId']},'raw':!![]})['then'](function(_0x2b3b3e){if(_0x2b3b3e&&_0x2b3b3e[_0x9f96('0x5a')]===0x0){return db[_0x9f96('0x32')][_0x9f96('0x54')]({'name':_0x403cf3[_0x9f96('0x34')],'resourceId':_0x403cf3['id'],'type':_0x2b3b3e['name'],'sectionId':_0x2b3b3e['id']},{})[_0x9f96('0x1f')](function(){return _0x3d6cdd;});}else{return _0x3d6cdd;}})[_0x9f96('0x27')](function(_0x5584ef){logger[_0x9f96('0x23')](_0x9f96('0x5b'),_0x5584ef);throw _0x5584ef;});}return _0x3d6cdd;})['then'](respondWithResult(_0x4e8eda,0xc9))[_0x9f96('0x27')](handleError(_0x4e8eda,null));};exports[_0x9f96('0x30')]=function(_0x2e79a4,_0x5592af){if(_0x2e79a4[_0x9f96('0x5c')]['id']){delete _0x2e79a4[_0x9f96('0x5c')]['id'];}return db['SmsAccount'][_0x9f96('0x5d')]({'where':{'id':_0x2e79a4[_0x9f96('0x5e')]['id']},'include':[{'model':db[_0x9f96('0x53')],'as':_0x9f96('0x37')}]})[_0x9f96('0x1f')](handleEntityNotFound(_0x5592af,null))[_0x9f96('0x1f')](saveUpdates(_0x2e79a4['body'],null))['then'](respondWithResult(_0x5592af,null))[_0x9f96('0x27')](handleError(_0x5592af,null));};exports[_0x9f96('0x31')]=function(_0x439ac7,_0x1df2d4){return db[_0x9f96('0x38')][_0x9f96('0x5d')]({'where':{'id':_0x439ac7[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x1df2d4,null))[_0x9f96('0x1f')](removeEntity(_0x1df2d4,null))[_0x9f96('0x27')](handleError(_0x1df2d4,null));};exports['describe']=function(_0x5e0dd8,_0x29aed2){return db[_0x9f96('0x38')][_0x9f96('0x5f')]()[_0x9f96('0x1f')](respondWithResult(_0x29aed2,null))[_0x9f96('0x27')](handleError(_0x29aed2,null));};exports[_0x9f96('0x60')]=function(_0x293b24,_0x4c4ba5,_0x209e9a){if(_0x293b24['body']['id']){delete _0x293b24[_0x9f96('0x5c')]['id'];}return db['SmsAccount'][_0x9f96('0x5d')]({'where':{'id':_0x293b24[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x4c4ba5,null))[_0x9f96('0x1f')](function(_0x4636ee){if(_0x4636ee){_0x293b24[_0x9f96('0x5c')][_0x9f96('0x61')]=_0x4636ee['id'];return db[_0x9f96('0x62')][_0x9f96('0x54')](_0x293b24[_0x9f96('0x5c')]);}})[_0x9f96('0x1f')](respondWithResult(_0x4c4ba5,null))[_0x9f96('0x27')](handleError(_0x4c4ba5,null));};exports['getDispositions']=function(_0x3f0974,_0x325fc7,_0x6e3a87){var _0x5da913={'raw':![],'where':{}};var _0x4f7d2f={};var _0x469517={'count':0x0,'rows':[]};return db[_0x9f96('0x38')][_0x9f96('0x63')]({'where':{'id':_0x3f0974[_0x9f96('0x5e')]['id']}})['then'](handleEntityNotFound(_0x325fc7,null))[_0x9f96('0x1f')](function(_0x21b3bd){if(_0x21b3bd){_0x4f7d2f[_0x9f96('0x3d')]=_[_0x9f96('0x40')](db[_0x9f96('0x62')][_0x9f96('0x39')]);_0x4f7d2f[_0x9f96('0x3f')]=_[_0x9f96('0x40')](_0x3f0974['query']);_0x4f7d2f[_0x9f96('0x41')]=_['intersection'](_0x4f7d2f[_0x9f96('0x3d')],_0x4f7d2f[_0x9f96('0x3f')]);_0x5da913[_0x9f96('0x43')]=_[_0x9f96('0x42')](_0x4f7d2f[_0x9f96('0x3d')],qs['fields'](_0x3f0974[_0x9f96('0x3f')]['fields']));_0x5da913['attributes']=_0x5da913[_0x9f96('0x43')]['length']?_0x5da913[_0x9f96('0x43')]:_0x4f7d2f[_0x9f96('0x3d')];if(!_0x3f0974[_0x9f96('0x3f')][_0x9f96('0x46')](_0x9f96('0x47'))){_0x5da913[_0x9f96('0x2c')]=qs['limit'](_0x3f0974[_0x9f96('0x3f')]['limit']);_0x5da913[_0x9f96('0x2a')]=qs['offset'](_0x3f0974['query'][_0x9f96('0x2a')]);}_0x5da913[_0x9f96('0x48')]=qs['sort'](_0x3f0974[_0x9f96('0x3f')][_0x9f96('0x49')]);_0x5da913[_0x9f96('0x4c')]=qs[_0x9f96('0x41')](_[_0x9f96('0x4a')](_0x3f0974[_0x9f96('0x3f')],_0x4f7d2f[_0x9f96('0x41')]));_0x5da913[_0x9f96('0x4c')]['SmsAccountId']=_0x21b3bd['id'];if(_0x3f0974[_0x9f96('0x3f')][_0x9f96('0x4b')]){_0x5da913['where']=_[_0x9f96('0x4d')](_0x5da913['where'],{'$or':_['map'](_0x5da913[_0x9f96('0x43')],function(_0x227e6e){var _0x2fcc29={};_0x2fcc29[_0x227e6e]={'$like':'%'+_0x3f0974['query'][_0x9f96('0x4b')]+'%'};return _0x2fcc29;})});}_0x5da913=_[_0x9f96('0x4d')]({},_0x5da913,_0x3f0974[_0x9f96('0x4f')]);return db[_0x9f96('0x62')][_0x9f96('0x2d')]({'where':_0x5da913[_0x9f96('0x4c')]})[_0x9f96('0x1f')](function(_0x4609c4){_0x469517[_0x9f96('0x2d')]=_0x4609c4;if(_0x3f0974['query'][_0x9f96('0x64')]){_0x5da913['include']=[{'all':!![]}];}return db[_0x9f96('0x62')][_0x9f96('0x51')](_0x5da913);})['then'](function(_0x5079e6){_0x469517[_0x9f96('0x52')]=_0x5079e6;return _0x469517;});}})[_0x9f96('0x1f')](respondWithFilteredResult(_0x325fc7,_0x5da913))[_0x9f96('0x27')](handleError(_0x325fc7,null));};exports['removeDispositions']=function(_0x7cbd19,_0x31b2ba,_0x665a37){return db[_0x9f96('0x38')]['find']({'where':{'id':_0x7cbd19[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x31b2ba,null))['then'](function(_0x2b00ab){if(_0x2b00ab){return _0x2b00ab['removeDispositions'](_0x7cbd19[_0x9f96('0x3f')][_0x9f96('0x65')]);}})[_0x9f96('0x1f')](respondWithStatusCode(_0x31b2ba,null))[_0x9f96('0x27')](handleError(_0x31b2ba,null));};exports[_0x9f96('0x66')]=function(_0x3061f0,_0x13b65e,_0x280e42){if(_0x3061f0[_0x9f96('0x5c')]['id']){delete _0x3061f0[_0x9f96('0x5c')]['id'];}return db['SmsAccount'][_0x9f96('0x5d')]({'where':{'id':_0x3061f0['params']['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x13b65e,null))['then'](function(_0x14034f){if(_0x14034f){_0x3061f0['body'][_0x9f96('0x61')]=_0x14034f['id'];return db['CannedAnswer']['create'](_0x3061f0[_0x9f96('0x5c')]);}})[_0x9f96('0x1f')](respondWithResult(_0x13b65e,null))[_0x9f96('0x27')](handleError(_0x13b65e,null));};exports[_0x9f96('0x67')]=function(_0x3e5053,_0x594c42,_0x2fc531){var _0x286713={'raw':![],'where':{}};var _0x283421={};var _0xe65528={'count':0x0,'rows':[]};return db[_0x9f96('0x38')][_0x9f96('0x63')]({'where':{'id':_0x3e5053[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x594c42,null))[_0x9f96('0x1f')](function(_0x2c0a1a){if(_0x2c0a1a){_0x283421['model']=_[_0x9f96('0x40')](db[_0x9f96('0x68')][_0x9f96('0x39')]);_0x283421[_0x9f96('0x3f')]=_['keys'](_0x3e5053[_0x9f96('0x3f')]);_0x283421[_0x9f96('0x41')]=_[_0x9f96('0x42')](_0x283421[_0x9f96('0x3d')],_0x283421[_0x9f96('0x3f')]);_0x286713['attributes']=_[_0x9f96('0x42')](_0x283421['model'],qs[_0x9f96('0x44')](_0x3e5053[_0x9f96('0x3f')]['fields']));_0x286713[_0x9f96('0x43')]=_0x286713['attributes'][_0x9f96('0x45')]?_0x286713['attributes']:_0x283421[_0x9f96('0x3d')];if(!_0x3e5053[_0x9f96('0x3f')][_0x9f96('0x46')](_0x9f96('0x47'))){_0x286713['limit']=qs[_0x9f96('0x2c')](_0x3e5053['query'][_0x9f96('0x2c')]);_0x286713[_0x9f96('0x2a')]=qs[_0x9f96('0x2a')](_0x3e5053['query'][_0x9f96('0x2a')]);}_0x286713['order']=qs['sort'](_0x3e5053[_0x9f96('0x3f')][_0x9f96('0x49')]);_0x286713[_0x9f96('0x4c')]=qs['filters'](_[_0x9f96('0x4a')](_0x3e5053[_0x9f96('0x3f')],_0x283421[_0x9f96('0x41')]));_0x286713[_0x9f96('0x4c')]['SmsAccountId']=_0x2c0a1a['id'];if(_0x3e5053['query']['filter']){_0x286713[_0x9f96('0x4c')]=_[_0x9f96('0x4d')](_0x286713[_0x9f96('0x4c')],{'$or':_[_0x9f96('0x3e')](_0x286713['attributes'],function(_0x589a00){var _0x4df581={};_0x4df581[_0x589a00]={'$like':'%'+_0x3e5053[_0x9f96('0x3f')][_0x9f96('0x4b')]+'%'};return _0x4df581;})});}_0x286713=_[_0x9f96('0x4d')]({},_0x286713,_0x3e5053['options']);return db[_0x9f96('0x68')]['count']({'where':_0x286713[_0x9f96('0x4c')]})['then'](function(_0x31eb08){_0xe65528[_0x9f96('0x2d')]=_0x31eb08;if(_0x3e5053[_0x9f96('0x3f')][_0x9f96('0x64')]){_0x286713[_0x9f96('0x50')]=[{'all':!![]}];}return db[_0x9f96('0x68')][_0x9f96('0x51')](_0x286713);})[_0x9f96('0x1f')](function(_0x3d46f0){_0xe65528[_0x9f96('0x52')]=_0x3d46f0;return _0xe65528;});}})[_0x9f96('0x1f')](respondWithFilteredResult(_0x594c42,_0x286713))[_0x9f96('0x27')](handleError(_0x594c42,null));};exports['removeAnswers']=function(_0x25d705,_0x1a3667,_0x24358a){return db['SmsAccount'][_0x9f96('0x5d')]({'where':{'id':_0x25d705[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x1a3667,null))[_0x9f96('0x1f')](function(_0x538d7b){if(_0x538d7b){return _0x538d7b[_0x9f96('0x69')](_0x25d705[_0x9f96('0x3f')][_0x9f96('0x65')]);}})['then'](respondWithStatusCode(_0x1a3667,null))[_0x9f96('0x27')](handleError(_0x1a3667,null));};exports[_0x9f96('0x6a')]=function(_0x273b82,_0x25f707,_0x204a1e){var _0x57c40c={'channel':'sms'};var _0xfca15f=[];var _0x3b8a82=[];var _0x395519={};return db[_0x9f96('0x38')]['find']({'where':{'id':_0x273b82[_0x9f96('0x5e')]['id']},'include':[{'model':db[_0x9f96('0x6b')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x25f707,null))[_0x9f96('0x1f')](function(_0x1cd1f2){_0x57c40c[_0x9f96('0x6c')]=_0x1cd1f2;_0x57c40c[_0x9f96('0x6d')]=_[_0x9f96('0x6e')](_0x1cd1f2[_0x9f96('0x6f')],[_0x9f96('0x70')],[_0x9f96('0x71')]);if(_0x57c40c[_0x9f96('0x6c')]['Applications']){delete _0x57c40c[_0x9f96('0x6c')][_0x9f96('0x6f')];}return db[_0x9f96('0x72')][_0x9f96('0x5f')]();})[_0x9f96('0x1f')](function(_0x1d5f8a){if(!_0x1d5f8a){throw new db[(_0x9f96('0x73'))][(_0x9f96('0x74'))](_0x9f96('0x75'));}_0xfca15f=_[_0x9f96('0x76')](_[_0x9f96('0x40')](_0x1d5f8a),['createdAt',_0x9f96('0x77')]);_0x3b8a82=_[_0x9f96('0x76')](_[_0x9f96('0x40')](_0x1d5f8a),[_0x9f96('0x78'),_0x9f96('0x77'),_0x9f96('0x79'),_0x9f96('0x7a')]);_0x57c40c[_0x9f96('0x5c')]={'mapKey':_0x9f96('0x7b')};if(_0x57c40c[_0x9f96('0x6c')][_0x9f96('0x3b')]){switch(_0x57c40c[_0x9f96('0x6c')]['type']){case _0x9f96('0x7c'):_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')]=_0x273b82['body']['From'];_0x57c40c['body'][_0x9f96('0x5c')]=_0x273b82['body'][_0x9f96('0x7e')];_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7f')]=_0x273b82['body'][_0x9f96('0x80')];break;case _0x9f96('0x81'):_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')]='+'+_0x273b82[_0x9f96('0x5c')][_0x9f96('0x82')];_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x5c')]=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x83')];break;case _0x9f96('0x84'):_0x57c40c[_0x9f96('0x5c')]['from']=_0x273b82[_0x9f96('0x5c')]['from'];_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x5c')]=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x25')];break;case _0x9f96('0x85'):_0x57c40c[_0x9f96('0x5c')]['from']=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x7d')];_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x5c')]=_0x273b82['body']['body'];_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7f')]=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x86')];break;case _0x9f96('0x87'):_0x57c40c[_0x9f96('0x5c')]['from']=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x88')];_0x57c40c[_0x9f96('0x5c')]['body']=_0x273b82[_0x9f96('0x5c')]['Text'];_0x57c40c[_0x9f96('0x5c')]['messageId']=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x89')];break;case'infobip':_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')]='+'+_0x273b82[_0x9f96('0x5c')][_0x9f96('0x8a')][0x0][_0x9f96('0x7d')];_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x5c')]=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x8a')][0x0][_0x9f96('0x83')];_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7f')]=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x8a')][0x0][_0x9f96('0x7f')];break;case _0x9f96('0x8b'):_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')]=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x8c')];_0x57c40c[_0x9f96('0x5c')]['body']=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x8d')][_0x9f96('0x25')];break;case _0x9f96('0x8e'):_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')]=_0x273b82['body'][_0x9f96('0x8f')];_0x57c40c['body'][_0x9f96('0x5c')]=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x83')];_0x57c40c[_0x9f96('0x5c')]['messageId']=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x90')];break;case _0x9f96('0x91'):_0x57c40c[_0x9f96('0x5c')]['messageId']=_0x273b82[_0x9f96('0x5c')][0x0][_0x9f96('0x25')]['id'];_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')]=_0x273b82[_0x9f96('0x5c')][0x0]['message'][_0x9f96('0x7d')];_0x57c40c['body'][_0x9f96('0x5c')]=_0x273b82[_0x9f96('0x5c')][0x0][_0x9f96('0x25')][_0x9f96('0x83')];break;case _0x9f96('0x92'):_0x57c40c['body']['from']=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x7d')];_0x57c40c[_0x9f96('0x5c')]['body']=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x25')];_0x57c40c[_0x9f96('0x5c')]['messageId']=_0x273b82[_0x9f96('0x5c')][_0x9f96('0x93')];break;}}if(_0x57c40c[_0x9f96('0x5c')]['id']){delete _0x57c40c[_0x9f96('0x5c')]['id'];}if(_[_0x9f96('0x94')](_0x57c40c['body'][_0x9f96('0x7d')])){throw new db['Sequelize'][(_0x9f96('0x74'))](_0x9f96('0x95'));}if(_[_0x9f96('0x94')](_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x5c')])||_0x57c40c[_0x9f96('0x5c')]['body']===''){throw new db[(_0x9f96('0x73'))][(_0x9f96('0x74'))](_0x9f96('0x96'));}if(_[_0x9f96('0x94')](_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x97')])){throw new db[(_0x9f96('0x73'))][(_0x9f96('0x74'))](_0x9f96('0x98')+_0x3b8a82);}if(!_[_0x9f96('0x99')](_0x3b8a82,_0x57c40c[_0x9f96('0x5c')]['mapKey'])){throw new db[(_0x9f96('0x73'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b8a82);}_0x395519[_0x57c40c[_0x9f96('0x5c')]['mapKey']]=_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')];return db[_0x9f96('0x9a')][_0x9f96('0x5d')]({'where':{'id':_0x57c40c[_0x9f96('0x6c')][_0x9f96('0x7a')]},'include':[{'model':db[_0x9f96('0x72')],'as':'Contacts','where':_0x395519,'limit':0x1,'order':[[_0x9f96('0x77'),_0x9f96('0x9b')]]}]});})[_0x9f96('0x1f')](handleEntityNotFound(_0x25f707,null))[_0x9f96('0x1f')](function(_0x122b75){if(_0x122b75){_0x57c40c[_0x9f96('0x9c')]=_[_0x9f96('0x9d')](_0x122b75,[_0x9f96('0x9e')]);if(_0x122b75[_0x9f96('0x9e')][_0x9f96('0x45')]){return _0x122b75['Contacts'][0x0];}var _0x4e031d=_[_0x9f96('0x9f')](_0x57c40c[_0x9f96('0x5c')],{'firstName':_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')],'ListId':_0x122b75['id']});_0x4e031d[_0x57c40c['body']['mapKey']]=_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7d')];return db[_0x9f96('0x72')][_0x9f96('0x54')](_0x4e031d,{'fields':_0xfca15f,'raw':!![]});}})[_0x9f96('0x1f')](handleEntityNotFound(_0x25f707,null))[_0x9f96('0x1f')](function(_0x3ba109){if(_0x3ba109){_0x57c40c[_0x9f96('0xa0')]=_0x3ba109;var _0x1879c8={'ContactId':_0x3ba109['id'],'phone':_0x57c40c[_0x9f96('0x5c')]['from'],'SmsAccountId':_0x273b82[_0x9f96('0x5e')]['id']};var _0x10039b={'ContactId':_0x3ba109['id'],'SmsAccountId':_0x273b82[_0x9f96('0x5e')]['id'],'closed':![]};return db[_0x9f96('0xa1')][_0x9f96('0x5d')]({'where':_0x10039b})[_0x9f96('0x1f')](function(_0x52c37d){if(_0x52c37d){return[_0x52c37d,![]];}return db[_0x9f96('0xa1')]['create'](_0x1879c8)[_0x9f96('0x1f')](function(_0x2a87c2){return[_0x2a87c2,!![]];});});}})[_0x9f96('0xa2')](function(_0x16167b,_0x3fb574){_0x57c40c['interaction']=_0x16167b[_0x9f96('0x57')]({'plain':!![]});_0x57c40c[_0x9f96('0xa3')]['created']=![];if(_0x3fb574){if(_0x57c40c[_0x9f96('0x6c')][_0x9f96('0xa4')]){_0x57c40c[_0x9f96('0x6d')]['push']({'id':0x0,'priority':_0x57c40c['applications'][_0x9f96('0x45')]+0x1,'app':_0x9f96('0xa5'),'appdata':_0x9f96('0xa6'),'interval':_0x9f96('0xa7')});}_0x57c40c['interaction'][_0x9f96('0xa8')]=!![];}return db[_0x9f96('0xa9')][_0x9f96('0x54')]({'phone':_0x57c40c['body'][_0x9f96('0x7d')],'messageId':_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x7f')],'body':_0x57c40c[_0x9f96('0x5c')][_0x9f96('0x5c')],'SmsAccountId':_0x273b82[_0x9f96('0x5e')]['id'],'SmsInteractionId':_0x16167b['id'],'direction':'in','ContactId':_0x16167b[_0x9f96('0xaa')],'AttachmentId':_0x57c40c[_0x9f96('0x5c')][_0x9f96('0xab')]});})[_0x9f96('0x1f')](function(_0x862e93){_0x57c40c[_0x9f96('0x25')]=_0x862e93;if(!_0x57c40c[_0x9f96('0xa3')][_0x9f96('0xac')])return;return db[_0x9f96('0xad')][_0x9f96('0x5d')]({'attributes':['id',_0x9f96('0x34')],'where':{'id':_0x57c40c[_0x9f96('0xa3')][_0x9f96('0xac')]}});})[_0x9f96('0x1f')](function(_0x1303e7){if(_0x1303e7){_0x57c40c[_0x9f96('0x6d')][_0x9f96('0xae')]({'id':0x0,'priority':0x0,'app':_0x9f96('0xaf'),'appdata':_0x1303e7['name']+','+(_0x57c40c['account']['waitForTheAssignedAgent']||0xa),'interval':_0x9f96('0xa7')});}if(!_0x57c40c['interaction']['queueId'])return;return db[_0x9f96('0xb0')]['find']({'attributes':['id','name'],'where':{'id':_0x57c40c[_0x9f96('0xa3')][_0x9f96('0xb1')]}});})[_0x9f96('0x1f')](function(_0x34f4c4){if(_0x34f4c4){_0x57c40c[_0x9f96('0x6d')][_0x9f96('0xae')]({'id':0x0,'priority':0x1,'app':_0x9f96('0xb2'),'appdata':_0x34f4c4[_0x9f96('0x34')]+','+(_0x57c40c[_0x9f96('0x6c')][_0x9f96('0xb3')]||0x12c),'interval':_0x9f96('0xa7')});}return respondWithRpcPromise(_0x9f96('0xb4'),_0x9f96('0xb5'),_0x57c40c);})[_0x9f96('0x1f')](function(_0x3f7d84){if(_0x3f7d84){var _0x2ebf13=0xc8;var _0x7923eb=_0x9f96('0xb6');logger[_0x9f96('0x26')](_0x9f96('0x21'),_0x7923eb,_0x2ebf13,'entity\x20found');logger[_0x9f96('0xb7')](_0x9f96('0xb8'),_0x7923eb,_0x2ebf13,'entity\x20found',JSON['stringify'](_0x3f7d84));if(_0x57c40c[_0x9f96('0x6c')][_0x9f96('0x3b')]===_0x9f96('0x7c')){return _0x25f707[_0x9f96('0x28')](_0x2ebf13)['set']('Content-Type',_0x9f96('0xb9'))['send'](_0x9f96('0xba'));}else{return _0x25f707['status'](_0x2ebf13)[_0x9f96('0x2e')](_0x3f7d84);}}})[_0x9f96('0x27')](handleError(_0x25f707,null));};exports[_0x9f96('0xbb')]=function(_0x5cb8c0,_0x4e931e){var _0x19bd78=_0x5cb8c0['params']['id'];var _0x571f60=_0x5cb8c0[_0x9f96('0x5c')];var _0x94bdf4=0xc8;var _0xdd3fb=null;return db['sequelize'][_0x9f96('0xbc')]({'isolationLevel':db['sequelize'][_0x9f96('0xbd')][_0x9f96('0xbe')][_0x9f96('0xbf')]},function(_0x157d64){return db[_0x9f96('0x38')][_0x9f96('0x63')]({'where':{'id':_0x19bd78},'transaction':_0x157d64})['then'](function(_0x3547e9){if(_0x3547e9){return db['SmsApplication'][_0x9f96('0x31')]({'where':{'SmsAccountId':_0x19bd78},'transaction':_0x157d64})[_0x9f96('0x1f')](function(){var _0x1d8d6f=_['map'](_0x571f60,function(_0x2a8bf0){_0x2a8bf0[_0x9f96('0x61')]=_0x19bd78;return _0x2a8bf0;});return db[_0x9f96('0x6b')]['bulkCreate'](_0x1d8d6f,{'transaction':_0x157d64});});}else{_0x94bdf4=0x194;_0xdd3fb=[];}});})['then'](function(){if(_0x94bdf4!==0x194){return db[_0x9f96('0x6b')]['findAndCountAll']({'where':{'SmsAccountId':_0x19bd78},'order':_0x9f96('0x70')})[_0x9f96('0x1f')](function(_0x3a7855){_0xdd3fb=_0x3a7855;});}})[_0x9f96('0x27')](function(_0x213769){_0x94bdf4=0x1f4;logger['error'](_0x213769['stack']);if(_0x213769[_0x9f96('0x34')]){delete _0x213769[_0x9f96('0x34')];}_0xdd3fb=_0x213769;})['finally'](function(){if(_0xdd3fb===null){_0x4e931e[_0x9f96('0x33')](_0x94bdf4);}else{if(_0x94bdf4===0x1f4){_0x4e931e[_0x9f96('0x28')](_0x94bdf4)[_0x9f96('0x35')](_0xdd3fb);}else{_0x4e931e['status'](_0x94bdf4)[_0x9f96('0x2e')](_0xdd3fb);}}});};exports[_0x9f96('0xc0')]=function(_0x55630f,_0x7c0ab0,_0x2cb5b5){var _0x4b3e10={};var _0x583b47={};var _0x11e262;var _0x48e900;return db[_0x9f96('0x38')][_0x9f96('0x63')]({'where':{'id':_0x55630f['params']['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x7c0ab0,null))['then'](function(_0x47f7cb){if(_0x47f7cb){_0x11e262=_0x47f7cb;_0x583b47[_0x9f96('0x3d')]=_[_0x9f96('0x40')](db[_0x9f96('0x6b')]['rawAttributes']);_0x583b47[_0x9f96('0x3f')]=_['keys'](_0x55630f[_0x9f96('0x3f')]);_0x583b47[_0x9f96('0x41')]=_['intersection'](_0x583b47[_0x9f96('0x3d')],_0x583b47[_0x9f96('0x3f')]);_0x4b3e10[_0x9f96('0x43')]=_[_0x9f96('0x42')](_0x583b47[_0x9f96('0x3d')],qs[_0x9f96('0x44')](_0x55630f[_0x9f96('0x3f')][_0x9f96('0x44')]));_0x4b3e10[_0x9f96('0x43')]=_0x4b3e10[_0x9f96('0x43')][_0x9f96('0x45')]?_0x4b3e10[_0x9f96('0x43')]:_0x583b47[_0x9f96('0x3d')];_0x4b3e10[_0x9f96('0x48')]=qs['sort'](_0x55630f[_0x9f96('0x3f')][_0x9f96('0x49')]);_0x4b3e10[_0x9f96('0x4c')]=qs[_0x9f96('0x41')](_[_0x9f96('0x4a')](_0x55630f[_0x9f96('0x3f')],_0x583b47[_0x9f96('0x41')]));if(_0x55630f['query'][_0x9f96('0x4b')]){_0x4b3e10[_0x9f96('0x4c')]=_['merge'](_0x4b3e10[_0x9f96('0x4c')],{'$or':_[_0x9f96('0x3e')](_0x4b3e10[_0x9f96('0x43')],function(_0x3287c6){var _0x2a7da4={};_0x2a7da4[_0x3287c6]={'$like':'%'+_0x55630f[_0x9f96('0x3f')][_0x9f96('0x4b')]+'%'};return _0x2a7da4;})});}_0x4b3e10=_[_0x9f96('0x4d')]({},_0x4b3e10,_0x55630f[_0x9f96('0x4f')]);return _0x11e262[_0x9f96('0xc0')](_0x4b3e10);}})[_0x9f96('0x1f')](function(_0x31e6ff){if(_0x31e6ff){_0x48e900=_0x31e6ff[_0x9f96('0x45')];if(!_0x55630f[_0x9f96('0x3f')][_0x9f96('0x46')](_0x9f96('0x47'))){_0x4b3e10['limit']=qs[_0x9f96('0x2c')](_0x55630f[_0x9f96('0x3f')][_0x9f96('0x2c')]);_0x4b3e10[_0x9f96('0x2a')]=qs[_0x9f96('0x2a')](_0x55630f[_0x9f96('0x3f')]['offset']);}return _0x11e262['getApplications'](_0x4b3e10);}})[_0x9f96('0x1f')](function(_0x3ac5fe){if(_0x3ac5fe){return _0x3ac5fe?{'count':_0x48e900,'rows':_0x3ac5fe}:null;}})[_0x9f96('0x1f')](respondWithResult(_0x7c0ab0,null))[_0x9f96('0x27')](handleError(_0x7c0ab0,null));};exports[_0x9f96('0xc1')]=function(_0x5e9156,_0x2d5c43,_0x26cc5f){var _0x488324={'raw':![],'where':{}};var _0x389eb9={};var _0x36e01c={'count':0x0,'rows':[]};return db[_0x9f96('0x38')]['findOne']({'where':{'id':_0x5e9156[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x2d5c43,null))[_0x9f96('0x1f')](function(_0x117c77){if(_0x117c77){_0x389eb9[_0x9f96('0x3d')]=_[_0x9f96('0x40')](db[_0x9f96('0xa1')][_0x9f96('0x39')]);_0x389eb9[_0x9f96('0x3f')]=_[_0x9f96('0x40')](_0x5e9156[_0x9f96('0x3f')]);_0x389eb9[_0x9f96('0x41')]=_[_0x9f96('0x42')](_0x389eb9[_0x9f96('0x3d')],_0x389eb9[_0x9f96('0x3f')]);_0x488324[_0x9f96('0x43')]=_[_0x9f96('0x42')](_0x389eb9[_0x9f96('0x3d')],qs[_0x9f96('0x44')](_0x5e9156[_0x9f96('0x3f')][_0x9f96('0x44')]));_0x488324['attributes']=_0x488324[_0x9f96('0x43')][_0x9f96('0x45')]?_0x488324[_0x9f96('0x43')]:_0x389eb9[_0x9f96('0x3d')];if(!_0x5e9156['query'][_0x9f96('0x46')](_0x9f96('0x47'))){_0x488324[_0x9f96('0x2c')]=qs['limit'](_0x5e9156[_0x9f96('0x3f')][_0x9f96('0x2c')]);_0x488324[_0x9f96('0x2a')]=qs['offset'](_0x5e9156['query'][_0x9f96('0x2a')]);}_0x488324[_0x9f96('0x48')]=qs[_0x9f96('0x49')](_0x5e9156[_0x9f96('0x3f')][_0x9f96('0x49')]);_0x488324[_0x9f96('0x4c')]=qs['filters'](_['pick'](_0x5e9156[_0x9f96('0x3f')],_0x389eb9[_0x9f96('0x41')]));_0x488324[_0x9f96('0x4c')][_0x9f96('0x61')]=_0x117c77['id'];if(_0x5e9156[_0x9f96('0x3f')][_0x9f96('0x4b')]){_0x488324[_0x9f96('0x4c')]=_[_0x9f96('0x4d')](_0x488324[_0x9f96('0x4c')],{'$or':_['map'](_0x488324[_0x9f96('0x43')],function(_0x4e56fd){var _0x219df5={};_0x219df5[_0x4e56fd]={'$like':'%'+_0x5e9156['query'][_0x9f96('0x4b')]+'%'};return _0x219df5;})});}_0x488324=_[_0x9f96('0x4d')]({},_0x488324,_0x5e9156['options']);return db[_0x9f96('0xa1')]['count']({'where':_0x488324[_0x9f96('0x4c')]})['then'](function(_0x4ea5ca){_0x36e01c[_0x9f96('0x2d')]=_0x4ea5ca;if(_0x5e9156[_0x9f96('0x3f')][_0x9f96('0x64')]){_0x488324[_0x9f96('0x50')]=[{'model':db[_0x9f96('0x72')],'as':_0x9f96('0xc2'),'required':![]},{'model':db[_0x9f96('0xad')],'as':'Owner','attributes':[_0x9f96('0x34'),_0x9f96('0xc3'),'internal'],'required':![]},{'model':db[_0x9f96('0xc4')],'as':_0x9f96('0xc5'),'attributes':['id',_0x9f96('0x34'),_0x9f96('0xc6')],'where':_0x5e9156[_0x9f96('0x3f')]['tag']?{'id':_0x5e9156[_0x9f96('0x3f')][_0x9f96('0xc7')]}:undefined,'required':_0x5e9156[_0x9f96('0x3f')][_0x9f96('0xc7')]?!![]:![]}];}return db[_0x9f96('0xa1')]['findAll'](_0x488324);})[_0x9f96('0x1f')](function(_0x806dfc){_0x36e01c[_0x9f96('0x52')]=_0x806dfc;return _0x36e01c;});}})[_0x9f96('0x1f')](respondWithFilteredResult(_0x2d5c43,_0x488324))[_0x9f96('0x27')](handleError(_0x2d5c43,null));};exports[_0x9f96('0x35')]=function(_0x117347,_0x1e7406,_0x1f9c4a){var _0xacc907,_0x3de328,_0x48df74;if(_[_0x9f96('0x94')](_0x117347[_0x9f96('0x5c')][_0x9f96('0x5c')])||_0x117347['body'][_0x9f96('0x5c')]===''){throw new db[(_0x9f96('0x73'))][(_0x9f96('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9f96('0x94')](_0x117347[_0x9f96('0x5c')]['to'])){throw new db[(_0x9f96('0x73'))][(_0x9f96('0x74'))]('to\x20is\x20mandatory');}_0xacc907=_0x117347[_0x9f96('0x5c')]['to'];return db[_0x9f96('0x38')][_0x9f96('0x5d')]({'where':{'id':_0x117347['params']['id']},'include':[{'model':db[_0x9f96('0x9a')],'as':_0x9f96('0xc8'),'include':[{'model':db[_0x9f96('0x72')],'as':_0x9f96('0x9e'),'where':{'mobile':_0xacc907},'limit':0x1,'order':[['updatedAt',_0x9f96('0x9b')]]}]}]})[_0x9f96('0x1f')](handleEntityNotFound(_0x1e7406,null))[_0x9f96('0x1f')](function(_0x4c4da2){if(_0x4c4da2&&_0x4c4da2['List']){_0x3de328=_0x4c4da2['get']({'plain':!![]});if(_0x3de328['List']&&_0x3de328['List']['Contacts'][_0x9f96('0x45')]){return _0x3de328[_0x9f96('0xc8')][_0x9f96('0x9e')][0x0];}return db[_0x9f96('0x72')][_0x9f96('0x54')](_[_0x9f96('0x9f')](_0x117347[_0x9f96('0x5c')],{'firstName':_0xacc907,'mobile':_0xacc907,'phone':_0xacc907,'ListId':_0x3de328[_0x9f96('0x7a')]}));}})[_0x9f96('0x1f')](handleEntityNotFound(_0x1e7406,null))['then'](function(_0x40fcaf){if(_0x40fcaf){_0x48df74=_0x40fcaf;return db['SmsInteraction'][_0x9f96('0x5d')]({'where':{'ContactId':_0x48df74['id'],'closed':![],'SmsAccountId':_0x3de328['id']}})[_0x9f96('0x1f')](function(_0xf2d673){if(_0xf2d673){return[_0xf2d673,![]];}return db[_0x9f96('0xa1')]['create']({'UserId':_0x117347[_0x9f96('0xc9')]['id'],'ContactId':_0x48df74['id'],'SmsAccountId':_0x3de328['id'],'phone':_0xacc907,'firstMsgDirection':_0x9f96('0xca'),'Messages':[_['merge'](_0x117347['body'],{'read':![],'body':_0x117347[_0x9f96('0x5c')][_0x9f96('0x5c')],'phone':_0xacc907,'SmsAccountId':_0x3de328['id'],'UserId':_0x117347['user']['id'],'ContactId':_0x48df74['id']})]},{'include':[{'model':db[_0x9f96('0xa9')],'as':_0x9f96('0xcb')}]})['then'](function(_0x5b354d){return[_0x5b354d,!![]];});});}})[_0x9f96('0xa2')](function(_0x300d23,_0x30e244){if(_0x30e244){return _0x300d23;}return db[_0x9f96('0xa9')][_0x9f96('0x54')](_['merge'](_0x117347[_0x9f96('0x5c')],{'read':![],'body':_0x117347[_0x9f96('0x5c')][_0x9f96('0x5c')],'phone':_0xacc907,'SmsAccountId':_0x3de328['id'],'SmsInteractionId':_0x300d23['id'],'UserId':_0x117347['user']['id'],'ContactId':_0x48df74['id']}))[_0x9f96('0x1f')](function(_0x3ae055){_0x300d23[_0x9f96('0xcc')]['Messages']=[];_0x300d23[_0x9f96('0xcc')][_0x9f96('0xcb')][_0x9f96('0xcd')](_0x3ae055[_0x9f96('0xcc')]);return _0x300d23;});})[_0x9f96('0x1f')](respondWithResult(_0x1e7406,null))[_0x9f96('0x27')](handleError(_0x1e7406,null));};exports[_0x9f96('0x28')]=function(_0x4507d5,_0x5af6a6,_0x30b058){if(_0x4507d5['body']['id']){delete _0x4507d5[_0x9f96('0x5c')]['id'];}var _0x11b48e,_0x37d188,_0x59a84a;return db[_0x9f96('0x38')][_0x9f96('0x5d')]({'where':{'id':_0x4507d5[_0x9f96('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5af6a6,null))['then'](function(_0xa9f444){if(_0xa9f444){_0x59a84a=_0xa9f444;logger['debug'](_0x9f96('0x21'),_0x9f96('0x28'),'received\x20delivery\x20report\x20from',_0xa9f444['type'],util[_0x9f96('0xce')](_0x4507d5[_0x9f96('0x5c')],{'showHidden':![],'depth':null}));switch(_0xa9f444[_0x9f96('0x3b')]){case _0x9f96('0x81'):if(_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xcf')]&&_0x4507d5[_0x9f96('0x5c')][_0x9f96('0x28')]){_0x37d188=_0x4507d5[_0x9f96('0x5c')][_0x9f96('0x28')];return db[_0x9f96('0xa9')][_0x9f96('0x5d')]({'where':{'messageId':_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xcf')]}});}break;case _0x9f96('0x84'):if(_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xd0')]&&_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xd1')]){_0x37d188=_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xd1')];return db[_0x9f96('0xa9')][_0x9f96('0x5d')]({'where':{'messageId':_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xd0')]}});}break;case'clicksend':if(_0x4507d5['body'][_0x9f96('0x86')]&&_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xd2')]){_0x37d188=_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xd2')];return db['SmsMessage'][_0x9f96('0x5d')]({'where':{'messageId':_0x4507d5['body'][_0x9f96('0x86')]}});}break;case'infobip':var _0x4bde3b=_0x4507d5[_0x9f96('0x5c')][_0x9f96('0x8a')][0x0];if(_0x4bde3b['messageId']&&_0x4bde3b[_0x9f96('0x28')]['groupName']===_0x9f96('0xd3')){_0x37d188=_0x4bde3b[_0x9f96('0x28')][_0x9f96('0xd4')];return db[_0x9f96('0xa9')][_0x9f96('0x5d')]({'where':{'messageId':_0x4bde3b['messageId']}});}break;case'clickatell':if(_0x4507d5[_0x9f96('0x5c')]['messageId']&&_0x4507d5[_0x9f96('0x5c')][_0x9f96('0x28')]){_0x37d188=_0x4507d5[_0x9f96('0x5c')][_0x9f96('0x28')];return db['SmsMessage'][_0x9f96('0x5d')]({'where':{'messageId':_0x4507d5[_0x9f96('0x5c')][_0x9f96('0x7f')]}});}break;case _0x9f96('0x91'):if(_0x4507d5[_0x9f96('0x5c')][0x0][_0x9f96('0x25')]['id']){_0x37d188=_0x4507d5[_0x9f96('0x5c')][0x0]['type'];return db[_0x9f96('0xa9')][_0x9f96('0x5d')]({'where':{'messageId':_0x4507d5['body'][0x0][_0x9f96('0x25')]['id']}});}break;case _0x9f96('0x92'):if(_0x4507d5['body']['redif']&&_0x4507d5[_0x9f96('0x5c')]['status']){_0x37d188=_0x4507d5[_0x9f96('0x5c')][_0x9f96('0x28')];return db[_0x9f96('0xa9')][_0x9f96('0x5d')]({'where':{'messageId':_0x4507d5[_0x9f96('0x5c')][_0x9f96('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x5af6a6,null))['then'](function(_0x2038ec){if(_0x2038ec){_0x11b48e=_0x2038ec;switch(_0x59a84a[_0x9f96('0x3b')]){case _0x9f96('0x81'):if(_0x37d188==='DELIVERED'){return _0x11b48e['update']({'read':!![]});}else{logger[_0x9f96('0x23')](_0x9f96('0x21'),'status',_0x9f96('0x81'),util[_0x9f96('0xce')](_0x4507d5[_0x9f96('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x9f96('0x84'):if(_0x37d188==='1'){return _0x11b48e[_0x9f96('0x30')]({'read':!![]});}else{logger[_0x9f96('0x23')](_0x9f96('0x21'),_0x9f96('0x28'),_0x9f96('0x81'),util[_0x9f96('0xce')](_0x4507d5[_0x9f96('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x9f96('0x85'):if(!_0x4507d5[_0x9f96('0x5c')]['error_code']&&_0x37d188>=0xc8&&_0x37d188<=0xce){return _0x11b48e['update']({'read':!![]});}else{logger[_0x9f96('0x23')](_0x9f96('0x21'),_0x9f96('0x28'),'clicksend',util[_0x9f96('0xce')](_0x4507d5[_0x9f96('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x9f96('0xd6'):var _0x1977e5=_0x4507d5[_0x9f96('0x5c')][_0x9f96('0x8a')][0x0];if(_0x1977e5[_0x9f96('0x28')][_0x9f96('0xd4')]===_0x9f96('0xd3')){return _0x11b48e[_0x9f96('0x30')]({'read':!![]});}else{logger[_0x9f96('0x23')](_0x9f96('0x21'),_0x9f96('0x28'),'infobip',util[_0x9f96('0xce')](_0x4507d5['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x37d188==_0x9f96('0xd7')||_0x37d188=='RECEIVED_BY_RECIPIENT'){return _0x11b48e[_0x9f96('0x30')]({'read':!![]});}else{logger[_0x9f96('0x23')](_0x9f96('0x21'),_0x9f96('0x28'),_0x9f96('0x8e'),util[_0x9f96('0xce')](_0x4507d5[_0x9f96('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x9f96('0x91'):if(_0x37d188==_0x9f96('0xd8')){return _0x11b48e[_0x9f96('0x30')]({'read':!![]});}else{logger[_0x9f96('0x23')](_0x9f96('0x21'),_0x9f96('0x28'),'bandwidth',util[_0x9f96('0xce')](_0x4507d5['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x37d188===_0x9f96('0xd9')||_0x37d188===_0x9f96('0xda')){return _0x11b48e[_0x9f96('0x30')]({'read':!![]});}else{logger[_0x9f96('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9f96('0x92'),util[_0x9f96('0xce')](_0x4507d5[_0x9f96('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x11b48e;}})[_0x9f96('0x1f')](respondWithResult(_0x5af6a6,null))[_0x9f96('0x27')](handleError(_0x5af6a6,null));};exports[_0x9f96('0xdb')]=function(_0x42df0c,_0x234c76,_0x6f7096){var _0x1b6fd2,_0x5ef98d,_0x38b980;return db['SmsAccount'][_0x9f96('0x5d')]({'where':{'id':_0x42df0c[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x234c76,null))[_0x9f96('0x1f')](function(_0x1eaa97){if(_0x1eaa97){_0x38b980=_0x1eaa97;logger[_0x9f96('0xb7')](_0x9f96('0x21'),_0x9f96('0x28'),_0x9f96('0xdc'),_0x1eaa97[_0x9f96('0x3b')],util[_0x9f96('0xce')](_0x42df0c[_0x9f96('0x3f')],{'showHidden':![],'depth':null}));switch(_0x1eaa97[_0x9f96('0x3b')]){case _0x9f96('0x8b'):if(_0x42df0c['query'][_0x9f96('0xdd')]&&_0x42df0c[_0x9f96('0x3f')]['state']){_0x5ef98d=_0x42df0c[_0x9f96('0x3f')]['state'];return db['SmsMessage'][_0x9f96('0x5d')]({'where':{'messageId':_0x42df0c['query'][_0x9f96('0xdd')]}});}break;}}})[_0x9f96('0x1f')](handleEntityNotFound(_0x234c76,null))[_0x9f96('0x1f')](function(_0x1f2eae){if(_0x1f2eae){_0x1b6fd2=_0x1f2eae;switch(_0x38b980['type']){case'csc':if(_0x5ef98d==='2'||_0x5ef98d==='6'){return _0x1b6fd2['update']({'read':!![]});}else{logger[_0x9f96('0x23')](_0x9f96('0x21'),_0x9f96('0x28'),'csc',util[_0x9f96('0xce')](_0x42df0c[_0x9f96('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x1b6fd2;}})[_0x9f96('0x1f')](respondWithResult(_0x234c76,null))[_0x9f96('0x27')](handleError(_0x234c76,null));};exports[_0x9f96('0xde')]=function(_0x41a68e,_0x14a8c5,_0x9cf4a4){return db[_0x9f96('0x38')]['find']({'where':{'id':_0x41a68e[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x14a8c5,null))[_0x9f96('0x1f')](function(_0x57df49){if(_0x57df49){return _0x57df49['addAgents'](_0x41a68e[_0x9f96('0x5c')][_0x9f96('0x65')],_[_0x9f96('0x9d')](_0x41a68e['body'],[_0x9f96('0x65'),'id'])||{})[_0x9f96('0xa2')](function(_0xd0641b){for(var _0x5a02a0=0x0;_0x5a02a0<_0x41a68e[_0x9f96('0x5c')][_0x9f96('0x65')][_0x9f96('0x45')];_0x5a02a0+=0x1){socket[_0x9f96('0xdf')](_0x9f96('0xe0'),{'UserId':Number(_0x41a68e['body'][_0x9f96('0x65')][_0x5a02a0]),'SmsAccountId':Number(_0x41a68e[_0x9f96('0x5e')]['id'])});}return _0xd0641b;});}})[_0x9f96('0x1f')](respondWithResult(_0x14a8c5,null))[_0x9f96('0x27')](handleError(_0x14a8c5,null));};exports[_0x9f96('0xe1')]=function(_0x3e0c07,_0x7745aa,_0x314c8a){return db[_0x9f96('0x38')][_0x9f96('0x5d')]({'where':{'id':_0x3e0c07[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x7745aa,null))[_0x9f96('0x1f')](function(_0x1db600){if(_0x1db600){return _0x1db600[_0x9f96('0xe1')](_0x3e0c07['query'][_0x9f96('0x65')])['then'](function(){if(_[_0x9f96('0xe2')](_0x3e0c07[_0x9f96('0x3f')][_0x9f96('0x65')])){for(var _0x421997=0x0;_0x421997<_0x3e0c07['query']['ids'][_0x9f96('0x45')];_0x421997+=0x1){socket[_0x9f96('0xdf')](_0x9f96('0xe3'),{'UserId':Number(_0x3e0c07[_0x9f96('0x3f')][_0x9f96('0x65')][_0x421997]),'SmsAccountId':Number(_0x3e0c07[_0x9f96('0x5e')]['id'])});}}else{socket[_0x9f96('0xdf')](_0x9f96('0xe3'),{'UserId':Number(_0x3e0c07[_0x9f96('0x3f')][_0x9f96('0x65')]),'SmsAccountId':Number(_0x3e0c07[_0x9f96('0x5e')]['id'])});}});}})[_0x9f96('0x1f')](respondWithStatusCode(_0x7745aa,null))[_0x9f96('0x27')](handleError(_0x7745aa,null));};exports[_0x9f96('0xe4')]=function(_0x360384,_0x1daf15,_0x14ca59){var _0x333e99={};var _0x598b18={};var _0xff9245;var _0x46dd9f;return db[_0x9f96('0x38')][_0x9f96('0x63')]({'where':{'id':_0x360384[_0x9f96('0x5e')]['id']}})[_0x9f96('0x1f')](handleEntityNotFound(_0x1daf15,null))[_0x9f96('0x1f')](function(_0x40ee81){if(_0x40ee81){_0xff9245=_0x40ee81;_0x598b18[_0x9f96('0x3d')]=_[_0x9f96('0x40')](db[_0x9f96('0xad')][_0x9f96('0x39')]);_0x598b18['query']=_[_0x9f96('0x40')](_0x360384[_0x9f96('0x3f')]);_0x598b18['filters']=_[_0x9f96('0x42')](_0x598b18[_0x9f96('0x3d')],_0x598b18[_0x9f96('0x3f')]);_0x333e99[_0x9f96('0x43')]=_[_0x9f96('0x42')](_0x598b18['model'],qs[_0x9f96('0x44')](_0x360384[_0x9f96('0x3f')][_0x9f96('0x44')]));_0x333e99[_0x9f96('0x43')]=_0x333e99[_0x9f96('0x43')][_0x9f96('0x45')]?_0x333e99[_0x9f96('0x43')]:_0x598b18[_0x9f96('0x3d')];_0x333e99['order']=qs['sort'](_0x360384[_0x9f96('0x3f')][_0x9f96('0x49')]);_0x333e99[_0x9f96('0x4c')]=qs['filters'](_[_0x9f96('0x4a')](_0x360384['query'],_0x598b18['filters']));if(_0x360384['query'][_0x9f96('0x4b')]){_0x333e99[_0x9f96('0x4c')]=_[_0x9f96('0x4d')](_0x333e99[_0x9f96('0x4c')],{'$or':_['map'](_0x333e99['attributes'],function(_0x519632){var _0xfc9c21={};_0xfc9c21[_0x519632]={'$like':'%'+_0x360384[_0x9f96('0x3f')][_0x9f96('0x4b')]+'%'};return _0xfc9c21;})});}_0x333e99=_['merge']({},_0x333e99,_0x360384['options']);return _0xff9245[_0x9f96('0xe4')](_0x333e99);}})[_0x9f96('0x1f')](function(_0x2555ce){if(_0x2555ce){_0x46dd9f=_0x2555ce[_0x9f96('0x45')];if(!_0x360384[_0x9f96('0x3f')][_0x9f96('0x46')](_0x9f96('0x47'))){_0x333e99[_0x9f96('0x2c')]=qs['limit'](_0x360384['query'][_0x9f96('0x2c')]);_0x333e99[_0x9f96('0x2a')]=qs[_0x9f96('0x2a')](_0x360384[_0x9f96('0x3f')][_0x9f96('0x2a')]);}return _0xff9245[_0x9f96('0xe4')](_0x333e99);}})[_0x9f96('0x1f')](function(_0x52f530){if(_0x52f530){return _0x52f530?{'count':_0x46dd9f,'rows':_0x52f530}:null;}})[_0x9f96('0x1f')](respondWithResult(_0x1daf15,null))['catch'](handleError(_0x1daf15,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 078d8a1..07a9fb7 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 _0x1fb3=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','remove','hasOwnProperty','hook'];(function(_0x247a1e,_0x24f903){var _0x40ed26=function(_0x318244){while(--_0x318244){_0x247a1e['push'](_0x247a1e['shift']());}};_0x40ed26(++_0x24f903);}(_0x1fb3,0x1b9));var _0x31fb=function(_0x513b9e,_0x5aeb09){_0x513b9e=_0x513b9e-0x0;var _0x36338c=_0x1fb3[_0x513b9e];return _0x36338c;};'use strict';var EventEmitter=require(_0x31fb('0x0'));var SmsAccount=require(_0x31fb('0x1'))['db'][_0x31fb('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x31fb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x31fb('0x4')};function emitEvent(_0x4e2d4f){return function(_0x2f28f7,_0x3d2462,_0x5759c0){SmsAccountEvents['emit'](_0x4e2d4f+':'+_0x2f28f7['id'],_0x2f28f7);SmsAccountEvents['emit'](_0x4e2d4f,_0x2f28f7);_0x5759c0(null);};}for(var e in events){if(events[_0x31fb('0x5')](e)){var event=events[e];SmsAccount[_0x31fb('0x6')](e,emitEvent(event));}}module[_0x31fb('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x335e=['exports','events','../../mysqldb','SmsAccount','remove','emit','hasOwnProperty','hook'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x335e,0xa9));var _0xe335=function(_0x50b0ea,_0x206b9a){_0x50b0ea=_0x50b0ea-0x0;var _0x35c57e=_0x335e[_0x50b0ea];return _0x35c57e;};'use strict';var EventEmitter=require(_0xe335('0x0'));var SmsAccount=require(_0xe335('0x1'))['db'][_0xe335('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe335('0x3')};function emitEvent(_0x3cc642){return function(_0x492665,_0x4ad2cb,_0x24f4a9){SmsAccountEvents[_0xe335('0x4')](_0x3cc642+':'+_0x492665['id'],_0x492665);SmsAccountEvents[_0xe335('0x4')](_0x3cc642,_0x492665);_0x24f4a9(null);};}for(var e in events){if(events[_0xe335('0x5')](e)){var event=events[e];SmsAccount[_0xe335('0x6')](e,emitEvent(event));}}module[_0xe335('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 a40898e..e66c223 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 _0xc280=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x4dd7c2,_0x5e86af){var _0x48ae97=function(_0x477727){while(--_0x477727){_0x4dd7c2['push'](_0x4dd7c2['shift']());}};_0x48ae97(++_0x5e86af);}(_0xc280,0x136));var _0x0c28=function(_0x3ea694,_0xd110d7){_0x3ea694=_0x3ea694-0x0;var _0x3ae3c2=_0xc280[_0x3ea694];return _0x3ae3c2;};'use strict';var _=require(_0x0c28('0x0'));var util=require(_0x0c28('0x1'));var logger=require(_0x0c28('0x2'))(_0x0c28('0x3'));var moment=require('moment');var BPromise=require(_0x0c28('0x4'));var rp=require(_0x0c28('0x5'));var fs=require('fs');var path=require(_0x0c28('0x6'));var rimraf=require(_0x0c28('0x7'));var config=require(_0x0c28('0x8'));var attributes=require('./smsAccount.attributes');module[_0x0c28('0x9')]=function(_0x5eafba,_0x34fbb6){return _0x5eafba[_0x0c28('0xa')](_0x0c28('0xb'),attributes,{'tableName':_0x0c28('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2cb=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x8e4d5b,_0x3bc92d){var _0x508e9b=function(_0x46e4bd){while(--_0x46e4bd){_0x8e4d5b['push'](_0x8e4d5b['shift']());}};_0x508e9b(++_0x3bc92d);}(_0xd2cb,0x109));var _0xbd2c=function(_0x43130c,_0x1a0e3e){_0x43130c=_0x43130c-0x0;var _0x570f1a=_0xd2cb[_0x43130c];return _0x570f1a;};'use strict';var _=require(_0xbd2c('0x0'));var util=require(_0xbd2c('0x1'));var logger=require(_0xbd2c('0x2'))(_0xbd2c('0x3'));var moment=require(_0xbd2c('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd2c('0x5'));var fs=require('fs');var path=require(_0xbd2c('0x6'));var rimraf=require(_0xbd2c('0x7'));var config=require(_0xbd2c('0x8'));var attributes=require(_0xbd2c('0x9'));module[_0xbd2c('0xa')]=function(_0x15b275,_0x162325){return _0x15b275[_0xbd2c('0xb')](_0xbd2c('0xc'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 3a4b4b4..9c453de 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 _0x404d=['catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1a3ce1,_0x40ed90){var _0x24aaae=function(_0x4ad875){while(--_0x4ad875){_0x1a3ce1['push'](_0x1a3ce1['shift']());}};_0x24aaae(++_0x40ed90);}(_0x404d,0x1c7));var _0xd404=function(_0x4f89b2,_0x5750c7){_0x4f89b2=_0x4f89b2-0x0;var _0x1cbacd=_0x404d[_0x4f89b2];return _0x1cbacd;};'use strict';var _=require(_0xd404('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd404('0x1'));var rs=require(_0xd404('0x2'));var fs=require('fs');var Redis=require(_0xd404('0x3'));var db=require(_0xd404('0x4'))['db'];var utils=require(_0xd404('0x5'));var logger=require(_0xd404('0x6'))('rpc');var config=require(_0xd404('0x7'));var jayson=require(_0xd404('0x8'));var client=jayson[_0xd404('0x9')]['http']({'port':0x232a});config[_0xd404('0xa')]=_[_0xd404('0xb')](config[_0xd404('0xa')],{'host':_0xd404('0xc'),'port':0x18eb});var socket=require(_0xd404('0xd'))(new Redis(config[_0xd404('0xa')]));require('./smsAccount.socket')[_0xd404('0xe')](socket);function respondWithRpcPromise(_0x1679aa,_0x406526,_0x1643bf){return new BPromise(function(_0x16aadf,_0x5997e1){return client[_0xd404('0xf')](_0x1679aa,_0x1643bf)['then'](function(_0x27d643){logger[_0xd404('0x10')](_0xd404('0x11'),_0x406526,_0xd404('0x12'));logger[_0xd404('0x13')](_0xd404('0x14'),_0x406526,_0xd404('0x12'),JSON[_0xd404('0x15')](_0x27d643));if(_0x27d643[_0xd404('0x16')]){if(_0x27d643[_0xd404('0x16')][_0xd404('0x17')]===0x1f4){logger[_0xd404('0x16')](_0xd404('0x11'),_0x406526,_0x27d643[_0xd404('0x16')]['message']);return _0x5997e1(_0x27d643[_0xd404('0x16')][_0xd404('0x18')]);}logger['error'](_0xd404('0x11'),_0x406526,_0x27d643[_0xd404('0x16')][_0xd404('0x18')]);return _0x16aadf(_0x27d643['error'][_0xd404('0x18')]);}else{logger[_0xd404('0x10')](_0xd404('0x11'),_0x406526,_0xd404('0x12'));_0x16aadf(_0x27d643[_0xd404('0x19')][_0xd404('0x18')]);}})[_0xd404('0x1a')](function(_0x554647){logger[_0xd404('0x16')]('SmsAccount,\x20%s,\x20%s',_0x406526,_0x554647);_0x5997e1(_0x554647);});});}exports[_0xd404('0x1b')]=function(_0x3150aa){var _0x5f48b5=this;return new Promise(function(_0x1dc4e6,_0x391384){return db[_0xd404('0x1c')][_0xd404('0x1d')]({'raw':_0x3150aa[_0xd404('0x1e')]?_0x3150aa[_0xd404('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3150aa[_0xd404('0x1e')]?_0x3150aa[_0xd404('0x1e')][_0xd404('0x1f')]||null:null,'attributes':_0x3150aa[_0xd404('0x1e')]?_0x3150aa['options'][_0xd404('0x20')]||null:null,'include':_0x3150aa['options']?_0x3150aa[_0xd404('0x1e')][_0xd404('0x21')]?_[_0xd404('0x22')](_0x3150aa[_0xd404('0x1e')][_0xd404('0x21')],function(_0x5514b1){return{'model':db[_0x5514b1[_0xd404('0x23')]],'as':_0x5514b1['as'],'attributes':_0x5514b1[_0xd404('0x20')],'include':_0x5514b1[_0xd404('0x21')]?_[_0xd404('0x22')](_0x5514b1['include'],function(_0xc8fab5){return{'model':db[_0xc8fab5[_0xd404('0x23')]],'as':_0xc8fab5['as'],'attributes':_0xc8fab5[_0xd404('0x20')],'include':_0xc8fab5[_0xd404('0x21')]?_['map'](_0xc8fab5['include'],function(_0xbcb702){return{'model':db[_0xbcb702[_0xd404('0x23')]],'as':_0xbcb702['as'],'attributes':_0xbcb702[_0xd404('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd404('0x24')](function(_0x39bb5e){logger[_0xd404('0x10')]('ShowSmsAccount',_0x3150aa);logger['debug'](_0xd404('0x1b'),_0x3150aa,JSON[_0xd404('0x15')](_0x39bb5e));_0x1dc4e6(_0x39bb5e);})[_0xd404('0x1a')](function(_0x312505){logger['error'](_0xd404('0x1b'),_0x312505[_0xd404('0x18')],_0x3150aa);_0x391384(_0x5f48b5[_0xd404('0x16')](0x1f4,_0x312505['message']));});});}; \ No newline at end of file +var _0x705a=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./smsAccount.socket','register','request','then'];(function(_0x15f752,_0x57a664){var _0xc880ae=function(_0x4e53eb){while(--_0x4e53eb){_0x15f752['push'](_0x15f752['shift']());}};_0xc880ae(++_0x57a664);}(_0x705a,0x1e7));var _0xa705=function(_0x217cff,_0x4f4924){_0x217cff=_0x217cff-0x0;var _0x3ba9c5=_0x705a[_0x217cff];return _0x3ba9c5;};'use strict';var _=require(_0xa705('0x0'));var util=require(_0xa705('0x1'));var moment=require('moment');var BPromise=require(_0xa705('0x2'));var rs=require(_0xa705('0x3'));var fs=require('fs');var Redis=require(_0xa705('0x4'));var db=require(_0xa705('0x5'))['db'];var utils=require(_0xa705('0x6'));var logger=require(_0xa705('0x7'))(_0xa705('0x8'));var config=require(_0xa705('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa705('0xa')]({'port':0x232a});config[_0xa705('0xb')]=_['defaults'](config[_0xa705('0xb')],{'host':_0xa705('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa705('0xb')]));require(_0xa705('0xd'))[_0xa705('0xe')](socket);function respondWithRpcPromise(_0x256d5f,_0x46d92b,_0x298d39){return new BPromise(function(_0x214080,_0x2a78c0){return client[_0xa705('0xf')](_0x256d5f,_0x298d39)[_0xa705('0x10')](function(_0x236b7c){logger[_0xa705('0x11')](_0xa705('0x12'),_0x46d92b,_0xa705('0x13'));logger['debug'](_0xa705('0x14'),_0x46d92b,_0xa705('0x13'),JSON['stringify'](_0x236b7c));if(_0x236b7c[_0xa705('0x15')]){if(_0x236b7c[_0xa705('0x15')][_0xa705('0x16')]===0x1f4){logger['error'](_0xa705('0x12'),_0x46d92b,_0x236b7c[_0xa705('0x15')][_0xa705('0x17')]);return _0x2a78c0(_0x236b7c[_0xa705('0x15')][_0xa705('0x17')]);}logger[_0xa705('0x15')](_0xa705('0x12'),_0x46d92b,_0x236b7c[_0xa705('0x15')]['message']);return _0x214080(_0x236b7c[_0xa705('0x15')][_0xa705('0x17')]);}else{logger[_0xa705('0x11')](_0xa705('0x12'),_0x46d92b,_0xa705('0x13'));_0x214080(_0x236b7c['result'][_0xa705('0x17')]);}})['catch'](function(_0x5889d2){logger[_0xa705('0x15')]('SmsAccount,\x20%s,\x20%s',_0x46d92b,_0x5889d2);_0x2a78c0(_0x5889d2);});});}exports[_0xa705('0x18')]=function(_0x1d176d){var _0x28d279=this;return new Promise(function(_0x148375,_0x1cfc8f){return db[_0xa705('0x19')][_0xa705('0x1a')]({'raw':_0x1d176d['options']?_0x1d176d[_0xa705('0x1b')][_0xa705('0x1c')]===undefined?!![]:![]:!![],'where':_0x1d176d[_0xa705('0x1b')]?_0x1d176d[_0xa705('0x1b')][_0xa705('0x1d')]||null:null,'attributes':_0x1d176d[_0xa705('0x1b')]?_0x1d176d[_0xa705('0x1b')][_0xa705('0x1e')]||null:null,'include':_0x1d176d['options']?_0x1d176d[_0xa705('0x1b')]['include']?_['map'](_0x1d176d['options'][_0xa705('0x1f')],function(_0x55d4c6){return{'model':db[_0x55d4c6['model']],'as':_0x55d4c6['as'],'attributes':_0x55d4c6['attributes'],'include':_0x55d4c6['include']?_['map'](_0x55d4c6['include'],function(_0xdc0040){return{'model':db[_0xdc0040['model']],'as':_0xdc0040['as'],'attributes':_0xdc0040[_0xa705('0x1e')],'include':_0xdc0040[_0xa705('0x1f')]?_[_0xa705('0x20')](_0xdc0040[_0xa705('0x1f')],function(_0x1644c8){return{'model':db[_0x1644c8[_0xa705('0x21')]],'as':_0x1644c8['as'],'attributes':_0x1644c8[_0xa705('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c3633){logger['info'](_0xa705('0x18'),_0x1d176d);logger[_0xa705('0x22')](_0xa705('0x18'),_0x1d176d,JSON['stringify'](_0x2c3633));_0x148375(_0x2c3633);})[_0xa705('0x23')](function(_0xb95335){logger[_0xa705('0x15')](_0xa705('0x18'),_0xb95335[_0xa705('0x17')],_0x1d176d);_0x1cfc8f(_0x28d279[_0xa705('0x15')](0x1f4,_0xb95335[_0xa705('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0bdb4a2..668fbfe 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 f75b5e5..d47117f 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x278878,_0x2fa57a){var _0x15ab71=function(_0x3350c6){while(--_0x3350c6){_0x278878['push'](_0x278878['shift']());}};_0x15ab71(++_0x2fa57a);}(_0x55ca,0x126));var _0xa55c=function(_0x414e73,_0x57569f){_0x414e73=_0x414e73-0x0;var _0x5c3cba=_0x55ca[_0x414e73];return _0x5c3cba;};'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['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('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(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7df1cd8..c8ad938 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 _0xa136=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x368e58,_0x202095){var _0xa52412=function(_0x2f09f4){while(--_0x2f09f4){_0x368e58['push'](_0x368e58['shift']());}};_0xa52412(++_0x202095);}(_0xa136,0x15b));var _0x6a13=function(_0x1c4866,_0x255b66){_0x1c4866=_0x1c4866-0x0;var _0x4239e6=_0xa136[_0x1c4866];return _0x4239e6;};'use strict';var Sequelize=require(_0x6a13('0x0'));module[_0x6a13('0x1')]={'priority':{'type':Sequelize[_0x6a13('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6a13('0x3')],'allowNull':![],'defaultValue':_0x6a13('0x4')},'appdata':{'type':Sequelize[_0x6a13('0x5')]()},'description':{'type':Sequelize[_0x6a13('0x3')]},'interval':{'type':Sequelize[_0x6a13('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3f54=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x3f54,0x139));var _0x43f5=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x3f54[_0x39bc44];return _0x2916d8;};'use strict';var Sequelize=require(_0x43f5('0x0'));module[_0x43f5('0x1')]={'priority':{'type':Sequelize[_0x43f5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x43f5('0x3')],'allowNull':![],'defaultValue':_0x43f5('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x43f5('0x3')]},'interval':{'type':Sequelize[_0x43f5('0x3')],'defaultValue':_0x43f5('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b59a934..1687bdd 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 _0xdf50=['destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','find','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then'];(function(_0x2705f7,_0x10e511){var _0x2f0f76=function(_0x495a5a){while(--_0x495a5a){_0x2705f7['push'](_0x2705f7['shift']());}};_0x2f0f76(++_0x10e511);}(_0xdf50,0xbb));var _0x0df5=function(_0x5e3bb1,_0x3cfe7c){_0x5e3bb1=_0x5e3bb1-0x0;var _0x4c1278=_0xdf50[_0x5e3bb1];return _0x4c1278;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0df5('0x0'));var zipdir=require(_0x0df5('0x1'));var jsonpatch=require(_0x0df5('0x2'));var rp=require(_0x0df5('0x3'));var moment=require(_0x0df5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0df5('0x5'));var util=require(_0x0df5('0x6'));var path=require(_0x0df5('0x7'));var sox=require(_0x0df5('0x8'));var csv=require(_0x0df5('0x9'));var ejs=require(_0x0df5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0df5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0df5('0xc'));var deskjs=require(_0x0df5('0xd'));var toCsv=require(_0x0df5('0x9'));var querystring=require('querystring');var Papa=require(_0x0df5('0xe'));var Redis=require(_0x0df5('0xf'));var authService=require(_0x0df5('0x10'));var qs=require(_0x0df5('0x11'));var as=require(_0x0df5('0x12'));var hardwareService=require(_0x0df5('0x13'));var logger=require(_0x0df5('0x14'))(_0x0df5('0x15'));var utils=require(_0x0df5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0df5('0x17'));var db=require(_0x0df5('0x18'))['db'];function respondWithStatusCode(_0x44481e,_0x1e0338){_0x1e0338=_0x1e0338||0xcc;return function(_0x5c5fa9){if(_0x5c5fa9){return _0x44481e[_0x0df5('0x19')](_0x1e0338);}return _0x44481e[_0x0df5('0x1a')](_0x1e0338)[_0x0df5('0x1b')]();};}function respondWithResult(_0x2a7e99,_0x1e3833){_0x1e3833=_0x1e3833||0xc8;return function(_0x222752){if(_0x222752){return _0x2a7e99[_0x0df5('0x1a')](_0x1e3833)[_0x0df5('0x1c')](_0x222752);}};}function respondWithFilteredResult(_0x4be675,_0x387167){return function(_0x3bb462){if(_0x3bb462){var _0x110958=typeof _0x387167[_0x0df5('0x1d')]===_0x0df5('0x1e')&&typeof _0x387167['limit']===_0x0df5('0x1e');var _0x475e94=_0x3bb462[_0x0df5('0x1f')];var _0xdcff5=_0x110958?0x0:_0x387167[_0x0df5('0x1d')];var _0x9c411d=_0x110958?_0x3bb462[_0x0df5('0x1f')]:_0x387167[_0x0df5('0x1d')]+_0x387167[_0x0df5('0x20')];var _0x51d425;if(_0x9c411d>=_0x475e94){_0x9c411d=_0x475e94;_0x51d425=0xc8;}else{_0x51d425=0xce;}_0x4be675[_0x0df5('0x1a')](_0x51d425);return _0x4be675[_0x0df5('0x21')](_0x0df5('0x22'),_0xdcff5+'-'+_0x9c411d+'/'+_0x475e94)[_0x0df5('0x1c')](_0x3bb462);}return null;};}function patchUpdates(_0x122d5e){return function(_0x5aa968){try{jsonpatch['apply'](_0x5aa968,_0x122d5e,!![]);}catch(_0x6dec7e){return BPromise[_0x0df5('0x23')](_0x6dec7e);}return _0x5aa968['save']();};}function saveUpdates(_0x4a2709,_0x3a4390){return function(_0xe80b58){if(_0xe80b58){return _0xe80b58[_0x0df5('0x24')](_0x4a2709)[_0x0df5('0x25')](function(_0x426d2f){return _0x426d2f;});}return null;};}function removeEntity(_0x4cc5ba,_0x9755b9){return function(_0xe925ec){if(_0xe925ec){return _0xe925ec[_0x0df5('0x26')]()[_0x0df5('0x25')](function(){_0x4cc5ba[_0x0df5('0x1a')](0xcc)[_0x0df5('0x1b')]();});}};}function handleEntityNotFound(_0x24fd2c,_0x3fd9f6){return function(_0x3017d6){if(!_0x3017d6){_0x24fd2c[_0x0df5('0x19')](0x194);}return _0x3017d6;};}function handleError(_0x389d73,_0x221b50){_0x221b50=_0x221b50||0x1f4;return function(_0x5d195f){logger[_0x0df5('0x27')](_0x5d195f[_0x0df5('0x28')]);if(_0x5d195f[_0x0df5('0x29')]){delete _0x5d195f[_0x0df5('0x29')];}_0x389d73[_0x0df5('0x1a')](_0x221b50)[_0x0df5('0x2a')](_0x5d195f);};}exports[_0x0df5('0x2b')]=function(_0x46798f,_0x49fcb7){var _0x5f04de={},_0x4742f2={},_0x380782={'count':0x0,'rows':[]};var _0x4d43ac=_[_0x0df5('0x2c')](db[_0x0df5('0x2d')][_0x0df5('0x2e')],function(_0x1e52bd){return{'name':_0x1e52bd[_0x0df5('0x2f')],'type':_0x1e52bd['type'][_0x0df5('0x30')]};});_0x4742f2[_0x0df5('0x31')]=_['map'](_0x4d43ac,'name');_0x4742f2['query']=_[_0x0df5('0x32')](_0x46798f['query']);_0x4742f2[_0x0df5('0x33')]=_[_0x0df5('0x34')](_0x4742f2[_0x0df5('0x31')],_0x4742f2[_0x0df5('0x35')]);_0x5f04de[_0x0df5('0x36')]=_['intersection'](_0x4742f2['model'],qs[_0x0df5('0x37')](_0x46798f[_0x0df5('0x35')][_0x0df5('0x37')]));_0x5f04de[_0x0df5('0x36')]=_0x5f04de[_0x0df5('0x36')][_0x0df5('0x38')]?_0x5f04de[_0x0df5('0x36')]:_0x4742f2['model'];if(!_0x46798f[_0x0df5('0x35')]['hasOwnProperty'](_0x0df5('0x39'))){_0x5f04de['limit']=qs[_0x0df5('0x20')](_0x46798f[_0x0df5('0x35')][_0x0df5('0x20')]);_0x5f04de[_0x0df5('0x1d')]=qs[_0x0df5('0x1d')](_0x46798f[_0x0df5('0x35')][_0x0df5('0x1d')]);}_0x5f04de[_0x0df5('0x3a')]=qs[_0x0df5('0x3b')](_0x46798f[_0x0df5('0x35')][_0x0df5('0x3b')]);_0x5f04de[_0x0df5('0x3c')]=qs['filters'](_[_0x0df5('0x3d')](_0x46798f[_0x0df5('0x35')],_0x4742f2[_0x0df5('0x33')]),_0x4d43ac);if(_0x46798f['query'][_0x0df5('0x3e')]){_0x5f04de[_0x0df5('0x3c')]=_[_0x0df5('0x3f')](_0x5f04de[_0x0df5('0x3c')],{'$or':_[_0x0df5('0x2c')](_0x4d43ac,function(_0x4ccca5){if(_0x4ccca5[_0x0df5('0x40')]!==_0x0df5('0x41')){var _0x4d3294={};_0x4d3294[_0x4ccca5['name']]={'$like':'%'+_0x46798f['query']['filter']+'%'};return _0x4d3294;}})});}_0x5f04de=_[_0x0df5('0x3f')]({},_0x5f04de,_0x46798f[_0x0df5('0x42')]);var _0x56031e={'where':_0x5f04de['where']};return db['SmsApplication'][_0x0df5('0x1f')](_0x56031e)[_0x0df5('0x25')](function(_0x3382ed){_0x380782[_0x0df5('0x1f')]=_0x3382ed;if(_0x46798f[_0x0df5('0x35')]['includeAll']){_0x5f04de[_0x0df5('0x43')]=[{'all':!![]}];}return db[_0x0df5('0x2d')][_0x0df5('0x44')](_0x5f04de);})[_0x0df5('0x25')](function(_0x298dee){_0x380782[_0x0df5('0x45')]=_0x298dee;return _0x380782;})[_0x0df5('0x25')](respondWithFilteredResult(_0x49fcb7,_0x5f04de))[_0x0df5('0x46')](handleError(_0x49fcb7,null));};exports[_0x0df5('0x47')]=function(_0x2d02bc,_0x1eede4){var _0x164762={'raw':!![],'where':{'id':_0x2d02bc[_0x0df5('0x48')]['id']}},_0x4995bf={};_0x4995bf['model']=_['keys'](db[_0x0df5('0x2d')]['rawAttributes']);_0x4995bf[_0x0df5('0x35')]=_['keys'](_0x2d02bc[_0x0df5('0x35')]);_0x4995bf[_0x0df5('0x33')]=_['intersection'](_0x4995bf[_0x0df5('0x31')],_0x4995bf[_0x0df5('0x35')]);_0x164762[_0x0df5('0x36')]=_[_0x0df5('0x34')](_0x4995bf[_0x0df5('0x31')],qs[_0x0df5('0x37')](_0x2d02bc[_0x0df5('0x35')]['fields']));_0x164762[_0x0df5('0x36')]=_0x164762[_0x0df5('0x36')][_0x0df5('0x38')]?_0x164762[_0x0df5('0x36')]:_0x4995bf[_0x0df5('0x31')];if(_0x2d02bc[_0x0df5('0x35')]['includeAll']){_0x164762['include']=[{'all':!![]}];}_0x164762=_['merge']({},_0x164762,_0x2d02bc['options']);return db[_0x0df5('0x2d')][_0x0df5('0x49')](_0x164762)[_0x0df5('0x25')](handleEntityNotFound(_0x1eede4,null))['then'](respondWithResult(_0x1eede4,null))[_0x0df5('0x46')](handleError(_0x1eede4,null));};exports['create']=function(_0x4a8972,_0x9fc77){return db[_0x0df5('0x2d')]['create'](_0x4a8972[_0x0df5('0x4a')],{})['then'](respondWithResult(_0x9fc77,0xc9))[_0x0df5('0x46')](handleError(_0x9fc77,null));};exports[_0x0df5('0x24')]=function(_0xce3c33,_0x20f6d6){if(_0xce3c33[_0x0df5('0x4a')]['id']){delete _0xce3c33[_0x0df5('0x4a')]['id'];}return db['SmsApplication'][_0x0df5('0x49')]({'where':{'id':_0xce3c33[_0x0df5('0x48')]['id']}})['then'](handleEntityNotFound(_0x20f6d6,null))['then'](saveUpdates(_0xce3c33['body'],null))[_0x0df5('0x25')](respondWithResult(_0x20f6d6,null))['catch'](handleError(_0x20f6d6,null));};exports['destroy']=function(_0x270f34,_0x5ecd26){return db[_0x0df5('0x2d')][_0x0df5('0x49')]({'where':{'id':_0x270f34[_0x0df5('0x48')]['id']}})[_0x0df5('0x25')](handleEntityNotFound(_0x5ecd26,null))['then'](removeEntity(_0x5ecd26,null))['catch'](handleError(_0x5ecd26,null));}; \ No newline at end of file +var _0xbc45=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SmsApplication','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','create','body','destroy','find','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x5bae95,_0x2aed2a){var _0x5ca520=function(_0x2e2df9){while(--_0x2e2df9){_0x5bae95['push'](_0x5bae95['shift']());}};_0x5ca520(++_0x2aed2a);}(_0xbc45,0x1be));var _0x5bc4=function(_0x21c9c7,_0x5c95c1){_0x21c9c7=_0x21c9c7-0x0;var _0x3dfe2c=_0xbc45[_0x21c9c7];return _0x3dfe2c;};'use strict';var emlformat=require(_0x5bc4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bc4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bc4('0x2'));var moment=require(_0x5bc4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bc4('0x4'));var util=require(_0x5bc4('0x5'));var path=require(_0x5bc4('0x6'));var sox=require(_0x5bc4('0x7'));var csv=require(_0x5bc4('0x8'));var ejs=require(_0x5bc4('0x9'));var fs=require('fs');var fs_extra=require(_0x5bc4('0xa'));var _=require(_0x5bc4('0xb'));var squel=require(_0x5bc4('0xc'));var crypto=require(_0x5bc4('0xd'));var jsforce=require(_0x5bc4('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5bc4('0xf'));var Papa=require(_0x5bc4('0x10'));var Redis=require(_0x5bc4('0x11'));var authService=require(_0x5bc4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bc4('0x13'))(_0x5bc4('0x14'));var utils=require(_0x5bc4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5bc4('0x16'));var db=require(_0x5bc4('0x17'))['db'];function respondWithStatusCode(_0x514660,_0xe6700){_0xe6700=_0xe6700||0xcc;return function(_0x6dc068){if(_0x6dc068){return _0x514660[_0x5bc4('0x18')](_0xe6700);}return _0x514660['status'](_0xe6700)[_0x5bc4('0x19')]();};}function respondWithResult(_0x59a105,_0x44a409){_0x44a409=_0x44a409||0xc8;return function(_0x3bc2fd){if(_0x3bc2fd){return _0x59a105[_0x5bc4('0x1a')](_0x44a409)[_0x5bc4('0x1b')](_0x3bc2fd);}};}function respondWithFilteredResult(_0x181939,_0x1b47f){return function(_0x5d2fec){if(_0x5d2fec){var _0x38f682=typeof _0x1b47f['offset']==='undefined'&&typeof _0x1b47f[_0x5bc4('0x1c')]===_0x5bc4('0x1d');var _0x135ba1=_0x5d2fec[_0x5bc4('0x1e')];var _0x10c946=_0x38f682?0x0:_0x1b47f[_0x5bc4('0x1f')];var _0x27a9b7=_0x38f682?_0x5d2fec[_0x5bc4('0x1e')]:_0x1b47f['offset']+_0x1b47f[_0x5bc4('0x1c')];var _0x242563;if(_0x27a9b7>=_0x135ba1){_0x27a9b7=_0x135ba1;_0x242563=0xc8;}else{_0x242563=0xce;}_0x181939['status'](_0x242563);return _0x181939[_0x5bc4('0x20')](_0x5bc4('0x21'),_0x10c946+'-'+_0x27a9b7+'/'+_0x135ba1)[_0x5bc4('0x1b')](_0x5d2fec);}return null;};}function patchUpdates(_0x20609d){return function(_0x2ebff3){try{jsonpatch[_0x5bc4('0x22')](_0x2ebff3,_0x20609d,!![]);}catch(_0x1f97e4){return BPromise[_0x5bc4('0x23')](_0x1f97e4);}return _0x2ebff3[_0x5bc4('0x24')]();};}function saveUpdates(_0x2a6318,_0xa25b80){return function(_0x5c62f9){if(_0x5c62f9){return _0x5c62f9['update'](_0x2a6318)[_0x5bc4('0x25')](function(_0x2c2793){return _0x2c2793;});}return null;};}function removeEntity(_0x17e423,_0x5f428a){return function(_0x1bf998){if(_0x1bf998){return _0x1bf998['destroy']()['then'](function(){_0x17e423[_0x5bc4('0x1a')](0xcc)[_0x5bc4('0x19')]();});}};}function handleEntityNotFound(_0x5a415b,_0x21d3b7){return function(_0x4babea){if(!_0x4babea){_0x5a415b[_0x5bc4('0x18')](0x194);}return _0x4babea;};}function handleError(_0x6985d2,_0x11a006){_0x11a006=_0x11a006||0x1f4;return function(_0xe3f10f){logger[_0x5bc4('0x26')](_0xe3f10f[_0x5bc4('0x27')]);if(_0xe3f10f['name']){delete _0xe3f10f[_0x5bc4('0x28')];}_0x6985d2[_0x5bc4('0x1a')](_0x11a006)[_0x5bc4('0x29')](_0xe3f10f);};}exports[_0x5bc4('0x2a')]=function(_0xefbfda,_0x14873b){var _0x4ab654={},_0x3b389f={},_0x2a9ceb={'count':0x0,'rows':[]};var _0x348e9c=_[_0x5bc4('0x2b')](db[_0x5bc4('0x2c')]['rawAttributes'],function(_0x2870f5){return{'name':_0x2870f5['fieldName'],'type':_0x2870f5[_0x5bc4('0x2d')][_0x5bc4('0x2e')]};});_0x3b389f[_0x5bc4('0x2f')]=_[_0x5bc4('0x2b')](_0x348e9c,'name');_0x3b389f['query']=_['keys'](_0xefbfda[_0x5bc4('0x30')]);_0x3b389f[_0x5bc4('0x31')]=_[_0x5bc4('0x32')](_0x3b389f[_0x5bc4('0x2f')],_0x3b389f[_0x5bc4('0x30')]);_0x4ab654['attributes']=_[_0x5bc4('0x32')](_0x3b389f[_0x5bc4('0x2f')],qs['fields'](_0xefbfda[_0x5bc4('0x30')][_0x5bc4('0x33')]));_0x4ab654[_0x5bc4('0x34')]=_0x4ab654['attributes'][_0x5bc4('0x35')]?_0x4ab654['attributes']:_0x3b389f[_0x5bc4('0x2f')];if(!_0xefbfda[_0x5bc4('0x30')][_0x5bc4('0x36')]('nolimit')){_0x4ab654[_0x5bc4('0x1c')]=qs[_0x5bc4('0x1c')](_0xefbfda[_0x5bc4('0x30')][_0x5bc4('0x1c')]);_0x4ab654[_0x5bc4('0x1f')]=qs['offset'](_0xefbfda[_0x5bc4('0x30')][_0x5bc4('0x1f')]);}_0x4ab654[_0x5bc4('0x37')]=qs[_0x5bc4('0x38')](_0xefbfda[_0x5bc4('0x30')][_0x5bc4('0x38')]);_0x4ab654['where']=qs[_0x5bc4('0x31')](_[_0x5bc4('0x39')](_0xefbfda[_0x5bc4('0x30')],_0x3b389f[_0x5bc4('0x31')]),_0x348e9c);if(_0xefbfda[_0x5bc4('0x30')][_0x5bc4('0x3a')]){_0x4ab654[_0x5bc4('0x3b')]=_[_0x5bc4('0x3c')](_0x4ab654[_0x5bc4('0x3b')],{'$or':_[_0x5bc4('0x2b')](_0x348e9c,function(_0x6b9879){if(_0x6b9879[_0x5bc4('0x2d')]!==_0x5bc4('0x3d')){var _0x50b7d1={};_0x50b7d1[_0x6b9879['name']]={'$like':'%'+_0xefbfda['query']['filter']+'%'};return _0x50b7d1;}})});}_0x4ab654=_['merge']({},_0x4ab654,_0xefbfda[_0x5bc4('0x3e')]);var _0x351359={'where':_0x4ab654[_0x5bc4('0x3b')]};return db['SmsApplication'][_0x5bc4('0x1e')](_0x351359)['then'](function(_0x203f11){_0x2a9ceb['count']=_0x203f11;if(_0xefbfda[_0x5bc4('0x30')][_0x5bc4('0x3f')]){_0x4ab654['include']=[{'all':!![]}];}return db[_0x5bc4('0x2c')][_0x5bc4('0x40')](_0x4ab654);})[_0x5bc4('0x25')](function(_0x5f356d){_0x2a9ceb[_0x5bc4('0x41')]=_0x5f356d;return _0x2a9ceb;})['then'](respondWithFilteredResult(_0x14873b,_0x4ab654))[_0x5bc4('0x42')](handleError(_0x14873b,null));};exports[_0x5bc4('0x43')]=function(_0x13d4bc,_0x31b980){var _0x56aa24={'raw':!![],'where':{'id':_0x13d4bc[_0x5bc4('0x44')]['id']}},_0xc13b66={};_0xc13b66['model']=_[_0x5bc4('0x45')](db['SmsApplication'][_0x5bc4('0x46')]);_0xc13b66[_0x5bc4('0x30')]=_['keys'](_0x13d4bc[_0x5bc4('0x30')]);_0xc13b66['filters']=_[_0x5bc4('0x32')](_0xc13b66[_0x5bc4('0x2f')],_0xc13b66[_0x5bc4('0x30')]);_0x56aa24[_0x5bc4('0x34')]=_[_0x5bc4('0x32')](_0xc13b66[_0x5bc4('0x2f')],qs[_0x5bc4('0x33')](_0x13d4bc[_0x5bc4('0x30')][_0x5bc4('0x33')]));_0x56aa24[_0x5bc4('0x34')]=_0x56aa24[_0x5bc4('0x34')]['length']?_0x56aa24[_0x5bc4('0x34')]:_0xc13b66[_0x5bc4('0x2f')];if(_0x13d4bc['query'][_0x5bc4('0x3f')]){_0x56aa24[_0x5bc4('0x47')]=[{'all':!![]}];}_0x56aa24=_[_0x5bc4('0x3c')]({},_0x56aa24,_0x13d4bc[_0x5bc4('0x3e')]);return db['SmsApplication']['find'](_0x56aa24)[_0x5bc4('0x25')](handleEntityNotFound(_0x31b980,null))['then'](respondWithResult(_0x31b980,null))['catch'](handleError(_0x31b980,null));};exports[_0x5bc4('0x48')]=function(_0x5d93a0,_0x26d96b){return db[_0x5bc4('0x2c')][_0x5bc4('0x48')](_0x5d93a0['body'],{})[_0x5bc4('0x25')](respondWithResult(_0x26d96b,0xc9))[_0x5bc4('0x42')](handleError(_0x26d96b,null));};exports['update']=function(_0x460374,_0x7fc330){if(_0x460374['body']['id']){delete _0x460374[_0x5bc4('0x49')]['id'];}return db[_0x5bc4('0x2c')]['find']({'where':{'id':_0x460374['params']['id']}})[_0x5bc4('0x25')](handleEntityNotFound(_0x7fc330,null))[_0x5bc4('0x25')](saveUpdates(_0x460374[_0x5bc4('0x49')],null))[_0x5bc4('0x25')](respondWithResult(_0x7fc330,null))[_0x5bc4('0x42')](handleError(_0x7fc330,null));};exports[_0x5bc4('0x4a')]=function(_0x147182,_0x9c8b8e){return db[_0x5bc4('0x2c')][_0x5bc4('0x4b')]({'where':{'id':_0x147182[_0x5bc4('0x44')]['id']}})['then'](handleEntityNotFound(_0x9c8b8e,null))['then'](removeEntity(_0x9c8b8e,null))['catch'](handleError(_0x9c8b8e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 3535a92..cc4fc90 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 _0x025f=['./smsApplication.attributes','exports','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x025f,0x160));var _0xf025=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x025f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf025('0x0'));var util=require(_0xf025('0x1'));var logger=require(_0xf025('0x2'))(_0xf025('0x3'));var moment=require(_0xf025('0x4'));var BPromise=require(_0xf025('0x5'));var rp=require(_0xf025('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf025('0x7'));var config=require('../../config/environment');var attributes=require(_0xf025('0x8'));module[_0xf025('0x9')]=function(_0x23786d,_0x1f4c01){return _0x23786d['define']('SmsApplication',attributes,{'tableName':_0xf025('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf025('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xedb4=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird'];(function(_0x266da8,_0x47419a){var _0x5cdbe0=function(_0x3a8782){while(--_0x3a8782){_0x266da8['push'](_0x266da8['shift']());}};_0x5cdbe0(++_0x47419a);}(_0xedb4,0x15b));var _0x4edb=function(_0x45096e,_0x17e82d){_0x45096e=_0x45096e-0x0;var _0xba1fa3=_0xedb4[_0x45096e];return _0xba1fa3;};'use strict';var _=require(_0x4edb('0x0'));var util=require(_0x4edb('0x1'));var logger=require('../../config/logger')(_0x4edb('0x2'));var moment=require('moment');var BPromise=require(_0x4edb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4edb('0x4'));var rimraf=require(_0x4edb('0x5'));var config=require(_0x4edb('0x6'));var attributes=require(_0x4edb('0x7'));module[_0x4edb('0x8')]=function(_0x19f666,_0xc67836){return _0x19f666[_0x4edb('0x9')](_0x4edb('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4edb('0xb'),'collate':_0x4edb('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8c912ff..8c8acb4 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 _0x627e=['request','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x400949,_0x50eafc){var _0x231f64=function(_0x1e0bb2){while(--_0x1e0bb2){_0x400949['push'](_0x400949['shift']());}};_0x231f64(++_0x50eafc);}(_0x627e,0x14a));var _0xe627=function(_0x57ebfa,_0x487980){_0x57ebfa=_0x57ebfa-0x0;var _0x1884bc=_0x627e[_0x57ebfa];return _0x1884bc;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});} \ No newline at end of file +var _0x29b6=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x202434,_0x1ccc96){var _0x9f27c5=function(_0x429ded){while(--_0x429ded){_0x202434['push'](_0x202434['shift']());}};_0x9f27c5(++_0x1ccc96);}(_0x29b6,0x17e));var _0x629b=function(_0x15dacd,_0x8b58e4){_0x15dacd=_0x15dacd-0x0;var _0x30f78c=_0x29b6[_0x15dacd];return _0x30f78c;};'use strict';var _=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var moment=require(_0x629b('0x2'));var BPromise=require(_0x629b('0x3'));var rs=require(_0x629b('0x4'));var fs=require('fs');var Redis=require(_0x629b('0x5'));var db=require(_0x629b('0x6'))['db'];var utils=require(_0x629b('0x7'));var logger=require(_0x629b('0x8'))(_0x629b('0x9'));var config=require('../../config/environment');var jayson=require(_0x629b('0xa'));var client=jayson['client'][_0x629b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4acc5a,_0x26e439,_0x398ecb){return new BPromise(function(_0x4e90cd,_0xc44b27){return client[_0x629b('0xc')](_0x4acc5a,_0x398ecb)['then'](function(_0x28c152){logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));logger[_0x629b('0x10')](_0x629b('0x11'),_0x26e439,_0x629b('0xf'),JSON[_0x629b('0x12')](_0x28c152));if(_0x28c152[_0x629b('0x13')]){if(_0x28c152[_0x629b('0x13')]['code']===0x1f4){logger['error'](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);return _0xc44b27(_0x28c152['error'][_0x629b('0x14')]);}logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')]['message']);return _0x4e90cd(_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);}else{logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));_0x4e90cd(_0x28c152['result'][_0x629b('0x14')]);}})['catch'](function(_0x151b93){logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x151b93);_0xc44b27(_0x151b93);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 660e039..8f20ef0 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 _0x80ed=['delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x80ed,0x11c));var _0xd80e=function(_0x56fbc9,_0x443b17){_0x56fbc9=_0x56fbc9-0x0;var _0x3893dd=_0x80ed[_0x56fbc9];return _0x3893dd;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./smsInteraction.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getMessages']);router[_0xd80e('0x8')](_0xd80e('0x10'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x12')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x12')](_0xd80e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x16')),controller[_0xd80e('0x17')]);router['put'](_0xd80e('0xd'),auth[_0xd80e('0x9')](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x18')),controller[_0xd80e('0x19')]);router[_0xd80e('0x1a')](_0xd80e('0xd'),auth['isAuthenticated'](),interaction[_0xd80e('0x14')](_0xd80e('0x15'),_0xd80e('0x1b')),controller[_0xd80e('0x1c')]);router['delete'](_0xd80e('0x1d'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x2f8d3e,_0x5752b1){var _0x5bfcb1=function(_0xea7a9d){while(--_0xea7a9d){_0x2f8d3e['push'](_0x2f8d3e['shift']());}};_0x5bfcb1(++_0x5752b1);}(_0x3c81,0x102));var _0x13c8=function(_0x46f440,_0x2bcb26){_0x46f440=_0x46f440-0x0;var _0x3fa64c=_0x3c81[_0x46f440];return _0x3fa64c;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 8b9d7a5..d3d38d5 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 _0xb4f4=['out','INTEGER','sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x5b7a24,_0x196a8e){var _0x4697a6=function(_0x1ed9be){while(--_0x1ed9be){_0x5b7a24['push'](_0x5b7a24['shift']());}};_0x4697a6(++_0x196a8e);}(_0xb4f4,0xda));var _0x4b4f=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xb4f4[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0x4b4f('0x0'));var moment=require(_0x4b4f('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4b4f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4b4f('0x3')]},'disposition':{'type':Sequelize[_0x4b4f('0x4')]},'secondDisposition':{'type':Sequelize[_0x4b4f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4b4f('0x4')]},'phone':{'type':Sequelize[_0x4b4f('0x4')]},'read1stAt':{'type':Sequelize[_0x4b4f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4b4f('0x5')]('in',_0x4b4f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4b4f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4b4f('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4b4f('0x7')]}}; \ No newline at end of file +var _0xa486=['STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','exports','DATE'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0xa486,0x17d));var _0x6a48=function(_0x50ffc0,_0x2cdc34){_0x50ffc0=_0x50ffc0-0x0;var _0x474732=_0xa486[_0x50ffc0];return _0x474732;};'use strict';var Sequelize=require(_0x6a48('0x0'));var moment=require('moment');module[_0x6a48('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6a48('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6a48('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6a48('0x3')]},'note':{'type':Sequelize[_0x6a48('0x3')]},'phone':{'type':Sequelize[_0x6a48('0x3')]},'read1stAt':{'type':Sequelize[_0x6a48('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6a48('0x4')]('in',_0x6a48('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6a48('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x6a48('0x4')]('in',_0x6a48('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6a48('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6a48('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index bb17580..8548cdb 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 _0x1156=['disposition','out','System','lastName','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','sms','query','user','catch','show','keys','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','create','body','params','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','toString','join','server','tmp','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Messages','createdAt','direction','secret','read','Account','Owner','get','Sms','N.A.','closed','closedAt'];(function(_0x12d003,_0x392793){var _0x5213e2=function(_0xfe1ce4){while(--_0xfe1ce4){_0x12d003['push'](_0x12d003['shift']());}};_0x5213e2(++_0x392793);}(_0x1156,0x178));var _0x6115=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x1156[_0x34021d];return _0x16597b;};'use strict';var rimraf=require(_0x6115('0x0'));var zipdir=require('zip-dir');var moment=require(_0x6115('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x6115('0x2'));var ejs=require(_0x6115('0x3'));var fs=require('fs');var _=require(_0x6115('0x4'));var Redis=require(_0x6115('0x5'));var interaction=require(_0x6115('0x6'));var qs=require(_0x6115('0x7'));var pdf=require(_0x6115('0x8'));var logger=require(_0x6115('0x9'))(_0x6115('0xa'));var config=require(_0x6115('0xb'));var db=require(_0x6115('0xc'))['db'];config[_0x6115('0xd')]=_['defaults'](config[_0x6115('0xd')],{'host':_0x6115('0xe'),'port':0x18eb});var socket=require(_0x6115('0xf'))(new Redis(config['redis']));require(_0x6115('0x10'))['register'](socket);function respondWithStatusCode(_0x3e7f94,_0xe4366){_0xe4366=_0xe4366||0xcc;return function(_0x39211d){if(_0x39211d){return _0x3e7f94[_0x6115('0x11')](_0xe4366);}return _0x3e7f94[_0x6115('0x12')](_0xe4366)[_0x6115('0x13')]();};}function respondWithResult(_0x3a29d9,_0xf603f5){_0xf603f5=_0xf603f5||0xc8;return function(_0x2cc544){if(_0x2cc544){return _0x3a29d9[_0x6115('0x12')](_0xf603f5)[_0x6115('0x14')](_0x2cc544);}};}function respondWithFilteredResult(_0x5d604d,_0x205808){return function(_0x2feaad){if(_0x2feaad){var _0x38dd95=typeof _0x205808[_0x6115('0x15')]==='undefined'&&typeof _0x205808[_0x6115('0x16')]===_0x6115('0x17');var _0x8f0903=_0x2feaad[_0x6115('0x18')];var _0x39022a=_0x38dd95?0x0:_0x205808['offset'];var _0x4c010b=_0x38dd95?_0x2feaad['count']:_0x205808[_0x6115('0x15')]+_0x205808[_0x6115('0x16')];var _0x3bba7e;if(_0x4c010b>=_0x8f0903){_0x4c010b=_0x8f0903;_0x3bba7e=0xc8;}else{_0x3bba7e=0xce;}_0x5d604d['status'](_0x3bba7e);return _0x5d604d[_0x6115('0x19')](_0x6115('0x1a'),_0x39022a+'-'+_0x4c010b+'/'+_0x8f0903)[_0x6115('0x14')](_0x2feaad);}return null;};}function saveUpdates(_0x5da7b5){return function(_0x309206){if(_0x309206){return _0x309206[_0x6115('0x1b')](_0x5da7b5)[_0x6115('0x1c')](function(_0x527c74){return _0x527c74;});}return null;};}function removeEntity(_0x14f2e2){return function(_0x15ab58){if(_0x15ab58){return _0x15ab58['destroy']()['then'](function(){_0x14f2e2['status'](0xcc)[_0x6115('0x13')]();});}};}function handleEntityNotFound(_0x1437d6){return function(_0x2da66a){if(!_0x2da66a){_0x1437d6['sendStatus'](0x194);}return _0x2da66a;};}function handleError(_0x2c69e9,_0x2a273c){_0x2a273c=_0x2a273c||0x1f4;return function(_0x21f40d){logger['error'](_0x21f40d[_0x6115('0x1d')]);if(_0x21f40d[_0x6115('0x1e')]){delete _0x21f40d[_0x6115('0x1e')];}_0x2c69e9['status'](_0x2a273c)[_0x6115('0x1f')](_0x21f40d);};}exports[_0x6115('0x20')]=function(_0x1468af,_0x265911){var _0x219d73={};var _0x3475ba=_[_0x6115('0x21')](db[_0x6115('0x22')][_0x6115('0x23')],function(_0x24dab7){return{'name':_0x24dab7[_0x6115('0x24')],'type':_0x24dab7[_0x6115('0x25')][_0x6115('0x26')]};});_0x219d73=qs[_0x6115('0x27')](_0x3475ba,_0x1468af);return interaction['findAll'](_0x6115('0x28'),_0x1468af[_0x6115('0x29')],_0x1468af[_0x6115('0x2a')],_0x219d73,_0x3475ba)[_0x6115('0x1c')](respondWithFilteredResult(_0x265911,_0x219d73))[_0x6115('0x2b')](handleError(_0x265911,null));};exports[_0x6115('0x2c')]=function(_0x11832f,_0x5384bc){var _0x22882e={'raw':![],'where':{'id':_0x11832f['params']['id']}},_0x2748c5={};_0x2748c5['model']=_[_0x6115('0x2d')](db[_0x6115('0x22')][_0x6115('0x23')]);_0x2748c5[_0x6115('0x29')]=_[_0x6115('0x2d')](_0x11832f[_0x6115('0x29')]);_0x2748c5[_0x6115('0x2e')]=_[_0x6115('0x2f')](_0x2748c5['model'],_0x2748c5[_0x6115('0x29')]);_0x22882e[_0x6115('0x30')]=_[_0x6115('0x2f')](_0x2748c5[_0x6115('0x31')],qs[_0x6115('0x32')](_0x11832f['query'][_0x6115('0x32')]));_0x22882e[_0x6115('0x30')]=_0x22882e[_0x6115('0x30')][_0x6115('0x33')]?_0x22882e[_0x6115('0x30')]:_0x2748c5[_0x6115('0x31')];if(_0x11832f['query'][_0x6115('0x34')]){_0x22882e[_0x6115('0x35')]=[{'all':!![]}];}_0x22882e=_[_0x6115('0x36')]({},_0x22882e,_0x11832f[_0x6115('0x37')]);return db[_0x6115('0x22')][_0x6115('0x38')](_0x22882e)[_0x6115('0x1c')](handleEntityNotFound(_0x5384bc,null))['then'](respondWithResult(_0x5384bc,null))['catch'](handleError(_0x5384bc,null));};exports[_0x6115('0x39')]=function(_0x25bd3a,_0x30bf68){return db[_0x6115('0x22')][_0x6115('0x39')](_0x25bd3a[_0x6115('0x3a')],{})['then'](respondWithResult(_0x30bf68,0xc9))[_0x6115('0x2b')](handleError(_0x30bf68,null));};exports[_0x6115('0x1b')]=function(_0x23dc67,_0x575f94){if(_0x23dc67['body']['id']){delete _0x23dc67['body']['id'];}return db[_0x6115('0x22')][_0x6115('0x38')]({'where':{'id':_0x23dc67[_0x6115('0x3b')]['id']}})[_0x6115('0x1c')](handleEntityNotFound(_0x575f94,null))[_0x6115('0x1c')](saveUpdates(_0x23dc67['body'],null))['then'](respondWithResult(_0x575f94,null))[_0x6115('0x2b')](handleError(_0x575f94,null));};exports[_0x6115('0x3c')]=function(_0x336abf,_0x27df44){return db['SmsInteraction'][_0x6115('0x38')]({'where':{'id':_0x336abf[_0x6115('0x3b')]['id']}})[_0x6115('0x1c')](handleEntityNotFound(_0x27df44,null))[_0x6115('0x1c')](removeEntity(_0x27df44,null))[_0x6115('0x2b')](handleError(_0x27df44,null));};exports[_0x6115('0x3d')]=function(_0xda7128,_0x4b4c0e){return db['SmsInteraction'][_0x6115('0x3d')]()[_0x6115('0x1c')](respondWithResult(_0x4b4c0e,null))[_0x6115('0x2b')](handleError(_0x4b4c0e,null));};exports[_0x6115('0x3e')]=function(_0x45a912,_0x1d13ea){return db[_0x6115('0x3f')]['find']({'where':{'id':_0x45a912[_0x6115('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1d13ea,null))[_0x6115('0x1c')](function(_0x43dea7){if(_0x43dea7){return _0x43dea7['addMessage'](_0x45a912['body'][_0x6115('0x40')],_[_0x6115('0x41')](_0x45a912[_0x6115('0x3a')],[_0x6115('0x40'),'id'])||{});}})[_0x6115('0x1c')](respondWithResult(_0x1d13ea,null))[_0x6115('0x2b')](handleError(_0x1d13ea,null));};exports[_0x6115('0x42')]=function(_0x234497,_0x2efbb0){var _0x33cd22={'raw':![],'where':{}};var _0x27d613={};var _0x31caf3={'count':0x0,'rows':[]};return db[_0x6115('0x22')][_0x6115('0x43')]({'where':{'id':_0x234497[_0x6115('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2efbb0,null))[_0x6115('0x1c')](function(_0x36d834){if(_0x36d834){_0x27d613[_0x6115('0x31')]=_['keys'](db[_0x6115('0x3f')]['rawAttributes']);_0x27d613['query']=_[_0x6115('0x2d')](_0x234497[_0x6115('0x29')]);_0x27d613[_0x6115('0x2e')]=_[_0x6115('0x2f')](_0x27d613[_0x6115('0x31')],_0x27d613[_0x6115('0x29')]);_0x33cd22[_0x6115('0x30')]=_['intersection'](_0x27d613['model'],qs[_0x6115('0x32')](_0x234497[_0x6115('0x29')][_0x6115('0x32')]));_0x33cd22[_0x6115('0x30')]=_0x33cd22[_0x6115('0x30')]['length']?_0x33cd22[_0x6115('0x30')]:_0x27d613[_0x6115('0x31')];if(!_0x234497[_0x6115('0x29')]['hasOwnProperty'](_0x6115('0x44'))){_0x33cd22['limit']=qs[_0x6115('0x16')](_0x234497['query'][_0x6115('0x16')]);_0x33cd22[_0x6115('0x15')]=qs[_0x6115('0x15')](_0x234497[_0x6115('0x29')][_0x6115('0x15')]);}_0x33cd22['order']=qs[_0x6115('0x45')](_0x234497[_0x6115('0x29')][_0x6115('0x45')]);_0x33cd22[_0x6115('0x46')]=qs[_0x6115('0x2e')](_[_0x6115('0x47')](_0x234497['query'],_0x27d613[_0x6115('0x2e')]));_0x33cd22['where']['SmsInteractionId']=_0x36d834['id'];if(_0x234497[_0x6115('0x29')]['filter']){_0x33cd22[_0x6115('0x46')]=_[_0x6115('0x36')](_0x33cd22['where'],{'$or':_['map'](_0x33cd22['attributes'],function(_0x3c05e2){var _0x5d2b01={};_0x5d2b01[_0x3c05e2]={'$like':'%'+_0x234497[_0x6115('0x29')][_0x6115('0x48')]+'%'};return _0x5d2b01;})});}if(_0x234497[_0x6115('0x29')][_0x6115('0x49')]){var _0x1aa900=_0x234497[_0x6115('0x29')][_0x6115('0x49')]['split'](',');var _0x4cc24d={};_0x4cc24d[_0x1aa900[0x0]]={'$gte':moment(_0x1aa900[0x1])['format'](_0x6115('0x4a'))};_0x33cd22['where']=_['merge'](_0x33cd22[_0x6115('0x46')],_0x4cc24d);}_0x33cd22=_[_0x6115('0x36')]({},_0x33cd22,_0x234497['options']);return db[_0x6115('0x3f')]['count']({'where':_0x33cd22['where']})['then'](function(_0x27345b){_0x31caf3[_0x6115('0x18')]=_0x27345b;if(_0x234497[_0x6115('0x29')]['includeAll']){_0x33cd22[_0x6115('0x35')]=[{'all':!![]}];}return db[_0x6115('0x3f')][_0x6115('0x4b')](_0x33cd22);})['then'](function(_0x1c33a5){_0x31caf3['rows']=_0x1c33a5;return _0x31caf3;});}})[_0x6115('0x1c')](respondWithFilteredResult(_0x2efbb0,_0x33cd22))['catch'](handleError(_0x2efbb0,null));};exports[_0x6115('0x4c')]=function(_0x84eda0,_0x383090){return db['SmsInteraction']['find']({'where':{'id':_0x84eda0['params']['id']}})['then'](handleEntityNotFound(_0x383090,null))[_0x6115('0x1c')](function(_0x3fc8c7){if(_0x3fc8c7){return _0x3fc8c7[_0x6115('0x4d')](_0x84eda0[_0x6115('0x3a')][_0x6115('0x40')],_[_0x6115('0x41')](_0x84eda0[_0x6115('0x3a')],['ids','id'])||{})[_0x6115('0x4e')](function(){return db[_0x6115('0x4f')]['findAll']({'attributes':['id',_0x6115('0x1e'),'color'],'where':{'id':_0x84eda0[_0x6115('0x3a')][_0x6115('0x40')]}});})[_0x6115('0x1c')](function(_0xd5efdc){socket[_0x6115('0x50')](_0x6115('0x51'),{'id':Number(_0x84eda0[_0x6115('0x3b')]['id']),'tags':_0xd5efdc||[]});return{'id':Number(_0x84eda0[_0x6115('0x3b')]['id']),'tags':_0xd5efdc||[]};});}})[_0x6115('0x1c')](respondWithResult(_0x383090,null))[_0x6115('0x2b')](handleError(_0x383090,null));};exports[_0x6115('0x52')]=function(_0x4c4dce,_0x3490c4){return db[_0x6115('0x22')][_0x6115('0x38')]({'where':{'id':_0x4c4dce[_0x6115('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3490c4,null))['then'](function(_0x3e9add){if(_0x3e9add){return _0x3e9add['removeTags'](_0x4c4dce[_0x6115('0x29')][_0x6115('0x40')]);}})[_0x6115('0x1c')](respondWithStatusCode(_0x3490c4,null))['catch'](handleError(_0x3490c4,null));};exports[_0x6115('0x53')]=function(_0x43b214,_0x43f56a){var _0x552ec1=moment()['unix']()[_0x6115('0x54')]();var _0x1a11d7=path[_0x6115('0x55')](config['root'],_0x6115('0x56'),'files',_0x6115('0x57'));var _0x3ad8d9=path[_0x6115('0x55')](_0x1a11d7,_0x552ec1);var _0x4a1635=util[_0x6115('0x58')](_0x6115('0x59'),_0x43b214[_0x6115('0x3b')]['id'],_0x552ec1);var _0x56cfb0=path[_0x6115('0x55')](_0x1a11d7,_0x4a1635);var _0x1df54f=[];_0x1df54f['push']({'model':db[_0x6115('0x5a')],'as':_0x6115('0x5a'),'attributes':['id',_0x6115('0x5b')],'raw':!![]});_0x1df54f[_0x6115('0x5c')]({'model':db[_0x6115('0x5d')],'as':_0x6115('0x5e'),'attributes':['id',_0x6115('0x5f'),'lastName'],'raw':!![]});var _0x417ec4=[{'model':db[_0x6115('0x3f')],'as':_0x6115('0x60'),'attributes':['id',_0x6115('0x3a'),_0x6115('0x61'),_0x6115('0x62'),_0x6115('0x63'),_0x6115('0x64')],'include':_0x1df54f}];_0x417ec4[_0x6115('0x5c')]({'model':db['SmsAccount'],'as':_0x6115('0x65'),'attributes':['id','name']});_0x417ec4['push']({'model':db['User'],'as':_0x6115('0x66'),'attributes':['id','fullname']});return db[_0x6115('0x22')][_0x6115('0x38')]({'where':{'id':_0x43b214['params']['id']},'include':_0x417ec4})['then'](handleEntityNotFound(_0x43f56a,null))[_0x6115('0x1c')](function(_0x449848){if(_0x449848){var _0x39c37c=_0x449848[_0x6115('0x67')]({'plain':!![]});fs['mkdirSync'](_0x3ad8d9);var _0x27a313={'channel':_0x6115('0x68'),'account':_0x39c37c[_0x6115('0x65')]['name'],'agent':_0x39c37c[_0x6115('0x66')]?_0x39c37c[_0x6115('0x66')][_0x6115('0x5b')]:_0x6115('0x69'),'createdAt':moment(_0x39c37c[_0x6115('0x61')])[_0x6115('0x58')](_0x6115('0x4a'))[_0x6115('0x54')](),'closedAt':_0x39c37c[_0x6115('0x6a')]?moment(_0x39c37c[_0x6115('0x6b')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6115('0x54')]():'','disposition':_0x39c37c[_0x6115('0x6c')],'messages':_(_0x39c37c[_0x6115('0x60')])[_0x6115('0x48')]({'secret':![]})['map'](function(_0xe4e146){return{'date':moment(_0xe4e146[_0x6115('0x61')])[_0x6115('0x58')](_0x6115('0x4a'))['toString'](),'sender':_0xe4e146['direction']===_0x6115('0x6d')?_0xe4e146[_0x6115('0x5a')]?_0xe4e146[_0x6115('0x5a')][_0x6115('0x5b')]:_0x6115('0x6e'):_0xe4e146[_0x6115('0x5e')][_0x6115('0x5f')]+(_0xe4e146[_0x6115('0x5e')]['lastName']?'\x20'+_0xe4e146[_0x6115('0x5e')][_0x6115('0x6f')]:''),'body':_0xe4e146['body'],'direction':_0xe4e146[_0x6115('0x62')]===_0x6115('0x6d')?'A':'C','secret':_0xe4e146[_0x6115('0x63')],'read':_0xe4e146[_0x6115('0x64')]};})[_0x6115('0x70')]()};return ejs[_0x6115('0x71')](path['join'](config[_0x6115('0x72')],_0x6115('0x56'),_0x6115('0x73'),_0x6115('0x74')),{'interaction':_0x27a313})[_0x6115('0x1c')](function(_0x481c01){var _0x1c0176=path[_0x6115('0x55')](_0x3ad8d9,_0x6115('0x75')+_0x39c37c['id']+'-'+_0x552ec1+_0x6115('0x76'));var _0x317dc8={'path':_0x1c0176,'channel':_0x6115('0x68'),'interactionId':_0x39c37c['id']};return pdf[_0x6115('0x77')](_0x481c01,_0x317dc8);})[_0x6115('0x1c')](function(){return new BPromise(function(_0x3f5284,_0x5146c2){zipdir(_0x3ad8d9,{'saveTo':_0x56cfb0},function(_0x1d55b4,_0x32438e){if(_0x1d55b4)return _0x5146c2(_0x1d55b4);return _0x3f5284(_0x32438e);});})['then'](function(){return new BPromise(function(_0x2780ad,_0x428375){rimraf(_0x3ad8d9,function(_0xaa7e58){if(_0xaa7e58)_0x428375(_0xaa7e58);return _0x2780ad();});});})[_0x6115('0x1c')](function(){return _0x43f56a['download'](_0x56cfb0,_0x4a1635,function(_0x2ab765){if(_0x2ab765){console['log'](_0x6115('0x78'),_0x2ab765);}else{fs['unlinkSync'](_0x56cfb0);}});});});}else{return _0x43f56a[_0x6115('0x11')](0xc8);}})[_0x6115('0x2b')](handleError(_0x43f56a,null));}; \ No newline at end of file +var _0xbaad=['err','unlinkSync','rimraf','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','error','name','index','map','SmsInteraction','type','key','findAll','sms','query','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','catch','params','describe','addMessage','SmsMessage','ids','omit','findOne','rawAttributes','hasOwnProperty','order','pick','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','color','emit','removeTags','unix','toString','root','server','files','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Messages','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','createdAt','closed','closedAt','direction','out','System','lastName','value','views'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xbaad,0x1b6));var _0xdbaa=function(_0x282994,_0x3a3a70){_0x282994=_0x282994-0x0;var _0x3a1810=_0xbaad[_0x282994];return _0x3a1810;};'use strict';var rimraf=require(_0xdbaa('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xdbaa('0x1'));var util=require(_0xdbaa('0x2'));var path=require('path');var ejs=require(_0xdbaa('0x3'));var fs=require('fs');var _=require(_0xdbaa('0x4'));var Redis=require('ioredis');var interaction=require(_0xdbaa('0x5'));var qs=require(_0xdbaa('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xdbaa('0x7'));var config=require(_0xdbaa('0x8'));var db=require('../../mysqldb')['db'];config[_0xdbaa('0x9')]=_[_0xdbaa('0xa')](config[_0xdbaa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xdbaa('0xb'))(new Redis(config[_0xdbaa('0x9')]));require(_0xdbaa('0xc'))[_0xdbaa('0xd')](socket);function respondWithStatusCode(_0x11f168,_0x39d634){_0x39d634=_0x39d634||0xcc;return function(_0x2ba1cb){if(_0x2ba1cb){return _0x11f168[_0xdbaa('0xe')](_0x39d634);}return _0x11f168[_0xdbaa('0xf')](_0x39d634)[_0xdbaa('0x10')]();};}function respondWithResult(_0x51af29,_0x810ae8){_0x810ae8=_0x810ae8||0xc8;return function(_0x406f43){if(_0x406f43){return _0x51af29[_0xdbaa('0xf')](_0x810ae8)[_0xdbaa('0x11')](_0x406f43);}};}function respondWithFilteredResult(_0xd2f8a8,_0x3dfc05){return function(_0x3f981d){if(_0x3f981d){var _0x36ab6b=typeof _0x3dfc05[_0xdbaa('0x12')]===_0xdbaa('0x13')&&typeof _0x3dfc05['limit']===_0xdbaa('0x13');var _0x2851b2=_0x3f981d[_0xdbaa('0x14')];var _0x3b99c4=_0x36ab6b?0x0:_0x3dfc05[_0xdbaa('0x12')];var _0x37e10c=_0x36ab6b?_0x3f981d[_0xdbaa('0x14')]:_0x3dfc05[_0xdbaa('0x12')]+_0x3dfc05[_0xdbaa('0x15')];var _0xd6d0fb;if(_0x37e10c>=_0x2851b2){_0x37e10c=_0x2851b2;_0xd6d0fb=0xc8;}else{_0xd6d0fb=0xce;}_0xd2f8a8[_0xdbaa('0xf')](_0xd6d0fb);return _0xd2f8a8['set'](_0xdbaa('0x16'),_0x3b99c4+'-'+_0x37e10c+'/'+_0x2851b2)[_0xdbaa('0x11')](_0x3f981d);}return null;};}function saveUpdates(_0x49c889){return function(_0xe51fe7){if(_0xe51fe7){return _0xe51fe7[_0xdbaa('0x17')](_0x49c889)[_0xdbaa('0x18')](function(_0x559199){return _0x559199;});}return null;};}function removeEntity(_0xa30e3){return function(_0x5c99f0){if(_0x5c99f0){return _0x5c99f0['destroy']()[_0xdbaa('0x18')](function(){_0xa30e3[_0xdbaa('0xf')](0xcc)[_0xdbaa('0x10')]();});}};}function handleEntityNotFound(_0xb2aad6){return function(_0x301eb0){if(!_0x301eb0){_0xb2aad6[_0xdbaa('0xe')](0x194);}return _0x301eb0;};}function handleError(_0x47f59f,_0x353321){_0x353321=_0x353321||0x1f4;return function(_0x460120){logger[_0xdbaa('0x19')](_0x460120['stack']);if(_0x460120[_0xdbaa('0x1a')]){delete _0x460120[_0xdbaa('0x1a')];}_0x47f59f[_0xdbaa('0xf')](_0x353321)['send'](_0x460120);};}exports[_0xdbaa('0x1b')]=function(_0x3dae83,_0x43e736){var _0x1fad5f={};var _0x14de85=_[_0xdbaa('0x1c')](db[_0xdbaa('0x1d')]['rawAttributes'],function(_0x4934d8){return{'name':_0x4934d8['fieldName'],'type':_0x4934d8[_0xdbaa('0x1e')][_0xdbaa('0x1f')]};});_0x1fad5f=qs['getOptions'](_0x14de85,_0x3dae83);return interaction[_0xdbaa('0x20')](_0xdbaa('0x21'),_0x3dae83[_0xdbaa('0x22')],_0x3dae83['user'],_0x1fad5f,_0x14de85)[_0xdbaa('0x18')](respondWithFilteredResult(_0x43e736,_0x1fad5f))['catch'](handleError(_0x43e736,null));};exports[_0xdbaa('0x23')]=function(_0x37e70d,_0xd51dc6){var _0x2d1609={'raw':![],'where':{'id':_0x37e70d['params']['id']}},_0x5bdc69={};_0x5bdc69[_0xdbaa('0x24')]=_[_0xdbaa('0x25')](db[_0xdbaa('0x1d')]['rawAttributes']);_0x5bdc69['query']=_[_0xdbaa('0x25')](_0x37e70d['query']);_0x5bdc69[_0xdbaa('0x26')]=_[_0xdbaa('0x27')](_0x5bdc69[_0xdbaa('0x24')],_0x5bdc69[_0xdbaa('0x22')]);_0x2d1609[_0xdbaa('0x28')]=_[_0xdbaa('0x27')](_0x5bdc69[_0xdbaa('0x24')],qs[_0xdbaa('0x29')](_0x37e70d[_0xdbaa('0x22')][_0xdbaa('0x29')]));_0x2d1609['attributes']=_0x2d1609['attributes'][_0xdbaa('0x2a')]?_0x2d1609[_0xdbaa('0x28')]:_0x5bdc69[_0xdbaa('0x24')];if(_0x37e70d[_0xdbaa('0x22')][_0xdbaa('0x2b')]){_0x2d1609[_0xdbaa('0x2c')]=[{'all':!![]}];}_0x2d1609=_[_0xdbaa('0x2d')]({},_0x2d1609,_0x37e70d[_0xdbaa('0x2e')]);return db['SmsInteraction'][_0xdbaa('0x2f')](_0x2d1609)['then'](handleEntityNotFound(_0xd51dc6,null))['then'](respondWithResult(_0xd51dc6,null))['catch'](handleError(_0xd51dc6,null));};exports[_0xdbaa('0x30')]=function(_0x481e67,_0x459bdb){return db[_0xdbaa('0x1d')][_0xdbaa('0x30')](_0x481e67[_0xdbaa('0x31')],{})['then'](respondWithResult(_0x459bdb,0xc9))[_0xdbaa('0x32')](handleError(_0x459bdb,null));};exports['update']=function(_0x38aea3,_0x2628a0){if(_0x38aea3[_0xdbaa('0x31')]['id']){delete _0x38aea3['body']['id'];}return db[_0xdbaa('0x1d')][_0xdbaa('0x2f')]({'where':{'id':_0x38aea3[_0xdbaa('0x33')]['id']}})['then'](handleEntityNotFound(_0x2628a0,null))['then'](saveUpdates(_0x38aea3[_0xdbaa('0x31')],null))['then'](respondWithResult(_0x2628a0,null))['catch'](handleError(_0x2628a0,null));};exports['destroy']=function(_0x257472,_0x4e6447){return db[_0xdbaa('0x1d')][_0xdbaa('0x2f')]({'where':{'id':_0x257472[_0xdbaa('0x33')]['id']}})['then'](handleEntityNotFound(_0x4e6447,null))['then'](removeEntity(_0x4e6447,null))[_0xdbaa('0x32')](handleError(_0x4e6447,null));};exports['describe']=function(_0x2b0403,_0x122817){return db[_0xdbaa('0x1d')][_0xdbaa('0x34')]()[_0xdbaa('0x18')](respondWithResult(_0x122817,null))[_0xdbaa('0x32')](handleError(_0x122817,null));};exports[_0xdbaa('0x35')]=function(_0x30a8c6,_0x285c35){return db[_0xdbaa('0x36')]['find']({'where':{'id':_0x30a8c6['params']['id']}})[_0xdbaa('0x18')](handleEntityNotFound(_0x285c35,null))['then'](function(_0x551441){if(_0x551441){return _0x551441['addMessage'](_0x30a8c6[_0xdbaa('0x31')][_0xdbaa('0x37')],_[_0xdbaa('0x38')](_0x30a8c6['body'],[_0xdbaa('0x37'),'id'])||{});}})[_0xdbaa('0x18')](respondWithResult(_0x285c35,null))['catch'](handleError(_0x285c35,null));};exports['getMessages']=function(_0x56aef3,_0x354eac){var _0x5a6dca={'raw':![],'where':{}};var _0xe4f312={};var _0x8106ce={'count':0x0,'rows':[]};return db[_0xdbaa('0x1d')][_0xdbaa('0x39')]({'where':{'id':_0x56aef3['params']['id']}})[_0xdbaa('0x18')](handleEntityNotFound(_0x354eac,null))[_0xdbaa('0x18')](function(_0x3d3a59){if(_0x3d3a59){_0xe4f312[_0xdbaa('0x24')]=_[_0xdbaa('0x25')](db['SmsMessage'][_0xdbaa('0x3a')]);_0xe4f312[_0xdbaa('0x22')]=_[_0xdbaa('0x25')](_0x56aef3[_0xdbaa('0x22')]);_0xe4f312[_0xdbaa('0x26')]=_['intersection'](_0xe4f312[_0xdbaa('0x24')],_0xe4f312['query']);_0x5a6dca['attributes']=_[_0xdbaa('0x27')](_0xe4f312[_0xdbaa('0x24')],qs[_0xdbaa('0x29')](_0x56aef3[_0xdbaa('0x22')]['fields']));_0x5a6dca[_0xdbaa('0x28')]=_0x5a6dca[_0xdbaa('0x28')][_0xdbaa('0x2a')]?_0x5a6dca['attributes']:_0xe4f312['model'];if(!_0x56aef3['query'][_0xdbaa('0x3b')]('nolimit')){_0x5a6dca[_0xdbaa('0x15')]=qs[_0xdbaa('0x15')](_0x56aef3[_0xdbaa('0x22')][_0xdbaa('0x15')]);_0x5a6dca[_0xdbaa('0x12')]=qs[_0xdbaa('0x12')](_0x56aef3[_0xdbaa('0x22')][_0xdbaa('0x12')]);}_0x5a6dca[_0xdbaa('0x3c')]=qs['sort'](_0x56aef3[_0xdbaa('0x22')]['sort']);_0x5a6dca['where']=qs[_0xdbaa('0x26')](_[_0xdbaa('0x3d')](_0x56aef3[_0xdbaa('0x22')],_0xe4f312[_0xdbaa('0x26')]));_0x5a6dca[_0xdbaa('0x3e')][_0xdbaa('0x3f')]=_0x3d3a59['id'];if(_0x56aef3[_0xdbaa('0x22')][_0xdbaa('0x40')]){_0x5a6dca[_0xdbaa('0x3e')]=_[_0xdbaa('0x2d')](_0x5a6dca[_0xdbaa('0x3e')],{'$or':_['map'](_0x5a6dca[_0xdbaa('0x28')],function(_0x47b25d){var _0x289df5={};_0x289df5[_0x47b25d]={'$like':'%'+_0x56aef3[_0xdbaa('0x22')][_0xdbaa('0x40')]+'%'};return _0x289df5;})});}if(_0x56aef3[_0xdbaa('0x22')][_0xdbaa('0x41')]){var _0x29b70d=_0x56aef3[_0xdbaa('0x22')][_0xdbaa('0x41')][_0xdbaa('0x42')](',');var _0x233e53={};_0x233e53[_0x29b70d[0x0]]={'$gte':moment(_0x29b70d[0x1])[_0xdbaa('0x43')](_0xdbaa('0x44'))};_0x5a6dca[_0xdbaa('0x3e')]=_['merge'](_0x5a6dca[_0xdbaa('0x3e')],_0x233e53);}_0x5a6dca=_[_0xdbaa('0x2d')]({},_0x5a6dca,_0x56aef3[_0xdbaa('0x2e')]);return db[_0xdbaa('0x36')]['count']({'where':_0x5a6dca[_0xdbaa('0x3e')]})['then'](function(_0x13e4dc){_0x8106ce[_0xdbaa('0x14')]=_0x13e4dc;if(_0x56aef3[_0xdbaa('0x22')][_0xdbaa('0x2b')]){_0x5a6dca[_0xdbaa('0x2c')]=[{'all':!![]}];}return db[_0xdbaa('0x36')][_0xdbaa('0x20')](_0x5a6dca);})['then'](function(_0x590da5){_0x8106ce['rows']=_0x590da5;return _0x8106ce;});}})[_0xdbaa('0x18')](respondWithFilteredResult(_0x354eac,_0x5a6dca))[_0xdbaa('0x32')](handleError(_0x354eac,null));};exports['addTags']=function(_0xb778b1,_0x166a69){return db[_0xdbaa('0x1d')]['find']({'where':{'id':_0xb778b1[_0xdbaa('0x33')]['id']}})['then'](handleEntityNotFound(_0x166a69,null))[_0xdbaa('0x18')](function(_0x45c127){if(_0x45c127){return _0x45c127[_0xdbaa('0x45')](_0xb778b1['body'][_0xdbaa('0x37')],_[_0xdbaa('0x38')](_0xb778b1[_0xdbaa('0x31')],[_0xdbaa('0x37'),'id'])||{})[_0xdbaa('0x46')](function(){return db[_0xdbaa('0x47')][_0xdbaa('0x20')]({'attributes':['id',_0xdbaa('0x1a'),_0xdbaa('0x48')],'where':{'id':_0xb778b1[_0xdbaa('0x31')]['ids']}});})[_0xdbaa('0x18')](function(_0x1f739e){socket[_0xdbaa('0x49')]('smsInteractionTags:save',{'id':Number(_0xb778b1[_0xdbaa('0x33')]['id']),'tags':_0x1f739e||[]});return{'id':Number(_0xb778b1[_0xdbaa('0x33')]['id']),'tags':_0x1f739e||[]};});}})[_0xdbaa('0x18')](respondWithResult(_0x166a69,null))[_0xdbaa('0x32')](handleError(_0x166a69,null));};exports[_0xdbaa('0x4a')]=function(_0x553b47,_0x30153c){return db[_0xdbaa('0x1d')][_0xdbaa('0x2f')]({'where':{'id':_0x553b47[_0xdbaa('0x33')]['id']}})[_0xdbaa('0x18')](handleEntityNotFound(_0x30153c,null))[_0xdbaa('0x18')](function(_0x350425){if(_0x350425){return _0x350425['removeTags'](_0x553b47[_0xdbaa('0x22')][_0xdbaa('0x37')]);}})[_0xdbaa('0x18')](respondWithStatusCode(_0x30153c,null))[_0xdbaa('0x32')](handleError(_0x30153c,null));};exports['download']=function(_0x1e46fd,_0x2c6a26){var _0x2422ee=moment()[_0xdbaa('0x4b')]()[_0xdbaa('0x4c')]();var _0xfada29=path['join'](config[_0xdbaa('0x4d')],_0xdbaa('0x4e'),_0xdbaa('0x4f'),'tmp');var _0x1d2f27=path[_0xdbaa('0x50')](_0xfada29,_0x2422ee);var _0x433c81=util[_0xdbaa('0x43')](_0xdbaa('0x51'),_0x1e46fd[_0xdbaa('0x33')]['id'],_0x2422ee);var _0x1b4ceb=path[_0xdbaa('0x50')](_0xfada29,_0x433c81);var _0x3ff766=[];_0x3ff766[_0xdbaa('0x52')]({'model':db[_0xdbaa('0x53')],'as':_0xdbaa('0x53'),'attributes':['id',_0xdbaa('0x54')],'raw':!![]});_0x3ff766[_0xdbaa('0x52')]({'model':db[_0xdbaa('0x55')],'as':_0xdbaa('0x56'),'attributes':['id',_0xdbaa('0x57'),'lastName'],'raw':!![]});var _0x141d66=[{'model':db[_0xdbaa('0x36')],'as':_0xdbaa('0x58'),'attributes':['id',_0xdbaa('0x31'),'createdAt','direction',_0xdbaa('0x59'),_0xdbaa('0x5a')],'include':_0x3ff766}];_0x141d66[_0xdbaa('0x52')]({'model':db[_0xdbaa('0x5b')],'as':_0xdbaa('0x5c'),'attributes':['id',_0xdbaa('0x1a')]});_0x141d66[_0xdbaa('0x52')]({'model':db['User'],'as':_0xdbaa('0x5d'),'attributes':['id',_0xdbaa('0x54')]});return db[_0xdbaa('0x1d')][_0xdbaa('0x2f')]({'where':{'id':_0x1e46fd[_0xdbaa('0x33')]['id']},'include':_0x141d66})[_0xdbaa('0x18')](handleEntityNotFound(_0x2c6a26,null))[_0xdbaa('0x18')](function(_0x549336){if(_0x549336){var _0x15b5b2=_0x549336[_0xdbaa('0x5e')]({'plain':!![]});fs[_0xdbaa('0x5f')](_0x1d2f27);var _0x2656b8={'channel':_0xdbaa('0x60'),'account':_0x15b5b2[_0xdbaa('0x5c')]['name'],'agent':_0x15b5b2[_0xdbaa('0x5d')]?_0x15b5b2[_0xdbaa('0x5d')][_0xdbaa('0x54')]:_0xdbaa('0x61'),'createdAt':moment(_0x15b5b2[_0xdbaa('0x62')])[_0xdbaa('0x43')](_0xdbaa('0x44'))[_0xdbaa('0x4c')](),'closedAt':_0x15b5b2[_0xdbaa('0x63')]?moment(_0x15b5b2[_0xdbaa('0x64')])[_0xdbaa('0x43')](_0xdbaa('0x44'))['toString']():'','disposition':_0x15b5b2['disposition'],'messages':_(_0x15b5b2[_0xdbaa('0x58')])[_0xdbaa('0x40')]({'secret':![]})[_0xdbaa('0x1c')](function(_0x4400a7){return{'date':moment(_0x4400a7[_0xdbaa('0x62')])[_0xdbaa('0x43')](_0xdbaa('0x44'))['toString'](),'sender':_0x4400a7[_0xdbaa('0x65')]===_0xdbaa('0x66')?_0x4400a7[_0xdbaa('0x53')]?_0x4400a7[_0xdbaa('0x53')][_0xdbaa('0x54')]:_0xdbaa('0x67'):_0x4400a7['Contact'][_0xdbaa('0x57')]+(_0x4400a7[_0xdbaa('0x56')][_0xdbaa('0x68')]?'\x20'+_0x4400a7['Contact'][_0xdbaa('0x68')]:''),'body':_0x4400a7[_0xdbaa('0x31')],'direction':_0x4400a7[_0xdbaa('0x65')]==='out'?'A':'C','secret':_0x4400a7[_0xdbaa('0x59')],'read':_0x4400a7[_0xdbaa('0x5a')]};})[_0xdbaa('0x69')]()};return ejs['renderFile'](path[_0xdbaa('0x50')](config[_0xdbaa('0x4d')],_0xdbaa('0x4e'),_0xdbaa('0x6a'),'downloadInteraction.ejs'),{'interaction':_0x2656b8})[_0xdbaa('0x18')](function(_0x3b8123){var _0x386a37=path[_0xdbaa('0x50')](_0x1d2f27,'transcript-'+_0x15b5b2['id']+'-'+_0x2422ee+'.pdf');var _0x1782cd={'path':_0x386a37,'channel':_0xdbaa('0x60'),'interactionId':_0x15b5b2['id']};return pdf['createPdfFromHTML'](_0x3b8123,_0x1782cd);})[_0xdbaa('0x18')](function(){return new BPromise(function(_0x3bff96,_0x270b2e){zipdir(_0x1d2f27,{'saveTo':_0x1b4ceb},function(_0x5f414a,_0x1ce1c5){if(_0x5f414a)return _0x270b2e(_0x5f414a);return _0x3bff96(_0x1ce1c5);});})['then'](function(){return new BPromise(function(_0x26368d,_0x66bd42){rimraf(_0x1d2f27,function(_0x3705a5){if(_0x3705a5)_0x66bd42(_0x3705a5);return _0x26368d();});});})[_0xdbaa('0x18')](function(){return _0x2c6a26['download'](_0x1b4ceb,_0x433c81,function(_0x1f6c39){if(_0x1f6c39){console['log'](_0xdbaa('0x6b'),_0x1f6c39);}else{fs[_0xdbaa('0x6c')](_0x1b4ceb);}});});});}else{return _0x2c6a26[_0xdbaa('0xe')](0xc8);}})[_0xdbaa('0x32')](handleError(_0x2c6a26,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ff9b019..9d6ce6d 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 _0x0598=['catch','hasOwnProperty','events','../../mysqldb','save','update','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x42bc9f,_0x45beff){var _0x314518=function(_0x5b7996){while(--_0x5b7996){_0x42bc9f['push'](_0x42bc9f['shift']());}};_0x314518(++_0x45beff);}(_0x0598,0x92));var _0x8059=function(_0x333d04,_0x492614){_0x333d04=_0x333d04-0x0;var _0x26f093=_0x0598[_0x333d04];return _0x26f093;};'use strict';var EventEmitter=require(_0x8059('0x0'));var SmsInteraction=require(_0x8059('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8059('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8059('0x2'),'afterUpdate':_0x8059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54f42f){return function(_0x555fb5,_0x467206,_0xa7d7c1){_0x555fb5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x248273){_0x555fb5[_0x8059('0x4')](_0x8059('0x5'),_0x248273[_0x8059('0x6')](function(_0x5df268){return{'id':_0x5df268['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x555fb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8059('0x7')](function(_0x1bf5fd){_0x555fb5[_0x8059('0x4')](_0x8059('0x8'),_0x1bf5fd[_0x8059('0x9')]);SmsInteractionEvents['emit'](_0x54f42f+':'+_0x555fb5['id'],_0x555fb5);SmsInteractionEvents['emit'](_0x54f42f,_0x555fb5);_0xa7d7c1(null);})[_0x8059('0xa')](_0xa7d7c1(null));};}for(var e in events){if(events[_0x8059('0xb')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x8603=['update','remove','getUsers','then','setDataValue','findAll','unreadMessages','emit','hasOwnProperty','hook','../../mysqldb','SmsInteraction','save'];(function(_0x523cbd,_0x4a8282){var _0x4952a6=function(_0x29d3c0){while(--_0x29d3c0){_0x523cbd['push'](_0x523cbd['shift']());}};_0x4952a6(++_0x4a8282);}(_0x8603,0x190));var _0x3860=function(_0x1de4c7,_0x188302){_0x1de4c7=_0x1de4c7-0x0;var _0x4d4658=_0x8603[_0x1de4c7];return _0x4d4658;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x3860('0x0'))['db'][_0x3860('0x1')];var SmsMessage=require(_0x3860('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3860('0x2'),'afterUpdate':_0x3860('0x3'),'afterDestroy':_0x3860('0x4')};function emitEvent(_0x490262){return function(_0x2fc97a,_0x56f8c5,_0xb0fc24){_0x2fc97a[_0x3860('0x5')]({'attributes':['id'],'raw':!![]})[_0x3860('0x6')](function(_0xd3ce26){_0x2fc97a[_0x3860('0x7')]('Users',_0xd3ce26['map'](function(_0x5b1ac8){return{'id':_0x5b1ac8['id']};}));return SmsMessage[_0x3860('0x8')]({'where':{'SmsInteractionId':_0x2fc97a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3860('0x6')](function(_0x52c277){_0x2fc97a[_0x3860('0x7')](_0x3860('0x9'),_0x52c277['length']);SmsInteractionEvents[_0x3860('0xa')](_0x490262+':'+_0x2fc97a['id'],_0x2fc97a);SmsInteractionEvents[_0x3860('0xa')](_0x490262,_0x2fc97a);_0xb0fc24(null);})['catch'](_0xb0fc24(null));};}for(var e in events){if(events[_0x3860('0xb')](e)){var event=events[e];SmsInteraction[_0x3860('0xc')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5b5d43e..3be35be 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 _0x4620=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions'];(function(_0x4677e3,_0x26e835){var _0x5a1e43=function(_0x7961fd){while(--_0x7961fd){_0x4677e3['push'](_0x4677e3['shift']());}};_0x5a1e43(++_0x26e835);}(_0x4620,0x159));var _0x0462=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x4620[_0x4f0c2b];return _0x526436;};'use strict';var _=require(_0x0462('0x0'));var util=require(_0x0462('0x1'));var logger=require('../../config/logger')(_0x0462('0x2'));var moment=require(_0x0462('0x3'));var BPromise=require(_0x0462('0x4'));var rp=require(_0x0462('0x5'));var fs=require('fs');var path=require(_0x0462('0x6'));var rimraf=require('rimraf');var config=require(_0x0462('0x7'));var attributes=require(_0x0462('0x8'));module['exports']=function(_0x8ca52f,_0x2ffa03){return _0x8ca52f[_0x0462('0x9')](_0x0462('0xa'),attributes,{'tableName':_0x0462('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59e797,_0x22fd42,_0x24eb13){if(_0x59e797[_0x0462('0xc')](_0x0462('0xd'))){_0x59e797[_0x0462('0xe')]=moment()[_0x0462('0xf')](_0x0462('0x10'));}_0x24eb13(null,_0x59e797);}}});}; \ No newline at end of file +var _0x21e7=['moment','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x21e7,0x1bb));var _0x721e=function(_0x3a4a71,_0x729b1e){_0x3a4a71=_0x3a4a71-0x0;var _0x4aa4e5=_0x21e7[_0x3a4a71];return _0x4aa4e5;};'use strict';var _=require('lodash');var util=require(_0x721e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x721e('0x1'));var BPromise=require('bluebird');var rp=require(_0x721e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x721e('0x3'));var attributes=require(_0x721e('0x4'));module[_0x721e('0x5')]=function(_0x56bff9,_0xd2ff7e){return _0x56bff9[_0x721e('0x6')](_0x721e('0x7'),attributes,{'tableName':_0x721e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8b6874,_0x4905ab,_0x143eb4){if(_0x8b6874['changed'](_0x721e('0x9'))){_0x8b6874[_0x721e('0xa')]=moment()['format'](_0x721e('0xb'));}_0x143eb4(null,_0x8b6874);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 632dbcc..d820648 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 _0x542f=['../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','body','options','where','attributes','limit','debug','UpdateSmsInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','../../config/utils'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x542f,0xd9));var _0xf542=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0x542f[_0x4a96ca];return _0x2aed48;};'use strict';var _=require(_0xf542('0x0'));var util=require(_0xf542('0x1'));var moment=require(_0xf542('0x2'));var BPromise=require(_0xf542('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf542('0x4'));var logger=require(_0xf542('0x5'))(_0xf542('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf542('0x7')]['http']({'port':0x232a});config[_0xf542('0x8')]=_[_0xf542('0x9')](config[_0xf542('0x8')],{'host':_0xf542('0xa'),'port':0x18eb});var socket=require(_0xf542('0xb'))(new Redis(config[_0xf542('0x8')]));require(_0xf542('0xc'))[_0xf542('0xd')](socket);function respondWithRpcPromise(_0x978f20,_0x557777,_0x586703){return new BPromise(function(_0x1c499d,_0x2e3357){return client[_0xf542('0xe')](_0x978f20,_0x586703)[_0xf542('0xf')](function(_0x1668ce){logger[_0xf542('0x10')](_0xf542('0x11'),_0x557777,_0xf542('0x12'));logger['debug'](_0xf542('0x13'),_0x557777,_0xf542('0x12'),JSON[_0xf542('0x14')](_0x1668ce));if(_0x1668ce['error']){if(_0x1668ce[_0xf542('0x15')][_0xf542('0x16')]===0x1f4){logger[_0xf542('0x15')](_0xf542('0x11'),_0x557777,_0x1668ce[_0xf542('0x15')][_0xf542('0x17')]);return _0x2e3357(_0x1668ce[_0xf542('0x15')]['message']);}logger[_0xf542('0x15')](_0xf542('0x11'),_0x557777,_0x1668ce[_0xf542('0x15')][_0xf542('0x17')]);return _0x1c499d(_0x1668ce[_0xf542('0x15')][_0xf542('0x17')]);}else{logger[_0xf542('0x10')](_0xf542('0x11'),_0x557777,_0xf542('0x12'));_0x1c499d(_0x1668ce['result'][_0xf542('0x17')]);}})[_0xf542('0x18')](function(_0x5f1e1f){logger[_0xf542('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x557777,_0x5f1e1f);_0x2e3357(_0x5f1e1f);});});}exports['UpdateSmsInteraction']=function(_0x5bc9be){var _0x454f95=this;return new Promise(function(_0x34d478,_0x546ad0){return db['SmsInteraction']['update'](_0x5bc9be[_0xf542('0x19')],{'raw':_0x5bc9be[_0xf542('0x1a')]?_0x5bc9be['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bc9be['options']?_0x5bc9be[_0xf542('0x1a')][_0xf542('0x1b')]||null:null,'attributes':_0x5bc9be[_0xf542('0x1a')]?_0x5bc9be[_0xf542('0x1a')][_0xf542('0x1c')]||null:null,'limit':_0x5bc9be[_0xf542('0x1a')]?_0x5bc9be[_0xf542('0x1a')][_0xf542('0x1d')]||null:null})['then'](function(_0x4cc742){logger[_0xf542('0x10')]('UpdateSmsInteraction',_0x5bc9be);logger[_0xf542('0x1e')](_0xf542('0x1f'),_0x5bc9be,JSON[_0xf542('0x14')](_0x4cc742));_0x34d478(_0x4cc742);})['catch'](function(_0xe726eb){logger[_0xf542('0x15')](_0xf542('0x1f'),_0xe726eb['message'],_0x5bc9be);_0x546ad0(_0x454f95[_0xf542('0x15')](0x1f4,_0xe726eb[_0xf542('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x51e873){return new Promise(function(_0x24c1ec,_0x527d0b){return db['SmsInteraction'][_0xf542('0x20')]({'where':_0x51e873[_0xf542('0x1a')]?_0x51e873['options'][_0xf542('0x1b')]||null:null})[_0xf542('0xf')](function(_0x57b008){if(_0x57b008){return _0x57b008[_0xf542('0x21')](_0x51e873['body']['ids'],_[_0xf542('0x22')](_0x51e873['body'],['ids','id'])||{});}})[_0xf542('0x23')](function(_0x655b11){logger[_0xf542('0x10')](_0xf542('0x24'),_0x51e873);logger['debug'](_0xf542('0x24'),_0x51e873,JSON[_0xf542('0x14')](_0x655b11));_0x24c1ec(_0x655b11);})[_0xf542('0x18')](function(_0x4622f5){logger[_0xf542('0x15')](_0xf542('0x24'),_0x4622f5[_0xf542('0x17')],_0x51e873);_0x527d0b(_this['error'](0x1f4,_0x4622f5[_0xf542('0x17')]));});});}; \ No newline at end of file +var _0x5cd2=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','SmsInteraction,\x20%s,\x20%s','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','stringify','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cd2,0xa3));var _0x25cd=function(_0x213dd6,_0x21c908){_0x213dd6=_0x213dd6-0x0;var _0x4d33c3=_0x5cd2[_0x213dd6];return _0x4d33c3;};'use strict';var _=require(_0x25cd('0x0'));var util=require('util');var moment=require(_0x25cd('0x1'));var BPromise=require(_0x25cd('0x2'));var rs=require(_0x25cd('0x3'));var fs=require('fs');var Redis=require(_0x25cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x25cd('0x5'));var logger=require(_0x25cd('0x6'))(_0x25cd('0x7'));var config=require(_0x25cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25cd('0x9')][_0x25cd('0xa')]({'port':0x232a});config[_0x25cd('0xb')]=_[_0x25cd('0xc')](config[_0x25cd('0xb')],{'host':_0x25cd('0xd'),'port':0x18eb});var socket=require(_0x25cd('0xe'))(new Redis(config[_0x25cd('0xb')]));require(_0x25cd('0xf'))['register'](socket);function respondWithRpcPromise(_0x53b999,_0x3dfa21,_0x79074){return new BPromise(function(_0x544e89,_0x20509b){return client[_0x25cd('0x10')](_0x53b999,_0x79074)[_0x25cd('0x11')](function(_0x2261e5){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3dfa21,'request\x20sent');logger[_0x25cd('0x12')](_0x25cd('0x13'),_0x3dfa21,_0x25cd('0x14'),JSON['stringify'](_0x2261e5));if(_0x2261e5[_0x25cd('0x15')]){if(_0x2261e5[_0x25cd('0x15')]['code']===0x1f4){logger[_0x25cd('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x3dfa21,_0x2261e5[_0x25cd('0x15')][_0x25cd('0x16')]);return _0x20509b(_0x2261e5[_0x25cd('0x15')]['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x3dfa21,_0x2261e5['error'][_0x25cd('0x16')]);return _0x544e89(_0x2261e5[_0x25cd('0x15')]['message']);}else{logger[_0x25cd('0x17')](_0x25cd('0x18'),_0x3dfa21,'request\x20sent');_0x544e89(_0x2261e5[_0x25cd('0x19')][_0x25cd('0x16')]);}})[_0x25cd('0x1a')](function(_0x426e92){logger['error'](_0x25cd('0x18'),_0x3dfa21,_0x426e92);_0x20509b(_0x426e92);});});}exports[_0x25cd('0x1b')]=function(_0x2d2916){var _0x2389df=this;return new Promise(function(_0x533fed,_0x7f0291){return db[_0x25cd('0x1c')]['update'](_0x2d2916[_0x25cd('0x1d')],{'raw':_0x2d2916['options']?_0x2d2916[_0x25cd('0x1e')][_0x25cd('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d2916[_0x25cd('0x1e')]?_0x2d2916[_0x25cd('0x1e')][_0x25cd('0x20')]||null:null,'attributes':_0x2d2916['options']?_0x2d2916[_0x25cd('0x1e')][_0x25cd('0x21')]||null:null,'limit':_0x2d2916[_0x25cd('0x1e')]?_0x2d2916[_0x25cd('0x1e')]['limit']||null:null})[_0x25cd('0x11')](function(_0x1fcf2e){logger[_0x25cd('0x17')](_0x25cd('0x1b'),_0x2d2916);logger[_0x25cd('0x12')](_0x25cd('0x1b'),_0x2d2916,JSON[_0x25cd('0x22')](_0x1fcf2e));_0x533fed(_0x1fcf2e);})[_0x25cd('0x1a')](function(_0x193540){logger[_0x25cd('0x15')](_0x25cd('0x1b'),_0x193540[_0x25cd('0x16')],_0x2d2916);_0x7f0291(_0x2389df['error'](0x1f4,_0x193540[_0x25cd('0x16')]));});});};exports[_0x25cd('0x23')]=function(_0x354a50){return new Promise(function(_0x11dba3,_0x121a50){return db['SmsInteraction']['find']({'where':_0x354a50['options']?_0x354a50[_0x25cd('0x1e')][_0x25cd('0x20')]||null:null})[_0x25cd('0x11')](function(_0x3e0247){if(_0x3e0247){return _0x3e0247[_0x25cd('0x24')](_0x354a50[_0x25cd('0x1d')][_0x25cd('0x25')],_[_0x25cd('0x26')](_0x354a50[_0x25cd('0x1d')],[_0x25cd('0x25'),'id'])||{});}})[_0x25cd('0x27')](function(_0x12f041){logger[_0x25cd('0x17')](_0x25cd('0x28'),_0x354a50);logger[_0x25cd('0x12')](_0x25cd('0x28'),_0x354a50,JSON[_0x25cd('0x22')](_0x12f041));_0x11dba3(_0x12f041);})['catch'](function(_0x53929d){logger[_0x25cd('0x15')]('AddTags',_0x53929d[_0x25cd('0x16')],_0x354a50);_0x121a50(_this[_0x25cd('0x15')](0x1f4,_0x53929d[_0x25cd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 9a1952e..94abcdf 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 _0x5e8d=['emit','removeListener','smsInteraction:','update'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5e8d,0xb3));var _0xd5e8=function(_0x1325da,_0xfcf3e6){_0x1325da=_0x1325da-0x0;var _0x1c2d83=_0x5e8d[_0x1325da];return _0x1c2d83;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save','remove',_0xd5e8('0x0')];function createListener(_0x3c2a5e,_0x466079){return function(_0xe2150){_0x466079[_0xd5e8('0x1')](_0x3c2a5e,_0xe2150);};}function removeListener(_0x5623a6,_0x55d01f){return function(){SmsInteractionEvents[_0xd5e8('0x2')](_0x5623a6,_0x55d01f);};}exports['register']=function(_0x4c449a){for(var _0x1cbff0=0x0,_0x3d5efd=events['length'];_0x1cbff0<_0x3d5efd;_0x1cbff0++){var _0x21e69b=events[_0x1cbff0];var _0x5e43bf=createListener(_0xd5e8('0x3')+_0x21e69b,_0x4c449a);SmsInteractionEvents['on'](_0x21e69b,_0x5e43bf);}}; \ No newline at end of file +var _0x3e49=['emit','register','length','save','remove','update'];(function(_0x14223b,_0x50dda7){var _0x443a4c=function(_0x204f34){while(--_0x204f34){_0x14223b['push'](_0x14223b['shift']());}};_0x443a4c(++_0x50dda7);}(_0x3e49,0x17d));var _0x93e4=function(_0x31779a,_0x23a359){_0x31779a=_0x31779a-0x0;var _0x24794e=_0x3e49[_0x31779a];return _0x24794e;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x93e4('0x0'),_0x93e4('0x1'),_0x93e4('0x2')];function createListener(_0x1cff9d,_0x1d32fb){return function(_0x46e1ff){_0x1d32fb[_0x93e4('0x3')](_0x1cff9d,_0x46e1ff);};}function removeListener(_0x248ee4,_0x4111b1){return function(){SmsInteractionEvents['removeListener'](_0x248ee4,_0x4111b1);};}exports[_0x93e4('0x4')]=function(_0x1bfd8b){for(var _0x34dd82=0x0,_0x14c4d1=events[_0x93e4('0x5')];_0x34dd82<_0x14c4d1;_0x34dd82++){var _0x4c133f=events[_0x34dd82];var _0x3ae586=createListener('smsInteraction:'+_0x4c133f,_0x1bfd8b);SmsInteractionEvents['on'](_0x4c133f,_0x3ae586);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ef74ef8..c0ee62c 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 _0x0551=['sms','smsmessage:create','create','/:id/status','status','put','update','accept','reject','delete','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x343a57,_0x3c26e3){var _0x9b3087=function(_0x4c0df9){while(--_0x4c0df9){_0x343a57['push'](_0x343a57['shift']());}};_0x9b3087(++_0x3c26e3);}(_0x0551,0x191));var _0x1055=function(_0x3fffdb,_0x18964c){_0x3fffdb=_0x3fffdb-0x0;var _0x5a9235=_0x0551[_0x3fffdb];return _0x5a9235;};'use strict';var multer=require(_0x1055('0x0'));var util=require('util');var path=require(_0x1055('0x1'));var timeout=require(_0x1055('0x2'));var express=require(_0x1055('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1055('0x4'));var config=require(_0x1055('0x5'));var controller=require(_0x1055('0x6'));router[_0x1055('0x7')]('/',auth[_0x1055('0x8')](),controller[_0x1055('0x9')]);router[_0x1055('0x7')](_0x1055('0xa'),auth[_0x1055('0x8')](),controller[_0x1055('0xb')]);router[_0x1055('0x7')](_0x1055('0xc'),auth[_0x1055('0x8')](),controller[_0x1055('0xd')]);router[_0x1055('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x1055('0xf'),_0x1055('0x10')),controller[_0x1055('0x11')]);router[_0x1055('0xe')](_0x1055('0x12'),controller[_0x1055('0x13')]);router[_0x1055('0x14')](_0x1055('0xc'),auth[_0x1055('0x8')](),controller[_0x1055('0x15')]);router[_0x1055('0x14')]('/:id/accept',auth[_0x1055('0x8')](),controller[_0x1055('0x16')]);router['put']('/:id/reject',auth[_0x1055('0x8')](),controller[_0x1055('0x17')]);router[_0x1055('0x18')](_0x1055('0xc'),auth[_0x1055('0x8')](),controller[_0x1055('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7229=['tracked','create','/:id/status','status','update','put','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x7229,0x76));var _0x9722=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x7229[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var path=require(_0x9722('0x2'));var timeout=require(_0x9722('0x3'));var express=require(_0x9722('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9722('0x5'));var interaction=require(_0x9722('0x6'));var config=require(_0x9722('0x7'));var controller=require(_0x9722('0x8'));router[_0x9722('0x9')]('/',auth[_0x9722('0xa')](),controller[_0x9722('0xb')]);router['get'](_0x9722('0xc'),auth['isAuthenticated'](),controller[_0x9722('0xd')]);router[_0x9722('0x9')](_0x9722('0xe'),auth[_0x9722('0xa')](),controller[_0x9722('0xf')]);router[_0x9722('0x10')]('/',auth[_0x9722('0xa')](),interaction[_0x9722('0x11')]('sms','smsmessage:create'),controller[_0x9722('0x12')]);router[_0x9722('0x10')](_0x9722('0x13'),controller[_0x9722('0x14')]);router['put'](_0x9722('0xe'),auth[_0x9722('0xa')](),controller[_0x9722('0x15')]);router[_0x9722('0x16')]('/:id/accept',auth[_0x9722('0xa')](),controller[_0x9722('0x17')]);router[_0x9722('0x16')](_0x9722('0x18'),auth[_0x9722('0xa')](),controller['reject']);router[_0x9722('0x19')](_0x9722('0xe'),auth[_0x9722('0xa')](),controller['destroy']);module[_0x9722('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 6a69f98..f265884 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 _0xe526=['sequelize','exports','TEXT','medium','out','STRING','DATE'];(function(_0x343762,_0x33878d){var _0x5b6557=function(_0x4755f4){while(--_0x4755f4){_0x343762['push'](_0x343762['shift']());}};_0x5b6557(++_0x33878d);}(_0xe526,0x103));var _0x6e52=function(_0x2389f2,_0x56e8da){_0x2389f2=_0x2389f2-0x0;var _0x168428=_0xe526[_0x2389f2];return _0x168428;};'use strict';var Sequelize=require(_0x6e52('0x0'));module[_0x6e52('0x1')]={'body':{'type':Sequelize[_0x6e52('0x2')](_0x6e52('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6e52('0x4')),'defaultValue':_0x6e52('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6e52('0x5')](0xbe)},'phone':{'type':Sequelize[_0x6e52('0x5')]},'readAt':{'type':Sequelize[_0x6e52('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6e52('0x2')]}}; \ No newline at end of file +var _0x9ac9=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x16486e,_0x5b56dc){var _0x4da6b6=function(_0x100ee6){while(--_0x100ee6){_0x16486e['push'](_0x16486e['shift']());}};_0x4da6b6(++_0x5b56dc);}(_0x9ac9,0x1b9));var _0x99ac=function(_0x275e4e,_0x278c1f){_0x275e4e=_0x275e4e-0x0;var _0xb475a9=_0x9ac9[_0x275e4e];return _0xb475a9;};'use strict';var Sequelize=require(_0x99ac('0x0'));module['exports']={'body':{'type':Sequelize[_0x99ac('0x1')](_0x99ac('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x99ac('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x99ac('0x4')]('in','out'),'defaultValue':_0x99ac('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x99ac('0x6')]},'readAt':{'type':Sequelize[_0x99ac('0x7')]},'secret':{'type':Sequelize[_0x99ac('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x99ac('0x6')]},'providerResponse':{'type':Sequelize[_0x99ac('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index badec1c..9ddf679 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 _0x431b=['send','index','map','SmsMessage','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','update','isNil','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','fullname','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','delivered','Status','plivio','results','groupName','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','reject','save','then','destroy','stack','name'];(function(_0x350cf4,_0x7dd1a6){var _0x4bcef4=function(_0x3469b1){while(--_0x3469b1){_0x350cf4['push'](_0x350cf4['shift']());}};_0x4bcef4(++_0x7dd1a6);}(_0x431b,0x18d));var _0xb431=function(_0x5c8643,_0x4f7c4d){_0x5c8643=_0x5c8643-0x0;var _0x546259=_0x431b[_0x5c8643];return _0x546259;};'use strict';var emlformat=require(_0xb431('0x0'));var rimraf=require(_0xb431('0x1'));var zipdir=require(_0xb431('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb431('0x3'));var moment=require(_0xb431('0x4'));var BPromise=require(_0xb431('0x5'));var Mustache=require(_0xb431('0x6'));var util=require(_0xb431('0x7'));var path=require(_0xb431('0x8'));var sox=require(_0xb431('0x9'));var csv=require('to-csv');var ejs=require(_0xb431('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb431('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb431('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb431('0xd'));var Papa=require(_0xb431('0xe'));var Redis=require(_0xb431('0xf'));var authService=require(_0xb431('0x10'));var qs=require(_0xb431('0x11'));var as=require(_0xb431('0x12'));var hardwareService=require(_0xb431('0x13'));var logger=require('../../config/logger')(_0xb431('0x14'));var utils=require(_0xb431('0x15'));var config=require(_0xb431('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb431('0x17'))['db'];config[_0xb431('0x18')]=_[_0xb431('0x19')](config[_0xb431('0x18')],{'host':_0xb431('0x1a'),'port':0x18eb});var socket=require(_0xb431('0x1b'))(new Redis(config['redis']));require(_0xb431('0x1c'))['register'](socket);var jayson=require(_0xb431('0x1d'));var client=jayson[_0xb431('0x1e')][_0xb431('0x1f')]({'port':0x232c});var client9002=jayson[_0xb431('0x1e')][_0xb431('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x163b4c,_0x4ddfab,_0x339474,_0x592db9){return new BPromise(function(_0xc73c8a,_0x2c2259){var _0xa77346=_0x592db9||client;return _0xa77346[_0xb431('0x20')](_0x163b4c,_0x339474)['then'](function(_0x43a4d8){logger[_0xb431('0x21')]('SmsMessage,\x20%s,\x20%s',_0x4ddfab,_0xb431('0x22'));logger[_0xb431('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ddfab,'request\x20sent',JSON[_0xb431('0x24')](_0x43a4d8));if(_0x43a4d8[_0xb431('0x25')]){if(_0x43a4d8[_0xb431('0x25')][_0xb431('0x26')]===0x1f4){logger[_0xb431('0x25')](_0xb431('0x27'),_0x4ddfab,_0x43a4d8[_0xb431('0x25')][_0xb431('0x28')]);return _0x2c2259(_0x43a4d8['error']['message']);}logger[_0xb431('0x25')](_0xb431('0x27'),_0x4ddfab,_0x43a4d8[_0xb431('0x25')][_0xb431('0x28')]);return _0xc73c8a(_0x43a4d8[_0xb431('0x25')][_0xb431('0x28')]);}else{logger[_0xb431('0x21')](_0xb431('0x27'),_0x4ddfab,_0xb431('0x22'));_0xc73c8a(_0x43a4d8['result'][_0xb431('0x28')]);}})[_0xb431('0x29')](function(_0x840632){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4ddfab,_0x840632);_0x2c2259(_0x840632);});});}function respondWithStatusCode(_0x529a9a,_0x3073b4){_0x3073b4=_0x3073b4||0xcc;return function(_0x1f4b94){if(_0x1f4b94){return _0x529a9a[_0xb431('0x2a')](_0x3073b4);}return _0x529a9a[_0xb431('0x2b')](_0x3073b4)[_0xb431('0x2c')]();};}function respondWithResult(_0x4d0b73,_0x28337c){_0x28337c=_0x28337c||0xc8;return function(_0x4c8c46){if(_0x4c8c46){return _0x4d0b73[_0xb431('0x2b')](_0x28337c)[_0xb431('0x2d')](_0x4c8c46);}};}function respondWithFilteredResult(_0x47bee2,_0xad5fc3){return function(_0xa6257){if(_0xa6257){var _0x18cacf=typeof _0xad5fc3['offset']==='undefined'&&typeof _0xad5fc3['limit']===_0xb431('0x2e');var _0x3ee435=_0xa6257[_0xb431('0x2f')];var _0x52c0e7=_0x18cacf?0x0:_0xad5fc3['offset'];var _0x51dea6=_0x18cacf?_0xa6257['count']:_0xad5fc3[_0xb431('0x30')]+_0xad5fc3[_0xb431('0x31')];var _0x441014;if(_0x51dea6>=_0x3ee435){_0x51dea6=_0x3ee435;_0x441014=0xc8;}else{_0x441014=0xce;}_0x47bee2[_0xb431('0x2b')](_0x441014);return _0x47bee2['set']('Content-Range',_0x52c0e7+'-'+_0x51dea6+'/'+_0x3ee435)[_0xb431('0x2d')](_0xa6257);}return null;};}function patchUpdates(_0x3e2b53){return function(_0x2db252){try{jsonpatch['apply'](_0x2db252,_0x3e2b53,!![]);}catch(_0x4984c){return BPromise[_0xb431('0x32')](_0x4984c);}return _0x2db252[_0xb431('0x33')]();};}function saveUpdates(_0x40dfe1,_0xdc1fd8){return function(_0x2dcbec){if(_0x2dcbec){return _0x2dcbec['update'](_0x40dfe1)[_0xb431('0x34')](function(_0x4091b1){return _0x4091b1;});}return null;};}function removeEntity(_0x2789d8,_0x451945){return function(_0x1cd08d){if(_0x1cd08d){return _0x1cd08d[_0xb431('0x35')]()[_0xb431('0x34')](function(){_0x2789d8[_0xb431('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c1ea5,_0x102766){return function(_0x477110){if(!_0x477110){_0x5c1ea5[_0xb431('0x2a')](0x194);}return _0x477110;};}function handleError(_0x17bbb8,_0x2c0539){_0x2c0539=_0x2c0539||0x1f4;return function(_0x360306){logger[_0xb431('0x25')](_0x360306[_0xb431('0x36')]);if(_0x360306[_0xb431('0x37')]){delete _0x360306[_0xb431('0x37')];}_0x17bbb8[_0xb431('0x2b')](_0x2c0539)[_0xb431('0x38')](_0x360306);};}exports[_0xb431('0x39')]=function(_0x55c06f,_0x16847e){var _0x434a31={},_0x570e40={},_0x573272={'count':0x0,'rows':[]};var _0x569ea9=_[_0xb431('0x3a')](db[_0xb431('0x3b')]['rawAttributes'],function(_0x53186d){return{'name':_0x53186d[_0xb431('0x3c')],'type':_0x53186d['type'][_0xb431('0x3d')]};});_0x570e40[_0xb431('0x3e')]=_['map'](_0x569ea9,'name');_0x570e40[_0xb431('0x3f')]=_['keys'](_0x55c06f[_0xb431('0x3f')]);_0x570e40[_0xb431('0x40')]=_[_0xb431('0x41')](_0x570e40['model'],_0x570e40['query']);_0x434a31[_0xb431('0x42')]=_[_0xb431('0x41')](_0x570e40[_0xb431('0x3e')],qs[_0xb431('0x43')](_0x55c06f[_0xb431('0x3f')]['fields']));_0x434a31[_0xb431('0x42')]=_0x434a31[_0xb431('0x42')][_0xb431('0x44')]?_0x434a31[_0xb431('0x42')]:_0x570e40[_0xb431('0x3e')];if(!_0x55c06f[_0xb431('0x3f')][_0xb431('0x45')](_0xb431('0x46'))){_0x434a31[_0xb431('0x31')]=qs[_0xb431('0x31')](_0x55c06f[_0xb431('0x3f')][_0xb431('0x31')]);_0x434a31['offset']=qs['offset'](_0x55c06f[_0xb431('0x3f')][_0xb431('0x30')]);}_0x434a31[_0xb431('0x47')]=qs[_0xb431('0x48')](_0x55c06f[_0xb431('0x3f')][_0xb431('0x48')]);_0x434a31['where']=qs[_0xb431('0x40')](_[_0xb431('0x49')](_0x55c06f['query'],_0x570e40[_0xb431('0x40')]),_0x569ea9);if(_0x55c06f[_0xb431('0x3f')]['filter']){_0x434a31[_0xb431('0x4a')]=_[_0xb431('0x4b')](_0x434a31[_0xb431('0x4a')],{'$or':_['map'](_0x569ea9,function(_0x39c27e){if(_0x39c27e[_0xb431('0x4c')]!==_0xb431('0x4d')){var _0x23a9f9={};_0x23a9f9[_0x39c27e[_0xb431('0x37')]]={'$like':'%'+_0x55c06f[_0xb431('0x3f')][_0xb431('0x4e')]+'%'};return _0x23a9f9;}})});}_0x434a31=_[_0xb431('0x4b')]({},_0x434a31,_0x55c06f[_0xb431('0x4f')]);var _0x59ed9a={'where':_0x434a31[_0xb431('0x4a')]};return db[_0xb431('0x3b')]['count'](_0x59ed9a)[_0xb431('0x34')](function(_0x316920){_0x573272[_0xb431('0x2f')]=_0x316920;if(_0x55c06f[_0xb431('0x3f')]['includeAll']){_0x434a31[_0xb431('0x50')]=[{'all':!![]}];}return db['SmsMessage'][_0xb431('0x51')](_0x434a31);})[_0xb431('0x34')](function(_0x264844){_0x573272[_0xb431('0x52')]=_0x264844;return _0x573272;})['then'](respondWithFilteredResult(_0x16847e,_0x434a31))[_0xb431('0x29')](handleError(_0x16847e,null));};exports[_0xb431('0x53')]=function(_0x179c2f,_0x4b5925){var _0x1f8c44={'raw':!![],'where':{'id':_0x179c2f[_0xb431('0x54')]['id']}},_0xbe326f={};_0xbe326f[_0xb431('0x3e')]=_[_0xb431('0x55')](db['SmsMessage'][_0xb431('0x56')]);_0xbe326f['query']=_['keys'](_0x179c2f[_0xb431('0x3f')]);_0xbe326f[_0xb431('0x40')]=_[_0xb431('0x41')](_0xbe326f['model'],_0xbe326f[_0xb431('0x3f')]);_0x1f8c44[_0xb431('0x42')]=_[_0xb431('0x41')](_0xbe326f['model'],qs[_0xb431('0x43')](_0x179c2f['query'][_0xb431('0x43')]));_0x1f8c44['attributes']=_0x1f8c44[_0xb431('0x42')][_0xb431('0x44')]?_0x1f8c44[_0xb431('0x42')]:_0xbe326f[_0xb431('0x3e')];if(_0x179c2f[_0xb431('0x3f')][_0xb431('0x57')]){_0x1f8c44[_0xb431('0x50')]=[{'all':!![]}];}_0x1f8c44=_[_0xb431('0x4b')]({},_0x1f8c44,_0x179c2f[_0xb431('0x4f')]);return db[_0xb431('0x3b')][_0xb431('0x58')](_0x1f8c44)[_0xb431('0x34')](handleEntityNotFound(_0x4b5925,null))['then'](respondWithResult(_0x4b5925,null))[_0xb431('0x29')](handleError(_0x4b5925,null));};exports[_0xb431('0x59')]=function(_0x53aea1,_0x1c4f8c){return db['SmsMessage']['create'](_0x53aea1[_0xb431('0x5a')],{})[_0xb431('0x34')](respondWithResult(_0x1c4f8c,0xc9))[_0xb431('0x29')](handleError(_0x1c4f8c,null));};exports['update']=function(_0x3a769a,_0x11c88a){if(_0x3a769a[_0xb431('0x5a')]['id']){delete _0x3a769a[_0xb431('0x5a')]['id'];}return db[_0xb431('0x3b')]['find']({'where':{'id':_0x3a769a[_0xb431('0x54')]['id']}})[_0xb431('0x34')](handleEntityNotFound(_0x11c88a,null))[_0xb431('0x34')](saveUpdates(_0x3a769a[_0xb431('0x5a')],null))['then'](respondWithResult(_0x11c88a,null))[_0xb431('0x29')](handleError(_0x11c88a,null));};exports[_0xb431('0x35')]=function(_0xd18f33,_0x59c411){return db[_0xb431('0x3b')][_0xb431('0x58')]({'where':{'id':_0xd18f33[_0xb431('0x54')]['id']}})[_0xb431('0x34')](handleEntityNotFound(_0x59c411,null))[_0xb431('0x34')](removeEntity(_0x59c411,null))[_0xb431('0x29')](handleError(_0x59c411,null));};exports[_0xb431('0x5b')]=function(_0x2ab02f,_0x2a12a5){return db[_0xb431('0x3b')][_0xb431('0x5b')]()[_0xb431('0x34')](respondWithResult(_0x2a12a5,null))[_0xb431('0x29')](handleError(_0x2a12a5,null));};var interaction_log=require('../../config/logger')(_0xb431('0x5c'));exports[_0xb431('0x5d')]=function(_0x1ba445,_0x17d0eb,_0x192e4b){var _0x2bee69={'agent':{},'channel':_0xb431('0x5e')};if(_0x1ba445[_0xb431('0x5a')]['id']){delete _0x1ba445[_0xb431('0x5a')]['id'];}_0x1ba445[_0xb431('0x5a')][_0xb431('0x5f')]=!![];_0x1ba445['body']['readAt']=moment()[_0xb431('0x60')](_0xb431('0x61'));_0x1ba445['body'][_0xb431('0x62')]=_0x1ba445[_0xb431('0x5a')][_0xb431('0x62')]||_0x1ba445[_0xb431('0x63')]['id'];_0x2bee69[_0xb431('0x64')]['id']=_0x1ba445[_0xb431('0x5a')][_0xb431('0x62')];return db[_0xb431('0x3b')][_0xb431('0x58')]({'where':{'id':_0x1ba445['params']['id'],'UserId':null}})[_0xb431('0x34')](handleEntityNotFound(_0x17d0eb,null))[_0xb431('0x34')](saveUpdates(_0x1ba445['body'],null))[_0xb431('0x34')](function(_0x54f37a){if(_0x54f37a){_0x2bee69['message']=_0x54f37a[_0xb431('0x65')]({'plain':!![]});return db[_0xb431('0x66')][_0xb431('0x58')]({'where':{'id':_0x54f37a[_0xb431('0x67')]}});}return null;})[_0xb431('0x34')](handleEntityNotFound(_0x17d0eb,null))[_0xb431('0x34')](function(_0x2da169){if(_0x2da169){return _0x2da169[_0xb431('0x68')]({'UserId':_0x1ba445[_0xb431('0x5a')]['UserId'],'read1stAt':_[_0xb431('0x69')](_0x2da169['read1stAt'])?moment()[_0xb431('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb431('0x34')](function(_0x5769f4){if(_0x5769f4){_0x2bee69['interaction']=_0x5769f4[_0xb431('0x65')]({'plain':!![]});interaction_log[_0xb431('0x21')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1ba445['user']['id'],_0x1ba445['user'][_0xb431('0x37')],_0x1ba445['user']['role'],_0x2bee69[_0xb431('0x6a')]['id'],_0x1ba445[_0xb431('0x5a')]?JSON['stringify'](_0x1ba445[_0xb431('0x5a')]):'null');return respondWithRpcPromise(_0xb431('0x6b'),_0xb431('0x6c'),_0x2bee69);}return null;})[_0xb431('0x34')](function(_0x3fed9b){var _0x28dfc8=_0xb431('0x6d')+_0x3fed9b[_0xb431('0x28')][_0xb431('0x6e')];return db[_0xb431('0x6f')][_0xb431('0x3f')](_0x28dfc8,{'type':db[_0xb431('0x70')][_0xb431('0x71')][_0xb431('0x72')],'raw':!![]})[_0xb431('0x34')](function(_0x17f915){return _0x17f915;});})[_0xb431('0x34')](function(_0x438b0b){if(_0x438b0b){_0x2bee69[_0xb431('0x28')][_0xb431('0x73')]=_0x438b0b[0x0];if(!_0x1ba445[_0xb431('0x5a')][_0xb431('0x62')])return;return db['User']['find']({'where':{'id':_0x1ba445[_0xb431('0x5a')][_0xb431('0x62')],'role':'agent'},'attributes':['id','name','fullname',_0xb431('0x74'),_0xb431('0x75')],'raw':!![]});}return null;})[_0xb431('0x34')](function(_0x1e05e5){if(!_0x1e05e5)return null;_0x2bee69[_0xb431('0x28')][_0xb431('0x64')]=_0x1e05e5;return _0x2bee69;})['then'](function(_0x5ba1f7){if(_0x5ba1f7){if(_0x1ba445[_0xb431('0x5a')][_0xb431('0x76')]){_0x2bee69[_0xb431('0x28')][_0xb431('0x77')]=util[_0xb431('0x60')](_0xb431('0x78'),_0x1ba445[_0xb431('0x63')][_0xb431('0x37')]);_0x2bee69[_0xb431('0x28')][_0xb431('0x79')]=_0x2bee69['channel'];_0x2bee69['message'][_0xb431('0x7a')]=_0x2bee69[_0xb431('0x79')];_0x2bee69['message'][_0xb431('0x7b')]=_0xb431('0x5d');return respondWithRpcPromise('EventManager',_0xb431('0x7c'),{'event':_0xb431('0x7d'),'message':_0x2bee69[_0xb431('0x28')]},client9002)[_0xb431('0x34')](function(){return _0x2bee69;});}return _0x2bee69;}return null;})[_0xb431('0x34')](respondWithResult(_0x17d0eb,null))['catch'](handleError(_0x17d0eb,null));};var interaction_log=require(_0xb431('0x7e'))(_0xb431('0x5c'));exports[_0xb431('0x32')]=function(_0x198a62,_0x526e9,_0xb44698){var _0x4fb551={'agent':{},'channel':_0xb431('0x5e')};if(_0x198a62[_0xb431('0x5a')]['id']){delete _0x198a62[_0xb431('0x5a')]['id'];}_0x198a62['body'][_0xb431('0x62')]=_0x198a62[_0xb431('0x5a')]['UserId']||_0x198a62[_0xb431('0x63')]['id'];_0x4fb551[_0xb431('0x64')]['id']=_0x198a62['body'][_0xb431('0x62')];return db['SmsMessage'][_0xb431('0x58')]({'where':{'id':_0x198a62['params']['id'],'UserId':null}})[_0xb431('0x34')](handleEntityNotFound(_0x526e9,null))[_0xb431('0x34')](function(_0x5cf821){if(_0x5cf821){_0x4fb551[_0xb431('0x28')]=_0x5cf821[_0xb431('0x65')]({'plain':!![]});return db[_0xb431('0x66')][_0xb431('0x58')]({'where':{'id':_0x5cf821['SmsInteractionId']}});}return null;})[_0xb431('0x34')](handleEntityNotFound(_0x526e9,null))[_0xb431('0x34')](function(_0x1e00d0){if(_0x1e00d0){_0x4fb551['interaction']=_0x1e00d0[_0xb431('0x65')]({'plain':!![]});interaction_log[_0xb431('0x21')](_0xb431('0x7f'),_0x198a62[_0xb431('0x63')]['id'],_0x198a62['user']['name'],_0x198a62[_0xb431('0x63')][_0xb431('0x80')],_0x4fb551[_0xb431('0x6a')]['id'],_0x198a62[_0xb431('0x5a')]?JSON[_0xb431('0x24')](_0x198a62['body']):'null');return respondWithRpcPromise(_0xb431('0x81'),_0xb431('0x82'),_0x4fb551);}return null;})[_0xb431('0x34')](function(_0x285300){var _0x485f5d=_0xb431('0x6d')+_0x285300['message'][_0xb431('0x6e')];return db[_0xb431('0x6f')][_0xb431('0x3f')](_0x485f5d,{'type':db[_0xb431('0x70')]['QueryTypes'][_0xb431('0x72')],'raw':!![]})[_0xb431('0x34')](function(_0x441fe){return _0x441fe;});})[_0xb431('0x34')](function(_0x1ca4b9){if(_0x1ca4b9){_0x4fb551['message'][_0xb431('0x73')]=_0x1ca4b9[0x0];if(!_0x198a62[_0xb431('0x5a')][_0xb431('0x62')])return;return db[_0xb431('0x83')][_0xb431('0x58')]({'where':{'id':_0x198a62[_0xb431('0x5a')][_0xb431('0x62')],'role':_0xb431('0x64')},'attributes':['id',_0xb431('0x37'),_0xb431('0x84'),'email',_0xb431('0x75')],'raw':!![]});}return null;})[_0xb431('0x34')](function(_0x2e29d0){if(!_0x2e29d0)return null;_0x4fb551['message']['agent']=_0x2e29d0;return _0x4fb551;})[_0xb431('0x34')](function(_0x380ec5){if(_0x380ec5){_0x380ec5[_0xb431('0x28')]['interface']=util['format'](_0xb431('0x78'),_0x198a62[_0xb431('0x63')][_0xb431('0x37')]);_0x380ec5[_0xb431('0x28')][_0xb431('0x79')]=_0x4fb551['channel'];_0x380ec5['message'][_0xb431('0x7a')]=_0x4fb551[_0xb431('0x79')];_0x380ec5['message'][_0xb431('0x7b')]=_0xb431('0x32');respondWithRpcPromise(_0xb431('0x7c'),_0xb431('0x7c'),{'event':_0xb431('0x85'),'message':_0x380ec5[_0xb431('0x28')]},client9002);return _0x4fb551;}return null;})['then'](respondWithResult(_0x526e9,null))['catch'](handleError(_0x526e9,null));};exports[_0xb431('0x2b')]=function(_0x2d66c0,_0x1d966d,_0x11cbbd){if(_0x2d66c0[_0xb431('0x5a')]['id']){delete _0x2d66c0[_0xb431('0x5a')]['id'];}var _0x564b7e;return db[_0xb431('0x3b')][_0xb431('0x58')]({'where':{'id':_0x2d66c0[_0xb431('0x54')]['id']}})[_0xb431('0x34')](handleEntityNotFound(_0x1d966d,null))[_0xb431('0x34')](function(_0x46ccb0){if(_0x46ccb0){_0x564b7e=_0x46ccb0;return db[_0xb431('0x86')][_0xb431('0x58')]({'where':{'id':_0x46ccb0[_0xb431('0x87')]}});}})[_0xb431('0x34')](handleEntityNotFound(_0x1d966d,null))[_0xb431('0x34')](function(_0x4eced1){if(_0x4eced1){logger[_0xb431('0x23')](_0xb431('0x88'),_0xb431('0x2b'),'received\x20delivery\x20report\x20from',_0x4eced1[_0xb431('0x4c')],util[_0xb431('0x89')](_0x2d66c0[_0xb431('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4eced1['type']){case _0xb431('0x8a'):if(_0x2d66c0[_0xb431('0x5a')][_0xb431('0x8b')]&&_0x2d66c0[_0xb431('0x5a')][_0xb431('0x8b')]===_0x564b7e[_0xb431('0x8c')]){return _0x564b7e[_0xb431('0x68')]({'read':!![]});}else{logger[_0xb431('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb431('0x2b'),_0xb431('0x8a'),util[_0xb431('0x89')](_0x2d66c0['body'],{'showHidden':![],'depth':null}));}break;case _0xb431('0x8d'):if(_0x2d66c0[_0xb431('0x5a')][_0xb431('0x8e')]&&_0x2d66c0[_0xb431('0x5a')][_0xb431('0x8e')]===_0x564b7e[_0xb431('0x8c')]&&_[_0xb431('0x8f')](['sent',_0xb431('0x90')],_0x2d66c0[_0xb431('0x5a')][_0xb431('0x91')])>=0x0){return _0x564b7e[_0xb431('0x68')]({'read':!![]});}else{logger[_0xb431('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xb431('0x92'),util['inspect'](_0x2d66c0[_0xb431('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3561a3=_0x2d66c0[_0xb431('0x5a')][_0xb431('0x93')][0x0];if(_0x3561a3[_0xb431('0x2b')][_0xb431('0x94')]==='DELIVERED'){return _0x564b7e[_0xb431('0x68')]({'read':!![]});}else{logger[_0xb431('0x25')](_0xb431('0x95'),_0xb431('0x2b'),_0xb431('0x96'),util[_0xb431('0x89')](_0x2d66c0[_0xb431('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x564b7e;}})[_0xb431('0x34')](respondWithResult(_0x1d966d,null))[_0xb431('0x29')](handleError(_0x1d966d,null));}; \ No newline at end of file +var _0x34bd=['debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','send','map','SmsMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','name','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','contact','email','interface','rejectmessage','SmsAccount','SmsAccountId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34bd,0x1d2));var _0xd34b=function(_0x4fab09,_0x2e343b){_0x4fab09=_0x4fab09-0x0;var _0xf457df=_0x34bd[_0x4fab09];return _0xf457df;};'use strict';var emlformat=require(_0xd34b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd34b('0x1'));var rp=require(_0xd34b('0x2'));var moment=require(_0xd34b('0x3'));var BPromise=require(_0xd34b('0x4'));var Mustache=require(_0xd34b('0x5'));var util=require(_0xd34b('0x6'));var path=require(_0xd34b('0x7'));var sox=require('sox');var csv=require(_0xd34b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd34b('0x9'));var crypto=require(_0xd34b('0xa'));var jsforce=require(_0xd34b('0xb'));var deskjs=require(_0xd34b('0xc'));var toCsv=require(_0xd34b('0x8'));var querystring=require(_0xd34b('0xd'));var Papa=require(_0xd34b('0xe'));var Redis=require(_0xd34b('0xf'));var authService=require(_0xd34b('0x10'));var qs=require(_0xd34b('0x11'));var as=require(_0xd34b('0x12'));var hardwareService=require(_0xd34b('0x13'));var logger=require('../../config/logger')(_0xd34b('0x14'));var utils=require('../../config/utils');var config=require(_0xd34b('0x15'));var licenseUtil=require(_0xd34b('0x16'));var db=require(_0xd34b('0x17'))['db'];config[_0xd34b('0x18')]=_[_0xd34b('0x19')](config[_0xd34b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd34b('0x1a'))(new Redis(config[_0xd34b('0x18')]));require('./smsMessage.socket')[_0xd34b('0x1b')](socket);var jayson=require(_0xd34b('0x1c'));var client=jayson[_0xd34b('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xd34b('0x1d')][_0xd34b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5a46be,_0x3c74e2,_0x4ce87b,_0xe11907){return new BPromise(function(_0x438b61,_0x2ace5a){var _0x56ea27=_0xe11907||client;return _0x56ea27[_0xd34b('0x1f')](_0x5a46be,_0x4ce87b)[_0xd34b('0x20')](function(_0x1bbbb1){logger[_0xd34b('0x21')](_0xd34b('0x22'),_0x3c74e2,'request\x20sent');logger['debug'](_0xd34b('0x23'),_0x3c74e2,_0xd34b('0x24'),JSON[_0xd34b('0x25')](_0x1bbbb1));if(_0x1bbbb1[_0xd34b('0x26')]){if(_0x1bbbb1[_0xd34b('0x26')][_0xd34b('0x27')]===0x1f4){logger['error'](_0xd34b('0x22'),_0x3c74e2,_0x1bbbb1[_0xd34b('0x26')][_0xd34b('0x28')]);return _0x2ace5a(_0x1bbbb1[_0xd34b('0x26')]['message']);}logger[_0xd34b('0x26')](_0xd34b('0x22'),_0x3c74e2,_0x1bbbb1[_0xd34b('0x26')][_0xd34b('0x28')]);return _0x438b61(_0x1bbbb1[_0xd34b('0x26')][_0xd34b('0x28')]);}else{logger['info'](_0xd34b('0x22'),_0x3c74e2,'request\x20sent');_0x438b61(_0x1bbbb1[_0xd34b('0x29')][_0xd34b('0x28')]);}})['catch'](function(_0x5f3325){logger['error'](_0xd34b('0x22'),_0x3c74e2,_0x5f3325);_0x2ace5a(_0x5f3325);});});}function respondWithStatusCode(_0x187b33,_0x14b8b9){_0x14b8b9=_0x14b8b9||0xcc;return function(_0x594413){if(_0x594413){return _0x187b33[_0xd34b('0x2a')](_0x14b8b9);}return _0x187b33[_0xd34b('0x2b')](_0x14b8b9)['end']();};}function respondWithResult(_0x21a653,_0x38637f){_0x38637f=_0x38637f||0xc8;return function(_0x342885){if(_0x342885){return _0x21a653['status'](_0x38637f)[_0xd34b('0x2c')](_0x342885);}};}function respondWithFilteredResult(_0x4f047d,_0x182266){return function(_0x27c392){if(_0x27c392){var _0x28e20c=typeof _0x182266['offset']===_0xd34b('0x2d')&&typeof _0x182266['limit']===_0xd34b('0x2d');var _0x47c0b3=_0x27c392[_0xd34b('0x2e')];var _0x567b74=_0x28e20c?0x0:_0x182266[_0xd34b('0x2f')];var _0x3f3ff0=_0x28e20c?_0x27c392['count']:_0x182266[_0xd34b('0x2f')]+_0x182266[_0xd34b('0x30')];var _0xc3beb1;if(_0x3f3ff0>=_0x47c0b3){_0x3f3ff0=_0x47c0b3;_0xc3beb1=0xc8;}else{_0xc3beb1=0xce;}_0x4f047d['status'](_0xc3beb1);return _0x4f047d[_0xd34b('0x31')](_0xd34b('0x32'),_0x567b74+'-'+_0x3f3ff0+'/'+_0x47c0b3)[_0xd34b('0x2c')](_0x27c392);}return null;};}function patchUpdates(_0x4db5d7){return function(_0x39f442){try{jsonpatch[_0xd34b('0x33')](_0x39f442,_0x4db5d7,!![]);}catch(_0x247b2d){return BPromise[_0xd34b('0x34')](_0x247b2d);}return _0x39f442[_0xd34b('0x35')]();};}function saveUpdates(_0x42b4e6,_0x392a60){return function(_0x53b5c7){if(_0x53b5c7){return _0x53b5c7[_0xd34b('0x36')](_0x42b4e6)[_0xd34b('0x20')](function(_0x389444){return _0x389444;});}return null;};}function removeEntity(_0x466129,_0x1ae71e){return function(_0x51e40c){if(_0x51e40c){return _0x51e40c[_0xd34b('0x37')]()[_0xd34b('0x20')](function(){_0x466129[_0xd34b('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5789b4,_0xcaf02){return function(_0x278322){if(!_0x278322){_0x5789b4[_0xd34b('0x2a')](0x194);}return _0x278322;};}function handleError(_0x4caae8,_0x33eadf){_0x33eadf=_0x33eadf||0x1f4;return function(_0x91e8ba){logger[_0xd34b('0x26')](_0x91e8ba[_0xd34b('0x38')]);if(_0x91e8ba['name']){delete _0x91e8ba['name'];}_0x4caae8[_0xd34b('0x2b')](_0x33eadf)[_0xd34b('0x39')](_0x91e8ba);};}exports['index']=function(_0x4a4da0,_0x4e72cf){var _0x64acdf={},_0x474855={},_0x5245e7={'count':0x0,'rows':[]};var _0x1538c3=_[_0xd34b('0x3a')](db[_0xd34b('0x3b')][_0xd34b('0x3c')],function(_0x11f707){return{'name':_0x11f707['fieldName'],'type':_0x11f707[_0xd34b('0x3d')][_0xd34b('0x3e')]};});_0x474855[_0xd34b('0x3f')]=_[_0xd34b('0x3a')](_0x1538c3,'name');_0x474855[_0xd34b('0x40')]=_[_0xd34b('0x41')](_0x4a4da0['query']);_0x474855['filters']=_[_0xd34b('0x42')](_0x474855[_0xd34b('0x3f')],_0x474855[_0xd34b('0x40')]);_0x64acdf[_0xd34b('0x43')]=_['intersection'](_0x474855[_0xd34b('0x3f')],qs[_0xd34b('0x44')](_0x4a4da0['query']['fields']));_0x64acdf['attributes']=_0x64acdf[_0xd34b('0x43')]['length']?_0x64acdf['attributes']:_0x474855[_0xd34b('0x3f')];if(!_0x4a4da0['query'][_0xd34b('0x45')]('nolimit')){_0x64acdf[_0xd34b('0x30')]=qs[_0xd34b('0x30')](_0x4a4da0[_0xd34b('0x40')][_0xd34b('0x30')]);_0x64acdf[_0xd34b('0x2f')]=qs['offset'](_0x4a4da0[_0xd34b('0x40')][_0xd34b('0x2f')]);}_0x64acdf[_0xd34b('0x46')]=qs[_0xd34b('0x47')](_0x4a4da0[_0xd34b('0x40')][_0xd34b('0x47')]);_0x64acdf[_0xd34b('0x48')]=qs[_0xd34b('0x49')](_[_0xd34b('0x4a')](_0x4a4da0[_0xd34b('0x40')],_0x474855[_0xd34b('0x49')]),_0x1538c3);if(_0x4a4da0[_0xd34b('0x40')]['filter']){_0x64acdf['where']=_[_0xd34b('0x4b')](_0x64acdf[_0xd34b('0x48')],{'$or':_['map'](_0x1538c3,function(_0x3dc3f8){if(_0x3dc3f8[_0xd34b('0x3d')]!=='VIRTUAL'){var _0x36847={};_0x36847[_0x3dc3f8[_0xd34b('0x4c')]]={'$like':'%'+_0x4a4da0['query']['filter']+'%'};return _0x36847;}})});}_0x64acdf=_[_0xd34b('0x4b')]({},_0x64acdf,_0x4a4da0[_0xd34b('0x4d')]);var _0x297d30={'where':_0x64acdf['where']};return db[_0xd34b('0x3b')]['count'](_0x297d30)[_0xd34b('0x20')](function(_0x560834){_0x5245e7[_0xd34b('0x2e')]=_0x560834;if(_0x4a4da0['query'][_0xd34b('0x4e')]){_0x64acdf[_0xd34b('0x4f')]=[{'all':!![]}];}return db[_0xd34b('0x3b')][_0xd34b('0x50')](_0x64acdf);})[_0xd34b('0x20')](function(_0x1a64e2){_0x5245e7[_0xd34b('0x51')]=_0x1a64e2;return _0x5245e7;})[_0xd34b('0x20')](respondWithFilteredResult(_0x4e72cf,_0x64acdf))[_0xd34b('0x52')](handleError(_0x4e72cf,null));};exports[_0xd34b('0x53')]=function(_0x9b5b9d,_0x3a7d82){var _0x13c5f6={'raw':!![],'where':{'id':_0x9b5b9d[_0xd34b('0x54')]['id']}},_0x5f3f40={};_0x5f3f40[_0xd34b('0x3f')]=_['keys'](db[_0xd34b('0x3b')][_0xd34b('0x3c')]);_0x5f3f40[_0xd34b('0x40')]=_[_0xd34b('0x41')](_0x9b5b9d[_0xd34b('0x40')]);_0x5f3f40[_0xd34b('0x49')]=_[_0xd34b('0x42')](_0x5f3f40[_0xd34b('0x3f')],_0x5f3f40['query']);_0x13c5f6[_0xd34b('0x43')]=_[_0xd34b('0x42')](_0x5f3f40[_0xd34b('0x3f')],qs[_0xd34b('0x44')](_0x9b5b9d['query'][_0xd34b('0x44')]));_0x13c5f6[_0xd34b('0x43')]=_0x13c5f6[_0xd34b('0x43')][_0xd34b('0x55')]?_0x13c5f6[_0xd34b('0x43')]:_0x5f3f40[_0xd34b('0x3f')];if(_0x9b5b9d[_0xd34b('0x40')][_0xd34b('0x4e')]){_0x13c5f6[_0xd34b('0x4f')]=[{'all':!![]}];}_0x13c5f6=_[_0xd34b('0x4b')]({},_0x13c5f6,_0x9b5b9d[_0xd34b('0x4d')]);return db[_0xd34b('0x3b')][_0xd34b('0x56')](_0x13c5f6)[_0xd34b('0x20')](handleEntityNotFound(_0x3a7d82,null))[_0xd34b('0x20')](respondWithResult(_0x3a7d82,null))['catch'](handleError(_0x3a7d82,null));};exports[_0xd34b('0x57')]=function(_0x18eaf4,_0x158003){return db['SmsMessage'][_0xd34b('0x57')](_0x18eaf4[_0xd34b('0x58')],{})[_0xd34b('0x20')](respondWithResult(_0x158003,0xc9))[_0xd34b('0x52')](handleError(_0x158003,null));};exports[_0xd34b('0x36')]=function(_0x153ed7,_0x6e42e1){if(_0x153ed7['body']['id']){delete _0x153ed7[_0xd34b('0x58')]['id'];}return db[_0xd34b('0x3b')][_0xd34b('0x56')]({'where':{'id':_0x153ed7['params']['id']}})[_0xd34b('0x20')](handleEntityNotFound(_0x6e42e1,null))[_0xd34b('0x20')](saveUpdates(_0x153ed7[_0xd34b('0x58')],null))[_0xd34b('0x20')](respondWithResult(_0x6e42e1,null))[_0xd34b('0x52')](handleError(_0x6e42e1,null));};exports[_0xd34b('0x37')]=function(_0xb6a848,_0x29d018){return db['SmsMessage'][_0xd34b('0x56')]({'where':{'id':_0xb6a848[_0xd34b('0x54')]['id']}})['then'](handleEntityNotFound(_0x29d018,null))[_0xd34b('0x20')](removeEntity(_0x29d018,null))[_0xd34b('0x52')](handleError(_0x29d018,null));};exports['describe']=function(_0x5b8151,_0x3097be){return db[_0xd34b('0x3b')][_0xd34b('0x59')]()[_0xd34b('0x20')](respondWithResult(_0x3097be,null))['catch'](handleError(_0x3097be,null));};var interaction_log=require(_0xd34b('0x5a'))(_0xd34b('0x5b'));exports[_0xd34b('0x5c')]=function(_0x1ed288,_0x5f0ce4,_0x55baf2){var _0x1a33e1={'agent':{},'channel':_0xd34b('0x5d')};if(_0x1ed288[_0xd34b('0x58')]['id']){delete _0x1ed288['body']['id'];}_0x1ed288[_0xd34b('0x58')][_0xd34b('0x5e')]=!![];_0x1ed288[_0xd34b('0x58')][_0xd34b('0x5f')]=moment()[_0xd34b('0x60')](_0xd34b('0x61'));_0x1ed288[_0xd34b('0x58')]['UserId']=_0x1ed288['body'][_0xd34b('0x62')]||_0x1ed288['user']['id'];_0x1a33e1[_0xd34b('0x63')]['id']=_0x1ed288[_0xd34b('0x58')][_0xd34b('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x1ed288[_0xd34b('0x54')]['id'],'UserId':null}})[_0xd34b('0x20')](handleEntityNotFound(_0x5f0ce4,null))[_0xd34b('0x20')](saveUpdates(_0x1ed288[_0xd34b('0x58')],null))['then'](function(_0x59d4a4){if(_0x59d4a4){_0x1a33e1[_0xd34b('0x28')]=_0x59d4a4[_0xd34b('0x64')]({'plain':!![]});return db[_0xd34b('0x65')]['find']({'where':{'id':_0x59d4a4['SmsInteractionId']}});}return null;})[_0xd34b('0x20')](handleEntityNotFound(_0x5f0ce4,null))[_0xd34b('0x20')](function(_0x18068b){if(_0x18068b){return _0x18068b[_0xd34b('0x36')]({'UserId':_0x1ed288[_0xd34b('0x58')][_0xd34b('0x62')],'read1stAt':_[_0xd34b('0x66')](_0x18068b[_0xd34b('0x67')])?moment()[_0xd34b('0x60')](_0xd34b('0x61')):undefined});}return null;})['then'](function(_0x235a18){if(_0x235a18){_0x1a33e1[_0xd34b('0x68')]=_0x235a18[_0xd34b('0x64')]({'plain':!![]});interaction_log[_0xd34b('0x21')](_0xd34b('0x69'),_0x1ed288[_0xd34b('0x6a')]['id'],_0x1ed288[_0xd34b('0x6a')][_0xd34b('0x4c')],_0x1ed288[_0xd34b('0x6a')][_0xd34b('0x6b')],_0x1a33e1[_0xd34b('0x68')]['id'],_0x1ed288[_0xd34b('0x58')]?JSON['stringify'](_0x1ed288['body']):'null');return respondWithRpcPromise(_0xd34b('0x6c'),'acceptMessage',_0x1a33e1);}return null;})[_0xd34b('0x20')](function(_0x3ca97a){var _0x56c94e=_0xd34b('0x6d')+_0x3ca97a[_0xd34b('0x28')]['ContactId'];return db[_0xd34b('0x6e')]['query'](_0x56c94e,{'type':db[_0xd34b('0x6f')]['QueryTypes'][_0xd34b('0x70')],'raw':!![]})[_0xd34b('0x20')](function(_0x9be403){return _0x9be403;});})[_0xd34b('0x20')](function(_0x155668){if(_0x155668){_0x1a33e1[_0xd34b('0x28')]['contact']=_0x155668[0x0];if(!_0x1ed288['body']['UserId'])return;return db[_0xd34b('0x71')][_0xd34b('0x56')]({'where':{'id':_0x1ed288[_0xd34b('0x58')][_0xd34b('0x62')],'role':'agent'},'attributes':['id',_0xd34b('0x4c'),_0xd34b('0x72'),'email','internal'],'raw':!![]});}return null;})[_0xd34b('0x20')](function(_0x45eace){if(!_0x45eace)return null;_0x1a33e1[_0xd34b('0x28')][_0xd34b('0x63')]=_0x45eace;return _0x1a33e1;})[_0xd34b('0x20')](function(_0x322600){if(_0x322600){if(_0x1ed288['body'][_0xd34b('0x73')]){_0x1a33e1['message']['interface']=util[_0xd34b('0x60')](_0xd34b('0x74'),_0x1ed288[_0xd34b('0x6a')][_0xd34b('0x4c')]);_0x1a33e1[_0xd34b('0x28')][_0xd34b('0x75')]=_0x1a33e1[_0xd34b('0x75')];_0x1a33e1[_0xd34b('0x28')][_0xd34b('0x76')]=_0x1a33e1[_0xd34b('0x75')];_0x1a33e1[_0xd34b('0x28')][_0xd34b('0x77')]=_0xd34b('0x5c');return respondWithRpcPromise(_0xd34b('0x78'),'EventManager',{'event':_0xd34b('0x79'),'message':_0x1a33e1[_0xd34b('0x28')]},client9002)[_0xd34b('0x20')](function(){return _0x1a33e1;});}return _0x1a33e1;}return null;})[_0xd34b('0x20')](respondWithResult(_0x5f0ce4,null))['catch'](handleError(_0x5f0ce4,null));};var interaction_log=require(_0xd34b('0x5a'))(_0xd34b('0x5b'));exports[_0xd34b('0x34')]=function(_0x59910f,_0x92d639,_0x4825a7){var _0x50b6a0={'agent':{},'channel':'sms'};if(_0x59910f['body']['id']){delete _0x59910f[_0xd34b('0x58')]['id'];}_0x59910f['body'][_0xd34b('0x62')]=_0x59910f[_0xd34b('0x58')][_0xd34b('0x62')]||_0x59910f['user']['id'];_0x50b6a0[_0xd34b('0x63')]['id']=_0x59910f[_0xd34b('0x58')][_0xd34b('0x62')];return db[_0xd34b('0x3b')][_0xd34b('0x56')]({'where':{'id':_0x59910f['params']['id'],'UserId':null}})[_0xd34b('0x20')](handleEntityNotFound(_0x92d639,null))[_0xd34b('0x20')](function(_0x3a3f22){if(_0x3a3f22){_0x50b6a0[_0xd34b('0x28')]=_0x3a3f22['get']({'plain':!![]});return db[_0xd34b('0x65')][_0xd34b('0x56')]({'where':{'id':_0x3a3f22[_0xd34b('0x7a')]}});}return null;})[_0xd34b('0x20')](handleEntityNotFound(_0x92d639,null))['then'](function(_0x45d0ab){if(_0x45d0ab){_0x50b6a0[_0xd34b('0x68')]=_0x45d0ab[_0xd34b('0x64')]({'plain':!![]});interaction_log[_0xd34b('0x21')](_0xd34b('0x7b'),_0x59910f[_0xd34b('0x6a')]['id'],_0x59910f[_0xd34b('0x6a')][_0xd34b('0x4c')],_0x59910f['user'][_0xd34b('0x6b')],_0x50b6a0[_0xd34b('0x68')]['id'],_0x59910f[_0xd34b('0x58')]?JSON['stringify'](_0x59910f[_0xd34b('0x58')]):_0xd34b('0x7c'));return respondWithRpcPromise(_0xd34b('0x7d'),_0xd34b('0x7e'),_0x50b6a0);}return null;})[_0xd34b('0x20')](function(_0x3dd21d){var _0x191878=_0xd34b('0x6d')+_0x3dd21d[_0xd34b('0x28')][_0xd34b('0x7f')];return db[_0xd34b('0x6e')][_0xd34b('0x40')](_0x191878,{'type':db[_0xd34b('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x56502e){return _0x56502e;});})[_0xd34b('0x20')](function(_0xaf6ebc){if(_0xaf6ebc){_0x50b6a0['message'][_0xd34b('0x80')]=_0xaf6ebc[0x0];if(!_0x59910f[_0xd34b('0x58')][_0xd34b('0x62')])return;return db[_0xd34b('0x71')]['find']({'where':{'id':_0x59910f[_0xd34b('0x58')][_0xd34b('0x62')],'role':_0xd34b('0x63')},'attributes':['id',_0xd34b('0x4c'),_0xd34b('0x72'),_0xd34b('0x81'),'internal'],'raw':!![]});}return null;})[_0xd34b('0x20')](function(_0x71f4d9){if(!_0x71f4d9)return null;_0x50b6a0[_0xd34b('0x28')][_0xd34b('0x63')]=_0x71f4d9;return _0x50b6a0;})[_0xd34b('0x20')](function(_0x2d76a7){if(_0x2d76a7){_0x2d76a7['message'][_0xd34b('0x82')]=util[_0xd34b('0x60')](_0xd34b('0x74'),_0x59910f[_0xd34b('0x6a')][_0xd34b('0x4c')]);_0x2d76a7[_0xd34b('0x28')]['channel']=_0x50b6a0[_0xd34b('0x75')];_0x2d76a7[_0xd34b('0x28')][_0xd34b('0x76')]=_0x50b6a0[_0xd34b('0x75')];_0x2d76a7[_0xd34b('0x28')][_0xd34b('0x77')]=_0xd34b('0x34');respondWithRpcPromise(_0xd34b('0x78'),_0xd34b('0x78'),{'event':_0xd34b('0x83'),'message':_0x2d76a7[_0xd34b('0x28')]},client9002);return _0x50b6a0;}return null;})[_0xd34b('0x20')](respondWithResult(_0x92d639,null))['catch'](handleError(_0x92d639,null));};exports[_0xd34b('0x2b')]=function(_0x350cc6,_0x414e00,_0x1cc0d2){if(_0x350cc6[_0xd34b('0x58')]['id']){delete _0x350cc6[_0xd34b('0x58')]['id'];}var _0xcad989;return db[_0xd34b('0x3b')][_0xd34b('0x56')]({'where':{'id':_0x350cc6[_0xd34b('0x54')]['id']}})[_0xd34b('0x20')](handleEntityNotFound(_0x414e00,null))[_0xd34b('0x20')](function(_0x164816){if(_0x164816){_0xcad989=_0x164816;return db[_0xd34b('0x84')][_0xd34b('0x56')]({'where':{'id':_0x164816[_0xd34b('0x85')]}});}})[_0xd34b('0x20')](handleEntityNotFound(_0x414e00,null))[_0xd34b('0x20')](function(_0x1bc678){if(_0x1bc678){logger[_0xd34b('0x86')](_0xd34b('0x23'),_0xd34b('0x2b'),_0xd34b('0x87'),_0x1bc678['type'],util[_0xd34b('0x88')](_0x350cc6[_0xd34b('0x58')],{'showHidden':![],'depth':null}));switch(_0x1bc678[_0xd34b('0x3d')]){case _0xd34b('0x89'):if(_0x350cc6[_0xd34b('0x58')]['MessageSid']&&_0x350cc6[_0xd34b('0x58')][_0xd34b('0x8a')]===_0xcad989[_0xd34b('0x8b')]){return _0xcad989[_0xd34b('0x36')]({'read':!![]});}else{logger['error'](_0xd34b('0x8c'),'status',_0xd34b('0x89'),util['inspect'](_0x350cc6[_0xd34b('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd34b('0x8d'):if(_0x350cc6[_0xd34b('0x58')][_0xd34b('0x8e')]&&_0x350cc6['body']['MessageUUID']===_0xcad989[_0xd34b('0x8b')]&&_['indexOf']([_0xd34b('0x8f'),_0xd34b('0x90')],_0x350cc6[_0xd34b('0x58')][_0xd34b('0x91')])>=0x0){return _0xcad989['update']({'read':!![]});}else{logger['error'](_0xd34b('0x8c'),_0xd34b('0x2b'),'plivio',util[_0xd34b('0x88')](_0x350cc6['body'],{'showHidden':![],'depth':null}));}break;case _0xd34b('0x92'):var _0x3cadd7=_0x350cc6['body'][_0xd34b('0x93')][0x0];if(_0x3cadd7[_0xd34b('0x2b')][_0xd34b('0x94')]===_0xd34b('0x95')){return _0xcad989['update']({'read':!![]});}else{logger[_0xd34b('0x26')](_0xd34b('0x8c'),_0xd34b('0x2b'),_0xd34b('0x92'),util['inspect'](_0x350cc6[_0xd34b('0x58')],{'showHidden':![],'depth':null}));}break;}return _0xcad989;}})[_0xd34b('0x20')](respondWithResult(_0x414e00,null))['catch'](handleError(_0x414e00,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 51a7256..8cecbcf 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 _0x363e=['update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x33dacb,_0x40f60a){var _0x35174f=function(_0x596477){while(--_0x596477){_0x33dacb['push'](_0x33dacb['shift']());}};_0x35174f(++_0x40f60a);}(_0x363e,0x1d8));var _0xe363=function(_0x52006b,_0x2fe7eb){_0x52006b=_0x52006b-0x0;var _0x28e55d=_0x363e[_0x52006b];return _0x28e55d;};'use strict';var EventEmitter=require(_0xe363('0x0'));var SmsMessage=require(_0xe363('0x1'))['db'][_0xe363('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe363('0x3')](0x0);var events={'afterCreate':_0xe363('0x4'),'afterUpdate':_0xe363('0x5'),'afterDestroy':_0xe363('0x6')};function emitEvent(_0x2b6660){return function(_0x223c90,_0x58b2f9,_0x5739f5){SmsMessageEvents[_0xe363('0x7')](_0x2b6660+':'+_0x223c90['id'],_0x223c90);SmsMessageEvents[_0xe363('0x7')](_0x2b6660,_0x223c90);_0x5739f5(null);};}for(var e in events){if(events[_0xe363('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x96f5=['update','remove','emit','hasOwnProperty','events','SmsMessage','setMaxListeners','save'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x96f5,0x1ec));var _0x596f=function(_0x3df946,_0xc2277d){_0x3df946=_0x3df946-0x0;var _0x12eded=_0x96f5[_0x3df946];return _0x12eded;};'use strict';var EventEmitter=require(_0x596f('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x596f('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x596f('0x2')](0x0);var events={'afterCreate':_0x596f('0x3'),'afterUpdate':_0x596f('0x4'),'afterDestroy':_0x596f('0x5')};function emitEvent(_0x2654d8){return function(_0x32c01a,_0x53a8ad,_0xe8cd10){SmsMessageEvents[_0x596f('0x6')](_0x2654d8+':'+_0x32c01a['id'],_0x32c01a);SmsMessageEvents[_0x596f('0x6')](_0x2654d8,_0x32c01a);_0xe8cd10(null);};}for(var e in events){if(events[_0x596f('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index f89e022..ac3492e 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 _0x0675=['%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','text','keys','sort','apiKey','createHash','md5','signature=','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','accountId','/messages','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','application/json','refid','status','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','direction','toLowerCase','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','xCALLY\x20Motion','senderString','format'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x0675,0x1a2));var _0x5067=function(_0x30ecde,_0x1f11ce){_0x30ecde=_0x30ecde-0x0;var _0x54078d=_0x0675[_0x30ecde];return _0x54078d;};'use strict';var _=require(_0x5067('0x0'));var util=require(_0x5067('0x1'));var logger=require('../../config/logger')(_0x5067('0x2'));var moment=require(_0x5067('0x3'));var BPromise=require(_0x5067('0x4'));var rp=require(_0x5067('0x5'));var fs=require('fs');var path=require(_0x5067('0x6'));var rimraf=require(_0x5067('0x7'));var config=require(_0x5067('0x8'));var attributes=require('./smsMessage.attributes');module[_0x5067('0x9')]=function(_0x31655a,_0x318488){return _0x31655a['define'](_0x5067('0xa'),attributes,{'tableName':_0x5067('0xb'),'paranoid':![],'indexes':[{'name':_0x5067('0xc'),'fields':[_0x5067('0xc')]},{'name':_0x5067('0xd'),'fields':['body'],'type':_0x5067('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x181c4f,_0x44928e,_0x2b9473){var _0x8714aa=_0x31655a['models'];var _0x50393c=_0x181c4f['get']({'plain':!![]});if(_0x50393c[_0x5067('0xf')][_0x5067('0x10')]()==='in'||_0x50393c[_0x5067('0xf')]['toLowerCase']()===_0x5067('0x11')&&!_0x50393c[_0x5067('0x12')]&&!_[_0x5067('0x13')](_0x50393c['UserId'])&&!_[_0x5067('0x13')](_0x50393c['SmsInteractionId'])){_0x8714aa[_0x5067('0x14')][_0x5067('0x15')]({'where':{'id':_0x50393c[_0x5067('0x16')]}})[_0x5067('0x17')](function(_0x3ac8fa){if(_0x3ac8fa){_0x3ac8fa[_0x5067('0x18')]({'lastMsgAt':_0x50393c[_0x5067('0x19')],'lastMsgDirection':_0x50393c['direction'][_0x5067('0x10')]()});}})[_0x5067('0x1a')](function(_0x2d6612){console[_0x5067('0x1b')](_0x2d6612);});}if(_0x50393c['direction']===_0x5067('0x11')&&!_0x50393c['secret']){var _0x46e616;_0x8714aa[_0x5067('0x1c')][_0x5067('0x1d')]({'where':{'id':_0x50393c[_0x5067('0x1e')]},'raw':!![]})['then'](function(_0x46caab){_0x46e616=_0x46caab;if(_0x46e616&&_0x46e616[_0x5067('0x1f')]){switch(_0x46e616['type']){case'twilio':var _0x5578c2=require(_0x5067('0x20'));if(_0x46e616[_0x5067('0x21')]&&_0x46e616[_0x5067('0x22')]&&_0x46e616[_0x5067('0x23')]){var _0x131c8d=new _0x5578c2(_0x46e616['accountSid'],_0x46e616['authToken']);_0x131c8d[_0x5067('0x24')][_0x5067('0x25')]({'body':_0x50393c['body'],'to':_0x50393c[_0x5067('0x23')],'from':_0x46e616[_0x5067('0x23')],'statusCallback':_0x46e616['remote']+_0x5067('0x26')+_0x50393c['id']+_0x5067('0x27')+_0x46e616[_0x5067('0x28')]})[_0x5067('0x17')](function(_0xc23ab4){if(_0xc23ab4[_0x5067('0x29')]){return _0x181c4f[_0x5067('0x18')]({'messageId':_0xc23ab4[_0x5067('0x29')]});}})[_0x5067('0x1a')](function(_0x1da3f7){logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x20'),util[_0x5067('0x2c')](_0x1da3f7,{'showHidden':![],'depth':null}));});}else{logger[_0x5067('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5067('0x2b'),_0x5067('0x20'),_0x5067('0x2d'));}break;case _0x5067('0x2e'):var _0x407f65=_0x5067('0x2f');if(_0x46e616[_0x5067('0x30')]&&_0x46e616[_0x5067('0x31')]){var _0x34996c={'recipient':[_0x50393c[_0x5067('0x23')]],'message':_0x50393c[_0x5067('0x32')],'message_type':_0x46e616[_0x5067('0x33')]};if(_0x46e616[_0x5067('0x33')]&&_0x46e616[_0x5067('0x33')]!=='SI'){_0x34996c[_0x5067('0x34')]=_0x46e616[_0x5067('0x23')];}var _0x211021={'url':_0x407f65+_0x5067('0x35')+_0x46e616[_0x5067('0x30')]+_0x5067('0x36')+_0x46e616[_0x5067('0x31')],'method':_0x5067('0x37')};rp(_0x211021)['then'](function(_0x13002d){var _0x3efc3d=_0x13002d[_0x5067('0x38')](';');var _0x4e4c11={'user_key':_0x3efc3d[0x0],'session_key':_0x3efc3d[0x1]};_0x211021={'url':_0x407f65+_0x5067('0x39'),'method':_0x5067('0x3a'),'headers':{'user_key':_0x4e4c11['user_key'],'Session_key':_0x4e4c11[_0x5067('0x3b')]},'json':!![],'body':_0x34996c};return rp(_0x211021);})[_0x5067('0x17')](function(_0x4f8fde){if(_0x4f8fde[_0x5067('0x3c')]>=0x1){var _0x469126={'messageId':_0x4f8fde[_0x5067('0x3d')]};if(_0x46e616['smsMethod']!=='GP'||!_0x46e616[_0x5067('0x3e')]){_0x469126[_0x5067('0x3f')]=!![];}return _0x181c4f['update'](_0x469126);}else{return logger[_0x5067('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5067('0x2b'),_0x5067('0x2e'),util['inspect'](_0x4f8fde,{'showHidden':![],'depth':null}));}})[_0x5067('0x1a')](function(_0xc632b9){return logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x2e'),util[_0x5067('0x2c')](_0xc632b9,{'showHidden':![],'depth':null}));});}else{logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x2e'),_0x5067('0x40'));}break;case _0x5067('0x41'):if(_0x46e616[_0x5067('0x22')]){var _0x1ef2e2={'recipient':_0x50393c[_0x5067('0x23')],'message':_0x50393c[_0x5067('0x32')],'sender':_0x46e616['senderString']||_0x46e616[_0x5067('0x23')],'authorization':_0x46e616[_0x5067('0x22')]};var _0x44928e={'method':'POST','uri':_0x5067('0x42'),'body':_0x1ef2e2,'json':!![]};rp(_0x44928e)[_0x5067('0x17')](function(_0x2b804c){var _0x4143cf={'messageId':_0x2b804c['requestid']};if(!_0x46e616['deliveryReport']){_0x4143cf[_0x5067('0x3f')]=!![];}return _0x181c4f[_0x5067('0x18')](_0x4143cf);})[_0x5067('0x1a')](function(_0x51a2c3){logger[_0x5067('0x1b')](_0x5067('0x2a'),'afterCreate',_0x5067('0x41'),util[_0x5067('0x2c')](_0x51a2c3,{'showHidden':![],'depth':null}));});}else{logger[_0x5067('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5067('0x2b'),_0x5067('0x41'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x46e616['username']&&_0x46e616[_0x5067('0x31')]){var _0x1ef2e2={'messages':[{'source':_0x5067('0x43'),'to':_0x50393c[_0x5067('0x23')],'body':_0x50393c[_0x5067('0x32')],'from':_0x46e616[_0x5067('0x44')]||_0x46e616[_0x5067('0x23')]}]};var _0x2ce49a=util[_0x5067('0x45')](_0x5067('0x46'),_0x46e616['username'],_0x46e616[_0x5067('0x31')]);var _0x44928e={'method':_0x5067('0x3a'),'uri':_0x5067('0x47'),'body':_0x1ef2e2,'headers':{'Authorization':util[_0x5067('0x45')](_0x5067('0x48'),new Buffer(_0x2ce49a)[_0x5067('0x49')](_0x5067('0x4a')))},'json':!![]};rp(_0x44928e)['then'](function(_0xf7112e){if(_0xf7112e[_0x5067('0x4b')]>=0xc8&&_0xf7112e[_0x5067('0x4b')]<=0xce){if(_0xf7112e[_0x5067('0x4c')]&&_0xf7112e[_0x5067('0x4c')][_0x5067('0x4d')]>0x0){var _0x5791c0=_[_0x5067('0x4e')](_0xf7112e[_0x5067('0x4c')][_0x5067('0x24')]);var _0x2e2a56={'messageId':_0x5791c0[_0x5067('0x4f')]};if(!_0x46e616[_0x5067('0x3e')]){_0x2e2a56[_0x5067('0x3f')]=!![];}return _0x181c4f[_0x5067('0x18')](_0x2e2a56);}else{logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),'clickSend',util[_0x5067('0x2c')](_0xf7112e,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x5067('0x2a'),'afterCreate',_0x5067('0x50'),util['inspect'](_0xf7112e,{'showHidden':![],'depth':null}));}})[_0x5067('0x1a')](function(_0x352566){logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x50'),util['inspect'](_0x352566,{'showHidden':![],'depth':null}));});}else{logger[_0x5067('0x1b')](_0x5067('0x2a'),'afterCreate',_0x5067('0x50'),_0x5067('0x40'));}break;case'plivo':if(_0x46e616[_0x5067('0x51')]&&_0x46e616[_0x5067('0x22')]){var _0x1ef2e2={'dst':_0x50393c[_0x5067('0x23')],'text':_0x50393c[_0x5067('0x32')],'src':_0x46e616[_0x5067('0x44')]||_0x46e616['phone'],'url':_0x46e616[_0x5067('0x52')]+_0x5067('0x26')+_0x50393c['id']+'/status?token='+_0x46e616['token']};var _0x2ce49a=util[_0x5067('0x45')](_0x5067('0x46'),_0x46e616[_0x5067('0x51')],_0x46e616[_0x5067('0x22')]);var _0x44928e={'method':'POST','uri':util[_0x5067('0x45')](_0x5067('0x53'),_0x46e616[_0x5067('0x51')]),'body':_0x1ef2e2,'headers':{'Authorization':util[_0x5067('0x45')](_0x5067('0x48'),new Buffer(_0x2ce49a)[_0x5067('0x49')]('base64'))},'json':!![]};rp(_0x44928e)[_0x5067('0x17')](function(_0x49b214){var _0x4aa6a4={'messageId':_0x49b214[_0x5067('0x54')][0x0]};return _0x181c4f[_0x5067('0x18')](_0x4aa6a4);})['catch'](function(_0x8e1212){logger[_0x5067('0x1b')](_0x5067('0x2a'),'afterCreate',_0x5067('0x55'),util['inspect'](_0x8e1212,{'showHidden':![],'depth':null}));});}else{logger[_0x5067('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5067('0x2b'),_0x5067('0x55'),_0x5067('0x56'));}break;case'infobip':if(_0x46e616[_0x5067('0x30')]&&_0x46e616[_0x5067('0x31')]){if(_0x46e616[_0x5067('0x57')]){var _0x593a7f={'method':_0x5067('0x3a'),'uri':_0x46e616[_0x5067('0x57')]+_0x5067('0x58'),'body':{'username':_0x46e616[_0x5067('0x30')],'password':_0x46e616[_0x5067('0x31')]},'json':!![]};return rp(_0x593a7f)[_0x5067('0x17')](function(_0x13cb8d){var _0x4052f9={'method':'POST','uri':_0x46e616[_0x5067('0x57')]+_0x5067('0x59'),'body':{'messages':[{'from':_0x46e616[_0x5067('0x23')],'destinations':[{'to':_0x50393c[_0x5067('0x23')]}],'text':_0x50393c[_0x5067('0x32')],'notifyUrl':_0x46e616[_0x5067('0x52')]+_0x5067('0x26')+_0x50393c['id']+_0x5067('0x27')+_0x46e616['token'],'notifyContentType':'application/json','callbackData':_0x46e616[_0x5067('0x23')]+';'+_0x50393c['body']}]},'headers':{'Authorization':_0x5067('0x5a')+_0x13cb8d['token']},'json':!![]};return rp(_0x4052f9)['then'](function(_0x47323b){if(_0x47323b['messages']){var _0x2ba98a={'messageId':_0x47323b[_0x5067('0x24')][0x0][_0x5067('0xc')]};if(!_0x46e616[_0x5067('0x3e')]){_0x2ba98a[_0x5067('0x3f')]=!![];}return _0x181c4f[_0x5067('0x18')](_0x2ba98a);}else{return logger[_0x5067('0x1b')](_0x5067('0x2a'),'afterCreate',_0x5067('0x5b'),util[_0x5067('0x2c')](_0x47323b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x21184b){return logger['error'](_0x5067('0x2a'),_0x5067('0x2b'),'infobip',util['inspect'](_0x21184b,{'showHidden':![],'depth':null}));});}else{logger[_0x5067('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5067('0x2b'),_0x5067('0x5b'),_0x5067('0x5c'));}}else{logger['error'](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x5b'),_0x5067('0x40'));}break;case _0x5067('0x5d'):var _0x4d568c=require(_0x5067('0x5e'));if(_0x46e616['apiKey']){var _0x23f042={};_0x23f042[_0x5067('0x5f')]=_0x46e616[_0x5067('0x30')];_0x23f042[_0x5067('0x23')]=_0x50393c[_0x5067('0x23')];_0x23f042[_0x5067('0x34')]=_0x46e616[_0x5067('0x23')];_0x23f042[_0x5067('0x60')]=_0x50393c[_0x5067('0x32')];_0x23f042['timestamp']=+new Date();var _0x2fed80='';var _0x4b86a8='';var _0x49cf48=Object[_0x5067('0x61')](_0x23f042);_0x49cf48[_0x5067('0x62')]();for(var _0x575eaa=0x0;_0x575eaa<_0x49cf48['length'];_0x575eaa++){if(_0x2fed80!=''){_0x2fed80+='&';}_0x2fed80+=_0x49cf48[_0x575eaa]+'='+encodeURIComponent(_0x23f042[_0x49cf48[_0x575eaa]]);_0x4b86a8+=_0x23f042[_0x49cf48[_0x575eaa]];}_0x4b86a8+=_0x46e616[_0x5067('0x63')];_0x4b86a8=_0x4d568c[_0x5067('0x64')](_0x5067('0x65'))[_0x5067('0x18')](_0x4b86a8)['digest']('hex');if(_0x2fed80!==''){_0x2fed80+='&';}_0x2fed80+=_0x5067('0x66')+_0x4b86a8;var _0x211021={'method':_0x5067('0x37'),'uri':_0x46e616[_0x5067('0x57')]+'/external/get/send.php?'+_0x2fed80,'json':!![]};return rp(_0x211021)[_0x5067('0x17')](function(_0x29fb62){var _0x1c57c5=Object[_0x5067('0x61')](_0x29fb62);if(_0x29fb62[_0x1c57c5[0x0]][_0x5067('0x1b')]&&parseInt(_0x29fb62[_0x1c57c5[0x0]][_0x5067('0x1b')])===0x0){var _0x3499ef={'messageId':_0x29fb62[_0x1c57c5[0x0]]['id_sms']};if(!_0x46e616['deliveryReport']){_0x3499ef[_0x5067('0x3f')]=!![];}return _0x181c4f['update'](_0x3499ef);}else{return logger[_0x5067('0x1b')](_0x5067('0x2a'),'afterCreate',_0x5067('0x5d'),util['inspect'](_0x29fb62[_0x5067('0x1b')],{'showHidden':![],'depth':null}));}})[_0x5067('0x1a')](function(_0x106819){return logger[_0x5067('0x1b')](_0x5067('0x2a'),'afterCreate',_0x5067('0x5d'),util['inspect'](_0x106819,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x5d'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x46e616[_0x5067('0x63')]){var _0x131b13={'method':_0x5067('0x3a'),'uri':_0x5067('0x67'),'headers':{'Authorization':_0x46e616['apiKey']},'body':{'content':_0x50393c[_0x5067('0x32')],'to':[_0x50393c[_0x5067('0x23')]],'from':_0x46e616[_0x5067('0x23')],'binary':![],'clientMessageId':_0x5067('0x68'),'charset':_0x5067('0x69')},'json':!![]};rp(_0x131b13)[_0x5067('0x17')](function(_0x45df07){if(!_0x45df07[_0x5067('0x1b')]){var _0x58b088={'messageId':_0x45df07[_0x5067('0x24')][0x0][_0x5067('0x6a')]};if(!_0x46e616[_0x5067('0x3e')]){_0x58b088['read']=!![];}return _0x181c4f['update'](_0x58b088);}else{return logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x6b'),util['inspect'](_0x45df07[_0x5067('0x1b')],{'showHidden':![],'depth':null}));}})[_0x5067('0x1a')](function(_0x15ca5e){return logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x6b'),util[_0x5067('0x2c')](_0x15ca5e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x6b'),_0x5067('0x6c'));}break;case _0x5067('0x6d'):if(_0x46e616['username']&&_0x46e616[_0x5067('0x31')]){var _0x2ce49a=util['format']('%s:%s',_0x46e616[_0x5067('0x30')],_0x46e616[_0x5067('0x31')]);var _0x44928e={'method':_0x5067('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x46e616[_0x5067('0x6e')]+_0x5067('0x6f'),'body':{'to':[_0x50393c[_0x5067('0x23')]],'text':_0x50393c[_0x5067('0x32')],'from':_0x46e616[_0x5067('0x23')],'applicationId':_0x46e616['applicationId']},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x2ce49a)[_0x5067('0x49')](_0x5067('0x4a')))},'json':!![]};rp(_0x44928e)['then'](function(_0x429be5){if(_0x429be5['id']){var _0x1db622={'messageId':_0x429be5['id']};return _0x181c4f[_0x5067('0x18')](_0x1db622);}else{logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),'bandwidth',util[_0x5067('0x2c')](_0x429be5,{'showHidden':![],'depth':null}));}})[_0x5067('0x1a')](function(_0x203a25){logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x6d'),util[_0x5067('0x2c')](_0x203a25,{'showHidden':![],'depth':null}));});}else{logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),'bandwidth',_0x5067('0x40'));}break;case _0x5067('0x70'):if(_0x46e616[_0x5067('0x63')]){var _0x200d1f={};var _0x211021={'method':_0x5067('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x46e616['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x46e616[_0x5067('0x23')],'to':_0x50393c['phone'],'text':_0x50393c[_0x5067('0x32')]},'json':!![]};return rp(_0x211021)[_0x5067('0x17')](function(_0x1f28c6){if(_0x1f28c6[_0x5067('0x71')]==0xca){_0x200d1f[_0x5067('0x72')]=_0x1f28c6;var _0x163f77={'method':_0x5067('0x3a'),'uri':_0x5067('0x73'),'headers':{'Authorization':_0x5067('0x74')+_0x46e616[_0x5067('0x63')],'Content-Type':_0x5067('0x75')},'body':{'refid':_0x200d1f['message'][_0x5067('0x76')]},'json':!![]};return rp(_0x163f77)['then'](function(_0x533c71){_0x200d1f[_0x5067('0x77')]=_0x533c71;var _0xb2b712={'messageId':_0x200d1f[_0x5067('0x72')][_0x5067('0x76')],'read':!![]};return _0x181c4f[_0x5067('0x18')](_0xb2b712);});}else{return logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),_0x5067('0x70'),util['inspect'](_0x1f28c6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4302d7){return logger[_0x5067('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5067('0x2b'),'intelepeer',util[_0x5067('0x2c')](_0x4302d7,{'showHidden':![],'depth':null}));});}else{return logger[_0x5067('0x1b')](_0x5067('0x2a'),_0x5067('0x2b'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x2b9473();});}else{_0x2b9473();}}},'charset':_0x5067('0x78'),'collate':_0x5067('0x79')});}; \ No newline at end of file +var _0xa8b9=['length','md5','hex','GET','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','application/json','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','SmsInteractionId','findOne','then','update','error','out','secret','SmsAccount','find','SmsAccountId','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','requestid','read','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','catch','plivo','authId','senderString','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','sort'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa8b9,0x10e));var _0x9a8b=function(_0x4a458f,_0x31766d){_0x4a458f=_0x4a458f-0x0;var _0x430d96=_0xa8b9[_0x4a458f];return _0x430d96;};'use strict';var _=require('lodash');var util=require(_0x9a8b('0x0'));var logger=require(_0x9a8b('0x1'))(_0x9a8b('0x2'));var moment=require(_0x9a8b('0x3'));var BPromise=require(_0x9a8b('0x4'));var rp=require(_0x9a8b('0x5'));var fs=require('fs');var path=require(_0x9a8b('0x6'));var rimraf=require(_0x9a8b('0x7'));var config=require(_0x9a8b('0x8'));var attributes=require(_0x9a8b('0x9'));module[_0x9a8b('0xa')]=function(_0x36d43b,_0x4c4acd){return _0x36d43b[_0x9a8b('0xb')](_0x9a8b('0xc'),attributes,{'tableName':_0x9a8b('0xd'),'paranoid':![],'indexes':[{'name':_0x9a8b('0xe'),'fields':['messageId']},{'name':_0x9a8b('0xf'),'fields':[_0x9a8b('0x10')],'type':_0x9a8b('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8e0517,_0x306a38,_0x1b873e){var _0x1326a2=_0x36d43b[_0x9a8b('0x12')];var _0x642611=_0x8e0517[_0x9a8b('0x13')]({'plain':!![]});if(_0x642611[_0x9a8b('0x14')][_0x9a8b('0x15')]()==='in'||_0x642611['direction'][_0x9a8b('0x15')]()==='out'&&!_0x642611['secret']&&!_[_0x9a8b('0x16')](_0x642611['UserId'])&&!_['isNil'](_0x642611[_0x9a8b('0x17')])){_0x1326a2['SmsInteraction'][_0x9a8b('0x18')]({'where':{'id':_0x642611['SmsInteractionId']}})[_0x9a8b('0x19')](function(_0xd6484c){if(_0xd6484c){_0xd6484c[_0x9a8b('0x1a')]({'lastMsgAt':_0x642611['createdAt'],'lastMsgDirection':_0x642611[_0x9a8b('0x14')][_0x9a8b('0x15')]()});}})['catch'](function(_0x2f2f02){console[_0x9a8b('0x1b')](_0x2f2f02);});}if(_0x642611[_0x9a8b('0x14')]===_0x9a8b('0x1c')&&!_0x642611[_0x9a8b('0x1d')]){var _0x5cdfc3;_0x1326a2[_0x9a8b('0x1e')][_0x9a8b('0x1f')]({'where':{'id':_0x642611[_0x9a8b('0x20')]},'raw':!![]})['then'](function(_0x2fca63){_0x5cdfc3=_0x2fca63;if(_0x5cdfc3&&_0x5cdfc3['type']){switch(_0x5cdfc3['type']){case _0x9a8b('0x21'):var _0x1961b8=require(_0x9a8b('0x21'));if(_0x5cdfc3[_0x9a8b('0x22')]&&_0x5cdfc3[_0x9a8b('0x23')]&&_0x5cdfc3['phone']){var _0x4d4847=new _0x1961b8(_0x5cdfc3['accountSid'],_0x5cdfc3['authToken']);_0x4d4847[_0x9a8b('0x24')][_0x9a8b('0x25')]({'body':_0x642611[_0x9a8b('0x10')],'to':_0x642611[_0x9a8b('0x26')],'from':_0x5cdfc3[_0x9a8b('0x26')],'statusCallback':_0x5cdfc3[_0x9a8b('0x27')]+_0x9a8b('0x28')+_0x642611['id']+_0x9a8b('0x29')+_0x5cdfc3[_0x9a8b('0x2a')]})['then'](function(_0xac99a6){if(_0xac99a6['sid']){return _0x8e0517[_0x9a8b('0x1a')]({'messageId':_0xac99a6[_0x9a8b('0x2b')]});}})['catch'](function(_0x546433){logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x21'),util[_0x9a8b('0x2e')](_0x546433,{'showHidden':![],'depth':null}));});}else{logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x21'),_0x9a8b('0x2f'));}break;case _0x9a8b('0x30'):var _0x3c3ec6=_0x9a8b('0x31');if(_0x5cdfc3[_0x9a8b('0x32')]&&_0x5cdfc3[_0x9a8b('0x33')]){var _0x47ce98={'recipient':[_0x642611[_0x9a8b('0x26')]],'message':_0x642611[_0x9a8b('0x10')],'message_type':_0x5cdfc3[_0x9a8b('0x34')]};if(_0x5cdfc3['smsMethod']&&_0x5cdfc3[_0x9a8b('0x34')]!=='SI'){_0x47ce98[_0x9a8b('0x35')]=_0x5cdfc3[_0x9a8b('0x26')];}var _0x2b79d4={'url':_0x3c3ec6+_0x9a8b('0x36')+_0x5cdfc3[_0x9a8b('0x32')]+_0x9a8b('0x37')+_0x5cdfc3[_0x9a8b('0x33')],'method':'GET'};rp(_0x2b79d4)[_0x9a8b('0x19')](function(_0x4fa2e1){var _0x23ce0d=_0x4fa2e1[_0x9a8b('0x38')](';');var _0xe3aaac={'user_key':_0x23ce0d[0x0],'session_key':_0x23ce0d[0x1]};_0x2b79d4={'url':_0x3c3ec6+_0x9a8b('0x39'),'method':_0x9a8b('0x3a'),'headers':{'user_key':_0xe3aaac[_0x9a8b('0x3b')],'Session_key':_0xe3aaac['session_key']},'json':!![],'body':_0x47ce98};return rp(_0x2b79d4);})['then'](function(_0x5aa761){if(_0x5aa761[_0x9a8b('0x3c')]>=0x1){var _0x195cc4={'messageId':_0x5aa761[_0x9a8b('0x3d')]};if(_0x5cdfc3[_0x9a8b('0x34')]!=='GP'||!_0x5cdfc3[_0x9a8b('0x3e')]){_0x195cc4['read']=!![];}return _0x8e0517[_0x9a8b('0x1a')](_0x195cc4);}else{return logger[_0x9a8b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9a8b('0x2d'),_0x9a8b('0x30'),util['inspect'](_0x5aa761,{'showHidden':![],'depth':null}));}})['catch'](function(_0x33d2d2){return logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x30'),util[_0x9a8b('0x2e')](_0x33d2d2,{'showHidden':![],'depth':null}));});}else{logger[_0x9a8b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9a8b('0x2d'),_0x9a8b('0x30'),_0x9a8b('0x3f'));}break;case _0x9a8b('0x40'):if(_0x5cdfc3['authToken']){var _0x33c84b={'recipient':_0x642611['phone'],'message':_0x642611[_0x9a8b('0x10')],'sender':_0x5cdfc3['senderString']||_0x5cdfc3[_0x9a8b('0x26')],'authorization':_0x5cdfc3['authToken']};var _0x306a38={'method':_0x9a8b('0x3a'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x33c84b,'json':!![]};rp(_0x306a38)[_0x9a8b('0x19')](function(_0x4a33b5){var _0x4f191f={'messageId':_0x4a33b5[_0x9a8b('0x41')]};if(!_0x5cdfc3[_0x9a8b('0x3e')]){_0x4f191f[_0x9a8b('0x42')]=!![];}return _0x8e0517[_0x9a8b('0x1a')](_0x4f191f);})['catch'](function(_0x5d601a){logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x40'),util[_0x9a8b('0x2e')](_0x5d601a,{'showHidden':![],'depth':null}));});}else{logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x40'),_0x9a8b('0x43'));}break;case _0x9a8b('0x44'):if(_0x5cdfc3[_0x9a8b('0x32')]&&_0x5cdfc3[_0x9a8b('0x33')]){var _0x33c84b={'messages':[{'source':'xCALLY\x20Motion','to':_0x642611[_0x9a8b('0x26')],'body':_0x642611['body'],'from':_0x5cdfc3['senderString']||_0x5cdfc3[_0x9a8b('0x26')]}]};var _0x4f3043=util[_0x9a8b('0x45')](_0x9a8b('0x46'),_0x5cdfc3[_0x9a8b('0x32')],_0x5cdfc3['password']);var _0x306a38={'method':_0x9a8b('0x3a'),'uri':_0x9a8b('0x47'),'body':_0x33c84b,'headers':{'Authorization':util[_0x9a8b('0x45')](_0x9a8b('0x48'),new Buffer(_0x4f3043)[_0x9a8b('0x49')](_0x9a8b('0x4a')))},'json':!![]};rp(_0x306a38)[_0x9a8b('0x19')](function(_0x233db7){if(_0x233db7[_0x9a8b('0x4b')]>=0xc8&&_0x233db7['http_code']<=0xce){if(_0x233db7[_0x9a8b('0x4c')]&&_0x233db7[_0x9a8b('0x4c')][_0x9a8b('0x4d')]>0x0){var _0x5330ed=_[_0x9a8b('0x4e')](_0x233db7['data'][_0x9a8b('0x24')]);var _0x4f9bf0={'messageId':_0x5330ed['message_id']};if(!_0x5cdfc3['deliveryReport']){_0x4f9bf0['read']=!![];}return _0x8e0517[_0x9a8b('0x1a')](_0x4f9bf0);}else{logger['error'](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x4f'),util[_0x9a8b('0x2e')](_0x233db7,{'showHidden':![],'depth':null}));}}else{logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),'clickSend',util[_0x9a8b('0x2e')](_0x233db7,{'showHidden':![],'depth':null}));}})[_0x9a8b('0x50')](function(_0x3dabd6){logger[_0x9a8b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9a8b('0x4f'),util['inspect'](_0x3dabd6,{'showHidden':![],'depth':null}));});}else{logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x4f'),_0x9a8b('0x3f'));}break;case _0x9a8b('0x51'):if(_0x5cdfc3[_0x9a8b('0x52')]&&_0x5cdfc3[_0x9a8b('0x23')]){var _0x33c84b={'dst':_0x642611[_0x9a8b('0x26')],'text':_0x642611['body'],'src':_0x5cdfc3[_0x9a8b('0x53')]||_0x5cdfc3['phone'],'url':_0x5cdfc3['remote']+_0x9a8b('0x28')+_0x642611['id']+_0x9a8b('0x29')+_0x5cdfc3[_0x9a8b('0x2a')]};var _0x4f3043=util[_0x9a8b('0x45')](_0x9a8b('0x46'),_0x5cdfc3['authId'],_0x5cdfc3[_0x9a8b('0x23')]);var _0x306a38={'method':_0x9a8b('0x3a'),'uri':util[_0x9a8b('0x45')](_0x9a8b('0x54'),_0x5cdfc3[_0x9a8b('0x52')]),'body':_0x33c84b,'headers':{'Authorization':util['format'](_0x9a8b('0x48'),new Buffer(_0x4f3043)[_0x9a8b('0x49')](_0x9a8b('0x4a')))},'json':!![]};rp(_0x306a38)[_0x9a8b('0x19')](function(_0x1d6d86){var _0x1a2415={'messageId':_0x1d6d86[_0x9a8b('0x55')][0x0]};return _0x8e0517[_0x9a8b('0x1a')](_0x1a2415);})[_0x9a8b('0x50')](function(_0x342e34){logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x51'),util[_0x9a8b('0x2e')](_0x342e34,{'showHidden':![],'depth':null}));});}else{logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),'plivo',_0x9a8b('0x56'));}break;case _0x9a8b('0x57'):if(_0x5cdfc3[_0x9a8b('0x32')]&&_0x5cdfc3['password']){if(_0x5cdfc3[_0x9a8b('0x58')]){var _0x5b5d61={'method':_0x9a8b('0x3a'),'uri':_0x5cdfc3[_0x9a8b('0x58')]+'/auth/1/session','body':{'username':_0x5cdfc3[_0x9a8b('0x32')],'password':_0x5cdfc3['password']},'json':!![]};return rp(_0x5b5d61)['then'](function(_0x1c021d){var _0x18df0d={'method':_0x9a8b('0x3a'),'uri':_0x5cdfc3['baseUrl']+_0x9a8b('0x59'),'body':{'messages':[{'from':_0x5cdfc3[_0x9a8b('0x26')],'destinations':[{'to':_0x642611[_0x9a8b('0x26')]}],'text':_0x642611[_0x9a8b('0x10')],'notifyUrl':_0x5cdfc3['remote']+_0x9a8b('0x28')+_0x642611['id']+_0x9a8b('0x29')+_0x5cdfc3['token'],'notifyContentType':'application/json','callbackData':_0x5cdfc3['phone']+';'+_0x642611['body']}]},'headers':{'Authorization':_0x9a8b('0x5a')+_0x1c021d[_0x9a8b('0x2a')]},'json':!![]};return rp(_0x18df0d)[_0x9a8b('0x19')](function(_0x15a732){if(_0x15a732[_0x9a8b('0x24')]){var _0x1c61f4={'messageId':_0x15a732['messages'][0x0][_0x9a8b('0xe')]};if(!_0x5cdfc3[_0x9a8b('0x3e')]){_0x1c61f4[_0x9a8b('0x42')]=!![];}return _0x8e0517[_0x9a8b('0x1a')](_0x1c61f4);}else{return logger['error'](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x57'),util['inspect'](_0x15a732,{'showHidden':![],'depth':null}));}});})[_0x9a8b('0x50')](function(_0xa51af2){return logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x57'),util[_0x9a8b('0x2e')](_0xa51af2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x57'),_0x9a8b('0x5b'));}}else{logger['error'](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x57'),_0x9a8b('0x3f'));}break;case _0x9a8b('0x5c'):var _0x34256f=require(_0x9a8b('0x5d'));if(_0x5cdfc3[_0x9a8b('0x5e')]){var _0x45718e={};_0x45718e[_0x9a8b('0x5f')]=_0x5cdfc3['username'];_0x45718e[_0x9a8b('0x26')]=_0x642611[_0x9a8b('0x26')];_0x45718e[_0x9a8b('0x35')]=_0x5cdfc3[_0x9a8b('0x26')];_0x45718e['text']=_0x642611[_0x9a8b('0x10')];_0x45718e[_0x9a8b('0x60')]=+new Date();var _0x3902b4='';var _0x169f43='';var _0x311f48=Object[_0x9a8b('0x61')](_0x45718e);_0x311f48[_0x9a8b('0x62')]();for(var _0x3eba23=0x0;_0x3eba23<_0x311f48[_0x9a8b('0x63')];_0x3eba23++){if(_0x3902b4!=''){_0x3902b4+='&';}_0x3902b4+=_0x311f48[_0x3eba23]+'='+encodeURIComponent(_0x45718e[_0x311f48[_0x3eba23]]);_0x169f43+=_0x45718e[_0x311f48[_0x3eba23]];}_0x169f43+=_0x5cdfc3['apiKey'];_0x169f43=_0x34256f['createHash'](_0x9a8b('0x64'))[_0x9a8b('0x1a')](_0x169f43)['digest'](_0x9a8b('0x65'));if(_0x3902b4!==''){_0x3902b4+='&';}_0x3902b4+='signature='+_0x169f43;var _0x2b79d4={'method':_0x9a8b('0x66'),'uri':_0x5cdfc3[_0x9a8b('0x58')]+'/external/get/send.php?'+_0x3902b4,'json':!![]};return rp(_0x2b79d4)[_0x9a8b('0x19')](function(_0x99bbf2){var _0x28ed40=Object[_0x9a8b('0x61')](_0x99bbf2);if(_0x99bbf2[_0x28ed40[0x0]][_0x9a8b('0x1b')]&&parseInt(_0x99bbf2[_0x28ed40[0x0]][_0x9a8b('0x1b')])===0x0){var _0x5650f4={'messageId':_0x99bbf2[_0x28ed40[0x0]]['id_sms']};if(!_0x5cdfc3[_0x9a8b('0x3e')]){_0x5650f4[_0x9a8b('0x42')]=!![];}return _0x8e0517[_0x9a8b('0x1a')](_0x5650f4);}else{return logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x5c'),util[_0x9a8b('0x2e')](_0x99bbf2[_0x9a8b('0x1b')],{'showHidden':![],'depth':null}));}})[_0x9a8b('0x50')](function(_0x177726){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9a8b('0x2d'),'csc',util[_0x9a8b('0x2e')](_0x177726,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x5c'),_0x9a8b('0x67'));}break;case _0x9a8b('0x68'):if(_0x5cdfc3[_0x9a8b('0x5e')]){var _0x301f1f={'method':_0x9a8b('0x3a'),'uri':_0x9a8b('0x69'),'headers':{'Authorization':_0x5cdfc3[_0x9a8b('0x5e')]},'body':{'content':_0x642611['body'],'to':[_0x642611[_0x9a8b('0x26')]],'from':_0x5cdfc3[_0x9a8b('0x26')],'binary':![],'clientMessageId':_0x9a8b('0x6a'),'charset':_0x9a8b('0x6b')},'json':!![]};rp(_0x301f1f)[_0x9a8b('0x19')](function(_0x31640b){if(!_0x31640b['error']){var _0x373520={'messageId':_0x31640b[_0x9a8b('0x24')][0x0][_0x9a8b('0x6c')]};if(!_0x5cdfc3['deliveryReport']){_0x373520[_0x9a8b('0x42')]=!![];}return _0x8e0517[_0x9a8b('0x1a')](_0x373520);}else{return logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x68'),util[_0x9a8b('0x2e')](_0x31640b[_0x9a8b('0x1b')],{'showHidden':![],'depth':null}));}})[_0x9a8b('0x50')](function(_0x858f6a){return logger['error'](_0x9a8b('0x2c'),'afterCreate',_0x9a8b('0x68'),util[_0x9a8b('0x2e')](_0x858f6a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x68'),_0x9a8b('0x67'));}break;case _0x9a8b('0x6d'):if(_0x5cdfc3[_0x9a8b('0x32')]&&_0x5cdfc3[_0x9a8b('0x33')]){var _0x4f3043=util[_0x9a8b('0x45')](_0x9a8b('0x46'),_0x5cdfc3[_0x9a8b('0x32')],_0x5cdfc3[_0x9a8b('0x33')]);var _0x306a38={'method':_0x9a8b('0x3a'),'uri':_0x9a8b('0x6e')+_0x5cdfc3['accountId']+_0x9a8b('0x6f'),'body':{'to':[_0x642611[_0x9a8b('0x26')]],'text':_0x642611[_0x9a8b('0x10')],'from':_0x5cdfc3[_0x9a8b('0x26')],'applicationId':_0x5cdfc3['applicationId']},'headers':{'Authorization':util[_0x9a8b('0x45')](_0x9a8b('0x48'),new Buffer(_0x4f3043)[_0x9a8b('0x49')](_0x9a8b('0x4a')))},'json':!![]};rp(_0x306a38)[_0x9a8b('0x19')](function(_0x1b536c){if(_0x1b536c['id']){var _0x14e679={'messageId':_0x1b536c['id']};return _0x8e0517[_0x9a8b('0x1a')](_0x14e679);}else{logger['error'](_0x9a8b('0x2c'),'afterCreate',_0x9a8b('0x6d'),util[_0x9a8b('0x2e')](_0x1b536c,{'showHidden':![],'depth':null}));}})[_0x9a8b('0x50')](function(_0x17d8e4){logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x6d'),util['inspect'](_0x17d8e4,{'showHidden':![],'depth':null}));});}else{logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x6d'),_0x9a8b('0x3f'));}break;case _0x9a8b('0x70'):if(_0x5cdfc3[_0x9a8b('0x5e')]){var _0x1a686={};var _0x2b79d4={'method':_0x9a8b('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x5cdfc3[_0x9a8b('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x5cdfc3[_0x9a8b('0x26')],'to':_0x642611['phone'],'text':_0x642611['body']},'json':!![]};return rp(_0x2b79d4)['then'](function(_0x1fddc2){if(_0x1fddc2['code']==0xca){_0x1a686['message']=_0x1fddc2;var _0x37aaad={'method':_0x9a8b('0x3a'),'uri':_0x9a8b('0x71'),'headers':{'Authorization':_0x9a8b('0x72')+_0x5cdfc3['apiKey'],'Content-Type':_0x9a8b('0x73')},'body':{'refid':_0x1a686[_0x9a8b('0x74')]['refid']},'json':!![]};return rp(_0x37aaad)['then'](function(_0x6bf034){_0x1a686[_0x9a8b('0x75')]=_0x6bf034;var _0x1e5519={'messageId':_0x1a686[_0x9a8b('0x74')][_0x9a8b('0x76')],'read':!![]};return _0x8e0517[_0x9a8b('0x1a')](_0x1e5519);});}else{return logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x70'),util[_0x9a8b('0x2e')](_0x1fddc2,{'showHidden':![],'depth':null}));}})[_0x9a8b('0x50')](function(_0x1a011e){return logger['error'](_0x9a8b('0x2c'),'afterCreate',_0x9a8b('0x70'),util[_0x9a8b('0x2e')](_0x1a011e,{'showHidden':![],'depth':null}));});}else{return logger[_0x9a8b('0x1b')](_0x9a8b('0x2c'),_0x9a8b('0x2d'),_0x9a8b('0x70'),_0x9a8b('0x77'));}break;}}})[_0x9a8b('0x78')](function(){_0x1b873e();});}else{_0x1b873e();}}},'charset':_0x9a8b('0x79'),'collate':_0x9a8b('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d8cf0a5..39ddf34 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 _0xe13a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','CreateSmsMessage','create','body','options','raw','lodash','util','moment','randomstring'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xe13a,0xea));var _0xae13=function(_0x2401d6,_0x193b3a){_0x2401d6=_0x2401d6-0x0;var _0x5b7932=_0xe13a[_0x2401d6];return _0x5b7932;};'use strict';var _=require(_0xae13('0x0'));var util=require(_0xae13('0x1'));var moment=require(_0xae13('0x2'));var BPromise=require('bluebird');var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require(_0xae13('0x4'));var db=require(_0xae13('0x5'))['db'];var utils=require(_0xae13('0x6'));var logger=require(_0xae13('0x7'))(_0xae13('0x8'));var config=require(_0xae13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});config[_0xae13('0xc')]=_[_0xae13('0xd')](config['redis'],{'host':_0xae13('0xe'),'port':0x18eb});var socket=require(_0xae13('0xf'))(new Redis(config[_0xae13('0xc')]));require('./smsMessage.socket')[_0xae13('0x10')](socket);function respondWithRpcPromise(_0x3f6355,_0x515012,_0x5389ec){return new BPromise(function(_0x444a33,_0x5c0aac){return client[_0xae13('0x11')](_0x3f6355,_0x5389ec)[_0xae13('0x12')](function(_0x2fa502){logger['info'](_0xae13('0x13'),_0x515012,'request\x20sent');logger[_0xae13('0x14')](_0xae13('0x15'),_0x515012,'request\x20sent',JSON[_0xae13('0x16')](_0x2fa502));if(_0x2fa502['error']){if(_0x2fa502[_0xae13('0x17')][_0xae13('0x18')]===0x1f4){logger[_0xae13('0x17')](_0xae13('0x13'),_0x515012,_0x2fa502['error'][_0xae13('0x19')]);return _0x5c0aac(_0x2fa502[_0xae13('0x17')][_0xae13('0x19')]);}logger[_0xae13('0x17')](_0xae13('0x13'),_0x515012,_0x2fa502[_0xae13('0x17')][_0xae13('0x19')]);return _0x444a33(_0x2fa502[_0xae13('0x17')][_0xae13('0x19')]);}else{logger[_0xae13('0x1a')](_0xae13('0x13'),_0x515012,_0xae13('0x1b'));_0x444a33(_0x2fa502['result'][_0xae13('0x19')]);}})[_0xae13('0x1c')](function(_0x5a425c){logger['error'](_0xae13('0x13'),_0x515012,_0x5a425c);_0x5c0aac(_0x5a425c);});});}exports[_0xae13('0x1d')]=function(_0x40c663){var _0x6adcde=this;return new Promise(function(_0x2d512d,_0x1d3496){return db['SmsMessage'][_0xae13('0x1e')](_0x40c663[_0xae13('0x1f')],{'raw':_0x40c663['options']?_0x40c663[_0xae13('0x20')][_0xae13('0x21')]===undefined?!![]:![]:!![]})[_0xae13('0x12')](function(_0x1213d0){logger[_0xae13('0x1a')](_0xae13('0x1d'),_0x40c663);logger[_0xae13('0x14')](_0xae13('0x1d'),_0x40c663,JSON['stringify'](_0x1213d0));_0x2d512d(_0x1213d0);})['catch'](function(_0x470fb9){logger[_0xae13('0x17')](_0xae13('0x1d'),_0x470fb9[_0xae13('0x19')],_0x40c663);_0x1d3496(_0x6adcde[_0xae13('0x17')](0x1f4,_0x470fb9[_0xae13('0x19')]));});});}; \ No newline at end of file +var _0xed0f=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','lodash','util'];(function(_0x55387b,_0x85625b){var _0x2a376d=function(_0x22e575){while(--_0x22e575){_0x55387b['push'](_0x55387b['shift']());}};_0x2a376d(++_0x85625b);}(_0xed0f,0x1c0));var _0xfed0=function(_0x799387,_0x29efec){_0x799387=_0x799387-0x0;var _0x1309e0=_0xed0f[_0x799387];return _0x1309e0;};'use strict';var _=require(_0xfed0('0x0'));var util=require(_0xfed0('0x1'));var moment=require(_0xfed0('0x2'));var BPromise=require('bluebird');var rs=require(_0xfed0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfed0('0x4'))['db'];var utils=require(_0xfed0('0x5'));var logger=require(_0xfed0('0x6'))(_0xfed0('0x7'));var config=require(_0xfed0('0x8'));var jayson=require(_0xfed0('0x9'));var client=jayson[_0xfed0('0xa')]['http']({'port':0x232a});config['redis']=_[_0xfed0('0xb')](config[_0xfed0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfed0('0xd'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xfed0('0xe')](socket);function respondWithRpcPromise(_0x27ff16,_0xbf7cdf,_0x24f188){return new BPromise(function(_0x556a8b,_0x464c47){return client[_0xfed0('0xf')](_0x27ff16,_0x24f188)[_0xfed0('0x10')](function(_0x3cdfc0){logger[_0xfed0('0x11')](_0xfed0('0x12'),_0xbf7cdf,_0xfed0('0x13'));logger['debug'](_0xfed0('0x14'),_0xbf7cdf,'request\x20sent',JSON['stringify'](_0x3cdfc0));if(_0x3cdfc0[_0xfed0('0x15')]){if(_0x3cdfc0[_0xfed0('0x15')]['code']===0x1f4){logger[_0xfed0('0x15')](_0xfed0('0x12'),_0xbf7cdf,_0x3cdfc0[_0xfed0('0x15')][_0xfed0('0x16')]);return _0x464c47(_0x3cdfc0['error']['message']);}logger[_0xfed0('0x15')](_0xfed0('0x12'),_0xbf7cdf,_0x3cdfc0['error'][_0xfed0('0x16')]);return _0x556a8b(_0x3cdfc0['error']['message']);}else{logger['info'](_0xfed0('0x12'),_0xbf7cdf,'request\x20sent');_0x556a8b(_0x3cdfc0[_0xfed0('0x17')][_0xfed0('0x16')]);}})[_0xfed0('0x18')](function(_0x121e5f){logger[_0xfed0('0x15')](_0xfed0('0x12'),_0xbf7cdf,_0x121e5f);_0x464c47(_0x121e5f);});});}exports[_0xfed0('0x19')]=function(_0x12d3d2){var _0x4e82b3=this;return new Promise(function(_0x316e66,_0x4d66a9){return db[_0xfed0('0x1a')]['create'](_0x12d3d2[_0xfed0('0x1b')],{'raw':_0x12d3d2[_0xfed0('0x1c')]?_0x12d3d2[_0xfed0('0x1c')][_0xfed0('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x581d7d){logger[_0xfed0('0x11')](_0xfed0('0x19'),_0x12d3d2);logger['debug'](_0xfed0('0x19'),_0x12d3d2,JSON['stringify'](_0x581d7d));_0x316e66(_0x581d7d);})['catch'](function(_0x228f0e){logger['error'](_0xfed0('0x19'),_0x228f0e[_0xfed0('0x16')],_0x12d3d2);_0x4d66a9(_0x4e82b3['error'](0x1f4,_0x228f0e[_0xfed0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e4cc446..4e1f170 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 _0x8b20=['remove','update','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x181d63,_0x4c5932){var _0x2b32c3=function(_0x2b14aa){while(--_0x2b14aa){_0x181d63['push'](_0x181d63['shift']());}};_0x2b32c3(++_0x4c5932);}(_0x8b20,0x1ae));var _0x08b2=function(_0x5918e9,_0x1142f5){_0x5918e9=_0x5918e9-0x0;var _0x151838=_0x8b20[_0x5918e9];return _0x151838;};'use strict';var SmsMessageEvents=require(_0x08b2('0x0'));var events=[_0x08b2('0x1'),_0x08b2('0x2'),_0x08b2('0x3')];function createListener(_0x13e3af,_0x12d63a){return function(_0x286acc){_0x12d63a['emit'](_0x13e3af,_0x286acc);};}function removeListener(_0xb0e01b,_0x4c2f7f){return function(){SmsMessageEvents[_0x08b2('0x4')](_0xb0e01b,_0x4c2f7f);};}exports[_0x08b2('0x5')]=function(_0x307272){for(var _0x486d5f=0x0,_0x147578=events[_0x08b2('0x6')];_0x486d5f<_0x147578;_0x486d5f++){var _0x499eac=events[_0x486d5f];var _0x4394f6=createListener(_0x08b2('0x7')+_0x499eac,_0x307272);SmsMessageEvents['on'](_0x499eac,_0x4394f6);}}; \ No newline at end of file +var _0xabb4=['register','length','./smsMessage.events','remove','update','emit','removeListener'];(function(_0x266ac7,_0x1d3ea9){var _0x3eb0f1=function(_0x50648f){while(--_0x50648f){_0x266ac7['push'](_0x266ac7['shift']());}};_0x3eb0f1(++_0x1d3ea9);}(_0xabb4,0x79));var _0x4abb=function(_0x55be64,_0x3bc0e9){_0x55be64=_0x55be64-0x0;var _0x434049=_0xabb4[_0x55be64];return _0x434049;};'use strict';var SmsMessageEvents=require(_0x4abb('0x0'));var events=['save',_0x4abb('0x1'),_0x4abb('0x2')];function createListener(_0x2a70ce,_0x40a89a){return function(_0x6b1d24){_0x40a89a[_0x4abb('0x3')](_0x2a70ce,_0x6b1d24);};}function removeListener(_0x7fec11,_0x5a2e5c){return function(){SmsMessageEvents[_0x4abb('0x4')](_0x7fec11,_0x5a2e5c);};}exports[_0x4abb('0x5')]=function(_0x4526d7){for(var _0x3e6237=0x0,_0x275a2b=events[_0x4abb('0x6')];_0x3e6237<_0x275a2b;_0x3e6237++){var _0x5b5478=events[_0x3e6237];var _0x589803=createListener('smsMessage:'+_0x5b5478,_0x4526d7);SmsMessageEvents['on'](_0x5b5478,_0x589803);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e093b3d..fcae8f8 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 _0x2a96=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','index','/describe','describe','isAuthenticated','show','/:id/members','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','/:id','update','delete','removeAgents','exports'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x2a96,0x13f));var _0x62a9=function(_0x32fc14,_0x20cd7b){_0x32fc14=_0x32fc14-0x0;var _0x434767=_0x2a96[_0x32fc14];return _0x434767;};'use strict';var multer=require(_0x62a9('0x0'));var util=require(_0x62a9('0x1'));var path=require(_0x62a9('0x2'));var timeout=require(_0x62a9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x62a9('0x4'));var auth=require(_0x62a9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x62a9('0x6'));var controller=require(_0x62a9('0x7'));router[_0x62a9('0x8')]('/',auth['isAuthenticated'](),controller[_0x62a9('0x9')]);router[_0x62a9('0x8')](_0x62a9('0xa'),auth['isAuthenticated'](),controller[_0x62a9('0xb')]);router[_0x62a9('0x8')]('/:id',auth[_0x62a9('0xc')](),controller[_0x62a9('0xd')]);router['get'](_0x62a9('0xe'),auth[_0x62a9('0xc')](),controller['getMembers']);router[_0x62a9('0x8')]('/:id/teams',auth[_0x62a9('0xc')](),controller[_0x62a9('0xf')]);router[_0x62a9('0x8')]('/:id/users',auth[_0x62a9('0xc')](),controller[_0x62a9('0x10')]);router[_0x62a9('0x11')]('/',auth[_0x62a9('0xc')](),controller[_0x62a9('0x12')]);router[_0x62a9('0x11')](_0x62a9('0x13'),auth['isAuthenticated'](),controller[_0x62a9('0x14')]);router[_0x62a9('0x11')](_0x62a9('0x15'),auth[_0x62a9('0xc')](),controller[_0x62a9('0x16')]);router[_0x62a9('0x17')](_0x62a9('0x18'),auth[_0x62a9('0xc')](),controller[_0x62a9('0x19')]);router[_0x62a9('0x1a')](_0x62a9('0x18'),auth[_0x62a9('0xc')](),controller['destroy']);router['delete'](_0x62a9('0x13'),auth[_0x62a9('0xc')](),controller['removeTeams']);router[_0x62a9('0x1a')](_0x62a9('0x15'),auth[_0x62a9('0xc')](),controller[_0x62a9('0x1b')]);module[_0x62a9('0x1c')]=router; \ No newline at end of file +var _0x8aa3=['delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8aa3,0xde));var _0x38aa=function(_0x5b028c,_0x23dfd5){_0x5b028c=_0x5b028c-0x0;var _0x209095=_0x8aa3[_0x5b028c];return _0x209095;};'use strict';var multer=require('multer');var util=require(_0x38aa('0x0'));var path=require('path');var timeout=require(_0x38aa('0x1'));var express=require(_0x38aa('0x2'));var router=express[_0x38aa('0x3')]();var fs_extra=require(_0x38aa('0x4'));var auth=require(_0x38aa('0x5'));var interaction=require(_0x38aa('0x6'));var config=require(_0x38aa('0x7'));var controller=require(_0x38aa('0x8'));router[_0x38aa('0x9')]('/',auth['isAuthenticated'](),controller[_0x38aa('0xa')]);router[_0x38aa('0x9')](_0x38aa('0xb'),auth['isAuthenticated'](),controller[_0x38aa('0xc')]);router[_0x38aa('0x9')](_0x38aa('0xd'),auth[_0x38aa('0xe')](),controller[_0x38aa('0xf')]);router[_0x38aa('0x9')](_0x38aa('0x10'),auth[_0x38aa('0xe')](),controller['getMembers']);router[_0x38aa('0x9')](_0x38aa('0x11'),auth[_0x38aa('0xe')](),controller['getTeams']);router[_0x38aa('0x9')](_0x38aa('0x12'),auth[_0x38aa('0xe')](),controller[_0x38aa('0x13')]);router[_0x38aa('0x14')]('/',auth['isAuthenticated'](),controller[_0x38aa('0x15')]);router[_0x38aa('0x14')]('/:id/teams',auth[_0x38aa('0xe')](),controller[_0x38aa('0x16')]);router[_0x38aa('0x14')](_0x38aa('0x12'),auth[_0x38aa('0xe')](),controller[_0x38aa('0x17')]);router[_0x38aa('0x18')](_0x38aa('0xd'),auth[_0x38aa('0xe')](),controller[_0x38aa('0x19')]);router[_0x38aa('0x1a')]('/:id',auth[_0x38aa('0xe')](),controller[_0x38aa('0x1b')]);router[_0x38aa('0x1a')](_0x38aa('0x11'),auth['isAuthenticated'](),controller[_0x38aa('0x1c')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x38aa('0x1d')]);module[_0x38aa('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5c0253c..5800e72 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 _0xa5cc=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xa5cc,0x18b));var _0xca5c=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xa5cc[_0x1a7846];return _0x48049;};'use strict';var Sequelize=require(_0xca5c('0x0'));module[_0xca5c('0x1')]={'name':{'type':Sequelize[_0xca5c('0x2')],'unique':_0xca5c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xca5c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xca5c('0x5')](_0xca5c('0x6'),_0xca5c('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x04a1=['rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x30eb36,_0x4f7dab){var _0x1b33d1=function(_0x4ab0ff){while(--_0x4ab0ff){_0x30eb36['push'](_0x30eb36['shift']());}};_0x1b33d1(++_0x4f7dab);}(_0x04a1,0x1de));var _0x104a=function(_0x10848c,_0x47f899){_0x10848c=_0x10848c-0x0;var _0x66609e=_0x04a1[_0x10848c];return _0x66609e;};'use strict';var Sequelize=require(_0x104a('0x0'));module[_0x104a('0x1')]={'name':{'type':Sequelize[_0x104a('0x2')],'unique':_0x104a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x104a('0x2')]},'timeout':{'type':Sequelize[_0x104a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x104a('0x5'),_0x104a('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ee2e6fe..8d45e9d 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x22ada8,_0x23a7ea){var _0x506e36=function(_0xd6ed10){while(--_0xd6ed10){_0x22ada8['push'](_0x22ada8['shift']());}};_0x506e36(++_0x23a7ea);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b2f8a,_0x68146b){_0x2b2f8a=_0x2b2f8a-0x0;var _0x241025=_0x5f2f[_0x2b2f8a];return _0x241025;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x0b0e[_0x149ca0];return _0x56b6b9;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 6865dce..9434129 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 _0xc840=['hasOwnProperty','hook','exports','events','setMaxListeners','update','emit'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xc840,0xb9));var _0x0c84=function(_0x5ef35c,_0x26ea6d){_0x5ef35c=_0x5ef35c-0x0;var _0x4244c6=_0xc840[_0x5ef35c];return _0x4244c6;};'use strict';var EventEmitter=require(_0x0c84('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x0c84('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0c84('0x2'),'afterDestroy':'remove'};function emitEvent(_0x223589){return function(_0x2df986,_0x50a1a7,_0x2c6c8b){SmsQueueEvents[_0x0c84('0x3')](_0x223589+':'+_0x2df986['id'],_0x2df986);SmsQueueEvents[_0x0c84('0x3')](_0x223589,_0x2df986);_0x2c6c8b(null);};}for(var e in events){if(events[_0x0c84('0x4')](e)){var event=events[e];SmsQueue[_0x0c84('0x5')](e,emitEvent(event));}}module[_0x0c84('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0xace1=['exports','events','SmsQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x315c67,_0x2ca2fa){var _0x6b82b=function(_0x156797){while(--_0x156797){_0x315c67['push'](_0x315c67['shift']());}};_0x6b82b(++_0x2ca2fa);}(_0xace1,0x159));var _0x1ace=function(_0x438ce6,_0x1e5b94){_0x438ce6=_0x438ce6-0x0;var _0x8cd45c=_0xace1[_0x438ce6];return _0x8cd45c;};'use strict';var EventEmitter=require(_0x1ace('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x1ace('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ace('0x2'),'afterDestroy':_0x1ace('0x3')};function emitEvent(_0x310423){return function(_0xed64a9,_0x295647,_0x4ab17c){SmsQueueEvents[_0x1ace('0x4')](_0x310423+':'+_0xed64a9['id'],_0xed64a9);SmsQueueEvents[_0x1ace('0x4')](_0x310423,_0xed64a9);_0x4ab17c(null);};}for(var e in events){if(events[_0x1ace('0x5')](e)){var event=events[e];SmsQueue[_0x1ace('0x6')](e,emitEvent(event));}}module[_0x1ace('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 236abd4..7eb03b3 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 _0x6900=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2868c9,_0x38d8a5){var _0x119510=function(_0xc87040){while(--_0xc87040){_0x2868c9['push'](_0x2868c9['shift']());}};_0x119510(++_0x38d8a5);}(_0x6900,0x148));var _0x0690=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x6900[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x0690('0x0'));var util=require(_0x0690('0x1'));var logger=require(_0x0690('0x2'))(_0x0690('0x3'));var moment=require(_0x0690('0x4'));var BPromise=require(_0x0690('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0690('0x6'));var rimraf=require(_0x0690('0x7'));var config=require(_0x0690('0x8'));var attributes=require(_0x0690('0x9'));module[_0x0690('0xa')]=function(_0x2ec1c6,_0x2426b6){return _0x2ec1c6[_0x0690('0xb')](_0x0690('0xc'),attributes,{'tableName':_0x0690('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x068c=['sms_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue'];(function(_0x5ea60d,_0xf1b6f3){var _0x1d14eb=function(_0x5a348d){while(--_0x5a348d){_0x5ea60d['push'](_0x5ea60d['shift']());}};_0x1d14eb(++_0xf1b6f3);}(_0x068c,0x91));var _0xc068=function(_0x44e30a,_0x8250ca){_0x44e30a=_0x44e30a-0x0;var _0x50d154=_0x068c[_0x44e30a];return _0x50d154;};'use strict';var _=require(_0xc068('0x0'));var util=require(_0xc068('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc068('0x2'));var BPromise=require(_0xc068('0x3'));var rp=require(_0xc068('0x4'));var fs=require('fs');var path=require(_0xc068('0x5'));var rimraf=require(_0xc068('0x6'));var config=require(_0xc068('0x7'));var attributes=require(_0xc068('0x8'));module[_0xc068('0x9')]=function(_0x10e90c,_0x1785e1){return _0x10e90c['define'](_0xc068('0xa'),attributes,{'tableName':_0xc068('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 1b614e0..3d548d3 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 _0xb3e1=['error','message','request\x20sent','result','catch','SmsQueue','findAll','options','raw','where','attributes','map','include','model','GetSmsQueue','stringify','find','ShowSmsQueue','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x656657,_0x4065d0){var _0x154ae9=function(_0x19aca0){while(--_0x19aca0){_0x656657['push'](_0x656657['shift']());}};_0x154ae9(++_0x4065d0);}(_0xb3e1,0xf0));var _0x1b3e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xb3e1[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x1b3e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1b3e('0x1'));var fs=require('fs');var Redis=require(_0x1b3e('0x2'));var db=require(_0x1b3e('0x3'))['db'];var utils=require(_0x1b3e('0x4'));var logger=require(_0x1b3e('0x5'))(_0x1b3e('0x6'));var config=require(_0x1b3e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b3e('0x8')]({'port':0x232a});config[_0x1b3e('0x9')]=_['defaults'](config[_0x1b3e('0x9')],{'host':_0x1b3e('0xa'),'port':0x18eb});var socket=require(_0x1b3e('0xb'))(new Redis(config[_0x1b3e('0x9')]));require(_0x1b3e('0xc'))[_0x1b3e('0xd')](socket);function respondWithRpcPromise(_0x89a376,_0x4b63fb,_0x3db90b){return new BPromise(function(_0x40caad,_0x122aac){return client['request'](_0x89a376,_0x3db90b)[_0x1b3e('0xe')](function(_0x2814e0){logger[_0x1b3e('0xf')](_0x1b3e('0x10'),_0x4b63fb,'request\x20sent');logger[_0x1b3e('0x11')](_0x1b3e('0x12'),_0x4b63fb,'request\x20sent',JSON['stringify'](_0x2814e0));if(_0x2814e0['error']){if(_0x2814e0[_0x1b3e('0x13')]['code']===0x1f4){logger['error'](_0x1b3e('0x10'),_0x4b63fb,_0x2814e0[_0x1b3e('0x13')][_0x1b3e('0x14')]);return _0x122aac(_0x2814e0['error'][_0x1b3e('0x14')]);}logger['error'](_0x1b3e('0x10'),_0x4b63fb,_0x2814e0[_0x1b3e('0x13')][_0x1b3e('0x14')]);return _0x40caad(_0x2814e0['error'][_0x1b3e('0x14')]);}else{logger['info'](_0x1b3e('0x10'),_0x4b63fb,_0x1b3e('0x15'));_0x40caad(_0x2814e0[_0x1b3e('0x16')][_0x1b3e('0x14')]);}})[_0x1b3e('0x17')](function(_0x1bc3ed){logger[_0x1b3e('0x13')](_0x1b3e('0x10'),_0x4b63fb,_0x1bc3ed);_0x122aac(_0x1bc3ed);});});}exports['GetSmsQueue']=function(_0x331007){var _0x36766d=this;return new Promise(function(_0x5c8cb8,_0x3d070e){return db[_0x1b3e('0x18')][_0x1b3e('0x19')]({'raw':_0x331007['options']?_0x331007[_0x1b3e('0x1a')][_0x1b3e('0x1b')]===undefined?!![]:![]:!![],'where':_0x331007['options']?_0x331007[_0x1b3e('0x1a')][_0x1b3e('0x1c')]||null:null,'attributes':_0x331007[_0x1b3e('0x1a')]?_0x331007[_0x1b3e('0x1a')][_0x1b3e('0x1d')]||null:null,'limit':_0x331007[_0x1b3e('0x1a')]?_0x331007[_0x1b3e('0x1a')]['limit']||null:null,'include':_0x331007[_0x1b3e('0x1a')]?_0x331007[_0x1b3e('0x1a')]['include']?_[_0x1b3e('0x1e')](_0x331007[_0x1b3e('0x1a')][_0x1b3e('0x1f')],function(_0x280ede){return{'model':db[_0x280ede[_0x1b3e('0x20')]],'as':_0x280ede['as'],'attributes':_0x280ede[_0x1b3e('0x1d')],'include':_0x280ede['include']?_[_0x1b3e('0x1e')](_0x280ede[_0x1b3e('0x1f')],function(_0x5a98be){return{'model':db[_0x5a98be[_0x1b3e('0x20')]],'as':_0x5a98be['as'],'attributes':_0x5a98be[_0x1b3e('0x1d')],'include':_0x5a98be['include']?_[_0x1b3e('0x1e')](_0x5a98be[_0x1b3e('0x1f')],function(_0x5c994b){return{'model':db[_0x5c994b[_0x1b3e('0x20')]],'as':_0x5c994b['as'],'attributes':_0x5c994b['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b3e('0xe')](function(_0x3e45be){logger[_0x1b3e('0xf')]('GetSmsQueue',_0x331007);logger[_0x1b3e('0x11')](_0x1b3e('0x21'),_0x331007,JSON[_0x1b3e('0x22')](_0x3e45be));_0x5c8cb8(_0x3e45be);})[_0x1b3e('0x17')](function(_0x1f5f5c){logger[_0x1b3e('0x13')]('GetSmsQueue',_0x1f5f5c['message'],_0x331007);_0x3d070e(_0x36766d[_0x1b3e('0x13')](0x1f4,_0x1f5f5c[_0x1b3e('0x14')]));});});};exports['ShowSmsQueue']=function(_0x4b9907){var _0x271eb5=this;return new Promise(function(_0x5772e3,_0x369e01){return db['SmsQueue'][_0x1b3e('0x23')]({'raw':_0x4b9907[_0x1b3e('0x1a')]?_0x4b9907['options'][_0x1b3e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b9907[_0x1b3e('0x1a')]?_0x4b9907[_0x1b3e('0x1a')][_0x1b3e('0x1c')]||null:null,'attributes':_0x4b9907['options']?_0x4b9907[_0x1b3e('0x1a')]['attributes']||null:null,'include':_0x4b9907[_0x1b3e('0x1a')]?_0x4b9907[_0x1b3e('0x1a')]['include']?_[_0x1b3e('0x1e')](_0x4b9907['options'][_0x1b3e('0x1f')],function(_0x46e9e5){return{'model':db[_0x46e9e5['model']],'as':_0x46e9e5['as'],'attributes':_0x46e9e5[_0x1b3e('0x1d')],'include':_0x46e9e5[_0x1b3e('0x1f')]?_[_0x1b3e('0x1e')](_0x46e9e5[_0x1b3e('0x1f')],function(_0x1062d4){return{'model':db[_0x1062d4[_0x1b3e('0x20')]],'as':_0x1062d4['as'],'attributes':_0x1062d4[_0x1b3e('0x1d')],'include':_0x1062d4[_0x1b3e('0x1f')]?_['map'](_0x1062d4['include'],function(_0x51d86d){return{'model':db[_0x51d86d[_0x1b3e('0x20')]],'as':_0x51d86d['as'],'attributes':_0x51d86d[_0x1b3e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1b3e('0xe')](function(_0x1cd683){logger['info'](_0x1b3e('0x24'),_0x4b9907);logger[_0x1b3e('0x11')](_0x1b3e('0x24'),_0x4b9907,JSON[_0x1b3e('0x22')](_0x1cd683));_0x5772e3(_0x1cd683);})[_0x1b3e('0x17')](function(_0x39feff){logger['error'](_0x1b3e('0x24'),_0x39feff[_0x1b3e('0x14')],_0x4b9907);_0x369e01(_0x271eb5[_0x1b3e('0x13')](0x1f4,_0x39feff[_0x1b3e('0x14')]));});});}; \ No newline at end of file +var _0x45e5=['util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowSmsQueue','lodash'];(function(_0x820867,_0x64e498){var _0x1efea4=function(_0x52c426){while(--_0x52c426){_0x820867['push'](_0x820867['shift']());}};_0x1efea4(++_0x64e498);}(_0x45e5,0x13f));var _0x545e=function(_0x489544,_0x1c54b5){_0x489544=_0x489544-0x0;var _0x42f404=_0x45e5[_0x489544];return _0x42f404;};'use strict';var _=require(_0x545e('0x0'));var util=require(_0x545e('0x1'));var moment=require('moment');var BPromise=require(_0x545e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x545e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x545e('0x4'));var logger=require(_0x545e('0x5'))(_0x545e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x545e('0x7')][_0x545e('0x8')]({'port':0x232a});config[_0x545e('0x9')]=_[_0x545e('0xa')](config['redis'],{'host':_0x545e('0xb'),'port':0x18eb});var socket=require(_0x545e('0xc'))(new Redis(config['redis']));require(_0x545e('0xd'))[_0x545e('0xe')](socket);function respondWithRpcPromise(_0x1a9f31,_0x17cd60,_0x3ea283){return new BPromise(function(_0x2d16e9,_0x4012aa){return client[_0x545e('0xf')](_0x1a9f31,_0x3ea283)['then'](function(_0x58f200){logger[_0x545e('0x10')](_0x545e('0x11'),_0x17cd60,_0x545e('0x12'));logger[_0x545e('0x13')](_0x545e('0x14'),_0x17cd60,_0x545e('0x12'),JSON[_0x545e('0x15')](_0x58f200));if(_0x58f200[_0x545e('0x16')]){if(_0x58f200[_0x545e('0x16')][_0x545e('0x17')]===0x1f4){logger['error'](_0x545e('0x11'),_0x17cd60,_0x58f200[_0x545e('0x16')][_0x545e('0x18')]);return _0x4012aa(_0x58f200[_0x545e('0x16')][_0x545e('0x18')]);}logger[_0x545e('0x16')](_0x545e('0x11'),_0x17cd60,_0x58f200[_0x545e('0x16')][_0x545e('0x18')]);return _0x2d16e9(_0x58f200[_0x545e('0x16')][_0x545e('0x18')]);}else{logger[_0x545e('0x10')]('SmsQueue,\x20%s,\x20%s',_0x17cd60,_0x545e('0x12'));_0x2d16e9(_0x58f200[_0x545e('0x19')][_0x545e('0x18')]);}})[_0x545e('0x1a')](function(_0x57e24d){logger[_0x545e('0x16')](_0x545e('0x11'),_0x17cd60,_0x57e24d);_0x4012aa(_0x57e24d);});});}exports[_0x545e('0x1b')]=function(_0x135cd9){var _0x360f40=this;return new Promise(function(_0x3e3966,_0x2a7de0){return db[_0x545e('0x1c')][_0x545e('0x1d')]({'raw':_0x135cd9[_0x545e('0x1e')]?_0x135cd9['options'][_0x545e('0x1f')]===undefined?!![]:![]:!![],'where':_0x135cd9['options']?_0x135cd9[_0x545e('0x1e')][_0x545e('0x20')]||null:null,'attributes':_0x135cd9[_0x545e('0x1e')]?_0x135cd9[_0x545e('0x1e')][_0x545e('0x21')]||null:null,'limit':_0x135cd9[_0x545e('0x1e')]?_0x135cd9['options'][_0x545e('0x22')]||null:null,'include':_0x135cd9[_0x545e('0x1e')]?_0x135cd9[_0x545e('0x1e')]['include']?_['map'](_0x135cd9[_0x545e('0x1e')][_0x545e('0x23')],function(_0x312008){return{'model':db[_0x312008[_0x545e('0x24')]],'as':_0x312008['as'],'attributes':_0x312008['attributes'],'include':_0x312008['include']?_['map'](_0x312008[_0x545e('0x23')],function(_0x4cdb6e){return{'model':db[_0x4cdb6e[_0x545e('0x24')]],'as':_0x4cdb6e['as'],'attributes':_0x4cdb6e[_0x545e('0x21')],'include':_0x4cdb6e[_0x545e('0x23')]?_[_0x545e('0x25')](_0x4cdb6e[_0x545e('0x23')],function(_0x48047f){return{'model':db[_0x48047f[_0x545e('0x24')]],'as':_0x48047f['as'],'attributes':_0x48047f[_0x545e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x545e('0x26')](function(_0x1a8d31){logger[_0x545e('0x10')](_0x545e('0x1b'),_0x135cd9);logger['debug'](_0x545e('0x1b'),_0x135cd9,JSON['stringify'](_0x1a8d31));_0x3e3966(_0x1a8d31);})[_0x545e('0x1a')](function(_0x4a698a){logger['error'](_0x545e('0x1b'),_0x4a698a[_0x545e('0x18')],_0x135cd9);_0x2a7de0(_0x360f40[_0x545e('0x16')](0x1f4,_0x4a698a[_0x545e('0x18')]));});});};exports[_0x545e('0x27')]=function(_0x5b6f18){var _0x3ce1e4=this;return new Promise(function(_0x2f33ed,_0xdff3a){return db[_0x545e('0x1c')]['find']({'raw':_0x5b6f18[_0x545e('0x1e')]?_0x5b6f18[_0x545e('0x1e')][_0x545e('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b6f18[_0x545e('0x1e')]?_0x5b6f18[_0x545e('0x1e')]['where']||null:null,'attributes':_0x5b6f18[_0x545e('0x1e')]?_0x5b6f18[_0x545e('0x1e')][_0x545e('0x21')]||null:null,'include':_0x5b6f18[_0x545e('0x1e')]?_0x5b6f18[_0x545e('0x1e')][_0x545e('0x23')]?_[_0x545e('0x25')](_0x5b6f18[_0x545e('0x1e')]['include'],function(_0x30ead5){return{'model':db[_0x30ead5[_0x545e('0x24')]],'as':_0x30ead5['as'],'attributes':_0x30ead5[_0x545e('0x21')],'include':_0x30ead5['include']?_[_0x545e('0x25')](_0x30ead5[_0x545e('0x23')],function(_0xc52d5b){return{'model':db[_0xc52d5b[_0x545e('0x24')]],'as':_0xc52d5b['as'],'attributes':_0xc52d5b[_0x545e('0x21')],'include':_0xc52d5b[_0x545e('0x23')]?_[_0x545e('0x25')](_0xc52d5b[_0x545e('0x23')],function(_0x31af81){return{'model':db[_0x31af81[_0x545e('0x24')]],'as':_0x31af81['as'],'attributes':_0x31af81[_0x545e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c0a3){logger['info'](_0x545e('0x27'),_0x5b6f18);logger[_0x545e('0x13')]('ShowSmsQueue',_0x5b6f18,JSON['stringify'](_0x51c0a3));_0x2f33ed(_0x51c0a3);})[_0x545e('0x1a')](function(_0x4a95c8){logger[_0x545e('0x16')]('ShowSmsQueue',_0x4a95c8[_0x545e('0x18')],_0x5b6f18);_0xdff3a(_0x3ce1e4[_0x545e('0x16')](0x1f4,_0x4a95c8[_0x545e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 999d0a8..94e8d77 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 _0x5635=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x52ac46,_0x35df0a){var _0x4ab2be=function(_0x86705c){while(--_0x86705c){_0x52ac46['push'](_0x52ac46['shift']());}};_0x4ab2be(++_0x35df0a);}(_0x5635,0x1eb));var _0x5563=function(_0x19cdb8,_0x5943c2){_0x19cdb8=_0x19cdb8-0x0;var _0x1dfd32=_0x5635[_0x19cdb8];return _0x1dfd32;};'use strict';var SmsQueueEvents=require(_0x5563('0x0'));var events=[_0x5563('0x1'),_0x5563('0x2'),_0x5563('0x3')];function createListener(_0x113f63,_0x3b1297){return function(_0x155b9e){_0x3b1297[_0x5563('0x4')](_0x113f63,_0x155b9e);};}function removeListener(_0x39aebe,_0x26783c){return function(){SmsQueueEvents['removeListener'](_0x39aebe,_0x26783c);};}exports[_0x5563('0x5')]=function(_0x19b085){for(var _0xd784fb=0x0,_0xed63bc=events[_0x5563('0x6')];_0xd784fb<_0xed63bc;_0xd784fb++){var _0x3e4464=events[_0xd784fb];var _0x17224f=createListener(_0x5563('0x7')+_0x3e4464,_0x19b085);SmsQueueEvents['on'](_0x3e4464,_0x17224f);}}; \ No newline at end of file +var _0xb0db=['emit','length','./smsQueue.events','save','remove'];(function(_0x2a8879,_0x1aff4f){var _0xff5dc9=function(_0x1e13f4){while(--_0x1e13f4){_0x2a8879['push'](_0x2a8879['shift']());}};_0xff5dc9(++_0x1aff4f);}(_0xb0db,0x106));var _0xbb0d=function(_0x9b6975,_0x63c435){_0x9b6975=_0x9b6975-0x0;var _0x3f3132=_0xb0db[_0x9b6975];return _0x3f3132;};'use strict';var SmsQueueEvents=require(_0xbb0d('0x0'));var events=[_0xbb0d('0x1'),_0xbb0d('0x2'),'update'];function createListener(_0x26c2fb,_0x539043){return function(_0x4b4a6f){_0x539043[_0xbb0d('0x3')](_0x26c2fb,_0x4b4a6f);};}function removeListener(_0x15fcf1,_0x9c40f5){return function(){SmsQueueEvents['removeListener'](_0x15fcf1,_0x9c40f5);};}exports['register']=function(_0x4a1a39){for(var _0x5bc212=0x0,_0x44572a=events[_0xbb0d('0x4')];_0x5bc212<_0x44572a;_0x5bc212++){var _0x1c5f78=events[_0x5bc212];var _0x2275dc=createListener('smsQueue:'+_0x1c5f78,_0x4a1a39);SmsQueueEvents['on'](_0x1c5f78,_0x2275dc);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 36d382d..7bb2cfb 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 _0x13e3=['/:id','show','post','create','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x549cf2,_0x41b5b3){var _0x35d0e5=function(_0x3b7777){while(--_0x3b7777){_0x549cf2['push'](_0x549cf2['shift']());}};_0x35d0e5(++_0x41b5b3);}(_0x13e3,0x137));var _0x313e=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x13e3[_0x580b15];return _0x1adb1b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x313e('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x313e('0x1')]();var fs_extra=require(_0x313e('0x2'));var auth=require(_0x313e('0x3'));var interaction=require(_0x313e('0x4'));var config=require('../../config/environment');var controller=require(_0x313e('0x5'));router[_0x313e('0x6')]('/',auth[_0x313e('0x7')](),controller['index']);router[_0x313e('0x6')](_0x313e('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x313e('0x9'),auth[_0x313e('0x7')](),controller[_0x313e('0xa')]);router[_0x313e('0xb')]('/',auth[_0x313e('0x7')](),controller[_0x313e('0xc')]);router['put'](_0x313e('0x9'),auth[_0x313e('0x7')](),controller['update']);router[_0x313e('0xd')](_0x313e('0x9'),auth['isAuthenticated'](),controller[_0x313e('0xe')]);module[_0x313e('0xf')]=router; \ No newline at end of file +var _0x15ad=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','create','delete','destroy','exports','multer','util','path'];(function(_0x5ca44a,_0x4865c9){var _0x9372b9=function(_0x1301ea){while(--_0x1301ea){_0x5ca44a['push'](_0x5ca44a['shift']());}};_0x9372b9(++_0x4865c9);}(_0x15ad,0x19b));var _0xd15a=function(_0x346651,_0x55ce9e){_0x346651=_0x346651-0x0;var _0x1d6106=_0x15ad[_0x346651];return _0x1d6106;};'use strict';var multer=require(_0xd15a('0x0'));var util=require(_0xd15a('0x1'));var path=require(_0xd15a('0x2'));var timeout=require(_0xd15a('0x3'));var express=require(_0xd15a('0x4'));var router=express['Router']();var fs_extra=require(_0xd15a('0x5'));var auth=require(_0xd15a('0x6'));var interaction=require(_0xd15a('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xd15a('0x8')](),controller['index']);router[_0xd15a('0x9')](_0xd15a('0xa'),auth['isAuthenticated'](),controller[_0xd15a('0xb')]);router[_0xd15a('0x9')](_0xd15a('0xc'),auth[_0xd15a('0x8')](),controller[_0xd15a('0xd')]);router['post']('/',auth[_0xd15a('0x8')](),controller[_0xd15a('0xe')]);router['put'](_0xd15a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd15a('0xf')](_0xd15a('0xc'),auth['isAuthenticated'](),controller[_0xd15a('0x10')]);module[_0xd15a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6ccaf13..32c7e79 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 _0xcbcc=['moment','STRING','DATE'];(function(_0x2e8802,_0x59ad8c){var _0x4617aa=function(_0x4380b4){while(--_0x4380b4){_0x2e8802['push'](_0x2e8802['shift']());}};_0x4617aa(++_0x59ad8c);}(_0xcbcc,0x198));var _0xccbc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcbcc[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0xccbc('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xccbc('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xccbc('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xccbc('0x2')]},'acceptAt':{'type':Sequelize[_0xccbc('0x2')]},'exitAt':{'type':Sequelize[_0xccbc('0x2')]},'reason':{'type':Sequelize[_0xccbc('0x1')]}}; \ No newline at end of file +var _0x8d8e=['STRING','DATE','moment','sequelize','exports'];(function(_0x37182a,_0x2c4cfd){var _0x360384=function(_0x54ec95){while(--_0x54ec95){_0x37182a['push'](_0x37182a['shift']());}};_0x360384(++_0x2c4cfd);}(_0x8d8e,0xd9));var _0xe8d8=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8d8e[_0x46aff0];return _0x9d78cf;};'use strict';var moment=require(_0xe8d8('0x0'));var Sequelize=require(_0xe8d8('0x1'));module[_0xe8d8('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe8d8('0x3')]},'joinAt':{'type':Sequelize[_0xe8d8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe8d8('0x4')]},'exitAt':{'type':Sequelize[_0xe8d8('0x4')]},'reason':{'type':Sequelize[_0xe8d8('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index cff913b..77c218b 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 _0xb71f=['merge','type','VIRTUAL','SmsQueueReport','includeAll','rows','catch','params','include','options','find','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','sort','pick','filter','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb71f,0x17d));var _0xfb71=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0xb71f[_0x2bfe52];return _0x1cf649;};'use strict';var emlformat=require(_0xfb71('0x0'));var rimraf=require(_0xfb71('0x1'));var zipdir=require(_0xfb71('0x2'));var jsonpatch=require(_0xfb71('0x3'));var rp=require(_0xfb71('0x4'));var moment=require('moment');var BPromise=require(_0xfb71('0x5'));var Mustache=require(_0xfb71('0x6'));var util=require(_0xfb71('0x7'));var path=require('path');var sox=require(_0xfb71('0x8'));var csv=require(_0xfb71('0x9'));var ejs=require(_0xfb71('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb71('0xb'));var squel=require(_0xfb71('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb71('0xd'));var deskjs=require(_0xfb71('0xe'));var toCsv=require(_0xfb71('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb71('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfb71('0x10'));var as=require(_0xfb71('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb71('0x12'))(_0xfb71('0x13'));var utils=require('../../config/utils');var config=require(_0xfb71('0x14'));var licenseUtil=require(_0xfb71('0x15'));var db=require(_0xfb71('0x16'))['db'];function respondWithStatusCode(_0x12c992,_0x4d85a1){_0x4d85a1=_0x4d85a1||0xcc;return function(_0x45d7f5){if(_0x45d7f5){return _0x12c992[_0xfb71('0x17')](_0x4d85a1);}return _0x12c992[_0xfb71('0x18')](_0x4d85a1)[_0xfb71('0x19')]();};}function respondWithResult(_0x11167b,_0x58fd9c){_0x58fd9c=_0x58fd9c||0xc8;return function(_0x233281){if(_0x233281){return _0x11167b[_0xfb71('0x18')](_0x58fd9c)[_0xfb71('0x1a')](_0x233281);}};}function respondWithFilteredResult(_0x249402,_0x324b9){return function(_0x63d9ad){if(_0x63d9ad){var _0x21fa80=typeof _0x324b9[_0xfb71('0x1b')]==='undefined'&&typeof _0x324b9[_0xfb71('0x1c')]===_0xfb71('0x1d');var _0x262838=_0x63d9ad[_0xfb71('0x1e')];var _0x409c93=_0x21fa80?0x0:_0x324b9[_0xfb71('0x1b')];var _0x23e800=_0x21fa80?_0x63d9ad[_0xfb71('0x1e')]:_0x324b9['offset']+_0x324b9[_0xfb71('0x1c')];var _0x496f17;if(_0x23e800>=_0x262838){_0x23e800=_0x262838;_0x496f17=0xc8;}else{_0x496f17=0xce;}_0x249402['status'](_0x496f17);return _0x249402['set'](_0xfb71('0x1f'),_0x409c93+'-'+_0x23e800+'/'+_0x262838)[_0xfb71('0x1a')](_0x63d9ad);}return null;};}function patchUpdates(_0x26975d){return function(_0x27e7e6){try{jsonpatch[_0xfb71('0x20')](_0x27e7e6,_0x26975d,!![]);}catch(_0x31d11c){return BPromise[_0xfb71('0x21')](_0x31d11c);}return _0x27e7e6[_0xfb71('0x22')]();};}function saveUpdates(_0x2117d2,_0x4ed88f){return function(_0x4cb4b1){if(_0x4cb4b1){return _0x4cb4b1['update'](_0x2117d2)[_0xfb71('0x23')](function(_0xa578d3){return _0xa578d3;});}return null;};}function removeEntity(_0x3269c1,_0x5eb589){return function(_0x2e80f4){if(_0x2e80f4){return _0x2e80f4['destroy']()[_0xfb71('0x23')](function(){_0x3269c1[_0xfb71('0x18')](0xcc)[_0xfb71('0x19')]();});}};}function handleEntityNotFound(_0x47263a,_0x43d2fc){return function(_0x457b7b){if(!_0x457b7b){_0x47263a[_0xfb71('0x17')](0x194);}return _0x457b7b;};}function handleError(_0x144115,_0x86a27a){_0x86a27a=_0x86a27a||0x1f4;return function(_0x21c333){logger[_0xfb71('0x24')](_0x21c333['stack']);if(_0x21c333['name']){delete _0x21c333[_0xfb71('0x25')];}_0x144115[_0xfb71('0x18')](_0x86a27a)[_0xfb71('0x26')](_0x21c333);};}exports[_0xfb71('0x27')]=function(_0x2e3203,_0x1201fb){var _0x3eb93b={},_0x5ce073={},_0x4098d8={'count':0x0,'rows':[]};var _0x10093c=_[_0xfb71('0x28')](db['SmsQueueReport'][_0xfb71('0x29')],function(_0x598666){return{'name':_0x598666[_0xfb71('0x2a')],'type':_0x598666['type'][_0xfb71('0x2b')]};});_0x5ce073['model']=_['map'](_0x10093c,'name');_0x5ce073[_0xfb71('0x2c')]=_[_0xfb71('0x2d')](_0x2e3203['query']);_0x5ce073[_0xfb71('0x2e')]=_[_0xfb71('0x2f')](_0x5ce073['model'],_0x5ce073['query']);_0x3eb93b['attributes']=_[_0xfb71('0x2f')](_0x5ce073[_0xfb71('0x30')],qs[_0xfb71('0x31')](_0x2e3203[_0xfb71('0x2c')][_0xfb71('0x31')]));_0x3eb93b['attributes']=_0x3eb93b['attributes'][_0xfb71('0x32')]?_0x3eb93b[_0xfb71('0x33')]:_0x5ce073['model'];if(!_0x2e3203[_0xfb71('0x2c')][_0xfb71('0x34')]('nolimit')){_0x3eb93b[_0xfb71('0x1c')]=qs[_0xfb71('0x1c')](_0x2e3203[_0xfb71('0x2c')][_0xfb71('0x1c')]);_0x3eb93b['offset']=qs[_0xfb71('0x1b')](_0x2e3203['query']['offset']);}_0x3eb93b['order']=qs[_0xfb71('0x35')](_0x2e3203[_0xfb71('0x2c')][_0xfb71('0x35')]);_0x3eb93b['where']=qs[_0xfb71('0x2e')](_[_0xfb71('0x36')](_0x2e3203[_0xfb71('0x2c')],_0x5ce073[_0xfb71('0x2e')]),_0x10093c);if(_0x2e3203[_0xfb71('0x2c')][_0xfb71('0x37')]){_0x3eb93b[_0xfb71('0x38')]=_[_0xfb71('0x39')](_0x3eb93b[_0xfb71('0x38')],{'$or':_[_0xfb71('0x28')](_0x10093c,function(_0x4bacee){if(_0x4bacee[_0xfb71('0x3a')]!==_0xfb71('0x3b')){var _0x3f119d={};_0x3f119d[_0x4bacee['name']]={'$like':'%'+_0x2e3203[_0xfb71('0x2c')]['filter']+'%'};return _0x3f119d;}})});}_0x3eb93b=_[_0xfb71('0x39')]({},_0x3eb93b,_0x2e3203['options']);var _0x3895fb={'where':_0x3eb93b['where']};return db[_0xfb71('0x3c')]['count'](_0x3895fb)[_0xfb71('0x23')](function(_0x4de35b){_0x4098d8[_0xfb71('0x1e')]=_0x4de35b;if(_0x2e3203[_0xfb71('0x2c')][_0xfb71('0x3d')]){_0x3eb93b['include']=[{'all':!![]}];}return db[_0xfb71('0x3c')]['findAll'](_0x3eb93b);})[_0xfb71('0x23')](function(_0x393620){_0x4098d8[_0xfb71('0x3e')]=_0x393620;return _0x4098d8;})[_0xfb71('0x23')](respondWithFilteredResult(_0x1201fb,_0x3eb93b))[_0xfb71('0x3f')](handleError(_0x1201fb,null));};exports['show']=function(_0x2487bb,_0x4ec3ef){var _0x66e2ab={'raw':!![],'where':{'id':_0x2487bb[_0xfb71('0x40')]['id']}},_0x265a79={};_0x265a79[_0xfb71('0x30')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x265a79[_0xfb71('0x2c')]=_[_0xfb71('0x2d')](_0x2487bb['query']);_0x265a79[_0xfb71('0x2e')]=_[_0xfb71('0x2f')](_0x265a79['model'],_0x265a79['query']);_0x66e2ab[_0xfb71('0x33')]=_['intersection'](_0x265a79[_0xfb71('0x30')],qs[_0xfb71('0x31')](_0x2487bb[_0xfb71('0x2c')][_0xfb71('0x31')]));_0x66e2ab[_0xfb71('0x33')]=_0x66e2ab[_0xfb71('0x33')][_0xfb71('0x32')]?_0x66e2ab[_0xfb71('0x33')]:_0x265a79[_0xfb71('0x30')];if(_0x2487bb[_0xfb71('0x2c')][_0xfb71('0x3d')]){_0x66e2ab[_0xfb71('0x41')]=[{'all':!![]}];}_0x66e2ab=_[_0xfb71('0x39')]({},_0x66e2ab,_0x2487bb[_0xfb71('0x42')]);return db[_0xfb71('0x3c')][_0xfb71('0x43')](_0x66e2ab)[_0xfb71('0x23')](handleEntityNotFound(_0x4ec3ef,null))['then'](respondWithResult(_0x4ec3ef,null))[_0xfb71('0x3f')](handleError(_0x4ec3ef,null));};exports[_0xfb71('0x44')]=function(_0x2362ba,_0x242525){return db[_0xfb71('0x3c')]['create'](_0x2362ba['body'],{})[_0xfb71('0x23')](respondWithResult(_0x242525,0xc9))['catch'](handleError(_0x242525,null));};exports[_0xfb71('0x45')]=function(_0xbd1226,_0x1fff7d){if(_0xbd1226[_0xfb71('0x46')]['id']){delete _0xbd1226[_0xfb71('0x46')]['id'];}return db[_0xfb71('0x3c')][_0xfb71('0x43')]({'where':{'id':_0xbd1226[_0xfb71('0x40')]['id']}})[_0xfb71('0x23')](handleEntityNotFound(_0x1fff7d,null))[_0xfb71('0x23')](saveUpdates(_0xbd1226[_0xfb71('0x46')],null))[_0xfb71('0x23')](respondWithResult(_0x1fff7d,null))[_0xfb71('0x3f')](handleError(_0x1fff7d,null));};exports[_0xfb71('0x47')]=function(_0x35270a,_0x100834){return db[_0xfb71('0x3c')][_0xfb71('0x43')]({'where':{'id':_0x35270a[_0xfb71('0x40')]['id']}})[_0xfb71('0x23')](handleEntityNotFound(_0x100834,null))['then'](removeEntity(_0x100834,null))['catch'](handleError(_0x100834,null));};exports[_0xfb71('0x48')]=function(_0x4d421d,_0x373eda){return db[_0xfb71('0x3c')]['describe']()[_0xfb71('0x23')](respondWithResult(_0x373eda,null))['catch'](handleError(_0x373eda,null));}; \ No newline at end of file +var _0xe756=['stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','find','create','update','body','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error'];(function(_0x4c99ee,_0x2d8768){var _0x24bc5f=function(_0x9b00c1){while(--_0x9b00c1){_0x4c99ee['push'](_0x4c99ee['shift']());}};_0x24bc5f(++_0x2d8768);}(_0xe756,0x13e));var _0x6e75=function(_0x24d032,_0xb53d6b){_0x24d032=_0x24d032-0x0;var _0x2bd0da=_0xe756[_0x24d032];return _0x2bd0da;};'use strict';var emlformat=require(_0x6e75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e75('0x1'));var jsonpatch=require(_0x6e75('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6e75('0x3'));var Mustache=require(_0x6e75('0x4'));var util=require(_0x6e75('0x5'));var path=require('path');var sox=require(_0x6e75('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e75('0x7'));var _=require(_0x6e75('0x8'));var squel=require(_0x6e75('0x9'));var crypto=require(_0x6e75('0xa'));var jsforce=require(_0x6e75('0xb'));var deskjs=require(_0x6e75('0xc'));var toCsv=require(_0x6e75('0xd'));var querystring=require(_0x6e75('0xe'));var Papa=require(_0x6e75('0xf'));var Redis=require(_0x6e75('0x10'));var authService=require(_0x6e75('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6e75('0x12'));var hardwareService=require(_0x6e75('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6e75('0x14'));var licenseUtil=require(_0x6e75('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x211aca,_0x96fa5d){_0x96fa5d=_0x96fa5d||0xcc;return function(_0x10c073){if(_0x10c073){return _0x211aca[_0x6e75('0x16')](_0x96fa5d);}return _0x211aca[_0x6e75('0x17')](_0x96fa5d)[_0x6e75('0x18')]();};}function respondWithResult(_0x42d017,_0x4b1400){_0x4b1400=_0x4b1400||0xc8;return function(_0x52b01c){if(_0x52b01c){return _0x42d017[_0x6e75('0x17')](_0x4b1400)[_0x6e75('0x19')](_0x52b01c);}};}function respondWithFilteredResult(_0x316473,_0x48d20){return function(_0x48c4af){if(_0x48c4af){var _0x16d808=typeof _0x48d20[_0x6e75('0x1a')]===_0x6e75('0x1b')&&typeof _0x48d20[_0x6e75('0x1c')]===_0x6e75('0x1b');var _0x29bebb=_0x48c4af[_0x6e75('0x1d')];var _0x544949=_0x16d808?0x0:_0x48d20[_0x6e75('0x1a')];var _0x2a142e=_0x16d808?_0x48c4af['count']:_0x48d20[_0x6e75('0x1a')]+_0x48d20[_0x6e75('0x1c')];var _0x14ca21;if(_0x2a142e>=_0x29bebb){_0x2a142e=_0x29bebb;_0x14ca21=0xc8;}else{_0x14ca21=0xce;}_0x316473[_0x6e75('0x17')](_0x14ca21);return _0x316473[_0x6e75('0x1e')](_0x6e75('0x1f'),_0x544949+'-'+_0x2a142e+'/'+_0x29bebb)[_0x6e75('0x19')](_0x48c4af);}return null;};}function patchUpdates(_0x45f166){return function(_0x1c7037){try{jsonpatch[_0x6e75('0x20')](_0x1c7037,_0x45f166,!![]);}catch(_0x2fd20e){return BPromise[_0x6e75('0x21')](_0x2fd20e);}return _0x1c7037[_0x6e75('0x22')]();};}function saveUpdates(_0x28b36e,_0x3782c4){return function(_0x5c5f37){if(_0x5c5f37){return _0x5c5f37['update'](_0x28b36e)[_0x6e75('0x23')](function(_0x1d4850){return _0x1d4850;});}return null;};}function removeEntity(_0x144469,_0x257734){return function(_0x5abfe4){if(_0x5abfe4){return _0x5abfe4['destroy']()[_0x6e75('0x23')](function(){_0x144469[_0x6e75('0x17')](0xcc)[_0x6e75('0x18')]();});}};}function handleEntityNotFound(_0x2f5955,_0x2d5450){return function(_0x55b667){if(!_0x55b667){_0x2f5955['sendStatus'](0x194);}return _0x55b667;};}function handleError(_0x555a44,_0x53ba48){_0x53ba48=_0x53ba48||0x1f4;return function(_0x2d2d48){logger[_0x6e75('0x24')](_0x2d2d48[_0x6e75('0x25')]);if(_0x2d2d48[_0x6e75('0x26')]){delete _0x2d2d48['name'];}_0x555a44[_0x6e75('0x17')](_0x53ba48)[_0x6e75('0x27')](_0x2d2d48);};}exports[_0x6e75('0x28')]=function(_0x27115d,_0x18492f){var _0x188c63={},_0x398210={},_0x5bb8d0={'count':0x0,'rows':[]};var _0x13d652=_[_0x6e75('0x29')](db[_0x6e75('0x2a')]['rawAttributes'],function(_0x4336d7){return{'name':_0x4336d7[_0x6e75('0x2b')],'type':_0x4336d7[_0x6e75('0x2c')][_0x6e75('0x2d')]};});_0x398210[_0x6e75('0x2e')]=_['map'](_0x13d652,_0x6e75('0x26'));_0x398210[_0x6e75('0x2f')]=_['keys'](_0x27115d['query']);_0x398210[_0x6e75('0x30')]=_[_0x6e75('0x31')](_0x398210[_0x6e75('0x2e')],_0x398210[_0x6e75('0x2f')]);_0x188c63[_0x6e75('0x32')]=_['intersection'](_0x398210[_0x6e75('0x2e')],qs['fields'](_0x27115d[_0x6e75('0x2f')][_0x6e75('0x33')]));_0x188c63[_0x6e75('0x32')]=_0x188c63['attributes']['length']?_0x188c63[_0x6e75('0x32')]:_0x398210[_0x6e75('0x2e')];if(!_0x27115d[_0x6e75('0x2f')][_0x6e75('0x34')]('nolimit')){_0x188c63[_0x6e75('0x1c')]=qs[_0x6e75('0x1c')](_0x27115d[_0x6e75('0x2f')]['limit']);_0x188c63['offset']=qs[_0x6e75('0x1a')](_0x27115d[_0x6e75('0x2f')][_0x6e75('0x1a')]);}_0x188c63['order']=qs[_0x6e75('0x35')](_0x27115d[_0x6e75('0x2f')][_0x6e75('0x35')]);_0x188c63[_0x6e75('0x36')]=qs[_0x6e75('0x30')](_[_0x6e75('0x37')](_0x27115d[_0x6e75('0x2f')],_0x398210[_0x6e75('0x30')]),_0x13d652);if(_0x27115d[_0x6e75('0x2f')]['filter']){_0x188c63['where']=_[_0x6e75('0x38')](_0x188c63[_0x6e75('0x36')],{'$or':_['map'](_0x13d652,function(_0x4cc736){if(_0x4cc736['type']!==_0x6e75('0x39')){var _0x2ab4f8={};_0x2ab4f8[_0x4cc736[_0x6e75('0x26')]]={'$like':'%'+_0x27115d['query']['filter']+'%'};return _0x2ab4f8;}})});}_0x188c63=_[_0x6e75('0x38')]({},_0x188c63,_0x27115d[_0x6e75('0x3a')]);var _0x367abb={'where':_0x188c63[_0x6e75('0x36')]};return db[_0x6e75('0x2a')]['count'](_0x367abb)[_0x6e75('0x23')](function(_0x399b7a){_0x5bb8d0['count']=_0x399b7a;if(_0x27115d[_0x6e75('0x2f')][_0x6e75('0x3b')]){_0x188c63['include']=[{'all':!![]}];}return db[_0x6e75('0x2a')][_0x6e75('0x3c')](_0x188c63);})[_0x6e75('0x23')](function(_0x33666b){_0x5bb8d0['rows']=_0x33666b;return _0x5bb8d0;})[_0x6e75('0x23')](respondWithFilteredResult(_0x18492f,_0x188c63))[_0x6e75('0x3d')](handleError(_0x18492f,null));};exports[_0x6e75('0x3e')]=function(_0xff6ba0,_0x590fc1){var _0x2e508e={'raw':!![],'where':{'id':_0xff6ba0[_0x6e75('0x3f')]['id']}},_0x125547={};_0x125547[_0x6e75('0x2e')]=_[_0x6e75('0x40')](db[_0x6e75('0x2a')]['rawAttributes']);_0x125547['query']=_[_0x6e75('0x40')](_0xff6ba0[_0x6e75('0x2f')]);_0x125547[_0x6e75('0x30')]=_['intersection'](_0x125547[_0x6e75('0x2e')],_0x125547[_0x6e75('0x2f')]);_0x2e508e[_0x6e75('0x32')]=_[_0x6e75('0x31')](_0x125547['model'],qs['fields'](_0xff6ba0[_0x6e75('0x2f')][_0x6e75('0x33')]));_0x2e508e['attributes']=_0x2e508e['attributes']['length']?_0x2e508e['attributes']:_0x125547['model'];if(_0xff6ba0[_0x6e75('0x2f')]['includeAll']){_0x2e508e['include']=[{'all':!![]}];}_0x2e508e=_['merge']({},_0x2e508e,_0xff6ba0[_0x6e75('0x3a')]);return db['SmsQueueReport'][_0x6e75('0x41')](_0x2e508e)['then'](handleEntityNotFound(_0x590fc1,null))[_0x6e75('0x23')](respondWithResult(_0x590fc1,null))[_0x6e75('0x3d')](handleError(_0x590fc1,null));};exports['create']=function(_0x93e96a,_0x41a1ab){return db['SmsQueueReport'][_0x6e75('0x42')](_0x93e96a['body'],{})[_0x6e75('0x23')](respondWithResult(_0x41a1ab,0xc9))[_0x6e75('0x3d')](handleError(_0x41a1ab,null));};exports[_0x6e75('0x43')]=function(_0x487eb7,_0x51ea9a){if(_0x487eb7[_0x6e75('0x44')]['id']){delete _0x487eb7[_0x6e75('0x44')]['id'];}return db[_0x6e75('0x2a')]['find']({'where':{'id':_0x487eb7[_0x6e75('0x3f')]['id']}})[_0x6e75('0x23')](handleEntityNotFound(_0x51ea9a,null))[_0x6e75('0x23')](saveUpdates(_0x487eb7[_0x6e75('0x44')],null))['then'](respondWithResult(_0x51ea9a,null))[_0x6e75('0x3d')](handleError(_0x51ea9a,null));};exports[_0x6e75('0x45')]=function(_0x3205f4,_0x313955){return db[_0x6e75('0x2a')]['find']({'where':{'id':_0x3205f4[_0x6e75('0x3f')]['id']}})[_0x6e75('0x23')](handleEntityNotFound(_0x313955,null))[_0x6e75('0x23')](removeEntity(_0x313955,null))[_0x6e75('0x3d')](handleError(_0x313955,null));};exports[_0x6e75('0x46')]=function(_0x3392ae,_0x134c74){return db['SmsQueueReport'][_0x6e75('0x46')]()[_0x6e75('0x23')](respondWithResult(_0x134c74,null))[_0x6e75('0x3d')](handleError(_0x134c74,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 7520bae..f8cd9b9 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x3e9402,_0x130b9e){var _0x1f5996=function(_0x5ad15c){while(--_0x5ad15c){_0x3e9402['push'](_0x3e9402['shift']());}};_0x1f5996(++_0x130b9e);}(_0xe706,0xa3));var _0x6e70=function(_0x4cbdb7,_0x1b82f6){_0x4cbdb7=_0x4cbdb7-0x0;var _0x4ecb18=_0xe706[_0x4cbdb7];return _0x4ecb18;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x28713b,_0x4ed965){var _0x39b010=function(_0x4286f5){while(--_0x4286f5){_0x28713b['push'](_0x28713b['shift']());}};_0x39b010(++_0x4ed965);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xcb91[_0x47e93d];return _0xe86c46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3b38bb3..15e1f95 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 _0x11b5=['message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','catch','update','where','attributes','limit','UpdateSmsQueueReport','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x11b5,0x72));var _0x511b=function(_0x50e90d,_0x4547e3){_0x50e90d=_0x50e90d-0x0;var _0x49a360=_0x11b5[_0x50e90d];return _0x49a360;};'use strict';var _=require(_0x511b('0x0'));var util=require('util');var moment=require(_0x511b('0x1'));var BPromise=require('bluebird');var rs=require(_0x511b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x511b('0x3'))['db'];var utils=require(_0x511b('0x4'));var logger=require(_0x511b('0x5'))(_0x511b('0x6'));var config=require(_0x511b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x511b('0x8')][_0x511b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7078ae,_0x6eb711,_0x59daaa){return new BPromise(function(_0x21310f,_0x398f04){return client[_0x511b('0xa')](_0x7078ae,_0x59daaa)[_0x511b('0xb')](function(_0x5e8a7e){logger[_0x511b('0xc')](_0x511b('0xd'),_0x6eb711,_0x511b('0xe'));logger['debug'](_0x511b('0xf'),_0x6eb711,_0x511b('0xe'),JSON['stringify'](_0x5e8a7e));if(_0x5e8a7e[_0x511b('0x10')]){if(_0x5e8a7e[_0x511b('0x10')][_0x511b('0x11')]===0x1f4){logger[_0x511b('0x10')](_0x511b('0xd'),_0x6eb711,_0x5e8a7e[_0x511b('0x10')][_0x511b('0x12')]);return _0x398f04(_0x5e8a7e[_0x511b('0x10')]['message']);}logger['error'](_0x511b('0xd'),_0x6eb711,_0x5e8a7e[_0x511b('0x10')][_0x511b('0x12')]);return _0x21310f(_0x5e8a7e[_0x511b('0x10')][_0x511b('0x12')]);}else{logger[_0x511b('0xc')](_0x511b('0xd'),_0x6eb711,'request\x20sent');_0x21310f(_0x5e8a7e[_0x511b('0x13')][_0x511b('0x12')]);}})['catch'](function(_0x472a84){logger[_0x511b('0x10')](_0x511b('0xd'),_0x6eb711,_0x472a84);_0x398f04(_0x472a84);});});}exports[_0x511b('0x14')]=function(_0x3a97a0){var _0x3914b9=this;return new Promise(function(_0x372169,_0x317767){return db[_0x511b('0x15')][_0x511b('0x16')](_0x3a97a0[_0x511b('0x17')],{'raw':_0x3a97a0[_0x511b('0x18')]?_0x3a97a0[_0x511b('0x18')][_0x511b('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5b573a){logger[_0x511b('0xc')](_0x511b('0x14'),_0x3a97a0);logger[_0x511b('0x1a')]('CreateSmsQueueReport',_0x3a97a0,JSON['stringify'](_0x5b573a));_0x372169(_0x5b573a);})[_0x511b('0x1b')](function(_0x189289){logger[_0x511b('0x10')](_0x511b('0x14'),_0x189289[_0x511b('0x12')],_0x3a97a0);_0x317767(_0x3914b9['error'](0x1f4,_0x189289['message']));});});};exports['UpdateSmsQueueReport']=function(_0x1b87a7){var _0x250719=this;return new Promise(function(_0x3541f3,_0x52f821){return db['SmsQueueReport'][_0x511b('0x1c')](_0x1b87a7[_0x511b('0x17')],{'raw':_0x1b87a7[_0x511b('0x18')]?_0x1b87a7[_0x511b('0x18')][_0x511b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b87a7[_0x511b('0x18')]?_0x1b87a7['options'][_0x511b('0x1d')]||null:null,'attributes':_0x1b87a7[_0x511b('0x18')]?_0x1b87a7[_0x511b('0x18')][_0x511b('0x1e')]||null:null,'limit':_0x1b87a7[_0x511b('0x18')]?_0x1b87a7['options'][_0x511b('0x1f')]||null:null})[_0x511b('0xb')](function(_0x51c997){logger[_0x511b('0xc')](_0x511b('0x20'),_0x1b87a7);logger[_0x511b('0x1a')](_0x511b('0x20'),_0x1b87a7,JSON['stringify'](_0x51c997));_0x3541f3(_0x51c997);})[_0x511b('0x1b')](function(_0x1b76cb){logger[_0x511b('0x10')](_0x511b('0x20'),_0x1b76cb[_0x511b('0x12')],_0x1b87a7);_0x52f821(_0x250719[_0x511b('0x10')](0x1f4,_0x1b76cb['message']));});});}; \ No newline at end of file +var _0xe5aa=['result','catch','CreateSmsQueueReport','create','options','stringify','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x3ee935,_0x293a98){var _0x586db7=function(_0x18db5c){while(--_0x18db5c){_0x3ee935['push'](_0x3ee935['shift']());}};_0x586db7(++_0x293a98);}(_0xe5aa,0x119));var _0xae5a=function(_0x53d268,_0x56846c){_0x53d268=_0x53d268-0x0;var _0x4f39f2=_0xe5aa[_0x53d268];return _0x4f39f2;};'use strict';var _=require('lodash');var util=require(_0xae5a('0x0'));var moment=require(_0xae5a('0x1'));var BPromise=require(_0xae5a('0x2'));var rs=require(_0xae5a('0x3'));var fs=require('fs');var Redis=require(_0xae5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae5a('0x5'));var config=require('../../config/environment');var jayson=require(_0xae5a('0x6'));var client=jayson[_0xae5a('0x7')][_0xae5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f0440,_0x48ec8d,_0x5124e1){return new BPromise(function(_0x29eeb3,_0x4822b8){return client[_0xae5a('0x9')](_0x1f0440,_0x5124e1)[_0xae5a('0xa')](function(_0x56c9ae){logger['info'](_0xae5a('0xb'),_0x48ec8d,_0xae5a('0xc'));logger[_0xae5a('0xd')](_0xae5a('0xe'),_0x48ec8d,'request\x20sent',JSON['stringify'](_0x56c9ae));if(_0x56c9ae[_0xae5a('0xf')]){if(_0x56c9ae[_0xae5a('0xf')][_0xae5a('0x10')]===0x1f4){logger[_0xae5a('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x48ec8d,_0x56c9ae['error'][_0xae5a('0x11')]);return _0x4822b8(_0x56c9ae[_0xae5a('0xf')][_0xae5a('0x11')]);}logger[_0xae5a('0xf')](_0xae5a('0xb'),_0x48ec8d,_0x56c9ae[_0xae5a('0xf')][_0xae5a('0x11')]);return _0x29eeb3(_0x56c9ae[_0xae5a('0xf')][_0xae5a('0x11')]);}else{logger[_0xae5a('0x12')](_0xae5a('0xb'),_0x48ec8d,_0xae5a('0xc'));_0x29eeb3(_0x56c9ae[_0xae5a('0x13')][_0xae5a('0x11')]);}})[_0xae5a('0x14')](function(_0x13a1de){logger[_0xae5a('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x48ec8d,_0x13a1de);_0x4822b8(_0x13a1de);});});}exports[_0xae5a('0x15')]=function(_0xa9c6ca){var _0x2dad52=this;return new Promise(function(_0x2115f7,_0x4fc7f1){return db['SmsQueueReport'][_0xae5a('0x16')](_0xa9c6ca['body'],{'raw':_0xa9c6ca[_0xae5a('0x17')]?_0xa9c6ca[_0xae5a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xae5a('0xa')](function(_0x430ca3){logger[_0xae5a('0x12')](_0xae5a('0x15'),_0xa9c6ca);logger[_0xae5a('0xd')](_0xae5a('0x15'),_0xa9c6ca,JSON[_0xae5a('0x18')](_0x430ca3));_0x2115f7(_0x430ca3);})[_0xae5a('0x14')](function(_0x58405a){logger['error'](_0xae5a('0x15'),_0x58405a[_0xae5a('0x11')],_0xa9c6ca);_0x4fc7f1(_0x2dad52[_0xae5a('0xf')](0x1f4,_0x58405a['message']));});});};exports[_0xae5a('0x19')]=function(_0x228bb8){var _0x46a843=this;return new Promise(function(_0x5403f8,_0x2637fa){return db[_0xae5a('0x1a')][_0xae5a('0x1b')](_0x228bb8['body'],{'raw':_0x228bb8['options']?_0x228bb8[_0xae5a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x228bb8[_0xae5a('0x17')]?_0x228bb8[_0xae5a('0x17')][_0xae5a('0x1c')]||null:null,'attributes':_0x228bb8[_0xae5a('0x17')]?_0x228bb8[_0xae5a('0x17')][_0xae5a('0x1d')]||null:null,'limit':_0x228bb8['options']?_0x228bb8[_0xae5a('0x17')]['limit']||null:null})[_0xae5a('0xa')](function(_0x13766d){logger[_0xae5a('0x12')](_0xae5a('0x19'),_0x228bb8);logger['debug'](_0xae5a('0x19'),_0x228bb8,JSON[_0xae5a('0x18')](_0x13766d));_0x5403f8(_0x13766d);})[_0xae5a('0x14')](function(_0x567ae7){logger[_0xae5a('0xf')]('UpdateSmsQueueReport',_0x567ae7[_0xae5a('0x11')],_0x228bb8);_0x2637fa(_0x46a843[_0xae5a('0xf')](0x1f4,_0x567ae7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7015268..49ed530 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 _0x61a5=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x61a5,0xf0));var _0x561a=function(_0x9db5d3,_0x4eea5e){_0x9db5d3=_0x9db5d3-0x0;var _0x477a81=_0x61a5[_0x9db5d3];return _0x477a81;};'use strict';var multer=require(_0x561a('0x0'));var util=require('util');var path=require(_0x561a('0x1'));var timeout=require(_0x561a('0x2'));var express=require(_0x561a('0x3'));var router=express[_0x561a('0x4')]();var fs_extra=require(_0x561a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var controller=require('./smsTransferReport.controller');router[_0x561a('0x8')]('/',auth[_0x561a('0x9')](),controller[_0x561a('0xa')]);router[_0x561a('0x8')](_0x561a('0xb'),auth[_0x561a('0x9')](),controller[_0x561a('0xc')]);router['get'](_0x561a('0xd'),auth['isAuthenticated'](),controller[_0x561a('0xe')]);router[_0x561a('0xf')]('/',auth['isAuthenticated'](),controller[_0x561a('0x10')]);router[_0x561a('0x11')]('/:id',auth[_0x561a('0x9')](),controller['update']);router[_0x561a('0x12')](_0x561a('0xd'),auth[_0x561a('0x9')](),controller[_0x561a('0x13')]);module[_0x561a('0x14')]=router; \ No newline at end of file +var _0x2b83=['/describe','describe','/:id','put','update','util','path','express','Router','fs-extra','../../config/environment','./smsTransferReport.controller','isAuthenticated','get'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x2b83,0x1d3));var _0x32b8=function(_0x37dd92,_0x415ab9){_0x37dd92=_0x37dd92-0x0;var _0x3c2719=_0x2b83[_0x37dd92];return _0x3c2719;};'use strict';var multer=require('multer');var util=require(_0x32b8('0x0'));var path=require(_0x32b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x32b8('0x2'));var router=express[_0x32b8('0x3')]();var fs_extra=require(_0x32b8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32b8('0x5'));var controller=require(_0x32b8('0x6'));router['get']('/',auth[_0x32b8('0x7')](),controller['index']);router[_0x32b8('0x8')](_0x32b8('0x9'),auth[_0x32b8('0x7')](),controller[_0x32b8('0xa')]);router['get'](_0x32b8('0xb'),auth[_0x32b8('0x7')](),controller['show']);router['post']('/',auth[_0x32b8('0x7')](),controller['create']);router[_0x32b8('0xc')](_0x32b8('0xb'),auth[_0x32b8('0x7')](),controller[_0x32b8('0xd')]);router['delete'](_0x32b8('0xb'),auth[_0x32b8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 4ca23d1..c0a4f15 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2d3e83,_0x138da8){var _0x52bc96=function(_0x124bf8){while(--_0x124bf8){_0x2d3e83['push'](_0x2d3e83['shift']());}};_0x52bc96(++_0x138da8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xcb91[_0xf55e73];return _0x116b99;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1ba576,_0x397070){var _0x48b26c=function(_0x13799c){while(--_0x13799c){_0x1ba576['push'](_0x1ba576['shift']());}};_0x48b26c(++_0x397070);}(_0xaa88,0x137));var _0x8aa8=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0xaa88[_0x203d64];return _0x462ab3;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f4efb59..80d393e 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 _0xa2d1=['rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','show','options','catch','create','body','update','find','params','describe','eml-format'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa2d1,0xda));var _0x1a2d=function(_0x2b63a0,_0x14fc48){_0x2b63a0=_0x2b63a0-0x0;var _0x4f0434=_0xa2d1[_0x2b63a0];return _0x4f0434;};'use strict';var emlformat=require(_0x1a2d('0x0'));var rimraf=require(_0x1a2d('0x1'));var zipdir=require(_0x1a2d('0x2'));var jsonpatch=require(_0x1a2d('0x3'));var rp=require(_0x1a2d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1a2d('0x5'));var sox=require(_0x1a2d('0x6'));var csv=require(_0x1a2d('0x7'));var ejs=require(_0x1a2d('0x8'));var fs=require('fs');var fs_extra=require(_0x1a2d('0x9'));var _=require(_0x1a2d('0xa'));var squel=require(_0x1a2d('0xb'));var crypto=require('crypto');var jsforce=require(_0x1a2d('0xc'));var deskjs=require(_0x1a2d('0xd'));var toCsv=require(_0x1a2d('0x7'));var querystring=require(_0x1a2d('0xe'));var Papa=require(_0x1a2d('0xf'));var Redis=require('ioredis');var authService=require(_0x1a2d('0x10'));var qs=require(_0x1a2d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1a2d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a2d('0x13'));var db=require(_0x1a2d('0x14'))['db'];function respondWithStatusCode(_0x32e557,_0x3d2a19){_0x3d2a19=_0x3d2a19||0xcc;return function(_0x52f4c2){if(_0x52f4c2){return _0x32e557['sendStatus'](_0x3d2a19);}return _0x32e557[_0x1a2d('0x15')](_0x3d2a19)[_0x1a2d('0x16')]();};}function respondWithResult(_0x32fb9c,_0x484be5){_0x484be5=_0x484be5||0xc8;return function(_0x1c7502){if(_0x1c7502){return _0x32fb9c[_0x1a2d('0x15')](_0x484be5)[_0x1a2d('0x17')](_0x1c7502);}};}function respondWithFilteredResult(_0x52f7bf,_0x288ec5){return function(_0x24b4c5){if(_0x24b4c5){var _0x3f42d8=typeof _0x288ec5[_0x1a2d('0x18')]===_0x1a2d('0x19')&&typeof _0x288ec5[_0x1a2d('0x1a')]==='undefined';var _0xabb9e0=_0x24b4c5[_0x1a2d('0x1b')];var _0x42c7c6=_0x3f42d8?0x0:_0x288ec5[_0x1a2d('0x18')];var _0x3ca831=_0x3f42d8?_0x24b4c5[_0x1a2d('0x1b')]:_0x288ec5['offset']+_0x288ec5['limit'];var _0x3b8d0b;if(_0x3ca831>=_0xabb9e0){_0x3ca831=_0xabb9e0;_0x3b8d0b=0xc8;}else{_0x3b8d0b=0xce;}_0x52f7bf[_0x1a2d('0x15')](_0x3b8d0b);return _0x52f7bf[_0x1a2d('0x1c')](_0x1a2d('0x1d'),_0x42c7c6+'-'+_0x3ca831+'/'+_0xabb9e0)[_0x1a2d('0x17')](_0x24b4c5);}return null;};}function patchUpdates(_0x305957){return function(_0x435d54){try{jsonpatch[_0x1a2d('0x1e')](_0x435d54,_0x305957,!![]);}catch(_0x43b2e8){return BPromise[_0x1a2d('0x1f')](_0x43b2e8);}return _0x435d54[_0x1a2d('0x20')]();};}function saveUpdates(_0xa6c9d2,_0x3aa01a){return function(_0x2548e3){if(_0x2548e3){return _0x2548e3['update'](_0xa6c9d2)[_0x1a2d('0x21')](function(_0x33d13e){return _0x33d13e;});}return null;};}function removeEntity(_0x214a1e,_0x27226a){return function(_0x174c51){if(_0x174c51){return _0x174c51[_0x1a2d('0x22')]()['then'](function(){_0x214a1e[_0x1a2d('0x15')](0xcc)[_0x1a2d('0x16')]();});}};}function handleEntityNotFound(_0x48f16d,_0x1c1b09){return function(_0x25b659){if(!_0x25b659){_0x48f16d[_0x1a2d('0x23')](0x194);}return _0x25b659;};}function handleError(_0x1586f4,_0x620617){_0x620617=_0x620617||0x1f4;return function(_0x304463){logger[_0x1a2d('0x24')](_0x304463[_0x1a2d('0x25')]);if(_0x304463[_0x1a2d('0x26')]){delete _0x304463[_0x1a2d('0x26')];}_0x1586f4[_0x1a2d('0x15')](_0x620617)[_0x1a2d('0x27')](_0x304463);};}exports['index']=function(_0x17ef17,_0x396a7c){var _0x1d927c={},_0x264406={},_0x13fdf3={'count':0x0,'rows':[]};var _0x4c49e4=_[_0x1a2d('0x28')](db[_0x1a2d('0x29')][_0x1a2d('0x2a')],function(_0x779e42){return{'name':_0x779e42[_0x1a2d('0x2b')],'type':_0x779e42[_0x1a2d('0x2c')][_0x1a2d('0x2d')]};});_0x264406[_0x1a2d('0x2e')]=_[_0x1a2d('0x28')](_0x4c49e4,_0x1a2d('0x26'));_0x264406[_0x1a2d('0x2f')]=_[_0x1a2d('0x30')](_0x17ef17['query']);_0x264406['filters']=_[_0x1a2d('0x31')](_0x264406['model'],_0x264406[_0x1a2d('0x2f')]);_0x1d927c[_0x1a2d('0x32')]=_[_0x1a2d('0x31')](_0x264406[_0x1a2d('0x2e')],qs[_0x1a2d('0x33')](_0x17ef17[_0x1a2d('0x2f')][_0x1a2d('0x33')]));_0x1d927c[_0x1a2d('0x32')]=_0x1d927c[_0x1a2d('0x32')][_0x1a2d('0x34')]?_0x1d927c[_0x1a2d('0x32')]:_0x264406['model'];if(!_0x17ef17[_0x1a2d('0x2f')]['hasOwnProperty'](_0x1a2d('0x35'))){_0x1d927c[_0x1a2d('0x1a')]=qs[_0x1a2d('0x1a')](_0x17ef17[_0x1a2d('0x2f')][_0x1a2d('0x1a')]);_0x1d927c[_0x1a2d('0x18')]=qs[_0x1a2d('0x18')](_0x17ef17['query'][_0x1a2d('0x18')]);}_0x1d927c[_0x1a2d('0x36')]=qs[_0x1a2d('0x37')](_0x17ef17[_0x1a2d('0x2f')][_0x1a2d('0x37')]);_0x1d927c[_0x1a2d('0x38')]=qs[_0x1a2d('0x39')](_['pick'](_0x17ef17[_0x1a2d('0x2f')],_0x264406[_0x1a2d('0x39')]),_0x4c49e4);if(_0x17ef17['query']['filter']){_0x1d927c[_0x1a2d('0x38')]=_[_0x1a2d('0x3a')](_0x1d927c[_0x1a2d('0x38')],{'$or':_[_0x1a2d('0x28')](_0x4c49e4,function(_0xbae590){if(_0xbae590[_0x1a2d('0x2c')]!==_0x1a2d('0x3b')){var _0x4b495d={};_0x4b495d[_0xbae590[_0x1a2d('0x26')]]={'$like':'%'+_0x17ef17[_0x1a2d('0x2f')][_0x1a2d('0x3c')]+'%'};return _0x4b495d;}})});}_0x1d927c=_[_0x1a2d('0x3a')]({},_0x1d927c,_0x17ef17['options']);var _0x910d6={'where':_0x1d927c[_0x1a2d('0x38')]};return db[_0x1a2d('0x29')][_0x1a2d('0x1b')](_0x910d6)[_0x1a2d('0x21')](function(_0x870b1c){_0x13fdf3[_0x1a2d('0x1b')]=_0x870b1c;if(_0x17ef17['query'][_0x1a2d('0x3d')]){_0x1d927c[_0x1a2d('0x3e')]=[{'all':!![]}];}return db[_0x1a2d('0x29')][_0x1a2d('0x3f')](_0x1d927c);})['then'](function(_0x3b3258){_0x13fdf3['rows']=_0x3b3258;return _0x13fdf3;})['then'](respondWithFilteredResult(_0x396a7c,_0x1d927c))['catch'](handleError(_0x396a7c,null));};exports[_0x1a2d('0x40')]=function(_0x19be32,_0x34ee86){var _0x59a122={'raw':!![],'where':{'id':_0x19be32['params']['id']}},_0x114d1a={};_0x114d1a[_0x1a2d('0x2e')]=_[_0x1a2d('0x30')](db[_0x1a2d('0x29')][_0x1a2d('0x2a')]);_0x114d1a[_0x1a2d('0x2f')]=_[_0x1a2d('0x30')](_0x19be32[_0x1a2d('0x2f')]);_0x114d1a[_0x1a2d('0x39')]=_[_0x1a2d('0x31')](_0x114d1a[_0x1a2d('0x2e')],_0x114d1a[_0x1a2d('0x2f')]);_0x59a122['attributes']=_['intersection'](_0x114d1a[_0x1a2d('0x2e')],qs[_0x1a2d('0x33')](_0x19be32[_0x1a2d('0x2f')][_0x1a2d('0x33')]));_0x59a122[_0x1a2d('0x32')]=_0x59a122[_0x1a2d('0x32')]['length']?_0x59a122[_0x1a2d('0x32')]:_0x114d1a[_0x1a2d('0x2e')];if(_0x19be32['query'][_0x1a2d('0x3d')]){_0x59a122['include']=[{'all':!![]}];}_0x59a122=_[_0x1a2d('0x3a')]({},_0x59a122,_0x19be32[_0x1a2d('0x41')]);return db['SmsTransferReport']['find'](_0x59a122)[_0x1a2d('0x21')](handleEntityNotFound(_0x34ee86,null))[_0x1a2d('0x21')](respondWithResult(_0x34ee86,null))[_0x1a2d('0x42')](handleError(_0x34ee86,null));};exports[_0x1a2d('0x43')]=function(_0x12360f,_0x5badae){return db[_0x1a2d('0x29')]['create'](_0x12360f[_0x1a2d('0x44')],{})[_0x1a2d('0x21')](respondWithResult(_0x5badae,0xc9))[_0x1a2d('0x42')](handleError(_0x5badae,null));};exports[_0x1a2d('0x45')]=function(_0x32b8c0,_0x2879c3){if(_0x32b8c0[_0x1a2d('0x44')]['id']){delete _0x32b8c0[_0x1a2d('0x44')]['id'];}return db[_0x1a2d('0x29')][_0x1a2d('0x46')]({'where':{'id':_0x32b8c0[_0x1a2d('0x47')]['id']}})[_0x1a2d('0x21')](handleEntityNotFound(_0x2879c3,null))[_0x1a2d('0x21')](saveUpdates(_0x32b8c0[_0x1a2d('0x44')],null))[_0x1a2d('0x21')](respondWithResult(_0x2879c3,null))['catch'](handleError(_0x2879c3,null));};exports[_0x1a2d('0x22')]=function(_0x4519a8,_0x232bcd){return db[_0x1a2d('0x29')][_0x1a2d('0x46')]({'where':{'id':_0x4519a8['params']['id']}})[_0x1a2d('0x21')](handleEntityNotFound(_0x232bcd,null))['then'](removeEntity(_0x232bcd,null))['catch'](handleError(_0x232bcd,null));};exports['describe']=function(_0x4fc31b,_0x2fcfac){return db['SmsTransferReport'][_0x1a2d('0x48')]()[_0x1a2d('0x21')](respondWithResult(_0x2fcfac,null))[_0x1a2d('0x42')](handleError(_0x2fcfac,null));}; \ No newline at end of file +var _0x3427=['offset','undefined','limit','count','set','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','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/license/util','../../mysqldb','status','end','json'];(function(_0x578111,_0x3bd10c){var _0x3356a0=function(_0x1dd0f1){while(--_0x1dd0f1){_0x578111['push'](_0x578111['shift']());}};_0x3356a0(++_0x3bd10c);}(_0x3427,0x1f3));var _0x7342=function(_0x1fa62f,_0x5ba625){_0x1fa62f=_0x1fa62f-0x0;var _0x269984=_0x3427[_0x1fa62f];return _0x269984;};'use strict';var emlformat=require(_0x7342('0x0'));var rimraf=require(_0x7342('0x1'));var zipdir=require(_0x7342('0x2'));var jsonpatch=require(_0x7342('0x3'));var rp=require('request-promise');var moment=require(_0x7342('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7342('0x5'));var csv=require(_0x7342('0x6'));var ejs=require(_0x7342('0x7'));var fs=require('fs');var fs_extra=require(_0x7342('0x8'));var _=require('lodash');var squel=require(_0x7342('0x9'));var crypto=require('crypto');var jsforce=require(_0x7342('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7342('0xb'));var Papa=require(_0x7342('0xc'));var Redis=require(_0x7342('0xd'));var authService=require(_0x7342('0xe'));var qs=require(_0x7342('0xf'));var as=require(_0x7342('0x10'));var hardwareService=require(_0x7342('0x11'));var logger=require(_0x7342('0x12'))(_0x7342('0x13'));var utils=require(_0x7342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7342('0x15'));var db=require(_0x7342('0x16'))['db'];function respondWithStatusCode(_0xa7f07b,_0x4fcaf7){_0x4fcaf7=_0x4fcaf7||0xcc;return function(_0x904e8d){if(_0x904e8d){return _0xa7f07b['sendStatus'](_0x4fcaf7);}return _0xa7f07b[_0x7342('0x17')](_0x4fcaf7)[_0x7342('0x18')]();};}function respondWithResult(_0x2b2f4f,_0x3b23af){_0x3b23af=_0x3b23af||0xc8;return function(_0x14db02){if(_0x14db02){return _0x2b2f4f['status'](_0x3b23af)[_0x7342('0x19')](_0x14db02);}};}function respondWithFilteredResult(_0x5657c2,_0x2f7c2d){return function(_0x825508){if(_0x825508){var _0x4d9df9=typeof _0x2f7c2d[_0x7342('0x1a')]===_0x7342('0x1b')&&typeof _0x2f7c2d[_0x7342('0x1c')]==='undefined';var _0x2bae67=_0x825508[_0x7342('0x1d')];var _0x4ba44d=_0x4d9df9?0x0:_0x2f7c2d[_0x7342('0x1a')];var _0x367837=_0x4d9df9?_0x825508[_0x7342('0x1d')]:_0x2f7c2d[_0x7342('0x1a')]+_0x2f7c2d[_0x7342('0x1c')];var _0x14754c;if(_0x367837>=_0x2bae67){_0x367837=_0x2bae67;_0x14754c=0xc8;}else{_0x14754c=0xce;}_0x5657c2[_0x7342('0x17')](_0x14754c);return _0x5657c2[_0x7342('0x1e')]('Content-Range',_0x4ba44d+'-'+_0x367837+'/'+_0x2bae67)['json'](_0x825508);}return null;};}function patchUpdates(_0x51e6e9){return function(_0x5c6de9){try{jsonpatch['apply'](_0x5c6de9,_0x51e6e9,!![]);}catch(_0x20bf46){return BPromise[_0x7342('0x1f')](_0x20bf46);}return _0x5c6de9[_0x7342('0x20')]();};}function saveUpdates(_0x2489f1,_0x399020){return function(_0x556630){if(_0x556630){return _0x556630[_0x7342('0x21')](_0x2489f1)['then'](function(_0x3a0202){return _0x3a0202;});}return null;};}function removeEntity(_0x4889e4,_0x438516){return function(_0x2ac3b1){if(_0x2ac3b1){return _0x2ac3b1[_0x7342('0x22')]()[_0x7342('0x23')](function(){_0x4889e4[_0x7342('0x17')](0xcc)[_0x7342('0x18')]();});}};}function handleEntityNotFound(_0x5bc2ee,_0x1f7ff0){return function(_0x26a25a){if(!_0x26a25a){_0x5bc2ee[_0x7342('0x24')](0x194);}return _0x26a25a;};}function handleError(_0x5ab173,_0x49f29e){_0x49f29e=_0x49f29e||0x1f4;return function(_0x1a542a){logger[_0x7342('0x25')](_0x1a542a[_0x7342('0x26')]);if(_0x1a542a[_0x7342('0x27')]){delete _0x1a542a[_0x7342('0x27')];}_0x5ab173[_0x7342('0x17')](_0x49f29e)[_0x7342('0x28')](_0x1a542a);};}exports[_0x7342('0x29')]=function(_0x136b9d,_0x135acc){var _0x747e8={},_0x4d7643={},_0x49eb50={'count':0x0,'rows':[]};var _0xf47152=_[_0x7342('0x2a')](db[_0x7342('0x2b')][_0x7342('0x2c')],function(_0x4db81b){return{'name':_0x4db81b[_0x7342('0x2d')],'type':_0x4db81b['type'][_0x7342('0x2e')]};});_0x4d7643[_0x7342('0x2f')]=_[_0x7342('0x2a')](_0xf47152,_0x7342('0x27'));_0x4d7643[_0x7342('0x30')]=_[_0x7342('0x31')](_0x136b9d[_0x7342('0x30')]);_0x4d7643['filters']=_[_0x7342('0x32')](_0x4d7643[_0x7342('0x2f')],_0x4d7643[_0x7342('0x30')]);_0x747e8[_0x7342('0x33')]=_['intersection'](_0x4d7643[_0x7342('0x2f')],qs[_0x7342('0x34')](_0x136b9d[_0x7342('0x30')]['fields']));_0x747e8[_0x7342('0x33')]=_0x747e8[_0x7342('0x33')]['length']?_0x747e8[_0x7342('0x33')]:_0x4d7643[_0x7342('0x2f')];if(!_0x136b9d[_0x7342('0x30')][_0x7342('0x35')](_0x7342('0x36'))){_0x747e8[_0x7342('0x1c')]=qs[_0x7342('0x1c')](_0x136b9d[_0x7342('0x30')][_0x7342('0x1c')]);_0x747e8['offset']=qs[_0x7342('0x1a')](_0x136b9d[_0x7342('0x30')]['offset']);}_0x747e8['order']=qs[_0x7342('0x37')](_0x136b9d[_0x7342('0x30')][_0x7342('0x37')]);_0x747e8[_0x7342('0x38')]=qs[_0x7342('0x39')](_[_0x7342('0x3a')](_0x136b9d[_0x7342('0x30')],_0x4d7643[_0x7342('0x39')]),_0xf47152);if(_0x136b9d[_0x7342('0x30')][_0x7342('0x3b')]){_0x747e8['where']=_[_0x7342('0x3c')](_0x747e8[_0x7342('0x38')],{'$or':_[_0x7342('0x2a')](_0xf47152,function(_0x3b0827){if(_0x3b0827[_0x7342('0x3d')]!=='VIRTUAL'){var _0xdf6d24={};_0xdf6d24[_0x3b0827[_0x7342('0x27')]]={'$like':'%'+_0x136b9d[_0x7342('0x30')][_0x7342('0x3b')]+'%'};return _0xdf6d24;}})});}_0x747e8=_[_0x7342('0x3c')]({},_0x747e8,_0x136b9d[_0x7342('0x3e')]);var _0x358766={'where':_0x747e8[_0x7342('0x38')]};return db[_0x7342('0x2b')][_0x7342('0x1d')](_0x358766)['then'](function(_0xe989c){_0x49eb50['count']=_0xe989c;if(_0x136b9d['query'][_0x7342('0x3f')]){_0x747e8[_0x7342('0x40')]=[{'all':!![]}];}return db[_0x7342('0x2b')][_0x7342('0x41')](_0x747e8);})[_0x7342('0x23')](function(_0x91065d){_0x49eb50[_0x7342('0x42')]=_0x91065d;return _0x49eb50;})[_0x7342('0x23')](respondWithFilteredResult(_0x135acc,_0x747e8))[_0x7342('0x43')](handleError(_0x135acc,null));};exports[_0x7342('0x44')]=function(_0x19af68,_0x226f2b){var _0x1b9ed4={'raw':!![],'where':{'id':_0x19af68[_0x7342('0x45')]['id']}},_0x2ded7c={};_0x2ded7c[_0x7342('0x2f')]=_[_0x7342('0x31')](db['SmsTransferReport']['rawAttributes']);_0x2ded7c[_0x7342('0x30')]=_[_0x7342('0x31')](_0x19af68[_0x7342('0x30')]);_0x2ded7c[_0x7342('0x39')]=_[_0x7342('0x32')](_0x2ded7c[_0x7342('0x2f')],_0x2ded7c[_0x7342('0x30')]);_0x1b9ed4[_0x7342('0x33')]=_[_0x7342('0x32')](_0x2ded7c[_0x7342('0x2f')],qs[_0x7342('0x34')](_0x19af68['query'][_0x7342('0x34')]));_0x1b9ed4[_0x7342('0x33')]=_0x1b9ed4[_0x7342('0x33')][_0x7342('0x46')]?_0x1b9ed4[_0x7342('0x33')]:_0x2ded7c[_0x7342('0x2f')];if(_0x19af68['query'][_0x7342('0x3f')]){_0x1b9ed4[_0x7342('0x40')]=[{'all':!![]}];}_0x1b9ed4=_[_0x7342('0x3c')]({},_0x1b9ed4,_0x19af68[_0x7342('0x3e')]);return db[_0x7342('0x2b')][_0x7342('0x47')](_0x1b9ed4)['then'](handleEntityNotFound(_0x226f2b,null))['then'](respondWithResult(_0x226f2b,null))[_0x7342('0x43')](handleError(_0x226f2b,null));};exports[_0x7342('0x48')]=function(_0x1db4bd,_0x57fbfd){return db[_0x7342('0x2b')][_0x7342('0x48')](_0x1db4bd[_0x7342('0x49')],{})['then'](respondWithResult(_0x57fbfd,0xc9))[_0x7342('0x43')](handleError(_0x57fbfd,null));};exports[_0x7342('0x21')]=function(_0x4eede0,_0x598e4){if(_0x4eede0[_0x7342('0x49')]['id']){delete _0x4eede0[_0x7342('0x49')]['id'];}return db[_0x7342('0x2b')][_0x7342('0x47')]({'where':{'id':_0x4eede0[_0x7342('0x45')]['id']}})['then'](handleEntityNotFound(_0x598e4,null))[_0x7342('0x23')](saveUpdates(_0x4eede0[_0x7342('0x49')],null))['then'](respondWithResult(_0x598e4,null))[_0x7342('0x43')](handleError(_0x598e4,null));};exports[_0x7342('0x22')]=function(_0x3cd2d8,_0x4748cc){return db[_0x7342('0x2b')][_0x7342('0x47')]({'where':{'id':_0x3cd2d8[_0x7342('0x45')]['id']}})[_0x7342('0x23')](handleEntityNotFound(_0x4748cc,null))[_0x7342('0x23')](removeEntity(_0x4748cc,null))[_0x7342('0x43')](handleError(_0x4748cc,null));};exports[_0x7342('0x4a')]=function(_0x4bd165,_0x54c429){return db[_0x7342('0x2b')][_0x7342('0x4a')]()[_0x7342('0x23')](respondWithResult(_0x54c429,null))['catch'](handleError(_0x54c429,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index ae769b5..54280e9 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 _0x850f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x2ed559,_0x4b1b17){var _0x3a725d=function(_0x46d858){while(--_0x46d858){_0x2ed559['push'](_0x2ed559['shift']());}};_0x3a725d(++_0x4b1b17);}(_0x850f,0xff));var _0xf850=function(_0x5f9081,_0x5b72ab){_0x5f9081=_0x5f9081-0x0;var _0x2da0fe=_0x850f[_0x5f9081];return _0x2da0fe;};'use strict';var _=require(_0xf850('0x0'));var util=require(_0xf850('0x1'));var logger=require(_0xf850('0x2'))(_0xf850('0x3'));var moment=require(_0xf850('0x4'));var BPromise=require(_0xf850('0x5'));var rp=require(_0xf850('0x6'));var fs=require('fs');var path=require(_0xf850('0x7'));var rimraf=require(_0xf850('0x8'));var config=require(_0xf850('0x9'));var attributes=require(_0xf850('0xa'));module[_0xf850('0xb')]=function(_0x45fe0b,_0x3ab465){return _0x45fe0b[_0xf850('0xc')](_0xf850('0xd'),attributes,{'tableName':_0xf850('0xe'),'paranoid':![],'indexes':[{'name':_0xf850('0xf'),'fields':[_0xf850('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef89=['path','rimraf','../../config/environment','./smsTransferReport.attributes','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x32cd2a,_0x5bf464){var _0x34d548=function(_0x5192f1){while(--_0x5192f1){_0x32cd2a['push'](_0x32cd2a['shift']());}};_0x34d548(++_0x5bf464);}(_0xef89,0xf6));var _0x9ef8=function(_0x22535f,_0x45d62b){_0x22535f=_0x22535f-0x0;var _0x14e2ef=_0xef89[_0x22535f];return _0x14e2ef;};'use strict';var _=require(_0x9ef8('0x0'));var util=require(_0x9ef8('0x1'));var logger=require(_0x9ef8('0x2'))(_0x9ef8('0x3'));var moment=require(_0x9ef8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ef8('0x5'));var fs=require('fs');var path=require(_0x9ef8('0x6'));var rimraf=require(_0x9ef8('0x7'));var config=require(_0x9ef8('0x8'));var attributes=require(_0x9ef8('0x9'));module['exports']=function(_0x1698c3,_0x5d40f7){return _0x1698c3['define']('SmsTransferReport',attributes,{'tableName':_0x9ef8('0xa'),'paranoid':![],'indexes':[{'name':_0x9ef8('0xb'),'fields':[_0x9ef8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 750d093..f4295c1 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 _0xb3ea=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5981fa,_0x427919){var _0x3e07cf=function(_0x39778f){while(--_0x39778f){_0x5981fa['push'](_0x5981fa['shift']());}};_0x3e07cf(++_0x427919);}(_0xb3ea,0x10d));var _0xab3e=function(_0x463802,_0x42e60b){_0x463802=_0x463802-0x0;var _0x1e005f=_0xb3ea[_0x463802];return _0x1e005f;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var moment=require(_0xab3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xab3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab3e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab3e('0x5'))(_0xab3e('0x6'));var config=require(_0xab3e('0x7'));var jayson=require(_0xab3e('0x8'));var client=jayson[_0xab3e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c0a3f,_0x4fecb7,_0x1026e7){return new BPromise(function(_0x6b6e2,_0x51482b){return client[_0xab3e('0xa')](_0x3c0a3f,_0x1026e7)[_0xab3e('0xb')](function(_0x5d8bab){logger[_0xab3e('0xc')](_0xab3e('0xd'),_0x4fecb7,'request\x20sent');logger['debug'](_0xab3e('0xe'),_0x4fecb7,_0xab3e('0xf'),JSON[_0xab3e('0x10')](_0x5d8bab));if(_0x5d8bab[_0xab3e('0x11')]){if(_0x5d8bab[_0xab3e('0x11')][_0xab3e('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4fecb7,_0x5d8bab['error'][_0xab3e('0x13')]);return _0x51482b(_0x5d8bab[_0xab3e('0x11')][_0xab3e('0x13')]);}logger[_0xab3e('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x4fecb7,_0x5d8bab[_0xab3e('0x11')]['message']);return _0x6b6e2(_0x5d8bab['error'][_0xab3e('0x13')]);}else{logger[_0xab3e('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4fecb7,_0xab3e('0xf'));_0x6b6e2(_0x5d8bab[_0xab3e('0x14')]['message']);}})[_0xab3e('0x15')](function(_0x516b1d){logger[_0xab3e('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x4fecb7,_0x516b1d);_0x51482b(_0x516b1d);});});} \ No newline at end of file +var _0xa990=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xa990,0xc9));var _0x0a99=function(_0x43b1ff,_0xf30023){_0x43b1ff=_0x43b1ff-0x0;var _0x347a49=_0xa990[_0x43b1ff];return _0x347a49;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var moment=require(_0x0a99('0x2'));var BPromise=require(_0x0a99('0x3'));var rs=require(_0x0a99('0x4'));var fs=require('fs');var Redis=require(_0x0a99('0x5'));var db=require(_0x0a99('0x6'))['db'];var utils=require(_0x0a99('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a99('0x8'));var jayson=require(_0x0a99('0x9'));var client=jayson[_0x0a99('0xa')][_0x0a99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b195,_0x398d95,_0xc6001b){return new BPromise(function(_0x599c7,_0x3cf0ef){return client[_0x0a99('0xc')](_0x45b195,_0xc6001b)[_0x0a99('0xd')](function(_0x56810b){logger[_0x0a99('0xe')](_0x0a99('0xf'),_0x398d95,'request\x20sent');logger['debug'](_0x0a99('0x10'),_0x398d95,_0x0a99('0x11'),JSON[_0x0a99('0x12')](_0x56810b));if(_0x56810b[_0x0a99('0x13')]){if(_0x56810b[_0x0a99('0x13')]['code']===0x1f4){logger[_0x0a99('0x13')](_0x0a99('0xf'),_0x398d95,_0x56810b['error'][_0x0a99('0x14')]);return _0x3cf0ef(_0x56810b[_0x0a99('0x13')][_0x0a99('0x14')]);}logger[_0x0a99('0x13')](_0x0a99('0xf'),_0x398d95,_0x56810b[_0x0a99('0x13')][_0x0a99('0x14')]);return _0x599c7(_0x56810b[_0x0a99('0x13')]['message']);}else{logger['info'](_0x0a99('0xf'),_0x398d95,_0x0a99('0x11'));_0x599c7(_0x56810b[_0x0a99('0x15')]['message']);}})[_0x0a99('0x16')](function(_0x5c91f9){logger['error'](_0x0a99('0xf'),_0x398d95,_0x5c91f9);_0x3cf0ef(_0x5c91f9);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 50620f5..3522e4f 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 _0x308f=['delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','now','extname','single','create','put','update'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x308f,0x7a));var _0xf308=function(_0x48ce3f,_0x325c60){_0x48ce3f=_0x48ce3f-0x0;var _0x2e877d=_0x308f[_0x48ce3f];return _0x2e877d;};'use strict';var multer=require(_0xf308('0x0'));var util=require('util');var path=require(_0xf308('0x1'));var timeout=require(_0xf308('0x2'));var express=require('express');var router=express[_0xf308('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf308('0x4'));var interaction=require(_0xf308('0x5'));var config=require(_0xf308('0x6'));var controller=require(_0xf308('0x7'));router[_0xf308('0x8')]('/',auth[_0xf308('0x9')](),controller[_0xf308('0xa')]);router[_0xf308('0x8')](_0xf308('0xb'),auth[_0xf308('0x9')](),controller[_0xf308('0xc')]);router[_0xf308('0x8')](_0xf308('0xd'),auth[_0xf308('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xf308('0xe')]({'destination':function(_0x320f38,_0x4d653a,_0x1ae707){_0x1ae707(null,path[_0xf308('0xf')](config[_0xf308('0x10')],_0xf308('0x11')));},'filename':function(_0x2d4fad,_0x58edc7,_0x1ed608){_0x58edc7[_0xf308('0x12')]=_0x58edc7['originalname'][_0xf308('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ed608(null,util[_0xf308('0x14')](_0xf308('0x15'),path['basename'](_0x58edc7[_0xf308('0x12')],path['extname'](_0x58edc7[_0xf308('0x12')])),Date[_0xf308('0x16')](),path[_0xf308('0x17')](_0x58edc7[_0xf308('0x12')])));}})});router['post']('/',upload[_0xf308('0x18')]('file'),controller[_0xf308('0x19')]);router[_0xf308('0x1a')](_0xf308('0xb'),auth[_0xf308('0x9')](),controller[_0xf308('0x1b')]);router[_0xf308('0x1c')](_0xf308('0xb'),auth[_0xf308('0x9')](),controller[_0xf308('0x1c')]);module[_0xf308('0x1d')]=router; \ No newline at end of file +var _0xdfc1=['express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','/:id','update','delete','exports','multer','connect-timeout'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xdfc1,0xde));var _0x1dfc=function(_0x23c31a,_0xdc4107){_0x23c31a=_0x23c31a-0x0;var _0x4d5585=_0xdfc1[_0x23c31a];return _0x4d5585;};'use strict';var multer=require(_0x1dfc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1dfc('0x1'));var express=require(_0x1dfc('0x2'));var router=express[_0x1dfc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1dfc('0x4'));var interaction=require(_0x1dfc('0x5'));var config=require('../../config/environment');var controller=require(_0x1dfc('0x6'));router[_0x1dfc('0x7')]('/',auth[_0x1dfc('0x8')](),controller[_0x1dfc('0x9')]);router[_0x1dfc('0x7')]('/:id',auth[_0x1dfc('0x8')](),controller['show']);router['get']('/:id/download',auth[_0x1dfc('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x1dfc('0xa')]({'destination':function(_0x59804b,_0xf8ecb,_0x43c844){_0x43c844(null,path['join'](config['root'],_0x1dfc('0xb')));},'filename':function(_0x31457a,_0x53b2b6,_0xd76bbf){_0x53b2b6[_0x1dfc('0xc')]=_0x53b2b6[_0x1dfc('0xc')][_0x1dfc('0xd')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd76bbf(null,util[_0x1dfc('0xe')](_0x1dfc('0xf'),path[_0x1dfc('0x10')](_0x53b2b6[_0x1dfc('0xc')],path[_0x1dfc('0x11')](_0x53b2b6[_0x1dfc('0xc')])),Date[_0x1dfc('0x12')](),path['extname'](_0x53b2b6[_0x1dfc('0xc')])));}})});router[_0x1dfc('0x13')]('/',upload[_0x1dfc('0x14')](_0x1dfc('0x15')),controller[_0x1dfc('0x16')]);router[_0x1dfc('0x17')](_0x1dfc('0x18'),auth[_0x1dfc('0x8')](),controller[_0x1dfc('0x19')]);router[_0x1dfc('0x1a')](_0x1dfc('0x18'),auth[_0x1dfc('0x8')](),controller['delete']);module[_0x1dfc('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index d76179e..3d26e61 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 _0xf234=['INTEGER','FLOAT','sequelize','exports','STRING','name','BIGINT'];(function(_0x275f4e,_0x437b49){var _0x1f1db0=function(_0x4e4e81){while(--_0x4e4e81){_0x275f4e['push'](_0x275f4e['shift']());}};_0x1f1db0(++_0x437b49);}(_0xf234,0x128));var _0x4f23=function(_0x39686f,_0x1af601){_0x39686f=_0x39686f-0x0;var _0x4fbf3a=_0xf234[_0x39686f];return _0x4fbf3a;};'use strict';var Sequelize=require(_0x4f23('0x0'));module[_0x4f23('0x1')]={'name':{'type':Sequelize[_0x4f23('0x2')],'unique':_0x4f23('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x4f23('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x4f23('0x2')]},'original_format':{'type':Sequelize[_0x4f23('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x4f23('0x4')]},'original_channelCount':{'type':Sequelize[_0x4f23('0x5')]},'original_bitRate':{'type':Sequelize[_0x4f23('0x4')]},'original_sampleRate':{'type':Sequelize[_0x4f23('0x5')]},'converted_format':{'type':Sequelize[_0x4f23('0x2')]},'converted_duration':{'type':Sequelize[_0x4f23('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x4f23('0x4')]},'converted_channelCount':{'type':Sequelize[_0x4f23('0x5')]},'converted_bitRate':{'type':Sequelize[_0x4f23('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x4f23('0x5')]}}; \ No newline at end of file +var _0x03c0=['STRING','BIGINT','INTEGER','FLOAT','sequelize','name'];(function(_0x17eafb,_0x3b4894){var _0x32bad7=function(_0x3ff06d){while(--_0x3ff06d){_0x17eafb['push'](_0x17eafb['shift']());}};_0x32bad7(++_0x3b4894);}(_0x03c0,0xee));var _0x003c=function(_0x3e61d4,_0x224d2d){_0x3e61d4=_0x3e61d4-0x0;var _0x40bd4e=_0x03c0[_0x3e61d4];return _0x40bd4e;};'use strict';var Sequelize=require(_0x003c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x003c('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x003c('0x2')]},'display_name':{'type':Sequelize[_0x003c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x003c('0x2')]},'original_format':{'type':Sequelize[_0x003c('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x003c('0x3')]},'original_channelCount':{'type':Sequelize[_0x003c('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x003c('0x4')]},'converted_format':{'type':Sequelize[_0x003c('0x2')]},'converted_duration':{'type':Sequelize[_0x003c('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x003c('0x3')]},'converted_channelCount':{'type':Sequelize[_0x003c('0x4')]},'converted_bitRate':{'type':Sequelize[_0x003c('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x003c('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index eeaa152..e9cfee6 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 _0x5b42=['error','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','include','findAll','rows','catch','show','fields','includeAll','find','download','params','save_name','join','Sequelize','ValidationError','Sound\x20not\x20found','root','server/files/sounds/converted','format','%s.%s','converted_format','create','file','originalname','filename','extname','substring','server/files/sounds/original','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','sampleRate','dest','converted_channelCount','channelCount','converted_bitRate','bitRate','converted_sampleRate','0777','role','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','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','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource'];(function(_0x325fcd,_0x5f3f53){var _0x283377=function(_0x576071){while(--_0x576071){_0x325fcd['push'](_0x325fcd['shift']());}};_0x283377(++_0x5f3f53);}(_0x5b42,0x1c7));var _0x25b4=function(_0xa200b1,_0x2618b8){_0xa200b1=_0xa200b1-0x0;var _0x98c8cb=_0x5b42[_0xa200b1];return _0x98c8cb;};'use strict';var emlformat=require(_0x25b4('0x0'));var rimraf=require(_0x25b4('0x1'));var zipdir=require(_0x25b4('0x2'));var jsonpatch=require(_0x25b4('0x3'));var rp=require(_0x25b4('0x4'));var moment=require('moment');var BPromise=require(_0x25b4('0x5'));var Mustache=require(_0x25b4('0x6'));var util=require(_0x25b4('0x7'));var path=require('path');var sox=require(_0x25b4('0x8'));var csv=require(_0x25b4('0x9'));var ejs=require(_0x25b4('0xa'));var fs=require('fs');var fs_extra=require(_0x25b4('0xb'));var _=require(_0x25b4('0xc'));var squel=require(_0x25b4('0xd'));var crypto=require(_0x25b4('0xe'));var jsforce=require(_0x25b4('0xf'));var deskjs=require(_0x25b4('0x10'));var toCsv=require(_0x25b4('0x9'));var querystring=require(_0x25b4('0x11'));var Papa=require(_0x25b4('0x12'));var Redis=require('ioredis');var authService=require(_0x25b4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x25b4('0x14'));var hardwareService=require(_0x25b4('0x15'));var logger=require('../../config/logger')(_0x25b4('0x16'));var utils=require(_0x25b4('0x17'));var config=require(_0x25b4('0x18'));var licenseUtil=require(_0x25b4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27eb3b,_0x1cf435){_0x1cf435=_0x1cf435||0xcc;return function(_0x4154d6){if(_0x4154d6){return _0x27eb3b[_0x25b4('0x1a')](_0x1cf435);}return _0x27eb3b['status'](_0x1cf435)[_0x25b4('0x1b')]();};}function respondWithResult(_0x2a2f1e,_0x6a234f){_0x6a234f=_0x6a234f||0xc8;return function(_0x240274){if(_0x240274){return _0x2a2f1e[_0x25b4('0x1c')](_0x6a234f)[_0x25b4('0x1d')](_0x240274);}};}function respondWithFilteredResult(_0x5726dd,_0x581e1f){return function(_0x5d03e2){if(_0x5d03e2){var _0x4b8c8c=typeof _0x581e1f[_0x25b4('0x1e')]===_0x25b4('0x1f')&&typeof _0x581e1f[_0x25b4('0x20')]===_0x25b4('0x1f');var _0xba43c9=_0x5d03e2[_0x25b4('0x21')];var _0x464f12=_0x4b8c8c?0x0:_0x581e1f[_0x25b4('0x1e')];var _0x49c2af=_0x4b8c8c?_0x5d03e2[_0x25b4('0x21')]:_0x581e1f['offset']+_0x581e1f[_0x25b4('0x20')];var _0x33de14;if(_0x49c2af>=_0xba43c9){_0x49c2af=_0xba43c9;_0x33de14=0xc8;}else{_0x33de14=0xce;}_0x5726dd['status'](_0x33de14);return _0x5726dd[_0x25b4('0x22')](_0x25b4('0x23'),_0x464f12+'-'+_0x49c2af+'/'+_0xba43c9)['json'](_0x5d03e2);}return null;};}function patchUpdates(_0x2e23f){return function(_0x3beab9){try{jsonpatch[_0x25b4('0x24')](_0x3beab9,_0x2e23f,!![]);}catch(_0x593191){return BPromise[_0x25b4('0x25')](_0x593191);}return _0x3beab9[_0x25b4('0x26')]();};}function saveUpdates(_0x40fd6a,_0x393ec7){return function(_0x2fa860){if(_0x2fa860){return _0x2fa860[_0x25b4('0x27')](_0x40fd6a)[_0x25b4('0x28')](function(_0x4874ef){return _0x4874ef;});}return null;};}function removeEntity(_0x449bdd,_0x34cc60){return function(_0x253d45){if(_0x253d45){return _0x253d45[_0x25b4('0x29')]()[_0x25b4('0x28')](function(){var _0x4d0fa3=_0x253d45[_0x25b4('0x2a')]({'plain':!![]});var _0x3d953b=_0x25b4('0x2b');return db[_0x25b4('0x2c')]['destroy']({'where':{'type':_0x3d953b,'resourceId':_0x4d0fa3['id']}})['then'](function(){return _0x253d45;});})['then'](function(){_0x449bdd[_0x25b4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39c768,_0x224317){return function(_0x2944b3){if(!_0x2944b3){_0x39c768[_0x25b4('0x1a')](0x194);}return _0x2944b3;};}function handleError(_0x183cc3,_0x59b3f4){_0x59b3f4=_0x59b3f4||0x1f4;return function(_0x39a7da){logger[_0x25b4('0x2d')](_0x39a7da['stack']);if(_0x39a7da[_0x25b4('0x2e')]){delete _0x39a7da[_0x25b4('0x2e')];}_0x183cc3['status'](_0x59b3f4)[_0x25b4('0x2f')](_0x39a7da);};}exports[_0x25b4('0x30')]=function(_0x2be8d1,_0x2147fd){var _0x7e3b8d={},_0x27ebd0={},_0x4ed17d={'count':0x0,'rows':[]};var _0x30c331=_[_0x25b4('0x31')](db[_0x25b4('0x32')][_0x25b4('0x33')],function(_0x3d4fe7){return{'name':_0x3d4fe7[_0x25b4('0x34')],'type':_0x3d4fe7['type'][_0x25b4('0x35')]};});_0x27ebd0[_0x25b4('0x36')]=_['map'](_0x30c331,_0x25b4('0x2e'));_0x27ebd0[_0x25b4('0x37')]=_[_0x25b4('0x38')](_0x2be8d1[_0x25b4('0x37')]);_0x27ebd0['filters']=_[_0x25b4('0x39')](_0x27ebd0['model'],_0x27ebd0[_0x25b4('0x37')]);_0x7e3b8d['attributes']=_['intersection'](_0x27ebd0['model'],qs['fields'](_0x2be8d1[_0x25b4('0x37')]['fields']));_0x7e3b8d['attributes']=_0x7e3b8d[_0x25b4('0x3a')][_0x25b4('0x3b')]?_0x7e3b8d[_0x25b4('0x3a')]:_0x27ebd0['model'];if(!_0x2be8d1[_0x25b4('0x37')][_0x25b4('0x3c')](_0x25b4('0x3d'))){_0x7e3b8d[_0x25b4('0x20')]=qs[_0x25b4('0x20')](_0x2be8d1['query'][_0x25b4('0x20')]);_0x7e3b8d[_0x25b4('0x1e')]=qs['offset'](_0x2be8d1[_0x25b4('0x37')][_0x25b4('0x1e')]);}_0x7e3b8d[_0x25b4('0x3e')]=qs[_0x25b4('0x3f')](_0x2be8d1[_0x25b4('0x37')]['sort']);_0x7e3b8d['where']=qs[_0x25b4('0x40')](_[_0x25b4('0x41')](_0x2be8d1[_0x25b4('0x37')],_0x27ebd0[_0x25b4('0x40')]),_0x30c331);if(_0x2be8d1[_0x25b4('0x37')][_0x25b4('0x42')]){_0x7e3b8d['where']=_[_0x25b4('0x43')](_0x7e3b8d[_0x25b4('0x44')],{'$or':_[_0x25b4('0x31')](_0x30c331,function(_0x44b5f0){if(_0x44b5f0['type']!=='VIRTUAL'){var _0xfa253={};_0xfa253[_0x44b5f0[_0x25b4('0x2e')]]={'$like':'%'+_0x2be8d1[_0x25b4('0x37')][_0x25b4('0x42')]+'%'};return _0xfa253;}})});}_0x7e3b8d=_[_0x25b4('0x43')]({},_0x7e3b8d,_0x2be8d1['options']);var _0x181f3c={'where':_0x7e3b8d[_0x25b4('0x44')]};return db[_0x25b4('0x32')]['count'](_0x181f3c)[_0x25b4('0x28')](function(_0x35c0d0){_0x4ed17d['count']=_0x35c0d0;if(_0x2be8d1[_0x25b4('0x37')]['includeAll']){_0x7e3b8d[_0x25b4('0x45')]=[{'all':!![]}];}return db[_0x25b4('0x32')][_0x25b4('0x46')](_0x7e3b8d);})[_0x25b4('0x28')](function(_0x1407b1){_0x4ed17d[_0x25b4('0x47')]=_0x1407b1;return _0x4ed17d;})['then'](respondWithFilteredResult(_0x2147fd,_0x7e3b8d))[_0x25b4('0x48')](handleError(_0x2147fd,null));};exports[_0x25b4('0x49')]=function(_0x37f6a8,_0x5bac8c){var _0x4df496={'raw':!![],'where':{'id':_0x37f6a8['params']['id']}},_0x5e0366={};_0x5e0366['model']=_['keys'](db[_0x25b4('0x32')]['rawAttributes']);_0x5e0366[_0x25b4('0x37')]=_[_0x25b4('0x38')](_0x37f6a8[_0x25b4('0x37')]);_0x5e0366[_0x25b4('0x40')]=_[_0x25b4('0x39')](_0x5e0366['model'],_0x5e0366['query']);_0x4df496[_0x25b4('0x3a')]=_['intersection'](_0x5e0366['model'],qs[_0x25b4('0x4a')](_0x37f6a8[_0x25b4('0x37')][_0x25b4('0x4a')]));_0x4df496[_0x25b4('0x3a')]=_0x4df496[_0x25b4('0x3a')][_0x25b4('0x3b')]?_0x4df496[_0x25b4('0x3a')]:_0x5e0366[_0x25b4('0x36')];if(_0x37f6a8['query'][_0x25b4('0x4b')]){_0x4df496['include']=[{'all':!![]}];}_0x4df496=_[_0x25b4('0x43')]({},_0x4df496,_0x37f6a8['options']);return db[_0x25b4('0x32')][_0x25b4('0x4c')](_0x4df496)[_0x25b4('0x28')](handleEntityNotFound(_0x5bac8c,null))[_0x25b4('0x28')](respondWithResult(_0x5bac8c,null))[_0x25b4('0x48')](handleError(_0x5bac8c,null));};exports[_0x25b4('0x4d')]=function(_0x39aedd,_0x402d25,_0x341c14){return db[_0x25b4('0x32')][_0x25b4('0x4c')]({'where':{'id':_0x39aedd[_0x25b4('0x4e')]['id']},'attributes':['name',_0x25b4('0x4f'),'converted_format'],'raw':!![]})[_0x25b4('0x28')](handleEntityNotFound(_0x402d25,null))[_0x25b4('0x28')](function(_0x1e6077){if(_0x1e6077){if(!fs['existsSync'](path[_0x25b4('0x50')](config['root'],'server/files/sounds/converted',_0x1e6077[_0x25b4('0x4f')]+'.'+_0x1e6077['converted_format']))){throw new db[(_0x25b4('0x51'))][(_0x25b4('0x52'))](_0x25b4('0x53'));}return _0x402d25[_0x25b4('0x4d')](path[_0x25b4('0x50')](config[_0x25b4('0x54')],_0x25b4('0x55'),util[_0x25b4('0x56')](_0x25b4('0x57'),_0x1e6077[_0x25b4('0x4f')],_0x1e6077[_0x25b4('0x58')])),util[_0x25b4('0x56')]('%s.%s',_0x1e6077[_0x25b4('0x2e')],_0x1e6077[_0x25b4('0x58')]));}return null;})[_0x25b4('0x48')](handleError(_0x402d25,null));};exports[_0x25b4('0x59')]=function(_0x2690a3,_0x502020,_0x51ad3e){var _0x279aab={'name':path['basename'](_0x2690a3[_0x25b4('0x5a')][_0x25b4('0x5b')],path['extname'](_0x2690a3[_0x25b4('0x5a')][_0x25b4('0x5b')])),'save_name':path['basename'](_0x2690a3[_0x25b4('0x5a')][_0x25b4('0x5c')],path[_0x25b4('0x5d')](_0x2690a3[_0x25b4('0x5a')][_0x25b4('0x5c')])),'original_format':path[_0x25b4('0x5d')](_0x2690a3['file'][_0x25b4('0x5b')])[_0x25b4('0x5e')](0x1),'converted_format':'wav'};var _0x4e0e31=path[_0x25b4('0x50')](config['root'],_0x25b4('0x5f'),_0x2690a3[_0x25b4('0x5a')][_0x25b4('0x5c')]);var _0x1ef6b3=path[_0x25b4('0x50')](config[_0x25b4('0x54')],_0x25b4('0x55'),util[_0x25b4('0x56')]('%s.%s',path[_0x25b4('0x60')](_0x2690a3[_0x25b4('0x5a')][_0x25b4('0x5c')],path[_0x25b4('0x5d')](_0x2690a3[_0x25b4('0x5a')][_0x25b4('0x5c')])),_0x279aab[_0x25b4('0x58')]));logger[_0x25b4('0x61')](_0x25b4('0x62'),_0x4e0e31);logger[_0x25b4('0x61')](_0x25b4('0x63'),_0x1ef6b3);try{fs[_0x25b4('0x64')](_0x4e0e31,parseInt('0777',0x8));var _0x2f2574=sox[_0x25b4('0x65')](_0x4e0e31,_0x1ef6b3,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2f2574['on'](_0x25b4('0x2d'),function(_0x47be13){fs[_0x25b4('0x66')](_0x4e0e31);_0x502020[_0x25b4('0x1c')](0x1f4)[_0x25b4('0x2f')](_0x47be13);});_0x2f2574['on'](_0x25b4('0x67'),function(_0x27d463){_0x279aab['original_duration']=isNaN(_0x27d463[_0x25b4('0x68')])?null:_0x27d463[_0x25b4('0x68')]*0x3e8;_0x279aab[_0x25b4('0x69')]=isNaN(_0x27d463['sampleCount'])?null:_0x27d463[_0x25b4('0x6a')];_0x279aab[_0x25b4('0x6b')]=isNaN(_0x27d463['channelCount'])?null:_0x27d463['channelCount'];_0x279aab[_0x25b4('0x6c')]=isNaN(_0x27d463['bitRate'])?null:_0x27d463['bitRate'];_0x279aab['original_sampleRate']=isNaN(_0x27d463[_0x25b4('0x6d')])?null:_0x27d463[_0x25b4('0x6d')];});_0x2f2574['on'](_0x25b4('0x6e'),function(_0x364a33){_0x279aab['converted_duration']=isNaN(_0x364a33[_0x25b4('0x68')])?null:_0x364a33[_0x25b4('0x68')]*0x3e8;_0x279aab['converted_sampleCount']=isNaN(_0x364a33[_0x25b4('0x6a')])?null:_0x364a33['sampleCount'];_0x279aab[_0x25b4('0x6f')]=isNaN(_0x364a33[_0x25b4('0x70')])?null:_0x364a33[_0x25b4('0x70')];_0x279aab[_0x25b4('0x71')]=isNaN(_0x364a33['bitRate'])?null:_0x364a33[_0x25b4('0x72')];_0x279aab[_0x25b4('0x73')]=isNaN(_0x364a33[_0x25b4('0x6d')])?null:_0x364a33[_0x25b4('0x6d')];});_0x2f2574['on'](_0x25b4('0x1b'),function(){fs[_0x25b4('0x64')](_0x1ef6b3,parseInt(_0x25b4('0x74'),0x8));return db['Sound'][_0x25b4('0x59')](_0x279aab)[_0x25b4('0x28')](function(_0x2b460c){var _0x5acd71={'role':_0x2690a3['body'][_0x25b4('0x75')],'userProfileId':_0x2690a3[_0x25b4('0x76')]['userProfileId']};if(!_0x5acd71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5acd71[_0x25b4('0x75')]===_0x25b4('0x77')){var _0x1e5697=_0x2b460c[_0x25b4('0x2a')]({'plain':!![]});return db[_0x25b4('0x78')][_0x25b4('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x5acd71['userProfileId']},'raw':!![]})[_0x25b4('0x28')](function(_0x260568){if(_0x260568&&_0x260568[_0x25b4('0x79')]===0x0){return db[_0x25b4('0x2c')][_0x25b4('0x59')]({'name':_0x1e5697[_0x25b4('0x2e')],'resourceId':_0x1e5697['id'],'type':_0x260568[_0x25b4('0x2e')],'sectionId':_0x260568['id']},{})[_0x25b4('0x28')](function(){return _0x2b460c;});}else{return _0x2b460c;}})[_0x25b4('0x48')](function(_0x4f72d0){logger[_0x25b4('0x2d')](_0x25b4('0x7a'),_0x4f72d0);throw _0x4f72d0;});}return _0x2b460c;})['then'](respondWithResult(_0x502020,null))[_0x25b4('0x48')](handleError(_0x502020,null));});_0x2f2574[_0x25b4('0x7b')]();}catch(_0x14fd2b){_0x502020['status'](0x1f4)['send'](_0x14fd2b);}};exports['update']=function(_0x26e18a,_0x3d43bc,_0x32a7d6){return db[_0x25b4('0x32')][_0x25b4('0x4c')]({'where':{'id':_0x26e18a[_0x25b4('0x4e')]['id']}})[_0x25b4('0x28')](handleEntityNotFound(_0x3d43bc,null))[_0x25b4('0x28')](saveUpdates(_[_0x25b4('0x41')](_0x26e18a['body'],[_0x25b4('0x2e'),_0x25b4('0x7c')]),null))['then'](respondWithResult(_0x3d43bc,null))['catch'](handleError(_0x3d43bc,null));};exports['delete']=function(_0x3f0cba,_0x3837e4,_0x5f7c9c){return db[_0x25b4('0x32')][_0x25b4('0x4c')]({'where':{'id':_0x3f0cba[_0x25b4('0x4e')]['id']}})[_0x25b4('0x28')](function(_0x456019){if(_0x456019){return _0x456019[_0x25b4('0x29')]();}})['then'](function(_0x5f039d){var _0x9bc3b4=path[_0x25b4('0x50')](config[_0x25b4('0x54')],_0x25b4('0x5f'),util[_0x25b4('0x56')](_0x25b4('0x57'),_0x5f039d['save_name'],_0x5f039d['original_format']));var _0x5d251a=path[_0x25b4('0x50')](config[_0x25b4('0x54')],_0x25b4('0x55'),util[_0x25b4('0x56')](_0x25b4('0x57'),_0x5f039d[_0x25b4('0x4f')],_0x5f039d[_0x25b4('0x58')]));fs[_0x25b4('0x66')](_0x9bc3b4);fs[_0x25b4('0x66')](_0x5d251a);return _0x5f039d;})[_0x25b4('0x28')](function(_0xa356c8){if(_0xa356c8){return _0x3837e4['status'](0xcc)[_0x25b4('0x1b')]();}})['then'](handleEntityNotFound(_0x3837e4,null))['catch'](handleError(_0x3837e4,null));}; \ No newline at end of file +var _0x3b4a=['basename','file','filename','wav','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','error','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','Sounds','stack','name','send','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','Sound','includeAll','include','findAll','rows','catch','show','length','find','download','params','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','root','format','%s.%s','create','originalname','extname'];(function(_0x1ecec5,_0x33173b){var _0x1bc0a4=function(_0x2d9435){while(--_0x2d9435){_0x1ecec5['push'](_0x1ecec5['shift']());}};_0x1bc0a4(++_0x33173b);}(_0x3b4a,0x11c));var _0xa3b4=function(_0x54c2d8,_0x6f1180){_0x54c2d8=_0x54c2d8-0x0;var _0x321a6a=_0x3b4a[_0x54c2d8];return _0x321a6a;};'use strict';var emlformat=require(_0xa3b4('0x0'));var rimraf=require(_0xa3b4('0x1'));var zipdir=require(_0xa3b4('0x2'));var jsonpatch=require(_0xa3b4('0x3'));var rp=require(_0xa3b4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa3b4('0x5'));var util=require(_0xa3b4('0x6'));var path=require(_0xa3b4('0x7'));var sox=require('sox');var csv=require(_0xa3b4('0x8'));var ejs=require(_0xa3b4('0x9'));var fs=require('fs');var fs_extra=require(_0xa3b4('0xa'));var _=require(_0xa3b4('0xb'));var squel=require(_0xa3b4('0xc'));var crypto=require(_0xa3b4('0xd'));var jsforce=require(_0xa3b4('0xe'));var deskjs=require(_0xa3b4('0xf'));var toCsv=require(_0xa3b4('0x8'));var querystring=require('querystring');var Papa=require(_0xa3b4('0x10'));var Redis=require(_0xa3b4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa3b4('0x12'));var as=require(_0xa3b4('0x13'));var hardwareService=require(_0xa3b4('0x14'));var logger=require(_0xa3b4('0x15'))(_0xa3b4('0x16'));var utils=require(_0xa3b4('0x17'));var config=require(_0xa3b4('0x18'));var licenseUtil=require(_0xa3b4('0x19'));var db=require(_0xa3b4('0x1a'))['db'];function respondWithStatusCode(_0x2cf10a,_0x15ec05){_0x15ec05=_0x15ec05||0xcc;return function(_0x460d34){if(_0x460d34){return _0x2cf10a[_0xa3b4('0x1b')](_0x15ec05);}return _0x2cf10a['status'](_0x15ec05)[_0xa3b4('0x1c')]();};}function respondWithResult(_0x1af386,_0x5b2e57){_0x5b2e57=_0x5b2e57||0xc8;return function(_0x45d156){if(_0x45d156){return _0x1af386[_0xa3b4('0x1d')](_0x5b2e57)[_0xa3b4('0x1e')](_0x45d156);}};}function respondWithFilteredResult(_0x272714,_0x1f79ee){return function(_0x5b0c53){if(_0x5b0c53){var _0x2333d6=typeof _0x1f79ee[_0xa3b4('0x1f')]===_0xa3b4('0x20')&&typeof _0x1f79ee[_0xa3b4('0x21')]===_0xa3b4('0x20');var _0x5e6c9d=_0x5b0c53[_0xa3b4('0x22')];var _0x390975=_0x2333d6?0x0:_0x1f79ee[_0xa3b4('0x1f')];var _0x3de60a=_0x2333d6?_0x5b0c53[_0xa3b4('0x22')]:_0x1f79ee[_0xa3b4('0x1f')]+_0x1f79ee[_0xa3b4('0x21')];var _0x5207ea;if(_0x3de60a>=_0x5e6c9d){_0x3de60a=_0x5e6c9d;_0x5207ea=0xc8;}else{_0x5207ea=0xce;}_0x272714[_0xa3b4('0x1d')](_0x5207ea);return _0x272714[_0xa3b4('0x23')](_0xa3b4('0x24'),_0x390975+'-'+_0x3de60a+'/'+_0x5e6c9d)['json'](_0x5b0c53);}return null;};}function patchUpdates(_0x199164){return function(_0x337b20){try{jsonpatch['apply'](_0x337b20,_0x199164,!![]);}catch(_0x9eeb7f){return BPromise[_0xa3b4('0x25')](_0x9eeb7f);}return _0x337b20[_0xa3b4('0x26')]();};}function saveUpdates(_0x4947ba,_0x424181){return function(_0x3db279){if(_0x3db279){return _0x3db279['update'](_0x4947ba)['then'](function(_0x50065a){return _0x50065a;});}return null;};}function removeEntity(_0x2f146f,_0x4d5179){return function(_0x16c05a){if(_0x16c05a){return _0x16c05a[_0xa3b4('0x27')]()[_0xa3b4('0x28')](function(){var _0x133645=_0x16c05a['get']({'plain':!![]});var _0x1e51b2=_0xa3b4('0x29');return db['UserProfileResource'][_0xa3b4('0x27')]({'where':{'type':_0x1e51b2,'resourceId':_0x133645['id']}})[_0xa3b4('0x28')](function(){return _0x16c05a;});})[_0xa3b4('0x28')](function(){_0x2f146f[_0xa3b4('0x1d')](0xcc)[_0xa3b4('0x1c')]();});}};}function handleEntityNotFound(_0x29b9c6,_0x3fdd2d){return function(_0x23101d){if(!_0x23101d){_0x29b9c6[_0xa3b4('0x1b')](0x194);}return _0x23101d;};}function handleError(_0x15963a,_0x4f6f67){_0x4f6f67=_0x4f6f67||0x1f4;return function(_0x4be2e0){logger['error'](_0x4be2e0[_0xa3b4('0x2a')]);if(_0x4be2e0[_0xa3b4('0x2b')]){delete _0x4be2e0[_0xa3b4('0x2b')];}_0x15963a[_0xa3b4('0x1d')](_0x4f6f67)[_0xa3b4('0x2c')](_0x4be2e0);};}exports['index']=function(_0x51fd19,_0x833325){var _0x5633aa={},_0x2059c7={},_0x142190={'count':0x0,'rows':[]};var _0x51e021=_[_0xa3b4('0x2d')](db['Sound'][_0xa3b4('0x2e')],function(_0x1e6578){return{'name':_0x1e6578['fieldName'],'type':_0x1e6578[_0xa3b4('0x2f')]['key']};});_0x2059c7[_0xa3b4('0x30')]=_[_0xa3b4('0x2d')](_0x51e021,_0xa3b4('0x2b'));_0x2059c7[_0xa3b4('0x31')]=_[_0xa3b4('0x32')](_0x51fd19[_0xa3b4('0x31')]);_0x2059c7[_0xa3b4('0x33')]=_['intersection'](_0x2059c7[_0xa3b4('0x30')],_0x2059c7[_0xa3b4('0x31')]);_0x5633aa[_0xa3b4('0x34')]=_[_0xa3b4('0x35')](_0x2059c7[_0xa3b4('0x30')],qs[_0xa3b4('0x36')](_0x51fd19[_0xa3b4('0x31')][_0xa3b4('0x36')]));_0x5633aa[_0xa3b4('0x34')]=_0x5633aa[_0xa3b4('0x34')]['length']?_0x5633aa[_0xa3b4('0x34')]:_0x2059c7[_0xa3b4('0x30')];if(!_0x51fd19[_0xa3b4('0x31')][_0xa3b4('0x37')](_0xa3b4('0x38'))){_0x5633aa[_0xa3b4('0x21')]=qs[_0xa3b4('0x21')](_0x51fd19[_0xa3b4('0x31')][_0xa3b4('0x21')]);_0x5633aa[_0xa3b4('0x1f')]=qs[_0xa3b4('0x1f')](_0x51fd19[_0xa3b4('0x31')][_0xa3b4('0x1f')]);}_0x5633aa['order']=qs[_0xa3b4('0x39')](_0x51fd19[_0xa3b4('0x31')]['sort']);_0x5633aa[_0xa3b4('0x3a')]=qs[_0xa3b4('0x33')](_[_0xa3b4('0x3b')](_0x51fd19['query'],_0x2059c7[_0xa3b4('0x33')]),_0x51e021);if(_0x51fd19[_0xa3b4('0x31')][_0xa3b4('0x3c')]){_0x5633aa[_0xa3b4('0x3a')]=_[_0xa3b4('0x3d')](_0x5633aa['where'],{'$or':_['map'](_0x51e021,function(_0x5dff94){if(_0x5dff94[_0xa3b4('0x2f')]!=='VIRTUAL'){var _0x24dd45={};_0x24dd45[_0x5dff94['name']]={'$like':'%'+_0x51fd19['query'][_0xa3b4('0x3c')]+'%'};return _0x24dd45;}})});}_0x5633aa=_[_0xa3b4('0x3d')]({},_0x5633aa,_0x51fd19['options']);var _0x1fea4c={'where':_0x5633aa[_0xa3b4('0x3a')]};return db[_0xa3b4('0x3e')][_0xa3b4('0x22')](_0x1fea4c)[_0xa3b4('0x28')](function(_0xad76cd){_0x142190[_0xa3b4('0x22')]=_0xad76cd;if(_0x51fd19[_0xa3b4('0x31')][_0xa3b4('0x3f')]){_0x5633aa[_0xa3b4('0x40')]=[{'all':!![]}];}return db[_0xa3b4('0x3e')][_0xa3b4('0x41')](_0x5633aa);})[_0xa3b4('0x28')](function(_0x2ac0af){_0x142190[_0xa3b4('0x42')]=_0x2ac0af;return _0x142190;})[_0xa3b4('0x28')](respondWithFilteredResult(_0x833325,_0x5633aa))[_0xa3b4('0x43')](handleError(_0x833325,null));};exports[_0xa3b4('0x44')]=function(_0x3e8c34,_0x16fca9){var _0x2b84e7={'raw':!![],'where':{'id':_0x3e8c34['params']['id']}},_0x217531={};_0x217531[_0xa3b4('0x30')]=_[_0xa3b4('0x32')](db[_0xa3b4('0x3e')][_0xa3b4('0x2e')]);_0x217531[_0xa3b4('0x31')]=_[_0xa3b4('0x32')](_0x3e8c34['query']);_0x217531[_0xa3b4('0x33')]=_[_0xa3b4('0x35')](_0x217531[_0xa3b4('0x30')],_0x217531[_0xa3b4('0x31')]);_0x2b84e7[_0xa3b4('0x34')]=_[_0xa3b4('0x35')](_0x217531['model'],qs['fields'](_0x3e8c34[_0xa3b4('0x31')][_0xa3b4('0x36')]));_0x2b84e7[_0xa3b4('0x34')]=_0x2b84e7[_0xa3b4('0x34')][_0xa3b4('0x45')]?_0x2b84e7[_0xa3b4('0x34')]:_0x217531['model'];if(_0x3e8c34[_0xa3b4('0x31')]['includeAll']){_0x2b84e7[_0xa3b4('0x40')]=[{'all':!![]}];}_0x2b84e7=_['merge']({},_0x2b84e7,_0x3e8c34['options']);return db['Sound'][_0xa3b4('0x46')](_0x2b84e7)[_0xa3b4('0x28')](handleEntityNotFound(_0x16fca9,null))[_0xa3b4('0x28')](respondWithResult(_0x16fca9,null))[_0xa3b4('0x43')](handleError(_0x16fca9,null));};exports[_0xa3b4('0x47')]=function(_0x2d6f96,_0x332b8c,_0x2c1f37){return db[_0xa3b4('0x3e')][_0xa3b4('0x46')]({'where':{'id':_0x2d6f96[_0xa3b4('0x48')]['id']},'attributes':[_0xa3b4('0x2b'),'save_name',_0xa3b4('0x49')],'raw':!![]})[_0xa3b4('0x28')](handleEntityNotFound(_0x332b8c,null))['then'](function(_0x4849df){if(_0x4849df){if(!fs[_0xa3b4('0x4a')](path[_0xa3b4('0x4b')](config['root'],_0xa3b4('0x4c'),_0x4849df[_0xa3b4('0x4d')]+'.'+_0x4849df['converted_format']))){throw new db[(_0xa3b4('0x4e'))]['ValidationError']('Sound\x20not\x20found');}return _0x332b8c[_0xa3b4('0x47')](path['join'](config[_0xa3b4('0x4f')],'server/files/sounds/converted',util[_0xa3b4('0x50')](_0xa3b4('0x51'),_0x4849df['save_name'],_0x4849df[_0xa3b4('0x49')])),util[_0xa3b4('0x50')]('%s.%s',_0x4849df['name'],_0x4849df[_0xa3b4('0x49')]));}return null;})[_0xa3b4('0x43')](handleError(_0x332b8c,null));};exports[_0xa3b4('0x52')]=function(_0x1e03b6,_0x1800f3,_0x4650c7){var _0x1775d0={'name':path['basename'](_0x1e03b6['file'][_0xa3b4('0x53')],path[_0xa3b4('0x54')](_0x1e03b6['file'][_0xa3b4('0x53')])),'save_name':path[_0xa3b4('0x55')](_0x1e03b6[_0xa3b4('0x56')][_0xa3b4('0x57')],path[_0xa3b4('0x54')](_0x1e03b6['file'][_0xa3b4('0x57')])),'original_format':path[_0xa3b4('0x54')](_0x1e03b6[_0xa3b4('0x56')]['originalname'])['substring'](0x1),'converted_format':_0xa3b4('0x58')};var _0x4c9587=path[_0xa3b4('0x4b')](config[_0xa3b4('0x4f')],'server/files/sounds/original',_0x1e03b6['file'][_0xa3b4('0x57')]);var _0x3a372c=path[_0xa3b4('0x4b')](config[_0xa3b4('0x4f')],_0xa3b4('0x4c'),util[_0xa3b4('0x50')](_0xa3b4('0x51'),path[_0xa3b4('0x55')](_0x1e03b6['file'][_0xa3b4('0x57')],path[_0xa3b4('0x54')](_0x1e03b6[_0xa3b4('0x56')][_0xa3b4('0x57')])),_0x1775d0[_0xa3b4('0x49')]));logger['info'](_0xa3b4('0x59'),_0x4c9587);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x3a372c);try{fs[_0xa3b4('0x5a')](_0x4c9587,parseInt(_0xa3b4('0x5b'),0x8));var _0x448f95=sox[_0xa3b4('0x5c')](_0x4c9587,_0x3a372c,{'sampleRate':0x1f40,'format':_0xa3b4('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x448f95['on'](_0xa3b4('0x5d'),function(_0x1c6573){fs['unlinkSync'](_0x4c9587);_0x1800f3[_0xa3b4('0x1d')](0x1f4)['send'](_0x1c6573);});_0x448f95['on'](_0xa3b4('0x5e'),function(_0x22469a){_0x1775d0[_0xa3b4('0x5f')]=isNaN(_0x22469a[_0xa3b4('0x60')])?null:_0x22469a['duration']*0x3e8;_0x1775d0[_0xa3b4('0x61')]=isNaN(_0x22469a[_0xa3b4('0x62')])?null:_0x22469a[_0xa3b4('0x62')];_0x1775d0['original_channelCount']=isNaN(_0x22469a['channelCount'])?null:_0x22469a[_0xa3b4('0x63')];_0x1775d0[_0xa3b4('0x64')]=isNaN(_0x22469a['bitRate'])?null:_0x22469a[_0xa3b4('0x65')];_0x1775d0[_0xa3b4('0x66')]=isNaN(_0x22469a[_0xa3b4('0x67')])?null:_0x22469a[_0xa3b4('0x67')];});_0x448f95['on'](_0xa3b4('0x68'),function(_0xc18fab){_0x1775d0[_0xa3b4('0x69')]=isNaN(_0xc18fab[_0xa3b4('0x60')])?null:_0xc18fab[_0xa3b4('0x60')]*0x3e8;_0x1775d0[_0xa3b4('0x6a')]=isNaN(_0xc18fab[_0xa3b4('0x62')])?null:_0xc18fab[_0xa3b4('0x62')];_0x1775d0['converted_channelCount']=isNaN(_0xc18fab['channelCount'])?null:_0xc18fab['channelCount'];_0x1775d0[_0xa3b4('0x6b')]=isNaN(_0xc18fab[_0xa3b4('0x65')])?null:_0xc18fab['bitRate'];_0x1775d0['converted_sampleRate']=isNaN(_0xc18fab[_0xa3b4('0x67')])?null:_0xc18fab[_0xa3b4('0x67')];});_0x448f95['on'](_0xa3b4('0x1c'),function(){fs[_0xa3b4('0x5a')](_0x3a372c,parseInt(_0xa3b4('0x5b'),0x8));return db[_0xa3b4('0x3e')]['create'](_0x1775d0)['then'](function(_0x10d50c){var _0x10e623={'role':_0x1e03b6[_0xa3b4('0x6c')][_0xa3b4('0x6d')],'userProfileId':_0x1e03b6[_0xa3b4('0x6c')][_0xa3b4('0x6e')]};if(!_0x10e623)throw new Error(_0xa3b4('0x6f'));if(_0x10e623[_0xa3b4('0x6d')]==='user'){var _0x3b3cf1=_0x10d50c[_0xa3b4('0x70')]({'plain':!![]});return db[_0xa3b4('0x71')]['find']({'where':{'name':_0xa3b4('0x29'),'userProfileId':_0x10e623[_0xa3b4('0x6e')]},'raw':!![]})['then'](function(_0x5897e0){if(_0x5897e0&&_0x5897e0[_0xa3b4('0x72')]===0x0){return db[_0xa3b4('0x73')][_0xa3b4('0x52')]({'name':_0x3b3cf1['name'],'resourceId':_0x3b3cf1['id'],'type':_0x5897e0[_0xa3b4('0x2b')],'sectionId':_0x5897e0['id']},{})['then'](function(){return _0x10d50c;});}else{return _0x10d50c;}})['catch'](function(_0x2b644f){logger[_0xa3b4('0x5d')](_0xa3b4('0x74'),_0x2b644f);throw _0x2b644f;});}return _0x10d50c;})[_0xa3b4('0x28')](respondWithResult(_0x1800f3,null))[_0xa3b4('0x43')](handleError(_0x1800f3,null));});_0x448f95[_0xa3b4('0x75')]();}catch(_0x76876a){_0x1800f3[_0xa3b4('0x1d')](0x1f4)[_0xa3b4('0x2c')](_0x76876a);}};exports['update']=function(_0xd10b06,_0x5c9799,_0x423017){return db[_0xa3b4('0x3e')]['find']({'where':{'id':_0xd10b06[_0xa3b4('0x48')]['id']}})[_0xa3b4('0x28')](handleEntityNotFound(_0x5c9799,null))[_0xa3b4('0x28')](saveUpdates(_[_0xa3b4('0x3b')](_0xd10b06[_0xa3b4('0x6c')],[_0xa3b4('0x2b'),_0xa3b4('0x76')]),null))[_0xa3b4('0x28')](respondWithResult(_0x5c9799,null))[_0xa3b4('0x43')](handleError(_0x5c9799,null));};exports[_0xa3b4('0x77')]=function(_0x108ea5,_0x45fd94,_0x4b32f4){return db['Sound'][_0xa3b4('0x46')]({'where':{'id':_0x108ea5['params']['id']}})['then'](function(_0x178d1e){if(_0x178d1e){return _0x178d1e[_0xa3b4('0x27')]();}})['then'](function(_0x3d98b7){var _0x10da98=path['join'](config[_0xa3b4('0x4f')],_0xa3b4('0x78'),util[_0xa3b4('0x50')](_0xa3b4('0x51'),_0x3d98b7['save_name'],_0x3d98b7[_0xa3b4('0x79')]));var _0x4b2d3d=path[_0xa3b4('0x4b')](config[_0xa3b4('0x4f')],_0xa3b4('0x4c'),util['format'](_0xa3b4('0x51'),_0x3d98b7[_0xa3b4('0x4d')],_0x3d98b7[_0xa3b4('0x49')]));fs['unlinkSync'](_0x10da98);fs[_0xa3b4('0x7a')](_0x4b2d3d);return _0x3d98b7;})[_0xa3b4('0x28')](function(_0x4d0e67){if(_0x4d0e67){return _0x45fd94[_0xa3b4('0x1d')](0xcc)[_0xa3b4('0x1c')]();}})['then'](handleEntityNotFound(_0x45fd94,null))[_0xa3b4('0x43')](handleError(_0x45fd94,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 56f591f..8954e3a 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 _0xd5c4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','../../config/logger','api'];(function(_0x2c654f,_0x11ce94){var _0xa53d15=function(_0x4db4a9){while(--_0x4db4a9){_0x2c654f['push'](_0x2c654f['shift']());}};_0xa53d15(++_0x11ce94);}(_0xd5c4,0x1a5));var _0x4d5c=function(_0x5277d0,_0x7fdc00){_0x5277d0=_0x5277d0-0x0;var _0x1054b3=_0xd5c4[_0x5277d0];return _0x1054b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4d5c('0x0'))(_0x4d5c('0x1'));var moment=require(_0x4d5c('0x2'));var BPromise=require(_0x4d5c('0x3'));var rp=require(_0x4d5c('0x4'));var fs=require('fs');var path=require(_0x4d5c('0x5'));var rimraf=require(_0x4d5c('0x6'));var config=require(_0x4d5c('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x228120,_0xb433b8){return _0x228120[_0x4d5c('0x8')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85f3=['api','moment','bluebird','request-promise','path','../../config/environment','exports','Sound','lodash'];(function(_0x4825e6,_0x43f514){var _0x250937=function(_0x32904e){while(--_0x32904e){_0x4825e6['push'](_0x4825e6['shift']());}};_0x250937(++_0x43f514);}(_0x85f3,0x128));var _0x385f=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x85f3[_0x5b27da];return _0x3254f4;};'use strict';var _=require(_0x385f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x385f('0x1'));var moment=require(_0x385f('0x2'));var BPromise=require(_0x385f('0x3'));var rp=require(_0x385f('0x4'));var fs=require('fs');var path=require(_0x385f('0x5'));var rimraf=require('rimraf');var config=require(_0x385f('0x6'));var attributes=require('./sound.attributes');module[_0x385f('0x7')]=function(_0x1afc4c,_0x22351f){return _0x1afc4c['define'](_0x385f('0x8'),attributes,{'tableName':'tools_sounds','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 6fe6f2c..d190948 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 _0x764b=['result','catch','ShowSound','find','options','raw','attributes','map','model','include','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x1ba90c,_0x5dfef1){var _0x5f4df1=function(_0x4cc226){while(--_0x4cc226){_0x1ba90c['push'](_0x1ba90c['shift']());}};_0x5f4df1(++_0x5dfef1);}(_0x764b,0x156));var _0xb764=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x764b[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');var util=require(_0xb764('0x0'));var moment=require(_0xb764('0x1'));var BPromise=require(_0xb764('0x2'));var rs=require(_0xb764('0x3'));var fs=require('fs');var Redis=require(_0xb764('0x4'));var db=require(_0xb764('0x5'))['db'];var utils=require(_0xb764('0x6'));var logger=require('../../config/logger')(_0xb764('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb764('0x8')][_0xb764('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d3d5c,_0x484bf1,_0x2a1483){return new BPromise(function(_0x4f2a60,_0x455abc){return client[_0xb764('0xa')](_0x4d3d5c,_0x2a1483)[_0xb764('0xb')](function(_0x3dedd6){logger[_0xb764('0xc')](_0xb764('0xd'),_0x484bf1,'request\x20sent');logger['debug'](_0xb764('0xe'),_0x484bf1,_0xb764('0xf'),JSON['stringify'](_0x3dedd6));if(_0x3dedd6[_0xb764('0x10')]){if(_0x3dedd6['error']['code']===0x1f4){logger[_0xb764('0x10')](_0xb764('0xd'),_0x484bf1,_0x3dedd6[_0xb764('0x10')]['message']);return _0x455abc(_0x3dedd6[_0xb764('0x10')][_0xb764('0x11')]);}logger[_0xb764('0x10')]('Sound,\x20%s,\x20%s',_0x484bf1,_0x3dedd6[_0xb764('0x10')][_0xb764('0x11')]);return _0x4f2a60(_0x3dedd6['error'][_0xb764('0x11')]);}else{logger[_0xb764('0xc')](_0xb764('0xd'),_0x484bf1,_0xb764('0xf'));_0x4f2a60(_0x3dedd6[_0xb764('0x12')]['message']);}})[_0xb764('0x13')](function(_0x3eff8d){logger[_0xb764('0x10')](_0xb764('0xd'),_0x484bf1,_0x3eff8d);_0x455abc(_0x3eff8d);});});}exports[_0xb764('0x14')]=function(_0x211771){var _0x1481d9=this;return new Promise(function(_0x3cfc13,_0x4d07e7){return db['Sound'][_0xb764('0x15')]({'raw':_0x211771[_0xb764('0x16')]?_0x211771[_0xb764('0x16')][_0xb764('0x17')]===undefined?!![]:![]:!![],'where':_0x211771[_0xb764('0x16')]?_0x211771[_0xb764('0x16')]['where']||null:null,'attributes':_0x211771['options']?_0x211771[_0xb764('0x16')][_0xb764('0x18')]||null:null,'include':_0x211771[_0xb764('0x16')]?_0x211771[_0xb764('0x16')]['include']?_[_0xb764('0x19')](_0x211771[_0xb764('0x16')]['include'],function(_0xc2eee7){return{'model':db[_0xc2eee7[_0xb764('0x1a')]],'as':_0xc2eee7['as'],'attributes':_0xc2eee7[_0xb764('0x18')],'include':_0xc2eee7[_0xb764('0x1b')]?_['map'](_0xc2eee7[_0xb764('0x1b')],function(_0x5db178){return{'model':db[_0x5db178[_0xb764('0x1a')]],'as':_0x5db178['as'],'attributes':_0x5db178['attributes'],'include':_0x5db178[_0xb764('0x1b')]?_['map'](_0x5db178[_0xb764('0x1b')],function(_0x35fd50){return{'model':db[_0x35fd50[_0xb764('0x1a')]],'as':_0x35fd50['as'],'attributes':_0x35fd50['attributes']};}):[]};}):[]};}):[]:[]})[_0xb764('0xb')](function(_0x18db40){logger[_0xb764('0xc')](_0xb764('0x14'),_0x211771);logger[_0xb764('0x1c')](_0xb764('0x14'),_0x211771,JSON[_0xb764('0x1d')](_0x18db40));_0x3cfc13(_0x18db40);})['catch'](function(_0x195188){logger[_0xb764('0x10')]('ShowSound',_0x195188['message'],_0x211771);_0x4d07e7(_0x1481d9[_0xb764('0x10')](0x1f4,_0x195188['message']));});});}; \ No newline at end of file +var _0x52b4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','find','options','where','attributes','include','map','model','info','debug','stringify','util','bluebird','randomstring'];(function(_0x5c2b1f,_0x266443){var _0x55d367=function(_0xeb5790){while(--_0xeb5790){_0x5c2b1f['push'](_0x5c2b1f['shift']());}};_0x55d367(++_0x266443);}(_0x52b4,0x193));var _0x452b=function(_0x34f6af,_0x679d84){_0x34f6af=_0x34f6af-0x0;var _0x4c7c2e=_0x52b4[_0x34f6af];return _0x4c7c2e;};'use strict';var _=require('lodash');var util=require(_0x452b('0x0'));var moment=require('moment');var BPromise=require(_0x452b('0x1'));var rs=require(_0x452b('0x2'));var fs=require('fs');var Redis=require(_0x452b('0x3'));var db=require(_0x452b('0x4'))['db'];var utils=require(_0x452b('0x5'));var logger=require(_0x452b('0x6'))(_0x452b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x452b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50d591,_0x491b12,_0x57b505){return new BPromise(function(_0x55035e,_0x15c042){return client['request'](_0x50d591,_0x57b505)[_0x452b('0x9')](function(_0x400d97){logger['info'](_0x452b('0xa'),_0x491b12,_0x452b('0xb'));logger['debug'](_0x452b('0xc'),_0x491b12,_0x452b('0xb'),JSON['stringify'](_0x400d97));if(_0x400d97[_0x452b('0xd')]){if(_0x400d97[_0x452b('0xd')][_0x452b('0xe')]===0x1f4){logger[_0x452b('0xd')](_0x452b('0xa'),_0x491b12,_0x400d97[_0x452b('0xd')][_0x452b('0xf')]);return _0x15c042(_0x400d97[_0x452b('0xd')][_0x452b('0xf')]);}logger[_0x452b('0xd')](_0x452b('0xa'),_0x491b12,_0x400d97[_0x452b('0xd')]['message']);return _0x55035e(_0x400d97[_0x452b('0xd')][_0x452b('0xf')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x491b12,_0x452b('0xb'));_0x55035e(_0x400d97[_0x452b('0x10')][_0x452b('0xf')]);}})[_0x452b('0x11')](function(_0x49cec4){logger['error'](_0x452b('0xa'),_0x491b12,_0x49cec4);_0x15c042(_0x49cec4);});});}exports[_0x452b('0x12')]=function(_0x402ab3){var _0x2343b3=this;return new Promise(function(_0x50e35e,_0xe088d0){return db['Sound'][_0x452b('0x13')]({'raw':_0x402ab3['options']?_0x402ab3[_0x452b('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x402ab3['options']?_0x402ab3['options'][_0x452b('0x15')]||null:null,'attributes':_0x402ab3[_0x452b('0x14')]?_0x402ab3['options'][_0x452b('0x16')]||null:null,'include':_0x402ab3[_0x452b('0x14')]?_0x402ab3[_0x452b('0x14')][_0x452b('0x17')]?_[_0x452b('0x18')](_0x402ab3['options']['include'],function(_0x41ea7d){return{'model':db[_0x41ea7d['model']],'as':_0x41ea7d['as'],'attributes':_0x41ea7d[_0x452b('0x16')],'include':_0x41ea7d[_0x452b('0x17')]?_[_0x452b('0x18')](_0x41ea7d['include'],function(_0x519438){return{'model':db[_0x519438[_0x452b('0x19')]],'as':_0x519438['as'],'attributes':_0x519438[_0x452b('0x16')],'include':_0x519438[_0x452b('0x17')]?_['map'](_0x519438[_0x452b('0x17')],function(_0x480039){return{'model':db[_0x480039['model']],'as':_0x480039['as'],'attributes':_0x480039[_0x452b('0x16')]};}):[]};}):[]};}):[]:[]})[_0x452b('0x9')](function(_0x25b9b8){logger[_0x452b('0x1a')](_0x452b('0x12'),_0x402ab3);logger[_0x452b('0x1b')](_0x452b('0x12'),_0x402ab3,JSON[_0x452b('0x1c')](_0x25b9b8));_0x50e35e(_0x25b9b8);})['catch'](function(_0x2219df){logger[_0x452b('0xd')](_0x452b('0x12'),_0x2219df[_0x452b('0xf')],_0x402ab3);_0xe088d0(_0x2343b3[_0x452b('0xd')](0x1f4,_0x2219df[_0x452b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0c7955e..ea0d98c 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x148da0,_0x2adee8){var _0x5236b=function(_0x353cfc){while(--_0x353cfc){_0x148da0['push'](_0x148da0['shift']());}};_0x5236b(++_0x2adee8);}(_0x2032,0xd9));var _0x2203=function(_0x4c6747,_0x4145e6){_0x4c6747=_0x4c6747-0x0;var _0x48910f=_0x2032[_0x4c6747];return _0x48910f;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=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(_0x32056c,_0x1b6db7){var _0x317313=function(_0x6456b6){while(--_0x6456b6){_0x32056c['push'](_0x32056c['shift']());}};_0x317313(++_0x1b6db7);}(_0x8603,0x190));var _0x3860=function(_0x271d10,_0x5348db){_0x271d10=_0x271d10-0x0;var _0x479491=_0x8603[_0x271d10];return _0x479491;};'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 a8e1614..a4571db 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 _0xea2a=['out','sequelize','exports','STRING','medium'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xea2a,0x132));var _0xaea2=function(_0x26aa24,_0xcd5d8c){_0x26aa24=_0x26aa24-0x0;var _0xf90f88=_0xea2a[_0x26aa24];return _0xf90f88;};'use strict';var Sequelize=require(_0xaea2('0x0'));module[_0xaea2('0x1')]={'uniqueid':{'type':Sequelize[_0xaea2('0x2')]},'body':{'type':Sequelize['TEXT'](_0xaea2('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xaea2('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xaea2('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc1f5=['medium','ENUM','out','STRING','TEXT','exports'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xc1f5,0xb9));var _0x5c1f=function(_0x1ef246,_0x42e40){_0x1ef246=_0x1ef246-0x0;var _0x229a28=_0xc1f5[_0x1ef246];return _0x229a28;};'use strict';var Sequelize=require('sequelize');module[_0x5c1f('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x5c1f('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x5c1f('0x2')]('in',_0x5c1f('0x3')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x5c1f('0x4')]},'providerResponse':{'type':Sequelize[_0x5c1f('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 998c809..aa5bb29 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 _0x2837=['find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SquareMessage','then','includeAll','include','findAll','rows','catch','show','params'];(function(_0xb46842,_0x553927){var _0x19a867=function(_0x1ea860){while(--_0x1ea860){_0xb46842['push'](_0xb46842['shift']());}};_0x19a867(++_0x553927);}(_0x2837,0x12b));var _0x7283=function(_0x19093d,_0xbf845){_0x19093d=_0x19093d-0x0;var _0x4a2170=_0x2837[_0x19093d];return _0x4a2170;};'use strict';var emlformat=require(_0x7283('0x0'));var rimraf=require(_0x7283('0x1'));var zipdir=require(_0x7283('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7283('0x3'));var moment=require(_0x7283('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7283('0x5'));var path=require(_0x7283('0x6'));var sox=require(_0x7283('0x7'));var csv=require('to-csv');var ejs=require(_0x7283('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7283('0x9'));var squel=require(_0x7283('0xa'));var crypto=require(_0x7283('0xb'));var jsforce=require(_0x7283('0xc'));var deskjs=require(_0x7283('0xd'));var toCsv=require(_0x7283('0xe'));var querystring=require(_0x7283('0xf'));var Papa=require(_0x7283('0x10'));var Redis=require(_0x7283('0x11'));var authService=require(_0x7283('0x12'));var qs=require(_0x7283('0x13'));var as=require(_0x7283('0x14'));var hardwareService=require(_0x7283('0x15'));var logger=require(_0x7283('0x16'))('api');var utils=require(_0x7283('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7283('0x18'))['db'];function respondWithStatusCode(_0x3897b9,_0x2bb2e6){_0x2bb2e6=_0x2bb2e6||0xcc;return function(_0x29f785){if(_0x29f785){return _0x3897b9['sendStatus'](_0x2bb2e6);}return _0x3897b9[_0x7283('0x19')](_0x2bb2e6)[_0x7283('0x1a')]();};}function respondWithResult(_0x42e57b,_0x35922d){_0x35922d=_0x35922d||0xc8;return function(_0x16bbe5){if(_0x16bbe5){return _0x42e57b[_0x7283('0x19')](_0x35922d)[_0x7283('0x1b')](_0x16bbe5);}};}function respondWithFilteredResult(_0x4dad4b,_0x21720d){return function(_0x28979f){if(_0x28979f){var _0x18fcb8=typeof _0x21720d['offset']===_0x7283('0x1c')&&typeof _0x21720d[_0x7283('0x1d')]==='undefined';var _0x4fa4ff=_0x28979f[_0x7283('0x1e')];var _0x4cf74e=_0x18fcb8?0x0:_0x21720d[_0x7283('0x1f')];var _0x3ca4a9=_0x18fcb8?_0x28979f[_0x7283('0x1e')]:_0x21720d[_0x7283('0x1f')]+_0x21720d[_0x7283('0x1d')];var _0x56cff0;if(_0x3ca4a9>=_0x4fa4ff){_0x3ca4a9=_0x4fa4ff;_0x56cff0=0xc8;}else{_0x56cff0=0xce;}_0x4dad4b[_0x7283('0x19')](_0x56cff0);return _0x4dad4b[_0x7283('0x20')](_0x7283('0x21'),_0x4cf74e+'-'+_0x3ca4a9+'/'+_0x4fa4ff)['json'](_0x28979f);}return null;};}function patchUpdates(_0x19d345){return function(_0x3db8e2){try{jsonpatch['apply'](_0x3db8e2,_0x19d345,!![]);}catch(_0x4765a6){return BPromise['reject'](_0x4765a6);}return _0x3db8e2['save']();};}function saveUpdates(_0x19654a,_0x3f90fc){return function(_0x24ef2d){if(_0x24ef2d){return _0x24ef2d[_0x7283('0x22')](_0x19654a)['then'](function(_0x2742de){return _0x2742de;});}return null;};}function removeEntity(_0x2c145b,_0x10d4f0){return function(_0x5785ef){if(_0x5785ef){return _0x5785ef[_0x7283('0x23')]()['then'](function(){_0x2c145b[_0x7283('0x19')](0xcc)[_0x7283('0x1a')]();});}};}function handleEntityNotFound(_0x9c80e9,_0x21482d){return function(_0x212a8c){if(!_0x212a8c){_0x9c80e9[_0x7283('0x24')](0x194);}return _0x212a8c;};}function handleError(_0x5c174a,_0x38b43e){_0x38b43e=_0x38b43e||0x1f4;return function(_0x2d919d){logger[_0x7283('0x25')](_0x2d919d['stack']);if(_0x2d919d[_0x7283('0x26')]){delete _0x2d919d[_0x7283('0x26')];}_0x5c174a[_0x7283('0x19')](_0x38b43e)[_0x7283('0x27')](_0x2d919d);};}exports[_0x7283('0x28')]=function(_0x361719,_0x39cc9b){var _0x3f67aa={},_0x50df44={},_0x49835d={'count':0x0,'rows':[]};var _0x1678de=_[_0x7283('0x29')](db['SquareMessage'][_0x7283('0x2a')],function(_0x2e9940){return{'name':_0x2e9940[_0x7283('0x2b')],'type':_0x2e9940[_0x7283('0x2c')][_0x7283('0x2d')]};});_0x50df44[_0x7283('0x2e')]=_[_0x7283('0x29')](_0x1678de,_0x7283('0x26'));_0x50df44[_0x7283('0x2f')]=_[_0x7283('0x30')](_0x361719[_0x7283('0x2f')]);_0x50df44[_0x7283('0x31')]=_[_0x7283('0x32')](_0x50df44['model'],_0x50df44[_0x7283('0x2f')]);_0x3f67aa[_0x7283('0x33')]=_[_0x7283('0x32')](_0x50df44[_0x7283('0x2e')],qs[_0x7283('0x34')](_0x361719[_0x7283('0x2f')][_0x7283('0x34')]));_0x3f67aa[_0x7283('0x33')]=_0x3f67aa[_0x7283('0x33')][_0x7283('0x35')]?_0x3f67aa['attributes']:_0x50df44[_0x7283('0x2e')];if(!_0x361719['query'][_0x7283('0x36')](_0x7283('0x37'))){_0x3f67aa[_0x7283('0x1d')]=qs[_0x7283('0x1d')](_0x361719['query'][_0x7283('0x1d')]);_0x3f67aa[_0x7283('0x1f')]=qs[_0x7283('0x1f')](_0x361719['query']['offset']);}_0x3f67aa['order']=qs[_0x7283('0x38')](_0x361719['query'][_0x7283('0x38')]);_0x3f67aa[_0x7283('0x39')]=qs[_0x7283('0x31')](_['pick'](_0x361719['query'],_0x50df44[_0x7283('0x31')]),_0x1678de);if(_0x361719[_0x7283('0x2f')][_0x7283('0x3a')]){_0x3f67aa[_0x7283('0x39')]=_[_0x7283('0x3b')](_0x3f67aa[_0x7283('0x39')],{'$or':_[_0x7283('0x29')](_0x1678de,function(_0x2d6d1c){if(_0x2d6d1c['type']!==_0x7283('0x3c')){var _0x1e4c21={};_0x1e4c21[_0x2d6d1c[_0x7283('0x26')]]={'$like':'%'+_0x361719['query']['filter']+'%'};return _0x1e4c21;}})});}_0x3f67aa=_[_0x7283('0x3b')]({},_0x3f67aa,_0x361719[_0x7283('0x3d')]);var _0x1cffa6={'where':_0x3f67aa[_0x7283('0x39')]};return db[_0x7283('0x3e')][_0x7283('0x1e')](_0x1cffa6)[_0x7283('0x3f')](function(_0x480af1){_0x49835d[_0x7283('0x1e')]=_0x480af1;if(_0x361719[_0x7283('0x2f')][_0x7283('0x40')]){_0x3f67aa[_0x7283('0x41')]=[{'all':!![]}];}return db[_0x7283('0x3e')][_0x7283('0x42')](_0x3f67aa);})[_0x7283('0x3f')](function(_0x5cb1b3){_0x49835d[_0x7283('0x43')]=_0x5cb1b3;return _0x49835d;})[_0x7283('0x3f')](respondWithFilteredResult(_0x39cc9b,_0x3f67aa))[_0x7283('0x44')](handleError(_0x39cc9b,null));};exports[_0x7283('0x45')]=function(_0x32b7d9,_0x3856b6){var _0x31b122={'raw':!![],'where':{'id':_0x32b7d9[_0x7283('0x46')]['id']}},_0x4d6f6d={};_0x4d6f6d[_0x7283('0x2e')]=_[_0x7283('0x30')](db[_0x7283('0x3e')][_0x7283('0x2a')]);_0x4d6f6d[_0x7283('0x2f')]=_[_0x7283('0x30')](_0x32b7d9['query']);_0x4d6f6d[_0x7283('0x31')]=_[_0x7283('0x32')](_0x4d6f6d[_0x7283('0x2e')],_0x4d6f6d[_0x7283('0x2f')]);_0x31b122[_0x7283('0x33')]=_[_0x7283('0x32')](_0x4d6f6d[_0x7283('0x2e')],qs[_0x7283('0x34')](_0x32b7d9[_0x7283('0x2f')][_0x7283('0x34')]));_0x31b122[_0x7283('0x33')]=_0x31b122[_0x7283('0x33')][_0x7283('0x35')]?_0x31b122[_0x7283('0x33')]:_0x4d6f6d['model'];if(_0x32b7d9[_0x7283('0x2f')]['includeAll']){_0x31b122[_0x7283('0x41')]=[{'all':!![]}];}_0x31b122=_[_0x7283('0x3b')]({},_0x31b122,_0x32b7d9[_0x7283('0x3d')]);return db[_0x7283('0x3e')][_0x7283('0x47')](_0x31b122)['then'](handleEntityNotFound(_0x3856b6,null))[_0x7283('0x3f')](respondWithResult(_0x3856b6,null))[_0x7283('0x44')](handleError(_0x3856b6,null));};exports[_0x7283('0x48')]=function(_0x46dcda,_0x568e02){return db['SquareMessage'][_0x7283('0x48')](_0x46dcda[_0x7283('0x49')],{})[_0x7283('0x3f')](respondWithResult(_0x568e02,0xc9))[_0x7283('0x44')](handleError(_0x568e02,null));};exports[_0x7283('0x22')]=function(_0x57f9ed,_0x34c6e7){if(_0x57f9ed[_0x7283('0x49')]['id']){delete _0x57f9ed[_0x7283('0x49')]['id'];}return db[_0x7283('0x3e')][_0x7283('0x47')]({'where':{'id':_0x57f9ed['params']['id']}})[_0x7283('0x3f')](handleEntityNotFound(_0x34c6e7,null))[_0x7283('0x3f')](saveUpdates(_0x57f9ed['body'],null))['then'](respondWithResult(_0x34c6e7,null))[_0x7283('0x44')](handleError(_0x34c6e7,null));};exports[_0x7283('0x23')]=function(_0x20d9d1,_0x116106){return db['SquareMessage'][_0x7283('0x47')]({'where':{'id':_0x20d9d1[_0x7283('0x46')]['id']}})['then'](handleEntityNotFound(_0x116106,null))['then'](removeEntity(_0x116106,null))[_0x7283('0x44')](handleError(_0x116106,null));}; \ No newline at end of file +var _0x1c52=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','send','index','map','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','filter','where','merge','SquareMessage','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0x1c52,0x7c));var _0x21c5=function(_0x106a60,_0x5d5e2e){_0x106a60=_0x106a60-0x0;var _0x54b226=_0x1c52[_0x106a60];return _0x54b226;};'use strict';var emlformat=require(_0x21c5('0x0'));var rimraf=require(_0x21c5('0x1'));var zipdir=require(_0x21c5('0x2'));var jsonpatch=require(_0x21c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x21c5('0x4'));var util=require(_0x21c5('0x5'));var path=require('path');var sox=require(_0x21c5('0x6'));var csv=require(_0x21c5('0x7'));var ejs=require(_0x21c5('0x8'));var fs=require('fs');var fs_extra=require(_0x21c5('0x9'));var _=require('lodash');var squel=require(_0x21c5('0xa'));var crypto=require(_0x21c5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21c5('0xc'));var toCsv=require(_0x21c5('0x7'));var querystring=require(_0x21c5('0xd'));var Papa=require(_0x21c5('0xe'));var Redis=require('ioredis');var authService=require(_0x21c5('0xf'));var qs=require(_0x21c5('0x10'));var as=require(_0x21c5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21c5('0x12'))('api');var utils=require(_0x21c5('0x13'));var config=require(_0x21c5('0x14'));var licenseUtil=require(_0x21c5('0x15'));var db=require(_0x21c5('0x16'))['db'];function respondWithStatusCode(_0x511e96,_0x36b869){_0x36b869=_0x36b869||0xcc;return function(_0x59bfc2){if(_0x59bfc2){return _0x511e96[_0x21c5('0x17')](_0x36b869);}return _0x511e96[_0x21c5('0x18')](_0x36b869)['end']();};}function respondWithResult(_0x17be3d,_0x4afb87){_0x4afb87=_0x4afb87||0xc8;return function(_0x4791f7){if(_0x4791f7){return _0x17be3d[_0x21c5('0x18')](_0x4afb87)[_0x21c5('0x19')](_0x4791f7);}};}function respondWithFilteredResult(_0x47030b,_0x20902a){return function(_0x15de0c){if(_0x15de0c){var _0x102433=typeof _0x20902a[_0x21c5('0x1a')]==='undefined'&&typeof _0x20902a[_0x21c5('0x1b')]==='undefined';var _0x495f5c=_0x15de0c[_0x21c5('0x1c')];var _0x56696e=_0x102433?0x0:_0x20902a['offset'];var _0x1bc8a4=_0x102433?_0x15de0c['count']:_0x20902a[_0x21c5('0x1a')]+_0x20902a['limit'];var _0x30fb8a;if(_0x1bc8a4>=_0x495f5c){_0x1bc8a4=_0x495f5c;_0x30fb8a=0xc8;}else{_0x30fb8a=0xce;}_0x47030b['status'](_0x30fb8a);return _0x47030b['set'](_0x21c5('0x1d'),_0x56696e+'-'+_0x1bc8a4+'/'+_0x495f5c)[_0x21c5('0x19')](_0x15de0c);}return null;};}function patchUpdates(_0x2840b7){return function(_0x300178){try{jsonpatch[_0x21c5('0x1e')](_0x300178,_0x2840b7,!![]);}catch(_0x1fb82d){return BPromise[_0x21c5('0x1f')](_0x1fb82d);}return _0x300178[_0x21c5('0x20')]();};}function saveUpdates(_0x1905a9,_0x493fbf){return function(_0x8021db){if(_0x8021db){return _0x8021db[_0x21c5('0x21')](_0x1905a9)[_0x21c5('0x22')](function(_0x1aa54e){return _0x1aa54e;});}return null;};}function removeEntity(_0x123a7a,_0x4bf186){return function(_0x251c9d){if(_0x251c9d){return _0x251c9d[_0x21c5('0x23')]()[_0x21c5('0x22')](function(){_0x123a7a[_0x21c5('0x18')](0xcc)[_0x21c5('0x24')]();});}};}function handleEntityNotFound(_0x4d3215,_0x51c0b1){return function(_0x4f877c){if(!_0x4f877c){_0x4d3215[_0x21c5('0x17')](0x194);}return _0x4f877c;};}function handleError(_0x200bc4,_0x442fac){_0x442fac=_0x442fac||0x1f4;return function(_0x2ae029){logger[_0x21c5('0x25')](_0x2ae029['stack']);if(_0x2ae029['name']){delete _0x2ae029['name'];}_0x200bc4[_0x21c5('0x18')](_0x442fac)[_0x21c5('0x26')](_0x2ae029);};}exports[_0x21c5('0x27')]=function(_0x3f056f,_0x52d551){var _0x887b={},_0x428b60={},_0x26dc04={'count':0x0,'rows':[]};var _0x1f3892=_[_0x21c5('0x28')](db['SquareMessage']['rawAttributes'],function(_0xda0d70){return{'name':_0xda0d70[_0x21c5('0x29')],'type':_0xda0d70[_0x21c5('0x2a')][_0x21c5('0x2b')]};});_0x428b60[_0x21c5('0x2c')]=_[_0x21c5('0x28')](_0x1f3892,_0x21c5('0x2d'));_0x428b60[_0x21c5('0x2e')]=_[_0x21c5('0x2f')](_0x3f056f[_0x21c5('0x2e')]);_0x428b60['filters']=_['intersection'](_0x428b60[_0x21c5('0x2c')],_0x428b60['query']);_0x887b[_0x21c5('0x30')]=_[_0x21c5('0x31')](_0x428b60[_0x21c5('0x2c')],qs[_0x21c5('0x32')](_0x3f056f['query'][_0x21c5('0x32')]));_0x887b['attributes']=_0x887b[_0x21c5('0x30')]['length']?_0x887b[_0x21c5('0x30')]:_0x428b60[_0x21c5('0x2c')];if(!_0x3f056f[_0x21c5('0x2e')]['hasOwnProperty'](_0x21c5('0x33'))){_0x887b['limit']=qs[_0x21c5('0x1b')](_0x3f056f[_0x21c5('0x2e')][_0x21c5('0x1b')]);_0x887b['offset']=qs[_0x21c5('0x1a')](_0x3f056f['query']['offset']);}_0x887b[_0x21c5('0x34')]=qs[_0x21c5('0x35')](_0x3f056f[_0x21c5('0x2e')][_0x21c5('0x35')]);_0x887b['where']=qs[_0x21c5('0x36')](_[_0x21c5('0x37')](_0x3f056f[_0x21c5('0x2e')],_0x428b60[_0x21c5('0x36')]),_0x1f3892);if(_0x3f056f[_0x21c5('0x2e')][_0x21c5('0x38')]){_0x887b[_0x21c5('0x39')]=_[_0x21c5('0x3a')](_0x887b['where'],{'$or':_[_0x21c5('0x28')](_0x1f3892,function(_0x29f3c1){if(_0x29f3c1[_0x21c5('0x2a')]!=='VIRTUAL'){var _0x44d12e={};_0x44d12e[_0x29f3c1[_0x21c5('0x2d')]]={'$like':'%'+_0x3f056f[_0x21c5('0x2e')][_0x21c5('0x38')]+'%'};return _0x44d12e;}})});}_0x887b=_[_0x21c5('0x3a')]({},_0x887b,_0x3f056f['options']);var _0x5a08ad={'where':_0x887b[_0x21c5('0x39')]};return db[_0x21c5('0x3b')][_0x21c5('0x1c')](_0x5a08ad)[_0x21c5('0x22')](function(_0x59a2fb){_0x26dc04[_0x21c5('0x1c')]=_0x59a2fb;if(_0x3f056f[_0x21c5('0x2e')][_0x21c5('0x3c')]){_0x887b[_0x21c5('0x3d')]=[{'all':!![]}];}return db['SquareMessage'][_0x21c5('0x3e')](_0x887b);})[_0x21c5('0x22')](function(_0x4f0e0b){_0x26dc04[_0x21c5('0x3f')]=_0x4f0e0b;return _0x26dc04;})[_0x21c5('0x22')](respondWithFilteredResult(_0x52d551,_0x887b))[_0x21c5('0x40')](handleError(_0x52d551,null));};exports['show']=function(_0x22af70,_0x35693c){var _0x19d698={'raw':!![],'where':{'id':_0x22af70[_0x21c5('0x41')]['id']}},_0x56547e={};_0x56547e['model']=_[_0x21c5('0x2f')](db[_0x21c5('0x3b')][_0x21c5('0x42')]);_0x56547e[_0x21c5('0x2e')]=_[_0x21c5('0x2f')](_0x22af70['query']);_0x56547e['filters']=_['intersection'](_0x56547e[_0x21c5('0x2c')],_0x56547e['query']);_0x19d698[_0x21c5('0x30')]=_[_0x21c5('0x31')](_0x56547e[_0x21c5('0x2c')],qs[_0x21c5('0x32')](_0x22af70['query'][_0x21c5('0x32')]));_0x19d698[_0x21c5('0x30')]=_0x19d698[_0x21c5('0x30')][_0x21c5('0x43')]?_0x19d698[_0x21c5('0x30')]:_0x56547e[_0x21c5('0x2c')];if(_0x22af70[_0x21c5('0x2e')][_0x21c5('0x3c')]){_0x19d698[_0x21c5('0x3d')]=[{'all':!![]}];}_0x19d698=_['merge']({},_0x19d698,_0x22af70[_0x21c5('0x44')]);return db['SquareMessage'][_0x21c5('0x45')](_0x19d698)[_0x21c5('0x22')](handleEntityNotFound(_0x35693c,null))[_0x21c5('0x22')](respondWithResult(_0x35693c,null))[_0x21c5('0x40')](handleError(_0x35693c,null));};exports[_0x21c5('0x46')]=function(_0x24242a,_0x29e4d3){return db[_0x21c5('0x3b')][_0x21c5('0x46')](_0x24242a[_0x21c5('0x47')],{})[_0x21c5('0x22')](respondWithResult(_0x29e4d3,0xc9))[_0x21c5('0x40')](handleError(_0x29e4d3,null));};exports['update']=function(_0x5e4586,_0x5513c5){if(_0x5e4586[_0x21c5('0x47')]['id']){delete _0x5e4586[_0x21c5('0x47')]['id'];}return db[_0x21c5('0x3b')]['find']({'where':{'id':_0x5e4586[_0x21c5('0x41')]['id']}})[_0x21c5('0x22')](handleEntityNotFound(_0x5513c5,null))[_0x21c5('0x22')](saveUpdates(_0x5e4586['body'],null))['then'](respondWithResult(_0x5513c5,null))[_0x21c5('0x40')](handleError(_0x5513c5,null));};exports[_0x21c5('0x23')]=function(_0x3fa0c4,_0x2b3ebc){return db['SquareMessage'][_0x21c5('0x45')]({'where':{'id':_0x3fa0c4[_0x21c5('0x41')]['id']}})[_0x21c5('0x22')](handleEntityNotFound(_0x2b3ebc,null))[_0x21c5('0x22')](removeEntity(_0x2b3ebc,null))['catch'](handleError(_0x2b3ebc,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b31ed37..66bb8ad 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 _0x7faa=['bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment'];(function(_0x429be3,_0x15623f){var _0x1cf48d=function(_0x4765a1){while(--_0x4765a1){_0x429be3['push'](_0x429be3['shift']());}};_0x1cf48d(++_0x15623f);}(_0x7faa,0x19f));var _0xa7fa=function(_0x24c181,_0x41f9b3){_0x24c181=_0x24c181-0x0;var _0x47d688=_0x7faa[_0x24c181];return _0x47d688;};'use strict';var _=require(_0xa7fa('0x0'));var util=require(_0xa7fa('0x1'));var logger=require(_0xa7fa('0x2'))(_0xa7fa('0x3'));var moment=require(_0xa7fa('0x4'));var BPromise=require(_0xa7fa('0x5'));var rp=require(_0xa7fa('0x6'));var fs=require('fs');var path=require(_0xa7fa('0x7'));var rimraf=require(_0xa7fa('0x8'));var config=require(_0xa7fa('0x9'));var attributes=require(_0xa7fa('0xa'));module[_0xa7fa('0xb')]=function(_0x4caef2,_0x5260cb){return _0x4caef2[_0xa7fa('0xc')](_0xa7fa('0xd'),attributes,{'tableName':_0xa7fa('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d00=['../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','bluebird','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d00,0x1c7));var _0x06d0=function(_0x18ecae,_0x2bf366){_0x18ecae=_0x18ecae-0x0;var _0x2fe95b=_0x6d00[_0x18ecae];return _0x2fe95b;};'use strict';var _=require(_0x06d0('0x0'));var util=require(_0x06d0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x06d0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06d0('0x3'));var rimraf=require(_0x06d0('0x4'));var config=require(_0x06d0('0x5'));var attributes=require(_0x06d0('0x6'));module['exports']=function(_0x875730,_0x3f642e){return _0x875730[_0x06d0('0x7')](_0x06d0('0x8'),attributes,{'tableName':_0x06d0('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 ea2cdc2..b7b12a9 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 _0x000b=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','raw','then','lodash','util'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0x000b,0x1ae));var _0xb000=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x000b[_0xf16b1];return _0x26f94d;};'use strict';var _=require(_0xb000('0x0'));var util=require(_0xb000('0x1'));var moment=require(_0xb000('0x2'));var BPromise=require('bluebird');var rs=require(_0xb000('0x3'));var fs=require('fs');var Redis=require(_0xb000('0x4'));var db=require(_0xb000('0x5'))['db'];var utils=require(_0xb000('0x6'));var logger=require(_0xb000('0x7'))(_0xb000('0x8'));var config=require(_0xb000('0x9'));var jayson=require(_0xb000('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a387e,_0x3dc120,_0x5c6605){return new BPromise(function(_0x236e1d,_0x432d30){return client[_0xb000('0xb')](_0x5a387e,_0x5c6605)['then'](function(_0x2bd924){logger[_0xb000('0xc')](_0xb000('0xd'),_0x3dc120,_0xb000('0xe'));logger[_0xb000('0xf')](_0xb000('0x10'),_0x3dc120,_0xb000('0xe'),JSON[_0xb000('0x11')](_0x2bd924));if(_0x2bd924[_0xb000('0x12')]){if(_0x2bd924['error'][_0xb000('0x13')]===0x1f4){logger[_0xb000('0x12')](_0xb000('0xd'),_0x3dc120,_0x2bd924[_0xb000('0x12')][_0xb000('0x14')]);return _0x432d30(_0x2bd924[_0xb000('0x12')][_0xb000('0x14')]);}logger[_0xb000('0x12')](_0xb000('0xd'),_0x3dc120,_0x2bd924[_0xb000('0x12')]['message']);return _0x236e1d(_0x2bd924[_0xb000('0x12')][_0xb000('0x14')]);}else{logger[_0xb000('0xc')](_0xb000('0xd'),_0x3dc120,_0xb000('0xe'));_0x236e1d(_0x2bd924['result'][_0xb000('0x14')]);}})[_0xb000('0x15')](function(_0x3db6ef){logger[_0xb000('0x12')]('SquareMessage,\x20%s,\x20%s',_0x3dc120,_0x3db6ef);_0x432d30(_0x3db6ef);});});}exports[_0xb000('0x16')]=function(_0x3cbb47){var _0x1ea328=this;return new Promise(function(_0x29594e,_0x5c96a4){return db[_0xb000('0x17')][_0xb000('0x18')](_0x3cbb47['body'],{'raw':_0x3cbb47['options']?_0x3cbb47['options'][_0xb000('0x19')]===undefined?!![]:![]:!![]})[_0xb000('0x1a')](function(_0x9a18e){logger[_0xb000('0xc')](_0xb000('0x16'),_0x3cbb47);logger[_0xb000('0xf')]('CreateSquareMessage',_0x3cbb47,JSON[_0xb000('0x11')](_0x9a18e));_0x29594e(_0x9a18e);})[_0xb000('0x15')](function(_0x5a3e6b){logger[_0xb000('0x12')](_0xb000('0x16'),_0x5a3e6b[_0xb000('0x14')],_0x3cbb47);_0x5c96a4(_0x1ea328['error'](0x1f4,_0x5a3e6b['message']));});});}; \ No newline at end of file +var _0xa0eb=['result','catch','CreateSquareMessage','SquareMessage','create','options','raw','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3a2c03,_0x1f945a){var _0x4f6540=function(_0x435e48){while(--_0x435e48){_0x3a2c03['push'](_0x3a2c03['shift']());}};_0x4f6540(++_0x1f945a);}(_0xa0eb,0x1e3));var _0xba0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa0eb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xba0e('0x0'));var util=require(_0xba0e('0x1'));var moment=require('moment');var BPromise=require(_0xba0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xba0e('0x4'));var logger=require(_0xba0e('0x5'))(_0xba0e('0x6'));var config=require(_0xba0e('0x7'));var jayson=require(_0xba0e('0x8'));var client=jayson[_0xba0e('0x9')][_0xba0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21fa12,_0x571943,_0x5872be){return new BPromise(function(_0x575ff0,_0x5ccb46){return client[_0xba0e('0xb')](_0x21fa12,_0x5872be)[_0xba0e('0xc')](function(_0x115dc9){logger[_0xba0e('0xd')](_0xba0e('0xe'),_0x571943,_0xba0e('0xf'));logger[_0xba0e('0x10')](_0xba0e('0x11'),_0x571943,'request\x20sent',JSON[_0xba0e('0x12')](_0x115dc9));if(_0x115dc9[_0xba0e('0x13')]){if(_0x115dc9[_0xba0e('0x13')]['code']===0x1f4){logger[_0xba0e('0x13')](_0xba0e('0xe'),_0x571943,_0x115dc9[_0xba0e('0x13')][_0xba0e('0x14')]);return _0x5ccb46(_0x115dc9[_0xba0e('0x13')][_0xba0e('0x14')]);}logger[_0xba0e('0x13')](_0xba0e('0xe'),_0x571943,_0x115dc9['error'][_0xba0e('0x14')]);return _0x575ff0(_0x115dc9[_0xba0e('0x13')][_0xba0e('0x14')]);}else{logger['info'](_0xba0e('0xe'),_0x571943,_0xba0e('0xf'));_0x575ff0(_0x115dc9[_0xba0e('0x15')]['message']);}})[_0xba0e('0x16')](function(_0x5af7ad){logger['error'](_0xba0e('0xe'),_0x571943,_0x5af7ad);_0x5ccb46(_0x5af7ad);});});}exports[_0xba0e('0x17')]=function(_0x409171){var _0x55e4d3=this;return new Promise(function(_0x167803,_0x3a735b){return db[_0xba0e('0x18')][_0xba0e('0x19')](_0x409171['body'],{'raw':_0x409171[_0xba0e('0x1a')]?_0x409171[_0xba0e('0x1a')][_0xba0e('0x1b')]===undefined?!![]:![]:!![]})[_0xba0e('0xc')](function(_0x2db2b0){logger[_0xba0e('0xd')]('CreateSquareMessage',_0x409171);logger['debug'](_0xba0e('0x17'),_0x409171,JSON[_0xba0e('0x12')](_0x2db2b0));_0x167803(_0x2db2b0);})['catch'](function(_0x551cc6){logger['error'](_0xba0e('0x17'),_0x551cc6[_0xba0e('0x14')],_0x409171);_0x3a735b(_0x55e4d3[_0xba0e('0x13')](0x1f4,_0x551cc6[_0xba0e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 2f2b419..d691b4b 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 _0xbc15=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','/:id/test','15s','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x28eeca,_0x5cbe53){var _0x30c7d9=function(_0x28bc89){while(--_0x28bc89){_0x28eeca['push'](_0x28eeca['shift']());}};_0x30c7d9(++_0x5cbe53);}(_0xbc15,0xcd));var _0x5bc1=function(_0xadd044,_0x2444a4){_0xadd044=_0xadd044-0x0;var _0x2113de=_0xbc15[_0xadd044];return _0x2113de;};'use strict';var multer=require(_0x5bc1('0x0'));var util=require(_0x5bc1('0x1'));var path=require(_0x5bc1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5bc1('0x3')]();var fs_extra=require(_0x5bc1('0x4'));var auth=require(_0x5bc1('0x5'));var interaction=require(_0x5bc1('0x6'));var config=require(_0x5bc1('0x7'));var controller=require(_0x5bc1('0x8'));router[_0x5bc1('0x9')]('/',auth[_0x5bc1('0xa')](),controller['index']);router[_0x5bc1('0x9')](_0x5bc1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5bc1('0x9')](_0x5bc1('0xc'),auth[_0x5bc1('0xa')](),timeout(_0x5bc1('0xd')),controller['test']);router[_0x5bc1('0xe')]('/',auth[_0x5bc1('0xa')](),controller[_0x5bc1('0xf')]);router[_0x5bc1('0x10')](_0x5bc1('0xb'),auth[_0x5bc1('0xa')](),controller[_0x5bc1('0x11')]);router[_0x5bc1('0x12')](_0x5bc1('0xb'),auth['isAuthenticated'](),controller[_0x5bc1('0x13')]);module[_0x5bc1('0x14')]=router; \ No newline at end of file +var _0x42b1=['./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x42b1,0xbd));var _0x142b=function(_0x3c1e47,_0x327090){_0x3c1e47=_0x3c1e47-0x0;var _0x30aa3c=_0x42b1[_0x3c1e47];return _0x30aa3c;};'use strict';var multer=require(_0x142b('0x0'));var util=require(_0x142b('0x1'));var path=require('path');var timeout=require(_0x142b('0x2'));var express=require(_0x142b('0x3'));var router=express[_0x142b('0x4')]();var fs_extra=require(_0x142b('0x5'));var auth=require(_0x142b('0x6'));var interaction=require(_0x142b('0x7'));var config=require(_0x142b('0x8'));var controller=require(_0x142b('0x9'));router[_0x142b('0xa')]('/',auth[_0x142b('0xb')](),controller[_0x142b('0xc')]);router['get'](_0x142b('0xd'),auth[_0x142b('0xb')](),controller['show']);router['get'](_0x142b('0xe'),auth[_0x142b('0xb')](),timeout(_0x142b('0xf')),controller['test']);router[_0x142b('0x10')]('/',auth[_0x142b('0xb')](),controller[_0x142b('0x11')]);router[_0x142b('0x12')](_0x142b('0xd'),auth['isAuthenticated'](),controller[_0x142b('0x13')]);router[_0x142b('0x14')](_0x142b('0xd'),auth[_0x142b('0xb')](),controller['destroy']);module[_0x142b('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 461be5f..713e94f 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 _0x22f1=['exports','STRING','name','sequelize'];(function(_0x496fdc,_0x4c18aa){var _0x2deb1d=function(_0x5e6aa3){while(--_0x5e6aa3){_0x496fdc['push'](_0x496fdc['shift']());}};_0x2deb1d(++_0x4c18aa);}(_0x22f1,0xbb));var _0x122f=function(_0x518f54,_0x2d454d){_0x518f54=_0x518f54-0x0;var _0x2dae18=_0x22f1[_0x518f54];return _0x2dae18;};'use strict';var Sequelize=require(_0x122f('0x0'));module[_0x122f('0x1')]={'name':{'type':Sequelize[_0x122f('0x2')],'unique':_0x122f('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x122f('0x2')]},'description':{'type':Sequelize[_0x122f('0x2')]}}; \ No newline at end of file +var _0xed26=['sequelize','STRING','name'];(function(_0x32e4de,_0x7da1c5){var _0x51ba2a=function(_0x2a7322){while(--_0x2a7322){_0x32e4de['push'](_0x32e4de['shift']());}};_0x51ba2a(++_0x7da1c5);}(_0xed26,0x6c));var _0x6ed2=function(_0x14668c,_0x51edb0){_0x14668c=_0x14668c-0x0;var _0x47d86c=_0xed26[_0x14668c];return _0x47d86c;};'use strict';var Sequelize=require(_0x6ed2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ed2('0x1')],'unique':_0x6ed2('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6ed2('0x1')]},'description':{'type':Sequelize[_0x6ed2('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f18ad74..bae7df9 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 _0x5962=['name','send','index','map','SquareOdbc','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ODBC','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','get','destroy','end','error','stack'];(function(_0x18a46a,_0xb4df4b){var _0x590d2c=function(_0x24129e){while(--_0x24129e){_0x18a46a['push'](_0x18a46a['shift']());}};_0x590d2c(++_0xb4df4b);}(_0x5962,0x133));var _0x2596=function(_0xd63e3a,_0x1bd6eb){_0xd63e3a=_0xd63e3a-0x0;var _0x19c178=_0x5962[_0xd63e3a];return _0x19c178;};'use strict';var emlformat=require(_0x2596('0x0'));var rimraf=require(_0x2596('0x1'));var zipdir=require(_0x2596('0x2'));var jsonpatch=require(_0x2596('0x3'));var rp=require('request-promise');var moment=require(_0x2596('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2596('0x5'));var path=require(_0x2596('0x6'));var sox=require(_0x2596('0x7'));var csv=require(_0x2596('0x8'));var ejs=require(_0x2596('0x9'));var fs=require('fs');var fs_extra=require(_0x2596('0xa'));var _=require(_0x2596('0xb'));var squel=require(_0x2596('0xc'));var crypto=require(_0x2596('0xd'));var jsforce=require(_0x2596('0xe'));var deskjs=require(_0x2596('0xf'));var toCsv=require(_0x2596('0x8'));var querystring=require('querystring');var Papa=require(_0x2596('0x10'));var Redis=require('ioredis');var authService=require(_0x2596('0x11'));var qs=require(_0x2596('0x12'));var as=require(_0x2596('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2596('0x14'));var utils=require(_0x2596('0x15'));var config=require(_0x2596('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2596('0x17'))['db'];function respondWithStatusCode(_0x2daae1,_0x56cfb9){_0x56cfb9=_0x56cfb9||0xcc;return function(_0x6e5c11){if(_0x6e5c11){return _0x2daae1[_0x2596('0x18')](_0x56cfb9);}return _0x2daae1['status'](_0x56cfb9)['end']();};}function respondWithResult(_0x3561a8,_0x16b864){_0x16b864=_0x16b864||0xc8;return function(_0x3f3d17){if(_0x3f3d17){return _0x3561a8[_0x2596('0x19')](_0x16b864)['json'](_0x3f3d17);}};}function respondWithFilteredResult(_0x28fa52,_0x36ca30){return function(_0x16788f){if(_0x16788f){var _0x3ffb0e=typeof _0x36ca30[_0x2596('0x1a')]==='undefined'&&typeof _0x36ca30['limit']===_0x2596('0x1b');var _0x3c7660=_0x16788f[_0x2596('0x1c')];var _0x180cb3=_0x3ffb0e?0x0:_0x36ca30[_0x2596('0x1a')];var _0xdf595c=_0x3ffb0e?_0x16788f[_0x2596('0x1c')]:_0x36ca30[_0x2596('0x1a')]+_0x36ca30[_0x2596('0x1d')];var _0x19cb19;if(_0xdf595c>=_0x3c7660){_0xdf595c=_0x3c7660;_0x19cb19=0xc8;}else{_0x19cb19=0xce;}_0x28fa52['status'](_0x19cb19);return _0x28fa52[_0x2596('0x1e')](_0x2596('0x1f'),_0x180cb3+'-'+_0xdf595c+'/'+_0x3c7660)['json'](_0x16788f);}return null;};}function patchUpdates(_0x384e72){return function(_0x216b57){try{jsonpatch[_0x2596('0x20')](_0x216b57,_0x384e72,!![]);}catch(_0x244236){return BPromise[_0x2596('0x21')](_0x244236);}return _0x216b57['save']();};}function saveUpdates(_0xbddecc,_0xa0557c){return function(_0x27240c){if(_0x27240c){return _0x27240c[_0x2596('0x22')](_0xbddecc)['then'](function(_0x21f2af){return _0x21f2af;});}return null;};}function removeEntity(_0x5f3294,_0x1bf34d){return function(_0x50fb57){if(_0x50fb57){return _0x50fb57['destroy']()[_0x2596('0x23')](function(){var _0x27cfab=_0x50fb57[_0x2596('0x24')]({'plain':!![]});var _0x10042d='ODBC';return db['UserProfileResource'][_0x2596('0x25')]({'where':{'type':_0x10042d,'resourceId':_0x27cfab['id']}})[_0x2596('0x23')](function(){return _0x50fb57;});})['then'](function(){_0x5f3294[_0x2596('0x19')](0xcc)[_0x2596('0x26')]();});}};}function handleEntityNotFound(_0x1f2a58,_0x50ca37){return function(_0x26715f){if(!_0x26715f){_0x1f2a58['sendStatus'](0x194);}return _0x26715f;};}function handleError(_0x4a3fc9,_0x1f2829){_0x1f2829=_0x1f2829||0x1f4;return function(_0x3ce433){logger[_0x2596('0x27')](_0x3ce433[_0x2596('0x28')]);if(_0x3ce433[_0x2596('0x29')]){delete _0x3ce433[_0x2596('0x29')];}_0x4a3fc9['status'](_0x1f2829)[_0x2596('0x2a')](_0x3ce433);};}exports[_0x2596('0x2b')]=function(_0x4d1cff,_0x1aafec){var _0x4eaa99={},_0x4f676c={},_0xe4f010={'count':0x0,'rows':[]};var _0x372fbc=_[_0x2596('0x2c')](db[_0x2596('0x2d')]['rawAttributes'],function(_0x139854){return{'name':_0x139854[_0x2596('0x2e')],'type':_0x139854['type'][_0x2596('0x2f')]};});_0x4f676c[_0x2596('0x30')]=_['map'](_0x372fbc,_0x2596('0x29'));_0x4f676c['query']=_['keys'](_0x4d1cff[_0x2596('0x31')]);_0x4f676c['filters']=_[_0x2596('0x32')](_0x4f676c[_0x2596('0x30')],_0x4f676c[_0x2596('0x31')]);_0x4eaa99[_0x2596('0x33')]=_[_0x2596('0x32')](_0x4f676c[_0x2596('0x30')],qs[_0x2596('0x34')](_0x4d1cff[_0x2596('0x31')]['fields']));_0x4eaa99[_0x2596('0x33')]=_0x4eaa99[_0x2596('0x33')][_0x2596('0x35')]?_0x4eaa99['attributes']:_0x4f676c[_0x2596('0x30')];if(!_0x4d1cff[_0x2596('0x31')]['hasOwnProperty'](_0x2596('0x36'))){_0x4eaa99[_0x2596('0x1d')]=qs['limit'](_0x4d1cff['query']['limit']);_0x4eaa99[_0x2596('0x1a')]=qs[_0x2596('0x1a')](_0x4d1cff[_0x2596('0x31')]['offset']);}_0x4eaa99[_0x2596('0x37')]=qs[_0x2596('0x38')](_0x4d1cff[_0x2596('0x31')][_0x2596('0x38')]);_0x4eaa99['where']=qs[_0x2596('0x39')](_[_0x2596('0x3a')](_0x4d1cff[_0x2596('0x31')],_0x4f676c[_0x2596('0x39')]),_0x372fbc);if(_0x4d1cff[_0x2596('0x31')]['filter']){_0x4eaa99['where']=_['merge'](_0x4eaa99[_0x2596('0x3b')],{'$or':_['map'](_0x372fbc,function(_0x137818){if(_0x137818[_0x2596('0x3c')]!==_0x2596('0x3d')){var _0x50c921={};_0x50c921[_0x137818[_0x2596('0x29')]]={'$like':'%'+_0x4d1cff[_0x2596('0x31')]['filter']+'%'};return _0x50c921;}})});}_0x4eaa99=_[_0x2596('0x3e')]({},_0x4eaa99,_0x4d1cff[_0x2596('0x3f')]);var _0x4dab40={'where':_0x4eaa99[_0x2596('0x3b')]};return db[_0x2596('0x2d')][_0x2596('0x1c')](_0x4dab40)[_0x2596('0x23')](function(_0x4c2c31){_0xe4f010[_0x2596('0x1c')]=_0x4c2c31;if(_0x4d1cff[_0x2596('0x31')]['includeAll']){_0x4eaa99[_0x2596('0x40')]=[{'all':!![]}];}return db[_0x2596('0x2d')][_0x2596('0x41')](_0x4eaa99);})['then'](function(_0x3caf58){_0xe4f010[_0x2596('0x42')]=_0x3caf58;return _0xe4f010;})[_0x2596('0x23')](respondWithFilteredResult(_0x1aafec,_0x4eaa99))[_0x2596('0x43')](handleError(_0x1aafec,null));};exports[_0x2596('0x44')]=function(_0x4d7800,_0x14e93d){var _0x493739={'raw':!![],'where':{'id':_0x4d7800[_0x2596('0x45')]['id']}},_0x14005e={};_0x14005e[_0x2596('0x30')]=_[_0x2596('0x46')](db[_0x2596('0x2d')][_0x2596('0x47')]);_0x14005e[_0x2596('0x31')]=_[_0x2596('0x46')](_0x4d7800[_0x2596('0x31')]);_0x14005e[_0x2596('0x39')]=_['intersection'](_0x14005e[_0x2596('0x30')],_0x14005e[_0x2596('0x31')]);_0x493739['attributes']=_[_0x2596('0x32')](_0x14005e[_0x2596('0x30')],qs['fields'](_0x4d7800['query'][_0x2596('0x34')]));_0x493739[_0x2596('0x33')]=_0x493739[_0x2596('0x33')]['length']?_0x493739[_0x2596('0x33')]:_0x14005e[_0x2596('0x30')];if(_0x4d7800['query'][_0x2596('0x48')]){_0x493739['include']=[{'all':!![]}];}_0x493739=_[_0x2596('0x3e')]({},_0x493739,_0x4d7800[_0x2596('0x3f')]);return db[_0x2596('0x2d')][_0x2596('0x49')](_0x493739)[_0x2596('0x23')](handleEntityNotFound(_0x14e93d,null))[_0x2596('0x23')](respondWithResult(_0x14e93d,null))['catch'](handleError(_0x14e93d,null));};exports[_0x2596('0x4a')]=function(_0x1436c6,_0x2f842f){return db[_0x2596('0x2d')][_0x2596('0x4a')](_0x1436c6[_0x2596('0x4b')],{})[_0x2596('0x23')](function(_0x6c8856){var _0x166a3e=_0x1436c6['user'][_0x2596('0x24')]({'plain':!![]});if(!_0x166a3e)throw new Error(_0x2596('0x4c'));if(_0x166a3e['role']===_0x2596('0x4d')){var _0x18b5b4=_0x6c8856[_0x2596('0x24')]({'plain':!![]});var _0x5c089c=_0x2596('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x5c089c,'userProfileId':_0x166a3e[_0x2596('0x4f')]},'raw':!![]})[_0x2596('0x23')](function(_0x8f5742){if(_0x8f5742&&_0x8f5742[_0x2596('0x50')]===0x0){return db[_0x2596('0x51')][_0x2596('0x4a')]({'name':_0x18b5b4[_0x2596('0x29')],'resourceId':_0x18b5b4['id'],'type':_0x8f5742['name'],'sectionId':_0x8f5742['id']},{})[_0x2596('0x23')](function(){return _0x6c8856;});}else{return _0x6c8856;}})[_0x2596('0x43')](function(_0x4dc5fa){logger[_0x2596('0x27')](_0x2596('0x52'),_0x4dc5fa);throw _0x4dc5fa;});}return _0x6c8856;})[_0x2596('0x23')](respondWithResult(_0x2f842f,0xc9))[_0x2596('0x43')](handleError(_0x2f842f,null));};exports[_0x2596('0x22')]=function(_0x2ae488,_0x269e8e){if(_0x2ae488[_0x2596('0x4b')]['id']){delete _0x2ae488[_0x2596('0x4b')]['id'];}return db[_0x2596('0x2d')][_0x2596('0x49')]({'where':{'id':_0x2ae488['params']['id']}})[_0x2596('0x23')](handleEntityNotFound(_0x269e8e,null))[_0x2596('0x23')](saveUpdates(_0x2ae488[_0x2596('0x4b')],null))['then'](respondWithResult(_0x269e8e,null))['catch'](handleError(_0x269e8e,null));};exports['destroy']=function(_0x33d5c9,_0x1b52a8){return db[_0x2596('0x2d')][_0x2596('0x49')]({'where':{'id':_0x33d5c9['params']['id']}})[_0x2596('0x23')](handleEntityNotFound(_0x1b52a8,null))[_0x2596('0x23')](removeEntity(_0x1b52a8,null))['catch'](handleError(_0x1b52a8,null));};exports['test']=function(_0x504a4c,_0x126ee5,_0x9165e3){var _0x164ab1;return db[_0x2596('0x2d')][_0x2596('0x49')]({'where':{'id':_0x504a4c[_0x2596('0x45')]['id']},'attributes':['id','dsn']})[_0x2596('0x23')](handleEntityNotFound(_0x126ee5,null))[_0x2596('0x23')](function(_0x16a6b2){if(_0x16a6b2){var _0x42077f=require(_0x2596('0x53'))();_0x42077f[_0x2596('0x54')](_0x16a6b2[_0x2596('0x55')]);_0x42077f[_0x2596('0x56')]();return _0x16a6b2;}})[_0x2596('0x23')](respondWithResult(_0x126ee5,null))[_0x2596('0x43')](handleError(_0x126ee5,null));}; \ No newline at end of file +var _0x6a4d=['limit','offset','set','Content-Range','save','destroy','get','then','error','stack','name','send','map','SquareOdbc','fieldName','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','include','findAll','catch','show','keys','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ODBC','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x514460,_0x2f2e70){var _0x3b67c1=function(_0x48ea04){while(--_0x48ea04){_0x514460['push'](_0x514460['shift']());}};_0x3b67c1(++_0x2f2e70);}(_0x6a4d,0x141));var _0xd6a4=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x6a4d[_0x31cb5f];return _0x586042;};'use strict';var emlformat=require(_0xd6a4('0x0'));var rimraf=require(_0xd6a4('0x1'));var zipdir=require(_0xd6a4('0x2'));var jsonpatch=require(_0xd6a4('0x3'));var rp=require('request-promise');var moment=require(_0xd6a4('0x4'));var BPromise=require(_0xd6a4('0x5'));var Mustache=require('mustache');var util=require(_0xd6a4('0x6'));var path=require(_0xd6a4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd6a4('0x8'));var fs=require('fs');var fs_extra=require(_0xd6a4('0x9'));var _=require(_0xd6a4('0xa'));var squel=require(_0xd6a4('0xb'));var crypto=require(_0xd6a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd6a4('0xd'));var toCsv=require(_0xd6a4('0xe'));var querystring=require(_0xd6a4('0xf'));var Papa=require(_0xd6a4('0x10'));var Redis=require(_0xd6a4('0x11'));var authService=require(_0xd6a4('0x12'));var qs=require(_0xd6a4('0x13'));var as=require(_0xd6a4('0x14'));var hardwareService=require(_0xd6a4('0x15'));var logger=require('../../config/logger')(_0xd6a4('0x16'));var utils=require(_0xd6a4('0x17'));var config=require(_0xd6a4('0x18'));var licenseUtil=require(_0xd6a4('0x19'));var db=require(_0xd6a4('0x1a'))['db'];function respondWithStatusCode(_0x43076b,_0x2b50df){_0x2b50df=_0x2b50df||0xcc;return function(_0x2eda29){if(_0x2eda29){return _0x43076b['sendStatus'](_0x2b50df);}return _0x43076b[_0xd6a4('0x1b')](_0x2b50df)[_0xd6a4('0x1c')]();};}function respondWithResult(_0x3ae3a4,_0x1e3f7e){_0x1e3f7e=_0x1e3f7e||0xc8;return function(_0x566e81){if(_0x566e81){return _0x3ae3a4[_0xd6a4('0x1b')](_0x1e3f7e)[_0xd6a4('0x1d')](_0x566e81);}};}function respondWithFilteredResult(_0x24eedd,_0x4f98f6){return function(_0x5891d8){if(_0x5891d8){var _0x5883fe=typeof _0x4f98f6['offset']===_0xd6a4('0x1e')&&typeof _0x4f98f6[_0xd6a4('0x1f')]===_0xd6a4('0x1e');var _0x2bd499=_0x5891d8['count'];var _0x5ca04c=_0x5883fe?0x0:_0x4f98f6[_0xd6a4('0x20')];var _0x49c0f9=_0x5883fe?_0x5891d8['count']:_0x4f98f6[_0xd6a4('0x20')]+_0x4f98f6['limit'];var _0x2975af;if(_0x49c0f9>=_0x2bd499){_0x49c0f9=_0x2bd499;_0x2975af=0xc8;}else{_0x2975af=0xce;}_0x24eedd[_0xd6a4('0x1b')](_0x2975af);return _0x24eedd[_0xd6a4('0x21')](_0xd6a4('0x22'),_0x5ca04c+'-'+_0x49c0f9+'/'+_0x2bd499)[_0xd6a4('0x1d')](_0x5891d8);}return null;};}function patchUpdates(_0x5b4862){return function(_0x4ad4b4){try{jsonpatch['apply'](_0x4ad4b4,_0x5b4862,!![]);}catch(_0x4b3eb2){return BPromise['reject'](_0x4b3eb2);}return _0x4ad4b4[_0xd6a4('0x23')]();};}function saveUpdates(_0x3e6855,_0xbf73cf){return function(_0x4425d6){if(_0x4425d6){return _0x4425d6['update'](_0x3e6855)['then'](function(_0x2286c5){return _0x2286c5;});}return null;};}function removeEntity(_0x4aaa7e,_0x545bac){return function(_0x463011){if(_0x463011){return _0x463011[_0xd6a4('0x24')]()['then'](function(){var _0x2e60e1=_0x463011[_0xd6a4('0x25')]({'plain':!![]});var _0x2d4263='ODBC';return db['UserProfileResource'][_0xd6a4('0x24')]({'where':{'type':_0x2d4263,'resourceId':_0x2e60e1['id']}})[_0xd6a4('0x26')](function(){return _0x463011;});})[_0xd6a4('0x26')](function(){_0x4aaa7e['status'](0xcc)[_0xd6a4('0x1c')]();});}};}function handleEntityNotFound(_0x261c9e,_0x14ef98){return function(_0x2f69bf){if(!_0x2f69bf){_0x261c9e['sendStatus'](0x194);}return _0x2f69bf;};}function handleError(_0x256318,_0x25e55e){_0x25e55e=_0x25e55e||0x1f4;return function(_0x10c81b){logger[_0xd6a4('0x27')](_0x10c81b[_0xd6a4('0x28')]);if(_0x10c81b['name']){delete _0x10c81b[_0xd6a4('0x29')];}_0x256318[_0xd6a4('0x1b')](_0x25e55e)[_0xd6a4('0x2a')](_0x10c81b);};}exports['index']=function(_0x53a8b2,_0x558991){var _0x45a4fb={},_0x13fcec={},_0x2593c1={'count':0x0,'rows':[]};var _0x104121=_[_0xd6a4('0x2b')](db[_0xd6a4('0x2c')]['rawAttributes'],function(_0x188dc6){return{'name':_0x188dc6[_0xd6a4('0x2d')],'type':_0x188dc6[_0xd6a4('0x2e')]['key']};});_0x13fcec[_0xd6a4('0x2f')]=_[_0xd6a4('0x2b')](_0x104121,_0xd6a4('0x29'));_0x13fcec[_0xd6a4('0x30')]=_['keys'](_0x53a8b2[_0xd6a4('0x30')]);_0x13fcec[_0xd6a4('0x31')]=_[_0xd6a4('0x32')](_0x13fcec['model'],_0x13fcec[_0xd6a4('0x30')]);_0x45a4fb['attributes']=_[_0xd6a4('0x32')](_0x13fcec[_0xd6a4('0x2f')],qs['fields'](_0x53a8b2['query'][_0xd6a4('0x33')]));_0x45a4fb['attributes']=_0x45a4fb['attributes'][_0xd6a4('0x34')]?_0x45a4fb[_0xd6a4('0x35')]:_0x13fcec['model'];if(!_0x53a8b2[_0xd6a4('0x30')][_0xd6a4('0x36')](_0xd6a4('0x37'))){_0x45a4fb['limit']=qs[_0xd6a4('0x1f')](_0x53a8b2[_0xd6a4('0x30')][_0xd6a4('0x1f')]);_0x45a4fb[_0xd6a4('0x20')]=qs['offset'](_0x53a8b2[_0xd6a4('0x30')]['offset']);}_0x45a4fb[_0xd6a4('0x38')]=qs[_0xd6a4('0x39')](_0x53a8b2['query'][_0xd6a4('0x39')]);_0x45a4fb[_0xd6a4('0x3a')]=qs['filters'](_[_0xd6a4('0x3b')](_0x53a8b2[_0xd6a4('0x30')],_0x13fcec[_0xd6a4('0x31')]),_0x104121);if(_0x53a8b2['query']['filter']){_0x45a4fb[_0xd6a4('0x3a')]=_['merge'](_0x45a4fb[_0xd6a4('0x3a')],{'$or':_[_0xd6a4('0x2b')](_0x104121,function(_0x45a455){if(_0x45a455[_0xd6a4('0x2e')]!==_0xd6a4('0x3c')){var _0x8dd63d={};_0x8dd63d[_0x45a455[_0xd6a4('0x29')]]={'$like':'%'+_0x53a8b2[_0xd6a4('0x30')][_0xd6a4('0x3d')]+'%'};return _0x8dd63d;}})});}_0x45a4fb=_[_0xd6a4('0x3e')]({},_0x45a4fb,_0x53a8b2[_0xd6a4('0x3f')]);var _0x11d0a4={'where':_0x45a4fb[_0xd6a4('0x3a')]};return db['SquareOdbc'][_0xd6a4('0x40')](_0x11d0a4)[_0xd6a4('0x26')](function(_0x33a395){_0x2593c1['count']=_0x33a395;if(_0x53a8b2[_0xd6a4('0x30')]['includeAll']){_0x45a4fb[_0xd6a4('0x41')]=[{'all':!![]}];}return db[_0xd6a4('0x2c')][_0xd6a4('0x42')](_0x45a4fb);})[_0xd6a4('0x26')](function(_0x5f1540){_0x2593c1['rows']=_0x5f1540;return _0x2593c1;})['then'](respondWithFilteredResult(_0x558991,_0x45a4fb))[_0xd6a4('0x43')](handleError(_0x558991,null));};exports[_0xd6a4('0x44')]=function(_0x3de053,_0x571887){var _0x4d41ae={'raw':!![],'where':{'id':_0x3de053['params']['id']}},_0x59216c={};_0x59216c[_0xd6a4('0x2f')]=_[_0xd6a4('0x45')](db[_0xd6a4('0x2c')][_0xd6a4('0x46')]);_0x59216c[_0xd6a4('0x30')]=_['keys'](_0x3de053['query']);_0x59216c[_0xd6a4('0x31')]=_[_0xd6a4('0x32')](_0x59216c[_0xd6a4('0x2f')],_0x59216c[_0xd6a4('0x30')]);_0x4d41ae[_0xd6a4('0x35')]=_['intersection'](_0x59216c[_0xd6a4('0x2f')],qs[_0xd6a4('0x33')](_0x3de053[_0xd6a4('0x30')]['fields']));_0x4d41ae[_0xd6a4('0x35')]=_0x4d41ae[_0xd6a4('0x35')][_0xd6a4('0x34')]?_0x4d41ae[_0xd6a4('0x35')]:_0x59216c['model'];if(_0x3de053[_0xd6a4('0x30')][_0xd6a4('0x47')]){_0x4d41ae[_0xd6a4('0x41')]=[{'all':!![]}];}_0x4d41ae=_[_0xd6a4('0x3e')]({},_0x4d41ae,_0x3de053[_0xd6a4('0x3f')]);return db['SquareOdbc'][_0xd6a4('0x48')](_0x4d41ae)[_0xd6a4('0x26')](handleEntityNotFound(_0x571887,null))[_0xd6a4('0x26')](respondWithResult(_0x571887,null))[_0xd6a4('0x43')](handleError(_0x571887,null));};exports[_0xd6a4('0x49')]=function(_0x1cdd46,_0xb483c){return db[_0xd6a4('0x2c')][_0xd6a4('0x49')](_0x1cdd46[_0xd6a4('0x4a')],{})[_0xd6a4('0x26')](function(_0x4075dd){var _0x275bbf=_0x1cdd46['user'][_0xd6a4('0x25')]({'plain':!![]});if(!_0x275bbf)throw new Error(_0xd6a4('0x4b'));if(_0x275bbf[_0xd6a4('0x4c')]===_0xd6a4('0x4d')){var _0x445cde=_0x4075dd[_0xd6a4('0x25')]({'plain':!![]});var _0x323676=_0xd6a4('0x4e');return db[_0xd6a4('0x4f')][_0xd6a4('0x48')]({'where':{'name':_0x323676,'userProfileId':_0x275bbf[_0xd6a4('0x50')]},'raw':!![]})[_0xd6a4('0x26')](function(_0xd69550){if(_0xd69550&&_0xd69550['autoAssociation']===0x0){return db['UserProfileResource'][_0xd6a4('0x49')]({'name':_0x445cde[_0xd6a4('0x29')],'resourceId':_0x445cde['id'],'type':_0xd69550['name'],'sectionId':_0xd69550['id']},{})[_0xd6a4('0x26')](function(){return _0x4075dd;});}else{return _0x4075dd;}})['catch'](function(_0x111ba8){logger[_0xd6a4('0x27')](_0xd6a4('0x51'),_0x111ba8);throw _0x111ba8;});}return _0x4075dd;})[_0xd6a4('0x26')](respondWithResult(_0xb483c,0xc9))['catch'](handleError(_0xb483c,null));};exports[_0xd6a4('0x52')]=function(_0x413a8f,_0xaa367){if(_0x413a8f[_0xd6a4('0x4a')]['id']){delete _0x413a8f['body']['id'];}return db[_0xd6a4('0x2c')][_0xd6a4('0x48')]({'where':{'id':_0x413a8f[_0xd6a4('0x53')]['id']}})[_0xd6a4('0x26')](handleEntityNotFound(_0xaa367,null))[_0xd6a4('0x26')](saveUpdates(_0x413a8f[_0xd6a4('0x4a')],null))[_0xd6a4('0x26')](respondWithResult(_0xaa367,null))[_0xd6a4('0x43')](handleError(_0xaa367,null));};exports[_0xd6a4('0x24')]=function(_0x38b7b4,_0x432473){return db[_0xd6a4('0x2c')]['find']({'where':{'id':_0x38b7b4[_0xd6a4('0x53')]['id']}})[_0xd6a4('0x26')](handleEntityNotFound(_0x432473,null))[_0xd6a4('0x26')](removeEntity(_0x432473,null))['catch'](handleError(_0x432473,null));};exports[_0xd6a4('0x54')]=function(_0xddaf38,_0x983990,_0x34cc08){var _0x16c43d;return db[_0xd6a4('0x2c')][_0xd6a4('0x48')]({'where':{'id':_0xddaf38[_0xd6a4('0x53')]['id']},'attributes':['id',_0xd6a4('0x55')]})[_0xd6a4('0x26')](handleEntityNotFound(_0x983990,null))['then'](function(_0x537fc){if(_0x537fc){var _0x2d805c=require(_0xd6a4('0x56'))();_0x2d805c[_0xd6a4('0x57')](_0x537fc[_0xd6a4('0x55')]);_0x2d805c['closeSync']();return _0x537fc;}})[_0xd6a4('0x26')](respondWithResult(_0x983990,null))['catch'](handleError(_0x983990,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c01b46e..8baef20 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 _0x2edb=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x4c35fa,_0xb87ad0){var _0x518179=function(_0x583131){while(--_0x583131){_0x4c35fa['push'](_0x4c35fa['shift']());}};_0x518179(++_0xb87ad0);}(_0x2edb,0x99));var _0xb2ed=function(_0x2f6c3e,_0x579279){_0x2f6c3e=_0x2f6c3e-0x0;var _0x5bd3b0=_0x2edb[_0x2f6c3e];return _0x5bd3b0;};'use strict';var _=require(_0xb2ed('0x0'));var util=require('util');var logger=require(_0xb2ed('0x1'))(_0xb2ed('0x2'));var moment=require(_0xb2ed('0x3'));var BPromise=require('bluebird');var rp=require(_0xb2ed('0x4'));var fs=require('fs');var path=require(_0xb2ed('0x5'));var rimraf=require(_0xb2ed('0x6'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xb2ed('0x7')]=function(_0x45fa13,_0x5f235c){return _0x45fa13[_0xb2ed('0x8')](_0xb2ed('0x9'),attributes,{'tableName':_0xb2ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x063e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0xe29419,_0x5ef504){var _0xe9260a=function(_0x2dea26){while(--_0x2dea26){_0xe29419['push'](_0xe29419['shift']());}};_0xe9260a(++_0x5ef504);}(_0x063e,0x194));var _0xe063=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x063e[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xe063('0x0'));var util=require(_0xe063('0x1'));var logger=require(_0xe063('0x2'))(_0xe063('0x3'));var moment=require(_0xe063('0x4'));var BPromise=require(_0xe063('0x5'));var rp=require(_0xe063('0x6'));var fs=require('fs');var path=require(_0xe063('0x7'));var rimraf=require(_0xe063('0x8'));var config=require(_0xe063('0x9'));var attributes=require(_0xe063('0xa'));module[_0xe063('0xb')]=function(_0x3deaa2,_0x3239fa){return _0x3deaa2[_0xe063('0xc')](_0xe063('0xd'),attributes,{'tableName':_0xe063('0xe'),'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 ac382f8..9ab3a34 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 _0xb6da=['SquareOdbc','find','options','where','attributes','include','map','model','then','ShowSquareOdbc','debug','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xb6da,0x10b));var _0xab6d=function(_0x1aa7f4,_0x1e2351){_0x1aa7f4=_0x1aa7f4-0x0;var _0x2fb04a=_0xb6da[_0x1aa7f4];return _0x2fb04a;};'use strict';var _=require(_0xab6d('0x0'));var util=require(_0xab6d('0x1'));var moment=require(_0xab6d('0x2'));var BPromise=require(_0xab6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab6d('0x4'));var logger=require('../../config/logger')(_0xab6d('0x5'));var config=require(_0xab6d('0x6'));var jayson=require(_0xab6d('0x7'));var client=jayson[_0xab6d('0x8')][_0xab6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f5a77,_0x40cf1a,_0x33f5a5){return new BPromise(function(_0x2f1b5f,_0x1d211d){return client[_0xab6d('0xa')](_0x1f5a77,_0x33f5a5)['then'](function(_0x46bc6a){logger[_0xab6d('0xb')](_0xab6d('0xc'),_0x40cf1a,_0xab6d('0xd'));logger['debug'](_0xab6d('0xe'),_0x40cf1a,_0xab6d('0xd'),JSON[_0xab6d('0xf')](_0x46bc6a));if(_0x46bc6a[_0xab6d('0x10')]){if(_0x46bc6a[_0xab6d('0x10')][_0xab6d('0x11')]===0x1f4){logger['error'](_0xab6d('0xc'),_0x40cf1a,_0x46bc6a['error'][_0xab6d('0x12')]);return _0x1d211d(_0x46bc6a['error'][_0xab6d('0x12')]);}logger[_0xab6d('0x10')](_0xab6d('0xc'),_0x40cf1a,_0x46bc6a[_0xab6d('0x10')][_0xab6d('0x12')]);return _0x2f1b5f(_0x46bc6a[_0xab6d('0x10')]['message']);}else{logger['info'](_0xab6d('0xc'),_0x40cf1a,'request\x20sent');_0x2f1b5f(_0x46bc6a[_0xab6d('0x13')]['message']);}})[_0xab6d('0x14')](function(_0x7ef173){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x40cf1a,_0x7ef173);_0x1d211d(_0x7ef173);});});}exports['ShowSquareOdbc']=function(_0x174f9e){var _0x6897b9=this;return new Promise(function(_0x4221d3,_0x5f4bc8){return db[_0xab6d('0x15')][_0xab6d('0x16')]({'raw':_0x174f9e['options']?_0x174f9e['options']['raw']===undefined?!![]:![]:!![],'where':_0x174f9e[_0xab6d('0x17')]?_0x174f9e[_0xab6d('0x17')][_0xab6d('0x18')]||null:null,'attributes':_0x174f9e[_0xab6d('0x17')]?_0x174f9e[_0xab6d('0x17')][_0xab6d('0x19')]||null:null,'include':_0x174f9e[_0xab6d('0x17')]?_0x174f9e[_0xab6d('0x17')][_0xab6d('0x1a')]?_[_0xab6d('0x1b')](_0x174f9e[_0xab6d('0x17')]['include'],function(_0x544e77){return{'model':db[_0x544e77[_0xab6d('0x1c')]],'as':_0x544e77['as'],'attributes':_0x544e77['attributes'],'include':_0x544e77['include']?_['map'](_0x544e77[_0xab6d('0x1a')],function(_0x5e3ab0){return{'model':db[_0x5e3ab0[_0xab6d('0x1c')]],'as':_0x5e3ab0['as'],'attributes':_0x5e3ab0[_0xab6d('0x19')],'include':_0x5e3ab0['include']?_[_0xab6d('0x1b')](_0x5e3ab0[_0xab6d('0x1a')],function(_0x1408cd){return{'model':db[_0x1408cd[_0xab6d('0x1c')]],'as':_0x1408cd['as'],'attributes':_0x1408cd['attributes']};}):[]};}):[]};}):[]:[]})[_0xab6d('0x1d')](function(_0x1c67f1){logger['info'](_0xab6d('0x1e'),_0x174f9e);logger[_0xab6d('0x1f')](_0xab6d('0x1e'),_0x174f9e,JSON[_0xab6d('0xf')](_0x1c67f1));_0x4221d3(_0x1c67f1);})[_0xab6d('0x14')](function(_0x32a260){logger[_0xab6d('0x10')](_0xab6d('0x1e'),_0x32a260[_0xab6d('0x12')],_0x174f9e);_0x5f4bc8(_0x6897b9[_0xab6d('0x10')](0x1f4,_0x32a260[_0xab6d('0x12')]));});});}; \ No newline at end of file +var _0x877b=['error','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x877b,0xa9));var _0xb877=function(_0x3c74b3,_0x53645f){_0x3c74b3=_0x3c74b3-0x0;var _0x2250a2=_0x877b[_0x3c74b3];return _0x2250a2;};'use strict';var _=require(_0xb877('0x0'));var util=require(_0xb877('0x1'));var moment=require(_0xb877('0x2'));var BPromise=require(_0xb877('0x3'));var rs=require(_0xb877('0x4'));var fs=require('fs');var Redis=require(_0xb877('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb877('0x6'));var logger=require(_0xb877('0x7'))(_0xb877('0x8'));var config=require('../../config/environment');var jayson=require(_0xb877('0x9'));var client=jayson['client'][_0xb877('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aff44,_0x26ee63,_0x559932){return new BPromise(function(_0x12cdb1,_0x40ecd8){return client['request'](_0x3aff44,_0x559932)[_0xb877('0xb')](function(_0x5ef230){logger[_0xb877('0xc')](_0xb877('0xd'),_0x26ee63,_0xb877('0xe'));logger[_0xb877('0xf')](_0xb877('0x10'),_0x26ee63,'request\x20sent',JSON['stringify'](_0x5ef230));if(_0x5ef230['error']){if(_0x5ef230[_0xb877('0x11')]['code']===0x1f4){logger[_0xb877('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x26ee63,_0x5ef230[_0xb877('0x11')][_0xb877('0x12')]);return _0x40ecd8(_0x5ef230[_0xb877('0x11')][_0xb877('0x12')]);}logger[_0xb877('0x11')](_0xb877('0xd'),_0x26ee63,_0x5ef230['error'][_0xb877('0x12')]);return _0x12cdb1(_0x5ef230[_0xb877('0x11')]['message']);}else{logger[_0xb877('0xc')](_0xb877('0xd'),_0x26ee63,_0xb877('0xe'));_0x12cdb1(_0x5ef230[_0xb877('0x13')][_0xb877('0x12')]);}})[_0xb877('0x14')](function(_0x147750){logger[_0xb877('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x26ee63,_0x147750);_0x40ecd8(_0x147750);});});}exports[_0xb877('0x15')]=function(_0x3cc706){var _0x1dc5ef=this;return new Promise(function(_0x24f3b2,_0x28b4fa){return db['SquareOdbc'][_0xb877('0x16')]({'raw':_0x3cc706[_0xb877('0x17')]?_0x3cc706[_0xb877('0x17')][_0xb877('0x18')]===undefined?!![]:![]:!![],'where':_0x3cc706['options']?_0x3cc706[_0xb877('0x17')][_0xb877('0x19')]||null:null,'attributes':_0x3cc706[_0xb877('0x17')]?_0x3cc706['options'][_0xb877('0x1a')]||null:null,'include':_0x3cc706[_0xb877('0x17')]?_0x3cc706[_0xb877('0x17')][_0xb877('0x1b')]?_['map'](_0x3cc706['options'][_0xb877('0x1b')],function(_0x3ea19a){return{'model':db[_0x3ea19a[_0xb877('0x1c')]],'as':_0x3ea19a['as'],'attributes':_0x3ea19a[_0xb877('0x1a')],'include':_0x3ea19a[_0xb877('0x1b')]?_[_0xb877('0x1d')](_0x3ea19a[_0xb877('0x1b')],function(_0x57fee7){return{'model':db[_0x57fee7[_0xb877('0x1c')]],'as':_0x57fee7['as'],'attributes':_0x57fee7[_0xb877('0x1a')],'include':_0x57fee7[_0xb877('0x1b')]?_['map'](_0x57fee7[_0xb877('0x1b')],function(_0x3102ff){return{'model':db[_0x3102ff['model']],'as':_0x3102ff['as'],'attributes':_0x3102ff[_0xb877('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb877('0xb')](function(_0xb0c85e){logger[_0xb877('0xc')](_0xb877('0x15'),_0x3cc706);logger[_0xb877('0xf')](_0xb877('0x15'),_0x3cc706,JSON[_0xb877('0x1e')](_0xb0c85e));_0x24f3b2(_0xb0c85e);})[_0xb877('0x14')](function(_0x24c20f){logger[_0xb877('0x11')](_0xb877('0x15'),_0x24c20f[_0xb877('0x12')],_0x3cc706);_0x28b4fa(_0x1dc5ef[_0xb877('0x11')](0x1f4,_0x24c20f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 6344329..3622546 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 _0xed4c=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','/:id','update','delete','destroy'];(function(_0x2375e9,_0x5df69a){var _0x5d7919=function(_0x4ccba9){while(--_0x4ccba9){_0x2375e9['push'](_0x2375e9['shift']());}};_0x5d7919(++_0x5df69a);}(_0xed4c,0x188));var _0xced4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed4c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xced4('0x0'));var util=require(_0xced4('0x1'));var path=require(_0xced4('0x2'));var timeout=require(_0xced4('0x3'));var express=require(_0xced4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xced4('0x5'));var interaction=require(_0xced4('0x6'));var config=require(_0xced4('0x7'));var controller=require('./squareProject.controller');router[_0xced4('0x8')]('/',auth[_0xced4('0x9')](),controller['index']);router[_0xced4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xced4('0xa')]);router['post']('/',auth[_0xced4('0x9')](),controller[_0xced4('0xb')]);router['put'](_0xced4('0xc'),auth[_0xced4('0x9')](),controller[_0xced4('0xd')]);router[_0xced4('0xe')](_0xced4('0xc'),auth[_0xced4('0x9')](),controller[_0xced4('0xf')]);module[_0xced4('0x10')]=router; \ No newline at end of file +var _0x6878=['create','update','delete','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show'];(function(_0x5cd846,_0x186e21){var _0x138fa3=function(_0x507acd){while(--_0x507acd){_0x5cd846['push'](_0x5cd846['shift']());}};_0x138fa3(++_0x186e21);}(_0x6878,0x148));var _0x8687=function(_0x4a3484,_0xe07a66){_0x4a3484=_0x4a3484-0x0;var _0x1113b1=_0x6878[_0x4a3484];return _0x1113b1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8687('0x0'));var express=require(_0x8687('0x1'));var router=express['Router']();var fs_extra=require(_0x8687('0x2'));var auth=require(_0x8687('0x3'));var interaction=require(_0x8687('0x4'));var config=require(_0x8687('0x5'));var controller=require(_0x8687('0x6'));router['get']('/',auth[_0x8687('0x7')](),controller[_0x8687('0x8')]);router[_0x8687('0x9')](_0x8687('0xa'),auth['isAuthenticated'](),controller[_0x8687('0xb')]);router['post']('/',auth[_0x8687('0x7')](),controller[_0x8687('0xc')]);router['put'](_0x8687('0xa'),auth[_0x8687('0x7')](),controller[_0x8687('0xd')]);router[_0x8687('0xe')](_0x8687('0xa'),auth[_0x8687('0x7')](),controller[_0x8687('0xf')]);module[_0x8687('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 87f364d..8a0fb94 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 _0x09cb=['DATE','sequelize','name','STRING','TEXT','BLOB','long','preproduction','utf8','production','toString'];(function(_0x2c10d7,_0x34cd9c){var _0xa56912=function(_0x56dfa0){while(--_0x56dfa0){_0x2c10d7['push'](_0x2c10d7['shift']());}};_0xa56912(++_0x34cd9c);}(_0x09cb,0xdd));var _0xb09c=function(_0x29d352,_0x34c666){_0x29d352=_0x29d352-0x0;var _0x2a432c=_0x09cb[_0x29d352];return _0x2a432c;};'use strict';var Sequelize=require(_0xb09c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb09c('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb09c('0x2')]},'notes':{'type':Sequelize[_0xb09c('0x3')]},'preproduction':{'type':Sequelize[_0xb09c('0x4')](_0xb09c('0x5')),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0xb09c('0x6'))['toString'](_0xb09c('0x7'));}}},'production':{'type':Sequelize[_0xb09c('0x4')]('long'),'get':function(){if(this['getDataValue'](_0xb09c('0x8'))){return this['getDataValue']('production')[_0xb09c('0x9')](_0xb09c('0x7'));}}},'savedAt':{'type':Sequelize[_0xb09c('0xa')]},'publishedAt':{'type':Sequelize[_0xb09c('0xa')]}}; \ No newline at end of file +var _0xebc4=['STRING','name','BLOB','long','getDataValue','toString','production','utf8','DATE','exports'];(function(_0x560ae1,_0x25e921){var _0x2636fa=function(_0x5df0e0){while(--_0x5df0e0){_0x560ae1['push'](_0x560ae1['shift']());}};_0x2636fa(++_0x25e921);}(_0xebc4,0xf9));var _0x4ebc=function(_0x28149d,_0x3f3ba6){_0x28149d=_0x28149d-0x0;var _0x38236d=_0xebc4[_0x28149d];return _0x38236d;};'use strict';var Sequelize=require('sequelize');module[_0x4ebc('0x0')]={'name':{'type':Sequelize[_0x4ebc('0x1')],'unique':_0x4ebc('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4ebc('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x4ebc('0x3')](_0x4ebc('0x4')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x4ebc('0x5')]('preproduction')[_0x4ebc('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x4ebc('0x3')]('long'),'get':function(){if(this['getDataValue']('production')){return this[_0x4ebc('0x5')](_0x4ebc('0x7'))[_0x4ebc('0x6')](_0x4ebc('0x8'));}}},'savedAt':{'type':Sequelize[_0x4ebc('0x9')]},'publishedAt':{'type':Sequelize[_0x4ebc('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index aa5dcfc..b7a5044 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 _0x361a=['destroy','params','lodash','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count','offset','Content-Range','update','then','SquareProjects','UserProfileResource','agi','stringify','end','sendStatus','error','name','send','index','map','SquareProject','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','show','include','options','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','find','publish','production'];(function(_0x438370,_0x522fdc){var _0x290e72=function(_0x4cd630){while(--_0x4cd630){_0x438370['push'](_0x438370['shift']());}};_0x290e72(++_0x522fdc);}(_0x361a,0x86));var _0xa361=function(_0x266f58,_0x56e05e){_0x266f58=_0x266f58-0x0;var _0x3d08d3=_0x361a[_0x266f58];return _0x3d08d3;};'use strict';var _=require(_0xa361('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa361('0x1'))(_0xa361('0x2'));var config=require(_0xa361('0x3'));var db=require('../../mysqldb')['db'];config[_0xa361('0x4')]=_[_0xa361('0x5')](config[_0xa361('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xa361('0x6'))(new Redis(config[_0xa361('0x4')]));require(_0xa361('0x7'))[_0xa361('0x8')](socket);function respondWithResult(_0x22ce65,_0x168757){_0x168757=_0x168757||0xc8;return function(_0x23f79c){if(_0x23f79c){return _0x22ce65[_0xa361('0x9')](_0x168757)[_0xa361('0xa')](_0x23f79c);}};}function respondWithFilteredResult(_0x1f2e0a,_0x1c08fb){return function(_0x596be3){if(_0x596be3){var _0x1d32cc=typeof _0x1c08fb['offset']===_0xa361('0xb')&&typeof _0x1c08fb[_0xa361('0xc')]===_0xa361('0xb');var _0x171677=_0x596be3[_0xa361('0xd')];var _0x34f54d=_0x1d32cc?0x0:_0x1c08fb[_0xa361('0xe')];var _0x5de3a6=_0x1d32cc?_0x596be3[_0xa361('0xd')]:_0x1c08fb[_0xa361('0xe')]+_0x1c08fb[_0xa361('0xc')];var _0x49be19;if(_0x5de3a6>=_0x171677){_0x5de3a6=_0x171677;_0x49be19=0xc8;}else{_0x49be19=0xce;}_0x1f2e0a[_0xa361('0x9')](_0x49be19);return _0x1f2e0a['set'](_0xa361('0xf'),_0x34f54d+'-'+_0x5de3a6+'/'+_0x171677)[_0xa361('0xa')](_0x596be3);}return null;};}function saveUpdates(_0x3e76be){return function(_0x24c07){if(_0x24c07){return _0x24c07[_0xa361('0x10')](_0x3e76be)[_0xa361('0x11')](function(_0x8521b9){return _0x8521b9;});}return null;};}function removeEntity(_0x78124f){return function(_0x3242ad){if(_0x3242ad){return _0x3242ad['destroy']()[_0xa361('0x11')](function(){var _0x4b4dc3=_0x3242ad['get']({'plain':!![]});var _0x5e6b62=_0xa361('0x12');return db[_0xa361('0x13')]['destroy']({'where':{'type':_0x5e6b62,'resourceId':_0x4b4dc3['id']}})[_0xa361('0x11')](function(){return _0x3242ad;});})[_0xa361('0x11')](function(){var _0x5506ce=new Redis(config[_0xa361('0x4')]);_0x5506ce['publish'](_0xa361('0x14'),JSON[_0xa361('0x15')]({'id':_0x3242ad['id'],'deleted':!![]}));})['then'](function(){_0x78124f[_0xa361('0x9')](0xcc)[_0xa361('0x16')]();});}};}function handleEntityNotFound(_0x2f92ab){return function(_0x5af4ff){if(!_0x5af4ff){_0x2f92ab[_0xa361('0x17')](0x194);}return _0x5af4ff;};}function handleError(_0x1ae21f,_0x4489e1){_0x4489e1=_0x4489e1||0x1f4;return function(_0x563850){logger[_0xa361('0x18')](_0x563850['stack']);if(_0x563850[_0xa361('0x19')]){delete _0x563850[_0xa361('0x19')];}_0x1ae21f[_0xa361('0x9')](_0x4489e1)[_0xa361('0x1a')](_0x563850);};}exports[_0xa361('0x1b')]=function(_0x2fad45,_0x3a97e9){var _0x11d1c1={},_0x5d787e={},_0x1d9857={'count':0x0,'rows':[]};var _0xc01b89=_[_0xa361('0x1c')](db[_0xa361('0x1d')]['rawAttributes'],function(_0x12834a){return{'name':_0x12834a['fieldName'],'type':_0x12834a[_0xa361('0x1e')][_0xa361('0x1f')]};});_0x5d787e[_0xa361('0x20')]=_['map'](_0xc01b89,'name');_0x5d787e['query']=_[_0xa361('0x21')](_0x2fad45[_0xa361('0x22')]);_0x5d787e[_0xa361('0x23')]=_['intersection'](_0x5d787e[_0xa361('0x20')],_0x5d787e[_0xa361('0x22')]);_0x11d1c1['attributes']=_['intersection'](_0x5d787e[_0xa361('0x20')],qs[_0xa361('0x24')](_0x2fad45[_0xa361('0x22')][_0xa361('0x24')]));_0x11d1c1[_0xa361('0x25')]=_0x11d1c1['attributes'][_0xa361('0x26')]?_0x11d1c1[_0xa361('0x25')]:_0x5d787e[_0xa361('0x20')];if(!_0x2fad45[_0xa361('0x22')][_0xa361('0x27')](_0xa361('0x28'))){_0x11d1c1[_0xa361('0xc')]=qs[_0xa361('0xc')](_0x2fad45['query'][_0xa361('0xc')]);_0x11d1c1[_0xa361('0xe')]=qs['offset'](_0x2fad45[_0xa361('0x22')][_0xa361('0xe')]);}_0x11d1c1[_0xa361('0x29')]=qs[_0xa361('0x2a')](_0x2fad45[_0xa361('0x22')][_0xa361('0x2a')]);_0x11d1c1['where']=qs[_0xa361('0x23')](_[_0xa361('0x2b')](_0x2fad45[_0xa361('0x22')],_0x5d787e[_0xa361('0x23')]),_0xc01b89);if(_0x2fad45[_0xa361('0x22')][_0xa361('0x2c')]){_0x11d1c1[_0xa361('0x2d')]=_[_0xa361('0x2e')](_0x11d1c1[_0xa361('0x2d')],{'$or':_[_0xa361('0x1c')](_0xc01b89,function(_0x701644){if(_0x701644[_0xa361('0x1e')]!==_0xa361('0x2f')){var _0x5515b9={};_0x5515b9[_0x701644[_0xa361('0x19')]]={'$like':'%'+_0x2fad45[_0xa361('0x22')][_0xa361('0x2c')]+'%'};return _0x5515b9;}})});}_0x11d1c1=_['merge']({},_0x11d1c1,_0x2fad45['options']);var _0x41957b={'where':_0x11d1c1[_0xa361('0x2d')]};return db[_0xa361('0x1d')]['count'](_0x41957b)['then'](function(_0x40e80d){_0x1d9857[_0xa361('0xd')]=_0x40e80d;if(_0x2fad45['query']['includeAll']){_0x11d1c1['include']=[{'all':!![]}];}return db[_0xa361('0x1d')]['findAll'](_0x11d1c1);})[_0xa361('0x11')](function(_0x79900b){_0x1d9857['rows']=_0x79900b;return _0x1d9857;})['then'](respondWithFilteredResult(_0x3a97e9,_0x11d1c1))['catch'](handleError(_0x3a97e9,null));};exports[_0xa361('0x30')]=function(_0x5b1720,_0x6a2e41){var _0x4c26b8={'raw':![],'where':{'id':_0x5b1720['params']['id']}},_0x4934a8={};_0x4934a8[_0xa361('0x20')]=_[_0xa361('0x21')](db['SquareProject']['rawAttributes']);_0x4934a8[_0xa361('0x22')]=_[_0xa361('0x21')](_0x5b1720['query']);_0x4934a8[_0xa361('0x23')]=_['intersection'](_0x4934a8[_0xa361('0x20')],_0x4934a8['query']);_0x4c26b8['attributes']=_['intersection'](_0x4934a8['model'],qs[_0xa361('0x24')](_0x5b1720[_0xa361('0x22')]['fields']));_0x4c26b8[_0xa361('0x25')]=_0x4c26b8[_0xa361('0x25')]['length']?_0x4c26b8[_0xa361('0x25')]:_0x4934a8[_0xa361('0x20')];if(_0x5b1720[_0xa361('0x22')]['includeAll']){_0x4c26b8[_0xa361('0x31')]=[{'all':!![]}];}_0x4c26b8=_[_0xa361('0x2e')]({},_0x4c26b8,_0x5b1720[_0xa361('0x32')]);return db[_0xa361('0x1d')]['find'](_0x4c26b8)[_0xa361('0x11')](handleEntityNotFound(_0x6a2e41,null))[_0xa361('0x11')](respondWithResult(_0x6a2e41,null))[_0xa361('0x33')](handleError(_0x6a2e41,null));};exports[_0xa361('0x34')]=function(_0x1d00af,_0xf09c28){return db[_0xa361('0x1d')]['create'](_0x1d00af['body'],{})['then'](function(_0x5c39d6){var _0x44ea98=_0x1d00af['user'][_0xa361('0x35')]({'plain':!![]});if(!_0x44ea98)throw new Error(_0xa361('0x36'));if(_0x44ea98[_0xa361('0x37')]===_0xa361('0x38')){var _0x21744d=_0x5c39d6[_0xa361('0x35')]({'plain':!![]});var _0x600b5e=_0xa361('0x12');return db[_0xa361('0x39')]['find']({'where':{'name':_0x600b5e,'userProfileId':_0x44ea98[_0xa361('0x3a')]},'raw':!![]})[_0xa361('0x11')](function(_0x311174){if(_0x311174&&_0x311174[_0xa361('0x3b')]===0x0){return db[_0xa361('0x13')]['create']({'name':_0x21744d[_0xa361('0x19')],'resourceId':_0x21744d['id'],'type':_0x311174[_0xa361('0x19')],'sectionId':_0x311174['id']},{})[_0xa361('0x11')](function(){return _0x5c39d6;});}else{return _0x5c39d6;}})[_0xa361('0x33')](function(_0x2996ea){logger[_0xa361('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2996ea);throw _0x2996ea;});}return _0x5c39d6;})[_0xa361('0x11')](respondWithResult(_0xf09c28,0xc9))[_0xa361('0x33')](handleError(_0xf09c28,null));};exports[_0xa361('0x10')]=function(_0x31d1f8,_0x5d6cda){if(_0x31d1f8[_0xa361('0x3c')]['id']){delete _0x31d1f8[_0xa361('0x3c')]['id'];}return db[_0xa361('0x1d')][_0xa361('0x3d')]({'where':{'id':_0x31d1f8['params']['id']}})[_0xa361('0x11')](handleEntityNotFound(_0x5d6cda,null))['then'](saveUpdates(_0x31d1f8['body'],null))[_0xa361('0x11')](function(_0x1aaa13){if(!_0x1aaa13)return;var _0x1fb57a=_0x1aaa13['get']({'plain':!![]});return _0x1fb57a;})[_0xa361('0x11')](function(_0x338485){var _0x462390=new Redis(config[_0xa361('0x4')]);_0x462390[_0xa361('0x3e')](_0xa361('0x14'),JSON[_0xa361('0x15')](_[_0xa361('0x2b')](_0x338485,['id',_0xa361('0x19'),_0xa361('0x3f')])));return _0x338485;})[_0xa361('0x11')](respondWithResult(_0x5d6cda,null))[_0xa361('0x33')](handleError(_0x5d6cda,null));};exports[_0xa361('0x40')]=function(_0x243153,_0x41194c){return db[_0xa361('0x1d')][_0xa361('0x3d')]({'where':{'id':_0x243153[_0xa361('0x41')]['id']}})[_0xa361('0x11')](handleEntityNotFound(_0x41194c,null))[_0xa361('0x11')](removeEntity(_0x41194c,null))[_0xa361('0x33')](handleError(_0x41194c,null));}; \ No newline at end of file +var _0x8f2d=['then','destroy','get','SquareProjects','UserProfileResource','agi','stringify','status','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','offset','undefined','count','limit','set','Content-Range','json','update'];(function(_0x5ac791,_0x504d37){var _0x9e3a19=function(_0x2d4821){while(--_0x2d4821){_0x5ac791['push'](_0x5ac791['shift']());}};_0x9e3a19(++_0x504d37);}(_0x8f2d,0x14a));var _0xd8f2=function(_0x4103f2,_0x5ecf1f){_0x4103f2=_0x4103f2-0x0;var _0x387ba8=_0x8f2d[_0x4103f2];return _0x387ba8;};'use strict';var _=require('lodash');var Redis=require(_0xd8f2('0x0'));var qs=require(_0xd8f2('0x1'));var logger=require(_0xd8f2('0x2'))(_0xd8f2('0x3'));var config=require(_0xd8f2('0x4'));var db=require(_0xd8f2('0x5'))['db'];config['redis']=_[_0xd8f2('0x6')](config[_0xd8f2('0x7')],{'host':_0xd8f2('0x8'),'port':0x18eb});var socket=require(_0xd8f2('0x9'))(new Redis(config[_0xd8f2('0x7')]));require(_0xd8f2('0xa'))[_0xd8f2('0xb')](socket);function respondWithResult(_0xa62ecd,_0x45e445){_0x45e445=_0x45e445||0xc8;return function(_0x44a834){if(_0x44a834){return _0xa62ecd['status'](_0x45e445)['json'](_0x44a834);}};}function respondWithFilteredResult(_0x50eadd,_0x4b7165){return function(_0xc8bc43){if(_0xc8bc43){var _0x461f78=typeof _0x4b7165[_0xd8f2('0xc')]==='undefined'&&typeof _0x4b7165['limit']===_0xd8f2('0xd');var _0x45c3d5=_0xc8bc43[_0xd8f2('0xe')];var _0x5ac60d=_0x461f78?0x0:_0x4b7165['offset'];var _0xcefc3b=_0x461f78?_0xc8bc43[_0xd8f2('0xe')]:_0x4b7165[_0xd8f2('0xc')]+_0x4b7165[_0xd8f2('0xf')];var _0x4a1123;if(_0xcefc3b>=_0x45c3d5){_0xcefc3b=_0x45c3d5;_0x4a1123=0xc8;}else{_0x4a1123=0xce;}_0x50eadd['status'](_0x4a1123);return _0x50eadd[_0xd8f2('0x10')](_0xd8f2('0x11'),_0x5ac60d+'-'+_0xcefc3b+'/'+_0x45c3d5)[_0xd8f2('0x12')](_0xc8bc43);}return null;};}function saveUpdates(_0x37563b){return function(_0xc339a2){if(_0xc339a2){return _0xc339a2[_0xd8f2('0x13')](_0x37563b)[_0xd8f2('0x14')](function(_0x10ad49){return _0x10ad49;});}return null;};}function removeEntity(_0x16e146){return function(_0x54ef8e){if(_0x54ef8e){return _0x54ef8e[_0xd8f2('0x15')]()[_0xd8f2('0x14')](function(){var _0x417125=_0x54ef8e[_0xd8f2('0x16')]({'plain':!![]});var _0x55d7a4=_0xd8f2('0x17');return db[_0xd8f2('0x18')][_0xd8f2('0x15')]({'where':{'type':_0x55d7a4,'resourceId':_0x417125['id']}})['then'](function(){return _0x54ef8e;});})[_0xd8f2('0x14')](function(){var _0x4c4fea=new Redis(config[_0xd8f2('0x7')]);_0x4c4fea['publish'](_0xd8f2('0x19'),JSON[_0xd8f2('0x1a')]({'id':_0x54ef8e['id'],'deleted':!![]}));})[_0xd8f2('0x14')](function(){_0x16e146[_0xd8f2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xddf0f7){return function(_0x50ab1d){if(!_0x50ab1d){_0xddf0f7[_0xd8f2('0x1c')](0x194);}return _0x50ab1d;};}function handleError(_0x26c252,_0x2967dc){_0x2967dc=_0x2967dc||0x1f4;return function(_0x2b4fdc){logger[_0xd8f2('0x1d')](_0x2b4fdc[_0xd8f2('0x1e')]);if(_0x2b4fdc[_0xd8f2('0x1f')]){delete _0x2b4fdc[_0xd8f2('0x1f')];}_0x26c252[_0xd8f2('0x1b')](_0x2967dc)[_0xd8f2('0x20')](_0x2b4fdc);};}exports[_0xd8f2('0x21')]=function(_0x7bc165,_0x283a87){var _0x1e3cbc={},_0x57fb0={},_0x1264a2={'count':0x0,'rows':[]};var _0x4776fe=_[_0xd8f2('0x22')](db[_0xd8f2('0x23')][_0xd8f2('0x24')],function(_0x22c84f){return{'name':_0x22c84f['fieldName'],'type':_0x22c84f[_0xd8f2('0x25')][_0xd8f2('0x26')]};});_0x57fb0['model']=_[_0xd8f2('0x22')](_0x4776fe,_0xd8f2('0x1f'));_0x57fb0[_0xd8f2('0x27')]=_[_0xd8f2('0x28')](_0x7bc165[_0xd8f2('0x27')]);_0x57fb0[_0xd8f2('0x29')]=_[_0xd8f2('0x2a')](_0x57fb0[_0xd8f2('0x2b')],_0x57fb0[_0xd8f2('0x27')]);_0x1e3cbc[_0xd8f2('0x2c')]=_[_0xd8f2('0x2a')](_0x57fb0[_0xd8f2('0x2b')],qs['fields'](_0x7bc165[_0xd8f2('0x27')][_0xd8f2('0x2d')]));_0x1e3cbc[_0xd8f2('0x2c')]=_0x1e3cbc[_0xd8f2('0x2c')][_0xd8f2('0x2e')]?_0x1e3cbc[_0xd8f2('0x2c')]:_0x57fb0[_0xd8f2('0x2b')];if(!_0x7bc165[_0xd8f2('0x27')][_0xd8f2('0x2f')]('nolimit')){_0x1e3cbc[_0xd8f2('0xf')]=qs[_0xd8f2('0xf')](_0x7bc165['query'][_0xd8f2('0xf')]);_0x1e3cbc[_0xd8f2('0xc')]=qs[_0xd8f2('0xc')](_0x7bc165[_0xd8f2('0x27')][_0xd8f2('0xc')]);}_0x1e3cbc['order']=qs['sort'](_0x7bc165[_0xd8f2('0x27')][_0xd8f2('0x30')]);_0x1e3cbc[_0xd8f2('0x31')]=qs[_0xd8f2('0x29')](_[_0xd8f2('0x32')](_0x7bc165[_0xd8f2('0x27')],_0x57fb0['filters']),_0x4776fe);if(_0x7bc165[_0xd8f2('0x27')]['filter']){_0x1e3cbc[_0xd8f2('0x31')]=_[_0xd8f2('0x33')](_0x1e3cbc[_0xd8f2('0x31')],{'$or':_[_0xd8f2('0x22')](_0x4776fe,function(_0x2758cd){if(_0x2758cd[_0xd8f2('0x25')]!==_0xd8f2('0x34')){var _0x349c54={};_0x349c54[_0x2758cd[_0xd8f2('0x1f')]]={'$like':'%'+_0x7bc165[_0xd8f2('0x27')][_0xd8f2('0x35')]+'%'};return _0x349c54;}})});}_0x1e3cbc=_['merge']({},_0x1e3cbc,_0x7bc165[_0xd8f2('0x36')]);var _0x1c904e={'where':_0x1e3cbc[_0xd8f2('0x31')]};return db[_0xd8f2('0x23')][_0xd8f2('0xe')](_0x1c904e)[_0xd8f2('0x14')](function(_0x51ee39){_0x1264a2[_0xd8f2('0xe')]=_0x51ee39;if(_0x7bc165[_0xd8f2('0x27')][_0xd8f2('0x37')]){_0x1e3cbc[_0xd8f2('0x38')]=[{'all':!![]}];}return db['SquareProject'][_0xd8f2('0x39')](_0x1e3cbc);})['then'](function(_0x415690){_0x1264a2[_0xd8f2('0x3a')]=_0x415690;return _0x1264a2;})['then'](respondWithFilteredResult(_0x283a87,_0x1e3cbc))['catch'](handleError(_0x283a87,null));};exports['show']=function(_0xd5470a,_0x222cdd){var _0x1f1c9d={'raw':![],'where':{'id':_0xd5470a[_0xd8f2('0x3b')]['id']}},_0x3b4810={};_0x3b4810[_0xd8f2('0x2b')]=_[_0xd8f2('0x28')](db['SquareProject'][_0xd8f2('0x24')]);_0x3b4810['query']=_['keys'](_0xd5470a[_0xd8f2('0x27')]);_0x3b4810['filters']=_[_0xd8f2('0x2a')](_0x3b4810[_0xd8f2('0x2b')],_0x3b4810[_0xd8f2('0x27')]);_0x1f1c9d[_0xd8f2('0x2c')]=_['intersection'](_0x3b4810[_0xd8f2('0x2b')],qs[_0xd8f2('0x2d')](_0xd5470a['query'][_0xd8f2('0x2d')]));_0x1f1c9d[_0xd8f2('0x2c')]=_0x1f1c9d['attributes'][_0xd8f2('0x2e')]?_0x1f1c9d['attributes']:_0x3b4810['model'];if(_0xd5470a['query'][_0xd8f2('0x37')]){_0x1f1c9d[_0xd8f2('0x38')]=[{'all':!![]}];}_0x1f1c9d=_['merge']({},_0x1f1c9d,_0xd5470a['options']);return db[_0xd8f2('0x23')][_0xd8f2('0x3c')](_0x1f1c9d)['then'](handleEntityNotFound(_0x222cdd,null))['then'](respondWithResult(_0x222cdd,null))[_0xd8f2('0x3d')](handleError(_0x222cdd,null));};exports[_0xd8f2('0x3e')]=function(_0x2aa001,_0x5e7ffe){return db[_0xd8f2('0x23')][_0xd8f2('0x3e')](_0x2aa001[_0xd8f2('0x3f')],{})[_0xd8f2('0x14')](function(_0x4d501f){var _0x11e0ac=_0x2aa001['user'][_0xd8f2('0x16')]({'plain':!![]});if(!_0x11e0ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11e0ac[_0xd8f2('0x40')]===_0xd8f2('0x41')){var _0x43f19e=_0x4d501f['get']({'plain':!![]});var _0x1cb7d3=_0xd8f2('0x17');return db[_0xd8f2('0x42')][_0xd8f2('0x3c')]({'where':{'name':_0x1cb7d3,'userProfileId':_0x11e0ac[_0xd8f2('0x43')]},'raw':!![]})[_0xd8f2('0x14')](function(_0x1cd209){if(_0x1cd209&&_0x1cd209['autoAssociation']===0x0){return db[_0xd8f2('0x18')]['create']({'name':_0x43f19e[_0xd8f2('0x1f')],'resourceId':_0x43f19e['id'],'type':_0x1cd209[_0xd8f2('0x1f')],'sectionId':_0x1cd209['id']},{})[_0xd8f2('0x14')](function(){return _0x4d501f;});}else{return _0x4d501f;}})[_0xd8f2('0x3d')](function(_0x2ee2dd){logger[_0xd8f2('0x1d')](_0xd8f2('0x44'),_0x2ee2dd);throw _0x2ee2dd;});}return _0x4d501f;})[_0xd8f2('0x14')](respondWithResult(_0x5e7ffe,0xc9))[_0xd8f2('0x3d')](handleError(_0x5e7ffe,null));};exports['update']=function(_0x50ca08,_0x2ebcfb){if(_0x50ca08[_0xd8f2('0x3f')]['id']){delete _0x50ca08[_0xd8f2('0x3f')]['id'];}return db[_0xd8f2('0x23')][_0xd8f2('0x3c')]({'where':{'id':_0x50ca08['params']['id']}})[_0xd8f2('0x14')](handleEntityNotFound(_0x2ebcfb,null))[_0xd8f2('0x14')](saveUpdates(_0x50ca08[_0xd8f2('0x3f')],null))[_0xd8f2('0x14')](function(_0x4cf6b7){if(!_0x4cf6b7)return;var _0x1dc038=_0x4cf6b7[_0xd8f2('0x16')]({'plain':!![]});return _0x1dc038;})[_0xd8f2('0x14')](function(_0x30ecf5){var _0x393730=new Redis(config['redis']);_0x393730['publish'](_0xd8f2('0x19'),JSON[_0xd8f2('0x1a')](_[_0xd8f2('0x32')](_0x30ecf5,['id','name',_0xd8f2('0x45')])));return _0x30ecf5;})[_0xd8f2('0x14')](respondWithResult(_0x2ebcfb,null))[_0xd8f2('0x3d')](handleError(_0x2ebcfb,null));};exports[_0xd8f2('0x15')]=function(_0x1370db,_0x3f2375){return db['SquareProject'][_0xd8f2('0x3c')]({'where':{'id':_0x1370db[_0xd8f2('0x3b')]['id']}})[_0xd8f2('0x14')](handleEntityNotFound(_0x3f2375,null))[_0xd8f2('0x14')](removeEntity(_0x3f2375,null))[_0xd8f2('0x3d')](handleError(_0x3f2375,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 781590e..9f404d1 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 _0x2c64=['SquareProject','save','update','remove','emit','hook','exports'];(function(_0x43d9b2,_0x2c57f8){var _0x13e343=function(_0x72437d){while(--_0x72437d){_0x43d9b2['push'](_0x43d9b2['shift']());}};_0x13e343(++_0x2c57f8);}(_0x2c64,0x77));var _0x42c6=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x2c64[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0x42c6('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x42c6('0x1'),'afterUpdate':_0x42c6('0x2'),'afterDestroy':_0x42c6('0x3')};function emitEvent(_0x30a633){return function(_0x32a331,_0x4c1823,_0x87a927){SquareProjectEvents[_0x42c6('0x4')](_0x30a633+':'+_0x32a331['id'],_0x32a331);SquareProjectEvents[_0x42c6('0x4')](_0x30a633,_0x32a331);_0x87a927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x42c6('0x5')](e,emitEvent(event));}}module[_0x42c6('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x3c5f=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x46437e,_0x20c7d8){var _0x1189bd=function(_0xc1e31f){while(--_0xc1e31f){_0x46437e['push'](_0x46437e['shift']());}};_0x1189bd(++_0x20c7d8);}(_0x3c5f,0x75));var _0xf3c5=function(_0x33b31a,_0x2e5b9d){_0x33b31a=_0x33b31a-0x0;var _0x26f5a6=_0x3c5f[_0x33b31a];return _0x26f5a6;};'use strict';var EventEmitter=require(_0xf3c5('0x0'));var SquareProject=require(_0xf3c5('0x1'))['db'][_0xf3c5('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf3c5('0x3')](0x0);var events={'afterCreate':_0xf3c5('0x4'),'afterUpdate':_0xf3c5('0x5'),'afterDestroy':_0xf3c5('0x6')};function emitEvent(_0x296255){return function(_0x1e077f,_0x2f7c49,_0x5494c4){SquareProjectEvents[_0xf3c5('0x7')](_0x296255+':'+_0x1e077f['id'],_0x1e077f);SquareProjectEvents['emit'](_0x296255,_0x1e077f);_0x5494c4(null);};}for(var e in events){if(events[_0xf3c5('0x8')](e)){var event=events[e];SquareProject[_0xf3c5('0x9')](e,emitEvent(event));}}module[_0xf3c5('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0577aba..317c4ff 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 _0x7ab3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util'];(function(_0x3cc8b4,_0x33bc7d){var _0x20ff15=function(_0x5c30c2){while(--_0x5c30c2){_0x3cc8b4['push'](_0x3cc8b4['shift']());}};_0x20ff15(++_0x33bc7d);}(_0x7ab3,0x70));var _0x37ab=function(_0x57532c,_0x2c75cf){_0x57532c=_0x57532c-0x0;var _0x5cb9a6=_0x7ab3[_0x57532c];return _0x5cb9a6;};'use strict';var _=require(_0x37ab('0x0'));var util=require(_0x37ab('0x1'));var logger=require(_0x37ab('0x2'))('api');var moment=require(_0x37ab('0x3'));var BPromise=require(_0x37ab('0x4'));var rp=require(_0x37ab('0x5'));var fs=require('fs');var path=require(_0x37ab('0x6'));var rimraf=require(_0x37ab('0x7'));var config=require(_0x37ab('0x8'));var attributes=require(_0x37ab('0x9'));module[_0x37ab('0xa')]=function(_0x491671,_0x49c8bc){return _0x491671[_0x37ab('0xb')]('SquareProject',attributes,{'tableName':_0x37ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x533922,_0x1336db,_0xc0abc0){if(_0x533922[_0x37ab('0xd')](_0x37ab('0xe'))){_0x533922['savedAt']=moment()[_0x37ab('0xf')](_0x37ab('0x10'));}if(_0x533922['changed'](_0x37ab('0x11'))){_0x533922[_0x37ab('0x12')]=moment()[_0x37ab('0xf')](_0x37ab('0x10'));}_0xc0abc0(null,_0x533922);}}});}; \ No newline at end of file +var _0xe43a=['define','square_projects','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0xc8bdaa,_0x53a105){var _0x20fa64=function(_0x2e602c){while(--_0x2e602c){_0xc8bdaa['push'](_0xc8bdaa['shift']());}};_0x20fa64(++_0x53a105);}(_0xe43a,0xed));var _0xae43=function(_0x4e6ceb,_0x17e571){_0x4e6ceb=_0x4e6ceb-0x0;var _0xa2dba7=_0xe43a[_0x4e6ceb];return _0xa2dba7;};'use strict';var _=require(_0xae43('0x0'));var util=require('util');var logger=require(_0xae43('0x1'))(_0xae43('0x2'));var moment=require(_0xae43('0x3'));var BPromise=require(_0xae43('0x4'));var rp=require(_0xae43('0x5'));var fs=require('fs');var path=require(_0xae43('0x6'));var rimraf=require(_0xae43('0x7'));var config=require(_0xae43('0x8'));var attributes=require(_0xae43('0x9'));module['exports']=function(_0x397f89,_0x48f656){return _0x397f89[_0xae43('0xa')]('SquareProject',attributes,{'tableName':_0xae43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a0b90,_0x346ff7,_0x53480a){if(_0x5a0b90[_0xae43('0xc')](_0xae43('0xd'))){_0x5a0b90[_0xae43('0xe')]=moment()[_0xae43('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5a0b90[_0xae43('0xc')](_0xae43('0x10'))){_0x5a0b90[_0xae43('0x11')]=moment()[_0xae43('0xf')](_0xae43('0x12'));}_0x53480a(null,_0x5a0b90);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index eaedbd6..105cc7e 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 _0x3119=['lodash','../../config/logger','redis','defaults','localhost','./squareProject.socket','register','SquareProject','findAll','options','where','limit','include','map','model','attributes','GetSquareProjects','debug','stringify','catch','message','ShowSquareProject','find','raw','then','info','error'];(function(_0x5380cd,_0x1ea634){var _0x25dd61=function(_0x277132){while(--_0x277132){_0x5380cd['push'](_0x5380cd['shift']());}};_0x25dd61(++_0x1ea634);}(_0x3119,0x195));var _0x9311=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0x3119[_0x187279];return _0x3da59d;};'use strict';var _=require(_0x9311('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x9311('0x1'))('rpc');var config=require('../../config/environment');config[_0x9311('0x2')]=_[_0x9311('0x3')](config[_0x9311('0x2')],{'host':_0x9311('0x4'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9311('0x2')]));require(_0x9311('0x5'))[_0x9311('0x6')](socket);exports['GetSquareProjects']=function(_0x34550d){var _0x3d6c94=this;return new Promise(function(_0x19527c,_0x2c6b9a){return db[_0x9311('0x7')][_0x9311('0x8')]({'raw':_0x34550d[_0x9311('0x9')]?_0x34550d[_0x9311('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x34550d[_0x9311('0x9')]?_0x34550d['options'][_0x9311('0xa')]||null:null,'attributes':_0x34550d['options']?_0x34550d[_0x9311('0x9')]['attributes']||null:null,'limit':_0x34550d[_0x9311('0x9')]?_0x34550d[_0x9311('0x9')][_0x9311('0xb')]||null:null,'include':_0x34550d[_0x9311('0x9')]?_0x34550d[_0x9311('0x9')][_0x9311('0xc')]?_[_0x9311('0xd')](_0x34550d[_0x9311('0x9')][_0x9311('0xc')],function(_0x5543cc){return{'model':db[_0x5543cc[_0x9311('0xe')]],'as':_0x5543cc['as'],'attributes':_0x5543cc[_0x9311('0xf')],'include':_0x5543cc['include']?_['map'](_0x5543cc[_0x9311('0xc')],function(_0x37d42c){return{'model':db[_0x37d42c[_0x9311('0xe')]],'as':_0x37d42c['as'],'attributes':_0x37d42c[_0x9311('0xf')],'include':_0x37d42c[_0x9311('0xc')]?_[_0x9311('0xd')](_0x37d42c[_0x9311('0xc')],function(_0x1d6316){return{'model':db[_0x1d6316[_0x9311('0xe')]],'as':_0x1d6316['as'],'attributes':_0x1d6316[_0x9311('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1de023){logger['info'](_0x9311('0x10'),_0x34550d);logger[_0x9311('0x11')](_0x9311('0x10'),_0x34550d,JSON[_0x9311('0x12')](_0x1de023));_0x19527c(_0x1de023);})[_0x9311('0x13')](function(_0x5a31c1){logger['error'](_0x9311('0x10'),_0x5a31c1[_0x9311('0x14')],_0x34550d);_0x2c6b9a(_0x3d6c94['error'](0x1f4,_0x5a31c1[_0x9311('0x14')]));});});};exports[_0x9311('0x15')]=function(_0x3dc66c){var _0x322d21=this;return new Promise(function(_0x27b9ab,_0xc27d33){return db['SquareProject'][_0x9311('0x16')]({'raw':_0x3dc66c['options']?_0x3dc66c[_0x9311('0x9')][_0x9311('0x17')]===undefined?!![]:![]:!![],'where':_0x3dc66c[_0x9311('0x9')]?_0x3dc66c[_0x9311('0x9')][_0x9311('0xa')]||null:null,'attributes':_0x3dc66c[_0x9311('0x9')]?_0x3dc66c['options'][_0x9311('0xf')]||null:null,'include':_0x3dc66c['options']?_0x3dc66c['options'][_0x9311('0xc')]?_[_0x9311('0xd')](_0x3dc66c['options'][_0x9311('0xc')],function(_0x2707c5){return{'model':db[_0x2707c5[_0x9311('0xe')]],'as':_0x2707c5['as'],'attributes':_0x2707c5[_0x9311('0xf')],'include':_0x2707c5[_0x9311('0xc')]?_[_0x9311('0xd')](_0x2707c5[_0x9311('0xc')],function(_0x5b5343){return{'model':db[_0x5b5343['model']],'as':_0x5b5343['as'],'attributes':_0x5b5343[_0x9311('0xf')],'include':_0x5b5343[_0x9311('0xc')]?_[_0x9311('0xd')](_0x5b5343[_0x9311('0xc')],function(_0x144db8){return{'model':db[_0x144db8['model']],'as':_0x144db8['as'],'attributes':_0x144db8['attributes']};}):[]};}):[]};}):[]:[]})[_0x9311('0x18')](function(_0x4400c6){logger[_0x9311('0x19')](_0x9311('0x15'),_0x3dc66c);logger['debug'](_0x9311('0x15'),_0x3dc66c,JSON[_0x9311('0x12')](_0x4400c6));_0x27b9ab(_0x4400c6);})['catch'](function(_0x38535e){logger['error'](_0x9311('0x15'),_0x38535e[_0x9311('0x14')],_0x3dc66c);_0xc27d33(_0x322d21[_0x9311('0x1a')](0x1f4,_0x38535e[_0x9311('0x14')]));});});}; \ No newline at end of file +var _0x4ff3=['info','debug','stringify','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','attributes','limit','include','map','model','then','catch','error','message','ShowSquareProject','find'];(function(_0x26b2b3,_0x2fcba7){var _0x3ee842=function(_0x3c1474){while(--_0x3c1474){_0x26b2b3['push'](_0x26b2b3['shift']());}};_0x3ee842(++_0x2fcba7);}(_0x4ff3,0x196));var _0x34ff=function(_0xbed702,_0x2d0842){_0xbed702=_0xbed702-0x0;var _0x2799d4=_0x4ff3[_0xbed702];return _0x2799d4;};'use strict';var _=require(_0x34ff('0x0'));var Redis=require(_0x34ff('0x1'));var db=require(_0x34ff('0x2'))['db'];var logger=require(_0x34ff('0x3'))(_0x34ff('0x4'));var config=require(_0x34ff('0x5'));config[_0x34ff('0x6')]=_[_0x34ff('0x7')](config[_0x34ff('0x6')],{'host':_0x34ff('0x8'),'port':0x18eb});var socket=require(_0x34ff('0x9'))(new Redis(config[_0x34ff('0x6')]));require(_0x34ff('0xa'))[_0x34ff('0xb')](socket);exports[_0x34ff('0xc')]=function(_0x485c02){var _0x6fdb95=this;return new Promise(function(_0x180309,_0x16ebff){return db[_0x34ff('0xd')]['findAll']({'raw':_0x485c02[_0x34ff('0xe')]?_0x485c02[_0x34ff('0xe')][_0x34ff('0xf')]===undefined?!![]:![]:!![],'where':_0x485c02[_0x34ff('0xe')]?_0x485c02[_0x34ff('0xe')][_0x34ff('0x10')]||null:null,'attributes':_0x485c02[_0x34ff('0xe')]?_0x485c02[_0x34ff('0xe')][_0x34ff('0x11')]||null:null,'limit':_0x485c02[_0x34ff('0xe')]?_0x485c02[_0x34ff('0xe')][_0x34ff('0x12')]||null:null,'include':_0x485c02['options']?_0x485c02[_0x34ff('0xe')][_0x34ff('0x13')]?_[_0x34ff('0x14')](_0x485c02[_0x34ff('0xe')][_0x34ff('0x13')],function(_0x2c8a3a){return{'model':db[_0x2c8a3a[_0x34ff('0x15')]],'as':_0x2c8a3a['as'],'attributes':_0x2c8a3a[_0x34ff('0x11')],'include':_0x2c8a3a[_0x34ff('0x13')]?_[_0x34ff('0x14')](_0x2c8a3a[_0x34ff('0x13')],function(_0x2b4773){return{'model':db[_0x2b4773[_0x34ff('0x15')]],'as':_0x2b4773['as'],'attributes':_0x2b4773[_0x34ff('0x11')],'include':_0x2b4773['include']?_['map'](_0x2b4773[_0x34ff('0x13')],function(_0x4d16d5){return{'model':db[_0x4d16d5[_0x34ff('0x15')]],'as':_0x4d16d5['as'],'attributes':_0x4d16d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x34ff('0x16')](function(_0x267579){logger['info'](_0x34ff('0xc'),_0x485c02);logger['debug']('GetSquareProjects',_0x485c02,JSON['stringify'](_0x267579));_0x180309(_0x267579);})[_0x34ff('0x17')](function(_0x46eafa){logger['error'](_0x34ff('0xc'),_0x46eafa['message'],_0x485c02);_0x16ebff(_0x6fdb95[_0x34ff('0x18')](0x1f4,_0x46eafa[_0x34ff('0x19')]));});});};exports[_0x34ff('0x1a')]=function(_0x15c095){var _0x3402d8=this;return new Promise(function(_0x5bd639,_0x3c4075){return db['SquareProject'][_0x34ff('0x1b')]({'raw':_0x15c095[_0x34ff('0xe')]?_0x15c095[_0x34ff('0xe')][_0x34ff('0xf')]===undefined?!![]:![]:!![],'where':_0x15c095[_0x34ff('0xe')]?_0x15c095[_0x34ff('0xe')][_0x34ff('0x10')]||null:null,'attributes':_0x15c095['options']?_0x15c095[_0x34ff('0xe')][_0x34ff('0x11')]||null:null,'include':_0x15c095[_0x34ff('0xe')]?_0x15c095[_0x34ff('0xe')][_0x34ff('0x13')]?_['map'](_0x15c095['options']['include'],function(_0x1432cf){return{'model':db[_0x1432cf[_0x34ff('0x15')]],'as':_0x1432cf['as'],'attributes':_0x1432cf[_0x34ff('0x11')],'include':_0x1432cf[_0x34ff('0x13')]?_[_0x34ff('0x14')](_0x1432cf['include'],function(_0x5d3c07){return{'model':db[_0x5d3c07[_0x34ff('0x15')]],'as':_0x5d3c07['as'],'attributes':_0x5d3c07[_0x34ff('0x11')],'include':_0x5d3c07[_0x34ff('0x13')]?_[_0x34ff('0x14')](_0x5d3c07['include'],function(_0x8479a8){return{'model':db[_0x8479a8[_0x34ff('0x15')]],'as':_0x8479a8['as'],'attributes':_0x8479a8[_0x34ff('0x11')]};}):[]};}):[]};}):[]:[]})[_0x34ff('0x16')](function(_0x3de2ee){logger[_0x34ff('0x1c')]('ShowSquareProject',_0x15c095);logger[_0x34ff('0x1d')](_0x34ff('0x1a'),_0x15c095,JSON[_0x34ff('0x1e')](_0x3de2ee));_0x5bd639(_0x3de2ee);})[_0x34ff('0x17')](function(_0x249dfd){logger[_0x34ff('0x18')](_0x34ff('0x1a'),_0x249dfd['message'],_0x15c095);_0x3c4075(_0x3402d8['error'](0x1f4,_0x249dfd[_0x34ff('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e5d5be9..7d6fc46 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 _0xe3fe=['length','squareProject:','./squareProject.events','save','update','removeListener'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xe3fe,0x194));var _0xee3f=function(_0x423593,_0x53468f){_0x423593=_0x423593-0x0;var _0x326e1e=_0xe3fe[_0x423593];return _0x326e1e;};'use strict';var SquareProjectEvents=require(_0xee3f('0x0'));var events=[_0xee3f('0x1'),'remove',_0xee3f('0x2')];function createListener(_0x932831,_0x563940){return function(_0x525a7f){_0x563940['emit'](_0x932831,_0x525a7f);};}function removeListener(_0x1204e0,_0x269058){return function(){SquareProjectEvents[_0xee3f('0x3')](_0x1204e0,_0x269058);};}exports['register']=function(_0xdf84e6){for(var _0x139e56=0x0,_0x419a54=events[_0xee3f('0x4')];_0x139e56<_0x419a54;_0x139e56++){var _0x2764ab=events[_0x139e56];var _0x22521e=createListener(_0xee3f('0x5')+_0x2764ab,_0xdf84e6);SquareProjectEvents['on'](_0x2764ab,_0x22521e);}}; \ No newline at end of file +var _0x2863=['register','squareProject:','./squareProject.events','save','remove','update','removeListener'];(function(_0xfe5bd6,_0xe53ffc){var _0x42896e=function(_0x551b81){while(--_0x551b81){_0xfe5bd6['push'](_0xfe5bd6['shift']());}};_0x42896e(++_0xe53ffc);}(_0x2863,0xdb));var _0x3286=function(_0x8e00e5,_0x1cae41){_0x8e00e5=_0x8e00e5-0x0;var _0x5d8c62=_0x2863[_0x8e00e5];return _0x5d8c62;};'use strict';var SquareProjectEvents=require(_0x3286('0x0'));var events=[_0x3286('0x1'),_0x3286('0x2'),_0x3286('0x3')];function createListener(_0x546bbb,_0x4bfc5f){return function(_0x3597cf){_0x4bfc5f['emit'](_0x546bbb,_0x3597cf);};}function removeListener(_0xc2e9c8,_0x358cb8){return function(){SquareProjectEvents[_0x3286('0x4')](_0xc2e9c8,_0x358cb8);};}exports[_0x3286('0x5')]=function(_0x2a952d){for(var _0x53bfda=0x0,_0x5379be=events['length'];_0x53bfda<_0x5379be;_0x53bfda++){var _0x36cca5=events[_0x53bfda];var _0x9e94fb=createListener(_0x3286('0x6')+_0x36cca5,_0x2a952d);SquareProjectEvents['on'](_0x36cca5,_0x9e94fb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6d4a3d0..c9c554c 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x522d8b,_0x21f430){var _0x5e0c73=function(_0x535457){while(--_0x535457){_0x522d8b['push'](_0x522d8b['shift']());}};_0x5e0c73(++_0x21f430);}(_0x326f,0xd1));var _0xf326=function(_0x2db5ed,_0x31ce60){_0x2db5ed=_0x2db5ed-0x0;var _0x1996f2=_0x326f[_0x2db5ed];return _0x1996f2;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e5c22,_0x1e450e){var _0x348888=function(_0x2e1499){while(--_0x2e1499){_0x2e5c22['push'](_0x2e5c22['shift']());}};_0x348888(++_0x1e450e);}(_0xf494,0x1c6));var _0x4f49=function(_0x58dda8,_0x2b5c7a){_0x58dda8=_0x58dda8-0x0;var _0xffa0c3=_0xf494[_0x58dda8];return _0xffa0c3;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 59786ef..5dd5567 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 _0x326f=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x2b001c,_0x31af40){var _0x45e604=function(_0x10115a){while(--_0x10115a){_0x2b001c['push'](_0x2b001c['shift']());}};_0x45e604(++_0x31af40);}(_0x326f,0xd1));var _0xf326=function(_0x1eab2e,_0x66697f){_0x1eab2e=_0x1eab2e-0x0;var _0x292b2f=_0x326f[_0x1eab2e];return _0x292b2f;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize[_0xf326('0x1')]},'extension':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize[_0xf326('0x1')]},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'dnid':{'type':Sequelize[_0xf326('0x1')]},'projectName':{'type':Sequelize[_0xf326('0x1')]},'saveName':{'type':Sequelize[_0xf326('0x1')]},'filename':{'type':Sequelize[_0xf326('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf326('0x2')],'get':function(){var _0x3851eb='';var _0x165f95=this[_0xf326('0x3')]('savePath');if(_0x165f95){_0x3851eb=_0x165f95['substring'](_0x165f95['lastIndexOf']('.'));}return _0x3851eb;}}}; \ No newline at end of file +var _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x13cd99,_0x50bd8d){var _0x1d42c7=function(_0x1fa433){while(--_0x1fa433){_0x13cd99['push'](_0x13cd99['shift']());}};_0x1d42c7(++_0x50bd8d);}(_0x2675,0x75));var _0x5267=function(_0x572997,_0x323709){_0x572997=_0x572997-0x0;var _0x1de5ae=_0x2675[_0x572997];return _0x1de5ae;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 65d3f53..ed24372 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 _0xe19f=['rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SquareRecording'];(function(_0x332684,_0x4c5b5b){var _0x42c520=function(_0x443b9b){while(--_0x443b9b){_0x332684['push'](_0x332684['shift']());}};_0x42c520(++_0x4c5b5b);}(_0xe19f,0x91));var _0xfe19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe19f[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe19('0x0'));var zipdir=require(_0xfe19('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe19('0x2'));var moment=require(_0xfe19('0x3'));var BPromise=require(_0xfe19('0x4'));var Mustache=require(_0xfe19('0x5'));var util=require(_0xfe19('0x6'));var path=require(_0xfe19('0x7'));var sox=require(_0xfe19('0x8'));var csv=require('to-csv');var ejs=require(_0xfe19('0x9'));var fs=require('fs');var fs_extra=require(_0xfe19('0xa'));var _=require(_0xfe19('0xb'));var squel=require(_0xfe19('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe19('0xd'));var deskjs=require(_0xfe19('0xe'));var toCsv=require(_0xfe19('0xf'));var querystring=require('querystring');var Papa=require(_0xfe19('0x10'));var Redis=require(_0xfe19('0x11'));var authService=require(_0xfe19('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfe19('0x13'));var hardwareService=require(_0xfe19('0x14'));var logger=require(_0xfe19('0x15'))('api');var utils=require(_0xfe19('0x16'));var config=require(_0xfe19('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe19('0x18'))['db'];function respondWithStatusCode(_0x2a6384,_0x3d45db){_0x3d45db=_0x3d45db||0xcc;return function(_0x4346c3){if(_0x4346c3){return _0x2a6384[_0xfe19('0x19')](_0x3d45db);}return _0x2a6384[_0xfe19('0x1a')](_0x3d45db)['end']();};}function respondWithResult(_0x553f20,_0x50d701){_0x50d701=_0x50d701||0xc8;return function(_0x502e06){if(_0x502e06){return _0x553f20[_0xfe19('0x1a')](_0x50d701)[_0xfe19('0x1b')](_0x502e06);}};}function respondWithFilteredResult(_0x5bfe4d,_0xd784e8){return function(_0x51cb79){if(_0x51cb79){var _0x3cb1f0=typeof _0xd784e8[_0xfe19('0x1c')]===_0xfe19('0x1d')&&typeof _0xd784e8[_0xfe19('0x1e')]===_0xfe19('0x1d');var _0x3ef3c8=_0x51cb79[_0xfe19('0x1f')];var _0x74ba32=_0x3cb1f0?0x0:_0xd784e8[_0xfe19('0x1c')];var _0x10b122=_0x3cb1f0?_0x51cb79[_0xfe19('0x1f')]:_0xd784e8['offset']+_0xd784e8[_0xfe19('0x1e')];var _0xdb586f;if(_0x10b122>=_0x3ef3c8){_0x10b122=_0x3ef3c8;_0xdb586f=0xc8;}else{_0xdb586f=0xce;}_0x5bfe4d[_0xfe19('0x1a')](_0xdb586f);return _0x5bfe4d[_0xfe19('0x20')](_0xfe19('0x21'),_0x74ba32+'-'+_0x10b122+'/'+_0x3ef3c8)['json'](_0x51cb79);}return null;};}function patchUpdates(_0x34a574){return function(_0xb8a019){try{jsonpatch[_0xfe19('0x22')](_0xb8a019,_0x34a574,!![]);}catch(_0x5bfa91){return BPromise[_0xfe19('0x23')](_0x5bfa91);}return _0xb8a019['save']();};}function saveUpdates(_0x1cb7da,_0x1876cc){return function(_0x589ace){if(_0x589ace){return _0x589ace[_0xfe19('0x24')](_0x1cb7da)[_0xfe19('0x25')](function(_0x1a8138){return _0x1a8138;});}return null;};}function removeEntity(_0x2c18fd,_0x2c7631){return function(_0xac6c9d){if(_0xac6c9d){return _0xac6c9d[_0xfe19('0x26')]()[_0xfe19('0x25')](function(){_0x2c18fd['status'](0xcc)[_0xfe19('0x27')]();});}};}function handleEntityNotFound(_0x376389,_0x11e2e){return function(_0x49d4f2){if(!_0x49d4f2){_0x376389[_0xfe19('0x19')](0x194);}return _0x49d4f2;};}function handleError(_0x5df982,_0x5e87f3){_0x5e87f3=_0x5e87f3||0x1f4;return function(_0x1e8bc0){logger[_0xfe19('0x28')](_0x1e8bc0[_0xfe19('0x29')]);if(_0x1e8bc0[_0xfe19('0x2a')]){delete _0x1e8bc0[_0xfe19('0x2a')];}_0x5df982[_0xfe19('0x1a')](_0x5e87f3)[_0xfe19('0x2b')](_0x1e8bc0);};}exports[_0xfe19('0x2c')]=function(_0x182aa6,_0x119d1f){var _0x1e1dc2={},_0x4408ed={},_0xcd880a={'count':0x0,'rows':[]};var _0x3ea4d9=_[_0xfe19('0x2d')](db[_0xfe19('0x2e')][_0xfe19('0x2f')],function(_0x4ba563){return{'name':_0x4ba563['fieldName'],'type':_0x4ba563[_0xfe19('0x30')][_0xfe19('0x31')]};});_0x4408ed[_0xfe19('0x32')]=_[_0xfe19('0x2d')](_0x3ea4d9,_0xfe19('0x2a'));_0x4408ed[_0xfe19('0x33')]=_[_0xfe19('0x34')](_0x182aa6[_0xfe19('0x33')]);_0x4408ed[_0xfe19('0x35')]=_[_0xfe19('0x36')](_0x4408ed[_0xfe19('0x32')],_0x4408ed[_0xfe19('0x33')]);_0x1e1dc2['attributes']=_['intersection'](_0x4408ed[_0xfe19('0x32')],qs[_0xfe19('0x37')](_0x182aa6['query'][_0xfe19('0x37')]));_0x1e1dc2['attributes']=_0x1e1dc2['attributes'][_0xfe19('0x38')]?_0x1e1dc2[_0xfe19('0x39')]:_0x4408ed['model'];if(!_0x182aa6[_0xfe19('0x33')]['hasOwnProperty'](_0xfe19('0x3a'))){_0x1e1dc2[_0xfe19('0x1e')]=qs[_0xfe19('0x1e')](_0x182aa6['query'][_0xfe19('0x1e')]);_0x1e1dc2['offset']=qs['offset'](_0x182aa6[_0xfe19('0x33')][_0xfe19('0x1c')]);}_0x1e1dc2[_0xfe19('0x3b')]=qs[_0xfe19('0x3c')](_0x182aa6['query'][_0xfe19('0x3c')]);_0x1e1dc2[_0xfe19('0x3d')]=qs[_0xfe19('0x35')](_['pick'](_0x182aa6[_0xfe19('0x33')],_0x4408ed[_0xfe19('0x35')]),_0x3ea4d9);if(_0x182aa6['query'][_0xfe19('0x3e')]){_0x1e1dc2[_0xfe19('0x3d')]=_[_0xfe19('0x3f')](_0x1e1dc2[_0xfe19('0x3d')],{'$or':_[_0xfe19('0x2d')](_0x3ea4d9,function(_0x2cdeee){if(_0x2cdeee[_0xfe19('0x30')]!==_0xfe19('0x40')){var _0x54ff25={};_0x54ff25[_0x2cdeee[_0xfe19('0x2a')]]={'$like':'%'+_0x182aa6['query'][_0xfe19('0x3e')]+'%'};return _0x54ff25;}})});}_0x1e1dc2=_[_0xfe19('0x3f')]({},_0x1e1dc2,_0x182aa6[_0xfe19('0x41')]);var _0x5b75b1={'where':_0x1e1dc2[_0xfe19('0x3d')]};return db[_0xfe19('0x2e')][_0xfe19('0x1f')](_0x5b75b1)[_0xfe19('0x25')](function(_0x45655c){_0xcd880a[_0xfe19('0x1f')]=_0x45655c;if(_0x182aa6['query'][_0xfe19('0x42')]){_0x1e1dc2['include']=[{'all':!![]}];}return db[_0xfe19('0x2e')][_0xfe19('0x43')](_0x1e1dc2);})[_0xfe19('0x25')](function(_0x5a9c0c){_0xcd880a['rows']=_0x5a9c0c;return _0xcd880a;})['then'](respondWithFilteredResult(_0x119d1f,_0x1e1dc2))[_0xfe19('0x44')](handleError(_0x119d1f,null));};exports[_0xfe19('0x45')]=function(_0x1fcb33,_0x332cd4){var _0x5ab222={'raw':!![],'where':{'id':_0x1fcb33[_0xfe19('0x46')]['id']}},_0x3cce1f={};_0x3cce1f[_0xfe19('0x32')]=_['keys'](db[_0xfe19('0x2e')]['rawAttributes']);_0x3cce1f[_0xfe19('0x33')]=_[_0xfe19('0x34')](_0x1fcb33['query']);_0x3cce1f[_0xfe19('0x35')]=_[_0xfe19('0x36')](_0x3cce1f[_0xfe19('0x32')],_0x3cce1f[_0xfe19('0x33')]);_0x5ab222['attributes']=_['intersection'](_0x3cce1f[_0xfe19('0x32')],qs[_0xfe19('0x37')](_0x1fcb33[_0xfe19('0x33')][_0xfe19('0x37')]));_0x5ab222[_0xfe19('0x39')]=_0x5ab222[_0xfe19('0x39')][_0xfe19('0x38')]?_0x5ab222[_0xfe19('0x39')]:_0x3cce1f[_0xfe19('0x32')];if(_0x1fcb33['query'][_0xfe19('0x42')]){_0x5ab222[_0xfe19('0x47')]=[{'all':!![]}];}_0x5ab222=_[_0xfe19('0x3f')]({},_0x5ab222,_0x1fcb33[_0xfe19('0x41')]);return db['SquareRecording']['find'](_0x5ab222)[_0xfe19('0x25')](handleEntityNotFound(_0x332cd4,null))['then'](respondWithResult(_0x332cd4,null))['catch'](handleError(_0x332cd4,null));};exports[_0xfe19('0x48')]=function(_0x1cba50,_0x39c082){return db[_0xfe19('0x2e')][_0xfe19('0x48')](_0x1cba50[_0xfe19('0x49')],{})[_0xfe19('0x25')](respondWithResult(_0x39c082,0xc9))[_0xfe19('0x44')](handleError(_0x39c082,null));};exports[_0xfe19('0x24')]=function(_0x211bc7,_0x2080ff){if(_0x211bc7[_0xfe19('0x49')]['id']){delete _0x211bc7[_0xfe19('0x49')]['id'];}return db[_0xfe19('0x2e')][_0xfe19('0x4a')]({'where':{'id':_0x211bc7[_0xfe19('0x46')]['id']}})['then'](handleEntityNotFound(_0x2080ff,null))[_0xfe19('0x25')](saveUpdates(_0x211bc7[_0xfe19('0x49')],null))['then'](respondWithResult(_0x2080ff,null))[_0xfe19('0x44')](handleError(_0x2080ff,null));};exports[_0xfe19('0x4b')]=function(_0x57b569,_0x6b16fd,_0xa93356){var _0x40261b=require(_0xfe19('0x4c'));var _0x5c8e6c=![];var _0x2c5261={};if(_0x57b569[_0xfe19('0x33')][_0xfe19('0x30')]&&_0x57b569['query'][_0xfe19('0x30')]===_0xfe19('0x4d')){_0x2c5261[_0xfe19('0x4d')]=_0x57b569['params']['id'];}else{_0x2c5261['id']=_0x57b569['params']['id'];}return db[_0xfe19('0x2e')][_0xfe19('0x4a')]({'where':_0x2c5261,'attributes':['id',_0xfe19('0x4e'),_0xfe19('0x4f')],'raw':!![]})[_0xfe19('0x25')](handleEntityNotFound(_0x6b16fd,null))[_0xfe19('0x25')](function(_0x4578aa){if(_0x4578aa){var _0x5d1e47=_0x4578aa['savePath'];var _0x28bf53=util[_0xfe19('0x50')](_0xfe19('0x51'),_0x5d1e47);if(fs[_0xfe19('0x52')](_0x28bf53)){_0x5c8e6c=!![];return _0x40261b['decryptFile'](_0x28bf53,_0x5d1e47,config['secrets'][_0xfe19('0x53')])['then'](function(){return _0x4578aa;});}return _0x4578aa;}})[_0xfe19('0x25')](function(_0x5539b0){if(_0x5539b0){var _0x20b398=_0x5539b0[_0xfe19('0x4e')];if(!fs[_0xfe19('0x52')](_0x20b398)){throw new db[(_0xfe19('0x54'))]['ValidationError'](_0xfe19('0x55'));}if(_0x5539b0[_0xfe19('0x4f')]){return _0x6b16fd['download'](_0x20b398,_0x5539b0[_0xfe19('0x4f')]+path[_0xfe19('0x56')](_0x20b398),function(){if(_0x5c8e6c){fs[_0xfe19('0x57')](_0x20b398);}});}else{return _0x6b16fd['download'](_0x20b398,function(_0xb0d367){if(_0x5c8e6c){fs[_0xfe19('0x57')](_0x20b398);}});}}})[_0xfe19('0x44')](function(_0x275040){if(_0x275040[_0xfe19('0x58')]===_0xfe19('0x55')){_0x6b16fd[_0xfe19('0x1a')](0x194)[_0xfe19('0x2b')]('Not\x20found');}else{return handleError(_0x6b16fd,null);}});};exports['destroy']=function(_0x42c5ce,_0x2bcbaa){return db[_0xfe19('0x2e')][_0xfe19('0x4a')]({'where':{'id':_0x42c5ce[_0xfe19('0x46')]['id']}})[_0xfe19('0x25')](function(_0x21bd4f){if(_['isNil'](_0x21bd4f)){throw new ReferenceError('Entity\x20not\x20found');}return _0x21bd4f;})[_0xfe19('0x25')](function(_0x24e8a4){var _0x498d55=_0x24e8a4[_0xfe19('0x4e')];logger[_0xfe19('0x59')](_0xfe19('0x5a'),_0x498d55);if(!_[_0xfe19('0x5b')](_0x24e8a4[_0xfe19('0x4e')])&&fs['existsSync'](_0x498d55)){logger['info'](_0xfe19('0x5c')+_0x498d55+_0xfe19('0x5d'));fs[_0xfe19('0x5e')](_0x498d55);}_0x498d55=_0x498d55+_0xfe19('0x5f');if(!_[_0xfe19('0x5b')](_0x24e8a4[_0xfe19('0x4e')])&&fs[_0xfe19('0x52')](_0x498d55)){logger[_0xfe19('0x59')](_0xfe19('0x5c')+_0x498d55+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfe19('0x5e')](_0x498d55);}return _0x24e8a4;})['then'](function(_0x3e8656){if(!_0x3e8656)throw new InternalError();return _0x3e8656[_0xfe19('0x26')]();})[_0xfe19('0x25')](function(){_0x2bcbaa['status'](0xcc)[_0xfe19('0x27')]();})[_0xfe19('0x44')](handleError(_0x2bcbaa,null));}; \ No newline at end of file +var _0xe460=['include','findAll','rows','catch','show','params','create','body','update','find','download','type','savePath','filename','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','SquareRecording'];(function(_0x57abcd,_0x20104c){var _0x3cfb7e=function(_0x32672c){while(--_0x32672c){_0x57abcd['push'](_0x57abcd['shift']());}};_0x3cfb7e(++_0x20104c);}(_0xe460,0x188));var _0x0e46=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xe460[_0x38c632];return _0x12737e;};'use strict';var emlformat=require(_0x0e46('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e46('0x1'));var rp=require(_0x0e46('0x2'));var moment=require('moment');var BPromise=require(_0x0e46('0x3'));var Mustache=require(_0x0e46('0x4'));var util=require(_0x0e46('0x5'));var path=require(_0x0e46('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e46('0x7'));var fs=require('fs');var fs_extra=require(_0x0e46('0x8'));var _=require(_0x0e46('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e46('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e46('0xb'));var Papa=require('papaparse');var Redis=require(_0x0e46('0xc'));var authService=require(_0x0e46('0xd'));var qs=require(_0x0e46('0xe'));var as=require(_0x0e46('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e46('0x10'))(_0x0e46('0x11'));var utils=require('../../config/utils');var config=require(_0x0e46('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e46('0x13'))['db'];function respondWithStatusCode(_0x5f50f8,_0x53d381){_0x53d381=_0x53d381||0xcc;return function(_0x11a0c9){if(_0x11a0c9){return _0x5f50f8[_0x0e46('0x14')](_0x53d381);}return _0x5f50f8[_0x0e46('0x15')](_0x53d381)[_0x0e46('0x16')]();};}function respondWithResult(_0x49d9a2,_0x233bdb){_0x233bdb=_0x233bdb||0xc8;return function(_0x1a0984){if(_0x1a0984){return _0x49d9a2[_0x0e46('0x15')](_0x233bdb)[_0x0e46('0x17')](_0x1a0984);}};}function respondWithFilteredResult(_0x42e779,_0x273d7b){return function(_0xbf95){if(_0xbf95){var _0x395797=typeof _0x273d7b[_0x0e46('0x18')]===_0x0e46('0x19')&&typeof _0x273d7b[_0x0e46('0x1a')]===_0x0e46('0x19');var _0x10adec=_0xbf95[_0x0e46('0x1b')];var _0x56bfc4=_0x395797?0x0:_0x273d7b[_0x0e46('0x18')];var _0xdaccf5=_0x395797?_0xbf95['count']:_0x273d7b[_0x0e46('0x18')]+_0x273d7b['limit'];var _0x225cc4;if(_0xdaccf5>=_0x10adec){_0xdaccf5=_0x10adec;_0x225cc4=0xc8;}else{_0x225cc4=0xce;}_0x42e779[_0x0e46('0x15')](_0x225cc4);return _0x42e779[_0x0e46('0x1c')](_0x0e46('0x1d'),_0x56bfc4+'-'+_0xdaccf5+'/'+_0x10adec)['json'](_0xbf95);}return null;};}function patchUpdates(_0x3d9199){return function(_0x57ede0){try{jsonpatch['apply'](_0x57ede0,_0x3d9199,!![]);}catch(_0x2f7859){return BPromise[_0x0e46('0x1e')](_0x2f7859);}return _0x57ede0[_0x0e46('0x1f')]();};}function saveUpdates(_0xb774e6,_0x445368){return function(_0x42e863){if(_0x42e863){return _0x42e863['update'](_0xb774e6)[_0x0e46('0x20')](function(_0x144a59){return _0x144a59;});}return null;};}function removeEntity(_0x24a355,_0x203921){return function(_0x40f09e){if(_0x40f09e){return _0x40f09e['destroy']()[_0x0e46('0x20')](function(){_0x24a355[_0x0e46('0x15')](0xcc)[_0x0e46('0x16')]();});}};}function handleEntityNotFound(_0x29b43,_0x337a47){return function(_0x362dda){if(!_0x362dda){_0x29b43[_0x0e46('0x14')](0x194);}return _0x362dda;};}function handleError(_0x2d99b8,_0x54c611){_0x54c611=_0x54c611||0x1f4;return function(_0x99a8b1){logger['error'](_0x99a8b1['stack']);if(_0x99a8b1[_0x0e46('0x21')]){delete _0x99a8b1[_0x0e46('0x21')];}_0x2d99b8[_0x0e46('0x15')](_0x54c611)[_0x0e46('0x22')](_0x99a8b1);};}exports[_0x0e46('0x23')]=function(_0x3274a4,_0x44d992){var _0x43eaf8={},_0x309a4f={},_0x2ae69={'count':0x0,'rows':[]};var _0x4ecc96=_[_0x0e46('0x24')](db['SquareRecording'][_0x0e46('0x25')],function(_0x46f006){return{'name':_0x46f006['fieldName'],'type':_0x46f006['type'][_0x0e46('0x26')]};});_0x309a4f[_0x0e46('0x27')]=_['map'](_0x4ecc96,'name');_0x309a4f[_0x0e46('0x28')]=_[_0x0e46('0x29')](_0x3274a4[_0x0e46('0x28')]);_0x309a4f[_0x0e46('0x2a')]=_['intersection'](_0x309a4f[_0x0e46('0x27')],_0x309a4f[_0x0e46('0x28')]);_0x43eaf8['attributes']=_[_0x0e46('0x2b')](_0x309a4f[_0x0e46('0x27')],qs[_0x0e46('0x2c')](_0x3274a4[_0x0e46('0x28')][_0x0e46('0x2c')]));_0x43eaf8[_0x0e46('0x2d')]=_0x43eaf8[_0x0e46('0x2d')][_0x0e46('0x2e')]?_0x43eaf8['attributes']:_0x309a4f[_0x0e46('0x27')];if(!_0x3274a4[_0x0e46('0x28')][_0x0e46('0x2f')](_0x0e46('0x30'))){_0x43eaf8[_0x0e46('0x1a')]=qs['limit'](_0x3274a4[_0x0e46('0x28')]['limit']);_0x43eaf8['offset']=qs[_0x0e46('0x18')](_0x3274a4[_0x0e46('0x28')]['offset']);}_0x43eaf8[_0x0e46('0x31')]=qs[_0x0e46('0x32')](_0x3274a4[_0x0e46('0x28')][_0x0e46('0x32')]);_0x43eaf8[_0x0e46('0x33')]=qs[_0x0e46('0x2a')](_[_0x0e46('0x34')](_0x3274a4['query'],_0x309a4f['filters']),_0x4ecc96);if(_0x3274a4['query']['filter']){_0x43eaf8['where']=_['merge'](_0x43eaf8[_0x0e46('0x33')],{'$or':_[_0x0e46('0x24')](_0x4ecc96,function(_0x445dc3){if(_0x445dc3['type']!==_0x0e46('0x35')){var _0x34ea43={};_0x34ea43[_0x445dc3[_0x0e46('0x21')]]={'$like':'%'+_0x3274a4[_0x0e46('0x28')][_0x0e46('0x36')]+'%'};return _0x34ea43;}})});}_0x43eaf8=_[_0x0e46('0x37')]({},_0x43eaf8,_0x3274a4[_0x0e46('0x38')]);var _0x489f44={'where':_0x43eaf8[_0x0e46('0x33')]};return db[_0x0e46('0x39')]['count'](_0x489f44)[_0x0e46('0x20')](function(_0x46bc38){_0x2ae69[_0x0e46('0x1b')]=_0x46bc38;if(_0x3274a4[_0x0e46('0x28')]['includeAll']){_0x43eaf8[_0x0e46('0x3a')]=[{'all':!![]}];}return db['SquareRecording'][_0x0e46('0x3b')](_0x43eaf8);})['then'](function(_0x437c60){_0x2ae69[_0x0e46('0x3c')]=_0x437c60;return _0x2ae69;})[_0x0e46('0x20')](respondWithFilteredResult(_0x44d992,_0x43eaf8))[_0x0e46('0x3d')](handleError(_0x44d992,null));};exports[_0x0e46('0x3e')]=function(_0x4a3938,_0x547923){var _0x585a88={'raw':!![],'where':{'id':_0x4a3938[_0x0e46('0x3f')]['id']}},_0x579175={};_0x579175[_0x0e46('0x27')]=_['keys'](db['SquareRecording'][_0x0e46('0x25')]);_0x579175['query']=_['keys'](_0x4a3938[_0x0e46('0x28')]);_0x579175[_0x0e46('0x2a')]=_[_0x0e46('0x2b')](_0x579175[_0x0e46('0x27')],_0x579175[_0x0e46('0x28')]);_0x585a88[_0x0e46('0x2d')]=_[_0x0e46('0x2b')](_0x579175[_0x0e46('0x27')],qs[_0x0e46('0x2c')](_0x4a3938[_0x0e46('0x28')][_0x0e46('0x2c')]));_0x585a88['attributes']=_0x585a88[_0x0e46('0x2d')][_0x0e46('0x2e')]?_0x585a88[_0x0e46('0x2d')]:_0x579175[_0x0e46('0x27')];if(_0x4a3938[_0x0e46('0x28')]['includeAll']){_0x585a88['include']=[{'all':!![]}];}_0x585a88=_['merge']({},_0x585a88,_0x4a3938[_0x0e46('0x38')]);return db[_0x0e46('0x39')]['find'](_0x585a88)[_0x0e46('0x20')](handleEntityNotFound(_0x547923,null))[_0x0e46('0x20')](respondWithResult(_0x547923,null))[_0x0e46('0x3d')](handleError(_0x547923,null));};exports[_0x0e46('0x40')]=function(_0x55bd59,_0x43f8d2){return db[_0x0e46('0x39')][_0x0e46('0x40')](_0x55bd59[_0x0e46('0x41')],{})['then'](respondWithResult(_0x43f8d2,0xc9))['catch'](handleError(_0x43f8d2,null));};exports[_0x0e46('0x42')]=function(_0x57aab,_0x1b5784){if(_0x57aab['body']['id']){delete _0x57aab['body']['id'];}return db[_0x0e46('0x39')][_0x0e46('0x43')]({'where':{'id':_0x57aab[_0x0e46('0x3f')]['id']}})[_0x0e46('0x20')](handleEntityNotFound(_0x1b5784,null))[_0x0e46('0x20')](saveUpdates(_0x57aab['body'],null))[_0x0e46('0x20')](respondWithResult(_0x1b5784,null))[_0x0e46('0x3d')](handleError(_0x1b5784,null));};exports[_0x0e46('0x44')]=function(_0x2f2b26,_0xd455e0,_0x1b8c3d){var _0x1b291a=require('../../components/encryptor');var _0x587cda=![];var _0x461c00={};if(_0x2f2b26['query'][_0x0e46('0x45')]&&_0x2f2b26[_0x0e46('0x28')][_0x0e46('0x45')]==='uniqueid'){_0x461c00['uniqueid']=_0x2f2b26[_0x0e46('0x3f')]['id'];}else{_0x461c00['id']=_0x2f2b26[_0x0e46('0x3f')]['id'];}return db[_0x0e46('0x39')]['find']({'where':_0x461c00,'attributes':['id',_0x0e46('0x46'),_0x0e46('0x47')],'raw':!![]})[_0x0e46('0x20')](handleEntityNotFound(_0xd455e0,null))[_0x0e46('0x20')](function(_0x2b2f50){if(_0x2b2f50){var _0x3bf90e=_0x2b2f50[_0x0e46('0x46')];var _0x258cb9=util['format']('%s.cypher',_0x3bf90e);if(fs[_0x0e46('0x48')](_0x258cb9)){_0x587cda=!![];return _0x1b291a[_0x0e46('0x49')](_0x258cb9,_0x3bf90e,config[_0x0e46('0x4a')]['recording'])[_0x0e46('0x20')](function(){return _0x2b2f50;});}return _0x2b2f50;}})['then'](function(_0x255e24){if(_0x255e24){var _0x2003fe=_0x255e24['savePath'];if(!fs[_0x0e46('0x48')](_0x2003fe)){throw new db[(_0x0e46('0x4b'))][(_0x0e46('0x4c'))](_0x0e46('0x4d'));}if(_0x255e24[_0x0e46('0x47')]){return _0xd455e0[_0x0e46('0x44')](_0x2003fe,_0x255e24[_0x0e46('0x47')]+path['extname'](_0x2003fe),function(){if(_0x587cda){fs[_0x0e46('0x4e')](_0x2003fe);}});}else{return _0xd455e0['download'](_0x2003fe,function(_0x4d2249){if(_0x587cda){fs['unlink'](_0x2003fe);}});}}})[_0x0e46('0x3d')](function(_0x5a079a){if(_0x5a079a[_0x0e46('0x4f')]==='SquareRecording\x20not\x20found'){_0xd455e0[_0x0e46('0x15')](0x194)[_0x0e46('0x22')](_0x0e46('0x50'));}else{return handleError(_0xd455e0,null);}});};exports[_0x0e46('0x51')]=function(_0x2cf413,_0x13d7e5){return db[_0x0e46('0x39')][_0x0e46('0x43')]({'where':{'id':_0x2cf413[_0x0e46('0x3f')]['id']}})['then'](function(_0x23ce1d){if(_[_0x0e46('0x52')](_0x23ce1d)){throw new ReferenceError(_0x0e46('0x53'));}return _0x23ce1d;})[_0x0e46('0x20')](function(_0x433ef7){var _0x3365fd=_0x433ef7['savePath'];logger[_0x0e46('0x54')](_0x0e46('0x55'),_0x3365fd);if(!_[_0x0e46('0x52')](_0x433ef7[_0x0e46('0x46')])&&fs[_0x0e46('0x48')](_0x3365fd)){logger[_0x0e46('0x54')]('File:\x20\x22'+_0x3365fd+_0x0e46('0x56'));fs[_0x0e46('0x57')](_0x3365fd);}_0x3365fd=_0x3365fd+_0x0e46('0x58');if(!_[_0x0e46('0x52')](_0x433ef7[_0x0e46('0x46')])&&fs[_0x0e46('0x48')](_0x3365fd)){logger[_0x0e46('0x54')](_0x0e46('0x59')+_0x3365fd+_0x0e46('0x56'));fs[_0x0e46('0x57')](_0x3365fd);}return _0x433ef7;})[_0x0e46('0x20')](function(_0x2c16e1){if(!_0x2c16e1)throw new InternalError();return _0x2c16e1['destroy']();})[_0x0e46('0x20')](function(){_0x13d7e5['status'](0xcc)[_0x0e46('0x16')]();})[_0x0e46('0x3d')](handleError(_0x13d7e5,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 57133ce..575bb0e 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 _0x62cf=['bluebird','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','moment'];(function(_0x21232a,_0x14ceef){var _0x594be6=function(_0x310296){while(--_0x310296){_0x21232a['push'](_0x21232a['shift']());}};_0x594be6(++_0x14ceef);}(_0x62cf,0x81));var _0xf62c=function(_0x2f1f6a,_0x3c1d6a){_0x2f1f6a=_0x2f1f6a-0x0;var _0x83fca3=_0x62cf[_0x2f1f6a];return _0x83fca3;};'use strict';var _=require(_0xf62c('0x0'));var util=require('util');var logger=require(_0xf62c('0x1'))('api');var moment=require(_0xf62c('0x2'));var BPromise=require(_0xf62c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var attributes=require(_0xf62c('0x6'));module[_0xf62c('0x7')]=function(_0x3604f0,_0x40487e){return _0x3604f0[_0xf62c('0x8')](_0xf62c('0x9'),attributes,{'tableName':_0xf62c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1893=['rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x481cba,_0x2def2d){var _0x3c5a1b=function(_0x28a3ef){while(--_0x28a3ef){_0x481cba['push'](_0x481cba['shift']());}};_0x3c5a1b(++_0x2def2d);}(_0x1893,0xa2));var _0x3189=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0x1893[_0x48961c];return _0x1d895d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 2f423a3..78f8731 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 _0x81a1=['client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x81a1,0xea));var _0x181a=function(_0x4c4dbc,_0x15bb88){_0x4c4dbc=_0x4c4dbc-0x0;var _0x4bc137=_0x81a1[_0x4c4dbc];return _0x4bc137;};'use strict';var _=require(_0x181a('0x0'));var util=require(_0x181a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x181a('0x2'));var fs=require('fs');var Redis=require(_0x181a('0x3'));var db=require(_0x181a('0x4'))['db'];var utils=require(_0x181a('0x5'));var logger=require(_0x181a('0x6'))(_0x181a('0x7'));var config=require('../../config/environment');var jayson=require(_0x181a('0x8'));var client=jayson[_0x181a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19c2ad,_0x5f0f5f,_0x348792){return new BPromise(function(_0x1ebbc2,_0x47e1ad){return client[_0x181a('0xa')](_0x19c2ad,_0x348792)[_0x181a('0xb')](function(_0x360971){logger[_0x181a('0xc')](_0x181a('0xd'),_0x5f0f5f,_0x181a('0xe'));logger[_0x181a('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5f0f5f,_0x181a('0xe'),JSON['stringify'](_0x360971));if(_0x360971[_0x181a('0x10')]){if(_0x360971[_0x181a('0x10')][_0x181a('0x11')]===0x1f4){logger['error'](_0x181a('0xd'),_0x5f0f5f,_0x360971[_0x181a('0x10')][_0x181a('0x12')]);return _0x47e1ad(_0x360971[_0x181a('0x10')][_0x181a('0x12')]);}logger['error'](_0x181a('0xd'),_0x5f0f5f,_0x360971[_0x181a('0x10')][_0x181a('0x12')]);return _0x1ebbc2(_0x360971['error']['message']);}else{logger['info'](_0x181a('0xd'),_0x5f0f5f,_0x181a('0xe'));_0x1ebbc2(_0x360971[_0x181a('0x13')][_0x181a('0x12')]);}})[_0x181a('0x14')](function(_0x39e96d){logger[_0x181a('0x10')]('SquareRecording,\x20%s,\x20%s',_0x5f0f5f,_0x39e96d);_0x47e1ad(_0x39e96d);});});}exports['CreateSquareRecording']=function(_0x4eeee2){var _0x1ae74d=this;return new Promise(function(_0x261231,_0x301808){return db[_0x181a('0x15')][_0x181a('0x16')](_0x4eeee2[_0x181a('0x17')],{'raw':_0x4eeee2[_0x181a('0x18')]?_0x4eeee2['options'][_0x181a('0x19')]===undefined?!![]:![]:!![]})[_0x181a('0xb')](function(_0x44ec7a){logger[_0x181a('0xc')](_0x181a('0x1a'),_0x4eeee2);logger[_0x181a('0xf')]('CreateSquareRecording',_0x4eeee2,JSON['stringify'](_0x44ec7a));_0x261231(_0x44ec7a);})['catch'](function(_0x4a143c){logger[_0x181a('0x10')](_0x181a('0x1a'),_0x4a143c[_0x181a('0x12')],_0x4eeee2);_0x301808(_0x1ae74d[_0x181a('0x10')](0x1f4,_0x4a143c[_0x181a('0x12')]));});});}; \ No newline at end of file +var _0x0374=['message','catch','CreateSquareRecording','SquareRecording','create','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x23acaf,_0x406d90){var _0x16015d=function(_0x1c2066){while(--_0x1c2066){_0x23acaf['push'](_0x23acaf['shift']());}};_0x16015d(++_0x406d90);}(_0x0374,0xf8));var _0x4037=function(_0x1bc180,_0x100e5a){_0x1bc180=_0x1bc180-0x0;var _0x244a4d=_0x0374[_0x1bc180];return _0x244a4d;};'use strict';var _=require(_0x4037('0x0'));var util=require(_0x4037('0x1'));var moment=require(_0x4037('0x2'));var BPromise=require(_0x4037('0x3'));var rs=require(_0x4037('0x4'));var fs=require('fs');var Redis=require(_0x4037('0x5'));var db=require(_0x4037('0x6'))['db'];var utils=require(_0x4037('0x7'));var logger=require(_0x4037('0x8'))(_0x4037('0x9'));var config=require(_0x4037('0xa'));var jayson=require(_0x4037('0xb'));var client=jayson[_0x4037('0xc')][_0x4037('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x448be1,_0xecda1d,_0x1517ef){return new BPromise(function(_0x43928f,_0x6f9a86){return client['request'](_0x448be1,_0x1517ef)[_0x4037('0xe')](function(_0x499089){logger[_0x4037('0xf')](_0x4037('0x10'),_0xecda1d,_0x4037('0x11'));logger['debug'](_0x4037('0x12'),_0xecda1d,_0x4037('0x11'),JSON[_0x4037('0x13')](_0x499089));if(_0x499089[_0x4037('0x14')]){if(_0x499089[_0x4037('0x14')][_0x4037('0x15')]===0x1f4){logger['error'](_0x4037('0x10'),_0xecda1d,_0x499089[_0x4037('0x14')][_0x4037('0x16')]);return _0x6f9a86(_0x499089[_0x4037('0x14')]['message']);}logger[_0x4037('0x14')](_0x4037('0x10'),_0xecda1d,_0x499089['error'][_0x4037('0x16')]);return _0x43928f(_0x499089['error'][_0x4037('0x16')]);}else{logger[_0x4037('0xf')](_0x4037('0x10'),_0xecda1d,_0x4037('0x11'));_0x43928f(_0x499089['result'][_0x4037('0x16')]);}})[_0x4037('0x17')](function(_0x270a62){logger[_0x4037('0x14')]('SquareRecording,\x20%s,\x20%s',_0xecda1d,_0x270a62);_0x6f9a86(_0x270a62);});});}exports[_0x4037('0x18')]=function(_0x23af45){var _0x67effe=this;return new Promise(function(_0x48f259,_0x43fbc9){return db[_0x4037('0x19')][_0x4037('0x1a')](_0x23af45['body'],{'raw':_0x23af45['options']?_0x23af45[_0x4037('0x1b')][_0x4037('0x1c')]===undefined?!![]:![]:!![]})[_0x4037('0xe')](function(_0x18f960){logger[_0x4037('0xf')](_0x4037('0x18'),_0x23af45);logger[_0x4037('0x1d')](_0x4037('0x18'),_0x23af45,JSON[_0x4037('0x13')](_0x18f960));_0x48f259(_0x18f960);})[_0x4037('0x17')](function(_0x52a284){logger[_0x4037('0x14')](_0x4037('0x18'),_0x52a284[_0x4037('0x16')],_0x23af45);_0x43fbc9(_0x67effe['error'](0x1f4,_0x52a284[_0x4037('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index df78977..fd934c8 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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x222121,_0x320c52){var _0x3602ee=function(_0x2ed4ec){while(--_0x2ed4ec){_0x222121['push'](_0x222121['shift']());}};_0x3602ee(++_0x320c52);}(_0xb10b,0x12a));var _0xbb10=function(_0x20a1b0,_0x18fe84){_0x20a1b0=_0x20a1b0-0x0;var _0x321e14=_0xb10b[_0x20a1b0];return _0x321e14;};'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 _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(_0x25cc3e,_0x71799b){var _0x13235a=function(_0x8a52ab){while(--_0x8a52ab){_0x25cc3e['push'](_0x25cc3e['shift']());}};_0x13235a(++_0x71799b);}(_0xe706,0xa3));var _0x6e70=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xe706[_0x2ddfd9];return _0x2668f0;};'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 d08d6a7..ecc115b 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 _0xa9ce=['STRING','DATE','BOOLEAN'];(function(_0x14bf63,_0xdbd373){var _0x410d22=function(_0x2e5e3a){while(--_0x2e5e3a){_0x14bf63['push'](_0x14bf63['shift']());}};_0x410d22(++_0xdbd373);}(_0xa9ce,0x14a));var _0xea9c=function(_0x2459b4,_0x56b89a){_0x2459b4=_0x2459b4-0x0;var _0xf1caab=_0xa9ce[_0x2459b4];return _0xf1caab;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0xea9c('0x0')]},'network_script':{'type':Sequelize[_0xea9c('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xea9c('0x0')]},'type':{'type':Sequelize[_0xea9c('0x0')]},'uniqueid':{'type':Sequelize[_0xea9c('0x0')]},'version':{'type':Sequelize[_0xea9c('0x0')]},'callerid':{'type':Sequelize[_0xea9c('0x0')]},'calleridname':{'type':Sequelize[_0xea9c('0x0')]},'callingpres':{'type':Sequelize[_0xea9c('0x0')]},'callingani2':{'type':Sequelize[_0xea9c('0x0')]},'callington':{'type':Sequelize[_0xea9c('0x0')]},'callingtns':{'type':Sequelize[_0xea9c('0x0')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xea9c('0x0')]},'extension':{'type':Sequelize[_0xea9c('0x0')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xea9c('0x0')]},'accountcode':{'type':Sequelize[_0xea9c('0x0')]},'threadid':{'type':Sequelize[_0xea9c('0x0')]},'project_name':{'type':Sequelize[_0xea9c('0x0')]},'joinAt':{'type':Sequelize[_0xea9c('0x1')]},'leaveAt':{'type':Sequelize[_0xea9c('0x1')]},'bot':{'type':Sequelize[_0xea9c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0f07=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x3f3183,_0x1cde60){var _0xae525e=function(_0x3153e7){while(--_0x3153e7){_0x3f3183['push'](_0x3f3183['shift']());}};_0xae525e(++_0x1cde60);}(_0x0f07,0x11a));var _0x70f0=function(_0x559c5e,_0x338b75){_0x559c5e=_0x559c5e-0x0;var _0xa30a50=_0x0f07[_0x559c5e];return _0xa30a50;};'use strict';var Sequelize=require(_0x70f0('0x0'));module[_0x70f0('0x1')]={'network':{'type':Sequelize[_0x70f0('0x2')]},'network_script':{'type':Sequelize[_0x70f0('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x70f0('0x2')]},'language':{'type':Sequelize[_0x70f0('0x2')]},'type':{'type':Sequelize[_0x70f0('0x2')]},'uniqueid':{'type':Sequelize[_0x70f0('0x2')]},'version':{'type':Sequelize[_0x70f0('0x2')]},'callerid':{'type':Sequelize[_0x70f0('0x2')]},'calleridname':{'type':Sequelize[_0x70f0('0x2')]},'callingpres':{'type':Sequelize[_0x70f0('0x2')]},'callingani2':{'type':Sequelize[_0x70f0('0x2')]},'callington':{'type':Sequelize[_0x70f0('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x70f0('0x2')]},'context':{'type':Sequelize[_0x70f0('0x2')]},'extension':{'type':Sequelize[_0x70f0('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x70f0('0x2')]},'accountcode':{'type':Sequelize[_0x70f0('0x2')]},'threadid':{'type':Sequelize[_0x70f0('0x2')]},'project_name':{'type':Sequelize[_0x70f0('0x2')]},'joinAt':{'type':Sequelize[_0x70f0('0x3')]},'leaveAt':{'type':Sequelize[_0x70f0('0x3')]},'bot':{'type':Sequelize[_0x70f0('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index e5c75db..e65b391 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 _0x8b0e=['fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','index','SquareReport'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8b0e,0x6a));var _0xe8b0=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0x8b0e[_0x7cb10c];return _0x11df59;};'use strict';var emlformat=require(_0xe8b0('0x0'));var rimraf=require(_0xe8b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8b0('0x2'));var rp=require(_0xe8b0('0x3'));var moment=require(_0xe8b0('0x4'));var BPromise=require(_0xe8b0('0x5'));var Mustache=require(_0xe8b0('0x6'));var util=require('util');var path=require(_0xe8b0('0x7'));var sox=require(_0xe8b0('0x8'));var csv=require(_0xe8b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8b0('0xa'));var _=require(_0xe8b0('0xb'));var squel=require(_0xe8b0('0xc'));var crypto=require(_0xe8b0('0xd'));var jsforce=require(_0xe8b0('0xe'));var deskjs=require(_0xe8b0('0xf'));var toCsv=require(_0xe8b0('0x9'));var querystring=require(_0xe8b0('0x10'));var Papa=require(_0xe8b0('0x11'));var Redis=require('ioredis');var authService=require(_0xe8b0('0x12'));var qs=require(_0xe8b0('0x13'));var as=require(_0xe8b0('0x14'));var hardwareService=require(_0xe8b0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe8b0('0x16'));var config=require(_0xe8b0('0x17'));var licenseUtil=require(_0xe8b0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x481312,_0x3da208){_0x3da208=_0x3da208||0xcc;return function(_0x2009f9){if(_0x2009f9){return _0x481312[_0xe8b0('0x19')](_0x3da208);}return _0x481312[_0xe8b0('0x1a')](_0x3da208)[_0xe8b0('0x1b')]();};}function respondWithResult(_0x480bac,_0x4d33a9){_0x4d33a9=_0x4d33a9||0xc8;return function(_0x95cd2c){if(_0x95cd2c){return _0x480bac['status'](_0x4d33a9)[_0xe8b0('0x1c')](_0x95cd2c);}};}function respondWithFilteredResult(_0x5c3454,_0x824ca3){return function(_0x306677){if(_0x306677){var _0xb2e3c=typeof _0x824ca3[_0xe8b0('0x1d')]===_0xe8b0('0x1e')&&typeof _0x824ca3[_0xe8b0('0x1f')]===_0xe8b0('0x1e');var _0xae750b=_0x306677[_0xe8b0('0x20')];var _0x146034=_0xb2e3c?0x0:_0x824ca3['offset'];var _0x849d3d=_0xb2e3c?_0x306677[_0xe8b0('0x20')]:_0x824ca3['offset']+_0x824ca3['limit'];var _0x593bc2;if(_0x849d3d>=_0xae750b){_0x849d3d=_0xae750b;_0x593bc2=0xc8;}else{_0x593bc2=0xce;}_0x5c3454[_0xe8b0('0x1a')](_0x593bc2);return _0x5c3454[_0xe8b0('0x21')](_0xe8b0('0x22'),_0x146034+'-'+_0x849d3d+'/'+_0xae750b)[_0xe8b0('0x1c')](_0x306677);}return null;};}function patchUpdates(_0x33b1d7){return function(_0x1b02e4){try{jsonpatch[_0xe8b0('0x23')](_0x1b02e4,_0x33b1d7,!![]);}catch(_0x4552e6){return BPromise['reject'](_0x4552e6);}return _0x1b02e4[_0xe8b0('0x24')]();};}function saveUpdates(_0x4a52cb,_0x4f6b05){return function(_0x506772){if(_0x506772){return _0x506772['update'](_0x4a52cb)[_0xe8b0('0x25')](function(_0x124082){return _0x124082;});}return null;};}function removeEntity(_0x66fdca,_0x58ce04){return function(_0x300a03){if(_0x300a03){return _0x300a03[_0xe8b0('0x26')]()[_0xe8b0('0x25')](function(){_0x66fdca[_0xe8b0('0x1a')](0xcc)[_0xe8b0('0x1b')]();});}};}function handleEntityNotFound(_0x3a5d75,_0x527043){return function(_0x7685fb){if(!_0x7685fb){_0x3a5d75[_0xe8b0('0x19')](0x194);}return _0x7685fb;};}function handleError(_0x309cc5,_0x3517dc){_0x3517dc=_0x3517dc||0x1f4;return function(_0x3985be){logger['error'](_0x3985be[_0xe8b0('0x27')]);if(_0x3985be[_0xe8b0('0x28')]){delete _0x3985be[_0xe8b0('0x28')];}_0x309cc5[_0xe8b0('0x1a')](_0x3517dc)[_0xe8b0('0x29')](_0x3985be);};}exports[_0xe8b0('0x2a')]=function(_0x28d0fb,_0x3b13b0){var _0x3a40c6={},_0x1f04f2={},_0x3fb6ff={'count':0x0,'rows':[]};var _0x2e4f6=_['map'](db[_0xe8b0('0x2b')]['rawAttributes'],function(_0x44657e){return{'name':_0x44657e[_0xe8b0('0x2c')],'type':_0x44657e[_0xe8b0('0x2d')][_0xe8b0('0x2e')]};});_0x1f04f2[_0xe8b0('0x2f')]=_['map'](_0x2e4f6,_0xe8b0('0x28'));_0x1f04f2[_0xe8b0('0x30')]=_[_0xe8b0('0x31')](_0x28d0fb[_0xe8b0('0x30')]);_0x1f04f2[_0xe8b0('0x32')]=_['intersection'](_0x1f04f2['model'],_0x1f04f2[_0xe8b0('0x30')]);_0x3a40c6[_0xe8b0('0x33')]=_[_0xe8b0('0x34')](_0x1f04f2[_0xe8b0('0x2f')],qs[_0xe8b0('0x35')](_0x28d0fb[_0xe8b0('0x30')][_0xe8b0('0x35')]));_0x3a40c6[_0xe8b0('0x33')]=_0x3a40c6[_0xe8b0('0x33')][_0xe8b0('0x36')]?_0x3a40c6[_0xe8b0('0x33')]:_0x1f04f2['model'];if(!_0x28d0fb[_0xe8b0('0x30')]['hasOwnProperty']('nolimit')){_0x3a40c6['limit']=qs[_0xe8b0('0x1f')](_0x28d0fb[_0xe8b0('0x30')][_0xe8b0('0x1f')]);_0x3a40c6[_0xe8b0('0x1d')]=qs['offset'](_0x28d0fb['query'][_0xe8b0('0x1d')]);}_0x3a40c6[_0xe8b0('0x37')]=qs[_0xe8b0('0x38')](_0x28d0fb[_0xe8b0('0x30')][_0xe8b0('0x38')]);_0x3a40c6['where']=qs[_0xe8b0('0x32')](_[_0xe8b0('0x39')](_0x28d0fb[_0xe8b0('0x30')],_0x1f04f2[_0xe8b0('0x32')]),_0x2e4f6);if(_0x28d0fb[_0xe8b0('0x30')][_0xe8b0('0x3a')]){_0x3a40c6[_0xe8b0('0x3b')]=_[_0xe8b0('0x3c')](_0x3a40c6[_0xe8b0('0x3b')],{'$or':_[_0xe8b0('0x3d')](_0x2e4f6,function(_0x110041){if(_0x110041[_0xe8b0('0x2d')]!==_0xe8b0('0x3e')){var _0x8a9365={};_0x8a9365[_0x110041[_0xe8b0('0x28')]]={'$like':'%'+_0x28d0fb[_0xe8b0('0x30')]['filter']+'%'};return _0x8a9365;}})});}_0x3a40c6=_[_0xe8b0('0x3c')]({},_0x3a40c6,_0x28d0fb['options']);var _0x2f322d={'where':_0x3a40c6[_0xe8b0('0x3b')]};return db[_0xe8b0('0x2b')][_0xe8b0('0x20')](_0x2f322d)[_0xe8b0('0x25')](function(_0x3b1ae9){_0x3fb6ff['count']=_0x3b1ae9;if(_0x28d0fb[_0xe8b0('0x30')][_0xe8b0('0x3f')]){_0x3a40c6[_0xe8b0('0x40')]=[{'all':!![]}];}return db[_0xe8b0('0x2b')][_0xe8b0('0x41')](_0x3a40c6);})[_0xe8b0('0x25')](function(_0x512902){_0x3fb6ff[_0xe8b0('0x42')]=_0x512902;return _0x3fb6ff;})[_0xe8b0('0x25')](respondWithFilteredResult(_0x3b13b0,_0x3a40c6))[_0xe8b0('0x43')](handleError(_0x3b13b0,null));};exports[_0xe8b0('0x44')]=function(_0x38fac5,_0x1f61b4){var _0x573241={'raw':!![],'where':{'id':_0x38fac5[_0xe8b0('0x45')]['id']}},_0xc5fe9e={};_0xc5fe9e[_0xe8b0('0x2f')]=_[_0xe8b0('0x31')](db[_0xe8b0('0x2b')][_0xe8b0('0x46')]);_0xc5fe9e[_0xe8b0('0x30')]=_[_0xe8b0('0x31')](_0x38fac5[_0xe8b0('0x30')]);_0xc5fe9e['filters']=_[_0xe8b0('0x34')](_0xc5fe9e['model'],_0xc5fe9e[_0xe8b0('0x30')]);_0x573241[_0xe8b0('0x33')]=_['intersection'](_0xc5fe9e[_0xe8b0('0x2f')],qs[_0xe8b0('0x35')](_0x38fac5[_0xe8b0('0x30')][_0xe8b0('0x35')]));_0x573241[_0xe8b0('0x33')]=_0x573241[_0xe8b0('0x33')][_0xe8b0('0x36')]?_0x573241[_0xe8b0('0x33')]:_0xc5fe9e[_0xe8b0('0x2f')];if(_0x38fac5[_0xe8b0('0x30')][_0xe8b0('0x3f')]){_0x573241['include']=[{'all':!![]}];}_0x573241=_[_0xe8b0('0x3c')]({},_0x573241,_0x38fac5['options']);return db[_0xe8b0('0x2b')][_0xe8b0('0x47')](_0x573241)[_0xe8b0('0x25')](handleEntityNotFound(_0x1f61b4,null))['then'](respondWithResult(_0x1f61b4,null))[_0xe8b0('0x43')](handleError(_0x1f61b4,null));};exports[_0xe8b0('0x48')]=function(_0x5b6c2e,_0x17a71e){return db[_0xe8b0('0x2b')][_0xe8b0('0x48')](_0x5b6c2e['body'],{})[_0xe8b0('0x25')](respondWithResult(_0x17a71e,0xc9))[_0xe8b0('0x43')](handleError(_0x17a71e,null));};exports['update']=function(_0x105fc6,_0x3aeabe){if(_0x105fc6[_0xe8b0('0x49')]['id']){delete _0x105fc6[_0xe8b0('0x49')]['id'];}return db['SquareReport'][_0xe8b0('0x47')]({'where':{'id':_0x105fc6['params']['id']}})[_0xe8b0('0x25')](handleEntityNotFound(_0x3aeabe,null))[_0xe8b0('0x25')](saveUpdates(_0x105fc6[_0xe8b0('0x49')],null))[_0xe8b0('0x25')](respondWithResult(_0x3aeabe,null))['catch'](handleError(_0x3aeabe,null));};exports[_0xe8b0('0x26')]=function(_0x4b0ac0,_0x1b1943){return db[_0xe8b0('0x2b')][_0xe8b0('0x47')]({'where':{'id':_0x4b0ac0[_0xe8b0('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b1943,null))['then'](removeEntity(_0x1b1943,null))[_0xe8b0('0x43')](handleError(_0x1b1943,null));};exports['describe']=function(_0x3fc68e,_0x11ca59){return db['SquareReport'][_0xe8b0('0x4a')]()[_0xe8b0('0x25')](respondWithResult(_0x11ca59,null))['catch'](handleError(_0x11ca59,null));}; \ No newline at end of file +var _0xf972=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','SquareReport','includeAll','rows','catch','show','params','intersection','fields','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x3d605e,_0x221c20){var _0xe58b15=function(_0x2266ea){while(--_0x2266ea){_0x3d605e['push'](_0x3d605e['shift']());}};_0xe58b15(++_0x221c20);}(_0xf972,0x76));var _0x2f97=function(_0x121c11,_0x572563){_0x121c11=_0x121c11-0x0;var _0x1c7690=_0xf972[_0x121c11];return _0x1c7690;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f97('0x0'));var zipdir=require(_0x2f97('0x1'));var jsonpatch=require(_0x2f97('0x2'));var rp=require(_0x2f97('0x3'));var moment=require(_0x2f97('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2f97('0x5'));var path=require('path');var sox=require(_0x2f97('0x6'));var csv=require(_0x2f97('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f97('0x8'));var squel=require(_0x2f97('0x9'));var crypto=require('crypto');var jsforce=require(_0x2f97('0xa'));var deskjs=require(_0x2f97('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2f97('0xc'));var Papa=require('papaparse');var Redis=require(_0x2f97('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2f97('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f97('0xf'));var logger=require(_0x2f97('0x10'))(_0x2f97('0x11'));var utils=require(_0x2f97('0x12'));var config=require(_0x2f97('0x13'));var licenseUtil=require(_0x2f97('0x14'));var db=require(_0x2f97('0x15'))['db'];function respondWithStatusCode(_0xbb9925,_0x4f6c3c){_0x4f6c3c=_0x4f6c3c||0xcc;return function(_0x396b2){if(_0x396b2){return _0xbb9925['sendStatus'](_0x4f6c3c);}return _0xbb9925[_0x2f97('0x16')](_0x4f6c3c)['end']();};}function respondWithResult(_0x2530bf,_0x4c2144){_0x4c2144=_0x4c2144||0xc8;return function(_0x1cd895){if(_0x1cd895){return _0x2530bf[_0x2f97('0x16')](_0x4c2144)[_0x2f97('0x17')](_0x1cd895);}};}function respondWithFilteredResult(_0x1cbc4e,_0x2867ce){return function(_0x256c51){if(_0x256c51){var _0xc09dd4=typeof _0x2867ce[_0x2f97('0x18')]==='undefined'&&typeof _0x2867ce[_0x2f97('0x19')]===_0x2f97('0x1a');var _0x13aa8a=_0x256c51['count'];var _0xb437b7=_0xc09dd4?0x0:_0x2867ce[_0x2f97('0x18')];var _0x4aa4d8=_0xc09dd4?_0x256c51[_0x2f97('0x1b')]:_0x2867ce[_0x2f97('0x18')]+_0x2867ce[_0x2f97('0x19')];var _0x3b5d9c;if(_0x4aa4d8>=_0x13aa8a){_0x4aa4d8=_0x13aa8a;_0x3b5d9c=0xc8;}else{_0x3b5d9c=0xce;}_0x1cbc4e[_0x2f97('0x16')](_0x3b5d9c);return _0x1cbc4e[_0x2f97('0x1c')](_0x2f97('0x1d'),_0xb437b7+'-'+_0x4aa4d8+'/'+_0x13aa8a)[_0x2f97('0x17')](_0x256c51);}return null;};}function patchUpdates(_0x1ed358){return function(_0x5c854a){try{jsonpatch[_0x2f97('0x1e')](_0x5c854a,_0x1ed358,!![]);}catch(_0x52456a){return BPromise['reject'](_0x52456a);}return _0x5c854a['save']();};}function saveUpdates(_0x597df4,_0x302b49){return function(_0x56e8ec){if(_0x56e8ec){return _0x56e8ec[_0x2f97('0x1f')](_0x597df4)[_0x2f97('0x20')](function(_0x170e24){return _0x170e24;});}return null;};}function removeEntity(_0x46afff,_0x5b33e7){return function(_0x4b71d5){if(_0x4b71d5){return _0x4b71d5[_0x2f97('0x21')]()[_0x2f97('0x20')](function(){_0x46afff[_0x2f97('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x511b33,_0x2e4436){return function(_0x23de13){if(!_0x23de13){_0x511b33[_0x2f97('0x22')](0x194);}return _0x23de13;};}function handleError(_0x26bf8e,_0x4dfa8f){_0x4dfa8f=_0x4dfa8f||0x1f4;return function(_0x453578){logger[_0x2f97('0x23')](_0x453578['stack']);if(_0x453578[_0x2f97('0x24')]){delete _0x453578[_0x2f97('0x24')];}_0x26bf8e['status'](_0x4dfa8f)[_0x2f97('0x25')](_0x453578);};}exports['index']=function(_0x162208,_0x58a3ef){var _0x253fa6={},_0x275f67={},_0x122f42={'count':0x0,'rows':[]};var _0x4ade9c=_[_0x2f97('0x26')](db['SquareReport'][_0x2f97('0x27')],function(_0x70006){return{'name':_0x70006[_0x2f97('0x28')],'type':_0x70006[_0x2f97('0x29')]['key']};});_0x275f67[_0x2f97('0x2a')]=_[_0x2f97('0x26')](_0x4ade9c,_0x2f97('0x24'));_0x275f67[_0x2f97('0x2b')]=_[_0x2f97('0x2c')](_0x162208[_0x2f97('0x2b')]);_0x275f67[_0x2f97('0x2d')]=_['intersection'](_0x275f67['model'],_0x275f67['query']);_0x253fa6[_0x2f97('0x2e')]=_['intersection'](_0x275f67[_0x2f97('0x2a')],qs['fields'](_0x162208[_0x2f97('0x2b')]['fields']));_0x253fa6[_0x2f97('0x2e')]=_0x253fa6[_0x2f97('0x2e')]['length']?_0x253fa6['attributes']:_0x275f67['model'];if(!_0x162208[_0x2f97('0x2b')][_0x2f97('0x2f')]('nolimit')){_0x253fa6[_0x2f97('0x19')]=qs[_0x2f97('0x19')](_0x162208['query'][_0x2f97('0x19')]);_0x253fa6[_0x2f97('0x18')]=qs[_0x2f97('0x18')](_0x162208[_0x2f97('0x2b')]['offset']);}_0x253fa6[_0x2f97('0x30')]=qs[_0x2f97('0x31')](_0x162208[_0x2f97('0x2b')][_0x2f97('0x31')]);_0x253fa6[_0x2f97('0x32')]=qs['filters'](_[_0x2f97('0x33')](_0x162208['query'],_0x275f67['filters']),_0x4ade9c);if(_0x162208[_0x2f97('0x2b')][_0x2f97('0x34')]){_0x253fa6[_0x2f97('0x32')]=_[_0x2f97('0x35')](_0x253fa6['where'],{'$or':_[_0x2f97('0x26')](_0x4ade9c,function(_0x813219){if(_0x813219[_0x2f97('0x29')]!=='VIRTUAL'){var _0x465ef8={};_0x465ef8[_0x813219['name']]={'$like':'%'+_0x162208[_0x2f97('0x2b')]['filter']+'%'};return _0x465ef8;}})});}_0x253fa6=_[_0x2f97('0x35')]({},_0x253fa6,_0x162208['options']);var _0x30319f={'where':_0x253fa6[_0x2f97('0x32')]};return db[_0x2f97('0x36')][_0x2f97('0x1b')](_0x30319f)[_0x2f97('0x20')](function(_0x4f4af9){_0x122f42[_0x2f97('0x1b')]=_0x4f4af9;if(_0x162208[_0x2f97('0x2b')][_0x2f97('0x37')]){_0x253fa6['include']=[{'all':!![]}];}return db[_0x2f97('0x36')]['findAll'](_0x253fa6);})[_0x2f97('0x20')](function(_0x30edfb){_0x122f42[_0x2f97('0x38')]=_0x30edfb;return _0x122f42;})['then'](respondWithFilteredResult(_0x58a3ef,_0x253fa6))[_0x2f97('0x39')](handleError(_0x58a3ef,null));};exports[_0x2f97('0x3a')]=function(_0x57e1f9,_0x18c726){var _0x387da1={'raw':!![],'where':{'id':_0x57e1f9[_0x2f97('0x3b')]['id']}},_0x3ad9ff={};_0x3ad9ff['model']=_[_0x2f97('0x2c')](db[_0x2f97('0x36')]['rawAttributes']);_0x3ad9ff[_0x2f97('0x2b')]=_['keys'](_0x57e1f9[_0x2f97('0x2b')]);_0x3ad9ff[_0x2f97('0x2d')]=_[_0x2f97('0x3c')](_0x3ad9ff['model'],_0x3ad9ff[_0x2f97('0x2b')]);_0x387da1[_0x2f97('0x2e')]=_[_0x2f97('0x3c')](_0x3ad9ff['model'],qs[_0x2f97('0x3d')](_0x57e1f9[_0x2f97('0x2b')]['fields']));_0x387da1[_0x2f97('0x2e')]=_0x387da1[_0x2f97('0x2e')]['length']?_0x387da1[_0x2f97('0x2e')]:_0x3ad9ff[_0x2f97('0x2a')];if(_0x57e1f9[_0x2f97('0x2b')][_0x2f97('0x37')]){_0x387da1[_0x2f97('0x3e')]=[{'all':!![]}];}_0x387da1=_[_0x2f97('0x35')]({},_0x387da1,_0x57e1f9[_0x2f97('0x3f')]);return db['SquareReport'][_0x2f97('0x40')](_0x387da1)['then'](handleEntityNotFound(_0x18c726,null))[_0x2f97('0x20')](respondWithResult(_0x18c726,null))[_0x2f97('0x39')](handleError(_0x18c726,null));};exports[_0x2f97('0x41')]=function(_0x22fa6f,_0x546e73){return db[_0x2f97('0x36')][_0x2f97('0x41')](_0x22fa6f[_0x2f97('0x42')],{})[_0x2f97('0x20')](respondWithResult(_0x546e73,0xc9))[_0x2f97('0x39')](handleError(_0x546e73,null));};exports[_0x2f97('0x1f')]=function(_0x15b1b8,_0x2268e4){if(_0x15b1b8['body']['id']){delete _0x15b1b8[_0x2f97('0x42')]['id'];}return db[_0x2f97('0x36')]['find']({'where':{'id':_0x15b1b8[_0x2f97('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2268e4,null))[_0x2f97('0x20')](saveUpdates(_0x15b1b8[_0x2f97('0x42')],null))[_0x2f97('0x20')](respondWithResult(_0x2268e4,null))['catch'](handleError(_0x2268e4,null));};exports[_0x2f97('0x21')]=function(_0x3c8250,_0x33d435){return db[_0x2f97('0x36')][_0x2f97('0x40')]({'where':{'id':_0x3c8250[_0x2f97('0x3b')]['id']}})[_0x2f97('0x20')](handleEntityNotFound(_0x33d435,null))['then'](removeEntity(_0x33d435,null))['catch'](handleError(_0x33d435,null));};exports[_0x2f97('0x43')]=function(_0x526db8,_0x3ea43c){return db['SquareReport']['describe']()[_0x2f97('0x20')](respondWithResult(_0x3ea43c,null))[_0x2f97('0x39')](handleError(_0x3ea43c,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 546690f..5d77e3f 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 _0x669b=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4fb1b0,_0x49104f){var _0x1500b3=function(_0x57fd6c){while(--_0x57fd6c){_0x4fb1b0['push'](_0x4fb1b0['shift']());}};_0x1500b3(++_0x49104f);}(_0x669b,0xa1));var _0xb669=function(_0x5b0e86,_0x14c6c2){_0x5b0e86=_0x5b0e86-0x0;var _0x1d8a8f=_0x669b[_0x5b0e86];return _0x1d8a8f;};'use strict';var _=require(_0xb669('0x0'));var util=require(_0xb669('0x1'));var logger=require(_0xb669('0x2'))(_0xb669('0x3'));var moment=require(_0xb669('0x4'));var BPromise=require(_0xb669('0x5'));var rp=require(_0xb669('0x6'));var fs=require('fs');var path=require(_0xb669('0x7'));var rimraf=require(_0xb669('0x8'));var config=require(_0xb669('0x9'));var attributes=require(_0xb669('0xa'));module[_0xb669('0xb')]=function(_0x33d2eb,_0x4775b6){return _0x33d2eb[_0xb669('0xc')](_0xb669('0xd'),attributes,{'tableName':_0xb669('0xe'),'paranoid':![],'indexes':[{'name':_0xb669('0xf'),'fields':[_0xb669('0x10'),_0xb669('0x11')]},{'name':_0xb669('0x12'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x07aa=['leaveAt','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x70c97a,_0xd4d263){var _0x5cb362=function(_0x163f30){while(--_0x163f30){_0x70c97a['push'](_0x70c97a['shift']());}};_0x5cb362(++_0xd4d263);}(_0x07aa,0x91));var _0xa07a=function(_0x89133b,_0x16e7b0){_0x89133b=_0x89133b-0x0;var _0x13cee4=_0x07aa[_0x89133b];return _0x13cee4;};'use strict';var _=require(_0xa07a('0x0'));var util=require(_0xa07a('0x1'));var logger=require(_0xa07a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa07a('0x3'));var fs=require('fs');var path=require(_0xa07a('0x4'));var rimraf=require(_0xa07a('0x5'));var config=require(_0xa07a('0x6'));var attributes=require(_0xa07a('0x7'));module[_0xa07a('0x8')]=function(_0x155e8f,_0x41d16c){return _0x155e8f[_0xa07a('0x9')](_0xa07a('0xa'),attributes,{'tableName':_0xa07a('0xb'),'paranoid':![],'indexes':[{'name':_0xa07a('0xc'),'fields':[_0xa07a('0xd'),_0xa07a('0xe')]},{'name':_0xa07a('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index eeb2eff..f619d32 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 _0xe7a2=['debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0xa1f431,_0x305605){var _0x17689d=function(_0x6fd50b){while(--_0x6fd50b){_0xa1f431['push'](_0xa1f431['shift']());}};_0x17689d(++_0x305605);}(_0xe7a2,0x1f4));var _0x2e7a=function(_0x21b95c,_0x35c39e){_0x21b95c=_0x21b95c-0x0;var _0x1ede2f=_0xe7a2[_0x21b95c];return _0x1ede2f;};'use strict';var _=require(_0x2e7a('0x0'));var util=require(_0x2e7a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e7a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e7a('0x3'));var logger=require(_0x2e7a('0x4'))('rpc');var config=require(_0x2e7a('0x5'));var jayson=require(_0x2e7a('0x6'));var client=jayson[_0x2e7a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d35b,_0x2577c7,_0x1c0e56){return new BPromise(function(_0x1a8903,_0x11ebe8){return client[_0x2e7a('0x8')](_0x54d35b,_0x1c0e56)[_0x2e7a('0x9')](function(_0x1ec13b){logger['info'](_0x2e7a('0xa'),_0x2577c7,_0x2e7a('0xb'));logger[_0x2e7a('0xc')](_0x2e7a('0xd'),_0x2577c7,'request\x20sent',JSON[_0x2e7a('0xe')](_0x1ec13b));if(_0x1ec13b['error']){if(_0x1ec13b[_0x2e7a('0xf')][_0x2e7a('0x10')]===0x1f4){logger['error'](_0x2e7a('0xa'),_0x2577c7,_0x1ec13b['error'][_0x2e7a('0x11')]);return _0x11ebe8(_0x1ec13b[_0x2e7a('0xf')]['message']);}logger['error'](_0x2e7a('0xa'),_0x2577c7,_0x1ec13b['error'][_0x2e7a('0x11')]);return _0x1a8903(_0x1ec13b[_0x2e7a('0xf')][_0x2e7a('0x11')]);}else{logger[_0x2e7a('0x12')](_0x2e7a('0xa'),_0x2577c7,_0x2e7a('0xb'));_0x1a8903(_0x1ec13b[_0x2e7a('0x13')][_0x2e7a('0x11')]);}})[_0x2e7a('0x14')](function(_0x277a24){logger[_0x2e7a('0xf')](_0x2e7a('0xa'),_0x2577c7,_0x277a24);_0x11ebe8(_0x277a24);});});}exports[_0x2e7a('0x15')]=function(_0x30ac4d){var _0x5a900b=this;return new Promise(function(_0x1bf6dc,_0x48ee2b){return db[_0x2e7a('0x16')][_0x2e7a('0x17')](_0x30ac4d[_0x2e7a('0x18')],{'raw':_0x30ac4d[_0x2e7a('0x19')]?_0x30ac4d[_0x2e7a('0x19')][_0x2e7a('0x1a')]===undefined?!![]:![]:!![]})[_0x2e7a('0x9')](function(_0x58b553){logger['info']('CreateSquareReport',_0x30ac4d);logger['debug'](_0x2e7a('0x15'),_0x30ac4d,JSON['stringify'](_0x58b553));_0x1bf6dc(_0x58b553);})[_0x2e7a('0x14')](function(_0x35b160){logger['error'](_0x2e7a('0x15'),_0x35b160[_0x2e7a('0x11')],_0x30ac4d);_0x48ee2b(_0x5a900b[_0x2e7a('0xf')](0x1f4,_0x35b160['message']));});});};exports[_0x2e7a('0x1b')]=function(_0x446159){var _0x1b9a77=this;return new Promise(function(_0x77c75d,_0x143c56){return db[_0x2e7a('0x16')][_0x2e7a('0x1c')](_0x446159[_0x2e7a('0x18')],{'raw':_0x446159['options']?_0x446159[_0x2e7a('0x19')][_0x2e7a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x446159[_0x2e7a('0x19')]?_0x446159['options'][_0x2e7a('0x1d')]||null:null,'attributes':_0x446159[_0x2e7a('0x19')]?_0x446159['options'][_0x2e7a('0x1e')]||null:null,'limit':_0x446159['options']?_0x446159[_0x2e7a('0x19')][_0x2e7a('0x1f')]||null:null})['then'](function(_0x255054){logger[_0x2e7a('0x12')](_0x2e7a('0x1b'),_0x446159);logger[_0x2e7a('0xc')](_0x2e7a('0x1b'),_0x446159,JSON[_0x2e7a('0xe')](_0x255054));_0x77c75d(_0x255054);})[_0x2e7a('0x14')](function(_0x59c7aa){logger[_0x2e7a('0xf')](_0x2e7a('0x1b'),_0x59c7aa[_0x2e7a('0x11')],_0x446159);_0x143c56(_0x1b9a77[_0x2e7a('0xf')](0x1f4,_0x59c7aa['message']));});});}; \ No newline at end of file +var _0x1ef1=['where','limit','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','body','options','then','CreateSquareReport','UpdateSquareReport','update','raw'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1ef1,0xc2));var _0x11ef=function(_0x2d9ef9,_0x40182b){_0x2d9ef9=_0x2d9ef9-0x0;var _0x35ffd1=_0x1ef1[_0x2d9ef9];return _0x35ffd1;};'use strict';var _=require('lodash');var util=require(_0x11ef('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x11ef('0x1'));var fs=require('fs');var Redis=require(_0x11ef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x11ef('0x3'));var logger=require('../../config/logger')(_0x11ef('0x4'));var config=require(_0x11ef('0x5'));var jayson=require(_0x11ef('0x6'));var client=jayson[_0x11ef('0x7')][_0x11ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20acaa,_0x16288d,_0x427547){return new BPromise(function(_0xaacf40,_0x14db5b){return client[_0x11ef('0x9')](_0x20acaa,_0x427547)['then'](function(_0x1947d9){logger[_0x11ef('0xa')](_0x11ef('0xb'),_0x16288d,_0x11ef('0xc'));logger[_0x11ef('0xd')](_0x11ef('0xe'),_0x16288d,'request\x20sent',JSON[_0x11ef('0xf')](_0x1947d9));if(_0x1947d9[_0x11ef('0x10')]){if(_0x1947d9[_0x11ef('0x10')][_0x11ef('0x11')]===0x1f4){logger[_0x11ef('0x10')](_0x11ef('0xb'),_0x16288d,_0x1947d9['error'][_0x11ef('0x12')]);return _0x14db5b(_0x1947d9['error'][_0x11ef('0x12')]);}logger[_0x11ef('0x10')]('SquareReport,\x20%s,\x20%s',_0x16288d,_0x1947d9[_0x11ef('0x10')][_0x11ef('0x12')]);return _0xaacf40(_0x1947d9['error'][_0x11ef('0x12')]);}else{logger[_0x11ef('0xa')](_0x11ef('0xb'),_0x16288d,_0x11ef('0xc'));_0xaacf40(_0x1947d9[_0x11ef('0x13')]['message']);}})[_0x11ef('0x14')](function(_0x3e4e35){logger['error']('SquareReport,\x20%s,\x20%s',_0x16288d,_0x3e4e35);_0x14db5b(_0x3e4e35);});});}exports['CreateSquareReport']=function(_0x5e588b){var _0x1e8ba7=this;return new Promise(function(_0x43abb2,_0xa03f34){return db[_0x11ef('0x15')][_0x11ef('0x16')](_0x5e588b[_0x11ef('0x17')],{'raw':_0x5e588b[_0x11ef('0x18')]?_0x5e588b[_0x11ef('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x11ef('0x19')](function(_0x348ba2){logger[_0x11ef('0xa')]('CreateSquareReport',_0x5e588b);logger[_0x11ef('0xd')](_0x11ef('0x1a'),_0x5e588b,JSON['stringify'](_0x348ba2));_0x43abb2(_0x348ba2);})['catch'](function(_0x36dbe6){logger[_0x11ef('0x10')](_0x11ef('0x1a'),_0x36dbe6[_0x11ef('0x12')],_0x5e588b);_0xa03f34(_0x1e8ba7[_0x11ef('0x10')](0x1f4,_0x36dbe6[_0x11ef('0x12')]));});});};exports[_0x11ef('0x1b')]=function(_0x57a588){var _0x1dea87=this;return new Promise(function(_0x29b320,_0x1e3a9a){return db[_0x11ef('0x15')][_0x11ef('0x1c')](_0x57a588[_0x11ef('0x17')],{'raw':_0x57a588[_0x11ef('0x18')]?_0x57a588[_0x11ef('0x18')][_0x11ef('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57a588[_0x11ef('0x18')]?_0x57a588['options'][_0x11ef('0x1e')]||null:null,'attributes':_0x57a588[_0x11ef('0x18')]?_0x57a588[_0x11ef('0x18')]['attributes']||null:null,'limit':_0x57a588[_0x11ef('0x18')]?_0x57a588['options'][_0x11ef('0x1f')]||null:null})[_0x11ef('0x19')](function(_0x2e42eb){logger[_0x11ef('0xa')](_0x11ef('0x1b'),_0x57a588);logger['debug']('UpdateSquareReport',_0x57a588,JSON[_0x11ef('0xf')](_0x2e42eb));_0x29b320(_0x2e42eb);})['catch'](function(_0x576f4f){logger[_0x11ef('0x10')](_0x11ef('0x1b'),_0x576f4f[_0x11ef('0x12')],_0x57a588);_0x1e3a9a(_0x1dea87[_0x11ef('0x10')](0x1f4,_0x576f4f[_0x11ef('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 836c347..c0ac1fa 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 _0x4ab8=['/describe','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index'];(function(_0x3a0100,_0x2013fb){var _0x3218f2=function(_0x504a93){while(--_0x504a93){_0x3a0100['push'](_0x3a0100['shift']());}};_0x3218f2(++_0x2013fb);}(_0x4ab8,0x1d1));var _0x84ab=function(_0x3ac5ae,_0x342121){_0x3ac5ae=_0x3ac5ae-0x0;var _0x23cef9=_0x4ab8[_0x3ac5ae];return _0x23cef9;};'use strict';var multer=require('multer');var util=require(_0x84ab('0x0'));var path=require('path');var timeout=require(_0x84ab('0x1'));var express=require('express');var router=express[_0x84ab('0x2')]();var fs_extra=require(_0x84ab('0x3'));var auth=require(_0x84ab('0x4'));var interaction=require(_0x84ab('0x5'));var config=require('../../config/environment');var controller=require(_0x84ab('0x6'));router[_0x84ab('0x7')]('/',auth[_0x84ab('0x8')](),controller[_0x84ab('0x9')]);router['get'](_0x84ab('0xa'),auth[_0x84ab('0x8')](),controller['describe']);router[_0x84ab('0x7')](_0x84ab('0xb'),auth['isAuthenticated'](),controller[_0x84ab('0xc')]);router[_0x84ab('0xd')]('/',auth['isAuthenticated'](),controller[_0x84ab('0xe')]);router[_0x84ab('0xf')](_0x84ab('0xb'),auth[_0x84ab('0x8')](),controller['update']);router[_0x84ab('0x10')](_0x84ab('0xb'),auth[_0x84ab('0x8')](),controller[_0x84ab('0x11')]);module[_0x84ab('0x12')]=router; \ No newline at end of file +var _0xbc8f=['update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','create','/:id'];(function(_0x4e9ff6,_0x28642d){var _0x59c86f=function(_0x255969){while(--_0x255969){_0x4e9ff6['push'](_0x4e9ff6['shift']());}};_0x59c86f(++_0x28642d);}(_0xbc8f,0xc1));var _0xfbc8=function(_0xb99709,_0x126f51){_0xb99709=_0xb99709-0x0;var _0x487f55=_0xbc8f[_0xb99709];return _0x487f55;};'use strict';var multer=require(_0xfbc8('0x0'));var util=require('util');var path=require(_0xfbc8('0x1'));var timeout=require(_0xfbc8('0x2'));var express=require('express');var router=express[_0xfbc8('0x3')]();var fs_extra=require(_0xfbc8('0x4'));var auth=require(_0xfbc8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfbc8('0x6'));var controller=require(_0xfbc8('0x7'));router[_0xfbc8('0x8')]('/',auth[_0xfbc8('0x9')](),controller[_0xfbc8('0xa')]);router[_0xfbc8('0x8')](_0xfbc8('0xb'),auth[_0xfbc8('0x9')](),controller[_0xfbc8('0xc')]);router['get']('/:id',auth[_0xfbc8('0x9')](),controller[_0xfbc8('0xd')]);router['post']('/',auth[_0xfbc8('0x9')](),controller[_0xfbc8('0xe')]);router['put'](_0xfbc8('0xf'),auth[_0xfbc8('0x9')](),controller[_0xfbc8('0x10')]);router['delete'](_0xfbc8('0xf'),auth['isAuthenticated'](),controller[_0xfbc8('0x11')]);module[_0xfbc8('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4dd00ab..ca0a5ff 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 _0xbf6f=['STRING','sequelize','exports'];(function(_0x512407,_0x282b3f){var _0x5eaf17=function(_0x168e4b){while(--_0x168e4b){_0x512407['push'](_0x512407['shift']());}};_0x5eaf17(++_0x282b3f);}(_0xbf6f,0x175));var _0xfbf6=function(_0x4fa063,_0x555bd4){_0x4fa063=_0x4fa063-0x0;var _0x2f574d=_0xbf6f[_0x4fa063];return _0x2f574d;};'use strict';var Sequelize=require(_0xfbf6('0x0'));module[_0xfbf6('0x1')]={'uniqueid':{'type':Sequelize[_0xfbf6('0x2')]},'node':{'type':Sequelize[_0xfbf6('0x2')]},'application':{'type':Sequelize[_0xfbf6('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb89a=['sequelize','exports','STRING','TEXT'];(function(_0x541820,_0x21b860){var _0x3603e2=function(_0x4137fa){while(--_0x4137fa){_0x541820['push'](_0x541820['shift']());}};_0x3603e2(++_0x21b860);}(_0xb89a,0x9c));var _0xab89=function(_0x262c39,_0x14b574){_0x262c39=_0x262c39-0x0;var _0x371d00=_0xb89a[_0x262c39];return _0x371d00;};'use strict';var Sequelize=require(_0xab89('0x0'));module[_0xab89('0x1')]={'uniqueid':{'type':Sequelize[_0xab89('0x2')]},'node':{'type':Sequelize[_0xab89('0x2')]},'application':{'type':Sequelize[_0xab89('0x2')]},'data':{'type':Sequelize[_0xab89('0x3')]},'project_name':{'type':Sequelize[_0xab89('0x2')]},'callerid':{'type':Sequelize[_0xab89('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index dbab11b..3dfad5f 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 _0x7910=['rows','show','params','rawAttributes','include','find','create','body','catch','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','keys','intersection','attributes','fields','length','model','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','findAll'];(function(_0x299a7a,_0xe2559b){var _0x55ac19=function(_0x488faf){while(--_0x488faf){_0x299a7a['push'](_0x299a7a['shift']());}};_0x55ac19(++_0xe2559b);}(_0x7910,0xf4));var _0x0791=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x7910[_0x3e6d5d];return _0x238923;};'use strict';var emlformat=require(_0x0791('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0791('0x1'));var rp=require(_0x0791('0x2'));var moment=require(_0x0791('0x3'));var BPromise=require(_0x0791('0x4'));var Mustache=require(_0x0791('0x5'));var util=require(_0x0791('0x6'));var path=require(_0x0791('0x7'));var sox=require(_0x0791('0x8'));var csv=require(_0x0791('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0791('0xa'));var _=require(_0x0791('0xb'));var squel=require('squel');var crypto=require(_0x0791('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0791('0xd'));var toCsv=require(_0x0791('0x9'));var querystring=require('querystring');var Papa=require(_0x0791('0xe'));var Redis=require(_0x0791('0xf'));var authService=require(_0x0791('0x10'));var qs=require(_0x0791('0x11'));var as=require(_0x0791('0x12'));var hardwareService=require(_0x0791('0x13'));var logger=require(_0x0791('0x14'))(_0x0791('0x15'));var utils=require(_0x0791('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f3984,_0x56b796){_0x56b796=_0x56b796||0xcc;return function(_0x9201c3){if(_0x9201c3){return _0x2f3984[_0x0791('0x17')](_0x56b796);}return _0x2f3984['status'](_0x56b796)[_0x0791('0x18')]();};}function respondWithResult(_0x54ed66,_0x5b6b89){_0x5b6b89=_0x5b6b89||0xc8;return function(_0x36fe5f){if(_0x36fe5f){return _0x54ed66['status'](_0x5b6b89)[_0x0791('0x19')](_0x36fe5f);}};}function respondWithFilteredResult(_0x195bab,_0xd5e3e0){return function(_0x2c98eb){if(_0x2c98eb){var _0x4347b4=typeof _0xd5e3e0[_0x0791('0x1a')]===_0x0791('0x1b')&&typeof _0xd5e3e0['limit']===_0x0791('0x1b');var _0x7749b=_0x2c98eb[_0x0791('0x1c')];var _0x109b6f=_0x4347b4?0x0:_0xd5e3e0['offset'];var _0x4b7fe4=_0x4347b4?_0x2c98eb[_0x0791('0x1c')]:_0xd5e3e0[_0x0791('0x1a')]+_0xd5e3e0[_0x0791('0x1d')];var _0x9e7cdf;if(_0x4b7fe4>=_0x7749b){_0x4b7fe4=_0x7749b;_0x9e7cdf=0xc8;}else{_0x9e7cdf=0xce;}_0x195bab[_0x0791('0x1e')](_0x9e7cdf);return _0x195bab[_0x0791('0x1f')](_0x0791('0x20'),_0x109b6f+'-'+_0x4b7fe4+'/'+_0x7749b)[_0x0791('0x19')](_0x2c98eb);}return null;};}function patchUpdates(_0x122d75){return function(_0x1b9a99){try{jsonpatch[_0x0791('0x21')](_0x1b9a99,_0x122d75,!![]);}catch(_0xbfd8eb){return BPromise[_0x0791('0x22')](_0xbfd8eb);}return _0x1b9a99[_0x0791('0x23')]();};}function saveUpdates(_0x514150,_0x2b27f1){return function(_0x1d4858){if(_0x1d4858){return _0x1d4858[_0x0791('0x24')](_0x514150)[_0x0791('0x25')](function(_0x507000){return _0x507000;});}return null;};}function removeEntity(_0xa36636,_0x2fa908){return function(_0x1cbec1){if(_0x1cbec1){return _0x1cbec1[_0x0791('0x26')]()[_0x0791('0x25')](function(){_0xa36636[_0x0791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x580804,_0x3cd35b){return function(_0x5a6e53){if(!_0x5a6e53){_0x580804[_0x0791('0x17')](0x194);}return _0x5a6e53;};}function handleError(_0x470cd1,_0x378c9d){_0x378c9d=_0x378c9d||0x1f4;return function(_0x307ed2){logger[_0x0791('0x27')](_0x307ed2[_0x0791('0x28')]);if(_0x307ed2[_0x0791('0x29')]){delete _0x307ed2['name'];}_0x470cd1['status'](_0x378c9d)[_0x0791('0x2a')](_0x307ed2);};}exports[_0x0791('0x2b')]=function(_0x158469,_0x4dbea3){var _0x3840b9={},_0x59fea2={},_0x45579c={'count':0x0,'rows':[]};var _0x51dabd=_[_0x0791('0x2c')](db[_0x0791('0x2d')]['rawAttributes'],function(_0x119bff){return{'name':_0x119bff[_0x0791('0x2e')],'type':_0x119bff[_0x0791('0x2f')][_0x0791('0x30')]};});_0x59fea2['model']=_[_0x0791('0x2c')](_0x51dabd,_0x0791('0x29'));_0x59fea2['query']=_[_0x0791('0x31')](_0x158469['query']);_0x59fea2['filters']=_[_0x0791('0x32')](_0x59fea2['model'],_0x59fea2['query']);_0x3840b9[_0x0791('0x33')]=_[_0x0791('0x32')](_0x59fea2['model'],qs[_0x0791('0x34')](_0x158469['query'][_0x0791('0x34')]));_0x3840b9[_0x0791('0x33')]=_0x3840b9[_0x0791('0x33')][_0x0791('0x35')]?_0x3840b9[_0x0791('0x33')]:_0x59fea2[_0x0791('0x36')];if(!_0x158469[_0x0791('0x37')][_0x0791('0x38')](_0x0791('0x39'))){_0x3840b9['limit']=qs[_0x0791('0x1d')](_0x158469['query'][_0x0791('0x1d')]);_0x3840b9[_0x0791('0x1a')]=qs[_0x0791('0x1a')](_0x158469[_0x0791('0x37')][_0x0791('0x1a')]);}_0x3840b9[_0x0791('0x3a')]=qs[_0x0791('0x3b')](_0x158469[_0x0791('0x37')][_0x0791('0x3b')]);_0x3840b9[_0x0791('0x3c')]=qs[_0x0791('0x3d')](_[_0x0791('0x3e')](_0x158469[_0x0791('0x37')],_0x59fea2[_0x0791('0x3d')]),_0x51dabd);if(_0x158469[_0x0791('0x37')]['filter']){_0x3840b9[_0x0791('0x3c')]=_['merge'](_0x3840b9[_0x0791('0x3c')],{'$or':_['map'](_0x51dabd,function(_0x31030a){if(_0x31030a[_0x0791('0x2f')]!==_0x0791('0x3f')){var _0x1e1b59={};_0x1e1b59[_0x31030a['name']]={'$like':'%'+_0x158469[_0x0791('0x37')]['filter']+'%'};return _0x1e1b59;}})});}_0x3840b9=_[_0x0791('0x40')]({},_0x3840b9,_0x158469[_0x0791('0x41')]);var _0x339e70={'where':_0x3840b9[_0x0791('0x3c')]};return db['SquareDetailsReport'][_0x0791('0x1c')](_0x339e70)[_0x0791('0x25')](function(_0x5dff22){_0x45579c[_0x0791('0x1c')]=_0x5dff22;if(_0x158469[_0x0791('0x37')][_0x0791('0x42')]){_0x3840b9['include']=[{'all':!![]}];}return db[_0x0791('0x2d')][_0x0791('0x43')](_0x3840b9);})[_0x0791('0x25')](function(_0x3d9797){_0x45579c[_0x0791('0x44')]=_0x3d9797;return _0x45579c;})[_0x0791('0x25')](respondWithFilteredResult(_0x4dbea3,_0x3840b9))['catch'](handleError(_0x4dbea3,null));};exports[_0x0791('0x45')]=function(_0x4c10b3,_0x40ca49){var _0x11ea06={'raw':!![],'where':{'id':_0x4c10b3[_0x0791('0x46')]['id']}},_0x32e335={};_0x32e335[_0x0791('0x36')]=_['keys'](db[_0x0791('0x2d')][_0x0791('0x47')]);_0x32e335[_0x0791('0x37')]=_[_0x0791('0x31')](_0x4c10b3['query']);_0x32e335['filters']=_[_0x0791('0x32')](_0x32e335['model'],_0x32e335[_0x0791('0x37')]);_0x11ea06[_0x0791('0x33')]=_[_0x0791('0x32')](_0x32e335[_0x0791('0x36')],qs[_0x0791('0x34')](_0x4c10b3[_0x0791('0x37')][_0x0791('0x34')]));_0x11ea06['attributes']=_0x11ea06[_0x0791('0x33')]['length']?_0x11ea06[_0x0791('0x33')]:_0x32e335['model'];if(_0x4c10b3['query']['includeAll']){_0x11ea06[_0x0791('0x48')]=[{'all':!![]}];}_0x11ea06=_['merge']({},_0x11ea06,_0x4c10b3[_0x0791('0x41')]);return db[_0x0791('0x2d')][_0x0791('0x49')](_0x11ea06)[_0x0791('0x25')](handleEntityNotFound(_0x40ca49,null))[_0x0791('0x25')](respondWithResult(_0x40ca49,null))['catch'](handleError(_0x40ca49,null));};exports[_0x0791('0x4a')]=function(_0x141d74,_0x5e4891){return db['SquareDetailsReport'][_0x0791('0x4a')](_0x141d74[_0x0791('0x4b')],{})[_0x0791('0x25')](respondWithResult(_0x5e4891,0xc9))[_0x0791('0x4c')](handleError(_0x5e4891,null));};exports[_0x0791('0x24')]=function(_0x157599,_0xbb647f){if(_0x157599['body']['id']){delete _0x157599[_0x0791('0x4b')]['id'];}return db['SquareDetailsReport'][_0x0791('0x49')]({'where':{'id':_0x157599[_0x0791('0x46')]['id']}})['then'](handleEntityNotFound(_0xbb647f,null))[_0x0791('0x25')](saveUpdates(_0x157599[_0x0791('0x4b')],null))[_0x0791('0x25')](respondWithResult(_0xbb647f,null))[_0x0791('0x4c')](handleError(_0xbb647f,null));};exports[_0x0791('0x26')]=function(_0x2a6d30,_0xfe8662){return db[_0x0791('0x2d')]['find']({'where':{'id':_0x2a6d30['params']['id']}})[_0x0791('0x25')](handleEntityNotFound(_0xfe8662,null))[_0x0791('0x25')](removeEntity(_0xfe8662,null))[_0x0791('0x4c')](handleError(_0xfe8662,null));};exports['describe']=function(_0x5300aa,_0x21bb39){return db[_0x0791('0x2d')][_0x0791('0x4d')]()[_0x0791('0x25')](respondWithResult(_0x21bb39,null))[_0x0791('0x4c')](handleError(_0x21bb39,null));}; \ No newline at end of file +var _0x621a=['save','update','destroy','then','error','send','index','SquareDetailsReport','rawAttributes','type','key','model','map','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x12572d,_0x1d44c3){var _0x14bdfa=function(_0x364fde){while(--_0x364fde){_0x12572d['push'](_0x12572d['shift']());}};_0x14bdfa(++_0x1d44c3);}(_0x621a,0x76));var _0xa621=function(_0x11c30d,_0x566175){_0x11c30d=_0x11c30d-0x0;var _0x43c1b3=_0x621a[_0x11c30d];return _0x43c1b3;};'use strict';var emlformat=require(_0xa621('0x0'));var rimraf=require(_0xa621('0x1'));var zipdir=require(_0xa621('0x2'));var jsonpatch=require(_0xa621('0x3'));var rp=require(_0xa621('0x4'));var moment=require(_0xa621('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa621('0x6'));var util=require(_0xa621('0x7'));var path=require(_0xa621('0x8'));var sox=require(_0xa621('0x9'));var csv=require(_0xa621('0xa'));var ejs=require(_0xa621('0xb'));var fs=require('fs');var fs_extra=require(_0xa621('0xc'));var _=require(_0xa621('0xd'));var squel=require(_0xa621('0xe'));var crypto=require('crypto');var jsforce=require(_0xa621('0xf'));var deskjs=require(_0xa621('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa621('0x11'));var Papa=require('papaparse');var Redis=require(_0xa621('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa621('0x13'));var as=require(_0xa621('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa621('0x15'));var utils=require(_0xa621('0x16'));var config=require(_0xa621('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa621('0x18'))['db'];function respondWithStatusCode(_0x1d9eda,_0x418ec5){_0x418ec5=_0x418ec5||0xcc;return function(_0x469504){if(_0x469504){return _0x1d9eda['sendStatus'](_0x418ec5);}return _0x1d9eda[_0xa621('0x19')](_0x418ec5)[_0xa621('0x1a')]();};}function respondWithResult(_0x5bbea4,_0x13cbde){_0x13cbde=_0x13cbde||0xc8;return function(_0x7f1f7c){if(_0x7f1f7c){return _0x5bbea4[_0xa621('0x19')](_0x13cbde)[_0xa621('0x1b')](_0x7f1f7c);}};}function respondWithFilteredResult(_0xb68dae,_0x48ccd6){return function(_0x149d5a){if(_0x149d5a){var _0x23d37c=typeof _0x48ccd6[_0xa621('0x1c')]===_0xa621('0x1d')&&typeof _0x48ccd6[_0xa621('0x1e')]===_0xa621('0x1d');var _0x42f75a=_0x149d5a[_0xa621('0x1f')];var _0x15e589=_0x23d37c?0x0:_0x48ccd6[_0xa621('0x1c')];var _0x2ee36d=_0x23d37c?_0x149d5a[_0xa621('0x1f')]:_0x48ccd6[_0xa621('0x1c')]+_0x48ccd6[_0xa621('0x1e')];var _0x16f82b;if(_0x2ee36d>=_0x42f75a){_0x2ee36d=_0x42f75a;_0x16f82b=0xc8;}else{_0x16f82b=0xce;}_0xb68dae[_0xa621('0x19')](_0x16f82b);return _0xb68dae[_0xa621('0x20')](_0xa621('0x21'),_0x15e589+'-'+_0x2ee36d+'/'+_0x42f75a)['json'](_0x149d5a);}return null;};}function patchUpdates(_0x56747f){return function(_0x1bef88){try{jsonpatch[_0xa621('0x22')](_0x1bef88,_0x56747f,!![]);}catch(_0xafefe1){return BPromise[_0xa621('0x23')](_0xafefe1);}return _0x1bef88[_0xa621('0x24')]();};}function saveUpdates(_0x67f021,_0x1fa3ce){return function(_0x15191e){if(_0x15191e){return _0x15191e[_0xa621('0x25')](_0x67f021)['then'](function(_0x30d55a){return _0x30d55a;});}return null;};}function removeEntity(_0x3aa39f,_0x40aa59){return function(_0x1ae2cb){if(_0x1ae2cb){return _0x1ae2cb[_0xa621('0x26')]()[_0xa621('0x27')](function(){_0x3aa39f[_0xa621('0x19')](0xcc)[_0xa621('0x1a')]();});}};}function handleEntityNotFound(_0x26f976,_0x3146a0){return function(_0x404647){if(!_0x404647){_0x26f976['sendStatus'](0x194);}return _0x404647;};}function handleError(_0x32f05a,_0x573cb4){_0x573cb4=_0x573cb4||0x1f4;return function(_0x39d61b){logger[_0xa621('0x28')](_0x39d61b['stack']);if(_0x39d61b['name']){delete _0x39d61b['name'];}_0x32f05a[_0xa621('0x19')](_0x573cb4)[_0xa621('0x29')](_0x39d61b);};}exports[_0xa621('0x2a')]=function(_0x37cc1d,_0x42561a){var _0x27dc1b={},_0x2dd4b6={},_0x261053={'count':0x0,'rows':[]};var _0x11a0d6=_['map'](db[_0xa621('0x2b')][_0xa621('0x2c')],function(_0x4fefc3){return{'name':_0x4fefc3['fieldName'],'type':_0x4fefc3[_0xa621('0x2d')][_0xa621('0x2e')]};});_0x2dd4b6[_0xa621('0x2f')]=_[_0xa621('0x30')](_0x11a0d6,_0xa621('0x31'));_0x2dd4b6['query']=_['keys'](_0x37cc1d[_0xa621('0x32')]);_0x2dd4b6[_0xa621('0x33')]=_[_0xa621('0x34')](_0x2dd4b6[_0xa621('0x2f')],_0x2dd4b6['query']);_0x27dc1b[_0xa621('0x35')]=_[_0xa621('0x34')](_0x2dd4b6[_0xa621('0x2f')],qs[_0xa621('0x36')](_0x37cc1d[_0xa621('0x32')][_0xa621('0x36')]));_0x27dc1b['attributes']=_0x27dc1b[_0xa621('0x35')]['length']?_0x27dc1b[_0xa621('0x35')]:_0x2dd4b6[_0xa621('0x2f')];if(!_0x37cc1d[_0xa621('0x32')][_0xa621('0x37')](_0xa621('0x38'))){_0x27dc1b[_0xa621('0x1e')]=qs['limit'](_0x37cc1d[_0xa621('0x32')][_0xa621('0x1e')]);_0x27dc1b[_0xa621('0x1c')]=qs[_0xa621('0x1c')](_0x37cc1d['query']['offset']);}_0x27dc1b[_0xa621('0x39')]=qs[_0xa621('0x3a')](_0x37cc1d[_0xa621('0x32')][_0xa621('0x3a')]);_0x27dc1b[_0xa621('0x3b')]=qs[_0xa621('0x33')](_[_0xa621('0x3c')](_0x37cc1d['query'],_0x2dd4b6[_0xa621('0x33')]),_0x11a0d6);if(_0x37cc1d[_0xa621('0x32')][_0xa621('0x3d')]){_0x27dc1b[_0xa621('0x3b')]=_['merge'](_0x27dc1b[_0xa621('0x3b')],{'$or':_[_0xa621('0x30')](_0x11a0d6,function(_0xc71042){if(_0xc71042[_0xa621('0x2d')]!==_0xa621('0x3e')){var _0x47f15b={};_0x47f15b[_0xc71042[_0xa621('0x31')]]={'$like':'%'+_0x37cc1d[_0xa621('0x32')]['filter']+'%'};return _0x47f15b;}})});}_0x27dc1b=_[_0xa621('0x3f')]({},_0x27dc1b,_0x37cc1d[_0xa621('0x40')]);var _0xc8c380={'where':_0x27dc1b[_0xa621('0x3b')]};return db[_0xa621('0x2b')][_0xa621('0x1f')](_0xc8c380)[_0xa621('0x27')](function(_0x31aa04){_0x261053[_0xa621('0x1f')]=_0x31aa04;if(_0x37cc1d['query']['includeAll']){_0x27dc1b[_0xa621('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xa621('0x42')](_0x27dc1b);})['then'](function(_0x204a7c){_0x261053[_0xa621('0x43')]=_0x204a7c;return _0x261053;})[_0xa621('0x27')](respondWithFilteredResult(_0x42561a,_0x27dc1b))[_0xa621('0x44')](handleError(_0x42561a,null));};exports[_0xa621('0x45')]=function(_0x2b4fd7,_0x4e2cb9){var _0x4513b4={'raw':!![],'where':{'id':_0x2b4fd7[_0xa621('0x46')]['id']}},_0x563270={};_0x563270[_0xa621('0x2f')]=_['keys'](db[_0xa621('0x2b')]['rawAttributes']);_0x563270[_0xa621('0x32')]=_['keys'](_0x2b4fd7['query']);_0x563270[_0xa621('0x33')]=_[_0xa621('0x34')](_0x563270[_0xa621('0x2f')],_0x563270[_0xa621('0x32')]);_0x4513b4[_0xa621('0x35')]=_['intersection'](_0x563270['model'],qs[_0xa621('0x36')](_0x2b4fd7[_0xa621('0x32')][_0xa621('0x36')]));_0x4513b4[_0xa621('0x35')]=_0x4513b4[_0xa621('0x35')][_0xa621('0x47')]?_0x4513b4[_0xa621('0x35')]:_0x563270[_0xa621('0x2f')];if(_0x2b4fd7[_0xa621('0x32')][_0xa621('0x48')]){_0x4513b4['include']=[{'all':!![]}];}_0x4513b4=_[_0xa621('0x3f')]({},_0x4513b4,_0x2b4fd7[_0xa621('0x40')]);return db[_0xa621('0x2b')]['find'](_0x4513b4)['then'](handleEntityNotFound(_0x4e2cb9,null))[_0xa621('0x27')](respondWithResult(_0x4e2cb9,null))[_0xa621('0x44')](handleError(_0x4e2cb9,null));};exports['create']=function(_0x4f6198,_0x1d764d){return db[_0xa621('0x2b')][_0xa621('0x49')](_0x4f6198[_0xa621('0x4a')],{})[_0xa621('0x27')](respondWithResult(_0x1d764d,0xc9))['catch'](handleError(_0x1d764d,null));};exports['update']=function(_0x208891,_0x3e8265){if(_0x208891[_0xa621('0x4a')]['id']){delete _0x208891[_0xa621('0x4a')]['id'];}return db[_0xa621('0x2b')][_0xa621('0x4b')]({'where':{'id':_0x208891[_0xa621('0x46')]['id']}})[_0xa621('0x27')](handleEntityNotFound(_0x3e8265,null))[_0xa621('0x27')](saveUpdates(_0x208891[_0xa621('0x4a')],null))[_0xa621('0x27')](respondWithResult(_0x3e8265,null))['catch'](handleError(_0x3e8265,null));};exports[_0xa621('0x26')]=function(_0x78b6d1,_0x2b6675){return db[_0xa621('0x2b')][_0xa621('0x4b')]({'where':{'id':_0x78b6d1[_0xa621('0x46')]['id']}})[_0xa621('0x27')](handleEntityNotFound(_0x2b6675,null))[_0xa621('0x27')](removeEntity(_0x2b6675,null))['catch'](handleError(_0x2b6675,null));};exports[_0xa621('0x4c')]=function(_0x267740,_0x55fa6e){return db['SquareDetailsReport'][_0xa621('0x4c')]()['then'](respondWithResult(_0x55fa6e,null))[_0xa621('0x44')](handleError(_0x55fa6e,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 532bb26..de91e1f 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 _0xa99f=['moment','bluebird','rimraf','../../config/environment','exports','define','report_square_details','lodash','util','../../config/logger','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa99f,0x96));var _0xfa99=function(_0x1f51cc,_0x4efcea){_0x1f51cc=_0x1f51cc-0x0;var _0x2d2d0a=_0xa99f[_0x1f51cc];return _0x2d2d0a;};'use strict';var _=require(_0xfa99('0x0'));var util=require(_0xfa99('0x1'));var logger=require(_0xfa99('0x2'))(_0xfa99('0x3'));var moment=require(_0xfa99('0x4'));var BPromise=require(_0xfa99('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfa99('0x6'));var config=require(_0xfa99('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0xfa99('0x8')]=function(_0x4c6271,_0x956370){return _0x4c6271[_0xfa99('0x9')]('SquareDetailsReport',attributes,{'tableName':_0xfa99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4007=['../../config/environment','./squareReportDetail.attributes','exports','report_square_details','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4007,0x1bc));var _0x7400=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4007[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x7400('0x0'));var util=require(_0x7400('0x1'));var logger=require(_0x7400('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7400('0x3'));var rp=require(_0x7400('0x4'));var fs=require('fs');var path=require(_0x7400('0x5'));var rimraf=require(_0x7400('0x6'));var config=require(_0x7400('0x7'));var attributes=require(_0x7400('0x8'));module[_0x7400('0x9')]=function(_0x16e551,_0x51111c){return _0x16e551['define']('SquareDetailsReport',attributes,{'tableName':_0x7400('0xa'),'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 9bc33b5..75dc35e 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 _0x9158=['raw','debug','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options'];(function(_0x59f3bd,_0x61cf5d){var _0xc58795=function(_0x4df437){while(--_0x4df437){_0x59f3bd['push'](_0x59f3bd['shift']());}};_0xc58795(++_0x61cf5d);}(_0x9158,0x16e));var _0x8915=function(_0x3541f0,_0x4c99bf){_0x3541f0=_0x3541f0-0x0;var _0x27fbbc=_0x9158[_0x3541f0];return _0x27fbbc;};'use strict';var _=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var moment=require(_0x8915('0x2'));var BPromise=require('bluebird');var rs=require(_0x8915('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8915('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8915('0x5'));var config=require(_0x8915('0x6'));var jayson=require(_0x8915('0x7'));var client=jayson[_0x8915('0x8')][_0x8915('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ff3d,_0x33abdd,_0x100d72){return new BPromise(function(_0x50d1f8,_0x41be04){return client[_0x8915('0xa')](_0x20ff3d,_0x100d72)[_0x8915('0xb')](function(_0x1a5403){logger[_0x8915('0xc')](_0x8915('0xd'),_0x33abdd,_0x8915('0xe'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x33abdd,_0x8915('0xe'),JSON[_0x8915('0xf')](_0x1a5403));if(_0x1a5403[_0x8915('0x10')]){if(_0x1a5403[_0x8915('0x10')][_0x8915('0x11')]===0x1f4){logger[_0x8915('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x33abdd,_0x1a5403[_0x8915('0x10')][_0x8915('0x12')]);return _0x41be04(_0x1a5403['error'][_0x8915('0x12')]);}logger['error'](_0x8915('0xd'),_0x33abdd,_0x1a5403['error'][_0x8915('0x12')]);return _0x50d1f8(_0x1a5403[_0x8915('0x10')][_0x8915('0x12')]);}else{logger[_0x8915('0xc')](_0x8915('0xd'),_0x33abdd,_0x8915('0xe'));_0x50d1f8(_0x1a5403[_0x8915('0x13')][_0x8915('0x12')]);}})[_0x8915('0x14')](function(_0x3f541c){logger[_0x8915('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x33abdd,_0x3f541c);_0x41be04(_0x3f541c);});});}exports[_0x8915('0x15')]=function(_0x913dc){var _0x5ccd36=this;return new Promise(function(_0x5987d4,_0x17bb6c){return db[_0x8915('0x16')][_0x8915('0x17')](_0x913dc[_0x8915('0x18')],{'raw':_0x913dc[_0x8915('0x19')]?_0x913dc[_0x8915('0x19')][_0x8915('0x1a')]===undefined?!![]:![]:!![]})[_0x8915('0xb')](function(_0x511dcd){logger['info'](_0x8915('0x15'),_0x913dc);logger[_0x8915('0x1b')](_0x8915('0x15'),_0x913dc,JSON[_0x8915('0xf')](_0x511dcd));_0x5987d4(_0x511dcd);})['catch'](function(_0x2eebe1){logger[_0x8915('0x10')](_0x8915('0x15'),_0x2eebe1[_0x8915('0x12')],_0x913dc);_0x17bb6c(_0x5ccd36[_0x8915('0x10')](0x1f4,_0x2eebe1[_0x8915('0x12')]));});});}; \ No newline at end of file +var _0xc901=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','catch','lodash','ioredis'];(function(_0x3a29b4,_0x2f9cc5){var _0x5f538b=function(_0x5b3f93){while(--_0x5b3f93){_0x3a29b4['push'](_0x3a29b4['shift']());}};_0x5f538b(++_0x2f9cc5);}(_0xc901,0x142));var _0x1c90=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc901[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c90('0x1'));var db=require(_0x1c90('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c90('0x3'))(_0x1c90('0x4'));var config=require(_0x1c90('0x5'));var jayson=require(_0x1c90('0x6'));var client=jayson[_0x1c90('0x7')][_0x1c90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x912860,_0x12c07d,_0x423cfb){return new BPromise(function(_0x19196f,_0x514386){return client[_0x1c90('0x9')](_0x912860,_0x423cfb)[_0x1c90('0xa')](function(_0x38cd18){logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));logger[_0x1c90('0xe')](_0x1c90('0xf'),_0x12c07d,'request\x20sent',JSON['stringify'](_0x38cd18));if(_0x38cd18[_0x1c90('0x10')]){if(_0x38cd18[_0x1c90('0x10')][_0x1c90('0x11')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x12c07d,_0x38cd18[_0x1c90('0x10')][_0x1c90('0x12')]);return _0x514386(_0x38cd18['error'][_0x1c90('0x12')]);}logger[_0x1c90('0x10')](_0x1c90('0xc'),_0x12c07d,_0x38cd18['error'][_0x1c90('0x12')]);return _0x19196f(_0x38cd18['error'][_0x1c90('0x12')]);}else{logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));_0x19196f(_0x38cd18['result'][_0x1c90('0x12')]);}})['catch'](function(_0x2d3c90){logger[_0x1c90('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x12c07d,_0x2d3c90);_0x514386(_0x2d3c90);});});}exports[_0x1c90('0x13')]=function(_0x4ec354){var _0x582246=this;return new Promise(function(_0x128bf0,_0x5dd488){return db[_0x1c90('0x14')][_0x1c90('0x15')](_0x4ec354[_0x1c90('0x16')],{'raw':_0x4ec354[_0x1c90('0x17')]?_0x4ec354['options'][_0x1c90('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x525997){logger[_0x1c90('0xb')](_0x1c90('0x13'),_0x4ec354);logger['debug'](_0x1c90('0x13'),_0x4ec354,JSON[_0x1c90('0x19')](_0x525997));_0x128bf0(_0x525997);})[_0x1c90('0x1a')](function(_0x4074fd){logger[_0x1c90('0x10')](_0x1c90('0x13'),_0x4074fd['message'],_0x4ec354);_0x5dd488(_0x582246[_0x1c90('0x10')](0x1f4,_0x4074fd[_0x1c90('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e5ac0ae..97a0463 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 _0x4d30=['get','isAuthenticated','index','/process/:pid/kill','killProcess','express'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x4d30,0xa1));var _0x04d3=function(_0x5a8665,_0x420b2d){_0x5a8665=_0x5a8665-0x0;var _0x45d8e1=_0x4d30[_0x5a8665];return _0x45d8e1;};'use strict';var express=require(_0x04d3('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x04d3('0x1')]('/',auth[_0x04d3('0x2')](),controller[_0x04d3('0x3')]);router[_0x04d3('0x1')](_0x04d3('0x4'),auth[_0x04d3('0x2')](),controller[_0x04d3('0x5')]);module['exports']=router; \ No newline at end of file +var _0x65fc=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x149247,_0x5eb16a){var _0x2d52fa=function(_0x287845){while(--_0x287845){_0x149247['push'](_0x149247['shift']());}};_0x2d52fa(++_0x5eb16a);}(_0x65fc,0x160));var _0xc65f=function(_0x3e198d,_0x28ccc9){_0x3e198d=_0x3e198d-0x0;var _0x530a85=_0x65fc[_0x3e198d];return _0x530a85;};'use strict';var express=require(_0xc65f('0x0'));var router=express[_0xc65f('0x1')]();var auth=require(_0xc65f('0x2'));var controller=require(_0xc65f('0x3'));router[_0xc65f('0x4')]('/',auth[_0xc65f('0x5')](),controller[_0xc65f('0x6')]);router['get'](_0xc65f('0x7'),auth[_0xc65f('0x5')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 36b7679..7651834 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 _0x29d3=['child_process','exec','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','json','catch','killProcess','components/import/cm','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','systeminformation'];(function(_0x47f39e,_0x4f3b6d){var _0x10586a=function(_0x11480e){while(--_0x11480e){_0x47f39e['push'](_0x47f39e['shift']());}};_0x10586a(++_0x4f3b6d);}(_0x29d3,0x19f));var _0x329d=function(_0x1f59e7,_0x3fdf23){_0x1f59e7=_0x1f59e7-0x0;var _0x81480b=_0x29d3[_0x1f59e7];return _0x81480b;};'use strict';var info=require(_0x329d('0x0'));var exec=require(_0x329d('0x1'))[_0x329d('0x2')];var logger=require('../../config/logger')(_0x329d('0x3'));var util=require(_0x329d('0x4'));var BPromise=require(_0x329d('0x5'));var _=require('lodash');function handleError(_0x42915d,_0x1e18e6,_0x157b9b){_0x1e18e6=_0x1e18e6||0x1f4;return function(_0x31db74){logger[_0x329d('0x6')](_0x329d('0x7'),_0x157b9b,_0x1e18e6,util[_0x329d('0x8')](_0x31db74,{'showHidden':![],'depth':null}));delete _0x31db74[_0x329d('0x9')];_0x42915d[_0x329d('0xa')](_0x1e18e6)['send'](_0x31db74);};}exports[_0x329d('0xb')]=function(_0x5c9ea4,_0x5f0cee){return info[_0x329d('0xc')]()['then'](function(_0x9c6b87){return _0x5f0cee[_0x329d('0xa')](0xc8)[_0x329d('0xd')](_0x9c6b87);})[_0x329d('0xe')](function(_0x17aa94){return _0x5f0cee[_0x329d('0xa')](0x1f4)[_0x329d('0xd')](_0x17aa94);});};exports[_0x329d('0xf')]=function(_0x2a8038,_0x1e592d){var _0x13152b=[_0x329d('0x10')];return new BPromise(function(_0x4f617e,_0x4c31bd){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2a8038[_0x329d('0x11')][_0x329d('0x12')]),function(_0x85bdcc,_0x3b0012,_0x36685b){if(_0x85bdcc){return _0x4c31bd(_0x85bdcc);}return _0x4f617e(_0x3b0012);});})['then'](function(_0x4e8ff5){var _0x44d0c7=![];var _0x46dd22=_0x4e8ff5[_0x329d('0x13')](/\n/);for(var _0x2b35f2=0x0,_0x52cd1a=_0x13152b[_0x329d('0x14')];_0x2b35f2<_0x52cd1a,_0x44d0c7===![];_0x2b35f2+=0x1){if(_0x4e8ff5[_0x329d('0x15')](_0x13152b[_0x2b35f2])>=0x0){_0x44d0c7=!![];}}if(!_0x44d0c7){throw new Error(util[_0x329d('0x16')](_0x329d('0x17'),_0x2a8038[_0x329d('0x11')]['pid']));}process[_0x329d('0x18')](_0x2a8038[_0x329d('0x11')][_0x329d('0x12')],_0x329d('0x19'));return _0x1e592d[_0x329d('0xa')](0xc8)['json']({'message':util[_0x329d('0x16')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2a8038[_0x329d('0x11')][_0x329d('0x12')])});})[_0x329d('0xe')](handleError(_0x1e592d,null,_0x329d('0xf')));}; \ No newline at end of file +var _0xc298=['pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','killProcess','components/import/cm','format','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params'];(function(_0x5347de,_0x5170c8){var _0x1b6852=function(_0x30611b){while(--_0x30611b){_0x5347de['push'](_0x5347de['shift']());}};_0x1b6852(++_0x5170c8);}(_0xc298,0x68));var _0x8c29=function(_0x2136ff,_0x3cacfa){_0x2136ff=_0x2136ff-0x0;var _0x23b9a5=_0xc298[_0x2136ff];return _0x23b9a5;};'use strict';var info=require('systeminformation');var exec=require(_0x8c29('0x0'))['exec'];var logger=require(_0x8c29('0x1'))('api');var util=require(_0x8c29('0x2'));var BPromise=require(_0x8c29('0x3'));var _=require(_0x8c29('0x4'));function handleError(_0x1dc8f8,_0x522044,_0x352a2e){_0x522044=_0x522044||0x1f4;return function(_0x1d947c){logger['error'](_0x8c29('0x5'),_0x352a2e,_0x522044,util[_0x8c29('0x6')](_0x1d947c,{'showHidden':![],'depth':null}));delete _0x1d947c[_0x8c29('0x7')];_0x1dc8f8[_0x8c29('0x8')](_0x522044)[_0x8c29('0x9')](_0x1d947c);};}exports[_0x8c29('0xa')]=function(_0x3a8a32,_0x56f4d5){return info['getAllData']()[_0x8c29('0xb')](function(_0x25b06f){return _0x56f4d5[_0x8c29('0x8')](0xc8)['json'](_0x25b06f);})['catch'](function(_0x4a2fdc){return _0x56f4d5['status'](0x1f4)[_0x8c29('0xc')](_0x4a2fdc);});};exports[_0x8c29('0xd')]=function(_0x50a35d,_0x58f139){var _0x583213=[_0x8c29('0xe')];return new BPromise(function(_0xc19bbb,_0x20c629){return exec(util[_0x8c29('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x50a35d['params']['pid']),function(_0x276c6f,_0x2d8249,_0x4fc82f){if(_0x276c6f){return _0x20c629(_0x276c6f);}return _0xc19bbb(_0x2d8249);});})['then'](function(_0x545dbb){var _0x32d0cb=![];var _0x45e4d7=_0x545dbb[_0x8c29('0x10')](/\n/);for(var _0x1ebdfb=0x0,_0x5efe51=_0x583213[_0x8c29('0x11')];_0x1ebdfb<_0x5efe51,_0x32d0cb===![];_0x1ebdfb+=0x1){if(_0x545dbb[_0x8c29('0x12')](_0x583213[_0x1ebdfb])>=0x0){_0x32d0cb=!![];}}if(!_0x32d0cb){throw new Error(util['format'](_0x8c29('0x13'),_0x50a35d[_0x8c29('0x14')][_0x8c29('0x15')]));}process[_0x8c29('0x16')](_0x50a35d[_0x8c29('0x14')]['pid'],'SIGINT');return _0x58f139['status'](0xc8)['json']({'message':util[_0x8c29('0xf')](_0x8c29('0x17'),_0x50a35d['params']['pid'])});})[_0x8c29('0x18')](handleError(_0x58f139,null,_0x8c29('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7239bc3..c225101 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 _0x4704=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x3c1a4f,_0xe9fe10){var _0x551a79=function(_0x59c2a7){while(--_0x59c2a7){_0x3c1a4f['push'](_0x3c1a4f['shift']());}};_0x551a79(++_0xe9fe10);}(_0x4704,0x19a));var _0x4470=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0x4704[_0x512550];return _0x19f661;};'use strict';var multer=require(_0x4470('0x0'));var util=require('util');var path=require(_0x4470('0x1'));var timeout=require(_0x4470('0x2'));var express=require(_0x4470('0x3'));var router=express[_0x4470('0x4')]();var fs_extra=require(_0x4470('0x5'));var auth=require(_0x4470('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4470('0x7'));var controller=require('./tag.controller');router[_0x4470('0x8')]('/',auth[_0x4470('0x9')](),controller['index']);router[_0x4470('0x8')]('/:id',auth[_0x4470('0x9')](),controller[_0x4470('0xa')]);router[_0x4470('0xb')]('/',auth[_0x4470('0x9')](),controller[_0x4470('0xc')]);router[_0x4470('0xd')]('/:id',auth[_0x4470('0x9')](),controller['update']);router['delete'](_0x4470('0xe'),auth['isAuthenticated'](),controller[_0x4470('0xf')]);module[_0x4470('0x10')]=router; \ No newline at end of file +var _0x7295=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7295,0x199));var _0x5729=function(_0x22cb10,_0x20db4f){_0x22cb10=_0x22cb10-0x0;var _0x38a6f8=_0x7295[_0x22cb10];return _0x38a6f8;};'use strict';var multer=require('multer');var util=require(_0x5729('0x0'));var path=require('path');var timeout=require(_0x5729('0x1'));var express=require(_0x5729('0x2'));var router=express[_0x5729('0x3')]();var fs_extra=require(_0x5729('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5729('0x5'));var config=require(_0x5729('0x6'));var controller=require(_0x5729('0x7'));router[_0x5729('0x8')]('/',auth['isAuthenticated'](),controller[_0x5729('0x9')]);router['get'](_0x5729('0xa'),auth[_0x5729('0xb')](),controller[_0x5729('0xc')]);router[_0x5729('0xd')]('/',auth['isAuthenticated'](),controller[_0x5729('0xe')]);router[_0x5729('0xf')](_0x5729('0xa'),auth['isAuthenticated'](),controller[_0x5729('0x10')]);router[_0x5729('0x11')](_0x5729('0xa'),auth[_0x5729('0xb')](),controller[_0x5729('0x12')]);module[_0x5729('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d5fc045..d5af532 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 _0x24b3=['STRING','sequelize','exports'];(function(_0x5edbac,_0xa54f78){var _0x2a5b78=function(_0x1c598d){while(--_0x1c598d){_0x5edbac['push'](_0x5edbac['shift']());}};_0x2a5b78(++_0xa54f78);}(_0x24b3,0xd3));var _0x324b=function(_0x25718b,_0x4a3d35){_0x25718b=_0x25718b-0x0;var _0x505734=_0x24b3[_0x25718b];return _0x505734;};'use strict';var Sequelize=require(_0x324b('0x0'));module[_0x324b('0x1')]={'name':{'type':Sequelize[_0x324b('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x324b('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xceb0=['STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xceb0,0x173));var _0x0ceb=function(_0x1cb815,_0x2c2e89){_0x1cb815=_0x1cb815-0x0;var _0x543ddc=_0xceb0[_0x1cb815];return _0x543ddc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0ceb('0x0')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x0ceb('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 72d5cc0..1f9d16a 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 _0x0eaa=['Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','index'];(function(_0x495248,_0x5b2bc9){var _0x11ca44=function(_0xe2da00){while(--_0xe2da00){_0x495248['push'](_0x495248['shift']());}};_0x11ca44(++_0x5b2bc9);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x57eedd,_0xfe922b){_0x57eedd=_0x57eedd-0x0;var _0x1e1b53=_0x0eaa[_0x57eedd];return _0x1e1b53;};'use strict';var emlformat=require(_0xa0ea('0x0'));var rimraf=require(_0xa0ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0ea('0x2'));var moment=require(_0xa0ea('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa0ea('0x4'));var util=require(_0xa0ea('0x5'));var path=require(_0xa0ea('0x6'));var sox=require(_0xa0ea('0x7'));var csv=require(_0xa0ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0ea('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa0ea('0xa'));var jsforce=require(_0xa0ea('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa0ea('0xc'));var Papa=require(_0xa0ea('0xd'));var Redis=require(_0xa0ea('0xe'));var authService=require(_0xa0ea('0xf'));var qs=require(_0xa0ea('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0ea('0x11'));var logger=require(_0xa0ea('0x12'))(_0xa0ea('0x13'));var utils=require(_0xa0ea('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa0ea('0x15'));var db=require(_0xa0ea('0x16'))['db'];function respondWithStatusCode(_0x43b1b5,_0x41216c){_0x41216c=_0x41216c||0xcc;return function(_0x3eda1d){if(_0x3eda1d){return _0x43b1b5['sendStatus'](_0x41216c);}return _0x43b1b5[_0xa0ea('0x17')](_0x41216c)[_0xa0ea('0x18')]();};}function respondWithResult(_0x58c0fa,_0x3970e5){_0x3970e5=_0x3970e5||0xc8;return function(_0x183062){if(_0x183062){return _0x58c0fa[_0xa0ea('0x17')](_0x3970e5)[_0xa0ea('0x19')](_0x183062);}};}function respondWithFilteredResult(_0x4d7f34,_0x128680){return function(_0x67dc10){if(_0x67dc10){var _0x4274c2=typeof _0x128680[_0xa0ea('0x1a')]===_0xa0ea('0x1b')&&typeof _0x128680[_0xa0ea('0x1c')]===_0xa0ea('0x1b');var _0x324555=_0x67dc10[_0xa0ea('0x1d')];var _0x405f7f=_0x4274c2?0x0:_0x128680['offset'];var _0x4ca082=_0x4274c2?_0x67dc10[_0xa0ea('0x1d')]:_0x128680[_0xa0ea('0x1a')]+_0x128680[_0xa0ea('0x1c')];var _0x1887c3;if(_0x4ca082>=_0x324555){_0x4ca082=_0x324555;_0x1887c3=0xc8;}else{_0x1887c3=0xce;}_0x4d7f34[_0xa0ea('0x17')](_0x1887c3);return _0x4d7f34[_0xa0ea('0x1e')](_0xa0ea('0x1f'),_0x405f7f+'-'+_0x4ca082+'/'+_0x324555)['json'](_0x67dc10);}return null;};}function patchUpdates(_0x916f1){return function(_0x2f8518){try{jsonpatch[_0xa0ea('0x20')](_0x2f8518,_0x916f1,!![]);}catch(_0x592dec){return BPromise[_0xa0ea('0x21')](_0x592dec);}return _0x2f8518[_0xa0ea('0x22')]();};}function saveUpdates(_0x45fda4,_0x12cda2){return function(_0x2b5af5){if(_0x2b5af5){return _0x2b5af5[_0xa0ea('0x23')](_0x45fda4)['then'](function(_0x35faa4){return _0x35faa4;});}return null;};}function removeEntity(_0x5c0ec3,_0x4d494e){return function(_0x259175){if(_0x259175){return _0x259175[_0xa0ea('0x24')]()[_0xa0ea('0x25')](function(){var _0x51b5e0=_0x259175[_0xa0ea('0x26')]({'plain':!![]});var _0x5d2d73=_0xa0ea('0x27');return db[_0xa0ea('0x28')][_0xa0ea('0x24')]({'where':{'type':_0x5d2d73,'resourceId':_0x51b5e0['id']}})[_0xa0ea('0x25')](function(){return _0x259175;});})[_0xa0ea('0x25')](function(){_0x5c0ec3[_0xa0ea('0x17')](0xcc)[_0xa0ea('0x18')]();});}};}function handleEntityNotFound(_0x287728,_0x380e09){return function(_0x208c8){if(!_0x208c8){_0x287728['sendStatus'](0x194);}return _0x208c8;};}function handleError(_0x15534e,_0x4f1acd){_0x4f1acd=_0x4f1acd||0x1f4;return function(_0x21640c){logger[_0xa0ea('0x29')](_0x21640c[_0xa0ea('0x2a')]);if(_0x21640c[_0xa0ea('0x2b')]){delete _0x21640c[_0xa0ea('0x2b')];}_0x15534e[_0xa0ea('0x17')](_0x4f1acd)['send'](_0x21640c);};}exports[_0xa0ea('0x2c')]=function(_0x5903ff,_0x210ce3){var _0x5db75e={},_0x35186b={},_0x1cb9f1={'count':0x0,'rows':[]};var _0x43a306=_['map'](db[_0xa0ea('0x2d')][_0xa0ea('0x2e')],function(_0x502df5){return{'name':_0x502df5[_0xa0ea('0x2f')],'type':_0x502df5[_0xa0ea('0x30')][_0xa0ea('0x31')]};});_0x35186b['model']=_['map'](_0x43a306,_0xa0ea('0x2b'));_0x35186b[_0xa0ea('0x32')]=_[_0xa0ea('0x33')](_0x5903ff['query']);_0x35186b[_0xa0ea('0x34')]=_[_0xa0ea('0x35')](_0x35186b[_0xa0ea('0x36')],_0x35186b[_0xa0ea('0x32')]);_0x5db75e[_0xa0ea('0x37')]=_['intersection'](_0x35186b['model'],qs[_0xa0ea('0x38')](_0x5903ff['query'][_0xa0ea('0x38')]));_0x5db75e[_0xa0ea('0x37')]=_0x5db75e[_0xa0ea('0x37')][_0xa0ea('0x39')]?_0x5db75e[_0xa0ea('0x37')]:_0x35186b['model'];if(!_0x5903ff[_0xa0ea('0x32')][_0xa0ea('0x3a')](_0xa0ea('0x3b'))){_0x5db75e[_0xa0ea('0x1c')]=qs[_0xa0ea('0x1c')](_0x5903ff[_0xa0ea('0x32')][_0xa0ea('0x1c')]);_0x5db75e[_0xa0ea('0x1a')]=qs[_0xa0ea('0x1a')](_0x5903ff[_0xa0ea('0x32')]['offset']);}_0x5db75e[_0xa0ea('0x3c')]=qs['sort'](_0x5903ff[_0xa0ea('0x32')]['sort']);_0x5db75e[_0xa0ea('0x3d')]=qs['filters'](_[_0xa0ea('0x3e')](_0x5903ff[_0xa0ea('0x32')],_0x35186b[_0xa0ea('0x34')]),_0x43a306);if(_0x5903ff[_0xa0ea('0x32')]['filter']){_0x5db75e[_0xa0ea('0x3d')]=_[_0xa0ea('0x3f')](_0x5db75e[_0xa0ea('0x3d')],{'$or':_[_0xa0ea('0x40')](_0x43a306,function(_0x2f1a35){if(_0x2f1a35[_0xa0ea('0x30')]!==_0xa0ea('0x41')){var _0x24ac13={};_0x24ac13[_0x2f1a35[_0xa0ea('0x2b')]]={'$like':'%'+_0x5903ff['query'][_0xa0ea('0x42')]+'%'};return _0x24ac13;}})});}_0x5db75e=_['merge']({},_0x5db75e,_0x5903ff[_0xa0ea('0x43')]);var _0x2b4fb4={'where':_0x5db75e[_0xa0ea('0x3d')]};return db[_0xa0ea('0x2d')][_0xa0ea('0x1d')](_0x2b4fb4)[_0xa0ea('0x25')](function(_0x209081){_0x1cb9f1[_0xa0ea('0x1d')]=_0x209081;if(_0x5903ff[_0xa0ea('0x32')][_0xa0ea('0x44')]){_0x5db75e[_0xa0ea('0x45')]=[{'all':!![]}];}return db[_0xa0ea('0x2d')][_0xa0ea('0x46')](_0x5db75e);})[_0xa0ea('0x25')](function(_0x3139ad){_0x1cb9f1['rows']=_0x3139ad;return _0x1cb9f1;})[_0xa0ea('0x25')](respondWithFilteredResult(_0x210ce3,_0x5db75e))['catch'](handleError(_0x210ce3,null));};exports[_0xa0ea('0x47')]=function(_0x59e305,_0x52ef60){var _0x5c3e6c={'raw':!![],'where':{'id':_0x59e305[_0xa0ea('0x48')]['id']}},_0x53606e={};_0x53606e[_0xa0ea('0x36')]=_['keys'](db[_0xa0ea('0x2d')][_0xa0ea('0x2e')]);_0x53606e[_0xa0ea('0x32')]=_['keys'](_0x59e305['query']);_0x53606e['filters']=_[_0xa0ea('0x35')](_0x53606e[_0xa0ea('0x36')],_0x53606e[_0xa0ea('0x32')]);_0x5c3e6c[_0xa0ea('0x37')]=_[_0xa0ea('0x35')](_0x53606e[_0xa0ea('0x36')],qs[_0xa0ea('0x38')](_0x59e305[_0xa0ea('0x32')][_0xa0ea('0x38')]));_0x5c3e6c[_0xa0ea('0x37')]=_0x5c3e6c[_0xa0ea('0x37')][_0xa0ea('0x39')]?_0x5c3e6c['attributes']:_0x53606e[_0xa0ea('0x36')];if(_0x59e305[_0xa0ea('0x32')][_0xa0ea('0x44')]){_0x5c3e6c[_0xa0ea('0x45')]=[{'all':!![]}];}_0x5c3e6c=_['merge']({},_0x5c3e6c,_0x59e305['options']);return db[_0xa0ea('0x2d')][_0xa0ea('0x49')](_0x5c3e6c)[_0xa0ea('0x25')](handleEntityNotFound(_0x52ef60,null))[_0xa0ea('0x25')](respondWithResult(_0x52ef60,null))[_0xa0ea('0x4a')](handleError(_0x52ef60,null));};exports[_0xa0ea('0x4b')]=function(_0x219540,_0x361210){return db[_0xa0ea('0x2d')][_0xa0ea('0x4b')](_0x219540['body'],{})[_0xa0ea('0x25')](function(_0x20061e){var _0x3fd22b=_0x219540[_0xa0ea('0x4c')][_0xa0ea('0x26')]({'plain':!![]});if(!_0x3fd22b)throw new Error(_0xa0ea('0x4d'));if(_0x3fd22b[_0xa0ea('0x4e')]==='user'){var _0x140155=_0x20061e[_0xa0ea('0x26')]({'plain':!![]});var _0x4e8e57=_0xa0ea('0x27');return db['UserProfileSection'][_0xa0ea('0x49')]({'where':{'name':_0x4e8e57,'userProfileId':_0x3fd22b[_0xa0ea('0x4f')]},'raw':!![]})[_0xa0ea('0x25')](function(_0x362613){if(_0x362613&&_0x362613[_0xa0ea('0x50')]===0x0){return db['UserProfileResource'][_0xa0ea('0x4b')]({'name':_0x140155['name'],'resourceId':_0x140155['id'],'type':_0x362613[_0xa0ea('0x2b')],'sectionId':_0x362613['id']},{})['then'](function(){return _0x20061e;});}else{return _0x20061e;}})[_0xa0ea('0x4a')](function(_0x18c602){logger['error'](_0xa0ea('0x51'),_0x18c602);throw _0x18c602;});}return _0x20061e;})[_0xa0ea('0x25')](respondWithResult(_0x361210,0xc9))[_0xa0ea('0x4a')](handleError(_0x361210,null));};exports['update']=function(_0x2b4d7c,_0x4853fe){if(_0x2b4d7c[_0xa0ea('0x52')]['id']){delete _0x2b4d7c[_0xa0ea('0x52')]['id'];}return db[_0xa0ea('0x2d')][_0xa0ea('0x49')]({'where':{'id':_0x2b4d7c[_0xa0ea('0x48')]['id']}})['then'](handleEntityNotFound(_0x4853fe,null))[_0xa0ea('0x25')](saveUpdates(_0x2b4d7c['body'],null))['then'](respondWithResult(_0x4853fe,null))[_0xa0ea('0x4a')](handleError(_0x4853fe,null));};exports[_0xa0ea('0x24')]=function(_0x6059b4,_0x4c8aa7){return db[_0xa0ea('0x2d')][_0xa0ea('0x49')]({'where':{'id':_0x6059b4[_0xa0ea('0x48')]['id']}})[_0xa0ea('0x25')](handleEntityNotFound(_0x4c8aa7,null))[_0xa0ea('0x25')](removeEntity(_0x4c8aa7,null))[_0xa0ea('0x4a')](handleError(_0x4c8aa7,null));}; \ No newline at end of file +var _0x9aea=['status','Content-Range','apply','reject','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined'];(function(_0x12bfa4,_0x3d340f){var _0x1b1d88=function(_0x14ba53){while(--_0x14ba53){_0x12bfa4['push'](_0x12bfa4['shift']());}};_0x1b1d88(++_0x3d340f);}(_0x9aea,0xdd));var _0xa9ae=function(_0x2b207a,_0x5da40a){_0x2b207a=_0x2b207a-0x0;var _0x2197f3=_0x9aea[_0x2b207a];return _0x2197f3;};'use strict';var emlformat=require(_0xa9ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ae('0x2'));var moment=require(_0xa9ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9ae('0x4'));var util=require(_0xa9ae('0x5'));var path=require(_0xa9ae('0x6'));var sox=require(_0xa9ae('0x7'));var csv=require(_0xa9ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ae('0x9'));var _=require(_0xa9ae('0xa'));var squel=require(_0xa9ae('0xb'));var crypto=require('crypto');var jsforce=require(_0xa9ae('0xc'));var deskjs=require(_0xa9ae('0xd'));var toCsv=require(_0xa9ae('0x8'));var querystring=require(_0xa9ae('0xe'));var Papa=require(_0xa9ae('0xf'));var Redis=require(_0xa9ae('0x10'));var authService=require(_0xa9ae('0x11'));var qs=require(_0xa9ae('0x12'));var as=require(_0xa9ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9ae('0x14'))('api');var utils=require(_0xa9ae('0x15'));var config=require(_0xa9ae('0x16'));var licenseUtil=require(_0xa9ae('0x17'));var db=require(_0xa9ae('0x18'))['db'];function respondWithStatusCode(_0x35f861,_0x33a72f){_0x33a72f=_0x33a72f||0xcc;return function(_0xa34271){if(_0xa34271){return _0x35f861[_0xa9ae('0x19')](_0x33a72f);}return _0x35f861['status'](_0x33a72f)[_0xa9ae('0x1a')]();};}function respondWithResult(_0x365e90,_0x10882e){_0x10882e=_0x10882e||0xc8;return function(_0x3f7f61){if(_0x3f7f61){return _0x365e90['status'](_0x10882e)[_0xa9ae('0x1b')](_0x3f7f61);}};}function respondWithFilteredResult(_0x1ec742,_0x31c03e){return function(_0x40b756){if(_0x40b756){var _0x77b0a4=typeof _0x31c03e[_0xa9ae('0x1c')]==='undefined'&&typeof _0x31c03e[_0xa9ae('0x1d')]===_0xa9ae('0x1e');var _0x3e31d9=_0x40b756['count'];var _0x4dbb30=_0x77b0a4?0x0:_0x31c03e[_0xa9ae('0x1c')];var _0x581345=_0x77b0a4?_0x40b756['count']:_0x31c03e[_0xa9ae('0x1c')]+_0x31c03e[_0xa9ae('0x1d')];var _0xbfd2ff;if(_0x581345>=_0x3e31d9){_0x581345=_0x3e31d9;_0xbfd2ff=0xc8;}else{_0xbfd2ff=0xce;}_0x1ec742[_0xa9ae('0x1f')](_0xbfd2ff);return _0x1ec742['set'](_0xa9ae('0x20'),_0x4dbb30+'-'+_0x581345+'/'+_0x3e31d9)[_0xa9ae('0x1b')](_0x40b756);}return null;};}function patchUpdates(_0x39f133){return function(_0x688153){try{jsonpatch[_0xa9ae('0x21')](_0x688153,_0x39f133,!![]);}catch(_0x2e204d){return BPromise[_0xa9ae('0x22')](_0x2e204d);}return _0x688153['save']();};}function saveUpdates(_0xc021cf,_0x4ca9a9){return function(_0x49dca9){if(_0x49dca9){return _0x49dca9['update'](_0xc021cf)['then'](function(_0x1afd07){return _0x1afd07;});}return null;};}function removeEntity(_0x4edd55,_0x13fb05){return function(_0x5093ad){if(_0x5093ad){return _0x5093ad[_0xa9ae('0x23')]()[_0xa9ae('0x24')](function(){var _0x93d637=_0x5093ad[_0xa9ae('0x25')]({'plain':!![]});var _0x12b061=_0xa9ae('0x26');return db[_0xa9ae('0x27')]['destroy']({'where':{'type':_0x12b061,'resourceId':_0x93d637['id']}})[_0xa9ae('0x24')](function(){return _0x5093ad;});})[_0xa9ae('0x24')](function(){_0x4edd55[_0xa9ae('0x1f')](0xcc)[_0xa9ae('0x1a')]();});}};}function handleEntityNotFound(_0x222db7,_0x428934){return function(_0xb12fa8){if(!_0xb12fa8){_0x222db7['sendStatus'](0x194);}return _0xb12fa8;};}function handleError(_0x489e88,_0x2f1a9f){_0x2f1a9f=_0x2f1a9f||0x1f4;return function(_0x3c324e){logger[_0xa9ae('0x28')](_0x3c324e[_0xa9ae('0x29')]);if(_0x3c324e[_0xa9ae('0x2a')]){delete _0x3c324e['name'];}_0x489e88['status'](_0x2f1a9f)[_0xa9ae('0x2b')](_0x3c324e);};}exports[_0xa9ae('0x2c')]=function(_0x372ec7,_0x3a48b7){var _0x314969={},_0x36bc28={},_0x5d0c84={'count':0x0,'rows':[]};var _0x5415f1=_[_0xa9ae('0x2d')](db[_0xa9ae('0x2e')][_0xa9ae('0x2f')],function(_0x3cd87a){return{'name':_0x3cd87a[_0xa9ae('0x30')],'type':_0x3cd87a[_0xa9ae('0x31')][_0xa9ae('0x32')]};});_0x36bc28[_0xa9ae('0x33')]=_['map'](_0x5415f1,_0xa9ae('0x2a'));_0x36bc28['query']=_[_0xa9ae('0x34')](_0x372ec7[_0xa9ae('0x35')]);_0x36bc28[_0xa9ae('0x36')]=_['intersection'](_0x36bc28[_0xa9ae('0x33')],_0x36bc28[_0xa9ae('0x35')]);_0x314969[_0xa9ae('0x37')]=_[_0xa9ae('0x38')](_0x36bc28[_0xa9ae('0x33')],qs['fields'](_0x372ec7[_0xa9ae('0x35')][_0xa9ae('0x39')]));_0x314969[_0xa9ae('0x37')]=_0x314969['attributes']['length']?_0x314969[_0xa9ae('0x37')]:_0x36bc28[_0xa9ae('0x33')];if(!_0x372ec7[_0xa9ae('0x35')][_0xa9ae('0x3a')]('nolimit')){_0x314969[_0xa9ae('0x1d')]=qs[_0xa9ae('0x1d')](_0x372ec7[_0xa9ae('0x35')][_0xa9ae('0x1d')]);_0x314969[_0xa9ae('0x1c')]=qs['offset'](_0x372ec7[_0xa9ae('0x35')]['offset']);}_0x314969[_0xa9ae('0x3b')]=qs[_0xa9ae('0x3c')](_0x372ec7[_0xa9ae('0x35')]['sort']);_0x314969[_0xa9ae('0x3d')]=qs[_0xa9ae('0x36')](_[_0xa9ae('0x3e')](_0x372ec7['query'],_0x36bc28[_0xa9ae('0x36')]),_0x5415f1);if(_0x372ec7[_0xa9ae('0x35')]['filter']){_0x314969[_0xa9ae('0x3d')]=_['merge'](_0x314969[_0xa9ae('0x3d')],{'$or':_[_0xa9ae('0x2d')](_0x5415f1,function(_0x4bbc74){if(_0x4bbc74[_0xa9ae('0x31')]!==_0xa9ae('0x3f')){var _0x234da5={};_0x234da5[_0x4bbc74[_0xa9ae('0x2a')]]={'$like':'%'+_0x372ec7[_0xa9ae('0x35')][_0xa9ae('0x40')]+'%'};return _0x234da5;}})});}_0x314969=_['merge']({},_0x314969,_0x372ec7[_0xa9ae('0x41')]);var _0xa12887={'where':_0x314969['where']};return db['Tag'][_0xa9ae('0x42')](_0xa12887)[_0xa9ae('0x24')](function(_0xc4f775){_0x5d0c84[_0xa9ae('0x42')]=_0xc4f775;if(_0x372ec7['query'][_0xa9ae('0x43')]){_0x314969[_0xa9ae('0x44')]=[{'all':!![]}];}return db[_0xa9ae('0x2e')][_0xa9ae('0x45')](_0x314969);})[_0xa9ae('0x24')](function(_0x2bef06){_0x5d0c84[_0xa9ae('0x46')]=_0x2bef06;return _0x5d0c84;})['then'](respondWithFilteredResult(_0x3a48b7,_0x314969))[_0xa9ae('0x47')](handleError(_0x3a48b7,null));};exports[_0xa9ae('0x48')]=function(_0x566cb0,_0x419ba7){var _0x542477={'raw':!![],'where':{'id':_0x566cb0[_0xa9ae('0x49')]['id']}},_0xb51a6c={};_0xb51a6c[_0xa9ae('0x33')]=_[_0xa9ae('0x34')](db[_0xa9ae('0x2e')][_0xa9ae('0x2f')]);_0xb51a6c[_0xa9ae('0x35')]=_['keys'](_0x566cb0[_0xa9ae('0x35')]);_0xb51a6c[_0xa9ae('0x36')]=_['intersection'](_0xb51a6c[_0xa9ae('0x33')],_0xb51a6c[_0xa9ae('0x35')]);_0x542477[_0xa9ae('0x37')]=_[_0xa9ae('0x38')](_0xb51a6c[_0xa9ae('0x33')],qs[_0xa9ae('0x39')](_0x566cb0['query'][_0xa9ae('0x39')]));_0x542477['attributes']=_0x542477[_0xa9ae('0x37')][_0xa9ae('0x4a')]?_0x542477['attributes']:_0xb51a6c['model'];if(_0x566cb0[_0xa9ae('0x35')][_0xa9ae('0x43')]){_0x542477[_0xa9ae('0x44')]=[{'all':!![]}];}_0x542477=_[_0xa9ae('0x4b')]({},_0x542477,_0x566cb0[_0xa9ae('0x41')]);return db[_0xa9ae('0x2e')][_0xa9ae('0x4c')](_0x542477)[_0xa9ae('0x24')](handleEntityNotFound(_0x419ba7,null))['then'](respondWithResult(_0x419ba7,null))['catch'](handleError(_0x419ba7,null));};exports[_0xa9ae('0x4d')]=function(_0x3cf89c,_0x4efe55){return db[_0xa9ae('0x2e')][_0xa9ae('0x4d')](_0x3cf89c[_0xa9ae('0x4e')],{})[_0xa9ae('0x24')](function(_0x36636f){var _0x104af2=_0x3cf89c[_0xa9ae('0x4f')][_0xa9ae('0x25')]({'plain':!![]});if(!_0x104af2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x104af2[_0xa9ae('0x50')]===_0xa9ae('0x4f')){var _0x5ea18d=_0x36636f[_0xa9ae('0x25')]({'plain':!![]});var _0x4abe30='Tags';return db['UserProfileSection'][_0xa9ae('0x4c')]({'where':{'name':_0x4abe30,'userProfileId':_0x104af2[_0xa9ae('0x51')]},'raw':!![]})['then'](function(_0x4840ea){if(_0x4840ea&&_0x4840ea['autoAssociation']===0x0){return db[_0xa9ae('0x27')]['create']({'name':_0x5ea18d[_0xa9ae('0x2a')],'resourceId':_0x5ea18d['id'],'type':_0x4840ea[_0xa9ae('0x2a')],'sectionId':_0x4840ea['id']},{})['then'](function(){return _0x36636f;});}else{return _0x36636f;}})[_0xa9ae('0x47')](function(_0x5cebe3){logger[_0xa9ae('0x28')](_0xa9ae('0x52'),_0x5cebe3);throw _0x5cebe3;});}return _0x36636f;})[_0xa9ae('0x24')](respondWithResult(_0x4efe55,0xc9))[_0xa9ae('0x47')](handleError(_0x4efe55,null));};exports[_0xa9ae('0x53')]=function(_0x233dd6,_0x1a04d4){if(_0x233dd6[_0xa9ae('0x4e')]['id']){delete _0x233dd6[_0xa9ae('0x4e')]['id'];}return db[_0xa9ae('0x2e')][_0xa9ae('0x4c')]({'where':{'id':_0x233dd6[_0xa9ae('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a04d4,null))[_0xa9ae('0x24')](saveUpdates(_0x233dd6[_0xa9ae('0x4e')],null))[_0xa9ae('0x24')](respondWithResult(_0x1a04d4,null))[_0xa9ae('0x47')](handleError(_0x1a04d4,null));};exports[_0xa9ae('0x23')]=function(_0x59de12,_0x4fe9e7){return db[_0xa9ae('0x2e')][_0xa9ae('0x4c')]({'where':{'id':_0x59de12['params']['id']}})['then'](handleEntityNotFound(_0x4fe9e7,null))[_0xa9ae('0x24')](removeEntity(_0x4fe9e7,null))['catch'](handleError(_0x4fe9e7,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 5bd158d..8270a8c 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 _0xd203=['./tag.attributes','exports','define','Tag','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf5f7b5,_0x19429c){var _0x74a62c=function(_0x1623c6){while(--_0x1623c6){_0xf5f7b5['push'](_0xf5f7b5['shift']());}};_0x74a62c(++_0x19429c);}(_0xd203,0x100));var _0x3d20=function(_0x4c7293,_0x301d0b){_0x4c7293=_0x4c7293-0x0;var _0x493013=_0xd203[_0x4c7293];return _0x493013;};'use strict';var _=require(_0x3d20('0x0'));var util=require(_0x3d20('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3d20('0x2'));var BPromise=require(_0x3d20('0x3'));var rp=require(_0x3d20('0x4'));var fs=require('fs');var path=require(_0x3d20('0x5'));var rimraf=require(_0x3d20('0x6'));var config=require(_0x3d20('0x7'));var attributes=require(_0x3d20('0x8'));module[_0x3d20('0x9')]=function(_0x349e38,_0x4ec00e){return _0x349e38[_0x3d20('0xa')](_0x3d20('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa73a=['util','../../config/logger','api','moment','bluebird','../../config/environment','./tag.attributes','exports','define','Tag'];(function(_0x1ce724,_0xbab0da){var _0xbc64d4=function(_0x46a731){while(--_0x46a731){_0x1ce724['push'](_0x1ce724['shift']());}};_0xbc64d4(++_0xbab0da);}(_0xa73a,0x82));var _0xaa73=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xa73a[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var util=require(_0xaa73('0x0'));var logger=require(_0xaa73('0x1'))(_0xaa73('0x2'));var moment=require(_0xaa73('0x3'));var BPromise=require(_0xaa73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa73('0x5'));var attributes=require(_0xaa73('0x6'));module[_0xaa73('0x7')]=function(_0x15d1c6,_0xf84c2e){return _0x15d1c6[_0xaa73('0x8')](_0xaa73('0x9'),attributes,{'tableName':'tools_tags','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 17fdcb5..a90877b 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 _0x7a59=['debug','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x7a59,0x16e));var _0x97a5=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x7a59[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97a5('0x1'));var rs=require(_0x97a5('0x2'));var fs=require('fs');var Redis=require(_0x97a5('0x3'));var db=require(_0x97a5('0x4'))['db'];var utils=require(_0x97a5('0x5'));var logger=require('../../config/logger')(_0x97a5('0x6'));var config=require(_0x97a5('0x7'));var jayson=require(_0x97a5('0x8'));var client=jayson['client'][_0x97a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d32f,_0x2663b9,_0x2c0efa){return new BPromise(function(_0x27e8a6,_0x156789){return client[_0x97a5('0xa')](_0x52d32f,_0x2c0efa)['then'](function(_0x4f34e8){logger[_0x97a5('0xb')](_0x97a5('0xc'),_0x2663b9,_0x97a5('0xd'));logger[_0x97a5('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x2663b9,'request\x20sent',JSON[_0x97a5('0xf')](_0x4f34e8));if(_0x4f34e8[_0x97a5('0x10')]){if(_0x4f34e8[_0x97a5('0x10')]['code']===0x1f4){logger[_0x97a5('0x10')](_0x97a5('0xc'),_0x2663b9,_0x4f34e8['error']['message']);return _0x156789(_0x4f34e8[_0x97a5('0x10')][_0x97a5('0x11')]);}logger['error']('Tag,\x20%s,\x20%s',_0x2663b9,_0x4f34e8['error']['message']);return _0x27e8a6(_0x4f34e8[_0x97a5('0x10')][_0x97a5('0x11')]);}else{logger[_0x97a5('0xb')]('Tag,\x20%s,\x20%s',_0x2663b9,_0x97a5('0xd'));_0x27e8a6(_0x4f34e8[_0x97a5('0x12')]['message']);}})[_0x97a5('0x13')](function(_0x5ee8ca){logger[_0x97a5('0x10')]('Tag,\x20%s,\x20%s',_0x2663b9,_0x5ee8ca);_0x156789(_0x5ee8ca);});});} \ No newline at end of file +var _0xb7c8=['error','Tag,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x32ce39,_0x368c80){var _0x249979=function(_0x3cb3ec){while(--_0x3cb3ec){_0x32ce39['push'](_0x32ce39['shift']());}};_0x249979(++_0x368c80);}(_0xb7c8,0x119));var _0x8b7c=function(_0x144906,_0x3b8034){_0x144906=_0x144906-0x0;var _0x5ad130=_0xb7c8[_0x144906];return _0x5ad130;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var moment=require(_0x8b7c('0x1'));var BPromise=require(_0x8b7c('0x2'));var rs=require(_0x8b7c('0x3'));var fs=require('fs');var Redis=require(_0x8b7c('0x4'));var db=require(_0x8b7c('0x5'))['db'];var utils=require(_0x8b7c('0x6'));var logger=require('../../config/logger')(_0x8b7c('0x7'));var config=require(_0x8b7c('0x8'));var jayson=require(_0x8b7c('0x9'));var client=jayson[_0x8b7c('0xa')][_0x8b7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12665c,_0x7a3850,_0x3c8fd6){return new BPromise(function(_0x6afb55,_0x30a924){return client[_0x8b7c('0xc')](_0x12665c,_0x3c8fd6)[_0x8b7c('0xd')](function(_0x48370e){logger[_0x8b7c('0xe')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x8b7c('0xf'));logger[_0x8b7c('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x7a3850,_0x8b7c('0xf'),JSON[_0x8b7c('0x11')](_0x48370e));if(_0x48370e[_0x8b7c('0x12')]){if(_0x48370e['error']['code']===0x1f4){logger[_0x8b7c('0x12')](_0x8b7c('0x13'),_0x7a3850,_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);return _0x30a924(_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);}logger[_0x8b7c('0x12')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);return _0x6afb55(_0x48370e[_0x8b7c('0x12')]['message']);}else{logger[_0x8b7c('0xe')](_0x8b7c('0x13'),_0x7a3850,'request\x20sent');_0x6afb55(_0x48370e[_0x8b7c('0x15')][_0x8b7c('0x14')]);}})[_0x8b7c('0x16')](function(_0x1682fd){logger[_0x8b7c('0x12')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x1682fd);_0x30a924(_0x1682fd);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 210f4c1..b66b13e 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 50b1997..80fe91b 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 _0xd8b0=['exports','sequelize'];(function(_0x1316b9,_0x2ca43e){var _0x5c6fa7=function(_0x6f1825){while(--_0x6f1825){_0x1316b9['push'](_0x1316b9['shift']());}};_0x5c6fa7(++_0x2ca43e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x5a7103,_0x4d72dc){var _0x296a97=function(_0x35337c){while(--_0x35337c){_0x5a7103['push'](_0x5a7103['shift']());}};_0x296a97(++_0x4d72dc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 526e427..9a5e531 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 _0xc723=['desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','Team','findAll','rows','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','sendStatus','Teams','end','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Unknown\x20channel','add','Queues','removeQueues','remove','ids','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','QueueId','TeamVoiceQueue','penalty','User','Queue','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','voicePause','all','VoicePrefixId','addAgents','removeAgents','Fax','Queue:remove','getAgents','order','hasOwnProperty','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x138f9e,_0x3dc6e9){var _0xc202f2=function(_0x40bb38){while(--_0x40bb38){_0x138f9e['push'](_0x138f9e['shift']());}};_0xc202f2(++_0x3dc6e9);}(_0xc723,0x123));var _0x3c72=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0xc723[_0x45ce08];return _0x23dff2;};'use strict';var emlformat=require(_0x3c72('0x0'));var rimraf=require(_0x3c72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c72('0x2'));var rp=require('request-promise');var moment=require(_0x3c72('0x3'));var BPromise=require(_0x3c72('0x4'));var Mustache=require(_0x3c72('0x5'));var util=require(_0x3c72('0x6'));var path=require(_0x3c72('0x7'));var sox=require(_0x3c72('0x8'));var csv=require(_0x3c72('0x9'));var ejs=require(_0x3c72('0xa'));var fs=require('fs');var fs_extra=require(_0x3c72('0xb'));var _=require('lodash');var squel=require(_0x3c72('0xc'));var crypto=require(_0x3c72('0xd'));var jsforce=require(_0x3c72('0xe'));var deskjs=require(_0x3c72('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c72('0x10'));var hardwareService=require(_0x3c72('0x11'));var logger=require(_0x3c72('0x12'))(_0x3c72('0x13'));var utils=require('../../config/utils');var config=require(_0x3c72('0x14'));var licenseUtil=require(_0x3c72('0x15'));var db=require(_0x3c72('0x16'))['db'];config[_0x3c72('0x17')]=_[_0x3c72('0x18')](config[_0x3c72('0x17')],{'host':_0x3c72('0x19'),'port':0x18eb});var socket=require(_0x3c72('0x1a'))(new Redis(config[_0x3c72('0x17')]));require(_0x3c72('0x1b'))[_0x3c72('0x1c')](socket);function respondWithStatusCode(_0x53c4c5,_0x46caa9){_0x46caa9=_0x46caa9||0xcc;return function(_0x486560){if(_0x486560){return _0x53c4c5['sendStatus'](_0x46caa9);}return _0x53c4c5['status'](_0x46caa9)['end']();};}function respondWithResult(_0x20ff54,_0x147dda){_0x147dda=_0x147dda||0xc8;return function(_0x2f8706){if(_0x2f8706){return _0x20ff54['status'](_0x147dda)[_0x3c72('0x1d')](_0x2f8706);}};}function respondWithFilteredResult(_0x132636,_0x21b52c){return function(_0x5a0f80){if(_0x5a0f80){var _0x2dab37=typeof _0x21b52c[_0x3c72('0x1e')]===_0x3c72('0x1f')&&typeof _0x21b52c[_0x3c72('0x20')]===_0x3c72('0x1f');var _0x3d90c5=_0x5a0f80[_0x3c72('0x21')];var _0x3d8830=_0x2dab37?0x0:_0x21b52c[_0x3c72('0x1e')];var _0x3b8304=_0x2dab37?_0x5a0f80[_0x3c72('0x21')]:_0x21b52c[_0x3c72('0x1e')]+_0x21b52c['limit'];var _0xec1390;if(_0x3b8304>=_0x3d90c5){_0x3b8304=_0x3d90c5;_0xec1390=0xc8;}else{_0xec1390=0xce;}_0x132636[_0x3c72('0x22')](_0xec1390);return _0x132636['set'](_0x3c72('0x23'),_0x3d8830+'-'+_0x3b8304+'/'+_0x3d90c5)[_0x3c72('0x1d')](_0x5a0f80);}return null;};}function patchUpdates(_0x443010){return function(_0xe46eb2){try{jsonpatch['apply'](_0xe46eb2,_0x443010,!![]);}catch(_0x5dd344){return BPromise[_0x3c72('0x24')](_0x5dd344);}return _0xe46eb2[_0x3c72('0x25')]();};}function saveUpdates(_0x1a7ebd,_0x3090f2){return function(_0x140302){if(_0x140302){return _0x140302[_0x3c72('0x26')](_0x1a7ebd)['then'](function(_0x144891){return _0x144891;});}return null;};}function handleEntityNotFound(_0x88f778,_0x2bf4b5){return function(_0x238e64){if(!_0x238e64){_0x88f778['sendStatus'](0x194);}return _0x238e64;};}function handleError(_0x16b6ae,_0x5217bd){_0x5217bd=_0x5217bd||0x1f4;return function(_0x397806){logger[_0x3c72('0x27')](_0x397806[_0x3c72('0x28')]);if(_0x397806[_0x3c72('0x29')]){delete _0x397806[_0x3c72('0x29')];}_0x16b6ae[_0x3c72('0x22')](_0x5217bd)[_0x3c72('0x2a')](_0x397806);};}exports[_0x3c72('0x2b')]=function(_0x3ed66e,_0x444346){var _0x18f370={},_0x1f192c={},_0x524d8b={'count':0x0,'rows':[]};var _0x5d6714=_[_0x3c72('0x2c')](db['Team']['rawAttributes'],function(_0x48cfb0){return{'name':_0x48cfb0[_0x3c72('0x2d')],'type':_0x48cfb0[_0x3c72('0x2e')][_0x3c72('0x2f')]};});_0x1f192c[_0x3c72('0x30')]=_[_0x3c72('0x2c')](_0x5d6714,_0x3c72('0x29'));_0x1f192c[_0x3c72('0x31')]=_[_0x3c72('0x32')](_0x3ed66e[_0x3c72('0x31')]);_0x1f192c[_0x3c72('0x33')]=_[_0x3c72('0x34')](_0x1f192c[_0x3c72('0x30')],_0x1f192c[_0x3c72('0x31')]);_0x18f370[_0x3c72('0x35')]=_['intersection'](_0x1f192c[_0x3c72('0x30')],qs[_0x3c72('0x36')](_0x3ed66e[_0x3c72('0x31')][_0x3c72('0x36')]));_0x18f370['attributes']=_0x18f370[_0x3c72('0x35')][_0x3c72('0x37')]?_0x18f370['attributes']:_0x1f192c[_0x3c72('0x30')];if(!_0x3ed66e[_0x3c72('0x31')]['hasOwnProperty'](_0x3c72('0x38'))){_0x18f370[_0x3c72('0x20')]=qs['limit'](_0x3ed66e['query']['limit']);_0x18f370['offset']=qs['offset'](_0x3ed66e['query'][_0x3c72('0x1e')]);}_0x18f370['order']=qs[_0x3c72('0x39')](_0x3ed66e[_0x3c72('0x31')]['sort']);_0x18f370[_0x3c72('0x3a')]=qs[_0x3c72('0x33')](_[_0x3c72('0x3b')](_0x3ed66e[_0x3c72('0x31')],_0x1f192c[_0x3c72('0x33')]),_0x5d6714);if(_0x3ed66e[_0x3c72('0x31')][_0x3c72('0x3c')]){_0x18f370[_0x3c72('0x3a')]=_[_0x3c72('0x3d')](_0x18f370['where'],{'$or':_[_0x3c72('0x2c')](_0x5d6714,function(_0x25d218){if(_0x25d218[_0x3c72('0x2e')]!==_0x3c72('0x3e')){var _0x4058a9={};_0x4058a9[_0x25d218[_0x3c72('0x29')]]={'$like':'%'+_0x3ed66e[_0x3c72('0x31')]['filter']+'%'};return _0x4058a9;}})});}_0x18f370=_[_0x3c72('0x3d')]({},_0x18f370,_0x3ed66e[_0x3c72('0x3f')]);var _0x101d4e={'where':_0x18f370[_0x3c72('0x3a')]};return db['Team'][_0x3c72('0x21')](_0x101d4e)[_0x3c72('0x40')](function(_0xf43eea){_0x524d8b[_0x3c72('0x21')]=_0xf43eea;if(_0x3ed66e[_0x3c72('0x31')][_0x3c72('0x41')]){_0x18f370[_0x3c72('0x42')]=[{'all':!![]}];}return db[_0x3c72('0x43')][_0x3c72('0x44')](_0x18f370);})[_0x3c72('0x40')](function(_0x231d28){_0x524d8b[_0x3c72('0x45')]=_0x231d28;return _0x524d8b;})[_0x3c72('0x40')](respondWithFilteredResult(_0x444346,_0x18f370))['catch'](handleError(_0x444346,null));};exports['show']=function(_0x2bc1af,_0x3285b6){var _0x4b0bb6={'raw':![],'where':{'id':_0x2bc1af[_0x3c72('0x46')]['id']}},_0x55dced={};_0x55dced[_0x3c72('0x30')]=_[_0x3c72('0x32')](db[_0x3c72('0x43')][_0x3c72('0x47')]);_0x55dced[_0x3c72('0x31')]=_['keys'](_0x2bc1af['query']);_0x55dced[_0x3c72('0x33')]=_[_0x3c72('0x34')](_0x55dced[_0x3c72('0x30')],_0x55dced[_0x3c72('0x31')]);_0x4b0bb6[_0x3c72('0x35')]=_[_0x3c72('0x34')](_0x55dced['model'],qs[_0x3c72('0x36')](_0x2bc1af[_0x3c72('0x31')][_0x3c72('0x36')]));_0x4b0bb6['attributes']=_0x4b0bb6[_0x3c72('0x35')][_0x3c72('0x37')]?_0x4b0bb6['attributes']:_0x55dced[_0x3c72('0x30')];if(_0x2bc1af[_0x3c72('0x31')][_0x3c72('0x41')]){_0x4b0bb6[_0x3c72('0x42')]=[{'all':!![]}];}_0x4b0bb6=_[_0x3c72('0x3d')]({},_0x4b0bb6,_0x2bc1af[_0x3c72('0x3f')]);return db[_0x3c72('0x43')][_0x3c72('0x48')](_0x4b0bb6)['then'](handleEntityNotFound(_0x3285b6,null))[_0x3c72('0x40')](respondWithResult(_0x3285b6,null))['catch'](handleError(_0x3285b6,null));};exports[_0x3c72('0x49')]=function(_0x2a2018,_0x1959eb){return db['Team']['create'](_0x2a2018['body'],{})[_0x3c72('0x40')](function(_0x40f791){var _0x2bb05c=_0x2a2018[_0x3c72('0x4a')][_0x3c72('0x4b')]({'plain':!![]});if(!_0x2bb05c)throw new Error(_0x3c72('0x4c'));if(_0x2bb05c['role']===_0x3c72('0x4a')){var _0x4030d0=_0x40f791[_0x3c72('0x4b')]({'plain':!![]});var _0x32550a='Teams';return db[_0x3c72('0x4d')][_0x3c72('0x48')]({'where':{'name':_0x32550a,'userProfileId':_0x2bb05c[_0x3c72('0x4e')]},'raw':!![]})[_0x3c72('0x40')](function(_0x1f5f20){if(_0x1f5f20&&_0x1f5f20[_0x3c72('0x4f')]===0x0){return db[_0x3c72('0x50')]['create']({'name':_0x4030d0['name'],'resourceId':_0x4030d0['id'],'type':_0x1f5f20[_0x3c72('0x29')],'sectionId':_0x1f5f20['id']},{})[_0x3c72('0x40')](function(){return _0x40f791;});}else{return _0x40f791;}})[_0x3c72('0x51')](function(_0x1a6e2d){logger[_0x3c72('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a6e2d);throw _0x1a6e2d;});}return _0x40f791;})['then'](respondWithResult(_0x1959eb,0xc9))['catch'](handleError(_0x1959eb,null));};exports[_0x3c72('0x26')]=function(_0x496bfe,_0x415424){if(_0x496bfe[_0x3c72('0x52')]['id']){delete _0x496bfe[_0x3c72('0x52')]['id'];}return db[_0x3c72('0x43')][_0x3c72('0x48')]({'where':{'id':_0x496bfe[_0x3c72('0x46')]['id']}})[_0x3c72('0x40')](handleEntityNotFound(_0x415424,null))[_0x3c72('0x40')](saveUpdates(_0x496bfe[_0x3c72('0x52')],null))['then'](respondWithResult(_0x415424,null))[_0x3c72('0x51')](handleError(_0x415424,null));};exports[_0x3c72('0x53')]=function(_0x43e793,_0x24c525){var _0x4bb0d4=_0x43e793['params']['id'];var _0x3ca123=[];return db['sequelize'][_0x3c72('0x54')](function(_0x4ccc80){var _0x5d743c=_0x3c72('0x55')+_0x4bb0d4;return db[_0x3c72('0x56')][_0x3c72('0x31')](_0x5d743c,{'type':db[_0x3c72('0x57')][_0x3c72('0x58')][_0x3c72('0x59')],'raw':!![],'transaction':_0x4ccc80})[_0x3c72('0x40')](function(_0x417afb){_0x3ca123=_[_0x3c72('0x2c')](_0x417afb,function(_0x59e2fb){return Number(_0x59e2fb['UserId']);});})[_0x3c72('0x40')](function(){var _0x48d3bd=_0x3c72('0x5a')+_0x4bb0d4;return db[_0x3c72('0x56')][_0x3c72('0x31')](_0x48d3bd,{'type':db['Sequelize'][_0x3c72('0x58')][_0x3c72('0x59')],'raw':!![],'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(_0x144380){var _0x465eed=_[_0x3c72('0x2c')](_0x144380,function(_0x187c9d){return Number(_0x187c9d[_0x3c72('0x5b')]);});return db[_0x3c72('0x5c')][_0x3c72('0x53')]({'where':{'UserId':{'$in':_0x3ca123},'VoiceQueueId':{'$in':_0x465eed}},'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(){var _0x129d65='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4bb0d4;return db['sequelize'][_0x3c72('0x31')](_0x129d65,{'type':db[_0x3c72('0x57')][_0x3c72('0x58')]['SELECT'],'raw':!![],'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(_0x437132){var _0x3e710a=_['map'](_0x437132,function(_0x4da8bb){return Number(_0x4da8bb[_0x3c72('0x5d')]);});return db[_0x3c72('0x5e')][_0x3c72('0x53')]({'where':{'UserId':{'$in':_0x3ca123},'MailQueueId':{'$in':_0x3e710a}},'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(){var _0x5140c9=_0x3c72('0x5f')+_0x4bb0d4;return db[_0x3c72('0x56')][_0x3c72('0x31')](_0x5140c9,{'type':db['Sequelize'][_0x3c72('0x58')][_0x3c72('0x59')],'raw':!![],'transaction':_0x4ccc80});})['then'](function(_0x2bad94){var _0x2e651c=_[_0x3c72('0x2c')](_0x2bad94,function(_0x45ba39){return Number(_0x45ba39['SmsQueueId']);});return db[_0x3c72('0x60')][_0x3c72('0x53')]({'where':{'UserId':{'$in':_0x3ca123},'SmsQueueId':{'$in':_0x2e651c}},'transaction':_0x4ccc80});})['then'](function(){var _0x4e873b=_0x3c72('0x61')+_0x4bb0d4;return db['sequelize'][_0x3c72('0x31')](_0x4e873b,{'type':db[_0x3c72('0x57')][_0x3c72('0x58')][_0x3c72('0x59')],'raw':!![],'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(_0xb97943){var _0x505a70=_[_0x3c72('0x2c')](_0xb97943,function(_0x29b37b){return Number(_0x29b37b[_0x3c72('0x62')]);});return db[_0x3c72('0x63')][_0x3c72('0x53')]({'where':{'UserId':{'$in':_0x3ca123},'ChatQueueId':{'$in':_0x505a70}},'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(){var _0x320289=_0x3c72('0x64')+_0x4bb0d4;return db[_0x3c72('0x56')][_0x3c72('0x31')](_0x320289,{'type':db['Sequelize']['QueryTypes'][_0x3c72('0x59')],'raw':!![],'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(_0x447e8b){var _0x13c367=_[_0x3c72('0x2c')](_0x447e8b,function(_0x5e6ba){return Number(_0x5e6ba['FaxQueueId']);});return db[_0x3c72('0x65')][_0x3c72('0x53')]({'where':{'UserId':{'$in':_0x3ca123},'FaxQueueId':{'$in':_0x13c367}},'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(){var _0x47a91b=_0x3c72('0x66')+_0x4bb0d4;return db[_0x3c72('0x56')]['query'](_0x47a91b,{'type':db[_0x3c72('0x57')][_0x3c72('0x58')][_0x3c72('0x59')],'raw':!![],'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(_0x174e28){var _0x53405d=_[_0x3c72('0x2c')](_0x174e28,function(_0x196f67){return Number(_0x196f67['OpenchannelQueueId']);});return db[_0x3c72('0x67')][_0x3c72('0x53')]({'where':{'UserId':{'$in':_0x3ca123},'OpenchannelQueueId':{'$in':_0x53405d}},'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(){var _0x1c0471=_0x3c72('0x68')+_0x4bb0d4;return db['sequelize'][_0x3c72('0x31')](_0x1c0471,{'type':db['Sequelize'][_0x3c72('0x58')]['SELECT'],'raw':!![],'transaction':_0x4ccc80});})['then'](function(_0xe4d83b){var _0x452e84=_[_0x3c72('0x2c')](_0xe4d83b,function(_0x172fa3){return Number(_0x172fa3[_0x3c72('0x69')]);});return db['UserWhatsappQueue'][_0x3c72('0x53')]({'where':{'UserId':{'$in':_0x3ca123},'WhatsappQueueId':{'$in':_0x452e84}},'transaction':_0x4ccc80});})['then'](function(){return db[_0x3c72('0x6a')][_0x3c72('0x48')]({'where':{'TeamId':_0x4bb0d4}});})[_0x3c72('0x40')](function(_0x599952){if(_0x599952===null){return;}return db[_0x3c72('0x6b')][_0x3c72('0x53')]({'where':{'UserId':{'$in':_0x3ca123},'VoicePrefixId':_0x599952['VoicePrefixId']},'transaction':_0x4ccc80});})[_0x3c72('0x40')](function(){return db['Team'][_0x3c72('0x53')]({'where':{'id':_0x4bb0d4},'cascade':!![],'transaction':_0x4ccc80});})['then'](function(_0x45c335){if(_0x45c335===0x0){_0x24c525[_0x3c72('0x6c')](0x194);}else{return db[_0x3c72('0x50')][_0x3c72('0x53')]({'where':{'type':_0x3c72('0x6d'),'resourceId':_0x4bb0d4},'cascade':!![],'transaction':_0x4ccc80})[_0x3c72('0x40')](function(){_0x24c525[_0x3c72('0x22')](0xcc)[_0x3c72('0x6e')]();});}})[_0x3c72('0x51')](function(_0x284f1d){_0x24c525[_0x3c72('0x22')](0x1f4)['send'](_0x284f1d);});});};exports[_0x3c72('0x6f')]=function(_0x416b0e,_0x37fe56,_0x54f8dd){return db[_0x3c72('0x43')][_0x3c72('0x70')]({'where':{'id':_0x416b0e[_0x3c72('0x46')]['id']}})[_0x3c72('0x40')](handleEntityNotFound(_0x37fe56,null))[_0x3c72('0x40')](function(_0x2d0fc2){if(!_0x416b0e[_0x3c72('0x31')][_0x3c72('0x71')]||!utils[_0x3c72('0x72')](_0x416b0e[_0x3c72('0x31')][_0x3c72('0x71')])){throw new db[(_0x3c72('0x57'))][(_0x3c72('0x73'))]('Unknown\x20channel');}var _0x359e30={};var _0x2119a7={};_0x2119a7['model']=_[_0x3c72('0x32')](db[_[_0x3c72('0x74')](_0x416b0e[_0x3c72('0x31')][_0x3c72('0x71')]['toLowerCase']())+'Queue'][_0x3c72('0x47')]);_0x2119a7[_0x3c72('0x31')]=_[_0x3c72('0x32')](_0x416b0e[_0x3c72('0x31')]);_0x2119a7['filters']=_['intersection'](_0x2119a7[_0x3c72('0x30')],_0x2119a7[_0x3c72('0x31')]);_0x359e30[_0x3c72('0x35')]=_[_0x3c72('0x34')](_0x2119a7[_0x3c72('0x30')],qs[_0x3c72('0x36')](_0x416b0e[_0x3c72('0x31')][_0x3c72('0x36')]));_0x359e30[_0x3c72('0x35')]=_0x359e30['attributes'][_0x3c72('0x37')]?_0x359e30[_0x3c72('0x35')]:_0x2119a7[_0x3c72('0x30')];_0x359e30['limit']=qs['limit'](_0x416b0e[_0x3c72('0x31')][_0x3c72('0x20')]);_0x359e30[_0x3c72('0x1e')]=qs[_0x3c72('0x1e')](_0x416b0e[_0x3c72('0x31')]['offset']);_0x359e30['order']=qs[_0x3c72('0x39')](_0x416b0e['query'][_0x3c72('0x39')]);_0x359e30[_0x3c72('0x3a')]=qs[_0x3c72('0x33')](_[_0x3c72('0x3b')](_0x416b0e[_0x3c72('0x31')],_0x2119a7[_0x3c72('0x33')]));_0x359e30=_['merge']({},_0x359e30,_0x416b0e[_0x3c72('0x3f')]);return _0x2d0fc2[_0x3c72('0x4b')+_[_0x3c72('0x74')](_0x416b0e[_0x3c72('0x31')][_0x3c72('0x71')][_0x3c72('0x75')]())+'Queues'](_0x359e30);})[_0x3c72('0x40')](respondWithResult(_0x37fe56,null))[_0x3c72('0x51')](handleError(_0x37fe56,null));};exports['addQueues']=function(_0x28541b,_0x5b86ed,_0x5e58f4){return db[_0x3c72('0x43')][_0x3c72('0x70')]({'where':{'id':_0x28541b[_0x3c72('0x46')]['id']}})[_0x3c72('0x40')](function(_0x35663c){if(_0x35663c){if(!_0x28541b[_0x3c72('0x52')][_0x3c72('0x71')]||!utils[_0x3c72('0x72')](_0x28541b[_0x3c72('0x52')]['channel'])){throw new db[(_0x3c72('0x57'))][(_0x3c72('0x73'))](_0x3c72('0x76'));}return _0x35663c[_0x3c72('0x77')+_['capitalize'](_0x28541b[_0x3c72('0x52')][_0x3c72('0x71')][_0x3c72('0x75')]())+_0x3c72('0x78')](_0x28541b['body']['ids']);}return null;})[_0x3c72('0x40')](handleEntityNotFound(_0x5b86ed,null))['then'](respondWithStatusCode(_0x5b86ed,null))['catch'](handleError(_0x5b86ed,null));};exports[_0x3c72('0x79')]=function(_0x22cc3b,_0x1fae67,_0x4e11dc){return db[_0x3c72('0x43')][_0x3c72('0x70')]({'where':{'id':_0x22cc3b['params']['id']}})[_0x3c72('0x40')](function(_0x5bf353){if(_0x5bf353){if(!_0x22cc3b[_0x3c72('0x31')][_0x3c72('0x71')]||!utils[_0x3c72('0x72')](_0x22cc3b[_0x3c72('0x31')][_0x3c72('0x71')])){throw new db[(_0x3c72('0x57'))]['ValidationError'](_0x3c72('0x76'));}return _0x5bf353[_0x3c72('0x7a')+_[_0x3c72('0x74')](_0x22cc3b[_0x3c72('0x31')]['channel'][_0x3c72('0x75')]())+'Queues'](_0x22cc3b[_0x3c72('0x31')][_0x3c72('0x7b')]);}return null;})[_0x3c72('0x40')](handleEntityNotFound(_0x1fae67,null))[_0x3c72('0x40')](respondWithStatusCode(_0x1fae67,null))['catch'](handleError(_0x1fae67,null));};exports['addAgents']=function(_0x301dee,_0x59b65e){var _0x32f36b=_[_0x3c72('0x7c')](_0x301dee[_0x3c72('0x52')][_0x3c72('0x7b')])?_0x301dee[_0x3c72('0x52')][_0x3c72('0x7b')]:[_0x301dee[_0x3c72('0x52')][_0x3c72('0x7b')]];var _0x380c33=_0x301dee[_0x3c72('0x46')]['id'];return db[_0x3c72('0x43')][_0x3c72('0x48')]({'where':{'id':_0x380c33}})[_0x3c72('0x40')](handleEntityNotFound(_0x59b65e,null))[_0x3c72('0x40')](function(_0x4f9398){if(_0x4f9398){var _0x3bfe02=[_0x3c72('0x7d'),_0x3c72('0x7e'),_0x3c72('0x7f'),_0x3c72('0x80'),'Fax',_0x3c72('0x81'),_0x3c72('0x82')];return db['sequelize'][_0x3c72('0x54')](function(_0x46aa2a){var _0x53ee60=_[_0x3c72('0x2c')](_0x3bfe02,function(_0x25f9ef){var _0x4d2ef8={'attributes':['id','name']};if(_0x25f9ef==='Voice'){_0x4d2ef8['through']={'attributes':['penalty']};}return _0x4f9398[_0x3c72('0x4b')+_0x25f9ef+_0x3c72('0x78')](_0x4d2ef8)[_0x3c72('0x40')](function(_0x5ad69a){var _0x505fc6=_[_0x3c72('0x2c')](_0x5ad69a,function(_0x49cd55){var _0x418b8b=_[_0x3c72('0x2c')](_0x32f36b,function(_0x2fa422){var _0x18ee76={'where':{'UserId':_0x2fa422,[_0x25f9ef+_0x3c72('0x83')]:_0x49cd55['id']},'transaction':_0x46aa2a};if(_0x25f9ef===_0x3c72('0x7d')){_0x18ee76[_0x3c72('0x18')]={'penalty':_0x49cd55[_0x3c72('0x84')][_0x3c72('0x85')]};}return db[_0x3c72('0x86')+_0x25f9ef+_0x3c72('0x87')][_0x3c72('0x88')](_0x18ee76)[_0x3c72('0x40')](function(){socket[_0x3c72('0x89')]('user'+_0x25f9ef+_0x3c72('0x8a'),{'UserId':_0x2fa422,[_0x25f9ef+_0x3c72('0x83')]:_0x49cd55['id']});if(_0x25f9ef!==_0x3c72('0x7d')){return;}return db[_0x3c72('0x86')]['findAll']({'where':{'id':_0x32f36b,'online':0x1},'attributes':['id','name',_0x3c72('0x8b'),'voicePause',_0x3c72('0x8c')],'raw':!![]})[_0x3c72('0x40')](function(_0x545446){var _0x1637bf=_['map'](_0x545446,function(_0x11bc88){return db[_0x3c72('0x8d')][_0x3c72('0x8e')]({'membername':_0x11bc88[_0x3c72('0x29')],'UserId':_0x11bc88['id'],'queue_name':_0x49cd55['name'],'VoiceQueueId':_0x49cd55['id'],'interface':_['isNil'](_0x11bc88[_0x3c72('0x8c')])?util['format']('SIP/%s',_0x11bc88[_0x3c72('0x29')]):_0x11bc88['interface'],'paused':_0x11bc88[_0x3c72('0x8f')]||![],'penalty':_0x49cd55['TeamVoiceQueue']['penalty']},{'transaction':_0x46aa2a});});return Promise[_0x3c72('0x90')](_0x1637bf);});});});return Promise['all'](_0x418b8b);});return Promise[_0x3c72('0x90')](_0x505fc6);})[_0x3c72('0x40')](function(){return db[_0x3c72('0x6a')][_0x3c72('0x70')]({'where':{'teamId':_0x380c33}})[_0x3c72('0x40')](function(_0x41372c){if(_0x41372c){var _0x58fd22=_[_0x3c72('0x2c')](_0x32f36b,function(_0x500fca){db[_0x3c72('0x6b')]['upsert']({'UserId':_0x500fca,'VoicePrefixId':_0x41372c[_0x3c72('0x91')]});});return Promise[_0x3c72('0x90')](_0x58fd22);}});});});return Promise[_0x3c72('0x90')](_0x53ee60)[_0x3c72('0x40')](function(){return _0x4f9398[_0x3c72('0x92')](_0x32f36b,{'transaction':_0x46aa2a})['spread'](function(_0x1aa6d2){return _0x1aa6d2;});});});}})['then'](respondWithResult(_0x59b65e,null))[_0x3c72('0x51')](handleError(_0x59b65e,null));};exports[_0x3c72('0x93')]=function(_0x32ead5,_0x407209){var _0x5bcb20=_[_0x3c72('0x7c')](_0x32ead5['query'][_0x3c72('0x7b')])?_0x32ead5[_0x3c72('0x31')][_0x3c72('0x7b')]:[_0x32ead5['query']['ids']];var _0x320c66=_0x32ead5[_0x3c72('0x46')]['id'];return db[_0x3c72('0x43')][_0x3c72('0x48')]({'where':{'id':_0x320c66}})[_0x3c72('0x40')](handleEntityNotFound(_0x407209,null))['then'](function(_0x5a47c1){if(_0x5a47c1){var _0x54a17b=[_0x3c72('0x7d'),_0x3c72('0x7e'),_0x3c72('0x7f'),_0x3c72('0x80'),_0x3c72('0x94'),_0x3c72('0x81'),'Whatsapp'];return db[_0x3c72('0x56')][_0x3c72('0x54')](function(_0x52e315){var _0x3e0a68=_['map'](_0x54a17b,function(_0x2c98b8){var _0x1e96a5={'attributes':['id',_0x3c72('0x29')]};return _0x5a47c1[_0x3c72('0x4b')+_0x2c98b8+'Queues'](_0x1e96a5)[_0x3c72('0x40')](function(_0x36f862){var _0x140bed=_[_0x3c72('0x2c')](_0x36f862,function(_0x400251){return _0x400251[_0x3c72('0x93')](_0x5bcb20,{'transaction':_0x52e315})[_0x3c72('0x40')](function(){var _0x386859=_[_0x3c72('0x2c')](_0x5bcb20,function(_0x91cee5){socket[_0x3c72('0x89')]('user'+_0x2c98b8+_0x3c72('0x95'),{'UserId':Number(_0x91cee5),[_0x2c98b8+'QueueId']:_0x400251['id']});if(_0x2c98b8!==_0x3c72('0x7d')){return;}return db[_0x3c72('0x8d')][_0x3c72('0x53')]({'where':{'VoiceQueueId':_0x400251['id'],'UserId':_0x91cee5},'transaction':_0x52e315});});return Promise[_0x3c72('0x90')](_0x386859);});});return Promise['all'](_0x140bed);});});return Promise[_0x3c72('0x90')](_0x3e0a68)[_0x3c72('0x40')](function(){return _0x5a47c1[_0x3c72('0x93')](_0x5bcb20,{'transaction':_0x52e315});})['then'](function(){return db[_0x3c72('0x6a')][_0x3c72('0x70')]({'where':{'teamId':_0x320c66}})[_0x3c72('0x40')](function(_0x46a569){if(_0x46a569){var _0x1d6bc6=_[_0x3c72('0x2c')](_0x5bcb20,function(_0x5a61a7){db[_0x3c72('0x6b')]['destroy']({'where':{'UserId':_0x5a61a7,'VoicePrefixId':_0x46a569['VoicePrefixId']}});});return Promise[_0x3c72('0x90')](_0x1d6bc6);}});});});}})[_0x3c72('0x40')](respondWithStatusCode(_0x407209,null))[_0x3c72('0x51')](handleError(_0x407209,null));};exports[_0x3c72('0x96')]=function(_0x37938e,_0x2689cc,_0x22456b){var _0x1f41d5={};var _0x52b87a={};var _0x139942;var _0x20e2c6;return db[_0x3c72('0x43')][_0x3c72('0x70')]({'where':{'id':_0x37938e[_0x3c72('0x46')]['id']}})[_0x3c72('0x40')](handleEntityNotFound(_0x2689cc,null))[_0x3c72('0x40')](function(_0x51ff6d){if(_0x51ff6d){_0x139942=_0x51ff6d;_0x52b87a['model']=_[_0x3c72('0x32')](db['User'][_0x3c72('0x47')]);_0x52b87a[_0x3c72('0x31')]=_['keys'](_0x37938e[_0x3c72('0x31')]);_0x52b87a[_0x3c72('0x33')]=_['intersection'](_0x52b87a[_0x3c72('0x30')],_0x52b87a[_0x3c72('0x31')]);_0x1f41d5['attributes']=_[_0x3c72('0x34')](_0x52b87a[_0x3c72('0x30')],qs[_0x3c72('0x36')](_0x37938e['query'][_0x3c72('0x36')]));_0x1f41d5[_0x3c72('0x35')]=_0x1f41d5['attributes'][_0x3c72('0x37')]?_0x1f41d5['attributes']:_0x52b87a['model'];_0x1f41d5[_0x3c72('0x97')]=qs[_0x3c72('0x39')](_0x37938e[_0x3c72('0x31')][_0x3c72('0x39')]);_0x1f41d5[_0x3c72('0x3a')]=qs[_0x3c72('0x33')](_[_0x3c72('0x3b')](_0x37938e[_0x3c72('0x31')],_0x52b87a[_0x3c72('0x33')]));if(_0x37938e['query'][_0x3c72('0x3c')]){_0x1f41d5[_0x3c72('0x3a')]=_[_0x3c72('0x3d')](_0x1f41d5['where'],{'$or':_[_0x3c72('0x2c')](_0x1f41d5[_0x3c72('0x35')],function(_0x25bf3f){var _0x5d4fd3={};_0x5d4fd3[_0x25bf3f]={'$like':'%'+_0x37938e[_0x3c72('0x31')]['filter']+'%'};return _0x5d4fd3;})});}_0x1f41d5=_[_0x3c72('0x3d')]({},_0x1f41d5,_0x37938e[_0x3c72('0x3f')]);return _0x139942[_0x3c72('0x96')](_0x1f41d5);}})[_0x3c72('0x40')](function(_0x2404c6){if(_0x2404c6){_0x20e2c6=_0x2404c6['length'];if(!_0x37938e[_0x3c72('0x31')][_0x3c72('0x98')]('nolimit')){_0x1f41d5[_0x3c72('0x20')]=qs[_0x3c72('0x20')](_0x37938e[_0x3c72('0x31')][_0x3c72('0x20')]);_0x1f41d5[_0x3c72('0x1e')]=qs['offset'](_0x37938e[_0x3c72('0x31')]['offset']);}return _0x139942[_0x3c72('0x96')](_0x1f41d5);}})['then'](function(_0x43d090){if(_0x43d090){return _0x43d090?{'count':_0x20e2c6,'rows':_0x43d090}:null;}})[_0x3c72('0x40')](respondWithResult(_0x2689cc,null))[_0x3c72('0x51')](handleError(_0x2689cc,null));}; \ No newline at end of file +var _0x1bea=['query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','channel','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','Unknown\x20channel','add','removeQueues','isValidChannel','remove','addAgents','isArray','ids','Chat','Sms','Fax','Whatsapp','Voice','through','QueueId','penalty','User','findOrCreate','emit','Queue:save','findAll','online','voicePause','UserVoiceQueueRt','isNil','interface','format','SIP/%s','TeamVoiceQueue','all','upsert','removeAgents','Mail','Openchannel','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','name','send','index','map','Team','rawAttributes','fieldName','type','model'];(function(_0x5d11c1,_0x155e3d){var _0x379505=function(_0x582bc8){while(--_0x582bc8){_0x5d11c1['push'](_0x5d11c1['shift']());}};_0x379505(++_0x155e3d);}(_0x1bea,0x1af));var _0xa1be=function(_0x5408b1,_0x258270){_0x5408b1=_0x5408b1-0x0;var _0x322910=_0x1bea[_0x5408b1];return _0x322910;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1be('0x0'));var zipdir=require(_0xa1be('0x1'));var jsonpatch=require(_0xa1be('0x2'));var rp=require(_0xa1be('0x3'));var moment=require(_0xa1be('0x4'));var BPromise=require(_0xa1be('0x5'));var Mustache=require(_0xa1be('0x6'));var util=require(_0xa1be('0x7'));var path=require(_0xa1be('0x8'));var sox=require(_0xa1be('0x9'));var csv=require(_0xa1be('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1be('0xb'));var _=require(_0xa1be('0xc'));var squel=require(_0xa1be('0xd'));var crypto=require(_0xa1be('0xe'));var jsforce=require(_0xa1be('0xf'));var deskjs=require(_0xa1be('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1be('0x11'));var Papa=require(_0xa1be('0x12'));var Redis=require(_0xa1be('0x13'));var authService=require(_0xa1be('0x14'));var qs=require(_0xa1be('0x15'));var as=require(_0xa1be('0x16'));var hardwareService=require(_0xa1be('0x17'));var logger=require(_0xa1be('0x18'))('api');var utils=require(_0xa1be('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa1be('0x1a'));var db=require(_0xa1be('0x1b'))['db'];config[_0xa1be('0x1c')]=_[_0xa1be('0x1d')](config[_0xa1be('0x1c')],{'host':_0xa1be('0x1e'),'port':0x18eb});var socket=require(_0xa1be('0x1f'))(new Redis(config[_0xa1be('0x1c')]));require(_0xa1be('0x20'))['register'](socket);function respondWithStatusCode(_0x10060c,_0x1d278c){_0x1d278c=_0x1d278c||0xcc;return function(_0x2a01e0){if(_0x2a01e0){return _0x10060c[_0xa1be('0x21')](_0x1d278c);}return _0x10060c[_0xa1be('0x22')](_0x1d278c)[_0xa1be('0x23')]();};}function respondWithResult(_0x4cc6f1,_0xee518b){_0xee518b=_0xee518b||0xc8;return function(_0x4888b1){if(_0x4888b1){return _0x4cc6f1[_0xa1be('0x22')](_0xee518b)[_0xa1be('0x24')](_0x4888b1);}};}function respondWithFilteredResult(_0x23222e,_0x52d566){return function(_0x3aef3b){if(_0x3aef3b){var _0x26bfd5=typeof _0x52d566[_0xa1be('0x25')]===_0xa1be('0x26')&&typeof _0x52d566['limit']===_0xa1be('0x26');var _0x5e80db=_0x3aef3b[_0xa1be('0x27')];var _0x48dbaf=_0x26bfd5?0x0:_0x52d566['offset'];var _0xd599c7=_0x26bfd5?_0x3aef3b[_0xa1be('0x27')]:_0x52d566['offset']+_0x52d566['limit'];var _0x1687dd;if(_0xd599c7>=_0x5e80db){_0xd599c7=_0x5e80db;_0x1687dd=0xc8;}else{_0x1687dd=0xce;}_0x23222e[_0xa1be('0x22')](_0x1687dd);return _0x23222e[_0xa1be('0x28')](_0xa1be('0x29'),_0x48dbaf+'-'+_0xd599c7+'/'+_0x5e80db)[_0xa1be('0x24')](_0x3aef3b);}return null;};}function patchUpdates(_0x56bfab){return function(_0x319db9){try{jsonpatch['apply'](_0x319db9,_0x56bfab,!![]);}catch(_0x27de21){return BPromise[_0xa1be('0x2a')](_0x27de21);}return _0x319db9[_0xa1be('0x2b')]();};}function saveUpdates(_0x5e059a,_0x36c4d2){return function(_0x2362d6){if(_0x2362d6){return _0x2362d6[_0xa1be('0x2c')](_0x5e059a)[_0xa1be('0x2d')](function(_0x2987c2){return _0x2987c2;});}return null;};}function handleEntityNotFound(_0x405ff6,_0x2ad51d){return function(_0x33a29a){if(!_0x33a29a){_0x405ff6[_0xa1be('0x21')](0x194);}return _0x33a29a;};}function handleError(_0x56eff5,_0x37d771){_0x37d771=_0x37d771||0x1f4;return function(_0x2095a5){logger['error'](_0x2095a5['stack']);if(_0x2095a5[_0xa1be('0x2e')]){delete _0x2095a5[_0xa1be('0x2e')];}_0x56eff5[_0xa1be('0x22')](_0x37d771)[_0xa1be('0x2f')](_0x2095a5);};}exports[_0xa1be('0x30')]=function(_0x79e1a6,_0x50d2d1){var _0x548ee3={},_0x574b7e={},_0x49fb80={'count':0x0,'rows':[]};var _0x7446f7=_[_0xa1be('0x31')](db[_0xa1be('0x32')][_0xa1be('0x33')],function(_0x50a6f3){return{'name':_0x50a6f3[_0xa1be('0x34')],'type':_0x50a6f3[_0xa1be('0x35')]['key']};});_0x574b7e[_0xa1be('0x36')]=_[_0xa1be('0x31')](_0x7446f7,_0xa1be('0x2e'));_0x574b7e[_0xa1be('0x37')]=_[_0xa1be('0x38')](_0x79e1a6[_0xa1be('0x37')]);_0x574b7e[_0xa1be('0x39')]=_[_0xa1be('0x3a')](_0x574b7e[_0xa1be('0x36')],_0x574b7e[_0xa1be('0x37')]);_0x548ee3['attributes']=_[_0xa1be('0x3a')](_0x574b7e[_0xa1be('0x36')],qs['fields'](_0x79e1a6[_0xa1be('0x37')][_0xa1be('0x3b')]));_0x548ee3[_0xa1be('0x3c')]=_0x548ee3['attributes'][_0xa1be('0x3d')]?_0x548ee3[_0xa1be('0x3c')]:_0x574b7e['model'];if(!_0x79e1a6[_0xa1be('0x37')]['hasOwnProperty'](_0xa1be('0x3e'))){_0x548ee3[_0xa1be('0x3f')]=qs[_0xa1be('0x3f')](_0x79e1a6['query'][_0xa1be('0x3f')]);_0x548ee3[_0xa1be('0x25')]=qs['offset'](_0x79e1a6[_0xa1be('0x37')][_0xa1be('0x25')]);}_0x548ee3[_0xa1be('0x40')]=qs[_0xa1be('0x41')](_0x79e1a6[_0xa1be('0x37')][_0xa1be('0x41')]);_0x548ee3[_0xa1be('0x42')]=qs[_0xa1be('0x39')](_[_0xa1be('0x43')](_0x79e1a6[_0xa1be('0x37')],_0x574b7e[_0xa1be('0x39')]),_0x7446f7);if(_0x79e1a6['query'][_0xa1be('0x44')]){_0x548ee3[_0xa1be('0x42')]=_[_0xa1be('0x45')](_0x548ee3[_0xa1be('0x42')],{'$or':_[_0xa1be('0x31')](_0x7446f7,function(_0x47b99b){if(_0x47b99b[_0xa1be('0x35')]!==_0xa1be('0x46')){var _0x570077={};_0x570077[_0x47b99b[_0xa1be('0x2e')]]={'$like':'%'+_0x79e1a6[_0xa1be('0x37')][_0xa1be('0x44')]+'%'};return _0x570077;}})});}_0x548ee3=_[_0xa1be('0x45')]({},_0x548ee3,_0x79e1a6[_0xa1be('0x47')]);var _0x4739ce={'where':_0x548ee3['where']};return db[_0xa1be('0x32')][_0xa1be('0x27')](_0x4739ce)[_0xa1be('0x2d')](function(_0x2f4c56){_0x49fb80[_0xa1be('0x27')]=_0x2f4c56;if(_0x79e1a6[_0xa1be('0x37')][_0xa1be('0x48')]){_0x548ee3['include']=[{'all':!![]}];}return db[_0xa1be('0x32')]['findAll'](_0x548ee3);})[_0xa1be('0x2d')](function(_0x2ba28b){_0x49fb80['rows']=_0x2ba28b;return _0x49fb80;})[_0xa1be('0x2d')](respondWithFilteredResult(_0x50d2d1,_0x548ee3))[_0xa1be('0x49')](handleError(_0x50d2d1,null));};exports[_0xa1be('0x4a')]=function(_0x4d93bf,_0x1e00af){var _0x357e2b={'raw':![],'where':{'id':_0x4d93bf['params']['id']}},_0x2a8706={};_0x2a8706['model']=_[_0xa1be('0x38')](db['Team'][_0xa1be('0x33')]);_0x2a8706[_0xa1be('0x37')]=_[_0xa1be('0x38')](_0x4d93bf['query']);_0x2a8706[_0xa1be('0x39')]=_[_0xa1be('0x3a')](_0x2a8706[_0xa1be('0x36')],_0x2a8706['query']);_0x357e2b[_0xa1be('0x3c')]=_[_0xa1be('0x3a')](_0x2a8706[_0xa1be('0x36')],qs[_0xa1be('0x3b')](_0x4d93bf[_0xa1be('0x37')][_0xa1be('0x3b')]));_0x357e2b[_0xa1be('0x3c')]=_0x357e2b[_0xa1be('0x3c')][_0xa1be('0x3d')]?_0x357e2b['attributes']:_0x2a8706[_0xa1be('0x36')];if(_0x4d93bf[_0xa1be('0x37')][_0xa1be('0x48')]){_0x357e2b[_0xa1be('0x4b')]=[{'all':!![]}];}_0x357e2b=_['merge']({},_0x357e2b,_0x4d93bf['options']);return db[_0xa1be('0x32')][_0xa1be('0x4c')](_0x357e2b)['then'](handleEntityNotFound(_0x1e00af,null))[_0xa1be('0x2d')](respondWithResult(_0x1e00af,null))[_0xa1be('0x49')](handleError(_0x1e00af,null));};exports['create']=function(_0x5763fc,_0x27c893){return db['Team'][_0xa1be('0x4d')](_0x5763fc[_0xa1be('0x4e')],{})['then'](function(_0x5d8ff9){var _0x1a710d=_0x5763fc[_0xa1be('0x4f')][_0xa1be('0x50')]({'plain':!![]});if(!_0x1a710d)throw new Error(_0xa1be('0x51'));if(_0x1a710d[_0xa1be('0x52')]==='user'){var _0x5d3efb=_0x5d8ff9['get']({'plain':!![]});var _0xf12e84=_0xa1be('0x53');return db[_0xa1be('0x54')][_0xa1be('0x4c')]({'where':{'name':_0xf12e84,'userProfileId':_0x1a710d['userProfileId']},'raw':!![]})[_0xa1be('0x2d')](function(_0x382c03){if(_0x382c03&&_0x382c03['autoAssociation']===0x0){return db['UserProfileResource'][_0xa1be('0x4d')]({'name':_0x5d3efb[_0xa1be('0x2e')],'resourceId':_0x5d3efb['id'],'type':_0x382c03[_0xa1be('0x2e')],'sectionId':_0x382c03['id']},{})[_0xa1be('0x2d')](function(){return _0x5d8ff9;});}else{return _0x5d8ff9;}})['catch'](function(_0x232e8d){logger[_0xa1be('0x55')](_0xa1be('0x56'),_0x232e8d);throw _0x232e8d;});}return _0x5d8ff9;})[_0xa1be('0x2d')](respondWithResult(_0x27c893,0xc9))['catch'](handleError(_0x27c893,null));};exports[_0xa1be('0x2c')]=function(_0x50c3a5,_0x461d9b){if(_0x50c3a5[_0xa1be('0x4e')]['id']){delete _0x50c3a5[_0xa1be('0x4e')]['id'];}return db['Team']['find']({'where':{'id':_0x50c3a5[_0xa1be('0x57')]['id']}})[_0xa1be('0x2d')](handleEntityNotFound(_0x461d9b,null))[_0xa1be('0x2d')](saveUpdates(_0x50c3a5[_0xa1be('0x4e')],null))['then'](respondWithResult(_0x461d9b,null))['catch'](handleError(_0x461d9b,null));};exports[_0xa1be('0x58')]=function(_0x315065,_0x19673a){var _0x24fa7f=_0x315065[_0xa1be('0x57')]['id'];var _0x1f5c44=[];return db[_0xa1be('0x59')][_0xa1be('0x5a')](function(_0x3929fd){var _0x1ccbf2=_0xa1be('0x5b')+_0x24fa7f;return db['sequelize']['query'](_0x1ccbf2,{'type':db[_0xa1be('0x5c')][_0xa1be('0x5d')]['SELECT'],'raw':!![],'transaction':_0x3929fd})[_0xa1be('0x2d')](function(_0x21306a){_0x1f5c44=_[_0xa1be('0x31')](_0x21306a,function(_0x1dd6e7){return Number(_0x1dd6e7[_0xa1be('0x5e')]);});})['then'](function(){var _0x151786=_0xa1be('0x5f')+_0x24fa7f;return db[_0xa1be('0x59')][_0xa1be('0x37')](_0x151786,{'type':db[_0xa1be('0x5c')][_0xa1be('0x5d')][_0xa1be('0x60')],'raw':!![],'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(_0x196a6d){var _0x2f87e6=_[_0xa1be('0x31')](_0x196a6d,function(_0x53d5e9){return Number(_0x53d5e9[_0xa1be('0x61')]);});return db[_0xa1be('0x62')][_0xa1be('0x58')]({'where':{'UserId':{'$in':_0x1f5c44},'VoiceQueueId':{'$in':_0x2f87e6}},'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(){var _0x545455=_0xa1be('0x63')+_0x24fa7f;return db['sequelize']['query'](_0x545455,{'type':db['Sequelize'][_0xa1be('0x5d')][_0xa1be('0x60')],'raw':!![],'transaction':_0x3929fd});})['then'](function(_0x894dd3){var _0x3fa50e=_[_0xa1be('0x31')](_0x894dd3,function(_0x35af34){return Number(_0x35af34[_0xa1be('0x64')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x1f5c44},'MailQueueId':{'$in':_0x3fa50e}},'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(){var _0x953d10='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x24fa7f;return db[_0xa1be('0x59')]['query'](_0x953d10,{'type':db[_0xa1be('0x5c')]['QueryTypes'][_0xa1be('0x60')],'raw':!![],'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(_0x458180){var _0x4f4d77=_[_0xa1be('0x31')](_0x458180,function(_0x4f0b0b){return Number(_0x4f0b0b[_0xa1be('0x65')]);});return db['UserSmsQueue'][_0xa1be('0x58')]({'where':{'UserId':{'$in':_0x1f5c44},'SmsQueueId':{'$in':_0x4f4d77}},'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(){var _0x50be65=_0xa1be('0x66')+_0x24fa7f;return db['sequelize'][_0xa1be('0x37')](_0x50be65,{'type':db[_0xa1be('0x5c')]['QueryTypes'][_0xa1be('0x60')],'raw':!![],'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(_0x5c4535){var _0xcd70c3=_[_0xa1be('0x31')](_0x5c4535,function(_0x4585a3){return Number(_0x4585a3[_0xa1be('0x67')]);});return db[_0xa1be('0x68')][_0xa1be('0x58')]({'where':{'UserId':{'$in':_0x1f5c44},'ChatQueueId':{'$in':_0xcd70c3}},'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(){var _0x25fa9e=_0xa1be('0x69')+_0x24fa7f;return db[_0xa1be('0x59')][_0xa1be('0x37')](_0x25fa9e,{'type':db[_0xa1be('0x5c')]['QueryTypes'][_0xa1be('0x60')],'raw':!![],'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(_0x5c4cd5){var _0x51d0de=_[_0xa1be('0x31')](_0x5c4cd5,function(_0x4f474d){return Number(_0x4f474d[_0xa1be('0x6a')]);});return db['UserFaxQueue'][_0xa1be('0x58')]({'where':{'UserId':{'$in':_0x1f5c44},'FaxQueueId':{'$in':_0x51d0de}},'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(){var _0xe08679=_0xa1be('0x6b')+_0x24fa7f;return db[_0xa1be('0x59')][_0xa1be('0x37')](_0xe08679,{'type':db[_0xa1be('0x5c')][_0xa1be('0x5d')][_0xa1be('0x60')],'raw':!![],'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(_0x5d3245){var _0x6ddf45=_[_0xa1be('0x31')](_0x5d3245,function(_0x3b0c5e){return Number(_0x3b0c5e[_0xa1be('0x6c')]);});return db[_0xa1be('0x6d')][_0xa1be('0x58')]({'where':{'UserId':{'$in':_0x1f5c44},'OpenchannelQueueId':{'$in':_0x6ddf45}},'transaction':_0x3929fd});})['then'](function(){var _0x4bdd4a=_0xa1be('0x6e')+_0x24fa7f;return db[_0xa1be('0x59')][_0xa1be('0x37')](_0x4bdd4a,{'type':db['Sequelize']['QueryTypes'][_0xa1be('0x60')],'raw':!![],'transaction':_0x3929fd});})['then'](function(_0x3c1922){var _0x139f89=_[_0xa1be('0x31')](_0x3c1922,function(_0x24b9d4){return Number(_0x24b9d4[_0xa1be('0x6f')]);});return db[_0xa1be('0x70')][_0xa1be('0x58')]({'where':{'UserId':{'$in':_0x1f5c44},'WhatsappQueueId':{'$in':_0x139f89}},'transaction':_0x3929fd});})['then'](function(){return db[_0xa1be('0x71')]['find']({'where':{'TeamId':_0x24fa7f}});})[_0xa1be('0x2d')](function(_0x1c91cd){if(_0x1c91cd===null){return;}return db[_0xa1be('0x72')][_0xa1be('0x58')]({'where':{'UserId':{'$in':_0x1f5c44},'VoicePrefixId':_0x1c91cd[_0xa1be('0x73')]},'transaction':_0x3929fd});})[_0xa1be('0x2d')](function(){return db[_0xa1be('0x32')]['destroy']({'where':{'id':_0x24fa7f},'cascade':!![],'transaction':_0x3929fd});})['then'](function(_0x38f545){if(_0x38f545===0x0){_0x19673a[_0xa1be('0x21')](0x194);}else{return db[_0xa1be('0x74')][_0xa1be('0x58')]({'where':{'type':_0xa1be('0x53'),'resourceId':_0x24fa7f},'cascade':!![],'transaction':_0x3929fd})[_0xa1be('0x2d')](function(){_0x19673a['status'](0xcc)['end']();});}})['catch'](function(_0x4da3d6){_0x19673a[_0xa1be('0x22')](0x1f4)[_0xa1be('0x2f')](_0x4da3d6);});});};exports[_0xa1be('0x75')]=function(_0x11d985,_0x1aeb1,_0xa2e4ae){return db[_0xa1be('0x32')]['findOne']({'where':{'id':_0x11d985[_0xa1be('0x57')]['id']}})[_0xa1be('0x2d')](handleEntityNotFound(_0x1aeb1,null))[_0xa1be('0x2d')](function(_0x5d8266){if(!_0x11d985['query']['channel']||!utils['isValidChannel'](_0x11d985[_0xa1be('0x37')][_0xa1be('0x76')])){throw new db['Sequelize'][(_0xa1be('0x77'))]('Unknown\x20channel');}var _0xee5edb={};var _0xdfec49={};_0xdfec49[_0xa1be('0x36')]=_[_0xa1be('0x38')](db[_[_0xa1be('0x78')](_0x11d985[_0xa1be('0x37')][_0xa1be('0x76')][_0xa1be('0x79')]())+_0xa1be('0x7a')][_0xa1be('0x33')]);_0xdfec49['query']=_[_0xa1be('0x38')](_0x11d985['query']);_0xdfec49['filters']=_['intersection'](_0xdfec49[_0xa1be('0x36')],_0xdfec49[_0xa1be('0x37')]);_0xee5edb[_0xa1be('0x3c')]=_[_0xa1be('0x3a')](_0xdfec49[_0xa1be('0x36')],qs[_0xa1be('0x3b')](_0x11d985[_0xa1be('0x37')][_0xa1be('0x3b')]));_0xee5edb[_0xa1be('0x3c')]=_0xee5edb[_0xa1be('0x3c')][_0xa1be('0x3d')]?_0xee5edb[_0xa1be('0x3c')]:_0xdfec49[_0xa1be('0x36')];_0xee5edb['limit']=qs[_0xa1be('0x3f')](_0x11d985[_0xa1be('0x37')]['limit']);_0xee5edb[_0xa1be('0x25')]=qs[_0xa1be('0x25')](_0x11d985['query'][_0xa1be('0x25')]);_0xee5edb['order']=qs['sort'](_0x11d985[_0xa1be('0x37')]['sort']);_0xee5edb[_0xa1be('0x42')]=qs['filters'](_[_0xa1be('0x43')](_0x11d985[_0xa1be('0x37')],_0xdfec49[_0xa1be('0x39')]));_0xee5edb=_[_0xa1be('0x45')]({},_0xee5edb,_0x11d985[_0xa1be('0x47')]);return _0x5d8266[_0xa1be('0x50')+_[_0xa1be('0x78')](_0x11d985[_0xa1be('0x37')][_0xa1be('0x76')][_0xa1be('0x79')]())+_0xa1be('0x7b')](_0xee5edb);})['then'](respondWithResult(_0x1aeb1,null))[_0xa1be('0x49')](handleError(_0x1aeb1,null));};exports[_0xa1be('0x7c')]=function(_0x44aa02,_0x6a6867,_0x339dba){return db[_0xa1be('0x32')][_0xa1be('0x7d')]({'where':{'id':_0x44aa02[_0xa1be('0x57')]['id']}})['then'](function(_0x47c622){if(_0x47c622){if(!_0x44aa02[_0xa1be('0x4e')]['channel']||!utils['isValidChannel'](_0x44aa02[_0xa1be('0x4e')]['channel'])){throw new db[(_0xa1be('0x5c'))][(_0xa1be('0x77'))](_0xa1be('0x7e'));}return _0x47c622[_0xa1be('0x7f')+_['capitalize'](_0x44aa02[_0xa1be('0x4e')][_0xa1be('0x76')][_0xa1be('0x79')]())+_0xa1be('0x7b')](_0x44aa02['body']['ids']);}return null;})[_0xa1be('0x2d')](handleEntityNotFound(_0x6a6867,null))[_0xa1be('0x2d')](respondWithStatusCode(_0x6a6867,null))[_0xa1be('0x49')](handleError(_0x6a6867,null));};exports[_0xa1be('0x80')]=function(_0x202852,_0x8ac248,_0x31293f){return db['Team'][_0xa1be('0x7d')]({'where':{'id':_0x202852[_0xa1be('0x57')]['id']}})[_0xa1be('0x2d')](function(_0x309496){if(_0x309496){if(!_0x202852['query'][_0xa1be('0x76')]||!utils[_0xa1be('0x81')](_0x202852['query'][_0xa1be('0x76')])){throw new db[(_0xa1be('0x5c'))][(_0xa1be('0x77'))](_0xa1be('0x7e'));}return _0x309496[_0xa1be('0x82')+_[_0xa1be('0x78')](_0x202852[_0xa1be('0x37')][_0xa1be('0x76')][_0xa1be('0x79')]())+'Queues'](_0x202852[_0xa1be('0x37')]['ids']);}return null;})['then'](handleEntityNotFound(_0x8ac248,null))[_0xa1be('0x2d')](respondWithStatusCode(_0x8ac248,null))[_0xa1be('0x49')](handleError(_0x8ac248,null));};exports[_0xa1be('0x83')]=function(_0x52b371,_0x4099c2){var _0x348c85=_[_0xa1be('0x84')](_0x52b371[_0xa1be('0x4e')][_0xa1be('0x85')])?_0x52b371[_0xa1be('0x4e')][_0xa1be('0x85')]:[_0x52b371[_0xa1be('0x4e')][_0xa1be('0x85')]];var _0x41ce8b=_0x52b371['params']['id'];return db['Team'][_0xa1be('0x4c')]({'where':{'id':_0x41ce8b}})[_0xa1be('0x2d')](handleEntityNotFound(_0x4099c2,null))[_0xa1be('0x2d')](function(_0x3b553a){if(_0x3b553a){var _0x20f841=['Voice',_0xa1be('0x86'),'Mail',_0xa1be('0x87'),_0xa1be('0x88'),'Openchannel',_0xa1be('0x89')];return db['sequelize']['transaction'](function(_0x2bce4b){var _0x584e92=_[_0xa1be('0x31')](_0x20f841,function(_0x349731){var _0x6025ae={'attributes':['id',_0xa1be('0x2e')]};if(_0x349731===_0xa1be('0x8a')){_0x6025ae[_0xa1be('0x8b')]={'attributes':['penalty']};}return _0x3b553a[_0xa1be('0x50')+_0x349731+_0xa1be('0x7b')](_0x6025ae)[_0xa1be('0x2d')](function(_0x1eceb9){var _0x63414f=_[_0xa1be('0x31')](_0x1eceb9,function(_0xc61a0b){var _0xaeeb50=_[_0xa1be('0x31')](_0x348c85,function(_0x11da5f){var _0x4de727={'where':{'UserId':_0x11da5f,[_0x349731+_0xa1be('0x8c')]:_0xc61a0b['id']},'transaction':_0x2bce4b};if(_0x349731==='Voice'){_0x4de727['defaults']={'penalty':_0xc61a0b['TeamVoiceQueue'][_0xa1be('0x8d')]};}return db[_0xa1be('0x8e')+_0x349731+_0xa1be('0x7a')][_0xa1be('0x8f')](_0x4de727)[_0xa1be('0x2d')](function(){socket[_0xa1be('0x90')](_0xa1be('0x4f')+_0x349731+_0xa1be('0x91'),{'UserId':_0x11da5f,[_0x349731+_0xa1be('0x8c')]:_0xc61a0b['id']});if(_0x349731!=='Voice'){return;}return db[_0xa1be('0x8e')][_0xa1be('0x92')]({'where':{'id':_0x348c85,'online':0x1},'attributes':['id',_0xa1be('0x2e'),_0xa1be('0x93'),_0xa1be('0x94'),'interface'],'raw':!![]})[_0xa1be('0x2d')](function(_0x29c6ff){var _0x5b861b=_[_0xa1be('0x31')](_0x29c6ff,function(_0x1072a2){return db[_0xa1be('0x95')]['upsert']({'membername':_0x1072a2[_0xa1be('0x2e')],'UserId':_0x1072a2['id'],'queue_name':_0xc61a0b[_0xa1be('0x2e')],'VoiceQueueId':_0xc61a0b['id'],'interface':_[_0xa1be('0x96')](_0x1072a2[_0xa1be('0x97')])?util[_0xa1be('0x98')](_0xa1be('0x99'),_0x1072a2[_0xa1be('0x2e')]):_0x1072a2[_0xa1be('0x97')],'paused':_0x1072a2[_0xa1be('0x94')]||![],'penalty':_0xc61a0b[_0xa1be('0x9a')][_0xa1be('0x8d')]},{'transaction':_0x2bce4b});});return Promise[_0xa1be('0x9b')](_0x5b861b);});});});return Promise['all'](_0xaeeb50);});return Promise['all'](_0x63414f);})[_0xa1be('0x2d')](function(){return db[_0xa1be('0x71')][_0xa1be('0x7d')]({'where':{'teamId':_0x41ce8b}})[_0xa1be('0x2d')](function(_0x23dc9b){if(_0x23dc9b){var _0x486137=_[_0xa1be('0x31')](_0x348c85,function(_0x3283b8){db[_0xa1be('0x72')][_0xa1be('0x9c')]({'UserId':_0x3283b8,'VoicePrefixId':_0x23dc9b[_0xa1be('0x73')]});});return Promise[_0xa1be('0x9b')](_0x486137);}});});});return Promise[_0xa1be('0x9b')](_0x584e92)['then'](function(){return _0x3b553a['addAgents'](_0x348c85,{'transaction':_0x2bce4b})['spread'](function(_0x2450fd){return _0x2450fd;});});});}})['then'](respondWithResult(_0x4099c2,null))['catch'](handleError(_0x4099c2,null));};exports[_0xa1be('0x9d')]=function(_0x56489f,_0x5d513a){var _0x1335be=_[_0xa1be('0x84')](_0x56489f[_0xa1be('0x37')][_0xa1be('0x85')])?_0x56489f['query'][_0xa1be('0x85')]:[_0x56489f['query'][_0xa1be('0x85')]];var _0x537b1e=_0x56489f[_0xa1be('0x57')]['id'];return db[_0xa1be('0x32')][_0xa1be('0x4c')]({'where':{'id':_0x537b1e}})[_0xa1be('0x2d')](handleEntityNotFound(_0x5d513a,null))[_0xa1be('0x2d')](function(_0x8814ed){if(_0x8814ed){var _0x139fa1=[_0xa1be('0x8a'),_0xa1be('0x86'),_0xa1be('0x9e'),_0xa1be('0x87'),_0xa1be('0x88'),_0xa1be('0x9f'),_0xa1be('0x89')];return db['sequelize'][_0xa1be('0x5a')](function(_0x2def79){var _0x4e78a6=_['map'](_0x139fa1,function(_0x33696f){var _0x2298ac={'attributes':['id',_0xa1be('0x2e')]};return _0x8814ed[_0xa1be('0x50')+_0x33696f+_0xa1be('0x7b')](_0x2298ac)[_0xa1be('0x2d')](function(_0xe1ef39){var _0x349b71=_[_0xa1be('0x31')](_0xe1ef39,function(_0x109a31){return _0x109a31[_0xa1be('0x9d')](_0x1335be,{'transaction':_0x2def79})[_0xa1be('0x2d')](function(){var _0xeaeb6d=_[_0xa1be('0x31')](_0x1335be,function(_0x17443a){socket[_0xa1be('0x90')](_0xa1be('0x4f')+_0x33696f+'Queue:remove',{'UserId':Number(_0x17443a),[_0x33696f+_0xa1be('0x8c')]:_0x109a31['id']});if(_0x33696f!==_0xa1be('0x8a')){return;}return db[_0xa1be('0x95')][_0xa1be('0x58')]({'where':{'VoiceQueueId':_0x109a31['id'],'UserId':_0x17443a},'transaction':_0x2def79});});return Promise[_0xa1be('0x9b')](_0xeaeb6d);});});return Promise[_0xa1be('0x9b')](_0x349b71);});});return Promise[_0xa1be('0x9b')](_0x4e78a6)[_0xa1be('0x2d')](function(){return _0x8814ed['removeAgents'](_0x1335be,{'transaction':_0x2def79});})[_0xa1be('0x2d')](function(){return db[_0xa1be('0x71')][_0xa1be('0x7d')]({'where':{'teamId':_0x537b1e}})[_0xa1be('0x2d')](function(_0x58b1a4){if(_0x58b1a4){var _0x33502f=_[_0xa1be('0x31')](_0x1335be,function(_0x2257f4){db[_0xa1be('0x72')][_0xa1be('0x58')]({'where':{'UserId':_0x2257f4,'VoicePrefixId':_0x58b1a4[_0xa1be('0x73')]}});});return Promise[_0xa1be('0x9b')](_0x33502f);}});});});}})['then'](respondWithStatusCode(_0x5d513a,null))['catch'](handleError(_0x5d513a,null));};exports[_0xa1be('0xa0')]=function(_0x56fe43,_0x22e833,_0x176c32){var _0x4c162b={};var _0x33106b={};var _0x3cc30f;var _0x2681e4;return db[_0xa1be('0x32')][_0xa1be('0x7d')]({'where':{'id':_0x56fe43['params']['id']}})['then'](handleEntityNotFound(_0x22e833,null))[_0xa1be('0x2d')](function(_0x3144c8){if(_0x3144c8){_0x3cc30f=_0x3144c8;_0x33106b['model']=_[_0xa1be('0x38')](db[_0xa1be('0x8e')][_0xa1be('0x33')]);_0x33106b[_0xa1be('0x37')]=_[_0xa1be('0x38')](_0x56fe43['query']);_0x33106b[_0xa1be('0x39')]=_[_0xa1be('0x3a')](_0x33106b['model'],_0x33106b[_0xa1be('0x37')]);_0x4c162b[_0xa1be('0x3c')]=_['intersection'](_0x33106b[_0xa1be('0x36')],qs[_0xa1be('0x3b')](_0x56fe43[_0xa1be('0x37')][_0xa1be('0x3b')]));_0x4c162b[_0xa1be('0x3c')]=_0x4c162b[_0xa1be('0x3c')][_0xa1be('0x3d')]?_0x4c162b[_0xa1be('0x3c')]:_0x33106b[_0xa1be('0x36')];_0x4c162b[_0xa1be('0x40')]=qs[_0xa1be('0x41')](_0x56fe43[_0xa1be('0x37')][_0xa1be('0x41')]);_0x4c162b['where']=qs[_0xa1be('0x39')](_[_0xa1be('0x43')](_0x56fe43[_0xa1be('0x37')],_0x33106b[_0xa1be('0x39')]));if(_0x56fe43[_0xa1be('0x37')][_0xa1be('0x44')]){_0x4c162b[_0xa1be('0x42')]=_[_0xa1be('0x45')](_0x4c162b['where'],{'$or':_[_0xa1be('0x31')](_0x4c162b[_0xa1be('0x3c')],function(_0x5ad1e1){var _0x192baf={};_0x192baf[_0x5ad1e1]={'$like':'%'+_0x56fe43['query'][_0xa1be('0x44')]+'%'};return _0x192baf;})});}_0x4c162b=_[_0xa1be('0x45')]({},_0x4c162b,_0x56fe43[_0xa1be('0x47')]);return _0x3cc30f[_0xa1be('0xa0')](_0x4c162b);}})['then'](function(_0x32c710){if(_0x32c710){_0x2681e4=_0x32c710[_0xa1be('0x3d')];if(!_0x56fe43['query'][_0xa1be('0xa1')]('nolimit')){_0x4c162b[_0xa1be('0x3f')]=qs[_0xa1be('0x3f')](_0x56fe43['query'][_0xa1be('0x3f')]);_0x4c162b[_0xa1be('0x25')]=qs[_0xa1be('0x25')](_0x56fe43['query'][_0xa1be('0x25')]);}return _0x3cc30f[_0xa1be('0xa0')](_0x4c162b);}})[_0xa1be('0x2d')](function(_0x24ade4){if(_0x24ade4){return _0x24ade4?{'count':_0x2681e4,'rows':_0x24ade4}:null;}})[_0xa1be('0x2d')](respondWithResult(_0x22e833,null))[_0xa1be('0x49')](handleError(_0x22e833,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 656c1a0..39c92c7 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 _0x76d5=['save','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x4dc3f0,_0x465e33){var _0x5ccb75=function(_0x1e0c70){while(--_0x1e0c70){_0x4dc3f0['push'](_0x4dc3f0['shift']());}};_0x5ccb75(++_0x465e33);}(_0x76d5,0x11c));var _0x576d=function(_0xa7d292,_0x3cefb0){_0xa7d292=_0xa7d292-0x0;var _0x277028=_0x76d5[_0xa7d292];return _0x277028;};'use strict';var EventEmitter=require(_0x576d('0x0'));var Team=require(_0x576d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x576d('0x2')](0x0);var events={'afterCreate':_0x576d('0x3'),'afterUpdate':'update','afterDestroy':_0x576d('0x4')};function emitEvent(_0x20b9a0){return function(_0x5bca41,_0x4eea5c,_0x163836){TeamEvents[_0x576d('0x5')](_0x20b9a0+':'+_0x5bca41['id'],_0x5bca41);TeamEvents[_0x576d('0x5')](_0x20b9a0,_0x5bca41);_0x163836(null);};}for(var e in events){if(events[_0x576d('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xb3f9=['hasOwnProperty','hook','events','update','remove','emit'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0xb3f9,0xc2));var _0x9b3f=function(_0xb04641,_0x2f7db7){_0xb04641=_0xb04641-0x0;var _0x4fa72b=_0xb3f9[_0xb04641];return _0x4fa72b;};'use strict';var EventEmitter=require(_0x9b3f('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b3f('0x1'),'afterDestroy':_0x9b3f('0x2')};function emitEvent(_0x1b99d7){return function(_0x50a997,_0xfc8b6d,_0x3f6e42){TeamEvents[_0x9b3f('0x3')](_0x1b99d7+':'+_0x50a997['id'],_0x50a997);TeamEvents[_0x9b3f('0x3')](_0x1b99d7,_0x50a997);_0x3f6e42(null);};}for(var e in events){if(events[_0x9b3f('0x4')](e)){var event=events[e];Team[_0x9b3f('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 53f56a8..d145e00 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 _0x4544=['Voice','Whatsapp','resolve','then','all','lodash','./team.attributes','get','map','channel','catch','define','Team','teams','Fax','Mail','Openchannel'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x4544,0x1bf));var _0x4454=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x4544[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x4454('0x0'));var attributes=require(_0x4454('0x1'));function getQueuesByChannel(_0x52864f,_0x4ed431){var _0x41b52a=_0x4454('0x2')+_0x4ed431+'Queues';return _0x52864f[_0x41b52a]()['then'](function(_0x16d0cd){return _[_0x4454('0x3')](_0x16d0cd,function(_0x562fca){_0x562fca['setDataValue'](_0x4454('0x4'),_0x4ed431);return _0x562fca;});})[_0x4454('0x5')](function(_0x543747){throw _0x543747;});}module['exports']=function(_0x4a76a5){return _0x4a76a5[_0x4454('0x6')](_0x4454('0x7'),attributes,{'tableName':_0x4454('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2551e8=this;var _0x3b592b=['Chat',_0x4454('0x9'),_0x4454('0xa'),_0x4454('0xb'),'Sms',_0x4454('0xc'),_0x4454('0xd')];return Promise[_0x4454('0xe')]()[_0x4454('0xf')](function(){var _0x513395=_[_0x4454('0x3')](_0x3b592b,function(_0x550781){return getQueuesByChannel(_0x2551e8,_0x550781);});return Promise[_0x4454('0x10')](_0x513395);})['catch'](function(_0x1666ac){throw _0x1666ac;});}}});}; \ No newline at end of file +var _0x8920=['Voice','Whatsapp','resolve','all','./team.attributes','get','Queues','then','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms'];(function(_0x159c75,_0xc06a35){var _0x40bf2b=function(_0x17799c){while(--_0x17799c){_0x159c75['push'](_0x159c75['shift']());}};_0x40bf2b(++_0xc06a35);}(_0x8920,0x1df));var _0x0892=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8920[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var attributes=require(_0x0892('0x0'));function getQueuesByChannel(_0x4e1013,_0x4d5c56){var _0x4d9fbd=_0x0892('0x1')+_0x4d5c56+_0x0892('0x2');return _0x4e1013[_0x4d9fbd]()[_0x0892('0x3')](function(_0x30707a){return _['map'](_0x30707a,function(_0x453978){_0x453978['setDataValue'](_0x0892('0x4'),_0x4d5c56);return _0x453978;});})[_0x0892('0x5')](function(_0x52931e){throw _0x52931e;});}module[_0x0892('0x6')]=function(_0x1eb168){return _0x1eb168[_0x0892('0x7')](_0x0892('0x8'),attributes,{'tableName':_0x0892('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x154551=this;var _0x1b5b1a=[_0x0892('0xa'),_0x0892('0xb'),_0x0892('0xc'),_0x0892('0xd'),_0x0892('0xe'),_0x0892('0xf'),_0x0892('0x10')];return Promise[_0x0892('0x11')]()[_0x0892('0x3')](function(){var _0x160a38=_['map'](_0x1b5b1a,function(_0x2b1f7a){return getQueuesByChannel(_0x154551,_0x2b1f7a);});return Promise[_0x0892('0x12')](_0x160a38);})[_0x0892('0x5')](function(_0x3c5131){throw _0x3c5131;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 61f01ba..d05c9d4 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 _0xe279=['redis','defaults','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xd0aedb,_0x1aad38){var _0xdcda0d=function(_0x200a2a){while(--_0x200a2a){_0xd0aedb['push'](_0xd0aedb['shift']());}};_0xdcda0d(++_0x1aad38);}(_0xe279,0xa5));var _0x9e27=function(_0x2c341e,_0x414d11){_0x2c341e=_0x2c341e-0x0;var _0x43c1e8=_0xe279[_0x2c341e];return _0x43c1e8;};'use strict';var _=require(_0x9e27('0x0'));var util=require(_0x9e27('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9e27('0x2'));var fs=require('fs');var Redis=require(_0x9e27('0x3'));var db=require(_0x9e27('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e27('0x5'))(_0x9e27('0x6'));var config=require('../../config/environment');var jayson=require(_0x9e27('0x7'));var client=jayson[_0x9e27('0x8')][_0x9e27('0x9')]({'port':0x232a});config[_0x9e27('0xa')]=_[_0x9e27('0xb')](config[_0x9e27('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e27('0xc'))[_0x9e27('0xd')](socket);function respondWithRpcPromise(_0x536a0b,_0x4e1696,_0x18bbbe){return new BPromise(function(_0x2e39a5,_0x44103b){return client[_0x9e27('0xe')](_0x536a0b,_0x18bbbe)[_0x9e27('0xf')](function(_0x18ad12){logger['info'](_0x9e27('0x10'),_0x4e1696,_0x9e27('0x11'));logger['debug'](_0x9e27('0x12'),_0x4e1696,'request\x20sent',JSON['stringify'](_0x18ad12));if(_0x18ad12[_0x9e27('0x13')]){if(_0x18ad12['error'][_0x9e27('0x14')]===0x1f4){logger[_0x9e27('0x13')](_0x9e27('0x10'),_0x4e1696,_0x18ad12[_0x9e27('0x13')][_0x9e27('0x15')]);return _0x44103b(_0x18ad12[_0x9e27('0x13')][_0x9e27('0x15')]);}logger[_0x9e27('0x13')](_0x9e27('0x10'),_0x4e1696,_0x18ad12[_0x9e27('0x13')]['message']);return _0x2e39a5(_0x18ad12['error'][_0x9e27('0x15')]);}else{logger[_0x9e27('0x16')](_0x9e27('0x10'),_0x4e1696,_0x9e27('0x11'));_0x2e39a5(_0x18ad12[_0x9e27('0x17')][_0x9e27('0x15')]);}})[_0x9e27('0x18')](function(_0x473087){logger[_0x9e27('0x13')](_0x9e27('0x10'),_0x4e1696,_0x473087);_0x44103b(_0x473087);});});} \ No newline at end of file +var _0x0144=['defaults','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x0144,0x160));var _0x4014=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x0144[_0x934425];return _0x31d596;};'use strict';var _=require(_0x4014('0x0'));var util=require('util');var moment=require(_0x4014('0x1'));var BPromise=require(_0x4014('0x2'));var rs=require(_0x4014('0x3'));var fs=require('fs');var Redis=require(_0x4014('0x4'));var db=require(_0x4014('0x5'))['db'];var utils=require(_0x4014('0x6'));var logger=require(_0x4014('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4014('0x8'));var client=jayson[_0x4014('0x9')][_0x4014('0xa')]({'port':0x232a});config[_0x4014('0xb')]=_[_0x4014('0xc')](config[_0x4014('0xb')],{'host':_0x4014('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4014('0xe'))[_0x4014('0xf')](socket);function respondWithRpcPromise(_0xf9d57b,_0x5e65ed,_0x404dad){return new BPromise(function(_0x30a938,_0xbf1bc1){return client[_0x4014('0x10')](_0xf9d57b,_0x404dad)[_0x4014('0x11')](function(_0x14ec8b){logger[_0x4014('0x12')](_0x4014('0x13'),_0x5e65ed,_0x4014('0x14'));logger[_0x4014('0x15')](_0x4014('0x16'),_0x5e65ed,_0x4014('0x14'),JSON[_0x4014('0x17')](_0x14ec8b));if(_0x14ec8b[_0x4014('0x18')]){if(_0x14ec8b[_0x4014('0x18')][_0x4014('0x19')]===0x1f4){logger[_0x4014('0x18')]('Team,\x20%s,\x20%s',_0x5e65ed,_0x14ec8b[_0x4014('0x18')]['message']);return _0xbf1bc1(_0x14ec8b[_0x4014('0x18')][_0x4014('0x1a')]);}logger[_0x4014('0x18')](_0x4014('0x13'),_0x5e65ed,_0x14ec8b[_0x4014('0x18')][_0x4014('0x1a')]);return _0x30a938(_0x14ec8b[_0x4014('0x18')]['message']);}else{logger['info']('Team,\x20%s,\x20%s',_0x5e65ed,_0x4014('0x14'));_0x30a938(_0x14ec8b['result'][_0x4014('0x1a')]);}})[_0x4014('0x1b')](function(_0x28e13d){logger['error'](_0x4014('0x13'),_0x5e65ed,_0x28e13d);_0xbf1bc1(_0x28e13d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 125137c..92e9893 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 _0xbe99=['./team.events','save','remove','update','removeListener','register','team:'];(function(_0x4ba90b,_0x1f742a){var _0x272c16=function(_0xc42bac){while(--_0xc42bac){_0x4ba90b['push'](_0x4ba90b['shift']());}};_0x272c16(++_0x1f742a);}(_0xbe99,0x196));var _0x9be9=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0xbe99[_0x1e5068];return _0x2230b6;};'use strict';var TeamEvents=require(_0x9be9('0x0'));var events=[_0x9be9('0x1'),_0x9be9('0x2'),_0x9be9('0x3')];function createListener(_0x34fc81,_0x598d7e){return function(_0x3a0621){_0x598d7e['emit'](_0x34fc81,_0x3a0621);};}function removeListener(_0x3bc6d5,_0x3cfcaa){return function(){TeamEvents[_0x9be9('0x4')](_0x3bc6d5,_0x3cfcaa);};}exports[_0x9be9('0x5')]=function(_0x52da35){for(var _0x2134e7=0x0,_0x1eccd7=events['length'];_0x2134e7<_0x1eccd7;_0x2134e7++){var _0x49694d=events[_0x2134e7];var _0x7e0cd=createListener(_0x9be9('0x6')+_0x49694d,_0x52da35);TeamEvents['on'](_0x49694d,_0x7e0cd);}}; \ No newline at end of file +var _0xbdc4=['register','team:','save','remove','update','removeListener'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbdc4,0xaa));var _0x4bdc=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xbdc4[_0x3511d3];return _0x5d6321;};'use strict';var TeamEvents=require('./team.events');var events=[_0x4bdc('0x0'),_0x4bdc('0x1'),_0x4bdc('0x2')];function createListener(_0xe23acc,_0x5b57ce){return function(_0x54211d){_0x5b57ce['emit'](_0xe23acc,_0x54211d);};}function removeListener(_0x1bb827,_0x1108bb){return function(){TeamEvents[_0x4bdc('0x3')](_0x1bb827,_0x1108bb);};}exports[_0x4bdc('0x4')]=function(_0x117731){for(var _0x3a3322=0x0,_0x34bb89=events['length'];_0x3a3322<_0x34bb89;_0x3a3322++){var _0x202ca9=events[_0x3a3322];var _0x1a7829=createListener(_0x4bdc('0x5')+_0x202ca9,_0x117731);TeamEvents['on'](_0x202ca9,_0x1a7829);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index e905930..4c8af69 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 _0x6ff1=['exports','INTEGER','sequelize'];(function(_0x2c654f,_0x11ce94){var _0xa53d15=function(_0x4db4a9){while(--_0x4db4a9){_0x2c654f['push'](_0x2c654f['shift']());}};_0xa53d15(++_0x11ce94);}(_0x6ff1,0x10a));var _0x16ff=function(_0x378616,_0xd7384e){_0x378616=_0x378616-0x0;var _0x2d42d6=_0x6ff1[_0x378616];return _0x2d42d6;};'use strict';var Sequelize=require(_0x16ff('0x0'));module[_0x16ff('0x1')]={'TeamId':{'type':Sequelize[_0x16ff('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x16ff('0x2')]}}; \ No newline at end of file +var _0xcdce=['exports','INTEGER'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xcdce,0x15a));var _0xecdc=function(_0xbf52d2,_0x2cd21){_0xbf52d2=_0xbf52d2-0x0;var _0x1261d4=_0xcdce[_0xbf52d2];return _0x1261d4;};'use strict';var Sequelize=require('sequelize');module[_0xecdc('0x0')]={'TeamId':{'type':Sequelize[_0xecdc('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xecdc('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5c14278..a270f8b 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 _0x351d=['../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x43e0b8,_0x571d38){var _0xab6d19=function(_0x325e90){while(--_0x325e90){_0x43e0b8['push'](_0x43e0b8['shift']());}};_0xab6d19(++_0x571d38);}(_0x351d,0x90));var _0xd351=function(_0x4cee12,_0x24b594){_0x4cee12=_0x4cee12-0x0;var _0x58612f=_0x351d[_0x4cee12];return _0x58612f;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42f4=['request-promise','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','api','moment','bluebird'];(function(_0x29fe20,_0x5be65d){var _0x59c303=function(_0x2aa094){while(--_0x2aa094){_0x29fe20['push'](_0x29fe20['shift']());}};_0x59c303(++_0x5be65d);}(_0x42f4,0x19d));var _0x442f=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0x42f4[_0x10d0f0];return _0x93e308;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index f1a88c7..8717b1b 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x42f465,_0x48a8a4){var _0x43a3b4=function(_0x5d756e){while(--_0x5d756e){_0x42f465['push'](_0x42f465['shift']());}};_0x43a3b4(++_0x48a8a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x36cd5b,_0xe52957){var _0x448ef1=function(_0x26ad8c){while(--_0x26ad8c){_0x36cd5b['push'](_0x36cd5b['shift']());}};_0x448ef1(++_0xe52957);}(_0x70e0,0x17b));var _0x070e=function(_0x3d299a,_0x50fbf1){_0x3d299a=_0x3d299a-0x0;var _0x35b485=_0x70e0[_0x3d299a];return _0x35b485;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1d54805..cd44041 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 _0xa1e9=['INTEGER','sequelize','exports'];(function(_0x19cb16,_0x4d139c){var _0xb99c45=function(_0x44691a){while(--_0x44691a){_0x19cb16['push'](_0x19cb16['shift']());}};_0xb99c45(++_0x4d139c);}(_0xa1e9,0x1ed));var _0x9a1e=function(_0x1c7586,_0x16efa7){_0x1c7586=_0x1c7586-0x0;var _0x4b4429=_0xa1e9[_0x1c7586];return _0x4b4429;};'use strict';var Sequelize=require(_0x9a1e('0x0'));module[_0x9a1e('0x1')]={'penalty':{'type':Sequelize[_0x9a1e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4556=['INTEGER','sequelize'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x4556,0x8f));var _0x6455=function(_0x52cfcb,_0x16b1f5){_0x52cfcb=_0x52cfcb-0x0;var _0x1aaecd=_0x4556[_0x52cfcb];return _0x1aaecd;};'use strict';var Sequelize=require(_0x6455('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6455('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 30e81ca..03be8cb 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 _0xb821=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','bluebird'];(function(_0x17a19c,_0x4a7440){var _0x1314e3=function(_0x21d8c1){while(--_0x21d8c1){_0x17a19c['push'](_0x17a19c['shift']());}};_0x1314e3(++_0x4a7440);}(_0xb821,0xa7));var _0x1b82=function(_0x4c7e32,_0x44dca3){_0x4c7e32=_0x4c7e32-0x0;var _0x3ff8fd=_0xb821[_0x4c7e32];return _0x3ff8fd;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bbb=['team_has_voice_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','TeamVoiceQueue'];(function(_0x3d343a,_0x443808){var _0x551f99=function(_0x2f8a18){while(--_0x2f8a18){_0x3d343a['push'](_0x3d343a['shift']());}};_0x551f99(++_0x443808);}(_0x2bbb,0x85));var _0xb2bb=function(_0x2aba69,_0x113724){_0x2aba69=_0x2aba69-0x0;var _0xd2c42b=_0x2bbb[_0x2aba69];return _0xd2c42b;};'use strict';var _=require('lodash');var util=require(_0xb2bb('0x0'));var logger=require(_0xb2bb('0x1'))(_0xb2bb('0x2'));var moment=require('moment');var BPromise=require(_0xb2bb('0x3'));var rp=require(_0xb2bb('0x4'));var fs=require('fs');var path=require(_0xb2bb('0x5'));var rimraf=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var attributes=require(_0xb2bb('0x8'));module['exports']=function(_0x3581e2,_0x5bee47){return _0x3581e2['define'](_0xb2bb('0x9'),attributes,{'tableName':_0xb2bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 2fe244a..ec6e5ba 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 _0x4e4d=['../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x523d0a,_0x29e454){var _0x4c0260=function(_0x554edf){while(--_0x554edf){_0x523d0a['push'](_0x523d0a['shift']());}};_0x4c0260(++_0x29e454);}(_0x4e4d,0xd7));var _0xd4e4=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x4e4d[_0x3c51d4];return _0x53c45f;};'use strict';var _=require(_0xd4e4('0x0'));var util=require(_0xd4e4('0x1'));var moment=require(_0xd4e4('0x2'));var BPromise=require(_0xd4e4('0x3'));var rs=require(_0xd4e4('0x4'));var fs=require('fs');var Redis=require(_0xd4e4('0x5'));var db=require(_0xd4e4('0x6'))['db'];var utils=require(_0xd4e4('0x7'));var logger=require(_0xd4e4('0x8'))(_0xd4e4('0x9'));var config=require(_0xd4e4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd4e4('0xb')][_0xd4e4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c35bd,_0x536990,_0x2e73c2){return new BPromise(function(_0x418698,_0x56bf24){return client['request'](_0x5c35bd,_0x2e73c2)[_0xd4e4('0xd')](function(_0x159faa){logger[_0xd4e4('0xe')](_0xd4e4('0xf'),_0x536990,_0xd4e4('0x10'));logger[_0xd4e4('0x11')](_0xd4e4('0x12'),_0x536990,_0xd4e4('0x10'),JSON[_0xd4e4('0x13')](_0x159faa));if(_0x159faa[_0xd4e4('0x14')]){if(_0x159faa['error'][_0xd4e4('0x15')]===0x1f4){logger[_0xd4e4('0x14')](_0xd4e4('0xf'),_0x536990,_0x159faa[_0xd4e4('0x14')]['message']);return _0x56bf24(_0x159faa['error'][_0xd4e4('0x16')]);}logger[_0xd4e4('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x536990,_0x159faa['error']['message']);return _0x418698(_0x159faa[_0xd4e4('0x14')][_0xd4e4('0x16')]);}else{logger[_0xd4e4('0xe')](_0xd4e4('0xf'),_0x536990,_0xd4e4('0x10'));_0x418698(_0x159faa[_0xd4e4('0x17')][_0xd4e4('0x16')]);}})[_0xd4e4('0x18')](function(_0x497e00){logger[_0xd4e4('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x536990,_0x497e00);_0x56bf24(_0x497e00);});});} \ No newline at end of file +var _0x6505=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x3be74f,_0x2a44ec){var _0xbf968c=function(_0x415a1c){while(--_0x415a1c){_0x3be74f['push'](_0x3be74f['shift']());}};_0xbf968c(++_0x2a44ec);}(_0x6505,0x8c));var _0x5650=function(_0x4e771e,_0x5e3b60){_0x4e771e=_0x4e771e-0x0;var _0x5e1fa4=_0x6505[_0x4e771e];return _0x5e1fa4;};'use strict';var _=require(_0x5650('0x0'));var util=require(_0x5650('0x1'));var moment=require(_0x5650('0x2'));var BPromise=require(_0x5650('0x3'));var rs=require(_0x5650('0x4'));var fs=require('fs');var Redis=require(_0x5650('0x5'));var db=require(_0x5650('0x6'))['db'];var utils=require(_0x5650('0x7'));var logger=require(_0x5650('0x8'))(_0x5650('0x9'));var config=require(_0x5650('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5650('0xb')][_0x5650('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39fab5,_0x21a5b1,_0x224352){return new BPromise(function(_0x29fc80,_0x14a29b){return client['request'](_0x39fab5,_0x224352)[_0x5650('0xd')](function(_0x4cde26){logger[_0x5650('0xe')](_0x5650('0xf'),_0x21a5b1,_0x5650('0x10'));logger[_0x5650('0x11')](_0x5650('0x12'),_0x21a5b1,_0x5650('0x10'),JSON[_0x5650('0x13')](_0x4cde26));if(_0x4cde26[_0x5650('0x14')]){if(_0x4cde26[_0x5650('0x14')][_0x5650('0x15')]===0x1f4){logger[_0x5650('0x14')](_0x5650('0xf'),_0x21a5b1,_0x4cde26[_0x5650('0x14')][_0x5650('0x16')]);return _0x14a29b(_0x4cde26[_0x5650('0x14')][_0x5650('0x16')]);}logger[_0x5650('0x14')](_0x5650('0xf'),_0x21a5b1,_0x4cde26[_0x5650('0x14')][_0x5650('0x16')]);return _0x29fc80(_0x4cde26['error'][_0x5650('0x16')]);}else{logger[_0x5650('0xe')](_0x5650('0xf'),_0x21a5b1,_0x5650('0x10'));_0x29fc80(_0x4cde26[_0x5650('0x17')][_0x5650('0x16')]);}})['catch'](function(_0x3f0aa8){logger[_0x5650('0x14')](_0x5650('0xf'),_0x21a5b1,_0x3f0aa8);_0x14a29b(_0x3f0aa8);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 70e0a34..740cef7 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 _0x50e5=['put','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50e5,0xb7));var _0x550e=function(_0x158f3d,_0x36e086){_0x158f3d=_0x158f3d-0x0;var _0x435322=_0x50e5[_0x158f3d];return _0x435322;};'use strict';var multer=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var path=require('path');var timeout=require(_0x550e('0x2'));var express=require(_0x550e('0x3'));var router=express[_0x550e('0x4')]();var fs_extra=require(_0x550e('0x5'));var auth=require(_0x550e('0x6'));var interaction=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var controller=require(_0x550e('0x9'));router[_0x550e('0xa')]('/',auth[_0x550e('0xb')](),controller[_0x550e('0xc')]);router[_0x550e('0xa')]('/:id',auth[_0x550e('0xb')](),controller[_0x550e('0xd')]);router['post']('/',auth[_0x550e('0xb')](),controller[_0x550e('0xe')]);router[_0x550e('0xf')]('/:id',auth[_0x550e('0xb')](),controller['update']);router['delete'](_0x550e('0x10'),auth[_0x550e('0xb')](),controller['destroy']);module[_0x550e('0x11')]=router; \ No newline at end of file +var _0xbb61=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','multer'];(function(_0x468b87,_0x3ed8b8){var _0x40d206=function(_0x583d43){while(--_0x583d43){_0x468b87['push'](_0x468b87['shift']());}};_0x40d206(++_0x3ed8b8);}(_0xbb61,0x131));var _0x1bb6=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xbb61[_0x597484];return _0x218e64;};'use strict';var multer=require(_0x1bb6('0x0'));var util=require('util');var path=require(_0x1bb6('0x1'));var timeout=require(_0x1bb6('0x2'));var express=require(_0x1bb6('0x3'));var router=express[_0x1bb6('0x4')]();var fs_extra=require(_0x1bb6('0x5'));var auth=require(_0x1bb6('0x6'));var interaction=require(_0x1bb6('0x7'));var config=require('../../config/environment');var controller=require(_0x1bb6('0x8'));router[_0x1bb6('0x9')]('/',auth[_0x1bb6('0xa')](),controller['index']);router[_0x1bb6('0x9')](_0x1bb6('0xb'),auth[_0x1bb6('0xa')](),controller['show']);router[_0x1bb6('0xc')]('/',auth[_0x1bb6('0xa')](),controller[_0x1bb6('0xd')]);router[_0x1bb6('0xe')](_0x1bb6('0xb'),auth[_0x1bb6('0xa')](),controller['update']);router[_0x1bb6('0xf')](_0x1bb6('0xb'),auth['isAuthenticated'](),controller[_0x1bb6('0x10')]);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 76ad0b7..9ca4bde 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 _0x3a44=['TEXT','sequelize','exports'];(function(_0xc12ce5,_0x3c3eab){var _0x8b5ded=function(_0x33d51e){while(--_0x33d51e){_0xc12ce5['push'](_0xc12ce5['shift']());}};_0x8b5ded(++_0x3c3eab);}(_0x3a44,0x16f));var _0x43a4=function(_0x25f5c6,_0x4250ff){_0x25f5c6=_0x25f5c6-0x0;var _0x297b7d=_0x3a44[_0x25f5c6];return _0x297b7d;};'use strict';var Sequelize=require(_0x43a4('0x0'));module[_0x43a4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x43a4('0x2')]}}; \ No newline at end of file +var _0x44c2=['STRING','TEXT','exports'];(function(_0x457f18,_0x5a8048){var _0x4df08f=function(_0x222a83){while(--_0x222a83){_0x457f18['push'](_0x457f18['shift']());}};_0x4df08f(++_0x5a8048);}(_0x44c2,0x1c7));var _0x244c=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x44c2[_0x351b46];return _0x1515df;};'use strict';var Sequelize=require('sequelize');module[_0x244c('0x0')]={'name':{'type':Sequelize[_0x244c('0x1')]},'description':{'type':Sequelize[_0x244c('0x1')]},'html':{'type':Sequelize[_0x244c('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index bad9b29..f524643 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 _0x8b21=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','then','destroy','get','Templates','sendStatus','stack','name','send','index','map','Template','type','key','model','query','keys','filters'];(function(_0x5d10fb,_0x5e9f3a){var _0x552573=function(_0x489c98){while(--_0x489c98){_0x5d10fb['push'](_0x5d10fb['shift']());}};_0x552573(++_0x5e9f3a);}(_0x8b21,0x16b));var _0x18b2=function(_0x3788bf,_0x17964f){_0x3788bf=_0x3788bf-0x0;var _0x5cd328=_0x8b21[_0x3788bf];return _0x5cd328;};'use strict';var emlformat=require(_0x18b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x18b2('0x1'));var jsonpatch=require(_0x18b2('0x2'));var rp=require(_0x18b2('0x3'));var moment=require(_0x18b2('0x4'));var BPromise=require(_0x18b2('0x5'));var Mustache=require('mustache');var util=require(_0x18b2('0x6'));var path=require(_0x18b2('0x7'));var sox=require('sox');var csv=require(_0x18b2('0x8'));var ejs=require(_0x18b2('0x9'));var fs=require('fs');var fs_extra=require(_0x18b2('0xa'));var _=require('lodash');var squel=require(_0x18b2('0xb'));var crypto=require(_0x18b2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x18b2('0xd'));var toCsv=require(_0x18b2('0x8'));var querystring=require('querystring');var Papa=require(_0x18b2('0xe'));var Redis=require(_0x18b2('0xf'));var authService=require(_0x18b2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x18b2('0x11'));var hardwareService=require(_0x18b2('0x12'));var logger=require(_0x18b2('0x13'))(_0x18b2('0x14'));var utils=require('../../config/utils');var config=require(_0x18b2('0x15'));var licenseUtil=require(_0x18b2('0x16'));var db=require(_0x18b2('0x17'))['db'];function respondWithStatusCode(_0x3b438b,_0x41310c){_0x41310c=_0x41310c||0xcc;return function(_0x3b5d5c){if(_0x3b5d5c){return _0x3b438b['sendStatus'](_0x41310c);}return _0x3b438b[_0x18b2('0x18')](_0x41310c)[_0x18b2('0x19')]();};}function respondWithResult(_0x3ea90b,_0x4155fe){_0x4155fe=_0x4155fe||0xc8;return function(_0xb8f2ab){if(_0xb8f2ab){return _0x3ea90b[_0x18b2('0x18')](_0x4155fe)['json'](_0xb8f2ab);}};}function respondWithFilteredResult(_0xd57d3,_0x26b8ad){return function(_0x1fbb1b){if(_0x1fbb1b){var _0x3e9a9e=typeof _0x26b8ad['offset']==='undefined'&&typeof _0x26b8ad[_0x18b2('0x1a')]===_0x18b2('0x1b');var _0xffa36d=_0x1fbb1b[_0x18b2('0x1c')];var _0x9941c0=_0x3e9a9e?0x0:_0x26b8ad[_0x18b2('0x1d')];var _0x19fd6c=_0x3e9a9e?_0x1fbb1b['count']:_0x26b8ad['offset']+_0x26b8ad[_0x18b2('0x1a')];var _0x318c4f;if(_0x19fd6c>=_0xffa36d){_0x19fd6c=_0xffa36d;_0x318c4f=0xc8;}else{_0x318c4f=0xce;}_0xd57d3[_0x18b2('0x18')](_0x318c4f);return _0xd57d3[_0x18b2('0x1e')](_0x18b2('0x1f'),_0x9941c0+'-'+_0x19fd6c+'/'+_0xffa36d)[_0x18b2('0x20')](_0x1fbb1b);}return null;};}function patchUpdates(_0x59a08a){return function(_0x2fc7aa){try{jsonpatch[_0x18b2('0x21')](_0x2fc7aa,_0x59a08a,!![]);}catch(_0x531777){return BPromise['reject'](_0x531777);}return _0x2fc7aa[_0x18b2('0x22')]();};}function saveUpdates(_0x2ba727,_0x4a8fff){return function(_0x52247e){if(_0x52247e){return _0x52247e['update'](_0x2ba727)[_0x18b2('0x23')](function(_0x1935dd){return _0x1935dd;});}return null;};}function removeEntity(_0x3c8f81,_0x5a19fb){return function(_0x505718){if(_0x505718){return _0x505718[_0x18b2('0x24')]()[_0x18b2('0x23')](function(){var _0x4aecac=_0x505718[_0x18b2('0x25')]({'plain':!![]});var _0x322810=_0x18b2('0x26');return db['UserProfileResource'][_0x18b2('0x24')]({'where':{'type':_0x322810,'resourceId':_0x4aecac['id']}})['then'](function(){return _0x505718;});})[_0x18b2('0x23')](function(){_0x3c8f81[_0x18b2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462c7e,_0x307338){return function(_0x6c0b45){if(!_0x6c0b45){_0x462c7e[_0x18b2('0x27')](0x194);}return _0x6c0b45;};}function handleError(_0x9091aa,_0x1989b3){_0x1989b3=_0x1989b3||0x1f4;return function(_0x28998e){logger['error'](_0x28998e[_0x18b2('0x28')]);if(_0x28998e[_0x18b2('0x29')]){delete _0x28998e[_0x18b2('0x29')];}_0x9091aa[_0x18b2('0x18')](_0x1989b3)[_0x18b2('0x2a')](_0x28998e);};}exports[_0x18b2('0x2b')]=function(_0x1bb029,_0x3b3a5b){var _0x300ddd={},_0x3ae96d={},_0x14b92e={'count':0x0,'rows':[]};var _0x11c9e4=_[_0x18b2('0x2c')](db[_0x18b2('0x2d')]['rawAttributes'],function(_0x4f8f13){return{'name':_0x4f8f13['fieldName'],'type':_0x4f8f13[_0x18b2('0x2e')][_0x18b2('0x2f')]};});_0x3ae96d[_0x18b2('0x30')]=_[_0x18b2('0x2c')](_0x11c9e4,_0x18b2('0x29'));_0x3ae96d[_0x18b2('0x31')]=_[_0x18b2('0x32')](_0x1bb029['query']);_0x3ae96d[_0x18b2('0x33')]=_['intersection'](_0x3ae96d['model'],_0x3ae96d[_0x18b2('0x31')]);_0x300ddd[_0x18b2('0x34')]=_[_0x18b2('0x35')](_0x3ae96d[_0x18b2('0x30')],qs[_0x18b2('0x36')](_0x1bb029[_0x18b2('0x31')][_0x18b2('0x36')]));_0x300ddd[_0x18b2('0x34')]=_0x300ddd['attributes'][_0x18b2('0x37')]?_0x300ddd[_0x18b2('0x34')]:_0x3ae96d[_0x18b2('0x30')];if(!_0x1bb029['query'][_0x18b2('0x38')](_0x18b2('0x39'))){_0x300ddd[_0x18b2('0x1a')]=qs['limit'](_0x1bb029[_0x18b2('0x31')][_0x18b2('0x1a')]);_0x300ddd[_0x18b2('0x1d')]=qs[_0x18b2('0x1d')](_0x1bb029[_0x18b2('0x31')][_0x18b2('0x1d')]);}_0x300ddd[_0x18b2('0x3a')]=qs[_0x18b2('0x3b')](_0x1bb029[_0x18b2('0x31')]['sort']);_0x300ddd[_0x18b2('0x3c')]=qs[_0x18b2('0x33')](_[_0x18b2('0x3d')](_0x1bb029[_0x18b2('0x31')],_0x3ae96d[_0x18b2('0x33')]),_0x11c9e4);if(_0x1bb029['query'][_0x18b2('0x3e')]){_0x300ddd[_0x18b2('0x3c')]=_[_0x18b2('0x3f')](_0x300ddd[_0x18b2('0x3c')],{'$or':_['map'](_0x11c9e4,function(_0x196420){if(_0x196420[_0x18b2('0x2e')]!==_0x18b2('0x40')){var _0x185735={};_0x185735[_0x196420['name']]={'$like':'%'+_0x1bb029['query'][_0x18b2('0x3e')]+'%'};return _0x185735;}})});}_0x300ddd=_[_0x18b2('0x3f')]({},_0x300ddd,_0x1bb029[_0x18b2('0x41')]);var _0x3149d0={'where':_0x300ddd[_0x18b2('0x3c')]};return db['Template'][_0x18b2('0x1c')](_0x3149d0)[_0x18b2('0x23')](function(_0x1450f1){_0x14b92e['count']=_0x1450f1;if(_0x1bb029['query'][_0x18b2('0x42')]){_0x300ddd[_0x18b2('0x43')]=[{'all':!![]}];}return db['Template'][_0x18b2('0x44')](_0x300ddd);})[_0x18b2('0x23')](function(_0xeff2ac){_0x14b92e[_0x18b2('0x45')]=_0xeff2ac;return _0x14b92e;})['then'](respondWithFilteredResult(_0x3b3a5b,_0x300ddd))['catch'](handleError(_0x3b3a5b,null));};exports[_0x18b2('0x46')]=function(_0x56978b,_0x586c62){var _0x3112c9={'raw':!![],'where':{'id':_0x56978b['params']['id']}},_0x14d684={};_0x14d684[_0x18b2('0x30')]=_['keys'](db[_0x18b2('0x2d')][_0x18b2('0x47')]);_0x14d684[_0x18b2('0x31')]=_[_0x18b2('0x32')](_0x56978b[_0x18b2('0x31')]);_0x14d684[_0x18b2('0x33')]=_[_0x18b2('0x35')](_0x14d684[_0x18b2('0x30')],_0x14d684[_0x18b2('0x31')]);_0x3112c9[_0x18b2('0x34')]=_[_0x18b2('0x35')](_0x14d684[_0x18b2('0x30')],qs['fields'](_0x56978b[_0x18b2('0x31')][_0x18b2('0x36')]));_0x3112c9[_0x18b2('0x34')]=_0x3112c9[_0x18b2('0x34')][_0x18b2('0x37')]?_0x3112c9[_0x18b2('0x34')]:_0x14d684[_0x18b2('0x30')];if(_0x56978b[_0x18b2('0x31')][_0x18b2('0x42')]){_0x3112c9[_0x18b2('0x43')]=[{'all':!![]}];}_0x3112c9=_[_0x18b2('0x3f')]({},_0x3112c9,_0x56978b[_0x18b2('0x41')]);return db[_0x18b2('0x2d')][_0x18b2('0x48')](_0x3112c9)[_0x18b2('0x23')](handleEntityNotFound(_0x586c62,null))[_0x18b2('0x23')](respondWithResult(_0x586c62,null))[_0x18b2('0x49')](handleError(_0x586c62,null));};exports['create']=function(_0x429f9d,_0x2628a2){return db[_0x18b2('0x2d')][_0x18b2('0x4a')](_0x429f9d[_0x18b2('0x4b')],{})[_0x18b2('0x23')](function(_0x18f75b){var _0x5dd596=_0x429f9d[_0x18b2('0x4c')]['get']({'plain':!![]});if(!_0x5dd596)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dd596[_0x18b2('0x4d')]===_0x18b2('0x4c')){var _0x229a3a=_0x18f75b[_0x18b2('0x25')]({'plain':!![]});var _0x3d04a9='Templates';return db[_0x18b2('0x4e')][_0x18b2('0x48')]({'where':{'name':_0x3d04a9,'userProfileId':_0x5dd596[_0x18b2('0x4f')]},'raw':!![]})[_0x18b2('0x23')](function(_0x423cae){if(_0x423cae&&_0x423cae[_0x18b2('0x50')]===0x0){return db[_0x18b2('0x51')][_0x18b2('0x4a')]({'name':_0x229a3a[_0x18b2('0x29')],'resourceId':_0x229a3a['id'],'type':_0x423cae[_0x18b2('0x29')],'sectionId':_0x423cae['id']},{})[_0x18b2('0x23')](function(){return _0x18f75b;});}else{return _0x18f75b;}})[_0x18b2('0x49')](function(_0x3ff0b8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ff0b8);throw _0x3ff0b8;});}return _0x18f75b;})[_0x18b2('0x23')](respondWithResult(_0x2628a2,0xc9))[_0x18b2('0x49')](handleError(_0x2628a2,null));};exports['update']=function(_0x106b3e,_0x1690bb){if(_0x106b3e[_0x18b2('0x4b')]['id']){delete _0x106b3e[_0x18b2('0x4b')]['id'];}return db[_0x18b2('0x2d')][_0x18b2('0x48')]({'where':{'id':_0x106b3e[_0x18b2('0x52')]['id']}})[_0x18b2('0x23')](handleEntityNotFound(_0x1690bb,null))[_0x18b2('0x23')](saveUpdates(_0x106b3e[_0x18b2('0x4b')],null))['then'](respondWithResult(_0x1690bb,null))[_0x18b2('0x49')](handleError(_0x1690bb,null));};exports[_0x18b2('0x24')]=function(_0x3ed3a1,_0x404cd4){return db['Template'][_0x18b2('0x48')]({'where':{'id':_0x3ed3a1[_0x18b2('0x52')]['id']}})['then'](handleEntityNotFound(_0x404cd4,null))[_0x18b2('0x23')](removeEntity(_0x404cd4,null))['catch'](handleError(_0x404cd4,null));}; \ No newline at end of file +var _0x4262=['keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','merge','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','Templates','UserProfileResource','error','stack','send','index','map','Template','rawAttributes','fieldName','type','name'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x4262,0x77));var _0x2426=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4262[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2426('0x0'));var rimraf=require(_0x2426('0x1'));var zipdir=require(_0x2426('0x2'));var jsonpatch=require(_0x2426('0x3'));var rp=require(_0x2426('0x4'));var moment=require('moment');var BPromise=require(_0x2426('0x5'));var Mustache=require(_0x2426('0x6'));var util=require(_0x2426('0x7'));var path=require(_0x2426('0x8'));var sox=require('sox');var csv=require(_0x2426('0x9'));var ejs=require(_0x2426('0xa'));var fs=require('fs');var fs_extra=require(_0x2426('0xb'));var _=require('lodash');var squel=require(_0x2426('0xc'));var crypto=require(_0x2426('0xd'));var jsforce=require(_0x2426('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2426('0x9'));var querystring=require('querystring');var Papa=require(_0x2426('0xf'));var Redis=require(_0x2426('0x10'));var authService=require(_0x2426('0x11'));var qs=require(_0x2426('0x12'));var as=require(_0x2426('0x13'));var hardwareService=require(_0x2426('0x14'));var logger=require('../../config/logger')(_0x2426('0x15'));var utils=require(_0x2426('0x16'));var config=require(_0x2426('0x17'));var licenseUtil=require(_0x2426('0x18'));var db=require(_0x2426('0x19'))['db'];function respondWithStatusCode(_0x48f0f2,_0x407844){_0x407844=_0x407844||0xcc;return function(_0x141c2b){if(_0x141c2b){return _0x48f0f2[_0x2426('0x1a')](_0x407844);}return _0x48f0f2[_0x2426('0x1b')](_0x407844)[_0x2426('0x1c')]();};}function respondWithResult(_0x4b2d6d,_0x3345c0){_0x3345c0=_0x3345c0||0xc8;return function(_0x11ad10){if(_0x11ad10){return _0x4b2d6d[_0x2426('0x1b')](_0x3345c0)[_0x2426('0x1d')](_0x11ad10);}};}function respondWithFilteredResult(_0x229258,_0x129869){return function(_0x59ecff){if(_0x59ecff){var _0x3347f2=typeof _0x129869[_0x2426('0x1e')]===_0x2426('0x1f')&&typeof _0x129869[_0x2426('0x20')]==='undefined';var _0x4f83bc=_0x59ecff[_0x2426('0x21')];var _0x33719f=_0x3347f2?0x0:_0x129869[_0x2426('0x1e')];var _0x35fe73=_0x3347f2?_0x59ecff[_0x2426('0x21')]:_0x129869['offset']+_0x129869[_0x2426('0x20')];var _0x4c7be2;if(_0x35fe73>=_0x4f83bc){_0x35fe73=_0x4f83bc;_0x4c7be2=0xc8;}else{_0x4c7be2=0xce;}_0x229258[_0x2426('0x1b')](_0x4c7be2);return _0x229258[_0x2426('0x22')](_0x2426('0x23'),_0x33719f+'-'+_0x35fe73+'/'+_0x4f83bc)[_0x2426('0x1d')](_0x59ecff);}return null;};}function patchUpdates(_0x68b3ef){return function(_0x354919){try{jsonpatch[_0x2426('0x24')](_0x354919,_0x68b3ef,!![]);}catch(_0x1d84b8){return BPromise[_0x2426('0x25')](_0x1d84b8);}return _0x354919['save']();};}function saveUpdates(_0x1759a6,_0xe463d6){return function(_0xc9cab6){if(_0xc9cab6){return _0xc9cab6['update'](_0x1759a6)[_0x2426('0x26')](function(_0x49b36f){return _0x49b36f;});}return null;};}function removeEntity(_0x1e20f7,_0x55f930){return function(_0x510618){if(_0x510618){return _0x510618[_0x2426('0x27')]()[_0x2426('0x26')](function(){var _0x20cfc9=_0x510618[_0x2426('0x28')]({'plain':!![]});var _0x205778=_0x2426('0x29');return db[_0x2426('0x2a')][_0x2426('0x27')]({'where':{'type':_0x205778,'resourceId':_0x20cfc9['id']}})[_0x2426('0x26')](function(){return _0x510618;});})[_0x2426('0x26')](function(){_0x1e20f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4271f6,_0xa891b4){return function(_0x44d902){if(!_0x44d902){_0x4271f6[_0x2426('0x1a')](0x194);}return _0x44d902;};}function handleError(_0x1dfeff,_0x305bdd){_0x305bdd=_0x305bdd||0x1f4;return function(_0xc9ac40){logger[_0x2426('0x2b')](_0xc9ac40[_0x2426('0x2c')]);if(_0xc9ac40['name']){delete _0xc9ac40['name'];}_0x1dfeff[_0x2426('0x1b')](_0x305bdd)[_0x2426('0x2d')](_0xc9ac40);};}exports[_0x2426('0x2e')]=function(_0x3043ac,_0x2c40fe){var _0x28e43b={},_0x3d2676={},_0x50843d={'count':0x0,'rows':[]};var _0x376f92=_[_0x2426('0x2f')](db[_0x2426('0x30')][_0x2426('0x31')],function(_0x45e314){return{'name':_0x45e314[_0x2426('0x32')],'type':_0x45e314[_0x2426('0x33')]['key']};});_0x3d2676['model']=_['map'](_0x376f92,_0x2426('0x34'));_0x3d2676['query']=_[_0x2426('0x35')](_0x3043ac[_0x2426('0x36')]);_0x3d2676[_0x2426('0x37')]=_[_0x2426('0x38')](_0x3d2676[_0x2426('0x39')],_0x3d2676[_0x2426('0x36')]);_0x28e43b[_0x2426('0x3a')]=_[_0x2426('0x38')](_0x3d2676[_0x2426('0x39')],qs['fields'](_0x3043ac[_0x2426('0x36')][_0x2426('0x3b')]));_0x28e43b['attributes']=_0x28e43b['attributes'][_0x2426('0x3c')]?_0x28e43b[_0x2426('0x3a')]:_0x3d2676['model'];if(!_0x3043ac[_0x2426('0x36')][_0x2426('0x3d')](_0x2426('0x3e'))){_0x28e43b['limit']=qs[_0x2426('0x20')](_0x3043ac[_0x2426('0x36')][_0x2426('0x20')]);_0x28e43b[_0x2426('0x1e')]=qs['offset'](_0x3043ac[_0x2426('0x36')][_0x2426('0x1e')]);}_0x28e43b['order']=qs[_0x2426('0x3f')](_0x3043ac['query'][_0x2426('0x3f')]);_0x28e43b[_0x2426('0x40')]=qs[_0x2426('0x37')](_[_0x2426('0x41')](_0x3043ac[_0x2426('0x36')],_0x3d2676[_0x2426('0x37')]),_0x376f92);if(_0x3043ac[_0x2426('0x36')]['filter']){_0x28e43b[_0x2426('0x40')]=_['merge'](_0x28e43b[_0x2426('0x40')],{'$or':_[_0x2426('0x2f')](_0x376f92,function(_0x40bc39){if(_0x40bc39[_0x2426('0x33')]!==_0x2426('0x42')){var _0x184353={};_0x184353[_0x40bc39[_0x2426('0x34')]]={'$like':'%'+_0x3043ac[_0x2426('0x36')][_0x2426('0x43')]+'%'};return _0x184353;}})});}_0x28e43b=_['merge']({},_0x28e43b,_0x3043ac[_0x2426('0x44')]);var _0x50fc49={'where':_0x28e43b['where']};return db[_0x2426('0x30')][_0x2426('0x21')](_0x50fc49)[_0x2426('0x26')](function(_0x330224){_0x50843d[_0x2426('0x21')]=_0x330224;if(_0x3043ac['query'][_0x2426('0x45')]){_0x28e43b[_0x2426('0x46')]=[{'all':!![]}];}return db['Template'][_0x2426('0x47')](_0x28e43b);})[_0x2426('0x26')](function(_0x25c60b){_0x50843d['rows']=_0x25c60b;return _0x50843d;})['then'](respondWithFilteredResult(_0x2c40fe,_0x28e43b))[_0x2426('0x48')](handleError(_0x2c40fe,null));};exports[_0x2426('0x49')]=function(_0x4b705c,_0x475e35){var _0x237cd4={'raw':!![],'where':{'id':_0x4b705c['params']['id']}},_0x55818={};_0x55818[_0x2426('0x39')]=_[_0x2426('0x35')](db[_0x2426('0x30')][_0x2426('0x31')]);_0x55818[_0x2426('0x36')]=_['keys'](_0x4b705c[_0x2426('0x36')]);_0x55818[_0x2426('0x37')]=_[_0x2426('0x38')](_0x55818[_0x2426('0x39')],_0x55818[_0x2426('0x36')]);_0x237cd4[_0x2426('0x3a')]=_['intersection'](_0x55818[_0x2426('0x39')],qs[_0x2426('0x3b')](_0x4b705c['query'][_0x2426('0x3b')]));_0x237cd4[_0x2426('0x3a')]=_0x237cd4[_0x2426('0x3a')][_0x2426('0x3c')]?_0x237cd4[_0x2426('0x3a')]:_0x55818[_0x2426('0x39')];if(_0x4b705c['query'][_0x2426('0x45')]){_0x237cd4[_0x2426('0x46')]=[{'all':!![]}];}_0x237cd4=_[_0x2426('0x4a')]({},_0x237cd4,_0x4b705c[_0x2426('0x44')]);return db[_0x2426('0x30')][_0x2426('0x4b')](_0x237cd4)[_0x2426('0x26')](handleEntityNotFound(_0x475e35,null))[_0x2426('0x26')](respondWithResult(_0x475e35,null))['catch'](handleError(_0x475e35,null));};exports[_0x2426('0x4c')]=function(_0x3f26f3,_0x4dabdb){return db[_0x2426('0x30')][_0x2426('0x4c')](_0x3f26f3['body'],{})[_0x2426('0x26')](function(_0x5e08a7){var _0x1bb122=_0x3f26f3[_0x2426('0x4d')]['get']({'plain':!![]});if(!_0x1bb122)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bb122[_0x2426('0x4e')]===_0x2426('0x4d')){var _0x147645=_0x5e08a7['get']({'plain':!![]});var _0x96485e=_0x2426('0x29');return db[_0x2426('0x4f')][_0x2426('0x4b')]({'where':{'name':_0x96485e,'userProfileId':_0x1bb122[_0x2426('0x50')]},'raw':!![]})['then'](function(_0x1cc447){if(_0x1cc447&&_0x1cc447[_0x2426('0x51')]===0x0){return db[_0x2426('0x2a')][_0x2426('0x4c')]({'name':_0x147645[_0x2426('0x34')],'resourceId':_0x147645['id'],'type':_0x1cc447[_0x2426('0x34')],'sectionId':_0x1cc447['id']},{})[_0x2426('0x26')](function(){return _0x5e08a7;});}else{return _0x5e08a7;}})[_0x2426('0x48')](function(_0x1112d1){logger[_0x2426('0x2b')](_0x2426('0x52'),_0x1112d1);throw _0x1112d1;});}return _0x5e08a7;})[_0x2426('0x26')](respondWithResult(_0x4dabdb,0xc9))[_0x2426('0x48')](handleError(_0x4dabdb,null));};exports[_0x2426('0x53')]=function(_0x146934,_0x2c056e){if(_0x146934['body']['id']){delete _0x146934[_0x2426('0x54')]['id'];}return db['Template'][_0x2426('0x4b')]({'where':{'id':_0x146934[_0x2426('0x55')]['id']}})[_0x2426('0x26')](handleEntityNotFound(_0x2c056e,null))['then'](saveUpdates(_0x146934[_0x2426('0x54')],null))[_0x2426('0x26')](respondWithResult(_0x2c056e,null))[_0x2426('0x48')](handleError(_0x2c056e,null));};exports[_0x2426('0x27')]=function(_0x121e83,_0xd4e013){return db['Template'][_0x2426('0x4b')]({'where':{'id':_0x121e83[_0x2426('0x55')]['id']}})[_0x2426('0x26')](handleEntityNotFound(_0xd4e013,null))['then'](removeEntity(_0xd4e013,null))[_0x2426('0x48')](handleError(_0xd4e013,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 53ac541..532ec85 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 _0xd605=['rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x25bff5,_0x4fdbb9){var _0xd9b6ee=function(_0x477a26){while(--_0x477a26){_0x25bff5['push'](_0x25bff5['shift']());}};_0xd9b6ee(++_0x4fdbb9);}(_0xd605,0xe6));var _0x5d60=function(_0x3ab77c,_0xe2cf92){_0x3ab77c=_0x3ab77c-0x0;var _0x423c9c=_0xd605[_0x3ab77c];return _0x423c9c;};'use strict';var _=require(_0x5d60('0x0'));var util=require(_0x5d60('0x1'));var logger=require(_0x5d60('0x2'))(_0x5d60('0x3'));var moment=require(_0x5d60('0x4'));var BPromise=require(_0x5d60('0x5'));var rp=require(_0x5d60('0x6'));var fs=require('fs');var path=require(_0x5d60('0x7'));var rimraf=require(_0x5d60('0x8'));var config=require(_0x5d60('0x9'));var attributes=require(_0x5d60('0xa'));module[_0x5d60('0xb')]=function(_0x192a7a,_0x36b83d){return _0x192a7a['define'](_0x5d60('0xc'),attributes,{'tableName':_0x5d60('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5125=['path','rimraf','./template.attributes','exports','define','Template','lodash','api','bluebird','request-promise'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0x5125,0x146));var _0x5512=function(_0x32270c,_0x4e4c59){_0x32270c=_0x32270c-0x0;var _0x4a0c24=_0x5125[_0x32270c];return _0x4a0c24;};'use strict';var _=require(_0x5512('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5512('0x1'));var moment=require('moment');var BPromise=require(_0x5512('0x2'));var rp=require(_0x5512('0x3'));var fs=require('fs');var path=require(_0x5512('0x4'));var rimraf=require(_0x5512('0x5'));var config=require('../../config/environment');var attributes=require(_0x5512('0x6'));module[_0x5512('0x7')]=function(_0x2b7816,_0x19b6ff){return _0x2b7816[_0x5512('0x8')](_0x5512('0x9'),attributes,{'tableName':'tools_templates','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 ac07381..afe3699 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 _0x0c2a=['Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','include','model','map','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info'];(function(_0xb3c387,_0x500c74){var _0x24c9cc=function(_0x46a2d7){while(--_0x46a2d7){_0xb3c387['push'](_0xb3c387['shift']());}};_0x24c9cc(++_0x500c74);}(_0x0c2a,0x1d5));var _0xa0c2=function(_0x4fc9ee,_0x320284){_0x4fc9ee=_0x4fc9ee-0x0;var _0x3d46e2=_0x0c2a[_0x4fc9ee];return _0x3d46e2;};'use strict';var _=require(_0xa0c2('0x0'));var util=require('util');var moment=require(_0xa0c2('0x1'));var BPromise=require(_0xa0c2('0x2'));var rs=require(_0xa0c2('0x3'));var fs=require('fs');var Redis=require(_0xa0c2('0x4'));var db=require(_0xa0c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa0c2('0x6'));var config=require(_0xa0c2('0x7'));var jayson=require(_0xa0c2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54963c,_0x1ebb86,_0x510902){return new BPromise(function(_0x9d7320,_0x1a8843){return client[_0xa0c2('0x9')](_0x54963c,_0x510902)['then'](function(_0x4782bf){logger[_0xa0c2('0xa')](_0xa0c2('0xb'),_0x1ebb86,_0xa0c2('0xc'));logger[_0xa0c2('0xd')](_0xa0c2('0xe'),_0x1ebb86,_0xa0c2('0xc'),JSON[_0xa0c2('0xf')](_0x4782bf));if(_0x4782bf[_0xa0c2('0x10')]){if(_0x4782bf['error']['code']===0x1f4){logger[_0xa0c2('0x10')](_0xa0c2('0xb'),_0x1ebb86,_0x4782bf[_0xa0c2('0x10')]['message']);return _0x1a8843(_0x4782bf[_0xa0c2('0x10')][_0xa0c2('0x11')]);}logger[_0xa0c2('0x10')](_0xa0c2('0xb'),_0x1ebb86,_0x4782bf[_0xa0c2('0x10')][_0xa0c2('0x11')]);return _0x9d7320(_0x4782bf['error'][_0xa0c2('0x11')]);}else{logger[_0xa0c2('0xa')](_0xa0c2('0xb'),_0x1ebb86,_0xa0c2('0xc'));_0x9d7320(_0x4782bf[_0xa0c2('0x12')][_0xa0c2('0x11')]);}})[_0xa0c2('0x13')](function(_0x3412e0){logger[_0xa0c2('0x10')](_0xa0c2('0xb'),_0x1ebb86,_0x3412e0);_0x1a8843(_0x3412e0);});});}exports[_0xa0c2('0x14')]=function(_0x5e70d6){var _0x54c636=this;return new Promise(function(_0x1730b7,_0x4a3bf3){return db[_0xa0c2('0x15')][_0xa0c2('0x16')]({'raw':_0x5e70d6[_0xa0c2('0x17')]?_0x5e70d6[_0xa0c2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5e70d6['options']?_0x5e70d6[_0xa0c2('0x17')][_0xa0c2('0x18')]||null:null,'attributes':_0x5e70d6[_0xa0c2('0x17')]?_0x5e70d6[_0xa0c2('0x17')][_0xa0c2('0x19')]||null:null,'limit':_0x5e70d6[_0xa0c2('0x17')]?_0x5e70d6[_0xa0c2('0x17')]['limit']||null:null,'include':_0x5e70d6[_0xa0c2('0x17')]?_0x5e70d6[_0xa0c2('0x17')][_0xa0c2('0x1a')]?_['map'](_0x5e70d6[_0xa0c2('0x17')][_0xa0c2('0x1a')],function(_0xc89ed9){return{'model':db[_0xc89ed9[_0xa0c2('0x1b')]],'as':_0xc89ed9['as'],'attributes':_0xc89ed9[_0xa0c2('0x19')],'include':_0xc89ed9['include']?_[_0xa0c2('0x1c')](_0xc89ed9[_0xa0c2('0x1a')],function(_0x3ecdcf){return{'model':db[_0x3ecdcf[_0xa0c2('0x1b')]],'as':_0x3ecdcf['as'],'attributes':_0x3ecdcf[_0xa0c2('0x19')],'include':_0x3ecdcf[_0xa0c2('0x1a')]?_[_0xa0c2('0x1c')](_0x3ecdcf[_0xa0c2('0x1a')],function(_0x1116bd){return{'model':db[_0x1116bd[_0xa0c2('0x1b')]],'as':_0x1116bd['as'],'attributes':_0x1116bd[_0xa0c2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa0c2('0x1d')](function(_0x54fae){logger[_0xa0c2('0xa')](_0xa0c2('0x14'),_0x5e70d6);logger[_0xa0c2('0xd')]('GetTemplate',_0x5e70d6,JSON['stringify'](_0x54fae));_0x1730b7(_0x54fae);})['catch'](function(_0x173474){logger[_0xa0c2('0x10')]('GetTemplate',_0x173474[_0xa0c2('0x11')],_0x5e70d6);_0x4a3bf3(_0x54c636[_0xa0c2('0x10')](0x1f4,_0x173474[_0xa0c2('0x11')]));});});}; \ No newline at end of file +var _0x7b9c=['message','info','catch','GetTemplate','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2828c2,_0x19e864){var _0x2b8cb9=function(_0x5bd08a){while(--_0x5bd08a){_0x2828c2['push'](_0x2828c2['shift']());}};_0x2b8cb9(++_0x19e864);}(_0x7b9c,0x115));var _0xc7b9=function(_0x3b1bba,_0x220536){_0x3b1bba=_0x3b1bba-0x0;var _0x4ca374=_0x7b9c[_0x3b1bba];return _0x4ca374;};'use strict';var _=require(_0xc7b9('0x0'));var util=require(_0xc7b9('0x1'));var moment=require('moment');var BPromise=require(_0xc7b9('0x2'));var rs=require(_0xc7b9('0x3'));var fs=require('fs');var Redis=require(_0xc7b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc7b9('0x5'))(_0xc7b9('0x6'));var config=require(_0xc7b9('0x7'));var jayson=require(_0xc7b9('0x8'));var client=jayson[_0xc7b9('0x9')][_0xc7b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c3348,_0x386fec,_0x226278){return new BPromise(function(_0xf75d14,_0x4f5bfe){return client[_0xc7b9('0xb')](_0x4c3348,_0x226278)[_0xc7b9('0xc')](function(_0x2e2d9e){logger['info'](_0xc7b9('0xd'),_0x386fec,'request\x20sent');logger[_0xc7b9('0xe')](_0xc7b9('0xf'),_0x386fec,_0xc7b9('0x10'),JSON[_0xc7b9('0x11')](_0x2e2d9e));if(_0x2e2d9e[_0xc7b9('0x12')]){if(_0x2e2d9e[_0xc7b9('0x12')][_0xc7b9('0x13')]===0x1f4){logger[_0xc7b9('0x12')](_0xc7b9('0xd'),_0x386fec,_0x2e2d9e[_0xc7b9('0x12')][_0xc7b9('0x14')]);return _0x4f5bfe(_0x2e2d9e[_0xc7b9('0x12')]['message']);}logger[_0xc7b9('0x12')](_0xc7b9('0xd'),_0x386fec,_0x2e2d9e[_0xc7b9('0x12')][_0xc7b9('0x14')]);return _0xf75d14(_0x2e2d9e[_0xc7b9('0x12')][_0xc7b9('0x14')]);}else{logger[_0xc7b9('0x15')]('Template,\x20%s,\x20%s',_0x386fec,_0xc7b9('0x10'));_0xf75d14(_0x2e2d9e['result']['message']);}})[_0xc7b9('0x16')](function(_0x3cc9ba){logger[_0xc7b9('0x12')](_0xc7b9('0xd'),_0x386fec,_0x3cc9ba);_0x4f5bfe(_0x3cc9ba);});});}exports[_0xc7b9('0x17')]=function(_0x359a92){var _0x91a324=this;return new Promise(function(_0x4310b2,_0x463837){return db['Template'][_0xc7b9('0x18')]({'raw':_0x359a92[_0xc7b9('0x19')]?_0x359a92[_0xc7b9('0x19')][_0xc7b9('0x1a')]===undefined?!![]:![]:!![],'where':_0x359a92[_0xc7b9('0x19')]?_0x359a92[_0xc7b9('0x19')][_0xc7b9('0x1b')]||null:null,'attributes':_0x359a92[_0xc7b9('0x19')]?_0x359a92[_0xc7b9('0x19')]['attributes']||null:null,'limit':_0x359a92[_0xc7b9('0x19')]?_0x359a92[_0xc7b9('0x19')][_0xc7b9('0x1c')]||null:null,'include':_0x359a92['options']?_0x359a92[_0xc7b9('0x19')][_0xc7b9('0x1d')]?_['map'](_0x359a92[_0xc7b9('0x19')][_0xc7b9('0x1d')],function(_0x4cb23d){return{'model':db[_0x4cb23d['model']],'as':_0x4cb23d['as'],'attributes':_0x4cb23d['attributes'],'include':_0x4cb23d[_0xc7b9('0x1d')]?_[_0xc7b9('0x1e')](_0x4cb23d[_0xc7b9('0x1d')],function(_0x5a879a){return{'model':db[_0x5a879a[_0xc7b9('0x1f')]],'as':_0x5a879a['as'],'attributes':_0x5a879a[_0xc7b9('0x20')],'include':_0x5a879a['include']?_[_0xc7b9('0x1e')](_0x5a879a['include'],function(_0x163d20){return{'model':db[_0x163d20[_0xc7b9('0x1f')]],'as':_0x163d20['as'],'attributes':_0x163d20[_0xc7b9('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e66d5){logger[_0xc7b9('0x15')]('GetTemplate',_0x359a92);logger[_0xc7b9('0xe')](_0xc7b9('0x17'),_0x359a92,JSON[_0xc7b9('0x11')](_0x5e66d5));_0x4310b2(_0x5e66d5);})['catch'](function(_0x58b57f){logger['error'](_0xc7b9('0x17'),_0x58b57f['message'],_0x359a92);_0x463837(_0x91a324[_0xc7b9('0x12')](0x1f4,_0x58b57f['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index e8f1dfa..8fb6ab6 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 _0xa7ef=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','destroy','exports'];(function(_0x193793,_0x481ddb){var _0x515439=function(_0x4f5552){while(--_0x4f5552){_0x193793['push'](_0x193793['shift']());}};_0x515439(++_0x481ddb);}(_0xa7ef,0x70));var _0xfa7e=function(_0x421053,_0x3ba306){_0x421053=_0x421053-0x0;var _0x2e9074=_0xa7ef[_0x421053];return _0x2e9074;};'use strict';var multer=require(_0xfa7e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfa7e('0x1'));var express=require(_0xfa7e('0x2'));var router=express[_0xfa7e('0x3')]();var fs_extra=require(_0xfa7e('0x4'));var auth=require(_0xfa7e('0x5'));var interaction=require(_0xfa7e('0x6'));var config=require(_0xfa7e('0x7'));var controller=require(_0xfa7e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa7e('0x9')]);router[_0xfa7e('0xa')](_0xfa7e('0xb'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0xd')]);router[_0xfa7e('0xa')](_0xfa7e('0xe'),auth['isAuthenticated'](),controller[_0xfa7e('0xf')]);router[_0xfa7e('0xa')](_0xfa7e('0x10'),auth['isAuthenticated'](),controller[_0xfa7e('0x11')]);router[_0xfa7e('0xa')](_0xfa7e('0x12'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x13')]);router[_0xfa7e('0x14')]('/',auth['isAuthenticated'](),controller[_0xfa7e('0x15')]);router[_0xfa7e('0x14')](_0xfa7e('0xe'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x16')]);router[_0xfa7e('0x14')](_0xfa7e('0x10'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x17')]);router[_0xfa7e('0x14')](_0xfa7e('0x12'),auth[_0xfa7e('0xc')](),controller['addAction']);router[_0xfa7e('0x18')]('/:id',auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x19')]);router['delete'](_0xfa7e('0xb'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x1a')]);module[_0xfa7e('0x1b')]=router; \ No newline at end of file +var _0x6a59=['update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','addAction','put','/:id'];(function(_0x2420c8,_0x59cdcc){var _0x46e13d=function(_0x1117c3){while(--_0x1117c3){_0x2420c8['push'](_0x2420c8['shift']());}};_0x46e13d(++_0x59cdcc);}(_0x6a59,0x1d6));var _0x96a5=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x6a59[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x96a5('0x0'));var util=require('util');var path=require(_0x96a5('0x1'));var timeout=require(_0x96a5('0x2'));var express=require('express');var router=express[_0x96a5('0x3')]();var fs_extra=require(_0x96a5('0x4'));var auth=require(_0x96a5('0x5'));var interaction=require(_0x96a5('0x6'));var config=require(_0x96a5('0x7'));var controller=require(_0x96a5('0x8'));router[_0x96a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x96a5('0xa')]);router[_0x96a5('0x9')]('/:id',auth[_0x96a5('0xb')](),controller[_0x96a5('0xc')]);router[_0x96a5('0x9')](_0x96a5('0xd'),auth[_0x96a5('0xb')](),controller[_0x96a5('0xe')]);router[_0x96a5('0x9')](_0x96a5('0xf'),auth[_0x96a5('0xb')](),controller[_0x96a5('0x10')]);router[_0x96a5('0x9')](_0x96a5('0x11'),auth[_0x96a5('0xb')](),controller['getActions']);router['post']('/',auth[_0x96a5('0xb')](),controller['create']);router[_0x96a5('0x12')](_0x96a5('0xd'),auth[_0x96a5('0xb')](),controller[_0x96a5('0x13')]);router['post']('/:id/any_conditions',auth[_0x96a5('0xb')](),controller[_0x96a5('0x14')]);router[_0x96a5('0x12')](_0x96a5('0x11'),auth[_0x96a5('0xb')](),controller[_0x96a5('0x15')]);router[_0x96a5('0x16')](_0x96a5('0x17'),auth['isAuthenticated'](),controller[_0x96a5('0x18')]);router['delete'](_0x96a5('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0x96a5('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 182cdb2..fc3b38b 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 _0xe9af=['exports','STRING','BOOLEAN'];(function(_0x35cb5a,_0x24f2e3){var _0x5f0c3c=function(_0x3aaab5){while(--_0x3aaab5){_0x35cb5a['push'](_0x35cb5a['shift']());}};_0x5f0c3c(++_0x24f2e3);}(_0xe9af,0x96));var _0xfe9a=function(_0x479619,_0x3a1745){_0x479619=_0x479619-0x0;var _0x4c4739=_0xe9af[_0x479619];return _0x4c4739;};'use strict';var Sequelize=require('sequelize');module[_0xfe9a('0x0')]={'name':{'type':Sequelize[_0xfe9a('0x1')]},'channel':{'type':Sequelize[_0xfe9a('0x1')]},'description':{'type':Sequelize[_0xfe9a('0x1')]},'status':{'type':Sequelize[_0xfe9a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x742e=['STRING'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x742e,0x101));var _0xe742=function(_0x11cb77,_0x12391c){_0x11cb77=_0x11cb77-0x0;var _0x2c3a18=_0x742e[_0x11cb77];return _0x2c3a18;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe742('0x0')]},'description':{'type':Sequelize[_0xe742('0x0')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 2eb6835..bff05bf 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 _0x0595=['status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','Trigger','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','filter','where','merge','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','sort','getAnyConditions','pick','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x808217,_0x1ba2b7){var _0x10572b=function(_0xa74116){while(--_0xa74116){_0x808217['push'](_0x808217['shift']());}};_0x10572b(++_0x1ba2b7);}(_0x0595,0xa8));var _0x5059=function(_0x4c9977,_0x1d1bd9){_0x4c9977=_0x4c9977-0x0;var _0xa4f67=_0x0595[_0x4c9977];return _0xa4f67;};'use strict';var emlformat=require(_0x5059('0x0'));var rimraf=require(_0x5059('0x1'));var zipdir=require(_0x5059('0x2'));var jsonpatch=require(_0x5059('0x3'));var rp=require(_0x5059('0x4'));var moment=require('moment');var BPromise=require(_0x5059('0x5'));var Mustache=require(_0x5059('0x6'));var util=require(_0x5059('0x7'));var path=require(_0x5059('0x8'));var sox=require(_0x5059('0x9'));var csv=require(_0x5059('0xa'));var ejs=require(_0x5059('0xb'));var fs=require('fs');var fs_extra=require(_0x5059('0xc'));var _=require(_0x5059('0xd'));var squel=require(_0x5059('0xe'));var crypto=require('crypto');var jsforce=require(_0x5059('0xf'));var deskjs=require(_0x5059('0x10'));var toCsv=require(_0x5059('0xa'));var querystring=require(_0x5059('0x11'));var Papa=require(_0x5059('0x12'));var Redis=require(_0x5059('0x13'));var authService=require(_0x5059('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5059('0x15'));var hardwareService=require(_0x5059('0x16'));var logger=require(_0x5059('0x17'))(_0x5059('0x18'));var utils=require(_0x5059('0x19'));var config=require(_0x5059('0x1a'));var licenseUtil=require(_0x5059('0x1b'));var db=require(_0x5059('0x1c'))['db'];function respondWithStatusCode(_0x564b61,_0x584cb4){_0x584cb4=_0x584cb4||0xcc;return function(_0x5ee487){if(_0x5ee487){return _0x564b61[_0x5059('0x1d')](_0x584cb4);}return _0x564b61[_0x5059('0x1e')](_0x584cb4)['end']();};}function respondWithResult(_0x547deb,_0x1b441a){_0x1b441a=_0x1b441a||0xc8;return function(_0x368e8e){if(_0x368e8e){return _0x547deb[_0x5059('0x1e')](_0x1b441a)[_0x5059('0x1f')](_0x368e8e);}};}function respondWithFilteredResult(_0x2e1b9d,_0x4049a2){return function(_0x2b5407){if(_0x2b5407){var _0x2ab434=typeof _0x4049a2[_0x5059('0x20')]===_0x5059('0x21')&&typeof _0x4049a2[_0x5059('0x22')]===_0x5059('0x21');var _0x3b5d45=_0x2b5407[_0x5059('0x23')];var _0x278753=_0x2ab434?0x0:_0x4049a2[_0x5059('0x20')];var _0x4d69a6=_0x2ab434?_0x2b5407[_0x5059('0x23')]:_0x4049a2[_0x5059('0x20')]+_0x4049a2[_0x5059('0x22')];var _0x33a43a;if(_0x4d69a6>=_0x3b5d45){_0x4d69a6=_0x3b5d45;_0x33a43a=0xc8;}else{_0x33a43a=0xce;}_0x2e1b9d[_0x5059('0x1e')](_0x33a43a);return _0x2e1b9d['set']('Content-Range',_0x278753+'-'+_0x4d69a6+'/'+_0x3b5d45)['json'](_0x2b5407);}return null;};}function patchUpdates(_0x50dbf8){return function(_0x5b270c){try{jsonpatch[_0x5059('0x24')](_0x5b270c,_0x50dbf8,!![]);}catch(_0x503a89){return BPromise[_0x5059('0x25')](_0x503a89);}return _0x5b270c[_0x5059('0x26')]();};}function saveUpdates(_0x26d81c,_0x35caf5){return function(_0x4974d1){if(_0x4974d1){return _0x4974d1['update'](_0x26d81c)[_0x5059('0x27')](function(_0x22713f){return _0x22713f;});}return null;};}function removeEntity(_0x304b9a,_0x187972){return function(_0x2d26e5){if(_0x2d26e5){return _0x2d26e5[_0x5059('0x28')]()[_0x5059('0x27')](function(){var _0xf83b8c=_0x2d26e5[_0x5059('0x29')]({'plain':!![]});var _0x4e780d='Triggers';return db[_0x5059('0x2a')][_0x5059('0x28')]({'where':{'type':_0x4e780d,'resourceId':_0xf83b8c['id']}})[_0x5059('0x27')](function(){return _0x2d26e5;});})[_0x5059('0x27')](function(){_0x304b9a[_0x5059('0x1e')](0xcc)[_0x5059('0x2b')]();});}};}function handleEntityNotFound(_0x4f5e07,_0x426f0a){return function(_0x24a80b){if(!_0x24a80b){_0x4f5e07['sendStatus'](0x194);}return _0x24a80b;};}function handleError(_0x3ca167,_0x12704a){_0x12704a=_0x12704a||0x1f4;return function(_0x16095d){logger['error'](_0x16095d[_0x5059('0x2c')]);if(_0x16095d[_0x5059('0x2d')]){delete _0x16095d[_0x5059('0x2d')];}_0x3ca167[_0x5059('0x1e')](_0x12704a)[_0x5059('0x2e')](_0x16095d);};}exports[_0x5059('0x2f')]=function(_0x2de75e,_0x6c9aee){var _0xe86c16={},_0xaae4f7={},_0x1b0612={'count':0x0,'rows':[]};var _0x3f3352=_[_0x5059('0x30')](db[_0x5059('0x31')][_0x5059('0x32')],function(_0x1cb9b8){return{'name':_0x1cb9b8['fieldName'],'type':_0x1cb9b8[_0x5059('0x33')][_0x5059('0x34')]};});_0xaae4f7['model']=_[_0x5059('0x30')](_0x3f3352,'name');_0xaae4f7[_0x5059('0x35')]=_[_0x5059('0x36')](_0x2de75e[_0x5059('0x35')]);_0xaae4f7[_0x5059('0x37')]=_[_0x5059('0x38')](_0xaae4f7[_0x5059('0x39')],_0xaae4f7[_0x5059('0x35')]);_0xe86c16[_0x5059('0x3a')]=_[_0x5059('0x38')](_0xaae4f7['model'],qs[_0x5059('0x3b')](_0x2de75e[_0x5059('0x35')][_0x5059('0x3b')]));_0xe86c16[_0x5059('0x3a')]=_0xe86c16[_0x5059('0x3a')][_0x5059('0x3c')]?_0xe86c16[_0x5059('0x3a')]:_0xaae4f7[_0x5059('0x39')];if(!_0x2de75e[_0x5059('0x35')][_0x5059('0x3d')](_0x5059('0x3e'))){_0xe86c16[_0x5059('0x22')]=qs[_0x5059('0x22')](_0x2de75e[_0x5059('0x35')][_0x5059('0x22')]);_0xe86c16[_0x5059('0x20')]=qs['offset'](_0x2de75e[_0x5059('0x35')][_0x5059('0x20')]);}_0xe86c16['order']=qs['sort'](_0x2de75e[_0x5059('0x35')]['sort']);_0xe86c16['where']=qs[_0x5059('0x37')](_['pick'](_0x2de75e[_0x5059('0x35')],_0xaae4f7[_0x5059('0x37')]),_0x3f3352);if(_0x2de75e[_0x5059('0x35')][_0x5059('0x3f')]){_0xe86c16[_0x5059('0x40')]=_[_0x5059('0x41')](_0xe86c16[_0x5059('0x40')],{'$or':_['map'](_0x3f3352,function(_0x5d23c3){if(_0x5d23c3[_0x5059('0x33')]!=='VIRTUAL'){var _0x11d6f1={};_0x11d6f1[_0x5d23c3[_0x5059('0x2d')]]={'$like':'%'+_0x2de75e[_0x5059('0x35')][_0x5059('0x3f')]+'%'};return _0x11d6f1;}})});}_0xe86c16=_[_0x5059('0x41')]({},_0xe86c16,_0x2de75e['options']);var _0x94f182={'where':_0xe86c16[_0x5059('0x40')]};return db['Trigger'][_0x5059('0x23')](_0x94f182)[_0x5059('0x27')](function(_0x444d9d){_0x1b0612[_0x5059('0x23')]=_0x444d9d;if(_0x2de75e[_0x5059('0x35')]['includeAll']){_0xe86c16['include']=[{'all':!![]}];}return db[_0x5059('0x31')][_0x5059('0x42')](_0xe86c16);})['then'](function(_0x486372){_0x1b0612[_0x5059('0x43')]=_0x486372;return _0x1b0612;})[_0x5059('0x27')](respondWithFilteredResult(_0x6c9aee,_0xe86c16))[_0x5059('0x44')](handleError(_0x6c9aee,null));};exports[_0x5059('0x45')]=function(_0x33f17e,_0x1166c5){var _0x4fb019={'raw':![],'where':{'id':_0x33f17e[_0x5059('0x46')]['id']}},_0x504b46={};_0x504b46[_0x5059('0x39')]=_[_0x5059('0x36')](db[_0x5059('0x31')][_0x5059('0x32')]);_0x504b46['query']=_[_0x5059('0x36')](_0x33f17e[_0x5059('0x35')]);_0x504b46['filters']=_[_0x5059('0x38')](_0x504b46[_0x5059('0x39')],_0x504b46[_0x5059('0x35')]);_0x4fb019[_0x5059('0x3a')]=_[_0x5059('0x38')](_0x504b46['model'],qs[_0x5059('0x3b')](_0x33f17e[_0x5059('0x35')][_0x5059('0x3b')]));_0x4fb019[_0x5059('0x3a')]=_0x4fb019[_0x5059('0x3a')][_0x5059('0x3c')]?_0x4fb019['attributes']:_0x504b46[_0x5059('0x39')];if(_0x33f17e['query'][_0x5059('0x47')]){_0x4fb019[_0x5059('0x48')]=[{'all':!![]}];}_0x4fb019=_['merge']({},_0x4fb019,_0x33f17e[_0x5059('0x49')]);return db['Trigger'][_0x5059('0x4a')](_0x4fb019)[_0x5059('0x27')](handleEntityNotFound(_0x1166c5,null))['then'](respondWithResult(_0x1166c5,null))[_0x5059('0x44')](handleError(_0x1166c5,null));};exports[_0x5059('0x4b')]=function(_0xb56d3b,_0x458f9b){return db[_0x5059('0x31')]['create'](_0xb56d3b[_0x5059('0x4c')],{})[_0x5059('0x27')](function(_0x30d532){var _0x397a28=_0xb56d3b[_0x5059('0x4d')][_0x5059('0x29')]({'plain':!![]});if(!_0x397a28)throw new Error(_0x5059('0x4e'));if(_0x397a28[_0x5059('0x4f')]===_0x5059('0x4d')){var _0x338b9b=_0x30d532[_0x5059('0x29')]({'plain':!![]});var _0x1af9d5=_0x5059('0x50');return db[_0x5059('0x51')][_0x5059('0x4a')]({'where':{'name':_0x1af9d5,'userProfileId':_0x397a28[_0x5059('0x52')]},'raw':!![]})[_0x5059('0x27')](function(_0x47d81f){if(_0x47d81f&&_0x47d81f[_0x5059('0x53')]===0x0){return db[_0x5059('0x2a')][_0x5059('0x4b')]({'name':_0x338b9b[_0x5059('0x2d')],'resourceId':_0x338b9b['id'],'type':_0x47d81f[_0x5059('0x2d')],'sectionId':_0x47d81f['id']},{})[_0x5059('0x27')](function(){return _0x30d532;});}else{return _0x30d532;}})['catch'](function(_0x56f2cd){logger['error'](_0x5059('0x54'),_0x56f2cd);throw _0x56f2cd;});}return _0x30d532;})[_0x5059('0x27')](respondWithResult(_0x458f9b,0xc9))['catch'](handleError(_0x458f9b,null));};exports[_0x5059('0x55')]=function(_0xf3e00,_0x3bfacf){if(_0xf3e00[_0x5059('0x4c')]['id']){delete _0xf3e00[_0x5059('0x4c')]['id'];}return db[_0x5059('0x31')][_0x5059('0x4a')]({'where':{'id':_0xf3e00['params']['id']}})[_0x5059('0x27')](handleEntityNotFound(_0x3bfacf,null))[_0x5059('0x27')](saveUpdates(_0xf3e00['body'],null))[_0x5059('0x27')](respondWithResult(_0x3bfacf,null))[_0x5059('0x44')](handleError(_0x3bfacf,null));};exports[_0x5059('0x28')]=function(_0x167040,_0x4e7f1e){return db[_0x5059('0x31')][_0x5059('0x4a')]({'where':{'id':_0x167040[_0x5059('0x46')]['id']}})[_0x5059('0x27')](handleEntityNotFound(_0x4e7f1e,null))[_0x5059('0x27')](removeEntity(_0x4e7f1e,null))[_0x5059('0x44')](handleError(_0x4e7f1e,null));};exports['addAllCondition']=function(_0x45cd9e,_0x1bac52,_0x5a4f7a){if(_0x45cd9e[_0x5059('0x4c')]['id']){delete _0x45cd9e['body']['id'];}return db[_0x5059('0x31')][_0x5059('0x4a')]({'where':{'id':_0x45cd9e[_0x5059('0x46')]['id']}})[_0x5059('0x27')](handleEntityNotFound(_0x1bac52,null))[_0x5059('0x27')](function(_0x3be4a4){if(_0x3be4a4){_0x45cd9e['body'][_0x5059('0x56')]=_0x3be4a4['id'];return db[_0x5059('0x57')]['create'](_0x45cd9e[_0x5059('0x4c')]);}})[_0x5059('0x27')](respondWithResult(_0x1bac52,null))['catch'](handleError(_0x1bac52,null));};exports[_0x5059('0x58')]=function(_0xd191bc,_0x30b18b,_0xb70e38){if(_0xd191bc['body']['id']){delete _0xd191bc[_0x5059('0x4c')]['id'];}return db[_0x5059('0x31')][_0x5059('0x4a')]({'where':{'id':_0xd191bc['params']['id']}})['then'](handleEntityNotFound(_0x30b18b,null))[_0x5059('0x27')](function(_0x5903be){if(_0x5903be){_0xd191bc[_0x5059('0x4c')][_0x5059('0x59')]=_0x5903be['id'];return db['Condition'][_0x5059('0x4b')](_0xd191bc[_0x5059('0x4c')]);}})[_0x5059('0x27')](respondWithResult(_0x30b18b,null))[_0x5059('0x44')](handleError(_0x30b18b,null));};exports[_0x5059('0x5a')]=function(_0x340823,_0xe2d0df,_0x3259b1){var _0x58fe14={};var _0x2fff08={};var _0x4da6b3;var _0x529c1f;return db[_0x5059('0x31')][_0x5059('0x5b')]({'where':{'id':_0x340823['params']['id']}})['then'](handleEntityNotFound(_0xe2d0df,null))['then'](function(_0x15c9ab){if(_0x15c9ab){_0x4da6b3=_0x15c9ab;_0x2fff08[_0x5059('0x39')]=_[_0x5059('0x36')](db[_0x5059('0x57')]['rawAttributes']);_0x2fff08[_0x5059('0x35')]=_[_0x5059('0x36')](_0x340823[_0x5059('0x35')]);_0x2fff08[_0x5059('0x37')]=_['intersection'](_0x2fff08['model'],_0x2fff08[_0x5059('0x35')]);_0x58fe14[_0x5059('0x3a')]=_['intersection'](_0x2fff08[_0x5059('0x39')],qs[_0x5059('0x3b')](_0x340823[_0x5059('0x35')][_0x5059('0x3b')]));_0x58fe14[_0x5059('0x3a')]=_0x58fe14['attributes'][_0x5059('0x3c')]?_0x58fe14[_0x5059('0x3a')]:_0x2fff08[_0x5059('0x39')];_0x58fe14['order']=qs[_0x5059('0x5c')](_0x340823[_0x5059('0x35')][_0x5059('0x5c')]);_0x58fe14[_0x5059('0x40')]=qs[_0x5059('0x37')](_['pick'](_0x340823[_0x5059('0x35')],_0x2fff08[_0x5059('0x37')]));if(_0x340823[_0x5059('0x35')][_0x5059('0x3f')]){_0x58fe14[_0x5059('0x40')]=_['merge'](_0x58fe14[_0x5059('0x40')],{'$or':_[_0x5059('0x30')](_0x58fe14[_0x5059('0x3a')],function(_0x3d4fd3){var _0xacc0ba={};_0xacc0ba[_0x3d4fd3]={'$like':'%'+_0x340823['query']['filter']+'%'};return _0xacc0ba;})});}_0x58fe14=_['merge']({},_0x58fe14,_0x340823[_0x5059('0x49')]);return _0x4da6b3[_0x5059('0x5a')](_0x58fe14);}})[_0x5059('0x27')](function(_0x210992){if(_0x210992){_0x529c1f=_0x210992['length'];if(!_0x340823[_0x5059('0x35')][_0x5059('0x3d')](_0x5059('0x3e'))){_0x58fe14[_0x5059('0x22')]=qs[_0x5059('0x22')](_0x340823[_0x5059('0x35')][_0x5059('0x22')]);_0x58fe14[_0x5059('0x20')]=qs[_0x5059('0x20')](_0x340823['query']['offset']);}return _0x4da6b3[_0x5059('0x5a')](_0x58fe14);}})['then'](function(_0x3093ea){if(_0x3093ea){return _0x3093ea?{'count':_0x529c1f,'rows':_0x3093ea}:null;}})['then'](respondWithResult(_0xe2d0df,null))[_0x5059('0x44')](handleError(_0xe2d0df,null));};exports[_0x5059('0x5d')]=function(_0x5104da,_0x3125ee,_0x2c276a){var _0x13e689={};var _0xfa58b0={};var _0x43c523;var _0x5b96ca;return db[_0x5059('0x31')][_0x5059('0x5b')]({'where':{'id':_0x5104da['params']['id']}})[_0x5059('0x27')](handleEntityNotFound(_0x3125ee,null))[_0x5059('0x27')](function(_0x26a3a8){if(_0x26a3a8){_0x43c523=_0x26a3a8;_0xfa58b0[_0x5059('0x39')]=_[_0x5059('0x36')](db[_0x5059('0x57')][_0x5059('0x32')]);_0xfa58b0['query']=_[_0x5059('0x36')](_0x5104da[_0x5059('0x35')]);_0xfa58b0[_0x5059('0x37')]=_[_0x5059('0x38')](_0xfa58b0['model'],_0xfa58b0[_0x5059('0x35')]);_0x13e689[_0x5059('0x3a')]=_[_0x5059('0x38')](_0xfa58b0[_0x5059('0x39')],qs[_0x5059('0x3b')](_0x5104da[_0x5059('0x35')][_0x5059('0x3b')]));_0x13e689['attributes']=_0x13e689[_0x5059('0x3a')][_0x5059('0x3c')]?_0x13e689[_0x5059('0x3a')]:_0xfa58b0['model'];_0x13e689['order']=qs[_0x5059('0x5c')](_0x5104da['query'][_0x5059('0x5c')]);_0x13e689[_0x5059('0x40')]=qs['filters'](_[_0x5059('0x5e')](_0x5104da[_0x5059('0x35')],_0xfa58b0[_0x5059('0x37')]));if(_0x5104da[_0x5059('0x35')][_0x5059('0x3f')]){_0x13e689['where']=_['merge'](_0x13e689[_0x5059('0x40')],{'$or':_[_0x5059('0x30')](_0x13e689[_0x5059('0x3a')],function(_0x246a16){var _0x3e383d={};_0x3e383d[_0x246a16]={'$like':'%'+_0x5104da[_0x5059('0x35')][_0x5059('0x3f')]+'%'};return _0x3e383d;})});}_0x13e689=_[_0x5059('0x41')]({},_0x13e689,_0x5104da[_0x5059('0x49')]);return _0x43c523[_0x5059('0x5d')](_0x13e689);}})[_0x5059('0x27')](function(_0x313fc2){if(_0x313fc2){_0x5b96ca=_0x313fc2[_0x5059('0x3c')];if(!_0x5104da[_0x5059('0x35')][_0x5059('0x3d')]('nolimit')){_0x13e689[_0x5059('0x22')]=qs[_0x5059('0x22')](_0x5104da[_0x5059('0x35')][_0x5059('0x22')]);_0x13e689['offset']=qs[_0x5059('0x20')](_0x5104da['query']['offset']);}return _0x43c523[_0x5059('0x5d')](_0x13e689);}})[_0x5059('0x27')](function(_0x115e68){if(_0x115e68){return _0x115e68?{'count':_0x5b96ca,'rows':_0x115e68}:null;}})[_0x5059('0x27')](respondWithResult(_0x3125ee,null))[_0x5059('0x44')](handleError(_0x3125ee,null));};exports[_0x5059('0x5f')]=function(_0x1e0a21,_0xb2b364,_0x428283){if(_0x1e0a21[_0x5059('0x4c')]['id']){delete _0x1e0a21[_0x5059('0x4c')]['id'];}return db[_0x5059('0x31')]['find']({'where':{'id':_0x1e0a21['params']['id']}})[_0x5059('0x27')](handleEntityNotFound(_0xb2b364,null))[_0x5059('0x27')](function(_0xfb1982){if(_0xfb1982){_0x1e0a21[_0x5059('0x4c')][_0x5059('0x60')]=_0xfb1982['id'];return db[_0x5059('0x61')][_0x5059('0x4b')](_0x1e0a21['body']);}})[_0x5059('0x27')](respondWithResult(_0xb2b364,null))[_0x5059('0x44')](handleError(_0xb2b364,null));};exports[_0x5059('0x62')]=function(_0x2cf1be,_0x2a3335,_0x321e46){var _0x3af8b9={};var _0x4c8b76={};var _0x50de1a;var _0xecab3f;return db[_0x5059('0x31')][_0x5059('0x5b')]({'where':{'id':_0x2cf1be['params']['id']}})['then'](handleEntityNotFound(_0x2a3335,null))[_0x5059('0x27')](function(_0x58a1da){if(_0x58a1da){_0x50de1a=_0x58a1da;_0x4c8b76['model']=_['keys'](db[_0x5059('0x61')][_0x5059('0x32')]);_0x4c8b76['query']=_[_0x5059('0x36')](_0x2cf1be['query']);_0x4c8b76[_0x5059('0x37')]=_['intersection'](_0x4c8b76[_0x5059('0x39')],_0x4c8b76[_0x5059('0x35')]);_0x3af8b9[_0x5059('0x3a')]=_[_0x5059('0x38')](_0x4c8b76[_0x5059('0x39')],qs[_0x5059('0x3b')](_0x2cf1be[_0x5059('0x35')][_0x5059('0x3b')]));_0x3af8b9[_0x5059('0x3a')]=_0x3af8b9[_0x5059('0x3a')][_0x5059('0x3c')]?_0x3af8b9[_0x5059('0x3a')]:_0x4c8b76['model'];_0x3af8b9['order']=qs[_0x5059('0x5c')](_0x2cf1be[_0x5059('0x35')]['sort']);_0x3af8b9[_0x5059('0x40')]=qs[_0x5059('0x37')](_[_0x5059('0x5e')](_0x2cf1be[_0x5059('0x35')],_0x4c8b76[_0x5059('0x37')]));if(_0x2cf1be['query']['filter']){_0x3af8b9[_0x5059('0x40')]=_[_0x5059('0x41')](_0x3af8b9[_0x5059('0x40')],{'$or':_['map'](_0x3af8b9[_0x5059('0x3a')],function(_0x4b8c2a){var _0x383984={};_0x383984[_0x4b8c2a]={'$like':'%'+_0x2cf1be['query'][_0x5059('0x3f')]+'%'};return _0x383984;})});}_0x3af8b9=_['merge']({},_0x3af8b9,_0x2cf1be['options']);return _0x50de1a[_0x5059('0x62')](_0x3af8b9);}})[_0x5059('0x27')](function(_0x41b03b){if(_0x41b03b){_0xecab3f=_0x41b03b[_0x5059('0x3c')];if(!_0x2cf1be[_0x5059('0x35')]['hasOwnProperty']('nolimit')){_0x3af8b9[_0x5059('0x22')]=qs[_0x5059('0x22')](_0x2cf1be[_0x5059('0x35')][_0x5059('0x22')]);_0x3af8b9[_0x5059('0x20')]=qs[_0x5059('0x20')](_0x2cf1be['query']['offset']);}return _0x50de1a[_0x5059('0x62')](_0x3af8b9);}})[_0x5059('0x27')](function(_0x363e8b){if(_0x363e8b){return _0x363e8b?{'count':_0xecab3f,'rows':_0x363e8b}:null;}})['then'](respondWithResult(_0x2a3335,null))[_0x5059('0x44')](handleError(_0x2a3335,null));}; \ No newline at end of file +var _0x2a7f=['sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','Triggers','UserProfileResource','destroy','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','length','include','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','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','order','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5da899,_0x38345e){var _0x540da7=function(_0x3c0e42){while(--_0x3c0e42){_0x5da899['push'](_0x5da899['shift']());}};_0x540da7(++_0x38345e);}(_0x2a7f,0xb1));var _0xf2a7=function(_0x286b9e,_0x46a607){_0x286b9e=_0x286b9e-0x0;var _0x525987=_0x2a7f[_0x286b9e];return _0x525987;};'use strict';var emlformat=require(_0xf2a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2a7('0x1'));var jsonpatch=require(_0xf2a7('0x2'));var rp=require(_0xf2a7('0x3'));var moment=require(_0xf2a7('0x4'));var BPromise=require(_0xf2a7('0x5'));var Mustache=require(_0xf2a7('0x6'));var util=require(_0xf2a7('0x7'));var path=require('path');var sox=require(_0xf2a7('0x8'));var csv=require(_0xf2a7('0x9'));var ejs=require(_0xf2a7('0xa'));var fs=require('fs');var fs_extra=require(_0xf2a7('0xb'));var _=require(_0xf2a7('0xc'));var squel=require(_0xf2a7('0xd'));var crypto=require(_0xf2a7('0xe'));var jsforce=require(_0xf2a7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf2a7('0x9'));var querystring=require(_0xf2a7('0x10'));var Papa=require(_0xf2a7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf2a7('0x12'));var as=require(_0xf2a7('0x13'));var hardwareService=require(_0xf2a7('0x14'));var logger=require(_0xf2a7('0x15'))(_0xf2a7('0x16'));var utils=require(_0xf2a7('0x17'));var config=require(_0xf2a7('0x18'));var licenseUtil=require(_0xf2a7('0x19'));var db=require(_0xf2a7('0x1a'))['db'];function respondWithStatusCode(_0x594b9c,_0x54260b){_0x54260b=_0x54260b||0xcc;return function(_0x4c64d6){if(_0x4c64d6){return _0x594b9c[_0xf2a7('0x1b')](_0x54260b);}return _0x594b9c[_0xf2a7('0x1c')](_0x54260b)[_0xf2a7('0x1d')]();};}function respondWithResult(_0x76ac49,_0x6b695f){_0x6b695f=_0x6b695f||0xc8;return function(_0x2ea028){if(_0x2ea028){return _0x76ac49[_0xf2a7('0x1c')](_0x6b695f)[_0xf2a7('0x1e')](_0x2ea028);}};}function respondWithFilteredResult(_0x4cc797,_0x4b4f24){return function(_0x28b58c){if(_0x28b58c){var _0x19bbe9=typeof _0x4b4f24['offset']===_0xf2a7('0x1f')&&typeof _0x4b4f24[_0xf2a7('0x20')]==='undefined';var _0x1f69f6=_0x28b58c[_0xf2a7('0x21')];var _0x4aa8a6=_0x19bbe9?0x0:_0x4b4f24['offset'];var _0x1f23d5=_0x19bbe9?_0x28b58c['count']:_0x4b4f24[_0xf2a7('0x22')]+_0x4b4f24[_0xf2a7('0x20')];var _0xc1d1f;if(_0x1f23d5>=_0x1f69f6){_0x1f23d5=_0x1f69f6;_0xc1d1f=0xc8;}else{_0xc1d1f=0xce;}_0x4cc797[_0xf2a7('0x1c')](_0xc1d1f);return _0x4cc797[_0xf2a7('0x23')](_0xf2a7('0x24'),_0x4aa8a6+'-'+_0x1f23d5+'/'+_0x1f69f6)['json'](_0x28b58c);}return null;};}function patchUpdates(_0xacbbcd){return function(_0x5b3f3a){try{jsonpatch[_0xf2a7('0x25')](_0x5b3f3a,_0xacbbcd,!![]);}catch(_0x3c0980){return BPromise[_0xf2a7('0x26')](_0x3c0980);}return _0x5b3f3a[_0xf2a7('0x27')]();};}function saveUpdates(_0x597dc9,_0xfaf73a){return function(_0xd37cf2){if(_0xd37cf2){return _0xd37cf2['update'](_0x597dc9)[_0xf2a7('0x28')](function(_0x14bb3a){return _0x14bb3a;});}return null;};}function removeEntity(_0xe76839,_0x48aa45){return function(_0x4b4752){if(_0x4b4752){return _0x4b4752['destroy']()[_0xf2a7('0x28')](function(){var _0x3d4398=_0x4b4752[_0xf2a7('0x29')]({'plain':!![]});var _0x28c90c=_0xf2a7('0x2a');return db[_0xf2a7('0x2b')][_0xf2a7('0x2c')]({'where':{'type':_0x28c90c,'resourceId':_0x3d4398['id']}})[_0xf2a7('0x28')](function(){return _0x4b4752;});})[_0xf2a7('0x28')](function(){_0xe76839[_0xf2a7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cfe42,_0x3d4fca){return function(_0x202c17){if(!_0x202c17){_0x1cfe42[_0xf2a7('0x1b')](0x194);}return _0x202c17;};}function handleError(_0x10f9d3,_0x3ce617){_0x3ce617=_0x3ce617||0x1f4;return function(_0x18a448){logger['error'](_0x18a448[_0xf2a7('0x2d')]);if(_0x18a448[_0xf2a7('0x2e')]){delete _0x18a448[_0xf2a7('0x2e')];}_0x10f9d3[_0xf2a7('0x1c')](_0x3ce617)[_0xf2a7('0x2f')](_0x18a448);};}exports[_0xf2a7('0x30')]=function(_0xe3a7f2,_0x514963){var _0x541634={},_0x3d2837={},_0x1a0ba0={'count':0x0,'rows':[]};var _0x11d698=_[_0xf2a7('0x31')](db[_0xf2a7('0x32')][_0xf2a7('0x33')],function(_0x68202d){return{'name':_0x68202d[_0xf2a7('0x34')],'type':_0x68202d[_0xf2a7('0x35')][_0xf2a7('0x36')]};});_0x3d2837['model']=_[_0xf2a7('0x31')](_0x11d698,'name');_0x3d2837[_0xf2a7('0x37')]=_[_0xf2a7('0x38')](_0xe3a7f2[_0xf2a7('0x37')]);_0x3d2837[_0xf2a7('0x39')]=_[_0xf2a7('0x3a')](_0x3d2837[_0xf2a7('0x3b')],_0x3d2837[_0xf2a7('0x37')]);_0x541634[_0xf2a7('0x3c')]=_[_0xf2a7('0x3a')](_0x3d2837[_0xf2a7('0x3b')],qs[_0xf2a7('0x3d')](_0xe3a7f2['query']['fields']));_0x541634[_0xf2a7('0x3c')]=_0x541634[_0xf2a7('0x3c')]['length']?_0x541634[_0xf2a7('0x3c')]:_0x3d2837[_0xf2a7('0x3b')];if(!_0xe3a7f2[_0xf2a7('0x37')]['hasOwnProperty'](_0xf2a7('0x3e'))){_0x541634[_0xf2a7('0x20')]=qs[_0xf2a7('0x20')](_0xe3a7f2['query'][_0xf2a7('0x20')]);_0x541634['offset']=qs[_0xf2a7('0x22')](_0xe3a7f2[_0xf2a7('0x37')]['offset']);}_0x541634['order']=qs[_0xf2a7('0x3f')](_0xe3a7f2['query']['sort']);_0x541634[_0xf2a7('0x40')]=qs[_0xf2a7('0x39')](_[_0xf2a7('0x41')](_0xe3a7f2['query'],_0x3d2837[_0xf2a7('0x39')]),_0x11d698);if(_0xe3a7f2[_0xf2a7('0x37')][_0xf2a7('0x42')]){_0x541634['where']=_[_0xf2a7('0x43')](_0x541634[_0xf2a7('0x40')],{'$or':_[_0xf2a7('0x31')](_0x11d698,function(_0x1544aa){if(_0x1544aa[_0xf2a7('0x35')]!==_0xf2a7('0x44')){var _0x344f99={};_0x344f99[_0x1544aa[_0xf2a7('0x2e')]]={'$like':'%'+_0xe3a7f2[_0xf2a7('0x37')]['filter']+'%'};return _0x344f99;}})});}_0x541634=_['merge']({},_0x541634,_0xe3a7f2[_0xf2a7('0x45')]);var _0x56a151={'where':_0x541634['where']};return db[_0xf2a7('0x32')][_0xf2a7('0x21')](_0x56a151)[_0xf2a7('0x28')](function(_0x13a901){_0x1a0ba0['count']=_0x13a901;if(_0xe3a7f2[_0xf2a7('0x37')]['includeAll']){_0x541634['include']=[{'all':!![]}];}return db[_0xf2a7('0x32')][_0xf2a7('0x46')](_0x541634);})[_0xf2a7('0x28')](function(_0x52690b){_0x1a0ba0[_0xf2a7('0x47')]=_0x52690b;return _0x1a0ba0;})[_0xf2a7('0x28')](respondWithFilteredResult(_0x514963,_0x541634))[_0xf2a7('0x48')](handleError(_0x514963,null));};exports[_0xf2a7('0x49')]=function(_0x2ec62a,_0x3a508c){var _0x25e1ad={'raw':![],'where':{'id':_0x2ec62a['params']['id']}},_0x4c603a={};_0x4c603a[_0xf2a7('0x3b')]=_[_0xf2a7('0x38')](db['Trigger'][_0xf2a7('0x33')]);_0x4c603a['query']=_[_0xf2a7('0x38')](_0x2ec62a['query']);_0x4c603a['filters']=_[_0xf2a7('0x3a')](_0x4c603a[_0xf2a7('0x3b')],_0x4c603a[_0xf2a7('0x37')]);_0x25e1ad[_0xf2a7('0x3c')]=_[_0xf2a7('0x3a')](_0x4c603a[_0xf2a7('0x3b')],qs[_0xf2a7('0x3d')](_0x2ec62a[_0xf2a7('0x37')][_0xf2a7('0x3d')]));_0x25e1ad['attributes']=_0x25e1ad[_0xf2a7('0x3c')][_0xf2a7('0x4a')]?_0x25e1ad[_0xf2a7('0x3c')]:_0x4c603a['model'];if(_0x2ec62a[_0xf2a7('0x37')]['includeAll']){_0x25e1ad[_0xf2a7('0x4b')]=[{'all':!![]}];}_0x25e1ad=_[_0xf2a7('0x43')]({},_0x25e1ad,_0x2ec62a[_0xf2a7('0x45')]);return db[_0xf2a7('0x32')][_0xf2a7('0x4c')](_0x25e1ad)['then'](handleEntityNotFound(_0x3a508c,null))['then'](respondWithResult(_0x3a508c,null))[_0xf2a7('0x48')](handleError(_0x3a508c,null));};exports[_0xf2a7('0x4d')]=function(_0x1a66fd,_0x1c5cd2){return db[_0xf2a7('0x32')]['create'](_0x1a66fd[_0xf2a7('0x4e')],{})['then'](function(_0x2d8003){var _0x1377b3=_0x1a66fd[_0xf2a7('0x4f')][_0xf2a7('0x29')]({'plain':!![]});if(!_0x1377b3)throw new Error(_0xf2a7('0x50'));if(_0x1377b3[_0xf2a7('0x51')]==='user'){var _0x1d805a=_0x2d8003['get']({'plain':!![]});var _0x1ee16d='Triggers';return db[_0xf2a7('0x52')][_0xf2a7('0x4c')]({'where':{'name':_0x1ee16d,'userProfileId':_0x1377b3[_0xf2a7('0x53')]},'raw':!![]})[_0xf2a7('0x28')](function(_0xd23503){if(_0xd23503&&_0xd23503[_0xf2a7('0x54')]===0x0){return db['UserProfileResource'][_0xf2a7('0x4d')]({'name':_0x1d805a[_0xf2a7('0x2e')],'resourceId':_0x1d805a['id'],'type':_0xd23503[_0xf2a7('0x2e')],'sectionId':_0xd23503['id']},{})[_0xf2a7('0x28')](function(){return _0x2d8003;});}else{return _0x2d8003;}})[_0xf2a7('0x48')](function(_0x56f9e4){logger[_0xf2a7('0x55')](_0xf2a7('0x56'),_0x56f9e4);throw _0x56f9e4;});}return _0x2d8003;})[_0xf2a7('0x28')](respondWithResult(_0x1c5cd2,0xc9))['catch'](handleError(_0x1c5cd2,null));};exports[_0xf2a7('0x57')]=function(_0x1bb6a5,_0x33be69){if(_0x1bb6a5[_0xf2a7('0x4e')]['id']){delete _0x1bb6a5[_0xf2a7('0x4e')]['id'];}return db['Trigger'][_0xf2a7('0x4c')]({'where':{'id':_0x1bb6a5[_0xf2a7('0x58')]['id']}})[_0xf2a7('0x28')](handleEntityNotFound(_0x33be69,null))['then'](saveUpdates(_0x1bb6a5[_0xf2a7('0x4e')],null))['then'](respondWithResult(_0x33be69,null))[_0xf2a7('0x48')](handleError(_0x33be69,null));};exports[_0xf2a7('0x2c')]=function(_0x1b9757,_0xba4858){return db[_0xf2a7('0x32')][_0xf2a7('0x4c')]({'where':{'id':_0x1b9757[_0xf2a7('0x58')]['id']}})[_0xf2a7('0x28')](handleEntityNotFound(_0xba4858,null))[_0xf2a7('0x28')](removeEntity(_0xba4858,null))[_0xf2a7('0x48')](handleError(_0xba4858,null));};exports[_0xf2a7('0x59')]=function(_0x270a58,_0x23ba05,_0x55dd56){if(_0x270a58[_0xf2a7('0x4e')]['id']){delete _0x270a58['body']['id'];}return db[_0xf2a7('0x32')][_0xf2a7('0x4c')]({'where':{'id':_0x270a58[_0xf2a7('0x58')]['id']}})[_0xf2a7('0x28')](handleEntityNotFound(_0x23ba05,null))[_0xf2a7('0x28')](function(_0x33d1ca){if(_0x33d1ca){_0x270a58[_0xf2a7('0x4e')][_0xf2a7('0x5a')]=_0x33d1ca['id'];return db[_0xf2a7('0x5b')]['create'](_0x270a58[_0xf2a7('0x4e')]);}})[_0xf2a7('0x28')](respondWithResult(_0x23ba05,null))[_0xf2a7('0x48')](handleError(_0x23ba05,null));};exports[_0xf2a7('0x5c')]=function(_0x42324d,_0x11f6f1,_0x49d019){if(_0x42324d[_0xf2a7('0x4e')]['id']){delete _0x42324d['body']['id'];}return db[_0xf2a7('0x32')]['find']({'where':{'id':_0x42324d[_0xf2a7('0x58')]['id']}})[_0xf2a7('0x28')](handleEntityNotFound(_0x11f6f1,null))[_0xf2a7('0x28')](function(_0x4a432b){if(_0x4a432b){_0x42324d['body']['TriggerAnyId']=_0x4a432b['id'];return db[_0xf2a7('0x5b')][_0xf2a7('0x4d')](_0x42324d[_0xf2a7('0x4e')]);}})[_0xf2a7('0x28')](respondWithResult(_0x11f6f1,null))[_0xf2a7('0x48')](handleError(_0x11f6f1,null));};exports[_0xf2a7('0x5d')]=function(_0x17d622,_0x27ddaa,_0x314070){var _0xa8067d={};var _0x372053={};var _0x43b5f6;var _0x1428b0;return db['Trigger'][_0xf2a7('0x5e')]({'where':{'id':_0x17d622[_0xf2a7('0x58')]['id']}})[_0xf2a7('0x28')](handleEntityNotFound(_0x27ddaa,null))[_0xf2a7('0x28')](function(_0x58c20f){if(_0x58c20f){_0x43b5f6=_0x58c20f;_0x372053[_0xf2a7('0x3b')]=_[_0xf2a7('0x38')](db[_0xf2a7('0x5b')][_0xf2a7('0x33')]);_0x372053[_0xf2a7('0x37')]=_[_0xf2a7('0x38')](_0x17d622['query']);_0x372053['filters']=_['intersection'](_0x372053[_0xf2a7('0x3b')],_0x372053['query']);_0xa8067d[_0xf2a7('0x3c')]=_[_0xf2a7('0x3a')](_0x372053[_0xf2a7('0x3b')],qs[_0xf2a7('0x3d')](_0x17d622[_0xf2a7('0x37')][_0xf2a7('0x3d')]));_0xa8067d[_0xf2a7('0x3c')]=_0xa8067d[_0xf2a7('0x3c')][_0xf2a7('0x4a')]?_0xa8067d[_0xf2a7('0x3c')]:_0x372053[_0xf2a7('0x3b')];_0xa8067d[_0xf2a7('0x5f')]=qs[_0xf2a7('0x3f')](_0x17d622['query'][_0xf2a7('0x3f')]);_0xa8067d[_0xf2a7('0x40')]=qs[_0xf2a7('0x39')](_[_0xf2a7('0x41')](_0x17d622[_0xf2a7('0x37')],_0x372053['filters']));if(_0x17d622['query'][_0xf2a7('0x42')]){_0xa8067d[_0xf2a7('0x40')]=_[_0xf2a7('0x43')](_0xa8067d[_0xf2a7('0x40')],{'$or':_['map'](_0xa8067d[_0xf2a7('0x3c')],function(_0x137784){var _0x1af0d0={};_0x1af0d0[_0x137784]={'$like':'%'+_0x17d622[_0xf2a7('0x37')][_0xf2a7('0x42')]+'%'};return _0x1af0d0;})});}_0xa8067d=_[_0xf2a7('0x43')]({},_0xa8067d,_0x17d622[_0xf2a7('0x45')]);return _0x43b5f6[_0xf2a7('0x5d')](_0xa8067d);}})[_0xf2a7('0x28')](function(_0x2c3cbf){if(_0x2c3cbf){_0x1428b0=_0x2c3cbf[_0xf2a7('0x4a')];if(!_0x17d622['query']['hasOwnProperty'](_0xf2a7('0x3e'))){_0xa8067d[_0xf2a7('0x20')]=qs[_0xf2a7('0x20')](_0x17d622['query'][_0xf2a7('0x20')]);_0xa8067d[_0xf2a7('0x22')]=qs[_0xf2a7('0x22')](_0x17d622['query'][_0xf2a7('0x22')]);}return _0x43b5f6['getAllConditions'](_0xa8067d);}})[_0xf2a7('0x28')](function(_0x5211dd){if(_0x5211dd){return _0x5211dd?{'count':_0x1428b0,'rows':_0x5211dd}:null;}})[_0xf2a7('0x28')](respondWithResult(_0x27ddaa,null))['catch'](handleError(_0x27ddaa,null));};exports[_0xf2a7('0x60')]=function(_0x2e0885,_0xfc3f06,_0x4d4ca7){var _0x43e7e4={};var _0x3dbe05={};var _0x5435dd;var _0x40f36d;return db[_0xf2a7('0x32')][_0xf2a7('0x5e')]({'where':{'id':_0x2e0885[_0xf2a7('0x58')]['id']}})[_0xf2a7('0x28')](handleEntityNotFound(_0xfc3f06,null))[_0xf2a7('0x28')](function(_0xd59318){if(_0xd59318){_0x5435dd=_0xd59318;_0x3dbe05['model']=_[_0xf2a7('0x38')](db['Condition'][_0xf2a7('0x33')]);_0x3dbe05[_0xf2a7('0x37')]=_[_0xf2a7('0x38')](_0x2e0885[_0xf2a7('0x37')]);_0x3dbe05['filters']=_['intersection'](_0x3dbe05[_0xf2a7('0x3b')],_0x3dbe05[_0xf2a7('0x37')]);_0x43e7e4[_0xf2a7('0x3c')]=_[_0xf2a7('0x3a')](_0x3dbe05[_0xf2a7('0x3b')],qs[_0xf2a7('0x3d')](_0x2e0885[_0xf2a7('0x37')]['fields']));_0x43e7e4[_0xf2a7('0x3c')]=_0x43e7e4['attributes'][_0xf2a7('0x4a')]?_0x43e7e4[_0xf2a7('0x3c')]:_0x3dbe05['model'];_0x43e7e4['order']=qs[_0xf2a7('0x3f')](_0x2e0885['query'][_0xf2a7('0x3f')]);_0x43e7e4[_0xf2a7('0x40')]=qs[_0xf2a7('0x39')](_[_0xf2a7('0x41')](_0x2e0885[_0xf2a7('0x37')],_0x3dbe05['filters']));if(_0x2e0885[_0xf2a7('0x37')]['filter']){_0x43e7e4[_0xf2a7('0x40')]=_[_0xf2a7('0x43')](_0x43e7e4[_0xf2a7('0x40')],{'$or':_['map'](_0x43e7e4[_0xf2a7('0x3c')],function(_0x5581da){var _0x42183e={};_0x42183e[_0x5581da]={'$like':'%'+_0x2e0885['query']['filter']+'%'};return _0x42183e;})});}_0x43e7e4=_[_0xf2a7('0x43')]({},_0x43e7e4,_0x2e0885['options']);return _0x5435dd[_0xf2a7('0x60')](_0x43e7e4);}})[_0xf2a7('0x28')](function(_0x1d5a27){if(_0x1d5a27){_0x40f36d=_0x1d5a27[_0xf2a7('0x4a')];if(!_0x2e0885[_0xf2a7('0x37')][_0xf2a7('0x61')](_0xf2a7('0x3e'))){_0x43e7e4['limit']=qs['limit'](_0x2e0885[_0xf2a7('0x37')]['limit']);_0x43e7e4[_0xf2a7('0x22')]=qs[_0xf2a7('0x22')](_0x2e0885[_0xf2a7('0x37')][_0xf2a7('0x22')]);}return _0x5435dd[_0xf2a7('0x60')](_0x43e7e4);}})[_0xf2a7('0x28')](function(_0x197f40){if(_0x197f40){return _0x197f40?{'count':_0x40f36d,'rows':_0x197f40}:null;}})[_0xf2a7('0x28')](respondWithResult(_0xfc3f06,null))['catch'](handleError(_0xfc3f06,null));};exports[_0xf2a7('0x62')]=function(_0x469ae1,_0x294e6e,_0x2dc613){if(_0x469ae1[_0xf2a7('0x4e')]['id']){delete _0x469ae1[_0xf2a7('0x4e')]['id'];}return db[_0xf2a7('0x32')][_0xf2a7('0x4c')]({'where':{'id':_0x469ae1[_0xf2a7('0x58')]['id']}})[_0xf2a7('0x28')](handleEntityNotFound(_0x294e6e,null))[_0xf2a7('0x28')](function(_0x432e00){if(_0x432e00){_0x469ae1[_0xf2a7('0x4e')][_0xf2a7('0x63')]=_0x432e00['id'];return db[_0xf2a7('0x64')][_0xf2a7('0x4d')](_0x469ae1[_0xf2a7('0x4e')]);}})[_0xf2a7('0x28')](respondWithResult(_0x294e6e,null))[_0xf2a7('0x48')](handleError(_0x294e6e,null));};exports[_0xf2a7('0x65')]=function(_0x17007c,_0x483076,_0x3ce6a5){var _0x5ae05e={};var _0x277f1c={};var _0x38b2d0;var _0x1dd2b7;return db[_0xf2a7('0x32')][_0xf2a7('0x5e')]({'where':{'id':_0x17007c[_0xf2a7('0x58')]['id']}})[_0xf2a7('0x28')](handleEntityNotFound(_0x483076,null))[_0xf2a7('0x28')](function(_0x3761dc){if(_0x3761dc){_0x38b2d0=_0x3761dc;_0x277f1c['model']=_[_0xf2a7('0x38')](db[_0xf2a7('0x64')][_0xf2a7('0x33')]);_0x277f1c['query']=_['keys'](_0x17007c[_0xf2a7('0x37')]);_0x277f1c[_0xf2a7('0x39')]=_[_0xf2a7('0x3a')](_0x277f1c['model'],_0x277f1c['query']);_0x5ae05e[_0xf2a7('0x3c')]=_[_0xf2a7('0x3a')](_0x277f1c[_0xf2a7('0x3b')],qs[_0xf2a7('0x3d')](_0x17007c[_0xf2a7('0x37')]['fields']));_0x5ae05e[_0xf2a7('0x3c')]=_0x5ae05e['attributes']['length']?_0x5ae05e['attributes']:_0x277f1c[_0xf2a7('0x3b')];_0x5ae05e['order']=qs['sort'](_0x17007c[_0xf2a7('0x37')][_0xf2a7('0x3f')]);_0x5ae05e[_0xf2a7('0x40')]=qs['filters'](_[_0xf2a7('0x41')](_0x17007c[_0xf2a7('0x37')],_0x277f1c['filters']));if(_0x17007c[_0xf2a7('0x37')][_0xf2a7('0x42')]){_0x5ae05e[_0xf2a7('0x40')]=_[_0xf2a7('0x43')](_0x5ae05e[_0xf2a7('0x40')],{'$or':_['map'](_0x5ae05e[_0xf2a7('0x3c')],function(_0xaf0d06){var _0x1ce42a={};_0x1ce42a[_0xaf0d06]={'$like':'%'+_0x17007c['query']['filter']+'%'};return _0x1ce42a;})});}_0x5ae05e=_['merge']({},_0x5ae05e,_0x17007c[_0xf2a7('0x45')]);return _0x38b2d0[_0xf2a7('0x65')](_0x5ae05e);}})['then'](function(_0x3e140a){if(_0x3e140a){_0x1dd2b7=_0x3e140a[_0xf2a7('0x4a')];if(!_0x17007c['query']['hasOwnProperty'](_0xf2a7('0x3e'))){_0x5ae05e['limit']=qs['limit'](_0x17007c[_0xf2a7('0x37')]['limit']);_0x5ae05e[_0xf2a7('0x22')]=qs['offset'](_0x17007c[_0xf2a7('0x37')][_0xf2a7('0x22')]);}return _0x38b2d0['getActions'](_0x5ae05e);}})['then'](function(_0x44ce9b){if(_0x44ce9b){return _0x44ce9b?{'count':_0x1dd2b7,'rows':_0x44ce9b}:null;}})[_0xf2a7('0x28')](respondWithResult(_0x483076,null))[_0xf2a7('0x48')](handleError(_0x483076,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f60081a..4e55c95 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 _0x851e=['../../config/environment','exports','define','Trigger','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3f7719,_0x1eea58){var _0x3abde7=function(_0x532112){while(--_0x532112){_0x3f7719['push'](_0x3f7719['shift']());}};_0x3abde7(++_0x1eea58);}(_0x851e,0x1e8));var _0xe851=function(_0x581332,_0x588a7b){_0x581332=_0x581332-0x0;var _0xfa58b4=_0x851e[_0x581332];return _0xfa58b4;};'use strict';var _=require(_0xe851('0x0'));var util=require(_0xe851('0x1'));var logger=require(_0xe851('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe851('0x3'));var rp=require(_0xe851('0x4'));var fs=require('fs');var path=require(_0xe851('0x5'));var rimraf=require(_0xe851('0x6'));var config=require(_0xe851('0x7'));var attributes=require('./trigger.attributes');module[_0xe851('0x8')]=function(_0x2b36b5,_0xba0648){return _0x2b36b5[_0xe851('0x9')](_0xe851('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9aee=['path','rimraf','Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x16ba14,_0x32cf07){var _0x23ef39=function(_0x160e0c){while(--_0x160e0c){_0x16ba14['push'](_0x16ba14['shift']());}};_0x23ef39(++_0x32cf07);}(_0x9aee,0x71));var _0xe9ae=function(_0x547a9b,_0x516541){_0x547a9b=_0x547a9b-0x0;var _0x323654=_0x9aee[_0x547a9b];return _0x323654;};'use strict';var _=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var logger=require(_0xe9ae('0x2'))(_0xe9ae('0x3'));var moment=require(_0xe9ae('0x4'));var BPromise=require(_0xe9ae('0x5'));var rp=require(_0xe9ae('0x6'));var fs=require('fs');var path=require(_0xe9ae('0x7'));var rimraf=require(_0xe9ae('0x8'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module['exports']=function(_0xf3aa52,_0x4e889d){return _0xf3aa52['define'](_0xe9ae('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 921a68c..31b93d2 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 _0x2e26=['http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','include','map','model','then','ShowTrigger','find','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3468b1,_0x3d2e68){var _0x6b808b=function(_0x367d76){while(--_0x367d76){_0x3468b1['push'](_0x3468b1['shift']());}};_0x6b808b(++_0x3d2e68);}(_0x2e26,0x16d));var _0x62e2=function(_0x3cad1a,_0x4a92c5){_0x3cad1a=_0x3cad1a-0x0;var _0x4b768d=_0x2e26[_0x3cad1a];return _0x4b768d;};'use strict';var _=require(_0x62e2('0x0'));var util=require(_0x62e2('0x1'));var moment=require(_0x62e2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62e2('0x3'));var db=require(_0x62e2('0x4'))['db'];var utils=require(_0x62e2('0x5'));var logger=require(_0x62e2('0x6'))(_0x62e2('0x7'));var config=require(_0x62e2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x62e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fcd5e,_0x2b95e6,_0x2282cf){return new BPromise(function(_0x3d8ec4,_0x347356){return client[_0x62e2('0xa')](_0x4fcd5e,_0x2282cf)['then'](function(_0x427139){logger[_0x62e2('0xb')](_0x62e2('0xc'),_0x2b95e6,_0x62e2('0xd'));logger[_0x62e2('0xe')](_0x62e2('0xf'),_0x2b95e6,_0x62e2('0xd'),JSON[_0x62e2('0x10')](_0x427139));if(_0x427139[_0x62e2('0x11')]){if(_0x427139[_0x62e2('0x11')]['code']===0x1f4){logger[_0x62e2('0x11')]('Trigger,\x20%s,\x20%s',_0x2b95e6,_0x427139[_0x62e2('0x11')][_0x62e2('0x12')]);return _0x347356(_0x427139[_0x62e2('0x11')][_0x62e2('0x12')]);}logger[_0x62e2('0x11')](_0x62e2('0xc'),_0x2b95e6,_0x427139[_0x62e2('0x11')][_0x62e2('0x12')]);return _0x3d8ec4(_0x427139['error'][_0x62e2('0x12')]);}else{logger[_0x62e2('0xb')]('Trigger,\x20%s,\x20%s',_0x2b95e6,_0x62e2('0xd'));_0x3d8ec4(_0x427139[_0x62e2('0x13')][_0x62e2('0x12')]);}})[_0x62e2('0x14')](function(_0x4e7dc2){logger[_0x62e2('0x11')](_0x62e2('0xc'),_0x2b95e6,_0x4e7dc2);_0x347356(_0x4e7dc2);});});}exports[_0x62e2('0x15')]=function(_0xa30b59){var _0x360363=this;return new Promise(function(_0x544985,_0x586326){return db[_0x62e2('0x16')][_0x62e2('0x17')]({'raw':_0xa30b59[_0x62e2('0x18')]?_0xa30b59[_0x62e2('0x18')][_0x62e2('0x19')]===undefined?!![]:![]:!![],'where':_0xa30b59[_0x62e2('0x18')]?_0xa30b59[_0x62e2('0x18')]['where']||null:null,'attributes':_0xa30b59[_0x62e2('0x18')]?_0xa30b59['options'][_0x62e2('0x1a')]||null:null,'limit':_0xa30b59[_0x62e2('0x18')]?_0xa30b59['options']['limit']||null:null,'include':_0xa30b59['options']?_0xa30b59[_0x62e2('0x18')][_0x62e2('0x1b')]?_[_0x62e2('0x1c')](_0xa30b59[_0x62e2('0x18')][_0x62e2('0x1b')],function(_0x5c06dc){return{'model':db[_0x5c06dc[_0x62e2('0x1d')]],'as':_0x5c06dc['as'],'attributes':_0x5c06dc[_0x62e2('0x1a')],'include':_0x5c06dc[_0x62e2('0x1b')]?_['map'](_0x5c06dc[_0x62e2('0x1b')],function(_0x58efc5){return{'model':db[_0x58efc5[_0x62e2('0x1d')]],'as':_0x58efc5['as'],'attributes':_0x58efc5[_0x62e2('0x1a')],'include':_0x58efc5['include']?_[_0x62e2('0x1c')](_0x58efc5[_0x62e2('0x1b')],function(_0x44e994){return{'model':db[_0x44e994[_0x62e2('0x1d')]],'as':_0x44e994['as'],'attributes':_0x44e994[_0x62e2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x62e2('0x1e')](function(_0x53b2af){logger[_0x62e2('0xb')](_0x62e2('0x15'),_0xa30b59);logger[_0x62e2('0xe')]('GetTrigger',_0xa30b59,JSON[_0x62e2('0x10')](_0x53b2af));_0x544985(_0x53b2af);})[_0x62e2('0x14')](function(_0x235842){logger['error']('GetTrigger',_0x235842['message'],_0xa30b59);_0x586326(_0x360363[_0x62e2('0x11')](0x1f4,_0x235842[_0x62e2('0x12')]));});});};exports[_0x62e2('0x1f')]=function(_0x227dc0){var _0x300552=this;return new Promise(function(_0x41544e,_0x356768){return db[_0x62e2('0x16')][_0x62e2('0x20')]({'raw':_0x227dc0['options']?_0x227dc0['options'][_0x62e2('0x19')]===undefined?!![]:![]:!![],'where':_0x227dc0[_0x62e2('0x18')]?_0x227dc0['options'][_0x62e2('0x21')]||null:null,'attributes':_0x227dc0['options']?_0x227dc0[_0x62e2('0x18')][_0x62e2('0x1a')]||null:null,'include':_0x227dc0[_0x62e2('0x18')]?_0x227dc0[_0x62e2('0x18')]['include']?_[_0x62e2('0x1c')](_0x227dc0['options']['include'],function(_0x152bd6){return{'model':db[_0x152bd6[_0x62e2('0x1d')]],'as':_0x152bd6['as'],'attributes':_0x152bd6['attributes'],'include':_0x152bd6[_0x62e2('0x1b')]?_[_0x62e2('0x1c')](_0x152bd6[_0x62e2('0x1b')],function(_0x135780){return{'model':db[_0x135780[_0x62e2('0x1d')]],'as':_0x135780['as'],'attributes':_0x135780[_0x62e2('0x1a')],'include':_0x135780[_0x62e2('0x1b')]?_[_0x62e2('0x1c')](_0x135780[_0x62e2('0x1b')],function(_0x21877e){return{'model':db[_0x21877e[_0x62e2('0x1d')]],'as':_0x21877e['as'],'attributes':_0x21877e['attributes']};}):[]};}):[]};}):[]:[]})[_0x62e2('0x1e')](function(_0x103b7a){logger[_0x62e2('0xb')](_0x62e2('0x1f'),_0x227dc0);logger['debug'](_0x62e2('0x1f'),_0x227dc0,JSON[_0x62e2('0x10')](_0x103b7a));_0x41544e(_0x103b7a);})[_0x62e2('0x14')](function(_0x93999a){logger['error'](_0x62e2('0x1f'),_0x93999a[_0x62e2('0x12')],_0x227dc0);_0x356768(_0x300552['error'](0x1f4,_0x93999a[_0x62e2('0x12')]));});});}; \ No newline at end of file +var _0x5cb3=['options','raw','include','map','attributes','model','catch','ShowTrigger','find','where','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger'];(function(_0x4dc3db,_0x41fd64){var _0x1db0f9=function(_0x39ec3f){while(--_0x39ec3f){_0x4dc3db['push'](_0x4dc3db['shift']());}};_0x1db0f9(++_0x41fd64);}(_0x5cb3,0x112));var _0x35cb=function(_0x2ec00a,_0x23412a){_0x2ec00a=_0x2ec00a-0x0;var _0x27b616=_0x5cb3[_0x2ec00a];return _0x27b616;};'use strict';var _=require('lodash');var util=require(_0x35cb('0x0'));var moment=require(_0x35cb('0x1'));var BPromise=require('bluebird');var rs=require(_0x35cb('0x2'));var fs=require('fs');var Redis=require(_0x35cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x35cb('0x4'))(_0x35cb('0x5'));var config=require(_0x35cb('0x6'));var jayson=require(_0x35cb('0x7'));var client=jayson[_0x35cb('0x8')][_0x35cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b19,_0x4baf7a,_0x2e5183){return new BPromise(function(_0x153d43,_0xc71605){return client[_0x35cb('0xa')](_0x2f0b19,_0x2e5183)[_0x35cb('0xb')](function(_0x1576d2){logger['info']('Trigger,\x20%s,\x20%s',_0x4baf7a,_0x35cb('0xc'));logger[_0x35cb('0xd')](_0x35cb('0xe'),_0x4baf7a,_0x35cb('0xc'),JSON[_0x35cb('0xf')](_0x1576d2));if(_0x1576d2['error']){if(_0x1576d2[_0x35cb('0x10')][_0x35cb('0x11')]===0x1f4){logger[_0x35cb('0x10')](_0x35cb('0x12'),_0x4baf7a,_0x1576d2['error']['message']);return _0xc71605(_0x1576d2[_0x35cb('0x10')][_0x35cb('0x13')]);}logger[_0x35cb('0x10')](_0x35cb('0x12'),_0x4baf7a,_0x1576d2[_0x35cb('0x10')][_0x35cb('0x13')]);return _0x153d43(_0x1576d2[_0x35cb('0x10')][_0x35cb('0x13')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x4baf7a,'request\x20sent');_0x153d43(_0x1576d2[_0x35cb('0x14')]['message']);}})['catch'](function(_0x4661f7){logger[_0x35cb('0x10')](_0x35cb('0x12'),_0x4baf7a,_0x4661f7);_0xc71605(_0x4661f7);});});}exports[_0x35cb('0x15')]=function(_0x125b70){var _0x4b008c=this;return new Promise(function(_0x464f12,_0x5950e0){return db[_0x35cb('0x16')]['findAll']({'raw':_0x125b70['options']?_0x125b70[_0x35cb('0x17')][_0x35cb('0x18')]===undefined?!![]:![]:!![],'where':_0x125b70[_0x35cb('0x17')]?_0x125b70['options']['where']||null:null,'attributes':_0x125b70['options']?_0x125b70[_0x35cb('0x17')]['attributes']||null:null,'limit':_0x125b70['options']?_0x125b70[_0x35cb('0x17')]['limit']||null:null,'include':_0x125b70[_0x35cb('0x17')]?_0x125b70[_0x35cb('0x17')][_0x35cb('0x19')]?_[_0x35cb('0x1a')](_0x125b70[_0x35cb('0x17')][_0x35cb('0x19')],function(_0x2fd32b){return{'model':db[_0x2fd32b['model']],'as':_0x2fd32b['as'],'attributes':_0x2fd32b[_0x35cb('0x1b')],'include':_0x2fd32b['include']?_[_0x35cb('0x1a')](_0x2fd32b[_0x35cb('0x19')],function(_0x395a95){return{'model':db[_0x395a95[_0x35cb('0x1c')]],'as':_0x395a95['as'],'attributes':_0x395a95[_0x35cb('0x1b')],'include':_0x395a95['include']?_[_0x35cb('0x1a')](_0x395a95[_0x35cb('0x19')],function(_0xcd88ed){return{'model':db[_0xcd88ed[_0x35cb('0x1c')]],'as':_0xcd88ed['as'],'attributes':_0xcd88ed[_0x35cb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x35cb('0xb')](function(_0x2bb05b){logger['info'](_0x35cb('0x15'),_0x125b70);logger[_0x35cb('0xd')](_0x35cb('0x15'),_0x125b70,JSON['stringify'](_0x2bb05b));_0x464f12(_0x2bb05b);})[_0x35cb('0x1d')](function(_0x548a86){logger[_0x35cb('0x10')](_0x35cb('0x15'),_0x548a86[_0x35cb('0x13')],_0x125b70);_0x5950e0(_0x4b008c['error'](0x1f4,_0x548a86[_0x35cb('0x13')]));});});};exports[_0x35cb('0x1e')]=function(_0x65c611){var _0x212b33=this;return new Promise(function(_0x427e2f,_0x3a6dfa){return db[_0x35cb('0x16')][_0x35cb('0x1f')]({'raw':_0x65c611[_0x35cb('0x17')]?_0x65c611[_0x35cb('0x17')][_0x35cb('0x18')]===undefined?!![]:![]:!![],'where':_0x65c611[_0x35cb('0x17')]?_0x65c611[_0x35cb('0x17')][_0x35cb('0x20')]||null:null,'attributes':_0x65c611[_0x35cb('0x17')]?_0x65c611[_0x35cb('0x17')]['attributes']||null:null,'include':_0x65c611['options']?_0x65c611['options'][_0x35cb('0x19')]?_[_0x35cb('0x1a')](_0x65c611[_0x35cb('0x17')][_0x35cb('0x19')],function(_0x25b055){return{'model':db[_0x25b055[_0x35cb('0x1c')]],'as':_0x25b055['as'],'attributes':_0x25b055[_0x35cb('0x1b')],'include':_0x25b055[_0x35cb('0x19')]?_[_0x35cb('0x1a')](_0x25b055['include'],function(_0xf372fa){return{'model':db[_0xf372fa[_0x35cb('0x1c')]],'as':_0xf372fa['as'],'attributes':_0xf372fa[_0x35cb('0x1b')],'include':_0xf372fa[_0x35cb('0x19')]?_[_0x35cb('0x1a')](_0xf372fa[_0x35cb('0x19')],function(_0x4685de){return{'model':db[_0x4685de['model']],'as':_0x4685de['as'],'attributes':_0x4685de['attributes']};}):[]};}):[]};}):[]:[]})[_0x35cb('0xb')](function(_0x2d5ebd){logger['info'](_0x35cb('0x1e'),_0x65c611);logger[_0x35cb('0xd')](_0x35cb('0x1e'),_0x65c611,JSON['stringify'](_0x2d5ebd));_0x427e2f(_0x2d5ebd);})['catch'](function(_0x12042f){logger[_0x35cb('0x10')](_0x35cb('0x1e'),_0x12042f[_0x35cb('0x13')],_0x65c611);_0x3a6dfa(_0x212b33[_0x35cb('0x10')](0x1f4,_0x12042f[_0x35cb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a179dba..18c4302 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 _0x44fd=['clone','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone'];(function(_0x35b87c,_0x3cd9c0){var _0x5dcd54=function(_0x1d3ac4){while(--_0x1d3ac4){_0x35b87c['push'](_0x35b87c['shift']());}};_0x5dcd54(++_0x3cd9c0);}(_0x44fd,0x1d0));var _0xd44f=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0x44fd[_0x32d414];return _0x4e0bca;};'use strict';var multer=require(_0xd44f('0x0'));var util=require(_0xd44f('0x1'));var path=require(_0xd44f('0x2'));var timeout=require(_0xd44f('0x3'));var express=require(_0xd44f('0x4'));var router=express['Router']();var fs_extra=require(_0xd44f('0x5'));var auth=require(_0xd44f('0x6'));var interaction=require(_0xd44f('0x7'));var config=require(_0xd44f('0x8'));var controller=require(_0xd44f('0x9'));router[_0xd44f('0xa')]('/',auth[_0xd44f('0xb')](),controller[_0xd44f('0xc')]);router[_0xd44f('0xa')](_0xd44f('0xd'),auth[_0xd44f('0xb')](),controller['show']);router[_0xd44f('0xe')](_0xd44f('0xf'),auth['isAuthenticated'](),controller[_0xd44f('0x10')]);router[_0xd44f('0xe')]('/',auth[_0xd44f('0xb')](),controller['create']);router['put'](_0xd44f('0xd'),auth['isAuthenticated'](),controller[_0xd44f('0x11')]);router[_0xd44f('0x12')]('/:id',auth[_0xd44f('0xb')](),controller['destroy']);module[_0xd44f('0x13')]=router; \ No newline at end of file +var _0xde6f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','clone','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0xde6f,0x176));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfde6('0x0'));var util=require(_0xfde6('0x1'));var path=require(_0xfde6('0x2'));var timeout=require('connect-timeout');var express=require(_0xfde6('0x3'));var router=express[_0xfde6('0x4')]();var fs_extra=require(_0xfde6('0x5'));var auth=require(_0xfde6('0x6'));var interaction=require(_0xfde6('0x7'));var config=require(_0xfde6('0x8'));var controller=require('./trunk.controller');router[_0xfde6('0x9')]('/',auth[_0xfde6('0xa')](),controller['index']);router[_0xfde6('0x9')](_0xfde6('0xb'),auth[_0xfde6('0xa')](),controller[_0xfde6('0xc')]);router['post']('/:id/clone',auth[_0xfde6('0xa')](),controller[_0xfde6('0xd')]);router[_0xfde6('0xe')]('/',auth['isAuthenticated'](),controller[_0xfde6('0xf')]);router[_0xfde6('0x10')](_0xfde6('0xb'),auth[_0xfde6('0xa')](),controller[_0xfde6('0x11')]);router[_0xfde6('0x12')](_0xfde6('0xb'),auth['isAuthenticated'](),controller[_0xfde6('0x13')]);module[_0xfde6('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c2a71d5..705bf22 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 _0xb6d9=['dynamic','update,nonat','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass'];(function(_0x385fd3,_0x3680b6){var _0x27c543=function(_0x3610cc){while(--_0x3610cc){_0x385fd3['push'](_0x385fd3['shift']());}};_0x27c543(++_0x3680b6);}(_0xb6d9,0x6d));var _0x9b6d=function(_0x4425de,_0x282802){_0x4425de=_0x4425de-0x0;var _0x129c1f=_0xb6d9[_0x4425de];return _0x129c1f;};'use strict';var Sequelize=require('sequelize');module[_0x9b6d('0x0')]={'name':{'type':Sequelize[_0x9b6d('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x3'),_0x9b6d('0x4'),_0x9b6d('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x9b6d('0x1')],'allowNull':![],'defaultValue':_0x9b6d('0x6')},'callingpres':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x7'),_0x9b6d('0x8'),_0x9b6d('0x9'),'ALLOWED',_0x9b6d('0xa'),'PROHIB_PASSED_SCREEN',_0x9b6d('0xb'),_0x9b6d('0xc'))},'deny':{'type':Sequelize[_0x9b6d('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x9b6d('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x9b6d('0x1')],'defaultValue':_0x9b6d('0xd'),'set':function(_0x220d2f){this[_0x9b6d('0xe')](_0x9b6d('0xf'),_0x220d2f?_0x220d2f[_0x9b6d('0x10')](','):null);},'get':function(){return this[_0x9b6d('0x11')](_0x9b6d('0xf'))?this[_0x9b6d('0x11')]('transport')[_0x9b6d('0x12')](','):null;},'comment':_0x9b6d('0x13')},'dtmfmode':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x14'),_0x9b6d('0x15'),_0x9b6d('0x16'),_0x9b6d('0x17'),_0x9b6d('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no','nonat',_0x9b6d('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9b6d('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9b6d('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x9b6d('0x1b'),'set':function(_0x53545f){this[_0x9b6d('0xe')](_0x9b6d('0x1c'),_0x53545f?_0x53545f[_0x9b6d('0x10')](','):null);},'get':function(){return this[_0x9b6d('0x11')](_0x9b6d('0x1c'))?this[_0x9b6d('0x11')](_0x9b6d('0x1c'))[_0x9b6d('0x12')](','):null;},'comment':_0x9b6d('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9b6d('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9b6d('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9b6d('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9b6d('0x1')],'defaultValue':_0x9b6d('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4b4d30){this['setDataValue'](_0x9b6d('0x1f'),_0x4b4d30?_0x4b4d30[_0x9b6d('0x10')](';'):_0x9b6d('0x20'));},'get':function(){return this[_0x9b6d('0x11')](_0x9b6d('0x1f'))?this[_0x9b6d('0x11')](_0x9b6d('0x1f'))['split'](';'):null;},'comment':_0x9b6d('0x21')},'autoframing':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'insecure':{'type':Sequelize[_0x9b6d('0x1')],'defaultValue':_0x9b6d('0x22'),'set':function(_0xd61589){this[_0x9b6d('0xe')]('insecure',_0xd61589?_0xd61589[_0x9b6d('0x10')](','):null);},'get':function(){return this[_0x9b6d('0x11')]('insecure')?this[_0x9b6d('0x11')](_0x9b6d('0x23'))[_0x9b6d('0x12')](','):null;},'comment':_0x9b6d('0x24')},'trustrpid':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no',_0x9b6d('0x25'))},'promiscredir':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x9b6d('0x1')]},'callerid':{'type':Sequelize[_0x9b6d('0x1')],'defaultValue':_0x9b6d('0x26')},'amaflags':{'type':Sequelize[_0x9b6d('0x1')]},'callcounter':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no'),'defaultValue':_0x9b6d('0x19')},'busylevel':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x9b6d('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x9b6d('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x9b6d('0x1')]},'videosupport':{'type':Sequelize[_0x9b6d('0x2')]('yes','no',_0x9b6d('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x29'),_0x9b6d('0x2a'),_0x9b6d('0x2b'))},'session_expires':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x9b6d('0x2')]('uac',_0x9b6d('0x2c')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x9b6d('0x1')]},'regexten':{'type':Sequelize[_0x9b6d('0x1')]},'fromdomain':{'type':Sequelize[_0x9b6d('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x9b6d('0x27')](0x5)},'qualify':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no'),'defaultValue':_0x9b6d('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x9b6d('0x1')]},'defaultuser':{'type':Sequelize[_0x9b6d('0x1')]},'rtptimeout':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x9b6d('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9b6d('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'timerb':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x9b6d('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x9b6d('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x9b6d('0x1')]},'use_q850_reason':{'type':Sequelize[_0x9b6d('0x1')]},'maxforwards':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'encryption':{'type':Sequelize[_0x9b6d('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'force_avp':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'icesupport':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no',_0x9b6d('0x2d'),_0x9b6d('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x9b6d('0x27')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x9b6d('0x1')]},'dtlscipher':{'type':Sequelize[_0x9b6d('0x1')]},'dtlscafile':{'type':Sequelize[_0x9b6d('0x1')]},'dtlscapath':{'type':Sequelize[_0x9b6d('0x1')]},'dtlssetup':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x2f'),_0x9b6d('0x30'),_0x9b6d('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9b6d('0x1')]},'usereqphone':{'type':Sequelize[_0x9b6d('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9b6d('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x9b6d('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x9b6d('0x19'),'no')},'vmexten':{'type':Sequelize[_0x9b6d('0x1')]},'mohinterpret':{'type':Sequelize[_0x9b6d('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x9b6d('0x1')]},'description':{'type':Sequelize[_0x9b6d('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x9b6d('0x32')},'canreinvite':{'type':Sequelize[_0x9b6d('0x2')](_0x9b6d('0x19'),'no','nonat',_0x9b6d('0x1a'),_0x9b6d('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x9b6d('0x1')]},'active':{'type':Sequelize[_0x9b6d('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9b6d('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc8b3=['ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','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]','\x22\x22\x20<>','always','accept','refuse','originate','INTEGER','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update','update,nonat','BOOLEAN','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x4c8fd1,_0x406a8a){var _0x3a09dd=function(_0x5549bc){while(--_0x5549bc){_0x4c8fd1['push'](_0x4c8fd1['shift']());}};_0x3a09dd(++_0x406a8a);}(_0xc8b3,0x1dc));var _0x3c8b=function(_0x56d970,_0x42c6e6){_0x56d970=_0x56d970-0x0;var _0x9180e6=_0xc8b3[_0x56d970];return _0x9180e6;};'use strict';var Sequelize=require('sequelize');module[_0x3c8b('0x0')]={'name':{'type':Sequelize[_0x3c8b('0x1')],'allowNull':![],'unique':_0x3c8b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x3c8b('0x3'),_0x3c8b('0x4'),_0x3c8b('0x5')),'allowNull':![],'defaultValue':_0x3c8b('0x3')},'context':{'type':Sequelize[_0x3c8b('0x1')],'allowNull':![],'defaultValue':_0x3c8b('0x6')},'callingpres':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x8'),_0x3c8b('0x9'),_0x3c8b('0xa'),'ALLOWED',_0x3c8b('0xb'),_0x3c8b('0xc'),'PROHIB_FAILED_SCREEN',_0x3c8b('0xd'))},'deny':{'type':Sequelize[_0x3c8b('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x3c8b('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x3c8b('0x1')],'defaultValue':_0x3c8b('0xe'),'set':function(_0x11a807){this[_0x3c8b('0xf')](_0x3c8b('0x10'),_0x11a807?_0x11a807[_0x3c8b('0x11')](','):null);},'get':function(){return this[_0x3c8b('0x12')](_0x3c8b('0x10'))?this[_0x3c8b('0x12')](_0x3c8b('0x10'))['split'](','):null;},'comment':_0x3c8b('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x3c8b('0x14'),_0x3c8b('0x15'),_0x3c8b('0x16'),_0x3c8b('0x17'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no',_0x3c8b('0x19'),'update',_0x3c8b('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3c8b('0x1')]},'directmediadeny':{'type':Sequelize[_0x3c8b('0x1')]},'nat':{'type':Sequelize[_0x3c8b('0x1')],'defaultValue':'force_rport,comedia','set':function(_0xfc7ab2){this['setDataValue'](_0x3c8b('0x1b'),_0xfc7ab2?_0xfc7ab2[_0x3c8b('0x11')](','):null);},'get':function(){return this[_0x3c8b('0x12')](_0x3c8b('0x1b'))?this[_0x3c8b('0x12')](_0x3c8b('0x1b'))['split'](','):null;},'comment':_0x3c8b('0x1c')},'callgroup':{'type':Sequelize[_0x3c8b('0x1')]},'namedcallgroup':{'type':Sequelize[_0x3c8b('0x1')]},'pickupgroup':{'type':Sequelize[_0x3c8b('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x3c8b('0x1')]},'language':{'type':Sequelize[_0x3c8b('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x3c8b('0x1d')},'allow':{'type':Sequelize[_0x3c8b('0x1')],'allowNull':![],'defaultValue':_0x3c8b('0x1e'),'set':function(_0x5c960c){this['setDataValue']('allow',_0x5c960c?_0x5c960c['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x3c8b('0x1f'))?this[_0x3c8b('0x12')]('allow')[_0x3c8b('0x20')](';'):null;},'comment':_0x3c8b('0x21')},'autoframing':{'type':Sequelize[_0x3c8b('0x7')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x3c8b('0x22'),'set':function(_0x19e475){this[_0x3c8b('0xf')](_0x3c8b('0x23'),_0x19e475?_0x19e475[_0x3c8b('0x11')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x3c8b('0x12')](_0x3c8b('0x23'))[_0x3c8b('0x20')](','):null;},'comment':_0x3c8b('0x24')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3c8b('0x7')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0x3c8b('0x7')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x3c8b('0x1')]},'callerid':{'type':Sequelize[_0x3c8b('0x1')],'defaultValue':_0x3c8b('0x25')},'amaflags':{'type':Sequelize[_0x3c8b('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no'),'defaultValue':_0x3c8b('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x3c8b('0x1')]},'template':{'type':Sequelize[_0x3c8b('0x1')]},'videosupport':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no',_0x3c8b('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no')},'mailbox':{'type':Sequelize[_0x3c8b('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x3c8b('0x27'),_0x3c8b('0x28'),_0x3c8b('0x29'))},'session_expires':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'session_minse':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'session_refresher':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x2b'),_0x3c8b('0x2c')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3c8b('0x1')]},'regexten':{'type':Sequelize[_0x3c8b('0x1')]},'fromdomain':{'type':Sequelize[_0x3c8b('0x1')]},'fromuser':{'type':Sequelize[_0x3c8b('0x1')]},'port':{'type':Sequelize[_0x3c8b('0x2a')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no'),'defaultValue':_0x3c8b('0x18')},'keepalive':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x3c8b('0x1')]},'rtptimeout':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no',_0x3c8b('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x3c8b('0x1')]},'contactacl':{'type':Sequelize[_0x3c8b('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x3c8b('0x1')]},'use_q850_reason':{'type':Sequelize[_0x3c8b('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x3c8b('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x3c8b('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no',_0x3c8b('0x2e'),_0x3c8b('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x3c8b('0x2a')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3c8b('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x3c8b('0x1')]},'dtlscafile':{'type':Sequelize[_0x3c8b('0x1')]},'dtlscapath':{'type':Sequelize[_0x3c8b('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3c8b('0x30'),_0x3c8b('0x31'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3c8b('0x1')]},'usereqphone':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x3c8b('0x1')]},'call_limit':{'type':Sequelize[_0x3c8b('0x2a')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3c8b('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x3c8b('0x7')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x3c8b('0x1')]},'parkinglot':{'type':Sequelize[_0x3c8b('0x1')]},'description':{'type':Sequelize[_0x3c8b('0x1')]},'host':{'type':Sequelize[_0x3c8b('0x1')],'defaultValue':_0x3c8b('0x32')},'canreinvite':{'type':Sequelize[_0x3c8b('0x7')](_0x3c8b('0x18'),'no',_0x3c8b('0x19'),_0x3c8b('0x33'),_0x3c8b('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3c8b('0x1')]},'otherFields':{'type':Sequelize[_0x3c8b('0x1')]},'active':{'type':Sequelize[_0x3c8b('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3c8b('0x1')],'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 48ea567..019abaf 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 _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x2c6bad,_0x29ffed){var _0x5f5435=function(_0x23f89b){while(--_0x23f89b){_0x2c6bad['push'](_0x2c6bad['shift']());}};_0x5f5435(++_0x29ffed);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1ae70c,_0x39d916){_0x1ae70c=_0x1ae70c-0x0;var _0x44e2f0=_0x9bde[_0x1ae70c];return _0x44e2f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file +var _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x517d7a,_0xad7160){var _0x149269=function(_0x1d2a87){while(--_0x1d2a87){_0x517d7a['push'](_0x517d7a['shift']());}};_0x149269(++_0xad7160);}(_0x6aa7,0x178));var _0x76aa=function(_0x1ef8b7,_0x788452){_0x1ef8b7=_0x1ef8b7-0x0;var _0xde938=_0x6aa7[_0x1ef8b7];return _0xde938;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b4a1967..4007482 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 _0x4c77=['../../config/environment','./trunk.attributes','define','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x35d830,_0x1cc01f){var _0x23d5f9=function(_0xc60863){while(--_0xc60863){_0x35d830['push'](_0x35d830['shift']());}};_0x23d5f9(++_0x1cc01f);}(_0x4c77,0x150));var _0x74c7=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4c77[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x74c7('0x0'));var logger=require(_0x74c7('0x1'))(_0x74c7('0x2'));var moment=require('moment');var BPromise=require(_0x74c7('0x3'));var rp=require(_0x74c7('0x4'));var fs=require('fs');var path=require(_0x74c7('0x5'));var rimraf=require('rimraf');var config=require(_0x74c7('0x6'));var attributes=require(_0x74c7('0x7'));module['exports']=function(_0x29f588,_0x2e817a){return _0x29f588[_0x74c7('0x8')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfbb=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4a7f17,_0x4106a4){var _0x59e8d9=function(_0x4adfa1){while(--_0x4adfa1){_0x4a7f17['push'](_0x4a7f17['shift']());}};_0x59e8d9(++_0x4106a4);}(_0xdfbb,0xe9));var _0xbdfb=function(_0x4b2526,_0x28ae5b){_0x4b2526=_0x4b2526-0x0;var _0x9e2e7c=_0xdfbb[_0x4b2526];return _0x9e2e7c;};'use strict';var _=require(_0xbdfb('0x0'));var util=require('util');var logger=require(_0xbdfb('0x1'))(_0xbdfb('0x2'));var moment=require(_0xbdfb('0x3'));var BPromise=require(_0xbdfb('0x4'));var rp=require(_0xbdfb('0x5'));var fs=require('fs');var path=require(_0xbdfb('0x6'));var rimraf=require(_0xbdfb('0x7'));var config=require(_0xbdfb('0x8'));var attributes=require(_0xbdfb('0x9'));module[_0xbdfb('0xa')]=function(_0x4f0f00,_0x5b86fe){return _0x4f0f00[_0xbdfb('0xb')](_0xbdfb('0xc'),attributes,{'tableName':_0xbdfb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 58693f5..3ac54c4 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 _0x9ecf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','options','raw','attributes','limit','include','map','model','stringify','find','where','then','ShowTrunk','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x56752d,_0x23ec6e){var _0x3a9ef3=function(_0x511f38){while(--_0x511f38){_0x56752d['push'](_0x56752d['shift']());}};_0x3a9ef3(++_0x23ec6e);}(_0x9ecf,0xc7));var _0xf9ec=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x9ecf[_0x470e67];return _0x28bbde;};'use strict';var _=require(_0xf9ec('0x0'));var util=require(_0xf9ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf9ec('0x2'));var fs=require('fs');var Redis=require(_0xf9ec('0x3'));var db=require(_0xf9ec('0x4'))['db'];var utils=require(_0xf9ec('0x5'));var logger=require(_0xf9ec('0x6'))(_0xf9ec('0x7'));var config=require(_0xf9ec('0x8'));var jayson=require(_0xf9ec('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7cee65,_0x39954d,_0x551817){return new BPromise(function(_0x197944,_0x153f7a){return client[_0xf9ec('0xa')](_0x7cee65,_0x551817)['then'](function(_0x28c945){logger[_0xf9ec('0xb')]('Trunk,\x20%s,\x20%s',_0x39954d,_0xf9ec('0xc'));logger[_0xf9ec('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x39954d,'request\x20sent',JSON['stringify'](_0x28c945));if(_0x28c945['error']){if(_0x28c945[_0xf9ec('0xe')][_0xf9ec('0xf')]===0x1f4){logger[_0xf9ec('0xe')](_0xf9ec('0x10'),_0x39954d,_0x28c945[_0xf9ec('0xe')][_0xf9ec('0x11')]);return _0x153f7a(_0x28c945[_0xf9ec('0xe')][_0xf9ec('0x11')]);}logger[_0xf9ec('0xe')]('Trunk,\x20%s,\x20%s',_0x39954d,_0x28c945[_0xf9ec('0xe')][_0xf9ec('0x11')]);return _0x197944(_0x28c945[_0xf9ec('0xe')]['message']);}else{logger[_0xf9ec('0xb')](_0xf9ec('0x10'),_0x39954d,_0xf9ec('0xc'));_0x197944(_0x28c945[_0xf9ec('0x12')][_0xf9ec('0x11')]);}})[_0xf9ec('0x13')](function(_0x28dd02){logger[_0xf9ec('0xe')]('Trunk,\x20%s,\x20%s',_0x39954d,_0x28dd02);_0x153f7a(_0x28dd02);});});}exports[_0xf9ec('0x14')]=function(_0x2f9044){var _0x3afab6=this;return new Promise(function(_0x2bef93,_0x3f7afb){return db[_0xf9ec('0x15')]['findAll']({'raw':_0x2f9044[_0xf9ec('0x16')]?_0x2f9044[_0xf9ec('0x16')][_0xf9ec('0x17')]===undefined?!![]:![]:!![],'where':_0x2f9044[_0xf9ec('0x16')]?_0x2f9044[_0xf9ec('0x16')]['where']||null:null,'attributes':_0x2f9044[_0xf9ec('0x16')]?_0x2f9044['options'][_0xf9ec('0x18')]||null:null,'limit':_0x2f9044[_0xf9ec('0x16')]?_0x2f9044[_0xf9ec('0x16')][_0xf9ec('0x19')]||null:null,'include':_0x2f9044[_0xf9ec('0x16')]?_0x2f9044[_0xf9ec('0x16')][_0xf9ec('0x1a')]?_[_0xf9ec('0x1b')](_0x2f9044['options'][_0xf9ec('0x1a')],function(_0x4e88e4){return{'model':db[_0x4e88e4['model']],'as':_0x4e88e4['as'],'attributes':_0x4e88e4[_0xf9ec('0x18')],'include':_0x4e88e4[_0xf9ec('0x1a')]?_[_0xf9ec('0x1b')](_0x4e88e4['include'],function(_0x503524){return{'model':db[_0x503524[_0xf9ec('0x1c')]],'as':_0x503524['as'],'attributes':_0x503524[_0xf9ec('0x18')],'include':_0x503524['include']?_[_0xf9ec('0x1b')](_0x503524[_0xf9ec('0x1a')],function(_0x53e7f6){return{'model':db[_0x53e7f6[_0xf9ec('0x1c')]],'as':_0x53e7f6['as'],'attributes':_0x53e7f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39295c){logger[_0xf9ec('0xb')](_0xf9ec('0x14'),_0x2f9044);logger[_0xf9ec('0xd')](_0xf9ec('0x14'),_0x2f9044,JSON[_0xf9ec('0x1d')](_0x39295c));_0x2bef93(_0x39295c);})[_0xf9ec('0x13')](function(_0x427b36){logger[_0xf9ec('0xe')]('GetTrunk',_0x427b36['message'],_0x2f9044);_0x3f7afb(_0x3afab6['error'](0x1f4,_0x427b36[_0xf9ec('0x11')]));});});};exports['ShowTrunk']=function(_0x4d92c0){var _0x288290=this;return new Promise(function(_0x4403b8,_0x5520de){return db[_0xf9ec('0x15')][_0xf9ec('0x1e')]({'raw':_0x4d92c0['options']?_0x4d92c0['options'][_0xf9ec('0x17')]===undefined?!![]:![]:!![],'where':_0x4d92c0[_0xf9ec('0x16')]?_0x4d92c0[_0xf9ec('0x16')][_0xf9ec('0x1f')]||null:null,'attributes':_0x4d92c0[_0xf9ec('0x16')]?_0x4d92c0['options'][_0xf9ec('0x18')]||null:null,'include':_0x4d92c0[_0xf9ec('0x16')]?_0x4d92c0[_0xf9ec('0x16')][_0xf9ec('0x1a')]?_['map'](_0x4d92c0['options'][_0xf9ec('0x1a')],function(_0x56fadc){return{'model':db[_0x56fadc['model']],'as':_0x56fadc['as'],'attributes':_0x56fadc[_0xf9ec('0x18')],'include':_0x56fadc['include']?_[_0xf9ec('0x1b')](_0x56fadc[_0xf9ec('0x1a')],function(_0x52e5ad){return{'model':db[_0x52e5ad[_0xf9ec('0x1c')]],'as':_0x52e5ad['as'],'attributes':_0x52e5ad['attributes'],'include':_0x52e5ad['include']?_[_0xf9ec('0x1b')](_0x52e5ad[_0xf9ec('0x1a')],function(_0x1f5720){return{'model':db[_0x1f5720[_0xf9ec('0x1c')]],'as':_0x1f5720['as'],'attributes':_0x1f5720[_0xf9ec('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf9ec('0x20')](function(_0x1583b9){logger[_0xf9ec('0xb')]('ShowTrunk',_0x4d92c0);logger['debug'](_0xf9ec('0x21'),_0x4d92c0,JSON[_0xf9ec('0x1d')](_0x1583b9));_0x4403b8(_0x1583b9);})[_0xf9ec('0x13')](function(_0x4a7ff6){logger[_0xf9ec('0xe')](_0xf9ec('0x21'),_0x4a7ff6[_0xf9ec('0x11')],_0x4d92c0);_0x5520de(_0x288290[_0xf9ec('0xe')](0x1f4,_0x4a7ff6[_0xf9ec('0x11')]));});});}; \ No newline at end of file +var _0x6da6=['limit','map','include','model','ShowTrunk','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x6da6,0x9a));var _0x66da=function(_0x22850f,_0x4a0371){_0x22850f=_0x22850f-0x0;var _0x4f6117=_0x6da6[_0x22850f];return _0x4f6117;};'use strict';var _=require(_0x66da('0x0'));var util=require(_0x66da('0x1'));var moment=require(_0x66da('0x2'));var BPromise=require('bluebird');var rs=require(_0x66da('0x3'));var fs=require('fs');var Redis=require(_0x66da('0x4'));var db=require(_0x66da('0x5'))['db'];var utils=require(_0x66da('0x6'));var logger=require('../../config/logger')(_0x66da('0x7'));var config=require(_0x66da('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x66da('0x9')][_0x66da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3892d4,_0x142650,_0x378aa4){return new BPromise(function(_0x55fc5f,_0x51e4cc){return client[_0x66da('0xb')](_0x3892d4,_0x378aa4)[_0x66da('0xc')](function(_0x48dc14){logger[_0x66da('0xd')](_0x66da('0xe'),_0x142650,_0x66da('0xf'));logger[_0x66da('0x10')](_0x66da('0x11'),_0x142650,_0x66da('0xf'),JSON[_0x66da('0x12')](_0x48dc14));if(_0x48dc14['error']){if(_0x48dc14[_0x66da('0x13')][_0x66da('0x14')]===0x1f4){logger[_0x66da('0x13')](_0x66da('0xe'),_0x142650,_0x48dc14['error'][_0x66da('0x15')]);return _0x51e4cc(_0x48dc14[_0x66da('0x13')]['message']);}logger[_0x66da('0x13')]('Trunk,\x20%s,\x20%s',_0x142650,_0x48dc14[_0x66da('0x13')][_0x66da('0x15')]);return _0x55fc5f(_0x48dc14[_0x66da('0x13')]['message']);}else{logger[_0x66da('0xd')]('Trunk,\x20%s,\x20%s',_0x142650,'request\x20sent');_0x55fc5f(_0x48dc14[_0x66da('0x16')][_0x66da('0x15')]);}})[_0x66da('0x17')](function(_0x3b3cb9){logger[_0x66da('0x13')](_0x66da('0xe'),_0x142650,_0x3b3cb9);_0x51e4cc(_0x3b3cb9);});});}exports[_0x66da('0x18')]=function(_0x1faeca){var _0x23a4bb=this;return new Promise(function(_0x521383,_0x267c93){return db[_0x66da('0x19')][_0x66da('0x1a')]({'raw':_0x1faeca['options']?_0x1faeca[_0x66da('0x1b')][_0x66da('0x1c')]===undefined?!![]:![]:!![],'where':_0x1faeca[_0x66da('0x1b')]?_0x1faeca[_0x66da('0x1b')][_0x66da('0x1d')]||null:null,'attributes':_0x1faeca['options']?_0x1faeca[_0x66da('0x1b')][_0x66da('0x1e')]||null:null,'limit':_0x1faeca[_0x66da('0x1b')]?_0x1faeca[_0x66da('0x1b')][_0x66da('0x1f')]||null:null,'include':_0x1faeca[_0x66da('0x1b')]?_0x1faeca['options']['include']?_[_0x66da('0x20')](_0x1faeca[_0x66da('0x1b')][_0x66da('0x21')],function(_0x40a380){return{'model':db[_0x40a380[_0x66da('0x22')]],'as':_0x40a380['as'],'attributes':_0x40a380[_0x66da('0x1e')],'include':_0x40a380[_0x66da('0x21')]?_[_0x66da('0x20')](_0x40a380['include'],function(_0x32f639){return{'model':db[_0x32f639[_0x66da('0x22')]],'as':_0x32f639['as'],'attributes':_0x32f639[_0x66da('0x1e')],'include':_0x32f639[_0x66da('0x21')]?_[_0x66da('0x20')](_0x32f639[_0x66da('0x21')],function(_0x310e98){return{'model':db[_0x310e98[_0x66da('0x22')]],'as':_0x310e98['as'],'attributes':_0x310e98[_0x66da('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x493bc8){logger['info'](_0x66da('0x18'),_0x1faeca);logger[_0x66da('0x10')](_0x66da('0x18'),_0x1faeca,JSON['stringify'](_0x493bc8));_0x521383(_0x493bc8);})['catch'](function(_0x5ba9cf){logger['error']('GetTrunk',_0x5ba9cf[_0x66da('0x15')],_0x1faeca);_0x267c93(_0x23a4bb[_0x66da('0x13')](0x1f4,_0x5ba9cf[_0x66da('0x15')]));});});};exports[_0x66da('0x23')]=function(_0x2a3915){var _0x9bfc5b=this;return new Promise(function(_0x2179ab,_0x3a3976){return db[_0x66da('0x19')][_0x66da('0x24')]({'raw':_0x2a3915[_0x66da('0x1b')]?_0x2a3915['options'][_0x66da('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a3915[_0x66da('0x1b')]?_0x2a3915[_0x66da('0x1b')][_0x66da('0x1d')]||null:null,'attributes':_0x2a3915['options']?_0x2a3915[_0x66da('0x1b')][_0x66da('0x1e')]||null:null,'include':_0x2a3915['options']?_0x2a3915[_0x66da('0x1b')][_0x66da('0x21')]?_[_0x66da('0x20')](_0x2a3915['options'][_0x66da('0x21')],function(_0x2585ab){return{'model':db[_0x2585ab['model']],'as':_0x2585ab['as'],'attributes':_0x2585ab['attributes'],'include':_0x2585ab[_0x66da('0x21')]?_[_0x66da('0x20')](_0x2585ab[_0x66da('0x21')],function(_0x1f19c7){return{'model':db[_0x1f19c7['model']],'as':_0x1f19c7['as'],'attributes':_0x1f19c7['attributes'],'include':_0x1f19c7[_0x66da('0x21')]?_[_0x66da('0x20')](_0x1f19c7[_0x66da('0x21')],function(_0x91d7b3){return{'model':db[_0x91d7b3[_0x66da('0x22')]],'as':_0x91d7b3['as'],'attributes':_0x91d7b3[_0x66da('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d3f0d){logger['info'](_0x66da('0x23'),_0x2a3915);logger['debug'](_0x66da('0x23'),_0x2a3915,JSON['stringify'](_0x5d3f0d));_0x2179ab(_0x5d3f0d);})[_0x66da('0x17')](function(_0x42dae0){logger['error'](_0x66da('0x23'),_0x42dae0[_0x66da('0x15')],_0x2a3915);_0x3a3976(_0x9bfc5b[_0x66da('0x13')](0x1f4,_0x42dae0[_0x66da('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 0e33c40..3be1b89 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe349=['./user-setting.controller','put','update','exports','express','Router','../../components/auth/service'];(function(_0x2212d5,_0x393fcd){var _0xdb0a21=function(_0x1f37fa){while(--_0x1f37fa){_0x2212d5['push'](_0x2212d5['shift']());}};_0xdb0a21(++_0x393fcd);}(_0xe349,0xd6));var _0x9e34=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0xe349[_0x289a67];return _0x572b49;};'use strict';var express=require(_0x9e34('0x0'));var router=express[_0x9e34('0x1')]();var auth=require(_0x9e34('0x2'));var controller=require(_0x9e34('0x3'));router[_0x9e34('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x9e34('0x5')]);module[_0x9e34('0x6')]=router; \ No newline at end of file +var _0x81f2=['exports','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x1922e5,_0x32eac8){var _0x2e5c5c=function(_0xbc19cc){while(--_0xbc19cc){_0x1922e5['push'](_0x1922e5['shift']());}};_0x2e5c5c(++_0x32eac8);}(_0x81f2,0x1a9));var _0x281f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81f2[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x281f('0x0')]();var auth=require(_0x281f('0x1'));var controller=require(_0x281f('0x2'));router[_0x281f('0x3')](_0x281f('0x4'),auth[_0x281f('0x5')](),controller[_0x281f('0x6')]);module[_0x281f('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 5195777..a6371c1 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e01=['warning','info','exports','BOOLEAN','TEXT','INTEGER','UserId','sequelize','error'];(function(_0x1e9f73,_0x3f1416){var _0x1dac25=function(_0x1c5f67){while(--_0x1c5f67){_0x1e9f73['push'](_0x1e9f73['shift']());}};_0x1dac25(++_0x3f1416);}(_0x1e01,0x1ed));var _0x11e0=function(_0x5f5657,_0x4a9f4d){_0x5f5657=_0x5f5657-0x0;var _0x13f970=_0x1e01[_0x5f5657];return _0x13f970;};'use strict';var Sequelize=require(_0x11e0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x11e0('0x1'),_0x11e0('0x2'),_0x11e0('0x3'),'debug'];module[_0x11e0('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x11e0('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x11e0('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x11e0('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x11e0('0x7')],'unique':_0x11e0('0x8')}}; \ No newline at end of file +var _0x3951=['error','warning','debug','exports','BOOLEAN','TEXT','DATE','UserId','sequelize'];(function(_0x4f52fa,_0x522609){var _0x24eb4a=function(_0x362bcf){while(--_0x362bcf){_0x4f52fa['push'](_0x4f52fa['shift']());}};_0x24eb4a(++_0x522609);}(_0x3951,0x1ca));var _0x1395=function(_0x336afa,_0x3ff400){_0x336afa=_0x336afa-0x0;var _0x4efbf5=_0x3951[_0x336afa];return _0x4efbf5;};'use strict';var Sequelize=require(_0x1395('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x1395('0x1'),_0x1395('0x2'),'info',_0x1395('0x3')];module[_0x1395('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x1395('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1395('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x1395('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x1395('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 3a908cb..17a34bb 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aaf=['socket.io-emitter','./user-setting.socket','register','defaults','localhost','status','then','sendStatus','error','stack','name','update','role','Unauthorized','Invalid\x20user\x20setting\x20id','find','params','body','catch','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x2e27fb,_0x115c86){var _0x155c4d=function(_0x57565c){while(--_0x57565c){_0x2e27fb['push'](_0x2e27fb['shift']());}};_0x155c4d(++_0x115c86);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x389fee,_0x18baf5){_0x389fee=_0x389fee-0x0;var _0x1511f6=_0x0aaf[_0x389fee];return _0x1511f6;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0xf0aa('0x0'))(_0xf0aa('0x1'));var config=require(_0xf0aa('0x2'));var db=require(_0xf0aa('0x3'))['db'];var socket=require(_0xf0aa('0x4'))(new Redis(config['redis']));require(_0xf0aa('0x5'))[_0xf0aa('0x6')](socket);config['redis']=_[_0xf0aa('0x7')](config['redis'],{'host':_0xf0aa('0x8'),'port':0x18eb});function respondWithResult(_0x4c2d11,_0xe4a744){_0xe4a744=_0xe4a744||0xc8;return function(_0x244745){if(_0x244745){return _0x4c2d11[_0xf0aa('0x9')](_0xe4a744)['json'](_0x244745);}};}function saveUpdates(_0x14137c){return function(_0x1fcbfe){if(_0x1fcbfe){return _0x1fcbfe['update'](_0x14137c)[_0xf0aa('0xa')](function(_0x1ce4ab){return _0x1ce4ab;});}return null;};}function handleEntityNotFound(_0x3c71d8){return function(_0x3de976){if(!_0x3de976){_0x3c71d8[_0xf0aa('0xb')](0x194);}return _0x3de976;};}function handleError(_0x405d1f,_0x34b218){_0x34b218=_0x34b218||0x1f4;return function(_0x106b57){logger[_0xf0aa('0xc')](_0x106b57[_0xf0aa('0xd')]);if(_0x106b57[_0xf0aa('0xe')]){delete _0x106b57[_0xf0aa('0xe')];}_0x405d1f['status'](_0x34b218)['send'](_0x106b57);};}exports[_0xf0aa('0xf')]=function(_0x222814,_0x5f3f18){if(_0x222814['user'][_0xf0aa('0x10')]!=='admin')throw new Error(_0xf0aa('0x11'));if(isNaN(Number(_0x222814['params']['id'])))throw new Error(_0xf0aa('0x12'));return db['UserSetting'][_0xf0aa('0x13')]({'where':{'id':_0x222814[_0xf0aa('0x14')]['id']}})[_0xf0aa('0xa')](handleEntityNotFound(_0x5f3f18,null))[_0xf0aa('0xa')](saveUpdates(_0x222814[_0xf0aa('0x15')],null))[_0xf0aa('0xa')](respondWithResult(_0x5f3f18,null))[_0xf0aa('0x16')](handleError(_0x5f3f18,null));}; \ No newline at end of file +var _0x225c=['status','json','then','sendStatus','error','name','update','Invalid\x20user\x20setting\x20id','UserSetting','find','lodash','ioredis','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x225c,0x106));var _0xc225=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x225c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc225('0x0'));var Redis=require(_0xc225('0x1'));var logger=require('../../config/logger')('api');var config=require(_0xc225('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0xc225('0x3'))(new Redis(config[_0xc225('0x4')]));require(_0xc225('0x5'))[_0xc225('0x6')](socket);config[_0xc225('0x4')]=_[_0xc225('0x7')](config[_0xc225('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x143eab,_0x249b43){_0x249b43=_0x249b43||0xc8;return function(_0x409c9f){if(_0x409c9f){return _0x143eab[_0xc225('0x8')](_0x249b43)[_0xc225('0x9')](_0x409c9f);}};}function saveUpdates(_0x4dc4ed){return function(_0x166add){if(_0x166add){return _0x166add['update'](_0x4dc4ed)[_0xc225('0xa')](function(_0x10f26b){return _0x10f26b;});}return null;};}function handleEntityNotFound(_0x238dbf){return function(_0x52727e){if(!_0x52727e){_0x238dbf[_0xc225('0xb')](0x194);}return _0x52727e;};}function handleError(_0x1f2f4f,_0x3ca94e){_0x3ca94e=_0x3ca94e||0x1f4;return function(_0x331018){logger[_0xc225('0xc')](_0x331018['stack']);if(_0x331018[_0xc225('0xd')]){delete _0x331018[_0xc225('0xd')];}_0x1f2f4f['status'](_0x3ca94e)['send'](_0x331018);};}exports[_0xc225('0xe')]=function(_0x3dc064,_0x2c53af){if(_0x3dc064['user']['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x3dc064['params']['id'])))throw new Error(_0xc225('0xf'));return db[_0xc225('0x10')][_0xc225('0x11')]({'where':{'id':_0x3dc064['params']['id']}})[_0xc225('0xa')](handleEntityNotFound(_0x2c53af,null))['then'](saveUpdates(_0x3dc064['body'],null))[_0xc225('0xa')](respondWithResult(_0x2c53af,null))['catch'](handleError(_0x2c53af,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 2ad401f..0680000 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46cf=['events','../../mysqldb','UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x17ef17,_0x1e9a56){var _0x2bb6c3=function(_0xf864df){while(--_0xf864df){_0x17ef17['push'](_0x17ef17['shift']());}};_0x2bb6c3(++_0x1e9a56);}(_0x46cf,0x105));var _0xf46c=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x46cf[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0xf46c('0x0'));var UserSetting=require(_0xf46c('0x1'))['db'][_0xf46c('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xf46c('0x3')](0x0);var events={'afterCreate':_0xf46c('0x4'),'afterUpdate':_0xf46c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x32751f){return function(_0x39cb6a,_0x5b881e,_0x1bf7f6){UserSettingEvents['emit'](_0x32751f+':'+_0x39cb6a['id'],_0x39cb6a);UserSettingEvents[_0xf46c('0x6')](_0x32751f,_0x39cb6a);_0x1bf7f6(null);};}for(var e in events){if(events[_0xf46c('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xf46c('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x1188=['events','../../mysqldb','UserSetting','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0xe6055a,_0x51b582){var _0x66d236=function(_0x376be2){while(--_0x376be2){_0xe6055a['push'](_0xe6055a['shift']());}};_0x66d236(++_0x51b582);}(_0x1188,0x198));var _0x8118=function(_0x107157,_0x5dd0fb){_0x107157=_0x107157-0x0;var _0x39c259=_0x1188[_0x107157];return _0x39c259;};'use strict';var EventEmitter=require(_0x8118('0x0'));var UserSetting=require(_0x8118('0x1'))['db'][_0x8118('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x8118('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8118('0x4')};function emitEvent(_0x5420da){return function(_0x52c588,_0x25f340,_0x29438c){UserSettingEvents[_0x8118('0x5')](_0x5420da+':'+_0x52c588['id'],_0x52c588);UserSettingEvents['emit'](_0x5420da,_0x52c588);_0x29438c(null);};}for(var e in events){if(events[_0x8118('0x6')](e)){var event=events[e];UserSetting[_0x8118('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index eb5d67a..138c9a1 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe130=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x299058,_0x51ad01){var _0xee1f97=function(_0x3468fe){while(--_0x3468fe){_0x299058['push'](_0x299058['shift']());}};_0xee1f97(++_0x51ad01);}(_0xe130,0x127));var _0x0e13=function(_0x243f01,_0x1fe47d){_0x243f01=_0x243f01-0x0;var _0x56eb2b=_0xe130[_0x243f01];return _0x56eb2b;};'use strict';var attributes=require(_0x0e13('0x0'));module[_0x0e13('0x1')]=function(_0x51aabf){return _0x51aabf[_0x0e13('0x2')](_0x0e13('0x3'),attributes,{'tableName':_0x0e13('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x360489){if(!_0x360489[_0x0e13('0x5')])_0x360489['clientSideLoggingEnabledSince']=null;else if(_0x360489[_0x0e13('0x6')]===null)_0x360489[_0x0e13('0x6')]=new Date();}}});}; \ No newline at end of file +var _0xeea4=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x1c3b6c,_0x2407ac){var _0x5463e5=function(_0x125cc1){while(--_0x125cc1){_0x1c3b6c['push'](_0x1c3b6c['shift']());}};_0x5463e5(++_0x2407ac);}(_0xeea4,0x19e));var _0x4eea=function(_0x190707,_0x154836){_0x190707=_0x190707-0x0;var _0x28f1ab=_0xeea4[_0x190707];return _0x28f1ab;};'use strict';var attributes=require(_0x4eea('0x0'));module[_0x4eea('0x1')]=function(_0x36e0f6){return _0x36e0f6[_0x4eea('0x2')](_0x4eea('0x3'),attributes,{'tableName':_0x4eea('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a47d5){if(!_0x2a47d5[_0x4eea('0x5')])_0x2a47d5[_0x4eea('0x6')]=null;else if(_0x2a47d5['clientSideLoggingEnabledSince']===null)_0x2a47d5[_0x4eea('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 202b44d..35090b2 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15e3=['UserId','register','length','user-setting:','./user-setting.events','remove','update','user-setting:update','emit','user-setting:update:user-'];(function(_0x20b158,_0x49dd46){var _0x4f20cb=function(_0x3e1854){while(--_0x3e1854){_0x20b158['push'](_0x20b158['shift']());}};_0x4f20cb(++_0x49dd46);}(_0x15e3,0x1b2));var _0x315e=function(_0x2c0ffb,_0x7bf411){_0x2c0ffb=_0x2c0ffb-0x0;var _0x5dfa15=_0x15e3[_0x2c0ffb];return _0x5dfa15;};'use strict';var UserSettingEvents=require(_0x315e('0x0'));var events=['save',_0x315e('0x1'),_0x315e('0x2')];function createListener(_0x3ebfa6,_0x91942f){return function(_0xbe7f95){_0x91942f['emit'](_0x3ebfa6,_0xbe7f95);if(_0x3ebfa6===_0x315e('0x3')){_0x91942f[_0x315e('0x4')](_0x315e('0x5')+_0xbe7f95[_0x315e('0x6')],_0xbe7f95);}};}exports[_0x315e('0x7')]=function(_0x325dac){for(var _0x22e821=0x0,_0x52320a=events[_0x315e('0x8')];_0x22e821<_0x52320a;_0x22e821++){var _0x3df847=events[_0x22e821];var _0x24be9c=createListener(_0x315e('0x9')+_0x3df847,_0x325dac);UserSettingEvents['on'](_0x3df847,_0x24be9c);}}; \ No newline at end of file +var _0x21f8=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','save'];(function(_0x4b53d4,_0x4498af){var _0x14736e=function(_0x11a6ae){while(--_0x11a6ae){_0x4b53d4['push'](_0x4b53d4['shift']());}};_0x14736e(++_0x4498af);}(_0x21f8,0x170));var _0x821f=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0x21f8[_0x5cbd7b];return _0x3fdfb8;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x821f('0x0'),'remove',_0x821f('0x1')];function createListener(_0x45010c,_0xa7bc69){return function(_0x44a696){_0xa7bc69[_0x821f('0x2')](_0x45010c,_0x44a696);if(_0x45010c===_0x821f('0x3')){_0xa7bc69[_0x821f('0x2')](_0x821f('0x4')+_0x44a696[_0x821f('0x5')],_0x44a696);}};}exports[_0x821f('0x6')]=function(_0x43e032){for(var _0x4a9ad0=0x0,_0x8934f7=events[_0x821f('0x7')];_0x4a9ad0<_0x8934f7;_0x4a9ad0++){var _0x4ef9ce=events[_0x4a9ad0];var _0x4fedbc=createListener(_0x821f('0x8')+_0x4ef9ce,_0x43e032);UserSettingEvents['on'](_0x4ef9ce,_0x4fedbc);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 23ab381..dc8943a 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 _0xb506=['addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','/presence','getPresence','show','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/chat_websites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts'];(function(_0x357851,_0x253da0){var _0x1beb62=function(_0x4067d0){while(--_0x4067d0){_0x357851['push'](_0x357851['shift']());}};_0x1beb62(++_0x253da0);}(_0xb506,0x10c));var _0x6b50=function(_0x394329,_0x58f631){_0x394329=_0x394329-0x0;var _0x54124c=_0xb506[_0x394329];return _0x54124c;};'use strict';var multer=require(_0x6b50('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b50('0x1'));var express=require(_0x6b50('0x2'));var router=express[_0x6b50('0x3')]();var fs_extra=require(_0x6b50('0x4'));var auth=require(_0x6b50('0x5'));var interaction=require(_0x6b50('0x6'));var config=require('../../config/environment');var controller=require(_0x6b50('0x7'));router['get']('/',auth[_0x6b50('0x8')](),controller[_0x6b50('0x9')]);router[_0x6b50('0xa')](_0x6b50('0xb'),auth['isAuthenticated'](),controller[_0x6b50('0xc')]);router[_0x6b50('0xa')](_0x6b50('0xd'),auth[_0x6b50('0x8')](),controller['whoami']);router[_0x6b50('0xa')](_0x6b50('0xe'),auth['isAuthenticated'](),controller[_0x6b50('0xf')]);router[_0x6b50('0xa')]('/:id',auth[_0x6b50('0x8')](),controller[_0x6b50('0x10')]);router['get'](_0x6b50('0x11'),controller['getAvatar']);router[_0x6b50('0xa')](_0x6b50('0x12'),auth[_0x6b50('0x8')](),controller['getOpenTabs']);router[_0x6b50('0xa')](_0x6b50('0x13'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x14')]);router[_0x6b50('0xa')](_0x6b50('0x15'),auth['isAuthenticated'](),controller[_0x6b50('0x16')]);router[_0x6b50('0xa')]('/:id/queues_rt',auth[_0x6b50('0x8')](),controller[_0x6b50('0x17')]);router[_0x6b50('0xa')](_0x6b50('0x18'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x19')]);router[_0x6b50('0xa')](_0x6b50('0x1a'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x1b')]);router[_0x6b50('0xa')](_0x6b50('0x1c'),auth[_0x6b50('0x8')](),controller['getScreenRecordings']);router[_0x6b50('0xa')](_0x6b50('0x1d'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x1e')]);router[_0x6b50('0xa')](_0x6b50('0x1f'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x20')]);router[_0x6b50('0xa')]('/:id/mail/interactions',auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x6b50('0xa')](_0x6b50('0x21'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x22')]);router[_0x6b50('0xa')](_0x6b50('0x23'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x24')]);router['get'](_0x6b50('0x25'),auth[_0x6b50('0x8')](),controller['getWhatsappInteractions']);router[_0x6b50('0xa')](_0x6b50('0x26'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x27')]);router[_0x6b50('0xa')](_0x6b50('0x28'),auth[_0x6b50('0x8')](),controller['getLists']);router['get'](_0x6b50('0x29'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x2a')]);router['get'](_0x6b50('0x2b'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x2c')]);router[_0x6b50('0xa')](_0x6b50('0x2d'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x2e')]);router[_0x6b50('0xa')](_0x6b50('0x2f'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x30')]);router[_0x6b50('0xa')](_0x6b50('0x31'),auth[_0x6b50('0x8')](),controller['getOpenchannelAccounts']);router[_0x6b50('0xa')]('/:id/sms_accounts',auth[_0x6b50('0x8')](),controller['getSmsAccounts']);router[_0x6b50('0xa')](_0x6b50('0x32'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x6b50('0xa')](_0x6b50('0x33'),auth[_0x6b50('0x8')](),controller['getWhatsappAccounts']);router[_0x6b50('0xa')](_0x6b50('0x34'),auth['isAuthenticated'](),controller[_0x6b50('0x35')]);router['get'](_0x6b50('0x36'),auth[_0x6b50('0x8')](),controller['getApiKey']);router[_0x6b50('0x37')](_0x6b50('0x13'),auth['isAuthenticated'](),controller[_0x6b50('0x38')]);router[_0x6b50('0x37')]('/',auth[_0x6b50('0x8')](),controller[_0x6b50('0x39')]);router[_0x6b50('0x37')](_0x6b50('0x3a'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x6b50('0x37')]('/:id/queues',auth[_0x6b50('0x8')](),controller[_0x6b50('0x3b')]);var upload=multer({'storage':multer[_0x6b50('0x3c')]({'destination':function(_0x36182b,_0x4e127d,_0x260c0d){_0x260c0d(null,path[_0x6b50('0x3d')](config[_0x6b50('0x3e')],_0x6b50('0x3f')));},'filename':function(_0x51a20e,_0x2bf99d,_0x179d60){_0x179d60(null,util[_0x6b50('0x40')]('%s-%s',Date[_0x6b50('0x41')](),_0x2bf99d[_0x6b50('0x42')]));}})});router[_0x6b50('0x37')]('/:id/avatar',upload[_0x6b50('0x43')](_0x6b50('0x44')),controller[_0x6b50('0x45')]);router[_0x6b50('0x37')](_0x6b50('0x46'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x47')]);router['post'](_0x6b50('0x48'),auth[_0x6b50('0x8')](),controller['logout']);router['post'](_0x6b50('0x49'),auth[_0x6b50('0x8')](),controller['pause']);router['post'](_0x6b50('0x4a'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x4b')]);router[_0x6b50('0x37')](_0x6b50('0x26'),auth['isAuthenticated'](),controller[_0x6b50('0x4c')]);router[_0x6b50('0x37')](_0x6b50('0x4d'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x4e')]);router[_0x6b50('0x37')](_0x6b50('0x4f'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x50')]);router[_0x6b50('0x37')](_0x6b50('0x51'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x52')]);router[_0x6b50('0x37')]('/:id/sms_interactions',auth[_0x6b50('0x8')](),controller[_0x6b50('0x53')]);router['post']('/:id/openchannel_interactions',auth[_0x6b50('0x8')](),controller[_0x6b50('0x54')]);router[_0x6b50('0x37')](_0x6b50('0x55'),auth['isAuthenticated'](),controller[_0x6b50('0x56')]);router[_0x6b50('0x37')](_0x6b50('0x2d'),auth['isAuthenticated'](),controller[_0x6b50('0x57')]);router[_0x6b50('0x37')](_0x6b50('0x2f'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x58')]);router[_0x6b50('0x37')](_0x6b50('0x31'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x59')]);router[_0x6b50('0x37')]('/:id/sms_accounts',auth[_0x6b50('0x8')](),controller[_0x6b50('0x5a')]);router[_0x6b50('0x37')](_0x6b50('0x32'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x5b')]);router[_0x6b50('0x37')](_0x6b50('0x33'),auth['isAuthenticated'](),controller[_0x6b50('0x5c')]);router[_0x6b50('0x37')](_0x6b50('0x36'),auth['isAuthenticated'](),controller[_0x6b50('0x5d')]);router[_0x6b50('0x5e')](_0x6b50('0x5f'),auth['isAuthenticated'](),controller[_0x6b50('0x60')]);router[_0x6b50('0x5e')](_0x6b50('0x61'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x62')]);router[_0x6b50('0x63')](_0x6b50('0x15'),auth['isAuthenticated'](),controller[_0x6b50('0x64')]);router['delete'](_0x6b50('0x26'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x65')]);router[_0x6b50('0x63')](_0x6b50('0x5f'),auth['isAuthenticated'](),controller[_0x6b50('0x66')]);router[_0x6b50('0x63')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x6b50('0x67')]);router[_0x6b50('0x63')](_0x6b50('0x4f'),auth['isAuthenticated'](),controller[_0x6b50('0x68')]);router[_0x6b50('0x63')]('/:id/fax_interactions',auth[_0x6b50('0x8')](),controller[_0x6b50('0x69')]);router[_0x6b50('0x63')](_0x6b50('0x6a'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x6b50('0x63')](_0x6b50('0x6b'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x6c')]);router[_0x6b50('0x63')](_0x6b50('0x55'),auth['isAuthenticated'](),controller[_0x6b50('0x6d')]);router[_0x6b50('0x63')](_0x6b50('0x2d'),auth['isAuthenticated'](),controller[_0x6b50('0x6e')]);router[_0x6b50('0x63')]('/:id/mail_accounts',auth[_0x6b50('0x8')](),controller['removeMailAccounts']);router[_0x6b50('0x63')](_0x6b50('0x31'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x6f')]);router[_0x6b50('0x63')](_0x6b50('0x70'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x71')]);router[_0x6b50('0x63')](_0x6b50('0x32'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x72')]);router['delete'](_0x6b50('0x33'),auth[_0x6b50('0x8')](),controller['removeWhatsappAccounts']);router[_0x6b50('0x63')](_0x6b50('0x36'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x73')]);router[_0x6b50('0x37')](_0x6b50('0x74'),auth[_0x6b50('0x8')](),controller[_0x6b50('0x75')]);module[_0x6b50('0x76')]=router; \ No newline at end of file +var _0x6dad=['exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','/:id/teams','delete','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification'];(function(_0x27472d,_0x146002){var _0x3eae9a=function(_0x28b212){while(--_0x28b212){_0x27472d['push'](_0x27472d['shift']());}};_0x3eae9a(++_0x146002);}(_0x6dad,0x77));var _0xd6da=function(_0x12d86d,_0x385097){_0x12d86d=_0x12d86d-0x0;var _0x3e3924=_0x6dad[_0x12d86d];return _0x3e3924;};'use strict';var multer=require(_0xd6da('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd6da('0x1'));var router=express[_0xd6da('0x2')]();var fs_extra=require(_0xd6da('0x3'));var auth=require(_0xd6da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd6da('0x5'));var controller=require(_0xd6da('0x6'));router[_0xd6da('0x7')]('/',auth[_0xd6da('0x8')](),controller[_0xd6da('0x9')]);router[_0xd6da('0x7')](_0xd6da('0xa'),auth[_0xd6da('0x8')](),controller[_0xd6da('0xb')]);router[_0xd6da('0x7')](_0xd6da('0xc'),auth[_0xd6da('0x8')](),controller[_0xd6da('0xd')]);router['get'](_0xd6da('0xe'),auth[_0xd6da('0x8')](),controller[_0xd6da('0xf')]);router[_0xd6da('0x7')](_0xd6da('0x10'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x11')]);router[_0xd6da('0x7')]('/:id/avatar',controller[_0xd6da('0x12')]);router['get'](_0xd6da('0x13'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x14')]);router[_0xd6da('0x7')](_0xd6da('0x15'),auth[_0xd6da('0x8')](),controller['getContacts']);router['get'](_0xd6da('0x16'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x17')]);router[_0xd6da('0x7')](_0xd6da('0x18'),auth['isAuthenticated'](),controller[_0xd6da('0x19')]);router[_0xd6da('0x7')]('/:id/groups',auth[_0xd6da('0x8')](),controller[_0xd6da('0x1a')]);router[_0xd6da('0x7')](_0xd6da('0x1b'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x1c')]);router[_0xd6da('0x7')]('/:id/screen_recordings',auth[_0xd6da('0x8')](),controller[_0xd6da('0x1d')]);router[_0xd6da('0x7')]('/:id/chat/interactions',auth[_0xd6da('0x8')](),controller[_0xd6da('0x1e')]);router[_0xd6da('0x7')](_0xd6da('0x1f'),auth['isAuthenticated'](),controller[_0xd6da('0x20')]);router[_0xd6da('0x7')](_0xd6da('0x21'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x22')]);router[_0xd6da('0x7')](_0xd6da('0x23'),auth[_0xd6da('0x8')](),controller['getSmsInteractions']);router[_0xd6da('0x7')](_0xd6da('0x24'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x25')]);router['get']('/:id/whatsapp/interactions',auth[_0xd6da('0x8')](),controller[_0xd6da('0x26')]);router[_0xd6da('0x7')]('/:id/teams',auth[_0xd6da('0x8')](),controller[_0xd6da('0x27')]);router[_0xd6da('0x7')]('/:id/lists',auth[_0xd6da('0x8')](),controller[_0xd6da('0x28')]);router['get'](_0xd6da('0x29'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x2a')]);router[_0xd6da('0x7')](_0xd6da('0x2b'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x2c')]);router[_0xd6da('0x7')](_0xd6da('0x2d'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x2e')]);router['get'](_0xd6da('0x2f'),auth[_0xd6da('0x8')](),controller['getMailAccounts']);router['get'](_0xd6da('0x30'),auth[_0xd6da('0x8')](),controller['getOpenchannelAccounts']);router[_0xd6da('0x7')](_0xd6da('0x31'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x32')]);router[_0xd6da('0x7')]('/:id/chat_websites',auth[_0xd6da('0x8')](),controller[_0xd6da('0x33')]);router[_0xd6da('0x7')](_0xd6da('0x34'),auth['isAuthenticated'](),controller[_0xd6da('0x35')]);router[_0xd6da('0x7')](_0xd6da('0x36'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x37')]);router[_0xd6da('0x7')](_0xd6da('0x38'),auth['isAuthenticated'](),controller[_0xd6da('0x39')]);router['post'](_0xd6da('0x15'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x3a')]);router[_0xd6da('0x3b')]('/',auth['isAuthenticated'](),controller[_0xd6da('0x3c')]);router[_0xd6da('0x3b')](_0xd6da('0x3d'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x3e')]);router[_0xd6da('0x3b')](_0xd6da('0x16'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x3f')]);var upload=multer({'storage':multer[_0xd6da('0x40')]({'destination':function(_0x23fdaa,_0x477dfd,_0x8b3d06){_0x8b3d06(null,path[_0xd6da('0x41')](config[_0xd6da('0x42')],_0xd6da('0x43')));},'filename':function(_0x2e26d4,_0x346c8f,_0x5e581d){_0x5e581d(null,util[_0xd6da('0x44')](_0xd6da('0x45'),Date[_0xd6da('0x46')](),_0x346c8f[_0xd6da('0x47')]));}})});router[_0xd6da('0x3b')](_0xd6da('0x48'),upload['single'](_0xd6da('0x49')),controller[_0xd6da('0x4a')]);router[_0xd6da('0x3b')](_0xd6da('0x4b'),auth['isAuthenticated'](),controller[_0xd6da('0x4c')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0xd6da('0x4d')]);router[_0xd6da('0x3b')](_0xd6da('0x4e'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x4f')]);router[_0xd6da('0x3b')](_0xd6da('0x50'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x51')]);router['post']('/:id/teams',auth[_0xd6da('0x8')](),controller[_0xd6da('0x52')]);router[_0xd6da('0x3b')](_0xd6da('0x53'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x54')]);router[_0xd6da('0x3b')]('/:id/mail_interactions',auth[_0xd6da('0x8')](),controller[_0xd6da('0x55')]);router[_0xd6da('0x3b')](_0xd6da('0x56'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x57')]);router[_0xd6da('0x3b')](_0xd6da('0x58'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x59')]);router[_0xd6da('0x3b')]('/:id/openchannel_interactions',auth[_0xd6da('0x8')](),controller[_0xd6da('0x5a')]);router[_0xd6da('0x3b')](_0xd6da('0x5b'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x5c')]);router[_0xd6da('0x3b')](_0xd6da('0x2d'),auth[_0xd6da('0x8')](),controller['addFaxAccounts']);router['post'](_0xd6da('0x2f'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x5d')]);router['post'](_0xd6da('0x30'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xd6da('0x3b')](_0xd6da('0x31'),auth[_0xd6da('0x8')](),controller['addSmsAccounts']);router[_0xd6da('0x3b')]('/:id/chat_websites',auth[_0xd6da('0x8')](),controller[_0xd6da('0x5e')]);router[_0xd6da('0x3b')](_0xd6da('0x34'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x5f')]);router[_0xd6da('0x3b')](_0xd6da('0x38'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x60')]);router[_0xd6da('0x61')](_0xd6da('0x10'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x62')]);router[_0xd6da('0x61')](_0xd6da('0x63'),auth['isAuthenticated'](),controller['changePassword']);router['delete'](_0xd6da('0x16'),auth[_0xd6da('0x8')](),controller['removeQueues']);router['delete'](_0xd6da('0x64'),auth[_0xd6da('0x8')](),controller['removeTeams']);router[_0xd6da('0x65')](_0xd6da('0x10'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x66')]);router[_0xd6da('0x65')](_0xd6da('0x53'),auth['isAuthenticated'](),controller[_0xd6da('0x67')]);router[_0xd6da('0x65')](_0xd6da('0x68'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x69')]);router[_0xd6da('0x65')](_0xd6da('0x56'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x6a')]);router['delete'](_0xd6da('0x58'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x6b')]);router[_0xd6da('0x65')]('/:id/openchannel_interactions',auth[_0xd6da('0x8')](),controller[_0xd6da('0x6c')]);router[_0xd6da('0x65')](_0xd6da('0x5b'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x6d')]);router[_0xd6da('0x65')](_0xd6da('0x2d'),auth[_0xd6da('0x8')](),controller['removeFaxAccounts']);router[_0xd6da('0x65')](_0xd6da('0x2f'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x6e')]);router[_0xd6da('0x65')]('/:id/openchannel_accounts',auth[_0xd6da('0x8')](),controller[_0xd6da('0x6f')]);router[_0xd6da('0x65')](_0xd6da('0x31'),auth['isAuthenticated'](),controller[_0xd6da('0x70')]);router[_0xd6da('0x65')](_0xd6da('0x71'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x72')]);router['delete'](_0xd6da('0x34'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xd6da('0x65')](_0xd6da('0x38'),auth[_0xd6da('0x8')](),controller[_0xd6da('0x73')]);router[_0xd6da('0x3b')](_0xd6da('0x74'),auth[_0xd6da('0x8')](),controller['messengerSoundNotification']);module[_0xd6da('0x75')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index bd4b2a2..9ecad4d 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 _0xdcca=['ulaw;alaw;gsm','allow','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','uac','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','force_avp','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue','STRING','email','toLowerCase','ENUM','admin','user','agent','telephone','local','internal','accountcode','format','fullname','DATE','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all'];(function(_0x2d7238,_0xfe5bd5){var _0x4f6a0e=function(_0x5b643f){while(--_0x5b643f){_0x2d7238['push'](_0x2d7238['shift']());}};_0x4f6a0e(++_0xfe5bd5);}(_0xdcca,0x89));var _0xadcc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcca[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xadcc('0x0'));var moment=require(_0xadcc('0x1'));var util=require(_0xadcc('0x2'));var _=require(_0xadcc('0x3'));module[_0xadcc('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xadcc('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xb92ab7){this[_0xadcc('0x6')](_0xadcc('0x5'),_0xb92ab7);this[_0xadcc('0x6')](_0xadcc('0x7'),_0xb92ab7);},'comment':_0xadcc('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2a4772){this[_0xadcc('0x6')]('fullname',_0x2a4772);this[_0xadcc('0x6')](_0xadcc('0x9'),util['format'](_0xadcc('0xa'),_0x2a4772,this[_0xadcc('0xb')]('internal')));}},'alias':{'type':Sequelize[_0xadcc('0xc')]},'email':{'type':Sequelize[_0xadcc('0xc')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x4d77cf){if(_0x4d77cf){this['setDataValue'](_0xadcc('0xd'),_0x4d77cf[_0xadcc('0xe')]());}}},'role':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x10'),_0xadcc('0x11'),_0xadcc('0x12'),_0xadcc('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xadcc('0xc')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xadcc('0xc')],'defaultValue':_0xadcc('0x14')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xadcc('0x15'),'set':function(_0x23e0ff){this['setDataValue'](_0xadcc('0x15'),_0x23e0ff);this[_0xadcc('0x6')](_0xadcc('0x16'),_0x23e0ff);this[_0xadcc('0x6')](_0xadcc('0x9'),util[_0xadcc('0x17')](_0xadcc('0xa'),this[_0xadcc('0xb')](_0xadcc('0x18')),_0x23e0ff));}},'salt':{'type':Sequelize[_0xadcc('0xc')]},'phone':{'type':Sequelize[_0xadcc('0xc')]},'mobile':{'type':Sequelize[_0xadcc('0xc')]},'address':{'type':Sequelize[_0xadcc('0xc')]},'zipcode':{'type':Sequelize[_0xadcc('0xc')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xadcc('0xc')]},'country':{'type':Sequelize[_0xadcc('0xc')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xadcc('0x19')]},'voicePause':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xadcc('0x19')]},'chatCapacity':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xadcc('0x1b')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'description':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'host':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![],'defaultValue':_0xadcc('0x1c')},'ipaddr':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x1d'),_0xadcc('0x11'),_0xadcc('0x1e')),'allowNull':!![],'defaultValue':_0xadcc('0x1d')},'context':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![],'defaultValue':_0xadcc('0x1f')},'callingpres':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x20'),_0xadcc('0x21'),_0xadcc('0x22'),'ALLOWED',_0xadcc('0x23'),_0xadcc('0x24'),_0xadcc('0x25'),_0xadcc('0x26')),'allowNull':!![]},'deny':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'transport':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![],'defaultValue':_0xadcc('0x27'),'set':function(_0x1f66a5){this[_0xadcc('0x6')](_0xadcc('0x28'),_0x1f66a5?_0x1f66a5[_0xadcc('0x29')](','):null);},'get':function(){return this[_0xadcc('0xb')]('transport')?this[_0xadcc('0xb')](_0xadcc('0x28'))[_0xadcc('0x2a')](','):null;},'comment':_0xadcc('0x2b')},'dtmfmode':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x2c'),_0xadcc('0x2d'),_0xadcc('0x2e'),_0xadcc('0x2f'),_0xadcc('0x30')),'allowNull':!![],'defaultValue':_0xadcc('0x2c')},'directmedia':{'type':Sequelize[_0xadcc('0xf')]('yes','no','nonat',_0xadcc('0x31'),_0xadcc('0x32')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xadcc('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'nat':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![],'defaultValue':_0xadcc('0x33'),'set':function(_0x34cc84){this[_0xadcc('0x6')]('nat',_0x34cc84?_0x34cc84[_0xadcc('0x29')](','):null);},'get':function(){return this['getDataValue'](_0xadcc('0x34'))?this['getDataValue']('nat')[_0xadcc('0x2a')](','):null;},'comment':_0xadcc('0x35')},'callgroup':{'type':Sequelize[_0xadcc('0xc')]},'namedcallgroup':{'type':Sequelize[_0xadcc('0xc')]},'pickupgroup':{'type':Sequelize[_0xadcc('0xc')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xadcc('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xadcc('0xc')],'allowNull':![],'defaultValue':_0xadcc('0x36')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xadcc('0x37'),'set':function(_0x38cc22){this[_0xadcc('0x6')](_0xadcc('0x38'),_0x38cc22?_0x38cc22[_0xadcc('0x29')](';'):_0xadcc('0x37'));},'get':function(){return this[_0xadcc('0xb')]('allow')?this[_0xadcc('0xb')]('allow')[_0xadcc('0x2a')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![],'set':function(_0x4b6583){this[_0xadcc('0x6')]('insecure',_0x4b6583?_0x4b6583[_0xadcc('0x29')](','):null);},'get':function(){return this[_0xadcc('0xb')](_0xadcc('0x3a'))?this[_0xadcc('0xb')](_0xadcc('0x3a'))[_0xadcc('0x2a')](','):null;},'comment':_0xadcc('0x3b')},'trustrpid':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no',_0xadcc('0x3c')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![],'defaultValue':_0xadcc('0x3d')},'amaflags':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xadcc('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xadcc('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xadcc('0x39'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no',_0xadcc('0x3e')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x3f'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x40'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xadcc('0x39'),'no'),'allowNull':!![],'defaultValue':_0xadcc('0x39')},'keepalive':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xadcc('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xadcc('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xadcc('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xadcc('0x39'),'no','fingerprint',_0xadcc('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xadcc('0x1b')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x42'),_0xadcc('0x43'),_0xadcc('0x44')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xadcc('0xf')](_0xadcc('0x39'),'no','nonat',_0xadcc('0x31'),_0xadcc('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xadcc('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xadcc('0x46')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x312c98){this[_0xadcc('0x6')](_0xadcc('0x47'),_0x312c98);var _0x487295=this['get']({'plain':!![]});switch(_0x312c98){case 0x0:case 0x1:var _0x3acf16=_0x487295['transport']?_[_0xadcc('0x48')](_0x487295[_0xadcc('0x28')])?_0x487295[_0xadcc('0x28')]['join']():_0x487295[_0xadcc('0x28')]:_0xadcc('0x27');if(_0x3acf16===_0xadcc('0x49')){_0x3acf16=_0xadcc('0x27');}this[_0xadcc('0x6')](_0xadcc('0x28'),_0x3acf16);this['setDataValue'](_0xadcc('0x4a'),'no');this['setDataValue'](_0xadcc('0x4b'),null);this[_0xadcc('0x6')]('force_avp',null);this[_0xadcc('0x6')](_0xadcc('0x4c'),null);this[_0xadcc('0x6')](_0xadcc('0x4d'),null);this[_0xadcc('0x6')](_0xadcc('0x4e'),null);this[_0xadcc('0x6')](_0xadcc('0x4f'),null);this[_0xadcc('0x6')](_0xadcc('0x50'),null);this[_0xadcc('0x6')](_0xadcc('0x51'),null);this[_0xadcc('0x6')]('rtcp_mux','no');break;case 0x2:this[_0xadcc('0x6')]('transport',_0xadcc('0x49'));this[_0xadcc('0x6')](_0xadcc('0x4a'),_0xadcc('0x39'));this[_0xadcc('0x6')]('avpf','yes');this[_0xadcc('0x6')](_0xadcc('0x52'),_0xadcc('0x39'));this[_0xadcc('0x6')](_0xadcc('0x4c'),_0xadcc('0x39'));this[_0xadcc('0x6')]('dtlsenable',_0xadcc('0x39'));this[_0xadcc('0x6')](_0xadcc('0x4e'),'no');this['setDataValue']('dtlssetup',_0xadcc('0x44'));this[_0xadcc('0x6')](_0xadcc('0x50'),_0x487295[_0xadcc('0x50')]||_0xadcc('0x53'));this[_0xadcc('0x6')](_0xadcc('0x51'),_0x487295['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xadcc('0x6')](_0xadcc('0x54'),_0xadcc('0x39'));break;default:}}},'permissions':{'type':Sequelize[_0xadcc('0x46')],'set':function(_0x53dd61){this[_0xadcc('0x6')](_0xadcc('0x55'),_0x53dd61?_0x53dd61['join'](','):[]);},'get':function(){return this['getDataValue'](_0xadcc('0x55'))?_[_0xadcc('0x56')](this[_0xadcc('0xb')]('permissions')[_0xadcc('0x2a')](','),function(_0x5637b8){return parseInt(_0x5637b8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xadcc('0xc')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xadcc('0xc')]},'phoneBarBusyNumber':{'type':Sequelize[_0xadcc('0xc')]},'phoneBarUnconditional':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xadcc('0x57')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0xadcc('0xb')](_0xadcc('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xadcc('0xc')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![],'set':function(_0xd4d0f4){if(typeof _0xd4d0f4===_0xadcc('0x59')){var _0x571ea3=_0xd4d0f4==='1'?!![]:_0xd4d0f4==='0'?![]:_0xd4d0f4==='true'?!![]:_0xd4d0f4===_0xadcc('0x5a')?![]:![];this['setDataValue'](_0xadcc('0x5b'),_0x571ea3);}else{this[_0xadcc('0x6')](_0xadcc('0x5b'),_0xd4d0f4);}}},'blocked':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![],'set':function(_0x221f21){this[_0xadcc('0x6')](_0xadcc('0x5c'),_0x221f21);if(_0x221f21===!![]){this[_0xadcc('0x6')](_0xadcc('0x5d'),moment());this[_0xadcc('0x6')](_0xadcc('0x5e'),0x0);}else{this[_0xadcc('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xadcc('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xadcc('0x1b')](0x5)[_0xadcc('0x5f')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xadcc('0x1b')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xadcc('0x1a')],'defaultValue':![]}}; \ No newline at end of file +var _0xce63=['UNSIGNED','sequelize','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','info','inband','rfc2833','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','active','passive','actpass','nonat','update','update,nonat','TEXT','isArray','wss','encryption','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsenable','dtlsverify','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','string','true','screenrecording','loginAttempts','blockedAt'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xce63,0xaf));var _0x3ce6=function(_0x2967c1,_0x202a72){_0x2967c1=_0x2967c1-0x0;var _0x103397=_0xce63[_0x2967c1];return _0x103397;};'use strict';var Sequelize=require(_0x3ce6('0x0'));var moment=require('moment');var util=require('util');var _=require(_0x3ce6('0x1'));module['exports']={'name':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':![],'unique':_0x3ce6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4f2059){this[_0x3ce6('0x4')](_0x3ce6('0x3'),_0x4f2059);this['setDataValue'](_0x3ce6('0x5'),_0x4f2059);},'comment':_0x3ce6('0x6')},'fullname':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':![],'set':function(_0x3f57e7){this[_0x3ce6('0x4')](_0x3ce6('0x7'),_0x3f57e7);this[_0x3ce6('0x4')](_0x3ce6('0x8'),util[_0x3ce6('0x9')](_0x3ce6('0xa'),_0x3f57e7,this[_0x3ce6('0xb')](_0x3ce6('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x2e4b3a){if(_0x2e4b3a){this['setDataValue'](_0x3ce6('0xd'),_0x2e4b3a[_0x3ce6('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x3ce6('0xf'),_0x3ce6('0x10'),_0x3ce6('0x11'),_0x3ce6('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3ce6('0x2')],'defaultValue':_0x3ce6('0x13')},'internal':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':![],'unique':_0x3ce6('0xc'),'set':function(_0x2650f7){this['setDataValue'](_0x3ce6('0xc'),_0x2650f7);this[_0x3ce6('0x4')](_0x3ce6('0x15'),_0x2650f7);this['setDataValue']('callerid',util[_0x3ce6('0x9')]('\x22%s\x22\x20<%s>',this[_0x3ce6('0xb')](_0x3ce6('0x7')),_0x2650f7));}},'salt':{'type':Sequelize[_0x3ce6('0x2')]},'phone':{'type':Sequelize[_0x3ce6('0x2')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x3ce6('0x2')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x3ce6('0x2')]},'city':{'type':Sequelize[_0x3ce6('0x2')]},'country':{'type':Sequelize[_0x3ce6('0x2')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3ce6('0x16')]},'voicePause':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3ce6('0x2')],'defaultValue':_0x3ce6('0x18')},'lastPauseAt':{'type':Sequelize[_0x3ce6('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![],'defaultValue':_0x3ce6('0x19')},'ipaddr':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x3ce6('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x3ce6('0x1a'),_0x3ce6('0x10'),_0x3ce6('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![],'defaultValue':_0x3ce6('0x1c')},'callingpres':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x1e'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x3ce6('0x1f'),'PROHIB_NOT_SCREENED',_0x3ce6('0x20'),_0x3ce6('0x21'),_0x3ce6('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![],'defaultValue':_0x3ce6('0x23'),'set':function(_0xc21e09){this[_0x3ce6('0x4')](_0x3ce6('0x24'),_0xc21e09?_0xc21e09[_0x3ce6('0x25')](','):null);},'get':function(){return this[_0x3ce6('0xb')](_0x3ce6('0x24'))?this['getDataValue'](_0x3ce6('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x3ce6('0x1d')]('rfc2833',_0x3ce6('0x26'),'shortinfo',_0x3ce6('0x27'),'auto'),'allowNull':!![],'defaultValue':_0x3ce6('0x28')},'directmedia':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no','nonat','update',_0x3ce6('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![],'defaultValue':_0x3ce6('0x2a'),'set':function(_0x29aeb3){this[_0x3ce6('0x4')](_0x3ce6('0x2b'),_0x29aeb3?_0x29aeb3['join'](','):null);},'get':function(){return this[_0x3ce6('0xb')]('nat')?this[_0x3ce6('0xb')](_0x3ce6('0x2b'))[_0x3ce6('0x2c')](','):null;},'comment':_0x3ce6('0x2d')},'callgroup':{'type':Sequelize[_0x3ce6('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3ce6('0x2')]},'pickupgroup':{'type':Sequelize[_0x3ce6('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3ce6('0x2')]},'language':{'type':Sequelize[_0x3ce6('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':![],'defaultValue':_0x3ce6('0x2e')},'allow':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x451d14){this[_0x3ce6('0x4')](_0x3ce6('0x2f'),_0x451d14?_0x451d14['join'](';'):_0x3ce6('0x30'));},'get':function(){return this['getDataValue']('allow')?this[_0x3ce6('0xb')](_0x3ce6('0x2f'))[_0x3ce6('0x2c')](';'):null;},'comment':_0x3ce6('0x31')},'autoframing':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![],'set':function(_0x4f9b09){this[_0x3ce6('0x4')](_0x3ce6('0x32'),_0x4f9b09?_0x4f9b09[_0x3ce6('0x25')](','):null);},'get':function(){return this[_0x3ce6('0xb')](_0x3ce6('0x32'))?this[_0x3ce6('0xb')]('insecure')['split'](','):null;},'comment':_0x3ce6('0x33')},'trustrpid':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x3ce6('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no',_0x3ce6('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![],'defaultValue':_0x3ce6('0x36')},'amaflags':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x3ce6('0x34'),'no'),'allowNull':!![],'defaultValue':_0x3ce6('0x34')},'busylevel':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no',_0x3ce6('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x3ce6('0x38'),_0x3ce6('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x3a'),_0x3ce6('0x3b')),'allowNull':!![],'defaultValue':_0x3ce6('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![],'defaultValue':_0x3ce6('0x34')},'keepalive':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x3c'),_0x3ce6('0x3d'),_0x3ce6('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3ce6('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3ce6('0x1d')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no',_0x3ce6('0x3f'),_0x3ce6('0x40'),_0x3ce6('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x3ce6('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3ce6('0x42')]},'showWebBar':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0,'set':function(_0x404649){this['setDataValue']('showWebBar',_0x404649);var _0x41a688=this['get']({'plain':!![]});switch(_0x404649){case 0x0:case 0x1:var _0x39c24c=_0x41a688[_0x3ce6('0x24')]?_[_0x3ce6('0x43')](_0x41a688[_0x3ce6('0x24')])?_0x41a688[_0x3ce6('0x24')][_0x3ce6('0x25')]():_0x41a688[_0x3ce6('0x24')]:_0x3ce6('0x23');if(_0x39c24c===_0x3ce6('0x44')){_0x39c24c=_0x3ce6('0x23');}this[_0x3ce6('0x4')](_0x3ce6('0x24'),_0x39c24c);this['setDataValue'](_0x3ce6('0x45'),'no');this[_0x3ce6('0x4')](_0x3ce6('0x46'),null);this['setDataValue'](_0x3ce6('0x47'),null);this[_0x3ce6('0x4')](_0x3ce6('0x48'),null);this[_0x3ce6('0x4')]('dtlsenable',null);this[_0x3ce6('0x4')]('dtlsverify',null);this[_0x3ce6('0x4')](_0x3ce6('0x49'),null);this[_0x3ce6('0x4')](_0x3ce6('0x4a'),null);this['setDataValue'](_0x3ce6('0x4b'),null);this[_0x3ce6('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x3ce6('0x4')](_0x3ce6('0x24'),_0x3ce6('0x44'));this[_0x3ce6('0x4')]('encryption',_0x3ce6('0x34'));this[_0x3ce6('0x4')]('avpf',_0x3ce6('0x34'));this[_0x3ce6('0x4')](_0x3ce6('0x47'),_0x3ce6('0x34'));this[_0x3ce6('0x4')]('icesupport',_0x3ce6('0x34'));this[_0x3ce6('0x4')](_0x3ce6('0x4c'),_0x3ce6('0x34'));this[_0x3ce6('0x4')](_0x3ce6('0x4d'),'no');this[_0x3ce6('0x4')](_0x3ce6('0x49'),_0x3ce6('0x3e'));this[_0x3ce6('0x4')](_0x3ce6('0x4a'),_0x41a688[_0x3ce6('0x4a')]||_0x3ce6('0x4e'));this[_0x3ce6('0x4')](_0x3ce6('0x4b'),_0x41a688[_0x3ce6('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x3ce6('0x4')]('rtcp_mux',_0x3ce6('0x34'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x37ebc6){this[_0x3ce6('0x4')](_0x3ce6('0x4f'),_0x37ebc6?_0x37ebc6[_0x3ce6('0x25')](','):[]);},'get':function(){return this[_0x3ce6('0xb')]('permissions')?_['map'](this[_0x3ce6('0xb')](_0x3ce6('0x4f'))['split'](','),function(_0x5db720){return parseInt(_0x5db720,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3ce6('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x3ce6('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3ce6('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3ce6('0x1d')](_0x3ce6('0x34'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3ce6('0x2')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3ce6('0x50')],'get':function(){return this[_0x3ce6('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x3ce6('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3ce6('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3ce6('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4751f1){if(typeof _0x4751f1===_0x3ce6('0x51')){var _0x930e54=_0x4751f1==='1'?!![]:_0x4751f1==='0'?![]:_0x4751f1===_0x3ce6('0x52')?!![]:_0x4751f1==='false'?![]:![];this['setDataValue'](_0x3ce6('0x53'),_0x930e54);}else{this[_0x3ce6('0x4')](_0x3ce6('0x53'),_0x4751f1);}}},'blocked':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![],'set':function(_0x52e2bf){this[_0x3ce6('0x4')]('blocked',_0x52e2bf);if(_0x52e2bf===!![]){this[_0x3ce6('0x4')]('blockedAt',moment());this['setDataValue'](_0x3ce6('0x54'),0x0);}else{this[_0x3ce6('0x4')](_0x3ce6('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x3ce6('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x3ce6('0x14')](0x5)[_0x3ce6('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x3ce6('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x3ce6('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x3ce6('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 3416e08..b0c29a6 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 _0x1172=['addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','spread','QueueId','voice','SIP/%s','penalty','UserVoiceQueueRt','upsert','remove','addAvatar','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','join','server/files/images/','getOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','where','options','Unknown\x20role','getVoiceQueuesRt','pick','merge','getGroups','nolimit','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','PAUSE','LOGININPAUSE','resolve','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','smsPause','pauseType','lastPauseAt','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','firstName','lastName','CmContact','Contact','CmHopper','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','teams','VoiceQueue','inbound','flatten','toString','col','asc','desc','substring','uniqBy','orderBy','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','SELECT','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','util','path','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','register','redis','defaults','localhost','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','then','agent','emit','userNotification:recalc:','destroy','get','role','admin','Users','user','Agents','Telephones','filter','map','value','find','UserProfileResource','end','error','stack','name','send','User','rawAttributes','fieldName','type','key','salt','previousPasswords','md5secret','includes','index','getOptions','query','includeAll','include','userSetting','attributes','push','findAll','rows','openTabs','true','length','chat','dataValues','sms','openchannel','whatsapp','all','catch','show','params','fax','mail','update','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','min_internal','sequelize','QueryTypes','isNil','from','voicemail','mailbox','VoiceMail','password','fullname','email','permissions','101','102','104','105','106','108','100','111','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory'];(function(_0x24344a,_0x29a91c){var _0x47a43e=function(_0x86c371){while(--_0x86c371){_0x24344a['push'](_0x24344a['shift']());}};_0x47a43e(++_0x29a91c);}(_0x1172,0xee));var _0x2117=function(_0x5180bf,_0x24a7f4){_0x5180bf=_0x5180bf-0x0;var _0x375902=_0x1172[_0x5180bf];return _0x375902;};'use strict';var moment=require(_0x2117('0x0'));var util=require(_0x2117('0x1'));var path=require(_0x2117('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2117('0x3'));var Redis=require(_0x2117('0x4'));var authService=require('../../components/auth/service');var contacts=require(_0x2117('0x5'));var qs=require(_0x2117('0x6'));var rta=require(_0x2117('0x7'));var logger=require(_0x2117('0x8'))(_0x2117('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x2117('0xa'))[_0x2117('0xb')];var APINotFoundError=require(_0x2117('0xa'))[_0x2117('0xc')];var APIHandleError=require(_0x2117('0xa'))[_0x2117('0xd')];var db=require(_0x2117('0xe'))['db'];var socket=require(_0x2117('0xf'))(new Redis(config['redis']));require('./user.socket')[_0x2117('0x10')](socket);config[_0x2117('0x11')]=_[_0x2117('0x12')](config[_0x2117('0x11')],{'host':_0x2117('0x13'),'port':0x18eb});var values;function respondWithStatusCode(_0x4635e6,_0x15e7fc){_0x15e7fc=_0x15e7fc||0xcc;return function(_0x3e9336){if(_0x3e9336){return _0x4635e6[_0x2117('0x14')](_0x15e7fc);}return _0x4635e6['status'](_0x15e7fc)['end']();};}function respondWithResult(_0x2c18d7,_0x494c42){_0x494c42=_0x494c42||0xc8;return function(_0x3727f7){if(_0x3727f7){return _0x2c18d7['status'](_0x494c42)[_0x2117('0x15')](_0x3727f7);}};}function respondWithFilteredResult(_0x3c891e,_0x2daa48){return function(_0x21e031){if(_0x21e031){var _0x3f4abe=typeof _0x2daa48[_0x2117('0x16')]===_0x2117('0x17')&&typeof _0x2daa48[_0x2117('0x18')]===_0x2117('0x17');var _0x48918d=_0x21e031['count'];var _0x552ba9=_0x3f4abe?0x0:_0x2daa48['offset'];var _0x34cde4=_0x3f4abe?_0x21e031[_0x2117('0x19')]:_0x2daa48[_0x2117('0x16')]+_0x2daa48[_0x2117('0x18')];var _0x562d0d;if(_0x34cde4>=_0x48918d){_0x34cde4=_0x48918d;_0x562d0d=0xc8;}else{_0x562d0d=0xce;}_0x3c891e[_0x2117('0x1a')](_0x562d0d);return _0x3c891e[_0x2117('0x1b')](_0x2117('0x1c'),_0x552ba9+'-'+_0x34cde4+'/'+_0x48918d)['json'](_0x21e031);}return null;};}function saveUpdates(_0x1795f4){return function(_0x97fabc){if(_0x97fabc){return _0x97fabc['update'](_0x1795f4)[_0x2117('0x1d')](function(_0x5ec367){if(_0x5ec367['role']===_0x2117('0x1e')){socket[_0x2117('0x1f')](_0x2117('0x20')+_0x5ec367['id'],_0x5ec367);}return _0x5ec367;});}return null;};}function removeEntity(_0x13e197){return function(_0x25395a){if(_0x25395a){return _0x25395a[_0x2117('0x21')]()[_0x2117('0x1d')](function(){var _0x3a82da=_0x25395a[_0x2117('0x22')]({'plain':!![]});if(_0x3a82da[_0x2117('0x23')]===_0x2117('0x24'))return;var _0x351b18=[{'name':_0x2117('0x25'),'value':_0x2117('0x26'),'ignore':!![]},{'name':_0x2117('0x27'),'value':_0x2117('0x1e'),'ignore':![]},{'name':_0x2117('0x28'),'value':'telephone','ignore':![]}];var _0x533c7d=_(_0x351b18)[_0x2117('0x29')]('ignore')[_0x2117('0x2a')](_0x2117('0x2b'))['value']();if(_['includes'](_0x533c7d,_0x3a82da['role'])){return;}var _0xdea721=_[_0x2117('0x2c')](_0x351b18,['value',_0x3a82da[_0x2117('0x23')]])['name'];return db[_0x2117('0x2d')][_0x2117('0x21')]({'where':{'type':_0xdea721,'resourceId':_0x3a82da['id']}})[_0x2117('0x1d')](function(){return _0x25395a;});})[_0x2117('0x1d')](function(){_0x13e197[_0x2117('0x1a')](0xcc)[_0x2117('0x2e')]();});}};}function handleEntityNotFound(_0x3665ba){return function(_0x416d5a){if(!_0x416d5a){_0x3665ba[_0x2117('0x14')](0x194);}return _0x416d5a;};}function handleError(_0x398d35,_0x31960f){_0x31960f=_0x31960f||0x1f4;return function(_0x27030c){logger[_0x2117('0x2f')](_0x27030c[_0x2117('0x30')]);if(_0x27030c['name']){delete _0x27030c[_0x2117('0x31')];}_0x398d35[_0x2117('0x1a')](_0x31960f)[_0x2117('0x32')](_0x27030c);};}function getUserAttributes(){return _(db[_0x2117('0x33')][_0x2117('0x34')])[_0x2117('0x2a')](function(_0x27a9da){return{'name':_0x27a9da[_0x2117('0x35')],'type':_0x27a9da[_0x2117('0x36')][_0x2117('0x37')]};})[_0x2117('0x29')](function(_0x2d0dfb){return!['password',_0x2117('0x38'),_0x2117('0x39'),'resetPasswordToken','resetPasswordExpires',_0x2117('0x3a')][_0x2117('0x3b')](_0x2d0dfb[_0x2117('0x31')]);})['value']();}exports[_0x2117('0x3c')]=function(_0x10b5bb,_0xdcc409){var _0x4f06bc={},_0x46ea8f={'count':0x0,'rows':[]};var _0x4fadbd=getUserAttributes();_0x4f06bc=qs[_0x2117('0x3d')](_0x4fadbd,_0x10b5bb);var _0x12918d={'where':_0x4f06bc['where']};return db[_0x2117('0x33')][_0x2117('0x19')](_0x12918d)[_0x2117('0x1d')](function(_0x4b7036){_0x46ea8f[_0x2117('0x19')]=_0x4b7036;if(_0x10b5bb[_0x2117('0x3e')][_0x2117('0x3f')]){_0x4f06bc[_0x2117('0x40')]=[{'all':!![]}];}if(_0x10b5bb['query']['userSetting']==='true'){_0x4f06bc[_0x2117('0x40')]=[{'model':db['UserSetting'],'as':_0x2117('0x41')}];}if(!_[_0x2117('0x3b')](_0x4f06bc[_0x2117('0x42')],'id')){_0x4f06bc['attributes'][_0x2117('0x43')]('id');}return db[_0x2117('0x33')][_0x2117('0x44')](_0x4f06bc);})[_0x2117('0x1d')](function(_0x11a98f){_0x46ea8f[_0x2117('0x45')]=_0x11a98f;if(_0x10b5bb[_0x2117('0x3e')][_0x2117('0x46')]===_0x2117('0x47')){var _0x5be04c=[];for(var _0x240727=0x0;_0x240727<_0x46ea8f['rows'][_0x2117('0x48')];_0x240727++){_0x5be04c[_0x2117('0x43')](get_open_tabs(_0x2117('0x49'),_0x46ea8f[_0x2117('0x45')][_0x240727][_0x2117('0x4a')]));_0x5be04c['push'](get_open_tabs(_0x2117('0x4b'),_0x46ea8f[_0x2117('0x45')][_0x240727][_0x2117('0x4a')]));_0x5be04c[_0x2117('0x43')](get_open_tabs('fax',_0x46ea8f[_0x2117('0x45')][_0x240727][_0x2117('0x4a')]));_0x5be04c[_0x2117('0x43')](get_open_tabs('mail',_0x46ea8f['rows'][_0x240727][_0x2117('0x4a')]));_0x5be04c[_0x2117('0x43')](get_open_tabs(_0x2117('0x4c'),_0x46ea8f[_0x2117('0x45')][_0x240727][_0x2117('0x4a')]));_0x5be04c[_0x2117('0x43')](get_open_tabs(_0x2117('0x4d'),_0x46ea8f[_0x2117('0x45')][_0x240727][_0x2117('0x4a')]));}return Promise[_0x2117('0x4e')](_0x5be04c)[_0x2117('0x1d')](function(){return _0x46ea8f;});}else{return _0x46ea8f;}})[_0x2117('0x1d')](respondWithFilteredResult(_0xdcc409,_0x4f06bc))[_0x2117('0x4f')](handleError(_0xdcc409,null));};exports[_0x2117('0x50')]=function(_0xfcc5ff,_0x616e26){var _0x40d46f=getUserAttributes();_0xfcc5ff[_0x2117('0x3e')]['id']=_0xfcc5ff[_0x2117('0x51')]['id'];var _0xd513bd=qs['getOptions'](_0x40d46f,_0xfcc5ff);if(_0xfcc5ff[_0x2117('0x3e')][_0x2117('0x3f')]){_0xd513bd['include']=[{'all':!![]}];}if(_0xfcc5ff[_0x2117('0x3e')][_0x2117('0x41')]===_0x2117('0x47')){_0xd513bd[_0x2117('0x40')]=[{'model':db['UserSetting'],'as':_0x2117('0x41')}];}_0xd513bd=_['merge']({},_0xd513bd,_0xfcc5ff['options']);if(!_[_0x2117('0x3b')](_0xd513bd[_0x2117('0x42')],'id')){_0xd513bd[_0x2117('0x42')][_0x2117('0x43')]('id');}return db['User'][_0x2117('0x2c')](_0xd513bd)[_0x2117('0x1d')](handleEntityNotFound(_0x616e26,null))[_0x2117('0x1d')](function(_0x2567e8){var _0x8afaeb=[];values=_0x2567e8;if(_0xfcc5ff[_0x2117('0x3e')][_0x2117('0x46')]===_0x2117('0x47')){_0x8afaeb['push'](get_open_tabs(_0x2117('0x49'),_0x2567e8[_0x2117('0x4a')]));_0x8afaeb[_0x2117('0x43')](get_open_tabs(_0x2117('0x4b'),_0x2567e8[_0x2117('0x4a')]));_0x8afaeb['push'](get_open_tabs(_0x2117('0x4c'),_0x2567e8[_0x2117('0x4a')]));_0x8afaeb[_0x2117('0x43')](get_open_tabs(_0x2117('0x4d'),_0x2567e8[_0x2117('0x4a')]));_0x8afaeb['push'](get_open_tabs(_0x2117('0x52'),_0x2567e8['dataValues']));_0x8afaeb[_0x2117('0x43')](get_open_tabs(_0x2117('0x53'),_0x2567e8[_0x2117('0x4a')]));return Promise[_0x2117('0x4e')](_0x8afaeb);}else{return values;}})[_0x2117('0x1d')](function(){return values;})[_0x2117('0x1d')](respondWithResult(_0x616e26,null))[_0x2117('0x4f')](handleError(_0x616e26,null));};exports[_0x2117('0x54')]=function(_0x17603d,_0x14bf31){if(_0x17603d['body']['id']){delete _0x17603d['body']['id'];}delete _0x17603d[_0x2117('0x55')][_0x2117('0x23')];return db[_0x2117('0x33')][_0x2117('0x2c')]({'where':{'id':_0x17603d['params']['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x14bf31,null))['then'](saveUpdates(_0x17603d[_0x2117('0x55')],null))['then'](respondWithResult(_0x14bf31,null))[_0x2117('0x4f')](handleError(_0x14bf31,null));};exports[_0x2117('0x56')]=function(_0x320ac1,_0x2c47ce){return db[_0x2117('0x33')][_0x2117('0x56')]()['then'](respondWithResult(_0x2c47ce,null))['catch'](handleError(_0x2c47ce,null));};exports['addContacts']=function(_0x434838,_0x514113){return db['User'][_0x2117('0x2c')]({'where':{'id':_0x434838[_0x2117('0x51')]['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x514113,null))[_0x2117('0x1d')](function(_0x55bab0){if(_0x55bab0){return _0x55bab0[_0x2117('0x57')](_0x434838[_0x2117('0x55')][_0x2117('0x58')],_[_0x2117('0x59')](_0x434838[_0x2117('0x55')],[_0x2117('0x58'),'id'])||{});}})[_0x2117('0x1d')](respondWithResult(_0x514113,null))[_0x2117('0x4f')](handleError(_0x514113,null));};function validateUser(_0x387371){return new Promise(function(_0x437b56,_0x9f036e){if(_0x387371[_0x2117('0x5a')])return _0x437b56(_0x387371);return db['Setting'][_0x2117('0x5b')](0x1)['then'](function(_0x2f51a5){if(_0x2f51a5[_0x2117('0x5c')])authService[_0x2117('0x5d')](_0x387371['password']);db[_0x2117('0x33')][_0x2117('0x5e')](_0x2117('0x5a'))['then'](function(_0x57e2ea){if(_['isNil'](_0x57e2ea)){_0x387371[_0x2117('0x5a')]=_0x2f51a5[_0x2117('0x5f')]||0x1;return;}if(_['isNil'](_0x2f51a5[_0x2117('0x5f')])||_0x2f51a5[_0x2117('0x5f')]===_0x57e2ea){_0x387371[_0x2117('0x5a')]=_0x57e2ea+0x1;return;}if(_0x2f51a5['min_internal']>_0x57e2ea){_0x387371[_0x2117('0x5a')]=_0x2f51a5['min_internal'];return;}return db[_0x2117('0x60')]['query']('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['sequelize'][_0x2117('0x61')]['SELECT']})[_0x2117('0x1d')](function(_0x3b3ed3){if(_0x3b3ed3&&_0x3b3ed3[_0x2117('0x48')]){for(var _0x1815a9=0x0,_0x4349cc=_0x3b3ed3['length'];_0x1815a9<_0x4349cc&&_[_0x2117('0x62')](_0x387371[_0x2117('0x5a')]);_0x1815a9++){if(_0x2f51a5[_0x2117('0x5f')]<=_0x3b3ed3[_0x1815a9][_0x2117('0x63')]){_0x387371['internal']=_0x3b3ed3[_0x1815a9][_0x2117('0x63')];}else if(_0x2f51a5[_0x2117('0x5f')]>_0x3b3ed3[_0x1815a9]['from']&&_0x2f51a5[_0x2117('0x5f')]<=_0x3b3ed3[_0x1815a9]['to']){_0x387371[_0x2117('0x5a')]=_0x2f51a5[_0x2117('0x5f')];}}}if(_[_0x2117('0x62')](_0x387371[_0x2117('0x5a')])){_0x387371[_0x2117('0x5a')]=_0x57e2ea+0x1;}return _0x437b56(_0x387371);});});})['catch'](function(_0x36923f){_0x9f036e(_0x36923f);});});}function updateUser(_0x4fe38a){return new Promise(function(_0x2c9568,_0x182bef){try{if(_0x4fe38a[_0x2117('0x64')]){_0x4fe38a[_0x2117('0x65')]=_0x4fe38a[_0x2117('0x5a')];_0x4fe38a[_0x2117('0x66')]={'mailbox':_0x4fe38a[_0x2117('0x5a')],'password':_0x4fe38a[_0x2117('0x67')],'fullname':_0x4fe38a[_0x2117('0x68')],'email':_0x4fe38a[_0x2117('0x69')]};}if(_0x4fe38a['role']===_0x2117('0x1e')){if(!_0x4fe38a[_0x2117('0x6a')])_0x4fe38a['permissions']=[_0x2117('0x6b'),_0x2117('0x6c'),'103','113','110',_0x2117('0x6d'),_0x2117('0x6e'),_0x2117('0x6f'),'107',_0x2117('0x70'),'109',_0x2117('0x71'),_0x2117('0x72'),'114',_0x2117('0x73')];}_0x2c9568(_0x4fe38a);}catch(_0x29fe4b){_0x182bef(_0x29fe4b);}});}exports['create']=function(_0xc5608d,_0x5f053a){if(_0xc5608d[_0x2117('0x26')][_0x2117('0x23')]===_0x2117('0x1e'))throw new Error(_0x2117('0x74'));if(_0xc5608d[_0x2117('0x55')]['role']===_0x2117('0x26')&&_0xc5608d[_0x2117('0x26')][_0x2117('0x23')]!==_0x2117('0x24')){throw new Error(_0x2117('0x75'));}if(_0xc5608d['body'][_0x2117('0x23')]===_0x2117('0x24')&&_0xc5608d[_0x2117('0x26')][_0x2117('0x23')]!==_0x2117('0x24')){throw new Error(_0x2117('0x76'));}return licenseUtil[_0x2117('0x77')]([_0xc5608d[_0x2117('0x55')]])['then'](function(){return validateUser(_0xc5608d['body']);})['then'](function(_0x4c5db5){return updateUser(_0x4c5db5)[_0x2117('0x1d')](function(_0x4c3e02){if(_0x4c3e02[_0x2117('0x23')]===_0x2117('0x24')){_0x4c3e02[_0x2117('0x78')]=_0xc5608d[_0x2117('0x26')][_0x2117('0x78')];delete _0x4c3e02[_0x2117('0x79')];}return _0x4c3e02;});})[_0x2117('0x1d')](function(_0x2259a9){return db['User'][_0x2117('0x7a')](_0x2259a9,{'include':[{'model':db[_0x2117('0x66')],'as':_0x2117('0x66')}]});})[_0x2117('0x1d')](function(_0x4dad9b){if(_0xc5608d[_0x2117('0x55')][_0x2117('0x23')]==='user')return _0x4dad9b;if(_0xc5608d['user'][_0x2117('0x23')]!=='user')return _0x4dad9b;return db[_0x2117('0x7b')][_0x2117('0x2c')]({'where':{'name':_0x4dad9b[_0x2117('0x23')]===_0x2117('0x1e')?_0x2117('0x27'):'Telephones','userProfileId':_0xc5608d['user'][_0x2117('0x79')]},'raw':!![]})[_0x2117('0x1d')](function(_0x52d5a0){if(!_0x52d5a0||_0x52d5a0[_0x2117('0x7c')]!=0x0)return _0x4dad9b;return db[_0x2117('0x2d')][_0x2117('0x7a')]({'name':_0x4dad9b['name'],'resourceId':_0x4dad9b['id'],'type':_0x52d5a0[_0x2117('0x31')],'sectionId':_0x52d5a0['id']},{})[_0x2117('0x1d')](function(){return _0x4dad9b;});})[_0x2117('0x4f')](function(_0x72b99f){logger[_0x2117('0x2f')](_0x2117('0x7d'),_0x72b99f);throw _0x72b99f;});})[_0x2117('0x1d')](respondWithResult(_0x5f053a,0xc9))[_0x2117('0x4f')](handleError(_0x5f053a,null));};exports[_0x2117('0x7e')]=function(_0x4a7e32,_0x34c8c9){var _0x2cb8a4=_0x4a7e32['body'];var _0x74120f=[];if(_0x4a7e32['user']['role']===_0x2117('0x1e'))throw new Error('Unauthorized');if(_['some'](_0x2cb8a4,[_0x2117('0x23'),'user'])&&_0x4a7e32['user'][_0x2117('0x23')]!==_0x2117('0x24')){throw new Error(_0x2117('0x75'));}if(_[_0x2117('0x7f')](_0x2cb8a4,[_0x2117('0x23'),_0x2117('0x24')])&&_0x4a7e32[_0x2117('0x26')][_0x2117('0x23')]!==_0x2117('0x24')){throw new Error(_0x2117('0x80'));}return licenseUtil[_0x2117('0x77')](_0x2cb8a4)[_0x2117('0x1d')](function(){return validateUser(_0x2cb8a4[0x0]);})['then'](function(){for(var _0x5afa46=0x1;_0x5afa46<_0x2cb8a4[_0x2117('0x48')];_0x5afa46++){var _0x30e74b=_0x2cb8a4[_0x5afa46-0x1][_0x2117('0x5a')];if(!_0x2cb8a4[_0x5afa46][_0x2117('0x5a')])_0x2cb8a4[_0x5afa46]['internal']=_0x30e74b+0x1;_0x74120f[_0x2117('0x43')](validateUser(_0x2cb8a4[_0x5afa46]));}return Promise['all'](_0x74120f);})[_0x2117('0x1d')](function(){_0x74120f=[];for(var _0x22e306=0x0;_0x22e306<_0x2cb8a4['length'];_0x22e306++){_0x74120f[_0x2117('0x43')](updateUser(_0x2cb8a4[_0x22e306]));}return Promise['all'](_0x74120f);})['then'](function(){_0x74120f=_0x2cb8a4[_0x2117('0x2a')](function(_0x53f7e2){return db['User'][_0x2117('0x7a')](_0x53f7e2,{'include':[{'model':db[_0x2117('0x66')],'as':_0x2117('0x66')}]})[_0x2117('0x1d')](function(_0x1e052c){_0x53f7e2['id']=_0x1e052c['id'];return _0x53f7e2;});});return Promise['all'](_0x74120f);})['then'](function(_0x1c2c7f){if(_0x4a7e32[_0x2117('0x55')][_0x2117('0x23')]==='user')return _0x1c2c7f;if(_0x4a7e32[_0x2117('0x26')]['role']!==_0x2117('0x26'))return _0x1c2c7f;var _0x2b73fb=_[_0x2117('0x7f')](_0x1c2c7f,function(_0x438c0b){return _0x438c0b[_0x2117('0x23')]===_0x2117('0x1e')||_0x438c0b['role']===_0x2117('0x81');});if(!_0x2b73fb)return _0x1c2c7f;return db[_0x2117('0x7b')][_0x2117('0x44')]({'where':{'name':{'$or':[_0x2117('0x27'),'Telephones']},'userProfileId':_0x4a7e32[_0x2117('0x26')][_0x2117('0x79')]},'raw':!![]})[_0x2117('0x1d')](function(_0x4c80b2){if(_[_0x2117('0x82')](_0x4c80b2)||!_[_0x2117('0x7f')](_0x4c80b2,[_0x2117('0x7c'),0x0]))return _0x1c2c7f;_0x74120f=[];var _0x402e04=_(_0x4c80b2)[_0x2117('0x2a')](function(_0x381888){if(_0x381888[_0x2117('0x7c')]===0x1)return;return _0x381888[_0x2117('0x31')]==='Agents'?_0x2117('0x1e'):_0x2117('0x81');})[_0x2117('0x83')]()[_0x2117('0x2b')]();for(var _0x45c70b=0x0;_0x45c70b<_0x1c2c7f[_0x2117('0x48')];_0x45c70b++){if(!_[_0x2117('0x3b')](_0x402e04,_0x1c2c7f[_0x45c70b][_0x2117('0x23')]))return;var _0x53321b=_0x1c2c7f[_0x45c70b]['role']==='agent'?'Agents':_0x2117('0x28');_0x74120f['push'](db[_0x2117('0x2d')][_0x2117('0x7a')]({'name':_0x1c2c7f[_0x45c70b]['name'],'resourceId':_0x1c2c7f[_0x45c70b]['id'],'type':_0x53321b,'sectionId':_[_0x2117('0x2c')](_0x4c80b2,[_0x2117('0x31'),_0x53321b])['id']},{}));}return Promise[_0x2117('0x4e')](_0x74120f);});})['then'](respondWithResult(_0x34c8c9,0xc9))['catch'](handleError(_0x34c8c9,null));};exports[_0x2117('0x84')]=function(_0x50e99a,_0x4533df){if(_0x50e99a[_0x2117('0x55')]['id']){delete _0x50e99a['body']['id'];}return db['User']['find']({'where':{'id':_0x50e99a[_0x2117('0x51')]['id']}})[_0x2117('0x1d')](function(_0x5d0a14){if(!_0x5d0a14)return null;if(_0x5d0a14['id']===_0x50e99a[_0x2117('0x26')]['id']){if(!_0x50e99a['body'][_0x2117('0x85')]||!_0x50e99a[_0x2117('0x55')][_0x2117('0x86')]){throw new db['Sequelize'][(_0x2117('0x87'))](_0x2117('0x88'));}if(!_0x5d0a14[_0x2117('0x89')](_0x50e99a[_0x2117('0x55')][_0x2117('0x85')])){throw new db[(_0x2117('0x8a'))][(_0x2117('0x87'))](_0x2117('0x8b'));}if(_0x50e99a[_0x2117('0x55')]['oldPassword']===_0x50e99a['body']['newPassword']){throw new db[(_0x2117('0x8a'))][(_0x2117('0x87'))](_0x2117('0x8c'));}}else if(_0x50e99a['user'][_0x2117('0x23')]===_0x2117('0x24')){if(!_0x50e99a['body']['newPassword']){throw new db['Sequelize'][(_0x2117('0x87'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x50e99a[_0x2117('0x26')][_0x2117('0x23')]==='user'){if(!_0x50e99a['body']['newPassword']){throw new db[(_0x2117('0x8a'))]['ValidationError'](_0x2117('0x8d'));}if(_0x5d0a14['role']!=='agent'){throw new db[(_0x2117('0x8a'))][(_0x2117('0x87'))]('Unauthorized');}}else{throw new db[(_0x2117('0x8a'))][(_0x2117('0x87'))](_0x2117('0x74'));}return _0x5d0a14;})[_0x2117('0x1d')](handleEntityNotFound(_0x4533df,null))[_0x2117('0x1d')](function(_0x325725){return db[_0x2117('0x8e')][_0x2117('0x8f')]({'attributes':['id',_0x2117('0x5c'),_0x2117('0x90'),_0x2117('0x91')]})[_0x2117('0x1d')](function(_0x12631c){if(_0x12631c[_0x2117('0x5c')])authService[_0x2117('0x5d')](_0x50e99a['body'][_0x2117('0x86')]);if(!_0x12631c[_0x2117('0x90')]||!_0x325725['previousPasswords'])return _0x325725;authService['validatePasswordHistory'](_0x50e99a['body'][_0x2117('0x86')],_0x325725['previousPasswords'],_0x12631c['passwordHistoryLimit']);return _0x325725;})['then'](saveUpdates({'password':_0x50e99a[_0x2117('0x55')][_0x2117('0x86')],'passwordResetAt':_0x50e99a[_0x2117('0x26')]['id']==_0x50e99a['params']['id']?moment():null,'previousPasswords':authService[_0x2117('0x92')](_0x50e99a[_0x2117('0x55')][_0x2117('0x86')],_0x325725['previousPasswords'])},null));})[_0x2117('0x1d')](respondWithResult(_0x4533df,null))[_0x2117('0x4f')](handleError(_0x4533df,null));};exports[_0x2117('0x93')]=function(_0x2a1542,_0x520dbe){var _0x148159=_0x2a1542[_0x2117('0x55')][_0x2117('0x94')];return db[_0x2117('0x33')][_0x2117('0x2c')]({'where':{'id':_0x2a1542[_0x2117('0x51')]['id']},'attributes':['id',_0x2117('0x31'),_0x2117('0x23'),_0x2117('0x95'),_0x2117('0x96'),_0x2117('0x97'),_0x2117('0x98')]})[_0x2117('0x1d')](handleEntityNotFound(_0x520dbe,null))[_0x2117('0x1d')](function(_0x44760e){if(_0x44760e){if(!utils[_0x2117('0x99')](_0x148159)){throw new db[(_0x2117('0x8a'))]['ValidationError'](_0x2117('0x9a'));}return _0x44760e['add'+_[_0x2117('0x9b')](_0x148159[_0x2117('0x9c')]())+_0x2117('0x9d')](_0x2a1542[_0x2117('0x55')][_0x2117('0x58')],{'penalty':_0x2a1542[_0x2117('0x55')]['penalty']||0x0})[_0x2117('0x9e')](function(_0x1f8d9c){for(var _0x54966d=0x0;_0x54966d<_0x2a1542[_0x2117('0x55')][_0x2117('0x58')][_0x2117('0x48')];_0x54966d+=0x1){var _0x12c71b={'UserId':Number(_0x2a1542[_0x2117('0x51')]['id'])};_0x12c71b[_[_0x2117('0x9b')](_0x148159['toLowerCase']())+_0x2117('0x9f')]=Number(_0x2a1542[_0x2117('0x55')][_0x2117('0x58')][_0x54966d]);socket[_0x2117('0x1f')](_0x2117('0x26')+_[_0x2117('0x9b')](_0x148159['toLowerCase']())+'Queue:save',_0x12c71b);}return _0x1f8d9c;})[_0x2117('0x1d')](function(){if(_0x148159==='voice'){return db['VoiceQueue']['findAll']({'where':{'id':_0x2a1542[_0x2117('0x55')][_0x2117('0x58')]||[]},'raw':!![],'attributes':['id',_0x2117('0x31')]});}})[_0x2117('0x1d')](function(_0x24b1aa){var _0x29230a=_0x44760e[_0x2117('0x22')]({'plain':!![]});var _0x2f0ee6=[];if(_0x148159===_0x2117('0xa0')&&_0x29230a[_0x2117('0x23')]===_0x2117('0x1e')&&_0x29230a[_0x2117('0x95')]){for(let _0x13407b=0x0;_0x13407b<_0x24b1aa[_0x2117('0x48')];_0x13407b+=0x1){_0x2f0ee6['push']({'membername':_0x29230a['name'],'UserId':_0x29230a['id'],'queue_name':_0x24b1aa[_0x13407b]['name'],'VoiceQueueId':_0x24b1aa[_0x13407b]['id'],'interface':_[_0x2117('0x62')](_0x29230a[_0x2117('0x98')])?util['format'](_0x2117('0xa1'),_0x29230a[_0x2117('0x31')]):_0x29230a['interface'],'paused':_0x29230a[_0x2117('0x97')]||![],'penalty':_0x2a1542[_0x2117('0x55')][_0x2117('0xa2')]||0x0});}return Promise[_0x2117('0x4e')](_0x2f0ee6['map'](function(_0x251258){return db[_0x2117('0xa3')][_0x2117('0xa4')](_0x251258);}));}return _0x44760e;});}})[_0x2117('0x1d')](respondWithStatusCode(_0x520dbe,null))['catch'](handleError(_0x520dbe,null));};exports['removeQueues']=function(_0x20ebea,_0x378ff1){var _0x5b289b,_0x11a859;return db['User'][_0x2117('0x2c')]({'where':{'id':_0x20ebea['params']['id']},'attributes':['id','name',_0x2117('0x23')]})[_0x2117('0x1d')](handleEntityNotFound(_0x378ff1,null))['then'](function(_0x109e7c){if(_0x109e7c){_0x5b289b=_0x109e7c;if(!_0x20ebea[_0x2117('0x3e')][_0x2117('0x94')]||!utils[_0x2117('0x99')](_0x20ebea[_0x2117('0x3e')][_0x2117('0x94')])){throw new db['Sequelize'][(_0x2117('0x87'))]('Unknown\x20channel');}return _0x109e7c[_0x2117('0xa5')+_[_0x2117('0x9b')](_0x20ebea[_0x2117('0x3e')][_0x2117('0x94')][_0x2117('0x9c')]())+_0x2117('0x9d')](_0x20ebea[_0x2117('0x3e')][_0x2117('0x58')]);}})[_0x2117('0x1d')](function(_0x13be0c){if(_['isArray'](_0x20ebea['query'][_0x2117('0x58')])){for(var _0x4c687b=0x0;_0x4c687b<_0x20ebea[_0x2117('0x3e')][_0x2117('0x58')]['length'];_0x4c687b+=0x1){_0x11a859={'UserId':Number(_0x20ebea['params']['id'])};_0x11a859[_[_0x2117('0x9b')](_0x20ebea[_0x2117('0x3e')][_0x2117('0x94')][_0x2117('0x9c')]())+_0x2117('0x9f')]=Number(_0x20ebea[_0x2117('0x3e')]['ids'][_0x4c687b]);socket[_0x2117('0x1f')]('user'+_['capitalize'](_0x20ebea['query'][_0x2117('0x94')][_0x2117('0x9c')]())+'Queue:remove',_0x11a859);}}else{_0x11a859={'UserId':Number(_0x20ebea[_0x2117('0x51')]['id'])};_0x11a859[_[_0x2117('0x9b')](_0x20ebea['query'][_0x2117('0x94')][_0x2117('0x9c')]())+'QueueId']=Number(_0x20ebea[_0x2117('0x3e')][_0x2117('0x58')]);socket[_0x2117('0x1f')]('user'+_[_0x2117('0x9b')](_0x20ebea[_0x2117('0x3e')][_0x2117('0x94')][_0x2117('0x9c')]())+'Queue:remove',_0x11a859);}return _0x13be0c;})[_0x2117('0x1d')](function(){if(_0x20ebea['query'][_0x2117('0x94')]===_0x2117('0xa0')){return db[_0x2117('0xa3')][_0x2117('0x21')]({'where':{'UserId':_0x20ebea[_0x2117('0x51')]['id'],'VoiceQueueId':_0x20ebea[_0x2117('0x3e')][_0x2117('0x58')]},'individualHooks':!![]})[_0x2117('0x1d')](function(){return _0x5b289b;});}return _0x5b289b;})[_0x2117('0x1d')](respondWithStatusCode(_0x378ff1,null))[_0x2117('0x4f')](handleError(_0x378ff1,null));};exports[_0x2117('0xa6')]=function(_0x53a5f8,_0x32bacb){_0x53a5f8[_0x2117('0x55')]['userpic']=_0x53a5f8['file'][_0x2117('0xa7')];return db['User'][_0x2117('0x2c')]({'where':{'id':_0x53a5f8[_0x2117('0x51')]['id']}})['then'](handleEntityNotFound(_0x32bacb,null))[_0x2117('0x1d')](saveUpdates(_0x53a5f8['body'],null))[_0x2117('0x1d')](respondWithResult(_0x32bacb,null))['catch'](handleError(_0x32bacb,null));};exports[_0x2117('0xa8')]=function(_0x3efe10,_0x3a7c01){var _0x522942=path['join'](config[_0x2117('0xa9')],_0x2117('0xaa'));return db[_0x2117('0x33')][_0x2117('0x2c')]({'where':{'id':_0x3efe10['params']['id']},'attributes':['id',_0x2117('0xab')],'raw':!![]})['then'](handleEntityNotFound(_0x3a7c01,null))['then'](function(_0x172d58){if(_0x172d58){if(_[_0x2117('0x62')](_0x172d58[_0x2117('0xab')])){return _0x3a7c01[_0x2117('0xac')](_0x522942);}else{if(!fs[_0x2117('0xad')](path[_0x2117('0xae')](config[_0x2117('0xa9')],_0x2117('0xaf'),_0x172d58[_0x2117('0xab')]))){return _0x3a7c01[_0x2117('0xac')](_0x522942);}return _0x3a7c01[_0x2117('0xac')](path[_0x2117('0xae')](config['root'],_0x2117('0xaf'),_0x172d58[_0x2117('0xab')]));}}})['catch'](handleError(_0x3a7c01,null));};exports[_0x2117('0xb0')]=function(_0xe19a80,_0x5c16eb){return db[_0x2117('0x33')][_0x2117('0x2c')]({'where':{'id':_0xe19a80[_0x2117('0x51')]['id']},'attributes':['id']})[_0x2117('0x1d')](handleEntityNotFound(_0x5c16eb,null))[_0x2117('0x1d')](function(_0x37c855){var _0x272175=[];values=_0x37c855['dataValues'];_0x272175[_0x2117('0x43')](get_open_tabs(_0x2117('0x49'),_0x37c855[_0x2117('0x4a')]));_0x272175[_0x2117('0x43')](get_open_tabs(_0x2117('0x4b'),_0x37c855[_0x2117('0x4a')]));_0x272175[_0x2117('0x43')](get_open_tabs(_0x2117('0x4c'),_0x37c855[_0x2117('0x4a')]));_0x272175['push'](get_open_tabs(_0x2117('0x4d'),_0x37c855[_0x2117('0x4a')]));_0x272175['push'](get_open_tabs(_0x2117('0x52'),_0x37c855[_0x2117('0x4a')]));_0x272175[_0x2117('0x43')](get_open_tabs('mail',_0x37c855['dataValues']));return Promise[_0x2117('0x4e')](_0x272175);})[_0x2117('0x1d')](function(_0x47039f){if(_0x47039f){var _0x3a1aef=_[_0x2117('0x2a')](values['ChatOpenTabs'],function(_0xa2229b){return{'channel':'CHAT','id':_0xa2229b['id'],'createdAt':_0xa2229b[_0x2117('0xb1')]};});var _0x495848=_[_0x2117('0x2a')](values[_0x2117('0xb2')],function(_0x59c3d4){return{'channel':_0x2117('0xb3'),'id':_0x59c3d4['id'],'createdAt':_0x59c3d4[_0x2117('0xb1')]};});var _0x2f8e6a=_[_0x2117('0x2a')](values[_0x2117('0xb4')],function(_0x578520){return{'channel':'OPENCHANNEL','id':_0x578520['id'],'createdAt':_0x578520['createdAt']};});var _0x358192=_[_0x2117('0x2a')](values[_0x2117('0xb5')],function(_0x2a1b18){return{'channel':_0x2117('0xb6'),'id':_0x2a1b18['id'],'createdAt':_0x2a1b18[_0x2117('0xb1')]};});var _0x5ac47e=_[_0x2117('0x2a')](values[_0x2117('0xb7')],function(_0x2a56c0){return{'channel':_0x2117('0xb8'),'id':_0x2a56c0['id'],'createdAt':_0x2a56c0[_0x2117('0xb1')]};});var _0x4ce90a=_[_0x2117('0x2a')](values[_0x2117('0xb9')],function(_0xd64e6c){return{'channel':_0x2117('0xba'),'id':_0xd64e6c['id'],'createdAt':_0xd64e6c[_0x2117('0xb1')]};});var _0x16cd1c=_[_0x2117('0xbb')](_0x3a1aef,_0x495848,_0x2f8e6a,_0x358192,_0x5ac47e,_0x4ce90a);var _0x5ba3de={'count':_0x16cd1c[_0x2117('0x48')],'rows':_0x16cd1c};return _0x5ba3de;}else return null;})[_0x2117('0x1d')](respondWithResult(_0x5c16eb,null))['catch'](handleError(_0x5c16eb,null));};exports[_0x2117('0xbc')]=function(_0x18312e,_0x4b339b){var _0x532d32={};return db[_0x2117('0x33')][_0x2117('0x8f')]({'where':{'id':_0x18312e['params']['id']}})['then'](function(_0x29f7e3){if(!_0x29f7e3){throw new APINotFoundError(util[_0x2117('0xbd')](_0x2117('0xbe'),_0x18312e['params']['id']));}return contacts[_0x2117('0x56')]();})[_0x2117('0x1d')](function(_0xaa9801){_0x18312e['query'][_0x2117('0x33')]=_0x18312e[_0x2117('0x51')]['id'];_0x532d32=qs['getOptions'](_0xaa9801,_0x18312e);if(_0x18312e['query'][_0x2117('0xbf')](_0x2117('0x3f'))){_0x532d32[_0x2117('0x40')]=[{'model':db[_0x2117('0xc0')],'as':'List','required':![]},{'model':db[_0x2117('0xc1')],'as':_0x2117('0xc2'),'attributes':['id','name','color'],'where':_0x18312e[_0x2117('0x3e')][_0x2117('0xc3')]?{'id':_0x18312e[_0x2117('0x3e')][_0x2117('0xc3')]}:undefined,'required':_0x18312e[_0x2117('0x3e')]['tag']?!![]:![]}];}return contacts['findAll'](_0x18312e[_0x2117('0x3e')],_0x18312e[_0x2117('0x26')],_0x532d32,_0xaa9801);})['then'](respondWithFilteredResult(_0x4b339b,_0x532d32))[_0x2117('0x4f')](APIHandleError(_0x4b339b));};exports[_0x2117('0xc4')]=function(_0x5f1cd1,_0x1d6fed){var _0x4c740f;var _0x1107d7={};var _0x2a548c;return db['User'][_0x2117('0x8f')]({'where':{'id':_0x5f1cd1[_0x2117('0x51')]['id']},'attributes':['id',_0x2117('0x31'),_0x2117('0x23')]})[_0x2117('0x1d')](handleEntityNotFound(_0x1d6fed,null))[_0x2117('0x1d')](function(_0x4d3e24){if(!utils[_0x2117('0x99')](_0x5f1cd1[_0x2117('0x3e')][_0x2117('0x94')])){throw new db[(_0x2117('0x8a'))][(_0x2117('0x87'))](_0x2117('0x9a'));}_0x4c740f=_0x4d3e24;var _0x4398d8={};_0x4398d8[_0x2117('0xc5')]=_[_0x2117('0xc6')](db[_[_0x2117('0x9b')](_0x5f1cd1['query'][_0x2117('0x94')])+_0x2117('0xc7')]['rawAttributes']);_0x4398d8[_0x2117('0x3e')]=_[_0x2117('0xc6')](_0x5f1cd1[_0x2117('0x3e')]);_0x4398d8[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x4398d8[_0x2117('0xc5')],_0x4398d8['query']);_0x1107d7[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x4398d8[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x5f1cd1[_0x2117('0x3e')][_0x2117('0xca')]));_0x1107d7['attributes']=_0x1107d7['attributes']['length']?_0x1107d7[_0x2117('0x42')]:_0x4398d8['model'];_0x1107d7[_0x2117('0xcb')]=qs['sort'](_0x5f1cd1['query'][_0x2117('0xcc')]);_0x1107d7['where']=qs[_0x2117('0xc8')](_['pick'](_0x5f1cd1[_0x2117('0x3e')],_0x4398d8[_0x2117('0xc8')]));if(_0x5f1cd1[_0x2117('0x3e')]['filter']){_0x1107d7[_0x2117('0xcd')]=_['merge'](_0x1107d7[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0x1107d7['attributes'],function(_0x3e563a){var _0x19b55e={};_0x19b55e[_0x3e563a]={'$like':'%'+_0x5f1cd1['query'][_0x2117('0x29')]+'%'};return _0x19b55e;})});}_0x1107d7=_['merge']({},_0x1107d7,_0x5f1cd1[_0x2117('0xce')]);switch(_0x4c740f[_0x2117('0x23')]){case'admin':return db[_['capitalize'](_0x5f1cd1['query'][_0x2117('0x94')])+_0x2117('0xc7')][_0x2117('0x44')](_0x1107d7);case _0x2117('0x26'):case'agent':return _0x4c740f[_0x2117('0x22')+_[_0x2117('0x9b')](_0x5f1cd1[_0x2117('0x3e')][_0x2117('0x94')])+_0x2117('0x9d')](_0x1107d7);default:throw new db['Sequelize'][(_0x2117('0x87'))](_0x2117('0xcf'));}})['then'](function(_0xd06076){_0x2a548c=_0xd06076[_0x2117('0x48')];if(!_0x5f1cd1[_0x2117('0x3e')][_0x2117('0xbf')]('nolimit')){_0x1107d7[_0x2117('0x18')]=qs[_0x2117('0x18')](_0x5f1cd1[_0x2117('0x3e')][_0x2117('0x18')]);_0x1107d7['offset']=qs[_0x2117('0x16')](_0x5f1cd1[_0x2117('0x3e')][_0x2117('0x16')]);}switch(_0x4c740f[_0x2117('0x23')]){case _0x2117('0x24'):return db[_['capitalize'](_0x5f1cd1['query']['channel'])+_0x2117('0xc7')]['findAll'](_0x1107d7);case _0x2117('0x26'):case'agent':return _0x4c740f[_0x2117('0x22')+_[_0x2117('0x9b')](_0x5f1cd1[_0x2117('0x3e')]['channel'])+_0x2117('0x9d')](_0x1107d7);}})[_0x2117('0x1d')](function(_0x3e6994){return{'count':_0x2a548c,'rows':_0x3e6994};})['then'](respondWithResult(_0x1d6fed,null))[_0x2117('0x4f')](handleError(_0x1d6fed,null));};exports[_0x2117('0xd0')]=function(_0x165e61,_0x1a89c7){var _0x55a222={};var _0x583c3d={};var _0x219c85;var _0x34879f;return db[_0x2117('0x33')][_0x2117('0x8f')]({'where':{'id':_0x165e61[_0x2117('0x51')]['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x1a89c7,null))[_0x2117('0x1d')](function(_0xcc9296){if(_0xcc9296){_0x219c85=_0xcc9296;_0x583c3d[_0x2117('0xc5')]=_[_0x2117('0xc6')](db[_0x2117('0xa3')][_0x2117('0x34')]);_0x583c3d[_0x2117('0x3e')]=_[_0x2117('0xc6')](_0x165e61[_0x2117('0x3e')]);_0x583c3d['filters']=_[_0x2117('0xc9')](_0x583c3d['model'],_0x583c3d[_0x2117('0x3e')]);_0x55a222[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x583c3d[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x165e61[_0x2117('0x3e')][_0x2117('0xca')]));_0x55a222[_0x2117('0x42')]=_0x55a222[_0x2117('0x42')]['length']?_0x55a222[_0x2117('0x42')]:_0x583c3d[_0x2117('0xc5')];_0x55a222['order']=qs[_0x2117('0xcc')](_0x165e61['query'][_0x2117('0xcc')]);_0x55a222[_0x2117('0xcd')]=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0x165e61['query'],_0x583c3d['filters']));if(_0x165e61[_0x2117('0x3e')]['filter']){_0x55a222[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x55a222[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0x55a222[_0x2117('0x42')],function(_0x1ae6bb){var _0x49ec46={};_0x49ec46[_0x1ae6bb]={'$like':'%'+_0x165e61['query']['filter']+'%'};return _0x49ec46;})});}_0x55a222=_[_0x2117('0xd2')]({},_0x55a222,_0x165e61[_0x2117('0xce')]);return _0x219c85[_0x2117('0xd0')](_0x55a222);}})[_0x2117('0x1d')](function(_0xb16a4e){if(_0xb16a4e){_0x34879f=_0xb16a4e['length'];if(!_0x165e61[_0x2117('0x3e')][_0x2117('0xbf')]('nolimit')){_0x55a222[_0x2117('0x18')]=qs[_0x2117('0x18')](_0x165e61[_0x2117('0x3e')][_0x2117('0x18')]);_0x55a222[_0x2117('0x16')]=qs[_0x2117('0x16')](_0x165e61['query']['offset']);}return _0x219c85[_0x2117('0xd0')](_0x55a222);}})['then'](function(_0x529b6c){if(_0x529b6c){return _0x529b6c?{'count':_0x34879f,'rows':_0x529b6c}:null;}})[_0x2117('0x1d')](respondWithResult(_0x1a89c7,null))['catch'](handleError(_0x1a89c7,null));};exports[_0x2117('0xd3')]=function(_0xb33248,_0x150412){var _0x10dd39={};var _0x4843ee={};var _0x281725;var _0x383938;return db['User']['findOne']({'where':{'id':_0xb33248['params']['id']}})['then'](handleEntityNotFound(_0x150412,null))[_0x2117('0x1d')](function(_0x9ebb38){if(_0x9ebb38){_0x281725=_0x9ebb38;_0x4843ee[_0x2117('0xc5')]=_[_0x2117('0xc6')](db['ChatGroup'][_0x2117('0x34')]);_0x4843ee[_0x2117('0x3e')]=_['keys'](_0xb33248[_0x2117('0x3e')]);_0x4843ee[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x4843ee[_0x2117('0xc5')],_0x4843ee[_0x2117('0x3e')]);_0x10dd39[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x4843ee[_0x2117('0xc5')],qs['fields'](_0xb33248[_0x2117('0x3e')][_0x2117('0xca')]));_0x10dd39['attributes']=_0x10dd39['attributes'][_0x2117('0x48')]?_0x10dd39[_0x2117('0x42')]:_0x4843ee[_0x2117('0xc5')];_0x10dd39[_0x2117('0xcb')]=qs['sort'](_0xb33248[_0x2117('0x3e')][_0x2117('0xcc')]);_0x10dd39[_0x2117('0xcd')]=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0xb33248['query'],_0x4843ee['filters']));if(_0xb33248[_0x2117('0x3e')][_0x2117('0x29')]){_0x10dd39[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x10dd39[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0x10dd39[_0x2117('0x42')],function(_0xf87f01){var _0x140904={};_0x140904[_0xf87f01]={'$like':'%'+_0xb33248[_0x2117('0x3e')]['filter']+'%'};return _0x140904;})});}_0x10dd39=_['merge']({},_0x10dd39,_0xb33248['options']);return _0x281725[_0x2117('0xd3')](_0x10dd39);}})[_0x2117('0x1d')](function(_0x376ee1){if(_0x376ee1){_0x383938=_0x376ee1[_0x2117('0x48')];if(!_0xb33248[_0x2117('0x3e')]['hasOwnProperty'](_0x2117('0xd4'))){_0x10dd39[_0x2117('0x18')]=qs[_0x2117('0x18')](_0xb33248[_0x2117('0x3e')][_0x2117('0x18')]);_0x10dd39[_0x2117('0x16')]=qs[_0x2117('0x16')](_0xb33248[_0x2117('0x3e')]['offset']);}return _0x281725[_0x2117('0xd3')](_0x10dd39);}})['then'](function(_0x42fa91){if(_0x42fa91){return _0x42fa91?{'count':_0x383938,'rows':_0x42fa91}:null;}})['then'](respondWithResult(_0x150412,null))[_0x2117('0x4f')](handleError(_0x150412,null));};exports[_0x2117('0xd5')]=function(_0x538fec,_0xaea94a){var _0x3d10cc={'raw':!![],'where':{}};var _0x2fccef={};var _0x4b86cf={'count':0x0,'rows':[]};return db[_0x2117('0x33')]['findOne']({'where':{'id':_0x538fec[_0x2117('0x51')]['id']}})['then'](handleEntityNotFound(_0xaea94a,null))[_0x2117('0x1d')](function(_0x4d2979){if(_0x4d2979){_0x2fccef[_0x2117('0xc5')]=_[_0x2117('0xc6')](db[_0x2117('0xd6')][_0x2117('0x34')]);_0x2fccef[_0x2117('0x3e')]=_[_0x2117('0xc6')](_0x538fec[_0x2117('0x3e')]);_0x2fccef[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x2fccef['model'],_0x2fccef['query']);_0x3d10cc[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x2fccef[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x538fec[_0x2117('0x3e')]['fields']));_0x3d10cc[_0x2117('0x42')]=_0x3d10cc[_0x2117('0x42')][_0x2117('0x48')]?_0x3d10cc['attributes']:_0x2fccef[_0x2117('0xc5')];if(!_0x538fec[_0x2117('0x3e')][_0x2117('0xbf')]('nolimit')){_0x3d10cc['limit']=qs[_0x2117('0x18')](_0x538fec[_0x2117('0x3e')][_0x2117('0x18')]);_0x3d10cc[_0x2117('0x16')]=qs[_0x2117('0x16')](_0x538fec['query'][_0x2117('0x16')]);}_0x3d10cc['order']=qs[_0x2117('0xcc')](_0x538fec[_0x2117('0x3e')][_0x2117('0xcc')]);_0x3d10cc[_0x2117('0xcd')]=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0x538fec['query'],_0x2fccef[_0x2117('0xc8')]));_0x3d10cc[_0x2117('0xcd')][_0x2117('0xd7')]=_0x4d2979['id'];if(_0x538fec[_0x2117('0x3e')][_0x2117('0x29')]){_0x3d10cc['where']=_[_0x2117('0xd2')](_0x3d10cc[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0x3d10cc[_0x2117('0x42')],function(_0x59b84b){var _0x350dad={};_0x350dad[_0x59b84b]={'$like':'%'+_0x538fec[_0x2117('0x3e')][_0x2117('0x29')]+'%'};return _0x350dad;})});}_0x3d10cc=_['merge']({},_0x3d10cc,_0x538fec[_0x2117('0xce')]);return db['VoiceRecording']['count']({'where':_0x3d10cc[_0x2117('0xcd')]})[_0x2117('0x1d')](function(_0x18cd83){_0x4b86cf[_0x2117('0x19')]=_0x18cd83;if(_0x538fec['query'][_0x2117('0x3f')]){_0x3d10cc[_0x2117('0x40')]=[{'all':!![]}];}return db[_0x2117('0xd6')]['findAll'](_0x3d10cc);})[_0x2117('0x1d')](function(_0x4c5e24){_0x4b86cf[_0x2117('0x45')]=_0x4c5e24;return _0x4b86cf;});}})['then'](respondWithFilteredResult(_0xaea94a,_0x3d10cc))[_0x2117('0x4f')](handleError(_0xaea94a,null));};exports[_0x2117('0xd8')]=function(_0x272ab4,_0x11315a){var _0x4e7c29={'raw':!![],'where':{}};var _0x55b921={};var _0x498e7d={'count':0x0,'rows':[]};return db[_0x2117('0x33')][_0x2117('0x8f')]({'where':{'id':_0x272ab4[_0x2117('0x51')]['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x11315a,null))['then'](function(_0x273d00){if(_0x273d00){_0x55b921['model']=_[_0x2117('0xc6')](db[_0x2117('0xd9')][_0x2117('0x34')]);_0x55b921['query']=_['keys'](_0x272ab4[_0x2117('0x3e')]);_0x55b921['filters']=_['intersection'](_0x55b921[_0x2117('0xc5')],_0x55b921[_0x2117('0x3e')]);_0x4e7c29[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x55b921[_0x2117('0xc5')],qs['fields'](_0x272ab4[_0x2117('0x3e')][_0x2117('0xca')]));_0x4e7c29[_0x2117('0x42')]=_0x4e7c29[_0x2117('0x42')]['length']?_0x4e7c29['attributes']:_0x55b921[_0x2117('0xc5')];if(!_0x272ab4[_0x2117('0x3e')][_0x2117('0xbf')](_0x2117('0xd4'))){_0x4e7c29['limit']=qs[_0x2117('0x18')](_0x272ab4['query'][_0x2117('0x18')]);_0x4e7c29[_0x2117('0x16')]=qs[_0x2117('0x16')](_0x272ab4[_0x2117('0x3e')]['offset']);}_0x4e7c29['order']=qs['sort'](_0x272ab4['query'][_0x2117('0xcc')]);_0x4e7c29[_0x2117('0xcd')]=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0x272ab4[_0x2117('0x3e')],_0x55b921[_0x2117('0xc8')]));_0x4e7c29['where'][_0x2117('0xd7')]=_0x273d00['id'];if(_0x272ab4[_0x2117('0x3e')][_0x2117('0x29')]){_0x4e7c29[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x4e7c29[_0x2117('0xcd')],{'$or':_['map'](_0x4e7c29[_0x2117('0x42')],function(_0x3ac2a6){var _0x1db449={};_0x1db449[_0x3ac2a6]={'$like':'%'+_0x272ab4[_0x2117('0x3e')][_0x2117('0x29')]+'%'};return _0x1db449;})});}_0x4e7c29=_['merge']({},_0x4e7c29,_0x272ab4[_0x2117('0xce')]);return db[_0x2117('0xd9')][_0x2117('0x19')]({'where':_0x4e7c29[_0x2117('0xcd')]})[_0x2117('0x1d')](function(_0x564ddc){_0x498e7d[_0x2117('0x19')]=_0x564ddc;if(_0x272ab4[_0x2117('0x3e')][_0x2117('0x3f')]){_0x4e7c29['include']=[{'all':!![]}];}return db[_0x2117('0xd9')][_0x2117('0x44')](_0x4e7c29);})[_0x2117('0x1d')](function(_0x1dafee){_0x498e7d[_0x2117('0x45')]=_0x1dafee;return _0x498e7d;});}})['then'](respondWithFilteredResult(_0x11315a,_0x4e7c29))[_0x2117('0x4f')](handleError(_0x11315a,null));};exports[_0x2117('0xda')]=function(_0x38fe06,_0x9998f6){var _0x2dde60={};var _0x49508b={};var _0x1c845c;var _0x1108b1;return db['User'][_0x2117('0x8f')]({'where':{'id':_0x38fe06[_0x2117('0x51')]['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x9998f6,null))[_0x2117('0x1d')](function(_0x2afd1e){if(_0x2afd1e){_0x1c845c=_0x2afd1e;_0x49508b[_0x2117('0xc5')]=_[_0x2117('0xc6')](db[_0x2117('0xdb')]['rawAttributes']);_0x49508b[_0x2117('0x3e')]=_['keys'](_0x38fe06[_0x2117('0x3e')]);_0x49508b[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x49508b['model'],_0x49508b[_0x2117('0x3e')]);_0x2dde60[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x49508b[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x38fe06[_0x2117('0x3e')][_0x2117('0xca')]));_0x2dde60[_0x2117('0x42')]=_0x2dde60[_0x2117('0x42')][_0x2117('0x48')]?_0x2dde60[_0x2117('0x42')]:_0x49508b['model'];_0x2dde60[_0x2117('0xcb')]=qs[_0x2117('0xcc')](_0x38fe06[_0x2117('0x3e')][_0x2117('0xcc')]);_0x2dde60[_0x2117('0xcd')]=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0x38fe06['query'],_0x49508b[_0x2117('0xc8')]));if(_0x38fe06[_0x2117('0x3e')][_0x2117('0x29')]){_0x2dde60[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x2dde60[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0x2dde60[_0x2117('0x42')],function(_0x539d88){var _0x2f0470={};_0x2f0470[_0x539d88]={'$like':'%'+_0x38fe06[_0x2117('0x3e')][_0x2117('0x29')]+'%'};return _0x2f0470;})});}_0x2dde60=_[_0x2117('0xd2')]({},_0x2dde60,_0x38fe06[_0x2117('0xce')]);return _0x1c845c[_0x2117('0xda')](_0x2dde60);}})[_0x2117('0x1d')](function(_0x40e5ef){if(_0x40e5ef){_0x1108b1=_0x40e5ef[_0x2117('0x48')];if(!_0x38fe06['query'][_0x2117('0xbf')](_0x2117('0xd4'))){_0x2dde60[_0x2117('0x18')]=qs['limit'](_0x38fe06[_0x2117('0x3e')][_0x2117('0x18')]);_0x2dde60[_0x2117('0x16')]=qs['offset'](_0x38fe06[_0x2117('0x3e')][_0x2117('0x16')]);}return _0x1c845c[_0x2117('0xda')](_0x2dde60);}})[_0x2117('0x1d')](function(_0x75517c){if(_0x75517c){return _0x75517c?{'count':_0x1108b1,'rows':_0x75517c}:null;}})[_0x2117('0x1d')](respondWithResult(_0x9998f6,null))[_0x2117('0x4f')](handleError(_0x9998f6,null));};exports[_0x2117('0xdc')]=function(_0x5b0457,_0x58b3ad){var _0x18b105={};var _0x2aca42={};var _0x578f0;var _0x2d96cc;return db[_0x2117('0x33')]['findOne']({'where':{'id':_0x5b0457['params']['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x58b3ad,null))[_0x2117('0x1d')](function(_0xe254d7){if(_0xe254d7){_0x578f0=_0xe254d7;_0x2aca42[_0x2117('0xc5')]=_[_0x2117('0xc6')](db['OpenchannelInteraction'][_0x2117('0x34')]);_0x2aca42[_0x2117('0x3e')]=_[_0x2117('0xc6')](_0x5b0457['query']);_0x2aca42[_0x2117('0xc8')]=_['intersection'](_0x2aca42['model'],_0x2aca42[_0x2117('0x3e')]);_0x18b105[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x2aca42[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x5b0457[_0x2117('0x3e')][_0x2117('0xca')]));_0x18b105[_0x2117('0x42')]=_0x18b105['attributes'][_0x2117('0x48')]?_0x18b105[_0x2117('0x42')]:_0x2aca42[_0x2117('0xc5')];_0x18b105['order']=qs[_0x2117('0xcc')](_0x5b0457[_0x2117('0x3e')][_0x2117('0xcc')]);_0x18b105['where']=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0x5b0457['query'],_0x2aca42[_0x2117('0xc8')]));if(_0x5b0457[_0x2117('0x3e')][_0x2117('0x29')]){_0x18b105[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x18b105['where'],{'$or':_[_0x2117('0x2a')](_0x18b105['attributes'],function(_0x48e2fb){var _0x4be966={};_0x4be966[_0x48e2fb]={'$like':'%'+_0x5b0457[_0x2117('0x3e')][_0x2117('0x29')]+'%'};return _0x4be966;})});}_0x18b105=_['merge']({},_0x18b105,_0x5b0457['options']);return _0x578f0[_0x2117('0xdc')](_0x18b105);}})['then'](function(_0x545349){if(_0x545349){_0x2d96cc=_0x545349[_0x2117('0x48')];if(!_0x5b0457[_0x2117('0x3e')][_0x2117('0xbf')](_0x2117('0xd4'))){_0x18b105[_0x2117('0x18')]=qs[_0x2117('0x18')](_0x5b0457[_0x2117('0x3e')][_0x2117('0x18')]);_0x18b105[_0x2117('0x16')]=qs['offset'](_0x5b0457[_0x2117('0x3e')][_0x2117('0x16')]);}return _0x578f0[_0x2117('0xdc')](_0x18b105);}})['then'](function(_0x380223){if(_0x380223){return _0x380223?{'count':_0x2d96cc,'rows':_0x380223}:null;}})[_0x2117('0x1d')](respondWithResult(_0x58b3ad,null))[_0x2117('0x4f')](handleError(_0x58b3ad,null));};exports[_0x2117('0xdd')]=function(_0x2fa760,_0x24ae67){var _0x564ad1={'raw':!![],'where':{}};var _0x3328e8={};var _0x253223={'count':0x0,'rows':[]};return db[_0x2117('0x33')][_0x2117('0x8f')]({'where':{'id':_0x2fa760[_0x2117('0x51')]['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x24ae67,null))[_0x2117('0x1d')](function(_0x33326e){if(_0x33326e){_0x3328e8[_0x2117('0xc5')]=_[_0x2117('0xc6')](db['MailInteraction'][_0x2117('0x34')]);_0x3328e8[_0x2117('0x3e')]=_['keys'](_0x2fa760[_0x2117('0x3e')]);_0x3328e8[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x3328e8[_0x2117('0xc5')],_0x3328e8[_0x2117('0x3e')]);_0x564ad1[_0x2117('0x42')]=_['intersection'](_0x3328e8[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x2fa760[_0x2117('0x3e')][_0x2117('0xca')]));_0x564ad1['attributes']=_0x564ad1[_0x2117('0x42')]['length']?_0x564ad1['attributes']:_0x3328e8[_0x2117('0xc5')];if(!_0x2fa760['query'][_0x2117('0xbf')](_0x2117('0xd4'))){_0x564ad1[_0x2117('0x18')]=qs[_0x2117('0x18')](_0x2fa760[_0x2117('0x3e')]['limit']);_0x564ad1[_0x2117('0x16')]=qs[_0x2117('0x16')](_0x2fa760[_0x2117('0x3e')][_0x2117('0x16')]);}_0x564ad1[_0x2117('0xcb')]=qs['sort'](_0x2fa760[_0x2117('0x3e')]['sort']);_0x564ad1['where']=qs[_0x2117('0xc8')](_['pick'](_0x2fa760['query'],_0x3328e8[_0x2117('0xc8')]));_0x564ad1['where'][_0x2117('0xd7')]=_0x33326e['id'];if(_0x2fa760[_0x2117('0x3e')][_0x2117('0x29')]){_0x564ad1[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x564ad1[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0x564ad1[_0x2117('0x42')],function(_0x2273d7){var _0x2d2d85={};_0x2d2d85[_0x2273d7]={'$like':'%'+_0x2fa760[_0x2117('0x3e')][_0x2117('0x29')]+'%'};return _0x2d2d85;})});}_0x564ad1=_[_0x2117('0xd2')]({},_0x564ad1,_0x2fa760[_0x2117('0xce')]);return db['MailInteraction'][_0x2117('0x19')]({'where':_0x564ad1[_0x2117('0xcd')]})[_0x2117('0x1d')](function(_0x11bdfa){_0x253223[_0x2117('0x19')]=_0x11bdfa;if(_0x2fa760[_0x2117('0x3e')][_0x2117('0x3f')]){_0x564ad1['include']=[{'all':!![]}];}return db['MailInteraction'][_0x2117('0x44')](_0x564ad1);})[_0x2117('0x1d')](function(_0x575c28){_0x253223[_0x2117('0x45')]=_0x575c28;return _0x253223;});}})[_0x2117('0x1d')](respondWithFilteredResult(_0x24ae67,_0x564ad1))[_0x2117('0x4f')](handleError(_0x24ae67,null));};exports[_0x2117('0xde')]=function(_0x53ccf6,_0x50f979){var _0x38e76e={};var _0x29208d={};var _0x3c0b19;var _0x410ab3;return db['User'][_0x2117('0x8f')]({'where':{'id':_0x53ccf6[_0x2117('0x51')]['id']}})['then'](handleEntityNotFound(_0x50f979,null))[_0x2117('0x1d')](function(_0x3f489a){if(_0x3f489a){_0x3c0b19=_0x3f489a;_0x29208d[_0x2117('0xc5')]=_[_0x2117('0xc6')](db[_0x2117('0xdf')]['rawAttributes']);_0x29208d[_0x2117('0x3e')]=_['keys'](_0x53ccf6[_0x2117('0x3e')]);_0x29208d[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x29208d[_0x2117('0xc5')],_0x29208d['query']);_0x38e76e[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x29208d[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x53ccf6[_0x2117('0x3e')][_0x2117('0xca')]));_0x38e76e[_0x2117('0x42')]=_0x38e76e[_0x2117('0x42')][_0x2117('0x48')]?_0x38e76e[_0x2117('0x42')]:_0x29208d[_0x2117('0xc5')];_0x38e76e['order']=qs[_0x2117('0xcc')](_0x53ccf6[_0x2117('0x3e')]['sort']);_0x38e76e[_0x2117('0xcd')]=qs['filters'](_['pick'](_0x53ccf6[_0x2117('0x3e')],_0x29208d[_0x2117('0xc8')]));if(_0x53ccf6[_0x2117('0x3e')][_0x2117('0x29')]){_0x38e76e[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x38e76e[_0x2117('0xcd')],{'$or':_['map'](_0x38e76e['attributes'],function(_0x441b55){var _0x3fcbc5={};_0x3fcbc5[_0x441b55]={'$like':'%'+_0x53ccf6[_0x2117('0x3e')][_0x2117('0x29')]+'%'};return _0x3fcbc5;})});}_0x38e76e=_[_0x2117('0xd2')]({},_0x38e76e,_0x53ccf6['options']);return _0x3c0b19[_0x2117('0xde')](_0x38e76e);}})[_0x2117('0x1d')](function(_0x201c31){if(_0x201c31){_0x410ab3=_0x201c31[_0x2117('0x48')];if(!_0x53ccf6[_0x2117('0x3e')][_0x2117('0xbf')](_0x2117('0xd4'))){_0x38e76e[_0x2117('0x18')]=qs[_0x2117('0x18')](_0x53ccf6[_0x2117('0x3e')][_0x2117('0x18')]);_0x38e76e[_0x2117('0x16')]=qs['offset'](_0x53ccf6[_0x2117('0x3e')][_0x2117('0x16')]);}return _0x3c0b19[_0x2117('0xde')](_0x38e76e);}})[_0x2117('0x1d')](function(_0x175974){if(_0x175974){return _0x175974?{'count':_0x410ab3,'rows':_0x175974}:null;}})[_0x2117('0x1d')](respondWithResult(_0x50f979,null))[_0x2117('0x4f')](handleError(_0x50f979,null));};exports[_0x2117('0xe0')]=function(_0x41b673,_0x4088f6){var _0xd49e12={};var _0x161390={};var _0x1fc8ad;var _0x4fbbc8;return db[_0x2117('0x33')][_0x2117('0x8f')]({'where':{'id':_0x41b673['params']['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x4088f6,null))['then'](function(_0x22498b){if(_0x22498b){_0x1fc8ad=_0x22498b;_0x161390[_0x2117('0xc5')]=_[_0x2117('0xc6')](db['FaxInteraction'][_0x2117('0x34')]);_0x161390[_0x2117('0x3e')]=_[_0x2117('0xc6')](_0x41b673[_0x2117('0x3e')]);_0x161390[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x161390['model'],_0x161390[_0x2117('0x3e')]);_0xd49e12[_0x2117('0x42')]=_['intersection'](_0x161390[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x41b673[_0x2117('0x3e')]['fields']));_0xd49e12[_0x2117('0x42')]=_0xd49e12[_0x2117('0x42')][_0x2117('0x48')]?_0xd49e12[_0x2117('0x42')]:_0x161390['model'];_0xd49e12[_0x2117('0xcb')]=qs[_0x2117('0xcc')](_0x41b673[_0x2117('0x3e')][_0x2117('0xcc')]);_0xd49e12[_0x2117('0xcd')]=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0x41b673[_0x2117('0x3e')],_0x161390[_0x2117('0xc8')]));if(_0x41b673['query'][_0x2117('0x29')]){_0xd49e12[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0xd49e12[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0xd49e12[_0x2117('0x42')],function(_0x4e9446){var _0x4d23be={};_0x4d23be[_0x4e9446]={'$like':'%'+_0x41b673[_0x2117('0x3e')][_0x2117('0x29')]+'%'};return _0x4d23be;})});}_0xd49e12=_[_0x2117('0xd2')]({},_0xd49e12,_0x41b673[_0x2117('0xce')]);return _0x1fc8ad[_0x2117('0xe0')](_0xd49e12);}})[_0x2117('0x1d')](function(_0x18f727){if(_0x18f727){_0x4fbbc8=_0x18f727[_0x2117('0x48')];if(!_0x41b673[_0x2117('0x3e')][_0x2117('0xbf')](_0x2117('0xd4'))){_0xd49e12[_0x2117('0x18')]=qs[_0x2117('0x18')](_0x41b673[_0x2117('0x3e')][_0x2117('0x18')]);_0xd49e12[_0x2117('0x16')]=qs['offset'](_0x41b673[_0x2117('0x3e')][_0x2117('0x16')]);}return _0x1fc8ad['getFaxInteractions'](_0xd49e12);}})[_0x2117('0x1d')](function(_0x21acd1){if(_0x21acd1){return _0x21acd1?{'count':_0x4fbbc8,'rows':_0x21acd1}:null;}})[_0x2117('0x1d')](respondWithResult(_0x4088f6,null))[_0x2117('0x4f')](handleError(_0x4088f6,null));};exports[_0x2117('0xe1')]=function(_0x1eb6a3,_0x55624e){var _0x4da5bb={};var _0xebac1c={};var _0x324608;var _0x53aab2;return db['User'][_0x2117('0x8f')]({'where':{'id':_0x1eb6a3['params']['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x55624e,null))[_0x2117('0x1d')](function(_0x4d9594){if(_0x4d9594){_0x324608=_0x4d9594;_0xebac1c[_0x2117('0xc5')]=_[_0x2117('0xc6')](db[_0x2117('0xe2')][_0x2117('0x34')]);_0xebac1c[_0x2117('0x3e')]=_[_0x2117('0xc6')](_0x1eb6a3['query']);_0xebac1c[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0xebac1c['model'],_0xebac1c[_0x2117('0x3e')]);_0x4da5bb[_0x2117('0x42')]=_[_0x2117('0xc9')](_0xebac1c[_0x2117('0xc5')],qs['fields'](_0x1eb6a3['query'][_0x2117('0xca')]));_0x4da5bb[_0x2117('0x42')]=_0x4da5bb[_0x2117('0x42')][_0x2117('0x48')]?_0x4da5bb[_0x2117('0x42')]:_0xebac1c[_0x2117('0xc5')];_0x4da5bb[_0x2117('0xcb')]=qs['sort'](_0x1eb6a3[_0x2117('0x3e')][_0x2117('0xcc')]);_0x4da5bb['where']=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0x1eb6a3[_0x2117('0x3e')],_0xebac1c[_0x2117('0xc8')]));if(_0x1eb6a3[_0x2117('0x3e')][_0x2117('0x29')]){_0x4da5bb[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x4da5bb[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0x4da5bb['attributes'],function(_0x36050a){var _0x2c7cca={};_0x2c7cca[_0x36050a]={'$like':'%'+_0x1eb6a3['query'][_0x2117('0x29')]+'%'};return _0x2c7cca;})});}_0x4da5bb=_['merge']({},_0x4da5bb,_0x1eb6a3[_0x2117('0xce')]);return _0x324608[_0x2117('0xe1')](_0x4da5bb);}})[_0x2117('0x1d')](function(_0x238032){if(_0x238032){_0x53aab2=_0x238032[_0x2117('0x48')];if(!_0x1eb6a3[_0x2117('0x3e')][_0x2117('0xbf')](_0x2117('0xd4'))){_0x4da5bb['limit']=qs[_0x2117('0x18')](_0x1eb6a3[_0x2117('0x3e')]['limit']);_0x4da5bb[_0x2117('0x16')]=qs[_0x2117('0x16')](_0x1eb6a3[_0x2117('0x3e')][_0x2117('0x16')]);}return _0x324608[_0x2117('0xe1')](_0x4da5bb);}})['then'](function(_0x4bddad){if(_0x4bddad){return _0x4bddad?{'count':_0x53aab2,'rows':_0x4bddad}:null;}})[_0x2117('0x1d')](respondWithResult(_0x55624e,null))['catch'](handleError(_0x55624e,null));};exports['login']=function(_0x5bd432,_0x28d015,_0x1aa037){var _0x39cd62;var _0x34eca0;var _0x4552ce;var _0x50dd7d=!_[_0x2117('0x62')](_0x5bd432[_0x2117('0x51')]['id'])?_0x5bd432[_0x2117('0x51')]['id']:!_[_0x2117('0x62')](_0x5bd432['user']['id'])?_0x5bd432[_0x2117('0x26')]['id']:null;return db['User'][_0x2117('0x2c')]({'where':{'id':_0x50dd7d,'role':{'$or':[_0x2117('0x24'),_0x2117('0x26'),_0x2117('0x1e')]}},'attributes':['id',_0x2117('0x31'),_0x2117('0xe3'),_0x2117('0xe4'),'role',_0x2117('0x5a'),_0x2117('0x96')]})[_0x2117('0x1d')](function(_0x158ebd){if(_0x158ebd){if(_0x158ebd[_0x2117('0x23')]==='agent'){_0x39cd62=_0x158ebd;if(_0x5bd432[_0x2117('0x55')]['interface']){_0x4552ce=util[_0x2117('0xbd')](_0x2117('0xe5'),_0x39cd62[_0x5bd432[_0x2117('0x55')][_0x2117('0x98')]]);}else if(_0x5bd432[_0x2117('0x55')][_0x2117('0xe6')]){_0x4552ce=util[_0x2117('0xbd')](_0x2117('0xa1'),_0x5bd432[_0x2117('0x55')][_0x2117('0xe6')]);}else{_0x4552ce=util['format'](_0x2117('0xa1'),_0x39cd62[_0x2117('0x31')]);}socket['to'](util[_0x2117('0xbd')](_0x2117('0xe7'),_0x39cd62[_0x2117('0x31')]))[_0x2117('0x1f')](_0x2117('0xe8'),{'user':{'id':_0x39cd62['id'],'name':_0x39cd62[_0x2117('0x31')]},'ip':_0x5bd432['headers'][_0x2117('0xe9')]||_0x5bd432['connection'][_0x2117('0xea')]||_0x5bd432[_0x2117('0xeb')][_0x2117('0xea')]||_0x5bd432['connection']['socket'][_0x2117('0xea')]});return db[_0x2117('0xa3')][_0x2117('0x21')]({'where':{'membername':_0x39cd62[_0x2117('0x31')]},'individualHooks':!![]});}}else{throw new db[(_0x2117('0x8a'))][(_0x2117('0x87'))](_0x2117('0xec'));}})[_0x2117('0x1d')](function(){if(_0x39cd62){return _0x39cd62['getVoiceQueues']({'raw':!![]});}})[_0x2117('0x1d')](function(_0x17755f){if(_0x39cd62){if(_0x17755f){_0x34eca0=_0x17755f;if(_0x34eca0[_0x2117('0x48')]){var _0x260f58=_0x34eca0[_0x2117('0x2a')](function(_0xdc776b){var _0x33066a={'membername':_0x39cd62['name'],'UserId':_0x39cd62['id'],'queue_name':_0xdc776b[_0x2117('0x31')],'VoiceQueueId':_0xdc776b['id'],'interface':_0x4552ce,'paused':_0x39cd62[_0x2117('0x96')]||![],'penalty':_0xdc776b['UserVoiceQueue.penalty']||0x0};return db[_0x2117('0xa3')][_0x2117('0xa4')](_0x33066a);});return Promise[_0x2117('0x4e')](_0x260f58);}}}})[_0x2117('0x1d')](function(){if(_0x39cd62){return db[_0x2117('0xed')]['findAll']({'where':{'membername':_0x39cd62[_0x2117('0x31')],'exitAt':null}});}})[_0x2117('0x1d')](function(_0x2c7d49){if(_0x39cd62){var _0x3edd75=[];_0x2c7d49['forEach'](function(_0x1fd810){_0x3edd75['push'](_0x1fd810[_0x2117('0x54')]({'exitAt':moment()['format'](_0x2117('0xee'))}));});return Promise[_0x2117('0x4e')](_0x3edd75);}})[_0x2117('0x1d')](function(){if(_0x39cd62){var _0x257320=[];var _0x344867=[];var _0x39bcd1=utils[_0x2117('0xef')]();var _0x684c55={'membername':_0x39cd62[_0x2117('0x31')],'interface':_0x4552ce,'enterAt':moment()[_0x2117('0xbd')](_0x2117('0xee')),'role':_0x39cd62['role'],'internal':_0x39cd62[_0x2117('0x5a')]};_0x39bcd1[_0x2117('0xf0')](function(_0x6d6909){_0x257320[_0x2117('0x43')](_['merge']({'channel':_0x6d6909,'type':_0x2117('0xf1'),'data1':_0x5bd432[_0x2117('0x55')]['device'],'data2':_0x4552ce},_0x684c55));if(_0x39cd62['loginInPause']){_0x344867[_0x2117('0x43')](_[_0x2117('0xd2')]({'channel':_0x6d6909,'type':_0x2117('0xf2'),'data1':_0x2117('0xf3')},_0x684c55));}});return db[_0x2117('0xed')]['bulkCreate'](_0x257320[_0x2117('0xbb')](_0x344867),{'individualHooks':!![]});}})['then'](function(){if(_0x39cd62){return _0x39cd62[_0x2117('0x54')]({'online':!![],'lastLoginAt':moment()[_0x2117('0xbd')](_0x2117('0xee')),'voicePause':_0x39cd62[_0x2117('0x96')]||![],'mailPause':_0x39cd62[_0x2117('0x96')]||![],'chatPause':_0x39cd62[_0x2117('0x96')]||![],'faxPause':_0x39cd62[_0x2117('0x96')]||![],'smsPause':_0x39cd62['loginInPause']||![],'openchannelPause':_0x39cd62['loginInPause']||![],'whatsappPause':_0x39cd62['loginInPause']||![],'pauseType':_0x39cd62[_0x2117('0x96')]?'LOGININPAUSE':null,'interface':_0x4552ce,'lastPauseAt':moment()[_0x2117('0xbd')](_0x2117('0xee'))});}})[_0x2117('0x1d')](function(_0x1ac826){if(_0x5bd432['isMiddleware']){return _0x1aa037();}else{return Promise[_0x2117('0xf4')](_0x1ac826)[_0x2117('0x1d')](respondWithResult(_0x28d015,null));}})[_0x2117('0x4f')](handleError(_0x28d015,null));};exports['logout']=function(_0xf1c28f,_0x211f28){var _0x4897f9;return db[_0x2117('0x33')][_0x2117('0x2c')]({'where':{'id':_0xf1c28f[_0x2117('0x51')]['id'],'role':_0x2117('0x1e')},'attributes':['id',_0x2117('0x31'),_0x2117('0x23')]})[_0x2117('0x1d')](handleEntityNotFound(_0x211f28,null))[_0x2117('0x1d')](function(_0x5424fb){if(_0x5424fb){_0x4897f9=_0x5424fb;return db[_0x2117('0xa3')][_0x2117('0x21')]({'where':{'membername':_0x4897f9[_0x2117('0x31')]},'individualHooks':!![]});}})[_0x2117('0x1d')](function(){return db[_0x2117('0xed')][_0x2117('0x44')]({'where':{'membername':_0x4897f9[_0x2117('0x31')],'exitAt':null}});})[_0x2117('0x1d')](function(_0x2c1369){var _0x40a2e6=[];_0x2c1369['forEach'](function(_0x5f0ed8){_0x40a2e6['push'](_0x5f0ed8['update']({'exitAt':moment()[_0x2117('0xbd')](_0x2117('0xee'))}));});return Promise['all'](_0x40a2e6);})[_0x2117('0x1d')](function(){return _0x4897f9[_0x2117('0x54')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2117('0x1d')](respondWithResult(_0x211f28,null))[_0x2117('0x4f')](handleError(_0x211f28,null));};exports[_0x2117('0xf5')]=function(_0x30b049,_0x1bc6ef){var _0x59cef9;return db[_0x2117('0xa3')][_0x2117('0x54')]({'paused':0x1},{'where':{'UserId':_0x30b049['params']['id']},'individualHooks':!![]})[_0x2117('0x1d')](function(){return db['User'][_0x2117('0x2c')]({'where':{'id':_0x30b049[_0x2117('0x51')]['id'],'role':_0x2117('0x1e')},'attributes':['id',_0x2117('0x31'),_0x2117('0x23'),_0x2117('0x5a'),_0x2117('0x98'),_0x2117('0x95')]});})[_0x2117('0x1d')](handleEntityNotFound(_0x1bc6ef,null))['then'](function(_0x50602c){if(_0x50602c){_0x59cef9=_0x50602c;return db[_0x2117('0xed')][_0x2117('0x44')]({'where':{'membername':_0x59cef9[_0x2117('0x31')],'type':'PAUSE','exitAt':null}});}})[_0x2117('0x1d')](function(_0x5c5377){if(_0x5c5377[_0x2117('0x48')]){var _0x37c7cc=moment()[_0x2117('0xbd')](_0x2117('0xee'));for(var _0x1f9dc9=0x0,_0x6cf55d=_0x5c5377[_0x2117('0x48')];_0x1f9dc9<_0x6cf55d;_0x1f9dc9++){_0x5c5377[_0x1f9dc9][_0x2117('0xf6')]({'exitAt':_0x37c7cc});}}})['then'](function(){var _0x1b7937=[];var _0x45cf8e=utils[_0x2117('0xef')]();_0x45cf8e[_0x2117('0xf0')](function(_0x13ee72){_0x1b7937[_0x2117('0x43')]({'channel':_0x13ee72,'membername':_0x59cef9['name'],'interface':_[_0x2117('0x62')](_0x59cef9[_0x2117('0x98')])?util['format'](_0x2117('0xa1'),_0x59cef9['name']):_0x59cef9[_0x2117('0x98')],'type':_0x2117('0xf2'),'enterAt':moment()[_0x2117('0xbd')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x30b049[_0x2117('0x55')]['type']||_0x2117('0xf7'),'role':_0x59cef9[_0x2117('0x23')],'internal':_0x59cef9[_0x2117('0x5a')]});});return db[_0x2117('0xed')][_0x2117('0x7e')](_0x1b7937,{'individualHooks':!![]});})[_0x2117('0x1d')](function(){return _0x59cef9[_0x2117('0x54')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x30b049[_0x2117('0x55')]['type']||_0x2117('0xf7'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2117('0x1d')](respondWithResult(_0x1bc6ef,null))[_0x2117('0x4f')](handleError(_0x1bc6ef,null));};exports[_0x2117('0xf8')]=function(_0x465667,_0x5adf78){if(_0x465667[_0x2117('0x55')][_0x2117('0x94')]&&!utils[_0x2117('0x99')](_0x465667[_0x2117('0x55')][_0x2117('0x94')])){throw new APIBadRequestError(util[_0x2117('0xbd')](_0x2117('0xf9'),_0x465667[_0x2117('0x55')][_0x2117('0x94')]));}return db['User'][_0x2117('0x2c')]({'where':{'id':_0x465667['params']['id']},'attributes':['id',_0x2117('0x31'),_0x2117('0x23'),_0x2117('0x5a'),_0x2117('0x98'),_0x2117('0x95'),'voicePause',_0x2117('0xfa'),'chatPause','faxPause','openchannelPause',_0x2117('0xfb'),'whatsappPause',_0x2117('0xfc'),_0x2117('0xfd')]})[_0x2117('0x1d')](function(_0x2a2c80){if(!_0x2a2c80){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x465667[_0x2117('0x51')]['id']));}return _0x2a2c80[_0x2117('0xf8')](_0x465667[_0x2117('0x55')][_0x2117('0x94')]);})[_0x2117('0x1d')](respondWithResult(_0x5adf78,null))[_0x2117('0x4f')](APIHandleError(_0x5adf78));};exports[_0x2117('0xfe')]=function(_0x17cb30,_0x6041ef){var _0xcb18d9={};var _0x577f55={};var _0x3cfcd8;var _0x1ff016;return db[_0x2117('0x33')][_0x2117('0x8f')]({'where':{'id':_0x17cb30[_0x2117('0x51')]['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x6041ef,null))[_0x2117('0x1d')](function(_0x50a50d){if(_0x50a50d){_0x3cfcd8=_0x50a50d;_0x577f55[_0x2117('0xc5')]=_[_0x2117('0xc6')](db[_0x2117('0xff')]['rawAttributes']);_0x577f55[_0x2117('0x3e')]=_[_0x2117('0xc6')](_0x17cb30[_0x2117('0x3e')]);_0x577f55[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x577f55['model'],_0x577f55['query']);_0xcb18d9[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x577f55['model'],qs['fields'](_0x17cb30['query'][_0x2117('0xca')]));_0xcb18d9[_0x2117('0x42')]=_0xcb18d9[_0x2117('0x42')][_0x2117('0x48')]?_0xcb18d9[_0x2117('0x42')]:_0x577f55[_0x2117('0xc5')];_0xcb18d9[_0x2117('0xcb')]=qs[_0x2117('0xcc')](_0x17cb30[_0x2117('0x3e')][_0x2117('0xcc')]);_0xcb18d9[_0x2117('0xcd')]=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0x17cb30['query'],_0x577f55[_0x2117('0xc8')]));if(_0x17cb30[_0x2117('0x3e')][_0x2117('0x29')]){_0xcb18d9['where']=_['merge'](_0xcb18d9['where'],{'$or':_[_0x2117('0x2a')](_0xcb18d9['attributes'],function(_0x4bddf3){var _0x11cac0={};_0x11cac0[_0x4bddf3]={'$like':'%'+_0x17cb30['query'][_0x2117('0x29')]+'%'};return _0x11cac0;})});}_0xcb18d9=_[_0x2117('0xd2')]({},_0xcb18d9,_0x17cb30[_0x2117('0xce')]);return _0x3cfcd8['getTeams'](_0xcb18d9);}})[_0x2117('0x1d')](function(_0x54af11){if(_0x54af11){_0x1ff016=_0x54af11[_0x2117('0x48')];if(!_0x17cb30[_0x2117('0x3e')][_0x2117('0xbf')]('nolimit')){_0xcb18d9['limit']=qs['limit'](_0x17cb30['query'][_0x2117('0x18')]);_0xcb18d9['offset']=qs[_0x2117('0x16')](_0x17cb30[_0x2117('0x3e')][_0x2117('0x16')]);}return _0x3cfcd8[_0x2117('0xfe')](_0xcb18d9);}})[_0x2117('0x1d')](function(_0x4c8670){if(_0x4c8670){return _0x4c8670?{'count':_0x1ff016,'rows':_0x4c8670}:null;}})['then'](respondWithResult(_0x6041ef,null))[_0x2117('0x4f')](handleError(_0x6041ef,null));};exports['addTeams']=function(_0x7d598,_0x4b6397){var _0x120b20=_0x7d598[_0x2117('0x51')]['id'];var _0x1dc159=_0x7d598[_0x2117('0x55')]?_0x7d598[_0x2117('0x55')][_0x2117('0x58')]:null;var _0x2a8da8=[];return Promise[_0x2117('0xf4')]()['then'](function(){if(!_0x1dc159)throw new APIBadRequestError(_0x2117('0x100'));})['then'](function(){return db[_0x2117('0x33')][_0x2117('0x8f')]({'where':{'id':_0x120b20}});})[_0x2117('0x1d')](function(_0x51400c){if(!_0x51400c)throw new APINotFoundError(util[_0x2117('0xbd')](_0x2117('0xbe'),_0x7d598[_0x2117('0x51')]['id']));return db[_0x2117('0x60')][_0x2117('0x101')](function(_0x47c173){return _0x51400c[_0x2117('0x102')](_0x1dc159,{'transaction':_0x47c173})[_0x2117('0x1d')](function(){return db[_0x2117('0xff')]['findAll']({'where':{'id':{'$in':_0x1dc159}}});})[_0x2117('0x1d')](function(_0xb7662b){var _0x210766=_[_0x2117('0x2a')](_0xb7662b,function(_0x3709ce){return _0x3709ce[_0x2117('0x103')]();});return Promise[_0x2117('0x4e')](_0x210766);})[_0x2117('0x1d')](function(_0xffb4c9){_0x2a8da8=_[_0x2117('0x104')](_0xffb4c9);var _0xa6fb82=_['map'](_0x2a8da8,function(_0x4ac402){return _0x4ac402[_0x2117('0x105')](_0x51400c['id'],{'transaction':_0x47c173});});return Promise[_0x2117('0x4e')](_0xa6fb82);})[_0x2117('0x1d')](function(){if(!_0x51400c[_0x2117('0x95')])return;var _0x2883ac=_['filter'](_0x2a8da8,function(_0x282866){return _0x282866[_0x2117('0x106')]('channel')==='Voice';});var _0x3c99e9=_[_0x2117('0x2a')](_0x2883ac,function(_0x4c35bf){return db[_0x2117('0xa3')][_0x2117('0xa4')]({'membername':_0x51400c['name'],'UserId':_0x51400c['id'],'queue_name':_0x4c35bf[_0x2117('0x31')],'VoiceQueueId':_0x4c35bf['id'],'interface':_[_0x2117('0x62')](_0x51400c[_0x2117('0x98')])?util[_0x2117('0xbd')](_0x2117('0xa1'),_0x51400c[_0x2117('0x31')]):_0x51400c[_0x2117('0x98')],'paused':_0x51400c[_0x2117('0x97')]||![],'penalty':_0x51400c[_0x2117('0xa2')]},{'transaction':_0x47c173});});return Promise['all'](_0x3c99e9);})[_0x2117('0x1d')](function(){return db[_0x2117('0x107')][_0x2117('0x44')]({'where':{'teamId':{'$in':_0x1dc159}}});})[_0x2117('0x1d')](function(_0x807f66){var _0x233daf=_['map'](_0x807f66,function(_0x37ef25){return db[_0x2117('0x108')]['create']({'UserId':_0x51400c['id'],'VoicePrefixId':_0x37ef25[_0x2117('0x109')]},{'transaction':_0x47c173});});return Promise['all'](_0x233daf);});});})[_0x2117('0x1d')](function(){for(var _0x58bf13=0x0;_0x58bf13<_0x2a8da8['length'];_0x58bf13++){var _0x2dc427=_0x2a8da8[_0x58bf13][_0x2117('0x106')]('channel');var _0x1664d6=_0x2dc427+'QueueId';socket[_0x2117('0x1f')]('user'+_0x2dc427+_0x2117('0x10a'),{'UserId':_0x120b20,['queueField']:_0x2a8da8[_0x58bf13]['id']});}})[_0x2117('0x1d')](respondWithStatusCode(_0x4b6397,null))[_0x2117('0x4f')](APIHandleError(_0x4b6397));};exports[_0x2117('0x10b')]=function(_0x328647,_0x56b4fc){var _0x27a4af=_0x328647[_0x2117('0x51')]['id'];var _0x1e9a20=null;if(_0x328647[_0x2117('0x3e')][_0x2117('0x58')]){_0x1e9a20=_[_0x2117('0x10c')](_0x328647[_0x2117('0x3e')][_0x2117('0x58')])?_0x328647[_0x2117('0x3e')][_0x2117('0x58')]:[_0x328647[_0x2117('0x3e')]['ids']];}var _0x5e0b26=[];return Promise['resolve']()[_0x2117('0x1d')](function(){if(!_0x1e9a20)throw new APIBadRequestError(_0x2117('0x10d'));})[_0x2117('0x1d')](function(){return db['User'][_0x2117('0x8f')]({'where':{'id':_0x27a4af}});})[_0x2117('0x1d')](function(_0x171e2d){if(!_0x171e2d)throw new APINotFoundError(util['format'](_0x2117('0xbe'),_0x328647[_0x2117('0x51')]['id']));return db[_0x2117('0x60')][_0x2117('0x101')](function(_0x306072){return _0x171e2d[_0x2117('0x10b')](_0x1e9a20,{'transaction':_0x306072})[_0x2117('0x1d')](function(){return db[_0x2117('0xff')][_0x2117('0x44')]({'where':{'id':{'$in':_0x1e9a20}}});})[_0x2117('0x1d')](function(_0x578ffa){var _0x41c873=_[_0x2117('0x2a')](_0x578ffa,function(_0x85eb39){return _0x85eb39['getAssociatedQueues']();});return Promise[_0x2117('0x4e')](_0x41c873);})['then'](function(_0x42c5ae){_0x5e0b26=_[_0x2117('0x104')](_0x42c5ae);var _0x6266e6=_[_0x2117('0x2a')](_0x5e0b26,function(_0x5198d9){return _0x5198d9['removeAgent'](_0x171e2d['id'],{'transaction':_0x306072});});return Promise['all'](_0x6266e6);})[_0x2117('0x1d')](function(){if(!_0x171e2d[_0x2117('0x95')])return;var _0x25e5a5=_[_0x2117('0x29')](_0x5e0b26,function(_0x28ac4e){return _0x28ac4e['getDataValue'](_0x2117('0x94'))==='Voice';});var _0x1e562a=_[_0x2117('0x2a')](_0x25e5a5,function(_0x3992e1){return db[_0x2117('0xa3')][_0x2117('0x21')]({'where':{'VoiceQueueId':_0x3992e1['id'],'UserId':_0x171e2d['id']},'transaction':_0x306072});});return Promise[_0x2117('0x4e')](_0x1e562a);})['then'](function(){return db[_0x2117('0x107')][_0x2117('0x44')]({'where':{'teamId':{'$in':_0x1e9a20}}});})[_0x2117('0x1d')](function(_0x244ae7){var _0x519438=_['map'](_0x244ae7,function(_0x418fcc){return db['UserVoicePrefix'][_0x2117('0x21')]({'where':{'UserId':_0x171e2d['id'],'VoicePrefixId':_0x418fcc[_0x2117('0x109')]}},{'transaction':_0x306072});});return Promise['all'](_0x519438);});});})[_0x2117('0x1d')](function(){for(var _0x4ce8a2=0x0;_0x4ce8a2<_0x5e0b26[_0x2117('0x48')];_0x4ce8a2++){var _0x275a74=_0x5e0b26[_0x4ce8a2][_0x2117('0x106')](_0x2117('0x94'));var _0x1029da=_0x275a74+_0x2117('0x9f');socket['emit']('user'+_0x275a74+'Queue:remove',{'UserId':_0x27a4af,['queueField']:_0x5e0b26[_0x4ce8a2]['id']});}})['then'](respondWithStatusCode(_0x56b4fc,null))[_0x2117('0x4f')](APIHandleError(_0x56b4fc));};exports[_0x2117('0x10e')]=function(_0xd49b54,_0x16295b){var _0x3a096={};var _0x4263cf={};var _0x4fbeb6;var _0x2e13ae;return db[_0x2117('0x33')]['findOne']({'where':{'id':_0xd49b54[_0x2117('0x51')]['id']}})[_0x2117('0x1d')](handleEntityNotFound(_0x16295b,null))['then'](function(_0x19d587){if(_0x19d587){_0x4fbeb6=_0x19d587;_0x4263cf[_0x2117('0xc5')]=_[_0x2117('0xc6')](db['CmList'][_0x2117('0x34')]);_0x4263cf[_0x2117('0x3e')]=_[_0x2117('0xc6')](_0xd49b54['query']);_0x4263cf[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x4263cf['model'],_0x4263cf['query']);_0x3a096[_0x2117('0x42')]=_['intersection'](_0x4263cf[_0x2117('0xc5')],qs[_0x2117('0xca')](_0xd49b54[_0x2117('0x3e')][_0x2117('0xca')]));_0x3a096[_0x2117('0x42')]=_0x3a096[_0x2117('0x42')][_0x2117('0x48')]?_0x3a096['attributes']:_0x4263cf[_0x2117('0xc5')];_0x3a096['order']=qs[_0x2117('0xcc')](_0xd49b54[_0x2117('0x3e')][_0x2117('0xcc')]);_0x3a096[_0x2117('0xcd')]=qs[_0x2117('0xc8')](_[_0x2117('0xd1')](_0xd49b54[_0x2117('0x3e')],_0x4263cf[_0x2117('0xc8')]));if(_0xd49b54[_0x2117('0x3e')][_0x2117('0x29')]){_0x3a096[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x3a096[_0x2117('0xcd')],{'$or':_[_0x2117('0x2a')](_0x3a096[_0x2117('0x42')],function(_0x59751d){var _0x21ee6c={};_0x21ee6c[_0x59751d]={'$like':'%'+_0xd49b54['query'][_0x2117('0x29')]+'%'};return _0x21ee6c;})});}_0x3a096=_[_0x2117('0xd2')]({},_0x3a096,_0xd49b54['options']);return _0x4fbeb6[_0x2117('0x10e')](_0x3a096);}})[_0x2117('0x1d')](function(_0x48eeb3){if(_0x48eeb3){_0x2e13ae=_0x48eeb3[_0x2117('0x48')];if(!_0xd49b54[_0x2117('0x3e')][_0x2117('0xbf')](_0x2117('0xd4'))){_0x3a096[_0x2117('0x18')]=qs[_0x2117('0x18')](_0xd49b54['query'][_0x2117('0x18')]);_0x3a096[_0x2117('0x16')]=qs[_0x2117('0x16')](_0xd49b54[_0x2117('0x3e')]['offset']);}return _0x4fbeb6[_0x2117('0x10e')](_0x3a096);}})[_0x2117('0x1d')](function(_0xedaf0d){if(_0xedaf0d){return _0xedaf0d?{'count':_0x2e13ae,'rows':_0xedaf0d}:null;}})[_0x2117('0x1d')](respondWithResult(_0x16295b,null))[_0x2117('0x4f')](handleError(_0x16295b,null));};exports[_0x2117('0x10f')]=function(_0x28adc,_0x10bcfb){var _0x3744f9={};var _0x565b9a={};var _0x3dfaf1;return db[_0x2117('0x33')][_0x2117('0x8f')]({'where':{'id':_0x28adc[_0x2117('0x51')]['id']}})['then'](handleEntityNotFound(_0x10bcfb,null))[_0x2117('0x1d')](function(_0x29e836){if(_0x29e836){_0x3dfaf1=_0x29e836;_0x565b9a['model']=_[_0x2117('0xc6')](db['User']['rawAttributes']);_0x565b9a[_0x2117('0x3e')]=_['keys'](_0x28adc[_0x2117('0x3e')]);_0x565b9a[_0x2117('0xc8')]=_[_0x2117('0xc9')](_0x565b9a[_0x2117('0xc5')],_0x565b9a[_0x2117('0x3e')]);_0x3744f9[_0x2117('0x42')]=_[_0x2117('0xc9')](_0x565b9a[_0x2117('0xc5')],qs[_0x2117('0xca')](_0x28adc[_0x2117('0x3e')][_0x2117('0xca')]));_0x3744f9[_0x2117('0x42')]=_0x3744f9[_0x2117('0x42')][_0x2117('0x48')]?_0x3744f9[_0x2117('0x42')]:_0x565b9a[_0x2117('0xc5')];_0x3744f9[_0x2117('0xcb')]=qs[_0x2117('0xcc')](_0x28adc['query'][_0x2117('0xcc')]);_0x3744f9[_0x2117('0xcd')]=qs['filters'](_['pick'](_0x28adc[_0x2117('0x3e')],_0x565b9a['filters']));if(_0x28adc[_0x2117('0x3e')][_0x2117('0x29')]){_0x3744f9[_0x2117('0xcd')]=_[_0x2117('0xd2')](_0x3744f9['where'],{'$or':_[_0x2117('0x2a')](_0x3744f9['attributes'],function(_0x179b60){var _0x4ddd18={};_0x4ddd18[_0x179b60]={'$like':'%'+_0x28adc[_0x2117('0x3e')]['filter']+'%'};return _0x4ddd18;})});}_0x3744f9[_0x2117('0xc5')]=db[_0x2117('0x33')];_0x3744f9['as']=_0x2117('0x27');_0x3744f9=_[_0x2117('0xd2')]({},_0x3744f9,_0x28adc['options']);return _0x3dfaf1['getVoiceQueues']({'include':[_0x3744f9]});}})[_0x2117('0x1d')](function(_0x49371c){if(_0x49371c){var _0x395942={},_0x4365b7=[];for(var _0x372c8a=0x0;_0x372c8a<_0x49371c['length'];_0x372c8a+=0x1){for(var _0x3cb6bb=0x0,_0x46c249;_0x3cb6bb<_0x49371c[_0x372c8a][_0x2117('0x27')][_0x2117('0x48')];_0x3cb6bb+=0x1){_0x46c249=_0x49371c[_0x372c8a]['Agents'][_0x3cb6bb][_0x2117('0x22')]({'plain':!![]});_0x395942[_0x46c249['id']]=_0x46c249;}}_0x395942=_[_0x2117('0x110')](_0x395942);for(var _0x28a262=qs[_0x2117('0x16')](_0x28adc[_0x2117('0x3e')]['offset']);_0x28a262<_0x395942[_0x2117('0x48')]&&_0x4365b7['length']=_0x25c5e7){_0x4ba7d3=_0x25c5e7;_0x5ba91a=0xc8;}else{_0x5ba91a=0xce;}_0x3548ed[_0xc39f('0x12')](_0x5ba91a);return _0x3548ed[_0xc39f('0x19')](_0xc39f('0x1a'),_0xb1f994+'-'+_0x4ba7d3+'/'+_0x25c5e7)['json'](_0x19181b);}return null;};}function saveUpdates(_0x353f12){return function(_0x1b644b){if(_0x1b644b){return _0x1b644b[_0xc39f('0x1b')](_0x353f12)['then'](function(_0x6f89b7){if(_0x6f89b7[_0xc39f('0x1c')]===_0xc39f('0x1d')){socket['emit'](_0xc39f('0x1e')+_0x6f89b7['id'],_0x6f89b7);}return _0x6f89b7;});}return null;};}function removeEntity(_0x2f8e09){return function(_0x163c1e){if(_0x163c1e){return _0x163c1e['destroy']()['then'](function(){var _0x4ef54c=_0x163c1e[_0xc39f('0x1f')]({'plain':!![]});if(_0x4ef54c[_0xc39f('0x1c')]===_0xc39f('0x20'))return;var _0x4b3162=[{'name':_0xc39f('0x21'),'value':_0xc39f('0x22'),'ignore':!![]},{'name':'Agents','value':_0xc39f('0x1d'),'ignore':![]},{'name':_0xc39f('0x23'),'value':_0xc39f('0x24'),'ignore':![]}];var _0x2cd243=_(_0x4b3162)[_0xc39f('0x25')](_0xc39f('0x26'))[_0xc39f('0x27')](_0xc39f('0x28'))[_0xc39f('0x28')]();if(_[_0xc39f('0x29')](_0x2cd243,_0x4ef54c['role'])){return;}var _0x9920d0=_[_0xc39f('0x2a')](_0x4b3162,[_0xc39f('0x28'),_0x4ef54c[_0xc39f('0x1c')]])[_0xc39f('0x2b')];return db[_0xc39f('0x2c')][_0xc39f('0x2d')]({'where':{'type':_0x9920d0,'resourceId':_0x4ef54c['id']}})[_0xc39f('0x2e')](function(){return _0x163c1e;});})[_0xc39f('0x2e')](function(){_0x2f8e09[_0xc39f('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff502){return function(_0x25adef){if(!_0x25adef){_0x3ff502[_0xc39f('0x2f')](0x194);}return _0x25adef;};}function handleError(_0x3b827f,_0x3e5bdf){_0x3e5bdf=_0x3e5bdf||0x1f4;return function(_0x2628a7){logger[_0xc39f('0x30')](_0x2628a7[_0xc39f('0x31')]);if(_0x2628a7[_0xc39f('0x2b')]){delete _0x2628a7[_0xc39f('0x2b')];}_0x3b827f['status'](_0x3e5bdf)[_0xc39f('0x32')](_0x2628a7);};}function getUserAttributes(){return _(db[_0xc39f('0x33')][_0xc39f('0x34')])[_0xc39f('0x27')](function(_0x3f173a){return{'name':_0x3f173a[_0xc39f('0x35')],'type':_0x3f173a[_0xc39f('0x36')][_0xc39f('0x37')]};})[_0xc39f('0x25')](function(_0x4efcd8){return![_0xc39f('0x38'),_0xc39f('0x39'),_0xc39f('0x3a'),_0xc39f('0x3b'),_0xc39f('0x3c'),_0xc39f('0x3d')][_0xc39f('0x29')](_0x4efcd8['name']);})['value']();}exports[_0xc39f('0x3e')]=function(_0x1eeee5,_0x109520){var _0x24cdcd={},_0x3f1a54={'count':0x0,'rows':[]};var _0x4e172f=getUserAttributes();_0x24cdcd=qs[_0xc39f('0x3f')](_0x4e172f,_0x1eeee5);var _0x14a97e={'where':_0x24cdcd[_0xc39f('0x40')]};return db['User']['count'](_0x14a97e)['then'](function(_0x956e2c){_0x3f1a54[_0xc39f('0x18')]=_0x956e2c;if(_0x1eeee5[_0xc39f('0x41')][_0xc39f('0x42')]){_0x24cdcd[_0xc39f('0x43')]=[{'all':!![]}];}if(_0x1eeee5[_0xc39f('0x41')][_0xc39f('0x44')]==='true'){_0x24cdcd[_0xc39f('0x43')]=[{'model':db[_0xc39f('0x45')],'as':'userSetting'}];}if(!_[_0xc39f('0x29')](_0x24cdcd['attributes'],'id')){_0x24cdcd['attributes'][_0xc39f('0x46')]('id');}return db[_0xc39f('0x33')][_0xc39f('0x47')](_0x24cdcd);})[_0xc39f('0x2e')](function(_0x52b7f1){_0x3f1a54[_0xc39f('0x48')]=_0x52b7f1;if(_0x1eeee5[_0xc39f('0x41')][_0xc39f('0x49')]===_0xc39f('0x4a')){var _0x548d69=[];for(var _0x555008=0x0;_0x555008<_0x3f1a54[_0xc39f('0x48')][_0xc39f('0x4b')];_0x555008++){_0x548d69[_0xc39f('0x46')](get_open_tabs(_0xc39f('0x4c'),_0x3f1a54[_0xc39f('0x48')][_0x555008][_0xc39f('0x4d')]));_0x548d69[_0xc39f('0x46')](get_open_tabs(_0xc39f('0x4e'),_0x3f1a54[_0xc39f('0x48')][_0x555008][_0xc39f('0x4d')]));_0x548d69[_0xc39f('0x46')](get_open_tabs('fax',_0x3f1a54[_0xc39f('0x48')][_0x555008][_0xc39f('0x4d')]));_0x548d69['push'](get_open_tabs('mail',_0x3f1a54[_0xc39f('0x48')][_0x555008][_0xc39f('0x4d')]));_0x548d69[_0xc39f('0x46')](get_open_tabs(_0xc39f('0x4f'),_0x3f1a54[_0xc39f('0x48')][_0x555008]['dataValues']));_0x548d69['push'](get_open_tabs(_0xc39f('0x50'),_0x3f1a54[_0xc39f('0x48')][_0x555008]['dataValues']));}return Promise[_0xc39f('0x51')](_0x548d69)[_0xc39f('0x2e')](function(){return _0x3f1a54;});}else{return _0x3f1a54;}})[_0xc39f('0x2e')](respondWithFilteredResult(_0x109520,_0x24cdcd))[_0xc39f('0x52')](handleError(_0x109520,null));};exports[_0xc39f('0x53')]=function(_0x543af4,_0x5a3b46){var _0x3bfca0=getUserAttributes();_0x543af4[_0xc39f('0x41')]['id']=_0x543af4['params']['id'];var _0x1a0e92=qs[_0xc39f('0x3f')](_0x3bfca0,_0x543af4);if(_0x543af4[_0xc39f('0x41')][_0xc39f('0x42')]){_0x1a0e92[_0xc39f('0x43')]=[{'all':!![]}];}if(_0x543af4[_0xc39f('0x41')][_0xc39f('0x44')]==='true'){_0x1a0e92[_0xc39f('0x43')]=[{'model':db[_0xc39f('0x45')],'as':_0xc39f('0x44')}];}_0x1a0e92=_[_0xc39f('0x54')]({},_0x1a0e92,_0x543af4[_0xc39f('0x55')]);if(!_['includes'](_0x1a0e92[_0xc39f('0x56')],'id')){_0x1a0e92[_0xc39f('0x56')]['push']('id');}return db['User'][_0xc39f('0x2a')](_0x1a0e92)[_0xc39f('0x2e')](handleEntityNotFound(_0x5a3b46,null))[_0xc39f('0x2e')](function(_0x568b70){var _0x447ff8=[];values=_0x568b70;if(_0x543af4[_0xc39f('0x41')][_0xc39f('0x49')]===_0xc39f('0x4a')){_0x447ff8['push'](get_open_tabs(_0xc39f('0x4c'),_0x568b70['dataValues']));_0x447ff8[_0xc39f('0x46')](get_open_tabs('sms',_0x568b70['dataValues']));_0x447ff8[_0xc39f('0x46')](get_open_tabs('openchannel',_0x568b70[_0xc39f('0x4d')]));_0x447ff8['push'](get_open_tabs('whatsapp',_0x568b70['dataValues']));_0x447ff8['push'](get_open_tabs(_0xc39f('0x57'),_0x568b70[_0xc39f('0x4d')]));_0x447ff8[_0xc39f('0x46')](get_open_tabs(_0xc39f('0x58'),_0x568b70[_0xc39f('0x4d')]));return Promise['all'](_0x447ff8);}else{return values;}})['then'](function(){return values;})[_0xc39f('0x2e')](respondWithResult(_0x5a3b46,null))[_0xc39f('0x52')](handleError(_0x5a3b46,null));};exports['update']=function(_0x4758b1,_0x384226){if(_0x4758b1[_0xc39f('0x59')]['id']){delete _0x4758b1[_0xc39f('0x59')]['id'];}delete _0x4758b1['body'][_0xc39f('0x1c')];return db[_0xc39f('0x33')][_0xc39f('0x2a')]({'where':{'id':_0x4758b1['params']['id']}})['then'](handleEntityNotFound(_0x384226,null))[_0xc39f('0x2e')](saveUpdates(_0x4758b1['body'],null))[_0xc39f('0x2e')](respondWithResult(_0x384226,null))[_0xc39f('0x52')](handleError(_0x384226,null));};exports[_0xc39f('0x5a')]=function(_0x7f175f,_0x4042a0){return db[_0xc39f('0x33')][_0xc39f('0x5a')]()[_0xc39f('0x2e')](respondWithResult(_0x4042a0,null))[_0xc39f('0x52')](handleError(_0x4042a0,null));};exports[_0xc39f('0x5b')]=function(_0x3c5715,_0x35332c){return db[_0xc39f('0x33')]['find']({'where':{'id':_0x3c5715['params']['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0x35332c,null))[_0xc39f('0x2e')](function(_0x1aff94){if(_0x1aff94){return _0x1aff94[_0xc39f('0x5b')](_0x3c5715[_0xc39f('0x59')][_0xc39f('0x5c')],_['omit'](_0x3c5715[_0xc39f('0x59')],[_0xc39f('0x5c'),'id'])||{});}})[_0xc39f('0x2e')](respondWithResult(_0x35332c,null))[_0xc39f('0x52')](handleError(_0x35332c,null));};function validateUser(_0x38766c){return new Promise(function(_0x5384a0,_0x4d59a4){if(_0x38766c['internal'])return _0x5384a0(_0x38766c);return db[_0xc39f('0x5d')][_0xc39f('0x5e')](0x1)[_0xc39f('0x2e')](function(_0x1b7ae1){if(_0x1b7ae1[_0xc39f('0x5f')])authService[_0xc39f('0x60')](_0x38766c['password']);db['User']['max'](_0xc39f('0x61'))[_0xc39f('0x2e')](function(_0x23951e){if(_[_0xc39f('0x62')](_0x23951e)){_0x38766c[_0xc39f('0x61')]=_0x1b7ae1[_0xc39f('0x63')]||0x1;return;}if(_[_0xc39f('0x62')](_0x1b7ae1[_0xc39f('0x63')])||_0x1b7ae1[_0xc39f('0x63')]===_0x23951e){_0x38766c['internal']=_0x23951e+0x1;return;}if(_0x1b7ae1[_0xc39f('0x63')]>_0x23951e){_0x38766c['internal']=_0x1b7ae1[_0xc39f('0x63')];return;}return db[_0xc39f('0x64')][_0xc39f('0x41')](_0xc39f('0x65'),{'type':db[_0xc39f('0x64')]['QueryTypes'][_0xc39f('0x66')]})[_0xc39f('0x2e')](function(_0x562bc3){if(_0x562bc3&&_0x562bc3[_0xc39f('0x4b')]){for(var _0x3e6c42=0x0,_0x3e84cc=_0x562bc3[_0xc39f('0x4b')];_0x3e6c42<_0x3e84cc&&_[_0xc39f('0x62')](_0x38766c[_0xc39f('0x61')]);_0x3e6c42++){if(_0x1b7ae1[_0xc39f('0x63')]<=_0x562bc3[_0x3e6c42][_0xc39f('0x67')]){_0x38766c[_0xc39f('0x61')]=_0x562bc3[_0x3e6c42][_0xc39f('0x67')];}else if(_0x1b7ae1[_0xc39f('0x63')]>_0x562bc3[_0x3e6c42][_0xc39f('0x67')]&&_0x1b7ae1[_0xc39f('0x63')]<=_0x562bc3[_0x3e6c42]['to']){_0x38766c[_0xc39f('0x61')]=_0x1b7ae1[_0xc39f('0x63')];}}}if(_[_0xc39f('0x62')](_0x38766c[_0xc39f('0x61')])){_0x38766c[_0xc39f('0x61')]=_0x23951e+0x1;}return _0x5384a0(_0x38766c);});});})[_0xc39f('0x52')](function(_0x3c9f81){_0x4d59a4(_0x3c9f81);});});}function updateUser(_0x352463){return new Promise(function(_0x24f92e,_0x137701){try{if(_0x352463['voicemail']){_0x352463[_0xc39f('0x68')]=_0x352463[_0xc39f('0x61')];_0x352463['VoiceMail']={'mailbox':_0x352463['internal'],'password':_0x352463['password'],'fullname':_0x352463[_0xc39f('0x69')],'email':_0x352463['email']};}if(_0x352463['role']==='agent'){if(!_0x352463[_0xc39f('0x6a')])_0x352463['permissions']=[_0xc39f('0x6b'),_0xc39f('0x6c'),'103',_0xc39f('0x6d'),_0xc39f('0x6e'),_0xc39f('0x6f'),_0xc39f('0x70'),_0xc39f('0x71'),_0xc39f('0x72'),_0xc39f('0x73'),_0xc39f('0x74'),_0xc39f('0x75'),_0xc39f('0x76'),'114','115'];}_0x24f92e(_0x352463);}catch(_0x2e0110){_0x137701(_0x2e0110);}});}exports[_0xc39f('0x77')]=function(_0x316eb1,_0x4c6dd1){if(_0x316eb1[_0xc39f('0x22')]['role']===_0xc39f('0x1d'))throw new Error(_0xc39f('0x78'));if(_0x316eb1[_0xc39f('0x59')]['role']===_0xc39f('0x22')&&_0x316eb1['user'][_0xc39f('0x1c')]!==_0xc39f('0x20')){throw new Error(_0xc39f('0x79'));}if(_0x316eb1[_0xc39f('0x59')][_0xc39f('0x1c')]===_0xc39f('0x20')&&_0x316eb1[_0xc39f('0x22')][_0xc39f('0x1c')]!==_0xc39f('0x20')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xc39f('0x7a')]([_0x316eb1['body']])['then'](function(){return validateUser(_0x316eb1[_0xc39f('0x59')]);})['then'](function(_0x25d397){return updateUser(_0x25d397)['then'](function(_0x49183b){if(_0x49183b[_0xc39f('0x1c')]==='admin'){_0x49183b[_0xc39f('0x7b')]=_0x316eb1[_0xc39f('0x22')]['settingsEnabled'];delete _0x49183b[_0xc39f('0x7c')];}return _0x49183b;});})['then'](function(_0x1278eb){return db[_0xc39f('0x33')]['create'](_0x1278eb,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xc39f('0x2e')](function(_0xe28b73){if(_0x316eb1[_0xc39f('0x59')][_0xc39f('0x1c')]==='user')return _0xe28b73;if(_0x316eb1[_0xc39f('0x22')][_0xc39f('0x1c')]!==_0xc39f('0x22'))return _0xe28b73;return db['UserProfileSection'][_0xc39f('0x2a')]({'where':{'name':_0xe28b73['role']===_0xc39f('0x1d')?_0xc39f('0x7d'):'Telephones','userProfileId':_0x316eb1[_0xc39f('0x22')][_0xc39f('0x7c')]},'raw':!![]})['then'](function(_0x5165a2){if(!_0x5165a2||_0x5165a2['autoAssociation']!=0x0)return _0xe28b73;return db[_0xc39f('0x2c')][_0xc39f('0x77')]({'name':_0xe28b73[_0xc39f('0x2b')],'resourceId':_0xe28b73['id'],'type':_0x5165a2[_0xc39f('0x2b')],'sectionId':_0x5165a2['id']},{})['then'](function(){return _0xe28b73;});})[_0xc39f('0x52')](function(_0x2f49d9){logger['error'](_0xc39f('0x7e'),_0x2f49d9);throw _0x2f49d9;});})[_0xc39f('0x2e')](respondWithResult(_0x4c6dd1,0xc9))['catch'](handleError(_0x4c6dd1,null));};exports[_0xc39f('0x7f')]=function(_0x41dd52,_0x1343cf){var _0x29cf94=_0x41dd52[_0xc39f('0x59')];var _0x239639=[];if(_0x41dd52['user'][_0xc39f('0x1c')]===_0xc39f('0x1d'))throw new Error('Unauthorized');if(_['some'](_0x29cf94,[_0xc39f('0x1c'),_0xc39f('0x22')])&&_0x41dd52[_0xc39f('0x22')]['role']!==_0xc39f('0x20')){throw new Error(_0xc39f('0x79'));}if(_[_0xc39f('0x80')](_0x29cf94,[_0xc39f('0x1c'),_0xc39f('0x20')])&&_0x41dd52['user'][_0xc39f('0x1c')]!=='admin'){throw new Error(_0xc39f('0x81'));}return licenseUtil[_0xc39f('0x7a')](_0x29cf94)[_0xc39f('0x2e')](function(){return validateUser(_0x29cf94[0x0]);})[_0xc39f('0x2e')](function(){for(var _0x111684=0x1;_0x111684<_0x29cf94[_0xc39f('0x4b')];_0x111684++){var _0x2b97a6=_0x29cf94[_0x111684-0x1][_0xc39f('0x61')];if(!_0x29cf94[_0x111684][_0xc39f('0x61')])_0x29cf94[_0x111684][_0xc39f('0x61')]=_0x2b97a6+0x1;_0x239639[_0xc39f('0x46')](validateUser(_0x29cf94[_0x111684]));}return Promise[_0xc39f('0x51')](_0x239639);})[_0xc39f('0x2e')](function(){_0x239639=[];for(var _0x3b14de=0x0;_0x3b14de<_0x29cf94[_0xc39f('0x4b')];_0x3b14de++){_0x239639[_0xc39f('0x46')](updateUser(_0x29cf94[_0x3b14de]));}return Promise[_0xc39f('0x51')](_0x239639);})[_0xc39f('0x2e')](function(){_0x239639=_0x29cf94['map'](function(_0x6afe2c){return db['User']['create'](_0x6afe2c,{'include':[{'model':db['VoiceMail'],'as':_0xc39f('0x82')}]})[_0xc39f('0x2e')](function(_0x4c7608){_0x6afe2c['id']=_0x4c7608['id'];return _0x6afe2c;});});return Promise[_0xc39f('0x51')](_0x239639);})[_0xc39f('0x2e')](function(_0x133e63){if(_0x41dd52['body']['role']===_0xc39f('0x22'))return _0x133e63;if(_0x41dd52[_0xc39f('0x22')][_0xc39f('0x1c')]!==_0xc39f('0x22'))return _0x133e63;var _0x3ea1b0=_[_0xc39f('0x80')](_0x133e63,function(_0x3fe807){return _0x3fe807[_0xc39f('0x1c')]===_0xc39f('0x1d')||_0x3fe807[_0xc39f('0x1c')]===_0xc39f('0x24');});if(!_0x3ea1b0)return _0x133e63;return db[_0xc39f('0x83')][_0xc39f('0x47')]({'where':{'name':{'$or':[_0xc39f('0x7d'),_0xc39f('0x23')]},'userProfileId':_0x41dd52[_0xc39f('0x22')][_0xc39f('0x7c')]},'raw':!![]})[_0xc39f('0x2e')](function(_0x3a8c82){if(_['isEmpty'](_0x3a8c82)||!_[_0xc39f('0x80')](_0x3a8c82,[_0xc39f('0x84'),0x0]))return _0x133e63;_0x239639=[];var _0x3b629c=_(_0x3a8c82)[_0xc39f('0x27')](function(_0x425d80){if(_0x425d80['autoAssociation']===0x1)return;return _0x425d80[_0xc39f('0x2b')]==='Agents'?_0xc39f('0x1d'):_0xc39f('0x24');})[_0xc39f('0x85')]()[_0xc39f('0x28')]();for(var _0xfdc34a=0x0;_0xfdc34a<_0x133e63['length'];_0xfdc34a++){if(!_[_0xc39f('0x29')](_0x3b629c,_0x133e63[_0xfdc34a][_0xc39f('0x1c')]))return;var _0x3fb005=_0x133e63[_0xfdc34a]['role']===_0xc39f('0x1d')?_0xc39f('0x7d'):_0xc39f('0x23');_0x239639[_0xc39f('0x46')](db[_0xc39f('0x2c')][_0xc39f('0x77')]({'name':_0x133e63[_0xfdc34a][_0xc39f('0x2b')],'resourceId':_0x133e63[_0xfdc34a]['id'],'type':_0x3fb005,'sectionId':_[_0xc39f('0x2a')](_0x3a8c82,[_0xc39f('0x2b'),_0x3fb005])['id']},{}));}return Promise[_0xc39f('0x51')](_0x239639);});})['then'](respondWithResult(_0x1343cf,0xc9))['catch'](handleError(_0x1343cf,null));};exports['changePassword']=function(_0x455d07,_0x3eb625){if(_0x455d07['body']['id']){delete _0x455d07[_0xc39f('0x59')]['id'];}return db[_0xc39f('0x33')]['find']({'where':{'id':_0x455d07[_0xc39f('0x86')]['id']}})[_0xc39f('0x2e')](function(_0x22cda4){if(!_0x22cda4)return null;if(_0x22cda4['id']===_0x455d07[_0xc39f('0x22')]['id']){if(!_0x455d07[_0xc39f('0x59')]['oldPassword']||!_0x455d07[_0xc39f('0x59')][_0xc39f('0x87')]){throw new db[(_0xc39f('0x88'))][(_0xc39f('0x89'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x22cda4[_0xc39f('0x8a')](_0x455d07[_0xc39f('0x59')][_0xc39f('0x8b')])){throw new db[(_0xc39f('0x88'))][(_0xc39f('0x89'))]('Wrong\x20credentials');}if(_0x455d07['body'][_0xc39f('0x8b')]===_0x455d07[_0xc39f('0x59')][_0xc39f('0x87')]){throw new db[(_0xc39f('0x88'))]['ValidationError'](_0xc39f('0x8c'));}}else if(_0x455d07['user'][_0xc39f('0x1c')]===_0xc39f('0x20')){if(!_0x455d07['body'][_0xc39f('0x87')]){throw new db[(_0xc39f('0x88'))][(_0xc39f('0x89'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x455d07[_0xc39f('0x22')][_0xc39f('0x1c')]===_0xc39f('0x22')){if(!_0x455d07['body'][_0xc39f('0x87')]){throw new db[(_0xc39f('0x88'))][(_0xc39f('0x89'))](_0xc39f('0x8d'));}if(_0x22cda4[_0xc39f('0x1c')]!==_0xc39f('0x1d')){throw new db[(_0xc39f('0x88'))][(_0xc39f('0x89'))]('Unauthorized');}}else{throw new db[(_0xc39f('0x88'))][(_0xc39f('0x89'))](_0xc39f('0x78'));}return _0x22cda4;})['then'](handleEntityNotFound(_0x3eb625,null))[_0xc39f('0x2e')](function(_0x23e3f8){return db[_0xc39f('0x5d')]['findOne']({'attributes':['id',_0xc39f('0x5f'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xc39f('0x2e')](function(_0x4d10a2){if(_0x4d10a2[_0xc39f('0x5f')])authService[_0xc39f('0x60')](_0x455d07[_0xc39f('0x59')][_0xc39f('0x87')]);if(!_0x4d10a2[_0xc39f('0x8e')]||!_0x23e3f8[_0xc39f('0x3a')])return _0x23e3f8;authService['validatePasswordHistory'](_0x455d07[_0xc39f('0x59')][_0xc39f('0x87')],_0x23e3f8[_0xc39f('0x3a')],_0x4d10a2[_0xc39f('0x8f')]);return _0x23e3f8;})[_0xc39f('0x2e')](saveUpdates({'password':_0x455d07['body'][_0xc39f('0x87')],'passwordResetAt':_0x455d07[_0xc39f('0x22')]['id']==_0x455d07[_0xc39f('0x86')]['id']?moment():null,'previousPasswords':authService[_0xc39f('0x90')](_0x455d07[_0xc39f('0x59')][_0xc39f('0x87')],_0x23e3f8[_0xc39f('0x3a')])},null));})[_0xc39f('0x2e')](respondWithResult(_0x3eb625,null))[_0xc39f('0x52')](handleError(_0x3eb625,null));};exports[_0xc39f('0x91')]=function(_0x338855,_0x28e8ef){var _0x40f520=_0x338855[_0xc39f('0x59')][_0xc39f('0x92')];return db[_0xc39f('0x33')][_0xc39f('0x2a')]({'where':{'id':_0x338855['params']['id']},'attributes':['id',_0xc39f('0x2b'),_0xc39f('0x1c'),'online',_0xc39f('0x93'),_0xc39f('0x94'),_0xc39f('0x95')]})['then'](handleEntityNotFound(_0x28e8ef,null))[_0xc39f('0x2e')](function(_0x370bca){if(_0x370bca){if(!utils[_0xc39f('0x96')](_0x40f520)){throw new db[(_0xc39f('0x88'))]['ValidationError']('Unknown\x20channel');}return _0x370bca[_0xc39f('0x97')+_[_0xc39f('0x98')](_0x40f520[_0xc39f('0x99')]())+_0xc39f('0x9a')](_0x338855[_0xc39f('0x59')]['ids'],{'penalty':_0x338855['body'][_0xc39f('0x9b')]||0x0})[_0xc39f('0x9c')](function(_0x3fc91b){for(var _0x443ddd=0x0;_0x443ddd<_0x338855['body'][_0xc39f('0x5c')][_0xc39f('0x4b')];_0x443ddd+=0x1){var _0x4505e7={'UserId':Number(_0x338855[_0xc39f('0x86')]['id'])};_0x4505e7[_[_0xc39f('0x98')](_0x40f520[_0xc39f('0x99')]())+'QueueId']=Number(_0x338855[_0xc39f('0x59')][_0xc39f('0x5c')][_0x443ddd]);socket[_0xc39f('0x9d')](_0xc39f('0x22')+_['capitalize'](_0x40f520[_0xc39f('0x99')]())+_0xc39f('0x9e'),_0x4505e7);}return _0x3fc91b;})[_0xc39f('0x2e')](function(){if(_0x40f520===_0xc39f('0x9f')){return db[_0xc39f('0xa0')][_0xc39f('0x47')]({'where':{'id':_0x338855[_0xc39f('0x59')]['ids']||[]},'raw':!![],'attributes':['id',_0xc39f('0x2b')]});}})[_0xc39f('0x2e')](function(_0x2451b9){var _0x2cd790=_0x370bca[_0xc39f('0x1f')]({'plain':!![]});var _0x2c8973=[];if(_0x40f520===_0xc39f('0x9f')&&_0x2cd790['role']===_0xc39f('0x1d')&&_0x2cd790[_0xc39f('0xa1')]){for(let _0x3560bc=0x0;_0x3560bc<_0x2451b9['length'];_0x3560bc+=0x1){_0x2c8973[_0xc39f('0x46')]({'membername':_0x2cd790[_0xc39f('0x2b')],'UserId':_0x2cd790['id'],'queue_name':_0x2451b9[_0x3560bc][_0xc39f('0x2b')],'VoiceQueueId':_0x2451b9[_0x3560bc]['id'],'interface':_[_0xc39f('0x62')](_0x2cd790[_0xc39f('0x95')])?util[_0xc39f('0xa2')]('SIP/%s',_0x2cd790[_0xc39f('0x2b')]):_0x2cd790[_0xc39f('0x95')],'paused':_0x2cd790['voicePause']||![],'penalty':_0x338855[_0xc39f('0x59')][_0xc39f('0x9b')]||0x0});}return Promise[_0xc39f('0x51')](_0x2c8973[_0xc39f('0x27')](function(_0x2563e5){return db[_0xc39f('0xa3')][_0xc39f('0xa4')](_0x2563e5);}));}return _0x370bca;});}})[_0xc39f('0x2e')](respondWithStatusCode(_0x28e8ef,null))['catch'](handleError(_0x28e8ef,null));};exports['removeQueues']=function(_0x301819,_0x54fefe){var _0x14d96d,_0x511e90;return db['User'][_0xc39f('0x2a')]({'where':{'id':_0x301819[_0xc39f('0x86')]['id']},'attributes':['id',_0xc39f('0x2b'),'role']})[_0xc39f('0x2e')](handleEntityNotFound(_0x54fefe,null))[_0xc39f('0x2e')](function(_0x1b4af7){if(_0x1b4af7){_0x14d96d=_0x1b4af7;if(!_0x301819[_0xc39f('0x41')]['channel']||!utils[_0xc39f('0x96')](_0x301819[_0xc39f('0x41')]['channel'])){throw new db[(_0xc39f('0x88'))][(_0xc39f('0x89'))](_0xc39f('0xa5'));}return _0x1b4af7[_0xc39f('0xa6')+_[_0xc39f('0x98')](_0x301819[_0xc39f('0x41')][_0xc39f('0x92')][_0xc39f('0x99')]())+'Queues'](_0x301819[_0xc39f('0x41')][_0xc39f('0x5c')]);}})[_0xc39f('0x2e')](function(_0x24466b){if(_['isArray'](_0x301819[_0xc39f('0x41')][_0xc39f('0x5c')])){for(var _0x52c95b=0x0;_0x52c95b<_0x301819[_0xc39f('0x41')][_0xc39f('0x5c')][_0xc39f('0x4b')];_0x52c95b+=0x1){_0x511e90={'UserId':Number(_0x301819[_0xc39f('0x86')]['id'])};_0x511e90[_[_0xc39f('0x98')](_0x301819[_0xc39f('0x41')]['channel']['toLowerCase']())+_0xc39f('0xa7')]=Number(_0x301819[_0xc39f('0x41')][_0xc39f('0x5c')][_0x52c95b]);socket[_0xc39f('0x9d')]('user'+_[_0xc39f('0x98')](_0x301819[_0xc39f('0x41')]['channel'][_0xc39f('0x99')]())+_0xc39f('0xa8'),_0x511e90);}}else{_0x511e90={'UserId':Number(_0x301819[_0xc39f('0x86')]['id'])};_0x511e90[_[_0xc39f('0x98')](_0x301819['query'][_0xc39f('0x92')][_0xc39f('0x99')]())+_0xc39f('0xa7')]=Number(_0x301819[_0xc39f('0x41')][_0xc39f('0x5c')]);socket['emit'](_0xc39f('0x22')+_['capitalize'](_0x301819[_0xc39f('0x41')][_0xc39f('0x92')]['toLowerCase']())+_0xc39f('0xa8'),_0x511e90);}return _0x24466b;})[_0xc39f('0x2e')](function(){if(_0x301819[_0xc39f('0x41')][_0xc39f('0x92')]==='voice'){return db[_0xc39f('0xa3')]['destroy']({'where':{'UserId':_0x301819[_0xc39f('0x86')]['id'],'VoiceQueueId':_0x301819['query'][_0xc39f('0x5c')]},'individualHooks':!![]})['then'](function(){return _0x14d96d;});}return _0x14d96d;})[_0xc39f('0x2e')](respondWithStatusCode(_0x54fefe,null))['catch'](handleError(_0x54fefe,null));};exports[_0xc39f('0xa9')]=function(_0x1cae27,_0x47ebe3){_0x1cae27[_0xc39f('0x59')][_0xc39f('0xaa')]=_0x1cae27[_0xc39f('0xab')]['filename'];return db[_0xc39f('0x33')][_0xc39f('0x2a')]({'where':{'id':_0x1cae27[_0xc39f('0x86')]['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0x47ebe3,null))[_0xc39f('0x2e')](saveUpdates(_0x1cae27['body'],null))[_0xc39f('0x2e')](respondWithResult(_0x47ebe3,null))['catch'](handleError(_0x47ebe3,null));};exports[_0xc39f('0xac')]=function(_0x10ec81,_0x556619){var _0x19cbab=path['join'](config[_0xc39f('0xad')],'server/files/images/logos/default_profile.png');return db[_0xc39f('0x33')][_0xc39f('0x2a')]({'where':{'id':_0x10ec81[_0xc39f('0x86')]['id']},'attributes':['id',_0xc39f('0xaa')],'raw':!![]})['then'](handleEntityNotFound(_0x556619,null))[_0xc39f('0x2e')](function(_0x47e8f2){if(_0x47e8f2){if(_[_0xc39f('0x62')](_0x47e8f2[_0xc39f('0xaa')])){return _0x556619['download'](_0x19cbab);}else{if(!fs[_0xc39f('0xae')](path[_0xc39f('0xaf')](config[_0xc39f('0xad')],_0xc39f('0xb0'),_0x47e8f2[_0xc39f('0xaa')]))){return _0x556619[_0xc39f('0xb1')](_0x19cbab);}return _0x556619['download'](path[_0xc39f('0xaf')](config[_0xc39f('0xad')],'server/files/images/',_0x47e8f2[_0xc39f('0xaa')]));}}})[_0xc39f('0x52')](handleError(_0x556619,null));};exports['getOpenTabs']=function(_0x50df53,_0x2c77a3){return db[_0xc39f('0x33')]['find']({'where':{'id':_0x50df53[_0xc39f('0x86')]['id']},'attributes':['id']})[_0xc39f('0x2e')](handleEntityNotFound(_0x2c77a3,null))[_0xc39f('0x2e')](function(_0x96fc7b){var _0x1c47fa=[];values=_0x96fc7b['dataValues'];_0x1c47fa[_0xc39f('0x46')](get_open_tabs('chat',_0x96fc7b[_0xc39f('0x4d')]));_0x1c47fa[_0xc39f('0x46')](get_open_tabs('sms',_0x96fc7b['dataValues']));_0x1c47fa[_0xc39f('0x46')](get_open_tabs(_0xc39f('0x4f'),_0x96fc7b[_0xc39f('0x4d')]));_0x1c47fa[_0xc39f('0x46')](get_open_tabs(_0xc39f('0x50'),_0x96fc7b[_0xc39f('0x4d')]));_0x1c47fa[_0xc39f('0x46')](get_open_tabs(_0xc39f('0x57'),_0x96fc7b['dataValues']));_0x1c47fa[_0xc39f('0x46')](get_open_tabs(_0xc39f('0x58'),_0x96fc7b[_0xc39f('0x4d')]));return Promise[_0xc39f('0x51')](_0x1c47fa);})[_0xc39f('0x2e')](function(_0x5b06d8){if(_0x5b06d8){var _0x397cd7=_[_0xc39f('0x27')](values[_0xc39f('0xb2')],function(_0x49104b){return{'channel':_0xc39f('0xb3'),'id':_0x49104b['id'],'createdAt':_0x49104b['createdAt']};});var _0x105d91=_['map'](values[_0xc39f('0xb4')],function(_0x3de5e5){return{'channel':_0xc39f('0xb5'),'id':_0x3de5e5['id'],'createdAt':_0x3de5e5[_0xc39f('0xb6')]};});var _0x1861e7=_[_0xc39f('0x27')](values['OpenchannelOpenTabs'],function(_0x2ca288){return{'channel':_0xc39f('0xb7'),'id':_0x2ca288['id'],'createdAt':_0x2ca288[_0xc39f('0xb6')]};});var _0x361d81=_[_0xc39f('0x27')](values['MailOpenTabs'],function(_0xd8f778){return{'channel':_0xc39f('0xb8'),'id':_0xd8f778['id'],'createdAt':_0xd8f778[_0xc39f('0xb6')]};});var _0x4a1bc2=_[_0xc39f('0x27')](values[_0xc39f('0xb9')],function(_0x257ae0){return{'channel':_0xc39f('0xba'),'id':_0x257ae0['id'],'createdAt':_0x257ae0[_0xc39f('0xb6')]};});var _0x28daac=_[_0xc39f('0x27')](values[_0xc39f('0xbb')],function(_0x2fea9e){return{'channel':_0xc39f('0xbc'),'id':_0x2fea9e['id'],'createdAt':_0x2fea9e[_0xc39f('0xb6')]};});var _0x4df3d4=_[_0xc39f('0xbd')](_0x397cd7,_0x105d91,_0x1861e7,_0x361d81,_0x4a1bc2,_0x28daac);var _0x436f05={'count':_0x4df3d4[_0xc39f('0x4b')],'rows':_0x4df3d4};return _0x436f05;}else return null;})[_0xc39f('0x2e')](respondWithResult(_0x2c77a3,null))[_0xc39f('0x52')](handleError(_0x2c77a3,null));};exports[_0xc39f('0xbe')]=function(_0x4aa846,_0x537075){var _0x3efe21={};return db[_0xc39f('0x33')][_0xc39f('0xbf')]({'where':{'id':_0x4aa846[_0xc39f('0x86')]['id']}})[_0xc39f('0x2e')](function(_0x3d84ae){if(!_0x3d84ae){throw new APINotFoundError(util[_0xc39f('0xa2')](_0xc39f('0xc0'),_0x4aa846[_0xc39f('0x86')]['id']));}return contacts['describe']();})[_0xc39f('0x2e')](function(_0x3f3dd5){_0x4aa846[_0xc39f('0x41')][_0xc39f('0x33')]=_0x4aa846[_0xc39f('0x86')]['id'];_0x3efe21=qs[_0xc39f('0x3f')](_0x3f3dd5,_0x4aa846);if(_0x4aa846[_0xc39f('0x41')][_0xc39f('0xc1')](_0xc39f('0x42'))){_0x3efe21['include']=[{'model':db[_0xc39f('0xc2')],'as':_0xc39f('0xc3'),'required':![]},{'model':db[_0xc39f('0xc4')],'as':_0xc39f('0xc5'),'attributes':['id',_0xc39f('0x2b'),_0xc39f('0xc6')],'where':_0x4aa846[_0xc39f('0x41')][_0xc39f('0xc7')]?{'id':_0x4aa846[_0xc39f('0x41')][_0xc39f('0xc7')]}:undefined,'required':_0x4aa846[_0xc39f('0x41')][_0xc39f('0xc7')]?!![]:![]}];}return contacts[_0xc39f('0x47')](_0x4aa846['query'],_0x4aa846['user'],_0x3efe21,_0x3f3dd5);})[_0xc39f('0x2e')](respondWithFilteredResult(_0x537075,_0x3efe21))['catch'](APIHandleError(_0x537075));};exports[_0xc39f('0xc8')]=function(_0x56debc,_0x5e3dc7){var _0x492eb7;var _0x293220={};var _0x4b7a90;return db[_0xc39f('0x33')][_0xc39f('0xbf')]({'where':{'id':_0x56debc[_0xc39f('0x86')]['id']},'attributes':['id',_0xc39f('0x2b'),'role']})[_0xc39f('0x2e')](handleEntityNotFound(_0x5e3dc7,null))[_0xc39f('0x2e')](function(_0x53df26){if(!utils['isValidChannel'](_0x56debc[_0xc39f('0x41')][_0xc39f('0x92')])){throw new db[(_0xc39f('0x88'))]['ValidationError'](_0xc39f('0xa5'));}_0x492eb7=_0x53df26;var _0x34e726={};_0x34e726[_0xc39f('0xc9')]=_['keys'](db[_[_0xc39f('0x98')](_0x56debc['query'][_0xc39f('0x92')])+_0xc39f('0xca')]['rawAttributes']);_0x34e726[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x56debc['query']);_0x34e726[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0x34e726['model'],_0x34e726[_0xc39f('0x41')]);_0x293220[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x34e726[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x56debc[_0xc39f('0x41')]['fields']));_0x293220[_0xc39f('0x56')]=_0x293220[_0xc39f('0x56')][_0xc39f('0x4b')]?_0x293220[_0xc39f('0x56')]:_0x34e726[_0xc39f('0xc9')];_0x293220[_0xc39f('0xcf')]=qs['sort'](_0x56debc[_0xc39f('0x41')][_0xc39f('0xd0')]);_0x293220[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_[_0xc39f('0xd1')](_0x56debc['query'],_0x34e726[_0xc39f('0xcc')]));if(_0x56debc[_0xc39f('0x41')][_0xc39f('0x25')]){_0x293220[_0xc39f('0x40')]=_[_0xc39f('0x54')](_0x293220[_0xc39f('0x40')],{'$or':_[_0xc39f('0x27')](_0x293220['attributes'],function(_0x445ec1){var _0x376655={};_0x376655[_0x445ec1]={'$like':'%'+_0x56debc[_0xc39f('0x41')]['filter']+'%'};return _0x376655;})});}_0x293220=_[_0xc39f('0x54')]({},_0x293220,_0x56debc[_0xc39f('0x55')]);switch(_0x492eb7['role']){case _0xc39f('0x20'):return db[_[_0xc39f('0x98')](_0x56debc[_0xc39f('0x41')][_0xc39f('0x92')])+_0xc39f('0xca')][_0xc39f('0x47')](_0x293220);case _0xc39f('0x22'):case'agent':return _0x492eb7['get'+_[_0xc39f('0x98')](_0x56debc[_0xc39f('0x41')]['channel'])+_0xc39f('0x9a')](_0x293220);default:throw new db[(_0xc39f('0x88'))]['ValidationError'](_0xc39f('0xd2'));}})['then'](function(_0x485b24){_0x4b7a90=_0x485b24['length'];if(!_0x56debc[_0xc39f('0x41')]['hasOwnProperty'](_0xc39f('0xd3'))){_0x293220[_0xc39f('0x16')]=qs['limit'](_0x56debc['query']['limit']);_0x293220[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x56debc['query'][_0xc39f('0x15')]);}switch(_0x492eb7[_0xc39f('0x1c')]){case _0xc39f('0x20'):return db[_[_0xc39f('0x98')](_0x56debc[_0xc39f('0x41')][_0xc39f('0x92')])+_0xc39f('0xca')][_0xc39f('0x47')](_0x293220);case _0xc39f('0x22'):case _0xc39f('0x1d'):return _0x492eb7[_0xc39f('0x1f')+_['capitalize'](_0x56debc[_0xc39f('0x41')][_0xc39f('0x92')])+_0xc39f('0x9a')](_0x293220);}})[_0xc39f('0x2e')](function(_0x31d51f){return{'count':_0x4b7a90,'rows':_0x31d51f};})['then'](respondWithResult(_0x5e3dc7,null))['catch'](handleError(_0x5e3dc7,null));};exports[_0xc39f('0xd4')]=function(_0x2f5a41,_0x21a283){var _0x14d1b1={};var _0x3ea066={};var _0x1f8c57;var _0x1e09ef;return db[_0xc39f('0x33')]['findOne']({'where':{'id':_0x2f5a41[_0xc39f('0x86')]['id']}})['then'](handleEntityNotFound(_0x21a283,null))[_0xc39f('0x2e')](function(_0x5d57c9){if(_0x5d57c9){_0x1f8c57=_0x5d57c9;_0x3ea066[_0xc39f('0xc9')]=_[_0xc39f('0xcb')](db[_0xc39f('0xa3')]['rawAttributes']);_0x3ea066[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x2f5a41[_0xc39f('0x41')]);_0x3ea066[_0xc39f('0xcc')]=_['intersection'](_0x3ea066['model'],_0x3ea066[_0xc39f('0x41')]);_0x14d1b1['attributes']=_[_0xc39f('0xcd')](_0x3ea066[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x2f5a41['query'][_0xc39f('0xce')]));_0x14d1b1[_0xc39f('0x56')]=_0x14d1b1[_0xc39f('0x56')]['length']?_0x14d1b1['attributes']:_0x3ea066[_0xc39f('0xc9')];_0x14d1b1[_0xc39f('0xcf')]=qs[_0xc39f('0xd0')](_0x2f5a41[_0xc39f('0x41')][_0xc39f('0xd0')]);_0x14d1b1[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_[_0xc39f('0xd1')](_0x2f5a41[_0xc39f('0x41')],_0x3ea066[_0xc39f('0xcc')]));if(_0x2f5a41[_0xc39f('0x41')][_0xc39f('0x25')]){_0x14d1b1[_0xc39f('0x40')]=_['merge'](_0x14d1b1[_0xc39f('0x40')],{'$or':_[_0xc39f('0x27')](_0x14d1b1[_0xc39f('0x56')],function(_0x8025e8){var _0x32696e={};_0x32696e[_0x8025e8]={'$like':'%'+_0x2f5a41[_0xc39f('0x41')][_0xc39f('0x25')]+'%'};return _0x32696e;})});}_0x14d1b1=_['merge']({},_0x14d1b1,_0x2f5a41[_0xc39f('0x55')]);return _0x1f8c57['getVoiceQueuesRt'](_0x14d1b1);}})[_0xc39f('0x2e')](function(_0x471cad){if(_0x471cad){_0x1e09ef=_0x471cad[_0xc39f('0x4b')];if(!_0x2f5a41[_0xc39f('0x41')][_0xc39f('0xc1')](_0xc39f('0xd3'))){_0x14d1b1[_0xc39f('0x16')]=qs[_0xc39f('0x16')](_0x2f5a41[_0xc39f('0x41')][_0xc39f('0x16')]);_0x14d1b1[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x2f5a41[_0xc39f('0x41')][_0xc39f('0x15')]);}return _0x1f8c57[_0xc39f('0xd4')](_0x14d1b1);}})['then'](function(_0x136af6){if(_0x136af6){return _0x136af6?{'count':_0x1e09ef,'rows':_0x136af6}:null;}})[_0xc39f('0x2e')](respondWithResult(_0x21a283,null))['catch'](handleError(_0x21a283,null));};exports[_0xc39f('0xd5')]=function(_0x46c56b,_0xab1fcd){var _0x561716={};var _0x3eb10b={};var _0x2dce24;var _0x5ada13;return db['User'][_0xc39f('0xbf')]({'where':{'id':_0x46c56b['params']['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0xab1fcd,null))['then'](function(_0x4eca06){if(_0x4eca06){_0x2dce24=_0x4eca06;_0x3eb10b['model']=_['keys'](db[_0xc39f('0xd6')]['rawAttributes']);_0x3eb10b[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x46c56b[_0xc39f('0x41')]);_0x3eb10b[_0xc39f('0xcc')]=_['intersection'](_0x3eb10b[_0xc39f('0xc9')],_0x3eb10b['query']);_0x561716[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x3eb10b[_0xc39f('0xc9')],qs['fields'](_0x46c56b[_0xc39f('0x41')][_0xc39f('0xce')]));_0x561716[_0xc39f('0x56')]=_0x561716[_0xc39f('0x56')]['length']?_0x561716['attributes']:_0x3eb10b[_0xc39f('0xc9')];_0x561716[_0xc39f('0xcf')]=qs[_0xc39f('0xd0')](_0x46c56b['query']['sort']);_0x561716[_0xc39f('0x40')]=qs['filters'](_[_0xc39f('0xd1')](_0x46c56b[_0xc39f('0x41')],_0x3eb10b[_0xc39f('0xcc')]));if(_0x46c56b[_0xc39f('0x41')][_0xc39f('0x25')]){_0x561716[_0xc39f('0x40')]=_[_0xc39f('0x54')](_0x561716[_0xc39f('0x40')],{'$or':_[_0xc39f('0x27')](_0x561716[_0xc39f('0x56')],function(_0x23e2d1){var _0x51b712={};_0x51b712[_0x23e2d1]={'$like':'%'+_0x46c56b[_0xc39f('0x41')][_0xc39f('0x25')]+'%'};return _0x51b712;})});}_0x561716=_[_0xc39f('0x54')]({},_0x561716,_0x46c56b[_0xc39f('0x55')]);return _0x2dce24['getGroups'](_0x561716);}})[_0xc39f('0x2e')](function(_0x31d38b){if(_0x31d38b){_0x5ada13=_0x31d38b[_0xc39f('0x4b')];if(!_0x46c56b['query'][_0xc39f('0xc1')](_0xc39f('0xd3'))){_0x561716[_0xc39f('0x16')]=qs['limit'](_0x46c56b[_0xc39f('0x41')][_0xc39f('0x16')]);_0x561716[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x46c56b[_0xc39f('0x41')][_0xc39f('0x15')]);}return _0x2dce24['getGroups'](_0x561716);}})['then'](function(_0x34c1f8){if(_0x34c1f8){return _0x34c1f8?{'count':_0x5ada13,'rows':_0x34c1f8}:null;}})[_0xc39f('0x2e')](respondWithResult(_0xab1fcd,null))['catch'](handleError(_0xab1fcd,null));};exports['getRecordings']=function(_0x566677,_0x9016dc){var _0x294a0f={'raw':!![],'where':{}};var _0x11e045={};var _0x49709c={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x566677[_0xc39f('0x86')]['id']}})['then'](handleEntityNotFound(_0x9016dc,null))['then'](function(_0x2b535c){if(_0x2b535c){_0x11e045['model']=_['keys'](db[_0xc39f('0xd7')]['rawAttributes']);_0x11e045[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x566677['query']);_0x11e045[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0x11e045[_0xc39f('0xc9')],_0x11e045['query']);_0x294a0f[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x11e045[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x566677[_0xc39f('0x41')][_0xc39f('0xce')]));_0x294a0f[_0xc39f('0x56')]=_0x294a0f[_0xc39f('0x56')][_0xc39f('0x4b')]?_0x294a0f[_0xc39f('0x56')]:_0x11e045[_0xc39f('0xc9')];if(!_0x566677[_0xc39f('0x41')][_0xc39f('0xc1')](_0xc39f('0xd3'))){_0x294a0f[_0xc39f('0x16')]=qs['limit'](_0x566677[_0xc39f('0x41')][_0xc39f('0x16')]);_0x294a0f[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x566677[_0xc39f('0x41')][_0xc39f('0x15')]);}_0x294a0f[_0xc39f('0xcf')]=qs['sort'](_0x566677[_0xc39f('0x41')]['sort']);_0x294a0f[_0xc39f('0x40')]=qs['filters'](_[_0xc39f('0xd1')](_0x566677['query'],_0x11e045[_0xc39f('0xcc')]));_0x294a0f['where']['UserId']=_0x2b535c['id'];if(_0x566677[_0xc39f('0x41')][_0xc39f('0x25')]){_0x294a0f[_0xc39f('0x40')]=_['merge'](_0x294a0f[_0xc39f('0x40')],{'$or':_[_0xc39f('0x27')](_0x294a0f[_0xc39f('0x56')],function(_0x2bfc27){var _0x18b509={};_0x18b509[_0x2bfc27]={'$like':'%'+_0x566677['query'][_0xc39f('0x25')]+'%'};return _0x18b509;})});}_0x294a0f=_['merge']({},_0x294a0f,_0x566677[_0xc39f('0x55')]);return db[_0xc39f('0xd7')][_0xc39f('0x18')]({'where':_0x294a0f[_0xc39f('0x40')]})[_0xc39f('0x2e')](function(_0x55276e){_0x49709c[_0xc39f('0x18')]=_0x55276e;if(_0x566677[_0xc39f('0x41')][_0xc39f('0x42')]){_0x294a0f[_0xc39f('0x43')]=[{'all':!![]}];}return db[_0xc39f('0xd7')]['findAll'](_0x294a0f);})[_0xc39f('0x2e')](function(_0x221b16){_0x49709c[_0xc39f('0x48')]=_0x221b16;return _0x49709c;});}})['then'](respondWithFilteredResult(_0x9016dc,_0x294a0f))[_0xc39f('0x52')](handleError(_0x9016dc,null));};exports['getScreenRecordings']=function(_0x2814aa,_0x15689f){var _0x3fa5f7={'raw':!![],'where':{}};var _0xe0f3e0={};var _0xfcf0d6={'count':0x0,'rows':[]};return db[_0xc39f('0x33')][_0xc39f('0xbf')]({'where':{'id':_0x2814aa[_0xc39f('0x86')]['id']}})['then'](handleEntityNotFound(_0x15689f,null))['then'](function(_0x297781){if(_0x297781){_0xe0f3e0['model']=_[_0xc39f('0xcb')](db['ScreenRecording'][_0xc39f('0x34')]);_0xe0f3e0[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x2814aa[_0xc39f('0x41')]);_0xe0f3e0[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0xe0f3e0[_0xc39f('0xc9')],_0xe0f3e0[_0xc39f('0x41')]);_0x3fa5f7[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0xe0f3e0[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x2814aa[_0xc39f('0x41')]['fields']));_0x3fa5f7[_0xc39f('0x56')]=_0x3fa5f7[_0xc39f('0x56')][_0xc39f('0x4b')]?_0x3fa5f7[_0xc39f('0x56')]:_0xe0f3e0['model'];if(!_0x2814aa[_0xc39f('0x41')]['hasOwnProperty'](_0xc39f('0xd3'))){_0x3fa5f7[_0xc39f('0x16')]=qs[_0xc39f('0x16')](_0x2814aa['query'][_0xc39f('0x16')]);_0x3fa5f7[_0xc39f('0x15')]=qs['offset'](_0x2814aa[_0xc39f('0x41')][_0xc39f('0x15')]);}_0x3fa5f7[_0xc39f('0xcf')]=qs[_0xc39f('0xd0')](_0x2814aa[_0xc39f('0x41')][_0xc39f('0xd0')]);_0x3fa5f7[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_['pick'](_0x2814aa[_0xc39f('0x41')],_0xe0f3e0[_0xc39f('0xcc')]));_0x3fa5f7[_0xc39f('0x40')][_0xc39f('0xd8')]=_0x297781['id'];if(_0x2814aa[_0xc39f('0x41')][_0xc39f('0x25')]){_0x3fa5f7['where']=_['merge'](_0x3fa5f7[_0xc39f('0x40')],{'$or':_[_0xc39f('0x27')](_0x3fa5f7[_0xc39f('0x56')],function(_0x571560){var _0x45efdd={};_0x45efdd[_0x571560]={'$like':'%'+_0x2814aa[_0xc39f('0x41')]['filter']+'%'};return _0x45efdd;})});}_0x3fa5f7=_[_0xc39f('0x54')]({},_0x3fa5f7,_0x2814aa['options']);return db[_0xc39f('0xd9')][_0xc39f('0x18')]({'where':_0x3fa5f7[_0xc39f('0x40')]})[_0xc39f('0x2e')](function(_0x555d64){_0xfcf0d6['count']=_0x555d64;if(_0x2814aa[_0xc39f('0x41')][_0xc39f('0x42')]){_0x3fa5f7['include']=[{'all':!![]}];}return db[_0xc39f('0xd9')][_0xc39f('0x47')](_0x3fa5f7);})[_0xc39f('0x2e')](function(_0x1ac735){_0xfcf0d6[_0xc39f('0x48')]=_0x1ac735;return _0xfcf0d6;});}})['then'](respondWithFilteredResult(_0x15689f,_0x3fa5f7))[_0xc39f('0x52')](handleError(_0x15689f,null));};exports[_0xc39f('0xda')]=function(_0x2735f7,_0x29f9fd){var _0x32f561={};var _0x236dc2={};var _0x43c4ef;var _0xb807af;return db[_0xc39f('0x33')]['findOne']({'where':{'id':_0x2735f7[_0xc39f('0x86')]['id']}})['then'](handleEntityNotFound(_0x29f9fd,null))[_0xc39f('0x2e')](function(_0x43f4b1){if(_0x43f4b1){_0x43c4ef=_0x43f4b1;_0x236dc2[_0xc39f('0xc9')]=_[_0xc39f('0xcb')](db[_0xc39f('0xdb')]['rawAttributes']);_0x236dc2[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x2735f7[_0xc39f('0x41')]);_0x236dc2['filters']=_[_0xc39f('0xcd')](_0x236dc2['model'],_0x236dc2['query']);_0x32f561['attributes']=_[_0xc39f('0xcd')](_0x236dc2[_0xc39f('0xc9')],qs['fields'](_0x2735f7[_0xc39f('0x41')][_0xc39f('0xce')]));_0x32f561['attributes']=_0x32f561[_0xc39f('0x56')]['length']?_0x32f561['attributes']:_0x236dc2[_0xc39f('0xc9')];_0x32f561[_0xc39f('0xcf')]=qs[_0xc39f('0xd0')](_0x2735f7[_0xc39f('0x41')]['sort']);_0x32f561[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_[_0xc39f('0xd1')](_0x2735f7[_0xc39f('0x41')],_0x236dc2[_0xc39f('0xcc')]));if(_0x2735f7[_0xc39f('0x41')][_0xc39f('0x25')]){_0x32f561[_0xc39f('0x40')]=_['merge'](_0x32f561['where'],{'$or':_[_0xc39f('0x27')](_0x32f561['attributes'],function(_0x6812b5){var _0xcab72b={};_0xcab72b[_0x6812b5]={'$like':'%'+_0x2735f7[_0xc39f('0x41')]['filter']+'%'};return _0xcab72b;})});}_0x32f561=_['merge']({},_0x32f561,_0x2735f7['options']);return _0x43c4ef['getChatInteractions'](_0x32f561);}})['then'](function(_0x525075){if(_0x525075){_0xb807af=_0x525075[_0xc39f('0x4b')];if(!_0x2735f7[_0xc39f('0x41')][_0xc39f('0xc1')](_0xc39f('0xd3'))){_0x32f561[_0xc39f('0x16')]=qs['limit'](_0x2735f7['query'][_0xc39f('0x16')]);_0x32f561[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x2735f7[_0xc39f('0x41')][_0xc39f('0x15')]);}return _0x43c4ef['getChatInteractions'](_0x32f561);}})[_0xc39f('0x2e')](function(_0x1efa6e){if(_0x1efa6e){return _0x1efa6e?{'count':_0xb807af,'rows':_0x1efa6e}:null;}})[_0xc39f('0x2e')](respondWithResult(_0x29f9fd,null))[_0xc39f('0x52')](handleError(_0x29f9fd,null));};exports[_0xc39f('0xdc')]=function(_0x2076d4,_0x30ca20){var _0x3caa6e={};var _0x6e3462={};var _0x4fd94b;var _0x298272;return db[_0xc39f('0x33')]['findOne']({'where':{'id':_0x2076d4[_0xc39f('0x86')]['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0x30ca20,null))[_0xc39f('0x2e')](function(_0x214732){if(_0x214732){_0x4fd94b=_0x214732;_0x6e3462[_0xc39f('0xc9')]=_[_0xc39f('0xcb')](db[_0xc39f('0xdd')][_0xc39f('0x34')]);_0x6e3462['query']=_['keys'](_0x2076d4[_0xc39f('0x41')]);_0x6e3462['filters']=_[_0xc39f('0xcd')](_0x6e3462[_0xc39f('0xc9')],_0x6e3462['query']);_0x3caa6e['attributes']=_[_0xc39f('0xcd')](_0x6e3462[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x2076d4['query']['fields']));_0x3caa6e['attributes']=_0x3caa6e['attributes']['length']?_0x3caa6e[_0xc39f('0x56')]:_0x6e3462[_0xc39f('0xc9')];_0x3caa6e[_0xc39f('0xcf')]=qs['sort'](_0x2076d4[_0xc39f('0x41')][_0xc39f('0xd0')]);_0x3caa6e[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_[_0xc39f('0xd1')](_0x2076d4[_0xc39f('0x41')],_0x6e3462[_0xc39f('0xcc')]));if(_0x2076d4[_0xc39f('0x41')][_0xc39f('0x25')]){_0x3caa6e['where']=_[_0xc39f('0x54')](_0x3caa6e['where'],{'$or':_[_0xc39f('0x27')](_0x3caa6e[_0xc39f('0x56')],function(_0x8b7463){var _0x5dc675={};_0x5dc675[_0x8b7463]={'$like':'%'+_0x2076d4[_0xc39f('0x41')][_0xc39f('0x25')]+'%'};return _0x5dc675;})});}_0x3caa6e=_['merge']({},_0x3caa6e,_0x2076d4['options']);return _0x4fd94b[_0xc39f('0xdc')](_0x3caa6e);}})[_0xc39f('0x2e')](function(_0x4ad1d0){if(_0x4ad1d0){_0x298272=_0x4ad1d0[_0xc39f('0x4b')];if(!_0x2076d4['query']['hasOwnProperty'](_0xc39f('0xd3'))){_0x3caa6e[_0xc39f('0x16')]=qs['limit'](_0x2076d4['query'][_0xc39f('0x16')]);_0x3caa6e[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x2076d4[_0xc39f('0x41')][_0xc39f('0x15')]);}return _0x4fd94b[_0xc39f('0xdc')](_0x3caa6e);}})[_0xc39f('0x2e')](function(_0x591d0a){if(_0x591d0a){return _0x591d0a?{'count':_0x298272,'rows':_0x591d0a}:null;}})['then'](respondWithResult(_0x30ca20,null))[_0xc39f('0x52')](handleError(_0x30ca20,null));};exports[_0xc39f('0xde')]=function(_0x4bc2f1,_0x216f8b){var _0x549262={'raw':!![],'where':{}};var _0x5a6f12={};var _0x1816cd={'count':0x0,'rows':[]};return db[_0xc39f('0x33')]['findOne']({'where':{'id':_0x4bc2f1[_0xc39f('0x86')]['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0x216f8b,null))[_0xc39f('0x2e')](function(_0x5e2df5){if(_0x5e2df5){_0x5a6f12[_0xc39f('0xc9')]=_[_0xc39f('0xcb')](db[_0xc39f('0xdf')][_0xc39f('0x34')]);_0x5a6f12[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x4bc2f1['query']);_0x5a6f12[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0x5a6f12[_0xc39f('0xc9')],_0x5a6f12[_0xc39f('0x41')]);_0x549262['attributes']=_['intersection'](_0x5a6f12[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x4bc2f1[_0xc39f('0x41')][_0xc39f('0xce')]));_0x549262[_0xc39f('0x56')]=_0x549262[_0xc39f('0x56')][_0xc39f('0x4b')]?_0x549262[_0xc39f('0x56')]:_0x5a6f12[_0xc39f('0xc9')];if(!_0x4bc2f1[_0xc39f('0x41')][_0xc39f('0xc1')](_0xc39f('0xd3'))){_0x549262['limit']=qs[_0xc39f('0x16')](_0x4bc2f1[_0xc39f('0x41')][_0xc39f('0x16')]);_0x549262[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x4bc2f1['query'][_0xc39f('0x15')]);}_0x549262[_0xc39f('0xcf')]=qs['sort'](_0x4bc2f1['query']['sort']);_0x549262[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_[_0xc39f('0xd1')](_0x4bc2f1[_0xc39f('0x41')],_0x5a6f12['filters']));_0x549262[_0xc39f('0x40')][_0xc39f('0xd8')]=_0x5e2df5['id'];if(_0x4bc2f1[_0xc39f('0x41')][_0xc39f('0x25')]){_0x549262[_0xc39f('0x40')]=_['merge'](_0x549262['where'],{'$or':_[_0xc39f('0x27')](_0x549262['attributes'],function(_0x3c874a){var _0x400471={};_0x400471[_0x3c874a]={'$like':'%'+_0x4bc2f1[_0xc39f('0x41')][_0xc39f('0x25')]+'%'};return _0x400471;})});}_0x549262=_['merge']({},_0x549262,_0x4bc2f1[_0xc39f('0x55')]);return db['MailInteraction']['count']({'where':_0x549262[_0xc39f('0x40')]})[_0xc39f('0x2e')](function(_0x22521e){_0x1816cd['count']=_0x22521e;if(_0x4bc2f1[_0xc39f('0x41')][_0xc39f('0x42')]){_0x549262[_0xc39f('0x43')]=[{'all':!![]}];}return db[_0xc39f('0xdf')][_0xc39f('0x47')](_0x549262);})[_0xc39f('0x2e')](function(_0x4feb35){_0x1816cd[_0xc39f('0x48')]=_0x4feb35;return _0x1816cd;});}})[_0xc39f('0x2e')](respondWithFilteredResult(_0x216f8b,_0x549262))[_0xc39f('0x52')](handleError(_0x216f8b,null));};exports['getSmsInteractions']=function(_0x54ca3c,_0x3c4697){var _0x1e3a1d={};var _0x3c4d9b={};var _0x3780f3;var _0xe5405f;return db[_0xc39f('0x33')]['findOne']({'where':{'id':_0x54ca3c[_0xc39f('0x86')]['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0x3c4697,null))[_0xc39f('0x2e')](function(_0x1b3bce){if(_0x1b3bce){_0x3780f3=_0x1b3bce;_0x3c4d9b[_0xc39f('0xc9')]=_[_0xc39f('0xcb')](db[_0xc39f('0xe0')][_0xc39f('0x34')]);_0x3c4d9b[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x54ca3c['query']);_0x3c4d9b[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0x3c4d9b[_0xc39f('0xc9')],_0x3c4d9b['query']);_0x1e3a1d[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x3c4d9b[_0xc39f('0xc9')],qs['fields'](_0x54ca3c[_0xc39f('0x41')]['fields']));_0x1e3a1d[_0xc39f('0x56')]=_0x1e3a1d[_0xc39f('0x56')][_0xc39f('0x4b')]?_0x1e3a1d[_0xc39f('0x56')]:_0x3c4d9b['model'];_0x1e3a1d[_0xc39f('0xcf')]=qs['sort'](_0x54ca3c[_0xc39f('0x41')][_0xc39f('0xd0')]);_0x1e3a1d['where']=qs['filters'](_[_0xc39f('0xd1')](_0x54ca3c[_0xc39f('0x41')],_0x3c4d9b[_0xc39f('0xcc')]));if(_0x54ca3c['query'][_0xc39f('0x25')]){_0x1e3a1d['where']=_[_0xc39f('0x54')](_0x1e3a1d[_0xc39f('0x40')],{'$or':_[_0xc39f('0x27')](_0x1e3a1d[_0xc39f('0x56')],function(_0x5ce0de){var _0x299b69={};_0x299b69[_0x5ce0de]={'$like':'%'+_0x54ca3c[_0xc39f('0x41')]['filter']+'%'};return _0x299b69;})});}_0x1e3a1d=_['merge']({},_0x1e3a1d,_0x54ca3c[_0xc39f('0x55')]);return _0x3780f3[_0xc39f('0xe1')](_0x1e3a1d);}})[_0xc39f('0x2e')](function(_0x13c3a6){if(_0x13c3a6){_0xe5405f=_0x13c3a6[_0xc39f('0x4b')];if(!_0x54ca3c[_0xc39f('0x41')][_0xc39f('0xc1')]('nolimit')){_0x1e3a1d[_0xc39f('0x16')]=qs[_0xc39f('0x16')](_0x54ca3c[_0xc39f('0x41')][_0xc39f('0x16')]);_0x1e3a1d[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x54ca3c[_0xc39f('0x41')][_0xc39f('0x15')]);}return _0x3780f3['getSmsInteractions'](_0x1e3a1d);}})[_0xc39f('0x2e')](function(_0x5ba1bb){if(_0x5ba1bb){return _0x5ba1bb?{'count':_0xe5405f,'rows':_0x5ba1bb}:null;}})['then'](respondWithResult(_0x3c4697,null))[_0xc39f('0x52')](handleError(_0x3c4697,null));};exports['getFaxInteractions']=function(_0x4104e6,_0xd671fe){var _0x5d0841={};var _0x582261={};var _0x3a3e3c;var _0xacd005;return db[_0xc39f('0x33')][_0xc39f('0xbf')]({'where':{'id':_0x4104e6[_0xc39f('0x86')]['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0xd671fe,null))[_0xc39f('0x2e')](function(_0x15491a){if(_0x15491a){_0x3a3e3c=_0x15491a;_0x582261['model']=_[_0xc39f('0xcb')](db['FaxInteraction'][_0xc39f('0x34')]);_0x582261[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x4104e6[_0xc39f('0x41')]);_0x582261[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0x582261[_0xc39f('0xc9')],_0x582261['query']);_0x5d0841[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x582261[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x4104e6[_0xc39f('0x41')][_0xc39f('0xce')]));_0x5d0841['attributes']=_0x5d0841[_0xc39f('0x56')][_0xc39f('0x4b')]?_0x5d0841['attributes']:_0x582261[_0xc39f('0xc9')];_0x5d0841[_0xc39f('0xcf')]=qs['sort'](_0x4104e6['query'][_0xc39f('0xd0')]);_0x5d0841[_0xc39f('0x40')]=qs['filters'](_['pick'](_0x4104e6[_0xc39f('0x41')],_0x582261[_0xc39f('0xcc')]));if(_0x4104e6[_0xc39f('0x41')]['filter']){_0x5d0841[_0xc39f('0x40')]=_[_0xc39f('0x54')](_0x5d0841['where'],{'$or':_[_0xc39f('0x27')](_0x5d0841[_0xc39f('0x56')],function(_0x4e91f6){var _0x1fa0ad={};_0x1fa0ad[_0x4e91f6]={'$like':'%'+_0x4104e6[_0xc39f('0x41')]['filter']+'%'};return _0x1fa0ad;})});}_0x5d0841=_[_0xc39f('0x54')]({},_0x5d0841,_0x4104e6[_0xc39f('0x55')]);return _0x3a3e3c[_0xc39f('0xe2')](_0x5d0841);}})[_0xc39f('0x2e')](function(_0x14cf8b){if(_0x14cf8b){_0xacd005=_0x14cf8b[_0xc39f('0x4b')];if(!_0x4104e6[_0xc39f('0x41')][_0xc39f('0xc1')](_0xc39f('0xd3'))){_0x5d0841['limit']=qs[_0xc39f('0x16')](_0x4104e6[_0xc39f('0x41')][_0xc39f('0x16')]);_0x5d0841['offset']=qs['offset'](_0x4104e6[_0xc39f('0x41')][_0xc39f('0x15')]);}return _0x3a3e3c[_0xc39f('0xe2')](_0x5d0841);}})[_0xc39f('0x2e')](function(_0x1e3cab){if(_0x1e3cab){return _0x1e3cab?{'count':_0xacd005,'rows':_0x1e3cab}:null;}})[_0xc39f('0x2e')](respondWithResult(_0xd671fe,null))[_0xc39f('0x52')](handleError(_0xd671fe,null));};exports[_0xc39f('0xe3')]=function(_0x40cc69,_0x3f5ed1){var _0x412fd3={};var _0x5aa809={};var _0x56e1f8;var _0xa25d12;return db[_0xc39f('0x33')][_0xc39f('0xbf')]({'where':{'id':_0x40cc69['params']['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0x3f5ed1,null))[_0xc39f('0x2e')](function(_0x1ab30c){if(_0x1ab30c){_0x56e1f8=_0x1ab30c;_0x5aa809[_0xc39f('0xc9')]=_[_0xc39f('0xcb')](db['WhatsappInteraction'][_0xc39f('0x34')]);_0x5aa809['query']=_[_0xc39f('0xcb')](_0x40cc69['query']);_0x5aa809[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0x5aa809[_0xc39f('0xc9')],_0x5aa809[_0xc39f('0x41')]);_0x412fd3[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x5aa809[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x40cc69['query'][_0xc39f('0xce')]));_0x412fd3[_0xc39f('0x56')]=_0x412fd3[_0xc39f('0x56')]['length']?_0x412fd3[_0xc39f('0x56')]:_0x5aa809[_0xc39f('0xc9')];_0x412fd3[_0xc39f('0xcf')]=qs['sort'](_0x40cc69[_0xc39f('0x41')][_0xc39f('0xd0')]);_0x412fd3[_0xc39f('0x40')]=qs['filters'](_[_0xc39f('0xd1')](_0x40cc69[_0xc39f('0x41')],_0x5aa809['filters']));if(_0x40cc69['query'][_0xc39f('0x25')]){_0x412fd3[_0xc39f('0x40')]=_[_0xc39f('0x54')](_0x412fd3[_0xc39f('0x40')],{'$or':_['map'](_0x412fd3[_0xc39f('0x56')],function(_0xd8cdc6){var _0x38d1eb={};_0x38d1eb[_0xd8cdc6]={'$like':'%'+_0x40cc69['query']['filter']+'%'};return _0x38d1eb;})});}_0x412fd3=_[_0xc39f('0x54')]({},_0x412fd3,_0x40cc69[_0xc39f('0x55')]);return _0x56e1f8[_0xc39f('0xe3')](_0x412fd3);}})[_0xc39f('0x2e')](function(_0x11a4fb){if(_0x11a4fb){_0xa25d12=_0x11a4fb[_0xc39f('0x4b')];if(!_0x40cc69[_0xc39f('0x41')]['hasOwnProperty']('nolimit')){_0x412fd3[_0xc39f('0x16')]=qs['limit'](_0x40cc69[_0xc39f('0x41')][_0xc39f('0x16')]);_0x412fd3['offset']=qs[_0xc39f('0x15')](_0x40cc69['query'][_0xc39f('0x15')]);}return _0x56e1f8['getWhatsappInteractions'](_0x412fd3);}})[_0xc39f('0x2e')](function(_0x5f3512){if(_0x5f3512){return _0x5f3512?{'count':_0xa25d12,'rows':_0x5f3512}:null;}})[_0xc39f('0x2e')](respondWithResult(_0x3f5ed1,null))[_0xc39f('0x52')](handleError(_0x3f5ed1,null));};exports[_0xc39f('0xe4')]=function(_0x5b97e2,_0x4df78e,_0x215c49){var _0x28f2fc;var _0x2e719c;var _0x240c70;var _0x4ba813=!_[_0xc39f('0x62')](_0x5b97e2[_0xc39f('0x86')]['id'])?_0x5b97e2[_0xc39f('0x86')]['id']:!_[_0xc39f('0x62')](_0x5b97e2[_0xc39f('0x22')]['id'])?_0x5b97e2['user']['id']:null;return db[_0xc39f('0x33')][_0xc39f('0x2a')]({'where':{'id':_0x4ba813,'role':{'$or':[_0xc39f('0x20'),_0xc39f('0x22'),_0xc39f('0x1d')]}},'attributes':['id',_0xc39f('0x2b'),_0xc39f('0xe5'),_0xc39f('0xe6'),'role',_0xc39f('0x61'),_0xc39f('0x93')]})['then'](function(_0x12f518){if(_0x12f518){if(_0x12f518['role']===_0xc39f('0x1d')){_0x28f2fc=_0x12f518;if(_0x5b97e2[_0xc39f('0x59')][_0xc39f('0x95')]){_0x240c70=util[_0xc39f('0xa2')](_0xc39f('0xe7'),_0x28f2fc[_0x5b97e2['body'][_0xc39f('0x95')]]);}else if(_0x5b97e2['body'][_0xc39f('0xe8')]){_0x240c70=util['format']('SIP/%s',_0x5b97e2[_0xc39f('0x59')][_0xc39f('0xe8')]);}else{_0x240c70=util[_0xc39f('0xa2')](_0xc39f('0xe9'),_0x28f2fc[_0xc39f('0x2b')]);}socket['to'](util[_0xc39f('0xa2')](_0xc39f('0xea'),_0x28f2fc['name']))[_0xc39f('0x9d')]('user:forcelogout',{'user':{'id':_0x28f2fc['id'],'name':_0x28f2fc[_0xc39f('0x2b')]},'ip':_0x5b97e2[_0xc39f('0xeb')][_0xc39f('0xec')]||_0x5b97e2[_0xc39f('0xed')][_0xc39f('0xee')]||_0x5b97e2['socket'][_0xc39f('0xee')]||_0x5b97e2['connection'][_0xc39f('0xef')][_0xc39f('0xee')]});return db[_0xc39f('0xa3')][_0xc39f('0x2d')]({'where':{'membername':_0x28f2fc[_0xc39f('0x2b')]},'individualHooks':!![]});}}else{throw new db[(_0xc39f('0x88'))][(_0xc39f('0x89'))](_0xc39f('0xf0'));}})['then'](function(){if(_0x28f2fc){return _0x28f2fc['getVoiceQueues']({'raw':!![]});}})[_0xc39f('0x2e')](function(_0xdfd1f7){if(_0x28f2fc){if(_0xdfd1f7){_0x2e719c=_0xdfd1f7;if(_0x2e719c['length']){var _0x1c5565=_0x2e719c[_0xc39f('0x27')](function(_0x20d604){var _0x1716af={'membername':_0x28f2fc[_0xc39f('0x2b')],'UserId':_0x28f2fc['id'],'queue_name':_0x20d604[_0xc39f('0x2b')],'VoiceQueueId':_0x20d604['id'],'interface':_0x240c70,'paused':_0x28f2fc[_0xc39f('0x93')]||![],'penalty':_0x20d604[_0xc39f('0xf1')]||0x0};return db['UserVoiceQueueRt'][_0xc39f('0xa4')](_0x1716af);});return Promise['all'](_0x1c5565);}}}})[_0xc39f('0x2e')](function(){if(_0x28f2fc){return db[_0xc39f('0xf2')][_0xc39f('0x47')]({'where':{'membername':_0x28f2fc['name'],'exitAt':null}});}})[_0xc39f('0x2e')](function(_0x2ff439){if(_0x28f2fc){var _0x10971d=[];_0x2ff439['forEach'](function(_0x248060){_0x10971d[_0xc39f('0x46')](_0x248060[_0xc39f('0x1b')]({'exitAt':moment()[_0xc39f('0xa2')](_0xc39f('0xf3'))}));});return Promise['all'](_0x10971d);}})[_0xc39f('0x2e')](function(){if(_0x28f2fc){var _0x2c115d=[];var _0x3a94af=[];var _0x39e1be=utils[_0xc39f('0xf4')]();var _0x21e248={'membername':_0x28f2fc[_0xc39f('0x2b')],'interface':_0x240c70,'enterAt':moment()['format'](_0xc39f('0xf3')),'role':_0x28f2fc[_0xc39f('0x1c')],'internal':_0x28f2fc[_0xc39f('0x61')]};_0x39e1be['forEach'](function(_0x11ebe6){_0x2c115d[_0xc39f('0x46')](_[_0xc39f('0x54')]({'channel':_0x11ebe6,'type':_0xc39f('0xf5'),'data1':_0x5b97e2[_0xc39f('0x59')][_0xc39f('0xf6')],'data2':_0x240c70},_0x21e248));if(_0x28f2fc['loginInPause']){_0x3a94af['push'](_[_0xc39f('0x54')]({'channel':_0x11ebe6,'type':_0xc39f('0xf7'),'data1':_0xc39f('0xf8')},_0x21e248));}});return db['MemberReport'][_0xc39f('0x7f')](_0x2c115d[_0xc39f('0xbd')](_0x3a94af),{'individualHooks':!![]});}})['then'](function(){if(_0x28f2fc){return _0x28f2fc['update']({'online':!![],'lastLoginAt':moment()[_0xc39f('0xa2')](_0xc39f('0xf3')),'voicePause':_0x28f2fc['loginInPause']||![],'mailPause':_0x28f2fc['loginInPause']||![],'chatPause':_0x28f2fc[_0xc39f('0x93')]||![],'faxPause':_0x28f2fc[_0xc39f('0x93')]||![],'smsPause':_0x28f2fc[_0xc39f('0x93')]||![],'openchannelPause':_0x28f2fc[_0xc39f('0x93')]||![],'whatsappPause':_0x28f2fc['loginInPause']||![],'pauseType':_0x28f2fc[_0xc39f('0x93')]?_0xc39f('0xf8'):null,'interface':_0x240c70,'lastPauseAt':moment()[_0xc39f('0xa2')](_0xc39f('0xf3'))});}})[_0xc39f('0x2e')](function(_0x5cfd22){if(_0x5b97e2['isMiddleware']){return _0x215c49();}else{return Promise['resolve'](_0x5cfd22)[_0xc39f('0x2e')](respondWithResult(_0x4df78e,null));}})[_0xc39f('0x52')](handleError(_0x4df78e,null));};exports[_0xc39f('0xf9')]=function(_0x3e3426,_0x4290f2){var _0x35d081;return db['User'][_0xc39f('0x2a')]({'where':{'id':_0x3e3426[_0xc39f('0x86')]['id'],'role':_0xc39f('0x1d')},'attributes':['id',_0xc39f('0x2b'),_0xc39f('0x1c')]})[_0xc39f('0x2e')](handleEntityNotFound(_0x4290f2,null))[_0xc39f('0x2e')](function(_0xfa0b8c){if(_0xfa0b8c){_0x35d081=_0xfa0b8c;return db['UserVoiceQueueRt'][_0xc39f('0x2d')]({'where':{'membername':_0x35d081[_0xc39f('0x2b')]},'individualHooks':!![]});}})['then'](function(){return db[_0xc39f('0xf2')][_0xc39f('0x47')]({'where':{'membername':_0x35d081['name'],'exitAt':null}});})['then'](function(_0x13ede4){var _0x138fb2=[];_0x13ede4[_0xc39f('0xfa')](function(_0x23e97b){_0x138fb2[_0xc39f('0x46')](_0x23e97b[_0xc39f('0x1b')]({'exitAt':moment()[_0xc39f('0xa2')](_0xc39f('0xf3'))}));});return Promise[_0xc39f('0x51')](_0x138fb2);})[_0xc39f('0x2e')](function(){return _0x35d081[_0xc39f('0x1b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xc39f('0x2e')](respondWithResult(_0x4290f2,null))['catch'](handleError(_0x4290f2,null));};exports[_0xc39f('0xfb')]=function(_0x485691,_0x465812){var _0x3ad5a9;return db['UserVoiceQueueRt'][_0xc39f('0x1b')]({'paused':0x1},{'where':{'UserId':_0x485691[_0xc39f('0x86')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xc39f('0x33')][_0xc39f('0x2a')]({'where':{'id':_0x485691['params']['id'],'role':_0xc39f('0x1d')},'attributes':['id',_0xc39f('0x2b'),_0xc39f('0x1c'),_0xc39f('0x61'),_0xc39f('0x95'),'online']});})['then'](handleEntityNotFound(_0x465812,null))[_0xc39f('0x2e')](function(_0x16a32f){if(_0x16a32f){_0x3ad5a9=_0x16a32f;return db[_0xc39f('0xf2')][_0xc39f('0x47')]({'where':{'membername':_0x3ad5a9[_0xc39f('0x2b')],'type':_0xc39f('0xf7'),'exitAt':null}});}})[_0xc39f('0x2e')](function(_0x3dc999){if(_0x3dc999[_0xc39f('0x4b')]){var _0x11d4ec=moment()[_0xc39f('0xa2')](_0xc39f('0xf3'));for(var _0x4a5d5d=0x0,_0x1c6ded=_0x3dc999[_0xc39f('0x4b')];_0x4a5d5d<_0x1c6ded;_0x4a5d5d++){_0x3dc999[_0x4a5d5d]['updateAttributes']({'exitAt':_0x11d4ec});}}})['then'](function(){var _0x418ed0=[];var _0xeb8b66=utils[_0xc39f('0xf4')]();_0xeb8b66['forEach'](function(_0x52268b){_0x418ed0['push']({'channel':_0x52268b,'membername':_0x3ad5a9[_0xc39f('0x2b')],'interface':_[_0xc39f('0x62')](_0x3ad5a9[_0xc39f('0x95')])?util['format']('SIP/%s',_0x3ad5a9[_0xc39f('0x2b')]):_0x3ad5a9[_0xc39f('0x95')],'type':'PAUSE','enterAt':moment()[_0xc39f('0xa2')](_0xc39f('0xf3')),'data1':_0x485691[_0xc39f('0x59')][_0xc39f('0x36')]||_0xc39f('0xfc'),'role':_0x3ad5a9[_0xc39f('0x1c')],'internal':_0x3ad5a9[_0xc39f('0x61')]});});return db[_0xc39f('0xf2')]['bulkCreate'](_0x418ed0,{'individualHooks':!![]});})[_0xc39f('0x2e')](function(){return _0x3ad5a9[_0xc39f('0x1b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x485691['body'][_0xc39f('0x36')]||_0xc39f('0xfc'),'lastPauseAt':moment()[_0xc39f('0xa2')](_0xc39f('0xf3'))});})[_0xc39f('0x2e')](respondWithResult(_0x465812,null))['catch'](handleError(_0x465812,null));};exports[_0xc39f('0xfd')]=function(_0x528dd7,_0x3dad9c){if(_0x528dd7[_0xc39f('0x59')][_0xc39f('0x92')]&&!utils[_0xc39f('0x96')](_0x528dd7['body'][_0xc39f('0x92')])){throw new APIBadRequestError(util[_0xc39f('0xa2')](_0xc39f('0xfe'),_0x528dd7[_0xc39f('0x59')][_0xc39f('0x92')]));}return db[_0xc39f('0x33')][_0xc39f('0x2a')]({'where':{'id':_0x528dd7[_0xc39f('0x86')]['id']},'attributes':['id',_0xc39f('0x2b'),_0xc39f('0x1c'),'internal','interface',_0xc39f('0xa1'),'voicePause',_0xc39f('0xff'),'chatPause',_0xc39f('0x100'),_0xc39f('0x101'),'smsPause','whatsappPause','pauseType',_0xc39f('0x102')]})[_0xc39f('0x2e')](function(_0x4b7c3b){if(!_0x4b7c3b){throw new APINotFoundError(util['format'](_0xc39f('0xc0'),_0x528dd7['params']['id']));}return _0x4b7c3b[_0xc39f('0xfd')](_0x528dd7[_0xc39f('0x59')]['channel']);})[_0xc39f('0x2e')](respondWithResult(_0x3dad9c,null))[_0xc39f('0x52')](APIHandleError(_0x3dad9c));};exports[_0xc39f('0x103')]=function(_0x5a7277,_0x14c4ea){var _0x3a12ce={};var _0x3ca3d8={};var _0x4d7531;var _0x168b7d;return db[_0xc39f('0x33')][_0xc39f('0xbf')]({'where':{'id':_0x5a7277[_0xc39f('0x86')]['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0x14c4ea,null))[_0xc39f('0x2e')](function(_0x506a3b){if(_0x506a3b){_0x4d7531=_0x506a3b;_0x3ca3d8['model']=_[_0xc39f('0xcb')](db['Team'][_0xc39f('0x34')]);_0x3ca3d8[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x5a7277[_0xc39f('0x41')]);_0x3ca3d8[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0x3ca3d8[_0xc39f('0xc9')],_0x3ca3d8[_0xc39f('0x41')]);_0x3a12ce[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x3ca3d8['model'],qs[_0xc39f('0xce')](_0x5a7277['query']['fields']));_0x3a12ce[_0xc39f('0x56')]=_0x3a12ce['attributes']['length']?_0x3a12ce[_0xc39f('0x56')]:_0x3ca3d8[_0xc39f('0xc9')];_0x3a12ce[_0xc39f('0xcf')]=qs[_0xc39f('0xd0')](_0x5a7277[_0xc39f('0x41')][_0xc39f('0xd0')]);_0x3a12ce[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_[_0xc39f('0xd1')](_0x5a7277[_0xc39f('0x41')],_0x3ca3d8[_0xc39f('0xcc')]));if(_0x5a7277[_0xc39f('0x41')][_0xc39f('0x25')]){_0x3a12ce[_0xc39f('0x40')]=_[_0xc39f('0x54')](_0x3a12ce[_0xc39f('0x40')],{'$or':_[_0xc39f('0x27')](_0x3a12ce['attributes'],function(_0x426abf){var _0x48c342={};_0x48c342[_0x426abf]={'$like':'%'+_0x5a7277['query'][_0xc39f('0x25')]+'%'};return _0x48c342;})});}_0x3a12ce=_[_0xc39f('0x54')]({},_0x3a12ce,_0x5a7277[_0xc39f('0x55')]);return _0x4d7531['getTeams'](_0x3a12ce);}})['then'](function(_0x4866b2){if(_0x4866b2){_0x168b7d=_0x4866b2[_0xc39f('0x4b')];if(!_0x5a7277[_0xc39f('0x41')][_0xc39f('0xc1')](_0xc39f('0xd3'))){_0x3a12ce[_0xc39f('0x16')]=qs[_0xc39f('0x16')](_0x5a7277['query'][_0xc39f('0x16')]);_0x3a12ce[_0xc39f('0x15')]=qs[_0xc39f('0x15')](_0x5a7277[_0xc39f('0x41')]['offset']);}return _0x4d7531['getTeams'](_0x3a12ce);}})[_0xc39f('0x2e')](function(_0x118173){if(_0x118173){return _0x118173?{'count':_0x168b7d,'rows':_0x118173}:null;}})[_0xc39f('0x2e')](respondWithResult(_0x14c4ea,null))[_0xc39f('0x52')](handleError(_0x14c4ea,null));};exports[_0xc39f('0x104')]=function(_0x1c11e8,_0x3eb0e7){var _0x1f470=_0x1c11e8['params']['id'];var _0x1ebd67=_0x1c11e8[_0xc39f('0x59')]?_0x1c11e8[_0xc39f('0x59')]['ids']:null;var _0x4823b8=[];return Promise[_0xc39f('0x105')]()['then'](function(){if(!_0x1ebd67)throw new APIBadRequestError(_0xc39f('0x106'));})[_0xc39f('0x2e')](function(){return db[_0xc39f('0x33')]['findOne']({'where':{'id':_0x1f470}});})[_0xc39f('0x2e')](function(_0xd1ab7b){if(!_0xd1ab7b)throw new APINotFoundError(util[_0xc39f('0xa2')](_0xc39f('0xc0'),_0x1c11e8[_0xc39f('0x86')]['id']));return db[_0xc39f('0x64')][_0xc39f('0x107')](function(_0x4a30a0){return _0xd1ab7b[_0xc39f('0x104')](_0x1ebd67,{'transaction':_0x4a30a0})[_0xc39f('0x2e')](function(){return db[_0xc39f('0x108')][_0xc39f('0x47')]({'where':{'id':{'$in':_0x1ebd67}}});})[_0xc39f('0x2e')](function(_0x1e5e47){var _0x142bc9=_[_0xc39f('0x27')](_0x1e5e47,function(_0x23d3e9){return _0x23d3e9['getAssociatedQueues']();});return Promise[_0xc39f('0x51')](_0x142bc9);})[_0xc39f('0x2e')](function(_0x4677ce){_0x4823b8=_['flattenDeep'](_0x4677ce);var _0x24661f=_['map'](_0x4823b8,function(_0x4a6a94){return _0x4a6a94[_0xc39f('0x109')](_0xd1ab7b['id'],{'transaction':_0x4a30a0});});return Promise[_0xc39f('0x51')](_0x24661f);})[_0xc39f('0x2e')](function(){if(!_0xd1ab7b[_0xc39f('0xa1')])return;var _0x142783=_[_0xc39f('0x25')](_0x4823b8,function(_0x5e22e3){return _0x5e22e3[_0xc39f('0x10a')](_0xc39f('0x92'))==='Voice';});var _0x5bf6ef=_[_0xc39f('0x27')](_0x142783,function(_0x8add26){return db[_0xc39f('0xa3')][_0xc39f('0xa4')]({'membername':_0xd1ab7b['name'],'UserId':_0xd1ab7b['id'],'queue_name':_0x8add26[_0xc39f('0x2b')],'VoiceQueueId':_0x8add26['id'],'interface':_[_0xc39f('0x62')](_0xd1ab7b[_0xc39f('0x95')])?util[_0xc39f('0xa2')](_0xc39f('0xe9'),_0xd1ab7b[_0xc39f('0x2b')]):_0xd1ab7b[_0xc39f('0x95')],'paused':_0xd1ab7b[_0xc39f('0x94')]||![],'penalty':_0xd1ab7b['penalty']},{'transaction':_0x4a30a0});});return Promise[_0xc39f('0x51')](_0x5bf6ef);})[_0xc39f('0x2e')](function(){return db[_0xc39f('0x10b')]['findAll']({'where':{'teamId':{'$in':_0x1ebd67}}});})[_0xc39f('0x2e')](function(_0x12c8a6){var _0x599316=_[_0xc39f('0x27')](_0x12c8a6,function(_0x535a94){return db[_0xc39f('0x10c')][_0xc39f('0x77')]({'UserId':_0xd1ab7b['id'],'VoicePrefixId':_0x535a94[_0xc39f('0x10d')]},{'transaction':_0x4a30a0});});return Promise['all'](_0x599316);});});})[_0xc39f('0x2e')](function(){for(var _0x184f0e=0x0;_0x184f0e<_0x4823b8[_0xc39f('0x4b')];_0x184f0e++){var _0x48f355=_0x4823b8[_0x184f0e][_0xc39f('0x10a')](_0xc39f('0x92'));var _0x4da169=_0x48f355+_0xc39f('0xa7');socket[_0xc39f('0x9d')](_0xc39f('0x22')+_0x48f355+_0xc39f('0x9e'),{'UserId':_0x1f470,['queueField']:_0x4823b8[_0x184f0e]['id']});}})[_0xc39f('0x2e')](respondWithStatusCode(_0x3eb0e7,null))[_0xc39f('0x52')](APIHandleError(_0x3eb0e7));};exports[_0xc39f('0x10e')]=function(_0x1236e0,_0x391311){var _0x547a15=_0x1236e0[_0xc39f('0x86')]['id'];var _0x5232de=null;if(_0x1236e0['query']['ids']){_0x5232de=_[_0xc39f('0x10f')](_0x1236e0['query'][_0xc39f('0x5c')])?_0x1236e0['query']['ids']:[_0x1236e0[_0xc39f('0x41')][_0xc39f('0x5c')]];}var _0x2f61ea=[];return Promise[_0xc39f('0x105')]()['then'](function(){if(!_0x5232de)throw new APIBadRequestError(_0xc39f('0x110'));})[_0xc39f('0x2e')](function(){return db[_0xc39f('0x33')][_0xc39f('0xbf')]({'where':{'id':_0x547a15}});})[_0xc39f('0x2e')](function(_0x50d605){if(!_0x50d605)throw new APINotFoundError(util['format'](_0xc39f('0xc0'),_0x1236e0[_0xc39f('0x86')]['id']));return db['sequelize'][_0xc39f('0x107')](function(_0xbab507){return _0x50d605[_0xc39f('0x10e')](_0x5232de,{'transaction':_0xbab507})[_0xc39f('0x2e')](function(){return db[_0xc39f('0x108')][_0xc39f('0x47')]({'where':{'id':{'$in':_0x5232de}}});})[_0xc39f('0x2e')](function(_0x3f4655){var _0x2f846a=_['map'](_0x3f4655,function(_0x1e815f){return _0x1e815f[_0xc39f('0x111')]();});return Promise[_0xc39f('0x51')](_0x2f846a);})[_0xc39f('0x2e')](function(_0x47ff20){_0x2f61ea=_[_0xc39f('0x112')](_0x47ff20);var _0x43e0f0=_[_0xc39f('0x27')](_0x2f61ea,function(_0xcc69f3){return _0xcc69f3[_0xc39f('0x113')](_0x50d605['id'],{'transaction':_0xbab507});});return Promise[_0xc39f('0x51')](_0x43e0f0);})[_0xc39f('0x2e')](function(){if(!_0x50d605[_0xc39f('0xa1')])return;var _0xd103d8=_['filter'](_0x2f61ea,function(_0x52cddb){return _0x52cddb[_0xc39f('0x10a')](_0xc39f('0x92'))===_0xc39f('0x114');});var _0x266cd5=_['map'](_0xd103d8,function(_0xd9d96c){return db[_0xc39f('0xa3')][_0xc39f('0x2d')]({'where':{'VoiceQueueId':_0xd9d96c['id'],'UserId':_0x50d605['id']},'transaction':_0xbab507});});return Promise['all'](_0x266cd5);})[_0xc39f('0x2e')](function(){return db[_0xc39f('0x10b')][_0xc39f('0x47')]({'where':{'teamId':{'$in':_0x5232de}}});})['then'](function(_0x433b19){var _0x4f9822=_[_0xc39f('0x27')](_0x433b19,function(_0x418d0f){return db[_0xc39f('0x10c')][_0xc39f('0x2d')]({'where':{'UserId':_0x50d605['id'],'VoicePrefixId':_0x418d0f['VoicePrefixId']}},{'transaction':_0xbab507});});return Promise[_0xc39f('0x51')](_0x4f9822);});});})[_0xc39f('0x2e')](function(){for(var _0x27e9d1=0x0;_0x27e9d1<_0x2f61ea[_0xc39f('0x4b')];_0x27e9d1++){var _0x240ff7=_0x2f61ea[_0x27e9d1][_0xc39f('0x10a')](_0xc39f('0x92'));var _0xf4e34f=_0x240ff7+_0xc39f('0xa7');socket['emit'](_0xc39f('0x22')+_0x240ff7+_0xc39f('0xa8'),{'UserId':_0x547a15,['queueField']:_0x2f61ea[_0x27e9d1]['id']});}})[_0xc39f('0x2e')](respondWithStatusCode(_0x391311,null))['catch'](APIHandleError(_0x391311));};exports['getLists']=function(_0x4cdbce,_0x223d09){var _0x365a93={};var _0x1ef112={};var _0x505e74;var _0x52a7e5;return db[_0xc39f('0x33')][_0xc39f('0xbf')]({'where':{'id':_0x4cdbce['params']['id']}})[_0xc39f('0x2e')](handleEntityNotFound(_0x223d09,null))[_0xc39f('0x2e')](function(_0x276514){if(_0x276514){_0x505e74=_0x276514;_0x1ef112[_0xc39f('0xc9')]=_[_0xc39f('0xcb')](db[_0xc39f('0xc2')]['rawAttributes']);_0x1ef112[_0xc39f('0x41')]=_[_0xc39f('0xcb')](_0x4cdbce['query']);_0x1ef112[_0xc39f('0xcc')]=_[_0xc39f('0xcd')](_0x1ef112[_0xc39f('0xc9')],_0x1ef112[_0xc39f('0x41')]);_0x365a93[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x1ef112[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x4cdbce[_0xc39f('0x41')][_0xc39f('0xce')]));_0x365a93['attributes']=_0x365a93['attributes'][_0xc39f('0x4b')]?_0x365a93['attributes']:_0x1ef112[_0xc39f('0xc9')];_0x365a93[_0xc39f('0xcf')]=qs[_0xc39f('0xd0')](_0x4cdbce['query']['sort']);_0x365a93[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_[_0xc39f('0xd1')](_0x4cdbce[_0xc39f('0x41')],_0x1ef112['filters']));if(_0x4cdbce[_0xc39f('0x41')][_0xc39f('0x25')]){_0x365a93['where']=_['merge'](_0x365a93[_0xc39f('0x40')],{'$or':_['map'](_0x365a93[_0xc39f('0x56')],function(_0x373141){var _0x31df37={};_0x31df37[_0x373141]={'$like':'%'+_0x4cdbce[_0xc39f('0x41')][_0xc39f('0x25')]+'%'};return _0x31df37;})});}_0x365a93=_[_0xc39f('0x54')]({},_0x365a93,_0x4cdbce[_0xc39f('0x55')]);return _0x505e74['getLists'](_0x365a93);}})['then'](function(_0x23074b){if(_0x23074b){_0x52a7e5=_0x23074b[_0xc39f('0x4b')];if(!_0x4cdbce[_0xc39f('0x41')][_0xc39f('0xc1')]('nolimit')){_0x365a93['limit']=qs[_0xc39f('0x16')](_0x4cdbce[_0xc39f('0x41')]['limit']);_0x365a93['offset']=qs[_0xc39f('0x15')](_0x4cdbce[_0xc39f('0x41')][_0xc39f('0x15')]);}return _0x505e74[_0xc39f('0x115')](_0x365a93);}})[_0xc39f('0x2e')](function(_0x5787ac){if(_0x5787ac){return _0x5787ac?{'count':_0x52a7e5,'rows':_0x5787ac}:null;}})[_0xc39f('0x2e')](respondWithResult(_0x223d09,null))['catch'](handleError(_0x223d09,null));};exports[_0xc39f('0x116')]=function(_0x142ff1,_0x1ad2a2){var _0x9e41b0={};var _0x3123ab={};var _0x4de0c9;return db[_0xc39f('0x33')]['findOne']({'where':{'id':_0x142ff1['params']['id']}})['then'](handleEntityNotFound(_0x1ad2a2,null))[_0xc39f('0x2e')](function(_0x2346f2){if(_0x2346f2){_0x4de0c9=_0x2346f2;_0x3123ab[_0xc39f('0xc9')]=_[_0xc39f('0xcb')](db[_0xc39f('0x33')]['rawAttributes']);_0x3123ab[_0xc39f('0x41')]=_['keys'](_0x142ff1[_0xc39f('0x41')]);_0x3123ab['filters']=_[_0xc39f('0xcd')](_0x3123ab[_0xc39f('0xc9')],_0x3123ab[_0xc39f('0x41')]);_0x9e41b0[_0xc39f('0x56')]=_[_0xc39f('0xcd')](_0x3123ab[_0xc39f('0xc9')],qs[_0xc39f('0xce')](_0x142ff1[_0xc39f('0x41')]['fields']));_0x9e41b0[_0xc39f('0x56')]=_0x9e41b0[_0xc39f('0x56')][_0xc39f('0x4b')]?_0x9e41b0[_0xc39f('0x56')]:_0x3123ab[_0xc39f('0xc9')];_0x9e41b0['order']=qs['sort'](_0x142ff1[_0xc39f('0x41')]['sort']);_0x9e41b0[_0xc39f('0x40')]=qs[_0xc39f('0xcc')](_[_0xc39f('0xd1')](_0x142ff1[_0xc39f('0x41')],_0x3123ab[_0xc39f('0xcc')]));if(_0x142ff1[_0xc39f('0x41')][_0xc39f('0x25')]){_0x9e41b0[_0xc39f('0x40')]=_[_0xc39f('0x54')](_0x9e41b0[_0xc39f('0x40')],{'$or':_[_0xc39f('0x27')](_0x9e41b0[_0xc39f('0x56')],function(_0x4d017f){var _0x29a235={};_0x29a235[_0x4d017f]={'$like':'%'+_0x142ff1[_0xc39f('0x41')][_0xc39f('0x25')]+'%'};return _0x29a235;})});}_0x9e41b0['model']=db[_0xc39f('0x33')];_0x9e41b0['as']='Agents';_0x9e41b0=_['merge']({},_0x9e41b0,_0x142ff1['options']);return _0x4de0c9[_0xc39f('0x117')]({'include':[_0x9e41b0]});}})[_0xc39f('0x2e')](function(_0x501a34){if(_0x501a34){var _0x13a896={},_0x571002=[];for(var _0x1ca701=0x0;_0x1ca701<_0x501a34['length'];_0x1ca701+=0x1){for(var _0x5401b5=0x0,_0x45999d;_0x5401b5<_0x501a34[_0x1ca701]['Agents'][_0xc39f('0x4b')];_0x5401b5+=0x1){_0x45999d=_0x501a34[_0x1ca701][_0xc39f('0x7d')][_0x5401b5][_0xc39f('0x1f')]({'plain':!![]});_0x13a896[_0x45999d['id']]=_0x45999d;}}_0x13a896=_['values'](_0x13a896);for(var _0x15bb25=qs[_0xc39f('0x15')](_0x142ff1[_0xc39f('0x41')]['offset']);_0x15bb25<_0x13a896['length']&&_0x571002['length']=_0x3e46a9[_0x2603('0x4a')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x2603('0x13')](function(){if(_0x4d53ef){return db[_0x2603('0x25')][_0x2603('0x42')]({'where':{'membername':_0x4d53ef[_0x2603('0x1f')]},'individualHooks':!![]});}})['then'](function(){if(_0x4d53ef){return _0x4d53ef[_0x2603('0x4b')]({'raw':!![]});}})['then'](function(_0x2c7005){if(_0x4d53ef){if(_0x2c7005){var _0x418812=[];_0x4fe017=_0x2c7005;if(_0x4fe017['length']){for(var _0x15d269=0x0;_0x15d269<_0x4fe017[_0x2603('0x29')];_0x15d269++){_0x418812[_0x2603('0x2d')](db[_0x2603('0x25')][_0x2603('0x4c')]({'membername':_0x4d53ef[_0x2603('0x1f')],'UserId':_0x4d53ef['id'],'queue_name':_0x4fe017[_0x15d269][_0x2603('0x1f')],'VoiceQueueId':_0x4fe017[_0x15d269]['id'],'interface':_0x184fe5,'paused':_0x4d53ef[_0x2603('0x45')]||![],'penalty':_0x4fe017[_0x15d269][_0x2603('0x4d')]||0x0}));}return BPromise[_0x2603('0x43')](_0x418812);}}}})[_0x2603('0x13')](function(){if(_0x4d53ef){return db['MemberReport'][_0x2603('0xc')]({'where':{'membername':_0x4d53ef['name'],'exitAt':null}});}})[_0x2603('0x13')](function(_0x2c23d3){if(_0x4d53ef){if(_0x2c23d3&&_0x2c23d3[_0x2603('0x29')]){var _0x290ad0=[];_0x2c23d3[_0x2603('0x2c')](function(_0x3a4945){_0x290ad0[_0x2603('0x2d')](_0x3a4945['update']({'exitAt':moment()[_0x2603('0x23')](_0x2603('0x2a'))}));});return BPromise[_0x2603('0x43')](_0x290ad0);}}})['then'](function(){if(_0x4d53ef){var _0x4232fb=[];var _0xcd6fc8=[];var _0x511686=utils['getChannels']();var _0x18d6c9={'membername':_0x4d53ef['name'],'interface':_0x184fe5,'enterAt':moment()[_0x2603('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4d53ef[_0x2603('0x20')],'internal':_0x4d53ef[_0x2603('0x21')]};_0x511686['forEach'](function(_0x5e04b7){_0x4232fb[_0x2603('0x2d')](_[_0x2603('0x4e')]({'channel':_0x5e04b7,'type':_0x2603('0x4f'),'data1':_0x2603('0x50'),'data2':_0x184fe5},_0x18d6c9));if(_0x4d53ef[_0x2603('0x45')]){_0xcd6fc8['push'](_['merge']({'channel':_0x5e04b7,'type':_0x2603('0x28'),'data1':'LOGININPAUSE'},_0x18d6c9));}});return db['MemberReport'][_0x2603('0x51')](_0x4232fb[_0x2603('0x52')](_0xcd6fc8),{'individualHooks':!![]});}})[_0x2603('0x13')](function(){if(_0x4d53ef){return _0x4d53ef[_0x2603('0x26')]({'online':!![],'lastLoginAt':moment()[_0x2603('0x23')](_0x2603('0x2a')),'voicePause':_0x4d53ef[_0x2603('0x45')]||![],'mailPause':_0x4d53ef[_0x2603('0x45')]||![],'chatPause':_0x4d53ef[_0x2603('0x45')]||![],'faxPause':_0x4d53ef[_0x2603('0x45')]||![],'smsPause':_0x4d53ef[_0x2603('0x45')]||![],'openchannelPause':_0x4d53ef[_0x2603('0x45')]||![],'pauseType':_0x4d53ef['loginInPause']?_0x2603('0x53'):null,'lastPauseAt':moment()[_0x2603('0x23')](_0x2603('0x2a')),'interface':_0x184fe5});}})[_0x2603('0x13')](function(_0x41ade8){_0x4a5e2d(_0x41ade8);})[_0x2603('0x15')](function(_0x5772d7){_0xec02e9(_0x20b74c['error'](0x1f4,_0x5772d7[_0x2603('0x17')]));});});}; \ No newline at end of file +var _0x3768=['callysquare','merge','concat','LOGININPAUSE','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','./user.socket','register','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','error','message','ShowUser','find','debug','PauseUser','name','role','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','push','SIP/%s','body','type','uniqueid','bulkCreate','update','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','online','voicePause','mailPause','chatPause','openchannelPause','smsPause','pauseType','lastPauseAt','unpause','LogoutUser','destroy','forEach','catch','LoginUser','mobile','phone','count','agent','../../config/license/util','getLicense','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','all','LOGIN'];(function(_0x2c8671,_0x56778a){var _0x38dc58=function(_0x2e82db){while(--_0x2e82db){_0x2c8671['push'](_0x2c8671['shift']());}};_0x38dc58(++_0x56778a);}(_0x3768,0x1b7));var _0x8376=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0x3768[_0x4e9274];return _0x8b474c;};'use strict';var _=require(_0x8376('0x0'));var util=require(_0x8376('0x1'));var moment=require(_0x8376('0x2'));var BPromise=require(_0x8376('0x3'));var Redis=require('ioredis');var db=require(_0x8376('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8376('0x5'));var config=require(_0x8376('0x6'));config[_0x8376('0x7')]=_[_0x8376('0x8')](config['redis'],{'host':_0x8376('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8376('0x7')]));require(_0x8376('0xa'))[_0x8376('0xb')](socket);exports[_0x8376('0xc')]=function(_0x502252){var _0x33df55=this;return new Promise(function(_0x50e383,_0x5e273f){return db[_0x8376('0xd')][_0x8376('0xe')]({'raw':_0x502252['options']?_0x502252[_0x8376('0xf')][_0x8376('0x10')]===undefined?!![]:![]:!![],'where':_0x502252[_0x8376('0xf')]?_0x502252[_0x8376('0xf')][_0x8376('0x11')]||null:null,'attributes':_0x502252[_0x8376('0xf')]?_0x502252['options'][_0x8376('0x12')]||null:null,'limit':_0x502252[_0x8376('0xf')]?_0x502252[_0x8376('0xf')][_0x8376('0x13')]||null:null,'include':_0x502252[_0x8376('0xf')]?_0x502252[_0x8376('0xf')][_0x8376('0x14')]?_[_0x8376('0x15')](_0x502252['options'][_0x8376('0x14')],function(_0x2158b8){return{'model':db[_0x2158b8['model']],'as':_0x2158b8['as'],'attributes':_0x2158b8['attributes'],'include':_0x2158b8[_0x8376('0x14')]?_['map'](_0x2158b8['include'],function(_0x100179){return{'model':db[_0x100179[_0x8376('0x16')]],'as':_0x100179['as'],'attributes':_0x100179[_0x8376('0x12')],'include':_0x100179[_0x8376('0x14')]?_[_0x8376('0x15')](_0x100179[_0x8376('0x14')],function(_0x511de6){return{'model':db[_0x511de6[_0x8376('0x16')]],'as':_0x511de6['as'],'attributes':_0x511de6[_0x8376('0x12')]};}):[]};}):[]};}):[]:[]})[_0x8376('0x17')](function(_0x49b180){logger['info'](_0x8376('0xc'),_0x502252);logger['debug'](_0x8376('0xc'),_0x502252,JSON[_0x8376('0x18')](_0x49b180));_0x50e383(_0x49b180);})['catch'](function(_0x294bf1){logger[_0x8376('0x19')](_0x8376('0xc'),_0x294bf1[_0x8376('0x1a')],_0x502252);_0x5e273f(_0x33df55[_0x8376('0x19')](0x1f4,_0x294bf1[_0x8376('0x1a')]));});});};exports[_0x8376('0x1b')]=function(_0x22a2fd){var _0x478e9a=this;return new Promise(function(_0x1e0f7d,_0x382278){return db[_0x8376('0xd')][_0x8376('0x1c')]({'raw':_0x22a2fd['options']?_0x22a2fd[_0x8376('0xf')][_0x8376('0x10')]===undefined?!![]:![]:!![],'where':_0x22a2fd[_0x8376('0xf')]?_0x22a2fd[_0x8376('0xf')]['where']||null:null,'attributes':_0x22a2fd['options']?_0x22a2fd[_0x8376('0xf')]['attributes']||null:null,'include':_0x22a2fd['options']?_0x22a2fd[_0x8376('0xf')][_0x8376('0x14')]?_[_0x8376('0x15')](_0x22a2fd[_0x8376('0xf')][_0x8376('0x14')],function(_0x23072e){return{'model':db[_0x23072e['model']],'as':_0x23072e['as'],'attributes':_0x23072e[_0x8376('0x12')],'include':_0x23072e[_0x8376('0x14')]?_['map'](_0x23072e[_0x8376('0x14')],function(_0x5b2cff){return{'model':db[_0x5b2cff['model']],'as':_0x5b2cff['as'],'attributes':_0x5b2cff[_0x8376('0x12')],'include':_0x5b2cff[_0x8376('0x14')]?_['map'](_0x5b2cff[_0x8376('0x14')],function(_0x3438a5){return{'model':db[_0x3438a5['model']],'as':_0x3438a5['as'],'attributes':_0x3438a5[_0x8376('0x12')]};}):[]};}):[]};}):[]:[]})[_0x8376('0x17')](function(_0x6c0eb5){logger['info'](_0x8376('0x1b'),_0x22a2fd);logger[_0x8376('0x1d')]('ShowUser',_0x22a2fd,JSON['stringify'](_0x6c0eb5));_0x1e0f7d(_0x6c0eb5);})['catch'](function(_0x58828a){logger[_0x8376('0x19')](_0x8376('0x1b'),_0x58828a['message'],_0x22a2fd);_0x382278(_0x478e9a[_0x8376('0x19')](0x1f4,_0x58828a[_0x8376('0x1a')]));});});};exports[_0x8376('0x1e')]=function(_0x38727d){var _0x29da7b;return db['User'][_0x8376('0x1c')]({'where':_0x38727d['options'][_0x8376('0x11')]||{},'attributes':['id',_0x8376('0x1f'),_0x8376('0x20'),_0x8376('0x21'),_0x8376('0x22')]})[_0x8376('0x17')](function(_0x181985){if(!_0x181985){throw new Error(util['format'](_0x8376('0x23'),_0x38727d['params']['id']));}_0x29da7b=_0x181985;return db[_0x8376('0x24')]['update']({'paused':0x1},{'where':{'UserId':_0x29da7b['id']},'individualHooks':!![]});})['then'](function(){return db[_0x8376('0x25')]['findAll']({'where':{'membername':_0x29da7b[_0x8376('0x1f')],'type':_0x8376('0x26'),'exitAt':null}});})[_0x8376('0x17')](function(_0x3c7a5f){if(_0x3c7a5f&&_0x3c7a5f[_0x8376('0x27')]){var _0x3ab330=moment()[_0x8376('0x28')](_0x8376('0x29'));for(var _0x39c007=0x0,_0x5c37da=_0x3c7a5f[_0x8376('0x27')];_0x39c007<_0x5c37da;_0x39c007++){_0x3c7a5f[_0x39c007]['updateAttributes']({'exitAt':_0x3ab330});}}})['then'](function(){var _0x10d0ba=[];var _0x4a8400=utils[_0x8376('0x2a')]();_0x4a8400['forEach'](function(_0x1a080e){_0x10d0ba[_0x8376('0x2b')]({'channel':_0x1a080e,'membername':_0x29da7b[_0x8376('0x1f')],'interface':_['isNil'](_0x29da7b[_0x8376('0x22')])?util[_0x8376('0x28')](_0x8376('0x2c'),_0x29da7b['name']):_0x29da7b['interface'],'type':_0x8376('0x26'),'enterAt':moment()[_0x8376('0x28')](_0x8376('0x29')),'data1':_0x38727d[_0x8376('0x2d')][_0x8376('0x2e')]||'DEFAULT\x20PAUSE','role':_0x29da7b['role'],'internal':_0x29da7b[_0x8376('0x21')],'uniqueid':_0x38727d[_0x8376('0x2d')][_0x8376('0x2f')]||null});});return db[_0x8376('0x25')][_0x8376('0x30')](_0x10d0ba,{'individualHooks':!![]});})[_0x8376('0x17')](function(){return _0x29da7b[_0x8376('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x38727d[_0x8376('0x2d')][_0x8376('0x2e')]||_0x8376('0x32'),'lastPauseAt':moment()[_0x8376('0x28')](_0x8376('0x29'))});})['catch'](function(_0x535ee3){throw _0x535ee3;});};exports[_0x8376('0x33')]=function(_0x437af8){return Promise[_0x8376('0x34')]()[_0x8376('0x17')](function(){if(_0x437af8['body'][_0x8376('0x35')]&&!utils[_0x8376('0x36')](_0x437af8[_0x8376('0x2d')][_0x8376('0x35')])){throw new Error(util[_0x8376('0x28')](_0x8376('0x37'),_0x437af8[_0x8376('0x2d')]['channel']));}return db['User']['findOne']({'where':_0x437af8[_0x8376('0xf')][_0x8376('0x11')]||{},'attributes':['id',_0x8376('0x1f'),_0x8376('0x20'),_0x8376('0x21'),_0x8376('0x22'),_0x8376('0x38'),_0x8376('0x39'),_0x8376('0x3a'),_0x8376('0x3b'),'faxPause',_0x8376('0x3c'),_0x8376('0x3d'),'whatsappPause',_0x8376('0x3e'),_0x8376('0x3f')]});})[_0x8376('0x17')](function(_0x5c5e91){if(!_0x5c5e91){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x437af8['params']['id']));}return _0x5c5e91[_0x8376('0x40')](_0x437af8[_0x8376('0x2d')][_0x8376('0x35')],'system');})['catch'](function(_0x240147){throw _0x240147;});};exports[_0x8376('0x41')]=function(_0x10c3d7){var _0x4f804a=this;return new Promise(function(_0x1be5ab,_0x31d6e0){var _0x41b804;return db['User']['findOne']({'where':_0x10c3d7['options'][_0x8376('0x11')]||{},'attributes':['id','name']})[_0x8376('0x17')](function(_0x4ff6c9){if(_0x4ff6c9){_0x41b804=_0x4ff6c9;return db[_0x8376('0x24')][_0x8376('0x42')]({'where':{'membername':_0x41b804[_0x8376('0x1f')]},'individualHooks':!![]});}})[_0x8376('0x17')](function(){if(_0x41b804){return db[_0x8376('0x25')][_0x8376('0xe')]({'where':{'membername':_0x41b804['name'],'exitAt':null}});}})[_0x8376('0x17')](function(_0x6400e1){if(_0x41b804){if(_0x6400e1&&_0x6400e1[_0x8376('0x27')]){var _0x4d2cd2=[];_0x6400e1[_0x8376('0x43')](function(_0x47fcf2){_0x4d2cd2[_0x8376('0x2b')](_0x47fcf2[_0x8376('0x31')]({'exitAt':moment()[_0x8376('0x28')](_0x8376('0x29'))}));});return BPromise['all'](_0x4d2cd2);}}})[_0x8376('0x17')](function(){if(_0x41b804){return _0x41b804[_0x8376('0x31')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x8376('0x17')](function(_0x78ffc9){_0x1be5ab(_0x78ffc9);})[_0x8376('0x44')](function(_0x1ee513){_0x31d6e0(_0x4f804a['error'](0x1f4,_0x1ee513[_0x8376('0x1a')]));});});};exports[_0x8376('0x45')]=function(_0x3adae6){var _0x41a8ea=this;return new Promise(function(_0x4b51c9,_0x449bc1){var _0x3ca863;var _0x199b4e;var _0x1c74cc;var _0x527e07;return db[_0x8376('0xd')]['findOne']({'where':_0x3adae6[_0x8376('0xf')][_0x8376('0x11')]||{},'attributes':['id',_0x8376('0x1f'),_0x8376('0x20'),_0x8376('0x46'),_0x8376('0x47'),_0x8376('0x21'),'loginInPause','interface']})['then'](function(_0xe934fc){if(_0xe934fc){_0x3ca863=_0xe934fc;_0x527e07=_0x3adae6[_0x8376('0x2d')][_0x8376('0x22')]?_0x3adae6[_0x8376('0x2d')][_0x8376('0x22')]:util[_0x8376('0x28')]('SIP/%s',_0x3ca863[_0x8376('0x1f')]);return db[_0x8376('0xd')][_0x8376('0x48')]({'where':{'role':_0x8376('0x49'),'online':!![],'id':{'$ne':_0x3ca863['id']}}});}})[_0x8376('0x17')](function(_0x30d7b6){if(_0x30d7b6){_0x1c74cc=_0x30d7b6;return require(_0x8376('0x4a'))[_0x8376('0x4b')]();}})[_0x8376('0x17')](function(_0xff99de){if(_0xff99de&&_0xff99de['agents']&&_0x1c74cc>=_0xff99de['agents']){throw new Error(_0x8376('0x4c'));}})[_0x8376('0x17')](function(){if(_0x3ca863){return db[_0x8376('0x24')]['destroy']({'where':{'membername':_0x3ca863['name']},'individualHooks':!![]});}})['then'](function(){if(_0x3ca863){return _0x3ca863[_0x8376('0x4d')]({'raw':!![]});}})[_0x8376('0x17')](function(_0x27d1d3){if(_0x3ca863){if(_0x27d1d3){var _0x374424=[];_0x199b4e=_0x27d1d3;if(_0x199b4e[_0x8376('0x27')]){for(var _0x370491=0x0;_0x370491<_0x199b4e['length'];_0x370491++){_0x374424[_0x8376('0x2b')](db[_0x8376('0x24')][_0x8376('0x4e')]({'membername':_0x3ca863['name'],'UserId':_0x3ca863['id'],'queue_name':_0x199b4e[_0x370491][_0x8376('0x1f')],'VoiceQueueId':_0x199b4e[_0x370491]['id'],'interface':_0x527e07,'paused':_0x3ca863[_0x8376('0x4f')]||![],'penalty':_0x199b4e[_0x370491][_0x8376('0x50')]||0x0}));}return BPromise[_0x8376('0x51')](_0x374424);}}}})['then'](function(){if(_0x3ca863){return db['MemberReport'][_0x8376('0xe')]({'where':{'membername':_0x3ca863[_0x8376('0x1f')],'exitAt':null}});}})[_0x8376('0x17')](function(_0x36e93){if(_0x3ca863){if(_0x36e93&&_0x36e93[_0x8376('0x27')]){var _0x5751a1=[];_0x36e93[_0x8376('0x43')](function(_0x44588d){_0x5751a1[_0x8376('0x2b')](_0x44588d['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x5751a1);}}})[_0x8376('0x17')](function(){if(_0x3ca863){var _0xec6fd2=[];var _0x3dce71=[];var _0x64bd5d=utils['getChannels']();var _0x4483be={'membername':_0x3ca863[_0x8376('0x1f')],'interface':_0x527e07,'enterAt':moment()[_0x8376('0x28')](_0x8376('0x29')),'role':_0x3ca863[_0x8376('0x20')],'internal':_0x3ca863[_0x8376('0x21')]};_0x64bd5d[_0x8376('0x43')](function(_0x32a449){_0xec6fd2['push'](_['merge']({'channel':_0x32a449,'type':_0x8376('0x52'),'data1':_0x8376('0x53'),'data2':_0x527e07},_0x4483be));if(_0x3ca863[_0x8376('0x4f')]){_0x3dce71[_0x8376('0x2b')](_[_0x8376('0x54')]({'channel':_0x32a449,'type':_0x8376('0x26'),'data1':'LOGININPAUSE'},_0x4483be));}});return db['MemberReport'][_0x8376('0x30')](_0xec6fd2[_0x8376('0x55')](_0x3dce71),{'individualHooks':!![]});}})[_0x8376('0x17')](function(){if(_0x3ca863){return _0x3ca863[_0x8376('0x31')]({'online':!![],'lastLoginAt':moment()[_0x8376('0x28')](_0x8376('0x29')),'voicePause':_0x3ca863[_0x8376('0x4f')]||![],'mailPause':_0x3ca863[_0x8376('0x4f')]||![],'chatPause':_0x3ca863[_0x8376('0x4f')]||![],'faxPause':_0x3ca863['loginInPause']||![],'smsPause':_0x3ca863[_0x8376('0x4f')]||![],'openchannelPause':_0x3ca863[_0x8376('0x4f')]||![],'pauseType':_0x3ca863[_0x8376('0x4f')]?_0x8376('0x56'):null,'lastPauseAt':moment()['format'](_0x8376('0x29')),'interface':_0x527e07});}})[_0x8376('0x17')](function(_0x1bd6a){_0x4b51c9(_0x1bd6a);})[_0x8376('0x44')](function(_0x84639c){_0x449bc1(_0x41a8ea['error'](0x1f4,_0x84639c[_0x8376('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 59cd0cd..6da70be 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 _0x176b=['remove','update','removeListener','length','user:','./user.events','save'];(function(_0x55e14e,_0x5f125e){var _0x3a396d=function(_0x25f40f){while(--_0x25f40f){_0x55e14e['push'](_0x55e14e['shift']());}};_0x3a396d(++_0x5f125e);}(_0x176b,0x1be));var _0xb176=function(_0xa261f5,_0x37ed4e){_0xa261f5=_0xa261f5-0x0;var _0x4a889b=_0x176b[_0xa261f5];return _0x4a889b;};'use strict';var UserEvents=require(_0xb176('0x0'));var events=[_0xb176('0x1'),_0xb176('0x2'),_0xb176('0x3')];function createListener(_0x244334,_0x147224){return function(_0x25e10c){_0x147224['emit'](_0x244334,_0x25e10c);};}function removeListener(_0x4d825a,_0x5f00d8){return function(){UserEvents[_0xb176('0x4')](_0x4d825a,_0x5f00d8);};}exports['register']=function(_0x5838ff){for(var _0x12b0ee=0x0,_0x4470de=events[_0xb176('0x5')];_0x12b0ee<_0x4470de;_0x12b0ee++){var _0x3b6878=events[_0x12b0ee];var _0x1ce1fa=createListener(_0xb176('0x6')+_0x3b6878,_0x5838ff);UserEvents['on'](_0x3b6878,_0x1ce1fa);}}; \ No newline at end of file +var _0xbd58=['length','user:','remove','update','emit','removeListener','register'];(function(_0x1aac46,_0x5e2881){var _0x2f7f7d=function(_0x18f4d4){while(--_0x18f4d4){_0x1aac46['push'](_0x1aac46['shift']());}};_0x2f7f7d(++_0x5e2881);}(_0xbd58,0x1e5));var _0x8bd5=function(_0x59e4e3,_0x430f6c){_0x59e4e3=_0x59e4e3-0x0;var _0x54be45=_0xbd58[_0x59e4e3];return _0x54be45;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x8bd5('0x0'),_0x8bd5('0x1')];function createListener(_0x2bca35,_0x1b7c0b){return function(_0x28b857){_0x1b7c0b[_0x8bd5('0x2')](_0x2bca35,_0x28b857);};}function removeListener(_0x51fa99,_0x136bc7){return function(){UserEvents[_0x8bd5('0x3')](_0x51fa99,_0x136bc7);};}exports[_0x8bd5('0x4')]=function(_0x356253){for(var _0x56aecb=0x0,_0x20e76c=events[_0x8bd5('0x5')];_0x56aecb<_0x20e76c;_0x56aecb++){var _0x458ce9=events[_0x56aecb];var _0x51af9f=createListener(_0x8bd5('0x6')+_0x458ce9,_0x356253);UserEvents['on'](_0x458ce9,_0x51af9f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c424b0e..d47ccde 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x26e2e8,_0x105b22){var _0x238da5=function(_0x55835f){while(--_0x55835f){_0x26e2e8['push'](_0x26e2e8['shift']());}};_0x238da5(++_0x105b22);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xa6b0b8,_0xcbbdeb){var _0x14cea8=function(_0x5937c1){while(--_0x5937c1){_0xa6b0b8['push'](_0xa6b0b8['shift']());}};_0x14cea8(++_0xcbbdeb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0xcb91[_0x5d6c3e];return _0x44ecb7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f595f96..709125b 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 _0x0de3=['INTEGER','sequelize','exports'];(function(_0x4b28e4,_0x3f145f){var _0x5c3c07=function(_0x47d1c1){while(--_0x47d1c1){_0x4b28e4['push'](_0x4b28e4['shift']());}};_0x5c3c07(++_0x3f145f);}(_0x0de3,0x15d));var _0x30de=function(_0x4fab53,_0x22d4a3){_0x4fab53=_0x4fab53-0x0;var _0x1d6f3d=_0x0de3[_0x4fab53];return _0x1d6f3d;};'use strict';var Sequelize=require(_0x30de('0x0'));module[_0x30de('0x1')]={'penalty':{'type':Sequelize[_0x30de('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1b6d=['INTEGER','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1b6d,0xe7));var _0xd1b6=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1b6d[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require('sequelize');module[_0xd1b6('0x0')]={'penalty':{'type':Sequelize[_0xd1b6('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 c336673..d90af37 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 _0xa200=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment'];(function(_0x6dc234,_0x52e5d3){var _0xf6b2d1=function(_0x31fed0){while(--_0x31fed0){_0x6dc234['push'](_0x6dc234['shift']());}};_0xf6b2d1(++_0x52e5d3);}(_0xa200,0x122));var _0x0a20=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa200[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0a20('0x0'));var util=require('util');var logger=require(_0x0a20('0x1'))(_0x0a20('0x2'));var moment=require(_0x0a20('0x3'));var BPromise=require(_0x0a20('0x4'));var rp=require(_0x0a20('0x5'));var fs=require('fs');var path=require(_0x0a20('0x6'));var rimraf=require(_0x0a20('0x7'));var config=require(_0x0a20('0x8'));var attributes=require(_0x0a20('0x9'));module[_0x0a20('0xa')]=function(_0x207743,_0x5edc28){return _0x207743[_0x0a20('0xb')](_0x0a20('0xc'),attributes,{'tableName':_0x0a20('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6513=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0xe2cbb8,_0x158436){var _0x3cce4d=function(_0x5a7e3d){while(--_0x5a7e3d){_0xe2cbb8['push'](_0xe2cbb8['shift']());}};_0x3cce4d(++_0x158436);}(_0x6513,0xf3));var _0x3651=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x6513[_0x5de532];return _0x4e9192;};'use strict';var _=require('lodash');var util=require(_0x3651('0x0'));var logger=require(_0x3651('0x1'))('api');var moment=require(_0x3651('0x2'));var BPromise=require('bluebird');var rp=require(_0x3651('0x3'));var fs=require('fs');var path=require(_0x3651('0x4'));var rimraf=require(_0x3651('0x5'));var config=require(_0x3651('0x6'));var attributes=require(_0x3651('0x7'));module[_0x3651('0x8')]=function(_0x426d41,_0x1335a1){return _0x426d41['define']('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','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 e5adf93..3eb0f16 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 _0xc7b2=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x3ca771,_0x3b2a87){var _0x434097=function(_0x1a60a0){while(--_0x1a60a0){_0x3ca771['push'](_0x3ca771['shift']());}};_0x434097(++_0x3b2a87);}(_0xc7b2,0xd6));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c7b('0x0'));var util=require(_0x2c7b('0x1'));var moment=require(_0x2c7b('0x2'));var BPromise=require(_0x2c7b('0x3'));var rs=require(_0x2c7b('0x4'));var fs=require('fs');var Redis=require(_0x2c7b('0x5'));var db=require(_0x2c7b('0x6'))['db'];var utils=require(_0x2c7b('0x7'));var logger=require(_0x2c7b('0x8'))(_0x2c7b('0x9'));var config=require(_0x2c7b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2c7b('0xb')][_0x2c7b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11f330,_0x3036dc,_0x94e9ff){return new BPromise(function(_0x15f70a,_0x3f344c){return client['request'](_0x11f330,_0x94e9ff)[_0x2c7b('0xd')](function(_0x5e3c5e){logger[_0x2c7b('0xe')](_0x2c7b('0xf'),_0x3036dc,'request\x20sent');logger['debug'](_0x2c7b('0x10'),_0x3036dc,'request\x20sent',JSON[_0x2c7b('0x11')](_0x5e3c5e));if(_0x5e3c5e['error']){if(_0x5e3c5e['error'][_0x2c7b('0x12')]===0x1f4){logger[_0x2c7b('0x13')](_0x2c7b('0xf'),_0x3036dc,_0x5e3c5e[_0x2c7b('0x13')][_0x2c7b('0x14')]);return _0x3f344c(_0x5e3c5e[_0x2c7b('0x13')][_0x2c7b('0x14')]);}logger['error'](_0x2c7b('0xf'),_0x3036dc,_0x5e3c5e['error']['message']);return _0x15f70a(_0x5e3c5e[_0x2c7b('0x13')][_0x2c7b('0x14')]);}else{logger[_0x2c7b('0xe')](_0x2c7b('0xf'),_0x3036dc,_0x2c7b('0x15'));_0x15f70a(_0x5e3c5e['result']['message']);}})[_0x2c7b('0x16')](function(_0x14258b){logger[_0x2c7b('0x13')](_0x2c7b('0xf'),_0x3036dc,_0x14258b);_0x3f344c(_0x14258b);});});} \ No newline at end of file +var _0x9b95=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x469a98,_0x1405fa){var _0x5b638c=function(_0x71f7c5){while(--_0x71f7c5){_0x469a98['push'](_0x469a98['shift']());}};_0x5b638c(++_0x1405fa);}(_0x9b95,0x9f));var _0x59b9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9b95[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x59b9('0x0'));var util=require(_0x59b9('0x1'));var moment=require(_0x59b9('0x2'));var BPromise=require(_0x59b9('0x3'));var rs=require(_0x59b9('0x4'));var fs=require('fs');var Redis=require(_0x59b9('0x5'));var db=require(_0x59b9('0x6'))['db'];var utils=require(_0x59b9('0x7'));var logger=require(_0x59b9('0x8'))(_0x59b9('0x9'));var config=require(_0x59b9('0xa'));var jayson=require(_0x59b9('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a83a6,_0x4c2138,_0x4484f4){return new BPromise(function(_0xff52c0,_0xa2f595){return client[_0x59b9('0xc')](_0x1a83a6,_0x4484f4)[_0x59b9('0xd')](function(_0x4fcf8a){logger[_0x59b9('0xe')](_0x59b9('0xf'),_0x4c2138,'request\x20sent');logger[_0x59b9('0x10')](_0x59b9('0x11'),_0x4c2138,_0x59b9('0x12'),JSON[_0x59b9('0x13')](_0x4fcf8a));if(_0x4fcf8a[_0x59b9('0x14')]){if(_0x4fcf8a[_0x59b9('0x14')][_0x59b9('0x15')]===0x1f4){logger[_0x59b9('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x4c2138,_0x4fcf8a[_0x59b9('0x14')]['message']);return _0xa2f595(_0x4fcf8a[_0x59b9('0x14')][_0x59b9('0x16')]);}logger['error'](_0x59b9('0xf'),_0x4c2138,_0x4fcf8a[_0x59b9('0x14')][_0x59b9('0x16')]);return _0xff52c0(_0x4fcf8a[_0x59b9('0x14')]['message']);}else{logger[_0x59b9('0xe')](_0x59b9('0xf'),_0x4c2138,'request\x20sent');_0xff52c0(_0x4fcf8a[_0x59b9('0x17')][_0x59b9('0x16')]);}})[_0x59b9('0x18')](function(_0x59146e){logger['error'](_0x59b9('0xf'),_0x4c2138,_0x59146e);_0xa2f595(_0x59146e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 0facdb9..304cf50 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(_0x5c2cd2,_0x3ddfde){var _0x4b8200=function(_0x3f57be){while(--_0x3f57be){_0x5c2cd2['push'](_0x5c2cd2['shift']());}};_0x4b8200(++_0x3ddfde);}(_0x70e0,0x17b));var _0x070e=function(_0x471f92,_0x424677){_0x471f92=_0x471f92-0x0;var _0x2e30a9=_0x70e0[_0x471f92];return _0x2e30a9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x17ea13,_0x1b7955){var _0x911701=function(_0x1ebed6){while(--_0x1ebed6){_0x17ea13['push'](_0x17ea13['shift']());}};_0x911701(++_0x1b7955);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 7793c1c..f51ec25 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 _0x20c4=['INTEGER','sequelize'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x20c4,0x13b));var _0x420c=function(_0x555f7d,_0x38ab3f){_0x555f7d=_0x555f7d-0x0;var _0x4cb145=_0x20c4[_0x555f7d];return _0x4cb145;};'use strict';var Sequelize=require(_0x420c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x420c('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x420c('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe741=['sequelize','INTEGER','STRING'];(function(_0x366647,_0xd7065c){var _0x54aed1=function(_0x1c0d52){while(--_0x1c0d52){_0x366647['push'](_0x366647['shift']());}};_0x54aed1(++_0xd7065c);}(_0xe741,0x1bf));var _0x1e74=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xe741[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x1e74('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1e74('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1e74('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index fbebf1b..aca7fd2 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 _0xb01b=['user_has_fax_queues','util','../../config/logger','moment','request-promise','path','./userFaxQueue.attributes','exports','define'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0xb01b,0xe2));var _0xbb01=function(_0x4269df,_0x22e048){_0x4269df=_0x4269df-0x0;var _0x2e61e3=_0xb01b[_0x4269df];return _0x2e61e3;};'use strict';var _=require('lodash');var util=require(_0xbb01('0x0'));var logger=require(_0xbb01('0x1'))('api');var moment=require(_0xbb01('0x2'));var BPromise=require('bluebird');var rp=require(_0xbb01('0x3'));var fs=require('fs');var path=require(_0xbb01('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbb01('0x5'));module[_0xbb01('0x6')]=function(_0x52d2ae,_0x207810){return _0x52d2ae[_0xbb01('0x7')]('UserFaxQueue',attributes,{'tableName':_0xbb01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bcc=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x50f5ef,_0x10677c){var _0x48f2a2=function(_0x803ec5){while(--_0x803ec5){_0x50f5ef['push'](_0x50f5ef['shift']());}};_0x48f2a2(++_0x10677c);}(_0x1bcc,0xa0));var _0xc1bc=function(_0x6978c0,_0x1f6765){_0x6978c0=_0x6978c0-0x0;var _0x361377=_0x1bcc[_0x6978c0];return _0x361377;};'use strict';var _=require(_0xc1bc('0x0'));var util=require(_0xc1bc('0x1'));var logger=require(_0xc1bc('0x2'))(_0xc1bc('0x3'));var moment=require(_0xc1bc('0x4'));var BPromise=require('bluebird');var rp=require(_0xc1bc('0x5'));var fs=require('fs');var path=require(_0xc1bc('0x6'));var rimraf=require(_0xc1bc('0x7'));var config=require(_0xc1bc('0x8'));var attributes=require(_0xc1bc('0x9'));module[_0xc1bc('0xa')]=function(_0x5ebdf3,_0x53f9ec){return _0x5ebdf3[_0xc1bc('0xb')](_0xc1bc('0xc'),attributes,{'tableName':_0xc1bc('0xd'),'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 4f636f9..518290c 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 _0x54aa=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x56cde8,_0x5736cb){var _0x1fa897=function(_0x4ff294){while(--_0x4ff294){_0x56cde8['push'](_0x56cde8['shift']());}};_0x1fa897(++_0x5736cb);}(_0x54aa,0x85));var _0xa54a=function(_0x4e772d,_0x56a24e){_0x4e772d=_0x4e772d-0x0;var _0x31ae2e=_0x54aa[_0x4e772d];return _0x31ae2e;};'use strict';var _=require(_0xa54a('0x0'));var util=require(_0xa54a('0x1'));var moment=require('moment');var BPromise=require(_0xa54a('0x2'));var rs=require(_0xa54a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa54a('0x4'))['db'];var utils=require(_0xa54a('0x5'));var logger=require(_0xa54a('0x6'))('rpc');var config=require(_0xa54a('0x7'));var jayson=require(_0xa54a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2596,_0x819fe4,_0x5059f4){return new BPromise(function(_0xbaab97,_0x5b9138){return client[_0xa54a('0x9')](_0x1a2596,_0x5059f4)[_0xa54a('0xa')](function(_0x29adbc){logger[_0xa54a('0xb')](_0xa54a('0xc'),_0x819fe4,_0xa54a('0xd'));logger[_0xa54a('0xe')](_0xa54a('0xf'),_0x819fe4,_0xa54a('0xd'),JSON[_0xa54a('0x10')](_0x29adbc));if(_0x29adbc[_0xa54a('0x11')]){if(_0x29adbc[_0xa54a('0x11')][_0xa54a('0x12')]===0x1f4){logger[_0xa54a('0x11')](_0xa54a('0xc'),_0x819fe4,_0x29adbc[_0xa54a('0x11')][_0xa54a('0x13')]);return _0x5b9138(_0x29adbc[_0xa54a('0x11')][_0xa54a('0x13')]);}logger[_0xa54a('0x11')](_0xa54a('0xc'),_0x819fe4,_0x29adbc[_0xa54a('0x11')][_0xa54a('0x13')]);return _0xbaab97(_0x29adbc['error'][_0xa54a('0x13')]);}else{logger[_0xa54a('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x819fe4,_0xa54a('0xd'));_0xbaab97(_0x29adbc[_0xa54a('0x14')][_0xa54a('0x13')]);}})[_0xa54a('0x15')](function(_0x523fe9){logger[_0xa54a('0x11')](_0xa54a('0xc'),_0x819fe4,_0x523fe9);_0x5b9138(_0x523fe9);});});} \ No newline at end of file +var _0xdf0d=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x30e469,_0x5de53c){var _0xf75061=function(_0x16a336){while(--_0x16a336){_0x30e469['push'](_0x30e469['shift']());}};_0xf75061(++_0x5de53c);}(_0xdf0d,0xeb));var _0xddf0=function(_0x3bfee5,_0x2b9999){_0x3bfee5=_0x3bfee5-0x0;var _0x174789=_0xdf0d[_0x3bfee5];return _0x174789;};'use strict';var _=require(_0xddf0('0x0'));var util=require(_0xddf0('0x1'));var moment=require(_0xddf0('0x2'));var BPromise=require('bluebird');var rs=require(_0xddf0('0x3'));var fs=require('fs');var Redis=require(_0xddf0('0x4'));var db=require(_0xddf0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xddf0('0x6'));var config=require('../../config/environment');var jayson=require(_0xddf0('0x7'));var client=jayson['client'][_0xddf0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b3d07,_0x33ca9d,_0x5c84e8){return new BPromise(function(_0x109636,_0x1faad1){return client[_0xddf0('0x9')](_0x2b3d07,_0x5c84e8)[_0xddf0('0xa')](function(_0x3c08f0){logger[_0xddf0('0xb')](_0xddf0('0xc'),_0x33ca9d,_0xddf0('0xd'));logger[_0xddf0('0xe')](_0xddf0('0xf'),_0x33ca9d,_0xddf0('0xd'),JSON['stringify'](_0x3c08f0));if(_0x3c08f0[_0xddf0('0x10')]){if(_0x3c08f0[_0xddf0('0x10')][_0xddf0('0x11')]===0x1f4){logger[_0xddf0('0x10')](_0xddf0('0xc'),_0x33ca9d,_0x3c08f0[_0xddf0('0x10')]['message']);return _0x1faad1(_0x3c08f0[_0xddf0('0x10')][_0xddf0('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x33ca9d,_0x3c08f0[_0xddf0('0x10')][_0xddf0('0x12')]);return _0x109636(_0x3c08f0[_0xddf0('0x10')][_0xddf0('0x12')]);}else{logger[_0xddf0('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x33ca9d,_0xddf0('0xd'));_0x109636(_0x3c08f0[_0xddf0('0x13')][_0xddf0('0x12')]);}})[_0xddf0('0x14')](function(_0x2e3d76){logger[_0xddf0('0x10')](_0xddf0('0xc'),_0x33ca9d,_0x2e3d76);_0x1faad1(_0x2e3d76);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ea5dfa1..04535bd 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2a7d55,_0x36bd70){var _0x137989=function(_0x51246a){while(--_0x51246a){_0x2a7d55['push'](_0x2a7d55['shift']());}};_0x137989(++_0x36bd70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1205dd,_0x11605e){var _0x439f72=function(_0x459b90){while(--_0x459b90){_0x1205dd['push'](_0x1205dd['shift']());}};_0x439f72(++_0x11605e);}(_0xedd9,0xfc));var _0x9edd=function(_0x42e1cd,_0x5ea3c7){_0x42e1cd=_0x42e1cd-0x0;var _0x4d69ad=_0xedd9[_0x42e1cd];return _0x4d69ad;};'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 875bb4e..d088b81 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 _0x33af=['INTEGER','sequelize','exports'];(function(_0x2e6b07,_0x581517){var _0x113ea9=function(_0x5c07fc){while(--_0x5c07fc){_0x2e6b07['push'](_0x2e6b07['shift']());}};_0x113ea9(++_0x581517);}(_0x33af,0xa3));var _0xf33a=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x33af[_0xfcbcb8];return _0x1b1f97;};'use strict';var Sequelize=require(_0xf33a('0x0'));module[_0xf33a('0x1')]={'penalty':{'type':Sequelize[_0xf33a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a5c=['exports'];(function(_0x1cb8aa,_0x2a08c3){var _0x220179=function(_0x32977c){while(--_0x32977c){_0x1cb8aa['push'](_0x1cb8aa['shift']());}};_0x220179(++_0x2a08c3);}(_0x6a5c,0x9d));var _0xc6a5=function(_0x272734,_0x5e33e4){_0x272734=_0x272734-0x0;var _0x1f7aa0=_0x6a5c[_0x272734];return _0x1f7aa0;};'use strict';var Sequelize=require('sequelize');module[_0xc6a5('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 d4bffde..7d2479e 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 _0xb4f9=['user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','UserMailQueue'];(function(_0x2e870b,_0x580fef){var _0x2bbe45=function(_0xdad29c){while(--_0xdad29c){_0x2e870b['push'](_0x2e870b['shift']());}};_0x2bbe45(++_0x580fef);}(_0xb4f9,0x85));var _0x9b4f=function(_0x3baaf2,_0x894e3d){_0x3baaf2=_0x3baaf2-0x0;var _0x50e8b0=_0xb4f9[_0x3baaf2];return _0x50e8b0;};'use strict';var _=require(_0x9b4f('0x0'));var util=require(_0x9b4f('0x1'));var logger=require(_0x9b4f('0x2'))(_0x9b4f('0x3'));var moment=require(_0x9b4f('0x4'));var BPromise=require(_0x9b4f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b4f('0x6'));var rimraf=require(_0x9b4f('0x7'));var config=require(_0x9b4f('0x8'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x62a5a2,_0x3e6ebf){return _0x62a5a2[_0x9b4f('0x9')](_0x9b4f('0xa'),attributes,{'tableName':_0x9b4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa45c=['rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x49f2d4,_0x4554db){var _0x174021=function(_0x5edd9f){while(--_0x5edd9f){_0x49f2d4['push'](_0x49f2d4['shift']());}};_0x174021(++_0x4554db);}(_0xa45c,0xaf));var _0xca45=function(_0x40944a,_0x99ad6d){_0x40944a=_0x40944a-0x0;var _0x36062c=_0xa45c[_0x40944a];return _0x36062c;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var logger=require(_0xca45('0x2'))(_0xca45('0x3'));var moment=require(_0xca45('0x4'));var BPromise=require(_0xca45('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca45('0x6'));var rimraf=require(_0xca45('0x7'));var config=require('../../config/environment');var attributes=require(_0xca45('0x8'));module[_0xca45('0x9')]=function(_0x287b9e,_0x5973fa){return _0x287b9e[_0xca45('0xa')](_0xca45('0xb'),attributes,{'tableName':_0xca45('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 6b6f064..275482e 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4c869e,_0xdb0c28){var _0x21cbaa=function(_0x34c4d1){while(--_0x34c4d1){_0x4c869e['push'](_0x4c869e['shift']());}};_0x21cbaa(++_0xdb0c28);}(_0x00bb,0x1d8));var _0xb00b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00bb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2aeb52,_0x3d2398){var _0x2d0e98=function(_0xd566a0){while(--_0xd566a0){_0x2aeb52['push'](_0x2aeb52['shift']());}};_0x2d0e98(++_0x3d2398);}(_0x34e8,0x12c));var _0x834e=function(_0x30cd9a,_0x3e8379){_0x30cd9a=_0x30cd9a-0x0;var _0x1c68c5=_0x34e8[_0x30cd9a];return _0x1c68c5;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 0a5191d..c3e64e3 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 _0x7b8a=['./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7b8a,0x131));var _0xa7b8=function(_0x2a0e05,_0x39bf1c){_0x2a0e05=_0x2a0e05-0x0;var _0x486d00=_0x7b8a[_0x2a0e05];return _0x486d00;};'use strict';var multer=require('multer');var util=require(_0xa7b8('0x0'));var path=require(_0xa7b8('0x1'));var timeout=require(_0xa7b8('0x2'));var express=require(_0xa7b8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa7b8('0x4'));var interaction=require(_0xa7b8('0x5'));var config=require(_0xa7b8('0x6'));var controller=require(_0xa7b8('0x7'));router[_0xa7b8('0x8')]('/',auth[_0xa7b8('0x9')](),controller[_0xa7b8('0xa')]);module[_0xa7b8('0xb')]=router; \ No newline at end of file +var _0xb575=['sendUserNotification','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x127277,_0x4cacaf){var _0x23c8ee=function(_0x942e67){while(--_0x942e67){_0x127277['push'](_0x127277['shift']());}};_0x23c8ee(++_0x4cacaf);}(_0xb575,0x9c));var _0x5b57=function(_0x451eaa,_0x27948f){_0x451eaa=_0x451eaa-0x0;var _0x25fdd7=_0xb575[_0x451eaa];return _0x25fdd7;};'use strict';var multer=require('multer');var util=require(_0x5b57('0x0'));var path=require(_0x5b57('0x1'));var timeout=require(_0x5b57('0x2'));var express=require(_0x5b57('0x3'));var router=express[_0x5b57('0x4')]();var fs_extra=require(_0x5b57('0x5'));var auth=require(_0x5b57('0x6'));var interaction=require(_0x5b57('0x7'));var config=require(_0x5b57('0x8'));var controller=require(_0x5b57('0x9'));router[_0x5b57('0xa')]('/',auth[_0x5b57('0xb')](),controller[_0x5b57('0xc')]);module[_0x5b57('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index a797c8b..3cca64b 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 _0xbf0f=['STRING','TEXT','BOOLEAN','exports'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xbf0f,0xb3));var _0xfbf0=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xbf0f[_0x1793de];return _0x4f0309;};'use strict';var Sequelize=require('sequelize');module[_0xfbf0('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xfbf0('0x1')]},'recipientsId':{'type':Sequelize[_0xfbf0('0x2')]},'recipientsDescription':{'type':Sequelize[_0xfbf0('0x1')]},'beep':{'type':Sequelize[_0xfbf0('0x3')]}}; \ No newline at end of file +var _0x7b55=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7b55,0x131));var _0x57b5=function(_0x5db96e,_0x1d15dd){_0x5db96e=_0x5db96e-0x0;var _0x1f7fd7=_0x7b55[_0x5db96e];return _0x1f7fd7;};'use strict';var Sequelize=require(_0x57b5('0x0'));module[_0x57b5('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x57b5('0x2')]},'recipientsId':{'type':Sequelize[_0x57b5('0x3')]},'recipientsDescription':{'type':Sequelize[_0x57b5('0x2')]},'beep':{'type':Sequelize[_0x57b5('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 4a53004..ffcef7e 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 _0x07d0=['replace','Queue','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','mailqueue','voicequeue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','create','forEach','recipient','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','ids','queue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x07d0,0xc2));var _0x007d=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x07d0[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x007d('0x0'));var zipdir=require(_0x007d('0x1'));var jsonpatch=require(_0x007d('0x2'));var rp=require('request-promise');var moment=require(_0x007d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x007d('0x4'));var util=require('util');var path=require(_0x007d('0x5'));var sox=require('sox');var csv=require(_0x007d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x007d('0x7'));var _=require(_0x007d('0x8'));var squel=require(_0x007d('0x9'));var crypto=require('crypto');var jsforce=require(_0x007d('0xa'));var deskjs=require(_0x007d('0xb'));var toCsv=require(_0x007d('0x6'));var querystring=require('querystring');var Papa=require(_0x007d('0xc'));var Redis=require(_0x007d('0xd'));var authService=require(_0x007d('0xe'));var qs=require(_0x007d('0xf'));var as=require(_0x007d('0x10'));var hardwareService=require(_0x007d('0x11'));var logger=require(_0x007d('0x12'))(_0x007d('0x13'));var utils=require(_0x007d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x007d('0x15')]=_[_0x007d('0x16')](config['redis'],{'host':_0x007d('0x17'),'port':0x18eb});var socket=require(_0x007d('0x18'))(new Redis(config[_0x007d('0x15')]));require(_0x007d('0x19'))['register'](socket);function respondWithStatusCode(_0xa5f4e9,_0xc118de){_0xc118de=_0xc118de||0xcc;return function(_0x50fb08){if(_0x50fb08){return _0xa5f4e9[_0x007d('0x1a')](_0xc118de);}return _0xa5f4e9[_0x007d('0x1b')](_0xc118de)[_0x007d('0x1c')]();};}function respondWithResult(_0x55013b,_0x823310){_0x823310=_0x823310||0xc8;return function(_0x519c90){if(_0x519c90){return _0x55013b[_0x007d('0x1b')](_0x823310)['json'](_0x519c90);}};}function respondWithFilteredResult(_0x409637,_0x9120e7){return function(_0x5577d5){if(_0x5577d5){var _0x307e10=typeof _0x9120e7['offset']==='undefined'&&typeof _0x9120e7['limit']==='undefined';var _0x55a154=_0x5577d5[_0x007d('0x1d')];var _0x5d8548=_0x307e10?0x0:_0x9120e7[_0x007d('0x1e')];var _0x5ccf29=_0x307e10?_0x5577d5['count']:_0x9120e7[_0x007d('0x1e')]+_0x9120e7[_0x007d('0x1f')];var _0x63413b;if(_0x5ccf29>=_0x55a154){_0x5ccf29=_0x55a154;_0x63413b=0xc8;}else{_0x63413b=0xce;}_0x409637[_0x007d('0x1b')](_0x63413b);return _0x409637[_0x007d('0x20')](_0x007d('0x21'),_0x5d8548+'-'+_0x5ccf29+'/'+_0x55a154)['json'](_0x5577d5);}return null;};}function patchUpdates(_0x35e692){return function(_0x7264b6){try{jsonpatch[_0x007d('0x22')](_0x7264b6,_0x35e692,!![]);}catch(_0x428edd){return BPromise[_0x007d('0x23')](_0x428edd);}return _0x7264b6[_0x007d('0x24')]();};}function saveUpdates(_0x22b8a7,_0x3007e3){return function(_0x1dcf72){if(_0x1dcf72){return _0x1dcf72[_0x007d('0x25')](_0x22b8a7)[_0x007d('0x26')](function(_0x31fd5b){return _0x31fd5b;});}return null;};}function removeEntity(_0x51017f,_0xad10a0){return function(_0x55cdd0){if(_0x55cdd0){return _0x55cdd0[_0x007d('0x27')]()[_0x007d('0x26')](function(){_0x51017f[_0x007d('0x1b')](0xcc)[_0x007d('0x1c')]();});}};}function handleEntityNotFound(_0x3975f6,_0xbc2172){return function(_0x584f9b){if(!_0x584f9b){_0x3975f6[_0x007d('0x1a')](0x194);}return _0x584f9b;};}function handleError(_0x35d694,_0x41945e){_0x41945e=_0x41945e||0x1f4;return function(_0x738c4a){logger[_0x007d('0x28')](_0x738c4a[_0x007d('0x29')]);if(_0x738c4a[_0x007d('0x2a')]){delete _0x738c4a[_0x007d('0x2a')];}_0x35d694[_0x007d('0x1b')](_0x41945e)[_0x007d('0x2b')](_0x738c4a);};}exports[_0x007d('0x2c')]=function(_0x595625,_0xd98a18,_0x289e84){if(!_0x595625[_0x007d('0x2d')][_0x007d('0x2e')](_0x007d('0x2f'))&&!_0x595625[_0x007d('0x2d')][_0x007d('0x2e')](_0x007d('0x30'))){throw new db[(_0x007d('0x31'))][(_0x007d('0x32'))](_0x007d('0x33'));}else{if(_0x595625['body'][_0x007d('0x2e')](_0x007d('0x30'))&&!_0x595625[_0x007d('0x2d')][_0x007d('0x2e')]('view')){throw new db['Sequelize'][(_0x007d('0x32'))](_0x007d('0x34'));}if(!_0x595625[_0x007d('0x2d')][_0x007d('0x2e')](_0x007d('0x35'))){throw new db[(_0x007d('0x31'))][(_0x007d('0x32'))](_0x007d('0x36'));}else{try{var _0x4d636a=JSON['parse'](_0x595625['body'][_0x007d('0x35')]);}catch(_0x1897fb){logger['error'](_0x1897fb);throw new db[(_0x007d('0x31'))][(_0x007d('0x32'))](_0x007d('0x37'));}var _0xffd97c=['chatqueue','faxqueue',_0x007d('0x38'),'openchannelqueue','smsqueue',_0x007d('0x39'),'whatsappqueue',_0x007d('0x3a'),_0x007d('0x3b')];if(_['some'](_0x4d636a,function(_0x138f4e){return!_[_0x007d('0x3c')](_0xffd97c,_0x138f4e[_0x007d('0x3d')][_0x007d('0x3e')]());})){throw new db['Sequelize'][(_0x007d('0x32'))](_0x007d('0x3f'));}}}var _0x4d55cc={};_0x4d55cc[_0x007d('0x40')]=_0x595625[_0x007d('0x2d')][_0x007d('0x2e')](_0x007d('0x40'))?_0x595625[_0x007d('0x2d')][_0x007d('0x40')]:_0x595625[_0x007d('0x3b')]['fullname'];_0x4d55cc[_0x007d('0x41')]=_[_0x007d('0x42')](_0x595625[_0x007d('0x2d')]['recipientsDescription'])?null:_0x595625[_0x007d('0x2d')][_0x007d('0x41')];_0x4d55cc[_0x007d('0x43')]=_0x595625[_0x007d('0x2d')]['beep']||![];_0x4d55cc[_0x007d('0x44')]=_0x595625[_0x007d('0x3b')]['id'];return getContent(_0x595625[_0x007d('0x2d')])[_0x007d('0x26')](function(_0x61ac5c){_0x4d55cc[_0x007d('0x2d')]=_0x61ac5c;return getRecipients(_0x4d636a);})[_0x007d('0x26')](function(_0x38a6c2){_0x4d55cc[_0x007d('0x45')]=_[_0x007d('0x46')](_0x38a6c2)[_0x007d('0x47')](',');return db['sequelize'][_0x007d('0x48')](function(_0x1338cb){return db['UserNotification'][_0x007d('0x49')](_0x4d55cc,{'raw':!![],'transaction':_0x1338cb})['then'](function(_0x47ee80){var _0xaf03c7={'sender':_0x4d55cc[_0x007d('0x40')],'description':_0x4d55cc[_0x007d('0x41')],'content':_0x4d55cc[_0x007d('0x2d')],'beep':_0x4d55cc[_0x007d('0x43')]};_0x38a6c2[_0x007d('0x4a')](function(_0x5afbb0){_0xaf03c7[_0x007d('0x4b')]=_0x5afbb0;socket['emit'](_0x007d('0x4c'),_0xaf03c7);});return _0x47ee80;});});})[_0x007d('0x26')](respondWithResult(_0xd98a18,0xc9))[_0x007d('0x4d')](handleError(_0xd98a18,null));};function getContent(_0x551edd){return new BPromise(function(_0x3bacc1,_0x5a887a){if(_0x551edd['text']){_0x3bacc1(_0x551edd['text']);return;}return db['Template'][_0x007d('0x4e')]({'attributes':[_0x007d('0x4f')],'where':{'id':_0x551edd[_0x007d('0x30')]},'raw':!![]})['then'](function(_0x5be10c){if(!_0x5be10c)throw new db['Sequelize'][(_0x007d('0x32'))](_0x007d('0x50'));var _0x12c8a7=Mustache[_0x007d('0x51')](_0x5be10c['html'],_0x551edd[_0x007d('0x52')]);_0x3bacc1(_0x12c8a7);})[_0x007d('0x4d')](function(_0x3811b2){_0x5a887a(_0x3811b2);});});}function getRecipients(_0x2951dd){return new BPromise(function(_0x5e7de7,_0x1ab4df){var _0x28e017=[];var _0x582269=[];_0x2951dd[_0x007d('0x4a')](function(_0x805d71){var _0x341b70=_[_0x007d('0x53')](_0x805d71[_0x007d('0x3d')][_0x007d('0x3e')]());if(_0x341b70===_0x007d('0x54')){_0x28e017=_[_0x007d('0x55')](_0x28e017,_0x805d71[_0x007d('0x56')]);}else{if(_[_0x007d('0x3c')](_0x341b70,_0x007d('0x57')))_0x341b70=_0x341b70[_0x007d('0x58')](_0x007d('0x57'),_0x007d('0x59'));_0x805d71['ids'][_0x007d('0x4a')](function(_0x1e21b1){_0x582269['push'](getAgents(_0x341b70,_0x1e21b1));});}});return BPromise[_0x007d('0x5a')](_0x582269)['then'](function(_0x2c355f){_0x28e017=_[_0x007d('0x55')](_0x28e017,_[_0x007d('0x5b')](_0x2c355f));_0x5e7de7(_0x28e017);})['catch'](function(_0x29f35a){_0x1ab4df(_0x29f35a);});});}function getAgents(_0x5b0e5d,_0x44d112){return new BPromise(function(_0x2b2a8e,_0x361512){return db[_0x5b0e5d][_0x007d('0x4e')]({'where':{'id':_0x44d112}})['then'](function(_0x25a237){return _0x25a237[_0x007d('0x5c')]({'attributes':['id'],'raw':!![]})[_0x007d('0x26')](function(_0x5d399d){var _0x2468c2=_[_0x007d('0x5d')](_0x5d399d,'id');_0x2b2a8e(_0x2468c2);});})['catch'](function(_0x38e77b){_0x361512(_0x38e77b);});});} \ No newline at end of file +var _0x4a2a=['offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','end','sendStatus','error','stack','name','hasOwnProperty','text','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','union','ids','replace','queue','push','all','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','status','json'];(function(_0x4f01a9,_0x4a0d3a){var _0x5f5ade=function(_0xbd7ca6){while(--_0xbd7ca6){_0x4f01a9['push'](_0x4f01a9['shift']());}};_0x5f5ade(++_0x4a0d3a);}(_0x4a2a,0x1dd));var _0xa4a2=function(_0x3cb8c9,_0x40cbd6){_0x3cb8c9=_0x3cb8c9-0x0;var _0x50d5af=_0x4a2a[_0x3cb8c9];return _0x50d5af;};'use strict';var emlformat=require(_0xa4a2('0x0'));var rimraf=require(_0xa4a2('0x1'));var zipdir=require(_0xa4a2('0x2'));var jsonpatch=require(_0xa4a2('0x3'));var rp=require(_0xa4a2('0x4'));var moment=require(_0xa4a2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4a2('0x6'));var path=require(_0xa4a2('0x7'));var sox=require(_0xa4a2('0x8'));var csv=require(_0xa4a2('0x9'));var ejs=require(_0xa4a2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4a2('0xb'));var squel=require(_0xa4a2('0xc'));var crypto=require(_0xa4a2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa4a2('0xe'));var toCsv=require(_0xa4a2('0x9'));var querystring=require('querystring');var Papa=require(_0xa4a2('0xf'));var Redis=require(_0xa4a2('0x10'));var authService=require(_0xa4a2('0x11'));var qs=require(_0xa4a2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4a2('0x13'));var logger=require(_0xa4a2('0x14'))(_0xa4a2('0x15'));var utils=require(_0xa4a2('0x16'));var config=require(_0xa4a2('0x17'));var licenseUtil=require(_0xa4a2('0x18'));var db=require(_0xa4a2('0x19'))['db'];config[_0xa4a2('0x1a')]=_[_0xa4a2('0x1b')](config[_0xa4a2('0x1a')],{'host':_0xa4a2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4a2('0x1a')]));require(_0xa4a2('0x1d'))[_0xa4a2('0x1e')](socket);function respondWithStatusCode(_0x33fe8d,_0x46bb67){_0x46bb67=_0x46bb67||0xcc;return function(_0x111566){if(_0x111566){return _0x33fe8d['sendStatus'](_0x46bb67);}return _0x33fe8d['status'](_0x46bb67)['end']();};}function respondWithResult(_0x2f899b,_0x70ea5d){_0x70ea5d=_0x70ea5d||0xc8;return function(_0x359bf3){if(_0x359bf3){return _0x2f899b[_0xa4a2('0x1f')](_0x70ea5d)[_0xa4a2('0x20')](_0x359bf3);}};}function respondWithFilteredResult(_0x49af02,_0x36754b){return function(_0x2aa8a9){if(_0x2aa8a9){var _0x4be9f8=typeof _0x36754b[_0xa4a2('0x21')]==='undefined'&&typeof _0x36754b['limit']===_0xa4a2('0x22');var _0x92f166=_0x2aa8a9[_0xa4a2('0x23')];var _0xa4cee5=_0x4be9f8?0x0:_0x36754b['offset'];var _0x4a5405=_0x4be9f8?_0x2aa8a9[_0xa4a2('0x23')]:_0x36754b[_0xa4a2('0x21')]+_0x36754b[_0xa4a2('0x24')];var _0x577369;if(_0x4a5405>=_0x92f166){_0x4a5405=_0x92f166;_0x577369=0xc8;}else{_0x577369=0xce;}_0x49af02[_0xa4a2('0x1f')](_0x577369);return _0x49af02[_0xa4a2('0x25')](_0xa4a2('0x26'),_0xa4cee5+'-'+_0x4a5405+'/'+_0x92f166)[_0xa4a2('0x20')](_0x2aa8a9);}return null;};}function patchUpdates(_0x19f75d){return function(_0x2ab0cd){try{jsonpatch[_0xa4a2('0x27')](_0x2ab0cd,_0x19f75d,!![]);}catch(_0x339811){return BPromise['reject'](_0x339811);}return _0x2ab0cd['save']();};}function saveUpdates(_0x4ae8db,_0x10175c){return function(_0x3ad342){if(_0x3ad342){return _0x3ad342[_0xa4a2('0x28')](_0x4ae8db)['then'](function(_0x10cafd){return _0x10cafd;});}return null;};}function removeEntity(_0x415a44,_0x1de675){return function(_0x3fb0fe){if(_0x3fb0fe){return _0x3fb0fe[_0xa4a2('0x29')]()[_0xa4a2('0x2a')](function(){_0x415a44[_0xa4a2('0x1f')](0xcc)[_0xa4a2('0x2b')]();});}};}function handleEntityNotFound(_0x28410a,_0xe092d2){return function(_0x214c5f){if(!_0x214c5f){_0x28410a[_0xa4a2('0x2c')](0x194);}return _0x214c5f;};}function handleError(_0x1fec6a,_0x5145c4){_0x5145c4=_0x5145c4||0x1f4;return function(_0xf59ea6){logger[_0xa4a2('0x2d')](_0xf59ea6[_0xa4a2('0x2e')]);if(_0xf59ea6[_0xa4a2('0x2f')]){delete _0xf59ea6[_0xa4a2('0x2f')];}_0x1fec6a['status'](_0x5145c4)['send'](_0xf59ea6);};}exports['sendUserNotification']=function(_0x209bc2,_0xe56fcc,_0x5d3c95){if(!_0x209bc2['body'][_0xa4a2('0x30')](_0xa4a2('0x31'))&&!_0x209bc2[_0xa4a2('0x32')][_0xa4a2('0x30')](_0xa4a2('0x33'))){throw new db['Sequelize'][(_0xa4a2('0x34'))](_0xa4a2('0x35'));}else{if(_0x209bc2[_0xa4a2('0x32')][_0xa4a2('0x30')]('TemplateId')&&!_0x209bc2[_0xa4a2('0x32')][_0xa4a2('0x30')](_0xa4a2('0x36'))){throw new db[(_0xa4a2('0x37'))][(_0xa4a2('0x34'))](_0xa4a2('0x38'));}if(!_0x209bc2[_0xa4a2('0x32')][_0xa4a2('0x30')](_0xa4a2('0x39'))){throw new db[(_0xa4a2('0x37'))]['ValidationError'](_0xa4a2('0x3a'));}else{try{var _0x29314a=JSON[_0xa4a2('0x3b')](_0x209bc2[_0xa4a2('0x32')]['recipients']);}catch(_0x408e49){logger[_0xa4a2('0x2d')](_0x408e49);throw new db['Sequelize'][(_0xa4a2('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x371117=['chatqueue',_0xa4a2('0x3c'),_0xa4a2('0x3d'),_0xa4a2('0x3e'),_0xa4a2('0x3f'),_0xa4a2('0x40'),_0xa4a2('0x41'),'team',_0xa4a2('0x42')];if(_['some'](_0x29314a,function(_0x125d4b){return!_[_0xa4a2('0x43')](_0x371117,_0x125d4b[_0xa4a2('0x44')][_0xa4a2('0x45')]());})){throw new db[(_0xa4a2('0x37'))][(_0xa4a2('0x34'))](_0xa4a2('0x46'));}}}var _0x3ba8c3={};_0x3ba8c3[_0xa4a2('0x47')]=_0x209bc2[_0xa4a2('0x32')]['hasOwnProperty'](_0xa4a2('0x47'))?_0x209bc2[_0xa4a2('0x32')][_0xa4a2('0x47')]:_0x209bc2['user']['fullname'];_0x3ba8c3[_0xa4a2('0x48')]=_[_0xa4a2('0x49')](_0x209bc2[_0xa4a2('0x32')]['recipientsDescription'])?null:_0x209bc2[_0xa4a2('0x32')]['recipientsDescription'];_0x3ba8c3['beep']=_0x209bc2[_0xa4a2('0x32')][_0xa4a2('0x4a')]||![];_0x3ba8c3[_0xa4a2('0x4b')]=_0x209bc2[_0xa4a2('0x42')]['id'];return getContent(_0x209bc2[_0xa4a2('0x32')])[_0xa4a2('0x2a')](function(_0x17289f){_0x3ba8c3[_0xa4a2('0x32')]=_0x17289f;return getRecipients(_0x29314a);})['then'](function(_0x448f07){_0x3ba8c3[_0xa4a2('0x4c')]=_[_0xa4a2('0x4d')](_0x448f07)[_0xa4a2('0x4e')](',');return db[_0xa4a2('0x4f')]['transaction'](function(_0x269be7){return db[_0xa4a2('0x50')][_0xa4a2('0x51')](_0x3ba8c3,{'raw':!![],'transaction':_0x269be7})[_0xa4a2('0x2a')](function(_0x1e1151){var _0xd751f3={'sender':_0x3ba8c3['senderName'],'description':_0x3ba8c3[_0xa4a2('0x48')],'content':_0x3ba8c3[_0xa4a2('0x32')],'beep':_0x3ba8c3['beep']};_0x448f07[_0xa4a2('0x52')](function(_0xdba475){_0xd751f3[_0xa4a2('0x53')]=_0xdba475;socket[_0xa4a2('0x54')](_0xa4a2('0x55'),_0xd751f3);});return _0x1e1151;});});})[_0xa4a2('0x2a')](respondWithResult(_0xe56fcc,0xc9))[_0xa4a2('0x56')](handleError(_0xe56fcc,null));};function getContent(_0x2207bb){return new BPromise(function(_0x5da162,_0x23ad58){if(_0x2207bb[_0xa4a2('0x31')]){_0x5da162(_0x2207bb[_0xa4a2('0x31')]);return;}return db[_0xa4a2('0x57')]['findOne']({'attributes':['html'],'where':{'id':_0x2207bb[_0xa4a2('0x33')]},'raw':!![]})[_0xa4a2('0x2a')](function(_0x43e9e4){if(!_0x43e9e4)throw new db[(_0xa4a2('0x37'))][(_0xa4a2('0x34'))](_0xa4a2('0x58'));var _0x48c695=Mustache[_0xa4a2('0x59')](_0x43e9e4[_0xa4a2('0x5a')],_0x2207bb[_0xa4a2('0x36')]);_0x5da162(_0x48c695);})[_0xa4a2('0x56')](function(_0x569f52){_0x23ad58(_0x569f52);});});}function getRecipients(_0x4c3051){return new BPromise(function(_0x4bd711,_0xe60f56){var _0xef8fe2=[];var _0x549870=[];_0x4c3051['forEach'](function(_0x23d86f){var _0x3c3ae2=_[_0xa4a2('0x5b')](_0x23d86f[_0xa4a2('0x44')]['toLowerCase']());if(_0x3c3ae2==='User'){_0xef8fe2=_[_0xa4a2('0x5c')](_0xef8fe2,_0x23d86f[_0xa4a2('0x5d')]);}else{if(_[_0xa4a2('0x43')](_0x3c3ae2,'queue'))_0x3c3ae2=_0x3c3ae2[_0xa4a2('0x5e')](_0xa4a2('0x5f'),'Queue');_0x23d86f['ids'][_0xa4a2('0x52')](function(_0x5e0f1f){_0x549870[_0xa4a2('0x60')](getAgents(_0x3c3ae2,_0x5e0f1f));});}});return BPromise[_0xa4a2('0x61')](_0x549870)['then'](function(_0x58f20d){_0xef8fe2=_['union'](_0xef8fe2,_[_0xa4a2('0x62')](_0x58f20d));_0x4bd711(_0xef8fe2);})[_0xa4a2('0x56')](function(_0x1cc629){_0xe60f56(_0x1cc629);});});}function getAgents(_0x507518,_0x24c116){return new BPromise(function(_0x5acb2d,_0x9cd625){return db[_0x507518][_0xa4a2('0x63')]({'where':{'id':_0x24c116}})[_0xa4a2('0x2a')](function(_0x2cc16e){return _0x2cc16e[_0xa4a2('0x64')]({'attributes':['id'],'raw':!![]})[_0xa4a2('0x2a')](function(_0x4b3a0f){var _0x530a80=_[_0xa4a2('0x65')](_0x4b3a0f,'id');_0x5acb2d(_0x530a80);});})[_0xa4a2('0x56')](function(_0xac3bbb){_0x9cd625(_0xac3bbb);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ac55738..598860c 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 _0xd2bf=['update','emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x14cd23,_0xb809a3){var _0x4c2e2b=function(_0x426fc4){while(--_0x426fc4){_0x14cd23['push'](_0x14cd23['shift']());}};_0x4c2e2b(++_0xb809a3);}(_0xd2bf,0x1ab));var _0xfd2b=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0xd2bf[_0x4fc421];return _0x8c6d63;};'use strict';var EventEmitter=require(_0xfd2b('0x0'));var UserNotification=require(_0xfd2b('0x1'))['db'][_0xfd2b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfd2b('0x3')](0x0);var events={'afterCreate':_0xfd2b('0x4'),'afterUpdate':_0xfd2b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2cacf4){return function(_0x15675c,_0x4114db,_0x31f0a8){UserNotificationEvents[_0xfd2b('0x6')](_0x2cacf4+':'+_0x15675c['id'],_0x15675c);UserNotificationEvents[_0xfd2b('0x6')](_0x2cacf4,_0x15675c);_0x31f0a8(null);};}for(var e in events){if(events[_0xfd2b('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xfd2b('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xeeab=['events','../../mysqldb','UserNotification','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x379b05,_0x1321f6){var _0x12c2ba=function(_0x4c67af){while(--_0x4c67af){_0x379b05['push'](_0x379b05['shift']());}};_0x12c2ba(++_0x1321f6);}(_0xeeab,0xd2));var _0xbeea=function(_0x55d1b6,_0x36c3a3){_0x55d1b6=_0x55d1b6-0x0;var _0x2db938=_0xeeab[_0x55d1b6];return _0x2db938;};'use strict';var EventEmitter=require(_0xbeea('0x0'));var UserNotification=require(_0xbeea('0x1'))['db'][_0xbeea('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbeea('0x3'),'afterUpdate':_0xbeea('0x4'),'afterDestroy':_0xbeea('0x5')};function emitEvent(_0x217894){return function(_0x379d35,_0x23d1b8,_0x22d952){UserNotificationEvents[_0xbeea('0x6')](_0x217894+':'+_0x379d35['id'],_0x379d35);UserNotificationEvents[_0xbeea('0x6')](_0x217894,_0x379d35);_0x22d952(null);};}for(var e in events){if(events[_0xbeea('0x7')](e)){var event=events[e];UserNotification[_0xbeea('0x8')](e,emitEvent(event));}}module[_0xbeea('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 184387a..fa97b2d 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 _0xd63b=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x18036e,_0x2e8a09){var _0x3d34ca=function(_0x49c0e1){while(--_0x49c0e1){_0x18036e['push'](_0x18036e['shift']());}};_0x3d34ca(++_0x2e8a09);}(_0xd63b,0x16e));var _0xbd63=function(_0x60305c,_0x229fb0){_0x60305c=_0x60305c-0x0;var _0x279236=_0xd63b[_0x60305c];return _0x279236;};'use strict';var _=require('lodash');var util=require(_0xbd63('0x0'));var logger=require(_0xbd63('0x1'))(_0xbd63('0x2'));var moment=require('moment');var BPromise=require(_0xbd63('0x3'));var rp=require(_0xbd63('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd63('0x5'));var config=require(_0xbd63('0x6'));var attributes=require(_0xbd63('0x7'));module[_0xbd63('0x8')]=function(_0x3cc278,_0x279155){return _0x3cc278[_0xbd63('0x9')](_0xbd63('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd63('0xb'),'collate':_0xbd63('0xc')});}; \ No newline at end of file +var _0xe20c=['../../config/logger','moment','bluebird','rimraf','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe20c,0x9f));var _0xce20=function(_0x9a6ad7,_0x348beb){_0x9a6ad7=_0x9a6ad7-0x0;var _0x292b85=_0xe20c[_0x9a6ad7];return _0x292b85;};'use strict';var _=require(_0xce20('0x0'));var util=require('util');var logger=require(_0xce20('0x1'))('api');var moment=require(_0xce20('0x2'));var BPromise=require(_0xce20('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce20('0x4'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x1f828a,_0x5a901c){return _0x1f828a[_0xce20('0x5')](_0xce20('0x6'),attributes,{'tableName':_0xce20('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xce20('0x8'),'collate':_0xce20('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 5731b7c..215ea73 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 _0xeed3=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','info','catch','util','moment','bluebird'];(function(_0x5bd3f2,_0x49f10b){var _0x444bfb=function(_0xae7210){while(--_0xae7210){_0x5bd3f2['push'](_0x5bd3f2['shift']());}};_0x444bfb(++_0x49f10b);}(_0xeed3,0x10b));var _0x3eed=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xeed3[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0x3eed('0x0'));var moment=require(_0x3eed('0x1'));var BPromise=require(_0x3eed('0x2'));var rs=require(_0x3eed('0x3'));var fs=require('fs');var Redis=require(_0x3eed('0x4'));var db=require(_0x3eed('0x5'))['db'];var utils=require(_0x3eed('0x6'));var logger=require('../../config/logger')(_0x3eed('0x7'));var config=require(_0x3eed('0x8'));var jayson=require(_0x3eed('0x9'));var client=jayson[_0x3eed('0xa')][_0x3eed('0xb')]({'port':0x232a});config[_0x3eed('0xc')]=_[_0x3eed('0xd')](config[_0x3eed('0xc')],{'host':_0x3eed('0xe'),'port':0x18eb});var socket=require(_0x3eed('0xf'))(new Redis(config['redis']));require(_0x3eed('0x10'))[_0x3eed('0x11')](socket);function respondWithRpcPromise(_0x2faa65,_0x42fd7c,_0x484c04){return new BPromise(function(_0x5a6644,_0x19a0fd){return client['request'](_0x2faa65,_0x484c04)[_0x3eed('0x12')](function(_0x45df21){logger['info']('UserNotification,\x20%s,\x20%s',_0x42fd7c,_0x3eed('0x13'));logger['debug'](_0x3eed('0x14'),_0x42fd7c,_0x3eed('0x13'),JSON[_0x3eed('0x15')](_0x45df21));if(_0x45df21[_0x3eed('0x16')]){if(_0x45df21[_0x3eed('0x16')]['code']===0x1f4){logger[_0x3eed('0x16')](_0x3eed('0x17'),_0x42fd7c,_0x45df21[_0x3eed('0x16')]['message']);return _0x19a0fd(_0x45df21[_0x3eed('0x16')][_0x3eed('0x18')]);}logger['error'](_0x3eed('0x17'),_0x42fd7c,_0x45df21[_0x3eed('0x16')][_0x3eed('0x18')]);return _0x5a6644(_0x45df21[_0x3eed('0x16')][_0x3eed('0x18')]);}else{logger[_0x3eed('0x19')]('UserNotification,\x20%s,\x20%s',_0x42fd7c,'request\x20sent');_0x5a6644(_0x45df21['result'][_0x3eed('0x18')]);}})[_0x3eed('0x1a')](function(_0xa7a0e){logger[_0x3eed('0x16')]('UserNotification,\x20%s,\x20%s',_0x42fd7c,_0xa7a0e);_0x19a0fd(_0xa7a0e);});});} \ No newline at end of file +var _0xf0dd=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userNotification.socket','register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4e43e6,_0x3c8d39){var _0x56bb49=function(_0x5c83fe){while(--_0x5c83fe){_0x4e43e6['push'](_0x4e43e6['shift']());}};_0x56bb49(++_0x3c8d39);}(_0xf0dd,0x191));var _0xdf0d=function(_0x36549f,_0x5c74f9){_0x36549f=_0x36549f-0x0;var _0x174066=_0xf0dd[_0x36549f];return _0x174066;};'use strict';var _=require(_0xdf0d('0x0'));var util=require('util');var moment=require(_0xdf0d('0x1'));var BPromise=require(_0xdf0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf0d('0x3'));var db=require(_0xdf0d('0x4'))['db'];var utils=require(_0xdf0d('0x5'));var logger=require(_0xdf0d('0x6'))(_0xdf0d('0x7'));var config=require(_0xdf0d('0x8'));var jayson=require(_0xdf0d('0x9'));var client=jayson[_0xdf0d('0xa')]['http']({'port':0x232a});config[_0xdf0d('0xb')]=_[_0xdf0d('0xc')](config['redis'],{'host':_0xdf0d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdf0d('0xe'))[_0xdf0d('0xf')](socket);function respondWithRpcPromise(_0x322ea7,_0x293f18,_0x3c4633){return new BPromise(function(_0x180bbe,_0x88812e){return client['request'](_0x322ea7,_0x3c4633)[_0xdf0d('0x10')](function(_0x494e60){logger['info'](_0xdf0d('0x11'),_0x293f18,_0xdf0d('0x12'));logger[_0xdf0d('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x293f18,_0xdf0d('0x12'),JSON[_0xdf0d('0x14')](_0x494e60));if(_0x494e60[_0xdf0d('0x15')]){if(_0x494e60[_0xdf0d('0x15')][_0xdf0d('0x16')]===0x1f4){logger[_0xdf0d('0x15')]('UserNotification,\x20%s,\x20%s',_0x293f18,_0x494e60[_0xdf0d('0x15')][_0xdf0d('0x17')]);return _0x88812e(_0x494e60[_0xdf0d('0x15')][_0xdf0d('0x17')]);}logger[_0xdf0d('0x15')](_0xdf0d('0x11'),_0x293f18,_0x494e60['error']['message']);return _0x180bbe(_0x494e60[_0xdf0d('0x15')]['message']);}else{logger['info'](_0xdf0d('0x11'),_0x293f18,_0xdf0d('0x12'));_0x180bbe(_0x494e60['result'][_0xdf0d('0x17')]);}})[_0xdf0d('0x18')](function(_0x3d3080){logger[_0xdf0d('0x15')](_0xdf0d('0x11'),_0x293f18,_0x3d3080);_0x88812e(_0x3d3080);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5b8c17a..58fcac1 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 _0x3b76=['userNotification:','save','remove','update','emit','removeListener','length'];(function(_0x550076,_0x34621a){var _0x272be2=function(_0x5960b8){while(--_0x5960b8){_0x550076['push'](_0x550076['shift']());}};_0x272be2(++_0x34621a);}(_0x3b76,0x1ba));var _0x63b7=function(_0x369029,_0x2e6099){_0x369029=_0x369029-0x0;var _0x578b63=_0x3b76[_0x369029];return _0x578b63;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x63b7('0x0'),_0x63b7('0x1'),_0x63b7('0x2')];function createListener(_0x1de2a2,_0x5c932c){return function(_0x240897){_0x5c932c[_0x63b7('0x3')](_0x1de2a2,_0x240897);};}function removeListener(_0xd28854,_0x3051ec){return function(){UserNotificationEvents[_0x63b7('0x4')](_0xd28854,_0x3051ec);};}exports['register']=function(_0x590c71){for(var _0x1f9a3a=0x0,_0x290199=events[_0x63b7('0x5')];_0x1f9a3a<_0x290199;_0x1f9a3a++){var _0x11648a=events[_0x1f9a3a];var _0x1ca689=createListener(_0x63b7('0x6')+_0x11648a,_0x590c71);UserNotificationEvents['on'](_0x11648a,_0x1ca689);}}; \ No newline at end of file +var _0xcf98=['save','emit','register','length','userNotification:','./userNotification.events'];(function(_0x480e5b,_0xe19028){var _0x30e10d=function(_0x2015e9){while(--_0x2015e9){_0x480e5b['push'](_0x480e5b['shift']());}};_0x30e10d(++_0xe19028);}(_0xcf98,0xa1));var _0x8cf9=function(_0x5934c5,_0xee08dd){_0x5934c5=_0x5934c5-0x0;var _0x272822=_0xcf98[_0x5934c5];return _0x272822;};'use strict';var UserNotificationEvents=require(_0x8cf9('0x0'));var events=[_0x8cf9('0x1'),'remove','update'];function createListener(_0x5c3d83,_0x121412){return function(_0x4e97c7){_0x121412[_0x8cf9('0x2')](_0x5c3d83,_0x4e97c7);};}function removeListener(_0x5aedc6,_0x424327){return function(){UserNotificationEvents['removeListener'](_0x5aedc6,_0x424327);};}exports[_0x8cf9('0x3')]=function(_0x1ce1a2){for(var _0x42e80f=0x0,_0x25bd5f=events[_0x8cf9('0x4')];_0x42e80f<_0x25bd5f;_0x42e80f++){var _0x509674=events[_0x42e80f];var _0x3736da=createListener(_0x8cf9('0x5')+_0x509674,_0x1ce1a2);UserNotificationEvents['on'](_0x509674,_0x3736da);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 124328b..ca11bb9 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2ce6ce,_0xa34095){var _0x1b445e=function(_0x52abaa){while(--_0x52abaa){_0x2ce6ce['push'](_0x2ce6ce['shift']());}};_0x1b445e(++_0xa34095);}(_0x70e0,0x17b));var _0x070e=function(_0xb48b3e,_0x6ec756){_0xb48b3e=_0xb48b3e-0x0;var _0x469829=_0x70e0[_0xb48b3e];return _0x469829;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3639ee,_0x4b29b6){var _0x307852=function(_0x44394b){while(--_0x44394b){_0x3639ee['push'](_0x3639ee['shift']());}};_0x307852(++_0x4b29b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 3af98de..4ed497f 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 _0xa644=['exports','INTEGER','sequelize'];(function(_0x44b434,_0x87eeb5){var _0x414d34=function(_0x2a60a6){while(--_0x2a60a6){_0x44b434['push'](_0x44b434['shift']());}};_0x414d34(++_0x87eeb5);}(_0xa644,0x15b));var _0x4a64=function(_0x1eddb1,_0x1b8ae0){_0x1eddb1=_0x1eddb1-0x0;var _0x4423fb=_0xa644[_0x1eddb1];return _0x4423fb;};'use strict';var Sequelize=require(_0x4a64('0x0'));module[_0x4a64('0x1')]={'penalty':{'type':Sequelize[_0x4a64('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xec13=['exports','INTEGER','sequelize'];(function(_0xb176d8,_0x17c90e){var _0x3a2490=function(_0x24092c){while(--_0x24092c){_0xb176d8['push'](_0xb176d8['shift']());}};_0x3a2490(++_0x17c90e);}(_0xec13,0x8f));var _0x3ec1=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xec13[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x3ec1('0x0'));module[_0x3ec1('0x1')]={'penalty':{'type':Sequelize[_0x3ec1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index b05b4db..51ab9b9 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 _0x49c1=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util'];(function(_0x59cbab,_0x5a20b7){var _0x28d627=function(_0x43e29c){while(--_0x43e29c){_0x59cbab['push'](_0x59cbab['shift']());}};_0x28d627(++_0x5a20b7);}(_0x49c1,0x185));var _0x149c=function(_0x4ec0d4,_0x3dce90){_0x4ec0d4=_0x4ec0d4-0x0;var _0x39583e=_0x49c1[_0x4ec0d4];return _0x39583e;};'use strict';var _=require('lodash');var util=require(_0x149c('0x0'));var logger=require(_0x149c('0x1'))(_0x149c('0x2'));var moment=require('moment');var BPromise=require(_0x149c('0x3'));var rp=require(_0x149c('0x4'));var fs=require('fs');var path=require(_0x149c('0x5'));var rimraf=require(_0x149c('0x6'));var config=require(_0x149c('0x7'));var attributes=require(_0x149c('0x8'));module[_0x149c('0x9')]=function(_0x3703d7,_0x10d1e0){return _0x3703d7[_0x149c('0xa')](_0x149c('0xb'),attributes,{'tableName':_0x149c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7866=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x7866,0xce));var _0x6786=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7866[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x6786('0x0'));var util=require(_0x6786('0x1'));var logger=require(_0x6786('0x2'))(_0x6786('0x3'));var moment=require('moment');var BPromise=require(_0x6786('0x4'));var rp=require(_0x6786('0x5'));var fs=require('fs');var path=require(_0x6786('0x6'));var rimraf=require(_0x6786('0x7'));var config=require('../../config/environment');var attributes=require(_0x6786('0x8'));module['exports']=function(_0x4ab14c,_0x1488af){return _0x4ab14c[_0x6786('0x9')](_0x6786('0xa'),attributes,{'tableName':_0x6786('0xb'),'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 2f26601..567d11b 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 _0x5ca7=['code','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x522970,_0x3bc5b7){var _0x113e6e=function(_0x3f5ce1){while(--_0x3f5ce1){_0x522970['push'](_0x522970['shift']());}};_0x113e6e(++_0x3bc5b7);}(_0x5ca7,0x153));var _0x75ca=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x5ca7[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x75ca('0x0'));var util=require(_0x75ca('0x1'));var moment=require(_0x75ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75ca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x75ca('0x4'));var logger=require(_0x75ca('0x5'))(_0x75ca('0x6'));var config=require(_0x75ca('0x7'));var jayson=require(_0x75ca('0x8'));var client=jayson[_0x75ca('0x9')][_0x75ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a4285,_0x460760,_0x556052){return new BPromise(function(_0x2c1d1e,_0x58adac){return client[_0x75ca('0xb')](_0x1a4285,_0x556052)[_0x75ca('0xc')](function(_0x50a813){logger[_0x75ca('0xd')](_0x75ca('0xe'),_0x460760,_0x75ca('0xf'));logger[_0x75ca('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x460760,'request\x20sent',JSON['stringify'](_0x50a813));if(_0x50a813[_0x75ca('0x11')]){if(_0x50a813['error'][_0x75ca('0x12')]===0x1f4){logger['error'](_0x75ca('0xe'),_0x460760,_0x50a813[_0x75ca('0x11')][_0x75ca('0x13')]);return _0x58adac(_0x50a813[_0x75ca('0x11')][_0x75ca('0x13')]);}logger['error'](_0x75ca('0xe'),_0x460760,_0x50a813[_0x75ca('0x11')][_0x75ca('0x13')]);return _0x2c1d1e(_0x50a813[_0x75ca('0x11')]['message']);}else{logger[_0x75ca('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x460760,_0x75ca('0xf'));_0x2c1d1e(_0x50a813[_0x75ca('0x14')]['message']);}})['catch'](function(_0x1d2e09){logger[_0x75ca('0x11')](_0x75ca('0xe'),_0x460760,_0x1d2e09);_0x58adac(_0x1d2e09);});});} \ No newline at end of file +var _0xcb11=['jayson/promise','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x2c47e7,_0x2f5fa){var _0x22e591=function(_0x253d5b){while(--_0x253d5b){_0x2c47e7['push'](_0x2c47e7['shift']());}};_0x22e591(++_0x2f5fa);}(_0xcb11,0x161));var _0x1cb1=function(_0x18ecae,_0x2bf366){_0x18ecae=_0x18ecae-0x0;var _0x2fe95b=_0xcb11[_0x18ecae];return _0x2fe95b;};'use strict';var _=require(_0x1cb1('0x0'));var util=require(_0x1cb1('0x1'));var moment=require(_0x1cb1('0x2'));var BPromise=require(_0x1cb1('0x3'));var rs=require(_0x1cb1('0x4'));var fs=require('fs');var Redis=require(_0x1cb1('0x5'));var db=require(_0x1cb1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1cb1('0x7'));var jayson=require(_0x1cb1('0x8'));var client=jayson[_0x1cb1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d386,_0x46f0d5,_0xf2f79b){return new BPromise(function(_0x49abe0,_0x42b7a5){return client['request'](_0x10d386,_0xf2f79b)[_0x1cb1('0xa')](function(_0x54a86f){logger[_0x1cb1('0xb')](_0x1cb1('0xc'),_0x46f0d5,'request\x20sent');logger[_0x1cb1('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x46f0d5,_0x1cb1('0xe'),JSON['stringify'](_0x54a86f));if(_0x54a86f[_0x1cb1('0xf')]){if(_0x54a86f[_0x1cb1('0xf')][_0x1cb1('0x10')]===0x1f4){logger[_0x1cb1('0xf')](_0x1cb1('0xc'),_0x46f0d5,_0x54a86f['error'][_0x1cb1('0x11')]);return _0x42b7a5(_0x54a86f['error'][_0x1cb1('0x11')]);}logger['error'](_0x1cb1('0xc'),_0x46f0d5,_0x54a86f[_0x1cb1('0xf')][_0x1cb1('0x11')]);return _0x49abe0(_0x54a86f[_0x1cb1('0xf')][_0x1cb1('0x11')]);}else{logger[_0x1cb1('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x46f0d5,_0x1cb1('0xe'));_0x49abe0(_0x54a86f['result']['message']);}})[_0x1cb1('0x12')](function(_0x1cef0b){logger[_0x1cb1('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x46f0d5,_0x1cef0b);_0x42b7a5(_0x1cef0b);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ab779df..0bcf320 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 _0x300d=['create','/:id/clone','clone','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x300d,0x1ca));var _0xd300=function(_0x2289d9,_0x3d3181){_0x2289d9=_0x2289d9-0x0;var _0x26ebab=_0x300d[_0x2289d9];return _0x26ebab;};'use strict';var multer=require(_0xd300('0x0'));var util=require(_0xd300('0x1'));var path=require(_0xd300('0x2'));var timeout=require(_0xd300('0x3'));var express=require(_0xd300('0x4'));var router=express[_0xd300('0x5')]();var fs_extra=require(_0xd300('0x6'));var auth=require(_0xd300('0x7'));var interaction=require(_0xd300('0x8'));var config=require(_0xd300('0x9'));var controller=require(_0xd300('0xa'));router['get']('/',auth[_0xd300('0xb')](),controller[_0xd300('0xc')]);router[_0xd300('0xd')](_0xd300('0xe'),auth[_0xd300('0xb')](),controller[_0xd300('0xf')]);router[_0xd300('0xd')](_0xd300('0x10'),auth[_0xd300('0xb')](),controller[_0xd300('0x11')]);router[_0xd300('0xd')]('/:id/sections',auth[_0xd300('0xb')](),controller[_0xd300('0x12')]);router[_0xd300('0xd')](_0xd300('0x13'),auth['isAuthenticated'](),controller[_0xd300('0x14')]);router[_0xd300('0x15')]('/',auth[_0xd300('0xb')](),controller[_0xd300('0x16')]);router['post'](_0xd300('0x17'),auth[_0xd300('0xb')](),controller[_0xd300('0x18')]);router[_0xd300('0x15')]('/:id/sections',auth[_0xd300('0xb')](),controller['addSections']);router[_0xd300('0x15')]('/:id/resources',auth[_0xd300('0xb')](),controller[_0xd300('0x19')]);router['put'](_0xd300('0x10'),auth[_0xd300('0xb')](),controller[_0xd300('0x1a')]);router[_0xd300('0x1b')]('/:id',auth[_0xd300('0xb')](),controller[_0xd300('0x1c')]);router[_0xd300('0x1b')]('/:id/sections',auth[_0xd300('0xb')](),controller[_0xd300('0x1d')]);router[_0xd300('0x1b')](_0xd300('0x13'),auth[_0xd300('0xb')](),controller[_0xd300('0x1e')]);module[_0xd300('0x1f')]=router; \ No newline at end of file +var _0x2e5d=['destroy','delete','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe','/:id','show','getSections','/:id/resources','getResources','post','create','/:id/sections','addSections','addResources','put','update'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2e5d,0xb8));var _0xd2e5=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0x2e5d[_0x2feb53];return _0x5700ee;};'use strict';var multer=require(_0xd2e5('0x0'));var util=require(_0xd2e5('0x1'));var path=require(_0xd2e5('0x2'));var timeout=require(_0xd2e5('0x3'));var express=require(_0xd2e5('0x4'));var router=express[_0xd2e5('0x5')]();var fs_extra=require(_0xd2e5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd2e5('0x7'));var config=require(_0xd2e5('0x8'));var controller=require(_0xd2e5('0x9'));router[_0xd2e5('0xa')]('/',auth['isAuthenticated'](),controller[_0xd2e5('0xb')]);router[_0xd2e5('0xa')]('/describe',auth[_0xd2e5('0xc')](),controller[_0xd2e5('0xd')]);router[_0xd2e5('0xa')](_0xd2e5('0xe'),auth[_0xd2e5('0xc')](),controller[_0xd2e5('0xf')]);router[_0xd2e5('0xa')]('/:id/sections',auth['isAuthenticated'](),controller[_0xd2e5('0x10')]);router['get'](_0xd2e5('0x11'),auth[_0xd2e5('0xc')](),controller[_0xd2e5('0x12')]);router[_0xd2e5('0x13')]('/',auth[_0xd2e5('0xc')](),controller[_0xd2e5('0x14')]);router[_0xd2e5('0x13')]('/:id/clone',auth[_0xd2e5('0xc')](),controller['clone']);router[_0xd2e5('0x13')](_0xd2e5('0x15'),auth[_0xd2e5('0xc')](),controller[_0xd2e5('0x16')]);router[_0xd2e5('0x13')](_0xd2e5('0x11'),auth[_0xd2e5('0xc')](),controller[_0xd2e5('0x17')]);router[_0xd2e5('0x18')](_0xd2e5('0xe'),auth[_0xd2e5('0xc')](),controller[_0xd2e5('0x19')]);router['delete'](_0xd2e5('0xe'),auth[_0xd2e5('0xc')](),controller[_0xd2e5('0x1a')]);router[_0xd2e5('0x1b')](_0xd2e5('0x15'),auth[_0xd2e5('0xc')](),controller[_0xd2e5('0x1c')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module[_0xd2e5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5eee139..906337e 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 _0xc888=['STRING','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x526c9a,_0x571d87){var _0x22f2eb=function(_0x1c9e9e){while(--_0x1c9e9e){_0x526c9a['push'](_0x526c9a['shift']());}};_0x22f2eb(++_0x571d87);}(_0xc888,0xcc));var _0x8c88=function(_0x20bedd,_0x39694b){_0x20bedd=_0x20bedd-0x0;var _0x3041f3=_0xc888[_0x20bedd];return _0x3041f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8c88('0x0')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x8c88('0x0')],'set':function(_0x10cbad){this['setDataValue'](_0x8c88('0x1'),_0x10cbad?_0x10cbad[_0x8c88('0x2')](''):[]);},'get':function(){return this[_0x8c88('0x3')](_0x8c88('0x1'))?this[_0x8c88('0x3')]('crudPermissions')[_0x8c88('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8c88('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8c88('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8c88('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8c88('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8c88('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8c88('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8c88('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8c88('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0652=['crudPermissions','BOOLEAN','sequelize','exports','STRING','name','setDataValue','getDataValue'];(function(_0x6e7f17,_0x185a7d){var _0x36ba9a=function(_0x2f8535){while(--_0x2f8535){_0x6e7f17['push'](_0x6e7f17['shift']());}};_0x36ba9a(++_0x185a7d);}(_0x0652,0x192));var _0x2065=function(_0x520dd3,_0x18e30a){_0x520dd3=_0x520dd3-0x0;var _0x4efad1=_0x0652[_0x520dd3];return _0x4efad1;};'use strict';var Sequelize=require(_0x2065('0x0'));module[_0x2065('0x1')]={'name':{'type':Sequelize[_0x2065('0x2')],'allowNull':![],'unique':_0x2065('0x3')},'crudPermissions':{'type':Sequelize[_0x2065('0x2')],'set':function(_0x5a7d04){this[_0x2065('0x4')]('crudPermissions',_0x5a7d04?_0x5a7d04['join'](''):[]);},'get':function(){return this[_0x2065('0x5')](_0x2065('0x6'))?this[_0x2065('0x5')](_0x2065('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2065('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2065('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2065('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2065('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2065('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2065('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2065('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2065('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2065('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 4f62024..c3237b6 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 _0xebba=['stack','name','index','map','UserProfile','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','sequelize','push','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','ids','getResources','Missing\x20section\x20parameter','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy'];(function(_0x5bc9c0,_0x516f88){var _0x31b3dd=function(_0x2ab758){while(--_0x2ab758){_0x5bc9c0['push'](_0x5bc9c0['shift']());}};_0x31b3dd(++_0x516f88);}(_0xebba,0xb3));var _0xaebb=function(_0x38a3c7,_0x5122d0){_0x38a3c7=_0x38a3c7-0x0;var _0x5db9a1=_0xebba[_0x38a3c7];return _0x5db9a1;};'use strict';var emlformat=require(_0xaebb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaebb('0x1'));var rp=require('request-promise');var moment=require(_0xaebb('0x2'));var BPromise=require(_0xaebb('0x3'));var Mustache=require(_0xaebb('0x4'));var util=require(_0xaebb('0x5'));var path=require(_0xaebb('0x6'));var sox=require(_0xaebb('0x7'));var csv=require('to-csv');var ejs=require(_0xaebb('0x8'));var fs=require('fs');var fs_extra=require(_0xaebb('0x9'));var _=require(_0xaebb('0xa'));var squel=require(_0xaebb('0xb'));var crypto=require(_0xaebb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaebb('0xd'));var toCsv=require(_0xaebb('0xe'));var querystring=require(_0xaebb('0xf'));var Papa=require(_0xaebb('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaebb('0x11'));var hardwareService=require(_0xaebb('0x12'));var logger=require('../../config/logger')(_0xaebb('0x13'));var utils=require(_0xaebb('0x14'));var config=require(_0xaebb('0x15'));var licenseUtil=require(_0xaebb('0x16'));var db=require(_0xaebb('0x17'))['db'];config[_0xaebb('0x18')]=_[_0xaebb('0x19')](config['redis'],{'host':_0xaebb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaebb('0x1b'))[_0xaebb('0x1c')](socket);function respondWithStatusCode(_0x493378,_0x886980){_0x886980=_0x886980||0xcc;return function(_0x3e6d88){if(_0x3e6d88){return _0x493378[_0xaebb('0x1d')](_0x886980);}return _0x493378[_0xaebb('0x1e')](_0x886980)['end']();};}function respondWithResult(_0x4f7883,_0x9c0bb4){_0x9c0bb4=_0x9c0bb4||0xc8;return function(_0x36ec84){if(_0x36ec84){return _0x4f7883[_0xaebb('0x1e')](_0x9c0bb4)[_0xaebb('0x1f')](_0x36ec84);}};}function respondWithFilteredResult(_0x25151f,_0xe6a893){return function(_0x393930){if(_0x393930){var _0x35864e=typeof _0xe6a893['offset']==='undefined'&&typeof _0xe6a893[_0xaebb('0x20')]===_0xaebb('0x21');var _0x25dea8=_0x393930[_0xaebb('0x22')];var _0x331833=_0x35864e?0x0:_0xe6a893[_0xaebb('0x23')];var _0x2ac8cc=_0x35864e?_0x393930[_0xaebb('0x22')]:_0xe6a893['offset']+_0xe6a893[_0xaebb('0x20')];var _0x2e73e1;if(_0x2ac8cc>=_0x25dea8){_0x2ac8cc=_0x25dea8;_0x2e73e1=0xc8;}else{_0x2e73e1=0xce;}_0x25151f['status'](_0x2e73e1);return _0x25151f[_0xaebb('0x24')](_0xaebb('0x25'),_0x331833+'-'+_0x2ac8cc+'/'+_0x25dea8)[_0xaebb('0x1f')](_0x393930);}return null;};}function patchUpdates(_0xe06fcc){return function(_0x78023b){try{jsonpatch['apply'](_0x78023b,_0xe06fcc,!![]);}catch(_0x571795){return BPromise[_0xaebb('0x26')](_0x571795);}return _0x78023b[_0xaebb('0x27')]();};}function saveUpdates(_0x3201ee,_0x5374bd){return function(_0x4dafd7){if(_0x4dafd7){return _0x4dafd7[_0xaebb('0x28')](_0x3201ee)[_0xaebb('0x29')](function(_0xe1ef50){return _0xe1ef50;});}return null;};}function removeEntity(_0x566cd3,_0x56cb6f){return function(_0x551195){if(_0x551195){return _0x551195[_0xaebb('0x2a')]()[_0xaebb('0x29')](function(){_0x566cd3[_0xaebb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3975b3,_0x488655){return function(_0x3dd005){if(!_0x3dd005){_0x3975b3[_0xaebb('0x1d')](0x194);}return _0x3dd005;};}function handleError(_0x547030,_0x3f3ec9){_0x3f3ec9=_0x3f3ec9||0x1f4;return function(_0x12c493){logger['error'](_0x12c493[_0xaebb('0x2b')]);if(_0x12c493[_0xaebb('0x2c')]){delete _0x12c493[_0xaebb('0x2c')];}_0x547030[_0xaebb('0x1e')](_0x3f3ec9)['send'](_0x12c493);};}exports[_0xaebb('0x2d')]=function(_0x4f9a22,_0x40872c){var _0x210939={},_0x475fd8={},_0x3c7905={'count':0x0,'rows':[]};var _0x2a93a7=_[_0xaebb('0x2e')](db[_0xaebb('0x2f')][_0xaebb('0x30')],function(_0x51fbb7){return{'name':_0x51fbb7[_0xaebb('0x31')],'type':_0x51fbb7['type'][_0xaebb('0x32')]};});_0x475fd8['model']=_[_0xaebb('0x2e')](_0x2a93a7,_0xaebb('0x2c'));_0x475fd8[_0xaebb('0x33')]=_[_0xaebb('0x34')](_0x4f9a22[_0xaebb('0x33')]);_0x475fd8[_0xaebb('0x35')]=_['intersection'](_0x475fd8[_0xaebb('0x36')],_0x475fd8[_0xaebb('0x33')]);_0x210939[_0xaebb('0x37')]=_[_0xaebb('0x38')](_0x475fd8[_0xaebb('0x36')],qs[_0xaebb('0x39')](_0x4f9a22[_0xaebb('0x33')]['fields']));_0x210939[_0xaebb('0x37')]=_0x210939[_0xaebb('0x37')][_0xaebb('0x3a')]?_0x210939[_0xaebb('0x37')]:_0x475fd8['model'];if(!_0x4f9a22[_0xaebb('0x33')][_0xaebb('0x3b')](_0xaebb('0x3c'))){_0x210939[_0xaebb('0x20')]=qs[_0xaebb('0x20')](_0x4f9a22[_0xaebb('0x33')][_0xaebb('0x20')]);_0x210939[_0xaebb('0x23')]=qs[_0xaebb('0x23')](_0x4f9a22[_0xaebb('0x33')][_0xaebb('0x23')]);}_0x210939['order']=qs[_0xaebb('0x3d')](_0x4f9a22['query'][_0xaebb('0x3d')]);_0x210939[_0xaebb('0x3e')]=qs['filters'](_[_0xaebb('0x3f')](_0x4f9a22[_0xaebb('0x33')],_0x475fd8[_0xaebb('0x35')]),_0x2a93a7);if(_0x4f9a22[_0xaebb('0x33')][_0xaebb('0x40')]){_0x210939[_0xaebb('0x3e')]=_[_0xaebb('0x41')](_0x210939[_0xaebb('0x3e')],{'$or':_[_0xaebb('0x2e')](_0x2a93a7,function(_0x53f17f){if(_0x53f17f['type']!==_0xaebb('0x42')){var _0x58891e={};_0x58891e[_0x53f17f[_0xaebb('0x2c')]]={'$like':'%'+_0x4f9a22[_0xaebb('0x33')][_0xaebb('0x40')]+'%'};return _0x58891e;}})});}_0x210939=_[_0xaebb('0x41')]({},_0x210939,_0x4f9a22['options']);var _0x492107={'where':_0x210939[_0xaebb('0x3e')]};return db[_0xaebb('0x2f')][_0xaebb('0x22')](_0x492107)['then'](function(_0xc96123){_0x3c7905[_0xaebb('0x22')]=_0xc96123;if(_0x4f9a22['query'][_0xaebb('0x43')]){_0x210939[_0xaebb('0x44')]=[{'all':!![]}];}return db[_0xaebb('0x2f')][_0xaebb('0x45')](_0x210939);})[_0xaebb('0x29')](function(_0x5d38ac){_0x3c7905[_0xaebb('0x46')]=_0x5d38ac;return _0x3c7905;})['then'](respondWithFilteredResult(_0x40872c,_0x210939))['catch'](handleError(_0x40872c,null));};exports[_0xaebb('0x47')]=function(_0x398d2c,_0xee4245){var _0x1edb3f={'raw':![],'where':{'id':_0x398d2c[_0xaebb('0x48')]['id']}},_0x1af5ba={};_0x1af5ba[_0xaebb('0x36')]=_[_0xaebb('0x34')](db['UserProfile'][_0xaebb('0x30')]);_0x1af5ba[_0xaebb('0x33')]=_[_0xaebb('0x34')](_0x398d2c[_0xaebb('0x33')]);_0x1af5ba[_0xaebb('0x35')]=_[_0xaebb('0x38')](_0x1af5ba['model'],_0x1af5ba[_0xaebb('0x33')]);_0x1edb3f[_0xaebb('0x37')]=_[_0xaebb('0x38')](_0x1af5ba[_0xaebb('0x36')],qs['fields'](_0x398d2c[_0xaebb('0x33')]['fields']));_0x1edb3f['attributes']=_0x1edb3f[_0xaebb('0x37')]['length']?_0x1edb3f[_0xaebb('0x37')]:_0x1af5ba[_0xaebb('0x36')];if(_0x398d2c[_0xaebb('0x33')][_0xaebb('0x43')]){_0x1edb3f[_0xaebb('0x44')]=[{'all':!![]}];}_0x1edb3f=_[_0xaebb('0x41')]({},_0x1edb3f,_0x398d2c[_0xaebb('0x49')]);return db[_0xaebb('0x2f')][_0xaebb('0x4a')](_0x1edb3f)[_0xaebb('0x29')](handleEntityNotFound(_0xee4245,null))[_0xaebb('0x29')](respondWithResult(_0xee4245,null))[_0xaebb('0x4b')](handleError(_0xee4245,null));};exports['create']=function(_0x10e1b2,_0x5c2ce2){return db[_0xaebb('0x2f')][_0xaebb('0x4c')](_0x10e1b2[_0xaebb('0x4d')],{})[_0xaebb('0x29')](respondWithResult(_0x5c2ce2,0xc9))['catch'](handleError(_0x5c2ce2,null));};exports[_0xaebb('0x4e')]=function(_0x4bb37e,_0x4d6d71){var _0x5a0cc4={'where':{'id':_0x4bb37e[_0xaebb('0x48')]['id']}},_0x4f6f2d={};_0x4f6f2d['model']=_['keys'](db[_0xaebb('0x2f')][_0xaebb('0x30')]);_0x5a0cc4[_0xaebb('0x37')]=_[_0xaebb('0x38')](_0x4f6f2d[_0xaebb('0x36')],qs[_0xaebb('0x39')](_0x4bb37e[_0xaebb('0x33')][_0xaebb('0x39')]));_0x5a0cc4[_0xaebb('0x37')]=_0x5a0cc4[_0xaebb('0x37')][_0xaebb('0x3a')]?_0x5a0cc4[_0xaebb('0x37')]:_0x4f6f2d[_0xaebb('0x36')];if(_0x4bb37e['query'][_0xaebb('0x43')]){_0x5a0cc4['include']=[{'all':!![]}];}_0x5a0cc4=_[_0xaebb('0x41')]({},_0x5a0cc4,_0x4bb37e[_0xaebb('0x49')]);return db['UserProfile'][_0xaebb('0x4a')](_0x5a0cc4)[_0xaebb('0x29')](handleEntityNotFound(_0x4d6d71,null))[_0xaebb('0x29')](function(_0x16089f){if(_0x16089f){var _0x565d7d=_0x16089f[_0xaebb('0x4f')]({'plain':!![]});_0x565d7d=qs[_0xaebb('0x50')](_0x565d7d,['id',_0xaebb('0x51'),_0xaebb('0x52'),_0xaebb('0x53')]);_0x4bb37e['body']=_[_0xaebb('0x50')](_0x4bb37e['body'],['id',_0xaebb('0x51'),'updatedAt']);return db['sequelize'][_0xaebb('0x54')](function(_0x2ddcb0){return db[_0xaebb('0x2f')]['create'](_[_0xaebb('0x41')](_0x565d7d,_0x4bb37e[_0xaebb('0x4d')]),{'include':_0x4bb37e['query'][_0xaebb('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x2ddcb0})[_0xaebb('0x29')](function(_0x5b48f6){var _0x4e89b8=_0x5b48f6['get']({'plain':!![]});return db['UserProfileSection'][_0xaebb('0x45')]({'where':{'userProfileId':_0x4bb37e[_0xaebb('0x48')]['id']},'raw':!![]})[_0xaebb('0x29')](function(_0x5d3874){if(_0x5d3874){return BPromise[_0xaebb('0x55')](_0x5d3874,function(_0x1fdbd4){return new BPromise(function(_0x5558b9,_0x21d88d){if(_0x1fdbd4[_0xaebb('0x56')]===null||_0x1fdbd4[_0xaebb('0x56')]===0x1)_0x5558b9(null);return db[_0xaebb('0x57')]['findAll']({'where':{'sectionId':_0x1fdbd4['id']},'raw':!![]})[_0xaebb('0x29')](function(_0x13c0e8){var _0x4bc85a=_['map'](_0x13c0e8,function(_0x254288){return qs[_0xaebb('0x50')](_0x254288,['id',_0xaebb('0x51'),'updatedAt',_0xaebb('0x58')]);});_0x5558b9(_0x4bc85a);})[_0xaebb('0x4b')](function(_0x3cbd1f){_0x21d88d(_0x3cbd1f);});})[_0xaebb('0x29')](function(_0x26d1e3){var _0xba3c6c=qs['omit'](_0x1fdbd4,['id','createdAt',_0xaebb('0x52')]);_0xba3c6c[_0xaebb('0x59')]=_0x4e89b8['id'];if(_0x26d1e3)_0xba3c6c[_0xaebb('0x5a')]=_0x26d1e3;return _0xba3c6c;})['then'](function(_0x489da2){return db[_0xaebb('0x5b')][_0xaebb('0x4c')](_0x489da2,{'include':[{'model':db[_0xaebb('0x57')],'as':_0xaebb('0x5a')}],'raw':!![],'transaction':_0x2ddcb0});});})['then'](function(){return _0x4e89b8;});}});});});}})[_0xaebb('0x29')](respondWithResult(_0x4d6d71,0xc9))[_0xaebb('0x4b')](handleError(_0x4d6d71,null));};exports[_0xaebb('0x28')]=function(_0x466e6a,_0x4beafb){if(_0x466e6a['body']['id']){delete _0x466e6a[_0xaebb('0x4d')]['id'];}return db[_0xaebb('0x2f')]['find']({'where':{'id':_0x466e6a['params']['id']}})['then'](handleEntityNotFound(_0x4beafb,null))[_0xaebb('0x29')](saveUpdates(_0x466e6a[_0xaebb('0x4d')],null))[_0xaebb('0x29')](respondWithResult(_0x4beafb,null))['catch'](handleError(_0x4beafb,null));};exports['destroy']=function(_0xece4c8,_0x501c0a){return db[_0xaebb('0x2f')][_0xaebb('0x4a')]({'where':{'id':_0xece4c8[_0xaebb('0x48')]['id']}})[_0xaebb('0x29')](handleEntityNotFound(_0x501c0a,null))[_0xaebb('0x29')](removeEntity(_0x501c0a,null))[_0xaebb('0x4b')](handleError(_0x501c0a,null));};exports[_0xaebb('0x5c')]=function(_0x305bae,_0x1453ee){return db[_0xaebb('0x2f')]['describe']()[_0xaebb('0x29')](respondWithResult(_0x1453ee,null))['catch'](handleError(_0x1453ee,null));};exports['addSections']=function(_0x3bd1e0,_0x256f49){var _0x54377c=_0x3bd1e0[_0xaebb('0x4d')];return db[_0xaebb('0x2f')]['find']({'where':{'id':_0x3bd1e0[_0xaebb('0x48')]['id']}})['then'](handleEntityNotFound(_0x256f49,null))['then'](function(_0x7d2df3){if(_0x7d2df3){return db[_0xaebb('0x5d')][_0xaebb('0x54')](function(_0x2d07b4){return db[_0xaebb('0x5b')][_0xaebb('0x2a')]({'where':{'userProfileId':_0x3bd1e0[_0xaebb('0x48')]['id'],'sectionId':_['map'](_0x54377c,function(_0x510f13){return _0x510f13[_0xaebb('0x58')];})},'transaction':_0x2d07b4})[_0xaebb('0x29')](function(){var _0x12d962=_[_0xaebb('0x2e')](_0x54377c,function(_0x223174){_0x223174[_0xaebb('0x59')]=_0x3bd1e0[_0xaebb('0x48')]['id'];return _0x223174;});var _0x9eb50a=[];return BPromise[_0xaebb('0x55')](_0x12d962,function(_0xab70db){return db[_0xaebb('0x5b')][_0xaebb('0x4c')](_0xab70db,{'include':[{'model':db['UserProfileResource'],'as':_0xaebb('0x5a')}],'raw':!![],'transaction':_0x2d07b4})[_0xaebb('0x29')](function(_0x1d566e){_0x9eb50a[_0xaebb('0x5e')](_0x1d566e[_0xaebb('0x4f')]({'plain':!![]}));});})[_0xaebb('0x29')](function(){return _0x9eb50a;});});});}})['then'](function(_0xa0b6e4){return _0xa0b6e4;})['then'](respondWithResult(_0x256f49,null))[_0xaebb('0x4b')](handleError(_0x256f49,null));};exports[_0xaebb('0x5f')]=function(_0x2efa61,_0x1363ed){var _0x1996ea;return db[_0xaebb('0x2f')][_0xaebb('0x4a')]({'where':{'id':_0x2efa61['params']['id']},'attributes':['id',_0xaebb('0x2c')]})['then'](handleEntityNotFound(_0x1363ed,null))[_0xaebb('0x29')](function(_0x468f91){if(_0x468f91){_0x1996ea=_0x468f91;return db[_0xaebb('0x5b')][_0xaebb('0x2a')]({'where':{'userProfileId':_0x2efa61[_0xaebb('0x48')]['id'],'sectionId':_0x2efa61[_0xaebb('0x33')]['ids']}});}})[_0xaebb('0x29')](function(){return _0x1996ea;})[_0xaebb('0x29')](respondWithStatusCode(_0x1363ed,null))[_0xaebb('0x4b')](handleError(_0x1363ed,null));};exports[_0xaebb('0x60')]=function(_0x5ce5b5,_0x1cc3d1){var _0x3496a9=[];var _0x3a5ff6=[];return db[_0xaebb('0x5b')][_0xaebb('0x45')]({'where':{'userProfileId':_0x5ce5b5['params']['id']},'raw':!![]})[_0xaebb('0x29')](function(_0x51bb1c){_0x3496a9=_['filter'](_0x51bb1c,function(_0x1af6e3){return _0x1af6e3[_0xaebb('0x61')]===0x1||_[_0xaebb('0x62')]([0x3eb,0x709],_0x1af6e3[_0xaebb('0x58')]);});if(!_[_0xaebb('0x63')](_0x3496a9)){return _['map'](_0x3496a9,function(_0x28ff7d){return _0x28ff7d[_0xaebb('0x58')];});}else{return;}})[_0xaebb('0x29')](function(_0x427b50){if(_0x427b50)_0x3a5ff6=_0x427b50;if(_['includes'](_0x3a5ff6,0x64)){var _0x3bb4a6=_[_0xaebb('0x4a')](_0x3496a9,{'sectionId':0x64});return hasDefaultDashboard(_0x3bb4a6)[_0xaebb('0x29')](function(_0x4d946c){return _[_0xaebb('0x2e')](_0x3496a9,function(_0x4ee4fd){if(_0x4ee4fd[_0xaebb('0x58')]===0x64){_0x4ee4fd[_0xaebb('0x64')]=_0x4d946c;}return _0x4ee4fd;});});}else{return;}})['then'](function(_0x18c016){if(_0x18c016)_0x3496a9=_0x18c016;if(_[_0xaebb('0x62')](_0x3a5ff6,0x3eb)){var _0x25f394=_[_0xaebb('0x4a')](_0x3496a9,{'sectionId':0x3eb});return getCustomDashboards(_0x25f394)[_0xaebb('0x29')](function(_0x369892){return _['map'](_0x3496a9,function(_0x36e6e7){if(_0x25f394[_0xaebb('0x61')]){if(_0x36e6e7[_0xaebb('0x58')]===0x3eb){_0x36e6e7[_0xaebb('0x64')]=_0x369892;}}else{if(_0x36e6e7['sectionId']===0x64){if(!_0x36e6e7[_0xaebb('0x64')]){_0x36e6e7[_0xaebb('0x64')]=[];}_0x36e6e7[_0xaebb('0x64')]=_0x36e6e7[_0xaebb('0x64')][_0xaebb('0x65')](_0x369892);}}return _0x36e6e7;});});}else{return;}})[_0xaebb('0x29')](function(_0x3db262){if(_0x3db262)_0x3496a9=_0x3db262;if(_[_0xaebb('0x62')](_0x3a5ff6,0x709)){var _0x382102=_[_0xaebb('0x4a')](_0x3496a9,{'sectionId':0x709});return getPlugins(_0x382102)['then'](function(_0x23ef7a){if(_0x382102[_0xaebb('0x61')]){return _[_0xaebb('0x2e')](_0x3496a9,function(_0x4f149b){if(_0x4f149b['sectionId']===0x709){_0x4f149b[_0xaebb('0x64')]=_0x23ef7a;}return _0x4f149b;});}else{var _0x4505c3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x23ef7a};var _0x1e1edf=_[_0xaebb('0x2e')](_0x3496a9);_0x1e1edf[_0xaebb('0x5e')](_0x4505c3);return _0x1e1edf;}});}else{return;}})[_0xaebb('0x29')](function(_0x4d5fce){if(_0x4d5fce)_0x3496a9=_0x4d5fce;return _[_0xaebb('0x40')](_0x3496a9,[_0xaebb('0x61'),0x1]);})['then'](respondWithResult(_0x1cc3d1,null))[_0xaebb('0x4b')](handleError(_0x1cc3d1,null));};function hasDefaultDashboard(_0x2ca9c9){var _0x56d4b6=[0x65];return new BPromise(function(_0x974342,_0x1b7f87){try{if(_0x2ca9c9[_0xaebb('0x56')]){_0x974342(_0x56d4b6);}else{return db[_0xaebb('0x57')]['findOne']({'where':{'sectionId':_0x2ca9c9['id']},'raw':!![]})[_0xaebb('0x29')](function(_0xf1df12){_0xf1df12?_0x974342(_0x56d4b6):_0x974342();});}}catch(_0x33cd4c){_0x1b7f87(_0x33cd4c);}});}function getCustomDashboards(_0x48ab18){var _0x2580a8=[];return new BPromise(function(_0x294b2f,_0x40888f){try{if(_0x48ab18['autoAssociation']){return db[_0xaebb('0x66')][_0xaebb('0x45')]({'raw':!![]})[_0xaebb('0x29')](function(_0x406be3){_0x406be3[_0xaebb('0x67')](function(_0x15bf58){_0x2580a8[_0xaebb('0x5e')](_0x15bf58['id']+0x1869f);});_0x294b2f(_0x2580a8);});}else{return db[_0xaebb('0x57')][_0xaebb('0x45')]({'where':{'sectionId':_0x48ab18['id']},'raw':!![]})[_0xaebb('0x29')](function(_0x3f6f20){_0x3f6f20[_0xaebb('0x67')](function(_0x1b3567){_0x2580a8[_0xaebb('0x5e')](_0x1b3567['resourceId']+0x1869f);});_0x294b2f(_0x2580a8);});}}catch(_0x190344){_0x40888f(_0x190344);}});}function getPlugins(_0x56f287){var _0x5cf0c8=[];return new BPromise(function(_0x47a6a2,_0xfdd616){try{if(_0x56f287[_0xaebb('0x56')]){return db[_0xaebb('0x68')][_0xaebb('0x45')]({'raw':!![]})[_0xaebb('0x29')](function(_0x121ebf){_0x121ebf[_0xaebb('0x67')](function(_0x4710d6){_0x5cf0c8['push'](_0x4710d6['id']+0x15b38);});_0x47a6a2(_0x5cf0c8);});}else{return db[_0xaebb('0x57')]['findAll']({'where':{'sectionId':_0x56f287['id']},'raw':!![]})[_0xaebb('0x29')](function(_0x24f090){_0x24f090[_0xaebb('0x67')](function(_0x3ef8dd){_0x5cf0c8['push'](_0x3ef8dd[_0xaebb('0x69')]+0x15b38);});_0x47a6a2(_0x5cf0c8);});}}catch(_0x1b45e1){_0xfdd616(_0x1b45e1);}});}exports['addResources']=function(_0x22d448,_0x2d2b17){return db[_0xaebb('0x2f')][_0xaebb('0x4a')]({'where':{'id':_0x22d448[_0xaebb('0x48')]['id']}})[_0xaebb('0x29')](handleEntityNotFound(_0x2d2b17,null))['then'](function(_0x6b2198){if(_0x6b2198){return db[_0xaebb('0x5d')][_0xaebb('0x54')](function(_0x219512){return db[_0xaebb('0x5b')][_0xaebb('0x45')]({'where':{'userProfileId':_0x22d448['params']['id']},'attributes':['id'],'raw':!![]})[_0xaebb('0x29')](function(_0x3ee840){if(_0x3ee840){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x22d448['params']['id'],'id':_['map'](_0x3ee840,function(_0x239999){return _0x239999['id'];})},'transaction':_0x219512});}})[_0xaebb('0x29')](function(_0x2c302f){var _0x2e2039=_[_0xaebb('0x2e')](_0x22d448[_0xaebb('0x4d')],function(_0x565f03){_0x565f03[_0xaebb('0x59')]=_0x22d448[_0xaebb('0x48')]['id'];return _0x565f03;});return db['UserProfileSection'][_0xaebb('0x6a')](_0x2e2039,{'raw':!![],'transaction':_0x219512});})[_0xaebb('0x29')](function(_0x5b9b1a){var _0x1139b9=_[_0xaebb('0x40')](_[_0xaebb('0x2e')](_0x5b9b1a,function(_0x5d0c28){return _0x5d0c28[_0xaebb('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x1139b9){return db[_0xaebb('0x5b')]['findAll']({'where':{'userProfileId':_0x22d448[_0xaebb('0x48')]['id'],'sectionId':_[_0xaebb('0x2e')](_0x1139b9,function(_0x18f1a5){return _0x18f1a5[_0xaebb('0x58')];})},'attributes':['id',_0xaebb('0x58')],'raw':!![]})[_0xaebb('0x29')](function(_0x27b68c){var _0x4b3430=_[_0xaebb('0x2e')](_0x22d448[_0xaebb('0x4d')],function(_0x5a8999){_0x5a8999[_0xaebb('0x59')]=_0x22d448[_0xaebb('0x48')]['id'];return _0x5a8999;});return db['UserProfileResource'][_0xaebb('0x6a')](_0x4b3430,{'raw':!![],'transaction':_0x219512});});}})[_0xaebb('0x4b')](handleError(_0x2d2b17,null));});}})[_0xaebb('0x29')](function(_0x25e99a){var _0x9f07e6=_['map'](_0x25e99a,function(_0x3b3992){return _0x3b3992[_0xaebb('0x4f')]({'plain':!![]});});})['then'](respondWithResult(_0x2d2b17,null))['catch'](handleError(_0x2d2b17,null));};exports[_0xaebb('0x6b')]=function(_0xd0c839,_0x62105c,_0x2ecda3){return db[_0xaebb('0x2f')][_0xaebb('0x4a')]({'where':{'id':_0xd0c839[_0xaebb('0x48')]['id']}})[_0xaebb('0x29')](handleEntityNotFound(_0x62105c,null))['then'](function(_0x36cb5e){if(_0x36cb5e){return _0x36cb5e['removeResources'](_0xd0c839[_0xaebb('0x33')][_0xaebb('0x6c')]);}})[_0xaebb('0x29')](respondWithStatusCode(_0x62105c,null))[_0xaebb('0x4b')](handleError(_0x62105c,null));};exports[_0xaebb('0x6d')]=function(_0x36036c,_0x5e6907){var _0x231908={};if(!_0x36036c[_0xaebb('0x33')]['section'])throw new Error(_0xaebb('0x6e'));if(!_0x36036c[_0xaebb('0x33')][_0xaebb('0x3b')](_0xaebb('0x3c'))){_0x231908[_0xaebb('0x20')]=qs[_0xaebb('0x20')](_0x36036c['query'][_0xaebb('0x20')]);_0x231908[_0xaebb('0x23')]=qs[_0xaebb('0x23')](_0x36036c[_0xaebb('0x33')][_0xaebb('0x23')]);}return db[_0xaebb('0x2f')]['find']({'where':{'id':_0x36036c[_0xaebb('0x48')]['id']}})['then'](function(_0x1c24c4){if(!_0x1c24c4)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x36036c['params']['id']);return db[_0xaebb('0x2f')][_0xaebb('0x6d')](_0x36036c);})[_0xaebb('0x29')](respondWithFilteredResult(_0x5e6907,_0x231908))[_0xaebb('0x4b')](handleError(_0x5e6907,null));}; \ No newline at end of file +var _0x345e=['filter','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','clone','fields','get','omit','createdAt','updatedAt','sequelize','merge','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','destroy','describe','addSections','UserProfileSection','push','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','forEach','resourceId','Plugin','transaction','bulkCreate','removeResources','ids','section','nolimit','getResources','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','UserProfile','type','key','model','query','keys','filters','intersection','attributes','length','sort','pick'];(function(_0x35da80,_0x1673f3){var _0x28732d=function(_0x28c1ff){while(--_0x28c1ff){_0x35da80['push'](_0x35da80['shift']());}};_0x28732d(++_0x1673f3);}(_0x345e,0x10d));var _0xe345=function(_0x5ad4cf,_0x212ffb){_0x5ad4cf=_0x5ad4cf-0x0;var _0x530aba=_0x345e[_0x5ad4cf];return _0x530aba;};'use strict';var emlformat=require(_0xe345('0x0'));var rimraf=require(_0xe345('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe345('0x2'));var moment=require(_0xe345('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe345('0x4'));var util=require(_0xe345('0x5'));var path=require(_0xe345('0x6'));var sox=require(_0xe345('0x7'));var csv=require(_0xe345('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe345('0x9'));var squel=require(_0xe345('0xa'));var crypto=require('crypto');var jsforce=require(_0xe345('0xb'));var deskjs=require(_0xe345('0xc'));var toCsv=require(_0xe345('0x8'));var querystring=require('querystring');var Papa=require(_0xe345('0xd'));var Redis=require(_0xe345('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe345('0xf'));var as=require(_0xe345('0x10'));var hardwareService=require(_0xe345('0x11'));var logger=require(_0xe345('0x12'))(_0xe345('0x13'));var utils=require(_0xe345('0x14'));var config=require(_0xe345('0x15'));var licenseUtil=require(_0xe345('0x16'));var db=require(_0xe345('0x17'))['db'];config[_0xe345('0x18')]=_['defaults'](config[_0xe345('0x18')],{'host':_0xe345('0x19'),'port':0x18eb});var socket=require(_0xe345('0x1a'))(new Redis(config[_0xe345('0x18')]));require(_0xe345('0x1b'))['register'](socket);function respondWithStatusCode(_0xec970b,_0x2939a2){_0x2939a2=_0x2939a2||0xcc;return function(_0x178931){if(_0x178931){return _0xec970b[_0xe345('0x1c')](_0x2939a2);}return _0xec970b[_0xe345('0x1d')](_0x2939a2)[_0xe345('0x1e')]();};}function respondWithResult(_0x505035,_0x3253c6){_0x3253c6=_0x3253c6||0xc8;return function(_0xf78c9b){if(_0xf78c9b){return _0x505035[_0xe345('0x1d')](_0x3253c6)[_0xe345('0x1f')](_0xf78c9b);}};}function respondWithFilteredResult(_0x523bb1,_0xabd19d){return function(_0x26c134){if(_0x26c134){var _0x3316f2=typeof _0xabd19d['offset']===_0xe345('0x20')&&typeof _0xabd19d[_0xe345('0x21')]==='undefined';var _0x42c4a1=_0x26c134['count'];var _0x3b5e42=_0x3316f2?0x0:_0xabd19d[_0xe345('0x22')];var _0x267b01=_0x3316f2?_0x26c134['count']:_0xabd19d['offset']+_0xabd19d[_0xe345('0x21')];var _0x9e2920;if(_0x267b01>=_0x42c4a1){_0x267b01=_0x42c4a1;_0x9e2920=0xc8;}else{_0x9e2920=0xce;}_0x523bb1[_0xe345('0x1d')](_0x9e2920);return _0x523bb1['set'](_0xe345('0x23'),_0x3b5e42+'-'+_0x267b01+'/'+_0x42c4a1)['json'](_0x26c134);}return null;};}function patchUpdates(_0x4004a6){return function(_0x16668f){try{jsonpatch[_0xe345('0x24')](_0x16668f,_0x4004a6,!![]);}catch(_0x3de52f){return BPromise[_0xe345('0x25')](_0x3de52f);}return _0x16668f['save']();};}function saveUpdates(_0x384978,_0x53ece1){return function(_0x47b47f){if(_0x47b47f){return _0x47b47f[_0xe345('0x26')](_0x384978)[_0xe345('0x27')](function(_0xcfbae8){return _0xcfbae8;});}return null;};}function removeEntity(_0x36871e,_0x33a8dc){return function(_0x4c4c58){if(_0x4c4c58){return _0x4c4c58['destroy']()[_0xe345('0x27')](function(){_0x36871e[_0xe345('0x1d')](0xcc)[_0xe345('0x1e')]();});}};}function handleEntityNotFound(_0x13d334,_0x4c41a6){return function(_0x17a58c){if(!_0x17a58c){_0x13d334['sendStatus'](0x194);}return _0x17a58c;};}function handleError(_0x3eeef2,_0x4c4a87){_0x4c4a87=_0x4c4a87||0x1f4;return function(_0x3ae991){logger[_0xe345('0x28')](_0x3ae991[_0xe345('0x29')]);if(_0x3ae991[_0xe345('0x2a')]){delete _0x3ae991[_0xe345('0x2a')];}_0x3eeef2[_0xe345('0x1d')](_0x4c4a87)[_0xe345('0x2b')](_0x3ae991);};}exports[_0xe345('0x2c')]=function(_0x48f47,_0x2033ee){var _0x21a1b7={},_0x35dea6={},_0x3b0c9f={'count':0x0,'rows':[]};var _0x161bea=_[_0xe345('0x2d')](db[_0xe345('0x2e')]['rawAttributes'],function(_0x245f5b){return{'name':_0x245f5b['fieldName'],'type':_0x245f5b[_0xe345('0x2f')][_0xe345('0x30')]};});_0x35dea6[_0xe345('0x31')]=_[_0xe345('0x2d')](_0x161bea,_0xe345('0x2a'));_0x35dea6[_0xe345('0x32')]=_[_0xe345('0x33')](_0x48f47[_0xe345('0x32')]);_0x35dea6[_0xe345('0x34')]=_[_0xe345('0x35')](_0x35dea6[_0xe345('0x31')],_0x35dea6[_0xe345('0x32')]);_0x21a1b7[_0xe345('0x36')]=_[_0xe345('0x35')](_0x35dea6[_0xe345('0x31')],qs['fields'](_0x48f47[_0xe345('0x32')]['fields']));_0x21a1b7['attributes']=_0x21a1b7[_0xe345('0x36')][_0xe345('0x37')]?_0x21a1b7[_0xe345('0x36')]:_0x35dea6['model'];if(!_0x48f47['query']['hasOwnProperty']('nolimit')){_0x21a1b7[_0xe345('0x21')]=qs['limit'](_0x48f47[_0xe345('0x32')]['limit']);_0x21a1b7[_0xe345('0x22')]=qs[_0xe345('0x22')](_0x48f47['query'][_0xe345('0x22')]);}_0x21a1b7['order']=qs[_0xe345('0x38')](_0x48f47[_0xe345('0x32')][_0xe345('0x38')]);_0x21a1b7['where']=qs[_0xe345('0x34')](_[_0xe345('0x39')](_0x48f47[_0xe345('0x32')],_0x35dea6[_0xe345('0x34')]),_0x161bea);if(_0x48f47[_0xe345('0x32')][_0xe345('0x3a')]){_0x21a1b7['where']=_['merge'](_0x21a1b7[_0xe345('0x3b')],{'$or':_['map'](_0x161bea,function(_0x16e6e9){if(_0x16e6e9[_0xe345('0x2f')]!==_0xe345('0x3c')){var _0x3af7a1={};_0x3af7a1[_0x16e6e9[_0xe345('0x2a')]]={'$like':'%'+_0x48f47[_0xe345('0x32')][_0xe345('0x3a')]+'%'};return _0x3af7a1;}})});}_0x21a1b7=_['merge']({},_0x21a1b7,_0x48f47[_0xe345('0x3d')]);var _0x15d092={'where':_0x21a1b7[_0xe345('0x3b')]};return db['UserProfile'][_0xe345('0x3e')](_0x15d092)[_0xe345('0x27')](function(_0x23f3ae){_0x3b0c9f[_0xe345('0x3e')]=_0x23f3ae;if(_0x48f47[_0xe345('0x32')][_0xe345('0x3f')]){_0x21a1b7[_0xe345('0x40')]=[{'all':!![]}];}return db['UserProfile'][_0xe345('0x41')](_0x21a1b7);})[_0xe345('0x27')](function(_0x5cbc02){_0x3b0c9f[_0xe345('0x42')]=_0x5cbc02;return _0x3b0c9f;})[_0xe345('0x27')](respondWithFilteredResult(_0x2033ee,_0x21a1b7))[_0xe345('0x43')](handleError(_0x2033ee,null));};exports[_0xe345('0x44')]=function(_0x514890,_0x415979){var _0x3e1eb0={'raw':![],'where':{'id':_0x514890[_0xe345('0x45')]['id']}},_0x229d34={};_0x229d34[_0xe345('0x31')]=_[_0xe345('0x33')](db['UserProfile'][_0xe345('0x46')]);_0x229d34['query']=_[_0xe345('0x33')](_0x514890[_0xe345('0x32')]);_0x229d34[_0xe345('0x34')]=_[_0xe345('0x35')](_0x229d34[_0xe345('0x31')],_0x229d34[_0xe345('0x32')]);_0x3e1eb0[_0xe345('0x36')]=_[_0xe345('0x35')](_0x229d34[_0xe345('0x31')],qs['fields'](_0x514890[_0xe345('0x32')]['fields']));_0x3e1eb0[_0xe345('0x36')]=_0x3e1eb0['attributes'][_0xe345('0x37')]?_0x3e1eb0['attributes']:_0x229d34[_0xe345('0x31')];if(_0x514890[_0xe345('0x32')][_0xe345('0x3f')]){_0x3e1eb0[_0xe345('0x40')]=[{'all':!![]}];}_0x3e1eb0=_['merge']({},_0x3e1eb0,_0x514890[_0xe345('0x3d')]);return db[_0xe345('0x2e')][_0xe345('0x47')](_0x3e1eb0)['then'](handleEntityNotFound(_0x415979,null))[_0xe345('0x27')](respondWithResult(_0x415979,null))[_0xe345('0x43')](handleError(_0x415979,null));};exports['create']=function(_0x24b915,_0x5be853){return db[_0xe345('0x2e')][_0xe345('0x48')](_0x24b915[_0xe345('0x49')],{})[_0xe345('0x27')](respondWithResult(_0x5be853,0xc9))[_0xe345('0x43')](handleError(_0x5be853,null));};exports[_0xe345('0x4a')]=function(_0x2c6e97,_0x1f07ab){var _0x43e388={'where':{'id':_0x2c6e97['params']['id']}},_0x136d86={};_0x136d86['model']=_[_0xe345('0x33')](db['UserProfile']['rawAttributes']);_0x43e388[_0xe345('0x36')]=_[_0xe345('0x35')](_0x136d86[_0xe345('0x31')],qs[_0xe345('0x4b')](_0x2c6e97[_0xe345('0x32')][_0xe345('0x4b')]));_0x43e388[_0xe345('0x36')]=_0x43e388['attributes'][_0xe345('0x37')]?_0x43e388[_0xe345('0x36')]:_0x136d86[_0xe345('0x31')];if(_0x2c6e97[_0xe345('0x32')][_0xe345('0x3f')]){_0x43e388[_0xe345('0x40')]=[{'all':!![]}];}_0x43e388=_['merge']({},_0x43e388,_0x2c6e97[_0xe345('0x3d')]);return db['UserProfile'][_0xe345('0x47')](_0x43e388)[_0xe345('0x27')](handleEntityNotFound(_0x1f07ab,null))[_0xe345('0x27')](function(_0x2ffdc3){if(_0x2ffdc3){var _0x5073de=_0x2ffdc3[_0xe345('0x4c')]({'plain':!![]});_0x5073de=qs[_0xe345('0x4d')](_0x5073de,['id',_0xe345('0x4e'),_0xe345('0x4f'),'crudPermissions']);_0x2c6e97['body']=_[_0xe345('0x4d')](_0x2c6e97[_0xe345('0x49')],['id',_0xe345('0x4e'),_0xe345('0x4f')]);return db[_0xe345('0x50')]['transaction'](function(_0x534cef){return db[_0xe345('0x2e')][_0xe345('0x48')](_[_0xe345('0x51')](_0x5073de,_0x2c6e97[_0xe345('0x49')]),{'include':_0x2c6e97[_0xe345('0x32')][_0xe345('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x534cef})['then'](function(_0x274550){var _0x16da89=_0x274550[_0xe345('0x4c')]({'plain':!![]});return db['UserProfileSection'][_0xe345('0x41')]({'where':{'userProfileId':_0x2c6e97['params']['id']},'raw':!![]})[_0xe345('0x27')](function(_0x2ff10e){if(_0x2ff10e){return BPromise['each'](_0x2ff10e,function(_0x174812){return new BPromise(function(_0x180d03,_0x5a9ca1){if(_0x174812[_0xe345('0x52')]===null||_0x174812['autoAssociation']===0x1)_0x180d03(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x174812['id']},'raw':!![]})[_0xe345('0x27')](function(_0x2e69a8){var _0x154788=_[_0xe345('0x2d')](_0x2e69a8,function(_0x5d3fcc){return qs[_0xe345('0x4d')](_0x5d3fcc,['id','createdAt',_0xe345('0x4f'),_0xe345('0x53')]);});_0x180d03(_0x154788);})[_0xe345('0x43')](function(_0x264392){_0x5a9ca1(_0x264392);});})[_0xe345('0x27')](function(_0x3df29f){var _0x17f484=qs['omit'](_0x174812,['id',_0xe345('0x4e'),_0xe345('0x4f')]);_0x17f484[_0xe345('0x54')]=_0x16da89['id'];if(_0x3df29f)_0x17f484[_0xe345('0x55')]=_0x3df29f;return _0x17f484;})[_0xe345('0x27')](function(_0x143107){return db['UserProfileSection'][_0xe345('0x48')](_0x143107,{'include':[{'model':db[_0xe345('0x56')],'as':_0xe345('0x55')}],'raw':!![],'transaction':_0x534cef});});})[_0xe345('0x27')](function(){return _0x16da89;});}});});});}})[_0xe345('0x27')](respondWithResult(_0x1f07ab,0xc9))['catch'](handleError(_0x1f07ab,null));};exports[_0xe345('0x26')]=function(_0x1f3116,_0x46983f){if(_0x1f3116['body']['id']){delete _0x1f3116['body']['id'];}return db[_0xe345('0x2e')][_0xe345('0x47')]({'where':{'id':_0x1f3116[_0xe345('0x45')]['id']}})[_0xe345('0x27')](handleEntityNotFound(_0x46983f,null))['then'](saveUpdates(_0x1f3116[_0xe345('0x49')],null))['then'](respondWithResult(_0x46983f,null))[_0xe345('0x43')](handleError(_0x46983f,null));};exports[_0xe345('0x57')]=function(_0x35a313,_0x3475ad){return db[_0xe345('0x2e')][_0xe345('0x47')]({'where':{'id':_0x35a313[_0xe345('0x45')]['id']}})['then'](handleEntityNotFound(_0x3475ad,null))[_0xe345('0x27')](removeEntity(_0x3475ad,null))[_0xe345('0x43')](handleError(_0x3475ad,null));};exports['describe']=function(_0x21d6ee,_0x2af631){return db[_0xe345('0x2e')][_0xe345('0x58')]()[_0xe345('0x27')](respondWithResult(_0x2af631,null))[_0xe345('0x43')](handleError(_0x2af631,null));};exports[_0xe345('0x59')]=function(_0x4e644e,_0x37b85d){var _0x1a5cb5=_0x4e644e[_0xe345('0x49')];return db[_0xe345('0x2e')][_0xe345('0x47')]({'where':{'id':_0x4e644e[_0xe345('0x45')]['id']}})['then'](handleEntityNotFound(_0x37b85d,null))[_0xe345('0x27')](function(_0x2a94d9){if(_0x2a94d9){return db[_0xe345('0x50')]['transaction'](function(_0x35f7bc){return db[_0xe345('0x5a')][_0xe345('0x57')]({'where':{'userProfileId':_0x4e644e[_0xe345('0x45')]['id'],'sectionId':_[_0xe345('0x2d')](_0x1a5cb5,function(_0x40aa89){return _0x40aa89[_0xe345('0x53')];})},'transaction':_0x35f7bc})[_0xe345('0x27')](function(){var _0x4abf5a=_[_0xe345('0x2d')](_0x1a5cb5,function(_0x45bda9){_0x45bda9[_0xe345('0x54')]=_0x4e644e[_0xe345('0x45')]['id'];return _0x45bda9;});var _0x32a328=[];return BPromise['each'](_0x4abf5a,function(_0x272bab){return db[_0xe345('0x5a')][_0xe345('0x48')](_0x272bab,{'include':[{'model':db[_0xe345('0x56')],'as':_0xe345('0x55')}],'raw':!![],'transaction':_0x35f7bc})[_0xe345('0x27')](function(_0x1a486d){_0x32a328[_0xe345('0x5b')](_0x1a486d[_0xe345('0x4c')]({'plain':!![]}));});})[_0xe345('0x27')](function(){return _0x32a328;});});});}})['then'](function(_0x14dc29){return _0x14dc29;})['then'](respondWithResult(_0x37b85d,null))[_0xe345('0x43')](handleError(_0x37b85d,null));};exports[_0xe345('0x5c')]=function(_0x3ed664,_0x2c7e6c){var _0x56fb64;return db[_0xe345('0x2e')][_0xe345('0x47')]({'where':{'id':_0x3ed664[_0xe345('0x45')]['id']},'attributes':['id',_0xe345('0x2a')]})[_0xe345('0x27')](handleEntityNotFound(_0x2c7e6c,null))[_0xe345('0x27')](function(_0x4a031c){if(_0x4a031c){_0x56fb64=_0x4a031c;return db[_0xe345('0x5a')][_0xe345('0x57')]({'where':{'userProfileId':_0x3ed664[_0xe345('0x45')]['id'],'sectionId':_0x3ed664[_0xe345('0x32')]['ids']}});}})['then'](function(){return _0x56fb64;})[_0xe345('0x27')](respondWithStatusCode(_0x2c7e6c,null))[_0xe345('0x43')](handleError(_0x2c7e6c,null));};exports[_0xe345('0x5d')]=function(_0x582ebf,_0x2eb29a){var _0x475627=[];var _0x5639d7=[];return db[_0xe345('0x5a')][_0xe345('0x41')]({'where':{'userProfileId':_0x582ebf[_0xe345('0x45')]['id']},'raw':!![]})[_0xe345('0x27')](function(_0x52491a){_0x475627=_['filter'](_0x52491a,function(_0xadc62b){return _0xadc62b[_0xe345('0x5e')]===0x1||_[_0xe345('0x5f')]([0x3eb,0x709],_0xadc62b['sectionId']);});if(!_[_0xe345('0x60')](_0x475627)){return _['map'](_0x475627,function(_0x1fe2b6){return _0x1fe2b6['sectionId'];});}else{return;}})['then'](function(_0x129e6a){if(_0x129e6a)_0x5639d7=_0x129e6a;if(_[_0xe345('0x5f')](_0x5639d7,0x64)){var _0xff2d32=_['find'](_0x475627,{'sectionId':0x64});return hasDefaultDashboard(_0xff2d32)[_0xe345('0x27')](function(_0x28520a){return _['map'](_0x475627,function(_0x1ab410){if(_0x1ab410[_0xe345('0x53')]===0x64){_0x1ab410[_0xe345('0x61')]=_0x28520a;}return _0x1ab410;});});}else{return;}})[_0xe345('0x27')](function(_0x4d0f98){if(_0x4d0f98)_0x475627=_0x4d0f98;if(_[_0xe345('0x5f')](_0x5639d7,0x3eb)){var _0x1a37db=_[_0xe345('0x47')](_0x475627,{'sectionId':0x3eb});return getCustomDashboards(_0x1a37db)[_0xe345('0x27')](function(_0x1d8969){return _['map'](_0x475627,function(_0xba2a10){if(_0x1a37db[_0xe345('0x5e')]){if(_0xba2a10[_0xe345('0x53')]===0x3eb){_0xba2a10[_0xe345('0x61')]=_0x1d8969;}}else{if(_0xba2a10['sectionId']===0x64){if(!_0xba2a10['subsections']){_0xba2a10[_0xe345('0x61')]=[];}_0xba2a10[_0xe345('0x61')]=_0xba2a10[_0xe345('0x61')][_0xe345('0x62')](_0x1d8969);}}return _0xba2a10;});});}else{return;}})[_0xe345('0x27')](function(_0x364804){if(_0x364804)_0x475627=_0x364804;if(_['includes'](_0x5639d7,0x709)){var _0x1f5401=_[_0xe345('0x47')](_0x475627,{'sectionId':0x709});return getPlugins(_0x1f5401)['then'](function(_0x45f171){if(_0x1f5401[_0xe345('0x5e')]){return _[_0xe345('0x2d')](_0x475627,function(_0xc6d623){if(_0xc6d623[_0xe345('0x53')]===0x709){_0xc6d623[_0xe345('0x61')]=_0x45f171;}return _0xc6d623;});}else{var _0x51a14f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x45f171};var _0x123204=_[_0xe345('0x2d')](_0x475627);_0x123204[_0xe345('0x5b')](_0x51a14f);return _0x123204;}});}else{return;}})[_0xe345('0x27')](function(_0x129f03){if(_0x129f03)_0x475627=_0x129f03;return _[_0xe345('0x3a')](_0x475627,[_0xe345('0x5e'),0x1]);})['then'](respondWithResult(_0x2eb29a,null))[_0xe345('0x43')](handleError(_0x2eb29a,null));};function hasDefaultDashboard(_0x2e8815){var _0x5c1587=[0x65];return new BPromise(function(_0xb15e38,_0x288696){try{if(_0x2e8815[_0xe345('0x52')]){_0xb15e38(_0x5c1587);}else{return db[_0xe345('0x56')]['findOne']({'where':{'sectionId':_0x2e8815['id']},'raw':!![]})['then'](function(_0x86765){_0x86765?_0xb15e38(_0x5c1587):_0xb15e38();});}}catch(_0x5e3c95){_0x288696(_0x5e3c95);}});}function getCustomDashboards(_0x4c2882){var _0x216eae=[];return new BPromise(function(_0x37ba62,_0x3a65b6){try{if(_0x4c2882[_0xe345('0x52')]){return db['Dashboard']['findAll']({'raw':!![]})[_0xe345('0x27')](function(_0x3b5b9a){_0x3b5b9a[_0xe345('0x63')](function(_0x3139fc){_0x216eae[_0xe345('0x5b')](_0x3139fc['id']+0x1869f);});_0x37ba62(_0x216eae);});}else{return db[_0xe345('0x56')][_0xe345('0x41')]({'where':{'sectionId':_0x4c2882['id']},'raw':!![]})[_0xe345('0x27')](function(_0x1e983a){_0x1e983a[_0xe345('0x63')](function(_0xb3f4d){_0x216eae[_0xe345('0x5b')](_0xb3f4d[_0xe345('0x64')]+0x1869f);});_0x37ba62(_0x216eae);});}}catch(_0x414955){_0x3a65b6(_0x414955);}});}function getPlugins(_0x1ec47f){var _0x300d2a=[];return new BPromise(function(_0x2bd0b3,_0x2145fe){try{if(_0x1ec47f['autoAssociation']){return db[_0xe345('0x65')][_0xe345('0x41')]({'raw':!![]})['then'](function(_0x2fcfa6){_0x2fcfa6[_0xe345('0x63')](function(_0x2ebe56){_0x300d2a[_0xe345('0x5b')](_0x2ebe56['id']+0x15b38);});_0x2bd0b3(_0x300d2a);});}else{return db[_0xe345('0x56')]['findAll']({'where':{'sectionId':_0x1ec47f['id']},'raw':!![]})[_0xe345('0x27')](function(_0x533cb2){_0x533cb2[_0xe345('0x63')](function(_0x3a341f){_0x300d2a[_0xe345('0x5b')](_0x3a341f['resourceId']+0x15b38);});_0x2bd0b3(_0x300d2a);});}}catch(_0x4ad431){_0x2145fe(_0x4ad431);}});}exports['addResources']=function(_0x128114,_0x403713){return db[_0xe345('0x2e')][_0xe345('0x47')]({'where':{'id':_0x128114[_0xe345('0x45')]['id']}})[_0xe345('0x27')](handleEntityNotFound(_0x403713,null))[_0xe345('0x27')](function(_0x438182){if(_0x438182){return db[_0xe345('0x50')][_0xe345('0x66')](function(_0x20eae6){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x128114[_0xe345('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xe345('0x27')](function(_0x2c2a77){if(_0x2c2a77){return db['UserProfileSection'][_0xe345('0x57')]({'where':{'userProfileId':_0x128114[_0xe345('0x45')]['id'],'id':_[_0xe345('0x2d')](_0x2c2a77,function(_0x521b50){return _0x521b50['id'];})},'transaction':_0x20eae6});}})[_0xe345('0x27')](function(_0x50f7a7){var _0x941b8=_['map'](_0x128114[_0xe345('0x49')],function(_0x32f24c){_0x32f24c[_0xe345('0x54')]=_0x128114[_0xe345('0x45')]['id'];return _0x32f24c;});return db[_0xe345('0x5a')][_0xe345('0x67')](_0x941b8,{'raw':!![],'transaction':_0x20eae6});})['then'](function(_0x55d866){var _0x1cbcd6=_['filter'](_['map'](_0x55d866,function(_0x29e80e){return _0x29e80e['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1cbcd6){return db['UserProfileSection'][_0xe345('0x41')]({'where':{'userProfileId':_0x128114[_0xe345('0x45')]['id'],'sectionId':_['map'](_0x1cbcd6,function(_0xbe10ed){return _0xbe10ed['sectionId'];})},'attributes':['id',_0xe345('0x53')],'raw':!![]})[_0xe345('0x27')](function(_0x725efa){var _0x5298cd=_[_0xe345('0x2d')](_0x128114['body'],function(_0x1d8821){_0x1d8821[_0xe345('0x54')]=_0x128114[_0xe345('0x45')]['id'];return _0x1d8821;});return db[_0xe345('0x56')][_0xe345('0x67')](_0x5298cd,{'raw':!![],'transaction':_0x20eae6});});}})[_0xe345('0x43')](handleError(_0x403713,null));});}})['then'](function(_0x582461){var _0x36edf6=_['map'](_0x582461,function(_0x2e1f32){return _0x2e1f32[_0xe345('0x4c')]({'plain':!![]});});})[_0xe345('0x27')](respondWithResult(_0x403713,null))[_0xe345('0x43')](handleError(_0x403713,null));};exports[_0xe345('0x68')]=function(_0x2dc8de,_0x29c0de,_0x4e0339){return db[_0xe345('0x2e')][_0xe345('0x47')]({'where':{'id':_0x2dc8de['params']['id']}})[_0xe345('0x27')](handleEntityNotFound(_0x29c0de,null))[_0xe345('0x27')](function(_0x34ab91){if(_0x34ab91){return _0x34ab91[_0xe345('0x68')](_0x2dc8de[_0xe345('0x32')][_0xe345('0x69')]);}})['then'](respondWithStatusCode(_0x29c0de,null))[_0xe345('0x43')](handleError(_0x29c0de,null));};exports['getResources']=function(_0x7f653f,_0x496e78){var _0x5851a8={};if(!_0x7f653f[_0xe345('0x32')][_0xe345('0x6a')])throw new Error('Missing\x20section\x20parameter');if(!_0x7f653f[_0xe345('0x32')]['hasOwnProperty'](_0xe345('0x6b'))){_0x5851a8['limit']=qs[_0xe345('0x21')](_0x7f653f[_0xe345('0x32')]['limit']);_0x5851a8[_0xe345('0x22')]=qs[_0xe345('0x22')](_0x7f653f[_0xe345('0x32')][_0xe345('0x22')]);}return db['UserProfile']['find']({'where':{'id':_0x7f653f['params']['id']}})[_0xe345('0x27')](function(_0x41d6b5){if(!_0x41d6b5)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x7f653f[_0xe345('0x45')]['id']);return db[_0xe345('0x2e')][_0xe345('0x6c')](_0x7f653f);})['then'](respondWithFilteredResult(_0x496e78,_0x5851a8))[_0xe345('0x43')](handleError(_0x496e78,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 01650f1..cbaf0a3 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 _0x6050=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','hasOwnProperty'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x6050,0x196));var _0x0605=function(_0x175beb,_0x2e98af){_0x175beb=_0x175beb-0x0;var _0x1130c6=_0x6050[_0x175beb];return _0x1130c6;};'use strict';var EventEmitter=require(_0x0605('0x0'));var UserProfile=require(_0x0605('0x1'))['db'][_0x0605('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0605('0x3')](0x0);var events={'afterCreate':_0x0605('0x4'),'afterUpdate':_0x0605('0x5'),'afterDestroy':'remove'};function emitEvent(_0x22d595){return function(_0x4576f4,_0x43403d,_0x5797b0){UserProfileEvents['emit'](_0x22d595+':'+_0x4576f4['id'],_0x4576f4);UserProfileEvents['emit'](_0x22d595,_0x4576f4);_0x5797b0(null);};}for(var e in events){if(events[_0x0605('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xc0d7=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x101db3,_0x39260a){var _0x2d0cf6=function(_0x4370ea){while(--_0x4370ea){_0x101db3['push'](_0x101db3['shift']());}};_0x2d0cf6(++_0x39260a);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x4de233,_0x48584d){_0x4de233=_0x4de233-0x0;var _0x637a5e=_0xc0d7[_0x4de233];return _0x637a5e;};'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 diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 85a1278..782102c 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 _0xed72=['WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','users','agents','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','all','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','includeAll','include','Tags','color','ThroughTags','tag','openTabs','true','dataValues','sms','mail','openchannel','whatsapp','squel','models','filter','field','value','findAll','then','associatedResources','map','model','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','SquareOdbc','squarerecordings','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues'];(function(_0x1a784,_0x5b812a){var _0x31e597=function(_0x38d814){while(--_0x38d814){_0x1a784['push'](_0x1a784['shift']());}};_0x31e597(++_0x5b812a);}(_0xed72,0x72));var _0x2ed7=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xed72[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require(_0x2ed7('0x0'));module['exports']=function(_0x4c4dad){var _0x4bb916=_0x4c4dad[_0x2ed7('0x1')];function _0x1218a1(_0x36a978,_0x581e5a){return new Promise(function(_0x1b5baf,_0x12c1f7){if(!_0x581e5a)return _0x1b5baf(null);var _0xe769bf=_0x581e5a['filter']?{[_0x581e5a[_0x2ed7('0x2')][_0x2ed7('0x3')]]:_0x581e5a[_0x2ed7('0x2')][_0x2ed7('0x4')]}:undefined;return _0x4bb916[_0x36a978][_0x2ed7('0x5')]({'where':_0xe769bf,'raw':!![]})[_0x2ed7('0x6')](function(_0x37f1ee){_0x581e5a[_0x2ed7('0x7')]=_[_0x2ed7('0x8')](_0x37f1ee,'id');_0x1b5baf(_0x581e5a);})['catch'](function(_0x400a2e){_0x12c1f7(_0x400a2e);});});}function _0x4c0043(_0x54d201,_0x12da1c){return new Promise(function(_0x1a6498,_0x45ce90){var _0xd3d4dd=_0x54d201[_0x2ed7('0x2')]?{[_0x54d201['filter'][_0x2ed7('0x3')]]:_0x54d201['filter']['value']}:undefined;return _0x4bb916[_0x54d201[_0x2ed7('0x9')]]['findAll']({'where':_0xd3d4dd,'raw':!![]})[_0x2ed7('0x6')](function(_0x14c963){_0x12da1c['associatedResources']=_[_0x2ed7('0x8')](_0x14c963,function(_0x2f7373){return _0x2f7373[_0x2ed7('0xa')];});_0x1a6498(_0x12da1c);})[_0x2ed7('0xb')](function(_0x1913ce){_0x45ce90(_0x1913ce);});});}function _0x28e840(_0x3862ee,_0x475697,_0x53a7b4){if(!_0x475697)return Promise[_0x2ed7('0xc')](null);return new Promise(function(_0x20fdc9,_0x46602a){return _0x4bb916[_0x2ed7('0xd')]['findAll']({'where':{'sectionId':_0x475697['id']},'raw':!![]})[_0x2ed7('0x6')](function(_0x457faa){if(_0x3862ee[_0x2ed7('0x3')]&&_0x3862ee['field']!=='id'){_0x475697['associatedResources']=_[_0x2ed7('0x8')](_0x457faa,function(_0x2bc094){return _0x2bc094[_0x3862ee[_0x2ed7('0x3')]];});}else{if(_0x53a7b4===_0x2ed7('0xe')){_0x475697[_0x2ed7('0x7')]=_['map'](_0x457faa,function(_0x27908e){return{'id':_0x27908e[_0x2ed7('0xf')],'type':_0x27908e[_0x2ed7('0x10')]};});}else{_0x475697[_0x2ed7('0x7')]=_[_0x2ed7('0x8')](_0x457faa,function(_0x1a9c91){return _0x1a9c91[_0x2ed7('0xf')];});}}_0x20fdc9(_0x475697);})['catch'](function(_0x1c11fb){_0x46602a(_0x1c11fb);});});}function _0x30f7a9(_0x13b714,_0x6f287e){var _0x3f2d59={'parentSections':[]};switch(_0x13b714[_0x2ed7('0x11')]()){case'squareprojects':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x13');break;case'odbc':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x14');break;case _0x2ed7('0x15'):_0x3f2d59[_0x2ed7('0x12')]='SquareRecording';_0x3f2d59[_0x2ed7('0x16')]=[{'name':_0x2ed7('0x17'),'field':'name','foreignKey':'projectName'}];break;case _0x2ed7('0x18'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x19');break;case _0x2ed7('0x1a'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x1b');_0x3f2d59[_0x2ed7('0x16')]=[{'name':_0x2ed7('0x1c'),'field':'id','foreignKey':_0x2ed7('0x1d')}];break;case _0x2ed7('0x1e'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x1f');break;case _0x2ed7('0x20'):_0x3f2d59['childModel']='CmCompany';break;case _0x2ed7('0x21'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x22');break;case _0x2ed7('0x23'):_0x3f2d59['childModel']=_0x2ed7('0x24');break;case _0x2ed7('0x25'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x26');break;case _0x2ed7('0x27'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x28');break;case _0x2ed7('0x29'):_0x3f2d59['childModel']=_0x2ed7('0x2a');break;case'inboundroutes':case'internalroutes':case _0x2ed7('0x2b'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x2c');break;case'contexts':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x2d');break;case _0x2ed7('0x2e'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x2f');break;case _0x2ed7('0x30'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x31');_0x3f2d59[_0x2ed7('0x16')]=[{'name':_0x2ed7('0x32'),'field':_0x2ed7('0xa'),'foreignKey':_0x2ed7('0x33'),'model':_0x2ed7('0x34'),'filter':{'field':_0x2ed7('0x35'),'value':[_0x2ed7('0x36')]}},{'name':_0x2ed7('0x37'),'field':_0x2ed7('0xa'),'foreignKey':_0x2ed7('0x33'),'model':'User','filter':{'field':_0x2ed7('0x35'),'value':[_0x2ed7('0x38')]}},{'name':_0x2ed7('0x39'),'field':_0x2ed7('0xa'),'foreignKey':_0x2ed7('0x3a'),'model':_0x2ed7('0x3b'),'filter':{'field':'type','value':['inbound']}},{'name':_0x2ed7('0x3c'),'field':_0x2ed7('0xa'),'foreignKey':_0x2ed7('0x3a'),'model':_0x2ed7('0x3b'),'filter':{'field':_0x2ed7('0x10'),'value':[_0x2ed7('0x3d')]}}];break;case'musiconholds':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x3e');break;case _0x2ed7('0x3f'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x40');break;case _0x2ed7('0x41'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x42');break;case'ivrcampaigns':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x43');break;case'mailqueues':_0x3f2d59[_0x2ed7('0x12')]='MailQueue';break;case _0x2ed7('0x44'):_0x3f2d59[_0x2ed7('0x12')]='MailAccount';break;case'mailsubstatuses':_0x3f2d59['childModel']=_0x2ed7('0x45');break;case _0x2ed7('0x46'):_0x3f2d59['childModel']=_0x2ed7('0x47');break;case _0x2ed7('0x48'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x49');break;case _0x2ed7('0x4a'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x4b');break;case'smsaccounts':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x4c');break;case _0x2ed7('0x4d'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x4e');break;case _0x2ed7('0x4f'):_0x3f2d59[_0x2ed7('0x12')]='WhatsappAccount';break;case'teams':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x50');break;case _0x2ed7('0x51'):case _0x2ed7('0x52'):_0x3f2d59[_0x2ed7('0x12')]='VoiceQueue';if(_0x6f287e){_0x3f2d59[_0x2ed7('0x16')]=[{'name':_0x2ed7('0x39')},{'name':_0x2ed7('0x3c')}];}break;case _0x2ed7('0x53'):case _0x2ed7('0x54'):case'telephones':_0x3f2d59['childModel']='User';if(_0x6f287e){_0x3f2d59['parentSections']=[{'name':'Users','filter':{'field':_0x2ed7('0x35'),'value':[_0x2ed7('0x55'),_0x2ed7('0x56')]},'ignore':!![]},{'name':_0x2ed7('0x32')},{'name':'Telephones'}];}break;case _0x2ed7('0x57'):_0x3f2d59['childModel']=_0x2ed7('0x58');break;case _0x2ed7('0x59'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x5a');break;case _0x2ed7('0x5b'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x5c');break;case _0x2ed7('0x5d'):_0x3f2d59['childModel']=_0x2ed7('0x5e');break;case _0x2ed7('0x5f'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x60');break;case _0x2ed7('0x61'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x62');break;case _0x2ed7('0x63'):_0x3f2d59[_0x2ed7('0x12')]='User';break;case _0x2ed7('0x64'):_0x3f2d59['childModel']=_0x2ed7('0x65');break;case _0x2ed7('0x66'):_0x3f2d59['childModel']='Disposition';break;case _0x2ed7('0x67'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x68');break;case'intervals':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x69');break;case'pauses':_0x3f2d59['childModel']=_0x2ed7('0x6a');break;case _0x2ed7('0x6b'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x6c');break;case'sounds':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x6d');break;case _0x2ed7('0x6e'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x6f');break;case _0x2ed7('0x70'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x71');break;case'triggers':_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x72');break;case _0x2ed7('0x73'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x74');break;case _0x2ed7('0x75'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x76');break;case _0x2ed7('0x77'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x78');break;case _0x2ed7('0x79'):_0x3f2d59['childModel']=_0x2ed7('0xe');_0x3f2d59['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x2ed7('0x7a')}];break;case _0x2ed7('0x7b'):_0x3f2d59[_0x2ed7('0x12')]=_0x2ed7('0x7c');break;}return _0x3f2d59;}function _0x539b8d(_0x335510,_0x3b36e9){var _0x3ca2a1=_0x335510['charAt'](0x0)[_0x2ed7('0x7d')]()+_0x335510[_0x2ed7('0x7e')](0x1);var _0x6bc8f4={'type':_0x4bb916[_0x2ed7('0x7f')][_0x2ed7('0x80')]['SELECT'],'raw':!![]};return new Promise(function(_0x166593,_0x2bd21d){var _0x15e7ce=squel['select']()[_0x2ed7('0x3')](_0x2ed7('0x81')+_0x3ca2a1+_0x2ed7('0x82'),'id')['field'](_0x2ed7('0x83'))[_0x2ed7('0x84')](_0x2ed7('0x85')+_0x335510+'_interactions','ui')[_0x2ed7('0x86')](_0x2ed7('0x87'),_0x3b36e9['id']);return _0x4bb916['sequelize'][_0x2ed7('0x88')](_0x15e7ce[_0x2ed7('0x89')](),_0x6bc8f4)['then'](function(_0x46abd6){_0x3b36e9[_0x3ca2a1+_0x2ed7('0x8a')]=_0x46abd6;_0x166593(_0x46abd6);})['catch'](function(_0x5037d3){_0x2bd21d(_0x5037d3);});});}return _0x4c4dad[_0x2ed7('0x8b')](_0x2ed7('0x8c'),attributes,{'tableName':_0x2ed7('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4bb92d){var _0x1c1200=require(_0x2ed7('0x8e'));var _0x5a80dd={'raw':_0x4bb92d[_0x2ed7('0x88')]['raw'],'where':{}};var _0x2c1c8e={};var _0x5eeb64={'count':0x0,'rows':[]};var _0x20745e=_0x4bb92d[_0x2ed7('0x88')]['section'];var _0x3cc080=_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0x8f')]||![];var _0x253b8f=_0x30f7a9(_0x20745e,_0x3cc080);if(!_0x253b8f[_0x2ed7('0x12')])throw new Error(_0x2ed7('0x90')+_0x20745e+'\x27');var _0x51052f=[{'name':_0x20745e}];if(!_[_0x2ed7('0x91')](_0x253b8f['parentSections']))_0x51052f=_0x253b8f[_0x2ed7('0x16')];var _0xe3a91c=[];for(var _0x18609f=0x0;_0x18609f<_0x51052f[_0x2ed7('0x92')];_0x18609f++){_0xe3a91c[_0x2ed7('0x93')](_0x4bb916[_0x2ed7('0x94')][_0x2ed7('0x95')]({'where':{'userProfileId':_0x4bb92d[_0x2ed7('0x96')]['id'],'name':_0x51052f[_0x18609f][_0x2ed7('0xa')]},'raw':!![]}));}return Promise['all'](_0xe3a91c)['then'](function(_0x3300ba){var _0x53bce5=_['filter'](_0x3300ba,function(_0x2b034c){return _0x2b034c?_0x2b034c:undefined;});var _0x2d0d3b=_[_0x2ed7('0x2')](_0x51052f,[_0x2ed7('0x97'),!![]]);var _0x5a5f92=_[_0x2ed7('0x91')](_0x53bce5)&&_['isEmpty'](_0x2d0d3b)?null:_[_0x2ed7('0x98')](_0x2d0d3b,_0x53bce5);if(!_0x5a5f92)return null;var _0xf38b96=[];for(var _0x30a695=0x0;_0x30a695<_0x5a5f92[_0x2ed7('0x92')];_0x30a695++){var _0x4090b2=_[_0x2ed7('0x95')](_0x51052f,function(_0x482ace){return _0x5a5f92[_0x30a695]?_0x482ace['name']===_0x5a5f92[_0x30a695]['name']:null;});if(_0x4090b2){if(_0x5a5f92[_0x30a695]['ignore']){_0xf38b96[_0x2ed7('0x93')](_0x1218a1(_0x253b8f[_0x2ed7('0x12')],_0x5a5f92[_0x30a695]));}else{if(!_0x5a5f92[_0x30a695][_0x2ed7('0x99')]){_0xf38b96['push'](_0x28e840(_0x4090b2,_0x5a5f92[_0x30a695],_0x253b8f[_0x2ed7('0x12')]));}else{if(_0x4090b2['model']){_0xf38b96['push'](_0x4c0043(_0x4090b2,_0x5a5f92[_0x30a695]));}}}}}return Promise[_0x2ed7('0x9a')](_0xf38b96);})['then'](function(_0x575f9d){var _0x144227=_0x575f9d;var _0x5cd942=null;if(_0x144227){_0x5cd942=_0x144227[_0x2ed7('0x92')]===0x1?_0x144227[0x0]:null;}if(!_0x5cd942&&!_0x144227)return _0x5eeb64;var _0x331de8=_0x4bb916[_0x253b8f[_0x2ed7('0x12')]][_0x2ed7('0x9b')];_0x2c1c8e[_0x2ed7('0x9')]=_[_0x2ed7('0x9c')](_0x331de8);_0x2c1c8e['query']=_[_0x2ed7('0x9c')](_0x4bb92d[_0x2ed7('0x88')]);_0x2c1c8e[_0x2ed7('0x9d')]=_[_0x2ed7('0x9e')](_0x2c1c8e['model'],_0x2c1c8e[_0x2ed7('0x88')]);_0x5a80dd[_0x2ed7('0x9f')]=_[_0x2ed7('0x9e')](_0x2c1c8e[_0x2ed7('0x9')],_0x1c1200[_0x2ed7('0xa0')](_0x4bb92d[_0x2ed7('0x88')]['fields']));_0x5a80dd['attributes']=_0x5a80dd['attributes'][_0x2ed7('0x92')]?_0x5a80dd[_0x2ed7('0x9f')]:_0x2c1c8e[_0x2ed7('0x9')];if(!_0x4bb92d['query']['hasOwnProperty'](_0x2ed7('0xa1'))){_0x5a80dd['limit']=_0x1c1200[_0x2ed7('0xa2')](_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xa2')]);_0x5a80dd[_0x2ed7('0xa3')]=_0x1c1200[_0x2ed7('0xa3')](_0x4bb92d['query'][_0x2ed7('0xa3')]);}_0x5a80dd['order']=_0x1c1200[_0x2ed7('0xa4')](_0x4bb92d['query']['sort']);_0x5a80dd[_0x2ed7('0x86')]=_0x1c1200[_0x2ed7('0x9d')](_[_0x2ed7('0xa5')](_0x4bb92d[_0x2ed7('0x88')],_0x2c1c8e[_0x2ed7('0x9d')]));if(_0x4bb92d[_0x2ed7('0x88')]['filter']){_0x5a80dd[_0x2ed7('0x86')]=_['merge'](_0x5a80dd['where'],{'$or':_['map'](_0x331de8,function(_0x30b1f8){if(_0x30b1f8[_0x2ed7('0x10')][_0x2ed7('0xa6')]!==_0x2ed7('0xa7')){var _0x4356a2={};_0x4356a2[_0x30b1f8['field']]={'$like':'%'+_0x4bb92d['query']['filter']+'%'};return _0x4356a2;}})});}var _0x39c5c3=[];var _0xa5f816=null;var _0x5e5402={};if(_0x5cd942){_0xa5f816=_[_0x2ed7('0x95')](_0x51052f,['name',_0x5cd942['name']]);if(_0xa5f816[_0x2ed7('0x3')]){_0x5e5402={};if(_0x253b8f[_0x2ed7('0x12')]===_0x2ed7('0xe')){_0x5e5402[_0xa5f816['foreignKey']]=_[_0x2ed7('0x8')](_0x5cd942['associatedResources'],'id');}else{_0x5e5402[_0xa5f816[_0x2ed7('0xa8')]]=_0x5cd942[_0x2ed7('0x7')];}_0x39c5c3[_0x2ed7('0x93')](_0x5e5402);}else{_0x5a80dd['where']['id']=_0x5cd942[_0x2ed7('0x7')];}}else{for(var _0x58b401=0x0;_0x58b401<_0x144227[_0x2ed7('0x92')];_0x58b401++){_0xa5f816=_[_0x2ed7('0x95')](_0x51052f,[_0x2ed7('0xa'),_0x144227[_0x58b401][_0x2ed7('0xa')]]);if(_0xa5f816[_0x2ed7('0x3')]){_0x5e5402={};_0x5e5402[_0xa5f816[_0x2ed7('0xa8')]]=_0x144227[_0x58b401][_0x2ed7('0x7')];_0x39c5c3['push'](_0x5e5402);}else{if(!_0x5a80dd['where']['id'])_0x5a80dd[_0x2ed7('0x86')]['id']=[];_0x144227[_0x58b401][_0x2ed7('0x7')][_0x2ed7('0xa9')](function(_0x2859b7){_0x5a80dd[_0x2ed7('0x86')]['id'][_0x2ed7('0x93')](_0x2859b7);});}}}if(!_['isEmpty'](_0x39c5c3)){_0x5a80dd['where']=_[_0x2ed7('0xaa')](_0x5a80dd['where'],{'$and':{'$or':_0x39c5c3}});}_0x5a80dd=_[_0x2ed7('0xaa')]({},_0x5a80dd,_0x4bb92d[_0x2ed7('0xab')]);if(_0x5cd942&&!_0x5cd942['autoAssociation']&&_0x253b8f[_0x2ed7('0x12')]==='AnalyticExtractedReport'){if(_0x4bb92d['query']['includeAll']){_0x5a80dd['include']=[{'all':!![]}];}return _0x4bb916[_0x253b8f[_0x2ed7('0x12')]][_0x2ed7('0x5')](_0x5a80dd)[_0x2ed7('0x6')](function(_0x1f4457){var _0x40a765=[];_0x1f4457[_0x2ed7('0xa9')](function(_0x40f22d){var _0x179925;switch(_0x40f22d['reportType']){case'default':_0x179925=_['find'](_0x5cd942[_0x2ed7('0x7')],function(_0x3d4cd5){return _0x3d4cd5['id']===_0x40f22d['reportId']&&_0x3d4cd5[_0x2ed7('0x10')]==='DefaultReports';});break;case'custom':_0x179925=_[_0x2ed7('0x95')](_0x5cd942[_0x2ed7('0x7')],function(_0x402b76){return _0x402b76['id']===_0x40f22d['reportId']&&_0x402b76[_0x2ed7('0x10')]===_0x2ed7('0xac');});break;}if(_0x179925)_0x40a765[_0x2ed7('0x93')](_0x40f22d);});_0x5eeb64[_0x2ed7('0xad')]=_0x40a765['length'];_0x5eeb64[_0x2ed7('0xae')]=_0x40a765;return _0x5eeb64;});}else{if(!_[_0x2ed7('0x91')](_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xaf')])){_0x5a80dd[_0x2ed7('0x86')]['id']=_0x5a80dd[_0x2ed7('0x86')]['id']?_[_0x2ed7('0x9e')](_0x5a80dd[_0x2ed7('0x86')]['id'],_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xaf')]):_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xaf')];if(_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xb0')]){_0x5a80dd[_0x2ed7('0xb1')]=_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xb0')];}}if(_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xb2')]){_0x5a80dd[_0x2ed7('0x86')]=_[_0x2ed7('0xaa')](_0x5a80dd[_0x2ed7('0x86')],{'$and':_0x4bb92d['query']['extraQueryConditions']});}return _0x4bb916[_0x253b8f[_0x2ed7('0x12')]][_0x2ed7('0xad')]({'where':_0x5a80dd[_0x2ed7('0x86')]})['then'](function(_0x213c9c){_0x5eeb64[_0x2ed7('0xad')]=_0x213c9c;if(_0x4bb92d['query'][_0x2ed7('0xb3')]){if(_0x253b8f[_0x2ed7('0x12')]===_0x2ed7('0x1b')){_0x5a80dd[_0x2ed7('0xb4')]=[{'model':_0x4bb916[_0x2ed7('0x6f')],'as':_0x2ed7('0xb5'),'attributes':['id',_0x2ed7('0xa'),_0x2ed7('0xb6')],'required':_0x4bb92d[_0x2ed7('0x88')]['tag']?!![]:![]},{'model':_0x4bb916[_0x2ed7('0x6f')],'as':_0x2ed7('0xb7'),'attributes':['id',_0x2ed7('0xa'),'color'],'through':_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xb8')]?{'attributes':[],'where':{'TagId':_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xb8')]||undefined}}:{},'required':_0x4bb92d['query'][_0x2ed7('0xb8')]?!![]:![]}];}else{_0x5a80dd[_0x2ed7('0xb4')]=[{'all':!![]}];}}return _0x4bb916[_0x253b8f['childModel']][_0x2ed7('0x5')](_0x5a80dd);})['then'](function(_0x1e974b){_0x5eeb64[_0x2ed7('0xae')]=_0x1e974b;if(_0x20745e===_0x2ed7('0x32')&&_0x4bb92d[_0x2ed7('0x88')][_0x2ed7('0xb9')]===_0x2ed7('0xba')){var _0x5813b4=[];for(var _0x5a5249=0x0;_0x5a5249<_0x5eeb64[_0x2ed7('0xae')][_0x2ed7('0x92')];_0x5a5249++){_0x5813b4['push'](_0x539b8d('chat',_0x5eeb64[_0x2ed7('0xae')][_0x5a5249][_0x2ed7('0xbb')]));_0x5813b4['push'](_0x539b8d(_0x2ed7('0xbc'),_0x5eeb64[_0x2ed7('0xae')][_0x5a5249][_0x2ed7('0xbb')]));_0x5813b4[_0x2ed7('0x93')](_0x539b8d('fax',_0x5eeb64['rows'][_0x5a5249]['dataValues']));_0x5813b4['push'](_0x539b8d(_0x2ed7('0xbd'),_0x5eeb64[_0x2ed7('0xae')][_0x5a5249][_0x2ed7('0xbb')]));_0x5813b4['push'](_0x539b8d(_0x2ed7('0xbe'),_0x5eeb64[_0x2ed7('0xae')][_0x5a5249][_0x2ed7('0xbb')]));_0x5813b4[_0x2ed7('0x93')](_0x539b8d(_0x2ed7('0xbf'),_0x5eeb64[_0x2ed7('0xae')][_0x5a5249][_0x2ed7('0xbb')]));}return Promise[_0x2ed7('0x9a')](_0x5813b4)[_0x2ed7('0x6')](function(){return _0x5eeb64;});}return _0x5eeb64;});}});}}});}; \ No newline at end of file +var _0xbb41=['SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Schedule','sounds','Tag','templates','Trigger','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','metrics','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','define','user_profiles','../../components/parsers/qs','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','autoAssociation','include','DefaultReports','reportId','count','ids','customSorting','extraQueryConditions','includeAll','CmContact','color','tag','rows','true','chat','dataValues','sms','mail','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','resourceId','type','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','chanspies','VoiceChanSpy','voiceprefixes','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount'];(function(_0x266cd6,_0x43c08e){var _0x3a8953=function(_0x23db2d){while(--_0x23db2d){_0x266cd6['push'](_0x266cd6['shift']());}};_0x3a8953(++_0x43c08e);}(_0xbb41,0x1c6));var _0x1bb4=function(_0x380a5a,_0x50f2e5){_0x380a5a=_0x380a5a-0x0;var _0xd47ac1=_0xbb41[_0x380a5a];return _0xd47ac1;};'use strict';var _=require(_0x1bb4('0x0'));var attributes=require(_0x1bb4('0x1'));var squel=require('squel');module[_0x1bb4('0x2')]=function(_0x52f141){var _0x3cdc4d=_0x52f141[_0x1bb4('0x3')];function _0x8e61a7(_0x47447f,_0x5df4eb){return new Promise(function(_0x129c75,_0xf0ae6){if(!_0x5df4eb)return _0x129c75(null);var _0x407468=_0x5df4eb[_0x1bb4('0x4')]?{[_0x5df4eb[_0x1bb4('0x4')][_0x1bb4('0x5')]]:_0x5df4eb['filter'][_0x1bb4('0x6')]}:undefined;return _0x3cdc4d[_0x47447f][_0x1bb4('0x7')]({'where':_0x407468,'raw':!![]})[_0x1bb4('0x8')](function(_0xb2ec2e){_0x5df4eb[_0x1bb4('0x9')]=_[_0x1bb4('0xa')](_0xb2ec2e,'id');_0x129c75(_0x5df4eb);})[_0x1bb4('0xb')](function(_0x4c731c){_0xf0ae6(_0x4c731c);});});}function _0x522512(_0x3b372d,_0x547621){return new Promise(function(_0x361629,_0x125c3c){var _0x32dee1=_0x3b372d[_0x1bb4('0x4')]?{[_0x3b372d['filter'][_0x1bb4('0x5')]]:_0x3b372d['filter'][_0x1bb4('0x6')]}:undefined;return _0x3cdc4d[_0x3b372d['model']][_0x1bb4('0x7')]({'where':_0x32dee1,'raw':!![]})['then'](function(_0x16cdad){_0x547621['associatedResources']=_[_0x1bb4('0xa')](_0x16cdad,function(_0x48677a){return _0x48677a[_0x1bb4('0xc')];});_0x361629(_0x547621);})[_0x1bb4('0xb')](function(_0x5037f8){_0x125c3c(_0x5037f8);});});}function _0x2d1bc1(_0x4f5d50,_0x161215,_0x3b7b6e){if(!_0x161215)return Promise[_0x1bb4('0xd')](null);return new Promise(function(_0x35f9e7,_0x4d7eb5){return _0x3cdc4d['UserProfileResource'][_0x1bb4('0x7')]({'where':{'sectionId':_0x161215['id']},'raw':!![]})[_0x1bb4('0x8')](function(_0x1b9599){if(_0x4f5d50['field']&&_0x4f5d50[_0x1bb4('0x5')]!=='id'){_0x161215[_0x1bb4('0x9')]=_[_0x1bb4('0xa')](_0x1b9599,function(_0x4ff4c3){return _0x4ff4c3[_0x4f5d50['field']];});}else{if(_0x3b7b6e==='AnalyticExtractedReport'){_0x161215['associatedResources']=_[_0x1bb4('0xa')](_0x1b9599,function(_0xf98da7){return{'id':_0xf98da7[_0x1bb4('0xe')],'type':_0xf98da7[_0x1bb4('0xf')]};});}else{_0x161215[_0x1bb4('0x9')]=_[_0x1bb4('0xa')](_0x1b9599,function(_0x19858b){return _0x19858b['resourceId'];});}}_0x35f9e7(_0x161215);})[_0x1bb4('0xb')](function(_0x4c743c){_0x4d7eb5(_0x4c743c);});});}function _0x24fd81(_0x5b44cf,_0x456bb9){var _0x464783={'parentSections':[]};switch(_0x5b44cf[_0x1bb4('0x10')]()){case'squareprojects':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x12');break;case _0x1bb4('0x13'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x14');break;case _0x1bb4('0x15'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x16');_0x464783[_0x1bb4('0x17')]=[{'name':_0x1bb4('0x18'),'field':_0x1bb4('0xc'),'foreignKey':_0x1bb4('0x19')}];break;case _0x1bb4('0x1a'):_0x464783['childModel']=_0x1bb4('0x1b');break;case _0x1bb4('0x1c'):_0x464783['childModel']='CmContact';_0x464783[_0x1bb4('0x17')]=[{'name':'Lists','field':'id','foreignKey':_0x1bb4('0x1d')}];break;case'lists':_0x464783['childModel']=_0x1bb4('0x1e');break;case'companies':_0x464783['childModel']=_0x1bb4('0x1f');break;case _0x1bb4('0x20'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x21');break;case _0x1bb4('0x22'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x23');break;case _0x1bb4('0x24'):_0x464783[_0x1bb4('0x11')]='ChatWebsite';break;case'faxqueues':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x25');break;case _0x1bb4('0x26'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x27');break;case _0x1bb4('0x28'):case'internalroutes':case _0x1bb4('0x29'):_0x464783['childModel']=_0x1bb4('0x2a');break;case _0x1bb4('0x2b'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x2c');break;case'voicemails':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x2d');break;case _0x1bb4('0x2e'):_0x464783['childModel']=_0x1bb4('0x2f');_0x464783[_0x1bb4('0x17')]=[{'name':_0x1bb4('0x30'),'field':_0x1bb4('0xc'),'foreignKey':'membername','model':_0x1bb4('0x31'),'filter':{'field':'role','value':[_0x1bb4('0x32')]}},{'name':_0x1bb4('0x33'),'field':_0x1bb4('0xc'),'foreignKey':_0x1bb4('0x34'),'model':'User','filter':{'field':_0x1bb4('0x35'),'value':[_0x1bb4('0x36')]}},{'name':_0x1bb4('0x37'),'field':_0x1bb4('0xc'),'foreignKey':_0x1bb4('0x38'),'model':_0x1bb4('0x39'),'filter':{'field':_0x1bb4('0xf'),'value':['inbound']}},{'name':_0x1bb4('0x3a'),'field':_0x1bb4('0xc'),'foreignKey':_0x1bb4('0x38'),'model':_0x1bb4('0x39'),'filter':{'field':'type','value':[_0x1bb4('0x3b')]}}];break;case'musiconholds':_0x464783[_0x1bb4('0x11')]='VoiceMusicOnHold';break;case _0x1bb4('0x3c'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x3d');break;case _0x1bb4('0x3e'):_0x464783[_0x1bb4('0x11')]='VoicePrefix';break;case'ivrcampaigns':_0x464783[_0x1bb4('0x11')]='Campaign';break;case _0x1bb4('0x3f'):_0x464783['childModel']=_0x1bb4('0x40');break;case _0x1bb4('0x41'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x42');break;case _0x1bb4('0x43'):_0x464783['childModel']=_0x1bb4('0x44');break;case _0x1bb4('0x45'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x46');break;case _0x1bb4('0x47'):_0x464783[_0x1bb4('0x11')]='OpenchannelAccount';break;case'smsqueues':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x48');break;case _0x1bb4('0x49'):_0x464783[_0x1bb4('0x11')]='SmsAccount';break;case'whatsappqueues':_0x464783[_0x1bb4('0x11')]='WhatsappQueue';break;case _0x1bb4('0x4a'):_0x464783[_0x1bb4('0x11')]='WhatsappAccount';break;case _0x1bb4('0x4b'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x4c');break;case _0x1bb4('0x4d'):case'queuecampaigns':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x39');if(_0x456bb9){_0x464783[_0x1bb4('0x17')]=[{'name':_0x1bb4('0x37')},{'name':_0x1bb4('0x3a')}];}break;case _0x1bb4('0x4e'):case _0x1bb4('0x4f'):case _0x1bb4('0x50'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x31');if(_0x456bb9){_0x464783[_0x1bb4('0x17')]=[{'name':_0x1bb4('0x51'),'filter':{'field':_0x1bb4('0x35'),'value':['admin',_0x1bb4('0x52')]},'ignore':!![]},{'name':_0x1bb4('0x30')},{'name':_0x1bb4('0x33')}];}break;case _0x1bb4('0x53'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x54');break;case _0x1bb4('0x55'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x56');break;case _0x1bb4('0x57'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x58');break;case'sugarcrmaccounts':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x59');break;case _0x1bb4('0x5a'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x5b');break;case _0x1bb4('0x5c'):_0x464783['childModel']=_0x1bb4('0x5d');break;case _0x1bb4('0x5e'):_0x464783['childModel']=_0x1bb4('0x31');break;case _0x1bb4('0x5f'):_0x464783['childModel']='CannedAnswer';break;case _0x1bb4('0x60'):_0x464783[_0x1bb4('0x11')]='Disposition';break;case _0x1bb4('0x61'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x62');break;case _0x1bb4('0x63'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x64');break;case _0x1bb4('0x65'):_0x464783[_0x1bb4('0x11')]='Pause';break;case'scheduler':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x66');break;case _0x1bb4('0x67'):_0x464783[_0x1bb4('0x11')]='Sound';break;case'tags':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x68');break;case _0x1bb4('0x69'):_0x464783['childModel']='Template';break;case'triggers':_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x6a');break;case'trunks':_0x464783[_0x1bb4('0x11')]='Trunk';break;case _0x1bb4('0x6b'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x6c');break;case _0x1bb4('0x6d'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x6e');break;case _0x1bb4('0x6f'):_0x464783[_0x1bb4('0x11')]=_0x1bb4('0x70');_0x464783[_0x1bb4('0x17')]=[{'name':_0x1bb4('0x71'),'field':'id','foreignKey':'reportId'}];break;case _0x1bb4('0x72'):_0x464783[_0x1bb4('0x11')]='AnalyticMetric';break;}return _0x464783;}function _0x9c9ed9(_0x4bd7b4,_0x167776){var _0x5ea2ba=_0x4bd7b4[_0x1bb4('0x73')](0x0)[_0x1bb4('0x74')]()+_0x4bd7b4[_0x1bb4('0x75')](0x1);var _0x4dc932={'type':_0x3cdc4d['Sequelize'][_0x1bb4('0x76')][_0x1bb4('0x77')],'raw':!![]};return new Promise(function(_0x15c226,_0x2fad53){var _0x598fbd=squel[_0x1bb4('0x78')]()[_0x1bb4('0x5')](_0x1bb4('0x79')+_0x5ea2ba+_0x1bb4('0x7a'),'id')[_0x1bb4('0x5')](_0x1bb4('0x7b'))[_0x1bb4('0x7c')](_0x1bb4('0x7d')+_0x4bd7b4+_0x1bb4('0x7e'),'ui')[_0x1bb4('0x7f')]('ui.UserId\x20=\x20?',_0x167776['id']);return _0x3cdc4d[_0x1bb4('0x80')][_0x1bb4('0x81')](_0x598fbd[_0x1bb4('0x82')](),_0x4dc932)['then'](function(_0x4a8dfb){_0x167776[_0x5ea2ba+'OpenTabs']=_0x4a8dfb;_0x15c226(_0x4a8dfb);})[_0x1bb4('0xb')](function(_0x45cd7a){_0x2fad53(_0x45cd7a);});});}return _0x52f141[_0x1bb4('0x83')]('UserProfile',attributes,{'tableName':_0x1bb4('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2227d9){var _0x4a42ad=require(_0x1bb4('0x85'));var _0x5345ac={'raw':_0x2227d9[_0x1bb4('0x81')]['raw'],'where':{}};var _0x141e6e={};var _0x266311={'count':0x0,'rows':[]};var _0x2203de=_0x2227d9['query']['section'];var _0x4887a9=_0x2227d9[_0x1bb4('0x81')]['mergeResources']||![];var _0x18a06b=_0x24fd81(_0x2203de,_0x4887a9);if(!_0x18a06b[_0x1bb4('0x11')])throw new Error(_0x1bb4('0x86')+_0x2203de+'\x27');var _0x452323=[{'name':_0x2203de}];if(!_[_0x1bb4('0x87')](_0x18a06b['parentSections']))_0x452323=_0x18a06b[_0x1bb4('0x17')];var _0x436c9c=[];for(var _0x38f059=0x0;_0x38f059<_0x452323[_0x1bb4('0x88')];_0x38f059++){_0x436c9c[_0x1bb4('0x89')](_0x3cdc4d['UserProfileSection'][_0x1bb4('0x8a')]({'where':{'userProfileId':_0x2227d9[_0x1bb4('0x8b')]['id'],'name':_0x452323[_0x38f059][_0x1bb4('0xc')]},'raw':!![]}));}return Promise[_0x1bb4('0x8c')](_0x436c9c)[_0x1bb4('0x8')](function(_0x2495ff){var _0x50f699=_[_0x1bb4('0x4')](_0x2495ff,function(_0x17a394){return _0x17a394?_0x17a394:undefined;});var _0x2bfa09=_[_0x1bb4('0x4')](_0x452323,[_0x1bb4('0x8d'),!![]]);var _0x4d3db1=_[_0x1bb4('0x87')](_0x50f699)&&_[_0x1bb4('0x87')](_0x2bfa09)?null:_[_0x1bb4('0x8e')](_0x2bfa09,_0x50f699);if(!_0x4d3db1)return null;var _0x340aa3=[];for(var _0x14cf12=0x0;_0x14cf12<_0x4d3db1[_0x1bb4('0x88')];_0x14cf12++){var _0x12ac81=_[_0x1bb4('0x8a')](_0x452323,function(_0x5bb680){return _0x4d3db1[_0x14cf12]?_0x5bb680[_0x1bb4('0xc')]===_0x4d3db1[_0x14cf12][_0x1bb4('0xc')]:null;});if(_0x12ac81){if(_0x4d3db1[_0x14cf12]['ignore']){_0x340aa3[_0x1bb4('0x89')](_0x8e61a7(_0x18a06b[_0x1bb4('0x11')],_0x4d3db1[_0x14cf12]));}else{if(!_0x4d3db1[_0x14cf12]['autoAssociation']){_0x340aa3[_0x1bb4('0x89')](_0x2d1bc1(_0x12ac81,_0x4d3db1[_0x14cf12],_0x18a06b[_0x1bb4('0x11')]));}else{if(_0x12ac81[_0x1bb4('0x8f')]){_0x340aa3[_0x1bb4('0x89')](_0x522512(_0x12ac81,_0x4d3db1[_0x14cf12]));}}}}}return Promise['all'](_0x340aa3);})[_0x1bb4('0x8')](function(_0x15e887){var _0xf8462b=_0x15e887;var _0x2f721b=null;if(_0xf8462b){_0x2f721b=_0xf8462b[_0x1bb4('0x88')]===0x1?_0xf8462b[0x0]:null;}if(!_0x2f721b&&!_0xf8462b)return _0x266311;var _0x44dd6e=_0x3cdc4d[_0x18a06b[_0x1bb4('0x11')]][_0x1bb4('0x90')];_0x141e6e['model']=_[_0x1bb4('0x91')](_0x44dd6e);_0x141e6e['query']=_['keys'](_0x2227d9[_0x1bb4('0x81')]);_0x141e6e[_0x1bb4('0x92')]=_[_0x1bb4('0x93')](_0x141e6e[_0x1bb4('0x8f')],_0x141e6e['query']);_0x5345ac[_0x1bb4('0x94')]=_[_0x1bb4('0x93')](_0x141e6e['model'],_0x4a42ad[_0x1bb4('0x95')](_0x2227d9['query']['fields']));_0x5345ac['attributes']=_0x5345ac['attributes']['length']?_0x5345ac[_0x1bb4('0x94')]:_0x141e6e[_0x1bb4('0x8f')];if(!_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0x96')]('nolimit')){_0x5345ac[_0x1bb4('0x97')]=_0x4a42ad[_0x1bb4('0x97')](_0x2227d9[_0x1bb4('0x81')]['limit']);_0x5345ac[_0x1bb4('0x98')]=_0x4a42ad[_0x1bb4('0x98')](_0x2227d9[_0x1bb4('0x81')]['offset']);}_0x5345ac[_0x1bb4('0x99')]=_0x4a42ad[_0x1bb4('0x9a')](_0x2227d9[_0x1bb4('0x81')]['sort']);_0x5345ac[_0x1bb4('0x7f')]=_0x4a42ad[_0x1bb4('0x92')](_[_0x1bb4('0x9b')](_0x2227d9[_0x1bb4('0x81')],_0x141e6e[_0x1bb4('0x92')]));if(_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0x4')]){_0x5345ac[_0x1bb4('0x7f')]=_['merge'](_0x5345ac[_0x1bb4('0x7f')],{'$or':_[_0x1bb4('0xa')](_0x44dd6e,function(_0x28ca13){if(_0x28ca13[_0x1bb4('0xf')][_0x1bb4('0x9c')]!==_0x1bb4('0x9d')){var _0x508a97={};_0x508a97[_0x28ca13[_0x1bb4('0x5')]]={'$like':'%'+_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0x4')]+'%'};return _0x508a97;}})});}var _0x15e624=[];var _0x252feb=null;var _0x2c805d={};if(_0x2f721b){_0x252feb=_['find'](_0x452323,['name',_0x2f721b[_0x1bb4('0xc')]]);if(_0x252feb['field']){_0x2c805d={};if(_0x18a06b[_0x1bb4('0x11')]===_0x1bb4('0x70')){_0x2c805d[_0x252feb['foreignKey']]=_['map'](_0x2f721b[_0x1bb4('0x9')],'id');}else{_0x2c805d[_0x252feb[_0x1bb4('0x9e')]]=_0x2f721b['associatedResources'];}_0x15e624[_0x1bb4('0x89')](_0x2c805d);}else{_0x5345ac[_0x1bb4('0x7f')]['id']=_0x2f721b[_0x1bb4('0x9')];}}else{for(var _0x287918=0x0;_0x287918<_0xf8462b['length'];_0x287918++){_0x252feb=_[_0x1bb4('0x8a')](_0x452323,['name',_0xf8462b[_0x287918][_0x1bb4('0xc')]]);if(_0x252feb[_0x1bb4('0x5')]){_0x2c805d={};_0x2c805d[_0x252feb[_0x1bb4('0x9e')]]=_0xf8462b[_0x287918][_0x1bb4('0x9')];_0x15e624[_0x1bb4('0x89')](_0x2c805d);}else{if(!_0x5345ac['where']['id'])_0x5345ac[_0x1bb4('0x7f')]['id']=[];_0xf8462b[_0x287918][_0x1bb4('0x9')][_0x1bb4('0x9f')](function(_0x4756c8){_0x5345ac[_0x1bb4('0x7f')]['id']['push'](_0x4756c8);});}}}if(!_[_0x1bb4('0x87')](_0x15e624)){_0x5345ac[_0x1bb4('0x7f')]=_['merge'](_0x5345ac['where'],{'$and':{'$or':_0x15e624}});}_0x5345ac=_[_0x1bb4('0xa0')]({},_0x5345ac,_0x2227d9[_0x1bb4('0xa1')]);if(_0x2f721b&&!_0x2f721b[_0x1bb4('0xa2')]&&_0x18a06b[_0x1bb4('0x11')]===_0x1bb4('0x70')){if(_0x2227d9['query']['includeAll']){_0x5345ac[_0x1bb4('0xa3')]=[{'all':!![]}];}return _0x3cdc4d[_0x18a06b['childModel']]['findAll'](_0x5345ac)[_0x1bb4('0x8')](function(_0x19d4a5){var _0x827f5b=[];_0x19d4a5[_0x1bb4('0x9f')](function(_0x590405){var _0x395e33;switch(_0x590405['reportType']){case'default':_0x395e33=_[_0x1bb4('0x8a')](_0x2f721b[_0x1bb4('0x9')],function(_0x42cdee){return _0x42cdee['id']===_0x590405['reportId']&&_0x42cdee['type']===_0x1bb4('0xa4');});break;case'custom':_0x395e33=_[_0x1bb4('0x8a')](_0x2f721b['associatedResources'],function(_0x4490b3){return _0x4490b3['id']===_0x590405[_0x1bb4('0xa5')]&&_0x4490b3[_0x1bb4('0xf')]==='CustomReports';});break;}if(_0x395e33)_0x827f5b[_0x1bb4('0x89')](_0x590405);});_0x266311[_0x1bb4('0xa6')]=_0x827f5b[_0x1bb4('0x88')];_0x266311['rows']=_0x827f5b;return _0x266311;});}else{if(!_[_0x1bb4('0x87')](_0x2227d9[_0x1bb4('0x81')]['ids'])){_0x5345ac['where']['id']=_0x5345ac[_0x1bb4('0x7f')]['id']?_[_0x1bb4('0x93')](_0x5345ac[_0x1bb4('0x7f')]['id'],_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0xa7')]):_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0xa7')];if(_0x2227d9[_0x1bb4('0x81')]['customSorting']){_0x5345ac['order']=_0x2227d9['query'][_0x1bb4('0xa8')];}}if(_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0xa9')]){_0x5345ac[_0x1bb4('0x7f')]=_['merge'](_0x5345ac[_0x1bb4('0x7f')],{'$and':_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0xa9')]});}return _0x3cdc4d[_0x18a06b[_0x1bb4('0x11')]][_0x1bb4('0xa6')]({'where':_0x5345ac[_0x1bb4('0x7f')]})['then'](function(_0x53762d){_0x266311[_0x1bb4('0xa6')]=_0x53762d;if(_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0xaa')]){if(_0x18a06b['childModel']===_0x1bb4('0xab')){_0x5345ac['include']=[{'model':_0x3cdc4d[_0x1bb4('0x68')],'as':'Tags','attributes':['id','name',_0x1bb4('0xac')],'required':_0x2227d9['query'][_0x1bb4('0xad')]?!![]:![]},{'model':_0x3cdc4d[_0x1bb4('0x68')],'as':'ThroughTags','attributes':['id',_0x1bb4('0xc'),_0x1bb4('0xac')],'through':_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0xad')]?{'attributes':[],'where':{'TagId':_0x2227d9[_0x1bb4('0x81')][_0x1bb4('0xad')]||undefined}}:{},'required':_0x2227d9['query'][_0x1bb4('0xad')]?!![]:![]}];}else{_0x5345ac['include']=[{'all':!![]}];}}return _0x3cdc4d[_0x18a06b[_0x1bb4('0x11')]][_0x1bb4('0x7')](_0x5345ac);})[_0x1bb4('0x8')](function(_0x18b113){_0x266311[_0x1bb4('0xae')]=_0x18b113;if(_0x2203de==='Agents'&&_0x2227d9['query']['openTabs']===_0x1bb4('0xaf')){var _0x9fc774=[];for(var _0x1d325b=0x0;_0x1d325b<_0x266311[_0x1bb4('0xae')][_0x1bb4('0x88')];_0x1d325b++){_0x9fc774[_0x1bb4('0x89')](_0x9c9ed9(_0x1bb4('0xb0'),_0x266311[_0x1bb4('0xae')][_0x1d325b][_0x1bb4('0xb1')]));_0x9fc774[_0x1bb4('0x89')](_0x9c9ed9(_0x1bb4('0xb2'),_0x266311['rows'][_0x1d325b][_0x1bb4('0xb1')]));_0x9fc774['push'](_0x9c9ed9('fax',_0x266311[_0x1bb4('0xae')][_0x1d325b]['dataValues']));_0x9fc774[_0x1bb4('0x89')](_0x9c9ed9(_0x1bb4('0xb3'),_0x266311[_0x1bb4('0xae')][_0x1d325b][_0x1bb4('0xb1')]));_0x9fc774[_0x1bb4('0x89')](_0x9c9ed9('openchannel',_0x266311[_0x1bb4('0xae')][_0x1d325b]['dataValues']));_0x9fc774[_0x1bb4('0x89')](_0x9c9ed9(_0x1bb4('0xb4'),_0x266311[_0x1bb4('0xae')][_0x1d325b][_0x1bb4('0xb1')]));}return Promise[_0x1bb4('0x8c')](_0x9fc774)[_0x1bb4('0x8')](function(){return _0x266311;});}return _0x266311;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 8d760d3..a431550 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 _0x9505=['request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s'];(function(_0x42d29e,_0x41553a){var _0x3c3546=function(_0x166000){while(--_0x166000){_0x42d29e['push'](_0x42d29e['shift']());}};_0x3c3546(++_0x41553a);}(_0x9505,0x1e5));var _0x5950=function(_0x17c833,_0x219a7b){_0x17c833=_0x17c833-0x0;var _0x3f3ddd=_0x9505[_0x17c833];return _0x3f3ddd;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var moment=require('moment');var BPromise=require(_0x5950('0x2'));var rs=require(_0x5950('0x3'));var fs=require('fs');var Redis=require(_0x5950('0x4'));var db=require(_0x5950('0x5'))['db'];var utils=require(_0x5950('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5950('0x7'));var jayson=require(_0x5950('0x8'));var client=jayson[_0x5950('0x9')][_0x5950('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5950('0xb')],{'host':_0x5950('0xc'),'port':0x18eb});var socket=require(_0x5950('0xd'))(new Redis(config[_0x5950('0xb')]));require(_0x5950('0xe'))[_0x5950('0xf')](socket);function respondWithRpcPromise(_0x1148ef,_0x213e3b,_0x1c8f39){return new BPromise(function(_0x5ef4ab,_0x32f2e0){return client[_0x5950('0x10')](_0x1148ef,_0x1c8f39)['then'](function(_0x5a6098){logger[_0x5950('0x11')](_0x5950('0x12'),_0x213e3b,_0x5950('0x13'));logger[_0x5950('0x14')](_0x5950('0x15'),_0x213e3b,_0x5950('0x13'),JSON[_0x5950('0x16')](_0x5a6098));if(_0x5a6098[_0x5950('0x17')]){if(_0x5a6098[_0x5950('0x17')][_0x5950('0x18')]===0x1f4){logger[_0x5950('0x17')](_0x5950('0x12'),_0x213e3b,_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);return _0x32f2e0(_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);}logger[_0x5950('0x17')](_0x5950('0x12'),_0x213e3b,_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);return _0x5ef4ab(_0x5a6098[_0x5950('0x17')]['message']);}else{logger['info'](_0x5950('0x12'),_0x213e3b,_0x5950('0x13'));_0x5ef4ab(_0x5a6098[_0x5950('0x1a')][_0x5950('0x19')]);}})[_0x5950('0x1b')](function(_0x483aaf){logger['error'](_0x5950('0x12'),_0x213e3b,_0x483aaf);_0x32f2e0(_0x483aaf);});});} \ No newline at end of file +var _0xff01=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5db0db,_0x1c585a){var _0x3fbd1a=function(_0x590e6a){while(--_0x590e6a){_0x5db0db['push'](_0x5db0db['shift']());}};_0x3fbd1a(++_0x1c585a);}(_0xff01,0xb7));var _0x1ff0=function(_0x32b78d,_0x32595c){_0x32b78d=_0x32b78d-0x0;var _0x34ee90=_0xff01[_0x32b78d];return _0x34ee90;};'use strict';var _=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var moment=require('moment');var BPromise=require(_0x1ff0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ff0('0x3'));var db=require(_0x1ff0('0x4'))['db'];var utils=require(_0x1ff0('0x5'));var logger=require('../../config/logger')(_0x1ff0('0x6'));var config=require('../../config/environment');var jayson=require(_0x1ff0('0x7'));var client=jayson['client'][_0x1ff0('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1ff0('0x9')],{'host':_0x1ff0('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ff0('0x9')]));require(_0x1ff0('0xb'))[_0x1ff0('0xc')](socket);function respondWithRpcPromise(_0x200b69,_0xa163fc,_0x52a6ff){return new BPromise(function(_0xcf03ac,_0x5d46af){return client[_0x1ff0('0xd')](_0x200b69,_0x52a6ff)[_0x1ff0('0xe')](function(_0xb498fb){logger[_0x1ff0('0xf')](_0x1ff0('0x10'),_0xa163fc,_0x1ff0('0x11'));logger[_0x1ff0('0x12')](_0x1ff0('0x13'),_0xa163fc,_0x1ff0('0x11'),JSON[_0x1ff0('0x14')](_0xb498fb));if(_0xb498fb['error']){if(_0xb498fb[_0x1ff0('0x15')][_0x1ff0('0x16')]===0x1f4){logger[_0x1ff0('0x15')](_0x1ff0('0x10'),_0xa163fc,_0xb498fb['error'][_0x1ff0('0x17')]);return _0x5d46af(_0xb498fb[_0x1ff0('0x15')]['message']);}logger[_0x1ff0('0x15')](_0x1ff0('0x10'),_0xa163fc,_0xb498fb[_0x1ff0('0x15')]['message']);return _0xcf03ac(_0xb498fb['error'][_0x1ff0('0x17')]);}else{logger[_0x1ff0('0xf')]('UserProfile,\x20%s,\x20%s',_0xa163fc,_0x1ff0('0x11'));_0xcf03ac(_0xb498fb[_0x1ff0('0x18')][_0x1ff0('0x17')]);}})[_0x1ff0('0x19')](function(_0x580215){logger['error']('UserProfile,\x20%s,\x20%s',_0xa163fc,_0x580215);_0x5d46af(_0x580215);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e936173..e2c902a 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 _0xc805=['remove','update','emit','register','userProfile:','./userProfile.events','save'];(function(_0x56506b,_0x253392){var _0x5de60c=function(_0x2c9b28){while(--_0x2c9b28){_0x56506b['push'](_0x56506b['shift']());}};_0x5de60c(++_0x253392);}(_0xc805,0x163));var _0x5c80=function(_0x39cad6,_0x1edf41){_0x39cad6=_0x39cad6-0x0;var _0x5a82f2=_0xc805[_0x39cad6];return _0x5a82f2;};'use strict';var UserProfileEvents=require(_0x5c80('0x0'));var events=[_0x5c80('0x1'),_0x5c80('0x2'),_0x5c80('0x3')];function createListener(_0x54c47a,_0x4cdd38){return function(_0x385681){_0x4cdd38[_0x5c80('0x4')](_0x54c47a,_0x385681);};}function removeListener(_0x3aee25,_0x48e641){return function(){UserProfileEvents['removeListener'](_0x3aee25,_0x48e641);};}exports[_0x5c80('0x5')]=function(_0x11d964){for(var _0x3489cf=0x0,_0x5b57d9=events['length'];_0x3489cf<_0x5b57d9;_0x3489cf++){var _0x5ba1c4=events[_0x3489cf];var _0x4d3889=createListener(_0x5c80('0x6')+_0x5ba1c4,_0x11d964);UserProfileEvents['on'](_0x5ba1c4,_0x4d3889);}}; \ No newline at end of file +var _0x7fa9=['removeListener','register','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x478edd,_0x5d8cf8){var _0x479429=function(_0x595eb9){while(--_0x595eb9){_0x478edd['push'](_0x478edd['shift']());}};_0x479429(++_0x5d8cf8);}(_0x7fa9,0x103));var _0x97fa=function(_0x1a79bb,_0x27d95d){_0x1a79bb=_0x1a79bb-0x0;var _0x3058de=_0x7fa9[_0x1a79bb];return _0x3058de;};'use strict';var UserProfileEvents=require(_0x97fa('0x0'));var events=[_0x97fa('0x1'),_0x97fa('0x2'),_0x97fa('0x3')];function createListener(_0x3959d9,_0x42490c){return function(_0x37b359){_0x42490c[_0x97fa('0x4')](_0x3959d9,_0x37b359);};}function removeListener(_0x4183f2,_0x33f570){return function(){UserProfileEvents[_0x97fa('0x5')](_0x4183f2,_0x33f570);};}exports[_0x97fa('0x6')]=function(_0x20a28e){for(var _0x213f8d=0x0,_0x223756=events['length'];_0x213f8d<_0x223756;_0x213f8d++){var _0x2634ef=events[_0x213f8d];var _0x965486=createListener(_0x97fa('0x7')+_0x2634ef,_0x20a28e);UserProfileEvents['on'](_0x2634ef,_0x965486);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1034f6a..0f68067 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 _0x3813=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x1634a3,_0x130089){var _0x218f3f=function(_0x5c099f){while(--_0x5c099f){_0x1634a3['push'](_0x1634a3['shift']());}};_0x218f3f(++_0x130089);}(_0x3813,0x171));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3381('0x0'));var util=require('util');var path=require(_0x3381('0x1'));var timeout=require(_0x3381('0x2'));var express=require(_0x3381('0x3'));var router=express[_0x3381('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3381('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3381('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3381('0x7')]);router[_0x3381('0x8')](_0x3381('0x9'),auth[_0x3381('0xa')](),controller[_0x3381('0xb')]);router[_0x3381('0x8')](_0x3381('0xc'),auth[_0x3381('0xa')](),controller[_0x3381('0xd')]);router[_0x3381('0xe')]('/',auth[_0x3381('0xa')](),controller[_0x3381('0xf')]);router['put'](_0x3381('0xc'),auth[_0x3381('0xa')](),controller[_0x3381('0x10')]);router[_0x3381('0x11')]('/:id',auth[_0x3381('0xa')](),controller[_0x3381('0x12')]);module[_0x3381('0x13')]=router; \ No newline at end of file +var _0xdf15=['/describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xdf15,0x185));var _0x5df1=function(_0x2a3311,_0x272275){_0x2a3311=_0x2a3311-0x0;var _0x1143a=_0xdf15[_0x2a3311];return _0x1143a;};'use strict';var multer=require(_0x5df1('0x0'));var util=require(_0x5df1('0x1'));var path=require(_0x5df1('0x2'));var timeout=require(_0x5df1('0x3'));var express=require('express');var router=express[_0x5df1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5df1('0x5'));var config=require('../../config/environment');var controller=require(_0x5df1('0x6'));router[_0x5df1('0x7')]('/',auth[_0x5df1('0x8')](),controller[_0x5df1('0x9')]);router[_0x5df1('0x7')](_0x5df1('0xa'),auth[_0x5df1('0x8')](),controller['describe']);router[_0x5df1('0x7')](_0x5df1('0xb'),auth['isAuthenticated'](),controller[_0x5df1('0xc')]);router[_0x5df1('0xd')]('/',auth[_0x5df1('0x8')](),controller[_0x5df1('0xe')]);router[_0x5df1('0xf')]('/:id',auth[_0x5df1('0x8')](),controller[_0x5df1('0x10')]);router[_0x5df1('0x11')](_0x5df1('0xb'),auth[_0x5df1('0x8')](),controller['destroy']);module[_0x5df1('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6955213..c4d996a 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 _0x7793=['STRING','sequelize','exports'];(function(_0x54e348,_0xc1f87f){var _0x21f143=function(_0x20365e){while(--_0x20365e){_0x54e348['push'](_0x54e348['shift']());}};_0x21f143(++_0xc1f87f);}(_0x7793,0x1b1));var _0x3779=function(_0x352059,_0x1cdc6f){_0x352059=_0x352059-0x0;var _0x4545b5=_0x7793[_0x352059];return _0x4545b5;};'use strict';var Sequelize=require(_0x3779('0x0'));module[_0x3779('0x1')]={'name':{'type':Sequelize[_0x3779('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x3779('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb4a3=['exports','STRING'];(function(_0x5cf31d,_0x159233){var _0x3a157a=function(_0x5cd18f){while(--_0x5cd18f){_0x5cf31d['push'](_0x5cf31d['shift']());}};_0x3a157a(++_0x159233);}(_0xb4a3,0x168));var _0x3b4a=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb4a3[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require('sequelize');module[_0x3b4a('0x0')]={'name':{'type':Sequelize[_0x3b4a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x3b4a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 5c903b4..75e5408 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 _0x66fa=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','UserProfileResource','findAll','rows','catch','merge','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x66fa,0x117));var _0xa66f=function(_0x4e9ac2,_0x34d3a8){_0x4e9ac2=_0x4e9ac2-0x0;var _0x29a64f=_0x66fa[_0x4e9ac2];return _0x29a64f;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['UserProfileResource'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['UserProfileResource'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['UserProfileResource'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['UserProfileResource'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));};exports[_0xa66f('0x4a')]=function(_0x5d77d1,_0x389b9a){return db['UserProfileResource'][_0xa66f('0x4a')]()['then'](respondWithResult(_0x389b9a,null))['catch'](handleError(_0x389b9a,null));}; \ No newline at end of file +var _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x51a001,_0x3669b9){_0x51a001=_0x51a001-0x0;var _0x31b1f3=_0x9f0e[_0x51a001];return _0x31b1f3;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d536adf..9a7d3f6 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 _0xf87f=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x4e2d5b,_0x556caf){var _0x50278e=function(_0x13a7b5){while(--_0x13a7b5){_0x4e2d5b['push'](_0x4e2d5b['shift']());}};_0x50278e(++_0x556caf);}(_0xf87f,0x184));var _0xff87=function(_0x369e27,_0x44751c){_0x369e27=_0x369e27-0x0;var _0x251f35=_0xf87f[_0x369e27];return _0x251f35;};'use strict';var _=require(_0xff87('0x0'));var util=require(_0xff87('0x1'));var logger=require(_0xff87('0x2'))(_0xff87('0x3'));var moment=require(_0xff87('0x4'));var BPromise=require(_0xff87('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff87('0x6'));var rimraf=require(_0xff87('0x7'));var config=require(_0xff87('0x8'));var attributes=require(_0xff87('0x9'));module[_0xff87('0xa')]=function(_0x4d03f7,_0x5a6fdd){return _0x4d03f7[_0xff87('0xb')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xff87('0xc'),'fields':[_0xff87('0xd'),_0xff87('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82c2=['path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b2b2b,_0xce00a8){var _0x23067d=function(_0x3d92ae){while(--_0x3d92ae){_0x4b2b2b['push'](_0x4b2b2b['shift']());}};_0x23067d(++_0xce00a8);}(_0x82c2,0x1c9));var _0x282c=function(_0x2f52d1,_0x36e3b1){_0x2f52d1=_0x2f52d1-0x0;var _0x3f9871=_0x82c2[_0x2f52d1];return _0x3f9871;};'use strict';var _=require(_0x282c('0x0'));var util=require(_0x282c('0x1'));var logger=require(_0x282c('0x2'))(_0x282c('0x3'));var moment=require(_0x282c('0x4'));var BPromise=require(_0x282c('0x5'));var rp=require(_0x282c('0x6'));var fs=require('fs');var path=require(_0x282c('0x7'));var rimraf=require(_0x282c('0x8'));var config=require(_0x282c('0x9'));var attributes=require(_0x282c('0xa'));module[_0x282c('0xb')]=function(_0x536fa4,_0x26c115){return _0x536fa4[_0x282c('0xc')](_0x282c('0xd'),attributes,{'tableName':_0x282c('0xe'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x282c('0xf'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 1e92f48..559b6fc 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 _0x2c6a=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','randomstring'];(function(_0x4188ae,_0x1b28b7){var _0x4e66bf=function(_0x1f73d5){while(--_0x1f73d5){_0x4188ae['push'](_0x4188ae['shift']());}};_0x4e66bf(++_0x1b28b7);}(_0x2c6a,0x174));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa2c6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa2c6('0x1'));var fs=require('fs');var Redis=require(_0xa2c6('0x2'));var db=require(_0xa2c6('0x3'))['db'];var utils=require(_0xa2c6('0x4'));var logger=require('../../config/logger')(_0xa2c6('0x5'));var config=require('../../config/environment');var jayson=require(_0xa2c6('0x6'));var client=jayson[_0xa2c6('0x7')][_0xa2c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2caa7b,_0x57190f,_0x3b74e9){return new BPromise(function(_0x1ad09f,_0x581bb3){return client[_0xa2c6('0x9')](_0x2caa7b,_0x3b74e9)[_0xa2c6('0xa')](function(_0x175f0b){logger[_0xa2c6('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x57190f,'request\x20sent');logger[_0xa2c6('0xc')](_0xa2c6('0xd'),_0x57190f,_0xa2c6('0xe'),JSON[_0xa2c6('0xf')](_0x175f0b));if(_0x175f0b[_0xa2c6('0x10')]){if(_0x175f0b[_0xa2c6('0x10')][_0xa2c6('0x11')]===0x1f4){logger[_0xa2c6('0x10')](_0xa2c6('0x12'),_0x57190f,_0x175f0b['error'][_0xa2c6('0x13')]);return _0x581bb3(_0x175f0b[_0xa2c6('0x10')][_0xa2c6('0x13')]);}logger[_0xa2c6('0x10')](_0xa2c6('0x12'),_0x57190f,_0x175f0b[_0xa2c6('0x10')]['message']);return _0x1ad09f(_0x175f0b[_0xa2c6('0x10')][_0xa2c6('0x13')]);}else{logger[_0xa2c6('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x57190f,_0xa2c6('0xe'));_0x1ad09f(_0x175f0b[_0xa2c6('0x14')][_0xa2c6('0x13')]);}})[_0xa2c6('0x15')](function(_0x3af18e){logger[_0xa2c6('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x57190f,_0x3af18e);_0x581bb3(_0x3af18e);});});} \ No newline at end of file +var _0x9873=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53ff36,_0x5066f2){var _0x4a0e2b=function(_0x204527){while(--_0x204527){_0x53ff36['push'](_0x53ff36['shift']());}};_0x4a0e2b(++_0x5066f2);}(_0x9873,0x119));var _0x3987=function(_0x5e1ab5,_0x2fcd4a){_0x5e1ab5=_0x5e1ab5-0x0;var _0xb9cc2f=_0x9873[_0x5e1ab5];return _0xb9cc2f;};'use strict';var _=require(_0x3987('0x0'));var util=require('util');var moment=require(_0x3987('0x1'));var BPromise=require(_0x3987('0x2'));var rs=require(_0x3987('0x3'));var fs=require('fs');var Redis=require(_0x3987('0x4'));var db=require(_0x3987('0x5'))['db'];var utils=require(_0x3987('0x6'));var logger=require(_0x3987('0x7'))(_0x3987('0x8'));var config=require('../../config/environment');var jayson=require(_0x3987('0x9'));var client=jayson[_0x3987('0xa')][_0x3987('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x110354,_0x4dbea6,_0x414433){return new BPromise(function(_0x335e58,_0x36625d){return client[_0x3987('0xc')](_0x110354,_0x414433)[_0x3987('0xd')](function(_0x453a18){logger[_0x3987('0xe')](_0x3987('0xf'),_0x4dbea6,_0x3987('0x10'));logger[_0x3987('0x11')](_0x3987('0x12'),_0x4dbea6,'request\x20sent',JSON[_0x3987('0x13')](_0x453a18));if(_0x453a18[_0x3987('0x14')]){if(_0x453a18[_0x3987('0x14')][_0x3987('0x15')]===0x1f4){logger['error'](_0x3987('0xf'),_0x4dbea6,_0x453a18[_0x3987('0x14')][_0x3987('0x16')]);return _0x36625d(_0x453a18[_0x3987('0x14')][_0x3987('0x16')]);}logger[_0x3987('0x14')](_0x3987('0xf'),_0x4dbea6,_0x453a18['error']['message']);return _0x335e58(_0x453a18['error'][_0x3987('0x16')]);}else{logger[_0x3987('0xe')](_0x3987('0xf'),_0x4dbea6,'request\x20sent');_0x335e58(_0x453a18['result'][_0x3987('0x16')]);}})[_0x3987('0x17')](function(_0x30d67c){logger[_0x3987('0x14')](_0x3987('0xf'),_0x4dbea6,_0x30d67c);_0x36625d(_0x30d67c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b16ead9..610ab8a 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 _0xfda9=['../../config/environment','./userProfileSection.controller','get','index','describe','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x55b806,_0x5e0671){var _0x1571d6=function(_0x31749e){while(--_0x31749e){_0x55b806['push'](_0x55b806['shift']());}};_0x1571d6(++_0x5e0671);}(_0xfda9,0x189));var _0x9fda=function(_0x59799d,_0x2c54bf){_0x59799d=_0x59799d-0x0;var _0x159c01=_0xfda9[_0x59799d];return _0x159c01;};'use strict';var multer=require(_0x9fda('0x0'));var util=require(_0x9fda('0x1'));var path=require(_0x9fda('0x2'));var timeout=require('connect-timeout');var express=require(_0x9fda('0x3'));var router=express[_0x9fda('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9fda('0x5'));var config=require(_0x9fda('0x6'));var controller=require(_0x9fda('0x7'));router[_0x9fda('0x8')]('/',auth['isAuthenticated'](),controller[_0x9fda('0x9')]);router[_0x9fda('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9fda('0xa')]);router[_0x9fda('0x8')](_0x9fda('0xb'),auth[_0x9fda('0xc')](),controller[_0x9fda('0xd')]);router['post']('/',auth[_0x9fda('0xc')](),controller[_0x9fda('0xe')]);router[_0x9fda('0xf')]('/:id',auth[_0x9fda('0xc')](),controller[_0x9fda('0x10')]);router[_0x9fda('0x11')](_0x9fda('0xb'),auth[_0x9fda('0xc')](),controller['destroy']);module[_0x9fda('0x12')]=router; \ No newline at end of file +var _0x908a=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','put','/:id','update','destroy','exports','multer','util'];(function(_0x85a944,_0xbf35e8){var _0x441ec7=function(_0x3d0ec0){while(--_0x3d0ec0){_0x85a944['push'](_0x85a944['shift']());}};_0x441ec7(++_0xbf35e8);}(_0x908a,0x142));var _0xa908=function(_0x13784b,_0x2e0911){_0x13784b=_0x13784b-0x0;var _0x1aa6fe=_0x908a[_0x13784b];return _0x1aa6fe;};'use strict';var multer=require(_0xa908('0x0'));var util=require(_0xa908('0x1'));var path=require(_0xa908('0x2'));var timeout=require(_0xa908('0x3'));var express=require('express');var router=express[_0xa908('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa908('0x5'));var interaction=require(_0xa908('0x6'));var config=require(_0xa908('0x7'));var controller=require('./userProfileSection.controller');router[_0xa908('0x8')]('/',auth[_0xa908('0x9')](),controller[_0xa908('0xa')]);router['get'](_0xa908('0xb'),auth[_0xa908('0x9')](),controller['describe']);router[_0xa908('0x8')]('/:id',auth[_0xa908('0x9')](),controller[_0xa908('0xc')]);router['post']('/',auth[_0xa908('0x9')](),controller['create']);router[_0xa908('0xd')](_0xa908('0xe'),auth[_0xa908('0x9')](),controller[_0xa908('0xf')]);router['delete'](_0xa908('0xe'),auth[_0xa908('0x9')](),controller[_0xa908('0x10')]);module[_0xa908('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0f5f12a..408f4f4 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 _0x84a0=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x84a0,0x66));var _0x084a=function(_0x88fbcc,_0x2b462b){_0x88fbcc=_0x88fbcc-0x0;var _0x4c9dc2=_0x84a0[_0x88fbcc];return _0x4c9dc2;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'name':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x084a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x084a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x58a814){this[_0x084a('0x4')](_0x084a('0x5'),_0x58a814?_0x58a814['join'](''):[]);},'get':function(){return this[_0x084a('0x6')](_0x084a('0x5'))?this[_0x084a('0x6')](_0x084a('0x5'))[_0x084a('0x7')](''):[];}}}; \ No newline at end of file +var _0xbaf0=['split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x3250f3,_0x1cd63e){var _0x2c5c69=function(_0x440092){while(--_0x440092){_0x3250f3['push'](_0x3250f3['shift']());}};_0x2c5c69(++_0x1cd63e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x232cc7){this[_0x0baf('0x4')](_0x0baf('0x5'),_0x232cc7?_0x232cc7[_0x0baf('0x6')](''):[]);},'get':function(){return this[_0x0baf('0x7')](_0x0baf('0x5'))?this[_0x0baf('0x7')](_0x0baf('0x5'))[_0x0baf('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e412281..0c353b7 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 _0x94e4=['limit','undefined','count','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94e4,0x152));var _0x494e=function(_0x2f8d92,_0x409384){_0x2f8d92=_0x2f8d92-0x0;var _0x50f69e=_0x94e4[_0x2f8d92];return _0x50f69e;};'use strict';var emlformat=require(_0x494e('0x0'));var rimraf=require(_0x494e('0x1'));var zipdir=require(_0x494e('0x2'));var jsonpatch=require(_0x494e('0x3'));var rp=require('request-promise');var moment=require(_0x494e('0x4'));var BPromise=require(_0x494e('0x5'));var Mustache=require(_0x494e('0x6'));var util=require(_0x494e('0x7'));var path=require(_0x494e('0x8'));var sox=require(_0x494e('0x9'));var csv=require(_0x494e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x494e('0xb'));var _=require(_0x494e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x494e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x494e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x494e('0xe'));var authService=require(_0x494e('0xf'));var qs=require(_0x494e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x494e('0x11'));var logger=require(_0x494e('0x12'))(_0x494e('0x13'));var utils=require(_0x494e('0x14'));var config=require(_0x494e('0x15'));var licenseUtil=require(_0x494e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe620c4,_0x11f72d){_0x11f72d=_0x11f72d||0xcc;return function(_0xe5f65a){if(_0xe5f65a){return _0xe620c4['sendStatus'](_0x11f72d);}return _0xe620c4['status'](_0x11f72d)[_0x494e('0x17')]();};}function respondWithResult(_0x2e2177,_0x42288e){_0x42288e=_0x42288e||0xc8;return function(_0x2a1f02){if(_0x2a1f02){return _0x2e2177[_0x494e('0x18')](_0x42288e)[_0x494e('0x19')](_0x2a1f02);}};}function respondWithFilteredResult(_0x4e3b12,_0x3c719d){return function(_0x1fb024){if(_0x1fb024){var _0x4c86f0=typeof _0x3c719d[_0x494e('0x1a')]==='undefined'&&typeof _0x3c719d[_0x494e('0x1b')]===_0x494e('0x1c');var _0x1b3b30=_0x1fb024['count'];var _0x54c279=_0x4c86f0?0x0:_0x3c719d[_0x494e('0x1a')];var _0x4adf33=_0x4c86f0?_0x1fb024[_0x494e('0x1d')]:_0x3c719d[_0x494e('0x1a')]+_0x3c719d['limit'];var _0x7ad118;if(_0x4adf33>=_0x1b3b30){_0x4adf33=_0x1b3b30;_0x7ad118=0xc8;}else{_0x7ad118=0xce;}_0x4e3b12[_0x494e('0x18')](_0x7ad118);return _0x4e3b12['set']('Content-Range',_0x54c279+'-'+_0x4adf33+'/'+_0x1b3b30)[_0x494e('0x19')](_0x1fb024);}return null;};}function patchUpdates(_0x2a37a9){return function(_0x562c7d){try{jsonpatch[_0x494e('0x1e')](_0x562c7d,_0x2a37a9,!![]);}catch(_0x4c5a72){return BPromise[_0x494e('0x1f')](_0x4c5a72);}return _0x562c7d['save']();};}function saveUpdates(_0x298091,_0x2e1c1b){return function(_0x382461){if(_0x382461){return _0x382461[_0x494e('0x20')](_0x298091)[_0x494e('0x21')](function(_0x24845f){return _0x24845f;});}return null;};}function removeEntity(_0x5b88c6,_0x528952){return function(_0x3bf2b5){if(_0x3bf2b5){return _0x3bf2b5[_0x494e('0x22')]()[_0x494e('0x21')](function(){_0x5b88c6[_0x494e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b57b,_0x144152){return function(_0x2baeb4){if(!_0x2baeb4){_0x35b57b[_0x494e('0x23')](0x194);}return _0x2baeb4;};}function handleError(_0x486e5f,_0xf47ab0){_0xf47ab0=_0xf47ab0||0x1f4;return function(_0x3c55b7){logger[_0x494e('0x24')](_0x3c55b7[_0x494e('0x25')]);if(_0x3c55b7[_0x494e('0x26')]){delete _0x3c55b7[_0x494e('0x26')];}_0x486e5f[_0x494e('0x18')](_0xf47ab0)['send'](_0x3c55b7);};}exports[_0x494e('0x27')]=function(_0x336953,_0x2ea787){var _0x1fd7db={},_0x3042a3={},_0x545e53={'count':0x0,'rows':[]};var _0x4033a1=_['map'](db['UserProfileSection']['rawAttributes'],function(_0x4982ed){return{'name':_0x4982ed[_0x494e('0x28')],'type':_0x4982ed[_0x494e('0x29')][_0x494e('0x2a')]};});_0x3042a3[_0x494e('0x2b')]=_['map'](_0x4033a1,'name');_0x3042a3[_0x494e('0x2c')]=_[_0x494e('0x2d')](_0x336953['query']);_0x3042a3[_0x494e('0x2e')]=_[_0x494e('0x2f')](_0x3042a3[_0x494e('0x2b')],_0x3042a3[_0x494e('0x2c')]);_0x1fd7db[_0x494e('0x30')]=_[_0x494e('0x2f')](_0x3042a3[_0x494e('0x2b')],qs[_0x494e('0x31')](_0x336953[_0x494e('0x2c')][_0x494e('0x31')]));_0x1fd7db[_0x494e('0x30')]=_0x1fd7db[_0x494e('0x30')][_0x494e('0x32')]?_0x1fd7db[_0x494e('0x30')]:_0x3042a3[_0x494e('0x2b')];if(!_0x336953[_0x494e('0x2c')][_0x494e('0x33')](_0x494e('0x34'))){_0x1fd7db[_0x494e('0x1b')]=qs[_0x494e('0x1b')](_0x336953[_0x494e('0x2c')][_0x494e('0x1b')]);_0x1fd7db[_0x494e('0x1a')]=qs[_0x494e('0x1a')](_0x336953[_0x494e('0x2c')]['offset']);}_0x1fd7db[_0x494e('0x35')]=qs['sort'](_0x336953[_0x494e('0x2c')][_0x494e('0x36')]);_0x1fd7db['where']=qs['filters'](_[_0x494e('0x37')](_0x336953[_0x494e('0x2c')],_0x3042a3['filters']),_0x4033a1);if(_0x336953[_0x494e('0x2c')][_0x494e('0x38')]){_0x1fd7db[_0x494e('0x39')]=_['merge'](_0x1fd7db[_0x494e('0x39')],{'$or':_['map'](_0x4033a1,function(_0x51f8c0){if(_0x51f8c0[_0x494e('0x29')]!=='VIRTUAL'){var _0x327f44={};_0x327f44[_0x51f8c0[_0x494e('0x26')]]={'$like':'%'+_0x336953[_0x494e('0x2c')][_0x494e('0x38')]+'%'};return _0x327f44;}})});}_0x1fd7db=_[_0x494e('0x3a')]({},_0x1fd7db,_0x336953['options']);var _0x104176={'where':_0x1fd7db[_0x494e('0x39')]};return db[_0x494e('0x3b')][_0x494e('0x1d')](_0x104176)['then'](function(_0x18eba5){_0x545e53['count']=_0x18eba5;if(_0x336953[_0x494e('0x2c')][_0x494e('0x3c')]){_0x1fd7db[_0x494e('0x3d')]=[{'all':!![]}];}return db[_0x494e('0x3b')][_0x494e('0x3e')](_0x1fd7db);})['then'](function(_0x4e1186){_0x545e53[_0x494e('0x3f')]=_0x4e1186;return _0x545e53;})[_0x494e('0x21')](respondWithFilteredResult(_0x2ea787,_0x1fd7db))[_0x494e('0x40')](handleError(_0x2ea787,null));};exports[_0x494e('0x41')]=function(_0xa1de07,_0x243e34){var _0x22ce7d={'raw':![],'where':{'id':_0xa1de07[_0x494e('0x42')]['id']}},_0x14754f={};_0x14754f[_0x494e('0x2b')]=_[_0x494e('0x2d')](db['UserProfileSection'][_0x494e('0x43')]);_0x14754f[_0x494e('0x2c')]=_[_0x494e('0x2d')](_0xa1de07[_0x494e('0x2c')]);_0x14754f[_0x494e('0x2e')]=_[_0x494e('0x2f')](_0x14754f[_0x494e('0x2b')],_0x14754f[_0x494e('0x2c')]);_0x22ce7d[_0x494e('0x30')]=_[_0x494e('0x2f')](_0x14754f['model'],qs[_0x494e('0x31')](_0xa1de07[_0x494e('0x2c')][_0x494e('0x31')]));_0x22ce7d[_0x494e('0x30')]=_0x22ce7d[_0x494e('0x30')][_0x494e('0x32')]?_0x22ce7d[_0x494e('0x30')]:_0x14754f[_0x494e('0x2b')];if(_0xa1de07['query']['includeAll']){_0x22ce7d[_0x494e('0x3d')]=[{'all':!![]}];}_0x22ce7d=_[_0x494e('0x3a')]({},_0x22ce7d,_0xa1de07[_0x494e('0x44')]);return db[_0x494e('0x3b')][_0x494e('0x45')](_0x22ce7d)[_0x494e('0x21')](handleEntityNotFound(_0x243e34,null))[_0x494e('0x21')](respondWithResult(_0x243e34,null))[_0x494e('0x40')](handleError(_0x243e34,null));};exports['create']=function(_0x3a9802,_0x21dbf3){return db[_0x494e('0x3b')][_0x494e('0x46')](_0x3a9802[_0x494e('0x47')],{})[_0x494e('0x21')](respondWithResult(_0x21dbf3,0xc9))[_0x494e('0x40')](handleError(_0x21dbf3,null));};exports[_0x494e('0x20')]=function(_0x11b14f,_0x232491){if(_0x11b14f[_0x494e('0x47')]['id']){delete _0x11b14f[_0x494e('0x47')]['id'];}return db[_0x494e('0x3b')][_0x494e('0x45')]({'where':{'id':_0x11b14f[_0x494e('0x42')]['id']}})['then'](handleEntityNotFound(_0x232491,null))['then'](saveUpdates(_0x11b14f[_0x494e('0x47')],null))['then'](respondWithResult(_0x232491,null))['catch'](handleError(_0x232491,null));};exports[_0x494e('0x22')]=function(_0x4d4950,_0x2fc93a){return db[_0x494e('0x3b')][_0x494e('0x45')]({'where':{'id':_0x4d4950['params']['id']}})[_0x494e('0x21')](handleEntityNotFound(_0x2fc93a,null))[_0x494e('0x21')](removeEntity(_0x2fc93a,null))[_0x494e('0x40')](handleError(_0x2fc93a,null));};exports[_0x494e('0x48')]=function(_0x18bb91,_0x5180b8){return db[_0x494e('0x3b')][_0x494e('0x48')]()[_0x494e('0x21')](respondWithResult(_0x5180b8,null))['catch'](handleError(_0x5180b8,null));}; \ No newline at end of file +var _0xd8c8=['where','merge','VIRTUAL','options','includeAll','include','show','params','intersection','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','UserProfileSection','rawAttributes','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','filters','pick','filter'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xd8c8,0x175));var _0x8d8c=function(_0x314029,_0x134824){_0x314029=_0x314029-0x0;var _0x11a61d=_0xd8c8[_0x314029];return _0x11a61d;};'use strict';var emlformat=require(_0x8d8c('0x0'));var rimraf=require(_0x8d8c('0x1'));var zipdir=require(_0x8d8c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d8c('0x3'));var moment=require('moment');var BPromise=require(_0x8d8c('0x4'));var Mustache=require(_0x8d8c('0x5'));var util=require(_0x8d8c('0x6'));var path=require(_0x8d8c('0x7'));var sox=require(_0x8d8c('0x8'));var csv=require(_0x8d8c('0x9'));var ejs=require(_0x8d8c('0xa'));var fs=require('fs');var fs_extra=require(_0x8d8c('0xb'));var _=require(_0x8d8c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8d8c('0xd'));var deskjs=require(_0x8d8c('0xe'));var toCsv=require(_0x8d8c('0x9'));var querystring=require(_0x8d8c('0xf'));var Papa=require(_0x8d8c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8d8c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d8c('0x12'));var logger=require(_0x8d8c('0x13'))(_0x8d8c('0x14'));var utils=require(_0x8d8c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8d8c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e651e,_0x1d54c0){_0x1d54c0=_0x1d54c0||0xcc;return function(_0x235f92){if(_0x235f92){return _0x2e651e[_0x8d8c('0x17')](_0x1d54c0);}return _0x2e651e[_0x8d8c('0x18')](_0x1d54c0)['end']();};}function respondWithResult(_0x38edf3,_0x23fc44){_0x23fc44=_0x23fc44||0xc8;return function(_0x5318f6){if(_0x5318f6){return _0x38edf3[_0x8d8c('0x18')](_0x23fc44)[_0x8d8c('0x19')](_0x5318f6);}};}function respondWithFilteredResult(_0x21d982,_0xad5826){return function(_0x59164f){if(_0x59164f){var _0x2685d2=typeof _0xad5826[_0x8d8c('0x1a')]===_0x8d8c('0x1b')&&typeof _0xad5826[_0x8d8c('0x1c')]===_0x8d8c('0x1b');var _0xcfb0ff=_0x59164f[_0x8d8c('0x1d')];var _0x2be063=_0x2685d2?0x0:_0xad5826[_0x8d8c('0x1a')];var _0x439373=_0x2685d2?_0x59164f[_0x8d8c('0x1d')]:_0xad5826['offset']+_0xad5826['limit'];var _0x5f3ebf;if(_0x439373>=_0xcfb0ff){_0x439373=_0xcfb0ff;_0x5f3ebf=0xc8;}else{_0x5f3ebf=0xce;}_0x21d982[_0x8d8c('0x18')](_0x5f3ebf);return _0x21d982[_0x8d8c('0x1e')]('Content-Range',_0x2be063+'-'+_0x439373+'/'+_0xcfb0ff)[_0x8d8c('0x19')](_0x59164f);}return null;};}function patchUpdates(_0x59b6f3){return function(_0x3c8637){try{jsonpatch[_0x8d8c('0x1f')](_0x3c8637,_0x59b6f3,!![]);}catch(_0x262367){return BPromise[_0x8d8c('0x20')](_0x262367);}return _0x3c8637[_0x8d8c('0x21')]();};}function saveUpdates(_0x31dd36,_0x5c56a9){return function(_0x392529){if(_0x392529){return _0x392529[_0x8d8c('0x22')](_0x31dd36)['then'](function(_0x454c4d){return _0x454c4d;});}return null;};}function removeEntity(_0x370d2a,_0x52f05c){return function(_0x4b8b76){if(_0x4b8b76){return _0x4b8b76[_0x8d8c('0x23')]()[_0x8d8c('0x24')](function(){_0x370d2a[_0x8d8c('0x18')](0xcc)[_0x8d8c('0x25')]();});}};}function handleEntityNotFound(_0x188441,_0x20b486){return function(_0x24e15b){if(!_0x24e15b){_0x188441[_0x8d8c('0x17')](0x194);}return _0x24e15b;};}function handleError(_0x1d66db,_0x488dd7){_0x488dd7=_0x488dd7||0x1f4;return function(_0x28d286){logger[_0x8d8c('0x26')](_0x28d286[_0x8d8c('0x27')]);if(_0x28d286[_0x8d8c('0x28')]){delete _0x28d286[_0x8d8c('0x28')];}_0x1d66db[_0x8d8c('0x18')](_0x488dd7)[_0x8d8c('0x29')](_0x28d286);};}exports[_0x8d8c('0x2a')]=function(_0x36b217,_0x565f93){var _0x5a3b76={},_0x277907={},_0x5ed635={'count':0x0,'rows':[]};var _0x14255e=_['map'](db[_0x8d8c('0x2b')][_0x8d8c('0x2c')],function(_0x37f043){return{'name':_0x37f043['fieldName'],'type':_0x37f043[_0x8d8c('0x2d')][_0x8d8c('0x2e')]};});_0x277907[_0x8d8c('0x2f')]=_['map'](_0x14255e,_0x8d8c('0x28'));_0x277907[_0x8d8c('0x30')]=_[_0x8d8c('0x31')](_0x36b217['query']);_0x277907['filters']=_['intersection'](_0x277907[_0x8d8c('0x2f')],_0x277907[_0x8d8c('0x30')]);_0x5a3b76['attributes']=_['intersection'](_0x277907[_0x8d8c('0x2f')],qs[_0x8d8c('0x32')](_0x36b217[_0x8d8c('0x30')]['fields']));_0x5a3b76[_0x8d8c('0x33')]=_0x5a3b76[_0x8d8c('0x33')][_0x8d8c('0x34')]?_0x5a3b76[_0x8d8c('0x33')]:_0x277907[_0x8d8c('0x2f')];if(!_0x36b217[_0x8d8c('0x30')]['hasOwnProperty'](_0x8d8c('0x35'))){_0x5a3b76[_0x8d8c('0x1c')]=qs[_0x8d8c('0x1c')](_0x36b217[_0x8d8c('0x30')][_0x8d8c('0x1c')]);_0x5a3b76[_0x8d8c('0x1a')]=qs[_0x8d8c('0x1a')](_0x36b217[_0x8d8c('0x30')][_0x8d8c('0x1a')]);}_0x5a3b76[_0x8d8c('0x36')]=qs[_0x8d8c('0x37')](_0x36b217['query'][_0x8d8c('0x37')]);_0x5a3b76['where']=qs[_0x8d8c('0x38')](_[_0x8d8c('0x39')](_0x36b217[_0x8d8c('0x30')],_0x277907['filters']),_0x14255e);if(_0x36b217[_0x8d8c('0x30')][_0x8d8c('0x3a')]){_0x5a3b76[_0x8d8c('0x3b')]=_[_0x8d8c('0x3c')](_0x5a3b76[_0x8d8c('0x3b')],{'$or':_['map'](_0x14255e,function(_0x5166ad){if(_0x5166ad[_0x8d8c('0x2d')]!==_0x8d8c('0x3d')){var _0x170113={};_0x170113[_0x5166ad[_0x8d8c('0x28')]]={'$like':'%'+_0x36b217[_0x8d8c('0x30')]['filter']+'%'};return _0x170113;}})});}_0x5a3b76=_[_0x8d8c('0x3c')]({},_0x5a3b76,_0x36b217[_0x8d8c('0x3e')]);var _0x2c35e9={'where':_0x5a3b76[_0x8d8c('0x3b')]};return db['UserProfileSection']['count'](_0x2c35e9)[_0x8d8c('0x24')](function(_0x12134a){_0x5ed635[_0x8d8c('0x1d')]=_0x12134a;if(_0x36b217[_0x8d8c('0x30')][_0x8d8c('0x3f')]){_0x5a3b76[_0x8d8c('0x40')]=[{'all':!![]}];}return db[_0x8d8c('0x2b')]['findAll'](_0x5a3b76);})[_0x8d8c('0x24')](function(_0x5b7354){_0x5ed635['rows']=_0x5b7354;return _0x5ed635;})['then'](respondWithFilteredResult(_0x565f93,_0x5a3b76))['catch'](handleError(_0x565f93,null));};exports[_0x8d8c('0x41')]=function(_0x261e2f,_0x534772){var _0x2410a7={'raw':![],'where':{'id':_0x261e2f[_0x8d8c('0x42')]['id']}},_0x2976ad={};_0x2976ad[_0x8d8c('0x2f')]=_[_0x8d8c('0x31')](db['UserProfileSection']['rawAttributes']);_0x2976ad[_0x8d8c('0x30')]=_[_0x8d8c('0x31')](_0x261e2f[_0x8d8c('0x30')]);_0x2976ad[_0x8d8c('0x38')]=_[_0x8d8c('0x43')](_0x2976ad[_0x8d8c('0x2f')],_0x2976ad[_0x8d8c('0x30')]);_0x2410a7['attributes']=_[_0x8d8c('0x43')](_0x2976ad[_0x8d8c('0x2f')],qs['fields'](_0x261e2f['query'][_0x8d8c('0x32')]));_0x2410a7[_0x8d8c('0x33')]=_0x2410a7[_0x8d8c('0x33')][_0x8d8c('0x34')]?_0x2410a7['attributes']:_0x2976ad[_0x8d8c('0x2f')];if(_0x261e2f['query']['includeAll']){_0x2410a7[_0x8d8c('0x40')]=[{'all':!![]}];}_0x2410a7=_['merge']({},_0x2410a7,_0x261e2f[_0x8d8c('0x3e')]);return db[_0x8d8c('0x2b')]['find'](_0x2410a7)['then'](handleEntityNotFound(_0x534772,null))[_0x8d8c('0x24')](respondWithResult(_0x534772,null))['catch'](handleError(_0x534772,null));};exports[_0x8d8c('0x44')]=function(_0x44b63c,_0x49d7ac){return db[_0x8d8c('0x2b')][_0x8d8c('0x44')](_0x44b63c[_0x8d8c('0x45')],{})[_0x8d8c('0x24')](respondWithResult(_0x49d7ac,0xc9))[_0x8d8c('0x46')](handleError(_0x49d7ac,null));};exports[_0x8d8c('0x22')]=function(_0x37183d,_0x5a7436){if(_0x37183d['body']['id']){delete _0x37183d[_0x8d8c('0x45')]['id'];}return db[_0x8d8c('0x2b')]['find']({'where':{'id':_0x37183d[_0x8d8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a7436,null))[_0x8d8c('0x24')](saveUpdates(_0x37183d[_0x8d8c('0x45')],null))[_0x8d8c('0x24')](respondWithResult(_0x5a7436,null))[_0x8d8c('0x46')](handleError(_0x5a7436,null));};exports[_0x8d8c('0x23')]=function(_0x3e03b8,_0x2ca96e){return db[_0x8d8c('0x2b')][_0x8d8c('0x47')]({'where':{'id':_0x3e03b8[_0x8d8c('0x42')]['id']}})[_0x8d8c('0x24')](handleEntityNotFound(_0x2ca96e,null))[_0x8d8c('0x24')](removeEntity(_0x2ca96e,null))[_0x8d8c('0x46')](handleError(_0x2ca96e,null));};exports['describe']=function(_0xdd05b4,_0x5e34cf){return db['UserProfileSection']['describe']()[_0x8d8c('0x24')](respondWithResult(_0x5e34cf,null))['catch'](handleError(_0x5e34cf,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 7f1266e..00b9906 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 _0xc04a=['exports','define','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x47b972,_0x51d417){var _0x4f6f19=function(_0x9da193){while(--_0x9da193){_0x47b972['push'](_0x47b972['shift']());}};_0x4f6f19(++_0x51d417);}(_0xc04a,0xd7));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac04('0x0'));var util=require(_0xac04('0x1'));var logger=require(_0xac04('0x2'))(_0xac04('0x3'));var moment=require(_0xac04('0x4'));var BPromise=require(_0xac04('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac04('0x6'));var rimraf=require(_0xac04('0x7'));var config=require(_0xac04('0x8'));var attributes=require('./userProfileSection.attributes');module[_0xac04('0x9')]=function(_0x544f9d,_0x37cc77){return _0x544f9d[_0xac04('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xac04('0xb'),'fields':[_0xac04('0xc'),_0xac04('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc7b4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','user_profile_has_sections','compositeIndex','userProfileId','lodash'];(function(_0xd7fe21,_0x578f2c){var _0x2eed96=function(_0x5e5908){while(--_0x5e5908){_0xd7fe21['push'](_0xd7fe21['shift']());}};_0x2eed96(++_0x578f2c);}(_0xc7b4,0x9b));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c7b('0x0'));var util=require(_0x4c7b('0x1'));var logger=require(_0x4c7b('0x2'))(_0x4c7b('0x3'));var moment=require(_0x4c7b('0x4'));var BPromise=require(_0x4c7b('0x5'));var rp=require(_0x4c7b('0x6'));var fs=require('fs');var path=require(_0x4c7b('0x7'));var rimraf=require(_0x4c7b('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x4c7b('0x9')]=function(_0x8ebf5e,_0x185a15){return _0x8ebf5e['define']('UserProfileSection',attributes,{'tableName':_0x4c7b('0xa'),'paranoid':![],'indexes':[{'name':_0x4c7b('0xb'),'fields':['sectionId',_0x4c7b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 7df4918..9029cfd 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 _0x0abf=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0abf,0x13f));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xf0ab('0x0'));var moment=require(_0xf0ab('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0ab('0x2'));var db=require(_0xf0ab('0x3'))['db'];var utils=require(_0xf0ab('0x4'));var logger=require('../../config/logger')(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a779e,_0x2a08ed,_0x2f68a7){return new BPromise(function(_0x317236,_0x29a463){return client[_0xf0ab('0xa')](_0x4a779e,_0x2f68a7)[_0xf0ab('0xb')](function(_0x8b5a6e){logger[_0xf0ab('0xc')](_0xf0ab('0xd'),_0x2a08ed,_0xf0ab('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2a08ed,_0xf0ab('0xe'),JSON['stringify'](_0x8b5a6e));if(_0x8b5a6e[_0xf0ab('0xf')]){if(_0x8b5a6e[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xd'),_0x2a08ed,_0x8b5a6e['error'][_0xf0ab('0x11')]);return _0x29a463(_0x8b5a6e[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xd'),_0x2a08ed,_0x8b5a6e['error'][_0xf0ab('0x11')]);return _0x317236(_0x8b5a6e['error']['message']);}else{logger[_0xf0ab('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x2a08ed,_0xf0ab('0xe'));_0x317236(_0x8b5a6e[_0xf0ab('0x12')][_0xf0ab('0x11')]);}})[_0xf0ab('0x13')](function(_0x2626c7){logger[_0xf0ab('0xf')](_0xf0ab('0xd'),_0x2a08ed,_0x2626c7);_0x29a463(_0x2626c7);});});} \ No newline at end of file +var _0x3178=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserProfileSection,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x3178,0x7f));var _0x8317=function(_0x26d6eb,_0x3fc8b2){_0x26d6eb=_0x26d6eb-0x0;var _0x5dcbc4=_0x3178[_0x26d6eb];return _0x5dcbc4;};'use strict';var _=require(_0x8317('0x0'));var util=require(_0x8317('0x1'));var moment=require('moment');var BPromise=require(_0x8317('0x2'));var rs=require(_0x8317('0x3'));var fs=require('fs');var Redis=require(_0x8317('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8317('0x5'));var logger=require(_0x8317('0x6'))(_0x8317('0x7'));var config=require(_0x8317('0x8'));var jayson=require(_0x8317('0x9'));var client=jayson[_0x8317('0xa')][_0x8317('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29976b,_0x49c705,_0x83d6d3){return new BPromise(function(_0x3cff10,_0xf37701){return client[_0x8317('0xc')](_0x29976b,_0x83d6d3)[_0x8317('0xd')](function(_0x3c7eb7){logger[_0x8317('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x49c705,'request\x20sent');logger[_0x8317('0xf')](_0x8317('0x10'),_0x49c705,_0x8317('0x11'),JSON[_0x8317('0x12')](_0x3c7eb7));if(_0x3c7eb7[_0x8317('0x13')]){if(_0x3c7eb7[_0x8317('0x13')]['code']===0x1f4){logger['error'](_0x8317('0x14'),_0x49c705,_0x3c7eb7[_0x8317('0x13')][_0x8317('0x15')]);return _0xf37701(_0x3c7eb7[_0x8317('0x13')][_0x8317('0x15')]);}logger[_0x8317('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x49c705,_0x3c7eb7['error'][_0x8317('0x15')]);return _0x3cff10(_0x3c7eb7[_0x8317('0x13')][_0x8317('0x15')]);}else{logger[_0x8317('0xe')](_0x8317('0x14'),_0x49c705,_0x8317('0x11'));_0x3cff10(_0x3c7eb7['result'][_0x8317('0x15')]);}})['catch'](function(_0x2db59f){logger['error'](_0x8317('0x14'),_0x49c705,_0x2db59f);_0xf37701(_0x2db59f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ab4734f..abacef6 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(_0x1b640f,_0x215390){var _0x560770=function(_0x5335ba){while(--_0x5335ba){_0x1b640f['push'](_0x1b640f['shift']());}};_0x560770(++_0x215390);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x560d9e,_0x5017ea){var _0xe362ab=function(_0x4a5474){while(--_0x4a5474){_0x560d9e['push'](_0x560d9e['shift']());}};_0xe362ab(++_0x5017ea);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 270870f..60fa42c 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 _0xbf10=['exports','INTEGER'];(function(_0x4279e1,_0x39cda4){var _0x1e33ea=function(_0x5b00ea){while(--_0x5b00ea){_0x4279e1['push'](_0x4279e1['shift']());}};_0x1e33ea(++_0x39cda4);}(_0xbf10,0x1d2));var _0x0bf1=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xbf10[_0x411add];return _0x238242;};'use strict';var Sequelize=require('sequelize');module[_0x0bf1('0x0')]={'penalty':{'type':Sequelize[_0x0bf1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe168=['INTEGER','exports'];(function(_0x347dec,_0x1d41a7){var _0x87cb4=function(_0x2214b7){while(--_0x2214b7){_0x347dec['push'](_0x347dec['shift']());}};_0x87cb4(++_0x1d41a7);}(_0xe168,0x79));var _0x8e16=function(_0x1c2f4a,_0x29deb0){_0x1c2f4a=_0x1c2f4a-0x0;var _0x1079eb=_0xe168[_0x1c2f4a];return _0x1079eb;};'use strict';var Sequelize=require('sequelize');module[_0x8e16('0x0')]={'penalty':{'type':Sequelize[_0x8e16('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 f4bf251..21b4789 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 _0xffd6=['path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0xffd6,0x97));var _0x6ffd=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xffd6[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var logger=require(_0x6ffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffd('0x3'));var rp=require(_0x6ffd('0x4'));var fs=require('fs');var path=require(_0x6ffd('0x5'));var rimraf=require('rimraf');var config=require(_0x6ffd('0x6'));var attributes=require(_0x6ffd('0x7'));module[_0x6ffd('0x8')]=function(_0x2949a4,_0x561055){return _0x2949a4[_0x6ffd('0x9')](_0x6ffd('0xa'),attributes,{'tableName':_0x6ffd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f6f=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userSmsQueue.attributes','exports','user_has_sms_queues'];(function(_0x2c9fe0,_0x1e2901){var _0xbcfe33=function(_0x3b9f5b){while(--_0x3b9f5b){_0x2c9fe0['push'](_0x2c9fe0['shift']());}};_0xbcfe33(++_0x1e2901);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0xbaf497,_0x1b5105){_0xbaf497=_0xbaf497-0x0;var _0x34fd88=_0x5f6f[_0xbaf497];return _0x34fd88;};'use strict';var _=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var logger=require(_0xf5f6('0x2'))(_0xf5f6('0x3'));var moment=require(_0xf5f6('0x4'));var BPromise=require('bluebird');var rp=require(_0xf5f6('0x5'));var fs=require('fs');var path=require(_0xf5f6('0x6'));var rimraf=require(_0xf5f6('0x7'));var config=require('../../config/environment');var attributes=require(_0xf5f6('0x8'));module[_0xf5f6('0x9')]=function(_0x390b1a,_0xfda1c7){return _0x390b1a['define']('UserSmsQueue',attributes,{'tableName':_0xf5f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index d82d52b..5c718ac 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 _0xd24d=['jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x49aeaf,_0x27284d){var _0x3818f8=function(_0x342440){while(--_0x342440){_0x49aeaf['push'](_0x49aeaf['shift']());}};_0x3818f8(++_0x27284d);}(_0xd24d,0x122));var _0xdd24=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd24d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdd24('0x0'));var util=require('util');var moment=require(_0xdd24('0x1'));var BPromise=require(_0xdd24('0x2'));var rs=require(_0xdd24('0x3'));var fs=require('fs');var Redis=require(_0xdd24('0x4'));var db=require(_0xdd24('0x5'))['db'];var utils=require(_0xdd24('0x6'));var logger=require(_0xdd24('0x7'))('rpc');var config=require(_0xdd24('0x8'));var jayson=require(_0xdd24('0x9'));var client=jayson[_0xdd24('0xa')][_0xdd24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46c1f7,_0x321ecb,_0x4e2f72){return new BPromise(function(_0xd9d82b,_0x3342f2){return client[_0xdd24('0xc')](_0x46c1f7,_0x4e2f72)[_0xdd24('0xd')](function(_0x518435){logger[_0xdd24('0xe')](_0xdd24('0xf'),_0x321ecb,_0xdd24('0x10'));logger['debug'](_0xdd24('0x11'),_0x321ecb,_0xdd24('0x10'),JSON[_0xdd24('0x12')](_0x518435));if(_0x518435[_0xdd24('0x13')]){if(_0x518435[_0xdd24('0x13')][_0xdd24('0x14')]===0x1f4){logger[_0xdd24('0x13')](_0xdd24('0xf'),_0x321ecb,_0x518435[_0xdd24('0x13')][_0xdd24('0x15')]);return _0x3342f2(_0x518435['error'][_0xdd24('0x15')]);}logger[_0xdd24('0x13')](_0xdd24('0xf'),_0x321ecb,_0x518435['error'][_0xdd24('0x15')]);return _0xd9d82b(_0x518435[_0xdd24('0x13')][_0xdd24('0x15')]);}else{logger['info'](_0xdd24('0xf'),_0x321ecb,_0xdd24('0x10'));_0xd9d82b(_0x518435['result'][_0xdd24('0x15')]);}})[_0xdd24('0x16')](function(_0x343334){logger[_0xdd24('0x13')](_0xdd24('0xf'),_0x321ecb,_0x343334);_0x3342f2(_0x343334);});});} \ No newline at end of file +var _0x9e79=['rpc','../../config/environment','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x478219,_0x28aa3d){var _0x4ff324=function(_0x226fb8){while(--_0x226fb8){_0x478219['push'](_0x478219['shift']());}};_0x4ff324(++_0x28aa3d);}(_0x9e79,0x111));var _0x99e7=function(_0x3ec668,_0x1029a9){_0x3ec668=_0x3ec668-0x0;var _0x454edd=_0x9e79[_0x3ec668];return _0x454edd;};'use strict';var _=require(_0x99e7('0x0'));var util=require('util');var moment=require(_0x99e7('0x1'));var BPromise=require('bluebird');var rs=require(_0x99e7('0x2'));var fs=require('fs');var Redis=require(_0x99e7('0x3'));var db=require(_0x99e7('0x4'))['db'];var utils=require(_0x99e7('0x5'));var logger=require(_0x99e7('0x6'))(_0x99e7('0x7'));var config=require(_0x99e7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x99e7('0x9')][_0x99e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13a478,_0x299139,_0x4d3720){return new BPromise(function(_0x1e4939,_0x51b20b){return client[_0x99e7('0xb')](_0x13a478,_0x4d3720)['then'](function(_0x261f51){logger[_0x99e7('0xc')](_0x99e7('0xd'),_0x299139,'request\x20sent');logger['debug'](_0x99e7('0xe'),_0x299139,_0x99e7('0xf'),JSON[_0x99e7('0x10')](_0x261f51));if(_0x261f51[_0x99e7('0x11')]){if(_0x261f51[_0x99e7('0x11')]['code']===0x1f4){logger[_0x99e7('0x11')](_0x99e7('0xd'),_0x299139,_0x261f51[_0x99e7('0x11')][_0x99e7('0x12')]);return _0x51b20b(_0x261f51[_0x99e7('0x11')]['message']);}logger[_0x99e7('0x11')](_0x99e7('0xd'),_0x299139,_0x261f51[_0x99e7('0x11')][_0x99e7('0x12')]);return _0x1e4939(_0x261f51[_0x99e7('0x11')][_0x99e7('0x12')]);}else{logger[_0x99e7('0xc')](_0x99e7('0xd'),_0x299139,_0x99e7('0xf'));_0x1e4939(_0x261f51['result']['message']);}})[_0x99e7('0x13')](function(_0x3688cd){logger['error'](_0x99e7('0xd'),_0x299139,_0x3688cd);_0x51b20b(_0x3688cd);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 687f1e5..09d3004 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 _0x105d=['INTEGER'];(function(_0x3a8efd,_0x52b9f3){var _0x26ee33=function(_0x2f4ed4){while(--_0x2f4ed4){_0x3a8efd['push'](_0x3a8efd['shift']());}};_0x26ee33(++_0x52b9f3);}(_0x105d,0x79));var _0xd105=function(_0x50f1d3,_0x37ff23){_0x50f1d3=_0x50f1d3-0x0;var _0x425e77=_0x105d[_0x50f1d3];return _0x425e77;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xd105('0x0')]}}; \ No newline at end of file +var _0xd4c9=['INTEGER','exports'];(function(_0x4bcbe7,_0x278680){var _0x2513ba=function(_0x5e0486){while(--_0x5e0486){_0x4bcbe7['push'](_0x4bcbe7['shift']());}};_0x2513ba(++_0x278680);}(_0xd4c9,0x1c3));var _0x9d4c=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xd4c9[_0x24fa1a];return _0xc5621f;};'use strict';var Sequelize=require('sequelize');module[_0x9d4c('0x0')]={'UserId':{'type':Sequelize[_0x9d4c('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x9d4c('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index e18110e..6cc407c 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(_0x2a393b,_0x2c0983){var _0xa3a757=function(_0x349b0c){while(--_0x349b0c){_0x2a393b['push'](_0x2a393b['shift']());}};_0xa3a757(++_0x2c0983);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x47349f,_0xb292e9){var _0x527c39=function(_0x1f6ac5){while(--_0x1f6ac5){_0x47349f['push'](_0x47349f['shift']());}};_0x527c39(++_0xb292e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 f08935d..579d210 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x416c20,_0x93585d){var _0x2ca7ec=function(_0x1d64a7){while(--_0x1d64a7){_0x416c20['push'](_0x416c20['shift']());}};_0x2ca7ec(++_0x93585d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2351c4,_0x1dca54){var _0x1dd3f8=function(_0x4c3fa2){while(--_0x4c3fa2){_0x2351c4['push'](_0x2351c4['shift']());}};_0x1dd3f8(++_0x1dca54);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 81f2ebe..86eb866 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 _0xf0b1=['sequelize','exports','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf0b1,0xcf));var _0x1f0b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf0b1[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x1f0b('0x0'));module[_0x1f0b('0x1')]={'penalty':{'type':Sequelize[_0x1f0b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x64f0=['sequelize'];(function(_0x25c55a,_0x19f5f2){var _0x4f24b4=function(_0x48930c){while(--_0x48930c){_0x25c55a['push'](_0x25c55a['shift']());}};_0x4f24b4(++_0x19f5f2);}(_0x64f0,0x1a0));var _0x064f=function(_0x1e03a6,_0xf0349){_0x1e03a6=_0x1e03a6-0x0;var _0x295b64=_0x64f0[_0x1e03a6];return _0x295b64;};'use strict';var Sequelize=require(_0x064f('0x0'));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 2d28ac6..b373364 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 _0xef22=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x18f778,_0x3cd8f5){var _0xd41215=function(_0x3c5888){while(--_0x3c5888){_0x18f778['push'](_0x18f778['shift']());}};_0xd41215(++_0x3cd8f5);}(_0xef22,0xd4));var _0x2ef2=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xef22[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x2ef2('0x0'));var util=require(_0x2ef2('0x1'));var logger=require('../../config/logger')(_0x2ef2('0x2'));var moment=require(_0x2ef2('0x3'));var BPromise=require(_0x2ef2('0x4'));var rp=require(_0x2ef2('0x5'));var fs=require('fs');var path=require(_0x2ef2('0x6'));var rimraf=require(_0x2ef2('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x293197,_0x4062b9){return _0x293197[_0x2ef2('0x8')](_0x2ef2('0x9'),attributes,{'tableName':_0x2ef2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x029a=['user_has_voice_queues','util','../../config/logger','path','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x029a,0xcc));var _0xa029=function(_0x3d9337,_0x263244){_0x3d9337=_0x3d9337-0x0;var _0x55693a=_0x029a[_0x3d9337];return _0x55693a;};'use strict';var _=require('lodash');var util=require(_0xa029('0x0'));var logger=require(_0xa029('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa029('0x2'));var rimraf=require('rimraf');var config=require(_0xa029('0x3'));var attributes=require(_0xa029('0x4'));module['exports']=function(_0x4008f3,_0x1a7fee){return _0x4008f3['define'](_0xa029('0x5'),attributes,{'tableName':_0xa029('0x6'),'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 5269001..fec7156 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 _0xcf99=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xcf99,0x198));var _0x9cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf99[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9cf9('0x0'));var util=require(_0x9cf9('0x1'));var moment=require(_0x9cf9('0x2'));var BPromise=require(_0x9cf9('0x3'));var rs=require(_0x9cf9('0x4'));var fs=require('fs');var Redis=require(_0x9cf9('0x5'));var db=require(_0x9cf9('0x6'))['db'];var utils=require(_0x9cf9('0x7'));var logger=require('../../config/logger')(_0x9cf9('0x8'));var config=require(_0x9cf9('0x9'));var jayson=require(_0x9cf9('0xa'));var client=jayson[_0x9cf9('0xb')][_0x9cf9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2953d5,_0x52fe8c,_0x523a17){return new BPromise(function(_0x3d0d67,_0x509a32){return client['request'](_0x2953d5,_0x523a17)[_0x9cf9('0xd')](function(_0xaa59){logger[_0x9cf9('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x52fe8c,_0x9cf9('0xf'));logger[_0x9cf9('0x10')](_0x9cf9('0x11'),_0x52fe8c,_0x9cf9('0xf'),JSON[_0x9cf9('0x12')](_0xaa59));if(_0xaa59[_0x9cf9('0x13')]){if(_0xaa59['error']['code']===0x1f4){logger['error'](_0x9cf9('0x14'),_0x52fe8c,_0xaa59[_0x9cf9('0x13')]['message']);return _0x509a32(_0xaa59[_0x9cf9('0x13')][_0x9cf9('0x15')]);}logger[_0x9cf9('0x13')](_0x9cf9('0x14'),_0x52fe8c,_0xaa59[_0x9cf9('0x13')][_0x9cf9('0x15')]);return _0x3d0d67(_0xaa59['error'][_0x9cf9('0x15')]);}else{logger[_0x9cf9('0xe')](_0x9cf9('0x14'),_0x52fe8c,'request\x20sent');_0x3d0d67(_0xaa59[_0x9cf9('0x16')][_0x9cf9('0x15')]);}})['catch'](function(_0x3fc389){logger[_0x9cf9('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x52fe8c,_0x3fc389);_0x509a32(_0x3fc389);});});} \ No newline at end of file +var _0x9eae=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x35624f,_0x456079){var _0x345514=function(_0x121aca){while(--_0x121aca){_0x35624f['push'](_0x35624f['shift']());}};_0x345514(++_0x456079);}(_0x9eae,0x1be));var _0xe9ea=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9eae[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe9ea('0x0'));var util=require(_0xe9ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe9ea('0x2'));var fs=require('fs');var Redis=require(_0xe9ea('0x3'));var db=require(_0xe9ea('0x4'))['db'];var utils=require(_0xe9ea('0x5'));var logger=require('../../config/logger')(_0xe9ea('0x6'));var config=require(_0xe9ea('0x7'));var jayson=require(_0xe9ea('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3676f0,_0x46d508,_0x4476c8){return new BPromise(function(_0x3b2a7e,_0x5cffb3){return client[_0xe9ea('0x9')](_0x3676f0,_0x4476c8)[_0xe9ea('0xa')](function(_0x585da6){logger[_0xe9ea('0xb')](_0xe9ea('0xc'),_0x46d508,_0xe9ea('0xd'));logger[_0xe9ea('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x46d508,_0xe9ea('0xd'),JSON['stringify'](_0x585da6));if(_0x585da6[_0xe9ea('0xf')]){if(_0x585da6[_0xe9ea('0xf')]['code']===0x1f4){logger[_0xe9ea('0xf')](_0xe9ea('0xc'),_0x46d508,_0x585da6[_0xe9ea('0xf')][_0xe9ea('0x10')]);return _0x5cffb3(_0x585da6[_0xe9ea('0xf')][_0xe9ea('0x10')]);}logger['error'](_0xe9ea('0xc'),_0x46d508,_0x585da6['error'][_0xe9ea('0x10')]);return _0x3b2a7e(_0x585da6['error']['message']);}else{logger[_0xe9ea('0xb')](_0xe9ea('0xc'),_0x46d508,_0xe9ea('0xd'));_0x3b2a7e(_0x585da6[_0xe9ea('0x11')][_0xe9ea('0x10')]);}})[_0xe9ea('0x12')](function(_0x1ed7a6){logger[_0xe9ea('0xf')](_0xe9ea('0xc'),_0x46d508,_0x1ed7a6);_0x5cffb3(_0x1ed7a6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c7e7caa..a63128c 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xece322,_0x1d0f77){var _0x2a68cc=function(_0x1f0396){while(--_0x1f0396){_0xece322['push'](_0xece322['shift']());}};_0x2a68cc(++_0x1d0f77);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3f237f,_0x1bb937){var _0x498986=function(_0x4a22c4){while(--_0x4a22c4){_0x3f237f['push'](_0x3f237f['shift']());}};_0x498986(++_0x1bb937);}(_0xe706,0xa3));var _0x6e70=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xe706[_0x4b26b5];return _0x4dec71;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 1dfc066..1ca98c7 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 _0x9485=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x32f620,_0x2966f5){var _0x53e64d=function(_0xe2dfbc){while(--_0xe2dfbc){_0x32f620['push'](_0x32f620['shift']());}};_0x53e64d(++_0x2966f5);}(_0x9485,0x8b));var _0x5948=function(_0x28c096,_0x148c62){_0x28c096=_0x28c096-0x0;var _0x2b3aa0=_0x9485[_0x28c096];return _0x2b3aa0;};'use strict';var Sequelize=require(_0x5948('0x0'));module[_0x5948('0x1')]={'uniqueid':{'type':Sequelize[_0x5948('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5948('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x5948('0x3')},'UserId':{'type':Sequelize[_0x5948('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5948('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x5948('0x3')},'VoiceQueueId':{'type':Sequelize[_0x5948('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5948('0x4')],'allowNull':![],'unique':_0x5948('0x5'),'comment':_0x5948('0x3')},'penalty':{'type':Sequelize[_0x5948('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x5948('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x97db=['Required\x20by\x20Asterisk','STRING','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97db,0x8e));var _0xb97d=function(_0x5f0138,_0x1c0f5c){_0x5f0138=_0x5f0138-0x0;var _0x269b85=_0x97db[_0x5f0138];return _0x269b85;};'use strict';var Sequelize=require('sequelize');module[_0xb97d('0x0')]={'uniqueid':{'type':Sequelize[_0xb97d('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb97d('0x2')},'membername':{'type':Sequelize[_0xb97d('0x3')],'allowNull':![],'comment':_0xb97d('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xb97d('0x2')},'VoiceQueueId':{'type':Sequelize[_0xb97d('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xb97d('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xb97d('0x1')](0xb),'defaultValue':0x0,'comment':_0xb97d('0x2')},'paused':{'type':Sequelize[_0xb97d('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index a9e223b..e4e243f 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 _0x85db=['update','emit','hook','exports','events','UserVoiceQueueRt','setMaxListeners'];(function(_0x280ad7,_0x192ee6){var _0xa78735=function(_0x52e0e5){while(--_0x52e0e5){_0x280ad7['push'](_0x280ad7['shift']());}};_0xa78735(++_0x192ee6);}(_0x85db,0x1af));var _0xb85d=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0x85db[_0x31b9cf];return _0x357b8a;};'use strict';var EventEmitter=require(_0xb85d('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xb85d('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb85d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb85d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x58297b){return function(_0x5c5c5c,_0x56e9af,_0x240e23){UserVoiceQueueRtEvents[_0xb85d('0x4')](_0x58297b+':'+_0x5c5c5c['id'],_0x5c5c5c);UserVoiceQueueRtEvents[_0xb85d('0x4')](_0x58297b,_0x5c5c5c);_0x240e23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xb85d('0x5')](e,emitEvent(event));}}module[_0xb85d('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x16ad=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xf3c8a4,_0x2bd868){var _0x4f5a9f=function(_0x6f031a){while(--_0x6f031a){_0xf3c8a4['push'](_0xf3c8a4['shift']());}};_0x4f5a9f(++_0x2bd868);}(_0x16ad,0xb0));var _0xd16a=function(_0x5f4192,_0x4ed539){_0x5f4192=_0x5f4192-0x0;var _0x21ee5c=_0x16ad[_0x5f4192];return _0x21ee5c;};'use strict';var EventEmitter=require(_0xd16a('0x0'));var UserVoiceQueueRt=require(_0xd16a('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd16a('0x2')](0x0);var events={'afterCreate':_0xd16a('0x3'),'afterUpdate':_0xd16a('0x4'),'afterDestroy':_0xd16a('0x5')};function emitEvent(_0x3f28d6){return function(_0x24cc39,_0x909eb7,_0x429f97){UserVoiceQueueRtEvents['emit'](_0x3f28d6+':'+_0x24cc39['id'],_0x24cc39);UserVoiceQueueRtEvents['emit'](_0x3f28d6,_0x24cc39);_0x429f97(null);};}for(var e in events){if(events[_0xd16a('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xd16a('0x7')](e,emitEvent(event));}}module[_0xd16a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 04d4444..3e492bc 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 _0xce9e=['define','user_has_voice_queues_rt','lodash','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x1971ca,_0x58789b){var _0x31c8e5=function(_0x2ff11b){while(--_0x2ff11b){_0x1971ca['push'](_0x1971ca['shift']());}};_0x31c8e5(++_0x58789b);}(_0xce9e,0xa4));var _0xece9=function(_0x18ce30,_0x437d06){_0x18ce30=_0x18ce30-0x0;var _0x4471a3=_0xce9e[_0x18ce30];return _0x4471a3;};'use strict';var _=require(_0xece9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xece9('0x1'));var moment=require(_0xece9('0x2'));var BPromise=require(_0xece9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xece9('0x4'));var rimraf=require('rimraf');var config=require(_0xece9('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xece9('0x6')]=function(_0x236c5b,_0x229402){return _0x236c5b[_0xece9('0x7')]('UserVoiceQueueRt',attributes,{'tableName':_0xece9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dbb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x22e7d9,_0x88f058){var _0x5396c2=function(_0xcd0fd3){while(--_0xcd0fd3){_0x22e7d9['push'](_0x22e7d9['shift']());}};_0x5396c2(++_0x88f058);}(_0x8dbb,0x1ec));var _0xb8db=function(_0x415b5d,_0x52a76d){_0x415b5d=_0x415b5d-0x0;var _0x3c0911=_0x8dbb[_0x415b5d];return _0x3c0911;};'use strict';var _=require(_0xb8db('0x0'));var util=require(_0xb8db('0x1'));var logger=require(_0xb8db('0x2'))(_0xb8db('0x3'));var moment=require(_0xb8db('0x4'));var BPromise=require(_0xb8db('0x5'));var rp=require(_0xb8db('0x6'));var fs=require('fs');var path=require(_0xb8db('0x7'));var rimraf=require(_0xb8db('0x8'));var config=require(_0xb8db('0x9'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x57b16a,_0x285e53){return _0x57b16a[_0xb8db('0xa')](_0xb8db('0xb'),attributes,{'tableName':_0xb8db('0xc'),'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 1250ca1..fe01e5d 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 _0x8d40=['raw','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','stringify','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x5bea5c,_0x56374d){var _0xe91509=function(_0x363b6d){while(--_0x363b6d){_0x5bea5c['push'](_0x5bea5c['shift']());}};_0xe91509(++_0x56374d);}(_0x8d40,0x132));var _0x08d4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8d40[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08d4('0x0'));var BPromise=require(_0x08d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08d4('0x2'));var db=require(_0x08d4('0x3'))['db'];var utils=require(_0x08d4('0x4'));var logger=require(_0x08d4('0x5'))(_0x08d4('0x6'));var config=require(_0x08d4('0x7'));var jayson=require(_0x08d4('0x8'));var client=jayson[_0x08d4('0x9')][_0x08d4('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x08d4('0xb'),'port':0x18eb});var socket=require(_0x08d4('0xc'))(new Redis(config['redis']));require(_0x08d4('0xd'))[_0x08d4('0xe')](socket);function respondWithRpcPromise(_0x29b2c3,_0x2e30cf,_0x4d8b9f){return new BPromise(function(_0x16d3bd,_0x3f9a5f){return client[_0x08d4('0xf')](_0x29b2c3,_0x4d8b9f)['then'](function(_0x985d4a){logger[_0x08d4('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e30cf,_0x08d4('0x11'));logger[_0x08d4('0x12')](_0x08d4('0x13'),_0x2e30cf,_0x08d4('0x11'),JSON['stringify'](_0x985d4a));if(_0x985d4a[_0x08d4('0x14')]){if(_0x985d4a['error']['code']===0x1f4){logger[_0x08d4('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e30cf,_0x985d4a[_0x08d4('0x14')][_0x08d4('0x15')]);return _0x3f9a5f(_0x985d4a[_0x08d4('0x14')]['message']);}logger[_0x08d4('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e30cf,_0x985d4a['error'][_0x08d4('0x15')]);return _0x16d3bd(_0x985d4a['error'][_0x08d4('0x15')]);}else{logger[_0x08d4('0x10')](_0x08d4('0x16'),_0x2e30cf,_0x08d4('0x11'));_0x16d3bd(_0x985d4a[_0x08d4('0x17')][_0x08d4('0x15')]);}})['catch'](function(_0x1f5db6){logger[_0x08d4('0x14')](_0x08d4('0x16'),_0x2e30cf,_0x1f5db6);_0x3f9a5f(_0x1f5db6);});});}exports[_0x08d4('0x18')]=function(_0x1dff0c){var _0x3582e8=this;return new Promise(function(_0xda8277,_0x4f3aad){return db[_0x08d4('0x19')][_0x08d4('0x1a')]({'raw':_0x1dff0c['options']?_0x1dff0c['options'][_0x08d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x1dff0c[_0x08d4('0x1c')]?_0x1dff0c[_0x08d4('0x1c')][_0x08d4('0x1d')]||null:null,'attributes':[[db[_0x08d4('0x1e')]['fn'](_0x08d4('0x1f'),db[_0x08d4('0x1e')]['fn']('IF',db[_0x08d4('0x1e')]['literal'](_0x08d4('0x20')))),_0x08d4('0x21')]]})[_0x08d4('0x22')](function(_0x16f85e){logger['info'](_0x08d4('0x18'),_0x1dff0c);logger[_0x08d4('0x12')](_0x08d4('0x18'),_0x1dff0c,JSON[_0x08d4('0x23')](_0x16f85e));_0xda8277(_0x16f85e);})[_0x08d4('0x24')](function(_0x36126a){logger['error']('GetVoiceQueueRtPauses',_0x36126a[_0x08d4('0x15')],_0x1dff0c);_0x4f3aad(_0x3582e8['error'](0x1f4,_0x36126a[_0x08d4('0x15')]));});});}; \ No newline at end of file +var _0x5f66=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x211d16,_0x281bda){var _0x4f27d4=function(_0x374388){while(--_0x374388){_0x211d16['push'](_0x211d16['shift']());}};_0x4f27d4(++_0x281bda);}(_0x5f66,0xca));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x65f6('0x0'));var util=require(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rs=require(_0x65f6('0x4'));var fs=require('fs');var Redis=require(_0x65f6('0x5'));var db=require(_0x65f6('0x6'))['db'];var utils=require(_0x65f6('0x7'));var logger=require(_0x65f6('0x8'))(_0x65f6('0x9'));var config=require(_0x65f6('0xa'));var jayson=require(_0x65f6('0xb'));var client=jayson[_0x65f6('0xc')][_0x65f6('0xd')]({'port':0x232a});config[_0x65f6('0xe')]=_[_0x65f6('0xf')](config[_0x65f6('0xe')],{'host':_0x65f6('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0xe')]));require(_0x65f6('0x11'))[_0x65f6('0x12')](socket);function respondWithRpcPromise(_0x3e0994,_0x2972cc,_0x5626fb){return new BPromise(function(_0x12be31,_0x1cbc01){return client[_0x65f6('0x13')](_0x3e0994,_0x5626fb)[_0x65f6('0x14')](function(_0x5835b5){logger[_0x65f6('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2972cc,'request\x20sent');logger[_0x65f6('0x16')](_0x65f6('0x17'),_0x2972cc,_0x65f6('0x18'),JSON[_0x65f6('0x19')](_0x5835b5));if(_0x5835b5['error']){if(_0x5835b5[_0x65f6('0x1a')][_0x65f6('0x1b')]===0x1f4){logger[_0x65f6('0x1a')](_0x65f6('0x1c'),_0x2972cc,_0x5835b5['error'][_0x65f6('0x1d')]);return _0x1cbc01(_0x5835b5['error'][_0x65f6('0x1d')]);}logger[_0x65f6('0x1a')](_0x65f6('0x1c'),_0x2972cc,_0x5835b5[_0x65f6('0x1a')][_0x65f6('0x1d')]);return _0x12be31(_0x5835b5[_0x65f6('0x1a')][_0x65f6('0x1d')]);}else{logger[_0x65f6('0x15')](_0x65f6('0x1c'),_0x2972cc,_0x65f6('0x18'));_0x12be31(_0x5835b5[_0x65f6('0x1e')]['message']);}})['catch'](function(_0x34fd04){logger[_0x65f6('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2972cc,_0x34fd04);_0x1cbc01(_0x34fd04);});});}exports[_0x65f6('0x1f')]=function(_0x17c8ec){var _0x3d37ad=this;return new Promise(function(_0xcf8744,_0x452967){return db[_0x65f6('0x20')][_0x65f6('0x21')]({'raw':_0x17c8ec[_0x65f6('0x22')]?_0x17c8ec[_0x65f6('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x17c8ec[_0x65f6('0x22')]?_0x17c8ec['options'][_0x65f6('0x23')]||null:null,'attributes':[[db[_0x65f6('0x24')]['fn'](_0x65f6('0x25'),db[_0x65f6('0x24')]['fn']('IF',db[_0x65f6('0x24')][_0x65f6('0x26')](_0x65f6('0x27')))),_0x65f6('0x28')]]})[_0x65f6('0x14')](function(_0x4922e1){logger['info'](_0x65f6('0x1f'),_0x17c8ec);logger['debug'](_0x65f6('0x1f'),_0x17c8ec,JSON[_0x65f6('0x19')](_0x4922e1));_0xcf8744(_0x4922e1);})[_0x65f6('0x29')](function(_0x2ac500){logger[_0x65f6('0x1a')](_0x65f6('0x1f'),_0x2ac500['message'],_0x17c8ec);_0x452967(_0x3d37ad[_0x65f6('0x1a')](0x1f4,_0x2ac500[_0x65f6('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index dd31ca3..6f69ee0 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 _0xc92f=['update','emit','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x550691,_0x19fe04){var _0x25f1e2=function(_0xe2eebd){while(--_0xe2eebd){_0x550691['push'](_0x550691['shift']());}};_0x25f1e2(++_0x19fe04);}(_0xc92f,0xf3));var _0xfc92=function(_0x418117,_0x44f4a7){_0x418117=_0x418117-0x0;var _0x403a66=_0xc92f[_0x418117];return _0x403a66;};'use strict';var UserVoiceQueueRtEvents=require(_0xfc92('0x0'));var events=[_0xfc92('0x1'),'remove',_0xfc92('0x2')];function createListener(_0x19f2d4,_0x355614){return function(_0x4a76e2){_0x355614[_0xfc92('0x3')](_0x19f2d4,_0x4a76e2);};}function removeListener(_0x21f567,_0x35780b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x21f567,_0x35780b);};}exports['register']=function(_0x930bab){for(var _0x47abee=0x0,_0x394026=events['length'];_0x47abee<_0x394026;_0x47abee++){var _0xd80968=events[_0x47abee];var _0x49db29=createListener(_0xfc92('0x4')+_0xd80968,_0x930bab);UserVoiceQueueRtEvents['on'](_0xd80968,_0x49db29);}}; \ No newline at end of file +var _0x07e8=['length','./userVoiceQueueRt.events','save','remove','removeListener','register'];(function(_0x56442c,_0x46f7cd){var _0x5ed5dc=function(_0x4fbfc4){while(--_0x4fbfc4){_0x56442c['push'](_0x56442c['shift']());}};_0x5ed5dc(++_0x46f7cd);}(_0x07e8,0x10f));var _0x807e=function(_0x1248db,_0x1d9f24){_0x1248db=_0x1248db-0x0;var _0x48e8=_0x07e8[_0x1248db];return _0x48e8;};'use strict';var UserVoiceQueueRtEvents=require(_0x807e('0x0'));var events=[_0x807e('0x1'),_0x807e('0x2'),'update'];function createListener(_0xaeb273,_0x51e0a1){return function(_0x100014){_0x51e0a1['emit'](_0xaeb273,_0x100014);};}function removeListener(_0x47d154,_0x2c423b){return function(){UserVoiceQueueRtEvents[_0x807e('0x3')](_0x47d154,_0x2c423b);};}exports[_0x807e('0x4')]=function(_0x59981c){for(var _0x5a768b=0x0,_0xa12efd=events[_0x807e('0x5')];_0x5a768b<_0xa12efd;_0x5a768b++){var _0x178efb=events[_0x5a768b];var _0x1845b3=createListener('userVoiceQueueRt:'+_0x178efb,_0x59981c);UserVoiceQueueRtEvents['on'](_0x178efb,_0x1845b3);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f9ce9d4..12b8cf5 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2db76c,_0x295205){var _0x2d39b8=function(_0x1e834c){while(--_0x1e834c){_0x2db76c['push'](_0x2db76c['shift']());}};_0x2d39b8(++_0x295205);}(_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(_0xa03cfa,_0x50f59c){var _0x550e0f=function(_0x56866d){while(--_0x56866d){_0xa03cfa['push'](_0xa03cfa['shift']());}};_0x550e0f(++_0x50f59c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xcb91[_0xd4636c];return _0x5ee17d;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 5edd6f3..6736bd9 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 _0xf203=['sequelize','exports'];(function(_0x2407d0,_0x5d2de3){var _0xe99ff5=function(_0x65f9c){while(--_0x65f9c){_0x2407d0['push'](_0x2407d0['shift']());}};_0xe99ff5(++_0x5d2de3);}(_0xf203,0x190));var _0x3f20=function(_0x2286a8,_0x312a0b){_0x2286a8=_0x2286a8-0x0;var _0x114441=_0xf203[_0x2286a8];return _0x114441;};'use strict';var Sequelize=require(_0x3f20('0x0'));module[_0x3f20('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa477=['sequelize','exports','INTEGER'];(function(_0xf1de4a,_0x52f431){var _0x2e2c37=function(_0x146699){while(--_0x146699){_0xf1de4a['push'](_0xf1de4a['shift']());}};_0x2e2c37(++_0x52f431);}(_0xa477,0x9c));var _0x7a47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa477[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x7a47('0x0'));module[_0x7a47('0x1')]={'penalty':{'type':Sequelize[_0x7a47('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 257c594..7bcbe43 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 _0x17a7=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x17a7,0x79));var _0x717a=function(_0x1f213c,_0xd9e1f8){_0x1f213c=_0x1f213c-0x0;var _0x1f2ec8=_0x17a7[_0x1f213c];return _0x1f2ec8;};'use strict';var _=require(_0x717a('0x0'));var util=require(_0x717a('0x1'));var logger=require('../../config/logger')(_0x717a('0x2'));var moment=require(_0x717a('0x3'));var BPromise=require(_0x717a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x717a('0x5'));var rimraf=require(_0x717a('0x6'));var config=require(_0x717a('0x7'));var attributes=require(_0x717a('0x8'));module[_0x717a('0x9')]=function(_0x822090,_0x16faf5){return _0x822090['define'](_0x717a('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba71=['../../config/logger','api','moment','../../config/environment','exports','define','user_has_whatsapp_queues','lodash'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0xba71,0x1ef));var _0x1ba7=function(_0x1dfdd5,_0x2f1efe){_0x1dfdd5=_0x1dfdd5-0x0;var _0x2d106a=_0xba71[_0x1dfdd5];return _0x2d106a;};'use strict';var _=require(_0x1ba7('0x0'));var util=require('util');var logger=require(_0x1ba7('0x1'))(_0x1ba7('0x2'));var moment=require(_0x1ba7('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(_0x1ba7('0x4'));var attributes=require('./userWhatsappQueue.attributes');module[_0x1ba7('0x5')]=function(_0x5669fb,_0x185350){return _0x5669fb[_0x1ba7('0x6')]('UserWhatsappQueue',attributes,{'tableName':_0x1ba7('0x7'),'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 289b072..248ba90 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 _0x86af=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x86af,0x65));var _0xf86a=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0x86af[_0x4a8418];return _0x390174;};'use strict';var _=require(_0xf86a('0x0'));var util=require('util');var moment=require(_0xf86a('0x1'));var BPromise=require(_0xf86a('0x2'));var rs=require(_0xf86a('0x3'));var fs=require('fs');var Redis=require(_0xf86a('0x4'));var db=require(_0xf86a('0x5'))['db'];var utils=require(_0xf86a('0x6'));var logger=require(_0xf86a('0x7'))(_0xf86a('0x8'));var config=require(_0xf86a('0x9'));var jayson=require(_0xf86a('0xa'));var client=jayson[_0xf86a('0xb')][_0xf86a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a96f4,_0x2e7b28,_0x32c59a){return new BPromise(function(_0x10d553,_0x4cc924){return client[_0xf86a('0xd')](_0x5a96f4,_0x32c59a)[_0xf86a('0xe')](function(_0x1da8b0){logger[_0xf86a('0xf')](_0xf86a('0x10'),_0x2e7b28,_0xf86a('0x11'));logger[_0xf86a('0x12')](_0xf86a('0x13'),_0x2e7b28,'request\x20sent',JSON[_0xf86a('0x14')](_0x1da8b0));if(_0x1da8b0[_0xf86a('0x15')]){if(_0x1da8b0[_0xf86a('0x15')]['code']===0x1f4){logger[_0xf86a('0x15')](_0xf86a('0x10'),_0x2e7b28,_0x1da8b0[_0xf86a('0x15')][_0xf86a('0x16')]);return _0x4cc924(_0x1da8b0[_0xf86a('0x15')]['message']);}logger[_0xf86a('0x15')](_0xf86a('0x10'),_0x2e7b28,_0x1da8b0[_0xf86a('0x15')][_0xf86a('0x16')]);return _0x10d553(_0x1da8b0['error'][_0xf86a('0x16')]);}else{logger[_0xf86a('0xf')](_0xf86a('0x10'),_0x2e7b28,_0xf86a('0x11'));_0x10d553(_0x1da8b0[_0xf86a('0x17')][_0xf86a('0x16')]);}})[_0xf86a('0x18')](function(_0x1759ae){logger[_0xf86a('0x15')](_0xf86a('0x10'),_0x2e7b28,_0x1759ae);_0x4cc924(_0x1759ae);});});} \ No newline at end of file +var _0xd044=['then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xd044,0x14d));var _0x4d04=function(_0x4f716e,_0x45191f){_0x4f716e=_0x4f716e-0x0;var _0x486be9=_0xd044[_0x4f716e];return _0x486be9;};'use strict';var _=require(_0x4d04('0x0'));var util=require(_0x4d04('0x1'));var moment=require(_0x4d04('0x2'));var BPromise=require(_0x4d04('0x3'));var rs=require(_0x4d04('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d04('0x5'));var logger=require('../../config/logger')(_0x4d04('0x6'));var config=require(_0x4d04('0x7'));var jayson=require(_0x4d04('0x8'));var client=jayson[_0x4d04('0x9')][_0x4d04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x484117,_0x288349,_0x5e5c79){return new BPromise(function(_0x3e9ecd,_0x2ead2e){return client[_0x4d04('0xb')](_0x484117,_0x5e5c79)[_0x4d04('0xc')](function(_0x77c726){logger[_0x4d04('0xd')](_0x4d04('0xe'),_0x288349,_0x4d04('0xf'));logger[_0x4d04('0x10')](_0x4d04('0x11'),_0x288349,_0x4d04('0xf'),JSON[_0x4d04('0x12')](_0x77c726));if(_0x77c726['error']){if(_0x77c726[_0x4d04('0x13')][_0x4d04('0x14')]===0x1f4){logger[_0x4d04('0x13')](_0x4d04('0xe'),_0x288349,_0x77c726[_0x4d04('0x13')][_0x4d04('0x15')]);return _0x2ead2e(_0x77c726['error'][_0x4d04('0x15')]);}logger[_0x4d04('0x13')](_0x4d04('0xe'),_0x288349,_0x77c726['error'][_0x4d04('0x15')]);return _0x3e9ecd(_0x77c726[_0x4d04('0x13')]['message']);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x288349,_0x4d04('0xf'));_0x3e9ecd(_0x77c726[_0x4d04('0x16')][_0x4d04('0x15')]);}})['catch'](function(_0x55f5e0){logger[_0x4d04('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x288349,_0x55f5e0);_0x2ead2e(_0x55f5e0);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 722bf6c..d5932ab 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 _0xe148=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show'];(function(_0x2f6c38,_0x4b067a){var _0x66279f=function(_0x13c4b5){while(--_0x13c4b5){_0x2f6c38['push'](_0x2f6c38['shift']());}};_0x66279f(++_0x4b067a);}(_0xe148,0x9e));var _0x8e14=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0xe148[_0x47e309];return _0x2e1900;};'use strict';var multer=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var path=require('path');var timeout=require(_0x8e14('0x2'));var express=require(_0x8e14('0x3'));var router=express['Router']();var fs_extra=require(_0x8e14('0x4'));var auth=require(_0x8e14('0x5'));var interaction=require(_0x8e14('0x6'));var config=require(_0x8e14('0x7'));var controller=require('./variable.controller');router['get']('/',auth[_0x8e14('0x8')](),controller[_0x8e14('0x9')]);router['get'](_0x8e14('0xa'),auth[_0x8e14('0x8')](),controller[_0x8e14('0xb')]);router[_0x8e14('0xc')]('/',auth['isAuthenticated'](),controller[_0x8e14('0xd')]);router['put'](_0x8e14('0xa'),auth[_0x8e14('0x8')](),controller['update']);router[_0x8e14('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8e14('0xf')]);module[_0x8e14('0x10')]=router; \ No newline at end of file +var _0xf50b=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','post','create','update','delete'];(function(_0x29a37d,_0x1efdce){var _0x11fc58=function(_0x373719){while(--_0x373719){_0x29a37d['push'](_0x29a37d['shift']());}};_0x11fc58(++_0x1efdce);}(_0xf50b,0xc8));var _0xbf50=function(_0x16ef29,_0x2eee79){_0x16ef29=_0x16ef29-0x0;var _0x35fc8f=_0xf50b[_0x16ef29];return _0x35fc8f;};'use strict';var multer=require(_0xbf50('0x0'));var util=require(_0xbf50('0x1'));var path=require('path');var timeout=require(_0xbf50('0x2'));var express=require(_0xbf50('0x3'));var router=express[_0xbf50('0x4')]();var fs_extra=require(_0xbf50('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf50('0x6'));var config=require('../../config/environment');var controller=require(_0xbf50('0x7'));router[_0xbf50('0x8')]('/',auth[_0xbf50('0x9')](),controller[_0xbf50('0xa')]);router[_0xbf50('0x8')](_0xbf50('0xb'),auth[_0xbf50('0x9')](),controller['show']);router[_0xbf50('0xc')]('/',auth[_0xbf50('0x9')](),controller[_0xbf50('0xd')]);router['put']('/:id',auth[_0xbf50('0x9')](),controller[_0xbf50('0xe')]);router[_0xbf50('0xf')]('/:id',auth[_0xbf50('0x9')](),controller[_0xbf50('0x10')]);module[_0xbf50('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ff982ac..50e4ecf 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 _0x28ed=['exports','name','STRING'];(function(_0x10c522,_0x19f6d0){var _0x1a3395=function(_0x3fa510){while(--_0x3fa510){_0x10c522['push'](_0x10c522['shift']());}};_0x1a3395(++_0x19f6d0);}(_0x28ed,0x1b9));var _0xd28e=function(_0x588148,_0x2bb277){_0x588148=_0x588148-0x0;var _0x532535=_0x28ed[_0x588148];return _0x532535;};'use strict';var Sequelize=require('sequelize');module[_0xd28e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd28e('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd28e('0x2')]}}; \ No newline at end of file +var _0x79e3=['exports','name','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x79e3,0x77));var _0x379e=function(_0x2a006e,_0x15bd8a){_0x2a006e=_0x2a006e-0x0;var _0x4c781e=_0x79e3[_0x2a006e];return _0x4c781e;};'use strict';var Sequelize=require(_0x379e('0x0'));module[_0x379e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x379e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f64b879..404d3f9 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 _0xafd7=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','Variable','findAll','rows','catch','params','create','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','offset','set','apply','reject','save','update','then','get','Variables','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x3a711c,_0x557e82){var _0x5139a2=function(_0x3c304){while(--_0x3c304){_0x3a711c['push'](_0x3a711c['shift']());}};_0x5139a2(++_0x557e82);}(_0xafd7,0xc2));var _0x7afd=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xafd7[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x7afd('0x0'));var rimraf=require(_0x7afd('0x1'));var zipdir=require(_0x7afd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7afd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7afd('0x4'));var util=require(_0x7afd('0x5'));var path=require(_0x7afd('0x6'));var sox=require(_0x7afd('0x7'));var csv=require(_0x7afd('0x8'));var ejs=require(_0x7afd('0x9'));var fs=require('fs');var fs_extra=require(_0x7afd('0xa'));var _=require('lodash');var squel=require(_0x7afd('0xb'));var crypto=require(_0x7afd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7afd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7afd('0xe'));var Papa=require(_0x7afd('0xf'));var Redis=require(_0x7afd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7afd('0x11'));var as=require(_0x7afd('0x12'));var hardwareService=require(_0x7afd('0x13'));var logger=require(_0x7afd('0x14'))(_0x7afd('0x15'));var utils=require(_0x7afd('0x16'));var config=require(_0x7afd('0x17'));var licenseUtil=require(_0x7afd('0x18'));var db=require(_0x7afd('0x19'))['db'];function respondWithStatusCode(_0x580e4f,_0x2e0f5d){_0x2e0f5d=_0x2e0f5d||0xcc;return function(_0x2e9a83){if(_0x2e9a83){return _0x580e4f['sendStatus'](_0x2e0f5d);}return _0x580e4f[_0x7afd('0x1a')](_0x2e0f5d)[_0x7afd('0x1b')]();};}function respondWithResult(_0x28436b,_0xf80726){_0xf80726=_0xf80726||0xc8;return function(_0x5f0c14){if(_0x5f0c14){return _0x28436b[_0x7afd('0x1a')](_0xf80726)['json'](_0x5f0c14);}};}function respondWithFilteredResult(_0x2e7a55,_0x51ea0e){return function(_0x4923a7){if(_0x4923a7){var _0x26c873=typeof _0x51ea0e['offset']==='undefined'&&typeof _0x51ea0e[_0x7afd('0x1c')]===_0x7afd('0x1d');var _0x2d9fe5=_0x4923a7['count'];var _0x3d4dcf=_0x26c873?0x0:_0x51ea0e[_0x7afd('0x1e')];var _0x2ed4e0=_0x26c873?_0x4923a7['count']:_0x51ea0e[_0x7afd('0x1e')]+_0x51ea0e[_0x7afd('0x1c')];var _0x129d9d;if(_0x2ed4e0>=_0x2d9fe5){_0x2ed4e0=_0x2d9fe5;_0x129d9d=0xc8;}else{_0x129d9d=0xce;}_0x2e7a55[_0x7afd('0x1a')](_0x129d9d);return _0x2e7a55[_0x7afd('0x1f')]('Content-Range',_0x3d4dcf+'-'+_0x2ed4e0+'/'+_0x2d9fe5)['json'](_0x4923a7);}return null;};}function patchUpdates(_0x8ddbee){return function(_0x4d5140){try{jsonpatch[_0x7afd('0x20')](_0x4d5140,_0x8ddbee,!![]);}catch(_0x5826c6){return BPromise[_0x7afd('0x21')](_0x5826c6);}return _0x4d5140[_0x7afd('0x22')]();};}function saveUpdates(_0x38ae19,_0x464dc8){return function(_0x2964bb){if(_0x2964bb){return _0x2964bb[_0x7afd('0x23')](_0x38ae19)[_0x7afd('0x24')](function(_0x1bd87c){return _0x1bd87c;});}return null;};}function removeEntity(_0x146135,_0x378a3f){return function(_0xe6841d){if(_0xe6841d){return _0xe6841d['destroy']()[_0x7afd('0x24')](function(){var _0x1d84a4=_0xe6841d[_0x7afd('0x25')]({'plain':!![]});var _0x3bc3eb=_0x7afd('0x26');return db['UserProfileResource'][_0x7afd('0x27')]({'where':{'type':_0x3bc3eb,'resourceId':_0x1d84a4['id']}})[_0x7afd('0x24')](function(){return _0xe6841d;});})[_0x7afd('0x24')](function(){_0x146135[_0x7afd('0x1a')](0xcc)[_0x7afd('0x1b')]();});}};}function handleEntityNotFound(_0xc4b914,_0x2f9c91){return function(_0x5f0f9d){if(!_0x5f0f9d){_0xc4b914['sendStatus'](0x194);}return _0x5f0f9d;};}function handleError(_0x288f20,_0x19387d){_0x19387d=_0x19387d||0x1f4;return function(_0x582243){logger[_0x7afd('0x28')](_0x582243[_0x7afd('0x29')]);if(_0x582243[_0x7afd('0x2a')]){delete _0x582243['name'];}_0x288f20[_0x7afd('0x1a')](_0x19387d)[_0x7afd('0x2b')](_0x582243);};}exports[_0x7afd('0x2c')]=function(_0x466be2,_0x24d4f5){var _0x3a54bc={},_0x17b3f3={},_0x4ccca0={'count':0x0,'rows':[]};var _0x116c45=_[_0x7afd('0x2d')](db['Variable'][_0x7afd('0x2e')],function(_0x3c3cbe){return{'name':_0x3c3cbe[_0x7afd('0x2f')],'type':_0x3c3cbe[_0x7afd('0x30')][_0x7afd('0x31')]};});_0x17b3f3[_0x7afd('0x32')]=_[_0x7afd('0x2d')](_0x116c45,_0x7afd('0x2a'));_0x17b3f3[_0x7afd('0x33')]=_[_0x7afd('0x34')](_0x466be2['query']);_0x17b3f3[_0x7afd('0x35')]=_[_0x7afd('0x36')](_0x17b3f3[_0x7afd('0x32')],_0x17b3f3[_0x7afd('0x33')]);_0x3a54bc['attributes']=_[_0x7afd('0x36')](_0x17b3f3['model'],qs[_0x7afd('0x37')](_0x466be2[_0x7afd('0x33')][_0x7afd('0x37')]));_0x3a54bc['attributes']=_0x3a54bc[_0x7afd('0x38')][_0x7afd('0x39')]?_0x3a54bc[_0x7afd('0x38')]:_0x17b3f3[_0x7afd('0x32')];if(!_0x466be2[_0x7afd('0x33')][_0x7afd('0x3a')](_0x7afd('0x3b'))){_0x3a54bc[_0x7afd('0x1c')]=qs[_0x7afd('0x1c')](_0x466be2[_0x7afd('0x33')]['limit']);_0x3a54bc['offset']=qs[_0x7afd('0x1e')](_0x466be2['query'][_0x7afd('0x1e')]);}_0x3a54bc['order']=qs['sort'](_0x466be2[_0x7afd('0x33')][_0x7afd('0x3c')]);_0x3a54bc[_0x7afd('0x3d')]=qs[_0x7afd('0x35')](_[_0x7afd('0x3e')](_0x466be2[_0x7afd('0x33')],_0x17b3f3[_0x7afd('0x35')]),_0x116c45);if(_0x466be2[_0x7afd('0x33')][_0x7afd('0x3f')]){_0x3a54bc[_0x7afd('0x3d')]=_[_0x7afd('0x40')](_0x3a54bc[_0x7afd('0x3d')],{'$or':_[_0x7afd('0x2d')](_0x116c45,function(_0x49798e){if(_0x49798e[_0x7afd('0x30')]!==_0x7afd('0x41')){var _0x2b3b65={};_0x2b3b65[_0x49798e[_0x7afd('0x2a')]]={'$like':'%'+_0x466be2[_0x7afd('0x33')][_0x7afd('0x3f')]+'%'};return _0x2b3b65;}})});}_0x3a54bc=_[_0x7afd('0x40')]({},_0x3a54bc,_0x466be2[_0x7afd('0x42')]);var _0x36b33c={'where':_0x3a54bc['where']};return db['Variable'][_0x7afd('0x43')](_0x36b33c)[_0x7afd('0x24')](function(_0x4e7c6c){_0x4ccca0[_0x7afd('0x43')]=_0x4e7c6c;if(_0x466be2[_0x7afd('0x33')]['includeAll']){_0x3a54bc[_0x7afd('0x44')]=[{'all':!![]}];}return db[_0x7afd('0x45')][_0x7afd('0x46')](_0x3a54bc);})[_0x7afd('0x24')](function(_0xca3722){_0x4ccca0[_0x7afd('0x47')]=_0xca3722;return _0x4ccca0;})['then'](respondWithFilteredResult(_0x24d4f5,_0x3a54bc))[_0x7afd('0x48')](handleError(_0x24d4f5,null));};exports['show']=function(_0x137c44,_0x480fdd){var _0x5b42a2={'raw':!![],'where':{'id':_0x137c44[_0x7afd('0x49')]['id']}},_0x30b987={};_0x30b987[_0x7afd('0x32')]=_[_0x7afd('0x34')](db['Variable'][_0x7afd('0x2e')]);_0x30b987[_0x7afd('0x33')]=_[_0x7afd('0x34')](_0x137c44[_0x7afd('0x33')]);_0x30b987[_0x7afd('0x35')]=_[_0x7afd('0x36')](_0x30b987['model'],_0x30b987[_0x7afd('0x33')]);_0x5b42a2[_0x7afd('0x38')]=_[_0x7afd('0x36')](_0x30b987['model'],qs[_0x7afd('0x37')](_0x137c44[_0x7afd('0x33')][_0x7afd('0x37')]));_0x5b42a2[_0x7afd('0x38')]=_0x5b42a2['attributes']['length']?_0x5b42a2['attributes']:_0x30b987[_0x7afd('0x32')];if(_0x137c44[_0x7afd('0x33')]['includeAll']){_0x5b42a2[_0x7afd('0x44')]=[{'all':!![]}];}_0x5b42a2=_['merge']({},_0x5b42a2,_0x137c44[_0x7afd('0x42')]);return db[_0x7afd('0x45')]['find'](_0x5b42a2)[_0x7afd('0x24')](handleEntityNotFound(_0x480fdd,null))[_0x7afd('0x24')](respondWithResult(_0x480fdd,null))[_0x7afd('0x48')](handleError(_0x480fdd,null));};exports[_0x7afd('0x4a')]=function(_0x3b125b,_0x144082){return db[_0x7afd('0x45')][_0x7afd('0x4a')](_0x3b125b['body'],{})[_0x7afd('0x24')](function(_0x3804d3){var _0x383052=_0x3b125b['user'][_0x7afd('0x25')]({'plain':!![]});if(!_0x383052)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x383052[_0x7afd('0x4b')]===_0x7afd('0x4c')){var _0x15ab85=_0x3804d3[_0x7afd('0x25')]({'plain':!![]});var _0x2e3909=_0x7afd('0x26');return db[_0x7afd('0x4d')][_0x7afd('0x4e')]({'where':{'name':_0x2e3909,'userProfileId':_0x383052['userProfileId']},'raw':!![]})['then'](function(_0x30a8bd){if(_0x30a8bd&&_0x30a8bd[_0x7afd('0x4f')]===0x0){return db[_0x7afd('0x50')][_0x7afd('0x4a')]({'name':_0x15ab85['name'],'resourceId':_0x15ab85['id'],'type':_0x30a8bd['name'],'sectionId':_0x30a8bd['id']},{})[_0x7afd('0x24')](function(){return _0x3804d3;});}else{return _0x3804d3;}})['catch'](function(_0x409d53){logger[_0x7afd('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x409d53);throw _0x409d53;});}return _0x3804d3;})['then'](respondWithResult(_0x144082,0xc9))['catch'](handleError(_0x144082,null));};exports['update']=function(_0x1cd80b,_0x145aab){if(_0x1cd80b[_0x7afd('0x51')]['id']){delete _0x1cd80b[_0x7afd('0x51')]['id'];}return db[_0x7afd('0x45')]['find']({'where':{'id':_0x1cd80b[_0x7afd('0x49')]['id']}})[_0x7afd('0x24')](handleEntityNotFound(_0x145aab,null))[_0x7afd('0x24')](saveUpdates(_0x1cd80b[_0x7afd('0x51')],null))[_0x7afd('0x24')](respondWithResult(_0x145aab,null))[_0x7afd('0x48')](handleError(_0x145aab,null));};exports['destroy']=function(_0x380899,_0x222e98){return db[_0x7afd('0x45')][_0x7afd('0x4e')]({'where':{'id':_0x380899[_0x7afd('0x49')]['id']}})[_0x7afd('0x24')](handleEntityNotFound(_0x222e98,null))[_0x7afd('0x24')](removeEntity(_0x222e98,null))[_0x7afd('0x48')](handleError(_0x222e98,null));}; \ No newline at end of file +var _0xd056=['moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','get','Variables','UserProfileResource','stack','name','map','Variable','rawAttributes','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','intersection','catch','create','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0xd056,0x1d6));var _0x6d05=function(_0x1ba9c1,_0x22bc64){_0x1ba9c1=_0x1ba9c1-0x0;var _0x31c63b=_0xd056[_0x1ba9c1];return _0x31c63b;};'use strict';var emlformat=require(_0x6d05('0x0'));var rimraf=require(_0x6d05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d05('0x2'));var rp=require(_0x6d05('0x3'));var moment=require(_0x6d05('0x4'));var BPromise=require(_0x6d05('0x5'));var Mustache=require(_0x6d05('0x6'));var util=require('util');var path=require(_0x6d05('0x7'));var sox=require(_0x6d05('0x8'));var csv=require(_0x6d05('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d05('0xa'));var _=require('lodash');var squel=require(_0x6d05('0xb'));var crypto=require('crypto');var jsforce=require(_0x6d05('0xc'));var deskjs=require(_0x6d05('0xd'));var toCsv=require(_0x6d05('0x9'));var querystring=require(_0x6d05('0xe'));var Papa=require(_0x6d05('0xf'));var Redis=require(_0x6d05('0x10'));var authService=require(_0x6d05('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6d05('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d05('0x13'))(_0x6d05('0x14'));var utils=require(_0x6d05('0x15'));var config=require(_0x6d05('0x16'));var licenseUtil=require(_0x6d05('0x17'));var db=require(_0x6d05('0x18'))['db'];function respondWithStatusCode(_0x3a8a18,_0x1c9757){_0x1c9757=_0x1c9757||0xcc;return function(_0x25efba){if(_0x25efba){return _0x3a8a18[_0x6d05('0x19')](_0x1c9757);}return _0x3a8a18[_0x6d05('0x1a')](_0x1c9757)[_0x6d05('0x1b')]();};}function respondWithResult(_0x3658fa,_0x59ca08){_0x59ca08=_0x59ca08||0xc8;return function(_0x24aa8e){if(_0x24aa8e){return _0x3658fa[_0x6d05('0x1a')](_0x59ca08)[_0x6d05('0x1c')](_0x24aa8e);}};}function respondWithFilteredResult(_0x147dd8,_0x418e34){return function(_0x35c985){if(_0x35c985){var _0xdd930a=typeof _0x418e34['offset']===_0x6d05('0x1d')&&typeof _0x418e34[_0x6d05('0x1e')]===_0x6d05('0x1d');var _0x3e7bf=_0x35c985[_0x6d05('0x1f')];var _0x31af39=_0xdd930a?0x0:_0x418e34[_0x6d05('0x20')];var _0x1f7472=_0xdd930a?_0x35c985[_0x6d05('0x1f')]:_0x418e34[_0x6d05('0x20')]+_0x418e34[_0x6d05('0x1e')];var _0x43bb43;if(_0x1f7472>=_0x3e7bf){_0x1f7472=_0x3e7bf;_0x43bb43=0xc8;}else{_0x43bb43=0xce;}_0x147dd8[_0x6d05('0x1a')](_0x43bb43);return _0x147dd8[_0x6d05('0x21')](_0x6d05('0x22'),_0x31af39+'-'+_0x1f7472+'/'+_0x3e7bf)[_0x6d05('0x1c')](_0x35c985);}return null;};}function patchUpdates(_0x1ac400){return function(_0x4f3650){try{jsonpatch[_0x6d05('0x23')](_0x4f3650,_0x1ac400,!![]);}catch(_0x43d8f0){return BPromise[_0x6d05('0x24')](_0x43d8f0);}return _0x4f3650['save']();};}function saveUpdates(_0x1790c8,_0x4c59b6){return function(_0x1fdd59){if(_0x1fdd59){return _0x1fdd59[_0x6d05('0x25')](_0x1790c8)['then'](function(_0x1f4f76){return _0x1f4f76;});}return null;};}function removeEntity(_0x51928e,_0x440bb6){return function(_0x56f690){if(_0x56f690){return _0x56f690[_0x6d05('0x26')]()[_0x6d05('0x27')](function(){var _0x18ecd2=_0x56f690[_0x6d05('0x28')]({'plain':!![]});var _0x4087cb=_0x6d05('0x29');return db[_0x6d05('0x2a')]['destroy']({'where':{'type':_0x4087cb,'resourceId':_0x18ecd2['id']}})[_0x6d05('0x27')](function(){return _0x56f690;});})[_0x6d05('0x27')](function(){_0x51928e[_0x6d05('0x1a')](0xcc)[_0x6d05('0x1b')]();});}};}function handleEntityNotFound(_0x4defb6,_0x4d3285){return function(_0x1a64c0){if(!_0x1a64c0){_0x4defb6[_0x6d05('0x19')](0x194);}return _0x1a64c0;};}function handleError(_0x4e4c1e,_0x406676){_0x406676=_0x406676||0x1f4;return function(_0x44f907){logger['error'](_0x44f907[_0x6d05('0x2b')]);if(_0x44f907[_0x6d05('0x2c')]){delete _0x44f907['name'];}_0x4e4c1e['status'](_0x406676)['send'](_0x44f907);};}exports['index']=function(_0x343f83,_0x217231){var _0x2653b9={},_0x22d913={},_0x6a55f={'count':0x0,'rows':[]};var _0x15e684=_[_0x6d05('0x2d')](db[_0x6d05('0x2e')][_0x6d05('0x2f')],function(_0x34c8bc){return{'name':_0x34c8bc['fieldName'],'type':_0x34c8bc['type'][_0x6d05('0x30')]};});_0x22d913[_0x6d05('0x31')]=_[_0x6d05('0x2d')](_0x15e684,_0x6d05('0x2c'));_0x22d913[_0x6d05('0x32')]=_[_0x6d05('0x33')](_0x343f83['query']);_0x22d913[_0x6d05('0x34')]=_['intersection'](_0x22d913['model'],_0x22d913[_0x6d05('0x32')]);_0x2653b9['attributes']=_['intersection'](_0x22d913[_0x6d05('0x31')],qs[_0x6d05('0x35')](_0x343f83[_0x6d05('0x32')][_0x6d05('0x35')]));_0x2653b9[_0x6d05('0x36')]=_0x2653b9[_0x6d05('0x36')][_0x6d05('0x37')]?_0x2653b9['attributes']:_0x22d913['model'];if(!_0x343f83[_0x6d05('0x32')][_0x6d05('0x38')]('nolimit')){_0x2653b9[_0x6d05('0x1e')]=qs[_0x6d05('0x1e')](_0x343f83[_0x6d05('0x32')][_0x6d05('0x1e')]);_0x2653b9[_0x6d05('0x20')]=qs[_0x6d05('0x20')](_0x343f83[_0x6d05('0x32')][_0x6d05('0x20')]);}_0x2653b9['order']=qs[_0x6d05('0x39')](_0x343f83['query'][_0x6d05('0x39')]);_0x2653b9[_0x6d05('0x3a')]=qs['filters'](_[_0x6d05('0x3b')](_0x343f83[_0x6d05('0x32')],_0x22d913[_0x6d05('0x34')]),_0x15e684);if(_0x343f83[_0x6d05('0x32')][_0x6d05('0x3c')]){_0x2653b9[_0x6d05('0x3a')]=_[_0x6d05('0x3d')](_0x2653b9['where'],{'$or':_[_0x6d05('0x2d')](_0x15e684,function(_0x2dc800){if(_0x2dc800['type']!==_0x6d05('0x3e')){var _0x274d4a={};_0x274d4a[_0x2dc800[_0x6d05('0x2c')]]={'$like':'%'+_0x343f83[_0x6d05('0x32')][_0x6d05('0x3c')]+'%'};return _0x274d4a;}})});}_0x2653b9=_[_0x6d05('0x3d')]({},_0x2653b9,_0x343f83[_0x6d05('0x3f')]);var _0x538321={'where':_0x2653b9[_0x6d05('0x3a')]};return db[_0x6d05('0x2e')]['count'](_0x538321)[_0x6d05('0x27')](function(_0x58154f){_0x6a55f[_0x6d05('0x1f')]=_0x58154f;if(_0x343f83[_0x6d05('0x32')][_0x6d05('0x40')]){_0x2653b9[_0x6d05('0x41')]=[{'all':!![]}];}return db[_0x6d05('0x2e')][_0x6d05('0x42')](_0x2653b9);})[_0x6d05('0x27')](function(_0x43e26e){_0x6a55f[_0x6d05('0x43')]=_0x43e26e;return _0x6a55f;})[_0x6d05('0x27')](respondWithFilteredResult(_0x217231,_0x2653b9))['catch'](handleError(_0x217231,null));};exports['show']=function(_0x5b239f,_0x4bdfc7){var _0x197bc4={'raw':!![],'where':{'id':_0x5b239f[_0x6d05('0x44')]['id']}},_0xeca7bc={};_0xeca7bc[_0x6d05('0x31')]=_[_0x6d05('0x33')](db['Variable']['rawAttributes']);_0xeca7bc[_0x6d05('0x32')]=_[_0x6d05('0x33')](_0x5b239f[_0x6d05('0x32')]);_0xeca7bc[_0x6d05('0x34')]=_[_0x6d05('0x45')](_0xeca7bc[_0x6d05('0x31')],_0xeca7bc[_0x6d05('0x32')]);_0x197bc4[_0x6d05('0x36')]=_['intersection'](_0xeca7bc['model'],qs['fields'](_0x5b239f[_0x6d05('0x32')][_0x6d05('0x35')]));_0x197bc4[_0x6d05('0x36')]=_0x197bc4[_0x6d05('0x36')][_0x6d05('0x37')]?_0x197bc4[_0x6d05('0x36')]:_0xeca7bc[_0x6d05('0x31')];if(_0x5b239f[_0x6d05('0x32')][_0x6d05('0x40')]){_0x197bc4['include']=[{'all':!![]}];}_0x197bc4=_[_0x6d05('0x3d')]({},_0x197bc4,_0x5b239f['options']);return db[_0x6d05('0x2e')]['find'](_0x197bc4)['then'](handleEntityNotFound(_0x4bdfc7,null))[_0x6d05('0x27')](respondWithResult(_0x4bdfc7,null))[_0x6d05('0x46')](handleError(_0x4bdfc7,null));};exports[_0x6d05('0x47')]=function(_0x1662bb,_0x49a01d){return db[_0x6d05('0x2e')][_0x6d05('0x47')](_0x1662bb['body'],{})[_0x6d05('0x27')](function(_0x943c86){var _0x2a4ab5=_0x1662bb['user'][_0x6d05('0x28')]({'plain':!![]});if(!_0x2a4ab5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a4ab5['role']==='user'){var _0x1acc33=_0x943c86[_0x6d05('0x28')]({'plain':!![]});var _0x390312=_0x6d05('0x29');return db[_0x6d05('0x48')][_0x6d05('0x49')]({'where':{'name':_0x390312,'userProfileId':_0x2a4ab5[_0x6d05('0x4a')]},'raw':!![]})[_0x6d05('0x27')](function(_0x4a709){if(_0x4a709&&_0x4a709[_0x6d05('0x4b')]===0x0){return db[_0x6d05('0x2a')][_0x6d05('0x47')]({'name':_0x1acc33['name'],'resourceId':_0x1acc33['id'],'type':_0x4a709[_0x6d05('0x2c')],'sectionId':_0x4a709['id']},{})[_0x6d05('0x27')](function(){return _0x943c86;});}else{return _0x943c86;}})['catch'](function(_0x469fbc){logger[_0x6d05('0x4c')](_0x6d05('0x4d'),_0x469fbc);throw _0x469fbc;});}return _0x943c86;})[_0x6d05('0x27')](respondWithResult(_0x49a01d,0xc9))[_0x6d05('0x46')](handleError(_0x49a01d,null));};exports[_0x6d05('0x25')]=function(_0x459f9c,_0x4f147d){if(_0x459f9c[_0x6d05('0x4e')]['id']){delete _0x459f9c[_0x6d05('0x4e')]['id'];}return db[_0x6d05('0x2e')][_0x6d05('0x49')]({'where':{'id':_0x459f9c['params']['id']}})[_0x6d05('0x27')](handleEntityNotFound(_0x4f147d,null))[_0x6d05('0x27')](saveUpdates(_0x459f9c[_0x6d05('0x4e')],null))[_0x6d05('0x27')](respondWithResult(_0x4f147d,null))[_0x6d05('0x46')](handleError(_0x4f147d,null));};exports[_0x6d05('0x26')]=function(_0x69cdc,_0x172ac6){return db['Variable'][_0x6d05('0x49')]({'where':{'id':_0x69cdc[_0x6d05('0x44')]['id']}})['then'](handleEntityNotFound(_0x172ac6,null))[_0x6d05('0x27')](removeEntity(_0x172ac6,null))[_0x6d05('0x46')](handleError(_0x172ac6,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 52434c9..3dffb47 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 _0x45d8=['../../config/logger','api','moment','bluebird','path','../../config/environment','./variable.attributes','Variable','tools_variables','lodash','util'];(function(_0x417485,_0xdfeb87){var _0x528683=function(_0x28fda7){while(--_0x28fda7){_0x417485['push'](_0x417485['shift']());}};_0x528683(++_0xdfeb87);}(_0x45d8,0x174));var _0x845d=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x45d8[_0x3cb6dc];return _0x47ec89;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var logger=require(_0x845d('0x2'))(_0x845d('0x3'));var moment=require(_0x845d('0x4'));var BPromise=require(_0x845d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x845d('0x6'));var rimraf=require('rimraf');var config=require(_0x845d('0x7'));var attributes=require(_0x845d('0x8'));module['exports']=function(_0x4ba664,_0x312806){return _0x4ba664['define'](_0x845d('0x9'),attributes,{'tableName':_0x845d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4268=['Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./variable.attributes','exports','define'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4268,0x15e));var _0x8426=function(_0x5043bd,_0x557d42){_0x5043bd=_0x5043bd-0x0;var _0x304c04=_0x4268[_0x5043bd];return _0x304c04;};'use strict';var _=require(_0x8426('0x0'));var util=require(_0x8426('0x1'));var logger=require(_0x8426('0x2'))(_0x8426('0x3'));var moment=require('moment');var BPromise=require(_0x8426('0x4'));var rp=require(_0x8426('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8426('0x6'));var attributes=require(_0x8426('0x7'));module[_0x8426('0x8')]=function(_0x130007,_0x14233b){return _0x130007[_0x8426('0x9')](_0x8426('0xa'),attributes,{'tableName':_0x8426('0xb'),'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 62de25a..90e34dd 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(_0x241b5a,_0x5ac06c){var _0x49fff8=function(_0x31f8ec){while(--_0x31f8ec){_0x241b5a['push'](_0x241b5a['shift']());}};_0x49fff8(++_0x5ac06c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x14706a,_0x43b00f){_0x14706a=_0x14706a-0x0;var _0xe5458c=_0x1cb9[_0x14706a];return _0xe5458c;};'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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x326f,0xd1));var _0xf326=function(_0x44d39e,_0x5c6390){_0x44d39e=_0x44d39e-0x0;var _0x1a483e=_0x326f[_0x44d39e];return _0x1a483e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 71de8c9..04e2cb1 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 _0xabd8=['/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','index','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset'];(function(_0x321d87,_0x247aae){var _0x44a87f=function(_0x2ef164){while(--_0x2ef164){_0x321d87['push'](_0x321d87['shift']());}};_0x44a87f(++_0x247aae);}(_0xabd8,0xc8));var _0x8abd=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xabd8[_0x2e7a43];return _0x52e9e1;};'use strict';var express=require('express');var router=express[_0x8abd('0x0')]();var auth=require(_0x8abd('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0x8abd('0x2')]);router[_0x8abd('0x3')](_0x8abd('0x4'),auth[_0x8abd('0x5')](),auth[_0x8abd('0x6')](),controller[_0x8abd('0x7')]);router[_0x8abd('0x3')](_0x8abd('0x8'),auth[_0x8abd('0x5')](),auth[_0x8abd('0x6')](),controller[_0x8abd('0x9')]);router[_0x8abd('0x3')]('/pull',auth[_0x8abd('0x5')](),auth[_0x8abd('0x6')](),controller['pull']);router[_0x8abd('0x3')](_0x8abd('0xa'),auth[_0x8abd('0x5')](),controller[_0x8abd('0xb')]);router[_0x8abd('0x3')](_0x8abd('0xc'),controller[_0x8abd('0xd')]);module[_0x8abd('0xe')]=router; \ No newline at end of file +var _0xe5a2=['isAuthenticated','canUpdate','/reset','reset','/pull','/restart','restart','migrations','express','Router','../../components/auth/service','./version.controller','get','/fetch'];(function(_0x1eb21d,_0x33a68b){var _0x43a875=function(_0x2ba9bd){while(--_0x2ba9bd){_0x1eb21d['push'](_0x1eb21d['shift']());}};_0x43a875(++_0x33a68b);}(_0xe5a2,0x166));var _0x2e5a=function(_0x33c8cd,_0xee1e23){_0x33c8cd=_0x33c8cd-0x0;var _0x4c28fb=_0xe5a2[_0x33c8cd];return _0x4c28fb;};'use strict';var express=require(_0x2e5a('0x0'));var router=express[_0x2e5a('0x1')]();var auth=require(_0x2e5a('0x2'));var controller=require(_0x2e5a('0x3'));router['get']('/',controller['index']);router[_0x2e5a('0x4')](_0x2e5a('0x5'),auth[_0x2e5a('0x6')](),auth[_0x2e5a('0x7')](),controller['fetch']);router[_0x2e5a('0x4')](_0x2e5a('0x8'),auth[_0x2e5a('0x6')](),auth[_0x2e5a('0x7')](),controller[_0x2e5a('0x9')]);router[_0x2e5a('0x4')](_0x2e5a('0xa'),auth['isAuthenticated'](),auth[_0x2e5a('0x7')](),controller['pull']);router['get'](_0x2e5a('0xb'),auth[_0x2e5a('0x6')](),controller[_0x2e5a('0xc')]);router['get']('/migrations',controller[_0x2e5a('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index f7c8f0f..476b91f 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 _0xbcb5=['push','sequelize','Migration','getQueryInterface','constructor','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/pm2','update','simple-git','root','index','query','fetch','latest','exports','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','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','server','length','replace'];(function(_0x101855,_0x3c7df1){var _0x11a974=function(_0xdb443a){while(--_0xdb443a){_0x101855['push'](_0x101855['shift']());}};_0x11a974(++_0x3c7df1);}(_0xbcb5,0x176));var _0x5bcb=function(_0x5a4e97,_0x3b0d3c){_0x5a4e97=_0x5a4e97-0x0;var _0x4c1d0b=_0xbcb5[_0x5a4e97];return _0x4c1d0b;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x5bcb('0x0'));var pkginfo=require(_0x5bcb('0x1'))(module,_0x5bcb('0x2'));var compareVersions=require(_0x5bcb('0x3'));var exec=require('child_process')[_0x5bcb('0x4')];var db=require(_0x5bcb('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x5bcb('0x6'));var logger=require('../../config/logger')(_0x5bcb('0x7'));var git=require(_0x5bcb('0x8'))(config[_0x5bcb('0x9')]);exports[_0x5bcb('0xa')]=function(_0x36f62c,_0x1cc065){var _0x2891d3={'current':module['exports'][_0x5bcb('0x2')],'phonebar':0x2};if(_0x36f62c[_0x5bcb('0xb')]&&_0x36f62c[_0x5bcb('0xb')]['latest']){return git[_0x5bcb('0xc')]()['tags'](function(_0x4140a4,_0x27fb41){_0x2891d3[_0x5bcb('0xd')]=(_0x4140a4?module[_0x5bcb('0xe')][_0x5bcb('0x2')]:_0x27fb41['latest'])||_0x5bcb('0xf');return _0x1cc065[_0x5bcb('0x10')](0xc8)[_0x5bcb('0x11')](_0x2891d3);});}else{return _0x1cc065[_0x5bcb('0x10')](0xc8)[_0x5bcb('0x11')](_0x2891d3);}};exports[_0x5bcb('0xc')]=function(_0x4c515e,_0x5e0366){return git[_0x5bcb('0xc')]([_0x5bcb('0x12'),_0x5bcb('0x13')],function(_0x2fc372){if(_0x2fc372){logger['error'](_0x2fc372);return _0x5e0366[_0x5bcb('0x10')](0x1f4)[_0x5bcb('0x11')](_0x2fc372);}logger[_0x5bcb('0x14')](_0x5bcb('0x15'));return _0x5e0366['status'](0xc8)['json']({'output':_0x5bcb('0x16')});});};exports['reset']=function(_0xeb6918,_0x3e7419){return git[_0x5bcb('0x17')]([_0x5bcb('0x18'),_0x5bcb('0x19')],function(_0x2a4bdc){if(_0x2a4bdc){logger[_0x5bcb('0x1a')](_0x2a4bdc);return _0x3e7419[_0x5bcb('0x10')](0x1f4)[_0x5bcb('0x11')](_0x2a4bdc);}logger[_0x5bcb('0x14')](_0x5bcb('0x1b'));return _0x3e7419[_0x5bcb('0x10')](0xc8)['json']({'output':_0x5bcb('0x1c')});});};exports[_0x5bcb('0x1d')]=function(_0x45fa2a,_0x3e55d3){exec(_0x5bcb('0x1e'),function(_0x26765a,_0x202c05,_0x5e6480){logger[_0x5bcb('0x14')](_0x202c05);logger[_0x5bcb('0x14')](_0x5e6480);if(_0x26765a){logger[_0x5bcb('0x1a')](_0x26765a);return _0x3e55d3[_0x5bcb('0x10')](0x1f4)['json'](_0x26765a);}return _0x3e55d3[_0x5bcb('0x10')](0xc8)[_0x5bcb('0x11')]({'output':_0x202c05});});};exports[_0x5bcb('0x1f')]=function(_0x4581fe,_0x447add){return pm2[_0x5bcb('0x1f')](_0x5bcb('0x20'))[_0x5bcb('0x21')](function(_0xbac83e){logger[_0x5bcb('0x14')](_0x5bcb('0x22'),_0xbac83e);return _0x447add[_0x5bcb('0x10')](0xc8)[_0x5bcb('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x5bcb('0x23')](function(_0x26d20c){logger[_0x5bcb('0x1a')](_0x26d20c);return _0x447add[_0x5bcb('0x10')](0x1f4)[_0x5bcb('0x11')](_0x26d20c);});};exports[_0x5bcb('0x24')]=function(_0x1d48b1,_0x40a369){var _0xf5f402=fs[_0x5bcb('0x25')](path[_0x5bcb('0x26')](config[_0x5bcb('0x9')],_0x5bcb('0x27'),_0x5bcb('0x24')));var _0x2d3b1=[];for(var _0x4ef83c=0x0;_0x4ef83c<_0xf5f402[_0x5bcb('0x28')];_0x4ef83c++){var _0x8d676=_0xf5f402[_0x4ef83c][_0x5bcb('0x29')]('.js','');if(compareVersions(module[_0x5bcb('0xe')][_0x5bcb('0x2')],_0x8d676)===-0x1){_0x2d3b1[_0x5bcb('0x2a')](_0x8d676);}}if(_0x2d3b1[_0x5bcb('0x28')]){var _0x4be794=_0x2d3b1['sort'](compareVersions);var _0x2c7980=new Umzug({'storage':_0x5bcb('0x2b'),'storageOptions':{'model':db[_0x5bcb('0x2c')],'modelName':_0x5bcb('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x5bcb('0x2b')][_0x5bcb('0x2d')](),db[_0x5bcb('0x2b')][_0x5bcb('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x5bcb('0x26')](config['root'],_0x5bcb('0x27'),'migrations'),'pattern':/\.js$/}});_0x2c7980['up']({'migrations':_[_0x5bcb('0x2f')](_0x4be794,function(_0x2bea9c){return _0x2bea9c+_0x5bcb('0x30');})})[_0x5bcb('0x21')](function(){return _0x40a369[_0x5bcb('0x10')](0xc8)[_0x5bcb('0x11')]({'output':_0x5bcb('0x31')+module['exports'][_0x5bcb('0x2')]+'\x20to\x20'+_[_0x5bcb('0x32')](_0x4be794),'migrations':_[_0x5bcb('0x26')](_0x4be794)});})[_0x5bcb('0x23')](function(_0x4670db){if(_0x4670db instanceof db[_0x5bcb('0x2b')][_0x5bcb('0x33')]){return _0x40a369[_0x5bcb('0x10')](0xc8)[_0x5bcb('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x40a369[_0x5bcb('0x10')](0x1f4)['json'](_0x4670db);}});}else{return _0x40a369['status'](0xc8)[_0x5bcb('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x3952=['replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','root','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','version','exec','../../config/pm2','../../config/logger','exports','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','catch','migrations','readdirSync','server','length'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3952,0xd3));var _0x2395=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x3952[_0x1bc013];return _0x55df36;};'use strict';var Umzug=require('umzug');var path=require(_0x2395('0x0'));var fs=require('fs');var _=require(_0x2395('0x1'));var pkginfo=require('pkginfo')(module,_0x2395('0x2'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0x2395('0x3')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x2395('0x4'));var logger=require(_0x2395('0x5'))('update');var git=require('simple-git')(config['root']);exports['index']=function(_0x3dbd04,_0x111b4d){var _0x380871={'current':module[_0x2395('0x6')][_0x2395('0x2')],'phonebar':0x2};if(_0x3dbd04[_0x2395('0x7')]&&_0x3dbd04[_0x2395('0x7')][_0x2395('0x8')]){return git[_0x2395('0x9')]()[_0x2395('0xa')](function(_0x42198f,_0x507463){_0x380871['latest']=(_0x42198f?module[_0x2395('0x6')][_0x2395('0x2')]:_0x507463[_0x2395('0x8')])||'2.0.0';return _0x111b4d[_0x2395('0xb')](0xc8)[_0x2395('0xc')](_0x380871);});}else{return _0x111b4d[_0x2395('0xb')](0xc8)[_0x2395('0xc')](_0x380871);}};exports['fetch']=function(_0x49b044,_0x277869){return git[_0x2395('0x9')]([_0x2395('0xd'),_0x2395('0xe')],function(_0x51218f){if(_0x51218f){logger[_0x2395('0xf')](_0x51218f);return _0x277869[_0x2395('0xb')](0x1f4)[_0x2395('0xc')](_0x51218f);}logger['info'](_0x2395('0x10'));return _0x277869[_0x2395('0xb')](0xc8)[_0x2395('0xc')]({'output':_0x2395('0x11')});});};exports[_0x2395('0x12')]=function(_0x487a98,_0x462b6f){return git[_0x2395('0x12')]([_0x2395('0x13'),_0x2395('0x14')],function(_0x5b756d){if(_0x5b756d){logger['error'](_0x5b756d);return _0x462b6f[_0x2395('0xb')](0x1f4)[_0x2395('0xc')](_0x5b756d);}logger[_0x2395('0x15')](_0x2395('0x16'));return _0x462b6f[_0x2395('0xb')](0xc8)[_0x2395('0xc')]({'output':_0x2395('0x17')});});};exports[_0x2395('0x18')]=function(_0x41d509,_0x36ba34){exec(_0x2395('0x19'),function(_0x18090f,_0x3ddae9,_0x1672e7){logger['info'](_0x3ddae9);logger[_0x2395('0x15')](_0x1672e7);if(_0x18090f){logger[_0x2395('0xf')](_0x18090f);return _0x36ba34['status'](0x1f4)[_0x2395('0xc')](_0x18090f);}return _0x36ba34[_0x2395('0xb')](0xc8)[_0x2395('0xc')]({'output':_0x3ddae9});});};exports[_0x2395('0x1a')]=function(_0x3d4b4b,_0x11cff8){return pm2['restart'](_0x2395('0x1b'))[_0x2395('0x1c')](function(_0x22f51c){logger['info']('pm2\x20restart\x20motion\x20%s',_0x22f51c);return _0x11cff8[_0x2395('0xb')](0xc8)[_0x2395('0xc')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x2395('0x1d')](function(_0x44679e){logger[_0x2395('0xf')](_0x44679e);return _0x11cff8['status'](0x1f4)[_0x2395('0xc')](_0x44679e);});};exports[_0x2395('0x1e')]=function(_0x5c19d9,_0x524a3f){var _0x60beb3=fs[_0x2395('0x1f')](path['join'](config['root'],_0x2395('0x20'),_0x2395('0x1e')));var _0x54fdec=[];for(var _0x132e3a=0x0;_0x132e3a<_0x60beb3[_0x2395('0x21')];_0x132e3a++){var _0x3f547c=_0x60beb3[_0x132e3a][_0x2395('0x22')](_0x2395('0x23'),'');if(compareVersions(module['exports']['version'],_0x3f547c)===-0x1){_0x54fdec['push'](_0x3f547c);}}if(_0x54fdec['length']){var _0x311089=_0x54fdec[_0x2395('0x24')](compareVersions);var _0x110860=new Umzug({'storage':_0x2395('0x25'),'storageOptions':{'model':db[_0x2395('0x26')],'modelName':_0x2395('0x26'),'columnName':'version'},'migrations':{'params':[db[_0x2395('0x25')][_0x2395('0x27')](),db['sequelize'][_0x2395('0x28')],function(){throw new Error(_0x2395('0x29'));}],'path':path[_0x2395('0x2a')](config[_0x2395('0x2b')],_0x2395('0x20'),'migrations'),'pattern':/\.js$/}});_0x110860['up']({'migrations':_[_0x2395('0x2c')](_0x311089,function(_0x2d282a){return _0x2d282a+_0x2395('0x23');})})[_0x2395('0x1c')](function(){return _0x524a3f[_0x2395('0xb')](0xc8)['json']({'output':_0x2395('0x2d')+module[_0x2395('0x6')][_0x2395('0x2')]+'\x20to\x20'+_[_0x2395('0x2e')](_0x311089),'migrations':_[_0x2395('0x2a')](_0x311089)});})[_0x2395('0x1d')](function(_0x4997c5){if(_0x4997c5 instanceof db[_0x2395('0x25')][_0x2395('0x2f')]){return _0x524a3f[_0x2395('0xb')](0xc8)['json']({'output':_0x2395('0x30')});}else{return _0x524a3f['status'](0x1f4)[_0x2395('0xc')](_0x4997c5);}});}else{return _0x524a3f[_0x2395('0xb')](0xc8)[_0x2395('0xc')]({'output':_0x2395('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0657449..59c420c 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 _0x816b=['describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','index','/describe','isAuthenticated'];(function(_0x13eebb,_0x263936){var _0x3ff2d8=function(_0x1fb7b6){while(--_0x1fb7b6){_0x13eebb['push'](_0x13eebb['shift']());}};_0x3ff2d8(++_0x263936);}(_0x816b,0xdc));var _0xb816=function(_0x16758b,_0x1fad5b){_0x16758b=_0x16758b-0x0;var _0xc3fdbf=_0x816b[_0x16758b];return _0xc3fdbf;};'use strict';var multer=require('multer');var util=require(_0xb816('0x0'));var path=require(_0xb816('0x1'));var timeout=require(_0xb816('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb816('0x3'));var auth=require(_0xb816('0x4'));var interaction=require(_0xb816('0x5'));var config=require('../../config/environment');var controller=require(_0xb816('0x6'));router[_0xb816('0x7')]('/',auth['isAuthenticated'](),controller[_0xb816('0x8')]);router[_0xb816('0x7')](_0xb816('0x9'),auth[_0xb816('0xa')](),controller[_0xb816('0xb')]);router[_0xb816('0x7')](_0xb816('0xc'),auth[_0xb816('0xa')](),controller[_0xb816('0xd')]);router[_0xb816('0xe')]('/',auth[_0xb816('0xa')](),controller[_0xb816('0xf')]);router[_0xb816('0x10')](_0xb816('0xc'),auth[_0xb816('0xa')](),controller[_0xb816('0x11')]);router[_0xb816('0x12')](_0xb816('0xc'),auth[_0xb816('0xa')](),controller[_0xb816('0x13')]);module[_0xb816('0x14')]=router; \ No newline at end of file +var _0xf321=['./voiceAgentReport.controller','isAuthenticated','get','/describe','/:id','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x22634f,_0x47120f){var _0x27a216=function(_0x22ffff){while(--_0x22ffff){_0x22634f['push'](_0x22634f['shift']());}};_0x27a216(++_0x47120f);}(_0xf321,0x10f));var _0x1f32=function(_0x48a48e,_0x5d96bd){_0x48a48e=_0x48a48e-0x0;var _0xe70df3=_0xf321[_0x48a48e];return _0xe70df3;};'use strict';var multer=require('multer');var util=require(_0x1f32('0x0'));var path=require(_0x1f32('0x1'));var timeout=require(_0x1f32('0x2'));var express=require(_0x1f32('0x3'));var router=express[_0x1f32('0x4')]();var fs_extra=require(_0x1f32('0x5'));var auth=require(_0x1f32('0x6'));var interaction=require(_0x1f32('0x7'));var config=require(_0x1f32('0x8'));var controller=require(_0x1f32('0x9'));router['get']('/',auth[_0x1f32('0xa')](),controller['index']);router[_0x1f32('0xb')](_0x1f32('0xc'),auth[_0x1f32('0xa')](),controller['describe']);router['get'](_0x1f32('0xd'),auth[_0x1f32('0xa')](),controller['show']);router[_0x1f32('0xe')]('/',auth[_0x1f32('0xa')](),controller[_0x1f32('0xf')]);router[_0x1f32('0x10')](_0x1f32('0xd'),auth[_0x1f32('0xa')](),controller[_0x1f32('0x11')]);router[_0x1f32('0x12')](_0x1f32('0xd'),auth[_0x1f32('0xa')](),controller[_0x1f32('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 0291d96..584d7d5 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 _0x7df3=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x7df3,0x1cc));var _0x37df=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7df3[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x37df('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x37df('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x37df('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x37df('0x3')]},'agentconnectAt':{'type':Sequelize[_0x37df('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x37df('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x37df('0x3')]},'agentdumpAt':{'type':Sequelize[_0x37df('0x3')]},'holdtime':{'type':Sequelize[_0x37df('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x37df('0x4')]},'agentacw':{'type':Sequelize[_0x37df('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x37df('0x4')]},'reason':{'type':Sequelize[_0x37df('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x37df('0x2')]},'channelstate':{'type':Sequelize[_0x37df('0x4')]},'channelstatedesc':{'type':Sequelize[_0x37df('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x37df('0x2')]},'language':{'type':Sequelize[_0x37df('0x2')]},'accountcode':{'type':Sequelize[_0x37df('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x37df('0x2')]},'priority':{'type':Sequelize[_0x37df('0x2')]},'destchannel':{'type':Sequelize[_0x37df('0x2')]},'destchannelstate':{'type':Sequelize[_0x37df('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x37df('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x37df('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x37df('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x37df('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x37df('0x2')]},'destcontext':{'type':Sequelize[_0x37df('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x37df('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x37df('0x2')]},'transfer':{'type':Sequelize[_0x37df('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x37df('0x2')],'comment':_0x37df('0x6')},'transferexten':{'type':Sequelize[_0x37df('0x2')]},'transferuniqueid':{'type':Sequelize[_0x37df('0x2')]},'agententerreason':{'type':Sequelize[_0x37df('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1a37=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x510d50,_0x284a40){var _0x5eead6=function(_0x589bbe){while(--_0x589bbe){_0x510d50['push'](_0x510d50['shift']());}};_0x5eead6(++_0x284a40);}(_0x1a37,0xb4));var _0x71a3=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x1a37[_0xd09668];return _0x68726;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'type':{'type':Sequelize[_0x71a3('0x2')]},'uniqueid':{'type':Sequelize[_0x71a3('0x2')]},'calleridnum':{'type':Sequelize[_0x71a3('0x2')]},'calleridname':{'type':Sequelize[_0x71a3('0x2')]},'queue':{'type':Sequelize[_0x71a3('0x2')]},'interface':{'type':Sequelize[_0x71a3('0x2')]},'membername':{'type':Sequelize[_0x71a3('0x2')]},'agentcalledAt':{'type':Sequelize[_0x71a3('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x71a3('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x71a3('0x3')]},'holdtime':{'type':Sequelize[_0x71a3('0x4')]},'agentcomplete':{'type':Sequelize[_0x71a3('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x71a3('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x71a3('0x2')]},'lastevent':{'type':Sequelize[_0x71a3('0x2')]},'channel':{'type':Sequelize[_0x71a3('0x2')]},'channelstate':{'type':Sequelize[_0x71a3('0x4')]},'channelstatedesc':{'type':Sequelize[_0x71a3('0x2')]},'connectedlinenum':{'type':Sequelize[_0x71a3('0x2')]},'connectedlinename':{'type':Sequelize[_0x71a3('0x2')]},'language':{'type':Sequelize[_0x71a3('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x71a3('0x2')]},'destchannel':{'type':Sequelize[_0x71a3('0x2')]},'destchannelstate':{'type':Sequelize[_0x71a3('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x71a3('0x2')]},'destcalleridnum':{'type':Sequelize[_0x71a3('0x2')]},'destcalleridname':{'type':Sequelize[_0x71a3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x71a3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x71a3('0x2')]},'destlanguage':{'type':Sequelize[_0x71a3('0x2')]},'destaccountcode':{'type':Sequelize[_0x71a3('0x2')]},'destcontext':{'type':Sequelize[_0x71a3('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x71a3('0x2')]},'destuniqueid':{'type':Sequelize[_0x71a3('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x71a3('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x71a3('0x2')],'comment':_0x71a3('0x6')},'transferexten':{'type':Sequelize[_0x71a3('0x2')]},'transferuniqueid':{'type':Sequelize[_0x71a3('0x2')]},'agententerreason':{'type':Sequelize[_0x71a3('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 96c4277..5300eaf 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(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 fcc5174..f3527f0 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 _0xf9d5=['define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xf9d5,0x122));var _0x5f9d=function(_0x6aef36,_0x501c76){_0x6aef36=_0x6aef36-0x0;var _0x29132a=_0xf9d5[_0x6aef36];return _0x29132a;};'use strict';var _=require('lodash');var util=require(_0x5f9d('0x0'));var logger=require(_0x5f9d('0x1'))('api');var moment=require(_0x5f9d('0x2'));var BPromise=require(_0x5f9d('0x3'));var rp=require(_0x5f9d('0x4'));var fs=require('fs');var path=require(_0x5f9d('0x5'));var rimraf=require(_0x5f9d('0x6'));var config=require(_0x5f9d('0x7'));var attributes=require(_0x5f9d('0x8'));module['exports']=function(_0x1fc74c,_0x59027b){return _0x1fc74c[_0x5f9d('0x9')](_0x5f9d('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5f9d('0xb'),_0x5f9d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bff=['bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','api'];(function(_0x1113d9,_0x52cd99){var _0x4a5aa2=function(_0x1f0b6e){while(--_0x1f0b6e){_0x1113d9['push'](_0x1113d9['shift']());}};_0x4a5aa2(++_0x52cd99);}(_0x6bff,0xa6));var _0xf6bf=function(_0x218fd8,_0x593900){_0x218fd8=_0x218fd8-0x0;var _0xb1fb78=_0x6bff[_0x218fd8];return _0xb1fb78;};'use strict';var _=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var logger=require('../../config/logger')(_0xf6bf('0x2'));var moment=require('moment');var BPromise=require(_0xf6bf('0x3'));var rp=require(_0xf6bf('0x4'));var fs=require('fs');var path=require(_0xf6bf('0x5'));var rimraf=require(_0xf6bf('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6bf('0x7'));module[_0xf6bf('0x8')]=function(_0x27cdda,_0x239d17){return _0x27cdda[_0xf6bf('0x9')](_0xf6bf('0xa'),attributes,{'tableName':_0xf6bf('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf6bf('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 53954b9..070ec8a 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 _0x6e81=['../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','update','body','where','attributes','UpdateVoiceAgentReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x37fc0e,_0x118bbf){var _0x4ccdc5=function(_0x138480){while(--_0x138480){_0x37fc0e['push'](_0x37fc0e['shift']());}};_0x4ccdc5(++_0x118bbf);}(_0x6e81,0xe5));var _0x16e8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6e81[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x16e8('0x0'));var util=require('util');var moment=require(_0x16e8('0x1'));var BPromise=require(_0x16e8('0x2'));var rs=require(_0x16e8('0x3'));var fs=require('fs');var Redis=require(_0x16e8('0x4'));var db=require(_0x16e8('0x5'))['db'];var utils=require(_0x16e8('0x6'));var logger=require(_0x16e8('0x7'))(_0x16e8('0x8'));var config=require(_0x16e8('0x9'));var jayson=require(_0x16e8('0xa'));var client=jayson[_0x16e8('0xb')][_0x16e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc6c250,_0x437580,_0x54cc33){return new BPromise(function(_0x44857e,_0x116a57){return client['request'](_0xc6c250,_0x54cc33)[_0x16e8('0xd')](function(_0x588995){logger[_0x16e8('0xe')](_0x16e8('0xf'),_0x437580,_0x16e8('0x10'));logger[_0x16e8('0x11')](_0x16e8('0x12'),_0x437580,'request\x20sent',JSON['stringify'](_0x588995));if(_0x588995[_0x16e8('0x13')]){if(_0x588995['error']['code']===0x1f4){logger[_0x16e8('0x13')](_0x16e8('0xf'),_0x437580,_0x588995[_0x16e8('0x13')]['message']);return _0x116a57(_0x588995[_0x16e8('0x13')]['message']);}logger['error'](_0x16e8('0xf'),_0x437580,_0x588995['error'][_0x16e8('0x14')]);return _0x44857e(_0x588995[_0x16e8('0x13')][_0x16e8('0x14')]);}else{logger[_0x16e8('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x437580,'request\x20sent');_0x44857e(_0x588995[_0x16e8('0x15')]['message']);}})[_0x16e8('0x16')](function(_0x1e13c5){logger[_0x16e8('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x437580,_0x1e13c5);_0x116a57(_0x1e13c5);});});}exports[_0x16e8('0x17')]=function(_0x4d8343){var _0x1c5a4e=this;return new Promise(function(_0x2390e2,_0x50fcbf){return db[_0x16e8('0x18')][_0x16e8('0x19')](_0x4d8343['body'],{'raw':_0x4d8343[_0x16e8('0x1a')]?_0x4d8343[_0x16e8('0x1a')][_0x16e8('0x1b')]===undefined?!![]:![]:!![]})[_0x16e8('0xd')](function(_0xa31c13){logger[_0x16e8('0xe')](_0x16e8('0x17'),_0x4d8343);logger[_0x16e8('0x11')]('CreateVoiceAgentReport',_0x4d8343,JSON[_0x16e8('0x1c')](_0xa31c13));_0x2390e2(_0xa31c13);})[_0x16e8('0x16')](function(_0x47ac85){logger[_0x16e8('0x13')]('CreateVoiceAgentReport',_0x47ac85[_0x16e8('0x14')],_0x4d8343);_0x50fcbf(_0x1c5a4e[_0x16e8('0x13')](0x1f4,_0x47ac85[_0x16e8('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0xd7eb4c){var _0x1b7712=this;return new Promise(function(_0x24f448,_0x2f1eb9){return db['VoiceAgentReport'][_0x16e8('0x1d')](_0xd7eb4c[_0x16e8('0x1e')],{'raw':_0xd7eb4c[_0x16e8('0x1a')]?_0xd7eb4c['options'][_0x16e8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd7eb4c['options']?_0xd7eb4c[_0x16e8('0x1a')][_0x16e8('0x1f')]||null:null,'attributes':_0xd7eb4c[_0x16e8('0x1a')]?_0xd7eb4c[_0x16e8('0x1a')][_0x16e8('0x20')]||null:null,'limit':_0xd7eb4c[_0x16e8('0x1a')]?_0xd7eb4c[_0x16e8('0x1a')]['limit']||null:null})[_0x16e8('0xd')](function(_0x357e45){logger[_0x16e8('0xe')](_0x16e8('0x21'),_0xd7eb4c);logger['debug']('UpdateVoiceAgentReport',_0xd7eb4c,JSON[_0x16e8('0x1c')](_0x357e45));_0x24f448(_0x357e45);})[_0x16e8('0x16')](function(_0x353d0b){logger[_0x16e8('0x13')]('UpdateVoiceAgentReport',_0x353d0b[_0x16e8('0x14')],_0xd7eb4c);_0x2f1eb9(_0x1b7712['error'](0x1f4,_0x353d0b['message']));});});}; \ No newline at end of file +var _0x1fcf=['attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where'];(function(_0x47bd60,_0x385f18){var _0x379085=function(_0x1ae943){while(--_0x1ae943){_0x47bd60['push'](_0x47bd60['shift']());}};_0x379085(++_0x385f18);}(_0x1fcf,0x111));var _0xf1fc=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x1fcf[_0x22cc16];return _0x399b70;};'use strict';var _=require(_0xf1fc('0x0'));var util=require(_0xf1fc('0x1'));var moment=require(_0xf1fc('0x2'));var BPromise=require(_0xf1fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1fc('0x4'));var db=require(_0xf1fc('0x5'))['db'];var utils=require(_0xf1fc('0x6'));var logger=require(_0xf1fc('0x7'))(_0xf1fc('0x8'));var config=require(_0xf1fc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf1fc('0xa')][_0xf1fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7fb3e3,_0x3ac2f9,_0x4dad3a){return new BPromise(function(_0x24b28e,_0x351fcd){return client[_0xf1fc('0xc')](_0x7fb3e3,_0x4dad3a)[_0xf1fc('0xd')](function(_0x4fdd48){logger[_0xf1fc('0xe')](_0xf1fc('0xf'),_0x3ac2f9,'request\x20sent');logger[_0xf1fc('0x10')](_0xf1fc('0x11'),_0x3ac2f9,_0xf1fc('0x12'),JSON[_0xf1fc('0x13')](_0x4fdd48));if(_0x4fdd48[_0xf1fc('0x14')]){if(_0x4fdd48[_0xf1fc('0x14')]['code']===0x1f4){logger['error'](_0xf1fc('0xf'),_0x3ac2f9,_0x4fdd48['error'][_0xf1fc('0x15')]);return _0x351fcd(_0x4fdd48[_0xf1fc('0x14')]['message']);}logger[_0xf1fc('0x14')](_0xf1fc('0xf'),_0x3ac2f9,_0x4fdd48[_0xf1fc('0x14')][_0xf1fc('0x15')]);return _0x24b28e(_0x4fdd48[_0xf1fc('0x14')][_0xf1fc('0x15')]);}else{logger[_0xf1fc('0xe')](_0xf1fc('0xf'),_0x3ac2f9,'request\x20sent');_0x24b28e(_0x4fdd48[_0xf1fc('0x16')][_0xf1fc('0x15')]);}})[_0xf1fc('0x17')](function(_0x1c3f3f){logger[_0xf1fc('0x14')](_0xf1fc('0xf'),_0x3ac2f9,_0x1c3f3f);_0x351fcd(_0x1c3f3f);});});}exports['CreateVoiceAgentReport']=function(_0x310376){var _0x466f86=this;return new Promise(function(_0x5cfc17,_0x9e5c09){return db[_0xf1fc('0x18')][_0xf1fc('0x19')](_0x310376[_0xf1fc('0x1a')],{'raw':_0x310376[_0xf1fc('0x1b')]?_0x310376['options']['raw']===undefined?!![]:![]:!![]})[_0xf1fc('0xd')](function(_0x3df8a7){logger[_0xf1fc('0xe')]('CreateVoiceAgentReport',_0x310376);logger[_0xf1fc('0x10')](_0xf1fc('0x1c'),_0x310376,JSON[_0xf1fc('0x13')](_0x3df8a7));_0x5cfc17(_0x3df8a7);})[_0xf1fc('0x17')](function(_0x28d2ce){logger[_0xf1fc('0x14')](_0xf1fc('0x1c'),_0x28d2ce[_0xf1fc('0x15')],_0x310376);_0x9e5c09(_0x466f86['error'](0x1f4,_0x28d2ce['message']));});});};exports[_0xf1fc('0x1d')]=function(_0x96b75c){var _0x59f505=this;return new Promise(function(_0x16f252,_0x55d48a){return db[_0xf1fc('0x18')][_0xf1fc('0x1e')](_0x96b75c['body'],{'raw':_0x96b75c[_0xf1fc('0x1b')]?_0x96b75c[_0xf1fc('0x1b')][_0xf1fc('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96b75c['options']?_0x96b75c[_0xf1fc('0x1b')][_0xf1fc('0x20')]||null:null,'attributes':_0x96b75c[_0xf1fc('0x1b')]?_0x96b75c[_0xf1fc('0x1b')][_0xf1fc('0x21')]||null:null,'limit':_0x96b75c[_0xf1fc('0x1b')]?_0x96b75c[_0xf1fc('0x1b')]['limit']||null:null})[_0xf1fc('0xd')](function(_0x3a3416){logger[_0xf1fc('0xe')](_0xf1fc('0x1d'),_0x96b75c);logger[_0xf1fc('0x10')](_0xf1fc('0x1d'),_0x96b75c,JSON[_0xf1fc('0x13')](_0x3a3416));_0x16f252(_0x3a3416);})[_0xf1fc('0x17')](function(_0x52f4ea){logger[_0xf1fc('0x14')](_0xf1fc('0x1d'),_0x52f4ea['message'],_0x96b75c);_0x55d48a(_0x59f505['error'](0x1f4,_0x52f4ea[_0xf1fc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7c6946a..846f965 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 _0x0e85=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0xf7058b,_0x22c9b7){var _0x24cbf0=function(_0x2997ac){while(--_0x2997ac){_0xf7058b['push'](_0xf7058b['shift']());}};_0x24cbf0(++_0x22c9b7);}(_0x0e85,0x7c));var _0x50e8=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x0e85[_0x20ef64];return _0x3707d8;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['show']);router[_0x50e8('0xc')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x50e8('0x11')]);module[_0x50e8('0x12')]=router; \ No newline at end of file +var _0x6c7b=['./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x2aff11,_0x4a1023){_0x2aff11=_0x2aff11-0x0;var _0x1c6bd1=_0x6c7b[_0x2aff11];return _0x1c6bd1;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0xc')]('/',auth[_0xb6c7('0x7')](),controller['create']);router['put'](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xd')]);router[_0xb6c7('0xe')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 845ef4c..e86be08 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 _0x18c9=['inbound','internal','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x432b47,_0x24d3b7){var _0xb74e85=function(_0x333c4f){while(--_0x333c4f){_0x432b47['push'](_0x432b47['shift']());}};_0xb74e85(++_0x24d3b7);}(_0x18c9,0x13c));var _0x918c=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x18c9[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x918c('0x0'));module[_0x918c('0x1')]={'uniqueid':{'type':Sequelize[_0x918c('0x2')]},'type':{'type':Sequelize[_0x918c('0x3')](_0x918c('0x4'),_0x918c('0x5'),'outbound',_0x918c('0x6'),_0x918c('0x7'),'dialer')},'tag':{'type':Sequelize[_0x918c('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x918c('0x2')]},'destination':{'type':Sequelize[_0x918c('0x2')]},'destinationcontext':{'type':Sequelize[_0x918c('0x2')]},'callerid':{'type':Sequelize[_0x918c('0x2')]},'channel':{'type':Sequelize[_0x918c('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x918c('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x918c('0x8')]},'answertime':{'type':Sequelize[_0x918c('0x8')]},'endtime':{'type':Sequelize[_0x918c('0x8')]},'duration':{'type':Sequelize[_0x918c('0x9')]},'billableseconds':{'type':Sequelize[_0x918c('0x9')]},'mohtime':{'type':Sequelize[_0x918c('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x918c('0x2')]},'amaflags':{'type':Sequelize[_0x918c('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x918c('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x918c('0x2')]},'note':{'type':Sequelize[_0x918c('0x2')]},'prefix':{'type':Sequelize[_0x918c('0x2')]},'routeid':{'type':Sequelize[_0x918c('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x793b=['TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound','inbound-fax'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x793b,0x189));var _0xb793=function(_0x6cbaea,_0x1bbbce){_0x6cbaea=_0x6cbaea-0x0;var _0x39efbf=_0x793b[_0x6cbaea];return _0x39efbf;};'use strict';var Sequelize=require(_0xb793('0x0'));module[_0xb793('0x1')]={'uniqueid':{'type':Sequelize[_0xb793('0x2')]},'type':{'type':Sequelize[_0xb793('0x3')](_0xb793('0x4'),'internal',_0xb793('0x5'),_0xb793('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xb793('0x2')]},'accountcode':{'type':Sequelize[_0xb793('0x2')]},'source':{'type':Sequelize[_0xb793('0x2')]},'destination':{'type':Sequelize[_0xb793('0x2')]},'destinationcontext':{'type':Sequelize[_0xb793('0x2')]},'callerid':{'type':Sequelize[_0xb793('0x2')]},'channel':{'type':Sequelize[_0xb793('0x2')]},'destinationchannel':{'type':Sequelize[_0xb793('0x2')]},'lastapplication':{'type':Sequelize[_0xb793('0x2')]},'lastdata':{'type':Sequelize[_0xb793('0x7')]},'starttime':{'type':Sequelize[_0xb793('0x8')]},'systemanswertime':{'type':Sequelize[_0xb793('0x8')]},'answertime':{'type':Sequelize[_0xb793('0x8')]},'endtime':{'type':Sequelize[_0xb793('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xb793('0x9')]},'mohtime':{'type':Sequelize[_0xb793('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xb793('0x2')]},'userDisposition':{'type':Sequelize[_0xb793('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xb793('0x2')]},'note':{'type':Sequelize[_0xb793('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xb793('0x9')]},'sipcallid':{'type':Sequelize[_0xb793('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 585bf6d..106bf6e 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x2ef3,0xba));var _0x32ef=function(_0xe41244,_0x38f02b){_0xe41244=_0xe41244-0x0;var _0xd873a5=_0x2ef3[_0xe41244];return _0xd873a5;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x33fca0,_0x188563){_0x33fca0=_0x33fca0-0x0;var _0x3a380c=_0x2032[_0x33fca0];return _0x3a380c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0f16ca1..3fb7ed1 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 _0xd38d=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','moment','bluebird','path'];(function(_0x68b58d,_0x58f0d6){var _0x48ceb3=function(_0x31c73b){while(--_0x31c73b){_0x68b58d['push'](_0x68b58d['shift']());}};_0x48ceb3(++_0x58f0d6);}(_0xd38d,0x133));var _0xdd38=function(_0x53ee43,_0x2a63ec){_0x53ee43=_0x53ee43-0x0;var _0x58b2ca=_0xd38d[_0x53ee43];return _0x58b2ca;};'use strict';var _=require(_0xdd38('0x0'));var util=require(_0xdd38('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdd38('0x2'));var BPromise=require(_0xdd38('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd38('0x4'));var rimraf=require(_0xdd38('0x5'));var config=require(_0xdd38('0x6'));var attributes=require(_0xdd38('0x7'));module[_0xdd38('0x8')]=function(_0x59c4da,_0x54ad70){return _0x59c4da[_0xdd38('0x9')](_0xdd38('0xa'),attributes,{'tableName':_0xdd38('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0141=['report_call','uniqueid','util','../../config/logger','bluebird','path','rimraf','exports','define'];(function(_0x292152,_0x1b5117){var _0x466335=function(_0x1c4cf9){while(--_0x1c4cf9){_0x292152['push'](_0x292152['shift']());}};_0x466335(++_0x1b5117);}(_0x0141,0x107));var _0x1014=function(_0x4d5994,_0x54e5e6){_0x4d5994=_0x4d5994-0x0;var _0x54df0a=_0x0141[_0x4d5994];return _0x54df0a;};'use strict';var _=require('lodash');var util=require(_0x1014('0x0'));var logger=require(_0x1014('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1014('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1014('0x3'));var rimraf=require(_0x1014('0x4'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x1014('0x5')]=function(_0x1afa28,_0x52a5d0){return _0x1afa28[_0x1014('0x6')]('VoiceCallReport',attributes,{'tableName':_0x1014('0x7'),'paranoid':![],'indexes':[{'fields':[_0x1014('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ec26d6a..59594a7 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 _0x2bb9=['where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','info','request\x20sent','debug','code','error','message','VoiceCallReport,\x20%s,\x20%s','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','then','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0x2bb9,0x104));var _0x92bb=function(_0x2f500a,_0x34217c){_0x2f500a=_0x2f500a-0x0;var _0x48b8e9=_0x2bb9[_0x2f500a];return _0x48b8e9;};'use strict';var _=require(_0x92bb('0x0'));var util=require(_0x92bb('0x1'));var moment=require(_0x92bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x92bb('0x3'));var fs=require('fs');var Redis=require(_0x92bb('0x4'));var db=require(_0x92bb('0x5'))['db'];var utils=require(_0x92bb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x92bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x92bb('0x8')][_0x92bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ffb3f,_0x33d9d9,_0x2e6353){return new BPromise(function(_0x3a117b,_0x4b459b){return client['request'](_0x4ffb3f,_0x2e6353)['then'](function(_0x820e11){logger[_0x92bb('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x33d9d9,_0x92bb('0xb'));logger[_0x92bb('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x33d9d9,_0x92bb('0xb'),JSON['stringify'](_0x820e11));if(_0x820e11['error']){if(_0x820e11['error'][_0x92bb('0xd')]===0x1f4){logger[_0x92bb('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x33d9d9,_0x820e11[_0x92bb('0xe')][_0x92bb('0xf')]);return _0x4b459b(_0x820e11[_0x92bb('0xe')][_0x92bb('0xf')]);}logger[_0x92bb('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x33d9d9,_0x820e11[_0x92bb('0xe')]['message']);return _0x3a117b(_0x820e11[_0x92bb('0xe')]['message']);}else{logger[_0x92bb('0xa')](_0x92bb('0x10'),_0x33d9d9,'request\x20sent');_0x3a117b(_0x820e11[_0x92bb('0x11')][_0x92bb('0xf')]);}})[_0x92bb('0x12')](function(_0x5191b7){logger[_0x92bb('0xe')](_0x92bb('0x10'),_0x33d9d9,_0x5191b7);_0x4b459b(_0x5191b7);});});}exports[_0x92bb('0x13')]=function(_0x278cba){var _0x53d70e=this;return new Promise(function(_0x285e24,_0x503d35){return db[_0x92bb('0x14')][_0x92bb('0x15')]({'raw':_0x278cba['options']?_0x278cba[_0x92bb('0x16')][_0x92bb('0x17')]===undefined?!![]:![]:!![],'where':_0x278cba[_0x92bb('0x16')]?_0x278cba[_0x92bb('0x16')]['where']||null:null,'attributes':_0x278cba[_0x92bb('0x16')]?_0x278cba[_0x92bb('0x16')][_0x92bb('0x18')]||null:null,'limit':_0x278cba['options']?_0x278cba[_0x92bb('0x16')][_0x92bb('0x19')]||null:null,'include':_0x278cba[_0x92bb('0x16')]?_0x278cba[_0x92bb('0x16')][_0x92bb('0x1a')]?_[_0x92bb('0x1b')](_0x278cba['options']['include'],function(_0xe9a0c8){return{'model':db[_0xe9a0c8[_0x92bb('0x1c')]],'as':_0xe9a0c8['as'],'attributes':_0xe9a0c8[_0x92bb('0x18')],'include':_0xe9a0c8[_0x92bb('0x1a')]?_[_0x92bb('0x1b')](_0xe9a0c8[_0x92bb('0x1a')],function(_0x593274){return{'model':db[_0x593274[_0x92bb('0x1c')]],'as':_0x593274['as'],'attributes':_0x593274['attributes'],'include':_0x593274[_0x92bb('0x1a')]?_[_0x92bb('0x1b')](_0x593274[_0x92bb('0x1a')],function(_0x5587a9){return{'model':db[_0x5587a9['model']],'as':_0x5587a9['as'],'attributes':_0x5587a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x92bb('0x1d')](function(_0x9ca870){logger[_0x92bb('0xa')](_0x92bb('0x13'),_0x278cba);logger[_0x92bb('0xc')](_0x92bb('0x13'),_0x278cba,JSON[_0x92bb('0x1e')](_0x9ca870));_0x285e24(_0x9ca870);})[_0x92bb('0x12')](function(_0x184187){logger[_0x92bb('0xe')](_0x92bb('0x13'),_0x184187[_0x92bb('0xf')],_0x278cba);_0x503d35(_0x53d70e[_0x92bb('0xe')](0x1f4,_0x184187[_0x92bb('0xf')]));});});};exports[_0x92bb('0x1f')]=function(_0x5a3ca6){var _0x15466a=this;return new Promise(function(_0x24e5ae,_0x4d9c07){return db[_0x92bb('0x14')][_0x92bb('0x20')](_0x5a3ca6[_0x92bb('0x21')],{'raw':_0x5a3ca6[_0x92bb('0x16')]?_0x5a3ca6[_0x92bb('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x92bb('0x1d')](function(_0x292360){logger[_0x92bb('0xa')](_0x92bb('0x1f'),_0x5a3ca6);logger[_0x92bb('0xc')](_0x92bb('0x1f'),_0x5a3ca6,JSON[_0x92bb('0x1e')](_0x292360));_0x24e5ae(_0x292360);})['catch'](function(_0xb197f4){logger[_0x92bb('0xe')]('CreateVoiceCallReport',_0xb197f4[_0x92bb('0xf')],_0x5a3ca6);_0x4d9c07(_0x15466a[_0x92bb('0xe')](0x1f4,_0xb197f4[_0x92bb('0xf')]));});});};exports[_0x92bb('0x22')]=function(_0x5842a4){var _0x3e285f=this;return new Promise(function(_0x32f6b7,_0x3e7edc){return db[_0x92bb('0x14')][_0x92bb('0x23')](_0x5842a4[_0x92bb('0x21')],{'raw':_0x5842a4[_0x92bb('0x16')]?_0x5842a4[_0x92bb('0x16')][_0x92bb('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5842a4[_0x92bb('0x16')]?_0x5842a4['options'][_0x92bb('0x24')]||null:null,'attributes':_0x5842a4[_0x92bb('0x16')]?_0x5842a4[_0x92bb('0x16')][_0x92bb('0x18')]||null:null,'limit':_0x5842a4['options']?_0x5842a4[_0x92bb('0x16')][_0x92bb('0x19')]||null:null})[_0x92bb('0x1d')](function(_0x5742ae){logger['info'](_0x92bb('0x22'),_0x5842a4);logger[_0x92bb('0xc')](_0x92bb('0x22'),_0x5842a4,JSON[_0x92bb('0x1e')](_0x5742ae));_0x32f6b7(_0x5742ae);})['catch'](function(_0x54c984){logger[_0x92bb('0xe')](_0x92bb('0x22'),_0x54c984[_0x92bb('0xf')],_0x5842a4);_0x3e7edc(_0x3e285f[_0x92bb('0xe')](0x1f4,_0x54c984[_0x92bb('0xf')]));});});}; \ No newline at end of file +var _0x0a9f=['catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','UpdateVoiceCallReport','VoiceCallReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x53ea96,_0x169917){var _0x3ffb86=function(_0x28c349){while(--_0x28c349){_0x53ea96['push'](_0x53ea96['shift']());}};_0x3ffb86(++_0x169917);}(_0x0a9f,0x1bd));var _0xf0a9=function(_0x13e11a,_0xe0fc7){_0x13e11a=_0x13e11a-0x0;var _0xd7f115=_0x0a9f[_0x13e11a];return _0xd7f115;};'use strict';var _=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var moment=require(_0xf0a9('0x2'));var BPromise=require(_0xf0a9('0x3'));var rs=require(_0xf0a9('0x4'));var fs=require('fs');var Redis=require(_0xf0a9('0x5'));var db=require(_0xf0a9('0x6'))['db'];var utils=require(_0xf0a9('0x7'));var logger=require('../../config/logger')(_0xf0a9('0x8'));var config=require(_0xf0a9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0a9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x559ec1,_0x17ef2d,_0x5c3cff){return new BPromise(function(_0x52338f,_0x384f24){return client[_0xf0a9('0xb')](_0x559ec1,_0x5c3cff)[_0xf0a9('0xc')](function(_0x5c5dbd){logger[_0xf0a9('0xd')](_0xf0a9('0xe'),_0x17ef2d,'request\x20sent');logger[_0xf0a9('0xf')](_0xf0a9('0x10'),_0x17ef2d,'request\x20sent',JSON[_0xf0a9('0x11')](_0x5c5dbd));if(_0x5c5dbd[_0xf0a9('0x12')]){if(_0x5c5dbd[_0xf0a9('0x12')][_0xf0a9('0x13')]===0x1f4){logger[_0xf0a9('0x12')](_0xf0a9('0xe'),_0x17ef2d,_0x5c5dbd[_0xf0a9('0x12')][_0xf0a9('0x14')]);return _0x384f24(_0x5c5dbd[_0xf0a9('0x12')][_0xf0a9('0x14')]);}logger[_0xf0a9('0x12')](_0xf0a9('0xe'),_0x17ef2d,_0x5c5dbd[_0xf0a9('0x12')]['message']);return _0x52338f(_0x5c5dbd[_0xf0a9('0x12')]['message']);}else{logger[_0xf0a9('0xd')](_0xf0a9('0xe'),_0x17ef2d,_0xf0a9('0x15'));_0x52338f(_0x5c5dbd[_0xf0a9('0x16')][_0xf0a9('0x14')]);}})[_0xf0a9('0x17')](function(_0x30dc1b){logger['error'](_0xf0a9('0xe'),_0x17ef2d,_0x30dc1b);_0x384f24(_0x30dc1b);});});}exports[_0xf0a9('0x18')]=function(_0x36fabd){var _0x1cb3d6=this;return new Promise(function(_0xe5274d,_0x5de5bd){return db['VoiceCallReport']['findAll']({'raw':_0x36fabd[_0xf0a9('0x19')]?_0x36fabd['options'][_0xf0a9('0x1a')]===undefined?!![]:![]:!![],'where':_0x36fabd[_0xf0a9('0x19')]?_0x36fabd['options'][_0xf0a9('0x1b')]||null:null,'attributes':_0x36fabd[_0xf0a9('0x19')]?_0x36fabd[_0xf0a9('0x19')][_0xf0a9('0x1c')]||null:null,'limit':_0x36fabd[_0xf0a9('0x19')]?_0x36fabd[_0xf0a9('0x19')][_0xf0a9('0x1d')]||null:null,'include':_0x36fabd[_0xf0a9('0x19')]?_0x36fabd[_0xf0a9('0x19')][_0xf0a9('0x1e')]?_[_0xf0a9('0x1f')](_0x36fabd[_0xf0a9('0x19')]['include'],function(_0x444536){return{'model':db[_0x444536[_0xf0a9('0x20')]],'as':_0x444536['as'],'attributes':_0x444536['attributes'],'include':_0x444536[_0xf0a9('0x1e')]?_[_0xf0a9('0x1f')](_0x444536[_0xf0a9('0x1e')],function(_0x40d69e){return{'model':db[_0x40d69e['model']],'as':_0x40d69e['as'],'attributes':_0x40d69e[_0xf0a9('0x1c')],'include':_0x40d69e['include']?_['map'](_0x40d69e['include'],function(_0x17ead5){return{'model':db[_0x17ead5[_0xf0a9('0x20')]],'as':_0x17ead5['as'],'attributes':_0x17ead5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb54b83){logger[_0xf0a9('0xd')](_0xf0a9('0x18'),_0x36fabd);logger[_0xf0a9('0xf')](_0xf0a9('0x18'),_0x36fabd,JSON[_0xf0a9('0x11')](_0xb54b83));_0xe5274d(_0xb54b83);})[_0xf0a9('0x17')](function(_0x92badf){logger[_0xf0a9('0x12')](_0xf0a9('0x18'),_0x92badf['message'],_0x36fabd);_0x5de5bd(_0x1cb3d6[_0xf0a9('0x12')](0x1f4,_0x92badf['message']));});});};exports[_0xf0a9('0x21')]=function(_0x2d3bd6){var _0x14ab4d=this;return new Promise(function(_0x58dfe9,_0x110a33){return db['VoiceCallReport'][_0xf0a9('0x22')](_0x2d3bd6['body'],{'raw':_0x2d3bd6[_0xf0a9('0x19')]?_0x2d3bd6[_0xf0a9('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x175076){logger[_0xf0a9('0xd')]('CreateVoiceCallReport',_0x2d3bd6);logger[_0xf0a9('0xf')]('CreateVoiceCallReport',_0x2d3bd6,JSON['stringify'](_0x175076));_0x58dfe9(_0x175076);})[_0xf0a9('0x17')](function(_0x2d80ed){logger[_0xf0a9('0x12')](_0xf0a9('0x21'),_0x2d80ed[_0xf0a9('0x14')],_0x2d3bd6);_0x110a33(_0x14ab4d[_0xf0a9('0x12')](0x1f4,_0x2d80ed['message']));});});};exports[_0xf0a9('0x23')]=function(_0x5718b5){var _0x4e181c=this;return new Promise(function(_0x573845,_0x161573){return db[_0xf0a9('0x24')][_0xf0a9('0x25')](_0x5718b5[_0xf0a9('0x26')],{'raw':_0x5718b5[_0xf0a9('0x19')]?_0x5718b5[_0xf0a9('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5718b5[_0xf0a9('0x19')]?_0x5718b5[_0xf0a9('0x19')][_0xf0a9('0x1b')]||null:null,'attributes':_0x5718b5[_0xf0a9('0x19')]?_0x5718b5[_0xf0a9('0x19')][_0xf0a9('0x1c')]||null:null,'limit':_0x5718b5[_0xf0a9('0x19')]?_0x5718b5[_0xf0a9('0x19')][_0xf0a9('0x1d')]||null:null})[_0xf0a9('0xc')](function(_0x1f2eee){logger[_0xf0a9('0xd')]('UpdateVoiceCallReport',_0x5718b5);logger['debug'](_0xf0a9('0x23'),_0x5718b5,JSON['stringify'](_0x1f2eee));_0x573845(_0x1f2eee);})['catch'](function(_0x8b814d){logger[_0xf0a9('0x12')](_0xf0a9('0x23'),_0x8b814d[_0xf0a9('0x14')],_0x5718b5);_0x161573(_0x4e181c[_0xf0a9('0x12')](0x1f4,_0x8b814d[_0xf0a9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9846e19..8ba0977 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 _0xe839=['./voiceChanSpy.controller','get','isAuthenticated','index','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x250516,_0x26f02d){var _0xfaddc0=function(_0x4e6a9f){while(--_0x4e6a9f){_0x250516['push'](_0x250516['shift']());}};_0xfaddc0(++_0x26f02d);}(_0xe839,0xf8));var _0x9e83=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe839[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x9e83('0x0'));var util=require(_0x9e83('0x1'));var path=require('path');var timeout=require(_0x9e83('0x2'));var express=require(_0x9e83('0x3'));var router=express[_0x9e83('0x4')]();var fs_extra=require(_0x9e83('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9e83('0x6'));var config=require(_0x9e83('0x7'));var controller=require(_0x9e83('0x8'));router[_0x9e83('0x9')]('/',auth[_0x9e83('0xa')](),controller[_0x9e83('0xb')]);router['get']('/:id',auth[_0x9e83('0xa')](),controller['show']);router['post']('/',auth[_0x9e83('0xa')](),controller['create']);router[_0x9e83('0xc')](_0x9e83('0xd'),auth[_0x9e83('0xa')](),controller[_0x9e83('0xe')]);router['delete'](_0x9e83('0xd'),auth['isAuthenticated'](),controller[_0x9e83('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7499=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x1e1f7b,_0x45246c){var _0x17b712=function(_0x166c48){while(--_0x166c48){_0x1e1f7b['push'](_0x1e1f7b['shift']());}};_0x17b712(++_0x45246c);}(_0x7499,0x1eb));var _0x9749=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x7499[_0x13ac10];return _0x28eda2;};'use strict';var multer=require(_0x9749('0x0'));var util=require(_0x9749('0x1'));var path=require(_0x9749('0x2'));var timeout=require(_0x9749('0x3'));var express=require('express');var router=express[_0x9749('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9749('0x5'));var interaction=require(_0x9749('0x6'));var config=require(_0x9749('0x7'));var controller=require(_0x9749('0x8'));router[_0x9749('0x9')]('/',auth[_0x9749('0xa')](),controller[_0x9749('0xb')]);router[_0x9749('0x9')](_0x9749('0xc'),auth[_0x9749('0xa')](),controller[_0x9749('0xd')]);router[_0x9749('0xe')]('/',auth['isAuthenticated'](),controller[_0x9749('0xf')]);router[_0x9749('0x10')]('/:id',auth[_0x9749('0xa')](),controller[_0x9749('0x11')]);router[_0x9749('0x12')](_0x9749('0xc'),auth[_0x9749('0xa')](),controller[_0x9749('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1e75f8b..a7ee636 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 _0x9800=['exports','STRING','name','setDataValue','options','join','split','BOOLEAN','sequelize'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9800,0x7d));var _0x0980=function(_0x1813d1,_0x93397c){_0x1813d1=_0x1813d1-0x0;var _0x3bd04f=_0x9800[_0x1813d1];return _0x3bd04f;};'use strict';var Sequelize=require(_0x0980('0x0'));module[_0x0980('0x1')]={'name':{'type':Sequelize[_0x0980('0x2')]},'prefix':{'type':Sequelize[_0x0980('0x2')],'unique':_0x0980('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x346145){this[_0x0980('0x4')](_0x0980('0x5'),_0x346145?_0x346145[_0x0980('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x0980('0x5'))?this['getDataValue'](_0x0980('0x5'))[_0x0980('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x0980('0x2')]},'record':{'type':Sequelize[_0x0980('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0980('0x2')]}}; \ No newline at end of file +var _0x5bde=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x237d67,_0x4ff2db){var _0x292dfb=function(_0x565a7d){while(--_0x565a7d){_0x237d67['push'](_0x237d67['shift']());}};_0x292dfb(++_0x4ff2db);}(_0x5bde,0x1e7));var _0xe5bd=function(_0x5483d6,_0x1dd0ee){_0x5483d6=_0x5483d6-0x0;var _0x57f41a=_0x5bde[_0x5483d6];return _0x57f41a;};'use strict';var Sequelize=require(_0xe5bd('0x0'));module[_0xe5bd('0x1')]={'name':{'type':Sequelize[_0xe5bd('0x2')]},'prefix':{'type':Sequelize[_0xe5bd('0x2')],'unique':_0xe5bd('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe5bd('0x2')],'set':function(_0x49593c){this[_0xe5bd('0x4')](_0xe5bd('0x5'),_0x49593c?_0x49593c[_0xe5bd('0x6')](''):[]);},'get':function(){return this[_0xe5bd('0x7')](_0xe5bd('0x5'))?this[_0xe5bd('0x7')](_0xe5bd('0x5'))[_0xe5bd('0x8')](''):[];}},'auth':{'type':Sequelize[_0xe5bd('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xe5bd('0x2')]},'record':{'type':Sequelize[_0xe5bd('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe5bd('0x2')]},'description':{'type':Sequelize[_0xe5bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7ab54af..f6e259b 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 _0x0b25=['where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','ChanSpies','UserProfileResource','then','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x0b25,0x155));var _0x50b2=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x0b25[_0x529f1c];return _0x4d57ab;};'use strict';var emlformat=require(_0x50b2('0x0'));var rimraf=require(_0x50b2('0x1'));var zipdir=require(_0x50b2('0x2'));var jsonpatch=require(_0x50b2('0x3'));var rp=require(_0x50b2('0x4'));var moment=require(_0x50b2('0x5'));var BPromise=require(_0x50b2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x50b2('0x7'));var sox=require('sox');var csv=require(_0x50b2('0x8'));var ejs=require(_0x50b2('0x9'));var fs=require('fs');var fs_extra=require(_0x50b2('0xa'));var _=require(_0x50b2('0xb'));var squel=require(_0x50b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x50b2('0xd'));var deskjs=require(_0x50b2('0xe'));var toCsv=require(_0x50b2('0x8'));var querystring=require(_0x50b2('0xf'));var Papa=require('papaparse');var Redis=require(_0x50b2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x50b2('0x11'));var as=require(_0x50b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50b2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x50b2('0x14'));var licenseUtil=require(_0x50b2('0x15'));var db=require(_0x50b2('0x16'))['db'];function respondWithStatusCode(_0x453d53,_0x3eda73){_0x3eda73=_0x3eda73||0xcc;return function(_0x3ab9e6){if(_0x3ab9e6){return _0x453d53[_0x50b2('0x17')](_0x3eda73);}return _0x453d53[_0x50b2('0x18')](_0x3eda73)[_0x50b2('0x19')]();};}function respondWithResult(_0x4542c9,_0x391255){_0x391255=_0x391255||0xc8;return function(_0x4d6650){if(_0x4d6650){return _0x4542c9[_0x50b2('0x18')](_0x391255)[_0x50b2('0x1a')](_0x4d6650);}};}function respondWithFilteredResult(_0x19eedd,_0x54cc61){return function(_0x3c3fd6){if(_0x3c3fd6){var _0x112d57=typeof _0x54cc61[_0x50b2('0x1b')]===_0x50b2('0x1c')&&typeof _0x54cc61[_0x50b2('0x1d')]===_0x50b2('0x1c');var _0x568a93=_0x3c3fd6[_0x50b2('0x1e')];var _0x419433=_0x112d57?0x0:_0x54cc61['offset'];var _0x30a9b8=_0x112d57?_0x3c3fd6[_0x50b2('0x1e')]:_0x54cc61['offset']+_0x54cc61[_0x50b2('0x1d')];var _0x106491;if(_0x30a9b8>=_0x568a93){_0x30a9b8=_0x568a93;_0x106491=0xc8;}else{_0x106491=0xce;}_0x19eedd['status'](_0x106491);return _0x19eedd[_0x50b2('0x1f')](_0x50b2('0x20'),_0x419433+'-'+_0x30a9b8+'/'+_0x568a93)[_0x50b2('0x1a')](_0x3c3fd6);}return null;};}function patchUpdates(_0x2cc483){return function(_0x4b6005){try{jsonpatch[_0x50b2('0x21')](_0x4b6005,_0x2cc483,!![]);}catch(_0x41d435){return BPromise[_0x50b2('0x22')](_0x41d435);}return _0x4b6005[_0x50b2('0x23')]();};}function saveUpdates(_0x20d71e,_0x459eaf){return function(_0x51f7ae){if(_0x51f7ae){return _0x51f7ae['update'](_0x20d71e)['then'](function(_0x4ed01b){return _0x4ed01b;});}return null;};}function removeEntity(_0x34c3cb,_0x3ead20){return function(_0x28e515){if(_0x28e515){return _0x28e515[_0x50b2('0x24')]()['then'](function(){var _0x31b4d1=_0x28e515[_0x50b2('0x25')]({'plain':!![]});var _0x3156bd=_0x50b2('0x26');return db[_0x50b2('0x27')][_0x50b2('0x24')]({'where':{'type':_0x3156bd,'resourceId':_0x31b4d1['id']}})[_0x50b2('0x28')](function(){return _0x28e515;});})[_0x50b2('0x28')](function(){_0x34c3cb[_0x50b2('0x18')](0xcc)[_0x50b2('0x19')]();});}};}function handleEntityNotFound(_0x2d05f5,_0x2c6fff){return function(_0x514d6a){if(!_0x514d6a){_0x2d05f5[_0x50b2('0x17')](0x194);}return _0x514d6a;};}function handleError(_0x43d906,_0x36afcf){_0x36afcf=_0x36afcf||0x1f4;return function(_0x3fcccc){logger[_0x50b2('0x29')](_0x3fcccc['stack']);if(_0x3fcccc[_0x50b2('0x2a')]){delete _0x3fcccc[_0x50b2('0x2a')];}_0x43d906[_0x50b2('0x18')](_0x36afcf)[_0x50b2('0x2b')](_0x3fcccc);};}exports['index']=function(_0x34309d,_0x1b3ee6){var _0x2efea8={},_0x1d95ec={},_0x313b33={'count':0x0,'rows':[]};var _0x425c5f=_[_0x50b2('0x2c')](db[_0x50b2('0x2d')][_0x50b2('0x2e')],function(_0x1049f9){return{'name':_0x1049f9[_0x50b2('0x2f')],'type':_0x1049f9[_0x50b2('0x30')]['key']};});_0x1d95ec['model']=_[_0x50b2('0x2c')](_0x425c5f,_0x50b2('0x2a'));_0x1d95ec[_0x50b2('0x31')]=_[_0x50b2('0x32')](_0x34309d['query']);_0x1d95ec[_0x50b2('0x33')]=_['intersection'](_0x1d95ec[_0x50b2('0x34')],_0x1d95ec[_0x50b2('0x31')]);_0x2efea8[_0x50b2('0x35')]=_['intersection'](_0x1d95ec[_0x50b2('0x34')],qs['fields'](_0x34309d[_0x50b2('0x31')][_0x50b2('0x36')]));_0x2efea8[_0x50b2('0x35')]=_0x2efea8[_0x50b2('0x35')][_0x50b2('0x37')]?_0x2efea8['attributes']:_0x1d95ec[_0x50b2('0x34')];if(!_0x34309d[_0x50b2('0x31')][_0x50b2('0x38')]('nolimit')){_0x2efea8['limit']=qs[_0x50b2('0x1d')](_0x34309d['query'][_0x50b2('0x1d')]);_0x2efea8[_0x50b2('0x1b')]=qs['offset'](_0x34309d[_0x50b2('0x31')]['offset']);}_0x2efea8[_0x50b2('0x39')]=qs[_0x50b2('0x3a')](_0x34309d[_0x50b2('0x31')][_0x50b2('0x3a')]);_0x2efea8[_0x50b2('0x3b')]=qs['filters'](_[_0x50b2('0x3c')](_0x34309d['query'],_0x1d95ec['filters']),_0x425c5f);if(_0x34309d['query'][_0x50b2('0x3d')]){_0x2efea8[_0x50b2('0x3b')]=_[_0x50b2('0x3e')](_0x2efea8['where'],{'$or':_[_0x50b2('0x2c')](_0x425c5f,function(_0x571292){if(_0x571292['type']!=='VIRTUAL'){var _0x127b67={};_0x127b67[_0x571292[_0x50b2('0x2a')]]={'$like':'%'+_0x34309d['query'][_0x50b2('0x3d')]+'%'};return _0x127b67;}})});}_0x2efea8=_[_0x50b2('0x3e')]({},_0x2efea8,_0x34309d[_0x50b2('0x3f')]);var _0x19cc7e={'where':_0x2efea8['where']};return db[_0x50b2('0x2d')]['count'](_0x19cc7e)[_0x50b2('0x28')](function(_0x1781b){_0x313b33['count']=_0x1781b;if(_0x34309d[_0x50b2('0x31')][_0x50b2('0x40')]){_0x2efea8[_0x50b2('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x50b2('0x42')](_0x2efea8);})[_0x50b2('0x28')](function(_0x7c5241){_0x313b33[_0x50b2('0x43')]=_0x7c5241;return _0x313b33;})[_0x50b2('0x28')](respondWithFilteredResult(_0x1b3ee6,_0x2efea8))[_0x50b2('0x44')](handleError(_0x1b3ee6,null));};exports['show']=function(_0x259a18,_0xdd7df3){var _0x54ce18={'raw':![],'where':{'id':_0x259a18[_0x50b2('0x45')]['id']}},_0x322768={};_0x322768[_0x50b2('0x34')]=_[_0x50b2('0x32')](db['VoiceChanSpy'][_0x50b2('0x2e')]);_0x322768[_0x50b2('0x31')]=_[_0x50b2('0x32')](_0x259a18[_0x50b2('0x31')]);_0x322768[_0x50b2('0x33')]=_['intersection'](_0x322768[_0x50b2('0x34')],_0x322768[_0x50b2('0x31')]);_0x54ce18[_0x50b2('0x35')]=_[_0x50b2('0x46')](_0x322768[_0x50b2('0x34')],qs[_0x50b2('0x36')](_0x259a18[_0x50b2('0x31')][_0x50b2('0x36')]));_0x54ce18[_0x50b2('0x35')]=_0x54ce18[_0x50b2('0x35')][_0x50b2('0x37')]?_0x54ce18[_0x50b2('0x35')]:_0x322768[_0x50b2('0x34')];if(_0x259a18['query'][_0x50b2('0x40')]){_0x54ce18['include']=[{'all':!![]}];}_0x54ce18=_[_0x50b2('0x3e')]({},_0x54ce18,_0x259a18['options']);return db['VoiceChanSpy'][_0x50b2('0x47')](_0x54ce18)['then'](handleEntityNotFound(_0xdd7df3,null))['then'](respondWithResult(_0xdd7df3,null))['catch'](handleError(_0xdd7df3,null));};exports['create']=function(_0x50919b,_0x4cfa62){return db[_0x50b2('0x2d')][_0x50b2('0x48')](_0x50919b[_0x50b2('0x49')],{})['then'](function(_0xee5202){var _0x4a2913=_0x50919b[_0x50b2('0x4a')][_0x50b2('0x25')]({'plain':!![]});if(!_0x4a2913)throw new Error(_0x50b2('0x4b'));if(_0x4a2913['role']==='user'){var _0x547117=_0xee5202['get']({'plain':!![]});var _0x450c99=_0x50b2('0x26');return db[_0x50b2('0x4c')]['find']({'where':{'name':_0x450c99,'userProfileId':_0x4a2913[_0x50b2('0x4d')]},'raw':!![]})['then'](function(_0x54a2ca){if(_0x54a2ca&&_0x54a2ca[_0x50b2('0x4e')]===0x0){return db[_0x50b2('0x27')][_0x50b2('0x48')]({'name':_0x547117[_0x50b2('0x2a')],'resourceId':_0x547117['id'],'type':_0x54a2ca[_0x50b2('0x2a')],'sectionId':_0x54a2ca['id']},{})[_0x50b2('0x28')](function(){return _0xee5202;});}else{return _0xee5202;}})[_0x50b2('0x44')](function(_0x1f68fc){logger[_0x50b2('0x29')](_0x50b2('0x4f'),_0x1f68fc);throw _0x1f68fc;});}return _0xee5202;})[_0x50b2('0x28')](respondWithResult(_0x4cfa62,0xc9))['catch'](handleError(_0x4cfa62,null));};exports['update']=function(_0x209a89,_0x1774dc){if(_0x209a89[_0x50b2('0x49')]['id']){delete _0x209a89['body']['id'];}return db[_0x50b2('0x2d')][_0x50b2('0x47')]({'where':{'id':_0x209a89[_0x50b2('0x45')]['id']}})[_0x50b2('0x28')](handleEntityNotFound(_0x1774dc,null))['then'](saveUpdates(_0x209a89['body'],null))[_0x50b2('0x28')](respondWithResult(_0x1774dc,null))[_0x50b2('0x44')](handleError(_0x1774dc,null));};exports[_0x50b2('0x24')]=function(_0x11eac2,_0x19a30f){return db[_0x50b2('0x2d')][_0x50b2('0x47')]({'where':{'id':_0x11eac2[_0x50b2('0x45')]['id']}})[_0x50b2('0x28')](handleEntityNotFound(_0x19a30f,null))[_0x50b2('0x28')](removeEntity(_0x19a30f,null))['catch'](handleError(_0x19a30f,null));}; \ No newline at end of file +var _0x89f7=['findAll','catch','include','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','error','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll'];(function(_0x493b70,_0x168e73){var _0x4c2355=function(_0x1e0247){while(--_0x1e0247){_0x493b70['push'](_0x493b70['shift']());}};_0x4c2355(++_0x168e73);}(_0x89f7,0x105));var _0x789f=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0x89f7[_0x11adbd];return _0x270029;};'use strict';var emlformat=require(_0x789f('0x0'));var rimraf=require(_0x789f('0x1'));var zipdir=require(_0x789f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x789f('0x3'));var moment=require('moment');var BPromise=require(_0x789f('0x4'));var Mustache=require('mustache');var util=require(_0x789f('0x5'));var path=require(_0x789f('0x6'));var sox=require(_0x789f('0x7'));var csv=require(_0x789f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x789f('0x9'));var _=require(_0x789f('0xa'));var squel=require(_0x789f('0xb'));var crypto=require(_0x789f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x789f('0x8'));var querystring=require(_0x789f('0xd'));var Papa=require(_0x789f('0xe'));var Redis=require('ioredis');var authService=require(_0x789f('0xf'));var qs=require(_0x789f('0x10'));var as=require(_0x789f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x789f('0x12'));var licenseUtil=require(_0x789f('0x13'));var db=require(_0x789f('0x14'))['db'];function respondWithStatusCode(_0x137c31,_0x8819db){_0x8819db=_0x8819db||0xcc;return function(_0x3c9259){if(_0x3c9259){return _0x137c31['sendStatus'](_0x8819db);}return _0x137c31[_0x789f('0x15')](_0x8819db)[_0x789f('0x16')]();};}function respondWithResult(_0x103241,_0xe767ad){_0xe767ad=_0xe767ad||0xc8;return function(_0x4c16cb){if(_0x4c16cb){return _0x103241[_0x789f('0x15')](_0xe767ad)['json'](_0x4c16cb);}};}function respondWithFilteredResult(_0x7fd299,_0x511ca4){return function(_0x51207b){if(_0x51207b){var _0x264258=typeof _0x511ca4[_0x789f('0x17')]===_0x789f('0x18')&&typeof _0x511ca4[_0x789f('0x19')]===_0x789f('0x18');var _0x44058c=_0x51207b[_0x789f('0x1a')];var _0x509853=_0x264258?0x0:_0x511ca4[_0x789f('0x17')];var _0x678cfb=_0x264258?_0x51207b[_0x789f('0x1a')]:_0x511ca4[_0x789f('0x17')]+_0x511ca4[_0x789f('0x19')];var _0xe4bb84;if(_0x678cfb>=_0x44058c){_0x678cfb=_0x44058c;_0xe4bb84=0xc8;}else{_0xe4bb84=0xce;}_0x7fd299['status'](_0xe4bb84);return _0x7fd299[_0x789f('0x1b')](_0x789f('0x1c'),_0x509853+'-'+_0x678cfb+'/'+_0x44058c)[_0x789f('0x1d')](_0x51207b);}return null;};}function patchUpdates(_0x5f2999){return function(_0x2b2ab0){try{jsonpatch[_0x789f('0x1e')](_0x2b2ab0,_0x5f2999,!![]);}catch(_0x415c71){return BPromise[_0x789f('0x1f')](_0x415c71);}return _0x2b2ab0[_0x789f('0x20')]();};}function saveUpdates(_0x590d01,_0x2611d8){return function(_0x162855){if(_0x162855){return _0x162855['update'](_0x590d01)[_0x789f('0x21')](function(_0xf9781f){return _0xf9781f;});}return null;};}function removeEntity(_0x1a67f0,_0x8e445f){return function(_0x52e3c4){if(_0x52e3c4){return _0x52e3c4['destroy']()['then'](function(){var _0x15122a=_0x52e3c4[_0x789f('0x22')]({'plain':!![]});var _0x4c14bd=_0x789f('0x23');return db[_0x789f('0x24')][_0x789f('0x25')]({'where':{'type':_0x4c14bd,'resourceId':_0x15122a['id']}})['then'](function(){return _0x52e3c4;});})[_0x789f('0x21')](function(){_0x1a67f0[_0x789f('0x15')](0xcc)[_0x789f('0x16')]();});}};}function handleEntityNotFound(_0x4344ea,_0x558598){return function(_0x1550b){if(!_0x1550b){_0x4344ea[_0x789f('0x26')](0x194);}return _0x1550b;};}function handleError(_0x23037c,_0xa655be){_0xa655be=_0xa655be||0x1f4;return function(_0xd5a07){logger[_0x789f('0x27')](_0xd5a07['stack']);if(_0xd5a07[_0x789f('0x28')]){delete _0xd5a07[_0x789f('0x28')];}_0x23037c[_0x789f('0x15')](_0xa655be)[_0x789f('0x29')](_0xd5a07);};}exports[_0x789f('0x2a')]=function(_0x28c365,_0x4ff7d0){var _0x55d202={},_0x1e1421={},_0x47da54={'count':0x0,'rows':[]};var _0x34e5b7=_['map'](db[_0x789f('0x2b')][_0x789f('0x2c')],function(_0x2b626f){return{'name':_0x2b626f[_0x789f('0x2d')],'type':_0x2b626f[_0x789f('0x2e')][_0x789f('0x2f')]};});_0x1e1421[_0x789f('0x30')]=_['map'](_0x34e5b7,_0x789f('0x28'));_0x1e1421['query']=_[_0x789f('0x31')](_0x28c365['query']);_0x1e1421[_0x789f('0x32')]=_[_0x789f('0x33')](_0x1e1421[_0x789f('0x30')],_0x1e1421[_0x789f('0x34')]);_0x55d202[_0x789f('0x35')]=_[_0x789f('0x33')](_0x1e1421[_0x789f('0x30')],qs['fields'](_0x28c365[_0x789f('0x34')][_0x789f('0x36')]));_0x55d202[_0x789f('0x35')]=_0x55d202[_0x789f('0x35')][_0x789f('0x37')]?_0x55d202[_0x789f('0x35')]:_0x1e1421['model'];if(!_0x28c365['query'][_0x789f('0x38')](_0x789f('0x39'))){_0x55d202['limit']=qs[_0x789f('0x19')](_0x28c365[_0x789f('0x34')]['limit']);_0x55d202[_0x789f('0x17')]=qs[_0x789f('0x17')](_0x28c365[_0x789f('0x34')]['offset']);}_0x55d202[_0x789f('0x3a')]=qs[_0x789f('0x3b')](_0x28c365[_0x789f('0x34')]['sort']);_0x55d202[_0x789f('0x3c')]=qs['filters'](_[_0x789f('0x3d')](_0x28c365['query'],_0x1e1421[_0x789f('0x32')]),_0x34e5b7);if(_0x28c365[_0x789f('0x34')][_0x789f('0x3e')]){_0x55d202[_0x789f('0x3c')]=_['merge'](_0x55d202['where'],{'$or':_[_0x789f('0x3f')](_0x34e5b7,function(_0x418547){if(_0x418547[_0x789f('0x2e')]!==_0x789f('0x40')){var _0x13710e={};_0x13710e[_0x418547[_0x789f('0x28')]]={'$like':'%'+_0x28c365[_0x789f('0x34')][_0x789f('0x3e')]+'%'};return _0x13710e;}})});}_0x55d202=_[_0x789f('0x41')]({},_0x55d202,_0x28c365['options']);var _0xf8d12f={'where':_0x55d202[_0x789f('0x3c')]};return db['VoiceChanSpy'][_0x789f('0x1a')](_0xf8d12f)[_0x789f('0x21')](function(_0x31eecf){_0x47da54['count']=_0x31eecf;if(_0x28c365[_0x789f('0x34')][_0x789f('0x42')]){_0x55d202['include']=[{'all':!![]}];}return db[_0x789f('0x2b')][_0x789f('0x43')](_0x55d202);})[_0x789f('0x21')](function(_0x2c43ee){_0x47da54['rows']=_0x2c43ee;return _0x47da54;})['then'](respondWithFilteredResult(_0x4ff7d0,_0x55d202))[_0x789f('0x44')](handleError(_0x4ff7d0,null));};exports['show']=function(_0x25aa8d,_0x4e25f7){var _0x31b7bc={'raw':![],'where':{'id':_0x25aa8d['params']['id']}},_0xf491f4={};_0xf491f4['model']=_[_0x789f('0x31')](db['VoiceChanSpy']['rawAttributes']);_0xf491f4[_0x789f('0x34')]=_[_0x789f('0x31')](_0x25aa8d['query']);_0xf491f4['filters']=_['intersection'](_0xf491f4[_0x789f('0x30')],_0xf491f4['query']);_0x31b7bc['attributes']=_[_0x789f('0x33')](_0xf491f4[_0x789f('0x30')],qs[_0x789f('0x36')](_0x25aa8d[_0x789f('0x34')][_0x789f('0x36')]));_0x31b7bc[_0x789f('0x35')]=_0x31b7bc[_0x789f('0x35')][_0x789f('0x37')]?_0x31b7bc[_0x789f('0x35')]:_0xf491f4['model'];if(_0x25aa8d[_0x789f('0x34')][_0x789f('0x42')]){_0x31b7bc[_0x789f('0x45')]=[{'all':!![]}];}_0x31b7bc=_['merge']({},_0x31b7bc,_0x25aa8d[_0x789f('0x46')]);return db[_0x789f('0x2b')][_0x789f('0x47')](_0x31b7bc)[_0x789f('0x21')](handleEntityNotFound(_0x4e25f7,null))['then'](respondWithResult(_0x4e25f7,null))[_0x789f('0x44')](handleError(_0x4e25f7,null));};exports[_0x789f('0x48')]=function(_0x596c82,_0x218c5d){return db[_0x789f('0x2b')][_0x789f('0x48')](_0x596c82[_0x789f('0x49')],{})[_0x789f('0x21')](function(_0x55e340){var _0x3e1cb6=_0x596c82[_0x789f('0x4a')]['get']({'plain':!![]});if(!_0x3e1cb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1cb6[_0x789f('0x4b')]==='user'){var _0xfdba86=_0x55e340[_0x789f('0x22')]({'plain':!![]});var _0x1cdb86=_0x789f('0x23');return db[_0x789f('0x4c')][_0x789f('0x47')]({'where':{'name':_0x1cdb86,'userProfileId':_0x3e1cb6[_0x789f('0x4d')]},'raw':!![]})[_0x789f('0x21')](function(_0xa30f7){if(_0xa30f7&&_0xa30f7[_0x789f('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0xfdba86[_0x789f('0x28')],'resourceId':_0xfdba86['id'],'type':_0xa30f7[_0x789f('0x28')],'sectionId':_0xa30f7['id']},{})[_0x789f('0x21')](function(){return _0x55e340;});}else{return _0x55e340;}})[_0x789f('0x44')](function(_0x4d5700){logger[_0x789f('0x27')](_0x789f('0x4f'),_0x4d5700);throw _0x4d5700;});}return _0x55e340;})['then'](respondWithResult(_0x218c5d,0xc9))['catch'](handleError(_0x218c5d,null));};exports[_0x789f('0x50')]=function(_0x98ee83,_0x1418ef){if(_0x98ee83[_0x789f('0x49')]['id']){delete _0x98ee83[_0x789f('0x49')]['id'];}return db[_0x789f('0x2b')]['find']({'where':{'id':_0x98ee83['params']['id']}})[_0x789f('0x21')](handleEntityNotFound(_0x1418ef,null))[_0x789f('0x21')](saveUpdates(_0x98ee83[_0x789f('0x49')],null))[_0x789f('0x21')](respondWithResult(_0x1418ef,null))['catch'](handleError(_0x1418ef,null));};exports['destroy']=function(_0x347347,_0xc8f58){return db[_0x789f('0x2b')][_0x789f('0x47')]({'where':{'id':_0x347347[_0x789f('0x51')]['id']}})['then'](handleEntityNotFound(_0xc8f58,null))[_0x789f('0x21')](removeEntity(_0xc8f58,null))[_0x789f('0x44')](handleError(_0xc8f58,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 0c447ac..8abf8fd 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 _0x9d80=['voice_chanspy','bulkCreate','VoiceExtension','destroy','catch','util','bluebird','./voiceChanSpy.attributes','context','from-sip','push','merge','Set','format','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then','models','VoiceChanSpy'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9d80,0xdd));var _0x09d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d80[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x09d8('0x0'));var BPromise=require(_0x09d8('0x1'));var attributes=require(_0x09d8('0x2'));var getUserApplications=function(_0x98050c,_0x3eb4e6,_0x32abb5){var _0x3c05f4=0x1;var _0x1f1f86=[];var _0x4c9d24={'context':_0x3eb4e6[_0x09d8('0x3')]||_0x09d8('0x4'),'exten':util['format']('%s%s',_0x98050c['prefix'],_0x32abb5),'type':'system','isApp':![],'ChanSpyId':_0x98050c['id'],'UserId':_0x3eb4e6['id']};_0x1f1f86[_0x09d8('0x5')](_[_0x09d8('0x6')]({'app':_0x09d8('0x7'),'appdata':util[_0x09d8('0x8')](_0x09d8('0x9'),_0x09d8('0xa')),'priority':_0x3c05f4++},_0x4c9d24));if(_0x98050c[_0x09d8('0xb')]){_0x1f1f86['push'](_[_0x09d8('0x6')]({'app':'MixMonitor','appdata':util['format'](_0x09d8('0xc'),_0x98050c[_0x09d8('0xd')]),'priority':_0x3c05f4++},_0x4c9d24));}if(_0x98050c[_0x09d8('0xe')]){_0x1f1f86[_0x09d8('0x5')](_['merge']({'app':_0x09d8('0xf'),'appdata':_0x98050c[_0x09d8('0x10')],'priority':_0x3c05f4++},_0x4c9d24));}_0x1f1f86[_0x09d8('0x5')](_[_0x09d8('0x6')]({'app':_0x09d8('0x11'),'appdata':util[_0x09d8('0x8')](_0x09d8('0x12'),_0x3eb4e6[_0x09d8('0x13')],_0x98050c[_0x09d8('0x14')]?_0x98050c[_0x09d8('0x14')][_0x09d8('0x15')](''):''),'priority':_0x3c05f4++},_0x4c9d24));if(_0x98050c['record']){_0x1f1f86[_0x09d8('0x5')](_[_0x09d8('0x6')]({'app':'StopMixMonitor','priority':_0x3c05f4++},_0x4c9d24));}return _0x1f1f86;};var getChanSpyApplications=function(_0x1e9c5a,_0x24bb99){var _0x18a58d=[];for(var _0x233908=0x0,_0x18a3af=0x1;_0x233908<_0x24bb99[_0x09d8('0x16')];_0x233908++,_0x18a3af=0x1){_0x18a58d=_0x18a58d[_0x09d8('0x17')](getUserApplications(_0x1e9c5a,_0x24bb99[_0x233908],_0x24bb99[_0x233908][_0x09d8('0x18')]));if(_0x24bb99[_0x233908][_0x09d8('0x18')]!=_0x24bb99[_0x233908]['name']){_0x18a58d=_0x18a58d[_0x09d8('0x17')](getUserApplications(_0x1e9c5a,_0x24bb99[_0x233908],_0x24bb99[_0x233908][_0x09d8('0x13')]));}}return _0x18a58d;};var getChanSpyPromise=function(_0x2f9cae,_0x2c1b2b){return new BPromise(function(_0x4df82d,_0x480647){return _0x2f9cae[_0x09d8('0x19')][_0x09d8('0x1a')]({'attributes':['id','name',_0x09d8('0x18')],'where':{'role':_0x09d8('0x1b'),'chanspy':!![]},'raw':!![]})[_0x09d8('0x1c')](function(_0x404e5f){if(_0x404e5f){return _0x4df82d(getChanSpyApplications(_0x2c1b2b,_0x404e5f));}return _0x4df82d([]);})['catch'](function(_0x445fc2){_0x480647(_0x445fc2);});});};module['exports']=function(_0x5a8ce3,_0x542ac0){var _0x43ec47=_0x5a8ce3[_0x09d8('0x1d')];return _0x5a8ce3['define'](_0x09d8('0x1e'),attributes,{'tableName':_0x09d8('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x55517f,_0x1394bb,_0x51d727){return getChanSpyPromise(_0x43ec47,_0x55517f)[_0x09d8('0x1c')](function(_0x24dae0){if(_0x24dae0&&_0x24dae0[_0x09d8('0x16')]){return _0x43ec47['VoiceExtension'][_0x09d8('0x20')](_0x24dae0);}})[_0x09d8('0x1c')](function(){_0x51d727();})['catch'](function(_0x5e11dd){_0x51d727(_0x5e11dd);});},'afterUpdate':function(_0x19bfd9,_0x554a54,_0x4712f0){return _0x43ec47[_0x09d8('0x21')][_0x09d8('0x22')]({'where':{'ChanSpyId':_0x19bfd9['id']}})[_0x09d8('0x1c')](function(){return getChanSpyPromise(_0x43ec47,_0x19bfd9);})[_0x09d8('0x1c')](function(_0x531036){if(_0x531036&&_0x531036[_0x09d8('0x16')]){return _0x43ec47['VoiceExtension']['bulkCreate'](_0x531036);}})[_0x09d8('0x1c')](function(){_0x4712f0();})[_0x09d8('0x23')](function(_0x33777e){_0x4712f0(_0x33777e);});},'afterDestroy':function(_0x26e1a9,_0xce6535,_0x284bba){return _0x43ec47[_0x09d8('0x21')][_0x09d8('0x22')]({'where':{'ChanSpyId':_0x26e1a9['id']}})[_0x09d8('0x1c')](function(){_0x284bba();})['catch'](function(_0x2e76f0){_0x284bba(_0x2e76f0);});}}});}; \ No newline at end of file +var _0x2fe2=['exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','from-sip','format','%s%s','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','findAll','then','catch'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x2fe2,0x1b8));var _0x22fe=function(_0x52ecb3,_0xfbd8d5){_0x52ecb3=_0x52ecb3-0x0;var _0x8043bf=_0x2fe2[_0x52ecb3];return _0x8043bf;};'use strict';var _=require('lodash');var util=require(_0x22fe('0x0'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x595e55,_0xd0ffdd,_0x336a0d){var _0x1c8b92=0x1;var _0x362ca2=[];var _0x1840ad={'context':_0xd0ffdd['context']||_0x22fe('0x1'),'exten':util[_0x22fe('0x2')](_0x22fe('0x3'),_0x595e55['prefix'],_0x336a0d),'type':_0x22fe('0x4'),'isApp':![],'ChanSpyId':_0x595e55['id'],'UserId':_0xd0ffdd['id']};_0x362ca2['push'](_[_0x22fe('0x5')]({'app':_0x22fe('0x6'),'appdata':util[_0x22fe('0x2')](_0x22fe('0x7'),_0x22fe('0x8')),'priority':_0x1c8b92++},_0x1840ad));if(_0x595e55[_0x22fe('0x9')]){_0x362ca2[_0x22fe('0xa')](_[_0x22fe('0x5')]({'app':_0x22fe('0xb'),'appdata':util['format'](_0x22fe('0xc'),_0x595e55[_0x22fe('0xd')]),'priority':_0x1c8b92++},_0x1840ad));}if(_0x595e55[_0x22fe('0xe')]){_0x362ca2[_0x22fe('0xa')](_['merge']({'app':'Authenticate','appdata':_0x595e55[_0x22fe('0xf')],'priority':_0x1c8b92++},_0x1840ad));}_0x362ca2[_0x22fe('0xa')](_['merge']({'app':_0x22fe('0x10'),'appdata':util[_0x22fe('0x2')](_0x22fe('0x11'),_0xd0ffdd[_0x22fe('0x12')],_0x595e55[_0x22fe('0x13')]?_0x595e55[_0x22fe('0x13')][_0x22fe('0x14')](''):''),'priority':_0x1c8b92++},_0x1840ad));if(_0x595e55[_0x22fe('0x9')]){_0x362ca2[_0x22fe('0xa')](_[_0x22fe('0x5')]({'app':_0x22fe('0x15'),'priority':_0x1c8b92++},_0x1840ad));}return _0x362ca2;};var getChanSpyApplications=function(_0x3bdb38,_0x2361ca){var _0x506822=[];for(var _0x2f4376=0x0,_0xea8fb8=0x1;_0x2f4376<_0x2361ca[_0x22fe('0x16')];_0x2f4376++,_0xea8fb8=0x1){_0x506822=_0x506822['concat'](getUserApplications(_0x3bdb38,_0x2361ca[_0x2f4376],_0x2361ca[_0x2f4376]['internal']));if(_0x2361ca[_0x2f4376][_0x22fe('0x17')]!=_0x2361ca[_0x2f4376][_0x22fe('0x12')]){_0x506822=_0x506822[_0x22fe('0x18')](getUserApplications(_0x3bdb38,_0x2361ca[_0x2f4376],_0x2361ca[_0x2f4376][_0x22fe('0x12')]));}}return _0x506822;};var getChanSpyPromise=function(_0x39b2aa,_0x1bf78c){return new BPromise(function(_0x2af156,_0x496949){return _0x39b2aa['User'][_0x22fe('0x19')]({'attributes':['id',_0x22fe('0x12'),_0x22fe('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x22fe('0x1a')](function(_0x54526d){if(_0x54526d){return _0x2af156(getChanSpyApplications(_0x1bf78c,_0x54526d));}return _0x2af156([]);})[_0x22fe('0x1b')](function(_0x7c92b9){_0x496949(_0x7c92b9);});});};module[_0x22fe('0x1c')]=function(_0x42421b,_0xd8e97f){var _0x387cb3=_0x42421b[_0x22fe('0x1d')];return _0x42421b[_0x22fe('0x1e')](_0x22fe('0x1f'),attributes,{'tableName':_0x22fe('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fee0c,_0x1be0a7,_0x570766){return getChanSpyPromise(_0x387cb3,_0x3fee0c)[_0x22fe('0x1a')](function(_0x5c7140){if(_0x5c7140&&_0x5c7140['length']){return _0x387cb3[_0x22fe('0x21')][_0x22fe('0x22')](_0x5c7140);}})[_0x22fe('0x1a')](function(){_0x570766();})[_0x22fe('0x1b')](function(_0x13455d){_0x570766(_0x13455d);});},'afterUpdate':function(_0x278c3e,_0x211323,_0x1f2c2a){return _0x387cb3[_0x22fe('0x21')][_0x22fe('0x23')]({'where':{'ChanSpyId':_0x278c3e['id']}})[_0x22fe('0x1a')](function(){return getChanSpyPromise(_0x387cb3,_0x278c3e);})[_0x22fe('0x1a')](function(_0x5b54b3){if(_0x5b54b3&&_0x5b54b3[_0x22fe('0x16')]){return _0x387cb3[_0x22fe('0x21')][_0x22fe('0x22')](_0x5b54b3);}})[_0x22fe('0x1a')](function(){_0x1f2c2a();})[_0x22fe('0x1b')](function(_0x2093ea){_0x1f2c2a(_0x2093ea);});},'afterDestroy':function(_0x79cbae,_0x1f8adc,_0x15f9d8){return _0x387cb3['VoiceExtension'][_0x22fe('0x23')]({'where':{'ChanSpyId':_0x79cbae['id']}})[_0x22fe('0x1a')](function(){_0x15f9d8();})[_0x22fe('0x1b')](function(_0x3726f2){_0x15f9d8(_0x3726f2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index eea3122..fb397ba 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceChanSpy,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x30315d,_0x3f7b05){var _0x56c1b1=function(_0x77593b){while(--_0x77593b){_0x30315d['push'](_0x30315d['shift']());}};_0x56c1b1(++_0x3f7b05);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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']('VoiceChanSpy,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceChanSpy,\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')]('VoiceChanSpy,\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')]('VoiceChanSpy,\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 _0x6e6c=['randomstring','../../config/utils','rpc','jayson/promise','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird'];(function(_0x4de1c3,_0xbe77b9){var _0x26acfe=function(_0x2c9df4){while(--_0x2c9df4){_0x4de1c3['push'](_0x4de1c3['shift']());}};_0x26acfe(++_0xbe77b9);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301f55,_0x30a10b,_0x4da7bd){return new BPromise(function(_0x324706,_0x15d268){return client['request'](_0x301f55,_0x4da7bd)[_0xc6e6('0x8')](function(_0x481799){logger[_0xc6e6('0x9')](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));logger[_0xc6e6('0xc')](_0xc6e6('0xd'),_0x30a10b,_0xc6e6('0xb'),JSON[_0xc6e6('0xe')](_0x481799));if(_0x481799[_0xc6e6('0xf')]){if(_0x481799[_0xc6e6('0xf')]['code']===0x1f4){logger[_0xc6e6('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x15d268(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}logger['error'](_0xc6e6('0xa'),_0x30a10b,_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);return _0x324706(_0x481799[_0xc6e6('0xf')][_0xc6e6('0x10')]);}else{logger['info'](_0xc6e6('0xa'),_0x30a10b,_0xc6e6('0xb'));_0x324706(_0x481799['result'][_0xc6e6('0x10')]);}})[_0xc6e6('0x11')](function(_0xedf127){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x30a10b,_0xedf127);_0x15d268(_0xedf127);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8923017..016f3cf 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 _0x0ed1=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0ed1,0x109));var _0x10ed=function(_0x98ed17,_0x16750d){_0x98ed17=_0x98ed17-0x0;var _0x43bc1b=_0x0ed1[_0x98ed17];return _0x43bc1b;};'use strict';var multer=require(_0x10ed('0x0'));var util=require(_0x10ed('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x10ed('0x2'));var interaction=require(_0x10ed('0x3'));var config=require(_0x10ed('0x4'));var controller=require('./voiceContext.controller');router[_0x10ed('0x5')]('/',auth[_0x10ed('0x6')](),controller[_0x10ed('0x7')]);router[_0x10ed('0x5')](_0x10ed('0x8'),auth[_0x10ed('0x6')](),controller[_0x10ed('0x9')]);router[_0x10ed('0xa')]('/',auth['isAuthenticated'](),controller[_0x10ed('0xb')]);router[_0x10ed('0xc')](_0x10ed('0x8'),auth[_0x10ed('0x6')](),controller[_0x10ed('0xd')]);router[_0x10ed('0xe')](_0x10ed('0x8'),auth['isAuthenticated'](),controller[_0x10ed('0xf')]);module[_0x10ed('0x10')]=router; \ No newline at end of file +var _0x5fad=['./voiceContext.controller','get','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x57acd0,_0x35704a){var _0x4ae3ba=function(_0x410ba9){while(--_0x410ba9){_0x57acd0['push'](_0x57acd0['shift']());}};_0x4ae3ba(++_0x35704a);}(_0x5fad,0x11a));var _0xd5fa=function(_0x4a6c4d,_0x455768){_0x4a6c4d=_0x4a6c4d-0x0;var _0x31800b=_0x5fad[_0x4a6c4d];return _0x31800b;};'use strict';var multer=require(_0xd5fa('0x0'));var util=require(_0xd5fa('0x1'));var path=require('path');var timeout=require(_0xd5fa('0x2'));var express=require('express');var router=express[_0xd5fa('0x3')]();var fs_extra=require(_0xd5fa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd5fa('0x5'));var config=require(_0xd5fa('0x6'));var controller=require(_0xd5fa('0x7'));router[_0xd5fa('0x8')]('/',auth[_0xd5fa('0x9')](),controller['index']);router[_0xd5fa('0x8')]('/:id',auth[_0xd5fa('0x9')](),controller[_0xd5fa('0xa')]);router[_0xd5fa('0xb')]('/',auth[_0xd5fa('0x9')](),controller[_0xd5fa('0xc')]);router[_0xd5fa('0xd')]('/:id',auth[_0xd5fa('0x9')](),controller[_0xd5fa('0xe')]);router['delete']('/:id',auth[_0xd5fa('0x9')](),controller[_0xd5fa('0xf')]);module[_0xd5fa('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index eb33666..a487407 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 _0x3d11=['sequelize','exports','STRING','name'];(function(_0x2aacd8,_0x85c53e){var _0x24b16a=function(_0x40eb54){while(--_0x40eb54){_0x2aacd8['push'](_0x2aacd8['shift']());}};_0x24b16a(++_0x85c53e);}(_0x3d11,0xe4));var _0x13d1=function(_0x146237,_0x54a9f4){_0x146237=_0x146237-0x0;var _0x736d1b=_0x3d11[_0x146237];return _0x736d1b;};'use strict';var Sequelize=require(_0x13d1('0x0'));module[_0x13d1('0x1')]={'name':{'type':Sequelize[_0x13d1('0x2')],'unique':_0x13d1('0x3')},'description':{'type':Sequelize[_0x13d1('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a5c=['STRING','name','BOOLEAN','sequelize'];(function(_0x295fe2,_0x5c92c0){var _0x40426b=function(_0x1d165f){while(--_0x1d165f){_0x295fe2['push'](_0x295fe2['shift']());}};_0x40426b(++_0x5c92c0);}(_0x8a5c,0x15f));var _0xc8a5=function(_0x5a2cb2,_0x79a980){_0x5a2cb2=_0x5a2cb2-0x0;var _0x1f6b0c=_0x8a5c[_0x5a2cb2];return _0x1f6b0c;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module['exports']={'name':{'type':Sequelize[_0xc8a5('0x1')],'unique':_0xc8a5('0x2')},'description':{'type':Sequelize[_0xc8a5('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc8a5('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 9c34cc1..c0e85b0 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 _0x85aa=['querystring','papaparse','ioredis','api','../../mysqldb','client','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','params','keys','include','find','create','findAll','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','join','server/files/templates/context.ejs','chan_sip.so','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x599629,_0x179f96){var _0x54e364=function(_0xfb310f){while(--_0xfb310f){_0x599629['push'](_0x599629['shift']());}};_0x54e364(++_0x179f96);}(_0x85aa,0x177));var _0xa85a=function(_0x25ad8a,_0x263335){_0x25ad8a=_0x25ad8a-0x0;var _0x13b892=_0x85aa[_0x25ad8a];return _0x13b892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa85a('0x0'));var zipdir=require(_0xa85a('0x1'));var jsonpatch=require(_0xa85a('0x2'));var rp=require(_0xa85a('0x3'));var moment=require(_0xa85a('0x4'));var BPromise=require(_0xa85a('0x5'));var Mustache=require(_0xa85a('0x6'));var util=require(_0xa85a('0x7'));var path=require(_0xa85a('0x8'));var sox=require(_0xa85a('0x9'));var csv=require(_0xa85a('0xa'));var ejs=require(_0xa85a('0xb'));var fs=require('fs');var fs_extra=require(_0xa85a('0xc'));var _=require(_0xa85a('0xd'));var squel=require(_0xa85a('0xe'));var crypto=require(_0xa85a('0xf'));var jsforce=require(_0xa85a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa85a('0xa'));var querystring=require(_0xa85a('0x11'));var Papa=require(_0xa85a('0x12'));var Redis=require(_0xa85a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa85a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa85a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa85a('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x344737,_0x1fff2e,_0x266151,_0x52d76b){return new BPromise(function(_0xf7be9f,_0x5dd043){var _0x31cd9a=_0x52d76b||client;return _0x31cd9a[_0xa85a('0x17')](_0x344737,_0x266151)[_0xa85a('0x18')](function(_0x4b7c79){logger[_0xa85a('0x19')]('VoiceContext,\x20%s,\x20%s',_0x1fff2e,'request\x20sent');logger[_0xa85a('0x1a')](_0xa85a('0x1b'),_0x1fff2e,_0xa85a('0x1c'),JSON[_0xa85a('0x1d')](_0x4b7c79));if(_0x4b7c79['error']){if(_0x4b7c79[_0xa85a('0x1e')][_0xa85a('0x1f')]===0x1f4){logger[_0xa85a('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x1fff2e,_0x4b7c79['error']['message']);return _0x5dd043(_0x4b7c79[_0xa85a('0x1e')][_0xa85a('0x20')]);}logger[_0xa85a('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x1fff2e,_0x4b7c79[_0xa85a('0x1e')][_0xa85a('0x20')]);return _0xf7be9f(_0x4b7c79[_0xa85a('0x1e')][_0xa85a('0x20')]);}else{logger[_0xa85a('0x19')](_0xa85a('0x21'),_0x1fff2e,_0xa85a('0x1c'));_0xf7be9f(_0x4b7c79[_0xa85a('0x22')][_0xa85a('0x20')]);}})[_0xa85a('0x23')](function(_0x46d3da){logger[_0xa85a('0x1e')](_0xa85a('0x21'),_0x1fff2e,_0x46d3da);_0x5dd043(_0x46d3da);});});}function respondWithStatusCode(_0x5a189d,_0x42ee5d){_0x42ee5d=_0x42ee5d||0xcc;return function(_0x39208e){if(_0x39208e){return _0x5a189d[_0xa85a('0x24')](_0x42ee5d);}return _0x5a189d['status'](_0x42ee5d)[_0xa85a('0x25')]();};}function respondWithResult(_0x10f628,_0x5311a1){_0x5311a1=_0x5311a1||0xc8;return function(_0xdf1dfe){if(_0xdf1dfe){return _0x10f628[_0xa85a('0x26')](_0x5311a1)[_0xa85a('0x27')](_0xdf1dfe);}};}function respondWithFilteredResult(_0x564fec,_0x45a308){return function(_0x2e74e1){if(_0x2e74e1){var _0x2b39be=typeof _0x45a308[_0xa85a('0x28')]===_0xa85a('0x29')&&typeof _0x45a308[_0xa85a('0x2a')]==='undefined';var _0x252b77=_0x2e74e1['count'];var _0x4c2c41=_0x2b39be?0x0:_0x45a308[_0xa85a('0x28')];var _0x23bb35=_0x2b39be?_0x2e74e1[_0xa85a('0x2b')]:_0x45a308[_0xa85a('0x28')]+_0x45a308['limit'];var _0x491e89;if(_0x23bb35>=_0x252b77){_0x23bb35=_0x252b77;_0x491e89=0xc8;}else{_0x491e89=0xce;}_0x564fec[_0xa85a('0x26')](_0x491e89);return _0x564fec[_0xa85a('0x2c')](_0xa85a('0x2d'),_0x4c2c41+'-'+_0x23bb35+'/'+_0x252b77)[_0xa85a('0x27')](_0x2e74e1);}return null;};}function patchUpdates(_0x508250){return function(_0x55f366){try{jsonpatch[_0xa85a('0x2e')](_0x55f366,_0x508250,!![]);}catch(_0x4212b6){return BPromise[_0xa85a('0x2f')](_0x4212b6);}return _0x55f366[_0xa85a('0x30')]();};}function saveUpdates(_0x4eddb0,_0x9e1f91){return function(_0x38b5af){if(_0x38b5af){return _0x38b5af[_0xa85a('0x31')](_0x4eddb0)[_0xa85a('0x18')](function(_0x20176c){return _0x20176c;});}return null;};}function removeEntity(_0x26867e,_0x103ec5){return function(_0x527aa8){if(_0x527aa8){return _0x527aa8[_0xa85a('0x32')]()[_0xa85a('0x18')](function(){var _0x442450=_0x527aa8[_0xa85a('0x33')]({'plain':!![]});var _0x148a9d=_0xa85a('0x34');return db['UserProfileResource'][_0xa85a('0x32')]({'where':{'type':_0x148a9d,'resourceId':_0x442450['id']}})[_0xa85a('0x18')](function(){return _0x527aa8;});})[_0xa85a('0x18')](function(){_0x26867e[_0xa85a('0x26')](0xcc)[_0xa85a('0x25')]();});}};}function handleEntityNotFound(_0x239885,_0x2aff1b){return function(_0x2de1cd){if(!_0x2de1cd){_0x239885['sendStatus'](0x194);}return _0x2de1cd;};}function handleError(_0x2d2209,_0x5ce74f){_0x5ce74f=_0x5ce74f||0x1f4;return function(_0x3703fa){logger[_0xa85a('0x1e')](_0x3703fa[_0xa85a('0x35')]);if(_0x3703fa[_0xa85a('0x36')]){delete _0x3703fa[_0xa85a('0x36')];}_0x2d2209['status'](_0x5ce74f)[_0xa85a('0x37')](_0x3703fa);};}exports[_0xa85a('0x38')]=function(_0x331239,_0x7bc75c){var _0x532b29={},_0xd9bbdf={},_0x26e679={'count':0x0,'rows':[]};var _0x2ae958=_[_0xa85a('0x39')](db[_0xa85a('0x3a')][_0xa85a('0x3b')],function(_0x56f606){return{'name':_0x56f606['fieldName'],'type':_0x56f606[_0xa85a('0x3c')]['key']};});_0xd9bbdf['model']=_[_0xa85a('0x39')](_0x2ae958,'name');_0xd9bbdf[_0xa85a('0x3d')]=_['keys'](_0x331239['query']);_0xd9bbdf[_0xa85a('0x3e')]=_['intersection'](_0xd9bbdf['model'],_0xd9bbdf[_0xa85a('0x3d')]);_0x532b29[_0xa85a('0x3f')]=_[_0xa85a('0x40')](_0xd9bbdf[_0xa85a('0x41')],qs[_0xa85a('0x42')](_0x331239['query'][_0xa85a('0x42')]));_0x532b29['attributes']=_0x532b29['attributes'][_0xa85a('0x43')]?_0x532b29[_0xa85a('0x3f')]:_0xd9bbdf['model'];if(!_0x331239[_0xa85a('0x3d')][_0xa85a('0x44')]('nolimit')){_0x532b29['limit']=qs[_0xa85a('0x2a')](_0x331239[_0xa85a('0x3d')][_0xa85a('0x2a')]);_0x532b29[_0xa85a('0x28')]=qs[_0xa85a('0x28')](_0x331239['query'][_0xa85a('0x28')]);}_0x532b29[_0xa85a('0x45')]=qs[_0xa85a('0x46')](_0x331239[_0xa85a('0x3d')][_0xa85a('0x46')]);_0x532b29[_0xa85a('0x47')]=qs[_0xa85a('0x3e')](_[_0xa85a('0x48')](_0x331239['query'],_0xd9bbdf[_0xa85a('0x3e')]),_0x2ae958);if(_0x331239['query'][_0xa85a('0x49')]){_0x532b29[_0xa85a('0x47')]=_[_0xa85a('0x4a')](_0x532b29['where'],{'$or':_['map'](_0x2ae958,function(_0x2ef133){if(_0x2ef133['type']!=='VIRTUAL'){var _0x11ef02={};_0x11ef02[_0x2ef133['name']]={'$like':'%'+_0x331239[_0xa85a('0x3d')][_0xa85a('0x49')]+'%'};return _0x11ef02;}})});}_0x532b29=_[_0xa85a('0x4a')]({},_0x532b29,_0x331239[_0xa85a('0x4b')]);var _0x1295c1={'where':_0x532b29[_0xa85a('0x47')]};return db[_0xa85a('0x3a')][_0xa85a('0x2b')](_0x1295c1)[_0xa85a('0x18')](function(_0x324dcc){_0x26e679['count']=_0x324dcc;if(_0x331239[_0xa85a('0x3d')]['includeAll']){_0x532b29['include']=[{'all':!![]}];}return db[_0xa85a('0x3a')]['findAll'](_0x532b29);})[_0xa85a('0x18')](function(_0x535d9d){_0x26e679['rows']=_0x535d9d;return _0x26e679;})['then'](respondWithFilteredResult(_0x7bc75c,_0x532b29))[_0xa85a('0x23')](handleError(_0x7bc75c,null));};exports['show']=function(_0x3d0775,_0x1861f8){var _0x111bc7={'raw':![],'where':{'id':_0x3d0775[_0xa85a('0x4c')]['id']}},_0x5e41c5={};_0x5e41c5[_0xa85a('0x41')]=_['keys'](db[_0xa85a('0x3a')][_0xa85a('0x3b')]);_0x5e41c5['query']=_[_0xa85a('0x4d')](_0x3d0775['query']);_0x5e41c5['filters']=_[_0xa85a('0x40')](_0x5e41c5['model'],_0x5e41c5[_0xa85a('0x3d')]);_0x111bc7['attributes']=_[_0xa85a('0x40')](_0x5e41c5[_0xa85a('0x41')],qs[_0xa85a('0x42')](_0x3d0775[_0xa85a('0x3d')][_0xa85a('0x42')]));_0x111bc7[_0xa85a('0x3f')]=_0x111bc7[_0xa85a('0x3f')]['length']?_0x111bc7[_0xa85a('0x3f')]:_0x5e41c5[_0xa85a('0x41')];if(_0x3d0775[_0xa85a('0x3d')]['includeAll']){_0x111bc7[_0xa85a('0x4e')]=[{'all':!![]}];}_0x111bc7=_['merge']({},_0x111bc7,_0x3d0775['options']);return db[_0xa85a('0x3a')][_0xa85a('0x4f')](_0x111bc7)[_0xa85a('0x18')](handleEntityNotFound(_0x1861f8,null))[_0xa85a('0x18')](respondWithResult(_0x1861f8,null))[_0xa85a('0x23')](handleError(_0x1861f8,null));};exports[_0xa85a('0x50')]=function(_0x4f8c3a,_0x2ab4f8,_0x5aec8c){var _0x3314c0;return db[_0xa85a('0x3a')][_0xa85a('0x50')](_0x4f8c3a['body'],{'raw':!![]})[_0xa85a('0x18')](function(_0xad832f){_0x3314c0=_0xad832f;return db[_0xa85a('0x3a')][_0xa85a('0x51')]({'raw':!![]});})['then'](function(_0x239909){var _0x11fc04=fs[_0xa85a('0x52')](path['join'](config[_0xa85a('0x53')],'server/files/templates/context.ejs'),_0xa85a('0x54'));var _0x2b70c0=ejs[_0xa85a('0x55')](_0x11fc04,{'contexts':_0x239909||[]});fs[_0xa85a('0x56')](_0xa85a('0x57'),_0x2b70c0);})[_0xa85a('0x18')](function(){return respondWithRpcPromise(_0xa85a('0x58'),'create',{'module':'chan_sip.so'});})[_0xa85a('0x18')](function(){var _0xa6f170=_0x4f8c3a[_0xa85a('0x59')][_0xa85a('0x33')]({'plain':!![]});if(!_0xa6f170)throw new Error(_0xa85a('0x5a'));if(_0xa6f170['role']===_0xa85a('0x59')){var _0x5eccee=_0x3314c0[_0xa85a('0x33')]({'plain':!![]});return db[_0xa85a('0x5b')]['find']({'where':{'name':'Contexts','userProfileId':_0xa6f170[_0xa85a('0x5c')]},'raw':!![]})[_0xa85a('0x18')](function(_0x348758){if(_0x348758&&_0x348758[_0xa85a('0x5d')]===0x0){return db[_0xa85a('0x5e')][_0xa85a('0x50')]({'name':_0x5eccee[_0xa85a('0x36')],'resourceId':_0x5eccee['id'],'type':_0x348758['name'],'sectionId':_0x348758['id']},{})[_0xa85a('0x18')](function(){return _0x3314c0;});}else{return _0x3314c0;}})[_0xa85a('0x23')](function(_0x499f67){logger[_0xa85a('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x499f67);throw _0x499f67;});}return _0x3314c0;})[_0xa85a('0x18')](respondWithResult(_0x2ab4f8,0xc9))['catch'](handleError(_0x2ab4f8,null));};exports[_0xa85a('0x31')]=function(_0x5e2027,_0x31adb4,_0x43e97e){var _0x3e641c;return db['VoiceContext'][_0xa85a('0x4f')]({'where':{'id':_0x5e2027[_0xa85a('0x4c')]['id']}})[_0xa85a('0x18')](handleEntityNotFound(_0x31adb4,null))[_0xa85a('0x18')](saveUpdates(_0x5e2027['body'],null))[_0xa85a('0x18')](function(_0x30d32a){if(_0x30d32a){_0x3e641c=_0x30d32a;return db[_0xa85a('0x3a')][_0xa85a('0x51')]({'raw':!![]});}})[_0xa85a('0x18')](function(_0x3b2ff6){var _0x2891a6=fs['readFileSync'](path[_0xa85a('0x5f')](config[_0xa85a('0x53')],_0xa85a('0x60')),'utf8');var _0x3ce922=ejs[_0xa85a('0x55')](_0x2891a6,{'contexts':_0x3b2ff6||[]});fs[_0xa85a('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3ce922);})['then'](function(){return respondWithRpcPromise(_0xa85a('0x58'),_0xa85a('0x31'),{'module':_0xa85a('0x61')});})[_0xa85a('0x18')](function(){return _0x3e641c;})[_0xa85a('0x18')](respondWithResult(_0x31adb4,null))[_0xa85a('0x23')](handleError(_0x31adb4,null));};exports[_0xa85a('0x32')]=function(_0x36357c,_0x338e99,_0x25a2b2){var _0x3373cc;return db['VoiceContext']['find']({'where':{'id':_0x36357c[_0xa85a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x338e99,null))[_0xa85a('0x18')](removeEntity(_0x338e99,null))['then'](function(){return db[_0xa85a('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x453b75){var _0x5ec65e=fs[_0xa85a('0x52')](path[_0xa85a('0x5f')](config[_0xa85a('0x53')],_0xa85a('0x60')),_0xa85a('0x54'));var _0x5c0569=ejs[_0xa85a('0x55')](_0x5ec65e,{'contexts':_0x453b75});fs[_0xa85a('0x56')](_0xa85a('0x57'),_0x5c0569);return respondWithRpcPromise(_0xa85a('0x58'),_0xa85a('0x32'),{'module':_0xa85a('0x61')});})[_0xa85a('0x23')](handleError(_0x338e99,null));}; \ No newline at end of file +var _0x1eb9=['apply','reject','update','destroy','get','Contexts','stack','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','readFileSync','join','root','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','offset','count'];(function(_0x57d2af,_0x124741){var _0x444a9c=function(_0x39154c){while(--_0x39154c){_0x57d2af['push'](_0x57d2af['shift']());}};_0x444a9c(++_0x124741);}(_0x1eb9,0x1dd));var _0x91eb=function(_0x36ea6b,_0x3b6a9e){_0x36ea6b=_0x36ea6b-0x0;var _0x25c6d2=_0x1eb9[_0x36ea6b];return _0x25c6d2;};'use strict';var emlformat=require(_0x91eb('0x0'));var rimraf=require(_0x91eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91eb('0x2'));var rp=require(_0x91eb('0x3'));var moment=require(_0x91eb('0x4'));var BPromise=require(_0x91eb('0x5'));var Mustache=require(_0x91eb('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x91eb('0x7'));var ejs=require(_0x91eb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91eb('0x9'));var squel=require(_0x91eb('0xa'));var crypto=require(_0x91eb('0xb'));var jsforce=require(_0x91eb('0xc'));var deskjs=require(_0x91eb('0xd'));var toCsv=require(_0x91eb('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91eb('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x91eb('0xf'));var hardwareService=require(_0x91eb('0x10'));var logger=require(_0x91eb('0x11'))(_0x91eb('0x12'));var utils=require(_0x91eb('0x13'));var config=require(_0x91eb('0x14'));var licenseUtil=require(_0x91eb('0x15'));var db=require(_0x91eb('0x16'))['db'];var jayson=require(_0x91eb('0x17'));var client=jayson['client'][_0x91eb('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5149b5,_0x451f16,_0x173670,_0x2d8474){return new BPromise(function(_0x2c0c69,_0x5994b1){var _0x321516=_0x2d8474||client;return _0x321516['request'](_0x5149b5,_0x173670)[_0x91eb('0x19')](function(_0xd3c1a1){logger['info']('VoiceContext,\x20%s,\x20%s',_0x451f16,_0x91eb('0x1a'));logger['debug'](_0x91eb('0x1b'),_0x451f16,'request\x20sent',JSON[_0x91eb('0x1c')](_0xd3c1a1));if(_0xd3c1a1[_0x91eb('0x1d')]){if(_0xd3c1a1[_0x91eb('0x1d')][_0x91eb('0x1e')]===0x1f4){logger[_0x91eb('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x451f16,_0xd3c1a1[_0x91eb('0x1d')]['message']);return _0x5994b1(_0xd3c1a1[_0x91eb('0x1d')][_0x91eb('0x1f')]);}logger[_0x91eb('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x451f16,_0xd3c1a1[_0x91eb('0x1d')][_0x91eb('0x1f')]);return _0x2c0c69(_0xd3c1a1[_0x91eb('0x1d')]['message']);}else{logger[_0x91eb('0x20')](_0x91eb('0x21'),_0x451f16,_0x91eb('0x1a'));_0x2c0c69(_0xd3c1a1[_0x91eb('0x22')][_0x91eb('0x1f')]);}})[_0x91eb('0x23')](function(_0x18e80a){logger['error'](_0x91eb('0x21'),_0x451f16,_0x18e80a);_0x5994b1(_0x18e80a);});});}function respondWithStatusCode(_0x5ba712,_0x2e0d7b){_0x2e0d7b=_0x2e0d7b||0xcc;return function(_0x1a1945){if(_0x1a1945){return _0x5ba712[_0x91eb('0x24')](_0x2e0d7b);}return _0x5ba712[_0x91eb('0x25')](_0x2e0d7b)[_0x91eb('0x26')]();};}function respondWithResult(_0x204567,_0x21f5b7){_0x21f5b7=_0x21f5b7||0xc8;return function(_0x49d1f0){if(_0x49d1f0){return _0x204567[_0x91eb('0x25')](_0x21f5b7)[_0x91eb('0x27')](_0x49d1f0);}};}function respondWithFilteredResult(_0x3059d4,_0x1fddc3){return function(_0x24f49e){if(_0x24f49e){var _0x1ddef4=typeof _0x1fddc3['offset']===_0x91eb('0x28')&&typeof _0x1fddc3['limit']===_0x91eb('0x28');var _0x48af5f=_0x24f49e['count'];var _0x5261c8=_0x1ddef4?0x0:_0x1fddc3[_0x91eb('0x29')];var _0x3e231d=_0x1ddef4?_0x24f49e[_0x91eb('0x2a')]:_0x1fddc3[_0x91eb('0x29')]+_0x1fddc3['limit'];var _0x35b80c;if(_0x3e231d>=_0x48af5f){_0x3e231d=_0x48af5f;_0x35b80c=0xc8;}else{_0x35b80c=0xce;}_0x3059d4[_0x91eb('0x25')](_0x35b80c);return _0x3059d4['set']('Content-Range',_0x5261c8+'-'+_0x3e231d+'/'+_0x48af5f)[_0x91eb('0x27')](_0x24f49e);}return null;};}function patchUpdates(_0x2f06a6){return function(_0xf4fb90){try{jsonpatch[_0x91eb('0x2b')](_0xf4fb90,_0x2f06a6,!![]);}catch(_0xc62a91){return BPromise[_0x91eb('0x2c')](_0xc62a91);}return _0xf4fb90['save']();};}function saveUpdates(_0xa56662,_0x14e563){return function(_0x25beec){if(_0x25beec){return _0x25beec[_0x91eb('0x2d')](_0xa56662)['then'](function(_0x538c18){return _0x538c18;});}return null;};}function removeEntity(_0x1de4c8,_0x3a1409){return function(_0x20a5e8){if(_0x20a5e8){return _0x20a5e8[_0x91eb('0x2e')]()[_0x91eb('0x19')](function(){var _0x11b7b2=_0x20a5e8[_0x91eb('0x2f')]({'plain':!![]});var _0x19f9e0=_0x91eb('0x30');return db['UserProfileResource'][_0x91eb('0x2e')]({'where':{'type':_0x19f9e0,'resourceId':_0x11b7b2['id']}})['then'](function(){return _0x20a5e8;});})[_0x91eb('0x19')](function(){_0x1de4c8[_0x91eb('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x307484,_0x21c01e){return function(_0x42f5c8){if(!_0x42f5c8){_0x307484[_0x91eb('0x24')](0x194);}return _0x42f5c8;};}function handleError(_0x332f72,_0x4a987b){_0x4a987b=_0x4a987b||0x1f4;return function(_0xa7eb5f){logger[_0x91eb('0x1d')](_0xa7eb5f[_0x91eb('0x31')]);if(_0xa7eb5f['name']){delete _0xa7eb5f[_0x91eb('0x32')];}_0x332f72[_0x91eb('0x25')](_0x4a987b)[_0x91eb('0x33')](_0xa7eb5f);};}exports[_0x91eb('0x34')]=function(_0x4b3499,_0x3634bc){var _0x3f5fc4={},_0x44c24b={},_0x686071={'count':0x0,'rows':[]};var _0x2ff9f6=_['map'](db[_0x91eb('0x35')][_0x91eb('0x36')],function(_0x5c47c8){return{'name':_0x5c47c8[_0x91eb('0x37')],'type':_0x5c47c8[_0x91eb('0x38')][_0x91eb('0x39')]};});_0x44c24b['model']=_[_0x91eb('0x3a')](_0x2ff9f6,_0x91eb('0x32'));_0x44c24b[_0x91eb('0x3b')]=_[_0x91eb('0x3c')](_0x4b3499['query']);_0x44c24b[_0x91eb('0x3d')]=_[_0x91eb('0x3e')](_0x44c24b['model'],_0x44c24b[_0x91eb('0x3b')]);_0x3f5fc4[_0x91eb('0x3f')]=_[_0x91eb('0x3e')](_0x44c24b[_0x91eb('0x40')],qs[_0x91eb('0x41')](_0x4b3499['query'][_0x91eb('0x41')]));_0x3f5fc4[_0x91eb('0x3f')]=_0x3f5fc4[_0x91eb('0x3f')][_0x91eb('0x42')]?_0x3f5fc4[_0x91eb('0x3f')]:_0x44c24b[_0x91eb('0x40')];if(!_0x4b3499[_0x91eb('0x3b')][_0x91eb('0x43')](_0x91eb('0x44'))){_0x3f5fc4[_0x91eb('0x45')]=qs[_0x91eb('0x45')](_0x4b3499['query'][_0x91eb('0x45')]);_0x3f5fc4['offset']=qs[_0x91eb('0x29')](_0x4b3499[_0x91eb('0x3b')]['offset']);}_0x3f5fc4[_0x91eb('0x46')]=qs[_0x91eb('0x47')](_0x4b3499[_0x91eb('0x3b')]['sort']);_0x3f5fc4[_0x91eb('0x48')]=qs[_0x91eb('0x3d')](_[_0x91eb('0x49')](_0x4b3499['query'],_0x44c24b[_0x91eb('0x3d')]),_0x2ff9f6);if(_0x4b3499[_0x91eb('0x3b')][_0x91eb('0x4a')]){_0x3f5fc4['where']=_[_0x91eb('0x4b')](_0x3f5fc4[_0x91eb('0x48')],{'$or':_[_0x91eb('0x3a')](_0x2ff9f6,function(_0x1c2ae1){if(_0x1c2ae1[_0x91eb('0x38')]!==_0x91eb('0x4c')){var _0x57eab8={};_0x57eab8[_0x1c2ae1[_0x91eb('0x32')]]={'$like':'%'+_0x4b3499['query']['filter']+'%'};return _0x57eab8;}})});}_0x3f5fc4=_[_0x91eb('0x4b')]({},_0x3f5fc4,_0x4b3499[_0x91eb('0x4d')]);var _0x1566b2={'where':_0x3f5fc4[_0x91eb('0x48')]};return db['VoiceContext'][_0x91eb('0x2a')](_0x1566b2)[_0x91eb('0x19')](function(_0x536394){_0x686071['count']=_0x536394;if(_0x4b3499[_0x91eb('0x3b')][_0x91eb('0x4e')]){_0x3f5fc4[_0x91eb('0x4f')]=[{'all':!![]}];}return db[_0x91eb('0x35')][_0x91eb('0x50')](_0x3f5fc4);})[_0x91eb('0x19')](function(_0x159cbc){_0x686071[_0x91eb('0x51')]=_0x159cbc;return _0x686071;})[_0x91eb('0x19')](respondWithFilteredResult(_0x3634bc,_0x3f5fc4))['catch'](handleError(_0x3634bc,null));};exports[_0x91eb('0x52')]=function(_0x20c405,_0x3bf9f6){var _0x392a90={'raw':![],'where':{'id':_0x20c405[_0x91eb('0x53')]['id']}},_0x577176={};_0x577176[_0x91eb('0x40')]=_[_0x91eb('0x3c')](db[_0x91eb('0x35')][_0x91eb('0x36')]);_0x577176[_0x91eb('0x3b')]=_['keys'](_0x20c405[_0x91eb('0x3b')]);_0x577176['filters']=_['intersection'](_0x577176['model'],_0x577176[_0x91eb('0x3b')]);_0x392a90[_0x91eb('0x3f')]=_[_0x91eb('0x3e')](_0x577176[_0x91eb('0x40')],qs[_0x91eb('0x41')](_0x20c405[_0x91eb('0x3b')][_0x91eb('0x41')]));_0x392a90[_0x91eb('0x3f')]=_0x392a90[_0x91eb('0x3f')]['length']?_0x392a90['attributes']:_0x577176['model'];if(_0x20c405['query'][_0x91eb('0x4e')]){_0x392a90[_0x91eb('0x4f')]=[{'all':!![]}];}_0x392a90=_['merge']({},_0x392a90,_0x20c405[_0x91eb('0x4d')]);return db['VoiceContext'][_0x91eb('0x54')](_0x392a90)['then'](handleEntityNotFound(_0x3bf9f6,null))[_0x91eb('0x19')](respondWithResult(_0x3bf9f6,null))[_0x91eb('0x23')](handleError(_0x3bf9f6,null));};exports[_0x91eb('0x55')]=function(_0x34da38,_0x446317,_0x2735a3){var _0x34b606;return db[_0x91eb('0x35')][_0x91eb('0x55')](_0x34da38[_0x91eb('0x56')],{'raw':!![]})['then'](function(_0x2ae528){_0x34b606=_0x2ae528;return db[_0x91eb('0x35')][_0x91eb('0x50')]({'raw':!![]});})[_0x91eb('0x19')](function(_0x1b22ae){var _0x3e540d=fs[_0x91eb('0x57')](path[_0x91eb('0x58')](config[_0x91eb('0x59')],'server/files/templates/context.ejs'),_0x91eb('0x5a'));var _0x45279f=ejs[_0x91eb('0x5b')](_0x3e540d,{'contexts':_0x1b22ae||[]});fs[_0x91eb('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x45279f);})[_0x91eb('0x19')](function(){return respondWithRpcPromise(_0x91eb('0x5d'),_0x91eb('0x55'),{'module':_0x91eb('0x5e')});})[_0x91eb('0x19')](function(){var _0x41388f=_0x34da38[_0x91eb('0x5f')][_0x91eb('0x2f')]({'plain':!![]});if(!_0x41388f)throw new Error(_0x91eb('0x60'));if(_0x41388f[_0x91eb('0x61')]===_0x91eb('0x5f')){var _0x15a480=_0x34b606['get']({'plain':!![]});return db[_0x91eb('0x62')][_0x91eb('0x54')]({'where':{'name':_0x91eb('0x30'),'userProfileId':_0x41388f[_0x91eb('0x63')]},'raw':!![]})[_0x91eb('0x19')](function(_0x5875c2){if(_0x5875c2&&_0x5875c2[_0x91eb('0x64')]===0x0){return db[_0x91eb('0x65')][_0x91eb('0x55')]({'name':_0x15a480['name'],'resourceId':_0x15a480['id'],'type':_0x5875c2['name'],'sectionId':_0x5875c2['id']},{})['then'](function(){return _0x34b606;});}else{return _0x34b606;}})['catch'](function(_0x315c9d){logger[_0x91eb('0x1d')](_0x91eb('0x66'),_0x315c9d);throw _0x315c9d;});}return _0x34b606;})[_0x91eb('0x19')](respondWithResult(_0x446317,0xc9))['catch'](handleError(_0x446317,null));};exports[_0x91eb('0x2d')]=function(_0x1f7d5c,_0x1191e7,_0x19e030){var _0x113dca;return db[_0x91eb('0x35')][_0x91eb('0x54')]({'where':{'id':_0x1f7d5c[_0x91eb('0x53')]['id']}})[_0x91eb('0x19')](handleEntityNotFound(_0x1191e7,null))[_0x91eb('0x19')](saveUpdates(_0x1f7d5c[_0x91eb('0x56')],null))[_0x91eb('0x19')](function(_0x3be0f5){if(_0x3be0f5){_0x113dca=_0x3be0f5;return db[_0x91eb('0x35')][_0x91eb('0x50')]({'raw':!![]});}})[_0x91eb('0x19')](function(_0x8268d1){var _0x4c02a3=fs[_0x91eb('0x57')](path[_0x91eb('0x58')](config['root'],'server/files/templates/context.ejs'),_0x91eb('0x5a'));var _0x50e167=ejs['render'](_0x4c02a3,{'contexts':_0x8268d1||[]});fs[_0x91eb('0x5c')](_0x91eb('0x67'),_0x50e167);})[_0x91eb('0x19')](function(){return respondWithRpcPromise(_0x91eb('0x5d'),_0x91eb('0x2d'),{'module':'chan_sip.so'});})[_0x91eb('0x19')](function(){return _0x113dca;})[_0x91eb('0x19')](respondWithResult(_0x1191e7,null))[_0x91eb('0x23')](handleError(_0x1191e7,null));};exports[_0x91eb('0x2e')]=function(_0x1f7fdd,_0x13e203,_0xc1a78f){var _0x4f96c0;return db['VoiceContext']['find']({'where':{'id':_0x1f7fdd[_0x91eb('0x53')]['id']}})['then'](handleEntityNotFound(_0x13e203,null))[_0x91eb('0x19')](removeEntity(_0x13e203,null))[_0x91eb('0x19')](function(){return db[_0x91eb('0x35')][_0x91eb('0x50')]({'raw':!![]});})[_0x91eb('0x19')](function(_0x343919){var _0x1cfe69=fs['readFileSync'](path[_0x91eb('0x58')](config[_0x91eb('0x59')],'server/files/templates/context.ejs'),'utf8');var _0x467652=ejs['render'](_0x1cfe69,{'contexts':_0x343919});fs[_0x91eb('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x467652);return respondWithRpcPromise(_0x91eb('0x5d'),_0x91eb('0x2e'),{'module':'chan_sip.so'});})[_0x91eb('0x23')](handleError(_0x13e203,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1bc2960..68adbaf 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 _0xcd01=['request-promise','path','rimraf','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','bluebird'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0xcd01,0xe3));var _0x1cd0=function(_0x13acd8,_0x5058b7){_0x13acd8=_0x13acd8-0x0;var _0xe6f98a=_0xcd01[_0x13acd8];return _0xe6f98a;};'use strict';var _=require(_0x1cd0('0x0'));var util=require('util');var logger=require(_0x1cd0('0x1'))(_0x1cd0('0x2'));var moment=require('moment');var BPromise=require(_0x1cd0('0x3'));var rp=require(_0x1cd0('0x4'));var fs=require('fs');var path=require(_0x1cd0('0x5'));var rimraf=require(_0x1cd0('0x6'));var config=require('../../config/environment');var attributes=require(_0x1cd0('0x7'));module['exports']=function(_0x38f273,_0x11d5fc){return _0x38f273[_0x1cd0('0x8')](_0x1cd0('0x9'),attributes,{'tableName':_0x1cd0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3b7=['rimraf','../../config/environment','define','VoiceContext','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20d333,_0x5a5b00){var _0x4b80f7=function(_0x24cedd){while(--_0x24cedd){_0x20d333['push'](_0x20d333['shift']());}};_0x4b80f7(++_0x5a5b00);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x311c5b,_0x4a2b50){_0x311c5b=_0x311c5b-0x0;var _0x44f0f5=_0xc3b7[_0x311c5b];return _0x44f0f5;};'use strict';var _=require('lodash');var util=require(_0x7c3b('0x0'));var logger=require(_0x7c3b('0x1'))(_0x7c3b('0x2'));var moment=require(_0x7c3b('0x3'));var BPromise=require(_0x7c3b('0x4'));var rp=require(_0x7c3b('0x5'));var fs=require('fs');var path=require(_0x7c3b('0x6'));var rimraf=require(_0x7c3b('0x7'));var config=require(_0x7c3b('0x8'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x20fa26,_0x40ef6a){return _0x20fa26[_0x7c3b('0x9')](_0x7c3b('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index d59f709..723bfca 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 _0xc224=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0xc224,0xe4));var _0x4c22=function(_0x4f5ac6,_0x5e92a5){_0x4f5ac6=_0x4f5ac6-0x0;var _0x4f4782=_0xc224[_0x4f5ac6];return _0x4f4782;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var moment=require(_0x4c22('0x2'));var BPromise=require(_0x4c22('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c22('0x4'));var db=require(_0x4c22('0x5'))['db'];var utils=require(_0x4c22('0x6'));var logger=require('../../config/logger')(_0x4c22('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c22('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2483a4,_0x1d0fac,_0x39e3d3){return new BPromise(function(_0x5975a9,_0x1b6bfe){return client[_0x4c22('0x9')](_0x2483a4,_0x39e3d3)[_0x4c22('0xa')](function(_0x1aadaa){logger[_0x4c22('0xb')](_0x4c22('0xc'),_0x1d0fac,_0x4c22('0xd'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1d0fac,_0x4c22('0xd'),JSON['stringify'](_0x1aadaa));if(_0x1aadaa[_0x4c22('0xe')]){if(_0x1aadaa[_0x4c22('0xe')][_0x4c22('0xf')]===0x1f4){logger[_0x4c22('0xe')](_0x4c22('0xc'),_0x1d0fac,_0x1aadaa[_0x4c22('0xe')][_0x4c22('0x10')]);return _0x1b6bfe(_0x1aadaa[_0x4c22('0xe')]['message']);}logger[_0x4c22('0xe')](_0x4c22('0xc'),_0x1d0fac,_0x1aadaa['error'][_0x4c22('0x10')]);return _0x5975a9(_0x1aadaa['error'][_0x4c22('0x10')]);}else{logger[_0x4c22('0xb')](_0x4c22('0xc'),_0x1d0fac,'request\x20sent');_0x5975a9(_0x1aadaa[_0x4c22('0x11')][_0x4c22('0x10')]);}})[_0x4c22('0x12')](function(_0x30ad20){logger[_0x4c22('0xe')](_0x4c22('0xc'),_0x1d0fac,_0x30ad20);_0x1b6bfe(_0x30ad20);});});} \ No newline at end of file +var _0xfbb2=['jayson/promise','http','request','then','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x757d8e,_0x3d3e28){var _0x78a473=function(_0x3ad510){while(--_0x3ad510){_0x757d8e['push'](_0x757d8e['shift']());}};_0x78a473(++_0x3d3e28);}(_0xfbb2,0xae));var _0x2fbb=function(_0x560b56,_0x2004b9){_0x560b56=_0x560b56-0x0;var _0x173c4e=_0xfbb2[_0x560b56];return _0x173c4e;};'use strict';var _=require(_0x2fbb('0x0'));var util=require(_0x2fbb('0x1'));var moment=require(_0x2fbb('0x2'));var BPromise=require(_0x2fbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fbb('0x4'));var db=require(_0x2fbb('0x5'))['db'];var utils=require(_0x2fbb('0x6'));var logger=require(_0x2fbb('0x7'))(_0x2fbb('0x8'));var config=require(_0x2fbb('0x9'));var jayson=require(_0x2fbb('0xa'));var client=jayson['client'][_0x2fbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x170c70,_0x27a40d,_0x5db376){return new BPromise(function(_0x4220be,_0x2b8842){return client[_0x2fbb('0xc')](_0x170c70,_0x5db376)[_0x2fbb('0xd')](function(_0x2e4a06){logger['info']('VoiceContext,\x20%s,\x20%s',_0x27a40d,'request\x20sent');logger['debug'](_0x2fbb('0xe'),_0x27a40d,_0x2fbb('0xf'),JSON[_0x2fbb('0x10')](_0x2e4a06));if(_0x2e4a06['error']){if(_0x2e4a06[_0x2fbb('0x11')]['code']===0x1f4){logger[_0x2fbb('0x11')](_0x2fbb('0x12'),_0x27a40d,_0x2e4a06[_0x2fbb('0x11')][_0x2fbb('0x13')]);return _0x2b8842(_0x2e4a06[_0x2fbb('0x11')]['message']);}logger[_0x2fbb('0x11')](_0x2fbb('0x12'),_0x27a40d,_0x2e4a06['error'][_0x2fbb('0x13')]);return _0x4220be(_0x2e4a06['error'][_0x2fbb('0x13')]);}else{logger[_0x2fbb('0x14')](_0x2fbb('0x12'),_0x27a40d,'request\x20sent');_0x4220be(_0x2e4a06[_0x2fbb('0x15')][_0x2fbb('0x13')]);}})[_0x2fbb('0x16')](function(_0x3ea671){logger[_0x2fbb('0x11')](_0x2fbb('0x12'),_0x27a40d,_0x3ea671);_0x2b8842(_0x3ea671);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3e43a58..6c77386 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 _0x7a77=['index','/describe','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7a77,0x1c3));var _0x77a7=function(_0x5a5a67,_0x1a6758){_0x5a5a67=_0x5a5a67-0x0;var _0x2040f0=_0x7a77[_0x5a5a67];return _0x2040f0;};'use strict';var multer=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var path=require(_0x77a7('0x2'));var timeout=require(_0x77a7('0x3'));var express=require('express');var router=express[_0x77a7('0x4')]();var fs_extra=require(_0x77a7('0x5'));var auth=require(_0x77a7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x77a7('0x7'));var controller=require(_0x77a7('0x8'));router[_0x77a7('0x9')]('/',auth[_0x77a7('0xa')](),controller[_0x77a7('0xb')]);router[_0x77a7('0x9')](_0x77a7('0xc'),auth[_0x77a7('0xa')](),controller[_0x77a7('0xd')]);router[_0x77a7('0x9')]('/:id',auth[_0x77a7('0xa')](),controller[_0x77a7('0xe')]);router[_0x77a7('0xf')]('/',auth['isAuthenticated'](),controller[_0x77a7('0x10')]);router['put'](_0x77a7('0x11'),auth[_0x77a7('0xa')](),controller['update']);router[_0x77a7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x77a7('0x13')]);module[_0x77a7('0x14')]=router; \ No newline at end of file +var _0xd450=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd450,0x157));var _0x0d45=function(_0x1af067,_0x518a65){_0x1af067=_0x1af067-0x0;var _0x5379a2=_0xd450[_0x1af067];return _0x5379a2;};'use strict';var multer=require(_0x0d45('0x0'));var util=require(_0x0d45('0x1'));var path=require(_0x0d45('0x2'));var timeout=require(_0x0d45('0x3'));var express=require(_0x0d45('0x4'));var router=express[_0x0d45('0x5')]();var fs_extra=require(_0x0d45('0x6'));var auth=require(_0x0d45('0x7'));var interaction=require(_0x0d45('0x8'));var config=require(_0x0d45('0x9'));var controller=require('./voiceDialReport.controller');router[_0x0d45('0xa')]('/',auth[_0x0d45('0xb')](),controller[_0x0d45('0xc')]);router[_0x0d45('0xa')](_0x0d45('0xd'),auth['isAuthenticated'](),controller[_0x0d45('0xe')]);router['get'](_0x0d45('0xf'),auth[_0x0d45('0xb')](),controller[_0x0d45('0x10')]);router[_0x0d45('0x11')]('/',auth[_0x0d45('0xb')](),controller['create']);router[_0x0d45('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0d45('0x13')]);router[_0x0d45('0x14')](_0x0d45('0xf'),auth[_0x0d45('0xb')](),controller['destroy']);module[_0x0d45('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0a0772d..14788a8 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 _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x37b30c,_0x42c4ed){var _0x31e57d=function(_0x58b133){while(--_0x58b133){_0x37b30c['push'](_0x37b30c['shift']());}};_0x31e57d(++_0x42c4ed);}(_0x55ca,0x126));var _0xa55c=function(_0x4a8072,_0x435bab){_0x4a8072=_0x4a8072-0x0;var _0x11a4fe=_0x55ca[_0x4a8072];return _0x11a4fe;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x309566,_0x5718f3){var _0x4ad5a8=function(_0x28b074){while(--_0x28b074){_0x309566['push'](_0x309566['shift']());}};_0x4ad5a8(++_0x5718f3);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2f89c0,_0x5965af){_0x2f89c0=_0x2f89c0-0x0;var _0x4c5cd6=_0x6f0d[_0x2f89c0];return _0x4c5cd6;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 15c4567..294dcc7 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 _0x0412=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','VoiceDialReport','rawAttributes','fieldName','model','map','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','rows','catch','show','find','create','body','params','describe'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0412,0x168));var _0x2041=function(_0x112522,_0x86cb6f){_0x112522=_0x112522-0x0;var _0x57b1d9=_0x0412[_0x112522];return _0x57b1d9;};'use strict';var emlformat=require(_0x2041('0x0'));var rimraf=require(_0x2041('0x1'));var zipdir=require(_0x2041('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2041('0x3'));var moment=require(_0x2041('0x4'));var BPromise=require(_0x2041('0x5'));var Mustache=require(_0x2041('0x6'));var util=require('util');var path=require(_0x2041('0x7'));var sox=require(_0x2041('0x8'));var csv=require(_0x2041('0x9'));var ejs=require(_0x2041('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2041('0xb'));var squel=require('squel');var crypto=require(_0x2041('0xc'));var jsforce=require(_0x2041('0xd'));var deskjs=require(_0x2041('0xe'));var toCsv=require(_0x2041('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2041('0xf'));var authService=require(_0x2041('0x10'));var qs=require(_0x2041('0x11'));var as=require(_0x2041('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2041('0x13'));var utils=require(_0x2041('0x14'));var config=require(_0x2041('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2041('0x16'))['db'];function respondWithStatusCode(_0x5b5f5f,_0x18f51b){_0x18f51b=_0x18f51b||0xcc;return function(_0x13fb54){if(_0x13fb54){return _0x5b5f5f[_0x2041('0x17')](_0x18f51b);}return _0x5b5f5f[_0x2041('0x18')](_0x18f51b)[_0x2041('0x19')]();};}function respondWithResult(_0x3bf76f,_0x2de901){_0x2de901=_0x2de901||0xc8;return function(_0x50bd49){if(_0x50bd49){return _0x3bf76f[_0x2041('0x18')](_0x2de901)['json'](_0x50bd49);}};}function respondWithFilteredResult(_0x2d5da9,_0x218522){return function(_0x1a94c6){if(_0x1a94c6){var _0x1823e1=typeof _0x218522[_0x2041('0x1a')]===_0x2041('0x1b')&&typeof _0x218522[_0x2041('0x1c')]===_0x2041('0x1b');var _0x1e68f9=_0x1a94c6[_0x2041('0x1d')];var _0x37870=_0x1823e1?0x0:_0x218522[_0x2041('0x1a')];var _0x24fb92=_0x1823e1?_0x1a94c6[_0x2041('0x1d')]:_0x218522[_0x2041('0x1a')]+_0x218522[_0x2041('0x1c')];var _0xfef31f;if(_0x24fb92>=_0x1e68f9){_0x24fb92=_0x1e68f9;_0xfef31f=0xc8;}else{_0xfef31f=0xce;}_0x2d5da9[_0x2041('0x18')](_0xfef31f);return _0x2d5da9[_0x2041('0x1e')](_0x2041('0x1f'),_0x37870+'-'+_0x24fb92+'/'+_0x1e68f9)['json'](_0x1a94c6);}return null;};}function patchUpdates(_0x3f7efe){return function(_0x17c9a5){try{jsonpatch[_0x2041('0x20')](_0x17c9a5,_0x3f7efe,!![]);}catch(_0x2b9242){return BPromise[_0x2041('0x21')](_0x2b9242);}return _0x17c9a5[_0x2041('0x22')]();};}function saveUpdates(_0x143a8d,_0x55da6d){return function(_0x2aa87e){if(_0x2aa87e){return _0x2aa87e[_0x2041('0x23')](_0x143a8d)['then'](function(_0x1d8164){return _0x1d8164;});}return null;};}function removeEntity(_0x3e3c77,_0x4894bf){return function(_0x1a149f){if(_0x1a149f){return _0x1a149f[_0x2041('0x24')]()['then'](function(){_0x3e3c77['status'](0xcc)[_0x2041('0x19')]();});}};}function handleEntityNotFound(_0x57fcc0,_0x1b1630){return function(_0xeafb8b){if(!_0xeafb8b){_0x57fcc0[_0x2041('0x17')](0x194);}return _0xeafb8b;};}function handleError(_0x45aca0,_0x4a09de){_0x4a09de=_0x4a09de||0x1f4;return function(_0x54d644){logger[_0x2041('0x25')](_0x54d644[_0x2041('0x26')]);if(_0x54d644['name']){delete _0x54d644['name'];}_0x45aca0[_0x2041('0x18')](_0x4a09de)[_0x2041('0x27')](_0x54d644);};}exports['index']=function(_0x1f3658,_0x1d1247){var _0x1c03b7={},_0x19f9dd={},_0x30c99b={'count':0x0,'rows':[]};var _0x44e973=_['map'](db[_0x2041('0x28')][_0x2041('0x29')],function(_0x52c850){return{'name':_0x52c850[_0x2041('0x2a')],'type':_0x52c850['type']['key']};});_0x19f9dd[_0x2041('0x2b')]=_[_0x2041('0x2c')](_0x44e973,_0x2041('0x2d'));_0x19f9dd['query']=_[_0x2041('0x2e')](_0x1f3658[_0x2041('0x2f')]);_0x19f9dd[_0x2041('0x30')]=_[_0x2041('0x31')](_0x19f9dd['model'],_0x19f9dd['query']);_0x1c03b7['attributes']=_[_0x2041('0x31')](_0x19f9dd['model'],qs[_0x2041('0x32')](_0x1f3658[_0x2041('0x2f')][_0x2041('0x32')]));_0x1c03b7[_0x2041('0x33')]=_0x1c03b7['attributes']['length']?_0x1c03b7['attributes']:_0x19f9dd[_0x2041('0x2b')];if(!_0x1f3658[_0x2041('0x2f')][_0x2041('0x34')]('nolimit')){_0x1c03b7[_0x2041('0x1c')]=qs[_0x2041('0x1c')](_0x1f3658[_0x2041('0x2f')]['limit']);_0x1c03b7[_0x2041('0x1a')]=qs[_0x2041('0x1a')](_0x1f3658['query'][_0x2041('0x1a')]);}_0x1c03b7[_0x2041('0x35')]=qs[_0x2041('0x36')](_0x1f3658[_0x2041('0x2f')][_0x2041('0x36')]);_0x1c03b7[_0x2041('0x37')]=qs[_0x2041('0x30')](_[_0x2041('0x38')](_0x1f3658[_0x2041('0x2f')],_0x19f9dd[_0x2041('0x30')]),_0x44e973);if(_0x1f3658['query'][_0x2041('0x39')]){_0x1c03b7[_0x2041('0x37')]=_['merge'](_0x1c03b7[_0x2041('0x37')],{'$or':_[_0x2041('0x2c')](_0x44e973,function(_0x50b943){if(_0x50b943['type']!==_0x2041('0x3a')){var _0x459cca={};_0x459cca[_0x50b943[_0x2041('0x2d')]]={'$like':'%'+_0x1f3658['query'][_0x2041('0x39')]+'%'};return _0x459cca;}})});}_0x1c03b7=_[_0x2041('0x3b')]({},_0x1c03b7,_0x1f3658[_0x2041('0x3c')]);var _0x6b82b1={'where':_0x1c03b7['where']};return db['VoiceDialReport'][_0x2041('0x1d')](_0x6b82b1)[_0x2041('0x3d')](function(_0x52a0b4){_0x30c99b['count']=_0x52a0b4;if(_0x1f3658[_0x2041('0x2f')][_0x2041('0x3e')]){_0x1c03b7[_0x2041('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x1c03b7);})[_0x2041('0x3d')](function(_0x11ac8b){_0x30c99b[_0x2041('0x40')]=_0x11ac8b;return _0x30c99b;})['then'](respondWithFilteredResult(_0x1d1247,_0x1c03b7))[_0x2041('0x41')](handleError(_0x1d1247,null));};exports[_0x2041('0x42')]=function(_0x4dd5b2,_0x55e3e7){var _0x3d9317={'raw':!![],'where':{'id':_0x4dd5b2['params']['id']}},_0x337d68={};_0x337d68[_0x2041('0x2b')]=_['keys'](db[_0x2041('0x28')][_0x2041('0x29')]);_0x337d68[_0x2041('0x2f')]=_['keys'](_0x4dd5b2[_0x2041('0x2f')]);_0x337d68[_0x2041('0x30')]=_['intersection'](_0x337d68[_0x2041('0x2b')],_0x337d68[_0x2041('0x2f')]);_0x3d9317['attributes']=_[_0x2041('0x31')](_0x337d68[_0x2041('0x2b')],qs[_0x2041('0x32')](_0x4dd5b2[_0x2041('0x2f')]['fields']));_0x3d9317[_0x2041('0x33')]=_0x3d9317['attributes']['length']?_0x3d9317['attributes']:_0x337d68[_0x2041('0x2b')];if(_0x4dd5b2[_0x2041('0x2f')]['includeAll']){_0x3d9317[_0x2041('0x3f')]=[{'all':!![]}];}_0x3d9317=_['merge']({},_0x3d9317,_0x4dd5b2[_0x2041('0x3c')]);return db['VoiceDialReport'][_0x2041('0x43')](_0x3d9317)[_0x2041('0x3d')](handleEntityNotFound(_0x55e3e7,null))[_0x2041('0x3d')](respondWithResult(_0x55e3e7,null))['catch'](handleError(_0x55e3e7,null));};exports['create']=function(_0x153745,_0x59440e){return db[_0x2041('0x28')][_0x2041('0x44')](_0x153745[_0x2041('0x45')],{})[_0x2041('0x3d')](respondWithResult(_0x59440e,0xc9))[_0x2041('0x41')](handleError(_0x59440e,null));};exports[_0x2041('0x23')]=function(_0x28615e,_0x3a2e2e){if(_0x28615e[_0x2041('0x45')]['id']){delete _0x28615e['body']['id'];}return db['VoiceDialReport'][_0x2041('0x43')]({'where':{'id':_0x28615e[_0x2041('0x46')]['id']}})[_0x2041('0x3d')](handleEntityNotFound(_0x3a2e2e,null))[_0x2041('0x3d')](saveUpdates(_0x28615e['body'],null))['then'](respondWithResult(_0x3a2e2e,null))[_0x2041('0x41')](handleError(_0x3a2e2e,null));};exports['destroy']=function(_0x46236b,_0x56eafc){return db['VoiceDialReport'][_0x2041('0x43')]({'where':{'id':_0x46236b[_0x2041('0x46')]['id']}})[_0x2041('0x3d')](handleEntityNotFound(_0x56eafc,null))[_0x2041('0x3d')](removeEntity(_0x56eafc,null))[_0x2041('0x41')](handleError(_0x56eafc,null));};exports[_0x2041('0x47')]=function(_0x2963b5,_0x40fb87){return db[_0x2041('0x28')][_0x2041('0x47')]()[_0x2041('0x3d')](respondWithResult(_0x40fb87,null))[_0x2041('0x41')](handleError(_0x40fb87,null));}; \ No newline at end of file +var _0x582c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','Content-Range','reject','save','destroy','error','stack','name','index','map','VoiceDialReport','fieldName','type','filters','intersection','model','query','attributes','fields','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x349a6a,_0x291b2a){var _0x3f6577=function(_0x384071){while(--_0x384071){_0x349a6a['push'](_0x349a6a['shift']());}};_0x3f6577(++_0x291b2a);}(_0x582c,0xcf));var _0xc582=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0x582c[_0x27a3cb];return _0x54ff38;};'use strict';var emlformat=require(_0xc582('0x0'));var rimraf=require(_0xc582('0x1'));var zipdir=require(_0xc582('0x2'));var jsonpatch=require(_0xc582('0x3'));var rp=require('request-promise');var moment=require(_0xc582('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc582('0x5'));var sox=require('sox');var csv=require(_0xc582('0x6'));var ejs=require(_0xc582('0x7'));var fs=require('fs');var fs_extra=require(_0xc582('0x8'));var _=require(_0xc582('0x9'));var squel=require(_0xc582('0xa'));var crypto=require(_0xc582('0xb'));var jsforce=require(_0xc582('0xc'));var deskjs=require(_0xc582('0xd'));var toCsv=require(_0xc582('0x6'));var querystring=require('querystring');var Papa=require(_0xc582('0xe'));var Redis=require(_0xc582('0xf'));var authService=require(_0xc582('0x10'));var qs=require(_0xc582('0x11'));var as=require(_0xc582('0x12'));var hardwareService=require(_0xc582('0x13'));var logger=require(_0xc582('0x14'))(_0xc582('0x15'));var utils=require(_0xc582('0x16'));var config=require(_0xc582('0x17'));var licenseUtil=require(_0xc582('0x18'));var db=require(_0xc582('0x19'))['db'];function respondWithStatusCode(_0x3f1370,_0x5ca978){_0x5ca978=_0x5ca978||0xcc;return function(_0x539b0f){if(_0x539b0f){return _0x3f1370[_0xc582('0x1a')](_0x5ca978);}return _0x3f1370[_0xc582('0x1b')](_0x5ca978)['end']();};}function respondWithResult(_0x1cb9e2,_0x443c16){_0x443c16=_0x443c16||0xc8;return function(_0x1a5c81){if(_0x1a5c81){return _0x1cb9e2[_0xc582('0x1b')](_0x443c16)[_0xc582('0x1c')](_0x1a5c81);}};}function respondWithFilteredResult(_0x4039ab,_0x41478d){return function(_0x3cbda8){if(_0x3cbda8){var _0x1a7f9c=typeof _0x41478d['offset']==='undefined'&&typeof _0x41478d['limit']===_0xc582('0x1d');var _0x240b52=_0x3cbda8['count'];var _0x3ed801=_0x1a7f9c?0x0:_0x41478d[_0xc582('0x1e')];var _0x5f09f8=_0x1a7f9c?_0x3cbda8[_0xc582('0x1f')]:_0x41478d[_0xc582('0x1e')]+_0x41478d['limit'];var _0x2234ce;if(_0x5f09f8>=_0x240b52){_0x5f09f8=_0x240b52;_0x2234ce=0xc8;}else{_0x2234ce=0xce;}_0x4039ab[_0xc582('0x1b')](_0x2234ce);return _0x4039ab[_0xc582('0x20')](_0xc582('0x21'),_0x3ed801+'-'+_0x5f09f8+'/'+_0x240b52)[_0xc582('0x1c')](_0x3cbda8);}return null;};}function patchUpdates(_0xe75c69){return function(_0x22cea3){try{jsonpatch['apply'](_0x22cea3,_0xe75c69,!![]);}catch(_0x4f6bf2){return BPromise[_0xc582('0x22')](_0x4f6bf2);}return _0x22cea3[_0xc582('0x23')]();};}function saveUpdates(_0x1ef72d,_0x33b759){return function(_0x51cd0e){if(_0x51cd0e){return _0x51cd0e['update'](_0x1ef72d)['then'](function(_0x4b50f7){return _0x4b50f7;});}return null;};}function removeEntity(_0xf20a85,_0x4d4358){return function(_0x34fbc0){if(_0x34fbc0){return _0x34fbc0[_0xc582('0x24')]()['then'](function(){_0xf20a85[_0xc582('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2826,_0x817c84){return function(_0x27b6b7){if(!_0x27b6b7){_0x3a2826[_0xc582('0x1a')](0x194);}return _0x27b6b7;};}function handleError(_0x4f0687,_0x13ab6e){_0x13ab6e=_0x13ab6e||0x1f4;return function(_0x3ef6e3){logger[_0xc582('0x25')](_0x3ef6e3[_0xc582('0x26')]);if(_0x3ef6e3[_0xc582('0x27')]){delete _0x3ef6e3[_0xc582('0x27')];}_0x4f0687[_0xc582('0x1b')](_0x13ab6e)['send'](_0x3ef6e3);};}exports[_0xc582('0x28')]=function(_0xeb6101,_0x2695dc){var _0x2aeea0={},_0x45a7bc={},_0x22fc85={'count':0x0,'rows':[]};var _0x395c64=_[_0xc582('0x29')](db[_0xc582('0x2a')]['rawAttributes'],function(_0x3a2a39){return{'name':_0x3a2a39[_0xc582('0x2b')],'type':_0x3a2a39[_0xc582('0x2c')]['key']};});_0x45a7bc['model']=_['map'](_0x395c64,_0xc582('0x27'));_0x45a7bc['query']=_['keys'](_0xeb6101['query']);_0x45a7bc[_0xc582('0x2d')]=_[_0xc582('0x2e')](_0x45a7bc[_0xc582('0x2f')],_0x45a7bc[_0xc582('0x30')]);_0x2aeea0[_0xc582('0x31')]=_['intersection'](_0x45a7bc[_0xc582('0x2f')],qs[_0xc582('0x32')](_0xeb6101[_0xc582('0x30')][_0xc582('0x32')]));_0x2aeea0[_0xc582('0x31')]=_0x2aeea0[_0xc582('0x31')]['length']?_0x2aeea0[_0xc582('0x31')]:_0x45a7bc['model'];if(!_0xeb6101['query']['hasOwnProperty']('nolimit')){_0x2aeea0[_0xc582('0x33')]=qs[_0xc582('0x33')](_0xeb6101[_0xc582('0x30')][_0xc582('0x33')]);_0x2aeea0[_0xc582('0x1e')]=qs['offset'](_0xeb6101['query']['offset']);}_0x2aeea0[_0xc582('0x34')]=qs['sort'](_0xeb6101['query'][_0xc582('0x35')]);_0x2aeea0[_0xc582('0x36')]=qs[_0xc582('0x2d')](_[_0xc582('0x37')](_0xeb6101[_0xc582('0x30')],_0x45a7bc[_0xc582('0x2d')]),_0x395c64);if(_0xeb6101[_0xc582('0x30')][_0xc582('0x38')]){_0x2aeea0[_0xc582('0x36')]=_[_0xc582('0x39')](_0x2aeea0[_0xc582('0x36')],{'$or':_[_0xc582('0x29')](_0x395c64,function(_0x480bd9){if(_0x480bd9[_0xc582('0x2c')]!==_0xc582('0x3a')){var _0x37b91f={};_0x37b91f[_0x480bd9[_0xc582('0x27')]]={'$like':'%'+_0xeb6101[_0xc582('0x30')]['filter']+'%'};return _0x37b91f;}})});}_0x2aeea0=_['merge']({},_0x2aeea0,_0xeb6101[_0xc582('0x3b')]);var _0x47c09f={'where':_0x2aeea0[_0xc582('0x36')]};return db[_0xc582('0x2a')][_0xc582('0x1f')](_0x47c09f)[_0xc582('0x3c')](function(_0x236918){_0x22fc85[_0xc582('0x1f')]=_0x236918;if(_0xeb6101[_0xc582('0x30')][_0xc582('0x3d')]){_0x2aeea0[_0xc582('0x3e')]=[{'all':!![]}];}return db[_0xc582('0x2a')]['findAll'](_0x2aeea0);})[_0xc582('0x3c')](function(_0x186a8f){_0x22fc85[_0xc582('0x3f')]=_0x186a8f;return _0x22fc85;})['then'](respondWithFilteredResult(_0x2695dc,_0x2aeea0))[_0xc582('0x40')](handleError(_0x2695dc,null));};exports[_0xc582('0x41')]=function(_0x40f5b8,_0x189be2){var _0x26710e={'raw':!![],'where':{'id':_0x40f5b8[_0xc582('0x42')]['id']}},_0x5b524b={};_0x5b524b[_0xc582('0x2f')]=_['keys'](db[_0xc582('0x2a')][_0xc582('0x43')]);_0x5b524b['query']=_['keys'](_0x40f5b8[_0xc582('0x30')]);_0x5b524b[_0xc582('0x2d')]=_[_0xc582('0x2e')](_0x5b524b[_0xc582('0x2f')],_0x5b524b[_0xc582('0x30')]);_0x26710e['attributes']=_[_0xc582('0x2e')](_0x5b524b['model'],qs['fields'](_0x40f5b8[_0xc582('0x30')][_0xc582('0x32')]));_0x26710e[_0xc582('0x31')]=_0x26710e[_0xc582('0x31')][_0xc582('0x44')]?_0x26710e[_0xc582('0x31')]:_0x5b524b['model'];if(_0x40f5b8[_0xc582('0x30')]['includeAll']){_0x26710e[_0xc582('0x3e')]=[{'all':!![]}];}_0x26710e=_[_0xc582('0x39')]({},_0x26710e,_0x40f5b8[_0xc582('0x3b')]);return db[_0xc582('0x2a')][_0xc582('0x45')](_0x26710e)[_0xc582('0x3c')](handleEntityNotFound(_0x189be2,null))[_0xc582('0x3c')](respondWithResult(_0x189be2,null))[_0xc582('0x40')](handleError(_0x189be2,null));};exports[_0xc582('0x46')]=function(_0x2b7631,_0xa1ee14){return db[_0xc582('0x2a')][_0xc582('0x46')](_0x2b7631['body'],{})[_0xc582('0x3c')](respondWithResult(_0xa1ee14,0xc9))['catch'](handleError(_0xa1ee14,null));};exports[_0xc582('0x47')]=function(_0x308b6b,_0x506298){if(_0x308b6b['body']['id']){delete _0x308b6b[_0xc582('0x48')]['id'];}return db[_0xc582('0x2a')][_0xc582('0x45')]({'where':{'id':_0x308b6b[_0xc582('0x42')]['id']}})[_0xc582('0x3c')](handleEntityNotFound(_0x506298,null))[_0xc582('0x3c')](saveUpdates(_0x308b6b[_0xc582('0x48')],null))[_0xc582('0x3c')](respondWithResult(_0x506298,null))[_0xc582('0x40')](handleError(_0x506298,null));};exports[_0xc582('0x24')]=function(_0x588243,_0x3302bd){return db[_0xc582('0x2a')]['find']({'where':{'id':_0x588243[_0xc582('0x42')]['id']}})[_0xc582('0x3c')](handleEntityNotFound(_0x3302bd,null))[_0xc582('0x3c')](removeEntity(_0x3302bd,null))[_0xc582('0x40')](handleError(_0x3302bd,null));};exports['describe']=function(_0x54051d,_0x7f094c){return db[_0xc582('0x2a')][_0xc582('0x49')]()[_0xc582('0x3c')](respondWithResult(_0x7f094c,null))[_0xc582('0x40')](handleError(_0x7f094c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ed708e4..9fbd7f8 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 _0x30ff=['report_dial','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x5ca899,_0x3185f4){var _0x5284c4=function(_0x2ef083){while(--_0x2ef083){_0x5ca899['push'](_0x5ca899['shift']());}};_0x5284c4(++_0x3185f4);}(_0x30ff,0x6a));var _0xf30f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x30ff[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xf30f('0x0'));var logger=require(_0xf30f('0x1'))(_0xf30f('0x2'));var moment=require(_0xf30f('0x3'));var BPromise=require(_0xf30f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf30f('0x5'));var rimraf=require(_0xf30f('0x6'));var config=require('../../config/environment');var attributes=require(_0xf30f('0x7'));module[_0xf30f('0x8')]=function(_0x1884e6,_0x4eeee8){return _0x1884e6[_0xf30f('0x9')](_0xf30f('0xa'),attributes,{'tableName':_0xf30f('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf30f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4703=['api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger'];(function(_0x2d2b18,_0x2bf8b0){var _0x5c71eb=function(_0x9a3a2b){while(--_0x9a3a2b){_0x2d2b18['push'](_0x2d2b18['shift']());}};_0x5c71eb(++_0x2bf8b0);}(_0x4703,0xda));var _0x3470=function(_0x207267,_0x50618f){_0x207267=_0x207267-0x0;var _0x4c7d02=_0x4703[_0x207267];return _0x4c7d02;};'use strict';var _=require(_0x3470('0x0'));var util=require(_0x3470('0x1'));var logger=require(_0x3470('0x2'))(_0x3470('0x3'));var moment=require(_0x3470('0x4'));var BPromise=require(_0x3470('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3470('0x6'));var config=require(_0x3470('0x7'));var attributes=require(_0x3470('0x8'));module[_0x3470('0x9')]=function(_0x184fac,_0x55a269){return _0x184fac[_0x3470('0xa')](_0x3470('0xb'),attributes,{'tableName':_0x3470('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8f03025..6dd94e0 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 _0x21c5=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceDialReport','body','options','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','raw','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x21c5,0x1ce));var _0x521c=function(_0x20194a,_0x16d2ce){_0x20194a=_0x20194a-0x0;var _0x5174bd=_0x21c5[_0x20194a];return _0x5174bd;};'use strict';var _=require(_0x521c('0x0'));var util=require(_0x521c('0x1'));var moment=require('moment');var BPromise=require(_0x521c('0x2'));var rs=require(_0x521c('0x3'));var fs=require('fs');var Redis=require(_0x521c('0x4'));var db=require(_0x521c('0x5'))['db'];var utils=require(_0x521c('0x6'));var logger=require(_0x521c('0x7'))(_0x521c('0x8'));var config=require(_0x521c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x521c('0xa')][_0x521c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fcc5,_0x4435f5,_0xfab4df){return new BPromise(function(_0x1dac25,_0x3f90f0){return client[_0x521c('0xc')](_0x49fcc5,_0xfab4df)[_0x521c('0xd')](function(_0x5a15c7){logger[_0x521c('0xe')](_0x521c('0xf'),_0x4435f5,_0x521c('0x10'));logger[_0x521c('0x11')](_0x521c('0x12'),_0x4435f5,'request\x20sent',JSON[_0x521c('0x13')](_0x5a15c7));if(_0x5a15c7['error']){if(_0x5a15c7[_0x521c('0x14')][_0x521c('0x15')]===0x1f4){logger[_0x521c('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x4435f5,_0x5a15c7[_0x521c('0x14')][_0x521c('0x16')]);return _0x3f90f0(_0x5a15c7[_0x521c('0x14')][_0x521c('0x16')]);}logger[_0x521c('0x14')](_0x521c('0xf'),_0x4435f5,_0x5a15c7[_0x521c('0x14')][_0x521c('0x16')]);return _0x1dac25(_0x5a15c7['error'][_0x521c('0x16')]);}else{logger[_0x521c('0xe')](_0x521c('0xf'),_0x4435f5,_0x521c('0x10'));_0x1dac25(_0x5a15c7[_0x521c('0x17')][_0x521c('0x16')]);}})['catch'](function(_0x834a44){logger[_0x521c('0x14')](_0x521c('0xf'),_0x4435f5,_0x834a44);_0x3f90f0(_0x834a44);});});}exports['CreateVoiceDialReport']=function(_0x7f9dda){var _0x4a4fbf=this;return new Promise(function(_0x4e8f87,_0x327e96){return db[_0x521c('0x18')]['create'](_0x7f9dda[_0x521c('0x19')],{'raw':_0x7f9dda['options']?_0x7f9dda[_0x521c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x35790e){logger[_0x521c('0xe')](_0x521c('0x1b'),_0x7f9dda);logger[_0x521c('0x11')](_0x521c('0x1b'),_0x7f9dda,JSON[_0x521c('0x13')](_0x35790e));_0x4e8f87(_0x35790e);})[_0x521c('0x1c')](function(_0x5eefff){logger[_0x521c('0x14')](_0x521c('0x1b'),_0x5eefff['message'],_0x7f9dda);_0x327e96(_0x4a4fbf[_0x521c('0x14')](0x1f4,_0x5eefff['message']));});});};exports[_0x521c('0x1d')]=function(_0x519b92){var _0x17b84c=this;return new Promise(function(_0x5ca118,_0x2bd2c5){return db[_0x521c('0x18')][_0x521c('0x1e')](_0x519b92[_0x521c('0x19')],{'raw':_0x519b92[_0x521c('0x1a')]?_0x519b92['options'][_0x521c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x519b92['options']?_0x519b92[_0x521c('0x1a')][_0x521c('0x20')]||null:null,'attributes':_0x519b92[_0x521c('0x1a')]?_0x519b92[_0x521c('0x1a')]['attributes']||null:null,'limit':_0x519b92[_0x521c('0x1a')]?_0x519b92['options'][_0x521c('0x21')]||null:null})['then'](function(_0xf2cfc3){logger['info'](_0x521c('0x1d'),_0x519b92);logger[_0x521c('0x11')](_0x521c('0x1d'),_0x519b92,JSON['stringify'](_0xf2cfc3));_0x5ca118(_0xf2cfc3);})[_0x521c('0x1c')](function(_0x2fa02f){logger[_0x521c('0x14')](_0x521c('0x1d'),_0x2fa02f[_0x521c('0x16')],_0x519b92);_0x2bd2c5(_0x17b84c[_0x521c('0x14')](0x1f4,_0x2fa02f[_0x521c('0x16')]));});});}; \ No newline at end of file +var _0x53a2=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','debug','catch','UpdateVoiceDialReport','raw','where','limit'];(function(_0x31aa84,_0x3bcc8b){var _0x2d9e3e=function(_0x4783da){while(--_0x4783da){_0x31aa84['push'](_0x31aa84['shift']());}};_0x2d9e3e(++_0x3bcc8b);}(_0x53a2,0x176));var _0x253a=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x53a2[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x253a('0x0'));var util=require(_0x253a('0x1'));var moment=require('moment');var BPromise=require(_0x253a('0x2'));var rs=require(_0x253a('0x3'));var fs=require('fs');var Redis=require(_0x253a('0x4'));var db=require(_0x253a('0x5'))['db'];var utils=require(_0x253a('0x6'));var logger=require(_0x253a('0x7'))(_0x253a('0x8'));var config=require(_0x253a('0x9'));var jayson=require(_0x253a('0xa'));var client=jayson['client'][_0x253a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x532d1d,_0x52c1aa,_0x570bd0){return new BPromise(function(_0x6e0333,_0x54855d){return client[_0x253a('0xc')](_0x532d1d,_0x570bd0)[_0x253a('0xd')](function(_0xb4a04d){logger[_0x253a('0xe')](_0x253a('0xf'),_0x52c1aa,_0x253a('0x10'));logger['debug'](_0x253a('0x11'),_0x52c1aa,_0x253a('0x10'),JSON[_0x253a('0x12')](_0xb4a04d));if(_0xb4a04d[_0x253a('0x13')]){if(_0xb4a04d[_0x253a('0x13')][_0x253a('0x14')]===0x1f4){logger[_0x253a('0x13')](_0x253a('0xf'),_0x52c1aa,_0xb4a04d[_0x253a('0x13')][_0x253a('0x15')]);return _0x54855d(_0xb4a04d[_0x253a('0x13')][_0x253a('0x15')]);}logger[_0x253a('0x13')](_0x253a('0xf'),_0x52c1aa,_0xb4a04d['error'][_0x253a('0x15')]);return _0x6e0333(_0xb4a04d[_0x253a('0x13')][_0x253a('0x15')]);}else{logger[_0x253a('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x52c1aa,_0x253a('0x10'));_0x6e0333(_0xb4a04d[_0x253a('0x16')][_0x253a('0x15')]);}})['catch'](function(_0x668783){logger[_0x253a('0x13')](_0x253a('0xf'),_0x52c1aa,_0x668783);_0x54855d(_0x668783);});});}exports[_0x253a('0x17')]=function(_0x5aa533){var _0x3bf511=this;return new Promise(function(_0x27f812,_0x501a2e){return db[_0x253a('0x18')][_0x253a('0x19')](_0x5aa533[_0x253a('0x1a')],{'raw':_0x5aa533['options']?_0x5aa533[_0x253a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x253a('0xd')](function(_0x30426){logger[_0x253a('0xe')](_0x253a('0x17'),_0x5aa533);logger[_0x253a('0x1c')](_0x253a('0x17'),_0x5aa533,JSON['stringify'](_0x30426));_0x27f812(_0x30426);})[_0x253a('0x1d')](function(_0x5d01b1){logger[_0x253a('0x13')]('CreateVoiceDialReport',_0x5d01b1[_0x253a('0x15')],_0x5aa533);_0x501a2e(_0x3bf511[_0x253a('0x13')](0x1f4,_0x5d01b1[_0x253a('0x15')]));});});};exports[_0x253a('0x1e')]=function(_0x278c8a){var _0x5c5b01=this;return new Promise(function(_0x36111d,_0x2ed8a2){return db[_0x253a('0x18')]['update'](_0x278c8a[_0x253a('0x1a')],{'raw':_0x278c8a[_0x253a('0x1b')]?_0x278c8a[_0x253a('0x1b')][_0x253a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x278c8a[_0x253a('0x1b')]?_0x278c8a[_0x253a('0x1b')][_0x253a('0x20')]||null:null,'attributes':_0x278c8a['options']?_0x278c8a[_0x253a('0x1b')]['attributes']||null:null,'limit':_0x278c8a[_0x253a('0x1b')]?_0x278c8a['options'][_0x253a('0x21')]||null:null})[_0x253a('0xd')](function(_0x1dbf95){logger[_0x253a('0xe')](_0x253a('0x1e'),_0x278c8a);logger['debug'](_0x253a('0x1e'),_0x278c8a,JSON[_0x253a('0x12')](_0x1dbf95));_0x36111d(_0x1dbf95);})['catch'](function(_0x1565bd){logger[_0x253a('0x13')]('UpdateVoiceDialReport',_0x1565bd[_0x253a('0x15')],_0x278c8a);_0x2ed8a2(_0x5c5b01[_0x253a('0x13')](0x1f4,_0x1565bd[_0x253a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0ca5c49..2df7abc 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 _0xc8ca=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','show','post','create','addApplications','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x56092a,_0x291ce5){var _0x1c9558=function(_0x5bf0c5){while(--_0x5bf0c5){_0x56092a['push'](_0x56092a['shift']());}};_0x1c9558(++_0x291ce5);}(_0xc8ca,0x13d));var _0xac8c=function(_0x532bd3,_0x946a47){_0x532bd3=_0x532bd3-0x0;var _0x17232e=_0xc8ca[_0x532bd3];return _0x17232e;};'use strict';var multer=require(_0xac8c('0x0'));var util=require(_0xac8c('0x1'));var path=require(_0xac8c('0x2'));var timeout=require(_0xac8c('0x3'));var express=require('express');var router=express[_0xac8c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac8c('0x5'));var config=require(_0xac8c('0x6'));var controller=require(_0xac8c('0x7'));router[_0xac8c('0x8')]('/',auth[_0xac8c('0x9')](),controller['index']);router[_0xac8c('0x8')]('/:id',auth[_0xac8c('0x9')](),controller[_0xac8c('0xa')]);router[_0xac8c('0xb')]('/',auth[_0xac8c('0x9')](),controller[_0xac8c('0xc')]);router[_0xac8c('0xb')]('/:id/applications',auth[_0xac8c('0x9')](),controller[_0xac8c('0xd')]);router[_0xac8c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xac8c('0xf')]);router['delete'](_0xac8c('0x10'),auth[_0xac8c('0x9')](),controller[_0xac8c('0x11')]);module[_0xac8c('0x12')]=router; \ No newline at end of file +var _0xba67=['../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','util','path','express','fs-extra','../../components/auth/service'];(function(_0x334704,_0x56cafb){var _0x18257c=function(_0x19490e){while(--_0x19490e){_0x334704['push'](_0x334704['shift']());}};_0x18257c(++_0x56cafb);}(_0xba67,0x13e));var _0x7ba6=function(_0x236dcd,_0x40799f){_0x236dcd=_0x236dcd-0x0;var _0x14646b=_0xba67[_0x236dcd];return _0x14646b;};'use strict';var multer=require('multer');var util=require(_0x7ba6('0x0'));var path=require(_0x7ba6('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ba6('0x2'));var router=express['Router']();var fs_extra=require(_0x7ba6('0x3'));var auth=require(_0x7ba6('0x4'));var interaction=require(_0x7ba6('0x5'));var config=require('../../config/environment');var controller=require(_0x7ba6('0x6'));router[_0x7ba6('0x7')]('/',auth[_0x7ba6('0x8')](),controller[_0x7ba6('0x9')]);router[_0x7ba6('0x7')](_0x7ba6('0xa'),auth[_0x7ba6('0x8')](),controller[_0x7ba6('0xb')]);router[_0x7ba6('0xc')]('/',auth[_0x7ba6('0x8')](),controller[_0x7ba6('0xd')]);router[_0x7ba6('0xc')](_0x7ba6('0xe'),auth[_0x7ba6('0x8')](),controller[_0x7ba6('0xf')]);router[_0x7ba6('0x10')](_0x7ba6('0xa'),auth[_0x7ba6('0x8')](),controller['update']);router[_0x7ba6('0x11')]('/:id',auth[_0x7ba6('0x8')](),controller[_0x7ba6('0x12')]);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 b6119ee..c266f05 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 _0xa43b=['inbound-fax','outbound-fax','system','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal'];(function(_0x494c07,_0x1ac29f){var _0x34606a=function(_0x3363b6){while(--_0x3363b6){_0x494c07['push'](_0x494c07['shift']());}};_0x34606a(++_0x1ac29f);}(_0xa43b,0xf6));var _0xba43=function(_0x4d548a,_0x4f7d6b){_0x4d548a=_0x4d548a-0x0;var _0x142f75=_0xa43b[_0x4d548a];return _0x142f75;};'use strict';var Sequelize=require(_0xba43('0x0'));module[_0xba43('0x1')]={'context':{'type':Sequelize[_0xba43('0x2')],'allowNull':![],'unique':_0xba43('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xba43('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xba43('0x3')},'tag':{'type':Sequelize[_0xba43('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xba43('0x4')},'appdata':{'type':Sequelize[_0xba43('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xba43('0x5')](_0xba43('0x6'),_0xba43('0x7'),_0xba43('0x8'),_0xba43('0x9'),_0xba43('0xa'),_0xba43('0xb'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xba43('0x2')]},'interval':{'type':Sequelize[_0xba43('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xba43('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xba43('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xba43('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xba43('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xba43('0x2')],'defaultValue':_0xba43('0xe')},'answer':{'type':Sequelize[_0xba43('0xd')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4b4b92){return this[_0xba43('0xf')](_0xba43('0x10'));}},'alias':{'type':Sequelize[_0xba43('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb203=['sequelize','exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue'];(function(_0x54bdd1,_0x565d88){var _0x495f90=function(_0x86b09e){while(--_0x86b09e){_0x54bdd1['push'](_0x54bdd1['shift']());}};_0x495f90(++_0x565d88);}(_0xb203,0x1b0));var _0x3b20=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb203[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x3b20('0x0'));module[_0x3b20('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3b20('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![],'unique':_0x3b20('0x2')},'priority':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x3b20('0x2')},'tag':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3b20('0x3')],'allowNull':![],'defaultValue':_0x3b20('0x4')},'appdata':{'type':Sequelize[_0x3b20('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3b20('0x5')](_0x3b20('0x6'),_0x3b20('0x7'),_0x3b20('0x8'),_0x3b20('0x9'),_0x3b20('0xa'),_0x3b20('0xb'),_0x3b20('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x3b20('0x3')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b20('0xd')},'IntervalId':{'type':Sequelize[_0x3b20('0xe')]},'isApp':{'type':Sequelize[_0x3b20('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x3b20('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0x3b20('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x3b20('0x3')],'defaultValue':_0x3b20('0x10')},'answer':{'type':Sequelize[_0x3b20('0xf')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x38ca50){return this[_0x3b20('0x11')]('exten');}},'alias':{'type':Sequelize[_0x3b20('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 e29f345..18084c4 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 _0xefb2=['catch','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','update','pick','context','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','map','value','type','find','name','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xefb2,0x1e1));var _0x2efb=function(_0x40eadc,_0x37af8d){_0x40eadc=_0x40eadc-0x0;var _0x6963b4=_0xefb2[_0x40eadc];return _0x6963b4;};'use strict';var _=require(_0x2efb('0x0'));var Redis=require(_0x2efb('0x1'));var qs=require(_0x2efb('0x2'));var logger=require('../../config/logger')('api');var config=require(_0x2efb('0x3'));var db=require(_0x2efb('0x4'))['db'];config[_0x2efb('0x5')]=_['defaults'](config['redis'],{'host':_0x2efb('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2efb('0x5')]));require(_0x2efb('0x7'))[_0x2efb('0x8')](socket);function respondWithStatusCode(_0x353677,_0x4e1a00){_0x4e1a00=_0x4e1a00||0xcc;return function(_0x113f20){if(_0x113f20){return _0x353677[_0x2efb('0x9')](_0x4e1a00);}return _0x353677[_0x2efb('0xa')](_0x4e1a00)[_0x2efb('0xb')]();};}function respondWithResult(_0x37bb34,_0x2d08f9){_0x2d08f9=_0x2d08f9||0xc8;return function(_0x272d30){if(_0x272d30){return _0x37bb34[_0x2efb('0xa')](_0x2d08f9)[_0x2efb('0xc')](_0x272d30);}};}function respondWithFilteredResult(_0x53b8c1,_0x4cc4fc){return function(_0x8f704){if(_0x8f704){var _0x10409c=typeof _0x4cc4fc[_0x2efb('0xd')]===_0x2efb('0xe')&&typeof _0x4cc4fc[_0x2efb('0xf')]==='undefined';var _0x6a609e=_0x8f704[_0x2efb('0x10')];var _0x5e59d1=_0x10409c?0x0:_0x4cc4fc[_0x2efb('0xd')];var _0x4f52cb=_0x10409c?_0x8f704[_0x2efb('0x10')]:_0x4cc4fc[_0x2efb('0xd')]+_0x4cc4fc[_0x2efb('0xf')];var _0xa8e1f3;if(_0x4f52cb>=_0x6a609e){_0x4f52cb=_0x6a609e;_0xa8e1f3=0xc8;}else{_0xa8e1f3=0xce;}_0x53b8c1[_0x2efb('0xa')](_0xa8e1f3);return _0x53b8c1['set'](_0x2efb('0x11'),_0x5e59d1+'-'+_0x4f52cb+'/'+_0x6a609e)[_0x2efb('0xc')](_0x8f704);}return null;};}function removeEntity(_0xd49c86){return function(_0x1c73c9){if(_0x1c73c9){return _0x1c73c9[_0x2efb('0x12')]()[_0x2efb('0x13')](function(){var _0x4f58b4=_0x1c73c9[_0x2efb('0x14')]({'plain':!![]});var _0x1bec27=[{'name':_0x2efb('0x15'),'value':_0x2efb('0x16'),'ignore':![]},{'name':_0x2efb('0x17'),'value':'outbound','ignore':![]},{'name':_0x2efb('0x18'),'value':_0x2efb('0x19'),'ignore':![]}];var _0xdc31be=_(_0x1bec27)['filter']('ignore')[_0x2efb('0x1a')](_0x2efb('0x1b'))[_0x2efb('0x1b')]();if(_['includes'](_0xdc31be,_0x4f58b4[_0x2efb('0x1c')])){return;}var _0x24b3d5=_[_0x2efb('0x1d')](_0x1bec27,[_0x2efb('0x1b'),_0x4f58b4[_0x2efb('0x1c')]])[_0x2efb('0x1e')];return db['UserProfileResource'][_0x2efb('0x12')]({'where':{'type':_0x24b3d5,'resourceId':_0x4f58b4['id']}})['then'](function(){return _0x1c73c9;});})[_0x2efb('0x13')](function(){_0xd49c86[_0x2efb('0xa')](0xcc)[_0x2efb('0xb')]();});}};}function handleEntityNotFound(_0x754a25){return function(_0x5d9480){if(!_0x5d9480){_0x754a25[_0x2efb('0x9')](0x194);}return _0x5d9480;};}function handleError(_0x595d81,_0xba1845){_0xba1845=_0xba1845||0x1f4;return function(_0x29fce3){logger[_0x2efb('0x1f')](_0x29fce3[_0x2efb('0x20')]);if(_0x29fce3[_0x2efb('0x1e')]){delete _0x29fce3['name'];}_0x595d81[_0x2efb('0xa')](_0xba1845)[_0x2efb('0x21')](_0x29fce3);};}exports['index']=function(_0x429ba3,_0x54327a){var _0x19f2f7={},_0x22a33e={},_0x4be281={'count':0x0,'rows':[]};var _0x4c3c15=_[_0x2efb('0x1a')](db[_0x2efb('0x22')][_0x2efb('0x23')],function(_0x41433b){return{'name':_0x41433b[_0x2efb('0x24')],'type':_0x41433b[_0x2efb('0x1c')][_0x2efb('0x25')]};});_0x22a33e[_0x2efb('0x26')]=_['map'](_0x4c3c15,'name');_0x22a33e[_0x2efb('0x27')]=_[_0x2efb('0x28')](_0x429ba3['query']);_0x22a33e[_0x2efb('0x29')]=_[_0x2efb('0x2a')](_0x22a33e[_0x2efb('0x26')],_0x22a33e[_0x2efb('0x27')]);_0x19f2f7['attributes']=_[_0x2efb('0x2a')](_0x22a33e[_0x2efb('0x26')],qs[_0x2efb('0x2b')](_0x429ba3[_0x2efb('0x27')][_0x2efb('0x2b')]));_0x19f2f7[_0x2efb('0x2c')]=_0x19f2f7[_0x2efb('0x2c')][_0x2efb('0x2d')]?_0x19f2f7[_0x2efb('0x2c')]:_0x22a33e[_0x2efb('0x26')];if(!_0x429ba3[_0x2efb('0x27')]['hasOwnProperty'](_0x2efb('0x2e'))){_0x19f2f7[_0x2efb('0xf')]=qs[_0x2efb('0xf')](_0x429ba3[_0x2efb('0x27')]['limit']);_0x19f2f7[_0x2efb('0xd')]=qs[_0x2efb('0xd')](_0x429ba3[_0x2efb('0x27')][_0x2efb('0xd')]);}_0x19f2f7['order']=qs['sort'](_0x429ba3[_0x2efb('0x27')][_0x2efb('0x2f')]);_0x19f2f7[_0x2efb('0x30')]=qs[_0x2efb('0x29')](_['pick'](_0x429ba3[_0x2efb('0x27')],_0x22a33e[_0x2efb('0x29')]),_0x4c3c15);if(_0x429ba3[_0x2efb('0x27')][_0x2efb('0x31')]){_0x19f2f7['where']=_[_0x2efb('0x32')](_0x19f2f7[_0x2efb('0x30')],{'$or':_[_0x2efb('0x1a')](_0x4c3c15,function(_0x3d1ad7){if(_0x3d1ad7[_0x2efb('0x1c')]!==_0x2efb('0x33')){var _0x424b39={};_0x424b39[_0x3d1ad7[_0x2efb('0x1e')]]={'$like':'%'+_0x429ba3['query'][_0x2efb('0x31')]+'%'};return _0x424b39;}})});}_0x19f2f7=_[_0x2efb('0x32')]({},_0x19f2f7,_0x429ba3[_0x2efb('0x34')]);var _0x4e7a2c={'where':_0x19f2f7[_0x2efb('0x30')]};return db[_0x2efb('0x22')][_0x2efb('0x10')](_0x4e7a2c)[_0x2efb('0x13')](function(_0x4219c0){_0x4be281[_0x2efb('0x10')]=_0x4219c0;if(_0x429ba3[_0x2efb('0x27')][_0x2efb('0x35')]){_0x19f2f7[_0x2efb('0x36')]=[{'all':!![]}];}return db[_0x2efb('0x22')][_0x2efb('0x37')](_0x19f2f7);})['then'](function(_0x222132){_0x4be281[_0x2efb('0x38')]=_0x222132;return _0x4be281;})[_0x2efb('0x13')](respondWithFilteredResult(_0x54327a,_0x19f2f7))['catch'](handleError(_0x54327a,null));};exports[_0x2efb('0x39')]=function(_0x16adfa,_0x15e2ed){var _0x12fb1d={'raw':![],'where':{'id':_0x16adfa[_0x2efb('0x3a')]['id']}},_0x32a2ba={};_0x32a2ba['model']=_['keys'](db[_0x2efb('0x22')][_0x2efb('0x23')]);_0x32a2ba[_0x2efb('0x27')]=_[_0x2efb('0x28')](_0x16adfa[_0x2efb('0x27')]);_0x32a2ba['filters']=_['intersection'](_0x32a2ba[_0x2efb('0x26')],_0x32a2ba[_0x2efb('0x27')]);_0x12fb1d[_0x2efb('0x2c')]=_['intersection'](_0x32a2ba[_0x2efb('0x26')],qs[_0x2efb('0x2b')](_0x16adfa['query'][_0x2efb('0x2b')]));_0x12fb1d[_0x2efb('0x2c')]=_0x12fb1d[_0x2efb('0x2c')][_0x2efb('0x2d')]?_0x12fb1d[_0x2efb('0x2c')]:_0x32a2ba[_0x2efb('0x26')];if(_0x16adfa[_0x2efb('0x27')][_0x2efb('0x35')]){_0x12fb1d['include']=[{'all':!![]}];}_0x12fb1d=_[_0x2efb('0x32')]({},_0x12fb1d,_0x16adfa[_0x2efb('0x34')]);return db['VoiceExtension'][_0x2efb('0x1d')](_0x12fb1d)[_0x2efb('0x13')](handleEntityNotFound(_0x15e2ed,null))[_0x2efb('0x13')](respondWithResult(_0x15e2ed,null))[_0x2efb('0x3b')](handleError(_0x15e2ed,null));};exports['destroy']=function(_0x1cb0e5,_0x15a1be){return db['VoiceExtension'][_0x2efb('0x1d')]({'where':{'id':_0x1cb0e5[_0x2efb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x15a1be,null))[_0x2efb('0x13')](removeEntity(_0x15a1be,null))[_0x2efb('0x3b')](handleError(_0x15a1be,null));};exports['create']=function(_0xa45525,_0x29dba1){if(_0xa45525['body'][_0x2efb('0x1c')]==='outbound'&&!_[_0x2efb('0x3c')](_0xa45525['body']['exten'],'_')){_0xa45525['body'][_0x2efb('0x3d')]='_'[_0x2efb('0x3e')](_0xa45525['body'][_0x2efb('0x3d')]);}return db[_0x2efb('0x22')]['create'](_0xa45525['body'],{'raw':![]})[_0x2efb('0x13')](function(_0x1fab98){var _0x43d791=_0xa45525[_0x2efb('0x3f')][_0x2efb('0x14')]({'plain':!![]});if(!_0x43d791)throw new Error(_0x2efb('0x40'));if(_0x43d791[_0x2efb('0x41')]===_0x2efb('0x3f')){var _0x3269fb=_0x1fab98[_0x2efb('0x14')]({'plain':!![]});var _0x2276d6=[{'name':_0x2efb('0x15'),'value':_0x2efb('0x16')},{'name':_0x2efb('0x17'),'value':_0x2efb('0x42')},{'name':_0x2efb('0x18'),'value':_0x2efb('0x19')}];var _0x632293=_[_0x2efb('0x1d')](_0x2276d6,[_0x2efb('0x1b'),_0x3269fb[_0x2efb('0x1c')]])[_0x2efb('0x1e')];return db[_0x2efb('0x43')]['find']({'where':{'name':_0x632293,'userProfileId':_0x43d791[_0x2efb('0x44')]},'raw':!![]})[_0x2efb('0x13')](function(_0x24ee66){if(_0x24ee66&&_0x24ee66[_0x2efb('0x45')]===0x0){return db[_0x2efb('0x46')]['create']({'name':_0x3269fb[_0x2efb('0x1e')],'resourceId':_0x3269fb['id'],'type':_0x24ee66[_0x2efb('0x1e')],'sectionId':_0x24ee66['id']},{})[_0x2efb('0x13')](function(){return _0x1fab98;});}else{return _0x1fab98;}})['catch'](function(_0xab16e1){logger[_0x2efb('0x1f')](_0x2efb('0x47'),_0xab16e1);throw _0xab16e1;});}return _0x1fab98;})['then'](respondWithResult(_0x29dba1,0xc9))[_0x2efb('0x3b')](handleError(_0x29dba1,null));};exports['update']=function(_0x4c4eda,_0x51819c){if(_0x4c4eda[_0x2efb('0x48')]['id']){delete _0x4c4eda[_0x2efb('0x48')]['id'];}return db[_0x2efb('0x22')]['find']({'where':{'id':_0x4c4eda[_0x2efb('0x3a')]['id']}})[_0x2efb('0x13')](handleEntityNotFound(_0x51819c,null))[_0x2efb('0x13')](function(_0x46500b){if(_0x46500b){return db[_0x2efb('0x22')][_0x2efb('0x49')](_[_0x2efb('0x4a')](_0x4c4eda['body'],[_0x2efb('0x3d'),_0x2efb('0x4b'),'description','recordingFormat',_0x2efb('0x4c'),_0x2efb('0x4d'),'alias']),{'where':{'context':_0x46500b[_0x2efb('0x4b')],'exten':_0x46500b[_0x2efb('0x3d')]},'individualHooks':!![]})[_0x2efb('0x13')](function(_0x241726){return _0x241726;});}return null;})[_0x2efb('0x13')](respondWithStatusCode(_0x51819c,null))[_0x2efb('0x3b')](handleError(_0x51819c,null));};exports[_0x2efb('0x4e')]=function(_0x3634e7,_0xa0b8b3){var _0x5434af=_0x3634e7[_0x2efb('0x3a')]['id'];var _0x4f15a8=_0x3634e7[_0x2efb('0x48')];var _0x8c5f10=0xc8;var _0x25b302=null;return db[_0x2efb('0x4f')][_0x2efb('0x50')]({'isolationLevel':db[_0x2efb('0x4f')][_0x2efb('0x51')][_0x2efb('0x52')]['READ_COMMITTED']},function(_0x21a6f0){return db[_0x2efb('0x22')][_0x2efb('0x53')]({'where':{'id':_0x5434af},'transaction':_0x21a6f0})[_0x2efb('0x13')](function(_0x46fcd1){if(_0x46fcd1){return db[_0x2efb('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x5434af},'transaction':_0x21a6f0})['then'](function(){var _0x284129=_['map'](_0x4f15a8,function(_0x174236){_0x174236[_0x2efb('0x54')]=_0x5434af;_0x174236[_0x2efb('0x55')]=!![];return _0x174236;});return _0x46fcd1['createRouting'](_0x284129);})['then'](function(_0x25c5f8){return db['VoiceExtension'][_0x2efb('0x56')](_0x25c5f8,{'transaction':_0x21a6f0});});}else{_0x8c5f10=0x194;_0x25b302=[];}});})[_0x2efb('0x13')](function(){if(_0x8c5f10!==0x194){return db['VoiceExtension'][_0x2efb('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5434af},'order':_0x2efb('0x58')})[_0x2efb('0x13')](function(_0xf899ba){_0x25b302=_0xf899ba;});}})[_0x2efb('0x3b')](function(_0x22e95e){_0x8c5f10=0x1f4;logger[_0x2efb('0x1f')](_0x22e95e['stack']);if(_0x22e95e[_0x2efb('0x1e')]){delete _0x22e95e[_0x2efb('0x1e')];}_0x25b302=_0x22e95e;})[_0x2efb('0x59')](function(){if(_0x25b302===null){_0xa0b8b3[_0x2efb('0x9')](_0x8c5f10);}else{if(_0x8c5f10===0x1f4){_0xa0b8b3['status'](_0x8c5f10)['send'](_0x25b302);}else{_0xa0b8b3[_0x2efb('0xa')](_0x8c5f10)[_0x2efb('0xc')](_0x25b302);}}});}; \ No newline at end of file +var _0x0ca5=['../../config/environment','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','destroy','then','InboundRoutes','OutboundRoutes','InternalRoutes','ignore','map','value','type','find','name','UserProfileResource','error','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','include','outbound','startsWith','exten','body','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','inbound','internal','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','context','description','cutdigits','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','stack','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x1c8620,_0x5d6555){var _0x55ce0c=function(_0x38afec){while(--_0x38afec){_0x1c8620['push'](_0x1c8620['shift']());}};_0x55ce0c(++_0x5d6555);}(_0x0ca5,0x10f));var _0x50ca=function(_0x36f92c,_0x78d7b1){_0x36f92c=_0x36f92c-0x0;var _0x5c0abc=_0x0ca5[_0x36f92c];return _0x5c0abc;};'use strict';var _=require(_0x50ca('0x0'));var Redis=require(_0x50ca('0x1'));var qs=require(_0x50ca('0x2'));var logger=require(_0x50ca('0x3'))(_0x50ca('0x4'));var config=require(_0x50ca('0x5'));var db=require(_0x50ca('0x6'))['db'];config[_0x50ca('0x7')]=_['defaults'](config[_0x50ca('0x7')],{'host':_0x50ca('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50ca('0x7')]));require(_0x50ca('0x9'))[_0x50ca('0xa')](socket);function respondWithStatusCode(_0x1efe55,_0x534f15){_0x534f15=_0x534f15||0xcc;return function(_0x48ec01){if(_0x48ec01){return _0x1efe55[_0x50ca('0xb')](_0x534f15);}return _0x1efe55[_0x50ca('0xc')](_0x534f15)[_0x50ca('0xd')]();};}function respondWithResult(_0x3d2edf,_0xecdfd7){_0xecdfd7=_0xecdfd7||0xc8;return function(_0x58bfce){if(_0x58bfce){return _0x3d2edf[_0x50ca('0xc')](_0xecdfd7)['json'](_0x58bfce);}};}function respondWithFilteredResult(_0x18eac8,_0x1242fe){return function(_0x3cc7f5){if(_0x3cc7f5){var _0x1b7ce5=typeof _0x1242fe[_0x50ca('0xe')]===_0x50ca('0xf')&&typeof _0x1242fe[_0x50ca('0x10')]===_0x50ca('0xf');var _0x235c1e=_0x3cc7f5[_0x50ca('0x11')];var _0x437ec6=_0x1b7ce5?0x0:_0x1242fe[_0x50ca('0xe')];var _0xd5d5c7=_0x1b7ce5?_0x3cc7f5['count']:_0x1242fe[_0x50ca('0xe')]+_0x1242fe[_0x50ca('0x10')];var _0x3c2a97;if(_0xd5d5c7>=_0x235c1e){_0xd5d5c7=_0x235c1e;_0x3c2a97=0xc8;}else{_0x3c2a97=0xce;}_0x18eac8[_0x50ca('0xc')](_0x3c2a97);return _0x18eac8[_0x50ca('0x12')]('Content-Range',_0x437ec6+'-'+_0xd5d5c7+'/'+_0x235c1e)[_0x50ca('0x13')](_0x3cc7f5);}return null;};}function removeEntity(_0x17a4da){return function(_0x5d24b9){if(_0x5d24b9){return _0x5d24b9[_0x50ca('0x14')]()[_0x50ca('0x15')](function(){var _0x53f69e=_0x5d24b9['get']({'plain':!![]});var _0x12d6ad=[{'name':_0x50ca('0x16'),'value':'inbound','ignore':![]},{'name':_0x50ca('0x17'),'value':'outbound','ignore':![]},{'name':_0x50ca('0x18'),'value':'internal','ignore':![]}];var _0x2662f9=_(_0x12d6ad)['filter'](_0x50ca('0x19'))[_0x50ca('0x1a')](_0x50ca('0x1b'))['value']();if(_['includes'](_0x2662f9,_0x53f69e[_0x50ca('0x1c')])){return;}var _0x2de4bd=_[_0x50ca('0x1d')](_0x12d6ad,['value',_0x53f69e[_0x50ca('0x1c')]])[_0x50ca('0x1e')];return db[_0x50ca('0x1f')][_0x50ca('0x14')]({'where':{'type':_0x2de4bd,'resourceId':_0x53f69e['id']}})['then'](function(){return _0x5d24b9;});})[_0x50ca('0x15')](function(){_0x17a4da[_0x50ca('0xc')](0xcc)[_0x50ca('0xd')]();});}};}function handleEntityNotFound(_0x4f42c5){return function(_0x162df3){if(!_0x162df3){_0x4f42c5[_0x50ca('0xb')](0x194);}return _0x162df3;};}function handleError(_0x2f30b4,_0x59b127){_0x59b127=_0x59b127||0x1f4;return function(_0x5030a2){logger[_0x50ca('0x20')](_0x5030a2['stack']);if(_0x5030a2[_0x50ca('0x1e')]){delete _0x5030a2[_0x50ca('0x1e')];}_0x2f30b4[_0x50ca('0xc')](_0x59b127)['send'](_0x5030a2);};}exports[_0x50ca('0x21')]=function(_0x434ea3,_0x14070f){var _0x269897={},_0x55a42e={},_0xe4e853={'count':0x0,'rows':[]};var _0x48b131=_[_0x50ca('0x1a')](db[_0x50ca('0x22')][_0x50ca('0x23')],function(_0x12e02b){return{'name':_0x12e02b[_0x50ca('0x24')],'type':_0x12e02b[_0x50ca('0x1c')]['key']};});_0x55a42e[_0x50ca('0x25')]=_[_0x50ca('0x1a')](_0x48b131,_0x50ca('0x1e'));_0x55a42e[_0x50ca('0x26')]=_[_0x50ca('0x27')](_0x434ea3['query']);_0x55a42e[_0x50ca('0x28')]=_[_0x50ca('0x29')](_0x55a42e[_0x50ca('0x25')],_0x55a42e['query']);_0x269897[_0x50ca('0x2a')]=_[_0x50ca('0x29')](_0x55a42e['model'],qs[_0x50ca('0x2b')](_0x434ea3[_0x50ca('0x26')][_0x50ca('0x2b')]));_0x269897[_0x50ca('0x2a')]=_0x269897[_0x50ca('0x2a')][_0x50ca('0x2c')]?_0x269897[_0x50ca('0x2a')]:_0x55a42e[_0x50ca('0x25')];if(!_0x434ea3[_0x50ca('0x26')]['hasOwnProperty'](_0x50ca('0x2d'))){_0x269897[_0x50ca('0x10')]=qs[_0x50ca('0x10')](_0x434ea3[_0x50ca('0x26')][_0x50ca('0x10')]);_0x269897[_0x50ca('0xe')]=qs[_0x50ca('0xe')](_0x434ea3['query'][_0x50ca('0xe')]);}_0x269897[_0x50ca('0x2e')]=qs[_0x50ca('0x2f')](_0x434ea3['query'][_0x50ca('0x2f')]);_0x269897[_0x50ca('0x30')]=qs[_0x50ca('0x28')](_[_0x50ca('0x31')](_0x434ea3[_0x50ca('0x26')],_0x55a42e['filters']),_0x48b131);if(_0x434ea3[_0x50ca('0x26')][_0x50ca('0x32')]){_0x269897[_0x50ca('0x30')]=_[_0x50ca('0x33')](_0x269897[_0x50ca('0x30')],{'$or':_['map'](_0x48b131,function(_0x53dc8e){if(_0x53dc8e[_0x50ca('0x1c')]!==_0x50ca('0x34')){var _0x45ab96={};_0x45ab96[_0x53dc8e[_0x50ca('0x1e')]]={'$like':'%'+_0x434ea3['query'][_0x50ca('0x32')]+'%'};return _0x45ab96;}})});}_0x269897=_['merge']({},_0x269897,_0x434ea3[_0x50ca('0x35')]);var _0x9a0d35={'where':_0x269897[_0x50ca('0x30')]};return db[_0x50ca('0x22')][_0x50ca('0x11')](_0x9a0d35)[_0x50ca('0x15')](function(_0x55b15f){_0xe4e853[_0x50ca('0x11')]=_0x55b15f;if(_0x434ea3[_0x50ca('0x26')][_0x50ca('0x36')]){_0x269897['include']=[{'all':!![]}];}return db[_0x50ca('0x22')][_0x50ca('0x37')](_0x269897);})[_0x50ca('0x15')](function(_0x198ecd){_0xe4e853[_0x50ca('0x38')]=_0x198ecd;return _0xe4e853;})[_0x50ca('0x15')](respondWithFilteredResult(_0x14070f,_0x269897))[_0x50ca('0x39')](handleError(_0x14070f,null));};exports['show']=function(_0x89a7e1,_0x2c3d81){var _0x360151={'raw':![],'where':{'id':_0x89a7e1['params']['id']}},_0x39a710={};_0x39a710[_0x50ca('0x25')]=_['keys'](db['VoiceExtension']['rawAttributes']);_0x39a710[_0x50ca('0x26')]=_[_0x50ca('0x27')](_0x89a7e1[_0x50ca('0x26')]);_0x39a710['filters']=_[_0x50ca('0x29')](_0x39a710[_0x50ca('0x25')],_0x39a710['query']);_0x360151[_0x50ca('0x2a')]=_['intersection'](_0x39a710[_0x50ca('0x25')],qs[_0x50ca('0x2b')](_0x89a7e1[_0x50ca('0x26')][_0x50ca('0x2b')]));_0x360151[_0x50ca('0x2a')]=_0x360151[_0x50ca('0x2a')][_0x50ca('0x2c')]?_0x360151['attributes']:_0x39a710['model'];if(_0x89a7e1[_0x50ca('0x26')][_0x50ca('0x36')]){_0x360151[_0x50ca('0x3a')]=[{'all':!![]}];}_0x360151=_['merge']({},_0x360151,_0x89a7e1[_0x50ca('0x35')]);return db[_0x50ca('0x22')][_0x50ca('0x1d')](_0x360151)[_0x50ca('0x15')](handleEntityNotFound(_0x2c3d81,null))['then'](respondWithResult(_0x2c3d81,null))[_0x50ca('0x39')](handleError(_0x2c3d81,null));};exports[_0x50ca('0x14')]=function(_0x333170,_0x34cdc1){return db['VoiceExtension']['find']({'where':{'id':_0x333170['params']['id']}})['then'](handleEntityNotFound(_0x34cdc1,null))[_0x50ca('0x15')](removeEntity(_0x34cdc1,null))[_0x50ca('0x39')](handleError(_0x34cdc1,null));};exports['create']=function(_0x3879c1,_0x57767c){if(_0x3879c1['body'][_0x50ca('0x1c')]===_0x50ca('0x3b')&&!_[_0x50ca('0x3c')](_0x3879c1['body'][_0x50ca('0x3d')],'_')){_0x3879c1[_0x50ca('0x3e')][_0x50ca('0x3d')]='_'[_0x50ca('0x3f')](_0x3879c1['body'][_0x50ca('0x3d')]);}return db[_0x50ca('0x22')][_0x50ca('0x40')](_0x3879c1[_0x50ca('0x3e')],{'raw':![]})[_0x50ca('0x15')](function(_0x12b0ac){var _0x4a6f31=_0x3879c1[_0x50ca('0x41')]['get']({'plain':!![]});if(!_0x4a6f31)throw new Error(_0x50ca('0x42'));if(_0x4a6f31[_0x50ca('0x43')]==='user'){var _0x2ee4ed=_0x12b0ac[_0x50ca('0x44')]({'plain':!![]});var _0x5e3f9c=[{'name':_0x50ca('0x16'),'value':_0x50ca('0x45')},{'name':_0x50ca('0x17'),'value':_0x50ca('0x3b')},{'name':'InternalRoutes','value':_0x50ca('0x46')}];var _0x312449=_[_0x50ca('0x1d')](_0x5e3f9c,['value',_0x2ee4ed[_0x50ca('0x1c')]])['name'];return db[_0x50ca('0x47')]['find']({'where':{'name':_0x312449,'userProfileId':_0x4a6f31[_0x50ca('0x48')]},'raw':!![]})[_0x50ca('0x15')](function(_0x4a4433){if(_0x4a4433&&_0x4a4433['autoAssociation']===0x0){return db[_0x50ca('0x1f')]['create']({'name':_0x2ee4ed[_0x50ca('0x1e')],'resourceId':_0x2ee4ed['id'],'type':_0x4a4433[_0x50ca('0x1e')],'sectionId':_0x4a4433['id']},{})['then'](function(){return _0x12b0ac;});}else{return _0x12b0ac;}})['catch'](function(_0x5925c8){logger[_0x50ca('0x20')](_0x50ca('0x49'),_0x5925c8);throw _0x5925c8;});}return _0x12b0ac;})[_0x50ca('0x15')](respondWithResult(_0x57767c,0xc9))['catch'](handleError(_0x57767c,null));};exports['update']=function(_0x48f1a2,_0x3e1ff7){if(_0x48f1a2[_0x50ca('0x3e')]['id']){delete _0x48f1a2['body']['id'];}return db[_0x50ca('0x22')][_0x50ca('0x1d')]({'where':{'id':_0x48f1a2[_0x50ca('0x4a')]['id']}})[_0x50ca('0x15')](handleEntityNotFound(_0x3e1ff7,null))[_0x50ca('0x15')](function(_0xdb3047){if(_0xdb3047){return db[_0x50ca('0x22')]['update'](_['pick'](_0x48f1a2[_0x50ca('0x3e')],[_0x50ca('0x3d'),_0x50ca('0x4b'),_0x50ca('0x4c'),'recordingFormat',_0x50ca('0x4d'),'mandatoryDisposition',_0x50ca('0x4e')]),{'where':{'context':_0xdb3047[_0x50ca('0x4b')],'exten':_0xdb3047['exten']},'individualHooks':!![]})[_0x50ca('0x15')](function(_0x4a26f0){return _0x4a26f0;});}return null;})[_0x50ca('0x15')](respondWithStatusCode(_0x3e1ff7,null))['catch'](handleError(_0x3e1ff7,null));};exports['addApplications']=function(_0xa46028,_0x1cebef){var _0x4ed94b=_0xa46028[_0x50ca('0x4a')]['id'];var _0x5284dd=_0xa46028[_0x50ca('0x3e')];var _0x135906=0xc8;var _0x297cc7=null;return db[_0x50ca('0x4f')][_0x50ca('0x50')]({'isolationLevel':db[_0x50ca('0x4f')][_0x50ca('0x51')][_0x50ca('0x52')][_0x50ca('0x53')]},function(_0x16b497){return db[_0x50ca('0x22')][_0x50ca('0x54')]({'where':{'id':_0x4ed94b},'transaction':_0x16b497})[_0x50ca('0x15')](function(_0x3c5269){if(_0x3c5269){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x4ed94b},'transaction':_0x16b497})[_0x50ca('0x15')](function(){var _0x24f27e=_[_0x50ca('0x1a')](_0x5284dd,function(_0x24d445){_0x24d445[_0x50ca('0x55')]=_0x4ed94b;_0x24d445['isApp']=!![];return _0x24d445;});return _0x3c5269[_0x50ca('0x56')](_0x24f27e);})[_0x50ca('0x15')](function(_0x54ecf2){return db[_0x50ca('0x22')][_0x50ca('0x57')](_0x54ecf2,{'transaction':_0x16b497});});}else{_0x135906=0x194;_0x297cc7=[];}});})[_0x50ca('0x15')](function(){if(_0x135906!==0x194){return db[_0x50ca('0x22')][_0x50ca('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4ed94b},'order':'cast(priority\x20as\x20unsigned)'})[_0x50ca('0x15')](function(_0x3cc41d){_0x297cc7=_0x3cc41d;});}})['catch'](function(_0x6716c2){_0x135906=0x1f4;logger['error'](_0x6716c2[_0x50ca('0x59')]);if(_0x6716c2['name']){delete _0x6716c2['name'];}_0x297cc7=_0x6716c2;})[_0x50ca('0x5a')](function(){if(_0x297cc7===null){_0x1cebef[_0x50ca('0xb')](_0x135906);}else{if(_0x135906===0x1f4){_0x1cebef[_0x50ca('0xc')](_0x135906)[_0x50ca('0x5b')](_0x297cc7);}else{_0x1cebef[_0x50ca('0xc')](_0x135906)[_0x50ca('0x13')](_0x297cc7);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index adcb126..7b63192 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 _0x3254=['hook','exports','events','../../mysqldb','setMaxListeners','remove','hasOwnProperty'];(function(_0x3ee697,_0x24f133){var _0x3b81e2=function(_0x44d6a5){while(--_0x44d6a5){_0x3ee697['push'](_0x3ee697['shift']());}};_0x3b81e2(++_0x24f133);}(_0x3254,0xf7));var _0x4325=function(_0x2caaa7,_0x360cf4){_0x2caaa7=_0x2caaa7-0x0;var _0x493016=_0x3254[_0x2caaa7];return _0x493016;};'use strict';var EventEmitter=require(_0x4325('0x0'));var VoiceExtension=require(_0x4325('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4325('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4325('0x3')};function emitEvent(_0x3ce362){return function(_0x19bd94,_0x4e573d,_0x338211){VoiceExtensionEvents['emit'](_0x3ce362+':'+_0x19bd94['id'],_0x19bd94);VoiceExtensionEvents['emit'](_0x3ce362,_0x19bd94);_0x338211(null);};}for(var e in events){if(events[_0x4325('0x4')](e)){var event=events[e];VoiceExtension[_0x4325('0x5')](e,emitEvent(event));}}module[_0x4325('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x96ae=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x96ae,0x1cf));var _0xe96a=function(_0x306626,_0x425e93){_0x306626=_0x306626-0x0;var _0x466728=_0x96ae[_0x306626];return _0x466728;};'use strict';var EventEmitter=require(_0xe96a('0x0'));var VoiceExtension=require(_0xe96a('0x1'))['db'][_0xe96a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe96a('0x3')](0x0);var events={'afterCreate':_0xe96a('0x4'),'afterUpdate':_0xe96a('0x5'),'afterDestroy':_0xe96a('0x6')};function emitEvent(_0xeea681){return function(_0x141bde,_0x197173,_0x4a1ae9){VoiceExtensionEvents[_0xe96a('0x7')](_0xeea681+':'+_0x141bde['id'],_0x141bde);VoiceExtensionEvents[_0xe96a('0x7')](_0xeea681,_0x141bde);_0x4a1ae9(null);};}for(var e in events){if(events[_0xe96a('0x8')](e)){var event=events[e];VoiceExtension[_0xe96a('0x9')](e,emitEvent(event));}}module[_0xe96a('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 10e588e..834cc91 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 _0x69ec=['findAll','interval','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','hasOwnProperty','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','define','VoiceExtension','then','Hangup','./voiceExtension.attributes','exports','models','type','Set','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN:','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','split','length','name','param','prefix','phone','join','indexOf','U(xcally-mixmonitor-context)'];(function(_0x23dcae,_0x5ac4e2){var _0x570ecc=function(_0x5b60a6){while(--_0x5b60a6){_0x23dcae['push'](_0x23dcae['shift']());}};_0x570ecc(++_0x5ac4e2);}(_0x69ec,0xbe));var _0xc69e=function(_0x3327fd,_0x393a4b){_0x3327fd=_0x3327fd-0x0;var _0x204729=_0x69ec[_0x3327fd];return _0x204729;};'use strict';var _=require('lodash');var attributes=require(_0xc69e('0x0'));module[_0xc69e('0x1')]=function(_0x24551c){var _0xc476b3=_0x24551c[_0xc69e('0x2')];function _0x10e914(_0x2fdc49){var _0xc2512d=0x2;var _0x416e44=[{'type':_0x2fdc49[_0xc69e('0x3')],'app':_0xc69e('0x4'),'appdata':'CDR(type)='+_0x2fdc49['type'],'context':_0x2fdc49[_0xc69e('0x5')],'exten':_0x2fdc49['exten'],'priority':_0xc2512d++,'VoiceExtensionId':_0x2fdc49['id']},{'type':_0x2fdc49[_0xc69e('0x3')],'app':_0x2fdc49[_0xc69e('0x6')]?_0xc69e('0x4'):_0xc69e('0x7'),'appdata':_0x2fdc49[_0xc69e('0x6')]?_0xc69e('0x8')+_0x2fdc49[_0xc69e('0x6')]:_0xc69e('0x9'),'context':_0x2fdc49['context'],'exten':_0x2fdc49['exten'],'priority':_0xc2512d++,'VoiceExtensionId':_0x2fdc49['id']}];if(_0x2fdc49['type']===_0xc69e('0xa')){_0x416e44[_0xc69e('0xb')]({'type':'inbound','app':_0xc69e('0x4'),'appdata':_0xc69e('0xc')+_0x2fdc49['id'],'context':_0x2fdc49[_0xc69e('0x5')],'exten':_0x2fdc49[_0xc69e('0xd')],'priority':_0xc2512d++,'VoiceExtensionId':_0x2fdc49['id']});}_0x416e44[_0xc69e('0xb')]({'type':_0x2fdc49[_0xc69e('0x3')],'app':'Set','appdata':_0xc69e('0xe'),'context':_0x2fdc49[_0xc69e('0x5')],'exten':_0x2fdc49[_0xc69e('0xd')],'priority':_0xc2512d++,'VoiceExtensionId':_0x2fdc49['id']},{'type':_0x2fdc49[_0xc69e('0x3')],'app':_0xc69e('0x4'),'appdata':_0xc69e('0xf'),'context':_0x2fdc49[_0xc69e('0x5')],'exten':_0x2fdc49[_0xc69e('0xd')],'priority':_0xc2512d++,'VoiceExtensionId':_0x2fdc49['id']},{'type':_0x2fdc49[_0xc69e('0x3')],'app':_0xc69e('0x4'),'appdata':_0xc69e('0x10'),'context':_0x2fdc49[_0xc69e('0x5')],'exten':_0x2fdc49[_0xc69e('0xd')],'priority':_0xc2512d++,'VoiceExtensionId':_0x2fdc49['id']});return _0x416e44;}function _0x113b92(_0x4d4138){var _0x173f39=0x2;var _0x5171b6=[{'type':_0xc69e('0x11'),'app':_0xc69e('0x4'),'appdata':_0xc69e('0x12'),'context':_0x4d4138['context'],'exten':_0x4d4138['exten'],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':_0xc69e('0x11'),'app':_0x4d4138[_0xc69e('0x6')]?_0xc69e('0x4'):_0xc69e('0x7'),'appdata':_0x4d4138[_0xc69e('0x6')]?_0xc69e('0x8')+_0x4d4138['alias']:'No\x20alias\x20set','context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138[_0xc69e('0xd')],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':_0xc69e('0x11'),'app':_0xc69e('0x4'),'appdata':'CDR(destination)='+(_0x4d4138['cutdigits']?_0xc69e('0x13')+_0x4d4138[_0xc69e('0x14')]+'}':_0xc69e('0x15')),'context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138['exten'],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':_0xc69e('0x11'),'app':_0xc69e('0x4'),'appdata':_0xc69e('0xc')+_0x4d4138['id'],'context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138[_0xc69e('0xd')],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':_0xc69e('0x11'),'app':_0xc69e('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x173f39+0x2)+_0xc69e('0x17')+(_0x173f39+0x1)+')','context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138[_0xc69e('0xd')],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':'outbound','app':_0xc69e('0x4'),'appdata':_0x4d4138[_0xc69e('0x14')]?_0xc69e('0x18')+_0x4d4138['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138[_0xc69e('0xd')],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':_0xc69e('0x11'),'app':_0xc69e('0x4'),'appdata':_0xc69e('0xe'),'context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138['exten'],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':_0xc69e('0x11'),'app':'Set','appdata':_0xc69e('0xf'),'context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138['exten'],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':'outbound','app':_0xc69e('0x4'),'appdata':_0xc69e('0x10'),'context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138[_0xc69e('0xd')],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':_0xc69e('0x11'),'app':_0xc69e('0x4'),'appdata':_0xc69e('0x19')+_0x4d4138['id'],'context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138[_0xc69e('0xd')],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']}];if(_0x4d4138['hasOwnProperty'](_0xc69e('0x1a'))&&_0x4d4138[_0xc69e('0x1a')]!==_0xc69e('0x1b')){_0x5171b6[_0xc69e('0xb')]({'type':_0xc69e('0x11'),'app':_0xc69e('0x4'),'appdata':_0xc69e('0x1c'),'context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138[_0xc69e('0xd')],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']},{'type':_0xc69e('0x11'),'app':_0xc69e('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4d4138[_0xc69e('0x1a')]||'wav','context':_0x4d4138[_0xc69e('0x5')],'exten':_0x4d4138[_0xc69e('0xd')],'priority':_0x173f39++,'VoiceExtensionId':_0x4d4138['id']});}return _0x5171b6;}function _0x109876(_0x5ad595,_0x2b399d){var _0x3818de=[{'name':_0xc69e('0x1d'),'param':0x0},{'name':_0xc69e('0x1e'),'param':0x1},{'name':_0xc69e('0x1f'),'param':0x2},{'name':'url','param':0x3}];var _0x45f4c3={};var _0x5c7b3c=_0x2b399d[_0xc69e('0x20')](',');var _0x2d318c=[];for(var _0x59f593=0x0;_0x59f593<_0x3818de[_0xc69e('0x21')];_0x59f593++){switch(_0x3818de[_0x59f593][_0xc69e('0x22')]){case _0xc69e('0x1d'):_0x45f4c3['trunk']=_0x5c7b3c[_0x3818de[_0x59f593][_0xc69e('0x23')]][_0xc69e('0x20')]('/')[0x1];_0x45f4c3['phone']=_0x5c7b3c[_0x3818de[_0x59f593][_0xc69e('0x23')]][_0xc69e('0x20')]('/')[0x2];_0x45f4c3[_0xc69e('0x24')]=_0x45f4c3['phone']?_0x45f4c3[_0xc69e('0x25')][_0xc69e('0x20')]('$')[0x0]:undefined;_0x45f4c3[_0xc69e('0x25')]=_0x5ad595[_0xc69e('0x14')]?(_0x45f4c3[_0xc69e('0x24')]||'')+_0xc69e('0x13')+_0x5ad595[_0xc69e('0x14')]+'}':(_0x45f4c3['prefix']||'')+_0xc69e('0x15');_0x2d318c[_0x3818de[_0x59f593]['param']]=['SIP',_0x45f4c3[_0xc69e('0x1d')],_0x45f4c3[_0xc69e('0x25')]][_0xc69e('0x26')]('/');break;case _0xc69e('0x1f'):_0x45f4c3['options']=_0x5c7b3c[_0x3818de[_0x59f593][_0xc69e('0x23')]];if(_0x5ad595[_0xc69e('0x1a')]!=='none'){if(_0x45f4c3[_0xc69e('0x1f')][_0xc69e('0x27')](_0xc69e('0x28'))<0x0){_0x45f4c3['options']+=_0xc69e('0x28');}}else{_0x45f4c3[_0xc69e('0x1f')]=_0x45f4c3['options']['replace'](_0xc69e('0x28'),'');}_0x2d318c[_0x3818de[_0x59f593][_0xc69e('0x23')]]=_0x45f4c3[_0xc69e('0x1f')];break;default:_0x2d318c[_0x3818de[_0x59f593][_0xc69e('0x23')]]=_0x5c7b3c[_0x3818de[_0x59f593][_0xc69e('0x23')]];}}return _0x2d318c[_0xc69e('0x26')](',');}function _0x485421(_0x15e729,_0x4499e2,_0x2d7287){return new Promise(function(_0x47429c,_0x31e4d6){var _0x59b2bc=[];if(_['isEmpty'](_0x4499e2))return _0x47429c(_0x59b2bc);_0xc476b3['Interval'][_0xc69e('0x29')]({'attributes':['id','interval','IntervalId'],'raw':!![]})['then'](function(_0x5e732e){for(var _0x4d08ef=0x0,_0x5b63b5=0x0;_0x4d08ef<_0x4499e2['length'];_0x4d08ef++,_0x5b63b5=0x0){var _0x5ea297=_0x4499e2[_0x4d08ef];var _0x44ad7e=[];var _0x462f40=[];delete _0x5ea297['id'];if(_0x5ea297[_0xc69e('0x2a')]!==_0xc69e('0x2b')){_0x5ea297['intervals']=[_0x5ea297[_0xc69e('0x2a')]];}else{_0x5ea297[_0xc69e('0x2c')]=_0x5ea297[_0xc69e('0x2d')]?_[_0xc69e('0x2e')](_[_0xc69e('0x2f')](_0x5e732e,{'IntervalId':_0x5ea297[_0xc69e('0x2d')]}),_0xc69e('0x2a')):[];}_0x5ea297[_0xc69e('0x5')]=_0x15e729[_0xc69e('0x5')];_0x5ea297[_0xc69e('0xd')]=_0x15e729[_0xc69e('0xd')];if(_0x5ea297['type'])_0x5ea297[_0xc69e('0x3')]=_0x5ea297[_0xc69e('0x3')][_0xc69e('0x30')]();if(_0x15e729[_0xc69e('0x3')]===_0xc69e('0x11')){if(_0x5ea297[_0xc69e('0x31')](_0xc69e('0x32'))&&_0x5ea297['tag']&&_0x5ea297[_0xc69e('0x32')]!=='--'){_0x44ad7e['push']({'type':_0x5ea297[_0xc69e('0x3')][_0xc69e('0x30')](),'app':'Set','appdata':'CDR(tag)='+_0x5ea297['tag'],'context':_0x15e729[_0xc69e('0x5')],'exten':_0x15e729[_0xc69e('0xd')],'priority':_0x5ea297[_0xc69e('0x2c')]['length']+_0x2d7287+_0x5b63b5++,'VoiceExtensionId':_0x15e729['id']});}_0x44ad7e[_0xc69e('0xb')]({'type':_0x5ea297['type'][_0xc69e('0x30')](),'app':_0xc69e('0x16'),'appdata':_0xc69e('0x33')+(_0x5ea297['callerID']?_0xc69e('0x34')+_0x5ea297[_0xc69e('0x35')]+')':_0xc69e('0x36')),'context':_0x15e729[_0xc69e('0x5')],'exten':_0x15e729[_0xc69e('0xd')],'priority':_0x5ea297[_0xc69e('0x2c')][_0xc69e('0x21')]+_0x2d7287+_0x5b63b5++,'VoiceExtensionId':_0x15e729['id']});}else{if(_0x5ea297['hasOwnProperty'](_0xc69e('0x37'))){if([_0xc69e('0x38'),_0xc69e('0x39')][_0xc69e('0x3a')](_0x5ea297[_0xc69e('0x3b')][_0xc69e('0x30')]())&&_0x5ea297[_0xc69e('0x3c')]!=='custom'){if(_0x5ea297[_0xc69e('0x37')]){_0x44ad7e['push']({'type':_0x5ea297[_0xc69e('0x3')]['toLowerCase'](),'app':_0xc69e('0x16'),'appdata':_0xc69e('0x3d'),'context':_0x15e729['context'],'exten':_0x15e729[_0xc69e('0xd')],'priority':_0x5ea297['intervals'][_0xc69e('0x21')]+_0x2d7287+_0x5b63b5++,'VoiceExtensionId':_0x15e729['id']});_0x44ad7e[_0xc69e('0xb')]({'type':_0x5ea297[_0xc69e('0x3')]['toLowerCase'](),'app':'Set','appdata':_0xc69e('0x3e'),'context':_0x15e729[_0xc69e('0x5')],'exten':_0x15e729['exten'],'priority':_0x5ea297[_0xc69e('0x2c')][_0xc69e('0x21')]+_0x2d7287+_0x5b63b5++,'VoiceExtensionId':_0x15e729['id']});}else{_0x44ad7e[_0xc69e('0xb')]({'type':_0x5ea297[_0xc69e('0x3')][_0xc69e('0x30')](),'app':_0xc69e('0x16'),'appdata':_0xc69e('0x3f'),'context':_0x15e729[_0xc69e('0x5')],'exten':_0x15e729[_0xc69e('0xd')],'priority':_0x5ea297['intervals']['length']+_0x2d7287+_0x5b63b5++,'VoiceExtensionId':_0x15e729['id']});_0x44ad7e[_0xc69e('0xb')]({'type':_0x5ea297[_0xc69e('0x3')][_0xc69e('0x30')](),'app':_0xc69e('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x15e729[_0xc69e('0x5')],'exten':_0x15e729[_0xc69e('0xd')],'priority':_0x5ea297[_0xc69e('0x2c')]['length']+_0x2d7287+_0x5b63b5++,'VoiceExtensionId':_0x15e729['id']});}}}}for(var _0x2aace5=0x0;_0x2aace5<_0x5ea297[_0xc69e('0x2c')][_0xc69e('0x21')];_0x2aace5++){var _0xdfb11d=_0x2d7287+_0x5ea297[_0xc69e('0x2c')][_0xc69e('0x21')];var _0x18864b=_0x2aace5===_0x5ea297[_0xc69e('0x2c')][_0xc69e('0x21')]-0x1?_0x2d7287+_0x44ad7e[_0xc69e('0x21')]+_0x462f40[_0xc69e('0x21')]+0x2:_0x2d7287+_0x2aace5+0x1;_0x44ad7e[_0xc69e('0x40')](_0x2aace5,0x0,{'type':_0x15e729[_0xc69e('0x3')],'app':_0xc69e('0x41'),'appdata':_0x5ea297[_0xc69e('0x2c')][_0x2aace5]+'?'+_0x15e729[_0xc69e('0x5')]+_0xc69e('0x42')+_0xdfb11d+':'+_0x15e729[_0xc69e('0x5')]+_0xc69e('0x42')+_0x18864b,'exten':_0x15e729['exten'],'context':_0x15e729[_0xc69e('0x5')],'priority':_0x2d7287+_0x2aace5,'VoiceExtensionId':_0x15e729['id']});}if(_0x5ea297[_0xc69e('0x3c')]==='outboundDial'){_0x5ea297[_0xc69e('0x43')]=_0x109876(_0x15e729,_0x5ea297[_0xc69e('0x43')]);}if(_0x5ea297[_0xc69e('0x3c')]===_0xc69e('0x44')){_0x44ad7e[_0xc69e('0xb')]({'type':_0x5ea297['type'][_0xc69e('0x30')](),'app':_0xc69e('0x4'),'appdata':_0xc69e('0x45'),'context':_0x15e729['context'],'exten':_0x15e729[_0xc69e('0xd')],'priority':_0x5ea297['intervals']['length']+_0x2d7287+_0x5b63b5++,'VoiceExtensionId':_0x15e729['id']});}_0x5ea297['priority']=_0x44ad7e['length']?_[_0xc69e('0x46')](_0x44ad7e)[_0xc69e('0x47')]+0x1:_0x2d7287;_0x59b2bc=_[_0xc69e('0x48')](_0x59b2bc,_0x44ad7e,[_0x5ea297],_0x462f40);_0x2d7287=_['last'](_0x59b2bc)[_0xc69e('0x47')]+0x1;}return _0x47429c(_0x59b2bc);})['catch'](function(_0x4242c3){_0x31e4d6(_0x4242c3);});});}return _0x24551c[_0xc69e('0x49')](_0xc69e('0x4a'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x465dec){var _0x220bb7=this['get']({'plain':!![]});var _0x16ba83=_0x220bb7[_0xc69e('0x3')]===_0xc69e('0x11')?_0x113b92(_0x220bb7):_0x10e914(_0x220bb7);return _0x485421(_0x220bb7,_0x465dec,_[_0xc69e('0x46')](_0x16ba83)[_0xc69e('0x47')]+0x1)[_0xc69e('0x4b')](function(_0x3ab65b){var _0x64db81=_[_0xc69e('0x48')](_0x16ba83,_0x3ab65b);_0x64db81[_0xc69e('0xb')]({'type':_0x220bb7[_0xc69e('0x3')],'app':_0xc69e('0x4c'),'exten':_0x220bb7[_0xc69e('0xd')],'context':_0x220bb7[_0xc69e('0x5')],'priority':_[_0xc69e('0x46')](_0x64db81)[_0xc69e('0x47')]+0x1,'VoiceExtensionId':_0x220bb7['id']});return _0x64db81;});}}});}; \ No newline at end of file +var _0x08b8=['type','CDR(type)=','exten','NoOp','alias','No\x20alias\x20set','inbound','push','Set','context','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','url','split','length','name','phone','prefix','SIP','join','options','param','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','models'];(function(_0x4a710c,_0x1dd160){var _0x31c65d=function(_0x51869d){while(--_0x51869d){_0x4a710c['push'](_0x4a710c['shift']());}};_0x31c65d(++_0x1dd160);}(_0x08b8,0xf0));var _0x808b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x08b8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x808b('0x0'));var attributes=require(_0x808b('0x1'));module['exports']=function(_0x13676f){var _0x32c07c=_0x13676f[_0x808b('0x2')];function _0x37d729(_0x2443fb){var _0x967ada=0x2;var _0x3b5024=[{'type':_0x2443fb[_0x808b('0x3')],'app':'Set','appdata':_0x808b('0x4')+_0x2443fb['type'],'context':_0x2443fb['context'],'exten':_0x2443fb[_0x808b('0x5')],'priority':_0x967ada++,'VoiceExtensionId':_0x2443fb['id']},{'type':_0x2443fb['type'],'app':_0x2443fb['alias']?'Set':_0x808b('0x6'),'appdata':_0x2443fb[_0x808b('0x7')]?'CDR(routeAlias)='+_0x2443fb['alias']:_0x808b('0x8'),'context':_0x2443fb['context'],'exten':_0x2443fb[_0x808b('0x5')],'priority':_0x967ada++,'VoiceExtensionId':_0x2443fb['id']}];if(_0x2443fb[_0x808b('0x3')]===_0x808b('0x9')){_0x3b5024[_0x808b('0xa')]({'type':'inbound','app':_0x808b('0xb'),'appdata':'CDR(routeid)='+_0x2443fb['id'],'context':_0x2443fb[_0x808b('0xc')],'exten':_0x2443fb['exten'],'priority':_0x967ada++,'VoiceExtensionId':_0x2443fb['id']});}_0x3b5024[_0x808b('0xa')]({'type':_0x2443fb[_0x808b('0x3')],'app':_0x808b('0xb'),'appdata':_0x808b('0xd'),'context':_0x2443fb[_0x808b('0xc')],'exten':_0x2443fb['exten'],'priority':_0x967ada++,'VoiceExtensionId':_0x2443fb['id']},{'type':_0x2443fb[_0x808b('0x3')],'app':_0x808b('0xb'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2443fb[_0x808b('0xc')],'exten':_0x2443fb[_0x808b('0x5')],'priority':_0x967ada++,'VoiceExtensionId':_0x2443fb['id']},{'type':_0x2443fb[_0x808b('0x3')],'app':'Set','appdata':_0x808b('0xe'),'context':_0x2443fb['context'],'exten':_0x2443fb[_0x808b('0x5')],'priority':_0x967ada++,'VoiceExtensionId':_0x2443fb['id']});return _0x3b5024;}function _0x723da(_0x465386){var _0x202505=0x2;var _0x3a30af=[{'type':_0x808b('0xf'),'app':_0x808b('0xb'),'appdata':_0x808b('0x10'),'context':_0x465386[_0x808b('0xc')],'exten':_0x465386[_0x808b('0x5')],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':_0x465386[_0x808b('0x7')]?_0x808b('0xb'):_0x808b('0x6'),'appdata':_0x465386['alias']?_0x808b('0x11')+_0x465386[_0x808b('0x7')]:'No\x20alias\x20set','context':_0x465386[_0x808b('0xc')],'exten':_0x465386[_0x808b('0x5')],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':_0x808b('0xb'),'appdata':_0x808b('0x12')+(_0x465386[_0x808b('0x13')]?_0x808b('0x14')+_0x465386[_0x808b('0x13')]+'}':_0x808b('0x15')),'context':_0x465386[_0x808b('0xc')],'exten':_0x465386['exten'],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':_0x808b('0xb'),'appdata':'CDR(routeid)='+_0x465386['id'],'context':_0x465386[_0x808b('0xc')],'exten':_0x465386[_0x808b('0x5')],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':'ExecIf','appdata':_0x808b('0x16')+(_0x202505+0x2)+_0x808b('0x17')+(_0x202505+0x1)+')','context':_0x465386[_0x808b('0xc')],'exten':_0x465386[_0x808b('0x5')],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':'Set','appdata':_0x465386[_0x808b('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x465386[_0x808b('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x465386[_0x808b('0xc')],'exten':_0x465386[_0x808b('0x5')],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':_0x808b('0xb'),'appdata':_0x808b('0xd'),'context':_0x465386[_0x808b('0xc')],'exten':_0x465386[_0x808b('0x5')],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':_0x808b('0xb'),'appdata':_0x808b('0x18'),'context':_0x465386['context'],'exten':_0x465386['exten'],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':'outbound','app':_0x808b('0xb'),'appdata':_0x808b('0xe'),'context':_0x465386['context'],'exten':_0x465386[_0x808b('0x5')],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':_0x808b('0xb'),'appdata':_0x808b('0x19')+_0x465386['id'],'context':_0x465386[_0x808b('0xc')],'exten':_0x465386[_0x808b('0x5')],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']}];if(_0x465386[_0x808b('0x1a')](_0x808b('0x1b'))&&_0x465386['recordingFormat']!==_0x808b('0x1c')){_0x3a30af[_0x808b('0xa')]({'type':'outbound','app':_0x808b('0xb'),'appdata':_0x808b('0x1d'),'context':_0x465386['context'],'exten':_0x465386['exten'],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']},{'type':_0x808b('0xf'),'app':_0x808b('0xb'),'appdata':_0x808b('0x1e')+_0x465386[_0x808b('0x1b')]||'wav','context':_0x465386[_0x808b('0xc')],'exten':_0x465386['exten'],'priority':_0x202505++,'VoiceExtensionId':_0x465386['id']});}return _0x3a30af;}function _0x588f13(_0x28622e,_0x5bd917){var _0x3055cc=[{'name':'trunk','param':0x0},{'name':_0x808b('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x808b('0x20'),'param':0x3}];var _0x12f549={};var _0x4e8f37=_0x5bd917[_0x808b('0x21')](',');var _0xe00f9b=[];for(var _0x48570d=0x0;_0x48570d<_0x3055cc[_0x808b('0x22')];_0x48570d++){switch(_0x3055cc[_0x48570d][_0x808b('0x23')]){case'trunk':_0x12f549['trunk']=_0x4e8f37[_0x3055cc[_0x48570d]['param']][_0x808b('0x21')]('/')[0x1];_0x12f549[_0x808b('0x24')]=_0x4e8f37[_0x3055cc[_0x48570d]['param']][_0x808b('0x21')]('/')[0x2];_0x12f549[_0x808b('0x25')]=_0x12f549[_0x808b('0x24')]?_0x12f549[_0x808b('0x24')][_0x808b('0x21')]('$')[0x0]:undefined;_0x12f549[_0x808b('0x24')]=_0x28622e[_0x808b('0x13')]?(_0x12f549['prefix']||'')+'${EXTEN:'+_0x28622e[_0x808b('0x13')]+'}':(_0x12f549[_0x808b('0x25')]||'')+'${EXTEN}';_0xe00f9b[_0x3055cc[_0x48570d]['param']]=[_0x808b('0x26'),_0x12f549['trunk'],_0x12f549['phone']][_0x808b('0x27')]('/');break;case _0x808b('0x28'):_0x12f549['options']=_0x4e8f37[_0x3055cc[_0x48570d][_0x808b('0x29')]];if(_0x28622e[_0x808b('0x1b')]!==_0x808b('0x1c')){if(_0x12f549[_0x808b('0x28')][_0x808b('0x2a')]('U(xcally-mixmonitor-context)')<0x0){_0x12f549[_0x808b('0x28')]+=_0x808b('0x2b');}}else{_0x12f549[_0x808b('0x28')]=_0x12f549[_0x808b('0x28')][_0x808b('0x2c')](_0x808b('0x2b'),'');}_0xe00f9b[_0x3055cc[_0x48570d][_0x808b('0x29')]]=_0x12f549[_0x808b('0x28')];break;default:_0xe00f9b[_0x3055cc[_0x48570d][_0x808b('0x29')]]=_0x4e8f37[_0x3055cc[_0x48570d][_0x808b('0x29')]];}}return _0xe00f9b[_0x808b('0x27')](',');}function _0x1ee3fd(_0x19cce0,_0x11f490,_0x398701){return new Promise(function(_0x50f31e,_0x211e4f){var _0x434c2=[];if(_['isEmpty'](_0x11f490))return _0x50f31e(_0x434c2);_0x32c07c[_0x808b('0x2d')][_0x808b('0x2e')]({'attributes':['id','interval',_0x808b('0x2f')],'raw':!![]})[_0x808b('0x30')](function(_0x13c870){for(var _0x4e3580=0x0,_0x137236=0x0;_0x4e3580<_0x11f490[_0x808b('0x22')];_0x4e3580++,_0x137236=0x0){var _0x32df31=_0x11f490[_0x4e3580];var _0x34d3d9=[];var _0x25f556=[];delete _0x32df31['id'];if(_0x32df31[_0x808b('0x31')]!==_0x808b('0x32')){_0x32df31[_0x808b('0x33')]=[_0x32df31[_0x808b('0x31')]];}else{_0x32df31[_0x808b('0x33')]=_0x32df31['IntervalId']?_[_0x808b('0x34')](_[_0x808b('0x35')](_0x13c870,{'IntervalId':_0x32df31[_0x808b('0x2f')]}),_0x808b('0x31')):[];}_0x32df31[_0x808b('0xc')]=_0x19cce0['context'];_0x32df31[_0x808b('0x5')]=_0x19cce0['exten'];if(_0x32df31[_0x808b('0x3')])_0x32df31[_0x808b('0x3')]=_0x32df31[_0x808b('0x3')][_0x808b('0x36')]();if(_0x19cce0['type']===_0x808b('0xf')){if(_0x32df31[_0x808b('0x1a')]('tag')&&_0x32df31[_0x808b('0x37')]&&_0x32df31[_0x808b('0x37')]!=='--'){_0x34d3d9[_0x808b('0xa')]({'type':_0x32df31[_0x808b('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x808b('0x38')+_0x32df31[_0x808b('0x37')],'context':_0x19cce0[_0x808b('0xc')],'exten':_0x19cce0[_0x808b('0x5')],'priority':_0x32df31[_0x808b('0x33')][_0x808b('0x22')]+_0x398701+_0x137236++,'VoiceExtensionId':_0x19cce0['id']});}_0x34d3d9['push']({'type':_0x32df31[_0x808b('0x3')][_0x808b('0x36')](),'app':_0x808b('0x39'),'appdata':_0x808b('0x3a')+(_0x32df31[_0x808b('0x3b')]?_0x808b('0x3c')+_0x32df31['callerID']+')':_0x808b('0x3d')),'context':_0x19cce0[_0x808b('0xc')],'exten':_0x19cce0[_0x808b('0x5')],'priority':_0x32df31[_0x808b('0x33')][_0x808b('0x22')]+_0x398701+_0x137236++,'VoiceExtensionId':_0x19cce0['id']});}else{if(_0x32df31[_0x808b('0x1a')](_0x808b('0x3e'))){if([_0x808b('0x3f'),'playback']['includes'](_0x32df31[_0x808b('0x40')][_0x808b('0x36')]())&&_0x32df31[_0x808b('0x41')]!==_0x808b('0x42')){if(_0x32df31['answer']){_0x34d3d9['push']({'type':_0x32df31[_0x808b('0x3')][_0x808b('0x36')](),'app':_0x808b('0x39'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x19cce0[_0x808b('0xc')],'exten':_0x19cce0[_0x808b('0x5')],'priority':_0x32df31[_0x808b('0x33')][_0x808b('0x22')]+_0x398701+_0x137236++,'VoiceExtensionId':_0x19cce0['id']});_0x34d3d9[_0x808b('0xa')]({'type':_0x32df31[_0x808b('0x3')][_0x808b('0x36')](),'app':'Set','appdata':_0x808b('0x43'),'context':_0x19cce0[_0x808b('0xc')],'exten':_0x19cce0['exten'],'priority':_0x32df31[_0x808b('0x33')][_0x808b('0x22')]+_0x398701+_0x137236++,'VoiceExtensionId':_0x19cce0['id']});}else{_0x34d3d9['push']({'type':_0x32df31[_0x808b('0x3')][_0x808b('0x36')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x19cce0['context'],'exten':_0x19cce0[_0x808b('0x5')],'priority':_0x32df31[_0x808b('0x33')][_0x808b('0x22')]+_0x398701+_0x137236++,'VoiceExtensionId':_0x19cce0['id']});_0x34d3d9[_0x808b('0xa')]({'type':_0x32df31['type'][_0x808b('0x36')](),'app':_0x808b('0xb'),'appdata':_0x808b('0x44'),'context':_0x19cce0[_0x808b('0xc')],'exten':_0x19cce0[_0x808b('0x5')],'priority':_0x32df31[_0x808b('0x33')]['length']+_0x398701+_0x137236++,'VoiceExtensionId':_0x19cce0['id']});}}}}for(var _0x5c00dd=0x0;_0x5c00dd<_0x32df31[_0x808b('0x33')]['length'];_0x5c00dd++){var _0x10480b=_0x398701+_0x32df31[_0x808b('0x33')][_0x808b('0x22')];var _0x33c6dc=_0x5c00dd===_0x32df31[_0x808b('0x33')][_0x808b('0x22')]-0x1?_0x398701+_0x34d3d9[_0x808b('0x22')]+_0x25f556[_0x808b('0x22')]+0x2:_0x398701+_0x5c00dd+0x1;_0x34d3d9['splice'](_0x5c00dd,0x0,{'type':_0x19cce0[_0x808b('0x3')],'app':_0x808b('0x45'),'appdata':_0x32df31[_0x808b('0x33')][_0x5c00dd]+'?'+_0x19cce0[_0x808b('0xc')]+_0x808b('0x46')+_0x10480b+':'+_0x19cce0['context']+_0x808b('0x46')+_0x33c6dc,'exten':_0x19cce0['exten'],'context':_0x19cce0['context'],'priority':_0x398701+_0x5c00dd,'VoiceExtensionId':_0x19cce0['id']});}if(_0x32df31[_0x808b('0x41')]==='outboundDial'){_0x32df31['appdata']=_0x588f13(_0x19cce0,_0x32df31['appdata']);}if(_0x32df31[_0x808b('0x41')]===_0x808b('0x47')){_0x34d3d9['push']({'type':_0x32df31['type']['toLowerCase'](),'app':_0x808b('0xb'),'appdata':_0x808b('0x48'),'context':_0x19cce0[_0x808b('0xc')],'exten':_0x19cce0['exten'],'priority':_0x32df31[_0x808b('0x33')][_0x808b('0x22')]+_0x398701+_0x137236++,'VoiceExtensionId':_0x19cce0['id']});}_0x32df31[_0x808b('0x49')]=_0x34d3d9[_0x808b('0x22')]?_[_0x808b('0x4a')](_0x34d3d9)[_0x808b('0x49')]+0x1:_0x398701;_0x434c2=_[_0x808b('0x4b')](_0x434c2,_0x34d3d9,[_0x32df31],_0x25f556);_0x398701=_[_0x808b('0x4a')](_0x434c2)[_0x808b('0x49')]+0x1;}return _0x50f31e(_0x434c2);})[_0x808b('0x4c')](function(_0x355f74){_0x211e4f(_0x355f74);});});}return _0x13676f[_0x808b('0x4d')](_0x808b('0x4e'),attributes,{'tableName':_0x808b('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1b103d){var _0x556762=this[_0x808b('0x50')]({'plain':!![]});var _0x27ea03=_0x556762[_0x808b('0x3')]===_0x808b('0xf')?_0x723da(_0x556762):_0x37d729(_0x556762);return _0x1ee3fd(_0x556762,_0x1b103d,_[_0x808b('0x4a')](_0x27ea03)[_0x808b('0x49')]+0x1)[_0x808b('0x30')](function(_0x2897e2){var _0x378a3d=_[_0x808b('0x4b')](_0x27ea03,_0x2897e2);_0x378a3d[_0x808b('0xa')]({'type':_0x556762[_0x808b('0x3')],'app':'Hangup','exten':_0x556762[_0x808b('0x5')],'context':_0x556762['context'],'priority':_['last'](_0x378a3d)[_0x808b('0x49')]+0x1,'VoiceExtensionId':_0x556762['id']});return _0x378a3d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7c6dc8e..cf6ad2e 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 _0x5e11=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x47d38f,_0x2be751){var _0x4f96bc=function(_0x3b7e22){while(--_0x3b7e22){_0x47d38f['push'](_0x47d38f['shift']());}};_0x4f96bc(++_0x2be751);}(_0x5e11,0x1c3));var _0x15e1=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0x5e11[_0x5f08a6];return _0x5d0641;};'use strict';var _=require(_0x15e1('0x0'));var util=require('util');var moment=require(_0x15e1('0x1'));var BPromise=require(_0x15e1('0x2'));var rs=require(_0x15e1('0x3'));var fs=require('fs');var Redis=require(_0x15e1('0x4'));var db=require(_0x15e1('0x5'))['db'];var utils=require(_0x15e1('0x6'));var logger=require('../../config/logger')(_0x15e1('0x7'));var config=require('../../config/environment');var jayson=require(_0x15e1('0x8'));var client=jayson[_0x15e1('0x9')][_0x15e1('0xa')]({'port':0x232a});config[_0x15e1('0xb')]=_[_0x15e1('0xc')](config['redis'],{'host':_0x15e1('0xd'),'port':0x18eb});var socket=require(_0x15e1('0xe'))(new Redis(config[_0x15e1('0xb')]));require(_0x15e1('0xf'))['register'](socket);function respondWithRpcPromise(_0x1d8828,_0x3cc7d8,_0x26ec40){return new BPromise(function(_0x4e7409,_0x3e0319){return client[_0x15e1('0x10')](_0x1d8828,_0x26ec40)[_0x15e1('0x11')](function(_0x178ffd){logger[_0x15e1('0x12')](_0x15e1('0x13'),_0x3cc7d8,_0x15e1('0x14'));logger[_0x15e1('0x15')](_0x15e1('0x16'),_0x3cc7d8,_0x15e1('0x14'),JSON[_0x15e1('0x17')](_0x178ffd));if(_0x178ffd[_0x15e1('0x18')]){if(_0x178ffd['error'][_0x15e1('0x19')]===0x1f4){logger[_0x15e1('0x18')](_0x15e1('0x13'),_0x3cc7d8,_0x178ffd['error'][_0x15e1('0x1a')]);return _0x3e0319(_0x178ffd[_0x15e1('0x18')]['message']);}logger[_0x15e1('0x18')](_0x15e1('0x13'),_0x3cc7d8,_0x178ffd[_0x15e1('0x18')][_0x15e1('0x1a')]);return _0x4e7409(_0x178ffd[_0x15e1('0x18')][_0x15e1('0x1a')]);}else{logger[_0x15e1('0x12')](_0x15e1('0x13'),_0x3cc7d8,_0x15e1('0x14'));_0x4e7409(_0x178ffd[_0x15e1('0x1b')][_0x15e1('0x1a')]);}})[_0x15e1('0x1c')](function(_0x29e433){logger[_0x15e1('0x18')](_0x15e1('0x13'),_0x3cc7d8,_0x29e433);_0x3e0319(_0x29e433);});});}exports[_0x15e1('0x1d')]=function(_0x533e00){var _0x25dd7d=this;return new Promise(function(_0xb28b8b,_0x5de6d9){return db[_0x15e1('0x1e')][_0x15e1('0x1f')]({'raw':_0x533e00[_0x15e1('0x20')]?_0x533e00[_0x15e1('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x533e00['options']?_0x533e00[_0x15e1('0x20')][_0x15e1('0x21')]||null:null,'attributes':_0x533e00[_0x15e1('0x20')]?_0x533e00[_0x15e1('0x20')][_0x15e1('0x22')]||null:null,'limit':_0x533e00[_0x15e1('0x20')]?_0x533e00[_0x15e1('0x20')]['limit']||null:null,'include':_0x533e00['options']?_0x533e00[_0x15e1('0x20')][_0x15e1('0x23')]?_['map'](_0x533e00['options'][_0x15e1('0x23')],function(_0x130ed6){return{'model':db[_0x130ed6['model']],'as':_0x130ed6['as'],'attributes':_0x130ed6[_0x15e1('0x22')],'include':_0x130ed6[_0x15e1('0x23')]?_[_0x15e1('0x24')](_0x130ed6[_0x15e1('0x23')],function(_0x3ecffa){return{'model':db[_0x3ecffa['model']],'as':_0x3ecffa['as'],'attributes':_0x3ecffa['attributes'],'include':_0x3ecffa['include']?_[_0x15e1('0x24')](_0x3ecffa['include'],function(_0x2dd839){return{'model':db[_0x2dd839[_0x15e1('0x25')]],'as':_0x2dd839['as'],'attributes':_0x2dd839[_0x15e1('0x22')]};}):[]};}):[]};}):[]:[]})[_0x15e1('0x11')](function(_0x40f5ef){logger['info'](_0x15e1('0x1d'),_0x533e00);logger['debug'](_0x15e1('0x1d'),_0x533e00,JSON['stringify'](_0x40f5ef));_0xb28b8b(_0x40f5ef);})['catch'](function(_0x2bc1e6){logger['error']('GetVoiceExtension',_0x2bc1e6['message'],_0x533e00);_0x5de6d9(_0x25dd7d[_0x15e1('0x18')](0x1f4,_0x2bc1e6[_0x15e1('0x1a')]));});});}; \ No newline at end of file +var _0x814b=['include','map','model','attributes','then','info','GetVoiceExtension','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','limit'];(function(_0x2f32fd,_0x51c18c){var _0x16826c=function(_0x5a75b1){while(--_0x5a75b1){_0x2f32fd['push'](_0x2f32fd['shift']());}};_0x16826c(++_0x51c18c);}(_0x814b,0x1a2));var _0xb814=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x814b[_0x54381d];return _0x5308a7;};'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});config[_0xb814('0xc')]=_[_0xb814('0xd')](config['redis'],{'host':_0xb814('0xe'),'port':0x18eb});var socket=require(_0xb814('0xf'))(new Redis(config[_0xb814('0xc')]));require(_0xb814('0x10'))[_0xb814('0x11')](socket);function respondWithRpcPromise(_0x21d4a5,_0x1086f8,_0x19aad8){return new BPromise(function(_0x207dbc,_0x3450f2){return client[_0xb814('0x12')](_0x21d4a5,_0x19aad8)['then'](function(_0x43dfe6){logger['info'](_0xb814('0x13'),_0x1086f8,_0xb814('0x14'));logger[_0xb814('0x15')](_0xb814('0x16'),_0x1086f8,_0xb814('0x14'),JSON[_0xb814('0x17')](_0x43dfe6));if(_0x43dfe6[_0xb814('0x18')]){if(_0x43dfe6[_0xb814('0x18')][_0xb814('0x19')]===0x1f4){logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x3450f2(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}logger[_0xb814('0x18')](_0xb814('0x13'),_0x1086f8,_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);return _0x207dbc(_0x43dfe6[_0xb814('0x18')][_0xb814('0x1a')]);}else{logger['info'](_0xb814('0x13'),_0x1086f8,'request\x20sent');_0x207dbc(_0x43dfe6[_0xb814('0x1b')][_0xb814('0x1a')]);}})['catch'](function(_0x4b55a7){logger['error'](_0xb814('0x13'),_0x1086f8,_0x4b55a7);_0x3450f2(_0x4b55a7);});});}exports['GetVoiceExtension']=function(_0x57c128){var _0xb684ea=this;return new Promise(function(_0x24211d,_0x25b6b6){return db['VoiceExtension'][_0xb814('0x1c')]({'raw':_0x57c128['options']?_0x57c128[_0xb814('0x1d')][_0xb814('0x1e')]===undefined?!![]:![]:!![],'where':_0x57c128[_0xb814('0x1d')]?_0x57c128[_0xb814('0x1d')][_0xb814('0x1f')]||null:null,'attributes':_0x57c128[_0xb814('0x1d')]?_0x57c128[_0xb814('0x1d')]['attributes']||null:null,'limit':_0x57c128[_0xb814('0x1d')]?_0x57c128['options'][_0xb814('0x20')]||null:null,'include':_0x57c128[_0xb814('0x1d')]?_0x57c128[_0xb814('0x1d')][_0xb814('0x21')]?_[_0xb814('0x22')](_0x57c128[_0xb814('0x1d')][_0xb814('0x21')],function(_0x5755ea){return{'model':db[_0x5755ea[_0xb814('0x23')]],'as':_0x5755ea['as'],'attributes':_0x5755ea[_0xb814('0x24')],'include':_0x5755ea[_0xb814('0x21')]?_[_0xb814('0x22')](_0x5755ea[_0xb814('0x21')],function(_0x1d5965){return{'model':db[_0x1d5965[_0xb814('0x23')]],'as':_0x1d5965['as'],'attributes':_0x1d5965[_0xb814('0x24')],'include':_0x1d5965['include']?_[_0xb814('0x22')](_0x1d5965[_0xb814('0x21')],function(_0x52ed64){return{'model':db[_0x52ed64[_0xb814('0x23')]],'as':_0x52ed64['as'],'attributes':_0x52ed64[_0xb814('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb814('0x25')](function(_0x499f22){logger[_0xb814('0x26')](_0xb814('0x27'),_0x57c128);logger['debug'](_0xb814('0x27'),_0x57c128,JSON['stringify'](_0x499f22));_0x24211d(_0x499f22);})[_0xb814('0x28')](function(_0x5f3e9b){logger['error'](_0xb814('0x27'),_0x5f3e9b['message'],_0x57c128);_0x25b6b6(_0xb684ea[_0xb814('0x18')](0x1f4,_0x5f3e9b[_0xb814('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 2d74d17..f453166 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x18d783,_0x3d3d5e){var _0x2f8e21=function(_0xadb91d){while(--_0xadb91d){_0x18d783['push'](_0x18d783['shift']());}};_0x2f8e21(++_0x3d3d5e);}(_0x0295,0x1f0));var _0x5029=function(_0x2b2c2f,_0x645409){_0x2b2c2f=_0x2b2c2f-0x0;var _0x2984ea=_0x0295[_0x2b2c2f];return _0x2984ea;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x4125e8,_0x2ab373){var _0x53cb6d=function(_0x6aee8a){while(--_0x6aee8a){_0x4125e8['push'](_0x4125e8['shift']());}};_0x53cb6d(++_0x2ab373);}(_0x1261,0x144));var _0x1126=function(_0x14e001,_0x569bf){_0x14e001=_0x14e001-0x0;var _0x2c09da=_0x1261[_0x14e001];return _0x2c09da;};'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 c77134f..c3f5449 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 _0x5496=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get','isAuthenticated','show','getMessages','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x3ff96e,_0x1e2ee4){var _0x4b9a9c=function(_0x9aa12){while(--_0x9aa12){_0x3ff96e['push'](_0x3ff96e['shift']());}};_0x4b9a9c(++_0x1e2ee4);}(_0x5496,0x175));var _0x6549=function(_0x580586,_0x424e4a){_0x580586=_0x580586-0x0;var _0x448a25=_0x5496[_0x580586];return _0x448a25;};'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')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id/messages',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')]('/',auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router[_0x6549('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6549('0x11')]);router[_0x6549('0x12')](_0x6549('0x13'),auth[_0x6549('0xb')](),controller[_0x6549('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5496=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get','isAuthenticated','show','getMessages','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0xba7bca,_0x477e46){var _0x2bf83d=function(_0x3b4f73){while(--_0x3b4f73){_0xba7bca['push'](_0xba7bca['shift']());}};_0x2bf83d(++_0x477e46);}(_0x5496,0x175));var _0x6549=function(_0x174067,_0x166f3e){_0x174067=_0x174067-0x0;var _0x48feb0=_0x5496[_0x174067];return _0x48feb0;};'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')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id/messages',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')]('/',auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router[_0x6549('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6549('0x11')]);router[_0x6549('0x12')](_0x6549('0x13'),auth[_0x6549('0xb')](),controller[_0x6549('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 50e7238..62163bd 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 _0xce64=['ENUM','yes','TINYINT(4)','INTEGER','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0xce64,0x92));var _0x4ce6=function(_0x44a574,_0x3bbe34){_0x44a574=_0x44a574-0x0;var _0x195dde=_0xce64[_0x44a574];return _0x195dde;};'use strict';var Sequelize=require(_0x4ce6('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4ce6('0x1')],'defaultValue':_0x4ce6('0x2'),'unique':_0x4ce6('0x3')},'mailbox':{'type':Sequelize[_0x4ce6('0x1')],'defaultValue':'','allowNull':![],'unique':_0x4ce6('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x5bc4e1){this[_0x4ce6('0x4')]('email',typeof _0x5bc4e1===_0x4ce6('0x5')&&_0x5bc4e1[_0x4ce6('0x6')]()?_0x5bc4e1[_0x4ce6('0x6')]():null);}},'pager':{'type':Sequelize[_0x4ce6('0x1')]},'tz':{'type':Sequelize[_0x4ce6('0x1')],'defaultValue':_0x4ce6('0x7')},'attach':{'type':Sequelize[_0x4ce6('0x8')]('yes','no'),'defaultValue':_0x4ce6('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':_0x4ce6('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4ce6('0x1')]},'callback':{'type':Sequelize[_0x4ce6('0x1')]},'review':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x4ce6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4ce6('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x4ce6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':_0x4ce6('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4ce6('0x8')](_0x4ce6('0x9'),'no'),'defaultValue':_0x4ce6('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x4ce6('0x1')]},'emailbody':{'type':Sequelize[_0x4ce6('0x1')]},'maxsecs':{'type':Sequelize[_0x4ce6('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4ce6('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4ce6('0xc')]('fullname')+'\x20-\x20'+this[_0x4ce6('0xc')](_0x4ce6('0xd'));}}}; \ No newline at end of file +var _0x7087=['from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING'];(function(_0x352a3e,_0x13108c){var _0x51ef3f=function(_0xe7287b){while(--_0xe7287b){_0x352a3e['push'](_0x352a3e['shift']());}};_0x51ef3f(++_0x13108c);}(_0x7087,0x1c0));var _0x7708=function(_0x1ff7d0,_0xaa0357){_0x1ff7d0=_0x1ff7d0-0x0;var _0x321557=_0x7087[_0x1ff7d0];return _0x321557;};'use strict';var Sequelize=require(_0x7708('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x7708('0x1')]},'context':{'type':Sequelize[_0x7708('0x1')],'defaultValue':_0x7708('0x2'),'unique':_0x7708('0x3')},'mailbox':{'type':Sequelize[_0x7708('0x1')],'defaultValue':'','allowNull':![],'unique':_0x7708('0x3')},'password':{'type':Sequelize[_0x7708('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7708('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5c8624){this['setDataValue']('email',typeof _0x5c8624===_0x7708('0x4')&&_0x5c8624[_0x7708('0x5')]()?_0x5c8624['trim']():null);}},'pager':{'type':Sequelize[_0x7708('0x1')]},'tz':{'type':Sequelize[_0x7708('0x1')],'defaultValue':_0x7708('0x6')},'attach':{'type':Sequelize[_0x7708('0x7')](_0x7708('0x8'),'no'),'defaultValue':_0x7708('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7708('0x7')](_0x7708('0x8'),'no'),'defaultValue':_0x7708('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7708('0x1')]},'callback':{'type':Sequelize[_0x7708('0x1')]},'review':{'type':Sequelize[_0x7708('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7708('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7708('0x7')](_0x7708('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7708('0x7')](_0x7708('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7708('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7708('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7708('0x7')](_0x7708('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7708('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x7708('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7708('0x7')](_0x7708('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7708('0x7')](_0x7708('0x8'),'no'),'defaultValue':_0x7708('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x7708('0x1')]},'emailbody':{'type':Sequelize[_0x7708('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7708('0xa')],'get':function(){return this['getDataValue'](_0x7708('0xb'))+_0x7708('0xc')+this[_0x7708('0xd')](_0x7708('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c67d51f..3693eed 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 _0xe5b5=['stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','merge','options','VoiceMail','includeAll','include','findAll','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xe5b5[_0x31a37b];return _0x49ae16;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){var _0x26bc02=_0x135c6c[_0x5e5b('0x29')]({'plain':!![]});var _0x4da321=_0x5e5b('0x2a');return db[_0x5e5b('0x2b')][_0x5e5b('0x28')]({'where':{'type':_0x4da321,'resourceId':_0x26bc02['id']}})['then'](function(){return _0x135c6c;});})[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ff91,_0x21c74b){return function(_0x39ce16){if(!_0x39ce16){_0x13ff91[_0x5e5b('0x1b')](0x194);}return _0x39ce16;};}function handleError(_0x31af09,_0x250fbd){_0x250fbd=_0x250fbd||0x1f4;return function(_0x2cb695){logger[_0x5e5b('0x2c')](_0x2cb695[_0x5e5b('0x2d')]);if(_0x2cb695[_0x5e5b('0x2e')]){delete _0x2cb695[_0x5e5b('0x2e')];}_0x31af09[_0x5e5b('0x1c')](_0x250fbd)['send'](_0x2cb695);};}exports['index']=function(_0x365f6f,_0x289f54){var _0xb68419={},_0x3dcdab={},_0x12f1ee={'count':0x0,'rows':[]};var _0x4b9be8=_[_0x5e5b('0x2f')](db['VoiceMail'][_0x5e5b('0x30')],function(_0x384d8f){return{'name':_0x384d8f[_0x5e5b('0x31')],'type':_0x384d8f[_0x5e5b('0x32')]['key']};});_0x3dcdab[_0x5e5b('0x33')]=_[_0x5e5b('0x2f')](_0x4b9be8,'name');_0x3dcdab[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x365f6f[_0x5e5b('0x34')]);_0x3dcdab[_0x5e5b('0x36')]=_[_0x5e5b('0x37')](_0x3dcdab[_0x5e5b('0x33')],_0x3dcdab[_0x5e5b('0x34')]);_0xb68419[_0x5e5b('0x38')]=_['intersection'](_0x3dcdab[_0x5e5b('0x33')],qs[_0x5e5b('0x39')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x39')]));_0xb68419[_0x5e5b('0x38')]=_0xb68419[_0x5e5b('0x38')]['length']?_0xb68419['attributes']:_0x3dcdab[_0x5e5b('0x33')];if(!_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3a')]('nolimit')){_0xb68419[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3b')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3b')]);_0xb68419['offset']=qs[_0x5e5b('0x1e')](_0x365f6f[_0x5e5b('0x34')]['offset']);}_0xb68419['order']=qs[_0x5e5b('0x3c')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3c')]);_0xb68419['where']=qs[_0x5e5b('0x36')](_['pick'](_0x365f6f['query'],_0x3dcdab[_0x5e5b('0x36')]),_0x4b9be8);if(_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3d')]){_0xb68419[_0x5e5b('0x3e')]=_[_0x5e5b('0x3f')](_0xb68419[_0x5e5b('0x3e')],{'$or':_[_0x5e5b('0x2f')](_0x4b9be8,function(_0x14ac35){if(_0x14ac35[_0x5e5b('0x32')]!=='VIRTUAL'){var _0x1f1907={};_0x1f1907[_0x14ac35[_0x5e5b('0x2e')]]={'$like':'%'+_0x365f6f['query'][_0x5e5b('0x3d')]+'%'};return _0x1f1907;}})});}_0xb68419=_['merge']({},_0xb68419,_0x365f6f[_0x5e5b('0x40')]);var _0x14b152={'where':_0xb68419[_0x5e5b('0x3e')]};return db[_0x5e5b('0x41')][_0x5e5b('0x20')](_0x14b152)[_0x5e5b('0x27')](function(_0x371550){_0x12f1ee[_0x5e5b('0x20')]=_0x371550;if(_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x42')]){_0xb68419[_0x5e5b('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x5e5b('0x44')](_0xb68419);})[_0x5e5b('0x27')](function(_0x46fec9){_0x12f1ee['rows']=_0x46fec9;return _0x12f1ee;})[_0x5e5b('0x27')](respondWithFilteredResult(_0x289f54,_0xb68419))[_0x5e5b('0x45')](handleError(_0x289f54,null));};exports['show']=function(_0x6672d9,_0x44b7be){var _0x5d3135={'raw':!![],'where':{'id':_0x6672d9['params']['id']}},_0x257bb7={};_0x257bb7['model']=_['keys'](db[_0x5e5b('0x41')]['rawAttributes']);_0x257bb7[_0x5e5b('0x34')]=_['keys'](_0x6672d9[_0x5e5b('0x34')]);_0x257bb7[_0x5e5b('0x36')]=_[_0x5e5b('0x37')](_0x257bb7[_0x5e5b('0x33')],_0x257bb7[_0x5e5b('0x34')]);_0x5d3135[_0x5e5b('0x38')]=_[_0x5e5b('0x37')](_0x257bb7['model'],qs['fields'](_0x6672d9[_0x5e5b('0x34')]['fields']));_0x5d3135['attributes']=_0x5d3135['attributes'][_0x5e5b('0x46')]?_0x5d3135['attributes']:_0x257bb7[_0x5e5b('0x33')];if(_0x6672d9[_0x5e5b('0x34')][_0x5e5b('0x42')]){_0x5d3135[_0x5e5b('0x43')]=[{'all':!![]}];}_0x5d3135=_[_0x5e5b('0x3f')]({},_0x5d3135,_0x6672d9[_0x5e5b('0x40')]);return db['VoiceMail'][_0x5e5b('0x47')](_0x5d3135)[_0x5e5b('0x27')](handleEntityNotFound(_0x44b7be,null))['then'](respondWithResult(_0x44b7be,null))[_0x5e5b('0x45')](handleError(_0x44b7be,null));};exports['create']=function(_0x41e4b3,_0x36d8fa){return db[_0x5e5b('0x41')][_0x5e5b('0x48')](_0x41e4b3['body'],{})[_0x5e5b('0x27')](function(_0x1c4efe){var _0x4f4ea3=_0x41e4b3[_0x5e5b('0x49')][_0x5e5b('0x29')]({'plain':!![]});if(!_0x4f4ea3)throw new Error(_0x5e5b('0x4a'));if(_0x4f4ea3[_0x5e5b('0x4b')]===_0x5e5b('0x49')){var _0x5ae8d0=_0x1c4efe['get']({'plain':!![]});var _0x690f8c=_0x5e5b('0x2a');return db['UserProfileSection'][_0x5e5b('0x47')]({'where':{'name':_0x690f8c,'userProfileId':_0x4f4ea3[_0x5e5b('0x4c')]},'raw':!![]})[_0x5e5b('0x27')](function(_0x5a9eae){if(_0x5a9eae&&_0x5a9eae[_0x5e5b('0x4d')]===0x0){return db[_0x5e5b('0x2b')][_0x5e5b('0x48')]({'name':_0x5ae8d0['name'],'resourceId':_0x5ae8d0['id'],'type':_0x5a9eae[_0x5e5b('0x2e')],'sectionId':_0x5a9eae['id']},{})[_0x5e5b('0x27')](function(){return _0x1c4efe;});}else{return _0x1c4efe;}})[_0x5e5b('0x45')](function(_0x4a4e0f){logger['error'](_0x5e5b('0x4e'),_0x4a4e0f);throw _0x4a4e0f;});}return _0x1c4efe;})['then'](respondWithResult(_0x36d8fa,0xc9))['catch'](handleError(_0x36d8fa,null));};exports[_0x5e5b('0x26')]=function(_0x13eee9,_0x4774ee){if(_0x13eee9['body']['id']){delete _0x13eee9[_0x5e5b('0x4f')]['id'];}return db[_0x5e5b('0x41')][_0x5e5b('0x47')]({'where':{'id':_0x13eee9[_0x5e5b('0x50')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x4774ee,null))[_0x5e5b('0x27')](saveUpdates(_0x13eee9['body'],null))['then'](respondWithResult(_0x4774ee,null))[_0x5e5b('0x45')](handleError(_0x4774ee,null));};exports[_0x5e5b('0x28')]=function(_0x1cc741,_0x357e55){return db['VoiceMail'][_0x5e5b('0x47')]({'where':{'id':_0x1cc741['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x357e55,null))[_0x5e5b('0x27')](removeEntity(_0x357e55,null))[_0x5e5b('0x45')](handleError(_0x357e55,null));};exports[_0x5e5b('0x51')]=function(_0x2d17b0,_0x30b010,_0x275930){return db[_0x5e5b('0x41')]['findOne']({'where':{'id':_0x2d17b0[_0x5e5b('0x50')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x30b010,null))[_0x5e5b('0x27')](function(_0x1aea38){var _0x129026;var _0x5543eb={},_0x2ccee2={};_0x2ccee2[_0x5e5b('0x33')]=_[_0x5e5b('0x35')](db[_0x5e5b('0x52')][_0x5e5b('0x30')]);_0x2ccee2['query']=_[_0x5e5b('0x35')](_0x2d17b0['query']);_0x2ccee2[_0x5e5b('0x36')]=_['intersection'](_0x2ccee2[_0x5e5b('0x33')],_0x2ccee2[_0x5e5b('0x34')]);_0x5543eb[_0x5e5b('0x38')]=_[_0x5e5b('0x37')](_0x2ccee2[_0x5e5b('0x33')],qs[_0x5e5b('0x39')](_0x2d17b0['query'][_0x5e5b('0x39')]));_0x5543eb[_0x5e5b('0x38')]=_0x5543eb[_0x5e5b('0x38')][_0x5e5b('0x46')]?_0x5543eb['attributes']:_0x2ccee2['model'];if(!_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3a')]('nolimit')){_0x5543eb[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3b')](_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3b')]);_0x5543eb[_0x5e5b('0x1e')]=qs['offset'](_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x1e')]);}_0x5543eb['order']=qs['sort'](_0x2d17b0['query'][_0x5e5b('0x3c')]);_0x5543eb[_0x5e5b('0x3e')]=qs[_0x5e5b('0x36')](_[_0x5e5b('0x53')](_0x2d17b0[_0x5e5b('0x34')],_0x2ccee2['filters']));if(_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3d')]){_0x5543eb['where']=_[_0x5e5b('0x3f')](_0x5543eb['where'],{'$or':_['map'](_0x5543eb[_0x5e5b('0x38')],function(_0x4fa0db){var _0x454026={};_0x454026[_0x4fa0db]={'$like':'%'+_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3d')]+'%'};return _0x454026;})});}_0x5543eb[_0x5e5b('0x3e')]=_[_0x5e5b('0x3f')](_0x5543eb['where'],{'mailboxuser':_0x1aea38[_0x5e5b('0x54')]});_0x5543eb=_[_0x5e5b('0x3f')]({},_0x5543eb,_0x2d17b0[_0x5e5b('0x40')]);return db[_0x5e5b('0x52')][_0x5e5b('0x55')](_0x5543eb)[_0x5e5b('0x27')](respondWithFilteredResult(_0x30b010,_0x5543eb));})[_0x5e5b('0x45')](handleError(_0x30b010,null));}; \ No newline at end of file +var _0x087b=['catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','destroy','getMessages','findOne','hasOwnProperty','order','mailbox','VoiceMailMessage','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','options','includeAll','include','findAll','show','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x087b,0x11a));var _0xb087=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x087b[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){var _0xdd4216=_0x3ad74e['get']({'plain':!![]});var _0x5a2dc6='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0x5a2dc6,'resourceId':_0xdd4216['id']}})[_0xb087('0x27')](function(){return _0x3ad74e;});})[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)[_0xb087('0x1d')]();});}};}function handleEntityNotFound(_0xd9ec66,_0xb72173){return function(_0xf3f41f){if(!_0xf3f41f){_0xd9ec66[_0xb087('0x1b')](0x194);}return _0xf3f41f;};}function handleError(_0x6cfb22,_0x1551c3){_0x1551c3=_0x1551c3||0x1f4;return function(_0x18058c){logger[_0xb087('0x28')](_0x18058c[_0xb087('0x29')]);if(_0x18058c[_0xb087('0x2a')]){delete _0x18058c['name'];}_0x6cfb22[_0xb087('0x1c')](_0x1551c3)[_0xb087('0x2b')](_0x18058c);};}exports[_0xb087('0x2c')]=function(_0x15c9ac,_0x22d441){var _0xa6d90c={},_0x2e1c57={},_0x13fb2f={'count':0x0,'rows':[]};var _0x53a535=_['map'](db[_0xb087('0x2d')][_0xb087('0x2e')],function(_0x4cb5a8){return{'name':_0x4cb5a8[_0xb087('0x2f')],'type':_0x4cb5a8[_0xb087('0x30')][_0xb087('0x31')]};});_0x2e1c57[_0xb087('0x32')]=_[_0xb087('0x33')](_0x53a535,_0xb087('0x2a'));_0x2e1c57[_0xb087('0x34')]=_[_0xb087('0x35')](_0x15c9ac[_0xb087('0x34')]);_0x2e1c57[_0xb087('0x36')]=_[_0xb087('0x37')](_0x2e1c57[_0xb087('0x32')],_0x2e1c57['query']);_0xa6d90c[_0xb087('0x38')]=_['intersection'](_0x2e1c57[_0xb087('0x32')],qs[_0xb087('0x39')](_0x15c9ac[_0xb087('0x34')][_0xb087('0x39')]));_0xa6d90c[_0xb087('0x38')]=_0xa6d90c[_0xb087('0x38')][_0xb087('0x3a')]?_0xa6d90c[_0xb087('0x38')]:_0x2e1c57[_0xb087('0x32')];if(!_0x15c9ac['query']['hasOwnProperty'](_0xb087('0x3b'))){_0xa6d90c[_0xb087('0x20')]=qs[_0xb087('0x20')](_0x15c9ac[_0xb087('0x34')][_0xb087('0x20')]);_0xa6d90c['offset']=qs[_0xb087('0x1f')](_0x15c9ac[_0xb087('0x34')]['offset']);}_0xa6d90c['order']=qs[_0xb087('0x3c')](_0x15c9ac[_0xb087('0x34')][_0xb087('0x3c')]);_0xa6d90c['where']=qs[_0xb087('0x36')](_[_0xb087('0x3d')](_0x15c9ac[_0xb087('0x34')],_0x2e1c57[_0xb087('0x36')]),_0x53a535);if(_0x15c9ac[_0xb087('0x34')]['filter']){_0xa6d90c[_0xb087('0x3e')]=_['merge'](_0xa6d90c[_0xb087('0x3e')],{'$or':_['map'](_0x53a535,function(_0x52a98f){if(_0x52a98f[_0xb087('0x30')]!=='VIRTUAL'){var _0xed47c4={};_0xed47c4[_0x52a98f['name']]={'$like':'%'+_0x15c9ac[_0xb087('0x34')]['filter']+'%'};return _0xed47c4;}})});}_0xa6d90c=_[_0xb087('0x3f')]({},_0xa6d90c,_0x15c9ac[_0xb087('0x40')]);var _0x364b1d={'where':_0xa6d90c[_0xb087('0x3e')]};return db[_0xb087('0x2d')][_0xb087('0x22')](_0x364b1d)[_0xb087('0x27')](function(_0x5e7690){_0x13fb2f[_0xb087('0x22')]=_0x5e7690;if(_0x15c9ac['query'][_0xb087('0x41')]){_0xa6d90c[_0xb087('0x42')]=[{'all':!![]}];}return db['VoiceMail'][_0xb087('0x43')](_0xa6d90c);})[_0xb087('0x27')](function(_0x7650c5){_0x13fb2f['rows']=_0x7650c5;return _0x13fb2f;})[_0xb087('0x27')](respondWithFilteredResult(_0x22d441,_0xa6d90c))['catch'](handleError(_0x22d441,null));};exports[_0xb087('0x44')]=function(_0x32b9d3,_0x5e7f45){var _0x38cb9d={'raw':!![],'where':{'id':_0x32b9d3['params']['id']}},_0x302ce7={};_0x302ce7[_0xb087('0x32')]=_[_0xb087('0x35')](db['VoiceMail'][_0xb087('0x2e')]);_0x302ce7[_0xb087('0x34')]=_[_0xb087('0x35')](_0x32b9d3[_0xb087('0x34')]);_0x302ce7['filters']=_['intersection'](_0x302ce7[_0xb087('0x32')],_0x302ce7[_0xb087('0x34')]);_0x38cb9d[_0xb087('0x38')]=_[_0xb087('0x37')](_0x302ce7[_0xb087('0x32')],qs[_0xb087('0x39')](_0x32b9d3['query']['fields']));_0x38cb9d[_0xb087('0x38')]=_0x38cb9d['attributes'][_0xb087('0x3a')]?_0x38cb9d[_0xb087('0x38')]:_0x302ce7[_0xb087('0x32')];if(_0x32b9d3[_0xb087('0x34')]['includeAll']){_0x38cb9d[_0xb087('0x42')]=[{'all':!![]}];}_0x38cb9d=_['merge']({},_0x38cb9d,_0x32b9d3[_0xb087('0x40')]);return db[_0xb087('0x2d')][_0xb087('0x45')](_0x38cb9d)[_0xb087('0x27')](handleEntityNotFound(_0x5e7f45,null))[_0xb087('0x27')](respondWithResult(_0x5e7f45,null))['catch'](handleError(_0x5e7f45,null));};exports[_0xb087('0x46')]=function(_0xb15e28,_0x588d96){return db['VoiceMail'][_0xb087('0x46')](_0xb15e28['body'],{})['then'](function(_0x1c9f8f){var _0x341665=_0xb15e28['user'][_0xb087('0x47')]({'plain':!![]});if(!_0x341665)throw new Error(_0xb087('0x48'));if(_0x341665[_0xb087('0x49')]==='user'){var _0x5ba160=_0x1c9f8f[_0xb087('0x47')]({'plain':!![]});var _0x54862a='Voicemails';return db[_0xb087('0x4a')][_0xb087('0x45')]({'where':{'name':_0x54862a,'userProfileId':_0x341665[_0xb087('0x4b')]},'raw':!![]})[_0xb087('0x27')](function(_0x2bf92f){if(_0x2bf92f&&_0x2bf92f[_0xb087('0x4c')]===0x0){return db[_0xb087('0x4d')][_0xb087('0x46')]({'name':_0x5ba160[_0xb087('0x2a')],'resourceId':_0x5ba160['id'],'type':_0x2bf92f[_0xb087('0x2a')],'sectionId':_0x2bf92f['id']},{})[_0xb087('0x27')](function(){return _0x1c9f8f;});}else{return _0x1c9f8f;}})[_0xb087('0x4e')](function(_0x55e653){logger[_0xb087('0x28')](_0xb087('0x4f'),_0x55e653);throw _0x55e653;});}return _0x1c9f8f;})['then'](respondWithResult(_0x588d96,0xc9))[_0xb087('0x4e')](handleError(_0x588d96,null));};exports[_0xb087('0x50')]=function(_0x343830,_0x1c91e8){if(_0x343830[_0xb087('0x51')]['id']){delete _0x343830[_0xb087('0x51')]['id'];}return db[_0xb087('0x2d')][_0xb087('0x45')]({'where':{'id':_0x343830[_0xb087('0x52')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x1c91e8,null))[_0xb087('0x27')](saveUpdates(_0x343830['body'],null))[_0xb087('0x27')](respondWithResult(_0x1c91e8,null))['catch'](handleError(_0x1c91e8,null));};exports[_0xb087('0x53')]=function(_0x575cc4,_0xf0b592){return db[_0xb087('0x2d')][_0xb087('0x45')]({'where':{'id':_0x575cc4[_0xb087('0x52')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0xf0b592,null))[_0xb087('0x27')](removeEntity(_0xf0b592,null))[_0xb087('0x4e')](handleError(_0xf0b592,null));};exports[_0xb087('0x54')]=function(_0x3f3091,_0x323e0a,_0x300e9b){return db[_0xb087('0x2d')][_0xb087('0x55')]({'where':{'id':_0x3f3091[_0xb087('0x52')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x323e0a,null))[_0xb087('0x27')](function(_0x217f26){var _0x3185c4;var _0x40ff74={},_0xe3cb2={};_0xe3cb2[_0xb087('0x32')]=_[_0xb087('0x35')](db['VoiceMailMessage'][_0xb087('0x2e')]);_0xe3cb2[_0xb087('0x34')]=_[_0xb087('0x35')](_0x3f3091['query']);_0xe3cb2[_0xb087('0x36')]=_[_0xb087('0x37')](_0xe3cb2['model'],_0xe3cb2[_0xb087('0x34')]);_0x40ff74[_0xb087('0x38')]=_[_0xb087('0x37')](_0xe3cb2['model'],qs[_0xb087('0x39')](_0x3f3091[_0xb087('0x34')][_0xb087('0x39')]));_0x40ff74[_0xb087('0x38')]=_0x40ff74[_0xb087('0x38')][_0xb087('0x3a')]?_0x40ff74[_0xb087('0x38')]:_0xe3cb2[_0xb087('0x32')];if(!_0x3f3091['query'][_0xb087('0x56')](_0xb087('0x3b'))){_0x40ff74[_0xb087('0x20')]=qs['limit'](_0x3f3091[_0xb087('0x34')]['limit']);_0x40ff74['offset']=qs[_0xb087('0x1f')](_0x3f3091[_0xb087('0x34')]['offset']);}_0x40ff74[_0xb087('0x57')]=qs['sort'](_0x3f3091[_0xb087('0x34')][_0xb087('0x3c')]);_0x40ff74['where']=qs['filters'](_[_0xb087('0x3d')](_0x3f3091['query'],_0xe3cb2['filters']));if(_0x3f3091[_0xb087('0x34')]['filter']){_0x40ff74[_0xb087('0x3e')]=_['merge'](_0x40ff74[_0xb087('0x3e')],{'$or':_[_0xb087('0x33')](_0x40ff74[_0xb087('0x38')],function(_0x2a6b2e){var _0x4e1683={};_0x4e1683[_0x2a6b2e]={'$like':'%'+_0x3f3091[_0xb087('0x34')]['filter']+'%'};return _0x4e1683;})});}_0x40ff74[_0xb087('0x3e')]=_['merge'](_0x40ff74[_0xb087('0x3e')],{'mailboxuser':_0x217f26[_0xb087('0x58')]});_0x40ff74=_[_0xb087('0x3f')]({},_0x40ff74,_0x3f3091['options']);return db[_0xb087('0x59')]['findAndCountAll'](_0x40ff74)[_0xb087('0x27')](respondWithFilteredResult(_0x323e0a,_0x40ff74));})[_0xb087('0x4e')](handleError(_0x323e0a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index cd92530..638b4fd 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 _0x41aa=['exports','define','VoiceMail','voice_voicemail','mailbox','context','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x41aa,0x84));var _0xa41a=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x41aa[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xa41a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa41a('0x1'));var moment=require(_0xa41a('0x2'));var BPromise=require(_0xa41a('0x3'));var rp=require(_0xa41a('0x4'));var fs=require('fs');var path=require(_0xa41a('0x5'));var rimraf=require(_0xa41a('0x6'));var config=require(_0xa41a('0x7'));var attributes=require('./voiceMail.attributes');module[_0xa41a('0x8')]=function(_0x3afb9c,_0x400e8f){return _0x3afb9c[_0xa41a('0x9')](_0xa41a('0xa'),attributes,{'tableName':_0xa41a('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xa41a('0xc'),_0xa41a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb614=['context','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x1dcc28,_0x26d40f){var _0x1ffb2d=function(_0x59e9e0){while(--_0x59e9e0){_0x1dcc28['push'](_0x1dcc28['shift']());}};_0x1ffb2d(++_0x26d40f);}(_0xb614,0x1e2));var _0x4b61=function(_0x48074b,_0x17a04b){_0x48074b=_0x48074b-0x0;var _0x3db86c=_0xb614[_0x48074b];return _0x3db86c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b61('0x0'))(_0x4b61('0x1'));var moment=require(_0x4b61('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b61('0x3'));var rimraf=require(_0x4b61('0x4'));var config=require(_0x4b61('0x5'));var attributes=require(_0x4b61('0x6'));module[_0x4b61('0x7')]=function(_0x4d5fd8,_0x341a98){return _0x4d5fd8['define'](_0x4b61('0x8'),attributes,{'tableName':_0x4b61('0x9'),'paranoid':![],'indexes':[{'name':_0x4b61('0xa'),'fields':[_0x4b61('0xb'),_0x4b61('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 6bcf0d5..35e9441 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 _0x3550=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x33dccb,_0x416f33){var _0x20df89=function(_0xcc1075){while(--_0xcc1075){_0x33dccb['push'](_0x33dccb['shift']());}};_0x20df89(++_0x416f33);}(_0x3550,0x16c));var _0x0355=function(_0x57ce67,_0x5e0b13){_0x57ce67=_0x57ce67-0x0;var _0x258fff=_0x3550[_0x57ce67];return _0x258fff;};'use strict';var _=require(_0x0355('0x0'));var util=require(_0x0355('0x1'));var moment=require('moment');var BPromise=require(_0x0355('0x2'));var rs=require(_0x0355('0x3'));var fs=require('fs');var Redis=require(_0x0355('0x4'));var db=require(_0x0355('0x5'))['db'];var utils=require(_0x0355('0x6'));var logger=require(_0x0355('0x7'))(_0x0355('0x8'));var config=require(_0x0355('0x9'));var jayson=require(_0x0355('0xa'));var client=jayson[_0x0355('0xb')][_0x0355('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c9d6d,_0x18c453,_0x55ff3b){return new BPromise(function(_0x3326ca,_0x1b099a){return client[_0x0355('0xd')](_0x1c9d6d,_0x55ff3b)[_0x0355('0xe')](function(_0x5ae7f9){logger['info'](_0x0355('0xf'),_0x18c453,_0x0355('0x10'));logger[_0x0355('0x11')](_0x0355('0x12'),_0x18c453,_0x0355('0x10'),JSON[_0x0355('0x13')](_0x5ae7f9));if(_0x5ae7f9[_0x0355('0x14')]){if(_0x5ae7f9[_0x0355('0x14')][_0x0355('0x15')]===0x1f4){logger[_0x0355('0x14')](_0x0355('0xf'),_0x18c453,_0x5ae7f9[_0x0355('0x14')][_0x0355('0x16')]);return _0x1b099a(_0x5ae7f9[_0x0355('0x14')][_0x0355('0x16')]);}logger[_0x0355('0x14')](_0x0355('0xf'),_0x18c453,_0x5ae7f9[_0x0355('0x14')][_0x0355('0x16')]);return _0x3326ca(_0x5ae7f9[_0x0355('0x14')][_0x0355('0x16')]);}else{logger[_0x0355('0x17')](_0x0355('0xf'),_0x18c453,_0x0355('0x10'));_0x3326ca(_0x5ae7f9[_0x0355('0x18')]['message']);}})[_0x0355('0x19')](function(_0x599076){logger[_0x0355('0x14')]('VoiceMail,\x20%s,\x20%s',_0x18c453,_0x599076);_0x1b099a(_0x599076);});});} \ No newline at end of file +var _0x6241=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment'];(function(_0x1b2b74,_0xa38666){var _0x1e5fac=function(_0x2c16b2){while(--_0x2c16b2){_0x1b2b74['push'](_0x1b2b74['shift']());}};_0x1e5fac(++_0xa38666);}(_0x6241,0xcd));var _0x1624=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x6241[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x1624('0x0'));var moment=require(_0x1624('0x1'));var BPromise=require(_0x1624('0x2'));var rs=require(_0x1624('0x3'));var fs=require('fs');var Redis=require(_0x1624('0x4'));var db=require(_0x1624('0x5'))['db'];var utils=require(_0x1624('0x6'));var logger=require(_0x1624('0x7'))(_0x1624('0x8'));var config=require(_0x1624('0x9'));var jayson=require(_0x1624('0xa'));var client=jayson[_0x1624('0xb')][_0x1624('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bceef,_0x116ed6,_0x5c7394){return new BPromise(function(_0x1ec586,_0x1c54ec){return client[_0x1624('0xd')](_0x3bceef,_0x5c7394)[_0x1624('0xe')](function(_0x1c64bd){logger[_0x1624('0xf')](_0x1624('0x10'),_0x116ed6,'request\x20sent');logger['debug'](_0x1624('0x11'),_0x116ed6,_0x1624('0x12'),JSON['stringify'](_0x1c64bd));if(_0x1c64bd[_0x1624('0x13')]){if(_0x1c64bd[_0x1624('0x13')][_0x1624('0x14')]===0x1f4){logger[_0x1624('0x13')](_0x1624('0x10'),_0x116ed6,_0x1c64bd[_0x1624('0x13')][_0x1624('0x15')]);return _0x1c54ec(_0x1c64bd[_0x1624('0x13')][_0x1624('0x15')]);}logger[_0x1624('0x13')](_0x1624('0x10'),_0x116ed6,_0x1c64bd[_0x1624('0x13')][_0x1624('0x15')]);return _0x1ec586(_0x1c64bd[_0x1624('0x13')]['message']);}else{logger[_0x1624('0xf')](_0x1624('0x10'),_0x116ed6,'request\x20sent');_0x1ec586(_0x1c64bd['result']['message']);}})[_0x1624('0x16')](function(_0x390b8e){logger['error'](_0x1624('0x10'),_0x116ed6,_0x390b8e);_0x1c54ec(_0x390b8e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c7ca791..8e13ae5 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 _0xae42=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','/:id/download','post','create','update','delete','destroy','exports'];(function(_0x29d5d5,_0x1e0198){var _0x1a6356=function(_0x341d62){while(--_0x341d62){_0x29d5d5['push'](_0x29d5d5['shift']());}};_0x1a6356(++_0x1e0198);}(_0xae42,0x132));var _0x2ae4=function(_0x51b841,_0x202129){_0x51b841=_0x51b841-0x0;var _0x3c1291=_0xae42[_0x51b841];return _0x3c1291;};'use strict';var multer=require('multer');var util=require(_0x2ae4('0x0'));var path=require(_0x2ae4('0x1'));var timeout=require(_0x2ae4('0x2'));var express=require('express');var router=express[_0x2ae4('0x3')]();var fs_extra=require(_0x2ae4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2ae4('0x5'));var controller=require(_0x2ae4('0x6'));router[_0x2ae4('0x7')]('/',auth[_0x2ae4('0x8')](),controller['index']);router[_0x2ae4('0x7')](_0x2ae4('0x9'),auth[_0x2ae4('0x8')](),controller['show']);router[_0x2ae4('0x7')](_0x2ae4('0xa'),auth[_0x2ae4('0x8')](),controller['download']);router[_0x2ae4('0xb')]('/',auth[_0x2ae4('0x8')](),controller[_0x2ae4('0xc')]);router['put']('/:id',auth[_0x2ae4('0x8')](),controller[_0x2ae4('0xd')]);router[_0x2ae4('0xe')](_0x2ae4('0x9'),auth['isAuthenticated'](),controller[_0x2ae4('0xf')]);module[_0x2ae4('0x10')]=router; \ No newline at end of file +var _0xb31c=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','multer','path','connect-timeout','express'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0xb31c,0x1b4));var _0xcb31=function(_0x313324,_0x362720){_0x313324=_0x313324-0x0;var _0x4c9dec=_0xb31c[_0x313324];return _0x4c9dec;};'use strict';var multer=require(_0xcb31('0x0'));var util=require('util');var path=require(_0xcb31('0x1'));var timeout=require(_0xcb31('0x2'));var express=require(_0xcb31('0x3'));var router=express[_0xcb31('0x4')]();var fs_extra=require(_0xcb31('0x5'));var auth=require(_0xcb31('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb31('0x7'));var controller=require(_0xcb31('0x8'));router[_0xcb31('0x9')]('/',auth[_0xcb31('0xa')](),controller['index']);router['get'](_0xcb31('0xb'),auth['isAuthenticated'](),controller[_0xcb31('0xc')]);router[_0xcb31('0x9')](_0xcb31('0xd'),auth[_0xcb31('0xa')](),controller[_0xcb31('0xe')]);router[_0xcb31('0xf')]('/',auth[_0xcb31('0xa')](),controller[_0xcb31('0x10')]);router[_0xcb31('0x11')]('/:id',auth[_0xcb31('0xa')](),controller['update']);router[_0xcb31('0x12')](_0xcb31('0xb'),auth[_0xcb31('0xa')](),controller[_0xcb31('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f6caf72..13469d8 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 _0xbd18=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','STRING','BLOB'];(function(_0x35f1be,_0xb6007c){var _0x41bf04=function(_0x4bc8c5){while(--_0x4bc8c5){_0x35f1be['push'](_0x35f1be['shift']());}};_0x41bf04(++_0xb6007c);}(_0xbd18,0x10c));var _0x8bd1=function(_0x229c9f,_0x198d86){_0x229c9f=_0x229c9f-0x0;var _0x4c429c=_0xbd18[_0x229c9f];return _0x4c429c;};'use strict';var Sequelize=require('sequelize');module[_0x8bd1('0x0')]={'name':{'type':Sequelize[_0x8bd1('0x1')],'get':function(_0x137e92){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8bd1('0x2')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x8bd1('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x8bd1('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8bd1('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8bd1('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x8bd1('0x3')](_0x8bd1('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x8bd1('0x5'),'defaultValue':Sequelize[_0x8bd1('0x6')](_0x8bd1('0x7'))}}; \ No newline at end of file +var _0x4384=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','getDataValue','INTEGER','STRING','long','TIMESTAMP','literal'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x4384,0x89));var _0x4438=function(_0x24f22d,_0x5a261a){_0x24f22d=_0x24f22d-0x0;var _0x441263=_0x4384[_0x24f22d];return _0x441263;};'use strict';var Sequelize=require(_0x4438('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x181cbb){return this[_0x4438('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x4438('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4438('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x4438('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4438('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x4438('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x4438('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4438('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x4438('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x4438('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4438('0x3')],'defaultValue':''},'stamp':{'type':_0x4438('0x5'),'defaultValue':Sequelize[_0x4438('0x6')](_0x4438('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 38ff98b..5cabca8 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 _0x5c90=['includeAll','include','rows','keys','catch','create','body','params','find','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','.wav\x22','send','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','model','differenceBy','query','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c90,0xaf));var _0x05c9=function(_0x467fe7,_0xbb91c){_0x467fe7=_0x467fe7-0x0;var _0x591b71=_0x5c90[_0x467fe7];return _0x591b71;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x05c9('0x0'));var jsonpatch=require(_0x05c9('0x1'));var rp=require('request-promise');var moment=require(_0x05c9('0x2'));var BPromise=require(_0x05c9('0x3'));var Mustache=require(_0x05c9('0x4'));var util=require(_0x05c9('0x5'));var path=require('path');var sox=require(_0x05c9('0x6'));var csv=require('to-csv');var ejs=require(_0x05c9('0x7'));var fs=require('fs');var fs_extra=require(_0x05c9('0x8'));var _=require(_0x05c9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x05c9('0xa'));var deskjs=require(_0x05c9('0xb'));var toCsv=require(_0x05c9('0xc'));var querystring=require(_0x05c9('0xd'));var Papa=require('papaparse');var Redis=require(_0x05c9('0xe'));var authService=require(_0x05c9('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05c9('0x10'));var logger=require(_0x05c9('0x11'))(_0x05c9('0x12'));var utils=require('../../config/utils');var config=require(_0x05c9('0x13'));var licenseUtil=require(_0x05c9('0x14'));var db=require(_0x05c9('0x15'))['db'];function respondWithStatusCode(_0x17e339,_0x8377ec){_0x8377ec=_0x8377ec||0xcc;return function(_0x5eb95d){if(_0x5eb95d){return _0x17e339['sendStatus'](_0x8377ec);}return _0x17e339['status'](_0x8377ec)[_0x05c9('0x16')]();};}function respondWithResult(_0x54806a,_0x2d685e){_0x2d685e=_0x2d685e||0xc8;return function(_0x1a2ce9){if(_0x1a2ce9){return _0x54806a['status'](_0x2d685e)['json'](_0x1a2ce9);}};}function respondWithFilteredResult(_0x3b61c1,_0x235ef6){return function(_0x21e401){if(_0x21e401){var _0x11f0c1=typeof _0x235ef6[_0x05c9('0x17')]===_0x05c9('0x18')&&typeof _0x235ef6[_0x05c9('0x19')]===_0x05c9('0x18');var _0x346428=_0x21e401[_0x05c9('0x1a')];var _0x32215e=_0x11f0c1?0x0:_0x235ef6['offset'];var _0xbec322=_0x11f0c1?_0x21e401[_0x05c9('0x1a')]:_0x235ef6[_0x05c9('0x17')]+_0x235ef6[_0x05c9('0x19')];var _0x48663a;if(_0xbec322>=_0x346428){_0xbec322=_0x346428;_0x48663a=0xc8;}else{_0x48663a=0xce;}_0x3b61c1[_0x05c9('0x1b')](_0x48663a);return _0x3b61c1[_0x05c9('0x1c')](_0x05c9('0x1d'),_0x32215e+'-'+_0xbec322+'/'+_0x346428)[_0x05c9('0x1e')](_0x21e401);}return null;};}function patchUpdates(_0x26130e){return function(_0x22fdc0){try{jsonpatch[_0x05c9('0x1f')](_0x22fdc0,_0x26130e,!![]);}catch(_0x163c19){return BPromise[_0x05c9('0x20')](_0x163c19);}return _0x22fdc0[_0x05c9('0x21')]();};}function saveUpdates(_0x4a78a9,_0x393a84){return function(_0x48223f){if(_0x48223f){return _0x48223f[_0x05c9('0x22')](_0x4a78a9)[_0x05c9('0x23')](function(_0x4aee4b){return _0x4aee4b;});}return null;};}function removeEntity(_0x540aef,_0x144e61){return function(_0x4872aa){if(_0x4872aa){return _0x4872aa[_0x05c9('0x24')]()[_0x05c9('0x23')](function(){_0x540aef[_0x05c9('0x1b')](0xcc)[_0x05c9('0x16')]();});}};}function handleEntityNotFound(_0x3d42c7,_0x1185d2){return function(_0x400206){if(!_0x400206){_0x3d42c7[_0x05c9('0x25')](0x194);}return _0x400206;};}function handleError(_0x26585f,_0xe2a0aa){_0xe2a0aa=_0xe2a0aa||0x1f4;return function(_0x1d78f5){logger[_0x05c9('0x26')](_0x1d78f5[_0x05c9('0x27')]);if(_0x1d78f5[_0x05c9('0x28')]){delete _0x1d78f5['name'];}_0x26585f[_0x05c9('0x1b')](_0xe2a0aa)['send'](_0x1d78f5);};}exports['index']=function(_0x5c24f8,_0x1c398e){var _0x4b6301={},_0x3ff530={},_0x16c223={'count':0x0,'rows':[]};var _0x5cd19c=_[_0x05c9('0x29')](db[_0x05c9('0x2a')][_0x05c9('0x2b')],function(_0x1872b4){return{'name':_0x1872b4[_0x05c9('0x2c')],'type':_0x1872b4['type']['key']};});_0x3ff530[_0x05c9('0x2d')]=_[_0x05c9('0x2e')](_['map'](_0x5cd19c,'name'),[_0x05c9('0x28')]);_0x3ff530['query']=_['keys'](_0x5c24f8[_0x05c9('0x2f')]);_0x3ff530['filters']=_[_0x05c9('0x30')](_0x3ff530['model'],_0x3ff530['query']);_0x4b6301[_0x05c9('0x31')]=_['intersection'](_0x3ff530[_0x05c9('0x2d')],qs[_0x05c9('0x32')](_0x5c24f8[_0x05c9('0x2f')][_0x05c9('0x32')]));_0x4b6301['attributes']=_0x4b6301[_0x05c9('0x31')][_0x05c9('0x33')]?_0x4b6301[_0x05c9('0x31')]:_0x3ff530[_0x05c9('0x2d')];if(!_0x5c24f8[_0x05c9('0x2f')]['hasOwnProperty']('nolimit')){_0x4b6301[_0x05c9('0x19')]=qs[_0x05c9('0x19')](_0x5c24f8[_0x05c9('0x2f')][_0x05c9('0x19')]);_0x4b6301['offset']=qs[_0x05c9('0x17')](_0x5c24f8[_0x05c9('0x2f')][_0x05c9('0x17')]);}_0x4b6301[_0x05c9('0x34')]=qs[_0x05c9('0x35')](_0x5c24f8[_0x05c9('0x2f')]['sort']);_0x4b6301['where']=qs[_0x05c9('0x36')](_[_0x05c9('0x37')](_0x5c24f8['query'],_0x3ff530['filters']),_0x5cd19c);if(_0x5c24f8['query'][_0x05c9('0x38')]){_0x4b6301[_0x05c9('0x39')]=_[_0x05c9('0x3a')](_0x4b6301[_0x05c9('0x39')],{'$or':_[_0x05c9('0x29')](_0x5cd19c,function(_0x199899){if(_0x199899[_0x05c9('0x3b')]!==_0x05c9('0x3c')){var _0x2063de={};_0x2063de[_0x199899['name']]={'$like':'%'+_0x5c24f8[_0x05c9('0x2f')][_0x05c9('0x38')]+'%'};return _0x2063de;}})});}_0x4b6301=_[_0x05c9('0x3a')]({},_0x4b6301,_0x5c24f8[_0x05c9('0x3d')]);var _0x512634={'where':_0x4b6301[_0x05c9('0x39')]};return db['VoiceMailMessage'][_0x05c9('0x1a')](_0x512634)[_0x05c9('0x23')](function(_0x1b97ac){_0x16c223[_0x05c9('0x1a')]=_0x1b97ac;if(_0x5c24f8[_0x05c9('0x2f')][_0x05c9('0x3e')]){_0x4b6301[_0x05c9('0x3f')]=[{'all':!![]}];}return db[_0x05c9('0x2a')]['findAll'](_0x4b6301);})[_0x05c9('0x23')](function(_0x54c0c6){_0x16c223[_0x05c9('0x40')]=_0x54c0c6;return _0x16c223;})[_0x05c9('0x23')](respondWithFilteredResult(_0x1c398e,_0x4b6301))['catch'](handleError(_0x1c398e,null));};exports['show']=function(_0x375a33,_0x30886b){var _0x4f709c={'raw':!![],'where':{'id':_0x375a33['params']['id']}},_0x47fd87={};_0x47fd87[_0x05c9('0x2d')]=_[_0x05c9('0x41')](db[_0x05c9('0x2a')][_0x05c9('0x2b')]);_0x47fd87['query']=_[_0x05c9('0x41')](_0x375a33[_0x05c9('0x2f')]);_0x47fd87[_0x05c9('0x36')]=_[_0x05c9('0x30')](_0x47fd87[_0x05c9('0x2d')],_0x47fd87[_0x05c9('0x2f')]);_0x4f709c['attributes']=_[_0x05c9('0x30')](_0x47fd87[_0x05c9('0x2d')],qs[_0x05c9('0x32')](_0x375a33[_0x05c9('0x2f')][_0x05c9('0x32')]));_0x4f709c[_0x05c9('0x31')]=_0x4f709c[_0x05c9('0x31')]['length']?_0x4f709c['attributes']:_0x47fd87[_0x05c9('0x2d')];if(_0x375a33['query']['includeAll']){_0x4f709c[_0x05c9('0x3f')]=[{'all':!![]}];}_0x4f709c=_['merge']({},_0x4f709c,_0x375a33[_0x05c9('0x3d')]);return db['VoiceMailMessage']['find'](_0x4f709c)[_0x05c9('0x23')](handleEntityNotFound(_0x30886b,null))['then'](respondWithResult(_0x30886b,null))[_0x05c9('0x42')](handleError(_0x30886b,null));};exports[_0x05c9('0x43')]=function(_0x17a417,_0x1ccb21){return db['VoiceMailMessage'][_0x05c9('0x43')](_0x17a417[_0x05c9('0x44')],{})['then'](respondWithResult(_0x1ccb21,0xc9))[_0x05c9('0x42')](handleError(_0x1ccb21,null));};exports[_0x05c9('0x22')]=function(_0x172bc4,_0x25803f){if(_0x172bc4[_0x05c9('0x44')]['id']){delete _0x172bc4[_0x05c9('0x44')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x172bc4[_0x05c9('0x45')]['id']}})['then'](handleEntityNotFound(_0x25803f,null))[_0x05c9('0x23')](saveUpdates(_0x172bc4[_0x05c9('0x44')],null))['then'](respondWithResult(_0x25803f,null))['catch'](handleError(_0x25803f,null));};exports[_0x05c9('0x24')]=function(_0x2062ef,_0x1d95d9){return db[_0x05c9('0x2a')]['find']({'where':{'id':_0x2062ef[_0x05c9('0x45')]['id']}})[_0x05c9('0x23')](handleEntityNotFound(_0x1d95d9,null))['then'](removeEntity(_0x1d95d9,null))[_0x05c9('0x42')](handleError(_0x1d95d9,null));};exports['download']=function(_0x4b725a,_0x284d48,_0x4ea31f){return db[_0x05c9('0x2a')][_0x05c9('0x46')]({'where':{'id':_0x4b725a[_0x05c9('0x45')]['id']},'attributes':['id',_0x05c9('0x47'),_0x05c9('0x48')]})[_0x05c9('0x23')](handleEntityNotFound(_0x284d48,null))['then'](function(_0x4bec21){if(_0x4bec21){if(!_0x4bec21[_0x05c9('0x47')]){throw new db[(_0x05c9('0x49'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x233559={'Content-Type':_0x05c9('0x4a'),'Content-Disposition':_0x05c9('0x4b')};if(_0x4bec21[_0x05c9('0x48')]){_0x233559[_0x05c9('0x4c')]='attachment;\x20filename=\x22'+_0x4bec21['msg_id']+_0x05c9('0x4d');}_0x284d48['set'](_0x233559);return _0x284d48[_0x05c9('0x4e')](new Buffer(_0x4bec21[_0x05c9('0x47')]));}})[_0x05c9('0x42')](handleError(_0x284d48,null));}; \ No newline at end of file +var _0xa0f8=['rows','catch','show','create','update','body','find','params','destroy','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','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','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','then','sendStatus','error','name','send','index','map','VoiceMailMessage','rawAttributes','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','merge','options','includeAll','include','findAll'];(function(_0x2d76ac,_0x5b30c0){var _0x330806=function(_0x1d481c){while(--_0x1d481c){_0x2d76ac['push'](_0x2d76ac['shift']());}};_0x330806(++_0x5b30c0);}(_0xa0f8,0x166));var _0x8a0f=function(_0x487f15,_0x1cf5fb){_0x487f15=_0x487f15-0x0;var _0x32c8a1=_0xa0f8[_0x487f15];return _0x32c8a1;};'use strict';var emlformat=require(_0x8a0f('0x0'));var rimraf=require(_0x8a0f('0x1'));var zipdir=require(_0x8a0f('0x2'));var jsonpatch=require(_0x8a0f('0x3'));var rp=require(_0x8a0f('0x4'));var moment=require(_0x8a0f('0x5'));var BPromise=require(_0x8a0f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8a0f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a0f('0x8'));var _=require(_0x8a0f('0x9'));var squel=require(_0x8a0f('0xa'));var crypto=require('crypto');var jsforce=require(_0x8a0f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8a0f('0xc'));var querystring=require(_0x8a0f('0xd'));var Papa=require(_0x8a0f('0xe'));var Redis=require('ioredis');var authService=require(_0x8a0f('0xf'));var qs=require(_0x8a0f('0x10'));var as=require(_0x8a0f('0x11'));var hardwareService=require(_0x8a0f('0x12'));var logger=require(_0x8a0f('0x13'))(_0x8a0f('0x14'));var utils=require(_0x8a0f('0x15'));var config=require(_0x8a0f('0x16'));var licenseUtil=require(_0x8a0f('0x17'));var db=require(_0x8a0f('0x18'))['db'];function respondWithStatusCode(_0x275375,_0x3b1302){_0x3b1302=_0x3b1302||0xcc;return function(_0x54f273){if(_0x54f273){return _0x275375['sendStatus'](_0x3b1302);}return _0x275375['status'](_0x3b1302)[_0x8a0f('0x19')]();};}function respondWithResult(_0x1b61ed,_0x11dba4){_0x11dba4=_0x11dba4||0xc8;return function(_0x4f15b5){if(_0x4f15b5){return _0x1b61ed['status'](_0x11dba4)[_0x8a0f('0x1a')](_0x4f15b5);}};}function respondWithFilteredResult(_0x592e9a,_0x22289a){return function(_0xf2a888){if(_0xf2a888){var _0x3ed19c=typeof _0x22289a[_0x8a0f('0x1b')]===_0x8a0f('0x1c')&&typeof _0x22289a[_0x8a0f('0x1d')]===_0x8a0f('0x1c');var _0x301f91=_0xf2a888[_0x8a0f('0x1e')];var _0x159330=_0x3ed19c?0x0:_0x22289a['offset'];var _0x2bd424=_0x3ed19c?_0xf2a888['count']:_0x22289a[_0x8a0f('0x1b')]+_0x22289a['limit'];var _0xc09c3b;if(_0x2bd424>=_0x301f91){_0x2bd424=_0x301f91;_0xc09c3b=0xc8;}else{_0xc09c3b=0xce;}_0x592e9a[_0x8a0f('0x1f')](_0xc09c3b);return _0x592e9a[_0x8a0f('0x20')](_0x8a0f('0x21'),_0x159330+'-'+_0x2bd424+'/'+_0x301f91)[_0x8a0f('0x1a')](_0xf2a888);}return null;};}function patchUpdates(_0x2fa36d){return function(_0x501892){try{jsonpatch['apply'](_0x501892,_0x2fa36d,!![]);}catch(_0x28ae20){return BPromise[_0x8a0f('0x22')](_0x28ae20);}return _0x501892[_0x8a0f('0x23')]();};}function saveUpdates(_0x4c8da3,_0x51e8d1){return function(_0x3d5c32){if(_0x3d5c32){return _0x3d5c32['update'](_0x4c8da3)[_0x8a0f('0x24')](function(_0x9e85f2){return _0x9e85f2;});}return null;};}function removeEntity(_0x1d2b88,_0x22234c){return function(_0x2ae6fb){if(_0x2ae6fb){return _0x2ae6fb['destroy']()[_0x8a0f('0x24')](function(){_0x1d2b88[_0x8a0f('0x1f')](0xcc)[_0x8a0f('0x19')]();});}};}function handleEntityNotFound(_0x582b11,_0x4490e7){return function(_0x7c2028){if(!_0x7c2028){_0x582b11[_0x8a0f('0x25')](0x194);}return _0x7c2028;};}function handleError(_0xb2cf17,_0x34e734){_0x34e734=_0x34e734||0x1f4;return function(_0x474157){logger[_0x8a0f('0x26')](_0x474157['stack']);if(_0x474157['name']){delete _0x474157[_0x8a0f('0x27')];}_0xb2cf17[_0x8a0f('0x1f')](_0x34e734)[_0x8a0f('0x28')](_0x474157);};}exports[_0x8a0f('0x29')]=function(_0x5d9186,_0x1ebb2d){var _0x52192c={},_0x512ae3={},_0x1cc95c={'count':0x0,'rows':[]};var _0x2fc202=_[_0x8a0f('0x2a')](db[_0x8a0f('0x2b')][_0x8a0f('0x2c')],function(_0x4022ee){return{'name':_0x4022ee['fieldName'],'type':_0x4022ee['type'][_0x8a0f('0x2d')]};});_0x512ae3[_0x8a0f('0x2e')]=_[_0x8a0f('0x2f')](_[_0x8a0f('0x2a')](_0x2fc202,_0x8a0f('0x27')),['name']);_0x512ae3[_0x8a0f('0x30')]=_[_0x8a0f('0x31')](_0x5d9186[_0x8a0f('0x30')]);_0x512ae3[_0x8a0f('0x32')]=_[_0x8a0f('0x33')](_0x512ae3['model'],_0x512ae3[_0x8a0f('0x30')]);_0x52192c[_0x8a0f('0x34')]=_[_0x8a0f('0x33')](_0x512ae3[_0x8a0f('0x2e')],qs['fields'](_0x5d9186[_0x8a0f('0x30')][_0x8a0f('0x35')]));_0x52192c[_0x8a0f('0x34')]=_0x52192c[_0x8a0f('0x34')][_0x8a0f('0x36')]?_0x52192c[_0x8a0f('0x34')]:_0x512ae3[_0x8a0f('0x2e')];if(!_0x5d9186[_0x8a0f('0x30')][_0x8a0f('0x37')]('nolimit')){_0x52192c['limit']=qs['limit'](_0x5d9186[_0x8a0f('0x30')][_0x8a0f('0x1d')]);_0x52192c['offset']=qs[_0x8a0f('0x1b')](_0x5d9186['query']['offset']);}_0x52192c[_0x8a0f('0x38')]=qs[_0x8a0f('0x39')](_0x5d9186[_0x8a0f('0x30')][_0x8a0f('0x39')]);_0x52192c['where']=qs[_0x8a0f('0x32')](_[_0x8a0f('0x3a')](_0x5d9186[_0x8a0f('0x30')],_0x512ae3[_0x8a0f('0x32')]),_0x2fc202);if(_0x5d9186[_0x8a0f('0x30')][_0x8a0f('0x3b')]){_0x52192c['where']=_['merge'](_0x52192c[_0x8a0f('0x3c')],{'$or':_['map'](_0x2fc202,function(_0x292bad){if(_0x292bad[_0x8a0f('0x3d')]!=='VIRTUAL'){var _0x56b7e4={};_0x56b7e4[_0x292bad[_0x8a0f('0x27')]]={'$like':'%'+_0x5d9186[_0x8a0f('0x30')][_0x8a0f('0x3b')]+'%'};return _0x56b7e4;}})});}_0x52192c=_[_0x8a0f('0x3e')]({},_0x52192c,_0x5d9186[_0x8a0f('0x3f')]);var _0x3955f5={'where':_0x52192c[_0x8a0f('0x3c')]};return db[_0x8a0f('0x2b')][_0x8a0f('0x1e')](_0x3955f5)[_0x8a0f('0x24')](function(_0x266784){_0x1cc95c[_0x8a0f('0x1e')]=_0x266784;if(_0x5d9186[_0x8a0f('0x30')][_0x8a0f('0x40')]){_0x52192c[_0x8a0f('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x8a0f('0x42')](_0x52192c);})[_0x8a0f('0x24')](function(_0x46f5f9){_0x1cc95c[_0x8a0f('0x43')]=_0x46f5f9;return _0x1cc95c;})[_0x8a0f('0x24')](respondWithFilteredResult(_0x1ebb2d,_0x52192c))[_0x8a0f('0x44')](handleError(_0x1ebb2d,null));};exports[_0x8a0f('0x45')]=function(_0x1800a0,_0x41a863){var _0xff19e7={'raw':!![],'where':{'id':_0x1800a0['params']['id']}},_0x53f59d={};_0x53f59d[_0x8a0f('0x2e')]=_['keys'](db['VoiceMailMessage'][_0x8a0f('0x2c')]);_0x53f59d[_0x8a0f('0x30')]=_[_0x8a0f('0x31')](_0x1800a0[_0x8a0f('0x30')]);_0x53f59d['filters']=_[_0x8a0f('0x33')](_0x53f59d[_0x8a0f('0x2e')],_0x53f59d['query']);_0xff19e7['attributes']=_[_0x8a0f('0x33')](_0x53f59d[_0x8a0f('0x2e')],qs[_0x8a0f('0x35')](_0x1800a0[_0x8a0f('0x30')][_0x8a0f('0x35')]));_0xff19e7[_0x8a0f('0x34')]=_0xff19e7['attributes'][_0x8a0f('0x36')]?_0xff19e7['attributes']:_0x53f59d[_0x8a0f('0x2e')];if(_0x1800a0['query']['includeAll']){_0xff19e7[_0x8a0f('0x41')]=[{'all':!![]}];}_0xff19e7=_['merge']({},_0xff19e7,_0x1800a0['options']);return db[_0x8a0f('0x2b')]['find'](_0xff19e7)[_0x8a0f('0x24')](handleEntityNotFound(_0x41a863,null))['then'](respondWithResult(_0x41a863,null))[_0x8a0f('0x44')](handleError(_0x41a863,null));};exports[_0x8a0f('0x46')]=function(_0x1e41cf,_0x298ca4){return db[_0x8a0f('0x2b')]['create'](_0x1e41cf['body'],{})[_0x8a0f('0x24')](respondWithResult(_0x298ca4,0xc9))[_0x8a0f('0x44')](handleError(_0x298ca4,null));};exports[_0x8a0f('0x47')]=function(_0x5ccbe7,_0x260397){if(_0x5ccbe7['body']['id']){delete _0x5ccbe7[_0x8a0f('0x48')]['id'];}return db[_0x8a0f('0x2b')][_0x8a0f('0x49')]({'where':{'id':_0x5ccbe7[_0x8a0f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x260397,null))[_0x8a0f('0x24')](saveUpdates(_0x5ccbe7[_0x8a0f('0x48')],null))[_0x8a0f('0x24')](respondWithResult(_0x260397,null))['catch'](handleError(_0x260397,null));};exports[_0x8a0f('0x4b')]=function(_0x45a725,_0x96fb73){return db[_0x8a0f('0x2b')]['find']({'where':{'id':_0x45a725[_0x8a0f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x96fb73,null))[_0x8a0f('0x24')](removeEntity(_0x96fb73,null))[_0x8a0f('0x44')](handleError(_0x96fb73,null));};exports[_0x8a0f('0x4c')]=function(_0x23d42a,_0xb799c0,_0x28c3fe){return db[_0x8a0f('0x2b')][_0x8a0f('0x49')]({'where':{'id':_0x23d42a[_0x8a0f('0x4a')]['id']},'attributes':['id','recording',_0x8a0f('0x4d')]})[_0x8a0f('0x24')](handleEntityNotFound(_0xb799c0,null))[_0x8a0f('0x24')](function(_0x418f4c){if(_0x418f4c){if(!_0x418f4c[_0x8a0f('0x4e')]){throw new db['Sequelize'][(_0x8a0f('0x4f'))](_0x8a0f('0x50'));}var _0x4c56ff={'Content-Type':_0x8a0f('0x51'),'Content-Disposition':_0x8a0f('0x52')};if(_0x418f4c['msg_id']){_0x4c56ff[_0x8a0f('0x53')]='attachment;\x20filename=\x22'+_0x418f4c['msg_id']+_0x8a0f('0x54');}_0xb799c0['set'](_0x4c56ff);return _0xb799c0[_0x8a0f('0x28')](new Buffer(_0x418f4c['recording']));}})[_0x8a0f('0x44')](handleError(_0xb799c0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 96e3ea3..ad1c8aa 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 _0x0b1c=['VoiceMailMessage','dir','util','../../config/logger','moment','bluebird','path','../../config/environment','exports'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x0b1c,0x6e));var _0xc0b1=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x0b1c[_0x2555d0];return _0x3bb486;};'use strict';var _=require('lodash');var util=require(_0xc0b1('0x0'));var logger=require(_0xc0b1('0x1'))('api');var moment=require(_0xc0b1('0x2'));var BPromise=require(_0xc0b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0b1('0x4'));var rimraf=require('rimraf');var config=require(_0xc0b1('0x5'));var attributes=require('./voiceMailMessage.attributes');module[_0xc0b1('0x6')]=function(_0x22d979,_0x4bb3b7){return _0x22d979['define'](_0xc0b1('0x7'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xc0b1('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x973d=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x4149ae,_0x11fab6){var _0x2cd18a=function(_0x4f2e1a){while(--_0x4f2e1a){_0x4149ae['push'](_0x4149ae['shift']());}};_0x2cd18a(++_0x11fab6);}(_0x973d,0x1b0));var _0xd973=function(_0x175a8c,_0x2d9212){_0x175a8c=_0x175a8c-0x0;var _0x37b0b0=_0x973d[_0x175a8c];return _0x37b0b0;};'use strict';var _=require(_0xd973('0x0'));var util=require(_0xd973('0x1'));var logger=require(_0xd973('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd973('0x3'));var rp=require(_0xd973('0x4'));var fs=require('fs');var path=require(_0xd973('0x5'));var rimraf=require(_0xd973('0x6'));var config=require(_0xd973('0x7'));var attributes=require(_0xd973('0x8'));module[_0xd973('0x9')]=function(_0x584d12,_0xba13cd){return _0x584d12[_0xd973('0xa')](_0xd973('0xb'),attributes,{'tableName':_0xd973('0xc'),'paranoid':![],'indexes':[{'name':_0xd973('0xd'),'fields':[_0xd973('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 33d4985..f49f1d0 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 _0xaf84=['client','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2247dc,_0x85b962){var _0x1b4fbd=function(_0x5806be){while(--_0x5806be){_0x2247dc['push'](_0x2247dc['shift']());}};_0x1b4fbd(++_0x85b962);}(_0xaf84,0x194));var _0x4af8=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xaf84[_0x318840];return _0x223da4;};'use strict';var _=require(_0x4af8('0x0'));var util=require(_0x4af8('0x1'));var moment=require(_0x4af8('0x2'));var BPromise=require(_0x4af8('0x3'));var rs=require(_0x4af8('0x4'));var fs=require('fs');var Redis=require(_0x4af8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4af8('0x6'));var logger=require(_0x4af8('0x7'))(_0x4af8('0x8'));var config=require(_0x4af8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4af8('0xa')][_0x4af8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41e6c9,_0x4c121d,_0x146a8a){return new BPromise(function(_0x53dc4c,_0x9ebb06){return client[_0x4af8('0xc')](_0x41e6c9,_0x146a8a)[_0x4af8('0xd')](function(_0x55c88d){logger[_0x4af8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x4c121d,_0x4af8('0xf'));logger[_0x4af8('0x10')](_0x4af8('0x11'),_0x4c121d,_0x4af8('0xf'),JSON[_0x4af8('0x12')](_0x55c88d));if(_0x55c88d[_0x4af8('0x13')]){if(_0x55c88d[_0x4af8('0x13')]['code']===0x1f4){logger[_0x4af8('0x13')](_0x4af8('0x14'),_0x4c121d,_0x55c88d['error']['message']);return _0x9ebb06(_0x55c88d[_0x4af8('0x13')][_0x4af8('0x15')]);}logger['error'](_0x4af8('0x14'),_0x4c121d,_0x55c88d['error'][_0x4af8('0x15')]);return _0x53dc4c(_0x55c88d['error']['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x4c121d,_0x4af8('0xf'));_0x53dc4c(_0x55c88d['result'][_0x4af8('0x15')]);}})[_0x4af8('0x16')](function(_0x4132a4){logger['error'](_0x4af8('0x14'),_0x4c121d,_0x4132a4);_0x9ebb06(_0x4132a4);});});} \ No newline at end of file +var _0x7568=['request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x7568,0x185));var _0x8756=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x7568[_0x616290];return _0x453879;};'use strict';var _=require(_0x8756('0x0'));var util=require(_0x8756('0x1'));var moment=require('moment');var BPromise=require(_0x8756('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8756('0x3'))['db'];var utils=require(_0x8756('0x4'));var logger=require(_0x8756('0x5'))(_0x8756('0x6'));var config=require(_0x8756('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8756('0x8')][_0x8756('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e4fbd,_0x28f782,_0x490da7){return new BPromise(function(_0x58d8b0,_0x1d2cb8){return client[_0x8756('0xa')](_0x3e4fbd,_0x490da7)[_0x8756('0xb')](function(_0x2f4f08){logger['info'](_0x8756('0xc'),_0x28f782,_0x8756('0xd'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x28f782,_0x8756('0xd'),JSON[_0x8756('0xe')](_0x2f4f08));if(_0x2f4f08[_0x8756('0xf')]){if(_0x2f4f08[_0x8756('0xf')]['code']===0x1f4){logger[_0x8756('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x28f782,_0x2f4f08[_0x8756('0xf')][_0x8756('0x10')]);return _0x1d2cb8(_0x2f4f08[_0x8756('0xf')]['message']);}logger[_0x8756('0xf')](_0x8756('0xc'),_0x28f782,_0x2f4f08[_0x8756('0xf')][_0x8756('0x10')]);return _0x58d8b0(_0x2f4f08['error']['message']);}else{logger['info'](_0x8756('0xc'),_0x28f782,_0x8756('0xd'));_0x58d8b0(_0x2f4f08[_0x8756('0x11')][_0x8756('0x10')]);}})[_0x8756('0x12')](function(_0x5eb6a2){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x28f782,_0x5eb6a2);_0x1d2cb8(_0x5eb6a2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index fe9b84b..a7e664f 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 _0xcb70=['post','create','/:id/sounds','addSound','put','delete','destroy','removeSound','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','getSounds'];(function(_0x135d17,_0x292743){var _0x209451=function(_0x560877){while(--_0x560877){_0x135d17['push'](_0x135d17['shift']());}};_0x209451(++_0x292743);}(_0xcb70,0xb9));var _0x0cb7=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xcb70[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0x0cb7('0x0'));var util=require(_0x0cb7('0x1'));var path=require('path');var timeout=require(_0x0cb7('0x2'));var express=require(_0x0cb7('0x3'));var router=express['Router']();var fs_extra=require(_0x0cb7('0x4'));var auth=require(_0x0cb7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0cb7('0x6'));var controller=require(_0x0cb7('0x7'));router[_0x0cb7('0x8')]('/',auth[_0x0cb7('0x9')](),controller['index']);router['get'](_0x0cb7('0xa'),auth[_0x0cb7('0x9')](),controller[_0x0cb7('0xb')]);router[_0x0cb7('0x8')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x0cb7('0xc')]);router[_0x0cb7('0xd')]('/',auth[_0x0cb7('0x9')](),controller[_0x0cb7('0xe')]);router[_0x0cb7('0xd')](_0x0cb7('0xf'),auth['isAuthenticated'](),controller[_0x0cb7('0x10')]);router[_0x0cb7('0x11')](_0x0cb7('0xa'),auth[_0x0cb7('0x9')](),controller['update']);router[_0x0cb7('0x12')](_0x0cb7('0xa'),auth['isAuthenticated'](),controller[_0x0cb7('0x13')]);router[_0x0cb7('0x12')]('/:id/sounds/:id2',auth[_0x0cb7('0x9')](),controller[_0x0cb7('0x14')]);module[_0x0cb7('0x15')]=router; \ No newline at end of file +var _0xb52c=['isAuthenticated','index','get','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','removeSound','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x49afb8,_0x48be44){var _0x7a587c=function(_0x24ca0a){while(--_0x24ca0a){_0x49afb8['push'](_0x49afb8['shift']());}};_0x7a587c(++_0x48be44);}(_0xb52c,0x1f3));var _0xcb52=function(_0x37edd5,_0x5b3a32){_0x37edd5=_0x37edd5-0x0;var _0x46a30e=_0xb52c[_0x37edd5];return _0x46a30e;};'use strict';var multer=require('multer');var util=require(_0xcb52('0x0'));var path=require(_0xcb52('0x1'));var timeout=require(_0xcb52('0x2'));var express=require(_0xcb52('0x3'));var router=express[_0xcb52('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb52('0x5'));var interaction=require(_0xcb52('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xcb52('0x7')](),controller[_0xcb52('0x8')]);router[_0xcb52('0x9')](_0xcb52('0xa'),auth[_0xcb52('0x7')](),controller[_0xcb52('0xb')]);router[_0xcb52('0x9')]('/:id/sounds',auth[_0xcb52('0x7')](),controller[_0xcb52('0xc')]);router[_0xcb52('0xd')]('/',auth['isAuthenticated'](),controller[_0xcb52('0xe')]);router[_0xcb52('0xd')](_0xcb52('0xf'),auth['isAuthenticated'](),controller[_0xcb52('0x10')]);router[_0xcb52('0x11')](_0xcb52('0xa'),auth[_0xcb52('0x7')](),controller[_0xcb52('0x12')]);router[_0xcb52('0x13')]('/:id',auth[_0xcb52('0x7')](),controller['destroy']);router[_0xcb52('0x13')]('/:id/sounds/:id2',auth[_0xcb52('0x7')](),controller[_0xcb52('0x14')]);module[_0xcb52('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f2ecde6..401625c 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 _0x3b60=['files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','custom'];(function(_0xc889c9,_0x1da1db){var _0x284ba7=function(_0x4ddec0){while(--_0x4ddec0){_0xc889c9['push'](_0xc889c9['shift']());}};_0x284ba7(++_0x1da1db);}(_0x3b60,0x11b));var _0x03b6=function(_0x6df93f,_0x45659d){_0x6df93f=_0x6df93f-0x0;var _0x26a4a5=_0x3b60[_0x6df93f];return _0x26a4a5;};'use strict';var Sequelize=require(_0x03b6('0x0'));module['exports']={'name':{'type':Sequelize[_0x03b6('0x1')],'allowNull':![],'unique':_0x03b6('0x2')},'mode':{'type':Sequelize[_0x03b6('0x3')](_0x03b6('0x4'),_0x03b6('0x5'),_0x03b6('0x6'),_0x03b6('0x7'),_0x03b6('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x03b6('0x5')},'directory':{'type':Sequelize[_0x03b6('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x03b6('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x03b6('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x03b6('0x1')],'allowNull':!![],'defaultValue':_0x03b6('0x9')},'format':{'type':Sequelize[_0x03b6('0x1')],'allowNull':!![]},'stamp':{'type':_0x03b6('0xa')},'defaultEntry':{'type':Sequelize[_0x03b6('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a66=['exports','name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','sequelize'];(function(_0x2fa04a,_0x324bb9){var _0x145d62=function(_0xc58bb0){while(--_0xc58bb0){_0x2fa04a['push'](_0x2fa04a['shift']());}};_0x145d62(++_0x324bb9);}(_0x8a66,0x1cb));var _0x68a6=function(_0x7ea1fb,_0x2f0b74){_0x7ea1fb=_0x7ea1fb-0x0;var _0x478241=_0x8a66[_0x7ea1fb];return _0x478241;};'use strict';var Sequelize=require(_0x68a6('0x0'));module[_0x68a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x68a6('0x2')},'mode':{'type':Sequelize[_0x68a6('0x3')]('custom',_0x68a6('0x4'),_0x68a6('0x5'),_0x68a6('0x6'),_0x68a6('0x7'),_0x68a6('0x8')),'allowNull':!![],'defaultValue':_0x68a6('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x68a6('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x68a6('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x68a6('0x9')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x68a6('0x9')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 4e36903..81a883c 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 _0x9c93=['undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','include','body','find','transaction','join','root','mode','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','extname','server/files/moh','format','symlinkSync','Sequelize','removeSound','findOne','id2','getSounds','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9c93,0x1b7));var _0x39c9=function(_0x33711e,_0x57999f){_0x33711e=_0x33711e-0x0;var _0x5816e3=_0x9c93[_0x33711e];return _0x5816e3;};'use strict';var emlformat=require(_0x39c9('0x0'));var rimraf=require(_0x39c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39c9('0x2'));var rp=require(_0x39c9('0x3'));var moment=require('moment');var BPromise=require(_0x39c9('0x4'));var Mustache=require(_0x39c9('0x5'));var util=require('util');var path=require(_0x39c9('0x6'));var sox=require('sox');var csv=require(_0x39c9('0x7'));var ejs=require(_0x39c9('0x8'));var fs=require('fs');var fs_extra=require(_0x39c9('0x9'));var _=require(_0x39c9('0xa'));var squel=require('squel');var crypto=require(_0x39c9('0xb'));var jsforce=require(_0x39c9('0xc'));var deskjs=require(_0x39c9('0xd'));var toCsv=require(_0x39c9('0x7'));var querystring=require(_0x39c9('0xe'));var Papa=require(_0x39c9('0xf'));var Redis=require(_0x39c9('0x10'));var authService=require(_0x39c9('0x11'));var qs=require(_0x39c9('0x12'));var as=require(_0x39c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39c9('0x14'))(_0x39c9('0x15'));var utils=require('../../config/utils');var config=require(_0x39c9('0x16'));var licenseUtil=require(_0x39c9('0x17'));var db=require(_0x39c9('0x18'))['db'];function respondWithStatusCode(_0x44c767,_0x5361d8){_0x5361d8=_0x5361d8||0xcc;return function(_0x4792a5){if(_0x4792a5){return _0x44c767[_0x39c9('0x19')](_0x5361d8);}return _0x44c767[_0x39c9('0x1a')](_0x5361d8)[_0x39c9('0x1b')]();};}function respondWithResult(_0x2565d0,_0x159aba){_0x159aba=_0x159aba||0xc8;return function(_0x12c342){if(_0x12c342){return _0x2565d0['status'](_0x159aba)[_0x39c9('0x1c')](_0x12c342);}};}function respondWithFilteredResult(_0x5213e6,_0x547899){return function(_0x48ef27){if(_0x48ef27){var _0x5a5f57=typeof _0x547899['offset']===_0x39c9('0x1d')&&typeof _0x547899[_0x39c9('0x1e')]==='undefined';var _0x4daeb4=_0x48ef27[_0x39c9('0x1f')];var _0x2cfc0b=_0x5a5f57?0x0:_0x547899[_0x39c9('0x20')];var _0x38cc05=_0x5a5f57?_0x48ef27[_0x39c9('0x1f')]:_0x547899[_0x39c9('0x20')]+_0x547899['limit'];var _0x28ec8d;if(_0x38cc05>=_0x4daeb4){_0x38cc05=_0x4daeb4;_0x28ec8d=0xc8;}else{_0x28ec8d=0xce;}_0x5213e6[_0x39c9('0x1a')](_0x28ec8d);return _0x5213e6['set'](_0x39c9('0x21'),_0x2cfc0b+'-'+_0x38cc05+'/'+_0x4daeb4)['json'](_0x48ef27);}return null;};}function patchUpdates(_0x457022){return function(_0x4c7e2b){try{jsonpatch[_0x39c9('0x22')](_0x4c7e2b,_0x457022,!![]);}catch(_0x577d04){return BPromise[_0x39c9('0x23')](_0x577d04);}return _0x4c7e2b['save']();};}function saveUpdates(_0x53170f,_0x34dec4){return function(_0x29c257){if(_0x29c257){return _0x29c257[_0x39c9('0x24')](_0x53170f)[_0x39c9('0x25')](function(_0x13f708){return _0x13f708;});}return null;};}function removeEntity(_0x5ec2a9,_0x5e5df7){return function(_0x227b2b){if(_0x227b2b){return _0x227b2b[_0x39c9('0x26')]()[_0x39c9('0x25')](function(){var _0x5085b8=_0x227b2b[_0x39c9('0x27')]({'plain':!![]});var _0x1da29b=_0x39c9('0x28');return db['UserProfileResource'][_0x39c9('0x26')]({'where':{'type':_0x1da29b,'resourceId':_0x5085b8['id']}})[_0x39c9('0x25')](function(){return _0x227b2b;});})[_0x39c9('0x25')](function(){_0x5ec2a9[_0x39c9('0x1a')](0xcc)[_0x39c9('0x1b')]();});}};}function handleEntityNotFound(_0x4e3aeb,_0x33daf6){return function(_0x3abc83){if(!_0x3abc83){_0x4e3aeb[_0x39c9('0x19')](0x194);}return _0x3abc83;};}function handleError(_0x5f58f9,_0x4dc0d1){_0x4dc0d1=_0x4dc0d1||0x1f4;return function(_0x134ee2){logger['error'](_0x134ee2[_0x39c9('0x29')]);if(_0x134ee2['name']){delete _0x134ee2[_0x39c9('0x2a')];}_0x5f58f9[_0x39c9('0x1a')](_0x4dc0d1)[_0x39c9('0x2b')](_0x134ee2);};}exports[_0x39c9('0x2c')]=function(_0x5bda07,_0x26f7e3){var _0xdcf3a4={},_0x11c83f={},_0x3786ca={'count':0x0,'rows':[]};var _0x4b5888=_[_0x39c9('0x2d')](db[_0x39c9('0x2e')]['rawAttributes'],function(_0x29d98d){return{'name':_0x29d98d[_0x39c9('0x2f')],'type':_0x29d98d[_0x39c9('0x30')][_0x39c9('0x31')]};});_0x11c83f['model']=_['map'](_0x4b5888,_0x39c9('0x2a'));_0x11c83f[_0x39c9('0x32')]=_[_0x39c9('0x33')](_0x5bda07[_0x39c9('0x32')]);_0x11c83f['filters']=_['intersection'](_0x11c83f['model'],_0x11c83f['query']);_0xdcf3a4[_0x39c9('0x34')]=_[_0x39c9('0x35')](_0x11c83f[_0x39c9('0x36')],qs[_0x39c9('0x37')](_0x5bda07[_0x39c9('0x32')]['fields']));_0xdcf3a4['attributes']=_0xdcf3a4[_0x39c9('0x34')][_0x39c9('0x38')]?_0xdcf3a4[_0x39c9('0x34')]:_0x11c83f[_0x39c9('0x36')];if(!_0x5bda07[_0x39c9('0x32')]['hasOwnProperty'](_0x39c9('0x39'))){_0xdcf3a4[_0x39c9('0x1e')]=qs[_0x39c9('0x1e')](_0x5bda07[_0x39c9('0x32')][_0x39c9('0x1e')]);_0xdcf3a4[_0x39c9('0x20')]=qs[_0x39c9('0x20')](_0x5bda07[_0x39c9('0x32')][_0x39c9('0x20')]);}_0xdcf3a4[_0x39c9('0x3a')]=qs[_0x39c9('0x3b')](_0x5bda07[_0x39c9('0x32')]['sort']);delete _0x5bda07[_0x39c9('0x32')][_0x39c9('0x3b')];_0xdcf3a4[_0x39c9('0x3c')]=qs[_0x39c9('0x3d')](_[_0x39c9('0x3e')](_0x5bda07[_0x39c9('0x32')],_0x11c83f[_0x39c9('0x3d')]),_0x4b5888);if(_0x5bda07[_0x39c9('0x32')][_0x39c9('0x3f')]){_0xdcf3a4[_0x39c9('0x3c')]=_[_0x39c9('0x40')](_0xdcf3a4['where'],{'$or':_[_0x39c9('0x2d')](_0x4b5888,function(_0x48f5b1){if(_0x48f5b1[_0x39c9('0x30')]!==_0x39c9('0x41')){var _0x14e42a={};_0x14e42a[_0x48f5b1[_0x39c9('0x2a')]]={'$like':'%'+_0x5bda07[_0x39c9('0x32')][_0x39c9('0x3f')]+'%'};return _0x14e42a;}})});}_0xdcf3a4=_[_0x39c9('0x40')]({},_0xdcf3a4,_0x5bda07[_0x39c9('0x42')]);var _0x47d7cc={'where':_0xdcf3a4[_0x39c9('0x3c')]};return db['VoiceMusicOnHold']['count'](_0x47d7cc)['then'](function(_0x37806b){_0x3786ca[_0x39c9('0x1f')]=_0x37806b;if(_0x5bda07[_0x39c9('0x32')][_0x39c9('0x43')]){_0xdcf3a4['include']=[{'all':!![]}];}return db[_0x39c9('0x2e')]['findAll'](_0xdcf3a4);})[_0x39c9('0x25')](function(_0x283e05){_0x3786ca[_0x39c9('0x44')]=_0x283e05;return _0x3786ca;})['then'](respondWithFilteredResult(_0x26f7e3,_0xdcf3a4))[_0x39c9('0x45')](handleError(_0x26f7e3,null));};exports[_0x39c9('0x46')]=function(_0x225d84,_0x167713){var _0x2a8901={'raw':![],'where':{'id':_0x225d84['params']['id']}},_0xc3ffb3={};_0xc3ffb3[_0x39c9('0x36')]=_[_0x39c9('0x33')](db[_0x39c9('0x2e')][_0x39c9('0x47')]);_0xc3ffb3['query']=_['keys'](_0x225d84['query']);_0xc3ffb3['filters']=_['intersection'](_0xc3ffb3[_0x39c9('0x36')],_0xc3ffb3[_0x39c9('0x32')]);_0x2a8901['attributes']=_['intersection'](_0xc3ffb3[_0x39c9('0x36')],qs[_0x39c9('0x37')](_0x225d84[_0x39c9('0x32')][_0x39c9('0x37')]));_0x2a8901[_0x39c9('0x34')]=_0x2a8901[_0x39c9('0x34')][_0x39c9('0x38')]?_0x2a8901[_0x39c9('0x34')]:_0xc3ffb3[_0x39c9('0x36')];if(_0x225d84[_0x39c9('0x32')][_0x39c9('0x43')]){_0x2a8901[_0x39c9('0x48')]=[{'all':!![]}];}_0x2a8901=_[_0x39c9('0x40')]({},_0x2a8901,_0x225d84['options']);return db[_0x39c9('0x2e')]['find'](_0x2a8901)[_0x39c9('0x25')](handleEntityNotFound(_0x167713,null))['then'](respondWithResult(_0x167713,null))['catch'](handleError(_0x167713,null));};exports['update']=function(_0x4913ff,_0xa2e5bd){if(_0x4913ff['body']['id']){delete _0x4913ff[_0x39c9('0x49')]['id'];}return db['VoiceMusicOnHold'][_0x39c9('0x4a')]({'where':{'id':_0x4913ff['params']['id']}})['then'](handleEntityNotFound(_0xa2e5bd,null))[_0x39c9('0x25')](saveUpdates(_0x4913ff['body'],null))['then'](respondWithResult(_0xa2e5bd,null))['catch'](handleError(_0xa2e5bd,null));};exports['create']=function(_0x194859,_0x39e97f,_0x7328a9){return db['sequelize'][_0x39c9('0x4b')](function(_0x523bba){if(_0x194859[_0x39c9('0x49')]['mode']==='files'){_0x194859[_0x39c9('0x49')]['directory']=path[_0x39c9('0x4c')](config[_0x39c9('0x4d')],'server/files/moh',_0x194859[_0x39c9('0x49')][_0x39c9('0x2a')]);}return db[_0x39c9('0x2e')]['create'](_0x194859[_0x39c9('0x49')],{'transaction':_0x523bba})[_0x39c9('0x25')](function(_0x596e3e){if(_0x194859[_0x39c9('0x49')][_0x39c9('0x4e')]==='files'){fs[_0x39c9('0x4f')](_0x596e3e[_0x39c9('0x50')],parseInt(_0x39c9('0x51'),0x8));}var _0x4cabdf=_0x194859[_0x39c9('0x52')][_0x39c9('0x27')]({'plain':!![]});if(!_0x4cabdf)throw new Error(_0x39c9('0x53'));if(_0x4cabdf['role']===_0x39c9('0x52')){var _0x4d9e3f=_0x596e3e[_0x39c9('0x27')]({'plain':!![]});return db[_0x39c9('0x54')][_0x39c9('0x4a')]({'where':{'name':_0x39c9('0x28'),'userProfileId':_0x4cabdf[_0x39c9('0x55')]},'raw':!![]})[_0x39c9('0x25')](function(_0x1dd860){if(_0x1dd860&&_0x1dd860[_0x39c9('0x56')]===0x0){return db[_0x39c9('0x57')][_0x39c9('0x58')]({'name':_0x4d9e3f[_0x39c9('0x2a')],'resourceId':_0x4d9e3f['id'],'type':_0x1dd860[_0x39c9('0x2a')],'sectionId':_0x1dd860['id']},{})[_0x39c9('0x25')](function(){return _0x596e3e;});}else{return _0x596e3e;}})[_0x39c9('0x45')](function(_0x161025){logger[_0x39c9('0x59')](_0x39c9('0x5a'),_0x161025);});}return _0x596e3e;});})['then'](respondWithResult(_0x39e97f,0xc9))[_0x39c9('0x45')](handleError(_0x39e97f,null));};exports['destroy']=function(_0x565d3a,_0xff0775,_0x3840f6){var _0x10dfc1;return db['VoiceMusicOnHold'][_0x39c9('0x4a')]({'where':{'id':_0x565d3a[_0x39c9('0x5b')]['id']}})[_0x39c9('0x25')](function(_0xbf7deb){if(_0xbf7deb){return db[_0x39c9('0x5c')][_0x39c9('0x4b')](function(_0x14936e){return _0xbf7deb[_0x39c9('0x26')]({'transaction':_0x14936e,'raw':!![]})[_0x39c9('0x25')](function(_0x43e2ea){if(_0x43e2ea[_0x39c9('0x50')]){fs[_0x39c9('0x5d')](_0x43e2ea[_0x39c9('0x50')])[_0x39c9('0x5e')](function(_0x444a31){fs[_0x39c9('0x5f')](path['join'](_0x43e2ea['directory'],_0x444a31));});fs[_0x39c9('0x60')](_0x43e2ea[_0x39c9('0x50')]);}return _0x43e2ea;});})[_0x39c9('0x45')](function(_0x4f2bfb){throw new db['Sequelize'][(_0x39c9('0x61'))](_0x4f2bfb[_0x39c9('0x62')]);});}})[_0x39c9('0x25')](handleEntityNotFound(_0xff0775,null))[_0x39c9('0x25')](removeEntity(_0xff0775,null))['catch'](handleError(_0xff0775,null));};exports[_0x39c9('0x63')]=function(_0x529990,_0x4beb4a,_0x3a2ec0){return db['sequelize']['transaction'](function(_0x38e2e1){var _0x1258de;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x529990[_0x39c9('0x5b')]['id']}})[_0x39c9('0x25')](function(_0x41bba6){if(_0x41bba6){_0x1258de=_0x41bba6;return _0x41bba6[_0x39c9('0x63')](_0x529990[_0x39c9('0x49')]['id'],{'transaction':_0x38e2e1});}})[_0x39c9('0x25')](function(_0x46b590){if(_0x46b590){return db[_0x39c9('0x64')]['findOne']({'where':{'id':_0x529990[_0x39c9('0x49')]['id']},'attributes':['id',_0x39c9('0x2a'),_0x39c9('0x65'),_0x39c9('0x66'),_0x39c9('0x67')],'raw':!![]});}})[_0x39c9('0x25')](function(_0x318b59){if(_0x318b59){var _0x2d8400=path[_0x39c9('0x4c')](config['root'],_0x39c9('0x68'),util['format'](_0x39c9('0x69'),path[_0x39c9('0x6a')](_0x318b59[_0x39c9('0x65')],path[_0x39c9('0x6b')](_0x318b59['save_name'])),_0x318b59[_0x39c9('0x66')]));var _0x459d70=path[_0x39c9('0x4c')](config[_0x39c9('0x4d')],_0x39c9('0x6c'),_0x1258de[_0x39c9('0x2a')],util[_0x39c9('0x6d')](_0x39c9('0x69'),_0x318b59[_0x39c9('0x2a')],_0x318b59[_0x39c9('0x66')]));fs[_0x39c9('0x6e')](_0x2d8400,_0x459d70);return _0x318b59;}})['catch'](function(_0x48b9b7){throw new db[(_0x39c9('0x6f'))][(_0x39c9('0x61'))](_0x48b9b7[_0x39c9('0x62')]);});})[_0x39c9('0x25')](handleEntityNotFound(_0x4beb4a,null))['then'](respondWithResult(_0x4beb4a,0xc9))[_0x39c9('0x45')](handleError(_0x4beb4a,null));};exports[_0x39c9('0x70')]=function(_0x4e5246,_0x1a3dad,_0x201508){return db[_0x39c9('0x5c')]['transaction'](function(_0x2be6ca){var _0xb5a494;return db[_0x39c9('0x2e')][_0x39c9('0x71')]({'where':{'id':_0x4e5246[_0x39c9('0x5b')]['id']}})[_0x39c9('0x25')](handleEntityNotFound(_0x1a3dad,null))[_0x39c9('0x25')](function(_0x3e88c0){if(_0x3e88c0){_0xb5a494=_0x3e88c0;return _0x3e88c0[_0x39c9('0x70')](_0x4e5246['params'][_0x39c9('0x72')]);}})[_0x39c9('0x25')](function(_0x40b7d9){if(_0x40b7d9){return db[_0x39c9('0x64')][_0x39c9('0x71')]({'where':{'id':_0x4e5246[_0x39c9('0x5b')][_0x39c9('0x72')]},'attributes':['id',_0x39c9('0x2a'),'save_name',_0x39c9('0x66'),_0x39c9('0x67')],'raw':!![]});}})['then'](function(_0x1a812b){if(_0x1a812b){fs[_0x39c9('0x5f')](path[_0x39c9('0x4c')](_0xb5a494[_0x39c9('0x50')],util['format'](_0x39c9('0x69'),_0x1a812b[_0x39c9('0x2a')],_0x1a812b[_0x39c9('0x66')])));return _0x1a812b;}})[_0x39c9('0x45')](function(_0x4a13a2){throw new db[(_0x39c9('0x6f'))][(_0x39c9('0x61'))](_0x4a13a2['message']);});})[_0x39c9('0x25')](handleEntityNotFound(_0x1a3dad,null))['then'](respondWithStatusCode(_0x1a3dad,0xcc))[_0x39c9('0x45')](handleError(_0x1a3dad,null));};exports[_0x39c9('0x73')]=function(_0x1f09ca,_0x17bd77,_0x4e1d5e){var _0x14cd99={};var _0x56f60a={};var _0x10c5dc;var _0x268097;return db['VoiceMusicOnHold'][_0x39c9('0x71')]({'where':{'id':_0x1f09ca['params']['id']}})['then'](handleEntityNotFound(_0x17bd77,null))[_0x39c9('0x25')](function(_0x85c6e){if(_0x85c6e){_0x10c5dc=_0x85c6e;_0x56f60a['model']=_[_0x39c9('0x33')](db[_0x39c9('0x64')]['rawAttributes']);_0x56f60a[_0x39c9('0x32')]=_[_0x39c9('0x33')](_0x1f09ca[_0x39c9('0x32')]);_0x56f60a[_0x39c9('0x3d')]=_[_0x39c9('0x35')](_0x56f60a[_0x39c9('0x36')],_0x56f60a[_0x39c9('0x32')]);_0x14cd99[_0x39c9('0x34')]=_[_0x39c9('0x35')](_0x56f60a[_0x39c9('0x36')],qs['fields'](_0x1f09ca['query']['fields']));_0x14cd99['attributes']=_0x14cd99['attributes'][_0x39c9('0x38')]?_0x14cd99[_0x39c9('0x34')]:_0x56f60a[_0x39c9('0x36')];_0x14cd99['order']=qs[_0x39c9('0x3b')](_0x1f09ca[_0x39c9('0x32')][_0x39c9('0x3b')]);_0x14cd99['where']=qs[_0x39c9('0x3d')](_[_0x39c9('0x3e')](_0x1f09ca[_0x39c9('0x32')],_0x56f60a[_0x39c9('0x3d')]));if(_0x1f09ca['query']['filter']){_0x14cd99['where']=_[_0x39c9('0x40')](_0x14cd99['where'],{'$or':_['map'](_0x14cd99[_0x39c9('0x34')],function(_0x3cac3c){var _0x306808={};_0x306808[_0x3cac3c]={'$like':'%'+_0x1f09ca['query']['filter']+'%'};return _0x306808;})});}_0x14cd99=_['merge']({},_0x14cd99,_0x1f09ca['options']);return _0x10c5dc[_0x39c9('0x73')](_0x14cd99);}})[_0x39c9('0x25')](function(_0x2c71fa){if(_0x2c71fa){_0x268097=_0x2c71fa[_0x39c9('0x38')];if(!_0x1f09ca[_0x39c9('0x32')][_0x39c9('0x74')](_0x39c9('0x39'))){_0x14cd99['limit']=qs[_0x39c9('0x1e')](_0x1f09ca[_0x39c9('0x32')]['limit']);_0x14cd99[_0x39c9('0x20')]=qs[_0x39c9('0x20')](_0x1f09ca[_0x39c9('0x32')][_0x39c9('0x20')]);}return _0x10c5dc[_0x39c9('0x73')](_0x14cd99);}})[_0x39c9('0x25')](function(_0x238c92){if(_0x238c92){return _0x238c92?{'count':_0x268097,'rows':_0x238c92}:null;}})[_0x39c9('0x25')](respondWithResult(_0x17bd77,null))[_0x39c9('0x45')](handleError(_0x17bd77,null));}; \ No newline at end of file +var _0x531d=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','params','include','options','body','find','sequelize','transaction','mode','files','create','mkdirSync','directory','0777','get','user','UserProfileSection','MusicOnHolds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','Sound','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','server/files/moh','Sequelize','ValidationError','removeSound','findOne','id2','getSounds','hasOwnProperty','rimraf','zip-dir','bluebird','path','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','sendStatus','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x4111f8,_0x2c6325){var _0x4ac8d8=function(_0x8898bf){while(--_0x8898bf){_0x4111f8['push'](_0x4111f8['shift']());}};_0x4ac8d8(++_0x2c6325);}(_0x531d,0x10d));var _0xd531=function(_0x32a20b,_0x226241){_0x32a20b=_0x32a20b-0x0;var _0x25ae51=_0x531d[_0x32a20b];return _0x25ae51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd531('0x0'));var zipdir=require(_0xd531('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd531('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd531('0x3'));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(_0xd531('0x4'));var squel=require(_0xd531('0x5'));var crypto=require(_0xd531('0x6'));var jsforce=require('jsforce');var deskjs=require(_0xd531('0x7'));var toCsv=require('to-csv');var querystring=require(_0xd531('0x8'));var Papa=require(_0xd531('0x9'));var Redis=require(_0xd531('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xd531('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd531('0xc'));var logger=require('../../config/logger')(_0xd531('0xd'));var utils=require('../../config/utils');var config=require(_0xd531('0xe'));var licenseUtil=require(_0xd531('0xf'));var db=require(_0xd531('0x10'))['db'];function respondWithStatusCode(_0x4d2920,_0x459a3c){_0x459a3c=_0x459a3c||0xcc;return function(_0x3edc86){if(_0x3edc86){return _0x4d2920['sendStatus'](_0x459a3c);}return _0x4d2920[_0xd531('0x11')](_0x459a3c)[_0xd531('0x12')]();};}function respondWithResult(_0xb86ba4,_0x1fbdfa){_0x1fbdfa=_0x1fbdfa||0xc8;return function(_0x139008){if(_0x139008){return _0xb86ba4[_0xd531('0x11')](_0x1fbdfa)[_0xd531('0x13')](_0x139008);}};}function respondWithFilteredResult(_0x1e33c0,_0x56cfa9){return function(_0x2b4009){if(_0x2b4009){var _0x43d5f8=typeof _0x56cfa9[_0xd531('0x14')]===_0xd531('0x15')&&typeof _0x56cfa9[_0xd531('0x16')]===_0xd531('0x15');var _0x3a85a5=_0x2b4009['count'];var _0x3dec12=_0x43d5f8?0x0:_0x56cfa9[_0xd531('0x14')];var _0x33caaa=_0x43d5f8?_0x2b4009['count']:_0x56cfa9[_0xd531('0x14')]+_0x56cfa9[_0xd531('0x16')];var _0x41aa8d;if(_0x33caaa>=_0x3a85a5){_0x33caaa=_0x3a85a5;_0x41aa8d=0xc8;}else{_0x41aa8d=0xce;}_0x1e33c0[_0xd531('0x11')](_0x41aa8d);return _0x1e33c0[_0xd531('0x17')](_0xd531('0x18'),_0x3dec12+'-'+_0x33caaa+'/'+_0x3a85a5)['json'](_0x2b4009);}return null;};}function patchUpdates(_0x34823d){return function(_0x2ea501){try{jsonpatch[_0xd531('0x19')](_0x2ea501,_0x34823d,!![]);}catch(_0x2f4d70){return BPromise[_0xd531('0x1a')](_0x2f4d70);}return _0x2ea501[_0xd531('0x1b')]();};}function saveUpdates(_0x1bf850,_0x484b13){return function(_0xa78104){if(_0xa78104){return _0xa78104[_0xd531('0x1c')](_0x1bf850)['then'](function(_0x472d59){return _0x472d59;});}return null;};}function removeEntity(_0x3f4736,_0x389c05){return function(_0xd54765){if(_0xd54765){return _0xd54765[_0xd531('0x1d')]()[_0xd531('0x1e')](function(){var _0x15b1d5=_0xd54765['get']({'plain':!![]});var _0x2a9f9a='MusicOnHolds';return db[_0xd531('0x1f')][_0xd531('0x1d')]({'where':{'type':_0x2a9f9a,'resourceId':_0x15b1d5['id']}})[_0xd531('0x1e')](function(){return _0xd54765;});})[_0xd531('0x1e')](function(){_0x3f4736['status'](0xcc)[_0xd531('0x12')]();});}};}function handleEntityNotFound(_0x400fc7,_0x5e1251){return function(_0x2b9e3c){if(!_0x2b9e3c){_0x400fc7[_0xd531('0x20')](0x194);}return _0x2b9e3c;};}function handleError(_0x129a19,_0x18e468){_0x18e468=_0x18e468||0x1f4;return function(_0x5740a8){logger[_0xd531('0x21')](_0x5740a8['stack']);if(_0x5740a8[_0xd531('0x22')]){delete _0x5740a8[_0xd531('0x22')];}_0x129a19[_0xd531('0x11')](_0x18e468)[_0xd531('0x23')](_0x5740a8);};}exports[_0xd531('0x24')]=function(_0x23d1ef,_0x5a21c0){var _0x5cf391={},_0x39da16={},_0xf14caa={'count':0x0,'rows':[]};var _0xe349a4=_[_0xd531('0x25')](db[_0xd531('0x26')][_0xd531('0x27')],function(_0xbe310){return{'name':_0xbe310[_0xd531('0x28')],'type':_0xbe310[_0xd531('0x29')]['key']};});_0x39da16[_0xd531('0x2a')]=_['map'](_0xe349a4,'name');_0x39da16[_0xd531('0x2b')]=_[_0xd531('0x2c')](_0x23d1ef[_0xd531('0x2b')]);_0x39da16[_0xd531('0x2d')]=_[_0xd531('0x2e')](_0x39da16[_0xd531('0x2a')],_0x39da16[_0xd531('0x2b')]);_0x5cf391[_0xd531('0x2f')]=_[_0xd531('0x2e')](_0x39da16[_0xd531('0x2a')],qs[_0xd531('0x30')](_0x23d1ef[_0xd531('0x2b')]['fields']));_0x5cf391[_0xd531('0x2f')]=_0x5cf391[_0xd531('0x2f')][_0xd531('0x31')]?_0x5cf391[_0xd531('0x2f')]:_0x39da16[_0xd531('0x2a')];if(!_0x23d1ef[_0xd531('0x2b')]['hasOwnProperty'](_0xd531('0x32'))){_0x5cf391['limit']=qs[_0xd531('0x16')](_0x23d1ef['query'][_0xd531('0x16')]);_0x5cf391[_0xd531('0x14')]=qs['offset'](_0x23d1ef[_0xd531('0x2b')]['offset']);}_0x5cf391[_0xd531('0x33')]=qs[_0xd531('0x34')](_0x23d1ef['query'][_0xd531('0x34')]);delete _0x23d1ef['query'][_0xd531('0x34')];_0x5cf391[_0xd531('0x35')]=qs[_0xd531('0x2d')](_[_0xd531('0x36')](_0x23d1ef[_0xd531('0x2b')],_0x39da16[_0xd531('0x2d')]),_0xe349a4);if(_0x23d1ef[_0xd531('0x2b')][_0xd531('0x37')]){_0x5cf391['where']=_[_0xd531('0x38')](_0x5cf391['where'],{'$or':_[_0xd531('0x25')](_0xe349a4,function(_0x112e96){if(_0x112e96[_0xd531('0x29')]!==_0xd531('0x39')){var _0x2d007d={};_0x2d007d[_0x112e96['name']]={'$like':'%'+_0x23d1ef[_0xd531('0x2b')]['filter']+'%'};return _0x2d007d;}})});}_0x5cf391=_[_0xd531('0x38')]({},_0x5cf391,_0x23d1ef['options']);var _0x550398={'where':_0x5cf391[_0xd531('0x35')]};return db[_0xd531('0x26')][_0xd531('0x3a')](_0x550398)[_0xd531('0x1e')](function(_0x4fd9c1){_0xf14caa[_0xd531('0x3a')]=_0x4fd9c1;if(_0x23d1ef['query'][_0xd531('0x3b')]){_0x5cf391['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xd531('0x3c')](_0x5cf391);})[_0xd531('0x1e')](function(_0x2edab4){_0xf14caa[_0xd531('0x3d')]=_0x2edab4;return _0xf14caa;})['then'](respondWithFilteredResult(_0x5a21c0,_0x5cf391))[_0xd531('0x3e')](handleError(_0x5a21c0,null));};exports['show']=function(_0x4bdd7d,_0x1cae04){var _0x4b37ef={'raw':![],'where':{'id':_0x4bdd7d[_0xd531('0x3f')]['id']}},_0x151c53={};_0x151c53[_0xd531('0x2a')]=_[_0xd531('0x2c')](db[_0xd531('0x26')][_0xd531('0x27')]);_0x151c53[_0xd531('0x2b')]=_[_0xd531('0x2c')](_0x4bdd7d[_0xd531('0x2b')]);_0x151c53[_0xd531('0x2d')]=_['intersection'](_0x151c53['model'],_0x151c53[_0xd531('0x2b')]);_0x4b37ef[_0xd531('0x2f')]=_[_0xd531('0x2e')](_0x151c53['model'],qs[_0xd531('0x30')](_0x4bdd7d[_0xd531('0x2b')][_0xd531('0x30')]));_0x4b37ef[_0xd531('0x2f')]=_0x4b37ef['attributes'][_0xd531('0x31')]?_0x4b37ef[_0xd531('0x2f')]:_0x151c53[_0xd531('0x2a')];if(_0x4bdd7d['query'][_0xd531('0x3b')]){_0x4b37ef[_0xd531('0x40')]=[{'all':!![]}];}_0x4b37ef=_['merge']({},_0x4b37ef,_0x4bdd7d[_0xd531('0x41')]);return db['VoiceMusicOnHold']['find'](_0x4b37ef)[_0xd531('0x1e')](handleEntityNotFound(_0x1cae04,null))[_0xd531('0x1e')](respondWithResult(_0x1cae04,null))['catch'](handleError(_0x1cae04,null));};exports[_0xd531('0x1c')]=function(_0x30fe5d,_0x3fd223){if(_0x30fe5d[_0xd531('0x42')]['id']){delete _0x30fe5d[_0xd531('0x42')]['id'];}return db['VoiceMusicOnHold'][_0xd531('0x43')]({'where':{'id':_0x30fe5d[_0xd531('0x3f')]['id']}})[_0xd531('0x1e')](handleEntityNotFound(_0x3fd223,null))[_0xd531('0x1e')](saveUpdates(_0x30fe5d['body'],null))[_0xd531('0x1e')](respondWithResult(_0x3fd223,null))['catch'](handleError(_0x3fd223,null));};exports['create']=function(_0x23ebde,_0x24c988,_0x3f0b76){return db[_0xd531('0x44')][_0xd531('0x45')](function(_0x372e15){if(_0x23ebde['body'][_0xd531('0x46')]===_0xd531('0x47')){_0x23ebde[_0xd531('0x42')]['directory']=path['join'](config['root'],'server/files/moh',_0x23ebde[_0xd531('0x42')]['name']);}return db[_0xd531('0x26')][_0xd531('0x48')](_0x23ebde[_0xd531('0x42')],{'transaction':_0x372e15})[_0xd531('0x1e')](function(_0x41aeee){if(_0x23ebde[_0xd531('0x42')]['mode']==='files'){fs[_0xd531('0x49')](_0x41aeee[_0xd531('0x4a')],parseInt(_0xd531('0x4b'),0x8));}var _0x518628=_0x23ebde['user'][_0xd531('0x4c')]({'plain':!![]});if(!_0x518628)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x518628['role']===_0xd531('0x4d')){var _0x349b30=_0x41aeee[_0xd531('0x4c')]({'plain':!![]});return db[_0xd531('0x4e')][_0xd531('0x43')]({'where':{'name':_0xd531('0x4f'),'userProfileId':_0x518628['userProfileId']},'raw':!![]})[_0xd531('0x1e')](function(_0x640e3f){if(_0x640e3f&&_0x640e3f['autoAssociation']===0x0){return db[_0xd531('0x1f')]['create']({'name':_0x349b30['name'],'resourceId':_0x349b30['id'],'type':_0x640e3f['name'],'sectionId':_0x640e3f['id']},{})['then'](function(){return _0x41aeee;});}else{return _0x41aeee;}})[_0xd531('0x3e')](function(_0x1d48ab){logger['error'](_0xd531('0x50'),_0x1d48ab);});}return _0x41aeee;});})[_0xd531('0x1e')](respondWithResult(_0x24c988,0xc9))[_0xd531('0x3e')](handleError(_0x24c988,null));};exports[_0xd531('0x1d')]=function(_0x535225,_0x242dc0,_0x4d601a){var _0x154fa3;return db['VoiceMusicOnHold'][_0xd531('0x43')]({'where':{'id':_0x535225[_0xd531('0x3f')]['id']}})[_0xd531('0x1e')](function(_0x384bab){if(_0x384bab){return db[_0xd531('0x44')][_0xd531('0x45')](function(_0x21812f){return _0x384bab[_0xd531('0x1d')]({'transaction':_0x21812f,'raw':!![]})[_0xd531('0x1e')](function(_0x50fd3c){if(_0x50fd3c['directory']){fs[_0xd531('0x51')](_0x50fd3c[_0xd531('0x4a')])[_0xd531('0x52')](function(_0x42b974){fs[_0xd531('0x53')](path[_0xd531('0x54')](_0x50fd3c[_0xd531('0x4a')],_0x42b974));});fs[_0xd531('0x55')](_0x50fd3c['directory']);}return _0x50fd3c;});})[_0xd531('0x3e')](function(_0x1b73e6){throw new db['Sequelize']['ValidationError'](_0x1b73e6[_0xd531('0x56')]);});}})['then'](handleEntityNotFound(_0x242dc0,null))[_0xd531('0x1e')](removeEntity(_0x242dc0,null))[_0xd531('0x3e')](handleError(_0x242dc0,null));};exports[_0xd531('0x57')]=function(_0x4303d5,_0x4c57c7,_0x3a884a){return db['sequelize']['transaction'](function(_0x3d4121){var _0x4f8653;return db[_0xd531('0x26')][_0xd531('0x43')]({'where':{'id':_0x4303d5[_0xd531('0x3f')]['id']}})[_0xd531('0x1e')](function(_0x492d56){if(_0x492d56){_0x4f8653=_0x492d56;return _0x492d56[_0xd531('0x57')](_0x4303d5[_0xd531('0x42')]['id'],{'transaction':_0x3d4121});}})[_0xd531('0x1e')](function(_0x35dee5){if(_0x35dee5){return db[_0xd531('0x58')]['findOne']({'where':{'id':_0x4303d5[_0xd531('0x42')]['id']},'attributes':['id',_0xd531('0x22'),'save_name',_0xd531('0x59'),_0xd531('0x5a')],'raw':!![]});}})[_0xd531('0x1e')](function(_0x291dd9){if(_0x291dd9){var _0x4bdee9=path[_0xd531('0x54')](config[_0xd531('0x5b')],_0xd531('0x5c'),util[_0xd531('0x5d')](_0xd531('0x5e'),path[_0xd531('0x5f')](_0x291dd9[_0xd531('0x60')],path[_0xd531('0x61')](_0x291dd9[_0xd531('0x60')])),_0x291dd9[_0xd531('0x59')]));var _0x5f028d=path['join'](config[_0xd531('0x5b')],_0xd531('0x62'),_0x4f8653[_0xd531('0x22')],util['format'](_0xd531('0x5e'),_0x291dd9[_0xd531('0x22')],_0x291dd9[_0xd531('0x59')]));fs['symlinkSync'](_0x4bdee9,_0x5f028d);return _0x291dd9;}})[_0xd531('0x3e')](function(_0x197386){throw new db[(_0xd531('0x63'))][(_0xd531('0x64'))](_0x197386[_0xd531('0x56')]);});})['then'](handleEntityNotFound(_0x4c57c7,null))[_0xd531('0x1e')](respondWithResult(_0x4c57c7,0xc9))[_0xd531('0x3e')](handleError(_0x4c57c7,null));};exports[_0xd531('0x65')]=function(_0x242b6a,_0x5bd43b,_0x3cdc65){return db['sequelize']['transaction'](function(_0x33aa11){var _0x44c937;return db['VoiceMusicOnHold'][_0xd531('0x66')]({'where':{'id':_0x242b6a[_0xd531('0x3f')]['id']}})[_0xd531('0x1e')](handleEntityNotFound(_0x5bd43b,null))[_0xd531('0x1e')](function(_0xce6fbb){if(_0xce6fbb){_0x44c937=_0xce6fbb;return _0xce6fbb[_0xd531('0x65')](_0x242b6a[_0xd531('0x3f')]['id2']);}})[_0xd531('0x1e')](function(_0xd7df5d){if(_0xd7df5d){return db[_0xd531('0x58')][_0xd531('0x66')]({'where':{'id':_0x242b6a[_0xd531('0x3f')][_0xd531('0x67')]},'attributes':['id',_0xd531('0x22'),_0xd531('0x60'),_0xd531('0x59'),_0xd531('0x5a')],'raw':!![]});}})[_0xd531('0x1e')](function(_0x21a636){if(_0x21a636){fs[_0xd531('0x53')](path[_0xd531('0x54')](_0x44c937['directory'],util['format']('%s.%s',_0x21a636[_0xd531('0x22')],_0x21a636[_0xd531('0x59')])));return _0x21a636;}})['catch'](function(_0x502878){throw new db['Sequelize'][(_0xd531('0x64'))](_0x502878[_0xd531('0x56')]);});})[_0xd531('0x1e')](handleEntityNotFound(_0x5bd43b,null))[_0xd531('0x1e')](respondWithStatusCode(_0x5bd43b,0xcc))['catch'](handleError(_0x5bd43b,null));};exports[_0xd531('0x68')]=function(_0x4dabbc,_0xc918c,_0x47f38e){var _0x5aaf2d={};var _0x477333={};var _0xb93588;var _0x3c1720;return db['VoiceMusicOnHold'][_0xd531('0x66')]({'where':{'id':_0x4dabbc[_0xd531('0x3f')]['id']}})[_0xd531('0x1e')](handleEntityNotFound(_0xc918c,null))[_0xd531('0x1e')](function(_0x1a42ed){if(_0x1a42ed){_0xb93588=_0x1a42ed;_0x477333['model']=_['keys'](db[_0xd531('0x58')][_0xd531('0x27')]);_0x477333[_0xd531('0x2b')]=_[_0xd531('0x2c')](_0x4dabbc[_0xd531('0x2b')]);_0x477333[_0xd531('0x2d')]=_[_0xd531('0x2e')](_0x477333[_0xd531('0x2a')],_0x477333[_0xd531('0x2b')]);_0x5aaf2d[_0xd531('0x2f')]=_['intersection'](_0x477333[_0xd531('0x2a')],qs['fields'](_0x4dabbc[_0xd531('0x2b')][_0xd531('0x30')]));_0x5aaf2d['attributes']=_0x5aaf2d[_0xd531('0x2f')][_0xd531('0x31')]?_0x5aaf2d[_0xd531('0x2f')]:_0x477333[_0xd531('0x2a')];_0x5aaf2d[_0xd531('0x33')]=qs['sort'](_0x4dabbc[_0xd531('0x2b')]['sort']);_0x5aaf2d['where']=qs[_0xd531('0x2d')](_[_0xd531('0x36')](_0x4dabbc[_0xd531('0x2b')],_0x477333[_0xd531('0x2d')]));if(_0x4dabbc['query']['filter']){_0x5aaf2d[_0xd531('0x35')]=_['merge'](_0x5aaf2d[_0xd531('0x35')],{'$or':_[_0xd531('0x25')](_0x5aaf2d['attributes'],function(_0x5c37ab){var _0x13a653={};_0x13a653[_0x5c37ab]={'$like':'%'+_0x4dabbc['query'][_0xd531('0x37')]+'%'};return _0x13a653;})});}_0x5aaf2d=_[_0xd531('0x38')]({},_0x5aaf2d,_0x4dabbc['options']);return _0xb93588[_0xd531('0x68')](_0x5aaf2d);}})[_0xd531('0x1e')](function(_0x25c496){if(_0x25c496){_0x3c1720=_0x25c496[_0xd531('0x31')];if(!_0x4dabbc[_0xd531('0x2b')][_0xd531('0x69')]('nolimit')){_0x5aaf2d[_0xd531('0x16')]=qs[_0xd531('0x16')](_0x4dabbc[_0xd531('0x2b')][_0xd531('0x16')]);_0x5aaf2d[_0xd531('0x14')]=qs[_0xd531('0x14')](_0x4dabbc[_0xd531('0x2b')][_0xd531('0x14')]);}return _0xb93588[_0xd531('0x68')](_0x5aaf2d);}})[_0xd531('0x1e')](function(_0x33b3e9){if(_0x33b3e9){return _0x33b3e9?{'count':_0x3c1720,'rows':_0x33b3e9}:null;}})['then'](respondWithResult(_0xc918c,null))[_0xd531('0x3e')](handleError(_0xc918c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2711045..df57895 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 _0xd828=['request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0xd828,0x151));var _0x8d82=function(_0x2a6203,_0x5cd31d){_0x2a6203=_0x2a6203-0x0;var _0x4bcddf=_0xd828[_0x2a6203];return _0x4bcddf;};'use strict';var _=require(_0x8d82('0x0'));var util=require(_0x8d82('0x1'));var logger=require(_0x8d82('0x2'))(_0x8d82('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8d82('0x4'));var fs=require('fs');var path=require(_0x8d82('0x5'));var rimraf=require('rimraf');var config=require(_0x8d82('0x6'));var attributes=require(_0x8d82('0x7'));module['exports']=function(_0x1b54ce,_0x35563d){return _0x1b54ce[_0x8d82('0x8')](_0x8d82('0x9'),attributes,{'tableName':_0x8d82('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf636=['exports','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x38ea83,_0x1b1fe6){var _0x90a5e=function(_0x3655f8){while(--_0x3655f8){_0x38ea83['push'](_0x38ea83['shift']());}};_0x90a5e(++_0x1b1fe6);}(_0xf636,0x7b));var _0x6f63=function(_0xb590d2,_0x2eeba9){_0xb590d2=_0xb590d2-0x0;var _0x3696dd=_0xf636[_0xb590d2];return _0x3696dd;};'use strict';var _=require('lodash');var util=require(_0x6f63('0x0'));var logger=require(_0x6f63('0x1'))(_0x6f63('0x2'));var moment=require(_0x6f63('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f63('0x4'));var fs=require('fs');var path=require(_0x6f63('0x5'));var rimraf=require(_0x6f63('0x6'));var config=require(_0x6f63('0x7'));var attributes=require(_0x6f63('0x8'));module[_0x6f63('0x9')]=function(_0x9d0810,_0x41e1ac){return _0x9d0810['define'](_0x6f63('0xa'),attributes,{'tableName':_0x6f63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 6d0849c..d411110 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(_0xe2386d,_0x2c6716){var _0x18bd5f=function(_0x35f801){while(--_0x35f801){_0xe2386d['push'](_0xe2386d['shift']());}};_0x18bd5f(++_0x2c6716);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x533406,_0x11ea96){var _0x579c8b=function(_0x30d128){while(--_0x30d128){_0x533406['push'](_0x533406['shift']());}};_0x579c8b(++_0x11ea96);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0xcb91[_0xfedc72];return _0x2c7c78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 144047b..f0072b7 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 _0x6bdc=['/:id/teams','getTeams','post','create','addAgents','addTeams','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/users','getAgents'];(function(_0x47d1ae,_0x223047){var _0x1aba68=function(_0x50b99d){while(--_0x50b99d){_0x47d1ae['push'](_0x47d1ae['shift']());}};_0x1aba68(++_0x223047);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x255a6c,_0x4a4dd7){_0x255a6c=_0x255a6c-0x0;var _0x13c1f9=_0x6bdc[_0x255a6c];return _0x13c1f9;};'use strict';var multer=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var path=require(_0xc6bd('0x2'));var timeout=require(_0xc6bd('0x3'));var express=require(_0xc6bd('0x4'));var router=express[_0xc6bd('0x5')]();var fs_extra=require(_0xc6bd('0x6'));var auth=require(_0xc6bd('0x7'));var interaction=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var controller=require('./voicePrefix.controller');router[_0xc6bd('0xa')]('/',auth[_0xc6bd('0xb')](),controller[_0xc6bd('0xc')]);router[_0xc6bd('0xa')](_0xc6bd('0xd'),auth[_0xc6bd('0xb')](),controller['describe']);router[_0xc6bd('0xa')](_0xc6bd('0xe'),auth[_0xc6bd('0xb')](),controller['show']);router['get'](_0xc6bd('0xf'),auth['isAuthenticated'](),controller[_0xc6bd('0x10')]);router['get'](_0xc6bd('0x11'),auth[_0xc6bd('0xb')](),controller[_0xc6bd('0x12')]);router[_0xc6bd('0x13')]('/',auth[_0xc6bd('0xb')](),controller[_0xc6bd('0x14')]);router[_0xc6bd('0x13')](_0xc6bd('0xf'),auth[_0xc6bd('0xb')](),controller[_0xc6bd('0x15')]);router[_0xc6bd('0x13')](_0xc6bd('0x11'),auth[_0xc6bd('0xb')](),controller[_0xc6bd('0x16')]);router['put'](_0xc6bd('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc6bd('0x17')](_0xc6bd('0xe'),auth[_0xc6bd('0xb')](),controller[_0xc6bd('0x18')]);router[_0xc6bd('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xc6bd('0x19')]);router['delete'](_0xc6bd('0x11'),auth[_0xc6bd('0xb')](),controller[_0xc6bd('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x70a1=['/describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index'];(function(_0x4d4ef8,_0x4c9d05){var _0x1137a3=function(_0x18ffaa){while(--_0x18ffaa){_0x4d4ef8['push'](_0x4d4ef8['shift']());}};_0x1137a3(++_0x4c9d05);}(_0x70a1,0x154));var _0x170a=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x70a1[_0x243217];return _0x478029;};'use strict';var multer=require(_0x170a('0x0'));var util=require(_0x170a('0x1'));var path=require(_0x170a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x170a('0x3'));var auth=require(_0x170a('0x4'));var interaction=require(_0x170a('0x5'));var config=require('../../config/environment');var controller=require(_0x170a('0x6'));router[_0x170a('0x7')]('/',auth[_0x170a('0x8')](),controller[_0x170a('0x9')]);router[_0x170a('0x7')](_0x170a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x170a('0x7')](_0x170a('0xb'),auth[_0x170a('0x8')](),controller['show']);router['get'](_0x170a('0xc'),auth[_0x170a('0x8')](),controller[_0x170a('0xd')]);router[_0x170a('0x7')](_0x170a('0xe'),auth['isAuthenticated'](),controller[_0x170a('0xf')]);router[_0x170a('0x10')]('/',auth[_0x170a('0x8')](),controller[_0x170a('0x11')]);router[_0x170a('0x10')](_0x170a('0xc'),auth[_0x170a('0x8')](),controller['addAgents']);router[_0x170a('0x10')](_0x170a('0xe'),auth[_0x170a('0x8')](),controller[_0x170a('0x12')]);router[_0x170a('0x13')]('/:id',auth[_0x170a('0x8')](),controller[_0x170a('0x14')]);router[_0x170a('0x15')](_0x170a('0xb'),auth[_0x170a('0x8')](),controller[_0x170a('0x16')]);router[_0x170a('0x15')](_0x170a('0xc'),auth['isAuthenticated'](),controller[_0x170a('0x17')]);router[_0x170a('0x15')](_0x170a('0xe'),auth[_0x170a('0x8')](),controller[_0x170a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index ef7cc76..02404f8 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 _0x830b=['name','INTEGER','sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x4c9310,_0x26de98){var _0x382493=function(_0x3f8c08){while(--_0x3f8c08){_0x4c9310['push'](_0x4c9310['shift']());}};_0x382493(++_0x26de98);}(_0x830b,0xd2));var _0xb830=function(_0x2e1bbf,_0x223761){_0x2e1bbf=_0x2e1bbf-0x0;var _0x4d23c3=_0x830b[_0x2e1bbf];return _0x4d23c3;};'use strict';var Sequelize=require(_0xb830('0x0'));module[_0xb830('0x1')]={'name':{'type':Sequelize[_0xb830('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xb830('0x3')],'get':function(_0x85ff41){return _0xb830('0x4')+this[_0xb830('0x5')](_0xb830('0x6'))+'-';}},'description':{'type':Sequelize[_0xb830('0x2')]},'callerIdAll':{'type':Sequelize[_0xb830('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xb830('0x7')]}}; \ No newline at end of file +var _0x3aad=['sequelize','exports','STRING','name','system-','getDataValue','INTEGER'];(function(_0x840aba,_0x32b722){var _0x128321=function(_0x1dac9a){while(--_0x1dac9a){_0x840aba['push'](_0x840aba['shift']());}};_0x128321(++_0x32b722);}(_0x3aad,0x1a4));var _0xd3aa=function(_0x3186f5,_0xd6b4dd){_0x3186f5=_0x3186f5-0x0;var _0x11f488=_0x3aad[_0x3186f5];return _0x11f488;};'use strict';var Sequelize=require(_0xd3aa('0x0'));module[_0xd3aa('0x1')]={'name':{'type':Sequelize[_0xd3aa('0x2')],'allowNull':![],'unique':_0xd3aa('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x61ec44){return _0xd3aa('0x4')+this[_0xd3aa('0x5')](_0xd3aa('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xd3aa('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xd3aa('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 37c6f9a..2f7d526 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 _0x160f=['forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','type','system','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','nolimit','Team','getTeams','Agents','online','voicePause','interface','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x37998b,_0x27ed44){var _0x2bc1ce=function(_0x5072ba){while(--_0x5072ba){_0x37998b['push'](_0x37998b['shift']());}};_0x2bc1ce(++_0x27ed44);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];config[_0xf160('0x17')]=_[_0xf160('0x18')](config['redis'],{'host':_0xf160('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf160('0x17')]));require(_0xf160('0x1a'))[_0xf160('0x1b')](socket);function respondWithStatusCode(_0x2bb6c7,_0x3a4faa){_0x3a4faa=_0x3a4faa||0xcc;return function(_0x31f7ae){if(_0x31f7ae){return _0x2bb6c7[_0xf160('0x1c')](_0x3a4faa);}return _0x2bb6c7[_0xf160('0x1d')](_0x3a4faa)[_0xf160('0x1e')]();};}function respondWithResult(_0x59ac02,_0x477e4d){_0x477e4d=_0x477e4d||0xc8;return function(_0x400bda){if(_0x400bda){return _0x59ac02[_0xf160('0x1d')](_0x477e4d)[_0xf160('0x1f')](_0x400bda);}};}function respondWithFilteredResult(_0x51824b,_0x36a978){return function(_0x4b8185){if(_0x4b8185){var _0x5388c7=typeof _0x36a978[_0xf160('0x20')]===_0xf160('0x21')&&typeof _0x36a978[_0xf160('0x22')]===_0xf160('0x21');var _0x205afa=_0x4b8185[_0xf160('0x23')];var _0x2a8cb4=_0x5388c7?0x0:_0x36a978[_0xf160('0x20')];var _0x4a58d9=_0x5388c7?_0x4b8185[_0xf160('0x23')]:_0x36a978[_0xf160('0x20')]+_0x36a978[_0xf160('0x22')];var _0x5ad173;if(_0x4a58d9>=_0x205afa){_0x4a58d9=_0x205afa;_0x5ad173=0xc8;}else{_0x5ad173=0xce;}_0x51824b[_0xf160('0x1d')](_0x5ad173);return _0x51824b[_0xf160('0x24')](_0xf160('0x25'),_0x2a8cb4+'-'+_0x4a58d9+'/'+_0x205afa)[_0xf160('0x1f')](_0x4b8185);}return null;};}function patchUpdates(_0x2e03c8){return function(_0x1b0081){try{jsonpatch[_0xf160('0x26')](_0x1b0081,_0x2e03c8,!![]);}catch(_0x5a72d1){return BPromise[_0xf160('0x27')](_0x5a72d1);}return _0x1b0081[_0xf160('0x28')]();};}function saveUpdates(_0x305f6a,_0x49bb5c){return function(_0x578f7d){if(_0x578f7d){return _0x578f7d[_0xf160('0x29')](_0x305f6a)[_0xf160('0x2a')](function(_0x4a8003){return _0x4a8003;});}return null;};}function removeEntity(_0x487c0c,_0x168a09){return function(_0x1cc04c){if(_0x1cc04c){return _0x1cc04c[_0xf160('0x2b')]()['then'](function(){var _0xcfa9bd=_0x1cc04c[_0xf160('0x2c')]({'plain':!![]});var _0x2851e8=_0xf160('0x2d');return db[_0xf160('0x2e')][_0xf160('0x2b')]({'where':{'type':_0x2851e8,'resourceId':_0xcfa9bd['id']}})['then'](function(){return _0x1cc04c;});})['then'](function(){_0x487c0c['status'](0xcc)[_0xf160('0x1e')]();});}};}function handleEntityNotFound(_0x16a5fa,_0xcaab39){return function(_0x26e06b){if(!_0x26e06b){_0x16a5fa[_0xf160('0x1c')](0x194);}return _0x26e06b;};}function handleError(_0x563103,_0x55f9c3){_0x55f9c3=_0x55f9c3||0x1f4;return function(_0x329d6b){logger['error'](_0x329d6b['stack']);if(_0x329d6b[_0xf160('0x2f')]){delete _0x329d6b[_0xf160('0x2f')];}_0x563103['status'](_0x55f9c3)[_0xf160('0x30')](_0x329d6b);};}exports[_0xf160('0x31')]=function(_0x4ab048,_0x528dff){var _0x4b3ef4={},_0x54d17f={},_0x3e7720={'count':0x0,'rows':[]};var _0x2bb5c4=_[_0xf160('0x32')](db[_0xf160('0x33')][_0xf160('0x34')],function(_0x26fc8b){return{'name':_0x26fc8b['fieldName'],'type':_0x26fc8b['type']['key']};});_0x54d17f[_0xf160('0x35')]=_['map'](_0x2bb5c4,'name');_0x54d17f[_0xf160('0x36')]=_[_0xf160('0x37')](_0x4ab048['query']);_0x54d17f[_0xf160('0x38')]=_[_0xf160('0x39')](_0x54d17f[_0xf160('0x35')],_0x54d17f[_0xf160('0x36')]);_0x4b3ef4[_0xf160('0x3a')]=_['intersection'](_0x54d17f[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x4ab048[_0xf160('0x36')]['fields']));_0x4b3ef4[_0xf160('0x3a')]=_0x4b3ef4[_0xf160('0x3a')][_0xf160('0x3c')]?_0x4b3ef4[_0xf160('0x3a')]:_0x54d17f[_0xf160('0x35')];if(!_0x4ab048[_0xf160('0x36')]['hasOwnProperty']('nolimit')){_0x4b3ef4[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x4ab048[_0xf160('0x36')][_0xf160('0x22')]);_0x4b3ef4[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x4ab048[_0xf160('0x36')][_0xf160('0x20')]);}_0x4b3ef4[_0xf160('0x3d')]=qs[_0xf160('0x3e')](_0x4ab048[_0xf160('0x36')][_0xf160('0x3e')]);_0x4b3ef4[_0xf160('0x3f')]=qs[_0xf160('0x38')](_[_0xf160('0x40')](_0x4ab048[_0xf160('0x36')],_0x54d17f[_0xf160('0x38')]),_0x2bb5c4);if(_0x4ab048[_0xf160('0x36')][_0xf160('0x41')]){_0x4b3ef4[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x4b3ef4[_0xf160('0x3f')],{'$or':_[_0xf160('0x32')](_0x2bb5c4,function(_0x1bdc44){if(_0x1bdc44['type']!==_0xf160('0x43')){var _0x476c31={};_0x476c31[_0x1bdc44[_0xf160('0x2f')]]={'$like':'%'+_0x4ab048[_0xf160('0x36')][_0xf160('0x41')]+'%'};return _0x476c31;}})});}_0x4b3ef4=_[_0xf160('0x42')]({},_0x4b3ef4,_0x4ab048[_0xf160('0x44')]);var _0x4f65c9={'where':_0x4b3ef4[_0xf160('0x3f')]};return db['VoicePrefix'][_0xf160('0x23')](_0x4f65c9)[_0xf160('0x2a')](function(_0x530fc5){_0x3e7720[_0xf160('0x23')]=_0x530fc5;if(_0x4ab048[_0xf160('0x36')][_0xf160('0x45')]){_0x4b3ef4[_0xf160('0x46')]=[{'all':!![]}];}return db[_0xf160('0x33')][_0xf160('0x47')](_0x4b3ef4);})[_0xf160('0x2a')](function(_0x4f5eba){_0x3e7720[_0xf160('0x48')]=_0x4f5eba;return _0x3e7720;})[_0xf160('0x2a')](respondWithFilteredResult(_0x528dff,_0x4b3ef4))[_0xf160('0x49')](handleError(_0x528dff,null));};exports[_0xf160('0x4a')]=function(_0x3e4f0e,_0x2caefa){var _0x33bef9={'raw':![],'where':{'id':_0x3e4f0e[_0xf160('0x4b')]['id']}},_0x15b31a={};_0x15b31a[_0xf160('0x35')]=_[_0xf160('0x37')](db['VoicePrefix']['rawAttributes']);_0x15b31a[_0xf160('0x36')]=_[_0xf160('0x37')](_0x3e4f0e[_0xf160('0x36')]);_0x15b31a[_0xf160('0x38')]=_[_0xf160('0x39')](_0x15b31a[_0xf160('0x35')],_0x15b31a['query']);_0x33bef9[_0xf160('0x3a')]=_['intersection'](_0x15b31a['model'],qs[_0xf160('0x3b')](_0x3e4f0e[_0xf160('0x36')]['fields']));_0x33bef9['attributes']=_0x33bef9[_0xf160('0x3a')][_0xf160('0x3c')]?_0x33bef9[_0xf160('0x3a')]:_0x15b31a[_0xf160('0x35')];if(_0x3e4f0e['query']['includeAll']){_0x33bef9['include']=[{'all':!![]}];}_0x33bef9=_['merge']({},_0x33bef9,_0x3e4f0e[_0xf160('0x44')]);return db['VoicePrefix'][_0xf160('0x4c')](_0x33bef9)[_0xf160('0x2a')](handleEntityNotFound(_0x2caefa,null))[_0xf160('0x2a')](respondWithResult(_0x2caefa,null))[_0xf160('0x49')](handleError(_0x2caefa,null));};exports['destroy']=function(_0x45af83,_0x283f55){return db[_0xf160('0x33')]['find']({'where':{'id':_0x45af83[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x283f55,null))[_0xf160('0x2a')](removeEntity(_0x283f55,null))['catch'](handleError(_0x283f55,null));};exports[_0xf160('0x4d')]=function(_0x6d8c9b,_0x409e7d){return db[_0xf160('0x33')][_0xf160('0x4d')]()['then'](respondWithResult(_0x409e7d,null))['catch'](handleError(_0x409e7d,null));};exports[_0xf160('0x4e')]=function(_0x5d81b9,_0x1d5168){var _0xf31056;return db['sequelize']['transaction'](function(_0x321309){return db[_0xf160('0x33')]['create'](_0x5d81b9[_0xf160('0x4f')],{'transaction':_0x321309})[_0xf160('0x2a')](function(_0x28605d){_0xf31056=_0x28605d[_0xf160('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0xf160('0x4c')]({'where':{'id':_0xf31056['VoiceExtensionId']},'raw':!![]})[_0xf160('0x2a')](function(_0x1b3ec0){return createVoicePrefixExtensions(_0xf31056,_0x1b3ec0,_0x321309);});});})[_0xf160('0x2a')](function(){var _0x170ca4=_0x5d81b9[_0xf160('0x50')]['get']({'plain':!![]});if(!_0x170ca4)throw new Error(_0xf160('0x51'));if(_0x170ca4['role']===_0xf160('0x50')){var _0x1229cd=_0xf31056;return db[_0xf160('0x52')][_0xf160('0x4c')]({'where':{'name':_0xf160('0x2d'),'userProfileId':_0x170ca4[_0xf160('0x53')]},'raw':!![]})[_0xf160('0x2a')](function(_0x12c22){if(_0x12c22&&_0x12c22[_0xf160('0x54')]===0x0){return db[_0xf160('0x2e')]['create']({'name':_0x1229cd['name'],'resourceId':_0x1229cd['id'],'type':_0x12c22[_0xf160('0x2f')],'sectionId':_0x12c22['id']},{})[_0xf160('0x2a')](function(){return _0xf31056;});}else{return _0xf31056;}})['catch'](function(_0x12083d){logger[_0xf160('0x55')](_0xf160('0x56'),_0x12083d);throw _0x12083d;});}return _0xf31056;})['then'](respondWithResult(_0x1d5168,null))['catch'](handleError(_0x1d5168,null));};function Extension(_0x12ab32,_0x352ddb,_0x5eeab6,_0x3243c6){this[_0xf160('0x57')]='from-sip';this[_0xf160('0x58')]=_0x12ab32;this[_0xf160('0x59')]=_0x5eeab6;this[_0xf160('0x5a')]=_0xf160('0x5b');this[_0xf160('0x5c')]=_0xf160('0x5d');this['priority']=_0x352ddb;this[_0xf160('0x5e')]=_0x3243c6;}function createVoicePrefixExtensions(_0x3dc02f,_0x30f750,_0x1364bc){return new BPromise(function(_0x38ee0f,_0x5a1be3){var _0x1d22bb=new Extension(formatPrefixName(_0x3dc02f['prefix']),0x1,_0xf160('0x5f'),_0xf160('0x60'));_0x1d22bb[_0xf160('0x61')]=_0x3dc02f['id'];return db[_0xf160('0x62')][_0xf160('0x4e')](_0x1d22bb,{'transaction':_0x1364bc})[_0xf160('0x2a')](function(_0x492d5b){var _0x32ec90=_0x492d5b[_0xf160('0x2c')]({'plain':!![]});var _0x291320=_[_0xf160('0x32')](addVoicePrefixExtensions(_0x3dc02f,_0x30f750),function(_0x40e5a1){_0x40e5a1['VoiceExtensionId']=_0x32ec90['id'];_0x40e5a1['VoicePrefixId']=_0x3dc02f['id'];return _0x40e5a1;});return db[_0xf160('0x62')][_0xf160('0x63')](_0x291320,{'transaction':_0x1364bc})[_0xf160('0x2a')](function(_0x3d8c6c){if(!_0x3d8c6c){return _0x5a1be3(_0xf160('0x64'));}else{return _0x38ee0f(_0x3d8c6c);}})[_0xf160('0x49')](function(_0x4c151f){return _0x5a1be3(_0x4c151f);});});;});};function addVoicePrefixExtensions(_0x25f79e,_0x27332f){var _0x351fa9=[];var _0x352063=formatPrefixName(_0x25f79e[_0xf160('0x65')]);_0x351fa9[_0xf160('0x66')](new Extension(_0x352063,0x2,_0xf160('0x67'),_0xf160('0x68')+_0x25f79e['name']));if(_0x25f79e[_0xf160('0x69')]){_0x351fa9['push'](new Extension(_0x352063,0x3,_0xf160('0x67'),_0xf160('0x6a')+_0x25f79e[_0xf160('0x69')]));}else{_0x351fa9[_0xf160('0x66')](new Extension(_0x352063,0x3,_0xf160('0x5f'),_0xf160('0x6b')));}_0x351fa9['push'](new Extension(_0x352063,0x4,_0xf160('0x6c'),_0x27332f[_0xf160('0x57')]+','+_0xf160('0x6d')+(0x8+_0x25f79e['name'][_0xf160('0x3c')])+'}'+','+0x1));return _0x351fa9;}function formatPrefixName(_0x407a4a){var _0x4db1df='_';for(var _0x1db588=0x0;_0x1db588<_0x407a4a[_0xf160('0x3c')];_0x1db588++){if(_0x407a4a[_0xf160('0x6e')](_0x1db588)=='-'){_0x4db1df+=_0x407a4a['charAt'](_0x1db588);}else{_0x4db1df+='['+_0x407a4a[_0xf160('0x6e')](_0x1db588)+']';}}_0x4db1df+='.';return _0x4db1df;}exports[_0xf160('0x29')]=function(_0x4265e1,_0x4b9d21,_0xc78642){var _0x136919=_0x4265e1[_0xf160('0x4f')];_0x136919[_0xf160('0x65')]=_0xf160('0x6f')+_0x136919[_0xf160('0x2f')]+'-';return db[_0xf160('0x70')]['transaction'](function(_0x797ba1){return db[_0xf160('0x33')][_0xf160('0x29')](_0x136919,{'where':{'id':_0x136919['id']},'transaction':_0x797ba1})['then'](function(){return db[_0xf160('0x62')][_0xf160('0x2b')]({'where':{'VoicePrefixId':_0x136919['id']},'transaction':_0x797ba1})[_0xf160('0x2a')](function(){return db[_0xf160('0x62')][_0xf160('0x4c')]({'where':{'id':_0x136919[_0xf160('0x71')]},'raw':!![]})[_0xf160('0x2a')](function(_0x59b63c){return createVoicePrefixExtensions(_0x136919,_0x59b63c,_0x797ba1);});});});})['then'](function(){return db[_0xf160('0x33')][_0xf160('0x72')](_0x136919['id']);})[_0xf160('0x2a')](respondWithResult(_0x4b9d21,null))[_0xf160('0x49')](handleError(_0x4b9d21,null));};exports[_0xf160('0x73')]=function(_0x722f3a,_0x2f434c,_0x484b18){return db[_0xf160('0x33')][_0xf160('0x4c')]({'where':{'id':_0x722f3a['params']['id']}})['then'](handleEntityNotFound(_0x2f434c,null))[_0xf160('0x2a')](function(_0x14d69d){if(_0x14d69d){return _0x14d69d['addAgents'](_0x722f3a[_0xf160('0x4f')][_0xf160('0x74')],_['omit'](_0x722f3a[_0xf160('0x4f')],['ids','id'])||{})[_0xf160('0x75')](function(_0x355226){for(var _0x74028e=0x0;_0x74028e<_0x722f3a[_0xf160('0x4f')]['ids'][_0xf160('0x3c')];_0x74028e+=0x1){socket[_0xf160('0x76')](_0xf160('0x77'),{'UserId':Number(_0x722f3a[_0xf160('0x4f')][_0xf160('0x74')][_0x74028e]),'VoicePrefixId':Number(_0x722f3a['params']['id'])});}return _0x355226;});}})[_0xf160('0x2a')](respondWithResult(_0x2f434c,null))[_0xf160('0x49')](handleError(_0x2f434c,null));};exports[_0xf160('0x78')]=function(_0x5275b4,_0x2396f6,_0x1165f5){return db[_0xf160('0x33')][_0xf160('0x4c')]({'where':{'id':_0x5275b4[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x2396f6,null))[_0xf160('0x2a')](function(_0x543534){if(_0x543534){return _0x543534[_0xf160('0x78')](_0x5275b4[_0xf160('0x36')][_0xf160('0x74')])[_0xf160('0x2a')](function(){if(_[_0xf160('0x79')](_0x5275b4['query'][_0xf160('0x74')])){for(var _0x3526cd=0x0;_0x3526cd<_0x5275b4[_0xf160('0x36')][_0xf160('0x74')][_0xf160('0x3c')];_0x3526cd+=0x1){socket[_0xf160('0x76')](_0xf160('0x7a'),{'UserId':Number(_0x5275b4[_0xf160('0x36')][_0xf160('0x74')][_0x3526cd]),'VoicePrefixId':Number(_0x5275b4[_0xf160('0x4b')]['id'])});}}else{socket[_0xf160('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x5275b4[_0xf160('0x36')]['ids']),'VoicePrefixId':Number(_0x5275b4[_0xf160('0x4b')]['id'])});}});}})[_0xf160('0x2a')](respondWithStatusCode(_0x2396f6,null))[_0xf160('0x49')](handleError(_0x2396f6,null));};exports[_0xf160('0x7b')]=function(_0x6ff6b1,_0x59281e,_0x3f873a){var _0x38426d={};var _0x2a992a={};var _0x185268;var _0x5927c9;return db['VoicePrefix'][_0xf160('0x7c')]({'where':{'id':_0x6ff6b1['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x59281e,null))['then'](function(_0x21b93a){if(_0x21b93a){_0x185268=_0x21b93a;_0x2a992a['model']=_['keys'](db[_0xf160('0x7d')][_0xf160('0x34')]);_0x2a992a[_0xf160('0x36')]=_[_0xf160('0x37')](_0x6ff6b1[_0xf160('0x36')]);_0x2a992a[_0xf160('0x38')]=_[_0xf160('0x39')](_0x2a992a[_0xf160('0x35')],_0x2a992a[_0xf160('0x36')]);_0x38426d['attributes']=_['intersection'](_0x2a992a[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x6ff6b1[_0xf160('0x36')][_0xf160('0x3b')]));_0x38426d[_0xf160('0x3a')]=_0x38426d['attributes'][_0xf160('0x3c')]?_0x38426d[_0xf160('0x3a')]:_0x2a992a[_0xf160('0x35')];_0x38426d[_0xf160('0x3d')]=qs['sort'](_0x6ff6b1['query']['sort']);_0x38426d[_0xf160('0x3f')]=qs['filters'](_[_0xf160('0x40')](_0x6ff6b1['query'],_0x2a992a[_0xf160('0x38')]));if(_0x6ff6b1[_0xf160('0x36')]['filter']){_0x38426d[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x38426d[_0xf160('0x3f')],{'$or':_[_0xf160('0x32')](_0x38426d[_0xf160('0x3a')],function(_0x39ec7e){var _0x2558b8={};_0x2558b8[_0x39ec7e]={'$like':'%'+_0x6ff6b1['query']['filter']+'%'};return _0x2558b8;})});}_0x38426d=_[_0xf160('0x42')]({},_0x38426d,_0x6ff6b1[_0xf160('0x44')]);return _0x185268[_0xf160('0x7b')](_0x38426d);}})['then'](function(_0x5316c5){if(_0x5316c5){_0x5927c9=_0x5316c5[_0xf160('0x3c')];if(!_0x6ff6b1[_0xf160('0x36')][_0xf160('0x7e')](_0xf160('0x7f'))){_0x38426d[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x6ff6b1[_0xf160('0x36')][_0xf160('0x22')]);_0x38426d[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x6ff6b1['query'][_0xf160('0x20')]);}return _0x185268[_0xf160('0x7b')](_0x38426d);}})[_0xf160('0x2a')](function(_0x3ee8d8){if(_0x3ee8d8){return _0x3ee8d8?{'count':_0x5927c9,'rows':_0x3ee8d8}:null;}})[_0xf160('0x2a')](respondWithResult(_0x59281e,null))[_0xf160('0x49')](handleError(_0x59281e,null));};exports['getTeams']=function(_0x336560,_0x120282,_0x2b6e56){var _0x362718={};var _0xcf5dee={};var _0x2a8af4;var _0x224dcc;return db[_0xf160('0x33')]['findOne']({'where':{'id':_0x336560['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x120282,null))[_0xf160('0x2a')](function(_0x55865d){if(_0x55865d){_0x2a8af4=_0x55865d;_0xcf5dee[_0xf160('0x35')]=_[_0xf160('0x37')](db[_0xf160('0x80')][_0xf160('0x34')]);_0xcf5dee[_0xf160('0x36')]=_[_0xf160('0x37')](_0x336560[_0xf160('0x36')]);_0xcf5dee[_0xf160('0x38')]=_[_0xf160('0x39')](_0xcf5dee[_0xf160('0x35')],_0xcf5dee['query']);_0x362718[_0xf160('0x3a')]=_[_0xf160('0x39')](_0xcf5dee[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x336560[_0xf160('0x36')]['fields']));_0x362718[_0xf160('0x3a')]=_0x362718[_0xf160('0x3a')][_0xf160('0x3c')]?_0x362718[_0xf160('0x3a')]:_0xcf5dee['model'];_0x362718[_0xf160('0x3d')]=qs[_0xf160('0x3e')](_0x336560['query']['sort']);_0x362718['where']=qs['filters'](_['pick'](_0x336560[_0xf160('0x36')],_0xcf5dee[_0xf160('0x38')]));if(_0x336560['query']['filter']){_0x362718[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x362718['where'],{'$or':_[_0xf160('0x32')](_0x362718['attributes'],function(_0x32fb34){var _0x3b1d1a={};_0x3b1d1a[_0x32fb34]={'$like':'%'+_0x336560[_0xf160('0x36')]['filter']+'%'};return _0x3b1d1a;})});}_0x362718=_[_0xf160('0x42')]({},_0x362718,_0x336560['options']);return _0x2a8af4[_0xf160('0x81')](_0x362718);}})['then'](function(_0x308dd9){if(_0x308dd9){_0x224dcc=_0x308dd9['length'];if(!_0x336560[_0xf160('0x36')]['hasOwnProperty'](_0xf160('0x7f'))){_0x362718[_0xf160('0x22')]=qs['limit'](_0x336560[_0xf160('0x36')][_0xf160('0x22')]);_0x362718['offset']=qs[_0xf160('0x20')](_0x336560[_0xf160('0x36')][_0xf160('0x20')]);}return _0x2a8af4[_0xf160('0x81')](_0x362718);}})['then'](function(_0x5cdecf){if(_0x5cdecf){return _0x5cdecf?{'count':_0x224dcc,'rows':_0x5cdecf}:null;}})[_0xf160('0x2a')](respondWithResult(_0x120282,null))[_0xf160('0x49')](handleError(_0x120282,null));};exports['addTeams']=function(_0x28b2cb,_0x24e3b5,_0x5c0dc8){var _0x182ed8=_0x28b2cb['body'][_0xf160('0x74')];var _0x2eada8;return db[_0xf160('0x80')]['findAll']({'where':{'id':_0x182ed8},'attributes':['id'],'include':[{'model':db[_0xf160('0x7d')],'as':_0xf160('0x82'),'attributes':['id',_0xf160('0x2f'),_0xf160('0x83'),_0xf160('0x84'),_0xf160('0x85')],'raw':!![]}]})[_0xf160('0x2a')](function(_0x2dbb52){if(_0x2dbb52){_0x2eada8=_0x2dbb52;var _0x5b29e0=_['flatMap'](_0x2dbb52,function(_0x2ae1dc){var _0x50912b=_0x2ae1dc['get']({'plain':!![]});return _0x50912b[_0xf160('0x82')];});return db['VoicePrefix'][_0xf160('0x4c')]({'where':{'id':_0x28b2cb[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](function(_0x26aa72){return db[_0xf160('0x70')][_0xf160('0x86')](function(_0x1bef1a){return _0x26aa72[_0xf160('0x87')](_0x182ed8,{'transaction':_0x1bef1a})[_0xf160('0x2a')](function(){return BPromise[_0xf160('0x88')](_0x2eada8,function(_0x154789){return db[_0xf160('0x89')][_0xf160('0x8a')]({'TeamId':_0x154789['id'],'VoicePrefixId':_0x28b2cb['params']['id']},{'transaction':_0x1bef1a});});})[_0xf160('0x2a')](function(){return BPromise[_0xf160('0x88')](_0x5b29e0,function(_0x3e46d1){return db[_0xf160('0x8b')][_0xf160('0x8c')]({'where':{'UserId':_0x3e46d1['id'],'VoicePrefixId':_0x28b2cb[_0xf160('0x4b')]['id']},'transaction':_0x1bef1a});});})[_0xf160('0x2a')](function(){_0x5b29e0[_0xf160('0x8d')](function(_0x3e9116){socket[_0xf160('0x76')](_0xf160('0x77'),{'UserId':_0x3e9116['id'],'VoicePrefixId':_0x26aa72['id']});});});});});}})[_0xf160('0x2a')](respondWithStatusCode(_0x24e3b5,null))[_0xf160('0x49')](handleError(_0x24e3b5,null));};exports[_0xf160('0x8e')]=function(_0x481f96,_0x4186f7,_0x37579a){return db[_0xf160('0x80')][_0xf160('0x47')]({'where':{'id':_0x481f96[_0xf160('0x36')][_0xf160('0x74')]},'attributes':['id'],'include':[{'model':db[_0xf160('0x7d')],'as':_0xf160('0x82'),'attributes':['id'],'raw':!![]}]})[_0xf160('0x2a')](handleEntityNotFound(_0x4186f7,null))[_0xf160('0x2a')](function(_0x36c1c5){var _0x4753d6=_[_0xf160('0x32')](_0x36c1c5,'id');var _0x2c486d=[];var _0x26332b=[];var _0x539056=squel['select']();_0x539056['field'](_0xf160('0x8f'))[_0xf160('0x90')](_0xf160('0x91'),'tq')[_0xf160('0x92')](_0xf160('0x93'),'ut',_0xf160('0x94'))['where'](_0xf160('0x95'),_0x481f96[_0xf160('0x4b')]['id']);for(var _0x1d308e=0x0;_0x1d308e<_0x36c1c5[_0xf160('0x3c')];_0x1d308e+=0x1){let _0x5bc8a3=_0x36c1c5[_0x1d308e];for(var _0x19dc59=0x0;_0x19dc59<_0x5bc8a3[_0xf160('0x82')][_0xf160('0x3c')];_0x19dc59+=0x1){let _0x35de2b=_0x5bc8a3[_0xf160('0x82')][_0x19dc59];var _0x446548=_0x539056[_0xf160('0x96')]();_0x446548[_0xf160('0x3f')](_0xf160('0x97'),_0x35de2b['id']);_0x26332b[_0xf160('0x66')](db[_0xf160('0x70')][_0xf160('0x36')](_0x446548[_0xf160('0x98')](),{'type':db[_0xf160('0x70')][_0xf160('0x99')][_0xf160('0x9a')]})[_0xf160('0x2a')](function(_0x258ad9){if(_0x258ad9['length']===0x1){return _0x35de2b['id'];}else{var _0x27d3ef=_['every'](_['map'](_0x258ad9,'TeamId'),function(_0x191d89){return _[_0xf160('0x9b')](_0x4753d6,_0x191d89);});if(_0x27d3ef){return _0x35de2b['id'];}}}));}}return BPromise[_0xf160('0x9c')](_0x26332b)[_0xf160('0x2a')](function(_0x2391f9){_0x2c486d=_(_0x2c486d)['union'](_0x2391f9)['compact']()[_0xf160('0x9d')]();return db[_0xf160('0x33')]['find']({'where':{'id':_0x481f96[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](function(_0x3d9b9b){return db[_0xf160('0x70')][_0xf160('0x86')](function(_0x563e5d){return _0x3d9b9b[_0xf160('0x8e')](_0x481f96['query'][_0xf160('0x74')],{'transaction':_0x563e5d})[_0xf160('0x2a')](function(){if(!_[_0xf160('0x9e')](_0x2c486d)){return _0x3d9b9b['removeAgents'](_0x2c486d,{'transaction':_0x563e5d});}})[_0xf160('0x2a')](function(){_0x2c486d[_0xf160('0x8d')](function(_0xfb5d28){socket[_0xf160('0x76')](_0xf160('0x7a'),{'UserId':_0xfb5d28,'VoicePrefixId':_0x3d9b9b['id']});});});});});});})[_0xf160('0x2a')](respondWithStatusCode(_0x4186f7,null))[_0xf160('0x49')](handleError(_0x4186f7,null));}; \ No newline at end of file +var _0xf7b4=['filter','nolimit','User','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','sequelize','transaction','create','body','get','VoiceExtension','VoiceExtensionId','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','update','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','filters','getTeams','Team'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2215c8,_0x32ea49){_0x2215c8=_0x2215c8-0x0;var _0x2d8d10=_0xf7b4[_0x2215c8];return _0x2d8d10;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4f7b('0x17')]=_[_0x4f7b('0x18')](config[_0x4f7b('0x17')],{'host':_0x4f7b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f7b('0x17')]));require(_0x4f7b('0x1a'))[_0x4f7b('0x1b')](socket);function respondWithStatusCode(_0x43a51a,_0x339486){_0x339486=_0x339486||0xcc;return function(_0x330de9){if(_0x330de9){return _0x43a51a[_0x4f7b('0x1c')](_0x339486);}return _0x43a51a[_0x4f7b('0x1d')](_0x339486)[_0x4f7b('0x1e')]();};}function respondWithResult(_0x29fdd5,_0x1a28b8){_0x1a28b8=_0x1a28b8||0xc8;return function(_0x1e7afc){if(_0x1e7afc){return _0x29fdd5['status'](_0x1a28b8)[_0x4f7b('0x1f')](_0x1e7afc);}};}function respondWithFilteredResult(_0x496322,_0x5b5ee3){return function(_0x24e5cf){if(_0x24e5cf){var _0x3813da=typeof _0x5b5ee3['offset']===_0x4f7b('0x20')&&typeof _0x5b5ee3[_0x4f7b('0x21')]===_0x4f7b('0x20');var _0xf2311f=_0x24e5cf['count'];var _0x1daa79=_0x3813da?0x0:_0x5b5ee3['offset'];var _0x41cf36=_0x3813da?_0x24e5cf[_0x4f7b('0x22')]:_0x5b5ee3[_0x4f7b('0x23')]+_0x5b5ee3[_0x4f7b('0x21')];var _0x27127b;if(_0x41cf36>=_0xf2311f){_0x41cf36=_0xf2311f;_0x27127b=0xc8;}else{_0x27127b=0xce;}_0x496322[_0x4f7b('0x1d')](_0x27127b);return _0x496322[_0x4f7b('0x24')](_0x4f7b('0x25'),_0x1daa79+'-'+_0x41cf36+'/'+_0xf2311f)[_0x4f7b('0x1f')](_0x24e5cf);}return null;};}function patchUpdates(_0x5508bd){return function(_0x410176){try{jsonpatch[_0x4f7b('0x26')](_0x410176,_0x5508bd,!![]);}catch(_0x2c9ea6){return BPromise['reject'](_0x2c9ea6);}return _0x410176[_0x4f7b('0x27')]();};}function saveUpdates(_0x4610a4,_0x5d22f4){return function(_0x15dbec){if(_0x15dbec){return _0x15dbec['update'](_0x4610a4)[_0x4f7b('0x28')](function(_0x2429be){return _0x2429be;});}return null;};}function removeEntity(_0x23c820,_0x278c41){return function(_0x17aa9d){if(_0x17aa9d){return _0x17aa9d[_0x4f7b('0x29')]()[_0x4f7b('0x28')](function(){var _0x3ad769=_0x17aa9d['get']({'plain':!![]});var _0x6c9626=_0x4f7b('0x2a');return db[_0x4f7b('0x2b')]['destroy']({'where':{'type':_0x6c9626,'resourceId':_0x3ad769['id']}})[_0x4f7b('0x28')](function(){return _0x17aa9d;});})[_0x4f7b('0x28')](function(){_0x23c820[_0x4f7b('0x1d')](0xcc)[_0x4f7b('0x1e')]();});}};}function handleEntityNotFound(_0x1ccce0,_0x4ebffa){return function(_0xac1f93){if(!_0xac1f93){_0x1ccce0[_0x4f7b('0x1c')](0x194);}return _0xac1f93;};}function handleError(_0x9a675c,_0x59d3ad){_0x59d3ad=_0x59d3ad||0x1f4;return function(_0x7de561){logger['error'](_0x7de561['stack']);if(_0x7de561[_0x4f7b('0x2c')]){delete _0x7de561['name'];}_0x9a675c[_0x4f7b('0x1d')](_0x59d3ad)[_0x4f7b('0x2d')](_0x7de561);};}exports[_0x4f7b('0x2e')]=function(_0x1cf980,_0x105ffb){var _0x4e5862={},_0x13a113={},_0x179372={'count':0x0,'rows':[]};var _0xba46b8=_[_0x4f7b('0x2f')](db[_0x4f7b('0x30')][_0x4f7b('0x31')],function(_0x3e7fb4){return{'name':_0x3e7fb4[_0x4f7b('0x32')],'type':_0x3e7fb4[_0x4f7b('0x33')][_0x4f7b('0x34')]};});_0x13a113[_0x4f7b('0x35')]=_[_0x4f7b('0x2f')](_0xba46b8,_0x4f7b('0x2c'));_0x13a113[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x1cf980[_0x4f7b('0x36')]);_0x13a113['filters']=_[_0x4f7b('0x38')](_0x13a113['model'],_0x13a113[_0x4f7b('0x36')]);_0x4e5862[_0x4f7b('0x39')]=_['intersection'](_0x13a113[_0x4f7b('0x35')],qs[_0x4f7b('0x3a')](_0x1cf980[_0x4f7b('0x36')]['fields']));_0x4e5862[_0x4f7b('0x39')]=_0x4e5862[_0x4f7b('0x39')][_0x4f7b('0x3b')]?_0x4e5862[_0x4f7b('0x39')]:_0x13a113[_0x4f7b('0x35')];if(!_0x1cf980[_0x4f7b('0x36')][_0x4f7b('0x3c')]('nolimit')){_0x4e5862[_0x4f7b('0x21')]=qs['limit'](_0x1cf980[_0x4f7b('0x36')][_0x4f7b('0x21')]);_0x4e5862[_0x4f7b('0x23')]=qs['offset'](_0x1cf980[_0x4f7b('0x36')]['offset']);}_0x4e5862[_0x4f7b('0x3d')]=qs[_0x4f7b('0x3e')](_0x1cf980['query']['sort']);_0x4e5862[_0x4f7b('0x3f')]=qs['filters'](_[_0x4f7b('0x40')](_0x1cf980[_0x4f7b('0x36')],_0x13a113['filters']),_0xba46b8);if(_0x1cf980[_0x4f7b('0x36')]['filter']){_0x4e5862['where']=_['merge'](_0x4e5862[_0x4f7b('0x3f')],{'$or':_[_0x4f7b('0x2f')](_0xba46b8,function(_0xa5532b){if(_0xa5532b[_0x4f7b('0x33')]!=='VIRTUAL'){var _0x3da93f={};_0x3da93f[_0xa5532b['name']]={'$like':'%'+_0x1cf980[_0x4f7b('0x36')]['filter']+'%'};return _0x3da93f;}})});}_0x4e5862=_[_0x4f7b('0x41')]({},_0x4e5862,_0x1cf980['options']);var _0x2c2b10={'where':_0x4e5862[_0x4f7b('0x3f')]};return db[_0x4f7b('0x30')][_0x4f7b('0x22')](_0x2c2b10)[_0x4f7b('0x28')](function(_0x325cd6){_0x179372[_0x4f7b('0x22')]=_0x325cd6;if(_0x1cf980[_0x4f7b('0x36')][_0x4f7b('0x42')]){_0x4e5862[_0x4f7b('0x43')]=[{'all':!![]}];}return db[_0x4f7b('0x30')][_0x4f7b('0x44')](_0x4e5862);})[_0x4f7b('0x28')](function(_0x508eaa){_0x179372[_0x4f7b('0x45')]=_0x508eaa;return _0x179372;})[_0x4f7b('0x28')](respondWithFilteredResult(_0x105ffb,_0x4e5862))[_0x4f7b('0x46')](handleError(_0x105ffb,null));};exports[_0x4f7b('0x47')]=function(_0x5cfca1,_0x581356){var _0x10d0ac={'raw':![],'where':{'id':_0x5cfca1[_0x4f7b('0x48')]['id']}},_0x1d1e10={};_0x1d1e10[_0x4f7b('0x35')]=_['keys'](db['VoicePrefix'][_0x4f7b('0x31')]);_0x1d1e10[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x5cfca1[_0x4f7b('0x36')]);_0x1d1e10['filters']=_['intersection'](_0x1d1e10[_0x4f7b('0x35')],_0x1d1e10[_0x4f7b('0x36')]);_0x10d0ac[_0x4f7b('0x39')]=_[_0x4f7b('0x38')](_0x1d1e10[_0x4f7b('0x35')],qs['fields'](_0x5cfca1[_0x4f7b('0x36')][_0x4f7b('0x3a')]));_0x10d0ac[_0x4f7b('0x39')]=_0x10d0ac['attributes'][_0x4f7b('0x3b')]?_0x10d0ac[_0x4f7b('0x39')]:_0x1d1e10[_0x4f7b('0x35')];if(_0x5cfca1[_0x4f7b('0x36')][_0x4f7b('0x42')]){_0x10d0ac[_0x4f7b('0x43')]=[{'all':!![]}];}_0x10d0ac=_[_0x4f7b('0x41')]({},_0x10d0ac,_0x5cfca1[_0x4f7b('0x49')]);return db[_0x4f7b('0x30')][_0x4f7b('0x4a')](_0x10d0ac)['then'](handleEntityNotFound(_0x581356,null))[_0x4f7b('0x28')](respondWithResult(_0x581356,null))[_0x4f7b('0x46')](handleError(_0x581356,null));};exports[_0x4f7b('0x29')]=function(_0x5003f1,_0x16eaef){return db[_0x4f7b('0x30')][_0x4f7b('0x4a')]({'where':{'id':_0x5003f1[_0x4f7b('0x48')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x16eaef,null))[_0x4f7b('0x28')](removeEntity(_0x16eaef,null))[_0x4f7b('0x46')](handleError(_0x16eaef,null));};exports[_0x4f7b('0x4b')]=function(_0x776ce7,_0x23d5f3){return db['VoicePrefix'][_0x4f7b('0x4b')]()[_0x4f7b('0x28')](respondWithResult(_0x23d5f3,null))[_0x4f7b('0x46')](handleError(_0x23d5f3,null));};exports['create']=function(_0x2c9cee,_0x40c183){var _0xeeb227;return db[_0x4f7b('0x4c')][_0x4f7b('0x4d')](function(_0x819fb3){return db['VoicePrefix'][_0x4f7b('0x4e')](_0x2c9cee[_0x4f7b('0x4f')],{'transaction':_0x819fb3})[_0x4f7b('0x28')](function(_0x4c9496){_0xeeb227=_0x4c9496[_0x4f7b('0x50')]({'plain':!![]});return db[_0x4f7b('0x51')][_0x4f7b('0x4a')]({'where':{'id':_0xeeb227[_0x4f7b('0x52')]},'raw':!![]})[_0x4f7b('0x28')](function(_0x6e448f){return createVoicePrefixExtensions(_0xeeb227,_0x6e448f,_0x819fb3);});});})['then'](function(){var _0x13bb98=_0x2c9cee['user']['get']({'plain':!![]});if(!_0x13bb98)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13bb98[_0x4f7b('0x53')]===_0x4f7b('0x54')){var _0x27b2e1=_0xeeb227;return db['UserProfileSection']['find']({'where':{'name':_0x4f7b('0x2a'),'userProfileId':_0x13bb98[_0x4f7b('0x55')]},'raw':!![]})['then'](function(_0xf957ca){if(_0xf957ca&&_0xf957ca[_0x4f7b('0x56')]===0x0){return db[_0x4f7b('0x2b')][_0x4f7b('0x4e')]({'name':_0x27b2e1['name'],'resourceId':_0x27b2e1['id'],'type':_0xf957ca[_0x4f7b('0x2c')],'sectionId':_0xf957ca['id']},{})[_0x4f7b('0x28')](function(){return _0xeeb227;});}else{return _0xeeb227;}})[_0x4f7b('0x46')](function(_0x42b378){logger[_0x4f7b('0x57')](_0x4f7b('0x58'),_0x42b378);throw _0x42b378;});}return _0xeeb227;})[_0x4f7b('0x28')](respondWithResult(_0x40c183,null))['catch'](handleError(_0x40c183,null));};function Extension(_0x529821,_0x507199,_0x133074,_0x5530cb){this['context']='from-sip';this['exten']=_0x529821;this[_0x4f7b('0x59')]=_0x133074;this[_0x4f7b('0x33')]=_0x4f7b('0x5a');this[_0x4f7b('0x5b')]=_0x4f7b('0x5c');this[_0x4f7b('0x5d')]=_0x507199;this[_0x4f7b('0x5e')]=_0x5530cb;}function createVoicePrefixExtensions(_0x80efcb,_0x1d500c,_0x2a80fe){return new BPromise(function(_0x31bed4,_0x12456e){var _0x1ba432=new Extension(formatPrefixName(_0x80efcb[_0x4f7b('0x5f')]),0x1,_0x4f7b('0x60'),_0x4f7b('0x61'));_0x1ba432[_0x4f7b('0x62')]=_0x80efcb['id'];return db[_0x4f7b('0x51')]['create'](_0x1ba432,{'transaction':_0x2a80fe})[_0x4f7b('0x28')](function(_0x46d15c){var _0x3c5b28=_0x46d15c[_0x4f7b('0x50')]({'plain':!![]});var _0x321f36=_['map'](addVoicePrefixExtensions(_0x80efcb,_0x1d500c),function(_0x4b9f3a){_0x4b9f3a[_0x4f7b('0x52')]=_0x3c5b28['id'];_0x4b9f3a['VoicePrefixId']=_0x80efcb['id'];return _0x4b9f3a;});return db[_0x4f7b('0x51')][_0x4f7b('0x63')](_0x321f36,{'transaction':_0x2a80fe})[_0x4f7b('0x28')](function(_0x7509ab){if(!_0x7509ab){return _0x12456e('Extensions\x20creation\x20failed');}else{return _0x31bed4(_0x7509ab);}})[_0x4f7b('0x46')](function(_0x35b569){return _0x12456e(_0x35b569);});});;});};function addVoicePrefixExtensions(_0x5a6db0,_0x58baa5){var _0x4b2089=[];var _0x5b16cb=formatPrefixName(_0x5a6db0[_0x4f7b('0x5f')]);_0x4b2089['push'](new Extension(_0x5b16cb,0x2,'Set','CDR(prefix)='+_0x5a6db0[_0x4f7b('0x2c')]));if(_0x5a6db0[_0x4f7b('0x64')]){_0x4b2089[_0x4f7b('0x65')](new Extension(_0x5b16cb,0x3,'Set',_0x4f7b('0x66')+_0x5a6db0[_0x4f7b('0x64')]));}else{_0x4b2089['push'](new Extension(_0x5b16cb,0x3,'NoOp',_0x4f7b('0x67')));}_0x4b2089[_0x4f7b('0x65')](new Extension(_0x5b16cb,0x4,_0x4f7b('0x68'),_0x58baa5[_0x4f7b('0x69')]+','+'${EXTEN:'+(0x8+_0x5a6db0[_0x4f7b('0x2c')][_0x4f7b('0x3b')])+'}'+','+0x1));return _0x4b2089;}function formatPrefixName(_0xc6b94e){var _0x2cb5f1='_';for(var _0x2ac8db=0x0;_0x2ac8db<_0xc6b94e[_0x4f7b('0x3b')];_0x2ac8db++){if(_0xc6b94e['charAt'](_0x2ac8db)=='-'){_0x2cb5f1+=_0xc6b94e[_0x4f7b('0x6a')](_0x2ac8db);}else{_0x2cb5f1+='['+_0xc6b94e[_0x4f7b('0x6a')](_0x2ac8db)+']';}}_0x2cb5f1+='.';return _0x2cb5f1;}exports[_0x4f7b('0x6b')]=function(_0x220f21,_0x1ca442,_0x509763){var _0x579363=_0x220f21['body'];_0x579363[_0x4f7b('0x5f')]=_0x4f7b('0x6c')+_0x579363[_0x4f7b('0x2c')]+'-';return db[_0x4f7b('0x4c')][_0x4f7b('0x4d')](function(_0x53034b){return db[_0x4f7b('0x30')][_0x4f7b('0x6b')](_0x579363,{'where':{'id':_0x579363['id']},'transaction':_0x53034b})[_0x4f7b('0x28')](function(){return db[_0x4f7b('0x51')][_0x4f7b('0x29')]({'where':{'VoicePrefixId':_0x579363['id']},'transaction':_0x53034b})[_0x4f7b('0x28')](function(){return db[_0x4f7b('0x51')][_0x4f7b('0x4a')]({'where':{'id':_0x579363[_0x4f7b('0x52')]},'raw':!![]})[_0x4f7b('0x28')](function(_0x36b46d){return createVoicePrefixExtensions(_0x579363,_0x36b46d,_0x53034b);});});});})[_0x4f7b('0x28')](function(){return db[_0x4f7b('0x30')][_0x4f7b('0x6d')](_0x579363['id']);})[_0x4f7b('0x28')](respondWithResult(_0x1ca442,null))[_0x4f7b('0x46')](handleError(_0x1ca442,null));};exports[_0x4f7b('0x6e')]=function(_0xf0691e,_0x531da6,_0x5bce88){return db[_0x4f7b('0x30')][_0x4f7b('0x4a')]({'where':{'id':_0xf0691e[_0x4f7b('0x48')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x531da6,null))['then'](function(_0x1102fe){if(_0x1102fe){return _0x1102fe[_0x4f7b('0x6e')](_0xf0691e[_0x4f7b('0x4f')][_0x4f7b('0x6f')],_[_0x4f7b('0x70')](_0xf0691e[_0x4f7b('0x4f')],[_0x4f7b('0x6f'),'id'])||{})[_0x4f7b('0x71')](function(_0x3ddd33){for(var _0x13f190=0x0;_0x13f190<_0xf0691e[_0x4f7b('0x4f')][_0x4f7b('0x6f')][_0x4f7b('0x3b')];_0x13f190+=0x1){socket[_0x4f7b('0x72')](_0x4f7b('0x73'),{'UserId':Number(_0xf0691e['body'][_0x4f7b('0x6f')][_0x13f190]),'VoicePrefixId':Number(_0xf0691e[_0x4f7b('0x48')]['id'])});}return _0x3ddd33;});}})['then'](respondWithResult(_0x531da6,null))['catch'](handleError(_0x531da6,null));};exports[_0x4f7b('0x74')]=function(_0x4beb8e,_0x3d25a6,_0x12125d){return db[_0x4f7b('0x30')][_0x4f7b('0x4a')]({'where':{'id':_0x4beb8e[_0x4f7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d25a6,null))['then'](function(_0x42bd6b){if(_0x42bd6b){return _0x42bd6b[_0x4f7b('0x74')](_0x4beb8e[_0x4f7b('0x36')][_0x4f7b('0x6f')])['then'](function(){if(_[_0x4f7b('0x75')](_0x4beb8e[_0x4f7b('0x36')]['ids'])){for(var _0x6aef20=0x0;_0x6aef20<_0x4beb8e[_0x4f7b('0x36')]['ids']['length'];_0x6aef20+=0x1){socket[_0x4f7b('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x4beb8e['query']['ids'][_0x6aef20]),'VoicePrefixId':Number(_0x4beb8e[_0x4f7b('0x48')]['id'])});}}else{socket['emit'](_0x4f7b('0x76'),{'UserId':Number(_0x4beb8e[_0x4f7b('0x36')][_0x4f7b('0x6f')]),'VoicePrefixId':Number(_0x4beb8e[_0x4f7b('0x48')]['id'])});}});}})[_0x4f7b('0x28')](respondWithStatusCode(_0x3d25a6,null))[_0x4f7b('0x46')](handleError(_0x3d25a6,null));};exports[_0x4f7b('0x77')]=function(_0x1f6650,_0x39799b,_0x4da13f){var _0x476637={};var _0x35c3cb={};var _0x37d151;var _0x40120d;return db[_0x4f7b('0x30')][_0x4f7b('0x78')]({'where':{'id':_0x1f6650[_0x4f7b('0x48')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x39799b,null))['then'](function(_0x24289e){if(_0x24289e){_0x37d151=_0x24289e;_0x35c3cb[_0x4f7b('0x35')]=_[_0x4f7b('0x37')](db['User'][_0x4f7b('0x31')]);_0x35c3cb['query']=_[_0x4f7b('0x37')](_0x1f6650[_0x4f7b('0x36')]);_0x35c3cb['filters']=_['intersection'](_0x35c3cb[_0x4f7b('0x35')],_0x35c3cb['query']);_0x476637[_0x4f7b('0x39')]=_['intersection'](_0x35c3cb[_0x4f7b('0x35')],qs[_0x4f7b('0x3a')](_0x1f6650[_0x4f7b('0x36')]['fields']));_0x476637[_0x4f7b('0x39')]=_0x476637['attributes'][_0x4f7b('0x3b')]?_0x476637[_0x4f7b('0x39')]:_0x35c3cb[_0x4f7b('0x35')];_0x476637[_0x4f7b('0x3d')]=qs[_0x4f7b('0x3e')](_0x1f6650[_0x4f7b('0x36')][_0x4f7b('0x3e')]);_0x476637['where']=qs[_0x4f7b('0x79')](_['pick'](_0x1f6650['query'],_0x35c3cb['filters']));if(_0x1f6650[_0x4f7b('0x36')]['filter']){_0x476637[_0x4f7b('0x3f')]=_[_0x4f7b('0x41')](_0x476637[_0x4f7b('0x3f')],{'$or':_[_0x4f7b('0x2f')](_0x476637[_0x4f7b('0x39')],function(_0x3f5f81){var _0x30a003={};_0x30a003[_0x3f5f81]={'$like':'%'+_0x1f6650[_0x4f7b('0x36')]['filter']+'%'};return _0x30a003;})});}_0x476637=_['merge']({},_0x476637,_0x1f6650['options']);return _0x37d151['getAgents'](_0x476637);}})[_0x4f7b('0x28')](function(_0x34bca4){if(_0x34bca4){_0x40120d=_0x34bca4[_0x4f7b('0x3b')];if(!_0x1f6650['query'][_0x4f7b('0x3c')]('nolimit')){_0x476637[_0x4f7b('0x21')]=qs[_0x4f7b('0x21')](_0x1f6650['query'][_0x4f7b('0x21')]);_0x476637[_0x4f7b('0x23')]=qs[_0x4f7b('0x23')](_0x1f6650['query'][_0x4f7b('0x23')]);}return _0x37d151[_0x4f7b('0x77')](_0x476637);}})[_0x4f7b('0x28')](function(_0x3927b5){if(_0x3927b5){return _0x3927b5?{'count':_0x40120d,'rows':_0x3927b5}:null;}})[_0x4f7b('0x28')](respondWithResult(_0x39799b,null))[_0x4f7b('0x46')](handleError(_0x39799b,null));};exports[_0x4f7b('0x7a')]=function(_0x1a91ce,_0xd249a,_0x4f2c6e){var _0x147e14={};var _0x55922a={};var _0x5afd27;var _0x471caa;return db[_0x4f7b('0x30')]['findOne']({'where':{'id':_0x1a91ce['params']['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0xd249a,null))['then'](function(_0x13c2e4){if(_0x13c2e4){_0x5afd27=_0x13c2e4;_0x55922a[_0x4f7b('0x35')]=_[_0x4f7b('0x37')](db[_0x4f7b('0x7b')][_0x4f7b('0x31')]);_0x55922a[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x1a91ce[_0x4f7b('0x36')]);_0x55922a['filters']=_[_0x4f7b('0x38')](_0x55922a[_0x4f7b('0x35')],_0x55922a[_0x4f7b('0x36')]);_0x147e14[_0x4f7b('0x39')]=_[_0x4f7b('0x38')](_0x55922a[_0x4f7b('0x35')],qs[_0x4f7b('0x3a')](_0x1a91ce['query'][_0x4f7b('0x3a')]));_0x147e14[_0x4f7b('0x39')]=_0x147e14[_0x4f7b('0x39')][_0x4f7b('0x3b')]?_0x147e14[_0x4f7b('0x39')]:_0x55922a[_0x4f7b('0x35')];_0x147e14[_0x4f7b('0x3d')]=qs[_0x4f7b('0x3e')](_0x1a91ce[_0x4f7b('0x36')]['sort']);_0x147e14['where']=qs['filters'](_['pick'](_0x1a91ce[_0x4f7b('0x36')],_0x55922a[_0x4f7b('0x79')]));if(_0x1a91ce[_0x4f7b('0x36')][_0x4f7b('0x7c')]){_0x147e14[_0x4f7b('0x3f')]=_[_0x4f7b('0x41')](_0x147e14[_0x4f7b('0x3f')],{'$or':_['map'](_0x147e14[_0x4f7b('0x39')],function(_0x265a8f){var _0x39ec96={};_0x39ec96[_0x265a8f]={'$like':'%'+_0x1a91ce[_0x4f7b('0x36')]['filter']+'%'};return _0x39ec96;})});}_0x147e14=_[_0x4f7b('0x41')]({},_0x147e14,_0x1a91ce[_0x4f7b('0x49')]);return _0x5afd27[_0x4f7b('0x7a')](_0x147e14);}})['then'](function(_0x3f844f){if(_0x3f844f){_0x471caa=_0x3f844f[_0x4f7b('0x3b')];if(!_0x1a91ce[_0x4f7b('0x36')][_0x4f7b('0x3c')](_0x4f7b('0x7d'))){_0x147e14[_0x4f7b('0x21')]=qs[_0x4f7b('0x21')](_0x1a91ce[_0x4f7b('0x36')][_0x4f7b('0x21')]);_0x147e14[_0x4f7b('0x23')]=qs[_0x4f7b('0x23')](_0x1a91ce[_0x4f7b('0x36')]['offset']);}return _0x5afd27['getTeams'](_0x147e14);}})[_0x4f7b('0x28')](function(_0x4cd4d6){if(_0x4cd4d6){return _0x4cd4d6?{'count':_0x471caa,'rows':_0x4cd4d6}:null;}})[_0x4f7b('0x28')](respondWithResult(_0xd249a,null))[_0x4f7b('0x46')](handleError(_0xd249a,null));};exports['addTeams']=function(_0x411a94,_0x1e934e,_0x5ec78b){var _0x4e07ce=_0x411a94['body'][_0x4f7b('0x6f')];var _0x5a8bda;return db['Team'][_0x4f7b('0x44')]({'where':{'id':_0x4e07ce},'attributes':['id'],'include':[{'model':db[_0x4f7b('0x7e')],'as':_0x4f7b('0x7f'),'attributes':['id',_0x4f7b('0x2c'),_0x4f7b('0x80'),_0x4f7b('0x81'),'interface'],'raw':!![]}]})[_0x4f7b('0x28')](function(_0x1ebf36){if(_0x1ebf36){_0x5a8bda=_0x1ebf36;var _0x4daeb1=_[_0x4f7b('0x82')](_0x1ebf36,function(_0x5556b4){var _0x4d5eb3=_0x5556b4['get']({'plain':!![]});return _0x4d5eb3[_0x4f7b('0x7f')];});return db[_0x4f7b('0x30')][_0x4f7b('0x4a')]({'where':{'id':_0x411a94[_0x4f7b('0x48')]['id']}})['then'](function(_0x3e0d84){return db['sequelize']['transaction'](function(_0x5c2027){return _0x3e0d84['addTeams'](_0x4e07ce,{'transaction':_0x5c2027})[_0x4f7b('0x28')](function(){return BPromise[_0x4f7b('0x83')](_0x5a8bda,function(_0xb3a12b){return db[_0x4f7b('0x84')][_0x4f7b('0x85')]({'TeamId':_0xb3a12b['id'],'VoicePrefixId':_0x411a94['params']['id']},{'transaction':_0x5c2027});});})[_0x4f7b('0x28')](function(){return BPromise[_0x4f7b('0x83')](_0x4daeb1,function(_0x20daa0){return db[_0x4f7b('0x86')][_0x4f7b('0x87')]({'where':{'UserId':_0x20daa0['id'],'VoicePrefixId':_0x411a94[_0x4f7b('0x48')]['id']},'transaction':_0x5c2027});});})['then'](function(){_0x4daeb1[_0x4f7b('0x88')](function(_0x5f4ea9){socket[_0x4f7b('0x72')](_0x4f7b('0x73'),{'UserId':_0x5f4ea9['id'],'VoicePrefixId':_0x3e0d84['id']});});});});});}})[_0x4f7b('0x28')](respondWithStatusCode(_0x1e934e,null))[_0x4f7b('0x46')](handleError(_0x1e934e,null));};exports[_0x4f7b('0x89')]=function(_0x3aaa25,_0x344257,_0x36209e){return db[_0x4f7b('0x7b')][_0x4f7b('0x44')]({'where':{'id':_0x3aaa25[_0x4f7b('0x36')][_0x4f7b('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4f7b('0x28')](handleEntityNotFound(_0x344257,null))[_0x4f7b('0x28')](function(_0x136804){var _0x13d7cd=_[_0x4f7b('0x2f')](_0x136804,'id');var _0x1cf812=[];var _0x3434a1=[];var _0x3acd39=squel[_0x4f7b('0x8a')]();_0x3acd39['field']('tq.TeamId')[_0x4f7b('0x8b')]('team_has_voice_prefixes','tq')[_0x4f7b('0x8c')](_0x4f7b('0x8d'),'ut',_0x4f7b('0x8e'))[_0x4f7b('0x3f')](_0x4f7b('0x8f'),_0x3aaa25['params']['id']);for(var _0x324ee3=0x0;_0x324ee3<_0x136804[_0x4f7b('0x3b')];_0x324ee3+=0x1){let _0x14c427=_0x136804[_0x324ee3];for(var _0x5dd4cd=0x0;_0x5dd4cd<_0x14c427[_0x4f7b('0x7f')][_0x4f7b('0x3b')];_0x5dd4cd+=0x1){let _0x43276a=_0x14c427[_0x4f7b('0x7f')][_0x5dd4cd];var _0x58cf43=_0x3acd39[_0x4f7b('0x90')]();_0x58cf43['where'](_0x4f7b('0x91'),_0x43276a['id']);_0x3434a1[_0x4f7b('0x65')](db[_0x4f7b('0x4c')][_0x4f7b('0x36')](_0x58cf43[_0x4f7b('0x92')](),{'type':db[_0x4f7b('0x4c')][_0x4f7b('0x93')][_0x4f7b('0x94')]})[_0x4f7b('0x28')](function(_0xe6b4de){if(_0xe6b4de[_0x4f7b('0x3b')]===0x1){return _0x43276a['id'];}else{var _0x4088d7=_[_0x4f7b('0x95')](_[_0x4f7b('0x2f')](_0xe6b4de,_0x4f7b('0x96')),function(_0x8fa122){return _[_0x4f7b('0x97')](_0x13d7cd,_0x8fa122);});if(_0x4088d7){return _0x43276a['id'];}}}));}}return BPromise['all'](_0x3434a1)['then'](function(_0x50a1e5){_0x1cf812=_(_0x1cf812)[_0x4f7b('0x98')](_0x50a1e5)['compact']()[_0x4f7b('0x99')]();return db['VoicePrefix'][_0x4f7b('0x4a')]({'where':{'id':_0x3aaa25[_0x4f7b('0x48')]['id']}})[_0x4f7b('0x28')](function(_0x196911){return db['sequelize']['transaction'](function(_0x228e98){return _0x196911[_0x4f7b('0x89')](_0x3aaa25['query']['ids'],{'transaction':_0x228e98})[_0x4f7b('0x28')](function(){if(!_['isEmpty'](_0x1cf812)){return _0x196911[_0x4f7b('0x74')](_0x1cf812,{'transaction':_0x228e98});}})['then'](function(){_0x1cf812[_0x4f7b('0x88')](function(_0x3dd10a){socket[_0x4f7b('0x72')](_0x4f7b('0x76'),{'UserId':_0x3dd10a,'VoicePrefixId':_0x196911['id']});});});});});});})[_0x4f7b('0x28')](respondWithStatusCode(_0x344257,null))[_0x4f7b('0x46')](handleError(_0x344257,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ebb6b0c..7cdb6f2 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 _0x9566=['save','update','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x26505b,_0x381490){var _0x769215=function(_0x2c5dfb){while(--_0x2c5dfb){_0x26505b['push'](_0x26505b['shift']());}};_0x769215(++_0x381490);}(_0x9566,0x1e6));var _0x6956=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9566[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x6956('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6956('0x1')](0x0);var events={'afterCreate':_0x6956('0x2'),'afterUpdate':_0x6956('0x3'),'afterDestroy':'remove'};function emitEvent(_0x376ec5){return function(_0x5f5579,_0x3e2f9c,_0x435b6f){VoicePrefixEvents[_0x6956('0x4')](_0x376ec5+':'+_0x5f5579['id'],_0x5f5579);VoicePrefixEvents[_0x6956('0x4')](_0x376ec5,_0x5f5579);_0x435b6f(null);};}for(var e in events){if(events[_0x6956('0x5')](e)){var event=events[e];VoicePrefix[_0x6956('0x6')](e,emitEvent(event));}}module[_0x6956('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x945c=['remove','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x945c,0x1a0));var _0xc945=function(_0x4952e1,_0x488c90){_0x4952e1=_0x4952e1-0x0;var _0x3d2a3f=_0x945c[_0x4952e1];return _0x3d2a3f;};'use strict';var EventEmitter=require(_0xc945('0x0'));var VoicePrefix=require(_0xc945('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc945('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc945('0x3'),'afterDestroy':_0xc945('0x4')};function emitEvent(_0x50350e){return function(_0x1958ba,_0x128d50,_0x11c6f2){VoicePrefixEvents['emit'](_0x50350e+':'+_0x1958ba['id'],_0x1958ba);VoicePrefixEvents['emit'](_0x50350e,_0x1958ba);_0x11c6f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xc945('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 a21866a..e3e0230 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 _0x9d0c=['path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','../../config/logger','api','bluebird','request-promise'];(function(_0x174374,_0x117e44){var _0x2e855c=function(_0x4e751d){while(--_0x4e751d){_0x174374['push'](_0x174374['shift']());}};_0x2e855c(++_0x117e44);}(_0x9d0c,0x150));var _0xc9d0=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x9d0c[_0x480bc8];return _0x28c245;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9d0('0x0'))(_0xc9d0('0x1'));var moment=require('moment');var BPromise=require(_0xc9d0('0x2'));var rp=require(_0xc9d0('0x3'));var fs=require('fs');var path=require(_0xc9d0('0x4'));var rimraf=require(_0xc9d0('0x5'));var config=require('../../config/environment');var attributes=require(_0xc9d0('0x6'));module[_0xc9d0('0x7')]=function(_0x423e2d,_0x2f1890){return _0x423e2d[_0xc9d0('0x8')](_0xc9d0('0x9'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26ba=['bluebird','path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x241de3,_0x433612){var _0x179db1=function(_0x323cd6){while(--_0x323cd6){_0x241de3['push'](_0x241de3['shift']());}};_0x179db1(++_0x433612);}(_0x26ba,0x193));var _0xa26b=function(_0x3217d3,_0xf66fcf){_0x3217d3=_0x3217d3-0x0;var _0x260f43=_0x26ba[_0x3217d3];return _0x260f43;};'use strict';var _=require(_0xa26b('0x0'));var util=require(_0xa26b('0x1'));var logger=require(_0xa26b('0x2'))(_0xa26b('0x3'));var moment=require(_0xa26b('0x4'));var BPromise=require(_0xa26b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa26b('0x6'));var rimraf=require('rimraf');var config=require(_0xa26b('0x7'));var attributes=require(_0xa26b('0x8'));module['exports']=function(_0x80370e,_0x5958b9){return _0x80370e[_0xa26b('0x9')](_0xa26b('0xa'),attributes,{'tableName':_0xa26b('0xb'),'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 cd1fb8a..a176383 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 _0x202a=['socket.io-emitter','redis','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','ioredis','rpc','../../config/environment','http','localhost'];(function(_0xb0ce11,_0x568d7f){var _0xfc10a1=function(_0x31883e){while(--_0x31883e){_0xb0ce11['push'](_0xb0ce11['shift']());}};_0xfc10a1(++_0x568d7f);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xa202('0x0'));var moment=require(_0xa202('0x1'));var BPromise=require(_0xa202('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa202('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa202('0x4'));var config=require(_0xa202('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa202('0x6')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa202('0x7'),'port':0x18eb});var socket=require(_0xa202('0x8'))(new Redis(config[_0xa202('0x9')]));require(_0xa202('0xa'))['register'](socket);function respondWithRpcPromise(_0x4c3ddf,_0x4355e5,_0x351e18){return new BPromise(function(_0x32ae0b,_0x2c4250){return client['request'](_0x4c3ddf,_0x351e18)[_0xa202('0xb')](function(_0x5e7899){logger[_0xa202('0xc')](_0xa202('0xd'),_0x4355e5,_0xa202('0xe'));logger['debug'](_0xa202('0xf'),_0x4355e5,_0xa202('0xe'),JSON[_0xa202('0x10')](_0x5e7899));if(_0x5e7899[_0xa202('0x11')]){if(_0x5e7899[_0xa202('0x11')][_0xa202('0x12')]===0x1f4){logger['error'](_0xa202('0xd'),_0x4355e5,_0x5e7899[_0xa202('0x11')][_0xa202('0x13')]);return _0x2c4250(_0x5e7899[_0xa202('0x11')][_0xa202('0x13')]);}logger['error'](_0xa202('0xd'),_0x4355e5,_0x5e7899[_0xa202('0x11')][_0xa202('0x13')]);return _0x32ae0b(_0x5e7899[_0xa202('0x11')][_0xa202('0x13')]);}else{logger[_0xa202('0xc')]('VoicePrefix,\x20%s,\x20%s',_0x4355e5,_0xa202('0xe'));_0x32ae0b(_0x5e7899['result'][_0xa202('0x13')]);}})['catch'](function(_0x1eaca4){logger[_0xa202('0x11')](_0xa202('0xd'),_0x4355e5,_0x1eaca4);_0x2c4250(_0x1eaca4);});});} \ No newline at end of file +var _0xe928=['defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0xe928,0x145));var _0x8e92=function(_0x9875f2,_0x5df566){_0x9875f2=_0x9875f2-0x0;var _0x57c331=_0xe928[_0x9875f2];return _0x57c331;};'use strict';var _=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var moment=require(_0x8e92('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e92('0x4'))['db'];var utils=require(_0x8e92('0x5'));var logger=require(_0x8e92('0x6'))(_0x8e92('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e92('0x8'));var client=jayson['client'][_0x8e92('0x9')]({'port':0x232a});config[_0x8e92('0xa')]=_[_0x8e92('0xb')](config[_0x8e92('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e92('0xc'))(new Redis(config['redis']));require(_0x8e92('0xd'))[_0x8e92('0xe')](socket);function respondWithRpcPromise(_0x720643,_0x3124d8,_0x45c1a4){return new BPromise(function(_0x79e446,_0x5d396b){return client[_0x8e92('0xf')](_0x720643,_0x45c1a4)[_0x8e92('0x10')](function(_0x2ad0d9){logger['info'](_0x8e92('0x11'),_0x3124d8,_0x8e92('0x12'));logger[_0x8e92('0x13')](_0x8e92('0x14'),_0x3124d8,_0x8e92('0x12'),JSON[_0x8e92('0x15')](_0x2ad0d9));if(_0x2ad0d9[_0x8e92('0x16')]){if(_0x2ad0d9['error'][_0x8e92('0x17')]===0x1f4){logger['error'](_0x8e92('0x11'),_0x3124d8,_0x2ad0d9[_0x8e92('0x16')]['message']);return _0x5d396b(_0x2ad0d9[_0x8e92('0x16')]['message']);}logger[_0x8e92('0x16')](_0x8e92('0x11'),_0x3124d8,_0x2ad0d9[_0x8e92('0x16')][_0x8e92('0x18')]);return _0x79e446(_0x2ad0d9[_0x8e92('0x16')][_0x8e92('0x18')]);}else{logger[_0x8e92('0x19')](_0x8e92('0x11'),_0x3124d8,'request\x20sent');_0x79e446(_0x2ad0d9[_0x8e92('0x1a')][_0x8e92('0x18')]);}})[_0x8e92('0x1b')](function(_0x1d476a){logger[_0x8e92('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x3124d8,_0x1d476a);_0x5d396b(_0x1d476a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8e3e815..1c64d95 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 _0x4e83=['save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x20da4,_0x33a01e){var _0x10a2ea=function(_0x48b3fe){while(--_0x48b3fe){_0x20da4['push'](_0x20da4['shift']());}};_0x10a2ea(++_0x33a01e);}(_0x4e83,0x88));var _0x34e8=function(_0x233eab,_0x5c910f){_0x233eab=_0x233eab-0x0;var _0x288cc3=_0x4e83[_0x233eab];return _0x288cc3;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x34e8('0x0'),_0x34e8('0x1'),_0x34e8('0x2')];function createListener(_0x3d2157,_0x5bec5b){return function(_0x33b4e1){_0x5bec5b[_0x34e8('0x3')](_0x3d2157,_0x33b4e1);};}function removeListener(_0x3b6abf,_0x2e88cb){return function(){VoicePrefixEvents[_0x34e8('0x4')](_0x3b6abf,_0x2e88cb);};}exports[_0x34e8('0x5')]=function(_0x1017db){for(var _0x38d4e0=0x0,_0x320b00=events[_0x34e8('0x6')];_0x38d4e0<_0x320b00;_0x38d4e0++){var _0x188f11=events[_0x38d4e0];var _0x18e178=createListener(_0x34e8('0x7')+_0x188f11,_0x1017db);VoicePrefixEvents['on'](_0x188f11,_0x18e178);}}; \ No newline at end of file +var _0x1cf3=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x2eb94b,_0xf3debe){var _0xb65a1c=function(_0x17f88f){while(--_0x17f88f){_0x2eb94b['push'](_0x2eb94b['shift']());}};_0xb65a1c(++_0xf3debe);}(_0x1cf3,0x1be));var _0x31cf=function(_0x2867ca,_0x344aec){_0x2867ca=_0x2867ca-0x0;var _0x4e6e3e=_0x1cf3[_0x2867ca];return _0x4e6e3e;};'use strict';var VoicePrefixEvents=require(_0x31cf('0x0'));var events=[_0x31cf('0x1'),_0x31cf('0x2'),_0x31cf('0x3')];function createListener(_0x54dff7,_0x20aa57){return function(_0x5a2ae7){_0x20aa57[_0x31cf('0x4')](_0x54dff7,_0x5a2ae7);};}function removeListener(_0x442009,_0x44d64d){return function(){VoicePrefixEvents[_0x31cf('0x5')](_0x442009,_0x44d64d);};}exports[_0x31cf('0x6')]=function(_0x44dd04){for(var _0x2b7cd4=0x0,_0x1830b4=events[_0x31cf('0x7')];_0x2b7cd4<_0x1830b4;_0x2b7cd4++){var _0x6be80=events[_0x2b7cd4];var _0x3f7b2e=createListener(_0x31cf('0x8')+_0x6be80,_0x44dd04);VoicePrefixEvents['on'](_0x6be80,_0x3f7b2e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a70bde2..f70d94c 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x24ab61,_0x19dd70){var _0x38cf83=function(_0x2ecc9d){while(--_0x2ecc9d){_0x24ab61['push'](_0x24ab61['shift']());}};_0x38cf83(++_0x19dd70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _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(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c5e8b,_0x11b9fa){_0x4c5e8b=_0x4c5e8b-0x0;var _0x3ca42e=_0xb10b[_0x4c5e8b];return _0x3ca42e;};'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 b6b47d2..d7e64b2 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 _0xc113=['Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','inbound','STRING','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','outbound','preview','booked','includes','INTEGER','yes','all','TEXT','join','periodic_announce','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','dropRate','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX'];(function(_0x3a59ac,_0xb314a6){var _0x2983f8=function(_0x3ee715){while(--_0x3ee715){_0x3a59ac['push'](_0x3a59ac['shift']());}};_0x2983f8(++_0xb314a6);}(_0xc113,0x148));var _0x3c11=function(_0x4f19d4,_0xa2d250){_0x4f19d4=_0x4f19d4-0x0;var _0x19c131=_0xc113[_0x4f19d4];return _0x19c131;};'use strict';var Sequelize=require(_0x3c11('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x3c11('0x1'),'outbound'),'allowNull':![],'defaultValue':_0x3c11('0x1')},'musiconhold':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x3c11('0x3')]('rr',_0x3c11('0x4'),_0x3c11('0x5'),_0x3c11('0x6'),_0x3c11('0x7'),_0x3c11('0x8'),_0x3c11('0x9'),_0x3c11('0xa'),_0x3c11('0xb')),'allowNull':![],'defaultValue':_0x3c11('0x4'),'set':function(_0x31a0ee){this[_0x3c11('0xc')](_0x3c11('0xd'),_0x31a0ee?_0x31a0ee:'rrmemory');},'get':function(){var _0x29434c=this[_0x3c11('0xe')](_0x3c11('0xf'));var _0x5a3853=this[_0x3c11('0xe')]('dialMethod');var _0x9a2934=this['getDataValue']('strategy');if(_0x29434c===_0x3c11('0x10')){if(_0x5a3853===_0x3c11('0x11')){return null;}if(_0x5a3853===_0x3c11('0x12')&&![_0x3c11('0x8'),'roundrobin'][_0x3c11('0x13')](_0x9a2934)){this[_0x3c11('0xc')](_0x3c11('0xd'),_0x3c11('0x8'));}}return _0x9a2934;}},'servicelevel':{'type':Sequelize[_0x3c11('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3c11('0x14')](0xb)},'timeout':{'type':Sequelize[_0x3c11('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3c11('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3c11('0x2')]},'weight':{'type':Sequelize[_0x3c11('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3c11('0x3')]('yes','no'),'defaultValue':_0x3c11('0x15')},'autopause':{'type':Sequelize[_0x3c11('0x3')](_0x3c11('0x15'),'no',_0x3c11('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3c11('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x3c11('0x3')](_0x3c11('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3c11('0x3')](_0x3c11('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3c11('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x3c11('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x3c11('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3c11('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3c11('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3c11('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3c11('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3c11('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3c11('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3c11('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x3c11('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x3c11('0x15'),'no'),'defaultValue':_0x3c11('0x15')},'announce_holdtime':{'type':Sequelize[_0x3c11('0x3')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x3c11('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3c11('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3c11('0x2')]},'queue_youarenext':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3c11('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3c11('0x2')]},'queue_quantity1':{'type':Sequelize[_0x3c11('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x3c11('0x2')]},'queue_less_than':{'type':Sequelize[_0x3c11('0x2')]},'periodic_announce':{'type':Sequelize[_0x3c11('0x17')],'set':function(_0xfadeb9){this[_0x3c11('0xc')]('periodic_announce',_0xfadeb9?_0xfadeb9[_0x3c11('0x18')](','):[]);},'get':function(){return this[_0x3c11('0xe')]('periodic_announce')?this['getDataValue'](_0x3c11('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':_0x3c11('0x15'),'set':function(_0x5a3922){this[_0x3c11('0xc')](_0x3c11('0x1a'),_0x5a3922?_0x5a3922[_0x3c11('0x18')](','):undefined);},'get':function(){return this[_0x3c11('0xe')]('joinempty')?this['getDataValue']('joinempty')[_0x3c11('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1bb3db){this['setDataValue']('leavewhenempty',_0x1bb3db?_0x1bb3db['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x3c11('0x1c'))?this['getDataValue']('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3c11('0x3')](_0x3c11('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x3c11('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3c11('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3c11('0x2')]},'acw':{'type':Sequelize[_0x3c11('0x1d')],'defaultValue':0x0,'set':function(_0x1e01fe){this['setDataValue'](_0x3c11('0x1e'),_0x1e01fe);if(_0x1e01fe){if(this['getDataValue']('wrapuptime')<0x2){this[_0x3c11('0xc')](_0x3c11('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3c11('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x3c11('0x3')]('preview',_0x3c11('0x20'),_0x3c11('0x21'),_0x3c11('0x22'),'booked'),'defaultValue':_0x3c11('0x20'),'comment':_0x3c11('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x3c11('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3c11('0x25')},'dialLimitQueue':{'type':Sequelize[_0x3c11('0x14')](0x4)[_0x3c11('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x3c11('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x3c11('0x3')]('agentBusyFactor','dropRate'),'defaultValue':_0x3c11('0x27'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3c11('0x26')](0x2)[_0x3c11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x3c11('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3c11('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x3c11('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c11('0x28')},'dialQueueOptions':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':_0x3c11('0x29'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c11('0x2a')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x3c11('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3c11('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c11('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3c11('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c11('0x2d')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3c11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c11('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3c11('0x14')](0x5)[_0x3c11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c11('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3c11('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x3c11('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3c11('0x14')](0x5)[_0x3c11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c11('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3c11('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3c11('0x32')},'dialTimezone':{'type':Sequelize[_0x3c11('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x3c11('0x33')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x3c11('0x3')]('always',_0x3c11('0x34'),_0x3c11('0x35')),'defaultValue':_0x3c11('0x36')},'dialAMDActive':{'type':Sequelize[_0x3c11('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x3c11('0x14')](0x9)[_0x3c11('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3c11('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x3c11('0x14')](0x9)[_0x3c11('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3c11('0x14')](0x9)[_0x3c11('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3c11('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3c11('0x14')](0x9)[_0x3c11('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3c11('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x3c11('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3c11('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3c11('0x14')](0x9)[_0x3c11('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3c11('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3c11('0x14')](0x9)[_0x3c11('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3c11('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3c11('0x14')](0x9)[_0x3c11('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3c11('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x3c11('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3c11('0x3d')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3c11('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3c11('0x3')](_0x3c11('0x3f'),_0x3c11('0x40')),'defaultValue':_0x3c11('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x3c11('0x2')],'comment':_0x3c11('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3c11('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3c11('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3c11('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3c11('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c11('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3c11('0x14')](0x5)[_0x3c11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c11('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x3c11('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c11('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3c11('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3c11('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3c11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x3c11('0x14')](0x5)[_0x3c11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c11('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3c11('0x14')](0x5)[_0x3c11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3c11('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3c11('0x48'),'set':function(_0x4b6c2a){if(!_0x4b6c2a)this[_0x3c11('0xc')](_0x3c11('0x49'),null);this[_0x3c11('0xc')]('mandatoryDisposition',_0x4b6c2a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3c11('0x14')](0x3)[_0x3c11('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x3c11('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3c11('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0x8fe4=['booked','roundrobin','includes','INTEGER','yes','all','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview'];(function(_0x107490,_0x63027e){var _0x3f197e=function(_0x480b53){while(--_0x480b53){_0x107490['push'](_0x107490['shift']());}};_0x3f197e(++_0x63027e);}(_0x8fe4,0xe1));var _0x48fe=function(_0x2cd090,_0x19980c){_0x2cd090=_0x2cd090-0x0;var _0x54f066=_0x8fe4[_0x2cd090];return _0x54f066;};'use strict';var Sequelize=require(_0x48fe('0x0'));module[_0x48fe('0x1')]={'name':{'type':Sequelize[_0x48fe('0x2')],'allowNull':![],'unique':_0x48fe('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x48fe('0x4')]('inbound',_0x48fe('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x48fe('0x4')]('rr',_0x48fe('0x6'),_0x48fe('0x7'),_0x48fe('0x8'),'random',_0x48fe('0x9'),_0x48fe('0xa'),_0x48fe('0xb'),_0x48fe('0xc')),'allowNull':![],'defaultValue':_0x48fe('0x6'),'set':function(_0x2a4402){this[_0x48fe('0xd')](_0x48fe('0xe'),_0x2a4402?_0x2a4402:_0x48fe('0x9'));},'get':function(){var _0x5b5d2d=this[_0x48fe('0xf')]('type');var _0x583dce=this[_0x48fe('0xf')](_0x48fe('0x10'));var _0x1fb90e=this[_0x48fe('0xf')]('strategy');if(_0x5b5d2d===_0x48fe('0x5')){if(_0x583dce===_0x48fe('0x11')){return null;}if(_0x583dce===_0x48fe('0x12')&&![_0x48fe('0x9'),_0x48fe('0x13')][_0x48fe('0x14')](_0x1fb90e)){this['setDataValue'](_0x48fe('0xe'),_0x48fe('0x9'));}}return _0x1fb90e;}},'servicelevel':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x48fe('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no'),'defaultValue':_0x48fe('0x16')},'autopause':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no',_0x48fe('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x48fe('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x48fe('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x48fe('0x4')]('yes','no'),'defaultValue':_0x48fe('0x16')},'announce_holdtime':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x48fe('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x48fe('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x48fe('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x48fe('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x48fe('0x18')],'set':function(_0x28d178){this[_0x48fe('0xd')](_0x48fe('0x19'),_0x28d178?_0x28d178['join'](','):[]);},'get':function(){return this[_0x48fe('0xf')](_0x48fe('0x19'))?this[_0x48fe('0xf')](_0x48fe('0x19'))[_0x48fe('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x7ec781){this[_0x48fe('0xd')]('joinempty',_0x7ec781?_0x7ec781[_0x48fe('0x1b')](','):undefined);},'get':function(){return this[_0x48fe('0xf')](_0x48fe('0x1c'))?this['getDataValue'](_0x48fe('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':'no','set':function(_0x42b994){this[_0x48fe('0xd')]('leavewhenempty',_0x42b994?_0x42b994['join'](','):undefined);},'get':function(){return this[_0x48fe('0xf')](_0x48fe('0x1d'))?this['getDataValue'](_0x48fe('0x1d'))[_0x48fe('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x48fe('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x48fe('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x48fe('0x2')]},'description':{'type':Sequelize[_0x48fe('0x2')]},'acw':{'type':Sequelize[_0x48fe('0x1e')],'defaultValue':0x0,'set':function(_0xc0d90e){this[_0x48fe('0xd')](_0x48fe('0x1f'),_0xc0d90e);if(_0xc0d90e){if(this[_0x48fe('0xf')]('wrapuptime')<0x2){this[_0x48fe('0xd')](_0x48fe('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x48fe('0x1e')],'defaultValue':0x0,'comment':_0x48fe('0x21')},'dialMethod':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x11'),'progressive',_0x48fe('0x22'),'predictive','booked'),'defaultValue':_0x48fe('0x23'),'comment':_0x48fe('0x24')},'dialLimitChannel':{'type':Sequelize[_0x48fe('0x15')](0x4)[_0x48fe('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x48fe('0x26')},'dialLimitQueue':{'type':Sequelize[_0x48fe('0x15')](0x4)[_0x48fe('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x48fe('0x27')},'dialPowerLevel':{'type':Sequelize[_0x48fe('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x48fe('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x48fe('0x4')](_0x48fe('0x2a'),_0x48fe('0x2b')),'defaultValue':_0x48fe('0x2b'),'comment':_0x48fe('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x48fe('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x48fe('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x48fe('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x48fe('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x48fe('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x48fe('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x48fe('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':_0x48fe('0x30'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x48fe('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x48fe('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x48fe('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x48fe('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x48fe('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x48fe('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x48fe('0x36')},'dialTimezone':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x48fe('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x48fe('0x4')]('always','never',_0x48fe('0x37')),'defaultValue':_0x48fe('0x38')},'dialAMDActive':{'type':Sequelize[_0x48fe('0x1e')],'defaultValue':0x0,'comment':_0x48fe('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x48fe('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x48fe('0x15')](0x9)[_0x48fe('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x48fe('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x48fe('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x48fe('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x48fe('0x15')](0x9)[_0x48fe('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x48fe('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x48fe('0x15')](0x9)[_0x48fe('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x48fe('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x48fe('0x15')](0x9)[_0x48fe('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x48fe('0x15')](0x9)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x48fe('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x48fe('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x48fe('0x15')](0x9)[_0x48fe('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x48fe('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x48fe('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x48fe('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x48fe('0x4')]('DESC','ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x48fe('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x48fe('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x48fe('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x48fe('0x44')},'dialCutDigit':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x48fe('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x48fe('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x48fe('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x48fe('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x48fe('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x48fe('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x48fe('0x15')](0x5)[_0x48fe('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x48fe('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x48fe('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x48fe('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x48fe('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x48fe('0x1e')],'defaultValue':![],'comment':_0x48fe('0x4e'),'set':function(_0x19de0d){if(!_0x19de0d)this[_0x48fe('0xd')](_0x48fe('0x4f'),null);this['setDataValue'](_0x48fe('0x50'),_0x19de0d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x48fe('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x48fe('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x48fe('0x15')](0x3)[_0x48fe('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ed08dfb..6a18484 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 _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x5cf727,_0x9a3e3c){var _0xdebb09=function(_0x4af6a2){while(--_0x4af6a2){_0x5cf727['push'](_0x5cf727['shift']());}};_0xdebb09(++_0x9a3e3c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0x5fc3[_0x19e928];return _0x4e941f;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file +var _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','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','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x6aa7,0x178));var _0x76aa=function(_0x24381e,_0x19d08c){_0x24381e=_0x24381e-0x0;var _0x1f2ba1=_0x6aa7[_0x24381e];return _0x1f2ba1;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 501df7e..5556d93 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 _0x2d31=['hook','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x217c6b,_0x55a16d){var _0x357a75=function(_0x39ccb0){while(--_0x39ccb0){_0x217c6b['push'](_0x217c6b['shift']());}};_0x357a75(++_0x55a16d);}(_0x2d31,0x118));var _0x12d3=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0x2d31[_0x176d14];return _0x89522c;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x12d3('0x0'))['db'][_0x12d3('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x12d3('0x2')](0x0);var events={'afterCreate':_0x12d3('0x3'),'afterUpdate':_0x12d3('0x4'),'afterDestroy':_0x12d3('0x5')};function emitEvent(_0x31bc46){return function(_0xf5e308,_0xe86b3,_0x4647de){VoiceQueueEvents[_0x12d3('0x6')](_0x31bc46+':'+_0xf5e308['id'],_0xf5e308);VoiceQueueEvents[_0x12d3('0x6')](_0x31bc46,_0xf5e308);_0x4647de(null);};}for(var e in events){if(events[_0x12d3('0x7')](e)){var event=events[e];VoiceQueue[_0x12d3('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xf71b=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x48bfb5,_0xa4ad5a){var _0x400a2c=function(_0x4f9cd3){while(--_0x4f9cd3){_0x48bfb5['push'](_0x48bfb5['shift']());}};_0x400a2c(++_0xa4ad5a);}(_0xf71b,0xe5));var _0xbf71=function(_0x1b896f,_0x12dbd4){_0x1b896f=_0x1b896f-0x0;var _0x4aa895=_0xf71b[_0x1b896f];return _0x4aa895;};'use strict';var EventEmitter=require(_0xbf71('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbf71('0x1')](0x0);var events={'afterCreate':_0xbf71('0x2'),'afterUpdate':_0xbf71('0x3'),'afterDestroy':_0xbf71('0x4')};function emitEvent(_0x53e7fc){return function(_0x4386c0,_0x3a6807,_0x12ce4f){VoiceQueueEvents[_0xbf71('0x5')](_0x53e7fc+':'+_0x4386c0['id'],_0x4386c0);VoiceQueueEvents[_0xbf71('0x5')](_0x53e7fc,_0x4386c0);_0x12ce4f(null);};}for(var e in events){if(events[_0xbf71('0x6')](e)){var event=events[e];VoiceQueue[_0xbf71('0x7')](e,emitEvent(event));}}module[_0xbf71('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 6fb7a24..919299a 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x3e74,0x175));var _0x43e7=function(_0xb2d121,_0x4cd7e8){_0xb2d121=_0xb2d121-0x0;var _0x168d8d=_0x3e74[_0xb2d121];return _0x168d8d;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0xa4ca7f,_0x22921a){var _0x46bb5a=function(_0x4dbee3){while(--_0x4dbee3){_0xa4ca7f['push'](_0xa4ca7f['shift']());}};_0x46bb5a(++_0x22921a);}(_0x34e8,0x12c));var _0x834e=function(_0x3dffd6,_0x1f5b5c){_0x3dffd6=_0x3dffd6-0x0;var _0x32f395=_0x34e8[_0x3dffd6];return _0x32f395;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index fadf245..62b59e1 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 _0x4ec1=['catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','model','debug','ShowVoiceQueue','find','raw','map','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x548e64,_0x29e562){var _0x47d34e=function(_0x397256){while(--_0x397256){_0x548e64['push'](_0x548e64['shift']());}};_0x47d34e(++_0x29e562);}(_0x4ec1,0x120));var _0x14ec=function(_0x2e8b20,_0x222475){_0x2e8b20=_0x2e8b20-0x0;var _0x5a8fb9=_0x4ec1[_0x2e8b20];return _0x5a8fb9;};'use strict';var _=require(_0x14ec('0x0'));var util=require(_0x14ec('0x1'));var moment=require(_0x14ec('0x2'));var BPromise=require(_0x14ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x14ec('0x5'));var logger=require(_0x14ec('0x6'))(_0x14ec('0x7'));var config=require(_0x14ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x14ec('0x9')]['http']({'port':0x232a});config[_0x14ec('0xa')]=_[_0x14ec('0xb')](config[_0x14ec('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14ec('0xa')]));require('./voiceQueue.socket')[_0x14ec('0xc')](socket);function respondWithRpcPromise(_0x2b491d,_0x3fff9b,_0x28258c){return new BPromise(function(_0x121040,_0x4e5c0a){return client[_0x14ec('0xd')](_0x2b491d,_0x28258c)[_0x14ec('0xe')](function(_0x2a93eb){logger[_0x14ec('0xf')](_0x14ec('0x10'),_0x3fff9b,_0x14ec('0x11'));logger['debug'](_0x14ec('0x12'),_0x3fff9b,'request\x20sent',JSON[_0x14ec('0x13')](_0x2a93eb));if(_0x2a93eb[_0x14ec('0x14')]){if(_0x2a93eb[_0x14ec('0x14')][_0x14ec('0x15')]===0x1f4){logger[_0x14ec('0x14')](_0x14ec('0x10'),_0x3fff9b,_0x2a93eb['error'][_0x14ec('0x16')]);return _0x4e5c0a(_0x2a93eb[_0x14ec('0x14')][_0x14ec('0x16')]);}logger[_0x14ec('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x3fff9b,_0x2a93eb[_0x14ec('0x14')][_0x14ec('0x16')]);return _0x121040(_0x2a93eb[_0x14ec('0x14')][_0x14ec('0x16')]);}else{logger[_0x14ec('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x3fff9b,'request\x20sent');_0x121040(_0x2a93eb[_0x14ec('0x17')]['message']);}})[_0x14ec('0x18')](function(_0x3ad949){logger[_0x14ec('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x3fff9b,_0x3ad949);_0x4e5c0a(_0x3ad949);});});}exports[_0x14ec('0x19')]=function(_0x3c92ae){var _0x376ed7=this;return new Promise(function(_0x31f46e,_0x54abaf){return db[_0x14ec('0x1a')][_0x14ec('0x1b')]({'raw':_0x3c92ae[_0x14ec('0x1c')]?_0x3c92ae[_0x14ec('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3c92ae[_0x14ec('0x1c')]?_0x3c92ae[_0x14ec('0x1c')][_0x14ec('0x1d')]||null:null,'attributes':_0x3c92ae['options']?_0x3c92ae[_0x14ec('0x1c')][_0x14ec('0x1e')]||null:null,'limit':_0x3c92ae[_0x14ec('0x1c')]?_0x3c92ae[_0x14ec('0x1c')][_0x14ec('0x1f')]||null:null,'include':_0x3c92ae[_0x14ec('0x1c')]?_0x3c92ae['options'][_0x14ec('0x20')]?_['map'](_0x3c92ae[_0x14ec('0x1c')][_0x14ec('0x20')],function(_0x5a5810){return{'model':db[_0x5a5810[_0x14ec('0x21')]],'as':_0x5a5810['as'],'attributes':_0x5a5810[_0x14ec('0x1e')],'include':_0x5a5810['include']?_['map'](_0x5a5810[_0x14ec('0x20')],function(_0x1c97d6){return{'model':db[_0x1c97d6[_0x14ec('0x21')]],'as':_0x1c97d6['as'],'attributes':_0x1c97d6[_0x14ec('0x1e')],'include':_0x1c97d6[_0x14ec('0x20')]?_['map'](_0x1c97d6['include'],function(_0xd9797d){return{'model':db[_0xd9797d[_0x14ec('0x21')]],'as':_0xd9797d['as'],'attributes':_0xd9797d[_0x14ec('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14ec('0xe')](function(_0x4978e3){logger[_0x14ec('0xf')](_0x14ec('0x19'),_0x3c92ae);logger[_0x14ec('0x22')]('GetVoiceQueue',_0x3c92ae,JSON[_0x14ec('0x13')](_0x4978e3));_0x31f46e(_0x4978e3);})[_0x14ec('0x18')](function(_0x57de07){logger[_0x14ec('0x14')](_0x14ec('0x19'),_0x57de07[_0x14ec('0x16')],_0x3c92ae);_0x54abaf(_0x376ed7['error'](0x1f4,_0x57de07['message']));});});};exports[_0x14ec('0x23')]=function(_0xda1848){var _0x6bf395=this;return new Promise(function(_0x3e2408,_0x3fb783){return db[_0x14ec('0x1a')][_0x14ec('0x24')]({'raw':_0xda1848[_0x14ec('0x1c')]?_0xda1848[_0x14ec('0x1c')][_0x14ec('0x25')]===undefined?!![]:![]:!![],'where':_0xda1848[_0x14ec('0x1c')]?_0xda1848[_0x14ec('0x1c')][_0x14ec('0x1d')]||null:null,'attributes':_0xda1848[_0x14ec('0x1c')]?_0xda1848[_0x14ec('0x1c')][_0x14ec('0x1e')]||null:null,'include':_0xda1848[_0x14ec('0x1c')]?_0xda1848[_0x14ec('0x1c')][_0x14ec('0x20')]?_[_0x14ec('0x26')](_0xda1848[_0x14ec('0x1c')][_0x14ec('0x20')],function(_0xe7ac2b){return{'model':db[_0xe7ac2b[_0x14ec('0x21')]],'as':_0xe7ac2b['as'],'attributes':_0xe7ac2b['attributes'],'include':_0xe7ac2b['include']?_[_0x14ec('0x26')](_0xe7ac2b[_0x14ec('0x20')],function(_0x16eaac){return{'model':db[_0x16eaac[_0x14ec('0x21')]],'as':_0x16eaac['as'],'attributes':_0x16eaac[_0x14ec('0x1e')],'include':_0x16eaac[_0x14ec('0x20')]?_[_0x14ec('0x26')](_0x16eaac[_0x14ec('0x20')],function(_0x4f8d21){return{'model':db[_0x4f8d21[_0x14ec('0x21')]],'as':_0x4f8d21['as'],'attributes':_0x4f8d21[_0x14ec('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14ec('0xe')](function(_0x299a0d){logger['info']('ShowVoiceQueue',_0xda1848);logger[_0x14ec('0x22')](_0x14ec('0x23'),_0xda1848,JSON[_0x14ec('0x13')](_0x299a0d));_0x3e2408(_0x299a0d);})[_0x14ec('0x18')](function(_0x2c4866){logger[_0x14ec('0x14')](_0x14ec('0x23'),_0x2c4866['message'],_0xda1848);_0x3fb783(_0x6bf395[_0x14ec('0x14')](0x1f4,_0x2c4866[_0x14ec('0x16')]));});});}; \ No newline at end of file +var _0xdc78=['request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','debug','ShowVoiceQueue','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register'];(function(_0x31752d,_0x2efff8){var _0x29da67=function(_0x296d74){while(--_0x296d74){_0x31752d['push'](_0x31752d['shift']());}};_0x29da67(++_0x2efff8);}(_0xdc78,0x10f));var _0x8dc7=function(_0x434ddc,_0x1f9e59){_0x434ddc=_0x434ddc-0x0;var _0x283bf5=_0xdc78[_0x434ddc];return _0x283bf5;};'use strict';var _=require(_0x8dc7('0x0'));var util=require(_0x8dc7('0x1'));var moment=require(_0x8dc7('0x2'));var BPromise=require('bluebird');var rs=require(_0x8dc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8dc7('0x4'))['db'];var utils=require(_0x8dc7('0x5'));var logger=require(_0x8dc7('0x6'))('rpc');var config=require(_0x8dc7('0x7'));var jayson=require(_0x8dc7('0x8'));var client=jayson[_0x8dc7('0x9')][_0x8dc7('0xa')]({'port':0x232a});config[_0x8dc7('0xb')]=_[_0x8dc7('0xc')](config[_0x8dc7('0xb')],{'host':_0x8dc7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8dc7('0xb')]));require(_0x8dc7('0xe'))[_0x8dc7('0xf')](socket);function respondWithRpcPromise(_0x4fb2bb,_0x4d1c33,_0x5246e0){return new BPromise(function(_0x5499f5,_0x12c61a){return client[_0x8dc7('0x10')](_0x4fb2bb,_0x5246e0)[_0x8dc7('0x11')](function(_0x129a2d){logger[_0x8dc7('0x12')](_0x8dc7('0x13'),_0x4d1c33,_0x8dc7('0x14'));logger['debug'](_0x8dc7('0x15'),_0x4d1c33,_0x8dc7('0x14'),JSON[_0x8dc7('0x16')](_0x129a2d));if(_0x129a2d[_0x8dc7('0x17')]){if(_0x129a2d[_0x8dc7('0x17')][_0x8dc7('0x18')]===0x1f4){logger[_0x8dc7('0x17')](_0x8dc7('0x13'),_0x4d1c33,_0x129a2d[_0x8dc7('0x17')]['message']);return _0x12c61a(_0x129a2d[_0x8dc7('0x17')][_0x8dc7('0x19')]);}logger[_0x8dc7('0x17')](_0x8dc7('0x13'),_0x4d1c33,_0x129a2d['error'][_0x8dc7('0x19')]);return _0x5499f5(_0x129a2d[_0x8dc7('0x17')][_0x8dc7('0x19')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4d1c33,_0x8dc7('0x14'));_0x5499f5(_0x129a2d[_0x8dc7('0x1a')]['message']);}})['catch'](function(_0x1060d0){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x4d1c33,_0x1060d0);_0x12c61a(_0x1060d0);});});}exports['GetVoiceQueue']=function(_0x6999a7){var _0x15e884=this;return new Promise(function(_0x289eeb,_0x57acfe){return db[_0x8dc7('0x1b')][_0x8dc7('0x1c')]({'raw':_0x6999a7[_0x8dc7('0x1d')]?_0x6999a7['options'][_0x8dc7('0x1e')]===undefined?!![]:![]:!![],'where':_0x6999a7[_0x8dc7('0x1d')]?_0x6999a7[_0x8dc7('0x1d')][_0x8dc7('0x1f')]||null:null,'attributes':_0x6999a7[_0x8dc7('0x1d')]?_0x6999a7[_0x8dc7('0x1d')][_0x8dc7('0x20')]||null:null,'limit':_0x6999a7[_0x8dc7('0x1d')]?_0x6999a7['options'][_0x8dc7('0x21')]||null:null,'include':_0x6999a7['options']?_0x6999a7[_0x8dc7('0x1d')][_0x8dc7('0x22')]?_[_0x8dc7('0x23')](_0x6999a7[_0x8dc7('0x1d')][_0x8dc7('0x22')],function(_0x4d2243){return{'model':db[_0x4d2243['model']],'as':_0x4d2243['as'],'attributes':_0x4d2243[_0x8dc7('0x20')],'include':_0x4d2243[_0x8dc7('0x22')]?_[_0x8dc7('0x23')](_0x4d2243[_0x8dc7('0x22')],function(_0x30f45b){return{'model':db[_0x30f45b[_0x8dc7('0x24')]],'as':_0x30f45b['as'],'attributes':_0x30f45b[_0x8dc7('0x20')],'include':_0x30f45b[_0x8dc7('0x22')]?_['map'](_0x30f45b[_0x8dc7('0x22')],function(_0x3dd502){return{'model':db[_0x3dd502['model']],'as':_0x3dd502['as'],'attributes':_0x3dd502[_0x8dc7('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3af29d){logger[_0x8dc7('0x12')](_0x8dc7('0x25'),_0x6999a7);logger[_0x8dc7('0x26')]('GetVoiceQueue',_0x6999a7,JSON[_0x8dc7('0x16')](_0x3af29d));_0x289eeb(_0x3af29d);})['catch'](function(_0x3b97bf){logger[_0x8dc7('0x17')]('GetVoiceQueue',_0x3b97bf[_0x8dc7('0x19')],_0x6999a7);_0x57acfe(_0x15e884[_0x8dc7('0x17')](0x1f4,_0x3b97bf['message']));});});};exports[_0x8dc7('0x27')]=function(_0x3413fb){var _0x500c9d=this;return new Promise(function(_0x3380fa,_0x4eb856){return db[_0x8dc7('0x1b')]['find']({'raw':_0x3413fb[_0x8dc7('0x1d')]?_0x3413fb['options'][_0x8dc7('0x1e')]===undefined?!![]:![]:!![],'where':_0x3413fb[_0x8dc7('0x1d')]?_0x3413fb['options']['where']||null:null,'attributes':_0x3413fb['options']?_0x3413fb[_0x8dc7('0x1d')][_0x8dc7('0x20')]||null:null,'include':_0x3413fb[_0x8dc7('0x1d')]?_0x3413fb['options'][_0x8dc7('0x22')]?_[_0x8dc7('0x23')](_0x3413fb[_0x8dc7('0x1d')][_0x8dc7('0x22')],function(_0x1e036a){return{'model':db[_0x1e036a['model']],'as':_0x1e036a['as'],'attributes':_0x1e036a[_0x8dc7('0x20')],'include':_0x1e036a[_0x8dc7('0x22')]?_[_0x8dc7('0x23')](_0x1e036a['include'],function(_0x427b48){return{'model':db[_0x427b48['model']],'as':_0x427b48['as'],'attributes':_0x427b48['attributes'],'include':_0x427b48[_0x8dc7('0x22')]?_[_0x8dc7('0x23')](_0x427b48[_0x8dc7('0x22')],function(_0x277802){return{'model':db[_0x277802['model']],'as':_0x277802['as'],'attributes':_0x277802[_0x8dc7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8dc7('0x11')](function(_0x5650d2){logger[_0x8dc7('0x12')]('ShowVoiceQueue',_0x3413fb);logger[_0x8dc7('0x26')](_0x8dc7('0x27'),_0x3413fb,JSON['stringify'](_0x5650d2));_0x3380fa(_0x5650d2);})[_0x8dc7('0x28')](function(_0x5d7b18){logger[_0x8dc7('0x17')](_0x8dc7('0x27'),_0x5d7b18['message'],_0x3413fb);_0x4eb856(_0x500c9d[_0x8dc7('0x17')](0x1f4,_0x5d7b18[_0x8dc7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 286ed04..d1f107a 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 _0xbaff=['emit','register','length','voiceQueue:','./voiceQueue.events','update'];(function(_0x473b41,_0x1c320f){var _0x4e521d=function(_0x19a745){while(--_0x19a745){_0x473b41['push'](_0x473b41['shift']());}};_0x4e521d(++_0x1c320f);}(_0xbaff,0x1d2));var _0xfbaf=function(_0x54a7dd,_0x19351d){_0x54a7dd=_0x54a7dd-0x0;var _0x3316d5=_0xbaff[_0x54a7dd];return _0x3316d5;};'use strict';var VoiceQueueEvents=require(_0xfbaf('0x0'));var events=['save','remove',_0xfbaf('0x1')];function createListener(_0x294b35,_0x2fb087){return function(_0x30e80c){_0x2fb087[_0xfbaf('0x2')](_0x294b35,_0x30e80c);};}function removeListener(_0x3cb472,_0x1249b7){return function(){VoiceQueueEvents['removeListener'](_0x3cb472,_0x1249b7);};}exports[_0xfbaf('0x3')]=function(_0x1c5881){for(var _0x34ae96=0x0,_0x23c1de=events[_0xfbaf('0x4')];_0x34ae96<_0x23c1de;_0x34ae96++){var _0x41bbd8=events[_0x34ae96];var _0x335a58=createListener(_0xfbaf('0x5')+_0x41bbd8,_0x1c5881);VoiceQueueEvents['on'](_0x41bbd8,_0x335a58);}}; \ No newline at end of file +var _0x2bb6=['update','removeListener','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x326b26,_0x3d372b){var _0x185153=function(_0x102fa4){while(--_0x102fa4){_0x326b26['push'](_0x326b26['shift']());}};_0x185153(++_0x3d372b);}(_0x2bb6,0x6f));var _0x62bb=function(_0x488616,_0x516a25){_0x488616=_0x488616-0x0;var _0x217fb3=_0x2bb6[_0x488616];return _0x217fb3;};'use strict';var VoiceQueueEvents=require(_0x62bb('0x0'));var events=[_0x62bb('0x1'),_0x62bb('0x2'),_0x62bb('0x3')];function createListener(_0x1d31b1,_0xac8711){return function(_0x3ee177){_0xac8711['emit'](_0x1d31b1,_0x3ee177);};}function removeListener(_0x2b8b85,_0x2b4818){return function(){VoiceQueueEvents[_0x62bb('0x4')](_0x2b8b85,_0x2b4818);};}exports['register']=function(_0x1730f4){for(var _0x3b656b=0x0,_0x9d42dc=events['length'];_0x3b656b<_0x9d42dc;_0x3b656b++){var _0x378241=events[_0x3b656b];var _0x352783=createListener(_0x62bb('0x5')+_0x378241,_0x1730f4);VoiceQueueEvents['on'](_0x378241,_0x352783);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 3c181bd..22c3742 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 _0xd825=['isAuthenticated','describe','/index','getVoiceQueuesReport','show','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get'];(function(_0x4540f0,_0xe6dd95){var _0x52d1e6=function(_0x1641d1){while(--_0x1641d1){_0x4540f0['push'](_0x4540f0['shift']());}};_0x52d1e6(++_0xe6dd95);}(_0xd825,0x197));var _0x5d82=function(_0x42f876,_0x54b94e){_0x42f876=_0x42f876-0x0;var _0x1e1f75=_0xd825[_0x42f876];return _0x1e1f75;};'use strict';var multer=require('multer');var util=require(_0x5d82('0x0'));var path=require(_0x5d82('0x1'));var timeout=require(_0x5d82('0x2'));var express=require('express');var router=express[_0x5d82('0x3')]();var fs_extra=require(_0x5d82('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5d82('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x5d82('0x6')]('/',auth[_0x5d82('0x7')](),controller['index']);router[_0x5d82('0x6')]('/describe',auth[_0x5d82('0x7')](),controller[_0x5d82('0x8')]);router[_0x5d82('0x6')](_0x5d82('0x9'),auth['isAuthenticated'](),controller[_0x5d82('0xa')]);router[_0x5d82('0x6')]('/:id',auth[_0x5d82('0x7')](),controller[_0x5d82('0xb')]);router[_0x5d82('0xc')]('/',auth[_0x5d82('0x7')](),controller[_0x5d82('0xd')]);router['put'](_0x5d82('0xe'),auth[_0x5d82('0x7')](),controller['update']);router[_0x5d82('0xf')](_0x5d82('0xe'),auth[_0x5d82('0x7')](),controller[_0x5d82('0x10')]);module[_0x5d82('0x11')]=router; \ No newline at end of file +var _0x8da1=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','create'];(function(_0x4954d4,_0x88836f){var _0x5d282d=function(_0x406e19){while(--_0x406e19){_0x4954d4['push'](_0x4954d4['shift']());}};_0x5d282d(++_0x88836f);}(_0x8da1,0xf8));var _0x18da=function(_0x24507a,_0x58e59b){_0x24507a=_0x24507a-0x0;var _0x20ed6a=_0x8da1[_0x24507a];return _0x20ed6a;};'use strict';var multer=require('multer');var util=require(_0x18da('0x0'));var path=require(_0x18da('0x1'));var timeout=require(_0x18da('0x2'));var express=require(_0x18da('0x3'));var router=express[_0x18da('0x4')]();var fs_extra=require(_0x18da('0x5'));var auth=require(_0x18da('0x6'));var interaction=require(_0x18da('0x7'));var config=require('../../config/environment');var controller=require(_0x18da('0x8'));router['get']('/',auth[_0x18da('0x9')](),controller[_0x18da('0xa')]);router[_0x18da('0xb')](_0x18da('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x18da('0xb')](_0x18da('0xd'),auth[_0x18da('0x9')](),controller[_0x18da('0xe')]);router['get']('/:id',auth[_0x18da('0x9')](),controller['show']);router['post']('/',auth[_0x18da('0x9')](),controller[_0x18da('0xf')]);router[_0x18da('0x10')](_0x18da('0x11'),auth[_0x18da('0x9')](),controller[_0x18da('0x12')]);router[_0x18da('0x13')](_0x18da('0x11'),auth[_0x18da('0x9')](),controller[_0x18da('0x14')]);module[_0x18da('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 60a5c7d..38c918a 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 _0xe289=['holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x40b003,_0x3ae3aa){var _0x3d0edc=function(_0x1f048e){while(--_0x1f048e){_0x40b003['push'](_0x40b003['shift']());}};_0x3d0edc(++_0x3ae3aa);}(_0xe289,0xe5));var _0x9e28=function(_0x19f568,_0x50baf4){_0x19f568=_0x19f568-0x0;var _0x525a6a=_0xe289[_0x19f568];return _0x525a6a;};'use strict';var Sequelize=require(_0x9e28('0x0'));var moment=require('moment');module[_0x9e28('0x1')]={'type':{'type':Sequelize[_0x9e28('0x2')]},'uniqueid':{'type':Sequelize[_0x9e28('0x2')]},'calleridnum':{'type':Sequelize[_0x9e28('0x2')]},'calleridname':{'type':Sequelize[_0x9e28('0x2')]},'queue':{'type':Sequelize[_0x9e28('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x9e28('0x3')],'set':function(_0xebd67c){var _0x2240e6=moment(_0xebd67c);var _0x4f7997=moment(this[_0x9e28('0x4')](_0x9e28('0x5')))[_0x9e28('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1b9f63=_0x2240e6[_0x9e28('0x7')](_0x4f7997,_0x9e28('0x8'));this[_0x9e28('0x9')](_0x9e28('0xa'),_0xebd67c);this[_0x9e28('0x9')](_0x9e28('0xb'),_0x1b9f63||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x9e28('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9e28('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x9e28('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9e28('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9e28('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x9e28('0x2')],'comment':_0x9e28('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x9e28('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9e28('0x2')]},'connectedlinename':{'type':Sequelize[_0x9e28('0x2')]},'accountcode':{'type':Sequelize[_0x9e28('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9e28('0x2')]},'priority':{'type':Sequelize[_0x9e28('0x2')]},'holdtime':{'type':Sequelize[_0x9e28('0xe')]},'mohtime':{'type':Sequelize[_0x9e28('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9e28('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x9e28('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9e28('0x2')],'comment':_0x9e28('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x9e28('0x2')]},'secondDisposition':{'type':Sequelize[_0x9e28('0x2')]},'thirdDisposition':{'type':Sequelize[_0x9e28('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x9e28('0xe')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9e28('0x2')]}}; \ No newline at end of file +var _0x17cf=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x4f310b,_0x2eb1b5){var _0x404f33=function(_0x24781f){while(--_0x24781f){_0x4f310b['push'](_0x4f310b['shift']());}};_0x404f33(++_0x2eb1b5);}(_0x17cf,0x1c3));var _0xf17c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x17cf[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xf17c('0x0'));var moment=require('moment');module[_0xf17c('0x1')]={'type':{'type':Sequelize[_0xf17c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf17c('0x2')]},'calleridname':{'type':Sequelize[_0xf17c('0x2')]},'queue':{'type':Sequelize[_0xf17c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xf17c('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xf17c('0x3')],'set':function(_0x111224){var _0x3d1a7d=moment(_0x111224);var _0x48a12d=moment(this['getDataValue']('queuecallerjoinAt'))[_0xf17c('0x4')](_0xf17c('0x5'));var _0x2c6fcc=_0x3d1a7d[_0xf17c('0x6')](_0x48a12d,_0xf17c('0x7'));this['setDataValue']('queuecallerleaveAt',_0x111224);this[_0xf17c('0x8')]('holdtime',_0x2c6fcc||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xf17c('0x9')]},'queuecallerabandon':{'type':Sequelize[_0xf17c('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf17c('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xf17c('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf17c('0x3')]},'queuecallerexit':{'type':Sequelize[_0xf17c('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf17c('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xf17c('0x2')],'comment':_0xf17c('0xb')},'originalposition':{'type':Sequelize[_0xf17c('0x9')]},'channel':{'type':Sequelize[_0xf17c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf17c('0x2')]},'accountcode':{'type':Sequelize[_0xf17c('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf17c('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf17c('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf17c('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf17c('0x2')],'comment':_0xf17c('0xc')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xf17c('0x2')]},'disposition':{'type':Sequelize[_0xf17c('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf17c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xf17c('0x9')],'defaultValue':0x0},'note':{'type':Sequelize[_0xf17c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 24bc71d..5c50566 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 _0xce3c=['set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','index','map','rawAttributes','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','VoiceQueueReport','include','rows','catch','show','includeAll','options','create','body','find','destroy','describe','getVoiceQueuesReport','pick','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','end','status','json','offset','limit','count'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xce3c,0x187));var _0xcce3=function(_0x23a971,_0x70b461){_0x23a971=_0x23a971-0x0;var _0x36c6d3=_0xce3c[_0x23a971];return _0x36c6d3;};'use strict';var emlformat=require(_0xcce3('0x0'));var rimraf=require(_0xcce3('0x1'));var zipdir=require(_0xcce3('0x2'));var jsonpatch=require(_0xcce3('0x3'));var rp=require('request-promise');var moment=require(_0xcce3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcce3('0x5'));var path=require(_0xcce3('0x6'));var sox=require(_0xcce3('0x7'));var csv=require(_0xcce3('0x8'));var ejs=require(_0xcce3('0x9'));var fs=require('fs');var fs_extra=require(_0xcce3('0xa'));var _=require(_0xcce3('0xb'));var squel=require(_0xcce3('0xc'));var crypto=require(_0xcce3('0xd'));var jsforce=require(_0xcce3('0xe'));var deskjs=require(_0xcce3('0xf'));var toCsv=require(_0xcce3('0x8'));var querystring=require(_0xcce3('0x10'));var Papa=require(_0xcce3('0x11'));var Redis=require(_0xcce3('0x12'));var authService=require(_0xcce3('0x13'));var qs=require(_0xcce3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcce3('0x15'));var logger=require(_0xcce3('0x16'))(_0xcce3('0x17'));var utils=require(_0xcce3('0x18'));var config=require(_0xcce3('0x19'));var licenseUtil=require(_0xcce3('0x1a'));var db=require(_0xcce3('0x1b'))['db'];config[_0xcce3('0x1c')]=_[_0xcce3('0x1d')](config[_0xcce3('0x1c')],{'host':_0xcce3('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcce3('0x1c')]));require(_0xcce3('0x1f'))[_0xcce3('0x20')](socket);function respondWithStatusCode(_0x458732,_0xcad130){_0xcad130=_0xcad130||0xcc;return function(_0x311d5f){if(_0x311d5f){return _0x458732['sendStatus'](_0xcad130);}return _0x458732['status'](_0xcad130)[_0xcce3('0x21')]();};}function respondWithResult(_0x455866,_0x5c1dd2){_0x5c1dd2=_0x5c1dd2||0xc8;return function(_0x3f004f){if(_0x3f004f){return _0x455866[_0xcce3('0x22')](_0x5c1dd2)[_0xcce3('0x23')](_0x3f004f);}};}function respondWithFilteredResult(_0x55bffd,_0x590826){return function(_0x3e68e0){if(_0x3e68e0){var _0x208c79=typeof _0x590826[_0xcce3('0x24')]==='undefined'&&typeof _0x590826[_0xcce3('0x25')]==='undefined';var _0x52c960=_0x3e68e0['count'];var _0x5e1f96=_0x208c79?0x0:_0x590826[_0xcce3('0x24')];var _0x5d3b1c=_0x208c79?_0x3e68e0[_0xcce3('0x26')]:_0x590826['offset']+_0x590826['limit'];var _0x34e752;if(_0x5d3b1c>=_0x52c960){_0x5d3b1c=_0x52c960;_0x34e752=0xc8;}else{_0x34e752=0xce;}_0x55bffd[_0xcce3('0x22')](_0x34e752);return _0x55bffd[_0xcce3('0x27')](_0xcce3('0x28'),_0x5e1f96+'-'+_0x5d3b1c+'/'+_0x52c960)[_0xcce3('0x23')](_0x3e68e0);}return null;};}function patchUpdates(_0x1bd13c){return function(_0x566a3f){try{jsonpatch[_0xcce3('0x29')](_0x566a3f,_0x1bd13c,!![]);}catch(_0x3cfdfe){return BPromise[_0xcce3('0x2a')](_0x3cfdfe);}return _0x566a3f[_0xcce3('0x2b')]();};}function saveUpdates(_0xc5204a,_0x329369){return function(_0x15151b){if(_0x15151b){return _0x15151b[_0xcce3('0x2c')](_0xc5204a)['then'](function(_0x20b7f1){return _0x20b7f1;});}return null;};}function removeEntity(_0x10d2bb,_0x4c85b5){return function(_0x3d8612){if(_0x3d8612){return _0x3d8612['destroy']()[_0xcce3('0x2d')](function(){_0x10d2bb[_0xcce3('0x22')](0xcc)[_0xcce3('0x21')]();});}};}function handleEntityNotFound(_0x291031,_0x54e769){return function(_0x19eb1b){if(!_0x19eb1b){_0x291031[_0xcce3('0x2e')](0x194);}return _0x19eb1b;};}function handleError(_0x5df38c,_0x55d446){_0x55d446=_0x55d446||0x1f4;return function(_0x1bd546){logger[_0xcce3('0x2f')](_0x1bd546[_0xcce3('0x30')]);if(_0x1bd546['name']){delete _0x1bd546['name'];}_0x5df38c[_0xcce3('0x22')](_0x55d446)['send'](_0x1bd546);};}exports[_0xcce3('0x31')]=function(_0x3e463b,_0x399f14){var _0xe29760={},_0x13129e={},_0x59e0ae={'count':0x0,'rows':[]};var _0x4ff9b6=_[_0xcce3('0x32')](db['VoiceQueueReport'][_0xcce3('0x33')],function(_0x396ce2){return{'name':_0x396ce2['fieldName'],'type':_0x396ce2['type'][_0xcce3('0x34')]};});_0x13129e[_0xcce3('0x35')]=_[_0xcce3('0x32')](_0x4ff9b6,_0xcce3('0x36'));_0x13129e[_0xcce3('0x37')]=_[_0xcce3('0x38')](_0x3e463b[_0xcce3('0x37')]);_0x13129e[_0xcce3('0x39')]=_['intersection'](_0x13129e[_0xcce3('0x35')],_0x13129e[_0xcce3('0x37')]);_0xe29760['attributes']=_[_0xcce3('0x3a')](_0x13129e[_0xcce3('0x35')],qs[_0xcce3('0x3b')](_0x3e463b[_0xcce3('0x37')][_0xcce3('0x3b')]));_0xe29760[_0xcce3('0x3c')]=_0xe29760[_0xcce3('0x3c')][_0xcce3('0x3d')]?_0xe29760['attributes']:_0x13129e[_0xcce3('0x35')];if(!_0x3e463b[_0xcce3('0x37')][_0xcce3('0x3e')](_0xcce3('0x3f'))){_0xe29760['limit']=qs[_0xcce3('0x25')](_0x3e463b['query'][_0xcce3('0x25')]);_0xe29760[_0xcce3('0x24')]=qs[_0xcce3('0x24')](_0x3e463b['query']['offset']);}_0xe29760[_0xcce3('0x40')]=qs[_0xcce3('0x41')](_0x3e463b[_0xcce3('0x37')]['sort']);_0xe29760['where']=qs[_0xcce3('0x39')](_['pick'](_0x3e463b[_0xcce3('0x37')],_0x13129e[_0xcce3('0x39')]),_0x4ff9b6);if(_0x3e463b[_0xcce3('0x37')][_0xcce3('0x42')]){_0xe29760['where']=_[_0xcce3('0x43')](_0xe29760[_0xcce3('0x44')],{'$or':_[_0xcce3('0x32')](_0x4ff9b6,function(_0x5ccf0e){if(_0x5ccf0e[_0xcce3('0x45')]!==_0xcce3('0x46')){var _0x137bf3={};_0x137bf3[_0x5ccf0e[_0xcce3('0x36')]]={'$like':'%'+_0x3e463b[_0xcce3('0x37')][_0xcce3('0x42')]+'%'};return _0x137bf3;}})});}_0xe29760=_[_0xcce3('0x43')]({},_0xe29760,_0x3e463b['options']);var _0x594118={'where':_0xe29760[_0xcce3('0x44')]};return db[_0xcce3('0x47')][_0xcce3('0x26')](_0x594118)[_0xcce3('0x2d')](function(_0x579d06){_0x59e0ae[_0xcce3('0x26')]=_0x579d06;if(_0x3e463b['query']['includeAll']){_0xe29760[_0xcce3('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0xe29760);})['then'](function(_0xe2eef3){_0x59e0ae[_0xcce3('0x49')]=_0xe2eef3;return _0x59e0ae;})[_0xcce3('0x2d')](respondWithFilteredResult(_0x399f14,_0xe29760))[_0xcce3('0x4a')](handleError(_0x399f14,null));};exports[_0xcce3('0x4b')]=function(_0x61219c,_0x594717){var _0x2661c7={'raw':![],'where':{'id':_0x61219c['params']['id']}},_0x510e6d={};_0x510e6d[_0xcce3('0x35')]=_[_0xcce3('0x38')](db[_0xcce3('0x47')]['rawAttributes']);_0x510e6d[_0xcce3('0x37')]=_['keys'](_0x61219c[_0xcce3('0x37')]);_0x510e6d['filters']=_[_0xcce3('0x3a')](_0x510e6d['model'],_0x510e6d[_0xcce3('0x37')]);_0x2661c7[_0xcce3('0x3c')]=_[_0xcce3('0x3a')](_0x510e6d[_0xcce3('0x35')],qs[_0xcce3('0x3b')](_0x61219c[_0xcce3('0x37')][_0xcce3('0x3b')]));_0x2661c7[_0xcce3('0x3c')]=_0x2661c7[_0xcce3('0x3c')][_0xcce3('0x3d')]?_0x2661c7['attributes']:_0x510e6d[_0xcce3('0x35')];if(_0x61219c[_0xcce3('0x37')][_0xcce3('0x4c')]){_0x2661c7[_0xcce3('0x48')]=[{'all':!![]}];}_0x2661c7=_[_0xcce3('0x43')]({},_0x2661c7,_0x61219c[_0xcce3('0x4d')]);return db['VoiceQueueReport']['find'](_0x2661c7)['then'](handleEntityNotFound(_0x594717,null))[_0xcce3('0x2d')](respondWithResult(_0x594717,null))[_0xcce3('0x4a')](handleError(_0x594717,null));};exports[_0xcce3('0x4e')]=function(_0x4a3c8c,_0x49646a){return db[_0xcce3('0x47')]['create'](_0x4a3c8c[_0xcce3('0x4f')],{})[_0xcce3('0x2d')](respondWithResult(_0x49646a,0xc9))['catch'](handleError(_0x49646a,null));};exports[_0xcce3('0x2c')]=function(_0x1dccad,_0x5bb788){if(_0x1dccad[_0xcce3('0x4f')]['id']){delete _0x1dccad[_0xcce3('0x4f')]['id'];}return db['VoiceQueueReport'][_0xcce3('0x50')]({'where':{'id':_0x1dccad['params']['id']}})['then'](handleEntityNotFound(_0x5bb788,null))[_0xcce3('0x2d')](saveUpdates(_0x1dccad[_0xcce3('0x4f')],null))['then'](respondWithResult(_0x5bb788,null))[_0xcce3('0x4a')](handleError(_0x5bb788,null));};exports[_0xcce3('0x51')]=function(_0x195271,_0x453685){return db[_0xcce3('0x47')][_0xcce3('0x50')]({'where':{'id':_0x195271['params']['id']}})[_0xcce3('0x2d')](handleEntityNotFound(_0x453685,null))['then'](removeEntity(_0x453685,null))[_0xcce3('0x4a')](handleError(_0x453685,null));};exports[_0xcce3('0x52')]=function(_0x5ac7b5,_0x594583){return db[_0xcce3('0x47')][_0xcce3('0x52')]()[_0xcce3('0x2d')](respondWithResult(_0x594583,null))[_0xcce3('0x4a')](handleError(_0x594583,null));};exports[_0xcce3('0x53')]=function(_0x32d91b,_0x399544){var _0x240123={},_0x1f3fa4={},_0x8255db={'count':0x0,'rows':[]};_0x1f3fa4[_0xcce3('0x35')]=_['keys'](db[_0xcce3('0x47')][_0xcce3('0x33')]);_0x1f3fa4[_0xcce3('0x37')]=_[_0xcce3('0x38')](_0x32d91b[_0xcce3('0x37')]);_0x1f3fa4['filters']=_[_0xcce3('0x3a')](_0x1f3fa4['model'],_0x1f3fa4[_0xcce3('0x37')]);_0x240123[_0xcce3('0x3c')]=_[_0xcce3('0x3a')](_0x1f3fa4[_0xcce3('0x35')],qs[_0xcce3('0x3b')](_0x32d91b[_0xcce3('0x37')][_0xcce3('0x3b')]));_0x240123[_0xcce3('0x3c')]=_0x240123[_0xcce3('0x3c')][_0xcce3('0x3d')]?_0x240123[_0xcce3('0x3c')]:_0x1f3fa4[_0xcce3('0x35')];if(!_0x32d91b[_0xcce3('0x37')][_0xcce3('0x3e')](_0xcce3('0x3f'))){_0x240123[_0xcce3('0x25')]=qs[_0xcce3('0x25')](_0x32d91b['query'][_0xcce3('0x25')]);_0x240123[_0xcce3('0x24')]=qs[_0xcce3('0x24')](_0x32d91b[_0xcce3('0x37')]['offset']);}_0x240123[_0xcce3('0x40')]=qs[_0xcce3('0x41')](_0x32d91b[_0xcce3('0x37')][_0xcce3('0x41')]);_0x240123[_0xcce3('0x44')]=qs[_0xcce3('0x39')](_[_0xcce3('0x54')](_0x32d91b['query'],_0x1f3fa4[_0xcce3('0x39')]));if(_0x32d91b['query']['filter']){_0x240123[_0xcce3('0x44')]=_[_0xcce3('0x43')](_0x240123['where'],{'$or':_[_0xcce3('0x32')](_0x240123[_0xcce3('0x3c')],function(_0xf7a46e){var _0xbe743a={};_0xbe743a[_0xf7a46e]={'$like':'%'+_0x32d91b['query']['filter']+'%'};return _0xbe743a;})});}_0x240123=_[_0xcce3('0x43')]({},_0x240123,_0x32d91b[_0xcce3('0x4d')]);var _0x1492b1={'where':_0x240123['where']};return db[_0xcce3('0x47')][_0xcce3('0x26')](_0x1492b1)['then'](function(_0x3c0f90){_0x8255db[_0xcce3('0x26')]=_0x3c0f90;if(_0x32d91b[_0xcce3('0x37')][_0xcce3('0x4c')]){_0x240123[_0xcce3('0x48')]=[{'all':!![]}];}return db[_0xcce3('0x47')][_0xcce3('0x55')](_0x240123);})['then'](function(_0x24d81b){_0x8255db['rows']=_0x24d81b;return _0x8255db;})[_0xcce3('0x2d')](respondWithFilteredResult(_0x399544,_0x240123,'getVoiceQueuesReport'))[_0xcce3('0x4a')](handleError(_0x399544,null,_0xcce3('0x53')));}; \ No newline at end of file +var _0xece1=['desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','VoiceQueueReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1c86af,_0x40f50d){var _0xbdd025=function(_0xd168a4){while(--_0xd168a4){_0x1c86af['push'](_0x1c86af['shift']());}};_0xbdd025(++_0x40f50d);}(_0xece1,0x1ed));var _0x1ece=function(_0x497d6d,_0xff7558){_0x497d6d=_0x497d6d-0x0;var _0x4a1d9a=_0xece1[_0x497d6d];return _0x4a1d9a;};'use strict';var emlformat=require(_0x1ece('0x0'));var rimraf=require(_0x1ece('0x1'));var zipdir=require(_0x1ece('0x2'));var jsonpatch=require(_0x1ece('0x3'));var rp=require(_0x1ece('0x4'));var moment=require(_0x1ece('0x5'));var BPromise=require(_0x1ece('0x6'));var Mustache=require(_0x1ece('0x7'));var util=require(_0x1ece('0x8'));var path=require(_0x1ece('0x9'));var sox=require(_0x1ece('0xa'));var csv=require(_0x1ece('0xb'));var ejs=require(_0x1ece('0xc'));var fs=require('fs');var fs_extra=require(_0x1ece('0xd'));var _=require(_0x1ece('0xe'));var squel=require(_0x1ece('0xf'));var crypto=require(_0x1ece('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x1ece('0x11'));var toCsv=require(_0x1ece('0xb'));var querystring=require(_0x1ece('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1ece('0x13'));var as=require(_0x1ece('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ece('0x15'))(_0x1ece('0x16'));var utils=require(_0x1ece('0x17'));var config=require(_0x1ece('0x18'));var licenseUtil=require(_0x1ece('0x19'));var db=require(_0x1ece('0x1a'))['db'];config[_0x1ece('0x1b')]=_[_0x1ece('0x1c')](config['redis'],{'host':_0x1ece('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1ece('0x1e'))['register'](socket);function respondWithStatusCode(_0x27d363,_0x1d180f){_0x1d180f=_0x1d180f||0xcc;return function(_0x387e45){if(_0x387e45){return _0x27d363[_0x1ece('0x1f')](_0x1d180f);}return _0x27d363['status'](_0x1d180f)['end']();};}function respondWithResult(_0x312d65,_0x264603){_0x264603=_0x264603||0xc8;return function(_0x42a853){if(_0x42a853){return _0x312d65['status'](_0x264603)[_0x1ece('0x20')](_0x42a853);}};}function respondWithFilteredResult(_0x5342ce,_0x837e72){return function(_0x27da97){if(_0x27da97){var _0x394774=typeof _0x837e72[_0x1ece('0x21')]===_0x1ece('0x22')&&typeof _0x837e72[_0x1ece('0x23')]===_0x1ece('0x22');var _0xe6569c=_0x27da97[_0x1ece('0x24')];var _0x3ab43d=_0x394774?0x0:_0x837e72['offset'];var _0x36d9fe=_0x394774?_0x27da97[_0x1ece('0x24')]:_0x837e72[_0x1ece('0x21')]+_0x837e72[_0x1ece('0x23')];var _0x5da54c;if(_0x36d9fe>=_0xe6569c){_0x36d9fe=_0xe6569c;_0x5da54c=0xc8;}else{_0x5da54c=0xce;}_0x5342ce[_0x1ece('0x25')](_0x5da54c);return _0x5342ce[_0x1ece('0x26')](_0x1ece('0x27'),_0x3ab43d+'-'+_0x36d9fe+'/'+_0xe6569c)[_0x1ece('0x20')](_0x27da97);}return null;};}function patchUpdates(_0x4ffd10){return function(_0x28f244){try{jsonpatch[_0x1ece('0x28')](_0x28f244,_0x4ffd10,!![]);}catch(_0x4ae181){return BPromise[_0x1ece('0x29')](_0x4ae181);}return _0x28f244['save']();};}function saveUpdates(_0x1788b6,_0x24381c){return function(_0x26810e){if(_0x26810e){return _0x26810e[_0x1ece('0x2a')](_0x1788b6)[_0x1ece('0x2b')](function(_0x3a9824){return _0x3a9824;});}return null;};}function removeEntity(_0x46a34f,_0x3471d8){return function(_0x1eab76){if(_0x1eab76){return _0x1eab76[_0x1ece('0x2c')]()[_0x1ece('0x2b')](function(){_0x46a34f[_0x1ece('0x25')](0xcc)[_0x1ece('0x2d')]();});}};}function handleEntityNotFound(_0x32c4f6,_0x1f4e09){return function(_0x5ab952){if(!_0x5ab952){_0x32c4f6[_0x1ece('0x1f')](0x194);}return _0x5ab952;};}function handleError(_0x4767e6,_0x73a30a){_0x73a30a=_0x73a30a||0x1f4;return function(_0x25b1bc){logger[_0x1ece('0x2e')](_0x25b1bc[_0x1ece('0x2f')]);if(_0x25b1bc[_0x1ece('0x30')]){delete _0x25b1bc['name'];}_0x4767e6['status'](_0x73a30a)[_0x1ece('0x31')](_0x25b1bc);};}exports[_0x1ece('0x32')]=function(_0x55988d,_0x4ed723){var _0x31e99b={},_0x26634c={},_0x44b1b3={'count':0x0,'rows':[]};var _0x6c7a09=_[_0x1ece('0x33')](db['VoiceQueueReport'][_0x1ece('0x34')],function(_0xdd702d){return{'name':_0xdd702d[_0x1ece('0x35')],'type':_0xdd702d['type']['key']};});_0x26634c[_0x1ece('0x36')]=_[_0x1ece('0x33')](_0x6c7a09,_0x1ece('0x30'));_0x26634c[_0x1ece('0x37')]=_[_0x1ece('0x38')](_0x55988d[_0x1ece('0x37')]);_0x26634c[_0x1ece('0x39')]=_[_0x1ece('0x3a')](_0x26634c['model'],_0x26634c['query']);_0x31e99b[_0x1ece('0x3b')]=_[_0x1ece('0x3a')](_0x26634c['model'],qs['fields'](_0x55988d[_0x1ece('0x37')][_0x1ece('0x3c')]));_0x31e99b['attributes']=_0x31e99b['attributes'][_0x1ece('0x3d')]?_0x31e99b[_0x1ece('0x3b')]:_0x26634c[_0x1ece('0x36')];if(!_0x55988d[_0x1ece('0x37')][_0x1ece('0x3e')](_0x1ece('0x3f'))){_0x31e99b[_0x1ece('0x23')]=qs[_0x1ece('0x23')](_0x55988d[_0x1ece('0x37')]['limit']);_0x31e99b['offset']=qs[_0x1ece('0x21')](_0x55988d[_0x1ece('0x37')][_0x1ece('0x21')]);}_0x31e99b[_0x1ece('0x40')]=qs[_0x1ece('0x41')](_0x55988d[_0x1ece('0x37')][_0x1ece('0x41')]);_0x31e99b[_0x1ece('0x42')]=qs['filters'](_[_0x1ece('0x43')](_0x55988d[_0x1ece('0x37')],_0x26634c['filters']),_0x6c7a09);if(_0x55988d[_0x1ece('0x37')][_0x1ece('0x44')]){_0x31e99b['where']=_[_0x1ece('0x45')](_0x31e99b[_0x1ece('0x42')],{'$or':_['map'](_0x6c7a09,function(_0x1a2e85){if(_0x1a2e85[_0x1ece('0x46')]!=='VIRTUAL'){var _0x1aebfb={};_0x1aebfb[_0x1a2e85[_0x1ece('0x30')]]={'$like':'%'+_0x55988d[_0x1ece('0x37')][_0x1ece('0x44')]+'%'};return _0x1aebfb;}})});}_0x31e99b=_[_0x1ece('0x45')]({},_0x31e99b,_0x55988d[_0x1ece('0x47')]);var _0x141301={'where':_0x31e99b['where']};return db[_0x1ece('0x48')][_0x1ece('0x24')](_0x141301)[_0x1ece('0x2b')](function(_0x4bd2c1){_0x44b1b3[_0x1ece('0x24')]=_0x4bd2c1;if(_0x55988d[_0x1ece('0x37')][_0x1ece('0x49')]){_0x31e99b[_0x1ece('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x1ece('0x4b')](_0x31e99b);})['then'](function(_0x54413a){_0x44b1b3[_0x1ece('0x4c')]=_0x54413a;return _0x44b1b3;})[_0x1ece('0x2b')](respondWithFilteredResult(_0x4ed723,_0x31e99b))['catch'](handleError(_0x4ed723,null));};exports[_0x1ece('0x4d')]=function(_0x134473,_0x4b19ad){var _0x116912={'raw':![],'where':{'id':_0x134473[_0x1ece('0x4e')]['id']}},_0x57f107={};_0x57f107[_0x1ece('0x36')]=_['keys'](db['VoiceQueueReport'][_0x1ece('0x34')]);_0x57f107[_0x1ece('0x37')]=_[_0x1ece('0x38')](_0x134473['query']);_0x57f107['filters']=_[_0x1ece('0x3a')](_0x57f107[_0x1ece('0x36')],_0x57f107[_0x1ece('0x37')]);_0x116912[_0x1ece('0x3b')]=_[_0x1ece('0x3a')](_0x57f107[_0x1ece('0x36')],qs[_0x1ece('0x3c')](_0x134473[_0x1ece('0x37')][_0x1ece('0x3c')]));_0x116912[_0x1ece('0x3b')]=_0x116912[_0x1ece('0x3b')][_0x1ece('0x3d')]?_0x116912['attributes']:_0x57f107['model'];if(_0x134473[_0x1ece('0x37')][_0x1ece('0x49')]){_0x116912[_0x1ece('0x4a')]=[{'all':!![]}];}_0x116912=_['merge']({},_0x116912,_0x134473['options']);return db[_0x1ece('0x48')][_0x1ece('0x4f')](_0x116912)[_0x1ece('0x2b')](handleEntityNotFound(_0x4b19ad,null))['then'](respondWithResult(_0x4b19ad,null))[_0x1ece('0x50')](handleError(_0x4b19ad,null));};exports['create']=function(_0x24f01c,_0x1ec49){return db[_0x1ece('0x48')][_0x1ece('0x51')](_0x24f01c[_0x1ece('0x52')],{})[_0x1ece('0x2b')](respondWithResult(_0x1ec49,0xc9))[_0x1ece('0x50')](handleError(_0x1ec49,null));};exports['update']=function(_0x1b2737,_0x1374ea){if(_0x1b2737['body']['id']){delete _0x1b2737[_0x1ece('0x52')]['id'];}return db[_0x1ece('0x48')]['find']({'where':{'id':_0x1b2737['params']['id']}})[_0x1ece('0x2b')](handleEntityNotFound(_0x1374ea,null))[_0x1ece('0x2b')](saveUpdates(_0x1b2737['body'],null))[_0x1ece('0x2b')](respondWithResult(_0x1374ea,null))[_0x1ece('0x50')](handleError(_0x1374ea,null));};exports[_0x1ece('0x2c')]=function(_0x5f1fbb,_0x2d487e){return db[_0x1ece('0x48')][_0x1ece('0x4f')]({'where':{'id':_0x5f1fbb['params']['id']}})[_0x1ece('0x2b')](handleEntityNotFound(_0x2d487e,null))[_0x1ece('0x2b')](removeEntity(_0x2d487e,null))['catch'](handleError(_0x2d487e,null));};exports[_0x1ece('0x53')]=function(_0x5a0245,_0x5c87b4){return db['VoiceQueueReport']['describe']()['then'](respondWithResult(_0x5c87b4,null))[_0x1ece('0x50')](handleError(_0x5c87b4,null));};exports[_0x1ece('0x54')]=function(_0x265c2e,_0x25b3b9){var _0x1aed47={},_0x5e4672={},_0x2f5655={'count':0x0,'rows':[]};_0x5e4672[_0x1ece('0x36')]=_[_0x1ece('0x38')](db[_0x1ece('0x48')][_0x1ece('0x34')]);_0x5e4672[_0x1ece('0x37')]=_['keys'](_0x265c2e[_0x1ece('0x37')]);_0x5e4672['filters']=_[_0x1ece('0x3a')](_0x5e4672[_0x1ece('0x36')],_0x5e4672[_0x1ece('0x37')]);_0x1aed47[_0x1ece('0x3b')]=_[_0x1ece('0x3a')](_0x5e4672['model'],qs[_0x1ece('0x3c')](_0x265c2e[_0x1ece('0x37')][_0x1ece('0x3c')]));_0x1aed47[_0x1ece('0x3b')]=_0x1aed47[_0x1ece('0x3b')][_0x1ece('0x3d')]?_0x1aed47[_0x1ece('0x3b')]:_0x5e4672[_0x1ece('0x36')];if(!_0x265c2e['query']['hasOwnProperty'](_0x1ece('0x3f'))){_0x1aed47[_0x1ece('0x23')]=qs[_0x1ece('0x23')](_0x265c2e[_0x1ece('0x37')][_0x1ece('0x23')]);_0x1aed47[_0x1ece('0x21')]=qs[_0x1ece('0x21')](_0x265c2e[_0x1ece('0x37')][_0x1ece('0x21')]);}_0x1aed47[_0x1ece('0x40')]=qs[_0x1ece('0x41')](_0x265c2e[_0x1ece('0x37')][_0x1ece('0x41')]);_0x1aed47[_0x1ece('0x42')]=qs[_0x1ece('0x39')](_['pick'](_0x265c2e[_0x1ece('0x37')],_0x5e4672[_0x1ece('0x39')]));if(_0x265c2e['query']['filter']){_0x1aed47['where']=_[_0x1ece('0x45')](_0x1aed47[_0x1ece('0x42')],{'$or':_[_0x1ece('0x33')](_0x1aed47[_0x1ece('0x3b')],function(_0xd80f4a){var _0x15a3a8={};_0x15a3a8[_0xd80f4a]={'$like':'%'+_0x265c2e[_0x1ece('0x37')][_0x1ece('0x44')]+'%'};return _0x15a3a8;})});}_0x1aed47=_['merge']({},_0x1aed47,_0x265c2e[_0x1ece('0x47')]);var _0x38a4a2={'where':_0x1aed47['where']};return db[_0x1ece('0x48')][_0x1ece('0x24')](_0x38a4a2)[_0x1ece('0x2b')](function(_0x4fe660){_0x2f5655[_0x1ece('0x24')]=_0x4fe660;if(_0x265c2e[_0x1ece('0x37')][_0x1ece('0x49')]){_0x1aed47['include']=[{'all':!![]}];}return db[_0x1ece('0x48')][_0x1ece('0x4b')](_0x1aed47);})[_0x1ece('0x2b')](function(_0x44cb04){_0x2f5655['rows']=_0x44cb04;return _0x2f5655;})[_0x1ece('0x2b')](respondWithFilteredResult(_0x25b3b9,_0x1aed47,_0x1ece('0x54')))[_0x1ece('0x50')](handleError(_0x25b3b9,null,_0x1ece('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 2f29d2b..a2b1f33 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 _0x4ef5=['setMaxListeners','save','emit','exports','events','../../mysqldb'];(function(_0x256575,_0x4246f6){var _0x20f83b=function(_0x301629){while(--_0x301629){_0x256575['push'](_0x256575['shift']());}};_0x20f83b(++_0x4246f6);}(_0x4ef5,0x136));var _0x54ef=function(_0x52e084,_0xb03409){_0x52e084=_0x52e084-0x0;var _0x3ec9e5=_0x4ef5[_0x52e084];return _0x3ec9e5;};'use strict';var EventEmitter=require(_0x54ef('0x0'));var VoiceQueueReport=require(_0x54ef('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x54ef('0x2')](0x0);var events={'afterCreate':_0x54ef('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3a3a50){return function(_0x33adbf,_0x2779e0,_0x5e7e2c){VoiceQueueReportEvents[_0x54ef('0x4')](_0x3a3a50+':'+_0x33adbf['id'],_0x33adbf);VoiceQueueReportEvents[_0x54ef('0x4')](_0x3a3a50,_0x33adbf);_0x5e7e2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x54ef('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xa75b=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x365c0a,_0x26dcb7){var _0x19e3e7=function(_0xe2a28a){while(--_0xe2a28a){_0x365c0a['push'](_0x365c0a['shift']());}};_0x19e3e7(++_0x26dcb7);}(_0xa75b,0x100));var _0xba75=function(_0x1141c0,_0x141b75){_0x1141c0=_0x1141c0-0x0;var _0x333b96=_0xa75b[_0x1141c0];return _0x333b96;};'use strict';var EventEmitter=require(_0xba75('0x0'));var VoiceQueueReport=require(_0xba75('0x1'))['db'][_0xba75('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xba75('0x3')](0x0);var events={'afterCreate':_0xba75('0x4'),'afterUpdate':_0xba75('0x5'),'afterDestroy':_0xba75('0x6')};function emitEvent(_0x275286){return function(_0xcc73be,_0x522714,_0xa1c738){VoiceQueueReportEvents['emit'](_0x275286+':'+_0xcc73be['id'],_0xcc73be);VoiceQueueReportEvents[_0xba75('0x7')](_0x275286,_0xcc73be);_0xa1c738(null);};}for(var e in events){if(events[_0xba75('0x8')](e)){var event=events[e];VoiceQueueReport[_0xba75('0x9')](e,emitEvent(event));}}module[_0xba75('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 62ec2a8..2a286d5 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 _0xbbb4=['bluebird','path','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','api','moment'];(function(_0x4147e6,_0x57174e){var _0x3305ba=function(_0x30199e){while(--_0x30199e){_0x4147e6['push'](_0x4147e6['shift']());}};_0x3305ba(++_0x57174e);}(_0xbbb4,0xd9));var _0x4bbb=function(_0x54edd5,_0x128ad3){_0x54edd5=_0x54edd5-0x0;var _0x4be75e=_0xbbb4[_0x54edd5];return _0x4be75e;};'use strict';var _=require('lodash');var util=require(_0x4bbb('0x0'));var logger=require(_0x4bbb('0x1'))(_0x4bbb('0x2'));var moment=require(_0x4bbb('0x3'));var BPromise=require(_0x4bbb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bbb('0x5'));var rimraf=require('rimraf');var config=require(_0x4bbb('0x6'));var attributes=require(_0x4bbb('0x7'));module[_0x4bbb('0x8')]=function(_0x5e9626,_0xe5c467){return _0x5e9626[_0x4bbb('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x4bbb('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4bbb('0xb')]},{'fields':[_0x4bbb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b15=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3b15,0x1e1));var _0x53b1=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x3b15[_0x339129];return _0x1570df;};'use strict';var _=require(_0x53b1('0x0'));var util=require(_0x53b1('0x1'));var logger=require('../../config/logger')(_0x53b1('0x2'));var moment=require(_0x53b1('0x3'));var BPromise=require(_0x53b1('0x4'));var rp=require(_0x53b1('0x5'));var fs=require('fs');var path=require(_0x53b1('0x6'));var rimraf=require('rimraf');var config=require(_0x53b1('0x7'));var attributes=require(_0x53b1('0x8'));module['exports']=function(_0x14a34c,_0x3302a4){return _0x14a34c[_0x53b1('0x9')](_0x53b1('0xa'),attributes,{'tableName':_0x53b1('0xb'),'paranoid':![],'indexes':[{'fields':[_0x53b1('0xc')]},{'fields':[_0x53b1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index cbe940d..87f5f5d 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 _0xaea9=['result','catch','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message'];(function(_0x492120,_0x3f6f33){var _0x2169af=function(_0x4665b8){while(--_0x4665b8){_0x492120['push'](_0x492120['shift']());}};_0x2169af(++_0x3f6f33);}(_0xaea9,0x1a6));var _0x9aea=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xaea9[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x9aea('0x0'));var util=require(_0x9aea('0x1'));var moment=require(_0x9aea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9aea('0x3'));var db=require(_0x9aea('0x4'))['db'];var utils=require(_0x9aea('0x5'));var logger=require(_0x9aea('0x6'))(_0x9aea('0x7'));var config=require(_0x9aea('0x8'));var jayson=require(_0x9aea('0x9'));var client=jayson[_0x9aea('0xa')][_0x9aea('0xb')]({'port':0x232a});config[_0x9aea('0xc')]=_[_0x9aea('0xd')](config[_0x9aea('0xc')],{'host':_0x9aea('0xe'),'port':0x18eb});var socket=require(_0x9aea('0xf'))(new Redis(config[_0x9aea('0xc')]));require(_0x9aea('0x10'))[_0x9aea('0x11')](socket);function respondWithRpcPromise(_0x1294fd,_0x567dfa,_0x1d80d3){return new BPromise(function(_0x15ab32,_0x58117e){return client[_0x9aea('0x12')](_0x1294fd,_0x1d80d3)[_0x9aea('0x13')](function(_0x43767e){logger[_0x9aea('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x567dfa,_0x9aea('0x15'));logger[_0x9aea('0x16')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x567dfa,'request\x20sent',JSON[_0x9aea('0x17')](_0x43767e));if(_0x43767e[_0x9aea('0x18')]){if(_0x43767e[_0x9aea('0x18')][_0x9aea('0x19')]===0x1f4){logger['error'](_0x9aea('0x1a'),_0x567dfa,_0x43767e['error'][_0x9aea('0x1b')]);return _0x58117e(_0x43767e[_0x9aea('0x18')][_0x9aea('0x1b')]);}logger[_0x9aea('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x567dfa,_0x43767e['error'][_0x9aea('0x1b')]);return _0x15ab32(_0x43767e[_0x9aea('0x18')]['message']);}else{logger[_0x9aea('0x14')](_0x9aea('0x1a'),_0x567dfa,_0x9aea('0x15'));_0x15ab32(_0x43767e[_0x9aea('0x1c')][_0x9aea('0x1b')]);}})[_0x9aea('0x1d')](function(_0x4c2b76){logger[_0x9aea('0x18')](_0x9aea('0x1a'),_0x567dfa,_0x4c2b76);_0x58117e(_0x4c2b76);});});}exports['GetVoiceQueueReport']=function(_0x288a66){var _0x24b012=this;return new Promise(function(_0x59d23d,_0x451f7f){return db[_0x9aea('0x1e')][_0x9aea('0x1f')]({'raw':_0x288a66[_0x9aea('0x20')]?_0x288a66[_0x9aea('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x288a66['options']?_0x288a66['options'][_0x9aea('0x21')]||null:null,'attributes':_0x288a66['options']?_0x288a66[_0x9aea('0x20')][_0x9aea('0x22')]||null:null,'limit':_0x288a66[_0x9aea('0x20')]?_0x288a66['options'][_0x9aea('0x23')]||null:null,'include':_0x288a66[_0x9aea('0x20')]?_0x288a66['options'][_0x9aea('0x24')]?_[_0x9aea('0x25')](_0x288a66[_0x9aea('0x20')]['include'],function(_0x15860f){return{'model':db[_0x15860f[_0x9aea('0x26')]],'as':_0x15860f['as'],'attributes':_0x15860f[_0x9aea('0x22')],'include':_0x15860f['include']?_['map'](_0x15860f[_0x9aea('0x24')],function(_0x236bd8){return{'model':db[_0x236bd8[_0x9aea('0x26')]],'as':_0x236bd8['as'],'attributes':_0x236bd8[_0x9aea('0x22')],'include':_0x236bd8['include']?_[_0x9aea('0x25')](_0x236bd8[_0x9aea('0x24')],function(_0x3adb26){return{'model':db[_0x3adb26[_0x9aea('0x26')]],'as':_0x3adb26['as'],'attributes':_0x3adb26[_0x9aea('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9aea('0x13')](function(_0x4a1ce6){logger[_0x9aea('0x14')]('GetVoiceQueueReport',_0x288a66);logger['debug'](_0x9aea('0x27'),_0x288a66,JSON[_0x9aea('0x17')](_0x4a1ce6));_0x59d23d(_0x4a1ce6);})['catch'](function(_0x3973ee){logger[_0x9aea('0x18')](_0x9aea('0x27'),_0x3973ee[_0x9aea('0x1b')],_0x288a66);_0x451f7f(_0x24b012[_0x9aea('0x18')](0x1f4,_0x3973ee['message']));});});};exports[_0x9aea('0x28')]=function(_0x4a78f6){var _0x45b334=this;return new Promise(function(_0x4bd6d1,_0x2c01ff){return db[_0x9aea('0x1e')][_0x9aea('0x29')](_0x4a78f6[_0x9aea('0x2a')],{'raw':_0x4a78f6['options']?_0x4a78f6[_0x9aea('0x20')][_0x9aea('0x2b')]===undefined?!![]:![]:!![]})['then'](function(_0x4646a7){logger[_0x9aea('0x14')](_0x9aea('0x28'),_0x4a78f6);logger[_0x9aea('0x16')](_0x9aea('0x28'),_0x4a78f6,JSON[_0x9aea('0x17')](_0x4646a7));_0x4bd6d1(_0x4646a7);})['catch'](function(_0x26a631){logger['error'](_0x9aea('0x28'),_0x26a631['message'],_0x4a78f6);_0x2c01ff(_0x45b334[_0x9aea('0x18')](0x1f4,_0x26a631[_0x9aea('0x1b')]));});});};exports[_0x9aea('0x2c')]=function(_0x129a33){var _0x2f9b78=this;return new Promise(function(_0x1b4df7,_0x49345c){return db[_0x9aea('0x1e')]['update'](_0x129a33[_0x9aea('0x2a')],{'raw':_0x129a33[_0x9aea('0x20')]?_0x129a33[_0x9aea('0x20')][_0x9aea('0x2b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x129a33[_0x9aea('0x20')]?_0x129a33[_0x9aea('0x20')]['where']||null:null,'attributes':_0x129a33[_0x9aea('0x20')]?_0x129a33['options'][_0x9aea('0x22')]||null:null,'limit':_0x129a33[_0x9aea('0x20')]?_0x129a33[_0x9aea('0x20')]['limit']||null:null})['then'](function(_0x753415){logger[_0x9aea('0x14')](_0x9aea('0x2c'),_0x129a33);logger[_0x9aea('0x16')](_0x9aea('0x2c'),_0x129a33,JSON[_0x9aea('0x17')](_0x753415));_0x1b4df7(_0x753415);})[_0x9aea('0x1d')](function(_0x25ce8f){logger[_0x9aea('0x18')]('UpdateVoiceQueueReport',_0x25ce8f['message'],_0x129a33);_0x49345c(_0x2f9b78['error'](0x1f4,_0x25ce8f[_0x9aea('0x1b')]));});});}; \ No newline at end of file +var _0x5c5b=['defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','map','include','model','attributes','debug','stringify','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','body','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x18f88c,_0x2fed0f){var _0x576492=function(_0x557349){while(--_0x557349){_0x18f88c['push'](_0x18f88c['shift']());}};_0x576492(++_0x2fed0f);}(_0x5c5b,0xdd));var _0xb5c5=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x5c5b[_0x416cdc];return _0x1931ce;};'use strict';var _=require(_0xb5c5('0x0'));var util=require(_0xb5c5('0x1'));var moment=require(_0xb5c5('0x2'));var BPromise=require(_0xb5c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5c5('0x4'));var db=require(_0xb5c5('0x5'))['db'];var utils=require(_0xb5c5('0x6'));var logger=require(_0xb5c5('0x7'))(_0xb5c5('0x8'));var config=require(_0xb5c5('0x9'));var jayson=require(_0xb5c5('0xa'));var client=jayson[_0xb5c5('0xb')][_0xb5c5('0xc')]({'port':0x232a});config[_0xb5c5('0xd')]=_[_0xb5c5('0xe')](config['redis'],{'host':_0xb5c5('0xf'),'port':0x18eb});var socket=require(_0xb5c5('0x10'))(new Redis(config[_0xb5c5('0xd')]));require(_0xb5c5('0x11'))[_0xb5c5('0x12')](socket);function respondWithRpcPromise(_0x529de1,_0x3482ce,_0x2d2e64){return new BPromise(function(_0x40c3f5,_0x364db9){return client[_0xb5c5('0x13')](_0x529de1,_0x2d2e64)[_0xb5c5('0x14')](function(_0x282af2){logger[_0xb5c5('0x15')](_0xb5c5('0x16'),_0x3482ce,_0xb5c5('0x17'));logger['debug'](_0xb5c5('0x18'),_0x3482ce,_0xb5c5('0x17'),JSON['stringify'](_0x282af2));if(_0x282af2[_0xb5c5('0x19')]){if(_0x282af2[_0xb5c5('0x19')][_0xb5c5('0x1a')]===0x1f4){logger[_0xb5c5('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x3482ce,_0x282af2[_0xb5c5('0x19')][_0xb5c5('0x1b')]);return _0x364db9(_0x282af2[_0xb5c5('0x19')][_0xb5c5('0x1b')]);}logger['error'](_0xb5c5('0x16'),_0x3482ce,_0x282af2['error'][_0xb5c5('0x1b')]);return _0x40c3f5(_0x282af2[_0xb5c5('0x19')][_0xb5c5('0x1b')]);}else{logger[_0xb5c5('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x3482ce,_0xb5c5('0x17'));_0x40c3f5(_0x282af2[_0xb5c5('0x1c')][_0xb5c5('0x1b')]);}})[_0xb5c5('0x1d')](function(_0x17bc48){logger[_0xb5c5('0x19')](_0xb5c5('0x16'),_0x3482ce,_0x17bc48);_0x364db9(_0x17bc48);});});}exports[_0xb5c5('0x1e')]=function(_0x46d3f8){var _0x15d8de=this;return new Promise(function(_0x215f92,_0x232d73){return db[_0xb5c5('0x1f')][_0xb5c5('0x20')]({'raw':_0x46d3f8[_0xb5c5('0x21')]?_0x46d3f8[_0xb5c5('0x21')][_0xb5c5('0x22')]===undefined?!![]:![]:!![],'where':_0x46d3f8[_0xb5c5('0x21')]?_0x46d3f8[_0xb5c5('0x21')][_0xb5c5('0x23')]||null:null,'attributes':_0x46d3f8[_0xb5c5('0x21')]?_0x46d3f8[_0xb5c5('0x21')]['attributes']||null:null,'limit':_0x46d3f8[_0xb5c5('0x21')]?_0x46d3f8['options']['limit']||null:null,'include':_0x46d3f8[_0xb5c5('0x21')]?_0x46d3f8[_0xb5c5('0x21')]['include']?_[_0xb5c5('0x24')](_0x46d3f8[_0xb5c5('0x21')][_0xb5c5('0x25')],function(_0x278460){return{'model':db[_0x278460['model']],'as':_0x278460['as'],'attributes':_0x278460['attributes'],'include':_0x278460[_0xb5c5('0x25')]?_[_0xb5c5('0x24')](_0x278460[_0xb5c5('0x25')],function(_0x50126){return{'model':db[_0x50126[_0xb5c5('0x26')]],'as':_0x50126['as'],'attributes':_0x50126[_0xb5c5('0x27')],'include':_0x50126[_0xb5c5('0x25')]?_[_0xb5c5('0x24')](_0x50126[_0xb5c5('0x25')],function(_0x4f0a59){return{'model':db[_0x4f0a59[_0xb5c5('0x26')]],'as':_0x4f0a59['as'],'attributes':_0x4f0a59[_0xb5c5('0x27')]};}):[]};}):[]};}):[]:[]})[_0xb5c5('0x14')](function(_0xfb2b14){logger[_0xb5c5('0x15')]('GetVoiceQueueReport',_0x46d3f8);logger[_0xb5c5('0x28')](_0xb5c5('0x1e'),_0x46d3f8,JSON[_0xb5c5('0x29')](_0xfb2b14));_0x215f92(_0xfb2b14);})[_0xb5c5('0x1d')](function(_0x5c32e0){logger[_0xb5c5('0x19')](_0xb5c5('0x1e'),_0x5c32e0[_0xb5c5('0x1b')],_0x46d3f8);_0x232d73(_0x15d8de[_0xb5c5('0x19')](0x1f4,_0x5c32e0[_0xb5c5('0x1b')]));});});};exports[_0xb5c5('0x2a')]=function(_0x1519f0){var _0x42671b=this;return new Promise(function(_0x451565,_0x5c3eab){return db[_0xb5c5('0x1f')][_0xb5c5('0x2b')](_0x1519f0['body'],{'raw':_0x1519f0['options']?_0x1519f0[_0xb5c5('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xb5c5('0x14')](function(_0x51d263){logger[_0xb5c5('0x15')](_0xb5c5('0x2a'),_0x1519f0);logger[_0xb5c5('0x28')](_0xb5c5('0x2a'),_0x1519f0,JSON[_0xb5c5('0x29')](_0x51d263));_0x451565(_0x51d263);})[_0xb5c5('0x1d')](function(_0x18f2c9){logger[_0xb5c5('0x19')](_0xb5c5('0x2a'),_0x18f2c9[_0xb5c5('0x1b')],_0x1519f0);_0x5c3eab(_0x42671b[_0xb5c5('0x19')](0x1f4,_0x18f2c9[_0xb5c5('0x1b')]));});});};exports[_0xb5c5('0x2c')]=function(_0x6a71c0){var _0x319de9=this;return new Promise(function(_0x123f1f,_0x114be1){return db[_0xb5c5('0x1f')]['update'](_0x6a71c0[_0xb5c5('0x2d')],{'raw':_0x6a71c0['options']?_0x6a71c0[_0xb5c5('0x21')][_0xb5c5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a71c0[_0xb5c5('0x21')]?_0x6a71c0['options']['where']||null:null,'attributes':_0x6a71c0[_0xb5c5('0x21')]?_0x6a71c0['options'][_0xb5c5('0x27')]||null:null,'limit':_0x6a71c0[_0xb5c5('0x21')]?_0x6a71c0[_0xb5c5('0x21')][_0xb5c5('0x2e')]||null:null})[_0xb5c5('0x14')](function(_0x273cff){logger['info'](_0xb5c5('0x2c'),_0x6a71c0);logger[_0xb5c5('0x28')](_0xb5c5('0x2c'),_0x6a71c0,JSON[_0xb5c5('0x29')](_0x273cff));_0x123f1f(_0x273cff);})[_0xb5c5('0x1d')](function(_0xee30fa){logger[_0xb5c5('0x19')](_0xb5c5('0x2c'),_0xee30fa['message'],_0x6a71c0);_0x114be1(_0x319de9[_0xb5c5('0x19')](0x1f4,_0xee30fa['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ae72e81..1a5ab9b 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 _0x2dd3=['register','length','save','remove','update','removeListener'];(function(_0x368ad3,_0x5e2750){var _0x434cd4=function(_0x3a8930){while(--_0x3a8930){_0x368ad3['push'](_0x368ad3['shift']());}};_0x434cd4(++_0x5e2750);}(_0x2dd3,0x6e));var _0x32dd=function(_0x31a661,_0x461b02){_0x31a661=_0x31a661-0x0;var _0x57de81=_0x2dd3[_0x31a661];return _0x57de81;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x32dd('0x0'),_0x32dd('0x1'),_0x32dd('0x2')];function createListener(_0xace4c9,_0x3541d7){return function(_0x346cb1){_0x3541d7['emit'](_0xace4c9,_0x346cb1);};}function removeListener(_0x36e50d,_0x144ee4){return function(){VoiceQueueReportEvents[_0x32dd('0x3')](_0x36e50d,_0x144ee4);};}exports[_0x32dd('0x4')]=function(_0x15aa74){for(var _0x2ca4f9=0x0,_0x3f65d9=events[_0x32dd('0x5')];_0x2ca4f9<_0x3f65d9;_0x2ca4f9++){var _0xbee4fe=events[_0x2ca4f9];var _0x174720=createListener('voiceQueueReport:'+_0xbee4fe,_0x15aa74);VoiceQueueReportEvents['on'](_0xbee4fe,_0x174720);}}; \ No newline at end of file +var _0x121d=['register','length','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x1e5ab2,_0x508296){var _0x564ee8=function(_0x43fc3a){while(--_0x43fc3a){_0x1e5ab2['push'](_0x1e5ab2['shift']());}};_0x564ee8(++_0x508296);}(_0x121d,0xea));var _0xd121=function(_0x586b2b,_0xa097d6){_0x586b2b=_0x586b2b-0x0;var _0x5471e1=_0x121d[_0x586b2b];return _0x5471e1;};'use strict';var VoiceQueueReportEvents=require(_0xd121('0x0'));var events=[_0xd121('0x1'),_0xd121('0x2'),_0xd121('0x3')];function createListener(_0x16ed51,_0x40e506){return function(_0x233726){_0x40e506[_0xd121('0x4')](_0x16ed51,_0x233726);};}function removeListener(_0x20a687,_0x349fc5){return function(){VoiceQueueReportEvents[_0xd121('0x5')](_0x20a687,_0x349fc5);};}exports[_0xd121('0x6')]=function(_0x2b2f41){for(var _0x31c727=0x0,_0x540cf2=events[_0xd121('0x7')];_0x31c727<_0x540cf2;_0x31c727++){var _0x5b67f7=events[_0x31c727];var _0x1da01c=createListener('voiceQueueReport:'+_0x5b67f7,_0x2b2f41);VoiceQueueReportEvents['on'](_0x5b67f7,_0x1da01c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0e23823..c58f2aa 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 _0x9c44=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x37d239,_0x9890dc){var _0x219891=function(_0xff7ebb){while(--_0xff7ebb){_0x37d239['push'](_0x37d239['shift']());}};_0x219891(++_0x9890dc);}(_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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0xb')]('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xf')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2cb4=['fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x2cb4,0x13e));var _0x42cb=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0x2cb4[_0x21f9c2];return _0x3da17f;};'use strict';var multer=require(_0x42cb('0x0'));var util=require(_0x42cb('0x1'));var path=require(_0x42cb('0x2'));var timeout=require(_0x42cb('0x3'));var express=require(_0x42cb('0x4'));var router=express[_0x42cb('0x5')]();var fs_extra=require(_0x42cb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x42cb('0x7'));var config=require(_0x42cb('0x8'));var controller=require(_0x42cb('0x9'));router[_0x42cb('0xa')]('/',auth[_0x42cb('0xb')](),controller['index']);router[_0x42cb('0xa')](_0x42cb('0xc'),auth[_0x42cb('0xb')](),controller[_0x42cb('0xd')]);router['post']('/',auth[_0x42cb('0xb')](),controller[_0x42cb('0xe')]);router[_0x42cb('0xf')](_0x42cb('0xc'),auth[_0x42cb('0xb')](),controller[_0x42cb('0x10')]);router[_0x42cb('0x11')](_0x42cb('0xc'),auth[_0x42cb('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 5b9bf1a..bdb02f4 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 _0xaccf=['exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0xaccf,0x12b));var _0xfacc=function(_0x52599d,_0x28933d){_0x52599d=_0x52599d-0x0;var _0x161325=_0xaccf[_0x52599d];return _0x161325;};'use strict';var Sequelize=require(_0xfacc('0x0'));var moment=require('moment');module[_0xfacc('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xfacc('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfacc('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfacc('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfacc('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfacc('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfacc('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfacc('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfacc('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xfacc('0x4'))}}; \ No newline at end of file +var _0x7c61=['sequelize','moment','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x514b70,_0x33749e){var _0x50d83d=function(_0x4aa9ca){while(--_0x4aa9ca){_0x514b70['push'](_0x514b70['shift']());}};_0x50d83d(++_0x33749e);}(_0x7c61,0x10e));var _0x17c6=function(_0xc461d8,_0x37a5de){_0xc461d8=_0xc461d8-0x0;var _0xb1dd0d=_0x7c61[_0xc461d8];return _0xb1dd0d;};'use strict';var Sequelize=require(_0x17c6('0x0'));var moment=require(_0x17c6('0x1'));module['exports']={'time':{'type':Sequelize[_0x17c6('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x17c6('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x17c6('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x17c6('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x17c6('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x17c6('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x17c6('0x3')](_0x17c6('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 3ca38a2..1f453e8 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 _0x4298=['params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4298,0x1af));var _0x8429=function(_0x1b417b,_0x4fe863){_0x1b417b=_0x1b417b-0x0;var _0x5439cd=_0x4298[_0x1b417b];return _0x5439cd;};'use strict';var emlformat=require(_0x8429('0x0'));var rimraf=require(_0x8429('0x1'));var zipdir=require(_0x8429('0x2'));var jsonpatch=require(_0x8429('0x3'));var rp=require(_0x8429('0x4'));var moment=require(_0x8429('0x5'));var BPromise=require(_0x8429('0x6'));var Mustache=require('mustache');var util=require(_0x8429('0x7'));var path=require(_0x8429('0x8'));var sox=require('sox');var csv=require(_0x8429('0x9'));var ejs=require(_0x8429('0xa'));var fs=require('fs');var fs_extra=require(_0x8429('0xb'));var _=require(_0x8429('0xc'));var squel=require('squel');var crypto=require(_0x8429('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8429('0x9'));var querystring=require(_0x8429('0xe'));var Papa=require('papaparse');var Redis=require(_0x8429('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8429('0x10'));var logger=require(_0x8429('0x11'))(_0x8429('0x12'));var utils=require('../../config/utils');var config=require(_0x8429('0x13'));var licenseUtil=require(_0x8429('0x14'));var db=require(_0x8429('0x15'))['db'];function respondWithStatusCode(_0x540f55,_0x54fc02){_0x54fc02=_0x54fc02||0xcc;return function(_0x28c2f9){if(_0x28c2f9){return _0x540f55['sendStatus'](_0x54fc02);}return _0x540f55[_0x8429('0x16')](_0x54fc02)[_0x8429('0x17')]();};}function respondWithResult(_0x376240,_0x38f195){_0x38f195=_0x38f195||0xc8;return function(_0x208a43){if(_0x208a43){return _0x376240['status'](_0x38f195)[_0x8429('0x18')](_0x208a43);}};}function respondWithFilteredResult(_0xe9dbb7,_0x3f86c0){return function(_0x33f5a1){if(_0x33f5a1){var _0x5e7d32=typeof _0x3f86c0[_0x8429('0x19')]===_0x8429('0x1a')&&typeof _0x3f86c0[_0x8429('0x1b')]===_0x8429('0x1a');var _0x3184d9=_0x33f5a1[_0x8429('0x1c')];var _0x1279c6=_0x5e7d32?0x0:_0x3f86c0['offset'];var _0x221dd4=_0x5e7d32?_0x33f5a1[_0x8429('0x1c')]:_0x3f86c0['offset']+_0x3f86c0[_0x8429('0x1b')];var _0x459dbf;if(_0x221dd4>=_0x3184d9){_0x221dd4=_0x3184d9;_0x459dbf=0xc8;}else{_0x459dbf=0xce;}_0xe9dbb7[_0x8429('0x16')](_0x459dbf);return _0xe9dbb7[_0x8429('0x1d')]('Content-Range',_0x1279c6+'-'+_0x221dd4+'/'+_0x3184d9)[_0x8429('0x18')](_0x33f5a1);}return null;};}function patchUpdates(_0x1ebdb3){return function(_0x50ac94){try{jsonpatch[_0x8429('0x1e')](_0x50ac94,_0x1ebdb3,!![]);}catch(_0x504136){return BPromise[_0x8429('0x1f')](_0x504136);}return _0x50ac94[_0x8429('0x20')]();};}function saveUpdates(_0x457e01,_0x34cd6d){return function(_0x2bb238){if(_0x2bb238){return _0x2bb238[_0x8429('0x21')](_0x457e01)['then'](function(_0x11e6ab){return _0x11e6ab;});}return null;};}function removeEntity(_0x38addb,_0x25ad92){return function(_0x1ed7d3){if(_0x1ed7d3){return _0x1ed7d3[_0x8429('0x22')]()[_0x8429('0x23')](function(){_0x38addb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a8f1c,_0xde9714){return function(_0x253240){if(!_0x253240){_0x2a8f1c['sendStatus'](0x194);}return _0x253240;};}function handleError(_0x746532,_0x55e49a){_0x55e49a=_0x55e49a||0x1f4;return function(_0x5a8440){logger[_0x8429('0x24')](_0x5a8440[_0x8429('0x25')]);if(_0x5a8440[_0x8429('0x26')]){delete _0x5a8440['name'];}_0x746532['status'](_0x55e49a)[_0x8429('0x27')](_0x5a8440);};}exports[_0x8429('0x28')]=function(_0x1c25be,_0x5e6a1e){var _0x368a03={},_0x30094f={},_0x50ef03={'count':0x0,'rows':[]};var _0x3a6701=_[_0x8429('0x29')](db[_0x8429('0x2a')][_0x8429('0x2b')],function(_0x4a444d){return{'name':_0x4a444d[_0x8429('0x2c')],'type':_0x4a444d[_0x8429('0x2d')][_0x8429('0x2e')]};});_0x30094f[_0x8429('0x2f')]=_[_0x8429('0x29')](_0x3a6701,_0x8429('0x26'));_0x30094f[_0x8429('0x30')]=_['keys'](_0x1c25be[_0x8429('0x30')]);_0x30094f[_0x8429('0x31')]=_['intersection'](_0x30094f[_0x8429('0x2f')],_0x30094f[_0x8429('0x30')]);_0x368a03[_0x8429('0x32')]=_[_0x8429('0x33')](_0x30094f[_0x8429('0x2f')],qs[_0x8429('0x34')](_0x1c25be[_0x8429('0x30')][_0x8429('0x34')]));_0x368a03[_0x8429('0x32')]=_0x368a03[_0x8429('0x32')][_0x8429('0x35')]?_0x368a03['attributes']:_0x30094f['model'];if(!_0x1c25be['query']['hasOwnProperty'](_0x8429('0x36'))){_0x368a03['limit']=qs[_0x8429('0x1b')](_0x1c25be[_0x8429('0x30')][_0x8429('0x1b')]);_0x368a03[_0x8429('0x19')]=qs[_0x8429('0x19')](_0x1c25be[_0x8429('0x30')][_0x8429('0x19')]);}_0x368a03['order']=qs['sort'](_0x1c25be[_0x8429('0x30')][_0x8429('0x37')]);_0x368a03[_0x8429('0x38')]=qs[_0x8429('0x31')](_[_0x8429('0x39')](_0x1c25be[_0x8429('0x30')],_0x30094f[_0x8429('0x31')]),_0x3a6701);if(_0x1c25be[_0x8429('0x30')][_0x8429('0x3a')]){_0x368a03['where']=_[_0x8429('0x3b')](_0x368a03[_0x8429('0x38')],{'$or':_[_0x8429('0x29')](_0x3a6701,function(_0x40d0df){if(_0x40d0df[_0x8429('0x2d')]!==_0x8429('0x3c')){var _0x5457dd={};_0x5457dd[_0x40d0df[_0x8429('0x26')]]={'$like':'%'+_0x1c25be[_0x8429('0x30')][_0x8429('0x3a')]+'%'};return _0x5457dd;}})});}_0x368a03=_[_0x8429('0x3b')]({},_0x368a03,_0x1c25be[_0x8429('0x3d')]);var _0x3f892b={'where':_0x368a03[_0x8429('0x38')]};return db['VoiceQueuesLog'][_0x8429('0x1c')](_0x3f892b)[_0x8429('0x23')](function(_0x4d28e4){_0x50ef03['count']=_0x4d28e4;if(_0x1c25be['query']['includeAll']){_0x368a03[_0x8429('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x8429('0x3f')](_0x368a03);})[_0x8429('0x23')](function(_0x2d76c2){_0x50ef03[_0x8429('0x40')]=_0x2d76c2;return _0x50ef03;})['then'](respondWithFilteredResult(_0x5e6a1e,_0x368a03))[_0x8429('0x41')](handleError(_0x5e6a1e,null));};exports['show']=function(_0x48eb92,_0x46111b){var _0x4f1ca4={'raw':!![],'where':{'id':_0x48eb92[_0x8429('0x42')]['id']}},_0x23214a={};_0x23214a[_0x8429('0x2f')]=_['keys'](db['VoiceQueuesLog'][_0x8429('0x2b')]);_0x23214a['query']=_[_0x8429('0x43')](_0x48eb92[_0x8429('0x30')]);_0x23214a[_0x8429('0x31')]=_['intersection'](_0x23214a[_0x8429('0x2f')],_0x23214a[_0x8429('0x30')]);_0x4f1ca4[_0x8429('0x32')]=_[_0x8429('0x33')](_0x23214a[_0x8429('0x2f')],qs[_0x8429('0x34')](_0x48eb92['query'][_0x8429('0x34')]));_0x4f1ca4['attributes']=_0x4f1ca4[_0x8429('0x32')][_0x8429('0x35')]?_0x4f1ca4[_0x8429('0x32')]:_0x23214a[_0x8429('0x2f')];if(_0x48eb92[_0x8429('0x30')]['includeAll']){_0x4f1ca4[_0x8429('0x3e')]=[{'all':!![]}];}_0x4f1ca4=_['merge']({},_0x4f1ca4,_0x48eb92['options']);return db[_0x8429('0x2a')]['find'](_0x4f1ca4)[_0x8429('0x23')](handleEntityNotFound(_0x46111b,null))[_0x8429('0x23')](respondWithResult(_0x46111b,null))[_0x8429('0x41')](handleError(_0x46111b,null));};exports['create']=function(_0x1543b1,_0x1102fc){return db[_0x8429('0x2a')][_0x8429('0x44')](_0x1543b1[_0x8429('0x45')],{})[_0x8429('0x23')](respondWithResult(_0x1102fc,0xc9))[_0x8429('0x41')](handleError(_0x1102fc,null));};exports[_0x8429('0x21')]=function(_0x55147b,_0x40d193){if(_0x55147b['body']['id']){delete _0x55147b['body']['id'];}return db[_0x8429('0x2a')][_0x8429('0x46')]({'where':{'id':_0x55147b[_0x8429('0x42')]['id']}})[_0x8429('0x23')](handleEntityNotFound(_0x40d193,null))['then'](saveUpdates(_0x55147b[_0x8429('0x45')],null))['then'](respondWithResult(_0x40d193,null))[_0x8429('0x41')](handleError(_0x40d193,null));};exports['destroy']=function(_0x2a02e9,_0x5d9f90){return db[_0x8429('0x2a')]['find']({'where':{'id':_0x2a02e9[_0x8429('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d9f90,null))[_0x8429('0x23')](removeEntity(_0x5d9f90,null))['catch'](handleError(_0x5d9f90,null));}; \ No newline at end of file +var _0xcc3f=['sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','status','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueuesLog','then','includeAll','findAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1d94d1,_0x347bb8){var _0x23c397=function(_0x489441){while(--_0x489441){_0x1d94d1['push'](_0x1d94d1['shift']());}};_0x23c397(++_0x347bb8);}(_0xcc3f,0x15a));var _0xfcc3=function(_0x450296,_0x29fca9){_0x450296=_0x450296-0x0;var _0x1340e9=_0xcc3f[_0x450296];return _0x1340e9;};'use strict';var emlformat=require(_0xfcc3('0x0'));var rimraf=require(_0xfcc3('0x1'));var zipdir=require(_0xfcc3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfcc3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfcc3('0x4'));var util=require(_0xfcc3('0x5'));var path=require(_0xfcc3('0x6'));var sox=require(_0xfcc3('0x7'));var csv=require(_0xfcc3('0x8'));var ejs=require(_0xfcc3('0x9'));var fs=require('fs');var fs_extra=require(_0xfcc3('0xa'));var _=require(_0xfcc3('0xb'));var squel=require(_0xfcc3('0xc'));var crypto=require(_0xfcc3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfcc3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfcc3('0xf'));var Papa=require('papaparse');var Redis=require(_0xfcc3('0x10'));var authService=require(_0xfcc3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfcc3('0x12'));var hardwareService=require(_0xfcc3('0x13'));var logger=require(_0xfcc3('0x14'))(_0xfcc3('0x15'));var utils=require(_0xfcc3('0x16'));var config=require(_0xfcc3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19d5dc,_0x536de4){_0x536de4=_0x536de4||0xcc;return function(_0x42d176){if(_0x42d176){return _0x19d5dc[_0xfcc3('0x18')](_0x536de4);}return _0x19d5dc['status'](_0x536de4)[_0xfcc3('0x19')]();};}function respondWithResult(_0x3821b1,_0x372293){_0x372293=_0x372293||0xc8;return function(_0x4da62e){if(_0x4da62e){return _0x3821b1['status'](_0x372293)[_0xfcc3('0x1a')](_0x4da62e);}};}function respondWithFilteredResult(_0x2b14d0,_0x2b3ee4){return function(_0x2e2d79){if(_0x2e2d79){var _0x3c6931=typeof _0x2b3ee4[_0xfcc3('0x1b')]===_0xfcc3('0x1c')&&typeof _0x2b3ee4['limit']===_0xfcc3('0x1c');var _0x455e2e=_0x2e2d79[_0xfcc3('0x1d')];var _0xb01124=_0x3c6931?0x0:_0x2b3ee4['offset'];var _0x1792df=_0x3c6931?_0x2e2d79[_0xfcc3('0x1d')]:_0x2b3ee4['offset']+_0x2b3ee4[_0xfcc3('0x1e')];var _0x503ecf;if(_0x1792df>=_0x455e2e){_0x1792df=_0x455e2e;_0x503ecf=0xc8;}else{_0x503ecf=0xce;}_0x2b14d0['status'](_0x503ecf);return _0x2b14d0[_0xfcc3('0x1f')](_0xfcc3('0x20'),_0xb01124+'-'+_0x1792df+'/'+_0x455e2e)['json'](_0x2e2d79);}return null;};}function patchUpdates(_0x176fc9){return function(_0x3e2479){try{jsonpatch['apply'](_0x3e2479,_0x176fc9,!![]);}catch(_0x55f885){return BPromise['reject'](_0x55f885);}return _0x3e2479[_0xfcc3('0x21')]();};}function saveUpdates(_0x18b99e,_0x23c8b3){return function(_0x4f87bc){if(_0x4f87bc){return _0x4f87bc[_0xfcc3('0x22')](_0x18b99e)['then'](function(_0x1bcf4e){return _0x1bcf4e;});}return null;};}function removeEntity(_0x2d52fc,_0x348393){return function(_0x572602){if(_0x572602){return _0x572602[_0xfcc3('0x23')]()['then'](function(){_0x2d52fc[_0xfcc3('0x24')](0xcc)[_0xfcc3('0x19')]();});}};}function handleEntityNotFound(_0x1a3097,_0x4fc0bb){return function(_0x1f7281){if(!_0x1f7281){_0x1a3097[_0xfcc3('0x18')](0x194);}return _0x1f7281;};}function handleError(_0x115473,_0x16169e){_0x16169e=_0x16169e||0x1f4;return function(_0x224325){logger[_0xfcc3('0x25')](_0x224325['stack']);if(_0x224325[_0xfcc3('0x26')]){delete _0x224325[_0xfcc3('0x26')];}_0x115473['status'](_0x16169e)['send'](_0x224325);};}exports[_0xfcc3('0x27')]=function(_0x119f8e,_0x3fee16){var _0x104c1d={},_0xd6289b={},_0x3d58b7={'count':0x0,'rows':[]};var _0x4858d3=_[_0xfcc3('0x28')](db['VoiceQueuesLog'][_0xfcc3('0x29')],function(_0xc90d5f){return{'name':_0xc90d5f[_0xfcc3('0x2a')],'type':_0xc90d5f[_0xfcc3('0x2b')][_0xfcc3('0x2c')]};});_0xd6289b[_0xfcc3('0x2d')]=_[_0xfcc3('0x28')](_0x4858d3,_0xfcc3('0x26'));_0xd6289b[_0xfcc3('0x2e')]=_[_0xfcc3('0x2f')](_0x119f8e['query']);_0xd6289b[_0xfcc3('0x30')]=_[_0xfcc3('0x31')](_0xd6289b[_0xfcc3('0x2d')],_0xd6289b[_0xfcc3('0x2e')]);_0x104c1d[_0xfcc3('0x32')]=_['intersection'](_0xd6289b['model'],qs['fields'](_0x119f8e['query'][_0xfcc3('0x33')]));_0x104c1d[_0xfcc3('0x32')]=_0x104c1d['attributes'][_0xfcc3('0x34')]?_0x104c1d[_0xfcc3('0x32')]:_0xd6289b[_0xfcc3('0x2d')];if(!_0x119f8e[_0xfcc3('0x2e')][_0xfcc3('0x35')]('nolimit')){_0x104c1d['limit']=qs[_0xfcc3('0x1e')](_0x119f8e[_0xfcc3('0x2e')][_0xfcc3('0x1e')]);_0x104c1d[_0xfcc3('0x1b')]=qs[_0xfcc3('0x1b')](_0x119f8e[_0xfcc3('0x2e')][_0xfcc3('0x1b')]);}_0x104c1d[_0xfcc3('0x36')]=qs['sort'](_0x119f8e[_0xfcc3('0x2e')][_0xfcc3('0x37')]);_0x104c1d[_0xfcc3('0x38')]=qs['filters'](_[_0xfcc3('0x39')](_0x119f8e[_0xfcc3('0x2e')],_0xd6289b['filters']),_0x4858d3);if(_0x119f8e[_0xfcc3('0x2e')][_0xfcc3('0x3a')]){_0x104c1d[_0xfcc3('0x38')]=_[_0xfcc3('0x3b')](_0x104c1d[_0xfcc3('0x38')],{'$or':_[_0xfcc3('0x28')](_0x4858d3,function(_0x25a68c){if(_0x25a68c[_0xfcc3('0x2b')]!==_0xfcc3('0x3c')){var _0x22ba71={};_0x22ba71[_0x25a68c[_0xfcc3('0x26')]]={'$like':'%'+_0x119f8e[_0xfcc3('0x2e')][_0xfcc3('0x3a')]+'%'};return _0x22ba71;}})});}_0x104c1d=_[_0xfcc3('0x3b')]({},_0x104c1d,_0x119f8e[_0xfcc3('0x3d')]);var _0x5ee364={'where':_0x104c1d[_0xfcc3('0x38')]};return db[_0xfcc3('0x3e')][_0xfcc3('0x1d')](_0x5ee364)[_0xfcc3('0x3f')](function(_0x5a889f){_0x3d58b7[_0xfcc3('0x1d')]=_0x5a889f;if(_0x119f8e[_0xfcc3('0x2e')][_0xfcc3('0x40')]){_0x104c1d['include']=[{'all':!![]}];}return db[_0xfcc3('0x3e')][_0xfcc3('0x41')](_0x104c1d);})['then'](function(_0x5f196f){_0x3d58b7[_0xfcc3('0x42')]=_0x5f196f;return _0x3d58b7;})[_0xfcc3('0x3f')](respondWithFilteredResult(_0x3fee16,_0x104c1d))[_0xfcc3('0x43')](handleError(_0x3fee16,null));};exports[_0xfcc3('0x44')]=function(_0x20242a,_0x460149){var _0x4f9cd1={'raw':!![],'where':{'id':_0x20242a[_0xfcc3('0x45')]['id']}},_0x416b2d={};_0x416b2d[_0xfcc3('0x2d')]=_[_0xfcc3('0x2f')](db[_0xfcc3('0x3e')]['rawAttributes']);_0x416b2d[_0xfcc3('0x2e')]=_['keys'](_0x20242a[_0xfcc3('0x2e')]);_0x416b2d['filters']=_[_0xfcc3('0x31')](_0x416b2d['model'],_0x416b2d[_0xfcc3('0x2e')]);_0x4f9cd1[_0xfcc3('0x32')]=_[_0xfcc3('0x31')](_0x416b2d[_0xfcc3('0x2d')],qs['fields'](_0x20242a[_0xfcc3('0x2e')][_0xfcc3('0x33')]));_0x4f9cd1['attributes']=_0x4f9cd1[_0xfcc3('0x32')]['length']?_0x4f9cd1['attributes']:_0x416b2d['model'];if(_0x20242a[_0xfcc3('0x2e')][_0xfcc3('0x40')]){_0x4f9cd1[_0xfcc3('0x46')]=[{'all':!![]}];}_0x4f9cd1=_['merge']({},_0x4f9cd1,_0x20242a[_0xfcc3('0x3d')]);return db['VoiceQueuesLog']['find'](_0x4f9cd1)[_0xfcc3('0x3f')](handleEntityNotFound(_0x460149,null))[_0xfcc3('0x3f')](respondWithResult(_0x460149,null))['catch'](handleError(_0x460149,null));};exports[_0xfcc3('0x47')]=function(_0x688426,_0x465917){return db[_0xfcc3('0x3e')][_0xfcc3('0x47')](_0x688426[_0xfcc3('0x48')],{})[_0xfcc3('0x3f')](respondWithResult(_0x465917,0xc9))[_0xfcc3('0x43')](handleError(_0x465917,null));};exports[_0xfcc3('0x22')]=function(_0x52df99,_0x304ec3){if(_0x52df99['body']['id']){delete _0x52df99[_0xfcc3('0x48')]['id'];}return db[_0xfcc3('0x3e')][_0xfcc3('0x49')]({'where':{'id':_0x52df99[_0xfcc3('0x45')]['id']}})['then'](handleEntityNotFound(_0x304ec3,null))[_0xfcc3('0x3f')](saveUpdates(_0x52df99[_0xfcc3('0x48')],null))[_0xfcc3('0x3f')](respondWithResult(_0x304ec3,null))[_0xfcc3('0x43')](handleError(_0x304ec3,null));};exports[_0xfcc3('0x23')]=function(_0x5dc025,_0x21e678){return db[_0xfcc3('0x3e')][_0xfcc3('0x49')]({'where':{'id':_0x5dc025[_0xfcc3('0x45')]['id']}})[_0xfcc3('0x3f')](handleEntityNotFound(_0x21e678,null))[_0xfcc3('0x3f')](removeEntity(_0x21e678,null))[_0xfcc3('0x43')](handleError(_0x21e678,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 950aefc..c78ab30 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 _0x957f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','../../config/logger','api'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0x957f,0x1ed));var _0xf957=function(_0xea1570,_0x2f7856){_0xea1570=_0xea1570-0x0;var _0x579e74=_0x957f[_0xea1570];return _0x579e74;};'use strict';var _=require(_0xf957('0x0'));var util=require('util');var logger=require(_0xf957('0x1'))(_0xf957('0x2'));var moment=require(_0xf957('0x3'));var BPromise=require(_0xf957('0x4'));var rp=require(_0xf957('0x5'));var fs=require('fs');var path=require(_0xf957('0x6'));var rimraf=require(_0xf957('0x7'));var config=require(_0xf957('0x8'));var attributes=require(_0xf957('0x9'));module[_0xf957('0xa')]=function(_0x349b24,_0x9b5c1c){return _0x349b24[_0xf957('0xb')](_0xf957('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xf957('0xd'),'fields':[_0xf957('0xe'),_0xf957('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0e11=['../../config/logger','api','moment','request-promise','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x2e80f2,_0x4a8364){var _0x12ef3c=function(_0x21088d){while(--_0x21088d){_0x2e80f2['push'](_0x2e80f2['shift']());}};_0x12ef3c(++_0x4a8364);}(_0x0e11,0x16a));var _0x10e1=function(_0x1ba59d,_0x22ab1f){_0x1ba59d=_0x1ba59d-0x0;var _0x38c360=_0x0e11[_0x1ba59d];return _0x38c360;};'use strict';var _=require(_0x10e1('0x0'));var util=require(_0x10e1('0x1'));var logger=require(_0x10e1('0x2'))(_0x10e1('0x3'));var moment=require(_0x10e1('0x4'));var BPromise=require('bluebird');var rp=require(_0x10e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x10e1('0x6'));var attributes=require(_0x10e1('0x7'));module[_0x10e1('0x8')]=function(_0x1deff0,_0x38e95e){return _0x1deff0['define'](_0x10e1('0x9'),attributes,{'tableName':_0x10e1('0xa'),'paranoid':![],'indexes':[{'name':_0x10e1('0xb'),'fields':[_0x10e1('0xc'),_0x10e1('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3cea384..26fb11a 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 _0x43fd=['stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x2a3ca4,_0x39a7e8){var _0x374c52=function(_0x32c6b8){while(--_0x32c6b8){_0x2a3ca4['push'](_0x2a3ca4['shift']());}};_0x374c52(++_0x39a7e8);}(_0x43fd,0x150));var _0xd43f=function(_0x8794f7,_0x3961f9){_0x8794f7=_0x8794f7-0x0;var _0x43ef84=_0x43fd[_0x8794f7];return _0x43ef84;};'use strict';var _=require(_0xd43f('0x0'));var util=require(_0xd43f('0x1'));var moment=require('moment');var BPromise=require(_0xd43f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd43f('0x3'));var db=require(_0xd43f('0x4'))['db'];var utils=require(_0xd43f('0x5'));var logger=require(_0xd43f('0x6'))(_0xd43f('0x7'));var config=require(_0xd43f('0x8'));var jayson=require(_0xd43f('0x9'));var client=jayson[_0xd43f('0xa')][_0xd43f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2296e1,_0x907208,_0x2516ee){return new BPromise(function(_0x39a819,_0x44b1bf){return client['request'](_0x2296e1,_0x2516ee)[_0xd43f('0xc')](function(_0x43b9db){logger[_0xd43f('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x907208,_0xd43f('0xe'));logger[_0xd43f('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x907208,_0xd43f('0xe'),JSON[_0xd43f('0x10')](_0x43b9db));if(_0x43b9db[_0xd43f('0x11')]){if(_0x43b9db[_0xd43f('0x11')]['code']===0x1f4){logger['error'](_0xd43f('0x12'),_0x907208,_0x43b9db[_0xd43f('0x11')]['message']);return _0x44b1bf(_0x43b9db[_0xd43f('0x11')]['message']);}logger['error'](_0xd43f('0x12'),_0x907208,_0x43b9db[_0xd43f('0x11')]['message']);return _0x39a819(_0x43b9db[_0xd43f('0x11')][_0xd43f('0x13')]);}else{logger['info'](_0xd43f('0x12'),_0x907208,_0xd43f('0xe'));_0x39a819(_0x43b9db[_0xd43f('0x14')][_0xd43f('0x13')]);}})[_0xd43f('0x15')](function(_0x5d2f85){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x907208,_0x5d2f85);_0x44b1bf(_0x5d2f85);});});} \ No newline at end of file +var _0x7382=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','randomstring'];(function(_0x1b025e,_0x1ea348){var _0xa31d2=function(_0x3461e3){while(--_0x3461e3){_0x1b025e['push'](_0x1b025e['shift']());}};_0xa31d2(++_0x1ea348);}(_0x7382,0x1f2));var _0x2738=function(_0x2b8a35,_0x1d9de5){_0x2b8a35=_0x2b8a35-0x0;var _0x494366=_0x7382[_0x2b8a35];return _0x494366;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2738('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2738('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2738('0x3'))(_0x2738('0x4'));var config=require('../../config/environment');var jayson=require(_0x2738('0x5'));var client=jayson[_0x2738('0x6')][_0x2738('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1437b0,_0x4f0d91,_0x99e22e){return new BPromise(function(_0x20a64f,_0x351335){return client[_0x2738('0x8')](_0x1437b0,_0x99e22e)[_0x2738('0x9')](function(_0x4d8c36){logger[_0x2738('0xa')](_0x2738('0xb'),_0x4f0d91,_0x2738('0xc'));logger[_0x2738('0xd')](_0x2738('0xe'),_0x4f0d91,'request\x20sent',JSON['stringify'](_0x4d8c36));if(_0x4d8c36['error']){if(_0x4d8c36[_0x2738('0xf')][_0x2738('0x10')]===0x1f4){logger[_0x2738('0xf')](_0x2738('0xb'),_0x4f0d91,_0x4d8c36[_0x2738('0xf')][_0x2738('0x11')]);return _0x351335(_0x4d8c36[_0x2738('0xf')][_0x2738('0x11')]);}logger[_0x2738('0xf')](_0x2738('0xb'),_0x4f0d91,_0x4d8c36[_0x2738('0xf')][_0x2738('0x11')]);return _0x20a64f(_0x4d8c36['error'][_0x2738('0x11')]);}else{logger[_0x2738('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4f0d91,'request\x20sent');_0x20a64f(_0x4d8c36[_0x2738('0x12')][_0x2738('0x11')]);}})[_0x2738('0x13')](function(_0x588a68){logger[_0x2738('0xf')](_0x2738('0xb'),_0x4f0d91,_0x588a68);_0x351335(_0x588a68);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 48ea5b0..5960bf2 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 _0x8124=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','/describe','isAuthenticated','get','/:id','show','/:id/download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3b493b,_0x370e14){var _0x383705=function(_0x264c33){while(--_0x264c33){_0x3b493b['push'](_0x3b493b['shift']());}};_0x383705(++_0x370e14);}(_0x8124,0x82));var _0x4812=function(_0xf37717,_0x5afacc){_0xf37717=_0xf37717-0x0;var _0x992835=_0x8124[_0xf37717];return _0x992835;};'use strict';var multer=require(_0x4812('0x0'));var util=require('util');var path=require(_0x4812('0x1'));var timeout=require(_0x4812('0x2'));var express=require(_0x4812('0x3'));var router=express[_0x4812('0x4')]();var fs_extra=require(_0x4812('0x5'));var auth=require(_0x4812('0x6'));var interaction=require(_0x4812('0x7'));var config=require(_0x4812('0x8'));var controller=require(_0x4812('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4812('0xa')]);router['get'](_0x4812('0xb'),auth[_0x4812('0xc')](),controller['describe']);router[_0x4812('0xd')](_0x4812('0xe'),auth[_0x4812('0xc')](),controller[_0x4812('0xf')]);router[_0x4812('0xd')](_0x4812('0x10'),auth[_0x4812('0xc')](),controller['download']);router[_0x4812('0xd')]('/:id/downloads',controller[_0x4812('0x11')]);router[_0x4812('0xd')](_0x4812('0x12'),auth[_0x4812('0xc')](),controller[_0x4812('0x13')]);router[_0x4812('0x14')]('/',auth[_0x4812('0xc')](),controller['create']);router['post']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x4812('0x15')]);router[_0x4812('0x16')]('/:id',auth[_0x4812('0xc')](),controller[_0x4812('0x17')]);router[_0x4812('0x18')](_0x4812('0xe'),auth['isAuthenticated'](),controller[_0x4812('0x19')]);module[_0x4812('0x1a')]=router; \ No newline at end of file +var _0x1139=['/:id/downloads','/:id/transcribe','create','runTranscribe','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1139,0x1ac));var _0x9113=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x1139[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x9113('0x0'));var util=require(_0x9113('0x1'));var path=require(_0x9113('0x2'));var timeout=require(_0x9113('0x3'));var express=require(_0x9113('0x4'));var router=express[_0x9113('0x5')]();var fs_extra=require(_0x9113('0x6'));var auth=require(_0x9113('0x7'));var interaction=require(_0x9113('0x8'));var config=require(_0x9113('0x9'));var controller=require(_0x9113('0xa'));router[_0x9113('0xb')]('/',auth['isAuthenticated'](),controller[_0x9113('0xc')]);router['get'](_0x9113('0xd'),auth[_0x9113('0xe')](),controller[_0x9113('0xf')]);router[_0x9113('0xb')](_0x9113('0x10'),auth['isAuthenticated'](),controller[_0x9113('0x11')]);router[_0x9113('0xb')](_0x9113('0x12'),auth[_0x9113('0xe')](),controller[_0x9113('0x13')]);router[_0x9113('0xb')](_0x9113('0x14'),controller['downloads']);router['get'](_0x9113('0x15'),auth['isAuthenticated'](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0x9113('0x16')]);router['post']('/:id/transcribe',auth[_0x9113('0xe')](),controller[_0x9113('0x17')]);router[_0x9113('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x9113('0x19')]);router[_0x9113('0x1a')](_0x9113('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x9113('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e539125..133fd66 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(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 90b1677..b4431ad 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 _0x5218=['offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','show','params','includeAll','find','create','body','catch','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','col','token','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','startTranscriptionJob','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','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeRegion','runSentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[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','moment','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x158180,_0x50987a){var _0x2b8cee=function(_0x5c96bc){while(--_0x5c96bc){_0x158180['push'](_0x158180['shift']());}};_0x2b8cee(++_0x50987a);}(_0x5218,0x7d));var _0x8521=function(_0x2df83b,_0xc3f7e3){_0x2df83b=_0x2df83b-0x0;var _0x2a97df=_0x5218[_0x2df83b];return _0x2a97df;};'use strict';var emlformat=require(_0x8521('0x0'));var rimraf=require(_0x8521('0x1'));var zipdir=require(_0x8521('0x2'));var jsonpatch=require(_0x8521('0x3'));var rp=require('request-promise');var moment=require(_0x8521('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8521('0x5'));var sox=require('sox');var csv=require(_0x8521('0x6'));var ejs=require(_0x8521('0x7'));var fs=require('fs');var fs_extra=require(_0x8521('0x8'));var _=require(_0x8521('0x9'));var squel=require('squel');var crypto=require(_0x8521('0xa'));var jsforce=require(_0x8521('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8521('0x6'));var querystring=require('querystring');var Papa=require(_0x8521('0xc'));var AWS=require(_0x8521('0xd'));var uuidv4=require(_0x8521('0xe'));var Redis=require('ioredis');var authService=require(_0x8521('0xf'));var qs=require(_0x8521('0x10'));var as=require(_0x8521('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8521('0x12'))(_0x8521('0x13'));var utils=require(_0x8521('0x14'));var config=require(_0x8521('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8521('0x16'))['db'];function respondWithStatusCode(_0x10223d,_0x85bf9f){_0x85bf9f=_0x85bf9f||0xcc;return function(_0x4c8fe1){if(_0x4c8fe1){return _0x10223d[_0x8521('0x17')](_0x85bf9f);}return _0x10223d[_0x8521('0x18')](_0x85bf9f)[_0x8521('0x19')]();};}function respondWithResult(_0x8c27f2,_0x3bc626){_0x3bc626=_0x3bc626||0xc8;return function(_0x1158fa){if(_0x1158fa){return _0x8c27f2[_0x8521('0x18')](_0x3bc626)[_0x8521('0x1a')](_0x1158fa);}};}function respondWithFilteredResult(_0x13bcaa,_0x3967f8){return function(_0x52b2f4){if(_0x52b2f4){var _0x31fc3d=typeof _0x3967f8[_0x8521('0x1b')]===_0x8521('0x1c')&&typeof _0x3967f8['limit']===_0x8521('0x1c');var _0xabe483=_0x52b2f4[_0x8521('0x1d')];var _0x40066e=_0x31fc3d?0x0:_0x3967f8[_0x8521('0x1b')];var _0x2d1815=_0x31fc3d?_0x52b2f4[_0x8521('0x1d')]:_0x3967f8[_0x8521('0x1b')]+_0x3967f8[_0x8521('0x1e')];var _0x5d2013;if(_0x2d1815>=_0xabe483){_0x2d1815=_0xabe483;_0x5d2013=0xc8;}else{_0x5d2013=0xce;}_0x13bcaa['status'](_0x5d2013);return _0x13bcaa[_0x8521('0x1f')](_0x8521('0x20'),_0x40066e+'-'+_0x2d1815+'/'+_0xabe483)[_0x8521('0x1a')](_0x52b2f4);}return null;};}function patchUpdates(_0xc960d2){return function(_0xab03c0){try{jsonpatch[_0x8521('0x21')](_0xab03c0,_0xc960d2,!![]);}catch(_0x24a966){return BPromise[_0x8521('0x22')](_0x24a966);}return _0xab03c0['save']();};}function saveUpdates(_0x5791bf,_0x1d9418){return function(_0x43c9fe){if(_0x43c9fe){return _0x43c9fe[_0x8521('0x23')](_0x5791bf)[_0x8521('0x24')](function(_0x5d64e9){return _0x5d64e9;});}return null;};}function removeEntity(_0x533dc9,_0x377ca6){return function(_0xf667bf){if(_0xf667bf){return _0xf667bf[_0x8521('0x25')]()[_0x8521('0x24')](function(){_0x533dc9[_0x8521('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cb59b,_0x1902f8){return function(_0xd48e65){if(!_0xd48e65){_0x3cb59b['sendStatus'](0x194);}return _0xd48e65;};}function handleError(_0x43ccf8,_0x51c967){_0x51c967=_0x51c967||0x1f4;return function(_0x5b26aa){logger[_0x8521('0x26')](_0x5b26aa[_0x8521('0x27')]);if(_0x5b26aa[_0x8521('0x28')]){delete _0x5b26aa[_0x8521('0x28')];}_0x43ccf8[_0x8521('0x18')](_0x51c967)[_0x8521('0x29')](_0x5b26aa);};}exports[_0x8521('0x2a')]=function(_0x49c9fd,_0x3b6ff8){var _0x4868ae={},_0x150378={},_0x4da28d={'count':0x0,'rows':[]};var _0x9aada4=_[_0x8521('0x2b')](db[_0x8521('0x2c')][_0x8521('0x2d')],function(_0x14a673){return{'name':_0x14a673[_0x8521('0x2e')],'type':_0x14a673['type'][_0x8521('0x2f')]};});_0x150378[_0x8521('0x30')]=_[_0x8521('0x31')](_[_0x8521('0x2b')](_0x9aada4,_0x8521('0x28')),[_0x8521('0x32')]);_0x150378[_0x8521('0x33')]=_[_0x8521('0x34')](_0x49c9fd[_0x8521('0x33')]);_0x150378[_0x8521('0x35')]=_[_0x8521('0x36')](_0x150378['model'],_0x150378['query']);_0x4868ae['attributes']=_[_0x8521('0x36')](_0x150378[_0x8521('0x30')],qs[_0x8521('0x37')](_0x49c9fd[_0x8521('0x33')][_0x8521('0x37')]));_0x4868ae['attributes']=_0x4868ae[_0x8521('0x38')][_0x8521('0x39')]?_0x4868ae[_0x8521('0x38')]:_0x150378[_0x8521('0x30')];if(!_0x49c9fd[_0x8521('0x33')][_0x8521('0x3a')](_0x8521('0x3b'))){_0x4868ae['limit']=qs[_0x8521('0x1e')](_0x49c9fd[_0x8521('0x33')][_0x8521('0x1e')]);_0x4868ae[_0x8521('0x1b')]=qs[_0x8521('0x1b')](_0x49c9fd[_0x8521('0x33')][_0x8521('0x1b')]);}_0x4868ae[_0x8521('0x3c')]=qs[_0x8521('0x3d')](_0x49c9fd[_0x8521('0x33')][_0x8521('0x3d')]);_0x4868ae[_0x8521('0x3e')]=qs[_0x8521('0x35')](_['pick'](_0x49c9fd['query'],_0x150378[_0x8521('0x35')]),_0x9aada4);if(_0x49c9fd['query'][_0x8521('0x3f')]){_0x4868ae[_0x8521('0x3e')]=_[_0x8521('0x40')](_0x4868ae[_0x8521('0x3e')],{'$or':_[_0x8521('0x2b')](_0x9aada4,function(_0x26f5a2){if(_0x26f5a2['type']!=='VIRTUAL'){var _0x2e3f3e={};_0x2e3f3e[_0x26f5a2[_0x8521('0x28')]]={'$like':'%'+_0x49c9fd['query']['filter']+'%'};return _0x2e3f3e;}})});}_0x4868ae=_[_0x8521('0x40')]({},_0x4868ae,_0x49c9fd[_0x8521('0x41')]);var _0x49fe11={'where':_0x4868ae[_0x8521('0x3e')]};return db[_0x8521('0x2c')][_0x8521('0x1d')](_0x49fe11)[_0x8521('0x24')](function(_0x47a884){_0x4da28d[_0x8521('0x1d')]=_0x47a884;if(_0x49c9fd[_0x8521('0x33')]['includeAll']){_0x4868ae[_0x8521('0x42')]=[{'all':!![]}];}return db[_0x8521('0x2c')][_0x8521('0x43')](_0x4868ae);})[_0x8521('0x24')](function(_0x388f78){_0x4da28d[_0x8521('0x44')]=_0x388f78;return _0x4da28d;})[_0x8521('0x24')](respondWithFilteredResult(_0x3b6ff8,_0x4868ae))['catch'](handleError(_0x3b6ff8,null));};exports[_0x8521('0x45')]=function(_0x1fd394,_0x2ca6c3){var _0x5892d1={'raw':![],'where':{'id':_0x1fd394[_0x8521('0x46')]['id']}},_0x5bc4f0={};_0x5bc4f0[_0x8521('0x30')]=_['keys'](db[_0x8521('0x2c')][_0x8521('0x2d')]);_0x5bc4f0[_0x8521('0x33')]=_[_0x8521('0x34')](_0x1fd394[_0x8521('0x33')]);_0x5bc4f0[_0x8521('0x35')]=_[_0x8521('0x36')](_0x5bc4f0[_0x8521('0x30')],_0x5bc4f0[_0x8521('0x33')]);_0x5892d1[_0x8521('0x38')]=_[_0x8521('0x36')](_0x5bc4f0[_0x8521('0x30')],qs[_0x8521('0x37')](_0x1fd394[_0x8521('0x33')][_0x8521('0x37')]));_0x5892d1['attributes']=_0x5892d1[_0x8521('0x38')][_0x8521('0x39')]?_0x5892d1[_0x8521('0x38')]:_0x5bc4f0[_0x8521('0x30')];if(_0x1fd394[_0x8521('0x33')][_0x8521('0x47')]){_0x5892d1[_0x8521('0x42')]=[{'all':!![]}];}_0x5892d1=_['merge']({},_0x5892d1,_0x1fd394[_0x8521('0x41')]);return db['VoiceRecording'][_0x8521('0x48')](_0x5892d1)[_0x8521('0x24')](handleEntityNotFound(_0x2ca6c3,null))[_0x8521('0x24')](respondWithResult(_0x2ca6c3,null))['catch'](handleError(_0x2ca6c3,null));};exports[_0x8521('0x49')]=function(_0x5f0191,_0x25e0c9){return db[_0x8521('0x2c')][_0x8521('0x49')](_0x5f0191[_0x8521('0x4a')],{})['then'](respondWithResult(_0x25e0c9,0xc9))[_0x8521('0x4b')](handleError(_0x25e0c9,null));};exports['update']=function(_0x3523e4,_0x1f9c2f){if(_0x3523e4[_0x8521('0x4a')]['id']){delete _0x3523e4['body']['id'];}return db[_0x8521('0x2c')][_0x8521('0x48')]({'where':{'id':_0x3523e4[_0x8521('0x46')]['id']}})[_0x8521('0x24')](handleEntityNotFound(_0x1f9c2f,null))['then'](saveUpdates(_0x3523e4['body'],null))[_0x8521('0x24')](respondWithResult(_0x1f9c2f,null))[_0x8521('0x4b')](handleError(_0x1f9c2f,null));};exports[_0x8521('0x4c')]=function(_0x2ed7aa,_0x2fcc9a){return db[_0x8521('0x2c')][_0x8521('0x4c')]()['then'](respondWithResult(_0x2fcc9a,null))['catch'](handleError(_0x2fcc9a,null));};exports[_0x8521('0x4d')]=function(_0x10d80b,_0x2fb458,_0x451549){var _0x4c329b=require(_0x8521('0x4e'));var _0x4dc8ef=![];var _0x1b3874={};if(_0x10d80b[_0x8521('0x33')][_0x8521('0x4f')]&&_0x10d80b['query'][_0x8521('0x4f')]==='uniqueid'){_0x1b3874[_0x8521('0x50')]=_0x10d80b[_0x8521('0x46')]['id'];}else{_0x1b3874['id']=_0x10d80b['params']['id'];}return db['VoiceRecording'][_0x8521('0x48')]({'where':_0x1b3874,'attributes':['id',_0x8521('0x51')],'raw':!![]})[_0x8521('0x24')](handleEntityNotFound(_0x2fb458,null))['then'](function(_0x22eec0){if(_0x22eec0){var _0x441515=_0x22eec0[_0x8521('0x51')];var _0x4a24be=util['format'](_0x8521('0x52'),_0x441515);if(fs['existsSync'](_0x4a24be)){_0x4dc8ef=!![];return _0x4c329b[_0x8521('0x53')](_0x4a24be,_0x441515,config[_0x8521('0x54')][_0x8521('0x55')])['then'](function(){return _0x22eec0;});}return _0x22eec0;}})['then'](function(_0x591bb8){if(_0x591bb8){var _0x278a04=_0x591bb8[_0x8521('0x51')];if(!fs[_0x8521('0x56')](_0x278a04)){throw new db[(_0x8521('0x57'))][(_0x8521('0x58'))](_0x8521('0x59'));}if(_0x591bb8[_0x8521('0x5a')]){return _0x2fb458[_0x8521('0x4d')](_0x278a04,_0x591bb8[_0x8521('0x5a')]+path[_0x8521('0x5b')](_0x278a04),function(){if(_0x4dc8ef){fs[_0x8521('0x5c')](_0x278a04);}});}else{return _0x2fb458[_0x8521('0x4d')](_0x278a04,function(_0x561759){if(_0x4dc8ef){fs['unlink'](_0x278a04);}});}}})[_0x8521('0x4b')](function(_0x4be3c1){if(_0x4be3c1[_0x8521('0x5d')]==='VoiceRecording\x20not\x20found'){_0x2fb458[_0x8521('0x18')](0x194)[_0x8521('0x29')](_0x8521('0x5e'));}else{return handleError(_0x2fb458,null);}});};exports[_0x8521('0x5f')]=function(_0x281b5e,_0x509731,_0x587eb0){var _0x1aa8b8=require(_0x8521('0x4e'));var _0x554ec9=![];var _0x1a57d0={'$and':[db[_0x8521('0x60')]['where'](db[_0x8521('0x60')]['fn']('MD5',db['sequelize'][_0x8521('0x61')](_0x8521('0x50'))),_0x281b5e[_0x8521('0x33')][_0x8521('0x62')])]};if(_0x281b5e[_0x8521('0x33')][_0x8521('0x4f')]&&_0x281b5e['query'][_0x8521('0x4f')]===_0x8521('0x50')){_0x1a57d0[_0x8521('0x63')][_0x8521('0x64')]({'uniqueid':_0x281b5e[_0x8521('0x46')]['id']});}else{_0x1a57d0[_0x8521('0x63')][_0x8521('0x64')]({'id':_0x281b5e[_0x8521('0x46')]['id']});}return db['VoiceRecording'][_0x8521('0x48')]({'where':_0x1a57d0,'attributes':['id',_0x8521('0x51')],'raw':!![]})[_0x8521('0x24')](handleEntityNotFound(_0x509731,null))[_0x8521('0x24')](function(_0x160dd7){if(_0x160dd7){var _0x22b5ed=util['format'](_0x8521('0x52'),_0x160dd7['value']);if(fs[_0x8521('0x56')](_0x22b5ed)){_0x554ec9=!![];return _0x1aa8b8['decryptFile'](_0x22b5ed,_0x160dd7['value'],config[_0x8521('0x54')][_0x8521('0x55')])[_0x8521('0x24')](function(){return _0x160dd7;});}return _0x160dd7;}})[_0x8521('0x24')](function(_0x4d74c8){if(_0x4d74c8){if(!fs[_0x8521('0x56')](_0x4d74c8['value'])){throw new db[(_0x8521('0x57'))][(_0x8521('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x4d74c8['filename']){return _0x509731[_0x8521('0x4d')](_0x4d74c8[_0x8521('0x51')],_0x4d74c8[_0x8521('0x5a')]+path[_0x8521('0x5b')](_0x4d74c8['value']),function(){if(_0x554ec9){fs[_0x8521('0x5c')](_0x4d74c8[_0x8521('0x51')]);}});}else{return _0x509731[_0x8521('0x4d')](_0x4d74c8['value'],function(_0x3046d4){if(_0x554ec9){fs[_0x8521('0x5c')](_0x4d74c8[_0x8521('0x51')]);}});}}})[_0x8521('0x4b')](handleError(_0x509731,null));};exports[_0x8521('0x25')]=function(_0x15e68a,_0x368696){return db[_0x8521('0x2c')]['find']({'where':{'id':_0x15e68a[_0x8521('0x46')]['id']}})[_0x8521('0x24')](function(_0x3b2668){if(_[_0x8521('0x65')](_0x3b2668)){throw new ReferenceError(_0x8521('0x66'));}return _0x3b2668;})[_0x8521('0x24')](function(_0x59fa0d){var _0x99d939=_0x59fa0d[_0x8521('0x51')];logger[_0x8521('0x67')](_0x8521('0x68'),_0x99d939);if(!_[_0x8521('0x65')](_0x59fa0d[_0x8521('0x51')])&&fs['existsSync'](_0x99d939)){logger[_0x8521('0x67')](_0x8521('0x69')+_0x99d939+_0x8521('0x6a'));fs['unlinkSync'](_0x99d939);}_0x99d939=_0x99d939+_0x8521('0x6b');if(!_[_0x8521('0x65')](_0x59fa0d['value'])&&fs[_0x8521('0x56')](_0x99d939)){logger[_0x8521('0x67')](_0x8521('0x69')+_0x99d939+_0x8521('0x6a'));fs[_0x8521('0x6c')](_0x99d939);}return _0x59fa0d;})[_0x8521('0x24')](function(_0x2403dd){if(!_0x2403dd)throw new InternalError();return _0x2403dd[_0x8521('0x25')]();})['then'](function(){_0x368696[_0x8521('0x18')](0xcc)[_0x8521('0x19')]();})[_0x8521('0x4b')](handleError(_0x368696,null));};function getBucketslist(_0x56850f,_0x4e9faf,_0x3cbe9d){return new Promise(function(_0x2f7e95,_0x330299){var _0x378cfa=new AWS['S3']({'accessKeyId':_0x4e9faf,'secretAccessKey':_0x56850f,'region':_0x3cbe9d});_0x378cfa[_0x8521('0x6d')]({},function(_0x40854b,_0x47d2f1){if(_0x40854b){return _0x330299(_0x40854b);}else{return _0x2f7e95(_0x47d2f1);}});});}function createBucket(_0x2e677a,_0x51af17,_0x322ee7,_0x376930){return new Promise(function(_0x4de8ca,_0x1f9d5a){var _0x445c65=new AWS['S3']({'accessKeyId':_0x51af17,'secretAccessKey':_0x2e677a,'region':_0x322ee7});_0x445c65[_0x8521('0x6e')]({'Bucket':_0x376930},function(_0x392052,_0x484c41){if(_0x392052){return _0x1f9d5a(_0x392052);}else{return _0x4de8ca(_0x484c41);}});});}function uploadFile(_0x176bf2,_0x2c641b,_0x4a1ee8,_0x89629,_0x4f8fc8,_0x2de8ec){return new Promise(function(_0x9725a,_0x1a32fc){var _0x1be3d3=new AWS['S3']({'accessKeyId':_0x2c641b,'secretAccessKey':_0x176bf2,'region':_0x4a1ee8});_0x1be3d3['upload']({'Bucket':_0x89629,'Key':_0x4f8fc8,'Body':_0x2de8ec},function(_0x2de178,_0x3c8751){if(_0x2de178){return _0x1a32fc(_0x2de178);}else{return _0x9725a(_0x3c8751);}});});}function startTranscribe(_0x11a00d,_0x28aed0,_0x31f07a,_0x25bc72,_0x5318b6,_0x2a0df9){return new Promise(function(_0x401ee9,_0x17a3b7){var _0xe0196c=new AWS['TranscribeService']({'accessKeyId':_0x28aed0,'secretAccessKey':_0x11a00d,'region':_0x31f07a});_0xe0196c[_0x8521('0x6f')]({'TranscriptionJobName':_0x25bc72,'LanguageCode':_0x5318b6,'Media':{'MediaFileUri':_0x2a0df9}},function(_0x5b0489,_0x1e59e4){if(_0x5b0489){return _0x17a3b7(_0x5b0489);}else{return _0x401ee9(_0x1e59e4);}});});}function transcribe(_0x2f0078,_0x3ccb53,_0x49602f,_0xe9abe0,_0x5ef5e7,_0x3376ec,_0x15747e){return new Promise(function(_0x21d877,_0x6845e1){var _0x1b24f2={};logger[_0x8521('0x67')](util[_0x8521('0x32')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2f0078,_0x5ef5e7));return uploadFile(_0x3ccb53,_0x49602f,_0xe9abe0,_0x5ef5e7,path['basename'](_0x3376ec),fs[_0x8521('0x70')](_0x3376ec))['then'](function(_0x2e3237){logger[_0x8521('0x67')](util[_0x8521('0x32')](_0x8521('0x71'),_0x2f0078,_0x5ef5e7,_0x2e3237[_0x8521('0x72')]));_0x1b24f2[_0x8521('0x73')]=_0x2e3237[_0x8521('0x74')];_0x1b24f2[_0x8521('0x75')]=_0x2e3237[_0x8521('0x72')];logger[_0x8521('0x67')](util[_0x8521('0x32')](_0x8521('0x76'),_0x2f0078));return startTranscribe(_0x3ccb53,_0x49602f,_0xe9abe0,uuidv4(),_0x15747e,_0x2e3237[_0x8521('0x72')]);})['then'](function(_0x550ad6){logger[_0x8521('0x67')](util[_0x8521('0x32')](_0x8521('0x77'),_0x2f0078,_0x550ad6[_0x8521('0x78')][_0x8521('0x79')]));_0x1b24f2[_0x8521('0x7a')]=_0x550ad6[_0x8521('0x78')][_0x8521('0x79')];_0x1b24f2[_0x8521('0x7b')]=_0x550ad6[_0x8521('0x78')][_0x8521('0x7c')];return _0x21d877(_0x1b24f2);})[_0x8521('0x4b')](function(_0x63d1a7){return _0x6845e1(_0x63d1a7);});});}exports['runTranscribe']=function(_0xa433d9,_0x44fdc6,_0x24da93){var _0x4b7087;var _0x188d34;var _0x203573;var _0x4d8112=require('../../components/encryptor');return db[_0x8521('0x2c')]['findOne']({'where':{'id':_0xa433d9[_0x8521('0x46')]['id']}})[_0x8521('0x24')](function(_0x38dbd3){if(_0x38dbd3){var _0x5a2589=util[_0x8521('0x32')](_0x8521('0x52'),_0x38dbd3['value']);if(fs['existsSync'](_0x5a2589)){cypher=!![];return _0x4d8112[_0x8521('0x53')](_0x5a2589,_0x38dbd3[_0x8521('0x51')],config['secrets'][_0x8521('0x55')])[_0x8521('0x24')](function(){return _0x38dbd3;});}return _0x38dbd3;}})[_0x8521('0x24')](function(_0x3a957f){if(!_0x3a957f){throw new db[(_0x8521('0x57'))][(_0x8521('0x58'))](_0x8521('0x7d'));}_0x188d34=_0x3a957f;return db[_0x8521('0x7e')][_0x8521('0x7f')]({'where':{'id':0x1}});})[_0x8521('0x24')](handleEntityNotFound(_0x44fdc6,null))[_0x8521('0x24')](function(_0x1dc25d){if(_0x1dc25d){_0x4b7087=_0x1dc25d;if(!_0x4b7087['transcribe']||!_0x4b7087['transcribeAccountId']||!_0x4b7087[_0x8521('0x80')]||!_0x4b7087['language']||!_0x4b7087[_0x8521('0x73')]){throw new db[(_0x8521('0x57'))][(_0x8521('0x58'))]('Transcribe\x20not\x20configured');}if(_0xa433d9['body'][_0x8521('0x81')]&&(!_0x4b7087['sentiment']||!_0x4b7087[_0x8521('0x82')]||!_0x4b7087[_0x8521('0x83')]||!_0x4b7087[_0x8521('0x84')]||!_0x4b7087[_0x8521('0x73')])){throw new db[(_0x8521('0x57'))][(_0x8521('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x8521('0x85')]['findOne']({'where':{'id':_0x4b7087['transcribeAccountId']}});}})[_0x8521('0x24')](function(_0x5b79d0){if(!_0x5b79d0){throw new db[(_0x8521('0x57'))][(_0x8521('0x58'))](_0x8521('0x86'));}if(!_0x5b79d0[_0x8521('0x87')]||!_0x5b79d0[_0x8521('0x88')]){throw new db[(_0x8521('0x57'))][(_0x8521('0x58'))](_0x8521('0x89'));}_0x203573=_0x5b79d0;return getBucketslist(_0x203573[_0x8521('0x87')],_0x203573['data2'],_0x4b7087[_0x8521('0x80')]);})['then'](function(_0x43e45c){if(_0x43e45c&&_0x43e45c[_0x8521('0x8a')]){var _0x51c4fa=_[_0x8521('0x48')](_0x43e45c[_0x8521('0x8a')],function(_0x15ee4b){return _0x15ee4b['Name']===_0x4b7087[_0x8521('0x73')];});if(!_0x51c4fa){logger[_0x8521('0x67')](util[_0x8521('0x32')](_0x8521('0x8b'),_0xa433d9[_0x8521('0x46')]['id'],_0x4b7087[_0x8521('0x73')]));return createBucket(_0x203573[_0x8521('0x87')],_0x203573[_0x8521('0x88')],_0x4b7087['transcribeRegion'],_0x4b7087['bucket']);}logger[_0x8521('0x67')](util[_0x8521('0x32')](_0x8521('0x8c'),_0xa433d9[_0x8521('0x46')]['id'],_0x4b7087['bucket']));return;}})[_0x8521('0x24')](function(_0x15c743){if(_0x188d34['transcribeStatus']==='NEW'){return transcribe(_0xa433d9[_0x8521('0x46')]['id'],_0x203573[_0x8521('0x87')],_0x203573[_0x8521('0x88')],_0x4b7087[_0x8521('0x80')],_0x4b7087[_0x8521('0x73')],_0x188d34[_0x8521('0x51')],_0x4b7087[_0x8521('0x84')]);}else{logger[_0x8521('0x67')](util[_0x8521('0x32')](_0x8521('0x8d'),_0xa433d9[_0x8521('0x46')]['id']));return{'transcribeStatus':_0x8521('0x8e')};}})[_0x8521('0x24')](function(_0x42dbb7){if(_0x42dbb7){_0x42dbb7[_0x8521('0x8f')]=_0xa433d9[_0x8521('0x4a')][_0x8521('0x81')];return _0x188d34[_0x8521('0x90')](_0x42dbb7);}})['then'](respondWithResult(_0x44fdc6,null))[_0x8521('0x4b')](handleError(_0x44fdc6,null));};function writeFile(_0xb5a6c9,_0x34516b){return new Promise(function(_0x2a5073,_0x496595){fs[_0x8521('0x91')](_0x34516b,_0xb5a6c9,function(_0x59606e,_0x36bbc2){if(_0x59606e){return _0x496595(_0x59606e);}else{return _0x2a5073(_0x36bbc2);}});});}exports[_0x8521('0x92')]=function(_0x260579,_0x315edd,_0x3b95c5){return db[_0x8521('0x2c')][_0x8521('0x7f')]({'where':{'id':_0x260579[_0x8521('0x46')]['id']}})[_0x8521('0x24')](handleEntityNotFound(_0x315edd))[_0x8521('0x24')](function(_0x561649){if(_0x561649&&_0x561649[_0x8521('0x93')]){var _0x22169c=_0x561649['fileText'];var _0x113493=config[_0x8521('0x94')]+_0x8521('0x95')+_0x561649['id']+_0x8521('0x96');if(fs[_0x8521('0x56')](_0x113493)){return _0x113493;}return writeFile(_0x22169c,_0x113493)[_0x8521('0x24')](function(){return _0x113493;});}else{throw new db[(_0x8521('0x57'))][(_0x8521('0x58'))](_0x8521('0x97'));}})[_0x8521('0x24')](function(_0x1d7720){return _0x315edd[_0x8521('0x4d')](_0x1d7720);})[_0x8521('0x4b')](handleError(_0x315edd));}; \ No newline at end of file +var _0x74fe=['Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeStatus','runTranscribe','findOne','decryptFile','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','VoiceRecording','fieldName','type','key','model','differenceBy','map','format','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','send','downloads','../../components/encryptor','sequelize','MD5','col','push','$and','recording','ValidationError','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)'];(function(_0x110b00,_0x2a0358){var _0x29b6d0=function(_0x3d2e18){while(--_0x3d2e18){_0x110b00['push'](_0x110b00['shift']());}};_0x29b6d0(++_0x2a0358);}(_0x74fe,0xb3));var _0xe74f=function(_0xcf925d,_0x500d26){_0xcf925d=_0xcf925d-0x0;var _0x2ba6d0=_0x74fe[_0xcf925d];return _0x2ba6d0;};'use strict';var emlformat=require(_0xe74f('0x0'));var rimraf=require(_0xe74f('0x1'));var zipdir=require(_0xe74f('0x2'));var jsonpatch=require(_0xe74f('0x3'));var rp=require(_0xe74f('0x4'));var moment=require('moment');var BPromise=require(_0xe74f('0x5'));var Mustache=require(_0xe74f('0x6'));var util=require(_0xe74f('0x7'));var path=require('path');var sox=require(_0xe74f('0x8'));var csv=require('to-csv');var ejs=require(_0xe74f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe74f('0xa'));var squel=require(_0xe74f('0xb'));var crypto=require(_0xe74f('0xc'));var jsforce=require(_0xe74f('0xd'));var deskjs=require(_0xe74f('0xe'));var toCsv=require(_0xe74f('0xf'));var querystring=require(_0xe74f('0x10'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xe74f('0x11'));var Redis=require('ioredis');var authService=require(_0xe74f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe74f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe74f('0x14'));var utils=require(_0xe74f('0x15'));var config=require(_0xe74f('0x16'));var licenseUtil=require(_0xe74f('0x17'));var db=require(_0xe74f('0x18'))['db'];function respondWithStatusCode(_0x1f6794,_0xd95515){_0xd95515=_0xd95515||0xcc;return function(_0x1a9ac2){if(_0x1a9ac2){return _0x1f6794[_0xe74f('0x19')](_0xd95515);}return _0x1f6794[_0xe74f('0x1a')](_0xd95515)['end']();};}function respondWithResult(_0x52d8b6,_0x2e9db3){_0x2e9db3=_0x2e9db3||0xc8;return function(_0x4bcaaf){if(_0x4bcaaf){return _0x52d8b6['status'](_0x2e9db3)[_0xe74f('0x1b')](_0x4bcaaf);}};}function respondWithFilteredResult(_0x11efbd,_0x38b0f2){return function(_0x1bfcc0){if(_0x1bfcc0){var _0x53bec2=typeof _0x38b0f2[_0xe74f('0x1c')]===_0xe74f('0x1d')&&typeof _0x38b0f2[_0xe74f('0x1e')]===_0xe74f('0x1d');var _0x1218fa=_0x1bfcc0['count'];var _0x123d7e=_0x53bec2?0x0:_0x38b0f2['offset'];var _0x13914a=_0x53bec2?_0x1bfcc0[_0xe74f('0x1f')]:_0x38b0f2['offset']+_0x38b0f2['limit'];var _0x454eba;if(_0x13914a>=_0x1218fa){_0x13914a=_0x1218fa;_0x454eba=0xc8;}else{_0x454eba=0xce;}_0x11efbd[_0xe74f('0x1a')](_0x454eba);return _0x11efbd[_0xe74f('0x20')](_0xe74f('0x21'),_0x123d7e+'-'+_0x13914a+'/'+_0x1218fa)[_0xe74f('0x1b')](_0x1bfcc0);}return null;};}function patchUpdates(_0x3ab766){return function(_0x317b71){try{jsonpatch[_0xe74f('0x22')](_0x317b71,_0x3ab766,!![]);}catch(_0x4cc998){return BPromise[_0xe74f('0x23')](_0x4cc998);}return _0x317b71[_0xe74f('0x24')]();};}function saveUpdates(_0x4a2582,_0x1468bd){return function(_0x54b788){if(_0x54b788){return _0x54b788[_0xe74f('0x25')](_0x4a2582)['then'](function(_0x393a95){return _0x393a95;});}return null;};}function removeEntity(_0x3ece66,_0x1c93b9){return function(_0x13a63f){if(_0x13a63f){return _0x13a63f[_0xe74f('0x26')]()[_0xe74f('0x27')](function(){_0x3ece66[_0xe74f('0x1a')](0xcc)[_0xe74f('0x28')]();});}};}function handleEntityNotFound(_0x9d5966,_0x5f37ac){return function(_0x1a1db4){if(!_0x1a1db4){_0x9d5966[_0xe74f('0x19')](0x194);}return _0x1a1db4;};}function handleError(_0x37cfd5,_0x331681){_0x331681=_0x331681||0x1f4;return function(_0x1e15a0){logger[_0xe74f('0x29')](_0x1e15a0['stack']);if(_0x1e15a0[_0xe74f('0x2a')]){delete _0x1e15a0[_0xe74f('0x2a')];}_0x37cfd5[_0xe74f('0x1a')](_0x331681)['send'](_0x1e15a0);};}exports['index']=function(_0x5260b0,_0x2ef81e){var _0x56fb71={},_0x334ee6={},_0x29223b={'count':0x0,'rows':[]};var _0x284421=_['map'](db[_0xe74f('0x2b')]['rawAttributes'],function(_0x36b4bf){return{'name':_0x36b4bf[_0xe74f('0x2c')],'type':_0x36b4bf[_0xe74f('0x2d')][_0xe74f('0x2e')]};});_0x334ee6[_0xe74f('0x2f')]=_[_0xe74f('0x30')](_[_0xe74f('0x31')](_0x284421,_0xe74f('0x2a')),[_0xe74f('0x32')]);_0x334ee6['query']=_[_0xe74f('0x33')](_0x5260b0[_0xe74f('0x34')]);_0x334ee6['filters']=_['intersection'](_0x334ee6[_0xe74f('0x2f')],_0x334ee6[_0xe74f('0x34')]);_0x56fb71['attributes']=_[_0xe74f('0x35')](_0x334ee6['model'],qs[_0xe74f('0x36')](_0x5260b0[_0xe74f('0x34')][_0xe74f('0x36')]));_0x56fb71[_0xe74f('0x37')]=_0x56fb71[_0xe74f('0x37')][_0xe74f('0x38')]?_0x56fb71[_0xe74f('0x37')]:_0x334ee6[_0xe74f('0x2f')];if(!_0x5260b0[_0xe74f('0x34')][_0xe74f('0x39')]('nolimit')){_0x56fb71[_0xe74f('0x1e')]=qs[_0xe74f('0x1e')](_0x5260b0[_0xe74f('0x34')][_0xe74f('0x1e')]);_0x56fb71[_0xe74f('0x1c')]=qs['offset'](_0x5260b0[_0xe74f('0x34')]['offset']);}_0x56fb71['order']=qs[_0xe74f('0x3a')](_0x5260b0[_0xe74f('0x34')]['sort']);_0x56fb71[_0xe74f('0x3b')]=qs[_0xe74f('0x3c')](_[_0xe74f('0x3d')](_0x5260b0['query'],_0x334ee6[_0xe74f('0x3c')]),_0x284421);if(_0x5260b0[_0xe74f('0x34')][_0xe74f('0x3e')]){_0x56fb71[_0xe74f('0x3b')]=_[_0xe74f('0x3f')](_0x56fb71[_0xe74f('0x3b')],{'$or':_[_0xe74f('0x31')](_0x284421,function(_0x1ac674){if(_0x1ac674['type']!==_0xe74f('0x40')){var _0x4d0426={};_0x4d0426[_0x1ac674[_0xe74f('0x2a')]]={'$like':'%'+_0x5260b0[_0xe74f('0x34')][_0xe74f('0x3e')]+'%'};return _0x4d0426;}})});}_0x56fb71=_[_0xe74f('0x3f')]({},_0x56fb71,_0x5260b0['options']);var _0x3dc959={'where':_0x56fb71[_0xe74f('0x3b')]};return db[_0xe74f('0x2b')][_0xe74f('0x1f')](_0x3dc959)[_0xe74f('0x27')](function(_0x49d2db){_0x29223b[_0xe74f('0x1f')]=_0x49d2db;if(_0x5260b0[_0xe74f('0x34')][_0xe74f('0x41')]){_0x56fb71[_0xe74f('0x42')]=[{'all':!![]}];}return db[_0xe74f('0x2b')][_0xe74f('0x43')](_0x56fb71);})[_0xe74f('0x27')](function(_0xac55ea){_0x29223b['rows']=_0xac55ea;return _0x29223b;})[_0xe74f('0x27')](respondWithFilteredResult(_0x2ef81e,_0x56fb71))['catch'](handleError(_0x2ef81e,null));};exports[_0xe74f('0x44')]=function(_0x30f212,_0x53ec85){var _0x1d86c7={'raw':![],'where':{'id':_0x30f212[_0xe74f('0x45')]['id']}},_0x290911={};_0x290911[_0xe74f('0x2f')]=_[_0xe74f('0x33')](db[_0xe74f('0x2b')][_0xe74f('0x46')]);_0x290911[_0xe74f('0x34')]=_[_0xe74f('0x33')](_0x30f212[_0xe74f('0x34')]);_0x290911['filters']=_[_0xe74f('0x35')](_0x290911[_0xe74f('0x2f')],_0x290911[_0xe74f('0x34')]);_0x1d86c7['attributes']=_[_0xe74f('0x35')](_0x290911[_0xe74f('0x2f')],qs[_0xe74f('0x36')](_0x30f212[_0xe74f('0x34')][_0xe74f('0x36')]));_0x1d86c7[_0xe74f('0x37')]=_0x1d86c7[_0xe74f('0x37')][_0xe74f('0x38')]?_0x1d86c7[_0xe74f('0x37')]:_0x290911[_0xe74f('0x2f')];if(_0x30f212[_0xe74f('0x34')][_0xe74f('0x41')]){_0x1d86c7[_0xe74f('0x42')]=[{'all':!![]}];}_0x1d86c7=_[_0xe74f('0x3f')]({},_0x1d86c7,_0x30f212['options']);return db['VoiceRecording'][_0xe74f('0x47')](_0x1d86c7)[_0xe74f('0x27')](handleEntityNotFound(_0x53ec85,null))[_0xe74f('0x27')](respondWithResult(_0x53ec85,null))[_0xe74f('0x48')](handleError(_0x53ec85,null));};exports[_0xe74f('0x49')]=function(_0x505897,_0x38cc33){return db[_0xe74f('0x2b')][_0xe74f('0x49')](_0x505897[_0xe74f('0x4a')],{})[_0xe74f('0x27')](respondWithResult(_0x38cc33,0xc9))[_0xe74f('0x48')](handleError(_0x38cc33,null));};exports['update']=function(_0x129a03,_0x37a011){if(_0x129a03['body']['id']){delete _0x129a03[_0xe74f('0x4a')]['id'];}return db[_0xe74f('0x2b')]['find']({'where':{'id':_0x129a03[_0xe74f('0x45')]['id']}})[_0xe74f('0x27')](handleEntityNotFound(_0x37a011,null))[_0xe74f('0x27')](saveUpdates(_0x129a03[_0xe74f('0x4a')],null))[_0xe74f('0x27')](respondWithResult(_0x37a011,null))[_0xe74f('0x48')](handleError(_0x37a011,null));};exports['describe']=function(_0x495b23,_0x230286){return db[_0xe74f('0x2b')][_0xe74f('0x4b')]()['then'](respondWithResult(_0x230286,null))[_0xe74f('0x48')](handleError(_0x230286,null));};exports['download']=function(_0x23af8a,_0x37b3c9,_0x15664c){var _0x49e34a=require('../../components/encryptor');var _0x40e9b5=![];var _0xe95dca={};if(_0x23af8a[_0xe74f('0x34')][_0xe74f('0x2d')]&&_0x23af8a[_0xe74f('0x34')]['type']===_0xe74f('0x4c')){_0xe95dca[_0xe74f('0x4c')]=_0x23af8a[_0xe74f('0x45')]['id'];}else{_0xe95dca['id']=_0x23af8a['params']['id'];}return db[_0xe74f('0x2b')]['find']({'where':_0xe95dca,'attributes':['id',_0xe74f('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x37b3c9,null))[_0xe74f('0x27')](function(_0x528524){if(_0x528524){var _0x401e02=_0x528524[_0xe74f('0x4d')];var _0x407c87=util[_0xe74f('0x32')](_0xe74f('0x4e'),_0x401e02);if(fs[_0xe74f('0x4f')](_0x407c87)){_0x40e9b5=!![];return _0x49e34a['decryptFile'](_0x407c87,_0x401e02,config[_0xe74f('0x50')]['recording'])[_0xe74f('0x27')](function(){return _0x528524;});}return _0x528524;}})[_0xe74f('0x27')](function(_0x2cc2e2){if(_0x2cc2e2){var _0xdb3eff=_0x2cc2e2['value'];if(!fs[_0xe74f('0x4f')](_0xdb3eff)){throw new db[(_0xe74f('0x51'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2cc2e2[_0xe74f('0x52')]){return _0x37b3c9[_0xe74f('0x53')](_0xdb3eff,_0x2cc2e2[_0xe74f('0x52')]+path[_0xe74f('0x54')](_0xdb3eff),function(){if(_0x40e9b5){fs['unlink'](_0xdb3eff);}});}else{return _0x37b3c9['download'](_0xdb3eff,function(_0x1c0d5e){if(_0x40e9b5){fs[_0xe74f('0x55')](_0xdb3eff);}});}}})[_0xe74f('0x48')](function(_0x4e58e5){if(_0x4e58e5[_0xe74f('0x56')]===_0xe74f('0x57')){_0x37b3c9[_0xe74f('0x1a')](0x194)[_0xe74f('0x58')]('Not\x20found');}else{return handleError(_0x37b3c9,null);}});};exports[_0xe74f('0x59')]=function(_0x47898e,_0xac9276,_0x49fed4){var _0x280302=require(_0xe74f('0x5a'));var _0x47d75c=![];var _0x24a59e={'$and':[db[_0xe74f('0x5b')]['where'](db[_0xe74f('0x5b')]['fn'](_0xe74f('0x5c'),db['sequelize'][_0xe74f('0x5d')]('uniqueid')),_0x47898e[_0xe74f('0x34')]['token'])]};if(_0x47898e[_0xe74f('0x34')]['type']&&_0x47898e['query'][_0xe74f('0x2d')]===_0xe74f('0x4c')){_0x24a59e['$and'][_0xe74f('0x5e')]({'uniqueid':_0x47898e[_0xe74f('0x45')]['id']});}else{_0x24a59e[_0xe74f('0x5f')]['push']({'id':_0x47898e['params']['id']});}return db[_0xe74f('0x2b')][_0xe74f('0x47')]({'where':_0x24a59e,'attributes':['id',_0xe74f('0x4d')],'raw':!![]})[_0xe74f('0x27')](handleEntityNotFound(_0xac9276,null))[_0xe74f('0x27')](function(_0x4236bf){if(_0x4236bf){var _0x30642f=util['format'](_0xe74f('0x4e'),_0x4236bf[_0xe74f('0x4d')]);if(fs['existsSync'](_0x30642f)){_0x47d75c=!![];return _0x280302['decryptFile'](_0x30642f,_0x4236bf['value'],config[_0xe74f('0x50')][_0xe74f('0x60')])[_0xe74f('0x27')](function(){return _0x4236bf;});}return _0x4236bf;}})['then'](function(_0x29ea76){if(_0x29ea76){if(!fs[_0xe74f('0x4f')](_0x29ea76[_0xe74f('0x4d')])){throw new db[(_0xe74f('0x51'))][(_0xe74f('0x61'))]('VoiceRecording\x20not\x20found');}if(_0x29ea76[_0xe74f('0x52')]){return _0xac9276[_0xe74f('0x53')](_0x29ea76[_0xe74f('0x4d')],_0x29ea76[_0xe74f('0x52')]+path[_0xe74f('0x54')](_0x29ea76[_0xe74f('0x4d')]),function(){if(_0x47d75c){fs[_0xe74f('0x55')](_0x29ea76[_0xe74f('0x4d')]);}});}else{return _0xac9276[_0xe74f('0x53')](_0x29ea76[_0xe74f('0x4d')],function(_0x18f453){if(_0x47d75c){fs[_0xe74f('0x55')](_0x29ea76['value']);}});}}})[_0xe74f('0x48')](handleError(_0xac9276,null));};exports['destroy']=function(_0x5d5e35,_0x4a3296){return db[_0xe74f('0x2b')][_0xe74f('0x47')]({'where':{'id':_0x5d5e35[_0xe74f('0x45')]['id']}})[_0xe74f('0x27')](function(_0x1ba760){if(_[_0xe74f('0x62')](_0x1ba760)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ba760;})[_0xe74f('0x27')](function(_0x1f1eeb){var _0x4fb43f=_0x1f1eeb[_0xe74f('0x4d')];logger[_0xe74f('0x63')](_0xe74f('0x64'),_0x4fb43f);if(!_[_0xe74f('0x62')](_0x1f1eeb['value'])&&fs[_0xe74f('0x4f')](_0x4fb43f)){logger[_0xe74f('0x63')](_0xe74f('0x65')+_0x4fb43f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe74f('0x66')](_0x4fb43f);}_0x4fb43f=_0x4fb43f+'.cypher';if(!_[_0xe74f('0x62')](_0x1f1eeb[_0xe74f('0x4d')])&&fs['existsSync'](_0x4fb43f)){logger[_0xe74f('0x63')](_0xe74f('0x65')+_0x4fb43f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe74f('0x66')](_0x4fb43f);}return _0x1f1eeb;})['then'](function(_0x4335c2){if(!_0x4335c2)throw new InternalError();return _0x4335c2[_0xe74f('0x26')]();})[_0xe74f('0x27')](function(){_0x4a3296[_0xe74f('0x1a')](0xcc)['end']();})[_0xe74f('0x48')](handleError(_0x4a3296,null));};function getBucketslist(_0x18a4f0,_0x30b8e6,_0x562e57){return new Promise(function(_0x103b3f,_0x27d756){var _0x21ed21=new AWS['S3']({'accessKeyId':_0x30b8e6,'secretAccessKey':_0x18a4f0,'region':_0x562e57});_0x21ed21[_0xe74f('0x67')]({},function(_0x946961,_0x5c1397){if(_0x946961){return _0x27d756(_0x946961);}else{return _0x103b3f(_0x5c1397);}});});}function createBucket(_0x16c072,_0x2da392,_0x26fc14,_0x10a26a){return new Promise(function(_0x1211a2,_0x4cc718){var _0x4210a1=new AWS['S3']({'accessKeyId':_0x2da392,'secretAccessKey':_0x16c072,'region':_0x26fc14});_0x4210a1[_0xe74f('0x68')]({'Bucket':_0x10a26a},function(_0x2acbe3,_0xc10b6b){if(_0x2acbe3){return _0x4cc718(_0x2acbe3);}else{return _0x1211a2(_0xc10b6b);}});});}function uploadFile(_0x54d022,_0x1a51b3,_0x26dbf7,_0x34e922,_0x4e135d,_0x599e9a){return new Promise(function(_0x1fc082,_0xbba492){var _0x32a4a1=new AWS['S3']({'accessKeyId':_0x1a51b3,'secretAccessKey':_0x54d022,'region':_0x26dbf7});_0x32a4a1[_0xe74f('0x69')]({'Bucket':_0x34e922,'Key':_0x4e135d,'Body':_0x599e9a},function(_0x5df4a6,_0x452f78){if(_0x5df4a6){return _0xbba492(_0x5df4a6);}else{return _0x1fc082(_0x452f78);}});});}function startTranscribe(_0x522fde,_0x3b8589,_0x3d0487,_0x368d3e,_0x442556,_0x52ba40){return new Promise(function(_0x5aa29e,_0x49e44d){var _0x311015=new AWS[(_0xe74f('0x6a'))]({'accessKeyId':_0x3b8589,'secretAccessKey':_0x522fde,'region':_0x3d0487});_0x311015[_0xe74f('0x6b')]({'TranscriptionJobName':_0x368d3e,'LanguageCode':_0x442556,'Media':{'MediaFileUri':_0x52ba40}},function(_0x269397,_0x595ec5){if(_0x269397){return _0x49e44d(_0x269397);}else{return _0x5aa29e(_0x595ec5);}});});}function transcribe(_0xd53254,_0x46302b,_0x5e2c54,_0x36b28b,_0x1b0601,_0x24310e,_0x1508a7){return new Promise(function(_0x160564,_0x211093){var _0x81e45c={};logger[_0xe74f('0x63')](util[_0xe74f('0x32')](_0xe74f('0x6c'),_0xd53254,_0x1b0601));return uploadFile(_0x46302b,_0x5e2c54,_0x36b28b,_0x1b0601,path[_0xe74f('0x6d')](_0x24310e),fs['readFileSync'](_0x24310e))['then'](function(_0x48142d){logger['info'](util['format'](_0xe74f('0x6e'),_0xd53254,_0x1b0601,_0x48142d[_0xe74f('0x6f')]));_0x81e45c[_0xe74f('0x70')]=_0x48142d[_0xe74f('0x71')];_0x81e45c[_0xe74f('0x72')]=_0x48142d[_0xe74f('0x6f')];logger[_0xe74f('0x63')](util['format'](_0xe74f('0x73'),_0xd53254));return startTranscribe(_0x46302b,_0x5e2c54,_0x36b28b,uuidv4(),_0x1508a7,_0x48142d['Location']);})[_0xe74f('0x27')](function(_0x3d51df){logger['info'](util['format'](_0xe74f('0x74'),_0xd53254,_0x3d51df[_0xe74f('0x75')]['TranscriptionJobName']));_0x81e45c['transcribeName']=_0x3d51df[_0xe74f('0x75')]['TranscriptionJobName'];_0x81e45c[_0xe74f('0x76')]=_0x3d51df['TranscriptionJob']['TranscriptionJobStatus'];return _0x160564(_0x81e45c);})['catch'](function(_0x33d0b0){return _0x211093(_0x33d0b0);});});}exports[_0xe74f('0x77')]=function(_0x12e392,_0x150d1d,_0x119d3c){var _0x56c37a;var _0x20a19d;var _0x34cce4;var _0xe3d800=require('../../components/encryptor');return db[_0xe74f('0x2b')][_0xe74f('0x78')]({'where':{'id':_0x12e392['params']['id']}})[_0xe74f('0x27')](function(_0x36a7f6){if(_0x36a7f6){var _0x100e63=util[_0xe74f('0x32')](_0xe74f('0x4e'),_0x36a7f6['value']);if(fs[_0xe74f('0x4f')](_0x100e63)){cypher=!![];return _0xe3d800[_0xe74f('0x79')](_0x100e63,_0x36a7f6[_0xe74f('0x4d')],config[_0xe74f('0x50')][_0xe74f('0x60')])[_0xe74f('0x27')](function(){return _0x36a7f6;});}return _0x36a7f6;}})[_0xe74f('0x27')](function(_0x1bfe84){if(!_0x1bfe84){throw new db[(_0xe74f('0x51'))][(_0xe74f('0x61'))](_0xe74f('0x7a'));}_0x20a19d=_0x1bfe84;return db[_0xe74f('0x7b')][_0xe74f('0x78')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x150d1d,null))[_0xe74f('0x27')](function(_0x14aaf2){if(_0x14aaf2){_0x56c37a=_0x14aaf2;if(!_0x56c37a[_0xe74f('0x7c')]||!_0x56c37a[_0xe74f('0x7d')]||!_0x56c37a[_0xe74f('0x7e')]||!_0x56c37a[_0xe74f('0x7f')]||!_0x56c37a[_0xe74f('0x70')]){throw new db[(_0xe74f('0x51'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x12e392[_0xe74f('0x4a')][_0xe74f('0x80')]&&(!_0x56c37a[_0xe74f('0x81')]||!_0x56c37a['sentimentAccountId']||!_0x56c37a['sentimentRegion']||!_0x56c37a[_0xe74f('0x7f')]||!_0x56c37a[_0xe74f('0x70')])){throw new db[(_0xe74f('0x51'))][(_0xe74f('0x61'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xe74f('0x82')]['findOne']({'where':{'id':_0x56c37a[_0xe74f('0x7d')]}});}})['then'](function(_0x138d9d){if(!_0x138d9d){throw new db['Sequelize'][(_0xe74f('0x61'))](_0xe74f('0x83'));}if(!_0x138d9d['data1']||!_0x138d9d[_0xe74f('0x84')]){throw new db[(_0xe74f('0x51'))][(_0xe74f('0x61'))]('Cloud\x20Provider\x20not\x20configured');}_0x34cce4=_0x138d9d;return getBucketslist(_0x34cce4['data1'],_0x34cce4[_0xe74f('0x84')],_0x56c37a[_0xe74f('0x7e')]);})[_0xe74f('0x27')](function(_0x187621){if(_0x187621&&_0x187621[_0xe74f('0x85')]){var _0x24def3=_[_0xe74f('0x47')](_0x187621[_0xe74f('0x85')],function(_0x200e8b){return _0x200e8b[_0xe74f('0x86')]===_0x56c37a[_0xe74f('0x70')];});if(!_0x24def3){logger[_0xe74f('0x63')](util[_0xe74f('0x32')](_0xe74f('0x87'),_0x12e392['params']['id'],_0x56c37a['bucket']));return createBucket(_0x34cce4[_0xe74f('0x88')],_0x34cce4[_0xe74f('0x84')],_0x56c37a[_0xe74f('0x7e')],_0x56c37a['bucket']);}logger['info'](util[_0xe74f('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x12e392['params']['id'],_0x56c37a[_0xe74f('0x70')]));return;}})[_0xe74f('0x27')](function(_0xd151d9){if(_0x20a19d[_0xe74f('0x76')]===_0xe74f('0x89')){return transcribe(_0x12e392[_0xe74f('0x45')]['id'],_0x34cce4[_0xe74f('0x88')],_0x34cce4['data2'],_0x56c37a['transcribeRegion'],_0x56c37a[_0xe74f('0x70')],_0x20a19d[_0xe74f('0x4d')],_0x56c37a[_0xe74f('0x7f')]);}else{logger[_0xe74f('0x63')](util['format'](_0xe74f('0x8a'),_0x12e392[_0xe74f('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xe74f('0x27')](function(_0x38aff5){if(_0x38aff5){_0x38aff5['tempSentiment']=_0x12e392[_0xe74f('0x4a')][_0xe74f('0x80')];return _0x20a19d[_0xe74f('0x8b')](_0x38aff5);}})[_0xe74f('0x27')](respondWithResult(_0x150d1d,null))[_0xe74f('0x48')](handleError(_0x150d1d,null));};function writeFile(_0x5bf331,_0x545ba6){return new Promise(function(_0xdb42c2,_0x4a7a99){fs['writeFile'](_0x545ba6,_0x5bf331,function(_0x107efc,_0xf3101f){if(_0x107efc){return _0x4a7a99(_0x107efc);}else{return _0xdb42c2(_0xf3101f);}});});}exports[_0xe74f('0x8c')]=function(_0x279bf4,_0x573f14,_0x3dab62){return db['VoiceRecording'][_0xe74f('0x78')]({'where':{'id':_0x279bf4['params']['id']}})[_0xe74f('0x27')](handleEntityNotFound(_0x573f14))['then'](function(_0x4badab){if(_0x4badab&&_0x4badab[_0xe74f('0x8d')]){var _0x592bea=_0x4badab['fileText'];var _0x2e0e31=config['root']+_0xe74f('0x8e')+_0x4badab['id']+_0xe74f('0x8f');if(fs[_0xe74f('0x4f')](_0x2e0e31)){return _0x2e0e31;}return writeFile(_0x592bea,_0x2e0e31)[_0xe74f('0x27')](function(){return _0x2e0e31;});}else{throw new db[(_0xe74f('0x51'))][(_0xe74f('0x61'))](_0xe74f('0x90'));}})[_0xe74f('0x27')](function(_0x70d550){return _0x573f14[_0xe74f('0x53')](_0x70d550);})[_0xe74f('0x48')](handleError(_0x573f14));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 40443eb..6c9aa22 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 _0xba6c=['./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x562196,_0x42d870){var _0x3d4e29=function(_0x28be6b){while(--_0x28be6b){_0x562196['push'](_0x562196['shift']());}};_0x3d4e29(++_0x42d870);}(_0xba6c,0x113));var _0xcba6=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0xba6c[_0x44b7d6];return _0x5346f0;};'use strict';var attributes=require(_0xcba6('0x0'));module['exports']=function(_0x253b30,_0x1f7f77){return _0x253b30[_0xcba6('0x1')](_0xcba6('0x2'),attributes,{'tableName':_0xcba6('0x3'),'paranoid':![],'indexes':[{'name':_0xcba6('0x4'),'fields':[_0xcba6('0x4')]},{'name':'transcribeStatus','fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e9b=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','define','VoiceRecording'];(function(_0x3128f7,_0x5ec08a){var _0x5ce976=function(_0x463e28){while(--_0x463e28){_0x3128f7['push'](_0x3128f7['shift']());}};_0x5ce976(++_0x5ec08a);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0x9e9b[_0xa4928c];return _0x27cc29;};'use strict';var attributes=require(_0xb9e9('0x0'));module['exports']=function(_0x5af29a,_0x39a0db){return _0x5af29a[_0xb9e9('0x1')](_0xb9e9('0x2'),attributes,{'tableName':_0xb9e9('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb9e9('0x4')]},{'name':_0xb9e9('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 7aa29aa..8a42ad7 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x3ad737,_0x300131){var _0x16c1e2=function(_0x4c64fe){while(--_0x4c64fe){_0x3ad737['push'](_0x3ad737['shift']());}};_0x16c1e2(++_0x300131);}(_0xd943,0x15d));var _0x3d94=function(_0x510826,_0x1f0f82){_0x510826=_0x510826-0x0;var _0x294167=_0xd943[_0x510826];return _0x294167;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x8f4c=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x51f812,_0x36212c){var _0x1ad290=function(_0x1f03b7){while(--_0x1f03b7){_0x51f812['push'](_0x51f812['shift']());}};_0x1ad290(++_0x36212c);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3b0d12,_0x581b78){_0x3b0d12=_0x3b0d12-0x0;var _0x44eb08=_0x8f4c[_0x3b0d12];return _0x44eb08;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108076[_0xc8f4('0x1b')]?_0x108076['options'][_0xc8f4('0x1d')]||null:null,'attributes':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1e')]||null:null,'limit':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x5e62aa){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON['stringify'](_0x5e62aa));_0x4763c1(_0x5e62aa);})[_0xc8f4('0x16')](function(_0x4a44e0){logger[_0xc8f4('0x11')]('UpdateVoiceRecording',_0x4a44e0[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0x4a44e0['message']));});});};exports[_0xc8f4('0x20')]=function(_0x21062f){var _0x11f766=this;return new Promise(function(_0x2fa052,_0x4ce586){var _0x3db490=require(_0xc8f4('0x21'));var _0x5db666;return db[_0xc8f4('0x22')][_0xc8f4('0x23')]({'attributes':['id',_0xc8f4('0x24')],'where':{'id':0x1},'raw':!![]})[_0xc8f4('0xb')](function(_0x24bef0){_0x5db666=_0x24bef0;return db[_0xc8f4('0x18')]['create'](_0x21062f[_0xc8f4('0x1a')]);})[_0xc8f4('0xb')](function(_0x1ea3d9){if(_0x5db666['callRecordingEncryption']&&fs[_0xc8f4('0x25')](_0x1ea3d9[_0xc8f4('0x26')])){var _0x5ab6cb=util['format']('%s.cypher',_0x1ea3d9[_0xc8f4('0x26')]);return _0x3db490[_0xc8f4('0x27')](_0x1ea3d9[_0xc8f4('0x26')],_0x5ab6cb,config[_0xc8f4('0x28')][_0xc8f4('0x29')])[_0xc8f4('0xb')](function(){fs[_0xc8f4('0x2a')](_0x1ea3d9[_0xc8f4('0x26')]);logger['info'](_0xc8f4('0x2b'));return _0x1ea3d9;});}return _0x1ea3d9;})[_0xc8f4('0xb')](function(_0x3910f3){logger['info'](_0xc8f4('0x20'),_0x21062f);logger[_0xc8f4('0xe')]('CreateVoiceRecording',_0x21062f,JSON[_0xc8f4('0x10')](_0x3910f3));_0x2fa052(_0x3910f3);})[_0xc8f4('0x16')](function(_0x36f24f){logger['error'](_0xc8f4('0x20'),_0x36f24f[_0xc8f4('0x13')],_0x21062f);_0x4ce586(_0x11f766[_0xc8f4('0x11')](0x1f4,_0x36f24f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 372f295..9eb664a 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 _0x0ef6=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x0ef6,0xda));var _0x60ef=function(_0x7396ee,_0xe21418){_0x7396ee=_0x7396ee-0x0;var _0x55950a=_0x0ef6[_0x7396ee];return _0x55950a;};'use strict';var multer=require(_0x60ef('0x0'));var util=require(_0x60ef('0x1'));var path=require('path');var timeout=require(_0x60ef('0x2'));var express=require('express');var router=express[_0x60ef('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x60ef('0x4'));var controller=require(_0x60ef('0x5'));router[_0x60ef('0x6')]('/',auth[_0x60ef('0x7')](),controller[_0x60ef('0x8')]);router['get']('/describe',auth[_0x60ef('0x7')](),controller[_0x60ef('0x9')]);router['get']('/:id',auth[_0x60ef('0x7')](),controller[_0x60ef('0xa')]);router[_0x60ef('0xb')]('/',auth[_0x60ef('0x7')](),controller[_0x60ef('0xc')]);router[_0x60ef('0xd')](_0x60ef('0xe'),auth[_0x60ef('0x7')](),controller[_0x60ef('0xf')]);router[_0x60ef('0x10')](_0x60ef('0xe'),auth[_0x60ef('0x7')](),controller[_0x60ef('0x11')]);module[_0x60ef('0x12')]=router; \ No newline at end of file +var _0x7352=['/describe','describe','get','show','post','create','put','/:id','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','isAuthenticated','index'];(function(_0x2e24d0,_0x34db1d){var _0x5aec4a=function(_0x1dbf44){while(--_0x1dbf44){_0x2e24d0['push'](_0x2e24d0['shift']());}};_0x5aec4a(++_0x34db1d);}(_0x7352,0xbe));var _0x2735=function(_0x5a4744,_0x2310bd){_0x5a4744=_0x5a4744-0x0;var _0x41f496=_0x7352[_0x5a4744];return _0x41f496;};'use strict';var multer=require('multer');var util=require(_0x2735('0x0'));var path=require('path');var timeout=require(_0x2735('0x1'));var express=require(_0x2735('0x2'));var router=express[_0x2735('0x3')]();var fs_extra=require(_0x2735('0x4'));var auth=require(_0x2735('0x5'));var interaction=require(_0x2735('0x6'));var config=require('../../config/environment');var controller=require(_0x2735('0x7'));router['get']('/',auth[_0x2735('0x8')](),controller[_0x2735('0x9')]);router['get'](_0x2735('0xa'),auth[_0x2735('0x8')](),controller[_0x2735('0xb')]);router[_0x2735('0xc')]('/:id',auth[_0x2735('0x8')](),controller[_0x2735('0xd')]);router[_0x2735('0xe')]('/',auth[_0x2735('0x8')](),controller[_0x2735('0xf')]);router[_0x2735('0x10')](_0x2735('0x11'),auth['isAuthenticated'](),controller[_0x2735('0x12')]);router['delete'](_0x2735('0x11'),auth[_0x2735('0x8')](),controller['destroy']);module[_0x2735('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 8c4fe81..56d09ad 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 _0x4720=['blind','STRING','moment','exports','ENUM'];(function(_0x1b4d39,_0x480366){var _0x511ddd=function(_0x275ed3){while(--_0x275ed3){_0x1b4d39['push'](_0x1b4d39['shift']());}};_0x511ddd(++_0x480366);}(_0x4720,0xe3));var _0x0472=function(_0x149319,_0x4182b5){_0x149319=_0x149319-0x0;var _0x4637c9=_0x4720[_0x149319];return _0x4637c9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0472('0x0'));module[_0x0472('0x1')]={'type':{'type':Sequelize[_0x0472('0x2')](_0x0472('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x0472('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x0472('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x0472('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x0472('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x0472('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x0472('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x0472('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0472('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x0472('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x0472('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x0472('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x0472('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x0472('0x4')]},'extension':{'type':Sequelize[_0x0472('0x4')]}}; \ No newline at end of file +var _0xbcda=['ENUM','blind','STRING','sequelize','moment','exports'];(function(_0x46dec4,_0x1fd050){var _0x319ab7=function(_0x1864f0){while(--_0x1864f0){_0x46dec4['push'](_0x46dec4['shift']());}};_0x319ab7(++_0x1fd050);}(_0xbcda,0xe1));var _0xabcd=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xbcda[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0xabcd('0x0'));var moment=require(_0xabcd('0x1'));module[_0xabcd('0x2')]={'type':{'type':Sequelize[_0xabcd('0x3')](_0xabcd('0x4'),'attended')},'result':{'type':Sequelize[_0xabcd('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xabcd('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xabcd('0x5')]},'transferercontext':{'type':Sequelize[_0xabcd('0x5')]},'transfererexten':{'type':Sequelize[_0xabcd('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xabcd('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xabcd('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xabcd('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xabcd('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xabcd('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xabcd('0x5')]},'isexternal':{'type':Sequelize[_0xabcd('0x3')]('Yes','No')},'context':{'type':Sequelize[_0xabcd('0x5')]},'extension':{'type':Sequelize[_0xabcd('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8e6419c..0905cff 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 _0x5ed2=['path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','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','undefined','limit','offset','set','apply','reject','save','update','destroy','then','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5ed2,0xe2));var _0x25ed=function(_0x1e0d9a,_0x214450){_0x1e0d9a=_0x1e0d9a-0x0;var _0x36cbe0=_0x5ed2[_0x1e0d9a];return _0x36cbe0;};'use strict';var emlformat=require(_0x25ed('0x0'));var rimraf=require(_0x25ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25ed('0x2'));var rp=require(_0x25ed('0x3'));var moment=require(_0x25ed('0x4'));var BPromise=require(_0x25ed('0x5'));var Mustache=require(_0x25ed('0x6'));var util=require(_0x25ed('0x7'));var path=require(_0x25ed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25ed('0xa'));var crypto=require(_0x25ed('0xb'));var jsforce=require(_0x25ed('0xc'));var deskjs=require(_0x25ed('0xd'));var toCsv=require(_0x25ed('0xe'));var querystring=require(_0x25ed('0xf'));var Papa=require('papaparse');var Redis=require(_0x25ed('0x10'));var authService=require(_0x25ed('0x11'));var qs=require(_0x25ed('0x12'));var as=require(_0x25ed('0x13'));var hardwareService=require(_0x25ed('0x14'));var logger=require(_0x25ed('0x15'))(_0x25ed('0x16'));var utils=require('../../config/utils');var config=require(_0x25ed('0x17'));var licenseUtil=require(_0x25ed('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ab799,_0x447247){_0x447247=_0x447247||0xcc;return function(_0x46ba91){if(_0x46ba91){return _0x4ab799[_0x25ed('0x19')](_0x447247);}return _0x4ab799['status'](_0x447247)[_0x25ed('0x1a')]();};}function respondWithResult(_0x25ee96,_0x25492c){_0x25492c=_0x25492c||0xc8;return function(_0x2cda4){if(_0x2cda4){return _0x25ee96[_0x25ed('0x1b')](_0x25492c)[_0x25ed('0x1c')](_0x2cda4);}};}function respondWithFilteredResult(_0x20386f,_0x4337df){return function(_0x558e17){if(_0x558e17){var _0x2a74d0=typeof _0x4337df['offset']===_0x25ed('0x1d')&&typeof _0x4337df[_0x25ed('0x1e')]===_0x25ed('0x1d');var _0x37f2da=_0x558e17['count'];var _0x3ad784=_0x2a74d0?0x0:_0x4337df[_0x25ed('0x1f')];var _0x416383=_0x2a74d0?_0x558e17['count']:_0x4337df[_0x25ed('0x1f')]+_0x4337df[_0x25ed('0x1e')];var _0xa689c4;if(_0x416383>=_0x37f2da){_0x416383=_0x37f2da;_0xa689c4=0xc8;}else{_0xa689c4=0xce;}_0x20386f['status'](_0xa689c4);return _0x20386f[_0x25ed('0x20')]('Content-Range',_0x3ad784+'-'+_0x416383+'/'+_0x37f2da)[_0x25ed('0x1c')](_0x558e17);}return null;};}function patchUpdates(_0x5e23eb){return function(_0xb5a02f){try{jsonpatch[_0x25ed('0x21')](_0xb5a02f,_0x5e23eb,!![]);}catch(_0x3f9d13){return BPromise[_0x25ed('0x22')](_0x3f9d13);}return _0xb5a02f[_0x25ed('0x23')]();};}function saveUpdates(_0x434e44,_0x4da8a8){return function(_0x104bfc){if(_0x104bfc){return _0x104bfc[_0x25ed('0x24')](_0x434e44)['then'](function(_0x17f2c7){return _0x17f2c7;});}return null;};}function removeEntity(_0x3d8b3f,_0x575d1c){return function(_0x5e2d01){if(_0x5e2d01){return _0x5e2d01[_0x25ed('0x25')]()[_0x25ed('0x26')](function(){_0x3d8b3f[_0x25ed('0x1b')](0xcc)[_0x25ed('0x1a')]();});}};}function handleEntityNotFound(_0xf722ff,_0x5e42ee){return function(_0x24b7fb){if(!_0x24b7fb){_0xf722ff[_0x25ed('0x19')](0x194);}return _0x24b7fb;};}function handleError(_0x376c69,_0x23af0e){_0x23af0e=_0x23af0e||0x1f4;return function(_0x550399){logger[_0x25ed('0x27')](_0x550399['stack']);if(_0x550399['name']){delete _0x550399[_0x25ed('0x28')];}_0x376c69[_0x25ed('0x1b')](_0x23af0e)[_0x25ed('0x29')](_0x550399);};}exports[_0x25ed('0x2a')]=function(_0x4d2ffc,_0xeaf92f){var _0xd8490f={},_0xde67a2={},_0x44d746={'count':0x0,'rows':[]};var _0xbe1d83=_[_0x25ed('0x2b')](db[_0x25ed('0x2c')][_0x25ed('0x2d')],function(_0x8bb719){return{'name':_0x8bb719[_0x25ed('0x2e')],'type':_0x8bb719[_0x25ed('0x2f')]['key']};});_0xde67a2[_0x25ed('0x30')]=_[_0x25ed('0x2b')](_0xbe1d83,_0x25ed('0x28'));_0xde67a2[_0x25ed('0x31')]=_[_0x25ed('0x32')](_0x4d2ffc[_0x25ed('0x31')]);_0xde67a2[_0x25ed('0x33')]=_[_0x25ed('0x34')](_0xde67a2[_0x25ed('0x30')],_0xde67a2[_0x25ed('0x31')]);_0xd8490f['attributes']=_[_0x25ed('0x34')](_0xde67a2[_0x25ed('0x30')],qs[_0x25ed('0x35')](_0x4d2ffc['query'][_0x25ed('0x35')]));_0xd8490f[_0x25ed('0x36')]=_0xd8490f[_0x25ed('0x36')][_0x25ed('0x37')]?_0xd8490f[_0x25ed('0x36')]:_0xde67a2['model'];if(!_0x4d2ffc['query'][_0x25ed('0x38')](_0x25ed('0x39'))){_0xd8490f[_0x25ed('0x1e')]=qs[_0x25ed('0x1e')](_0x4d2ffc[_0x25ed('0x31')][_0x25ed('0x1e')]);_0xd8490f[_0x25ed('0x1f')]=qs[_0x25ed('0x1f')](_0x4d2ffc['query'][_0x25ed('0x1f')]);}_0xd8490f[_0x25ed('0x3a')]=qs[_0x25ed('0x3b')](_0x4d2ffc[_0x25ed('0x31')][_0x25ed('0x3b')]);_0xd8490f['where']=qs[_0x25ed('0x33')](_[_0x25ed('0x3c')](_0x4d2ffc[_0x25ed('0x31')],_0xde67a2[_0x25ed('0x33')]),_0xbe1d83);if(_0x4d2ffc[_0x25ed('0x31')]['filter']){_0xd8490f['where']=_[_0x25ed('0x3d')](_0xd8490f[_0x25ed('0x3e')],{'$or':_[_0x25ed('0x2b')](_0xbe1d83,function(_0x50fa3f){if(_0x50fa3f[_0x25ed('0x2f')]!==_0x25ed('0x3f')){var _0x4abc4a={};_0x4abc4a[_0x50fa3f[_0x25ed('0x28')]]={'$like':'%'+_0x4d2ffc[_0x25ed('0x31')][_0x25ed('0x40')]+'%'};return _0x4abc4a;}})});}_0xd8490f=_[_0x25ed('0x3d')]({},_0xd8490f,_0x4d2ffc[_0x25ed('0x41')]);var _0x231ef7={'where':_0xd8490f[_0x25ed('0x3e')]};return db[_0x25ed('0x2c')][_0x25ed('0x42')](_0x231ef7)[_0x25ed('0x26')](function(_0x44faa8){_0x44d746[_0x25ed('0x42')]=_0x44faa8;if(_0x4d2ffc[_0x25ed('0x31')][_0x25ed('0x43')]){_0xd8490f[_0x25ed('0x44')]=[{'all':!![]}];}return db[_0x25ed('0x2c')][_0x25ed('0x45')](_0xd8490f);})['then'](function(_0x2ed766){_0x44d746[_0x25ed('0x46')]=_0x2ed766;return _0x44d746;})[_0x25ed('0x26')](respondWithFilteredResult(_0xeaf92f,_0xd8490f))[_0x25ed('0x47')](handleError(_0xeaf92f,null));};exports[_0x25ed('0x48')]=function(_0x238f69,_0x1fed22){var _0x1bff32={'raw':!![],'where':{'id':_0x238f69[_0x25ed('0x49')]['id']}},_0x22f630={};_0x22f630[_0x25ed('0x30')]=_['keys'](db[_0x25ed('0x2c')][_0x25ed('0x2d')]);_0x22f630[_0x25ed('0x31')]=_[_0x25ed('0x32')](_0x238f69[_0x25ed('0x31')]);_0x22f630[_0x25ed('0x33')]=_[_0x25ed('0x34')](_0x22f630[_0x25ed('0x30')],_0x22f630[_0x25ed('0x31')]);_0x1bff32[_0x25ed('0x36')]=_[_0x25ed('0x34')](_0x22f630[_0x25ed('0x30')],qs['fields'](_0x238f69['query'][_0x25ed('0x35')]));_0x1bff32[_0x25ed('0x36')]=_0x1bff32[_0x25ed('0x36')][_0x25ed('0x37')]?_0x1bff32[_0x25ed('0x36')]:_0x22f630[_0x25ed('0x30')];if(_0x238f69[_0x25ed('0x31')][_0x25ed('0x43')]){_0x1bff32[_0x25ed('0x44')]=[{'all':!![]}];}_0x1bff32=_[_0x25ed('0x3d')]({},_0x1bff32,_0x238f69['options']);return db[_0x25ed('0x2c')][_0x25ed('0x4a')](_0x1bff32)[_0x25ed('0x26')](handleEntityNotFound(_0x1fed22,null))[_0x25ed('0x26')](respondWithResult(_0x1fed22,null))[_0x25ed('0x47')](handleError(_0x1fed22,null));};exports[_0x25ed('0x4b')]=function(_0x19ed0c,_0x52f5ab){return db['VoiceTransferReport']['create'](_0x19ed0c[_0x25ed('0x4c')],{})[_0x25ed('0x26')](respondWithResult(_0x52f5ab,0xc9))[_0x25ed('0x47')](handleError(_0x52f5ab,null));};exports[_0x25ed('0x24')]=function(_0x34aa6e,_0x5012c0){if(_0x34aa6e[_0x25ed('0x4c')]['id']){delete _0x34aa6e[_0x25ed('0x4c')]['id'];}return db[_0x25ed('0x2c')][_0x25ed('0x4a')]({'where':{'id':_0x34aa6e[_0x25ed('0x49')]['id']}})[_0x25ed('0x26')](handleEntityNotFound(_0x5012c0,null))['then'](saveUpdates(_0x34aa6e[_0x25ed('0x4c')],null))['then'](respondWithResult(_0x5012c0,null))[_0x25ed('0x47')](handleError(_0x5012c0,null));};exports[_0x25ed('0x25')]=function(_0x2b18e3,_0x35ad70){return db[_0x25ed('0x2c')][_0x25ed('0x4a')]({'where':{'id':_0x2b18e3[_0x25ed('0x49')]['id']}})[_0x25ed('0x26')](handleEntityNotFound(_0x35ad70,null))[_0x25ed('0x26')](removeEntity(_0x35ad70,null))[_0x25ed('0x47')](handleError(_0x35ad70,null));};exports[_0x25ed('0x4d')]=function(_0x3c3890,_0xfbe3cc){return db[_0x25ed('0x2c')][_0x25ed('0x4d')]()['then'](respondWithResult(_0xfbe3cc,null))[_0x25ed('0x47')](handleError(_0xfbe3cc,null));}; \ No newline at end of file +var _0x58a8=['attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','intersection'];(function(_0x16667a,_0x40fe6e){var _0x535ddb=function(_0x56aa68){while(--_0x56aa68){_0x16667a['push'](_0x16667a['shift']());}};_0x535ddb(++_0x40fe6e);}(_0x58a8,0xa7));var _0x858a=function(_0x3076f9,_0x379308){_0x3076f9=_0x3076f9-0x0;var _0x552d12=_0x58a8[_0x3076f9];return _0x552d12;};'use strict';var emlformat=require(_0x858a('0x0'));var rimraf=require(_0x858a('0x1'));var zipdir=require(_0x858a('0x2'));var jsonpatch=require(_0x858a('0x3'));var rp=require(_0x858a('0x4'));var moment=require(_0x858a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x858a('0x6'));var util=require(_0x858a('0x7'));var path=require(_0x858a('0x8'));var sox=require(_0x858a('0x9'));var csv=require(_0x858a('0xa'));var ejs=require(_0x858a('0xb'));var fs=require('fs');var fs_extra=require(_0x858a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x858a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x858a('0xa'));var querystring=require(_0x858a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x858a('0xf'));var qs=require(_0x858a('0x10'));var as=require(_0x858a('0x11'));var hardwareService=require(_0x858a('0x12'));var logger=require(_0x858a('0x13'))(_0x858a('0x14'));var utils=require('../../config/utils');var config=require(_0x858a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x858a('0x16'))['db'];function respondWithStatusCode(_0x3f90fc,_0x140a70){_0x140a70=_0x140a70||0xcc;return function(_0x33a473){if(_0x33a473){return _0x3f90fc['sendStatus'](_0x140a70);}return _0x3f90fc['status'](_0x140a70)[_0x858a('0x17')]();};}function respondWithResult(_0x218db6,_0x3a0f84){_0x3a0f84=_0x3a0f84||0xc8;return function(_0x34a23e){if(_0x34a23e){return _0x218db6[_0x858a('0x18')](_0x3a0f84)['json'](_0x34a23e);}};}function respondWithFilteredResult(_0x3bdf48,_0x1c674a){return function(_0x2aba6e){if(_0x2aba6e){var _0x2c036e=typeof _0x1c674a[_0x858a('0x19')]===_0x858a('0x1a')&&typeof _0x1c674a['limit']===_0x858a('0x1a');var _0x5f1713=_0x2aba6e[_0x858a('0x1b')];var _0x25c48f=_0x2c036e?0x0:_0x1c674a[_0x858a('0x19')];var _0x26a9dc=_0x2c036e?_0x2aba6e[_0x858a('0x1b')]:_0x1c674a[_0x858a('0x19')]+_0x1c674a[_0x858a('0x1c')];var _0x3bdf9b;if(_0x26a9dc>=_0x5f1713){_0x26a9dc=_0x5f1713;_0x3bdf9b=0xc8;}else{_0x3bdf9b=0xce;}_0x3bdf48['status'](_0x3bdf9b);return _0x3bdf48[_0x858a('0x1d')](_0x858a('0x1e'),_0x25c48f+'-'+_0x26a9dc+'/'+_0x5f1713)[_0x858a('0x1f')](_0x2aba6e);}return null;};}function patchUpdates(_0x452391){return function(_0x265f29){try{jsonpatch[_0x858a('0x20')](_0x265f29,_0x452391,!![]);}catch(_0x40afc0){return BPromise[_0x858a('0x21')](_0x40afc0);}return _0x265f29[_0x858a('0x22')]();};}function saveUpdates(_0x366b16,_0x190b99){return function(_0x424751){if(_0x424751){return _0x424751[_0x858a('0x23')](_0x366b16)['then'](function(_0x4d1a98){return _0x4d1a98;});}return null;};}function removeEntity(_0x5bdbd5,_0x24f96c){return function(_0x317163){if(_0x317163){return _0x317163[_0x858a('0x24')]()[_0x858a('0x25')](function(){_0x5bdbd5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f80a,_0x3b7272){return function(_0x131e95){if(!_0x131e95){_0x40f80a[_0x858a('0x26')](0x194);}return _0x131e95;};}function handleError(_0x18222a,_0x53b245){_0x53b245=_0x53b245||0x1f4;return function(_0x199807){logger[_0x858a('0x27')](_0x199807['stack']);if(_0x199807[_0x858a('0x28')]){delete _0x199807['name'];}_0x18222a[_0x858a('0x18')](_0x53b245)[_0x858a('0x29')](_0x199807);};}exports[_0x858a('0x2a')]=function(_0x211072,_0x17184a){var _0x297591={},_0x14fed5={},_0x103ad4={'count':0x0,'rows':[]};var _0x5605c5=_[_0x858a('0x2b')](db[_0x858a('0x2c')]['rawAttributes'],function(_0x41f564){return{'name':_0x41f564[_0x858a('0x2d')],'type':_0x41f564[_0x858a('0x2e')][_0x858a('0x2f')]};});_0x14fed5[_0x858a('0x30')]=_[_0x858a('0x2b')](_0x5605c5,_0x858a('0x28'));_0x14fed5[_0x858a('0x31')]=_[_0x858a('0x32')](_0x211072[_0x858a('0x31')]);_0x14fed5['filters']=_[_0x858a('0x33')](_0x14fed5['model'],_0x14fed5[_0x858a('0x31')]);_0x297591[_0x858a('0x34')]=_[_0x858a('0x33')](_0x14fed5['model'],qs[_0x858a('0x35')](_0x211072[_0x858a('0x31')][_0x858a('0x35')]));_0x297591['attributes']=_0x297591['attributes'][_0x858a('0x36')]?_0x297591[_0x858a('0x34')]:_0x14fed5[_0x858a('0x30')];if(!_0x211072['query']['hasOwnProperty'](_0x858a('0x37'))){_0x297591[_0x858a('0x1c')]=qs['limit'](_0x211072[_0x858a('0x31')][_0x858a('0x1c')]);_0x297591[_0x858a('0x19')]=qs[_0x858a('0x19')](_0x211072['query']['offset']);}_0x297591[_0x858a('0x38')]=qs[_0x858a('0x39')](_0x211072[_0x858a('0x31')]['sort']);_0x297591[_0x858a('0x3a')]=qs[_0x858a('0x3b')](_['pick'](_0x211072[_0x858a('0x31')],_0x14fed5[_0x858a('0x3b')]),_0x5605c5);if(_0x211072[_0x858a('0x31')][_0x858a('0x3c')]){_0x297591[_0x858a('0x3a')]=_['merge'](_0x297591[_0x858a('0x3a')],{'$or':_[_0x858a('0x2b')](_0x5605c5,function(_0x1c8e48){if(_0x1c8e48[_0x858a('0x2e')]!=='VIRTUAL'){var _0x2b359e={};_0x2b359e[_0x1c8e48[_0x858a('0x28')]]={'$like':'%'+_0x211072['query'][_0x858a('0x3c')]+'%'};return _0x2b359e;}})});}_0x297591=_[_0x858a('0x3d')]({},_0x297591,_0x211072['options']);var _0x9d7f31={'where':_0x297591[_0x858a('0x3a')]};return db['VoiceTransferReport'][_0x858a('0x1b')](_0x9d7f31)[_0x858a('0x25')](function(_0x487d9b){_0x103ad4[_0x858a('0x1b')]=_0x487d9b;if(_0x211072['query'][_0x858a('0x3e')]){_0x297591[_0x858a('0x3f')]=[{'all':!![]}];}return db[_0x858a('0x2c')][_0x858a('0x40')](_0x297591);})[_0x858a('0x25')](function(_0x4e5b06){_0x103ad4[_0x858a('0x41')]=_0x4e5b06;return _0x103ad4;})[_0x858a('0x25')](respondWithFilteredResult(_0x17184a,_0x297591))[_0x858a('0x42')](handleError(_0x17184a,null));};exports['show']=function(_0x19f7fc,_0x59d6f6){var _0x29d5cc={'raw':!![],'where':{'id':_0x19f7fc[_0x858a('0x43')]['id']}},_0x20b126={};_0x20b126[_0x858a('0x30')]=_[_0x858a('0x32')](db[_0x858a('0x2c')]['rawAttributes']);_0x20b126[_0x858a('0x31')]=_[_0x858a('0x32')](_0x19f7fc['query']);_0x20b126['filters']=_[_0x858a('0x33')](_0x20b126[_0x858a('0x30')],_0x20b126[_0x858a('0x31')]);_0x29d5cc[_0x858a('0x34')]=_[_0x858a('0x33')](_0x20b126[_0x858a('0x30')],qs[_0x858a('0x35')](_0x19f7fc[_0x858a('0x31')][_0x858a('0x35')]));_0x29d5cc[_0x858a('0x34')]=_0x29d5cc[_0x858a('0x34')][_0x858a('0x36')]?_0x29d5cc[_0x858a('0x34')]:_0x20b126[_0x858a('0x30')];if(_0x19f7fc['query']['includeAll']){_0x29d5cc[_0x858a('0x3f')]=[{'all':!![]}];}_0x29d5cc=_[_0x858a('0x3d')]({},_0x29d5cc,_0x19f7fc[_0x858a('0x44')]);return db['VoiceTransferReport'][_0x858a('0x45')](_0x29d5cc)[_0x858a('0x25')](handleEntityNotFound(_0x59d6f6,null))['then'](respondWithResult(_0x59d6f6,null))[_0x858a('0x42')](handleError(_0x59d6f6,null));};exports[_0x858a('0x46')]=function(_0xee88f0,_0x101021){return db[_0x858a('0x2c')][_0x858a('0x46')](_0xee88f0['body'],{})[_0x858a('0x25')](respondWithResult(_0x101021,0xc9))[_0x858a('0x42')](handleError(_0x101021,null));};exports['update']=function(_0x38e35c,_0x2d3fc9){if(_0x38e35c[_0x858a('0x47')]['id']){delete _0x38e35c['body']['id'];}return db[_0x858a('0x2c')]['find']({'where':{'id':_0x38e35c[_0x858a('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d3fc9,null))[_0x858a('0x25')](saveUpdates(_0x38e35c['body'],null))[_0x858a('0x25')](respondWithResult(_0x2d3fc9,null))[_0x858a('0x42')](handleError(_0x2d3fc9,null));};exports[_0x858a('0x24')]=function(_0xa5a2c4,_0x3f0992){return db[_0x858a('0x2c')][_0x858a('0x45')]({'where':{'id':_0xa5a2c4[_0x858a('0x43')]['id']}})[_0x858a('0x25')](handleEntityNotFound(_0x3f0992,null))['then'](removeEntity(_0x3f0992,null))[_0x858a('0x42')](handleError(_0x3f0992,null));};exports[_0x858a('0x48')]=function(_0x291763,_0x535d6b){return db[_0x858a('0x2c')][_0x858a('0x48')]()[_0x858a('0x25')](respondWithResult(_0x535d6b,null))[_0x858a('0x42')](handleError(_0x535d6b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c37adb2..d8d1747 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 _0x65ee=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2812c2,_0x2b382d){var _0x218ac9=function(_0x2fe4c4){while(--_0x2fe4c4){_0x2812c2['push'](_0x2812c2['shift']());}};_0x218ac9(++_0x2b382d);}(_0x65ee,0x160));var _0xe65e=function(_0x81796c,_0x32c669){_0x81796c=_0x81796c-0x0;var _0x597a00=_0x65ee[_0x81796c];return _0x597a00;};'use strict';var _=require(_0xe65e('0x0'));var util=require(_0xe65e('0x1'));var logger=require(_0xe65e('0x2'))(_0xe65e('0x3'));var moment=require(_0xe65e('0x4'));var BPromise=require(_0xe65e('0x5'));var rp=require(_0xe65e('0x6'));var fs=require('fs');var path=require(_0xe65e('0x7'));var rimraf=require(_0xe65e('0x8'));var config=require(_0xe65e('0x9'));var attributes=require(_0xe65e('0xa'));module[_0xe65e('0xb')]=function(_0x53fdfb,_0x38d046){return _0x53fdfb[_0xe65e('0xc')](_0xe65e('0xd'),attributes,{'tableName':_0xe65e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76be=['VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x4257a5,_0x168b5a){var _0x668494=function(_0x4f986a){while(--_0x4f986a){_0x4257a5['push'](_0x4257a5['shift']());}};_0x668494(++_0x168b5a);}(_0x76be,0x154));var _0xe76b=function(_0x981602,_0x261528){_0x981602=_0x981602-0x0;var _0x116340=_0x76be[_0x981602];return _0x116340;};'use strict';var _=require(_0xe76b('0x0'));var util=require('util');var logger=require(_0xe76b('0x1'))(_0xe76b('0x2'));var moment=require('moment');var BPromise=require(_0xe76b('0x3'));var rp=require(_0xe76b('0x4'));var fs=require('fs');var path=require(_0xe76b('0x5'));var rimraf=require(_0xe76b('0x6'));var config=require(_0xe76b('0x7'));var attributes=require(_0xe76b('0x8'));module[_0xe76b('0x9')]=function(_0x27d2e5,_0x39b2a3){return _0x27d2e5[_0xe76b('0xa')](_0xe76b('0xb'),attributes,{'tableName':_0xe76b('0xc'),'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 1a7b881..dd14a52 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 _0x9ea6=['ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify','lodash','randomstring'];(function(_0x2a9c14,_0x5f0468){var _0x4c44b6=function(_0x120073){while(--_0x120073){_0x2a9c14['push'](_0x2a9c14['shift']());}};_0x4c44b6(++_0x5f0468);}(_0x9ea6,0x102));var _0x69ea=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9ea6[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x69ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x69ea('0x1'));var fs=require('fs');var Redis=require(_0x69ea('0x2'));var db=require(_0x69ea('0x3'))['db'];var utils=require(_0x69ea('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x69ea('0x5'));var client=jayson[_0x69ea('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5250da,_0x423ea0,_0x1b906f){return new BPromise(function(_0x149858,_0x4b147b){return client[_0x69ea('0x7')](_0x5250da,_0x1b906f)[_0x69ea('0x8')](function(_0x1aa4d0){logger[_0x69ea('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0x423ea0,_0x69ea('0xa'));logger[_0x69ea('0xb')](_0x69ea('0xc'),_0x423ea0,_0x69ea('0xa'),JSON['stringify'](_0x1aa4d0));if(_0x1aa4d0[_0x69ea('0xd')]){if(_0x1aa4d0[_0x69ea('0xd')][_0x69ea('0xe')]===0x1f4){logger[_0x69ea('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x423ea0,_0x1aa4d0[_0x69ea('0xd')][_0x69ea('0xf')]);return _0x4b147b(_0x1aa4d0[_0x69ea('0xd')][_0x69ea('0xf')]);}logger[_0x69ea('0xd')](_0x69ea('0x10'),_0x423ea0,_0x1aa4d0[_0x69ea('0xd')][_0x69ea('0xf')]);return _0x149858(_0x1aa4d0[_0x69ea('0xd')]['message']);}else{logger[_0x69ea('0x9')](_0x69ea('0x10'),_0x423ea0,_0x69ea('0xa'));_0x149858(_0x1aa4d0[_0x69ea('0x11')][_0x69ea('0xf')]);}})[_0x69ea('0x12')](function(_0xdec30a){logger[_0x69ea('0xd')](_0x69ea('0x10'),_0x423ea0,_0xdec30a);_0x4b147b(_0xdec30a);});});}exports[_0x69ea('0x13')]=function(_0x59a668){var _0x182951=this;return new Promise(function(_0x36ead3,_0xe25cd1){return db[_0x69ea('0x14')][_0x69ea('0x15')](_0x59a668[_0x69ea('0x16')],{'raw':_0x59a668[_0x69ea('0x17')]?_0x59a668['options'][_0x69ea('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2bef51){logger[_0x69ea('0x9')](_0x69ea('0x13'),_0x59a668);logger[_0x69ea('0xb')](_0x69ea('0x13'),_0x59a668,JSON[_0x69ea('0x19')](_0x2bef51));_0x36ead3(_0x2bef51);})['catch'](function(_0x5d5c04){logger[_0x69ea('0xd')](_0x69ea('0x13'),_0x5d5c04['message'],_0x59a668);_0xe25cd1(_0x182951[_0x69ea('0xd')](0x1f4,_0x5d5c04[_0x69ea('0xf')]));});});}; \ No newline at end of file +var _0x0c84=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','util','moment','bluebird'];(function(_0x28e30a,_0x514484){var _0x1aa1f3=function(_0x4c6a59){while(--_0x4c6a59){_0x28e30a['push'](_0x28e30a['shift']());}};_0x1aa1f3(++_0x514484);}(_0x0c84,0x1c8));var _0x40c8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0c84[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x40c8('0x0'));var moment=require(_0x40c8('0x1'));var BPromise=require(_0x40c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x40c8('0x4'));var logger=require('../../config/logger')(_0x40c8('0x5'));var config=require(_0x40c8('0x6'));var jayson=require(_0x40c8('0x7'));var client=jayson['client'][_0x40c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e0bf6,_0xb55dc9,_0x418292){return new BPromise(function(_0x13957a,_0x402591){return client[_0x40c8('0x9')](_0x4e0bf6,_0x418292)['then'](function(_0x495394){logger[_0x40c8('0xa')](_0x40c8('0xb'),_0xb55dc9,_0x40c8('0xc'));logger['debug'](_0x40c8('0xd'),_0xb55dc9,_0x40c8('0xc'),JSON[_0x40c8('0xe')](_0x495394));if(_0x495394[_0x40c8('0xf')]){if(_0x495394[_0x40c8('0xf')][_0x40c8('0x10')]===0x1f4){logger['error'](_0x40c8('0xb'),_0xb55dc9,_0x495394[_0x40c8('0xf')][_0x40c8('0x11')]);return _0x402591(_0x495394[_0x40c8('0xf')][_0x40c8('0x11')]);}logger[_0x40c8('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xb55dc9,_0x495394[_0x40c8('0xf')][_0x40c8('0x11')]);return _0x13957a(_0x495394[_0x40c8('0xf')][_0x40c8('0x11')]);}else{logger[_0x40c8('0xa')](_0x40c8('0xb'),_0xb55dc9,_0x40c8('0xc'));_0x13957a(_0x495394[_0x40c8('0x12')][_0x40c8('0x11')]);}})[_0x40c8('0x13')](function(_0x2051a7){logger[_0x40c8('0xf')](_0x40c8('0xb'),_0xb55dc9,_0x2051a7);_0x402591(_0x2051a7);});});}exports[_0x40c8('0x14')]=function(_0x1ae56e){var _0x4092dd=this;return new Promise(function(_0x411534,_0x18c381){return db[_0x40c8('0x15')][_0x40c8('0x16')](_0x1ae56e[_0x40c8('0x17')],{'raw':_0x1ae56e[_0x40c8('0x18')]?_0x1ae56e[_0x40c8('0x18')][_0x40c8('0x19')]===undefined?!![]:![]:!![]})[_0x40c8('0x1a')](function(_0x7631ef){logger['info']('CreateVoiceTransferReport',_0x1ae56e);logger['debug']('CreateVoiceTransferReport',_0x1ae56e,JSON[_0x40c8('0xe')](_0x7631ef));_0x411534(_0x7631ef);})[_0x40c8('0x13')](function(_0x24bf8c){logger['error'](_0x40c8('0x14'),_0x24bf8c[_0x40c8('0x11')],_0x1ae56e);_0x18c381(_0x4092dd[_0x40c8('0xf')](0x1f4,_0x24bf8c[_0x40c8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 49030d9..961ccbf 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 _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0xe8b3b6,_0x50d0df){var _0x49548f=function(_0x241293){while(--_0x241293){_0xe8b3b6['push'](_0xe8b3b6['shift']());}};_0x49548f(++_0x50d0df);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xb4e6[_0x39872b];return _0x55fa18;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x46c91d,_0x1c57a5){var _0x8d029e=function(_0xfa581f){while(--_0xfa581f){_0x46c91d['push'](_0x46c91d['shift']());}};_0x8d029e(++_0x1c57a5);}(_0xdace,0xc5));var _0xedac=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xdace[_0x487b0c];return _0x1adbdc;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index efe95e9..26fca53 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 _0x4ea3=['body','json','userId','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','catch','hold','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','filter','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','client','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','stack','name','send','status','NotFound','request','then','message','User','findOne','agent','all','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:'];(function(_0x1d9069,_0x14d346){var _0x314b18=function(_0x328afe){while(--_0x328afe){_0x1d9069['push'](_0x1d9069['shift']());}};_0x314b18(++_0x14d346);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var path=require(_0x34ea('0x0'));var fs=require('fs');var _=require(_0x34ea('0x1'));var db=require(_0x34ea('0x2'))['db'];var config=require(_0x34ea('0x3'));var util=require('util');var BPromise=require(_0x34ea('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x34ea('0x5')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0x34ea('0x6'));var Redis=require(_0x34ea('0x7'));config[_0x34ea('0x8')]=_[_0x34ea('0x9')](config[_0x34ea('0x8')],{'host':_0x34ea('0xa'),'port':0x18eb});var io=require(_0x34ea('0xb'))(new Redis(config['redis']));var Schema=require(_0x34ea('0xc'));var originateValidation=new Schema({'userId':{'type':_0x34ea('0xd'),'required':[!![],_0x34ea('0xe')]},'callNumber':{'type':'string','required':[!![],_0x34ea('0xf')]},'callerId':{'type':_0x34ea('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x34ea('0xe')]},'sessionId':{'type':_0x34ea('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x34ea('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x34ea('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x34ea('0xd'),'required':[!![],_0x34ea('0xe')]},'sessionId':{'type':_0x34ea('0x10'),'required':[!![],_0x34ea('0x11')]},'transferNumber':{'type':_0x34ea('0x10'),'required':[!![],_0x34ea('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x34ea('0xd'),'required':[!![],_0x34ea('0xe')]},'sessionId':{'type':_0x34ea('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x34ea('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x34ea('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x34ea('0xd'),'required':[!![],_0x34ea('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x34ea('0xd'),'required':[!![],_0x34ea('0xe')]}});function emit(_0x56b2d7,_0x6a84a7,_0x18c013){logger[_0x34ea('0x13')](_0x56b2d7,_0x6a84a7,JSON[_0x34ea('0x14')](_0x18c013));io['to'](_0x56b2d7)['emit'](_0x6a84a7,_0x18c013);}function handleError(_0x2680e0){return function(_0x34caea){console[_0x34ea('0x15')]('handleError:',_0x34caea,_0x34caea instanceof RangeError);logger[_0x34ea('0x16')](_0x34caea[_0x34ea('0x17')]);if(_0x34caea instanceof RangeError){if(_0x34caea[_0x34ea('0x18')]){delete _0x34caea[_0x34ea('0x18')];}_0x2680e0['status'](0x194)[_0x34ea('0x19')](_0x34caea);}else{if(_0x34caea[_0x34ea('0x18')]){delete _0x34caea[_0x34ea('0x18')];}_0x2680e0[_0x34ea('0x1a')](0x1f4)['send'](_0x34caea);}};}function checkError(){return function(_0x55277a){if(!_0x55277a){throw new RangeError(_0x34ea('0x1b'));}return _0x55277a;};}function respondWithRpcPromise(_0x26ae3a,_0x151fae){return new BPromise(function(_0x51022f,_0x5197a2){var _0x2eafc6=amiClient;return _0x2eafc6[_0x34ea('0x1c')](_0x26ae3a,_0x151fae)[_0x34ea('0x1d')](function(_0x30c4b0){if(_0x30c4b0[_0x34ea('0x16')]){if(_0x30c4b0[_0x34ea('0x16')]['code']===0x1f4){return _0x5197a2(_0x30c4b0[_0x34ea('0x16')][_0x34ea('0x1e')]);}return _0x51022f(_0x30c4b0[_0x34ea('0x16')][_0x34ea('0x1e')]);}else{_0x51022f(_0x30c4b0['result']);}})['catch'](function(_0x564d1b){_0x5197a2(_0x564d1b);});});}function getAgent(_0x142709){return db[_0x34ea('0x1f')][_0x34ea('0x20')]({'where':{'id':_0x142709,'role':_0x34ea('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x26c80b,_0x267083){return new BPromise(function(_0x27c6f7,_0x4fd4fd){var _0x4cded8=respondWithRpcPromise('VoiceChannels');var _0x4d4360=getAgent(_0x26c80b);Promise[_0x34ea('0x22')]([_0x4cded8,_0x4d4360])[_0x34ea('0x1d')](function(_0x859b7e){var _0x162081=_0x859b7e[0x0];var _0x56c9dd=_0x859b7e[0x1];var _0x216379=_['filter'](_0x162081[_0x34ea('0x23')],function(_0x4f2b77){return _0x4f2b77[_0x34ea('0x24')]==_0x56c9dd['id']&&_0x4f2b77[_0x34ea('0x25')]==_0x267083;});if(_0x216379[_0x34ea('0x26')]==0x1){_0x27c6f7(_0x56c9dd);}else{_0x4fd4fd(new RangeError('sessionId\x20'+_0x267083+_0x34ea('0x27')));}});});}exports[_0x34ea('0x28')]=function(_0x55c8ba,_0x10bcfe){logger['info'](_0x34ea('0x29'),_0x55c8ba[_0x34ea('0x2a')]);var _0x2d358e=originateValidation['validate'](_0x55c8ba['body']);if(_0x2d358e[_0x34ea('0x26')]>0x0){return _0x10bcfe['status'](0x190)[_0x34ea('0x2b')](_0x2d358e);}var _0x359a31=_0x55c8ba['body'][_0x34ea('0x2c')];var _0x3b7d8d=_0x55c8ba[_0x34ea('0x2a')][_0x34ea('0x2d')];var _0x4d43ca=_0x55c8ba['body']['callerId'];var _0x2b31e9=_0x55c8ba[_0x34ea('0x2a')][_0x34ea('0x2e')];return getAgent(_0x359a31)['then'](function(_0x4e26e0){logger['info'](_0x34ea('0x2f'),_0x4e26e0[_0x34ea('0x18')]);emit(util['format'](_0x34ea('0x30'),_0x4e26e0[_0x34ea('0x18')]),_0x34ea('0x31'),{'callNumber':_0x3b7d8d,'callerId':_0x4d43ca,'callbackUrl':_0x2b31e9});return _0x10bcfe[_0x34ea('0x1a')](0xc8)[_0x34ea('0x2b')]({'error':![],'message':_0x34ea('0x32')});})['catch'](handleError(_0x10bcfe));};exports[_0x34ea('0x33')]=function(_0x22729a,_0x60f384){logger[_0x34ea('0x13')]('hangup\x20fired:',_0x22729a['body']);var _0x6f024c=hangupValidation[_0x34ea('0xc')](_0x22729a[_0x34ea('0x2a')]);if(_0x6f024c[_0x34ea('0x26')]>0x0){return _0x60f384[_0x34ea('0x1a')](0x190)['json'](_0x6f024c);}var _0x31bdfe=_0x22729a[_0x34ea('0x2a')][_0x34ea('0x2c')];var _0x3a6a90=_0x22729a[_0x34ea('0x2a')][_0x34ea('0x25')];return getAgent(_0x31bdfe)[_0x34ea('0x1d')](function(_0xa1ff39){logger[_0x34ea('0x13')](_0x34ea('0x2f'),_0xa1ff39[_0x34ea('0x18')]);emit(util[_0x34ea('0x34')](_0x34ea('0x30'),_0xa1ff39[_0x34ea('0x18')]),_0x34ea('0x35'),{'sessionId':_0x3a6a90});return _0x60f384[_0x34ea('0x1a')](0xc8)['json']({'error':![],'message':_0x34ea('0x36')});})['catch'](handleError(_0x60f384));};exports[_0x34ea('0x37')]=function(_0x1f3d26,_0x46e14c){logger[_0x34ea('0x13')](_0x34ea('0x38'),_0x1f3d26[_0x34ea('0x2a')]);var _0x35d81d=answerValidation[_0x34ea('0xc')](_0x1f3d26[_0x34ea('0x2a')]);if(_0x35d81d['length']>0x0){return _0x46e14c[_0x34ea('0x1a')](0x190)['json'](_0x35d81d);}var _0x45f170=_0x1f3d26[_0x34ea('0x2a')][_0x34ea('0x2c')];var _0x379282=_0x1f3d26[_0x34ea('0x2a')][_0x34ea('0x25')];return getAgent(_0x45f170)['then'](function(_0x3edecf){logger[_0x34ea('0x13')]('entityFound:',_0x3edecf[_0x34ea('0x18')]);emit(util[_0x34ea('0x34')](_0x34ea('0x30'),_0x3edecf[_0x34ea('0x18')]),_0x34ea('0x39'),{'sessionId':_0x379282});return _0x46e14c['status'](0xc8)[_0x34ea('0x2b')]({'error':![],'message':_0x34ea('0x3a')});})[_0x34ea('0x3b')](handleError(_0x46e14c));};exports[_0x34ea('0x3c')]=function(_0x3e2e61,_0x16c1a6){logger['info']('hold\x20fired:',_0x3e2e61[_0x34ea('0x2a')]);var _0x117047=holdValidation[_0x34ea('0xc')](_0x3e2e61['body']);if(_0x117047[_0x34ea('0x26')]>0x0){return _0x16c1a6['status'](0x190)[_0x34ea('0x2b')](_0x117047);}var _0x4cc586=_0x3e2e61[_0x34ea('0x2a')][_0x34ea('0x2c')];var _0x136ef6=_0x3e2e61['body'][_0x34ea('0x25')];return getAgent(_0x4cc586)['then'](function(_0x404a59){logger[_0x34ea('0x13')](_0x34ea('0x2f'),_0x404a59[_0x34ea('0x18')]);emit(util['format'](_0x34ea('0x30'),_0x404a59[_0x34ea('0x18')]),_0x34ea('0x3d'),{'sessionId':_0x136ef6});return _0x16c1a6[_0x34ea('0x1a')](0xc8)[_0x34ea('0x2b')]({'error':![],'message':_0x34ea('0x3e')});})[_0x34ea('0x3b')](handleError(_0x16c1a6));};exports['unhold']=function(_0x1059dc,_0x224c53){logger[_0x34ea('0x13')](_0x34ea('0x3f'),_0x1059dc[_0x34ea('0x2a')]);var _0x85bef8=unholdValidation[_0x34ea('0xc')](_0x1059dc[_0x34ea('0x2a')]);if(_0x85bef8[_0x34ea('0x26')]>0x0){return _0x224c53[_0x34ea('0x1a')](0x190)[_0x34ea('0x2b')](_0x85bef8);}var _0x2b7ff4=_0x1059dc[_0x34ea('0x2a')]['userId'];var _0x1d01f2=_0x1059dc[_0x34ea('0x2a')][_0x34ea('0x25')];return getAgent(_0x2b7ff4)['then'](function(_0x379a87){logger['info'](_0x34ea('0x2f'),_0x379a87[_0x34ea('0x18')]);emit(util['format'](_0x34ea('0x30'),_0x379a87[_0x34ea('0x18')]),_0x34ea('0x40'),{'sessionId':_0x1d01f2});return _0x224c53['status'](0xc8)['json']({'error':![],'message':_0x34ea('0x41')});})['catch'](handleError(_0x224c53));};exports['calls']=function(_0x575dd4,_0x4df7bf){logger[_0x34ea('0x13')](_0x34ea('0x42'),_0x4df7bf[_0x34ea('0x2a')]);var _0x443c98=callsValidation[_0x34ea('0xc')](_0x575dd4[_0x34ea('0x2a')]);if(_0x443c98[_0x34ea('0x26')]>0x0){return _0x4df7bf[_0x34ea('0x1a')](0x190)[_0x34ea('0x2b')](_0x443c98);}var _0x30d4a5=_0x575dd4[_0x34ea('0x2a')][_0x34ea('0x2c')];var _0x372295=respondWithRpcPromise(_0x34ea('0x43'));var _0x2fa11f=getAgent(_0x30d4a5);return Promise[_0x34ea('0x22')]([_0x372295,_0x2fa11f])['then'](function(_0x101033){var _0x48a93c=_0x101033[0x0];var _0x1ec07f=_0x101033[0x1];var _0x35ea45=_[_0x34ea('0x44')](_0x48a93c[_0x34ea('0x23')],function(_0x2e432c){return _0x2e432c[_0x34ea('0x24')]==_0x1ec07f['id'];});return _0x4df7bf['status'](0xc8)[_0x34ea('0x2b')]({'count':_0x35ea45[_0x34ea('0x26')],'rows':_0x35ea45});})[_0x34ea('0x3b')](handleError(_0x4df7bf));};exports[_0x34ea('0x45')]=function(_0x37c963,_0x55549e){logger[_0x34ea('0x13')]('conference\x20fired:',_0x37c963['body']);var _0x54dc5e=conferenceValidation[_0x34ea('0xc')](_0x37c963['body']);if(_0x54dc5e[_0x34ea('0x26')]>0x0){return _0x55549e['status'](0x190)[_0x34ea('0x2b')](_0x54dc5e);}var _0x5e4df3=_0x37c963[_0x34ea('0x2a')]['userId'];return getAgent(_0x5e4df3)[_0x34ea('0x1d')](function(_0x56b1de){logger[_0x34ea('0x13')](_0x34ea('0x2f'),_0x56b1de[_0x34ea('0x18')]);emit(util['format']('user:%s',_0x56b1de[_0x34ea('0x18')]),_0x34ea('0x46'));return _0x55549e[_0x34ea('0x1a')](0xc8)[_0x34ea('0x2b')]({'error':![],'message':_0x34ea('0x47')});})[_0x34ea('0x3b')](handleError(_0x55549e));};exports[_0x34ea('0x48')]=function(_0x23ba32,_0x2e3d65){logger['info'](_0x34ea('0x49'),_0x23ba32[_0x34ea('0x2a')]);var _0x22d4bb=transferValidation['validate'](_0x23ba32['body']);if(_0x22d4bb[_0x34ea('0x26')]>0x0){return _0x2e3d65[_0x34ea('0x1a')](0x190)[_0x34ea('0x2b')](_0x22d4bb);}var _0x5a2750=_0x23ba32[_0x34ea('0x2a')][_0x34ea('0x2c')];var _0x38542d=_0x23ba32['body'][_0x34ea('0x25')];var _0x26a73a=_0x23ba32['body'][_0x34ea('0x4a')];return getAgent(_0x5a2750)[_0x34ea('0x1d')](function(_0x39c810){logger['info'](_0x34ea('0x2f'),_0x39c810['name']);emit(util[_0x34ea('0x34')](_0x34ea('0x30'),_0x39c810[_0x34ea('0x18')]),_0x34ea('0x4b'),{'sessionId':_0x38542d,'transferNumber':_0x26a73a});return _0x2e3d65['status'](0xc8)[_0x34ea('0x2b')]({'error':![],'message':_0x34ea('0x4c')});})['catch'](handleError(_0x2e3d65));}; \ No newline at end of file +var _0xf290=['lodash','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','name','status','send','then','error','code','message','result','catch','User','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','body','json','userId','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!'];(function(_0x2bf76a,_0xb01832){var _0x1ec759=function(_0x660558){while(--_0x660558){_0x2bf76a['push'](_0x2bf76a['shift']());}};_0x1ec759(++_0xb01832);}(_0xf290,0xde));var _0x0f29=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0xf290[_0x113e32];return _0x4ff939;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0f29('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x0f29('0x1'));var util=require('util');var BPromise=require(_0x0f29('0x2'));var jayson=require(_0x0f29('0x3'));var amiClient=jayson[_0x0f29('0x4')][_0x0f29('0x5')]({'port':0x232a});var logger=require(_0x0f29('0x6'))('webbarapi');var Redis=require(_0x0f29('0x7'));config['redis']=_[_0x0f29('0x8')](config[_0x0f29('0x9')],{'host':_0x0f29('0xa'),'port':0x18eb});var io=require(_0x0f29('0xb'))(new Redis(config[_0x0f29('0x9')]));var Schema=require(_0x0f29('0xc'));var originateValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]},'callNumber':{'type':_0x0f29('0xf'),'required':[!![],_0x0f29('0x10')]},'callerId':{'type':_0x0f29('0xf')},'callbackUrl':{'type':_0x0f29('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]},'sessionId':{'type':_0x0f29('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0f29('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]},'sessionId':{'type':_0x0f29('0xf'),'required':[!![],_0x0f29('0x11')]},'transferNumber':{'type':_0x0f29('0xf'),'required':[!![],_0x0f29('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0f29('0xe')]},'sessionId':{'type':_0x0f29('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]},'sessionId':{'type':_0x0f29('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],_0x0f29('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0f29('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x4ac37d,_0x2be27f,_0x3151a5){logger[_0x0f29('0x13')](_0x4ac37d,_0x2be27f,JSON[_0x0f29('0x14')](_0x3151a5));io['to'](_0x4ac37d)['emit'](_0x2be27f,_0x3151a5);}function handleError(_0x122bfa){return function(_0x5d72a5){console[_0x0f29('0x15')]('handleError:',_0x5d72a5,_0x5d72a5 instanceof RangeError);logger['error'](_0x5d72a5['stack']);if(_0x5d72a5 instanceof RangeError){if(_0x5d72a5[_0x0f29('0x16')]){delete _0x5d72a5[_0x0f29('0x16')];}_0x122bfa[_0x0f29('0x17')](0x194)[_0x0f29('0x18')](_0x5d72a5);}else{if(_0x5d72a5[_0x0f29('0x16')]){delete _0x5d72a5[_0x0f29('0x16')];}_0x122bfa[_0x0f29('0x17')](0x1f4)['send'](_0x5d72a5);}};}function checkError(){return function(_0x49d954){if(!_0x49d954){throw new RangeError('NotFound');}return _0x49d954;};}function respondWithRpcPromise(_0x5ab592,_0x55d92e){return new BPromise(function(_0x5d94b9,_0x38a1ce){var _0x4a9dd8=amiClient;return _0x4a9dd8['request'](_0x5ab592,_0x55d92e)[_0x0f29('0x19')](function(_0x1840e0){if(_0x1840e0[_0x0f29('0x1a')]){if(_0x1840e0[_0x0f29('0x1a')][_0x0f29('0x1b')]===0x1f4){return _0x38a1ce(_0x1840e0['error'][_0x0f29('0x1c')]);}return _0x5d94b9(_0x1840e0['error'][_0x0f29('0x1c')]);}else{_0x5d94b9(_0x1840e0[_0x0f29('0x1d')]);}})[_0x0f29('0x1e')](function(_0x28cfaa){_0x38a1ce(_0x28cfaa);});});}function getAgent(_0x57667b){return db[_0x0f29('0x1f')]['findOne']({'where':{'id':_0x57667b,'role':'agent'}})[_0x0f29('0x19')](checkError());}function getAgentCheckSession(_0x5c0202,_0x5bfcac){return new BPromise(function(_0x57dcc7,_0x4dd0b0){var _0x3c6ce9=respondWithRpcPromise(_0x0f29('0x20'));var _0x4cc5a0=getAgent(_0x5c0202);Promise[_0x0f29('0x21')]([_0x3c6ce9,_0x4cc5a0])[_0x0f29('0x19')](function(_0x274c9d){var _0x51e7dc=_0x274c9d[0x0];var _0x56e729=_0x274c9d[0x1];var _0x37ebcc=_['filter'](_0x51e7dc[_0x0f29('0x22')],function(_0x561c31){return _0x561c31['UserId']==_0x56e729['id']&&_0x561c31[_0x0f29('0x23')]==_0x5bfcac;});if(_0x37ebcc[_0x0f29('0x24')]==0x1){_0x57dcc7(_0x56e729);}else{_0x4dd0b0(new RangeError(_0x0f29('0x25')+_0x5bfcac+_0x0f29('0x26')));}});});}exports['originate']=function(_0x52a501,_0x3bb3c8){logger['info']('originate\x20fired:',_0x52a501[_0x0f29('0x27')]);var _0x5baebb=originateValidation[_0x0f29('0xc')](_0x52a501['body']);if(_0x5baebb['length']>0x0){return _0x3bb3c8[_0x0f29('0x17')](0x190)[_0x0f29('0x28')](_0x5baebb);}var _0x3ea452=_0x52a501[_0x0f29('0x27')][_0x0f29('0x29')];var _0x4d0504=_0x52a501[_0x0f29('0x27')]['callNumber'];var _0x2cc510=_0x52a501[_0x0f29('0x27')][_0x0f29('0x2a')];var _0x1320a3=_0x52a501['body'][_0x0f29('0x2b')];return getAgent(_0x3ea452)[_0x0f29('0x19')](function(_0x5be4fa){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x5be4fa['name']);emit(util['format'](_0x0f29('0x2d'),_0x5be4fa[_0x0f29('0x16')]),_0x0f29('0x2e'),{'callNumber':_0x4d0504,'callerId':_0x2cc510,'callbackUrl':_0x1320a3});return _0x3bb3c8[_0x0f29('0x17')](0xc8)[_0x0f29('0x28')]({'error':![],'message':_0x0f29('0x2f')});})['catch'](handleError(_0x3bb3c8));};exports[_0x0f29('0x30')]=function(_0x5a538e,_0x331dc7){logger['info'](_0x0f29('0x31'),_0x5a538e[_0x0f29('0x27')]);var _0x6d4c82=hangupValidation['validate'](_0x5a538e['body']);if(_0x6d4c82[_0x0f29('0x24')]>0x0){return _0x331dc7['status'](0x190)[_0x0f29('0x28')](_0x6d4c82);}var _0x3f49f8=_0x5a538e[_0x0f29('0x27')][_0x0f29('0x29')];var _0x9ae45d=_0x5a538e['body'][_0x0f29('0x23')];return getAgent(_0x3f49f8)[_0x0f29('0x19')](function(_0x42872b){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x42872b[_0x0f29('0x16')]);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x42872b[_0x0f29('0x16')]),'webbar:hangup',{'sessionId':_0x9ae45d});return _0x331dc7[_0x0f29('0x17')](0xc8)[_0x0f29('0x28')]({'error':![],'message':_0x0f29('0x33')});})[_0x0f29('0x1e')](handleError(_0x331dc7));};exports['answer']=function(_0x10e800,_0xfc9257){logger[_0x0f29('0x13')](_0x0f29('0x34'),_0x10e800[_0x0f29('0x27')]);var _0x56062d=answerValidation[_0x0f29('0xc')](_0x10e800[_0x0f29('0x27')]);if(_0x56062d[_0x0f29('0x24')]>0x0){return _0xfc9257['status'](0x190)[_0x0f29('0x28')](_0x56062d);}var _0x284279=_0x10e800[_0x0f29('0x27')][_0x0f29('0x29')];var _0x35f753=_0x10e800[_0x0f29('0x27')][_0x0f29('0x23')];return getAgent(_0x284279)[_0x0f29('0x19')](function(_0x4b6b6a){logger['info']('entityFound:',_0x4b6b6a[_0x0f29('0x16')]);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x4b6b6a[_0x0f29('0x16')]),_0x0f29('0x35'),{'sessionId':_0x35f753});return _0xfc9257[_0x0f29('0x17')](0xc8)['json']({'error':![],'message':_0x0f29('0x36')});})['catch'](handleError(_0xfc9257));};exports[_0x0f29('0x37')]=function(_0x57242c,_0x284036){logger[_0x0f29('0x13')](_0x0f29('0x38'),_0x57242c[_0x0f29('0x27')]);var _0x301fc8=holdValidation['validate'](_0x57242c[_0x0f29('0x27')]);if(_0x301fc8[_0x0f29('0x24')]>0x0){return _0x284036[_0x0f29('0x17')](0x190)['json'](_0x301fc8);}var _0x14b747=_0x57242c['body']['userId'];var _0x21c0a4=_0x57242c[_0x0f29('0x27')][_0x0f29('0x23')];return getAgent(_0x14b747)[_0x0f29('0x19')](function(_0x20aa53){logger[_0x0f29('0x13')]('entityFound:',_0x20aa53[_0x0f29('0x16')]);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x20aa53[_0x0f29('0x16')]),_0x0f29('0x39'),{'sessionId':_0x21c0a4});return _0x284036[_0x0f29('0x17')](0xc8)[_0x0f29('0x28')]({'error':![],'message':_0x0f29('0x3a')});})[_0x0f29('0x1e')](handleError(_0x284036));};exports[_0x0f29('0x3b')]=function(_0x5cd4a9,_0x5e4479){logger[_0x0f29('0x13')](_0x0f29('0x3c'),_0x5cd4a9[_0x0f29('0x27')]);var _0x178f21=unholdValidation['validate'](_0x5cd4a9[_0x0f29('0x27')]);if(_0x178f21[_0x0f29('0x24')]>0x0){return _0x5e4479[_0x0f29('0x17')](0x190)[_0x0f29('0x28')](_0x178f21);}var _0xbf8f22=_0x5cd4a9[_0x0f29('0x27')][_0x0f29('0x29')];var _0x59aeb9=_0x5cd4a9[_0x0f29('0x27')][_0x0f29('0x23')];return getAgent(_0xbf8f22)[_0x0f29('0x19')](function(_0x2c6a95){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x2c6a95['name']);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x2c6a95[_0x0f29('0x16')]),'webbar:unhold',{'sessionId':_0x59aeb9});return _0x5e4479[_0x0f29('0x17')](0xc8)['json']({'error':![],'message':_0x0f29('0x3d')});})['catch'](handleError(_0x5e4479));};exports[_0x0f29('0x3e')]=function(_0x3fcda8,_0x4a490a){logger[_0x0f29('0x13')](_0x0f29('0x3f'),_0x4a490a[_0x0f29('0x27')]);var _0x4a2c08=callsValidation[_0x0f29('0xc')](_0x3fcda8['body']);if(_0x4a2c08[_0x0f29('0x24')]>0x0){return _0x4a490a[_0x0f29('0x17')](0x190)['json'](_0x4a2c08);}var _0x1c46a6=_0x3fcda8[_0x0f29('0x27')]['userId'];var _0xbe013b=respondWithRpcPromise('VoiceChannels');var _0x1baaf8=getAgent(_0x1c46a6);return Promise['all']([_0xbe013b,_0x1baaf8])[_0x0f29('0x19')](function(_0x302d05){var _0x36a7df=_0x302d05[0x0];var _0x4ba5c3=_0x302d05[0x1];var _0x36e714=_[_0x0f29('0x40')](_0x36a7df[_0x0f29('0x22')],function(_0x46c22c){return _0x46c22c['UserId']==_0x4ba5c3['id'];});return _0x4a490a[_0x0f29('0x17')](0xc8)['json']({'count':_0x36e714[_0x0f29('0x24')],'rows':_0x36e714});})['catch'](handleError(_0x4a490a));};exports[_0x0f29('0x41')]=function(_0x3eafc8,_0x306b24){logger[_0x0f29('0x13')](_0x0f29('0x42'),_0x3eafc8[_0x0f29('0x27')]);var _0x272a9e=conferenceValidation['validate'](_0x3eafc8[_0x0f29('0x27')]);if(_0x272a9e['length']>0x0){return _0x306b24[_0x0f29('0x17')](0x190)[_0x0f29('0x28')](_0x272a9e);}var _0x357437=_0x3eafc8['body'][_0x0f29('0x29')];return getAgent(_0x357437)[_0x0f29('0x19')](function(_0x115dbe){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x115dbe['name']);emit(util['format'](_0x0f29('0x2d'),_0x115dbe[_0x0f29('0x16')]),_0x0f29('0x43'));return _0x306b24['status'](0xc8)['json']({'error':![],'message':_0x0f29('0x44')});})[_0x0f29('0x1e')](handleError(_0x306b24));};exports[_0x0f29('0x45')]=function(_0x4a7e9f,_0x520e92){logger['info'](_0x0f29('0x46'),_0x4a7e9f[_0x0f29('0x27')]);var _0x49a7b3=transferValidation[_0x0f29('0xc')](_0x4a7e9f[_0x0f29('0x27')]);if(_0x49a7b3['length']>0x0){return _0x520e92[_0x0f29('0x17')](0x190)['json'](_0x49a7b3);}var _0x41f20a=_0x4a7e9f[_0x0f29('0x27')]['userId'];var _0x2e423a=_0x4a7e9f[_0x0f29('0x27')][_0x0f29('0x23')];var _0x2d5ce4=_0x4a7e9f[_0x0f29('0x27')][_0x0f29('0x47')];return getAgent(_0x41f20a)['then'](function(_0x2babb0){logger[_0x0f29('0x13')](_0x0f29('0x2c'),_0x2babb0['name']);emit(util[_0x0f29('0x32')](_0x0f29('0x2d'),_0x2babb0['name']),_0x0f29('0x48'),{'sessionId':_0x2e423a,'transferNumber':_0x2d5ce4});return _0x520e92['status'](0xc8)[_0x0f29('0x28')]({'error':![],'message':_0x0f29('0x49')});})[_0x0f29('0x1e')](handleError(_0x520e92));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4b9dab1..fdec0fd 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 _0xd480=['fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','index','get','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','/:id/canned_answers','getAnswers','/:id/users','getApplications','post','addDisposition','addAnswer','/:id/applications','addApplications','/:id/notify','notify','/:id/send','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','Router'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd480,0x167));var _0x0d48=function(_0x1de013,_0x1d22af){_0x1de013=_0x1de013-0x0;var _0x226720=_0xd480[_0x1de013];return _0x226720;};'use strict';var multer=require('multer');var util=require(_0x0d48('0x0'));var path=require(_0x0d48('0x1'));var timeout=require(_0x0d48('0x2'));var express=require('express');var router=express[_0x0d48('0x3')]();var fs_extra=require(_0x0d48('0x4'));var auth=require(_0x0d48('0x5'));var interaction=require(_0x0d48('0x6'));var config=require('../../config/environment');var controller=require(_0x0d48('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d48('0x8')]);router[_0x0d48('0x9')](_0x0d48('0xa'),auth['isAuthenticated'](),controller[_0x0d48('0xb')]);router[_0x0d48('0x9')](_0x0d48('0xc'),auth['isAuthenticated'](),controller[_0x0d48('0xd')]);router[_0x0d48('0x9')](_0x0d48('0xe'),auth[_0x0d48('0xf')](),controller['getDispositions']);router['get'](_0x0d48('0x10'),auth[_0x0d48('0xf')](),controller[_0x0d48('0x11')]);router[_0x0d48('0x9')](_0x0d48('0x12'),auth[_0x0d48('0xf')](),controller['getAgents']);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x0d48('0x13')]);router['post']('/',auth[_0x0d48('0xf')](),controller['create']);router[_0x0d48('0x14')](_0x0d48('0xe'),auth[_0x0d48('0xf')](),controller[_0x0d48('0x15')]);router[_0x0d48('0x14')]('/:id/canned_answers',auth[_0x0d48('0xf')](),controller[_0x0d48('0x16')]);router[_0x0d48('0x14')](_0x0d48('0x12'),auth[_0x0d48('0xf')](),controller['addAgents']);router[_0x0d48('0x14')](_0x0d48('0x17'),auth[_0x0d48('0xf')](),controller[_0x0d48('0x18')]);router[_0x0d48('0x14')](_0x0d48('0x19'),controller[_0x0d48('0x1a')]);router['post'](_0x0d48('0x1b'),auth[_0x0d48('0xf')](),controller['send']);router['put'](_0x0d48('0xc'),auth[_0x0d48('0xf')](),controller['update']);router[_0x0d48('0x1c')](_0x0d48('0xc'),auth[_0x0d48('0xf')](),controller[_0x0d48('0x1d')]);router['delete']('/:id/dispositions',auth[_0x0d48('0xf')](),controller[_0x0d48('0x1e')]);router[_0x0d48('0x1c')](_0x0d48('0x10'),auth[_0x0d48('0xf')](),controller[_0x0d48('0x1f')]);router[_0x0d48('0x1c')](_0x0d48('0x12'),auth[_0x0d48('0xf')](),controller[_0x0d48('0x20')]);module['exports']=router; \ No newline at end of file +var _0xf036=['getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','/:id/canned_answers','/:id/users','/:id/applications'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xf036,0x1c0));var _0x6f03=function(_0x41dd18,_0x2d8885){_0x41dd18=_0x41dd18-0x0;var _0x5a2d2f=_0xf036[_0x41dd18];return _0x5a2d2f;};'use strict';var multer=require(_0x6f03('0x0'));var util=require(_0x6f03('0x1'));var path=require(_0x6f03('0x2'));var timeout=require(_0x6f03('0x3'));var express=require(_0x6f03('0x4'));var router=express[_0x6f03('0x5')]();var fs_extra=require(_0x6f03('0x6'));var auth=require(_0x6f03('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6f03('0x8'));var controller=require(_0x6f03('0x9'));router[_0x6f03('0xa')]('/',auth['isAuthenticated'](),controller[_0x6f03('0xb')]);router[_0x6f03('0xa')](_0x6f03('0xc'),auth[_0x6f03('0xd')](),controller[_0x6f03('0xe')]);router['get'](_0x6f03('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6f03('0xa')](_0x6f03('0x10'),auth[_0x6f03('0xd')](),controller['getDispositions']);router['get'](_0x6f03('0x11'),auth[_0x6f03('0xd')](),controller['getAnswers']);router[_0x6f03('0xa')](_0x6f03('0x12'),auth[_0x6f03('0xd')](),controller['getAgents']);router[_0x6f03('0xa')](_0x6f03('0x13'),auth[_0x6f03('0xd')](),controller[_0x6f03('0x14')]);router[_0x6f03('0x15')]('/',auth[_0x6f03('0xd')](),controller[_0x6f03('0x16')]);router[_0x6f03('0x15')](_0x6f03('0x10'),auth['isAuthenticated'](),controller[_0x6f03('0x17')]);router[_0x6f03('0x15')](_0x6f03('0x11'),auth[_0x6f03('0xd')](),controller[_0x6f03('0x18')]);router['post'](_0x6f03('0x12'),auth[_0x6f03('0xd')](),controller[_0x6f03('0x19')]);router['post'](_0x6f03('0x13'),auth[_0x6f03('0xd')](),controller[_0x6f03('0x1a')]);router[_0x6f03('0x15')](_0x6f03('0x1b'),controller[_0x6f03('0x1c')]);router[_0x6f03('0x15')](_0x6f03('0x1d'),auth[_0x6f03('0xd')](),controller[_0x6f03('0x1e')]);router[_0x6f03('0x1f')]('/:id',auth[_0x6f03('0xd')](),controller[_0x6f03('0x20')]);router[_0x6f03('0x21')](_0x6f03('0xf'),auth[_0x6f03('0xd')](),controller[_0x6f03('0x22')]);router['delete'](_0x6f03('0x10'),auth[_0x6f03('0xd')](),controller[_0x6f03('0x23')]);router[_0x6f03('0x21')](_0x6f03('0x11'),auth['isAuthenticated'](),controller[_0x6f03('0x24')]);router['delete'](_0x6f03('0x12'),auth[_0x6f03('0xd')](),controller[_0x6f03('0x25')]);module[_0x6f03('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 71ff5ee..f637a1c 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 _0x4072=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','sinch','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x4072,0x198));var _0x2407=function(_0x41bd0d,_0x283017){_0x41bd0d=_0x41bd0d-0x0;var _0x5a4f5d=_0x4072[_0x41bd0d];return _0x5a4f5d;};'use strict';var Sequelize=require(_0x2407('0x0'));var rs=require(_0x2407('0x1'));module[_0x2407('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x2407('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2407('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2407('0x3')],'defaultValue':function(){return rs[_0x2407('0x4')]();}},'phone':{'type':Sequelize[_0x2407('0x3')]},'type':{'type':Sequelize[_0x2407('0x5')](_0x2407('0x6'),_0x2407('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x2407('0x3')]},'authToken':{'type':Sequelize[_0x2407('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2407('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x2407('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2407('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2407('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2407('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2407('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x2407('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4b8426){if(!_0x4b8426){this[_0x2407('0xb')](_0x2407('0xc'),null);}this['setDataValue'](_0x2407('0xd'),_0x4b8426);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcedc=['name','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports'];(function(_0x52b23b,_0x378054){var _0x1c2126=function(_0xf21258){while(--_0xf21258){_0x52b23b['push'](_0x52b23b['shift']());}};_0x1c2126(++_0x378054);}(_0xcedc,0x8d));var _0xcced=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcedc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcced('0x0'));var rs=require(_0xcced('0x1'));module[_0xcced('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xcced('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xcced('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcced('0x5')]();}},'phone':{'type':Sequelize[_0xcced('0x4')]},'type':{'type':Sequelize[_0xcced('0x6')](_0xcced('0x7'),_0xcced('0x8'))},'accountSid':{'type':Sequelize[_0xcced('0x4')]},'baseUrl':{'type':Sequelize[_0xcced('0x4')]},'authToken':{'type':Sequelize[_0xcced('0x4')]},'notificationTemplate':{'type':Sequelize[_0xcced('0x9')],'defaultValue':function(){return _0xcced('0xa');}},'notificationSound':{'type':Sequelize[_0xcced('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xcced('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcced('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcced('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcced('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcced('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcced('0xd'),'set':function(_0x46bfd0){if(!_0x46bfd0){this[_0xcced('0xe')](_0xcced('0xf'),null);}this[_0xcced('0xe')]('mandatoryDisposition',_0x46bfd0);}},'description':{'type':Sequelize[_0xcced('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a1f83a6..ebc5372 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 _0xd38f=['result','catch','sendStatus','status','offset','count','set','Content-Range','json','apply','reject','update','UserProfileResource','destroy','end','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','Pause','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','unshift','waitForTheAssignedQueue','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappAccount,\x20%s,\x20%s'];(function(_0x38c7d8,_0x253557){var _0x266426=function(_0x2f727b){while(--_0x2f727b){_0x38c7d8['push'](_0x38c7d8['shift']());}};_0x266426(++_0x253557);}(_0xd38f,0xa3));var _0xfd38=function(_0x4ebf05,_0x330258){_0x4ebf05=_0x4ebf05-0x0;var _0x39b9d5=_0xd38f[_0x4ebf05];return _0x39b9d5;};'use strict';var emlformat=require(_0xfd38('0x0'));var rimraf=require(_0xfd38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfd38('0x2'));var BPromise=require(_0xfd38('0x3'));var Mustache=require(_0xfd38('0x4'));var util=require(_0xfd38('0x5'));var path=require(_0xfd38('0x6'));var sox=require(_0xfd38('0x7'));var csv=require(_0xfd38('0x8'));var ejs=require(_0xfd38('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd38('0xa'));var squel=require(_0xfd38('0xb'));var crypto=require(_0xfd38('0xc'));var jsforce=require(_0xfd38('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd38('0xe'));var Papa=require(_0xfd38('0xf'));var Redis=require('ioredis');var authService=require(_0xfd38('0x10'));var qs=require(_0xfd38('0x11'));var as=require(_0xfd38('0x12'));var hardwareService=require(_0xfd38('0x13'));var logger=require(_0xfd38('0x14'))(_0xfd38('0x15'));var utils=require(_0xfd38('0x16'));var config=require(_0xfd38('0x17'));var licenseUtil=require(_0xfd38('0x18'));var db=require(_0xfd38('0x19'))['db'];config['redis']=_[_0xfd38('0x1a')](config['redis'],{'host':_0xfd38('0x1b'),'port':0x18eb});var socket=require(_0xfd38('0x1c'))(new Redis(config[_0xfd38('0x1d')]));require(_0xfd38('0x1e'))[_0xfd38('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfd38('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x53a2b7,_0xc20909,_0x344fc5,_0x5d7f99){return new BPromise(function(_0x338eec,_0x2d86fb){var _0x447252=_0x5d7f99||client;return _0x447252[_0xfd38('0x21')](_0x53a2b7,_0x344fc5)[_0xfd38('0x22')](function(_0xec4ec5){logger[_0xfd38('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0xc20909,_0xfd38('0x24'));logger[_0xfd38('0x25')](_0xfd38('0x26'),_0xc20909,_0xfd38('0x24'),JSON['stringify'](_0xec4ec5));if(_0xec4ec5[_0xfd38('0x27')]){if(_0xec4ec5['error'][_0xfd38('0x28')]===0x1f4){logger[_0xfd38('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0xc20909,_0xec4ec5[_0xfd38('0x27')]['message']);return _0x2d86fb(_0xec4ec5['error'][_0xfd38('0x29')]);}logger[_0xfd38('0x27')](_0xfd38('0x2a'),_0xc20909,_0xec4ec5[_0xfd38('0x27')][_0xfd38('0x29')]);return _0x338eec(_0xec4ec5[_0xfd38('0x27')][_0xfd38('0x29')]);}else{logger[_0xfd38('0x23')](_0xfd38('0x2a'),_0xc20909,_0xfd38('0x24'));_0x338eec(_0xec4ec5[_0xfd38('0x2b')][_0xfd38('0x29')]);}})[_0xfd38('0x2c')](function(_0x3a562a){logger[_0xfd38('0x27')](_0xfd38('0x2a'),_0xc20909,_0x3a562a);_0x2d86fb(_0x3a562a);});});}function respondWithStatusCode(_0x11217e,_0x27ade0){_0x27ade0=_0x27ade0||0xcc;return function(_0x10ea1f){if(_0x10ea1f){return _0x11217e[_0xfd38('0x2d')](_0x27ade0);}return _0x11217e['status'](_0x27ade0)['end']();};}function respondWithResult(_0x13c718,_0x2ca70c){_0x2ca70c=_0x2ca70c||0xc8;return function(_0x321e74){if(_0x321e74){return _0x13c718[_0xfd38('0x2e')](_0x2ca70c)['json'](_0x321e74);}};}function respondWithFilteredResult(_0x57e495,_0x24c7af){return function(_0x4fb4a5){if(_0x4fb4a5){var _0x629c44=typeof _0x24c7af[_0xfd38('0x2f')]==='undefined'&&typeof _0x24c7af['limit']==='undefined';var _0x373776=_0x4fb4a5[_0xfd38('0x30')];var _0x299b54=_0x629c44?0x0:_0x24c7af[_0xfd38('0x2f')];var _0x58d5d4=_0x629c44?_0x4fb4a5[_0xfd38('0x30')]:_0x24c7af[_0xfd38('0x2f')]+_0x24c7af['limit'];var _0x59a4d9;if(_0x58d5d4>=_0x373776){_0x58d5d4=_0x373776;_0x59a4d9=0xc8;}else{_0x59a4d9=0xce;}_0x57e495[_0xfd38('0x2e')](_0x59a4d9);return _0x57e495[_0xfd38('0x31')](_0xfd38('0x32'),_0x299b54+'-'+_0x58d5d4+'/'+_0x373776)[_0xfd38('0x33')](_0x4fb4a5);}return null;};}function patchUpdates(_0x9e8eeb){return function(_0x5f487c){try{jsonpatch[_0xfd38('0x34')](_0x5f487c,_0x9e8eeb,!![]);}catch(_0x5db4d2){return BPromise[_0xfd38('0x35')](_0x5db4d2);}return _0x5f487c['save']();};}function saveUpdates(_0x1d48ea,_0x4da027){return function(_0x41a696){if(_0x41a696){return _0x41a696[_0xfd38('0x36')](_0x1d48ea)[_0xfd38('0x22')](function(_0xfdc218){return _0xfdc218;});}return null;};}function removeEntity(_0x257ec1,_0x5a1b5f){return function(_0x3d267e){if(_0x3d267e){return _0x3d267e['destroy']()[_0xfd38('0x22')](function(){var _0x4bfb2b=_0x3d267e['get']({'plain':!![]});var _0x2b820a='WhatsappAccounts';return db[_0xfd38('0x37')][_0xfd38('0x38')]({'where':{'type':_0x2b820a,'resourceId':_0x4bfb2b['id']}})['then'](function(){return _0x3d267e;});})[_0xfd38('0x22')](function(){_0x257ec1[_0xfd38('0x2e')](0xcc)[_0xfd38('0x39')]();});}};}function handleEntityNotFound(_0xbdbfae,_0x534764){return function(_0x4d7327){if(!_0x4d7327){_0xbdbfae['sendStatus'](0x194);}return _0x4d7327;};}function handleError(_0x8c230c,_0x33d00c){_0x33d00c=_0x33d00c||0x1f4;return function(_0x44abae){logger[_0xfd38('0x27')](_0x44abae[_0xfd38('0x3a')]);if(_0x44abae[_0xfd38('0x3b')]){delete _0x44abae[_0xfd38('0x3b')];}_0x8c230c[_0xfd38('0x2e')](_0x33d00c)['send'](_0x44abae);};}exports[_0xfd38('0x3c')]=function(_0x157ee0,_0x2f5ddd){var _0x2364e2={'include':[{'model':db['Pause'],'as':_0xfd38('0x3d')}]},_0x3a0aba={},_0x46a1db={'count':0x0,'rows':[]};var _0xa2c025=_[_0xfd38('0x3e')](db[_0xfd38('0x3f')][_0xfd38('0x40')],function(_0xfa4486){return{'name':_0xfa4486[_0xfd38('0x41')],'type':_0xfa4486[_0xfd38('0x42')][_0xfd38('0x43')]};});_0x3a0aba[_0xfd38('0x44')]=_['map'](_0xa2c025,_0xfd38('0x3b'));_0x3a0aba['query']=_['keys'](_0x157ee0[_0xfd38('0x45')]);_0x3a0aba[_0xfd38('0x46')]=_[_0xfd38('0x47')](_0x3a0aba[_0xfd38('0x44')],_0x3a0aba[_0xfd38('0x45')]);_0x2364e2[_0xfd38('0x48')]=_[_0xfd38('0x47')](_0x3a0aba['model'],qs[_0xfd38('0x49')](_0x157ee0[_0xfd38('0x45')][_0xfd38('0x49')]));_0x2364e2['attributes']=_0x2364e2[_0xfd38('0x48')][_0xfd38('0x4a')]?_0x2364e2['attributes']:_0x3a0aba[_0xfd38('0x44')];if(!_0x157ee0['query'][_0xfd38('0x4b')](_0xfd38('0x4c'))){_0x2364e2[_0xfd38('0x4d')]=qs[_0xfd38('0x4d')](_0x157ee0[_0xfd38('0x45')][_0xfd38('0x4d')]);_0x2364e2[_0xfd38('0x2f')]=qs[_0xfd38('0x2f')](_0x157ee0['query']['offset']);}_0x2364e2[_0xfd38('0x4e')]=qs[_0xfd38('0x4f')](_0x157ee0['query'][_0xfd38('0x4f')]);_0x2364e2[_0xfd38('0x50')]=qs[_0xfd38('0x46')](_[_0xfd38('0x51')](_0x157ee0[_0xfd38('0x45')],_0x3a0aba[_0xfd38('0x46')]),_0xa2c025);if(_0x157ee0[_0xfd38('0x45')][_0xfd38('0x52')]){_0x2364e2['where']=_[_0xfd38('0x53')](_0x2364e2['where'],{'$or':_[_0xfd38('0x3e')](_0xa2c025,function(_0x2b2558){if(_0x2b2558[_0xfd38('0x42')]!==_0xfd38('0x54')){var _0x3d8054={};_0x3d8054[_0x2b2558[_0xfd38('0x3b')]]={'$like':'%'+_0x157ee0[_0xfd38('0x45')][_0xfd38('0x52')]+'%'};return _0x3d8054;}})});}_0x2364e2=_[_0xfd38('0x53')]({},_0x2364e2,_0x157ee0[_0xfd38('0x55')]);var _0xe04426={'where':_0x2364e2[_0xfd38('0x50')]};return db[_0xfd38('0x3f')][_0xfd38('0x30')](_0xe04426)[_0xfd38('0x22')](function(_0x30b398){_0x46a1db[_0xfd38('0x30')]=_0x30b398;if(_0x157ee0['query'][_0xfd38('0x56')]){_0x2364e2[_0xfd38('0x57')]=[{'all':!![]}];}return db[_0xfd38('0x3f')]['findAll'](_0x2364e2);})[_0xfd38('0x22')](function(_0x312c63){_0x46a1db[_0xfd38('0x58')]=_0x312c63;return _0x46a1db;})[_0xfd38('0x22')](respondWithFilteredResult(_0x2f5ddd,_0x2364e2))['catch'](handleError(_0x2f5ddd,null));};exports[_0xfd38('0x59')]=function(_0xc242ff,_0x32a89c){var _0xdc3ea1={'raw':![],'where':{'id':_0xc242ff['params']['id']},'include':[{'model':db[_0xfd38('0x5a')],'as':_0xfd38('0x3d')}]},_0x3f94e0={};_0x3f94e0[_0xfd38('0x44')]=_[_0xfd38('0x5b')](db[_0xfd38('0x3f')][_0xfd38('0x40')]);_0x3f94e0['query']=_[_0xfd38('0x5b')](_0xc242ff['query']);_0x3f94e0['filters']=_[_0xfd38('0x47')](_0x3f94e0['model'],_0x3f94e0[_0xfd38('0x45')]);_0xdc3ea1[_0xfd38('0x48')]=_[_0xfd38('0x47')](_0x3f94e0[_0xfd38('0x44')],qs['fields'](_0xc242ff[_0xfd38('0x45')][_0xfd38('0x49')]));_0xdc3ea1[_0xfd38('0x48')]=_0xdc3ea1[_0xfd38('0x48')][_0xfd38('0x4a')]?_0xdc3ea1[_0xfd38('0x48')]:_0x3f94e0[_0xfd38('0x44')];if(_0xc242ff['query'][_0xfd38('0x56')]){_0xdc3ea1['include']=[{'all':!![]}];}_0xdc3ea1=_['merge']({},_0xdc3ea1,_0xc242ff['options']);return db[_0xfd38('0x3f')][_0xfd38('0x5c')](_0xdc3ea1)[_0xfd38('0x22')](handleEntityNotFound(_0x32a89c,null))[_0xfd38('0x22')](respondWithResult(_0x32a89c,null))[_0xfd38('0x2c')](handleError(_0x32a89c,null));};exports[_0xfd38('0x5d')]=function(_0x1f315c,_0x27e956){return db[_0xfd38('0x3f')]['create'](_0x1f315c['body'],{})[_0xfd38('0x22')](function(_0x2c0f30){var _0x5bd33b=_0x1f315c[_0xfd38('0x5e')][_0xfd38('0x5f')]({'plain':!![]});if(!_0x5bd33b)throw new Error(_0xfd38('0x60'));if(_0x5bd33b['role']===_0xfd38('0x5e')){var _0x3c00ed=_0x2c0f30[_0xfd38('0x5f')]({'plain':!![]});var _0x4695db='WhatsappAccounts';return db[_0xfd38('0x61')][_0xfd38('0x5c')]({'where':{'name':_0x4695db,'userProfileId':_0x5bd33b[_0xfd38('0x62')]},'raw':!![]})[_0xfd38('0x22')](function(_0x4586ea){if(_0x4586ea&&_0x4586ea[_0xfd38('0x63')]===0x0){return db[_0xfd38('0x37')][_0xfd38('0x5d')]({'name':_0x3c00ed[_0xfd38('0x3b')],'resourceId':_0x3c00ed['id'],'type':_0x4586ea[_0xfd38('0x3b')],'sectionId':_0x4586ea['id']},{})[_0xfd38('0x22')](function(){return _0x2c0f30;});}else{return _0x2c0f30;}})[_0xfd38('0x2c')](function(_0x58b55d){logger[_0xfd38('0x27')](_0xfd38('0x64'),_0x58b55d);throw _0x58b55d;});}return _0x2c0f30;})[_0xfd38('0x22')](respondWithResult(_0x27e956,0xc9))[_0xfd38('0x2c')](handleError(_0x27e956,null));};exports[_0xfd38('0x36')]=function(_0x148a73,_0x118ace){if(_0x148a73[_0xfd38('0x65')]['id']){delete _0x148a73[_0xfd38('0x65')]['id'];}return db[_0xfd38('0x3f')]['find']({'where':{'id':_0x148a73[_0xfd38('0x66')]['id']},'include':[{'model':db[_0xfd38('0x5a')],'as':_0xfd38('0x3d')}]})['then'](handleEntityNotFound(_0x118ace,null))[_0xfd38('0x22')](saveUpdates(_0x148a73[_0xfd38('0x65')],null))[_0xfd38('0x22')](respondWithResult(_0x118ace,null))[_0xfd38('0x2c')](handleError(_0x118ace,null));};exports[_0xfd38('0x38')]=function(_0x5e1b05,_0x103628){return db[_0xfd38('0x3f')][_0xfd38('0x5c')]({'where':{'id':_0x5e1b05['params']['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x103628,null))['then'](removeEntity(_0x103628,null))[_0xfd38('0x2c')](handleError(_0x103628,null));};exports[_0xfd38('0x67')]=function(_0x4a895b,_0x134014){return db[_0xfd38('0x3f')][_0xfd38('0x67')]()[_0xfd38('0x22')](respondWithResult(_0x134014,null))['catch'](handleError(_0x134014,null));};exports[_0xfd38('0x68')]=function(_0x5cf0e4,_0x5a0ef5,_0x4ff190){if(_0x5cf0e4[_0xfd38('0x65')]['id']){delete _0x5cf0e4[_0xfd38('0x65')]['id'];}return db['WhatsappAccount'][_0xfd38('0x5c')]({'where':{'id':_0x5cf0e4[_0xfd38('0x66')]['id']}})['then'](handleEntityNotFound(_0x5a0ef5,null))['then'](function(_0x4bba72){if(_0x4bba72){_0x5cf0e4[_0xfd38('0x65')][_0xfd38('0x69')]=_0x4bba72['id'];return db['Disposition']['create'](_0x5cf0e4[_0xfd38('0x65')]);}})[_0xfd38('0x22')](respondWithResult(_0x5a0ef5,null))[_0xfd38('0x2c')](handleError(_0x5a0ef5,null));};exports[_0xfd38('0x6a')]=function(_0x5ca548,_0x51fe1e,_0x150e27){var _0x4e8d12={'raw':![],'where':{}};var _0x348ecf={};var _0x59a645={'count':0x0,'rows':[]};return db[_0xfd38('0x3f')][_0xfd38('0x6b')]({'where':{'id':_0x5ca548[_0xfd38('0x66')]['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x51fe1e,null))[_0xfd38('0x22')](function(_0x26f64e){if(_0x26f64e){_0x348ecf[_0xfd38('0x44')]=_[_0xfd38('0x5b')](db[_0xfd38('0x6c')][_0xfd38('0x40')]);_0x348ecf[_0xfd38('0x45')]=_[_0xfd38('0x5b')](_0x5ca548['query']);_0x348ecf[_0xfd38('0x46')]=_[_0xfd38('0x47')](_0x348ecf[_0xfd38('0x44')],_0x348ecf[_0xfd38('0x45')]);_0x4e8d12[_0xfd38('0x48')]=_[_0xfd38('0x47')](_0x348ecf[_0xfd38('0x44')],qs[_0xfd38('0x49')](_0x5ca548[_0xfd38('0x45')][_0xfd38('0x49')]));_0x4e8d12[_0xfd38('0x48')]=_0x4e8d12[_0xfd38('0x48')][_0xfd38('0x4a')]?_0x4e8d12[_0xfd38('0x48')]:_0x348ecf[_0xfd38('0x44')];if(!_0x5ca548[_0xfd38('0x45')][_0xfd38('0x4b')](_0xfd38('0x4c'))){_0x4e8d12[_0xfd38('0x4d')]=qs[_0xfd38('0x4d')](_0x5ca548[_0xfd38('0x45')]['limit']);_0x4e8d12[_0xfd38('0x2f')]=qs[_0xfd38('0x2f')](_0x5ca548[_0xfd38('0x45')][_0xfd38('0x2f')]);}_0x4e8d12[_0xfd38('0x4e')]=qs[_0xfd38('0x4f')](_0x5ca548[_0xfd38('0x45')][_0xfd38('0x4f')]);_0x4e8d12[_0xfd38('0x50')]=qs['filters'](_['pick'](_0x5ca548['query'],_0x348ecf[_0xfd38('0x46')]));_0x4e8d12[_0xfd38('0x50')]['WhatsappAccountId']=_0x26f64e['id'];if(_0x5ca548[_0xfd38('0x45')]['filter']){_0x4e8d12[_0xfd38('0x50')]=_[_0xfd38('0x53')](_0x4e8d12[_0xfd38('0x50')],{'$or':_[_0xfd38('0x3e')](_0x4e8d12[_0xfd38('0x48')],function(_0x50c7b4){var _0xb2d72d={};_0xb2d72d[_0x50c7b4]={'$like':'%'+_0x5ca548[_0xfd38('0x45')][_0xfd38('0x52')]+'%'};return _0xb2d72d;})});}_0x4e8d12=_[_0xfd38('0x53')]({},_0x4e8d12,_0x5ca548[_0xfd38('0x55')]);return db[_0xfd38('0x6c')][_0xfd38('0x30')]({'where':_0x4e8d12['where']})[_0xfd38('0x22')](function(_0x53b28d){_0x59a645[_0xfd38('0x30')]=_0x53b28d;if(_0x5ca548[_0xfd38('0x45')][_0xfd38('0x56')]){_0x4e8d12[_0xfd38('0x57')]=[{'all':!![]}];}return db[_0xfd38('0x6c')][_0xfd38('0x6d')](_0x4e8d12);})[_0xfd38('0x22')](function(_0x384049){_0x59a645['rows']=_0x384049;return _0x59a645;});}})[_0xfd38('0x22')](respondWithFilteredResult(_0x51fe1e,_0x4e8d12))[_0xfd38('0x2c')](handleError(_0x51fe1e,null));};exports[_0xfd38('0x6e')]=function(_0x451aa9,_0x19b14d,_0x2058e1){return db[_0xfd38('0x3f')][_0xfd38('0x5c')]({'where':{'id':_0x451aa9[_0xfd38('0x66')]['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x19b14d,null))[_0xfd38('0x22')](function(_0x4d8628){if(_0x4d8628){return _0x4d8628[_0xfd38('0x6e')](_0x451aa9['query'][_0xfd38('0x6f')]);}})['then'](respondWithStatusCode(_0x19b14d,null))[_0xfd38('0x2c')](handleError(_0x19b14d,null));};exports['addAnswer']=function(_0xff289,_0x353a08,_0x6e2303){if(_0xff289[_0xfd38('0x65')]['id']){delete _0xff289[_0xfd38('0x65')]['id'];}return db[_0xfd38('0x3f')][_0xfd38('0x5c')]({'where':{'id':_0xff289['params']['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x353a08,null))[_0xfd38('0x22')](function(_0x4af986){if(_0x4af986){_0xff289[_0xfd38('0x65')][_0xfd38('0x69')]=_0x4af986['id'];return db[_0xfd38('0x70')][_0xfd38('0x5d')](_0xff289[_0xfd38('0x65')]);}})[_0xfd38('0x22')](respondWithResult(_0x353a08,null))['catch'](handleError(_0x353a08,null));};exports[_0xfd38('0x71')]=function(_0x481e4f,_0x39fc39,_0x53bca3){var _0x39f446={'raw':![],'where':{}};var _0x1bedef={};var _0x5c9b97={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xfd38('0x6b')]({'where':{'id':_0x481e4f[_0xfd38('0x66')]['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x39fc39,null))[_0xfd38('0x22')](function(_0x5dcbcd){if(_0x5dcbcd){_0x1bedef['model']=_[_0xfd38('0x5b')](db['CannedAnswer']['rawAttributes']);_0x1bedef[_0xfd38('0x45')]=_[_0xfd38('0x5b')](_0x481e4f[_0xfd38('0x45')]);_0x1bedef[_0xfd38('0x46')]=_[_0xfd38('0x47')](_0x1bedef['model'],_0x1bedef[_0xfd38('0x45')]);_0x39f446['attributes']=_[_0xfd38('0x47')](_0x1bedef[_0xfd38('0x44')],qs[_0xfd38('0x49')](_0x481e4f[_0xfd38('0x45')]['fields']));_0x39f446['attributes']=_0x39f446[_0xfd38('0x48')][_0xfd38('0x4a')]?_0x39f446[_0xfd38('0x48')]:_0x1bedef['model'];if(!_0x481e4f['query'][_0xfd38('0x4b')](_0xfd38('0x4c'))){_0x39f446[_0xfd38('0x4d')]=qs['limit'](_0x481e4f[_0xfd38('0x45')][_0xfd38('0x4d')]);_0x39f446[_0xfd38('0x2f')]=qs[_0xfd38('0x2f')](_0x481e4f[_0xfd38('0x45')][_0xfd38('0x2f')]);}_0x39f446[_0xfd38('0x4e')]=qs[_0xfd38('0x4f')](_0x481e4f[_0xfd38('0x45')][_0xfd38('0x4f')]);_0x39f446['where']=qs[_0xfd38('0x46')](_[_0xfd38('0x51')](_0x481e4f[_0xfd38('0x45')],_0x1bedef[_0xfd38('0x46')]));_0x39f446[_0xfd38('0x50')][_0xfd38('0x69')]=_0x5dcbcd['id'];if(_0x481e4f['query']['filter']){_0x39f446[_0xfd38('0x50')]=_[_0xfd38('0x53')](_0x39f446[_0xfd38('0x50')],{'$or':_[_0xfd38('0x3e')](_0x39f446[_0xfd38('0x48')],function(_0x5b84d2){var _0xdd218c={};_0xdd218c[_0x5b84d2]={'$like':'%'+_0x481e4f[_0xfd38('0x45')][_0xfd38('0x52')]+'%'};return _0xdd218c;})});}_0x39f446=_['merge']({},_0x39f446,_0x481e4f[_0xfd38('0x55')]);return db[_0xfd38('0x70')][_0xfd38('0x30')]({'where':_0x39f446['where']})[_0xfd38('0x22')](function(_0x41996d){_0x5c9b97[_0xfd38('0x30')]=_0x41996d;if(_0x481e4f[_0xfd38('0x45')]['includeAll']){_0x39f446[_0xfd38('0x57')]=[{'all':!![]}];}return db[_0xfd38('0x70')][_0xfd38('0x6d')](_0x39f446);})[_0xfd38('0x22')](function(_0x3ecd1d){_0x5c9b97[_0xfd38('0x58')]=_0x3ecd1d;return _0x5c9b97;});}})[_0xfd38('0x22')](respondWithFilteredResult(_0x39fc39,_0x39f446))[_0xfd38('0x2c')](handleError(_0x39fc39,null));};exports[_0xfd38('0x72')]=function(_0x316b46,_0x56708d,_0x1d7526){return db[_0xfd38('0x3f')]['find']({'where':{'id':_0x316b46[_0xfd38('0x66')]['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x56708d,null))['then'](function(_0x594073){if(_0x594073){return _0x594073['removeAnswers'](_0x316b46['query'][_0xfd38('0x6f')]);}})[_0xfd38('0x22')](respondWithStatusCode(_0x56708d,null))[_0xfd38('0x2c')](handleError(_0x56708d,null));};exports[_0xfd38('0x73')]=function(_0x37a35b,_0x50a0d6,_0x5055f0){return db[_0xfd38('0x3f')][_0xfd38('0x5c')]({'where':{'id':_0x37a35b['params']['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x50a0d6,null))[_0xfd38('0x22')](function(_0x34fce8){if(_0x34fce8){return _0x34fce8['addAgents'](_0x37a35b[_0xfd38('0x65')][_0xfd38('0x6f')],_['omit'](_0x37a35b[_0xfd38('0x65')],[_0xfd38('0x6f'),'id'])||{})[_0xfd38('0x74')](function(_0x2711e9){for(var _0x3edba6=0x0;_0x3edba6<_0x37a35b[_0xfd38('0x65')][_0xfd38('0x6f')]['length'];_0x3edba6+=0x1){socket[_0xfd38('0x75')](_0xfd38('0x76'),{'UserId':Number(_0x37a35b['body']['ids'][_0x3edba6]),'WhatsappAccountId':Number(_0x37a35b[_0xfd38('0x66')]['id'])});}return _0x2711e9;});}})[_0xfd38('0x22')](respondWithResult(_0x50a0d6,null))[_0xfd38('0x2c')](handleError(_0x50a0d6,null));};exports[_0xfd38('0x77')]=function(_0x44f2c9,_0x2c1b50,_0x424bf7){return db[_0xfd38('0x3f')][_0xfd38('0x5c')]({'where':{'id':_0x44f2c9[_0xfd38('0x66')]['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x2c1b50,null))[_0xfd38('0x22')](function(_0x5edd68){if(_0x5edd68){return _0x5edd68[_0xfd38('0x77')](_0x44f2c9['query']['ids'])[_0xfd38('0x22')](function(){if(_['isArray'](_0x44f2c9[_0xfd38('0x45')][_0xfd38('0x6f')])){for(var _0x1a3305=0x0;_0x1a3305<_0x44f2c9[_0xfd38('0x45')][_0xfd38('0x6f')][_0xfd38('0x4a')];_0x1a3305+=0x1){socket[_0xfd38('0x75')](_0xfd38('0x78'),{'UserId':Number(_0x44f2c9[_0xfd38('0x45')][_0xfd38('0x6f')][_0x1a3305]),'WhatsappAccountId':Number(_0x44f2c9[_0xfd38('0x66')]['id'])});}}else{socket[_0xfd38('0x75')](_0xfd38('0x78'),{'UserId':Number(_0x44f2c9[_0xfd38('0x45')][_0xfd38('0x6f')]),'WhatsappAccountId':Number(_0x44f2c9[_0xfd38('0x66')]['id'])});}});}})[_0xfd38('0x22')](respondWithStatusCode(_0x2c1b50,null))[_0xfd38('0x2c')](handleError(_0x2c1b50,null));};exports['getAgents']=function(_0x540300,_0xade271,_0x1568d3){var _0x277137={};var _0x2654f1={};var _0x3a7808;var _0x32f748;return db[_0xfd38('0x3f')]['findOne']({'where':{'id':_0x540300['params']['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0xade271,null))[_0xfd38('0x22')](function(_0x40bb68){if(_0x40bb68){_0x3a7808=_0x40bb68;_0x2654f1[_0xfd38('0x44')]=_['keys'](db[_0xfd38('0x79')][_0xfd38('0x40')]);_0x2654f1[_0xfd38('0x45')]=_[_0xfd38('0x5b')](_0x540300[_0xfd38('0x45')]);_0x2654f1[_0xfd38('0x46')]=_[_0xfd38('0x47')](_0x2654f1['model'],_0x2654f1[_0xfd38('0x45')]);_0x277137[_0xfd38('0x48')]=_[_0xfd38('0x47')](_0x2654f1[_0xfd38('0x44')],qs[_0xfd38('0x49')](_0x540300[_0xfd38('0x45')][_0xfd38('0x49')]));_0x277137['attributes']=_0x277137[_0xfd38('0x48')][_0xfd38('0x4a')]?_0x277137['attributes']:_0x2654f1[_0xfd38('0x44')];_0x277137[_0xfd38('0x4e')]=qs[_0xfd38('0x4f')](_0x540300[_0xfd38('0x45')][_0xfd38('0x4f')]);_0x277137[_0xfd38('0x50')]=qs[_0xfd38('0x46')](_[_0xfd38('0x51')](_0x540300['query'],_0x2654f1[_0xfd38('0x46')]));if(_0x540300['query']['filter']){_0x277137[_0xfd38('0x50')]=_[_0xfd38('0x53')](_0x277137[_0xfd38('0x50')],{'$or':_[_0xfd38('0x3e')](_0x277137[_0xfd38('0x48')],function(_0x3d3e8e){var _0x4ec4c6={};_0x4ec4c6[_0x3d3e8e]={'$like':'%'+_0x540300[_0xfd38('0x45')][_0xfd38('0x52')]+'%'};return _0x4ec4c6;})});}_0x277137=_[_0xfd38('0x53')]({},_0x277137,_0x540300[_0xfd38('0x55')]);return _0x3a7808[_0xfd38('0x7a')](_0x277137);}})[_0xfd38('0x22')](function(_0x576494){if(_0x576494){_0x32f748=_0x576494[_0xfd38('0x4a')];if(!_0x540300[_0xfd38('0x45')][_0xfd38('0x4b')]('nolimit')){_0x277137[_0xfd38('0x4d')]=qs[_0xfd38('0x4d')](_0x540300[_0xfd38('0x45')][_0xfd38('0x4d')]);_0x277137[_0xfd38('0x2f')]=qs[_0xfd38('0x2f')](_0x540300[_0xfd38('0x45')][_0xfd38('0x2f')]);}return _0x3a7808[_0xfd38('0x7a')](_0x277137);}})['then'](function(_0x47e007){if(_0x47e007){return _0x47e007?{'count':_0x32f748,'rows':_0x47e007}:null;}})[_0xfd38('0x22')](respondWithResult(_0xade271,null))[_0xfd38('0x2c')](handleError(_0xade271,null));};exports[_0xfd38('0x7b')]=function(_0x37f21c,_0x1a1569){var _0x165cb4=_0x37f21c[_0xfd38('0x66')]['id'];var _0x4e2edf=_0x37f21c[_0xfd38('0x65')];var _0x88d5db=0xc8;var _0xdc8e9c=null;return db[_0xfd38('0x7c')][_0xfd38('0x7d')]({'isolationLevel':db[_0xfd38('0x7c')][_0xfd38('0x7e')][_0xfd38('0x7f')][_0xfd38('0x80')]},function(_0x6af0d4){return db['WhatsappAccount']['findOne']({'where':{'id':_0x165cb4},'transaction':_0x6af0d4})['then'](function(_0x16aa13){if(_0x16aa13){return db[_0xfd38('0x81')][_0xfd38('0x38')]({'where':{'WhatsappAccountId':_0x165cb4},'transaction':_0x6af0d4})[_0xfd38('0x22')](function(){var _0x51229e=_['map'](_0x4e2edf,function(_0x42b0a9){_0x42b0a9[_0xfd38('0x69')]=_0x165cb4;return _0x42b0a9;});return db['WhatsappApplication'][_0xfd38('0x82')](_0x51229e,{'transaction':_0x6af0d4});});}else{_0x88d5db=0x194;_0xdc8e9c=[];}});})[_0xfd38('0x22')](function(){if(_0x88d5db!==0x194){return db[_0xfd38('0x81')][_0xfd38('0x83')]({'where':{'WhatsappAccountId':_0x165cb4},'order':_0xfd38('0x84')})[_0xfd38('0x22')](function(_0x31be09){_0xdc8e9c=_0x31be09;});}})[_0xfd38('0x2c')](function(_0x1f3a0f){_0x88d5db=0x1f4;logger[_0xfd38('0x27')](_0x1f3a0f['stack']);if(_0x1f3a0f['name']){delete _0x1f3a0f[_0xfd38('0x3b')];}_0xdc8e9c=_0x1f3a0f;})[_0xfd38('0x85')](function(){if(_0xdc8e9c===null){_0x1a1569[_0xfd38('0x2d')](_0x88d5db);}else{if(_0x88d5db===0x1f4){_0x1a1569[_0xfd38('0x2e')](_0x88d5db)[_0xfd38('0x86')](_0xdc8e9c);}else{_0x1a1569[_0xfd38('0x2e')](_0x88d5db)[_0xfd38('0x33')](_0xdc8e9c);}}});};exports[_0xfd38('0x87')]=function(_0x5e33ba,_0x364872,_0x5f7406){var _0x90615f={};var _0x199494={};var _0x1d9a3e;var _0x3a7939;return db[_0xfd38('0x3f')][_0xfd38('0x6b')]({'where':{'id':_0x5e33ba[_0xfd38('0x66')]['id']}})[_0xfd38('0x22')](handleEntityNotFound(_0x364872,null))[_0xfd38('0x22')](function(_0x14d619){if(_0x14d619){_0x1d9a3e=_0x14d619;_0x199494[_0xfd38('0x44')]=_['keys'](db[_0xfd38('0x81')]['rawAttributes']);_0x199494[_0xfd38('0x45')]=_[_0xfd38('0x5b')](_0x5e33ba[_0xfd38('0x45')]);_0x199494[_0xfd38('0x46')]=_[_0xfd38('0x47')](_0x199494[_0xfd38('0x44')],_0x199494['query']);_0x90615f[_0xfd38('0x48')]=_[_0xfd38('0x47')](_0x199494[_0xfd38('0x44')],qs[_0xfd38('0x49')](_0x5e33ba[_0xfd38('0x45')][_0xfd38('0x49')]));_0x90615f['attributes']=_0x90615f[_0xfd38('0x48')]['length']?_0x90615f[_0xfd38('0x48')]:_0x199494[_0xfd38('0x44')];_0x90615f[_0xfd38('0x4e')]=qs[_0xfd38('0x4f')](_0x5e33ba[_0xfd38('0x45')][_0xfd38('0x4f')]);_0x90615f['where']=qs[_0xfd38('0x46')](_['pick'](_0x5e33ba[_0xfd38('0x45')],_0x199494[_0xfd38('0x46')]));if(_0x5e33ba[_0xfd38('0x45')][_0xfd38('0x52')]){_0x90615f[_0xfd38('0x50')]=_[_0xfd38('0x53')](_0x90615f['where'],{'$or':_[_0xfd38('0x3e')](_0x90615f[_0xfd38('0x48')],function(_0x29376){var _0x31c186={};_0x31c186[_0x29376]={'$like':'%'+_0x5e33ba[_0xfd38('0x45')][_0xfd38('0x52')]+'%'};return _0x31c186;})});}_0x90615f=_[_0xfd38('0x53')]({},_0x90615f,_0x5e33ba[_0xfd38('0x55')]);return _0x1d9a3e[_0xfd38('0x87')](_0x90615f);}})[_0xfd38('0x22')](function(_0x82c9cc){if(_0x82c9cc){_0x3a7939=_0x82c9cc['length'];if(!_0x5e33ba['query'][_0xfd38('0x4b')](_0xfd38('0x4c'))){_0x90615f[_0xfd38('0x4d')]=qs['limit'](_0x5e33ba[_0xfd38('0x45')]['limit']);_0x90615f[_0xfd38('0x2f')]=qs['offset'](_0x5e33ba[_0xfd38('0x45')][_0xfd38('0x2f')]);}return _0x1d9a3e[_0xfd38('0x87')](_0x90615f);}})[_0xfd38('0x22')](function(_0x2f64fd){if(_0x2f64fd){return _0x2f64fd?{'count':_0x3a7939,'rows':_0x2f64fd}:null;}})['then'](respondWithResult(_0x364872,null))[_0xfd38('0x2c')](handleError(_0x364872,null));};exports[_0xfd38('0x88')]=function(_0x4add21,_0x3a0598,_0x2ed296){var _0x41889c={'channel':_0xfd38('0x89')};var _0x109151=[];var _0x5fe5c2=[];var _0x55db0c={};return db[_0xfd38('0x3f')][_0xfd38('0x5c')]({'where':{'id':_0x4add21[_0xfd38('0x66')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xfd38('0x8a')}]})[_0xfd38('0x22')](handleEntityNotFound(_0x3a0598,null))[_0xfd38('0x22')](function(_0xea897d){_0x41889c['account']=_0xea897d;if(_0x41889c[_0xfd38('0x8b')]&&_0x41889c[_0xfd38('0x8b')][_0xfd38('0x42')]===_0xfd38('0x8c')&&_0x4add21['body'][_0xfd38('0x8d')]){if(_0x4add21['body'][_0xfd38('0x8d')][_0xfd38('0x4a')]===0x0)return;if(_0x4add21['body'][_0xfd38('0x8d')][0x0][_0xfd38('0x8e')]!==_0xfd38('0x8f'))return;return db['WhatsappMessage'][_0xfd38('0x36')]({'read':!![],'readAt':_0x4add21[_0xfd38('0x65')][_0xfd38('0x8d')][0x0][_0xfd38('0x90')]},{'where':{'messageId':_0x4add21[_0xfd38('0x65')][_0xfd38('0x8d')][0x0][_0xfd38('0x91')]},'individualHooks':!![]})[_0xfd38('0x22')](function(_0x4f18bb){return _0x3a0598[_0xfd38('0x2e')](0xc8)[_0xfd38('0x33')](_0x4f18bb);});}_0x41889c['applications']=_[_0xfd38('0x92')](_0xea897d['Applications'],[_0xfd38('0x84')],[_0xfd38('0x93')]);if(_0x41889c['account'][_0xfd38('0x8a')]){delete _0x41889c['account'][_0xfd38('0x8a')];}return db[_0xfd38('0x94')][_0xfd38('0x67')]()[_0xfd38('0x22')](function(_0x41fd92){if(!_0x41fd92){throw new db[(_0xfd38('0x95'))][(_0xfd38('0x96'))](_0xfd38('0x97'));}_0x109151=_[_0xfd38('0x98')](_['keys'](_0x41fd92),[_0xfd38('0x99'),_0xfd38('0x9a')]);_0x5fe5c2=_[_0xfd38('0x98')](_[_0xfd38('0x5b')](_0x41fd92),['createdAt',_0xfd38('0x9a'),_0xfd38('0x9b'),_0xfd38('0x9c')]);_0x41889c[_0xfd38('0x65')]={'mapKey':_0xfd38('0x9d')};if(_0x41889c[_0xfd38('0x8b')]&&_0x41889c['account'][_0xfd38('0x42')]===_0xfd38('0x9e')){_0x41889c[_0xfd38('0x65')][_0xfd38('0x9f')]=_0x4add21[_0xfd38('0x65')][_0xfd38('0xa0')][_0xfd38('0xa1')](_0xfd38('0xa2'),'');_0x41889c[_0xfd38('0x65')]['body']=_0x4add21[_0xfd38('0x65')][_0xfd38('0xa3')];_0x41889c['body'][_0xfd38('0xa4')]=_0x4add21[_0xfd38('0x65')][_0xfd38('0xa5')];}if(_0x41889c['account']&&_0x41889c[_0xfd38('0x8b')]['type']===_0xfd38('0x8c')){_0x41889c['body'][_0xfd38('0x9f')]=_0x4add21[_0xfd38('0x65')][_0xfd38('0xa6')][0x0][_0xfd38('0x9f')];_0x41889c['body']['body']=_0x4add21[_0xfd38('0x65')][_0xfd38('0xa6')][0x0][_0xfd38('0x29')][_0xfd38('0x65')];_0x41889c[_0xfd38('0x65')]['messageId']=_0x4add21[_0xfd38('0x65')]['notifications'][0x0]['message_id'];}if(_0x41889c[_0xfd38('0x65')]['id']){delete _0x41889c[_0xfd38('0x65')]['id'];}if(_[_0xfd38('0xa7')](_0x41889c[_0xfd38('0x65')][_0xfd38('0x9f')])){throw new db[(_0xfd38('0x95'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x41889c[_0xfd38('0x65')]['body'])||_0x41889c[_0xfd38('0x65')][_0xfd38('0x65')]===''){throw new db[(_0xfd38('0x95'))][(_0xfd38('0x96'))](_0xfd38('0xa8'));}if(_[_0xfd38('0xa7')](_0x41889c['body'][_0xfd38('0xa9')])){throw new db['Sequelize'][(_0xfd38('0x96'))](_0xfd38('0xaa')+_0x5fe5c2);}if(!_[_0xfd38('0xab')](_0x5fe5c2,_0x41889c[_0xfd38('0x65')][_0xfd38('0xa9')])){throw new db[(_0xfd38('0x95'))][(_0xfd38('0x96'))](_0xfd38('0xac')+_0x5fe5c2);}_0x55db0c[_0x41889c[_0xfd38('0x65')][_0xfd38('0xa9')]]=_0x41889c[_0xfd38('0x65')][_0xfd38('0x9f')];return db[_0xfd38('0xad')][_0xfd38('0x5c')]({'where':{'id':_0x41889c[_0xfd38('0x8b')][_0xfd38('0x9c')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x55db0c,'limit':0x1,'order':[[_0xfd38('0x9a'),'DESC']]}]});})[_0xfd38('0x22')](handleEntityNotFound(_0x3a0598,null))[_0xfd38('0x22')](function(_0x48a1cf){if(_0x48a1cf){_0x41889c[_0xfd38('0xae')]=_['omit'](_0x48a1cf,[_0xfd38('0xaf')]);if(_0x48a1cf[_0xfd38('0xaf')][_0xfd38('0x4a')]){return _0x48a1cf[_0xfd38('0xaf')][0x0];}var _0x4f57e8=_[_0xfd38('0x1a')](_0x41889c['body'],{'firstName':_0x41889c[_0xfd38('0x65')][_0xfd38('0x9f')],'ListId':_0x48a1cf['id']});_0x4f57e8[_0x41889c['body'][_0xfd38('0xa9')]]=_0x41889c[_0xfd38('0x65')][_0xfd38('0x9f')];return db['CmContact']['create'](_0x4f57e8,{'fields':_0x109151,'raw':!![]});}})[_0xfd38('0x22')](handleEntityNotFound(_0x3a0598,null))[_0xfd38('0x22')](function(_0x179e96){if(_0x179e96){_0x41889c[_0xfd38('0xb0')]=_0x179e96;var _0x22a756={'ContactId':_0x179e96['id'],'phone':_0x41889c[_0xfd38('0x65')][_0xfd38('0x9f')],'WhatsappAccountId':_0x4add21[_0xfd38('0x66')]['id']};var _0x42df83={'ContactId':_0x179e96['id'],'WhatsappAccountId':_0x4add21['params']['id'],'closed':![]};return db[_0xfd38('0xb1')]['find']({'where':_0x42df83})[_0xfd38('0x22')](function(_0x31a761){if(_0x31a761){return[_0x31a761,![]];}return db[_0xfd38('0xb1')][_0xfd38('0x5d')](_0x22a756)['then'](function(_0x356acb){return[_0x356acb,!![]];});});}})[_0xfd38('0x74')](function(_0x4b91e1,_0x4bc0ae){_0x41889c[_0xfd38('0xb2')]=_0x4b91e1[_0xfd38('0x5f')]({'plain':!![]});_0x41889c[_0xfd38('0xb2')][_0xfd38('0xb3')]=![];if(_0x4bc0ae){if(_0x41889c[_0xfd38('0x8b')][_0xfd38('0xb4')]){_0x41889c[_0xfd38('0xb5')][_0xfd38('0xb6')]({'id':0x0,'priority':_0x41889c['applications']['length']+0x1,'app':_0xfd38('0xb7'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x41889c[_0xfd38('0xb2')][_0xfd38('0xb3')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x41889c[_0xfd38('0x65')][_0xfd38('0x9f')],'messageId':_0x41889c[_0xfd38('0x65')][_0xfd38('0xa4')],'body':_0x41889c[_0xfd38('0x65')][_0xfd38('0x65')],'WhatsappAccountId':_0x4add21[_0xfd38('0x66')]['id'],'WhatsappInteractionId':_0x4b91e1['id'],'direction':'in','ContactId':_0x4b91e1[_0xfd38('0xb8')],'AttachmentId':_0x41889c['body'][_0xfd38('0xb9')]});})[_0xfd38('0x22')](function(_0x5ad4d9){_0x41889c[_0xfd38('0x29')]=_0x5ad4d9;if(!_0x41889c[_0xfd38('0xb2')][_0xfd38('0xba')])return;return db['User'][_0xfd38('0x5c')]({'attributes':['id',_0xfd38('0x3b')],'where':{'id':_0x41889c['interaction'][_0xfd38('0xba')]}});})[_0xfd38('0x22')](function(_0x12f714){if(_0x12f714){_0x41889c['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xfd38('0xbb'),'appdata':_0x12f714[_0xfd38('0x3b')]+','+(_0x41889c[_0xfd38('0x8b')][_0xfd38('0xbc')]||0xa),'interval':_0xfd38('0xbd')});}if(!_0x41889c[_0xfd38('0xb2')][_0xfd38('0xbe')])return;return db[_0xfd38('0xbf')][_0xfd38('0x5c')]({'attributes':['id',_0xfd38('0x3b')],'where':{'id':_0x41889c[_0xfd38('0xb2')]['queueId']}});})['then'](function(_0x52f81c){if(_0x52f81c){_0x41889c['applications'][_0xfd38('0xc0')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x52f81c[_0xfd38('0x3b')]+','+(_0x41889c[_0xfd38('0x8b')][_0xfd38('0xc1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xfd38('0xc2'),_0xfd38('0xc3'),_0x41889c);})[_0xfd38('0x22')](function(_0x24e2b8){if(_0x24e2b8){var _0x2a0fd1=0xc8;var _0x2ed7c2='receiveMessage';logger[_0xfd38('0x23')](_0xfd38('0x26'),_0x2ed7c2,_0x2a0fd1,_0xfd38('0xc4'));logger['debug'](_0xfd38('0xc5'),_0x2ed7c2,_0x2a0fd1,'entity\x20found',JSON['stringify'](_0x24e2b8));if(_0x41889c[_0xfd38('0x8b')][_0xfd38('0x42')]===_0xfd38('0x9e')){return _0x3a0598['status'](_0x2a0fd1)['set'](_0xfd38('0xc6'),'text/xml')[_0xfd38('0x86')](_0xfd38('0xc7'));}else{return _0x3a0598[_0xfd38('0x2e')](_0x2a0fd1)[_0xfd38('0x33')](_0x24e2b8);}}});})[_0xfd38('0x2c')](handleError(_0x3a0598,null));};exports['send']=function(_0x49ca32,_0x44ad46,_0x11f097){var _0x23beda,_0x135a4d,_0x1988cc;if(_[_0xfd38('0xa7')](_0x49ca32['body'][_0xfd38('0x65')])||_0x49ca32['body'][_0xfd38('0x65')]===''){throw new db[(_0xfd38('0x95'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x49ca32[_0xfd38('0x65')]['to'])){throw new db['Sequelize'][(_0xfd38('0x96'))](_0xfd38('0xc8'));}_0x23beda=_0x49ca32[_0xfd38('0x65')]['to'];return db[_0xfd38('0x3f')]['find']({'where':{'id':_0x49ca32[_0xfd38('0x66')]['id']},'include':[{'model':db[_0xfd38('0xad')],'as':_0xfd38('0xc9'),'include':[{'model':db[_0xfd38('0x94')],'as':_0xfd38('0xaf'),'where':{'mobile':_0x23beda},'limit':0x1,'order':[[_0xfd38('0x9a'),_0xfd38('0xca')]]}]}]})['then'](handleEntityNotFound(_0x44ad46,null))[_0xfd38('0x22')](function(_0x38abdb){if(_0x38abdb&&_0x38abdb[_0xfd38('0xc9')]){_0x135a4d=_0x38abdb[_0xfd38('0x5f')]({'plain':!![]});if(_0x135a4d[_0xfd38('0xc9')]&&_0x135a4d[_0xfd38('0xc9')][_0xfd38('0xaf')][_0xfd38('0x4a')]){return _0x135a4d[_0xfd38('0xc9')][_0xfd38('0xaf')][0x0];}return db['CmContact'][_0xfd38('0x5d')](_[_0xfd38('0x1a')](_0x49ca32['body'],{'firstName':_0x23beda,'mobile':_0x23beda,'phone':_0x23beda,'ListId':_0x135a4d[_0xfd38('0x9c')]}));}})[_0xfd38('0x22')](handleEntityNotFound(_0x44ad46,null))[_0xfd38('0x22')](function(_0x1a96d5){if(_0x1a96d5){_0x1988cc=_0x1a96d5;return db[_0xfd38('0xb1')][_0xfd38('0x5c')]({'where':{'ContactId':_0x1988cc['id'],'closed':![],'WhatsappAccountId':_0x135a4d['id']}})['then'](function(_0x21ccdc){if(_0x21ccdc){return[_0x21ccdc,![]];}return db[_0xfd38('0xb1')][_0xfd38('0x5d')]({'UserId':_0x49ca32[_0xfd38('0x5e')]['id'],'ContactId':_0x1988cc['id'],'WhatsappAccountId':_0x135a4d['id'],'phone':_0x23beda,'firstMsgDirection':_0xfd38('0xcb'),'Messages':[_['merge'](_0x49ca32[_0xfd38('0x65')],{'read':![],'body':_0x49ca32[_0xfd38('0x65')][_0xfd38('0x65')],'phone':_0x23beda,'WhatsappAccountId':_0x135a4d['id'],'UserId':_0x49ca32[_0xfd38('0x5e')]['id'],'ContactId':_0x1988cc['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xfd38('0xcc')}]})['then'](function(_0x1470c9){return[_0x1470c9,!![]];});});}})['spread'](function(_0x18352e,_0x12df82){if(_0x12df82){return _0x18352e;}return db['WhatsappMessage'][_0xfd38('0x5d')](_[_0xfd38('0x53')](_0x49ca32[_0xfd38('0x65')],{'read':![],'body':_0x49ca32[_0xfd38('0x65')][_0xfd38('0x65')],'phone':_0x23beda,'WhatsappAccountId':_0x135a4d['id'],'WhatsappInteractionId':_0x18352e['id'],'UserId':_0x49ca32[_0xfd38('0x5e')]['id'],'ContactId':_0x1988cc['id']}))[_0xfd38('0x22')](function(_0x5937c7){_0x18352e[_0xfd38('0xcd')][_0xfd38('0xcc')]=[];_0x18352e[_0xfd38('0xcd')]['Messages']['push'](_0x5937c7[_0xfd38('0xcd')]);return _0x18352e;});})[_0xfd38('0x22')](respondWithResult(_0x44ad46,null))[_0xfd38('0x2c')](handleError(_0x44ad46,null));}; \ No newline at end of file +var _0x5610=['CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','replace','whatsapp:','messageId','MessageSid','message_id','isNil','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','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','close','*,*,*,*','ContactId','UserId','unshift','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','to\x20is\x20mandatory','CmList','List','Messages','WhatsappMessage','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','get','WhatsappAccounts','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','Pause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','addDisposition','Disposition','getDispositions','findOne','include','removeDispositions','ids','addAnswer','WhatsappAccountId','getAnswers','CannedAnswer','hasOwnProperty','pick','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','asc'];(function(_0x2f9f2b,_0x2de7ed){var _0x497d69=function(_0x1d2960){while(--_0x1d2960){_0x2f9f2b['push'](_0x2f9f2b['shift']());}};_0x497d69(++_0x2de7ed);}(_0x5610,0x100));var _0x0561=function(_0x3d006e,_0x5e7af2){_0x3d006e=_0x3d006e-0x0;var _0x19b490=_0x5610[_0x3d006e];return _0x19b490;};'use strict';var emlformat=require(_0x0561('0x0'));var rimraf=require(_0x0561('0x1'));var zipdir=require(_0x0561('0x2'));var jsonpatch=require(_0x0561('0x3'));var rp=require(_0x0561('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0561('0x5'));var util=require(_0x0561('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0561('0x7'));var ejs=require(_0x0561('0x8'));var fs=require('fs');var fs_extra=require(_0x0561('0x9'));var _=require(_0x0561('0xa'));var squel=require(_0x0561('0xb'));var crypto=require(_0x0561('0xc'));var jsforce=require(_0x0561('0xd'));var deskjs=require(_0x0561('0xe'));var toCsv=require(_0x0561('0x7'));var querystring=require(_0x0561('0xf'));var Papa=require(_0x0561('0x10'));var Redis=require('ioredis');var authService=require(_0x0561('0x11'));var qs=require(_0x0561('0x12'));var as=require(_0x0561('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0561('0x14'))(_0x0561('0x15'));var utils=require('../../config/utils');var config=require(_0x0561('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0561('0x17')]=_[_0x0561('0x18')](config[_0x0561('0x17')],{'host':_0x0561('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0561('0x17')]));require(_0x0561('0x1a'))[_0x0561('0x1b')](socket);var jayson=require(_0x0561('0x1c'));var client=jayson['client'][_0x0561('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5188b2,_0x38a5ba,_0xdb29b1,_0x198bbe){return new BPromise(function(_0x4c2dd4,_0x3fdc54){var _0x22ba73=_0x198bbe||client;return _0x22ba73['request'](_0x5188b2,_0xdb29b1)[_0x0561('0x1e')](function(_0x5386db){logger[_0x0561('0x1f')](_0x0561('0x20'),_0x38a5ba,_0x0561('0x21'));logger[_0x0561('0x22')](_0x0561('0x23'),_0x38a5ba,'request\x20sent',JSON[_0x0561('0x24')](_0x5386db));if(_0x5386db[_0x0561('0x25')]){if(_0x5386db['error'][_0x0561('0x26')]===0x1f4){logger[_0x0561('0x25')](_0x0561('0x20'),_0x38a5ba,_0x5386db[_0x0561('0x25')][_0x0561('0x27')]);return _0x3fdc54(_0x5386db[_0x0561('0x25')][_0x0561('0x27')]);}logger['error'](_0x0561('0x20'),_0x38a5ba,_0x5386db[_0x0561('0x25')][_0x0561('0x27')]);return _0x4c2dd4(_0x5386db[_0x0561('0x25')][_0x0561('0x27')]);}else{logger['info'](_0x0561('0x20'),_0x38a5ba,_0x0561('0x21'));_0x4c2dd4(_0x5386db['result'][_0x0561('0x27')]);}})[_0x0561('0x28')](function(_0x543a1a){logger[_0x0561('0x25')](_0x0561('0x20'),_0x38a5ba,_0x543a1a);_0x3fdc54(_0x543a1a);});});}function respondWithStatusCode(_0xe05b8c,_0x4657bc){_0x4657bc=_0x4657bc||0xcc;return function(_0x584315){if(_0x584315){return _0xe05b8c[_0x0561('0x29')](_0x4657bc);}return _0xe05b8c[_0x0561('0x2a')](_0x4657bc)[_0x0561('0x2b')]();};}function respondWithResult(_0x2c35d3,_0x3ccd61){_0x3ccd61=_0x3ccd61||0xc8;return function(_0x303d3b){if(_0x303d3b){return _0x2c35d3[_0x0561('0x2a')](_0x3ccd61)[_0x0561('0x2c')](_0x303d3b);}};}function respondWithFilteredResult(_0x426e8d,_0x41525b){return function(_0xea6cc3){if(_0xea6cc3){var _0x4cd50c=typeof _0x41525b[_0x0561('0x2d')]===_0x0561('0x2e')&&typeof _0x41525b[_0x0561('0x2f')]==='undefined';var _0x506f29=_0xea6cc3[_0x0561('0x30')];var _0xfd59bf=_0x4cd50c?0x0:_0x41525b[_0x0561('0x2d')];var _0x2aff78=_0x4cd50c?_0xea6cc3[_0x0561('0x30')]:_0x41525b[_0x0561('0x2d')]+_0x41525b[_0x0561('0x2f')];var _0x52b74a;if(_0x2aff78>=_0x506f29){_0x2aff78=_0x506f29;_0x52b74a=0xc8;}else{_0x52b74a=0xce;}_0x426e8d[_0x0561('0x2a')](_0x52b74a);return _0x426e8d[_0x0561('0x31')](_0x0561('0x32'),_0xfd59bf+'-'+_0x2aff78+'/'+_0x506f29)['json'](_0xea6cc3);}return null;};}function patchUpdates(_0x2d5145){return function(_0x174812){try{jsonpatch[_0x0561('0x33')](_0x174812,_0x2d5145,!![]);}catch(_0x507e64){return BPromise[_0x0561('0x34')](_0x507e64);}return _0x174812[_0x0561('0x35')]();};}function saveUpdates(_0x46ec38,_0x28ec35){return function(_0xf3ca9c){if(_0xf3ca9c){return _0xf3ca9c['update'](_0x46ec38)[_0x0561('0x1e')](function(_0x2c388e){return _0x2c388e;});}return null;};}function removeEntity(_0x29a221,_0x162236){return function(_0x102188){if(_0x102188){return _0x102188['destroy']()[_0x0561('0x1e')](function(){var _0x574c08=_0x102188[_0x0561('0x36')]({'plain':!![]});var _0x37808c=_0x0561('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x37808c,'resourceId':_0x574c08['id']}})['then'](function(){return _0x102188;});})[_0x0561('0x1e')](function(){_0x29a221[_0x0561('0x2a')](0xcc)[_0x0561('0x2b')]();});}};}function handleEntityNotFound(_0x1bd194,_0x536769){return function(_0x5dde38){if(!_0x5dde38){_0x1bd194[_0x0561('0x29')](0x194);}return _0x5dde38;};}function handleError(_0x216ea4,_0x9e1708){_0x9e1708=_0x9e1708||0x1f4;return function(_0x5c07b9){logger[_0x0561('0x25')](_0x5c07b9[_0x0561('0x38')]);if(_0x5c07b9[_0x0561('0x39')]){delete _0x5c07b9[_0x0561('0x39')];}_0x216ea4['status'](_0x9e1708)['send'](_0x5c07b9);};}exports[_0x0561('0x3a')]=function(_0x57444e,_0x238024){var _0x24ff8e={'include':[{'model':db['Pause'],'as':_0x0561('0x3b')}]},_0x469768={},_0x492597={'count':0x0,'rows':[]};var _0x467ef8=_[_0x0561('0x3c')](db[_0x0561('0x3d')][_0x0561('0x3e')],function(_0x92ca59){return{'name':_0x92ca59[_0x0561('0x3f')],'type':_0x92ca59[_0x0561('0x40')][_0x0561('0x41')]};});_0x469768[_0x0561('0x42')]=_[_0x0561('0x3c')](_0x467ef8,_0x0561('0x39'));_0x469768[_0x0561('0x43')]=_[_0x0561('0x44')](_0x57444e[_0x0561('0x43')]);_0x469768[_0x0561('0x45')]=_[_0x0561('0x46')](_0x469768[_0x0561('0x42')],_0x469768[_0x0561('0x43')]);_0x24ff8e['attributes']=_[_0x0561('0x46')](_0x469768['model'],qs[_0x0561('0x47')](_0x57444e[_0x0561('0x43')][_0x0561('0x47')]));_0x24ff8e[_0x0561('0x48')]=_0x24ff8e[_0x0561('0x48')][_0x0561('0x49')]?_0x24ff8e[_0x0561('0x48')]:_0x469768[_0x0561('0x42')];if(!_0x57444e[_0x0561('0x43')]['hasOwnProperty'](_0x0561('0x4a'))){_0x24ff8e['limit']=qs['limit'](_0x57444e[_0x0561('0x43')][_0x0561('0x2f')]);_0x24ff8e['offset']=qs[_0x0561('0x2d')](_0x57444e[_0x0561('0x43')][_0x0561('0x2d')]);}_0x24ff8e[_0x0561('0x4b')]=qs[_0x0561('0x4c')](_0x57444e['query'][_0x0561('0x4c')]);_0x24ff8e[_0x0561('0x4d')]=qs['filters'](_['pick'](_0x57444e[_0x0561('0x43')],_0x469768[_0x0561('0x45')]),_0x467ef8);if(_0x57444e[_0x0561('0x43')][_0x0561('0x4e')]){_0x24ff8e[_0x0561('0x4d')]=_[_0x0561('0x4f')](_0x24ff8e[_0x0561('0x4d')],{'$or':_[_0x0561('0x3c')](_0x467ef8,function(_0x3cd840){if(_0x3cd840[_0x0561('0x40')]!=='VIRTUAL'){var _0x3fd190={};_0x3fd190[_0x3cd840[_0x0561('0x39')]]={'$like':'%'+_0x57444e[_0x0561('0x43')][_0x0561('0x4e')]+'%'};return _0x3fd190;}})});}_0x24ff8e=_[_0x0561('0x4f')]({},_0x24ff8e,_0x57444e[_0x0561('0x50')]);var _0x20568a={'where':_0x24ff8e[_0x0561('0x4d')]};return db[_0x0561('0x3d')][_0x0561('0x30')](_0x20568a)[_0x0561('0x1e')](function(_0x1313bd){_0x492597[_0x0561('0x30')]=_0x1313bd;if(_0x57444e[_0x0561('0x43')][_0x0561('0x51')]){_0x24ff8e['include']=[{'all':!![]}];}return db[_0x0561('0x3d')][_0x0561('0x52')](_0x24ff8e);})['then'](function(_0x52745c){_0x492597[_0x0561('0x53')]=_0x52745c;return _0x492597;})['then'](respondWithFilteredResult(_0x238024,_0x24ff8e))[_0x0561('0x28')](handleError(_0x238024,null));};exports[_0x0561('0x54')]=function(_0x18c85b,_0x3d5b37){var _0xe09f24={'raw':![],'where':{'id':_0x18c85b[_0x0561('0x55')]['id']},'include':[{'model':db[_0x0561('0x56')],'as':_0x0561('0x3b')}]},_0x4f149d={};_0x4f149d[_0x0561('0x42')]=_[_0x0561('0x44')](db[_0x0561('0x3d')][_0x0561('0x3e')]);_0x4f149d['query']=_['keys'](_0x18c85b['query']);_0x4f149d[_0x0561('0x45')]=_[_0x0561('0x46')](_0x4f149d[_0x0561('0x42')],_0x4f149d[_0x0561('0x43')]);_0xe09f24[_0x0561('0x48')]=_[_0x0561('0x46')](_0x4f149d[_0x0561('0x42')],qs[_0x0561('0x47')](_0x18c85b[_0x0561('0x43')][_0x0561('0x47')]));_0xe09f24[_0x0561('0x48')]=_0xe09f24['attributes'][_0x0561('0x49')]?_0xe09f24[_0x0561('0x48')]:_0x4f149d['model'];if(_0x18c85b[_0x0561('0x43')][_0x0561('0x51')]){_0xe09f24['include']=[{'all':!![]}];}_0xe09f24=_[_0x0561('0x4f')]({},_0xe09f24,_0x18c85b['options']);return db[_0x0561('0x3d')]['find'](_0xe09f24)[_0x0561('0x1e')](handleEntityNotFound(_0x3d5b37,null))[_0x0561('0x1e')](respondWithResult(_0x3d5b37,null))[_0x0561('0x28')](handleError(_0x3d5b37,null));};exports[_0x0561('0x57')]=function(_0x261711,_0x1d35c0){return db[_0x0561('0x3d')][_0x0561('0x57')](_0x261711[_0x0561('0x58')],{})[_0x0561('0x1e')](function(_0x358502){var _0x22ddc6=_0x261711[_0x0561('0x59')][_0x0561('0x36')]({'plain':!![]});if(!_0x22ddc6)throw new Error(_0x0561('0x5a'));if(_0x22ddc6[_0x0561('0x5b')]===_0x0561('0x59')){var _0xe159fb=_0x358502[_0x0561('0x36')]({'plain':!![]});var _0x245732=_0x0561('0x37');return db['UserProfileSection'][_0x0561('0x5c')]({'where':{'name':_0x245732,'userProfileId':_0x22ddc6[_0x0561('0x5d')]},'raw':!![]})[_0x0561('0x1e')](function(_0x2e7387){if(_0x2e7387&&_0x2e7387[_0x0561('0x5e')]===0x0){return db[_0x0561('0x5f')][_0x0561('0x57')]({'name':_0xe159fb[_0x0561('0x39')],'resourceId':_0xe159fb['id'],'type':_0x2e7387[_0x0561('0x39')],'sectionId':_0x2e7387['id']},{})[_0x0561('0x1e')](function(){return _0x358502;});}else{return _0x358502;}})[_0x0561('0x28')](function(_0x48cd03){logger[_0x0561('0x25')](_0x0561('0x60'),_0x48cd03);throw _0x48cd03;});}return _0x358502;})[_0x0561('0x1e')](respondWithResult(_0x1d35c0,0xc9))[_0x0561('0x28')](handleError(_0x1d35c0,null));};exports[_0x0561('0x61')]=function(_0x3ada87,_0x1d29c5){if(_0x3ada87[_0x0561('0x58')]['id']){delete _0x3ada87[_0x0561('0x58')]['id'];}return db[_0x0561('0x3d')][_0x0561('0x5c')]({'where':{'id':_0x3ada87[_0x0561('0x55')]['id']},'include':[{'model':db[_0x0561('0x56')],'as':'mandatoryDispositionPause'}]})[_0x0561('0x1e')](handleEntityNotFound(_0x1d29c5,null))[_0x0561('0x1e')](saveUpdates(_0x3ada87['body'],null))[_0x0561('0x1e')](respondWithResult(_0x1d29c5,null))['catch'](handleError(_0x1d29c5,null));};exports[_0x0561('0x62')]=function(_0x49e36f,_0x4ca6bc){return db[_0x0561('0x3d')][_0x0561('0x5c')]({'where':{'id':_0x49e36f[_0x0561('0x55')]['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x4ca6bc,null))[_0x0561('0x1e')](removeEntity(_0x4ca6bc,null))['catch'](handleError(_0x4ca6bc,null));};exports[_0x0561('0x63')]=function(_0x157f03,_0x43195d){return db[_0x0561('0x3d')][_0x0561('0x63')]()[_0x0561('0x1e')](respondWithResult(_0x43195d,null))[_0x0561('0x28')](handleError(_0x43195d,null));};exports[_0x0561('0x64')]=function(_0x20c610,_0x554d27,_0x1c3456){if(_0x20c610[_0x0561('0x58')]['id']){delete _0x20c610[_0x0561('0x58')]['id'];}return db[_0x0561('0x3d')][_0x0561('0x5c')]({'where':{'id':_0x20c610[_0x0561('0x55')]['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x554d27,null))[_0x0561('0x1e')](function(_0xa5fb44){if(_0xa5fb44){_0x20c610[_0x0561('0x58')]['WhatsappAccountId']=_0xa5fb44['id'];return db[_0x0561('0x65')]['create'](_0x20c610[_0x0561('0x58')]);}})[_0x0561('0x1e')](respondWithResult(_0x554d27,null))[_0x0561('0x28')](handleError(_0x554d27,null));};exports[_0x0561('0x66')]=function(_0x288086,_0x5ae938,_0x4b4d3c){var _0x589434={'raw':![],'where':{}};var _0x2e90e8={};var _0x1108dd={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x0561('0x67')]({'where':{'id':_0x288086[_0x0561('0x55')]['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x5ae938,null))[_0x0561('0x1e')](function(_0x4b838b){if(_0x4b838b){_0x2e90e8[_0x0561('0x42')]=_[_0x0561('0x44')](db[_0x0561('0x65')][_0x0561('0x3e')]);_0x2e90e8[_0x0561('0x43')]=_[_0x0561('0x44')](_0x288086[_0x0561('0x43')]);_0x2e90e8[_0x0561('0x45')]=_['intersection'](_0x2e90e8['model'],_0x2e90e8[_0x0561('0x43')]);_0x589434['attributes']=_[_0x0561('0x46')](_0x2e90e8[_0x0561('0x42')],qs[_0x0561('0x47')](_0x288086[_0x0561('0x43')][_0x0561('0x47')]));_0x589434[_0x0561('0x48')]=_0x589434[_0x0561('0x48')]['length']?_0x589434[_0x0561('0x48')]:_0x2e90e8[_0x0561('0x42')];if(!_0x288086[_0x0561('0x43')]['hasOwnProperty'](_0x0561('0x4a'))){_0x589434[_0x0561('0x2f')]=qs[_0x0561('0x2f')](_0x288086['query'][_0x0561('0x2f')]);_0x589434[_0x0561('0x2d')]=qs['offset'](_0x288086[_0x0561('0x43')][_0x0561('0x2d')]);}_0x589434[_0x0561('0x4b')]=qs[_0x0561('0x4c')](_0x288086[_0x0561('0x43')][_0x0561('0x4c')]);_0x589434[_0x0561('0x4d')]=qs[_0x0561('0x45')](_['pick'](_0x288086[_0x0561('0x43')],_0x2e90e8[_0x0561('0x45')]));_0x589434['where']['WhatsappAccountId']=_0x4b838b['id'];if(_0x288086[_0x0561('0x43')][_0x0561('0x4e')]){_0x589434[_0x0561('0x4d')]=_[_0x0561('0x4f')](_0x589434[_0x0561('0x4d')],{'$or':_['map'](_0x589434['attributes'],function(_0x32fb8d){var _0x20d91={};_0x20d91[_0x32fb8d]={'$like':'%'+_0x288086[_0x0561('0x43')][_0x0561('0x4e')]+'%'};return _0x20d91;})});}_0x589434=_[_0x0561('0x4f')]({},_0x589434,_0x288086['options']);return db[_0x0561('0x65')][_0x0561('0x30')]({'where':_0x589434['where']})[_0x0561('0x1e')](function(_0x533809){_0x1108dd[_0x0561('0x30')]=_0x533809;if(_0x288086[_0x0561('0x43')][_0x0561('0x51')]){_0x589434[_0x0561('0x68')]=[{'all':!![]}];}return db[_0x0561('0x65')][_0x0561('0x52')](_0x589434);})['then'](function(_0x56d3c5){_0x1108dd[_0x0561('0x53')]=_0x56d3c5;return _0x1108dd;});}})[_0x0561('0x1e')](respondWithFilteredResult(_0x5ae938,_0x589434))['catch'](handleError(_0x5ae938,null));};exports[_0x0561('0x69')]=function(_0x47920e,_0x2590da,_0xbbd357){return db['WhatsappAccount'][_0x0561('0x5c')]({'where':{'id':_0x47920e[_0x0561('0x55')]['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x2590da,null))['then'](function(_0x32a7f6){if(_0x32a7f6){return _0x32a7f6[_0x0561('0x69')](_0x47920e[_0x0561('0x43')][_0x0561('0x6a')]);}})[_0x0561('0x1e')](respondWithStatusCode(_0x2590da,null))[_0x0561('0x28')](handleError(_0x2590da,null));};exports[_0x0561('0x6b')]=function(_0x515bb3,_0x50883a,_0x27203e){if(_0x515bb3[_0x0561('0x58')]['id']){delete _0x515bb3[_0x0561('0x58')]['id'];}return db[_0x0561('0x3d')]['find']({'where':{'id':_0x515bb3['params']['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x50883a,null))[_0x0561('0x1e')](function(_0xb88875){if(_0xb88875){_0x515bb3['body'][_0x0561('0x6c')]=_0xb88875['id'];return db['CannedAnswer'][_0x0561('0x57')](_0x515bb3[_0x0561('0x58')]);}})[_0x0561('0x1e')](respondWithResult(_0x50883a,null))[_0x0561('0x28')](handleError(_0x50883a,null));};exports[_0x0561('0x6d')]=function(_0x5f5761,_0x193af2,_0x567c24){var _0x51bcc8={'raw':![],'where':{}};var _0x3ecf51={};var _0x22d18e={'count':0x0,'rows':[]};return db[_0x0561('0x3d')][_0x0561('0x67')]({'where':{'id':_0x5f5761['params']['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x193af2,null))[_0x0561('0x1e')](function(_0x3c4367){if(_0x3c4367){_0x3ecf51[_0x0561('0x42')]=_[_0x0561('0x44')](db[_0x0561('0x6e')]['rawAttributes']);_0x3ecf51[_0x0561('0x43')]=_[_0x0561('0x44')](_0x5f5761[_0x0561('0x43')]);_0x3ecf51[_0x0561('0x45')]=_[_0x0561('0x46')](_0x3ecf51[_0x0561('0x42')],_0x3ecf51['query']);_0x51bcc8[_0x0561('0x48')]=_['intersection'](_0x3ecf51[_0x0561('0x42')],qs[_0x0561('0x47')](_0x5f5761[_0x0561('0x43')][_0x0561('0x47')]));_0x51bcc8['attributes']=_0x51bcc8[_0x0561('0x48')][_0x0561('0x49')]?_0x51bcc8[_0x0561('0x48')]:_0x3ecf51[_0x0561('0x42')];if(!_0x5f5761[_0x0561('0x43')][_0x0561('0x6f')](_0x0561('0x4a'))){_0x51bcc8['limit']=qs[_0x0561('0x2f')](_0x5f5761[_0x0561('0x43')][_0x0561('0x2f')]);_0x51bcc8[_0x0561('0x2d')]=qs[_0x0561('0x2d')](_0x5f5761['query'][_0x0561('0x2d')]);}_0x51bcc8[_0x0561('0x4b')]=qs[_0x0561('0x4c')](_0x5f5761['query'][_0x0561('0x4c')]);_0x51bcc8[_0x0561('0x4d')]=qs[_0x0561('0x45')](_[_0x0561('0x70')](_0x5f5761[_0x0561('0x43')],_0x3ecf51[_0x0561('0x45')]));_0x51bcc8['where']['WhatsappAccountId']=_0x3c4367['id'];if(_0x5f5761[_0x0561('0x43')][_0x0561('0x4e')]){_0x51bcc8[_0x0561('0x4d')]=_[_0x0561('0x4f')](_0x51bcc8[_0x0561('0x4d')],{'$or':_[_0x0561('0x3c')](_0x51bcc8['attributes'],function(_0x51fb3d){var _0xe22801={};_0xe22801[_0x51fb3d]={'$like':'%'+_0x5f5761[_0x0561('0x43')][_0x0561('0x4e')]+'%'};return _0xe22801;})});}_0x51bcc8=_['merge']({},_0x51bcc8,_0x5f5761[_0x0561('0x50')]);return db[_0x0561('0x6e')][_0x0561('0x30')]({'where':_0x51bcc8[_0x0561('0x4d')]})[_0x0561('0x1e')](function(_0xb3339d){_0x22d18e['count']=_0xb3339d;if(_0x5f5761['query']['includeAll']){_0x51bcc8['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0561('0x52')](_0x51bcc8);})['then'](function(_0x2302e2){_0x22d18e[_0x0561('0x53')]=_0x2302e2;return _0x22d18e;});}})[_0x0561('0x1e')](respondWithFilteredResult(_0x193af2,_0x51bcc8))[_0x0561('0x28')](handleError(_0x193af2,null));};exports['removeAnswers']=function(_0x5cca26,_0x314119,_0x1a313c){return db['WhatsappAccount'][_0x0561('0x5c')]({'where':{'id':_0x5cca26[_0x0561('0x55')]['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x314119,null))[_0x0561('0x1e')](function(_0x2377d3){if(_0x2377d3){return _0x2377d3[_0x0561('0x71')](_0x5cca26[_0x0561('0x43')][_0x0561('0x6a')]);}})[_0x0561('0x1e')](respondWithStatusCode(_0x314119,null))['catch'](handleError(_0x314119,null));};exports[_0x0561('0x72')]=function(_0x27ad99,_0x446d85,_0x3b9a9f){return db['WhatsappAccount'][_0x0561('0x5c')]({'where':{'id':_0x27ad99[_0x0561('0x55')]['id']}})['then'](handleEntityNotFound(_0x446d85,null))[_0x0561('0x1e')](function(_0x21bdc9){if(_0x21bdc9){return _0x21bdc9['addAgents'](_0x27ad99[_0x0561('0x58')][_0x0561('0x6a')],_[_0x0561('0x73')](_0x27ad99[_0x0561('0x58')],['ids','id'])||{})['spread'](function(_0x1a3254){for(var _0x2658bd=0x0;_0x2658bd<_0x27ad99[_0x0561('0x58')][_0x0561('0x6a')][_0x0561('0x49')];_0x2658bd+=0x1){socket[_0x0561('0x74')](_0x0561('0x75'),{'UserId':Number(_0x27ad99[_0x0561('0x58')][_0x0561('0x6a')][_0x2658bd]),'WhatsappAccountId':Number(_0x27ad99['params']['id'])});}return _0x1a3254;});}})[_0x0561('0x1e')](respondWithResult(_0x446d85,null))[_0x0561('0x28')](handleError(_0x446d85,null));};exports[_0x0561('0x76')]=function(_0x569693,_0x2c23f5,_0x12230c){return db[_0x0561('0x3d')][_0x0561('0x5c')]({'where':{'id':_0x569693['params']['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x2c23f5,null))[_0x0561('0x1e')](function(_0x289313){if(_0x289313){return _0x289313[_0x0561('0x76')](_0x569693[_0x0561('0x43')][_0x0561('0x6a')])['then'](function(){if(_['isArray'](_0x569693[_0x0561('0x43')][_0x0561('0x6a')])){for(var _0x9c4248=0x0;_0x9c4248<_0x569693[_0x0561('0x43')][_0x0561('0x6a')][_0x0561('0x49')];_0x9c4248+=0x1){socket[_0x0561('0x74')](_0x0561('0x77'),{'UserId':Number(_0x569693['query'][_0x0561('0x6a')][_0x9c4248]),'WhatsappAccountId':Number(_0x569693['params']['id'])});}}else{socket[_0x0561('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x569693[_0x0561('0x43')][_0x0561('0x6a')]),'WhatsappAccountId':Number(_0x569693[_0x0561('0x55')]['id'])});}});}})[_0x0561('0x1e')](respondWithStatusCode(_0x2c23f5,null))['catch'](handleError(_0x2c23f5,null));};exports[_0x0561('0x78')]=function(_0x33d516,_0x3be7c0,_0x1fdd4a){var _0x43823b={};var _0x5029ce={};var _0xa95bf7;var _0x1715e6;return db['WhatsappAccount']['findOne']({'where':{'id':_0x33d516['params']['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x3be7c0,null))[_0x0561('0x1e')](function(_0x2eb106){if(_0x2eb106){_0xa95bf7=_0x2eb106;_0x5029ce['model']=_[_0x0561('0x44')](db[_0x0561('0x79')]['rawAttributes']);_0x5029ce[_0x0561('0x43')]=_[_0x0561('0x44')](_0x33d516[_0x0561('0x43')]);_0x5029ce['filters']=_[_0x0561('0x46')](_0x5029ce['model'],_0x5029ce[_0x0561('0x43')]);_0x43823b[_0x0561('0x48')]=_[_0x0561('0x46')](_0x5029ce[_0x0561('0x42')],qs[_0x0561('0x47')](_0x33d516[_0x0561('0x43')][_0x0561('0x47')]));_0x43823b[_0x0561('0x48')]=_0x43823b[_0x0561('0x48')]['length']?_0x43823b['attributes']:_0x5029ce[_0x0561('0x42')];_0x43823b['order']=qs[_0x0561('0x4c')](_0x33d516[_0x0561('0x43')]['sort']);_0x43823b['where']=qs[_0x0561('0x45')](_[_0x0561('0x70')](_0x33d516[_0x0561('0x43')],_0x5029ce[_0x0561('0x45')]));if(_0x33d516[_0x0561('0x43')][_0x0561('0x4e')]){_0x43823b[_0x0561('0x4d')]=_[_0x0561('0x4f')](_0x43823b[_0x0561('0x4d')],{'$or':_['map'](_0x43823b[_0x0561('0x48')],function(_0x213e50){var _0x2f5a1b={};_0x2f5a1b[_0x213e50]={'$like':'%'+_0x33d516[_0x0561('0x43')][_0x0561('0x4e')]+'%'};return _0x2f5a1b;})});}_0x43823b=_[_0x0561('0x4f')]({},_0x43823b,_0x33d516['options']);return _0xa95bf7[_0x0561('0x78')](_0x43823b);}})[_0x0561('0x1e')](function(_0x42fe93){if(_0x42fe93){_0x1715e6=_0x42fe93['length'];if(!_0x33d516[_0x0561('0x43')][_0x0561('0x6f')](_0x0561('0x4a'))){_0x43823b[_0x0561('0x2f')]=qs[_0x0561('0x2f')](_0x33d516[_0x0561('0x43')]['limit']);_0x43823b[_0x0561('0x2d')]=qs[_0x0561('0x2d')](_0x33d516[_0x0561('0x43')][_0x0561('0x2d')]);}return _0xa95bf7[_0x0561('0x78')](_0x43823b);}})[_0x0561('0x1e')](function(_0x43556a){if(_0x43556a){return _0x43556a?{'count':_0x1715e6,'rows':_0x43556a}:null;}})[_0x0561('0x1e')](respondWithResult(_0x3be7c0,null))[_0x0561('0x28')](handleError(_0x3be7c0,null));};exports['addApplications']=function(_0x288c5b,_0x4b8c36){var _0x3898a9=_0x288c5b[_0x0561('0x55')]['id'];var _0x10bf60=_0x288c5b['body'];var _0x3f40cc=0xc8;var _0x4411e6=null;return db[_0x0561('0x7a')][_0x0561('0x7b')]({'isolationLevel':db[_0x0561('0x7a')][_0x0561('0x7c')][_0x0561('0x7d')][_0x0561('0x7e')]},function(_0x3e1a8d){return db[_0x0561('0x3d')]['findOne']({'where':{'id':_0x3898a9},'transaction':_0x3e1a8d})[_0x0561('0x1e')](function(_0x5a2411){if(_0x5a2411){return db[_0x0561('0x7f')][_0x0561('0x62')]({'where':{'WhatsappAccountId':_0x3898a9},'transaction':_0x3e1a8d})[_0x0561('0x1e')](function(){var _0x1734eb=_[_0x0561('0x3c')](_0x10bf60,function(_0x2a8f38){_0x2a8f38[_0x0561('0x6c')]=_0x3898a9;return _0x2a8f38;});return db[_0x0561('0x7f')][_0x0561('0x80')](_0x1734eb,{'transaction':_0x3e1a8d});});}else{_0x3f40cc=0x194;_0x4411e6=[];}});})[_0x0561('0x1e')](function(){if(_0x3f40cc!==0x194){return db[_0x0561('0x7f')][_0x0561('0x81')]({'where':{'WhatsappAccountId':_0x3898a9},'order':_0x0561('0x82')})[_0x0561('0x1e')](function(_0x45e143){_0x4411e6=_0x45e143;});}})[_0x0561('0x28')](function(_0x34261e){_0x3f40cc=0x1f4;logger[_0x0561('0x25')](_0x34261e[_0x0561('0x38')]);if(_0x34261e['name']){delete _0x34261e['name'];}_0x4411e6=_0x34261e;})[_0x0561('0x83')](function(){if(_0x4411e6===null){_0x4b8c36['sendStatus'](_0x3f40cc);}else{if(_0x3f40cc===0x1f4){_0x4b8c36['status'](_0x3f40cc)[_0x0561('0x84')](_0x4411e6);}else{_0x4b8c36[_0x0561('0x2a')](_0x3f40cc)[_0x0561('0x2c')](_0x4411e6);}}});};exports['getApplications']=function(_0x832ab1,_0x38b106,_0x55b6c4){var _0x412cac={};var _0x124536={};var _0x1fa55b;var _0x1bd9cc;return db[_0x0561('0x3d')][_0x0561('0x67')]({'where':{'id':_0x832ab1[_0x0561('0x55')]['id']}})[_0x0561('0x1e')](handleEntityNotFound(_0x38b106,null))['then'](function(_0x4d49ed){if(_0x4d49ed){_0x1fa55b=_0x4d49ed;_0x124536['model']=_[_0x0561('0x44')](db[_0x0561('0x7f')][_0x0561('0x3e')]);_0x124536['query']=_[_0x0561('0x44')](_0x832ab1['query']);_0x124536[_0x0561('0x45')]=_[_0x0561('0x46')](_0x124536['model'],_0x124536[_0x0561('0x43')]);_0x412cac['attributes']=_[_0x0561('0x46')](_0x124536[_0x0561('0x42')],qs[_0x0561('0x47')](_0x832ab1[_0x0561('0x43')][_0x0561('0x47')]));_0x412cac[_0x0561('0x48')]=_0x412cac[_0x0561('0x48')][_0x0561('0x49')]?_0x412cac[_0x0561('0x48')]:_0x124536['model'];_0x412cac[_0x0561('0x4b')]=qs['sort'](_0x832ab1[_0x0561('0x43')][_0x0561('0x4c')]);_0x412cac[_0x0561('0x4d')]=qs[_0x0561('0x45')](_[_0x0561('0x70')](_0x832ab1['query'],_0x124536[_0x0561('0x45')]));if(_0x832ab1[_0x0561('0x43')]['filter']){_0x412cac[_0x0561('0x4d')]=_[_0x0561('0x4f')](_0x412cac[_0x0561('0x4d')],{'$or':_[_0x0561('0x3c')](_0x412cac[_0x0561('0x48')],function(_0x55a806){var _0x43a12a={};_0x43a12a[_0x55a806]={'$like':'%'+_0x832ab1[_0x0561('0x43')][_0x0561('0x4e')]+'%'};return _0x43a12a;})});}_0x412cac=_[_0x0561('0x4f')]({},_0x412cac,_0x832ab1[_0x0561('0x50')]);return _0x1fa55b[_0x0561('0x85')](_0x412cac);}})[_0x0561('0x1e')](function(_0x36d9e8){if(_0x36d9e8){_0x1bd9cc=_0x36d9e8[_0x0561('0x49')];if(!_0x832ab1['query'][_0x0561('0x6f')](_0x0561('0x4a'))){_0x412cac['limit']=qs[_0x0561('0x2f')](_0x832ab1[_0x0561('0x43')][_0x0561('0x2f')]);_0x412cac['offset']=qs[_0x0561('0x2d')](_0x832ab1['query'][_0x0561('0x2d')]);}return _0x1fa55b[_0x0561('0x85')](_0x412cac);}})['then'](function(_0x5b4371){if(_0x5b4371){return _0x5b4371?{'count':_0x1bd9cc,'rows':_0x5b4371}:null;}})[_0x0561('0x1e')](respondWithResult(_0x38b106,null))[_0x0561('0x28')](handleError(_0x38b106,null));};exports[_0x0561('0x86')]=function(_0x2f5a2c,_0x3e5e62,_0x4f33b8){var _0x5799d3={'channel':_0x0561('0x87')};var _0x28f039=[];var _0x355336=[];var _0x21d89a={};return db[_0x0561('0x3d')][_0x0561('0x5c')]({'where':{'id':_0x2f5a2c[_0x0561('0x55')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x0561('0x88')}]})['then'](handleEntityNotFound(_0x3e5e62,null))[_0x0561('0x1e')](function(_0x3e6d94){_0x5799d3['account']=_0x3e6d94;if(_0x5799d3['account']&&_0x5799d3[_0x0561('0x89')]['type']===_0x0561('0x8a')&&_0x2f5a2c[_0x0561('0x58')]['statuses']){if(_0x2f5a2c['body']['statuses'][_0x0561('0x49')]===0x0)return;if(_0x2f5a2c[_0x0561('0x58')][_0x0561('0x8b')][0x0][_0x0561('0x8c')]!==_0x0561('0x8d'))return;return db['WhatsappMessage'][_0x0561('0x61')]({'read':!![],'readAt':_0x2f5a2c[_0x0561('0x58')]['statuses'][0x0][_0x0561('0x8e')]},{'where':{'messageId':_0x2f5a2c[_0x0561('0x58')][_0x0561('0x8b')][0x0]['message_id']},'individualHooks':!![]})[_0x0561('0x1e')](function(_0x4aab0b){return _0x3e5e62[_0x0561('0x2a')](0xc8)[_0x0561('0x2c')](_0x4aab0b);});}_0x5799d3['applications']=_['orderBy'](_0x3e6d94[_0x0561('0x88')],['priority'],[_0x0561('0x8f')]);if(_0x5799d3['account'][_0x0561('0x88')]){delete _0x5799d3[_0x0561('0x89')][_0x0561('0x88')];}return db[_0x0561('0x90')][_0x0561('0x63')]()[_0x0561('0x1e')](function(_0x4056b2){if(!_0x4056b2){throw new db['Sequelize'][(_0x0561('0x91'))](_0x0561('0x92'));}_0x28f039=_[_0x0561('0x93')](_['keys'](_0x4056b2),[_0x0561('0x94'),_0x0561('0x95')]);_0x355336=_[_0x0561('0x93')](_['keys'](_0x4056b2),[_0x0561('0x94'),_0x0561('0x95'),_0x0561('0x96'),_0x0561('0x97')]);_0x5799d3['body']={'mapKey':'mobile'};if(_0x5799d3[_0x0561('0x89')]&&_0x5799d3[_0x0561('0x89')][_0x0561('0x40')]==='twilio'){_0x5799d3[_0x0561('0x58')][_0x0561('0x98')]=_0x2f5a2c[_0x0561('0x58')]['From'][_0x0561('0x99')](_0x0561('0x9a'),'');_0x5799d3[_0x0561('0x58')]['body']=_0x2f5a2c[_0x0561('0x58')]['Body'];_0x5799d3[_0x0561('0x58')][_0x0561('0x9b')]=_0x2f5a2c[_0x0561('0x58')][_0x0561('0x9c')];}if(_0x5799d3['account']&&_0x5799d3['account'][_0x0561('0x40')]===_0x0561('0x8a')){_0x5799d3['body'][_0x0561('0x98')]=_0x2f5a2c[_0x0561('0x58')]['notifications'][0x0][_0x0561('0x98')];_0x5799d3['body'][_0x0561('0x58')]=_0x2f5a2c['body']['notifications'][0x0][_0x0561('0x27')][_0x0561('0x58')];_0x5799d3[_0x0561('0x58')][_0x0561('0x9b')]=_0x2f5a2c[_0x0561('0x58')]['notifications'][0x0][_0x0561('0x9d')];}if(_0x5799d3[_0x0561('0x58')]['id']){delete _0x5799d3['body']['id'];}if(_[_0x0561('0x9e')](_0x5799d3[_0x0561('0x58')][_0x0561('0x98')])){throw new db[(_0x0561('0x9f'))][(_0x0561('0x91'))](_0x0561('0xa0'));}if(_['isNil'](_0x5799d3['body'][_0x0561('0x58')])||_0x5799d3[_0x0561('0x58')][_0x0561('0x58')]===''){throw new db[(_0x0561('0x9f'))]['ValidationError'](_0x0561('0xa1'));}if(_[_0x0561('0x9e')](_0x5799d3[_0x0561('0x58')]['mapKey'])){throw new db['Sequelize'][(_0x0561('0x91'))](_0x0561('0xa2')+_0x355336);}if(!_[_0x0561('0xa3')](_0x355336,_0x5799d3[_0x0561('0x58')][_0x0561('0xa4')])){throw new db[(_0x0561('0x9f'))][(_0x0561('0x91'))](_0x0561('0xa5')+_0x355336);}_0x21d89a[_0x5799d3[_0x0561('0x58')]['mapKey']]=_0x5799d3[_0x0561('0x58')][_0x0561('0x98')];return db['CmList'][_0x0561('0x5c')]({'where':{'id':_0x5799d3[_0x0561('0x89')][_0x0561('0x97')]},'include':[{'model':db['CmContact'],'as':_0x0561('0xa6'),'where':_0x21d89a,'limit':0x1,'order':[['updatedAt',_0x0561('0xa7')]]}]});})['then'](handleEntityNotFound(_0x3e5e62,null))['then'](function(_0x1856cc){if(_0x1856cc){_0x5799d3[_0x0561('0xa8')]=_[_0x0561('0x73')](_0x1856cc,[_0x0561('0xa6')]);if(_0x1856cc[_0x0561('0xa6')][_0x0561('0x49')]){return _0x1856cc[_0x0561('0xa6')][0x0];}var _0x592dc8=_[_0x0561('0x18')](_0x5799d3[_0x0561('0x58')],{'firstName':_0x5799d3['body'][_0x0561('0x98')],'ListId':_0x1856cc['id']});_0x592dc8[_0x5799d3[_0x0561('0x58')][_0x0561('0xa4')]]=_0x5799d3[_0x0561('0x58')][_0x0561('0x98')];return db[_0x0561('0x90')][_0x0561('0x57')](_0x592dc8,{'fields':_0x28f039,'raw':!![]});}})['then'](handleEntityNotFound(_0x3e5e62,null))['then'](function(_0x4a53da){if(_0x4a53da){_0x5799d3[_0x0561('0xa9')]=_0x4a53da;var _0x2f09e7={'ContactId':_0x4a53da['id'],'phone':_0x5799d3['body'][_0x0561('0x98')],'WhatsappAccountId':_0x2f5a2c[_0x0561('0x55')]['id']};var _0x2f60a8={'ContactId':_0x4a53da['id'],'WhatsappAccountId':_0x2f5a2c[_0x0561('0x55')]['id'],'closed':![]};return db[_0x0561('0xaa')][_0x0561('0x5c')]({'where':_0x2f60a8})[_0x0561('0x1e')](function(_0x431cd9){if(_0x431cd9){return[_0x431cd9,![]];}return db[_0x0561('0xaa')][_0x0561('0x57')](_0x2f09e7)['then'](function(_0x1751d8){return[_0x1751d8,!![]];});});}})[_0x0561('0xab')](function(_0x2cf51d,_0x18ff77){_0x5799d3[_0x0561('0xac')]=_0x2cf51d[_0x0561('0x36')]({'plain':!![]});_0x5799d3[_0x0561('0xac')][_0x0561('0xad')]=![];if(_0x18ff77){if(_0x5799d3[_0x0561('0x89')][_0x0561('0xae')]){_0x5799d3[_0x0561('0xaf')]['push']({'id':0x0,'priority':_0x5799d3['applications']['length']+0x1,'app':_0x0561('0xb0'),'appdata':'unmanaged','interval':_0x0561('0xb1')});}_0x5799d3[_0x0561('0xac')][_0x0561('0xad')]=!![];}return db['WhatsappMessage'][_0x0561('0x57')]({'phone':_0x5799d3['body'][_0x0561('0x98')],'messageId':_0x5799d3[_0x0561('0x58')][_0x0561('0x9b')],'body':_0x5799d3['body'][_0x0561('0x58')],'WhatsappAccountId':_0x2f5a2c['params']['id'],'WhatsappInteractionId':_0x2cf51d['id'],'direction':'in','ContactId':_0x2cf51d[_0x0561('0xb2')],'AttachmentId':_0x5799d3[_0x0561('0x58')]['AttachmentId']});})['then'](function(_0x8cf64e){_0x5799d3[_0x0561('0x27')]=_0x8cf64e;if(!_0x5799d3[_0x0561('0xac')]['UserId'])return;return db[_0x0561('0x79')]['find']({'attributes':['id','name'],'where':{'id':_0x5799d3[_0x0561('0xac')][_0x0561('0xb3')]}});})[_0x0561('0x1e')](function(_0x3a1cb9){if(_0x3a1cb9){_0x5799d3[_0x0561('0xaf')][_0x0561('0xb4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3a1cb9[_0x0561('0x39')]+','+(_0x5799d3['account'][_0x0561('0xb5')]||0xa),'interval':_0x0561('0xb1')});}if(!_0x5799d3[_0x0561('0xac')][_0x0561('0xb6')])return;return db[_0x0561('0xb7')]['find']({'attributes':['id','name'],'where':{'id':_0x5799d3[_0x0561('0xac')][_0x0561('0xb6')]}});})[_0x0561('0x1e')](function(_0x379fc6){if(_0x379fc6){_0x5799d3[_0x0561('0xaf')][_0x0561('0xb4')]({'id':0x0,'priority':0x1,'app':_0x0561('0xb8'),'appdata':_0x379fc6[_0x0561('0x39')]+','+(_0x5799d3[_0x0561('0x89')]['waitForTheAssignedQueue']||0x12c),'interval':_0x0561('0xb1')});}return respondWithRpcPromise(_0x0561('0xb9'),_0x0561('0xba'),_0x5799d3);})[_0x0561('0x1e')](function(_0x709df8){if(_0x709df8){var _0x2c665a=0xc8;var _0x3d073c=_0x0561('0xbb');logger[_0x0561('0x1f')](_0x0561('0x23'),_0x3d073c,_0x2c665a,_0x0561('0xbc'));logger['debug'](_0x0561('0xbd'),_0x3d073c,_0x2c665a,_0x0561('0xbc'),JSON[_0x0561('0x24')](_0x709df8));if(_0x5799d3[_0x0561('0x89')][_0x0561('0x40')]===_0x0561('0xbe')){return _0x3e5e62[_0x0561('0x2a')](_0x2c665a)[_0x0561('0x31')](_0x0561('0xbf'),'text/xml')[_0x0561('0x84')](_0x0561('0xc0'));}else{return _0x3e5e62[_0x0561('0x2a')](_0x2c665a)[_0x0561('0x2c')](_0x709df8);}}});})[_0x0561('0x28')](handleError(_0x3e5e62,null));};exports[_0x0561('0x84')]=function(_0x4bcf5b,_0x51a21a,_0x517697){var _0x41e6ee,_0x560938,_0x2b70b4;if(_[_0x0561('0x9e')](_0x4bcf5b[_0x0561('0x58')][_0x0561('0x58')])||_0x4bcf5b[_0x0561('0x58')]['body']===''){throw new db[(_0x0561('0x9f'))][(_0x0561('0x91'))](_0x0561('0xa1'));}if(_[_0x0561('0x9e')](_0x4bcf5b['body']['to'])){throw new db[(_0x0561('0x9f'))][(_0x0561('0x91'))](_0x0561('0xc1'));}_0x41e6ee=_0x4bcf5b['body']['to'];return db['WhatsappAccount'][_0x0561('0x5c')]({'where':{'id':_0x4bcf5b['params']['id']},'include':[{'model':db[_0x0561('0xc2')],'as':_0x0561('0xc3'),'include':[{'model':db['CmContact'],'as':_0x0561('0xa6'),'where':{'mobile':_0x41e6ee},'limit':0x1,'order':[[_0x0561('0x95'),_0x0561('0xa7')]]}]}]})[_0x0561('0x1e')](handleEntityNotFound(_0x51a21a,null))[_0x0561('0x1e')](function(_0x9ae503){if(_0x9ae503&&_0x9ae503[_0x0561('0xc3')]){_0x560938=_0x9ae503[_0x0561('0x36')]({'plain':!![]});if(_0x560938[_0x0561('0xc3')]&&_0x560938[_0x0561('0xc3')][_0x0561('0xa6')]['length']){return _0x560938['List'][_0x0561('0xa6')][0x0];}return db[_0x0561('0x90')][_0x0561('0x57')](_['defaults'](_0x4bcf5b[_0x0561('0x58')],{'firstName':_0x41e6ee,'mobile':_0x41e6ee,'phone':_0x41e6ee,'ListId':_0x560938['ListId']}));}})[_0x0561('0x1e')](handleEntityNotFound(_0x51a21a,null))['then'](function(_0x3c14fb){if(_0x3c14fb){_0x2b70b4=_0x3c14fb;return db[_0x0561('0xaa')][_0x0561('0x5c')]({'where':{'ContactId':_0x2b70b4['id'],'closed':![],'WhatsappAccountId':_0x560938['id']}})[_0x0561('0x1e')](function(_0x56156f){if(_0x56156f){return[_0x56156f,![]];}return db[_0x0561('0xaa')]['create']({'UserId':_0x4bcf5b[_0x0561('0x59')]['id'],'ContactId':_0x2b70b4['id'],'WhatsappAccountId':_0x560938['id'],'phone':_0x41e6ee,'firstMsgDirection':'out','Messages':[_[_0x0561('0x4f')](_0x4bcf5b[_0x0561('0x58')],{'read':![],'body':_0x4bcf5b[_0x0561('0x58')]['body'],'phone':_0x41e6ee,'WhatsappAccountId':_0x560938['id'],'UserId':_0x4bcf5b[_0x0561('0x59')]['id'],'ContactId':_0x2b70b4['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x0561('0xc4')}]})[_0x0561('0x1e')](function(_0x2ddd6d){return[_0x2ddd6d,!![]];});});}})[_0x0561('0xab')](function(_0x48ebdf,_0x5f0e42){if(_0x5f0e42){return _0x48ebdf;}return db[_0x0561('0xc5')]['create'](_[_0x0561('0x4f')](_0x4bcf5b[_0x0561('0x58')],{'read':![],'body':_0x4bcf5b[_0x0561('0x58')][_0x0561('0x58')],'phone':_0x41e6ee,'WhatsappAccountId':_0x560938['id'],'WhatsappInteractionId':_0x48ebdf['id'],'UserId':_0x4bcf5b[_0x0561('0x59')]['id'],'ContactId':_0x2b70b4['id']}))['then'](function(_0x34a94c){_0x48ebdf[_0x0561('0xc6')][_0x0561('0xc4')]=[];_0x48ebdf[_0x0561('0xc6')]['Messages'][_0x0561('0xc7')](_0x34a94c[_0x0561('0xc6')]);return _0x48ebdf;});})[_0x0561('0x1e')](respondWithResult(_0x51a21a,null))[_0x0561('0x28')](handleError(_0x51a21a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f90e3c9..1099f48 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 _0x4905=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x4905,0xcf));var _0x5490=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x4905[_0x17bb31];return _0x505c71;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x5490('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5490('0x1')](0x0);var events={'afterCreate':_0x5490('0x2'),'afterUpdate':_0x5490('0x3'),'afterDestroy':'remove'};function emitEvent(_0x31b404){return function(_0x4b6c05,_0x435a6d,_0x3ff9e0){WhatsappAccountEvents[_0x5490('0x4')](_0x31b404+':'+_0x4b6c05['id'],_0x4b6c05);WhatsappAccountEvents[_0x5490('0x4')](_0x31b404,_0x4b6c05);_0x3ff9e0(null);};}for(var e in events){if(events[_0x5490('0x5')](e)){var event=events[e];WhatsappAccount[_0x5490('0x6')](e,emitEvent(event));}}module[_0x5490('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd1f4=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x248874,_0x26f631){var _0x2eb2ed=function(_0x467ff5){while(--_0x467ff5){_0x248874['push'](_0x248874['shift']());}};_0x2eb2ed(++_0x26f631);}(_0xd1f4,0x18b));var _0x4d1f=function(_0x2435fe,_0x5edfaa){_0x2435fe=_0x2435fe-0x0;var _0xef61e2=_0xd1f4[_0x2435fe];return _0xef61e2;};'use strict';var EventEmitter=require(_0x4d1f('0x0'));var WhatsappAccount=require(_0x4d1f('0x1'))['db'][_0x4d1f('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x4d1f('0x3')](0x0);var events={'afterCreate':_0x4d1f('0x4'),'afterUpdate':_0x4d1f('0x5'),'afterDestroy':_0x4d1f('0x6')};function emitEvent(_0x3d5f94){return function(_0x388cb2,_0x56c961,_0x5692b0){WhatsappAccountEvents[_0x4d1f('0x7')](_0x3d5f94+':'+_0x388cb2['id'],_0x388cb2);WhatsappAccountEvents[_0x4d1f('0x7')](_0x3d5f94,_0x388cb2);_0x5692b0(null);};}for(var e in events){if(events[_0x4d1f('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 8e06166..0be96e1 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 _0xf169=['../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','moment','request-promise','path','rimraf'];(function(_0x48096a,_0xa0cd66){var _0xa8011e=function(_0x31943f){while(--_0x31943f){_0x48096a['push'](_0x48096a['shift']());}};_0xa8011e(++_0xa0cd66);}(_0xf169,0x139));var _0x9f16=function(_0x13e28,_0x2d11c2){_0x13e28=_0x13e28-0x0;var _0x1856d0=_0xf169[_0x13e28];return _0x1856d0;};'use strict';var _=require(_0x9f16('0x0'));var util=require(_0x9f16('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9f16('0x2'));var BPromise=require('bluebird');var rp=require(_0x9f16('0x3'));var fs=require('fs');var path=require(_0x9f16('0x4'));var rimraf=require(_0x9f16('0x5'));var config=require(_0x9f16('0x6'));var attributes=require(_0x9f16('0x7'));module[_0x9f16('0x8')]=function(_0x34635f,_0x2d584c){return _0x34635f['define'](_0x9f16('0x9'),attributes,{'tableName':_0x9f16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4618=['WhatsappAccount','whatsapp_accounts','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','define'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x4618,0xda));var _0x8461=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x4618[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8461('0x0'));var BPromise=require(_0x8461('0x1'));var rp=require(_0x8461('0x2'));var fs=require('fs');var path=require(_0x8461('0x3'));var rimraf=require(_0x8461('0x4'));var config=require('../../config/environment');var attributes=require(_0x8461('0x5'));module['exports']=function(_0x3150c5,_0x21d769){return _0x3150c5[_0x8461('0x6')](_0x8461('0x7'),attributes,{'tableName':_0x8461('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 04e62e9..9b2cef7 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 _0x6c1d=['message','catch','WhatsappAccount','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s'];(function(_0x4f413c,_0x377b6f){var _0xf9e6f8=function(_0x336cd6){while(--_0x336cd6){_0x4f413c['push'](_0x4f413c['shift']());}};_0xf9e6f8(++_0x377b6f);}(_0x6c1d,0xa4));var _0xd6c1=function(_0x4bca87,_0x27abdd){_0x4bca87=_0x4bca87-0x0;var _0x4a1b57=_0x6c1d[_0x4bca87];return _0x4a1b57;};'use strict';var _=require(_0xd6c1('0x0'));var util=require('util');var moment=require(_0xd6c1('0x1'));var BPromise=require(_0xd6c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6c1('0x3'))['db'];var utils=require(_0xd6c1('0x4'));var logger=require(_0xd6c1('0x5'))(_0xd6c1('0x6'));var config=require(_0xd6c1('0x7'));var jayson=require(_0xd6c1('0x8'));var client=jayson[_0xd6c1('0x9')][_0xd6c1('0xa')]({'port':0x232a});config['redis']=_[_0xd6c1('0xb')](config[_0xd6c1('0xc')],{'host':_0xd6c1('0xd'),'port':0x18eb});var socket=require(_0xd6c1('0xe'))(new Redis(config[_0xd6c1('0xc')]));require('./whatsappAccount.socket')[_0xd6c1('0xf')](socket);function respondWithRpcPromise(_0x38d433,_0x5addac,_0x266eff){return new BPromise(function(_0x2b1a52,_0x196442){return client[_0xd6c1('0x10')](_0x38d433,_0x266eff)[_0xd6c1('0x11')](function(_0x33764d){logger[_0xd6c1('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x5addac,_0xd6c1('0x13'));logger[_0xd6c1('0x14')](_0xd6c1('0x15'),_0x5addac,'request\x20sent',JSON[_0xd6c1('0x16')](_0x33764d));if(_0x33764d['error']){if(_0x33764d[_0xd6c1('0x17')][_0xd6c1('0x18')]===0x1f4){logger[_0xd6c1('0x17')](_0xd6c1('0x19'),_0x5addac,_0x33764d['error']['message']);return _0x196442(_0x33764d[_0xd6c1('0x17')][_0xd6c1('0x1a')]);}logger['error'](_0xd6c1('0x19'),_0x5addac,_0x33764d[_0xd6c1('0x17')][_0xd6c1('0x1a')]);return _0x2b1a52(_0x33764d[_0xd6c1('0x17')][_0xd6c1('0x1a')]);}else{logger['info'](_0xd6c1('0x19'),_0x5addac,_0xd6c1('0x13'));_0x2b1a52(_0x33764d['result']['message']);}})[_0xd6c1('0x1b')](function(_0x5ebb7){logger[_0xd6c1('0x17')](_0xd6c1('0x19'),_0x5addac,_0x5ebb7);_0x196442(_0x5ebb7);});});}exports['ShowWhatsappAccount']=function(_0x3dc5c4){var _0x32e8e7=this;return new Promise(function(_0x354008,_0x504617){return db[_0xd6c1('0x1c')][_0xd6c1('0x1d')]({'raw':_0x3dc5c4[_0xd6c1('0x1e')]?_0x3dc5c4[_0xd6c1('0x1e')][_0xd6c1('0x1f')]===undefined?!![]:![]:!![],'where':_0x3dc5c4[_0xd6c1('0x1e')]?_0x3dc5c4[_0xd6c1('0x1e')][_0xd6c1('0x20')]||null:null,'attributes':_0x3dc5c4[_0xd6c1('0x1e')]?_0x3dc5c4[_0xd6c1('0x1e')][_0xd6c1('0x21')]||null:null,'include':_0x3dc5c4[_0xd6c1('0x1e')]?_0x3dc5c4[_0xd6c1('0x1e')][_0xd6c1('0x22')]?_['map'](_0x3dc5c4[_0xd6c1('0x1e')][_0xd6c1('0x22')],function(_0x38aa2b){return{'model':db[_0x38aa2b['model']],'as':_0x38aa2b['as'],'attributes':_0x38aa2b[_0xd6c1('0x21')],'include':_0x38aa2b[_0xd6c1('0x22')]?_['map'](_0x38aa2b[_0xd6c1('0x22')],function(_0x3f7d47){return{'model':db[_0x3f7d47[_0xd6c1('0x23')]],'as':_0x3f7d47['as'],'attributes':_0x3f7d47[_0xd6c1('0x21')],'include':_0x3f7d47['include']?_[_0xd6c1('0x24')](_0x3f7d47[_0xd6c1('0x22')],function(_0x536fce){return{'model':db[_0x536fce[_0xd6c1('0x23')]],'as':_0x536fce['as'],'attributes':_0x536fce[_0xd6c1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd6c1('0x11')](function(_0x267b55){logger[_0xd6c1('0x12')](_0xd6c1('0x25'),_0x3dc5c4);logger[_0xd6c1('0x14')](_0xd6c1('0x25'),_0x3dc5c4,JSON['stringify'](_0x267b55));_0x354008(_0x267b55);})['catch'](function(_0x2f3e4e){logger['error'](_0xd6c1('0x25'),_0x2f3e4e[_0xd6c1('0x1a')],_0x3dc5c4);_0x504617(_0x32e8e7[_0xd6c1('0x17')](0x1f4,_0x2f3e4e['message']));});});}; \ No newline at end of file +var _0x3166=['message','info','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','include','map','model','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b5641,_0x439102){var _0xb51db1=function(_0x964c58){while(--_0x964c58){_0x5b5641['push'](_0x5b5641['shift']());}};_0xb51db1(++_0x439102);}(_0x3166,0xbb));var _0x6316=function(_0x28a2aa,_0x373c9a){_0x28a2aa=_0x28a2aa-0x0;var _0x125975=_0x3166[_0x28a2aa];return _0x125975;};'use strict';var _=require('lodash');var util=require(_0x6316('0x0'));var moment=require(_0x6316('0x1'));var BPromise=require(_0x6316('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6316('0x3'));var db=require(_0x6316('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6316('0x5'))(_0x6316('0x6'));var config=require('../../config/environment');var jayson=require(_0x6316('0x7'));var client=jayson[_0x6316('0x8')][_0x6316('0x9')]({'port':0x232a});config[_0x6316('0xa')]=_['defaults'](config[_0x6316('0xa')],{'host':_0x6316('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6316('0xa')]));require(_0x6316('0xc'))[_0x6316('0xd')](socket);function respondWithRpcPromise(_0x39b005,_0x39570a,_0xa599d5){return new BPromise(function(_0x2930d7,_0x26d437){return client[_0x6316('0xe')](_0x39b005,_0xa599d5)[_0x6316('0xf')](function(_0xeb4358){logger['info'](_0x6316('0x10'),_0x39570a,_0x6316('0x11'));logger[_0x6316('0x12')](_0x6316('0x13'),_0x39570a,_0x6316('0x11'),JSON[_0x6316('0x14')](_0xeb4358));if(_0xeb4358['error']){if(_0xeb4358[_0x6316('0x15')][_0x6316('0x16')]===0x1f4){logger[_0x6316('0x15')](_0x6316('0x10'),_0x39570a,_0xeb4358['error'][_0x6316('0x17')]);return _0x26d437(_0xeb4358[_0x6316('0x15')][_0x6316('0x17')]);}logger['error'](_0x6316('0x10'),_0x39570a,_0xeb4358[_0x6316('0x15')]['message']);return _0x2930d7(_0xeb4358[_0x6316('0x15')][_0x6316('0x17')]);}else{logger[_0x6316('0x18')](_0x6316('0x10'),_0x39570a,'request\x20sent');_0x2930d7(_0xeb4358['result'][_0x6316('0x17')]);}})[_0x6316('0x19')](function(_0xf70772){logger[_0x6316('0x15')](_0x6316('0x10'),_0x39570a,_0xf70772);_0x26d437(_0xf70772);});});}exports[_0x6316('0x1a')]=function(_0x17ca5b){var _0x3ca71f=this;return new Promise(function(_0x111a38,_0x3e4543){return db[_0x6316('0x1b')]['find']({'raw':_0x17ca5b[_0x6316('0x1c')]?_0x17ca5b[_0x6316('0x1c')][_0x6316('0x1d')]===undefined?!![]:![]:!![],'where':_0x17ca5b[_0x6316('0x1c')]?_0x17ca5b[_0x6316('0x1c')][_0x6316('0x1e')]||null:null,'attributes':_0x17ca5b[_0x6316('0x1c')]?_0x17ca5b[_0x6316('0x1c')]['attributes']||null:null,'include':_0x17ca5b[_0x6316('0x1c')]?_0x17ca5b[_0x6316('0x1c')][_0x6316('0x1f')]?_[_0x6316('0x20')](_0x17ca5b['options'][_0x6316('0x1f')],function(_0x378cdf){return{'model':db[_0x378cdf[_0x6316('0x21')]],'as':_0x378cdf['as'],'attributes':_0x378cdf['attributes'],'include':_0x378cdf[_0x6316('0x1f')]?_[_0x6316('0x20')](_0x378cdf[_0x6316('0x1f')],function(_0x16a64b){return{'model':db[_0x16a64b[_0x6316('0x21')]],'as':_0x16a64b['as'],'attributes':_0x16a64b[_0x6316('0x22')],'include':_0x16a64b[_0x6316('0x1f')]?_[_0x6316('0x20')](_0x16a64b[_0x6316('0x1f')],function(_0x575e0e){return{'model':db[_0x575e0e[_0x6316('0x21')]],'as':_0x575e0e['as'],'attributes':_0x575e0e[_0x6316('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30b984){logger['info'](_0x6316('0x1a'),_0x17ca5b);logger[_0x6316('0x12')]('ShowWhatsappAccount',_0x17ca5b,JSON['stringify'](_0x30b984));_0x111a38(_0x30b984);})[_0x6316('0x19')](function(_0x4f97fc){logger['error']('ShowWhatsappAccount',_0x4f97fc['message'],_0x17ca5b);_0x3e4543(_0x3ca71f[_0x6316('0x15')](0x1f4,_0x4f97fc[_0x6316('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1c847ca..b69ecd4 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 _0x6a08=['save','remove','update','emit','removeListener','register','length'];(function(_0xa06fe5,_0x534cca){var _0x1b1619=function(_0x3b6e04){while(--_0x3b6e04){_0xa06fe5['push'](_0xa06fe5['shift']());}};_0x1b1619(++_0x534cca);}(_0x6a08,0x10a));var _0x86a0=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x6a08[_0x326e79];return _0x37eb89;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x86a0('0x0'),_0x86a0('0x1'),_0x86a0('0x2')];function createListener(_0x41de52,_0x187901){return function(_0x2622b5){_0x187901[_0x86a0('0x3')](_0x41de52,_0x2622b5);};}function removeListener(_0x1a2784,_0x4c20b1){return function(){WhatsappAccountEvents[_0x86a0('0x4')](_0x1a2784,_0x4c20b1);};}exports[_0x86a0('0x5')]=function(_0x4c5ce6){for(var _0x2747eb=0x0,_0x385fcb=events[_0x86a0('0x6')];_0x2747eb<_0x385fcb;_0x2747eb++){var _0x2e6910=events[_0x2747eb];var _0x3c6da5=createListener('whatsappAccount:'+_0x2e6910,_0x4c5ce6);WhatsappAccountEvents['on'](_0x2e6910,_0x3c6da5);}}; \ No newline at end of file +var _0xbaa8=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x1d64fe,_0x21e967){var _0x27bd64=function(_0x259101){while(--_0x259101){_0x1d64fe['push'](_0x1d64fe['shift']());}};_0x27bd64(++_0x21e967);}(_0xbaa8,0x110));var _0x8baa=function(_0x32f3e3,_0x21da17){_0x32f3e3=_0x32f3e3-0x0;var _0xe0295a=_0xbaa8[_0x32f3e3];return _0xe0295a;};'use strict';var WhatsappAccountEvents=require(_0x8baa('0x0'));var events=[_0x8baa('0x1'),_0x8baa('0x2'),_0x8baa('0x3')];function createListener(_0x5f4bb4,_0xbcc43e){return function(_0x57f4c2){_0xbcc43e['emit'](_0x5f4bb4,_0x57f4c2);};}function removeListener(_0x31fe1c,_0x32b7fb){return function(){WhatsappAccountEvents['removeListener'](_0x31fe1c,_0x32b7fb);};}exports['register']=function(_0x2a084f){for(var _0xf041af=0x0,_0x7684fc=events[_0x8baa('0x4')];_0xf041af<_0x7684fc;_0xf041af++){var _0x33bf70=events[_0xf041af];var _0x5f2db4=createListener(_0x8baa('0x5')+_0x33bf70,_0x2a084f);WhatsappAccountEvents['on'](_0x33bf70,_0x5f2db4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d8dab72..ed618a8 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 _0x2822=['exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','destroy'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x2822,0x1b4));var _0x2282=function(_0x27cb80,_0x560457){_0x27cb80=_0x27cb80-0x0;var _0x3d1459=_0x2822[_0x27cb80];return _0x3d1459;};'use strict';var multer=require('multer');var util=require(_0x2282('0x0'));var path=require(_0x2282('0x1'));var timeout=require('connect-timeout');var express=require(_0x2282('0x2'));var router=express['Router']();var fs_extra=require(_0x2282('0x3'));var auth=require(_0x2282('0x4'));var interaction=require(_0x2282('0x5'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x2282('0x6')]('/',auth[_0x2282('0x7')](),controller['index']);router[_0x2282('0x6')](_0x2282('0x8'),auth[_0x2282('0x7')](),controller[_0x2282('0x9')]);router[_0x2282('0xa')]('/',auth[_0x2282('0x7')](),controller[_0x2282('0xb')]);router[_0x2282('0xc')]('/:id',auth[_0x2282('0x7')](),controller['update']);router['delete'](_0x2282('0x8'),auth[_0x2282('0x7')](),controller[_0x2282('0xd')]);module[_0x2282('0xe')]=router; \ No newline at end of file +var _0x5202=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','post','create','update','multer'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x5202,0x74));var _0x2520=function(_0x554e2c,_0x311468){_0x554e2c=_0x554e2c-0x0;var _0x28b199=_0x5202[_0x554e2c];return _0x28b199;};'use strict';var multer=require(_0x2520('0x0'));var util=require(_0x2520('0x1'));var path=require('path');var timeout=require(_0x2520('0x2'));var express=require('express');var router=express[_0x2520('0x3')]();var fs_extra=require(_0x2520('0x4'));var auth=require(_0x2520('0x5'));var interaction=require(_0x2520('0x6'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2520('0x7')]);router['get'](_0x2520('0x8'),auth[_0x2520('0x9')](),controller['show']);router[_0x2520('0xa')]('/',auth[_0x2520('0x9')](),controller[_0x2520('0xb')]);router['put'](_0x2520('0x8'),auth[_0x2520('0x9')](),controller[_0x2520('0xc')]);router['delete'](_0x2520('0x8'),auth[_0x2520('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 0bea5db..04882d0 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 _0x3a08=['noop','TEXT','STRING','*,*,*,*','exports','INTEGER'];(function(_0x1010d4,_0xbee34f){var _0x1160cc=function(_0x1e55fc){while(--_0x1e55fc){_0x1010d4['push'](_0x1010d4['shift']());}};_0x1160cc(++_0xbee34f);}(_0x3a08,0xdc));var _0x83a0=function(_0x994e43,_0x48cda8){_0x994e43=_0x994e43-0x0;var _0x3dcb0f=_0x3a08[_0x994e43];return _0x3dcb0f;};'use strict';var Sequelize=require('sequelize');module[_0x83a0('0x0')]={'priority':{'type':Sequelize[_0x83a0('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x83a0('0x2')},'appdata':{'type':Sequelize[_0x83a0('0x3')]()},'description':{'type':Sequelize[_0x83a0('0x4')]},'interval':{'type':Sequelize[_0x83a0('0x4')],'defaultValue':_0x83a0('0x5')}}; \ No newline at end of file +var _0x0b66=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x32776a,_0x592b3b){var _0x4e4c3f=function(_0x328a00){while(--_0x328a00){_0x32776a['push'](_0x32776a['shift']());}};_0x4e4c3f(++_0x592b3b);}(_0x0b66,0x1de));var _0x60b6=function(_0x5aee50,_0x52cd3d){_0x5aee50=_0x5aee50-0x0;var _0x32c480=_0x0b66[_0x5aee50];return _0x32c480;};'use strict';var Sequelize=require('sequelize');module[_0x60b6('0x0')]={'priority':{'type':Sequelize[_0x60b6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x60b6('0x2')],'allowNull':![],'defaultValue':_0x60b6('0x3')},'appdata':{'type':Sequelize[_0x60b6('0x4')]()},'description':{'type':Sequelize[_0x60b6('0x2')]},'interval':{'type':Sequelize[_0x60b6('0x2')],'defaultValue':_0x60b6('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a0ad942..5eb1d22 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 _0x095b=['limit','Content-Range','apply','save','update','error','stack','name','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','catch','find','body','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x095b,0x6e));var _0xb095=function(_0x236765,_0x52df3b){_0x236765=_0x236765-0x0;var _0x385b31=_0x095b[_0x236765];return _0x385b31;};'use strict';var emlformat=require(_0xb095('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb095('0x1'));var jsonpatch=require(_0xb095('0x2'));var rp=require(_0xb095('0x3'));var moment=require(_0xb095('0x4'));var BPromise=require(_0xb095('0x5'));var Mustache=require('mustache');var util=require(_0xb095('0x6'));var path=require(_0xb095('0x7'));var sox=require(_0xb095('0x8'));var csv=require(_0xb095('0x9'));var ejs=require(_0xb095('0xa'));var fs=require('fs');var fs_extra=require(_0xb095('0xb'));var _=require(_0xb095('0xc'));var squel=require(_0xb095('0xd'));var crypto=require(_0xb095('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb095('0xf'));var toCsv=require(_0xb095('0x9'));var querystring=require(_0xb095('0x10'));var Papa=require(_0xb095('0x11'));var Redis=require(_0xb095('0x12'));var authService=require(_0xb095('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb095('0x14'));var logger=require(_0xb095('0x15'))('api');var utils=require(_0xb095('0x16'));var config=require(_0xb095('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb095('0x18'))['db'];function respondWithStatusCode(_0x5e0fb3,_0x7b6edf){_0x7b6edf=_0x7b6edf||0xcc;return function(_0x23dcc5){if(_0x23dcc5){return _0x5e0fb3[_0xb095('0x19')](_0x7b6edf);}return _0x5e0fb3[_0xb095('0x1a')](_0x7b6edf)[_0xb095('0x1b')]();};}function respondWithResult(_0x394df0,_0x781a3f){_0x781a3f=_0x781a3f||0xc8;return function(_0x4afb4d){if(_0x4afb4d){return _0x394df0[_0xb095('0x1a')](_0x781a3f)[_0xb095('0x1c')](_0x4afb4d);}};}function respondWithFilteredResult(_0x44280b,_0x2e6a89){return function(_0xd92481){if(_0xd92481){var _0x2568f8=typeof _0x2e6a89['offset']==='undefined'&&typeof _0x2e6a89['limit']===_0xb095('0x1d');var _0x2c4e86=_0xd92481[_0xb095('0x1e')];var _0x54d06=_0x2568f8?0x0:_0x2e6a89[_0xb095('0x1f')];var _0x7f0681=_0x2568f8?_0xd92481['count']:_0x2e6a89[_0xb095('0x1f')]+_0x2e6a89[_0xb095('0x20')];var _0x27e1d0;if(_0x7f0681>=_0x2c4e86){_0x7f0681=_0x2c4e86;_0x27e1d0=0xc8;}else{_0x27e1d0=0xce;}_0x44280b[_0xb095('0x1a')](_0x27e1d0);return _0x44280b['set'](_0xb095('0x21'),_0x54d06+'-'+_0x7f0681+'/'+_0x2c4e86)[_0xb095('0x1c')](_0xd92481);}return null;};}function patchUpdates(_0x2273f8){return function(_0x318687){try{jsonpatch[_0xb095('0x22')](_0x318687,_0x2273f8,!![]);}catch(_0x2af120){return BPromise['reject'](_0x2af120);}return _0x318687[_0xb095('0x23')]();};}function saveUpdates(_0x525a1a,_0x51750f){return function(_0x4ef4a9){if(_0x4ef4a9){return _0x4ef4a9[_0xb095('0x24')](_0x525a1a)['then'](function(_0x39f9de){return _0x39f9de;});}return null;};}function removeEntity(_0x4650f1,_0x2f1a8b){return function(_0x32d1e6){if(_0x32d1e6){return _0x32d1e6['destroy']()['then'](function(){_0x4650f1[_0xb095('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6488,_0x1bbe29){return function(_0x1f1206){if(!_0x1f1206){_0x3c6488['sendStatus'](0x194);}return _0x1f1206;};}function handleError(_0x3e2095,_0x608591){_0x608591=_0x608591||0x1f4;return function(_0x3cb69f){logger[_0xb095('0x25')](_0x3cb69f[_0xb095('0x26')]);if(_0x3cb69f[_0xb095('0x27')]){delete _0x3cb69f[_0xb095('0x27')];}_0x3e2095[_0xb095('0x1a')](_0x608591)['send'](_0x3cb69f);};}exports['index']=function(_0xd6426c,_0x1d82a5){var _0x53803f={},_0x2f273f={},_0x3d00d1={'count':0x0,'rows':[]};var _0x468d94=_[_0xb095('0x28')](db[_0xb095('0x29')][_0xb095('0x2a')],function(_0xafd194){return{'name':_0xafd194['fieldName'],'type':_0xafd194[_0xb095('0x2b')][_0xb095('0x2c')]};});_0x2f273f[_0xb095('0x2d')]=_[_0xb095('0x28')](_0x468d94,_0xb095('0x27'));_0x2f273f[_0xb095('0x2e')]=_[_0xb095('0x2f')](_0xd6426c['query']);_0x2f273f['filters']=_['intersection'](_0x2f273f['model'],_0x2f273f['query']);_0x53803f[_0xb095('0x30')]=_[_0xb095('0x31')](_0x2f273f[_0xb095('0x2d')],qs[_0xb095('0x32')](_0xd6426c[_0xb095('0x2e')][_0xb095('0x32')]));_0x53803f[_0xb095('0x30')]=_0x53803f[_0xb095('0x30')][_0xb095('0x33')]?_0x53803f[_0xb095('0x30')]:_0x2f273f[_0xb095('0x2d')];if(!_0xd6426c['query'][_0xb095('0x34')](_0xb095('0x35'))){_0x53803f[_0xb095('0x20')]=qs['limit'](_0xd6426c['query'][_0xb095('0x20')]);_0x53803f[_0xb095('0x1f')]=qs[_0xb095('0x1f')](_0xd6426c[_0xb095('0x2e')]['offset']);}_0x53803f['order']=qs[_0xb095('0x36')](_0xd6426c['query'][_0xb095('0x36')]);_0x53803f[_0xb095('0x37')]=qs['filters'](_[_0xb095('0x38')](_0xd6426c[_0xb095('0x2e')],_0x2f273f[_0xb095('0x39')]),_0x468d94);if(_0xd6426c['query'][_0xb095('0x3a')]){_0x53803f[_0xb095('0x37')]=_['merge'](_0x53803f[_0xb095('0x37')],{'$or':_[_0xb095('0x28')](_0x468d94,function(_0x7dd3c9){if(_0x7dd3c9[_0xb095('0x2b')]!==_0xb095('0x3b')){var _0x3d5e17={};_0x3d5e17[_0x7dd3c9[_0xb095('0x27')]]={'$like':'%'+_0xd6426c[_0xb095('0x2e')]['filter']+'%'};return _0x3d5e17;}})});}_0x53803f=_[_0xb095('0x3c')]({},_0x53803f,_0xd6426c[_0xb095('0x3d')]);var _0x69cfbe={'where':_0x53803f[_0xb095('0x37')]};return db[_0xb095('0x29')][_0xb095('0x1e')](_0x69cfbe)[_0xb095('0x3e')](function(_0x1eb503){_0x3d00d1[_0xb095('0x1e')]=_0x1eb503;if(_0xd6426c[_0xb095('0x2e')][_0xb095('0x3f')]){_0x53803f[_0xb095('0x40')]=[{'all':!![]}];}return db[_0xb095('0x29')][_0xb095('0x41')](_0x53803f);})[_0xb095('0x3e')](function(_0x4f57ef){_0x3d00d1['rows']=_0x4f57ef;return _0x3d00d1;})[_0xb095('0x3e')](respondWithFilteredResult(_0x1d82a5,_0x53803f))[_0xb095('0x42')](handleError(_0x1d82a5,null));};exports['show']=function(_0x2a8178,_0x3f63fa){var _0x1582d5={'raw':!![],'where':{'id':_0x2a8178['params']['id']}},_0x367bce={};_0x367bce['model']=_[_0xb095('0x2f')](db[_0xb095('0x29')][_0xb095('0x2a')]);_0x367bce['query']=_['keys'](_0x2a8178['query']);_0x367bce[_0xb095('0x39')]=_['intersection'](_0x367bce[_0xb095('0x2d')],_0x367bce[_0xb095('0x2e')]);_0x1582d5[_0xb095('0x30')]=_['intersection'](_0x367bce[_0xb095('0x2d')],qs['fields'](_0x2a8178['query']['fields']));_0x1582d5[_0xb095('0x30')]=_0x1582d5['attributes'][_0xb095('0x33')]?_0x1582d5['attributes']:_0x367bce[_0xb095('0x2d')];if(_0x2a8178['query'][_0xb095('0x3f')]){_0x1582d5[_0xb095('0x40')]=[{'all':!![]}];}_0x1582d5=_[_0xb095('0x3c')]({},_0x1582d5,_0x2a8178['options']);return db[_0xb095('0x29')][_0xb095('0x43')](_0x1582d5)[_0xb095('0x3e')](handleEntityNotFound(_0x3f63fa,null))[_0xb095('0x3e')](respondWithResult(_0x3f63fa,null))[_0xb095('0x42')](handleError(_0x3f63fa,null));};exports['create']=function(_0x45c71c,_0x4ad545){return db['WhatsappApplication']['create'](_0x45c71c[_0xb095('0x44')],{})['then'](respondWithResult(_0x4ad545,0xc9))[_0xb095('0x42')](handleError(_0x4ad545,null));};exports[_0xb095('0x24')]=function(_0x5685e2,_0x32f642){if(_0x5685e2[_0xb095('0x44')]['id']){delete _0x5685e2[_0xb095('0x44')]['id'];}return db[_0xb095('0x29')][_0xb095('0x43')]({'where':{'id':_0x5685e2['params']['id']}})['then'](handleEntityNotFound(_0x32f642,null))[_0xb095('0x3e')](saveUpdates(_0x5685e2[_0xb095('0x44')],null))[_0xb095('0x3e')](respondWithResult(_0x32f642,null))['catch'](handleError(_0x32f642,null));};exports[_0xb095('0x45')]=function(_0xf0f9e6,_0x13bb46){return db[_0xb095('0x29')][_0xb095('0x43')]({'where':{'id':_0xf0f9e6[_0xb095('0x46')]['id']}})[_0xb095('0x3e')](handleEntityNotFound(_0x13bb46,null))['then'](removeEntity(_0x13bb46,null))[_0xb095('0x42')](handleError(_0x13bb46,null));}; \ No newline at end of file +var _0xa064=['model','map','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','length','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','key'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa064,0x192));var _0x4a06=function(_0x997ede,_0x5a0814){_0x997ede=_0x997ede-0x0;var _0x1f3288=_0xa064[_0x997ede];return _0x1f3288;};'use strict';var emlformat=require(_0x4a06('0x0'));var rimraf=require(_0x4a06('0x1'));var zipdir=require(_0x4a06('0x2'));var jsonpatch=require(_0x4a06('0x3'));var rp=require(_0x4a06('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4a06('0x5'));var util=require('util');var path=require(_0x4a06('0x6'));var sox=require(_0x4a06('0x7'));var csv=require('to-csv');var ejs=require(_0x4a06('0x8'));var fs=require('fs');var fs_extra=require(_0x4a06('0x9'));var _=require('lodash');var squel=require(_0x4a06('0xa'));var crypto=require(_0x4a06('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a06('0xc'));var querystring=require(_0x4a06('0xd'));var Papa=require(_0x4a06('0xe'));var Redis=require(_0x4a06('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4a06('0x10'));var as=require(_0x4a06('0x11'));var hardwareService=require(_0x4a06('0x12'));var logger=require(_0x4a06('0x13'))(_0x4a06('0x14'));var utils=require(_0x4a06('0x15'));var config=require(_0x4a06('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a06('0x17'))['db'];function respondWithStatusCode(_0x52818e,_0x16d686){_0x16d686=_0x16d686||0xcc;return function(_0x3ac986){if(_0x3ac986){return _0x52818e[_0x4a06('0x18')](_0x16d686);}return _0x52818e['status'](_0x16d686)[_0x4a06('0x19')]();};}function respondWithResult(_0xdbc234,_0xf9b166){_0xf9b166=_0xf9b166||0xc8;return function(_0x569aed){if(_0x569aed){return _0xdbc234[_0x4a06('0x1a')](_0xf9b166)[_0x4a06('0x1b')](_0x569aed);}};}function respondWithFilteredResult(_0x292770,_0x51643c){return function(_0x221a80){if(_0x221a80){var _0x29e99b=typeof _0x51643c[_0x4a06('0x1c')]===_0x4a06('0x1d')&&typeof _0x51643c[_0x4a06('0x1e')]==='undefined';var _0x19c96d=_0x221a80['count'];var _0x4fd47f=_0x29e99b?0x0:_0x51643c[_0x4a06('0x1c')];var _0x463aca=_0x29e99b?_0x221a80[_0x4a06('0x1f')]:_0x51643c[_0x4a06('0x1c')]+_0x51643c[_0x4a06('0x1e')];var _0x226538;if(_0x463aca>=_0x19c96d){_0x463aca=_0x19c96d;_0x226538=0xc8;}else{_0x226538=0xce;}_0x292770[_0x4a06('0x1a')](_0x226538);return _0x292770[_0x4a06('0x20')](_0x4a06('0x21'),_0x4fd47f+'-'+_0x463aca+'/'+_0x19c96d)['json'](_0x221a80);}return null;};}function patchUpdates(_0x98df26){return function(_0x3933e6){try{jsonpatch[_0x4a06('0x22')](_0x3933e6,_0x98df26,!![]);}catch(_0x357f82){return BPromise[_0x4a06('0x23')](_0x357f82);}return _0x3933e6[_0x4a06('0x24')]();};}function saveUpdates(_0x20f9f4,_0x156af7){return function(_0xae7471){if(_0xae7471){return _0xae7471[_0x4a06('0x25')](_0x20f9f4)[_0x4a06('0x26')](function(_0x44eb74){return _0x44eb74;});}return null;};}function removeEntity(_0x38c823,_0x5ebd7c){return function(_0x501ee9){if(_0x501ee9){return _0x501ee9[_0x4a06('0x27')]()[_0x4a06('0x26')](function(){_0x38c823[_0x4a06('0x1a')](0xcc)[_0x4a06('0x19')]();});}};}function handleEntityNotFound(_0x5b5a43,_0x5e8af0){return function(_0xf7e565){if(!_0xf7e565){_0x5b5a43[_0x4a06('0x18')](0x194);}return _0xf7e565;};}function handleError(_0x55861c,_0xdf5163){_0xdf5163=_0xdf5163||0x1f4;return function(_0x54613e){logger[_0x4a06('0x28')](_0x54613e[_0x4a06('0x29')]);if(_0x54613e['name']){delete _0x54613e[_0x4a06('0x2a')];}_0x55861c[_0x4a06('0x1a')](_0xdf5163)[_0x4a06('0x2b')](_0x54613e);};}exports[_0x4a06('0x2c')]=function(_0x1c14d3,_0x37cb33){var _0x5ee187={},_0x255924={},_0x452188={'count':0x0,'rows':[]};var _0x1ab220=_['map'](db[_0x4a06('0x2d')][_0x4a06('0x2e')],function(_0x20cf23){return{'name':_0x20cf23['fieldName'],'type':_0x20cf23['type'][_0x4a06('0x2f')]};});_0x255924[_0x4a06('0x30')]=_[_0x4a06('0x31')](_0x1ab220,_0x4a06('0x2a'));_0x255924[_0x4a06('0x32')]=_[_0x4a06('0x33')](_0x1c14d3[_0x4a06('0x32')]);_0x255924[_0x4a06('0x34')]=_['intersection'](_0x255924[_0x4a06('0x30')],_0x255924[_0x4a06('0x32')]);_0x5ee187[_0x4a06('0x35')]=_[_0x4a06('0x36')](_0x255924[_0x4a06('0x30')],qs['fields'](_0x1c14d3[_0x4a06('0x32')]['fields']));_0x5ee187[_0x4a06('0x35')]=_0x5ee187[_0x4a06('0x35')]['length']?_0x5ee187[_0x4a06('0x35')]:_0x255924[_0x4a06('0x30')];if(!_0x1c14d3[_0x4a06('0x32')][_0x4a06('0x37')](_0x4a06('0x38'))){_0x5ee187['limit']=qs[_0x4a06('0x1e')](_0x1c14d3['query'][_0x4a06('0x1e')]);_0x5ee187[_0x4a06('0x1c')]=qs[_0x4a06('0x1c')](_0x1c14d3['query'][_0x4a06('0x1c')]);}_0x5ee187[_0x4a06('0x39')]=qs[_0x4a06('0x3a')](_0x1c14d3[_0x4a06('0x32')][_0x4a06('0x3a')]);_0x5ee187[_0x4a06('0x3b')]=qs['filters'](_[_0x4a06('0x3c')](_0x1c14d3['query'],_0x255924[_0x4a06('0x34')]),_0x1ab220);if(_0x1c14d3[_0x4a06('0x32')][_0x4a06('0x3d')]){_0x5ee187['where']=_[_0x4a06('0x3e')](_0x5ee187['where'],{'$or':_[_0x4a06('0x31')](_0x1ab220,function(_0x59517c){if(_0x59517c['type']!==_0x4a06('0x3f')){var _0x84b40e={};_0x84b40e[_0x59517c[_0x4a06('0x2a')]]={'$like':'%'+_0x1c14d3[_0x4a06('0x32')][_0x4a06('0x3d')]+'%'};return _0x84b40e;}})});}_0x5ee187=_[_0x4a06('0x3e')]({},_0x5ee187,_0x1c14d3[_0x4a06('0x40')]);var _0x1084b8={'where':_0x5ee187[_0x4a06('0x3b')]};return db['WhatsappApplication']['count'](_0x1084b8)[_0x4a06('0x26')](function(_0x284a2b){_0x452188[_0x4a06('0x1f')]=_0x284a2b;if(_0x1c14d3[_0x4a06('0x32')][_0x4a06('0x41')]){_0x5ee187[_0x4a06('0x42')]=[{'all':!![]}];}return db[_0x4a06('0x2d')]['findAll'](_0x5ee187);})['then'](function(_0x465938){_0x452188[_0x4a06('0x43')]=_0x465938;return _0x452188;})[_0x4a06('0x26')](respondWithFilteredResult(_0x37cb33,_0x5ee187))[_0x4a06('0x44')](handleError(_0x37cb33,null));};exports[_0x4a06('0x45')]=function(_0x534227,_0x18dbe9){var _0x538c73={'raw':!![],'where':{'id':_0x534227[_0x4a06('0x46')]['id']}},_0x35fb1b={};_0x35fb1b[_0x4a06('0x30')]=_[_0x4a06('0x33')](db['WhatsappApplication'][_0x4a06('0x2e')]);_0x35fb1b[_0x4a06('0x32')]=_[_0x4a06('0x33')](_0x534227['query']);_0x35fb1b[_0x4a06('0x34')]=_[_0x4a06('0x36')](_0x35fb1b[_0x4a06('0x30')],_0x35fb1b['query']);_0x538c73[_0x4a06('0x35')]=_[_0x4a06('0x36')](_0x35fb1b[_0x4a06('0x30')],qs[_0x4a06('0x47')](_0x534227[_0x4a06('0x32')][_0x4a06('0x47')]));_0x538c73[_0x4a06('0x35')]=_0x538c73[_0x4a06('0x35')][_0x4a06('0x48')]?_0x538c73[_0x4a06('0x35')]:_0x35fb1b[_0x4a06('0x30')];if(_0x534227[_0x4a06('0x32')][_0x4a06('0x41')]){_0x538c73['include']=[{'all':!![]}];}_0x538c73=_[_0x4a06('0x3e')]({},_0x538c73,_0x534227['options']);return db[_0x4a06('0x2d')][_0x4a06('0x49')](_0x538c73)[_0x4a06('0x26')](handleEntityNotFound(_0x18dbe9,null))[_0x4a06('0x26')](respondWithResult(_0x18dbe9,null))[_0x4a06('0x44')](handleError(_0x18dbe9,null));};exports['create']=function(_0x1fb2fe,_0x1f4fad){return db[_0x4a06('0x2d')]['create'](_0x1fb2fe[_0x4a06('0x4a')],{})[_0x4a06('0x26')](respondWithResult(_0x1f4fad,0xc9))[_0x4a06('0x44')](handleError(_0x1f4fad,null));};exports['update']=function(_0x25ba9c,_0x2824ed){if(_0x25ba9c[_0x4a06('0x4a')]['id']){delete _0x25ba9c[_0x4a06('0x4a')]['id'];}return db[_0x4a06('0x2d')][_0x4a06('0x49')]({'where':{'id':_0x25ba9c['params']['id']}})[_0x4a06('0x26')](handleEntityNotFound(_0x2824ed,null))[_0x4a06('0x26')](saveUpdates(_0x25ba9c[_0x4a06('0x4a')],null))[_0x4a06('0x26')](respondWithResult(_0x2824ed,null))[_0x4a06('0x44')](handleError(_0x2824ed,null));};exports[_0x4a06('0x27')]=function(_0x524ebd,_0xcfa915){return db['WhatsappApplication']['find']({'where':{'id':_0x524ebd[_0x4a06('0x46')]['id']}})[_0x4a06('0x26')](handleEntityNotFound(_0xcfa915,null))[_0x4a06('0x26')](removeEntity(_0xcfa915,null))[_0x4a06('0x44')](handleError(_0xcfa915,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 27b77f7..baf49ec 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 _0xa74a=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x230229,_0x465a26){var _0x1aa165=function(_0xb0f174){while(--_0xb0f174){_0x230229['push'](_0x230229['shift']());}};_0x1aa165(++_0x465a26);}(_0xa74a,0x66));var _0xaa74=function(_0x5770cb,_0xf8000b){_0x5770cb=_0x5770cb-0x0;var _0x285427=_0xa74a[_0x5770cb];return _0x285427;};'use strict';var _=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var logger=require(_0xaa74('0x2'))(_0xaa74('0x3'));var moment=require(_0xaa74('0x4'));var BPromise=require(_0xaa74('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa74('0x6'));var rimraf=require(_0xaa74('0x7'));var config=require(_0xaa74('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x24eee1,_0x44250c){return _0x24eee1[_0xaa74('0x9')](_0xaa74('0xa'),attributes,{'tableName':_0xaa74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaa74('0xc')});}; \ No newline at end of file +var _0x6dac=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x25d45e,_0x26f1d6){var _0x209ce4=function(_0x25e3f4){while(--_0x25e3f4){_0x25d45e['push'](_0x25d45e['shift']());}};_0x209ce4(++_0x26f1d6);}(_0x6dac,0x16e));var _0xc6da=function(_0x11cf57,_0x218174){_0x11cf57=_0x11cf57-0x0;var _0x2c92f5=_0x6dac[_0x11cf57];return _0x2c92f5;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var logger=require(_0xc6da('0x2'))(_0xc6da('0x3'));var moment=require(_0xc6da('0x4'));var BPromise=require(_0xc6da('0x5'));var rp=require(_0xc6da('0x6'));var fs=require('fs');var path=require(_0xc6da('0x7'));var rimraf=require(_0xc6da('0x8'));var config=require(_0xc6da('0x9'));var attributes=require(_0xc6da('0xa'));module[_0xc6da('0xb')]=function(_0x325f49,_0x5caf49){return _0x325f49[_0xc6da('0xc')](_0xc6da('0xd'),attributes,{'tableName':_0xc6da('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc6da('0xf'),'collate':_0xc6da('0x10')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b99f610..5df82fc 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 _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x8c51b6,_0x431aff){var _0x2fe4b7=function(_0x58051a){while(--_0x58051a){_0x8c51b6['push'](_0x8c51b6['shift']());}};_0x2fe4b7(++_0x431aff);}(_0x2d17,0x17e));var _0x72d1=function(_0x5d406d,_0x525896){_0x5d406d=_0x5d406d-0x0;var _0x2b44fc=_0x2d17[_0x5d406d];return _0x2b44fc;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file +var _0x98a8=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52c17b,_0x3f8750){var _0x50cde3=function(_0x4f50f6){while(--_0x4f50f6){_0x52c17b['push'](_0x52c17b['shift']());}};_0x50cde3(++_0x3f8750);}(_0x98a8,0x12c));var _0x898a=function(_0x59e8e2,_0x2eb5ba){_0x59e8e2=_0x59e8e2-0x0;var _0x2a1693=_0x98a8[_0x59e8e2];return _0x2a1693;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3d054d4..050f409 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 _0x126e=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x126e,0x108));var _0xe126=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x126e[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0xe126('0x0'));var path=require(_0xe126('0x1'));var timeout=require(_0xe126('0x2'));var express=require(_0xe126('0x3'));var router=express[_0xe126('0x4')]();var fs_extra=require(_0xe126('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe126('0x6'));var config=require(_0xe126('0x7'));var controller=require(_0xe126('0x8'));router[_0xe126('0x9')]('/',auth[_0xe126('0xa')](),controller[_0xe126('0xb')]);router[_0xe126('0x9')]('/describe',auth[_0xe126('0xa')](),controller[_0xe126('0xc')]);router[_0xe126('0x9')](_0xe126('0xd'),auth[_0xe126('0xa')](),controller['show']);router[_0xe126('0x9')](_0xe126('0xe'),auth['isAuthenticated'](),controller[_0xe126('0xf')]);router[_0xe126('0x9')]('/:id/download',auth[_0xe126('0xa')](),controller['download']);router[_0xe126('0x10')]('/',auth['isAuthenticated'](),controller[_0xe126('0x11')]);router[_0xe126('0x10')](_0xe126('0xe'),auth[_0xe126('0xa')](),controller[_0xe126('0x12')]);router[_0xe126('0x10')](_0xe126('0x13'),auth['isAuthenticated'](),interaction[_0xe126('0x14')](_0xe126('0x15'),'whatsappinteraction:addtags'),controller[_0xe126('0x16')]);router[_0xe126('0x17')](_0xe126('0xd'),auth[_0xe126('0xa')](),interaction['tracked'](_0xe126('0x15'),_0xe126('0x18')),controller[_0xe126('0x19')]);router['delete'](_0xe126('0xd'),auth['isAuthenticated'](),interaction[_0xe126('0x14')](_0xe126('0x15'),_0xe126('0x1a')),controller[_0xe126('0x1b')]);router[_0xe126('0x1c')](_0xe126('0x13'),auth[_0xe126('0xa')](),controller[_0xe126('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xba34=['removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','destroy','delete'];(function(_0x40c6b4,_0x4b803b){var _0x2b54e7=function(_0x4b3db9){while(--_0x4b3db9){_0x40c6b4['push'](_0x40c6b4['shift']());}};_0x2b54e7(++_0x4b803b);}(_0xba34,0x119));var _0x4ba3=function(_0x143b84,_0xc0aabf){_0x143b84=_0x143b84-0x0;var _0x17937e=_0xba34[_0x143b84];return _0x17937e;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/download',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['post']('/',auth[_0x4ba3('0x9')](),controller['create']);router[_0x4ba3('0x11')]('/:id/messages',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x12')]);router[_0x4ba3('0x11')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),interaction[_0x4ba3('0x14')](_0x4ba3('0x15'),_0x4ba3('0x16')),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x18')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),interaction[_0x4ba3('0x14')](_0x4ba3('0x15'),_0x4ba3('0x19')),controller[_0x4ba3('0x1a')]);router['delete'](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),interaction[_0x4ba3('0x14')](_0x4ba3('0x15'),'whatsappinteraction:destroy'),controller[_0x4ba3('0x1b')]);router[_0x4ba3('0x1c')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x1d')]);module[_0x4ba3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index ceb018b..2fc3f13 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 _0x6a95=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a95,0x1db));var _0x56a9=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6a95[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0x56a9('0x0'));var moment=require(_0x56a9('0x1'));module[_0x56a9('0x2')]={'closed':{'type':Sequelize[_0x56a9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x56a9('0x4')]},'disposition':{'type':Sequelize[_0x56a9('0x5')]},'secondDisposition':{'type':Sequelize[_0x56a9('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x56a9('0x5')]},'read1stAt':{'type':Sequelize[_0x56a9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x56a9('0x6')]('in',_0x56a9('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x56a9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x56a9('0x6')]('in',_0x56a9('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3c66=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x257a8b,_0x214d25){var _0x36e8b1=function(_0x58fa7a){while(--_0x58fa7a){_0x257a8b['push'](_0x257a8b['shift']());}};_0x36e8b1(++_0x214d25);}(_0x3c66,0x8b));var _0x63c6=function(_0x2b5ecb,_0x49f11b){_0x2b5ecb=_0x2b5ecb-0x0;var _0x156305=_0x3c66[_0x2b5ecb];return _0x156305;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x63c6('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x63c6('0x1')]},'disposition':{'type':Sequelize[_0x63c6('0x2')]},'secondDisposition':{'type':Sequelize[_0x63c6('0x2')]},'thirdDisposition':{'type':Sequelize[_0x63c6('0x2')]},'note':{'type':Sequelize[_0x63c6('0x2')]},'phone':{'type':Sequelize[_0x63c6('0x2')]},'read1stAt':{'type':Sequelize[_0x63c6('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x63c6('0x3')]('in',_0x63c6('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x63c6('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x63c6('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x63c6('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 5983e51..20412c4 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 _0x45b2=['keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','order','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','color','removeTags','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Attachment','createdAt','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','pipe','createWriteStream','System','lastName','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','err','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','then','destroy','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','findAll','query','params','model'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x45b2,0xc8));var _0x245b=function(_0x49baae,_0x348854){_0x49baae=_0x49baae-0x0;var _0x148062=_0x45b2[_0x49baae];return _0x148062;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x245b('0x0'));var moment=require(_0x245b('0x1'));var BPromise=require('bluebird');var util=require(_0x245b('0x2'));var path=require(_0x245b('0x3'));var ejs=require(_0x245b('0x4'));var fs=require('fs');var _=require(_0x245b('0x5'));var Redis=require(_0x245b('0x6'));var interaction=require(_0x245b('0x7'));var qs=require(_0x245b('0x8'));var pdf=require(_0x245b('0x9'));var logger=require(_0x245b('0xa'))(_0x245b('0xb'));var config=require(_0x245b('0xc'));var db=require(_0x245b('0xd'))['db'];config[_0x245b('0xe')]=_['defaults'](config[_0x245b('0xe')],{'host':_0x245b('0xf'),'port':0x18eb});var socket=require(_0x245b('0x10'))(new Redis(config[_0x245b('0xe')]));require(_0x245b('0x11'))[_0x245b('0x12')](socket);function respondWithStatusCode(_0x5f5135,_0x4e8c9c){_0x4e8c9c=_0x4e8c9c||0xcc;return function(_0x56ad17){if(_0x56ad17){return _0x5f5135[_0x245b('0x13')](_0x4e8c9c);}return _0x5f5135[_0x245b('0x14')](_0x4e8c9c)[_0x245b('0x15')]();};}function respondWithResult(_0x4c966b,_0x27accf){_0x27accf=_0x27accf||0xc8;return function(_0x2bbf87){if(_0x2bbf87){return _0x4c966b[_0x245b('0x14')](_0x27accf)['json'](_0x2bbf87);}};}function respondWithFilteredResult(_0x395df8,_0xe3dec1){return function(_0x16baf3){if(_0x16baf3){var _0x532550=typeof _0xe3dec1[_0x245b('0x16')]==='undefined'&&typeof _0xe3dec1[_0x245b('0x17')]===_0x245b('0x18');var _0x308f5c=_0x16baf3[_0x245b('0x19')];var _0x130455=_0x532550?0x0:_0xe3dec1[_0x245b('0x16')];var _0x270a2f=_0x532550?_0x16baf3['count']:_0xe3dec1[_0x245b('0x16')]+_0xe3dec1['limit'];var _0x221589;if(_0x270a2f>=_0x308f5c){_0x270a2f=_0x308f5c;_0x221589=0xc8;}else{_0x221589=0xce;}_0x395df8[_0x245b('0x14')](_0x221589);return _0x395df8['set'](_0x245b('0x1a'),_0x130455+'-'+_0x270a2f+'/'+_0x308f5c)[_0x245b('0x1b')](_0x16baf3);}return null;};}function saveUpdates(_0x36c722){return function(_0x5825d6){if(_0x5825d6){return _0x5825d6['update'](_0x36c722)[_0x245b('0x1c')](function(_0x3cee28){return _0x3cee28;});}return null;};}function removeEntity(_0x423722){return function(_0x4218f6){if(_0x4218f6){return _0x4218f6[_0x245b('0x1d')]()[_0x245b('0x1c')](function(){_0x423722[_0x245b('0x14')](0xcc)[_0x245b('0x15')]();});}};}function handleEntityNotFound(_0x5f26c9){return function(_0xfd5b6f){if(!_0xfd5b6f){_0x5f26c9['sendStatus'](0x194);}return _0xfd5b6f;};}function handleError(_0x4f8653,_0x19b3de){_0x19b3de=_0x19b3de||0x1f4;return function(_0xb9e476){logger['error'](_0xb9e476[_0x245b('0x1e')]);if(_0xb9e476[_0x245b('0x1f')]){delete _0xb9e476[_0x245b('0x1f')];}_0x4f8653[_0x245b('0x14')](_0x19b3de)['send'](_0xb9e476);};}exports[_0x245b('0x20')]=function(_0x4c0540,_0x4be377){var _0x570bfd={};var _0x5532e6=_[_0x245b('0x21')](db[_0x245b('0x22')][_0x245b('0x23')],function(_0x190903){return{'name':_0x190903[_0x245b('0x24')],'type':_0x190903[_0x245b('0x25')]['key']};});_0x570bfd=qs['getOptions'](_0x5532e6,_0x4c0540);return interaction[_0x245b('0x26')]('whatsapp',_0x4c0540[_0x245b('0x27')],_0x4c0540['user'],_0x570bfd,_0x5532e6)[_0x245b('0x1c')](respondWithFilteredResult(_0x4be377,_0x570bfd))['catch'](handleError(_0x4be377,null));};exports['show']=function(_0xb075d,_0x564966){var _0x5c0af2={'raw':![],'where':{'id':_0xb075d[_0x245b('0x28')]['id']}},_0x40c7ff={};_0x40c7ff[_0x245b('0x29')]=_[_0x245b('0x2a')](db[_0x245b('0x22')]['rawAttributes']);_0x40c7ff[_0x245b('0x27')]=_[_0x245b('0x2a')](_0xb075d[_0x245b('0x27')]);_0x40c7ff[_0x245b('0x2b')]=_['intersection'](_0x40c7ff[_0x245b('0x29')],_0x40c7ff['query']);_0x5c0af2[_0x245b('0x2c')]=_[_0x245b('0x2d')](_0x40c7ff[_0x245b('0x29')],qs[_0x245b('0x2e')](_0xb075d[_0x245b('0x27')]['fields']));_0x5c0af2[_0x245b('0x2c')]=_0x5c0af2['attributes'][_0x245b('0x2f')]?_0x5c0af2['attributes']:_0x40c7ff[_0x245b('0x29')];if(_0xb075d[_0x245b('0x27')][_0x245b('0x30')]){_0x5c0af2[_0x245b('0x31')]=[{'all':!![]}];}_0x5c0af2=_[_0x245b('0x32')]({},_0x5c0af2,_0xb075d[_0x245b('0x33')]);return db[_0x245b('0x22')][_0x245b('0x34')](_0x5c0af2)[_0x245b('0x1c')](handleEntityNotFound(_0x564966,null))[_0x245b('0x1c')](respondWithResult(_0x564966,null))[_0x245b('0x35')](handleError(_0x564966,null));};exports[_0x245b('0x36')]=function(_0x6b0fce,_0x2e8c3d){return db[_0x245b('0x22')][_0x245b('0x36')](_0x6b0fce[_0x245b('0x37')],{})[_0x245b('0x1c')](respondWithResult(_0x2e8c3d,0xc9))[_0x245b('0x35')](handleError(_0x2e8c3d,null));};exports['update']=function(_0x51ac8f,_0x3731ed){if(_0x51ac8f['body']['id']){delete _0x51ac8f[_0x245b('0x37')]['id'];}return db[_0x245b('0x22')][_0x245b('0x34')]({'where':{'id':_0x51ac8f[_0x245b('0x28')]['id']}})[_0x245b('0x1c')](handleEntityNotFound(_0x3731ed,null))[_0x245b('0x1c')](saveUpdates(_0x51ac8f[_0x245b('0x37')],null))[_0x245b('0x1c')](respondWithResult(_0x3731ed,null))[_0x245b('0x35')](handleError(_0x3731ed,null));};exports['destroy']=function(_0x6cfea8,_0x10fdd3){return db[_0x245b('0x22')][_0x245b('0x34')]({'where':{'id':_0x6cfea8['params']['id']}})['then'](handleEntityNotFound(_0x10fdd3,null))[_0x245b('0x1c')](removeEntity(_0x10fdd3,null))['catch'](handleError(_0x10fdd3,null));};exports['describe']=function(_0xf3d8e3,_0x452d9e){return db[_0x245b('0x22')][_0x245b('0x38')]()['then'](respondWithResult(_0x452d9e,null))[_0x245b('0x35')](handleError(_0x452d9e,null));};exports[_0x245b('0x39')]=function(_0x50345e,_0x32e507){return db[_0x245b('0x3a')]['find']({'where':{'id':_0x50345e['params']['id']}})[_0x245b('0x1c')](handleEntityNotFound(_0x32e507,null))[_0x245b('0x1c')](function(_0xc5c47){if(_0xc5c47){return _0xc5c47[_0x245b('0x39')](_0x50345e['body']['ids'],_['omit'](_0x50345e[_0x245b('0x37')],[_0x245b('0x3b'),'id'])||{});}})[_0x245b('0x1c')](respondWithResult(_0x32e507,null))[_0x245b('0x35')](handleError(_0x32e507,null));};exports[_0x245b('0x3c')]=function(_0x229b43,_0x4985d3){var _0x2b8b15={'raw':![],'where':{}};var _0x18ecd6={};var _0x54d2d0={'count':0x0,'rows':[]};return db[_0x245b('0x22')][_0x245b('0x3d')]({'where':{'id':_0x229b43[_0x245b('0x28')]['id']}})[_0x245b('0x1c')](handleEntityNotFound(_0x4985d3,null))['then'](function(_0xe3e1ba){if(_0xe3e1ba){_0x18ecd6[_0x245b('0x29')]=_[_0x245b('0x2a')](db['WhatsappMessage'][_0x245b('0x23')]);_0x18ecd6[_0x245b('0x27')]=_[_0x245b('0x2a')](_0x229b43[_0x245b('0x27')]);_0x18ecd6['filters']=_[_0x245b('0x2d')](_0x18ecd6[_0x245b('0x29')],_0x18ecd6[_0x245b('0x27')]);_0x2b8b15[_0x245b('0x2c')]=_[_0x245b('0x2d')](_0x18ecd6[_0x245b('0x29')],qs[_0x245b('0x2e')](_0x229b43[_0x245b('0x27')][_0x245b('0x2e')]));_0x2b8b15[_0x245b('0x2c')]=_0x2b8b15[_0x245b('0x2c')]['length']?_0x2b8b15[_0x245b('0x2c')]:_0x18ecd6[_0x245b('0x29')];if(!_0x229b43['query'][_0x245b('0x3e')]('nolimit')){_0x2b8b15[_0x245b('0x17')]=qs['limit'](_0x229b43[_0x245b('0x27')][_0x245b('0x17')]);_0x2b8b15['offset']=qs[_0x245b('0x16')](_0x229b43[_0x245b('0x27')][_0x245b('0x16')]);}_0x2b8b15[_0x245b('0x3f')]=qs['sort'](_0x229b43[_0x245b('0x27')][_0x245b('0x40')]);_0x2b8b15[_0x245b('0x41')]=qs['filters'](_['pick'](_0x229b43[_0x245b('0x27')],_0x18ecd6[_0x245b('0x2b')]));_0x2b8b15[_0x245b('0x41')]['WhatsappInteractionId']=_0xe3e1ba['id'];if(_0x229b43[_0x245b('0x27')][_0x245b('0x42')]){_0x2b8b15[_0x245b('0x41')]=_[_0x245b('0x32')](_0x2b8b15[_0x245b('0x41')],{'$or':_[_0x245b('0x21')](_0x2b8b15[_0x245b('0x2c')],function(_0x11320a){var _0x4fb6a0={};_0x4fb6a0[_0x11320a]={'$like':'%'+_0x229b43[_0x245b('0x27')][_0x245b('0x42')]+'%'};return _0x4fb6a0;})});}if(_0x229b43[_0x245b('0x27')]['$gte']){var _0x5e0917=_0x229b43[_0x245b('0x27')][_0x245b('0x43')][_0x245b('0x44')](',');var _0x8379d8={};_0x8379d8[_0x5e0917[0x0]]={'$gte':moment(_0x5e0917[0x1])[_0x245b('0x45')](_0x245b('0x46'))};_0x2b8b15[_0x245b('0x41')]=_[_0x245b('0x32')](_0x2b8b15[_0x245b('0x41')],_0x8379d8);}_0x2b8b15=_[_0x245b('0x32')]({},_0x2b8b15,_0x229b43[_0x245b('0x33')]);return db[_0x245b('0x3a')]['count']({'where':_0x2b8b15['where']})[_0x245b('0x1c')](function(_0x45de10){_0x54d2d0[_0x245b('0x19')]=_0x45de10;if(_0x229b43[_0x245b('0x27')][_0x245b('0x30')]){_0x2b8b15[_0x245b('0x31')]=[{'all':!![]}];}return db[_0x245b('0x3a')][_0x245b('0x26')](_0x2b8b15);})[_0x245b('0x1c')](function(_0x4c4311){_0x54d2d0[_0x245b('0x47')]=_0x4c4311;return _0x54d2d0;});}})[_0x245b('0x1c')](respondWithFilteredResult(_0x4985d3,_0x2b8b15))['catch'](handleError(_0x4985d3,null));};exports[_0x245b('0x48')]=function(_0x35a7bd,_0x417153){return db[_0x245b('0x22')][_0x245b('0x34')]({'where':{'id':_0x35a7bd[_0x245b('0x28')]['id']}})[_0x245b('0x1c')](handleEntityNotFound(_0x417153,null))['then'](function(_0x2eb8bb){if(_0x2eb8bb){return _0x2eb8bb[_0x245b('0x49')](_0x35a7bd[_0x245b('0x37')]['ids'],_[_0x245b('0x4a')](_0x35a7bd[_0x245b('0x37')],['ids','id'])||{})[_0x245b('0x4b')](function(){return db[_0x245b('0x4c')]['findAll']({'attributes':['id',_0x245b('0x1f'),_0x245b('0x4d')],'where':{'id':_0x35a7bd[_0x245b('0x37')]['ids']}});})[_0x245b('0x1c')](function(_0x30ae34){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x35a7bd[_0x245b('0x28')]['id']),'tags':_0x30ae34||[]});return{'id':Number(_0x35a7bd[_0x245b('0x28')]['id']),'tags':_0x30ae34||[]};});}})['then'](respondWithResult(_0x417153,null))[_0x245b('0x35')](handleError(_0x417153,null));};exports['removeTags']=function(_0x3c9996,_0x42e4d5){return db[_0x245b('0x22')][_0x245b('0x34')]({'where':{'id':_0x3c9996[_0x245b('0x28')]['id']}})[_0x245b('0x1c')](handleEntityNotFound(_0x42e4d5,null))[_0x245b('0x1c')](function(_0x937869){if(_0x937869){return _0x937869[_0x245b('0x4e')](_0x3c9996[_0x245b('0x27')]['ids']);}})[_0x245b('0x1c')](respondWithStatusCode(_0x42e4d5,null))[_0x245b('0x35')](handleError(_0x42e4d5,null));};exports['download']=function(_0x3dba01,_0x369dbf){var _0x3c371c=moment()['unix']()[_0x245b('0x4f')]();var _0x10b03d=path[_0x245b('0x50')](config[_0x245b('0x51')],_0x245b('0x52'),_0x245b('0x53'),_0x245b('0x54'));var _0x4a4d2f=path[_0x245b('0x50')](config['root'],_0x245b('0x52'),_0x245b('0x53'),_0x245b('0x55'));var _0x55070a=path[_0x245b('0x50')](_0x10b03d,_0x3c371c);var _0x3d89ab=util[_0x245b('0x45')](_0x245b('0x56'),_0x3dba01[_0x245b('0x28')]['id'],_0x3c371c);var _0x3d83e8=path[_0x245b('0x50')](_0x10b03d,_0x3d89ab);var _0x15f79e=[];_0x15f79e[_0x245b('0x57')]({'model':db[_0x245b('0x58')],'as':_0x245b('0x58'),'attributes':['id',_0x245b('0x59')],'raw':!![]});_0x15f79e[_0x245b('0x57')]({'model':db[_0x245b('0x5a')],'as':_0x245b('0x5b'),'attributes':['id',_0x245b('0x5c'),'lastName'],'raw':!![]});if(_0x3dba01[_0x245b('0x27')][_0x245b('0x55')]){_0x15f79e[_0x245b('0x57')]({'model':db[_0x245b('0x5d')],'as':_0x245b('0x5d'),'raw':!![]});}var _0x4b58c1=[{'model':db[_0x245b('0x3a')],'as':'Messages','attributes':['id',_0x245b('0x37'),_0x245b('0x5e'),_0x245b('0x5f'),_0x245b('0x60'),_0x245b('0x61')],'include':_0x15f79e}];_0x4b58c1[_0x245b('0x57')]({'model':db[_0x245b('0x62')],'as':_0x245b('0x63'),'attributes':['id',_0x245b('0x1f')]});_0x4b58c1['push']({'model':db[_0x245b('0x58')],'as':'Owner','attributes':['id',_0x245b('0x59')]});return db[_0x245b('0x22')][_0x245b('0x34')]({'where':{'id':_0x3dba01[_0x245b('0x28')]['id']},'include':_0x4b58c1})[_0x245b('0x1c')](handleEntityNotFound(_0x369dbf,null))['then'](function(_0x316b07){if(_0x316b07){var _0x4972b1=_0x316b07[_0x245b('0x64')]({'plain':!![]});fs[_0x245b('0x65')](_0x55070a);var _0x27a777={'channel':_0x245b('0x66'),'account':_0x4972b1[_0x245b('0x63')][_0x245b('0x1f')],'agent':_0x4972b1[_0x245b('0x67')]?_0x4972b1[_0x245b('0x67')][_0x245b('0x59')]:_0x245b('0x68'),'createdAt':moment(_0x4972b1[_0x245b('0x5e')])[_0x245b('0x45')](_0x245b('0x46'))[_0x245b('0x4f')](),'closedAt':_0x4972b1[_0x245b('0x69')]?moment(_0x4972b1[_0x245b('0x6a')])[_0x245b('0x45')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x4972b1[_0x245b('0x6b')],'messages':_(_0x4972b1[_0x245b('0x6c')])[_0x245b('0x42')]({'secret':![]})['map'](function(_0x5b1ba4){if(_0x5b1ba4[_0x245b('0x5d')]){var _0x31efef=path[_0x245b('0x50')](_0x4a4d2f,_0x5b1ba4[_0x245b('0x5d')][_0x245b('0x6d')]);if(fs[_0x245b('0x6e')](_0x31efef)){fs['createReadStream'](_0x31efef)[_0x245b('0x6f')](fs[_0x245b('0x70')](path[_0x245b('0x50')](_0x55070a,_0x5b1ba4[_0x245b('0x5d')]['basename'])));}}return{'date':moment(_0x5b1ba4[_0x245b('0x5e')])[_0x245b('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0x245b('0x4f')](),'sender':_0x5b1ba4[_0x245b('0x5f')]==='out'?_0x5b1ba4[_0x245b('0x58')]?_0x5b1ba4[_0x245b('0x58')][_0x245b('0x59')]:_0x245b('0x71'):_0x5b1ba4[_0x245b('0x5b')]['firstName']+(_0x5b1ba4['Contact'][_0x245b('0x72')]?'\x20'+_0x5b1ba4[_0x245b('0x5b')]['lastName']:''),'body':_0x5b1ba4[_0x245b('0x5d')]?_0x5b1ba4[_0x245b('0x5d')][_0x245b('0x6d')]:_0x5b1ba4['body'],'direction':_0x5b1ba4[_0x245b('0x5f')]==='out'?'A':'C','secret':_0x5b1ba4[_0x245b('0x60')],'read':_0x5b1ba4[_0x245b('0x61')],'attachment':_0x5b1ba4[_0x245b('0x5d')]};})['value']()};return ejs['renderFile'](path[_0x245b('0x50')](config['root'],_0x245b('0x52'),'views',_0x245b('0x73')),{'interaction':_0x27a777})[_0x245b('0x1c')](function(_0x1306e0){var _0x378b41=path[_0x245b('0x50')](_0x55070a,_0x245b('0x74')+_0x4972b1['id']+'-'+_0x3c371c+'.pdf');var _0xda48b1={'path':_0x378b41,'channel':'Whatsapp','interactionId':_0x4972b1['id']};return pdf[_0x245b('0x75')](_0x1306e0,_0xda48b1);})[_0x245b('0x1c')](function(){return new BPromise(function(_0x22f7b0,_0x40ddbe){zipdir(_0x55070a,{'saveTo':_0x3d83e8},function(_0x484e65,_0x32fa2a){if(_0x484e65)return _0x40ddbe(_0x484e65);return _0x22f7b0(_0x32fa2a);});})[_0x245b('0x1c')](function(){return new BPromise(function(_0x3b2ea5,_0x2315b6){rimraf(_0x55070a,function(_0x19305e){if(_0x19305e)_0x2315b6(_0x19305e);return _0x3b2ea5();});});})[_0x245b('0x1c')](function(){return _0x369dbf[_0x245b('0x76')](_0x3d83e8,_0x3d89ab,function(_0x448632){if(_0x448632){console['log'](_0x245b('0x77'),_0x448632);}else{fs[_0x245b('0x78')](_0x3d83e8);}});});});}else{return _0x369dbf[_0x245b('0x13')](0xc8);}})['catch'](handleError(_0x369dbf,null));}; \ No newline at end of file +var _0x7df7=['merge','find','create','body','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','limit','order','sort','where','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','disposition','basename','existsSync','createReadStream','createWriteStream','System','lastName','out','renderFile','views','.pdf','log','err','unlinkSync','rimraf','zip-dir','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7df7,0x1b9));var _0x77df=function(_0x26e2b6,_0xed0ac2){_0x26e2b6=_0x26e2b6-0x0;var _0x199157=_0x7df7[_0x26e2b6];return _0x199157;};'use strict';var rimraf=require(_0x77df('0x0'));var zipdir=require(_0x77df('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x77df('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x77df('0x3'));var Redis=require('ioredis');var interaction=require(_0x77df('0x4'));var qs=require(_0x77df('0x5'));var pdf=require(_0x77df('0x6'));var logger=require(_0x77df('0x7'))(_0x77df('0x8'));var config=require(_0x77df('0x9'));var db=require(_0x77df('0xa'))['db'];config[_0x77df('0xb')]=_[_0x77df('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x77df('0xd'))(new Redis(config[_0x77df('0xb')]));require(_0x77df('0xe'))[_0x77df('0xf')](socket);function respondWithStatusCode(_0x3b3790,_0x375b88){_0x375b88=_0x375b88||0xcc;return function(_0x5f0f3c){if(_0x5f0f3c){return _0x3b3790[_0x77df('0x10')](_0x375b88);}return _0x3b3790[_0x77df('0x11')](_0x375b88)[_0x77df('0x12')]();};}function respondWithResult(_0x5cb829,_0x46603d){_0x46603d=_0x46603d||0xc8;return function(_0x3215ec){if(_0x3215ec){return _0x5cb829[_0x77df('0x11')](_0x46603d)[_0x77df('0x13')](_0x3215ec);}};}function respondWithFilteredResult(_0x2ffa28,_0x23b1f8){return function(_0x411d1f){if(_0x411d1f){var _0x528754=typeof _0x23b1f8[_0x77df('0x14')]===_0x77df('0x15')&&typeof _0x23b1f8['limit']===_0x77df('0x15');var _0x42b7d1=_0x411d1f['count'];var _0x54b359=_0x528754?0x0:_0x23b1f8['offset'];var _0x5c500c=_0x528754?_0x411d1f[_0x77df('0x16')]:_0x23b1f8[_0x77df('0x14')]+_0x23b1f8['limit'];var _0x574706;if(_0x5c500c>=_0x42b7d1){_0x5c500c=_0x42b7d1;_0x574706=0xc8;}else{_0x574706=0xce;}_0x2ffa28['status'](_0x574706);return _0x2ffa28[_0x77df('0x17')](_0x77df('0x18'),_0x54b359+'-'+_0x5c500c+'/'+_0x42b7d1)[_0x77df('0x13')](_0x411d1f);}return null;};}function saveUpdates(_0x3da640){return function(_0x5b6019){if(_0x5b6019){return _0x5b6019[_0x77df('0x19')](_0x3da640)[_0x77df('0x1a')](function(_0xf61f5e){return _0xf61f5e;});}return null;};}function removeEntity(_0x30a274){return function(_0x227d93){if(_0x227d93){return _0x227d93['destroy']()[_0x77df('0x1a')](function(){_0x30a274['status'](0xcc)[_0x77df('0x12')]();});}};}function handleEntityNotFound(_0x1b8d97){return function(_0xd0e5aa){if(!_0xd0e5aa){_0x1b8d97['sendStatus'](0x194);}return _0xd0e5aa;};}function handleError(_0x36459f,_0x517825){_0x517825=_0x517825||0x1f4;return function(_0x3178c8){logger['error'](_0x3178c8['stack']);if(_0x3178c8[_0x77df('0x1b')]){delete _0x3178c8[_0x77df('0x1b')];}_0x36459f['status'](_0x517825)[_0x77df('0x1c')](_0x3178c8);};}exports[_0x77df('0x1d')]=function(_0x21987c,_0x1dc1cf){var _0x1a0649={};var _0x685ce1=_[_0x77df('0x1e')](db[_0x77df('0x1f')][_0x77df('0x20')],function(_0x5aa2b1){return{'name':_0x5aa2b1[_0x77df('0x21')],'type':_0x5aa2b1[_0x77df('0x22')]['key']};});_0x1a0649=qs[_0x77df('0x23')](_0x685ce1,_0x21987c);return interaction[_0x77df('0x24')](_0x77df('0x25'),_0x21987c[_0x77df('0x26')],_0x21987c['user'],_0x1a0649,_0x685ce1)[_0x77df('0x1a')](respondWithFilteredResult(_0x1dc1cf,_0x1a0649))[_0x77df('0x27')](handleError(_0x1dc1cf,null));};exports[_0x77df('0x28')]=function(_0x5c7622,_0x36a889){var _0x2bb591={'raw':![],'where':{'id':_0x5c7622[_0x77df('0x29')]['id']}},_0x33edda={};_0x33edda[_0x77df('0x2a')]=_[_0x77df('0x2b')](db[_0x77df('0x1f')][_0x77df('0x20')]);_0x33edda[_0x77df('0x26')]=_[_0x77df('0x2b')](_0x5c7622[_0x77df('0x26')]);_0x33edda[_0x77df('0x2c')]=_[_0x77df('0x2d')](_0x33edda[_0x77df('0x2a')],_0x33edda[_0x77df('0x26')]);_0x2bb591[_0x77df('0x2e')]=_[_0x77df('0x2d')](_0x33edda[_0x77df('0x2a')],qs['fields'](_0x5c7622[_0x77df('0x26')][_0x77df('0x2f')]));_0x2bb591[_0x77df('0x2e')]=_0x2bb591[_0x77df('0x2e')][_0x77df('0x30')]?_0x2bb591['attributes']:_0x33edda['model'];if(_0x5c7622[_0x77df('0x26')][_0x77df('0x31')]){_0x2bb591[_0x77df('0x32')]=[{'all':!![]}];}_0x2bb591=_[_0x77df('0x33')]({},_0x2bb591,_0x5c7622['options']);return db[_0x77df('0x1f')][_0x77df('0x34')](_0x2bb591)[_0x77df('0x1a')](handleEntityNotFound(_0x36a889,null))[_0x77df('0x1a')](respondWithResult(_0x36a889,null))[_0x77df('0x27')](handleError(_0x36a889,null));};exports[_0x77df('0x35')]=function(_0x134a69,_0x3afd25){return db[_0x77df('0x1f')][_0x77df('0x35')](_0x134a69[_0x77df('0x36')],{})['then'](respondWithResult(_0x3afd25,0xc9))[_0x77df('0x27')](handleError(_0x3afd25,null));};exports[_0x77df('0x19')]=function(_0xbce8c2,_0x2a3298){if(_0xbce8c2['body']['id']){delete _0xbce8c2[_0x77df('0x36')]['id'];}return db[_0x77df('0x1f')][_0x77df('0x34')]({'where':{'id':_0xbce8c2[_0x77df('0x29')]['id']}})[_0x77df('0x1a')](handleEntityNotFound(_0x2a3298,null))[_0x77df('0x1a')](saveUpdates(_0xbce8c2[_0x77df('0x36')],null))[_0x77df('0x1a')](respondWithResult(_0x2a3298,null))[_0x77df('0x27')](handleError(_0x2a3298,null));};exports[_0x77df('0x37')]=function(_0x3c0417,_0x2778f8){return db[_0x77df('0x1f')][_0x77df('0x34')]({'where':{'id':_0x3c0417[_0x77df('0x29')]['id']}})[_0x77df('0x1a')](handleEntityNotFound(_0x2778f8,null))[_0x77df('0x1a')](removeEntity(_0x2778f8,null))[_0x77df('0x27')](handleError(_0x2778f8,null));};exports[_0x77df('0x38')]=function(_0x396524,_0x32afdc){return db[_0x77df('0x1f')]['describe']()['then'](respondWithResult(_0x32afdc,null))[_0x77df('0x27')](handleError(_0x32afdc,null));};exports[_0x77df('0x39')]=function(_0x14f5ef,_0x55e7fc){return db[_0x77df('0x3a')][_0x77df('0x34')]({'where':{'id':_0x14f5ef[_0x77df('0x29')]['id']}})[_0x77df('0x1a')](handleEntityNotFound(_0x55e7fc,null))[_0x77df('0x1a')](function(_0x331786){if(_0x331786){return _0x331786[_0x77df('0x39')](_0x14f5ef[_0x77df('0x36')][_0x77df('0x3b')],_[_0x77df('0x3c')](_0x14f5ef[_0x77df('0x36')],['ids','id'])||{});}})[_0x77df('0x1a')](respondWithResult(_0x55e7fc,null))['catch'](handleError(_0x55e7fc,null));};exports[_0x77df('0x3d')]=function(_0x4e8f1c,_0x4b3956){var _0x3b2daa={'raw':![],'where':{}};var _0x20d057={};var _0x59f85e={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x77df('0x3e')]({'where':{'id':_0x4e8f1c[_0x77df('0x29')]['id']}})[_0x77df('0x1a')](handleEntityNotFound(_0x4b3956,null))[_0x77df('0x1a')](function(_0x4fca0e){if(_0x4fca0e){_0x20d057[_0x77df('0x2a')]=_[_0x77df('0x2b')](db[_0x77df('0x3a')][_0x77df('0x20')]);_0x20d057[_0x77df('0x26')]=_['keys'](_0x4e8f1c[_0x77df('0x26')]);_0x20d057[_0x77df('0x2c')]=_[_0x77df('0x2d')](_0x20d057[_0x77df('0x2a')],_0x20d057[_0x77df('0x26')]);_0x3b2daa[_0x77df('0x2e')]=_[_0x77df('0x2d')](_0x20d057[_0x77df('0x2a')],qs[_0x77df('0x2f')](_0x4e8f1c['query'][_0x77df('0x2f')]));_0x3b2daa[_0x77df('0x2e')]=_0x3b2daa['attributes']['length']?_0x3b2daa[_0x77df('0x2e')]:_0x20d057[_0x77df('0x2a')];if(!_0x4e8f1c[_0x77df('0x26')][_0x77df('0x3f')](_0x77df('0x40'))){_0x3b2daa['limit']=qs[_0x77df('0x41')](_0x4e8f1c[_0x77df('0x26')][_0x77df('0x41')]);_0x3b2daa['offset']=qs[_0x77df('0x14')](_0x4e8f1c['query']['offset']);}_0x3b2daa[_0x77df('0x42')]=qs[_0x77df('0x43')](_0x4e8f1c[_0x77df('0x26')][_0x77df('0x43')]);_0x3b2daa[_0x77df('0x44')]=qs[_0x77df('0x2c')](_[_0x77df('0x45')](_0x4e8f1c[_0x77df('0x26')],_0x20d057['filters']));_0x3b2daa[_0x77df('0x44')]['WhatsappInteractionId']=_0x4fca0e['id'];if(_0x4e8f1c['query']['filter']){_0x3b2daa['where']=_['merge'](_0x3b2daa['where'],{'$or':_[_0x77df('0x1e')](_0x3b2daa[_0x77df('0x2e')],function(_0x5295b0){var _0x1938e7={};_0x1938e7[_0x5295b0]={'$like':'%'+_0x4e8f1c[_0x77df('0x26')]['filter']+'%'};return _0x1938e7;})});}if(_0x4e8f1c[_0x77df('0x26')][_0x77df('0x46')]){var _0x57c2c6=_0x4e8f1c[_0x77df('0x26')][_0x77df('0x46')][_0x77df('0x47')](',');var _0x47644f={};_0x47644f[_0x57c2c6[0x0]]={'$gte':moment(_0x57c2c6[0x1])[_0x77df('0x48')](_0x77df('0x49'))};_0x3b2daa['where']=_[_0x77df('0x33')](_0x3b2daa[_0x77df('0x44')],_0x47644f);}_0x3b2daa=_['merge']({},_0x3b2daa,_0x4e8f1c[_0x77df('0x4a')]);return db[_0x77df('0x3a')][_0x77df('0x16')]({'where':_0x3b2daa['where']})[_0x77df('0x1a')](function(_0x30e7b6){_0x59f85e[_0x77df('0x16')]=_0x30e7b6;if(_0x4e8f1c['query'][_0x77df('0x31')]){_0x3b2daa['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x77df('0x24')](_0x3b2daa);})['then'](function(_0x198ff0){_0x59f85e[_0x77df('0x4b')]=_0x198ff0;return _0x59f85e;});}})[_0x77df('0x1a')](respondWithFilteredResult(_0x4b3956,_0x3b2daa))[_0x77df('0x27')](handleError(_0x4b3956,null));};exports[_0x77df('0x4c')]=function(_0x56387a,_0x560496){return db[_0x77df('0x1f')][_0x77df('0x34')]({'where':{'id':_0x56387a[_0x77df('0x29')]['id']}})[_0x77df('0x1a')](handleEntityNotFound(_0x560496,null))['then'](function(_0x287fa9){if(_0x287fa9){return _0x287fa9[_0x77df('0x4d')](_0x56387a[_0x77df('0x36')][_0x77df('0x3b')],_[_0x77df('0x3c')](_0x56387a[_0x77df('0x36')],[_0x77df('0x3b'),'id'])||{})[_0x77df('0x4e')](function(){return db[_0x77df('0x4f')][_0x77df('0x24')]({'attributes':['id',_0x77df('0x1b'),_0x77df('0x50')],'where':{'id':_0x56387a[_0x77df('0x36')][_0x77df('0x3b')]}});})['then'](function(_0xf88add){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x56387a[_0x77df('0x29')]['id']),'tags':_0xf88add||[]});return{'id':Number(_0x56387a[_0x77df('0x29')]['id']),'tags':_0xf88add||[]};});}})[_0x77df('0x1a')](respondWithResult(_0x560496,null))[_0x77df('0x27')](handleError(_0x560496,null));};exports[_0x77df('0x51')]=function(_0x1e0540,_0x2cdabb){return db[_0x77df('0x1f')]['find']({'where':{'id':_0x1e0540[_0x77df('0x29')]['id']}})['then'](handleEntityNotFound(_0x2cdabb,null))[_0x77df('0x1a')](function(_0xd1a46d){if(_0xd1a46d){return _0xd1a46d[_0x77df('0x51')](_0x1e0540[_0x77df('0x26')]['ids']);}})[_0x77df('0x1a')](respondWithStatusCode(_0x2cdabb,null))[_0x77df('0x27')](handleError(_0x2cdabb,null));};exports[_0x77df('0x52')]=function(_0x1e3812,_0x5313bf){var _0x3bc61a=moment()['unix']()[_0x77df('0x53')]();var _0x23648c=path[_0x77df('0x54')](config[_0x77df('0x55')],_0x77df('0x56'),_0x77df('0x57'),_0x77df('0x58'));var _0x324e26=path[_0x77df('0x54')](config[_0x77df('0x55')],'server',_0x77df('0x57'),_0x77df('0x59'));var _0x51f689=path[_0x77df('0x54')](_0x23648c,_0x3bc61a);var _0x466aaa=util[_0x77df('0x48')](_0x77df('0x5a'),_0x1e3812[_0x77df('0x29')]['id'],_0x3bc61a);var _0x5700e4=path[_0x77df('0x54')](_0x23648c,_0x466aaa);var _0x5f3278=[];_0x5f3278[_0x77df('0x5b')]({'model':db[_0x77df('0x5c')],'as':_0x77df('0x5c'),'attributes':['id',_0x77df('0x5d')],'raw':!![]});_0x5f3278[_0x77df('0x5b')]({'model':db[_0x77df('0x5e')],'as':_0x77df('0x5f'),'attributes':['id',_0x77df('0x60'),'lastName'],'raw':!![]});if(_0x1e3812[_0x77df('0x26')][_0x77df('0x59')]){_0x5f3278[_0x77df('0x5b')]({'model':db[_0x77df('0x61')],'as':_0x77df('0x61'),'raw':!![]});}var _0x476d99=[{'model':db['WhatsappMessage'],'as':_0x77df('0x62'),'attributes':['id',_0x77df('0x36'),_0x77df('0x63'),_0x77df('0x64'),_0x77df('0x65'),_0x77df('0x66')],'include':_0x5f3278}];_0x476d99[_0x77df('0x5b')]({'model':db[_0x77df('0x67')],'as':_0x77df('0x68'),'attributes':['id',_0x77df('0x1b')]});_0x476d99[_0x77df('0x5b')]({'model':db[_0x77df('0x5c')],'as':_0x77df('0x69'),'attributes':['id',_0x77df('0x5d')]});return db['WhatsappInteraction'][_0x77df('0x34')]({'where':{'id':_0x1e3812[_0x77df('0x29')]['id']},'include':_0x476d99})[_0x77df('0x1a')](handleEntityNotFound(_0x5313bf,null))[_0x77df('0x1a')](function(_0x24b49a){if(_0x24b49a){var _0x284f65=_0x24b49a[_0x77df('0x6a')]({'plain':!![]});fs['mkdirSync'](_0x51f689);var _0xb01d20={'channel':_0x77df('0x6b'),'account':_0x284f65[_0x77df('0x68')][_0x77df('0x1b')],'agent':_0x284f65[_0x77df('0x69')]?_0x284f65[_0x77df('0x69')][_0x77df('0x5d')]:_0x77df('0x6c'),'createdAt':moment(_0x284f65['createdAt'])[_0x77df('0x48')](_0x77df('0x49'))[_0x77df('0x53')](),'closedAt':_0x284f65['closed']?moment(_0x284f65['closedAt'])[_0x77df('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0x77df('0x53')]():'','disposition':_0x284f65[_0x77df('0x6d')],'messages':_(_0x284f65[_0x77df('0x62')])['filter']({'secret':![]})['map'](function(_0x226e3a){if(_0x226e3a['Attachment']){var _0x2d7fdd=path['join'](_0x324e26,_0x226e3a[_0x77df('0x61')][_0x77df('0x6e')]);if(fs[_0x77df('0x6f')](_0x2d7fdd)){fs[_0x77df('0x70')](_0x2d7fdd)['pipe'](fs[_0x77df('0x71')](path[_0x77df('0x54')](_0x51f689,_0x226e3a['Attachment'][_0x77df('0x6e')])));}}return{'date':moment(_0x226e3a['createdAt'])[_0x77df('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0x77df('0x53')](),'sender':_0x226e3a[_0x77df('0x64')]==='out'?_0x226e3a[_0x77df('0x5c')]?_0x226e3a['User'][_0x77df('0x5d')]:_0x77df('0x72'):_0x226e3a[_0x77df('0x5f')][_0x77df('0x60')]+(_0x226e3a[_0x77df('0x5f')][_0x77df('0x73')]?'\x20'+_0x226e3a[_0x77df('0x5f')][_0x77df('0x73')]:''),'body':_0x226e3a[_0x77df('0x61')]?_0x226e3a['Attachment']['basename']:_0x226e3a[_0x77df('0x36')],'direction':_0x226e3a[_0x77df('0x64')]===_0x77df('0x74')?'A':'C','secret':_0x226e3a[_0x77df('0x65')],'read':_0x226e3a['read'],'attachment':_0x226e3a[_0x77df('0x61')]};})['value']()};return ejs[_0x77df('0x75')](path[_0x77df('0x54')](config['root'],_0x77df('0x56'),_0x77df('0x76'),'downloadInteraction.ejs'),{'interaction':_0xb01d20})['then'](function(_0x20c365){var _0x1900ea=path[_0x77df('0x54')](_0x51f689,'transcript-'+_0x284f65['id']+'-'+_0x3bc61a+_0x77df('0x77'));var _0x27e4f9={'path':_0x1900ea,'channel':'Whatsapp','interactionId':_0x284f65['id']};return pdf['createPdfFromHTML'](_0x20c365,_0x27e4f9);})[_0x77df('0x1a')](function(){return new BPromise(function(_0x5e2d34,_0x57b071){zipdir(_0x51f689,{'saveTo':_0x5700e4},function(_0x20409a,_0xba2548){if(_0x20409a)return _0x57b071(_0x20409a);return _0x5e2d34(_0xba2548);});})[_0x77df('0x1a')](function(){return new BPromise(function(_0x3e0801,_0x399062){rimraf(_0x51f689,function(_0x4fc637){if(_0x4fc637)_0x399062(_0x4fc637);return _0x3e0801();});});})[_0x77df('0x1a')](function(){return _0x5313bf[_0x77df('0x52')](_0x5700e4,_0x466aaa,function(_0x304d06){if(_0x304d06){console[_0x77df('0x78')](_0x77df('0x79'),_0x304d06);}else{fs[_0x77df('0x7a')](_0x5700e4);}});});});}else{return _0x5313bf[_0x77df('0x10')](0xc8);}})['catch'](handleError(_0x5313bf,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index bbd001e..ca3bc83 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 _0x570f=['WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','Users','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x488907,_0x77df86){var _0x3944f0=function(_0x118784){while(--_0x118784){_0x488907['push'](_0x488907['shift']());}};_0x3944f0(++_0x77df86);}(_0x570f,0x152));var _0xf570=function(_0x5545f7,_0x570414){_0x5545f7=_0x5545f7-0x0;var _0x52a979=_0x570f[_0x5545f7];return _0x52a979;};'use strict';var EventEmitter=require(_0xf570('0x0'));var WhatsappInteraction=require(_0xf570('0x1'))['db'][_0xf570('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf570('0x3')](0x0);var events={'afterCreate':_0xf570('0x4'),'afterUpdate':_0xf570('0x5'),'afterDestroy':_0xf570('0x6')};function emitEvent(_0x140bb4){return function(_0x1cb206,_0x5b8c89,_0x5ce063){_0x1cb206[_0xf570('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x37d1c8){_0x1cb206['setDataValue'](_0xf570('0x8'),_0x37d1c8['map'](function(_0x350a32){return{'id':_0x350a32['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1cb206['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf570('0x9')](function(_0x375e35){_0x1cb206[_0xf570('0xa')](_0xf570('0xb'),_0x375e35[_0xf570('0xc')]);WhatsappInteractionEvents['emit'](_0x140bb4+':'+_0x1cb206['id'],_0x1cb206);WhatsappInteractionEvents[_0xf570('0xd')](_0x140bb4,_0x1cb206);_0x5ce063(null);})[_0xf570('0xe')](_0x5ce063(null));};}for(var e in events){if(events[_0xf570('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf570('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x87ae=['findAll','setDataValue','unreadMessages','length','emit','catch','exports','WhatsappInteraction','setMaxListeners','save','update','then','Users','map'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x87ae,0xf5));var _0xe87a=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x87ae[_0x456fb1];return _0x4083d6;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0xe87a('0x0')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe87a('0x1')](0x0);var events={'afterCreate':_0xe87a('0x2'),'afterUpdate':_0xe87a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x28899c){return function(_0x1fa362,_0x1820dc,_0x5ef978){_0x1fa362['getUsers']({'attributes':['id'],'raw':!![]})[_0xe87a('0x4')](function(_0x2fbd6b){_0x1fa362['setDataValue'](_0xe87a('0x5'),_0x2fbd6b[_0xe87a('0x6')](function(_0x48873f){return{'id':_0x48873f['id']};}));return WhatsappMessage[_0xe87a('0x7')]({'where':{'WhatsappInteractionId':_0x1fa362['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe87a('0x4')](function(_0x499cb8){_0x1fa362[_0xe87a('0x8')](_0xe87a('0x9'),_0x499cb8[_0xe87a('0xa')]);WhatsappInteractionEvents[_0xe87a('0xb')](_0x28899c+':'+_0x1fa362['id'],_0x1fa362);WhatsappInteractionEvents[_0xe87a('0xb')](_0x28899c,_0x1fa362);_0x5ef978(null);})[_0xe87a('0xc')](_0x5ef978(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xe87a('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 331aa12..d2fa679 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 _0xac3c=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format'];(function(_0x441ee1,_0x388cf4){var _0x246f95=function(_0x32f25c){while(--_0x32f25c){_0x441ee1['push'](_0x441ee1['shift']());}};_0x246f95(++_0x388cf4);}(_0xac3c,0xe0));var _0xcac3=function(_0x3f931e,_0x1b84e7){_0x3f931e=_0x3f931e-0x0;var _0x4a3106=_0xac3c[_0x3f931e];return _0x4a3106;};'use strict';var _=require(_0xcac3('0x0'));var util=require(_0xcac3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcac3('0x2'));var rp=require(_0xcac3('0x3'));var fs=require('fs');var path=require(_0xcac3('0x4'));var rimraf=require(_0xcac3('0x5'));var config=require(_0xcac3('0x6'));var attributes=require(_0xcac3('0x7'));module[_0xcac3('0x8')]=function(_0x5948fd,_0x2222fb){return _0x5948fd['define'](_0xcac3('0x9'),attributes,{'tableName':_0xcac3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15516d,_0x439488,_0x5e451f){if(_0x15516d['changed'](_0xcac3('0xb'))){_0x15516d[_0xcac3('0xc')]=moment()[_0xcac3('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5e451f(null,_0x15516d);}}});}; \ No newline at end of file +var _0x0f97=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','lodash','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0f97,0x196));var _0x70f9=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x0f97[_0x2181fc];return _0x315da1;};'use strict';var _=require(_0x70f9('0x0'));var util=require(_0x70f9('0x1'));var logger=require(_0x70f9('0x2'))(_0x70f9('0x3'));var moment=require(_0x70f9('0x4'));var BPromise=require(_0x70f9('0x5'));var rp=require(_0x70f9('0x6'));var fs=require('fs');var path=require(_0x70f9('0x7'));var rimraf=require(_0x70f9('0x8'));var config=require(_0x70f9('0x9'));var attributes=require(_0x70f9('0xa'));module['exports']=function(_0x4dafa5,_0x37d6a7){return _0x4dafa5[_0x70f9('0xb')](_0x70f9('0xc'),attributes,{'tableName':_0x70f9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59933c,_0x523d32,_0x140eec){if(_0x59933c[_0x70f9('0xe')](_0x70f9('0xf'))){_0x59933c[_0x70f9('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x140eec(null,_0x59933c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 562677d..49544d8 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 _0xbb79=['raw','where','UpdateWhatsappInteraction','stringify','find','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','update','body','options'];(function(_0x37ce3e,_0x248d3d){var _0x506bef=function(_0x2b8292){while(--_0x2b8292){_0x37ce3e['push'](_0x37ce3e['shift']());}};_0x506bef(++_0x248d3d);}(_0xbb79,0x1e9));var _0x9bb7=function(_0x530b82,_0x2872ba){_0x530b82=_0x530b82-0x0;var _0x5da464=_0xbb79[_0x530b82];return _0x5da464;};'use strict';var _=require(_0x9bb7('0x0'));var util=require(_0x9bb7('0x1'));var moment=require(_0x9bb7('0x2'));var BPromise=require(_0x9bb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bb7('0x5'));var logger=require(_0x9bb7('0x6'))(_0x9bb7('0x7'));var config=require(_0x9bb7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9bb7('0x9')][_0x9bb7('0xa')]({'port':0x232a});config[_0x9bb7('0xb')]=_['defaults'](config[_0x9bb7('0xb')],{'host':_0x9bb7('0xc'),'port':0x18eb});var socket=require(_0x9bb7('0xd'))(new Redis(config[_0x9bb7('0xb')]));require('./whatsappInteraction.socket')[_0x9bb7('0xe')](socket);function respondWithRpcPromise(_0x456ddc,_0xb60d66,_0x371e58){return new BPromise(function(_0x5bb805,_0x1a0fe8){return client['request'](_0x456ddc,_0x371e58)[_0x9bb7('0xf')](function(_0x5622bf){logger[_0x9bb7('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0xb60d66,_0x9bb7('0x11'));logger[_0x9bb7('0x12')](_0x9bb7('0x13'),_0xb60d66,_0x9bb7('0x11'),JSON['stringify'](_0x5622bf));if(_0x5622bf[_0x9bb7('0x14')]){if(_0x5622bf[_0x9bb7('0x14')][_0x9bb7('0x15')]===0x1f4){logger['error'](_0x9bb7('0x16'),_0xb60d66,_0x5622bf[_0x9bb7('0x14')]['message']);return _0x1a0fe8(_0x5622bf[_0x9bb7('0x14')][_0x9bb7('0x17')]);}logger[_0x9bb7('0x14')](_0x9bb7('0x16'),_0xb60d66,_0x5622bf['error'][_0x9bb7('0x17')]);return _0x5bb805(_0x5622bf[_0x9bb7('0x14')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xb60d66,_0x9bb7('0x11'));_0x5bb805(_0x5622bf[_0x9bb7('0x18')][_0x9bb7('0x17')]);}})[_0x9bb7('0x19')](function(_0x3aec48){logger[_0x9bb7('0x14')](_0x9bb7('0x16'),_0xb60d66,_0x3aec48);_0x1a0fe8(_0x3aec48);});});}exports['UpdateWhatsappInteraction']=function(_0x2ae5ad){var _0x47c44c=this;return new Promise(function(_0x5e0016,_0xa3ea3c){return db['WhatsappInteraction'][_0x9bb7('0x1a')](_0x2ae5ad[_0x9bb7('0x1b')],{'raw':_0x2ae5ad[_0x9bb7('0x1c')]?_0x2ae5ad[_0x9bb7('0x1c')][_0x9bb7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ae5ad[_0x9bb7('0x1c')]?_0x2ae5ad[_0x9bb7('0x1c')][_0x9bb7('0x1e')]||null:null,'attributes':_0x2ae5ad[_0x9bb7('0x1c')]?_0x2ae5ad[_0x9bb7('0x1c')]['attributes']||null:null,'limit':_0x2ae5ad[_0x9bb7('0x1c')]?_0x2ae5ad[_0x9bb7('0x1c')]['limit']||null:null})[_0x9bb7('0xf')](function(_0x45815f){logger[_0x9bb7('0x10')](_0x9bb7('0x1f'),_0x2ae5ad);logger[_0x9bb7('0x12')]('UpdateWhatsappInteraction',_0x2ae5ad,JSON[_0x9bb7('0x20')](_0x45815f));_0x5e0016(_0x45815f);})[_0x9bb7('0x19')](function(_0xbf70fe){logger['error']('UpdateWhatsappInteraction',_0xbf70fe[_0x9bb7('0x17')],_0x2ae5ad);_0xa3ea3c(_0x47c44c[_0x9bb7('0x14')](0x1f4,_0xbf70fe[_0x9bb7('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3fcae2){return new Promise(function(_0x4c03a6,_0x4b232a){return db['WhatsappInteraction'][_0x9bb7('0x21')]({'where':_0x3fcae2['options']?_0x3fcae2[_0x9bb7('0x1c')][_0x9bb7('0x1e')]||null:null})[_0x9bb7('0xf')](function(_0x571661){if(_0x571661){return _0x571661['addTags'](_0x3fcae2[_0x9bb7('0x1b')][_0x9bb7('0x22')],_['omit'](_0x3fcae2[_0x9bb7('0x1b')],[_0x9bb7('0x22'),'id'])||{});}})[_0x9bb7('0x23')](function(_0x55a3b4){logger['info'](_0x9bb7('0x24'),_0x3fcae2);logger[_0x9bb7('0x12')]('AddTags',_0x3fcae2,JSON[_0x9bb7('0x20')](_0x55a3b4));_0x4c03a6(_0x55a3b4);})[_0x9bb7('0x19')](function(_0x18c124){logger[_0x9bb7('0x14')](_0x9bb7('0x24'),_0x18c124[_0x9bb7('0x17')],_0x3fcae2);_0x4b232a(_this['error'](0x1f4,_0x18c124['message']));});});}; \ No newline at end of file +var _0xbd81=['limit','AddTagsToWhatsappInteraction','find','where','body','ids','AddTags','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes'];(function(_0x13a102,_0x7f6c67){var _0x3a37d2=function(_0x418744){while(--_0x418744){_0x13a102['push'](_0x13a102['shift']());}};_0x3a37d2(++_0x7f6c67);}(_0xbd81,0x126));var _0x1bd8=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xbd81[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x1bd8('0x0'));var moment=require(_0x1bd8('0x1'));var BPromise=require(_0x1bd8('0x2'));var rs=require(_0x1bd8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1bd8('0x4'));var logger=require(_0x1bd8('0x5'))('rpc');var config=require(_0x1bd8('0x6'));var jayson=require(_0x1bd8('0x7'));var client=jayson[_0x1bd8('0x8')][_0x1bd8('0x9')]({'port':0x232a});config['redis']=_[_0x1bd8('0xa')](config[_0x1bd8('0xb')],{'host':_0x1bd8('0xc'),'port':0x18eb});var socket=require(_0x1bd8('0xd'))(new Redis(config[_0x1bd8('0xb')]));require(_0x1bd8('0xe'))[_0x1bd8('0xf')](socket);function respondWithRpcPromise(_0x422a09,_0x29f5ea,_0x27ab1e){return new BPromise(function(_0x121468,_0x372a36){return client[_0x1bd8('0x10')](_0x422a09,_0x27ab1e)[_0x1bd8('0x11')](function(_0x3a468f){logger[_0x1bd8('0x12')](_0x1bd8('0x13'),_0x29f5ea,_0x1bd8('0x14'));logger[_0x1bd8('0x15')](_0x1bd8('0x16'),_0x29f5ea,_0x1bd8('0x14'),JSON['stringify'](_0x3a468f));if(_0x3a468f['error']){if(_0x3a468f[_0x1bd8('0x17')][_0x1bd8('0x18')]===0x1f4){logger[_0x1bd8('0x17')](_0x1bd8('0x13'),_0x29f5ea,_0x3a468f[_0x1bd8('0x17')][_0x1bd8('0x19')]);return _0x372a36(_0x3a468f[_0x1bd8('0x17')][_0x1bd8('0x19')]);}logger['error'](_0x1bd8('0x13'),_0x29f5ea,_0x3a468f['error'][_0x1bd8('0x19')]);return _0x121468(_0x3a468f[_0x1bd8('0x17')][_0x1bd8('0x19')]);}else{logger[_0x1bd8('0x12')](_0x1bd8('0x13'),_0x29f5ea,_0x1bd8('0x14'));_0x121468(_0x3a468f[_0x1bd8('0x1a')]['message']);}})[_0x1bd8('0x1b')](function(_0x66954){logger[_0x1bd8('0x17')](_0x1bd8('0x13'),_0x29f5ea,_0x66954);_0x372a36(_0x66954);});});}exports[_0x1bd8('0x1c')]=function(_0x4721e7){var _0xd3d852=this;return new Promise(function(_0x20ff0b,_0x11f098){return db[_0x1bd8('0x1d')][_0x1bd8('0x1e')](_0x4721e7['body'],{'raw':_0x4721e7[_0x1bd8('0x1f')]?_0x4721e7[_0x1bd8('0x1f')][_0x1bd8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4721e7[_0x1bd8('0x1f')]?_0x4721e7[_0x1bd8('0x1f')]['where']||null:null,'attributes':_0x4721e7[_0x1bd8('0x1f')]?_0x4721e7[_0x1bd8('0x1f')][_0x1bd8('0x21')]||null:null,'limit':_0x4721e7[_0x1bd8('0x1f')]?_0x4721e7[_0x1bd8('0x1f')][_0x1bd8('0x22')]||null:null})[_0x1bd8('0x11')](function(_0x19bf9d){logger['info'](_0x1bd8('0x1c'),_0x4721e7);logger[_0x1bd8('0x15')](_0x1bd8('0x1c'),_0x4721e7,JSON['stringify'](_0x19bf9d));_0x20ff0b(_0x19bf9d);})[_0x1bd8('0x1b')](function(_0x2c6f04){logger[_0x1bd8('0x17')](_0x1bd8('0x1c'),_0x2c6f04[_0x1bd8('0x19')],_0x4721e7);_0x11f098(_0xd3d852['error'](0x1f4,_0x2c6f04[_0x1bd8('0x19')]));});});};exports[_0x1bd8('0x23')]=function(_0x3f8b49){return new Promise(function(_0x10ecef,_0x90e70){return db[_0x1bd8('0x1d')][_0x1bd8('0x24')]({'where':_0x3f8b49[_0x1bd8('0x1f')]?_0x3f8b49[_0x1bd8('0x1f')][_0x1bd8('0x25')]||null:null})[_0x1bd8('0x11')](function(_0x532552){if(_0x532552){return _0x532552['addTags'](_0x3f8b49[_0x1bd8('0x26')][_0x1bd8('0x27')],_['omit'](_0x3f8b49[_0x1bd8('0x26')],[_0x1bd8('0x27'),'id'])||{});}})['spread'](function(_0x23f3f6){logger[_0x1bd8('0x12')]('AddTags',_0x3f8b49);logger['debug']('AddTags',_0x3f8b49,JSON['stringify'](_0x23f3f6));_0x10ecef(_0x23f3f6);})[_0x1bd8('0x1b')](function(_0x51cb2e){logger[_0x1bd8('0x17')](_0x1bd8('0x28'),_0x51cb2e[_0x1bd8('0x19')],_0x3f8b49);_0x90e70(_this[_0x1bd8('0x17')](0x1f4,_0x51cb2e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 70be413..ae5c9ef 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 _0x1011=['removeListener','register','length','./whatsappInteraction.events','remove','update'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x1011,0xf9));var _0x1101=function(_0x4a5531,_0xe35c69){_0x4a5531=_0x4a5531-0x0;var _0xd8670f=_0x1011[_0x4a5531];return _0xd8670f;};'use strict';var WhatsappInteractionEvents=require(_0x1101('0x0'));var events=['save',_0x1101('0x1'),_0x1101('0x2')];function createListener(_0x407319,_0x42cdc6){return function(_0x1ae7be){_0x42cdc6['emit'](_0x407319,_0x1ae7be);};}function removeListener(_0x4e21b2,_0x2b0993){return function(){WhatsappInteractionEvents[_0x1101('0x3')](_0x4e21b2,_0x2b0993);};}exports[_0x1101('0x4')]=function(_0x6b1a09){for(var _0x412aff=0x0,_0x132dd1=events[_0x1101('0x5')];_0x412aff<_0x132dd1;_0x412aff++){var _0x1289d4=events[_0x412aff];var _0x4b20e1=createListener('whatsappInteraction:'+_0x1289d4,_0x6b1a09);WhatsappInteractionEvents['on'](_0x1289d4,_0x4b20e1);}}; \ No newline at end of file +var _0xa004=['emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','update'];(function(_0x29a289,_0x95a026){var _0x47e6af=function(_0x34e18a){while(--_0x34e18a){_0x29a289['push'](_0x29a289['shift']());}};_0x47e6af(++_0x95a026);}(_0xa004,0x7d));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0x4a00('0x0'));var events=[_0x4a00('0x1'),'remove',_0x4a00('0x2')];function createListener(_0x171613,_0x3dc877){return function(_0x5905c7){_0x3dc877[_0x4a00('0x3')](_0x171613,_0x5905c7);};}function removeListener(_0x54099c,_0x1e9fbb){return function(){WhatsappInteractionEvents[_0x4a00('0x4')](_0x54099c,_0x1e9fbb);};}exports[_0x4a00('0x5')]=function(_0x2c422a){for(var _0x5f82c3=0x0,_0x40efbd=events[_0x4a00('0x6')];_0x5f82c3<_0x40efbd;_0x5f82c3++){var _0x1ac233=events[_0x5f82c3];var _0x48ffa4=createListener(_0x4a00('0x7')+_0x1ac233,_0x2c422a);WhatsappInteractionEvents['on'](_0x1ac233,_0x48ffa4);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 002b12c..d25e817 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 _0x1aec=['update','/:id/accept','accept','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','whatsapp','whatsappmessage:create','create','status'];(function(_0x3629a7,_0x30f27e){var _0x1c0eaa=function(_0x10d900){while(--_0x10d900){_0x3629a7['push'](_0x3629a7['shift']());}};_0x1c0eaa(++_0x30f27e);}(_0x1aec,0x133));var _0xc1ae=function(_0x5a831c,_0x23ac4c){_0x5a831c=_0x5a831c-0x0;var _0x561f75=_0x1aec[_0x5a831c];return _0x561f75;};'use strict';var multer=require(_0xc1ae('0x0'));var util=require(_0xc1ae('0x1'));var path=require('path');var timeout=require(_0xc1ae('0x2'));var express=require('express');var router=express[_0xc1ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc1ae('0x4'));var interaction=require(_0xc1ae('0x5'));var config=require('../../config/environment');var controller=require(_0xc1ae('0x6'));router[_0xc1ae('0x7')]('/',auth[_0xc1ae('0x8')](),controller[_0xc1ae('0x9')]);router[_0xc1ae('0x7')](_0xc1ae('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xc1ae('0x7')](_0xc1ae('0xb'),auth[_0xc1ae('0x8')](),controller[_0xc1ae('0xc')]);router[_0xc1ae('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xc1ae('0xe'),_0xc1ae('0xf')),controller[_0xc1ae('0x10')]);router[_0xc1ae('0xd')]('/:id/status',controller[_0xc1ae('0x11')]);router['put'](_0xc1ae('0xb'),auth['isAuthenticated'](),controller[_0xc1ae('0x12')]);router['put'](_0xc1ae('0x13'),auth[_0xc1ae('0x8')](),controller[_0xc1ae('0x14')]);router[_0xc1ae('0x15')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xc1ae('0x16')](_0xc1ae('0xb'),auth['isAuthenticated'](),controller[_0xc1ae('0x17')]);module[_0xc1ae('0x18')]=router; \ No newline at end of file +var _0x4d5c=['whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked'];(function(_0xd76d8b,_0x12f713){var _0xf75e5e=function(_0x5c253f){while(--_0x5c253f){_0xd76d8b['push'](_0xd76d8b['shift']());}};_0xf75e5e(++_0x12f713);}(_0x4d5c,0xfd));var _0xc4d5=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x4d5c[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0xc4d5('0x0'));var util=require(_0xc4d5('0x1'));var path=require(_0xc4d5('0x2'));var timeout=require(_0xc4d5('0x3'));var express=require(_0xc4d5('0x4'));var router=express['Router']();var fs_extra=require(_0xc4d5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc4d5('0x6'));var config=require(_0xc4d5('0x7'));var controller=require(_0xc4d5('0x8'));router[_0xc4d5('0x9')]('/',auth[_0xc4d5('0xa')](),controller[_0xc4d5('0xb')]);router[_0xc4d5('0x9')]('/describe',auth[_0xc4d5('0xa')](),controller[_0xc4d5('0xc')]);router[_0xc4d5('0x9')](_0xc4d5('0xd'),auth[_0xc4d5('0xa')](),controller[_0xc4d5('0xe')]);router[_0xc4d5('0xf')]('/',auth['isAuthenticated'](),interaction[_0xc4d5('0x10')](_0xc4d5('0x11'),_0xc4d5('0x12')),controller[_0xc4d5('0x13')]);router['post'](_0xc4d5('0x14'),controller[_0xc4d5('0x15')]);router[_0xc4d5('0x16')](_0xc4d5('0xd'),auth['isAuthenticated'](),controller[_0xc4d5('0x17')]);router[_0xc4d5('0x16')](_0xc4d5('0x18'),auth[_0xc4d5('0xa')](),controller[_0xc4d5('0x19')]);router[_0xc4d5('0x16')](_0xc4d5('0x1a'),auth[_0xc4d5('0xa')](),controller[_0xc4d5('0x1b')]);router[_0xc4d5('0x1c')](_0xc4d5('0xd'),auth[_0xc4d5('0xa')](),controller[_0xc4d5('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 0e39f60..de5c8d8 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 _0xe024=['DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out','STRING'];(function(_0xbb7f4,_0x3f7a58){var _0x179011=function(_0x4d5d57){while(--_0x4d5d57){_0xbb7f4['push'](_0xbb7f4['shift']());}};_0x179011(++_0x3f7a58);}(_0xe024,0x161));var _0x4e02=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0xe024[_0x454e6d];return _0x4bc294;};'use strict';var Sequelize=require(_0x4e02('0x0'));module[_0x4e02('0x1')]={'body':{'type':Sequelize[_0x4e02('0x2')](_0x4e02('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e02('0x4')]('in',_0x4e02('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x4e02('0x6')]},'readAt':{'type':Sequelize[_0x4e02('0x7')]},'secret':{'type':Sequelize[_0x4e02('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4e02('0x6')]},'providerResponse':{'type':Sequelize[_0x4e02('0x2')]}}; \ No newline at end of file +var _0x37c7=['TEXT','sequelize','exports','BOOLEAN','out','STRING','DATE'];(function(_0x53f86f,_0xf17560){var _0xa58ab1=function(_0x20e6b4){while(--_0x20e6b4){_0x53f86f['push'](_0x53f86f['shift']());}};_0xa58ab1(++_0xf17560);}(_0x37c7,0x1cf));var _0x737c=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0x37c7[_0x2212d1];return _0x15eec5;};'use strict';var Sequelize=require(_0x737c('0x0'));module[_0x737c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x737c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x737c('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x737c('0x4')]},'readAt':{'type':Sequelize[_0x737c('0x5')]},'secret':{'type':Sequelize[_0x737c('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x737c('0x4')]},'providerResponse':{'type':Sequelize[_0x737c('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 105813b..56c5ed7 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 _0xc7da=['ejs','fs-extra','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','end','sendStatus','name','index','WhatsappMessage','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','rawAttributes','merge','create','body','update','find','destroy','params','describe','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','User','email','internal','manual','channel','motionChannel','event','accept','EventManager','whatsapp-interactions','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','Sequelize','QueryTypes','SELECT','fullname','SIP/%s','reject','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox'];(function(_0x321a60,_0x56ee66){var _0x330f44=function(_0x46456f){while(--_0x46456f){_0x321a60['push'](_0x321a60['shift']());}};_0x330f44(++_0x56ee66);}(_0xc7da,0x196));var _0xac7d=function(_0x3245ee,_0x2d02ba){_0x3245ee=_0x3245ee-0x0;var _0x5c5547=_0xc7da[_0x3245ee];return _0x5c5547;};'use strict';var emlformat=require(_0xac7d('0x0'));var rimraf=require(_0xac7d('0x1'));var zipdir=require(_0xac7d('0x2'));var jsonpatch=require(_0xac7d('0x3'));var rp=require('request-promise');var moment=require(_0xac7d('0x4'));var BPromise=require(_0xac7d('0x5'));var Mustache=require('mustache');var util=require(_0xac7d('0x6'));var path=require('path');var sox=require(_0xac7d('0x7'));var csv=require('to-csv');var ejs=require(_0xac7d('0x8'));var fs=require('fs');var fs_extra=require(_0xac7d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac7d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xac7d('0xb'));var querystring=require('querystring');var Papa=require(_0xac7d('0xc'));var Redis=require(_0xac7d('0xd'));var authService=require(_0xac7d('0xe'));var qs=require(_0xac7d('0xf'));var as=require(_0xac7d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac7d('0x11'))(_0xac7d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xac7d('0x13'));var db=require(_0xac7d('0x14'))['db'];config[_0xac7d('0x15')]=_[_0xac7d('0x16')](config[_0xac7d('0x15')],{'host':_0xac7d('0x17'),'port':0x18eb});var socket=require(_0xac7d('0x18'))(new Redis(config[_0xac7d('0x15')]));require(_0xac7d('0x19'))[_0xac7d('0x1a')](socket);var jayson=require(_0xac7d('0x1b'));var client=jayson[_0xac7d('0x1c')][_0xac7d('0x1d')]({'port':0x232c});var client9002=jayson[_0xac7d('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5488,_0x5cba9c,_0x1707ef,_0x233bba){return new BPromise(function(_0xdc5e3e,_0x181125){var _0x5ada24=_0x233bba||client;return _0x5ada24[_0xac7d('0x1e')](_0x4b5488,_0x1707ef)[_0xac7d('0x1f')](function(_0x2502d2){logger[_0xac7d('0x20')](_0xac7d('0x21'),_0x5cba9c,_0xac7d('0x22'));logger['debug'](_0xac7d('0x23'),_0x5cba9c,_0xac7d('0x22'),JSON[_0xac7d('0x24')](_0x2502d2));if(_0x2502d2[_0xac7d('0x25')]){if(_0x2502d2['error'][_0xac7d('0x26')]===0x1f4){logger[_0xac7d('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x5cba9c,_0x2502d2['error'][_0xac7d('0x27')]);return _0x181125(_0x2502d2[_0xac7d('0x25')][_0xac7d('0x27')]);}logger[_0xac7d('0x25')](_0xac7d('0x21'),_0x5cba9c,_0x2502d2[_0xac7d('0x25')][_0xac7d('0x27')]);return _0xdc5e3e(_0x2502d2[_0xac7d('0x25')][_0xac7d('0x27')]);}else{logger[_0xac7d('0x20')](_0xac7d('0x21'),_0x5cba9c,_0xac7d('0x22'));_0xdc5e3e(_0x2502d2[_0xac7d('0x28')]['message']);}})[_0xac7d('0x29')](function(_0x3e28e5){logger[_0xac7d('0x25')](_0xac7d('0x21'),_0x5cba9c,_0x3e28e5);_0x181125(_0x3e28e5);});});}function respondWithStatusCode(_0x20caea,_0x2caefe){_0x2caefe=_0x2caefe||0xcc;return function(_0x3e0653){if(_0x3e0653){return _0x20caea['sendStatus'](_0x2caefe);}return _0x20caea[_0xac7d('0x2a')](_0x2caefe)['end']();};}function respondWithResult(_0x404dfb,_0x1d1c27){_0x1d1c27=_0x1d1c27||0xc8;return function(_0x39e119){if(_0x39e119){return _0x404dfb[_0xac7d('0x2a')](_0x1d1c27)[_0xac7d('0x2b')](_0x39e119);}};}function respondWithFilteredResult(_0x47b608,_0x1f3717){return function(_0x4c4892){if(_0x4c4892){var _0x3cf762=typeof _0x1f3717['offset']===_0xac7d('0x2c')&&typeof _0x1f3717[_0xac7d('0x2d')]==='undefined';var _0xaeed2a=_0x4c4892[_0xac7d('0x2e')];var _0xba1cb6=_0x3cf762?0x0:_0x1f3717[_0xac7d('0x2f')];var _0x44fda9=_0x3cf762?_0x4c4892[_0xac7d('0x2e')]:_0x1f3717[_0xac7d('0x2f')]+_0x1f3717[_0xac7d('0x2d')];var _0xb6e903;if(_0x44fda9>=_0xaeed2a){_0x44fda9=_0xaeed2a;_0xb6e903=0xc8;}else{_0xb6e903=0xce;}_0x47b608[_0xac7d('0x2a')](_0xb6e903);return _0x47b608[_0xac7d('0x30')](_0xac7d('0x31'),_0xba1cb6+'-'+_0x44fda9+'/'+_0xaeed2a)[_0xac7d('0x2b')](_0x4c4892);}return null;};}function patchUpdates(_0xba92f){return function(_0x18c449){try{jsonpatch[_0xac7d('0x32')](_0x18c449,_0xba92f,!![]);}catch(_0x30179b){return BPromise['reject'](_0x30179b);}return _0x18c449[_0xac7d('0x33')]();};}function saveUpdates(_0x5a1bfa,_0x164699){return function(_0x5d7729){if(_0x5d7729){return _0x5d7729['update'](_0x5a1bfa)[_0xac7d('0x1f')](function(_0x521b49){return _0x521b49;});}return null;};}function removeEntity(_0x4b7e76,_0x15e986){return function(_0x44f85e){if(_0x44f85e){return _0x44f85e['destroy']()[_0xac7d('0x1f')](function(){_0x4b7e76[_0xac7d('0x2a')](0xcc)[_0xac7d('0x34')]();});}};}function handleEntityNotFound(_0x5e7773,_0x2be469){return function(_0x4b7fee){if(!_0x4b7fee){_0x5e7773[_0xac7d('0x35')](0x194);}return _0x4b7fee;};}function handleError(_0x3404db,_0x4a6fa4){_0x4a6fa4=_0x4a6fa4||0x1f4;return function(_0x1e736d){logger[_0xac7d('0x25')](_0x1e736d['stack']);if(_0x1e736d[_0xac7d('0x36')]){delete _0x1e736d[_0xac7d('0x36')];}_0x3404db['status'](_0x4a6fa4)['send'](_0x1e736d);};}exports[_0xac7d('0x37')]=function(_0x360c26,_0xdbdfd1){var _0x39bee7={},_0x2aa795={},_0x337e23={'count':0x0,'rows':[]};var _0x59eb1f=_['map'](db[_0xac7d('0x38')]['rawAttributes'],function(_0x47ed23){return{'name':_0x47ed23['fieldName'],'type':_0x47ed23[_0xac7d('0x39')][_0xac7d('0x3a')]};});_0x2aa795[_0xac7d('0x3b')]=_[_0xac7d('0x3c')](_0x59eb1f,_0xac7d('0x36'));_0x2aa795['query']=_[_0xac7d('0x3d')](_0x360c26[_0xac7d('0x3e')]);_0x2aa795[_0xac7d('0x3f')]=_[_0xac7d('0x40')](_0x2aa795['model'],_0x2aa795[_0xac7d('0x3e')]);_0x39bee7[_0xac7d('0x41')]=_[_0xac7d('0x40')](_0x2aa795['model'],qs[_0xac7d('0x42')](_0x360c26['query'][_0xac7d('0x42')]));_0x39bee7[_0xac7d('0x41')]=_0x39bee7[_0xac7d('0x41')][_0xac7d('0x43')]?_0x39bee7[_0xac7d('0x41')]:_0x2aa795['model'];if(!_0x360c26['query'][_0xac7d('0x44')]('nolimit')){_0x39bee7['limit']=qs['limit'](_0x360c26[_0xac7d('0x3e')][_0xac7d('0x2d')]);_0x39bee7[_0xac7d('0x2f')]=qs[_0xac7d('0x2f')](_0x360c26[_0xac7d('0x3e')][_0xac7d('0x2f')]);}_0x39bee7[_0xac7d('0x45')]=qs['sort'](_0x360c26['query'][_0xac7d('0x46')]);_0x39bee7[_0xac7d('0x47')]=qs[_0xac7d('0x3f')](_[_0xac7d('0x48')](_0x360c26[_0xac7d('0x3e')],_0x2aa795['filters']),_0x59eb1f);if(_0x360c26[_0xac7d('0x3e')][_0xac7d('0x49')]){_0x39bee7[_0xac7d('0x47')]=_['merge'](_0x39bee7[_0xac7d('0x47')],{'$or':_[_0xac7d('0x3c')](_0x59eb1f,function(_0x219d21){if(_0x219d21[_0xac7d('0x39')]!==_0xac7d('0x4a')){var _0x4795e8={};_0x4795e8[_0x219d21[_0xac7d('0x36')]]={'$like':'%'+_0x360c26[_0xac7d('0x3e')]['filter']+'%'};return _0x4795e8;}})});}_0x39bee7=_['merge']({},_0x39bee7,_0x360c26[_0xac7d('0x4b')]);var _0x31d458={'where':_0x39bee7[_0xac7d('0x47')]};return db['WhatsappMessage'][_0xac7d('0x2e')](_0x31d458)[_0xac7d('0x1f')](function(_0x44bc82){_0x337e23[_0xac7d('0x2e')]=_0x44bc82;if(_0x360c26['query'][_0xac7d('0x4c')]){_0x39bee7[_0xac7d('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xac7d('0x4e')](_0x39bee7);})[_0xac7d('0x1f')](function(_0x57eca3){_0x337e23['rows']=_0x57eca3;return _0x337e23;})[_0xac7d('0x1f')](respondWithFilteredResult(_0xdbdfd1,_0x39bee7))[_0xac7d('0x29')](handleError(_0xdbdfd1,null));};exports[_0xac7d('0x4f')]=function(_0x5de8c4,_0x224a63){var _0x12a9a6={'raw':!![],'where':{'id':_0x5de8c4['params']['id']}},_0x4cd1a6={};_0x4cd1a6[_0xac7d('0x3b')]=_[_0xac7d('0x3d')](db[_0xac7d('0x38')][_0xac7d('0x50')]);_0x4cd1a6['query']=_[_0xac7d('0x3d')](_0x5de8c4[_0xac7d('0x3e')]);_0x4cd1a6['filters']=_[_0xac7d('0x40')](_0x4cd1a6[_0xac7d('0x3b')],_0x4cd1a6[_0xac7d('0x3e')]);_0x12a9a6[_0xac7d('0x41')]=_['intersection'](_0x4cd1a6['model'],qs[_0xac7d('0x42')](_0x5de8c4['query']['fields']));_0x12a9a6[_0xac7d('0x41')]=_0x12a9a6[_0xac7d('0x41')][_0xac7d('0x43')]?_0x12a9a6['attributes']:_0x4cd1a6[_0xac7d('0x3b')];if(_0x5de8c4[_0xac7d('0x3e')]['includeAll']){_0x12a9a6[_0xac7d('0x4d')]=[{'all':!![]}];}_0x12a9a6=_[_0xac7d('0x51')]({},_0x12a9a6,_0x5de8c4[_0xac7d('0x4b')]);return db[_0xac7d('0x38')]['find'](_0x12a9a6)[_0xac7d('0x1f')](handleEntityNotFound(_0x224a63,null))[_0xac7d('0x1f')](respondWithResult(_0x224a63,null))[_0xac7d('0x29')](handleError(_0x224a63,null));};exports[_0xac7d('0x52')]=function(_0x37ec38,_0x2b45b2){return db[_0xac7d('0x38')][_0xac7d('0x52')](_0x37ec38[_0xac7d('0x53')],{})['then'](respondWithResult(_0x2b45b2,0xc9))[_0xac7d('0x29')](handleError(_0x2b45b2,null));};exports[_0xac7d('0x54')]=function(_0x43b194,_0x50239f){if(_0x43b194[_0xac7d('0x53')]['id']){delete _0x43b194[_0xac7d('0x53')]['id'];}return db['WhatsappMessage'][_0xac7d('0x55')]({'where':{'id':_0x43b194['params']['id']}})[_0xac7d('0x1f')](handleEntityNotFound(_0x50239f,null))['then'](saveUpdates(_0x43b194[_0xac7d('0x53')],null))[_0xac7d('0x1f')](respondWithResult(_0x50239f,null))[_0xac7d('0x29')](handleError(_0x50239f,null));};exports[_0xac7d('0x56')]=function(_0xad7ad8,_0x11bd2b){return db[_0xac7d('0x38')][_0xac7d('0x55')]({'where':{'id':_0xad7ad8[_0xac7d('0x57')]['id']}})[_0xac7d('0x1f')](handleEntityNotFound(_0x11bd2b,null))[_0xac7d('0x1f')](removeEntity(_0x11bd2b,null))[_0xac7d('0x29')](handleError(_0x11bd2b,null));};exports[_0xac7d('0x58')]=function(_0x3e7909,_0x35db9c){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x35db9c,null))[_0xac7d('0x29')](handleError(_0x35db9c,null));};var interaction_log=require(_0xac7d('0x11'))('whatsapp-interactions');exports['accept']=function(_0x58a8f4,_0x2fbb47,_0x6a263b){var _0x275b92={'agent':{},'channel':_0xac7d('0x59')};if(_0x58a8f4[_0xac7d('0x53')]['id']){delete _0x58a8f4[_0xac7d('0x53')]['id'];}_0x58a8f4[_0xac7d('0x53')][_0xac7d('0x5a')]=!![];_0x58a8f4[_0xac7d('0x53')][_0xac7d('0x5b')]=moment()['format'](_0xac7d('0x5c'));_0x58a8f4[_0xac7d('0x53')][_0xac7d('0x5d')]=_0x58a8f4[_0xac7d('0x53')][_0xac7d('0x5d')]||_0x58a8f4[_0xac7d('0x5e')]['id'];_0x275b92[_0xac7d('0x5f')]['id']=_0x58a8f4['body'][_0xac7d('0x5d')];return db[_0xac7d('0x38')][_0xac7d('0x55')]({'where':{'id':_0x58a8f4[_0xac7d('0x57')]['id'],'UserId':null}})[_0xac7d('0x1f')](handleEntityNotFound(_0x2fbb47,null))['then'](saveUpdates(_0x58a8f4[_0xac7d('0x53')],null))[_0xac7d('0x1f')](function(_0x1f8f2e){if(_0x1f8f2e){_0x275b92[_0xac7d('0x27')]=_0x1f8f2e[_0xac7d('0x60')]({'plain':!![]});return db[_0xac7d('0x61')][_0xac7d('0x55')]({'where':{'id':_0x1f8f2e['WhatsappInteractionId']}});}return null;})[_0xac7d('0x1f')](handleEntityNotFound(_0x2fbb47,null))[_0xac7d('0x1f')](function(_0x1d624b){if(_0x1d624b){return _0x1d624b[_0xac7d('0x54')]({'UserId':_0x58a8f4[_0xac7d('0x53')][_0xac7d('0x5d')],'read1stAt':_[_0xac7d('0x62')](_0x1d624b[_0xac7d('0x63')])?moment()[_0xac7d('0x64')](_0xac7d('0x5c')):undefined});}return null;})[_0xac7d('0x1f')](function(_0x5b822b){if(_0x5b822b){_0x275b92[_0xac7d('0x65')]=_0x5b822b[_0xac7d('0x60')]({'plain':!![]});interaction_log[_0xac7d('0x20')](_0xac7d('0x66'),_0x58a8f4['user']['id'],_0x58a8f4[_0xac7d('0x5e')][_0xac7d('0x36')],_0x58a8f4[_0xac7d('0x5e')][_0xac7d('0x67')],_0x275b92[_0xac7d('0x65')]['id'],_0x58a8f4['body']?JSON['stringify'](_0x58a8f4[_0xac7d('0x53')]):'null');return respondWithRpcPromise(_0xac7d('0x68'),_0xac7d('0x69'),_0x275b92);}return null;})[_0xac7d('0x1f')](function(_0x43d065){var _0x2fe77c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x43d065[_0xac7d('0x27')][_0xac7d('0x6a')];return db[_0xac7d('0x6b')]['query'](_0x2fe77c,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xac7d('0x1f')](function(_0x1ec03c){return _0x1ec03c;});})[_0xac7d('0x1f')](function(_0xfa1775){if(_0xfa1775){_0x275b92['message']['contact']=_0xfa1775[0x0];if(!_0x58a8f4[_0xac7d('0x53')][_0xac7d('0x5d')])return;return db[_0xac7d('0x6c')][_0xac7d('0x55')]({'where':{'id':_0x58a8f4['body'][_0xac7d('0x5d')],'role':_0xac7d('0x5f')},'attributes':['id',_0xac7d('0x36'),'fullname',_0xac7d('0x6d'),_0xac7d('0x6e')],'raw':!![]});}return null;})[_0xac7d('0x1f')](function(_0x557520){if(!_0x557520)return null;_0x275b92['message'][_0xac7d('0x5f')]=_0x557520;return _0x275b92;})[_0xac7d('0x1f')](function(_0x209ae0){if(_0x209ae0){if(_0x58a8f4[_0xac7d('0x53')][_0xac7d('0x6f')]){_0x275b92[_0xac7d('0x27')]['interface']=util['format']('SIP/%s',_0x58a8f4[_0xac7d('0x5e')][_0xac7d('0x36')]);_0x275b92['message']['channel']=_0x275b92[_0xac7d('0x70')];_0x275b92[_0xac7d('0x27')][_0xac7d('0x71')]=_0x275b92[_0xac7d('0x70')];_0x275b92['message'][_0xac7d('0x72')]=_0xac7d('0x73');return respondWithRpcPromise(_0xac7d('0x74'),_0xac7d('0x74'),{'event':'acceptmessage','message':_0x275b92['message']},client9002)['then'](function(){return _0x275b92;});}return _0x275b92;}return null;})[_0xac7d('0x1f')](respondWithResult(_0x2fbb47,null))[_0xac7d('0x29')](handleError(_0x2fbb47,null));};var interaction_log=require(_0xac7d('0x11'))(_0xac7d('0x75'));exports['reject']=function(_0x43ad62,_0x55f5cb,_0x57e2d3){var _0x5deed1={'agent':{},'channel':_0xac7d('0x59')};if(_0x43ad62[_0xac7d('0x53')]['id']){delete _0x43ad62[_0xac7d('0x53')]['id'];}_0x43ad62[_0xac7d('0x53')]['UserId']=_0x43ad62[_0xac7d('0x53')][_0xac7d('0x5d')]||_0x43ad62[_0xac7d('0x5e')]['id'];_0x5deed1[_0xac7d('0x5f')]['id']=_0x43ad62[_0xac7d('0x53')]['UserId'];return db[_0xac7d('0x38')][_0xac7d('0x55')]({'where':{'id':_0x43ad62[_0xac7d('0x57')]['id'],'UserId':null}})[_0xac7d('0x1f')](handleEntityNotFound(_0x55f5cb,null))[_0xac7d('0x1f')](function(_0x5caa3f){if(_0x5caa3f){_0x5deed1[_0xac7d('0x27')]=_0x5caa3f[_0xac7d('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0xac7d('0x55')]({'where':{'id':_0x5caa3f[_0xac7d('0x76')]}});}return null;})[_0xac7d('0x1f')](handleEntityNotFound(_0x55f5cb,null))[_0xac7d('0x1f')](function(_0x435954){if(_0x435954){_0x5deed1['interaction']=_0x435954['get']({'plain':!![]});interaction_log[_0xac7d('0x20')](_0xac7d('0x77'),_0x43ad62[_0xac7d('0x5e')]['id'],_0x43ad62[_0xac7d('0x5e')][_0xac7d('0x36')],_0x43ad62[_0xac7d('0x5e')]['role'],_0x5deed1['interaction']['id'],_0x43ad62['body']?JSON['stringify'](_0x43ad62['body']):_0xac7d('0x78'));return respondWithRpcPromise(_0xac7d('0x79'),'rejectMessage',_0x5deed1);}return null;})[_0xac7d('0x1f')](function(_0x3b0784){var _0x59aeeb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3b0784[_0xac7d('0x27')][_0xac7d('0x6a')];return db['sequelize'][_0xac7d('0x3e')](_0x59aeeb,{'type':db[_0xac7d('0x7a')][_0xac7d('0x7b')][_0xac7d('0x7c')],'raw':!![]})[_0xac7d('0x1f')](function(_0x1f2820){return _0x1f2820;});})[_0xac7d('0x1f')](function(_0x2dd05c){if(_0x2dd05c){_0x5deed1[_0xac7d('0x27')]['contact']=_0x2dd05c[0x0];if(!_0x43ad62[_0xac7d('0x53')][_0xac7d('0x5d')])return;return db[_0xac7d('0x6c')]['find']({'where':{'id':_0x43ad62[_0xac7d('0x53')][_0xac7d('0x5d')],'role':'agent'},'attributes':['id',_0xac7d('0x36'),_0xac7d('0x7d'),_0xac7d('0x6d'),_0xac7d('0x6e')],'raw':!![]});}return null;})[_0xac7d('0x1f')](function(_0x4316b8){if(!_0x4316b8)return null;_0x5deed1[_0xac7d('0x27')][_0xac7d('0x5f')]=_0x4316b8;return _0x5deed1;})['then'](function(_0x1e0d2d){if(_0x1e0d2d){_0x1e0d2d[_0xac7d('0x27')]['interface']=util[_0xac7d('0x64')](_0xac7d('0x7e'),_0x43ad62[_0xac7d('0x5e')]['name']);_0x1e0d2d[_0xac7d('0x27')][_0xac7d('0x70')]=_0x5deed1[_0xac7d('0x70')];_0x1e0d2d[_0xac7d('0x27')][_0xac7d('0x71')]=_0x5deed1['channel'];_0x1e0d2d[_0xac7d('0x27')][_0xac7d('0x72')]=_0xac7d('0x7f');respondWithRpcPromise(_0xac7d('0x74'),_0xac7d('0x74'),{'event':_0xac7d('0x80'),'message':_0x1e0d2d[_0xac7d('0x27')]},client9002);return _0x5deed1;}return null;})[_0xac7d('0x1f')](respondWithResult(_0x55f5cb,null))[_0xac7d('0x29')](handleError(_0x55f5cb,null));};exports[_0xac7d('0x2a')]=function(_0x163b02,_0x2c8393,_0x3be682){if(_0x163b02[_0xac7d('0x53')]['id']){delete _0x163b02[_0xac7d('0x53')]['id'];}var _0x257ec4;return db[_0xac7d('0x38')][_0xac7d('0x55')]({'where':{'id':_0x163b02[_0xac7d('0x57')]['id']}})[_0xac7d('0x1f')](handleEntityNotFound(_0x2c8393,null))[_0xac7d('0x1f')](function(_0x1a3cd7){if(_0x1a3cd7){_0x257ec4=_0x1a3cd7;return db['WhatsappAccount']['find']({'where':{'id':_0x1a3cd7[_0xac7d('0x81')]}});}})[_0xac7d('0x1f')](handleEntityNotFound(_0x2c8393,null))['then'](function(_0x219a4d){if(_0x219a4d){logger[_0xac7d('0x82')](_0xac7d('0x83'),'status','received\x20delivery\x20report\x20from',_0x219a4d[_0xac7d('0x39')],util[_0xac7d('0x84')](_0x163b02['body'],{'showHidden':![],'depth':null}));switch(_0x219a4d['type']){case _0xac7d('0x85'):if(_0x163b02[_0xac7d('0x53')][_0xac7d('0x86')]&&_0x163b02[_0xac7d('0x53')][_0xac7d('0x86')]===_0x257ec4[_0xac7d('0x87')]&&_0x163b02['body']['MessageStatus']&&_0x163b02[_0xac7d('0x53')][_0xac7d('0x88')]==='read'){return _0x257ec4['update']({'read':!![]});}else{logger[_0xac7d('0x25')](_0xac7d('0x89'),_0xac7d('0x2a'),_0xac7d('0x85'),util[_0xac7d('0x84')](_0x163b02[_0xac7d('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x257ec4;}})[_0xac7d('0x1f')](respondWithResult(_0x2c8393,null))['catch'](handleError(_0x2c8393,null));}; \ No newline at end of file +var _0x5e90=['accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','isNil','read1stAt','format','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','email','reject','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','length','options','find','create','body','params','describe','whatsapp-interactions'];(function(_0x3ef27d,_0x382a13){var _0x5e40df=function(_0x4a31b0){while(--_0x4a31b0){_0x3ef27d['push'](_0x3ef27d['shift']());}};_0x5e40df(++_0x382a13);}(_0x5e90,0x1dc));var _0x05e9=function(_0x3064f4,_0x5aa5e2){_0x3064f4=_0x3064f4-0x0;var _0x5649a3=_0x5e90[_0x3064f4];return _0x5649a3;};'use strict';var emlformat=require(_0x05e9('0x0'));var rimraf=require(_0x05e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05e9('0x2'));var rp=require(_0x05e9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x05e9('0x4'));var util=require(_0x05e9('0x5'));var path=require(_0x05e9('0x6'));var sox=require(_0x05e9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x05e9('0x8'));var crypto=require('crypto');var jsforce=require(_0x05e9('0x9'));var deskjs=require(_0x05e9('0xa'));var toCsv=require(_0x05e9('0xb'));var querystring=require(_0x05e9('0xc'));var Papa=require(_0x05e9('0xd'));var Redis=require(_0x05e9('0xe'));var authService=require(_0x05e9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x05e9('0x10'));var hardwareService=require(_0x05e9('0x11'));var logger=require(_0x05e9('0x12'))(_0x05e9('0x13'));var utils=require(_0x05e9('0x14'));var config=require(_0x05e9('0x15'));var licenseUtil=require(_0x05e9('0x16'));var db=require(_0x05e9('0x17'))['db'];config['redis']=_['defaults'](config[_0x05e9('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05e9('0x18')]));require(_0x05e9('0x19'))[_0x05e9('0x1a')](socket);var jayson=require(_0x05e9('0x1b'));var client=jayson[_0x05e9('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x05e9('0x1c')][_0x05e9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x304520,_0x2edd35,_0x436213,_0x2f3575){return new BPromise(function(_0xd74ed3,_0x3a1621){var _0x11c49d=_0x2f3575||client;return _0x11c49d['request'](_0x304520,_0x436213)[_0x05e9('0x1e')](function(_0x136338){logger[_0x05e9('0x1f')](_0x05e9('0x20'),_0x2edd35,'request\x20sent');logger[_0x05e9('0x21')](_0x05e9('0x22'),_0x2edd35,_0x05e9('0x23'),JSON[_0x05e9('0x24')](_0x136338));if(_0x136338[_0x05e9('0x25')]){if(_0x136338[_0x05e9('0x25')][_0x05e9('0x26')]===0x1f4){logger[_0x05e9('0x25')](_0x05e9('0x20'),_0x2edd35,_0x136338[_0x05e9('0x25')]['message']);return _0x3a1621(_0x136338[_0x05e9('0x25')]['message']);}logger[_0x05e9('0x25')](_0x05e9('0x20'),_0x2edd35,_0x136338['error'][_0x05e9('0x27')]);return _0xd74ed3(_0x136338['error']['message']);}else{logger[_0x05e9('0x1f')](_0x05e9('0x20'),_0x2edd35,'request\x20sent');_0xd74ed3(_0x136338[_0x05e9('0x28')][_0x05e9('0x27')]);}})['catch'](function(_0x1794df){logger['error'](_0x05e9('0x20'),_0x2edd35,_0x1794df);_0x3a1621(_0x1794df);});});}function respondWithStatusCode(_0x80af9d,_0x345d4a){_0x345d4a=_0x345d4a||0xcc;return function(_0x17deb1){if(_0x17deb1){return _0x80af9d[_0x05e9('0x29')](_0x345d4a);}return _0x80af9d['status'](_0x345d4a)[_0x05e9('0x2a')]();};}function respondWithResult(_0x30cac6,_0x589729){_0x589729=_0x589729||0xc8;return function(_0x122d4f){if(_0x122d4f){return _0x30cac6[_0x05e9('0x2b')](_0x589729)[_0x05e9('0x2c')](_0x122d4f);}};}function respondWithFilteredResult(_0x348a3f,_0x4453db){return function(_0x255260){if(_0x255260){var _0x568038=typeof _0x4453db[_0x05e9('0x2d')]===_0x05e9('0x2e')&&typeof _0x4453db['limit']===_0x05e9('0x2e');var _0x2a4daf=_0x255260[_0x05e9('0x2f')];var _0x25b558=_0x568038?0x0:_0x4453db['offset'];var _0x21b5f1=_0x568038?_0x255260[_0x05e9('0x2f')]:_0x4453db['offset']+_0x4453db[_0x05e9('0x30')];var _0x59536d;if(_0x21b5f1>=_0x2a4daf){_0x21b5f1=_0x2a4daf;_0x59536d=0xc8;}else{_0x59536d=0xce;}_0x348a3f[_0x05e9('0x2b')](_0x59536d);return _0x348a3f[_0x05e9('0x31')](_0x05e9('0x32'),_0x25b558+'-'+_0x21b5f1+'/'+_0x2a4daf)[_0x05e9('0x2c')](_0x255260);}return null;};}function patchUpdates(_0x2daf2a){return function(_0x3032eb){try{jsonpatch[_0x05e9('0x33')](_0x3032eb,_0x2daf2a,!![]);}catch(_0x177638){return BPromise['reject'](_0x177638);}return _0x3032eb['save']();};}function saveUpdates(_0x8dfeb5,_0x50a017){return function(_0x1f834e){if(_0x1f834e){return _0x1f834e[_0x05e9('0x34')](_0x8dfeb5)[_0x05e9('0x1e')](function(_0x58d8b8){return _0x58d8b8;});}return null;};}function removeEntity(_0x1eb798,_0x3a8c21){return function(_0xd70780){if(_0xd70780){return _0xd70780[_0x05e9('0x35')]()[_0x05e9('0x1e')](function(){_0x1eb798['status'](0xcc)[_0x05e9('0x2a')]();});}};}function handleEntityNotFound(_0x413c16,_0x5d3ce6){return function(_0x36909b){if(!_0x36909b){_0x413c16[_0x05e9('0x29')](0x194);}return _0x36909b;};}function handleError(_0x391b81,_0x44c99f){_0x44c99f=_0x44c99f||0x1f4;return function(_0x38e96c){logger[_0x05e9('0x25')](_0x38e96c[_0x05e9('0x36')]);if(_0x38e96c[_0x05e9('0x37')]){delete _0x38e96c['name'];}_0x391b81['status'](_0x44c99f)[_0x05e9('0x38')](_0x38e96c);};}exports[_0x05e9('0x39')]=function(_0x440954,_0x3cff9b){var _0x32751e={},_0x167b64={},_0x58348b={'count':0x0,'rows':[]};var _0x579292=_[_0x05e9('0x3a')](db[_0x05e9('0x3b')][_0x05e9('0x3c')],function(_0xd6c60a){return{'name':_0xd6c60a[_0x05e9('0x3d')],'type':_0xd6c60a[_0x05e9('0x3e')][_0x05e9('0x3f')]};});_0x167b64['model']=_[_0x05e9('0x3a')](_0x579292,_0x05e9('0x37'));_0x167b64[_0x05e9('0x40')]=_[_0x05e9('0x41')](_0x440954[_0x05e9('0x40')]);_0x167b64[_0x05e9('0x42')]=_[_0x05e9('0x43')](_0x167b64[_0x05e9('0x44')],_0x167b64[_0x05e9('0x40')]);_0x32751e[_0x05e9('0x45')]=_[_0x05e9('0x43')](_0x167b64['model'],qs['fields'](_0x440954[_0x05e9('0x40')][_0x05e9('0x46')]));_0x32751e[_0x05e9('0x45')]=_0x32751e[_0x05e9('0x45')]['length']?_0x32751e['attributes']:_0x167b64[_0x05e9('0x44')];if(!_0x440954[_0x05e9('0x40')][_0x05e9('0x47')]('nolimit')){_0x32751e[_0x05e9('0x30')]=qs[_0x05e9('0x30')](_0x440954[_0x05e9('0x40')][_0x05e9('0x30')]);_0x32751e[_0x05e9('0x2d')]=qs[_0x05e9('0x2d')](_0x440954[_0x05e9('0x40')][_0x05e9('0x2d')]);}_0x32751e[_0x05e9('0x48')]=qs[_0x05e9('0x49')](_0x440954[_0x05e9('0x40')]['sort']);_0x32751e['where']=qs[_0x05e9('0x42')](_[_0x05e9('0x4a')](_0x440954['query'],_0x167b64[_0x05e9('0x42')]),_0x579292);if(_0x440954[_0x05e9('0x40')][_0x05e9('0x4b')]){_0x32751e[_0x05e9('0x4c')]=_[_0x05e9('0x4d')](_0x32751e['where'],{'$or':_['map'](_0x579292,function(_0x6e667d){if(_0x6e667d[_0x05e9('0x3e')]!==_0x05e9('0x4e')){var _0x3f051d={};_0x3f051d[_0x6e667d[_0x05e9('0x37')]]={'$like':'%'+_0x440954[_0x05e9('0x40')][_0x05e9('0x4b')]+'%'};return _0x3f051d;}})});}_0x32751e=_[_0x05e9('0x4d')]({},_0x32751e,_0x440954['options']);var _0xe2a121={'where':_0x32751e[_0x05e9('0x4c')]};return db[_0x05e9('0x3b')][_0x05e9('0x2f')](_0xe2a121)[_0x05e9('0x1e')](function(_0x5a6ec3){_0x58348b[_0x05e9('0x2f')]=_0x5a6ec3;if(_0x440954['query']['includeAll']){_0x32751e[_0x05e9('0x4f')]=[{'all':!![]}];}return db[_0x05e9('0x3b')][_0x05e9('0x50')](_0x32751e);})[_0x05e9('0x1e')](function(_0x39c7a5){_0x58348b[_0x05e9('0x51')]=_0x39c7a5;return _0x58348b;})['then'](respondWithFilteredResult(_0x3cff9b,_0x32751e))[_0x05e9('0x52')](handleError(_0x3cff9b,null));};exports[_0x05e9('0x53')]=function(_0x55eab3,_0x124604){var _0x506e64={'raw':!![],'where':{'id':_0x55eab3['params']['id']}},_0x12f8b={};_0x12f8b[_0x05e9('0x44')]=_[_0x05e9('0x41')](db[_0x05e9('0x3b')][_0x05e9('0x3c')]);_0x12f8b['query']=_[_0x05e9('0x41')](_0x55eab3[_0x05e9('0x40')]);_0x12f8b[_0x05e9('0x42')]=_['intersection'](_0x12f8b['model'],_0x12f8b['query']);_0x506e64['attributes']=_[_0x05e9('0x43')](_0x12f8b[_0x05e9('0x44')],qs[_0x05e9('0x46')](_0x55eab3[_0x05e9('0x40')][_0x05e9('0x46')]));_0x506e64['attributes']=_0x506e64[_0x05e9('0x45')][_0x05e9('0x54')]?_0x506e64[_0x05e9('0x45')]:_0x12f8b[_0x05e9('0x44')];if(_0x55eab3[_0x05e9('0x40')]['includeAll']){_0x506e64['include']=[{'all':!![]}];}_0x506e64=_[_0x05e9('0x4d')]({},_0x506e64,_0x55eab3[_0x05e9('0x55')]);return db[_0x05e9('0x3b')][_0x05e9('0x56')](_0x506e64)[_0x05e9('0x1e')](handleEntityNotFound(_0x124604,null))[_0x05e9('0x1e')](respondWithResult(_0x124604,null))[_0x05e9('0x52')](handleError(_0x124604,null));};exports[_0x05e9('0x57')]=function(_0x4040f7,_0xf99977){return db[_0x05e9('0x3b')][_0x05e9('0x57')](_0x4040f7[_0x05e9('0x58')],{})[_0x05e9('0x1e')](respondWithResult(_0xf99977,0xc9))[_0x05e9('0x52')](handleError(_0xf99977,null));};exports[_0x05e9('0x34')]=function(_0x4e9cb1,_0x247736){if(_0x4e9cb1[_0x05e9('0x58')]['id']){delete _0x4e9cb1[_0x05e9('0x58')]['id'];}return db[_0x05e9('0x3b')][_0x05e9('0x56')]({'where':{'id':_0x4e9cb1['params']['id']}})[_0x05e9('0x1e')](handleEntityNotFound(_0x247736,null))[_0x05e9('0x1e')](saveUpdates(_0x4e9cb1['body'],null))[_0x05e9('0x1e')](respondWithResult(_0x247736,null))[_0x05e9('0x52')](handleError(_0x247736,null));};exports[_0x05e9('0x35')]=function(_0x1a4622,_0x5140b3){return db['WhatsappMessage']['find']({'where':{'id':_0x1a4622[_0x05e9('0x59')]['id']}})[_0x05e9('0x1e')](handleEntityNotFound(_0x5140b3,null))['then'](removeEntity(_0x5140b3,null))[_0x05e9('0x52')](handleError(_0x5140b3,null));};exports[_0x05e9('0x5a')]=function(_0x1571a8,_0x100d5a){return db[_0x05e9('0x3b')][_0x05e9('0x5a')]()[_0x05e9('0x1e')](respondWithResult(_0x100d5a,null))[_0x05e9('0x52')](handleError(_0x100d5a,null));};var interaction_log=require(_0x05e9('0x12'))(_0x05e9('0x5b'));exports[_0x05e9('0x5c')]=function(_0x1c806a,_0x173fc0,_0x5b430e){var _0x34d9c9={'agent':{},'channel':_0x05e9('0x5d')};if(_0x1c806a['body']['id']){delete _0x1c806a[_0x05e9('0x58')]['id'];}_0x1c806a[_0x05e9('0x58')][_0x05e9('0x5e')]=!![];_0x1c806a[_0x05e9('0x58')][_0x05e9('0x5f')]=moment()['format'](_0x05e9('0x60'));_0x1c806a['body'][_0x05e9('0x61')]=_0x1c806a['body']['UserId']||_0x1c806a[_0x05e9('0x62')]['id'];_0x34d9c9[_0x05e9('0x63')]['id']=_0x1c806a[_0x05e9('0x58')]['UserId'];return db[_0x05e9('0x3b')][_0x05e9('0x56')]({'where':{'id':_0x1c806a[_0x05e9('0x59')]['id'],'UserId':null}})[_0x05e9('0x1e')](handleEntityNotFound(_0x173fc0,null))[_0x05e9('0x1e')](saveUpdates(_0x1c806a[_0x05e9('0x58')],null))[_0x05e9('0x1e')](function(_0x5494e5){if(_0x5494e5){_0x34d9c9['message']=_0x5494e5['get']({'plain':!![]});return db['WhatsappInteraction'][_0x05e9('0x56')]({'where':{'id':_0x5494e5[_0x05e9('0x64')]}});}return null;})[_0x05e9('0x1e')](handleEntityNotFound(_0x173fc0,null))['then'](function(_0x29ef80){if(_0x29ef80){return _0x29ef80[_0x05e9('0x34')]({'UserId':_0x1c806a['body'][_0x05e9('0x61')],'read1stAt':_[_0x05e9('0x65')](_0x29ef80[_0x05e9('0x66')])?moment()[_0x05e9('0x67')](_0x05e9('0x60')):undefined});}return null;})[_0x05e9('0x1e')](function(_0x50f8f8){if(_0x50f8f8){_0x34d9c9['interaction']=_0x50f8f8[_0x05e9('0x68')]({'plain':!![]});interaction_log[_0x05e9('0x1f')](_0x05e9('0x69'),_0x1c806a[_0x05e9('0x62')]['id'],_0x1c806a[_0x05e9('0x62')][_0x05e9('0x37')],_0x1c806a[_0x05e9('0x62')][_0x05e9('0x6a')],_0x34d9c9[_0x05e9('0x6b')]['id'],_0x1c806a['body']?JSON[_0x05e9('0x24')](_0x1c806a['body']):_0x05e9('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x05e9('0x6d'),_0x34d9c9);}return null;})[_0x05e9('0x1e')](function(_0x1bfa5d){var _0x1805aa=_0x05e9('0x6e')+_0x1bfa5d['message'][_0x05e9('0x6f')];return db[_0x05e9('0x70')][_0x05e9('0x40')](_0x1805aa,{'type':db['Sequelize'][_0x05e9('0x71')][_0x05e9('0x72')],'raw':!![]})[_0x05e9('0x1e')](function(_0xf5b479){return _0xf5b479;});})[_0x05e9('0x1e')](function(_0x241725){if(_0x241725){_0x34d9c9[_0x05e9('0x27')][_0x05e9('0x73')]=_0x241725[0x0];if(!_0x1c806a[_0x05e9('0x58')][_0x05e9('0x61')])return;return db['User'][_0x05e9('0x56')]({'where':{'id':_0x1c806a[_0x05e9('0x58')][_0x05e9('0x61')],'role':_0x05e9('0x63')},'attributes':['id',_0x05e9('0x37'),_0x05e9('0x74'),'email',_0x05e9('0x75')],'raw':!![]});}return null;})[_0x05e9('0x1e')](function(_0xea0dd0){if(!_0xea0dd0)return null;_0x34d9c9[_0x05e9('0x27')][_0x05e9('0x63')]=_0xea0dd0;return _0x34d9c9;})[_0x05e9('0x1e')](function(_0x1d1632){if(_0x1d1632){if(_0x1c806a[_0x05e9('0x58')][_0x05e9('0x76')]){_0x34d9c9[_0x05e9('0x27')]['interface']=util['format'](_0x05e9('0x77'),_0x1c806a['user'][_0x05e9('0x37')]);_0x34d9c9['message'][_0x05e9('0x78')]=_0x34d9c9['channel'];_0x34d9c9[_0x05e9('0x27')][_0x05e9('0x79')]=_0x34d9c9[_0x05e9('0x78')];_0x34d9c9[_0x05e9('0x27')][_0x05e9('0x7a')]=_0x05e9('0x5c');return respondWithRpcPromise(_0x05e9('0x7b'),_0x05e9('0x7b'),{'event':_0x05e9('0x7c'),'message':_0x34d9c9[_0x05e9('0x27')]},client9002)['then'](function(){return _0x34d9c9;});}return _0x34d9c9;}return null;})['then'](respondWithResult(_0x173fc0,null))[_0x05e9('0x52')](handleError(_0x173fc0,null));};var interaction_log=require('../../config/logger')(_0x05e9('0x5b'));exports['reject']=function(_0x3a8ee7,_0x58bb43,_0x4b94e3){var _0x4d4263={'agent':{},'channel':'whatsapp'};if(_0x3a8ee7['body']['id']){delete _0x3a8ee7['body']['id'];}_0x3a8ee7[_0x05e9('0x58')][_0x05e9('0x61')]=_0x3a8ee7[_0x05e9('0x58')][_0x05e9('0x61')]||_0x3a8ee7[_0x05e9('0x62')]['id'];_0x4d4263[_0x05e9('0x63')]['id']=_0x3a8ee7[_0x05e9('0x58')]['UserId'];return db[_0x05e9('0x3b')][_0x05e9('0x56')]({'where':{'id':_0x3a8ee7['params']['id'],'UserId':null}})[_0x05e9('0x1e')](handleEntityNotFound(_0x58bb43,null))['then'](function(_0x2167f2){if(_0x2167f2){_0x4d4263[_0x05e9('0x27')]=_0x2167f2[_0x05e9('0x68')]({'plain':!![]});return db[_0x05e9('0x7d')][_0x05e9('0x56')]({'where':{'id':_0x2167f2[_0x05e9('0x64')]}});}return null;})[_0x05e9('0x1e')](handleEntityNotFound(_0x58bb43,null))[_0x05e9('0x1e')](function(_0x14e982){if(_0x14e982){_0x4d4263['interaction']=_0x14e982[_0x05e9('0x68')]({'plain':!![]});interaction_log[_0x05e9('0x1f')](_0x05e9('0x7e'),_0x3a8ee7[_0x05e9('0x62')]['id'],_0x3a8ee7[_0x05e9('0x62')][_0x05e9('0x37')],_0x3a8ee7['user'][_0x05e9('0x6a')],_0x4d4263[_0x05e9('0x6b')]['id'],_0x3a8ee7[_0x05e9('0x58')]?JSON[_0x05e9('0x24')](_0x3a8ee7[_0x05e9('0x58')]):_0x05e9('0x6c'));return respondWithRpcPromise('RejectMessage',_0x05e9('0x7f'),_0x4d4263);}return null;})[_0x05e9('0x1e')](function(_0x10f013){var _0xb0030d=_0x05e9('0x6e')+_0x10f013[_0x05e9('0x27')][_0x05e9('0x6f')];return db[_0x05e9('0x70')]['query'](_0xb0030d,{'type':db['Sequelize'][_0x05e9('0x71')][_0x05e9('0x72')],'raw':!![]})[_0x05e9('0x1e')](function(_0x54353f){return _0x54353f;});})[_0x05e9('0x1e')](function(_0x290ccf){if(_0x290ccf){_0x4d4263['message']['contact']=_0x290ccf[0x0];if(!_0x3a8ee7[_0x05e9('0x58')][_0x05e9('0x61')])return;return db[_0x05e9('0x80')]['find']({'where':{'id':_0x3a8ee7[_0x05e9('0x58')][_0x05e9('0x61')],'role':_0x05e9('0x63')},'attributes':['id',_0x05e9('0x37'),_0x05e9('0x74'),_0x05e9('0x81'),_0x05e9('0x75')],'raw':!![]});}return null;})[_0x05e9('0x1e')](function(_0x2983ca){if(!_0x2983ca)return null;_0x4d4263[_0x05e9('0x27')][_0x05e9('0x63')]=_0x2983ca;return _0x4d4263;})[_0x05e9('0x1e')](function(_0x5d8051){if(_0x5d8051){_0x5d8051[_0x05e9('0x27')]['interface']=util[_0x05e9('0x67')](_0x05e9('0x77'),_0x3a8ee7[_0x05e9('0x62')][_0x05e9('0x37')]);_0x5d8051['message'][_0x05e9('0x78')]=_0x4d4263[_0x05e9('0x78')];_0x5d8051[_0x05e9('0x27')][_0x05e9('0x79')]=_0x4d4263['channel'];_0x5d8051[_0x05e9('0x27')][_0x05e9('0x7a')]=_0x05e9('0x82');respondWithRpcPromise('EventManager',_0x05e9('0x7b'),{'event':_0x05e9('0x83'),'message':_0x5d8051[_0x05e9('0x27')]},client9002);return _0x4d4263;}return null;})[_0x05e9('0x1e')](respondWithResult(_0x58bb43,null))['catch'](handleError(_0x58bb43,null));};exports[_0x05e9('0x2b')]=function(_0x28cd0a,_0x2d67b3,_0x31b74a){if(_0x28cd0a['body']['id']){delete _0x28cd0a['body']['id'];}var _0x558fd7;return db[_0x05e9('0x3b')][_0x05e9('0x56')]({'where':{'id':_0x28cd0a[_0x05e9('0x59')]['id']}})[_0x05e9('0x1e')](handleEntityNotFound(_0x2d67b3,null))[_0x05e9('0x1e')](function(_0x75c2e){if(_0x75c2e){_0x558fd7=_0x75c2e;return db[_0x05e9('0x84')]['find']({'where':{'id':_0x75c2e[_0x05e9('0x85')]}});}})['then'](handleEntityNotFound(_0x2d67b3,null))[_0x05e9('0x1e')](function(_0xbab310){if(_0xbab310){logger[_0x05e9('0x21')](_0x05e9('0x86'),_0x05e9('0x2b'),_0x05e9('0x87'),_0xbab310['type'],util['inspect'](_0x28cd0a[_0x05e9('0x58')],{'showHidden':![],'depth':null}));switch(_0xbab310[_0x05e9('0x3e')]){case _0x05e9('0x88'):if(_0x28cd0a[_0x05e9('0x58')]['MessageSid']&&_0x28cd0a[_0x05e9('0x58')][_0x05e9('0x89')]===_0x558fd7[_0x05e9('0x8a')]&&_0x28cd0a[_0x05e9('0x58')]['MessageStatus']&&_0x28cd0a[_0x05e9('0x58')][_0x05e9('0x8b')]===_0x05e9('0x5e')){return _0x558fd7[_0x05e9('0x34')]({'read':!![]});}else{logger[_0x05e9('0x25')](_0x05e9('0x8c'),_0x05e9('0x2b'),'twilio',util[_0x05e9('0x8d')](_0x28cd0a[_0x05e9('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x558fd7;}})[_0x05e9('0x1e')](respondWithResult(_0x2d67b3,null))[_0x05e9('0x52')](handleError(_0x2d67b3,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index bdf4e01..afe5a08 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 _0x4b0f=['exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x598785,_0x148a9e){_0x598785=_0x598785-0x0;var _0x2235ff=_0x4b0f[_0x598785];return _0x2235ff;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf4b0('0x0'))['db'][_0xf4b0('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf4b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4b0('0x3'),'afterDestroy':_0xf4b0('0x4')};function emitEvent(_0x141c87){return function(_0x28be5f,_0x2a08dc,_0x354cb3){WhatsappMessageEvents[_0xf4b0('0x5')](_0x141c87+':'+_0x28be5f['id'],_0x28be5f);WhatsappMessageEvents[_0xf4b0('0x5')](_0x141c87,_0x28be5f);_0x354cb3(null);};}for(var e in events){if(events[_0xf4b0('0x6')](e)){var event=events[e];WhatsappMessage[_0xf4b0('0x7')](e,emitEvent(event));}}module[_0xf4b0('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x3264=['exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x18bee3,_0x534c71){var _0x331e74=function(_0x346f7b){while(--_0x346f7b){_0x18bee3['push'](_0x18bee3['shift']());}};_0x331e74(++_0x534c71);}(_0x3264,0x7f));var _0x4326=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x3264[_0x5608a3];return _0x1ed50a;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x4326('0x0'))['db'][_0x4326('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4326('0x2')](0x0);var events={'afterCreate':_0x4326('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xdd223f){return function(_0x510181,_0x5555ac,_0x27ff99){WhatsappMessageEvents[_0x4326('0x4')](_0xdd223f+':'+_0x510181['id'],_0x510181);WhatsappMessageEvents[_0x4326('0x4')](_0xdd223f,_0x510181);_0x27ff99(null);};}for(var e in events){if(events[_0x4326('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x4326('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c1dab11..ec3e8f8 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 _0xbe83=['toLowerCase','direction','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf','../../config/environment','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get'];(function(_0x3de7b6,_0x8fc525){var _0x498d09=function(_0xe8161c){while(--_0xe8161c){_0x3de7b6['push'](_0x3de7b6['shift']());}};_0x498d09(++_0x8fc525);}(_0xbe83,0xee));var _0x3be8=function(_0x4930e4,_0x4ce8c6){_0x4930e4=_0x4930e4-0x0;var _0x3435d4=_0xbe83[_0x4930e4];return _0x3435d4;};'use strict';var _=require(_0x3be8('0x0'));var util=require('util');var logger=require(_0x3be8('0x1'))(_0x3be8('0x2'));var moment=require(_0x3be8('0x3'));var BPromise=require(_0x3be8('0x4'));var rp=require('request-promise');var fetch=require(_0x3be8('0x5'));var fs=require('fs');var path=require(_0x3be8('0x6'));var rimraf=require(_0x3be8('0x7'));var config=require(_0x3be8('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x3be8('0x9')]=function(_0x31183c,_0x3dbe5c){return _0x31183c['define'](_0x3be8('0xa'),attributes,{'tableName':_0x3be8('0xb'),'paranoid':![],'indexes':[{'name':_0x3be8('0xc'),'fields':[_0x3be8('0xc')]},{'name':_0x3be8('0xd'),'fields':[_0x3be8('0xe')],'type':_0x3be8('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55fdc3,_0x86edb,_0x45367e){var _0x4f1f26=_0x31183c[_0x3be8('0x10')];var _0x397e33=_0x55fdc3[_0x3be8('0x11')]({'plain':!![]});if(_0x397e33['direction'][_0x3be8('0x12')]()==='in'||_0x397e33[_0x3be8('0x13')][_0x3be8('0x12')]()==='out'&&!_0x397e33[_0x3be8('0x14')]&&!_[_0x3be8('0x15')](_0x397e33[_0x3be8('0x16')])){_0x4f1f26[_0x3be8('0x17')][_0x3be8('0x18')]({'where':{'id':_0x397e33[_0x3be8('0x19')]}})['then'](function(_0x227cad){if(_0x227cad){_0x227cad[_0x3be8('0x1a')]({'lastMsgAt':_0x397e33[_0x3be8('0x1b')],'lastMsgDirection':_0x397e33[_0x3be8('0x13')]['toLowerCase']()});}})[_0x3be8('0x1c')](function(_0x288ccd){console[_0x3be8('0x1d')](_0x288ccd);});}if(_0x397e33['direction']===_0x3be8('0x1e')&&!_0x397e33[_0x3be8('0x14')]){var _0x3517f3;_0x4f1f26[_0x3be8('0x1f')][_0x3be8('0x20')]({'where':{'id':_0x397e33[_0x3be8('0x21')]},'raw':!![]})[_0x3be8('0x22')](function(_0x3f8cff){_0x3517f3=_0x3f8cff;if(_0x3517f3&&_0x3517f3[_0x3be8('0x23')]){switch(_0x3517f3[_0x3be8('0x23')]){case _0x3be8('0x24'):var _0x12773f=require(_0x3be8('0x24'));if(_0x3517f3[_0x3be8('0x25')]&&_0x3517f3[_0x3be8('0x26')]&&_0x3517f3[_0x3be8('0x27')]){var _0x2652cf=new _0x12773f(_0x3517f3['accountSid'],_0x3517f3['authToken']);_0x2652cf[_0x3be8('0x28')][_0x3be8('0x29')]({'body':_0x397e33[_0x3be8('0xe')],'to':_0x3be8('0x2a')+_0x397e33[_0x3be8('0x27')],'from':_0x3be8('0x2a')+_0x3517f3[_0x3be8('0x27')],'statusCallback':_0x3517f3[_0x3be8('0x2b')]+_0x3be8('0x2c')+_0x397e33['id']+_0x3be8('0x2d')+_0x3517f3[_0x3be8('0x2e')]})[_0x3be8('0x22')](function(_0x1fbdee){if(_0x1fbdee[_0x3be8('0x2f')]){return _0x55fdc3['update']({'messageId':_0x1fbdee[_0x3be8('0x2f')]});}})['catch'](function(_0x43af94){logger[_0x3be8('0x1d')](_0x3be8('0x30'),'afterCreate',_0x3be8('0x24'),util[_0x3be8('0x31')](_0x43af94,{'showHidden':![],'depth':null}));});}else{logger[_0x3be8('0x1d')](_0x3be8('0x30'),_0x3be8('0x32'),_0x3be8('0x24'),_0x3be8('0x33'));}break;case _0x3be8('0x34'):var _0x5abf82=_0x3517f3[_0x3be8('0x25')];var _0x14313f=_0x3517f3[_0x3be8('0x26')];var _0x170092=_0x3517f3[_0x3be8('0x35')]+'/whatsapp/v1/'+_0x5abf82+_0x3be8('0x36');var _0x339c29={'to':[_0x397e33[_0x3be8('0x27')]],'message':{'type':_0x3be8('0x37'),'text':_0x397e33[_0x3be8('0xe')]}};var _0x90b54d={'method':_0x3be8('0x38'),'uri':_0x170092,'headers':{'Authorization':_0x3be8('0x39')+_0x14313f,'Content-Type':'application/json'},'body':_0x339c29,'json':!![]};rp(_0x90b54d)[_0x3be8('0x22')](function(_0x3798d9){if(_0x3798d9[_0x3be8('0x3a')][0x0][_0x3be8('0x3b')]){return _0x55fdc3[_0x3be8('0x1a')]({'messageId':_0x3798d9['statuses'][0x0]['message_id']});}})[_0x3be8('0x1c')](function(_0xd83cf){logger['err'](_0x3be8('0x3c'),_0xd83cf);});break;}}})[_0x3be8('0x3d')](function(){_0x45367e();});}else{_0x45367e();}}},'charset':_0x3be8('0x3e'),'collate':_0x3be8('0x3f')});}; \ No newline at end of file +var _0xef3a=['body','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','../../config/logger','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId'];(function(_0x52874e,_0x2196de){var _0x274a88=function(_0x206b1f){while(--_0x206b1f){_0x52874e['push'](_0x52874e['shift']());}};_0x274a88(++_0x2196de);}(_0xef3a,0xa6));var _0xaef3=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0xef3a[_0x1cb0b4];return _0x525b60;};'use strict';var _=require(_0xaef3('0x0'));var util=require('util');var logger=require(_0xaef3('0x1'))('api');var moment=require(_0xaef3('0x2'));var BPromise=require('bluebird');var rp=require(_0xaef3('0x3'));var fetch=require(_0xaef3('0x4'));var fs=require('fs');var path=require(_0xaef3('0x5'));var rimraf=require(_0xaef3('0x6'));var config=require(_0xaef3('0x7'));var attributes=require(_0xaef3('0x8'));module[_0xaef3('0x9')]=function(_0x29f36b,_0x1fef7c){return _0x29f36b[_0xaef3('0xa')](_0xaef3('0xb'),attributes,{'tableName':_0xaef3('0xc'),'paranoid':![],'indexes':[{'name':_0xaef3('0xd'),'fields':[_0xaef3('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0xaef3('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d4764,_0x4aa193,_0x12ca45){var _0x30b6dd=_0x29f36b[_0xaef3('0xf')];var _0x3e782e=_0x4d4764[_0xaef3('0x10')]({'plain':!![]});if(_0x3e782e[_0xaef3('0x11')][_0xaef3('0x12')]()==='in'||_0x3e782e[_0xaef3('0x11')]['toLowerCase']()==='out'&&!_0x3e782e[_0xaef3('0x13')]&&!_[_0xaef3('0x14')](_0x3e782e[_0xaef3('0x15')])){_0x30b6dd[_0xaef3('0x16')]['findOne']({'where':{'id':_0x3e782e[_0xaef3('0x17')]}})[_0xaef3('0x18')](function(_0x2e32ad){if(_0x2e32ad){_0x2e32ad['update']({'lastMsgAt':_0x3e782e[_0xaef3('0x19')],'lastMsgDirection':_0x3e782e['direction'][_0xaef3('0x12')]()});}})[_0xaef3('0x1a')](function(_0x371fc7){console[_0xaef3('0x1b')](_0x371fc7);});}if(_0x3e782e[_0xaef3('0x11')]===_0xaef3('0x1c')&&!_0x3e782e[_0xaef3('0x13')]){var _0x2d59aa;_0x30b6dd[_0xaef3('0x1d')][_0xaef3('0x1e')]({'where':{'id':_0x3e782e[_0xaef3('0x1f')]},'raw':!![]})[_0xaef3('0x18')](function(_0x2bfa12){_0x2d59aa=_0x2bfa12;if(_0x2d59aa&&_0x2d59aa['type']){switch(_0x2d59aa['type']){case _0xaef3('0x20'):var _0x2eae00=require(_0xaef3('0x20'));if(_0x2d59aa[_0xaef3('0x21')]&&_0x2d59aa[_0xaef3('0x22')]&&_0x2d59aa[_0xaef3('0x23')]){var _0x193e9d=new _0x2eae00(_0x2d59aa[_0xaef3('0x21')],_0x2d59aa[_0xaef3('0x22')]);_0x193e9d[_0xaef3('0x24')][_0xaef3('0x25')]({'body':_0x3e782e[_0xaef3('0xe')],'to':_0xaef3('0x26')+_0x3e782e[_0xaef3('0x23')],'from':_0xaef3('0x26')+_0x2d59aa['phone'],'statusCallback':_0x2d59aa[_0xaef3('0x27')]+_0xaef3('0x28')+_0x3e782e['id']+_0xaef3('0x29')+_0x2d59aa[_0xaef3('0x2a')]})['then'](function(_0xec001c){if(_0xec001c[_0xaef3('0x2b')]){return _0x4d4764[_0xaef3('0x2c')]({'messageId':_0xec001c[_0xaef3('0x2b')]});}})['catch'](function(_0x39c84a){logger[_0xaef3('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaef3('0x20'),util['inspect'](_0x39c84a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaef3('0x2d'),_0xaef3('0x2e'),'twilio',_0xaef3('0x2f'));}break;case _0xaef3('0x30'):var _0x529041=_0x2d59aa[_0xaef3('0x21')];var _0x165e0c=_0x2d59aa[_0xaef3('0x22')];var _0x16dcf5=_0x2d59aa['baseUrl']+_0xaef3('0x31')+_0x529041+_0xaef3('0x32');var _0x490c93={'to':[_0x3e782e[_0xaef3('0x23')]],'message':{'type':_0xaef3('0x33'),'text':_0x3e782e[_0xaef3('0xe')]}};var _0x29ef06={'method':'POST','uri':_0x16dcf5,'headers':{'Authorization':_0xaef3('0x34')+_0x165e0c,'Content-Type':_0xaef3('0x35')},'body':_0x490c93,'json':!![]};rp(_0x29ef06)[_0xaef3('0x18')](function(_0x308eae){if(_0x308eae['statuses'][0x0][_0xaef3('0x36')]){return _0x4d4764['update']({'messageId':_0x308eae[_0xaef3('0x37')][0x0]['message_id']});}})['catch'](function(_0xa538bc){logger[_0xaef3('0x38')](_0xaef3('0x39'),_0xa538bc);});break;}}})[_0xaef3('0x3a')](function(){_0x12ca45();});}else{_0x12ca45();}}},'charset':_0xaef3('0x3b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 780525f..09a9a77 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 _0x4ebb=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','then','debug','catch','lodash'];(function(_0xd59f3e,_0x544e44){var _0x449c0f=function(_0x1554b3){while(--_0x1554b3){_0xd59f3e['push'](_0xd59f3e['shift']());}};_0x449c0f(++_0x544e44);}(_0x4ebb,0x1cd));var _0xb4eb=function(_0xc10366,_0x4a25a8){_0xc10366=_0xc10366-0x0;var _0x2c535d=_0x4ebb[_0xc10366];return _0x2c535d;};'use strict';var _=require(_0xb4eb('0x0'));var util=require(_0xb4eb('0x1'));var moment=require('moment');var BPromise=require(_0xb4eb('0x2'));var rs=require(_0xb4eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4eb('0x5'))(_0xb4eb('0x6'));var config=require(_0xb4eb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb4eb('0x8')][_0xb4eb('0x9')]({'port':0x232a});config[_0xb4eb('0xa')]=_[_0xb4eb('0xb')](config[_0xb4eb('0xa')],{'host':_0xb4eb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb4eb('0xd'))[_0xb4eb('0xe')](socket);function respondWithRpcPromise(_0x59ec80,_0x521b66,_0x4b689b){return new BPromise(function(_0xe06953,_0x4a8c68){return client[_0xb4eb('0xf')](_0x59ec80,_0x4b689b)['then'](function(_0x495198){logger['info'](_0xb4eb('0x10'),_0x521b66,'request\x20sent');logger['debug'](_0xb4eb('0x11'),_0x521b66,_0xb4eb('0x12'),JSON[_0xb4eb('0x13')](_0x495198));if(_0x495198[_0xb4eb('0x14')]){if(_0x495198[_0xb4eb('0x14')][_0xb4eb('0x15')]===0x1f4){logger[_0xb4eb('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x521b66,_0x495198[_0xb4eb('0x14')]['message']);return _0x4a8c68(_0x495198[_0xb4eb('0x14')]['message']);}logger[_0xb4eb('0x14')](_0xb4eb('0x10'),_0x521b66,_0x495198[_0xb4eb('0x14')][_0xb4eb('0x16')]);return _0xe06953(_0x495198[_0xb4eb('0x14')][_0xb4eb('0x16')]);}else{logger[_0xb4eb('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x521b66,'request\x20sent');_0xe06953(_0x495198[_0xb4eb('0x18')][_0xb4eb('0x16')]);}})['catch'](function(_0x202d38){logger[_0xb4eb('0x14')](_0xb4eb('0x10'),_0x521b66,_0x202d38);_0x4a8c68(_0x202d38);});});}exports[_0xb4eb('0x19')]=function(_0x49695f){var _0x484596=this;return new Promise(function(_0x5ef529,_0x1d023f){return db[_0xb4eb('0x1a')][_0xb4eb('0x1b')](_0x49695f[_0xb4eb('0x1c')],{'raw':_0x49695f[_0xb4eb('0x1d')]?_0x49695f[_0xb4eb('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xb4eb('0x1e')](function(_0x61f557){logger[_0xb4eb('0x17')]('CreateWhatsappMessage',_0x49695f);logger[_0xb4eb('0x1f')]('CreateWhatsappMessage',_0x49695f,JSON[_0xb4eb('0x13')](_0x61f557));_0x5ef529(_0x61f557);})[_0xb4eb('0x20')](function(_0x202133){logger[_0xb4eb('0x14')](_0xb4eb('0x19'),_0x202133[_0xb4eb('0x16')],_0x49695f);_0x1d023f(_0x484596['error'](0x1f4,_0x202133['message']));});});}; \ No newline at end of file +var _0xd113=['request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','debug','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0xad68ca,_0x45baf8){var _0x34e77d=function(_0x2e01a2){while(--_0x2e01a2){_0xad68ca['push'](_0xad68ca['shift']());}};_0x34e77d(++_0x45baf8);}(_0xd113,0x9e));var _0x3d11=function(_0x3f8208,_0x6d3077){_0x3f8208=_0x3f8208-0x0;var _0x12abc5=_0xd113[_0x3f8208];return _0x12abc5;};'use strict';var _=require(_0x3d11('0x0'));var util=require(_0x3d11('0x1'));var moment=require(_0x3d11('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d11('0x4'));var logger=require(_0x3d11('0x5'))(_0x3d11('0x6'));var config=require(_0x3d11('0x7'));var jayson=require(_0x3d11('0x8'));var client=jayson[_0x3d11('0x9')][_0x3d11('0xa')]({'port':0x232a});config[_0x3d11('0xb')]=_[_0x3d11('0xc')](config[_0x3d11('0xb')],{'host':_0x3d11('0xd'),'port':0x18eb});var socket=require(_0x3d11('0xe'))(new Redis(config[_0x3d11('0xb')]));require(_0x3d11('0xf'))[_0x3d11('0x10')](socket);function respondWithRpcPromise(_0x5bdeab,_0x305b63,_0x4cdfd6){return new BPromise(function(_0x1ac0c4,_0x47bcd3){return client[_0x3d11('0x11')](_0x5bdeab,_0x4cdfd6)[_0x3d11('0x12')](function(_0x2e8c51){logger['info'](_0x3d11('0x13'),_0x305b63,_0x3d11('0x14'));logger['debug'](_0x3d11('0x15'),_0x305b63,_0x3d11('0x14'),JSON[_0x3d11('0x16')](_0x2e8c51));if(_0x2e8c51['error']){if(_0x2e8c51['error'][_0x3d11('0x17')]===0x1f4){logger[_0x3d11('0x18')](_0x3d11('0x13'),_0x305b63,_0x2e8c51[_0x3d11('0x18')][_0x3d11('0x19')]);return _0x47bcd3(_0x2e8c51['error']['message']);}logger[_0x3d11('0x18')](_0x3d11('0x13'),_0x305b63,_0x2e8c51[_0x3d11('0x18')][_0x3d11('0x19')]);return _0x1ac0c4(_0x2e8c51[_0x3d11('0x18')][_0x3d11('0x19')]);}else{logger[_0x3d11('0x1a')](_0x3d11('0x13'),_0x305b63,_0x3d11('0x14'));_0x1ac0c4(_0x2e8c51['result'][_0x3d11('0x19')]);}})[_0x3d11('0x1b')](function(_0x4d28f1){logger[_0x3d11('0x18')](_0x3d11('0x13'),_0x305b63,_0x4d28f1);_0x47bcd3(_0x4d28f1);});});}exports['CreateWhatsappMessage']=function(_0x3548c1){var _0x482a06=this;return new Promise(function(_0x2c64b8,_0x33e5f3){return db[_0x3d11('0x1c')][_0x3d11('0x1d')](_0x3548c1[_0x3d11('0x1e')],{'raw':_0x3548c1[_0x3d11('0x1f')]?_0x3548c1[_0x3d11('0x1f')][_0x3d11('0x20')]===undefined?!![]:![]:!![]})[_0x3d11('0x12')](function(_0x52a584){logger[_0x3d11('0x1a')](_0x3d11('0x21'),_0x3548c1);logger[_0x3d11('0x22')](_0x3d11('0x21'),_0x3548c1,JSON['stringify'](_0x52a584));_0x2c64b8(_0x52a584);})[_0x3d11('0x1b')](function(_0x3e2adc){logger['error']('CreateWhatsappMessage',_0x3e2adc[_0x3d11('0x19')],_0x3548c1);_0x33e5f3(_0x482a06[_0x3d11('0x18')](0x1f4,_0x3e2adc['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 4a5148f..262e5a9 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 _0x4cff=['remove','removeListener','register','./whatsappMessage.events'];(function(_0x200be5,_0x4e7587){var _0x54e27d=function(_0x126727){while(--_0x126727){_0x200be5['push'](_0x200be5['shift']());}};_0x54e27d(++_0x4e7587);}(_0x4cff,0x187));var _0xf4cf=function(_0x3abcf0,_0x52dcf0){_0x3abcf0=_0x3abcf0-0x0;var _0x26b834=_0x4cff[_0x3abcf0];return _0x26b834;};'use strict';var WhatsappMessageEvents=require(_0xf4cf('0x0'));var events=['save',_0xf4cf('0x1'),'update'];function createListener(_0x3299b9,_0x3e5b32){return function(_0x2ab6d4){_0x3e5b32['emit'](_0x3299b9,_0x2ab6d4);};}function removeListener(_0x3abc74,_0x35aa05){return function(){WhatsappMessageEvents[_0xf4cf('0x2')](_0x3abc74,_0x35aa05);};}exports[_0xf4cf('0x3')]=function(_0x42244b){for(var _0x5094fd=0x0,_0x292a5b=events['length'];_0x5094fd<_0x292a5b;_0x5094fd++){var _0x538e00=events[_0x5094fd];var _0x455837=createListener('whatsappMessage:'+_0x538e00,_0x42244b);WhatsappMessageEvents['on'](_0x538e00,_0x455837);}}; \ No newline at end of file +var _0x3c4a=['save','remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x3c4a,0xb3));var _0xa3c4=function(_0x18860c,_0x4af1bb){_0x18860c=_0x18860c-0x0;var _0x51f126=_0x3c4a[_0x18860c];return _0x51f126;};'use strict';var WhatsappMessageEvents=require(_0xa3c4('0x0'));var events=[_0xa3c4('0x1'),_0xa3c4('0x2'),_0xa3c4('0x3')];function createListener(_0x448a77,_0x5b2b0a){return function(_0x458d3b){_0x5b2b0a[_0xa3c4('0x4')](_0x448a77,_0x458d3b);};}function removeListener(_0x325a53,_0x33706f){return function(){WhatsappMessageEvents[_0xa3c4('0x5')](_0x325a53,_0x33706f);};}exports[_0xa3c4('0x6')]=function(_0x37077a){for(var _0x2c4739=0x0,_0x2b5654=events[_0xa3c4('0x7')];_0x2c4739<_0x2b5654;_0x2c4739++){var _0x3f03ef=events[_0x2c4739];var _0x204a29=createListener(_0xa3c4('0x8')+_0x3f03ef,_0x37077a);WhatsappMessageEvents['on'](_0x3f03ef,_0x204a29);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c88136b..aab165b 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 _0x1962=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0x1962,0x166));var _0x2196=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x1962[_0x30c2ae];return _0x1ee1cc;};'use strict';var multer=require(_0x2196('0x0'));var util=require(_0x2196('0x1'));var path=require(_0x2196('0x2'));var timeout=require(_0x2196('0x3'));var express=require(_0x2196('0x4'));var router=express[_0x2196('0x5')]();var fs_extra=require(_0x2196('0x6'));var auth=require(_0x2196('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2196('0x8'));var controller=require('./whatsappQueue.controller');router[_0x2196('0x9')]('/',auth[_0x2196('0xa')](),controller[_0x2196('0xb')]);router[_0x2196('0x9')](_0x2196('0xc'),auth['isAuthenticated'](),controller[_0x2196('0xd')]);router[_0x2196('0x9')](_0x2196('0xe'),auth[_0x2196('0xa')](),controller[_0x2196('0xf')]);router[_0x2196('0x9')](_0x2196('0x10'),auth[_0x2196('0xa')](),controller[_0x2196('0x11')]);router[_0x2196('0x9')](_0x2196('0x12'),auth['isAuthenticated'](),controller[_0x2196('0x13')]);router['get'](_0x2196('0x14'),auth[_0x2196('0xa')](),controller[_0x2196('0x15')]);router[_0x2196('0x16')]('/',auth[_0x2196('0xa')](),controller[_0x2196('0x17')]);router['post'](_0x2196('0x12'),auth[_0x2196('0xa')](),controller[_0x2196('0x18')]);router[_0x2196('0x16')](_0x2196('0x14'),auth[_0x2196('0xa')](),controller[_0x2196('0x19')]);router[_0x2196('0x1a')]('/:id',auth[_0x2196('0xa')](),controller[_0x2196('0x1b')]);router['delete'](_0x2196('0xe'),auth['isAuthenticated'](),controller[_0x2196('0x1c')]);router[_0x2196('0x1d')](_0x2196('0x12'),auth['isAuthenticated'](),controller[_0x2196('0x1e')]);router[_0x2196('0x1d')]('/:id/users',auth[_0x2196('0xa')](),controller[_0x2196('0x1f')]);module[_0x2196('0x20')]=router; \ No newline at end of file +var _0x4341=['removeAgents','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id/members','/:id/teams','getTeams','/:id/users','post','addTeams','put','/:id','update','destroy','delete','removeTeams'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4341,0x1dc));var _0x1434=function(_0x1e1b5a,_0x13b534){_0x1e1b5a=_0x1e1b5a-0x0;var _0x3206db=_0x4341[_0x1e1b5a];return _0x3206db;};'use strict';var multer=require(_0x1434('0x0'));var util=require(_0x1434('0x1'));var path=require(_0x1434('0x2'));var timeout=require('connect-timeout');var express=require(_0x1434('0x3'));var router=express['Router']();var fs_extra=require(_0x1434('0x4'));var auth=require(_0x1434('0x5'));var interaction=require(_0x1434('0x6'));var config=require(_0x1434('0x7'));var controller=require(_0x1434('0x8'));router[_0x1434('0x9')]('/',auth[_0x1434('0xa')](),controller['index']);router[_0x1434('0x9')](_0x1434('0xb'),auth[_0x1434('0xa')](),controller['describe']);router[_0x1434('0x9')]('/:id',auth[_0x1434('0xa')](),controller['show']);router[_0x1434('0x9')](_0x1434('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x1434('0x9')](_0x1434('0xd'),auth[_0x1434('0xa')](),controller[_0x1434('0xe')]);router[_0x1434('0x9')](_0x1434('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x1434('0x10')]('/',auth[_0x1434('0xa')](),controller['create']);router[_0x1434('0x10')](_0x1434('0xd'),auth['isAuthenticated'](),controller[_0x1434('0x11')]);router[_0x1434('0x10')](_0x1434('0xf'),auth[_0x1434('0xa')](),controller['addAgents']);router[_0x1434('0x12')](_0x1434('0x13'),auth[_0x1434('0xa')](),controller[_0x1434('0x14')]);router['delete']('/:id',auth[_0x1434('0xa')](),controller[_0x1434('0x15')]);router[_0x1434('0x16')](_0x1434('0xd'),auth[_0x1434('0xa')](),controller[_0x1434('0x17')]);router[_0x1434('0x16')]('/:id/users',auth[_0x1434('0xa')](),controller[_0x1434('0x18')]);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 1938e1b..27646a9 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 _0xf72b=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xf72b,0x1d9));var _0xbf72=function(_0x3e4367,_0x558227){_0x3e4367=_0x3e4367-0x0;var _0x4c2b77=_0xf72b[_0x3e4367];return _0x4c2b77;};'use strict';var Sequelize=require(_0xbf72('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf72('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xbf72('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbf72('0x3')]('rrmemory',_0xbf72('0x4'),_0xbf72('0x5'))},'description':{'type':Sequelize[_0xbf72('0x1')]}}; \ No newline at end of file +var _0x0269=['rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0269,0x135));var _0x9026=function(_0x3cb1a8,_0x26b758){_0x3cb1a8=_0x3cb1a8-0x0;var _0x1826cf=_0x0269[_0x3cb1a8];return _0x1826cf;};'use strict';var Sequelize=require(_0x9026('0x0'));module['exports']={'name':{'type':Sequelize[_0x9026('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9026('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9026('0x3'),_0x9026('0x4'),_0x9026('0x5'))},'description':{'type':Sequelize[_0x9026('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d746a0c..8d9352e 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 _0x2162=['online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','name','map','WhatsappQueue','rawAttributes','fieldName','key','where','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','get','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','options','addTeams','ids','Agents'];(function(_0x5de85c,_0x67c18e){var _0x515b90=function(_0x1a5cf4){while(--_0x1a5cf4){_0x5de85c['push'](_0x5de85c['shift']());}};_0x515b90(++_0x67c18e);}(_0x2162,0x1f1));var _0x2216=function(_0x5232bb,_0x4fcb6c){_0x5232bb=_0x5232bb-0x0;var _0x2ba6d1=_0x2162[_0x5232bb];return _0x2ba6d1;};'use strict';var BPromise=require('bluebird');var util=require(_0x2216('0x0'));var _=require(_0x2216('0x1'));var squel=require(_0x2216('0x2'));var Redis=require('ioredis');var qs=require(_0x2216('0x3'));var logger=require(_0x2216('0x4'))(_0x2216('0x5'));var config=require(_0x2216('0x6'));var db=require('../../mysqldb')['db'];config[_0x2216('0x7')]=_['defaults'](config[_0x2216('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x2216('0x8')](socket);function respondWithStatusCode(_0x72eef6,_0x26955a){_0x26955a=_0x26955a||0xcc;return function(_0x5a74d5){if(_0x5a74d5){return _0x72eef6[_0x2216('0x9')](_0x26955a);}return _0x72eef6[_0x2216('0xa')](_0x26955a)[_0x2216('0xb')]();};}function respondWithResult(_0x5895d4,_0x18009a){_0x18009a=_0x18009a||0xc8;return function(_0x57aa37){if(_0x57aa37){return _0x5895d4['status'](_0x18009a)['json'](_0x57aa37);}};}function respondWithFilteredResult(_0x5072c0,_0x13bb77){return function(_0x3d020f){if(_0x3d020f){var _0x58456e=typeof _0x13bb77[_0x2216('0xc')]===_0x2216('0xd')&&typeof _0x13bb77[_0x2216('0xe')]==='undefined';var _0x381507=_0x3d020f[_0x2216('0xf')];var _0x42c90e=_0x58456e?0x0:_0x13bb77[_0x2216('0xc')];var _0x1842db=_0x58456e?_0x3d020f['count']:_0x13bb77[_0x2216('0xc')]+_0x13bb77[_0x2216('0xe')];var _0xa761d9;if(_0x1842db>=_0x381507){_0x1842db=_0x381507;_0xa761d9=0xc8;}else{_0xa761d9=0xce;}_0x5072c0[_0x2216('0xa')](_0xa761d9);return _0x5072c0[_0x2216('0x10')](_0x2216('0x11'),_0x42c90e+'-'+_0x1842db+'/'+_0x381507)[_0x2216('0x12')](_0x3d020f);}return null;};}function saveUpdates(_0x32bfb1){return function(_0x3c2a28){if(_0x3c2a28){return _0x3c2a28[_0x2216('0x13')](_0x32bfb1)[_0x2216('0x14')](function(_0x409284){return _0x409284;});}return null;};}function removeEntity(_0x43aeb5){return function(_0x2919b7){if(_0x2919b7){return _0x2919b7['destroy']()['then'](function(){var _0x554fff=_0x2919b7['get']({'plain':!![]});var _0x14e0de='WhatsappQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x14e0de,'resourceId':_0x554fff['id']}})['then'](function(){return _0x2919b7;});})[_0x2216('0x14')](function(){_0x43aeb5[_0x2216('0xa')](0xcc)[_0x2216('0xb')]();});}};}function handleEntityNotFound(_0x41ca62){return function(_0x14a282){if(!_0x14a282){_0x41ca62[_0x2216('0x9')](0x194);}return _0x14a282;};}function handleError(_0x55c8eb,_0x4c4f19){_0x4c4f19=_0x4c4f19||0x1f4;return function(_0x1b778b){logger[_0x2216('0x15')](_0x1b778b['stack']);if(_0x1b778b[_0x2216('0x16')]){delete _0x1b778b[_0x2216('0x16')];}_0x55c8eb[_0x2216('0xa')](_0x4c4f19)['send'](_0x1b778b);};}exports['index']=function(_0x4c5b10,_0x3c4aa8){var _0x5a7503={};var _0x4f4256={'count':0x0,'rows':[]};var _0x595ab6=_[_0x2216('0x17')](db[_0x2216('0x18')][_0x2216('0x19')],function(_0x57fd5e){return{'name':_0x57fd5e[_0x2216('0x1a')],'type':_0x57fd5e['type'][_0x2216('0x1b')]};});_0x5a7503=qs['getOptions'](_0x595ab6,_0x4c5b10);var _0x53baa4={'where':_0x5a7503[_0x2216('0x1c')]};return db[_0x2216('0x18')][_0x2216('0xf')](_0x53baa4)[_0x2216('0x14')](function(_0x558f3c){_0x4f4256[_0x2216('0xf')]=_0x558f3c;_0x5a7503[_0x2216('0x1d')]=qs[_0x2216('0x1d')](_0x4c5b10[_0x2216('0x1e')]);return db[_0x2216('0x18')][_0x2216('0x1f')](_0x5a7503);})['then'](function(_0x1bdbd5){_0x4f4256['rows']=_0x1bdbd5;return _0x4f4256;})[_0x2216('0x14')](respondWithFilteredResult(_0x3c4aa8,_0x5a7503))[_0x2216('0x20')](handleError(_0x3c4aa8,null));};exports[_0x2216('0x21')]=function(_0x14cf68,_0x3a4d56){var _0x437c12={'raw':!![],'where':{'id':_0x14cf68[_0x2216('0x22')]['id']}},_0x216ae0={};_0x216ae0[_0x2216('0x23')]=_[_0x2216('0x24')](db[_0x2216('0x18')][_0x2216('0x19')]);_0x216ae0[_0x2216('0x1e')]=_[_0x2216('0x24')](_0x14cf68['query']);_0x216ae0[_0x2216('0x25')]=_[_0x2216('0x26')](_0x216ae0[_0x2216('0x23')],_0x216ae0[_0x2216('0x1e')]);_0x437c12[_0x2216('0x27')]=_[_0x2216('0x26')](_0x216ae0[_0x2216('0x23')],qs[_0x2216('0x28')](_0x14cf68[_0x2216('0x1e')][_0x2216('0x28')]));_0x437c12[_0x2216('0x27')]=_0x437c12['attributes'][_0x2216('0x29')]?_0x437c12[_0x2216('0x27')]:_0x216ae0[_0x2216('0x23')];if(_0x14cf68[_0x2216('0x1e')][_0x2216('0x2a')]){_0x437c12[_0x2216('0x1d')]=[{'all':!![]}];}_0x437c12=_[_0x2216('0x2b')]({},_0x437c12,_0x14cf68['options']);return db['WhatsappQueue'][_0x2216('0x2c')](_0x437c12)[_0x2216('0x14')](handleEntityNotFound(_0x3a4d56,null))[_0x2216('0x14')](respondWithResult(_0x3a4d56,null))[_0x2216('0x20')](handleError(_0x3a4d56,null));};exports[_0x2216('0x2d')]=function(_0x4b161e,_0x3f8ada){return db['WhatsappQueue'][_0x2216('0x2d')](_0x4b161e[_0x2216('0x2e')],{})[_0x2216('0x14')](function(_0xa6334){var _0x5177b5=_0x4b161e[_0x2216('0x2f')]['get']({'plain':!![]});if(!_0x5177b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5177b5['role']===_0x2216('0x2f')){var _0x2748f4=_0xa6334[_0x2216('0x30')]({'plain':!![]});var _0x160dca='WhatsappQueues';return db['UserProfileSection'][_0x2216('0x2c')]({'where':{'name':_0x160dca,'userProfileId':_0x5177b5[_0x2216('0x31')]},'raw':!![]})[_0x2216('0x14')](function(_0x329cd6){if(_0x329cd6&&_0x329cd6[_0x2216('0x32')]===0x0){return db[_0x2216('0x33')][_0x2216('0x2d')]({'name':_0x2748f4['name'],'resourceId':_0x2748f4['id'],'type':_0x329cd6['name'],'sectionId':_0x329cd6['id']},{})[_0x2216('0x14')](function(){return _0xa6334;});}else{return _0xa6334;}})['catch'](function(_0x4105fa){logger[_0x2216('0x15')](_0x2216('0x34'),_0x4105fa);throw _0x4105fa;});}return _0xa6334;})[_0x2216('0x14')](respondWithResult(_0x3f8ada,0xc9))['catch'](handleError(_0x3f8ada,null));};exports[_0x2216('0x13')]=function(_0x391104,_0x2eedd3){if(_0x391104[_0x2216('0x2e')]['id']){delete _0x391104[_0x2216('0x2e')]['id'];}return db[_0x2216('0x18')][_0x2216('0x2c')]({'where':{'id':_0x391104['params']['id']}})[_0x2216('0x14')](handleEntityNotFound(_0x2eedd3,null))[_0x2216('0x14')](saveUpdates(_0x391104['body'],null))[_0x2216('0x14')](respondWithResult(_0x2eedd3,null))[_0x2216('0x20')](handleError(_0x2eedd3,null));};exports[_0x2216('0x35')]=function(_0x4181e7,_0x518efb){return db[_0x2216('0x18')][_0x2216('0x2c')]({'where':{'id':_0x4181e7[_0x2216('0x22')]['id']}})[_0x2216('0x14')](handleEntityNotFound(_0x518efb,null))[_0x2216('0x14')](removeEntity(_0x518efb,null))['catch'](handleError(_0x518efb,null));};exports[_0x2216('0x36')]=function(_0x55dcb3,_0x143e1a){return db[_0x2216('0x18')]['describe']()['then'](respondWithResult(_0x143e1a,null))[_0x2216('0x20')](handleError(_0x143e1a,null));};exports[_0x2216('0x37')]=function(_0x757b25,_0x1f9e58){var _0x511f51={'raw':!![],'where':{}},_0x306c67={},_0x3c1661;return db[_0x2216('0x18')][_0x2216('0x38')]({'where':{'id':_0x757b25[_0x2216('0x22')]['id']}})[_0x2216('0x14')](handleEntityNotFound(_0x1f9e58,null))[_0x2216('0x14')](function(_0x5868c4){if(_0x5868c4){_0x3c1661=_0x5868c4[_0x2216('0x30')]({'plain':!![]});_0x306c67[_0x2216('0x23')]=_[_0x2216('0x24')](db['UserWhatsappQueue']['rawAttributes']);_0x306c67[_0x2216('0x1e')]=_[_0x2216('0x24')](_0x757b25['query']);_0x306c67[_0x2216('0x25')]=_[_0x2216('0x26')](_0x306c67[_0x2216('0x23')],_0x306c67[_0x2216('0x1e')]);_0x511f51[_0x2216('0x27')]=_['intersection'](_0x306c67[_0x2216('0x23')],qs['fields'](_0x757b25[_0x2216('0x1e')][_0x2216('0x28')]));_0x511f51[_0x2216('0x27')]=_0x511f51[_0x2216('0x27')]['length']?_0x511f51['attributes']:_0x306c67[_0x2216('0x23')];if(!_0x757b25['query'][_0x2216('0x39')](_0x2216('0x3a'))){_0x511f51[_0x2216('0xe')]=qs['limit'](_0x757b25['query']['limit']);_0x511f51[_0x2216('0xc')]=qs[_0x2216('0xc')](_0x757b25[_0x2216('0x1e')][_0x2216('0xc')]);}_0x511f51[_0x2216('0x3b')]=qs[_0x2216('0x3c')](_0x757b25[_0x2216('0x1e')][_0x2216('0x3c')]);_0x511f51['where']=qs[_0x2216('0x25')](_['pick'](_0x757b25[_0x2216('0x1e')],_0x306c67['filters']));_0x511f51[_0x2216('0x1c')][_0x2216('0x3d')]=_0x5868c4['id'];if(_0x757b25[_0x2216('0x1e')][_0x2216('0x3e')]){_0x511f51['where']=_[_0x2216('0x2b')](_0x511f51['where'],{'$or':_[_0x2216('0x17')](_0x511f51[_0x2216('0x27')],function(_0x23952e){var _0x155ae5={};_0x155ae5[_0x23952e]={'$like':'%'+_0x757b25['query'][_0x2216('0x3e')]+'%'};return _0x155ae5;})});}_0x511f51=_[_0x2216('0x2b')]({},_0x511f51,_0x757b25['options']);return db[_0x2216('0x3f')][_0x2216('0x1f')](_0x511f51);}})[_0x2216('0x14')](function(_0xfacb32){if(_0xfacb32){return db[_0x2216('0x40')][_0x2216('0x41')]({'where':{'id':_['map'](_0xfacb32,'UserId'),'role':_0x2216('0x42')},'attributes':['id',_0x2216('0x16'),_0x2216('0x43'),_0x2216('0x44'),_0x2216('0x45')]});}})[_0x2216('0x14')](function(_0x59c411){if(_0x59c411){return{'count':_0x59c411[_0x2216('0xf')],'rows':_['map'](_0x59c411[_0x2216('0x46')],function(_0x1c67df){return{'membername':_0x1c67df['name'],'UserId':_0x1c67df['id'],'queue_name':_0x3c1661[_0x2216('0x16')],'WhatsappQueueId':_0x3c1661['id'],'interface':util['format'](_0x2216('0x47'),'SIP',_0x1c67df[_0x2216('0x16')]),'penalty':0x0,'paused':_0x1c67df[_0x2216('0x43')],'createdAt':_0x1c67df[_0x2216('0x45')],'updatedAt':_0x1c67df[_0x2216('0x44')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1f9e58,_0x511f51))[_0x2216('0x20')](handleError(_0x1f9e58,null));};exports[_0x2216('0x48')]=function(_0x2b9cd8,_0x313a6f){var _0x4763b0={};var _0x143ac1={};var _0x2f5b88;var _0x4139eb;return db[_0x2216('0x18')]['findOne']({'where':{'id':_0x2b9cd8[_0x2216('0x22')]['id']}})['then'](handleEntityNotFound(_0x313a6f,null))['then'](function(_0x2c2090){if(_0x2c2090){_0x2f5b88=_0x2c2090;_0x143ac1['model']=_[_0x2216('0x24')](db[_0x2216('0x49')][_0x2216('0x19')]);_0x143ac1[_0x2216('0x1e')]=_['keys'](_0x2b9cd8[_0x2216('0x1e')]);_0x143ac1[_0x2216('0x25')]=_[_0x2216('0x26')](_0x143ac1[_0x2216('0x23')],_0x143ac1['query']);_0x4763b0[_0x2216('0x27')]=_[_0x2216('0x26')](_0x143ac1[_0x2216('0x23')],qs[_0x2216('0x28')](_0x2b9cd8['query']['fields']));_0x4763b0['attributes']=_0x4763b0[_0x2216('0x27')]['length']?_0x4763b0[_0x2216('0x27')]:_0x143ac1[_0x2216('0x23')];_0x4763b0[_0x2216('0x3b')]=qs[_0x2216('0x3c')](_0x2b9cd8['query']['sort']);_0x4763b0[_0x2216('0x1c')]=qs['filters'](_['pick'](_0x2b9cd8[_0x2216('0x1e')],_0x143ac1[_0x2216('0x25')]));if(_0x2b9cd8[_0x2216('0x1e')][_0x2216('0x3e')]){_0x4763b0[_0x2216('0x1c')]=_[_0x2216('0x2b')](_0x4763b0[_0x2216('0x1c')],{'$or':_['map'](_0x4763b0['attributes'],function(_0x35ffeb){var _0xeac4ff={};_0xeac4ff[_0x35ffeb]={'$like':'%'+_0x2b9cd8[_0x2216('0x1e')]['filter']+'%'};return _0xeac4ff;})});}_0x4763b0=_[_0x2216('0x2b')]({},_0x4763b0,_0x2b9cd8[_0x2216('0x4a')]);return _0x2f5b88[_0x2216('0x48')](_0x4763b0);}})[_0x2216('0x14')](function(_0x4498c2){if(_0x4498c2){_0x4139eb=_0x4498c2[_0x2216('0x29')];if(!_0x2b9cd8[_0x2216('0x1e')][_0x2216('0x39')]('nolimit')){_0x4763b0[_0x2216('0xe')]=qs[_0x2216('0xe')](_0x2b9cd8[_0x2216('0x1e')][_0x2216('0xe')]);_0x4763b0[_0x2216('0xc')]=qs[_0x2216('0xc')](_0x2b9cd8[_0x2216('0x1e')][_0x2216('0xc')]);}return _0x2f5b88['getTeams'](_0x4763b0);}})['then'](function(_0x550c33){if(_0x550c33){return _0x550c33?{'count':_0x4139eb,'rows':_0x550c33}:null;}})[_0x2216('0x14')](respondWithResult(_0x313a6f,null))[_0x2216('0x20')](handleError(_0x313a6f,null));};exports[_0x2216('0x4b')]=function(_0x3a861e,_0x4f5e12){var _0x51ced6=_0x3a861e[_0x2216('0x2e')][_0x2216('0x4c')];return db['Team'][_0x2216('0x1f')]({'where':{'id':_0x51ced6},'attributes':['id'],'include':[{'model':db[_0x2216('0x40')],'as':_0x2216('0x4d'),'attributes':['id',_0x2216('0x16'),_0x2216('0x4e'),_0x2216('0x4f'),_0x2216('0x50')],'raw':!![]}]})[_0x2216('0x14')](function(_0x227950){if(_0x227950){var _0x5af0ba=_[_0x2216('0x51')](_0x227950,function(_0x5c1581){var _0x35487c=_0x5c1581[_0x2216('0x30')]({'plain':!![]});return _0x35487c[_0x2216('0x4d')];});return db[_0x2216('0x18')]['find']({'where':{'id':_0x3a861e['params']['id']}})[_0x2216('0x14')](function(_0x5197be){return db[_0x2216('0x52')][_0x2216('0x53')](function(_0x36c945){return _0x5197be[_0x2216('0x4b')](_0x51ced6,{'transaction':_0x36c945})['then'](function(){return BPromise[_0x2216('0x54')](_0x5af0ba,function(_0x52cdd6){return db[_0x2216('0x3f')][_0x2216('0x55')]({'where':{'UserId':_0x52cdd6['id'],'WhatsappQueueId':_0x3a861e['params']['id']},'transaction':_0x36c945});});})[_0x2216('0x14')](function(){_0x5af0ba[_0x2216('0x56')](function(_0x471537){socket['emit'](_0x2216('0x57'),{'UserId':_0x471537['id'],'WhatsappQueueId':_0x5197be['id']});});});});});}})[_0x2216('0x14')](respondWithStatusCode(_0x4f5e12,null))[_0x2216('0x20')](handleError(_0x4f5e12,null));};exports['removeTeams']=function(_0x473bc8,_0x460030){return db[_0x2216('0x49')][_0x2216('0x1f')]({'where':{'id':_0x473bc8['query'][_0x2216('0x4c')]},'attributes':['id'],'include':[{'model':db[_0x2216('0x40')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2216('0x14')](handleEntityNotFound(_0x460030,null))['then'](function(_0x3c23cc){var _0x8c8dad=_['map'](_0x3c23cc,'id');var _0x1e3f0d=[];var _0x4618d7=[];var _0x272e21=squel[_0x2216('0x58')]();_0x272e21[_0x2216('0x59')](_0x2216('0x5a'))['from']('team_has_whatsapp_queues','tq')['join'](_0x2216('0x5b'),'ut',_0x2216('0x5c'))[_0x2216('0x1c')](_0x2216('0x5d'),_0x473bc8[_0x2216('0x22')]['id']);for(var _0x31fab6=0x0;_0x31fab6<_0x3c23cc['length'];_0x31fab6+=0x1){let _0x41ccb8=_0x3c23cc[_0x31fab6];for(var _0x3c6f84=0x0;_0x3c6f84<_0x41ccb8['Agents'][_0x2216('0x29')];_0x3c6f84+=0x1){let _0x229afb=_0x41ccb8[_0x2216('0x4d')][_0x3c6f84];var _0x2b913e=_0x272e21[_0x2216('0x5e')]();_0x2b913e[_0x2216('0x1c')](_0x2216('0x5f'),_0x229afb['id']);_0x4618d7[_0x2216('0x60')](db[_0x2216('0x52')][_0x2216('0x1e')](_0x2b913e[_0x2216('0x61')](),{'type':db[_0x2216('0x52')][_0x2216('0x62')][_0x2216('0x63')]})[_0x2216('0x14')](function(_0x57d5be){if(_0x57d5be[_0x2216('0x29')]===0x1){return _0x229afb['id'];}else{var _0xcc10a0=_['every'](_['map'](_0x57d5be,_0x2216('0x64')),function(_0x58b06b){return _[_0x2216('0x65')](_0x8c8dad,_0x58b06b);});if(_0xcc10a0){return _0x229afb['id'];}}}));}}return BPromise[_0x2216('0x66')](_0x4618d7)['then'](function(_0x3c7cb3){_0x1e3f0d=_(_0x1e3f0d)[_0x2216('0x67')](_0x3c7cb3)[_0x2216('0x68')]()[_0x2216('0x69')]();return db[_0x2216('0x18')][_0x2216('0x2c')]({'where':{'id':_0x473bc8[_0x2216('0x22')]['id']}})[_0x2216('0x14')](function(_0x3b7392){return db[_0x2216('0x52')][_0x2216('0x53')](function(_0x551359){return _0x3b7392[_0x2216('0x6a')](_0x473bc8['query'][_0x2216('0x4c')],{'transaction':_0x551359})[_0x2216('0x14')](function(){if(!_[_0x2216('0x6b')](_0x1e3f0d)){return _0x3b7392['removeAgents'](_0x1e3f0d,{'transaction':_0x551359});}})[_0x2216('0x14')](function(){_0x1e3f0d[_0x2216('0x56')](function(_0x47afd8){socket[_0x2216('0x6c')](_0x2216('0x6d'),{'UserId':_0x47afd8,'WhatsappQueueId':_0x3b7392['id']});});});});});});})['then'](respondWithStatusCode(_0x460030,null))[_0x2216('0x20')](handleError(_0x460030,null));};exports[_0x2216('0x6e')]=function(_0x2f1ab1,_0x5aa716){return db[_0x2216('0x18')][_0x2216('0x2c')]({'where':{'id':_0x2f1ab1[_0x2216('0x22')]['id']}})[_0x2216('0x14')](handleEntityNotFound(_0x5aa716,null))[_0x2216('0x14')](function(_0x4aff35){if(_0x4aff35){return _0x4aff35[_0x2216('0x6e')](_0x2f1ab1['body'][_0x2216('0x4c')],_[_0x2216('0x6f')](_0x2f1ab1[_0x2216('0x2e')],[_0x2216('0x4c'),'id'])||{})['spread'](function(_0x5087ba){for(var _0x290e41=0x0;_0x290e41<_0x2f1ab1[_0x2216('0x2e')][_0x2216('0x4c')][_0x2216('0x29')];_0x290e41+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x2f1ab1[_0x2216('0x2e')][_0x2216('0x4c')][_0x290e41]),'WhatsappQueueId':Number(_0x2f1ab1[_0x2216('0x22')]['id'])});}return _0x5087ba;});}})['then'](respondWithResult(_0x5aa716,null))['catch'](handleError(_0x5aa716,null));};exports[_0x2216('0x70')]=function(_0x12dd19,_0x12b556){return db[_0x2216('0x18')]['find']({'where':{'id':_0x12dd19[_0x2216('0x22')]['id']}})[_0x2216('0x14')](handleEntityNotFound(_0x12b556,null))[_0x2216('0x14')](function(_0x25d7b7){if(_0x25d7b7){return _0x25d7b7['removeAgents'](_0x12dd19[_0x2216('0x1e')][_0x2216('0x4c')])[_0x2216('0x14')](function(){if(_[_0x2216('0x71')](_0x12dd19[_0x2216('0x1e')][_0x2216('0x4c')])){for(var _0x209f12=0x0;_0x209f12<_0x12dd19[_0x2216('0x1e')][_0x2216('0x4c')][_0x2216('0x29')];_0x209f12+=0x1){socket[_0x2216('0x6c')](_0x2216('0x6d'),{'UserId':Number(_0x12dd19[_0x2216('0x1e')]['ids'][_0x209f12]),'WhatsappQueueId':Number(_0x12dd19[_0x2216('0x22')]['id'])});}}else{socket[_0x2216('0x6c')](_0x2216('0x6d'),{'UserId':Number(_0x12dd19[_0x2216('0x1e')][_0x2216('0x4c')]),'WhatsappQueueId':Number(_0x12dd19[_0x2216('0x22')]['id'])});}});}})[_0x2216('0x14')](respondWithStatusCode(_0x12b556,null))[_0x2216('0x20')](handleError(_0x12b556,null));};exports[_0x2216('0x72')]=function(_0x51d294,_0x207f17){var _0x57adc6={};var _0xacb93c={};var _0x1f0671;var _0x88209c;return db['WhatsappQueue'][_0x2216('0x38')]({'where':{'id':_0x51d294['params']['id']}})['then'](handleEntityNotFound(_0x207f17,null))[_0x2216('0x14')](function(_0x2e77a3){if(_0x2e77a3){_0x1f0671=_0x2e77a3;_0xacb93c[_0x2216('0x23')]=_[_0x2216('0x24')](db[_0x2216('0x40')]['rawAttributes']);_0xacb93c[_0x2216('0x1e')]=_[_0x2216('0x24')](_0x51d294[_0x2216('0x1e')]);_0xacb93c['filters']=_[_0x2216('0x26')](_0xacb93c['model'],_0xacb93c[_0x2216('0x1e')]);_0x57adc6[_0x2216('0x27')]=_['intersection'](_0xacb93c['model'],qs[_0x2216('0x28')](_0x51d294[_0x2216('0x1e')][_0x2216('0x28')]));_0x57adc6['attributes']=_0x57adc6['attributes']['length']?_0x57adc6[_0x2216('0x27')]:_0xacb93c[_0x2216('0x23')];_0x57adc6['order']=qs[_0x2216('0x3c')](_0x51d294['query'][_0x2216('0x3c')]);_0x57adc6[_0x2216('0x1c')]=qs['filters'](_['pick'](_0x51d294[_0x2216('0x1e')],_0xacb93c['filters']));if(_0x51d294[_0x2216('0x1e')][_0x2216('0x3e')]){_0x57adc6[_0x2216('0x1c')]=_[_0x2216('0x2b')](_0x57adc6[_0x2216('0x1c')],{'$or':_['map'](_0x57adc6[_0x2216('0x27')],function(_0x105471){var _0x59f9d5={};_0x59f9d5[_0x105471]={'$like':'%'+_0x51d294[_0x2216('0x1e')][_0x2216('0x3e')]+'%'};return _0x59f9d5;})});}_0x57adc6=_[_0x2216('0x2b')]({},_0x57adc6,_0x51d294['options']);return _0x1f0671[_0x2216('0x72')](_0x57adc6);}})[_0x2216('0x14')](function(_0x2ed10d){if(_0x2ed10d){_0x88209c=_0x2ed10d[_0x2216('0x29')];if(!_0x51d294[_0x2216('0x1e')][_0x2216('0x39')]('nolimit')){_0x57adc6[_0x2216('0xe')]=qs[_0x2216('0xe')](_0x51d294[_0x2216('0x1e')]['limit']);_0x57adc6[_0x2216('0xc')]=qs['offset'](_0x51d294[_0x2216('0x1e')]['offset']);}return _0x1f0671['getAgents'](_0x57adc6);}})['then'](function(_0x20d8c8){if(_0x20d8c8){return _0x20d8c8?{'count':_0x88209c,'rows':_0x20d8c8}:null;}})[_0x2216('0x14')](respondWithResult(_0x207f17,null))['catch'](handleError(_0x207f17,null));}; \ No newline at end of file +var _0x345d=['params','keys','filters','attributes','intersection','fields','length','model','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','order','sort','pick','WhatsappQueueId','filter','merge','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','nolimit','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','catch'];(function(_0xee741b,_0x10cf16){var _0x9ce0a2=function(_0x196418){while(--_0x196418){_0xee741b['push'](_0xee741b['shift']());}};_0x9ce0a2(++_0x10cf16);}(_0x345d,0x150));var _0xd345=function(_0x5ee673,_0x4ee30e){_0x5ee673=_0x5ee673-0x0;var _0x3cb63f=_0x345d[_0x5ee673];return _0x3cb63f;};'use strict';var BPromise=require(_0xd345('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xd345('0x1'));var Redis=require(_0xd345('0x2'));var qs=require(_0xd345('0x3'));var logger=require(_0xd345('0x4'))(_0xd345('0x5'));var config=require(_0xd345('0x6'));var db=require(_0xd345('0x7'))['db'];config['redis']=_['defaults'](config[_0xd345('0x8')],{'host':_0xd345('0x9'),'port':0x18eb});var socket=require(_0xd345('0xa'))(new Redis(config[_0xd345('0x8')]));require('./whatsappQueue.socket')[_0xd345('0xb')](socket);function respondWithStatusCode(_0x59af35,_0x48e879){_0x48e879=_0x48e879||0xcc;return function(_0x39dbeb){if(_0x39dbeb){return _0x59af35[_0xd345('0xc')](_0x48e879);}return _0x59af35[_0xd345('0xd')](_0x48e879)['end']();};}function respondWithResult(_0xa9b006,_0x36f2a1){_0x36f2a1=_0x36f2a1||0xc8;return function(_0xd6083e){if(_0xd6083e){return _0xa9b006[_0xd345('0xd')](_0x36f2a1)[_0xd345('0xe')](_0xd6083e);}};}function respondWithFilteredResult(_0x43914b,_0x336a79){return function(_0x1839a1){if(_0x1839a1){var _0x3d8121=typeof _0x336a79[_0xd345('0xf')]===_0xd345('0x10')&&typeof _0x336a79['limit']===_0xd345('0x10');var _0x47f4e8=_0x1839a1[_0xd345('0x11')];var _0x19fd95=_0x3d8121?0x0:_0x336a79[_0xd345('0xf')];var _0x20d055=_0x3d8121?_0x1839a1[_0xd345('0x11')]:_0x336a79[_0xd345('0xf')]+_0x336a79[_0xd345('0x12')];var _0x5890de;if(_0x20d055>=_0x47f4e8){_0x20d055=_0x47f4e8;_0x5890de=0xc8;}else{_0x5890de=0xce;}_0x43914b[_0xd345('0xd')](_0x5890de);return _0x43914b[_0xd345('0x13')](_0xd345('0x14'),_0x19fd95+'-'+_0x20d055+'/'+_0x47f4e8)[_0xd345('0xe')](_0x1839a1);}return null;};}function saveUpdates(_0x57126e){return function(_0x152940){if(_0x152940){return _0x152940[_0xd345('0x15')](_0x57126e)[_0xd345('0x16')](function(_0xef2731){return _0xef2731;});}return null;};}function removeEntity(_0x40d075){return function(_0x4d7c17){if(_0x4d7c17){return _0x4d7c17[_0xd345('0x17')]()[_0xd345('0x16')](function(){var _0x3064d2=_0x4d7c17[_0xd345('0x18')]({'plain':!![]});var _0x5f5c00=_0xd345('0x19');return db[_0xd345('0x1a')][_0xd345('0x17')]({'where':{'type':_0x5f5c00,'resourceId':_0x3064d2['id']}})['then'](function(){return _0x4d7c17;});})[_0xd345('0x16')](function(){_0x40d075['status'](0xcc)[_0xd345('0x1b')]();});}};}function handleEntityNotFound(_0x11f3bd){return function(_0x38c290){if(!_0x38c290){_0x11f3bd[_0xd345('0xc')](0x194);}return _0x38c290;};}function handleError(_0x5c1757,_0x4db933){_0x4db933=_0x4db933||0x1f4;return function(_0x54813c){logger[_0xd345('0x1c')](_0x54813c[_0xd345('0x1d')]);if(_0x54813c[_0xd345('0x1e')]){delete _0x54813c[_0xd345('0x1e')];}_0x5c1757[_0xd345('0xd')](_0x4db933)[_0xd345('0x1f')](_0x54813c);};}exports[_0xd345('0x20')]=function(_0x4e266c,_0x2b725d){var _0x3788b7={};var _0x27c396={'count':0x0,'rows':[]};var _0x44a9e9=_[_0xd345('0x21')](db[_0xd345('0x22')][_0xd345('0x23')],function(_0x28050a){return{'name':_0x28050a[_0xd345('0x24')],'type':_0x28050a['type'][_0xd345('0x25')]};});_0x3788b7=qs[_0xd345('0x26')](_0x44a9e9,_0x4e266c);var _0x4fda15={'where':_0x3788b7[_0xd345('0x27')]};return db[_0xd345('0x22')][_0xd345('0x11')](_0x4fda15)['then'](function(_0x15de9d){_0x27c396['count']=_0x15de9d;_0x3788b7[_0xd345('0x28')]=qs[_0xd345('0x28')](_0x4e266c[_0xd345('0x29')]);return db[_0xd345('0x22')][_0xd345('0x2a')](_0x3788b7);})[_0xd345('0x16')](function(_0x312f19){_0x27c396[_0xd345('0x2b')]=_0x312f19;return _0x27c396;})[_0xd345('0x16')](respondWithFilteredResult(_0x2b725d,_0x3788b7))[_0xd345('0x2c')](handleError(_0x2b725d,null));};exports['show']=function(_0x39a203,_0x1e01d1){var _0x4de3ac={'raw':!![],'where':{'id':_0x39a203[_0xd345('0x2d')]['id']}},_0x354f4a={};_0x354f4a['model']=_[_0xd345('0x2e')](db['WhatsappQueue'][_0xd345('0x23')]);_0x354f4a[_0xd345('0x29')]=_[_0xd345('0x2e')](_0x39a203[_0xd345('0x29')]);_0x354f4a[_0xd345('0x2f')]=_['intersection'](_0x354f4a['model'],_0x354f4a[_0xd345('0x29')]);_0x4de3ac[_0xd345('0x30')]=_[_0xd345('0x31')](_0x354f4a['model'],qs[_0xd345('0x32')](_0x39a203[_0xd345('0x29')][_0xd345('0x32')]));_0x4de3ac[_0xd345('0x30')]=_0x4de3ac['attributes'][_0xd345('0x33')]?_0x4de3ac[_0xd345('0x30')]:_0x354f4a[_0xd345('0x34')];if(_0x39a203[_0xd345('0x29')][_0xd345('0x35')]){_0x4de3ac[_0xd345('0x28')]=[{'all':!![]}];}_0x4de3ac=_['merge']({},_0x4de3ac,_0x39a203[_0xd345('0x36')]);return db[_0xd345('0x22')][_0xd345('0x37')](_0x4de3ac)[_0xd345('0x16')](handleEntityNotFound(_0x1e01d1,null))[_0xd345('0x16')](respondWithResult(_0x1e01d1,null))['catch'](handleError(_0x1e01d1,null));};exports[_0xd345('0x38')]=function(_0x42b6a7,_0xf0086f){return db[_0xd345('0x22')][_0xd345('0x38')](_0x42b6a7['body'],{})[_0xd345('0x16')](function(_0x2f016f){var _0x25e3dd=_0x42b6a7[_0xd345('0x39')][_0xd345('0x18')]({'plain':!![]});if(!_0x25e3dd)throw new Error(_0xd345('0x3a'));if(_0x25e3dd[_0xd345('0x3b')]===_0xd345('0x39')){var _0x36d093=_0x2f016f['get']({'plain':!![]});var _0x5285c2=_0xd345('0x19');return db[_0xd345('0x3c')][_0xd345('0x37')]({'where':{'name':_0x5285c2,'userProfileId':_0x25e3dd[_0xd345('0x3d')]},'raw':!![]})[_0xd345('0x16')](function(_0x1cae13){if(_0x1cae13&&_0x1cae13[_0xd345('0x3e')]===0x0){return db[_0xd345('0x1a')][_0xd345('0x38')]({'name':_0x36d093['name'],'resourceId':_0x36d093['id'],'type':_0x1cae13['name'],'sectionId':_0x1cae13['id']},{})[_0xd345('0x16')](function(){return _0x2f016f;});}else{return _0x2f016f;}})['catch'](function(_0x5a161c){logger[_0xd345('0x1c')](_0xd345('0x3f'),_0x5a161c);throw _0x5a161c;});}return _0x2f016f;})[_0xd345('0x16')](respondWithResult(_0xf0086f,0xc9))['catch'](handleError(_0xf0086f,null));};exports[_0xd345('0x15')]=function(_0x1754a4,_0x3cd09c){if(_0x1754a4[_0xd345('0x40')]['id']){delete _0x1754a4[_0xd345('0x40')]['id'];}return db['WhatsappQueue'][_0xd345('0x37')]({'where':{'id':_0x1754a4[_0xd345('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3cd09c,null))[_0xd345('0x16')](saveUpdates(_0x1754a4[_0xd345('0x40')],null))[_0xd345('0x16')](respondWithResult(_0x3cd09c,null))['catch'](handleError(_0x3cd09c,null));};exports[_0xd345('0x17')]=function(_0x17e7bd,_0x360f58){return db[_0xd345('0x22')][_0xd345('0x37')]({'where':{'id':_0x17e7bd[_0xd345('0x2d')]['id']}})[_0xd345('0x16')](handleEntityNotFound(_0x360f58,null))[_0xd345('0x16')](removeEntity(_0x360f58,null))[_0xd345('0x2c')](handleError(_0x360f58,null));};exports[_0xd345('0x41')]=function(_0x20faa2,_0x15dc07){return db['WhatsappQueue'][_0xd345('0x41')]()[_0xd345('0x16')](respondWithResult(_0x15dc07,null))[_0xd345('0x2c')](handleError(_0x15dc07,null));};exports[_0xd345('0x42')]=function(_0x3d386c,_0x56dc9d){var _0x3e4b35={'raw':!![],'where':{}},_0x476601={},_0x33d579;return db[_0xd345('0x22')][_0xd345('0x43')]({'where':{'id':_0x3d386c[_0xd345('0x2d')]['id']}})[_0xd345('0x16')](handleEntityNotFound(_0x56dc9d,null))[_0xd345('0x16')](function(_0x306b5d){if(_0x306b5d){_0x33d579=_0x306b5d[_0xd345('0x18')]({'plain':!![]});_0x476601['model']=_[_0xd345('0x2e')](db['UserWhatsappQueue'][_0xd345('0x23')]);_0x476601[_0xd345('0x29')]=_[_0xd345('0x2e')](_0x3d386c['query']);_0x476601[_0xd345('0x2f')]=_[_0xd345('0x31')](_0x476601['model'],_0x476601[_0xd345('0x29')]);_0x3e4b35[_0xd345('0x30')]=_[_0xd345('0x31')](_0x476601['model'],qs[_0xd345('0x32')](_0x3d386c[_0xd345('0x29')][_0xd345('0x32')]));_0x3e4b35[_0xd345('0x30')]=_0x3e4b35['attributes'][_0xd345('0x33')]?_0x3e4b35[_0xd345('0x30')]:_0x476601[_0xd345('0x34')];if(!_0x3d386c[_0xd345('0x29')]['hasOwnProperty']('nolimit')){_0x3e4b35['limit']=qs[_0xd345('0x12')](_0x3d386c['query'][_0xd345('0x12')]);_0x3e4b35[_0xd345('0xf')]=qs[_0xd345('0xf')](_0x3d386c[_0xd345('0x29')][_0xd345('0xf')]);}_0x3e4b35[_0xd345('0x44')]=qs[_0xd345('0x45')](_0x3d386c[_0xd345('0x29')][_0xd345('0x45')]);_0x3e4b35[_0xd345('0x27')]=qs[_0xd345('0x2f')](_[_0xd345('0x46')](_0x3d386c[_0xd345('0x29')],_0x476601[_0xd345('0x2f')]));_0x3e4b35[_0xd345('0x27')][_0xd345('0x47')]=_0x306b5d['id'];if(_0x3d386c[_0xd345('0x29')][_0xd345('0x48')]){_0x3e4b35[_0xd345('0x27')]=_[_0xd345('0x49')](_0x3e4b35['where'],{'$or':_['map'](_0x3e4b35[_0xd345('0x30')],function(_0x10043c){var _0x46607b={};_0x46607b[_0x10043c]={'$like':'%'+_0x3d386c[_0xd345('0x29')][_0xd345('0x48')]+'%'};return _0x46607b;})});}_0x3e4b35=_[_0xd345('0x49')]({},_0x3e4b35,_0x3d386c[_0xd345('0x36')]);return db[_0xd345('0x4a')]['findAll'](_0x3e4b35);}})[_0xd345('0x16')](function(_0x14e122){if(_0x14e122){return db[_0xd345('0x4b')][_0xd345('0x4c')]({'where':{'id':_['map'](_0x14e122,_0xd345('0x4d')),'role':_0xd345('0x4e')},'attributes':['id',_0xd345('0x1e'),_0xd345('0x4f'),_0xd345('0x50'),_0xd345('0x51')]});}})['then'](function(_0x1ad560){if(_0x1ad560){return{'count':_0x1ad560[_0xd345('0x11')],'rows':_['map'](_0x1ad560[_0xd345('0x2b')],function(_0xf77aef){return{'membername':_0xf77aef[_0xd345('0x1e')],'UserId':_0xf77aef['id'],'queue_name':_0x33d579[_0xd345('0x1e')],'WhatsappQueueId':_0x33d579['id'],'interface':util[_0xd345('0x52')](_0xd345('0x53'),'SIP',_0xf77aef[_0xd345('0x1e')]),'penalty':0x0,'paused':_0xf77aef[_0xd345('0x4f')],'createdAt':_0xf77aef['createdAt'],'updatedAt':_0xf77aef[_0xd345('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x56dc9d,_0x3e4b35))[_0xd345('0x2c')](handleError(_0x56dc9d,null));};exports[_0xd345('0x54')]=function(_0x5c458b,_0x318802){var _0x41689e={};var _0x4c700d={};var _0x14cd44;var _0x231ba7;return db['WhatsappQueue'][_0xd345('0x43')]({'where':{'id':_0x5c458b[_0xd345('0x2d')]['id']}})[_0xd345('0x16')](handleEntityNotFound(_0x318802,null))[_0xd345('0x16')](function(_0x531d7b){if(_0x531d7b){_0x14cd44=_0x531d7b;_0x4c700d[_0xd345('0x34')]=_[_0xd345('0x2e')](db[_0xd345('0x55')][_0xd345('0x23')]);_0x4c700d[_0xd345('0x29')]=_['keys'](_0x5c458b[_0xd345('0x29')]);_0x4c700d[_0xd345('0x2f')]=_[_0xd345('0x31')](_0x4c700d['model'],_0x4c700d[_0xd345('0x29')]);_0x41689e[_0xd345('0x30')]=_[_0xd345('0x31')](_0x4c700d[_0xd345('0x34')],qs['fields'](_0x5c458b[_0xd345('0x29')][_0xd345('0x32')]));_0x41689e[_0xd345('0x30')]=_0x41689e[_0xd345('0x30')][_0xd345('0x33')]?_0x41689e[_0xd345('0x30')]:_0x4c700d[_0xd345('0x34')];_0x41689e[_0xd345('0x44')]=qs[_0xd345('0x45')](_0x5c458b['query'][_0xd345('0x45')]);_0x41689e[_0xd345('0x27')]=qs[_0xd345('0x2f')](_[_0xd345('0x46')](_0x5c458b[_0xd345('0x29')],_0x4c700d[_0xd345('0x2f')]));if(_0x5c458b[_0xd345('0x29')]['filter']){_0x41689e[_0xd345('0x27')]=_[_0xd345('0x49')](_0x41689e[_0xd345('0x27')],{'$or':_[_0xd345('0x21')](_0x41689e['attributes'],function(_0x2181c2){var _0x5be700={};_0x5be700[_0x2181c2]={'$like':'%'+_0x5c458b[_0xd345('0x29')][_0xd345('0x48')]+'%'};return _0x5be700;})});}_0x41689e=_['merge']({},_0x41689e,_0x5c458b[_0xd345('0x36')]);return _0x14cd44[_0xd345('0x54')](_0x41689e);}})[_0xd345('0x16')](function(_0x4dba03){if(_0x4dba03){_0x231ba7=_0x4dba03[_0xd345('0x33')];if(!_0x5c458b['query'][_0xd345('0x56')]('nolimit')){_0x41689e[_0xd345('0x12')]=qs['limit'](_0x5c458b[_0xd345('0x29')][_0xd345('0x12')]);_0x41689e[_0xd345('0xf')]=qs[_0xd345('0xf')](_0x5c458b['query'][_0xd345('0xf')]);}return _0x14cd44[_0xd345('0x54')](_0x41689e);}})['then'](function(_0x4da6db){if(_0x4da6db){return _0x4da6db?{'count':_0x231ba7,'rows':_0x4da6db}:null;}})['then'](respondWithResult(_0x318802,null))['catch'](handleError(_0x318802,null));};exports[_0xd345('0x57')]=function(_0xb7324c,_0x35c498){var _0x1e6fcf=_0xb7324c['body'][_0xd345('0x58')];return db[_0xd345('0x55')]['findAll']({'where':{'id':_0x1e6fcf},'attributes':['id'],'include':[{'model':db[_0xd345('0x4b')],'as':_0xd345('0x59'),'attributes':['id',_0xd345('0x1e'),'online',_0xd345('0x5a'),_0xd345('0x5b')],'raw':!![]}]})[_0xd345('0x16')](function(_0x199deb){if(_0x199deb){var _0x1894e6=_[_0xd345('0x5c')](_0x199deb,function(_0x931c52){var _0x2d6591=_0x931c52[_0xd345('0x18')]({'plain':!![]});return _0x2d6591[_0xd345('0x59')];});return db[_0xd345('0x22')][_0xd345('0x37')]({'where':{'id':_0xb7324c['params']['id']}})[_0xd345('0x16')](function(_0x5bcfc8){return db[_0xd345('0x5d')][_0xd345('0x5e')](function(_0x46af07){return _0x5bcfc8[_0xd345('0x57')](_0x1e6fcf,{'transaction':_0x46af07})[_0xd345('0x16')](function(){return BPromise[_0xd345('0x5f')](_0x1894e6,function(_0x4a4f19){return db['UserWhatsappQueue'][_0xd345('0x60')]({'where':{'UserId':_0x4a4f19['id'],'WhatsappQueueId':_0xb7324c['params']['id']},'transaction':_0x46af07});});})[_0xd345('0x16')](function(){_0x1894e6[_0xd345('0x61')](function(_0x59cf6a){socket['emit'](_0xd345('0x62'),{'UserId':_0x59cf6a['id'],'WhatsappQueueId':_0x5bcfc8['id']});});});});});}})['then'](respondWithStatusCode(_0x35c498,null))[_0xd345('0x2c')](handleError(_0x35c498,null));};exports[_0xd345('0x63')]=function(_0x48448c,_0x26b523){return db[_0xd345('0x55')][_0xd345('0x2a')]({'where':{'id':_0x48448c[_0xd345('0x29')][_0xd345('0x58')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd345('0x59'),'attributes':['id'],'raw':!![]}]})[_0xd345('0x16')](handleEntityNotFound(_0x26b523,null))['then'](function(_0xb3c3d3){var _0x2f2549=_[_0xd345('0x21')](_0xb3c3d3,'id');var _0x18c0b0=[];var _0x25d170=[];var _0x599fcd=squel[_0xd345('0x64')]();_0x599fcd[_0xd345('0x65')](_0xd345('0x66'))[_0xd345('0x67')](_0xd345('0x68'),'tq')['join'](_0xd345('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd345('0x27')]('WhatsappQueueId\x20=\x20?',_0x48448c[_0xd345('0x2d')]['id']);for(var _0x25c5cc=0x0;_0x25c5cc<_0xb3c3d3[_0xd345('0x33')];_0x25c5cc+=0x1){let _0x394824=_0xb3c3d3[_0x25c5cc];for(var _0x543644=0x0;_0x543644<_0x394824['Agents'][_0xd345('0x33')];_0x543644+=0x1){let _0x48705a=_0x394824[_0xd345('0x59')][_0x543644];var _0x66321f=_0x599fcd[_0xd345('0x6a')]();_0x66321f[_0xd345('0x27')](_0xd345('0x6b'),_0x48705a['id']);_0x25d170[_0xd345('0x6c')](db[_0xd345('0x5d')][_0xd345('0x29')](_0x66321f['toString'](),{'type':db[_0xd345('0x5d')][_0xd345('0x6d')][_0xd345('0x6e')]})[_0xd345('0x16')](function(_0x3a4e53){if(_0x3a4e53['length']===0x1){return _0x48705a['id'];}else{var _0x599cd7=_[_0xd345('0x6f')](_[_0xd345('0x21')](_0x3a4e53,_0xd345('0x70')),function(_0x15a616){return _[_0xd345('0x71')](_0x2f2549,_0x15a616);});if(_0x599cd7){return _0x48705a['id'];}}}));}}return BPromise['all'](_0x25d170)['then'](function(_0x3920f7){_0x18c0b0=_(_0x18c0b0)[_0xd345('0x72')](_0x3920f7)[_0xd345('0x73')]()[_0xd345('0x74')]();return db['WhatsappQueue'][_0xd345('0x37')]({'where':{'id':_0x48448c[_0xd345('0x2d')]['id']}})[_0xd345('0x16')](function(_0x148b50){return db['sequelize'][_0xd345('0x5e')](function(_0x5b54bc){return _0x148b50['removeTeams'](_0x48448c[_0xd345('0x29')][_0xd345('0x58')],{'transaction':_0x5b54bc})[_0xd345('0x16')](function(){if(!_[_0xd345('0x75')](_0x18c0b0)){return _0x148b50['removeAgents'](_0x18c0b0,{'transaction':_0x5b54bc});}})[_0xd345('0x16')](function(){_0x18c0b0[_0xd345('0x61')](function(_0x3b84a4){socket[_0xd345('0x76')](_0xd345('0x77'),{'UserId':_0x3b84a4,'WhatsappQueueId':_0x148b50['id']});});});});});});})[_0xd345('0x16')](respondWithStatusCode(_0x26b523,null))[_0xd345('0x2c')](handleError(_0x26b523,null));};exports[_0xd345('0x78')]=function(_0x3145e2,_0x2790c3){return db[_0xd345('0x22')][_0xd345('0x37')]({'where':{'id':_0x3145e2['params']['id']}})['then'](handleEntityNotFound(_0x2790c3,null))[_0xd345('0x16')](function(_0x8eabcc){if(_0x8eabcc){return _0x8eabcc[_0xd345('0x78')](_0x3145e2[_0xd345('0x40')]['ids'],_[_0xd345('0x79')](_0x3145e2[_0xd345('0x40')],[_0xd345('0x58'),'id'])||{})[_0xd345('0x7a')](function(_0x4baea0){for(var _0x18fa3d=0x0;_0x18fa3d<_0x3145e2[_0xd345('0x40')]['ids']['length'];_0x18fa3d+=0x1){socket[_0xd345('0x76')](_0xd345('0x62'),{'UserId':Number(_0x3145e2[_0xd345('0x40')][_0xd345('0x58')][_0x18fa3d]),'WhatsappQueueId':Number(_0x3145e2[_0xd345('0x2d')]['id'])});}return _0x4baea0;});}})[_0xd345('0x16')](respondWithResult(_0x2790c3,null))[_0xd345('0x2c')](handleError(_0x2790c3,null));};exports[_0xd345('0x7b')]=function(_0x2a7b5e,_0x3cc7ab){return db[_0xd345('0x22')]['find']({'where':{'id':_0x2a7b5e[_0xd345('0x2d')]['id']}})[_0xd345('0x16')](handleEntityNotFound(_0x3cc7ab,null))['then'](function(_0xe35bdc){if(_0xe35bdc){return _0xe35bdc['removeAgents'](_0x2a7b5e[_0xd345('0x29')]['ids'])[_0xd345('0x16')](function(){if(_[_0xd345('0x7c')](_0x2a7b5e['query']['ids'])){for(var _0x2ee972=0x0;_0x2ee972<_0x2a7b5e['query'][_0xd345('0x58')][_0xd345('0x33')];_0x2ee972+=0x1){socket[_0xd345('0x76')](_0xd345('0x77'),{'UserId':Number(_0x2a7b5e[_0xd345('0x29')][_0xd345('0x58')][_0x2ee972]),'WhatsappQueueId':Number(_0x2a7b5e[_0xd345('0x2d')]['id'])});}}else{socket[_0xd345('0x76')]('userWhatsappQueue:remove',{'UserId':Number(_0x2a7b5e['query'][_0xd345('0x58')]),'WhatsappQueueId':Number(_0x2a7b5e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3cc7ab,null))[_0xd345('0x2c')](handleError(_0x3cc7ab,null));};exports[_0xd345('0x7d')]=function(_0x18cba2,_0x27ee95){var _0x11bca0={};var _0x38a85b={};var _0xc32711;var _0x3a52fc;return db['WhatsappQueue']['findOne']({'where':{'id':_0x18cba2[_0xd345('0x2d')]['id']}})['then'](handleEntityNotFound(_0x27ee95,null))['then'](function(_0x29f79c){if(_0x29f79c){_0xc32711=_0x29f79c;_0x38a85b[_0xd345('0x34')]=_[_0xd345('0x2e')](db[_0xd345('0x4b')][_0xd345('0x23')]);_0x38a85b[_0xd345('0x29')]=_[_0xd345('0x2e')](_0x18cba2[_0xd345('0x29')]);_0x38a85b[_0xd345('0x2f')]=_['intersection'](_0x38a85b['model'],_0x38a85b[_0xd345('0x29')]);_0x11bca0['attributes']=_[_0xd345('0x31')](_0x38a85b[_0xd345('0x34')],qs[_0xd345('0x32')](_0x18cba2[_0xd345('0x29')][_0xd345('0x32')]));_0x11bca0['attributes']=_0x11bca0[_0xd345('0x30')]['length']?_0x11bca0[_0xd345('0x30')]:_0x38a85b['model'];_0x11bca0[_0xd345('0x44')]=qs[_0xd345('0x45')](_0x18cba2[_0xd345('0x29')][_0xd345('0x45')]);_0x11bca0[_0xd345('0x27')]=qs[_0xd345('0x2f')](_[_0xd345('0x46')](_0x18cba2['query'],_0x38a85b['filters']));if(_0x18cba2[_0xd345('0x29')][_0xd345('0x48')]){_0x11bca0[_0xd345('0x27')]=_[_0xd345('0x49')](_0x11bca0[_0xd345('0x27')],{'$or':_[_0xd345('0x21')](_0x11bca0[_0xd345('0x30')],function(_0x560b15){var _0x6d1520={};_0x6d1520[_0x560b15]={'$like':'%'+_0x18cba2[_0xd345('0x29')]['filter']+'%'};return _0x6d1520;})});}_0x11bca0=_['merge']({},_0x11bca0,_0x18cba2['options']);return _0xc32711[_0xd345('0x7d')](_0x11bca0);}})['then'](function(_0x2d9f09){if(_0x2d9f09){_0x3a52fc=_0x2d9f09['length'];if(!_0x18cba2[_0xd345('0x29')]['hasOwnProperty'](_0xd345('0x7e'))){_0x11bca0[_0xd345('0x12')]=qs['limit'](_0x18cba2['query']['limit']);_0x11bca0[_0xd345('0xf')]=qs['offset'](_0x18cba2[_0xd345('0x29')][_0xd345('0xf')]);}return _0xc32711['getAgents'](_0x11bca0);}})['then'](function(_0x19d3a4){if(_0x19d3a4){return _0x19d3a4?{'count':_0x3a52fc,'rows':_0x19d3a4}:null;}})[_0xd345('0x16')](respondWithResult(_0x27ee95,null))[_0xd345('0x2c')](handleError(_0x27ee95,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 11b5df5..53b0131 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 _0x0eba=['remove','emit','exports','../../mysqldb','setMaxListeners','save'];(function(_0x5b0bcc,_0x1ae024){var _0x2cd514=function(_0x11d1b9){while(--_0x11d1b9){_0x5b0bcc['push'](_0x5b0bcc['shift']());}};_0x2cd514(++_0x1ae024);}(_0x0eba,0x13b));var _0xa0eb=function(_0x150278,_0x369ed4){_0x150278=_0x150278-0x0;var _0x468e44=_0x0eba[_0x150278];return _0x468e44;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xa0eb('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa0eb('0x1')](0x0);var events={'afterCreate':_0xa0eb('0x2'),'afterUpdate':'update','afterDestroy':_0xa0eb('0x3')};function emitEvent(_0xee57a4){return function(_0x4afd4d,_0x305115,_0x59cccc){WhatsappQueueEvents['emit'](_0xee57a4+':'+_0x4afd4d['id'],_0x4afd4d);WhatsappQueueEvents[_0xa0eb('0x4')](_0xee57a4,_0x4afd4d);_0x59cccc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xa0eb('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0x7255=['hasOwnProperty','exports','events','setMaxListeners','save','remove','emit'];(function(_0x2e791b,_0x216426){var _0x391b9f=function(_0x3a2e96){while(--_0x3a2e96){_0x2e791b['push'](_0x2e791b['shift']());}};_0x391b9f(++_0x216426);}(_0x7255,0x1b4));var _0x5725=function(_0x489a4f,_0xaa4d77){_0x489a4f=_0x489a4f-0x0;var _0x462e1b=_0x7255[_0x489a4f];return _0x462e1b;};'use strict';var EventEmitter=require(_0x5725('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5725('0x1')](0x0);var events={'afterCreate':_0x5725('0x2'),'afterUpdate':'update','afterDestroy':_0x5725('0x3')};function emitEvent(_0x2f00c4){return function(_0x1fe5a8,_0x1cb0f2,_0x2150c7){WhatsappQueueEvents[_0x5725('0x4')](_0x2f00c4+':'+_0x1fe5a8['id'],_0x1fe5a8);WhatsappQueueEvents['emit'](_0x2f00c4,_0x1fe5a8);_0x2150c7(null);};}for(var e in events){if(events[_0x5725('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5725('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 1b7eb6d..e723811 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 _0x3f61=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x3f61,0x10a));var _0x13f6=function(_0x284359,_0x1ba316){_0x284359=_0x284359-0x0;var _0x3cc6f1=_0x3f61[_0x284359];return _0x3cc6f1;};'use strict';var _=require(_0x13f6('0x0'));var util=require(_0x13f6('0x1'));var logger=require(_0x13f6('0x2'))(_0x13f6('0x3'));var moment=require(_0x13f6('0x4'));var BPromise=require(_0x13f6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13f6('0x6'));var rimraf=require(_0x13f6('0x7'));var config=require(_0x13f6('0x8'));var attributes=require(_0x13f6('0x9'));module[_0x13f6('0xa')]=function(_0x4e2b72,_0xb081bb){return _0x4e2b72[_0x13f6('0xb')](_0x13f6('0xc'),attributes,{'tableName':_0x13f6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe723=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','util','api','moment','bluebird','request-promise','path'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xe723,0x144));var _0x3e72=function(_0xb7e04c,_0x5c0d2e){_0xb7e04c=_0xb7e04c-0x0;var _0x51d4c5=_0xe723[_0xb7e04c];return _0x51d4c5;};'use strict';var _=require('lodash');var util=require(_0x3e72('0x0'));var logger=require('../../config/logger')(_0x3e72('0x1'));var moment=require(_0x3e72('0x2'));var BPromise=require(_0x3e72('0x3'));var rp=require(_0x3e72('0x4'));var fs=require('fs');var path=require(_0x3e72('0x5'));var rimraf=require(_0x3e72('0x6'));var config=require(_0x3e72('0x7'));var attributes=require(_0x3e72('0x8'));module[_0x3e72('0x9')]=function(_0x1a7604,_0x3b0622){return _0x1a7604[_0x3e72('0xa')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','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 22d23b7..607f240 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 _0x6079=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','options','raw','where','attributes','limit','map','include','model','debug','stringify','ShowWhatsappQueue','find','lodash'];(function(_0x4d8441,_0x3a371a){var _0x336c72=function(_0x187e19){while(--_0x187e19){_0x4d8441['push'](_0x4d8441['shift']());}};_0x336c72(++_0x3a371a);}(_0x6079,0x18f));var _0x9607=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x6079[_0x4b7b69];return _0x173b4c;};'use strict';var _=require(_0x9607('0x0'));var util=require('util');var moment=require(_0x9607('0x1'));var BPromise=require(_0x9607('0x2'));var rs=require(_0x9607('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9607('0x4'));var logger=require(_0x9607('0x5'))(_0x9607('0x6'));var config=require('../../config/environment');var jayson=require(_0x9607('0x7'));var client=jayson[_0x9607('0x8')][_0x9607('0x9')]({'port':0x232a});config[_0x9607('0xa')]=_[_0x9607('0xb')](config['redis'],{'host':_0x9607('0xc'),'port':0x18eb});var socket=require(_0x9607('0xd'))(new Redis(config[_0x9607('0xa')]));require(_0x9607('0xe'))[_0x9607('0xf')](socket);function respondWithRpcPromise(_0xaac72b,_0x1879e9,_0x1561c9){return new BPromise(function(_0x505c5e,_0x3186f0){return client[_0x9607('0x10')](_0xaac72b,_0x1561c9)[_0x9607('0x11')](function(_0x5098fd){logger[_0x9607('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x1879e9,_0x9607('0x13'));logger['debug'](_0x9607('0x14'),_0x1879e9,_0x9607('0x13'),JSON['stringify'](_0x5098fd));if(_0x5098fd[_0x9607('0x15')]){if(_0x5098fd[_0x9607('0x15')][_0x9607('0x16')]===0x1f4){logger[_0x9607('0x15')](_0x9607('0x17'),_0x1879e9,_0x5098fd[_0x9607('0x15')]['message']);return _0x3186f0(_0x5098fd[_0x9607('0x15')][_0x9607('0x18')]);}logger['error'](_0x9607('0x17'),_0x1879e9,_0x5098fd[_0x9607('0x15')][_0x9607('0x18')]);return _0x505c5e(_0x5098fd[_0x9607('0x15')][_0x9607('0x18')]);}else{logger['info'](_0x9607('0x17'),_0x1879e9,_0x9607('0x13'));_0x505c5e(_0x5098fd[_0x9607('0x19')][_0x9607('0x18')]);}})[_0x9607('0x1a')](function(_0x55a57b){logger[_0x9607('0x15')](_0x9607('0x17'),_0x1879e9,_0x55a57b);_0x3186f0(_0x55a57b);});});}exports[_0x9607('0x1b')]=function(_0x24e860){var _0x58c8f6=this;return new Promise(function(_0x463ddd,_0x4e8388){return db['WhatsappQueue']['findAll']({'raw':_0x24e860[_0x9607('0x1c')]?_0x24e860['options'][_0x9607('0x1d')]===undefined?!![]:![]:!![],'where':_0x24e860['options']?_0x24e860[_0x9607('0x1c')][_0x9607('0x1e')]||null:null,'attributes':_0x24e860['options']?_0x24e860[_0x9607('0x1c')][_0x9607('0x1f')]||null:null,'limit':_0x24e860[_0x9607('0x1c')]?_0x24e860[_0x9607('0x1c')][_0x9607('0x20')]||null:null,'include':_0x24e860[_0x9607('0x1c')]?_0x24e860[_0x9607('0x1c')]['include']?_[_0x9607('0x21')](_0x24e860['options'][_0x9607('0x22')],function(_0x47cad8){return{'model':db[_0x47cad8[_0x9607('0x23')]],'as':_0x47cad8['as'],'attributes':_0x47cad8[_0x9607('0x1f')],'include':_0x47cad8[_0x9607('0x22')]?_['map'](_0x47cad8[_0x9607('0x22')],function(_0x209566){return{'model':db[_0x209566[_0x9607('0x23')]],'as':_0x209566['as'],'attributes':_0x209566[_0x9607('0x1f')],'include':_0x209566[_0x9607('0x22')]?_[_0x9607('0x21')](_0x209566[_0x9607('0x22')],function(_0x2f8bf9){return{'model':db[_0x2f8bf9[_0x9607('0x23')]],'as':_0x2f8bf9['as'],'attributes':_0x2f8bf9[_0x9607('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9607('0x11')](function(_0x473d1a){logger[_0x9607('0x12')](_0x9607('0x1b'),_0x24e860);logger[_0x9607('0x24')](_0x9607('0x1b'),_0x24e860,JSON[_0x9607('0x25')](_0x473d1a));_0x463ddd(_0x473d1a);})[_0x9607('0x1a')](function(_0x1a581e){logger[_0x9607('0x15')](_0x9607('0x1b'),_0x1a581e[_0x9607('0x18')],_0x24e860);_0x4e8388(_0x58c8f6[_0x9607('0x15')](0x1f4,_0x1a581e[_0x9607('0x18')]));});});};exports[_0x9607('0x26')]=function(_0x2a0c5c){var _0xe64eab=this;return new Promise(function(_0xed6524,_0x76859c){return db['WhatsappQueue'][_0x9607('0x27')]({'raw':_0x2a0c5c[_0x9607('0x1c')]?_0x2a0c5c['options'][_0x9607('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a0c5c[_0x9607('0x1c')]?_0x2a0c5c[_0x9607('0x1c')][_0x9607('0x1e')]||null:null,'attributes':_0x2a0c5c[_0x9607('0x1c')]?_0x2a0c5c[_0x9607('0x1c')][_0x9607('0x1f')]||null:null,'include':_0x2a0c5c[_0x9607('0x1c')]?_0x2a0c5c[_0x9607('0x1c')][_0x9607('0x22')]?_[_0x9607('0x21')](_0x2a0c5c[_0x9607('0x1c')]['include'],function(_0x50f261){return{'model':db[_0x50f261['model']],'as':_0x50f261['as'],'attributes':_0x50f261[_0x9607('0x1f')],'include':_0x50f261[_0x9607('0x22')]?_[_0x9607('0x21')](_0x50f261[_0x9607('0x22')],function(_0x5bd4ae){return{'model':db[_0x5bd4ae[_0x9607('0x23')]],'as':_0x5bd4ae['as'],'attributes':_0x5bd4ae[_0x9607('0x1f')],'include':_0x5bd4ae[_0x9607('0x22')]?_[_0x9607('0x21')](_0x5bd4ae[_0x9607('0x22')],function(_0x1425fc){return{'model':db[_0x1425fc['model']],'as':_0x1425fc['as'],'attributes':_0x1425fc[_0x9607('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9607('0x11')](function(_0xf4d05d){logger[_0x9607('0x12')](_0x9607('0x26'),_0x2a0c5c);logger[_0x9607('0x24')](_0x9607('0x26'),_0x2a0c5c,JSON[_0x9607('0x25')](_0xf4d05d));_0xed6524(_0xf4d05d);})[_0x9607('0x1a')](function(_0x1227f6){logger[_0x9607('0x15')](_0x9607('0x26'),_0x1227f6[_0x9607('0x18')],_0x2a0c5c);_0x76859c(_0xe64eab[_0x9607('0x15')](0x1f4,_0x1227f6[_0x9607('0x18')]));});});}; \ No newline at end of file +var _0x6b37=['limit','include','model','map','stringify','catch','ShowWhatsappQueue','find','raw','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','WhatsappQueue,\x20%s,\x20%s','message','info','result','GetWhatsappQueue','WhatsappQueue','options','where','attributes'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6b37,0x142));var _0x76b3=function(_0x5ee4fb,_0xafe0dd){_0x5ee4fb=_0x5ee4fb-0x0;var _0x541423=_0x6b37[_0x5ee4fb];return _0x541423;};'use strict';var _=require(_0x76b3('0x0'));var util=require(_0x76b3('0x1'));var moment=require(_0x76b3('0x2'));var BPromise=require(_0x76b3('0x3'));var rs=require(_0x76b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x76b3('0x5'));var logger=require(_0x76b3('0x6'))('rpc');var config=require(_0x76b3('0x7'));var jayson=require(_0x76b3('0x8'));var client=jayson[_0x76b3('0x9')][_0x76b3('0xa')]({'port':0x232a});config[_0x76b3('0xb')]=_[_0x76b3('0xc')](config[_0x76b3('0xb')],{'host':_0x76b3('0xd'),'port':0x18eb});var socket=require(_0x76b3('0xe'))(new Redis(config[_0x76b3('0xb')]));require('./whatsappQueue.socket')[_0x76b3('0xf')](socket);function respondWithRpcPromise(_0x20142d,_0x2c8e42,_0x4c5d86){return new BPromise(function(_0x35e6ae,_0x584a6a){return client['request'](_0x20142d,_0x4c5d86)['then'](function(_0x22a9e3){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x2c8e42,_0x76b3('0x10'));logger[_0x76b3('0x11')](_0x76b3('0x12'),_0x2c8e42,_0x76b3('0x10'),JSON['stringify'](_0x22a9e3));if(_0x22a9e3[_0x76b3('0x13')]){if(_0x22a9e3[_0x76b3('0x13')]['code']===0x1f4){logger['error'](_0x76b3('0x14'),_0x2c8e42,_0x22a9e3['error'][_0x76b3('0x15')]);return _0x584a6a(_0x22a9e3['error']['message']);}logger[_0x76b3('0x13')](_0x76b3('0x14'),_0x2c8e42,_0x22a9e3[_0x76b3('0x13')][_0x76b3('0x15')]);return _0x35e6ae(_0x22a9e3[_0x76b3('0x13')]['message']);}else{logger[_0x76b3('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x2c8e42,'request\x20sent');_0x35e6ae(_0x22a9e3[_0x76b3('0x17')][_0x76b3('0x15')]);}})['catch'](function(_0x5ab6fd){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2c8e42,_0x5ab6fd);_0x584a6a(_0x5ab6fd);});});}exports[_0x76b3('0x18')]=function(_0x2c7fcf){var _0x3e2781=this;return new Promise(function(_0x1a473c,_0x2396bd){return db[_0x76b3('0x19')]['findAll']({'raw':_0x2c7fcf[_0x76b3('0x1a')]?_0x2c7fcf[_0x76b3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2c7fcf[_0x76b3('0x1a')]?_0x2c7fcf[_0x76b3('0x1a')][_0x76b3('0x1b')]||null:null,'attributes':_0x2c7fcf[_0x76b3('0x1a')]?_0x2c7fcf[_0x76b3('0x1a')][_0x76b3('0x1c')]||null:null,'limit':_0x2c7fcf[_0x76b3('0x1a')]?_0x2c7fcf[_0x76b3('0x1a')][_0x76b3('0x1d')]||null:null,'include':_0x2c7fcf[_0x76b3('0x1a')]?_0x2c7fcf[_0x76b3('0x1a')][_0x76b3('0x1e')]?_['map'](_0x2c7fcf[_0x76b3('0x1a')][_0x76b3('0x1e')],function(_0x4efd9e){return{'model':db[_0x4efd9e['model']],'as':_0x4efd9e['as'],'attributes':_0x4efd9e[_0x76b3('0x1c')],'include':_0x4efd9e[_0x76b3('0x1e')]?_['map'](_0x4efd9e[_0x76b3('0x1e')],function(_0x2cdc0f){return{'model':db[_0x2cdc0f[_0x76b3('0x1f')]],'as':_0x2cdc0f['as'],'attributes':_0x2cdc0f[_0x76b3('0x1c')],'include':_0x2cdc0f[_0x76b3('0x1e')]?_[_0x76b3('0x20')](_0x2cdc0f[_0x76b3('0x1e')],function(_0x18a9c8){return{'model':db[_0x18a9c8[_0x76b3('0x1f')]],'as':_0x18a9c8['as'],'attributes':_0x18a9c8[_0x76b3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b6d4){logger[_0x76b3('0x16')]('GetWhatsappQueue',_0x2c7fcf);logger[_0x76b3('0x11')](_0x76b3('0x18'),_0x2c7fcf,JSON[_0x76b3('0x21')](_0x14b6d4));_0x1a473c(_0x14b6d4);})[_0x76b3('0x22')](function(_0x2703fe){logger[_0x76b3('0x13')](_0x76b3('0x18'),_0x2703fe[_0x76b3('0x15')],_0x2c7fcf);_0x2396bd(_0x3e2781[_0x76b3('0x13')](0x1f4,_0x2703fe[_0x76b3('0x15')]));});});};exports[_0x76b3('0x23')]=function(_0x5250b4){var _0xa354dd=this;return new Promise(function(_0x30fdbb,_0x55776c){return db[_0x76b3('0x19')][_0x76b3('0x24')]({'raw':_0x5250b4[_0x76b3('0x1a')]?_0x5250b4[_0x76b3('0x1a')][_0x76b3('0x25')]===undefined?!![]:![]:!![],'where':_0x5250b4[_0x76b3('0x1a')]?_0x5250b4['options'][_0x76b3('0x1b')]||null:null,'attributes':_0x5250b4[_0x76b3('0x1a')]?_0x5250b4[_0x76b3('0x1a')]['attributes']||null:null,'include':_0x5250b4[_0x76b3('0x1a')]?_0x5250b4[_0x76b3('0x1a')][_0x76b3('0x1e')]?_['map'](_0x5250b4['options'][_0x76b3('0x1e')],function(_0x4c001e){return{'model':db[_0x4c001e[_0x76b3('0x1f')]],'as':_0x4c001e['as'],'attributes':_0x4c001e['attributes'],'include':_0x4c001e[_0x76b3('0x1e')]?_[_0x76b3('0x20')](_0x4c001e[_0x76b3('0x1e')],function(_0x57b79f){return{'model':db[_0x57b79f[_0x76b3('0x1f')]],'as':_0x57b79f['as'],'attributes':_0x57b79f[_0x76b3('0x1c')],'include':_0x57b79f[_0x76b3('0x1e')]?_[_0x76b3('0x20')](_0x57b79f[_0x76b3('0x1e')],function(_0xd9d782){return{'model':db[_0xd9d782[_0x76b3('0x1f')]],'as':_0xd9d782['as'],'attributes':_0xd9d782[_0x76b3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x76b3('0x26')](function(_0x1b56f2){logger[_0x76b3('0x16')](_0x76b3('0x23'),_0x5250b4);logger[_0x76b3('0x11')](_0x76b3('0x23'),_0x5250b4,JSON[_0x76b3('0x21')](_0x1b56f2));_0x30fdbb(_0x1b56f2);})[_0x76b3('0x22')](function(_0x1157e1){logger[_0x76b3('0x13')](_0x76b3('0x23'),_0x1157e1[_0x76b3('0x15')],_0x5250b4);_0x55776c(_0xa354dd['error'](0x1f4,_0x1157e1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b764bed..a06e9db 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 _0xd1e1=['emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xd1e1,0xcf));var _0x1d1e=function(_0x2c3973,_0x3f219e){_0x2c3973=_0x2c3973-0x0;var _0x511f1b=_0xd1e1[_0x2c3973];return _0x511f1b;};'use strict';var WhatsappQueueEvents=require(_0x1d1e('0x0'));var events=[_0x1d1e('0x1'),_0x1d1e('0x2'),'update'];function createListener(_0x24a21a,_0x232514){return function(_0x9f8637){_0x232514[_0x1d1e('0x3')](_0x24a21a,_0x9f8637);};}function removeListener(_0x16290d,_0xae17c5){return function(){WhatsappQueueEvents[_0x1d1e('0x4')](_0x16290d,_0xae17c5);};}exports[_0x1d1e('0x5')]=function(_0x1547aa){for(var _0x56a03d=0x0,_0x2e7874=events['length'];_0x56a03d<_0x2e7874;_0x56a03d++){var _0x5c274b=events[_0x56a03d];var _0xffcd41=createListener(_0x1d1e('0x6')+_0x5c274b,_0x1547aa);WhatsappQueueEvents['on'](_0x5c274b,_0xffcd41);}}; \ No newline at end of file +var _0x7e59=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','emit'];(function(_0x19e8ec,_0x12e4e2){var _0x5bdfa2=function(_0x2fc2f0){while(--_0x2fc2f0){_0x19e8ec['push'](_0x19e8ec['shift']());}};_0x5bdfa2(++_0x12e4e2);}(_0x7e59,0x9c));var _0x97e5=function(_0xc61c38,_0x648013){_0xc61c38=_0xc61c38-0x0;var _0x117e5b=_0x7e59[_0xc61c38];return _0x117e5b;};'use strict';var WhatsappQueueEvents=require(_0x97e5('0x0'));var events=[_0x97e5('0x1'),_0x97e5('0x2'),'update'];function createListener(_0x894a33,_0x58bb3d){return function(_0x3e4c98){_0x58bb3d[_0x97e5('0x3')](_0x894a33,_0x3e4c98);};}function removeListener(_0x5d8826,_0x50ed3b){return function(){WhatsappQueueEvents[_0x97e5('0x4')](_0x5d8826,_0x50ed3b);};}exports[_0x97e5('0x5')]=function(_0x4cc528){for(var _0x588703=0x0,_0x57c08a=events[_0x97e5('0x6')];_0x588703<_0x57c08a;_0x588703++){var _0x46c042=events[_0x588703];var _0x12e78e=createListener(_0x97e5('0x7')+_0x46c042,_0x4cc528);WhatsappQueueEvents['on'](_0x46c042,_0x12e78e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bca5faa..264b6d0 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 _0x45f2=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2ef2cb,_0x226f62){var _0x1870b2=function(_0x47ce94){while(--_0x47ce94){_0x2ef2cb['push'](_0x2ef2cb['shift']());}};_0x1870b2(++_0x226f62);}(_0x45f2,0x1e9));var _0x245f=function(_0x36e3c7,_0x5d1009){_0x36e3c7=_0x36e3c7-0x0;var _0x3e08cf=_0x45f2[_0x36e3c7];return _0x3e08cf;};'use strict';var multer=require(_0x245f('0x0'));var util=require(_0x245f('0x1'));var path=require('path');var timeout=require(_0x245f('0x2'));var express=require(_0x245f('0x3'));var router=express[_0x245f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x245f('0x5'));var interaction=require(_0x245f('0x6'));var config=require(_0x245f('0x7'));var controller=require(_0x245f('0x8'));router[_0x245f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x245f('0xa'),auth[_0x245f('0xb')](),controller[_0x245f('0xc')]);router[_0x245f('0x9')](_0x245f('0xd'),auth[_0x245f('0xb')](),controller[_0x245f('0xe')]);router[_0x245f('0xf')]('/',auth['isAuthenticated'](),controller[_0x245f('0x10')]);router[_0x245f('0x11')](_0x245f('0xd'),auth[_0x245f('0xb')](),controller['update']);router[_0x245f('0x12')](_0x245f('0xd'),auth['isAuthenticated'](),controller[_0x245f('0x13')]);module[_0x245f('0x14')]=router; \ No newline at end of file +var _0xf531=['update','delete','/:id','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','describe','post','create','put'];(function(_0x421284,_0x5590ee){var _0x19488e=function(_0x55258c){while(--_0x55258c){_0x421284['push'](_0x421284['shift']());}};_0x19488e(++_0x5590ee);}(_0xf531,0x1df));var _0x1f53=function(_0x45eacc,_0x3727a4){_0x45eacc=_0x45eacc-0x0;var _0x3f1252=_0xf531[_0x45eacc];return _0x3f1252;};'use strict';var multer=require(_0x1f53('0x0'));var util=require(_0x1f53('0x1'));var path=require(_0x1f53('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f53('0x3'));var router=express['Router']();var fs_extra=require(_0x1f53('0x4'));var auth=require(_0x1f53('0x5'));var interaction=require(_0x1f53('0x6'));var config=require(_0x1f53('0x7'));var controller=require(_0x1f53('0x8'));router[_0x1f53('0x9')]('/',auth[_0x1f53('0xa')](),controller['index']);router[_0x1f53('0x9')]('/describe',auth[_0x1f53('0xa')](),controller[_0x1f53('0xb')]);router[_0x1f53('0x9')]('/:id',auth[_0x1f53('0xa')](),controller['show']);router[_0x1f53('0xc')]('/',auth[_0x1f53('0xa')](),controller[_0x1f53('0xd')]);router[_0x1f53('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1f53('0xf')]);router[_0x1f53('0x10')](_0x1f53('0x11'),auth[_0x1f53('0xa')](),controller[_0x1f53('0x12')]);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 8dd1d7b..a18d518 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(_0x26fd62,_0x47e21e){var _0x4fcef7=function(_0x423f6f){while(--_0x423f6f){_0x26fd62['push'](_0x26fd62['shift']());}};_0x4fcef7(++_0x47e21e);}(_0x7a54,0x106));var _0x47a5=function(_0x22cc86,_0x31f8d8){_0x22cc86=_0x22cc86-0x0;var _0x29c822=_0x7a54[_0x22cc86];return _0x29c822;};'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(_0x3eddc1,_0x143c45){var _0xce9cd1=function(_0x1583c8){while(--_0x1583c8){_0x3eddc1['push'](_0x3eddc1['shift']());}};_0xce9cd1(++_0x143c45);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 bed316e..30a6a50 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 _0x5423=['params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','WhatsappQueueReport','find','create','body','update'];(function(_0x20a3c4,_0x5ad92e){var _0x477d69=function(_0x406553){while(--_0x406553){_0x20a3c4['push'](_0x20a3c4['shift']());}};_0x477d69(++_0x5ad92e);}(_0x5423,0xe3));var _0x3542=function(_0x3827fb,_0xc26585){_0x3827fb=_0x3827fb-0x0;var _0x580ca5=_0x5423[_0x3827fb];return _0x580ca5;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];function respondWithStatusCode(_0x1cf710,_0x43e977){_0x43e977=_0x43e977||0xcc;return function(_0x4ee86){if(_0x4ee86){return _0x1cf710[_0x3542('0x18')](_0x43e977);}return _0x1cf710[_0x3542('0x19')](_0x43e977)[_0x3542('0x1a')]();};}function respondWithResult(_0x15863d,_0x4bac5b){_0x4bac5b=_0x4bac5b||0xc8;return function(_0x14fe57){if(_0x14fe57){return _0x15863d['status'](_0x4bac5b)[_0x3542('0x1b')](_0x14fe57);}};}function respondWithFilteredResult(_0x13fe0b,_0xc33d42){return function(_0x546fbd){if(_0x546fbd){var _0x270312=typeof _0xc33d42[_0x3542('0x1c')]===_0x3542('0x1d')&&typeof _0xc33d42['limit']===_0x3542('0x1d');var _0x23b0de=_0x546fbd[_0x3542('0x1e')];var _0x3d5199=_0x270312?0x0:_0xc33d42['offset'];var _0x32df3f=_0x270312?_0x546fbd['count']:_0xc33d42[_0x3542('0x1c')]+_0xc33d42[_0x3542('0x1f')];var _0x4d93bc;if(_0x32df3f>=_0x23b0de){_0x32df3f=_0x23b0de;_0x4d93bc=0xc8;}else{_0x4d93bc=0xce;}_0x13fe0b[_0x3542('0x19')](_0x4d93bc);return _0x13fe0b[_0x3542('0x20')](_0x3542('0x21'),_0x3d5199+'-'+_0x32df3f+'/'+_0x23b0de)[_0x3542('0x1b')](_0x546fbd);}return null;};}function patchUpdates(_0x212950){return function(_0x4a7695){try{jsonpatch['apply'](_0x4a7695,_0x212950,!![]);}catch(_0x4c58f1){return BPromise[_0x3542('0x22')](_0x4c58f1);}return _0x4a7695['save']();};}function saveUpdates(_0x1d5488,_0x551645){return function(_0x1d5f1e){if(_0x1d5f1e){return _0x1d5f1e['update'](_0x1d5488)['then'](function(_0x3eacd0){return _0x3eacd0;});}return null;};}function removeEntity(_0xe3f983,_0x5ae097){return function(_0x5d05b2){if(_0x5d05b2){return _0x5d05b2[_0x3542('0x23')]()['then'](function(){_0xe3f983[_0x3542('0x19')](0xcc)[_0x3542('0x1a')]();});}};}function handleEntityNotFound(_0x1e0723,_0x2f2e63){return function(_0x298763){if(!_0x298763){_0x1e0723[_0x3542('0x18')](0x194);}return _0x298763;};}function handleError(_0x412184,_0x1e156e){_0x1e156e=_0x1e156e||0x1f4;return function(_0x18dc6c){logger[_0x3542('0x24')](_0x18dc6c[_0x3542('0x25')]);if(_0x18dc6c[_0x3542('0x26')]){delete _0x18dc6c[_0x3542('0x26')];}_0x412184[_0x3542('0x19')](_0x1e156e)[_0x3542('0x27')](_0x18dc6c);};}exports[_0x3542('0x28')]=function(_0x303412,_0x20eda1){var _0x3bd666={},_0x5590a2={},_0x31ad47={'count':0x0,'rows':[]};var _0x35bbc9=_[_0x3542('0x29')](db['WhatsappQueueReport'][_0x3542('0x2a')],function(_0xc6f23b){return{'name':_0xc6f23b[_0x3542('0x2b')],'type':_0xc6f23b[_0x3542('0x2c')]['key']};});_0x5590a2['model']=_[_0x3542('0x29')](_0x35bbc9,_0x3542('0x26'));_0x5590a2[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x303412[_0x3542('0x2d')]);_0x5590a2[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5590a2['model'],_0x5590a2['query']);_0x3bd666[_0x3542('0x31')]=_['intersection'](_0x5590a2['model'],qs[_0x3542('0x32')](_0x303412['query']['fields']));_0x3bd666[_0x3542('0x31')]=_0x3bd666[_0x3542('0x31')][_0x3542('0x33')]?_0x3bd666['attributes']:_0x5590a2[_0x3542('0x34')];if(!_0x303412['query'][_0x3542('0x35')](_0x3542('0x36'))){_0x3bd666['limit']=qs[_0x3542('0x1f')](_0x303412['query'][_0x3542('0x1f')]);_0x3bd666[_0x3542('0x1c')]=qs[_0x3542('0x1c')](_0x303412['query'][_0x3542('0x1c')]);}_0x3bd666['order']=qs[_0x3542('0x37')](_0x303412[_0x3542('0x2d')][_0x3542('0x37')]);_0x3bd666[_0x3542('0x38')]=qs[_0x3542('0x2f')](_[_0x3542('0x39')](_0x303412[_0x3542('0x2d')],_0x5590a2[_0x3542('0x2f')]),_0x35bbc9);if(_0x303412[_0x3542('0x2d')][_0x3542('0x3a')]){_0x3bd666[_0x3542('0x38')]=_[_0x3542('0x3b')](_0x3bd666[_0x3542('0x38')],{'$or':_['map'](_0x35bbc9,function(_0x62429){if(_0x62429['type']!=='VIRTUAL'){var _0x2782f2={};_0x2782f2[_0x62429[_0x3542('0x26')]]={'$like':'%'+_0x303412[_0x3542('0x2d')][_0x3542('0x3a')]+'%'};return _0x2782f2;}})});}_0x3bd666=_[_0x3542('0x3b')]({},_0x3bd666,_0x303412[_0x3542('0x3c')]);var _0xc7f13c={'where':_0x3bd666[_0x3542('0x38')]};return db['WhatsappQueueReport'][_0x3542('0x1e')](_0xc7f13c)['then'](function(_0x1c8855){_0x31ad47[_0x3542('0x1e')]=_0x1c8855;if(_0x303412['query'][_0x3542('0x3d')]){_0x3bd666[_0x3542('0x3e')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x3542('0x3f')](_0x3bd666);})[_0x3542('0x40')](function(_0x5e1b29){_0x31ad47[_0x3542('0x41')]=_0x5e1b29;return _0x31ad47;})[_0x3542('0x40')](respondWithFilteredResult(_0x20eda1,_0x3bd666))[_0x3542('0x42')](handleError(_0x20eda1,null));};exports[_0x3542('0x43')]=function(_0x290c7c,_0xb12441){var _0x2b54b9={'raw':!![],'where':{'id':_0x290c7c['params']['id']}},_0x4bf45a={};_0x4bf45a[_0x3542('0x34')]=_[_0x3542('0x2e')](db[_0x3542('0x44')][_0x3542('0x2a')]);_0x4bf45a[_0x3542('0x2d')]=_['keys'](_0x290c7c[_0x3542('0x2d')]);_0x4bf45a['filters']=_[_0x3542('0x30')](_0x4bf45a[_0x3542('0x34')],_0x4bf45a[_0x3542('0x2d')]);_0x2b54b9['attributes']=_[_0x3542('0x30')](_0x4bf45a[_0x3542('0x34')],qs['fields'](_0x290c7c[_0x3542('0x2d')][_0x3542('0x32')]));_0x2b54b9[_0x3542('0x31')]=_0x2b54b9[_0x3542('0x31')][_0x3542('0x33')]?_0x2b54b9[_0x3542('0x31')]:_0x4bf45a[_0x3542('0x34')];if(_0x290c7c[_0x3542('0x2d')]['includeAll']){_0x2b54b9['include']=[{'all':!![]}];}_0x2b54b9=_['merge']({},_0x2b54b9,_0x290c7c[_0x3542('0x3c')]);return db[_0x3542('0x44')][_0x3542('0x45')](_0x2b54b9)[_0x3542('0x40')](handleEntityNotFound(_0xb12441,null))[_0x3542('0x40')](respondWithResult(_0xb12441,null))[_0x3542('0x42')](handleError(_0xb12441,null));};exports[_0x3542('0x46')]=function(_0x5adf34,_0x157683){return db[_0x3542('0x44')][_0x3542('0x46')](_0x5adf34[_0x3542('0x47')],{})['then'](respondWithResult(_0x157683,0xc9))[_0x3542('0x42')](handleError(_0x157683,null));};exports[_0x3542('0x48')]=function(_0x55b43a,_0x528f8c){if(_0x55b43a[_0x3542('0x47')]['id']){delete _0x55b43a[_0x3542('0x47')]['id'];}return db[_0x3542('0x44')][_0x3542('0x45')]({'where':{'id':_0x55b43a[_0x3542('0x49')]['id']}})[_0x3542('0x40')](handleEntityNotFound(_0x528f8c,null))[_0x3542('0x40')](saveUpdates(_0x55b43a['body'],null))[_0x3542('0x40')](respondWithResult(_0x528f8c,null))[_0x3542('0x42')](handleError(_0x528f8c,null));};exports[_0x3542('0x23')]=function(_0x392c6e,_0x1ebc82){return db[_0x3542('0x44')][_0x3542('0x45')]({'where':{'id':_0x392c6e[_0x3542('0x49')]['id']}})[_0x3542('0x40')](handleEntityNotFound(_0x1ebc82,null))['then'](removeEntity(_0x1ebc82,null))['catch'](handleError(_0x1ebc82,null));};exports[_0x3542('0x4a')]=function(_0x4b406b,_0x5a798a){return db['WhatsappQueueReport'][_0x3542('0x4a')]()[_0x3542('0x40')](respondWithResult(_0x5a798a,null))[_0x3542('0x42')](handleError(_0x5a798a,null));}; \ No newline at end of file +var _0x3266=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model'];(function(_0xf3c25,_0x3d763b){var _0x83f347=function(_0x57890e){while(--_0x57890e){_0xf3c25['push'](_0xf3c25['shift']());}};_0x83f347(++_0x3d763b);}(_0x3266,0x6a));var _0x6326=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0x3266[_0xe45118];return _0x15e15d;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){_0x429bb0[_0x6326('0x1d')](0xcc)[_0x6326('0x27')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x1c')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x28')]);if(_0x1a48da[_0x6326('0x29')]){delete _0x1a48da[_0x6326('0x29')];}_0x4dae28[_0x6326('0x1d')](_0x33c466)[_0x6326('0x2a')](_0x1a48da);};}exports[_0x6326('0x2b')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=_[_0x6326('0x2c')](db[_0x6326('0x2d')][_0x6326('0x2e')],function(_0x20c5ab){return{'name':_0x20c5ab['fieldName'],'type':_0x20c5ab[_0x6326('0x2f')][_0x6326('0x30')]};});_0x127744[_0x6326('0x31')]=_['map'](_0x2a8873,_0x6326('0x29'));_0x127744['query']=_['keys'](_0x40e036[_0x6326('0x32')]);_0x127744[_0x6326('0x33')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],_0x127744[_0x6326('0x32')]);_0x461e0f[_0x6326('0x35')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],qs[_0x6326('0x36')](_0x40e036[_0x6326('0x32')][_0x6326('0x36')]));_0x461e0f[_0x6326('0x35')]=_0x461e0f['attributes'][_0x6326('0x37')]?_0x461e0f[_0x6326('0x35')]:_0x127744['model'];if(!_0x40e036[_0x6326('0x32')][_0x6326('0x38')](_0x6326('0x39'))){_0x461e0f['limit']=qs[_0x6326('0x3a')](_0x40e036['query']['limit']);_0x461e0f[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x40e036[_0x6326('0x32')]['offset']);}_0x461e0f[_0x6326('0x3b')]=qs['sort'](_0x40e036[_0x6326('0x32')]['sort']);_0x461e0f[_0x6326('0x3c')]=qs[_0x6326('0x33')](_[_0x6326('0x3d')](_0x40e036[_0x6326('0x32')],_0x127744[_0x6326('0x33')]),_0x2a8873);if(_0x40e036[_0x6326('0x32')]['filter']){_0x461e0f[_0x6326('0x3c')]=_[_0x6326('0x3e')](_0x461e0f['where'],{'$or':_[_0x6326('0x2c')](_0x2a8873,function(_0x5ae140){if(_0x5ae140['type']!==_0x6326('0x3f')){var _0x1f8dcf={};_0x1f8dcf[_0x5ae140[_0x6326('0x29')]]={'$like':'%'+_0x40e036[_0x6326('0x32')][_0x6326('0x40')]+'%'};return _0x1f8dcf;}})});}_0x461e0f=_[_0x6326('0x3e')]({},_0x461e0f,_0x40e036['options']);var _0x485bed={'where':_0x461e0f[_0x6326('0x3c')]};return db['WhatsappQueueReport'][_0x6326('0x20')](_0x485bed)['then'](function(_0x282f33){_0x4980f6[_0x6326('0x20')]=_0x282f33;if(_0x40e036[_0x6326('0x32')][_0x6326('0x41')]){_0x461e0f[_0x6326('0x42')]=[{'all':!![]}];}return db[_0x6326('0x2d')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x25')](function(_0x3b089b){_0x4980f6[_0x6326('0x44')]=_0x3b089b;return _0x4980f6;})[_0x6326('0x25')](respondWithFilteredResult(_0x27802c,_0x461e0f))['catch'](handleError(_0x27802c,null));};exports[_0x6326('0x45')]=function(_0x5ce03a,_0x29f2fd){var _0x1d9d4c={'raw':!![],'where':{'id':_0x5ce03a[_0x6326('0x46')]['id']}},_0x16fc33={};_0x16fc33['model']=_[_0x6326('0x47')](db[_0x6326('0x2d')]['rawAttributes']);_0x16fc33[_0x6326('0x32')]=_[_0x6326('0x47')](_0x5ce03a[_0x6326('0x32')]);_0x16fc33[_0x6326('0x33')]=_['intersection'](_0x16fc33[_0x6326('0x31')],_0x16fc33[_0x6326('0x32')]);_0x1d9d4c[_0x6326('0x35')]=_[_0x6326('0x34')](_0x16fc33[_0x6326('0x31')],qs[_0x6326('0x36')](_0x5ce03a[_0x6326('0x32')]['fields']));_0x1d9d4c[_0x6326('0x35')]=_0x1d9d4c[_0x6326('0x35')][_0x6326('0x37')]?_0x1d9d4c[_0x6326('0x35')]:_0x16fc33['model'];if(_0x5ce03a[_0x6326('0x32')]['includeAll']){_0x1d9d4c[_0x6326('0x42')]=[{'all':!![]}];}_0x1d9d4c=_[_0x6326('0x3e')]({},_0x1d9d4c,_0x5ce03a[_0x6326('0x48')]);return db[_0x6326('0x2d')][_0x6326('0x49')](_0x1d9d4c)['then'](handleEntityNotFound(_0x29f2fd,null))[_0x6326('0x25')](respondWithResult(_0x29f2fd,null))['catch'](handleError(_0x29f2fd,null));};exports['create']=function(_0x2bca12,_0x44cf9d){return db['WhatsappQueueReport'][_0x6326('0x4a')](_0x2bca12[_0x6326('0x4b')],{})[_0x6326('0x25')](respondWithResult(_0x44cf9d,0xc9))[_0x6326('0x4c')](handleError(_0x44cf9d,null));};exports[_0x6326('0x24')]=function(_0x4f8dc0,_0x4af0ee){if(_0x4f8dc0[_0x6326('0x4b')]['id']){delete _0x4f8dc0[_0x6326('0x4b')]['id'];}return db[_0x6326('0x2d')][_0x6326('0x49')]({'where':{'id':_0x4f8dc0[_0x6326('0x46')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4af0ee,null))[_0x6326('0x25')](saveUpdates(_0x4f8dc0['body'],null))[_0x6326('0x25')](respondWithResult(_0x4af0ee,null))[_0x6326('0x4c')](handleError(_0x4af0ee,null));};exports[_0x6326('0x26')]=function(_0x3e7674,_0x1b5e9a){return db['WhatsappQueueReport'][_0x6326('0x49')]({'where':{'id':_0x3e7674['params']['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x1b5e9a,null))[_0x6326('0x25')](removeEntity(_0x1b5e9a,null))['catch'](handleError(_0x1b5e9a,null));};exports[_0x6326('0x4d')]=function(_0x5040b1,_0xaa4c9d){return db[_0x6326('0x2d')][_0x6326('0x4d')]()[_0x6326('0x25')](respondWithResult(_0xaa4c9d,null))['catch'](handleError(_0xaa4c9d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 85b51d3..ab54eab 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 _0xb3ec=['rimraf','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb3ec,0x1a3));var _0xcb3e=function(_0x2b382f,_0x5b42d9){_0x2b382f=_0x2b382f-0x0;var _0xd3c25=_0xb3ec[_0x2b382f];return _0xd3c25;};'use strict';var _=require(_0xcb3e('0x0'));var util=require(_0xcb3e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcb3e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb3e('0x3'));var rimraf=require(_0xcb3e('0x4'));var config=require('../../config/environment');var attributes=require(_0xcb3e('0x5'));module[_0xcb3e('0x6')]=function(_0x52fbc0,_0x12cb91){return _0x52fbc0[_0xcb3e('0x7')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xcb3e('0x8'),'fields':[_0xcb3e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe682=['uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','report_whatsapp_queue'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xe682,0x7a));var _0x2e68=function(_0x3626ce,_0x33effa){_0x3626ce=_0x3626ce-0x0;var _0x455327=_0xe682[_0x3626ce];return _0x455327;};'use strict';var _=require(_0x2e68('0x0'));var util=require('util');var logger=require(_0x2e68('0x1'))(_0x2e68('0x2'));var moment=require('moment');var BPromise=require(_0x2e68('0x3'));var rp=require(_0x2e68('0x4'));var fs=require('fs');var path=require(_0x2e68('0x5'));var rimraf=require('rimraf');var config=require(_0x2e68('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x2e68('0x7')]=function(_0xecd394,_0x3d1b99){return _0xecd394[_0x2e68('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x2e68('0x9'),'paranoid':![],'indexes':[{'name':_0x2e68('0xa'),'fields':[_0x2e68('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 2520b6c..517d51a 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 _0x6b30=['update','raw','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','body','options','CreateWhatsappQueueReport','debug'];(function(_0x33a021,_0x282d0e){var _0x327735=function(_0x513a8b){while(--_0x513a8b){_0x33a021['push'](_0x33a021['shift']());}};_0x327735(++_0x282d0e);}(_0x6b30,0x146));var _0x06b3=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x6b30[_0x22bdd3];return _0x44d9d9;};'use strict';var _=require(_0x06b3('0x0'));var util=require(_0x06b3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x06b3('0x2'));var fs=require('fs');var Redis=require(_0x06b3('0x3'));var db=require(_0x06b3('0x4'))['db'];var utils=require(_0x06b3('0x5'));var logger=require(_0x06b3('0x6'))(_0x06b3('0x7'));var config=require('../../config/environment');var jayson=require(_0x06b3('0x8'));var client=jayson['client'][_0x06b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f12d9,_0x2e4412,_0x241b68){return new BPromise(function(_0x517d9d,_0x1d6daa){return client[_0x06b3('0xa')](_0x1f12d9,_0x241b68)[_0x06b3('0xb')](function(_0x33c42f){logger[_0x06b3('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2e4412,_0x06b3('0xd'));logger['debug'](_0x06b3('0xe'),_0x2e4412,'request\x20sent',JSON[_0x06b3('0xf')](_0x33c42f));if(_0x33c42f[_0x06b3('0x10')]){if(_0x33c42f[_0x06b3('0x10')]['code']===0x1f4){logger[_0x06b3('0x10')](_0x06b3('0x11'),_0x2e4412,_0x33c42f[_0x06b3('0x10')][_0x06b3('0x12')]);return _0x1d6daa(_0x33c42f['error']['message']);}logger['error'](_0x06b3('0x11'),_0x2e4412,_0x33c42f[_0x06b3('0x10')][_0x06b3('0x12')]);return _0x517d9d(_0x33c42f[_0x06b3('0x10')][_0x06b3('0x12')]);}else{logger['info'](_0x06b3('0x11'),_0x2e4412,_0x06b3('0xd'));_0x517d9d(_0x33c42f[_0x06b3('0x13')]['message']);}})[_0x06b3('0x14')](function(_0x375253){logger[_0x06b3('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2e4412,_0x375253);_0x1d6daa(_0x375253);});});}exports['CreateWhatsappQueueReport']=function(_0x46746f){var _0x40fafd=this;return new Promise(function(_0x2f8a70,_0x37c68c){return db[_0x06b3('0x15')]['create'](_0x46746f[_0x06b3('0x16')],{'raw':_0x46746f[_0x06b3('0x17')]?_0x46746f[_0x06b3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x06b3('0xb')](function(_0x5664f0){logger[_0x06b3('0xc')](_0x06b3('0x18'),_0x46746f);logger[_0x06b3('0x19')](_0x06b3('0x18'),_0x46746f,JSON[_0x06b3('0xf')](_0x5664f0));_0x2f8a70(_0x5664f0);})[_0x06b3('0x14')](function(_0x2d39c1){logger[_0x06b3('0x10')](_0x06b3('0x18'),_0x2d39c1['message'],_0x46746f);_0x37c68c(_0x40fafd[_0x06b3('0x10')](0x1f4,_0x2d39c1[_0x06b3('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x3214de){var _0x4ef219=this;return new Promise(function(_0x1af80b,_0x1fa326){return db['WhatsappQueueReport'][_0x06b3('0x1a')](_0x3214de['body'],{'raw':_0x3214de[_0x06b3('0x17')]?_0x3214de['options'][_0x06b3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3214de['options']?_0x3214de[_0x06b3('0x17')][_0x06b3('0x1c')]||null:null,'attributes':_0x3214de[_0x06b3('0x17')]?_0x3214de[_0x06b3('0x17')][_0x06b3('0x1d')]||null:null,'limit':_0x3214de[_0x06b3('0x17')]?_0x3214de[_0x06b3('0x17')][_0x06b3('0x1e')]||null:null})[_0x06b3('0xb')](function(_0x274d5c){logger[_0x06b3('0xc')](_0x06b3('0x1f'),_0x3214de);logger[_0x06b3('0x19')](_0x06b3('0x1f'),_0x3214de,JSON['stringify'](_0x274d5c));_0x1af80b(_0x274d5c);})[_0x06b3('0x14')](function(_0x444da8){logger[_0x06b3('0x10')](_0x06b3('0x1f'),_0x444da8[_0x06b3('0x12')],_0x3214de);_0x1fa326(_0x4ef219[_0x06b3('0x10')](0x1f4,_0x444da8[_0x06b3('0x12')]));});});}; \ No newline at end of file +var _0xa5cd=['limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport','update','where','attributes'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xa5cd,0xd3));var _0xda5c=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xa5cd[_0x45d3f0];return _0x314b79;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda5c('0x0'));var BPromise=require(_0xda5c('0x1'));var rs=require(_0xda5c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda5c('0x3'))['db'];var utils=require(_0xda5c('0x4'));var logger=require(_0xda5c('0x5'))(_0xda5c('0x6'));var config=require(_0xda5c('0x7'));var jayson=require(_0xda5c('0x8'));var client=jayson[_0xda5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7006b3,_0x3c2094,_0x2df01d){return new BPromise(function(_0xa18ef3,_0x4ee173){return client['request'](_0x7006b3,_0x2df01d)[_0xda5c('0xa')](function(_0x35dbb7){logger[_0xda5c('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3c2094,_0xda5c('0xc'));logger[_0xda5c('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3c2094,'request\x20sent',JSON[_0xda5c('0xe')](_0x35dbb7));if(_0x35dbb7[_0xda5c('0xf')]){if(_0x35dbb7[_0xda5c('0xf')]['code']===0x1f4){logger[_0xda5c('0xf')](_0xda5c('0x10'),_0x3c2094,_0x35dbb7['error'][_0xda5c('0x11')]);return _0x4ee173(_0x35dbb7[_0xda5c('0xf')][_0xda5c('0x11')]);}logger['error'](_0xda5c('0x10'),_0x3c2094,_0x35dbb7[_0xda5c('0xf')][_0xda5c('0x11')]);return _0xa18ef3(_0x35dbb7[_0xda5c('0xf')]['message']);}else{logger[_0xda5c('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3c2094,_0xda5c('0xc'));_0xa18ef3(_0x35dbb7['result'][_0xda5c('0x11')]);}})['catch'](function(_0x277d61){logger['error'](_0xda5c('0x10'),_0x3c2094,_0x277d61);_0x4ee173(_0x277d61);});});}exports[_0xda5c('0x12')]=function(_0x504391){var _0x2dbdd7=this;return new Promise(function(_0x771326,_0x51a6a2){return db[_0xda5c('0x13')][_0xda5c('0x14')](_0x504391[_0xda5c('0x15')],{'raw':_0x504391[_0xda5c('0x16')]?_0x504391[_0xda5c('0x16')][_0xda5c('0x17')]===undefined?!![]:![]:!![]})[_0xda5c('0xa')](function(_0x44fe7f){logger[_0xda5c('0xb')](_0xda5c('0x12'),_0x504391);logger[_0xda5c('0xd')](_0xda5c('0x12'),_0x504391,JSON['stringify'](_0x44fe7f));_0x771326(_0x44fe7f);})[_0xda5c('0x18')](function(_0x547b51){logger['error']('CreateWhatsappQueueReport',_0x547b51[_0xda5c('0x11')],_0x504391);_0x51a6a2(_0x2dbdd7[_0xda5c('0xf')](0x1f4,_0x547b51[_0xda5c('0x11')]));});});};exports[_0xda5c('0x19')]=function(_0x48aee6){var _0x172350=this;return new Promise(function(_0x9e32b3,_0x530aeb){return db['WhatsappQueueReport'][_0xda5c('0x1a')](_0x48aee6[_0xda5c('0x15')],{'raw':_0x48aee6[_0xda5c('0x16')]?_0x48aee6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48aee6['options']?_0x48aee6[_0xda5c('0x16')][_0xda5c('0x1b')]||null:null,'attributes':_0x48aee6[_0xda5c('0x16')]?_0x48aee6['options'][_0xda5c('0x1c')]||null:null,'limit':_0x48aee6[_0xda5c('0x16')]?_0x48aee6['options'][_0xda5c('0x1d')]||null:null})[_0xda5c('0xa')](function(_0x147af7){logger['info'](_0xda5c('0x19'),_0x48aee6);logger['debug'](_0xda5c('0x19'),_0x48aee6,JSON[_0xda5c('0xe')](_0x147af7));_0x9e32b3(_0x147af7);})[_0xda5c('0x18')](function(_0x1394b6){logger[_0xda5c('0xf')](_0xda5c('0x19'),_0x1394b6[_0xda5c('0x11')],_0x48aee6);_0x530aeb(_0x172350['error'](0x1f4,_0x1394b6[_0xda5c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index b21b105..f90795b 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 _0x8ba0=['/:id','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','isAuthenticated','describe','get','show','post','create'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x8ba0,0x157));var _0x08ba=function(_0x4ad4da,_0x50a67e){_0x4ad4da=_0x4ad4da-0x0;var _0x1f17a5=_0x8ba0[_0x4ad4da];return _0x1f17a5;};'use strict';var multer=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x08ba('0x2'));var router=express[_0x08ba('0x3')]();var fs_extra=require(_0x08ba('0x4'));var auth=require(_0x08ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x08ba('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x08ba('0x7')]);router['get']('/describe',auth[_0x08ba('0x8')](),controller[_0x08ba('0x9')]);router[_0x08ba('0xa')]('/:id',auth[_0x08ba('0x8')](),controller[_0x08ba('0xb')]);router[_0x08ba('0xc')]('/',auth[_0x08ba('0x8')](),controller[_0x08ba('0xd')]);router['put'](_0x08ba('0xe'),auth[_0x08ba('0x8')](),controller['update']);router[_0x08ba('0xf')](_0x08ba('0xe'),auth['isAuthenticated'](),controller[_0x08ba('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0248=['isAuthenticated','index','get','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2318d3,_0x29a3b0){var _0x4bfd76=function(_0x36f9f2){while(--_0x36f9f2){_0x2318d3['push'](_0x2318d3['shift']());}};_0x4bfd76(++_0x29a3b0);}(_0x0248,0xd4));var _0x8024=function(_0x4e352c,_0x1730dd){_0x4e352c=_0x4e352c-0x0;var _0x40b221=_0x0248[_0x4e352c];return _0x40b221;};'use strict';var multer=require(_0x8024('0x0'));var util=require(_0x8024('0x1'));var path=require(_0x8024('0x2'));var timeout=require(_0x8024('0x3'));var express=require(_0x8024('0x4'));var router=express[_0x8024('0x5')]();var fs_extra=require(_0x8024('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8024('0x7'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x8024('0x8')](),controller[_0x8024('0x9')]);router[_0x8024('0xa')](_0x8024('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x8024('0xc'),auth[_0x8024('0x8')](),controller['show']);router[_0x8024('0xd')]('/',auth['isAuthenticated'](),controller[_0x8024('0xe')]);router[_0x8024('0xf')](_0x8024('0xc'),auth[_0x8024('0x8')](),controller[_0x8024('0x10')]);router[_0x8024('0x11')]('/:id',auth[_0x8024('0x8')](),controller[_0x8024('0x12')]);module[_0x8024('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 54189c1..48fd765 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 _0xbcff=['agent','queue','sequelize','exports','STRING','account'];(function(_0x2b5d39,_0x55a5f2){var _0x3917c4=function(_0x16551f){while(--_0x16551f){_0x2b5d39['push'](_0x2b5d39['shift']());}};_0x3917c4(++_0x55a5f2);}(_0xbcff,0x12e));var _0xfbcf=function(_0x3df6a3,_0xf69df4){_0x3df6a3=_0x3df6a3-0x0;var _0x2ee3c1=_0xbcff[_0x3df6a3];return _0x2ee3c1;};'use strict';var Sequelize=require(_0xfbcf('0x0'));module[_0xfbcf('0x1')]={'uniqueid':{'type':Sequelize[_0xfbcf('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfbcf('0x3'),_0xfbcf('0x4'),_0xfbcf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xdcdb=['account','agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xdcdb,0x64));var _0xbdcd=function(_0x3505df,_0x129aea){_0x3505df=_0x3505df-0x0;var _0x3cf71e=_0xdcdb[_0x3505df];return _0x3cf71e;};'use strict';var Sequelize=require(_0xbdcd('0x0'));module[_0xbdcd('0x1')]={'uniqueid':{'type':Sequelize[_0xbdcd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbdcd('0x3')](_0xbdcd('0x4'),_0xbdcd('0x5'),_0xbdcd('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbdcd('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 3ae6fe9..ef28530 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 _0x10ee=['params','rawAttributes','fields','length','find','catch','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','map','WhatsappTransferReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x452630,_0x1c0fc4){var _0x31ebec=function(_0x18cb48){while(--_0x18cb48){_0x452630['push'](_0x452630['shift']());}};_0x31ebec(++_0x1c0fc4);}(_0x10ee,0xed));var _0xe10e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x10ee[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe10e('0x0'));var rimraf=require(_0xe10e('0x1'));var zipdir=require(_0xe10e('0x2'));var jsonpatch=require(_0xe10e('0x3'));var rp=require('request-promise');var moment=require(_0xe10e('0x4'));var BPromise=require(_0xe10e('0x5'));var Mustache=require(_0xe10e('0x6'));var util=require(_0xe10e('0x7'));var path=require(_0xe10e('0x8'));var sox=require('sox');var csv=require(_0xe10e('0x9'));var ejs=require(_0xe10e('0xa'));var fs=require('fs');var fs_extra=require(_0xe10e('0xb'));var _=require('lodash');var squel=require(_0xe10e('0xc'));var crypto=require(_0xe10e('0xd'));var jsforce=require(_0xe10e('0xe'));var deskjs=require(_0xe10e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe10e('0x10'));var Papa=require(_0xe10e('0x11'));var Redis=require(_0xe10e('0x12'));var authService=require(_0xe10e('0x13'));var qs=require(_0xe10e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe10e('0x15'))(_0xe10e('0x16'));var utils=require('../../config/utils');var config=require(_0xe10e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe10e('0x18'))['db'];function respondWithStatusCode(_0x24869b,_0x5cbd1f){_0x5cbd1f=_0x5cbd1f||0xcc;return function(_0x4c4b3d){if(_0x4c4b3d){return _0x24869b[_0xe10e('0x19')](_0x5cbd1f);}return _0x24869b[_0xe10e('0x1a')](_0x5cbd1f)[_0xe10e('0x1b')]();};}function respondWithResult(_0x25a273,_0x4a5b42){_0x4a5b42=_0x4a5b42||0xc8;return function(_0x2ccc45){if(_0x2ccc45){return _0x25a273['status'](_0x4a5b42)[_0xe10e('0x1c')](_0x2ccc45);}};}function respondWithFilteredResult(_0x96948e,_0x2e37b2){return function(_0xc6f530){if(_0xc6f530){var _0x4584cc=typeof _0x2e37b2[_0xe10e('0x1d')]===_0xe10e('0x1e')&&typeof _0x2e37b2[_0xe10e('0x1f')]===_0xe10e('0x1e');var _0x20a404=_0xc6f530[_0xe10e('0x20')];var _0x91f0d1=_0x4584cc?0x0:_0x2e37b2[_0xe10e('0x1d')];var _0x148e99=_0x4584cc?_0xc6f530[_0xe10e('0x20')]:_0x2e37b2[_0xe10e('0x1d')]+_0x2e37b2[_0xe10e('0x1f')];var _0x15881e;if(_0x148e99>=_0x20a404){_0x148e99=_0x20a404;_0x15881e=0xc8;}else{_0x15881e=0xce;}_0x96948e[_0xe10e('0x1a')](_0x15881e);return _0x96948e[_0xe10e('0x21')](_0xe10e('0x22'),_0x91f0d1+'-'+_0x148e99+'/'+_0x20a404)[_0xe10e('0x1c')](_0xc6f530);}return null;};}function patchUpdates(_0x3eb773){return function(_0xcac481){try{jsonpatch[_0xe10e('0x23')](_0xcac481,_0x3eb773,!![]);}catch(_0x5d9d3b){return BPromise[_0xe10e('0x24')](_0x5d9d3b);}return _0xcac481['save']();};}function saveUpdates(_0x519cd9,_0xf447ea){return function(_0x1f70c0){if(_0x1f70c0){return _0x1f70c0[_0xe10e('0x25')](_0x519cd9)[_0xe10e('0x26')](function(_0xa77246){return _0xa77246;});}return null;};}function removeEntity(_0x3075eb,_0x2dfa94){return function(_0x5bcf42){if(_0x5bcf42){return _0x5bcf42['destroy']()[_0xe10e('0x26')](function(){_0x3075eb[_0xe10e('0x1a')](0xcc)[_0xe10e('0x1b')]();});}};}function handleEntityNotFound(_0x246999,_0x429400){return function(_0x4663bc){if(!_0x4663bc){_0x246999['sendStatus'](0x194);}return _0x4663bc;};}function handleError(_0x4afd2c,_0x120000){_0x120000=_0x120000||0x1f4;return function(_0x1ca188){logger[_0xe10e('0x27')](_0x1ca188['stack']);if(_0x1ca188[_0xe10e('0x28')]){delete _0x1ca188[_0xe10e('0x28')];}_0x4afd2c['status'](_0x120000)[_0xe10e('0x29')](_0x1ca188);};}exports['index']=function(_0x32b32b,_0x37f1f7){var _0x43a746={},_0x26f024={},_0x43e721={'count':0x0,'rows':[]};var _0x23ff93=_[_0xe10e('0x2a')](db[_0xe10e('0x2b')]['rawAttributes'],function(_0x17eeb9){return{'name':_0x17eeb9[_0xe10e('0x2c')],'type':_0x17eeb9[_0xe10e('0x2d')][_0xe10e('0x2e')]};});_0x26f024['model']=_[_0xe10e('0x2a')](_0x23ff93,_0xe10e('0x28'));_0x26f024[_0xe10e('0x2f')]=_[_0xe10e('0x30')](_0x32b32b[_0xe10e('0x2f')]);_0x26f024[_0xe10e('0x31')]=_[_0xe10e('0x32')](_0x26f024['model'],_0x26f024[_0xe10e('0x2f')]);_0x43a746['attributes']=_[_0xe10e('0x32')](_0x26f024[_0xe10e('0x33')],qs['fields'](_0x32b32b[_0xe10e('0x2f')]['fields']));_0x43a746[_0xe10e('0x34')]=_0x43a746[_0xe10e('0x34')]['length']?_0x43a746[_0xe10e('0x34')]:_0x26f024[_0xe10e('0x33')];if(!_0x32b32b['query'][_0xe10e('0x35')](_0xe10e('0x36'))){_0x43a746[_0xe10e('0x1f')]=qs['limit'](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x1f')]);_0x43a746[_0xe10e('0x1d')]=qs[_0xe10e('0x1d')](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x1d')]);}_0x43a746[_0xe10e('0x37')]=qs['sort'](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x38')]);_0x43a746[_0xe10e('0x39')]=qs[_0xe10e('0x31')](_['pick'](_0x32b32b['query'],_0x26f024['filters']),_0x23ff93);if(_0x32b32b[_0xe10e('0x2f')]['filter']){_0x43a746[_0xe10e('0x39')]=_[_0xe10e('0x3a')](_0x43a746[_0xe10e('0x39')],{'$or':_['map'](_0x23ff93,function(_0x2708c1){if(_0x2708c1[_0xe10e('0x2d')]!==_0xe10e('0x3b')){var _0x223a13={};_0x223a13[_0x2708c1['name']]={'$like':'%'+_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x3c')]+'%'};return _0x223a13;}})});}_0x43a746=_[_0xe10e('0x3a')]({},_0x43a746,_0x32b32b[_0xe10e('0x3d')]);var _0x511cec={'where':_0x43a746[_0xe10e('0x39')]};return db[_0xe10e('0x2b')][_0xe10e('0x20')](_0x511cec)['then'](function(_0x2aee23){_0x43e721[_0xe10e('0x20')]=_0x2aee23;if(_0x32b32b['query'][_0xe10e('0x3e')]){_0x43a746[_0xe10e('0x3f')]=[{'all':!![]}];}return db[_0xe10e('0x2b')][_0xe10e('0x40')](_0x43a746);})[_0xe10e('0x26')](function(_0x2e8db1){_0x43e721[_0xe10e('0x41')]=_0x2e8db1;return _0x43e721;})['then'](respondWithFilteredResult(_0x37f1f7,_0x43a746))['catch'](handleError(_0x37f1f7,null));};exports[_0xe10e('0x42')]=function(_0x366c62,_0x5e985e){var _0x12a787={'raw':!![],'where':{'id':_0x366c62[_0xe10e('0x43')]['id']}},_0x37e988={};_0x37e988[_0xe10e('0x33')]=_[_0xe10e('0x30')](db[_0xe10e('0x2b')][_0xe10e('0x44')]);_0x37e988[_0xe10e('0x2f')]=_[_0xe10e('0x30')](_0x366c62[_0xe10e('0x2f')]);_0x37e988[_0xe10e('0x31')]=_['intersection'](_0x37e988[_0xe10e('0x33')],_0x37e988[_0xe10e('0x2f')]);_0x12a787[_0xe10e('0x34')]=_[_0xe10e('0x32')](_0x37e988[_0xe10e('0x33')],qs[_0xe10e('0x45')](_0x366c62[_0xe10e('0x2f')][_0xe10e('0x45')]));_0x12a787[_0xe10e('0x34')]=_0x12a787[_0xe10e('0x34')][_0xe10e('0x46')]?_0x12a787['attributes']:_0x37e988[_0xe10e('0x33')];if(_0x366c62[_0xe10e('0x2f')]['includeAll']){_0x12a787[_0xe10e('0x3f')]=[{'all':!![]}];}_0x12a787=_[_0xe10e('0x3a')]({},_0x12a787,_0x366c62['options']);return db[_0xe10e('0x2b')][_0xe10e('0x47')](_0x12a787)[_0xe10e('0x26')](handleEntityNotFound(_0x5e985e,null))[_0xe10e('0x26')](respondWithResult(_0x5e985e,null))['catch'](handleError(_0x5e985e,null));};exports['create']=function(_0x2c6b70,_0xc801b){return db['WhatsappTransferReport']['create'](_0x2c6b70['body'],{})[_0xe10e('0x26')](respondWithResult(_0xc801b,0xc9))[_0xe10e('0x48')](handleError(_0xc801b,null));};exports['update']=function(_0x5b033f,_0x24f71b){if(_0x5b033f[_0xe10e('0x49')]['id']){delete _0x5b033f[_0xe10e('0x49')]['id'];}return db[_0xe10e('0x2b')][_0xe10e('0x47')]({'where':{'id':_0x5b033f[_0xe10e('0x43')]['id']}})['then'](handleEntityNotFound(_0x24f71b,null))[_0xe10e('0x26')](saveUpdates(_0x5b033f[_0xe10e('0x49')],null))[_0xe10e('0x26')](respondWithResult(_0x24f71b,null))[_0xe10e('0x48')](handleError(_0x24f71b,null));};exports[_0xe10e('0x4a')]=function(_0x5428eb,_0x55ade0){return db[_0xe10e('0x2b')]['find']({'where':{'id':_0x5428eb['params']['id']}})[_0xe10e('0x26')](handleEntityNotFound(_0x55ade0,null))['then'](removeEntity(_0x55ade0,null))[_0xe10e('0x48')](handleError(_0x55ade0,null));};exports[_0xe10e('0x4b')]=function(_0x23f6dd,_0x14e455){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x14e455,null))['catch'](handleError(_0x14e455,null));}; \ No newline at end of file +var _0xb7ea=['apply','save','update','then','destroy','stack','name','send','index','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','WhatsappTransferReport','includeAll','findAll','catch','keys','body','params','find','describe','rimraf','zip-dir','bluebird','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','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb7ea,0x6a));var _0xab7e=function(_0x3640e2,_0x562103){_0x3640e2=_0x3640e2-0x0;var _0x277415=_0xb7ea[_0x3640e2];return _0x277415;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab7e('0x0'));var zipdir=require(_0xab7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab7e('0x2'));var Mustache=require('mustache');var util=require(_0xab7e('0x3'));var path=require(_0xab7e('0x4'));var sox=require(_0xab7e('0x5'));var csv=require(_0xab7e('0x6'));var ejs=require(_0xab7e('0x7'));var fs=require('fs');var fs_extra=require(_0xab7e('0x8'));var _=require(_0xab7e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xab7e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xab7e('0x6'));var querystring=require(_0xab7e('0xb'));var Papa=require(_0xab7e('0xc'));var Redis=require(_0xab7e('0xd'));var authService=require(_0xab7e('0xe'));var qs=require(_0xab7e('0xf'));var as=require(_0xab7e('0x10'));var hardwareService=require(_0xab7e('0x11'));var logger=require(_0xab7e('0x12'))('api');var utils=require(_0xab7e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xab7e('0x14'));var db=require(_0xab7e('0x15'))['db'];function respondWithStatusCode(_0x4d8803,_0x3bf166){_0x3bf166=_0x3bf166||0xcc;return function(_0xafd35d){if(_0xafd35d){return _0x4d8803[_0xab7e('0x16')](_0x3bf166);}return _0x4d8803[_0xab7e('0x17')](_0x3bf166)[_0xab7e('0x18')]();};}function respondWithResult(_0x1bcd83,_0x4b462b){_0x4b462b=_0x4b462b||0xc8;return function(_0xfc2553){if(_0xfc2553){return _0x1bcd83[_0xab7e('0x17')](_0x4b462b)[_0xab7e('0x19')](_0xfc2553);}};}function respondWithFilteredResult(_0x19dc4e,_0x45352b){return function(_0x193cf3){if(_0x193cf3){var _0xf812c4=typeof _0x45352b[_0xab7e('0x1a')]===_0xab7e('0x1b')&&typeof _0x45352b[_0xab7e('0x1c')]===_0xab7e('0x1b');var _0x5dbde3=_0x193cf3[_0xab7e('0x1d')];var _0x5ce265=_0xf812c4?0x0:_0x45352b[_0xab7e('0x1a')];var _0x585e76=_0xf812c4?_0x193cf3[_0xab7e('0x1d')]:_0x45352b['offset']+_0x45352b['limit'];var _0x2f39ea;if(_0x585e76>=_0x5dbde3){_0x585e76=_0x5dbde3;_0x2f39ea=0xc8;}else{_0x2f39ea=0xce;}_0x19dc4e[_0xab7e('0x17')](_0x2f39ea);return _0x19dc4e[_0xab7e('0x1e')](_0xab7e('0x1f'),_0x5ce265+'-'+_0x585e76+'/'+_0x5dbde3)[_0xab7e('0x19')](_0x193cf3);}return null;};}function patchUpdates(_0x52d25f){return function(_0x1fb180){try{jsonpatch[_0xab7e('0x20')](_0x1fb180,_0x52d25f,!![]);}catch(_0x825e1a){return BPromise['reject'](_0x825e1a);}return _0x1fb180[_0xab7e('0x21')]();};}function saveUpdates(_0x4d8d3a,_0x47ff7a){return function(_0x7616be){if(_0x7616be){return _0x7616be[_0xab7e('0x22')](_0x4d8d3a)[_0xab7e('0x23')](function(_0x3e312d){return _0x3e312d;});}return null;};}function removeEntity(_0x46b69c,_0xb196ca){return function(_0x1d4b38){if(_0x1d4b38){return _0x1d4b38[_0xab7e('0x24')]()['then'](function(){_0x46b69c['status'](0xcc)[_0xab7e('0x18')]();});}};}function handleEntityNotFound(_0x2e7995,_0x379ae0){return function(_0x257fc4){if(!_0x257fc4){_0x2e7995[_0xab7e('0x16')](0x194);}return _0x257fc4;};}function handleError(_0x52ee29,_0x582286){_0x582286=_0x582286||0x1f4;return function(_0x3475fd){logger['error'](_0x3475fd[_0xab7e('0x25')]);if(_0x3475fd[_0xab7e('0x26')]){delete _0x3475fd[_0xab7e('0x26')];}_0x52ee29['status'](_0x582286)[_0xab7e('0x27')](_0x3475fd);};}exports[_0xab7e('0x28')]=function(_0x2d5bd8,_0x52c0b3){var _0x21470e={},_0x52fc3d={},_0x3d8d94={'count':0x0,'rows':[]};var _0x42dd1a=_['map'](db['WhatsappTransferReport'][_0xab7e('0x29')],function(_0x296e4b){return{'name':_0x296e4b['fieldName'],'type':_0x296e4b['type'][_0xab7e('0x2a')]};});_0x52fc3d[_0xab7e('0x2b')]=_['map'](_0x42dd1a,_0xab7e('0x26'));_0x52fc3d[_0xab7e('0x2c')]=_['keys'](_0x2d5bd8[_0xab7e('0x2c')]);_0x52fc3d[_0xab7e('0x2d')]=_[_0xab7e('0x2e')](_0x52fc3d[_0xab7e('0x2b')],_0x52fc3d[_0xab7e('0x2c')]);_0x21470e['attributes']=_['intersection'](_0x52fc3d[_0xab7e('0x2b')],qs[_0xab7e('0x2f')](_0x2d5bd8[_0xab7e('0x2c')][_0xab7e('0x2f')]));_0x21470e[_0xab7e('0x30')]=_0x21470e['attributes'][_0xab7e('0x31')]?_0x21470e[_0xab7e('0x30')]:_0x52fc3d[_0xab7e('0x2b')];if(!_0x2d5bd8[_0xab7e('0x2c')][_0xab7e('0x32')](_0xab7e('0x33'))){_0x21470e[_0xab7e('0x1c')]=qs[_0xab7e('0x1c')](_0x2d5bd8[_0xab7e('0x2c')][_0xab7e('0x1c')]);_0x21470e[_0xab7e('0x1a')]=qs[_0xab7e('0x1a')](_0x2d5bd8[_0xab7e('0x2c')][_0xab7e('0x1a')]);}_0x21470e[_0xab7e('0x34')]=qs[_0xab7e('0x35')](_0x2d5bd8[_0xab7e('0x2c')][_0xab7e('0x35')]);_0x21470e[_0xab7e('0x36')]=qs['filters'](_[_0xab7e('0x37')](_0x2d5bd8[_0xab7e('0x2c')],_0x52fc3d[_0xab7e('0x2d')]),_0x42dd1a);if(_0x2d5bd8['query'][_0xab7e('0x38')]){_0x21470e['where']=_[_0xab7e('0x39')](_0x21470e['where'],{'$or':_['map'](_0x42dd1a,function(_0x304913){if(_0x304913[_0xab7e('0x3a')]!=='VIRTUAL'){var _0x3039e1={};_0x3039e1[_0x304913[_0xab7e('0x26')]]={'$like':'%'+_0x2d5bd8[_0xab7e('0x2c')][_0xab7e('0x38')]+'%'};return _0x3039e1;}})});}_0x21470e=_['merge']({},_0x21470e,_0x2d5bd8[_0xab7e('0x3b')]);var _0x3d0071={'where':_0x21470e[_0xab7e('0x36')]};return db[_0xab7e('0x3c')]['count'](_0x3d0071)[_0xab7e('0x23')](function(_0x19cfe5){_0x3d8d94[_0xab7e('0x1d')]=_0x19cfe5;if(_0x2d5bd8[_0xab7e('0x2c')][_0xab7e('0x3d')]){_0x21470e['include']=[{'all':!![]}];}return db[_0xab7e('0x3c')][_0xab7e('0x3e')](_0x21470e);})[_0xab7e('0x23')](function(_0x17d51d){_0x3d8d94['rows']=_0x17d51d;return _0x3d8d94;})[_0xab7e('0x23')](respondWithFilteredResult(_0x52c0b3,_0x21470e))[_0xab7e('0x3f')](handleError(_0x52c0b3,null));};exports['show']=function(_0x4b7816,_0x4ef3a2){var _0x286b3c={'raw':!![],'where':{'id':_0x4b7816['params']['id']}},_0x5c3f04={};_0x5c3f04[_0xab7e('0x2b')]=_[_0xab7e('0x40')](db['WhatsappTransferReport'][_0xab7e('0x29')]);_0x5c3f04[_0xab7e('0x2c')]=_['keys'](_0x4b7816[_0xab7e('0x2c')]);_0x5c3f04[_0xab7e('0x2d')]=_[_0xab7e('0x2e')](_0x5c3f04[_0xab7e('0x2b')],_0x5c3f04[_0xab7e('0x2c')]);_0x286b3c[_0xab7e('0x30')]=_[_0xab7e('0x2e')](_0x5c3f04['model'],qs['fields'](_0x4b7816[_0xab7e('0x2c')][_0xab7e('0x2f')]));_0x286b3c[_0xab7e('0x30')]=_0x286b3c[_0xab7e('0x30')][_0xab7e('0x31')]?_0x286b3c['attributes']:_0x5c3f04[_0xab7e('0x2b')];if(_0x4b7816[_0xab7e('0x2c')]['includeAll']){_0x286b3c['include']=[{'all':!![]}];}_0x286b3c=_[_0xab7e('0x39')]({},_0x286b3c,_0x4b7816[_0xab7e('0x3b')]);return db[_0xab7e('0x3c')]['find'](_0x286b3c)['then'](handleEntityNotFound(_0x4ef3a2,null))[_0xab7e('0x23')](respondWithResult(_0x4ef3a2,null))[_0xab7e('0x3f')](handleError(_0x4ef3a2,null));};exports['create']=function(_0x459d56,_0x3b1205){return db[_0xab7e('0x3c')]['create'](_0x459d56[_0xab7e('0x41')],{})[_0xab7e('0x23')](respondWithResult(_0x3b1205,0xc9))['catch'](handleError(_0x3b1205,null));};exports[_0xab7e('0x22')]=function(_0x8307ae,_0x361db0){if(_0x8307ae[_0xab7e('0x41')]['id']){delete _0x8307ae[_0xab7e('0x41')]['id'];}return db[_0xab7e('0x3c')]['find']({'where':{'id':_0x8307ae[_0xab7e('0x42')]['id']}})[_0xab7e('0x23')](handleEntityNotFound(_0x361db0,null))['then'](saveUpdates(_0x8307ae[_0xab7e('0x41')],null))[_0xab7e('0x23')](respondWithResult(_0x361db0,null))[_0xab7e('0x3f')](handleError(_0x361db0,null));};exports[_0xab7e('0x24')]=function(_0xc27fc7,_0x36c2b3){return db['WhatsappTransferReport'][_0xab7e('0x43')]({'where':{'id':_0xc27fc7['params']['id']}})['then'](handleEntityNotFound(_0x36c2b3,null))[_0xab7e('0x23')](removeEntity(_0x36c2b3,null))[_0xab7e('0x3f')](handleError(_0x36c2b3,null));};exports[_0xab7e('0x44')]=function(_0x49f0bf,_0x3173f1){return db[_0xab7e('0x3c')]['describe']()['then'](respondWithResult(_0x3173f1,null))[_0xab7e('0x3f')](handleError(_0x3173f1,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 892f9fd..593cfe8 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 _0x8fa7=['bluebird','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fa7,0x197));var _0x78fa=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x8fa7[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require(_0x78fa('0x0'));var logger=require(_0x78fa('0x1'))(_0x78fa('0x2'));var moment=require('moment');var BPromise=require(_0x78fa('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(_0x78fa('0x4'));module[_0x78fa('0x5')]=function(_0x2b9158,_0x4f4997){return _0x2b9158[_0x78fa('0x6')](_0x78fa('0x7'),attributes,{'tableName':_0x78fa('0x8'),'paranoid':![],'indexes':[{'name':_0x78fa('0x9'),'fields':[_0x78fa('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9761=['bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x9761,0xf3));var _0x1976=function(_0x11b259,_0x322aa3){_0x11b259=_0x11b259-0x0;var _0x57dba4=_0x9761[_0x11b259];return _0x57dba4;};'use strict';var _=require(_0x1976('0x0'));var util=require(_0x1976('0x1'));var logger=require(_0x1976('0x2'))('api');var moment=require(_0x1976('0x3'));var BPromise=require(_0x1976('0x4'));var rp=require(_0x1976('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1976('0x6'));var config=require('../../config/environment');var attributes=require(_0x1976('0x7'));module[_0x1976('0x8')]=function(_0x1b8195,_0x30e161){return _0x1b8195[_0x1976('0x9')](_0x1976('0xa'),attributes,{'tableName':_0x1976('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1976('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 9670e60..2fbafd3 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 _0xb3a9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5ab555,_0x26fc64){var _0x62d8f1=function(_0xb92e37){while(--_0xb92e37){_0x5ab555['push'](_0x5ab555['shift']());}};_0x62d8f1(++_0x26fc64);}(_0xb3a9,0x157));var _0x9b3a=function(_0x39ac42,_0x2afc0){_0x39ac42=_0x39ac42-0x0;var _0x3d9d61=_0xb3a9[_0x39ac42];return _0x3d9d61;};'use strict';var _=require(_0x9b3a('0x0'));var util=require(_0x9b3a('0x1'));var moment=require(_0x9b3a('0x2'));var BPromise=require(_0x9b3a('0x3'));var rs=require(_0x9b3a('0x4'));var fs=require('fs');var Redis=require(_0x9b3a('0x5'));var db=require(_0x9b3a('0x6'))['db'];var utils=require(_0x9b3a('0x7'));var logger=require('../../config/logger')(_0x9b3a('0x8'));var config=require(_0x9b3a('0x9'));var jayson=require(_0x9b3a('0xa'));var client=jayson[_0x9b3a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f63a3,_0x5a1172,_0x51f4b6){return new BPromise(function(_0x56d7d2,_0x25cdcb){return client['request'](_0x3f63a3,_0x51f4b6)[_0x9b3a('0xc')](function(_0x46cd57){logger[_0x9b3a('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5a1172,_0x9b3a('0xe'));logger[_0x9b3a('0xf')](_0x9b3a('0x10'),_0x5a1172,_0x9b3a('0xe'),JSON[_0x9b3a('0x11')](_0x46cd57));if(_0x46cd57[_0x9b3a('0x12')]){if(_0x46cd57['error']['code']===0x1f4){logger[_0x9b3a('0x12')](_0x9b3a('0x13'),_0x5a1172,_0x46cd57[_0x9b3a('0x12')][_0x9b3a('0x14')]);return _0x25cdcb(_0x46cd57[_0x9b3a('0x12')][_0x9b3a('0x14')]);}logger['error'](_0x9b3a('0x13'),_0x5a1172,_0x46cd57[_0x9b3a('0x12')][_0x9b3a('0x14')]);return _0x56d7d2(_0x46cd57['error'][_0x9b3a('0x14')]);}else{logger['info'](_0x9b3a('0x13'),_0x5a1172,_0x9b3a('0xe'));_0x56d7d2(_0x46cd57[_0x9b3a('0x15')]['message']);}})[_0x9b3a('0x16')](function(_0x4589a8){logger[_0x9b3a('0x12')](_0x9b3a('0x13'),_0x5a1172,_0x4589a8);_0x25cdcb(_0x4589a8);});});} \ No newline at end of file +var _0x8445=['message','WhatsappTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8445,0x77));var _0x5844=function(_0x38690b,_0x158905){_0x38690b=_0x38690b-0x0;var _0x1478e7=_0x8445[_0x38690b];return _0x1478e7;};'use strict';var _=require(_0x5844('0x0'));var util=require(_0x5844('0x1'));var moment=require(_0x5844('0x2'));var BPromise=require(_0x5844('0x3'));var rs=require(_0x5844('0x4'));var fs=require('fs');var Redis=require(_0x5844('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5844('0x6'));var logger=require(_0x5844('0x7'))(_0x5844('0x8'));var config=require(_0x5844('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x195d35,_0x322863,_0x448480){return new BPromise(function(_0x490e4c,_0x2f8ec6){return client[_0x5844('0xa')](_0x195d35,_0x448480)[_0x5844('0xb')](function(_0xd467ff){logger[_0x5844('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x322863,_0x5844('0xd'));logger[_0x5844('0xe')](_0x5844('0xf'),_0x322863,_0x5844('0xd'),JSON[_0x5844('0x10')](_0xd467ff));if(_0xd467ff['error']){if(_0xd467ff[_0x5844('0x11')][_0x5844('0x12')]===0x1f4){logger[_0x5844('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x322863,_0xd467ff['error'][_0x5844('0x13')]);return _0x2f8ec6(_0xd467ff[_0x5844('0x11')][_0x5844('0x13')]);}logger[_0x5844('0x11')](_0x5844('0x14'),_0x322863,_0xd467ff[_0x5844('0x11')]['message']);return _0x490e4c(_0xd467ff['error'][_0x5844('0x13')]);}else{logger[_0x5844('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x322863,_0x5844('0xd'));_0x490e4c(_0xd467ff[_0x5844('0x15')][_0x5844('0x13')]);}})[_0x5844('0x16')](function(_0x34bbbf){logger[_0x5844('0x11')](_0x5844('0x14'),_0x322863,_0x34bbbf);_0x2f8ec6(_0x34bbbf);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index c471a19..f90bdd0 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3edc=['then','seedDB','default','listen','start','info','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','filter','online','Offline\x20apps:','join','None','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x2976de,_0x4c546d){_0x2976de=_0x2976de-0x0;var _0xecbf51=_0x3edc[_0x2976de];return _0xecbf51;};'use strict';var _=require(_0xc3ed('0x0'));var db=require(_0xc3ed('0x1'))['db'];var seedDb=require(_0xc3ed('0x2'));var checkLicense=require(_0xc3ed('0x3'));var rpc=require(_0xc3ed('0x4'));var config=require('./config/environment');var logger=require(_0xc3ed('0x5'))('app');var pm2=require(_0xc3ed('0x6'));var pm2Config=require(_0xc3ed('0x7'));var schedule=require(_0xc3ed('0x8'));var chat=require(_0xc3ed('0x9'));var whatsapp=require(_0xc3ed('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xc3ed('0xb'));function main(){return db[_0xc3ed('0xc')][_0xc3ed('0xd')]()[_0xc3ed('0xe')](function(){if(config[_0xc3ed('0xf')]){return seedDb[_0xc3ed('0x10')]();}})['then'](function(){return checkLicense[_0xc3ed('0x10')]();})[_0xc3ed('0xe')](function(){return rpc[_0xc3ed('0x11')]();})['then'](function(_0x57e75f){logger['info'](_0x57e75f);return chat[_0xc3ed('0x12')]();})[_0xc3ed('0xe')](function(){return whatsapp[_0xc3ed('0x12')]();})[_0xc3ed('0xe')](function(){return schedule[_0xc3ed('0x12')]();})[_0xc3ed('0xe')](function(){return transcribe[_0xc3ed('0x12')]();})[_0xc3ed('0xe')](function(){return provider[_0xc3ed('0x12')]();})[_0xc3ed('0xe')](function(_0x53937a){logger[_0xc3ed('0x13')](_0x53937a);return pm2[_0xc3ed('0x12')](pm2Config);})[_0xc3ed('0xe')](function(_0x2eb6f3){var _0x5f5d0b=_0x2eb6f3['filter'](function(_0x59f603){return typeof _0x59f603['exitCode']===_0xc3ed('0x14')&&_0x59f603[_0xc3ed('0x15')]>=0x0;});if(_0x5f5d0b['length']>0x0){throw new Error(_0x5f5d0b[_0xc3ed('0x16')]+_0xc3ed('0x17')+_['map'](_0x5f5d0b,function(_0x498d53){return'\x22'+_0x498d53[_0xc3ed('0x18')][_0xc3ed('0x19')]+'\x22';}));}logger['info'](_0xc3ed('0x1a'),_[_0xc3ed('0x1b')](_[_0xc3ed('0x1c')](_0x2eb6f3,{'status':_0xc3ed('0x1d')}),_0xc3ed('0x19'))['join']());logger[_0xc3ed('0x13')](_0xc3ed('0x1e'),_[_0xc3ed('0x1b')](_[_0xc3ed('0x1c')](_0x2eb6f3,function(_0x1a4ad6){return _0x1a4ad6['status']!==_0xc3ed('0x1d');}),'name')[_0xc3ed('0x1f')]()||_0xc3ed('0x20'));console[_0xc3ed('0x21')]('App\x20Ready!');})['catch'](function(_0x10fbdd){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x10fbdd);logger[_0xc3ed('0x22')](_0xc3ed('0x23'),_0x10fbdd);process[_0xc3ed('0x24')](0x1);});}main(); \ No newline at end of file +var _0x102b=['\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','join','Offline\x20apps:','status','online','name','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','start','info','filter','exitCode','length'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x102b,0x1be));var _0xb102=function(_0x23ca48,_0x52df82){_0x23ca48=_0x23ca48-0x0;var _0x88ed76=_0x102b[_0x23ca48];return _0x88ed76;};'use strict';var _=require('lodash');var db=require(_0xb102('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xb102('0x1'));var rpc=require(_0xb102('0x2'));var config=require(_0xb102('0x3'));var logger=require(_0xb102('0x4'))(_0xb102('0x5'));var pm2=require(_0xb102('0x6'));var pm2Config=require(_0xb102('0x7'));var schedule=require(_0xb102('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xb102('0x9'));var transcribe=require(_0xb102('0xa'));var provider=require(_0xb102('0xb'));function main(){return db[_0xb102('0xc')][_0xb102('0xd')]()['then'](function(){if(config[_0xb102('0xe')]){return seedDb['default']();}})['then'](function(){return checkLicense[_0xb102('0xf')]();})['then'](function(){return rpc['listen']();})[_0xb102('0x10')](function(_0x19f257){logger['info'](_0x19f257);return chat[_0xb102('0x11')]();})[_0xb102('0x10')](function(){return whatsapp[_0xb102('0x11')]();})[_0xb102('0x10')](function(){return schedule[_0xb102('0x11')]();})[_0xb102('0x10')](function(){return transcribe[_0xb102('0x11')]();})['then'](function(){return provider[_0xb102('0x11')]();})['then'](function(_0x2327ee){logger[_0xb102('0x12')](_0x2327ee);return pm2['start'](pm2Config);})[_0xb102('0x10')](function(_0x38db8c){var _0x5ab722=_0x38db8c[_0xb102('0x13')](function(_0x2925fb){return typeof _0x2925fb[_0xb102('0x14')]==='number'&&_0x2925fb['exitCode']>=0x0;});if(_0x5ab722['length']>0x0){throw new Error(_0x5ab722[_0xb102('0x15')]+_0xb102('0x16')+_[_0xb102('0x17')](_0x5ab722,function(_0xc80615){return'\x22'+_0xc80615['pm2_env']['name']+'\x22';}));}logger[_0xb102('0x12')](_0xb102('0x18'),_[_0xb102('0x17')](_[_0xb102('0x13')](_0x38db8c,{'status':'online'}),'name')[_0xb102('0x19')]());logger[_0xb102('0x12')](_0xb102('0x1a'),_[_0xb102('0x17')](_['filter'](_0x38db8c,function(_0xd2206b){return _0xd2206b[_0xb102('0x1b')]!==_0xb102('0x1c');}),_0xb102('0x1d'))['join']()||'None');console[_0xb102('0x1e')](_0xb102('0x1f'));})['catch'](function(_0x1752f1){console['log'](_0xb102('0x20'),_0x1752f1);logger[_0xb102('0x21')](_0xb102('0x22'),_0x1752f1);process[_0xb102('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a131f63..3e48e52 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 _0x0abf=['ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','disposition','closed','unmanaged','json','Forbidden.','headers','authorization','startsWith','User','then','authenticate','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','findOne','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','add','minutes','Invalid\x20API\x20access\x20key','catch','find','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','regenerateApiKey','test','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.','Sequelize','ValidationError','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','payload','session','randomBytes','toString','hex','floor','apiKeyIat','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','userpic','permissions','md5secret','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments'];(function(_0x48c718,_0x1341bd){var _0x2ef267=function(_0x221d87){while(--_0x221d87){_0x48c718['push'](_0x48c718['shift']());}};_0x2ef267(++_0x1341bd);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var db=require(_0xf0ab('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xf0ab('0x1'));var licenseUtil=require(_0xf0ab('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0xf0ab('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xf0ab('0x4'));var basicAuth=require(_0xf0ab('0x5'));var crypto=require(_0xf0ab('0x6'));var BPromise=require(_0xf0ab('0x7'));var util=require(_0xf0ab('0x8'));var moment=require(_0xf0ab('0x9'));var validateJwt=expressJwt({'secret':config[_0xf0ab('0xa')]['session']});var userAttributes=['id',_0xf0ab('0xb'),_0xf0ab('0xc'),_0xf0ab('0xd'),_0xf0ab('0xe'),'email',_0xf0ab('0xf'),_0xf0ab('0x10'),_0xf0ab('0x11'),'voicePause','chatPause',_0xf0ab('0x12'),'faxPause',_0xf0ab('0x13'),_0xf0ab('0x14'),_0xf0ab('0x15'),_0xf0ab('0x16'),_0xf0ab('0x17'),_0xf0ab('0x18'),_0xf0ab('0x19'),'allowmessenger',_0xf0ab('0x1a'),_0xf0ab('0x1b'),_0xf0ab('0x1c'),_0xf0ab('0x1d'),_0xf0ab('0x1e'),_0xf0ab('0x1f'),_0xf0ab('0x20'),_0xf0ab('0x21'),_0xf0ab('0x22'),_0xf0ab('0x23'),_0xf0ab('0x24'),_0xf0ab('0x25'),_0xf0ab('0x26'),_0xf0ab('0x27'),_0xf0ab('0x28'),'privacyEnabled',_0xf0ab('0x29'),_0xf0ab('0x2a'),_0xf0ab('0x2b'),_0xf0ab('0x2c'),_0xf0ab('0x2d'),_0xf0ab('0x2e'),_0xf0ab('0x2f'),_0xf0ab('0x30'),_0xf0ab('0x31'),_0xf0ab('0x32'),_0xf0ab('0x33'),_0xf0ab('0x34'),_0xf0ab('0x35'),_0xf0ab('0x36'),_0xf0ab('0x37'),_0xf0ab('0x38'),'faxAutoanswerDelay',_0xf0ab('0x39'),_0xf0ab('0x3a'),_0xf0ab('0x3b')];exports[_0xf0ab('0x3c')]=function(){return this[_0xf0ab('0x3d')](!![])[_0xf0ab('0x3e')](function(_0x250317,_0x20140b,_0x36ad01){if(_0x250317[_0xf0ab('0x3f')]){_0x36ad01();}else{return db[_0xf0ab('0x40')]['findOne']({'where':{'id':_0x250317['params']['id']},'attributes':['id','closed',_0xf0ab('0x41')],'raw':!![]})['then'](function(_0x3eca32){if(_0x3eca32&&_0x3eca32[_0xf0ab('0x42')]){return _0x20140b['status'](_0x3eca32[_0xf0ab('0x41')]===_0xf0ab('0x43')?0x195:0x193)[_0xf0ab('0x44')]({'message':_0x3eca32[_0xf0ab('0x41')]===_0xf0ab('0x43')?'Unmanaged.':_0xf0ab('0x45')});}else{_0x36ad01();}})['catch'](function(_0x55d799){_0x36ad01(_0x55d799);});}});};exports[_0xf0ab('0x3d')]=function isAuthenticated(_0x4306c6){return compose()[_0xf0ab('0x3e')](function(_0x445160,_0x43476c,_0x174052){var _0x367302;if(_0x445160[_0xf0ab('0x46')][_0xf0ab('0x47')]){if(_[_0xf0ab('0x48')](_0x445160[_0xf0ab('0x46')][_0xf0ab('0x47')],'Basic')){var _0x1e1ffb=basicAuth(_0x445160);db[_0xf0ab('0x49')]['find']({'where':{'name':_0x1e1ffb['name']}})[_0xf0ab('0x4a')](function(_0x1dc84e){if(!_0x1dc84e||!_0x1dc84e[_0xf0ab('0x4b')](_0x1e1ffb['pass'])){return _0x43476c['status'](0x191)[_0xf0ab('0x44')]({'message':'Wrong\x20credentials.'});}_0x445160[_0xf0ab('0x3f')]={'id':_0x1dc84e['id']};_0x174052();})['catch'](function(_0x3f66fa){_0x174052(_0x3f66fa);});}else if(_[_0xf0ab('0x48')](_0x445160['headers']['authorization'],_0xf0ab('0x4c'))){validateJwt(_0x445160,_0x43476c,_0x174052);}else{if(_0x4306c6){_0x174052();}else{return _0x43476c[_0xf0ab('0x4d')](0x193)[_0xf0ab('0x44')]({'message':_0xf0ab('0x4e')});}}}else if(_0x445160[_0xf0ab('0x4f')][_0xf0ab('0x50')]){try{var _0x17f3b3={'audience':hardwareConf[_0xf0ab('0x51')](),'issuer':hardwareConf[_0xf0ab('0x51')]()};verifyJwt(_0x445160[_0xf0ab('0x4f')][_0xf0ab('0x50')],_0x17f3b3)[_0xf0ab('0x4a')](function(_0x22dcfe){return db[_0xf0ab('0x49')]['find']({'where':{'id':_0x22dcfe[_0xf0ab('0x52')]}})[_0xf0ab('0x4a')](function(_0xc575ed){_0x367302=_0xc575ed;return db['Setting'][_0xf0ab('0x53')]({'where':{'id':0x1},'attributes':[_0xf0ab('0x54'),_0xf0ab('0x55')],'raw':!![]});})['then'](function(_0x396c71){if(!_0x367302||!_['isEqual'](_0x367302[_0xf0ab('0x56')],_0x22dcfe['nonce'])){return _0x43476c[_0xf0ab('0x4d')](0x191)[_0xf0ab('0x44')]({'message':_0xf0ab('0x57')});}if(_0x367302[_0xf0ab('0x58')]){return _0x43476c[_0xf0ab('0x4d')](0x191)[_0xf0ab('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x367302[_0xf0ab('0x59')]){if(_0x396c71[_0xf0ab('0x55')]>0x0){if(moment(_0x367302['blockedAt'])[_0xf0ab('0x5a')](_0x396c71[_0xf0ab('0x55')],_0xf0ab('0x5b'))>moment()){return _0x43476c[_0xf0ab('0x4d')](0x191)[_0xf0ab('0x44')]({'message':_0xf0ab('0x5c')});}}else{return _0x43476c[_0xf0ab('0x4d')](0x191)['json']({'message':_0xf0ab('0x5c')});}}_0x445160[_0xf0ab('0x3f')]={'id':_0x367302['id']};_0x174052();});})[_0xf0ab('0x5d')](function(){return _0x43476c['status'](0x191)[_0xf0ab('0x44')]({'message':_0xf0ab('0x5c')});});}catch(_0x44077b){_0x174052(_0x44077b);}}else if(_0x4306c6){_0x174052();}else{return _0x43476c[_0xf0ab('0x4d')](0x193)[_0xf0ab('0x44')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf0ab('0x3e')](function(_0x39a212,_0x28e7a4,_0x197955){if(_0x39a212[_0xf0ab('0x3f')]){db[_0xf0ab('0x49')][_0xf0ab('0x5e')]({'where':{'id':_0x39a212[_0xf0ab('0x3f')]['id']},'attributes':userAttributes})[_0xf0ab('0x4a')](function(_0x3b214a){if(!_0x3b214a){return _0x28e7a4[_0xf0ab('0x4d')](0x194)[_0xf0ab('0x44')]({'message':_0xf0ab('0x5f')});}_0x39a212['user']=_0x3b214a;_0x197955();})['catch'](function(_0x2fc677){_0x197955(_0x2fc677);});}else if(_0x4306c6){_0x197955();}else{return _0x28e7a4['status'](0x194)[_0xf0ab('0x44')]({'message':_0xf0ab('0x60')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xf0ab('0x3e')](function(_0x17ac48,_0x591d37,_0x35051f){return licenseUtil[_0xf0ab('0x61')]()[_0xf0ab('0x4a')](function(_0x1cb47a){if(_0x1cb47a[_0xf0ab('0x62')]){_0x35051f();}else{return _0x591d37[_0xf0ab('0x4d')](0x193)[_0xf0ab('0x44')]({'message':_0xf0ab('0x63')});}})[_0xf0ab('0x5d')](function(_0xe0cabc){_0x35051f(_0xe0cabc);});});};exports[_0xf0ab('0x64')]=function isWebrtcLicence(){return compose()[_0xf0ab('0x3e')](function(_0x13b477,_0x99ce7,_0x58fea3){return licenseUtil['getLicense']()[_0xf0ab('0x4a')](function(_0x4da898){if(_0x4da898['webrtc']){_0x58fea3();}else{return _0x99ce7['status'](0x193)[_0xf0ab('0x44')]({'message':_0xf0ab('0x63')});}})[_0xf0ab('0x5d')](function(_0x2df69a){_0x58fea3(_0x2df69a);});});};exports[_0xf0ab('0x65')]=function(_0x132ada,_0x472c1b,_0x1a0f21){_0x132ada[_0xf0ab('0x65')]=!![];return _0x1a0f21();};exports[_0xf0ab('0x66')]=function signToken(_0x344389){return signJwt(_0x344389);};exports[_0xf0ab('0x67')]=function(_0x4e6c9b,_0x393c9a){if(!_0x4e6c9b[_0xf0ab('0x3f')]){return _0x393c9a[_0xf0ab('0x4d')](0x194)[_0xf0ab('0x44')]({'message':_0xf0ab('0x68')});}var _0x29fb03={'payload':{'id':_0x4e6c9b[_0xf0ab('0x3f')]['id'],'role':_0x4e6c9b[_0xf0ab('0x3f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x29fb03)['then'](function(_0x51b4a9){_0x393c9a[_0xf0ab('0x69')](_0xf0ab('0x6a'),_0x51b4a9);_0x393c9a['redirect'](_0xf0ab('0x6b'));})[_0xf0ab('0x5d')](function(_0x4edb01){return _0x393c9a[_0xf0ab('0x4d')](0x1f4)[_0xf0ab('0x6c')](_0x4edb01);});};exports[_0xf0ab('0x6d')]=function(_0xe4ef6d){if(_[_0xf0ab('0x6e')](_0xe4ef6d[_0xf0ab('0x56')])||_[_0xf0ab('0x6e')](_0xe4ef6d['apiKeyIat'])){return null;}else{return createJwt(_0xe4ef6d);}};exports[_0xf0ab('0x6f')]=function(_0x59e7dd){_0x59e7dd[_0xf0ab('0x56')]=generateNonce();_0x59e7dd['apiKeyIat']=generateIssuedAt();return createJwt(_0x59e7dd);};exports[_0xf0ab('0x70')]=function(_0x5c721a,_0x535274){var _0x1e3b91=_0x5c721a['query'][_0xf0ab('0x50')];if(_0x1e3b91){var _0x54efed={'nonce':_0x535274[_0xf0ab('0x56')],'iat':_0x535274['apiKeyIat'],'audience':hardwareConf[_0xf0ab('0x51')](),'issuer':hardwareConf[_0xf0ab('0x51')]()};return verifyJwt(_0x1e3b91,_0x54efed)[_0xf0ab('0x4a')](function(){return generateApiKey(_0x535274);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x57b05f){var _0x2db43d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2db43d[_0xf0ab('0x71')](_0x57b05f))throw new db['Sequelize']['ValidationError'](_0xf0ab('0x72'));return;};exports[_0xf0ab('0x73')]=function(_0x8df75a,_0x4ead7d,_0x227597){var _0x41ea9d=encryptor[_0xf0ab('0x74')](_0x4ead7d)[_0xf0ab('0x75')](',');for(var _0x1d7616=0x0;_0x1d7616<_0x227597;_0x1d7616++){if(!_0x41ea9d[_0x1d7616])break;if(_0x8df75a[_0xf0ab('0x76')]()===_0x41ea9d[_0x1d7616][_0xf0ab('0x76')]()){var _0x4d80a6=util[_0xf0ab('0x77')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x227597);if(_0x227597===0x1){_0x4d80a6=_0xf0ab('0x78');}throw new db[(_0xf0ab('0x79'))][(_0xf0ab('0x7a'))](_0x4d80a6);}}return;};exports[_0xf0ab('0x7b')]=function(_0x3e1b85,_0x3c168f){var _0x152e80=_0x3c168f?encryptor[_0xf0ab('0x74')](_0x3c168f)[_0xf0ab('0x75')](','):[];if(_0x152e80[_0xf0ab('0x7c')]===0x5){_0x152e80['splice'](-0x1,0x1);}_0x152e80[_0xf0ab('0x7d')](_0x3e1b85);return encryptor[_0xf0ab('0x7e')](_0x152e80[_0xf0ab('0x7f')](','));};function signJwt(_0x1d4a72){var _0x2232eb=BPromise[_0xf0ab('0x80')](jwt[_0xf0ab('0x81')],{'context':jwt});var _0x14f61e=_0x1d4a72[_0xf0ab('0x82')]||config['secrets']['session'];return new BPromise(function(_0x7e0318,_0x5c286d){_0x2232eb(_0x1d4a72[_0xf0ab('0x83')],_0x14f61e,_0x1d4a72['options'])[_0xf0ab('0x4a')](function(_0x1cc702){_0x7e0318(_0x1cc702);})[_0xf0ab('0x5d')](function(_0x5daeda){_0x5c286d(_0x5daeda);});});}function verifyJwt(_0x2c1a44,_0x16522b,_0x3fc57e){var _0x3d333f=BPromise[_0xf0ab('0x80')](jwt['verify'],{'context':jwt});var _0x3f0e11=_0x3fc57e||config[_0xf0ab('0xa')][_0xf0ab('0x84')];return new BPromise(function(_0x4531ae,_0x14cd6f){_0x3d333f(_0x2c1a44,_0x3f0e11,_0x16522b)[_0xf0ab('0x4a')](function(_0xe3fc19){_0x4531ae(_0xe3fc19);})[_0xf0ab('0x5d')](function(_0x2d9194){_0x14cd6f(_0x2d9194);});});}function generateNonce(){return crypto[_0xf0ab('0x85')](0x10)[_0xf0ab('0x86')](_0xf0ab('0x87'));}function generateIssuedAt(){return Math[_0xf0ab('0x88')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x3e1f1e){var _0x1490de={'payload':{'iat':_0x3e1f1e[_0xf0ab('0x89')],'nonce':_0x3e1f1e['apiKeyNonce']},'options':{'algorithm':_0xf0ab('0x8a'),'subject':_0x3e1f1e['id']['toString'](),'issuer':hardwareConf[_0xf0ab('0x51')](),'audience':hardwareConf[_0xf0ab('0x51')]()}};return signJwt(_0x1490de)[_0xf0ab('0x4a')](function(_0x52e201){return{'iat':_0x3e1f1e[_0xf0ab('0x89')],'nonce':_0x3e1f1e['apiKeyNonce'],'token':_0x52e201};});} \ No newline at end of file +var _0x4cf8=['Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','options','promisify','verify','randomBytes','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','role','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','authenticate','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x4cf8[_0x5d31f3];return _0x1cc88c;};'use strict';var db=require(_0x84cf('0x0'))['db'];var config=require(_0x84cf('0x1'));var hardwareConf=require(_0x84cf('0x2'));var licenseUtil=require(_0x84cf('0x3'));var encryptor=require(_0x84cf('0x4'));var _=require(_0x84cf('0x5'));var jwt=require(_0x84cf('0x6'));var expressJwt=require(_0x84cf('0x7'));var compose=require(_0x84cf('0x8'));var basicAuth=require(_0x84cf('0x9'));var crypto=require(_0x84cf('0xa'));var BPromise=require(_0x84cf('0xb'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x84cf('0xc')]['session']});var userAttributes=['id',_0x84cf('0xd'),_0x84cf('0xe'),'name',_0x84cf('0xf'),_0x84cf('0x10'),'userpic',_0x84cf('0x11'),_0x84cf('0x12'),_0x84cf('0x13'),_0x84cf('0x14'),'mailPause',_0x84cf('0x15'),_0x84cf('0x16'),'openchannelPause','pauseType',_0x84cf('0x17'),_0x84cf('0x18'),_0x84cf('0x19'),_0x84cf('0x1a'),_0x84cf('0x1b'),_0x84cf('0x1c'),_0x84cf('0x1d'),_0x84cf('0x1e'),_0x84cf('0x1f'),_0x84cf('0x20'),_0x84cf('0x21'),_0x84cf('0x22'),_0x84cf('0x23'),_0x84cf('0x24'),_0x84cf('0x25'),_0x84cf('0x26'),_0x84cf('0x27'),_0x84cf('0x28'),_0x84cf('0x29'),'userProfileId',_0x84cf('0x2a'),_0x84cf('0x2b'),_0x84cf('0x2c'),_0x84cf('0x2d'),_0x84cf('0x2e'),_0x84cf('0x2f'),_0x84cf('0x30'),'selectRecallMeCampaign','chatAutoanswer',_0x84cf('0x31'),_0x84cf('0x32'),_0x84cf('0x33'),_0x84cf('0x34'),_0x84cf('0x35'),'openchannelAutoanswer',_0x84cf('0x36'),_0x84cf('0x37'),_0x84cf('0x38'),_0x84cf('0x39'),_0x84cf('0x3a'),'messengerSoundNotification'];exports[_0x84cf('0x3b')]=function(){return this[_0x84cf('0x3c')](!![])[_0x84cf('0x3d')](function(_0x23e1e7,_0x3e5e94,_0x29e9e1){if(_0x23e1e7[_0x84cf('0x3e')]){_0x29e9e1();}else{return db['ChatInteraction'][_0x84cf('0x3f')]({'where':{'id':_0x23e1e7[_0x84cf('0x40')]['id']},'attributes':['id',_0x84cf('0x41'),_0x84cf('0x42')],'raw':!![]})[_0x84cf('0x43')](function(_0x44d4bf){if(_0x44d4bf&&_0x44d4bf[_0x84cf('0x41')]){return _0x3e5e94[_0x84cf('0x44')](_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?0x195:0x193)['json']({'message':_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?_0x84cf('0x46'):_0x84cf('0x47')});}else{_0x29e9e1();}})['catch'](function(_0x1595dd){_0x29e9e1(_0x1595dd);});}});};exports['isAuthenticated']=function isAuthenticated(_0x29455e){return compose()[_0x84cf('0x3d')](function(_0x43b41b,_0xc15298,_0x51adcf){var _0x20de4b;if(_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')]){if(_[_0x84cf('0x4a')](_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')],_0x84cf('0x4b'))){var _0x18243d=basicAuth(_0x43b41b);db[_0x84cf('0x4c')]['find']({'where':{'name':_0x18243d['name']}})[_0x84cf('0x43')](function(_0x25de3a){if(!_0x25de3a||!_0x25de3a[_0x84cf('0x4d')](_0x18243d[_0x84cf('0x4e')])){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x50')});}_0x43b41b[_0x84cf('0x3e')]={'id':_0x25de3a['id']};_0x51adcf();})['catch'](function(_0x113b3e){_0x51adcf(_0x113b3e);});}else if(_[_0x84cf('0x4a')](_0x43b41b['headers'][_0x84cf('0x49')],'Bearer')){validateJwt(_0x43b41b,_0xc15298,_0x51adcf);}else{if(_0x29455e){_0x51adcf();}else{return _0xc15298[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}}}else if(_0x43b41b[_0x84cf('0x52')][_0x84cf('0x53')]){try{var _0x49d415={'audience':hardwareConf[_0x84cf('0x54')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x43b41b['query'][_0x84cf('0x53')],_0x49d415)[_0x84cf('0x43')](function(_0x4c4676){return db[_0x84cf('0x4c')][_0x84cf('0x55')]({'where':{'id':_0x4c4676[_0x84cf('0x56')]}})[_0x84cf('0x43')](function(_0xd13908){_0x20de4b=_0xd13908;return db[_0x84cf('0x57')]['findOne']({'where':{'id':0x1},'attributes':[_0x84cf('0x58'),_0x84cf('0x59')],'raw':!![]});})[_0x84cf('0x43')](function(_0x32cff6){if(!_0x20de4b||!_[_0x84cf('0x5a')](_0x20de4b[_0x84cf('0x5b')],_0x4c4676['nonce'])){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5c')});}if(_0x20de4b[_0x84cf('0x5d')]){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}if(_0x20de4b[_0x84cf('0x5f')]){if(_0x32cff6[_0x84cf('0x59')]>0x0){if(moment(_0x20de4b[_0x84cf('0x60')])[_0x84cf('0x61')](_0x32cff6['blockDuration'],_0x84cf('0x62'))>moment()){return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}}else{return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x43b41b[_0x84cf('0x3e')]={'id':_0x20de4b['id']};_0x51adcf();});})['catch'](function(){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5e')});});}catch(_0x40ae50){_0x51adcf(_0x40ae50);}}else if(_0x29455e){_0x51adcf();}else{return _0xc15298['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}})[_0x84cf('0x3d')](function(_0x5ef5fb,_0x3c1314,_0x5f1b8e){if(_0x5ef5fb[_0x84cf('0x3e')]){db['User']['find']({'where':{'id':_0x5ef5fb['user']['id']},'attributes':userAttributes})[_0x84cf('0x43')](function(_0xcf14ba){if(!_0xcf14ba){return _0x3c1314['status'](0x194)[_0x84cf('0x4f')]({'message':'User\x20not\x20found.'});}_0x5ef5fb[_0x84cf('0x3e')]=_0xcf14ba;_0x5f1b8e();})[_0x84cf('0x63')](function(_0x5ce309){_0x5f1b8e(_0x5ce309);});}else if(_0x29455e){_0x5f1b8e();}else{return _0x3c1314[_0x84cf('0x44')](0x194)['json']({'message':_0x84cf('0x64')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5d8b69,_0x5498ec,_0x585644){return licenseUtil['getLicense']()['then'](function(_0x210d9b){if(_0x210d9b[_0x84cf('0x65')]){_0x585644();}else{return _0x5498ec[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':'Forbidden'});}})[_0x84cf('0x63')](function(_0x4af229){_0x585644(_0x4af229);});});};exports[_0x84cf('0x66')]=function isWebrtcLicence(){return compose()[_0x84cf('0x3d')](function(_0x1533a7,_0x253464,_0x121bb9){return licenseUtil[_0x84cf('0x67')]()['then'](function(_0x2f7da6){if(_0x2f7da6[_0x84cf('0x68')]){_0x121bb9();}else{return _0x253464['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x69')});}})[_0x84cf('0x63')](function(_0x5212ec){_0x121bb9(_0x5212ec);});});};exports['isMiddleware']=function(_0x5499f9,_0x1cf3f6,_0x104421){_0x5499f9[_0x84cf('0x6a')]=!![];return _0x104421();};exports[_0x84cf('0x6b')]=function signToken(_0x271cc3){return signJwt(_0x271cc3);};exports[_0x84cf('0x6c')]=function(_0x51d725,_0x350985){if(!_0x51d725['user']){return _0x350985[_0x84cf('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x46c595={'payload':{'id':_0x51d725[_0x84cf('0x3e')]['id'],'role':_0x51d725[_0x84cf('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x46c595)['then'](function(_0x290a4d){_0x350985[_0x84cf('0x6d')](_0x84cf('0x6e'),_0x290a4d);_0x350985[_0x84cf('0x6f')](_0x84cf('0x70'));})['catch'](function(_0xcfe28f){return _0x350985[_0x84cf('0x44')](0x1f4)['send'](_0xcfe28f);});};exports[_0x84cf('0x71')]=function(_0x5baea8){if(_['isNil'](_0x5baea8[_0x84cf('0x5b')])||_[_0x84cf('0x72')](_0x5baea8['apiKeyIat'])){return null;}else{return createJwt(_0x5baea8);}};exports['generateApiKey']=function(_0x31176c){_0x31176c[_0x84cf('0x5b')]=generateNonce();_0x31176c[_0x84cf('0x73')]=generateIssuedAt();return createJwt(_0x31176c);};exports[_0x84cf('0x74')]=function(_0x406c33,_0x3edaec){var _0x3a0eb4=_0x406c33[_0x84cf('0x52')]['apikey'];if(_0x3a0eb4){var _0x1bc15c={'nonce':_0x3edaec[_0x84cf('0x5b')],'iat':_0x3edaec['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x84cf('0x54')]()};return verifyJwt(_0x3a0eb4,_0x1bc15c)[_0x84cf('0x43')](function(){return generateApiKey(_0x3edaec);});}else{throw{'message':_0x84cf('0x75')};}};exports[_0x84cf('0x76')]=function(_0x340915){var _0xfec87d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xfec87d[_0x84cf('0x77')](_0x340915))throw new db['Sequelize'][(_0x84cf('0x78'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x84cf('0x79')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){var _0x55d8c4=encryptor[_0x84cf('0x7a')](_0x2a60bc)[_0x84cf('0x7b')](',');for(var _0x52a3f1=0x0;_0x52a3f1<_0x1c2f1b;_0x52a3f1++){if(!_0x55d8c4[_0x52a3f1])break;if(_0x5c0122[_0x84cf('0x7c')]()===_0x55d8c4[_0x52a3f1]['toLowerCase']()){var _0x577d55=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1c2f1b);if(_0x1c2f1b===0x1){_0x577d55=_0x84cf('0x7d');}throw new db[(_0x84cf('0x7e'))][(_0x84cf('0x78'))](_0x577d55);}}return;};exports[_0x84cf('0x7f')]=function(_0x480c3e,_0x32aa8b){var _0x3c1c55=_0x32aa8b?encryptor['decryptString'](_0x32aa8b)[_0x84cf('0x7b')](','):[];if(_0x3c1c55[_0x84cf('0x80')]===0x5){_0x3c1c55[_0x84cf('0x81')](-0x1,0x1);}_0x3c1c55[_0x84cf('0x82')](_0x480c3e);return encryptor[_0x84cf('0x83')](_0x3c1c55[_0x84cf('0x84')](','));};function signJwt(_0x1f1f76){var _0x39a336=BPromise['promisify'](jwt[_0x84cf('0x85')],{'context':jwt});var _0x58a96a=_0x1f1f76[_0x84cf('0x86')]||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x276ab1,_0x2602b7){_0x39a336(_0x1f1f76['payload'],_0x58a96a,_0x1f1f76[_0x84cf('0x88')])[_0x84cf('0x43')](function(_0xe1a1d9){_0x276ab1(_0xe1a1d9);})['catch'](function(_0xdb9b0c){_0x2602b7(_0xdb9b0c);});});}function verifyJwt(_0x240cca,_0x4e6077,_0x84d9cb){var _0x482958=BPromise[_0x84cf('0x89')](jwt[_0x84cf('0x8a')],{'context':jwt});var _0x57f1f2=_0x84d9cb||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x4a7905,_0x40b33e){_0x482958(_0x240cca,_0x57f1f2,_0x4e6077)[_0x84cf('0x43')](function(_0x262ae1){_0x4a7905(_0x262ae1);})[_0x84cf('0x63')](function(_0x577ade){_0x40b33e(_0x577ade);});});}function generateNonce(){return crypto[_0x84cf('0x8b')](0x10)[_0x84cf('0x8c')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x84cf('0x8c')]();}function createJwt(_0x8399f4){var _0xfcd0d={'payload':{'iat':_0x8399f4['apiKeyIat'],'nonce':_0x8399f4['apiKeyNonce']},'options':{'algorithm':_0x84cf('0x8d'),'subject':_0x8399f4['id'][_0x84cf('0x8c')](),'issuer':hardwareConf[_0x84cf('0x54')](),'audience':hardwareConf[_0x84cf('0x54')]()}};return signJwt(_0xfcd0d)[_0x84cf('0x43')](function(_0x39bd44){return{'iat':_0x8399f4[_0x84cf('0x73')],'nonce':_0x8399f4[_0x84cf('0x5b')],'token':_0x39bd44};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 02e34af..b85f63e 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e8d=['findOne','length','fieldType','type','catch','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','user','skip','checkListsRestrictions','then','ids','tag','count','User','clause','rows','describe','CmContact','keys','startsWith','cf_','map','CmCustomField'];(function(_0x4ebe88,_0x10b8a8){var _0x3dbfae=function(_0x5adc06){while(--_0x5adc06){_0x4ebe88['push'](_0x4ebe88['shift']());}};_0x3dbfae(++_0x10b8a8);}(_0x8e8d,0x1b5));var _0xd8e8=function(_0x493dc7,_0x2d125b){_0x493dc7=_0x493dc7-0x0;var _0x3cd6a8=_0x8e8d[_0x493dc7];return _0x3cd6a8;};'use strict';var _=require(_0xd8e8('0x0'));var sqlUtils=require(_0xd8e8('0x1'));var db=require(_0xd8e8('0x2'))['db'];exports[_0xd8e8('0x3')]=function(_0x45e248,_0x431f87,_0x4aeb9c,_0x47b905){var _0x112fdc={'count':0x0,'rows':[]};var _0xe2eadb=sqlUtils[_0xd8e8('0x4')](_0x431f87,_0x45e248);if(_0xe2eadb){return Promise['resolve'](_0x112fdc);}var _0x493faf=sqlUtils[_0xd8e8('0x5')]();var _0x469978={};var _0x48c0cc=![];var _0x50bdd8=![];return Promise[_0xd8e8('0x6')]()['then'](function(){if(_0x45e248['search']){return sqlUtils[_0xd8e8('0x7')](_0x45e248[_0xd8e8('0x8')],_0x47b905);}else{return sqlUtils[_0xd8e8('0x9')](_0x45e248,_0x47b905);}})['then'](function(_0x4caa36){_0x493faf[_0xd8e8('0xa')](_0x4caa36[_0xd8e8('0xb')]);_0x493faf[_0xd8e8('0xa')](_0x4caa36[_0xd8e8('0xc')]);_0x493faf[_0xd8e8('0xa')](_0x4caa36[_0xd8e8('0xd')]);_0x493faf[_0xd8e8('0xa')](_0x4caa36[_0xd8e8('0xe')]['clause']);_0x469978=_0x4caa36['tags'];_0x50bdd8=_0x4caa36['user'][_0xd8e8('0xf')];return sqlUtils[_0xd8e8('0x10')](_0x431f87,_0x45e248,_0x50bdd8);})[_0xd8e8('0x11')](function(_0x1ab62c){_0x493faf['where'](_0x1ab62c);var _0x3673ee=_0x45e248['search']?_0x469978[_0xd8e8('0x12')]:_0x45e248[_0xd8e8('0x13')];_0x48c0cc=_0x3673ee?!![]:![];return sqlUtils['countFilteredContacts'](_0x493faf,_0x3673ee);})[_0xd8e8('0x11')](function(_0xcba9e6){_0x112fdc[_0xd8e8('0x14')]=_0xcba9e6;if(_0x112fdc[_0xd8e8('0x14')]===0x0){return;}if(_0x45e248[_0xd8e8('0x15')]){_0x50bdd8=!![];}return sqlUtils['buildContactsQuery'](_0x493faf,_0x45e248[_0xd8e8('0xc')],_0x4aeb9c,_0x48c0cc,_0x469978[_0xd8e8('0x16')],_0x50bdd8);})[_0xd8e8('0x11')](function(_0x38d53d){if(!_0x38d53d){return[];}return sqlUtils['getFilteredContacts'](_0x38d53d,_0x45e248,_0x4aeb9c);})['then'](function(_0xa90fae){_0x112fdc[_0xd8e8('0x17')]=_0xa90fae;return _0x112fdc;})['catch'](function(_0x2a0b92){throw _0x2a0b92;});};exports[_0xd8e8('0x18')]=function(){var _0x13006d={};var _0x8e7b27=[];return db[_0xd8e8('0x19')]['describe']()[_0xd8e8('0x11')](function(_0x2eafc2){_0x13006d=_0x2eafc2;var _0x2e81c3=Object[_0xd8e8('0x1a')](_0x13006d)['filter'](function(_0x161039){return _[_0xd8e8('0x1b')](_0x161039,_0xd8e8('0x1c'))?_0x161039:undefined;});var _0x276508=_0x2e81c3[_0xd8e8('0x1d')](function(_0x48a175){return db[_0xd8e8('0x1e')][_0xd8e8('0x1f')]({'where':{'id':_0x48a175['slice'](0x3)},'raw':!![]});});return Promise['all'](_0x276508);})[_0xd8e8('0x11')](function(_0x1849b0){for(var _0x133b3e=0x0;_0x133b3e<_0x1849b0[_0xd8e8('0x20')];_0x133b3e++){if(_0x1849b0[_0x133b3e]){var _0x40ab8b=_0xd8e8('0x1c')+_0x1849b0[_0x133b3e]['id'];_0x13006d[_0x40ab8b][_0xd8e8('0x21')]=_0x1849b0[_0x133b3e][_0xd8e8('0x22')];}}_0x8e7b27=_[_0xd8e8('0x1d')](Object[_0xd8e8('0x1a')](_0x13006d),function(_0x41e41f){return{'name':_0x41e41f,'type':_0x13006d[_0x41e41f][_0xd8e8('0x22')]};});return _0x8e7b27;})[_0xd8e8('0x23')](function(_0x25b348){throw _0x25b348;});}; \ No newline at end of file +var _0x5179=['keys','cf_','map','findOne','all','length','type','catch','./sql-utils','findAll','skipContactsQuery','getContactsSubquery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','filter','user','clause','skip','checkListsRestrictions','tag','countFilteredContacts','count','buildContactsQuery','fields','getFilteredContacts','rows','describe'];(function(_0x27b994,_0x309afe){var _0x364a12=function(_0x475ad3){while(--_0x475ad3){_0x27b994['push'](_0x27b994['shift']());}};_0x364a12(++_0x309afe);}(_0x5179,0x108));var _0x9517=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x5179[_0x1b7368];return _0x25d54c;};'use strict';var _=require('lodash');var sqlUtils=require(_0x9517('0x0'));var db=require('../../mysqldb')['db'];exports[_0x9517('0x1')]=function(_0x507e9d,_0x36b70b,_0xf03dbf,_0x391a74){var _0x49c55b={'count':0x0,'rows':[]};var _0x54063d=sqlUtils[_0x9517('0x2')](_0x36b70b,_0x507e9d);if(_0x54063d){return Promise['resolve'](_0x49c55b);}var _0x2a2328=sqlUtils[_0x9517('0x3')]();var _0x49b3dd={};var _0x55ac76=![];var _0x32a174=![];return Promise[_0x9517('0x4')]()['then'](function(){if(_0x507e9d[_0x9517('0x5')]){return sqlUtils[_0x9517('0x6')](_0x507e9d[_0x9517('0x5')],_0x391a74);}else{return sqlUtils[_0x9517('0x7')](_0x507e9d,_0x391a74);}})[_0x9517('0x8')](function(_0x532422){_0x2a2328[_0x9517('0x9')](_0x532422[_0x9517('0xa')]);_0x2a2328[_0x9517('0x9')](_0x532422['fields']);_0x2a2328['where'](_0x532422[_0x9517('0xb')]);_0x2a2328[_0x9517('0x9')](_0x532422[_0x9517('0xc')][_0x9517('0xd')]);_0x49b3dd=_0x532422['tags'];_0x32a174=_0x532422[_0x9517('0xc')][_0x9517('0xe')];return sqlUtils[_0x9517('0xf')](_0x36b70b,_0x507e9d,_0x32a174);})['then'](function(_0x481c37){_0x2a2328['where'](_0x481c37);var _0x1a556f=_0x507e9d[_0x9517('0x5')]?_0x49b3dd['ids']:_0x507e9d[_0x9517('0x10')];_0x55ac76=_0x1a556f?!![]:![];return sqlUtils[_0x9517('0x11')](_0x2a2328,_0x1a556f);})[_0x9517('0x8')](function(_0x2e3679){_0x49c55b[_0x9517('0x12')]=_0x2e3679;if(_0x49c55b[_0x9517('0x12')]===0x0){return;}if(_0x507e9d['User']){_0x32a174=!![];}return sqlUtils[_0x9517('0x13')](_0x2a2328,_0x507e9d[_0x9517('0x14')],_0xf03dbf,_0x55ac76,_0x49b3dd[_0x9517('0xd')],_0x32a174);})[_0x9517('0x8')](function(_0x68a06f){if(!_0x68a06f){return[];}return sqlUtils[_0x9517('0x15')](_0x68a06f,_0x507e9d,_0xf03dbf);})['then'](function(_0x1d3c59){_0x49c55b[_0x9517('0x16')]=_0x1d3c59;return _0x49c55b;})['catch'](function(_0x351e7e){throw _0x351e7e;});};exports[_0x9517('0x17')]=function(){var _0x106b16={};var _0x3eb780=[];return db['CmContact'][_0x9517('0x17')]()[_0x9517('0x8')](function(_0x50caf4){_0x106b16=_0x50caf4;var _0x58d05f=Object[_0x9517('0x18')](_0x106b16)['filter'](function(_0x493e73){return _['startsWith'](_0x493e73,_0x9517('0x19'))?_0x493e73:undefined;});var _0x294a6c=_0x58d05f[_0x9517('0x1a')](function(_0x104b14){return db['CmCustomField'][_0x9517('0x1b')]({'where':{'id':_0x104b14['slice'](0x3)},'raw':!![]});});return Promise[_0x9517('0x1c')](_0x294a6c);})[_0x9517('0x8')](function(_0x3e9d90){for(var _0x345d1f=0x0;_0x345d1f<_0x3e9d90[_0x9517('0x1d')];_0x345d1f++){if(_0x3e9d90[_0x345d1f]){var _0x466c2b=_0x9517('0x19')+_0x3e9d90[_0x345d1f]['id'];_0x106b16[_0x466c2b]['fieldType']=_0x3e9d90[_0x345d1f][_0x9517('0x1e')];}}_0x3eb780=_[_0x9517('0x1a')](Object[_0x9517('0x18')](_0x106b16),function(_0xf85033){return{'name':_0xf85033,'type':_0x106b16[_0xf85033][_0x9517('0x1e')]};});return _0x3eb780;})[_0x9517('0x1f')](function(_0x40a302){throw _0x40a302;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 92e6173..e769802 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72fb=['user','clause','uc.UserId\x20=\x20?','skip','compact','Contact','User','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','filter','resolve','agent','getLists','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','sequelize','query','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','SELECT','COUNT(*)','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','castTo','DATE','buildExpression','type','default','text','start','value','Tag','split','map','tags','and','ids'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x72fb,0x113));var _0xb72f=function(_0x4920f2,_0xa4bfbf){_0x4920f2=_0x4920f2-0x0;var _0x1f27cf=_0x72fb[_0x4920f2];return _0x1f27cf;};'use strict';var _=require('lodash');var squel=require(_0xb72f('0x0'));var as=require(_0xb72f('0x1'));var qs=require(_0xb72f('0x2'));var utils=require(_0xb72f('0x3'));var db=require(_0xb72f('0x4'))['db'];function skipContactsQuery(_0x38c82a,_0x187971){var _0x185821=![];if(_0x38c82a[_0xb72f('0x5')]==='agent'&&!_0x187971[_0xb72f('0x6')]&&!_0x187971[_0xb72f('0x7')]&&_0x187971[_0xb72f('0x8')]!=='true'){_0x185821=!![];}return _0x185821;}function getContactsSubquery(){return squel[_0xb72f('0x9')]()[_0xb72f('0xa')](_0xb72f('0xb'),'c')[_0xb72f('0xc')](_0xb72f('0xd'));}function applyJoinClauses(_0x469ce4,_0x4ecce3){var _0x3a298b=_0x4ecce3?'c':_0xb72f('0xe');_0x469ce4[_0xb72f('0xf')](_0xb72f('0x10'),'uc',_0xb72f('0x11')+_0x3a298b+'.id')[_0xb72f('0xf')](_0xb72f('0x12'),'ct',_0xb72f('0x13')+_0x3a298b+_0xb72f('0x14'))['left_join'](_0xb72f('0x15'),'t',_0xb72f('0x16'));return _0x469ce4;}function addFieldsToQuery(_0x255a20,_0x17ef37,_0x396497,_0x2a6b76,_0x393505){var _0x28104d=_0x393505?'c':'subqry';if(!_0x17ef37){_0x17ef37=['id',_0xb72f('0x17'),_0xb72f('0x18'),_0xb72f('0x19'),_0xb72f('0x1a'),'fax',_0xb72f('0x1b'),'ListId',_0xb72f('0x1c'),_0xb72f('0x1d'),_0xb72f('0x1e'),_0xb72f('0x1f'),_0xb72f('0x20')];}else if(!_0x17ef37[_0xb72f('0x21')]('id')){_0x17ef37[_0xb72f('0x22')]('id');}var _0x500c23=_0x396497&&_0x393505||!_0x396497&&!_0x393505;if(_0x2a6b76){_0x500c23=_0x2a6b76&&_0x393505||!_0x2a6b76&&!_0x393505;}_0x17ef37[_0xb72f('0x23')](function(_0x3fdab3){if(_0x3fdab3===_0xb72f('0x20')){if(_0x500c23){_0x255a20['field'](_0xb72f('0x24'),_0x3fdab3);}else if(_0x396497||_0x2a6b76){_0x255a20[_0xb72f('0x25')](_0x28104d+'.'+_0x3fdab3);}}else{_0x255a20[_0xb72f('0x25')](_0x28104d+'.'+_0x3fdab3);}});return _0x255a20;}function getSqlClauses(){var _0x2818af={'default':squel[_0xb72f('0x26')](),'fields':squel['expr'](),'filter':squel[_0xb72f('0x26')](),'tags':{'clause':squel[_0xb72f('0x26')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x2818af;}function parseTagParameter(_0x27c523){var _0x38ca51=squel['expr']();if(_0x27c523){var _0x170327=utils[_0xb72f('0x27')](_0x27c523);_0x170327['forEach'](function(_0x277955){_0x38ca51['or'](_0xb72f('0x28'),'%,'+_0x277955+',%');});}return _0x38ca51;}function parseSearchFilter(_0x4be363){var _0x3fed77=squel[_0xb72f('0x26')]();if(_0x4be363){var _0x5cf718=_0x4be363['replace']('\x5c','\x5c\x5c')[_0xb72f('0x29')](/'/g,'\x27\x27');if(_0x5cf718['split']('\x20')[_0xb72f('0x2a')]>0x1){_0x3fed77['or'](_0xb72f('0x2b'),qs[_0xb72f('0x2c')](_0x5cf718,!![]),null);}else{if(qs[_0xb72f('0x2d')](_0x5cf718)){_0x3fed77['or']('c.id\x20LIKE\x20?',_0x5cf718+'%');_0x3fed77['or'](_0xb72f('0x2e'),_0x5cf718+'%');_0x3fed77['or']('c.mobile\x20LIKE\x20?',_0x5cf718+'%');_0x3fed77['or'](_0xb72f('0x2f'),_0x5cf718+'%');}else if(qs[_0xb72f('0x30')](_0x5cf718)){_0x3fed77['or'](_0xb72f('0x31'),_0x5cf718+'%');}else{_0x3fed77['or'](_0xb72f('0x32'),'%'+_0x5cf718+'%');_0x3fed77['or'](_0xb72f('0x33'),'%'+_0x5cf718+'%');_0x3fed77['or'](_0xb72f('0x31'),'%'+_0x5cf718+'%');}}}return _0x3fed77;}function parseAdvancedSearchFilter(_0x54fcce,_0x13e2c4){var _0x2e62c9=getSqlClauses();var _0x419c3c=as[_0xb72f('0x34')](_0x54fcce);var _0x246c5a=_0x419c3c[_0xb72f('0x35')];for(var _0x46b767=0x0;_0x46b767<_0x419c3c[_0xb72f('0x36')][_0xb72f('0x2a')];_0x46b767++){var _0x52549a=_0x419c3c[_0xb72f('0x36')][_0x46b767];var _0x4c72a2='c';var _0x2d9072=_[_0xb72f('0x37')](_0x13e2c4,[_0xb72f('0x38'),_0x52549a[_0xb72f('0x25')]]);if(_0x2d9072){if(_0x52549a[_0xb72f('0x25')]===_0xb72f('0x39')||_0x2d9072[_0xb72f('0x3a')]==='datetime'){_0x52549a[_0xb72f('0x3b')]=_0xb72f('0x3c');}var _0x249409=as[_0xb72f('0x3d')](_0x4c72a2,_0x2d9072[_0xb72f('0x3e')],_0x52549a);_0x2e62c9[_0xb72f('0x3f')][_0x246c5a](_0x249409[_0xb72f('0x40')],_0x249409['value'][_0xb72f('0x41')],_0x249409[_0xb72f('0x42')]['end']);}else{if(_0x52549a[_0xb72f('0x25')]===_0xb72f('0x43')){var _0x55455d=_0x52549a[_0xb72f('0x42')][_0xb72f('0x44')](',')[_0xb72f('0x45')](function(_0x6d524f){return Number(_0x6d524f);});var _0x1b4f0c=parseTagParameter(_0x55455d);_0x2e62c9[_0xb72f('0x46')]['clause'][_0xb72f('0x47')](_0x1b4f0c);_0x2e62c9[_0xb72f('0x46')][_0xb72f('0x48')]=_0x55455d;}else if(_0x52549a[_0xb72f('0x25')]==='User'){_0x2e62c9[_0xb72f('0x49')][_0xb72f('0x4a')][_0xb72f('0x47')](_0xb72f('0x4b'),_0x52549a[_0xb72f('0x42')]);_0x2e62c9[_0xb72f('0x49')][_0xb72f('0x4c')]=!![];}}}return _0x2e62c9;}function parseModelFields(_0x2e21cb,_0x1d50a0){var _0x593098=squel[_0xb72f('0x26')]();var _0x1e3674=_(_0x2e21cb)['keys']()[_0xb72f('0x45')](function(_0x12fbf5){return _['some'](_0x1d50a0,[_0xb72f('0x38'),_0x12fbf5])?_0x12fbf5:undefined;})[_0xb72f('0x4d')]()['value']();if(_0x2e21cb[_0xb72f('0x4e')]){_0x1e3674[_0xb72f('0x22')](_0xb72f('0x4e'));}if(_0x2e21cb[_0xb72f('0x4f')]){_0x1e3674[_0xb72f('0x22')](_0xb72f('0x4f'));}if(_0x1e3674[_0xb72f('0x2a')]>0x0){_0x1e3674[_0xb72f('0x23')](function(_0x426678){if(_0x426678===_0xb72f('0x7')){_0x593098[_0xb72f('0x47')]('c.ListId\x20IN\x20?',[][_0xb72f('0x50')](_0x2e21cb[_0x426678]));}else if(_0x426678==='Contact'){var _0x2d52ea='%'+_0x2e21cb[_0x426678]+'%';_0x593098[_0xb72f('0x47')](_0xb72f('0x51'),_0x2d52ea);}else if(_0x426678==='User'){_0x593098[_0xb72f('0x47')](_0xb72f('0x4b'),_0x2e21cb[_0x426678]);}else{_0x593098[_0xb72f('0x47')]('c.'+_0x426678+_0xb72f('0x52'),_0x2e21cb[_0x426678]);}});}return _0x593098;}function parseQueryParameters(_0x5670b4,_0x147a8b){var _0x22c817=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x5670b4,_0x147a8b);})[_0xb72f('0x53')](function(_0x482855){_0x22c817[_0xb72f('0x54')][_0xb72f('0x47')](_0x482855);return parseTagParameter(_0x5670b4[_0xb72f('0x55')]);})['then'](function(_0x582318){_0x22c817[_0xb72f('0x46')][_0xb72f('0x4a')][_0xb72f('0x47')](_0x582318);return parseSearchFilter(_0x5670b4[_0xb72f('0x56')]);})[_0xb72f('0x53')](function(_0x3498b6){_0x22c817[_0xb72f('0x56')]=_0x3498b6;return _0x22c817;});}function checkListsRestrictions(_0x21ab0d,_0x269d2c,_0x4b9051){var _0x5e59d1=squel[_0xb72f('0x26')]();return Promise[_0xb72f('0x57')]()[_0xb72f('0x53')](function(){if(_0x269d2c[_0xb72f('0x6')]&&_0x21ab0d[_0xb72f('0x5')]===_0xb72f('0x58')&&!_0x4b9051){return _0x21ab0d[_0xb72f('0x59')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x136337){if(_0x136337){if(_0x136337[_0xb72f('0x2a')]===0x0){_0x5e59d1[_0xb72f('0x47')]('c.ListId\x20IS\x20NULL');}else{_0x5e59d1[_0xb72f('0x47')](_0xb72f('0x5a'),_[_0xb72f('0x45')](_0x136337,'id'));}}})[_0xb72f('0x53')](function(){return _0x5e59d1;});}function buildContactsQuery(_0x31ea9f,_0x45b3b0,_0x434f6d,_0x29ca74,_0x5ca3e0,_0x41a4cc){if(_0x45b3b0){_0x45b3b0=_0x434f6d[_0xb72f('0x5b')];}_0x31ea9f=addFieldsToQuery(_0x31ea9f,_0x45b3b0,_0x29ca74,_0x41a4cc,!![]);var _0x344149=squel[_0xb72f('0x9')]();_0x344149=addFieldsToQuery(_0x344149,_0x45b3b0,_0x29ca74,_0x41a4cc,![]);if(_0x29ca74||_0x41a4cc){_0x31ea9f=applyJoinClauses(_0x31ea9f,!![]);_0x31ea9f[_0xb72f('0x5c')](_0xb72f('0x5d'));if(_0x434f6d[_0xb72f('0x5e')]){_0x344149[_0xb72f('0x5e')](_0x434f6d[_0xb72f('0x5e')]);}if(_0x434f6d[_0xb72f('0x5f')]){_0x344149[_0xb72f('0x5f')](_0x434f6d[_0xb72f('0x5f')]);}}else{_0x344149=applyJoinClauses(_0x344149,![]);_0x344149[_0xb72f('0x5c')](_0xb72f('0x60'));if(_0x434f6d[_0xb72f('0x5e')]){_0x31ea9f[_0xb72f('0x5e')](_0x434f6d[_0xb72f('0x5e')]);}if(_0x434f6d[_0xb72f('0x5f')]){_0x31ea9f[_0xb72f('0x5f')](_0x434f6d['offset']);}}_0x344149[_0xb72f('0x61')](_0x5ca3e0);if(_0x434f6d[_0xb72f('0x62')]){_0x434f6d[_0xb72f('0x62')][_0xb72f('0x23')](function(_0x802906){_0x31ea9f[_0xb72f('0x62')]('c.'+_0x802906[0x0],_0x802906[0x1]===_0xb72f('0x63')?![]:!![]);_0x344149[_0xb72f('0x62')](_0xb72f('0x64')+_0x802906[0x0],_0x802906[0x1]===_0xb72f('0x63')?![]:!![]);});}_0x344149[_0xb72f('0xa')](_0x31ea9f,_0xb72f('0xe'));return _0x344149;}function getFilteredContacts(_0x42d0bf){var _0xc9fbe3=[];return db[_0xb72f('0x43')][_0xb72f('0x65')]({'attributes':['id',_0xb72f('0x38'),_0xb72f('0x66')],'raw':!![]})[_0xb72f('0x53')](function(_0x1e7c33){_0xc9fbe3=_[_0xb72f('0x67')](_0x1e7c33,'id');var _0xe8563f={'type':db[_0xb72f('0x68')][_0xb72f('0x69')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb72f('0x6a')][_0xb72f('0x6b')](_0x42d0bf[_0xb72f('0x6c')](),_0xe8563f);})[_0xb72f('0x53')](function(_0x27fec7){_0x27fec7[_0xb72f('0x23')](function(_0x4448e7){if(_0x4448e7['TagIds']){_0x4448e7[_0xb72f('0x6d')]=[];_0x4448e7[_0xb72f('0x20')]['split'](',')[_0xb72f('0x23')](function(_0x41b531){_0x4448e7[_0xb72f('0x6d')]['push'](_0xc9fbe3[_0x41b531]);});}delete _0x4448e7[_0xb72f('0x20')];});return _0x27fec7;});}function countFilteredContacts(_0x4bb76b,_0x28c6fc){var _0x13530b=_0x4bb76b[_0xb72f('0x6e')]();_0x13530b['field']('COUNT(*)');_0x13530b=applyJoinClauses(_0x13530b,!![]);_0x4bb76b[_0xb72f('0x5c')](_0xb72f('0x5d'));var _0x1189f5=utils[_0xb72f('0x27')](_0x28c6fc);if(!_[_0xb72f('0x6f')](_0x1189f5)){_0x13530b[_0xb72f('0xc')](_0xb72f('0x70'),_0x1189f5);}var _0x39bbcc={'type':db['Sequelize']['QueryTypes'][_0xb72f('0x71')],'raw':!![]};return db[_0xb72f('0x6a')][_0xb72f('0x6b')](_0x13530b[_0xb72f('0x6c')](),_0x39bbcc)[_0xb72f('0x53')](function(_0x1fdde6){return _0x1fdde6[0x0][_0xb72f('0x72')];});}module[_0xb72f('0x73')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x885b=['where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','ListId','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','map','tags','clause','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','name','compact','Contact','and','c.ListId\x20IN\x20?','concat','\x20=\x20?','then','fields','tag','filter','getLists','attributes','group','c.id','limit','offset','subqry.id','order','subqry.','DESC','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../../mysqldb','role','agent','search','autocomplete','select','from','cm_contacts'];(function(_0x5a67c0,_0x337713){var _0xbe503=function(_0xd84145){while(--_0xd84145){_0x5a67c0['push'](_0x5a67c0['shift']());}};_0xbe503(++_0x337713);}(_0x885b,0x13a));var _0xb885=function(_0x947d64,_0x226378){_0x947d64=_0x947d64-0x0;var _0x1ab4ae=_0x885b[_0x947d64];return _0x1ab4ae;};'use strict';var _=require('lodash');var squel=require(_0xb885('0x0'));var as=require(_0xb885('0x1'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0xb885('0x2'))['db'];function skipContactsQuery(_0x36e03b,_0x2e6558){var _0x3861c5=![];if(_0x36e03b[_0xb885('0x3')]===_0xb885('0x4')&&!_0x2e6558[_0xb885('0x5')]&&!_0x2e6558['ListId']&&_0x2e6558[_0xb885('0x6')]!=='true'){_0x3861c5=!![];}return _0x3861c5;}function getContactsSubquery(){return squel[_0xb885('0x7')]()[_0xb885('0x8')](_0xb885('0x9'),'c')[_0xb885('0xa')](_0xb885('0xb'));}function applyJoinClauses(_0x5cda5e,_0x352994){var _0x221aed=_0x352994?'c':_0xb885('0xc');_0x5cda5e[_0xb885('0xd')](_0xb885('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x221aed+_0xb885('0xf'))[_0xb885('0xd')](_0xb885('0x10'),'ct',_0xb885('0x11')+_0x221aed+_0xb885('0xf'))[_0xb885('0xd')](_0xb885('0x12'),'t',_0xb885('0x13'));return _0x5cda5e;}function addFieldsToQuery(_0x2bd301,_0x3e9e1e,_0x46e570,_0xe31c37,_0x1ea7de){var _0x2dba29=_0x1ea7de?'c':_0xb885('0xc');if(!_0x3e9e1e){_0x3e9e1e=['id',_0xb885('0x14'),'lastName',_0xb885('0x15'),_0xb885('0x16'),_0xb885('0x17'),'email',_0xb885('0x18'),_0xb885('0x19'),_0xb885('0x1a'),'updatedAt',_0xb885('0x1b'),_0xb885('0x1c')];}else if(!_0x3e9e1e[_0xb885('0x1d')]('id')){_0x3e9e1e[_0xb885('0x1e')]('id');}var _0x42c58d=_0x46e570&&_0x1ea7de||!_0x46e570&&!_0x1ea7de;if(_0xe31c37){_0x42c58d=_0xe31c37&&_0x1ea7de||!_0xe31c37&&!_0x1ea7de;}_0x3e9e1e[_0xb885('0x1f')](function(_0x342b5e){if(_0x342b5e===_0xb885('0x1c')){if(_0x42c58d){_0x2bd301[_0xb885('0x20')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x342b5e);}else if(_0x46e570||_0xe31c37){_0x2bd301[_0xb885('0x20')](_0x2dba29+'.'+_0x342b5e);}}else{_0x2bd301[_0xb885('0x20')](_0x2dba29+'.'+_0x342b5e);}});return _0x2bd301;}function getSqlClauses(){var _0x3dbb5d={'default':squel[_0xb885('0x21')](),'fields':squel[_0xb885('0x21')](),'filter':squel[_0xb885('0x21')](),'tags':{'clause':squel[_0xb885('0x21')](),'ids':null},'user':{'clause':squel[_0xb885('0x21')](),'skip':![]}};return _0x3dbb5d;}function parseTagParameter(_0x5ed730){var _0x122cbc=squel[_0xb885('0x21')]();if(_0x5ed730){var _0x2a0ee4=utils[_0xb885('0x22')](_0x5ed730);_0x2a0ee4['forEach'](function(_0x1257f1){_0x122cbc['or'](_0xb885('0x23'),'%,'+_0x1257f1+',%');});}return _0x122cbc;}function parseSearchFilter(_0x3352f4){var _0x39283f=squel[_0xb885('0x21')]();if(_0x3352f4){var _0x451ece=_0x3352f4[_0xb885('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x451ece[_0xb885('0x25')]('\x20')[_0xb885('0x26')]>0x1){_0x39283f['or'](_0xb885('0x27'),qs[_0xb885('0x28')](_0x451ece,!![]),null);}else{if(qs['isNumeric'](_0x451ece)){_0x39283f['or'](_0xb885('0x29'),_0x451ece+'%');_0x39283f['or'](_0xb885('0x2a'),_0x451ece+'%');_0x39283f['or'](_0xb885('0x2b'),_0x451ece+'%');_0x39283f['or'](_0xb885('0x2c'),_0x451ece+'%');}else if(qs[_0xb885('0x2d')](_0x451ece)){_0x39283f['or'](_0xb885('0x2e'),_0x451ece+'%');}else{_0x39283f['or']('c.firstName\x20LIKE\x20?','%'+_0x451ece+'%');_0x39283f['or'](_0xb885('0x2f'),'%'+_0x451ece+'%');_0x39283f['or']('c.email\x20LIKE\x20?','%'+_0x451ece+'%');}}}return _0x39283f;}function parseAdvancedSearchFilter(_0x1354de,_0x2515a9){var _0x3123bc=getSqlClauses();var _0x1bdb3a=as[_0xb885('0x30')](_0x1354de);var _0x582772=_0x1bdb3a['sqlOperator'];for(var _0x44bc75=0x0;_0x44bc75<_0x1bdb3a[_0xb885('0x31')][_0xb885('0x26')];_0x44bc75++){var _0x53fd22=_0x1bdb3a[_0xb885('0x31')][_0x44bc75];var _0x450db4='c';var _0x2d5134=_[_0xb885('0x32')](_0x2515a9,['name',_0x53fd22['field']]);if(_0x2d5134){if(_0x53fd22['field']==='dateOfBirth'||_0x2d5134[_0xb885('0x33')]===_0xb885('0x34')){_0x53fd22[_0xb885('0x35')]=_0xb885('0x36');}var _0x2ffa8c=as[_0xb885('0x37')](_0x450db4,_0x2d5134[_0xb885('0x38')],_0x53fd22);_0x3123bc[_0xb885('0x39')][_0x582772](_0x2ffa8c[_0xb885('0x3a')],_0x2ffa8c[_0xb885('0x3b')][_0xb885('0x3c')],_0x2ffa8c['value'][_0xb885('0x3d')]);}else{if(_0x53fd22[_0xb885('0x20')]===_0xb885('0x3e')){var _0x327eb2=_0x53fd22[_0xb885('0x3b')]['split'](',')[_0xb885('0x3f')](function(_0x16363d){return Number(_0x16363d);});var _0x35f12f=parseTagParameter(_0x327eb2);_0x3123bc[_0xb885('0x40')][_0xb885('0x41')]['and'](_0x35f12f);_0x3123bc[_0xb885('0x40')][_0xb885('0x42')]=_0x327eb2;}else if(_0x53fd22[_0xb885('0x20')]===_0xb885('0x43')){_0x3123bc[_0xb885('0x44')][_0xb885('0x41')]['and'](_0xb885('0x45'),_0x53fd22[_0xb885('0x3b')]);_0x3123bc[_0xb885('0x44')][_0xb885('0x46')]=!![];}}}return _0x3123bc;}function parseModelFields(_0x192068,_0x4a4ab9){var _0x33dfe9=squel[_0xb885('0x21')]();var _0x5c5836=_(_0x192068)[_0xb885('0x47')]()[_0xb885('0x3f')](function(_0x4e40b4){return _[_0xb885('0x48')](_0x4a4ab9,[_0xb885('0x49'),_0x4e40b4])?_0x4e40b4:undefined;})[_0xb885('0x4a')]()['value']();if(_0x192068[_0xb885('0x4b')]){_0x5c5836[_0xb885('0x1e')](_0xb885('0x4b'));}if(_0x192068['User']){_0x5c5836[_0xb885('0x1e')](_0xb885('0x43'));}if(_0x5c5836[_0xb885('0x26')]>0x0){_0x5c5836[_0xb885('0x1f')](function(_0x17a45e){if(_0x17a45e==='ListId'){_0x33dfe9[_0xb885('0x4c')](_0xb885('0x4d'),[][_0xb885('0x4e')](_0x192068[_0x17a45e]));}else if(_0x17a45e===_0xb885('0x4b')){var _0x4c814d='%'+_0x192068[_0x17a45e]+'%';_0x33dfe9[_0xb885('0x4c')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x4c814d);}else if(_0x17a45e===_0xb885('0x43')){_0x33dfe9[_0xb885('0x4c')]('uc.UserId\x20=\x20?',_0x192068[_0x17a45e]);}else{_0x33dfe9['and']('c.'+_0x17a45e+_0xb885('0x4f'),_0x192068[_0x17a45e]);}});}return _0x33dfe9;}function parseQueryParameters(_0xf3f715,_0x16d440){var _0x375405=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0xf3f715,_0x16d440);})[_0xb885('0x50')](function(_0x26f1fc){_0x375405[_0xb885('0x51')]['and'](_0x26f1fc);return parseTagParameter(_0xf3f715[_0xb885('0x52')]);})[_0xb885('0x50')](function(_0x38d8a3){_0x375405['tags'][_0xb885('0x41')][_0xb885('0x4c')](_0x38d8a3);return parseSearchFilter(_0xf3f715[_0xb885('0x53')]);})[_0xb885('0x50')](function(_0x46211a){_0x375405[_0xb885('0x53')]=_0x46211a;return _0x375405;});}function checkListsRestrictions(_0x347808,_0x21cb0a,_0x50dc1){var _0x4d0b02=squel[_0xb885('0x21')]();return Promise['resolve']()[_0xb885('0x50')](function(){if(_0x21cb0a[_0xb885('0x5')]&&_0x347808['role']===_0xb885('0x4')&&!_0x50dc1){return _0x347808[_0xb885('0x54')]({'attributes':['id'],'raw':!![]});}})[_0xb885('0x50')](function(_0x59705e){if(_0x59705e){if(_0x59705e[_0xb885('0x26')]===0x0){_0x4d0b02[_0xb885('0x4c')]('c.ListId\x20IS\x20NULL');}else{_0x4d0b02[_0xb885('0x4c')]('c.ListId\x20IN\x20?',_[_0xb885('0x3f')](_0x59705e,'id'));}}})[_0xb885('0x50')](function(){return _0x4d0b02;});}function buildContactsQuery(_0x2e77db,_0xa28dc3,_0x45d190,_0x13e12b,_0x1ee01d,_0x500cae){if(_0xa28dc3){_0xa28dc3=_0x45d190[_0xb885('0x55')];}_0x2e77db=addFieldsToQuery(_0x2e77db,_0xa28dc3,_0x13e12b,_0x500cae,!![]);var _0x2c2984=squel[_0xb885('0x7')]();_0x2c2984=addFieldsToQuery(_0x2c2984,_0xa28dc3,_0x13e12b,_0x500cae,![]);if(_0x13e12b||_0x500cae){_0x2e77db=applyJoinClauses(_0x2e77db,!![]);_0x2e77db[_0xb885('0x56')](_0xb885('0x57'));if(_0x45d190[_0xb885('0x58')]){_0x2c2984[_0xb885('0x58')](_0x45d190[_0xb885('0x58')]);}if(_0x45d190[_0xb885('0x59')]){_0x2c2984[_0xb885('0x59')](_0x45d190[_0xb885('0x59')]);}}else{_0x2c2984=applyJoinClauses(_0x2c2984,![]);_0x2c2984['group'](_0xb885('0x5a'));if(_0x45d190[_0xb885('0x58')]){_0x2e77db[_0xb885('0x58')](_0x45d190['limit']);}if(_0x45d190[_0xb885('0x59')]){_0x2e77db['offset'](_0x45d190[_0xb885('0x59')]);}}_0x2c2984['having'](_0x1ee01d);if(_0x45d190['order']){_0x45d190[_0xb885('0x5b')][_0xb885('0x1f')](function(_0x43dc2a){_0x2e77db[_0xb885('0x5b')]('c.'+_0x43dc2a[0x0],_0x43dc2a[0x1]==='DESC'?![]:!![]);_0x2c2984[_0xb885('0x5b')](_0xb885('0x5c')+_0x43dc2a[0x0],_0x43dc2a[0x1]===_0xb885('0x5d')?![]:!![]);});}_0x2c2984[_0xb885('0x8')](_0x2e77db,'subqry');return _0x2c2984;}function getFilteredContacts(_0x457d9){var _0x16aa87=[];return db[_0xb885('0x3e')]['findAll']({'attributes':['id',_0xb885('0x49'),_0xb885('0x5e')],'raw':!![]})[_0xb885('0x50')](function(_0x3fe696){_0x16aa87=_[_0xb885('0x5f')](_0x3fe696,'id');var _0x113c32={'type':db[_0xb885('0x60')][_0xb885('0x61')][_0xb885('0x62')],'model':db[_0xb885('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb885('0x64')][_0xb885('0x65')](_0x457d9[_0xb885('0x66')](),_0x113c32);})[_0xb885('0x50')](function(_0x4d2595){_0x4d2595[_0xb885('0x1f')](function(_0x92a5c5){if(_0x92a5c5[_0xb885('0x1c')]){_0x92a5c5[_0xb885('0x67')]=[];_0x92a5c5['TagIds'][_0xb885('0x25')](',')['forEach'](function(_0x307004){_0x92a5c5[_0xb885('0x67')]['push'](_0x16aa87[_0x307004]);});}delete _0x92a5c5[_0xb885('0x1c')];});return _0x4d2595;});}function countFilteredContacts(_0x87433f,_0x139487){var _0x489e76=_0x87433f[_0xb885('0x68')]();_0x489e76['field']('COUNT(*)');_0x489e76=applyJoinClauses(_0x489e76,!![]);_0x87433f[_0xb885('0x56')](_0xb885('0x57'));var _0x27638e=utils[_0xb885('0x22')](_0x139487);if(!_[_0xb885('0x69')](_0x27638e)){_0x489e76[_0xb885('0xa')](_0xb885('0x6a'),_0x27638e);}var _0xce5ff6={'type':db[_0xb885('0x60')][_0xb885('0x61')][_0xb885('0x62')],'raw':!![]};return db[_0xb885('0x64')][_0xb885('0x65')](_0x489e76['toString'](),_0xce5ff6)[_0xb885('0x50')](function(_0x3146ad){return _0x3146ad[0x0]['COUNT(*)'];});}module[_0xb885('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b6d23c7..5758398 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 _0xb26c=['createDecipher','encryptString','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','decryptFile'];(function(_0x52a92e,_0x338e7a){var _0xd4ee84=function(_0x39c41a){while(--_0x39c41a){_0x52a92e['push'](_0x52a92e['shift']());}};_0xd4ee84(++_0x338e7a);}(_0xb26c,0xd8));var _0xcb26=function(_0x2ac47b,_0x46f990){_0x2ac47b=_0x2ac47b-0x0;var _0xf43403=_0xb26c[_0x2ac47b];return _0xf43403;};'use strict';var crypto=require(_0xcb26('0x0'));var fs=require('fs');var BPromise=require(_0xcb26('0x1'));var _=require(_0xcb26('0x2'));var config=require(_0xcb26('0x3'));var logger=require('../../config/logger')(_0xcb26('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xcb26('0x5')][_0xcb26('0x6')],'algorithm':_0xcb26('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0xcb26('0x8')]&&config[_0xcb26('0x8')][_0xcb26('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xcb26('0x9')]);if(isSupported){fileOptions[_0xcb26('0x9')]=config['encrypt'][_0xcb26('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xcb26('0xa')](config[_0xcb26('0x8')][_0xcb26('0x9')],_0xcb26('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x525316){return AES_SUPPORTED_RX[_0xcb26('0xc')](_0x525316);}function getSupportedCiphers(){return crypto[_0xcb26('0xd')]()[_0xcb26('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x4e5e1e){return getSupportedCiphers()[_0xcb26('0xf')](_0x4e5e1e)>-0x1;}function combineOptions(_0x395414){var _0x3683e7={};for(var _0xe31b2b in fileOptions){if(fileOptions[_0xcb26('0x10')](_0xe31b2b)){_0x3683e7[_0xe31b2b]=fileOptions[_0xe31b2b];}}if(_0x395414){for(var _0x10c75f in _0x395414){if(_0x395414[_0xcb26('0x10')](_0x10c75f)){_0x3683e7[_0x10c75f]=_0x395414[_0x10c75f];}}}return _0x3683e7;}exports[_0xcb26('0x11')]=function(_0x336020,_0x128297,_0x4452db,_0x3c4fbe){return new BPromise(function(_0x372f6a,_0x326ed3){_0x3c4fbe=combineOptions(_0x3c4fbe);var _0x54de8d=new Buffer(_0x4452db);var _0x4c4e59=fs[_0xcb26('0x12')](_0x336020);var _0x1dd369=fs[_0xcb26('0x13')](_0x128297);var _0x55bbf8=crypto[_0xcb26('0x14')](_0x3c4fbe[_0xcb26('0x9')],_0x54de8d);_0x4c4e59['on'](_0xcb26('0x15'),function(_0x16903b){var _0x26e582=new Buffer(_0x55bbf8[_0xcb26('0x16')](_0x16903b),_0xcb26('0x17'));_0x1dd369[_0xcb26('0x18')](_0x26e582);});_0x4c4e59['on'](_0xcb26('0x19'),function(){try{var _0x5d22b8=new Buffer(_0x55bbf8[_0xcb26('0x1a')]('binary'),_0xcb26('0x17'));_0x1dd369[_0xcb26('0x18')](_0x5d22b8);_0x1dd369[_0xcb26('0x19')]();_0x1dd369['on'](_0xcb26('0x1b'),function(){return _0x372f6a(_0x128297);});}catch(_0x36fe23){fs['unlink'](_0x128297);return _0x326ed3(_0x36fe23);}});});};exports[_0xcb26('0x1c')]=function(_0x4c334f,_0x2bb55e,_0x1443fc,_0x1e91be){return new BPromise(function(_0x189672,_0x1d7f4a){_0x1e91be=combineOptions(_0x1e91be);var _0x339997=new Buffer(_0x1443fc);var _0x31bd5f=fs[_0xcb26('0x12')](_0x4c334f);var _0x27dc8d=fs[_0xcb26('0x13')](_0x2bb55e);var _0x33dce2=crypto[_0xcb26('0x1d')](_0x1e91be[_0xcb26('0x9')],_0x339997);_0x31bd5f['on'](_0xcb26('0x15'),function(_0xdcbcb2){var _0x27f760=new Buffer(_0x33dce2[_0xcb26('0x16')](_0xdcbcb2),_0xcb26('0x17'));_0x27dc8d['write'](_0x27f760);});_0x31bd5f['on'](_0xcb26('0x19'),function(){try{var _0x929d3a=new Buffer(_0x33dce2[_0xcb26('0x1a')](_0xcb26('0x17')),_0xcb26('0x17'));_0x27dc8d['write'](_0x929d3a);_0x27dc8d['end']();_0x27dc8d['on'](_0xcb26('0x1b'),function(){return _0x189672(_0x2bb55e);});}catch(_0x2dd70c){fs['unlink'](_0x2bb55e);return _0x1d7f4a(_0x2dd70c);}});});};exports[_0xcb26('0x1e')]=function(_0x24da12,_0x629db6,_0x15526a){var _0x2e1bc9=_0x15526a||stringOptions[_0xcb26('0x9')];var _0x3ca801=_0x629db6||stringOptions[_0xcb26('0x1f')];var _0x52640d=crypto[_0xcb26('0x14')](_0x2e1bc9,_0x3ca801);var _0x22921b=_0x52640d[_0xcb26('0x16')](_0x24da12,'utf8',_0xcb26('0x20'));_0x22921b+=_0x52640d[_0xcb26('0x1a')](_0xcb26('0x20'));return _0x22921b;};exports[_0xcb26('0x21')]=function(_0x1f3ccb,_0x2e963d,_0x38a1bc){var _0x2c82e6=_0x38a1bc||stringOptions[_0xcb26('0x9')];var _0x17f0e0=_0x2e963d||stringOptions[_0xcb26('0x1f')];var _0x5c1bcc=crypto[_0xcb26('0x1d')](_0x2c82e6,_0x17f0e0);var _0x373c70=_0x5c1bcc[_0xcb26('0x16')](_0x1f3ccb,_0xcb26('0x20'),_0xcb26('0x22'));_0x373c70+=_0x5c1bcc['final'](_0xcb26('0x22'));return _0x373c70;}; \ No newline at end of file +var _0x4528=['createWriteStream','createCipher','data','update','binary','end','close','unlink','decryptFile','write','encryptString','secret','utf8','final','decryptString','createDecipher','crypto','bluebird','lodash','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile'];(function(_0x1a1586,_0x2ddd60){var _0x59eca0=function(_0x22c619){while(--_0x22c619){_0x1a1586['push'](_0x1a1586['shift']());}};_0x59eca0(++_0x2ddd60);}(_0x4528,0x108));var _0x8452=function(_0x4f39a8,_0x1a4fdf){_0x4f39a8=_0x4f39a8-0x0;var _0xc40765=_0x4528[_0x4f39a8];return _0xc40765;};'use strict';var crypto=require(_0x8452('0x0'));var fs=require('fs');var BPromise=require(_0x8452('0x1'));var _=require(_0x8452('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8452('0x3')]['session'],'algorithm':_0x8452('0x4')};const fileOptions={'algorithm':_0x8452('0x5')};if(config[_0x8452('0x6')]&&config[_0x8452('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x8452('0x6')]['algorithm']);if(isSupported){fileOptions[_0x8452('0x7')]=config[_0x8452('0x6')][_0x8452('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8452('0x8')](',\x20');logger['error'](config[_0x8452('0x6')][_0x8452('0x7')],_0x8452('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x468153){return AES_SUPPORTED_RX[_0x8452('0xa')](_0x468153);}function getSupportedCiphers(){return crypto[_0x8452('0xb')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x2a0012){return getSupportedCiphers()[_0x8452('0xc')](_0x2a0012)>-0x1;}function combineOptions(_0x15364e){var _0x2f8d2c={};for(var _0x20ff05 in fileOptions){if(fileOptions[_0x8452('0xd')](_0x20ff05)){_0x2f8d2c[_0x20ff05]=fileOptions[_0x20ff05];}}if(_0x15364e){for(var _0x56cea5 in _0x15364e){if(_0x15364e[_0x8452('0xd')](_0x56cea5)){_0x2f8d2c[_0x56cea5]=_0x15364e[_0x56cea5];}}}return _0x2f8d2c;}exports[_0x8452('0xe')]=function(_0x5c41de,_0x484ba6,_0x1381cc,_0x315ee5){return new BPromise(function(_0x26b4eb,_0x3c5570){_0x315ee5=combineOptions(_0x315ee5);var _0x36a7e0=new Buffer(_0x1381cc);var _0x58e457=fs['createReadStream'](_0x5c41de);var _0x577d70=fs[_0x8452('0xf')](_0x484ba6);var _0x3f5c82=crypto[_0x8452('0x10')](_0x315ee5[_0x8452('0x7')],_0x36a7e0);_0x58e457['on'](_0x8452('0x11'),function(_0x582700){var _0x3c21ae=new Buffer(_0x3f5c82[_0x8452('0x12')](_0x582700),_0x8452('0x13'));_0x577d70['write'](_0x3c21ae);});_0x58e457['on'](_0x8452('0x14'),function(){try{var _0x19e82c=new Buffer(_0x3f5c82['final'](_0x8452('0x13')),_0x8452('0x13'));_0x577d70['write'](_0x19e82c);_0x577d70[_0x8452('0x14')]();_0x577d70['on'](_0x8452('0x15'),function(){return _0x26b4eb(_0x484ba6);});}catch(_0xefa13c){fs[_0x8452('0x16')](_0x484ba6);return _0x3c5570(_0xefa13c);}});});};exports[_0x8452('0x17')]=function(_0x1f6d33,_0x31a786,_0x957b56,_0x4dfb60){return new BPromise(function(_0x5ca9ed,_0x57c89b){_0x4dfb60=combineOptions(_0x4dfb60);var _0x56de47=new Buffer(_0x957b56);var _0x23bc9a=fs['createReadStream'](_0x1f6d33);var _0x1b872e=fs[_0x8452('0xf')](_0x31a786);var _0x1116b8=crypto['createDecipher'](_0x4dfb60[_0x8452('0x7')],_0x56de47);_0x23bc9a['on'](_0x8452('0x11'),function(_0x5bc9e8){var _0x1e5912=new Buffer(_0x1116b8[_0x8452('0x12')](_0x5bc9e8),'binary');_0x1b872e['write'](_0x1e5912);});_0x23bc9a['on'](_0x8452('0x14'),function(){try{var _0x18fa5d=new Buffer(_0x1116b8['final'](_0x8452('0x13')),_0x8452('0x13'));_0x1b872e[_0x8452('0x18')](_0x18fa5d);_0x1b872e[_0x8452('0x14')]();_0x1b872e['on']('close',function(){return _0x5ca9ed(_0x31a786);});}catch(_0x55a831){fs[_0x8452('0x16')](_0x31a786);return _0x57c89b(_0x55a831);}});});};exports[_0x8452('0x19')]=function(_0x2c3611,_0x5b418f,_0xe1d5f2){var _0x589f2d=_0xe1d5f2||stringOptions['algorithm'];var _0x4e02b5=_0x5b418f||stringOptions[_0x8452('0x1a')];var _0x131f50=crypto[_0x8452('0x10')](_0x589f2d,_0x4e02b5);var _0x4b0969=_0x131f50[_0x8452('0x12')](_0x2c3611,_0x8452('0x1b'),'base64');_0x4b0969+=_0x131f50[_0x8452('0x1c')]('base64');return _0x4b0969;};exports[_0x8452('0x1d')]=function(_0x1804ad,_0x34939e,_0x536760){var _0x4dc3dd=_0x536760||stringOptions[_0x8452('0x7')];var _0x1e963c=_0x34939e||stringOptions[_0x8452('0x1a')];var _0x1f2e1c=crypto[_0x8452('0x1e')](_0x4dc3dd,_0x1e963c);var _0xbb5c1b=_0x1f2e1c[_0x8452('0x12')](_0x1804ad,'base64',_0x8452('0x1b'));_0xbb5c1b+=_0x1f2e1c[_0x8452('0x1c')](_0x8452('0x1b'));return _0xbb5c1b;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0067b6f..9a4a1f7 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 _0x68eb=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','dirname','basename','.csv','length','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','info'];(function(_0x3d4bc3,_0x1c4559){var _0x185fc6=function(_0x2ca273){while(--_0x2ca273){_0x3d4bc3['push'](_0x3d4bc3['shift']());}};_0x185fc6(++_0x1c4559);}(_0x68eb,0x14e));var _0xb68e=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x68eb[_0x592e40];return _0x5d4288;};'use strict';var util=require(_0xb68e('0x0'));var path=require(_0xb68e('0x1'));var _=require(_0xb68e('0x2'));var csv=require(_0xb68e('0x3'));var fs=require('fs');var BPromise=require(_0xb68e('0x4'));var zipdir=require(_0xb68e('0x5'));var rimraf=require(_0xb68e('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0xb68e('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb68e('0x8')][0x2]);var QUERY=process[_0xb68e('0x8')][0x3];var PATH=process[_0xb68e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc7a47,_0x3279d9){var _0x42354e={'status':_0xc7a47};var _0x1894be={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3279d9){_0x42354e[_0xb68e('0x9')]=_0x3279d9;}return db[_0xb68e('0xa')]['update'](_0x42354e,_0x1894be);}function main(){var _0x55567d=0x1388;var _0x35a7b5;logger['info'](util[_0xb68e('0xb')](_0xb68e('0xc'),EXTRACTED_REPORT_ID,_0xb68e('0xd')));return db[_0xb68e('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb68e('0xf'),_0xb68e('0x10')]})[_0xb68e('0x11')](function(_0x33f950){if(_0x33f950){_0x35a7b5=_0x33f950;_0x55567d=_0x35a7b5[_0xb68e('0x10')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xb68e('0x12')](util[_0xb68e('0xb')](_0xb68e('0x13'),QUERY),{'type':dbH[_0xb68e('0x14')][_0xb68e('0x15')][_0xb68e('0x16')]});})[_0xb68e('0x11')](function(_0x3fd07c){if(!_0x3fd07c[0x0][_0xb68e('0x17')]){return analyticExtractedReport(_0xb68e('0x18'));}var _0x3527f4=[];var _0x5046ab=0x0;if(_0x35a7b5[_0xb68e('0xf')]){if(_0x3fd07c&&_0x3fd07c['length']){var _0xca3aba=_[_0xb68e('0x19')](_0x3fd07c[0x0]['num']/_0x55567d);var _0x3fd259=Number[_0xb68e('0x1a')](_0x3fd07c[0x0][_0xb68e('0x17')]/_0x55567d)?_0x3fd07c[0x0][_0xb68e('0x17')]%_0x55567d:0x0;_0xca3aba[_0xb68e('0x1b')](function(_0xd01b7){if(_0xd01b7>0x0){_0x5046ab+=_0x55567d;}_0x3527f4[_0xb68e('0x1c')](dbH[_0xb68e('0x14')][_0xb68e('0x12')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x55567d,_0x5046ab),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));});if(_0x3fd259>0x0){_0x5046ab+=_0x55567d;_0x3527f4['push'](dbH[_0xb68e('0x14')][_0xb68e('0x12')](util[_0xb68e('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3fd259,_0x5046ab),{'type':dbH[_0xb68e('0x14')][_0xb68e('0x15')][_0xb68e('0x16')]}));}}}else{_0x3527f4['push'](dbH['sequelize'][_0xb68e('0x12')](QUERY,{'type':dbH[_0xb68e('0x14')]['QueryTypes'][_0xb68e('0x16')]}));}var _0x5a42c8=path[_0xb68e('0x1d')](PATH);var _0x51451a=path[_0xb68e('0x1e')](PATH,_0xb68e('0x1f'));var _0x2dbc87=_0x35a7b5['split']&&_0x3527f4[_0xb68e('0x20')]>0x1;var _0x5e4e77=[];if(!fs[_0xb68e('0x21')](path[_0xb68e('0x22')](_0x5a42c8,_0x51451a))&&_0x2dbc87){fs[_0xb68e('0x23')](path[_0xb68e('0x22')](_0x5a42c8,_0x51451a));}return BPromise[_0xb68e('0x24')](_0x3527f4,function(_0x5a4d5f){_0x5e4e77[_0xb68e('0x1c')](_0x5a4d5f);})[_0xb68e('0x11')](function(){for(var _0xd3395=0x0;_0xd3395<_0x5e4e77[_0xb68e('0x20')];_0xd3395+=0x1){var _0x27982d;var _0xb676fa=_0x5e4e77[_0xd3395];if(_0x2dbc87){_0x27982d=path[_0xb68e('0x22')](_0x5a42c8,_0x51451a,util[_0xb68e('0xb')]('%s%d.%s',_0x51451a,_0xd3395,_0xb68e('0x25')));}else{_0x27982d=path['join'](_0x5a42c8,util['format'](_0xb68e('0x26'),_0x51451a,_0xb68e('0x25')));}fs[_0xb68e('0x27')](_0x27982d,csv(_0xb676fa));}})[_0xb68e('0x11')](function(){if(_0x2dbc87){return new Promise(function(_0x2401a2){zipdir(path[_0xb68e('0x22')](_0x5a42c8,_0x51451a),{'saveTo':path['join'](_0x5a42c8,util[_0xb68e('0xb')](_0xb68e('0x26'),_0x51451a,_0xb68e('0x28')))},function(_0x5b79fd,_0x1ebc3b){rimraf(path[_0xb68e('0x22')](_0x5a42c8,_0x51451a),function(){});_0x2401a2('zip\x20finished');});});}})['then'](function(){logger[_0xb68e('0x29')](util[_0xb68e('0xb')](_0xb68e('0x2a'),EXTRACTED_REPORT_ID,_0xb68e('0xd')));return analyticExtractedReport(_0xb68e('0x2b'),_0x2dbc87?util[_0xb68e('0xb')](_0xb68e('0x26'),_0x51451a,_0x2dbc87?_0xb68e('0x28'):_0xb68e('0x25')):null);});})['catch'](function(_0x2c9e3b){logger[_0xb68e('0x29')](util['format'](_0xb68e('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util[_0xb68e('0x2d')](_0x2c9e3b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb68e('0x2e'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2fbe=['lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','SELECT','num','length','query','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','exit'];(function(_0x131acf,_0x4b4597){var _0x40d32e=function(_0x804943){while(--_0x804943){_0x131acf['push'](_0x131acf['shift']());}};_0x40d32e(++_0x4b4597);}(_0x2fbe,0x134));var _0xe2fb=function(_0x1b3b8d,_0x1487b6){_0x1b3b8d=_0x1b3b8d-0x0;var _0x1ab26d=_0x2fbe[_0x1b3b8d];return _0x1ab26d;};'use strict';var util=require('util');var path=require('path');var _=require(_0xe2fb('0x0'));var csv=require(_0xe2fb('0x1'));var fs=require('fs');var BPromise=require(_0xe2fb('0x2'));var zipdir=require(_0xe2fb('0x3'));var rimraf=require(_0xe2fb('0x4'));var db=require(_0xe2fb('0x5'))['db'];var dbH=require('../../mysqldb')[_0xe2fb('0x6')];var logger=require(_0xe2fb('0x7'))(_0xe2fb('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe2fb('0x9')][0x2]);var QUERY=process[_0xe2fb('0x9')][0x3];var PATH=process[_0xe2fb('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x18e9c8,_0x5f168e){var _0x231f57={'status':_0x18e9c8};var _0x10113c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f168e){_0x231f57[_0xe2fb('0xa')]=_0x5f168e;}return db['AnalyticExtractedReport'][_0xe2fb('0xb')](_0x231f57,_0x10113c);}function main(){var _0x3bf1c5=0x1388;var _0x254e31;logger[_0xe2fb('0xc')](util[_0xe2fb('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe2fb('0xe')));return db[_0xe2fb('0xf')][_0xe2fb('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe2fb('0x11'),'splitSizeCsv']})[_0xe2fb('0x12')](function(_0x5c57b0){if(_0x5c57b0){_0x254e31=_0x5c57b0;_0x3bf1c5=_0x254e31[_0xe2fb('0x13')]||0x1388;}})[_0xe2fb('0x12')](function(){return dbH['sequelize']['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe2fb('0x14')]['QueryTypes'][_0xe2fb('0x15')]});})['then'](function(_0x4477a8){if(!_0x4477a8[0x0][_0xe2fb('0x16')]){return analyticExtractedReport('Empty');}var _0x26e020=[];var _0x371b84=0x0;if(_0x254e31[_0xe2fb('0x11')]){if(_0x4477a8&&_0x4477a8[_0xe2fb('0x17')]){var _0x3fdb6d=_['range'](_0x4477a8[0x0][_0xe2fb('0x16')]/_0x3bf1c5);var _0x1063a5=Number['isInteger'](_0x4477a8[0x0][_0xe2fb('0x16')]/_0x3bf1c5)?_0x4477a8[0x0]['num']%_0x3bf1c5:0x0;_0x3fdb6d['forEach'](function(_0x1702f4){if(_0x1702f4>0x0){_0x371b84+=_0x3bf1c5;}_0x26e020['push'](dbH[_0xe2fb('0x14')][_0xe2fb('0x18')](util[_0xe2fb('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3bf1c5,_0x371b84),{'type':dbH[_0xe2fb('0x14')][_0xe2fb('0x19')][_0xe2fb('0x15')]}));});if(_0x1063a5>0x0){_0x371b84+=_0x3bf1c5;_0x26e020[_0xe2fb('0x1a')](dbH[_0xe2fb('0x14')][_0xe2fb('0x18')](util[_0xe2fb('0xd')](_0xe2fb('0x1b'),QUERY,_0x1063a5,_0x371b84),{'type':dbH[_0xe2fb('0x14')][_0xe2fb('0x19')][_0xe2fb('0x15')]}));}}}else{_0x26e020[_0xe2fb('0x1a')](dbH[_0xe2fb('0x14')][_0xe2fb('0x18')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xe2fb('0x15')]}));}var _0x43baf8=path[_0xe2fb('0x1c')](PATH);var _0x20021=path['basename'](PATH,_0xe2fb('0x1d'));var _0x3f692b=_0x254e31[_0xe2fb('0x11')]&&_0x26e020['length']>0x1;var _0x48cc85=[];if(!fs[_0xe2fb('0x1e')](path['join'](_0x43baf8,_0x20021))&&_0x3f692b){fs[_0xe2fb('0x1f')](path['join'](_0x43baf8,_0x20021));}return BPromise['each'](_0x26e020,function(_0xb59a1c){_0x48cc85['push'](_0xb59a1c);})['then'](function(){for(var _0x2fe82e=0x0;_0x2fe82e<_0x48cc85['length'];_0x2fe82e+=0x1){var _0x437944;var _0xea6d5e=_0x48cc85[_0x2fe82e];if(_0x3f692b){_0x437944=path[_0xe2fb('0x20')](_0x43baf8,_0x20021,util[_0xe2fb('0xd')](_0xe2fb('0x21'),_0x20021,_0x2fe82e,_0xe2fb('0x22')));}else{_0x437944=path['join'](_0x43baf8,util['format'](_0xe2fb('0x23'),_0x20021,'csv'));}fs[_0xe2fb('0x24')](_0x437944,csv(_0xea6d5e));}})['then'](function(){if(_0x3f692b){return new Promise(function(_0x3190e8){zipdir(path[_0xe2fb('0x20')](_0x43baf8,_0x20021),{'saveTo':path[_0xe2fb('0x20')](_0x43baf8,util['format']('%s.%s',_0x20021,_0xe2fb('0x25')))},function(_0x2adaf0,_0x3fa08e){rimraf(path[_0xe2fb('0x20')](_0x43baf8,_0x20021),function(){});_0x3190e8(_0xe2fb('0x26'));});});}})['then'](function(){logger[_0xe2fb('0xc')](util[_0xe2fb('0xd')](_0xe2fb('0x27'),EXTRACTED_REPORT_ID,_0xe2fb('0xe')));return analyticExtractedReport(_0xe2fb('0x28'),_0x3f692b?util[_0xe2fb('0xd')](_0xe2fb('0x23'),_0x20021,_0x3f692b?_0xe2fb('0x25'):_0xe2fb('0x22')):null);});})[_0xe2fb('0x29')](function(_0x225a05){logger[_0xe2fb('0xc')](util[_0xe2fb('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe2fb('0xe')),util['inspect'](_0x225a05,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe2fb('0x2a'));})['finally'](function(){process[_0xe2fb('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ebd2a76..b3a945d 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 _0x24bd=['basename','.pdf','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','all','zip','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','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','center','Interaction\x20Transcript','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','path','lodash','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','fill','length','body','concat','chunk','keys','format','name','startDate','endDate','push','header','pageBreak','before','margin','landscape','toString','\x20/\x20','black','num','Empty','Setting','split','splitSizePdf','then','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT'];(function(_0x2474a5,_0xa85774){var _0x333910=function(_0x3ba4f9){while(--_0x3ba4f9){_0x2474a5['push'](_0x2474a5['shift']());}};_0x333910(++_0xa85774);}(_0x24bd,0x132));var _0xd24b=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x24bd[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xd24b('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0xd24b('0x1'));var PdfPrinter=require(_0xd24b('0x2'));var zipdir=require(_0xd24b('0x3'));var rimraf=require(_0xd24b('0x4'));var JSDOM=require(_0xd24b('0x5'))[_0xd24b('0x6')];var window=new JSDOM('')[_0xd24b('0x7')];var BPromise=require(_0xd24b('0x8'));var db=require(_0xd24b('0x9'))['db'];var dbH=require('../../mysqldb')[_0xd24b('0xa')];var logger=require(_0xd24b('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd24b('0xc')][0x3];var PATH=process[_0xd24b('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xd24b('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x6daaa1,_0xee3503){var _0x2350f2={'status':_0x6daaa1};var _0x326b26={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xee3503){_0x2350f2['savename']=_0xee3503;}return db[_0xd24b('0xe')][_0xd24b('0xf')](_0x2350f2,_0x326b26);}function getHeaders(_0x55aa03){return _[_0xd24b('0x10')](_0x55aa03,function(_0x117ca6){return{'text':_0x117ca6,'style':_0xd24b('0x11')};});}function getRows(_0x472383,_0x4afbea){return _['map'](_0x4afbea,function(_0x3ed1a0){return _(_0x3ed1a0)['pick'](_0x472383)['map'](function(_0x2e7e9){return _0x2e7e9?_['toString'](_0x2e7e9):'';})['value']();});}function createTable(_0x4dc933,_0x20f1f1){var _0x8fffd3={'widths':_[_0xd24b('0x12')](Array(_0x4dc933[_0xd24b('0x13')]),0x91),'heights':function(_0x2aee72){return _0x2aee72===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2132bb=getHeaders(_0x4dc933);_0x8fffd3['body']['push'](_0x2132bb);var _0x47e038=getRows(_0x4dc933,_0x20f1f1);_0x8fffd3[_0xd24b('0x14')]=_0x8fffd3[_0xd24b('0x14')][_0xd24b('0x15')](_0x47e038);return _0x8fffd3;}function createTables(_0x4d1275){var _0x262656=[];var _0x4cfd1f=_[_0xd24b('0x16')](Object[_0xd24b('0x17')](_0x4d1275[0x0]),0x5);_0x4cfd1f['forEach'](function(_0x3252ca){_0x262656['push'](createTable(_0x3252ca,_0x4d1275));});return _0x262656;}function getPDFDocDefinition(_0x565ad0){var _0xa843ef=util[_0xd24b('0x18')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xd24b('0x19')],moment(EXTRACTED_REPORT[_0xd24b('0x1a')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xd24b('0x1b')])[_0xd24b('0x18')](FORMAT));var _0x8ca6b5=[];for(var _0xa9aea4=0x0;_0xa9aea4<_0x565ad0[_0xd24b('0x13')];_0xa9aea4++){var _0x175ed3=[];if(_0xa9aea4===0x0){_0x175ed3[_0xd24b('0x1c')]({'text':_0xa843ef,'style':_0xd24b('0x1d')});}var _0x471487={'table':_0x565ad0[_0xa9aea4]};if(_0xa9aea4>0x0){_0x471487[_0xd24b('0x1e')]=_0xd24b('0x1f');_0x471487[_0xd24b('0x20')]=[0x0,0x46,0x0,0x0];}_0x175ed3[_0xd24b('0x1c')](_0x471487);_0x8ca6b5[_0xd24b('0x1c')](_0x175ed3);}return{'pageSize':'A4','pageOrientation':_0xd24b('0x21'),'content':_0x8ca6b5,'footer':function(_0x41e3b9,_0x351abd){return{'text':_0x41e3b9[_0xd24b('0x22')]()+_0xd24b('0x23')+_0x351abd,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd24b('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2a615d){var _0x369a1d=0x1388;var _0x3e9469;if(!_0x2a615d[0x0][_0xd24b('0x25')]){return analyticExtractedReport(_0xd24b('0x26'));}return db[_0xd24b('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd24b('0x28'),_0xd24b('0x29')]})['then'](function(_0x16fda9){if(_0x16fda9){_0x3e9469=_0x16fda9;_0x369a1d=_0x3e9469[_0xd24b('0x29')]||0x3e8;}})[_0xd24b('0x2a')](function(){var _0xc75ec2=[];var _0xdb0168=0x0;if(_0x3e9469['split']){if(_0x2a615d&&_0x2a615d[_0xd24b('0x13')]){var _0x468463=_['range'](_0x2a615d[0x0]['num']/_0x369a1d);var _0x352fc3=Number[_0xd24b('0x2b')](_0x2a615d[0x0][_0xd24b('0x25')]/_0x369a1d)?_0x2a615d[0x0][_0xd24b('0x25')]%_0x369a1d:0x0;_0x468463[_0xd24b('0x2c')](function(_0xa83ee5){if(_0xa83ee5>0x0){_0xdb0168+=_0x369a1d;}_0xc75ec2['push'](dbH[_0xd24b('0x2d')][_0xd24b('0x2e')](util[_0xd24b('0x18')](_0xd24b('0x2f'),QUERY,_0x369a1d,_0xdb0168),{'type':dbH[_0xd24b('0x2d')][_0xd24b('0x30')][_0xd24b('0x31')]}));});if(_0x352fc3>0x0){_0xdb0168+=_0x369a1d;_0xc75ec2[_0xd24b('0x1c')](dbH[_0xd24b('0x2d')][_0xd24b('0x2e')](util[_0xd24b('0x18')](_0xd24b('0x2f'),QUERY,_0x352fc3,_0xdb0168),{'type':dbH[_0xd24b('0x2d')]['QueryTypes']['SELECT']}));}}}else{_0xc75ec2[_0xd24b('0x1c')](dbH[_0xd24b('0x2d')][_0xd24b('0x2e')](QUERY,{'type':dbH[_0xd24b('0x2d')][_0xd24b('0x30')][_0xd24b('0x31')]}));}var _0x41d491=path['dirname'](PATH);var _0x315d90=path[_0xd24b('0x32')](PATH,_0xd24b('0x33'));var _0x23f89e=_0x3e9469['split']&&_0xc75ec2[_0xd24b('0x13')]>0x1;var _0x5860f0=[];if(!fs[_0xd24b('0x34')](path[_0xd24b('0x35')](_0x41d491,_0x315d90))&&_0x23f89e){fs[_0xd24b('0x36')](path[_0xd24b('0x35')](_0x41d491,_0x315d90));}return BPromise[_0xd24b('0x37')](_0xc75ec2,function(_0xcc69e5){_0x5860f0[_0xd24b('0x1c')](_0xcc69e5);})['then'](function(){var _0x4da7fe=[];for(var _0x2f2ade=0x0;_0x2f2ade<_0x5860f0[_0xd24b('0x13')];_0x2f2ade+=0x1){var _0x5ebd5a=_0x5860f0[_0x2f2ade];var _0x31c4b1=createTables(_[_0xd24b('0x38')](_0x5ebd5a));var _0x3c84f5;var _0x446c9b=getPDFDocDefinition(_0x31c4b1);var _0xd187b9=getPDFPrinter();var _0x3df13c=_0xd187b9['createPdfKitDocument'](_0x446c9b);if(_0x23f89e){_0x3c84f5=path['join'](_0x41d491,_0x315d90,util[_0xd24b('0x18')](_0xd24b('0x39'),_0x315d90,_0x2f2ade,_0xd24b('0x3a')));}else{_0x3c84f5=path[_0xd24b('0x35')](_0x41d491,util[_0xd24b('0x18')](_0xd24b('0x3b'),_0x315d90,_0xd24b('0x3a')));}_0x4da7fe[_0xd24b('0x1c')](writePDFDocument(_0x3df13c,_0x3c84f5));}return Promise[_0xd24b('0x3c')](_0x4da7fe);})[_0xd24b('0x2a')](function(){if(_0x23f89e){return new Promise(function(_0xbe5246){zipdir(path[_0xd24b('0x35')](_0x41d491,_0x315d90),{'saveTo':path[_0xd24b('0x35')](_0x41d491,util['format'](_0xd24b('0x3b'),_0x315d90,_0xd24b('0x3d')))},function(){rimraf(path['join'](_0x41d491,_0x315d90),function(){});_0xbe5246('zip\x20finished');});});}})[_0xd24b('0x2a')](function(){if(!_0x23f89e)return;rimraf(path['join'](_0x41d491,_0x315d90),function(){});})[_0xd24b('0x2a')](function(){logger[_0xd24b('0x3e')](util['format'](_0xd24b('0x3f'),EXTRACTED_REPORT_ID,_0xd24b('0x40')));return analyticExtractedReport(_0xd24b('0x41'),_0x23f89e?util[_0xd24b('0x18')](_0xd24b('0x3b'),_0x315d90,_0x23f89e?'zip':_0xd24b('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd24b('0x3e')](util[_0xd24b('0x18')](_0xd24b('0x42'),EXTRACTED_REPORT_ID,_0xd24b('0x40')));return db[_0xd24b('0xe')][_0xd24b('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd24b('0x2a')](function(_0x7789b8){EXTRACTED_REPORT=_0x7789b8;return dbH[_0xd24b('0x2d')][_0xd24b('0x2e')](util[_0xd24b('0x18')](_0xd24b('0x44'),QUERY),{'type':dbH['sequelize'][_0xd24b('0x30')]['SELECT']});})[_0xd24b('0x2a')](extractReport)['catch'](function(_0x4688e8){logger[_0xd24b('0x3e')](util['format'](_0xd24b('0x45'),EXTRACTED_REPORT_ID,_0xd24b('0x40')),util[_0xd24b('0x46')](_0x4688e8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd24b('0x47'));})['finally'](function(){process[_0xd24b('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x573c3a=new PdfPrinter({'Arial':{'normal':__dirname+_0xd24b('0x49'),'bold':__dirname+_0xd24b('0x4a'),'italics':__dirname+_0xd24b('0x4b'),'bolditalics':__dirname+_0xd24b('0x4c')}});return _0x573c3a;}function getPDFDocDefinitionFromHTML(_0x4d982e,_0x1156c2){var _0x4359d4=util[_0xd24b('0x18')]('%s\x20#%d',_0x1156c2[_0xd24b('0x4d')],_0x1156c2['interactionId']);var _0x387faf=moment()[_0xd24b('0x18')]('YYYY-MM-DD')[_0xd24b('0x22')]();var _0x13dab1=htmlToPdfmake(_0x4d982e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x13dab1],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd24b('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd24b('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd24b('0x4e')}},'header':function(){return[{'text':_0xd24b('0x4f'),'style':_0xd24b('0x1d')}];},'footer':function(_0x2a48a,_0x242dfd){return[{'text':util[_0xd24b('0x18')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x4359d4,_0x2a48a,_0x242dfd,_0x387faf),'style':_0xd24b('0x50')}];}};}function writePDFDocument(_0x473300,_0x436ad5){return new Promise(function(_0x441607,_0x1ac3eb){var _0x1a64d2=_0x473300[_0xd24b('0x51')](fs[_0xd24b('0x52')](_0x436ad5));_0x1a64d2['on'](_0xd24b('0x53'),function(){_0x441607(_0xd24b('0x53'));});_0x1a64d2['on'](_0xd24b('0x54'),function(_0x128f70){_0x1ac3eb(_0x128f70);});_0x473300[_0xd24b('0x55')]();});}exports[_0xd24b('0x56')]=function(_0x286648,_0x2f7f3a){var _0x219851=getPDFPrinter();var _0x957da0=getPDFDocDefinitionFromHTML(_0x286648,_0x2f7f3a);var _0x4717fb=_0x219851[_0xd24b('0x57')](_0x957da0);return writePDFDocument(_0x4717fb,_0x2f7f3a[_0xd24b('0x58')])['catch'](function(_0x2f9c83){throw _0x2f9c83;});}; \ No newline at end of file +var _0x92ce=['Setting','find','split','splitSizePdf','then','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfFromHTML','catch','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','toString','value','fill','length','auto','body','chunk','keys','push','format','startDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty'];(function(_0x2fc284,_0x5d271c){var _0x221234=function(_0x39fb00){while(--_0x39fb00){_0x2fc284['push'](_0x2fc284['shift']());}};_0x221234(++_0x5d271c);}(_0x92ce,0xe0));var _0xe92c=function(_0x6a7986,_0x30debf){_0x6a7986=_0x6a7986-0x0;var _0x381864=_0x92ce[_0x6a7986];return _0x381864;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0xe92c('0x0'));var moment=require(_0xe92c('0x1'));var htmlToPdfmake=require(_0xe92c('0x2'));var PdfPrinter=require(_0xe92c('0x3'));var zipdir=require(_0xe92c('0x4'));var rimraf=require(_0xe92c('0x5'));var JSDOM=require(_0xe92c('0x6'))[_0xe92c('0x7')];var window=new JSDOM('')[_0xe92c('0x8')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0xe92c('0x9'))[_0xe92c('0xa')];var logger=require(_0xe92c('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe92c('0xc')][0x2]);var QUERY=process[_0xe92c('0xc')][0x3];var PATH=process[_0xe92c('0xc')][0x4];var NAME=process[_0xe92c('0xc')][0x5];var FORMAT=_0xe92c('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1ed033,_0x12624c){var _0x142930={'status':_0x1ed033};var _0x5b4f72={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12624c){_0x142930[_0xe92c('0xe')]=_0x12624c;}return db[_0xe92c('0xf')][_0xe92c('0x10')](_0x142930,_0x5b4f72);}function getHeaders(_0x2220a8){return _[_0xe92c('0x11')](_0x2220a8,function(_0x30543b){return{'text':_0x30543b,'style':'tableHeader'};});}function getRows(_0x1edb9b,_0x1c1129){return _[_0xe92c('0x11')](_0x1c1129,function(_0x4f48ce){return _(_0x4f48ce)['pick'](_0x1edb9b)['map'](function(_0x54f651){return _0x54f651?_[_0xe92c('0x12')](_0x54f651):'';})[_0xe92c('0x13')]();});}function createTable(_0x13a90e,_0x83aac4){var _0x2b6ada={'widths':_[_0xe92c('0x14')](Array(_0x13a90e[_0xe92c('0x15')]),0x91),'heights':function(_0x237f02){return _0x237f02===0x0?_0xe92c('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xc32f91=getHeaders(_0x13a90e);_0x2b6ada[_0xe92c('0x17')]['push'](_0xc32f91);var _0x458954=getRows(_0x13a90e,_0x83aac4);_0x2b6ada['body']=_0x2b6ada['body']['concat'](_0x458954);return _0x2b6ada;}function createTables(_0x2414ce){var _0x36505e=[];var _0x30e697=_[_0xe92c('0x18')](Object[_0xe92c('0x19')](_0x2414ce[0x0]),0x5);_0x30e697['forEach'](function(_0x9def1e){_0x36505e[_0xe92c('0x1a')](createTable(_0x9def1e,_0x2414ce));});return _0x36505e;}function getPDFDocDefinition(_0x29af7b){var _0x36a9da=util[_0xe92c('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xe92c('0x1c')])[_0xe92c('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x3fbb98=[];for(var _0x5edf5e=0x0;_0x5edf5e<_0x29af7b['length'];_0x5edf5e++){var _0x4fac6b=[];if(_0x5edf5e===0x0){_0x4fac6b[_0xe92c('0x1a')]({'text':_0x36a9da,'style':_0xe92c('0x1d')});}var _0x4ff12f={'table':_0x29af7b[_0x5edf5e]};if(_0x5edf5e>0x0){_0x4ff12f[_0xe92c('0x1e')]=_0xe92c('0x1f');_0x4ff12f[_0xe92c('0x20')]=[0x0,0x46,0x0,0x0];}_0x4fac6b['push'](_0x4ff12f);_0x3fbb98[_0xe92c('0x1a')](_0x4fac6b);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3fbb98,'footer':function(_0x380b8d,_0x164c2c){return{'text':_0x380b8d[_0xe92c('0x12')]()+_0xe92c('0x21')+_0x164c2c,'style':_0xe92c('0x22')};},'defaultStyle':{'font':_0xe92c('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe92c('0x24')},'footer':{'alignment':_0xe92c('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x8e84b3){var _0x3d7ca6=0x1388;var _0x3a484a;if(!_0x8e84b3[0x0][_0xe92c('0x26')]){return analyticExtractedReport(_0xe92c('0x27'));}return db[_0xe92c('0x28')][_0xe92c('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe92c('0x2a'),_0xe92c('0x2b')]})[_0xe92c('0x2c')](function(_0x4059bd){if(_0x4059bd){_0x3a484a=_0x4059bd;_0x3d7ca6=_0x3a484a['splitSizePdf']||0x3e8;}})[_0xe92c('0x2c')](function(){var _0x886f2d=[];var _0x443a32=0x0;if(_0x3a484a[_0xe92c('0x2a')]){if(_0x8e84b3&&_0x8e84b3[_0xe92c('0x15')]){var _0xaa6353=_['range'](_0x8e84b3[0x0][_0xe92c('0x26')]/_0x3d7ca6);var _0xfa885=Number[_0xe92c('0x2d')](_0x8e84b3[0x0]['num']/_0x3d7ca6)?_0x8e84b3[0x0][_0xe92c('0x26')]%_0x3d7ca6:0x0;_0xaa6353['forEach'](function(_0x425052){if(_0x425052>0x0){_0x443a32+=_0x3d7ca6;}_0x886f2d['push'](dbH['sequelize'][_0xe92c('0x2e')](util[_0xe92c('0x1b')](_0xe92c('0x2f'),QUERY,_0x3d7ca6,_0x443a32),{'type':dbH[_0xe92c('0x30')][_0xe92c('0x31')][_0xe92c('0x32')]}));});if(_0xfa885>0x0){_0x443a32+=_0x3d7ca6;_0x886f2d[_0xe92c('0x1a')](dbH[_0xe92c('0x30')][_0xe92c('0x2e')](util['format'](_0xe92c('0x2f'),QUERY,_0xfa885,_0x443a32),{'type':dbH[_0xe92c('0x30')]['QueryTypes'][_0xe92c('0x32')]}));}}}else{_0x886f2d[_0xe92c('0x1a')](dbH[_0xe92c('0x30')][_0xe92c('0x2e')](QUERY,{'type':dbH[_0xe92c('0x30')][_0xe92c('0x31')][_0xe92c('0x32')]}));}var _0x16f382=path[_0xe92c('0x33')](PATH);var _0x3b75b5=path[_0xe92c('0x34')](PATH,_0xe92c('0x35'));var _0x2578b5=_0x3a484a[_0xe92c('0x2a')]&&_0x886f2d['length']>0x1;var _0x58323a=[];if(!fs[_0xe92c('0x36')](path[_0xe92c('0x37')](_0x16f382,_0x3b75b5))&&_0x2578b5){fs['mkdirSync'](path[_0xe92c('0x37')](_0x16f382,_0x3b75b5));}return BPromise[_0xe92c('0x38')](_0x886f2d,function(_0x46ca59){_0x58323a[_0xe92c('0x1a')](_0x46ca59);})[_0xe92c('0x2c')](function(){var _0x11ca34=[];for(var _0x17738a=0x0;_0x17738a<_0x58323a[_0xe92c('0x15')];_0x17738a+=0x1){var _0x32d91a=_0x58323a[_0x17738a];var _0x587375=createTables(_[_0xe92c('0x39')](_0x32d91a));var _0xda2177;var _0x174b46=getPDFDocDefinition(_0x587375);var _0x23e387=getPDFPrinter();var _0x3a13be=_0x23e387[_0xe92c('0x3a')](_0x174b46);if(_0x2578b5){_0xda2177=path[_0xe92c('0x37')](_0x16f382,_0x3b75b5,util[_0xe92c('0x1b')](_0xe92c('0x3b'),_0x3b75b5,_0x17738a,'pdf'));}else{_0xda2177=path[_0xe92c('0x37')](_0x16f382,util[_0xe92c('0x1b')]('%s.%s',_0x3b75b5,_0xe92c('0x3c')));}_0x11ca34[_0xe92c('0x1a')](writePDFDocument(_0x3a13be,_0xda2177));}return Promise[_0xe92c('0x3d')](_0x11ca34);})['then'](function(){if(_0x2578b5){return new Promise(function(_0xd1ac5){zipdir(path['join'](_0x16f382,_0x3b75b5),{'saveTo':path[_0xe92c('0x37')](_0x16f382,util[_0xe92c('0x1b')](_0xe92c('0x3e'),_0x3b75b5,_0xe92c('0x3f')))},function(){rimraf(path[_0xe92c('0x37')](_0x16f382,_0x3b75b5),function(){});_0xd1ac5(_0xe92c('0x40'));});});}})[_0xe92c('0x2c')](function(){if(!_0x2578b5)return;rimraf(path[_0xe92c('0x37')](_0x16f382,_0x3b75b5),function(){});})[_0xe92c('0x2c')](function(){logger['info'](util[_0xe92c('0x1b')](_0xe92c('0x41'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xe92c('0x42'),_0x2578b5?util[_0xe92c('0x1b')]('%s.%s',_0x3b75b5,_0x2578b5?_0xe92c('0x3f'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xe92c('0x1b')](_0xe92c('0x43'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x4cb0b7){EXTRACTED_REPORT=_0x4cb0b7;return dbH[_0xe92c('0x30')][_0xe92c('0x2e')](util[_0xe92c('0x1b')](_0xe92c('0x44'),QUERY),{'type':dbH[_0xe92c('0x30')][_0xe92c('0x31')][_0xe92c('0x32')]});})[_0xe92c('0x2c')](extractReport)['catch'](function(_0x4607c9){logger[_0xe92c('0x45')](util[_0xe92c('0x1b')](_0xe92c('0x46'),EXTRACTED_REPORT_ID,_0xe92c('0x47')),util[_0xe92c('0x48')](_0x4607c9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe92c('0x49')](function(){process[_0xe92c('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1e8b98=new PdfPrinter({'Arial':{'normal':__dirname+_0xe92c('0x4b'),'bold':__dirname+_0xe92c('0x4c'),'italics':__dirname+_0xe92c('0x4d'),'bolditalics':__dirname+_0xe92c('0x4e')}});return _0x1e8b98;}function getPDFDocDefinitionFromHTML(_0x1fbda0,_0x219651){var _0x4c7f22=util['format']('%s\x20#%d',_0x219651[_0xe92c('0x4f')],_0x219651['interactionId']);var _0x4501a5=moment()[_0xe92c('0x1b')]('YYYY-MM-DD')[_0xe92c('0x12')]();var _0x37297f=htmlToPdfmake(_0x1fbda0,{'window':window,'tableAutoSize':!![]});return{'content':[_0x37297f],'defaultStyle':{'font':_0xe92c('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe92c('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe92c('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xe92c('0x50')}},'header':function(){return[{'text':_0xe92c('0x51'),'style':_0xe92c('0x1d')}];},'footer':function(_0x2c1b24,_0x5b93b9){return[{'text':util[_0xe92c('0x1b')](_0xe92c('0x52'),_0x4c7f22,_0x2c1b24,_0x5b93b9,_0x4501a5),'style':_0xe92c('0x22')}];}};}function writePDFDocument(_0x2f13e7,_0x2e5c82){return new Promise(function(_0x13e4ee,_0x3ea1a6){var _0x4a56d4=_0x2f13e7['pipe'](fs[_0xe92c('0x53')](_0x2e5c82));_0x4a56d4['on'](_0xe92c('0x54'),function(){_0x13e4ee('finish');});_0x4a56d4['on'](_0xe92c('0x55'),function(_0x19ac37){_0x3ea1a6(_0x19ac37);});_0x2f13e7['end']();});}exports[_0xe92c('0x56')]=function(_0x37a684,_0x4a6ed3){var _0x6d2018=getPDFPrinter();var _0x35f17a=getPDFDocDefinitionFromHTML(_0x37a684,_0x4a6ed3);var _0x47e2f9=_0x6d2018[_0xe92c('0x3a')](_0x35f17a);return writePDFDocument(_0x47e2f9,_0x4a6ed3[_0xe92c('0x0')])[_0xe92c('0x57')](function(_0x48ffd5){throw _0x48ffd5;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b09f34b..1cc8fb2 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 _0x2472=['QueryTypes','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','split','existsSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize'];(function(_0x133178,_0x30c7cf){var _0x53a051=function(_0x22b14b){while(--_0x22b14b){_0x133178['push'](_0x133178['shift']());}};_0x53a051(++_0x30c7cf);}(_0x2472,0xd8));var _0x2247=function(_0xa048f8,_0x5e1892){_0xa048f8=_0xa048f8-0x0;var _0x432370=_0x2472[_0xa048f8];return _0x432370;};'use strict';var util=require(_0x2247('0x0'));var path=require(_0x2247('0x1'));var _=require(_0x2247('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x2247('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2247('0x4'))[_0x2247('0x5')];var logger=require(_0x2247('0x6'))(_0x2247('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x2247('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2325d9,_0x2881c9){var _0x1c83ae={'status':_0x2325d9};var _0x58f607={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2881c9){_0x1c83ae['savename']=_0x2881c9;}return db[_0x2247('0x9')]['update'](_0x1c83ae,_0x58f607);}function main(){var _0x3af39b=0x1388;var _0x10233b;logger[_0x2247('0xa')](util[_0x2247('0xb')](_0x2247('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x2247('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2247('0xe')]})[_0x2247('0xf')](function(_0x4857c5){if(_0x4857c5){_0x10233b=_0x4857c5;_0x3af39b=_0x10233b['splitSizeXlsx']||0x1388;}})[_0x2247('0xf')](function(){return dbH['sequelize'][_0x2247('0x10')](util['format'](_0x2247('0x11'),QUERY),{'type':dbH[_0x2247('0x12')][_0x2247('0x13')]['SELECT']});})[_0x2247('0xf')](function(_0x41a0ba){if(!_0x41a0ba[0x0][_0x2247('0x14')]){return analyticExtractedReport(_0x2247('0x15'));}var _0xe3b231=[];var _0x17b8ae=0x0;if(_0x10233b['split']){if(_0x41a0ba&&_0x41a0ba[_0x2247('0x16')]){var _0x553f6c=_[_0x2247('0x17')](_0x41a0ba[0x0][_0x2247('0x14')]/_0x3af39b);var _0x107bed=Number[_0x2247('0x18')](_0x41a0ba[0x0][_0x2247('0x14')]/_0x3af39b)?_0x41a0ba[0x0]['num']%_0x3af39b:0x0;_0x553f6c['forEach'](function(_0x7af113){if(_0x7af113>0x0){_0x17b8ae+=_0x3af39b;}_0xe3b231[_0x2247('0x19')](dbH[_0x2247('0x12')][_0x2247('0x10')](util[_0x2247('0xb')](_0x2247('0x1a'),QUERY,_0x3af39b,_0x17b8ae),{'type':dbH[_0x2247('0x12')]['QueryTypes'][_0x2247('0x1b')]}));});if(_0x107bed>0x0){_0x17b8ae+=_0x3af39b;_0xe3b231['push'](dbH[_0x2247('0x12')][_0x2247('0x10')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x107bed,_0x17b8ae),{'type':dbH['sequelize'][_0x2247('0x13')]['SELECT']}));}}}else{_0xe3b231['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x2247('0x12')][_0x2247('0x13')][_0x2247('0x1b')]}));}var _0x51d4e2=path[_0x2247('0x1c')](PATH);var _0x4670f2=path[_0x2247('0x1d')](PATH,_0x2247('0x1e'));var _0x351646=_0x10233b[_0x2247('0x1f')]&&_0xe3b231[_0x2247('0x16')]>0x1;var _0x1125ed=[];if(!fs[_0x2247('0x20')](path['join'](_0x51d4e2,_0x4670f2))&&_0x351646){fs['mkdirSync'](path[_0x2247('0x21')](_0x51d4e2,_0x4670f2));}return BPromise[_0x2247('0x22')](_0xe3b231,function(_0x1a8544){_0x1125ed[_0x2247('0x19')](_0x1a8544);})[_0x2247('0xf')](function(){for(var _0x550b35=0x0;_0x550b35<_0x1125ed['length'];_0x550b35+=0x1){var _0x34a122;var _0x2b01e6=_0x1125ed[_0x550b35];if(_0x351646){_0x34a122=path['join'](_0x51d4e2,_0x4670f2,util[_0x2247('0xb')](_0x2247('0x23'),_0x4670f2,_0x550b35,_0x2247('0x24')));}else{_0x34a122=path['join'](_0x51d4e2,util[_0x2247('0xb')](_0x2247('0x25'),_0x4670f2,_0x2247('0x24')));}fs['writeFileSync'](_0x34a122,json2xls(_0x2b01e6),_0x2247('0x26'));}})[_0x2247('0xf')](function(){if(_0x351646){return new Promise(function(_0x43056e){zipdir(path['join'](_0x51d4e2,_0x4670f2),{'saveTo':path[_0x2247('0x21')](_0x51d4e2,util[_0x2247('0xb')]('%s.%s',_0x4670f2,_0x2247('0x27')))},function(_0x27f8b2,_0x4e8e6a){rimraf(path[_0x2247('0x21')](_0x51d4e2,_0x4670f2),function(){});_0x43056e('zip\x20finished');});});}})[_0x2247('0xf')](function(){logger[_0x2247('0xa')](util[_0x2247('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2247('0x28')));return analyticExtractedReport(_0x2247('0x29'),_0x351646?util[_0x2247('0xb')](_0x2247('0x25'),_0x4670f2,_0x351646?_0x2247('0x27'):_0x2247('0x24')):null);});})[_0x2247('0x2a')](function(_0x1739bd){logger[_0x2247('0xa')](util[_0x2247('0xb')](_0x2247('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x2247('0x2c')](_0x1739bd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2247('0x2d'));})['finally'](function(){process[_0x2247('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8960=['length','isInteger','num','forEach','sequelize','query','SELECT','push','QueryTypes','dirname','basename','.xlsx','existsSync','mkdirSync','each','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Empty'];(function(_0x1488fe,_0x1a2440){var _0x142f88=function(_0x4b98a7){while(--_0x4b98a7){_0x1488fe['push'](_0x1488fe['shift']());}};_0x142f88(++_0x1a2440);}(_0x8960,0x17b));var _0x0896=function(_0x206bd7,_0x4426a8){_0x206bd7=_0x206bd7-0x0;var _0x1eec47=_0x8960[_0x206bd7];return _0x1eec47;};'use strict';var util=require('util');var path=require(_0x0896('0x0'));var _=require(_0x0896('0x1'));var fs=require('fs');var json2xls=require(_0x0896('0x2'));var BPromise=require(_0x0896('0x3'));var zipdir=require(_0x0896('0x4'));var rimraf=require(_0x0896('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x0896('0x6'))[_0x0896('0x7')];var logger=require(_0x0896('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0896('0x9')][0x2]);var QUERY=process[_0x0896('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x197968,_0x4958f1){var _0x56d3e1={'status':_0x197968};var _0x1dd5e9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4958f1){_0x56d3e1[_0x0896('0xa')]=_0x4958f1;}return db[_0x0896('0xb')][_0x0896('0xc')](_0x56d3e1,_0x1dd5e9);}function main(){var _0x1dfd7e=0x1388;var _0x1612c7;logger[_0x0896('0xd')](util[_0x0896('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x0896('0xf')][_0x0896('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0896('0x11')]})[_0x0896('0x12')](function(_0x5388c8){if(_0x5388c8){_0x1612c7=_0x5388c8;_0x1dfd7e=_0x1612c7[_0x0896('0x11')]||0x1388;}})[_0x0896('0x12')](function(){return dbH['sequelize']['query'](util['format'](_0x0896('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x0896('0x12')](function(_0x5629a1){if(!_0x5629a1[0x0]['num']){return analyticExtractedReport(_0x0896('0x14'));}var _0x5dd072=[];var _0x1806d6=0x0;if(_0x1612c7['split']){if(_0x5629a1&&_0x5629a1[_0x0896('0x15')]){var _0x5d3f45=_['range'](_0x5629a1[0x0]['num']/_0x1dfd7e);var _0x321850=Number[_0x0896('0x16')](_0x5629a1[0x0]['num']/_0x1dfd7e)?_0x5629a1[0x0][_0x0896('0x17')]%_0x1dfd7e:0x0;_0x5d3f45[_0x0896('0x18')](function(_0x77b14){if(_0x77b14>0x0){_0x1806d6+=_0x1dfd7e;}_0x5dd072['push'](dbH[_0x0896('0x19')][_0x0896('0x1a')](util[_0x0896('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1dfd7e,_0x1806d6),{'type':dbH[_0x0896('0x19')]['QueryTypes']['SELECT']}));});if(_0x321850>0x0){_0x1806d6+=_0x1dfd7e;_0x5dd072['push'](dbH['sequelize'][_0x0896('0x1a')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x321850,_0x1806d6),{'type':dbH[_0x0896('0x19')]['QueryTypes'][_0x0896('0x1b')]}));}}}else{_0x5dd072[_0x0896('0x1c')](dbH[_0x0896('0x19')]['query'](QUERY,{'type':dbH[_0x0896('0x19')][_0x0896('0x1d')]['SELECT']}));}var _0x35348a=path[_0x0896('0x1e')](PATH);var _0x22447b=path[_0x0896('0x1f')](PATH,_0x0896('0x20'));var _0xdfaa74=_0x1612c7['split']&&_0x5dd072[_0x0896('0x15')]>0x1;var _0x2353b0=[];if(!fs[_0x0896('0x21')](path['join'](_0x35348a,_0x22447b))&&_0xdfaa74){fs[_0x0896('0x22')](path['join'](_0x35348a,_0x22447b));}return BPromise[_0x0896('0x23')](_0x5dd072,function(_0x4135f3){_0x2353b0[_0x0896('0x1c')](_0x4135f3);})[_0x0896('0x12')](function(){for(var _0x54b3ca=0x0;_0x54b3ca<_0x2353b0[_0x0896('0x15')];_0x54b3ca+=0x1){var _0x427cad;var _0x4bfd39=_0x2353b0[_0x54b3ca];if(_0xdfaa74){_0x427cad=path[_0x0896('0x24')](_0x35348a,_0x22447b,util[_0x0896('0xe')](_0x0896('0x25'),_0x22447b,_0x54b3ca,_0x0896('0x26')));}else{_0x427cad=path[_0x0896('0x24')](_0x35348a,util[_0x0896('0xe')]('%s.%s',_0x22447b,'xlsx'));}fs[_0x0896('0x27')](_0x427cad,json2xls(_0x4bfd39),_0x0896('0x28'));}})[_0x0896('0x12')](function(){if(_0xdfaa74){return new Promise(function(_0x465c4d){zipdir(path['join'](_0x35348a,_0x22447b),{'saveTo':path[_0x0896('0x24')](_0x35348a,util[_0x0896('0xe')](_0x0896('0x29'),_0x22447b,'zip'))},function(_0x5bcb40,_0x7356d1){rimraf(path[_0x0896('0x24')](_0x35348a,_0x22447b),function(){});_0x465c4d('zip\x20finished');});});}})[_0x0896('0x12')](function(){logger[_0x0896('0xd')](util[_0x0896('0xe')](_0x0896('0x2a'),EXTRACTED_REPORT_ID,_0x0896('0x2b')));return analyticExtractedReport(_0x0896('0x2c'),_0xdfaa74?util[_0x0896('0xe')](_0x0896('0x29'),_0x22447b,_0xdfaa74?_0x0896('0x2d'):'xlsx'):null);});})['catch'](function(_0x4bc599){logger[_0x0896('0xd')](util['format'](_0x0896('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x4bc599,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0896('0x2f'));})[_0x0896('0x30')](function(){process[_0x0896('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f460798..81db00c 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 _0xc906=['CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','push','context','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','rewrite','lodash','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','map','exten'];(function(_0x2ed132,_0xfd2d15){var _0x1b7735=function(_0x119012){while(--_0x119012){_0x2ed132['push'](_0x2ed132['shift']());}};_0x1b7735(++_0xfd2d15);}(_0xc906,0x1ed));var _0x6c90=function(_0x4f705f,_0x3023f2){_0x4f705f=_0x4f705f-0x0;var _0x4a0b33=_0xc906[_0x4f705f];return _0x4a0b33;};'use strict';var _=require(_0x6c90('0x0'));var util=require(_0x6c90('0x1'));function rewrite(_0x55a452,_0x3e0501){var _0x5b3a79=this;return _0x55a452['models'][_0x6c90('0x2')][_0x6c90('0x3')]({'raw':!![]})[_0x6c90('0x4')](function(_0x56c0cf){_0x5b3a79[_0x6c90('0x5')]=_0x56c0cf;return _0x55a452[_0x6c90('0x6')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x3e0501[_0x6c90('0x7')]},'raw':!![]});})[_0x6c90('0x4')](function(_0xa3af3){return _0x55a452[_0x6c90('0x6')][_0x6c90('0x8')][_0x6c90('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x6c90('0x9')](_0xa3af3,_0x6c90('0xa')))}},'order':[{'raw':_0x6c90('0xb')}],'raw':!![]});})[_0x6c90('0x4')](function(_0x2d3c06){var _0x90d22b=_[_0x6c90('0xc')](_0x2d3c06,{'priority':'1'});var _0x444857=_[_0x6c90('0xc')](_0x2d3c06,{'isApp':0x1});var _0x546860=_[_0x6c90('0xd')](_0x444857,'exten');var _0x3cfc6d=['queue',_0x6c90('0xe')];var _0x502082=[];var _0x17b955=[];for(var _0x30ad03 in _0x546860){if(_0x546860[_0x6c90('0xf')](_0x30ad03)){_0x5b3a79[_0x6c90('0x10')]=0x2;_0x5b3a79[_0x6c90('0x11')]=[];_0x5b3a79[_0x6c90('0x12')]=_['find'](_0x90d22b,{'exten':_0x546860[_0x30ad03][0x0][_0x6c90('0xa')]});_0x5b3a79[_0x6c90('0x11')]['push']({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':_0x6c90('0x14'),'appdata':util[_0x6c90('0x15')](_0x6c90('0x16'),_0x546860[_0x30ad03][0x0][_0x6c90('0x13')]),'context':_0x546860[_0x30ad03][0x0]['context'],'exten':_0x546860[_0x30ad03][0x0][_0x6c90('0xa')],'priority':_0x5b3a79['priority']++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});if(_0x546860[_0x30ad03][0x0][_0x6c90('0x13')]===_0x6c90('0x18')){_0x5b3a79[_0x6c90('0x11')][_0x6c90('0x19')]({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':'Set','appdata':'CDR(routeid)='+_0x546860[_0x30ad03][0x0][_0x6c90('0x17')],'context':_0x546860[_0x30ad03][0x0][_0x6c90('0x1a')],'exten':_0x546860[_0x30ad03][0x0]['exten'],'priority':_0x5b3a79[_0x6c90('0x10')]++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});}else if(_0x546860[_0x30ad03][0x0]['type']===_0x6c90('0x1b')){if(_0x5b3a79[_0x6c90('0x12')]){_0x5b3a79[_0x6c90('0x11')]['push']({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':_0x6c90('0x14'),'appdata':_0x6c90('0x1c')+(_0x5b3a79['extension']['cutdigits']?_0x6c90('0x1d')+_0x5b3a79[_0x6c90('0x12')][_0x6c90('0x1e')]+'}':_0x6c90('0x1f')),'context':_0x546860[_0x30ad03][0x0]['context'],'exten':_0x546860[_0x30ad03][0x0]['exten'],'priority':_0x5b3a79[_0x6c90('0x10')]++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});}_0x5b3a79['extensions'][_0x6c90('0x19')]({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':_0x6c90('0x14'),'appdata':_0x6c90('0x20')+_0x546860[_0x30ad03][0x0][_0x6c90('0x17')],'context':_0x546860[_0x30ad03][0x0][_0x6c90('0x1a')],'exten':_0x546860[_0x30ad03][0x0]['exten'],'priority':_0x5b3a79[_0x6c90('0x10')]++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});var _0x3ee8e9=_0x5b3a79[_0x6c90('0x10')]++;_0x5b3a79[_0x6c90('0x11')][_0x6c90('0x19')]({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':_0x6c90('0x21'),'appdata':_0x6c90('0x22')+(_0x3ee8e9+0x2)+_0x6c90('0x23')+(_0x3ee8e9+0x1)+')','context':_0x546860[_0x30ad03][0x0]['context'],'exten':_0x546860[_0x30ad03][0x0]['exten'],'priority':_0x3ee8e9,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});if(_0x5b3a79[_0x6c90('0x12')]){_0x5b3a79[_0x6c90('0x11')]['push']({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':'Set','appdata':_0x5b3a79['extension'][_0x6c90('0x1e')]?_0x6c90('0x24')+_0x5b3a79['extension'][_0x6c90('0x1e')]+'}':_0x6c90('0x25'),'context':_0x546860[_0x30ad03][0x0][_0x6c90('0x1a')],'exten':_0x546860[_0x30ad03][0x0][_0x6c90('0xa')],'priority':_0x5b3a79['priority']++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});}_0x5b3a79[_0x6c90('0x11')]['push']({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':'Set','appdata':_0x6c90('0x26')+_0x546860[_0x30ad03][0x0]['VoiceExtensionId'],'context':_0x546860[_0x30ad03][0x0][_0x6c90('0x1a')],'exten':_0x546860[_0x30ad03][0x0]['exten'],'priority':_0x5b3a79['priority']++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0]['VoiceExtensionId']});if(_0x5b3a79[_0x6c90('0x12')]&&_0x5b3a79[_0x6c90('0x12')][_0x6c90('0xf')](_0x6c90('0x27'))&&_0x5b3a79['extension'][_0x6c90('0x27')]!==_0x6c90('0x28')){_0x5b3a79['extensions'][_0x6c90('0x19')]({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':_0x6c90('0x14'),'appdata':_0x6c90('0x29'),'context':_0x546860[_0x30ad03][0x0][_0x6c90('0x1a')],'exten':_0x546860[_0x30ad03][0x0][_0x6c90('0xa')],'priority':_0x5b3a79[_0x6c90('0x10')]++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});_0x5b3a79[_0x6c90('0x11')][_0x6c90('0x19')]({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':_0x6c90('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5b3a79['extension'][_0x6c90('0x27')]||_0x6c90('0x2a'),'context':_0x546860[_0x30ad03][0x0]['context'],'exten':_0x546860[_0x30ad03][0x0]['exten'],'priority':_0x5b3a79[_0x6c90('0x10')]++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});}}_0x5b3a79[_0x6c90('0x11')][_0x6c90('0x19')]({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x546860[_0x30ad03][0x0][_0x6c90('0x1a')],'exten':_0x546860[_0x30ad03][0x0][_0x6c90('0xa')],'priority':_0x5b3a79[_0x6c90('0x10')]++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});_0x5b3a79[_0x6c90('0x11')]['push']({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':'Set','appdata':_0x6c90('0x2b'),'context':_0x546860[_0x30ad03][0x0]['context'],'exten':_0x546860[_0x30ad03][0x0][_0x6c90('0xa')],'priority':_0x5b3a79[_0x6c90('0x10')]++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0]['VoiceExtensionId']});_0x5b3a79['extensions']['push']({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':_0x6c90('0x14'),'appdata':_0x6c90('0x2c'),'context':_0x546860[_0x30ad03][0x0][_0x6c90('0x1a')],'exten':_0x546860[_0x30ad03][0x0][_0x6c90('0xa')],'priority':_0x5b3a79['priority']++,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});for(var _0x444c50=0x0,_0xb216de=0x0;_0x444c50<_0x546860[_0x30ad03][_0x6c90('0x2d')];_0x444c50+=0x1,_0xb216de=0x0){var _0x22a652=_0x546860[_0x30ad03][_0x444c50];if(_0x22a652['type']){_0x22a652[_0x6c90('0x13')]=_0x22a652[_0x6c90('0x13')][_0x6c90('0x2e')]();}var _0xfd516e=[];var _0x3ea83a=[];delete _0x22a652['id'];delete _0x22a652['createdAt'];delete _0x22a652['updatedAt'];var _0x2bd73c=_0x22a652[_0x6c90('0x2f')]!==_0x6c90('0x30')?[_0x22a652[_0x6c90('0x2f')]]:_0x22a652[_0x6c90('0x7')]?_[_0x6c90('0x9')](_['filter'](_0x5b3a79[_0x6c90('0x5')],{'IntervalId':_0x22a652[_0x6c90('0x7')]}),_0x6c90('0x2f')):[];if(_0x22a652[_0x6c90('0xf')](_0x6c90('0x31'))){if(_0x22a652[_0x6c90('0x31')]&&_0x22a652[_0x6c90('0x31')]!=='--'){_0xfd516e['push']({'type':_0x22a652[_0x6c90('0x13')],'app':_0x6c90('0x14'),'appdata':_0x6c90('0x32')+_0x22a652[_0x6c90('0x31')],'context':_0x22a652['context'],'exten':_0x22a652[_0x6c90('0xa')],'priority':_0x2bd73c['length']+_0x5b3a79[_0x6c90('0x10')]+_0xb216de++,'VoiceExtensionId':_0x22a652['VoiceExtensionId']});}}if(_0x22a652[_0x6c90('0x13')]===_0x6c90('0x1b')&&_0x22a652[_0x6c90('0xf')](_0x6c90('0x33'))){if(_0x22a652[_0x6c90('0x33')]){_0xfd516e[_0x6c90('0x19')]({'type':_0x22a652[_0x6c90('0x13')],'app':_0x6c90('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x22a652[_0x6c90('0x33')]+')','context':_0x22a652[_0x6c90('0x1a')],'exten':_0x22a652[_0x6c90('0xa')],'priority':_0x2bd73c[_0x6c90('0x2d')]+_0x5b3a79[_0x6c90('0x10')]+_0xb216de++,'VoiceExtensionId':_0x22a652[_0x6c90('0x17')]});}else{_0xfd516e[_0x6c90('0x19')]({'type':_0x22a652[_0x6c90('0x13')],'app':_0x6c90('0x21'),'appdata':_0x6c90('0x34'),'context':_0x22a652[_0x6c90('0x1a')],'exten':_0x22a652[_0x6c90('0xa')],'priority':_0x2bd73c[_0x6c90('0x2d')]+_0x5b3a79['priority']+_0xb216de++,'VoiceExtensionId':_0x22a652[_0x6c90('0x17')]});}}if(_0x22a652[_0x6c90('0xf')](_0x6c90('0x35'))){if(_0x3cfc6d[_0x6c90('0x36')](_0x22a652['app'][_0x6c90('0x2e')]())>=0x0&&_0x22a652[_0x6c90('0x37')]!==_0x6c90('0x38')){if(_0x22a652[_0x6c90('0x35')]){_0xfd516e[_0x6c90('0x19')]({'type':_0x22a652[_0x6c90('0x13')],'app':_0x6c90('0x21'),'appdata':_0x6c90('0x39'),'context':_0x22a652[_0x6c90('0x1a')],'exten':_0x22a652[_0x6c90('0xa')],'priority':_0x2bd73c[_0x6c90('0x2d')]+_0x5b3a79[_0x6c90('0x10')]+_0xb216de++,'VoiceExtensionId':_0x22a652[_0x6c90('0x17')]});_0xfd516e[_0x6c90('0x19')]({'type':_0x22a652['type'],'app':_0x6c90('0x14'),'appdata':_0x6c90('0x3a'),'context':_0x22a652[_0x6c90('0x1a')],'exten':_0x22a652[_0x6c90('0xa')],'priority':_0x2bd73c[_0x6c90('0x2d')]+_0x5b3a79[_0x6c90('0x10')]+_0xb216de++,'VoiceExtensionId':_0x22a652[_0x6c90('0x17')]});}else{_0xfd516e[_0x6c90('0x19')]({'type':_0x22a652['type'],'app':_0x6c90('0x21'),'appdata':_0x6c90('0x3b'),'context':_0x22a652[_0x6c90('0x1a')],'exten':_0x22a652[_0x6c90('0xa')],'priority':_0x2bd73c[_0x6c90('0x2d')]+_0x5b3a79['priority']+_0xb216de++,'VoiceExtensionId':_0x22a652['VoiceExtensionId']});_0xfd516e[_0x6c90('0x19')]({'type':_0x22a652[_0x6c90('0x13')],'app':_0x6c90('0x14'),'appdata':_0x6c90('0x3c'),'context':_0x22a652[_0x6c90('0x1a')],'exten':_0x22a652[_0x6c90('0xa')],'priority':_0x2bd73c[_0x6c90('0x2d')]+_0x5b3a79[_0x6c90('0x10')]+_0xb216de++,'VoiceExtensionId':_0x22a652['VoiceExtensionId']});}}}for(var _0x5afea0=0x0;_0x5afea0<_0x2bd73c[_0x6c90('0x2d')];_0x5afea0+=0x1){var _0x183498=_0x5b3a79['priority']+_0x2bd73c[_0x6c90('0x2d')];var _0x335e7f=_0x5afea0===_0x2bd73c[_0x6c90('0x2d')]-0x1?_0x5b3a79[_0x6c90('0x10')]+_0xfd516e[_0x6c90('0x2d')]+_0x3ea83a['length']+0x2:_0x5b3a79[_0x6c90('0x10')]+_0x5afea0+0x1;_0xfd516e[_0x6c90('0x3d')](_0x5afea0,0x0,{'type':_0x22a652['type'],'app':_0x6c90('0x3e'),'appdata':_0x2bd73c[_0x5afea0]+'?'+_0x22a652[_0x6c90('0x1a')]+_0x6c90('0x3f')+_0x183498+':'+_0x22a652[_0x6c90('0x1a')]+',${EXTEN},'+_0x335e7f,'exten':_0x22a652[_0x6c90('0xa')],'context':_0x22a652[_0x6c90('0x1a')],'priority':_0x5b3a79[_0x6c90('0x10')]+_0x5afea0,'VoiceExtensionId':_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]});}_0x22a652[_0x6c90('0x10')]=_0xfd516e[_0x6c90('0x2d')]?_[_0x6c90('0x40')](_0xfd516e)['priority']+0x1:_0x5b3a79[_0x6c90('0x10')];_0x5b3a79[_0x6c90('0x10')]=(_0x3ea83a[_0x6c90('0x2d')]?_['last'](_0x3ea83a)[_0x6c90('0x10')]:_0x22a652[_0x6c90('0x10')])+0x1;_0x5b3a79[_0x6c90('0x11')]=_[_0x6c90('0x41')](_0x5b3a79['extensions'],_0xfd516e,[_0x22a652],_0x3ea83a);}_0x5b3a79[_0x6c90('0x11')]['push']({'type':_0x546860[_0x30ad03][0x0][_0x6c90('0x13')],'app':_0x6c90('0x42'),'exten':_0x546860[_0x30ad03][0x0][_0x6c90('0xa')],'context':_0x546860[_0x30ad03][0x0][_0x6c90('0x1a')],'priority':_0x5b3a79[_0x6c90('0x10')],'VoiceExtensionId':_0x546860[_0x30ad03][0x0]['VoiceExtensionId']});_0x502082['push'](_0x546860[_0x30ad03][0x0][_0x6c90('0x17')]);_0x17b955=_['concat'](_0x17b955,_0x5b3a79['extensions']);}}return _0x55a452[_0x6c90('0x43')](function(_0x26ebe0){return _0x55a452[_0x6c90('0x6')][_0x6c90('0x8')][_0x6c90('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x502082}},'transaction':_0x26ebe0})[_0x6c90('0x4')](function(_0xec5ca1){return _0x55a452[_0x6c90('0x6')][_0x6c90('0x8')][_0x6c90('0x45')](_[_0x6c90('0x46')](_0x17b955,_0x6c90('0x10')),{'transaction':_0x26ebe0});});});})['catch'](function(_0x448c1f){console['error'](_0x448c1f);});}exports[_0x6c90('0x47')]=rewrite; \ No newline at end of file +var _0xb833=['util','Interval','then','intervals','findAll','models','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','MONITOR_OPTIONS=ab','updatedAt','interval','*,*,*,*','IntervalId','hasOwnProperty','tag','CDR(tag)=','length','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','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite'];(function(_0x59ae41,_0x22a50c){var _0x3a46f6=function(_0x47fb9e){while(--_0x47fb9e){_0x59ae41['push'](_0x59ae41['shift']());}};_0x3a46f6(++_0x22a50c);}(_0xb833,0x1b9));var _0x3b83=function(_0x5134ae,_0x12e32d){_0x5134ae=_0x5134ae-0x0;var _0x281380=_0xb833[_0x5134ae];return _0x281380;};'use strict';var _=require('lodash');var util=require(_0x3b83('0x0'));function rewrite(_0x23ed52,_0x1d7c37){var _0x3efe7d=this;return _0x23ed52['models'][_0x3b83('0x1')]['findAll']({'raw':!![]})[_0x3b83('0x2')](function(_0x36057c){_0x3efe7d[_0x3b83('0x3')]=_0x36057c;return _0x23ed52['models']['VoiceExtension'][_0x3b83('0x4')]({'where':{'IntervalId':_0x1d7c37['IntervalId']},'raw':!![]});})['then'](function(_0x558889){return _0x23ed52[_0x3b83('0x5')][_0x3b83('0x6')][_0x3b83('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x3b83('0x7')](_0x558889,_0x3b83('0x8')))}},'order':[{'raw':_0x3b83('0x9')}],'raw':!![]});})[_0x3b83('0x2')](function(_0x271b37){var _0x2b2f56=_[_0x3b83('0xa')](_0x271b37,{'priority':'1'});var _0x2022ff=_[_0x3b83('0xa')](_0x271b37,{'isApp':0x1});var _0xf5f3ad=_[_0x3b83('0xb')](_0x2022ff,_0x3b83('0x8'));var _0x44a93b=['queue',_0x3b83('0xc')];var _0x419161=[];var _0x28c71f=[];for(var _0x1ef54f in _0xf5f3ad){if(_0xf5f3ad['hasOwnProperty'](_0x1ef54f)){_0x3efe7d[_0x3b83('0xd')]=0x2;_0x3efe7d[_0x3b83('0xe')]=[];_0x3efe7d[_0x3b83('0xf')]=_['find'](_0x2b2f56,{'exten':_0xf5f3ad[_0x1ef54f][0x0]['exten']});_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':util[_0x3b83('0x13')](_0x3b83('0x14'),_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')]),'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});if(_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')]==='inbound'){_0x3efe7d['extensions'][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':'Set','appdata':'CDR(routeid)='+_0xf5f3ad[_0x1ef54f][0x0]['VoiceExtensionId'],'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});}else if(_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')]===_0x3b83('0x17')){if(_0x3efe7d['extension']){_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':_0x3b83('0x18')+(_0x3efe7d[_0x3b83('0xf')][_0x3b83('0x19')]?'${EXTEN:'+_0x3efe7d[_0x3b83('0xf')][_0x3b83('0x19')]+'}':_0x3b83('0x1a')),'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});}_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0]['type'],'app':'Set','appdata':_0x3b83('0x1b')+_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')],'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});var _0x3bffb3=_0x3efe7d[_0x3b83('0xd')]++;_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x1c'),'appdata':_0x3b83('0x1d')+(_0x3bffb3+0x2)+'):Goto('+(_0x3bffb3+0x1)+')','context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3bffb3,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});if(_0x3efe7d[_0x3b83('0xf')]){_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':_0x3efe7d[_0x3b83('0xf')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x3efe7d[_0x3b83('0xf')][_0x3b83('0x19')]+'}':_0x3b83('0x1e'),'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0]['exten'],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});}_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':_0x3b83('0x1f')+_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')],'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0]['exten'],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});if(_0x3efe7d[_0x3b83('0xf')]&&_0x3efe7d[_0x3b83('0xf')]['hasOwnProperty'](_0x3b83('0x20'))&&_0x3efe7d[_0x3b83('0xf')][_0x3b83('0x20')]!=='none'){_0x3efe7d['extensions'][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':_0x3b83('0x21'),'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3efe7d[_0x3b83('0xf')][_0x3b83('0x20')]||_0x3b83('0x22'),'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d['priority']++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});}}_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0]['VoiceExtensionId']});_0x3efe7d[_0x3b83('0xe')][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xf5f3ad[_0x1ef54f][0x0]['context'],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});_0x3efe7d['extensions'][_0x3b83('0x10')]({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':_0x3b83('0x23'),'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'priority':_0x3efe7d[_0x3b83('0xd')]++,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0]['VoiceExtensionId']});for(var _0xd45fd0=0x0,_0x26822b=0x0;_0xd45fd0<_0xf5f3ad[_0x1ef54f]['length'];_0xd45fd0+=0x1,_0x26822b=0x0){var _0x58f450=_0xf5f3ad[_0x1ef54f][_0xd45fd0];if(_0x58f450[_0x3b83('0x11')]){_0x58f450[_0x3b83('0x11')]=_0x58f450[_0x3b83('0x11')]['toLowerCase']();}var _0x2e92f8=[];var _0x2c8a0c=[];delete _0x58f450['id'];delete _0x58f450['createdAt'];delete _0x58f450[_0x3b83('0x24')];var _0x5761a3=_0x58f450[_0x3b83('0x25')]!==_0x3b83('0x26')?[_0x58f450[_0x3b83('0x25')]]:_0x58f450[_0x3b83('0x27')]?_[_0x3b83('0x7')](_['filter'](_0x3efe7d[_0x3b83('0x3')],{'IntervalId':_0x58f450['IntervalId']}),_0x3b83('0x25')):[];if(_0x58f450[_0x3b83('0x28')](_0x3b83('0x29'))){if(_0x58f450[_0x3b83('0x29')]&&_0x58f450['tag']!=='--'){_0x2e92f8['push']({'type':_0x58f450[_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':_0x3b83('0x2a')+_0x58f450[_0x3b83('0x29')],'context':_0x58f450[_0x3b83('0x15')],'exten':_0x58f450[_0x3b83('0x8')],'priority':_0x5761a3[_0x3b83('0x2b')]+_0x3efe7d[_0x3b83('0xd')]+_0x26822b++,'VoiceExtensionId':_0x58f450[_0x3b83('0x16')]});}}if(_0x58f450[_0x3b83('0x11')]===_0x3b83('0x17')&&_0x58f450[_0x3b83('0x28')](_0x3b83('0x2c'))){if(_0x58f450[_0x3b83('0x2c')]){_0x2e92f8[_0x3b83('0x10')]({'type':_0x58f450[_0x3b83('0x11')],'app':_0x3b83('0x1c'),'appdata':_0x3b83('0x2d')+_0x58f450['callerID']+')','context':_0x58f450['context'],'exten':_0x58f450[_0x3b83('0x8')],'priority':_0x5761a3['length']+_0x3efe7d['priority']+_0x26822b++,'VoiceExtensionId':_0x58f450[_0x3b83('0x16')]});}else{_0x2e92f8[_0x3b83('0x10')]({'type':_0x58f450[_0x3b83('0x11')],'app':_0x3b83('0x1c'),'appdata':_0x3b83('0x2e'),'context':_0x58f450[_0x3b83('0x15')],'exten':_0x58f450['exten'],'priority':_0x5761a3[_0x3b83('0x2b')]+_0x3efe7d['priority']+_0x26822b++,'VoiceExtensionId':_0x58f450[_0x3b83('0x16')]});}}if(_0x58f450[_0x3b83('0x28')](_0x3b83('0x2f'))){if(_0x44a93b['indexOf'](_0x58f450['app']['toLowerCase']())>=0x0&&_0x58f450[_0x3b83('0x30')]!==_0x3b83('0x31')){if(_0x58f450[_0x3b83('0x2f')]){_0x2e92f8['push']({'type':_0x58f450[_0x3b83('0x11')],'app':_0x3b83('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x58f450[_0x3b83('0x15')],'exten':_0x58f450[_0x3b83('0x8')],'priority':_0x5761a3[_0x3b83('0x2b')]+_0x3efe7d[_0x3b83('0xd')]+_0x26822b++,'VoiceExtensionId':_0x58f450['VoiceExtensionId']});_0x2e92f8[_0x3b83('0x10')]({'type':_0x58f450[_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x58f450[_0x3b83('0x15')],'exten':_0x58f450[_0x3b83('0x8')],'priority':_0x5761a3[_0x3b83('0x2b')]+_0x3efe7d['priority']+_0x26822b++,'VoiceExtensionId':_0x58f450['VoiceExtensionId']});}else{_0x2e92f8[_0x3b83('0x10')]({'type':_0x58f450['type'],'app':'ExecIf','appdata':_0x3b83('0x32'),'context':_0x58f450['context'],'exten':_0x58f450['exten'],'priority':_0x5761a3[_0x3b83('0x2b')]+_0x3efe7d[_0x3b83('0xd')]+_0x26822b++,'VoiceExtensionId':_0x58f450['VoiceExtensionId']});_0x2e92f8[_0x3b83('0x10')]({'type':_0x58f450[_0x3b83('0x11')],'app':_0x3b83('0x12'),'appdata':_0x3b83('0x33'),'context':_0x58f450[_0x3b83('0x15')],'exten':_0x58f450[_0x3b83('0x8')],'priority':_0x5761a3[_0x3b83('0x2b')]+_0x3efe7d[_0x3b83('0xd')]+_0x26822b++,'VoiceExtensionId':_0x58f450[_0x3b83('0x16')]});}}}for(var _0x21b117=0x0;_0x21b117<_0x5761a3[_0x3b83('0x2b')];_0x21b117+=0x1){var _0x6689ac=_0x3efe7d[_0x3b83('0xd')]+_0x5761a3[_0x3b83('0x2b')];var _0x5270f7=_0x21b117===_0x5761a3[_0x3b83('0x2b')]-0x1?_0x3efe7d[_0x3b83('0xd')]+_0x2e92f8[_0x3b83('0x2b')]+_0x2c8a0c[_0x3b83('0x2b')]+0x2:_0x3efe7d[_0x3b83('0xd')]+_0x21b117+0x1;_0x2e92f8[_0x3b83('0x34')](_0x21b117,0x0,{'type':_0x58f450['type'],'app':_0x3b83('0x35'),'appdata':_0x5761a3[_0x21b117]+'?'+_0x58f450['context']+_0x3b83('0x36')+_0x6689ac+':'+_0x58f450[_0x3b83('0x15')]+_0x3b83('0x36')+_0x5270f7,'exten':_0x58f450[_0x3b83('0x8')],'context':_0x58f450[_0x3b83('0x15')],'priority':_0x3efe7d[_0x3b83('0xd')]+_0x21b117,'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x16')]});}_0x58f450[_0x3b83('0xd')]=_0x2e92f8[_0x3b83('0x2b')]?_['last'](_0x2e92f8)['priority']+0x1:_0x3efe7d['priority'];_0x3efe7d[_0x3b83('0xd')]=(_0x2c8a0c[_0x3b83('0x2b')]?_['last'](_0x2c8a0c)[_0x3b83('0xd')]:_0x58f450[_0x3b83('0xd')])+0x1;_0x3efe7d[_0x3b83('0xe')]=_[_0x3b83('0x37')](_0x3efe7d[_0x3b83('0xe')],_0x2e92f8,[_0x58f450],_0x2c8a0c);}_0x3efe7d[_0x3b83('0xe')]['push']({'type':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x11')],'app':'Hangup','exten':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x8')],'context':_0xf5f3ad[_0x1ef54f][0x0][_0x3b83('0x15')],'priority':_0x3efe7d[_0x3b83('0xd')],'VoiceExtensionId':_0xf5f3ad[_0x1ef54f][0x0]['VoiceExtensionId']});_0x419161[_0x3b83('0x10')](_0xf5f3ad[_0x1ef54f][0x0]['VoiceExtensionId']);_0x28c71f=_[_0x3b83('0x37')](_0x28c71f,_0x3efe7d[_0x3b83('0xe')]);}}return _0x23ed52[_0x3b83('0x38')](function(_0x571dc8){return _0x23ed52['models'][_0x3b83('0x6')][_0x3b83('0x39')]({'where':{'VoiceExtensionId':{'$in':_0x419161}},'transaction':_0x571dc8})['then'](function(_0x2fb5ed){return _0x23ed52['models']['VoiceExtension'][_0x3b83('0x3a')](_[_0x3b83('0x3b')](_0x28c71f,_0x3b83('0xd')),{'transaction':_0x571dc8});});});})[_0x3b83('0x3c')](function(_0x236e61){console[_0x3b83('0x3d')](_0x236e61);});}exports[_0x3b83('0x3e')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d059172..99fbfc4 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 _0xa093=['all','VoiceQueue','findAll','BlackLists','Campaign','Lists','always','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','bluebird','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','from','str','calleridnum','cm_hopper_final','into','id\x20IN\x20?','outbound','dialCheckDuplicateType','CmList','then','get','sequelize','query','onlyIfOpen','VoiceQueueId'];(function(_0x4fa563,_0xefd12f){var _0x4566f2=function(_0x1f9ea5){while(--_0x1f9ea5){_0x4fa563['push'](_0x4fa563['shift']());}};_0x4566f2(++_0xefd12f);}(_0xa093,0xec));var _0x3a09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa093[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x3a09('0x0'));var util=require('util');var _=require(_0x3a09('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x3a09('0x2'));var Redis=require(_0x3a09('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x3a09('0x4'));var logger=require(_0x3a09('0x5'))(_0x3a09('0x6'));config['redis']=_[_0x3a09('0x7')](config[_0x3a09('0x8')],{'host':_0x3a09('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3a09('0xa'))['register'](socket);try{if(!process[_0x3a09('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x3a09('0xb')][0x2]===_0x3a09('0xc')){throw new Error(_0x3a09('0xd'));}var FILEPATH=process[_0x3a09('0xb')][0x2];if(!process[_0x3a09('0xb')][0x3]||process[_0x3a09('0xb')][0x3]===_0x3a09('0xe')||process[_0x3a09('0xb')][0x3]===_0x3a09('0xc')||!process[_0x3a09('0xb')][0x4]||process[_0x3a09('0xb')][0x4]===_0x3a09('0xe')||process[_0x3a09('0xb')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x3a09('0xf')](process[_0x3a09('0xb')][0x3][_0x3a09('0x10')](','),process[_0x3a09('0xb')][0x4][_0x3a09('0x10')](','));if(!process[_0x3a09('0xb')][0x5]||process['argv'][0x5]==='undefined'||process[_0x3a09('0xb')][0x5]==='null'){throw new Error(_0x3a09('0x11'));}var LISTID=process[_0x3a09('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x3a09('0xe')&&process[_0x3a09('0xb')][0x6]!==_0x3a09('0xc')?process[_0x3a09('0xb')][0x6]:null;var DUPLICATES=process[_0x3a09('0xb')][0x7]&&process['argv'][0x7]!==_0x3a09('0xe')&&process[_0x3a09('0xb')][0x7]!==_0x3a09('0xc')?process[_0x3a09('0xb')][0x7]:null;if(!process[_0x3a09('0xb')][0x8]||process[_0x3a09('0xb')][0x8]===_0x3a09('0xe')||process[_0x3a09('0xb')][0x8]===_0x3a09('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3a09('0xb')][0x8];}catch(_0x420de8){logger[_0x3a09('0x12')](_0x420de8);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(_0x574170,_0x47df10,_0x3bd22f,_0x5a21bb){var _0x23382b={'message':_0x47df10};_0x23382b[_0x574170]=!![];if(_0x3bd22f){_0x23382b[_0x3a09('0x13')]=_0x3bd22f;}if(_0x5a21bb){_0x23382b[_0x3a09('0x14')]=_0x5a21bb;}return _0x23382b;}function isEmail(_0x4605f1){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))*$/[_0x3a09('0x15')](_0x4605f1);}function checkRow(_0x1e97bb,_0x482082,_0x1f4424){return new BPromise(function(_0x29b275,_0x1620ad){if(_['isNil'](_0x1e97bb)){return _0x1620ad(handleCheckRowError(_0x3a09('0x12'),_0x3a09('0x16'),null,_0x1f4424));}if(_0x1e97bb[_0x3a09('0x17')]&&_0x1e97bb[_0x3a09('0x17')][_0x3a09('0x18')]){var _0x56c01e=_['map'](_0x1e97bb[_0x3a09('0x17')],_0x3a09('0x19'))['join'](';');return _0x1620ad(handleCheckRowError(_0x3a09('0x12'),_0x56c01e,null,_0x1f4424));}var _0x55943a={};for(var _0x30ff58 in FIELDS){if(FIELDS[_0x3a09('0x1a')](_0x30ff58)&&FIELDS[_0x30ff58]){_0x55943a[_0x30ff58]=_0x1e97bb[_0x3a09('0x1b')][0x0][FIELDS[_0x30ff58]]||_0x1e97bb['data'][0x0]['\ufeff'+FIELDS[_0x30ff58]];}}if(!_0x55943a['firstName']){return _0x1620ad(handleCheckRowError(_0x3a09('0x12'),_0x3a09('0x1c'),null,_0x1f4424));}if(!_0x55943a[_0x3a09('0x1d')]){return _0x1620ad(handleCheckRowError(_0x3a09('0x12'),_0x3a09('0x1e'),null,_0x1f4424));}if(_0x55943a[_0x3a09('0x1f')]){var _0x4d5f65=moment(_0x55943a['birthDate'],_0x3a09('0x20'));if(!_0x4d5f65[_0x3a09('0x21')]()){return _0x1620ad(handleCheckRowError(_0x3a09('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x1f4424));}}if(_0x55943a[_0x3a09('0x22')]){if(!isEmail(_0x55943a[_0x3a09('0x22')])){return _0x1620ad(handleCheckRowError(_0x3a09('0x12'),_0x3a09('0x23'),null,_0x1f4424));}}_0x55943a[_0x3a09('0x24')]=LISTID;_0x55943a[_0x3a09('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x482082){var _0x2239a9={};for(var _0xb2bf2a=0x0,_0x3ac997=DUPLICATES[_0x3a09('0x18')];_0xb2bf2a<_0x3ac997;_0xb2bf2a+=0x1){_0x2239a9[DUPLICATES[_0xb2bf2a]]=_0x55943a[DUPLICATES[_0xb2bf2a]];}var _0x21bfee=_[_0x3a09('0x26')](_0x482082,_0x2239a9);if(_0x21bfee){return _0x1620ad(handleCheckRowError(_0x3a09('0x27'),'Duplicate\x20Contact',_0x21bfee,_0x1f4424));}}return db[_0x3a09('0x28')][_0x3a09('0x29')](_0x55943a,{'raw':!![],'hooks':![],'fields':_['keys'](_0x55943a)})['then'](function(_0x3f6c60){if(DUPLICATES&&DUPLICATES['length']&&_0x482082){_0x482082[_0x3a09('0x2a')](_[_0x3a09('0x2b')](_0x55943a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3f6c60['id'];return _0x29b275();})[_0x3a09('0x2c')](function(_0xa9ade0){return _0x1620ad(handleCheckRowError('error',_0x3a09('0x2d')+(_0xa9ade0[_0x3a09('0x19')]||JSON['stringify'](_0xa9ade0)),null,_0x1f4424));});});}function checkHopper(){function _0x2433a5(){return function(_0x1e5c60){logger[_0x3a09('0x12')](_0x3a09('0x2e'),_0x3a09('0x2f'),util[_0x3a09('0x30')](_0x1e5c60,{'showHidden':![],'depth':null}));};}var _0x124804=function(_0x1f1a45,_0x56b14f){var _0xc2d738=squel[_0x3a09('0x31')]()['into'](_0x3a09('0x32'))[_0x3a09('0x33')]([_0x3a09('0x1d'),_0x3a09('0x34'),_0x3a09('0x35'),_0x3a09('0x24'),_0x56b14f,_0x3a09('0x36'),_0x3a09('0x37')],squel[_0x3a09('0x38')]()[_0x3a09('0x39')](_0x3a09('0x1d'),_0x3a09('0x1d'))[_0x3a09('0x39')](_0x3a09('0x3a'),_0x3a09('0x34'))['field']('id','ContactId')['field'](LISTID[_0x3a09('0x3b')](),'ListId')[_0x3a09('0x39')](_0x1f1a45['id'][_0x3a09('0x3b')](),_0x56b14f)[_0x3a09('0x39')](_0x3a09('0x3a'),_0x3a09('0x36'))[_0x3a09('0x39')](_0x3a09('0x3a'),_0x3a09('0x37'))['from'](_0x3a09('0x3c'))[_0x3a09('0x3d')](_0x3a09('0x3e'))[_0x3a09('0x3d')](_0x3a09('0x3f'),LISTID[_0x3a09('0x3b')]())[_0x3a09('0x3d')](_0x3a09('0x40'))[_0x3a09('0x3d')](_0x3a09('0x41'),squel[_0x3a09('0x38')]()['field'](_0x3a09('0x1d'))['from']('cm_hopper')[_0x3a09('0x3d')](_0x56b14f+_0x3a09('0x42'),_0x1f1a45['id'][_0x3a09('0x3b')]())))[_0x3a09('0x3b')]();return _0xc2d738;};var _0x32b5c6=function(_0x32f99c,_0x14a01d){var _0x1bdd9e=squel['insert']()['into'](_0x3a09('0x32'))[_0x3a09('0x33')]([_0x3a09('0x1d'),_0x3a09('0x34'),_0x3a09('0x35'),_0x3a09('0x24'),_0x14a01d,_0x3a09('0x36'),_0x3a09('0x37')],squel[_0x3a09('0x38')]()['field']('phone',_0x3a09('0x1d'))['field'](_0x3a09('0x3a'),_0x3a09('0x34'))[_0x3a09('0x39')]('id',_0x3a09('0x35'))[_0x3a09('0x39')](LISTID['toString'](),_0x3a09('0x24'))[_0x3a09('0x39')](_0x32f99c['id']['toString'](),_0x14a01d)['field'](_0x3a09('0x3a'),_0x3a09('0x36'))[_0x3a09('0x39')](_0x3a09('0x3a'),_0x3a09('0x37'))[_0x3a09('0x43')](_0x3a09('0x3c'))[_0x3a09('0x3d')]('deletedAt\x20IS\x20NULL')[_0x3a09('0x3d')](_0x3a09('0x3f'),LISTID['toString']())[_0x3a09('0x3d')]('id\x20IN\x20?',squel[_0x3a09('0x44')](hopperContacts))['where'](_0x3a09('0x40'))[_0x3a09('0x3d')](_0x3a09('0x41'),squel[_0x3a09('0x38')]()[_0x3a09('0x39')](_0x3a09('0x45'))[_0x3a09('0x43')](_0x3a09('0x46'))['where'](_0x14a01d+_0x3a09('0x42'),_0x32f99c['id'][_0x3a09('0x3b')]()))['where'](_0x3a09('0x41'),squel[_0x3a09('0x38')]()['field'](_0x3a09('0x1d'))['from'](_0x3a09('0x32'))[_0x3a09('0x3d')](_0x14a01d+'\x20=\x20?',_0x32f99c['id'][_0x3a09('0x3b')]())))[_0x3a09('0x3b')]();return _0x1bdd9e;};function _0x1f0714(_0x4237cb,_0x25a6fd){var _0xb0f76b=squel[_0x3a09('0x31')]()[_0x3a09('0x47')](_0x3a09('0x32'))[_0x3a09('0x33')]([_0x3a09('0x1d'),'scheduledAt','ContactId',_0x3a09('0x24'),_0x25a6fd,_0x3a09('0x36'),_0x3a09('0x37')],squel[_0x3a09('0x38')]()[_0x3a09('0x39')](_0x3a09('0x1d'),_0x3a09('0x1d'))[_0x3a09('0x39')](_0x3a09('0x3a'),'scheduledAt')[_0x3a09('0x39')]('id','ContactId')[_0x3a09('0x39')](LISTID['toString'](),'ListId')['field'](_0x4237cb['id'][_0x3a09('0x3b')](),_0x25a6fd)[_0x3a09('0x39')](_0x3a09('0x3a'),_0x3a09('0x36'))[_0x3a09('0x39')](_0x3a09('0x3a'),_0x3a09('0x37'))[_0x3a09('0x43')](_0x3a09('0x3c'))[_0x3a09('0x3d')](_0x3a09('0x3e'))[_0x3a09('0x3d')](_0x3a09('0x3f'),LISTID[_0x3a09('0x3b')]())[_0x3a09('0x3d')](_0x3a09('0x48'),squel['str'](hopperContacts))[_0x3a09('0x3d')](_0x3a09('0x40')))[_0x3a09('0x3b')]();return _0xb0f76b;}function _0x37e3a6(_0x2bcf17,_0xf65cdc){var _0x78085d=squel[_0x3a09('0x31')]()[_0x3a09('0x47')]('cm_hopper_black')[_0x3a09('0x33')]([_0x3a09('0x1d'),_0x3a09('0x35'),_0x3a09('0x24'),_0xf65cdc,_0x3a09('0x36'),_0x3a09('0x37')],squel[_0x3a09('0x38')]()[_0x3a09('0x39')]('phone','phone')[_0x3a09('0x39')]('id','ContactId')[_0x3a09('0x39')](LISTID[_0x3a09('0x3b')](),_0x3a09('0x24'))[_0x3a09('0x39')](_0x2bcf17['id']['toString'](),_0xf65cdc)[_0x3a09('0x39')](_0x3a09('0x3a'),_0x3a09('0x36'))[_0x3a09('0x39')](_0x3a09('0x3a'),'updatedAt')[_0x3a09('0x43')](_0x3a09('0x3c'))[_0x3a09('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x3a09('0x3b')]())[_0x3a09('0x3d')](_0x3a09('0x48'),squel['str'](hopperContacts))[_0x3a09('0x3d')](_0x3a09('0x40')))[_0x3a09('0x3b')]();return _0x78085d;}return db['VoiceQueue']['findAll']({'where':{'type':_0x3a09('0x49')},'attributes':['id',_0x3a09('0x4a')],'include':[{'model':db[_0x3a09('0x4b')],'as':'Lists','where':{'id':LISTID}}]})[_0x3a09('0x4c')](function(_0x46dfb9){var _0x2fdf3d=[];if(_0x46dfb9){var _0xbe124e;for(var _0x133e17=0x0,_0x232742;_0x133e17<_0x46dfb9[_0x3a09('0x18')];_0x133e17+=0x1){_0x232742=_0x46dfb9[_0x133e17][_0x3a09('0x4d')]({'plain':!![]});switch(_0x232742[_0x3a09('0x4a')]){case'always':_0x2fdf3d[_0x3a09('0x2a')](db[_0x3a09('0x4e')][_0x3a09('0x4f')](_0x32b5c6(_0x232742,'VoiceQueueId'))[_0x3a09('0x4c')](function(){})[_0x3a09('0x2c')](_0x2433a5()));break;case _0x3a09('0x50'):_0x2fdf3d[_0x3a09('0x2a')](db[_0x3a09('0x4e')][_0x3a09('0x4f')](_0x124804(_0x232742,_0x3a09('0x51')))[_0x3a09('0x4c')](function(){})['catch'](_0x2433a5()));break;default:_0x2fdf3d[_0x3a09('0x2a')](db[_0x3a09('0x4e')][_0x3a09('0x4f')](_0x1f0714(_0x232742,_0x3a09('0x51')))[_0x3a09('0x4c')](function(){})[_0x3a09('0x2c')](_0x2433a5()));}}}return _0x2fdf3d;})[_0x3a09('0x52')]()[_0x3a09('0x4c')](function(){return db[_0x3a09('0x53')][_0x3a09('0x54')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x3a09('0x4b')],'as':_0x3a09('0x55'),'where':{'id':LISTID}}]})[_0x3a09('0x4c')](function(_0x4d6c5f){var _0x4b79f1=[];if(_0x4d6c5f){var _0x5cde43;for(var _0x2445e0=0x0,_0x5f44e3;_0x2445e0<_0x4d6c5f[_0x3a09('0x18')];_0x2445e0+=0x1){_0x5f44e3=_0x4d6c5f[_0x2445e0][_0x3a09('0x4d')]({'plain':!![]});_0x4b79f1['push'](db['sequelize']['query'](_0x37e3a6(_0x5f44e3,_0x3a09('0x51')))[_0x3a09('0x4c')](function(){})[_0x3a09('0x2c')](_0x2433a5()));}}return _0x4b79f1;})[_0x3a09('0x52')]();})[_0x3a09('0x4c')](function(){return db[_0x3a09('0x56')][_0x3a09('0x54')]({'attributes':['id',_0x3a09('0x4a')],'include':[{'model':db[_0x3a09('0x4b')],'as':_0x3a09('0x57'),'where':{'id':LISTID}}]})[_0x3a09('0x4c')](function(_0x5c5827){var _0x144c48=[];if(_0x5c5827){for(var _0x30c86=0x0,_0x4f6e70;_0x30c86<_0x5c5827[_0x3a09('0x18')];_0x30c86+=0x1){_0x4f6e70=_0x5c5827[_0x30c86]['get']({'plain':!![]});switch(_0x4f6e70[_0x3a09('0x4a')]){case _0x3a09('0x58'):_0x144c48['push'](db[_0x3a09('0x4e')][_0x3a09('0x4f')](_0x32b5c6(_0x4f6e70,'CampaignId'))['then'](function(){})[_0x3a09('0x2c')](_0x2433a5()));break;case _0x3a09('0x50'):_0x144c48[_0x3a09('0x2a')](db[_0x3a09('0x4e')][_0x3a09('0x4f')](_0x124804(_0x4f6e70,'CampaignId'))[_0x3a09('0x4c')](function(){})[_0x3a09('0x2c')](_0x2433a5()));break;default:_0x144c48['push'](db[_0x3a09('0x4e')][_0x3a09('0x4f')](_0x1f0714(_0x4f6e70,_0x3a09('0x59')))[_0x3a09('0x4c')](function(){})[_0x3a09('0x2c')](_0x2433a5()));}}}return _0x144c48;})[_0x3a09('0x52')]();})[_0x3a09('0x4c')](function(){return db[_0x3a09('0x56')][_0x3a09('0x54')]({'attributes':['id'],'include':[{'model':db[_0x3a09('0x4b')],'as':_0x3a09('0x55'),'where':{'id':LISTID}}]})[_0x3a09('0x4c')](function(_0x3b5fa4){var _0x4018e5=[];if(_0x3b5fa4){for(var _0x387d52=0x0,_0x59a696;_0x387d52<_0x3b5fa4['length'];_0x387d52+=0x1){_0x59a696=_0x3b5fa4[_0x387d52][_0x3a09('0x4d')]({'plain':!![]});_0x4018e5[_0x3a09('0x2a')](db[_0x3a09('0x4e')][_0x3a09('0x4f')](_0x37e3a6(_0x59a696,_0x3a09('0x59')))[_0x3a09('0x4c')](function(){})[_0x3a09('0x2c')](_0x2433a5()));}}return _0x4018e5;})['all']();})['catch'](function(_0x591ab0){logger[_0x3a09('0x12')](_0x3a09('0x5a'),'generalCheckHopper',_0x591ab0['message']);});}var processPromises=function(_0x1eb440){return BPromise[_0x3a09('0x52')](promises)[_0x3a09('0x4c')](function(_0x37a6de){})[_0x3a09('0x2c')](function(_0x152b43){logger[_0x3a09('0x12')](_0x3a09('0x5b'),JSON[_0x3a09('0x5c')](_0x152b43));})[_0x3a09('0x5d')](function(){socket[_0x3a09('0x5e')](_0x3a09('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1eb440){return _0x1eb440['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x3a09('0x4c')](function(){if(hopperContacts){return checkHopper();}})[_0x3a09('0x4c')](function(){socket[_0x3a09('0x5e')](_0x3a09('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3a09('0x60')](FILEPATH);}catch(_0x2cc850){logger[_0x3a09('0x12')](_0x3a09('0x61'),JSON[_0x3a09('0x5c')](_0x2cc850));}finally{process[_0x3a09('0x62')](0x0);}});};process['on'](_0x3a09('0x63'),function(){logger[_0x3a09('0x64')](_0x3a09('0x65'));endCsv();});function main(){return BPromise[_0x3a09('0x66')]()[_0x3a09('0x4c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3a09('0x10')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3a09('0x4c')](function(_0x58d2e7){var _0x53829a=fs[_0x3a09('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3a09('0x68')](_0x53829a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x57b90d,_0x108498){total+=0x1;var _0x4fc66b=total;promises[_0x3a09('0x2a')](checkRow(_0x57b90d,_0x58d2e7,_0x4fc66b)[_0x3a09('0x4c')](function(){success+=0x1;})[_0x3a09('0x2c')](function(_0x23a229){if(_0x23a229['error']){errors+=0x1;delete _0x23a229[_0x3a09('0x12')];}else if(_0x23a229[_0x3a09('0x27')]){duplicates+=0x1;delete _0x23a229[_0x3a09('0x27')];}rows[_0x3a09('0x2a')](_0x23a229);}));if(total%0xc8===0x0){_0x108498[_0x3a09('0x69')]();return processPromises(_0x108498);}},'complete':function(){return processPromises()[_0x3a09('0x4c')](function(){logger[_0x3a09('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x49aaa9,_0x5c171c){logger[_0x3a09('0x64')]('CSV\x20parse\x20error',JSON['stringify'](_0x49aaa9));endCsv();}});})['catch'](function(_0x3b06c4){logger[_0x3a09('0x12')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x3b06c4));});}main(); \ No newline at end of file +var _0x842a=['BlackLists','get','query','Campaign','CampaignId','emit','contact:csv_','resume','resolve','exit','SIGINT','info','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','../../../mysqldb','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','map','errors','join','hasOwnProperty','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','length','Duplicate\x20Contact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','fromQuery','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','Lists','always','sequelize','VoiceQueueId','then','onlyIfOpen','all','outbound','CmList'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x842a,0xdb));var _0xa842=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x842a[_0x2ff739];return _0x12dc13;};'use strict';var BPromise=require(_0xa842('0x0'));var util=require(_0xa842('0x1'));var _=require(_0xa842('0x2'));var fs=require('fs');var squel=require(_0xa842('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xa842('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xa842('0x5'));config[_0xa842('0x6')]=_['defaults'](config[_0xa842('0x6')],{'host':_0xa842('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa842('0x6')]));require(_0xa842('0x8'))[_0xa842('0x9')](socket);try{if(!process['argv'][0x2]||process[_0xa842('0xa')][0x2]===_0xa842('0xb')||process[_0xa842('0xa')][0x2]===_0xa842('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0xa842('0xa')][0x3]||process['argv'][0x3]==='undefined'||process[_0xa842('0xa')][0x3]===_0xa842('0xc')||!process[_0xa842('0xa')][0x4]||process['argv'][0x4]===_0xa842('0xb')||process[_0xa842('0xa')][0x4]===_0xa842('0xc')){throw new Error(_0xa842('0xd'));}var FIELDS=_[_0xa842('0xe')](process['argv'][0x3][_0xa842('0xf')](','),process[_0xa842('0xa')][0x4][_0xa842('0xf')](','));if(!process[_0xa842('0xa')][0x5]||process[_0xa842('0xa')][0x5]===_0xa842('0xb')||process[_0xa842('0xa')][0x5]==='null'){throw new Error(_0xa842('0x10'));}var LISTID=process[_0xa842('0xa')][0x5];var COMPANYID=process[_0xa842('0xa')][0x6]&&process[_0xa842('0xa')][0x6]!=='undefined'&&process[_0xa842('0xa')][0x6]!==_0xa842('0xc')?process[_0xa842('0xa')][0x6]:null;var DUPLICATES=process[_0xa842('0xa')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xa842('0xa')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0xa842('0xa')][0x8]||process[_0xa842('0xa')][0x8]===_0xa842('0xb')||process[_0xa842('0xa')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xa842('0xa')][0x8];}catch(_0x18625c){logger[_0xa842('0x11')](_0x18625c);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(_0x1c35d7,_0x500c1c,_0x2eb460,_0x155dd4){var _0x4268ea={'message':_0x500c1c};_0x4268ea[_0x1c35d7]=!![];if(_0x2eb460){_0x4268ea[_0xa842('0x12')]=_0x2eb460;}if(_0x155dd4){_0x4268ea[_0xa842('0x13')]=_0x155dd4;}return _0x4268ea;}function isEmail(_0x596bf4){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))*$/[_0xa842('0x14')](_0x596bf4);}function checkRow(_0x176dd3,_0x22af01,_0xafc0b8){return new BPromise(function(_0x5a72fe,_0x1cb8d1){if(_['isNil'](_0x176dd3)){return _0x1cb8d1(handleCheckRowError(_0xa842('0x11'),_0xa842('0x15'),null,_0xafc0b8));}if(_0x176dd3['errors']&&_0x176dd3['errors']['length']){var _0x4c29ca=_[_0xa842('0x16')](_0x176dd3[_0xa842('0x17')],'message')[_0xa842('0x18')](';');return _0x1cb8d1(handleCheckRowError(_0xa842('0x11'),_0x4c29ca,null,_0xafc0b8));}var _0x39c864={};for(var _0x4b7caf in FIELDS){if(FIELDS[_0xa842('0x19')](_0x4b7caf)&&FIELDS[_0x4b7caf]){_0x39c864[_0x4b7caf]=_0x176dd3['data'][0x0][FIELDS[_0x4b7caf]]||_0x176dd3['data'][0x0]['\ufeff'+FIELDS[_0x4b7caf]];}}if(!_0x39c864['firstName']){return _0x1cb8d1(handleCheckRowError('error',_0xa842('0x1a'),null,_0xafc0b8));}if(!_0x39c864['phone']){return _0x1cb8d1(handleCheckRowError(_0xa842('0x11'),_0xa842('0x1b'),null,_0xafc0b8));}if(_0x39c864['birthDate']){var _0x5b90d9=moment(_0x39c864[_0xa842('0x1c')],_0xa842('0x1d'));if(!_0x5b90d9[_0xa842('0x1e')]()){return _0x1cb8d1(handleCheckRowError(_0xa842('0x11'),_0xa842('0x1f'),null,_0xafc0b8));}}if(_0x39c864[_0xa842('0x20')]){if(!isEmail(_0x39c864[_0xa842('0x20')])){return _0x1cb8d1(handleCheckRowError(_0xa842('0x11'),'email\x20format\x20is\x20not\x20valid!',null,_0xafc0b8));}}_0x39c864[_0xa842('0x21')]=LISTID;_0x39c864['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x22af01){var _0x38a573={};for(var _0x1981d6=0x0,_0x3cb978=DUPLICATES[_0xa842('0x22')];_0x1981d6<_0x3cb978;_0x1981d6+=0x1){_0x38a573[DUPLICATES[_0x1981d6]]=_0x39c864[DUPLICATES[_0x1981d6]];}var _0xa51da4=_['find'](_0x22af01,_0x38a573);if(_0xa51da4){return _0x1cb8d1(handleCheckRowError('duplicate',_0xa842('0x23'),_0xa51da4,_0xafc0b8));}}return db['CmContact'][_0xa842('0x24')](_0x39c864,{'raw':!![],'hooks':![],'fields':_[_0xa842('0x25')](_0x39c864)})['then'](function(_0x565de1){if(DUPLICATES&&DUPLICATES[_0xa842('0x22')]&&_0x22af01){_0x22af01[_0xa842('0x26')](_[_0xa842('0x27')](_0x39c864,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x565de1['id'];return _0x5a72fe();})[_0xa842('0x28')](function(_0x3e8aa8){return _0x1cb8d1(handleCheckRowError(_0xa842('0x11'),_0xa842('0x29')+(_0x3e8aa8[_0xa842('0x2a')]||JSON[_0xa842('0x2b')](_0x3e8aa8)),null,_0xafc0b8));});});}function checkHopper(){function _0x47ca2b(){return function(_0xf3a69d){logger[_0xa842('0x11')](_0xa842('0x2c'),_0xa842('0x2d'),util['inspect'](_0xf3a69d,{'showHidden':![],'depth':null}));};}var _0x221e29=function(_0x3c9e3f,_0x4191a2){var _0x32e5ea=squel[_0xa842('0x2e')]()[_0xa842('0x2f')](_0xa842('0x30'))['fromQuery']([_0xa842('0x31'),_0xa842('0x32'),_0xa842('0x33'),_0xa842('0x21'),_0x4191a2,_0xa842('0x34'),_0xa842('0x35')],squel[_0xa842('0x36')]()[_0xa842('0x37')](_0xa842('0x31'),_0xa842('0x31'))[_0xa842('0x37')]('NOW()',_0xa842('0x32'))[_0xa842('0x37')]('id',_0xa842('0x33'))[_0xa842('0x37')](LISTID['toString'](),'ListId')[_0xa842('0x37')](_0x3c9e3f['id'][_0xa842('0x38')](),_0x4191a2)[_0xa842('0x37')](_0xa842('0x39'),'createdAt')[_0xa842('0x37')]('NOW()',_0xa842('0x35'))[_0xa842('0x3a')](_0xa842('0x3b'))[_0xa842('0x3c')](_0xa842('0x3d'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xa842('0x3c')](_0xa842('0x3e'))[_0xa842('0x3c')](_0xa842('0x3f'),squel[_0xa842('0x36')]()[_0xa842('0x37')](_0xa842('0x31'))[_0xa842('0x3a')](_0xa842('0x30'))[_0xa842('0x3c')](_0x4191a2+_0xa842('0x40'),_0x3c9e3f['id'][_0xa842('0x38')]())))['toString']();return _0x32e5ea;};var _0x390190=function(_0x168408,_0x2257be){var _0x22c8ea=squel['insert']()[_0xa842('0x2f')]('cm_hopper')['fromQuery']([_0xa842('0x31'),_0xa842('0x32'),_0xa842('0x33'),_0xa842('0x21'),_0x2257be,_0xa842('0x34'),'updatedAt'],squel[_0xa842('0x36')]()[_0xa842('0x37')](_0xa842('0x31'),_0xa842('0x31'))[_0xa842('0x37')](_0xa842('0x39'),_0xa842('0x32'))[_0xa842('0x37')]('id',_0xa842('0x33'))[_0xa842('0x37')](LISTID[_0xa842('0x38')](),'ListId')[_0xa842('0x37')](_0x168408['id'][_0xa842('0x38')](),_0x2257be)[_0xa842('0x37')](_0xa842('0x39'),'createdAt')[_0xa842('0x37')](_0xa842('0x39'),'updatedAt')[_0xa842('0x3a')](_0xa842('0x3b'))[_0xa842('0x3c')]('deletedAt\x20IS\x20NULL')[_0xa842('0x3c')](_0xa842('0x41'),LISTID[_0xa842('0x38')]())[_0xa842('0x3c')](_0xa842('0x42'),squel[_0xa842('0x43')](hopperContacts))[_0xa842('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa842('0x36')]()[_0xa842('0x37')](_0xa842('0x44'))[_0xa842('0x3a')](_0xa842('0x45'))[_0xa842('0x3c')](_0x2257be+_0xa842('0x40'),_0x168408['id']['toString']()))[_0xa842('0x3c')](_0xa842('0x3f'),squel[_0xa842('0x36')]()[_0xa842('0x37')](_0xa842('0x31'))[_0xa842('0x3a')](_0xa842('0x30'))['where'](_0x2257be+_0xa842('0x40'),_0x168408['id'][_0xa842('0x38')]())))['toString']();return _0x22c8ea;};function _0x515dd4(_0x9e8d8d,_0x1c3915){var _0x3ae4c1=squel[_0xa842('0x2e')]()['into'](_0xa842('0x30'))[_0xa842('0x46')]([_0xa842('0x31'),_0xa842('0x32'),_0xa842('0x33'),_0xa842('0x21'),_0x1c3915,'createdAt',_0xa842('0x35')],squel[_0xa842('0x36')]()[_0xa842('0x37')](_0xa842('0x31'),_0xa842('0x31'))['field']('NOW()',_0xa842('0x32'))[_0xa842('0x37')]('id',_0xa842('0x33'))[_0xa842('0x37')](LISTID[_0xa842('0x38')](),_0xa842('0x21'))[_0xa842('0x37')](_0x9e8d8d['id'][_0xa842('0x38')](),_0x1c3915)[_0xa842('0x37')](_0xa842('0x39'),_0xa842('0x34'))[_0xa842('0x37')](_0xa842('0x39'),_0xa842('0x35'))[_0xa842('0x3a')]('cm_contacts')[_0xa842('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0xa842('0x41'),LISTID[_0xa842('0x38')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xa842('0x3c')](_0xa842('0x3e')))['toString']();return _0x3ae4c1;}function _0x7f2ea9(_0xac7ec8,_0x2e7615){var _0x20b916=squel[_0xa842('0x2e')]()[_0xa842('0x2f')](_0xa842('0x47'))[_0xa842('0x46')]([_0xa842('0x31'),_0xa842('0x33'),_0xa842('0x21'),_0x2e7615,_0xa842('0x34'),'updatedAt'],squel['select']()[_0xa842('0x37')]('phone',_0xa842('0x31'))[_0xa842('0x37')]('id',_0xa842('0x33'))[_0xa842('0x37')](LISTID[_0xa842('0x38')](),_0xa842('0x21'))[_0xa842('0x37')](_0xac7ec8['id'][_0xa842('0x38')](),_0x2e7615)[_0xa842('0x37')](_0xa842('0x39'),_0xa842('0x34'))[_0xa842('0x37')]('NOW()',_0xa842('0x35'))[_0xa842('0x3a')](_0xa842('0x3b'))[_0xa842('0x3c')](_0xa842('0x3d'))[_0xa842('0x3c')](_0xa842('0x41'),LISTID['toString']())[_0xa842('0x3c')](_0xa842('0x42'),squel['str'](hopperContacts))[_0xa842('0x3c')](_0xa842('0x3e')))['toString']();return _0x20b916;}return db[_0xa842('0x48')][_0xa842('0x49')]({'where':{'type':'outbound'},'attributes':['id',_0xa842('0x4a')],'include':[{'model':db['CmList'],'as':_0xa842('0x4b'),'where':{'id':LISTID}}]})['then'](function(_0x2fb47e){var _0x1a71d4=[];if(_0x2fb47e){var _0x4e44b2;for(var _0x1fa4fd=0x0,_0x2fa75b;_0x1fa4fd<_0x2fb47e[_0xa842('0x22')];_0x1fa4fd+=0x1){_0x2fa75b=_0x2fb47e[_0x1fa4fd]['get']({'plain':!![]});switch(_0x2fa75b[_0xa842('0x4a')]){case _0xa842('0x4c'):_0x1a71d4['push'](db[_0xa842('0x4d')]['query'](_0x390190(_0x2fa75b,_0xa842('0x4e')))[_0xa842('0x4f')](function(){})[_0xa842('0x28')](_0x47ca2b()));break;case _0xa842('0x50'):_0x1a71d4['push'](db[_0xa842('0x4d')]['query'](_0x221e29(_0x2fa75b,_0xa842('0x4e')))[_0xa842('0x4f')](function(){})['catch'](_0x47ca2b()));break;default:_0x1a71d4[_0xa842('0x26')](db['sequelize']['query'](_0x515dd4(_0x2fa75b,_0xa842('0x4e')))[_0xa842('0x4f')](function(){})[_0xa842('0x28')](_0x47ca2b()));}}}return _0x1a71d4;})[_0xa842('0x51')]()[_0xa842('0x4f')](function(){return db[_0xa842('0x48')]['findAll']({'where':{'type':_0xa842('0x52')},'attributes':['id'],'include':[{'model':db[_0xa842('0x53')],'as':_0xa842('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x879bee){var _0x49f52d=[];if(_0x879bee){var _0x270ad5;for(var _0x17a0c3=0x0,_0x43e5e2;_0x17a0c3<_0x879bee['length'];_0x17a0c3+=0x1){_0x43e5e2=_0x879bee[_0x17a0c3][_0xa842('0x55')]({'plain':!![]});_0x49f52d[_0xa842('0x26')](db[_0xa842('0x4d')][_0xa842('0x56')](_0x7f2ea9(_0x43e5e2,_0xa842('0x4e')))[_0xa842('0x4f')](function(){})[_0xa842('0x28')](_0x47ca2b()));}}return _0x49f52d;})[_0xa842('0x51')]();})[_0xa842('0x4f')](function(){return db[_0xa842('0x57')][_0xa842('0x49')]({'attributes':['id',_0xa842('0x4a')],'include':[{'model':db[_0xa842('0x53')],'as':_0xa842('0x4b'),'where':{'id':LISTID}}]})[_0xa842('0x4f')](function(_0x5fa3b3){var _0x2fdf93=[];if(_0x5fa3b3){for(var _0xb4bde8=0x0,_0x573eec;_0xb4bde8<_0x5fa3b3[_0xa842('0x22')];_0xb4bde8+=0x1){_0x573eec=_0x5fa3b3[_0xb4bde8][_0xa842('0x55')]({'plain':!![]});switch(_0x573eec['dialCheckDuplicateType']){case'always':_0x2fdf93[_0xa842('0x26')](db[_0xa842('0x4d')][_0xa842('0x56')](_0x390190(_0x573eec,_0xa842('0x58')))[_0xa842('0x4f')](function(){})['catch'](_0x47ca2b()));break;case _0xa842('0x50'):_0x2fdf93[_0xa842('0x26')](db[_0xa842('0x4d')]['query'](_0x221e29(_0x573eec,_0xa842('0x58')))[_0xa842('0x4f')](function(){})[_0xa842('0x28')](_0x47ca2b()));break;default:_0x2fdf93[_0xa842('0x26')](db[_0xa842('0x4d')][_0xa842('0x56')](_0x515dd4(_0x573eec,_0xa842('0x58')))['then'](function(){})['catch'](_0x47ca2b()));}}}return _0x2fdf93;})['all']();})[_0xa842('0x4f')](function(){return db[_0xa842('0x57')][_0xa842('0x49')]({'attributes':['id'],'include':[{'model':db[_0xa842('0x53')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa842('0x4f')](function(_0x4a8f59){var _0x4bbb7e=[];if(_0x4a8f59){for(var _0x35cb0c=0x0,_0x50f942;_0x35cb0c<_0x4a8f59[_0xa842('0x22')];_0x35cb0c+=0x1){_0x50f942=_0x4a8f59[_0x35cb0c][_0xa842('0x55')]({'plain':!![]});_0x4bbb7e[_0xa842('0x26')](db[_0xa842('0x4d')][_0xa842('0x56')](_0x7f2ea9(_0x50f942,_0xa842('0x58')))['then'](function(){})[_0xa842('0x28')](_0x47ca2b()));}}return _0x4bbb7e;})[_0xa842('0x51')]();})[_0xa842('0x28')](function(_0x1d6c07){logger[_0xa842('0x11')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x1d6c07[_0xa842('0x2a')]);});}var processPromises=function(_0x403381){return BPromise[_0xa842('0x51')](promises)[_0xa842('0x4f')](function(_0x5dbc74){})[_0xa842('0x28')](function(_0x3b59a9){logger[_0xa842('0x11')]('Error\x20processing\x20rows\x20block:',JSON[_0xa842('0x2b')](_0x3b59a9));})['finally'](function(){socket[_0xa842('0x59')](_0xa842('0x5a')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x403381){return _0x403381[_0xa842('0x5b')]();}});};var endCsv=function(){return BPromise[_0xa842('0x5c')]()[_0xa842('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0xa842('0x4f')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2c7100){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xa842('0x2b')](_0x2c7100));}finally{process[_0xa842('0x5d')](0x0);}});};process['on'](_0xa842('0x5e'),function(){logger[_0xa842('0x5f')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xa842('0x5c')]()[_0xa842('0x4f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa842('0xf')](',');return db['CmContact'][_0xa842('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa842('0x4f')](function(_0x309a87){var _0x13cc9e=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa842('0x60')](_0x13cc9e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e0115,_0x344975){total+=0x1;var _0x543921=total;promises[_0xa842('0x26')](checkRow(_0x2e0115,_0x309a87,_0x543921)[_0xa842('0x4f')](function(){success+=0x1;})[_0xa842('0x28')](function(_0x499581){if(_0x499581[_0xa842('0x11')]){errors+=0x1;delete _0x499581[_0xa842('0x11')];}else if(_0x499581[_0xa842('0x61')]){duplicates+=0x1;delete _0x499581[_0xa842('0x61')];}rows['push'](_0x499581);}));if(total%0xc8===0x0){_0x344975[_0xa842('0x62')]();return processPromises(_0x344975);}},'complete':function(){return processPromises()[_0xa842('0x4f')](function(){logger[_0xa842('0x5f')](_0xa842('0x63'));endCsv();});},'error':function(_0x4e2d8e,_0x44d04f){logger[_0xa842('0x5f')](_0xa842('0x64'),JSON[_0xa842('0x2b')](_0x4e2d8e));endCsv();}});})[_0xa842('0x28')](function(_0x4ce491){logger[_0xa842('0x11')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x4ce491));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7dbbd33..6b3b354 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 _0xf137=['cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','error','message','exit','code','info','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','keys','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','errors','find','_description','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','emit','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','squel','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','all','then','AdditionalPhones','length','push','split','isNil','filter','CmContactHasItem','findOne','update','create','inserted','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','into','cm_hopper_black','createdAt','cm_contacts','field','\x20=\x20','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item'];(function(_0x1a4cd9,_0x446c90){var _0x444070=function(_0x22aa75){while(--_0x22aa75){_0x1a4cd9['push'](_0x1a4cd9['shift']());}};_0x444070(++_0x446c90);}(_0xf137,0x71));var _0x7f13=function(_0x46753c,_0x1d8501){_0x46753c=_0x46753c-0x0;var _0x5edd01=_0xf137[_0x46753c];return _0x5edd01;};'use strict';var fs=require('fs');var path=require(_0x7f13('0x0'));var _=require(_0x7f13('0x1'));var Papa=require(_0x7f13('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x7f13('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x7f13('0x4'));var shared=require(_0x7f13('0x5'));var logger=require(_0x7f13('0x6'))(_0x7f13('0x7'));config[_0x7f13('0x8')]=_[_0x7f13('0x9')](config[_0x7f13('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f13('0xa'))(new Redis(config[_0x7f13('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7f13('0xb')](_0x7f13('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7f13('0xb')](_0x7f13('0xc'));function isEmail(_0x1a438e){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'](_0x1a438e);}function selectNotIn(_0x2e8baa,_0x39f20f,_0x582f18,_0x16f442,_0x474059){return squel[_0x7f13('0xd')]()['field'](_0x7f13('0xe'))[_0x7f13('0xf')](_0x16f442)[_0x7f13('0x10')](_0x39f20f,null,_0x39f20f+_0x7f13('0x11')+_0x16f442+'.'+_0x582f18)[_0x7f13('0x12')](_0x16f442+'.'+_0x582f18+'\x20=\x20'+_0x2e8baa+'.'+_0x582f18)[_0x7f13('0x12')](_0x39f20f+_0x7f13('0x13')+_0x474059[_0x7f13('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2b4f84,_0x3e0567){promisesAdditionalPhones=[];return db[_0x7f13('0x14')][_0x7f13('0x15')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x532d29){if(_0x532d29!==null){var _0x40dabc=[];for(var _0x231e47=0x0;_0x231e47<_0x532d29['length'];_0x231e47++){var _0x19c4b0=_0x532d29[_0x231e47];_0x40dabc['push'](insertAdditionalPhones(_0x19c4b0));}}Promise[_0x7f13('0x16')](_0x40dabc)[_0x7f13('0x17')](function(){_0x2b4f84({'val':0x1});});});});}function insertAdditionalPhones(_0x4ab002){return new Promise(function(_0x30e736,_0x47d7cd){var _0x10930a=_0x4ab002[_0x7f13('0x18')];var _0x5bd69a=_0x10930a['split'](';');var _0x4a6df5=[];orderBy=0x0;for(var _0x3584f=0x0;_0x3584f<_0x5bd69a[_0x7f13('0x19')];_0x3584f++){_0x4a6df5[_0x7f13('0x1a')](splitAdditionalPhone(_0x4ab002['id'],_0x5bd69a[_0x3584f]));}Promise[_0x7f13('0x16')](_0x4a6df5)[_0x7f13('0x17')](function(){_0x30e736({'val':_0x5bd69a['length']});});});}function splitAdditionalPhone(_0x3b8b5c,_0x4f4eda){return new Promise(function(_0x5c64d2,_0x107a55){var _0x2730d4=_0x4f4eda[_0x7f13('0x1b')](':');var _0x3152e9=_0x2730d4[0x0];var _0xcc5249=_0x2730d4[0x1];if(!_[_0x7f13('0x1c')](_0xcc5249)){var _0xbf0b21=_0xcc5249[_0x7f13('0x1b')]('|');var _0xf68b2c=[];for(var _0x382c31=0x0;_0x382c31<_0xbf0b21[_0x7f13('0x19')];_0x382c31++){if(_0xbf0b21[_0x382c31]!==''){var _0x4061f9=_[_0x7f13('0x1d')](promisesAdditionalPhones,{'contactId':_0x3b8b5c,'phone':_0xbf0b21[_0x382c31]});if(_0x4061f9['length']==0x0){orderBy++;promisesAdditionalPhones[_0x7f13('0x1a')]({'contactId':_0x3b8b5c,'contactTypeId':_0x3152e9,'phone':_0xbf0b21[_0x382c31],'orderBy':orderBy});}}}_0x5c64d2({'ok':0x1});}else _0x5c64d2({'res':0x0});});}function createAdditionalPhone(_0x3c81d5,_0x4a43f2,_0x2131b8,_0x4ba8d6){var _0x44caf3='';var _0x50d860='';var _0x3755f8=_0x2131b8[_0x7f13('0x1b')]('§');_0x44caf3=_0x3755f8[0x0];if(_0x3755f8[_0x7f13('0x19')]==0x2)_0x50d860=_0x3755f8[0x1];return new Promise(function(_0xedb578,_0x1a2a20){return db[_0x7f13('0x1e')][_0x7f13('0x1f')]({'where':{'CmContactId':_0x3c81d5,'item':_0x44caf3}})[_0x7f13('0x17')](function(_0x6d5be3){if(_0x6d5be3){return db[_0x7f13('0x1e')][_0x7f13('0x20')]({'ItemTypeId':_0x4a43f2,'description':_0x50d860,'OrderBy':_0x4ba8d6},{'where':{'CmContactId':_0x3c81d5,'item':_0x44caf3}})[_0x7f13('0x17')](function(_0x567327){_0xedb578({'res':'updated'});});}else{return db[_0x7f13('0x1e')][_0x7f13('0x21')]({'CmContactId':_0x3c81d5,'item':_0x44caf3,'description':_0x50d860,'ItemTypeId':_0x4a43f2,'OrderBy':_0x4ba8d6,'ItemClass':'PHONE'})[_0x7f13('0x17')](function(_0x4cf67b){_0xedb578({'res':_0x7f13('0x22')});});}});});}function insertCmHopper(_0x20d0ab,_0x6b2772,_0x492ab3,_0x1ce4a1,_0x31c3cc){var _0x48a226=['cm_contacts.phone',_0x7f13('0x23'),'cm_contacts.id',_0x7f13('0x24'),_0x6b2772+'.'+_0x1ce4a1,_0x7f13('0x25'),_0x7f13('0x26'),_0x7f13('0x27'),_0x7f13('0x28'),'\x22'+_0x31c3cc+'\x22'];return squel[_0x7f13('0x29')]()['into'](_0x7f13('0x2a'))[_0x7f13('0x2b')](['phone','scheduledat',_0x7f13('0x2c'),_0x7f13('0x2d'),_0x1ce4a1,'createdAt',_0x7f13('0x2e'),_0x7f13('0x2f'),_0x7f13('0x30'),_0x7f13('0x31')],squel[_0x7f13('0xd')]()[_0x7f13('0x32')](_0x48a226)[_0x7f13('0xf')](_0x6b2772)[_0x7f13('0x10')]('cm_contacts',null,_0x7f13('0x33')+_0x6b2772+_0x7f13('0x34'))['join'](_0x492ab3,null,_0x492ab3+_0x7f13('0x11')+_0x6b2772+'.'+_0x1ce4a1)[_0x7f13('0x12')](_0x6b2772+_0x7f13('0x35'),_0x20d0ab)['where'](_0x7f13('0x36'),NOW)[_0x7f13('0x12')](_0x7f13('0x37'),selectNotIn(_0x6b2772,_0x492ab3,_0x1ce4a1,_0x7f13('0x2a'),[_0x7f13('0x38'),_0x7f13('0x39')]))[_0x7f13('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x6b2772,_0x492ab3,_0x1ce4a1,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x314a6b,_0x130149,_0x84165d,_0x116fa2){var _0x6303dc=['cm_contacts.phone',_0x7f13('0x3a'),_0x7f13('0x24'),_0x130149+'.'+_0x116fa2,_0x7f13('0x25'),_0x7f13('0x26')];return squel['insert']()[_0x7f13('0x3b')](_0x7f13('0x3c'))[_0x7f13('0x2b')]([_0x7f13('0xe'),_0x7f13('0x2c'),_0x7f13('0x2d'),_0x116fa2,_0x7f13('0x3d'),'updatedAt'],squel['select']()['fields'](_0x6303dc)[_0x7f13('0xf')](_0x130149)[_0x7f13('0x10')](_0x7f13('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x130149+_0x7f13('0x34'))['join'](_0x84165d,null,_0x84165d+_0x7f13('0x11')+_0x130149+'.'+_0x116fa2)['where'](_0x130149+_0x7f13('0x35'),_0x314a6b)[_0x7f13('0x12')](_0x7f13('0x36'),NOW)[_0x7f13('0x12')](_0x7f13('0x37'),squel[_0x7f13('0xd')]()[_0x7f13('0x3f')](_0x7f13('0xe'))[_0x7f13('0xf')](_0x7f13('0x3c'))['where']('ListId\x20=\x20?',_0x314a6b)['where'](_0x116fa2+_0x7f13('0x40')+_0x130149+'.'+_0x116fa2)))[_0x7f13('0x41')]();}function insertTzCmHopper(_0x3072b0,_0x3eb881,_0x554311,_0x26f2e8,_0x2d58fe,_0x44d033){var _0x4b0703=['cm_contacts.phone',_0x7f13('0x42')+_0x44d033+_0x7f13('0x43'),_0x7f13('0x3a'),'cm_contacts.ListId',_0x3eb881+'.'+_0x26f2e8,_0x7f13('0x25'),_0x7f13('0x26'),_0x7f13('0x27'),'cm_contacts.UserId','\x22'+_0x2d58fe+'\x22'];var _0x26e410=squel['insert']()[_0x7f13('0x3b')](_0x7f13('0x2a'))[_0x7f13('0x2b')]([_0x7f13('0xe'),_0x7f13('0x44'),_0x7f13('0x2c'),_0x7f13('0x2d'),_0x26f2e8,_0x7f13('0x3d'),'updatedAt',_0x7f13('0x2f'),_0x7f13('0x30'),'recallme'],squel[_0x7f13('0xd')]()[_0x7f13('0x32')](_0x4b0703)[_0x7f13('0xf')](_0x3eb881)[_0x7f13('0x10')](_0x7f13('0x3e'),null,_0x7f13('0x33')+_0x3eb881+_0x7f13('0x34'))[_0x7f13('0x10')](_0x554311,null,_0x554311+_0x7f13('0x11')+_0x3eb881+'.'+_0x26f2e8)[_0x7f13('0x10')](_0x44d033,null,_0x44d033+_0x7f13('0x11')+_0x3eb881+'.'+_0x26f2e8)[_0x7f13('0x12')](_0x3eb881+'.CmListId\x20=\x20?',_0x3072b0)['where'](_0x7f13('0x36'),NOW)[_0x7f13('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3eb881,_0x554311,_0x26f2e8,_0x7f13('0x2a'),[_0x7f13('0x38'),'\x22onlyIfOpen\x22']))[_0x7f13('0x12')](_0x7f13('0x37'),selectNotIn(_0x3eb881,_0x554311,_0x26f2e8,_0x7f13('0x2a'),[_0x7f13('0x38')])))[_0x7f13('0x41')]();return _0x26e410;}function insertTzCmHopperBlack(_0x4c4d4,_0x56194d,_0x206845,_0x4b650c){var _0x5db532=['cm_contacts.phone',_0x7f13('0x3a'),_0x7f13('0x24'),_0x56194d+'.'+_0x4b650c,_0x7f13('0x25'),_0x7f13('0x26')];return squel[_0x7f13('0x29')]()['into']('cm_hopper_black')[_0x7f13('0x2b')](['phone',_0x7f13('0x2c'),_0x7f13('0x2d'),_0x4b650c,'createdAt',_0x7f13('0x2e')],squel[_0x7f13('0xd')]()[_0x7f13('0x32')](_0x5db532)[_0x7f13('0xf')](_0x56194d)[_0x7f13('0x10')](_0x7f13('0x3e'),null,_0x7f13('0x33')+_0x56194d+_0x7f13('0x34'))[_0x7f13('0x10')](_0x206845,null,_0x206845+_0x7f13('0x11')+_0x56194d+'.'+_0x4b650c)[_0x7f13('0x12')](_0x56194d+_0x7f13('0x35'),_0x4c4d4)[_0x7f13('0x12')](_0x7f13('0x36'),NOW)[_0x7f13('0x12')](_0x7f13('0x37'),squel[_0x7f13('0xd')]()[_0x7f13('0x3f')](_0x7f13('0xe'))[_0x7f13('0xf')](_0x7f13('0x3c'))[_0x7f13('0x12')](_0x7f13('0x45'),_0x4c4d4)[_0x7f13('0x12')](_0x4b650c+_0x7f13('0x40')+_0x56194d+'.'+_0x4b650c)))[_0x7f13('0x41')]();}function insertCmHopperAdditionalPhones(_0x537d65){var _0x31ee6c=[_0x7f13('0x46'),_0x7f13('0x47'),_0x7f13('0x48'),_0x7f13('0x49'),_0x7f13('0x4a')];return squel[_0x7f13('0x29')]()[_0x7f13('0x3b')](_0x7f13('0x4b'))[_0x7f13('0x2b')](['CmHopperId','phone',_0x7f13('0x4c'),'createdAt',_0x7f13('0x2e')],squel[_0x7f13('0xd')]()[_0x7f13('0x32')](_0x31ee6c)[_0x7f13('0xf')](_0x7f13('0x2a'))[_0x7f13('0x10')](_0x7f13('0x3e'),null,_0x7f13('0x4d'))[_0x7f13('0x10')]('cm_contact_has_items',null,_0x7f13('0x4e'))['where'](_0x7f13('0x4f'),_0x537d65)[_0x7f13('0x12')](_0x7f13('0x36'),NOW))[_0x7f13('0x41')]();}function insertCmContact(_0x207d48,_0x4088d8,_0x1c3e6e,_0x41e6f2){var _0x1806b5=_[_0x7f13('0x50')](_['keys'](_0x41e6f2),['ListId',_0x7f13('0x51'),'createdAt',_0x7f13('0x2e'),_0x7f13('0x52')]);return squel['insert']()[_0x7f13('0x3b')](_0x7f13('0x3e'))['fromQuery'](_0x1806b5,squel[_0x7f13('0xd')]()[_0x7f13('0x32')](_0x1806b5)['from'](_0x4088d8)[_0x7f13('0x12')]('('+_0x1c3e6e[_0x7f13('0x10')](',')+')\x20NOT\x20IN\x20?',squel[_0x7f13('0xd')]()[_0x7f13('0x32')](_0x1c3e6e)[_0x7f13('0xf')]('cm_contacts')[_0x7f13('0x12')]('ListId\x20=\x20?',_0x207d48)[_0x7f13('0x12')](_0x7f13('0x53')))[_0x7f13('0x12')](_0x7f13('0x54'),squel[_0x7f13('0xd')]()[_0x7f13('0x3f')](_0x7f13('0x55'),'min_id')['from'](_0x4088d8)['group'](_0x1c3e6e[_0x7f13('0x10')](','))))[_0x7f13('0x41')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x9487ae){logger[_0x7f13('0x56')](_0x9487ae[_0x7f13('0x57')]);process[_0x7f13('0x58')](0x1);}function handleError(_0x12be5,_0x12dcc7){stats['errors'][_0x7f13('0x1a')]({'name':_0x12dcc7[_0x7f13('0x59')],'message':_0x12dcc7[_0x7f13('0x57')],'row':_0x12be5});}function handleQuery(_0x38a564){logger[_0x7f13('0x5a')](_0x38a564);return db['sequelize'][_0x7f13('0x5b')](_0x38a564)[_0x7f13('0x5c')](function(_0x23d019){results['push'](_0x23d019);})[_0x7f13('0x5d')](function(_0x417070){logger['error'](_0x417070[_0x7f13('0x57')]);});}function updateTzCampaigns(_0x317ada){return new Promise(function(_0x575307,_0x2815dc){var _0x4fb310=squel[_0x7f13('0xd')]()['fields']([_0x7f13('0x5e'),_0x7f13('0x5f')])[_0x7f13('0xf')](_0x7f13('0x60'))[_0x7f13('0x10')](_0x7f13('0x61'),null,_0x7f13('0x62'))[_0x7f13('0x12')](_0x7f13('0x63')+_0x317ada);db[_0x7f13('0x64')][_0x7f13('0x5b')](_0x4fb310[_0x7f13('0x41')]())[_0x7f13('0x5c')](function(_0x4463c8){var _0xc7e3da=[];for(var _0x1110d6=0x0;_0x1110d6<_0x4463c8[_0x7f13('0x19')];_0x1110d6++){_0xc7e3da[_0x7f13('0x1a')](getTimezoneData(_0x4463c8[_0x1110d6],tmp_campaigns));}BPromise[_0x7f13('0x16')](_0xc7e3da)['then'](function(){_0x575307({'val':0x1});});})[_0x7f13('0x5d')](function(_0x28bbf5){logger[_0x7f13('0x56')](_0x28bbf5[_0x7f13('0x57')]);_0x575307({'val':0x0});});});}function updateTzVoiceQueues(_0x422d78){return new Promise(function(_0x1e1aae,_0x3f79ac){var _0xcecc19=squel[_0x7f13('0xd')]()['fields']([_0x7f13('0x65'),_0x7f13('0x66')])[_0x7f13('0xf')](_0x7f13('0x67'))[_0x7f13('0x10')](_0x7f13('0x68'),null,_0x7f13('0x69'))[_0x7f13('0x12')]('voice_queues_has_cm_lists.CmListId='+_0x422d78);db[_0x7f13('0x64')][_0x7f13('0x5b')](_0xcecc19[_0x7f13('0x41')]())['spread'](function(_0x583b5e){var _0x19dab4=[];for(var _0x581fca=0x0;_0x581fca<_0x583b5e[_0x7f13('0x19')];_0x581fca++){_0x19dab4[_0x7f13('0x1a')](getTimezoneData(_0x583b5e[_0x581fca],tmp_voice_queues));}BPromise[_0x7f13('0x16')](_0x19dab4)[_0x7f13('0x17')](function(){_0x1e1aae({'val':0x1});});})[_0x7f13('0x5d')](function(_0x74a95c){logger[_0x7f13('0x56')](_0x74a95c[_0x7f13('0x57')]);_0x1e1aae({'val':0x0});});});}function getTimezoneData(_0x1fe996,_0xc6b447){return new Promise(function(_0xb8c5f0,_0x1bc559){var _0x5ac453=shared[_0x7f13('0x6a')];var _0x5bf201=_0x5ac453[_0x1fe996[_0x7f13('0x6b')]];if(_['isNil'](_0x5bf201)){_0xb8c5f0({'ret':0x1});}else{var _0x791a02=_0x5bf201[_0x7f13('0x6c')];var _0x1eb524=squel[_0x7f13('0x29')]()['into'](_0xc6b447)[_0x7f13('0x6d')]('id',_0x1fe996['id'])[_0x7f13('0x6d')](_0x7f13('0x6e'),_0x791a02)[_0x7f13('0x6d')](_0x7f13('0x6b'),_0x1fe996[_0x7f13('0x6b')])[_0x7f13('0x41')]();return db[_0x7f13('0x64')][_0x7f13('0x5b')](_0x1eb524)[_0x7f13('0x5c')](function(_0x2365f6){_0xb8c5f0({'ret':0x1});})['catch'](function(_0x5c6762){logger[_0x7f13('0x56')](_0x5c6762[_0x7f13('0x57')]);_0x1bc559({'ret':0x1});});}});}function handleTZQuery(_0x376ef6){logger[_0x7f13('0x5a')](_0x376ef6);return db[_0x7f13('0x64')][_0x7f13('0x5b')](_0x376ef6)[_0x7f13('0x5c')](function(_0x238b88){})[_0x7f13('0x5d')](function(_0x1f80d6){logger[_0x7f13('0x56')](_0x1f80d6['message']);});}function main(_0x1033d4,_0x6a1683,_0x46251a,_0x60ba0c){logger['info'](_0x7f13('0x6f'),_0x1033d4,JSON[_0x7f13('0x70')](_0x6a1683));process[_0x7f13('0x71')](_0x7f13('0x72'));var _0x22ebd0=_0x6a1683['binding'];var _0x4fb6e3=_['clone'](_0x22ebd0);var _0x2922be=_0x6a1683[_0x7f13('0x73')];var _0x8f1f25=path['join'](config[_0x7f13('0x74')],_0x7f13('0x75'),_0x2922be+_0x7f13('0x76'));hasTZ=_[_0x7f13('0x77')](_0x22ebd0)[_0x7f13('0x78')](_0x7f13('0x6b'));var _0x33e50b=_[_0x7f13('0x77')](_0x22ebd0)['join']();logger[_0x7f13('0x5a')](_0x7f13('0x79'),_0x33e50b);db[_0x7f13('0x7a')][_0x7f13('0x15')]({'raw':!![],'attributes':['id',_0x7f13('0x7b')]})[_0x7f13('0x17')](function(_0x1dcfd0){for(var _0xfce5b3=0x0;_0xfce5b3<_0x1dcfd0[_0x7f13('0x19')];_0xfce5b3++){if(_0x1dcfd0[_0xfce5b3][_0x7f13('0x7b')]in _0x22ebd0){contactItemTypes['push'](_0x1dcfd0[_0xfce5b3]);delete _0x4fb6e3[_0x1dcfd0[_0xfce5b3]['name']];hasAdditionalPhones=!![];}for(var _0x418adf in _0x22ebd0){if(_0x1dcfd0[_0xfce5b3][_0x7f13('0x7b')]+'_description'===_0x418adf){phoneDescriptions[_0x7f13('0x1a')]({'itemTypeId':_0x1dcfd0[_0xfce5b3]['id'],'description':_0x418adf});delete _0x4fb6e3[_0x418adf];}}}if(hasAdditionalPhones)_0x4fb6e3['AdditionalPhones']='';var _0x4cc7a=_['keys'](_0x4fb6e3)[_0x7f13('0x10')]();logger[_0x7f13('0x5a')](_0x7f13('0x79'),_0x4cc7a);fs[_0x7f13('0x7c')](_0x8f1f25,_0x4cc7a+'\x0a');Papa[_0x7f13('0x7d')](fs[_0x7f13('0x7e')](_0x1033d4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x204de2,_0x147fe6){try{for(var _0x18bbc2=0x0,_0x8cce7d=[];_0x18bbc2<_0x204de2[_0x7f13('0x7f')][_0x7f13('0x19')];_0x18bbc2++){stats[_0x7f13('0x80')]+=0x1;if(_0x204de2[_0x7f13('0x81')][_0x18bbc2]){handleError(_0x204de2['data'][_0x18bbc2],_0x204de2[_0x7f13('0x81')][_0x18bbc2]);}else{var _0x460d74=[];var _0xda3db2=[];var _0x26329e={};for(var _0x2459d8 in _0x22ebd0){let _0x344738=contactItemTypes[_0x7f13('0x82')](_0x1bfbd3=>_0x1bfbd3[_0x7f13('0x7b')]===_0x2459d8);let _0x499fcb=contactItemTypes[_0x7f13('0x82')](_0x15ef6e=>_0x15ef6e[_0x7f13('0x7b')]+_0x7f13('0x83')===_0x2459d8);if(_['isNil'](_0x344738)&&_['isNil'](_0x499fcb)){if(_0x22ebd0['hasOwnProperty'](_0x2459d8)){if(_0x204de2['data'][_0x18bbc2][_0x22ebd0[_0x2459d8]]){var _0x4c8c3d=_[_0x7f13('0x84')](_0x204de2[_0x7f13('0x7f')][_0x18bbc2][_0x22ebd0[_0x2459d8]][_0x7f13('0x85')](/"/g,'\x27'));switch(_0x2459d8){case _0x7f13('0x44'):var _0x2a2a0c=moment(_0x4c8c3d,_0x7f13('0xc'),!![]);if(_0x2a2a0c[_0x7f13('0x86')]()){_0x8cce7d['push']('\x22'+_0x4c8c3d+'\x22');}else{_0x460d74[_0x7f13('0x1a')](_0x7f13('0x87'));}break;case'priority':var _0x5dd85d=parseInt(_0x4c8c3d);_0x4c8c3d=_['isNaN'](_0x5dd85d)||_0x5dd85d<0x0||_0x5dd85d>0x4?_0x60ba0c?0x3:0x2:_0x5dd85d;_0x8cce7d['push']('\x22'+_0x4c8c3d+'\x22');break;case _0x7f13('0x30'):var _0x1783a0=parseInt(_0x4c8c3d);if(_[_0x7f13('0x88')](_0x1783a0)&&_['includes'](_0x46251a,_0x1783a0)){_0x8cce7d[_0x7f13('0x1a')]('\x22'+_0x1783a0+'\x22');}else{_0x460d74['push']('agent\x20not\x20exists');}break;case _0x7f13('0x89'):if(isEmail(_0x4c8c3d)){_0x8cce7d['push']('\x22'+_0x4c8c3d+'\x22');}else{_0x460d74[_0x7f13('0x1a')](_0x7f13('0x8a'));}break;case _0x7f13('0x8b'):var _0x2bb1bc=moment(_0x4c8c3d,'YYYY-MM-DD',!![]);if(_0x2bb1bc[_0x7f13('0x86')]()){_0x8cce7d['push']('\x22'+_0x4c8c3d+'\x22');}else{_0x460d74[_0x7f13('0x1a')](_0x7f13('0x8c'));}break;case _0x7f13('0x6b'):var _0x13aceb=shared[_0x7f13('0x6a')];var _0x427fa8=_0x13aceb[_0x4c8c3d];if(!_[_0x7f13('0x1c')](_0x427fa8)){var _0x5b50a1=_0x427fa8['utcOffset'];_0x8cce7d[_0x7f13('0x1a')]('\x22'+_0x4c8c3d+'\x22');_0x8cce7d[_0x7f13('0x1a')]('\x22'+_0x5b50a1+'\x22');}break;default:_0x8cce7d[_0x7f13('0x1a')]('\x22'+_0x4c8c3d+'\x22');}}else{switch(_0x2459d8){case _0x7f13('0x8d'):case _0x7f13('0xe'):_0x460d74[_0x7f13('0x1a')](_0x2459d8+_0x7f13('0x8e'));break;default:_0x8cce7d[_0x7f13('0x1a')]('\x22\x22');}}}}else{var _0xdd3663='';if(!_[_0x7f13('0x1c')](_0x344738)){if(!_0x26329e[_0x7f13('0x8f')](_0x344738['id'])){if(!_[_0x7f13('0x1c')](_0x204de2[_0x7f13('0x7f')][_0x18bbc2][_0x22ebd0[_0x2459d8]])){var _0x4c8c3d=_[_0x7f13('0x84')](_0x204de2['data'][_0x18bbc2][_0x22ebd0[_0x2459d8]][_0x7f13('0x85')](/"/g,'\x27'));var _0x58a018=phoneDescriptions[_0x7f13('0x82')](_0x32520d=>_0x32520d[_0x7f13('0x90')]===_0x344738['id']);if(!_['isNil'](_0x58a018)){var _0x5ad999=_[_0x7f13('0x84')](_0x204de2[_0x7f13('0x7f')][_0x18bbc2][_0x22ebd0[_0x58a018[_0x7f13('0x91')]]][_0x7f13('0x85')](/"/g,'\x27'));if(!_[_0x7f13('0x1c')](_0x5ad999))_0x4c8c3d=_0x4c8c3d+'§'+_0x5ad999;}if(_0xdd3663=='')_0xdd3663=_0x4c8c3d;else _0xdd3663+='|'+_0x4c8c3d;}_0xda3db2[_0x7f13('0x1a')](_0x344738['id']+':'+_0xdd3663);_0x26329e[_0x344738['id']]=0x1;}}}}if(hasAdditionalPhones){_0x8cce7d[_0x7f13('0x1a')]('\x22'+_0xda3db2[_0x7f13('0x10')](';')+'\x22');}if(_0x460d74[_0x7f13('0x19')]){handleError(_0x204de2['data'][_0x18bbc2],{'code':_0x7f13('0x92'),'message':_0x460d74['join']()});}else{fs[_0x7f13('0x93')](_0x8f1f25,_0x8cce7d['join']()+'\x0a');}_0x8cce7d=[];}if(!(stats[_0x7f13('0x80')]%0xc8)){socket[_0x7f13('0x94')]('contact:import:'+_0x2922be,stats);stats[_0x7f13('0x81')]=[];}}if(stopped){logger[_0x7f13('0x5a')]('Abort\x20parser');_0x147fe6[_0x7f13('0x95')]();}}catch(_0x307c1e){handleError(_0x204de2[_0x7f13('0x7f')][_0x18bbc2],{'code':'SystemError','message':_0x307c1e[_0x7f13('0x57')]});logger[_0x7f13('0x56')](_0x7f13('0x96'),_0x307c1e[_0x7f13('0x57')]);}},'complete':function(){try{var _0x1f0b52=[];var _0x1a7c3a=[];var _0x110457=_0x7f13('0x3e');if(_0x6a1683[_0x7f13('0x97')]&&_0x6a1683[_0x7f13('0x97')][_0x7f13('0x19')]){_0x110457=_0x7f13('0x98')+_0x2922be;_0x1f0b52[_0x7f13('0x1a')](_0x7f13('0x99')+_0x110457+_0x7f13('0x9a'));}tmp_campaigns='campaigns_'+_0x2922be;tmp_voice_queues=_0x7f13('0x9b')+_0x2922be;_0x1a7c3a[_0x7f13('0x1a')](_0x7f13('0x99')+tmp_campaigns+_0x7f13('0x9c'));_0x1a7c3a[_0x7f13('0x1a')](_0x7f13('0x99')+tmp_voice_queues+_0x7f13('0x9c'));BPromise['each'](_0x1a7c3a,handleTZQuery)['then'](function(_0x4878d6){updateTzCampaigns(_0x6a1683[_0x7f13('0x2d')])[_0x7f13('0x17')](function(_0x3543d7){updateTzVoiceQueues(_0x6a1683['ListId'])['then'](function(_0x4eadb0){if(hasTZ)_0x4cc7a=_0x4cc7a[_0x7f13('0x85')](_0x7f13('0x6b'),_0x7f13('0x9d'));var _0xe247ce=util['format'](_0x7f13('0x9e'),_0x8f1f25,_0x110457,_0x4cc7a,_0x6a1683[_0x7f13('0x2d')],_0x6a1683[_0x7f13('0x51')]||null,NOW,NOW);if(_[_0x7f13('0x1c')](_0x22ebd0[_0x7f13('0x44')])){_0xe247ce+=_0x7f13('0x9f');}_0x1f0b52[_0x7f13('0x1a')](_0xe247ce);if(_0x6a1683[_0x7f13('0x97')]&&_0x6a1683[_0x7f13('0x97')][_0x7f13('0x19')]){_0x1f0b52[_0x7f13('0x1a')](insertCmContact(_0x6a1683[_0x7f13('0x2d')],_0x110457,_0x6a1683[_0x7f13('0x97')],_0x22ebd0));_0x1f0b52['push']('DROP\x20TABLE\x20'+_0x110457+';');}BPromise[_0x7f13('0xa0')](_0x1f0b52,handleQuery)[_0x7f13('0x17')](function(_0x4003f4){BPromise[_0x7f13('0x16')]([handleAdditionalPhones()])[_0x7f13('0x17')](function(){_0x1f0b52=[];for(var _0x6d4b76=0x0;_0x6d4b76_0x3ec4f7['name']===_0x5f13f2);let _0x345a81=contactItemTypes[_0x5b72('0x7b')](_0x5d4beb=>_0x5d4beb[_0x5b72('0x77')]+'_description'===_0x5f13f2);if(_['isNil'](_0x5b6f06)&&_[_0x5b72('0x1f')](_0x345a81)){if(_0x2fa51b[_0x5b72('0x7c')](_0x5f13f2)){if(_0x5303fd[_0x5b72('0x7d')][_0x2ebb21][_0x2fa51b[_0x5f13f2]]){var _0x553400=_['trim'](_0x5303fd[_0x5b72('0x7d')][_0x2ebb21][_0x2fa51b[_0x5f13f2]][_0x5b72('0x7e')](/"/g,'\x27'));switch(_0x5f13f2){case _0x5b72('0x2b'):var _0x27967c=moment(_0x553400,_0x5b72('0xe'),!![]);if(_0x27967c[_0x5b72('0x7f')]()){_0x4cda14[_0x5b72('0x1c')]('\x22'+_0x553400+'\x22');}else{_0x7b2b58[_0x5b72('0x1c')](_0x5b72('0x80'));}break;case _0x5b72('0x2f'):var _0x221f90=parseInt(_0x553400);_0x553400=_[_0x5b72('0x81')](_0x221f90)||_0x221f90<0x0||_0x221f90>0x4?_0x19b22c?0x3:0x2:_0x221f90;_0x4cda14[_0x5b72('0x1c')]('\x22'+_0x553400+'\x22');break;case _0x5b72('0x82'):var _0x11c81e=parseInt(_0x553400);if(_[_0x5b72('0x83')](_0x11c81e)&&_[_0x5b72('0x84')](_0xeb031f,_0x11c81e)){_0x4cda14[_0x5b72('0x1c')]('\x22'+_0x11c81e+'\x22');}else{_0x7b2b58[_0x5b72('0x1c')](_0x5b72('0x85'));}break;case _0x5b72('0x86'):if(isEmail(_0x553400)){_0x4cda14['push']('\x22'+_0x553400+'\x22');}else{_0x7b2b58[_0x5b72('0x1c')](_0x5b72('0x87'));}break;case _0x5b72('0x88'):var _0x261739=moment(_0x553400,'YYYY-MM-DD',!![]);if(_0x261739['isValid']()){_0x4cda14[_0x5b72('0x1c')]('\x22'+_0x553400+'\x22');}else{_0x7b2b58[_0x5b72('0x1c')](_0x5b72('0x89'));}break;case _0x5b72('0x67'):var _0x228e3=shared[_0x5b72('0x66')];var _0x14bbe0=_0x228e3[_0x553400];if(!_['isNil'](_0x14bbe0)){var _0x5db665=_0x14bbe0[_0x5b72('0x68')];_0x4cda14[_0x5b72('0x1c')]('\x22'+_0x553400+'\x22');_0x4cda14['push']('\x22'+_0x5db665+'\x22');}break;default:_0x4cda14[_0x5b72('0x1c')]('\x22'+_0x553400+'\x22');}}else{switch(_0x5f13f2){case'firstName':case _0x5b72('0x12'):_0x7b2b58[_0x5b72('0x1c')](_0x5f13f2+_0x5b72('0x8a'));break;default:_0x4cda14[_0x5b72('0x1c')]('\x22\x22');}}}}else{var _0x1f8c14='';if(!_[_0x5b72('0x1f')](_0x5b6f06)){if(!_0x460bbb[_0x5b72('0x7c')](_0x5b6f06['id'])){if(!_[_0x5b72('0x1f')](_0x5303fd[_0x5b72('0x7d')][_0x2ebb21][_0x2fa51b[_0x5f13f2]])){var _0x553400=_[_0x5b72('0x8b')](_0x5303fd[_0x5b72('0x7d')][_0x2ebb21][_0x2fa51b[_0x5f13f2]][_0x5b72('0x7e')](/"/g,'\x27'));var _0xf4543d=phoneDescriptions['find'](_0x433d9b=>_0x433d9b[_0x5b72('0x8c')]===_0x5b6f06['id']);if(!_['isNil'](_0xf4543d)){var _0xc7dd51=_[_0x5b72('0x8b')](_0x5303fd['data'][_0x2ebb21][_0x2fa51b[_0xf4543d[_0x5b72('0x8d')]]][_0x5b72('0x7e')](/"/g,'\x27'));if(!_[_0x5b72('0x1f')](_0xc7dd51))_0x553400=_0x553400+'§'+_0xc7dd51;}if(_0x1f8c14=='')_0x1f8c14=_0x553400;else _0x1f8c14+='|'+_0x553400;}_0x1fe792[_0x5b72('0x1c')](_0x5b6f06['id']+':'+_0x1f8c14);_0x460bbb[_0x5b6f06['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4cda14[_0x5b72('0x1c')]('\x22'+_0x1fe792[_0x5b72('0x14')](';')+'\x22');}if(_0x7b2b58[_0x5b72('0x1b')]){handleError(_0x5303fd[_0x5b72('0x7d')][_0x2ebb21],{'code':_0x5b72('0x8e'),'message':_0x7b2b58[_0x5b72('0x14')]()});}else{fs[_0x5b72('0x8f')](_0x1ac8e1,_0x4cda14[_0x5b72('0x14')]()+'\x0a');}_0x4cda14=[];}if(!(stats['rows']%0xc8)){socket[_0x5b72('0x90')](_0x5b72('0x91')+_0x388c9d,stats);stats['errors']=[];}}if(stopped){logger[_0x5b72('0x50')](_0x5b72('0x92'));_0x525ef3[_0x5b72('0x93')]();}}catch(_0x298330){handleError(_0x5303fd[_0x5b72('0x7d')][_0x2ebb21],{'code':'SystemError','message':_0x298330['message']});logger[_0x5b72('0x52')](_0x5b72('0x94'),_0x298330['message']);}},'complete':function(){try{var _0xde903c=[];var _0x2bb839=[];var _0x7b42f5='cm_contacts';if(_0x20b04b[_0x5b72('0x95')]&&_0x20b04b[_0x5b72('0x95')][_0x5b72('0x1b')]){_0x7b42f5=_0x5b72('0x96')+_0x388c9d;_0xde903c[_0x5b72('0x1c')](_0x5b72('0x97')+_0x7b42f5+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x5b72('0x98')+_0x388c9d;tmp_voice_queues=_0x5b72('0x99')+_0x388c9d;_0x2bb839[_0x5b72('0x1c')](_0x5b72('0x97')+tmp_campaigns+_0x5b72('0x9a'));_0x2bb839['push'](_0x5b72('0x97')+tmp_voice_queues+_0x5b72('0x9a'));BPromise[_0x5b72('0x9b')](_0x2bb839,handleTZQuery)[_0x5b72('0x1a')](function(_0x32ebe8){updateTzCampaigns(_0x20b04b[_0x5b72('0x37')])['then'](function(_0x21ecfe){updateTzVoiceQueues(_0x20b04b[_0x5b72('0x37')])['then'](function(_0x37c482){if(hasTZ)_0x45a155=_0x45a155[_0x5b72('0x7e')](_0x5b72('0x67'),'dialTimezone,utcOffset');var _0x30ecf3=util[_0x5b72('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x1ac8e1,_0x7b42f5,_0x45a155,_0x20b04b['ListId'],_0x20b04b['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x2fa51b[_0x5b72('0x2b')])){_0x30ecf3+=_0x5b72('0x9c');}_0xde903c[_0x5b72('0x1c')](_0x30ecf3);if(_0x20b04b[_0x5b72('0x95')]&&_0x20b04b[_0x5b72('0x95')][_0x5b72('0x1b')]){_0xde903c[_0x5b72('0x1c')](insertCmContact(_0x20b04b[_0x5b72('0x37')],_0x7b42f5,_0x20b04b[_0x5b72('0x95')],_0x2fa51b));_0xde903c[_0x5b72('0x1c')](_0x5b72('0x9d')+_0x7b42f5+';');}BPromise[_0x5b72('0x9b')](_0xde903c,handleQuery)[_0x5b72('0x1a')](function(_0x5a5fe8){BPromise[_0x5b72('0x1d')]([handleAdditionalPhones()])[_0x5b72('0x1a')](function(){_0xde903c=[];for(var _0x2e6ecd=0x0;_0x2e6ecd\x20\x20');}var _0x3bb2bb=path[_0x5b72('0x14')](config[_0x5b72('0x70')],_0x5b72('0x71'),process['argv'][0x2]);if(!fs['existsSync'](_0x3bb2bb)){throw new Error(_0x5b72('0xa7'));}var _0x5a272d={};try{_0x5a272d=JSON[_0x5b72('0xa8')](process['argv'][0x3]);if(!_0x5a272d[_0x5b72('0x6d')]){throw new Error(_0x5b72('0xa9'));}if(!_0x5a272d[_0x5b72('0x6d')][_0x5b72('0x12')]){throw new Error(_0x5b72('0xaa'));}if(!_0x5a272d['binding'][_0x5b72('0xab')]){throw new Error(_0x5b72('0xac'));}var _0x251c52=0x0;if(_0x5a272d[_0x5b72('0x6d')][_0x5b72('0x82')]){_0x251c52=0x1;}if(!_0x5a272d[_0x5b72('0x37')]){throw new Error(_0x5b72('0xad'));}}catch(_0x363d57){throw new Error(_0x5b72('0xae'));}var _0x5ae612=[];try{_0x5ae612=_[_0x5b72('0xaf')](JSON[_0x5b72('0xa8')](process[_0x5b72('0xa6')][0x4]),'id');}catch(_0x2e4f96){logger[_0x5b72('0x50')](_0x5b72('0xb0'));}main(_0x3bb2bb,_0x5a272d,_0x5ae612,_0x251c52);}validate();process['on'](_0x5b72('0xb1'),handleStop);process['on'](_0x5b72('0xb2'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 3e5de1e..8284f5b 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23a3=['join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','spread','length','isNil','AdditionalPhones','push','all','message','then','split','filter','CmContactHasItem','updated','create','PHONE','inserted','CmContact','CmHopper','update','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','priority','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_contacts.createdAt','insert','cm_hopper_black','updatedAt','cm_contacts','ListId\x20=\x20?','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','createdAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','Received\x20SIGINT','error','exit','errors','code','info','sequelize','catch','stringify','send','start','binding','clone','socket_timestamp','root','.csv','body','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contact','contactId','contactTypeId','orderBy','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from'];(function(_0x4b512c,_0x55fdd3){var _0x23b785=function(_0x4f88c7){while(--_0x4f88c7){_0x4b512c['push'](_0x4b512c['shift']());}};_0x23b785(++_0x55fdd3);}(_0x23a3,0x131));var _0x323a=function(_0x4d901b,_0xf27eb8){_0x4d901b=_0x4d901b-0x0;var _0x704e25=_0x23a3[_0x4d901b];return _0x704e25;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0x323a('0x0'));var BPromise=require('bluebird');var moment=require(_0x323a('0x1'));var squel=require(_0x323a('0x2'));var Redis=require(_0x323a('0x3'));var db=require(_0x323a('0x4'))['db'];var config=require(_0x323a('0x5'));var logger=require(_0x323a('0x6'))(_0x323a('0x7'));config[_0x323a('0x8')]=_[_0x323a('0x9')](config['redis'],{'host':_0x323a('0xa'),'port':0x18eb});var socket=require(_0x323a('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x323a('0xc')](_0x323a('0xd'));var tempTableName=_0x323a('0xe')+moment()['format'](_0x323a('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x11f2e5){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))*$/[_0x323a('0x10')](_0x11f2e5);}function selectNotIn(_0x3e0e0b,_0x1b3d13,_0x50a99b,_0x15d09f,_0x2cea45){return squel[_0x323a('0x11')]()[_0x323a('0x12')](_0x323a('0x13'))[_0x323a('0x14')](_0x15d09f)[_0x323a('0x15')](_0x1b3d13,null,_0x1b3d13+_0x323a('0x16')+_0x15d09f+'.'+_0x50a99b)['where'](_0x15d09f+'.'+_0x50a99b+_0x323a('0x17')+_0x3e0e0b+'.'+_0x50a99b)['where'](_0x1b3d13+_0x323a('0x18')+_0x2cea45['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5f3922,_0x34849a){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x323a('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0x323a('0x1a')](function(_0x64003){if(_0x64003!==null){var _0x54cda9=[];for(var _0x271b85=0x0;_0x271b85<_0x64003[_0x323a('0x1b')];_0x271b85++){var _0x569963=_0x64003[_0x271b85];if(!_['isNil'](_0x569963[_0x323a('0x13')])){if(!_[_0x323a('0x1c')](_0x569963[_0x323a('0x1d')]))_0x54cda9[_0x323a('0x1e')](insertAdditionalPhones(_0x569963));promisesContact[_0x323a('0x1e')]({'contact':_0x569963});}}}Promise[_0x323a('0x1f')](_0x54cda9)['then'](function(){_0x5f3922({'val':0x1});});})['catch'](function(_0x47f84e){logger['error'](_0x47f84e[_0x323a('0x20')]);});});}function insertAdditionalPhones(_0x549801){return new Promise(function(_0xc0f3e4,_0x38bc95){var _0x154ab1=_0x549801[_0x323a('0x1d')];if(_['isNil'](_0x154ab1))_0x38bc95({'val':0x0});else{var _0x5af312=_0x154ab1['split'](';');var _0x12c8d7=[];orderBy=0x0;for(var _0x323517=0x0;_0x323517<_0x5af312[_0x323a('0x1b')];_0x323517++){_0x12c8d7['push'](splitAdditionalPhone(_0x549801['id'],_0x5af312[_0x323517]));}Promise[_0x323a('0x1f')](_0x12c8d7)[_0x323a('0x21')](function(){_0xc0f3e4({'val':_0x5af312[_0x323a('0x1b')]});});}});}function splitAdditionalPhone(_0x2960e0,_0x35f8ec){return new Promise(function(_0x204f76,_0x5ba015){var _0x3a51bb=_0x35f8ec['split'](':');var _0xc0c527=_0x3a51bb[0x0];var _0x2e05fd=_0x3a51bb[0x1];if(_0x2e05fd!==''){var _0x27c7de=_0x2e05fd[_0x323a('0x22')]('|');var _0x3676f8=[];for(var _0x47ed72=0x0;_0x47ed72<_0x27c7de[_0x323a('0x1b')];_0x47ed72++){if(_0x27c7de[_0x47ed72]!==''){var _0x384c93=_[_0x323a('0x23')](promisesAdditionalPhones,{'contactId':_0x2960e0,'phone':_0x27c7de[_0x47ed72]});if(_0x384c93[_0x323a('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x323a('0x1e')]({'contactId':_0x2960e0,'contactTypeId':_0xc0c527,'phone':_0x27c7de[_0x47ed72],'orderBy':orderBy});}}}_0x204f76({'ok':0x1});}else _0x204f76({'res':0x0});});}function createAdditionalPhone(_0x4ba792,_0x23a989,_0x571264,_0x24747b){var _0x1eb71f='';var _0x2f4a76='';var _0x3a4b0d=_0x571264[_0x323a('0x22')]('§');_0x1eb71f=_0x3a4b0d[0x0];if(_0x3a4b0d[_0x323a('0x1b')]==0x2)_0x2f4a76=_0x3a4b0d[0x1];return new Promise(function(_0x5bdea1,_0x2a1a85){return db[_0x323a('0x24')]['findOne']({'where':{'CmContactId':_0x4ba792,'item':_0x1eb71f}})[_0x323a('0x21')](function(_0x4abf8d){if(_0x4abf8d){return db['CmContactHasItem']['update']({'ItemTypeId':_0x23a989,'description':_0x2f4a76,'OrderBy':_0x24747b},{'where':{'CmContactId':_0x4ba792,'item':_0x1eb71f}})[_0x323a('0x21')](function(_0x58ec44){_0x5bdea1({'res':_0x323a('0x25')});});}else{return db[_0x323a('0x24')][_0x323a('0x26')]({'CmContactId':_0x4ba792,'item':_0x1eb71f,'ItemTypeId':_0x23a989,'description':_0x2f4a76,'OrderBy':_0x24747b,'ItemClass':_0x323a('0x27')})[_0x323a('0x21')](function(_0x4d5ed4){_0x5bdea1({'res':_0x323a('0x28')});});}});});}function updateContact(_0x487260){return new Promise(function(_0x45748f,_0x57c120){var _0x2c55cc=_0x487260['id'];delete _0x487260['id'];return db[_0x323a('0x29')]['update'](_0x487260,{'where':{'id':_0x2c55cc}})[_0x323a('0x21')](function(_0x3a1edd){updatedRows+=0x1;return db[_0x323a('0x2a')][_0x323a('0x2b')]({'phone':_0x487260[_0x323a('0x13')]},{'where':{'ContactId':_0x2c55cc}})[_0x323a('0x21')](function(_0x43fc4f){_0x45748f({'ret':'OK'});});});});}function insertCmHopper(_0x44fecb,_0x491242,_0x1ac6a6,_0x149944,_0x10b7ab){var _0x125c8b=[_0x323a('0x2c'),_0x323a('0x2d'),_0x323a('0x2e'),'cm_contacts.ListId',_0x491242+'.'+_0x149944,'cm_contacts.createdAt',_0x323a('0x2f'),_0x323a('0x30'),_0x323a('0x31'),'\x22'+_0x10b7ab+'\x22'];return squel['insert']()[_0x323a('0x32')](_0x323a('0x33'))[_0x323a('0x34')]([_0x323a('0x13'),'scheduledat',_0x323a('0x35'),_0x323a('0x36'),_0x149944,'createdAt','updatedAt',_0x323a('0x37'),'UserId',_0x323a('0x38')],squel[_0x323a('0x11')]()[_0x323a('0x39')](_0x125c8b)['from'](_0x491242)[_0x323a('0x15')]('cm_contacts',null,_0x323a('0x3a')+_0x491242+_0x323a('0x3b'))[_0x323a('0x15')](_0x1ac6a6,null,_0x1ac6a6+_0x323a('0x16')+_0x491242+'.'+_0x149944)[_0x323a('0x3c')](_0x491242+_0x323a('0x3d'),_0x44fecb)['where'](_0x323a('0x3e'),NOW)[_0x323a('0x3c')](_0x323a('0x3f'),selectNotIn(_0x491242,_0x1ac6a6,_0x149944,_0x323a('0x33'),[_0x323a('0x40'),'\x22onlyIfOpen\x22']))[_0x323a('0x3c')](_0x323a('0x3f'),selectNotIn(_0x491242,_0x1ac6a6,_0x149944,'cm_hopper',[_0x323a('0x40')])))[_0x323a('0x41')]();}function insertCmHopperBlack(_0x8d699b,_0x42a89c,_0x2a2da8,_0x599b28){var _0x736c9d=['cm_contacts.phone','cm_contacts.id',_0x323a('0x42'),_0x42a89c+'.'+_0x599b28,_0x323a('0x43'),_0x323a('0x2f')];return squel[_0x323a('0x44')]()['into'](_0x323a('0x45'))[_0x323a('0x34')]([_0x323a('0x13'),_0x323a('0x35'),_0x323a('0x36'),_0x599b28,'createdAt',_0x323a('0x46')],squel[_0x323a('0x11')]()['fields'](_0x736c9d)['from'](_0x42a89c)[_0x323a('0x15')](_0x323a('0x47'),null,_0x323a('0x3a')+_0x42a89c+'.CmListId')[_0x323a('0x15')](_0x2a2da8,null,_0x2a2da8+_0x323a('0x16')+_0x42a89c+'.'+_0x599b28)[_0x323a('0x3c')](_0x42a89c+'.CmListId\x20=\x20?',_0x8d699b)[_0x323a('0x3c')](_0x323a('0x3e'),NOW)[_0x323a('0x3c')](_0x323a('0x3f'),squel[_0x323a('0x11')]()[_0x323a('0x12')](_0x323a('0x13'))[_0x323a('0x14')](_0x323a('0x45'))[_0x323a('0x3c')](_0x323a('0x48'),_0x8d699b)[_0x323a('0x3c')](_0x599b28+'\x20=\x20?',_0x42a89c+'.'+_0x599b28)))[_0x323a('0x41')]();}function insertCmHopperAdditionalPhones(_0x3bae04){var _0x1c2681=['cm_hopper.id','cm_contact_has_items.item',_0x323a('0x49'),_0x323a('0x4a'),_0x323a('0x4b')];return squel[_0x323a('0x44')]()['into'](_0x323a('0x4c'))['fromQuery']([_0x323a('0x4d'),_0x323a('0x13'),_0x323a('0x4e'),_0x323a('0x4f'),_0x323a('0x46')],squel['select']()[_0x323a('0x39')](_0x1c2681)[_0x323a('0x14')](_0x323a('0x33'))[_0x323a('0x15')]('cm_contacts',null,_0x323a('0x50'))['join'](_0x323a('0x51'),null,_0x323a('0x52'))[_0x323a('0x3c')](_0x323a('0x53'),_0x3bae04)[_0x323a('0x3c')](_0x323a('0x3e'),NOW))[_0x323a('0x41')]();}function insertCmContact(_0x101357,_0x10cb91,_0x37242c,_0x5db6c7){var _0x4ba007=_[_0x323a('0x54')](_[_0x323a('0x55')](_0x5db6c7),[_0x323a('0x36'),_0x323a('0x56'),_0x323a('0x4f'),_0x323a('0x46')]);return squel['insert']()[_0x323a('0x32')](_0x323a('0x47'))[_0x323a('0x34')](_0x4ba007,squel['select']()[_0x323a('0x39')](_0x4ba007)[_0x323a('0x14')](_0x10cb91)['where']('('+_0x37242c[_0x323a('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0x323a('0x11')]()[_0x323a('0x39')](_0x37242c)[_0x323a('0x14')](_0x323a('0x47'))['where'](_0x323a('0x48'),_0x101357))['where'](_0x323a('0x57'),squel['select']()[_0x323a('0x12')](_0x323a('0x58'),'min_id')[_0x323a('0x14')](_0x10cb91)['group'](_0x37242c[_0x323a('0x15')](','))))[_0x323a('0x41')]();}function handleStop(){logger['info'](_0x323a('0x59'));stopped=!![];}function handleUncaughtException(_0x445c23){logger[_0x323a('0x5a')](_0x445c23['message']);process[_0x323a('0x5b')](0x1);}function handleError(_0x362e15,_0x20dded){stats[_0x323a('0x5c')][_0x323a('0x1e')]({'name':_0x20dded[_0x323a('0x5d')],'message':_0x20dded[_0x323a('0x20')],'row':_0x362e15});}function handleQuery(_0x2d9789){logger[_0x323a('0x5e')](_0x2d9789);return db[_0x323a('0x5f')][_0x323a('0x19')](_0x2d9789)[_0x323a('0x1a')](function(_0x181072){results[_0x323a('0x1e')](_0x181072);})[_0x323a('0x60')](function(_0x12129a){logger['error'](_0x12129a[_0x323a('0x20')]);});}function main(_0x188777,_0x42d260,_0x40df26,_0x4dae2e){logger['info']('main',_0x188777,JSON[_0x323a('0x61')](_0x42d260));process[_0x323a('0x62')](_0x323a('0x63'));var _0x2810b4=_0x42d260[_0x323a('0x64')];var _0x96863b=_[_0x323a('0x65')](_0x2810b4);var _0x1e1c61=_0x42d260[_0x323a('0x66')];var _0x41a566=path[_0x323a('0x15')](config[_0x323a('0x67')],'server/files/tmp',_0x1e1c61+_0x323a('0x68'));logger[_0x323a('0x5e')](_0x323a('0x69'),_0x42d260);db['ContactItemType'][_0x323a('0x6a')]({'raw':!![],'attributes':['id',_0x323a('0x6b')]})[_0x323a('0x21')](function(_0x57f9a9){for(var _0x507cbd=0x0;_0x507cbd<_0x57f9a9['length'];_0x507cbd++){if(_0x57f9a9[_0x507cbd][_0x323a('0x6b')]in _0x2810b4){contactItemTypes[_0x323a('0x1e')](_0x57f9a9[_0x507cbd]);delete _0x96863b[_0x57f9a9[_0x507cbd][_0x323a('0x6b')]];hasAdditionalPhones=!![];}for(var _0x4470ea in _0x2810b4){if(_0x57f9a9[_0x507cbd][_0x323a('0x6b')]+_0x323a('0x6c')===_0x4470ea){phoneDescriptions[_0x323a('0x1e')]({'itemTypeId':_0x57f9a9[_0x507cbd]['id'],'description':_0x4470ea});delete _0x96863b[_0x4470ea];}}}if(hasAdditionalPhones)_0x96863b['AdditionalPhones']='';var _0x55e751=_['keys'](_0x96863b)['join']();logger['info'](_0x323a('0x6d'),_0x55e751);fs[_0x323a('0x6e')](_0x41a566,_0x55e751+'\x0a');Papa[_0x323a('0x6f')](fs[_0x323a('0x70')](_0x188777),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1ee247,_0xed1022){try{for(var _0x11e7c8=0x0,_0x540b8c=[];_0x11e7c8<_0x1ee247[_0x323a('0x71')]['length'];_0x11e7c8++){stats[_0x323a('0x72')]+=0x1;if(_0x1ee247['errors'][_0x11e7c8]){handleError(_0x1ee247['data'][_0x11e7c8],_0x1ee247['errors'][_0x11e7c8]);}else{var _0x4916e0=[];var _0x59b1b6=[];var _0x5bab5e={};for(var _0x1cbe16 in _0x2810b4){let _0x54cec6=contactItemTypes[_0x323a('0x73')](_0xe59485=>_0xe59485[_0x323a('0x6b')]===_0x1cbe16);let _0x4bef04=contactItemTypes['find'](_0x2a0576=>_0x2a0576[_0x323a('0x6b')]+_0x323a('0x6c')===_0x1cbe16);if(_[_0x323a('0x1c')](_0x54cec6)&&_['isNil'](_0x4bef04)){if(_0x2810b4[_0x323a('0x74')](_0x1cbe16)){if(_0x1ee247[_0x323a('0x71')][_0x11e7c8][_0x2810b4[_0x1cbe16]]){var _0x50ad8f=_[_0x323a('0x75')](_0x1ee247[_0x323a('0x71')][_0x11e7c8][_0x2810b4[_0x1cbe16]]['replace'](/"/g,'\x27'));switch(_0x1cbe16){case _0x323a('0x76'):var _0x2669ad=moment(_0x50ad8f,_0x323a('0xd'),!![]);if(_0x2669ad[_0x323a('0x77')]()){_0x540b8c[_0x323a('0x1e')]('\x22'+_0x50ad8f+'\x22');}else{_0x4916e0[_0x323a('0x1e')](_0x323a('0x78'));}break;case'priority':var _0x5359de=parseInt(_0x50ad8f);_0x50ad8f=_[_0x323a('0x79')](_0x5359de)||_0x5359de<0x0||_0x5359de>0x4?_0x4dae2e?0x3:0x2:_0x5359de;_0x540b8c['push']('\x22'+_0x50ad8f+'\x22');break;case _0x323a('0x7a'):var _0x4a2754=parseInt(_0x50ad8f);if(_[_0x323a('0x7b')](_0x4a2754)&&_[_0x323a('0x7c')](_0x40df26,_0x4a2754)){_0x540b8c['push']('\x22'+_0x4a2754+'\x22');}else{_0x4916e0[_0x323a('0x1e')](_0x323a('0x7d'));}break;case _0x323a('0x7e'):if(isEmail(_0x50ad8f)){_0x540b8c[_0x323a('0x1e')]('\x22'+_0x50ad8f+'\x22');}else{_0x4916e0['push'](_0x323a('0x7f'));}break;case _0x323a('0x80'):var _0x52594f=moment(_0x50ad8f,'YYYY-MM-DD',!![]);if(_0x52594f[_0x323a('0x77')]()){_0x540b8c['push']('\x22'+_0x50ad8f+'\x22');}else{_0x4916e0['push'](_0x323a('0x81'));}break;default:_0x540b8c[_0x323a('0x1e')]('\x22'+_0x50ad8f+'\x22');}}else{switch(_0x1cbe16){case _0x323a('0x82'):case _0x323a('0x13'):_0x4916e0[_0x323a('0x1e')](_0x1cbe16+_0x323a('0x83'));break;default:_0x540b8c[_0x323a('0x1e')]('\x22\x22');}}}}else{var _0x2ec377='';if(!_['isNil'](_0x54cec6)){if(!_0x5bab5e[_0x323a('0x74')](_0x54cec6['id'])){for(var _0x4a510e=0x0;_0x4a510e<_0x2810b4[_0x1cbe16][_0x323a('0x1b')];_0x4a510e++){var _0x50ad8f=_['trim'](_0x1ee247[_0x323a('0x71')][_0x11e7c8][_0x2810b4[_0x1cbe16][_0x4a510e]][_0x323a('0x84')](/"/g,'\x27'));var _0x448756=phoneDescriptions[_0x323a('0x73')](_0x5e54d4=>_0x5e54d4[_0x323a('0x85')]===_0x54cec6['id']);if(!_[_0x323a('0x1c')](_0x448756)){var _0xac7a0a=_['trim'](_0x1ee247[_0x323a('0x71')][_0x11e7c8][_0x2810b4[_0x448756[_0x323a('0x86')]][0x0]][_0x323a('0x84')](/"/g,'\x27'));if(!_[_0x323a('0x1c')](_0xac7a0a))_0x50ad8f=_0x50ad8f+'§'+_0xac7a0a;}if(_0x2ec377=='')_0x2ec377=_0x50ad8f;else _0x2ec377+='|'+_0x50ad8f;}_0x59b1b6[_0x323a('0x1e')](_0x54cec6['id']+':'+_0x2ec377);_0x5bab5e[_0x54cec6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x540b8c[_0x323a('0x1e')]('\x22'+_0x59b1b6[_0x323a('0x15')](';')+'\x22');}if(_0x4916e0[_0x323a('0x1b')]){handleError(_0x1ee247['data'][_0x11e7c8],{'code':_0x323a('0x87'),'message':_0x4916e0[_0x323a('0x15')]()});}else{fs[_0x323a('0x88')](_0x41a566,_0x540b8c[_0x323a('0x15')]()+'\x0a');}_0x540b8c=[];}if(!(stats[_0x323a('0x72')]%0xc8)){socket[_0x323a('0x89')](_0x323a('0x8a')+_0x1e1c61,stats);stats['errors']=[];}}if(stopped){logger[_0x323a('0x5e')]('Abort\x20parser');_0xed1022[_0x323a('0x8b')]();}}catch(_0x2ee403){handleError(_0x1ee247[_0x323a('0x71')][_0x11e7c8],{'code':_0x323a('0x8c'),'message':_0x2ee403[_0x323a('0x20')]});logger[_0x323a('0x5a')](_0x323a('0x8d'),_0x2ee403['message']);}},'complete':function(){try{var _0x9f0bc=[];var _0x1a93a2=tempTableName;_0x9f0bc[_0x323a('0x1e')]('CREATE\x20TABLE\x20'+_0x1a93a2+_0x323a('0x8e'));logger[_0x323a('0x5e')](_0x323a('0x8f'),contactItemTypes[_0x323a('0x1b')]);var _0x4c0e3b=util['format'](_0x323a('0x90'),_0x41a566,_0x1a93a2,_0x55e751,_0x42d260[_0x323a('0x36')],_0x42d260[_0x323a('0x56')]||null,NOW,NOW);if(_[_0x323a('0x1c')](_0x2810b4[_0x323a('0x76')])){_0x4c0e3b+=_0x323a('0x91');}_0x9f0bc[_0x323a('0x1e')](_0x4c0e3b);BPromise['each'](_0x9f0bc,handleQuery)[_0x323a('0x21')](function(_0xefd515){BPromise[_0x323a('0x1f')]([handleAdditionalPhones()])['then'](function(){_0x9f0bc=[];for(var _0x16f8e4=0x0;_0x16f8e4\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','SIGINT','uncaughtException','lodash','papaparse','bluebird','squel','../../../config/logger','import','redis','localhost','socket.io-emitter','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','select\x20*\x20from\x20','spread','isNil','phone','AdditionalPhones','all','then','error','message','split','length','push','filter','CmContactHasItem','findOne','update','updated','create','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.id','cm_contacts.createdAt','cm_hopper_black','cm_contacts','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','group','exit','errors','code','info','catch','main','start','binding','clone','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','writeFileSync','createReadStream','data','rows','find','_description','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','trim','description','appendFileSync','contact:import:','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactId','contactTypeId'];(function(_0x3873ca,_0x1ecda9){var _0x4ce3e5=function(_0x2a3d23){while(--_0x2a3d23){_0x3873ca['push'](_0x3873ca['shift']());}};_0x4ce3e5(++_0x1ecda9);}(_0x19cb,0x146));var _0xb19c=function(_0x142a84,_0x373faf){_0x142a84=_0x142a84-0x0;var _0x21cbf3=_0x19cb[_0x142a84];return _0x21cbf3;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xb19c('0x0'));var Papa=require(_0xb19c('0x1'));var util=require('util');var BPromise=require(_0xb19c('0x2'));var moment=require('moment');var squel=require(_0xb19c('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xb19c('0x4'))(_0xb19c('0x5'));config['redis']=_['defaults'](config[_0xb19c('0x6')],{'host':_0xb19c('0x7'),'port':0x18eb});var socket=require(_0xb19c('0x8'))(new Redis(config[_0xb19c('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xb19c('0x9')+moment()[_0xb19c('0xa')](_0xb19c('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x12d1ce){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))*$/[_0xb19c('0xc')](_0x12d1ce);}function selectNotIn(_0x4de417,_0x14d90d,_0xcc851f,_0x13e3c2,_0x3b7448){return squel[_0xb19c('0xd')]()[_0xb19c('0xe')]('phone')['from'](_0x13e3c2)['join'](_0x14d90d,null,_0x14d90d+_0xb19c('0xf')+_0x13e3c2+'.'+_0xcc851f)[_0xb19c('0x10')](_0x13e3c2+'.'+_0xcc851f+_0xb19c('0x11')+_0x4de417+'.'+_0xcc851f)['where'](_0x14d90d+_0xb19c('0x12')+_0x3b7448[_0xb19c('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3be3f4,_0x547c77){promisesAdditionalPhones=[];promisesContact=[];return db[_0xb19c('0x14')]['query'](_0xb19c('0x15')+tempTableName)[_0xb19c('0x16')](function(_0x2d239c){if(_0x2d239c!==null){var _0x1eec19=[];for(var _0x11eea0=0x0;_0x11eea0<_0x2d239c['length'];_0x11eea0++){var _0x4364de=_0x2d239c[_0x11eea0];if(!_[_0xb19c('0x17')](_0x4364de[_0xb19c('0x18')])){if(!_[_0xb19c('0x17')](_0x4364de[_0xb19c('0x19')]))_0x1eec19['push'](insertAdditionalPhones(_0x4364de));promisesContact['push']({'contact':_0x4364de});}}}Promise[_0xb19c('0x1a')](_0x1eec19)[_0xb19c('0x1b')](function(){_0x3be3f4({'val':0x1});});})['catch'](function(_0x55cf87){logger[_0xb19c('0x1c')](_0x55cf87[_0xb19c('0x1d')]);});});}function insertAdditionalPhones(_0xe42795){return new Promise(function(_0x413646,_0x4ec4ae){var _0x3b4537=_0xe42795[_0xb19c('0x19')];if(_[_0xb19c('0x17')](_0x3b4537))_0x4ec4ae({'val':0x0});else{var _0x595773=_0x3b4537[_0xb19c('0x1e')](';');var _0x383878=[];orderBy=0x0;for(var _0x186f47=0x0;_0x186f47<_0x595773[_0xb19c('0x1f')];_0x186f47++){_0x383878[_0xb19c('0x20')](splitAdditionalPhone(_0xe42795['id'],_0x595773[_0x186f47]));}Promise['all'](_0x383878)['then'](function(){_0x413646({'val':_0x595773[_0xb19c('0x1f')]});});}});}function splitAdditionalPhone(_0x5c56cc,_0x7b3f7a){return new Promise(function(_0x562386,_0xdc2623){var _0x1fdc4e=_0x7b3f7a[_0xb19c('0x1e')](':');var _0x3542f7=_0x1fdc4e[0x0];var _0x41bde5=_0x1fdc4e[0x1];if(_0x41bde5!==''){var _0x1774fc=_0x41bde5[_0xb19c('0x1e')]('|');var _0xe06131=[];for(var _0x4bbb72=0x0;_0x4bbb72<_0x1774fc[_0xb19c('0x1f')];_0x4bbb72++){if(_0x1774fc[_0x4bbb72]!==''){var _0x259569=_[_0xb19c('0x21')](promisesAdditionalPhones,{'contactId':_0x5c56cc,'phone':_0x1774fc[_0x4bbb72]});if(_0x259569[_0xb19c('0x1f')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5c56cc,'contactTypeId':_0x3542f7,'phone':_0x1774fc[_0x4bbb72],'orderBy':orderBy});}}}_0x562386({'ok':0x1});}else _0x562386({'res':0x0});});}function createAdditionalPhone(_0x5d9bcd,_0x5f13fb,_0xaca236,_0x1dd187){var _0x2e3af4='';var _0x168045='';var _0x3ca5c4=_0xaca236['split']('§');_0x2e3af4=_0x3ca5c4[0x0];if(_0x3ca5c4[_0xb19c('0x1f')]==0x2)_0x168045=_0x3ca5c4[0x1];return new Promise(function(_0x1517bf,_0x12fc7c){return db[_0xb19c('0x22')][_0xb19c('0x23')]({'where':{'CmContactId':_0x5d9bcd,'item':_0x2e3af4}})[_0xb19c('0x1b')](function(_0x7b42f5){if(_0x7b42f5){return db['CmContactHasItem'][_0xb19c('0x24')]({'ItemTypeId':_0x5f13fb,'description':_0x168045,'OrderBy':_0x1dd187},{'where':{'CmContactId':_0x5d9bcd,'item':_0x2e3af4}})[_0xb19c('0x1b')](function(_0x4df9f4){_0x1517bf({'res':_0xb19c('0x25')});});}else{return db[_0xb19c('0x22')][_0xb19c('0x26')]({'CmContactId':_0x5d9bcd,'item':_0x2e3af4,'ItemTypeId':_0x5f13fb,'description':_0x168045,'OrderBy':_0x1dd187,'ItemClass':_0xb19c('0x27')})[_0xb19c('0x1b')](function(_0x5abece){_0x1517bf({'res':'inserted'});});}});});}function updateContact(_0x209dfc){return new Promise(function(_0x31028b,_0x1b22e2){var _0x53f9a1=_0x209dfc['id'];delete _0x209dfc['id'];return db[_0xb19c('0x28')][_0xb19c('0x24')](_0x209dfc,{'where':{'id':_0x53f9a1}})[_0xb19c('0x1b')](function(_0x21d0d6){updatedRows+=0x1;return db[_0xb19c('0x29')][_0xb19c('0x24')]({'phone':_0x209dfc[_0xb19c('0x18')]},{'where':{'ContactId':_0x53f9a1}})[_0xb19c('0x1b')](function(_0xa02709){_0x31028b({'ret':'OK'});});});});}function insertCmHopper(_0x52c79b,_0x36fd64,_0x2d8eff,_0x5a1fb7,_0x546e2e){var _0x17147b=[_0xb19c('0x2a'),_0xb19c('0x2b'),'cm_contacts.id',_0xb19c('0x2c'),_0x36fd64+'.'+_0x5a1fb7,'cm_contacts.createdAt',_0xb19c('0x2d'),'cm_contacts.priority',_0xb19c('0x2e'),'\x22'+_0x546e2e+'\x22'];return squel[_0xb19c('0x2f')]()[_0xb19c('0x30')](_0xb19c('0x31'))[_0xb19c('0x32')]([_0xb19c('0x18'),_0xb19c('0x33'),_0xb19c('0x34'),_0xb19c('0x35'),_0x5a1fb7,_0xb19c('0x36'),_0xb19c('0x37'),'priority',_0xb19c('0x38'),_0xb19c('0x39')],squel[_0xb19c('0xd')]()[_0xb19c('0x3a')](_0x17147b)[_0xb19c('0x3b')](_0x36fd64)[_0xb19c('0x13')]('cm_contacts',null,_0xb19c('0x3c')+_0x36fd64+_0xb19c('0x3d'))['join'](_0x2d8eff,null,_0x2d8eff+_0xb19c('0xf')+_0x36fd64+'.'+_0x5a1fb7)['where'](_0x36fd64+_0xb19c('0x3e'),_0x52c79b)[_0xb19c('0x10')](_0xb19c('0x3f'),NOW)[_0xb19c('0x10')](_0xb19c('0x40'),selectNotIn(_0x36fd64,_0x2d8eff,_0x5a1fb7,_0xb19c('0x31'),[_0xb19c('0x41'),'\x22onlyIfOpen\x22']))[_0xb19c('0x10')](_0xb19c('0x40'),selectNotIn(_0x36fd64,_0x2d8eff,_0x5a1fb7,'cm_hopper',[_0xb19c('0x41')])))[_0xb19c('0x42')]();}function insertCmHopperBlack(_0x25acab,_0x3b5161,_0x56f3a6,_0x48b108){var _0x49df44=[_0xb19c('0x2a'),_0xb19c('0x43'),_0xb19c('0x2c'),_0x3b5161+'.'+_0x48b108,_0xb19c('0x44'),_0xb19c('0x2d')];return squel[_0xb19c('0x2f')]()[_0xb19c('0x30')](_0xb19c('0x45'))[_0xb19c('0x32')](['phone',_0xb19c('0x34'),_0xb19c('0x35'),_0x48b108,_0xb19c('0x36'),_0xb19c('0x37')],squel[_0xb19c('0xd')]()[_0xb19c('0x3a')](_0x49df44)[_0xb19c('0x3b')](_0x3b5161)[_0xb19c('0x13')](_0xb19c('0x46'),null,_0xb19c('0x3c')+_0x3b5161+_0xb19c('0x3d'))['join'](_0x56f3a6,null,_0x56f3a6+_0xb19c('0xf')+_0x3b5161+'.'+_0x48b108)[_0xb19c('0x10')](_0x3b5161+_0xb19c('0x3e'),_0x25acab)[_0xb19c('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xb19c('0x40'),squel[_0xb19c('0xd')]()[_0xb19c('0xe')](_0xb19c('0x18'))['from'](_0xb19c('0x45'))[_0xb19c('0x10')]('ListId\x20=\x20?',_0x25acab)['where'](_0x48b108+_0xb19c('0x47'),_0x3b5161+'.'+_0x48b108)))[_0xb19c('0x42')]();}function insertCmHopperAdditionalPhones(_0x272d6a){var _0x7a2887=[_0xb19c('0x48'),_0xb19c('0x49'),_0xb19c('0x4a'),_0xb19c('0x4b'),_0xb19c('0x4c')];return squel['insert']()['into'](_0xb19c('0x4d'))[_0xb19c('0x32')](['CmHopperId',_0xb19c('0x18'),_0xb19c('0x4e'),_0xb19c('0x36'),_0xb19c('0x37')],squel[_0xb19c('0xd')]()[_0xb19c('0x3a')](_0x7a2887)[_0xb19c('0x3b')]('cm_hopper')[_0xb19c('0x13')](_0xb19c('0x46'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xb19c('0x13')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xb19c('0x4f'),_0x272d6a)[_0xb19c('0x10')](_0xb19c('0x3f'),NOW))[_0xb19c('0x42')]();}function insertCmContact(_0xcb0169,_0x5f1588,_0x207741,_0x11ef00){var _0x33a7df=_[_0xb19c('0x50')](_[_0xb19c('0x51')](_0x11ef00),['ListId',_0xb19c('0x52'),'createdAt',_0xb19c('0x37')]);return squel['insert']()['into']('cm_contacts')[_0xb19c('0x32')](_0x33a7df,squel['select']()[_0xb19c('0x3a')](_0x33a7df)[_0xb19c('0x3b')](_0x5f1588)[_0xb19c('0x10')]('('+_0x207741[_0xb19c('0x13')](',')+_0xb19c('0x53'),squel['select']()[_0xb19c('0x3a')](_0x207741)[_0xb19c('0x3b')]('cm_contacts')[_0xb19c('0x10')](_0xb19c('0x54'),_0xcb0169))[_0xb19c('0x10')](_0xb19c('0x55'),squel[_0xb19c('0xd')]()[_0xb19c('0xe')](_0xb19c('0x56'),'min_id')[_0xb19c('0x3b')](_0x5f1588)[_0xb19c('0x57')](_0x207741[_0xb19c('0x13')](','))))['toString']();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4c8e9c){logger[_0xb19c('0x1c')](_0x4c8e9c[_0xb19c('0x1d')]);process[_0xb19c('0x58')](0x1);}function handleError(_0x3e9851,_0x43fb4f){stats[_0xb19c('0x59')][_0xb19c('0x20')]({'name':_0x43fb4f[_0xb19c('0x5a')],'message':_0x43fb4f[_0xb19c('0x1d')],'row':_0x3e9851});}function handleQuery(_0x4e0078){logger[_0xb19c('0x5b')](_0x4e0078);return db['sequelize']['query'](_0x4e0078)['spread'](function(_0x405b13){results[_0xb19c('0x20')](_0x405b13);})[_0xb19c('0x5c')](function(_0x3cf5b1){logger[_0xb19c('0x1c')](_0x3cf5b1[_0xb19c('0x1d')]);});}function main(_0x289bc9,_0x398695,_0x3db9f0,_0x375750){logger[_0xb19c('0x5b')](_0xb19c('0x5d'),_0x289bc9,JSON['stringify'](_0x398695));process['send'](_0xb19c('0x5e'));var _0x1f0397=_0x398695[_0xb19c('0x5f')];var _0x26dc2a=_[_0xb19c('0x60')](_0x1f0397);var _0x275ce3=_0x398695['socket_timestamp'];var _0x21acd1=path[_0xb19c('0x13')](config[_0xb19c('0x61')],_0xb19c('0x62'),_0x275ce3+_0xb19c('0x63'));logger[_0xb19c('0x5b')](_0xb19c('0x64'),_0x398695);db[_0xb19c('0x65')][_0xb19c('0x66')]({'raw':!![],'attributes':['id',_0xb19c('0x67')]})['then'](function(_0x11679d){for(var _0x49c872=0x0;_0x49c872<_0x11679d[_0xb19c('0x1f')];_0x49c872++){if(_0x11679d[_0x49c872][_0xb19c('0x67')]in _0x1f0397){contactItemTypes[_0xb19c('0x20')](_0x11679d[_0x49c872]);delete _0x26dc2a[_0x11679d[_0x49c872][_0xb19c('0x67')]];hasAdditionalPhones=!![];}for(var _0x14cf90 in _0x1f0397){if(_0x11679d[_0x49c872][_0xb19c('0x67')]+'_description'===_0x14cf90){phoneDescriptions['push']({'itemTypeId':_0x11679d[_0x49c872]['id'],'description':_0x14cf90});delete _0x26dc2a[_0x14cf90];}}}if(hasAdditionalPhones)_0x26dc2a[_0xb19c('0x19')]='';var _0x46fbd8=_[_0xb19c('0x51')](_0x26dc2a)[_0xb19c('0x13')]();logger[_0xb19c('0x5b')](_0xb19c('0x68'),_0x46fbd8);fs[_0xb19c('0x69')](_0x21acd1,_0x46fbd8+'\x0a');Papa['parse'](fs[_0xb19c('0x6a')](_0x289bc9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c4e77,_0x57e3e3){try{for(var _0x97c099=0x0,_0x25c53c=[];_0x97c099<_0x5c4e77[_0xb19c('0x6b')][_0xb19c('0x1f')];_0x97c099++){stats[_0xb19c('0x6c')]+=0x1;if(_0x5c4e77[_0xb19c('0x59')][_0x97c099]){handleError(_0x5c4e77[_0xb19c('0x6b')][_0x97c099],_0x5c4e77[_0xb19c('0x59')][_0x97c099]);}else{var _0x56f4ae=[];var _0x36c7a8=[];var _0xc7fa01={};for(var _0x52c132 in _0x1f0397){let _0x467188=contactItemTypes[_0xb19c('0x6d')](_0x4a1f75=>_0x4a1f75[_0xb19c('0x67')]===_0x52c132);let _0x375f96=contactItemTypes[_0xb19c('0x6d')](_0x918aee=>_0x918aee['name']+_0xb19c('0x6e')===_0x52c132);if(_[_0xb19c('0x17')](_0x467188)&&_['isNil'](_0x375f96)){if(_0x1f0397[_0xb19c('0x6f')](_0x52c132)){if(_0x5c4e77[_0xb19c('0x6b')][_0x97c099][_0x1f0397[_0x52c132]]){var _0xfada18=_['trim'](_0x5c4e77[_0xb19c('0x6b')][_0x97c099][_0x1f0397[_0x52c132]][_0xb19c('0x70')](/"/g,'\x27'));switch(_0x52c132){case _0xb19c('0x33'):var _0x488d63=moment(_0xfada18,_0xb19c('0x71'),!![]);if(_0x488d63[_0xb19c('0x72')]()){_0x25c53c[_0xb19c('0x20')]('\x22'+_0xfada18+'\x22');}else{_0x56f4ae[_0xb19c('0x20')](_0xb19c('0x73'));}break;case _0xb19c('0x74'):var _0x39187f=parseInt(_0xfada18);_0xfada18=_[_0xb19c('0x75')](_0x39187f)||_0x39187f<0x0||_0x39187f>0x4?_0x375750?0x3:0x2:_0x39187f;_0x25c53c[_0xb19c('0x20')]('\x22'+_0xfada18+'\x22');break;case _0xb19c('0x38'):var _0x164034=parseInt(_0xfada18);if(_[_0xb19c('0x76')](_0x164034)&&_[_0xb19c('0x77')](_0x3db9f0,_0x164034)){_0x25c53c[_0xb19c('0x20')]('\x22'+_0x164034+'\x22');}else{_0x56f4ae['push'](_0xb19c('0x78'));}break;case'email':if(isEmail(_0xfada18)){_0x25c53c[_0xb19c('0x20')]('\x22'+_0xfada18+'\x22');}else{_0x56f4ae[_0xb19c('0x20')]('email\x20wrong\x20format');}break;case _0xb19c('0x79'):var _0x237ed1=moment(_0xfada18,_0xb19c('0x7a'),!![]);if(_0x237ed1[_0xb19c('0x72')]()){_0x25c53c['push']('\x22'+_0xfada18+'\x22');}else{_0x56f4ae[_0xb19c('0x20')](_0xb19c('0x7b'));}break;default:_0x25c53c[_0xb19c('0x20')]('\x22'+_0xfada18+'\x22');}}else{switch(_0x52c132){case _0xb19c('0x7c'):case _0xb19c('0x18'):_0x56f4ae[_0xb19c('0x20')](_0x52c132+'\x20not\x20specified');break;default:_0x25c53c[_0xb19c('0x20')]('\x22\x22');}}}}else{var _0x26957f='';if(!_[_0xb19c('0x17')](_0x467188)){if(!_0xc7fa01[_0xb19c('0x6f')](_0x467188['id'])){for(var _0x5607c6=0x0;_0x5607c6<_0x1f0397[_0x52c132][_0xb19c('0x1f')];_0x5607c6++){var _0xfada18=_[_0xb19c('0x7d')](_0x5c4e77[_0xb19c('0x6b')][_0x97c099][_0x1f0397[_0x52c132][_0x5607c6]][_0xb19c('0x70')](/"/g,'\x27'));var _0x379319=phoneDescriptions[_0xb19c('0x6d')](_0x27bb8e=>_0x27bb8e['itemTypeId']===_0x467188['id']);if(!_[_0xb19c('0x17')](_0x379319)){var _0x134b6b=_['trim'](_0x5c4e77[_0xb19c('0x6b')][_0x97c099][_0x1f0397[_0x379319[_0xb19c('0x7e')]][0x0]][_0xb19c('0x70')](/"/g,'\x27'));if(!_[_0xb19c('0x17')](_0x134b6b))_0xfada18=_0xfada18+'§'+_0x134b6b;}if(_0x26957f=='')_0x26957f=_0xfada18;else _0x26957f+='|'+_0xfada18;}_0x36c7a8[_0xb19c('0x20')](_0x467188['id']+':'+_0x26957f);_0xc7fa01[_0x467188['id']]=0x1;}}}}if(hasAdditionalPhones){_0x25c53c[_0xb19c('0x20')]('\x22'+_0x36c7a8[_0xb19c('0x13')](';')+'\x22');}if(_0x56f4ae[_0xb19c('0x1f')]){handleError(_0x5c4e77[_0xb19c('0x6b')][_0x97c099],{'code':'SystemRow','message':_0x56f4ae['join']()});}else{fs[_0xb19c('0x7f')](_0x21acd1,_0x25c53c[_0xb19c('0x13')]()+'\x0a');}_0x25c53c=[];}if(!(stats[_0xb19c('0x6c')]%0xc8)){socket['emit'](_0xb19c('0x80')+_0x275ce3,stats);stats[_0xb19c('0x59')]=[];}}if(stopped){logger[_0xb19c('0x5b')]('Abort\x20parser');_0x57e3e3[_0xb19c('0x81')]();}}catch(_0x2ab734){handleError(_0x5c4e77[_0xb19c('0x6b')][_0x97c099],{'code':'SystemError','message':_0x2ab734[_0xb19c('0x1d')]});logger['error'](_0xb19c('0x82'),_0x2ab734[_0xb19c('0x1d')]);}},'complete':function(){try{var _0x216bd9=[];var _0x5bbe05=tempTableName;_0x216bd9[_0xb19c('0x20')](_0xb19c('0x83')+_0x5bbe05+_0xb19c('0x84'));logger[_0xb19c('0x5b')](_0xb19c('0x85'),contactItemTypes[_0xb19c('0x1f')]);var _0x234449=util[_0xb19c('0xa')](_0xb19c('0x86'),_0x21acd1,_0x5bbe05,_0x46fbd8,_0x398695[_0xb19c('0x35')],_0x398695[_0xb19c('0x52')]||null,NOW,NOW);if(_[_0xb19c('0x17')](_0x1f0397[_0xb19c('0x33')])){_0x234449+=',\x20scheduledAt\x20=\x20NOW()';}_0x216bd9[_0xb19c('0x20')](_0x234449);BPromise[_0xb19c('0x87')](_0x216bd9,handleQuery)[_0xb19c('0x1b')](function(_0xea6a8f){BPromise['all']([handleAdditionalPhones()])[_0xb19c('0x1b')](function(){_0x216bd9=[];for(var _0x5b2df6=0x0;_0x5b2df6\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','color','from','getInteractionFK','_interactions','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','me.','tools_tags','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','isEmail','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','text','value','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','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?','ContactId','buildExpression','start','Tag','tags','clause','ids','User','user','body','plainBody','some','compact','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','filter','get','chat','agent','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus'];(function(_0x50d191,_0x5b718c){var _0x3ae99b=function(_0x379816){while(--_0x379816){_0x50d191['push'](_0x50d191['shift']());}};_0x3ae99b(++_0x5b718c);}(_0xc548,0x16f));var _0x8c54=function(_0x47dbee,_0x226fae){_0x47dbee=_0x47dbee-0x0;var _0x121d46=_0xc548[_0x47dbee];return _0x121d46;};'use strict';var _=require(_0x8c54('0x0'));var squel=require(_0x8c54('0x1'));var as=require(_0x8c54('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0x8c54('0x3'))['updateInteraction'];var utils=require(_0x8c54('0x4'));var db=require(_0x8c54('0x5'))['db'];function skipInteractionsQuery(_0x23016f,_0x2efa29,_0x42b848){var _0x45509b=![];var _0x3b3228=utils[_0x8c54('0x6')](_0x23016f);if(_0x2efa29[_0x8c54('0x7')]==='agent'&&!_0x42b848[_0x8c54('0x8')]&&!_0x42b848[_0x3b3228]){_0x45509b=!![];}return _0x45509b;}function getTagsQuery(){return squel[_0x8c54('0x9')]()[_0x8c54('0xa')]('id')[_0x8c54('0xa')](_0x8c54('0xb'))[_0x8c54('0xa')](_0x8c54('0xc'))[_0x8c54('0xd')]('tools_tags');}function getUsersQuery(_0x2c97a0,_0x2b211d){var _0x314223=utils[_0x8c54('0xe')](_0x2c97a0);var _0x3e554d='user_has_'+_0x2c97a0+_0x8c54('0xf');var _0x456e3c=squel[_0x8c54('0x9')]()[_0x8c54('0xa')]('u.id')[_0x8c54('0xa')](_0x8c54('0x10'))[_0x8c54('0xa')](_0x8c54('0x11')+_0x314223)['from'](_0x3e554d,'ui')[_0x8c54('0x12')]('users','u',_0x8c54('0x13'));if(_0x2b211d[_0x8c54('0x14')]>0x0){_0x456e3c[_0x8c54('0x15')](_0x8c54('0x11')+_0x314223+_0x8c54('0x16'),_[_0x8c54('0x17')](_0x2b211d,'id'));}return _0x456e3c;}function getInteractionsQuery(_0x16dcb6){var _0x3e026f=utils[_0x8c54('0x18')](_0x16dcb6);var _0x300569=utils['getAccountFK'](_0x16dcb6);var _0x26edc3=utils[_0x8c54('0xe')](_0x16dcb6);return squel[_0x8c54('0x9')]()[_0x8c54('0xd')](_0x3e026f[_0x8c54('0x19')],'i')[_0x8c54('0x12')](_0x8c54('0x1a'),'c',_0x8c54('0x1b'))[_0x8c54('0x12')]('users','o','o.id\x20=\x20i.UserId')[_0x8c54('0x12')](_0x3e026f[_0x8c54('0x1c')],'a',_0x8c54('0x1d')+_0x300569)[_0x8c54('0x12')](_0x3e026f[_0x8c54('0x1e')],'me',_0x8c54('0x1f')+_0x26edc3+'\x20=\x20i.id')[_0x8c54('0x12')](_0x3e026f['interactionsTags'],'it','it.'+_0x26edc3+'\x20=\x20i.id')[_0x8c54('0x12')](_0x8c54('0x20'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x5c36ef={'body':squel[_0x8c54('0x21')](),'contact':squel[_0x8c54('0x21')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x8c54('0x21')](),'read':squel[_0x8c54('0x21')](),'tags':{'clause':squel[_0x8c54('0x21')](),'ids':null},'user':squel[_0x8c54('0x21')]()};return _0x5c36ef;}function parseTagParameter(_0x32305a){var _0x364e30=squel[_0x8c54('0x21')]();if(_0x32305a){var _0x2f7fe0=utils[_0x8c54('0x22')](_0x32305a);_0x2f7fe0[_0x8c54('0x23')](function(_0x57ed1f){_0x364e30['or'](_0x8c54('0x24'),'%,'+_0x57ed1f+',%');});}return _0x364e30;}function parseReadParameter(_0x4791e1){var _0x246153='';if(_0x4791e1){_0x246153=_0x8c54('0x25');if(_0x4791e1==='1'){_0x246153=_0x246153[_0x8c54('0x26')](_0x8c54('0x27'),'=');}else{_0x246153=_0x246153[_0x8c54('0x26')](_0x8c54('0x27'),'>');}}return _0x246153;}function parseSearchFilter(_0x26efd3,_0x7e5832){var _0xb26c4e=squel['expr']();if(_0x7e5832){var _0x36cd4d=_0x7e5832[_0x8c54('0x26')]('\x5c','\x5c\x5c')[_0x8c54('0x26')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x36cd4d)){_0xb26c4e['or'](_0x8c54('0x28'),_0x36cd4d+'%');if([_0x8c54('0x29'),_0x8c54('0x2a')]['includes'](_0x26efd3)){_0xb26c4e['or'](_0x8c54('0x2b'),_0x36cd4d+'%');}else if(_0x26efd3===_0x8c54('0x2c')){_0xb26c4e['or']('i.fax\x20LIKE\x20?',_0x36cd4d+'%');}else if(_0x26efd3==='openchannel'){_0xb26c4e['or']('i.from\x20LIKE\x20?',_0x36cd4d+'%');}}else if(_0x26efd3==='mail'&&qs[_0x8c54('0x2d')](_0x36cd4d)){_0xb26c4e['or']('c.email\x20LIKE\x20?',_0x36cd4d+'%');}else{if(_0x26efd3===_0x8c54('0x2e')){_0xb26c4e['or'](_0x8c54('0x2f'),qs['getFullTextValue'](_0x36cd4d,!![]))['or'](_0x8c54('0x30'),qs[_0x8c54('0x31')](_0x36cd4d));}else if(_0x26efd3!==_0x8c54('0x2c')){_0xb26c4e['or'](_0x8c54('0x32'),qs[_0x8c54('0x31')](_0x36cd4d));}_0xb26c4e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8c54('0x31')](_0x36cd4d,!![]),null);}}return _0xb26c4e;}function parseAdvancedSearchFilter(_0x25cf60,_0x5ce473){var _0x5a1362=getSqlClauses();var _0x28e450=as[_0x8c54('0x33')](_0x25cf60);var _0x3c1ddd=_0x28e450[_0x8c54('0x34')];for(var _0x4bc2e0=0x0;_0x4bc2e0<_0x28e450[_0x8c54('0x35')]['length'];_0x4bc2e0++){var _0x35b1b0=_0x28e450[_0x8c54('0x35')][_0x4bc2e0];var _0x1a8a01='i';var _0x4db16e=_[_0x8c54('0x36')](_0x5ce473,[_0x8c54('0xb'),_0x35b1b0[_0x8c54('0xa')]]);if(_0x4db16e){var _0x16b5b6=as['buildExpression'](_0x1a8a01,_0x4db16e[_0x8c54('0x37')],_0x35b1b0);_0x5a1362['default'][_0x3c1ddd](_0x16b5b6[_0x8c54('0x38')],_0x16b5b6[_0x8c54('0x39')]['start'],_0x16b5b6[_0x8c54('0x39')][_0x8c54('0x3a')]);}else{switch(_0x35b1b0['field']){case _0x8c54('0x3b'):var _0x77ffb2=parseReadParameter(_0x35b1b0[_0x8c54('0x39')]);_0x5a1362[_0x8c54('0x3c')][_0x8c54('0x3d')](_0x77ffb2);break;case _0x8c54('0x3e'):if(_0x35b1b0[_0x8c54('0x3f')]===_0x8c54('0x40')){if(_0x35b1b0[_0x8c54('0x39')][_0x8c54('0x41')]('\x20')[_0x8c54('0x14')]>0x1){_0x5a1362[_0x8c54('0x42')][_0x3c1ddd](_0x8c54('0x43'),qs['getFullTextValue'](_0x35b1b0[_0x8c54('0x39')],!![]),null);}else{var _0x3da65f='%'+_0x35b1b0['value']+'%';_0x5a1362['contact'][_0x3c1ddd](_0x8c54('0x44'),_0x3da65f,_0x3da65f,_0x3da65f);}}else{_0x4db16e=_['find'](_0x5ce473,[_0x8c54('0xb'),_0x8c54('0x45')]);_0x35b1b0[_0x8c54('0xa')]=_0x8c54('0x45');_0x16b5b6=as[_0x8c54('0x46')](_0x1a8a01,_0x4db16e[_0x8c54('0x37')],_0x35b1b0);_0x5a1362[_0x8c54('0x42')][_0x3c1ddd](_0x16b5b6[_0x8c54('0x38')],_0x16b5b6[_0x8c54('0x39')][_0x8c54('0x47')],_0x16b5b6['value']['end']);}break;case _0x8c54('0x48'):var _0x520f99=_0x35b1b0[_0x8c54('0x39')][_0x8c54('0x41')](',')[_0x8c54('0x17')](function(_0x21c551){return Number(_0x21c551);});var _0x24c6f2=parseTagParameter(_0x520f99);_0x5a1362[_0x8c54('0x49')][_0x8c54('0x4a')][_0x8c54('0x3d')](_0x24c6f2);_0x5a1362[_0x8c54('0x49')][_0x8c54('0x4b')]=_0x520f99;break;case _0x8c54('0x4c'):if(_0x35b1b0[_0x8c54('0x3f')]==='$substring'){_0x5a1362[_0x8c54('0x4d')][_0x3c1ddd]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x35b1b0[_0x8c54('0x39')]+'%',null);}else{_0x4db16e=_[_0x8c54('0x36')](_0x5ce473,[_0x8c54('0xb'),'UserId']);_0x35b1b0['field']='UserId';_0x16b5b6=as['buildExpression'](_0x1a8a01,_0x4db16e[_0x8c54('0x37')],_0x35b1b0);_0x5a1362[_0x8c54('0x4d')][_0x3c1ddd](_0x16b5b6['text'],_0x16b5b6[_0x8c54('0x39')][_0x8c54('0x47')],_0x16b5b6[_0x8c54('0x39')][_0x8c54('0x3a')]);}break;case _0x8c54('0x4e'):case _0x8c54('0x4f'):_0x16b5b6=as[_0x8c54('0x46')]('me',null,_0x35b1b0);_0x5a1362[_0x8c54('0x4e')][_0x3c1ddd](_0x16b5b6[_0x8c54('0x38')],_0x16b5b6[_0x8c54('0x39')][_0x8c54('0x47')],_0x16b5b6['value']['end']);break;}}}return _0x5a1362;}function parseModelFields(_0x343069,_0x291cc1,_0x1b3350){var _0x53ee12=utils[_0x8c54('0x6')](_0x343069);var _0x2c4b78=squel[_0x8c54('0x21')]();var _0x18ab5e=_(_0x291cc1)['keys']()[_0x8c54('0x17')](function(_0x4d203a){return _[_0x8c54('0x50')](_0x1b3350,['name',_0x4d203a])?_0x4d203a:undefined;})[_0x8c54('0x51')]()[_0x8c54('0x39')]();if(_0x18ab5e['length']>0x0){_0x18ab5e[_0x8c54('0x23')](function(_0x5ab84a){if(_0x5ab84a===_0x53ee12){_0x2c4b78[_0x8c54('0x3d')]('i.'+_0x53ee12+_0x8c54('0x16'),[][_0x8c54('0x52')](_0x291cc1[_0x5ab84a]));}else if(_0x5ab84a===_0x8c54('0x53')){var _0x3813f5=JSON[_0x8c54('0x54')](_0x291cc1[_0x5ab84a])[_0x8c54('0x55')];var _0x8e11b8=JSON[_0x8c54('0x54')](_0x291cc1[_0x5ab84a])['$lte'];_0x2c4b78[_0x8c54('0x3d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3813f5,_0x8e11b8);}else{if(_0x291cc1[_0x5ab84a]===_0x8c54('0x56')){_0x2c4b78['and']('i.'+_0x5ab84a+_0x8c54('0x57'));}else{_0x2c4b78['and']('i.'+_0x5ab84a+_0x8c54('0x58'),_0x291cc1[_0x5ab84a]);}}});}return _0x2c4b78;}function parseQueryParameters(_0x3f77e3,_0x3212fd,_0x29520b){var _0x57070a=getSqlClauses();return Promise[_0x8c54('0x59')]()['then'](function(){return parseModelFields(_0x3f77e3,_0x3212fd,_0x29520b);})[_0x8c54('0x5a')](function(_0x614b6e){_0x57070a['fields'][_0x8c54('0x3d')](_0x614b6e);return parseReadParameter(_0x3212fd['read']);})[_0x8c54('0x5a')](function(_0x59862a){_0x57070a[_0x8c54('0x3c')][_0x8c54('0x3d')](_0x59862a);return parseTagParameter(_0x3212fd[_0x8c54('0x5b')]);})['then'](function(_0x2db324){_0x57070a[_0x8c54('0x49')][_0x8c54('0x4a')]['and'](_0x2db324);return parseSearchFilter(_0x3f77e3,_0x3212fd[_0x8c54('0x5c')]);})[_0x8c54('0x5a')](function(_0x246de9){_0x57070a['filter']=_0x246de9;return _0x57070a;});}function checkAccountsRestrictions(_0x19e2de,_0x492961,_0x5d0a6c){var _0x15bfc9=utils[_0x8c54('0x6')](_0x19e2de);var _0x5c4226=_0x8c54('0x5d')+_['capitalize'](_0x19e2de)+(_0x19e2de===_0x8c54('0x5e')?'Websites':'Accounts');var _0x37b8a4=squel[_0x8c54('0x21')]();return Promise[_0x8c54('0x59')]()[_0x8c54('0x5a')](function(){if(_0x5d0a6c[_0x8c54('0x8')]&&_0x492961['role']===_0x8c54('0x5f')){return _0x492961[_0x5c4226]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2d1523){if(_0x2d1523){if(_0x2d1523['length']===0x0){_0x37b8a4[_0x8c54('0x3d')]('i.'+_0x15bfc9+_0x8c54('0x57'));}else{_0x37b8a4[_0x8c54('0x3d')]('i.'+_0x15bfc9+'\x20IN\x20?',_['map'](_0x2d1523,'id'));}}else if(!_0x5d0a6c[_0x15bfc9]){_0x37b8a4[_0x8c54('0x3d')]('i.'+_0x15bfc9+'\x20IS\x20NOT\x20NULL');}})[_0x8c54('0x5a')](function(){return _0x37b8a4;});}function getClosedOrderClause(_0x9347b8,_0x4f09ac){var _0x542e62='';var _0x48019c=[_0x8c54('0x60'),_0x8c54('0x61'),_0x8c54('0x62')];if(_0x9347b8==='mail'){_0x48019c[_0x8c54('0x63')](_0x8c54('0x64'));}if(_0x4f09ac['closed']==='0'&&_0x9347b8===_0x8c54('0x2e')){_0x542e62=_0x8c54('0x64');}else{if(_0x4f09ac[_0x8c54('0x65')]==='1'){_0x48019c[_0x8c54('0x66')]();}_0x542e62='CONCAT_WS(\x27\x27,\x20'+_0x48019c[_0x8c54('0x67')](',\x20')+')';}return _0x542e62;}function getFilteredInteractions(_0xe84f2d,_0xf66aa8,_0x151f4d,_0x509922){var _0x2df44c=utils[_0x8c54('0xe')](_0xe84f2d);var _0x42807e=_[_0x8c54('0x68')](_0xe84f2d)+_0x8c54('0x69');var _0xdce00a=[];var _0x3532a2=getTagsQuery();var _0x161864={'type':db['Sequelize'][_0x8c54('0x6a')][_0x8c54('0x6b')],'raw':!![]};var _0x6027a1=[];var _0x2ab42c=[];return db[_0x8c54('0x6c')][_0x8c54('0x6d')](_0x3532a2[_0x8c54('0x6e')](),_0x161864)[_0x8c54('0x5a')](function(_0x116b02){_0xdce00a=_['keyBy'](_0x116b02,'id');_0x161864=_[_0x8c54('0x6f')](_0x161864,{'model':db[_0x42807e],'mapToModel':!![],'nest':!![]});if(_0x151f4d[_0x8c54('0x70')]){_0x509922['attributes']['forEach'](function(_0xb61c46){_0xf66aa8[_0x8c54('0xa')]('i.'+_0xb61c46);});}else{_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x71'),'unreadMessages');_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x72'),_0x8c54('0x73'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x74'),_0x8c54('0x75'));if(_0xe84f2d===_0x8c54('0x2e')){_0xf66aa8[_0x8c54('0xa')]('a.email',_0x8c54('0x76'));_0xf66aa8['field'](_0x8c54('0x77'),_0x8c54('0x78'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x79'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x7a'));_0xf66aa8['field']('i.updatedAt');_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x7b'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x7c'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x7d'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x7e'));_0xf66aa8[_0x8c54('0xa')]('i.lastMsgDirection');_0xf66aa8[_0x8c54('0xa')]('i.subject');_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x62'));_0xf66aa8['field'](_0x8c54('0x61'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x60'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x64'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x7f'));_0xf66aa8['field'](_0x8c54('0x80'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x81'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x82'));}else if(_0xe84f2d===_0x8c54('0x83')){_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x84'),'contactName');}else{_0xf66aa8[_0x8c54('0xa')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x8c54('0x78'));}if(_0xe84f2d!=='mail'){_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x85'));}_0xf66aa8[_0x8c54('0xa')]('c.firstName',_0x8c54('0x86'));_0xf66aa8['field']('c.lastName',_0x8c54('0x87'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x88'),_0x8c54('0x89'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x8a'),_0x8c54('0x8b'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x8c'),_0x8c54('0x8d'));_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x8e'),'Contact.fax');_0xf66aa8[_0x8c54('0xa')](_0x8c54('0x8f'),_0x8c54('0x90'));_0xf66aa8['field'](_0x8c54('0x91'),_0x8c54('0x92'));_0xf66aa8['field'](_0x8c54('0x93'),_0x8c54('0x94'));}if(_0x509922[_0x8c54('0x95')]){_0xf66aa8['limit'](_0x509922[_0x8c54('0x95')]);}if(_0x509922[_0x8c54('0x96')]){_0xf66aa8['offset'](_0x509922[_0x8c54('0x96')]);}return db[_0x8c54('0x6c')]['query'](_0xf66aa8['toString'](),_0x161864);})['then'](function(_0x4c46af){_0x6027a1=_0x4c46af;var _0x8303d=getUsersQuery(_0xe84f2d,_0x6027a1);return db['sequelize'][_0x8c54('0x6d')](_0x8303d[_0x8c54('0x6e')](),_0x161864);})[_0x8c54('0x5a')](function(_0x1bfdf6){_0x2ab42c=_[_0x8c54('0x97')](_0x1bfdf6,_0x2df44c);if(_0xe84f2d==='mail'){return db[_0x8c54('0x98')][_0x8c54('0x99')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x8c54('0x5a')](function(_0x3d0e4b){var _0x2b06c2=_0x3d0e4b?_0x3d0e4b[_0x8c54('0x9a')]:undefined;var _0xa0129b=_0x6027a1['map'](function(_0x59b6f9){return updateInteraction(_0x59b6f9,_0xdce00a,_0x2ab42c,_0x2b06c2);});return Promise['all'](_0xa0129b);});}function countFilteredInteractions(_0x5a6134,_0x4473bb){var _0x1aa041=_0x5a6134['clone']();_0x1aa041[_0x8c54('0xa')]('COUNT(*)');_0x1aa041[_0x8c54('0xa')](_0x8c54('0x71'),_0x8c54('0x3b'));var _0x22176c=utils[_0x8c54('0x22')](_0x4473bb);if(!_['isEmpty'](_0x22176c)){_0x1aa041[_0x8c54('0x15')](_0x8c54('0x9b'),_0x22176c);}var _0x49b32e={'type':db['Sequelize'][_0x8c54('0x6a')][_0x8c54('0x6b')],'raw':!![]};return db['sequelize'][_0x8c54('0x6d')](_0x1aa041[_0x8c54('0x6e')](),_0x49b32e);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xf150=['select','field','name','from','tools_tags','getInteractionFK','user_has_','u.id','ui.','users','length','\x20IN\x20?','map','getAccountFK','interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','default','text','start','value','end','unreadMessages','read','Contact','operator','$substring','split','contact','type','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','and','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','then','fields','tag','filter','get','chat','Accounts','resolve','role','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','a.email','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','all','clone','isEmpty','where','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','agent'];(function(_0x2f51e4,_0x43de4c){var _0x26fc81=function(_0x3beb0e){while(--_0x3beb0e){_0x2f51e4['push'](_0x2f51e4['shift']());}};_0x26fc81(++_0x43de4c);}(_0xf150,0x1de));var _0x0f15=function(_0x46812b,_0x3269b9){_0x46812b=_0x46812b-0x0;var _0x4dc3ab=_0xf150[_0x46812b];return _0x4dc3ab;};'use strict';var _=require(_0x0f15('0x0'));var squel=require(_0x0f15('0x1'));var as=require(_0x0f15('0x2'));var qs=require(_0x0f15('0x3'));var updateInteraction=require(_0x0f15('0x4'))['updateInteraction'];var utils=require(_0x0f15('0x5'));var db=require(_0x0f15('0x6'))['db'];function skipInteractionsQuery(_0xa993b5,_0x578e10,_0x81bfd){var _0x386adb=![];var _0x501c65=utils['getAccountFK'](_0xa993b5);if(_0x578e10['role']===_0x0f15('0x7')&&!_0x81bfd['search']&&!_0x81bfd[_0x501c65]){_0x386adb=!![];}return _0x386adb;}function getTagsQuery(){return squel[_0x0f15('0x8')]()[_0x0f15('0x9')]('id')['field'](_0x0f15('0xa'))['field']('color')[_0x0f15('0xb')](_0x0f15('0xc'));}function getUsersQuery(_0x32e36f,_0x40e429){var _0x2948ce=utils[_0x0f15('0xd')](_0x32e36f);var _0x72ba68=_0x0f15('0xe')+_0x32e36f+'_interactions';var _0x528bda=squel[_0x0f15('0x8')]()['field'](_0x0f15('0xf'))[_0x0f15('0x9')]('u.fullname')[_0x0f15('0x9')](_0x0f15('0x10')+_0x2948ce)['from'](_0x72ba68,'ui')['left_join'](_0x0f15('0x11'),'u','u.id\x20=\x20ui.UserId');if(_0x40e429[_0x0f15('0x12')]>0x0){_0x528bda['where']('ui.'+_0x2948ce+_0x0f15('0x13'),_[_0x0f15('0x14')](_0x40e429,'id'));}return _0x528bda;}function getInteractionsQuery(_0x5bf9cf){var _0x247cdd=utils['getInteractionsTables'](_0x5bf9cf);var _0x37a405=utils[_0x0f15('0x15')](_0x5bf9cf);var _0x7b556f=utils[_0x0f15('0xd')](_0x5bf9cf);return squel[_0x0f15('0x8')]()[_0x0f15('0xb')](_0x247cdd[_0x0f15('0x16')],'i')[_0x0f15('0x17')](_0x0f15('0x18'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0f15('0x17')](_0x0f15('0x11'),'o',_0x0f15('0x19'))['left_join'](_0x247cdd['accounts'],'a','a.id\x20=\x20i.'+_0x37a405)['left_join'](_0x247cdd[_0x0f15('0x1a')],'me',_0x0f15('0x1b')+_0x7b556f+_0x0f15('0x1c'))[_0x0f15('0x17')](_0x247cdd[_0x0f15('0x1d')],'it',_0x0f15('0x1e')+_0x7b556f+_0x0f15('0x1c'))[_0x0f15('0x17')]('tools_tags','t',_0x0f15('0x1f'));}function getSqlClauses(){var _0x32b16b={'body':squel[_0x0f15('0x20')](),'contact':squel['expr'](),'default':squel[_0x0f15('0x20')](),'fields':squel[_0x0f15('0x20')](),'filter':squel[_0x0f15('0x20')](),'read':squel[_0x0f15('0x20')](),'tags':{'clause':squel[_0x0f15('0x20')](),'ids':null},'user':squel[_0x0f15('0x20')]()};return _0x32b16b;}function parseTagParameter(_0x490235){var _0x333c5c=squel[_0x0f15('0x20')]();if(_0x490235){var _0x12df67=utils[_0x0f15('0x21')](_0x490235);_0x12df67[_0x0f15('0x22')](function(_0x980a9c){_0x333c5c['or'](_0x0f15('0x23'),'%,'+_0x980a9c+',%');});}return _0x333c5c;}function parseReadParameter(_0x31865f){var _0x33e8de='';if(_0x31865f){_0x33e8de=_0x0f15('0x24');if(_0x31865f==='1'){_0x33e8de=_0x33e8de[_0x0f15('0x25')](_0x0f15('0x26'),'=');}else{_0x33e8de=_0x33e8de[_0x0f15('0x25')]('{OPERATOR}','>');}}return _0x33e8de;}function parseSearchFilter(_0x20724c,_0x389130){var _0x1c06db=squel['expr']();if(_0x389130){var _0x1984a2=_0x389130[_0x0f15('0x25')]('\x5c','\x5c\x5c')[_0x0f15('0x25')](/'/g,'\x27\x27');if(qs[_0x0f15('0x27')](_0x1984a2)){_0x1c06db['or'](_0x0f15('0x28'),_0x1984a2+'%');if([_0x0f15('0x29'),_0x0f15('0x2a')][_0x0f15('0x2b')](_0x20724c)){_0x1c06db['or']('i.phone\x20LIKE\x20?',_0x1984a2+'%');}else if(_0x20724c==='fax'){_0x1c06db['or'](_0x0f15('0x2c'),_0x1984a2+'%');}else if(_0x20724c===_0x0f15('0x2d')){_0x1c06db['or'](_0x0f15('0x2e'),_0x1984a2+'%');}}else if(_0x20724c==='mail'&&qs[_0x0f15('0x2f')](_0x1984a2)){_0x1c06db['or'](_0x0f15('0x30'),_0x1984a2+'%');}else{if(_0x20724c===_0x0f15('0x31')){_0x1c06db['or'](_0x0f15('0x32'),qs[_0x0f15('0x33')](_0x1984a2,!![]))['or'](_0x0f15('0x34'),qs[_0x0f15('0x33')](_0x1984a2));}else if(_0x20724c!==_0x0f15('0x35')){_0x1c06db['or'](_0x0f15('0x36'),qs[_0x0f15('0x33')](_0x1984a2));}_0x1c06db['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0f15('0x33')](_0x1984a2,!![]),null);}}return _0x1c06db;}function parseAdvancedSearchFilter(_0x2e5340,_0x1765c0){var _0x40b1a1=getSqlClauses();var _0x51aa0e=as[_0x0f15('0x37')](_0x2e5340);var _0x415109=_0x51aa0e[_0x0f15('0x38')];for(var _0x2d0320=0x0;_0x2d0320<_0x51aa0e[_0x0f15('0x39')]['length'];_0x2d0320++){var _0x3d2cf6=_0x51aa0e[_0x0f15('0x39')][_0x2d0320];var _0x54ff6d='i';var _0x29c730=_[_0x0f15('0x3a')](_0x1765c0,['name',_0x3d2cf6[_0x0f15('0x9')]]);if(_0x29c730){var _0x10bf89=as[_0x0f15('0x3b')](_0x54ff6d,_0x29c730['type'],_0x3d2cf6);_0x40b1a1[_0x0f15('0x3c')][_0x415109](_0x10bf89[_0x0f15('0x3d')],_0x10bf89['value'][_0x0f15('0x3e')],_0x10bf89[_0x0f15('0x3f')][_0x0f15('0x40')]);}else{switch(_0x3d2cf6[_0x0f15('0x9')]){case _0x0f15('0x41'):var _0x6da52f=parseReadParameter(_0x3d2cf6[_0x0f15('0x3f')]);_0x40b1a1[_0x0f15('0x42')]['and'](_0x6da52f);break;case _0x0f15('0x43'):if(_0x3d2cf6[_0x0f15('0x44')]===_0x0f15('0x45')){if(_0x3d2cf6[_0x0f15('0x3f')][_0x0f15('0x46')]('\x20')[_0x0f15('0x12')]>0x1){_0x40b1a1['contact'][_0x415109]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0f15('0x33')](_0x3d2cf6[_0x0f15('0x3f')],!![]),null);}else{var _0x579b64='%'+_0x3d2cf6[_0x0f15('0x3f')]+'%';_0x40b1a1[_0x0f15('0x47')][_0x415109]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x579b64,_0x579b64,_0x579b64);}}else{_0x29c730=_['find'](_0x1765c0,[_0x0f15('0xa'),'ContactId']);_0x3d2cf6[_0x0f15('0x9')]='ContactId';_0x10bf89=as[_0x0f15('0x3b')](_0x54ff6d,_0x29c730[_0x0f15('0x48')],_0x3d2cf6);_0x40b1a1[_0x0f15('0x47')][_0x415109](_0x10bf89[_0x0f15('0x3d')],_0x10bf89[_0x0f15('0x3f')][_0x0f15('0x3e')],_0x10bf89[_0x0f15('0x3f')][_0x0f15('0x40')]);}break;case _0x0f15('0x49'):var _0x3dfe93=_0x3d2cf6[_0x0f15('0x3f')]['split'](',')['map'](function(_0x1844d9){return Number(_0x1844d9);});var _0x553fdb=parseTagParameter(_0x3dfe93);_0x40b1a1[_0x0f15('0x4a')][_0x0f15('0x4b')]['and'](_0x553fdb);_0x40b1a1[_0x0f15('0x4a')][_0x0f15('0x4c')]=_0x3dfe93;break;case _0x0f15('0x4d'):if(_0x3d2cf6[_0x0f15('0x44')]===_0x0f15('0x45')){_0x40b1a1[_0x0f15('0x4e')][_0x415109](_0x0f15('0x4f'),'%'+_0x3d2cf6[_0x0f15('0x3f')]+'%',null);}else{_0x29c730=_[_0x0f15('0x3a')](_0x1765c0,[_0x0f15('0xa'),_0x0f15('0x50')]);_0x3d2cf6[_0x0f15('0x9')]='UserId';_0x10bf89=as[_0x0f15('0x3b')](_0x54ff6d,_0x29c730[_0x0f15('0x48')],_0x3d2cf6);_0x40b1a1['user'][_0x415109](_0x10bf89[_0x0f15('0x3d')],_0x10bf89[_0x0f15('0x3f')][_0x0f15('0x3e')],_0x10bf89[_0x0f15('0x3f')]['end']);}break;case _0x0f15('0x51'):case'plainBody':_0x10bf89=as[_0x0f15('0x3b')]('me',null,_0x3d2cf6);_0x40b1a1[_0x0f15('0x51')][_0x415109](_0x10bf89['text'],_0x10bf89['value'][_0x0f15('0x3e')],_0x10bf89[_0x0f15('0x3f')][_0x0f15('0x40')]);break;}}}return _0x40b1a1;}function parseModelFields(_0x51c1e0,_0x4ada2b,_0x1c4ab4){var _0x324f16=utils[_0x0f15('0x15')](_0x51c1e0);var _0x250561=squel[_0x0f15('0x20')]();var _0x201e01=_(_0x4ada2b)[_0x0f15('0x52')]()['map'](function(_0x199a85){return _[_0x0f15('0x53')](_0x1c4ab4,[_0x0f15('0xa'),_0x199a85])?_0x199a85:undefined;})[_0x0f15('0x54')]()[_0x0f15('0x3f')]();if(_0x201e01[_0x0f15('0x12')]>0x0){_0x201e01[_0x0f15('0x22')](function(_0x354358){if(_0x354358===_0x324f16){_0x250561[_0x0f15('0x55')]('i.'+_0x324f16+_0x0f15('0x13'),[][_0x0f15('0x56')](_0x4ada2b[_0x354358]));}else if(_0x354358===_0x0f15('0x57')){var _0x56c717=JSON[_0x0f15('0x58')](_0x4ada2b[_0x354358])[_0x0f15('0x59')];var _0x4af9e0=JSON[_0x0f15('0x58')](_0x4ada2b[_0x354358])['$lte'];_0x250561[_0x0f15('0x55')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x56c717,_0x4af9e0);}else{if(_0x4ada2b[_0x354358]===_0x0f15('0x5a')){_0x250561[_0x0f15('0x55')]('i.'+_0x354358+_0x0f15('0x5b'));}else{_0x250561[_0x0f15('0x55')]('i.'+_0x354358+'\x20=\x20?',_0x4ada2b[_0x354358]);}}});}return _0x250561;}function parseQueryParameters(_0x2bbe30,_0x3a1722,_0x1a32ce){var _0x23a3a7=getSqlClauses();return Promise['resolve']()[_0x0f15('0x5c')](function(){return parseModelFields(_0x2bbe30,_0x3a1722,_0x1a32ce);})[_0x0f15('0x5c')](function(_0xddeb10){_0x23a3a7[_0x0f15('0x5d')][_0x0f15('0x55')](_0xddeb10);return parseReadParameter(_0x3a1722[_0x0f15('0x42')]);})[_0x0f15('0x5c')](function(_0x18ba9e){_0x23a3a7['read'][_0x0f15('0x55')](_0x18ba9e);return parseTagParameter(_0x3a1722[_0x0f15('0x5e')]);})[_0x0f15('0x5c')](function(_0x927721){_0x23a3a7['tags'][_0x0f15('0x4b')]['and'](_0x927721);return parseSearchFilter(_0x2bbe30,_0x3a1722[_0x0f15('0x5f')]);})[_0x0f15('0x5c')](function(_0x53189f){_0x23a3a7[_0x0f15('0x5f')]=_0x53189f;return _0x23a3a7;});}function checkAccountsRestrictions(_0x322700,_0x3d3924,_0x437cc9){var _0x3005de=utils[_0x0f15('0x15')](_0x322700);var _0x3ca30d=_0x0f15('0x60')+_['capitalize'](_0x322700)+(_0x322700===_0x0f15('0x61')?'Websites':_0x0f15('0x62'));var _0x384255=squel['expr']();return Promise[_0x0f15('0x63')]()[_0x0f15('0x5c')](function(){if(_0x437cc9['search']&&_0x3d3924[_0x0f15('0x64')]===_0x0f15('0x7')){return _0x3d3924[_0x3ca30d]({'attributes':['id'],'raw':!![]});}})[_0x0f15('0x5c')](function(_0xc14a77){if(_0xc14a77){if(_0xc14a77[_0x0f15('0x12')]===0x0){_0x384255['and']('i.'+_0x3005de+_0x0f15('0x5b'));}else{_0x384255[_0x0f15('0x55')]('i.'+_0x3005de+_0x0f15('0x13'),_[_0x0f15('0x14')](_0xc14a77,'id'));}}else if(!_0x437cc9[_0x3005de]){_0x384255['and']('i.'+_0x3005de+_0x0f15('0x65'));}})[_0x0f15('0x5c')](function(){return _0x384255;});}function getClosedOrderClause(_0x56601e,_0x5815c4){var _0x45a7a8='';var _0x152119=['i.thirdDisposition',_0x0f15('0x66'),_0x0f15('0x67')];if(_0x56601e===_0x0f15('0x31')){_0x152119[_0x0f15('0x68')](_0x0f15('0x69'));}if(_0x5815c4[_0x0f15('0x6a')]==='0'&&_0x56601e===_0x0f15('0x31')){_0x45a7a8=_0x0f15('0x69');}else{if(_0x5815c4[_0x0f15('0x6a')]==='1'){_0x152119['shift']();}_0x45a7a8='CONCAT_WS(\x27\x27,\x20'+_0x152119[_0x0f15('0x6b')](',\x20')+')';}return _0x45a7a8;}function getFilteredInteractions(_0x424fdb,_0x4abb03,_0x2317d5,_0x3d9390){var _0x5d387=utils[_0x0f15('0xd')](_0x424fdb);var _0x3c6891=_[_0x0f15('0x6c')](_0x424fdb)+_0x0f15('0x6d');var _0x3e8864=[];var _0x56da3d=getTagsQuery();var _0x247cd4={'type':db[_0x0f15('0x6e')][_0x0f15('0x6f')][_0x0f15('0x70')],'raw':!![]};var _0x3ee4b4=[];var _0x11f64c=[];return db[_0x0f15('0x71')][_0x0f15('0x72')](_0x56da3d['toString'](),_0x247cd4)[_0x0f15('0x5c')](function(_0x29e73c){_0x3e8864=_[_0x0f15('0x73')](_0x29e73c,'id');_0x247cd4=_['merge'](_0x247cd4,{'model':db[_0x3c6891],'mapToModel':!![],'nest':!![]});if(_0x2317d5['fields']){_0x3d9390[_0x0f15('0x74')]['forEach'](function(_0xe17e09){_0x4abb03[_0x0f15('0x9')]('i.'+_0xe17e09);});}else{_0x4abb03[_0x0f15('0x9')](_0x0f15('0x75'),_0x0f15('0x41'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x76'),_0x0f15('0x77'));_0x4abb03[_0x0f15('0x9')]('a.mandatoryDisposition',_0x0f15('0x78'));if(_0x424fdb===_0x0f15('0x31')){_0x4abb03[_0x0f15('0x9')](_0x0f15('0x79'),'Account.email');_0x4abb03[_0x0f15('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x4abb03[_0x0f15('0x9')](_0x0f15('0x7a'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x7b'));_0x4abb03[_0x0f15('0x9')]('i.updatedAt');_0x4abb03[_0x0f15('0x9')](_0x0f15('0x7c'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x7d'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x7e'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x7f'));_0x4abb03['field']('i.lastMsgDirection');_0x4abb03['field']('i.subject');_0x4abb03['field']('i.disposition');_0x4abb03[_0x0f15('0x9')](_0x0f15('0x66'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x80'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x69'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x81'));_0x4abb03['field'](_0x0f15('0x82'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x83'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x84'));}else if(_0x424fdb==='openchannel'){_0x4abb03[_0x0f15('0x9')](_0x0f15('0x85'),'contactName');}else{_0x4abb03[_0x0f15('0x9')](_0x0f15('0x86'),_0x0f15('0x87'));}if(_0x424fdb!==_0x0f15('0x31')){_0x4abb03['field'](_0x0f15('0x88'));}_0x4abb03[_0x0f15('0x9')](_0x0f15('0x89'),_0x0f15('0x8a'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x8b'),'Contact.lastName');_0x4abb03[_0x0f15('0x9')](_0x0f15('0x8c'),'Contact.email');_0x4abb03[_0x0f15('0x9')]('c.phone',_0x0f15('0x8d'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x8e'),'Contact.mobile');_0x4abb03['field']('c.fax',_0x0f15('0x8f'));_0x4abb03[_0x0f15('0x9')]('o.fullname',_0x0f15('0x90'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x91'),_0x0f15('0x92'));_0x4abb03[_0x0f15('0x9')](_0x0f15('0x93'),_0x0f15('0x94'));}if(_0x3d9390[_0x0f15('0x95')]){_0x4abb03[_0x0f15('0x95')](_0x3d9390['limit']);}if(_0x3d9390[_0x0f15('0x96')]){_0x4abb03[_0x0f15('0x96')](_0x3d9390['offset']);}return db[_0x0f15('0x71')][_0x0f15('0x72')](_0x4abb03[_0x0f15('0x97')](),_0x247cd4);})[_0x0f15('0x5c')](function(_0x451222){_0x3ee4b4=_0x451222;var _0x4de507=getUsersQuery(_0x424fdb,_0x3ee4b4);return db[_0x0f15('0x71')]['query'](_0x4de507['toString'](),_0x247cd4);})[_0x0f15('0x5c')](function(_0x5557b7){_0x11f64c=_[_0x0f15('0x98')](_0x5557b7,_0x5d387);if(_0x424fdb===_0x0f15('0x31')){return db[_0x0f15('0x99')][_0x0f15('0x9a')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x0f15('0x5c')](function(_0x5643f0){var _0x1a4a8a=_0x5643f0?_0x5643f0[_0x0f15('0x9b')]:undefined;var _0x300866=_0x3ee4b4['map'](function(_0x2c06bf){return updateInteraction(_0x2c06bf,_0x3e8864,_0x11f64c,_0x1a4a8a);});return Promise[_0x0f15('0x9c')](_0x300866);});}function countFilteredInteractions(_0x548225,_0x54bedf){var _0x4af060=_0x548225[_0x0f15('0x9d')]();_0x4af060[_0x0f15('0x9')]('COUNT(*)');_0x4af060[_0x0f15('0x9')](_0x0f15('0x75'),'unreadMessages');var _0x15193b=utils[_0x0f15('0x21')](_0x54bedf);if(!_[_0x0f15('0x9e')](_0x15193b)){_0x4af060[_0x0f15('0x9f')](_0x0f15('0xa0'),_0x15193b);}var _0x2378e4={'type':db[_0x0f15('0x6e')][_0x0f15('0x6f')][_0x0f15('0x70')],'raw':!![]};return db['sequelize'][_0x0f15('0x72')](_0x4af060['toString'](),_0x2378e4);}module[_0x0f15('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 529aced..0fb794f 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcff6=['waiting','answered','unmanaged','abandoned','total','disposition','UserId','talking','MailMessage','findOne','out','-id','then','lastMsgText','plainBody','Users','Tags','TagIds','catch','lodash','fullname','split','forEach'];(function(_0x4ddf84,_0x3c23cd){var _0x3e66ec=function(_0x4a8905){while(--_0x4a8905){_0x4ddf84['push'](_0x4ddf84['shift']());}};_0x3e66ec(++_0x3c23cd);}(_0xcff6,0x1b1));var _0x6cff=function(_0x3a4f4b,_0x464d4c){_0x3a4f4b=_0x3a4f4b-0x0;var _0xe9cca9=_0xcff6[_0x3a4f4b];return _0xe9cca9;};'use strict';var _=require(_0x6cff('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x3ad1b0,_0x3b24f4){return new Promise(function(_0x121224,_0x36332f){try{var _0x3b36a3=[];if(_0x3b24f4[_0x3ad1b0]){_0x3b36a3=_0x3b24f4[_0x3ad1b0]['map'](function(_0x40d574){return{'id':_0x40d574['id'],'fullname':_0x40d574[_0x6cff('0x1')]};});}return _0x121224(_0x3b36a3);}catch(_0x2153e5){_0x36332f(_0x2153e5);}});}function getInteractionTags(_0x3aaf06,_0x520d2b){var _0x29d259=[];if(_0x3aaf06){_0x3aaf06[_0x6cff('0x2')](',')[_0x6cff('0x3')](function(_0x3b2db9){_0x29d259['push'](_0x520d2b[_0x3b2db9]);});}return _0x29d259;}function updateWaitingCounter(_0x5ca03b){if(_0x5ca03b['waiting']){_0x5ca03b[_0x6cff('0x4')]-=0x1;}}function updateInteractionCounters(_0x373244){_0x373244[_0x6cff('0x4')]=0x0;_0x373244['talking']=0x0;_0x373244[_0x6cff('0x5')]=0x0;_0x373244[_0x6cff('0x6')]=0x0;_0x373244[_0x6cff('0x7')]=0x0;_0x373244[_0x6cff('0x8')]=0x0;if(_0x373244['closed']){if(_0x373244[_0x6cff('0x9')]===_0x6cff('0x7')){_0x373244[_0x6cff('0x7')]+=0x1;updateWaitingCounter(_0x373244);}if(_0x373244[_0x6cff('0xa')]){_0x373244['answered']+=0x1;if(_0x373244[_0x6cff('0xb')]){_0x373244['talking']-=0x1;}}else{if(_0x373244['disposition']){_0x373244['unmanaged']+=0x1;updateWaitingCounter(_0x373244);}}}else{if(!_0x373244[_0x6cff('0xa')]){_0x373244[_0x6cff('0x4')]+=0x1;}if(_0x373244[_0x6cff('0xa')]){_0x373244[_0x6cff('0xb')]+=0x1;updateWaitingCounter(_0x373244);}}_0x373244[_0x6cff('0x8')]+=0x1;return _0x373244;}function getLastMessageText(_0x57f3e2){return db[_0x6cff('0xc')][_0x6cff('0xd')]({'where':{'$and':[{'MailInteractionId':_0x57f3e2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6cff('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x6cff('0xf'),'raw':!![]})[_0x6cff('0x10')](function(_0xec1251){if(_0xec1251&&_0xec1251['plainBody']){_0x57f3e2[_0x6cff('0x11')]=_['trimStart'](_0xec1251[_0x6cff('0x12')]);}return _0x57f3e2;})['catch'](function(_0x3d9046){throw _0x3d9046;});}exports['updateInteraction']=function(_0x169302,_0x425a22,_0x435335,_0x38be4d){return new Promise(function(_0x3e8fff,_0x13456a){return getInteractionUsers(_0x169302['id'],_0x435335)[_0x6cff('0x10')](function(_0x4c7c2d){_0x169302[_0x6cff('0x13')]=_0x4c7c2d;return getInteractionTags(_0x169302['TagIds'],_0x425a22);})['then'](function(_0x2d4c2d){_0x169302[_0x6cff('0x14')]=_0x2d4c2d;delete _0x169302[_0x6cff('0x15')];return updateInteractionCounters(_0x169302);})['then'](function(_0x1bd115){if(_0x38be4d){return getLastMessageText(_0x1bd115);}else{return _0x1bd115;}})['then'](function(_0x5e88e0){_0x3e8fff(_0x5e88e0);})[_0x6cff('0x16')](function(_0xbb7086){_0x13456a(_0xbb7086);});});}; \ No newline at end of file +var _0xb27a=['closed','disposition','UserId','answered','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Users','TagIds','catch','lodash','split','push','waiting','talking','unmanaged','abandoned','total'];(function(_0x32e451,_0x8d30e8){var _0x3f64a6=function(_0x1c32af){while(--_0x1c32af){_0x32e451['push'](_0x32e451['shift']());}};_0x3f64a6(++_0x8d30e8);}(_0xb27a,0xe8));var _0xab27=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0xb27a[_0x2aee2f];return _0x19337f;};'use strict';var _=require(_0xab27('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x900146,_0x4f1654){return new Promise(function(_0x29e444,_0x4d6043){try{var _0x2b4b28=[];if(_0x4f1654[_0x900146]){_0x2b4b28=_0x4f1654[_0x900146]['map'](function(_0x9daeb6){return{'id':_0x9daeb6['id'],'fullname':_0x9daeb6['fullname']};});}return _0x29e444(_0x2b4b28);}catch(_0xe1c96e){_0x4d6043(_0xe1c96e);}});}function getInteractionTags(_0x199089,_0x181d97){var _0x5128ce=[];if(_0x199089){_0x199089[_0xab27('0x1')](',')['forEach'](function(_0x19d3d9){_0x5128ce[_0xab27('0x2')](_0x181d97[_0x19d3d9]);});}return _0x5128ce;}function updateWaitingCounter(_0x1db531){if(_0x1db531['waiting']){_0x1db531[_0xab27('0x3')]-=0x1;}}function updateInteractionCounters(_0x4ff166){_0x4ff166[_0xab27('0x3')]=0x0;_0x4ff166[_0xab27('0x4')]=0x0;_0x4ff166['answered']=0x0;_0x4ff166[_0xab27('0x5')]=0x0;_0x4ff166[_0xab27('0x6')]=0x0;_0x4ff166[_0xab27('0x7')]=0x0;if(_0x4ff166[_0xab27('0x8')]){if(_0x4ff166[_0xab27('0x9')]===_0xab27('0x6')){_0x4ff166[_0xab27('0x6')]+=0x1;updateWaitingCounter(_0x4ff166);}if(_0x4ff166[_0xab27('0xa')]){_0x4ff166[_0xab27('0xb')]+=0x1;if(_0x4ff166[_0xab27('0x4')]){_0x4ff166['talking']-=0x1;}}else{if(_0x4ff166[_0xab27('0x9')]){_0x4ff166['unmanaged']+=0x1;updateWaitingCounter(_0x4ff166);}}}else{if(!_0x4ff166[_0xab27('0xa')]){_0x4ff166[_0xab27('0x3')]+=0x1;}if(_0x4ff166[_0xab27('0xa')]){_0x4ff166[_0xab27('0x4')]+=0x1;updateWaitingCounter(_0x4ff166);}}_0x4ff166['total']+=0x1;return _0x4ff166;}function getLastMessageText(_0x4a56aa){return db[_0xab27('0xc')][_0xab27('0xd')]({'where':{'$and':[{'MailInteractionId':_0x4a56aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xab27('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xab27('0xf')],'order':_0xab27('0x10'),'raw':!![]})[_0xab27('0x11')](function(_0x53ba4e){if(_0x53ba4e&&_0x53ba4e['plainBody']){_0x4a56aa[_0xab27('0x12')]=_[_0xab27('0x13')](_0x53ba4e['plainBody']);}return _0x4a56aa;})['catch'](function(_0x13bef2){throw _0x13bef2;});}exports[_0xab27('0x14')]=function(_0x3fa6ac,_0xe4a4d1,_0x57ee95,_0x558028){return new Promise(function(_0x510a07,_0x3ccf3c){return getInteractionUsers(_0x3fa6ac['id'],_0x57ee95)[_0xab27('0x11')](function(_0x470dd9){_0x3fa6ac[_0xab27('0x15')]=_0x470dd9;return getInteractionTags(_0x3fa6ac[_0xab27('0x16')],_0xe4a4d1);})[_0xab27('0x11')](function(_0x320bce){_0x3fa6ac['Tags']=_0x320bce;delete _0x3fa6ac[_0xab27('0x16')];return updateInteractionCounters(_0x3fa6ac);})['then'](function(_0x2b12f5){if(_0x558028){return getLastMessageText(_0x2b12f5);}else{return _0x2b12f5;}})[_0xab27('0x11')](function(_0x533426){_0x510a07(_0x533426);})[_0xab27('0x17')](function(_0x213dca){_0x3ccf3c(_0x213dca);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c607142..afee621 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45b4=['name','role','stringify','null','Interaction','findOne','then','update','catch','error','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','chat','Website','upperFirst','unknown','websites','_interaction_has_tags','_interactions','isArray','toUpperCase'];(function(_0x583fae,_0x389f36){var _0x410ebc=function(_0x3b9bf2){while(--_0x3b9bf2){_0x583fae['push'](_0x583fae['shift']());}};_0x410ebc(++_0x389f36);}(_0x45b4,0x128));var _0x445b=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x45b4[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x445b('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x445b('0x1'))(_0x445b('0x2')),'mail':require(_0x445b('0x1'))(_0x445b('0x3')),'fax':require(_0x445b('0x1'))(_0x445b('0x4')),'sms':require(_0x445b('0x1'))(_0x445b('0x5')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0x445b('0x1'))(_0x445b('0x6'))};function getAccountFK(_0x925ec4){return _['capitalize'](_0x925ec4)+(_0x925ec4===_0x445b('0x7')?_0x445b('0x8'):'Account')+'Id';}function getInteractionFK(_0x46df8c){return _['capitalize'](_0x46df8c)+'InteractionId';}function getInteractionId(_0x183bc4,_0x312ca9,_0x343cbd){if(_0x183bc4&&_0x183bc4[_[_0x445b('0x9')](_0x343cbd)+'InteractionId']){return _0x183bc4[_[_0x445b('0x9')](_0x343cbd)+'InteractionId'];}else if(_0x183bc4&&_0x183bc4['id']){return _0x183bc4['id'];}else if(_0x312ca9&&_0x312ca9['id']){return _0x312ca9['id'];}else{return _0x445b('0xa');}}function getInteractionsTables(_0x194502){return{'accounts':_0x194502+'_'+(_0x194502===_0x445b('0x7')?_0x445b('0xb'):'accounts'),'interactions':_0x194502+'_interactions','interactionsTags':_0x194502+_0x445b('0xc'),'messages':_0x194502+'_messages','userInteractions':'user_has_'+_0x194502+_0x445b('0xd')};}function getSelectedTags(_0x23164e){var _0xb5f107=[];if(_0x23164e){_0xb5f107=Array[_0x445b('0xe')](_0x23164e)?_0x23164e:[_0x23164e];}return _0xb5f107;}function log(_0x1cc4f7,_0x768b78,_0x1acb22,_0x53b0d2,_0x517340,_0x171cd8){loggers[_0x517340['toLowerCase']()][_0x1cc4f7]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x171cd8[_0x445b('0xf')](),_0x768b78?_0x768b78['id']:null,_0x768b78?_0x768b78[_0x445b('0x10')]:null,_0x768b78?_0x768b78[_0x445b('0x11')]:null,getInteractionId(_0x1acb22,_0x53b0d2,_0x517340),_0x1acb22?JSON[_0x445b('0x12')](_0x1acb22):_0x445b('0x13'));}function updateUser(_0x3a67aa,_0x2df883,_0x3d4a82,_0x9bb02b,_0x578c85){db[_[_0x445b('0x9')](_0x9bb02b)+_0x445b('0x14')][_0x445b('0x15')]({'where':{'id':getInteractionId(_0x2df883,_0x3d4a82,_0x9bb02b)}})[_0x445b('0x16')](function(_0x3bf3c5){if(_0x3bf3c5){return _0x3bf3c5[_0x445b('0x17')]({'UserId':_0x3a67aa?_0x3a67aa['id']:null});}})[_0x445b('0x16')](function(_0x5bd5f5){if(_0x5bd5f5){log('info',_0x3a67aa,_0x2df883,_0x3d4a82,_0x9bb02b,_0x578c85);}})[_0x445b('0x18')](function(){log(_0x445b('0x19'),_0x3a67aa,_0x2df883,_0x3d4a82,_0x9bb02b,_0x578c85);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x6c3e=['update','then','info','catch','error','exports','lodash','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','findOne'];(function(_0x39e821,_0x2fde60){var _0x5ce9d7=function(_0x1b79e1){while(--_0x1b79e1){_0x39e821['push'](_0x39e821['shift']());}};_0x5ce9d7(++_0x2fde60);}(_0x6c3e,0x17c));var _0xe6c3=function(_0x355238,_0x411e09){_0x355238=_0x355238-0x0;var _0x2c0977=_0x6c3e[_0x355238];return _0x2c0977;};'use strict';var _=require(_0xe6c3('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0xe6c3('0x1')),'mail':require(_0xe6c3('0x2'))(_0xe6c3('0x3')),'fax':require(_0xe6c3('0x2'))(_0xe6c3('0x4')),'sms':require(_0xe6c3('0x2'))(_0xe6c3('0x5')),'chat':require(_0xe6c3('0x2'))(_0xe6c3('0x6')),'whatsapp':require(_0xe6c3('0x2'))(_0xe6c3('0x7'))};function getAccountFK(_0x45703d){return _[_0xe6c3('0x8')](_0x45703d)+(_0x45703d===_0xe6c3('0x9')?_0xe6c3('0xa'):_0xe6c3('0xb'))+'Id';}function getInteractionFK(_0xf4d4f5){return _[_0xe6c3('0x8')](_0xf4d4f5)+_0xe6c3('0xc');}function getInteractionId(_0x7e1207,_0x27b688,_0x29fe6f){if(_0x7e1207&&_0x7e1207[_[_0xe6c3('0xd')](_0x29fe6f)+_0xe6c3('0xc')]){return _0x7e1207[_[_0xe6c3('0xd')](_0x29fe6f)+'InteractionId'];}else if(_0x7e1207&&_0x7e1207['id']){return _0x7e1207['id'];}else if(_0x27b688&&_0x27b688['id']){return _0x27b688['id'];}else{return _0xe6c3('0xe');}}function getInteractionsTables(_0x1adb0d){return{'accounts':_0x1adb0d+'_'+(_0x1adb0d===_0xe6c3('0x9')?_0xe6c3('0xf'):_0xe6c3('0x10')),'interactions':_0x1adb0d+_0xe6c3('0x11'),'interactionsTags':_0x1adb0d+_0xe6c3('0x12'),'messages':_0x1adb0d+_0xe6c3('0x13'),'userInteractions':_0xe6c3('0x14')+_0x1adb0d+_0xe6c3('0x11')};}function getSelectedTags(_0x1a76ff){var _0x3cfdb5=[];if(_0x1a76ff){_0x3cfdb5=Array[_0xe6c3('0x15')](_0x1a76ff)?_0x1a76ff:[_0x1a76ff];}return _0x3cfdb5;}function log(_0x588786,_0x1cb4eb,_0x1f90d5,_0x36b684,_0x260343,_0xa2a804){loggers[_0x260343[_0xe6c3('0x16')]()][_0x588786](_0xe6c3('0x17'),_0xa2a804['toUpperCase'](),_0x1cb4eb?_0x1cb4eb['id']:null,_0x1cb4eb?_0x1cb4eb['name']:null,_0x1cb4eb?_0x1cb4eb[_0xe6c3('0x18')]:null,getInteractionId(_0x1f90d5,_0x36b684,_0x260343),_0x1f90d5?JSON[_0xe6c3('0x19')](_0x1f90d5):_0xe6c3('0x1a'));}function updateUser(_0x27a5fc,_0x40815f,_0x2bf233,_0x58f087,_0x5dbb6c){db[_['upperFirst'](_0x58f087)+'Interaction'][_0xe6c3('0x1b')]({'where':{'id':getInteractionId(_0x40815f,_0x2bf233,_0x58f087)}})['then'](function(_0x32b5c9){if(_0x32b5c9){return _0x32b5c9[_0xe6c3('0x1c')]({'UserId':_0x27a5fc?_0x27a5fc['id']:null});}})[_0xe6c3('0x1d')](function(_0x57df0a){if(_0x57df0a){log(_0xe6c3('0x1e'),_0x27a5fc,_0x40815f,_0x2bf233,_0x58f087,_0x5dbb6c);}})[_0xe6c3('0x1f')](function(){log(_0xe6c3('0x20'),_0x27a5fc,_0x40815f,_0x2bf233,_0x58f087,_0x5dbb6c);});}module[_0xe6c3('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 78d7070..8d0a9c1 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 _0x9e80=['License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use'];(function(_0xfca941,_0x1aecfb){var _0x53da32=function(_0x246f3e){while(--_0x246f3e){_0xfca941['push'](_0xfca941['shift']());}};_0x53da32(++_0x1aecfb);}(_0x9e80,0xfc));var _0x09e8=function(_0x24e25e,_0x1a6c37){_0x24e25e=_0x24e25e-0x0;var _0x5a14cd=_0x9e80[_0x24e25e];return _0x5a14cd;};'use strict';var crypto=require(_0x09e8('0x0'));var util=require(_0x09e8('0x1'));var compose=require(_0x09e8('0x2'));var db=require(_0x09e8('0x3'))['db'];var config=require(_0x09e8('0x4'));function getValueFromLicense(_0x3a94c9,_0x14813b){if(_0x3a94c9&&_0x14813b){if(_0x14813b[_0x09e8('0x5')]&&_0x14813b[_0x09e8('0x6')]){var _0xaef3cb=_0x14813b[_0x09e8('0x5')];var _0x2ccbe4=_0x14813b[_0x09e8('0x6')];var _0x122e19=_0xaef3cb[_0x09e8('0x7')]('-')[0x4];var _0x11be3f=_0xaef3cb[_0x09e8('0x7')]('-')[0x0];var _0x4262de=crypto['createDecipher'](_0x09e8('0x8'),util[_0x09e8('0x9')](_0x09e8('0xa'),_0x122e19,_0xaef3cb,_0x11be3f));var _0x269329=_0x4262de[_0x09e8('0xb')](_0x2ccbe4,_0x09e8('0xc'),_0x09e8('0xd'));_0x269329+=_0x4262de[_0x09e8('0xe')](_0x09e8('0xd'));var _0x5390c0=JSON[_0x09e8('0xf')](_0x269329);return _0x5390c0[_0x09e8('0x10')](_0x3a94c9)?_0x5390c0[_0x3a94c9]:null;}}return null;}function isLimit(_0x171255,_0x29a497,_0x5862ca,_0x1a12f9){var _0xe7990e=_0x29a497;return compose()[_0x09e8('0x11')](function(_0x3c80db,_0x5cf2e5,_0xbfbc14){return db[_0x09e8('0x12')][_0x09e8('0x13')]({'where':{'id':0x1},'raw':!![]})[_0x09e8('0x14')](function(_0x354470){var _0x1aa819=getValueFromLicense(_0x171255,_0x354470);return _0x1aa819?_0x1aa819:_0xe7990e;})['then'](function(_0x17b442){_0xe7990e=_0x17b442;return _0x5862ca[_0x09e8('0x15')](_0x1a12f9);})['then'](function(_0x137e93){if(_0x137e93>=_0xe7990e){return _0x5cf2e5['status'](0x193)[_0x09e8('0x16')]({'message':util[_0x09e8('0x9')](_0x09e8('0x17'),_0x171255)});}_0xbfbc14();})[_0x09e8('0x18')](function(_0x23f8b5){_0xbfbc14(_0x23f8b5);});});}function isUserLimit(){return isLimit(_0x09e8('0x19'),0x1,db[_0x09e8('0x1a')],{'where':{'$or':[{'role':_0x09e8('0x1b')},{'role':_0x09e8('0x1c')}]}});}exports[_0x09e8('0x1d')]=isUserLimit; \ No newline at end of file +var _0x2452=['parse','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util','composable-middleware','data1','license','createDecipher','format','%s:%s:%s','update','base64','utf8','final'];(function(_0x31b534,_0xad3938){var _0x479c64=function(_0x157ce1){while(--_0x157ce1){_0x31b534['push'](_0x31b534['shift']());}};_0x479c64(++_0xad3938);}(_0x2452,0x1bc));var _0x2245=function(_0x875110,_0x7873af){_0x875110=_0x875110-0x0;var _0x39758a=_0x2452[_0x875110];return _0x39758a;};'use strict';var crypto=require(_0x2245('0x0'));var util=require(_0x2245('0x1'));var compose=require(_0x2245('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x28d3e2,_0x2f9449){if(_0x28d3e2&&_0x2f9449){if(_0x2f9449[_0x2245('0x3')]&&_0x2f9449[_0x2245('0x4')]){var _0x2c6a3d=_0x2f9449[_0x2245('0x3')];var _0x532cdb=_0x2f9449[_0x2245('0x4')];var _0x277e9b=_0x2c6a3d['split']('-')[0x4];var _0x622c53=_0x2c6a3d['split']('-')[0x0];var _0xab9262=crypto[_0x2245('0x5')]('aes-256-ctr',util[_0x2245('0x6')](_0x2245('0x7'),_0x277e9b,_0x2c6a3d,_0x622c53));var _0x584557=_0xab9262[_0x2245('0x8')](_0x532cdb,_0x2245('0x9'),_0x2245('0xa'));_0x584557+=_0xab9262[_0x2245('0xb')](_0x2245('0xa'));var _0x3e08f4=JSON[_0x2245('0xc')](_0x584557);return _0x3e08f4['hasOwnProperty'](_0x28d3e2)?_0x3e08f4[_0x28d3e2]:null;}}return null;}function isLimit(_0x2eb4e4,_0x571d69,_0x1afaeb,_0x38a155){var _0x4a76e9=_0x571d69;return compose()[_0x2245('0xd')](function(_0x123a53,_0x3f7001,_0xae4f6c){return db['License'][_0x2245('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x2245('0xf')](function(_0x170044){var _0x16ac66=getValueFromLicense(_0x2eb4e4,_0x170044);return _0x16ac66?_0x16ac66:_0x4a76e9;})[_0x2245('0xf')](function(_0x23977f){_0x4a76e9=_0x23977f;return _0x1afaeb['count'](_0x38a155);})[_0x2245('0xf')](function(_0x274cb0){if(_0x274cb0>=_0x4a76e9){return _0x3f7001[_0x2245('0x10')](0x193)[_0x2245('0x11')]({'message':util['format'](_0x2245('0x12'),_0x2eb4e4)});}_0xae4f6c();})[_0x2245('0x13')](function(_0x57d683){_0xae4f6c(_0x57d683);});});}function isUserLimit(){return isLimit(_0x2245('0x14'),0x1,db[_0x2245('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x2245('0x16')}]}});}exports[_0x2245('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2e1a3aa..6f55818 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 _0x4631=['$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','$startsWith','shift','pop','format','utcOffset','hours','seconds','moment','sqlOperator','startsWith','[$or]','replace','length','slice','forEach','split','indexOf','map','conditions','DATE','operator','$eq','$between','includes','$gt','$lte','value','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','>\x20?'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x4631,0x178));var _0x1463=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x4631[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require('lodash');var moment=require(_0x1463('0x0'));exports['parseSearch']=function(_0xa93c4d){var _0x2759a5={'conditions':[]};_0x2759a5[_0x1463('0x1')]=_[_0x1463('0x2')](_0xa93c4d,_0x1463('0x3'))?'or':'and';var _0x37c669=_0xa93c4d['replace']('[$and]','')[_0x1463('0x4')](_0x1463('0x3'),'')['split']('||');for(var _0x137a44=0x0;_0x137a44<_0x37c669[_0x1463('0x5')];_0x137a44++){var _0x54f0d0=_0x37c669[_0x137a44]['split'](':=');var _0x3f5926=_0x54f0d0[0x0];var _0x9141df=_0x54f0d0[_0x1463('0x6')](0x1);_0x9141df[_0x1463('0x7')](function(_0x54fd26){var _0x41da72=_0x54fd26[_0x1463('0x8')]('[')['shift']();var _0x1c38c2=_0x54fd26['match'](/\[(.*?)\]/g);_0x1c38c2[_0x1463('0x7')](function(_0x706181){var _0x29bb34=_0x706181[_0x1463('0x8')]('[')['filter'](function(_0x13ee25){return _0x13ee25[_0x1463('0x9')](']')>-0x1;})[_0x1463('0xa')](function(_0x560c1f){return _0x560c1f[_0x1463('0x8')](']')[0x0];})[0x0];_0x2759a5[_0x1463('0xb')]['push']({'field':_0x3f5926,'operator':_0x41da72,'value':_0x29bb34});});});}return _0x2759a5;};exports['buildExpression']=function(_0x2f6b4b,_0x592884,_0x53ee34){var _0x105f0e={};if(_0x592884===_0x1463('0xc')){if(_0x53ee34[_0x1463('0xd')]===_0x1463('0xe')){_0x53ee34[_0x1463('0xd')]=_0x1463('0xf');_0x53ee34['value']+=','+_0x53ee34['value'];}else if(_[_0x1463('0x10')]([_0x1463('0x11'),_0x1463('0x12')],_0x53ee34[_0x1463('0xd')])){_0x53ee34[_0x1463('0x13')]=moment(_0x53ee34[_0x1463('0x13')])[_0x1463('0x14')](0x1,_0x1463('0x15'))['format'](_0x1463('0x16'));}}if(_0x53ee34[_0x1463('0x17')]){_0x592884=_0x53ee34[_0x1463('0x17')];_0x105f0e[_0x1463('0x18')]=_0x1463('0x19')+_0x2f6b4b+'.'+_0x53ee34[_0x1463('0x1a')]+_0x1463('0x1b')+_0x53ee34[_0x1463('0x17')]+')\x20'+parseOperator(_0x53ee34[_0x1463('0xd')]);}else{_0x105f0e['text']=_0x2f6b4b+'.'+_0x53ee34['field']+'\x20'+parseOperator(_0x53ee34[_0x1463('0xd')]);}if(_['includes'](['$ne',_0x1463('0x1c')],_0x53ee34['operator']))_0x105f0e[_0x1463('0x18')]='('+_0x105f0e[_0x1463('0x18')]+_0x1463('0x1d')+_0x2f6b4b+'.'+_0x53ee34['field']+_0x1463('0x1e');_0x105f0e[_0x1463('0x13')]=parseValue(_0x592884,_0x53ee34[_0x1463('0xd')],_0x53ee34['value']);return _0x105f0e;};function parseOperator(_0x11ba7c){var _0xffe1c;switch(_0x11ba7c){case _0x1463('0x1f'):_0xffe1c=_0x1463('0x20');break;case _0x1463('0x1c'):_0xffe1c=_0x1463('0x21');break;case _0x1463('0xe'):_0xffe1c=_0x1463('0x22');break;case'$ne':_0xffe1c=_0x1463('0x23');break;case'$substring':case'$startsWith':case _0x1463('0x24'):_0xffe1c=_0x1463('0x25');break;case _0x1463('0x26'):_0xffe1c='<\x20?';break;case _0x1463('0x11'):_0xffe1c=_0x1463('0x27');break;case _0x1463('0x12'):_0xffe1c='<=\x20?';break;case _0x1463('0x28'):_0xffe1c=_0x1463('0x29');break;case _0x1463('0xf'):_0xffe1c=_0x1463('0x2a');break;}return _0xffe1c;}function parseValue(_0x3b1648,_0x1152be,_0x50dae6){var _0x214779={'start':undefined,'end':undefined};switch(_0x1152be){case _0x1463('0x1f'):case _0x1463('0x1c'):_0x214779[_0x1463('0x2b')]=_0x50dae6[_0x1463('0x8')](',');break;case _0x1463('0x2c'):_0x214779[_0x1463('0x2b')]='%'+_0x50dae6+'%';break;case _0x1463('0x2d'):_0x214779['start']=_0x50dae6+'%';break;case _0x1463('0x24'):_0x214779[_0x1463('0x2b')]='%'+_0x50dae6;break;case _0x1463('0xf'):var _0x24b85d=_0x50dae6[_0x1463('0x8')](',');var _0x50dae6=_0x24b85d[_0x1463('0x2e')]();var _0x5459a8=_0x24b85d[_0x1463('0x2f')]();if(_0x3b1648===_0x1463('0xc')){_0x50dae6=moment(_0x50dae6)['utcOffset'](0x0,!![])[_0x1463('0x30')]();_0x5459a8=moment(_0x5459a8)[_0x1463('0x31')](0x0,!![])[_0x1463('0x14')](0x17,_0x1463('0x32'))[_0x1463('0x14')](0x3b,'minutes')[_0x1463('0x14')](0x3b,_0x1463('0x33'))[_0x1463('0x30')]();}_0x214779={'start':_0x50dae6,'end':_0x5459a8};break;default:_0x214779['start']=_0x50dae6;break;}return _0x214779;} \ No newline at end of file +var _0xd5aa=['field','\x20AS\x20','castTo','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','$startsWith','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','[$and]','replace','[$or]','split','length','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','text','CAST('];(function(_0x478de7,_0x3deb50){var _0x290cbd=function(_0x56821b){while(--_0x56821b){_0x478de7['push'](_0x478de7['shift']());}};_0x290cbd(++_0x3deb50);}(_0xd5aa,0x146));var _0xad5a=function(_0x20964f,_0x4b819d){_0x20964f=_0x20964f-0x0;var _0x1b2df4=_0xd5aa[_0x20964f];return _0x1b2df4;};'use strict';var _=require(_0xad5a('0x0'));var moment=require(_0xad5a('0x1'));exports[_0xad5a('0x2')]=function(_0x35b091){var _0x2d86b5={'conditions':[]};_0x2d86b5[_0xad5a('0x3')]=_[_0xad5a('0x4')](_0x35b091,'[$or]')?'or':_0xad5a('0x5');var _0x35e601=_0x35b091['replace'](_0xad5a('0x6'),'')[_0xad5a('0x7')](_0xad5a('0x8'),'')[_0xad5a('0x9')]('||');for(var _0x1bd1ad=0x0;_0x1bd1ad<_0x35e601[_0xad5a('0xa')];_0x1bd1ad++){var _0x1ab0ce=_0x35e601[_0x1bd1ad]['split'](':=');var _0x194189=_0x1ab0ce[0x0];var _0x157911=_0x1ab0ce['slice'](0x1);_0x157911[_0xad5a('0xb')](function(_0x427647){var _0xde39bd=_0x427647[_0xad5a('0x9')]('[')[_0xad5a('0xc')]();var _0x24dc72=_0x427647[_0xad5a('0xd')](/\[(.*?)\]/g);_0x24dc72['forEach'](function(_0x3a7a92){var _0x7d4246=_0x3a7a92[_0xad5a('0x9')]('[')[_0xad5a('0xe')](function(_0x37a147){return _0x37a147[_0xad5a('0xf')](']')>-0x1;})[_0xad5a('0x10')](function(_0x5a37ad){return _0x5a37ad[_0xad5a('0x9')](']')[0x0];})[0x0];_0x2d86b5[_0xad5a('0x11')][_0xad5a('0x12')]({'field':_0x194189,'operator':_0xde39bd,'value':_0x7d4246});});});}return _0x2d86b5;};exports[_0xad5a('0x13')]=function(_0x578fb3,_0x558f8c,_0x19a238){var _0x42de92={};if(_0x558f8c===_0xad5a('0x14')){if(_0x19a238['operator']===_0xad5a('0x15')){_0x19a238[_0xad5a('0x16')]=_0xad5a('0x17');_0x19a238['value']+=','+_0x19a238[_0xad5a('0x18')];}else if(_[_0xad5a('0x19')]([_0xad5a('0x1a'),_0xad5a('0x1b')],_0x19a238[_0xad5a('0x16')])){_0x19a238[_0xad5a('0x18')]=moment(_0x19a238[_0xad5a('0x18')])[_0xad5a('0x1c')](0x1,_0xad5a('0x1d'))[_0xad5a('0x1e')](_0xad5a('0x1f'));}}if(_0x19a238['castTo']){_0x558f8c=_0x19a238['castTo'];_0x42de92[_0xad5a('0x20')]=_0xad5a('0x21')+_0x578fb3+'.'+_0x19a238[_0xad5a('0x22')]+_0xad5a('0x23')+_0x19a238[_0xad5a('0x24')]+')\x20'+parseOperator(_0x19a238['operator']);}else{_0x42de92['text']=_0x578fb3+'.'+_0x19a238['field']+'\x20'+parseOperator(_0x19a238[_0xad5a('0x16')]);}if(_['includes']([_0xad5a('0x25'),'$notIn'],_0x19a238['operator']))_0x42de92['text']='('+_0x42de92[_0xad5a('0x20')]+_0xad5a('0x26')+_0x578fb3+'.'+_0x19a238['field']+_0xad5a('0x27');_0x42de92[_0xad5a('0x18')]=parseValue(_0x558f8c,_0x19a238[_0xad5a('0x16')],_0x19a238[_0xad5a('0x18')]);return _0x42de92;};function parseOperator(_0x4f0cb6){var _0x174175;switch(_0x4f0cb6){case _0xad5a('0x28'):_0x174175=_0xad5a('0x29');break;case _0xad5a('0x2a'):_0x174175=_0xad5a('0x2b');break;case _0xad5a('0x15'):_0x174175=_0xad5a('0x2c');break;case _0xad5a('0x25'):_0x174175='<>\x20?';break;case'$substring':case'$startsWith':case _0xad5a('0x2d'):_0x174175=_0xad5a('0x2e');break;case _0xad5a('0x2f'):_0x174175=_0xad5a('0x30');break;case _0xad5a('0x1a'):_0x174175=_0xad5a('0x31');break;case _0xad5a('0x1b'):_0x174175=_0xad5a('0x32');break;case _0xad5a('0x33'):_0x174175=_0xad5a('0x34');break;case _0xad5a('0x17'):_0x174175=_0xad5a('0x35');break;}return _0x174175;}function parseValue(_0x4021f4,_0x3b0cd6,_0x4d5f7b){var _0x3ee753={'start':undefined,'end':undefined};switch(_0x3b0cd6){case _0xad5a('0x28'):case _0xad5a('0x2a'):_0x3ee753[_0xad5a('0x36')]=_0x4d5f7b[_0xad5a('0x9')](',');break;case _0xad5a('0x37'):_0x3ee753['start']='%'+_0x4d5f7b+'%';break;case _0xad5a('0x38'):_0x3ee753[_0xad5a('0x36')]=_0x4d5f7b+'%';break;case _0xad5a('0x2d'):_0x3ee753[_0xad5a('0x36')]='%'+_0x4d5f7b;break;case'$between':var _0x34db96=_0x4d5f7b[_0xad5a('0x9')](',');var _0x4d5f7b=_0x34db96[_0xad5a('0xc')]();var _0x53976f=_0x34db96['pop']();if(_0x4021f4==='DATE'){_0x4d5f7b=moment(_0x4d5f7b)[_0xad5a('0x39')](0x0,!![])['format']();_0x53976f=moment(_0x53976f)['utcOffset'](0x0,!![])[_0xad5a('0x1c')](0x17,'hours')[_0xad5a('0x1c')](0x3b,_0xad5a('0x3a'))[_0xad5a('0x1c')](0x3b,_0xad5a('0x3b'))[_0xad5a('0x1e')]();}_0x3ee753={'start':_0x4d5f7b,'end':_0x53976f};break;default:_0x3ee753[_0xad5a('0x36')]=_0x4d5f7b;break;}return _0x3ee753;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 20e1a14..2fc961a 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 _0xdb94=['type','DATE','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','uniqueid','isArray','limit','offset','sort','map','priority','cast','col','substr','unsigned','ASC','omit','isEmpty','length','isObject','isString','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','replace','push','{EXPR}','join','query','name','intersection','attributes','nolimit','order','where','pick','filter','columns','merge','VIRTUAL','lower','options','include','includeAll','sequelize','moment','parse','includes','keys','model','alias','raw','fields','split','filters'];(function(_0x3611dd,_0x4bfc20){var _0x4e3cd1=function(_0x539877){while(--_0x539877){_0x3611dd['push'](_0x3611dd['shift']());}};_0x4e3cd1(++_0x4bfc20);}(_0xdb94,0xe5));var _0x4db9=function(_0x371925,_0x4de48a){_0x371925=_0x371925-0x0;var _0x5b09e3=_0xdb94[_0x371925];return _0x5b09e3;};'use strict';var _=require('lodash');var sequelize=require(_0x4db9('0x0'));var moment=require(_0x4db9('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x26e16b){var _0x3b24a6=['ne'];try{var _0x25b510=JSON[_0x4db9('0x2')](_0x26e16b);var _0x1f05d4=Object['keys'](_0x25b510)[0x0];return _0x3b24a6[_0x4db9('0x3')](_0x1f05d4);}catch(_0x541226){return![];}}function getOperatorValue(_0x1d21a8){var _0xc76bc1=JSON[_0x4db9('0x2')](_0x1d21a8);var _0x3404f6=Object[_0x4db9('0x4')](_0xc76bc1)[0x0];var _0x57c701=_0xc76bc1[_0x3404f6];return{['$'+_0x3404f6]:_0x57c701};}function parseIncludeModel(_0x45d5a3){var _0x4376c8=JSON[_0x4db9('0x2')](_0x45d5a3);return{'model':db[_0x4376c8[_0x4db9('0x5')]],'as':_0x4376c8[_0x4db9('0x6')],'attributes':_0x4376c8['fields'],'raw':_0x4376c8[_0x4db9('0x7')]};}exports[_0x4db9('0x8')]=function(_0x31f02d){var _0xe6de11=null;if(_0x31f02d){_0xe6de11=_0x31f02d[_0x4db9('0x9')](',');}return _0xe6de11;};exports[_0x4db9('0xa')]=function(_0x58b34a,_0x2a7107){var _0x4397fc={};if(!_['isEmpty'](_0x58b34a)){_['forOwn'](_0x58b34a,function(_0x19f2d3,_0x3ac147){try{if(_0x2a7107){var _0x34ec92=_['find'](_0x2a7107,{'name':_0x3ac147})||{};if(hasSequelizeOperator(_0x19f2d3)){_0x4397fc[_0x3ac147]=getOperatorValue(_0x19f2d3);}else if(_0x34ec92[_0x4db9('0xb')]===_0x4db9('0xc')&&_[_0x4db9('0xd')](_0x19f2d3)){var _0x1ea47d=JSON[_0x4db9('0x2')](_0x19f2d3);var _0x585230={'$gte':moment(moment(_0x1ea47d[_0x4db9('0xe')])[_0x4db9('0xf')]('YYYY-MM-DD'))[_0x4db9('0x10')]()[_0x4db9('0xf')](),'$lte':moment(moment(_0x1ea47d[_0x4db9('0x11')])['format'](_0x4db9('0x12')))[_0x4db9('0x10')]()['subtract'](0x1,'s')['format']()};_0x4397fc[_0x3ac147]=_0x585230;}else if(_0x34ec92['name']===_0x4db9('0x13')){_0x4397fc[_0x3ac147]=_0x19f2d3;}else{_0x4397fc[_0x3ac147]=_[_0x4db9('0x14')](_0x19f2d3)?_0x19f2d3:JSON['parse'](_0x19f2d3);}}else{_0x4397fc[_0x3ac147]=_[_0x4db9('0x14')](_0x19f2d3)?_0x19f2d3:JSON[_0x4db9('0x2')](_0x19f2d3);}}catch(_0x353718){_0x4397fc[_0x3ac147]=_0x19f2d3[_0x4db9('0x9')](',');}});}return _0x4397fc;};exports[_0x4db9('0x15')]=function(_0x28b7f6){_0x28b7f6=parseInt(_0x28b7f6,0xa);if(!_0x28b7f6||_0x28b7f6<0x0){_0x28b7f6=LIMIT_VALUE;}return _0x28b7f6;};exports[_0x4db9('0x16')]=function(_0x111f4a){_0x111f4a=parseInt(_0x111f4a,0xa);if(!_0x111f4a||_0x111f4a<0x0){_0x111f4a=0x0;}return _0x111f4a;};exports[_0x4db9('0x17')]=function(_0x41d0c1){var _0x29b4ff,_0x102402=null;if(_0x41d0c1){_0x29b4ff=_0x41d0c1['split'](',');_0x102402=_[_0x4db9('0x18')](_0x29b4ff,function(_0x2917bd){if(_0x2917bd['indexOf']('-')===0x0){return[_0x2917bd===_0x4db9('0x19')?sequelize[_0x4db9('0x1a')](sequelize[_0x4db9('0x1b')](_0x4db9('0x19')),'unsigned'):_0x2917bd[_0x4db9('0x1c')](0x1),'DESC'];}else{return[_0x2917bd===_0x4db9('0x19')?sequelize[_0x4db9('0x1a')](sequelize[_0x4db9('0x1b')](_0x4db9('0x19')),_0x4db9('0x1d')):_0x2917bd,_0x4db9('0x1e')];}});}return _0x102402;};exports[_0x4db9('0x1f')]=function(_0x5e7d29,_0x5f59be){if(_[_0x4db9('0x20')](_0x5e7d29)){return _0x5e7d29;}if(_['isArray'](_0x5e7d29)){for(var _0x910137=0x0;_0x910137<_0x5e7d29[_0x4db9('0x21')];_0x910137+=0x1){_0x5e7d29[_0x910137]=this[_0x4db9('0x1f')](_0x5e7d29[_0x910137],_0x5f59be);}return _0x5e7d29;}if(!_[_0x4db9('0x22')](_0x5e7d29)){return _0x5e7d29;}if(_[_0x4db9('0x23')](_0x5f59be)){_0x5f59be=[_0x5f59be];}if(!_[_0x4db9('0x14')](_0x5f59be)){return _0x5e7d29;}for(var _0x1d0dc2=0x0;_0x1d0dc2<_0x5f59be[_0x4db9('0x21')];_0x1d0dc2+=0x1){_['unset'](_0x5e7d29,_0x5f59be[_0x1d0dc2]);}for(var _0x35f757 in _0x5e7d29){if(_0x5e7d29['hasOwnProperty'](_0x35f757)){_0x5e7d29[_0x35f757]=this[_0x4db9('0x1f')](_0x5e7d29[_0x35f757],_0x5f59be);}}return _0x5e7d29;};exports[_0x4db9('0x24')]=function(_0x1e7840){return _0x1e7840[_0x4db9('0x25')](RegExp(_0x4db9('0x26')))?!![]:![];};exports['isEmail']=function(_0x2d6d00){return _0x2d6d00[_0x4db9('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x4db9('0x27')]=function(_0x31fe6a,_0x5a16e4){var _0x553d07=[];var _0x15841b=/[ `!@#$%^&*()_\-?~]/;var _0x39e528=_0x5a16e4?'\x22{EXPR}\x22':'{EXPR}';_0x31fe6a[_0x4db9('0x9')](/[ ,]+/)['forEach'](function(_0x4c2449){_0x4c2449=_0x4c2449[_0x4db9('0x28')](/([^:]")"+/g,'$1');_0x4c2449='+'+_0x4c2449+'*';var _0x83f4e8=_0x4c2449['match'](_0x15841b);if(_0x83f4e8){_0x4c2449='\x22'+_0x4c2449+'\x22';}_0x553d07[_0x4db9('0x29')](_0x4c2449);});_0x39e528=_0x39e528[_0x4db9('0x28')](_0x4db9('0x2a'),_0x553d07[_0x4db9('0x2b')]('\x20'));return _0x39e528;};exports['getOptions']=function(_0x444d84,_0x4f3594,_0x4c1dc0){var _0x4999d1={},_0x2bc7df={};if(_0x4f3594[_0x4db9('0x2c')]['$id']){_0x4f3594[_0x4db9('0x2c')]['id']=_0x4f3594[_0x4db9('0x2c')]['$id'];delete _0x4f3594['query']['$id'];}_0x4999d1[_0x4db9('0x5')]=_['map'](_0x444d84,_0x4db9('0x2d'));_0x4999d1['query']=_[_0x4db9('0x4')](_0x4f3594[_0x4db9('0x2c')]);_0x4999d1[_0x4db9('0xa')]=_[_0x4db9('0x2e')](_0x4999d1[_0x4db9('0x5')],_0x4999d1['query']);_0x2bc7df[_0x4db9('0x2f')]=_['intersection'](_0x4999d1[_0x4db9('0x5')],this[_0x4db9('0x8')](_0x4f3594[_0x4db9('0x2c')][_0x4db9('0x8')]));_0x2bc7df[_0x4db9('0x2f')]=_0x2bc7df[_0x4db9('0x2f')]['length']?_0x2bc7df[_0x4db9('0x2f')]:_0x4999d1[_0x4db9('0x5')];if(!_0x4f3594['query']['hasOwnProperty'](_0x4db9('0x30'))){_0x2bc7df[_0x4db9('0x15')]=this[_0x4db9('0x15')](_0x4f3594[_0x4db9('0x2c')][_0x4db9('0x15')]);_0x2bc7df[_0x4db9('0x16')]=this[_0x4db9('0x16')](_0x4f3594[_0x4db9('0x2c')][_0x4db9('0x16')]);}_0x2bc7df[_0x4db9('0x31')]=this[_0x4db9('0x17')](_0x4f3594[_0x4db9('0x2c')]['sort']);_0x2bc7df[_0x4db9('0x32')]=this[_0x4db9('0xa')](_[_0x4db9('0x33')](_0x4f3594[_0x4db9('0x2c')],_0x4999d1['filters']),_0x444d84);if(_0x4f3594['query'][_0x4db9('0x34')]){var _0x2b18a2=_0x444d84;var _0x2fc233=_0x4f3594['query'][_0x4db9('0x34')];if(typeof _0x2fc233==='object'){_0x2b18a2=_[_0x4db9('0x34')](_0x444d84,function(_0xce53a7){return _[_0x4db9('0x3')](_0x2fc233[_0x4db9('0x35')],_0xce53a7[_0x4db9('0x2d')]);});_0x2fc233=_0x2fc233['value'];}_0x2bc7df[_0x4db9('0x32')]=_[_0x4db9('0x36')](_0x2bc7df[_0x4db9('0x32')],{'$or':_[_0x4db9('0x18')](_0x2b18a2,function(_0x36480a){if(_0x36480a['type']!==_0x4db9('0x37')){if(_0x4c1dc0){return sequelize[_0x4db9('0x32')](sequelize['fn'](_0x4db9('0x38'),sequelize[_0x4db9('0x1b')](_0x36480a[_0x4db9('0x2d')])),{'$like':sequelize['fn'](_0x4db9('0x38'),'%'+_0x4f3594[_0x4db9('0x2c')][_0x4db9('0x34')]+'%')});}else{var _0x8ebc63={};_0x8ebc63[_0x36480a['name']]={'$like':'%'+_0x4f3594[_0x4db9('0x2c')]['filter']+'%'};return _0x8ebc63;}}})});}_0x2bc7df=_['merge']({},_0x2bc7df,_0x4f3594[_0x4db9('0x39')]);return _0x2bc7df;};exports[_0x4db9('0x3a')]=function(_0x4fb6f9){var _0x4d9e2e=[];if(_0x4fb6f9[_0x4db9('0x3b')]){_0x4d9e2e[_0x4db9('0x29')]({'all':!![]});}else if(_0x4fb6f9[_0x4db9('0x3a')]){if(Array[_0x4db9('0x14')](_0x4fb6f9[_0x4db9('0x3a')])){_0x4d9e2e=Object[_0x4db9('0x4')](_0x4fb6f9[_0x4db9('0x3a')])[_0x4db9('0x18')](function(_0x17ea04){return parseIncludeModel(_0x4fb6f9[_0x4db9('0x3a')][_0x17ea04]);});}else{var _0x43312c=parseIncludeModel(_0x4fb6f9['include']);_0x4d9e2e[_0x4db9('0x29')](_0x43312c);}}return _0x4d9e2e;}; \ No newline at end of file +var _0x370d=['\x22{EXPR}\x22','forEach','replace','{EXPR}','query','intersection','attributes','limit','order','where','filter','object','columns','merge','VIRTUAL','lower','options','includeAll','push','include','lodash','moment','parse','keys','includes','model','alias','fields','raw','split','filters','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','col','unsigned','DESC','ASC','isEmpty','length','omit','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue'];(function(_0xf402ce,_0x4a7b32){var _0x46c801=function(_0x3e535b){while(--_0x3e535b){_0xf402ce['push'](_0xf402ce['shift']());}};_0x46c801(++_0x4a7b32);}(_0x370d,0x194));var _0xd370=function(_0x367c53,_0x524366){_0x367c53=_0x367c53-0x0;var _0x4019f5=_0x370d[_0x367c53];return _0x4019f5;};'use strict';var _=require(_0xd370('0x0'));var sequelize=require('sequelize');var moment=require(_0xd370('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x293167){var _0x27928b=['ne'];try{var _0xb556a3=JSON[_0xd370('0x2')](_0x293167);var _0x1af247=Object[_0xd370('0x3')](_0xb556a3)[0x0];return _0x27928b[_0xd370('0x4')](_0x1af247);}catch(_0x34e8f0){return![];}}function getOperatorValue(_0xe2940d){var _0x516e57=JSON[_0xd370('0x2')](_0xe2940d);var _0x1f748d=Object['keys'](_0x516e57)[0x0];var _0x3b7eb0=_0x516e57[_0x1f748d];return{['$'+_0x1f748d]:_0x3b7eb0};}function parseIncludeModel(_0x4d2b15){var _0x3e9235=JSON[_0xd370('0x2')](_0x4d2b15);return{'model':db[_0x3e9235[_0xd370('0x5')]],'as':_0x3e9235[_0xd370('0x6')],'attributes':_0x3e9235[_0xd370('0x7')],'raw':_0x3e9235[_0xd370('0x8')]};}exports[_0xd370('0x7')]=function(_0x5f49be){var _0x24fc2c=null;if(_0x5f49be){_0x24fc2c=_0x5f49be[_0xd370('0x9')](',');}return _0x24fc2c;};exports[_0xd370('0xa')]=function(_0xabc330,_0x1007b4){var _0x271404={};if(!_['isEmpty'](_0xabc330)){_[_0xd370('0xb')](_0xabc330,function(_0x15ec10,_0x34860f){try{if(_0x1007b4){var _0x2c0daf=_[_0xd370('0xc')](_0x1007b4,{'name':_0x34860f})||{};if(hasSequelizeOperator(_0x15ec10)){_0x271404[_0x34860f]=getOperatorValue(_0x15ec10);}else if(_0x2c0daf['type']===_0xd370('0xd')&&_[_0xd370('0xe')](_0x15ec10)){var _0x18f9ff=JSON[_0xd370('0x2')](_0x15ec10);var _0x549356={'$gte':moment(moment(_0x18f9ff[_0xd370('0xf')])[_0xd370('0x10')](_0xd370('0x11')))[_0xd370('0x12')]()[_0xd370('0x10')](),'$lte':moment(moment(_0x18f9ff[_0xd370('0x13')])['format'](_0xd370('0x11')))['utc']()[_0xd370('0x14')](0x1,'s')[_0xd370('0x10')]()};_0x271404[_0x34860f]=_0x549356;}else if(_0x2c0daf[_0xd370('0x15')]===_0xd370('0x16')){_0x271404[_0x34860f]=_0x15ec10;}else{_0x271404[_0x34860f]=_[_0xd370('0x17')](_0x15ec10)?_0x15ec10:JSON[_0xd370('0x2')](_0x15ec10);}}else{_0x271404[_0x34860f]=_[_0xd370('0x17')](_0x15ec10)?_0x15ec10:JSON[_0xd370('0x2')](_0x15ec10);}}catch(_0x44670e){_0x271404[_0x34860f]=_0x15ec10[_0xd370('0x9')](',');}});}return _0x271404;};exports['limit']=function(_0x19c6e5){_0x19c6e5=parseInt(_0x19c6e5,0xa);if(!_0x19c6e5||_0x19c6e5<0x0){_0x19c6e5=LIMIT_VALUE;}return _0x19c6e5;};exports[_0xd370('0x18')]=function(_0x40e494){_0x40e494=parseInt(_0x40e494,0xa);if(!_0x40e494||_0x40e494<0x0){_0x40e494=0x0;}return _0x40e494;};exports[_0xd370('0x19')]=function(_0x450e28){var _0x44464e,_0x251436=null;if(_0x450e28){_0x44464e=_0x450e28[_0xd370('0x9')](',');_0x251436=_[_0xd370('0x1a')](_0x44464e,function(_0x26b594){if(_0x26b594[_0xd370('0x1b')]('-')===0x0){return[_0x26b594===_0xd370('0x1c')?sequelize['cast'](sequelize[_0xd370('0x1d')]('priority'),_0xd370('0x1e')):_0x26b594['substr'](0x1),_0xd370('0x1f')];}else{return[_0x26b594===_0xd370('0x1c')?sequelize['cast'](sequelize[_0xd370('0x1d')]('priority'),_0xd370('0x1e')):_0x26b594,_0xd370('0x20')];}});}return _0x251436;};exports['omit']=function(_0x525b8f,_0x4cee28){if(_[_0xd370('0x21')](_0x525b8f)){return _0x525b8f;}if(_[_0xd370('0x17')](_0x525b8f)){for(var _0x5d6b4d=0x0;_0x5d6b4d<_0x525b8f[_0xd370('0x22')];_0x5d6b4d+=0x1){_0x525b8f[_0x5d6b4d]=this[_0xd370('0x23')](_0x525b8f[_0x5d6b4d],_0x4cee28);}return _0x525b8f;}if(!_[_0xd370('0x24')](_0x525b8f)){return _0x525b8f;}if(_[_0xd370('0x25')](_0x4cee28)){_0x4cee28=[_0x4cee28];}if(!_['isArray'](_0x4cee28)){return _0x525b8f;}for(var _0x547851=0x0;_0x547851<_0x4cee28[_0xd370('0x22')];_0x547851+=0x1){_[_0xd370('0x26')](_0x525b8f,_0x4cee28[_0x547851]);}for(var _0x5d58a1 in _0x525b8f){if(_0x525b8f['hasOwnProperty'](_0x5d58a1)){_0x525b8f[_0x5d58a1]=this[_0xd370('0x23')](_0x525b8f[_0x5d58a1],_0x4cee28);}}return _0x525b8f;};exports[_0xd370('0x27')]=function(_0x2823fb){return _0x2823fb[_0xd370('0x28')](RegExp(_0xd370('0x29')))?!![]:![];};exports[_0xd370('0x2a')]=function(_0x4f86bf){return _0x4f86bf['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xd370('0x2b')]=function(_0x173a39,_0x4a7371){var _0x1f4091=[];var _0x374a38=/[ `!@#$%^&*()_\-?~]/;var _0x5aaf4d=_0x4a7371?_0xd370('0x2c'):'{EXPR}';_0x173a39[_0xd370('0x9')](/[ ,]+/)[_0xd370('0x2d')](function(_0x56e4e4){_0x56e4e4=_0x56e4e4[_0xd370('0x2e')](/([^:]")"+/g,'$1');_0x56e4e4='+'+_0x56e4e4+'*';var _0x41c909=_0x56e4e4[_0xd370('0x28')](_0x374a38);if(_0x41c909){_0x56e4e4='\x22'+_0x56e4e4+'\x22';}_0x1f4091['push'](_0x56e4e4);});_0x5aaf4d=_0x5aaf4d[_0xd370('0x2e')](_0xd370('0x2f'),_0x1f4091['join']('\x20'));return _0x5aaf4d;};exports['getOptions']=function(_0x2cf49b,_0x5a1750,_0x28c67a){var _0x3e7cf5={},_0x567a26={};if(_0x5a1750[_0xd370('0x30')]['$id']){_0x5a1750['query']['id']=_0x5a1750[_0xd370('0x30')]['$id'];delete _0x5a1750['query']['$id'];}_0x3e7cf5['model']=_[_0xd370('0x1a')](_0x2cf49b,'name');_0x3e7cf5[_0xd370('0x30')]=_[_0xd370('0x3')](_0x5a1750[_0xd370('0x30')]);_0x3e7cf5['filters']=_[_0xd370('0x31')](_0x3e7cf5[_0xd370('0x5')],_0x3e7cf5['query']);_0x567a26[_0xd370('0x32')]=_[_0xd370('0x31')](_0x3e7cf5['model'],this[_0xd370('0x7')](_0x5a1750[_0xd370('0x30')]['fields']));_0x567a26[_0xd370('0x32')]=_0x567a26['attributes'][_0xd370('0x22')]?_0x567a26[_0xd370('0x32')]:_0x3e7cf5[_0xd370('0x5')];if(!_0x5a1750['query']['hasOwnProperty']('nolimit')){_0x567a26[_0xd370('0x33')]=this['limit'](_0x5a1750['query'][_0xd370('0x33')]);_0x567a26[_0xd370('0x18')]=this[_0xd370('0x18')](_0x5a1750[_0xd370('0x30')][_0xd370('0x18')]);}_0x567a26[_0xd370('0x34')]=this[_0xd370('0x19')](_0x5a1750[_0xd370('0x30')]['sort']);_0x567a26[_0xd370('0x35')]=this['filters'](_['pick'](_0x5a1750[_0xd370('0x30')],_0x3e7cf5[_0xd370('0xa')]),_0x2cf49b);if(_0x5a1750[_0xd370('0x30')][_0xd370('0x36')]){var _0x2182a0=_0x2cf49b;var _0x309940=_0x5a1750[_0xd370('0x30')]['filter'];if(typeof _0x309940===_0xd370('0x37')){_0x2182a0=_['filter'](_0x2cf49b,function(_0x37e176){return _['includes'](_0x309940[_0xd370('0x38')],_0x37e176[_0xd370('0x15')]);});_0x309940=_0x309940['value'];}_0x567a26[_0xd370('0x35')]=_[_0xd370('0x39')](_0x567a26[_0xd370('0x35')],{'$or':_['map'](_0x2182a0,function(_0x3a255e){if(_0x3a255e['type']!==_0xd370('0x3a')){if(_0x28c67a){return sequelize[_0xd370('0x35')](sequelize['fn'](_0xd370('0x3b'),sequelize[_0xd370('0x1d')](_0x3a255e[_0xd370('0x15')])),{'$like':sequelize['fn'](_0xd370('0x3b'),'%'+_0x5a1750[_0xd370('0x30')]['filter']+'%')});}else{var _0xa1a55d={};_0xa1a55d[_0x3a255e[_0xd370('0x15')]]={'$like':'%'+_0x5a1750[_0xd370('0x30')][_0xd370('0x36')]+'%'};return _0xa1a55d;}}})});}_0x567a26=_['merge']({},_0x567a26,_0x5a1750[_0xd370('0x3c')]);return _0x567a26;};exports['include']=function(_0x5be001){var _0x18ec03=[];if(_0x5be001[_0xd370('0x3d')]){_0x18ec03[_0xd370('0x3e')]({'all':!![]});}else if(_0x5be001[_0xd370('0x3f')]){if(Array[_0xd370('0x17')](_0x5be001[_0xd370('0x3f')])){_0x18ec03=Object[_0xd370('0x3')](_0x5be001[_0xd370('0x3f')])[_0xd370('0x1a')](function(_0x5c95ce){return parseIncludeModel(_0x5be001[_0xd370('0x3f')][_0x5c95ce]);});}else{var _0x5c01f1=parseIncludeModel(_0x5be001['include']);_0x18ec03['push'](_0x5c01f1);}}return _0x18ec03;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 8f1a533..0ee7aaa 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x425d=['getAgents','all','flatten','uniq','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','name','fullname','whatsappPause','find','merge','catch','getSortedAgentsIdsByStatus','split','globalStatus','order','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','openchannelStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','value','filterAgentAttributes','chatStatusTime','mailStatusTime','smsStatusTime','mailCapacity','openchannelCurrentCapacity','onhold','routealias','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x425d,0x1e0));var _0xd425=function(_0x11d405,_0x5ba595){_0x11d405=_0x11d405-0x0;var _0x17210a=_0x425d[_0x11d405];return _0x17210a;};'use strict';var _=require(_0xd425('0x0'));var jayson=require('jayson/promise');var db=require(_0xd425('0x1'))['db'];var amiClient=jayson[_0xd425('0x2')][_0xd425('0x3')]({'port':0x232a});var routingClient=jayson[_0xd425('0x2')][_0xd425('0x3')]({'port':0x232c});function isAgentPaused(_0x44ba48,_0x47043f){var _0x596be7=[_0x44ba48[_0xd425('0x4')],_0x44ba48[_0xd425('0x5')],_0x44ba48[_0xd425('0x6')],_0x44ba48[_0xd425('0x7')],_0x44ba48[_0xd425('0x8')],_0x44ba48[_0xd425('0x9')],_0x44ba48['whatsappPause']];if(!_0x47043f)return _[_0xd425('0xa')](_0x596be7);var _0x374c3d=_[_0xd425('0xb')](_0x596be7);return _0x374c3d[_0xd425('0xc')]>0x0&&_0x374c3d[_0xd425('0xc')]<_0x596be7[_0xd425('0xc')]?!![]:![];}function isIdle(_0x30111e){return _0x30111e===_0xd425('0xd')||_0x30111e===_0xd425('0xe')||_0x30111e===_0xd425('0xf')||_0x30111e===_0xd425('0x10')||_[_0xd425('0x11')](_0x30111e);}function isAgentIdle(_0x26f6d2){if(_0x26f6d2[_0xd425('0x12')]!==_0xd425('0xd')&&_0x26f6d2[_0xd425('0x9')]){_0x26f6d2[_0xd425('0x12')]=_0xd425('0x13');return![];}return _[_0xd425('0xa')]([_0x26f6d2[_0xd425('0x14')],_0x26f6d2['faxStatus'],_0x26f6d2[_0xd425('0x15')],_0x26f6d2[_0xd425('0x16')],_0x26f6d2[_0xd425('0x17')],_0x26f6d2['voiceStatus'],_0x26f6d2[_0xd425('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd425('0x19')](_0xd425('0x1a'),{})[_0xd425('0x1b')](function(_0x1fc822){if(_0x1fc822['error']){throw new Error(_0xd425('0x1c'));}var _0x471267=_0x1fc822[_0xd425('0x1d')];return routingClient[_0xd425('0x19')]('Agents',{})[_0xd425('0x1b')](function(_0x434d97){if(_0x434d97[_0xd425('0x1e')]){throw new Error(_0xd425('0x1f'));}var _0x4e88fa=_0x434d97['result'];return _['merge']({},_0x471267,_0x4e88fa);});})['catch'](function(_0x427304){throw _0x427304;});}exports[_0xd425('0x20')]=getRealtimeAgents;function getAgentStatus(_0x3c98db){var _0x5e797a=_0xd425('0xe');if(isAgentPaused(_0x3c98db))_0x5e797a=_0xd425('0x13');else if(isAgentPaused(_0x3c98db,!![]))_0x5e797a='*pause';else if(isAgentIdle(_0x3c98db))_0x5e797a=_0xd425('0xd');else _0x5e797a=_0xd425('0x21');return _0x5e797a;}exports[_0xd425('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x1d3fc0,_0x3e93db){var _0xb240c4=_[_0xd425('0x23')](_0x1d3fc0)?_0x1d3fc0:[_0x1d3fc0];var _0x3500bb=_[_0xd425('0x24')](_0x3e93db)+_0xd425('0x25');var _0x151ad9=_[_0xd425('0x26')](_0xb240c4,function(_0x47f44a){return db[_0x3500bb][_0xd425('0x27')]({'where':{'id':_0x47f44a}})[_0xd425('0x1b')](function(_0x398985){if(!_0x398985)return[];return _0x398985[_0xd425('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd425('0x29')](_0x151ad9)[_0xd425('0x1b')](function(_0x3c3402){var _0x577e4b=_(_0x3c3402)[_0xd425('0x2a')]()[_0xd425('0x26')]('id')[_0xd425('0x2b')]()['value']();return _0x577e4b;});}exports[_0xd425('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3ad9bd,_0x433189,_0x999fb9){try{if(_0x433189[_0xd425('0xc')]>0x0){_0x3ad9bd=_0x3ad9bd[_0xd425('0xb')](function(_0x2fd17a){return _0x433189[_0xd425('0x2d')](_0x2fd17a['id']);});}var _0x24da23=_0x3ad9bd[_0xd425('0xb')](function(_0x482ba6){var _0x471e3e=_0xd425('0x21');if(isAgentIdle(_0x482ba6)){_0x471e3e=_0xd425('0xd');}return _0x471e3e===_0x999fb9;});return _[_0xd425('0x26')](_0x24da23,'id');}catch(_0x3275b1){throw _0x3275b1;}}exports[_0xd425('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x47405f,_0x40c392,_0x3ec51b){return Promise[_0xd425('0x2f')]()[_0xd425('0x1b')](function(){if(_0x40c392['length']>0x0){_0x47405f=_0x47405f[_0xd425('0xb')](function(_0x2a2a9b){return _0x40c392[_0xd425('0x2d')](_0x2a2a9b['id']);});}return _0x47405f;})[_0xd425('0x1b')](function(){return db[_0xd425('0x30')]['findAll']({'attributes':['id',_0xd425('0x31'),_0xd425('0x32'),'chatPause','faxPause','mailPause',_0xd425('0x7'),_0xd425('0x8'),_0xd425('0x9'),_0xd425('0x33'),'pauseType'],'where':{'id':{'$in':_[_0xd425('0x26')](_0x47405f,'id')}},'raw':!![]});})[_0xd425('0x1b')](function(_0x30a9dc){return _0x30a9dc[_0xd425('0x26')](function(_0x27b9e2){var _0x1e12f2=_[_0xd425('0x34')](_0x47405f,['id',_0x27b9e2['id']]);var _0x533af1=filterAgentAttributes(_0x1e12f2);_[_0xd425('0x35')](_0x27b9e2,_0x533af1);_0x27b9e2['globalStatus']=getAgentStatus(_0x27b9e2);return _0x27b9e2;});})[_0xd425('0x1b')](function(_0x29cca9){var _0x36c8da=sortAgentsByStatus(_0x29cca9,_0x3ec51b);return _['map'](_0x36c8da,'id');})[_0xd425('0x36')](function(_0x26806c){throw _0x26806c;});}exports[_0xd425('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x46cfe2){var _0x58f36d={'fields':[],'order':null};var _0x1d38fa=_0x46cfe2[_0xd425('0x38')](',');_0x58f36d['fields']=_['filter'](_0x1d38fa,function(_0x48fc85){if(!_0x48fc85[_0xd425('0x2d')](_0xd425('0x39'))){return!![];}_0x58f36d[_0xd425('0x3a')]=_['startsWith'](_0x48fc85,'-')?'DESC':'ASC';return![];});return _0x58f36d;}exports[_0xd425('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x3f9090){if(!_0x3f9090){_0x3f9090=_0xd425('0x3c');}if(_0x3f9090[_0xd425('0x2d')](_0xd425('0x32'))&&!_0x3f9090[_0xd425('0x2d')](_0xd425('0x3d'))){var _0x4b922f=_0x3f9090[_0xd425('0x3e')](0x0,_0x3f9090[_0xd425('0x3f')](_0xd425('0x32')));_0x3f9090+=','+_0x4b922f+'internal';}return _0x3f9090;}exports[_0xd425('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x2dffc7,_0x336a87){var _0x5dc4c4=_0x2dffc7[_0xd425('0x41')](function(_0x12b970,_0x1c5ba6){if(_0x12b970[_0xd425('0x39')]===_0x1c5ba6['globalStatus']){if(_0x12b970[_0xd425('0x39')]===_0xd425('0x13')){if(_0x336a87===_0xd425('0x42')){return(_0x12b970[_0xd425('0x43')]||'')<(_0x1c5ba6[_0xd425('0x43')]||'')||_0x12b970[_0xd425('0x32')][_0xd425('0x44')]()>_0x1c5ba6['fullname'][_0xd425('0x44')]()?0x1:-0x1;}else{return(_0x12b970[_0xd425('0x43')]||'')<(_0x1c5ba6['pauseType']||'')||_0x12b970[_0xd425('0x32')]['toLowerCase']()>_0x1c5ba6['fullname'][_0xd425('0x44')]()?-0x1:0x1;}}else{if(_0x336a87==='DESC'){return _0x12b970[_0xd425('0x32')]['toLowerCase']()<_0x1c5ba6[_0xd425('0x32')][_0xd425('0x44')]()?0x1:-0x1;}else{return _0x12b970[_0xd425('0x32')][_0xd425('0x44')]()<_0x1c5ba6[_0xd425('0x32')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x336a87===_0xd425('0x42')){return _0x12b970['globalStatus']<_0x1c5ba6[_0xd425('0x39')]?0x1:-0x1;}else{return _0x12b970['globalStatus']<_0x1c5ba6[_0xd425('0x39')]?-0x1:0x1;}}});return _0x5dc4c4;}exports[_0xd425('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0x3fd2ce){var _0x15d8fd=[_0xd425('0x46'),'online',_0xd425('0x47'),_0xd425('0x48'),_0xd425('0x43'),_0xd425('0x48'),_0xd425('0x3d'),'address',_0xd425('0x4'),_0xd425('0x7'),_0xd425('0x6'),_0xd425('0x8'),_0xd425('0x33'),_0xd425('0x5'),'voicePause',_0xd425('0x49'),_0xd425('0x4a'),'mailCapacity',_0xd425('0x4b'),_0xd425('0x4c'),_0xd425('0x4d'),_0xd425('0x4e'),'openchannelCurrentCapacity',_0xd425('0x4f'),_0xd425('0x50'),_0xd425('0x51'),_0xd425('0x52'),_0xd425('0x14'),'openchannelStatus','mailStatus',_0xd425('0x17'),'whatsappStatus',_0xd425('0x53'),_0xd425('0x12'),'chatStatusTime',_0xd425('0x54'),'mailStatusTime','smsStatusTime',_0xd425('0x55'),_0xd425('0x56'),_0xd425('0x57'),_0xd425('0x58'),_0xd425('0x59'),_0xd425('0x5a'),_0xd425('0x5b'),_0xd425('0x5c'),'routealias'];var _0x11ed71=[_0xd425('0x4'),_0xd425('0x7'),_0xd425('0x6'),_0xd425('0x8'),_0xd425('0x33'),_0xd425('0x5'),_0xd425('0x9'),'online'];var _0x4a2508=_(_0x3fd2ce)['omit'](_0x11ed71)[_0xd425('0x5d')](_0x15d8fd)[_0xd425('0x5e')]();return _0x4a2508;}exports[_0xd425('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xd425('0x31'),'fullname','role','internal','online',_0xd425('0x39'),_0xd425('0x46'),'lastLoginAt',_0xd425('0x43'),_0xd425('0x48'),_0xd425('0x5'),'chatPause','mailPause',_0xd425('0x7'),'smsPause','voicePause','whatsappPause',_0xd425('0x14'),_0xd425('0x53'),_0xd425('0x15'),'openchannelStatus',_0xd425('0x17'),'voiceStatus',_0xd425('0x18'),_0xd425('0x60'),_0xd425('0x56'),_0xd425('0x61'),_0xd425('0x54'),_0xd425('0x62'),_0xd425('0x57'),_0xd425('0x55'),_0xd425('0x49'),'faxCapacity',_0xd425('0x63'),_0xd425('0x4a'),_0xd425('0x4b'),_0xd425('0x4c'),'chatCurrentCapacity','faxCurrentCapacity',_0xd425('0x4f'),_0xd425('0x64'),_0xd425('0x50'),_0xd425('0x51'),_0xd425('0x5b'),_0xd425('0x5c'),_0xd425('0x59'),_0xd425('0x65'),_0xd425('0x58'),_0xd425('0x66'),_0xd425('0x5a')];}exports[_0xd425('0x67')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xdc97=['openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','value','filterAgentAttributes','role','userpic','voiceStatusTime','mailCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','chatPause','faxPause','mailPause','smsPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','isArray','Queue','map','findOne','uniq','getAgentIdsByQueues','includes','resolve','name','openchannelPause','voicePause','whatsappPause','pauseType','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','fullname,internal','fullname','internal','substring','indexOf','toLowerCase','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus'];(function(_0x4f939a,_0x5232ee){var _0xb1d4eb=function(_0x19821b){while(--_0x19821b){_0x4f939a['push'](_0x4f939a['shift']());}};_0xb1d4eb(++_0x5232ee);}(_0xdc97,0x13b));var _0x7dc9=function(_0x47bc76,_0x551259){_0x47bc76=_0x47bc76-0x0;var _0x1992a1=_0xdc97[_0x47bc76];return _0x1992a1;};'use strict';var _=require(_0x7dc9('0x0'));var jayson=require(_0x7dc9('0x1'));var db=require(_0x7dc9('0x2'))['db'];var amiClient=jayson['client'][_0x7dc9('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x7dc9('0x3')]({'port':0x232c});function isAgentPaused(_0x2b86da,_0x478a95){var _0x2a77c1=[_0x2b86da[_0x7dc9('0x4')],_0x2b86da[_0x7dc9('0x5')],_0x2b86da[_0x7dc9('0x6')],_0x2b86da['openchannelPause'],_0x2b86da[_0x7dc9('0x7')],_0x2b86da['voicePause'],_0x2b86da['whatsappPause']];if(!_0x478a95)return _[_0x7dc9('0x8')](_0x2a77c1);var _0x23737d=_[_0x7dc9('0x9')](_0x2a77c1);return _0x23737d[_0x7dc9('0xa')]>0x0&&_0x23737d[_0x7dc9('0xa')]<_0x2a77c1['length']?!![]:![];}function isIdle(_0xb2fa2a){return _0xb2fa2a===_0x7dc9('0xb')||_0xb2fa2a===_0x7dc9('0xc')||_0xb2fa2a===_0x7dc9('0xd')||_0xb2fa2a===_0x7dc9('0xe')||_[_0x7dc9('0xf')](_0xb2fa2a);}function isAgentIdle(_0x1e336a){if(_0x1e336a['voiceStatus']!=='idle'&&_0x1e336a['voicePause']){_0x1e336a['voiceStatus']=_0x7dc9('0x10');return![];}return _[_0x7dc9('0x8')]([_0x1e336a['chatStatus'],_0x1e336a[_0x7dc9('0x11')],_0x1e336a[_0x7dc9('0x12')],_0x1e336a[_0x7dc9('0x13')],_0x1e336a[_0x7dc9('0x14')],_0x1e336a[_0x7dc9('0x15')],_0x1e336a[_0x7dc9('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x7dc9('0x17'),{})[_0x7dc9('0x18')](function(_0x1b0aa1){if(_0x1b0aa1[_0x7dc9('0x19')]){throw new Error(_0x7dc9('0x1a'));}var _0xbe0437=_0x1b0aa1[_0x7dc9('0x1b')];return routingClient[_0x7dc9('0x1c')](_0x7dc9('0x17'),{})['then'](function(_0x22577e){if(_0x22577e['error']){throw new Error(_0x7dc9('0x1d'));}var _0x1cc237=_0x22577e['result'];return _[_0x7dc9('0x1e')]({},_0xbe0437,_0x1cc237);});})[_0x7dc9('0x1f')](function(_0x12f08d){throw _0x12f08d;});}exports[_0x7dc9('0x20')]=getRealtimeAgents;function getAgentStatus(_0x43ec33){var _0x184bfd=_0x7dc9('0xc');if(isAgentPaused(_0x43ec33))_0x184bfd=_0x7dc9('0x10');else if(isAgentPaused(_0x43ec33,!![]))_0x184bfd=_0x7dc9('0x21');else if(isAgentIdle(_0x43ec33))_0x184bfd=_0x7dc9('0xb');else _0x184bfd='busy';return _0x184bfd;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x12954f,_0x5981e2){var _0x596e0f=_[_0x7dc9('0x22')](_0x12954f)?_0x12954f:[_0x12954f];var _0x27f7fa=_['startCase'](_0x5981e2)+_0x7dc9('0x23');var _0x43d31f=_[_0x7dc9('0x24')](_0x596e0f,function(_0x4906b1){return db[_0x27f7fa][_0x7dc9('0x25')]({'where':{'id':_0x4906b1}})[_0x7dc9('0x18')](function(_0xf95336){if(!_0xf95336)return[];return _0xf95336['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x43d31f)['then'](function(_0x25b383){var _0x32d032=_(_0x25b383)['flatten']()['map']('id')[_0x7dc9('0x26')]()['value']();return _0x32d032;});}exports[_0x7dc9('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1c690b,_0x3a74a0,_0x3e4102){try{if(_0x3a74a0[_0x7dc9('0xa')]>0x0){_0x1c690b=_0x1c690b[_0x7dc9('0x9')](function(_0x236d42){return _0x3a74a0[_0x7dc9('0x28')](_0x236d42['id']);});}var _0x1fcf0e=_0x1c690b[_0x7dc9('0x9')](function(_0x14083d){var _0x2a456c='busy';if(isAgentIdle(_0x14083d)){_0x2a456c='idle';}return _0x2a456c===_0x3e4102;});return _['map'](_0x1fcf0e,'id');}catch(_0x49a4a5){throw _0x49a4a5;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x553a03,_0x58c4e8,_0x59f5d8){return Promise[_0x7dc9('0x29')]()[_0x7dc9('0x18')](function(){if(_0x58c4e8[_0x7dc9('0xa')]>0x0){_0x553a03=_0x553a03[_0x7dc9('0x9')](function(_0x3300ff){return _0x58c4e8[_0x7dc9('0x28')](_0x3300ff['id']);});}return _0x553a03;})['then'](function(){return db['User']['findAll']({'attributes':['id',_0x7dc9('0x2a'),'fullname',_0x7dc9('0x4'),_0x7dc9('0x5'),_0x7dc9('0x6'),_0x7dc9('0x2b'),_0x7dc9('0x7'),_0x7dc9('0x2c'),_0x7dc9('0x2d'),_0x7dc9('0x2e')],'where':{'id':{'$in':_['map'](_0x553a03,'id')}},'raw':!![]});})[_0x7dc9('0x18')](function(_0x4cdec4){return _0x4cdec4[_0x7dc9('0x24')](function(_0x16431a){var _0x3dc8e0=_[_0x7dc9('0x2f')](_0x553a03,['id',_0x16431a['id']]);var _0x48d9b2=filterAgentAttributes(_0x3dc8e0);_[_0x7dc9('0x1e')](_0x16431a,_0x48d9b2);_0x16431a['globalStatus']=getAgentStatus(_0x16431a);return _0x16431a;});})[_0x7dc9('0x18')](function(_0x4f47af){var _0x590bed=sortAgentsByStatus(_0x4f47af,_0x59f5d8);return _[_0x7dc9('0x24')](_0x590bed,'id');})[_0x7dc9('0x1f')](function(_0x21e036){throw _0x21e036;});}exports[_0x7dc9('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5dac5b){var _0x9376a5={'fields':[],'order':null};var _0x183d87=_0x5dac5b[_0x7dc9('0x31')](',');_0x9376a5[_0x7dc9('0x32')]=_[_0x7dc9('0x9')](_0x183d87,function(_0x21faa6){if(!_0x21faa6[_0x7dc9('0x28')](_0x7dc9('0x33'))){return!![];}_0x9376a5[_0x7dc9('0x34')]=_[_0x7dc9('0x35')](_0x21faa6,'-')?_0x7dc9('0x36'):_0x7dc9('0x37');return![];});return _0x9376a5;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x34b5c9){if(!_0x34b5c9){_0x34b5c9=_0x7dc9('0x38');}if(_0x34b5c9[_0x7dc9('0x28')](_0x7dc9('0x39'))&&!_0x34b5c9['includes'](_0x7dc9('0x3a'))){var _0x89db0e=_0x34b5c9[_0x7dc9('0x3b')](0x0,_0x34b5c9[_0x7dc9('0x3c')](_0x7dc9('0x39')));_0x34b5c9+=','+_0x89db0e+_0x7dc9('0x3a');}return _0x34b5c9;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x553230,_0x3ef9fd){var _0x36a965=_0x553230['sort'](function(_0x3a705c,_0x4a37ec){if(_0x3a705c[_0x7dc9('0x33')]===_0x4a37ec[_0x7dc9('0x33')]){if(_0x3a705c[_0x7dc9('0x33')]==='pause'){if(_0x3ef9fd===_0x7dc9('0x36')){return(_0x3a705c[_0x7dc9('0x2e')]||'')<(_0x4a37ec[_0x7dc9('0x2e')]||'')||_0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()>_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?0x1:-0x1;}else{return(_0x3a705c['pauseType']||'')<(_0x4a37ec[_0x7dc9('0x2e')]||'')||_0x3a705c['fullname']['toLowerCase']()>_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?-0x1:0x1;}}else{if(_0x3ef9fd===_0x7dc9('0x36')){return _0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()<_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?0x1:-0x1;}else{return _0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()<_0x4a37ec['fullname'][_0x7dc9('0x3d')]()?-0x1:0x1;}}}else{if(_0x3ef9fd===_0x7dc9('0x36')){return _0x3a705c[_0x7dc9('0x33')]<_0x4a37ec[_0x7dc9('0x33')]?0x1:-0x1;}else{return _0x3a705c[_0x7dc9('0x33')]<_0x4a37ec[_0x7dc9('0x33')]?-0x1:0x1;}}});return _0x36a965;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3774cb){var _0x42e110=['userpic',_0x7dc9('0x3e'),_0x7dc9('0x3f'),_0x7dc9('0x40'),'pauseType',_0x7dc9('0x40'),'internal','address',_0x7dc9('0x4'),_0x7dc9('0x2b'),_0x7dc9('0x6'),'smsPause','whatsappPause',_0x7dc9('0x5'),'voicePause',_0x7dc9('0x41'),_0x7dc9('0x42'),'mailCapacity',_0x7dc9('0x43'),_0x7dc9('0x44'),_0x7dc9('0x45'),_0x7dc9('0x46'),_0x7dc9('0x47'),_0x7dc9('0x48'),_0x7dc9('0x49'),_0x7dc9('0x4a'),_0x7dc9('0x4b'),_0x7dc9('0x4c'),_0x7dc9('0x13'),_0x7dc9('0x12'),_0x7dc9('0x14'),'whatsappStatus',_0x7dc9('0x11'),'voiceStatus','chatStatusTime',_0x7dc9('0x4d'),_0x7dc9('0x4e'),_0x7dc9('0x4f'),_0x7dc9('0x50'),_0x7dc9('0x51'),'voiceStatusTime',_0x7dc9('0x52'),_0x7dc9('0x53'),_0x7dc9('0x54'),'phoneBarEnableScreenRecordingByAgent',_0x7dc9('0x55'),_0x7dc9('0x56')];var _0x2cf133=[_0x7dc9('0x4'),_0x7dc9('0x2b'),_0x7dc9('0x6'),'smsPause',_0x7dc9('0x2d'),_0x7dc9('0x5'),_0x7dc9('0x2c'),_0x7dc9('0x3e')];var _0x877a67=_(_0x3774cb)[_0x7dc9('0x57')](_0x2cf133)[_0x7dc9('0x58')](_0x42e110)[_0x7dc9('0x59')]();return _0x877a67;}exports[_0x7dc9('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7dc9('0x2a'),_0x7dc9('0x39'),_0x7dc9('0x5b'),'internal',_0x7dc9('0x3e'),_0x7dc9('0x33'),_0x7dc9('0x5c'),_0x7dc9('0x3f'),_0x7dc9('0x2e'),'lastPauseAt',_0x7dc9('0x5'),_0x7dc9('0x4'),_0x7dc9('0x6'),_0x7dc9('0x2b'),_0x7dc9('0x7'),_0x7dc9('0x2c'),'whatsappPause','chatStatus','faxStatus',_0x7dc9('0x12'),_0x7dc9('0x13'),_0x7dc9('0x14'),_0x7dc9('0x15'),'whatsappStatus','chatStatusTime',_0x7dc9('0x51'),_0x7dc9('0x4e'),_0x7dc9('0x4d'),_0x7dc9('0x4f'),_0x7dc9('0x5d'),_0x7dc9('0x50'),_0x7dc9('0x41'),'faxCapacity',_0x7dc9('0x5e'),_0x7dc9('0x42'),_0x7dc9('0x43'),_0x7dc9('0x44'),_0x7dc9('0x46'),'faxCurrentCapacity',_0x7dc9('0x48'),_0x7dc9('0x47'),_0x7dc9('0x49'),_0x7dc9('0x4a'),_0x7dc9('0x5f'),_0x7dc9('0x55'),_0x7dc9('0x53'),_0x7dc9('0x60'),_0x7dc9('0x52'),_0x7dc9('0x56'),_0x7dc9('0x54')];}exports[_0x7dc9('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 7878c1b..2169196 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f4b=['dialActive','dialMethod','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','result','getRealtimeQueues','inbound','concat','map','get','outbound','find','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','waiting','busy','inUse','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','originated','message','statusMessage'];(function(_0x520407,_0x24a4ce){var _0x45f7a1=function(_0x57ea00){while(--_0x57ea00){_0x520407['push'](_0x520407['shift']());}};_0x45f7a1(++_0x24a4ce);}(_0x7f4b,0x1ea));var _0xb7f4=function(_0x2a83b9,_0x3c2d30){_0x2a83b9=_0x2a83b9-0x0;var _0x11cd74=_0x7f4b[_0x2a83b9];return _0x11cd74;};'use strict';var _=require('lodash');var jayson=require(_0xb7f4('0x0'));var util=require(_0xb7f4('0x1'));var amiClient=jayson[_0xb7f4('0x2')][_0xb7f4('0x3')]({'port':0x232a});var routingClient=jayson[_0xb7f4('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xb7f4('0x4'),_0xb7f4('0x5'),'paused',_0xb7f4('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xb7f4('0x7'),_0xb7f4('0x8'),'invalid',_0xb7f4('0x9'),_0xb7f4('0xa'),_0xb7f4('0xb'),_0xb7f4('0xc'),_0xb7f4('0xd'),_0xb7f4('0xe'),_0xb7f4('0xf'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xb7f4('0x10'),_0xb7f4('0x11'),_0xb7f4('0x12'),_0xb7f4('0x13'),_0xb7f4('0x14'),_0xb7f4('0x15'),_0xb7f4('0x16'),'startPredictive',_0xb7f4('0x17'),'erlangCalls',_0xb7f4('0x18'),_0xb7f4('0x19'),_0xb7f4('0x1a'),_0xb7f4('0x1b'),_0xb7f4('0x1c'),'dialPredictiveIntervalMinThreshold',_0xb7f4('0x1d'),'predictiveIntervalTotalCalls',_0xb7f4('0x1e'),'predictiveIntervalDroppedCallsTimeout',_0xb7f4('0x1f'),_0xb7f4('0x20'),_0xb7f4('0x21')];function getRealtimeQueues(_0x1ee8e6,_0x40b3f1){var _0x2bc1f8=_0x40b3f1===_0xb7f4('0x22')?amiClient:routingClient;return _0x2bc1f8[_0xb7f4('0x23')](_[_0xb7f4('0x24')](_0x40b3f1)+_0xb7f4('0x25'),_0x1ee8e6)[_0xb7f4('0x26')](function(_0x571c79){if(_0x571c79[_0xb7f4('0x27')])throw new Error(util[_0xb7f4('0x28')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x40b3f1));return _0x571c79[_0xb7f4('0x29')];})['catch'](function(_0x19d91b){throw _0x19d91b;});}exports[_0xb7f4('0x2a')]=getRealtimeQueues;function initializeQueues(_0x47caf2,_0xdcc290,_0xa3c905,_0x50144e){var _0x5f49c3=DEFAULT_QUEUE_ATTRIBUTES;if(_0xa3c905===_0xb7f4('0x22')){if(_0x50144e===_0xb7f4('0x2b')){_0x5f49c3=_0x5f49c3[_0xb7f4('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x50144e==='outbound'){_0x5f49c3=_0x5f49c3['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x47caf2[_0xb7f4('0x2d')](function(_0x1ce54c){var _0x4c86b5=_0x1ce54c[_0xb7f4('0x2e')]({'plain':!![]});_0x4c86b5['paused']=0x0;_0x4c86b5['loggedInDb']=0x0;_0x4c86b5[_0xb7f4('0x5')]=0x0;_0x4c86b5[_0xb7f4('0x4')]=0x0;_0x4c86b5[_0xb7f4('0x6')]=0x0;if(_0xa3c905==='voice'){_0x4c86b5[_0xb7f4('0xe')]=0x0;_0x4c86b5[_0xb7f4('0x7')]=0x0;if(_0x50144e===_0xb7f4('0x2f')){_0x4c86b5[_0xb7f4('0x10')]=0x0;_0x4c86b5[_0xb7f4('0x11')]=0x0;}}var _0x1b13a3=_[_0xb7f4('0x30')](_0xdcc290,['id',_0x4c86b5['id']]);if(_0x1b13a3){_['merge'](_0x4c86b5,_[_0xb7f4('0x31')](_0x1b13a3,_0x5f49c3));}return _0x4c86b5;});}exports[_0xb7f4('0x32')]=initializeQueues; \ No newline at end of file +var _0xc5f8=['available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','merge','pick','initializeQueues','lodash','util','client'];(function(_0x2d876c,_0x29c04c){var _0x5d07f7=function(_0x5d327a){while(--_0x5d327a){_0x2d876c['push'](_0x2d876c['shift']());}};_0x5d07f7(++_0x29c04c);}(_0xc5f8,0xf2));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c5f('0x0'));var jayson=require('jayson/promise');var util=require(_0x8c5f('0x1'));var amiClient=jayson[_0x8c5f('0x2')]['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8c5f('0x3'),'loggedIn',_0x8c5f('0x4'),_0x8c5f('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x8c5f('0x6'),_0x8c5f('0x7'),_0x8c5f('0x8'),_0x8c5f('0x9'),_0x8c5f('0xa'),_0x8c5f('0xb'),_0x8c5f('0xc'),_0x8c5f('0xd'),_0x8c5f('0xe'),_0x8c5f('0xf'),_0x8c5f('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8c5f('0x11'),_0x8c5f('0x12'),_0x8c5f('0x13'),_0x8c5f('0x14'),_0x8c5f('0x15'),'dialMethod','Trunk','startPredictive',_0x8c5f('0x16'),_0x8c5f('0x17'),'erlangCallToSecond',_0x8c5f('0x18'),_0x8c5f('0x19'),_0x8c5f('0x1a'),'dialPredictiveIntervalMaxThreshold',_0x8c5f('0x1b'),_0x8c5f('0x1c'),_0x8c5f('0x1d'),_0x8c5f('0x1e'),_0x8c5f('0x1f'),_0x8c5f('0x20'),_0x8c5f('0x21'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x59b710,_0x2f3e75){var _0xfc4780=_0x2f3e75===_0x8c5f('0x22')?amiClient:routingClient;return _0xfc4780[_0x8c5f('0x23')](_['startCase'](_0x2f3e75)+_0x8c5f('0x24'),_0x59b710)['then'](function(_0x543c84){if(_0x543c84[_0x8c5f('0x25')])throw new Error(util[_0x8c5f('0x26')](_0x8c5f('0x27'),_0x2f3e75));return _0x543c84[_0x8c5f('0x28')];})[_0x8c5f('0x29')](function(_0x5e3cb0){throw _0x5e3cb0;});}exports[_0x8c5f('0x2a')]=getRealtimeQueues;function initializeQueues(_0x22481c,_0x43a470,_0xd5e78b,_0x54cac4){var _0x3704cf=DEFAULT_QUEUE_ATTRIBUTES;if(_0xd5e78b==='voice'){if(_0x54cac4==='inbound'){_0x3704cf=_0x3704cf[_0x8c5f('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x54cac4===_0x8c5f('0x2c')){_0x3704cf=_0x3704cf[_0x8c5f('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x22481c[_0x8c5f('0x2d')](function(_0x227a16){var _0x1c3a10=_0x227a16['get']({'plain':!![]});_0x1c3a10[_0x8c5f('0x4')]=0x0;_0x1c3a10['loggedInDb']=0x0;_0x1c3a10['loggedIn']=0x0;_0x1c3a10[_0x8c5f('0x3')]=0x0;_0x1c3a10[_0x8c5f('0x5')]=0x0;if(_0xd5e78b==='voice'){_0x1c3a10[_0x8c5f('0xe')]=0x0;_0x1c3a10[_0x8c5f('0x6')]=0x0;if(_0x54cac4===_0x8c5f('0x2c')){_0x1c3a10[_0x8c5f('0x11')]=0x0;_0x1c3a10[_0x8c5f('0x12')]=0x0;}}var _0x19f596=_['find'](_0x43a470,['id',_0x1c3a10['id']]);if(_0x19f596){_[_0x8c5f('0x2e')](_0x1c3a10,_[_0x8c5f('0x2f')](_0x19f596,_0x3704cf));}return _0x1c3a10;});}exports[_0x8c5f('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6618af6..3db8c5d 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x5b083b,_0x145a9b){var _0x6c2225=function(_0xcc6435){while(--_0xcc6435){_0x5b083b['push'](_0x5b083b['shift']());}};_0x6c2225(++_0x145a9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x28107d,_0x2ec8b3){var _0x2b1cbe=function(_0x5b06ad){while(--_0x5b06ad){_0x28107d['push'](_0x28107d['shift']());}};_0x2b1cbe(++_0x2ec8b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 0e3c8ea..554af19 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 _0x0bb7=['concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','join','createHash','md5','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4'];(function(_0x33c603,_0x6d0ce4){var _0xae96f4=function(_0x2679f8){while(--_0x2679f8){_0x33c603['push'](_0x33c603['shift']());}};_0xae96f4(++_0x6d0ce4);}(_0x0bb7,0xf7));var _0x70bb=function(_0x1b59de,_0x1fdde2){_0x1b59de=_0x1b59de-0x0;var _0x1e9f50=_0x0bb7[_0x1b59de];return _0x1e9f50;};'use strict';var _=require(_0x70bb('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x70bb('0x1'));var exec=require(_0x70bb('0x2'))[_0x70bb('0x3')];var config=require(_0x70bb('0x4'));function getInterfaces(){var _0x4014dd=[];var _0x542708=os[_0x70bb('0x5')]();var _0x2ac729=_[_0x70bb('0x6')](_[_0x70bb('0x7')](_0x542708));for(var _0x90ccaf=0x0;_0x90ccaf<_0x2ac729[_0x70bb('0x8')];_0x90ccaf++){var _0x38da3b=_0x542708[_0x2ac729[_0x90ccaf]][_0x70bb('0x9')](function(_0x3e4dd2){return _0x3e4dd2[_0x70bb('0xa')]===_0x70bb('0xb')&&_0x3e4dd2['internal']===![];});_0x4014dd=_0x4014dd[_0x70bb('0xc')](_0x38da3b);}return _0x4014dd;}function getFirstInterface(){var _0x119d68=_[_0x70bb('0xd')](getInterfaces());return{'macAddress':_0x119d68&&_0x119d68[_0x70bb('0xe')]?_0x119d68['mac']:_0x70bb('0xf'),'ipAddress':_0x119d68&&_0x119d68[_0x70bb('0x10')]?_0x119d68[_0x70bb('0x10')]:_0x70bb('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x90fce=_[_0x70bb('0x6')](os[_0x70bb('0x12')]()[_0x70bb('0x13')](function(_0x516968){return _0x516968['model'];}))[_0x70bb('0x14')](':');return crypto[_0x70bb('0x15')](_0x70bb('0x16'))['update'](_0x90fce)['digest'](_0x70bb('0x17'));}exports[_0x70bb('0x18')]=function(){var _0x3aa4eb=os[_0x70bb('0x19')]();var _0x5cc8c1=/[0-9a-f-]{36}/;if(config[_0x70bb('0x1a')]&&_0x5cc8c1[_0x70bb('0x1b')](config[_0x70bb('0x1a')])){return config[_0x70bb('0x1a')];}else if(_0x3aa4eb===_0x70bb('0x1c')){return exec(_0x70bb('0x1d'),{'encoding':_0x70bb('0x1e')})[_0x70bb('0x1f')]('\x0d\x0a','');}else{var _0x4568db=getFirstInterface();var _0x542a9f=getCPUhash();var _0x54b37d=_0x542a9f+'|'+os[_0x70bb('0x20')]()+'|'+_0x4568db[_0x70bb('0x21')]+'|'+_0x4568db[_0x70bb('0x22')];var _0x41a17a=crypto[_0x70bb('0x15')]('md5')[_0x70bb('0x23')](_0x54b37d)['digest'](_0x70bb('0x17'));return _0x41a17a[_0x70bb('0x24')](0x0,0x8)+'-'+_0x41a17a[_0x70bb('0x24')](0x8,0xc)+'-'+_0x41a17a[_0x70bb('0x24')](0xc,0x10)+'-'+_0x41a17a[_0x70bb('0x24')](0x10,0x14)+'-'+_0x41a17a[_0x70bb('0x24')](0x14);}}; \ No newline at end of file +var _0x455b=['map','model','join','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','ipAddress','createHash','md5','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus'];(function(_0x154efd,_0x27c90d){var _0x331e99=function(_0x3458ad){while(--_0x3458ad){_0x154efd['push'](_0x154efd['shift']());}};_0x331e99(++_0x27c90d);}(_0x455b,0x1e6));var _0xb455=function(_0x5471ca,_0xa83bde){_0x5471ca=_0x5471ca-0x0;var _0x4f80d7=_0x455b[_0x5471ca];return _0x4f80d7;};'use strict';var _=require(_0xb455('0x0'));var os=require('os');var crypto=require(_0xb455('0x1'));var machine=require(_0xb455('0x2'));var exec=require(_0xb455('0x3'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x1144e4=[];var _0x334728=os['networkInterfaces']();var _0x14d3db=_[_0xb455('0x4')](_[_0xb455('0x5')](_0x334728));for(var _0x5f0a42=0x0;_0x5f0a42<_0x14d3db[_0xb455('0x6')];_0x5f0a42++){var _0x287b70=_0x334728[_0x14d3db[_0x5f0a42]][_0xb455('0x7')](function(_0xbbbb2){return _0xbbbb2[_0xb455('0x8')]==='IPv4'&&_0xbbbb2[_0xb455('0x9')]===![];});_0x1144e4=_0x1144e4[_0xb455('0xa')](_0x287b70);}return _0x1144e4;}function getFirstInterface(){var _0x262309=_[_0xb455('0xb')](getInterfaces());return{'macAddress':_0x262309&&_0x262309[_0xb455('0xc')]?_0x262309[_0xb455('0xc')]:_0xb455('0xd'),'ipAddress':_0x262309&&_0x262309[_0xb455('0xe')]?_0x262309['address']:_0xb455('0xf')};}exports[_0xb455('0x10')]=getFirstInterface;function getCPUhash(){var _0x55a71b=_[_0xb455('0x4')](os[_0xb455('0x11')]()[_0xb455('0x12')](function(_0x35ecd8){return _0x35ecd8[_0xb455('0x13')];}))[_0xb455('0x14')](':');return crypto['createHash']('md5')[_0xb455('0x15')](_0x55a71b)[_0xb455('0x16')]('hex');}exports[_0xb455('0x17')]=function(){var _0x32c965=os[_0xb455('0x18')]();var _0x2693af=/[0-9a-f-]{36}/;if(config[_0xb455('0x19')]&&_0x2693af[_0xb455('0x1a')](config[_0xb455('0x19')])){return config[_0xb455('0x19')];}else if(_0x32c965===_0xb455('0x1b')){return exec(_0xb455('0x1c'),{'encoding':_0xb455('0x1d')})['replace']('\x0d\x0a','');}else{var _0x2e4d20=getFirstInterface();var _0x5c7a8b=getCPUhash();var _0x9e40d5=_0x5c7a8b+'|'+os[_0xb455('0x1e')]()+'|'+_0x2e4d20['macAddress']+'|'+_0x2e4d20[_0xb455('0x1f')];var _0x3e60ad=crypto[_0xb455('0x20')](_0xb455('0x21'))[_0xb455('0x15')](_0x9e40d5)['digest'](_0xb455('0x22'));return _0x3e60ad[_0xb455('0x23')](0x0,0x8)+'-'+_0x3e60ad[_0xb455('0x23')](0x8,0xc)+'-'+_0x3e60ad[_0xb455('0x23')](0xc,0x10)+'-'+_0x3e60ad[_0xb455('0x23')](0x10,0x14)+'-'+_0x3e60ad['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 6f6fab7..30af5ed 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 _0xc0b2=['toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','catch','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','get','data1','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','info','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x37c888,_0x547332){var _0x15857c=function(_0x36674c){while(--_0x36674c){_0x37c888['push'](_0x37c888['shift']());}};_0x15857c(++_0x547332);}(_0xc0b2,0xfe));var _0x2c0b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc0b2[_0x484e36];return _0xafc85d;};'use strict';var util=require(_0x2c0b('0x0'));var moment=require(_0x2c0b('0x1'));var rp=require(_0x2c0b('0x2'));var BPromise=require(_0x2c0b('0x3'));var pkginfo=require(_0x2c0b('0x4'))(module,_0x2c0b('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x2c0b('0x6'));var hardware=require('./hardware');var logger=require(_0x2c0b('0x7'))('license');var HOST=_0x2c0b('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2617af){return new BPromise(function(_0x3371bc,_0x5362b3){var _0x31621f=util[_0x2c0b('0x9')](_0x2c0b('0xa'),HOST,_0x2617af,module[_0x2c0b('0xb')][_0x2c0b('0x5')]);if(oldToken){_0x31621f=util[_0x2c0b('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2617af,module[_0x2c0b('0xb')][_0x2c0b('0x5')],oldToken);}var _0x495266={'uri':_0x31621f,'method':_0x2c0b('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x495266)[_0x2c0b('0xd')](function(_0x45c03a){_0x3371bc(_0x45c03a);})['catch'](function(_0x3af1fa){_0x5362b3(_0x3af1fa);});});}function manageLicense(_0x466465,_0x2a55b1){var _0x234a7d=_0x2a55b1[_0x2c0b('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x234a7d[_0x2c0b('0xf')]!==_0x466465&&!_0x234a7d[_0x2c0b('0x10')]){oldToken=_0x234a7d[_0x2c0b('0xf')];}httpRequest(_0x466465)[_0x2c0b('0xd')](function(_0x1c11bb){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1c11bb[_0x2c0b('0x11')]){isOldTokenSent=![];if(!_0x234a7d[_0x2c0b('0x12')]&&_0x234a7d[_0x2c0b('0x12')]!=_0x1c11bb[_0x2c0b('0x12')]||_0x234a7d[_0x2c0b('0x12')]&&_0x234a7d[_0x2c0b('0x10')]){logger['info'](_0x2c0b('0x13'));}if(_0x234a7d[_0x2c0b('0x12')]&&!_0x234a7d[_0x2c0b('0x10')]&&_0x234a7d[_0x2c0b('0x12')]!=_0x1c11bb[_0x2c0b('0x12')]){logger['info'](_0x2c0b('0x14'));}if(_0x234a7d[_0x2c0b('0x12')]&&!_0x234a7d[_0x2c0b('0x10')]&&_0x234a7d[_0x2c0b('0x12')]==_0x1c11bb[_0x2c0b('0x12')]){return _0x2a55b1;}return _0x2a55b1['update']({'data1':_0x466465,'data2':null,'license':_0x1c11bb['license']});}else{if(_0x1c11bb[_0x2c0b('0x12')]||_0x234a7d[_0x2c0b('0x12')]){if(!_0x234a7d[_0x2c0b('0x10')]){if(_0x234a7d[_0x2c0b('0xf')]==_0x466465){GRAY_PERIOD_REASON=_0x2c0b('0x15');logger['info'](_0x2c0b('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x2c0b('0x17')](_0x2c0b('0x18'),_0x234a7d[_0x2c0b('0xf')],_0x466465);}logger[_0x2c0b('0x17')](_0x2c0b('0x19'),GRAY_PERIOD_REASON[_0x2c0b('0x1a')](),moment()[_0x2c0b('0x9')](_0x2c0b('0x1b')));return _0x2a55b1[_0x2c0b('0x1c')]({'data2':encryptor[_0x2c0b('0x1d')](moment()[_0x2c0b('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x2c0b('0x1e')](_0x234a7d['data2']),'days')>DAYS){logger[_0x2c0b('0x17')](_0x2c0b('0x1f'),moment()[_0x2c0b('0x9')](_0x2c0b('0x1b')));isOldTokenSent=![];return _0x2a55b1[_0x2c0b('0x1c')]({'data1':_0x466465,'data2':null,'license':null});}}}else{if(_0x234a7d[_0x2c0b('0xf')]!=_0x466465){logger[_0x2c0b('0x17')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x234a7d[_0x2c0b('0xf')],_0x466465);return _0x2a55b1[_0x2c0b('0x1c')]({'data1':_0x466465,'data2':null,'license':null});}}}return _0x2a55b1;})[_0x2c0b('0xd')](function(_0x3bbe7c){_0x2a55b1=_0x3bbe7c;})['catch'](function(_0x8f8c73){logger[_0x2c0b('0x20')](_0x8f8c73[_0x2c0b('0x21')]);})[_0x2c0b('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x2c0b('0x23')](),_0x2a55b1);},TIME);});}function defaultLicense(){var _0x4afad2=hardware[_0x2c0b('0x23')]();if(_0x4afad2){return db[_0x2c0b('0x24')][_0x2c0b('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x4afad2}})[_0x2c0b('0x26')](function(_0x22fba8,_0x2ce907){logger[_0x2c0b('0x17')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4afad2);manageLicense(_0x4afad2,_0x22fba8);})[_0x2c0b('0x27')](function(_0x12b5e){logger[_0x2c0b('0x20')](_0x12b5e[_0x2c0b('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xf213=['data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','get'];(function(_0x3fdb14,_0x1a4585){var _0x4fb736=function(_0x5d195b){while(--_0x5d195b){_0x3fdb14['push'](_0x3fdb14['shift']());}};_0x4fb736(++_0x1a4585);}(_0xf213,0x156));var _0x3f21=function(_0x156b2d,_0x396cba){_0x156b2d=_0x156b2d-0x0;var _0x584a81=_0xf213[_0x156b2d];return _0x584a81;};'use strict';var util=require(_0x3f21('0x0'));var moment=require(_0x3f21('0x1'));var rp=require(_0x3f21('0x2'));var BPromise=require(_0x3f21('0x3'));var pkginfo=require(_0x3f21('0x4'))(module,'version');var db=require(_0x3f21('0x5'))['db'];var encryptor=require(_0x3f21('0x6'));var hardware=require(_0x3f21('0x7'));var logger=require(_0x3f21('0x8'))(_0x3f21('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x6a45d7){return new BPromise(function(_0xeaea20,_0x5a2452){var _0x5cc93b=util[_0x3f21('0xa')](_0x3f21('0xb'),HOST,_0x6a45d7,module['exports']['version']);if(oldToken){_0x5cc93b=util[_0x3f21('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x6a45d7,module[_0x3f21('0xc')][_0x3f21('0xd')],oldToken);}var _0x288c9c={'uri':_0x5cc93b,'method':_0x3f21('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x288c9c)[_0x3f21('0xf')](function(_0x312b40){_0xeaea20(_0x312b40);})[_0x3f21('0x10')](function(_0x25724e){_0x5a2452(_0x25724e);});});}function manageLicense(_0xc1d43e,_0x424cd4){var _0x47d0e1=_0x424cd4[_0x3f21('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x47d0e1['data1']!==_0xc1d43e&&!_0x47d0e1[_0x3f21('0x12')]){oldToken=_0x47d0e1['data1'];}httpRequest(_0xc1d43e)['then'](function(_0x560677){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x560677['active']){isOldTokenSent=![];if(!_0x47d0e1['license']&&_0x47d0e1[_0x3f21('0x9')]!=_0x560677[_0x3f21('0x9')]||_0x47d0e1[_0x3f21('0x9')]&&_0x47d0e1[_0x3f21('0x12')]){logger[_0x3f21('0x13')](_0x3f21('0x14'));}if(_0x47d0e1[_0x3f21('0x9')]&&!_0x47d0e1[_0x3f21('0x12')]&&_0x47d0e1[_0x3f21('0x9')]!=_0x560677['license']){logger['info'](_0x3f21('0x15'));}if(_0x47d0e1['license']&&!_0x47d0e1['data2']&&_0x47d0e1['license']==_0x560677['license']){return _0x424cd4;}return _0x424cd4[_0x3f21('0x16')]({'data1':_0xc1d43e,'data2':null,'license':_0x560677[_0x3f21('0x9')]});}else{if(_0x560677[_0x3f21('0x9')]||_0x47d0e1[_0x3f21('0x9')]){if(!_0x47d0e1[_0x3f21('0x12')]){if(_0x47d0e1[_0x3f21('0x17')]==_0xc1d43e){GRAY_PERIOD_REASON=_0x3f21('0x18');logger[_0x3f21('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x3f21('0x13')](_0x3f21('0x19'),_0x47d0e1[_0x3f21('0x17')],_0xc1d43e);}logger[_0x3f21('0x13')](_0x3f21('0x1a'),GRAY_PERIOD_REASON[_0x3f21('0x1b')](),moment()[_0x3f21('0xa')](_0x3f21('0x1c')));return _0x424cd4['update']({'data2':encryptor[_0x3f21('0x1d')](moment()[_0x3f21('0xa')](_0x3f21('0x1c')))});}else{if(moment()['diff'](encryptor[_0x3f21('0x1e')](_0x47d0e1[_0x3f21('0x12')]),_0x3f21('0x1f'))>DAYS){logger[_0x3f21('0x13')](_0x3f21('0x20'),moment()[_0x3f21('0xa')](_0x3f21('0x1c')));isOldTokenSent=![];return _0x424cd4[_0x3f21('0x16')]({'data1':_0xc1d43e,'data2':null,'license':null});}}}else{if(_0x47d0e1[_0x3f21('0x17')]!=_0xc1d43e){logger['info'](_0x3f21('0x19'),_0x47d0e1[_0x3f21('0x17')],_0xc1d43e);return _0x424cd4[_0x3f21('0x16')]({'data1':_0xc1d43e,'data2':null,'license':null});}}}return _0x424cd4;})['then'](function(_0x1f237e){_0x424cd4=_0x1f237e;})[_0x3f21('0x10')](function(_0x2ecc43){logger[_0x3f21('0x21')](_0x2ecc43['message']);})[_0x3f21('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x3f21('0x23')](),_0x424cd4);},TIME);});}function defaultLicense(){var _0xd62c3b=hardware[_0x3f21('0x23')]();if(_0xd62c3b){return db[_0x3f21('0x24')][_0x3f21('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0xd62c3b}})['spread'](function(_0x3a483e,_0x45a8d2){logger['info'](_0x3f21('0x26'),_0xd62c3b);manageLicense(_0xd62c3b,_0x3a483e);})[_0x3f21('0x10')](function(_0x13ce68){logger[_0x3f21('0x21')](_0x13ce68[_0x3f21('0x27')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c68e259..db27422 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 _0x1d3d=['uuid','machineUuid','gray','deadline','add','days','format','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','telephones','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','catch','exports','util','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','%s:%s:%s','parse','demo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d3d,0x135));var _0xd1d3=function(_0x4f160f,_0x88cea5){_0x4f160f=_0x4f160f-0x0;var _0x2832f3=_0x1d3d[_0x4f160f];return _0x2832f3;};'use strict';var util=require(_0xd1d3('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0xd1d3('0x1'));var encryptor=require(_0xd1d3('0x2'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd1d3('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd1d3('0x4'),'machineUuid':hardware[_0xd1d3('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd1d3('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd1d3('0x6'),'machineUuid':hardware[_0xd1d3('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x39281a){return new BPromise(function(_0x5731ca,_0x3d5432){return db[_0xd1d3('0x7')][_0xd1d3('0x8')](_['defaults'](_0x39281a,{'raw':!![],'where':{'id':0x1}}))[_0xd1d3('0x9')](function(_0x15a159){return checkLicense(_0x15a159,null);})[_0xd1d3('0x9')](function(_0x2999d4){_0x5731ca(_0x2999d4);return;})['catch'](function(_0x48aa13){_0x3d5432(_0x48aa13);});});}function checkLicense(_0x49d4c0,_0x12275b){if(!_0x49d4c0){demoLicense['uuid']=_0x49d4c0['data1'];return demoLicense;}try{var _0x2785e1=_0x12275b||_0x49d4c0[_0xd1d3('0xa')];if(_[_0xd1d3('0xb')](_0x2785e1)){throw new Error(_0xd1d3('0xc'));}var _0x311073=_0x49d4c0[_0xd1d3('0xd')];var _0x31eee0=_0x49d4c0[_0xd1d3('0xe')];var _0x6b46dd=_0x311073[_0xd1d3('0xf')]('-')[0x4];var _0x393c65=_0x311073[_0xd1d3('0xf')]('-')[0x0];var _0x145446=encryptor[_0xd1d3('0x10')](_0x2785e1,util['format'](_0xd1d3('0x11'),_0x6b46dd,_0x311073,_0x393c65));var _0x8bc94a=JSON[_0xd1d3('0x12')](_0x145446);_0x8bc94a[_0xd1d3('0x13')]=![];_0x8bc94a[_0xd1d3('0x14')]=_0x311073;_0x8bc94a[_0xd1d3('0x15')]=hardware[_0xd1d3('0x5')]();if(_0x31eee0){var _0x355d94=encryptor[_0xd1d3('0x10')](_0x31eee0);_0x8bc94a[_0xd1d3('0x16')]=_0x355d94;_0x8bc94a[_0xd1d3('0x17')]=moment(_0x355d94)[_0xd1d3('0x18')](0x7,_0xd1d3('0x19'))[_0xd1d3('0x1a')]();_0x8bc94a[_0xd1d3('0x1b')]=_0x8bc94a[_0xd1d3('0x14')]!=_0x8bc94a[_0xd1d3('0x15')]?'changed':_0xd1d3('0x1c');}return _0x8bc94a;}catch(_0x40ab73){breakingLicense[_0xd1d3('0x14')]=_0x49d4c0[_0xd1d3('0xd')];breakingLicense[_0xd1d3('0x1d')]=_0x40ab73['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4058e0,_0x1157c2){getLicense()['then'](function(_0x2c2027){return db[_0xd1d3('0x1e')][_0xd1d3('0x1f')]({'attributes':[_0xd1d3('0x20'),[db[_0xd1d3('0x21')]['fn'](_0xd1d3('0x22'),db[_0xd1d3('0x21')][_0xd1d3('0x23')](_0xd1d3('0x20'))),'count']],'group':_0xd1d3('0x20'),'where':{'role':{'$or':[_0xd1d3('0x24'),_0xd1d3('0x25'),_0xd1d3('0x26')]}},'raw':!![]})['then'](function(_0x584c03){var _0x1fb58a={'user':_0x2c2027[_0xd1d3('0x27')]||0x0,'telephone':_0x2c2027[_0xd1d3('0x28')]||0x0};_0x584c03[_0xd1d3('0x29')](function(_0x58bd4b){var _0x2f6a54=_0x58bd4b[_0xd1d3('0x20')]===_0xd1d3('0x24')?_0xd1d3('0x25'):_0x58bd4b['role'];_0x1fb58a[_0x2f6a54]-=_0x58bd4b['count'];if(_0x1fb58a[_0x2f6a54]<0x0)_0x1fb58a[_0x2f6a54]=0x0;});_0x4058e0(_0x1fb58a);return;});})['catch'](function(_0x176831){_0x1157c2(_0x176831);});});}function checkUserLimits(_0x5dc3a1){return new BPromise(function(_0x1d4423,_0x146cd6){getLimits()[_0xd1d3('0x9')](function(_0x2b8235){var _0x53078c=_[_0xd1d3('0x2a')](_['countBy'](_0x5dc3a1,_0xd1d3('0x20')),[_0xd1d3('0x24'),_0xd1d3('0x25'),_0xd1d3('0x26')]);var _0x23744c=(_0x53078c['admin']||0x0)+(_0x53078c[_0xd1d3('0x25')]||0x0);var _0xfcca62=_0x53078c[_0xd1d3('0x26')]||0x0;if(_0x23744c>_0x2b8235['user'])return _0x146cd6(_0xd1d3('0x2b'));if(_0xfcca62>_0x2b8235['telephone'])return _0x146cd6(_0xd1d3('0x2c'));return _0x1d4423();})[_0xd1d3('0x2d')](function(_0x1d37b8){_0x146cd6(_0x1d37b8);});});}module[_0xd1d3('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5a91=['%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','uuid','changed','message','User','role','sequelize','COUNT','count','admin','user','users','forEach','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format'];(function(_0x11d25d,_0x1c92f4){var _0x5a7003=function(_0x4f50ca){while(--_0x4f50ca){_0x11d25d['push'](_0x11d25d['shift']());}};_0x5a7003(++_0x1c92f4);}(_0x5a91,0x154));var _0x15a9=function(_0x5a0ed5,_0x83f521){_0x5a0ed5=_0x5a0ed5-0x0;var _0x18601d=_0x5a91[_0x5a0ed5];return _0x18601d;};'use strict';var util=require(_0x15a9('0x0'));var _=require(_0x15a9('0x1'));var moment=require(_0x15a9('0x2'));var BPromise=require('bluebird');var hardware=require(_0x15a9('0x3'));var encryptor=require(_0x15a9('0x4'));var db=require(_0x15a9('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x15a9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x15a9('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x15a9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x15a9('0x8'),'machineUuid':hardware[_0x15a9('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4723b0){return new BPromise(function(_0x479910,_0x103415){return db['License'][_0x15a9('0x9')](_['defaults'](_0x4723b0,{'raw':!![],'where':{'id':0x1}}))[_0x15a9('0xa')](function(_0x1ccb00){return checkLicense(_0x1ccb00,null);})[_0x15a9('0xa')](function(_0x5d0af4){_0x479910(_0x5d0af4);return;})[_0x15a9('0xb')](function(_0x5ebdcf){_0x103415(_0x5ebdcf);});});}function checkLicense(_0x2329db,_0x2ca09e){if(!_0x2329db){demoLicense['uuid']=_0x2329db[_0x15a9('0xc')];return demoLicense;}try{var _0x413aa8=_0x2ca09e||_0x2329db[_0x15a9('0xd')];if(_[_0x15a9('0xe')](_0x413aa8)){throw new Error(_0x15a9('0xf'));}var _0x10faee=_0x2329db[_0x15a9('0xc')];var _0x22be45=_0x2329db[_0x15a9('0x10')];var _0x4cbd3a=_0x10faee[_0x15a9('0x11')]('-')[0x4];var _0x3f9d4a=_0x10faee[_0x15a9('0x11')]('-')[0x0];var _0x116a0a=encryptor[_0x15a9('0x12')](_0x413aa8,util[_0x15a9('0x13')](_0x15a9('0x14'),_0x4cbd3a,_0x10faee,_0x3f9d4a));var _0x267e2e=JSON[_0x15a9('0x15')](_0x116a0a);_0x267e2e[_0x15a9('0x16')]=![];_0x267e2e['uuid']=_0x10faee;_0x267e2e[_0x15a9('0x17')]=hardware[_0x15a9('0x7')]();if(_0x22be45){var _0x550583=encryptor[_0x15a9('0x12')](_0x22be45);_0x267e2e['gray']=_0x550583;_0x267e2e[_0x15a9('0x18')]=moment(_0x550583)[_0x15a9('0x19')](0x7,_0x15a9('0x1a'))['format']();_0x267e2e[_0x15a9('0x1b')]=_0x267e2e[_0x15a9('0x1c')]!=_0x267e2e[_0x15a9('0x17')]?_0x15a9('0x1d'):'disabled';}return _0x267e2e;}catch(_0x1080c3){breakingLicense[_0x15a9('0x1c')]=_0x2329db[_0x15a9('0xc')];breakingLicense[_0x15a9('0x1e')]=_0x1080c3[_0x15a9('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x25adb6,_0x20186b){getLicense()['then'](function(_0x357dc4){return db[_0x15a9('0x1f')]['findAll']({'attributes':[_0x15a9('0x20'),[db[_0x15a9('0x21')]['fn'](_0x15a9('0x22'),db['sequelize']['col'](_0x15a9('0x20'))),_0x15a9('0x23')]],'group':_0x15a9('0x20'),'where':{'role':{'$or':[_0x15a9('0x24'),_0x15a9('0x25'),'telephone']}},'raw':!![]})[_0x15a9('0xa')](function(_0x5e857f){var _0x62b42e={'user':_0x357dc4[_0x15a9('0x26')]||0x0,'telephone':_0x357dc4['telephones']||0x0};_0x5e857f[_0x15a9('0x27')](function(_0x2f476c){var _0x3931ef=_0x2f476c[_0x15a9('0x20')]===_0x15a9('0x24')?_0x15a9('0x25'):_0x2f476c[_0x15a9('0x20')];_0x62b42e[_0x3931ef]-=_0x2f476c[_0x15a9('0x23')];if(_0x62b42e[_0x3931ef]<0x0)_0x62b42e[_0x3931ef]=0x0;});_0x25adb6(_0x62b42e);return;});})[_0x15a9('0xb')](function(_0x2a1122){_0x20186b(_0x2a1122);});});}function checkUserLimits(_0x28285c){return new BPromise(function(_0xcda6b,_0x3ab681){getLimits()[_0x15a9('0xa')](function(_0x158d70){var _0x5b93e7=_['pick'](_[_0x15a9('0x28')](_0x28285c,_0x15a9('0x20')),[_0x15a9('0x24'),_0x15a9('0x25'),_0x15a9('0x29')]);var _0x2f1f1b=(_0x5b93e7['admin']||0x0)+(_0x5b93e7[_0x15a9('0x25')]||0x0);var _0x5374f6=_0x5b93e7[_0x15a9('0x29')]||0x0;if(_0x2f1f1b>_0x158d70['user'])return _0x3ab681(_0x15a9('0x2a'));if(_0x5374f6>_0x158d70[_0x15a9('0x29')])return _0x3ab681(_0x15a9('0x2b'));return _0xcda6b();})[_0x15a9('0xb')](function(_0x11020f){_0x3ab681(_0x11020f);});});}module[_0x15a9('0x2c')]={'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 5dec2b3..fc5b165 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 _0x6a95=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0xaf9da6,_0x57203e){var _0x4d583f=function(_0x50bc2d){while(--_0x50bc2d){_0xaf9da6['push'](_0xaf9da6['shift']());}};_0x4d583f(++_0x57203e);}(_0x6a95,0x1db));var _0x56a9=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x6a95[_0x2576d7];return _0x16a08c;};'use strict';module[_0x56a9('0x0')]={'DOMAIN':_0x56a9('0x1'),'SESSION_SECRET':_0x56a9('0x2'),'GOOGLE_ID':_0x56a9('0x3'),'GOOGLE_SECRET':_0x56a9('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xe1e3=['http://localhost:9000','app-id','exports'];(function(_0x471ec4,_0x42c871){var _0x43ab60=function(_0x178e9f){while(--_0x178e9f){_0x471ec4['push'](_0x471ec4['shift']());}};_0x43ab60(++_0x42c871);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x3d1800,_0x13ac8b){_0x3d1800=_0x3d1800-0x0;var _0x58e4f6=_0xe1e3[_0x3d1800];return _0x58e4f6;};'use strict';module[_0x3e1e('0x0')]={'DOMAIN':_0x3e1e('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x3e1e('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 18d68b5..6e8e842 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfa0=['exports','../utils/loggers'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0xdfa0,0x1a5));var _0x0dfa=function(_0x1b45ea,_0x537387){_0x1b45ea=_0x1b45ea-0x0;var _0x19e68a=_0xdfa0[_0x1b45ea];return _0x19e68a;};'use strict';var fileLogger=require(_0x0dfa('0x0'))['fileLogger'];module[_0x0dfa('0x1')]=fileLogger; \ No newline at end of file +var _0xdcc5=['../utils/loggers','exports'];(function(_0x171bc0,_0x25d626){var _0x2b8f46=function(_0x481b14){while(--_0x481b14){_0x171bc0['push'](_0x171bc0['shift']());}};_0x2b8f46(++_0x25d626);}(_0xdcc5,0x14c));var _0x5dcc=function(_0x33d5fc,_0x495c31){_0x33d5fc=_0x33d5fc-0x0;var _0xf6a695=_0xdcc5[_0x33d5fc];return _0xf6a695;};'use strict';var fileLogger=require(_0x5dcc('0x0'))['fileLogger'];module[_0x5dcc('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b99820c..fff2893 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 _0xbd7d=['../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','resolve','join','root','legacy-libs','express','../../services/express/index.js'];(function(_0x4630ff,_0x496879){var _0x39d052=function(_0x29099e){while(--_0x29099e){_0x4630ff['push'](_0x4630ff['shift']());}};_0x39d052(++_0x496879);}(_0xbd7d,0x119));var _0xdbd7=function(_0x367c0e,_0x1332d8){_0x367c0e=_0x367c0e-0x0;var _0x33509c=_0xbd7d[_0x367c0e];return _0x33509c;};'use strict';var path=require(_0xdbd7('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xdbd7('0x1')](path[_0xdbd7('0x2')](cfg[_0xdbd7('0x3')],_0xdbd7('0x4')))};var pm2config={'apps':[{'name':_0xdbd7('0x5'),'script':path[_0xdbd7('0x2')](__dirname,_0xdbd7('0x6')),'env':env},{'name':'ami','script':path[_0xdbd7('0x2')](__dirname,_0xdbd7('0x7')),'env':env},{'name':'agi','script':path[_0xdbd7('0x2')](__dirname,_0xdbd7('0x8')),'env':env},{'name':_0xdbd7('0x9'),'script':path[_0xdbd7('0x2')](__dirname,_0xdbd7('0xa')),'env':env},{'name':_0xdbd7('0xb'),'script':path['join'](__dirname,_0xdbd7('0xc')),'env':env},{'name':_0xdbd7('0xd'),'script':path[_0xdbd7('0x2')](__dirname,_0xdbd7('0xe')),'env':env}]};module[_0xdbd7('0xf')]=pm2config; \ No newline at end of file +var _0x1a80=['agi','email','../../services/email/index.js','routing','xdr','path','../../config/environment','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js'];(function(_0x30f2b5,_0x1237b6){var _0x3b6ecc=function(_0x2d8729){while(--_0x2d8729){_0x30f2b5['push'](_0x30f2b5['shift']());}};_0x3b6ecc(++_0x1237b6);}(_0x1a80,0x116));var _0x01a8=function(_0x728c99,_0x54ad14){_0x728c99=_0x728c99-0x0;var _0x36990e=_0x1a80[_0x728c99];return _0x36990e;};'use strict';var path=require(_0x01a8('0x0'));var cfg=require(_0x01a8('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x01a8('0x2')](cfg[_0x01a8('0x3')],_0x01a8('0x4')))};var pm2config={'apps':[{'name':_0x01a8('0x5'),'script':path['join'](__dirname,_0x01a8('0x6')),'env':env},{'name':'ami','script':path[_0x01a8('0x2')](__dirname,_0x01a8('0x7')),'env':env},{'name':_0x01a8('0x8'),'script':path[_0x01a8('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x01a8('0x9'),'script':path[_0x01a8('0x2')](__dirname,_0x01a8('0xa')),'env':env},{'name':_0x01a8('0xb'),'script':path[_0x01a8('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x01a8('0xc'),'script':path[_0x01a8('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index db70a66..3186092 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 _0x9d32=['stop','disconnect','restart','list','delete','dump','saved','pm2','./config','connect','connected','then','start'];(function(_0x1080ad,_0x453a6a){var _0xee46ac=function(_0x547aea){while(--_0x547aea){_0x1080ad['push'](_0x1080ad['shift']());}};_0xee46ac(++_0x453a6a);}(_0x9d32,0xd7));var _0x29d3=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x9d32[_0x1abb09];return _0xea1c07;};'use strict';var pm2=require(_0x29d3('0x0'));var BPromise=require('bluebird');var config=require(_0x29d3('0x1'));function connect(){return new BPromise(function(_0xcc175c,_0x2a8c7a){return pm2[_0x29d3('0x2')](function(_0x22befc){if(_0x22befc){return _0x2a8c7a(_0x22befc);}return _0xcc175c(_0x29d3('0x3'));});});};exports['start']=function(_0x147ef0){return connect()[_0x29d3('0x4')](function(){return new BPromise(function(_0x3fe7ab,_0x4c85fa){return pm2[_0x29d3('0x5')](_0x147ef0,function(_0x36a0b1,_0xbeb092){if(_0x36a0b1){return _0x4c85fa(_0x36a0b1);}pm2['disconnect']();return _0x3fe7ab(_0xbeb092);});});});};exports['stop']=function(_0x541cf8){return connect()[_0x29d3('0x4')](function(){return new BPromise(function(_0x5d537b,_0x418689){return pm2[_0x29d3('0x6')](_0x541cf8,function(_0x2fe9df,_0x411580){if(_0x2fe9df){return _0x418689(_0x2fe9df);}pm2[_0x29d3('0x7')]();return _0x5d537b(_0x411580);});});});};exports[_0x29d3('0x8')]=function(_0x52a370){return connect()['then'](function(){return new BPromise(function(_0x396dea,_0xae2fde){return pm2['restart'](_0x52a370,function(_0x10d2ee,_0x5468b2){if(_0x10d2ee){return _0xae2fde(_0x10d2ee);}pm2[_0x29d3('0x7')]();return _0x396dea(_0x5468b2);});});});};exports[_0x29d3('0x9')]=function(){return connect()[_0x29d3('0x4')](function(){return new BPromise(function(_0x4c9896,_0x3a1617){return pm2[_0x29d3('0x9')](function(_0x59c1b3,_0x577d35){if(_0x59c1b3){return _0x3a1617(_0x59c1b3);}pm2[_0x29d3('0x7')]();return _0x4c9896(_0x577d35);});});});};exports['describe']=function(_0x39bb5d){return connect()['then'](function(){return new BPromise(function(_0x2a7fad,_0x4c25d4){return pm2['describe'](_0x39bb5d,function(_0x5b5390,_0xf568e2){if(_0x5b5390){return _0x4c25d4(_0x5b5390);}pm2[_0x29d3('0x7')]();return _0x2a7fad(_0xf568e2);});});});};exports[_0x29d3('0xa')]=function(_0x521add){return connect()[_0x29d3('0x4')](function(){return new BPromise(function(_0x17901a,_0x2840a8){return pm2['delete'](_0x521add,function(_0x5ac946,_0xe67852){if(_0x5ac946){return _0x2840a8(_0x5ac946);}pm2['disconnect']();return _0x17901a(_0xe67852);});});});};exports[_0x29d3('0xb')]=function(){return connect()[_0x29d3('0x4')](function(){return new BPromise(function(_0x30e046,_0x4276d4){return pm2['dump'](function(_0x286b44){if(_0x286b44){return _0x4276d4(_0x286b44);}return _0x30e046(_0x29d3('0xc'));});});});}; \ No newline at end of file +var _0x3718=['bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x48a3e9,_0x5ac87b){var _0x62b564=function(_0x2de3a3){while(--_0x2de3a3){_0x48a3e9['push'](_0x48a3e9['shift']());}};_0x62b564(++_0x5ac87b);}(_0x3718,0x1b2));var _0x8371=function(_0x109a55,_0x343c56){_0x109a55=_0x109a55-0x0;var _0x5038d6=_0x3718[_0x109a55];return _0x5038d6;};'use strict';var pm2=require(_0x8371('0x0'));var BPromise=require(_0x8371('0x1'));var config=require(_0x8371('0x2'));function connect(){return new BPromise(function(_0x5ef453,_0x241da4){return pm2[_0x8371('0x3')](function(_0x12c56b){if(_0x12c56b){return _0x241da4(_0x12c56b);}return _0x5ef453(_0x8371('0x4'));});});};exports[_0x8371('0x5')]=function(_0x1de939){return connect()[_0x8371('0x6')](function(){return new BPromise(function(_0x30fa87,_0x18c055){return pm2['start'](_0x1de939,function(_0x41933f,_0x19f4f8){if(_0x41933f){return _0x18c055(_0x41933f);}pm2[_0x8371('0x7')]();return _0x30fa87(_0x19f4f8);});});});};exports[_0x8371('0x8')]=function(_0x13a912){return connect()[_0x8371('0x6')](function(){return new BPromise(function(_0x15bfa4,_0x18d331){return pm2['stop'](_0x13a912,function(_0x1ad5fa,_0x4781b8){if(_0x1ad5fa){return _0x18d331(_0x1ad5fa);}pm2['disconnect']();return _0x15bfa4(_0x4781b8);});});});};exports[_0x8371('0x9')]=function(_0x162208){return connect()[_0x8371('0x6')](function(){return new BPromise(function(_0x2e7acd,_0x3ae9f7){return pm2[_0x8371('0x9')](_0x162208,function(_0xd2e3d9,_0x2d05a5){if(_0xd2e3d9){return _0x3ae9f7(_0xd2e3d9);}pm2[_0x8371('0x7')]();return _0x2e7acd(_0x2d05a5);});});});};exports['list']=function(){return connect()[_0x8371('0x6')](function(){return new BPromise(function(_0x2dfe85,_0x542945){return pm2[_0x8371('0xa')](function(_0x4d3f8b,_0x636505){if(_0x4d3f8b){return _0x542945(_0x4d3f8b);}pm2[_0x8371('0x7')]();return _0x2dfe85(_0x636505);});});});};exports['describe']=function(_0x443685){return connect()[_0x8371('0x6')](function(){return new BPromise(function(_0x3c8691,_0x2799a8){return pm2[_0x8371('0xb')](_0x443685,function(_0x4c965e,_0x39b160){if(_0x4c965e){return _0x2799a8(_0x4c965e);}pm2[_0x8371('0x7')]();return _0x3c8691(_0x39b160);});});});};exports[_0x8371('0xc')]=function(_0x4086dd){return connect()[_0x8371('0x6')](function(){return new BPromise(function(_0x574749,_0x47927f){return pm2[_0x8371('0xc')](_0x4086dd,function(_0x44fe91,_0x1dde24){if(_0x44fe91){return _0x47927f(_0x44fe91);}pm2[_0x8371('0x7')]();return _0x574749(_0x1dde24);});});});};exports[_0x8371('0xd')]=function(){return connect()[_0x8371('0x6')](function(){return new BPromise(function(_0x5cbb4c,_0xe172f9){return pm2[_0x8371('0xd')](function(_0x4053fe){if(_0x4053fe){return _0xe172f9(_0x4053fe);}return _0x5cbb4c(_0x8371('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8c02f56..218f212 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 _0x53d8=['format','YYYY-MM-DD\x20HH:mm:ss','join','error','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','Setting','find','chatTimeout','lastMsgAt','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','system','timeout'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x53d8,0x17f));var _0x853d=function(_0x8a5017,_0x4652b){_0x8a5017=_0x8a5017-0x0;var _0x2aabe0=_0x53d8[_0x8a5017];return _0x2aabe0;};'use strict';var _=require(_0x853d('0x0'));var moment=require(_0x853d('0x1'));var Redis=require(_0x853d('0x2'));var util=require(_0x853d('0x3'));var config=require(_0x853d('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x853d('0x5'))(_0x853d('0x6'));config[_0x853d('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x853d('0x7')]));function closeInteractions(){var _0x5e0235=0x0;var _0xddb21a=[];return db[_0x853d('0x8')][_0x853d('0x9')]({'raw':!![],'attributes':['id',_0x853d('0xa')],'where':{'id':0x1}})['then'](function(_0x36a840){_0x5e0235=_0x36a840[_0x853d('0xa')];if(_0x5e0235){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x853d('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x36a840[_0x853d('0xa')],_0x853d('0xc'))}}});}else{return[];}})[_0x853d('0xd')](function(_0x23df59){if(_0x23df59&&_0x23df59[_0x853d('0xe')]){_0xddb21a=_[_0x853d('0xf')](_0x23df59||[],'id');logger[_0x853d('0x10')](_0x853d('0x11'),_0xddb21a['join']());return db[_0x853d('0x12')][_0x853d('0x13')]({'closeReason':_0x853d('0x14'),'disposition':_0x853d('0x15'),'closed':!![],'closedAt':moment()[_0x853d('0x16')](_0x853d('0x17'))},{'where':{'id':_0xddb21a}});}})[_0x853d('0xd')](function(){if(_0xddb21a&&_0xddb21a['length']){logger[_0x853d('0x10')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xddb21a[_0x853d('0x18')]());for(var _0x38f4b6=0x0;_0x38f4b6<_0xddb21a['length'];_0x38f4b6++){io['emit']('chatInteraction:update',{'id':_0xddb21a[_0x38f4b6],'closed':!![]});}}})['catch'](function(_0x3122c2){logger[_0x853d('0x19')]('[CHAT]\x20Error\x20closing\x20interactions',_0x3122c2?util['inspect'](_0x3122c2,{'showHidden':![],'depth':null}):'');});}exports[_0x853d('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x443c=['join','ChatInteraction','update','timeout','YYYY-MM-DD\x20HH:mm:ss','info','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','then','lastMsgAt','subtract','length','map'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0x443c,0xd7));var _0xc443=function(_0x59145c,_0x94d69a){_0x59145c=_0x59145c-0x0;var _0x4651d0=_0x443c[_0x59145c];return _0x4651d0;};'use strict';var _=require(_0xc443('0x0'));var moment=require('moment');var Redis=require(_0xc443('0x1'));var util=require(_0xc443('0x2'));var config=require('../../config/environment');var db=require(_0xc443('0x3'))['db'];var logger=require(_0xc443('0x4'))(_0xc443('0x5'));config['redis']=_[_0xc443('0x6')](config[_0xc443('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xc443('0x8'))(new Redis(config[_0xc443('0x7')]));function closeInteractions(){var _0x1a7094=0x0;var _0x42e155=[];return db[_0xc443('0x9')][_0xc443('0xa')]({'raw':!![],'attributes':['id',_0xc443('0xb')],'where':{'id':0x1}})[_0xc443('0xc')](function(_0x1834e6){_0x1a7094=_0x1834e6[_0xc443('0xb')];if(_0x1a7094){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0xc443('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc443('0xe')](_0x1834e6[_0xc443('0xb')],'minutes')}}});}else{return[];}})[_0xc443('0xc')](function(_0x5a010c){if(_0x5a010c&&_0x5a010c[_0xc443('0xf')]){_0x42e155=_[_0xc443('0x10')](_0x5a010c||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x42e155[_0xc443('0x11')]());return db[_0xc443('0x12')][_0xc443('0x13')]({'closeReason':'system','disposition':_0xc443('0x14'),'closed':!![],'closedAt':moment()['format'](_0xc443('0x15'))},{'where':{'id':_0x42e155}});}})[_0xc443('0xc')](function(){if(_0x42e155&&_0x42e155[_0xc443('0xf')]){logger[_0xc443('0x16')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x42e155[_0xc443('0x11')]());for(var _0xa8ffe4=0x0;_0xa8ffe4<_0x42e155[_0xc443('0xf')];_0xa8ffe4++){io[_0xc443('0x17')]('chatInteraction:update',{'id':_0x42e155[_0xa8ffe4],'closed':!![]});}}})[_0xc443('0x18')](function(_0x46e0d9){logger[_0xc443('0x19')](_0xc443('0x1a'),_0x46e0d9?util[_0xc443('0x1b')](_0x46e0d9,{'showHidden':![],'depth':null}):'');});}exports[_0xc443('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 2cd20e5..8bd9b8f 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed4d=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3e8f8e,_0x50e78d){var _0x428d54=function(_0x40fdab){while(--_0x40fdab){_0x3e8f8e['push'](_0x3e8f8e['shift']());}};_0x428d54(++_0x50e78d);}(_0xed4d,0xa7));var _0xded4=function(_0x4fb4e4,_0x187bc0){_0x4fb4e4=_0x4fb4e4-0x0;var _0x4b7774=_0xed4d[_0x4fb4e4];return _0x4b7774;};'use strict';function start(){var _0x3dc977=require(_0xded4('0x0'));return _0x3dc977[_0xded4('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x73d4=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x22f8c8,_0x173223){var _0x407a36=function(_0x32ff5d){while(--_0x32ff5d){_0x22f8c8['push'](_0x22f8c8['shift']());}};_0x407a36(++_0x173223);}(_0x73d4,0x1d7));var _0x473d=function(_0x3366c5,_0x597f9a){_0x3366c5=_0x3366c5-0x0;var _0x18500d=_0x73d4[_0x3366c5];return _0x18500d;};'use strict';function start(){var _0x4c22e6=require(_0x473d('0x0'));return _0x4c22e6[_0x473d('0x1')]();}module[_0x473d('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 335c7c2..4d6f327 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 _0x1664=['length','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','exists','endAt','update','update\x20cron','run','start','util','path','moment','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','format','\x22%s\x22\x20<%s>','MailAccount','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','basename','extname','savename','join','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','error','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy'];(function(_0x6e7bb5,_0x4dadc8){var _0x4bcf84=function(_0x5ce403){while(--_0x5ce403){_0x6e7bb5['push'](_0x6e7bb5['shift']());}};_0x4bcf84(++_0x4dadc8);}(_0x1664,0x157));var _0x4166=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1664[_0x2641f9];return _0x585741;};'use strict';var fs=require('fs');var util=require(_0x4166('0x0'));var path=require(_0x4166('0x1'));var _=require('lodash');var moment=require(_0x4166('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x4166('0x3'));var logger=require('../logger')(_0x4166('0x4'));var db=require(_0x4166('0x5'))['db'];var analyticCustomReportController=require(_0x4166('0x6'));var analyticDefaultReportController=require(_0x4166('0x7'));var client=jayson[_0x4166('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x554a95,_0x376380){return function(){logger[_0x4166('0x9')](_0x4166('0xa'),_0x554a95[_0x4166('0xb')]);var _0x541197=!![];var _0x2fa4c6=_0x554a95['MailAccount']['getSmtpOptions']();var _0x4939b3={'account':_0x2fa4c6,'message':{'from':util[_0x4166('0xc')](_0x4166('0xd'),_0x554a95[_0x4166('0xe')][_0x4166('0xf')],_0x554a95[_0x4166('0xe')][_0x4166('0xb')]||_0x554a95[_0x4166('0xe')]['Smtp'][_0x4166('0x10')]),'to':_0x554a95[_0x4166('0xb')],'cc':_0x554a95['cc'],'bcc':_0x554a95[_0x4166('0x11')],'subject':util[_0x4166('0xc')](_0x4166('0x12'),_0x376380[_0x4166('0xf')],_0x554a95[_0x4166('0x13')],_0x554a95[_0x4166('0x14')])}};var _0x1c11b7=path['join'](__dirname,'../../files/reports');var _0x520410=_0x376380['savename'];var _0x22275b=util[_0x4166('0xc')]('%s.%s',path[_0x4166('0x15')](_0x376380['savename'],path[_0x4166('0x16')](_0x376380[_0x4166('0x17')])),'zip');var _0x4581cb=path['join'](_0x1c11b7,_0x520410);var _0x480081=path[_0x4166('0x18')](_0x1c11b7,_0x22275b);if(fs['existsSync'](_0x4581cb)){_0x376380[_0x4166('0x19')]=_0x4166('0x1a');_0x4939b3[_0x4166('0x1b')][_0x4166('0x1c')]=[{'filename':_0x520410,'path':_0x4581cb}];_0x4939b3['message'][_0x4166('0x1d')]=util[_0x4166('0xc')](_0x4166('0x1e'),JSON[_0x4166('0x1f')](_0x376380,null,0x2));}else if(fs[_0x4166('0x20')](_0x480081)){_0x376380[_0x4166('0x19')]=_0x4166('0x1a');_0x4939b3[_0x4166('0x1b')][_0x4166('0x1c')]=[{'filename':_0x22275b,'path':_0x480081}];}else{_0x4939b3[_0x4166('0x1b')][_0x4166('0x1d')]=_0x4166('0x21');if(!_0x554a95['sendIfEmpty']){_0x541197=![];logger[_0x4166('0x9')](_0x4166('0x22'));}}if(_0x541197){return client[_0x4166('0x23')](_0x4166('0x24'),_0x4939b3)['then'](function(_0x3c7d88){if(_0x3c7d88['error']){return logger['error'](_0x4166('0x25'),JSON[_0x4166('0x1f')](_0x3c7d88));}return logger[_0x4166('0x9')](_0x4166('0x26'));})[_0x4166('0x27')](function(_0x496c39){return logger['error']('error\x20mail',JSON[_0x4166('0x1f')](_0x496c39));});}};}function handleError(){return function(_0x138552){return logger['error'](JSON[_0x4166('0x1f')](_0x138552));};}function handleResult(_0x198695){return function(_0x3b76c3){logger[_0x4166('0x9')](_0x4166('0x28'),JSON[_0x4166('0x1f')](_0x3b76c3));if(_0x198695[_0x4166('0xe')]&&_0x198695[_0x4166('0xe')][_0x4166('0x29')]&&!_[_0x4166('0x2a')](_0x198695[_0x4166('0xb')])){setTimeout(handleSendEmail(_0x198695,_0x3b76c3),0x3c*0x3e8);}};}function handleJob(_0x147b0e){return function(){try{if(_['isNil'](_0x147b0e['subtractNumber'])){return logger[_0x4166('0x9')](_0x4166('0x2b'));}if(_[_0x4166('0x2a')](_0x147b0e[_0x4166('0x14')])){return logger['info'](_0x4166('0x2c'));}var _0x513260={'startDate':moment()['subtract'](_0x147b0e[_0x4166('0x13')],_0x147b0e[_0x4166('0x14')])['format'](_0x4166('0x2d')),'endDate':moment()[_0x4166('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x4166('0x2e'),'output':_0x147b0e['output'],'name':_0x147b0e['name']};if(!_[_0x4166('0x2a')](_0x147b0e['DefaultReportId'])){logger[_0x4166('0x9')]('exec\x20defaul\x20report\x20id:%s',_0x147b0e[_0x4166('0x2f')]);return analyticDefaultReportController[_0x4166('0x30')]({'id':_0x147b0e[_0x4166('0x2f')]},_0x513260)[_0x4166('0x31')](handleResult(_0x147b0e))[_0x4166('0x27')](handleError());}if(!_[_0x4166('0x2a')](_0x147b0e[_0x4166('0x32')])){logger[_0x4166('0x9')](_0x4166('0x33'),_0x147b0e['CustomReportId']);return analyticCustomReportController[_0x4166('0x30')]({'id':_0x147b0e[_0x4166('0x32')]},_0x513260)[_0x4166('0x31')](handleResult(_0x147b0e))[_0x4166('0x27')](handleError());}}catch(_0x13f7ea){logger[_0x4166('0x34')](JSON[_0x4166('0x1f')](_0x13f7ea));}return logger[_0x4166('0x9')](_0x4166('0x35'));};}function getJobs(_0x132460){var _0xe354f6={};if(_0x132460){_0xe354f6['id']=_0x132460;}return db[_0x4166('0x36')]['findAll']({'where':_0xe354f6,'include':[{'model':db[_0x4166('0xe')],'attributes':['id',_0x4166('0xf'),_0x4166('0xb')],'include':[{'model':db[_0x4166('0x37')],'as':_0x4166('0x29'),'include':[{'model':db['CloudProvider'],'as':_0x4166('0x38')}]}]}]})[_0x4166('0x31')](function(_0x47442d){var _0x104f5a=_[_0x4166('0x39')](manager[_0x4166('0x3a')]);var _0x2860d8=_[_0x4166('0x3b')](_0x47442d,function(_0x2a577e){return _0x2a577e['id'][_0x4166('0x3c')]();});var _0x337cfe=_[_0x4166('0x3d')](_0x47442d,function(_0x1cf0d8){return _0x1cf0d8['id'][_0x4166('0x3c')]();});var _0x3b9bca=_0x132460?_0x2860d8:_['difference'](_0x2860d8,_0x104f5a);var _0x405795=_['intersection'](_0x2860d8,_0x104f5a);var _0x37a659=_['difference'](_0x104f5a,_0x2860d8);var _0x5b625b;var _0x164fbd;for(_0x5b625b=0x0;_0x5b625b<_0x37a659[_0x4166('0x3e')]&&!_0x132460;_0x5b625b+=0x1){_0x164fbd=_0x37a659[_0x5b625b][_0x4166('0x3c')]();if(manager['exists'](_0x164fbd)){manager[_0x4166('0x3f')](_0x164fbd);manager[_0x4166('0x40')](_0x164fbd);logger['info']('delete\x20cron',_0x164fbd);}}logger[_0x4166('0x9')](_0x4166('0x41'),JSON[_0x4166('0x1f')](_0x3b9bca));for(_0x5b625b=0x0;_0x5b625b<_0x3b9bca[_0x4166('0x3e')];_0x5b625b+=0x1){_0x164fbd=_0x3b9bca[_0x5b625b][_0x4166('0x3c')]();logger[_0x4166('0x9')](_0x4166('0x42'),_0x164fbd);if(_0x132460){logger[_0x4166('0x9')](_0x4166('0x43'),_0x132460);logger[_0x4166('0x9')](JSON[_0x4166('0x1f')](_0x337cfe[_0x164fbd]));BPromise[_0x4166('0x44')]()[_0x4166('0x31')](handleJob(_0x337cfe[_0x164fbd]));logger['info'](_0x4166('0x45'),_0x337cfe[_0x164fbd][_0x4166('0xf')],_0x337cfe[_0x164fbd][_0x4166('0x46')]);}else if(_0x337cfe[_0x164fbd]['cron']&&_0x337cfe[_0x164fbd][_0x4166('0x47')]&&moment()[_0x4166('0x48')](_0x337cfe[_0x164fbd][_0x4166('0x49')],_0x337cfe[_0x164fbd]['endAt'])){manager[_0x4166('0x4a')](_0x164fbd,_0x337cfe[_0x164fbd][_0x4166('0x46')],handleJob(_0x337cfe[_0x164fbd]));manager['start'](_0x164fbd);logger[_0x4166('0x9')]('add\x20cron',_0x337cfe[_0x164fbd]['name'],_0x337cfe[_0x164fbd][_0x4166('0x46')]);}else if(manager[_0x4166('0x4b')](_0x164fbd)){manager[_0x4166('0x3f')](_0x164fbd);manager[_0x4166('0x40')](_0x164fbd);logger[_0x4166('0x9')]('stop\x20cron',_0x337cfe[_0x164fbd][_0x4166('0xf')],_0x337cfe[_0x164fbd][_0x4166('0x46')]);}}for(_0x5b625b=0x0,_0x164fbd;_0x5b625b<_0x405795[_0x4166('0x3e')]&&!_0x132460;_0x5b625b+=0x1){_0x164fbd=_0x405795[_0x5b625b]['toString']();if(manager[_0x4166('0x4b')](_0x164fbd)){if(_0x337cfe[_0x164fbd][_0x4166('0x46')]&&_0x337cfe[_0x164fbd][_0x4166('0x47')]&&moment()[_0x4166('0x48')](_0x337cfe[_0x164fbd][_0x4166('0x49')],_0x337cfe[_0x164fbd][_0x4166('0x4c')])){manager[_0x4166('0x4d')](_0x164fbd,_0x337cfe[_0x164fbd][_0x4166('0x46')],handleJob(_0x337cfe[_0x164fbd]));logger[_0x4166('0x9')](_0x4166('0x4e'),_0x337cfe[_0x164fbd][_0x4166('0xf')],_0x337cfe[_0x164fbd][_0x4166('0x46')]);}else{manager[_0x4166('0x3f')](_0x164fbd);manager[_0x4166('0x40')](_0x164fbd);logger['info']('stop\x20cron',_0x337cfe[_0x164fbd][_0x4166('0xf')],_0x337cfe[_0x164fbd][_0x4166('0x46')]);}}}})['catch'](function(_0x2a5ac5){logger[_0x4166('0x34')](JSON[_0x4166('0x1f')](_0x2a5ac5));});}exports[_0x4166('0x4f')]=function(_0x47feb3){return getJobs(_0x47feb3);};exports[_0x4166('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0604=['bcc','subtractNumber','join','../../files/reports','savename','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','stringify','email\x20sent','error\x20mail','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','Schedule','MailServerOut','CloudProvider','keys','map','keyBy','toString','difference','length','exists','stop','deleteJob','toRun','resolve','run\x20job','cron','active','isBetween','endAt','start','stop\x20cron','startAt','update','update\x20cron','run','util','path','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','user'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0604,0x8d));var _0x4060=function(_0x277dbd,_0x6fdbc8){_0x277dbd=_0x277dbd-0x0;var _0x14a8c8=_0x0604[_0x277dbd];return _0x14a8c8;};'use strict';var fs=require('fs');var util=require(_0x4060('0x0'));var path=require(_0x4060('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x4060('0x2'));var logger=require(_0x4060('0x3'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x4060('0x4'));var analyticDefaultReportController=require(_0x4060('0x5'));var client=jayson[_0x4060('0x6')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4c01ca,_0x2e26f9){return function(){logger['info'](_0x4060('0x7'),_0x4c01ca[_0x4060('0x8')]);var _0x2a2de2=!![];var _0x2dc93a=_0x4c01ca[_0x4060('0x9')][_0x4060('0xa')]();var _0x399fc4={'account':_0x2dc93a,'message':{'from':util[_0x4060('0xb')](_0x4060('0xc'),_0x4c01ca[_0x4060('0x9')][_0x4060('0xd')],_0x4c01ca[_0x4060('0x9')][_0x4060('0x8')]||_0x4c01ca[_0x4060('0x9')]['Smtp'][_0x4060('0xe')]),'to':_0x4c01ca[_0x4060('0x8')],'cc':_0x4c01ca['cc'],'bcc':_0x4c01ca[_0x4060('0xf')],'subject':util[_0x4060('0xb')]('Report\x20%s\x20last\x20%s\x20%s',_0x2e26f9[_0x4060('0xd')],_0x4c01ca[_0x4060('0x10')],_0x4c01ca['subtractUnit'])}};var _0x42e128=path[_0x4060('0x11')](__dirname,_0x4060('0x12'));var _0x2004c2=_0x2e26f9[_0x4060('0x13')];var _0x8211ca=util[_0x4060('0xb')]('%s.%s',path[_0x4060('0x14')](_0x2e26f9['savename'],path[_0x4060('0x15')](_0x2e26f9[_0x4060('0x13')])),_0x4060('0x16'));var _0x24ec45=path['join'](_0x42e128,_0x2004c2);var _0x123072=path[_0x4060('0x11')](_0x42e128,_0x8211ca);if(fs[_0x4060('0x17')](_0x24ec45)){_0x2e26f9[_0x4060('0x18')]=_0x4060('0x19');_0x399fc4[_0x4060('0x1a')][_0x4060('0x1b')]=[{'filename':_0x2004c2,'path':_0x24ec45}];_0x399fc4[_0x4060('0x1a')][_0x4060('0x1c')]=util[_0x4060('0xb')](_0x4060('0x1d'),JSON['stringify'](_0x2e26f9,null,0x2));}else if(fs['existsSync'](_0x123072)){_0x2e26f9[_0x4060('0x18')]=_0x4060('0x19');_0x399fc4[_0x4060('0x1a')]['attachments']=[{'filename':_0x8211ca,'path':_0x123072}];}else{_0x399fc4['message'][_0x4060('0x1c')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4c01ca[_0x4060('0x1e')]){_0x2a2de2=![];logger[_0x4060('0x1f')](_0x4060('0x20'));}}if(_0x2a2de2){return client['request'](_0x4060('0x21'),_0x399fc4)[_0x4060('0x22')](function(_0x532251){if(_0x532251[_0x4060('0x23')]){return logger[_0x4060('0x23')]('error\x20mail',JSON[_0x4060('0x24')](_0x532251));}return logger[_0x4060('0x1f')](_0x4060('0x25'));})['catch'](function(_0x157ab3){return logger[_0x4060('0x23')](_0x4060('0x26'),JSON['stringify'](_0x157ab3));});}};}function handleError(){return function(_0x515947){return logger[_0x4060('0x23')](JSON[_0x4060('0x24')](_0x515947));};}function handleResult(_0x2bf675){return function(_0x511080){logger[_0x4060('0x1f')](_0x4060('0x27'),JSON[_0x4060('0x24')](_0x511080));if(_0x2bf675[_0x4060('0x9')]&&_0x2bf675['MailAccount'][_0x4060('0x28')]&&!_[_0x4060('0x29')](_0x2bf675[_0x4060('0x8')])){setTimeout(handleSendEmail(_0x2bf675,_0x511080),0x3c*0x3e8);}};}function handleJob(_0x6d8fff){return function(){try{if(_['isNil'](_0x6d8fff[_0x4060('0x10')])){return logger[_0x4060('0x1f')](_0x4060('0x2a'));}if(_[_0x4060('0x29')](_0x6d8fff[_0x4060('0x2b')])){return logger['info'](_0x4060('0x2c'));}var _0x4a678f={'startDate':moment()[_0x4060('0x2d')](_0x6d8fff[_0x4060('0x10')],_0x6d8fff[_0x4060('0x2b')])['format'](_0x4060('0x2e')),'endDate':moment()[_0x4060('0xb')](_0x4060('0x2e')),'type':_0x4060('0x2f'),'output':_0x6d8fff[_0x4060('0x30')],'name':_0x6d8fff[_0x4060('0xd')]};if(!_[_0x4060('0x29')](_0x6d8fff[_0x4060('0x31')])){logger[_0x4060('0x1f')]('exec\x20defaul\x20report\x20id:%s',_0x6d8fff[_0x4060('0x31')]);return analyticDefaultReportController[_0x4060('0x32')]({'id':_0x6d8fff[_0x4060('0x31')]},_0x4a678f)[_0x4060('0x22')](handleResult(_0x6d8fff))[_0x4060('0x33')](handleError());}if(!_[_0x4060('0x29')](_0x6d8fff['CustomReportId'])){logger[_0x4060('0x1f')]('exec\x20custom\x20report\x20id:%s',_0x6d8fff[_0x4060('0x34')]);return analyticCustomReportController['runReport']({'id':_0x6d8fff[_0x4060('0x34')]},_0x4a678f)['then'](handleResult(_0x6d8fff))[_0x4060('0x33')](handleError());}}catch(_0x4bb8f5){logger['error'](JSON[_0x4060('0x24')](_0x4bb8f5));}return logger[_0x4060('0x1f')]('no\x20report\x20id');};}function getJobs(_0x3a5bc8){var _0x6ce82d={};if(_0x3a5bc8){_0x6ce82d['id']=_0x3a5bc8;}return db[_0x4060('0x35')]['findAll']({'where':_0x6ce82d,'include':[{'model':db[_0x4060('0x9')],'attributes':['id','name',_0x4060('0x8')],'include':[{'model':db[_0x4060('0x36')],'as':_0x4060('0x28'),'include':[{'model':db[_0x4060('0x37')],'as':_0x4060('0x37')}]}]}]})[_0x4060('0x22')](function(_0x581c63){var _0x33257c=_[_0x4060('0x38')](manager['jobs']);var _0x3a15a7=_[_0x4060('0x39')](_0x581c63,function(_0x5a0cd5){return _0x5a0cd5['id']['toString']();});var _0x40108f=_[_0x4060('0x3a')](_0x581c63,function(_0x41e062){return _0x41e062['id'][_0x4060('0x3b')]();});var _0x27d287=_0x3a5bc8?_0x3a15a7:_[_0x4060('0x3c')](_0x3a15a7,_0x33257c);var _0x39c4c4=_['intersection'](_0x3a15a7,_0x33257c);var _0x21256b=_[_0x4060('0x3c')](_0x33257c,_0x3a15a7);var _0x4e7c6a;var _0x32f0b0;for(_0x4e7c6a=0x0;_0x4e7c6a<_0x21256b[_0x4060('0x3d')]&&!_0x3a5bc8;_0x4e7c6a+=0x1){_0x32f0b0=_0x21256b[_0x4e7c6a][_0x4060('0x3b')]();if(manager[_0x4060('0x3e')](_0x32f0b0)){manager[_0x4060('0x3f')](_0x32f0b0);manager[_0x4060('0x40')](_0x32f0b0);logger[_0x4060('0x1f')]('delete\x20cron',_0x32f0b0);}}logger[_0x4060('0x1f')](_0x4060('0x41'),JSON[_0x4060('0x24')](_0x27d287));for(_0x4e7c6a=0x0;_0x4e7c6a<_0x27d287[_0x4060('0x3d')];_0x4e7c6a+=0x1){_0x32f0b0=_0x27d287[_0x4e7c6a][_0x4060('0x3b')]();logger['info']('index',_0x32f0b0);if(_0x3a5bc8){logger['info']('my\x20id',_0x3a5bc8);logger['info'](JSON[_0x4060('0x24')](_0x40108f[_0x32f0b0]));BPromise[_0x4060('0x42')]()['then'](handleJob(_0x40108f[_0x32f0b0]));logger[_0x4060('0x1f')](_0x4060('0x43'),_0x40108f[_0x32f0b0][_0x4060('0xd')],_0x40108f[_0x32f0b0]['cron']);}else if(_0x40108f[_0x32f0b0][_0x4060('0x44')]&&_0x40108f[_0x32f0b0][_0x4060('0x45')]&&moment()[_0x4060('0x46')](_0x40108f[_0x32f0b0]['startAt'],_0x40108f[_0x32f0b0][_0x4060('0x47')])){manager['add'](_0x32f0b0,_0x40108f[_0x32f0b0][_0x4060('0x44')],handleJob(_0x40108f[_0x32f0b0]));manager[_0x4060('0x48')](_0x32f0b0);logger['info']('add\x20cron',_0x40108f[_0x32f0b0][_0x4060('0xd')],_0x40108f[_0x32f0b0][_0x4060('0x44')]);}else if(manager[_0x4060('0x3e')](_0x32f0b0)){manager[_0x4060('0x3f')](_0x32f0b0);manager['deleteJob'](_0x32f0b0);logger[_0x4060('0x1f')](_0x4060('0x49'),_0x40108f[_0x32f0b0][_0x4060('0xd')],_0x40108f[_0x32f0b0][_0x4060('0x44')]);}}for(_0x4e7c6a=0x0,_0x32f0b0;_0x4e7c6a<_0x39c4c4['length']&&!_0x3a5bc8;_0x4e7c6a+=0x1){_0x32f0b0=_0x39c4c4[_0x4e7c6a][_0x4060('0x3b')]();if(manager['exists'](_0x32f0b0)){if(_0x40108f[_0x32f0b0][_0x4060('0x44')]&&_0x40108f[_0x32f0b0][_0x4060('0x45')]&&moment()[_0x4060('0x46')](_0x40108f[_0x32f0b0][_0x4060('0x4a')],_0x40108f[_0x32f0b0][_0x4060('0x47')])){manager[_0x4060('0x4b')](_0x32f0b0,_0x40108f[_0x32f0b0]['cron'],handleJob(_0x40108f[_0x32f0b0]));logger[_0x4060('0x1f')](_0x4060('0x4c'),_0x40108f[_0x32f0b0][_0x4060('0xd')],_0x40108f[_0x32f0b0][_0x4060('0x44')]);}else{manager[_0x4060('0x3f')](_0x32f0b0);manager[_0x4060('0x40')](_0x32f0b0);logger['info']('stop\x20cron',_0x40108f[_0x32f0b0][_0x4060('0xd')],_0x40108f[_0x32f0b0][_0x4060('0x44')]);}}}})['catch'](function(_0x15d669){logger['error'](JSON[_0x4060('0x24')](_0x15d669));});}exports[_0x4060('0x4d')]=function(_0x57d60d){return getJobs(_0x57d60d);};exports[_0x4060('0x48')]=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 5d09be4..16ad0b4 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 _0x530f=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','then','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','Mixed','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','aws-sdk','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format'];(function(_0x117bc8,_0x33ce9d){var _0x30a897=function(_0x58ebd0){while(--_0x58ebd0){_0x117bc8['push'](_0x117bc8['shift']());}};_0x30a897(++_0x33ce9d);}(_0x530f,0x167));var _0xf530=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x530f[_0x100682];return _0xcb6e87;};var _=require('lodash');var AWS=require(_0xf530('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0xf530('0x1'));var db=require(_0xf530('0x2'))['db'];var logger=require(_0xf530('0x3'))(_0xf530('0x4'));function getTranscriptionJob(_0x464b2e,_0x2bacf8,_0x5cb04f,_0xa4e5b7){return new Promise(function(_0x58f5f8,_0x3a0301){var _0x2ce7f8=new AWS[(_0xf530('0x5'))]({'accessKeyId':_0x2bacf8,'secretAccessKey':_0x464b2e,'region':_0x5cb04f});_0x2ce7f8['getTranscriptionJob']({'TranscriptionJobName':_0xa4e5b7},function(_0x2bbe3c,_0xf205be){if(_0x2bbe3c){return _0x3a0301(_0x2bbe3c);}else{return _0x58f5f8(_0xf205be);}});});}function sentiment(_0x375d92,_0x38503f,_0x4132bf,_0x1b3603,_0x4b8336){return new Promise(function(_0xd747c3,_0x2fd24d){var _0x383493=new AWS[(_0xf530('0x6'))]({'accessKeyId':_0x38503f,'secretAccessKey':_0x375d92,'region':_0x4132bf});_0x383493[_0xf530('0x7')]({'Text':_0x1b3603,'LanguageCode':_0x4b8336[_0xf530('0x8')](0x0,0x2)},function(_0x4cd30d,_0x4c483a){if(_0x4cd30d){return _0x2fd24d(_0x4cd30d);}else{return _0xd747c3(_0x4c483a);}});});}function checkTranscribeJob(_0x35c314,_0x194b1f,_0x27f552){var _0x332ce2;return new BPromise(function(_0x8d76da,_0x4afc17){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0xb'),_0x35c314['id'],_0x35c314[_0xf530('0xc')]));return getTranscriptionJob(_0x27f552[_0xf530('0xd')],_0x27f552[_0xf530('0xe')],_0x194b1f[_0xf530('0xf')],_0x35c314[_0xf530('0xc')])['then'](function(_0x244fb8){logger[_0xf530('0x9')](util['format'](_0xf530('0x10'),_0x35c314['id'],_0x35c314[_0xf530('0xc')],_0x244fb8['TranscriptionJob'][_0xf530('0x11')]));if(!_0x35c314[_0xf530('0x12')]){switch(_0x244fb8[_0xf530('0x13')][_0xf530('0x11')]){case'COMPLETED':var _0x34742c={'transcribeStatus':_0x244fb8[_0xf530('0x13')][_0xf530('0x11')],'fileUri':_0x244fb8[_0xf530('0x13')][_0xf530('0x14')][_0xf530('0x15')]};logger['info'](util[_0xf530('0xa')](_0xf530('0x16'),_0x35c314['id']));return rp({'uri':_0x244fb8[_0xf530('0x13')][_0xf530('0x14')][_0xf530('0x15')],'json':!![]})['then'](function(_0x4dbbaf){logger['info'](util[_0xf530('0xa')](_0xf530('0x17'),_0x35c314['id']));if(_0x4dbbaf&&_0x4dbbaf[_0xf530('0x18')]&&_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')]&&_0x4dbbaf['results'][_0xf530('0x19')][_0xf530('0x1a')]){_0x34742c[_0xf530('0x12')]='';for(var _0x24a4dc=0x0;_0x24a4dc<_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')][_0xf530('0x1a')];_0x24a4dc++){_0x34742c[_0xf530('0x12')]+=_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')][_0x24a4dc][_0xf530('0x1b')]+'';}}return _0x35c314['update'](_0x34742c);})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35c314['id']));if(!_0x35c314[_0xf530('0x1d')]){throw new db['Sequelize']['ValidationError'](_0xf530('0x1e'));}if(!_0x194b1f[_0xf530('0x1f')]||!_0x194b1f[_0xf530('0x20')]||!_0x194b1f['sentimentRegion']||!_0x194b1f[_0xf530('0x21')]||!_0x194b1f[_0xf530('0x22')]){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x25'));}if(!_0x34742c[_0xf530('0x12')]){throw new Error(_0xf530('0x26'));}if(_0x194b1f[_0xf530('0x20')]===_0x27f552['id']){return _0x27f552;}else{return db[_0xf530('0x27')][_0xf530('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf530('0x1c')](function(_0x4a1e5f){if(!_0x4a1e5f){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4a1e5f['data1']||!_0x4a1e5f['data2']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x29'));}_0x332ce2=_0x4a1e5f;logger[_0xf530('0x9')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x35c314['id']));return sentiment(_0x332ce2[_0xf530('0xd')],_0x332ce2[_0xf530('0xe')],_0x194b1f[_0xf530('0x2a')],_0x34742c[_0xf530('0x12')],_0x194b1f[_0xf530('0x21')]);})[_0xf530('0x1c')](function(_0x1d6dfe){logger['info'](util[_0xf530('0xa')](_0xf530('0x2b'),_0x35c314['id']));return _0x35c314[_0xf530('0x2c')]({'sentiment':_0x1d6dfe[_0xf530('0x2d')],'sPositive':_0x1d6dfe[_0xf530('0x2e')]['Positive'],'sNegative':_0x1d6dfe[_0xf530('0x2e')]['Negative'],'sMixed':_0x1d6dfe[_0xf530('0x2e')]['Mixed'],'sNeutral':_0x1d6dfe[_0xf530('0x2e')][_0xf530('0x2f')]});})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util['format'](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});case'FAILED':return _0x35c314['update']({'transcribeStatus':_0xf530('0x31'),'failureReason':_0x244fb8[_0xf530('0x13')][_0xf530('0x32')]})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});default:logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x33'),_0x35c314['id']));break;}}else{return BPromise[_0xf530('0x34')]()[_0xf530('0x1c')](function(){if(!_0x35c314['tempSentiment']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x1e'));}if(!_0x194b1f[_0xf530('0x1f')]||!_0x194b1f[_0xf530('0x20')]||!_0x194b1f[_0xf530('0x2a')]||!_0x194b1f[_0xf530('0x21')]||!_0x194b1f['bucket']){throw new db['Sequelize']['ValidationError'](_0xf530('0x25'));}if(!_0x35c314[_0xf530('0x12')]){throw new Error(_0xf530('0x26'));}if(_0x194b1f[_0xf530('0x20')]===_0x27f552['id']){return _0x27f552;}else{return db[_0xf530('0x27')]['findOne']({'where':{'id':_settings[_0xf530('0x20')]}});}})['then'](function(_0x38372c){if(!_0x38372c){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x35'));}if(!_0x38372c[_0xf530('0xd')]||!_0x38372c['data2']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x332ce2=_0x38372c;logger['info'](util[_0xf530('0xa')](_0xf530('0x36'),_0x35c314['id']));return sentiment(_0x332ce2['data1'],_0x332ce2[_0xf530('0xe')],_0x194b1f['sentimentRegion'],_0x35c314[_0xf530('0x12')],_0x194b1f[_0xf530('0x21')]);})[_0xf530('0x1c')](function(_0x5d6333){logger['info'](util[_0xf530('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x35c314['id']));return _0x35c314[_0xf530('0x2c')]({'sentiment':_0x5d6333['Sentiment'],'sPositive':_0x5d6333[_0xf530('0x2e')][_0xf530('0x37')],'sNegative':_0x5d6333['SentimentScore']['Negative'],'sMixed':_0x5d6333['SentimentScore'][_0xf530('0x38')],'sNeutral':_0x5d6333['SentimentScore'][_0xf530('0x2f')],'transcribeStatus':_0xf530('0x39')});})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});}})[_0xf530('0x3a')](function(_0x245675){if(_0x245675){if(!_0x245675[_0xf530('0x3b')]||_0x245675[_0xf530('0x3b')]!==_0xf530('0x3c')){logger[_0xf530('0x3d')](util[_0xf530('0xa')](_0xf530('0x3e'),_0x35c314['id']),util[_0xf530('0x3f')](_0x245675,{'showHidden':![],'depth':null}));}}_0x8d76da();});});}function checkTranscribe(){var _0x17acce;var _0x3060a9;var _0x73b6d9;return db[_0xf530('0x40')][_0xf530('0x41')]({'where':{'transcribeStatus':_0xf530('0x42')}})[_0xf530('0x1c')](function(_0x2d3ed9){if(!_0x2d3ed9||!_0x2d3ed9[_0xf530('0x1a')]){throw new db['Sequelize'][(_0xf530('0x24'))](_0xf530('0x43'));}_0x17acce=_0x2d3ed9;return db[_0xf530('0x44')][_0xf530('0x28')]({'where':{'id':0x1}});})[_0xf530('0x1c')](function(_0x484dca){if(!_0x484dca){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Settings\x20not\x20available');}_0x3060a9=_0x484dca;if(!_0x3060a9[_0xf530('0x4')]||!_0x3060a9[_0xf530('0x45')]||!_0x3060a9[_0xf530('0xf')]||!_0x3060a9[_0xf530('0x21')]||!_0x3060a9['bucket']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x46'));}return db[_0xf530('0x27')][_0xf530('0x28')]({'where':{'id':_0x3060a9[_0xf530('0x45')]}});})['then'](function(_0x304150){if(!_0x304150){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x35'));}if(!_0x304150['data1']||!_0x304150[_0xf530('0xe')]){throw new db['Sequelize'][(_0xf530('0x24'))](_0xf530('0x29'));}_0x73b6d9=_0x304150;var _0x3d4664=[];_0x17acce[_0xf530('0x47')](function(_0x3c83eb){_0x3d4664['push'](checkTranscribeJob(_0x3c83eb,_0x3060a9,_0x73b6d9));});return BPromise[_0xf530('0x48')](_0x3d4664);})[_0xf530('0x3a')](function(_0x261c00){if(_0x261c00){if(!_0x261c00[_0xf530('0x3b')]||_0x261c00[_0xf530('0x3b')]!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x261c00,{'showHidden':![],'depth':null}));}}});}exports[_0xf530('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1572=['Sentiment','SentimentScore','Mixed','FAILED','FailureReason','tempSentiment','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','Neutral','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','inspect','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis'];(function(_0x49cc37,_0x273002){var _0x4ffd48=function(_0x185908){while(--_0x185908){_0x49cc37['push'](_0x49cc37['shift']());}};_0x4ffd48(++_0x273002);}(_0x1572,0xf5));var _0x2157=function(_0x8f7114,_0x2e60dd){_0x8f7114=_0x8f7114-0x0;var _0x63af7f=_0x1572[_0x8f7114];return _0x63af7f;};var _=require(_0x2157('0x0'));var AWS=require(_0x2157('0x1'));var rp=require(_0x2157('0x2'));var util=require(_0x2157('0x3'));var BPromise=require(_0x2157('0x4'));var db=require(_0x2157('0x5'))['db'];var logger=require(_0x2157('0x6'))(_0x2157('0x7'));function getTranscriptionJob(_0x214311,_0x30e5c6,_0x2cb065,_0x3c3eb5){return new Promise(function(_0x2f13ab,_0x9e1c46){var _0x286be0=new AWS[(_0x2157('0x8'))]({'accessKeyId':_0x30e5c6,'secretAccessKey':_0x214311,'region':_0x2cb065});_0x286be0[_0x2157('0x9')]({'TranscriptionJobName':_0x3c3eb5},function(_0x91bf75,_0x5e9959){if(_0x91bf75){return _0x9e1c46(_0x91bf75);}else{return _0x2f13ab(_0x5e9959);}});});}function sentiment(_0x2ee42e,_0x4cd82d,_0x91d81,_0xaa87db,_0x17d4c0){return new Promise(function(_0x366643,_0x2ae8d5){var _0x3bcff9=new AWS[(_0x2157('0xa'))]({'accessKeyId':_0x4cd82d,'secretAccessKey':_0x2ee42e,'region':_0x91d81});_0x3bcff9[_0x2157('0xb')]({'Text':_0xaa87db,'LanguageCode':_0x17d4c0['substring'](0x0,0x2)},function(_0x3ff739,_0x2088ab){if(_0x3ff739){return _0x2ae8d5(_0x3ff739);}else{return _0x366643(_0x2088ab);}});});}function checkTranscribeJob(_0xd969d2,_0x1434ee,_0x5d64d3){var _0x32683b;return new BPromise(function(_0x418d29,_0xba98c0){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0xe'),_0xd969d2['id'],_0xd969d2[_0x2157('0xf')]));return getTranscriptionJob(_0x5d64d3['data1'],_0x5d64d3['data2'],_0x1434ee['transcribeRegion'],_0xd969d2[_0x2157('0xf')])[_0x2157('0x10')](function(_0x371461){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x11'),_0xd969d2['id'],_0xd969d2[_0x2157('0xf')],_0x371461[_0x2157('0x12')][_0x2157('0x13')]));if(!_0xd969d2['fileText']){switch(_0x371461[_0x2157('0x12')][_0x2157('0x13')]){case _0x2157('0x14'):var _0x5c6661={'transcribeStatus':_0x371461[_0x2157('0x12')][_0x2157('0x13')],'fileUri':_0x371461[_0x2157('0x12')][_0x2157('0x15')][_0x2157('0x16')]};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0xd969d2['id']));return rp({'uri':_0x371461[_0x2157('0x12')]['Transcript'][_0x2157('0x16')],'json':!![]})[_0x2157('0x10')](function(_0x537ada){logger['info'](util[_0x2157('0xd')](_0x2157('0x17'),_0xd969d2['id']));if(_0x537ada&&_0x537ada[_0x2157('0x18')]&&_0x537ada[_0x2157('0x18')]['transcripts']&&_0x537ada[_0x2157('0x18')][_0x2157('0x19')]['length']){_0x5c6661['fileText']='';for(var _0x138c0e=0x0;_0x138c0e<_0x537ada[_0x2157('0x18')][_0x2157('0x19')][_0x2157('0x1a')];_0x138c0e++){_0x5c6661[_0x2157('0x1b')]+=_0x537ada[_0x2157('0x18')]['transcripts'][_0x138c0e][_0x2157('0x1c')]+'';}}return _0xd969d2[_0x2157('0x1d')](_0x5c6661);})[_0x2157('0x10')](function(){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x1e'),_0xd969d2['id']));if(!_0xd969d2['tempSentiment']){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x21'));}if(!_0x1434ee[_0x2157('0x22')]||!_0x1434ee['sentimentAccountId']||!_0x1434ee[_0x2157('0x23')]||!_0x1434ee[_0x2157('0x24')]||!_0x1434ee[_0x2157('0x25')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x26'));}if(!_0x5c6661[_0x2157('0x1b')]){throw new Error(_0x2157('0x27'));}if(_0x1434ee[_0x2157('0x28')]===_0x5d64d3['id']){return _0x5d64d3;}else{return db[_0x2157('0x29')][_0x2157('0x2a')]({'where':{'id':_settings[_0x2157('0x28')]}});}})[_0x2157('0x10')](function(_0x3c887e){if(!_0x3c887e){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3c887e[_0x2157('0x2b')]||!_0x3c887e[_0x2157('0x2c')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x2d'));}_0x32683b=_0x3c887e;logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x2e'),_0xd969d2['id']));return sentiment(_0x32683b[_0x2157('0x2b')],_0x32683b['data2'],_0x1434ee['sentimentRegion'],_0x5c6661[_0x2157('0x1b')],_0x1434ee[_0x2157('0x24')]);})['then'](function(_0x6096fe){logger[_0x2157('0xc')](util[_0x2157('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd969d2['id']));return _0xd969d2[_0x2157('0x1d')]({'sentiment':_0x6096fe[_0x2157('0x2f')],'sPositive':_0x6096fe[_0x2157('0x30')]['Positive'],'sNegative':_0x6096fe[_0x2157('0x30')]['Negative'],'sMixed':_0x6096fe[_0x2157('0x30')][_0x2157('0x31')],'sNeutral':_0x6096fe[_0x2157('0x30')]['Neutral']});})[_0x2157('0x10')](function(){logger[_0x2157('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xd969d2['id']));_0x418d29();});case _0x2157('0x32'):return _0xd969d2[_0x2157('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x371461[_0x2157('0x12')][_0x2157('0x33')]})['then'](function(){logger[_0x2157('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xd969d2['id']));_0x418d29();});default:logger[_0x2157('0xc')](util[_0x2157('0xd')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0xd969d2['id']));break;}}else{return BPromise['resolve']()[_0x2157('0x10')](function(){if(!_0xd969d2[_0x2157('0x34')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x21'));}if(!_0x1434ee[_0x2157('0x22')]||!_0x1434ee[_0x2157('0x28')]||!_0x1434ee['sentimentRegion']||!_0x1434ee[_0x2157('0x24')]||!_0x1434ee[_0x2157('0x25')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x26'));}if(!_0xd969d2[_0x2157('0x1b')]){throw new Error('Transcript\x20not\x20available');}if(_0x1434ee['sentimentAccountId']===_0x5d64d3['id']){return _0x5d64d3;}else{return db['CloudProvider'][_0x2157('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2157('0x10')](function(_0x10cfc3){if(!_0x10cfc3){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x10cfc3[_0x2157('0x2b')]||!_0x10cfc3[_0x2157('0x2c')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x2d'));}_0x32683b=_0x10cfc3;logger[_0x2157('0xc')](util[_0x2157('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xd969d2['id']));return sentiment(_0x32683b[_0x2157('0x2b')],_0x32683b[_0x2157('0x2c')],_0x1434ee['sentimentRegion'],_0xd969d2[_0x2157('0x1b')],_0x1434ee[_0x2157('0x24')]);})[_0x2157('0x10')](function(_0x5289e0){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x35'),_0xd969d2['id']));return _0xd969d2[_0x2157('0x1d')]({'sentiment':_0x5289e0[_0x2157('0x2f')],'sPositive':_0x5289e0['SentimentScore'][_0x2157('0x36')],'sNegative':_0x5289e0['SentimentScore'][_0x2157('0x37')],'sMixed':_0x5289e0[_0x2157('0x30')][_0x2157('0x31')],'sNeutral':_0x5289e0[_0x2157('0x30')][_0x2157('0x38')],'transcribeStatus':_0x2157('0x14')});})['then'](function(){logger[_0x2157('0xc')](util[_0x2157('0xd')](_0x2157('0x1e'),_0xd969d2['id']));_0x418d29();});}})[_0x2157('0x39')](function(_0x5e04ca){if(_0x5e04ca){if(!_0x5e04ca[_0x2157('0x3a')]||_0x5e04ca[_0x2157('0x3a')]!=='SequelizeValidationError'){logger[_0x2157('0x3b')](util[_0x2157('0xd')](_0x2157('0x3c'),_0xd969d2['id']),util['inspect'](_0x5e04ca,{'showHidden':![],'depth':null}));}}_0x418d29();});});}function checkTranscribe(){var _0x2d0963;var _0x545b46;var _0xb6b619;return db[_0x2157('0x3d')]['findAll']({'where':{'transcribeStatus':_0x2157('0x3e')}})[_0x2157('0x10')](function(_0x1f18f1){if(!_0x1f18f1||!_0x1f18f1[_0x2157('0x1a')]){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x3f'));}_0x2d0963=_0x1f18f1;return db[_0x2157('0x40')][_0x2157('0x2a')]({'where':{'id':0x1}});})['then'](function(_0x3c7cbf){if(!_0x3c7cbf){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))](_0x2157('0x41'));}_0x545b46=_0x3c7cbf;if(!_0x545b46[_0x2157('0x7')]||!_0x545b46['transcribeAccountId']||!_0x545b46[_0x2157('0x42')]||!_0x545b46['language']||!_0x545b46['bucket']){throw new db[(_0x2157('0x1f'))]['ValidationError'](_0x2157('0x43'));}return db[_0x2157('0x29')][_0x2157('0x2a')]({'where':{'id':_0x545b46['transcribeAccountId']}});})[_0x2157('0x10')](function(_0x2aba0a){if(!_0x2aba0a){throw new db[(_0x2157('0x1f'))][(_0x2157('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2aba0a[_0x2157('0x2b')]||!_0x2aba0a[_0x2157('0x2c')]){throw new db['Sequelize'][(_0x2157('0x20'))](_0x2157('0x2d'));}_0xb6b619=_0x2aba0a;var _0x44ee05=[];_0x2d0963[_0x2157('0x44')](function(_0x1dc792){_0x44ee05[_0x2157('0x45')](checkTranscribeJob(_0x1dc792,_0x545b46,_0xb6b619));});return BPromise[_0x2157('0x46')](_0x44ee05);})[_0x2157('0x39')](function(_0x4aca70){if(_0x4aca70){if(!_0x4aca70[_0x2157('0x3a')]||_0x4aca70[_0x2157('0x3a')]!==_0x2157('0x47')){logger[_0x2157('0x3b')](util[_0x2157('0x48')](_0x4aca70,{'showHidden':![],'depth':null}));}}});}exports['start']=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 20b13f2..ecb0169 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 _0xb77c=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','redis','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system'];(function(_0x2c4f47,_0x152a73){var _0x2387ea=function(_0x3801e4){while(--_0x3801e4){_0x2c4f47['push'](_0x2c4f47['shift']());}};_0x2387ea(++_0x152a73);}(_0xb77c,0x89));var _0xcb77=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xb77c[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xcb77('0x0'));var moment=require(_0xcb77('0x1'));var Redis=require(_0xcb77('0x2'));var util=require('util');var config=require(_0xcb77('0x3'));var db=require(_0xcb77('0x4'))['db'];var logger=require(_0xcb77('0x5'))('schedule');config[_0xcb77('0x6')]=_['defaults'](config[_0xcb77('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb77('0x6')]));function closeInteractions(){var _0x5898b4=[];return db[_0xcb77('0x7')][_0xcb77('0x8')]({'raw':!![],'attributes':['id',_0xcb77('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xcb77('0xa'))}}})[_0xcb77('0xb')](function(_0x138aa1){if(_0x138aa1&&_0x138aa1[_0xcb77('0xc')]){_0x5898b4=_[_0xcb77('0xd')](_0x138aa1||[],'id');logger[_0xcb77('0xe')](_0xcb77('0xf'),_0x5898b4[_0xcb77('0x10')]());return db[_0xcb77('0x7')][_0xcb77('0x11')]({'closeReason':_0xcb77('0x12'),'disposition':_0xcb77('0x13'),'closed':!![],'closedAt':moment()[_0xcb77('0x14')](_0xcb77('0x15'))},{'where':{'id':_0x5898b4}});}})[_0xcb77('0xb')](function(){if(_0x5898b4&&_0x5898b4[_0xcb77('0xc')]){logger[_0xcb77('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x5898b4[_0xcb77('0x10')]());for(var _0x23f260=0x0;_0x23f260<_0x5898b4[_0xcb77('0xc')];_0x23f260++){io[_0xcb77('0x16')]('whatsappInteraction:update',{'id':_0x5898b4[_0x23f260],'closed':!![]});}}})['catch'](function(_0x966cee){logger[_0xcb77('0x17')](_0xcb77('0x18'),_0x966cee?util['inspect'](_0x966cee,{'showHidden':![],'depth':null}):'');});}exports[_0xcb77('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa544=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0xa544,0x97));var _0x4a54=function(_0x18a962,_0x2fa79b){_0x18a962=_0x18a962-0x0;var _0x32faec=_0xa544[_0x18a962];return _0x32faec;};'use strict';var _=require('lodash');var moment=require(_0x4a54('0x0'));var Redis=require(_0x4a54('0x1'));var util=require('util');var config=require(_0x4a54('0x2'));var db=require(_0x4a54('0x3'))['db'];var logger=require(_0x4a54('0x4'))('schedule');config[_0x4a54('0x5')]=_[_0x4a54('0x6')](config['redis'],{'host':_0x4a54('0x7'),'port':0x18eb});var io=require(_0x4a54('0x8'))(new Redis(config[_0x4a54('0x5')]));function closeInteractions(){var _0x5304d8=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x4a54('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4a54('0xa')](0x18,_0x4a54('0xb'))}}})['then'](function(_0x5f0b14){if(_0x5f0b14&&_0x5f0b14[_0x4a54('0xc')]){_0x5304d8=_[_0x4a54('0xd')](_0x5f0b14||[],'id');logger[_0x4a54('0xe')](_0x4a54('0xf'),_0x5304d8[_0x4a54('0x10')]());return db['WhatsappInteraction'][_0x4a54('0x11')]({'closeReason':_0x4a54('0x12'),'disposition':_0x4a54('0x13'),'closed':!![],'closedAt':moment()[_0x4a54('0x14')](_0x4a54('0x15'))},{'where':{'id':_0x5304d8}});}})['then'](function(){if(_0x5304d8&&_0x5304d8[_0x4a54('0xc')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x5304d8[_0x4a54('0x10')]());for(var _0x61d8fa=0x0;_0x61d8fa<_0x5304d8[_0x4a54('0xc')];_0x61d8fa++){io[_0x4a54('0x16')](_0x4a54('0x17'),{'id':_0x5304d8[_0x61d8fa],'closed':!![]});}}})[_0x4a54('0x18')](function(_0x286d1f){logger[_0x4a54('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x286d1f?util[_0x4a54('0x1a')](_0x286d1f,{'showHidden':![],'depth':null}):'');});}exports[_0x4a54('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 08ed806..401082c 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b37=['CmHopper','finished\x20populating','catch','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','bulkCreate','then','log','contacts1'];(function(_0x4b5815,_0x44fb95){var _0x58634a=function(_0x5565ce){while(--_0x5565ce){_0x4b5815['push'](_0x4b5815['shift']());}};_0x58634a(++_0x44fb95);}(_0x2b37,0x113));var _0x72b3=function(_0x725448,_0xb186bc){_0x725448=_0x725448-0x0;var _0x391e6e=_0x2b37[_0x725448];return _0x391e6e;};'use strict';var util=require(_0x72b3('0x0'));var db=require(_0x72b3('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x72b3('0x2')]({'id':i,'firstName':_0x72b3('0x3')+i,'lastName':_0x72b3('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x72b3('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x72b3('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x72b3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x72b3('0x6')](),'updatedAt':Date[_0x72b3('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x72b3('0x2')]({'id':i,'firstName':_0x72b3('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x72b3('0x7')+i+_0x72b3('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x72b3('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x72b3('0x6')](),'updatedAt':Date[_0x72b3('0x6')]()});}db[_0x72b3('0x8')][_0x72b3('0x9')]({'where':{}})['then'](function(){return db[_0x72b3('0x8')][_0x72b3('0xa')](contacts);})[_0x72b3('0xb')](function(){console[_0x72b3('0xc')]('finished\x20populating',_0x72b3('0xd'));return db[_0x72b3('0xe')][_0x72b3('0x9')]({'where':{}});})[_0x72b3('0xb')](function(){return db[_0x72b3('0xe')][_0x72b3('0xa')](hopper);})[_0x72b3('0xb')](function(){console[_0x72b3('0xc')](_0x72b3('0xf'),'hopper1');return db[_0x72b3('0x8')]['bulkCreate'](contacts2);})[_0x72b3('0xb')](function(){console['log'](_0x72b3('0xf'),'contacts2');return db[_0x72b3('0xe')][_0x72b3('0xa')](hopper2);})['then'](function(){console[_0x72b3('0xc')]('finished\x20populating','hopper2');})[_0x72b3('0x10')](function(_0x5e1e8){console[_0x72b3('0xc')](_0x5e1e8);}); \ No newline at end of file +var _0x9ad5=['now','push','Innocenzo','Biondo','CmContact','destroy','bulkCreate','then','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','innocenzo.biondo','@xcally.com'];(function(_0x2af29a,_0x4f44bc){var _0x5ef02f=function(_0x4349ef){while(--_0x4349ef){_0x2af29a['push'](_0x2af29a['shift']());}};_0x5ef02f(++_0x4f44bc);}(_0x9ad5,0x1b1));var _0x59ad=function(_0x57dd01,_0x291d5f){_0x57dd01=_0x57dd01-0x0;var _0x706d85=_0x9ad5[_0x57dd01];return _0x706d85;};'use strict';var util=require(_0x59ad('0x0'));var db=require(_0x59ad('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x59ad('0x2')+i+_0x59ad('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x59ad('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x59ad('0x5')]({'id':i,'firstName':_0x59ad('0x6')+i,'lastName':_0x59ad('0x7')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x59ad('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x59ad('0x4')](),'updatedAt':Date[_0x59ad('0x4')]()});}db[_0x59ad('0x8')][_0x59ad('0x9')]({'where':{}})['then'](function(){return db['CmContact'][_0x59ad('0xa')](contacts);})[_0x59ad('0xb')](function(){console[_0x59ad('0xc')](_0x59ad('0xd'),'contacts1');return db[_0x59ad('0xe')][_0x59ad('0x9')]({'where':{}});})[_0x59ad('0xb')](function(){return db[_0x59ad('0xe')][_0x59ad('0xa')](hopper);})[_0x59ad('0xb')](function(){console[_0x59ad('0xc')](_0x59ad('0xd'),_0x59ad('0xf'));return db[_0x59ad('0x8')][_0x59ad('0xa')](contacts2);})[_0x59ad('0xb')](function(){console[_0x59ad('0xc')](_0x59ad('0xd'),_0x59ad('0x10'));return db[_0x59ad('0xe')][_0x59ad('0xa')](hopper2);})[_0x59ad('0xb')](function(){console[_0x59ad('0xc')](_0x59ad('0xd'),_0x59ad('0x11'));})[_0x59ad('0x12')](function(_0x634e38){console[_0x59ad('0xc')](_0x634e38);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 220bd84..5077c0c 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cc1=['/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','util','push','%s%s','format','agent','%s%s@xcally.com','udp','all','ulaw','yes'];(function(_0x350923,_0x2c450d){var _0x2012ca=function(_0x1ff088){while(--_0x1ff088){_0x350923['push'](_0x350923['shift']());}};_0x2012ca(++_0x2c450d);}(_0x6cc1,0x17c));var _0x16cc=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x6cc1[_0x35a140];return _0x30ab82;};'use strict';var util=require(_0x16cc('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x16cc('0x1')]({'name':util['format'](_0x16cc('0x2'),'agent',i),'fullname':util[_0x16cc('0x3')]('%s%s',_0x16cc('0x4'),i),'email':util[_0x16cc('0x3')](_0x16cc('0x5'),_0x16cc('0x4'),i),'role':_0x16cc('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x16cc('0x6'),'ws','wss'],'disallow':[_0x16cc('0x7')],'allow':[_0x16cc('0x8')],'defaultuser':util[_0x16cc('0x3')](_0x16cc('0x2'),_0x16cc('0x4'),i),'encryption':_0x16cc('0x9'),'avpf':_0x16cc('0x9'),'force_avp':_0x16cc('0x9'),'icesupport':_0x16cc('0x9'),'dtlsenable':_0x16cc('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x16cc('0xa'),'dtlssetup':'actpass','callerid':util['format'](_0x16cc('0xb'),util['format'](_0x16cc('0x2'),_0x16cc('0x4'),i),0xfa0+i)});}db['User'][_0x16cc('0xc')](users)['then'](function(){console[_0x16cc('0xd')](_0x16cc('0xe'));})['catch'](function(_0x2df30a){console[_0x16cc('0xd')](_0x2df30a);}); \ No newline at end of file +var _0x526f=['../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','udp','wss','all','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','catch'];(function(_0x593b33,_0x1ea034){var _0x2f17a2=function(_0x2dbb16){while(--_0x2dbb16){_0x593b33['push'](_0x593b33['shift']());}};_0x2f17a2(++_0x1ea034);}(_0x526f,0x1a0));var _0xf526=function(_0x2c8433,_0x4a0b1e){_0x2c8433=_0x2c8433-0x0;var _0xc8dae5=_0x526f[_0x2c8433];return _0xc8dae5;};'use strict';var util=require('util');var db=require(_0xf526('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf526('0x1')]({'name':util[_0xf526('0x2')](_0xf526('0x3'),'agent',i),'fullname':util[_0xf526('0x2')](_0xf526('0x3'),_0xf526('0x4'),i),'email':util[_0xf526('0x2')](_0xf526('0x5'),_0xf526('0x4'),i),'role':_0xf526('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xf526('0x6'),'ws',_0xf526('0x7')],'disallow':[_0xf526('0x8')],'allow':['ulaw'],'defaultuser':util[_0xf526('0x2')](_0xf526('0x3'),_0xf526('0x4'),i),'encryption':_0xf526('0x9'),'avpf':_0xf526('0x9'),'force_avp':_0xf526('0x9'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf526('0xa'),'dtlssetup':'actpass','callerid':util[_0xf526('0x2')](_0xf526('0xb'),util['format'](_0xf526('0x3'),_0xf526('0x4'),i),0xfa0+i)});}db['User'][_0xf526('0xc')](users)[_0xf526('0xd')](function(){console[_0xf526('0xe')]('add\x20user');})[_0xf526('0xf')](function(_0x3bfa8e){console[_0xf526('0xe')](_0x3bfa8e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4000f69..a2cceef 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26c2=['util','bluebird','../mysqldb','./environment','Agents','name','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','map','User','where','Campaign','type','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','user','ChatQueues','WhatsappQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','openchannel','whatsapp','telephone:%s','trunk:%s','leave','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','log','SocketIO\x20','nsp','disconnect','DISCONNECTED'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x26c2,0x1d6));var _0x226c=function(_0x4f7cd2,_0x3b01b0){_0x4f7cd2=_0x4f7cd2-0x0;var _0x3af5a0=_0x26c2[_0x4f7cd2];return _0x3af5a0;};'use strict';var _=require('lodash');var util=require(_0x226c('0x0'));var BPromise=require(_0x226c('0x1'));var db=require(_0x226c('0x2'))['db'];var config=require(_0x226c('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x226c('0x4'),'model':db['User'],'attributes':['id',_0x226c('0x5'),_0x226c('0x6')],'raw':!![],'where':{'role':_0x226c('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x226c('0x5')],'where':{'role':_0x226c('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x226c('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x226c('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x226c('0x9')}};function getAssociatedResources(_0x1677ee,_0x5a8a66,_0x475e09){return db[_0x226c('0xa')][_0x226c('0xb')]({'where':{'name':_0x1677ee,'userProfileId':_0x5a8a66},'raw':!![]})[_0x226c('0xc')](function(_0x1ae421){if(_0x1ae421){if(_0x1ae421[_0x226c('0xd')]){switch(_0x1677ee){case _0x226c('0xe'):case'ChatQueues':case'FaxQueues':case _0x226c('0xf'):case _0x226c('0x10'):case _0x226c('0x11'):case _0x226c('0x12'):return db[_0x475e09]['findAll'](queryQueues);case'Telephones':return db[_0x475e09][_0x226c('0x13')](queryTelephones);case _0x226c('0x14'):return db[_0x475e09][_0x226c('0x13')](queryTrunks);case _0x226c('0x15'):return db[_0x475e09][_0x226c('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0x226c('0x13')]({'attributes':[_0x226c('0x16')],'where':{'sectionId':_0x1ae421['id']},'raw':!![]})[_0x226c('0xc')](function(_0x4b542b){if(_0x4b542b){var _0x19d62d={'where':{'id':_[_0x226c('0x17')](_0x4b542b,_0x226c('0x16'))},'raw':!![]};switch(_0x475e09){case _0x226c('0x18'):_0x19d62d[_0x226c('0x19')][_0x226c('0x6')]=_0x226c('0x8');break;case _0x226c('0x1a'):_0x19d62d[_0x226c('0x19')][_0x226c('0x1b')]=_0x226c('0x9');break;}return db[_0x475e09][_0x226c('0x13')](_0x19d62d);}else{return[];}});}}else{return[];}})[_0x226c('0xc')](function(_0x53c323){return _0x53c323;});}function joinOrLeaveQueues(_0x34242a,_0x1d3ee8,_0x1abe31,_0x49f43d){_0x34242a[_0x1d3ee8](util[_0x226c('0x1c')](_0x226c('0x1d'),_0x1abe31,_0x49f43d['name']));if(_0x49f43d[_0x226c('0x4')]){for(var _0x29c441=0x0;_0x29c441<_0x49f43d[_0x226c('0x4')][_0x226c('0x1e')];_0x29c441+=0x1){_0x34242a[_0x1d3ee8](util[_0x226c('0x1c')](_0x226c('0x1f'),_0x49f43d['Agents'][_0x29c441][_0x226c('0x5')]));}}}function joinOrLeave(_0x3df28f,_0x17ab5f,_0x3f2643){var _0x392717;if(_0x3df28f[_0x226c('0x20')]['query']['id']){db[_0x226c('0x18')][_0x226c('0x21')]({'attributes':['id',_0x226c('0x5'),'role',_0x226c('0x22')],'where':{'id':_0x3df28f['handshake'][_0x226c('0x23')]['id']},'include':[{'model':db[_0x226c('0x24')],'as':_0x226c('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x226c('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x226c('0x27')],'as':_0x226c('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x226c('0x29'),'attributes':['id'],'raw':!![]}]})[_0x226c('0xc')](function(_0x1bec1a){if(_0x1bec1a){_0x392717=_0x1bec1a;_0x3df28f[_0x17ab5f](util[_0x226c('0x1c')](_0x226c('0x1f'),_0x1bec1a['name']));var _0x2c861c=[];switch(_0x1bec1a[_0x226c('0x6')]){case'admin':_0x3df28f[_0x17ab5f](_0x226c('0x2a'));_0x3df28f[_0x17ab5f](_0x226c('0x2b'));if(queryQueues[_0x226c('0x2c')]('include')){delete queryQueues[_0x226c('0x2d')];}_0x2c861c[_0x226c('0x2e')](db[_0x226c('0x2f')][_0x226c('0x13')](queryQueues));_0x2c861c[_0x226c('0x2e')](db[_0x226c('0x30')][_0x226c('0x13')](queryQueues));_0x2c861c['push'](db[_0x226c('0x31')][_0x226c('0x13')](queryQueues));_0x2c861c[_0x226c('0x2e')](db['SmsQueue'][_0x226c('0x13')](queryQueues));_0x2c861c[_0x226c('0x2e')](db[_0x226c('0x32')][_0x226c('0x13')](queryQueues));_0x2c861c[_0x226c('0x2e')](db[_0x226c('0x33')][_0x226c('0x13')](queryQueues));_0x2c861c[_0x226c('0x2e')](db['WhatsappQueue'][_0x226c('0x13')](queryQueues));_0x2c861c[_0x226c('0x2e')](db[_0x226c('0x18')][_0x226c('0x13')](queryTelephones));_0x2c861c[_0x226c('0x2e')](db['Trunk']['findAll'](queryTrunks));_0x2c861c[_0x226c('0x2e')](db[_0x226c('0x1a')][_0x226c('0x13')](queryCampaigns));_0x2c861c['push'](db['User'][_0x226c('0x13')](queryAgents));break;case _0x226c('0x34'):_0x3df28f[_0x17ab5f](_0x226c('0x2a'));_0x3df28f[_0x17ab5f]('voice:outbound');_0x2c861c[_0x226c('0x2e')](getAssociatedResources('VoiceQueues',_0x1bec1a[_0x226c('0x22')],'VoiceQueue'));_0x2c861c[_0x226c('0x2e')](getAssociatedResources(_0x226c('0x35'),_0x1bec1a[_0x226c('0x22')],'ChatQueue'));_0x2c861c[_0x226c('0x2e')](getAssociatedResources('FaxQueues',_0x1bec1a[_0x226c('0x22')],_0x226c('0x31')));_0x2c861c[_0x226c('0x2e')](getAssociatedResources('SmsQueues',_0x1bec1a[_0x226c('0x22')],'SmsQueue'));_0x2c861c[_0x226c('0x2e')](getAssociatedResources(_0x226c('0x10'),_0x1bec1a[_0x226c('0x22')],_0x226c('0x32')));_0x2c861c[_0x226c('0x2e')](getAssociatedResources('OpenchannelQueues',_0x1bec1a[_0x226c('0x22')],'OpenchannelQueue'));_0x2c861c[_0x226c('0x2e')](getAssociatedResources(_0x226c('0x12'),_0x1bec1a[_0x226c('0x22')],_0x226c('0x36')));_0x2c861c['push'](getAssociatedResources('Telephones',_0x1bec1a['userProfileId'],_0x226c('0x18')));_0x2c861c['push'](getAssociatedResources('Trunks',_0x1bec1a[_0x226c('0x22')],_0x226c('0x37')));_0x2c861c[_0x226c('0x2e')](getAssociatedResources(_0x226c('0x15'),_0x1bec1a[_0x226c('0x22')],_0x226c('0x1a')));_0x2c861c[_0x226c('0x2e')](db['User'][_0x226c('0x13')](queryAgents));break;case _0x226c('0x7'):_0x3df28f[_0x17ab5f](_0x226c('0x2a'));_0x3df28f[_0x17ab5f]('voice:outbound');_0x2c861c[_0x226c('0x2e')](_0x1bec1a[_0x226c('0x38')]({'attributes':['id',_0x226c('0x5')]}));_0x2c861c[_0x226c('0x2e')](_0x1bec1a[_0x226c('0x39')]({'attributes':['id',_0x226c('0x5')]}));_0x2c861c['push'](_0x1bec1a[_0x226c('0x3a')]({'attributes':['id',_0x226c('0x5')]}));_0x2c861c[_0x226c('0x2e')](_0x1bec1a[_0x226c('0x3b')]({'attributes':['id',_0x226c('0x5')]}));_0x2c861c[_0x226c('0x2e')](_0x1bec1a[_0x226c('0x3c')]({'attributes':['id','name']}));_0x2c861c['push'](_0x1bec1a[_0x226c('0x3d')]({'attributes':['id',_0x226c('0x5')]}));_0x2c861c[_0x226c('0x2e')](_0x1bec1a['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x226c('0x3e')](_0x2c861c);}})[_0x226c('0xc')](function(_0x452ce8){if(_0x452ce8&&_0x452ce8[_0x226c('0x1e')]){for(var _0x343637=0x0;_0x343637<_0x452ce8[_0x226c('0x1e')];_0x343637+=0x1){for(var _0x25736e=0x0;_0x25736e<_0x452ce8[_0x343637][_0x226c('0x1e')];_0x25736e+=0x1){switch(_0x343637){case 0x0:joinOrLeaveQueues(_0x3df28f,_0x17ab5f,_0x226c('0x3f'),_0x452ce8[_0x343637][_0x25736e]);break;case 0x1:joinOrLeaveQueues(_0x3df28f,_0x17ab5f,_0x226c('0x40'),_0x452ce8[_0x343637][_0x25736e]);break;case 0x2:joinOrLeaveQueues(_0x3df28f,_0x17ab5f,_0x226c('0x41'),_0x452ce8[_0x343637][_0x25736e]);break;case 0x3:joinOrLeaveQueues(_0x3df28f,_0x17ab5f,'sms',_0x452ce8[_0x343637][_0x25736e]);break;case 0x4:joinOrLeaveQueues(_0x3df28f,_0x17ab5f,'mail',_0x452ce8[_0x343637][_0x25736e]);break;case 0x5:joinOrLeaveQueues(_0x3df28f,_0x17ab5f,_0x226c('0x42'),_0x452ce8[_0x343637][_0x25736e]);break;case 0x6:joinOrLeaveQueues(_0x3df28f,_0x17ab5f,_0x226c('0x43'),_0x452ce8[_0x343637][_0x25736e]);break;case 0x7:if(_0x392717[_0x226c('0x6')]!==_0x226c('0x7'))_0x3df28f[_0x17ab5f](util[_0x226c('0x1c')](_0x226c('0x44'),_0x452ce8[_0x343637][_0x25736e][_0x226c('0x5')]));break;case 0x8:if(_0x392717[_0x226c('0x6')]!==_0x226c('0x7'))_0x3df28f[_0x17ab5f](util[_0x226c('0x1c')](_0x226c('0x45'),_0x452ce8[_0x343637][_0x25736e][_0x226c('0x5')]));break;case 0x9:if(_0x392717[_0x226c('0x6')]!==_0x226c('0x7'))_0x3df28f[_0x17ab5f](util[_0x226c('0x1c')]('campaign:%s:%s',_0x452ce8[_0x343637][_0x25736e]['type'],_0x452ce8[_0x343637][_0x25736e][_0x226c('0x5')]));break;case 0xa:_0x3df28f[_0x17ab5f](util[_0x226c('0x1c')]('user:%s',_0x452ce8[_0x343637][_0x25736e][_0x226c('0x5')]));break;}}}}})[_0x226c('0xc')](function(){if(_0x17ab5f===_0x226c('0x46')){var _0x5ac059=_['map'](_0x392717[_0x226c('0x25')],'id');return _0x392717['removeChatInteractions'](_0x5ac059)[_0x226c('0xc')](function(){for(var _0x3adfba=0x0;_0x3adfba<_0x5ac059['length'];_0x3adfba+=0x1){_0x3f2643[_0x226c('0x47')](_0x226c('0x48'),{'ChatInteractionId':Number(_0x5ac059[_0x3adfba]),'UserId':Number(_0x392717['id'])});}});}})['then'](function(){if(_0x17ab5f===_0x226c('0x46')){var _0x416f8f=_[_0x226c('0x17')](_0x392717['MailInteractions'],'id');return _0x392717['removeMailInteractions'](_0x416f8f)[_0x226c('0xc')](function(){for(var _0x3feeff=0x0;_0x3feeff<_0x416f8f['length'];_0x3feeff+=0x1){_0x3f2643['emit'](_0x226c('0x49'),{'MailInteractionId':Number(_0x416f8f[_0x3feeff]),'UserId':Number(_0x392717['id'])});}});}})[_0x226c('0xc')](function(){if(_0x17ab5f==='leave'){var _0x1f8603=_[_0x226c('0x17')](_0x392717['FaxInteractions'],'id');return _0x392717[_0x226c('0x4a')](_0x1f8603)[_0x226c('0xc')](function(){for(var _0x4d93e3=0x0;_0x4d93e3<_0x1f8603[_0x226c('0x1e')];_0x4d93e3+=0x1){_0x3f2643[_0x226c('0x47')](_0x226c('0x4b'),{'FaxInteractionId':Number(_0x1f8603[_0x4d93e3]),'UserId':Number(_0x392717['id'])});}});}})[_0x226c('0xc')](function(){if(_0x17ab5f===_0x226c('0x46')){var _0x471b46=_[_0x226c('0x17')](_0x392717[_0x226c('0x4c')],'id');return _0x392717[_0x226c('0x4d')](_0x471b46)[_0x226c('0xc')](function(){for(var _0x462883=0x0;_0x462883<_0x471b46[_0x226c('0x1e')];_0x462883+=0x1){_0x3f2643[_0x226c('0x47')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x471b46[_0x462883]),'UserId':Number(_0x392717['id'])});}});}})[_0x226c('0xc')](function(){if(_0x17ab5f===_0x226c('0x46')){var _0x338b64=_['map'](_0x392717[_0x226c('0x28')],'id');return _0x392717[_0x226c('0x4e')](_0x338b64)['then'](function(){for(var _0x177128=0x0;_0x177128<_0x338b64[_0x226c('0x1e')];_0x177128+=0x1){_0x3f2643[_0x226c('0x47')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x338b64[_0x177128]),'UserId':Number(_0x392717['id'])});}});}})[_0x226c('0xc')](function(){if(_0x17ab5f==='leave'){var _0x52c46d=_['map'](_0x392717[_0x226c('0x29')],'id');return _0x392717[_0x226c('0x4f')](_0x52c46d)['then'](function(){for(var _0x27ec6=0x0;_0x27ec6<_0x52c46d[_0x226c('0x1e')];_0x27ec6+=0x1){_0x3f2643[_0x226c('0x47')](_0x226c('0x50'),{'WhatsappInteractionId':Number(_0x52c46d[_0x27ec6]),'UserId':Number(_0x392717['id'])});}});}})[_0x226c('0x51')](function(_0x9c1231){_0x3df28f['log'](_0x9c1231);});}}function onDisconnect(_0x335860,_0x41a803){joinOrLeave(_0x335860,_0x226c('0x46'),_0x41a803);}function onConnect(_0x332d0c){joinOrLeave(_0x332d0c,'join');}exports[_0x226c('0x52')]=function(_0xe75fee){_0xe75fee['on'](_0x226c('0x53'),function(_0x553f60){_0x553f60[_0x226c('0x54')](0x0);_0x553f60[_0x226c('0x55')]=_0x553f60[_0x226c('0x56')][_0x226c('0x53')][_0x226c('0x57')]+':'+_0x553f60[_0x226c('0x56')]['connection'][_0x226c('0x58')];_0x553f60['connectedAt']=new Date();_0x553f60[_0x226c('0x59')]=function(_0x326174){console['log'](_0x226c('0x5a')+_0x553f60[_0x226c('0x5b')]['name']+'['+_0x553f60['address']+']',_0x326174);};_0x553f60['on'](_0x226c('0x5c'),function(){onDisconnect(_0x553f60,_0xe75fee);_0x553f60[_0x226c('0x59')](_0x226c('0x5d'));});onConnect(_0x553f60);_0x553f60[_0x226c('0x59')]('CONNECTED');});}; \ No newline at end of file +var _0xe1c4=['address','DISCONNECTED','lodash','util','bluebird','name','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','VoiceQueue','push','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','userProfileId','ChatQueues','FaxQueue','WhatsappQueues','IvrCampaigns','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp'];(function(_0x79b53e,_0x108f8d){var _0x2d4d6c=function(_0x256d7f){while(--_0x256d7f){_0x79b53e['push'](_0x79b53e['shift']());}};_0x2d4d6c(++_0x108f8d);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x569c95,_0x54f839){_0x569c95=_0x569c95-0x0;var _0x2749b5=_0xe1c4[_0x569c95];return _0x2749b5;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var BPromise=require(_0x4e1c('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x4e1c('0x3')],'include':[{'as':'Agents','model':db[_0x4e1c('0x4')],'attributes':['id',_0x4e1c('0x3'),_0x4e1c('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x4e1c('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4e1c('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x4e1c('0x3')],'where':{'role':_0x4e1c('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4e1c('0x3'),_0x4e1c('0x8')],'where':{'type':_0x4e1c('0x9')}};function getAssociatedResources(_0x443447,_0x16c9d8,_0x60e98c){return db[_0x4e1c('0xa')][_0x4e1c('0xb')]({'where':{'name':_0x443447,'userProfileId':_0x16c9d8},'raw':!![]})[_0x4e1c('0xc')](function(_0x4fc396){if(_0x4fc396){if(_0x4fc396[_0x4e1c('0xd')]){switch(_0x443447){case _0x4e1c('0xe'):case'ChatQueues':case _0x4e1c('0xf'):case _0x4e1c('0x10'):case _0x4e1c('0x11'):case _0x4e1c('0x12'):case'WhatsappQueues':return db[_0x60e98c][_0x4e1c('0x13')](queryQueues);case _0x4e1c('0x14'):return db[_0x60e98c][_0x4e1c('0x13')](queryTelephones);case _0x4e1c('0x15'):return db[_0x60e98c]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x60e98c]['findAll'](queryCampaigns);}}else{return db[_0x4e1c('0x16')][_0x4e1c('0x13')]({'attributes':[_0x4e1c('0x17')],'where':{'sectionId':_0x4fc396['id']},'raw':!![]})[_0x4e1c('0xc')](function(_0x4d47ec){if(_0x4d47ec){var _0x2cd5bc={'where':{'id':_[_0x4e1c('0x18')](_0x4d47ec,_0x4e1c('0x17'))},'raw':!![]};switch(_0x60e98c){case _0x4e1c('0x4'):_0x2cd5bc[_0x4e1c('0x19')][_0x4e1c('0x5')]='telephone';break;case _0x4e1c('0x1a'):_0x2cd5bc[_0x4e1c('0x19')][_0x4e1c('0x8')]=_0x4e1c('0x9');break;}return db[_0x60e98c][_0x4e1c('0x13')](_0x2cd5bc);}else{return[];}});}}else{return[];}})[_0x4e1c('0xc')](function(_0x13d348){return _0x13d348;});}function joinOrLeaveQueues(_0x544b08,_0x2dbfe9,_0x426864,_0x391ade){_0x544b08[_0x2dbfe9](util[_0x4e1c('0x1b')](_0x4e1c('0x1c'),_0x426864,_0x391ade[_0x4e1c('0x3')]));if(_0x391ade[_0x4e1c('0x1d')]){for(var _0x53a020=0x0;_0x53a020<_0x391ade[_0x4e1c('0x1d')][_0x4e1c('0x1e')];_0x53a020+=0x1){_0x544b08[_0x2dbfe9](util[_0x4e1c('0x1b')](_0x4e1c('0x1f'),_0x391ade[_0x4e1c('0x1d')][_0x53a020][_0x4e1c('0x3')]));}}}function joinOrLeave(_0x98868b,_0x19ed77,_0x45c13e){var _0x5ada14;if(_0x98868b[_0x4e1c('0x20')][_0x4e1c('0x21')]['id']){db[_0x4e1c('0x4')]['find']({'attributes':['id','name',_0x4e1c('0x5'),'userProfileId'],'where':{'id':_0x98868b[_0x4e1c('0x20')][_0x4e1c('0x21')]['id']},'include':[{'model':db[_0x4e1c('0x22')],'as':_0x4e1c('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x4e1c('0x24')],'as':_0x4e1c('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x4e1c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x4e1c('0x27')],'as':_0x4e1c('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x4e1c('0x29')],'as':_0x4e1c('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x4e1c('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x4e1c('0xc')](function(_0x1b5ba8){if(_0x1b5ba8){_0x5ada14=_0x1b5ba8;_0x98868b[_0x19ed77](util[_0x4e1c('0x1b')]('user:%s',_0x1b5ba8[_0x4e1c('0x3')]));var _0x15fdb4=[];switch(_0x1b5ba8['role']){case _0x4e1c('0x2c'):_0x98868b[_0x19ed77]('voice:inbound');_0x98868b[_0x19ed77](_0x4e1c('0x2d'));if(queryQueues[_0x4e1c('0x2e')](_0x4e1c('0x2f'))){delete queryQueues[_0x4e1c('0x2f')];}_0x15fdb4['push'](db[_0x4e1c('0x30')]['findAll'](queryQueues));_0x15fdb4[_0x4e1c('0x31')](db['ChatQueue'][_0x4e1c('0x13')](queryQueues));_0x15fdb4[_0x4e1c('0x31')](db['FaxQueue'][_0x4e1c('0x13')](queryQueues));_0x15fdb4['push'](db[_0x4e1c('0x32')][_0x4e1c('0x13')](queryQueues));_0x15fdb4[_0x4e1c('0x31')](db[_0x4e1c('0x33')][_0x4e1c('0x13')](queryQueues));_0x15fdb4[_0x4e1c('0x31')](db[_0x4e1c('0x34')][_0x4e1c('0x13')](queryQueues));_0x15fdb4[_0x4e1c('0x31')](db[_0x4e1c('0x35')]['findAll'](queryQueues));_0x15fdb4[_0x4e1c('0x31')](db[_0x4e1c('0x4')][_0x4e1c('0x13')](queryTelephones));_0x15fdb4[_0x4e1c('0x31')](db[_0x4e1c('0x36')][_0x4e1c('0x13')](queryTrunks));_0x15fdb4['push'](db['Campaign'][_0x4e1c('0x13')](queryCampaigns));_0x15fdb4[_0x4e1c('0x31')](db[_0x4e1c('0x4')][_0x4e1c('0x13')](queryAgents));break;case'user':_0x98868b[_0x19ed77](_0x4e1c('0x37'));_0x98868b[_0x19ed77](_0x4e1c('0x2d'));_0x15fdb4['push'](getAssociatedResources(_0x4e1c('0xe'),_0x1b5ba8[_0x4e1c('0x38')],_0x4e1c('0x30')));_0x15fdb4['push'](getAssociatedResources(_0x4e1c('0x39'),_0x1b5ba8[_0x4e1c('0x38')],'ChatQueue'));_0x15fdb4[_0x4e1c('0x31')](getAssociatedResources(_0x4e1c('0xf'),_0x1b5ba8[_0x4e1c('0x38')],_0x4e1c('0x3a')));_0x15fdb4[_0x4e1c('0x31')](getAssociatedResources(_0x4e1c('0x10'),_0x1b5ba8['userProfileId'],'SmsQueue'));_0x15fdb4[_0x4e1c('0x31')](getAssociatedResources(_0x4e1c('0x11'),_0x1b5ba8[_0x4e1c('0x38')],_0x4e1c('0x33')));_0x15fdb4[_0x4e1c('0x31')](getAssociatedResources(_0x4e1c('0x12'),_0x1b5ba8[_0x4e1c('0x38')],_0x4e1c('0x34')));_0x15fdb4[_0x4e1c('0x31')](getAssociatedResources(_0x4e1c('0x3b'),_0x1b5ba8[_0x4e1c('0x38')],'WhatsappQueue'));_0x15fdb4['push'](getAssociatedResources(_0x4e1c('0x14'),_0x1b5ba8[_0x4e1c('0x38')],_0x4e1c('0x4')));_0x15fdb4[_0x4e1c('0x31')](getAssociatedResources(_0x4e1c('0x15'),_0x1b5ba8[_0x4e1c('0x38')],'Trunk'));_0x15fdb4[_0x4e1c('0x31')](getAssociatedResources(_0x4e1c('0x3c'),_0x1b5ba8[_0x4e1c('0x38')],_0x4e1c('0x1a')));_0x15fdb4[_0x4e1c('0x31')](db[_0x4e1c('0x4')][_0x4e1c('0x13')](queryAgents));break;case _0x4e1c('0x7'):_0x98868b[_0x19ed77](_0x4e1c('0x37'));_0x98868b[_0x19ed77](_0x4e1c('0x2d'));_0x15fdb4[_0x4e1c('0x31')](_0x1b5ba8['getVoiceQueues']({'attributes':['id',_0x4e1c('0x3')]}));_0x15fdb4[_0x4e1c('0x31')](_0x1b5ba8[_0x4e1c('0x3d')]({'attributes':['id',_0x4e1c('0x3')]}));_0x15fdb4[_0x4e1c('0x31')](_0x1b5ba8[_0x4e1c('0x3e')]({'attributes':['id',_0x4e1c('0x3')]}));_0x15fdb4[_0x4e1c('0x31')](_0x1b5ba8['getSmsQueues']({'attributes':['id',_0x4e1c('0x3')]}));_0x15fdb4['push'](_0x1b5ba8[_0x4e1c('0x3f')]({'attributes':['id',_0x4e1c('0x3')]}));_0x15fdb4['push'](_0x1b5ba8[_0x4e1c('0x40')]({'attributes':['id',_0x4e1c('0x3')]}));_0x15fdb4['push'](_0x1b5ba8['getWhatsappQueues']({'attributes':['id',_0x4e1c('0x3')]}));break;}return BPromise[_0x4e1c('0x41')](_0x15fdb4);}})[_0x4e1c('0xc')](function(_0x7b26dc){if(_0x7b26dc&&_0x7b26dc['length']){for(var _0x3e6639=0x0;_0x3e6639<_0x7b26dc[_0x4e1c('0x1e')];_0x3e6639+=0x1){for(var _0x2169ae=0x0;_0x2169ae<_0x7b26dc[_0x3e6639][_0x4e1c('0x1e')];_0x2169ae+=0x1){switch(_0x3e6639){case 0x0:joinOrLeaveQueues(_0x98868b,_0x19ed77,'voice',_0x7b26dc[_0x3e6639][_0x2169ae]);break;case 0x1:joinOrLeaveQueues(_0x98868b,_0x19ed77,_0x4e1c('0x42'),_0x7b26dc[_0x3e6639][_0x2169ae]);break;case 0x2:joinOrLeaveQueues(_0x98868b,_0x19ed77,_0x4e1c('0x43'),_0x7b26dc[_0x3e6639][_0x2169ae]);break;case 0x3:joinOrLeaveQueues(_0x98868b,_0x19ed77,_0x4e1c('0x44'),_0x7b26dc[_0x3e6639][_0x2169ae]);break;case 0x4:joinOrLeaveQueues(_0x98868b,_0x19ed77,_0x4e1c('0x45'),_0x7b26dc[_0x3e6639][_0x2169ae]);break;case 0x5:joinOrLeaveQueues(_0x98868b,_0x19ed77,_0x4e1c('0x46'),_0x7b26dc[_0x3e6639][_0x2169ae]);break;case 0x6:joinOrLeaveQueues(_0x98868b,_0x19ed77,_0x4e1c('0x47'),_0x7b26dc[_0x3e6639][_0x2169ae]);break;case 0x7:if(_0x5ada14[_0x4e1c('0x5')]!==_0x4e1c('0x7'))_0x98868b[_0x19ed77](util[_0x4e1c('0x1b')]('telephone:%s',_0x7b26dc[_0x3e6639][_0x2169ae][_0x4e1c('0x3')]));break;case 0x8:if(_0x5ada14['role']!==_0x4e1c('0x7'))_0x98868b[_0x19ed77](util[_0x4e1c('0x1b')](_0x4e1c('0x48'),_0x7b26dc[_0x3e6639][_0x2169ae]['name']));break;case 0x9:if(_0x5ada14['role']!==_0x4e1c('0x7'))_0x98868b[_0x19ed77](util[_0x4e1c('0x1b')]('campaign:%s:%s',_0x7b26dc[_0x3e6639][_0x2169ae][_0x4e1c('0x8')],_0x7b26dc[_0x3e6639][_0x2169ae][_0x4e1c('0x3')]));break;case 0xa:_0x98868b[_0x19ed77](util['format']('user:%s',_0x7b26dc[_0x3e6639][_0x2169ae][_0x4e1c('0x3')]));break;}}}}})['then'](function(){if(_0x19ed77===_0x4e1c('0x49')){var _0x284835=_[_0x4e1c('0x18')](_0x5ada14[_0x4e1c('0x23')],'id');return _0x5ada14[_0x4e1c('0x4a')](_0x284835)[_0x4e1c('0xc')](function(){for(var _0x7eeb2f=0x0;_0x7eeb2f<_0x284835[_0x4e1c('0x1e')];_0x7eeb2f+=0x1){_0x45c13e['emit'](_0x4e1c('0x4b'),{'ChatInteractionId':Number(_0x284835[_0x7eeb2f]),'UserId':Number(_0x5ada14['id'])});}});}})[_0x4e1c('0xc')](function(){if(_0x19ed77==='leave'){var _0x44808e=_['map'](_0x5ada14[_0x4e1c('0x25')],'id');return _0x5ada14[_0x4e1c('0x4c')](_0x44808e)[_0x4e1c('0xc')](function(){for(var _0x4ac25b=0x0;_0x4ac25b<_0x44808e[_0x4e1c('0x1e')];_0x4ac25b+=0x1){_0x45c13e[_0x4e1c('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x44808e[_0x4ac25b]),'UserId':Number(_0x5ada14['id'])});}});}})[_0x4e1c('0xc')](function(){if(_0x19ed77===_0x4e1c('0x49')){var _0x356e11=_[_0x4e1c('0x18')](_0x5ada14['FaxInteractions'],'id');return _0x5ada14[_0x4e1c('0x4e')](_0x356e11)[_0x4e1c('0xc')](function(){for(var _0x2a417f=0x0;_0x2a417f<_0x356e11[_0x4e1c('0x1e')];_0x2a417f+=0x1){_0x45c13e[_0x4e1c('0x4d')](_0x4e1c('0x4f'),{'FaxInteractionId':Number(_0x356e11[_0x2a417f]),'UserId':Number(_0x5ada14['id'])});}});}})[_0x4e1c('0xc')](function(){if(_0x19ed77==='leave'){var _0x1d5548=_[_0x4e1c('0x18')](_0x5ada14[_0x4e1c('0x28')],'id');return _0x5ada14[_0x4e1c('0x50')](_0x1d5548)['then'](function(){for(var _0x1b99db=0x0;_0x1b99db<_0x1d5548[_0x4e1c('0x1e')];_0x1b99db+=0x1){_0x45c13e['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1d5548[_0x1b99db]),'UserId':Number(_0x5ada14['id'])});}});}})[_0x4e1c('0xc')](function(){if(_0x19ed77===_0x4e1c('0x49')){var _0x393a2b=_[_0x4e1c('0x18')](_0x5ada14[_0x4e1c('0x2a')],'id');return _0x5ada14[_0x4e1c('0x51')](_0x393a2b)[_0x4e1c('0xc')](function(){for(var _0x442604=0x0;_0x442604<_0x393a2b[_0x4e1c('0x1e')];_0x442604+=0x1){_0x45c13e['emit'](_0x4e1c('0x52'),{'OpenchannelInteractionId':Number(_0x393a2b[_0x442604]),'UserId':Number(_0x5ada14['id'])});}});}})['then'](function(){if(_0x19ed77===_0x4e1c('0x49')){var _0x65874d=_[_0x4e1c('0x18')](_0x5ada14['WhatsappInteractions'],'id');return _0x5ada14[_0x4e1c('0x53')](_0x65874d)[_0x4e1c('0xc')](function(){for(var _0x4432c1=0x0;_0x4432c1<_0x65874d['length'];_0x4432c1+=0x1){_0x45c13e[_0x4e1c('0x4d')](_0x4e1c('0x54'),{'WhatsappInteractionId':Number(_0x65874d[_0x4432c1]),'UserId':Number(_0x5ada14['id'])});}});}})['catch'](function(_0x335830){_0x98868b[_0x4e1c('0x55')](_0x335830);});}}function onDisconnect(_0x108765,_0x2c2de4){joinOrLeave(_0x108765,_0x4e1c('0x49'),_0x2c2de4);}function onConnect(_0x15ce0a){joinOrLeave(_0x15ce0a,_0x4e1c('0x56'));}exports[_0x4e1c('0x57')]=function(_0x4e7a8d){_0x4e7a8d['on'](_0x4e1c('0x58'),function(_0x455f0b){_0x455f0b[_0x4e1c('0x59')](0x0);_0x455f0b['address']=_0x455f0b[_0x4e1c('0x5a')][_0x4e1c('0x58')][_0x4e1c('0x5b')]+':'+_0x455f0b[_0x4e1c('0x5a')][_0x4e1c('0x58')][_0x4e1c('0x5c')];_0x455f0b[_0x4e1c('0x5d')]=new Date();_0x455f0b[_0x4e1c('0x55')]=function(_0xbfd9e4){console[_0x4e1c('0x55')](_0x4e1c('0x5e')+_0x455f0b[_0x4e1c('0x5f')][_0x4e1c('0x3')]+'['+_0x455f0b[_0x4e1c('0x60')]+']',_0xbfd9e4);};_0x455f0b['on']('disconnect',function(){onDisconnect(_0x455f0b,_0x4e7a8d);_0x455f0b['log'](_0x4e1c('0x61'));});onConnect(_0x455f0b);_0x455f0b['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 6c05f6c..1c4803b 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 _0x85a0=['then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','undefined','UserId','interface','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','resolve','Sequelize','contact','format','agent','closed','changed','substatus','AfterUpdate','find','fullname','email','internal','default','model','callback','toLowerCase','util','../../mysqldb','jayson/promise','../logger','client','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager'];(function(_0x366776,_0x48f0bf){var _0x34e2ad=function(_0xb7dfb0){while(--_0xb7dfb0){_0x366776['push'](_0x366776['shift']());}};_0x34e2ad(++_0x48f0bf);}(_0x85a0,0x104));var _0x085a=function(_0x5080af,_0x254e92){_0x5080af=_0x5080af-0x0;var _0x380eb4=_0x85a0[_0x5080af];return _0x380eb4;};'use strict';var util=require(_0x085a('0x0'));var db=require(_0x085a('0x1'))['db'];var jayson=require(_0x085a('0x2'));var logger=require(_0x085a('0x3'))('triggers');var client=jayson[_0x085a('0x4')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x085a('0x5'),'event':_0x085a('0x6'),'condition':_0x085a('0x7'),'callback':afterCreate},{'channel':_0x085a('0x8'),'model':_0x085a('0x5'),'event':_0x085a('0x9'),'condition':_0x085a('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0x085a('0xb'),'event':_0x085a('0x6'),'condition':_0x085a('0xc'),'callback':afterCreateMessage},{'channel':_0x085a('0x8'),'model':_0x085a('0xd'),'event':_0x085a('0x6'),'condition':_0x085a('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x085a('0xe'),'model':_0x085a('0xf'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x085a('0xe'),'model':_0x085a('0xf'),'event':_0x085a('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x085a('0x10'),'event':_0x085a('0x6'),'condition':_0x085a('0xc'),'callback':afterCreateMessage},{'channel':_0x085a('0x11'),'model':_0x085a('0x12'),'event':_0x085a('0x6'),'condition':_0x085a('0x7'),'callback':afterCreate},{'channel':_0x085a('0x11'),'model':_0x085a('0x12'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x085a('0x11'),'model':_0x085a('0x13'),'event':_0x085a('0x6'),'condition':_0x085a('0xc'),'callback':afterCreateMessage},{'channel':_0x085a('0x14'),'model':_0x085a('0x15'),'event':_0x085a('0x6'),'condition':_0x085a('0x7'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x085a('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x085a('0x14'),'model':'FaxMessage','event':'afterCreate','condition':_0x085a('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x085a('0x16'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x085a('0x17'),'model':_0x085a('0x16'),'event':_0x085a('0x9'),'condition':_0x085a('0xa'),'callback':afterUpdate},{'channel':_0x085a('0x17'),'model':'MailMessage','event':'afterCreate','condition':_0x085a('0xc'),'callback':afterCreateMessage},{'channel':_0x085a('0x18'),'model':'OpenchannelInteraction','event':_0x085a('0x6'),'condition':_0x085a('0x7'),'callback':afterCreate},{'channel':_0x085a('0x18'),'model':_0x085a('0x19'),'event':_0x085a('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x085a('0x18'),'model':_0x085a('0x1a'),'event':_0x085a('0x6'),'condition':_0x085a('0xc'),'callback':afterCreateMessage}];function request(_0x392dbb){return client['request'](_0x085a('0x1b'),_0x392dbb)[_0x085a('0x1c')](function(_0x248599){logger[_0x085a('0x1d')](_0x085a('0x1e'),_0x085a('0x1b'),_0x248599);if(_0x248599[_0x085a('0x1f')]){if(_0x248599['error'][_0x085a('0x20')]===0x1f4){logger[_0x085a('0x1f')]('Trigger,\x20%s',_0x085a('0x1b'),_0x248599[_0x085a('0x1f')]);}}})[_0x085a('0x21')](function(_0x1c9ff7){logger[_0x085a('0x1f')](_0x085a('0x1e'),_0x085a('0x1b'),_0x1c9ff7);});}function afterCreateMessage(_0x33945b){return function(_0x430780){_0x430780=_0x430780[_0x085a('0x22')]({'plain':!![]});_0x430780[_0x085a('0x23')]=_0x33945b;_0x430780[_0x085a('0x24')]=_0x33945b;_0x430780[_0x085a('0x25')]=_0x430780[_0x085a('0x26')];Promise['resolve']()[_0x085a('0x1c')](function(){if(typeof _0x430780[_0x085a('0x27')]==='undefined')return null;var _0x417a17=_0x085a('0x28')+_0x430780[_0x085a('0x27')];return db[_0x085a('0x29')][_0x085a('0x2a')](_0x417a17,{'type':db['Sequelize'][_0x085a('0x2b')][_0x085a('0x2c')],'raw':!![]});})['then'](function(_0x37dd99){if(_0x37dd99){_0x430780['contact']=_0x37dd99[0x0];}if(typeof _0x430780['UserId']===_0x085a('0x2d'))return;return getAgent(_0x430780[_0x085a('0x2e')]);})['then'](function(_0x329e21){if(_0x329e21){_0x430780[_0x085a('0x2f')]=util['format'](_0x085a('0x30'),_0x329e21[_0x085a('0x31')]);_0x430780['agent']=_0x329e21;_0x430780['channel']=_0x33945b;return request({'event':_0x085a('0x32'),'message':_0x430780});}else{return request({'event':_0x085a('0x33'),'message':_0x430780});}})[_0x085a('0x21')](function(_0x5d16cb){logger[_0x085a('0x1f')](_0x085a('0x1e'),_0x085a('0x34'),_0x5d16cb);});};}function afterCreateOfflineMessage(_0x35f84a){return function(_0x420c89){_0x420c89=_0x420c89[_0x085a('0x22')]({'plain':!![]});_0x420c89[_0x085a('0x23')]=_0x35f84a;_0x420c89['motionChannel']=_0x35f84a;_0x420c89[_0x085a('0x25')]=_0x085a('0x35');return request({'event':_0x420c89[_0x085a('0x25')],'message':_0x420c89});};}function afterCreate(_0x5c20af,_0x1fef41){return function(_0x14f8bd){_0x14f8bd=_0x14f8bd[_0x085a('0x22')]({'plain':!![]});_0x14f8bd[_0x085a('0x23')]=_0x5c20af;_0x14f8bd[_0x085a('0x24')]=_0x5c20af;_0x14f8bd[_0x085a('0x25')]=_0x085a('0x36');Promise[_0x085a('0x37')]()[_0x085a('0x1c')](function(){var _0x301bb8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x14f8bd[_0x085a('0x27')];return db[_0x085a('0x29')][_0x085a('0x2a')](_0x301bb8,{'type':db[_0x085a('0x38')][_0x085a('0x2b')][_0x085a('0x2c')],'raw':!![]});})[_0x085a('0x1c')](function(_0xa3eac6){if(_0xa3eac6){_0x14f8bd[_0x085a('0x39')]=_0xa3eac6[0x0];}if(typeof _0x14f8bd[_0x085a('0x2e')]===_0x085a('0x2d'))return;return getAgent(_0x14f8bd[_0x085a('0x2e')]);})[_0x085a('0x1c')](function(_0x1281b2){if(_0x1281b2){_0x14f8bd['interface']=util[_0x085a('0x3a')](_0x085a('0x30'),_0x1281b2[_0x085a('0x31')]);_0x14f8bd[_0x085a('0x3b')]=_0x1281b2;}return request({'event':_0x1fef41,'message':_0x14f8bd});})[_0x085a('0x21')](function(_0x410a8b){logger[_0x085a('0x1f')](_0x085a('0x1e'),'AfterCreate',_0x410a8b);});};}function afterUpdate(_0x5256fe){return function(_0x40af90){var _0x5b0a58=_0x40af90['changed'](_0x085a('0x3c'))&&_0x40af90[_0x085a('0x3c')];var _0xd5c0d3=_0x40af90[_0x085a('0x3d')]('substatus');if(_0x5b0a58||_0xd5c0d3){var _0x53464f=_0x5b0a58?'closedinteraction':'substatus';var _0x35cbf6=_0x40af90['get']({'plain':!![]});_0x35cbf6[_0x085a('0x23')]=_0x5256fe;_0x35cbf6['motionChannel']=_0x5256fe;_0x35cbf6[_0x085a('0x25')]=_0x5b0a58?_0x085a('0x3c'):_0x085a('0x3e');var _0x1b2ffc=_0x085a('0x28')+_0x35cbf6[_0x085a('0x27')];return db[_0x085a('0x29')][_0x085a('0x2a')](_0x1b2ffc,{'type':db[_0x085a('0x38')]['QueryTypes'][_0x085a('0x2c')],'raw':!![]})[_0x085a('0x1c')](function(_0x472787){if(_0x472787){_0x35cbf6['contact']=_0x472787[0x0];}if(typeof _0x35cbf6[_0x085a('0x2e')]===_0x085a('0x2d'))return;return getAgent(_0x35cbf6[_0x085a('0x2e')]);})[_0x085a('0x1c')](function(_0x3cec67){if(_0x3cec67){_0x35cbf6[_0x085a('0x2f')]=util[_0x085a('0x3a')](_0x085a('0x30'),_0x3cec67[_0x085a('0x31')]);_0x35cbf6[_0x085a('0x3b')]=_0x3cec67;}return request({'event':_0x53464f,'message':_0x35cbf6});})[_0x085a('0x21')](function(_0x18ff63){logger['error'](_0x085a('0x1e'),_0x085a('0x3f'),_0x18ff63);});}};}function getAgent(_0x2f2368){return db['User'][_0x085a('0x40')]({'where':{'id':_0x2f2368},'attributes':['id',_0x085a('0x31'),_0x085a('0x41'),_0x085a('0x42'),_0x085a('0x43')],'raw':!![]})['then'](function(_0x47c283){return _0x47c283;});}exports[_0x085a('0x44')]=function(){for(var _0x8655c6=0x0;_0x8655c6=_0x2db58c['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1eef5e(_0x38a79a);})[_0xffcd('0x16')](function(_0x2aa3c8){_0x3a3b79(_0x2aa3c8);});});}; \ No newline at end of file +var _0x4299=['chat','fax','sms','openchannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','count','then','agents','bluebird','../mysqldb','voice','mail'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x4299,0xe0));var _0x9429=function(_0x3c8d56,_0x18477b){_0x3c8d56=_0x3c8d56-0x0;var _0x300301=_0x4299[_0x3c8d56];return _0x300301;};'use strict';var _=require('lodash');var BPromise=require(_0x9429('0x0'));var db=require(_0x9429('0x1'))['db'];var util=require('./license/util');var channels=[_0x9429('0x2'),_0x9429('0x3'),_0x9429('0x4'),_0x9429('0x5'),_0x9429('0x6'),'whatsapp',_0x9429('0x7')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0xeeb182){_0xeeb182=_0xeeb182[_0x9429('0x8')]();return _['includes'](channels,_0xeeb182);};exports[_0x9429('0x9')]=function(_0x217fe6,_0x1b459c,_0x329eb7,_0x42ad6a){var _0x46ccbd={'loginAttempts':_0x1b459c,'blocked':_0x329eb7};if(!_[_0x9429('0xa')](_0x42ad6a)){_0x46ccbd[_0x9429('0xb')]=_0x42ad6a;}return _0x217fe6[_0x9429('0xc')](_0x46ccbd);};exports[_0x9429('0xd')]=function(_0xb245f1){return new BPromise(function(_0x3add09,_0x210326){var _0x36d862=0x0;if(_0xb245f1['role']!==_0x9429('0xe')){_0x3add09(_0xb245f1);}db[_0x9429('0xf')][_0x9429('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0xb245f1['id']}}})[_0x9429('0x11')](function(_0x32f2f4){_0x36d862=_0x32f2f4;return util[_0x9429('0xd')]();})['then'](function(_0x5d255b){if(_0x5d255b&&_0x5d255b[_0x9429('0x12')]&&_0x36d862>=_0x5d255b[_0x9429('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3add09(_0xb245f1);})['catch'](function(_0x203009){_0x210326(_0x203009);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 32b0aef..f5c529b 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x409ec2,_0x1214b7){var _0x11f3f7=function(_0x30700a){while(--_0x30700a){_0x409ec2['push'](_0x409ec2['shift']());}};_0x11f3f7(++_0x1214b7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xe14b=['Out\x20Of\x20Interval','Forbidden','error','stack','statusMessage','status','send','util','../config/logger','message','name','Bad\x20Request','inherits','Not\x20Found'];(function(_0x1804af,_0x85df23){var _0x44b773=function(_0x35e1eb){while(--_0x35e1eb){_0x1804af['push'](_0x1804af['shift']());}};_0x44b773(++_0x85df23);}(_0xe14b,0x93));var _0xbe14=function(_0x4c170c,_0x3118ff){_0x4c170c=_0x4c170c-0x0;var _0xff48d1=_0xe14b[_0x4c170c];return _0xff48d1;};'use strict';var util=require(_0xbe14('0x0'));var logger=require(_0xbe14('0x1'))('api');var APIError=function(_0x5cc4d8,_0x11c3a0){this[_0xbe14('0x2')]=_0x5cc4d8||'Internal\x20Server\x20Error';this[_0xbe14('0x3')]=_0x11c3a0||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1833e3){this[_0xbe14('0x2')]=_0x1833e3||_0xbe14('0x4');this[_0xbe14('0x3')]=_0xbe14('0x4');util[_0xbe14('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x196fca){this['message']=_0x196fca||'Entity\x20not\x20found';this['name']=_0xbe14('0x6');util[_0xbe14('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xd68cd7){this[_0xbe14('0x2')]=_0xd68cd7||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this['name']=_0xbe14('0x7');util[_0xbe14('0x5')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4935cc){switch(_0x4935cc){case _0xbe14('0x4'):return 0x190;case _0xbe14('0x8'),_0xbe14('0x7'):return 0x193;case _0xbe14('0x6'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x27792f){if(_0x27792f===_0xbe14('0x7'))return _0x27792f;return null;}function handleError(_0x23a730){return function(_0x2850cb){logger[_0xbe14('0x9')](_0x2850cb[_0xbe14('0xa')]);var _0x1e4826=getStatusCode(_0x2850cb[_0xbe14('0x3')]);var _0x813399=getCustomStatusMessage(_0x2850cb['name']);if(_0x2850cb['name'])delete _0x2850cb[_0xbe14('0x3')];if(_0x813399)_0x23a730[_0xbe14('0xb')]=_0x813399;return _0x23a730[_0xbe14('0xc')](_0x1e4826)[_0xbe14('0xd')](_0x2850cb);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index da75410..26c92f7 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa647=['send','status','json'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0xa647,0x18a));var _0x7a64=function(_0xd10c1d,_0x243774){_0xd10c1d=_0xd10c1d-0x0;var _0x41fbae=_0xa647[_0xd10c1d];return _0x41fbae;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3499a6,_0x452b55){var _0x4879d8='404';var _0x2ae3df=0x194;var _0x850e57={'status':_0x2ae3df};_0x452b55['status'](_0x850e57['status']);_0x452b55['render'](_0x4879d8,{},function(_0x169b08,_0x2c29e8){if(_0x169b08){return _0x452b55[_0x7a64('0x0')](_0x850e57['status'])[_0x7a64('0x1')](_0x850e57);}_0x452b55[_0x7a64('0x2')](_0x2c29e8);});}; \ No newline at end of file +var _0x5f6a=['status','render','json','send','exports','404'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x394b32,_0x41a63c){_0x394b32=_0x394b32-0x0;var _0x2d00a4=_0x5f6a[_0x394b32];return _0x2d00a4;};'use strict';module[_0xa5f6('0x0')][0x194]=function pageNotFound(_0x5cc494,_0x59c041){var _0x3ba94f=_0xa5f6('0x1');var _0x2e23f3=0x194;var _0x1ec17a={'status':_0x2e23f3};_0x59c041['status'](_0x1ec17a[_0xa5f6('0x2')]);_0x59c041[_0xa5f6('0x3')](_0x3ba94f,{},function(_0x199819,_0xde771e){if(_0x199819){return _0x59c041[_0xa5f6('0x2')](_0x1ec17a[_0xa5f6('0x2')])[_0xa5f6('0x4')](_0x1ec17a);}_0x59c041[_0xa5f6('0x5')](_0xde771e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d420a9a..2dc7bad 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c445107..3ca7cca 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cee=['/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','/server/files/plugins','route','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/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/integrations/servicenow/configurations','./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/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue'];(function(_0x3323b3,_0x2395a5){var _0x331003=function(_0x491daf){while(--_0x491daf){_0x3323b3['push'](_0x3323b3['shift']());}};_0x331003(++_0x2395a5);}(_0x0cee,0x12f));var _0xe0ce=function(_0x26ad66,_0x2a6a1d){_0x26ad66=_0x26ad66-0x0;var _0x2a11e3=_0x0cee[_0x26ad66];return _0x2a11e3;};'use strict';var path=require(_0xe0ce('0x0'));var express=require(_0xe0ce('0x1'));var errors=require(_0xe0ce('0x2'));var config=require(_0xe0ce('0x3'));var setupLoggers=require(_0xe0ce('0x4'))[_0xe0ce('0x5')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0xe181aa){return setupLoggers(_0xe181aa)[_0xe0ce('0x6')](function(){_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x8'),require(_0xe0ce('0x9')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xa'),require(_0xe0ce('0xb')));_0xe181aa['use'](_0xe0ce('0xc'),require(_0xe0ce('0xd')));_0xe181aa['use'](_0xe0ce('0xe'),require(_0xe0ce('0xf')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x10'),require('./api/voiceMusicOnHold'));_0xe181aa['use']('/api/voice/queues',require(_0xe0ce('0x11')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x12'),require(_0xe0ce('0x13')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x14'),require(_0xe0ce('0x15')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x16'),require(_0xe0ce('0x17')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x18'),require('./api/voiceMailMessage'));_0xe181aa['use'](_0xe0ce('0x19'),require(_0xe0ce('0x1a')));_0xe181aa['use']('/api/voice/dials/reports',require(_0xe0ce('0x1b')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x1c'),require(_0xe0ce('0x1d')));_0xe181aa[_0xe0ce('0x7')]('/api/voice/queues/reports',require(_0xe0ce('0x1e')));_0xe181aa['use'](_0xe0ce('0x1f'),require(_0xe0ce('0x20')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x21'),require(_0xe0ce('0x22')));_0xe181aa['use']('/api/voice/transfers/reports',require(_0xe0ce('0x23')));_0xe181aa['use']('/api/mail/out_servers',require(_0xe0ce('0x24')));_0xe181aa[_0xe0ce('0x7')]('/api/mail/accounts',require(_0xe0ce('0x25')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x26'),require(_0xe0ce('0x27')));_0xe181aa[_0xe0ce('0x7')]('/api/mail/substatuses',require(_0xe0ce('0x28')));_0xe181aa['use'](_0xe0ce('0x29'),require('./api/mailInteraction'));_0xe181aa['use']('/api/mail/messages',require('./api/mailMessage'));_0xe181aa[_0xe0ce('0x7')]('/api/mail/applications',require(_0xe0ce('0x2a')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x2b'),require(_0xe0ce('0x2c')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x2d'),require(_0xe0ce('0x2e')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x2f'),require(_0xe0ce('0x30')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x31'),require('./api/faxAccount'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x32'),require(_0xe0ce('0x33')));_0xe181aa[_0xe0ce('0x7')]('/api/fax/interactions',require(_0xe0ce('0x34')));_0xe181aa[_0xe0ce('0x7')]('/api/fax/messages',require(_0xe0ce('0x35')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x36'),require(_0xe0ce('0x37')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x38'),require(_0xe0ce('0x39')));_0xe181aa['use'](_0xe0ce('0x3a'),require(_0xe0ce('0x3b')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x3c'),require(_0xe0ce('0x3d')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x3e'),require('./api/smsInteraction'));_0xe181aa['use'](_0xe0ce('0x3f'),require('./api/smsMessage'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x40'),require(_0xe0ce('0x41')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x42'),require('./api/openchannelAccount'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x43'),require('./api/openchannelApplication'));_0xe181aa['use']('/api/openchannel/interactions',require(_0xe0ce('0x44')));_0xe181aa[_0xe0ce('0x7')]('/api/openchannel/messages',require(_0xe0ce('0x45')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x46'),require(_0xe0ce('0x47')));_0xe181aa['use'](_0xe0ce('0x48'),require(_0xe0ce('0x49')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x4a'),require(_0xe0ce('0x4b')));_0xe181aa['use']('/api/chat/applications',require(_0xe0ce('0x4c')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x4d'),require(_0xe0ce('0x4e')));_0xe181aa['use'](_0xe0ce('0x4f'),require(_0xe0ce('0x50')));_0xe181aa['use'](_0xe0ce('0x51'),require(_0xe0ce('0x52')));_0xe181aa['use'](_0xe0ce('0x53'),require(_0xe0ce('0x54')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x55'),require(_0xe0ce('0x56')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x57'),require('./api/chatProactiveAction'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x58'),require(_0xe0ce('0x59')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x5a'),require('./api/cmContact'));_0xe181aa['use'](_0xe0ce('0x5b'),require(_0xe0ce('0x5c')));_0xe181aa[_0xe0ce('0x7')]('/api/cm/hopper_black',require(_0xe0ce('0x5d')));_0xe181aa[_0xe0ce('0x7')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x5e'),require(_0xe0ce('0x5f')));_0xe181aa[_0xe0ce('0x7')]('/api/cm/custom_fields',require(_0xe0ce('0x60')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x61'),require(_0xe0ce('0x62')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x63'),require(_0xe0ce('0x64')));_0xe181aa['use'](_0xe0ce('0x65'),require(_0xe0ce('0x66')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x67'),require(_0xe0ce('0x68')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x69'),require('./api/condition'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x6a'),require('./api/interval'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x6b'),require(_0xe0ce('0x6c')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x6d'),require('./api/cdr'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x6e'),require(_0xe0ce('0x6f')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x70'),require(_0xe0ce('0x71')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x72'),require(_0xe0ce('0x73')));_0xe181aa[_0xe0ce('0x7')]('/api/tags',require('./api/tag'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x74'),require(_0xe0ce('0x75')));_0xe181aa['use'](_0xe0ce('0x76'),require('./api/cmContactHasItem'));_0xe181aa[_0xe0ce('0x7')]('/api/cm_hopper_additional_phones',require(_0xe0ce('0x77')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x78'),require('./api/template'));_0xe181aa['use'](_0xe0ce('0x79'),require(_0xe0ce('0x7a')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x7b'),require('./api/variable'));_0xe181aa[_0xe0ce('0x7')]('/api/integrations',require('./api/integration'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x7c'),require(_0xe0ce('0x7d')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x7e'),require(_0xe0ce('0x7f')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x80'),require(_0xe0ce('0x81')));_0xe181aa['use'](_0xe0ce('0x82'),require(_0xe0ce('0x83')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x84'),require(_0xe0ce('0x85')));_0xe181aa[_0xe0ce('0x7')]('/api/analytics/field_reports',require(_0xe0ce('0x86')));_0xe181aa['use']('/api/analytics/tree_reports',require(_0xe0ce('0x87')));_0xe181aa['use'](_0xe0ce('0x88'),require('./api/intSalesforceAccount'));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x89'),require(_0xe0ce('0x8a')));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/sugarcrm/accounts',require(_0xe0ce('0x8b')));_0xe181aa['use']('/api/integrations/sugarcrm/configurations',require(_0xe0ce('0x8c')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x8d'),require(_0xe0ce('0x8e')));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/desk/accounts',require(_0xe0ce('0x8f')));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/desk/configurations',require(_0xe0ce('0x90')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x91'),require(_0xe0ce('0x92')));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/zoho/accounts',require(_0xe0ce('0x93')));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/zoho/configurations',require(_0xe0ce('0x94')));_0xe181aa['use'](_0xe0ce('0x95'),require(_0xe0ce('0x96')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x97'),require(_0xe0ce('0x98')));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0xe181aa['use'](_0xe0ce('0x99'),require(_0xe0ce('0x9a')));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0xe181aa[_0xe0ce('0x7')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x9b'),require(_0xe0ce('0x9c')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x9d'),require(_0xe0ce('0x9e')));_0xe181aa['use'](_0xe0ce('0x9f'),require(_0xe0ce('0xa0')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xa1'),require(_0xe0ce('0xa2')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xa3'),require('./api/intServicenowAccount'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xa4'),require('./api/intServicenowConfiguration'));_0xe181aa['use']('/api/integrations/servicenow/fields',require(_0xe0ce('0xa5')));_0xe181aa['use']('/api/integrations/dynamics365/accounts',require(_0xe0ce('0xa6')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xa7'),require(_0xe0ce('0xa8')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xa9'),require(_0xe0ce('0xaa')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xab'),require(_0xe0ce('0xac')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xad'),require(_0xe0ce('0xae')));_0xe181aa['use']('/api/integrations/freshsales/fields',require(_0xe0ce('0xaf')));_0xe181aa[_0xe0ce('0x7')]('/api/networks',require('./api/network'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xb0'),require(_0xe0ce('0xb1')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xb2'),require(_0xe0ce('0xb3')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xb4'),require('./api/jscriptyAnswerReport'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xb5'),require(_0xe0ce('0xb6')));_0xe181aa[_0xe0ce('0x7')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0xe181aa['use'](_0xe0ce('0xb7'),require(_0xe0ce('0xb8')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xb9'),require(_0xe0ce('0xba')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xbb'),require(_0xe0ce('0xbc')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xbd'),require(_0xe0ce('0xbe')));_0xe181aa[_0xe0ce('0x7')]('/api/settings',require(_0xe0ce('0xbf')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xc0'),require(_0xe0ce('0xc1')));_0xe181aa[_0xe0ce('0x7')]('/api/square/projects',require('./api/squareProject'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xc2'),require(_0xe0ce('0xc3')));_0xe181aa['use']('/api/square/messages',require('./api/squareMessage'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xc4'),require('./api/team'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xc5'),require(_0xe0ce('0xc6')));_0xe181aa['use']('/api/campaigns',require(_0xe0ce('0xc7')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xc8'),require('./api/migration'));_0xe181aa[_0xe0ce('0x7')]('/api/attachments',require(_0xe0ce('0xc9')));_0xe181aa['use'](_0xe0ce('0xca'),require(_0xe0ce('0xcb')));_0xe181aa['use']('/api/mail/reports/transfer',require(_0xe0ce('0xcc')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xcd'),require(_0xe0ce('0xce')));_0xe181aa['use'](_0xe0ce('0xcf'),require(_0xe0ce('0xd0')));_0xe181aa['use'](_0xe0ce('0xd1'),require(_0xe0ce('0xd2')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xd3'),require(_0xe0ce('0xd4')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xd5'),require(_0xe0ce('0xd6')));_0xe181aa['use'](_0xe0ce('0xd7'),require(_0xe0ce('0xd8')));_0xe181aa[_0xe0ce('0x7')]('/api/userProfiles',require('./api/userProfile'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xd9'),require(_0xe0ce('0xda')));_0xe181aa['use'](_0xe0ce('0xdb'),require(_0xe0ce('0xdc')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xdd'),require('./api/userNotification'));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xde'),require(_0xe0ce('0xdf')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xe0'),require('./api/whatsappApplication'));_0xe181aa['use']('/api/whatsapp/interactions',require(_0xe0ce('0xe1')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xe2'),require(_0xe0ce('0xe3')));_0xe181aa[_0xe0ce('0x7')]('/api/whatsapp/reports/queue',require(_0xe0ce('0xe4')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xe5'),require(_0xe0ce('0xe6')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xe7'),require(_0xe0ce('0xe8')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xe9'),require(_0xe0ce('0xea')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xeb'),require(_0xe0ce('0xec')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xed'),require(_0xe0ce('0xee')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xef'),require(_0xe0ce('0xf0')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xf1'),require(_0xe0ce('0xf2')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xf3'),require(_0xe0ce('0xf4')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xf5'),require(_0xe0ce('0xf6')));_0xe181aa[_0xe0ce('0x7')]('/api/rpc',require(_0xe0ce('0xf7')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xf8'),require(_0xe0ce('0xf9')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xfa'),require(_0xe0ce('0xfb')));_0xe181aa['use'](_0xe0ce('0xfc'),require(_0xe0ce('0xfd')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xfe'),require('./api/webbar'));_0xe181aa[_0xe0ce('0x7')]('/api/logs',clientSideLogs);_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0xff'),express[_0xe0ce('0x100')](path[_0xe0ce('0x101')](config[_0xe0ce('0x102')],'/apidoc')));_0xe181aa[_0xe0ce('0x7')]('/www',express['static'](path[_0xe0ce('0x101')](config[_0xe0ce('0x102')],_0xe0ce('0x103'))));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x104'),express[_0xe0ce('0x100')](path[_0xe0ce('0x101')](config[_0xe0ce('0x102')],'/demo')));_0xe181aa[_0xe0ce('0x7')](_0xe0ce('0x105'),express['static'](path[_0xe0ce('0x101')](config[_0xe0ce('0x102')],'snippet','3.5.0')));_0xe181aa[_0xe0ce('0x7')]('/plugins',express[_0xe0ce('0x100')](path[_0xe0ce('0x101')](config[_0xe0ce('0x102')],_0xe0ce('0x106'))));_0xe181aa[_0xe0ce('0x107')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0xe181aa[_0xe0ce('0x107')]('/*')[_0xe0ce('0x108')](function(_0xe5d096,_0x5a2e58){_0x5a2e58[_0xe0ce('0x109')](path[_0xe0ce('0x10a')](_0xe181aa[_0xe0ce('0x108')]('appPath')+_0xe0ce('0x10b')));});return _0xe181aa;});}; \ No newline at end of file +var _0xad8a=['./api/automation','/api/canned_answers','./api/cannedAnswer','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/demo','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./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/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/interactions','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations'];(function(_0x405aeb,_0x5ee732){var _0x50e76a=function(_0x2cded1){while(--_0x2cded1){_0x405aeb['push'](_0x405aeb['shift']());}};_0x50e76a(++_0x5ee732);}(_0xad8a,0xb0));var _0xaad8=function(_0x23d33f,_0x3f6afd){_0x23d33f=_0x23d33f-0x0;var _0x55c2aa=_0xad8a[_0x23d33f];return _0x55c2aa;};'use strict';var path=require(_0xaad8('0x0'));var express=require(_0xaad8('0x1'));var errors=require(_0xaad8('0x2'));var config=require(_0xaad8('0x3'));var setupLoggers=require(_0xaad8('0x4'))['setupLoggers'];var clientSideLogs=require(_0xaad8('0x5'));exports[_0xaad8('0x6')]=function(_0x398fde){return setupLoggers(_0x398fde)['then'](function(){_0x398fde[_0xaad8('0x7')](_0xaad8('0x8'),require(_0xaad8('0x9')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xa'),require(_0xaad8('0xb')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xc'),require(_0xaad8('0xd')));_0x398fde[_0xaad8('0x7')]('/api/voice/extensions',require('./api/voiceExtension'));_0x398fde[_0xaad8('0x7')](_0xaad8('0xe'),require(_0xaad8('0xf')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x10'),require(_0xaad8('0x11')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x12'),require(_0xaad8('0x13')));_0x398fde['use'](_0xaad8('0x14'),require(_0xaad8('0x15')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x16'),require(_0xaad8('0x17')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x18'),require(_0xaad8('0x19')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x1a'),require(_0xaad8('0x1b')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x1c'),require('./api/voiceDialReport'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x1d'),require('./api/voiceAgentReport'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x1e'),require(_0xaad8('0x1f')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x20'),require(_0xaad8('0x21')));_0x398fde['use'](_0xaad8('0x22'),require(_0xaad8('0x23')));_0x398fde['use'](_0xaad8('0x24'),require('./api/voiceTransferReport'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x25'),require(_0xaad8('0x26')));_0x398fde[_0xaad8('0x7')]('/api/mail/accounts',require(_0xaad8('0x27')));_0x398fde[_0xaad8('0x7')]('/api/mail/queues',require(_0xaad8('0x28')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x29'),require('./api/mailSubstatus'));_0x398fde['use'](_0xaad8('0x2a'),require(_0xaad8('0x2b')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x2c'),require(_0xaad8('0x2d')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x2e'),require(_0xaad8('0x2f')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x30'),require(_0xaad8('0x31')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x32'),require(_0xaad8('0x33')));_0x398fde[_0xaad8('0x7')]('/api/dashboards/items',require(_0xaad8('0x34')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x35'),require('./api/faxAccount'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x36'),require(_0xaad8('0x37')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x38'),require('./api/faxInteraction'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x39'),require(_0xaad8('0x3a')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x3b'),require('./api/faxQueue'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x3c'),require(_0xaad8('0x3d')));_0x398fde[_0xaad8('0x7')]('/api/sms/accounts',require(_0xaad8('0x3e')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x3f'),require(_0xaad8('0x40')));_0x398fde[_0xaad8('0x7')]('/api/sms/interactions',require(_0xaad8('0x41')));_0x398fde[_0xaad8('0x7')]('/api/sms/messages',require('./api/smsMessage'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x42'),require(_0xaad8('0x43')));_0x398fde[_0xaad8('0x7')]('/api/openchannel/accounts',require(_0xaad8('0x44')));_0x398fde[_0xaad8('0x7')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x45'),require('./api/openchannelInteraction'));_0x398fde[_0xaad8('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x46'),require('./api/openchannelQueue'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x47'),require(_0xaad8('0x48')));_0x398fde[_0xaad8('0x7')]('/api/openchannel/reports/queue',require(_0xaad8('0x49')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x4a'),require(_0xaad8('0x4b')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x4c'),require('./api/chatInteraction'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x4d'),require(_0xaad8('0x4e')));_0x398fde['use'](_0xaad8('0x4f'),require(_0xaad8('0x50')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x51'),require(_0xaad8('0x52')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x53'),require('./api/chatGroup'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x54'),require(_0xaad8('0x55')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x56'),require(_0xaad8('0x57')));_0x398fde['use'](_0xaad8('0x58'),require(_0xaad8('0x59')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x5a'),require('./api/cmHopper'));_0x398fde['use']('/api/cm/hopper_black',require(_0xaad8('0x5b')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x5c'),require('./api/cmHopperFinal'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x5d'),require('./api/cmHopperHistory'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x5e'),require(_0xaad8('0x5f')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x60'),require(_0xaad8('0x61')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x62'),require(_0xaad8('0x63')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x64'),require(_0xaad8('0x65')));_0x398fde['use']('/api/dispositions',require('./api/disposition'));_0x398fde[_0xaad8('0x7')]('/api/conditions',require(_0xaad8('0x66')));_0x398fde['use']('/api/intervals',require(_0xaad8('0x67')));_0x398fde['use'](_0xaad8('0x68'),require(_0xaad8('0x69')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x6a'),require(_0xaad8('0x6b')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x6c'),require(_0xaad8('0x6d')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x6e'),require(_0xaad8('0x6f')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x70'),require(_0xaad8('0x71')));_0x398fde[_0xaad8('0x7')]('/api/tags',require('./api/tag'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x72'),require(_0xaad8('0x73')));_0x398fde['use']('/api/cm_contact_has_items',require(_0xaad8('0x74')));_0x398fde['use'](_0xaad8('0x75'),require(_0xaad8('0x76')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x77'),require(_0xaad8('0x78')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x79'),require(_0xaad8('0x7a')));_0x398fde[_0xaad8('0x7')]('/api/variables',require(_0xaad8('0x7b')));_0x398fde[_0xaad8('0x7')]('/api/integrations',require(_0xaad8('0x7c')));_0x398fde['use'](_0xaad8('0x7d'),require(_0xaad8('0x7e')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x7f'),require(_0xaad8('0x80')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x81'),require(_0xaad8('0x82')));_0x398fde[_0xaad8('0x7')]('/api/analytics/extracted_reports',require(_0xaad8('0x83')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x84'),require(_0xaad8('0x85')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x86'),require('./api/analyticFieldReport'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x87'),require('./api/analyticTreeReport'));_0x398fde['use'](_0xaad8('0x88'),require(_0xaad8('0x89')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x8a'),require(_0xaad8('0x8b')));_0x398fde[_0xaad8('0x7')]('/api/integrations/salesforce/fields',require(_0xaad8('0x8c')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x8d'),require(_0xaad8('0x8e')));_0x398fde[_0xaad8('0x7')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x8f'),require(_0xaad8('0x90')));_0x398fde['use'](_0xaad8('0x91'),require(_0xaad8('0x92')));_0x398fde[_0xaad8('0x7')]('/api/integrations/desk/configurations',require(_0xaad8('0x93')));_0x398fde['use'](_0xaad8('0x94'),require(_0xaad8('0x95')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x96'),require('./api/intZohoAccount'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x97'),require('./api/intZohoConfiguration'));_0x398fde['use'](_0xaad8('0x98'),require('./api/intZohoField'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x99'),require(_0xaad8('0x9a')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x9b'),require(_0xaad8('0x9c')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x9d'),require(_0xaad8('0x9e')));_0x398fde['use'](_0xaad8('0x9f'),require(_0xaad8('0xa0')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xa1'),require(_0xaad8('0xa2')));_0x398fde[_0xaad8('0x7')]('/api/integrations/freshdesk/fields',require(_0xaad8('0xa3')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xa4'),require('./api/intVtigerAccount'));_0x398fde['use'](_0xaad8('0xa5'),require(_0xaad8('0xa6')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xa7'),require('./api/intVtigerField'));_0x398fde[_0xaad8('0x7')](_0xaad8('0xa8'),require(_0xaad8('0xa9')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xaa'),require('./api/intServicenowConfiguration'));_0x398fde['use'](_0xaad8('0xab'),require(_0xaad8('0xac')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xad'),require(_0xaad8('0xae')));_0x398fde[_0xaad8('0x7')]('/api/integrations/dynamics365/configurations',require(_0xaad8('0xaf')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xb0'),require(_0xaad8('0xb1')));_0x398fde[_0xaad8('0x7')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x398fde['use'](_0xaad8('0xb2'),require(_0xaad8('0xb3')));_0x398fde['use'](_0xaad8('0xb4'),require(_0xaad8('0xb5')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xb6'),require(_0xaad8('0xb7')));_0x398fde['use'](_0xaad8('0xb8'),require(_0xaad8('0xb9')));_0x398fde[_0xaad8('0x7')]('/api/chat/internal/messages',require(_0xaad8('0xba')));_0x398fde['use'](_0xaad8('0xbb'),require(_0xaad8('0xbc')));_0x398fde['use'](_0xaad8('0xbd'),require(_0xaad8('0xbe')));_0x398fde['use'](_0xaad8('0xbf'),require('./api/jscriptySessionReport'));_0x398fde[_0xaad8('0x7')](_0xaad8('0xc0'),require(_0xaad8('0xc1')));_0x398fde[_0xaad8('0x7')]('/api/square/reports',require(_0xaad8('0xc2')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xc3'),require(_0xaad8('0xc4')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xc5'),require(_0xaad8('0xc6')));_0x398fde['use'](_0xaad8('0xc7'),require(_0xaad8('0xc8')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xc9'),require(_0xaad8('0xca')));_0x398fde[_0xaad8('0x7')]('/api/square/projects',require(_0xaad8('0xcb')));_0x398fde['use'](_0xaad8('0xcc'),require('./api/squareRecording'));_0x398fde[_0xaad8('0x7')]('/api/square/messages',require(_0xaad8('0xcd')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xce'),require(_0xaad8('0xcf')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xd0'),require(_0xaad8('0xd1')));_0x398fde['use'](_0xaad8('0xd2'),require(_0xaad8('0xd3')));_0x398fde['use'](_0xaad8('0xd4'),require(_0xaad8('0xd5')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xd6'),require(_0xaad8('0xd7')));_0x398fde[_0xaad8('0x7')]('/api/plugins',require(_0xaad8('0xd8')));_0x398fde['use']('/api/mail/reports/transfer',require(_0xaad8('0xd9')));_0x398fde[_0xaad8('0x7')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x398fde['use']('/api/fax/reports/transfer',require(_0xaad8('0xda')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xdb'),require(_0xaad8('0xdc')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xdd'),require(_0xaad8('0xde')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xdf'),require(_0xaad8('0xe0')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xe1'),require(_0xaad8('0xe2')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xe3'),require(_0xaad8('0xe4')));_0x398fde[_0xaad8('0x7')]('/api/userProfile/sections',require(_0xaad8('0xe5')));_0x398fde[_0xaad8('0x7')]('/api/userProfile/resources',require(_0xaad8('0xe6')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xe7'),require('./api/userNotification'));_0x398fde[_0xaad8('0x7')]('/api/whatsapp/accounts',require(_0xaad8('0xe8')));_0x398fde[_0xaad8('0x7')]('/api/whatsapp/applications',require(_0xaad8('0xe9')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xea'),require('./api/whatsappInteraction'));_0x398fde[_0xaad8('0x7')](_0xaad8('0xeb'),require(_0xaad8('0xec')));_0x398fde['use']('/api/whatsapp/reports/queue',require(_0xaad8('0xed')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xee'),require(_0xaad8('0xef')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xf0'),require(_0xaad8('0xf1')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xf2'),require('./api/cloudProvider'));_0x398fde['use'](_0xaad8('0xf3'),require(_0xaad8('0xf4')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xf5'),require(_0xaad8('0xf6')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xf7'),require(_0xaad8('0xf8')));_0x398fde['use'](_0xaad8('0xf9'),require('./api/authGoogle'));_0x398fde[_0xaad8('0x7')](_0xaad8('0xfa'),require(_0xaad8('0xfb')));_0x398fde[_0xaad8('0x7')](_0xaad8('0xfc'),require(_0xaad8('0xfd')));_0x398fde['use'](_0xaad8('0xfe'),require(_0xaad8('0xff')));_0x398fde[_0xaad8('0x7')]('/api/version',require(_0xaad8('0x100')));_0x398fde[_0xaad8('0x7')](_0xaad8('0x101'),require('./api/system'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x102'),require('./api/pm2'));_0x398fde[_0xaad8('0x7')](_0xaad8('0x103'),require(_0xaad8('0x104')));_0x398fde[_0xaad8('0x7')]('/api/logs',clientSideLogs);_0x398fde['use'](_0xaad8('0x105'),express[_0xaad8('0x106')](path[_0xaad8('0x107')](config[_0xaad8('0x108')],_0xaad8('0x105'))));_0x398fde['use']('/www',express['static'](path[_0xaad8('0x107')](config['root'],'/www')));_0x398fde[_0xaad8('0x7')]('/demo',express[_0xaad8('0x106')](path['join'](config[_0xaad8('0x108')],_0xaad8('0x109'))));_0x398fde['use'](_0xaad8('0x10a'),express[_0xaad8('0x106')](path[_0xaad8('0x107')](config[_0xaad8('0x108')],_0xaad8('0x10b'),'3.5.0')));_0x398fde[_0xaad8('0x7')]('/plugins',express[_0xaad8('0x106')](path[_0xaad8('0x107')](config[_0xaad8('0x108')],_0xaad8('0x10c'))));_0x398fde[_0xaad8('0x10d')](_0xaad8('0x10e'))[_0xaad8('0x10f')](errors[0x194]);_0x398fde[_0xaad8('0x10d')]('/*')[_0xaad8('0x10f')](function(_0xda1b30,_0x5ed968){_0x5ed968['sendFile'](path[_0xaad8('0x110')](_0x398fde[_0xaad8('0x10f')](_0xaad8('0x111'))+_0xaad8('0x112')));});return _0x398fde;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0ed39d4..50b0a1e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1da9=['../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.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/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc'];(function(_0x5f1011,_0xea0f25){var _0x1e5228=function(_0x15ee13){while(--_0x15ee13){_0x5f1011['push'](_0x5f1011['shift']());}};_0x1e5228(++_0xea0f25);}(_0x1da9,0x141));var _0x91da=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1da9[_0x5ddb1c];return _0x354adc;};'use strict';var jayson=require(_0x91da('0x0'));var _=require(_0x91da('0x1'));var config=require(_0x91da('0x2'));exports[_0x91da('0x3')]=function(){return new Promise(function(_0x18bb47,_0x3bb4f8){var _0x2526ae={};_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x5')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x6')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x7')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x8')));_0x2526ae=_['merge'](_0x2526ae,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x9')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0xa')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0xb')));_0x2526ae=_['merge'](_0x2526ae,require(_0x91da('0xc')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0xd')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0xe')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0xf')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x10')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x11')));_0x2526ae=_['merge'](_0x2526ae,require(_0x91da('0x12')));_0x2526ae=_['merge'](_0x2526ae,require(_0x91da('0x13')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x14')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x15')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x16')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x17')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x18')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x19')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x1a')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x1b')));_0x2526ae=_['merge'](_0x2526ae,require(_0x91da('0x1c')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/smsQueue/smsQueue.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x1d')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x1e')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x1f')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x20')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x21')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x22')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x23')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x24')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x25')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x26')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x27')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/interval/interval.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/pause/pause.rpc'));_0x2526ae=_['merge'](_0x2526ae,require(_0x91da('0x28')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x29')));_0x2526ae=_['merge'](_0x2526ae,require(_0x91da('0x2a')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x2b')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x2c')));_0x2526ae=_['merge'](_0x2526ae,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x2d')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x2e')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x2f')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x30')));_0x2526ae=_['merge'](_0x2526ae,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x31')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x32')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x33')));_0x2526ae=_['merge'](_0x2526ae,require(_0x91da('0x34')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x35')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x36')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x37')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x38')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/squareProject/squareProject.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x39')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x3a')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x3b')));_0x2526ae=_['merge'](_0x2526ae,require('../api/attachment/attachment.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x3c')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x3d')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x3e')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x3f')));_0x2526ae=_[_0x91da('0x4')](_0x2526ae,require(_0x91da('0x40')));var _0x264356=jayson[_0x91da('0x41')](_0x2526ae)[_0x91da('0x42')]();var _0x2f5bb4=config['rpc']['port']||config[_0x91da('0x43')]+0x1;var _0x37d06d=config[_0x91da('0x44')]['ip']||_0x91da('0x45');_0x264356['on'](_0x91da('0x46'),function(_0x445d02){return _0x3bb4f8(_0x445d02);});_0x264356[_0x91da('0x3')](_0x2f5bb4,_0x37d06d,function(){console['log'](_0x91da('0x47'),_0x37d06d,_0x2f5bb4);require(_0x91da('0x48'))[_0x91da('0x49')]();return _0x18bb47('RPC\x20listening\x20on\x20'+_0x37d06d+':'+_0x2f5bb4);});});}; \ No newline at end of file +var _0x808f=['../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.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/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc'];(function(_0x4e40b6,_0x30d1c2){var _0x5438bb=function(_0x1abde7){while(--_0x1abde7){_0x4e40b6['push'](_0x4e40b6['shift']());}};_0x5438bb(++_0x30d1c2);}(_0x808f,0x1ea));var _0xf808=function(_0x2aa041,_0x46d6f1){_0x2aa041=_0x2aa041-0x0;var _0x4d0c80=_0x808f[_0x2aa041];return _0x4d0c80;};'use strict';var jayson=require('jayson/promise');var _=require(_0xf808('0x0'));var config=require(_0xf808('0x1'));exports['listen']=function(){return new Promise(function(_0x526ef8,_0x19ba9c){var _0x59d101={};_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x3')));_0x59d101=_['merge'](_0x59d101,require('../api/voiceExtension/voiceExtension.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x4')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/voiceRecording/voiceRecording.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x5')));_0x59d101=_['merge'](_0x59d101,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x6')));_0x59d101=_['merge'](_0x59d101,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/memberReport/memberReport.rpc'));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x7')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x8')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x9')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0xa')));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0xb')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0xc')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0xd')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0xe')));_0x59d101=_['merge'](_0x59d101,require('../api/mailApplication/mailApplication.rpc'));_0x59d101=_['merge'](_0x59d101,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0xf')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x10')));_0x59d101=_['merge'](_0x59d101,require('../api/faxInteraction/faxInteraction.rpc'));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x11')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x12')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x13')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x14')));_0x59d101=_['merge'](_0x59d101,require('../api/smsMessage/smsMessage.rpc'));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x15')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x16')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x17')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x18')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/chatInteraction/chatInteraction.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x19')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x1a')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x1b')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x1c')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x1d')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x1e')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x1f')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x20')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x21')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/template/template.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/trigger/trigger.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/variable/variable.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x22')));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x23')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x24')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x25')));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x26')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x27')));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x28')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x29')));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x2a')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x2b')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x2c')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x2d')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x2e')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x2f')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x30')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x31')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x32')));_0x59d101=_['merge'](_0x59d101,require(_0xf808('0x33')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x34')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x35')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x36')));_0x59d101=_[_0xf808('0x2')](_0x59d101,require(_0xf808('0x37')));var _0x27c858=jayson[_0xf808('0x38')](_0x59d101)['http']();var _0x44bb54=config[_0xf808('0x39')][_0xf808('0x3a')]||config['port']+0x1;var _0x3a2d53=config[_0xf808('0x39')]['ip']||_0xf808('0x3b');_0x27c858['on'](_0xf808('0x3c'),function(_0x44d0ee){return _0x19ba9c(_0x44d0ee);});_0x27c858[_0xf808('0x3d')](_0x44bb54,_0x3a2d53,function(){console['log'](_0xf808('0x3e'),_0x3a2d53,_0x44bb54);require(_0xf808('0x3f'))['default']();return _0x526ef8(_0xf808('0x40')+_0x3a2d53+':'+_0x44bb54);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 3e650f2..cc2acaa 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 _0x05f9=['SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','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','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','split','length','match','error','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','function','close','destroy','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber'];(function(_0x22cc36,_0x2c8292){var _0x7fc85=function(_0x4e476d){while(--_0x4e476d){_0x22cc36['push'](_0x22cc36['shift']());}};_0x7fc85(++_0x2c8292);}(_0x05f9,0x101));var _0x905f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x05f9[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x905f('0x0'));var _=require(_0x905f('0x1'));var EventEmitter=require('events')[_0x905f('0x2')];var AGIReply=require(_0x905f('0x3'));var AGIError=require(_0x905f('0x4'));function AGIChannel(_0x5111a2){var _0x259260=this,_0x4ae1a9=new AGIReply(),_0x4eb634=![],_0x1c623b={};EventEmitter[_0x905f('0x5')](_0x259260);_0x5111a2[_0x905f('0x6')]('utf8');_0x5111a2[_0x905f('0x7')](0x8*0x3c*0x3c*0x3e8);_0x4ae1a9[_0x905f('0x6')](_0x905f('0x8'));_0x4ae1a9['on'](_0x905f('0x9'),function(_0x2b43b3){for(var _0x17eee2 in _0x2b43b3){_0x259260[_0x17eee2]=_0x2b43b3[_0x17eee2];}_0x259260[_0x905f('0xa')](_0x905f('0xb'));});_0x4ae1a9['on'](_0x905f('0xc'),function(_0x5141e5){if(_0x5141e5[_0x905f('0xd')]()==_0x905f('0xe')){_0x259260[_0x905f('0xa')](_0x905f('0xe'));return;}if(_0x5141e5[_0x905f('0xf')](0x0,0xb)=='520-Invalid'){_0x4eb634=!![];}if(_0x4eb634){_0x1c623b['rx']+=_0x5141e5+'\x0a';if(_0x5141e5['search'](_0x905f('0x10'))!=-0x1){_0x4eb634=![];}}else{_0x1c623b['rx']=_0x5141e5;}if(_0x4eb634){return;}if(typeof _0x1c623b['cb']=='function'){var _0x235c8f=_0x1c623b['rx'][_0x905f('0xf')](0x0,0x3),_0x51e694=null,_0x1a86ed=null;_0x235c8f=parseInt(_0x235c8f);if(isNaN(_0x235c8f)){_0x1c623b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x905f('0x11')});return;}if(_0x235c8f!=0xc8){_0x1c623b['cb'](null,{'code':_0x235c8f,'result':-0x1,'extra':'KO'});return;}_0x51e694=_0x1c623b['rx'][_0x905f('0xf')](0x4)[_0x905f('0x12')](_0x905f('0x13'),'');if(_0x51e694[_0x905f('0x14')]('\x20')!=-0x1){_0x51e694=_0x51e694[_0x905f('0x15')](0x0,_0x51e694['indexOf']('\x20'));}if(_['startsWith'](_0x51e694,'-1')){_0x51e694=parseInt(_0x51e694);}_0x1a86ed=_0x1c623b['rx'][_0x905f('0x16')]('\x20');if(_0x1a86ed['length']==0x3){_0x1a86ed=_0x1a86ed[0x2][_0x905f('0xf')](0x1,_0x1a86ed[0x2][_0x905f('0x17')]-0x1);}else if(_0x1a86ed[_0x905f('0x17')]>0x3){var _0x50f0fa=/\((.+)\)/;var _0x414d08=_0x1c623b['rx'][_0x905f('0x18')](_0x50f0fa);if(_0x414d08){_0x1a86ed=_0x414d08[0x1];}else{_0x1a86ed=null;}}else{_0x1a86ed=null;}_0x1c623b['cb'](null,{'code':_0x235c8f,'result':_0x51e694,'extra':_0x1a86ed});}});_0x5111a2['on'](_0x905f('0x19'),function(_0xc31bb4){_0x259260[_0x905f('0xa')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0xc31bb4[_0x905f('0x1a')]));});_0x5111a2['on']('close',function(){_0x259260[_0x905f('0xa')]('close',new AGIError(_0x905f('0x1b')));});_0x5111a2['on'](_0x905f('0x1c'),function(){_0x259260[_0x905f('0xa')]('timeout',new AGIError(_0x905f('0x1d')));_0x5111a2['destroy']();});_0x5111a2[_0x905f('0x1e')](_0x4ae1a9);this['command']=function(_0x42f03e,_0x15bf22){var _0x42f03e=_0x42f03e||'',_0x15bf22=typeof _0x15bf22==_0x905f('0x1f')?_0x15bf22:new Function();_0x1c623b={'tx':_0x42f03e,'rx':'','cb':_0x15bf22};_0x5111a2['write'](_0x42f03e+'\x0a');},this[_0x905f('0x20')]=function(){_0x5111a2[_0x905f('0x21')]();};}util[_0x905f('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x905f('0x23')][_0x905f('0x24')]=function(_0xb3964d){return this[_0x905f('0x25')][_0x905f('0x26')](this,_0xb3964d);};AGIChannel[_0x905f('0x23')][_0x905f('0x27')]=function(){return this[_0x905f('0x24')](_0x905f('0x28'));};AGIChannel['prototype'][_0x905f('0x29')]=function(_0x31b895,_0x275caf,_0x4cbeeb){_0x31b895=_0x31b895===undefined?_0x905f('0x2a'):_0x31b895;_0x275caf=_0x275caf===undefined?'5':_0x275caf;_0x4cbeeb=_0x4cbeeb===undefined?'1':_0x4cbeeb;return this['sendRequest'](util[_0x905f('0x2b')](_0x905f('0x2c'),_0x31b895,_0x275caf*0x3e8,_0x4cbeeb));};AGIChannel['prototype'][_0x905f('0x2d')]=function(_0x243339){_0x243339=_0x243339||_0x905f('0x2e');return this['sendRequest'](util[_0x905f('0x2b')](_0x905f('0x2f'),_0x243339));};AGIChannel['prototype'][_0x905f('0x30')]=function(_0xa9e8c2,_0x393fa2){if(_['isArray'](_0x393fa2)){return this[_0x905f('0x24')](util['format'](_0x905f('0x31'),_0xa9e8c2,_0x393fa2[_0x905f('0x32')](',')));}return this[_0x905f('0x24')](util[_0x905f('0x2b')](_0x905f('0x31'),_0xa9e8c2,_0x393fa2));};AGIChannel[_0x905f('0x23')][_0x905f('0x33')]=function(_0x218ca9){return this[_0x905f('0x24')](util[_0x905f('0x2b')](_0x905f('0x34'),_0x218ca9));};AGIChannel[_0x905f('0x23')][_0x905f('0x35')]=function(_0x57fed7){return this[_0x905f('0x24')](util[_0x905f('0x2b')](_0x905f('0x36'),_0x57fed7));};AGIChannel[_0x905f('0x23')][_0x905f('0x37')]=function(_0x5b73d8){return this[_0x905f('0x24')](util['format'](_0x905f('0x38'),_0x5b73d8));};AGIChannel['prototype'][_0x905f('0xe')]=function(){return this[_0x905f('0x24')](_0x905f('0x39'));};AGIChannel['prototype'][_0x905f('0x3a')]=function(_0x233897,_0xd7c14a){var _0x3effa8=_[_0x905f('0x3b')](_0xd7c14a)||_[_0x905f('0x3c')](_0xd7c14a)?_0xd7c14a[_0x905f('0x3d')]():_0xd7c14a;return this['sendRequest'](util[_0x905f('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x233897,_0x3effa8?_0x3effa8['toString']()[_0x905f('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x905f('0x3e')]=function(_0x2f4f77,_0x4994dd){return this[_0x905f('0x24')](util[_0x905f('0x2b')](_0x905f('0x3f'),_0x2f4f77,_0x4994dd));};AGIChannel[_0x905f('0x23')][_0x905f('0x40')]=function(_0x50d6e2,_0x33d37b){return this['sendRequest'](util[_0x905f('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x50d6e2,_0x33d37b));};AGIChannel[_0x905f('0x23')][_0x905f('0x41')]=function(_0x154c01,_0x2bd731){return this['sendRequest'](util[_0x905f('0x2b')](_0x905f('0x42'),_0x154c01,_0x2bd731));};AGIChannel[_0x905f('0x23')][_0x905f('0x43')]=function(_0x5da780,_0x31a065,_0x5b9cea){_0x31a065=_0x31a065||this[_0x905f('0x44')];_0x5b9cea=_0x5b9cea||0x1;this['setContext'](_0x5da780);this[_0x905f('0x35')](_0x31a065);this[_0x905f('0x37')](_0x5b9cea);return this[_0x905f('0x2d')](util[_0x905f('0x2b')](_0x905f('0x45'),_0x5da780,_0x31a065,_0x5b9cea));};AGIChannel[_0x905f('0x23')][_0x905f('0x46')]=function(_0x1175b2){return this[_0x905f('0x24')](util[_0x905f('0x2b')](_0x905f('0x47'),_0x1175b2));};AGIChannel[_0x905f('0x23')][_0x905f('0x48')]=function(_0xe4c0ed,_0x3529f3,_0x5e917e,_0x500457,_0x35ca6f,_0x41cfa2){_0x3529f3=_0x3529f3||'wav';_0x5e917e=_0x5e917e||'';_0x500457=_0x500457===undefined?-0x1:_0x500457==='-1'?-0x1:_0x500457*0x3e8;_0x35ca6f=_0x35ca6f===undefined?'':'s='+_0x35ca6f;_0x41cfa2=_0x41cfa2?'BEEP':'';return this['sendRequest'](util[_0x905f('0x2b')](_0x905f('0x49'),_0xe4c0ed,_0x3529f3,_0x5e917e,_0x500457,_0x41cfa2,_0x35ca6f));};AGIChannel[_0x905f('0x23')]['streamFile']=function(_0x50edff,_0x3e49aa){_0x3e49aa=_0x3e49aa||'';return this[_0x905f('0x24')](util['format'](_0x905f('0x4a'),_0x50edff,_0x3e49aa));};AGIChannel[_0x905f('0x23')][_0x905f('0x4b')]=function(_0x96dbfb){return this[_0x905f('0x30')](_0x905f('0x4c'),_0x96dbfb);};AGIChannel[_0x905f('0x23')][_0x905f('0x4d')]=function(_0x367d47){return this[_0x905f('0x30')](_0x905f('0x4e'),_0x367d47);};AGIChannel['prototype'][_0x905f('0x19')]=function(_0x394978,_0x22d928){this[_0x905f('0x2d')](util[_0x905f('0x2b')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x394978['id'],_0x394978['label'],_0x22d928));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x905f('0x4f')]=AGIChannel; \ No newline at end of file +var _0x1be0=['prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x1be0,0x16b));var _0x01be=function(_0x198e7f,_0x1fbfb4){_0x198e7f=_0x198e7f-0x0;var _0x4e854e=_0x1be0[_0x198e7f];return _0x4e854e;};'use strict';var util=require('util');var _=require(_0x01be('0x0'));var EventEmitter=require(_0x01be('0x1'))[_0x01be('0x2')];var AGIReply=require(_0x01be('0x3'));var AGIError=require('./error');function AGIChannel(_0x2fab52){var _0x225de0=this,_0x3b9df4=new AGIReply(),_0xd632ab=![],_0x53a68b={};EventEmitter[_0x01be('0x4')](_0x225de0);_0x2fab52[_0x01be('0x5')]('utf8');_0x2fab52['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x3b9df4[_0x01be('0x5')](_0x01be('0x6'));_0x3b9df4['on'](_0x01be('0x7'),function(_0x478a41){for(var _0x17f9ad in _0x478a41){_0x225de0[_0x17f9ad]=_0x478a41[_0x17f9ad];}_0x225de0[_0x01be('0x8')](_0x01be('0x9'));});_0x3b9df4['on'](_0x01be('0xa'),function(_0x55d716){if(_0x55d716['toLowerCase']()=='hangup'){_0x225de0[_0x01be('0x8')](_0x01be('0xb'));return;}if(_0x55d716[_0x01be('0xc')](0x0,0xb)==_0x01be('0xd')){_0xd632ab=!![];}if(_0xd632ab){_0x53a68b['rx']+=_0x55d716+'\x0a';if(_0x55d716[_0x01be('0xe')](_0x01be('0xf'))!=-0x1){_0xd632ab=![];}}else{_0x53a68b['rx']=_0x55d716;}if(_0xd632ab){return;}if(typeof _0x53a68b['cb']==_0x01be('0x10')){var _0x6146b5=_0x53a68b['rx'][_0x01be('0xc')](0x0,0x3),_0x500b61=null,_0x5e4bb0=null;_0x6146b5=parseInt(_0x6146b5);if(isNaN(_0x6146b5)){_0x53a68b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x01be('0x11')});return;}if(_0x6146b5!=0xc8){_0x53a68b['cb'](null,{'code':_0x6146b5,'result':-0x1,'extra':'KO'});return;}_0x500b61=_0x53a68b['rx']['substring'](0x4)[_0x01be('0x12')]('result=','');if(_0x500b61[_0x01be('0x13')]('\x20')!=-0x1){_0x500b61=_0x500b61[_0x01be('0x14')](0x0,_0x500b61[_0x01be('0x13')]('\x20'));}if(_[_0x01be('0x15')](_0x500b61,'-1')){_0x500b61=parseInt(_0x500b61);}_0x5e4bb0=_0x53a68b['rx'][_0x01be('0x16')]('\x20');if(_0x5e4bb0[_0x01be('0x17')]==0x3){_0x5e4bb0=_0x5e4bb0[0x2][_0x01be('0xc')](0x1,_0x5e4bb0[0x2][_0x01be('0x17')]-0x1);}else if(_0x5e4bb0[_0x01be('0x17')]>0x3){var _0x1245b8=/\((.+)\)/;var _0x20f40c=_0x53a68b['rx'][_0x01be('0x18')](_0x1245b8);if(_0x20f40c){_0x5e4bb0=_0x20f40c[0x1];}else{_0x5e4bb0=null;}}else{_0x5e4bb0=null;}_0x53a68b['cb'](null,{'code':_0x6146b5,'result':_0x500b61,'extra':_0x5e4bb0});}});_0x2fab52['on'](_0x01be('0x19'),function(_0x4bb952){_0x225de0['emit']('error',new AGIError(_0x01be('0x1a'),_0x4bb952[_0x01be('0x1b')]));});_0x2fab52['on'](_0x01be('0x1c'),function(){_0x225de0['emit']('close',new AGIError(_0x01be('0x1d')));});_0x2fab52['on'](_0x01be('0x1e'),function(){_0x225de0[_0x01be('0x8')](_0x01be('0x1e'),new AGIError(_0x01be('0x1f')));_0x2fab52[_0x01be('0x20')]();});_0x2fab52[_0x01be('0x21')](_0x3b9df4);this[_0x01be('0x22')]=function(_0x1b5d9d,_0x6502c2){var _0x1b5d9d=_0x1b5d9d||'',_0x6502c2=typeof _0x6502c2==_0x01be('0x10')?_0x6502c2:new Function();_0x53a68b={'tx':_0x1b5d9d,'rx':'','cb':_0x6502c2};_0x2fab52[_0x01be('0x23')](_0x1b5d9d+'\x0a');},this[_0x01be('0x1c')]=function(){_0x2fab52[_0x01be('0x20')]();};}util[_0x01be('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x01be('0x25')][_0x01be('0x26')]=function(_0x3227ee){return this[_0x01be('0x22')][_0x01be('0x27')](this,_0x3227ee);};AGIChannel[_0x01be('0x25')][_0x01be('0x28')]=function(){return this[_0x01be('0x26')](_0x01be('0x29'));};AGIChannel[_0x01be('0x25')][_0x01be('0x2a')]=function(_0x4f32fc,_0x311d04,_0x1303d1){_0x4f32fc=_0x4f32fc===undefined?_0x01be('0x2b'):_0x4f32fc;_0x311d04=_0x311d04===undefined?'5':_0x311d04;_0x1303d1=_0x1303d1===undefined?'1':_0x1303d1;return this[_0x01be('0x26')](util[_0x01be('0x2c')](_0x01be('0x2d'),_0x4f32fc,_0x311d04*0x3e8,_0x1303d1));};AGIChannel[_0x01be('0x25')][_0x01be('0x2e')]=function(_0x25abb3){_0x25abb3=_0x25abb3||'NO\x20MESSAGE';return this['sendRequest'](util[_0x01be('0x2c')](_0x01be('0x2f'),_0x25abb3));};AGIChannel[_0x01be('0x25')]['exec']=function(_0x9ed8c3,_0x5d4894){if(_[_0x01be('0x30')](_0x5d4894)){return this[_0x01be('0x26')](util['format'](_0x01be('0x31'),_0x9ed8c3,_0x5d4894[_0x01be('0x32')](',')));}return this[_0x01be('0x26')](util['format'](_0x01be('0x31'),_0x9ed8c3,_0x5d4894));};AGIChannel['prototype'][_0x01be('0x33')]=function(_0x4900c9){return this[_0x01be('0x26')](util[_0x01be('0x2c')](_0x01be('0x34'),_0x4900c9));};AGIChannel[_0x01be('0x25')][_0x01be('0x35')]=function(_0x2d1126){return this[_0x01be('0x26')](util[_0x01be('0x2c')](_0x01be('0x36'),_0x2d1126));};AGIChannel['prototype'][_0x01be('0x37')]=function(_0x186724){return this['sendRequest'](util[_0x01be('0x2c')](_0x01be('0x38'),_0x186724));};AGIChannel['prototype'][_0x01be('0xb')]=function(){return this[_0x01be('0x26')](_0x01be('0x39'));};AGIChannel['prototype'][_0x01be('0x3a')]=function(_0x3ec271,_0x457d25){var _0x234329=_[_0x01be('0x3b')](_0x457d25)||_['isNumber'](_0x457d25)?_0x457d25[_0x01be('0x3c')]():_0x457d25;return this[_0x01be('0x26')](util['format'](_0x01be('0x3d'),_0x3ec271,_0x234329?_0x234329[_0x01be('0x3c')]()[_0x01be('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x2e32ef,_0x1be7a0){return this[_0x01be('0x26')](util[_0x01be('0x2c')](_0x01be('0x3e'),_0x2e32ef,_0x1be7a0));};AGIChannel['prototype'][_0x01be('0x3f')]=function(_0x4858df,_0x487e3b){return this[_0x01be('0x26')](util[_0x01be('0x2c')]('SAY\x20DIGITS\x20%s\x20%s',_0x4858df,_0x487e3b));};AGIChannel['prototype'][_0x01be('0x40')]=function(_0x489d22,_0x1bb5b1){return this[_0x01be('0x26')](util[_0x01be('0x2c')](_0x01be('0x41'),_0x489d22,_0x1bb5b1));};AGIChannel[_0x01be('0x25')][_0x01be('0x42')]=function(_0x604040,_0x17de40,_0x4ebbed){_0x17de40=_0x17de40||this[_0x01be('0x43')];_0x4ebbed=_0x4ebbed||0x1;this[_0x01be('0x33')](_0x604040);this[_0x01be('0x35')](_0x17de40);this[_0x01be('0x37')](_0x4ebbed);return this[_0x01be('0x2e')](util['format'](_0x01be('0x44'),_0x604040,_0x17de40,_0x4ebbed));};AGIChannel[_0x01be('0x25')][_0x01be('0x45')]=function(_0x1be4e2){return this[_0x01be('0x26')](util[_0x01be('0x2c')](_0x01be('0x46'),_0x1be4e2));};AGIChannel['prototype']['recordFile']=function(_0x3ee936,_0x343dab,_0x56a6c1,_0x29160a,_0x2c0967,_0x747b02){_0x343dab=_0x343dab||_0x01be('0x47');_0x56a6c1=_0x56a6c1||'';_0x29160a=_0x29160a===undefined?-0x1:_0x29160a==='-1'?-0x1:_0x29160a*0x3e8;_0x2c0967=_0x2c0967===undefined?'':'s='+_0x2c0967;_0x747b02=_0x747b02?'BEEP':'';return this[_0x01be('0x26')](util[_0x01be('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3ee936,_0x343dab,_0x56a6c1,_0x29160a,_0x747b02,_0x2c0967));};AGIChannel[_0x01be('0x25')]['streamFile']=function(_0x4c3a47,_0xd162a4){_0xd162a4=_0xd162a4||'';return this[_0x01be('0x26')](util[_0x01be('0x2c')](_0x01be('0x48'),_0x4c3a47,_0xd162a4));};AGIChannel[_0x01be('0x25')][_0x01be('0x49')]=function(_0x4246dd){return this[_0x01be('0x4a')](_0x01be('0x4b'),_0x4246dd);};AGIChannel[_0x01be('0x25')]['wait']=function(_0x36f861){return this['exec'](_0x01be('0x4c'),_0x36f861);};AGIChannel['prototype'][_0x01be('0x19')]=function(_0x878731,_0x376404){this['noop'](util[_0x01be('0x2c')](_0x01be('0x4d'),_0x878731['id'],_0x878731[_0x01be('0x4e')],_0x376404));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x01be('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ba9d053..2ef52f7 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 _0x2593=['push','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x2593,0x15b));var _0x3259=function(_0x31cc0e,_0x24ba4c){_0x31cc0e=_0x31cc0e-0x0;var _0x144862=_0x2593[_0x31cc0e];return _0x144862;};'use strict';var util=require(_0x3259('0x0'));var error={'E_AGI_UNDEFINED':_0x3259('0x1'),'E_AGI_ARGUMENT_PORT':_0x3259('0x2'),'E_AGI_SERVER_ERROR':_0x3259('0x3'),'E_AGI_SERVER_CLOSE':_0x3259('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x3259('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x3259('0x6'),'E_AGI_SOCKET_ERROR':_0x3259('0x7'),'E_AGI_SOCKET_CLOSE':_0x3259('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x3259('0x9'),'E_AGI_COMMAND_EMPTY':_0x3259('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3259('0xb'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xc41944){var _0xc41944=_0xc41944||null,_0x250c4d=_0x250c4d||[],_0x503d01=0x1,_0x3453c7='';if(!error[_0xc41944]){_0xc41944=_0x3259('0xc');}_0x250c4d[_0x3259('0xd')](error[_0xc41944]);while(arguments[_0x503d01]){_0x250c4d[_0x3259('0xd')](arguments[_0x503d01]);_0x503d01++;}_0x3453c7=util['format']['apply'](util,_0x250c4d);this['message']=_0x3453c7;this['name']=_0xc41944;}module[_0x3259('0xe')]=AGIError; \ No newline at end of file +var _0x873e=['Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x35748b,_0x27f885){var _0x544082=function(_0x5074c7){while(--_0x5074c7){_0x35748b['push'](_0x35748b['shift']());}};_0x544082(++_0x27f885);}(_0x873e,0xc0));var _0xe873=function(_0x219b13,_0x28c391){_0x219b13=_0x219b13-0x0;var _0x19cd91=_0x873e[_0x219b13];return _0x19cd91;};'use strict';var util=require(_0xe873('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xe873('0x1'),'E_AGI_SERVER_ERROR':_0xe873('0x2'),'E_AGI_SERVER_CLOSE':_0xe873('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xe873('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xe873('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xe873('0x6'),'E_AGI_COMMAND_EMPTY':_0xe873('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe873('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x52c711){var _0x52c711=_0x52c711||null,_0x31377a=_0x31377a||[],_0x29b1e5=0x1,_0x1f3c72='';if(!error[_0x52c711]){_0x52c711='E_AGI_UNDEFINED';}_0x31377a['push'](error[_0x52c711]);while(arguments[_0x29b1e5]){_0x31377a[_0xe873('0x9')](arguments[_0x29b1e5]);_0x29b1e5++;}_0x1f3c72=util[_0xe873('0xa')][_0xe873('0xb')](util,_0x31377a);this[_0xe873('0xc')]=_0x1f3c72;this[_0xe873('0xd')]=_0x52c711;}module[_0xe873('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 0b0768c..d319efe 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19d5=['parse','projectUpdate','exports','events','EventEmitter','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message'];(function(_0x3c2a39,_0x4f42b3){var _0x3900a1=function(_0x21a9db){while(--_0x21a9db){_0x3c2a39['push'](_0x3c2a39['shift']());}};_0x3900a1(++_0x4f42b3);}(_0x19d5,0x153));var _0x519d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x19d5[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var EventEmitter=require(_0x519d('0x0'))[_0x519d('0x1')];var Redis=require('ioredis');var AGIError=require(_0x519d('0x2'));var config=require(_0x519d('0x3'));config[_0x519d('0x4')]=_[_0x519d('0x5')](config['redis'],{'host':_0x519d('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x519d('0x7')](_0x519d('0x8'),function(_0x519c5d){if(_0x519c5d)return eventEmitter[_0x519d('0x9')](_0x519d('0xa'),new AGIError(_0x519d('0xb'),_0x519c5d));});sub['on'](_0x519d('0xc'),function(_0x2ba101,_0x1e56df){if(_0x2ba101!==_0x519d('0x8'))return;try{var _0x2aeb09=JSON[_0x519d('0xd')](_0x1e56df);eventEmitter['emit'](_0x519d('0xe'),_0x2aeb09);}catch(_0x480900){eventEmitter[_0x519d('0x9')]('error',new AGIError(_0x519d('0xb'),_0x480900));}});module[_0x519d('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7a81=['error','E_AGI_SERVER_ERROR','parse','exports','lodash','events','EventEmitter','./error','../../config/environment','redis','localhost','subscribe','agi','emit'];(function(_0x286e97,_0x300e06){var _0x126fa9=function(_0x513e98){while(--_0x513e98){_0x286e97['push'](_0x286e97['shift']());}};_0x126fa9(++_0x300e06);}(_0x7a81,0xba));var _0x17a8=function(_0x3be791,_0x1c6814){_0x3be791=_0x3be791-0x0;var _0x5d2401=_0x7a81[_0x3be791];return _0x5d2401;};'use strict';var _=require(_0x17a8('0x0'));var EventEmitter=require(_0x17a8('0x1'))[_0x17a8('0x2')];var Redis=require('ioredis');var AGIError=require(_0x17a8('0x3'));var config=require(_0x17a8('0x4'));config[_0x17a8('0x5')]=_['defaults'](config['redis'],{'host':_0x17a8('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x17a8('0x5')]);sub[_0x17a8('0x7')](_0x17a8('0x8'),function(_0x2c2da1){if(_0x2c2da1)return eventEmitter[_0x17a8('0x9')](_0x17a8('0xa'),new AGIError(_0x17a8('0xb'),_0x2c2da1));});sub['on']('message',function(_0x1343eb,_0xfd6aab){if(_0x1343eb!=='agi')return;try{var _0x3477f7=JSON[_0x17a8('0xc')](_0xfd6aab);eventEmitter['emit']('projectUpdate',_0x3477f7);}catch(_0x353ae8){eventEmitter['emit'](_0x17a8('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x353ae8));}});module[_0x17a8('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 67d91cf..4acd6c5 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 _0x9529=['includes','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','target','invalid','default\x20on\x20switch\x20not\x20found'];(function(_0x202438,_0x21f696){var _0x43a7f1=function(_0x4359bb){while(--_0x4359bb){_0x202438['push'](_0x202438['shift']());}};_0x43a7f1(++_0x21f696);}(_0x9529,0x94));var _0x9952=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9529[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9952('0x0'));var logger=require(_0x9952('0x1'))(_0x9952('0x2'));var verticesWithRetry=[_0x9952('0x3'),_0x9952('0x4'),_0x9952('0x5')];var Graph=function(){this[_0x9952('0x6')]={};this[_0x9952('0x7')]={};this[_0x9952('0x8')]=0x0;};Graph[_0x9952('0x9')][_0x9952('0xa')]=function(_0x37e522){this[_0x9952('0x6')][_0x37e522['id']]=_0x37e522;this[_0x9952('0x7')][_0x37e522['id']]=[];};Graph[_0x9952('0x9')][_0x9952('0xb')]=function(_0x5093f9,_0x47dee8,_0x491735){this[_0x9952('0x7')][_0x5093f9]['push']({'target':_0x47dee8,'condition':_0x491735});this[_0x9952('0x8')]+=0x1;};Graph[_0x9952('0x9')][_0x9952('0xc')]=function(){return _[_0x9952('0xc')](this['vertices']);};Graph[_0x9952('0x9')]['relations']=function(){return this[_0x9952('0x8')];};Graph[_0x9952('0x9')][_0x9952('0xd')]=function(_0x366f9f){return this[_0x9952('0x6')][_0x366f9f];};Graph['prototype'][_0x9952('0xe')]=function(_0x2cc79d,_0x3d11ef){if(!this[_0x9952('0x6')][_0x2cc79d]){return logger[_0x9952('0xf')](_0x9952('0x10'));}var _0x298161=_0x3d11ef(this[_0x9952('0x6')][_0x2cc79d]);if(!_0x298161){return logger[_0x9952('0xf')](_0x9952('0x11'));}if(this['edges'][_0x2cc79d][_0x9952('0x12')]===0x0){return logger[_0x9952('0xf')](_0x9952('0x13'));}for(var _0x5d1d56=0x0,_0x3bb3e8=[],_0x4fc22a=![];_0x5d1d56\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','info','[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','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','../../config/environment','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','error','findIndex'];(function(_0x25f136,_0x5afe29){var _0x4e0c92=function(_0x2278e0){while(--_0x2278e0){_0x25f136['push'](_0x25f136['shift']());}};_0x4e0c92(++_0x5afe29);}(_0x82f1,0x70));var _0x182f=function(_0x17efe7,_0x2fa161){_0x17efe7=_0x17efe7-0x0;var _0x2cf3df=_0x82f1[_0x17efe7];return _0x2cf3df;};'use strict';var _=require(_0x182f('0x0'));var syncho=require(_0x182f('0x1'));var util=require('util');var config=require(_0x182f('0x2'));var logger=require('../../config/logger')(_0x182f('0x3'));var utilLicense=require(_0x182f('0x4'));var rpc=require(_0x182f('0x5'));var Project=require(_0x182f('0x6'));var AGIEmitter=require(_0x182f('0x7'))[_0x182f('0x8')];var projects=[];config['agi']=_[_0x182f('0x9')](config[_0x182f('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x182f('0xa'),projectUpdateHandler);function connectionHandler(_0xf43cab){process[_0x182f('0xb')](function(){syncho(function(){try{setChannelVariables(_0xf43cab);agiHandler(_0xf43cab);}catch(_0x4cc595){logger[_0x182f('0xc')](_0x4cc595['stack']);}});});}function projectUpdateHandler(_0x5f28f4){try{var _0x4c338e=_[_0x182f('0xd')](projects,['id',_0x5f28f4['id']]);if(_0x4c338e>-0x1){if(_0x5f28f4[_0x182f('0xe')]===!![]){projects[_0x182f('0xf')](_0x4c338e,0x1);}else{projects[_0x4c338e]=_0x5f28f4;}}else{projects[_0x182f('0x10')](_0x5f28f4);}}catch(_0x25eee9){logger[_0x182f('0xc')](_0x25eee9[_0x182f('0x11')]);}}function listeningHandler(){console[_0x182f('0x12')](_0x182f('0x13'),config['agi'][_0x182f('0x14')]);logger['info'](util[_0x182f('0x15')](_0x182f('0x16'),config['agi']['ip'],config[_0x182f('0x3')][_0x182f('0x14')]));}function errorHandler(_0xbc9861){if(_0xbc9861&&_0xbc9861[_0x182f('0x17')]&&_0xbc9861[_0x182f('0x18')]){logger[_0x182f('0xc')](util[_0x182f('0x15')](_0x182f('0x19'),_0xbc9861['name'],_0xbc9861[_0x182f('0x18')]));}else{logger[_0x182f('0xc')](util['format']('[ERROR]\x20%s',_0xbc9861['stack']));}}function closeHandler(){logger['info'](util['format'](_0x182f('0x1a'),this[_0x182f('0x1b')],this[_0x182f('0x1c')],this[_0x182f('0x1d')],this['dnid'],this[_0x182f('0x1e')]));try{createSquareReport(this);}catch(_0x390e89){logger['error'](_0x390e89[_0x182f('0x11')]);}}function timeoutHandler(){logger[_0x182f('0x1f')](util[_0x182f('0x15')](_0x182f('0x20'),this[_0x182f('0x1b')],this['calleridname'],this['callerid'],this[_0x182f('0x21')],this[_0x182f('0x1e')]));}function hangupHandler(){logger[_0x182f('0x1f')](util[_0x182f('0x15')](_0x182f('0x22'),this[_0x182f('0x1b')],this[_0x182f('0x1c')],this[_0x182f('0x1d')],this[_0x182f('0x21')],this[_0x182f('0x1e')]));this['evtHangup']=!![];}function createSquareReport(_0x3672ce,_0x489039){rpc[_0x182f('0x23')](_0x3672ce)[_0x182f('0x24')](function(_0x5e975b){if(_0x489039){_0x489039(null,_0x5e975b);}})[_0x182f('0x25')](function(_0x17273f){if(_0x489039){_0x489039(null,_0x17273f);}});}function setChannelVariables(_0x20e408){for(var _0x58aa70 in _0x20e408){if(_0x20e408[_0x182f('0x26')](_0x58aa70)){if(_0x58aa70['indexOf'](_0x182f('0x27'))===0x0){_0x20e408[_0x58aa70[_0x182f('0x28')](0x4)]=_0x20e408[_0x58aa70];delete _0x20e408[_0x58aa70];}}}}function agiHandler(_0x2992f2){logger[_0x182f('0x29')](_0x182f('0x2a'),JSON[_0x182f('0x2b')](_0x2992f2,null,0x2));logger[_0x182f('0x1f')](util['format'](_0x182f('0x2c'),_0x2992f2[_0x182f('0x1b')],_0x2992f2[_0x182f('0x1c')],_0x2992f2[_0x182f('0x1d')],_0x2992f2[_0x182f('0x21')],_0x2992f2[_0x182f('0x1e')]));_0x2992f2['on'](_0x182f('0xc'),errorHandler);_0x2992f2['on'](_0x182f('0x2d'),closeHandler);_0x2992f2['on']('timeout',timeoutHandler);_0x2992f2[_0x182f('0x2e')]=![];_0x2992f2['on']('hangup',hangupHandler);var _0xd4b45e=_[_0x182f('0x2f')](projects,['name',_0x2992f2[_0x182f('0x1b')]]);if(!_0xd4b45e)return Project[_0x182f('0x30')](_0x2992f2);if(!_0xd4b45e[_0x182f('0x31')])return Project['handleUnpublished'](_0x2992f2);return Project[_0x182f('0x32')](_0xd4b45e,_0x2992f2);}function main(){var _0x4633c;return utilLicense[_0x182f('0x33')]()[_0x182f('0x24')](function(_0x2f0176){if(!_0x2f0176)return;if(_0x2f0176[_0x182f('0x34')]){if(_0x2f0176[_0x182f('0x35')]&&_0x2f0176[_0x182f('0x35')]>0x0){logger[_0x182f('0x1f')](util[_0x182f('0x15')](_0x182f('0x36'),_0x2f0176[_0x182f('0x35')]));_0x4633c=_0x2f0176[_0x182f('0x35')];}else{logger[_0x182f('0x1f')](_0x182f('0x37'));}}else{logger['info'](_0x182f('0x38'));_0x4633c=-0x1;}})[_0x182f('0x24')](function(){return Project[_0x182f('0x39')]();})[_0x182f('0x24')](function(_0x217273){projects=_0x217273;return;})[_0x182f('0x25')](function(_0x4b7139){logger['error'](_0x182f('0x3a'),_0x4b7139['stack']);})[_0x182f('0x3b')](function(){var _0x1918d4=require(_0x182f('0x3c'))(config[_0x182f('0x3')][_0x182f('0x14')],config[_0x182f('0x3')]['ip'],_0x4633c);_0x1918d4['on'](_0x182f('0xc'),errorHandler);_0x1918d4['on'](_0x182f('0x3d'),listeningHandler);_0x1918d4['on'](_0x182f('0x3e'),connectionHandler);_0x1918d4['on'](_0x182f('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0x748a=['port','info','format','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','catch','indexOf','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','name','handleNotFound','production','handleUnpublished','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','lodash','util','../../config/environment','../../config/logger','agi','./events','EventEmitter','nextTick','error','stack','findIndex','deleted','push','log'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x748a,0x1bd));var _0xa748=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x748a[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xa748('0x0'));var syncho=require('syncho');var util=require(_0xa748('0x1'));var config=require(_0xa748('0x2'));var logger=require(_0xa748('0x3'))(_0xa748('0x4'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0xa748('0x5'))[_0xa748('0x6')];var projects=[];config[_0xa748('0x4')]=_['defaults'](config[_0xa748('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x3d4846){process[_0xa748('0x7')](function(){syncho(function(){try{setChannelVariables(_0x3d4846);agiHandler(_0x3d4846);}catch(_0x531efa){logger[_0xa748('0x8')](_0x531efa[_0xa748('0x9')]);}});});}function projectUpdateHandler(_0x513f02){try{var _0x5011f8=_[_0xa748('0xa')](projects,['id',_0x513f02['id']]);if(_0x5011f8>-0x1){if(_0x513f02[_0xa748('0xb')]===!![]){projects['splice'](_0x5011f8,0x1);}else{projects[_0x5011f8]=_0x513f02;}}else{projects[_0xa748('0xc')](_0x513f02);}}catch(_0x3d7923){logger[_0xa748('0x8')](_0x3d7923['stack']);}}function listeningHandler(){console[_0xa748('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xa748('0x4')][_0xa748('0xe')]);logger[_0xa748('0xf')](util[_0xa748('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xa748('0x4')]['ip'],config[_0xa748('0x4')][_0xa748('0xe')]));}function errorHandler(_0x3691f8){if(_0x3691f8&&_0x3691f8['name']&&_0x3691f8[_0xa748('0x11')]){logger['error'](util['format']('[%s]\x20%s',_0x3691f8['name'],_0x3691f8[_0xa748('0x11')]));}else{logger[_0xa748('0x8')](util[_0xa748('0x10')]('[ERROR]\x20%s',_0x3691f8[_0xa748('0x9')]));}}function closeHandler(){logger[_0xa748('0xf')](util[_0xa748('0x10')](_0xa748('0x12'),this[_0xa748('0x13')],this[_0xa748('0x14')],this['callerid'],this[_0xa748('0x15')],this[_0xa748('0x16')]));try{createSquareReport(this);}catch(_0x1ecad7){logger[_0xa748('0x8')](_0x1ecad7[_0xa748('0x9')]);}}function timeoutHandler(){logger[_0xa748('0xf')](util['format'](_0xa748('0x17'),this['arg_1'],this[_0xa748('0x14')],this[_0xa748('0x18')],this[_0xa748('0x15')],this[_0xa748('0x16')]));}function hangupHandler(){logger[_0xa748('0xf')](util[_0xa748('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa748('0x13')],this[_0xa748('0x14')],this[_0xa748('0x18')],this[_0xa748('0x15')],this[_0xa748('0x16')]));this['evtHangup']=!![];}function createSquareReport(_0x444383,_0x42ac81){rpc['createSquareReport'](_0x444383)['then'](function(_0x1b156c){if(_0x42ac81){_0x42ac81(null,_0x1b156c);}})[_0xa748('0x19')](function(_0x522bf3){if(_0x42ac81){_0x42ac81(null,_0x522bf3);}});}function setChannelVariables(_0x41f4e4){for(var _0x4b9ec2 in _0x41f4e4){if(_0x41f4e4['hasOwnProperty'](_0x4b9ec2)){if(_0x4b9ec2[_0xa748('0x1a')](_0xa748('0x1b'))===0x0){_0x41f4e4[_0x4b9ec2[_0xa748('0x1c')](0x4)]=_0x41f4e4[_0x4b9ec2];delete _0x41f4e4[_0x4b9ec2];}}}}function agiHandler(_0x520aef){logger[_0xa748('0x1d')]('variables',JSON[_0xa748('0x1e')](_0x520aef,null,0x2));logger['info'](util[_0xa748('0x10')](_0xa748('0x1f'),_0x520aef[_0xa748('0x13')],_0x520aef[_0xa748('0x14')],_0x520aef[_0xa748('0x18')],_0x520aef['dnid'],_0x520aef[_0xa748('0x16')]));_0x520aef['on'](_0xa748('0x8'),errorHandler);_0x520aef['on'](_0xa748('0x20'),closeHandler);_0x520aef['on'](_0xa748('0x21'),timeoutHandler);_0x520aef[_0xa748('0x22')]=![];_0x520aef['on'](_0xa748('0x23'),hangupHandler);var _0x5ab3b9=_['find'](projects,[_0xa748('0x24'),_0x520aef['arg_1']]);if(!_0x5ab3b9)return Project[_0xa748('0x25')](_0x520aef);if(!_0x5ab3b9[_0xa748('0x26')])return Project[_0xa748('0x27')](_0x520aef);return Project[_0xa748('0x28')](_0x5ab3b9,_0x520aef);}function main(){var _0x404258;return utilLicense['getLicense']()[_0xa748('0x29')](function(_0x9794d7){if(!_0x9794d7)return;if(_0x9794d7[_0xa748('0x2a')]){if(_0x9794d7[_0xa748('0x2b')]&&_0x9794d7[_0xa748('0x2b')]>0x0){logger[_0xa748('0xf')](util['format'](_0xa748('0x2c'),_0x9794d7[_0xa748('0x2b')]));_0x404258=_0x9794d7[_0xa748('0x2b')];}else{logger[_0xa748('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0xa748('0x2d'));_0x404258=-0x1;}})[_0xa748('0x29')](function(){return Project[_0xa748('0x2e')]();})[_0xa748('0x29')](function(_0x148446){projects=_0x148446;return;})['catch'](function(_0x211314){logger[_0xa748('0x8')](_0xa748('0x2f'),_0x211314['stack']);})[_0xa748('0x30')](function(){var _0x4b6071=require(_0xa748('0x31'))(config['agi'][_0xa748('0xe')],config[_0xa748('0x4')]['ip'],_0x404258);_0x4b6071['on'](_0xa748('0x8'),errorHandler);_0x4b6071['on'](_0xa748('0x32'),listeningHandler);_0x4b6071['on']('connection',connectionHandler);_0x4b6071['on'](_0xa748('0x20'),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 9e59dd7..43d296b 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 _0xa4d7=['sendMailMessage','SendMail','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xa4d7,0x86));var _0x7a4d=function(_0x250858,_0x4381dc){_0x250858=_0x250858-0x0;var _0x4ba9f8=_0xa4d7[_0x250858];return _0x4ba9f8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7a4d('0x0'));var client=jayson[_0x7a4d('0x1')][_0x7a4d('0x2')]({'port':0x232b});function request(_0xf16580,_0x5e053d){return new BPromise(function(_0x5dde85,_0x2b4170){return client[_0x7a4d('0x3')](_0xf16580,_0x5e053d)[_0x7a4d('0x4')](function(_0x304de3){if(_0x304de3[_0x7a4d('0x5')]){return _0x2b4170(_0x304de3[_0x7a4d('0x5')][_0x7a4d('0x6')]);}else{return _0x5dde85(_0x304de3[_0x7a4d('0x7')]);}})[_0x7a4d('0x8')](function(_0x3d9570){return _0x2b4170(_0x3d9570);});});}exports[_0x7a4d('0x9')]=function(_0x171406,_0x3d5fb6){return request(_0x7a4d('0xa'),{'account':_0x171406,'message':_0x3d5fb6});}; \ No newline at end of file +var _0x7c80=['http','request','then','error','result','catch','SendMail','bluebird','jayson/promise'];(function(_0x4ef555,_0x50d48a){var _0x2ad0ef=function(_0x2b7c77){while(--_0x2b7c77){_0x4ef555['push'](_0x4ef555['shift']());}};_0x2ad0ef(++_0x50d48a);}(_0x7c80,0x14b));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x07c8('0x0'));var jayson=require(_0x07c8('0x1'));var client=jayson['client'][_0x07c8('0x2')]({'port':0x232b});function request(_0x3a8c08,_0x1f37fa){return new BPromise(function(_0x5d3f88,_0x4d84a0){return client[_0x07c8('0x3')](_0x3a8c08,_0x1f37fa)[_0x07c8('0x4')](function(_0x571fc5){if(_0x571fc5[_0x07c8('0x5')]){return _0x4d84a0(_0x571fc5[_0x07c8('0x5')]['message']);}else{return _0x5d3f88(_0x571fc5[_0x07c8('0x6')]);}})[_0x07c8('0x7')](function(_0x1b7928){return _0x4d84a0(_0x1b7928);});});}exports['sendMailMessage']=function(_0x361e88,_0x2b0ec6){return request(_0x07c8('0x8'),{'account':_0x361e88,'message':_0x2b0ec6});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 4be81c7..22bd908 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95d0=['response','code','result','toString','agicommand\x20not\x20found','finally','callerid','dnid','vertex','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','retry','maxRetry','addVertex','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','start','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','traverseBFS','clear','gotoc','context','extension','priority'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x95d0,0x104));var _0x095d=function(_0x2869d6,_0xd0e3ac){_0x2869d6=_0x2869d6-0x0;var _0x26d21d=_0x95d0[_0x2869d6];return _0x26d21d;};'use strict';var _=require(_0x095d('0x0'));var moment=require(_0x095d('0x1'));var parser=require('xml2json');var util=require('util');var logger=require(_0x095d('0x2'))(_0x095d('0x3'));var rpc=require('./rpc');var mailRpc=require(_0x095d('0x4'));var Graph=require(_0x095d('0x5'));var Vertices=require(_0x095d('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x095d('0x7')]()[_0x095d('0x8')](function(_0x423400){logger[_0x095d('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x423400[_0x095d('0xa')]);return[];});}function addVertex(_0x439c4b,_0x4677bc,_0x158b3f){_0x4677bc[_0x095d('0xb')]=_0x158b3f;if(_0x4677bc['hasOwnProperty'](_0x095d('0xc'))){_0x4677bc[_0x095d('0xd')]=parseInt(_0x4677bc[_0x095d('0xc')],0xa);}_0x439c4b[_0x095d('0xe')](_['omit'](_0x4677bc,_0x095d('0xf')));}function initGraph(_0x46b295,_0x319038){var _0x45933e=new Graph();for(var _0x2d4a69 in _0x46b295){if(_0x46b295[_0x095d('0x10')](_0x2d4a69)){if(_[_0x095d('0x11')](_0x46b295[_0x2d4a69])){for(var _0x3aca37=0x0;_0x3aca37<_0x46b295[_0x2d4a69][_0x095d('0x12')];_0x3aca37+=0x1){addVertex(_0x45933e,_0x46b295[_0x2d4a69][_0x3aca37],_0x2d4a69);}}else{addVertex(_0x45933e,_0x46b295[_0x2d4a69],_0x2d4a69);}}}for(var _0x298b41=0x0;_0x298b41<_0x319038[_0x095d('0x12')];_0x298b41+=0x1){if(_0x319038[_0x298b41][_0x095d('0x13')]&&_0x319038[_0x298b41][_0x095d('0x14')]){_0x45933e[_0x095d('0x15')](_0x319038[_0x298b41]['source'],_0x319038[_0x298b41][_0x095d('0x14')],_0x319038[_0x298b41][_0x095d('0x16')]);}}return _0x45933e;}function getRoot(_0x25664a){return parser[_0x095d('0x17')](_0x25664a,{'object':!![]})[_0x095d('0x18')]['root'];}function inspect(_0x51ca25){return util[_0x095d('0x19')](_0x51ca25,{'showHidden':![],'depth':null});}function initialize(_0x1300d7,_0x653ac6){var _0x9e8254=getRoot(_0x1300d7['production']);if(!_0x9e8254||!_0x9e8254[_0x095d('0x1a')])return;var _0xcba5ff,_0x46753c,_0x4edf90;logger[_0x095d('0x1b')](_0x095d('0x1c'),JSON[_0x095d('0x1d')](_0x9e8254,null,0x2));_0x653ac6[_0x095d('0x1e')]=moment()['format'](_0x095d('0x1f'));_0xcba5ff=initGraph(_[_0x095d('0x20')](_0x9e8254,_0x095d('0xf')),_0x9e8254[_0x095d('0xf')]);_0x46753c=new Vertices(_0x653ac6,rpc,mailRpc);logger[_0x095d('0x21')](util[_0x095d('0x22')](_0x095d('0x23'),_0x653ac6[_0x095d('0x24')],_0x653ac6[_0x095d('0x25')],_0x653ac6['callerid'],_0x653ac6['dnid'],_0x653ac6[_0x095d('0x26')]));_0xcba5ff[_0x095d('0x27')](_0x9e8254[_0x095d('0x1a')]['id'],function(_0xcdf8a7){try{_0xcdf8a7=_0x46753c[_0x095d('0x28')](_0xcdf8a7);logger[_0x095d('0x1b')]('vertex',JSON['stringify'](_0xcdf8a7,null,0x2));if(_0xcdf8a7[_0x095d('0xb')]===_0x095d('0x29')){logger[_0x095d('0x21')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x653ac6[_0x095d('0x2a')]=_0xcdf8a7[_0x095d('0x2a')]||_0x653ac6[_0x095d('0x2a')];_0x653ac6[_0x095d('0x2b')]=_0xcdf8a7['extension'];_0x653ac6['priority']=_0xcdf8a7[_0x095d('0x2c')]?_0xcdf8a7[_0x095d('0x2c')]-0x1:0x1;return null;}else if(_0xcdf8a7&&_0x46753c[_0xcdf8a7[_0x095d('0xb')]]){_0x4edf90=_0x46753c[_0xcdf8a7[_0x095d('0xb')]](_0xcdf8a7);logger[_0x095d('0x21')](_0x095d('0x2d'),JSON[_0x095d('0x1d')](_0x4edf90,null,0x2));if(_0x4edf90&&_0x4edf90[_0x095d('0x2e')]===AGI_CODE_SUCCESS&&_0x4edf90[_0x095d('0x2f')]!==AGI_RESULT_ERROR&&!_0x653ac6['evtHangup']){logger[_0x095d('0x1b')](_0x095d('0x2d'),inspect(_0x4edf90));return _['isUndefined'](_0x4edf90[_0x095d('0x2f')])?null:_0x4edf90[_0x095d('0x2f')][_0x095d('0x30')]();}else{logger['error']('response',inspect(_0x4edf90));return null;}}else{logger['error'](_0x095d('0x31'));return null;}}catch(_0x47beb3){logger['error'](_0x47beb3[_0x095d('0xa')]);return null;}});if(_0x9e8254[_0x095d('0x32')]){logger[_0x095d('0x21')](util[_0x095d('0x22')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x653ac6[_0x095d('0x24')],_0x653ac6[_0x095d('0x25')],_0x653ac6[_0x095d('0x33')],_0x653ac6[_0x095d('0x34')],_0x653ac6[_0x095d('0x26')]));_0xcba5ff[_0x095d('0x27')](_0x9e8254[_0x095d('0x32')]['id'],function(_0x69e242){try{_0x69e242=_0x46753c['clear'](_0x69e242);logger['debug'](_0x095d('0x35'),JSON[_0x095d('0x1d')](_0x69e242,null,0x2));if(_0x69e242&&_0x46753c[_0x69e242['agicommand']]){_0x4edf90=_0x46753c[_0x69e242[_0x095d('0xb')]](_0x69e242);if(_0x4edf90){logger[_0x095d('0x1b')]('response',inspect(_0x4edf90));return _[_0x095d('0x36')](_0x4edf90[_0x095d('0x2f')])?null:_0x4edf90['result'][_0x095d('0x30')]();}else{logger[_0x095d('0x9')](_0x095d('0x2d'),inspect(_0x4edf90));return null;}}else{logger[_0x095d('0x9')](_0x095d('0x31'));return null;}}catch(_0x4a81bb){logger[_0x095d('0x9')](_0x4a81bb[_0x095d('0xa')]);return null;}});}logger[_0x095d('0x21')](util[_0x095d('0x22')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x653ac6['arg_1'],_0x653ac6[_0x095d('0x25')],_0x653ac6[_0x095d('0x33')],_0x653ac6[_0x095d('0x34')],_0x653ac6[_0x095d('0x26')]));logger[_0x095d('0x21')](util[_0x095d('0x22')](_0x095d('0x37'),_0x653ac6['context'],_0x653ac6['extension'],parseInt(_0x653ac6['priority'],0xa)+0x1));_0x653ac6[_0x095d('0x38')](_0x653ac6[_0x095d('0x2a')],_0x653ac6[_0x095d('0x2b')],parseInt(_0x653ac6[_0x095d('0x2c')],0xa)+0x1);_0x653ac6[_0x095d('0x39')]();}function handleNotFound(_0x4f9e73){logger[_0x095d('0x9')](util[_0x095d('0x22')](_0x095d('0x3a'),_0x4f9e73[_0x095d('0x24')]));_0x4f9e73['continueAt'](_0x4f9e73[_0x095d('0x2a')],_0x4f9e73[_0x095d('0x2b')],parseInt(_0x4f9e73[_0x095d('0x2c')],0xa)+0x1);_0x4f9e73[_0x095d('0x39')]();}function handleUnpublished(_0x3a7024){logger[_0x095d('0x9')](util[_0x095d('0x22')](_0x095d('0x3b'),_0x3a7024[_0x095d('0x24')]));_0x3a7024[_0x095d('0x38')](_0x3a7024[_0x095d('0x2a')],_0x3a7024['extension'],parseInt(_0x3a7024[_0x095d('0x2c')],0xa)+0x1);_0x3a7024[_0x095d('0x39')]();}module[_0x095d('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x888e=['./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','length','source','target','value','mxGraphModel','root','production','start','debug','joinAt','format','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','stringify','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','exports','lodash','moment','xml2json','util','../../config/logger','agi'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x888e,0x1ac));var _0xe888=function(_0x1d705d,_0x1a51ea){_0x1d705d=_0x1d705d-0x0;var _0x3221f4=_0x888e[_0x1d705d];return _0x3221f4;};'use strict';var _=require(_0xe888('0x0'));var moment=require(_0xe888('0x1'));var parser=require(_0xe888('0x2'));var util=require(_0xe888('0x3'));var logger=require(_0xe888('0x4'))(_0xe888('0x5'));var rpc=require(_0xe888('0x6'));var mailRpc=require(_0xe888('0x7'));var Graph=require(_0xe888('0x8'));var Vertices=require(_0xe888('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe888('0xa')]()[_0xe888('0xb')](function(_0x32194){logger[_0xe888('0xc')](_0xe888('0xd'),_0x32194[_0xe888('0xe')]);return[];});}function addVertex(_0x3a086e,_0x27094e,_0x33bfd4){_0x27094e[_0xe888('0xf')]=_0x33bfd4;if(_0x27094e[_0xe888('0x10')](_0xe888('0x11'))){_0x27094e[_0xe888('0x12')]=parseInt(_0x27094e[_0xe888('0x11')],0xa);}_0x3a086e['addVertex'](_[_0xe888('0x13')](_0x27094e,'mxCell'));}function initGraph(_0x105b19,_0x2b1778){var _0x4f9722=new Graph();for(var _0x4a8374 in _0x105b19){if(_0x105b19[_0xe888('0x10')](_0x4a8374)){if(_['isArray'](_0x105b19[_0x4a8374])){for(var _0x4e2fcb=0x0;_0x4e2fcb<_0x105b19[_0x4a8374]['length'];_0x4e2fcb+=0x1){addVertex(_0x4f9722,_0x105b19[_0x4a8374][_0x4e2fcb],_0x4a8374);}}else{addVertex(_0x4f9722,_0x105b19[_0x4a8374],_0x4a8374);}}}for(var _0x239775=0x0;_0x239775<_0x2b1778[_0xe888('0x14')];_0x239775+=0x1){if(_0x2b1778[_0x239775][_0xe888('0x15')]&&_0x2b1778[_0x239775]['target']){_0x4f9722['addEdge'](_0x2b1778[_0x239775]['source'],_0x2b1778[_0x239775][_0xe888('0x16')],_0x2b1778[_0x239775][_0xe888('0x17')]);}}return _0x4f9722;}function getRoot(_0x4418ff){return parser['toJson'](_0x4418ff,{'object':!![]})[_0xe888('0x18')][_0xe888('0x19')];}function inspect(_0x142b4a){return util['inspect'](_0x142b4a,{'showHidden':![],'depth':null});}function initialize(_0x88421b,_0x49505b){var _0xd059ea=getRoot(_0x88421b[_0xe888('0x1a')]);if(!_0xd059ea||!_0xd059ea[_0xe888('0x1b')])return;var _0x127d7e,_0x3291b7,_0x5679e8;logger[_0xe888('0x1c')](_0xe888('0x19'),JSON['stringify'](_0xd059ea,null,0x2));_0x49505b[_0xe888('0x1d')]=moment()[_0xe888('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x127d7e=initGraph(_['omit'](_0xd059ea,_0xe888('0x1f')),_0xd059ea['mxCell']);_0x3291b7=new Vertices(_0x49505b,rpc,mailRpc);logger[_0xe888('0x20')](util['format'](_0xe888('0x21'),_0x49505b[_0xe888('0x22')],_0x49505b['calleridname'],_0x49505b['callerid'],_0x49505b[_0xe888('0x23')],_0x49505b[_0xe888('0x24')]));_0x127d7e[_0xe888('0x25')](_0xd059ea[_0xe888('0x1b')]['id'],function(_0x35fc4c){try{_0x35fc4c=_0x3291b7[_0xe888('0x26')](_0x35fc4c);logger['debug'](_0xe888('0x27'),JSON['stringify'](_0x35fc4c,null,0x2));if(_0x35fc4c['agicommand']===_0xe888('0x28')){logger[_0xe888('0x20')](_0xe888('0x29'));_0x49505b[_0xe888('0x2a')]=_0x35fc4c['context']||_0x49505b['context'];_0x49505b[_0xe888('0x2b')]=_0x35fc4c['extension'];_0x49505b[_0xe888('0x2c')]=_0x35fc4c['priority']?_0x35fc4c[_0xe888('0x2c')]-0x1:0x1;return null;}else if(_0x35fc4c&&_0x3291b7[_0x35fc4c[_0xe888('0xf')]]){_0x5679e8=_0x3291b7[_0x35fc4c[_0xe888('0xf')]](_0x35fc4c);logger[_0xe888('0x20')]('response',JSON[_0xe888('0x2d')](_0x5679e8,null,0x2));if(_0x5679e8&&_0x5679e8[_0xe888('0x2e')]===AGI_CODE_SUCCESS&&_0x5679e8[_0xe888('0x2f')]!==AGI_RESULT_ERROR&&!_0x49505b[_0xe888('0x30')]){logger[_0xe888('0x1c')](_0xe888('0x31'),inspect(_0x5679e8));return _[_0xe888('0x32')](_0x5679e8[_0xe888('0x2f')])?null:_0x5679e8[_0xe888('0x2f')][_0xe888('0x33')]();}else{logger[_0xe888('0xc')]('response',inspect(_0x5679e8));return null;}}else{logger[_0xe888('0xc')](_0xe888('0x34'));return null;}}catch(_0x262210){logger[_0xe888('0xc')](_0x262210[_0xe888('0xe')]);return null;}});if(_0xd059ea[_0xe888('0x35')]){logger[_0xe888('0x20')](util['format'](_0xe888('0x36'),_0x49505b[_0xe888('0x22')],_0x49505b[_0xe888('0x37')],_0x49505b['callerid'],_0x49505b[_0xe888('0x23')],_0x49505b['uniqueid']));_0x127d7e['traverseBFS'](_0xd059ea[_0xe888('0x35')]['id'],function(_0x3628d2){try{_0x3628d2=_0x3291b7[_0xe888('0x26')](_0x3628d2);logger[_0xe888('0x1c')](_0xe888('0x27'),JSON[_0xe888('0x2d')](_0x3628d2,null,0x2));if(_0x3628d2&&_0x3291b7[_0x3628d2[_0xe888('0xf')]]){_0x5679e8=_0x3291b7[_0x3628d2[_0xe888('0xf')]](_0x3628d2);if(_0x5679e8){logger[_0xe888('0x1c')](_0xe888('0x31'),inspect(_0x5679e8));return _[_0xe888('0x32')](_0x5679e8[_0xe888('0x2f')])?null:_0x5679e8[_0xe888('0x2f')][_0xe888('0x33')]();}else{logger[_0xe888('0xc')]('response',inspect(_0x5679e8));return null;}}else{logger['error'](_0xe888('0x34'));return null;}}catch(_0x2634b6){logger[_0xe888('0xc')](_0x2634b6[_0xe888('0xe')]);return null;}});}logger['info'](util[_0xe888('0x1e')](_0xe888('0x38'),_0x49505b[_0xe888('0x22')],_0x49505b[_0xe888('0x37')],_0x49505b['callerid'],_0x49505b[_0xe888('0x23')],_0x49505b[_0xe888('0x24')]));logger[_0xe888('0x20')](util[_0xe888('0x1e')](_0xe888('0x39'),_0x49505b['context'],_0x49505b['extension'],parseInt(_0x49505b[_0xe888('0x2c')],0xa)+0x1));_0x49505b[_0xe888('0x3a')](_0x49505b[_0xe888('0x2a')],_0x49505b[_0xe888('0x2b')],parseInt(_0x49505b['priority'],0xa)+0x1);_0x49505b['close']();}function handleNotFound(_0x1fd7f1){logger[_0xe888('0xc')](util[_0xe888('0x1e')](_0xe888('0x3b'),_0x1fd7f1[_0xe888('0x22')]));_0x1fd7f1[_0xe888('0x3a')](_0x1fd7f1[_0xe888('0x2a')],_0x1fd7f1['extension'],parseInt(_0x1fd7f1['priority'],0xa)+0x1);_0x1fd7f1['close']();}function handleUnpublished(_0x32ee14){logger['error'](util[_0xe888('0x1e')]('Project\x20%s\x20not\x20published',_0x32ee14[_0xe888('0x22')]));_0x32ee14[_0xe888('0x3a')](_0x32ee14[_0xe888('0x2a')],_0x32ee14[_0xe888('0x2b')],parseInt(_0x32ee14[_0xe888('0x2c')],0xa)+0x1);_0x32ee14[_0xe888('0x3c')]();}module[_0xe888('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 9f0537f..4030d0b 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 _0x0404=['split','slice','trim','emit','line','exports','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','toString','indexOf','substring','length'];(function(_0x29ccfc,_0x311422){var _0x4f919b=function(_0x5bd57b){while(--_0x5bd57b){_0x29ccfc['push'](_0x29ccfc['shift']());}};_0x4f919b(++_0x311422);}(_0x0404,0xf4));var _0x4040=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x0404[_0x5a7112];return _0x3147f7;};'use strict';var util=require('util');var Transform=require(_0x4040('0x0'))[_0x4040('0x1')];function AGIReply(_0x3787c5){Transform[_0x4040('0x2')](this,_0x3787c5);this[_0x4040('0x3')]='';this[_0x4040('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x4040('0x5')][_0x4040('0x6')]=function(_0x193ebe,_0x3109ca,_0x4b7cf6){var _0x1e9698='\x0a',_0x47ddbe=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x265f51=-0x1,_0x4abf2c=-0x1,_0x4af52a='',_0x3f8f5b=0x0,_0x163a69='',_0x13e3aa='';this[_0x4040('0x3')]+=_0x193ebe[_0x4040('0x7')]();_0x163a69=this[_0x4040('0x3')];if(!this['_inBody']){_0x3f8f5b=0x0;while(_0x47ddbe[_0x3f8f5b]){while((_0x4abf2c=_0x163a69[_0x4040('0x8')](_0x47ddbe[_0x3f8f5b]))!=-0x1){_0x4af52a=_0x47ddbe[_0x3f8f5b];_0x13e3aa=_0x163a69[_0x4040('0x9')](0x0,_0x4abf2c);_0x163a69=_0x163a69['substring'](_0x4abf2c+_0x4af52a[_0x4040('0xa')]);var _0x15a349=_0x13e3aa[_0x4040('0xb')](_0x1e9698),_0x492ebd=0x0,_0x13e651={},_0x6848fe='',_0x43c6e6='',_0x5ad97f=-0x1;while(_0x15a349[_0x492ebd]){_0x5ad97f=_0x15a349[_0x492ebd]['indexOf'](':');if(_0x5ad97f!=-0x1){_0x6848fe=_0x15a349[_0x492ebd][_0x4040('0xc')](0x0,_0x5ad97f)[_0x4040('0xd')]();_0x43c6e6=_0x15a349[_0x492ebd][_0x4040('0xc')](_0x5ad97f+0x1)['trim']();if(_0x6848fe[_0x4040('0xa')]>0x0){_0x13e651[_0x6848fe]=_0x43c6e6;}}else{}_0x492ebd++;}this[_0x4040('0xe')]('headers',_0x13e651);this['_inBody']=!![];}_0x3f8f5b++;}this['_localBuffer']=_0x163a69;}else{while((_0x265f51=_0x163a69[_0x4040('0x8')](_0x1e9698))!=-0x1){_0x13e3aa=_0x163a69[_0x4040('0x9')](0x0,_0x265f51);this[_0x4040('0xe')](_0x4040('0xf'),_0x13e3aa);_0x163a69=_0x163a69[_0x4040('0x9')](_0x265f51+_0x1e9698[_0x4040('0xa')]);}this[_0x4040('0x3')]=_0x163a69;}_0x4b7cf6();};module[_0x4040('0x10')]=AGIReply; \ No newline at end of file +var _0x6e69=['exports','util','Transform','call','_localBuffer','_inBody','prototype','_transform','toString','substring','length','split','indexOf','slice','trim','emit','headers'];(function(_0x182a35,_0x2ce245){var _0x1aac89=function(_0x47d42c){while(--_0x47d42c){_0x182a35['push'](_0x182a35['shift']());}};_0x1aac89(++_0x2ce245);}(_0x6e69,0x9a));var _0x96e6=function(_0x331580,_0x207b6b){_0x331580=_0x331580-0x0;var _0x155e37=_0x6e69[_0x331580];return _0x155e37;};'use strict';var util=require(_0x96e6('0x0'));var Transform=require('stream')[_0x96e6('0x1')];function AGIReply(_0x44c548){Transform[_0x96e6('0x2')](this,_0x44c548);this[_0x96e6('0x3')]='';this[_0x96e6('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x96e6('0x5')][_0x96e6('0x6')]=function(_0x3f1036,_0x3c09c7,_0x15b45c){var _0x55e4f5='\x0a',_0x3d5dd9=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x2cd016=-0x1,_0x3f4216=-0x1,_0x227d56='',_0x15bc74=0x0,_0xfe9123='',_0x21ec9e='';this[_0x96e6('0x3')]+=_0x3f1036[_0x96e6('0x7')]();_0xfe9123=this[_0x96e6('0x3')];if(!this[_0x96e6('0x4')]){_0x15bc74=0x0;while(_0x3d5dd9[_0x15bc74]){while((_0x3f4216=_0xfe9123['indexOf'](_0x3d5dd9[_0x15bc74]))!=-0x1){_0x227d56=_0x3d5dd9[_0x15bc74];_0x21ec9e=_0xfe9123[_0x96e6('0x8')](0x0,_0x3f4216);_0xfe9123=_0xfe9123['substring'](_0x3f4216+_0x227d56[_0x96e6('0x9')]);var _0x2a6de5=_0x21ec9e[_0x96e6('0xa')](_0x55e4f5),_0x34f1e3=0x0,_0x2e14cf={},_0x32b050='',_0x5b2c01='',_0x3ed67a=-0x1;while(_0x2a6de5[_0x34f1e3]){_0x3ed67a=_0x2a6de5[_0x34f1e3][_0x96e6('0xb')](':');if(_0x3ed67a!=-0x1){_0x32b050=_0x2a6de5[_0x34f1e3][_0x96e6('0xc')](0x0,_0x3ed67a)[_0x96e6('0xd')]();_0x5b2c01=_0x2a6de5[_0x34f1e3][_0x96e6('0xc')](_0x3ed67a+0x1)[_0x96e6('0xd')]();if(_0x32b050[_0x96e6('0x9')]>0x0){_0x2e14cf[_0x32b050]=_0x5b2c01;}}else{}_0x34f1e3++;}this[_0x96e6('0xe')](_0x96e6('0xf'),_0x2e14cf);this[_0x96e6('0x4')]=!![];}_0x15bc74++;}this['_localBuffer']=_0xfe9123;}else{while((_0x2cd016=_0xfe9123[_0x96e6('0xb')](_0x55e4f5))!=-0x1){_0x21ec9e=_0xfe9123[_0x96e6('0x8')](0x0,_0x2cd016);this['emit']('line',_0x21ec9e);_0xfe9123=_0xfe9123[_0x96e6('0x8')](_0x2cd016+_0x55e4f5['length']);}this[_0x96e6('0x3')]=_0xfe9123;}_0x15b45c();};module[_0x96e6('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 44dc02e..76b6406 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 _0x6873=['http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','UnpauseUser','agentLogout','jayson/promise','client'];(function(_0x26ac05,_0x5beb9d){var _0x2a09c4=function(_0x48407f){while(--_0x48407f){_0x26ac05['push'](_0x26ac05['shift']());}};_0x2a09c4(++_0x5beb9d);}(_0x6873,0xac));var _0x3687=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x6873[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x3687('0x0'));var client=jayson[_0x3687('0x1')][_0x3687('0x2')]({'port':0x2329});function request(_0x377799,_0x3be8a1){return new Promise(function(_0x4bbecf,_0x247d96){return client['request'](_0x377799,_0x3be8a1)[_0x3687('0x3')](function(_0x2a4f40){if(_0x2a4f40['error']){return _0x247d96(_0x2a4f40[_0x3687('0x4')][_0x3687('0x5')]);}else{return _0x4bbecf(_0x2a4f40[_0x3687('0x6')]);}})[_0x3687('0x7')](function(_0x143060){return _0x247d96(_0x143060);});});}exports[_0x3687('0x8')]=function(){return request(_0x3687('0x9'),{'options':{'raw':![],'attributes':['id',_0x3687('0xa'),_0x3687('0xb')]}});};exports['getSquareProject']=function(_0x32c490){return request(_0x3687('0xc'),{'options':{'raw':![],'where':{'name':_0x32c490},'attributes':['production']}});};exports[_0x3687('0xd')]=function(_0x3799ad){return request(_0x3687('0xe'),{'options':{'raw':![],'where':{'id':_0x3799ad},'include':[{'model':_0x3687('0xf'),'as':_0x3687('0x10'),'include':[{'model':'CloudProvider','as':_0x3687('0x11')}]}],'attributes':['id',_0x3687('0xa'),'email'],'smtp':!![]}});};exports[_0x3687('0x12')]=function(_0x2001c0){return request(_0x3687('0xc'),{'options':{'where':{'id':_0x2001c0},'attributes':[_0x3687('0xa')]}});};exports[_0x3687('0x13')]=function(_0x27c2be){return request(_0x3687('0x14'),{'options':{'where':{'id':_0x27c2be},'attributes':[_0x3687('0xa')]}});};exports[_0x3687('0x15')]=function(_0x4879d0){return request(_0x3687('0x16'),{'options':{'where':{'id':_0x4879d0},'attributes':[_0x3687('0xa')]}});};exports[_0x3687('0x17')]=function(_0x541726){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x541726},'attributes':[_0x3687('0x18')]}});};exports[_0x3687('0x19')]=function(_0x280158){return request(_0x3687('0x1a'),{'options':{'where':{'id':_0x280158},'attributes':[_0x3687('0xa')]}});};exports[_0x3687('0x1b')]=function(_0x531e0b){return request(_0x3687('0x1c'),{'options':{'where':{'phone':_0x531e0b[_0x3687('0x1d')]},'attributes':['id']}});};exports[_0x3687('0x1e')]=function(_0xbd6230){return request('ShowTrunk',{'options':{'where':{'id':_0xbd6230},'attributes':[_0x3687('0xa')]}});};exports['getSoundById']=function(_0x2f34b6){return request(_0x3687('0x1f'),{'options':{'where':{'id':_0x2f34b6},'attributes':[_0x3687('0x20')]}});};exports[_0x3687('0x21')]=function(_0x18b722){return request(_0x3687('0x22'),{'options':{'raw':![],'where':{'id':_0x18b722},'include':[{'model':_0x3687('0x23'),'as':_0x3687('0x24')}]}});};exports[_0x3687('0x25')]=function(_0x29ff98){return request(_0x3687('0x26'),{'options':{'where':{'id':_0x29ff98},'attributes':['id',_0x3687('0xa')]}});};exports[_0x3687('0x27')]=function(_0x203f09){return request('CreateSmsMessage',{'body':_0x203f09});};exports['createSquareDetailsReport']=function(_0x5f4420){return request(_0x3687('0x28'),{'body':_0x5f4420});};exports[_0x3687('0x29')]=function(_0x3e1e6a){return request(_0x3687('0x2a'),{'body':_[_0x3687('0x2b')](_0x3e1e6a,{'project_name':_0x3e1e6a[_0x3687('0x2c')],'prev_project_name':_0x3e1e6a[_0x3687('0x2d')]||'','is_subproject':_0x3e1e6a['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x3687('0x2e'))})});};exports['createSquareRecording']=function(_0x2f418f){return request(_0x3687('0x2f'),{'body':_0x2f418f});};exports['createSquareMessage']=function(_0x547d79){return request(_0x3687('0x30'),{'body':_0x547d79});};exports['createCmContact']=function(_0xb3d748){return request(_0x3687('0x31'),{'options':{'raw':![],'where':{'phone':_0xb3d748[_0x3687('0x1d')],'ListId':_0xb3d748[_0x3687('0x32')]}}})['then'](function(_0xc5b026){if(_0xc5b026){return _0xc5b026;}return request(_0x3687('0x33'),{'body':_0xb3d748});});};exports[_0x3687('0x34')]=function(_0x58d35c){return request(_0x3687('0x35'),{'options':{'where':{'id':_0x58d35c},'attributes':[_0x3687('0xa')]}});};exports[_0x3687('0x36')]=function(_0x260ccc,_0x2646e){return request(_0x3687('0x37'),{'body':{'interface':_0x2646e},'options':{'where':_0x260ccc}});};exports['agentPause']=function(_0x47beb9,_0x394f98,_0x2e44b7){return request('PauseUser',{'body':{'type':_0x394f98,'uniqueid':_0x2e44b7},'options':{'where':_0x47beb9}});};exports['agentUnpause']=function(_0x9a2516){return request(_0x3687('0x38'),{'body':{},'options':{'where':_0x9a2516}});};exports[_0x3687('0x39')]=function(_0x2aaa22){return request('LogoutUser',{'body':{},'options':{'where':_0x2aaa22}});}; \ No newline at end of file +var _0xf874=['CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','then','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x5b86f6,_0x417f9f){var _0x309a26=function(_0x4ac5b4){while(--_0x4ac5b4){_0x5b86f6['push'](_0x5b86f6['shift']());}};_0x309a26(++_0x417f9f);}(_0xf874,0x177));var _0x4f87=function(_0x298e42,_0x13c55e){_0x298e42=_0x298e42-0x0;var _0x53f5d1=_0xf874[_0x298e42];return _0x53f5d1;};'use strict';var _=require(_0x4f87('0x0'));var moment=require('moment');var jayson=require(_0x4f87('0x1'));var client=jayson[_0x4f87('0x2')][_0x4f87('0x3')]({'port':0x2329});function request(_0xe07d73,_0x18fe31){return new Promise(function(_0xe4464e,_0x87123d){return client['request'](_0xe07d73,_0x18fe31)[_0x4f87('0x4')](function(_0xe6e413){if(_0xe6e413['error']){return _0x87123d(_0xe6e413['error']['message']);}else{return _0xe4464e(_0xe6e413['result']);}})['catch'](function(_0x2aeac4){return _0x87123d(_0x2aeac4);});});}exports['getSquareProjects']=function(){return request(_0x4f87('0x5'),{'options':{'raw':![],'attributes':['id',_0x4f87('0x6'),_0x4f87('0x7')]}});};exports[_0x4f87('0x8')]=function(_0x4dfb28){return request(_0x4f87('0x9'),{'options':{'raw':![],'where':{'name':_0x4dfb28},'attributes':[_0x4f87('0x7')]}});};exports[_0x4f87('0xa')]=function(_0x1777bb){return request(_0x4f87('0xb'),{'options':{'raw':![],'where':{'id':_0x1777bb},'include':[{'model':_0x4f87('0xc'),'as':_0x4f87('0xd'),'include':[{'model':_0x4f87('0xe'),'as':_0x4f87('0xe')}]}],'attributes':['id',_0x4f87('0x6'),_0x4f87('0xf')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2ccfda){return request(_0x4f87('0x9'),{'options':{'where':{'id':_0x2ccfda},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x1dcbf9){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1dcbf9},'attributes':[_0x4f87('0x6')]}});};exports[_0x4f87('0x10')]=function(_0x24ac31){return request(_0x4f87('0x11'),{'options':{'where':{'id':_0x24ac31},'attributes':[_0x4f87('0x6')]}});};exports[_0x4f87('0x12')]=function(_0x3c327b){return request(_0x4f87('0x13'),{'options':{'where':{'id':_0x3c327b},'attributes':[_0x4f87('0x14')]}});};exports[_0x4f87('0x15')]=function(_0x3ffd7b){return request(_0x4f87('0x16'),{'options':{'where':{'id':_0x3ffd7b},'attributes':[_0x4f87('0x6')]}});};exports[_0x4f87('0x17')]=function(_0x8b401b){return request(_0x4f87('0x18'),{'options':{'where':{'phone':_0x8b401b[_0x4f87('0x19')]},'attributes':['id']}});};exports[_0x4f87('0x1a')]=function(_0x135f44){return request('ShowTrunk',{'options':{'where':{'id':_0x135f44},'attributes':[_0x4f87('0x6')]}});};exports[_0x4f87('0x1b')]=function(_0x4f1934){return request(_0x4f87('0x1c'),{'options':{'where':{'id':_0x4f1934},'attributes':[_0x4f87('0x1d')]}});};exports['getIntervalById']=function(_0x26ac97){return request(_0x4f87('0x1e'),{'options':{'raw':![],'where':{'id':_0x26ac97},'include':[{'model':_0x4f87('0x1f'),'as':_0x4f87('0x20')}]}});};exports['getSmsAccountById']=function(_0x2eded4){return request(_0x4f87('0x21'),{'options':{'where':{'id':_0x2eded4},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x345622){return request(_0x4f87('0x22'),{'body':_0x345622});};exports[_0x4f87('0x23')]=function(_0x1179eb){return request(_0x4f87('0x24'),{'body':_0x1179eb});};exports[_0x4f87('0x25')]=function(_0x23ce03){return request(_0x4f87('0x26'),{'body':_['merge'](_0x23ce03,{'project_name':_0x23ce03[_0x4f87('0x27')],'prev_project_name':_0x23ce03[_0x4f87('0x28')]||'','is_subproject':_0x23ce03[_0x4f87('0x28')]?!![]:![],'leaveAt':moment()[_0x4f87('0x29')](_0x4f87('0x2a'))})});};exports[_0x4f87('0x2b')]=function(_0x24d2bb){return request(_0x4f87('0x2c'),{'body':_0x24d2bb});};exports[_0x4f87('0x2d')]=function(_0x1d7421){return request(_0x4f87('0x2e'),{'body':_0x1d7421});};exports[_0x4f87('0x2f')]=function(_0x3c2b61){return request(_0x4f87('0x30'),{'options':{'raw':![],'where':{'phone':_0x3c2b61[_0x4f87('0x19')],'ListId':_0x3c2b61[_0x4f87('0x31')]}}})[_0x4f87('0x4')](function(_0x214a96){if(_0x214a96){return _0x214a96;}return request(_0x4f87('0x32'),{'body':_0x3c2b61});});};exports['getPauseById']=function(_0x3c8c8c){return request(_0x4f87('0x33'),{'options':{'where':{'id':_0x3c8c8c},'attributes':['name']}});};exports[_0x4f87('0x34')]=function(_0x331c52,_0x3a0046){return request(_0x4f87('0x35'),{'body':{'interface':_0x3a0046},'options':{'where':_0x331c52}});};exports[_0x4f87('0x36')]=function(_0x4bc337,_0x1c8e17,_0x370b0f){return request(_0x4f87('0x37'),{'body':{'type':_0x1c8e17,'uniqueid':_0x370b0f},'options':{'where':_0x4bc337}});};exports['agentUnpause']=function(_0x8df7f9){return request(_0x4f87('0x38'),{'body':{},'options':{'where':_0x8df7f9}});};exports[_0x4f87('0x39')]=function(_0x396e17){return request(_0x4f87('0x3a'),{'body':{},'options':{'where':_0x396e17}});}; \ 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 28cfe96..2a6156a 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 polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc1db=['./polly','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc1db,0x120));var _0xbc1d=function(_0x1bd4ac,_0x3aaac2){_0x1bd4ac=_0x1bd4ac-0x0;var _0x1bba58=_0xc1db[_0x1bd4ac];return _0x1bba58;};var polly=require(_0xbc1d('0x0'));var lex=require('./lex');module[_0xbc1d('0x1')]={'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 3d8290d..146a12f 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 _0xe5b5=['exports','./lib/api'];(function(_0x3607ff,_0x17cbd7){var _0x31dcbd=function(_0x28ca96){while(--_0x28ca96){_0x3607ff['push'](_0x3607ff['shift']());}};_0x31dcbd(++_0x17cbd7);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xe5b5[_0x35a140];return _0x30ab82;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ No newline at end of file +var _0x9c00=['./lib/api','exports'];(function(_0x7c5676,_0x46c0fd){var _0x3eefc6=function(_0x531498){while(--_0x531498){_0x7c5676['push'](_0x7c5676['shift']());}};_0x3eefc6(++_0x46c0fd);}(_0x9c00,0x1a0));var _0x09c0=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x9c00[_0x270adf];return _0x29eda9;};'use strict';var lex=require(_0x09c0('0x0'));module[_0x09c0('0x1')]=function(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c){return lex(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c);}; \ 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 07d457e..c475da5 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(_0x5a1800,_0x4dd4d2){var _0x1956e1=function(_0x3a5140){while(--_0x3a5140){_0x5a1800['push'](_0x5a1800['shift']());}};_0x1956e1(++_0x4dd4d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x4f1a14,_0x556aa0){var _0x432390=function(_0x47ce3c){while(--_0x47ce3c){_0x4f1a14['push'](_0x4f1a14['shift']());}};_0x432390(++_0x556aa0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index a8f9a68..dee0501 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 _0x4f61=['./lib/api'];(function(_0x71e0b8,_0x5746ea){var _0x4b9a96=function(_0x44e47b){while(--_0x44e47b){_0x71e0b8['push'](_0x71e0b8['shift']());}};_0x4b9a96(++_0x5746ea);}(_0x4f61,0xe5));var _0x14f6=function(_0x223982,_0x153cde){_0x223982=_0x223982-0x0;var _0x1a5b5e=_0x4f61[_0x223982];return _0x1a5b5e;};'use strict';var polly=require(_0x14f6('0x0'));module['exports']=function(_0x3ae4ef,_0x1b31de,_0x5dac44,_0x41055d,_0x34dfca,_0x598fdf,_0x51dff6){return polly(_0x3ae4ef,_0x1b31de,_0x5dac44,_0x41055d,_0x34dfca,_0x598fdf,_0x51dff6);}; \ No newline at end of file +var _0x5df9=['./lib/api','exports'];(function(_0x2950d9,_0x19b43d){var _0x1bb04c=function(_0x4742a9){while(--_0x4742a9){_0x2950d9['push'](_0x2950d9['shift']());}};_0x1bb04c(++_0x19b43d);}(_0x5df9,0x176));var _0x95df=function(_0x545bef,_0x212189){_0x545bef=_0x545bef-0x0;var _0x4cb90c=_0x5df9[_0x545bef];return _0x4cb90c;};'use strict';var polly=require(_0x95df('0x0'));module[_0x95df('0x1')]=function(_0x629234,_0xaa8a11,_0x39aaea,_0x3a4b83,_0x219256,_0x2adbdf,_0x508f06){return polly(_0x629234,_0xaa8a11,_0x39aaea,_0x3a4b83,_0x219256,_0x2adbdf,_0x508f06);}; \ 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 0210ae6..1b84853 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 _0x7050=['path','bluebird','randomstring','aws-sdk','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3'];(function(_0x3c5bd8,_0x507e6f){var _0x5ef18c=function(_0x10e623){while(--_0x10e623){_0x3c5bd8['push'](_0x3c5bd8['shift']());}};_0x5ef18c(++_0x507e6f);}(_0x7050,0x68));var _0x0705=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7050[_0x413feb];return _0x40ee88;};'use strict';var fs=require('fs');var path=require(_0x0705('0x0'));var BPromise=require(_0x0705('0x1'));var rs=require(_0x0705('0x2'));var AWS=require(_0x0705('0x3'));function pollyResult(_0x32a77c,_0x1f54ac,_0x199acc){return new BPromise(function(_0x3a9924,_0x459ebf){_0x32a77c['synthesizeSpeech'](_0x1f54ac,function(_0x1ca341,_0x131b07){if(_0x1ca341){_0x459ebf(_0x1ca341);}else if(_0x131b07){if(_0x131b07[_0x0705('0x4')]instanceof Buffer){fs['writeFile'](_0x199acc,_0x131b07[_0x0705('0x4')],function(_0x5d3c17){if(_0x5d3c17){_0x459ebf(_0x5d3c17);}else{_0x3a9924();}});}else{_0x459ebf(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x459ebf(new Error(_0x0705('0x5')));}});});}module['exports']=function(_0x3ee2bb,_0x212062,_0x406440,_0x198eae,_0x576e02,_0x2d7d0a,_0x3d3297){var _0x30bc49=new AWS['Polly']({'accessKeyId':_0x3ee2bb,'secretAccessKey':_0x212062,'region':_0x406440});var _0x591396={'Text':_0x576e02,'TextType':_0x2d7d0a||_0x0705('0x6'),'OutputFormat':_0x0705('0x7'),'VoiceId':_0x198eae};return pollyResult(_0x30bc49,_0x591396,_0x3d3297);}; \ No newline at end of file +var _0x8772=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','bluebird','aws-sdk'];(function(_0x4bb874,_0x37183c){var _0x316fb4=function(_0x1ee0f5){while(--_0x1ee0f5){_0x4bb874['push'](_0x4bb874['shift']());}};_0x316fb4(++_0x37183c);}(_0x8772,0x116));var _0x2877=function(_0x2b2d5b,_0x4a2fb1){_0x2b2d5b=_0x2b2d5b-0x0;var _0x80b73f=_0x8772[_0x2b2d5b];return _0x80b73f;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x2877('0x0'));var rs=require('randomstring');var AWS=require(_0x2877('0x1'));function pollyResult(_0x5bdcc6,_0x59f572,_0x33675f){return new BPromise(function(_0x41e8a6,_0x3ce2a9){_0x5bdcc6['synthesizeSpeech'](_0x59f572,function(_0x364ee7,_0x3a8f2b){if(_0x364ee7){_0x3ce2a9(_0x364ee7);}else if(_0x3a8f2b){if(_0x3a8f2b[_0x2877('0x2')]instanceof Buffer){fs[_0x2877('0x3')](_0x33675f,_0x3a8f2b[_0x2877('0x2')],function(_0x3912c2){if(_0x3912c2){_0x3ce2a9(_0x3912c2);}else{_0x41e8a6();}});}else{_0x3ce2a9(new Error(_0x2877('0x4')));}}else{_0x3ce2a9(new Error(_0x2877('0x5')));}});});}module[_0x2877('0x6')]=function(_0x1ae243,_0x2fa852,_0x26878d,_0x1c534b,_0x30adee,_0x1e8e59,_0x4e7a63){var _0x5dc1e9=new AWS['Polly']({'accessKeyId':_0x1ae243,'secretAccessKey':_0x2fa852,'region':_0x26878d});var _0x2abb08={'Text':_0x30adee,'TextType':_0x1e8e59||'text','OutputFormat':_0x2877('0x7'),'VoiceId':_0x1c534b};return pollyResult(_0x5dc1e9,_0x2abb08,_0x4e7a63);}; \ 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 eaddf85..1b6aa2b 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 _0x29cf=['exports','./lib/api'];(function(_0x27ebe8,_0x21dd01){var _0x431778=function(_0xcf97c6){while(--_0xcf97c6){_0x27ebe8['push'](_0x27ebe8['shift']());}};_0x431778(++_0x21dd01);}(_0x29cf,0xd5));var _0xf29c=function(_0x30afd6,_0x5283ab){_0x30afd6=_0x30afd6-0x0;var _0x14d9af=_0x29cf[_0x30afd6];return _0x14d9af;};'use strict';var asr=require(_0xf29c('0x0'));module[_0xf29c('0x1')]=function(_0x50d98b,_0x4ed3d2,_0x50ad15,_0x1dffd8){return asr(_0x50d98b,_0x4ed3d2,_0x50ad15);}; \ No newline at end of file +var _0x6b6f=['exports'];(function(_0x388960,_0x2a8993){var _0x8237db=function(_0x4e7c61){while(--_0x4e7c61){_0x388960['push'](_0x388960['shift']());}};_0x8237db(++_0x2a8993);}(_0x6b6f,0xe9));var _0xf6b6=function(_0x45fb04,_0x3136f6){_0x45fb04=_0x45fb04-0x0;var _0xd52a12=_0x6b6f[_0x45fb04];return _0xd52a12;};'use strict';var asr=require('./lib/api');module[_0xf6b6('0x0')]=function(_0xc5ed5d,_0x343176,_0x4671a9,_0x33aad7){return asr(_0xc5ed5d,_0x343176,_0x4671a9);}; \ 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 5214607..5b3fa65 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 _0x5ff3=['filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','bluebird','exports','string','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ff3,0x17d));var _0x35ff=function(_0x4f5c04,_0x3398aa){_0x4f5c04=_0x4f5c04-0x0;var _0xeda548=_0x5ff3[_0x4f5c04];return _0xeda548;};'use strict';var url=require('url');var BPromise=require(_0x35ff('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x35ff('0x1')]=function(_0x47c98d,_0x380f54,_0x1bb200){return new BPromise(function(_0x3bd66a,_0xd0846d){var _0x551514;if(typeof _0x47c98d!==_0x35ff('0x2')||_0x47c98d[_0x35ff('0x3')]===0x0){return _0xd0846d(_0x35ff('0x4'));}if(typeof _0x380f54!==_0x35ff('0x2')||_0x380f54[_0x35ff('0x3')]===0x0){return _0xd0846d('key\x20should\x20be\x20a\x20string');}if(typeof _0x1bb200!==_0x35ff('0x5')&&(typeof _0x1bb200!=='string'||_0x1bb200[_0x35ff('0x3')]===0x0)){return _0xd0846d(_0x35ff('0x6'));}try{_0x551514=fs[_0x35ff('0x7')](_0x47c98d)['toString'](_0x35ff('0x8'));}catch(_0x59ec4f){return _0xd0846d(_0x59ec4f);}return _0x3bd66a({'method':_0x35ff('0x9'),'uri':host+_0x35ff('0xa')+_0x380f54,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x1bb200},'audio':{'content':_0x551514}},'json':!![]});});}; \ No newline at end of file +var _0xb2ff=['readFileSync','base64','POST','LINEAR16','8000','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xb2ff,0x123));var _0xfb2f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb2ff[_0x4b369d];return _0x571a98;};'use strict';var url=require(_0xfb2f('0x0'));var BPromise=require(_0xfb2f('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xfb2f('0x2')]=function(_0x54e80d,_0x584330,_0x51e1fe){return new BPromise(function(_0x13cb60,_0x484368){var _0x145e77;if(typeof _0x54e80d!==_0xfb2f('0x3')||_0x54e80d[_0xfb2f('0x4')]===0x0){return _0x484368(_0xfb2f('0x5'));}if(typeof _0x584330!=='string'||_0x584330['length']===0x0){return _0x484368(_0xfb2f('0x6'));}if(typeof _0x51e1fe!=='undefined'&&(typeof _0x51e1fe!==_0xfb2f('0x3')||_0x51e1fe[_0xfb2f('0x4')]===0x0)){return _0x484368(_0xfb2f('0x7'));}try{_0x145e77=fs[_0xfb2f('0x8')](_0x54e80d)['toString'](_0xfb2f('0x9'));}catch(_0x5084f0){return _0x484368(_0x5084f0);}return _0x13cb60({'method':_0xfb2f('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x584330,'body':{'config':{'encoding':_0xfb2f('0xb'),'sampleRateHertz':_0xfb2f('0xc'),'languageCode':_0x51e1fe},'audio':{'content':_0x145e77}},'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 99a2774..9afc5a9 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 _0x84cc=['exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x84cc,0x7c));var _0xc84c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x84cc[_0x1ac595];return _0x455fff;};var asr=require('./asr');module[_0xc84c('0x0')]={'asr':asr}; \ No newline at end of file +var _0x3d8a=['./asr'];(function(_0x5a8954,_0x4c6d17){var _0x4b29f5=function(_0x39ecea){while(--_0x39ecea){_0x5a8954['push'](_0x5a8954['shift']());}};_0x4b29f5(++_0x4c6d17);}(_0x3d8a,0xa1));var _0xa3d8=function(_0x20e2bb,_0x10e3db){_0x20e2bb=_0x20e2bb-0x0;var _0x2c944c=_0x3d8a[_0x20e2bb];return _0x2c944c;};var asr=require(_0xa3d8('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index aadbb95..e711337 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 _0xac0f=['textRequest','result','source','resolvedQuery','action','fulfillment','speech','status','metadata','endConversation','replace','SessionsClient','sessionPath','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','polly','777','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./google','./tilde','../../../config/logger','agi','protocol','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','host','get','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','text:synthesize','POST','from','writeFile','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','unlink','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','message','googleDialogflow'];(function(_0xee0493,_0x57b4da){var _0x47b771=function(_0x479376){while(--_0x479376){_0xee0493['push'](_0xee0493['shift']());}};_0x47b771(++_0x57b4da);}(_0xac0f,0xb4));var _0xfac0=function(_0x13592e,_0x90abf1){_0x13592e=_0x13592e-0x0;var _0x4998b8=_0xac0f[_0x13592e];return _0x4998b8;};'use strict';var apiai=require(_0xfac0('0x0'));var BPromise=require(_0xfac0('0x1'));var dialogflow=require(_0xfac0('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xfac0('0x3'));var md5=require('md5');var path=require(_0xfac0('0x4'));var querystring=require(_0xfac0('0x5'));var rp=require(_0xfac0('0x6'));var rs=require(_0xfac0('0x7'));var sox=require(_0xfac0('0x8'));var tts=require(_0xfac0('0x9'));var urlParse=require(_0xfac0('0xa'))[_0xfac0('0xb')];var util=require('util');var aws=require('./aws');var google=require(_0xfac0('0xc'));var sestek=require('./sestek');var tilde=require(_0xfac0('0xd'));var logger=require(_0xfac0('0xe'))(_0xfac0('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5990d7,_0x223916){return new BPromise(function(_0x583204,_0xcb5666){var _0x506ae6=urlParse(_0x5990d7);var _0x286e85=_0x506ae6[_0xfac0('0x10')]==='https:'?https:http;var _0x4617e1={'host':_0x506ae6['host'],'path':_0x506ae6[_0xfac0('0x4')],'headers':{'user-agent':_0xfac0('0x11')}};_0x286e85['get'](_0x4617e1,function(_0x4e9f4c){if(_0x4e9f4c[_0xfac0('0x12')]!==0xc8){logger[_0xfac0('0x13')]('request\x20to\x20'+_0x5990d7+_0xfac0('0x14')+_0x4e9f4c['statusCode']+'\x20('+_0x4e9f4c[_0xfac0('0x15')]+')');_0xcb5666(new Error(_0xfac0('0x16')+_0x5990d7+'\x20failed,\x20status\x20code\x20=\x20'+_0x4e9f4c[_0xfac0('0x12')]+'\x20('+_0x4e9f4c[_0xfac0('0x15')]+')'));return;}var _0x167a42=fs[_0xfac0('0x17')](_0x223916);_0x167a42['on'](_0xfac0('0x18'),function(){logger[_0xfac0('0x19')](_0xfac0('0x1a'));_0x167a42[_0xfac0('0x1b')](_0x583204);});_0x167a42['on']('error',function(_0x28fa0b){fs['unlink'](_0x223916);logger[_0xfac0('0x13')](_0xfac0('0x1c'),_0x28fa0b);_0xcb5666(_0x28fa0b);});_0x4e9f4c[_0xfac0('0x1d')](_0x167a42);})['on'](_0xfac0('0x13'),function(_0x3c9bf6){logger[_0xfac0('0x13')](_0x3c9bf6);_0xcb5666(_0x3c9bf6);})['end']();});}function uploadFile(_0x2cb6f9){return new BPromise(function(_0x593dc6,_0x374fad){var _0x37dc0a=urlParse(_0x2cb6f9);var _0x5bc228=_0x37dc0a[_0xfac0('0x10')]==='https:'?https:http;var _0x1e2386={'host':_0x37dc0a[_0xfac0('0x1e')],'path':_0x37dc0a[_0xfac0('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x5bc228[_0xfac0('0x1f')](_0x1e2386,function(_0x8cae24){if(_0x8cae24[_0xfac0('0x12')]!==0xc8){_0x374fad(new Error('request\x20to\x20'+_0x2cb6f9+_0xfac0('0x14')+_0x8cae24[_0xfac0('0x12')]+'\x20('+_0x8cae24[_0xfac0('0x15')]+')'));return;}var _0x34251f='';_0x8cae24['on'](_0xfac0('0x20'),function(_0x53f45e){_0x34251f+=_0x53f45e;});_0x8cae24['on'](_0xfac0('0x21'),function(){_0x593dc6(_0x34251f);});})['on'](_0xfac0('0x13'),function(_0x2c2957){_0x374fad(_0x2c2957);})[_0xfac0('0x21')]();});}function convertFile(_0x38996c,_0x16acfc){return new BPromise(function(_0x4b86c4,_0x1060d2){var _0x5b4af0=sox[_0xfac0('0x22')](_0x38996c,_0x16acfc,{'sampleRate':0x1f40,'format':_0xfac0('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5b4af0['on']('error',function(_0x3d9926){logger['error'](_0xfac0('0x24'),_0x3d9926);_0x1060d2(_0x3d9926);});_0x5b4af0['on'](_0xfac0('0x21'),function(){logger[_0xfac0('0x19')](_0xfac0('0x25'));_0x4b86c4();});_0x5b4af0[_0xfac0('0x26')]();});}function base64Decode(_0xc880f7,_0x21ad8f){var _0x1ae274=path[_0xfac0('0x27')](__dirname,_0xfac0('0x28'),rs[_0xfac0('0x29')](0x4)+_0xfac0('0x2a'));fs[_0xfac0('0x2b')](_0x1ae274,_0xc880f7,'base64');return convertFile(_0x1ae274,_0x21ad8f)[_0xfac0('0x2c')](function(){try{fs['unlink'](_0x1ae274);fs[_0xfac0('0x2d')](_0x21ad8f,'777');}catch(_0x4c29d0){logger[_0xfac0('0x13')](_0x4c29d0);}return _0x21ad8f[_0xfac0('0x2e')]('.')[0x0];});}function base64Encode(_0x72681d){var _0x436e8d=fs['readFileSync'](_0x72681d);return new Buffer(_0x436e8d)[_0xfac0('0x2f')](_0xfac0('0x30'));}exports[_0xfac0('0x31')]=function(_0x46a134,_0x25b4ca,_0x428360,_0x261210,_0x568308,_0x2d0fb){var _0x5ef9fc,_0x4b59fd;var _0x18b8f3=_0xfac0('0x32');var _0x498689=_0xfac0('0x33')+_0x46a134;var _0x370a88={};if(_0x25b4ca===_0xfac0('0x34')){_0x370a88[_0xfac0('0x35')]={'ssml':_0x428360};}else{_0x370a88[_0xfac0('0x35')]={'text':_0x428360};};_0x370a88['voice']={'languageCode':_0x261210,'ssmlGender':_0x568308};_0x370a88[_0xfac0('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x3d4b1f={'url':_0x18b8f3+_0xfac0('0x37')+_0x498689,'method':_0xfac0('0x38'),'json':!![],'body':_0x370a88};return rp(_0x3d4b1f)['then'](function(_0x3bddb3){return new BPromise(function(_0x33df1c,_0x1dc50e){_0x5ef9fc=path['resolve'](__dirname,_0xfac0('0x28'),rs[_0xfac0('0x29')](0x4)+'.mp3');var _0x23c3e9=Buffer[_0xfac0('0x39')](_0x3bddb3['audioContent'],_0xfac0('0x30'));return fs[_0xfac0('0x3a')](_0x5ef9fc,_0x23c3e9,function(_0x1eff64){_0x1dc50e(_0x1eff64);},function(_0x5c104a){fs[_0xfac0('0x2d')](_0x5ef9fc,'777');_0x33df1c(_0x5c104a);});});})[_0xfac0('0x2c')](function(_0x349fec){_0x4b59fd=path[_0xfac0('0x27')](__dirname,_0xfac0('0x28'),rs[_0xfac0('0x29')](0x4)+_0xfac0('0x2a'));return convertFile(_0x5ef9fc,_0x4b59fd);})[_0xfac0('0x2c')](function(){try{fs['unlink'](_0x5ef9fc);fs[_0xfac0('0x2d')](_0x4b59fd,'777');}catch(_0x35def8){logger['error'](_0x35def8);}logger[_0xfac0('0x19')](_0xfac0('0x3b'),_0x4b59fd[_0xfac0('0x2e')]('.')[0x0]);return _0x4b59fd['split']('.')[0x0];});};exports[_0xfac0('0x3c')]=function(_0x4a18f1,_0x43efbb){var _0xd242ad='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x10d92e,_0x224af3;var _0x214eea;var _0x50ac3c={'encoding':_0xfac0('0x3d'),'method':_0xfac0('0x38'),'timeout':0x2710,'url':_0xd242ad,'headers':{'Content-Type':_0xfac0('0x3e')},'body':_0xfac0('0x3f')+encodeURIComponent(JSON[_0xfac0('0x40')]([[[_0xfac0('0x41'),JSON['stringify']([_0x4a18f1,_0x43efbb||'en',![],'null']),null,_0xfac0('0x42')]]]))};return rp(_0x50ac3c)[_0xfac0('0x2c')](function(_0x3e8041){try{_0x214eea=eval(_0x3e8041[_0xfac0('0x43')](0x5))[0x0][0x2];}catch(_0x5a9cfc){throw new Error(_0xfac0('0x44')+_0x3e8041['data']);}if(!_0x214eea){if(_0x4a18f1[_0xfac0('0x45')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xfac0('0x46')+_0x43efbb+_0xfac0('0x47'));}}try{_0x214eea=eval(_0x214eea)[0x0];}catch(_0x2b05c0){throw new Error(_0xfac0('0x44')+res['data']);}const _0x4726eb=_0x214eea;_0x10d92e=path['resolve'](__dirname,_0xfac0('0x28'),rs[_0xfac0('0x29')](0x4)+_0xfac0('0x48'));fs['writeFileSync'](_0x10d92e,_0x214eea,{'encoding':'base64'});_0x224af3=path[_0xfac0('0x27')](__dirname,_0xfac0('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x10d92e,_0x224af3);})[_0xfac0('0x2c')](function(){try{fs[_0xfac0('0x49')](_0x10d92e);fs['chmodSync'](_0x224af3,'777');}catch(_0x5ce376){logger[_0xfac0('0x13')](_0x5ce376);}logger[_0xfac0('0x19')](_0xfac0('0x4a'),_0x224af3['split']('.')[0x0]);return _0x224af3[_0xfac0('0x2e')]('.')[0x0];});};exports[_0xfac0('0x4b')]=function(_0x55c8f8,_0xb20a8f,_0x17841d){return google[_0xfac0('0x4c')](_0x55c8f8,_0xb20a8f,_0x17841d)['then'](function(_0x4c339a){logger['info'](_0x4c339a[_0xfac0('0x4d')]);return rp(_0x4c339a);})['then'](function(_0x496446){var _0x3ee97b='';var _0x692160=0x0;try{fs[_0xfac0('0x49')](_0x55c8f8);}catch(_0x24e005){logger[_0xfac0('0x13')](_0x24e005);}if(_0x496446&&_0x496446[_0xfac0('0x4e')]){_0x3ee97b=_0x496446[_0xfac0('0x4e')][_0xfac0('0x4f')](function(_0x77e41a){return _0x77e41a&&_0x77e41a[_0xfac0('0x50')][0x0]&&_0x77e41a[_0xfac0('0x50')][0x0][_0xfac0('0x51')]?_0x77e41a[_0xfac0('0x50')][0x0][_0xfac0('0x51')]:'';})[_0xfac0('0x52')]('\x0a');_0x692160=_0x496446[_0xfac0('0x4e')]['map'](function(_0x1ccad2){return _0x1ccad2&&_0x1ccad2['alternatives'][0x0]&&_0x1ccad2[_0xfac0('0x50')][0x0][_0xfac0('0x53')]?_0x1ccad2[_0xfac0('0x50')][0x0][_0xfac0('0x53')]:0x0;})[_0xfac0('0x52')]('\x0a');}logger[_0xfac0('0x19')](_0xfac0('0x54'),_0x3ee97b);logger[_0xfac0('0x19')](_0xfac0('0x55'),_0x692160);return{'transcript':_0x3ee97b,'confidence':_0x692160};})['catch'](function(_0x51dfae){logger[_0xfac0('0x13')]('[%s]\x20%s:%s',_0x51dfae[_0xfac0('0x12')],_0x51dfae['name'],_0x51dfae[_0xfac0('0x56')]);});};exports[_0xfac0('0x57')]=function(_0x5df90b,_0x2900bb,_0x4b17f2,_0x502bcf){var _0x7a2135=apiai(_0x2900bb,{'language':_0x502bcf||'en'});return _0x7a2135[_0xfac0('0x58')](_0x4b17f2,{'sessionId':md5(_0x5df90b)})['then'](function(_0x5301fd){logger['info'](JSON['stringify'](_0x5301fd));return{'source':_0x5301fd[_0xfac0('0x59')][_0xfac0('0x5a')],'resolvedQuery':_0x5301fd[_0xfac0('0x59')][_0xfac0('0x5b')],'action':_0x5301fd['result'][_0xfac0('0x5c')],'actionIncomplete':_0x5301fd['result']['actionIncomplete'],'speech':_0x5301fd['result'][_0xfac0('0x5d')][_0xfac0('0x5e')],'score':_0x5301fd['result']['score'],'statusCode':_0x5301fd[_0xfac0('0x5f')]['code'],'endConversation':_0x5301fd[_0xfac0('0x59')][_0xfac0('0x60')][_0xfac0('0x61')]||![],'isFallbackIntent':_0x5301fd[_0xfac0('0x59')][_0xfac0('0x60')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x317214,_0x5afec7,_0x4e21fb,_0x57d83b,_0x3fc5ce,_0x3c489b){var _0x16495f=_0x57d83b[_0xfac0('0x62')](/\\n/g,'\x0a');var _0xfbdede={'credentials':{'private_key':_0x16495f,'client_email':_0x4e21fb}};var _0x2eefc=new dialogflow[(_0xfac0('0x63'))](_0xfbdede);var _0x11771a=_0x2eefc[_0xfac0('0x64')](_0x5afec7,md5(_0x317214));var _0xf279a5={'session':_0x11771a,'queryInput':{'text':{'text':_0x3fc5ce,'languageCode':_0x3c489b}}};return _0x2eefc['detectIntent'](_0xf279a5)['then'](function(_0x4bf883){if(_0x4bf883&&_0x4bf883[_0xfac0('0x45')]){logger[_0xfac0('0x19')]('Dialogflow\x20V2\x20response:',JSON[_0xfac0('0x40')](_0x4bf883));var _0x81bd9d=_0x4bf883[0x0];if(_0x81bd9d){var _0x1e43fe={'action':_0x81bd9d['queryResult'][_0xfac0('0x5c')],'allRequiredParamsPresent':_0x81bd9d['queryResult'][_0xfac0('0x65')],'endConversation':_0x81bd9d[_0xfac0('0x66')][_0xfac0('0x67')]&&_0x81bd9d[_0xfac0('0x66')][_0xfac0('0x67')]['fields']?_0x81bd9d[_0xfac0('0x66')][_0xfac0('0x67')][_0xfac0('0x68')][_0xfac0('0x69')][_0xfac0('0x6a')]:![],'fulfillmentText':_0x81bd9d['queryResult'][_0xfac0('0x6b')],'intentName':_0x81bd9d[_0xfac0('0x66')][_0xfac0('0x6c')]['name'],'intentDisplayName':_0x81bd9d[_0xfac0('0x66')][_0xfac0('0x6c')][_0xfac0('0x6d')],'isFallbackIntent':_0x81bd9d['queryResult']['intent']['isFallback'],'languageCode':_0x81bd9d[_0xfac0('0x66')][_0xfac0('0x6e')],'queryText':_0x81bd9d[_0xfac0('0x66')]['queryText'],'responseId':_0x81bd9d[_0xfac0('0x6f')],'score':_0x81bd9d['queryResult'][_0xfac0('0x70')],'speech':_0x81bd9d[_0xfac0('0x66')][_0xfac0('0x6b')],'providerResponse':JSON[_0xfac0('0x40')](_0x4bf883)};return _0x1e43fe;}}});};exports[_0xfac0('0x71')]=function(_0x111464,_0x288224,_0x54b1b8,_0x25fa46){return tilde[_0xfac0('0x4c')](_0x111464,_0x288224,_0x54b1b8,_0x25fa46)[_0xfac0('0x2c')](function(_0x6f450f){try{fs[_0xfac0('0x49')](_0x111464);}catch(_0x1f4c96){logger[_0xfac0('0x13')](_0x1f4c96);}logger[_0xfac0('0x19')](_0xfac0('0x72'),_0x6f450f[_0xfac0('0x51')]);logger[_0xfac0('0x19')]('Tilde\x20ASR\x20confidence',_0x6f450f[_0xfac0('0x53')]);return _0x6f450f;});};exports['awsPolly']=function(_0xc9b2f,_0x275464,_0x5f2010,_0x3f23f7,_0x436d23,_0xce7a6){var _0x2836d9=path[_0xfac0('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xfac0('0x48'));var _0x2cb347;return aws[_0xfac0('0x73')](_0xc9b2f,_0x275464,_0x5f2010,_0x3f23f7,_0x436d23,_0xce7a6,_0x2836d9)[_0xfac0('0x2c')](function(){_0x2cb347=path['resolve'](__dirname,_0xfac0('0x28'),rs['generate'](0x4)+_0xfac0('0x2a'));return convertFile(_0x2836d9,_0x2cb347);})[_0xfac0('0x2c')](function(){try{fs['unlink'](_0x2836d9);fs[_0xfac0('0x2d')](_0x2cb347,_0xfac0('0x74'));}catch(_0x3cca4c){logger[_0xfac0('0x13')](_0x3cca4c);}return _0x2cb347[_0xfac0('0x2e')]('.')[0x0];});};exports[_0xfac0('0x75')]=function(_0x5bca1d,_0x24e0bc,_0x254194,_0x2daa5b,_0x169f1e,_0x761e79){return aws[_0xfac0('0x76')](_0x5bca1d,_0x24e0bc,_0x254194,_0x2daa5b,_0x169f1e,_0x761e79)['then'](function(_0x1cfe47){logger['info'](JSON[_0xfac0('0x40')](_0x1cfe47));return _0x1cfe47;});};exports['ispeechTTS']=function(_0x53eccd,_0x22ce82,_0x1aea03,_0x3aa6e9){var _0x47bfc3=util['format'](_0xfac0('0x77'),ISPEECH_API,_0x53eccd,encodeURIComponent(_0x22ce82),_0x1aea03,_0x3aa6e9);var _0x5dc24d=path[_0xfac0('0x27')](__dirname,_0xfac0('0x28'),rs[_0xfac0('0x29')](0x4)+_0xfac0('0x48'));var _0x24514b;return downloadFile(_0x47bfc3,_0x5dc24d)['then'](function(){_0x24514b=path['resolve'](__dirname,_0xfac0('0x28'),rs[_0xfac0('0x29')](0x4)+_0xfac0('0x2a'));return convertFile(_0x5dc24d,_0x24514b);})[_0xfac0('0x2c')](function(){try{fs[_0xfac0('0x49')](_0x5dc24d);fs[_0xfac0('0x2d')](_0x24514b,_0xfac0('0x74'));}catch(_0x3c62c4){logger[_0xfac0('0x13')](_0x3c62c4);}return _0x24514b[_0xfac0('0x2e')]('.')[0x0];});};exports[_0xfac0('0x78')]=function(_0xfe86b,_0x239831,_0x48e9da,_0x3104b7){var _0x41d516=util[_0xfac0('0x79')](_0xfac0('0x7a'),ISPEECH_API,_0x239831,_0x48e9da,base64Encode(_0xfe86b),_0x3104b7?util[_0xfac0('0x79')]('model=%s',encodeURIComponent(_0x3104b7)):_0xfac0('0x7b'));return uploadFile(_0x41d516)[_0xfac0('0x2c')](function(_0x1c69f0){return querystring[_0xfac0('0xb')](_0x1c69f0);});};exports[_0xfac0('0x7c')]=function(_0x2ed695,_0x16b404){return sestek[_0xfac0('0x7d')](_0x2ed695,_0x16b404)['then'](function(_0x3708d0){logger[_0xfac0('0x19')](JSON['stringify'](_0x3708d0));var _0xdd82bc={'speech':_0x3708d0[_0xfac0('0x7e')],'action':_0x3708d0[_0xfac0('0x7f')]?_0x3708d0['channelData'][_0xfac0('0x80')]:undefined,'actiondata':_0x3708d0[_0xfac0('0x7f')]?_0x3708d0['channelData'][_0xfac0('0x81')]:undefined};if(_0x3708d0[_0xfac0('0x7f')]&&_0x3708d0[_0xfac0('0x7f')]['AudioFromTts']){return base64Decode(_0x3708d0['channelData'][_0xfac0('0x82')][_0xfac0('0x83')],path[_0xfac0('0x27')](__dirname,'tmp',rs[_0xfac0('0x29')](0x4)+_0xfac0('0x2a')))[_0xfac0('0x2c')](function(_0x541660){_0xdd82bc[_0xfac0('0x84')]=_0x541660;return _0xdd82bc;});}return _0xdd82bc;});};exports[_0xfac0('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x3f9e=['dirName','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','agi','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','unlink','download\x20error','pipe','end','https:','data','error\x20convert','info','finish\x20to\x20convert','start','generate','.wav','base64','then','chmodSync','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','resolve','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','writeFileSync','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','[%s]\x20%s:%s','googleDialogflow','textRequest','result','source','action','fulfillment','speech','endConversation','metadata','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','name','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile'];(function(_0x19fa2e,_0x15755b){var _0x2118ec=function(_0x241bf6){while(--_0x241bf6){_0x19fa2e['push'](_0x19fa2e['shift']());}};_0x2118ec(++_0x15755b);}(_0x3f9e,0x181));var _0xe3f9=function(_0xfde968,_0x3f9dfc){_0xfde968=_0xfde968-0x0;var _0x4038bd=_0x3f9e[_0xfde968];return _0x4038bd;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xe3f9('0x0'));var dialogflow=require(_0xe3f9('0x1'));var fs=require('fs');var http=require(_0xe3f9('0x2'));var https=require(_0xe3f9('0x3'));var md5=require(_0xe3f9('0x4'));var path=require(_0xe3f9('0x5'));var querystring=require(_0xe3f9('0x6'));var rp=require(_0xe3f9('0x7'));var rs=require('randomstring');var sox=require(_0xe3f9('0x8'));var tts=require(_0xe3f9('0x9'));var urlParse=require(_0xe3f9('0xa'))[_0xe3f9('0xb')];var util=require(_0xe3f9('0xc'));var aws=require('./aws');var google=require(_0xe3f9('0xd'));var sestek=require(_0xe3f9('0xe'));var tilde=require(_0xe3f9('0xf'));var logger=require('../../../config/logger')(_0xe3f9('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x485ca2,_0x5dd3e6){return new BPromise(function(_0x523f68,_0x11871d){var _0x1c691f=urlParse(_0x485ca2);var _0x532bd0=_0x1c691f[_0xe3f9('0x11')]==='https:'?https:http;var _0x101f97={'host':_0x1c691f[_0xe3f9('0x12')],'path':_0x1c691f['path'],'headers':{'user-agent':_0xe3f9('0x13')}};_0x532bd0[_0xe3f9('0x14')](_0x101f97,function(_0x868b59){if(_0x868b59[_0xe3f9('0x15')]!==0xc8){logger[_0xe3f9('0x16')](_0xe3f9('0x17')+_0x485ca2+'\x20failed,\x20status\x20code\x20=\x20'+_0x868b59[_0xe3f9('0x15')]+'\x20('+_0x868b59[_0xe3f9('0x18')]+')');_0x11871d(new Error(_0xe3f9('0x17')+_0x485ca2+_0xe3f9('0x19')+_0x868b59[_0xe3f9('0x15')]+'\x20('+_0x868b59[_0xe3f9('0x18')]+')'));return;}var _0x3c45cc=fs[_0xe3f9('0x1a')](_0x5dd3e6);_0x3c45cc['on'](_0xe3f9('0x1b'),function(){logger['info'](_0xe3f9('0x1c'));_0x3c45cc['close'](_0x523f68);});_0x3c45cc['on'](_0xe3f9('0x16'),function(_0x39f14d){fs[_0xe3f9('0x1d')](_0x5dd3e6);logger[_0xe3f9('0x16')](_0xe3f9('0x1e'),_0x39f14d);_0x11871d(_0x39f14d);});_0x868b59[_0xe3f9('0x1f')](_0x3c45cc);})['on'](_0xe3f9('0x16'),function(_0x3d6747){logger[_0xe3f9('0x16')](_0x3d6747);_0x11871d(_0x3d6747);})[_0xe3f9('0x20')]();});}function uploadFile(_0x3ce524){return new BPromise(function(_0x186c67,_0x184d80){var _0x9bdde=urlParse(_0x3ce524);var _0x203833=_0x9bdde[_0xe3f9('0x11')]===_0xe3f9('0x21')?https:http;var _0x254996={'host':_0x9bdde[_0xe3f9('0x12')],'path':_0x9bdde[_0xe3f9('0x5')],'headers':{'user-agent':_0xe3f9('0x13')}};_0x203833['get'](_0x254996,function(_0x2e8341){if(_0x2e8341['statusCode']!==0xc8){_0x184d80(new Error(_0xe3f9('0x17')+_0x3ce524+_0xe3f9('0x19')+_0x2e8341[_0xe3f9('0x15')]+'\x20('+_0x2e8341['statusMessage']+')'));return;}var _0x3abbd5='';_0x2e8341['on'](_0xe3f9('0x22'),function(_0x409ed1){_0x3abbd5+=_0x409ed1;});_0x2e8341['on'](_0xe3f9('0x20'),function(){_0x186c67(_0x3abbd5);});})['on']('error',function(_0x5b679d){_0x184d80(_0x5b679d);})[_0xe3f9('0x20')]();});}function convertFile(_0x227d94,_0x3991cb){return new BPromise(function(_0x25d936,_0x225329){var _0x2b9344=sox['transcode'](_0x227d94,_0x3991cb,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2b9344['on'](_0xe3f9('0x16'),function(_0x228c36){logger['error'](_0xe3f9('0x23'),_0x228c36);_0x225329(_0x228c36);});_0x2b9344['on'](_0xe3f9('0x20'),function(){logger[_0xe3f9('0x24')](_0xe3f9('0x25'));_0x25d936();});_0x2b9344[_0xe3f9('0x26')]();});}function base64Decode(_0x5b6f78,_0x52a92b){var _0x533a0e=path['resolve'](__dirname,'tmp',rs[_0xe3f9('0x27')](0x4)+_0xe3f9('0x28'));fs['writeFileSync'](_0x533a0e,_0x5b6f78,_0xe3f9('0x29'));return convertFile(_0x533a0e,_0x52a92b)[_0xe3f9('0x2a')](function(){try{fs['unlink'](_0x533a0e);fs[_0xe3f9('0x2b')](_0x52a92b,_0xe3f9('0x2c'));}catch(_0x1cefeb){logger[_0xe3f9('0x16')](_0x1cefeb);}return _0x52a92b['split']('.')[0x0];});}function base64Encode(_0x36ab01){var _0x5b11e1=fs[_0xe3f9('0x2d')](_0x36ab01);return new Buffer(_0x5b11e1)['toString'](_0xe3f9('0x29'));}exports[_0xe3f9('0x2e')]=function(_0xdb5646,_0x40e9b5,_0x4819b8,_0x5b6d64,_0x4f02d9,_0x34f0ad){var _0x13e732,_0x1bd867;var _0xed27d5=_0xe3f9('0x2f');var _0x598380=_0xe3f9('0x30')+_0xdb5646;var _0x581e09={};if(_0x40e9b5===_0xe3f9('0x31')){_0x581e09[_0xe3f9('0x32')]={'ssml':_0x4819b8};}else{_0x581e09['input']={'text':_0x4819b8};};_0x581e09['voice']={'languageCode':_0x5b6d64,'ssmlGender':_0x4f02d9};_0x581e09['audioConfig']={'audioEncoding':_0xe3f9('0x33'),'sampleRateHertz':0x1f40};var _0x6bb335={'url':_0xed27d5+_0xe3f9('0x34')+_0x598380,'method':_0xe3f9('0x35'),'json':!![],'body':_0x581e09};return rp(_0x6bb335)[_0xe3f9('0x2a')](function(_0x1e6bb3){return new BPromise(function(_0x2e584f,_0x255c6b){_0x13e732=path['resolve'](__dirname,_0xe3f9('0x36'),rs[_0xe3f9('0x27')](0x4)+_0xe3f9('0x37'));var _0x751531=Buffer[_0xe3f9('0x38')](_0x1e6bb3[_0xe3f9('0x39')],_0xe3f9('0x29'));return fs['writeFile'](_0x13e732,_0x751531,function(_0x4d9172){_0x255c6b(_0x4d9172);},function(_0x482084){fs['chmodSync'](_0x13e732,_0xe3f9('0x2c'));_0x2e584f(_0x482084);});});})['then'](function(_0x5322d0){_0x1bd867=path[_0xe3f9('0x3a')](__dirname,_0xe3f9('0x36'),rs['generate'](0x4)+_0xe3f9('0x28'));return convertFile(_0x13e732,_0x1bd867);})[_0xe3f9('0x2a')](function(){try{fs[_0xe3f9('0x1d')](_0x13e732);fs[_0xe3f9('0x2b')](_0x1bd867,_0xe3f9('0x2c'));}catch(_0x9d9fb4){logger[_0xe3f9('0x16')](_0x9d9fb4);}logger[_0xe3f9('0x24')](_0xe3f9('0x3b'),_0x1bd867[_0xe3f9('0x3c')]('.')[0x0]);return _0x1bd867[_0xe3f9('0x3c')]('.')[0x0];});};exports[_0xe3f9('0x3d')]=function(_0x2847e1,_0x567642){var _0x5bb5b0=_0xe3f9('0x3e');var _0x54a07c,_0x3dd207;var _0x25f967;var _0x5100a7={'encoding':_0xe3f9('0x3f'),'method':_0xe3f9('0x35'),'timeout':0x2710,'url':_0x5bb5b0,'headers':{'Content-Type':_0xe3f9('0x40')},'body':'f.req='+encodeURIComponent(JSON[_0xe3f9('0x41')]([[['jQ1olc',JSON[_0xe3f9('0x41')]([_0x2847e1,_0x567642||'en',![],_0xe3f9('0x42')]),null,_0xe3f9('0x43')]]]))};return rp(_0x5100a7)[_0xe3f9('0x2a')](function(_0x5aff46){try{_0x25f967=eval(_0x5aff46[_0xe3f9('0x44')](0x5))[0x0][0x2];}catch(_0x32b8a8){throw new Error('parse\x20response\x20failed:\x0a'+_0x5aff46[_0xe3f9('0x22')]);}if(!_0x25f967){if(_0x2847e1[_0xe3f9('0x45')]>0xc8){throw new Error(_0xe3f9('0x46'));}else{throw new Error(_0xe3f9('0x47')+_0x567642+_0xe3f9('0x48'));}}try{_0x25f967=eval(_0x25f967)[0x0];}catch(_0x3ff96d){throw new Error(_0xe3f9('0x49')+res[_0xe3f9('0x22')]);}const _0x5418b2=_0x25f967;_0x54a07c=path[_0xe3f9('0x3a')](__dirname,_0xe3f9('0x36'),rs[_0xe3f9('0x27')](0x4)+_0xe3f9('0x37'));fs[_0xe3f9('0x4a')](_0x54a07c,_0x25f967,{'encoding':_0xe3f9('0x29')});_0x3dd207=path['resolve'](__dirname,_0xe3f9('0x36'),rs[_0xe3f9('0x27')](0x4)+'.wav');return convertFile(_0x54a07c,_0x3dd207);})[_0xe3f9('0x2a')](function(){try{fs[_0xe3f9('0x1d')](_0x54a07c);fs[_0xe3f9('0x2b')](_0x3dd207,_0xe3f9('0x2c'));}catch(_0x3a57c4){logger[_0xe3f9('0x16')](_0x3a57c4);}logger[_0xe3f9('0x24')](_0xe3f9('0x4b'),_0x3dd207[_0xe3f9('0x3c')]('.')[0x0]);return _0x3dd207[_0xe3f9('0x3c')]('.')[0x0];});};exports[_0xe3f9('0x4c')]=function(_0x30e437,_0x860044,_0x315425){return google[_0xe3f9('0x4d')](_0x30e437,_0x860044,_0x315425)[_0xe3f9('0x2a')](function(_0x4a8f22){logger[_0xe3f9('0x24')](_0x4a8f22['uri']);return rp(_0x4a8f22);})[_0xe3f9('0x2a')](function(_0x581b47){var _0xccc71b='';var _0xcd03bf=0x0;try{fs[_0xe3f9('0x1d')](_0x30e437);}catch(_0x2e92ad){logger[_0xe3f9('0x16')](_0x2e92ad);}if(_0x581b47&&_0x581b47[_0xe3f9('0x4e')]){_0xccc71b=_0x581b47['results']['map'](function(_0x50d18d){return _0x50d18d&&_0x50d18d[_0xe3f9('0x4f')][0x0]&&_0x50d18d['alternatives'][0x0][_0xe3f9('0x50')]?_0x50d18d[_0xe3f9('0x4f')][0x0][_0xe3f9('0x50')]:'';})[_0xe3f9('0x51')]('\x0a');_0xcd03bf=_0x581b47[_0xe3f9('0x4e')][_0xe3f9('0x52')](function(_0x2119d8){return _0x2119d8&&_0x2119d8['alternatives'][0x0]&&_0x2119d8[_0xe3f9('0x4f')][0x0][_0xe3f9('0x53')]?_0x2119d8[_0xe3f9('0x4f')][0x0]['confidence']:0x0;})[_0xe3f9('0x51')]('\x0a');}logger['info'](_0xe3f9('0x54'),_0xccc71b);logger[_0xe3f9('0x24')]('googleASR\x20confidence',_0xcd03bf);return{'transcript':_0xccc71b,'confidence':_0xcd03bf};})['catch'](function(_0x219d65){logger['error'](_0xe3f9('0x55'),_0x219d65['statusCode'],_0x219d65['name'],_0x219d65['message']);});};exports[_0xe3f9('0x56')]=function(_0x106f49,_0x203caf,_0x7c1bf9,_0x3dd4ff){var _0x1c8d71=apiai(_0x203caf,{'language':_0x3dd4ff||'en'});return _0x1c8d71[_0xe3f9('0x57')](_0x7c1bf9,{'sessionId':md5(_0x106f49)})[_0xe3f9('0x2a')](function(_0x5ee7b1){logger[_0xe3f9('0x24')](JSON[_0xe3f9('0x41')](_0x5ee7b1));return{'source':_0x5ee7b1[_0xe3f9('0x58')][_0xe3f9('0x59')],'resolvedQuery':_0x5ee7b1[_0xe3f9('0x58')]['resolvedQuery'],'action':_0x5ee7b1[_0xe3f9('0x58')][_0xe3f9('0x5a')],'actionIncomplete':_0x5ee7b1[_0xe3f9('0x58')]['actionIncomplete'],'speech':_0x5ee7b1['result'][_0xe3f9('0x5b')][_0xe3f9('0x5c')],'score':_0x5ee7b1['result']['score'],'statusCode':_0x5ee7b1['status']['code'],'endConversation':_0x5ee7b1[_0xe3f9('0x58')]['metadata'][_0xe3f9('0x5d')]||![],'isFallbackIntent':_0x5ee7b1[_0xe3f9('0x58')][_0xe3f9('0x5e')]['isFallbackIntent']};});};exports[_0xe3f9('0x5f')]=function(_0x5f57ca,_0x6d2c08,_0x52abef,_0x112267,_0xfa1a5e,_0x3dd3e3){var _0x59f7e8=_0x112267['replace'](/\\n/g,'\x0a');var _0x2736f4={'credentials':{'private_key':_0x59f7e8,'client_email':_0x52abef}};var _0x10c397=new dialogflow[(_0xe3f9('0x60'))](_0x2736f4);var _0x485e2b=_0x10c397[_0xe3f9('0x61')](_0x6d2c08,md5(_0x5f57ca));var _0x1083b1={'session':_0x485e2b,'queryInput':{'text':{'text':_0xfa1a5e,'languageCode':_0x3dd3e3}}};return _0x10c397[_0xe3f9('0x62')](_0x1083b1)['then'](function(_0x408e90){if(_0x408e90&&_0x408e90[_0xe3f9('0x45')]){logger['info'](_0xe3f9('0x63'),JSON[_0xe3f9('0x41')](_0x408e90));var _0x32c593=_0x408e90[0x0];if(_0x32c593){var _0x539ccc={'action':_0x32c593[_0xe3f9('0x64')][_0xe3f9('0x5a')],'allRequiredParamsPresent':_0x32c593[_0xe3f9('0x64')][_0xe3f9('0x65')],'endConversation':_0x32c593['queryResult']['diagnosticInfo']&&_0x32c593[_0xe3f9('0x64')][_0xe3f9('0x66')][_0xe3f9('0x67')]?_0x32c593['queryResult'][_0xe3f9('0x66')][_0xe3f9('0x67')][_0xe3f9('0x68')][_0xe3f9('0x69')]:![],'fulfillmentText':_0x32c593[_0xe3f9('0x64')]['fulfillmentText'],'intentName':_0x32c593[_0xe3f9('0x64')][_0xe3f9('0x6a')][_0xe3f9('0x6b')],'intentDisplayName':_0x32c593[_0xe3f9('0x64')][_0xe3f9('0x6a')]['displayName'],'isFallbackIntent':_0x32c593[_0xe3f9('0x64')][_0xe3f9('0x6a')][_0xe3f9('0x6c')],'languageCode':_0x32c593[_0xe3f9('0x64')][_0xe3f9('0x6d')],'queryText':_0x32c593[_0xe3f9('0x64')]['queryText'],'responseId':_0x32c593[_0xe3f9('0x6e')],'score':_0x32c593[_0xe3f9('0x64')][_0xe3f9('0x6f')],'speech':_0x32c593[_0xe3f9('0x64')]['fulfillmentText'],'providerResponse':JSON[_0xe3f9('0x41')](_0x408e90)};return _0x539ccc;}}});};exports[_0xe3f9('0x70')]=function(_0x4720c2,_0x1aa3ec,_0x4ba47e,_0x4feb3a){return tilde['asr'](_0x4720c2,_0x1aa3ec,_0x4ba47e,_0x4feb3a)[_0xe3f9('0x2a')](function(_0x346a6d){try{fs[_0xe3f9('0x1d')](_0x4720c2);}catch(_0x40895a){logger['error'](_0x40895a);}logger[_0xe3f9('0x24')]('Tilde\x20ASR\x20transcription',_0x346a6d['transcript']);logger[_0xe3f9('0x24')]('Tilde\x20ASR\x20confidence',_0x346a6d[_0xe3f9('0x53')]);return _0x346a6d;});};exports['awsPolly']=function(_0x42a41e,_0x6f6b68,_0x32c5a8,_0x24ddfc,_0x1a016,_0x295d69){var _0x22ecd4=path[_0xe3f9('0x3a')](__dirname,_0xe3f9('0x36'),rs[_0xe3f9('0x27')](0x4)+_0xe3f9('0x37'));var _0x208d99;return aws[_0xe3f9('0x71')](_0x42a41e,_0x6f6b68,_0x32c5a8,_0x24ddfc,_0x1a016,_0x295d69,_0x22ecd4)[_0xe3f9('0x2a')](function(){_0x208d99=path['resolve'](__dirname,_0xe3f9('0x36'),rs[_0xe3f9('0x27')](0x4)+_0xe3f9('0x28'));return convertFile(_0x22ecd4,_0x208d99);})[_0xe3f9('0x2a')](function(){try{fs[_0xe3f9('0x1d')](_0x22ecd4);fs['chmodSync'](_0x208d99,_0xe3f9('0x2c'));}catch(_0x14cfd2){logger[_0xe3f9('0x16')](_0x14cfd2);}return _0x208d99[_0xe3f9('0x3c')]('.')[0x0];});};exports[_0xe3f9('0x72')]=function(_0x1fd404,_0x173090,_0x5af9ba,_0x2e6f6a,_0xa7fd17,_0x29bd4d){return aws['lex'](_0x1fd404,_0x173090,_0x5af9ba,_0x2e6f6a,_0xa7fd17,_0x29bd4d)[_0xe3f9('0x2a')](function(_0x524a26){logger['info'](JSON[_0xe3f9('0x41')](_0x524a26));return _0x524a26;});};exports[_0xe3f9('0x73')]=function(_0x1a3c0b,_0x33fd99,_0x1d9862,_0x3cee63){var _0x10aae1=util[_0xe3f9('0x74')](_0xe3f9('0x75'),ISPEECH_API,_0x1a3c0b,encodeURIComponent(_0x33fd99),_0x1d9862,_0x3cee63);var _0x4e3957=path[_0xe3f9('0x3a')](__dirname,_0xe3f9('0x36'),rs[_0xe3f9('0x27')](0x4)+'.mp3');var _0x3644f7;return downloadFile(_0x10aae1,_0x4e3957)[_0xe3f9('0x2a')](function(){_0x3644f7=path[_0xe3f9('0x3a')](__dirname,'tmp',rs[_0xe3f9('0x27')](0x4)+_0xe3f9('0x28'));return convertFile(_0x4e3957,_0x3644f7);})[_0xe3f9('0x2a')](function(){try{fs['unlink'](_0x4e3957);fs[_0xe3f9('0x2b')](_0x3644f7,'777');}catch(_0x24342b){logger[_0xe3f9('0x16')](_0x24342b);}return _0x3644f7[_0xe3f9('0x3c')]('.')[0x0];});};exports[_0xe3f9('0x76')]=function(_0x41b0d1,_0x41535a,_0x1da3bc,_0x2e40a2){var _0x108eff=util['format'](_0xe3f9('0x77'),ISPEECH_API,_0x41535a,_0x1da3bc,base64Encode(_0x41b0d1),_0x2e40a2?util['format']('model=%s',encodeURIComponent(_0x2e40a2)):_0xe3f9('0x78'));return uploadFile(_0x108eff)[_0xe3f9('0x2a')](function(_0x21a4d2){return querystring[_0xe3f9('0xb')](_0x21a4d2);});};exports[_0xe3f9('0x79')]=function(_0x5576ee,_0x19c2ba){return sestek['nda'](_0x5576ee,_0x19c2ba)['then'](function(_0x98b13b){logger[_0xe3f9('0x24')](JSON[_0xe3f9('0x41')](_0x98b13b));var _0x11b63a={'speech':_0x98b13b['text'],'action':_0x98b13b['channelData']?_0x98b13b[_0xe3f9('0x7a')][_0xe3f9('0x7b')]:undefined,'actiondata':_0x98b13b['channelData']?_0x98b13b[_0xe3f9('0x7a')][_0xe3f9('0x7c')]:undefined};if(_0x98b13b[_0xe3f9('0x7a')]&&_0x98b13b['channelData'][_0xe3f9('0x7d')]){return base64Decode(_0x98b13b['channelData'][_0xe3f9('0x7d')]['Data'],path['resolve'](__dirname,_0xe3f9('0x36'),rs[_0xe3f9('0x27')](0x4)+_0xe3f9('0x28')))[_0xe3f9('0x2a')](function(_0x272c98){_0x11b63a[_0xe3f9('0x7e')]=_0x272c98;return _0x11b63a;});}return _0x11b63a;});};exports[_0xe3f9('0x7f')]=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 38c5921..2aadd3a 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 _0x4b20=['exports'];(function(_0x1590dc,_0x2eed71){var _0x367282=function(_0x4ce874){while(--_0x4ce874){_0x1590dc['push'](_0x1590dc['shift']());}};_0x367282(++_0x2eed71);}(_0x4b20,0x1e8));var _0x04b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b20[_0x3dd15e];return _0x231fd0;};var nda=require('./nda');module[_0x04b2('0x0')]={'nda':nda}; \ No newline at end of file +var _0xe76a=['exports','./nda'];(function(_0x85dfd0,_0x161180){var _0x1fdff5=function(_0x4cbe1a){while(--_0x4cbe1a){_0x85dfd0['push'](_0x85dfd0['shift']());}};_0x1fdff5(++_0x161180);}(_0xe76a,0x1af));var _0xae76=function(_0x18fd01,_0x3e4a0a){_0x18fd01=_0x18fd01-0x0;var _0xafd22=_0xe76a[_0x18fd01];return _0xafd22;};var nda=require(_0xae76('0x0'));module[_0xae76('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 28e0a2d..7247110 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 _0x9993=['CustomAction','custom_action_data','CustomActionData','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','project','ndagenerate_audio','audio/wav'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x9993,0x109));var _0x3999=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x9993[_0x25e7cb];return _0x375d92;};'use strict';var rp=require(_0x3999('0x0'));var url=require('url');var logger=require(_0x3999('0x1'))(_0x3999('0x2'));module[_0x3999('0x3')]=function(_0x4b3123,_0x464d6f){var _0x4f3c12={'method':_0x3999('0x4'),'uri':url[_0x3999('0x5')](_0x464d6f[_0x3999('0x6')],'/token'),'form':{'grant_type':_0x3999('0x7'),'username':_0x464d6f[_0x3999('0x8')],'password':_0x464d6f['password']},'json':!![]};return rp(_0x4f3c12)[_0x3999('0x9')](function(_0x85b5af){var _0x4c1a49={'method':_0x3999('0x4'),'uri':url[_0x3999('0x5')](_0x464d6f['ndassistant_url'],_0x3999('0xa')),'body':{'type':_0x464d6f['ndaactivity_type']||_0x3999('0xb'),'channelId':_0x3999('0xc'),'conversation':{'id':_0x4b3123['uniqueid']},'from':{'id':_0x4b3123[_0x3999('0xd')],'name':_0x4b3123[_0x3999('0xe')]},'recipient':{'id':_0x4b3123[_0x3999('0xf')],'name':_0x4b3123[_0x3999('0x10')]},'text':_0x464d6f[_0x3999('0x11')],'channelData':{}},'headers':{'Authorization':_0x3999('0x12')+_0x85b5af[_0x3999('0x13')]},'json':!![]};if(_0x464d6f['project']){_0x4c1a49[_0x3999('0x14')][_0x3999('0x15')]['ProjectName']=_0x464d6f[_0x3999('0x16')];}if(_0x464d6f[_0x3999('0x17')]=='1'){_0x4c1a49[_0x3999('0x14')][_0x3999('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3999('0x18')};}if(_0x464d6f['custom_action']){_0x4c1a49[_0x3999('0x14')]['channelData'][_0x3999('0x19')]=_0x464d6f['custom_action'];if(_0x464d6f[_0x3999('0x1a')]){_0x4c1a49[_0x3999('0x14')][_0x3999('0x15')][_0x3999('0x1b')]=_0x464d6f['custom_action_data'];}}logger['info'](JSON[_0x3999('0x1c')](_0x4c1a49));return rp(_0x4c1a49);});}; \ No newline at end of file +var _0x8d53=['calleridname','dnid','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','password','username','ndassistant_url','ndaactivity_type','message','uniqueid','callerid'];(function(_0x1a830e,_0x35c437){var _0xf03675=function(_0x2ceb63){while(--_0x2ceb63){_0x1a830e['push'](_0x1a830e['shift']());}};_0xf03675(++_0x35c437);}(_0x8d53,0x1c2));var _0x38d5=function(_0x377e23,_0x2dc8fc){_0x377e23=_0x377e23-0x0;var _0x19e26a=_0x8d53[_0x377e23];return _0x19e26a;};'use strict';var rp=require(_0x38d5('0x0'));var url=require(_0x38d5('0x1'));var logger=require('../../../../../config/logger')(_0x38d5('0x2'));module[_0x38d5('0x3')]=function(_0x108137,_0x453bf8){var _0x3a7660={'method':_0x38d5('0x4'),'uri':url[_0x38d5('0x5')](_0x453bf8[_0x38d5('0x6')],'/token'),'form':{'grant_type':_0x38d5('0x7'),'username':_0x453bf8[_0x38d5('0x8')],'password':_0x453bf8[_0x38d5('0x7')]},'json':!![]};return rp(_0x3a7660)['then'](function(_0x5ebf9a){var _0x284f7b={'method':_0x38d5('0x4'),'uri':url[_0x38d5('0x5')](_0x453bf8[_0x38d5('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x453bf8[_0x38d5('0xa')]||_0x38d5('0xb'),'channelId':'Nda','conversation':{'id':_0x108137[_0x38d5('0xc')]},'from':{'id':_0x108137[_0x38d5('0xd')],'name':_0x108137[_0x38d5('0xe')]},'recipient':{'id':_0x108137[_0x38d5('0xf')],'name':_0x108137['extension']},'text':_0x453bf8['text'],'channelData':{}},'headers':{'Authorization':_0x38d5('0x10')+_0x5ebf9a[_0x38d5('0x11')]},'json':!![]};if(_0x453bf8['project']){_0x284f7b[_0x38d5('0x12')]['channelData'][_0x38d5('0x13')]=_0x453bf8[_0x38d5('0x14')];}if(_0x453bf8[_0x38d5('0x15')]=='1'){_0x284f7b[_0x38d5('0x12')][_0x38d5('0x16')][_0x38d5('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x453bf8[_0x38d5('0x18')]){_0x284f7b['body'][_0x38d5('0x16')]['CustomAction']=_0x453bf8[_0x38d5('0x18')];if(_0x453bf8[_0x38d5('0x19')]){_0x284f7b[_0x38d5('0x12')]['channelData'][_0x38d5('0x1a')]=_0x453bf8[_0x38d5('0x19')];}}logger[_0x38d5('0x1b')](JSON[_0x38d5('0x1c')](_0x284f7b));return rp(_0x284f7b);});}; \ 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 8f29ec3..45ec1dd 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 _0xcf52=['./lib/api','exports'];(function(_0x5c753b,_0x4916e3){var _0x3d66da=function(_0x3bbf7a){while(--_0x3bbf7a){_0x5c753b['push'](_0x5c753b['shift']());}};_0x3d66da(++_0x4916e3);}(_0xcf52,0x70));var _0x2cf5=function(_0x2da5b0,_0x374028){_0x2da5b0=_0x2da5b0-0x0;var _0x41e598=_0xcf52[_0x2da5b0];return _0x41e598;};'use strict';var asr=require(_0x2cf5('0x0'));module[_0x2cf5('0x1')]=function(_0xe96662,_0x556a9d,_0x199e9d,_0x30d843){return asr(_0xe96662,_0x556a9d,_0x199e9d,_0x30d843);}; \ No newline at end of file +var _0x5e9a=['./lib/api','exports'];(function(_0x3dde18,_0x11bdb0){var _0x436d04=function(_0x3f86ba){while(--_0x3f86ba){_0x3dde18['push'](_0x3dde18['shift']());}};_0x436d04(++_0x11bdb0);}(_0x5e9a,0x160));var _0xa5e9=function(_0x258d2a,_0x227588){_0x258d2a=_0x258d2a-0x0;var _0x48aad5=_0x5e9a[_0x258d2a];return _0x48aad5;};'use strict';var asr=require(_0xa5e9('0x0'));module[_0xa5e9('0x1')]=function(_0x3940a5,_0x3bba95,_0x52ba10,_0x57dc89){return asr(_0x3940a5,_0x3bba95,_0x52ba10,_0x57dc89);}; \ 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 6de8a23..ffe7515 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 _0x8220=['close','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','transcript','likelihood','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','lodash','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','Open\x20Tilde\x20ASR\x20socket','send','stringify','data'];(function(_0x4cfdfe,_0x55a62b){var _0x4eea9d=function(_0x32e668){while(--_0x32e668){_0x4cfdfe['push'](_0x4cfdfe['shift']());}};_0x4eea9d(++_0x55a62b);}(_0x8220,0xfc));var _0x0822=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x8220[_0x20fdc1];return _0x25397c;};'use strict';var BPromise=require('bluebird');var _=require(_0x0822('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x0822('0x1'));var logger=require(_0x0822('0x2'))(_0x0822('0x3'));module['exports']=function(_0x347411,_0x5e2255,_0x335539,_0x1125e8){return new BPromise(function(_0x5746e5,_0xbe785c){logger[_0x0822('0x4')](_0x0822('0x5'),_0x1125e8||_0x0822('0x6'));var _0x1e22df=new WebSocket(_0x1125e8||_0x0822('0x6'),{'perMessageDeflate':![]});var _0xfde23a='';var _0x137e3b='0';var _0x437cf6='1';var _0x104540='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x324842(_0x4c81fd){var _0x44e6d4=crypto[_0x0822('0x7')](_0x0822('0x8'));_0x44e6d4[_0x0822('0x9')](_0x4c81fd);return _0x44e6d4['digest']('hex');}function _0x577ca9(){try{logger[_0x0822('0x4')](_0x0822('0xa'));var _0x18863b=moment()['unix']();var _0x257ba5=_0x324842(_0x18863b+_0x5e2255+_0x335539);_0x1e22df[_0x0822('0xb')](JSON[_0x0822('0xc')]({'appID':_0x5e2255,'timestamp':_0x18863b,'appKey':_0x257ba5}));var _0x43558a=fs['createReadStream'](_0x347411);_0x43558a['on'](_0x0822('0xd'),function(_0x1125ce){_0x1e22df[_0x0822('0xb')](_0x1125ce);});_0x43558a['on'](_0x0822('0xe'),function(){_0x1e22df[_0x0822('0xb')](_0x0822('0xf'));});}catch(_0x3f2e82){logger['error'](_0x0822('0x10'),JSON['stringify'](_0x3f2e82));_0x1e22df['terminate']();}}function _0x4b9754(_0x1fe8b2){try{if(_0x1fe8b2){var _0x1876dc=JSON[_0x0822('0x11')](_0x1fe8b2);switch(_0x1876dc[_0x0822('0x12')]){case 0x0:if(_0x1876dc[_0x0822('0x13')]){if(_0x1876dc[_0x0822('0x13')][_0x0822('0x14')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x0822('0xc')](_0x1876dc[_0x0822('0x13')][_0x0822('0x15')]));_0xfde23a=_0x1876dc['result'][_0x0822('0x15')][0x0][_0x0822('0x16')];_0x137e3b=_0x1876dc[_0x0822('0x13')][_0x0822('0x15')][0x0][_0x0822('0x17')];_0x437cf6='0';_0x104540=_0x0822('0x18');_0x1e22df[_0x0822('0x19')]();}}break;case 0x1:logger['info'](_0x0822('0x1a'));_0x437cf6='1';_0x104540=_0x0822('0x1a');break;case 0x2:logger[_0x0822('0x4')](_0x0822('0x1b'));_0x437cf6='2';_0x104540='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x0822('0x4')](_0x0822('0x1c'));_0x437cf6='9';_0x104540='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x0822('0x4')](_0x0822('0x1d'));_0x437cf6='10';_0x104540='Authentication\x20failed.';break;case 0xb:logger[_0x0822('0x4')](_0x0822('0x1e'));_0x437cf6='11';_0x104540='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4d4192){logger[_0x0822('0x1f')](_0x0822('0x20'),JSON[_0x0822('0xc')](_0x4d4192));_0x1e22df['terminate']();}}function _0x23b178(){logger[_0x0822('0x4')](_0x0822('0x21'));_0x5746e5({'transcript':_0xfde23a,'confidence':_0x137e3b,'status':_0x437cf6,'status_message':_0x104540});}function _0x248f9e(_0x8230a5){logger[_0x0822('0x1f')](_0x0822('0x22'));if(!_[_0x0822('0x23')](_0x8230a5)){logger[_0x0822('0x1f')](_[_0x0822('0x24')](_0x8230a5)?JSON[_0x0822('0xc')](_0x8230a5):_0x8230a5);}}_0x1e22df['on'](_0x0822('0x25'),_0x577ca9);_0x1e22df['on']('message',_0x4b9754);_0x1e22df['on'](_0x0822('0xe'),_0x23b178);_0x1e22df['on'](_0x0822('0x1f'),_0x248f9e);});}; \ No newline at end of file +var _0x0d57=['data','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','close','bluebird','lodash','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream'];(function(_0xee3a8c,_0x13146c){var _0x41a2e2=function(_0x1c84a5){while(--_0x1c84a5){_0xee3a8c['push'](_0xee3a8c['shift']());}};_0x41a2e2(++_0x13146c);}(_0x0d57,0x66));var _0x70d5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0d57[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x70d5('0x0'));var _=require(_0x70d5('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require('../../../../../../config/logger')('agi');module[_0x70d5('0x2')]=function(_0x45a25b,_0x197640,_0x32556b,_0x280b80){return new BPromise(function(_0xa6319b,_0x11f352){logger['info'](_0x70d5('0x3'),_0x280b80||_0x70d5('0x4'));var _0x56be66=new WebSocket(_0x280b80||_0x70d5('0x4'),{'perMessageDeflate':![]});var _0x5d018d='';var _0x3cd9fa='0';var _0xa4a572='1';var _0x13981d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2240e8(_0x580961){var _0xa09608=crypto[_0x70d5('0x5')](_0x70d5('0x6'));_0xa09608[_0x70d5('0x7')](_0x580961);return _0xa09608['digest'](_0x70d5('0x8'));}function _0xb12c3c(){try{logger[_0x70d5('0x9')](_0x70d5('0xa'));var _0x21ede9=moment()[_0x70d5('0xb')]();var _0x1ce77b=_0x2240e8(_0x21ede9+_0x197640+_0x32556b);_0x56be66[_0x70d5('0xc')](JSON[_0x70d5('0xd')]({'appID':_0x197640,'timestamp':_0x21ede9,'appKey':_0x1ce77b}));var _0x40bc98=fs[_0x70d5('0xe')](_0x45a25b);_0x40bc98['on'](_0x70d5('0xf'),function(_0x1a819a){_0x56be66[_0x70d5('0xc')](_0x1a819a);});_0x40bc98['on']('close',function(){_0x56be66[_0x70d5('0xc')]('EOS');});}catch(_0x38d96b){logger[_0x70d5('0x10')](_0x70d5('0x11'),JSON[_0x70d5('0xd')](_0x38d96b));_0x56be66[_0x70d5('0x12')]();}}function _0x2dc5a4(_0x2fcdb7){try{if(_0x2fcdb7){var _0x149bf2=JSON[_0x70d5('0x13')](_0x2fcdb7);switch(_0x149bf2['status']){case 0x0:if(_0x149bf2['result']){if(_0x149bf2[_0x70d5('0x14')][_0x70d5('0x15')]){logger[_0x70d5('0x9')](_0x70d5('0x16'),JSON[_0x70d5('0xd')](_0x149bf2['result'][_0x70d5('0x17')]));_0x5d018d=_0x149bf2[_0x70d5('0x14')]['hypotheses'][0x0][_0x70d5('0x18')];_0x3cd9fa=_0x149bf2[_0x70d5('0x14')][_0x70d5('0x17')][0x0][_0x70d5('0x19')];_0xa4a572='0';_0x13981d=_0x70d5('0x1a');_0x56be66[_0x70d5('0x12')]();}}break;case 0x1:logger[_0x70d5('0x9')](_0x70d5('0x1b'));_0xa4a572='1';_0x13981d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x70d5('0x9')](_0x70d5('0x1c'));_0xa4a572='2';_0x13981d='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x70d5('0x9')](_0x70d5('0x1d'));_0xa4a572='9';_0x13981d=_0x70d5('0x1d');break;case 0xa:logger['info'](_0x70d5('0x1e'));_0xa4a572='10';_0x13981d='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xa4a572='11';_0x13981d=_0x70d5('0x1f');}}}catch(_0x56447e){logger[_0x70d5('0x10')](_0x70d5('0x20'),JSON[_0x70d5('0xd')](_0x56447e));_0x56be66[_0x70d5('0x12')]();}}function _0x42d59b(){logger[_0x70d5('0x9')](_0x70d5('0x21'));_0xa6319b({'transcript':_0x5d018d,'confidence':_0x3cd9fa,'status':_0xa4a572,'status_message':_0x13981d});}function _0x4d281a(_0x577b6a){logger[_0x70d5('0x10')](_0x70d5('0x22'));if(!_[_0x70d5('0x23')](_0x577b6a)){logger['error'](_[_0x70d5('0x24')](_0x577b6a)?JSON[_0x70d5('0xd')](_0x577b6a):_0x577b6a);}}_0x56be66['on']('open',_0xb12c3c);_0x56be66['on'](_0x70d5('0x25'),_0x2dc5a4);_0x56be66['on'](_0x70d5('0x26'),_0x42d59b);_0x56be66['on'](_0x70d5('0x10'),_0x4d281a);});}; \ 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 12b42a6..ff11021 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 _0x9acc=['./asr'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x9acc,0x110));var _0xc9ac=function(_0x2710dc,_0x14335d){_0x2710dc=_0x2710dc-0x0;var _0x3e89db=_0x9acc[_0x2710dc];return _0x3e89db;};var asr=require(_0xc9ac('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x2994=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2994,0x79));var _0x4299=function(_0x82f586,_0x382c19){_0x82f586=_0x82f586-0x0;var _0x591ec8=_0x2994[_0x82f586];return _0x591ec8;};var asr=require(_0x4299('0x0'));module[_0x4299('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 16ca745..08bd206 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c97be38..cbf80dd 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 _0x1af3=['moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','includes','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','randomstring'];(function(_0x2a06a5,_0x2183f7){var _0x136b4d=function(_0x586aab){while(--_0x586aab){_0x2a06a5['push'](_0x2a06a5['shift']());}};_0x136b4d(++_0x2183f7);}(_0x1af3,0x1ca));var _0x31af=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0x1af3[_0x319cb9];return _0x1735fc;};'use strict';var fs=require('fs');var util=require(_0x31af('0x0'));var _=require(_0x31af('0x1'));var sh=require(_0x31af('0x2'));var odbc=require(_0x31af('0x3'))();var rs=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var Mustache=require(_0x31af('0x6'));var rp=require(_0x31af('0x7'));var logger=require(_0x31af('0x8'))(_0x31af('0x9'));var config=require('../../config/environment');var scripts=require(_0x31af('0xa'));var FILES_PATH=_0x31af('0xb');var recursiveMapAttributes=[_0x31af('0xc'),_0x31af('0xd')];var verticesWithRetry=['menu',_0x31af('0xe'),_0x31af('0xf')];var AGIVertices=function(_0x406dd8,_0x524d00,_0x21c951){this[_0x31af('0x10')]=_0x406dd8;this[_0x31af('0x11')]=_0x524d00;this[_0x31af('0x12')]=_0x21c951;};AGIVertices[_0x31af('0x13')][_0x31af('0x14')]=function(_0x1fa064,_0x33b4a5){this['rpc'][_0x31af('0x15')](_0x1fa064)[_0x31af('0x16')](function(_0xc077e6){_0x33b4a5(null,_0xc077e6?_0xc077e6[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x481f20){_0x33b4a5(_0x481f20);});};AGIVertices[_0x31af('0x13')][_0x31af('0x19')]=function(_0x5c18b4,_0x4b801f){this[_0x31af('0x11')][_0x31af('0x1a')](_0x5c18b4)[_0x31af('0x16')](function(_0x10b9c6){_0x4b801f(null,_0x10b9c6?_0x10b9c6[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x369934){_0x4b801f(_0x369934);});};AGIVertices[_0x31af('0x13')][_0x31af('0x1b')]=function(_0x5a651f,_0x375ea2){this['rpc'][_0x31af('0x1c')](_0x5a651f)[_0x31af('0x16')](function(_0x3a2305){_0x375ea2(null,_0x3a2305?_0x3a2305[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x30a112){_0x375ea2(_0x30a112);});};AGIVertices[_0x31af('0x13')][_0x31af('0x1d')]=function(_0x3246c6,_0x550870){this[_0x31af('0x11')][_0x31af('0x1e')](_0x3246c6)[_0x31af('0x16')](function(_0x2ce4c2){_0x550870(null,_0x2ce4c2?_0x2ce4c2[_0x31af('0x1f')]:![]);})['catch'](function(_0x1a0bd0){_0x550870(_0x1a0bd0);});};AGIVertices[_0x31af('0x13')][_0x31af('0x20')]=function(_0x2e600a,_0x394d13){this[_0x31af('0x11')][_0x31af('0x21')](_0x2e600a)[_0x31af('0x16')](function(_0x3f673f){_0x394d13(null,_0x3f673f?_0x3f673f[_0x31af('0x17')]:![]);})[_0x31af('0x18')](function(_0x1a67e3){_0x394d13(_0x1a67e3);});};AGIVertices[_0x31af('0x13')][_0x31af('0x22')]=function(_0x32f189,_0x5ae495){this['rpc']['getTrunkById'](_0x32f189)[_0x31af('0x16')](function(_0x2b3bad){_0x5ae495(null,_0x2b3bad?_0x2b3bad['name']:![]);})[_0x31af('0x18')](function(_0x8f9f60){_0x5ae495(_0x8f9f60);});};AGIVertices['prototype'][_0x31af('0x23')]=function(_0x21e227,_0x53b726){var _0x171b7f=this;this[_0x31af('0x11')][_0x31af('0x24')](_0x21e227)[_0x31af('0x16')](function(_0x3326a7){_0x53b726(null,_0x3326a7?_0x171b7f['getSoundPath'](_0x3326a7[_0x31af('0x25')]):![]);})[_0x31af('0x18')](function(_0x1e6df8){_0x53b726(_0x1e6df8);});};AGIVertices[_0x31af('0x13')][_0x31af('0x26')]=function(_0x3e885e,_0x149d01){this[_0x31af('0x11')][_0x31af('0x27')](_0x3e885e)[_0x31af('0x16')](function(_0x388e9c){_0x149d01(null,_0x388e9c?_0x388e9c:![]);})[_0x31af('0x18')](function(_0x57d570){_0x149d01(_0x57d570);});};AGIVertices[_0x31af('0x13')][_0x31af('0x28')]=function(_0x4d5166,_0x4cabed,_0x50dd99){this[_0x31af('0x12')]['sendMailMessage'](_0x4d5166,_0x4cabed)[_0x31af('0x16')](function(){_0x50dd99(null);})[_0x31af('0x18')](function(_0x2899a0){_0x50dd99(_0x2899a0);});};AGIVertices[_0x31af('0x13')][_0x31af('0x29')]=function(_0x4bfbe9,_0x52f251){this[_0x31af('0x11')][_0x31af('0x2a')](_0x4bfbe9)[_0x31af('0x16')](function(_0x7481ca){if(_0x7481ca){if(_0x7481ca[_0x31af('0x2b')]){_0x52f251(null,[_0x7481ca[_0x31af('0x2c')]]);}else{_0x52f251(null,_[_0x31af('0x2d')](_0x7481ca[_0x31af('0x2e')],'interval'));}}else{_0x52f251(null,![]);}})[_0x31af('0x18')](function(_0x57af86){_0x52f251(_0x57af86);});};AGIVertices[_0x31af('0x13')][_0x31af('0x2f')]=function(_0x254f1a){return util[_0x31af('0x30')](_0x31af('0x31'),FILES_PATH,_0x254f1a);};AGIVertices['prototype']['getQueryOdbc']=function(_0x53bb6d,_0x318005,_0x1ce300){odbc[_0x31af('0x32')](_0x53bb6d,function(_0x1cfdd3){if(_0x1cfdd3){logger[_0x31af('0x33')](_0x31af('0x34'),_0x1cfdd3);_0x1ce300(_0x1cfdd3);}else{logger[_0x31af('0x35')](_0x31af('0x36'));odbc['query'](_0x318005,function(_0x3d7cf2,_0x16f3e1){if(_0x3d7cf2){logger[_0x31af('0x35')](_0x31af('0x37'),_0x318005);_0x1ce300(_0x3d7cf2);}else{logger[_0x31af('0x35')](_0x31af('0x38'),_0x318005);odbc[_0x31af('0x39')](function(_0xe90ba9){if(_0xe90ba9){logger[_0x31af('0x33')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xe90ba9);}_0x1ce300(null,_0x16f3e1);});}});}});};AGIVertices[_0x31af('0x13')]['getSmsAccount']=function(_0x447a01,_0x5405e3){this['rpc'][_0x31af('0x3a')](_0x447a01)[_0x31af('0x16')](function(_0x110f38){_0x5405e3(null,_0x110f38?_0x110f38:![]);})[_0x31af('0x18')](function(_0x188e34){_0x5405e3(_0x188e34);});};AGIVertices[_0x31af('0x13')][_0x31af('0x3b')]=function(_0x4fd8c4,_0x33b1ea){this[_0x31af('0x11')][_0x31af('0x3b')](_0x4fd8c4)['then'](function(_0x44e10e){_0x33b1ea(null,_0x44e10e);})[_0x31af('0x18')](function(_0x1d8d27){_0x33b1ea(_0x1d8d27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x3c')]=function(_0x57da2c,_0x12357c,_0x3b10ef){this[_0x31af('0x11')][_0x31af('0x3c')]({'uniqueid':this['channel'][_0x31af('0x3d')],'node':_0x57da2c[_0x31af('0x3e')],'application':_0x57da2c['agicommand'],'data':_0x12357c||null,'project_name':this[_0x31af('0x10')][_0x31af('0x3f')],'callerid':this[_0x31af('0x10')][_0x31af('0x40')]})[_0x31af('0x16')](function(_0x334b95){if(_0x3b10ef){_0x3b10ef(null,_0x334b95);}})[_0x31af('0x18')](function(_0x3a349f){if(_0x3b10ef){_0x3b10ef(_0x3a349f);}});};AGIVertices[_0x31af('0x13')][_0x31af('0x41')]=function(_0x52a602,_0x48f7b4,_0x19cbc0,_0x492725){this[_0x31af('0x11')][_0x31af('0x41')]({'uniqueid':this[_0x31af('0x10')]['uniqueid'],'callerid':this['channel'][_0x31af('0x40')],'calleridname':this['channel'][_0x31af('0x42')],'context':this[_0x31af('0x10')][_0x31af('0x43')],'extension':this[_0x31af('0x10')]['extension'],'priority':this['channel'][_0x31af('0x44')],'accountcode':this[_0x31af('0x10')][_0x31af('0x45')],'dnid':this[_0x31af('0x10')]['dnid'],'projectName':this[_0x31af('0x10')][_0x31af('0x3f')],'saveName':_0x48f7b4,'filename':_0x52a602[_0x31af('0x46')]||_0x48f7b4,'savePath':_0x19cbc0})['then'](function(_0x5a1cbe){_0x492725(null,_0x5a1cbe);})[_0x31af('0x18')](function(_0xdccf27){_0x492725(_0xdccf27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x47')]=function(_0x2880f3,_0x198969,_0x39201e,_0x275780,_0x1ac4ae){this[_0x31af('0x11')]['createSquareMessage']({'uniqueid':this[_0x31af('0x10')][_0x31af('0x3d')],'body':_0x2880f3,'direction':_0x198969,'providerName':_0x39201e,'providerResponse':_0x275780})[_0x31af('0x16')](function(_0xe75210){if(_0x1ac4ae){_0x1ac4ae(null,_0xe75210);}})[_0x31af('0x18')](function(_0x896839){if(_0x1ac4ae){_0x1ac4ae(_0x896839);}});};AGIVertices[_0x31af('0x13')][_0x31af('0x48')]=function(_0x1a6438,_0x25369b){this[_0x31af('0x11')][_0x31af('0x48')]({'firstName':_[_0x31af('0x49')](_0x1a6438[_0x31af('0x17')])||_['isNil'](_0x1a6438[_0x31af('0x17')])?_0x31af('0x4a')+Math[_0x31af('0x4b')]():_0x1a6438['name'],'lastName':_[_0x31af('0x49')](_0x1a6438[_0x31af('0x4c')])||_[_0x31af('0x4d')](_0x1a6438['lastName'])?null:_0x1a6438[_0x31af('0x4c')],'phone':_0x1a6438[_0x31af('0x4e')],'ListId':_0x1a6438[_0x31af('0x4f')],'scheduledat':_0x1a6438[_0x31af('0x50')],'callbackUniqueid':this[_0x31af('0x10')][_0x31af('0x3d')],'tags':_0x31af('0x51'),'description':'Callback\x20scheduled\x20at\x20'+_0x1a6438[_0x31af('0x50')][_0x31af('0x52')](),'priority':_0x1a6438[_0x31af('0x53')]})[_0x31af('0x16')](function(_0x58c0ff){_0x25369b(null,_0x58c0ff);})['catch'](function(_0x4b57bc){_0x25369b(_0x4b57bc);});};AGIVertices['prototype'][_0x31af('0x54')]=function(_0x152e4f,_0x202634){this[_0x31af('0x11')][_0x31af('0x55')](_0x152e4f)[_0x31af('0x16')](function(_0x5cc45b){_0x202634(null,_0x5cc45b?_0x5cc45b[_0x31af('0x17')]:![]);})['catch'](function(_0x19015d){_0x202634(_0x19015d);});};AGIVertices[_0x31af('0x13')]['agentPause']=function(_0x439171,_0xc6511,_0x5c5834){var _0x820339={'role':_0x31af('0x56')};_0x820339[_0x439171]=this[_0x31af('0x10')][_0x31af('0x40')];this['rpc']['agentPause'](_0x820339,_0xc6511,this[_0x31af('0x10')][_0x31af('0x3d')])['then'](function(_0x345469){_0x5c5834(null,_[_0x31af('0x4d')](_0x345469)?![]:!![]);})[_0x31af('0x18')](function(_0x209038){logger[_0x31af('0x33')](_0x209038);_0x5c5834(null,![]);});};AGIVertices[_0x31af('0x13')]['agentUnpause']=function(_0x28f6ee,_0x45e195){var _0x453db0={'role':_0x31af('0x56')};_0x453db0[_0x28f6ee]=this[_0x31af('0x10')][_0x31af('0x40')];this[_0x31af('0x11')]['agentUnpause'](_0x453db0)[_0x31af('0x16')](function(_0x7e9169){_0x45e195(null,_[_0x31af('0x4d')](_0x7e9169)?![]:!![]);})[_0x31af('0x18')](function(_0x4b1d51){logger[_0x31af('0x33')](_0x4b1d51);_0x45e195(null,![]);});};AGIVertices['prototype'][_0x31af('0x57')]=function(_0x4c71b3,_0x3d3f66){var _0x441679={'role':_0x31af('0x56')};_0x441679[_0x4c71b3]=this[_0x31af('0x10')][_0x31af('0x40')];this[_0x31af('0x11')][_0x31af('0x57')](_0x441679)[_0x31af('0x16')](function(_0x107aba){_0x3d3f66(null,_[_0x31af('0x4d')](_0x107aba)?![]:!![]);})['catch'](function(_0x5d9c73){logger[_0x31af('0x33')](_0x5d9c73);_0x3d3f66(null,![]);});};AGIVertices[_0x31af('0x13')][_0x31af('0x58')]=function(_0x3610a8,_0x1de9ac){var _0x50d8f1={'role':_0x31af('0x56')};_0x50d8f1[_0x3610a8]=this[_0x31af('0x10')]['callerid'];var _0x172f45=_0x3610a8!=_0x31af('0x59')?util[_0x31af('0x30')]('%s/%s@from-sip/n',_0x31af('0x5a'),this[_0x31af('0x10')][_0x31af('0x40')]):undefined;this[_0x31af('0x11')][_0x31af('0x58')](_0x50d8f1,_0x172f45)[_0x31af('0x16')](function(_0x5cccfe){_0x1de9ac(null,_[_0x31af('0x4d')](_0x5cccfe)?![]:!![]);})['catch'](function(_0x4c833a){logger[_0x31af('0x33')](_0x4c833a);_0x1de9ac(null,![]);});};AGIVertices[_0x31af('0x13')][_0x31af('0x5b')]=function(_0x51a7dc,_0x1972c7){sh[_0x31af('0x5c')](_[_0x31af('0x5d')](_0x51a7dc),function(_0x27241d,_0x30e9b5){var _0x2a13d4=_0x30e9b5[_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'');_0x1972c7(null,_0x2a13d4);});};AGIVertices[_0x31af('0x13')][_0x31af('0x5f')]=function(_0x342426,_0x1dbc50){scripts[_0x31af('0x5f')](_0x342426[_0x31af('0x60')],_0x342426['google_cloud_tts_text_type']||_0x31af('0x61'),_0x342426[_0x31af('0x61')],_0x342426[_0x31af('0x62')]||_0x31af('0x63'),_0x342426[_0x31af('0x64')]||'MALE',_0x342426[_0x31af('0x65')]||_0x31af('0x66'))[_0x31af('0x16')](function(_0x52b54a){_0x1dbc50(null,_0x52b54a);})[_0x31af('0x18')](function(_0x4f6354){_0x1dbc50(_0x4f6354);});};AGIVertices['prototype']['googleTTS']=function(_0x26ddb0,_0x147a74){scripts[_0x31af('0x67')](_0x26ddb0[_0x31af('0x61')],_0x26ddb0[_0x31af('0x68')]||'en',0x1)[_0x31af('0x16')](function(_0x625679){_0x147a74(null,_0x625679);})[_0x31af('0x18')](function(_0x499b43){_0x147a74(_0x499b43);});};AGIVertices[_0x31af('0x13')]['restAPI']=function(_0x20ded5,_0x443ad5){var _0x251e98={'uri':_0x20ded5[_0x31af('0x69')],'method':_0x20ded5[_0x31af('0x6a')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x20ded5['timeout'])===_0x31af('0x6b')&&parseInt(_0x20ded5['timeout'])>=0x1?parseInt(_0x20ded5['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x31af('0x6c'),_0x31af('0x6d')],_0x251e98[_0x31af('0x6a')][_0x31af('0x6e')]())){try{_0x251e98[_0x31af('0x6f')]=_0x20ded5[_0x31af('0xd')]?JSON[_0x31af('0x70')](_0x20ded5['rawBody']):{};}catch(_0x20ce38){logger[_0x31af('0x33')](_0x31af('0x71'),_0x20ce38);}}try{_0x251e98[_0x31af('0x72')]=_0x20ded5[_0x31af('0xc')]?JSON[_0x31af('0x70')](_0x20ded5[_0x31af('0xc')]):{};}catch(_0x38943b){logger[_0x31af('0x33')](_0x31af('0x73'),_0x38943b);}if(_0x20ded5[_0x31af('0x74')]){try{var _0x39f7fd=require(_0x20ded5[_0x31af('0x74')])[_0x31af('0x75')](this,_0x251e98);_0x251e98['uri']=Mustache[_0x31af('0x76')](_0x20ded5['url'],_0x39f7fd,{},['$$','$$']);if(_0x251e98[_0x31af('0x72')]){_0x251e98['headers']=JSON[_0x31af('0x70')](Mustache['render'](JSON['stringify'](_0x251e98[_0x31af('0x72')]),_0x39f7fd,{},['$$','$$']));}if(_0x251e98[_0x31af('0x6f')]){_0x251e98[_0x31af('0x6f')]=JSON[_0x31af('0x70')](Mustache[_0x31af('0x76')](JSON[_0x31af('0x77')](_0x251e98[_0x31af('0x6f')]),_0x39f7fd,{},['$$','$$']));}}catch(_0x17a278){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x17a278);}}rp(_0x251e98)[_0x31af('0x16')](function(_0x2f308e){var _0x85ec13={'statusCode':_0x2f308e[_0x31af('0x78')]||0xc8,'statusMessage':_0x2f308e[_0x31af('0x79')]||'OK','headers':_0x2f308e[_0x31af('0x72')]||{},'body':_0x2f308e[_0x31af('0x6f')]||{}};_0x443ad5(null,_0x85ec13);})['catch'](function(_0xf1a1bf){var _0x2dd7ac={'statusCode':_0xf1a1bf[_0x31af('0x78')]||0x1f4,'statusMessage':_0xf1a1bf['message']||_0x31af('0x7a'),'headers':_0xf1a1bf[_0x31af('0x7b')]['headers']||{},'body':_0xf1a1bf[_0x31af('0x7b')][_0x31af('0x6f')]||{}};_0x443ad5(null,_0x2dd7ac);});};AGIVertices[_0x31af('0x13')]['googleDialogflow']=function(_0x58db8e,_0x68efb7){scripts[_0x31af('0x7c')](this['channel'][_0x31af('0x3d')],_0x58db8e[_0x31af('0x7d')],_0x58db8e['text'],_0x58db8e[_0x31af('0x7e')]||'en')['then'](function(_0x4c2512){_0x68efb7(null,_0x4c2512);})['catch'](function(_0x2f5a27){_0x68efb7(_0x2f5a27);});};AGIVertices[_0x31af('0x13')][_0x31af('0x7f')]=function(_0x3dc355,_0x5bcd7b){scripts['googleDialogflowV2'](this[_0x31af('0x10')][_0x31af('0x3d')],_0x3dc355[_0x31af('0x80')],_0x3dc355['client_email'],_0x3dc355[_0x31af('0x81')],_0x3dc355['text'],_0x3dc355[_0x31af('0x82')]||'en')[_0x31af('0x16')](function(_0x5e10ec){_0x5bcd7b(null,_0x5e10ec);})[_0x31af('0x18')](function(_0x7105d4){_0x5bcd7b(_0x7105d4);});};AGIVertices[_0x31af('0x13')][_0x31af('0x83')]=function(_0x1b940a,_0xbf906e){scripts[_0x31af('0x83')](this[_0x31af('0x10')],_0x1b940a)['then'](function(_0x12810b){_0xbf906e(null,_0x12810b);})[_0x31af('0x18')](function(_0x108c5d){_0xbf906e(_0x108c5d);});};AGIVertices[_0x31af('0x13')][_0x31af('0x84')]=function(_0x1a2d1f,_0x3f3798){scripts[_0x31af('0x84')](_0x1a2d1f[_0x31af('0x7d')],_0x1a2d1f['text'],_0x1a2d1f[_0x31af('0x85')]||_0x31af('0x63'),_0x1a2d1f[_0x31af('0x86')])[_0x31af('0x16')](function(_0x53499f){_0x3f3798(null,_0x53499f);})[_0x31af('0x18')](function(_0x5c23ae){_0x3f3798(_0x5c23ae);});};AGIVertices[_0x31af('0x13')][_0x31af('0x87')]=function(_0x4e09db,_0x97e9d1,_0xb471ad){scripts[_0x31af('0x87')](_0x97e9d1,_0x4e09db[_0x31af('0x7d')],_0x4e09db[_0x31af('0x88')]||'en-US',this[_0x31af('0x89')](_0x4e09db[_0x31af('0x8a')])?_0x4e09db[_0x31af('0x8a')]:undefined)[_0x31af('0x16')](function(_0x23fca2){_0xb471ad(null,_0x23fca2);})[_0x31af('0x18')](function(_0x1e6afa){_0xb471ad(_0x1e6afa);});};AGIVertices[_0x31af('0x13')][_0x31af('0x8b')]=function(_0x473338,_0x650e83){scripts[_0x31af('0x8b')](_0x473338[_0x31af('0x8c')],_0x473338[_0x31af('0x8d')],_0x473338[_0x31af('0x8e')],_0x473338[_0x31af('0x8f')]||_0x31af('0x90'),_0x473338[_0x31af('0x61')],_0x473338['aws_text_type']||_0x31af('0x61'))[_0x31af('0x16')](function(_0x2a78a9){_0x650e83(null,_0x2a78a9);})[_0x31af('0x18')](function(_0x553442){_0x650e83(_0x553442);});};AGIVertices[_0x31af('0x13')][_0x31af('0x91')]=function(_0x4ffaa2,_0x402290){scripts[_0x31af('0x91')](this[_0x31af('0x10')][_0x31af('0x3d')],_0x4ffaa2[_0x31af('0x8c')],_0x4ffaa2['aws_secret_access_key'],_0x4ffaa2['aws_lex_region'],_0x4ffaa2[_0x31af('0x61')],_0x4ffaa2[_0x31af('0x92')])[_0x31af('0x16')](function(_0x2198d9){_0x402290(null,_0x2198d9);})[_0x31af('0x18')](function(_0x562e31){_0x402290(_0x562e31);});};AGIVertices[_0x31af('0x13')][_0x31af('0x93')]=function(_0x574d4a,_0x4a6833,_0x5a6cd5){scripts[_0x31af('0x93')](_0x4a6833,_0x574d4a[_0x31af('0x7d')],_0x574d4a[_0x31af('0x94')]||_0x31af('0x63'))['then'](function(_0x2ae2f0){_0x5a6cd5(null,_0x2ae2f0);})[_0x31af('0x18')](function(_0x58db7b){_0x5a6cd5(_0x58db7b);});};AGIVertices['prototype'][_0x31af('0x95')]=function(_0x1c6cb9,_0x5eff1f,_0x2ad67a){scripts[_0x31af('0x95')](_0x5eff1f,_0x1c6cb9[_0x31af('0x96')],_0x1c6cb9[_0x31af('0x97')],_0x1c6cb9[_0x31af('0x98')])[_0x31af('0x16')](function(_0x50a967){_0x2ad67a(null,_0x50a967);})['catch'](function(_0x436b7b){_0x2ad67a(_0x436b7b);});};AGIVertices[_0x31af('0x13')]['clear']=function(_0xb600ef){var _0x23792f=_[_0x31af('0x99')](verticesWithRetry,_0xb600ef[_0x31af('0x9a')])?_0xb600ef:_[_0x31af('0x9b')](_0xb600ef);for(var _0x758084 in _0x23792f){if(_0x23792f[_0x31af('0x9c')](_0x758084)){if(_0x23792f[_0x758084]&&_[_0x31af('0x9d')](_0x23792f[_0x758084])){if(_[_0x31af('0x99')](recursiveMapAttributes,_0x758084)){_0x23792f[_0x758084]=this[_0x31af('0x9e')](_0x23792f[_0x758084]);}else{_0x23792f[_0x758084]=this[_0x31af('0x9f')](_0x23792f[_0x758084]);}}}}return _0x23792f;};AGIVertices[_0x31af('0x13')][_0x31af('0xa0')]=function(_0x1035a0){for(var _0x3cc775 in _0x1035a0){if(_0x1035a0[_0x31af('0x9c')](_0x3cc775)){if(_[_0x31af('0xa1')](_0x1035a0[_0x3cc775])){this[_0x31af('0xa0')](_0x1035a0[_0x3cc775]);}else if(_['isArray'](_0x1035a0[_0x3cc775])){for(var _0x54d549=0x0;_0x54d549<_0x1035a0[_0x3cc775][_0x31af('0xa2')];_0x54d549++){this[_0x31af('0xa0')](_0x1035a0[_0x3cc775][_0x54d549]);}}else if(_[_0x31af('0x9d')](_0x1035a0[_0x3cc775])){_0x1035a0[_0x3cc775]=this[_0x31af('0x9f')](_0x1035a0[_0x3cc775]);}}}};AGIVertices[_0x31af('0x13')][_0x31af('0xa3')]=function(_0x580ad9,_0xcdbb6b){for(var _0x22de90 in _0x580ad9){if(_0x580ad9[_0x31af('0x9c')](_0x22de90)){if(_['isPlainObject'](_0x580ad9[_0x22de90])){if(!_[_0x31af('0x49')](_0x580ad9[_0x22de90])){this[_0x31af('0xa3')](_0x580ad9[_0x22de90],util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90));}}else if(_[_0x31af('0xa5')](_0x580ad9[_0x22de90])){for(var _0x1c254e=0x0;_0x1c254e<_0x580ad9[_0x22de90][_0x31af('0xa2')];_0x1c254e++){this[_0x31af('0xa3')](_0x580ad9[_0x22de90][_0x1c254e],util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90+'['+_0x1c254e+']'));}}else{if(!_['isNil'](_0x580ad9[_0x22de90])){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xa4'),_0xcdbb6b,_0x22de90),_0x580ad9[_0x22de90]);}}}}};AGIVertices[_0x31af('0x13')][_0x31af('0x9e')]=function(_0x429027){try{var _0x25ef0b=JSON['parse'](_0x429027);this['recursiveNodeIndex'](_0x25ef0b);return JSON[_0x31af('0x77')](_0x25ef0b);}catch(_0x287578){return this[_0x31af('0x9f')](_0x429027);}};AGIVertices[_0x31af('0x13')]['replaceAllVariables']=function(_0x56b4c1){var _0x537e5a=_0x56b4c1[_0x31af('0xa7')]('{');for(var _0x176686=0x1;_0x176686<_0x537e5a['length'];_0x176686+=0x1){var _0x454c6c=_0x537e5a[_0x176686][_0x31af('0xa7')]('}');if(_0x454c6c[_0x31af('0xa2')]>0x1){_0x56b4c1=_0x56b4c1[_0x31af('0xa8')]('{'+_0x454c6c[0x0]+'}',this[_0x31af('0x10')][_0x31af('0x14')](_0x454c6c[0x0])[_0x31af('0xa9')]||_0x454c6c[0x0]);}}if(_0x537e5a[_0x31af('0xa2')]===0x1){return _0x56b4c1['toString']();}return this[_0x31af('0x9f')](_0x56b4c1);};AGIVertices[_0x31af('0x13')]['getAndSetVariable']=function(_0x1a3aa6,_0x27834a){var _0x33cdac=this[_0x31af('0x10')]['getVariable'](_0x1a3aa6);if(_0x33cdac[_0x31af('0xaa')]===-0x1){return _0x33cdac;}logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xab'),_0x27834a,_0x33cdac[_0x31af('0xa9')]));return this['channel'][_0x31af('0xa6')](_0x27834a,_0x33cdac['extra']);};AGIVertices['prototype'][_0x31af('0x89')]=function(_0x2dfda4){return _0x2dfda4&&_0x2dfda4!=='0'&&_0x2dfda4!=='-1'&&_0x2dfda4!=='';};AGIVertices[_0x31af('0x13')][_0x31af('0xac')]=function(_0x759c19){this[_0x31af('0x3c')]['sync'](this,_0x759c19,'-');_0x759c19['retry']=_0x759c19[_0x31af('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x517893){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xad'),_0x517893[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x517893[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xaf'));}var _0x2823cb='\x22'+_0x517893[_0x31af('0x61')]+'\x22';if(this['isConfigured'](_0x517893[_0x31af('0x7b')])){_0x2823cb+=','+_0x517893[_0x31af('0x7b')];}var _0x42f5d3=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x2823cb);if(_0x42f5d3[_0x31af('0xaa')]===-0x1){return _0x42f5d3;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xb1'),_0x2823cb));};AGIVertices[_0x31af('0x13')][_0x31af('0xb2')]=function(_0x58a8f6){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x58a8f6[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x58a8f6[_0x31af('0xb3')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xb4'));}var _0x103a8e=_0x58a8f6[_0x31af('0xb3')];if(this[_0x31af('0x89')](_0x58a8f6[_0x31af('0x7b')])){_0x103a8e+=','+_0x58a8f6[_0x31af('0x7b')];}var _0x28ba13=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb5'),_0x103a8e);if(_0x28ba13['result']===-0x1){return _0x28ba13;}var _0x25ebed=this[_0x31af('0xb6')](_0x31af('0xb7'),_0x31af('0xb8'));if(_0x25ebed[_0x31af('0xaa')]===-0x1){return _0x25ebed;}var _0xa855d1=this['getAndSetVariable'](_0x31af('0xb9'),_0x31af('0xba'));if(_0xa855d1[_0x31af('0xaa')]===-0x1){return _0xa855d1;}var _0x5bf030=this[_0x31af('0xb6')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5bf030['result']===-0x1){return _0x5bf030;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x103a8e));};AGIVertices[_0x31af('0x13')][_0x31af('0x9')]=function(_0x4925c7){logger['info'](util[_0x31af('0x30')](_0x31af('0xbb'),_0x4925c7[_0x31af('0x3e')]));return this[_0x31af('0x10')]['agi']([_0x4925c7[_0x31af('0xbc')],_0x4925c7['args']]);};AGIVertices[_0x31af('0x13')][_0x31af('0xbd')]=function(_0x901ab3){logger['info'](util[_0x31af('0x30')](_0x31af('0xbe'),_0x901ab3[_0x31af('0x3e')]));if(this[_0x31af('0x89')](_0x901ab3[_0x31af('0xbf')])){logger['info'](util['format'](_0x31af('0xc0'),_0x901ab3['timeout']));var _0x11c047=this['channel'][_0x31af('0xc1')](_0x901ab3[_0x31af('0xbf')]);if(_0x11c047[_0x31af('0xaa')]===-0x1){return _0x11c047;}}return this[_0x31af('0x10')][_0x31af('0xbd')]();};AGIVertices['prototype'][_0x31af('0x51')]=function(_0x472ed9){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xc2'),_0x472ed9['label']));if(!this[_0x31af('0x89')](_0x472ed9['list_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x472ed9,'no\x20list\x20selected');}_0x472ed9['scheduledAt']=moment();if(this['isConfigured'](_0x472ed9[_0x31af('0xc3')])){_0x472ed9[_0x31af('0x50')]=moment()['add'](_0x472ed9[_0x31af('0xc3')],_0x31af('0xc4'));}if(!this['isConfigured'](_0x472ed9[_0x31af('0x53')])){_0x472ed9[_0x31af('0x53')]=0x2;}this[_0x31af('0x48')][_0x31af('0x75')](this,_0x472ed9);return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xc5'),_0x472ed9[_0x31af('0x4e')],_0x472ed9[_0x31af('0x4f')],_0x472ed9[_0x31af('0x50')]));};AGIVertices[_0x31af('0x13')][_0x31af('0xc6')]=function(_0x1a3049){logger['info'](util[_0x31af('0x30')](_0x31af('0xc7'),_0x1a3049[_0x31af('0x3e')]));var _0x2751d6=this[_0x31af('0x10')]['exec'](_0x1a3049['application'],_0x1a3049['options']);if(_0x2751d6['result']===-0x1){return _0x2751d6;}return this['channel'][_0x31af('0xae')](util['format']('Executed\x20command\x20%s\x20%s',_0x1a3049[_0x31af('0xc8')],_0x1a3049['options']));};AGIVertices['prototype'][_0x31af('0xc9')]=function(_0x55183d){logger['info'](util[_0x31af('0x30')](_0x31af('0xca'),_0x55183d[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x55183d[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xaf'));}var _0x1dccc5='\x22'+_0x55183d[_0x31af('0x61')]+'\x22';if(this[_0x31af('0x89')](_0x55183d[_0x31af('0x7b')])){_0x1dccc5+=','+_0x55183d[_0x31af('0x7b')];}var _0x398174=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x1dccc5);if(_0x398174[_0x31af('0xaa')]===-0x1){return _0x398174;}return this['channel'][_0x31af('0xae')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1dccc5));};AGIVertices[_0x31af('0x13')][_0x31af('0xcb')]=function(_0xae3285){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xcc'),_0xae3285[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xae3285[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20text\x20configured');}var _0x4607a2='\x22'+_0xae3285[_0x31af('0x61')]+'\x22';if(this[_0x31af('0x89')](_0xae3285[_0x31af('0x7b')])){_0x4607a2+=','+_0xae3285[_0x31af('0x7b')];}var _0x50ab11=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0xb0'),_0x4607a2);if(_0x50ab11[_0x31af('0xaa')]===-0x1){return _0x50ab11;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4607a2));};AGIVertices[_0x31af('0x13')]['lumenvoxasr']=function(_0xb69db4){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xcd'),_0xb69db4[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xb69db4[_0x31af('0xb3')])){return this[_0x31af('0x10')]['noop']('no\x20grammar\x20configured');}var _0x37cbda=_0xb69db4['grammar'];if(this[_0x31af('0x89')](_0xb69db4[_0x31af('0x7b')])){_0x37cbda+=','+_0xb69db4[_0x31af('0x7b')];}var _0xfc89a7=this['channel'][_0x31af('0x5c')]('MRCPRecog',_0x37cbda);if(_0xfc89a7['result']===-0x1){return _0xfc89a7;}var _0x226ae0=this['getAndSetVariable'](_0x31af('0xb7'),_0x31af('0xce'));if(_0x226ae0[_0x31af('0xaa')]===-0x1){return _0x226ae0;}var _0x583288=this[_0x31af('0xb6')](_0x31af('0xb9'),_0x31af('0xcf'));if(_0x583288[_0x31af('0xaa')]===-0x1){return _0x583288;}var _0x50f27c=this['getAndSetVariable'](_0x31af('0xd0'),_0x31af('0xd1'));if(_0x50f27c[_0x31af('0xaa')]===-0x1){return _0x50f27c;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x37cbda));};AGIVertices[_0x31af('0x13')]['sestekasr']=function(_0xec1a1e){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xd2'),_0xec1a1e[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xec1a1e[_0x31af('0xb3')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xb4'));}var _0x596c49=_0xec1a1e[_0x31af('0xb3')];if(this['isConfigured'](_0xec1a1e['options'])){_0x596c49+=','+_0xec1a1e[_0x31af('0x7b')];}var _0x261f0b=this['channel'][_0x31af('0x5c')](_0x31af('0xb5'),_0x596c49);if(_0x261f0b['result']===-0x1){return _0x261f0b;}var _0xa23096=this[_0x31af('0xb6')](_0x31af('0xb7'),_0x31af('0xd3'));if(_0xa23096[_0x31af('0xaa')]===-0x1){return _0xa23096;}var _0x39422f=this['getAndSetVariable'](_0x31af('0xb9'),_0x31af('0xd4'));if(_0x39422f['result']===-0x1){return _0x39422f;}var _0x2b6a24=this[_0x31af('0xb6')]('RECOG_INSTANCE()',_0x31af('0xd5'));if(_0x2b6a24[_0x31af('0xaa')]===-0x1){return _0x2b6a24;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20MRCPRecog\x20%s',_0x596c49));};AGIVertices['prototype'][_0x31af('0xd6')]=function(_0x5bee36){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5bee36[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x5bee36[_0x31af('0xd7')])){return this['channel'][_0x31af('0x33')](_0x5bee36,_0x31af('0xd8'));}var _0x2203c8=this[_0x31af('0x1d')]['sync'](this,_0x5bee36[_0x31af('0xd7')]);if(!_0x2203c8){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5bee36,_0x31af('0xd9'));}if(!this['isConfigured'](_0x5bee36[_0x31af('0xda')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5bee36,_0x31af('0xdb'));}var _0x59380d=_0x5bee36[_0x31af('0xda')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0xdc'),_0x59380d));var _0x550442=this[_0x31af('0xdd')][_0x31af('0x75')](this,_0x2203c8,_0x59380d);this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x5bee36,_0x59380d);if(!this[_0x31af('0x89')](_0x5bee36[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}var _0x49b136=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x5bee36[_0x31af('0xde')]);if(!_0x49b136){return this['channel']['error'](_0x5bee36,'no\x20variable\x20found');}var _0x422cfa=this;_0x550442[_0x31af('0xe0')](function(_0x2a7f25,_0x29691a){Object[_0x31af('0xe1')](_0x2a7f25)['forEach'](function(_0x2a3213){_0x422cfa[_0x31af('0x10')][_0x31af('0xa6')](util['format'](_0x31af('0xe2'),_0x49b136,_0x29691a,_0x2a3213),_0x2a7f25[_0x2a3213]);});});this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xe3'),_0x49b136),_0x550442[_0x31af('0xa2')]);return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0xe4'),_0x49b136));};AGIVertices[_0x31af('0x13')][_0x31af('0xe5')]=function(_0x2e8ffd){logger[_0x31af('0xe6')](util[_0x31af('0x30')](_0x31af('0xe7'),_0x2e8ffd['label']));if(!this['isConfigured'](_0x2e8ffd['sip_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2e8ffd,_0x31af('0xe8'));}var _0x132096=this[_0x31af('0x20')][_0x31af('0x75')](this,_0x2e8ffd[_0x31af('0xe9')]);if(!_0x132096){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2e8ffd,'no\x20user\x20found');}var _0x39a7f3=this['channel']['exec'](_0x31af('0xea'),[util['format'](_0x31af('0xeb'),_0x132096),_0x2e8ffd[_0x31af('0xbf')],_0x2e8ffd[_0x31af('0xec')],_0x2e8ffd[_0x31af('0x69')]]);if(_0x39a7f3[_0x31af('0xaa')]===-0x1){return _0x39a7f3;}return this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0xed'),_0x31af('0xea')));};AGIVertices['prototype'][_0x31af('0xee')]=function(_0x1d7815){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1d7815['label']));if(!this[_0x31af('0x89')](_0x1d7815['key'])){return this[_0x31af('0x10')]['noop'](_0x31af('0xef'));}if(!this[_0x31af('0x89')](_0x1d7815[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')]['bot']=!![];this[_0x31af('0x3c')](_0x1d7815);this[_0x31af('0x47')](_0x1d7815['text'],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0xf0'),_0x1d7815[_0x31af('0x61')]));var _0x4ca7e7=this[_0x31af('0x7c')]['sync'](this,_0x1d7815);if(_0x4ca7e7){for(var _0x398ac1 in _0x4ca7e7){if(_0x4ca7e7[_0x31af('0x9c')](_0x398ac1)){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xf1'),_0x398ac1[_0x31af('0x6e')]()),_0x4ca7e7[_0x398ac1]);}}this['createSquareMessage'](_0x4ca7e7[_0x31af('0xf2')],_0x31af('0xf3'),_0x31af('0xee'),'');return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Dialogflow\x20Result\x20%s',_0x4ca7e7[_0x31af('0xf2')]));}return this['channel'][_0x31af('0x33')](_0x1d7815,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')][_0x31af('0xf4')]=function(_0x7daa3a){logger['info'](util[_0x31af('0x30')](_0x31af('0xf5'),_0x7daa3a[_0x31af('0x3e')]));if(!this['isConfigured'](_0x7daa3a[_0x31af('0x80')])){return this['channel'][_0x31af('0xae')](_0x31af('0xf6'));}if(!this['isConfigured'](_0x7daa3a[_0x31af('0xf7')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xf8'));}if(!this[_0x31af('0x89')](_0x7daa3a['private_key'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20private_key\x20configured');}if(!this[_0x31af('0x89')](_0x7daa3a[_0x31af('0x82')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xf9'));}if(!this[_0x31af('0x89')](_0x7daa3a['text'])){return this['channel'][_0x31af('0xae')](_0x31af('0xaf'));}this[_0x31af('0x10')][_0x31af('0xfa')]=!![];this['createSquareDetailsReport'](_0x7daa3a);this['createSquareMessage'](_0x7daa3a[_0x31af('0x61')],'in','','');this['channel'][_0x31af('0xae')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x7daa3a[_0x31af('0x61')]));var _0x32f99c=this[_0x31af('0x7f')]['sync'](this,_0x7daa3a);if(_0x32f99c){for(var _0x5b9481 in _0x32f99c){if(_0x32f99c[_0x31af('0x9c')](_0x5b9481)){if(_0x5b9481!==_0x31af('0xfb')){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0xf1'),_0x5b9481['toUpperCase']()),_0x32f99c[_0x5b9481]);}}}this[_0x31af('0x47')](_0x32f99c[_0x31af('0xf2')],_0x31af('0xf3'),'dialogflowV2',_0x32f99c[_0x31af('0xfb')]);return this['channel'][_0x31af('0xae')](util[_0x31af('0x30')]('DialogflowV2\x20Result\x20%s',_0x32f99c['speech']));}return this[_0x31af('0x10')][_0x31af('0x33')](_0x7daa3a,_0x31af('0xfc'));};AGIVertices[_0x31af('0x13')][_0x31af('0xfd')]=function(_0x4152ba){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0xfe'),_0x4152ba[_0x31af('0x3e')]));if(!this['isConfigured'](_0x4152ba[_0x31af('0xff')])){return this['channel'][_0x31af('0xae')](_0x31af('0x100'));}if(!this[_0x31af('0x89')](_0x4152ba[_0x31af('0x101')])){return this['channel'][_0x31af('0xae')](_0x31af('0x102'));}if(!this['isConfigured'](_0x4152ba[_0x31af('0x103')])){return this['channel'][_0x31af('0xae')](_0x31af('0x104'));}if(!this[_0x31af('0x89')](_0x4152ba['ndassistant_url'])){return this['channel'][_0x31af('0xae')](_0x31af('0xaf'));}this['channel'][_0x31af('0xfa')]=!![];this[_0x31af('0x3c')](_0x4152ba);this[_0x31af('0x47')](_0x4152ba[_0x31af('0x61')],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x105'),_0x4152ba[_0x31af('0x61')]));var _0x245f0f=this['sestekNDA'][_0x31af('0x75')](this,_0x4152ba);if(_0x245f0f){for(var _0x54bd26 in _0x245f0f){if(_0x245f0f[_0x31af('0x9c')](_0x54bd26)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x106'),_0x54bd26['toUpperCase']()),_0x245f0f[_0x54bd26]);}}this[_0x31af('0x47')](_0x245f0f['speech'],_0x31af('0xf3'),_0x31af('0xfd'),'');if(_0x245f0f[_0x31af('0x107')]){this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x108'),_0x245f0f[_0x31af('0x107')]));var _0x5361d6=this['channel'][_0x31af('0x109')](_0x245f0f[_0x31af('0x107')]);try{fs[_0x31af('0x10a')](_0x245f0f[_0x31af('0x107')]+_0x31af('0x10b'));}catch(_0xca933f){logger[_0x31af('0x33')](_0xca933f);}return _0x5361d6;}else{return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x10c'),_0x245f0f[_0x31af('0xf2')]));}}return this['channel'][_0x31af('0x33')](_0x4152ba,_0x31af('0x10d'));};AGIVertices[_0x31af('0x13')][_0x31af('0x10e')]=function(_0x3d18e7){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x10f'),_0x3d18e7[_0x31af('0x3e')]));return this['channel'][_0x31af('0xae')](_0x31af('0x10e'));};AGIVertices[_0x31af('0x13')]['ext_dial']=function(_0x24c5d5){logger['info'](util[_0x31af('0x30')](_0x31af('0x110'),_0x24c5d5[_0x31af('0x3e')]));var _0x3c9dad='';if(_0x24c5d5['trunk_id']){if(!this[_0x31af('0x89')](_0x24c5d5['trunk_id'])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x24c5d5,_0x31af('0x111'));}else{var _0x513617=parseInt(_0x24c5d5[_0x31af('0x112')],0xa);if(isNaN(_0x513617)){_0x3c9dad=_0x24c5d5[_0x31af('0x112')];}else{_0x3c9dad=this[_0x31af('0x22')][_0x31af('0x75')](this,_0x24c5d5[_0x31af('0x112')]);if(!_0x3c9dad){return this['channel'][_0x31af('0x33')](_0x24c5d5,_0x31af('0x113'));}}}}else if(_0x24c5d5[_0x31af('0x114')]){_0x3c9dad=_0x24c5d5[_0x31af('0x114')];}else{return this[_0x31af('0x10')][_0x31af('0x33')](_0x24c5d5,_0x31af('0x111'));}var _0x579c71=this[_0x31af('0x10')][_0x31af('0x5c')]('DIAL',[util[_0x31af('0x30')](_0x31af('0x115'),_0x3c9dad,_0x24c5d5[_0x31af('0x4e')]),_0x24c5d5['timeout'],_0x24c5d5['opts'],_0x24c5d5['url']]);if(_0x579c71[_0x31af('0xaa')]===-0x1){return _0x579c71;}return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0xed'),_0x31af('0xea')));};AGIVertices[_0x31af('0x13')]['finally']=function(_0x210d4d){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x210d4d['label']));return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x116'));};AGIVertices[_0x31af('0x13')][_0x31af('0xe')]=function(_0xa48379){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x117'),_0xa48379[_0x31af('0x3e')]));if(_0xa48379[_0x31af('0x118')]===0x0){return this[_0x31af('0xac')](_0xa48379);}_0xa48379[_0x31af('0x118')]-=0x1;if(!this[_0x31af('0x89')](_0xa48379[_0x31af('0x119')])){return this[_0x31af('0x10')]['error'](_0xa48379,_0x31af('0x11a'));}var _0xb478f3=this[_0x31af('0x23')]['sync'](this,_0xa48379[_0x31af('0x119')]);if(!_0xb478f3){return this[_0x31af('0x10')]['error'](_0xa48379,_0x31af('0x11b'));}if(!this['isConfigured'](_0xa48379[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x31af('0xdf'));}var _0x4a149f=this[_0x31af('0x10')][_0x31af('0x11c')](_0xb478f3,_0xa48379['response'],_0xa48379[_0x31af('0x11d')]);var _0x2af1a9=_0x4a149f['result']?_0x4a149f[_0x31af('0xaa')][_0x31af('0x52')]():'';logger[_0x31af('0x35')](_0x31af('0x11e'),JSON['stringify'](_0x4a149f));if(_0x4a149f['result']===-0x1){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,_0x2af1a9);return _0x4a149f;}else if(_0x4a149f[_0x31af('0xa9')]===_0x31af('0xbf')){_0x4a149f[_0x31af('0xaa')]=_0x2af1a9[_0x31af('0xa2')]>=parseInt(_0xa48379[_0x31af('0x11f')])?'x':'i';}else{_0x4a149f[_0x31af('0xaa')]=_0x2af1a9['length']>=parseInt(_0xa48379[_0x31af('0x11f')])&&_0x2af1a9[_0x31af('0xa2')]<=parseInt(_0xa48379[_0x31af('0x11d')])?'x':'i';}var _0x3de225=this['getVariable'][_0x31af('0x75')](this,_0xa48379[_0x31af('0xde')]);if(!_0x3de225){return this[_0x31af('0x10')][_0x31af('0x33')](_0xa48379,_0x31af('0x120'));}this[_0x31af('0x10')][_0x31af('0xa6')](_0x3de225,_0x2af1a9);if(this[_0x31af('0x89')](_0xa48379[_0x31af('0x121')])){var _0x55d1fb=parseInt(_0xa48379[_0x31af('0x121')],0xa);var _0x1fa7e0=rs[_0x31af('0x122')]({'charset':'*','length':_0x55d1fb});var _0x1a09c6=_0x2af1a9[_0x31af('0xa2')];if(_0x1a09c6>0x0){if(_0x1a09c6>_0x55d1fb){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,_0xa48379[_0x31af('0x123')]===_0x31af('0x124')?_0x1fa7e0+_0x2af1a9['substr'](_0x55d1fb):_0x2af1a9[_0x31af('0x125')](0x0,_0x1a09c6-_0x55d1fb)+_0x1fa7e0);}else{this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,rs[_0x31af('0x122')]({'charset':'*','length':_0x1a09c6}));}}else{this[_0x31af('0x3c')][_0x31af('0x75')](this,_0xa48379,'');}}else{this['createSquareDetailsReport'][_0x31af('0x75')](this,_0xa48379,_0x2af1a9);}return _0x4a149f;};AGIVertices[_0x31af('0x13')][_0x31af('0xf')]=function(_0x293f4a){logger['info'](util['format'](_0x31af('0x126'),_0x293f4a[_0x31af('0x3e')]));return this[_0x31af('0xe')](_0x293f4a);};AGIVertices['prototype']['goal']=function(_0x334c75){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x334c75['label']));this[_0x31af('0x3c')]['sync'](this,_0x334c75,_0x334c75[_0x31af('0x127')]);return this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x128'),_0x334c75[_0x31af('0x127')]));};AGIVertices[_0x31af('0x13')][_0x31af('0x129')]=function(_0x2ae295){logger[_0x31af('0x35')](util['format'](_0x31af('0x12a'),_0x2ae295[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x2ae295[_0x31af('0x8c')])||!this[_0x31af('0x89')](_0x2ae295[_0x31af('0x8d')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2ae295[_0x31af('0x61')])){return this['channel'][_0x31af('0xae')]('no\x20text\x20configured');}this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x12b'),_0x2ae295['text']));var _0x4136c0=this[_0x31af('0x8b')][_0x31af('0x75')](this,_0x2ae295);if(_0x4136c0){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x12c'),_0x4136c0));var _0x539ce3=this[_0x31af('0x10')][_0x31af('0x109')](_0x4136c0);try{fs['unlink'](_0x4136c0+_0x31af('0x10b'));}catch(_0x2ea778){logger[_0x31af('0x33')](_0x2ea778);}return _0x539ce3;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x2ae295,_0x31af('0x12d'));};AGIVertices['prototype']['awslex']=function(_0x378c06){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x378c06[_0x31af('0x3e')]));if(!this['isConfigured'](_0x378c06[_0x31af('0x8c')])||!this[_0x31af('0x89')](_0x378c06[_0x31af('0x8d')])){return this['channel']['noop'](_0x31af('0x12e'));}if(!this[_0x31af('0x89')](_0x378c06[_0x31af('0x92')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x12f'));}if(!this[_0x31af('0x89')](_0x378c06[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')][_0x31af('0xfa')]=!![];this[_0x31af('0x3c')](_0x378c06);this[_0x31af('0x47')](_0x378c06[_0x31af('0x61')],'in','','');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x130'),_0x378c06[_0x31af('0x61')]));var _0x5cc479=this[_0x31af('0x91')][_0x31af('0x75')](this,_0x378c06);if(_0x5cc479){for(var _0x25e488 in _0x5cc479){if(_0x5cc479[_0x31af('0x9c')](_0x25e488)&&_['isString'](_0x5cc479[_0x25e488])){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')]('AWS_LEX_%s',_0x25e488[_0x31af('0x6e')]()),_0x5cc479[_0x25e488]);}}if(_[_0x31af('0x4d')](_0x5cc479[_0x31af('0x131')])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x31af('0x47')](_0x5cc479['message'],_0x31af('0xf3'),_0x31af('0x132'),'');return this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x133'),_0x5cc479[_0x31af('0x131')]));}}return this['channel'][_0x31af('0x33')](_0x378c06,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')]['googleasr']=function(_0x5ee9c4){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x134'),_0x5ee9c4[_0x31af('0x3e')],_0x5ee9c4[_0x31af('0xbf')]));if(!this[_0x31af('0x89')](_0x5ee9c4[_0x31af('0x7d')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xef'));}var _0x369724=_0x31af('0x135');var _0x1244e2=util[_0x31af('0x30')](_0x31af('0x136'),FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x52dfb5=util[_0x31af('0x30')]('%s.%s',_0x1244e2,_0x369724);var _0x25fd41=!![];if(_0x5ee9c4[_0x31af('0x137')]==='NOBEEP'){_0x25fd41=![];}var _0x34f52d=this['channel'][_0x31af('0x138')](_0x1244e2,_0x369724,_0x5ee9c4[_0x31af('0x139')],_0x5ee9c4[_0x31af('0xbf')],undefined,_0x25fd41);if(_0x34f52d[_0x31af('0xaa')]!==-0x1){this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('google\x20%s\x20file\x20created',_0x52dfb5));var _0x47a056=this[_0x31af('0x93')][_0x31af('0x75')](this,_0x5ee9c4,_0x52dfb5);if(_0x47a056){for(var _0x1fdb84 in _0x47a056){if(_0x47a056[_0x31af('0x9c')](_0x1fdb84)){this[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x13a'),_0x1fdb84[_0x31af('0x6e')]()),_0x47a056[_0x1fdb84]);}}return this['channel']['noop'](util[_0x31af('0x30')](_0x31af('0x13b'),JSON[_0x31af('0x77')](_0x47a056)));}}return _0x34f52d;};AGIVertices['prototype'][_0x31af('0x13c')]=function(_0xdb4fe7){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x13d'),_0xdb4fe7[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xdb4fe7['appid'])){return this['channel']['noop'](_0x31af('0x13e'));}if(!this[_0x31af('0x89')](_0xdb4fe7[_0x31af('0x97')])){return this['channel'][_0x31af('0xae')](_0x31af('0x13f'));}var _0x3149f4=_0x31af('0x135');var _0x2ad480=util[_0x31af('0x30')]('%s/recordings/%s',FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x4d06f4=util['format']('%s.%s',_0x2ad480,_0x3149f4);var _0x139379=!![];if(_0xdb4fe7[_0x31af('0x137')]==='NOBEEP'){_0x139379=![];}var _0x1331be=this[_0x31af('0x10')][_0x31af('0x138')](_0x2ad480,_0x3149f4,_0xdb4fe7[_0x31af('0x139')],_0xdb4fe7[_0x31af('0xbf')],undefined,_0x139379);if(_0x1331be['result']!==-0x1){this[_0x31af('0x10')][_0x31af('0xae')](util['format']('tilde\x20%s\x20file\x20created',_0x4d06f4));var _0x209ed9=this[_0x31af('0x95')]['sync'](this,_0xdb4fe7,_0x4d06f4);if(_0x209ed9){for(var _0x3301f7 in _0x209ed9){if(_0x209ed9[_0x31af('0x9c')](_0x3301f7)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x140'),_0x3301f7['toUpperCase']()),_0x209ed9[_0x3301f7]);}}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x141'),JSON[_0x31af('0x77')](_0x209ed9)));}}return _0x1331be;};AGIVertices['prototype'][_0x31af('0x142')]=function(_0x4690e6){logger['info'](util[_0x31af('0x30')](_0x31af('0x143'),_0x4690e6[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x144')](_0x4690e6[_0x31af('0x43')],_0x4690e6['extension'],_0x4690e6[_0x31af('0x44')]);};AGIVertices[_0x31af('0x13')]['gotoif']=function(_0x2a7a52){logger['info'](util[_0x31af('0x30')](_0x31af('0x145'),_0x2a7a52[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x2a7a52[_0x31af('0x146')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x2a7a52,_0x31af('0x147'));}try{var _0x38bb3b=eval(_0x2a7a52[_0x31af('0x146')])?_0x31af('0x148'):_0x31af('0x149');this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x14a'),_0x2a7a52['condition'],_0x38bb3b));return{'code':0xc8,'result':_0x38bb3b};}catch(_0x5bf376){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x31af('0x13')][_0x31af('0x14b')]=function(_0x753a4b){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x753a4b[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x753a4b[_0x31af('0x14c')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x753a4b,'no\x20interval\x20configured');}var _0x4a4e13=this[_0x31af('0x29')][_0x31af('0x75')](this,_0x753a4b['interval_id']);if(!_0x4a4e13){return this[_0x31af('0x10')][_0x31af('0x33')](_0x753a4b,_0x31af('0x14d'));}for(var _0x441dd4=0x0;_0x441dd4<_0x4a4e13[_0x31af('0xa2')];_0x441dd4+=0x1){var _0x3c36aa=this[_0x31af('0x10')]['getVariable'](util[_0x31af('0x30')]('IFTIME(%s?true:false)',_0x4a4e13[_0x441dd4]));if(_0x3c36aa['result']===-0x1){return _0x3c36aa;}logger['info'](util[_0x31af('0x30')](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x3c36aa[_0x31af('0xa9')]));if(_0x3c36aa[_0x31af('0xa9')]===_0x31af('0x148')){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x31af('0x148')));this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],_0x31af('0x148')));return{'code':0xc8,'result':_0x31af('0x148')};}else{logger[_0x31af('0x35')](util['format'](_0x31af('0x14e'),_0x4a4e13[_0x441dd4],'false'));this['channel'][_0x31af('0xae')](util[_0x31af('0x30')]('IFTIME\x20%s\x20%s',_0x4a4e13[_0x441dd4],_0x31af('0x149')));}}return{'code':0xc8,'result':_0x31af('0x149')};};AGIVertices[_0x31af('0x13')][_0x31af('0x14f')]=function(_0xde04c6){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x150'),_0xde04c6[_0x31af('0x3e')]));return this['channel'][_0x31af('0x14f')]();};AGIVertices[_0x31af('0x13')][_0x31af('0x151')]=function(_0x101a60){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x152'),_0x101a60[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x101a60['key'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20key\x20configured');}var _0x31a7a1=_0x31af('0x135');var _0x37d651=util[_0x31af('0x30')](_0x31af('0x136'),FILES_PATH,rs[_0x31af('0x122')](0x4));var _0x397951=util[_0x31af('0x30')](_0x31af('0xa4'),_0x37d651,_0x31a7a1);var _0x4914ae=!![];if(_0x101a60[_0x31af('0x137')]===_0x31af('0x153')){_0x4914ae=![];}var _0x31d544=this['channel']['recordFile'](_0x37d651,_0x31a7a1,_0x101a60[_0x31af('0x139')],_0x101a60[_0x31af('0xbf')],undefined,_0x4914ae);if(_0x31d544[_0x31af('0xaa')]!==-0x1){this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x154'),_0x397951));var _0x593a34=this['ispeechASR'][_0x31af('0x75')](this,_0x101a60,_0x397951);if(_0x593a34){for(var _0x2ee23d in _0x593a34){if(_0x593a34['hasOwnProperty'](_0x2ee23d)){this['channel'][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x155'),_0x2ee23d[_0x31af('0x6e')]()),_0x593a34[_0x2ee23d]);}}return this['channel']['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x593a34)));}}return _0x31d544;};AGIVertices['prototype']['ispeechtts']=function(_0x321fde){logger['info'](util[_0x31af('0x30')](_0x31af('0x156'),_0x321fde[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x321fde[_0x31af('0x7d')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x321fde[_0x31af('0x61')])){return this['channel']['noop'](_0x31af('0xaf'));}this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x157'),_0x321fde[_0x31af('0x61')]));var _0xcd5d74=this[_0x31af('0x84')][_0x31af('0x75')](this,_0x321fde);if(_0xcd5d74){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('ispeech\x20%s\x20file\x20created',_0xcd5d74));var _0xc85309=this['channel']['streamFile'](_0xcd5d74,_0x321fde[_0x31af('0x139')]);try{fs['unlink'](_0xcd5d74+'.wav');}catch(_0x1247aa){logger[_0x31af('0x33')](_0x1247aa);}return _0xc85309;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x321fde,_0x31af('0x158'));};AGIVertices[_0x31af('0x13')][_0x31af('0x159')]=function(_0xa40daa){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xa40daa['label']));if(!this['isConfigured'](_0xa40daa[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0xa40daa,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format'](_0x31af('0x15c'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));var _0x27ac1d=this[_0x31af('0x58')][_0x31af('0x75')](this,_0xa40daa['findBy']);if(_0x27ac1d){logger['info'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel']['callerid'],_0xa40daa[_0x31af('0x15a')]));this['channel']['noop'](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));return{'code':0xc8,'result':_0x31af('0x15e')};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x31af('0x10')]['callerid'],_0xa40daa['findBy']));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0xa40daa['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices['prototype'][_0x31af('0x161')]=function(_0x37561d){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x162'),_0x37561d[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x37561d[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0x37561d,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format'](_0x31af('0x15c'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));var _0x41d55b=this['agentLogout'][_0x31af('0x75')](this,_0x37561d[_0x31af('0x15a')]);if(_0x41d55b){logger[_0x31af('0x35')](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x37561d['findBy']));return{'code':0xc8,'result':_0x31af('0x15e')};}else{logger[_0x31af('0x35')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d[_0x31af('0x15a')]));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0x37561d['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices[_0x31af('0x13')][_0x31af('0x163')]=function(_0x5a9dfe){logger[_0x31af('0x35')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5a9dfe[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0x5a9dfe[_0x31af('0x164')])){return this[_0x31af('0x10')]['error'](_0x5a9dfe,_0x31af('0x165'));}this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x166'),_0x5a9dfe[_0x31af('0x164')]));var _0xb7714=eval(_0x5a9dfe[_0x31af('0x164')]);if(!this[_0x31af('0x89')](_0x5a9dfe[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}var _0x1384bd=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x5a9dfe[_0x31af('0xde')]);if(!_0x1384bd){return this[_0x31af('0x10')][_0x31af('0x33')](_0x5a9dfe,_0x31af('0x120'));}if(_[_0x31af('0xa5')](_0xb7714)){var _0x5a7a9d=this;_0xb7714['forEach'](function(_0x2e7b87,_0xbc511b){_0x5a7a9d[_0x31af('0x10')][_0x31af('0xa6')](util[_0x31af('0x30')](_0x31af('0x167'),_0x1384bd,_0xbc511b),_0x2e7b87);});return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x168'),_0x1384bd));}else{return this[_0x31af('0x10')][_0x31af('0xa6')](_0x1384bd,_0xb7714);}};AGIVertices[_0x31af('0x13')][_0x31af('0x169')]=function(_0x3fecbf){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16a'),_0x3fecbf['label']));if(_0x3fecbf[_0x31af('0x118')]===0x0){return this[_0x31af('0xac')](_0x3fecbf);}_0x3fecbf['retry']-=0x1;if(!this[_0x31af('0x89')](_0x3fecbf[_0x31af('0x119')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x3fecbf,_0x31af('0x11a'));}var _0x3d50ef=this[_0x31af('0x23')]['sync'](this,_0x3fecbf['file_id']);if(!_0x3d50ef){return this[_0x31af('0x10')]['error'](_0x3fecbf,_0x31af('0x11b'));}var _0x34c65f=this[_0x31af('0x10')][_0x31af('0x11c')](_0x3d50ef,_0x3fecbf['response'],_0x3fecbf[_0x31af('0x16b')]);var _0x46fd42=_0x34c65f['result'];if(_0x34c65f[_0x31af('0xaa')]===-0x1){this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x3fecbf,'-1');return _0x34c65f;}else if(_0x34c65f['extra']===_0x31af('0xbf')){_0x34c65f[_0x31af('0xaa')]=_0x34c65f['result'][_0x31af('0xa2')]>0x0?_0x34c65f['result']:'t';}else if(_[_0x31af('0x49')](_0x34c65f[_0x31af('0xaa')])){_0x34c65f[_0x31af('0xaa')]='#';_0x46fd42='#';}if(!this[_0x31af('0x89')](_0x3fecbf[_0x31af('0xde')])){this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0xdf'));}else{var _0x4b457e=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x3fecbf[_0x31af('0xde')]);if(!_0x4b457e){return this[_0x31af('0x10')]['error'](_0x3fecbf,_0x31af('0x120'));}this[_0x31af('0x10')]['setVariable'](_0x4b457e,_0x46fd42);}this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x3fecbf,_0x46fd42);return _0x34c65f;};AGIVertices[_0x31af('0x13')][_0x31af('0xae')]=function(_0x256514){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16c'),_0x256514[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0xae')](_0x256514[_0x31af('0x16d')]||_0x256514['label']);};AGIVertices[_0x31af('0x13')][_0x31af('0x16e')]=function(_0x4a69ce){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x16f'),_0x4a69ce[_0x31af('0x3e')]));if(!this['isConfigured'](_0x4a69ce[_0x31af('0x15a')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x4a69ce,_0x31af('0x15b'));}logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15c'),this[_0x31af('0x10')]['callerid'],_0x4a69ce[_0x31af('0x15a')]));var _0x3db92e=this[_0x31af('0x54')][_0x31af('0x75')](this,_0x4a69ce[_0x31af('0x170')]);var _0x2b48d0=this['agentPause'][_0x31af('0x75')](this,_0x4a69ce[_0x31af('0x15a')],_0x3db92e);if(_0x2b48d0){logger[_0x31af('0x35')](util['format'](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this['channel'][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')]['callerid'],_0x4a69ce[_0x31af('0x15a')]));this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x4a69ce[_0x31af('0x15a')]));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices[_0x31af('0x13')]['playback']=function(_0x877523){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x877523[_0x31af('0x3e')]));if(!this['isConfigured'](_0x877523[_0x31af('0x119')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x877523,_0x31af('0x11a'));}var _0xed11e7=this['getSound'][_0x31af('0x75')](this,_0x877523[_0x31af('0x119')]);if(!_0xed11e7){return this[_0x31af('0x10')]['error'](_0x877523,_0x31af('0x11b'));}var _0x4902ed=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0x171'),[_0xed11e7,_0x877523[_0x31af('0xec')]]);if(_0x4902ed[_0x31af('0xaa')]===-0x1){return _0x4902ed;}return this['channel'][_0x31af('0xae')](util['format'](_0x31af('0x172'),'PLAYBACK',_0xed11e7));};AGIVertices[_0x31af('0x13')][_0x31af('0x173')]=function(_0x291870){logger['info'](util[_0x31af('0x30')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x291870['label']));if(!this[_0x31af('0x89')](_0x291870[_0x31af('0x174')])){return this[_0x31af('0x10')][_0x31af('0x33')](_0x291870,_0x31af('0x175'));}var _0x5508d1='';var _0x20a0b0=parseInt(_0x291870[_0x31af('0x174')],0xa);if(isNaN(_0x20a0b0)){_0x5508d1=_0x291870[_0x31af('0x174')];}else{_0x5508d1=this['getVoiceQueue'][_0x31af('0x75')](this,_0x291870[_0x31af('0x174')]);if(!_0x5508d1){return this[_0x31af('0x10')][_0x31af('0x33')](_0x291870,'no\x20queue\x20found');}}var _0x5ba987='';if(this[_0x31af('0x89')](_0x291870[_0x31af('0x119')])){var _0x5e2cdb=this['getSound'][_0x31af('0x75')](this,_0x291870[_0x31af('0x119')]);if(_0x5e2cdb){_0x5ba987=_0x5e2cdb;}}this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x291870,_0x5508d1);if(_0x291870[_0x31af('0xec')][_0x31af('0x176')]('x')<0x0){_0x291870[_0x31af('0xec')]+='x';}if(_0x291870['opts'][_0x31af('0x176')]('X')<0x0){_0x291870[_0x31af('0xec')]+='X';}this[_0x31af('0x10')][_0x31af('0xa6')](_0x31af('0x177'),_0x5508d1?_0x5508d1['toLowerCase']():'');var _0x22cffd=this['channel'][_0x31af('0x5c')](_0x31af('0x178'),[_0x5508d1,_0x291870[_0x31af('0xec')],_0x291870[_0x31af('0x69')],_0x5ba987,_0x291870[_0x31af('0xbf')],_0x291870[_0x31af('0x9')],_0x291870['macro'],_0x291870[_0x31af('0x179')],'',_0x291870[_0x31af('0x17a')]]);if(_0x22cffd[_0x31af('0xaa')]===-0x1){return _0x22cffd;}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('Executed\x20command\x20%s\x20%s',_0x31af('0x178'),_0x5508d1));};AGIVertices[_0x31af('0x13')][_0x31af('0x17b')]=function(_0x3d261e){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x17c'),_0x3d261e[_0x31af('0x3e')]));var _0x5ab585=_0x3d261e['recordingFormat']||'wav';var _0x53ba59=util[_0x31af('0x30')](_0x31af('0x17d'),this[_0x31af('0x10')]['uniqueid'],rs['generate'](0x5));var _0x2a8d6b=util[_0x31af('0x30')](_0x31af('0x17e'),FILES_PATH,_0x53ba59,_0x5ab585);var _0x2842b3=util[_0x31af('0x30')]('%s/recordings/%s',FILES_PATH,_0x53ba59);this[_0x31af('0x41')][_0x31af('0x75')](this,_0x3d261e,_0x53ba59,_0x2a8d6b);this['channel'][_0x31af('0xa6')](_0x31af('0x17f'),_0x53ba59);logger[_0x31af('0x35')](_0x31af('0x180'),_0x2842b3,_0x5ab585,_0x3d261e[_0x31af('0x181')],_0x3d261e['timeout']);return this[_0x31af('0x10')][_0x31af('0x138')](_0x2842b3,_0x5ab585,_0x3d261e[_0x31af('0x181')],_0x3d261e[_0x31af('0xbf')],undefined,!![]);};AGIVertices[_0x31af('0x13')][_0x31af('0x182')]=function(_0x163f46){logger[_0x31af('0x35')](util['format'](_0x31af('0x183'),_0x163f46['label']));if(!this[_0x31af('0x89')](_0x163f46[_0x31af('0x69')])){return this['channel'][_0x31af('0xae')](_0x31af('0x184'));}var _0x112b0a=this[_0x31af('0x185')]['sync'](this,_0x163f46);logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x186'),util[_0x31af('0x187')](_0x112b0a,{'showHidden':![],'depth':null})));if(!this[_0x31af('0x89')](_0x163f46[_0x31af('0xde')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x188'));}var _0x3b39bf=this[_0x31af('0x14')][_0x31af('0x75')](this,_0x163f46[_0x31af('0xde')]);if(!_0x3b39bf){return this[_0x31af('0x10')][_0x31af('0x33')](_0x163f46,_0x31af('0x120'));}this[_0x31af('0x10')]['setVariable'](util[_0x31af('0x30')](_0x31af('0x189'),_0x3b39bf),_0x112b0a[_0x31af('0x78')]?_0x112b0a[_0x31af('0x78')]:_0x31af('0x18a'));this['channel'][_0x31af('0xa6')](util['format']('%s_STATUS_MESSAGE',_0x3b39bf),_0x112b0a['statusMessage']?_0x112b0a['statusMessage']:'OK');if(_0x112b0a[_0x31af('0x6f')]){try{this[_0x31af('0xa3')](_0x112b0a['body'],_0x3b39bf);}catch(_0x134c24){logger[_0x31af('0x33')](util[_0x31af('0x30')](_0x31af('0x18b'),_0x3b39bf));}}return this['channel']['noop'](util[_0x31af('0x30')](_0x31af('0xe4'),_0x3b39bf));};AGIVertices[_0x31af('0x13')]['saydigits']=function(_0x1b6d93){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1b6d93[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x18c')](_0x1b6d93[_0x31af('0x18d')]['replace'](/\s+/g,''),_0x1b6d93[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x18e')]=function(_0x31d152){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x31d152[_0x31af('0x3e')]));return this[_0x31af('0x10')][_0x31af('0x18f')](_0x31d152['number'][_0x31af('0x5e')](/\s+/g,''),_0x31d152[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x190')]=function(_0x49d166){logger['info'](util[_0x31af('0x30')](_0x31af('0x191'),_0x49d166['label']));return this[_0x31af('0x10')][_0x31af('0x192')](_0x49d166[_0x31af('0x61')],_0x49d166[_0x31af('0x181')]);};AGIVertices[_0x31af('0x13')][_0x31af('0x193')]=function(_0xf76463){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x194'),_0xf76463[_0x31af('0x3e')]));if(!this[_0x31af('0x89')](_0xf76463[_0x31af('0x195')])){return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x196'));}var _0x15cf7a=this[_0x31af('0x26')][_0x31af('0x75')](this,_0xf76463['account_id']);if(!_0x15cf7a||!_0x15cf7a[_0x31af('0x197')]){return this[_0x31af('0x10')][_0x31af('0x33')](_0xf76463,_0x31af('0x198'));}var _0x2ffa72={'from':util[_0x31af('0x30')](_0x31af('0x199'),_0x15cf7a['name'],_0x15cf7a[_0x31af('0x19a')]||_0x15cf7a[_0x31af('0x197')][_0x31af('0x19b')]),'to':_0xf76463['to']||'','cc':_0xf76463['cc']||'','bcc':_0xf76463[_0x31af('0x19c')]||'','subject':_0xf76463[_0x31af('0x19d')],'html':_0xf76463[_0x31af('0x61')],'text':_0xf76463[_0x31af('0x61')]};if(this[_0x31af('0x89')](_0xf76463[_0x31af('0x19e')])){}logger[_0x31af('0xe6')](_0x31af('0x19f'),JSON['stringify'](_0x2ffa72));this[_0x31af('0x3c')]['sync'](this,_0xf76463,_0xf76463[_0x31af('0x195')]);this[_0x31af('0x10')][_0x31af('0xae')](util['format'](_0x31af('0x1a0'),_0x15cf7a[_0x31af('0x17')]));this[_0x31af('0x28')][_0x31af('0x75')](this,_0x15cf7a[_0x31af('0x1a1')],_0x2ffa72);return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x1a2'));};AGIVertices[_0x31af('0x13')]['sendFax']=function(_0x4156ba){logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x1a3'),_0x4156ba[_0x31af('0x3e')]));return this[_0x31af('0x10')]['noop'](_0x31af('0x1a4'));};AGIVertices['prototype']['sendSMS']=function(_0x38f1b0){logger['info'](util['format'](_0x31af('0x1a5'),_0x38f1b0[_0x31af('0x3e')]));if(!this['isConfigured'](_0x38f1b0['sms_account_id'])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20sms\x20account\x20configured');}var _0x37ccbb=this[_0x31af('0x1a6')]['sync'](this,_0x38f1b0[_0x31af('0x1a7')]);if(!_0x37ccbb){return this['channel'][_0x31af('0x33')](_0x38f1b0,_0x31af('0x1a8'));}var _0x241971={'body':_0x38f1b0[_0x31af('0x1a9')],'phone':_0x38f1b0['to']||'','SmsAccountId':_0x37ccbb['id']};logger[_0x31af('0xe6')](_0x31af('0x1aa'),JSON['stringify'](_0x241971));this[_0x31af('0x3c')][_0x31af('0x75')](this,_0x38f1b0,_0x38f1b0[_0x31af('0x1a7')]);this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1ab'),_0x37ccbb[_0x31af('0x17')]));this['createSmsMessage'][_0x31af('0x75')](this,_0x241971);return this[_0x31af('0x10')]['noop'](_0x31af('0x1ac'));};AGIVertices[_0x31af('0x13')][_0x31af('0x1ad')]=function(_0x49d9f2){logger[_0x31af('0x35')](util['format'](_0x31af('0x1ae'),_0x49d9f2['label']));if(!this[_0x31af('0x89')](_0x49d9f2[_0x31af('0xde')])){return this[_0x31af('0x10')]['error'](_0x49d9f2,_0x31af('0x1af'));}var _0x3fa16b=this['getVariable'][_0x31af('0x75')](this,_0x49d9f2[_0x31af('0xde')]);if(!_0x3fa16b){return this[_0x31af('0x10')][_0x31af('0x33')](_0x49d9f2,_0x31af('0x120'));}return this[_0x31af('0x10')][_0x31af('0xa6')](_0x3fa16b,_0x49d9f2[_0x31af('0x1b0')]);};AGIVertices[_0x31af('0x13')]['start']=function(_0x40184a){logger[_0x31af('0x35')](util['format'](_0x31af('0x1b1'),_0x40184a[_0x31af('0x3e')]));this['channel'][_0x31af('0xae')]('START\x20CALLY\x20SQUARE');var _0x2b95b0=this['channel'][_0x31af('0x14')]('XMCS-UNIQUEID');if(!_['isEmpty'](_0x2b95b0['extra'])){this[_0x31af('0x10')][_0x31af('0x3d')]=_0x2b95b0[_0x31af('0xa9')];}if(_0x40184a[_0x31af('0xbd')]===_0x31af('0x1b2')){this[_0x31af('0x10')][_0x31af('0xae')]('Answer');return this[_0x31af('0x10')][_0x31af('0xbd')]();}return this[_0x31af('0x10')][_0x31af('0xae')](_0x31af('0x1b3'));};AGIVertices[_0x31af('0x13')]['subproject']=function(_0x427f3a){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x427f3a[_0x31af('0x3e')]));if(!this['isConfigured'](_0x427f3a[_0x31af('0x1b4')])){return this['channel'][_0x31af('0x33')](_0x427f3a,_0x31af('0x1b5'));}var _0x17d8ab=this['getSquareProject'][_0x31af('0x75')](this,_0x427f3a[_0x31af('0x1b4')]);if(!this[_0x31af('0x89')](_0x17d8ab)){return this[_0x31af('0x10')][_0x31af('0x33')](_0x427f3a,util[_0x31af('0x30')](_0x31af('0x1b6'),_0x427f3a[_0x31af('0x1b4')]));}if(_0x17d8ab===this[_0x31af('0x10')][_0x31af('0x3f')]){return this[_0x31af('0x10')][_0x31af('0x33')](_0x427f3a,_0x31af('0x1b7'));}this['createSquareDetailsReport'][_0x31af('0x75')](this,_0x427f3a,_0x17d8ab);var _0x49885a=this[_0x31af('0x10')]['exec'](_0x31af('0x1b8'),util[_0x31af('0x30')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x31af('0x9')][_0x31af('0x1b9')]||_0x31af('0x1ba'),_0x17d8ab,this['channel'][_0x31af('0x3f')]));if(_0x49885a[_0x31af('0xaa')]===-0x1){return _0x49885a;}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x172'),_0x31af('0x1b8'),_0x17d8ab));};AGIVertices['prototype'][_0x31af('0x1bb')]=function(_0xf8a9de){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xf8a9de[_0x31af('0x3e')]));var _0x529d7e=this[_0x31af('0x5b')][_0x31af('0x75')](this,_0xf8a9de[_0x31af('0xbc')]);this['createSquareDetailsReport'][_0x31af('0x75')](this,_0xf8a9de,_0xf8a9de[_0x31af('0xbc')]);if(this[_0x31af('0x89')](_0xf8a9de[_0x31af('0xde')])){var _0x31d449=this[_0x31af('0x14')][_0x31af('0x75')](this,_0xf8a9de[_0x31af('0xde')]);if(_0x31d449){this[_0x31af('0x10')][_0x31af('0xa6')](_0x31d449,_0x529d7e);return this['channel'][_0x31af('0xae')](util['format'](_0x31af('0x1bc'),_0xf8a9de[_0x31af('0xbc')],_0x31d449));}}return this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xf8a9de[_0x31af('0xbc')]));};AGIVertices[_0x31af('0x13')][_0x31af('0x1bd')]=function(_0x3dc988){logger[_0x31af('0x35')](util['format'](_0x31af('0x1be'),_0x3dc988[_0x31af('0x3e')]));_0x3dc988['text']=_0x3dc988[_0x31af('0x61')][_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3dc988[_0x31af('0x60')])){return this[_0x31af('0x10')]['noop'](_0x31af('0x1bf'));}if(!this[_0x31af('0x89')](_0x3dc988[_0x31af('0x61')])){return this[_0x31af('0x10')]['noop'](_0x31af('0xaf'));}this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c0'),_0x3dc988['text']));var _0x549ce0=this[_0x31af('0x5f')][_0x31af('0x75')](this,_0x3dc988);if(_0x549ce0){this[_0x31af('0x10')]['noop'](util[_0x31af('0x30')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x549ce0));var _0x3e9d1c=this[_0x31af('0x10')][_0x31af('0x109')](_0x549ce0);try{fs[_0x31af('0x10a')](_0x549ce0+'.wav');}catch(_0xa26e2b){logger[_0x31af('0x33')](_0xa26e2b);}return _0x3e9d1c;}return this['channel'][_0x31af('0x33')](_0x3dc988,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x31af('0x13')][_0x31af('0x1c1')]=function(_0x18e19b){logger['info'](util[_0x31af('0x30')](_0x31af('0x1c2'),_0x18e19b[_0x31af('0x3e')]));_0x18e19b[_0x31af('0x61')]=_0x18e19b[_0x31af('0x61')][_0x31af('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x31af('0x89')](_0x18e19b[_0x31af('0x61')])){return this[_0x31af('0x10')][_0x31af('0xae')]('no\x20text\x20configured');}this['channel'][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c3'),_0x18e19b[_0x31af('0x61')]));var _0x2e11ba=this['googleTTS'][_0x31af('0x75')](this,_0x18e19b);if(_0x2e11ba){this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x1c4'),_0x2e11ba));var _0x133e7c=this[_0x31af('0x10')][_0x31af('0x109')](_0x2e11ba);try{fs['unlink'](_0x2e11ba+'.wav');}catch(_0x36bf8d){logger[_0x31af('0x33')](_0x36bf8d);}return _0x133e7c;}return this[_0x31af('0x10')][_0x31af('0x33')](_0x18e19b,_0x31af('0x1c5'));};AGIVertices[_0x31af('0x13')][_0x31af('0x1c6')]=function(_0x351aa2){logger[_0x31af('0x35')](util[_0x31af('0x30')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x351aa2['label']));if(!this[_0x31af('0x89')](_0x351aa2[_0x31af('0x15a')])){return this[_0x31af('0x10')]['error'](_0x351aa2,_0x31af('0x15b'));}logger[_0x31af('0x35')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2[_0x31af('0x15a')]));var _0x14bfb9=this[_0x31af('0x1c7')]['sync'](this,_0x351aa2[_0x31af('0x15a')]);if(_0x14bfb9){logger[_0x31af('0x35')](util[_0x31af('0x30')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x31af('0x10')]['callerid'],_0x351aa2['findBy']));this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x15d'),this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x31af('0x35')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')][_0x31af('0x40')],_0x351aa2[_0x31af('0x15a')]));this[_0x31af('0x10')][_0x31af('0xae')](util[_0x31af('0x30')](_0x31af('0x15f'),this[_0x31af('0x10')]['callerid'],_0x351aa2['findBy']));return{'code':0xc8,'result':_0x31af('0x160')};}};AGIVertices['prototype'][_0x31af('0x1c8')]=function(_0x229aab){logger['info'](util['format'](_0x31af('0x1c9'),_0x229aab[_0x31af('0x3e')]));var _0x1f467d=this[_0x31af('0x10')][_0x31af('0x5c')](_0x31af('0x1ca'),[_0x229aab[_0x31af('0x1cb')],_0x229aab[_0x31af('0x7b')]]);if(_0x1f467d[_0x31af('0xaa')]===-0x1){return _0x1f467d;}return this[_0x31af('0x10')]['noop'](util['format'](_0x31af('0x172'),_0x31af('0x1ca'),_0x229aab['mailbox']));};AGIVertices[_0x31af('0x13')][_0x31af('0x1cc')]=function(_0x541be3){logger[_0x31af('0x35')](util['format'](_0x31af('0x1cd'),_0x541be3[_0x31af('0x3e')]));if(!this['isConfigured'](_0x541be3['variable_id'])){return this['channel'][_0x31af('0x33')](_0x541be3,'no\x20variable\x20selected');}var _0x23bf0d=this['getVariable']['sync'](this,_0x541be3[_0x31af('0xde')]);if(!_0x23bf0d){return this['channel'][_0x31af('0x33')](_0x541be3,'no\x20variable\x20found');}var _0x1a6c97=this['channel'][_0x31af('0x14')](_0x23bf0d);return{'code':0xc8,'result':_0x1a6c97[_0x31af('0xa9')]?_0x1a6c97[_0x31af('0xa9')]:'-'};};String['prototype'][_0x31af('0xa8')]=function(_0xf8daa4,_0xd25d4d){return this[_0x31af('0xa7')](_0xf8daa4)['join'](_0xd25d4d);};module[_0x31af('0x1ce')]=AGIVertices; \ No newline at end of file +var _0x2d17=['context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','agentPause','agent','callerid','agentUnpause','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','headers','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_voice','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','EVAL\x20CONDITION\x20%s\x20%s','condition','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','unlink','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','util','lodash','odbc','randomstring','mustache','request-promise','agi','./scripts','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','createSquareRecording','uniqueid'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x2d17,0x17e));var _0x72d1=function(_0x3edf4e,_0x201e89){_0x3edf4e=_0x3edf4e-0x0;var _0xaa1eaa=_0x2d17[_0x3edf4e];return _0xaa1eaa;};'use strict';var fs=require('fs');var util=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var sh=require('shelljs');var odbc=require(_0x72d1('0x2'))();var rs=require(_0x72d1('0x3'));var moment=require('moment');var Mustache=require(_0x72d1('0x4'));var rp=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var scripts=require(_0x72d1('0x7'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x72d1('0x8'),_0x72d1('0x9')];var verticesWithRetry=['menu',_0x72d1('0xa'),_0x72d1('0xb')];var AGIVertices=function(_0x19e248,_0x4e7f3e,_0x215536){this[_0x72d1('0xc')]=_0x19e248;this[_0x72d1('0xd')]=_0x4e7f3e;this['mailRpc']=_0x215536;};AGIVertices[_0x72d1('0xe')][_0x72d1('0xf')]=function(_0x45eb4a,_0x14a41e){this[_0x72d1('0xd')][_0x72d1('0x10')](_0x45eb4a)[_0x72d1('0x11')](function(_0x14ef98){_0x14a41e(null,_0x14ef98?_0x14ef98[_0x72d1('0x12')]:![]);})[_0x72d1('0x13')](function(_0x5ad4df){_0x14a41e(_0x5ad4df);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x14')]=function(_0x4c1038,_0x115cd7){this[_0x72d1('0xd')][_0x72d1('0x15')](_0x4c1038)[_0x72d1('0x11')](function(_0x383bb){_0x115cd7(null,_0x383bb?_0x383bb[_0x72d1('0x12')]:![]);})[_0x72d1('0x13')](function(_0x21c85e){_0x115cd7(_0x21c85e);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x16')]=function(_0x491af4,_0x46fa3d){this['rpc'][_0x72d1('0x17')](_0x491af4)[_0x72d1('0x11')](function(_0x59d7b5){_0x46fa3d(null,_0x59d7b5?_0x59d7b5[_0x72d1('0x12')]:![]);})[_0x72d1('0x13')](function(_0x1ca18d){_0x46fa3d(_0x1ca18d);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x313d7b,_0x10d464){this[_0x72d1('0xd')][_0x72d1('0x18')](_0x313d7b)[_0x72d1('0x11')](function(_0x2253fd){_0x10d464(null,_0x2253fd?_0x2253fd[_0x72d1('0x19')]:![]);})['catch'](function(_0x1c695c){_0x10d464(_0x1c695c);});};AGIVertices['prototype']['getUser']=function(_0x5b85cc,_0x585243){this[_0x72d1('0xd')][_0x72d1('0x1a')](_0x5b85cc)['then'](function(_0x2a421a){_0x585243(null,_0x2a421a?_0x2a421a[_0x72d1('0x12')]:![]);})[_0x72d1('0x13')](function(_0x1431ee){_0x585243(_0x1431ee);});};AGIVertices[_0x72d1('0xe')]['getTrunk']=function(_0x5e0f73,_0x188eca){this[_0x72d1('0xd')][_0x72d1('0x1b')](_0x5e0f73)[_0x72d1('0x11')](function(_0xdf6a69){_0x188eca(null,_0xdf6a69?_0xdf6a69[_0x72d1('0x12')]:![]);})[_0x72d1('0x13')](function(_0x589f7c){_0x188eca(_0x589f7c);});};AGIVertices['prototype'][_0x72d1('0x1c')]=function(_0x482cb8,_0x18ca85){var _0x3454fc=this;this[_0x72d1('0xd')]['getSoundById'](_0x482cb8)[_0x72d1('0x11')](function(_0x4c4c41){_0x18ca85(null,_0x4c4c41?_0x3454fc[_0x72d1('0x1d')](_0x4c4c41[_0x72d1('0x1e')]):![]);})[_0x72d1('0x13')](function(_0x2cc0c8){_0x18ca85(_0x2cc0c8);});};AGIVertices['prototype'][_0x72d1('0x1f')]=function(_0x562e83,_0x42c03c){this[_0x72d1('0xd')]['getMailAccountById'](_0x562e83)[_0x72d1('0x11')](function(_0x358b0c){_0x42c03c(null,_0x358b0c?_0x358b0c:![]);})[_0x72d1('0x13')](function(_0x11ea2f){_0x42c03c(_0x11ea2f);});};AGIVertices[_0x72d1('0xe')]['sendMailMessage']=function(_0x95c44a,_0x60941a,_0x9efc2f){this['mailRpc'][_0x72d1('0x20')](_0x95c44a,_0x60941a)[_0x72d1('0x11')](function(){_0x9efc2f(null);})['catch'](function(_0x3372a5){_0x9efc2f(_0x3372a5);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x21')]=function(_0x5a63d9,_0x348692){this['rpc'][_0x72d1('0x22')](_0x5a63d9)[_0x72d1('0x11')](function(_0x23418d){if(_0x23418d){if(_0x23418d[_0x72d1('0x23')]){_0x348692(null,[_0x23418d[_0x72d1('0x24')]]);}else{_0x348692(null,_[_0x72d1('0x25')](_0x23418d[_0x72d1('0x26')],_0x72d1('0x24')));}}else{_0x348692(null,![]);}})[_0x72d1('0x13')](function(_0x24be04){_0x348692(_0x24be04);});};AGIVertices[_0x72d1('0xe')]['getSoundPath']=function(_0x20a14b){return util[_0x72d1('0x27')](_0x72d1('0x28'),FILES_PATH,_0x20a14b);};AGIVertices[_0x72d1('0xe')]['getQueryOdbc']=function(_0x3eb3da,_0x3ae025,_0x2783bb){odbc['open'](_0x3eb3da,function(_0x3fe9e9){if(_0x3fe9e9){logger[_0x72d1('0x29')](_0x72d1('0x2a'),_0x3fe9e9);_0x2783bb(_0x3fe9e9);}else{logger['info'](_0x72d1('0x2b'));odbc[_0x72d1('0x2c')](_0x3ae025,function(_0x34f159,_0x53e5a1){if(_0x34f159){logger[_0x72d1('0x2d')](_0x72d1('0x2e'),_0x3ae025);_0x2783bb(_0x34f159);}else{logger[_0x72d1('0x2d')](_0x72d1('0x2f'),_0x3ae025);odbc[_0x72d1('0x30')](function(_0x785820){if(_0x785820){logger[_0x72d1('0x29')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x785820);}_0x2783bb(null,_0x53e5a1);});}});}});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x31')]=function(_0x440ac5,_0x16407a){this[_0x72d1('0xd')][_0x72d1('0x32')](_0x440ac5)[_0x72d1('0x11')](function(_0x1d4fdf){_0x16407a(null,_0x1d4fdf?_0x1d4fdf:![]);})['catch'](function(_0x44d5b2){_0x16407a(_0x44d5b2);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x33')]=function(_0x1d6704,_0x45870b){this[_0x72d1('0xd')][_0x72d1('0x33')](_0x1d6704)[_0x72d1('0x11')](function(_0x5620f0){_0x45870b(null,_0x5620f0);})['catch'](function(_0x1359bd){_0x45870b(_0x1359bd);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x34')]=function(_0x21d361,_0x5a6bc4,_0x3fe286){this[_0x72d1('0xd')]['createSquareDetailsReport']({'uniqueid':this[_0x72d1('0xc')]['uniqueid'],'node':_0x21d361[_0x72d1('0x35')],'application':_0x21d361[_0x72d1('0x36')],'data':_0x5a6bc4||null,'project_name':this['channel'][_0x72d1('0x37')],'callerid':this['channel']['callerid']})['then'](function(_0x334bfe){if(_0x3fe286){_0x3fe286(null,_0x334bfe);}})['catch'](function(_0x42ac27){if(_0x3fe286){_0x3fe286(_0x42ac27);}});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x38')]=function(_0x4e5519,_0x4a5c1c,_0x263fcb,_0x58e2c1){this['rpc'][_0x72d1('0x38')]({'uniqueid':this[_0x72d1('0xc')][_0x72d1('0x39')],'callerid':this['channel']['callerid'],'calleridname':this['channel']['calleridname'],'context':this[_0x72d1('0xc')][_0x72d1('0x3a')],'extension':this[_0x72d1('0xc')][_0x72d1('0x3b')],'priority':this[_0x72d1('0xc')][_0x72d1('0x3c')],'accountcode':this[_0x72d1('0xc')][_0x72d1('0x3d')],'dnid':this[_0x72d1('0xc')]['dnid'],'projectName':this[_0x72d1('0xc')][_0x72d1('0x37')],'saveName':_0x4a5c1c,'filename':_0x4e5519[_0x72d1('0x3e')]||_0x4a5c1c,'savePath':_0x263fcb})['then'](function(_0x418e6f){_0x58e2c1(null,_0x418e6f);})[_0x72d1('0x13')](function(_0x12ad75){_0x58e2c1(_0x12ad75);});};AGIVertices['prototype'][_0x72d1('0x3f')]=function(_0x2b60f0,_0x343da3,_0x1bf626,_0x48c20d,_0x5de802){this[_0x72d1('0xd')][_0x72d1('0x3f')]({'uniqueid':this[_0x72d1('0xc')]['uniqueid'],'body':_0x2b60f0,'direction':_0x343da3,'providerName':_0x1bf626,'providerResponse':_0x48c20d})[_0x72d1('0x11')](function(_0xee3c52){if(_0x5de802){_0x5de802(null,_0xee3c52);}})[_0x72d1('0x13')](function(_0x463670){if(_0x5de802){_0x5de802(_0x463670);}});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x40')]=function(_0x3146cf,_0xebe855){this[_0x72d1('0xd')][_0x72d1('0x40')]({'firstName':_[_0x72d1('0x41')](_0x3146cf['name'])||_[_0x72d1('0x42')](_0x3146cf['name'])?'callback_'+Math[_0x72d1('0x43')]():_0x3146cf['name'],'lastName':_[_0x72d1('0x41')](_0x3146cf[_0x72d1('0x44')])||_[_0x72d1('0x42')](_0x3146cf[_0x72d1('0x44')])?null:_0x3146cf[_0x72d1('0x44')],'phone':_0x3146cf[_0x72d1('0x45')],'ListId':_0x3146cf[_0x72d1('0x46')],'scheduledat':_0x3146cf[_0x72d1('0x47')],'callbackUniqueid':this[_0x72d1('0xc')][_0x72d1('0x39')],'tags':_0x72d1('0x48'),'description':'Callback\x20scheduled\x20at\x20'+_0x3146cf[_0x72d1('0x47')][_0x72d1('0x49')](),'priority':_0x3146cf[_0x72d1('0x4a')]})['then'](function(_0x53bd97){_0xebe855(null,_0x53bd97);})[_0x72d1('0x13')](function(_0x140f0b){_0xebe855(_0x140f0b);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x4b')]=function(_0x444583,_0x480b5d){this[_0x72d1('0xd')]['getPauseById'](_0x444583)[_0x72d1('0x11')](function(_0x41c6a6){_0x480b5d(null,_0x41c6a6?_0x41c6a6[_0x72d1('0x12')]:![]);})[_0x72d1('0x13')](function(_0x2ff81f){_0x480b5d(_0x2ff81f);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x4c')]=function(_0x2f07c1,_0x384f0a,_0x3a2dfe){var _0xc3a6b9={'role':_0x72d1('0x4d')};_0xc3a6b9[_0x2f07c1]=this[_0x72d1('0xc')][_0x72d1('0x4e')];this[_0x72d1('0xd')][_0x72d1('0x4c')](_0xc3a6b9,_0x384f0a,this[_0x72d1('0xc')]['uniqueid'])[_0x72d1('0x11')](function(_0x3dceb7){_0x3a2dfe(null,_[_0x72d1('0x42')](_0x3dceb7)?![]:!![]);})[_0x72d1('0x13')](function(_0xb947ef){logger[_0x72d1('0x29')](_0xb947ef);_0x3a2dfe(null,![]);});};AGIVertices['prototype'][_0x72d1('0x4f')]=function(_0x303508,_0xb05cd9){var _0x5319d2={'role':'agent'};_0x5319d2[_0x303508]=this[_0x72d1('0xc')]['callerid'];this[_0x72d1('0xd')][_0x72d1('0x4f')](_0x5319d2)[_0x72d1('0x11')](function(_0x41525c){_0xb05cd9(null,_[_0x72d1('0x42')](_0x41525c)?![]:!![]);})[_0x72d1('0x13')](function(_0x3224c2){logger[_0x72d1('0x29')](_0x3224c2);_0xb05cd9(null,![]);});};AGIVertices[_0x72d1('0xe')]['agentLogout']=function(_0x5d3b27,_0x4042e5){var _0x1d44f0={'role':_0x72d1('0x4d')};_0x1d44f0[_0x5d3b27]=this['channel'][_0x72d1('0x4e')];this[_0x72d1('0xd')]['agentLogout'](_0x1d44f0)[_0x72d1('0x11')](function(_0x5a8442){_0x4042e5(null,_[_0x72d1('0x42')](_0x5a8442)?![]:!![]);})[_0x72d1('0x13')](function(_0x17ac0e){logger[_0x72d1('0x29')](_0x17ac0e);_0x4042e5(null,![]);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x50')]=function(_0x3c4dec,_0x115c72){var _0x2f2750={'role':_0x72d1('0x4d')};_0x2f2750[_0x3c4dec]=this['channel']['callerid'];var _0x15e0e0=_0x3c4dec!=_0x72d1('0x51')?util[_0x72d1('0x27')](_0x72d1('0x52'),_0x72d1('0x53'),this[_0x72d1('0xc')][_0x72d1('0x4e')]):undefined;this[_0x72d1('0xd')]['agentLogin'](_0x2f2750,_0x15e0e0)[_0x72d1('0x11')](function(_0x5a7687){_0x115c72(null,_[_0x72d1('0x42')](_0x5a7687)?![]:!![]);})[_0x72d1('0x13')](function(_0x565257){logger['error'](_0x565257);_0x115c72(null,![]);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x54')]=function(_0x22ca95,_0x44d076){sh[_0x72d1('0x55')](_[_0x72d1('0x56')](_0x22ca95),function(_0x27d3be,_0x574b6e){var _0x2d24f0=_0x574b6e[_0x72d1('0x57')](/(\r\n|\n|\r)/gm,'');_0x44d076(null,_0x2d24f0);});};AGIVertices[_0x72d1('0xe')]['googleCloudTTS']=function(_0x61b30b,_0x4970ac){scripts[_0x72d1('0x58')](_0x61b30b[_0x72d1('0x59')],_0x61b30b['google_cloud_tts_text_type']||_0x72d1('0x5a'),_0x61b30b[_0x72d1('0x5a')],_0x61b30b['languageCode']||_0x72d1('0x5b'),_0x61b30b[_0x72d1('0x5c')]||_0x72d1('0x5d'),_0x61b30b[_0x72d1('0x5e')]||'MP3')['then'](function(_0x532298){_0x4970ac(null,_0x532298);})[_0x72d1('0x13')](function(_0x1753e7){_0x4970ac(_0x1753e7);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x5f')]=function(_0x146b06,_0x3de4a6){scripts['googleTTS'](_0x146b06['text'],_0x146b06[_0x72d1('0x60')]||'en',0x1)[_0x72d1('0x11')](function(_0x36827e){_0x3de4a6(null,_0x36827e);})[_0x72d1('0x13')](function(_0x3ff429){_0x3de4a6(_0x3ff429);});};AGIVertices[_0x72d1('0xe')]['restAPI']=function(_0x23f0e3,_0x4511a4){var _0x18cec8={'uri':_0x23f0e3['url'],'method':_0x23f0e3[_0x72d1('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x23f0e3[_0x72d1('0x62')])===_0x72d1('0x63')&&parseInt(_0x23f0e3[_0x72d1('0x62')])>=0x1?parseInt(_0x23f0e3[_0x72d1('0x62')])*0x3e8:0x5*0x3e8};if(_[_0x72d1('0x64')]([_0x72d1('0x65'),_0x72d1('0x66')],_0x18cec8['method'][_0x72d1('0x67')]())){try{_0x18cec8[_0x72d1('0x68')]=_0x23f0e3[_0x72d1('0x9')]?JSON[_0x72d1('0x69')](_0x23f0e3['rawBody']):{};}catch(_0x4f1b2f){logger[_0x72d1('0x29')](_0x72d1('0x6a'),_0x4f1b2f);}}try{_0x18cec8['headers']=_0x23f0e3[_0x72d1('0x8')]?JSON[_0x72d1('0x69')](_0x23f0e3[_0x72d1('0x8')]):{};}catch(_0x305fd9){logger[_0x72d1('0x29')](_0x72d1('0x6b'),_0x305fd9);}if(_0x23f0e3[_0x72d1('0x6c')]){try{var _0xaacd06=require(_0x23f0e3['computedVariables'])[_0x72d1('0x6d')](this,_0x18cec8);_0x18cec8[_0x72d1('0x6e')]=Mustache[_0x72d1('0x6f')](_0x23f0e3[_0x72d1('0x70')],_0xaacd06,{},['$$','$$']);if(_0x18cec8[_0x72d1('0x71')]){_0x18cec8[_0x72d1('0x71')]=JSON[_0x72d1('0x69')](Mustache[_0x72d1('0x6f')](JSON['stringify'](_0x18cec8[_0x72d1('0x71')]),_0xaacd06,{},['$$','$$']));}if(_0x18cec8[_0x72d1('0x68')]){_0x18cec8[_0x72d1('0x68')]=JSON[_0x72d1('0x69')](Mustache[_0x72d1('0x6f')](JSON[_0x72d1('0x72')](_0x18cec8['body']),_0xaacd06,{},['$$','$$']));}}catch(_0x1c6547){logger[_0x72d1('0x29')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1c6547);}}rp(_0x18cec8)[_0x72d1('0x11')](function(_0x4057ec){var _0x239cdb={'statusCode':_0x4057ec[_0x72d1('0x73')]||0xc8,'statusMessage':_0x4057ec[_0x72d1('0x74')]||'OK','headers':_0x4057ec[_0x72d1('0x71')]||{},'body':_0x4057ec['body']||{}};_0x4511a4(null,_0x239cdb);})[_0x72d1('0x13')](function(_0x4255c0){var _0x5074b9={'statusCode':_0x4255c0['statusCode']||0x1f4,'statusMessage':_0x4255c0[_0x72d1('0x75')]||_0x72d1('0x76'),'headers':_0x4255c0[_0x72d1('0x77')][_0x72d1('0x71')]||{},'body':_0x4255c0['options'][_0x72d1('0x68')]||{}};_0x4511a4(null,_0x5074b9);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x78')]=function(_0x353b96,_0xe967e2){scripts[_0x72d1('0x78')](this[_0x72d1('0xc')][_0x72d1('0x39')],_0x353b96['key'],_0x353b96[_0x72d1('0x5a')],_0x353b96[_0x72d1('0x79')]||'en')[_0x72d1('0x11')](function(_0x1b06f3){_0xe967e2(null,_0x1b06f3);})['catch'](function(_0x39b8f7){_0xe967e2(_0x39b8f7);});};AGIVertices[_0x72d1('0xe')]['googleDialogflowV2']=function(_0xb8b082,_0x5e3bd1){scripts[_0x72d1('0x7a')](this['channel'][_0x72d1('0x39')],_0xb8b082[_0x72d1('0x7b')],_0xb8b082[_0x72d1('0x7c')],_0xb8b082[_0x72d1('0x7d')],_0xb8b082[_0x72d1('0x5a')],_0xb8b082['dialogflowV2_language']||'en')[_0x72d1('0x11')](function(_0x5e810){_0x5e3bd1(null,_0x5e810);})[_0x72d1('0x13')](function(_0x4b3d33){_0x5e3bd1(_0x4b3d33);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x7e')]=function(_0x52dd76,_0x26f1b0){scripts[_0x72d1('0x7e')](this[_0x72d1('0xc')],_0x52dd76)['then'](function(_0x1d0db0){_0x26f1b0(null,_0x1d0db0);})[_0x72d1('0x13')](function(_0x8968c4){_0x26f1b0(_0x8968c4);});};AGIVertices['prototype'][_0x72d1('0x7f')]=function(_0x51c8f9,_0x38a32c){scripts['ispeechTTS'](_0x51c8f9[_0x72d1('0x80')],_0x51c8f9[_0x72d1('0x5a')],_0x51c8f9[_0x72d1('0x81')]||_0x72d1('0x5b'),_0x51c8f9['speed'])[_0x72d1('0x11')](function(_0x13311e){_0x38a32c(null,_0x13311e);})[_0x72d1('0x13')](function(_0x17184a){_0x38a32c(_0x17184a);});};AGIVertices['prototype'][_0x72d1('0x82')]=function(_0x3e28f5,_0x430905,_0x1408df){scripts[_0x72d1('0x82')](_0x430905,_0x3e28f5[_0x72d1('0x80')],_0x3e28f5[_0x72d1('0x83')]||'en-US',this['isConfigured'](_0x3e28f5['model'])?_0x3e28f5[_0x72d1('0x84')]:undefined)['then'](function(_0x2d6f12){_0x1408df(null,_0x2d6f12);})[_0x72d1('0x13')](function(_0x487bb1){_0x1408df(_0x487bb1);});};AGIVertices[_0x72d1('0xe')]['awsPolly']=function(_0x280fc9,_0x378cf0){scripts[_0x72d1('0x85')](_0x280fc9[_0x72d1('0x86')],_0x280fc9['aws_secret_access_key'],_0x280fc9['aws_polly_region'],_0x280fc9[_0x72d1('0x87')]||'Amy',_0x280fc9['text'],_0x280fc9['aws_text_type']||_0x72d1('0x5a'))[_0x72d1('0x11')](function(_0x1fd6b1){_0x378cf0(null,_0x1fd6b1);})[_0x72d1('0x13')](function(_0x2340ff){_0x378cf0(_0x2340ff);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x88')]=function(_0x4e9d08,_0x5e7785){scripts[_0x72d1('0x88')](this[_0x72d1('0xc')]['uniqueid'],_0x4e9d08[_0x72d1('0x86')],_0x4e9d08['aws_secret_access_key'],_0x4e9d08['aws_lex_region'],_0x4e9d08[_0x72d1('0x5a')],_0x4e9d08[_0x72d1('0x89')])[_0x72d1('0x11')](function(_0x42944e){_0x5e7785(null,_0x42944e);})[_0x72d1('0x13')](function(_0x20c5a7){_0x5e7785(_0x20c5a7);});};AGIVertices['prototype'][_0x72d1('0x8a')]=function(_0x17180e,_0x4ceefd,_0x3e1ae0){scripts['googleASR'](_0x4ceefd,_0x17180e[_0x72d1('0x80')],_0x17180e[_0x72d1('0x8b')]||_0x72d1('0x5b'))[_0x72d1('0x11')](function(_0x391df5){_0x3e1ae0(null,_0x391df5);})[_0x72d1('0x13')](function(_0x25a748){_0x3e1ae0(_0x25a748);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x8c')]=function(_0x52249a,_0x27d69e,_0x1c18c2){scripts['tildeASR'](_0x27d69e,_0x52249a['appid'],_0x52249a[_0x72d1('0x8d')],_0x52249a[_0x72d1('0x6e')])[_0x72d1('0x11')](function(_0x1c044d){_0x1c18c2(null,_0x1c044d);})[_0x72d1('0x13')](function(_0x2c9864){_0x1c18c2(_0x2c9864);});};AGIVertices[_0x72d1('0xe')][_0x72d1('0x8e')]=function(_0x33db90){var _0x51a6ca=_[_0x72d1('0x64')](verticesWithRetry,_0x33db90[_0x72d1('0x36')])?_0x33db90:_['clone'](_0x33db90);for(var _0x19258c in _0x51a6ca){if(_0x51a6ca[_0x72d1('0x8f')](_0x19258c)){if(_0x51a6ca[_0x19258c]&&_[_0x72d1('0x90')](_0x51a6ca[_0x19258c])){if(_[_0x72d1('0x64')](recursiveMapAttributes,_0x19258c)){_0x51a6ca[_0x19258c]=this[_0x72d1('0x91')](_0x51a6ca[_0x19258c]);}else{_0x51a6ca[_0x19258c]=this[_0x72d1('0x92')](_0x51a6ca[_0x19258c]);}}}}return _0x51a6ca;};AGIVertices[_0x72d1('0xe')][_0x72d1('0x93')]=function(_0x5289ff){for(var _0x3b83da in _0x5289ff){if(_0x5289ff[_0x72d1('0x8f')](_0x3b83da)){if(_['isPlainObject'](_0x5289ff[_0x3b83da])){this['recursiveNodeIndex'](_0x5289ff[_0x3b83da]);}else if(_[_0x72d1('0x94')](_0x5289ff[_0x3b83da])){for(var _0x113d59=0x0;_0x113d59<_0x5289ff[_0x3b83da]['length'];_0x113d59++){this[_0x72d1('0x93')](_0x5289ff[_0x3b83da][_0x113d59]);}}else if(_['isString'](_0x5289ff[_0x3b83da])){_0x5289ff[_0x3b83da]=this['replaceAllVariables'](_0x5289ff[_0x3b83da]);}}}};AGIVertices[_0x72d1('0xe')][_0x72d1('0x95')]=function(_0x3982ee,_0x23db54){for(var _0xdc9fe3 in _0x3982ee){if(_0x3982ee['hasOwnProperty'](_0xdc9fe3)){if(_['isPlainObject'](_0x3982ee[_0xdc9fe3])){if(!_[_0x72d1('0x41')](_0x3982ee[_0xdc9fe3])){this[_0x72d1('0x95')](_0x3982ee[_0xdc9fe3],util[_0x72d1('0x27')](_0x72d1('0x96'),_0x23db54,_0xdc9fe3));}}else if(_['isArray'](_0x3982ee[_0xdc9fe3])){for(var _0x3b46a9=0x0;_0x3b46a9<_0x3982ee[_0xdc9fe3][_0x72d1('0x97')];_0x3b46a9++){this[_0x72d1('0x95')](_0x3982ee[_0xdc9fe3][_0x3b46a9],util[_0x72d1('0x27')](_0x72d1('0x96'),_0x23db54,_0xdc9fe3+'['+_0x3b46a9+']'));}}else{if(!_[_0x72d1('0x42')](_0x3982ee[_0xdc9fe3])){this['channel'][_0x72d1('0x98')](util[_0x72d1('0x27')](_0x72d1('0x96'),_0x23db54,_0xdc9fe3),_0x3982ee[_0xdc9fe3]);}}}}};AGIVertices['prototype'][_0x72d1('0x91')]=function(_0x3e8b52){try{var _0x412a62=JSON['parse'](_0x3e8b52);this[_0x72d1('0x93')](_0x412a62);return JSON['stringify'](_0x412a62);}catch(_0x352ae2){return this[_0x72d1('0x92')](_0x3e8b52);}};AGIVertices['prototype'][_0x72d1('0x92')]=function(_0x170333){var _0x9d7fac=_0x170333[_0x72d1('0x99')]('{');for(var _0xc2a5a4=0x1;_0xc2a5a4<_0x9d7fac[_0x72d1('0x97')];_0xc2a5a4+=0x1){var _0x49797d=_0x9d7fac[_0xc2a5a4][_0x72d1('0x99')]('}');if(_0x49797d[_0x72d1('0x97')]>0x1){_0x170333=_0x170333[_0x72d1('0x9a')]('{'+_0x49797d[0x0]+'}',this['channel'][_0x72d1('0xf')](_0x49797d[0x0])[_0x72d1('0x9b')]||_0x49797d[0x0]);}}if(_0x9d7fac[_0x72d1('0x97')]===0x1){return _0x170333[_0x72d1('0x49')]();}return this['replaceAllVariables'](_0x170333);};AGIVertices[_0x72d1('0xe')][_0x72d1('0x9c')]=function(_0xf94aa1,_0x317e18){var _0xc8f14b=this[_0x72d1('0xc')]['getVariable'](_0xf94aa1);if(_0xc8f14b[_0x72d1('0x9d')]===-0x1){return _0xc8f14b;}logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x9e'),_0x317e18,_0xc8f14b['extra']));return this['channel'][_0x72d1('0x98')](_0x317e18,_0xc8f14b['extra']);};AGIVertices[_0x72d1('0xe')][_0x72d1('0x9f')]=function(_0x2bd855){return _0x2bd855&&_0x2bd855!=='0'&&_0x2bd855!=='-1'&&_0x2bd855!=='';};AGIVertices[_0x72d1('0xe')][_0x72d1('0xa0')]=function(_0x4dcfef){this[_0x72d1('0x34')][_0x72d1('0x6d')](this,_0x4dcfef,'-');_0x4dcfef[_0x72d1('0xa1')]=_0x4dcfef[_0x72d1('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x72d1('0xe')][_0x72d1('0xa2')]=function(_0x6d9b75){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0xa3'),_0x6d9b75[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x6d9b75[_0x72d1('0x5a')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xa5'));}var _0x585a2a='\x22'+_0x6d9b75['text']+'\x22';if(this['isConfigured'](_0x6d9b75[_0x72d1('0x77')])){_0x585a2a+=','+_0x6d9b75['options'];}var _0x5c4774=this[_0x72d1('0xc')][_0x72d1('0x55')](_0x72d1('0xa6'),_0x585a2a);if(_0x5c4774['result']===-0x1){return _0x5c4774;}return this['channel']['noop'](util[_0x72d1('0x27')](_0x72d1('0xa7'),_0x585a2a));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xa8')]=function(_0x2868d8){logger[_0x72d1('0x2d')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2868d8[_0x72d1('0x35')]));if(!this['isConfigured'](_0x2868d8['grammar'])){return this[_0x72d1('0xc')]['noop'](_0x72d1('0xa9'));}var _0x3dbbe5=_0x2868d8[_0x72d1('0xaa')];if(this[_0x72d1('0x9f')](_0x2868d8['options'])){_0x3dbbe5+=','+_0x2868d8[_0x72d1('0x77')];}var _0x549ec6=this[_0x72d1('0xc')][_0x72d1('0x55')]('MRCPRecog',_0x3dbbe5);if(_0x549ec6[_0x72d1('0x9d')]===-0x1){return _0x549ec6;}var _0x47fc64=this[_0x72d1('0x9c')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x47fc64[_0x72d1('0x9d')]===-0x1){return _0x47fc64;}var _0x3e3065=this[_0x72d1('0x9c')](_0x72d1('0xab'),'MRCP_RECOG_TRANSCRIPT');if(_0x3e3065['result']===-0x1){return _0x3e3065;}var _0x284c67=this[_0x72d1('0x9c')]('RECOG_INSTANCE()',_0x72d1('0xac'));if(_0x284c67['result']===-0x1){return _0x284c67;}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3dbbe5));};AGIVertices['prototype'][_0x72d1('0x6')]=function(_0x1ed28f){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0xad'),_0x1ed28f['label']));return this[_0x72d1('0xc')][_0x72d1('0x6')]([_0x1ed28f[_0x72d1('0xae')],_0x1ed28f[_0x72d1('0xaf')]]);};AGIVertices[_0x72d1('0xe')][_0x72d1('0xb0')]=function(_0x3ded2f){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3ded2f[_0x72d1('0x35')]));if(this['isConfigured'](_0x3ded2f[_0x72d1('0x62')])){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0xb1'),_0x3ded2f[_0x72d1('0x62')]));var _0x15b256=this['channel']['wait'](_0x3ded2f[_0x72d1('0x62')]);if(_0x15b256['result']===-0x1){return _0x15b256;}}return this[_0x72d1('0xc')][_0x72d1('0xb0')]();};AGIVertices[_0x72d1('0xe')]['callback']=function(_0x2c324f){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0xb2'),_0x2c324f[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x2c324f[_0x72d1('0x46')])){return this['channel'][_0x72d1('0x29')](_0x2c324f,_0x72d1('0xb3'));}_0x2c324f[_0x72d1('0x47')]=moment();if(this[_0x72d1('0x9f')](_0x2c324f[_0x72d1('0xb4')])){_0x2c324f[_0x72d1('0x47')]=moment()[_0x72d1('0xb5')](_0x2c324f[_0x72d1('0xb4')],_0x72d1('0xb6'));}if(!this[_0x72d1('0x9f')](_0x2c324f[_0x72d1('0x4a')])){_0x2c324f['callback_priority']=0x2;}this[_0x72d1('0x40')]['sync'](this,_0x2c324f);return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xb7'),_0x2c324f[_0x72d1('0x45')],_0x2c324f[_0x72d1('0x46')],_0x2c324f['scheduledAt']));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xb8')]=function(_0xf50257){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xf50257[_0x72d1('0x35')]));var _0x38abcb=this[_0x72d1('0xc')][_0x72d1('0x55')](_0xf50257[_0x72d1('0xb9')],_0xf50257[_0x72d1('0x77')]);if(_0x38abcb[_0x72d1('0x9d')]===-0x1){return _0x38abcb;}return this['channel']['noop'](util[_0x72d1('0x27')](_0x72d1('0xba'),_0xf50257[_0x72d1('0xb9')],_0xf50257[_0x72d1('0x77')]));};AGIVertices['prototype'][_0x72d1('0xbb')]=function(_0x4296e6){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0xbc'),_0x4296e6[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x4296e6[_0x72d1('0x5a')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xa5'));}var _0x1065d8='\x22'+_0x4296e6['text']+'\x22';if(this[_0x72d1('0x9f')](_0x4296e6['options'])){_0x1065d8+=','+_0x4296e6[_0x72d1('0x77')];}var _0x20ad96=this['channel'][_0x72d1('0x55')](_0x72d1('0xa6'),_0x1065d8);if(_0x20ad96[_0x72d1('0x9d')]===-0x1){return _0x20ad96;}return this[_0x72d1('0xc')]['noop'](util[_0x72d1('0x27')](_0x72d1('0xa7'),_0x1065d8));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xbd')]=function(_0x499fac){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0xbe'),_0x499fac[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x499fac['text'])){return this['channel'][_0x72d1('0xa4')]('no\x20text\x20configured');}var _0x22be3c='\x22'+_0x499fac['text']+'\x22';if(this[_0x72d1('0x9f')](_0x499fac['options'])){_0x22be3c+=','+_0x499fac[_0x72d1('0x77')];}var _0x8d5068=this[_0x72d1('0xc')]['exec'](_0x72d1('0xa6'),_0x22be3c);if(_0x8d5068[_0x72d1('0x9d')]===-0x1){return _0x8d5068;}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0xa7'),_0x22be3c));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xbf')]=function(_0x3121d5){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0xc0'),_0x3121d5[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x3121d5[_0x72d1('0xaa')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xa9'));}var _0x5a1b7c=_0x3121d5['grammar'];if(this[_0x72d1('0x9f')](_0x3121d5['options'])){_0x5a1b7c+=','+_0x3121d5[_0x72d1('0x77')];}var _0x411347=this[_0x72d1('0xc')][_0x72d1('0x55')](_0x72d1('0xc1'),_0x5a1b7c);if(_0x411347[_0x72d1('0x9d')]===-0x1){return _0x411347;}var _0x2e67a5=this[_0x72d1('0x9c')](_0x72d1('0xc2'),_0x72d1('0xc3'));if(_0x2e67a5['result']===-0x1){return _0x2e67a5;}var _0x14068a=this[_0x72d1('0x9c')]('RECOG_INPUT()',_0x72d1('0xc4'));if(_0x14068a['result']===-0x1){return _0x14068a;}var _0x3ab940=this['getAndSetVariable'](_0x72d1('0xc5'),'LUMENVOX_ASR_INSTANCE');if(_0x3ab940['result']===-0x1){return _0x3ab940;}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xc6'),_0x5a1b7c));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xc7')]=function(_0x34b338){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0xc8'),_0x34b338['label']));if(!this['isConfigured'](_0x34b338[_0x72d1('0xaa')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xa9'));}var _0x24c52a=_0x34b338[_0x72d1('0xaa')];if(this[_0x72d1('0x9f')](_0x34b338['options'])){_0x24c52a+=','+_0x34b338[_0x72d1('0x77')];}var _0xf850f0=this[_0x72d1('0xc')][_0x72d1('0x55')]('MRCPRecog',_0x24c52a);if(_0xf850f0[_0x72d1('0x9d')]===-0x1){return _0xf850f0;}var _0x1c9ca8=this[_0x72d1('0x9c')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x1c9ca8[_0x72d1('0x9d')]===-0x1){return _0x1c9ca8;}var _0x1730dc=this[_0x72d1('0x9c')](_0x72d1('0xab'),_0x72d1('0xc9'));if(_0x1730dc[_0x72d1('0x9d')]===-0x1){return _0x1730dc;}var _0x2bca96=this[_0x72d1('0x9c')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x2bca96[_0x72d1('0x9d')]===-0x1){return _0x2bca96;}return this['channel'][_0x72d1('0xa4')](util['format'](_0x72d1('0xc6'),_0x24c52a));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xca')]=function(_0x5de544){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0xcb'),_0x5de544[_0x72d1('0x35')]));if(!this['isConfigured'](_0x5de544[_0x72d1('0xcc')])){return this[_0x72d1('0xc')]['error'](_0x5de544,_0x72d1('0xcd'));}var _0xb226a3=this['getSquareOdbc'][_0x72d1('0x6d')](this,_0x5de544[_0x72d1('0xcc')]);if(!_0xb226a3){return this[_0x72d1('0xc')]['error'](_0x5de544,_0x72d1('0xce'));}if(!this[_0x72d1('0x9f')](_0x5de544['query'])){return this[_0x72d1('0xc')]['error'](_0x5de544,_0x72d1('0xcf'));}var _0x84904=_0x5de544[_0x72d1('0x2c')][_0x72d1('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')]('query:\x20%s',_0x84904));var _0x354832=this['getQueryOdbc'][_0x72d1('0x6d')](this,_0xb226a3,_0x84904);this[_0x72d1('0x34')][_0x72d1('0x6d')](this,_0x5de544,_0x84904);if(!this[_0x72d1('0x9f')](_0x5de544[_0x72d1('0xd0')])){return this[_0x72d1('0xc')]['noop'](_0x72d1('0xd1'));}var _0x2288e2=this[_0x72d1('0xf')][_0x72d1('0x6d')](this,_0x5de544[_0x72d1('0xd0')]);if(!_0x2288e2){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x5de544,_0x72d1('0xd2'));}var _0x59fb89=this;_0x354832[_0x72d1('0xd3')](function(_0x54333f,_0x44b1f9){Object[_0x72d1('0xd4')](_0x54333f)[_0x72d1('0xd3')](function(_0x35fbf4){_0x59fb89[_0x72d1('0xc')][_0x72d1('0x98')](util[_0x72d1('0x27')](_0x72d1('0xd5'),_0x2288e2,_0x44b1f9,_0x35fbf4),_0x54333f[_0x35fbf4]);});});this[_0x72d1('0xc')][_0x72d1('0x98')](util[_0x72d1('0x27')]('%s_ROWS_COUNT',_0x2288e2),_0x354832[_0x72d1('0x97')]);return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xd6'),_0x2288e2));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xd7')]=function(_0x574cd4){logger[_0x72d1('0xd8')](util[_0x72d1('0x27')](_0x72d1('0xd9'),_0x574cd4[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x574cd4['sip_id'])){return this[_0x72d1('0xc')]['error'](_0x574cd4,_0x72d1('0xda'));}var _0x4fe8dc=this['getUser']['sync'](this,_0x574cd4[_0x72d1('0xdb')]);if(!_0x4fe8dc){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x574cd4,'no\x20user\x20found');}var _0x268eea=this[_0x72d1('0xc')]['exec'](_0x72d1('0xdc'),[util['format'](_0x72d1('0xdd'),_0x4fe8dc),_0x574cd4['timeout'],_0x574cd4[_0x72d1('0xde')],_0x574cd4[_0x72d1('0x70')]]);if(_0x268eea[_0x72d1('0x9d')]===-0x1){return _0x268eea;}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0xdf'),'DIAL'));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xe0')]=function(_0xed1ab2){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0xe1'),_0xed1ab2[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0xed1ab2['key'])){return this['channel'][_0x72d1('0xa4')]('no\x20key\x20configured');}if(!this[_0x72d1('0x9f')](_0xed1ab2[_0x72d1('0x5a')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xa5'));}this['channel']['bot']=!![];this[_0x72d1('0x34')](_0xed1ab2);this[_0x72d1('0x3f')](_0xed1ab2[_0x72d1('0x5a')],'in','','');this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')]('Trying\x20Dialogflow:\x20%s',_0xed1ab2[_0x72d1('0x5a')]));var _0x1cd699=this[_0x72d1('0x78')]['sync'](this,_0xed1ab2);if(_0x1cd699){for(var _0x507bb0 in _0x1cd699){if(_0x1cd699[_0x72d1('0x8f')](_0x507bb0)){this[_0x72d1('0xc')][_0x72d1('0x98')](util[_0x72d1('0x27')](_0x72d1('0xe2'),_0x507bb0['toUpperCase']()),_0x1cd699[_0x507bb0]);}}this['createSquareMessage'](_0x1cd699[_0x72d1('0xe3')],_0x72d1('0xe4'),_0x72d1('0xe0'),'');return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xe5'),_0x1cd699[_0x72d1('0xe3')]));}return this['channel'][_0x72d1('0x29')](_0xed1ab2,_0x72d1('0xe6'));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xe7')]=function(_0x1ffd3e){logger['info'](util[_0x72d1('0x27')](_0x72d1('0xe8'),_0x1ffd3e[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x1ffd3e[_0x72d1('0x7b')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xe9'));}if(!this[_0x72d1('0x9f')](_0x1ffd3e[_0x72d1('0x7c')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xea'));}if(!this[_0x72d1('0x9f')](_0x1ffd3e['private_key'])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xeb'));}if(!this['isConfigured'](_0x1ffd3e[_0x72d1('0xec')])){return this['channel'][_0x72d1('0xa4')](_0x72d1('0xed'));}if(!this[_0x72d1('0x9f')](_0x1ffd3e['text'])){return this[_0x72d1('0xc')][_0x72d1('0xa4')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x72d1('0x34')](_0x1ffd3e);this['createSquareMessage'](_0x1ffd3e[_0x72d1('0x5a')],'in','','');this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xee'),_0x1ffd3e[_0x72d1('0x5a')]));var _0x3b263c=this[_0x72d1('0x7a')][_0x72d1('0x6d')](this,_0x1ffd3e);if(_0x3b263c){for(var _0x389055 in _0x3b263c){if(_0x3b263c[_0x72d1('0x8f')](_0x389055)){if(_0x389055!=='providerResponse'){this['channel'][_0x72d1('0x98')](util[_0x72d1('0x27')](_0x72d1('0xe2'),_0x389055[_0x72d1('0x67')]()),_0x3b263c[_0x389055]);}}}this[_0x72d1('0x3f')](_0x3b263c[_0x72d1('0xe3')],_0x72d1('0xe4'),_0x72d1('0xe7'),_0x3b263c[_0x72d1('0xef')]);return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xf0'),_0x3b263c['speech']));}return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x1ffd3e,_0x72d1('0xf1'));};AGIVertices['prototype'][_0x72d1('0xf2')]=function(_0x21e5e1){logger['info'](util[_0x72d1('0x27')](_0x72d1('0xf3'),_0x21e5e1[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x21e5e1[_0x72d1('0xf4')])){return this['channel']['noop'](_0x72d1('0xf5'));}if(!this[_0x72d1('0x9f')](_0x21e5e1[_0x72d1('0xf6')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xf7'));}if(!this['isConfigured'](_0x21e5e1['password'])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xf8'));}if(!this[_0x72d1('0x9f')](_0x21e5e1[_0x72d1('0xf9')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')]('no\x20text\x20configured');}this['channel'][_0x72d1('0xfa')]=!![];this[_0x72d1('0x34')](_0x21e5e1);this['createSquareMessage'](_0x21e5e1[_0x72d1('0x5a')],'in','','');this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xfb'),_0x21e5e1[_0x72d1('0x5a')]));var _0x1c35c5=this['sestekNDA'][_0x72d1('0x6d')](this,_0x21e5e1);if(_0x1c35c5){for(var _0x4c95c8 in _0x1c35c5){if(_0x1c35c5['hasOwnProperty'](_0x4c95c8)){this['channel'][_0x72d1('0x98')](util[_0x72d1('0x27')](_0x72d1('0xfc'),_0x4c95c8[_0x72d1('0x67')]()),_0x1c35c5[_0x4c95c8]);}}this['createSquareMessage'](_0x1c35c5[_0x72d1('0xe3')],_0x72d1('0xe4'),_0x72d1('0xf2'),'');if(_0x1c35c5[_0x72d1('0xfd')]){this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xfe'),_0x1c35c5[_0x72d1('0xfd')]));var _0x55672a=this['channel'][_0x72d1('0xff')](_0x1c35c5['audiofile']);try{fs['unlink'](_0x1c35c5['audiofile']+_0x72d1('0x100'));}catch(_0x2fc085){logger[_0x72d1('0x29')](_0x2fc085);}return _0x55672a;}else{return this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0x101'),_0x1c35c5[_0x72d1('0xe3')]));}}return this['channel'][_0x72d1('0x29')](_0x21e5e1,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x72d1('0xe')][_0x72d1('0x102')]=function(_0x29f83e){logger[_0x72d1('0x2d')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x29f83e[_0x72d1('0x35')]));return this['channel']['noop'](_0x72d1('0x102'));};AGIVertices['prototype']['ext_dial']=function(_0x541615){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x103'),_0x541615[_0x72d1('0x35')]));var _0x2f1001='';if(_0x541615['trunk_id']){if(!this[_0x72d1('0x9f')](_0x541615[_0x72d1('0x104')])){return this['channel'][_0x72d1('0x29')](_0x541615,_0x72d1('0x105'));}else{var _0x55ba85=parseInt(_0x541615[_0x72d1('0x104')],0xa);if(isNaN(_0x55ba85)){_0x2f1001=_0x541615[_0x72d1('0x104')];}else{_0x2f1001=this[_0x72d1('0x106')][_0x72d1('0x6d')](this,_0x541615[_0x72d1('0x104')]);if(!_0x2f1001){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x541615,_0x72d1('0x107'));}}}}else if(_0x541615[_0x72d1('0x108')]){_0x2f1001=_0x541615['trunk_name'];}else{return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x541615,'no\x20trunk\x20selected');}var _0x4da2c4=this[_0x72d1('0xc')]['exec'](_0x72d1('0xdc'),[util[_0x72d1('0x27')](_0x72d1('0x109'),_0x2f1001,_0x541615['phone']),_0x541615[_0x72d1('0x62')],_0x541615[_0x72d1('0xde')],_0x541615['url']]);if(_0x4da2c4[_0x72d1('0x9d')]===-0x1){return _0x4da2c4;}return this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xdf'),_0x72d1('0xdc')));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x10a')]=function(_0x4959a9){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x10b'),_0x4959a9[_0x72d1('0x35')]));return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x10a'));};AGIVertices[_0x72d1('0xe')][_0x72d1('0xa')]=function(_0x1ea17d){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1ea17d[_0x72d1('0x35')]));if(_0x1ea17d[_0x72d1('0xa1')]===0x0){return this['maxRetry'](_0x1ea17d);}_0x1ea17d[_0x72d1('0xa1')]-=0x1;if(!this['isConfigured'](_0x1ea17d[_0x72d1('0x10c')])){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x1ea17d,'no\x20file\x20audio\x20selected');}var _0x3de1a3=this[_0x72d1('0x1c')][_0x72d1('0x6d')](this,_0x1ea17d[_0x72d1('0x10c')]);if(!_0x3de1a3){return this[_0x72d1('0xc')]['error'](_0x1ea17d,_0x72d1('0x10d'));}if(!this[_0x72d1('0x9f')](_0x1ea17d['variable_id'])){return this['channel'][_0x72d1('0x29')](_0x72d1('0xd1'));}var _0x52cb91=this[_0x72d1('0xc')][_0x72d1('0x10e')](_0x3de1a3,_0x1ea17d[_0x72d1('0x10f')],_0x1ea17d[_0x72d1('0x110')]);var _0x40fcfd=_0x52cb91[_0x72d1('0x9d')]?_0x52cb91[_0x72d1('0x9d')]['toString']():'';logger['info'](_0x72d1('0x111'),JSON[_0x72d1('0x72')](_0x52cb91));if(_0x52cb91[_0x72d1('0x9d')]===-0x1){this[_0x72d1('0x34')][_0x72d1('0x6d')](this,_0x1ea17d,_0x40fcfd);return _0x52cb91;}else if(_0x52cb91[_0x72d1('0x9b')]===_0x72d1('0x62')){_0x52cb91[_0x72d1('0x9d')]=_0x40fcfd[_0x72d1('0x97')]>=parseInt(_0x1ea17d[_0x72d1('0x112')])?'x':'i';}else{_0x52cb91[_0x72d1('0x9d')]=_0x40fcfd[_0x72d1('0x97')]>=parseInt(_0x1ea17d['mindigit'])&&_0x40fcfd[_0x72d1('0x97')]<=parseInt(_0x1ea17d[_0x72d1('0x110')])?'x':'i';}var _0x23fb0a=this[_0x72d1('0xf')][_0x72d1('0x6d')](this,_0x1ea17d[_0x72d1('0xd0')]);if(!_0x23fb0a){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x1ea17d,'no\x20variable\x20found');}this['channel'][_0x72d1('0x98')](_0x23fb0a,_0x40fcfd);if(this['isConfigured'](_0x1ea17d[_0x72d1('0x113')])){var _0x4e68ae=parseInt(_0x1ea17d[_0x72d1('0x113')],0xa);var _0x3847e0=rs[_0x72d1('0x114')]({'charset':'*','length':_0x4e68ae});var _0xeb380=_0x40fcfd['length'];if(_0xeb380>0x0){if(_0xeb380>_0x4e68ae){this[_0x72d1('0x34')]['sync'](this,_0x1ea17d,_0x1ea17d['hiddendigitspos']===_0x72d1('0x115')?_0x3847e0+_0x40fcfd[_0x72d1('0x116')](_0x4e68ae):_0x40fcfd['substr'](0x0,_0xeb380-_0x4e68ae)+_0x3847e0);}else{this['createSquareDetailsReport']['sync'](this,_0x1ea17d,rs[_0x72d1('0x114')]({'charset':'*','length':_0xeb380}));}}else{this[_0x72d1('0x34')]['sync'](this,_0x1ea17d,'');}}else{this[_0x72d1('0x34')]['sync'](this,_0x1ea17d,_0x40fcfd);}return _0x52cb91;};AGIVertices[_0x72d1('0xe')][_0x72d1('0xb')]=function(_0x72321a){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x117'),_0x72321a[_0x72d1('0x35')]));return this[_0x72d1('0xa')](_0x72321a);};AGIVertices[_0x72d1('0xe')][_0x72d1('0x118')]=function(_0x32bd8d){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x119'),_0x32bd8d[_0x72d1('0x35')]));this['createSquareDetailsReport'][_0x72d1('0x6d')](this,_0x32bd8d,_0x32bd8d[_0x72d1('0x11a')]);return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x11b'),_0x32bd8d[_0x72d1('0x11a')]));};AGIVertices['prototype']['awspolly']=function(_0x2e9a8a){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x11c'),_0x2e9a8a['label']));if(!this[_0x72d1('0x9f')](_0x2e9a8a[_0x72d1('0x86')])||!this[_0x72d1('0x9f')](_0x2e9a8a[_0x72d1('0x11d')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2e9a8a['text'])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xa5'));}this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x11e'),_0x2e9a8a[_0x72d1('0x5a')]));var _0xf4b74f=this[_0x72d1('0x85')][_0x72d1('0x6d')](this,_0x2e9a8a);if(_0xf4b74f){this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')]('aws\x20Polly\x20%s\x20file\x20created',_0xf4b74f));var _0x47f440=this[_0x72d1('0xc')][_0x72d1('0xff')](_0xf4b74f);try{fs['unlink'](_0xf4b74f+_0x72d1('0x100'));}catch(_0x313d87){logger[_0x72d1('0x29')](_0x313d87);}return _0x47f440;}return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x2e9a8a,_0x72d1('0x11f'));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x120')]=function(_0x18ad49){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x121'),_0x18ad49[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x18ad49[_0x72d1('0x86')])||!this[_0x72d1('0x9f')](_0x18ad49['aws_secret_access_key'])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x122'));}if(!this[_0x72d1('0x9f')](_0x18ad49[_0x72d1('0x89')])){return this[_0x72d1('0xc')]['noop'](_0x72d1('0x123'));}if(!this[_0x72d1('0x9f')](_0x18ad49['text'])){return this['channel'][_0x72d1('0xa4')](_0x72d1('0xa5'));}this[_0x72d1('0xc')][_0x72d1('0xfa')]=!![];this[_0x72d1('0x34')](_0x18ad49);this['createSquareMessage'](_0x18ad49[_0x72d1('0x5a')],'in','','');this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x124'),_0x18ad49['text']));var _0x145efe=this[_0x72d1('0x88')][_0x72d1('0x6d')](this,_0x18ad49);if(_0x145efe){for(var _0x34b950 in _0x145efe){if(_0x145efe[_0x72d1('0x8f')](_0x34b950)&&_[_0x72d1('0x90')](_0x145efe[_0x34b950])){this[_0x72d1('0xc')][_0x72d1('0x98')](util[_0x72d1('0x27')](_0x72d1('0x125'),_0x34b950[_0x72d1('0x67')]()),_0x145efe[_0x34b950]);}}if(_['isNil'](_0x145efe[_0x72d1('0x75')])){return this['channel'][_0x72d1('0xa4')](_0x72d1('0x126'));}else{this['createSquareMessage'](_0x145efe[_0x72d1('0x75')],_0x72d1('0xe4'),_0x72d1('0x127'),'');return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x128'),_0x145efe[_0x72d1('0x75')]));}}return this[_0x72d1('0xc')]['error'](_0x18ad49,_0x72d1('0x129'));};AGIVertices[_0x72d1('0xe')]['googleasr']=function(_0x166521){logger['info'](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x166521[_0x72d1('0x35')],_0x166521['timeout']));if(!this['isConfigured'](_0x166521[_0x72d1('0x80')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')]('no\x20key\x20configured');}var _0x348c70=_0x72d1('0x12a');var _0x315cc4=util[_0x72d1('0x27')](_0x72d1('0x12b'),FILES_PATH,rs[_0x72d1('0x114')](0x4));var _0xd3d2b6=util['format']('%s.%s',_0x315cc4,_0x348c70);var _0x544198=!![];if(_0x166521[_0x72d1('0x12c')]===_0x72d1('0x12d')){_0x544198=![];}var _0x46151f=this[_0x72d1('0xc')]['recordFile'](_0x315cc4,_0x348c70,_0x166521[_0x72d1('0x12e')],_0x166521[_0x72d1('0x62')],undefined,_0x544198);if(_0x46151f['result']!==-0x1){this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0x12f'),_0xd3d2b6));var _0x20919c=this[_0x72d1('0x8a')]['sync'](this,_0x166521,_0xd3d2b6);if(_0x20919c){for(var _0x165c30 in _0x20919c){if(_0x20919c[_0x72d1('0x8f')](_0x165c30)){this[_0x72d1('0xc')][_0x72d1('0x98')](util['format'](_0x72d1('0x130'),_0x165c30[_0x72d1('0x67')]()),_0x20919c[_0x165c30]);}}return this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x20919c)));}}return _0x46151f;};AGIVertices[_0x72d1('0xe')]['tildeasr']=function(_0x2c46e6){logger['info'](util['format'](_0x72d1('0x131'),_0x2c46e6[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x2c46e6['appid'])){return this['channel'][_0x72d1('0xa4')](_0x72d1('0x132'));}if(!this[_0x72d1('0x9f')](_0x2c46e6[_0x72d1('0x8d')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x133'));}var _0x3e1f47=_0x72d1('0x12a');var _0x5299d9=util[_0x72d1('0x27')](_0x72d1('0x12b'),FILES_PATH,rs[_0x72d1('0x114')](0x4));var _0x214bff=util[_0x72d1('0x27')]('%s.%s',_0x5299d9,_0x3e1f47);var _0x4297e6=!![];if(_0x2c46e6['beep']===_0x72d1('0x12d')){_0x4297e6=![];}var _0x32939f=this[_0x72d1('0xc')]['recordFile'](_0x5299d9,_0x3e1f47,_0x2c46e6[_0x72d1('0x12e')],_0x2c46e6['timeout'],undefined,_0x4297e6);if(_0x32939f[_0x72d1('0x9d')]!==-0x1){this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x134'),_0x214bff));var _0x222789=this[_0x72d1('0x8c')][_0x72d1('0x6d')](this,_0x2c46e6,_0x214bff);if(_0x222789){for(var _0x568136 in _0x222789){if(_0x222789[_0x72d1('0x8f')](_0x568136)){this[_0x72d1('0xc')][_0x72d1('0x98')](util['format']('TILDE_ASR_%s',_0x568136[_0x72d1('0x67')]()),_0x222789[_0x568136]);}}return this[_0x72d1('0xc')]['noop'](util['format'](_0x72d1('0x135'),JSON[_0x72d1('0x72')](_0x222789)));}}return _0x32939f;};AGIVertices['prototype']['gotoc']=function(_0x392f98){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x392f98[_0x72d1('0x35')]));return this['channel'][_0x72d1('0x136')](_0x392f98['context'],_0x392f98[_0x72d1('0x3b')],_0x392f98[_0x72d1('0x3c')]);};AGIVertices[_0x72d1('0xe')][_0x72d1('0x137')]=function(_0x28ff50){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x138'),_0x28ff50[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x28ff50['condition'])){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x28ff50,'no\x20condition\x20configured');}try{var _0x370047=eval(_0x28ff50['condition'])?_0x72d1('0x139'):'false';this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x13a'),_0x28ff50[_0x72d1('0x13b')],_0x370047));return{'code':0xc8,'result':_0x370047};}catch(_0x2bace2){return{'code':0xc8,'result':_0x72d1('0x13c')};}};AGIVertices[_0x72d1('0xe')]['gotoiftime']=function(_0x455917){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x13d'),_0x455917[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x455917[_0x72d1('0x13e')])){return this['channel']['error'](_0x455917,'no\x20interval\x20configured');}var _0x251a47=this[_0x72d1('0x21')][_0x72d1('0x6d')](this,_0x455917['interval_id']);if(!_0x251a47){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x455917,'no\x20intervals\x20found');}for(var _0x501a09=0x0;_0x501a09<_0x251a47['length'];_0x501a09+=0x1){var _0x372591=this[_0x72d1('0xc')][_0x72d1('0xf')](util[_0x72d1('0x27')](_0x72d1('0x13f'),_0x251a47[_0x501a09]));if(_0x372591[_0x72d1('0x9d')]===-0x1){return _0x372591;}logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x140'),_0x251a47[_0x501a09],_0x372591[_0x72d1('0x9b')]));if(_0x372591[_0x72d1('0x9b')]==='true'){logger['info'](util['format'](_0x72d1('0x140'),_0x251a47[_0x501a09],_0x72d1('0x139')));this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x140'),_0x251a47[_0x501a09],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x72d1('0x27')](_0x72d1('0x140'),_0x251a47[_0x501a09],_0x72d1('0x13c')));this[_0x72d1('0xc')]['noop'](util[_0x72d1('0x27')](_0x72d1('0x140'),_0x251a47[_0x501a09],_0x72d1('0x13c')));}}return{'code':0xc8,'result':_0x72d1('0x13c')};};AGIVertices[_0x72d1('0xe')][_0x72d1('0x141')]=function(_0x55ec15){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x55ec15[_0x72d1('0x35')]));return this['channel'][_0x72d1('0x141')]();};AGIVertices['prototype']['ispeechasr']=function(_0x5f4af9){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x142'),_0x5f4af9[_0x72d1('0x35')]));if(!this['isConfigured'](_0x5f4af9[_0x72d1('0x80')])){return this['channel']['noop'](_0x72d1('0x143'));}var _0xd6c9a4=_0x72d1('0x12a');var _0x1525ab=util['format'](_0x72d1('0x12b'),FILES_PATH,rs[_0x72d1('0x114')](0x4));var _0xdf16b6=util[_0x72d1('0x27')](_0x72d1('0x96'),_0x1525ab,_0xd6c9a4);var _0x2ea6a7=!![];if(_0x5f4af9[_0x72d1('0x12c')]===_0x72d1('0x12d')){_0x2ea6a7=![];}var _0x1216f3=this[_0x72d1('0xc')]['recordFile'](_0x1525ab,_0xd6c9a4,_0x5f4af9[_0x72d1('0x12e')],_0x5f4af9[_0x72d1('0x62')],undefined,_0x2ea6a7);if(_0x1216f3[_0x72d1('0x9d')]!==-0x1){this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x144'),_0xdf16b6));var _0x1e3801=this[_0x72d1('0x82')][_0x72d1('0x6d')](this,_0x5f4af9,_0xdf16b6);if(_0x1e3801){for(var _0x130ef4 in _0x1e3801){if(_0x1e3801[_0x72d1('0x8f')](_0x130ef4)){this['channel']['setVariable'](util['format'](_0x72d1('0x145'),_0x130ef4['toUpperCase']()),_0x1e3801[_0x130ef4]);}}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0x146'),JSON[_0x72d1('0x72')](_0x1e3801)));}}return _0x1216f3;};AGIVertices[_0x72d1('0xe')][_0x72d1('0x147')]=function(_0x48a53f){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x148'),_0x48a53f['label']));if(!this['isConfigured'](_0x48a53f[_0x72d1('0x80')])){return this[_0x72d1('0xc')]['noop'](_0x72d1('0x143'));}if(!this[_0x72d1('0x9f')](_0x48a53f[_0x72d1('0x5a')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')]('no\x20text\x20configured');}this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x149'),_0x48a53f[_0x72d1('0x5a')]));var _0x1a5df9=this[_0x72d1('0x7f')][_0x72d1('0x6d')](this,_0x48a53f);if(_0x1a5df9){this['channel']['noop'](util[_0x72d1('0x27')](_0x72d1('0x144'),_0x1a5df9));var _0x47f66c=this[_0x72d1('0xc')][_0x72d1('0xff')](_0x1a5df9,_0x48a53f['intKey']);try{fs[_0x72d1('0x14a')](_0x1a5df9+_0x72d1('0x100'));}catch(_0x23d35e){logger[_0x72d1('0x29')](_0x23d35e);}return _0x47f66c;}return this['channel'][_0x72d1('0x29')](_0x48a53f,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x72d1('0xe')]['login']=function(_0x2d0b34){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x14b'),_0x2d0b34[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x2d0b34['findBy'])){return this['channel'][_0x72d1('0x29')](_0x2d0b34,_0x72d1('0x14c'));}logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x14d'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x2d0b34[_0x72d1('0x14e')]));var _0x52aca3=this['agentLogin'][_0x72d1('0x6d')](this,_0x2d0b34[_0x72d1('0x14e')]);if(_0x52aca3){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x2d0b34[_0x72d1('0x14e')]));this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0x14f'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x2d0b34[_0x72d1('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x72d1('0x27')](_0x72d1('0x150'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x2d0b34[_0x72d1('0x14e')]));this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0x150'),this['channel'][_0x72d1('0x4e')],_0x2d0b34[_0x72d1('0x14e')]));return{'code':0xc8,'result':_0x72d1('0x151')};}};AGIVertices[_0x72d1('0xe')][_0x72d1('0x152')]=function(_0xdf071b){logger['info'](util[_0x72d1('0x27')](_0x72d1('0x153'),_0xdf071b[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0xdf071b[_0x72d1('0x14e')])){return this[_0x72d1('0xc')]['error'](_0xdf071b,_0x72d1('0x14c'));}logger['info'](util[_0x72d1('0x27')](_0x72d1('0x14d'),this[_0x72d1('0xc')]['callerid'],_0xdf071b['findBy']));var _0x21d024=this[_0x72d1('0x154')][_0x72d1('0x6d')](this,_0xdf071b[_0x72d1('0x14e')]);if(_0x21d024){logger['info'](util[_0x72d1('0x27')](_0x72d1('0x14f'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0xdf071b[_0x72d1('0x14e')]));this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x14f'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0xdf071b[_0x72d1('0x14e')]));return{'code':0xc8,'result':_0x72d1('0x155')};}else{logger['info'](util[_0x72d1('0x27')](_0x72d1('0x150'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0xdf071b[_0x72d1('0x14e')]));this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x150'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0xdf071b[_0x72d1('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x72d1('0xe')][_0x72d1('0x156')]=function(_0x59ecc8){logger['info'](util[_0x72d1('0x27')](_0x72d1('0x157'),_0x59ecc8[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x59ecc8[_0x72d1('0x158')])){return this['channel'][_0x72d1('0x29')](_0x59ecc8,_0x72d1('0x159'));}this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0x15a'),_0x59ecc8[_0x72d1('0x158')]));var _0x57ec5c=eval(_0x59ecc8[_0x72d1('0x158')]);if(!this[_0x72d1('0x9f')](_0x59ecc8[_0x72d1('0xd0')])){return this[_0x72d1('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xc81d38=this[_0x72d1('0xf')]['sync'](this,_0x59ecc8[_0x72d1('0xd0')]);if(!_0xc81d38){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x59ecc8,'no\x20variable\x20found');}if(_[_0x72d1('0x94')](_0x57ec5c)){var _0xabd2d4=this;_0x57ec5c['forEach'](function(_0x5159b5,_0x2185e0){_0xabd2d4[_0x72d1('0xc')][_0x72d1('0x98')](util[_0x72d1('0x27')](_0x72d1('0x15b'),_0xc81d38,_0x2185e0),_0x5159b5);});return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x15c'),_0xc81d38));}else{return this[_0x72d1('0xc')][_0x72d1('0x98')](_0xc81d38,_0x57ec5c);}};AGIVertices['prototype'][_0x72d1('0x15d')]=function(_0x20be11){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x15e'),_0x20be11['label']));if(_0x20be11[_0x72d1('0xa1')]===0x0){return this[_0x72d1('0xa0')](_0x20be11);}_0x20be11[_0x72d1('0xa1')]-=0x1;if(!this[_0x72d1('0x9f')](_0x20be11[_0x72d1('0x10c')])){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x20be11,_0x72d1('0x15f'));}var _0xf723c6=this['getSound'][_0x72d1('0x6d')](this,_0x20be11['file_id']);if(!_0xf723c6){return this['channel'][_0x72d1('0x29')](_0x20be11,'no\x20file\x20audio\x20found');}var _0x5bfa24=this[_0x72d1('0xc')]['getData'](_0xf723c6,_0x20be11[_0x72d1('0x10f')],_0x20be11[_0x72d1('0x160')]);var _0x3e9110=_0x5bfa24['result'];if(_0x5bfa24[_0x72d1('0x9d')]===-0x1){this[_0x72d1('0x34')][_0x72d1('0x6d')](this,_0x20be11,'-1');return _0x5bfa24;}else if(_0x5bfa24['extra']===_0x72d1('0x62')){_0x5bfa24[_0x72d1('0x9d')]=_0x5bfa24[_0x72d1('0x9d')][_0x72d1('0x97')]>0x0?_0x5bfa24['result']:'t';}else if(_[_0x72d1('0x41')](_0x5bfa24[_0x72d1('0x9d')])){_0x5bfa24['result']='#';_0x3e9110='#';}if(!this['isConfigured'](_0x20be11[_0x72d1('0xd0')])){this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0xd1'));}else{var _0x5131a0=this[_0x72d1('0xf')][_0x72d1('0x6d')](this,_0x20be11[_0x72d1('0xd0')]);if(!_0x5131a0){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x20be11,_0x72d1('0xd2'));}this[_0x72d1('0xc')]['setVariable'](_0x5131a0,_0x3e9110);}this[_0x72d1('0x34')]['sync'](this,_0x20be11,_0x3e9110);return _0x5bfa24;};AGIVertices[_0x72d1('0xe')][_0x72d1('0xa4')]=function(_0x1e943a){logger['info'](util[_0x72d1('0x27')](_0x72d1('0x161'),_0x1e943a[_0x72d1('0x35')]));return this[_0x72d1('0xc')]['noop'](_0x1e943a[_0x72d1('0x162')]||_0x1e943a['label']);};AGIVertices[_0x72d1('0xe')][_0x72d1('0x163')]=function(_0x131f5f){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x164'),_0x131f5f[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x131f5f[_0x72d1('0x14e')])){return this['channel'][_0x72d1('0x29')](_0x131f5f,_0x72d1('0x14c'));}logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x14d'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x131f5f['findBy']));var _0x44fdd6=this[_0x72d1('0x4b')][_0x72d1('0x6d')](this,_0x131f5f['pause_id']);var _0x175b78=this[_0x72d1('0x4c')]['sync'](this,_0x131f5f[_0x72d1('0x14e')],_0x44fdd6);if(_0x175b78){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x14f'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x131f5f['findBy']));this[_0x72d1('0xc')]['noop'](util['format'](_0x72d1('0x14f'),this['channel'][_0x72d1('0x4e')],_0x131f5f['findBy']));return{'code':0xc8,'result':_0x72d1('0x155')};}else{logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x150'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x131f5f['findBy']));this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x72d1('0x4e')],_0x131f5f[_0x72d1('0x14e')]));return{'code':0xc8,'result':_0x72d1('0x151')};}};AGIVertices[_0x72d1('0xe')]['playback']=function(_0x30bd79){logger['info'](util[_0x72d1('0x27')](_0x72d1('0x165'),_0x30bd79[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x30bd79[_0x72d1('0x10c')])){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x30bd79,_0x72d1('0x15f'));}var _0x57d32c=this[_0x72d1('0x1c')][_0x72d1('0x6d')](this,_0x30bd79[_0x72d1('0x10c')]);if(!_0x57d32c){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x30bd79,'no\x20file\x20audio\x20found');}var _0x5cb193=this[_0x72d1('0xc')][_0x72d1('0x55')](_0x72d1('0x166'),[_0x57d32c,_0x30bd79['opts']]);if(_0x5cb193['result']===-0x1){return _0x5cb193;}return this[_0x72d1('0xc')]['noop'](util['format'](_0x72d1('0xba'),'PLAYBACK',_0x57d32c));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x167')]=function(_0x45a8f0){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x45a8f0[_0x72d1('0x35')]));if(!this['isConfigured'](_0x45a8f0[_0x72d1('0x168')])){return this[_0x72d1('0xc')]['error'](_0x45a8f0,_0x72d1('0x169'));}var _0x47aca5='';var _0x316e60=parseInt(_0x45a8f0[_0x72d1('0x168')],0xa);if(isNaN(_0x316e60)){_0x47aca5=_0x45a8f0[_0x72d1('0x168')];}else{_0x47aca5=this[_0x72d1('0x14')][_0x72d1('0x6d')](this,_0x45a8f0['queue_id']);if(!_0x47aca5){return this['channel'][_0x72d1('0x29')](_0x45a8f0,'no\x20queue\x20found');}}var _0x56b0ce='';if(this[_0x72d1('0x9f')](_0x45a8f0[_0x72d1('0x10c')])){var _0x21ed96=this[_0x72d1('0x1c')][_0x72d1('0x6d')](this,_0x45a8f0['file_id']);if(_0x21ed96){_0x56b0ce=_0x21ed96;}}this[_0x72d1('0x34')][_0x72d1('0x6d')](this,_0x45a8f0,_0x47aca5);if(_0x45a8f0[_0x72d1('0xde')][_0x72d1('0x16a')]('x')<0x0){_0x45a8f0[_0x72d1('0xde')]+='x';}if(_0x45a8f0[_0x72d1('0xde')][_0x72d1('0x16a')]('X')<0x0){_0x45a8f0['opts']+='X';}this[_0x72d1('0xc')][_0x72d1('0x98')](_0x72d1('0x16b'),_0x47aca5?_0x47aca5[_0x72d1('0x16c')]():'');var _0x2c22af=this['channel'][_0x72d1('0x55')](_0x72d1('0x16d'),[_0x47aca5,_0x45a8f0[_0x72d1('0xde')],_0x45a8f0[_0x72d1('0x70')],_0x56b0ce,_0x45a8f0[_0x72d1('0x62')],_0x45a8f0[_0x72d1('0x6')],_0x45a8f0[_0x72d1('0x16e')],_0x45a8f0[_0x72d1('0x16f')],'',_0x45a8f0['position']]);if(_0x2c22af[_0x72d1('0x9d')]===-0x1){return _0x2c22af;}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0xba'),_0x72d1('0x16d'),_0x47aca5));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x170')]=function(_0x57871e){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x171'),_0x57871e[_0x72d1('0x35')]));var _0x46f076=_0x57871e[_0x72d1('0x172')]||_0x72d1('0x12a');var _0x1624d8=util[_0x72d1('0x27')]('%s_%s',this[_0x72d1('0xc')]['uniqueid'],rs[_0x72d1('0x114')](0x5));var _0x3718b7=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x1624d8,_0x46f076);var _0x4af5ba=util[_0x72d1('0x27')](_0x72d1('0x12b'),FILES_PATH,_0x1624d8);this[_0x72d1('0x38')][_0x72d1('0x6d')](this,_0x57871e,_0x1624d8,_0x3718b7);this[_0x72d1('0xc')][_0x72d1('0x98')](_0x72d1('0x173'),_0x1624d8);logger[_0x72d1('0x2d')](_0x72d1('0x174'),_0x4af5ba,_0x46f076,_0x57871e['escape_digits'],_0x57871e[_0x72d1('0x62')]);return this['channel']['recordFile'](_0x4af5ba,_0x46f076,_0x57871e[_0x72d1('0x175')],_0x57871e[_0x72d1('0x62')],undefined,!![]);};AGIVertices[_0x72d1('0xe')][_0x72d1('0x176')]=function(_0x565968){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x177'),_0x565968[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x565968[_0x72d1('0x70')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x178'));}var _0x56c665=this['restAPI']['sync'](this,_0x565968);logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Response:',util['inspect'](_0x56c665,{'showHidden':![],'depth':null})));if(!this[_0x72d1('0x9f')](_0x565968[_0x72d1('0xd0')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x332f28=this['getVariable'][_0x72d1('0x6d')](this,_0x565968[_0x72d1('0xd0')]);if(!_0x332f28){return this[_0x72d1('0xc')]['error'](_0x565968,'no\x20variable\x20found');}this['channel']['setVariable'](util['format']('%s_STATUS_CODE',_0x332f28),_0x56c665[_0x72d1('0x73')]?_0x56c665['statusCode']:_0x72d1('0x179'));this['channel']['setVariable'](util[_0x72d1('0x27')](_0x72d1('0x17a'),_0x332f28),_0x56c665[_0x72d1('0x74')]?_0x56c665[_0x72d1('0x74')]:'OK');if(_0x56c665[_0x72d1('0x68')]){try{this['saveRestApiResult'](_0x56c665['body'],_0x332f28);}catch(_0x39a678){logger[_0x72d1('0x29')](util['format'](_0x72d1('0x17b'),_0x332f28));}}return this[_0x72d1('0xc')]['noop'](util[_0x72d1('0x27')](_0x72d1('0xd6'),_0x332f28));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x17c')]=function(_0xddcc94){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x17d'),_0xddcc94[_0x72d1('0x35')]));return this[_0x72d1('0xc')]['sayDigits'](_0xddcc94['digits'][_0x72d1('0x57')](/\s+/g,''),_0xddcc94[_0x72d1('0x175')]);};AGIVertices[_0x72d1('0xe')][_0x72d1('0x17e')]=function(_0x1aea73){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x17f'),_0x1aea73[_0x72d1('0x35')]));return this[_0x72d1('0xc')][_0x72d1('0x180')](_0x1aea73['number'][_0x72d1('0x57')](/\s+/g,''),_0x1aea73[_0x72d1('0x175')]);};AGIVertices['prototype'][_0x72d1('0x181')]=function(_0x439765){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x182'),_0x439765[_0x72d1('0x35')]));return this['channel'][_0x72d1('0x183')](_0x439765['text'],_0x439765[_0x72d1('0x175')]);};AGIVertices[_0x72d1('0xe')][_0x72d1('0x184')]=function(_0x162d21){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x185'),_0x162d21[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x162d21['account_id'])){return this['channel'][_0x72d1('0xa4')](_0x72d1('0x186'));}var _0x28dac6=this[_0x72d1('0x1f')][_0x72d1('0x6d')](this,_0x162d21['account_id']);if(!_0x28dac6||!_0x28dac6[_0x72d1('0x187')]){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x162d21,_0x72d1('0x188'));}var _0x522afd={'from':util[_0x72d1('0x27')]('\x22%s\x22\x20<%s>',_0x28dac6[_0x72d1('0x12')],_0x28dac6[_0x72d1('0x189')]||_0x28dac6[_0x72d1('0x187')]['user']),'to':_0x162d21['to']||'','cc':_0x162d21['cc']||'','bcc':_0x162d21[_0x72d1('0x18a')]||'','subject':_0x162d21[_0x72d1('0x18b')],'html':_0x162d21[_0x72d1('0x5a')],'text':_0x162d21[_0x72d1('0x5a')]};if(this[_0x72d1('0x9f')](_0x162d21[_0x72d1('0x18c')])){}logger['debug'](_0x72d1('0x18d'),JSON['stringify'](_0x522afd));this[_0x72d1('0x34')][_0x72d1('0x6d')](this,_0x162d21,_0x162d21[_0x72d1('0x18e')]);this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x18f'),_0x28dac6[_0x72d1('0x12')]));this[_0x72d1('0x20')][_0x72d1('0x6d')](this,_0x28dac6['smtpOptions'],_0x522afd);return this[_0x72d1('0xc')][_0x72d1('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['sendFax']=function(_0x4bc01a){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x190'),_0x4bc01a[_0x72d1('0x35')]));return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x191'));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x192')]=function(_0x5a8f0c){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x193'),_0x5a8f0c[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x5a8f0c['sms_account_id'])){return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x194'));}var _0x274e41=this[_0x72d1('0x31')][_0x72d1('0x6d')](this,_0x5a8f0c[_0x72d1('0x195')]);if(!_0x274e41){return this[_0x72d1('0xc')]['error'](_0x5a8f0c,_0x72d1('0x196'));}var _0x341b56={'body':_0x5a8f0c[_0x72d1('0x197')],'phone':_0x5a8f0c['to']||'','SmsAccountId':_0x274e41['id']};logger['debug']('sendSMS\x20message',JSON[_0x72d1('0x72')](_0x341b56));this['createSquareDetailsReport'][_0x72d1('0x6d')](this,_0x5a8f0c,_0x5a8f0c[_0x72d1('0x195')]);this['channel'][_0x72d1('0xa4')](util[_0x72d1('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x274e41['name']));this[_0x72d1('0x33')][_0x72d1('0x6d')](this,_0x341b56);return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x198'));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x199')]=function(_0x41f2b6){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x19a'),_0x41f2b6[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x41f2b6[_0x72d1('0xd0')])){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x41f2b6,'no\x20variable\x20selected');}var _0x1fcd06=this[_0x72d1('0xf')][_0x72d1('0x6d')](this,_0x41f2b6['variable_id']);if(!_0x1fcd06){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x41f2b6,_0x72d1('0xd2'));}return this['channel'][_0x72d1('0x98')](_0x1fcd06,_0x41f2b6[_0x72d1('0x19b')]);};AGIVertices[_0x72d1('0xe')]['start']=function(_0x474ed8){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20START\x20(%s)\x20block',_0x474ed8[_0x72d1('0x35')]));this[_0x72d1('0xc')][_0x72d1('0xa4')]('START\x20CALLY\x20SQUARE');var _0x5627cf=this['channel'][_0x72d1('0xf')]('XMCS-UNIQUEID');if(!_[_0x72d1('0x41')](_0x5627cf[_0x72d1('0x9b')])){this[_0x72d1('0xc')][_0x72d1('0x39')]=_0x5627cf[_0x72d1('0x9b')];}if(_0x474ed8[_0x72d1('0xb0')]===_0x72d1('0x19c')){this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x19d'));return this[_0x72d1('0xc')][_0x72d1('0xb0')]();}return this[_0x72d1('0xc')][_0x72d1('0xa4')](_0x72d1('0x19e'));};AGIVertices['prototype'][_0x72d1('0x19f')]=function(_0x4634ba){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x1a0'),_0x4634ba['label']));if(!this[_0x72d1('0x9f')](_0x4634ba[_0x72d1('0x1a1')])){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x4634ba,_0x72d1('0x1a2'));}var _0x5606ab=this[_0x72d1('0x16')][_0x72d1('0x6d')](this,_0x4634ba[_0x72d1('0x1a1')]);if(!this[_0x72d1('0x9f')](_0x5606ab)){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x4634ba,util[_0x72d1('0x27')](_0x72d1('0x1a3'),_0x4634ba['project_id']));}if(_0x5606ab===this[_0x72d1('0xc')][_0x72d1('0x37')]){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x4634ba,_0x72d1('0x1a4'));}this[_0x72d1('0x34')][_0x72d1('0x6d')](this,_0x4634ba,_0x5606ab);var _0x4c8049=this[_0x72d1('0xc')]['exec'](_0x72d1('0x1a5'),util[_0x72d1('0x27')](_0x72d1('0x1a6'),config[_0x72d1('0x6')][_0x72d1('0x1a7')]||'127.0.0.1',_0x5606ab,this[_0x72d1('0xc')][_0x72d1('0x37')]));if(_0x4c8049[_0x72d1('0x9d')]===-0x1){return _0x4c8049;}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0xba'),_0x72d1('0x1a5'),_0x5606ab));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x1a8')]=function(_0xf49b2d){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xf49b2d[_0x72d1('0x35')]));var _0x4a9501=this['shellCommand'][_0x72d1('0x6d')](this,_0xf49b2d[_0x72d1('0xae')]);this[_0x72d1('0x34')][_0x72d1('0x6d')](this,_0xf49b2d,_0xf49b2d['command']);if(this[_0x72d1('0x9f')](_0xf49b2d[_0x72d1('0xd0')])){var _0x5799fe=this[_0x72d1('0xf')][_0x72d1('0x6d')](this,_0xf49b2d[_0x72d1('0xd0')]);if(_0x5799fe){this[_0x72d1('0xc')][_0x72d1('0x98')](_0x5799fe,_0x4a9501);return this['channel']['noop'](util[_0x72d1('0x27')](_0x72d1('0x1a9'),_0xf49b2d[_0x72d1('0xae')],_0x5799fe));}}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x1aa'),_0xf49b2d[_0x72d1('0xae')]));};AGIVertices[_0x72d1('0xe')]['google_cloud_tts']=function(_0x59b7a7){logger[_0x72d1('0x2d')](util['format'](_0x72d1('0x1ab'),_0x59b7a7[_0x72d1('0x35')]));_0x59b7a7[_0x72d1('0x5a')]=_0x59b7a7[_0x72d1('0x5a')][_0x72d1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x59b7a7[_0x72d1('0x59')])){return this['channel'][_0x72d1('0xa4')]('no\x20apiKey\x20configured');}if(!this[_0x72d1('0x9f')](_0x59b7a7[_0x72d1('0x5a')])){return this[_0x72d1('0xc')][_0x72d1('0xa4')]('no\x20text\x20configured');}this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x59b7a7[_0x72d1('0x5a')]));var _0x298b35=this[_0x72d1('0x58')][_0x72d1('0x6d')](this,_0x59b7a7);if(_0x298b35){this[_0x72d1('0xc')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x298b35));var _0x56e9fe=this['channel'][_0x72d1('0xff')](_0x298b35);try{fs[_0x72d1('0x14a')](_0x298b35+_0x72d1('0x100'));}catch(_0x266ace){logger[_0x72d1('0x29')](_0x266ace);}return _0x56e9fe;}return this[_0x72d1('0xc')]['error'](_0x59b7a7,_0x72d1('0x1ac'));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x1ad')]=function(_0x54cb7e){logger['info'](util[_0x72d1('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x54cb7e[_0x72d1('0x35')]));_0x54cb7e[_0x72d1('0x5a')]=_0x54cb7e[_0x72d1('0x5a')][_0x72d1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x54cb7e[_0x72d1('0x5a')])){return this[_0x72d1('0xc')]['noop'](_0x72d1('0xa5'));}this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x1ae'),_0x54cb7e['text']));var _0x484310=this[_0x72d1('0x5f')][_0x72d1('0x6d')](this,_0x54cb7e);if(_0x484310){this[_0x72d1('0xc')]['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x484310));var _0x126b9c=this[_0x72d1('0xc')][_0x72d1('0xff')](_0x484310);try{fs[_0x72d1('0x14a')](_0x484310+'.wav');}catch(_0x49e0a4){logger['error'](_0x49e0a4);}return _0x126b9c;}return this[_0x72d1('0xc')]['error'](_0x54cb7e,_0x72d1('0x1af'));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x1b0')]=function(_0x1dc7dc){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1dc7dc[_0x72d1('0x35')]));if(!this[_0x72d1('0x9f')](_0x1dc7dc[_0x72d1('0x14e')])){return this[_0x72d1('0xc')][_0x72d1('0x29')](_0x1dc7dc,'no\x20find\x20by\x20configured');}logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x14d'),this[_0x72d1('0xc')]['callerid'],_0x1dc7dc[_0x72d1('0x14e')]));var _0x491cca=this[_0x72d1('0x4f')][_0x72d1('0x6d')](this,_0x1dc7dc[_0x72d1('0x14e')]);if(_0x491cca){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x14f'),this['channel']['callerid'],_0x1dc7dc[_0x72d1('0x14e')]));this[_0x72d1('0xc')][_0x72d1('0xa4')](util['format'](_0x72d1('0x14f'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x1dc7dc[_0x72d1('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x72d1('0x2d')](util[_0x72d1('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x72d1('0xc')]['callerid'],_0x1dc7dc['findBy']));this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')](_0x72d1('0x150'),this[_0x72d1('0xc')][_0x72d1('0x4e')],_0x1dc7dc[_0x72d1('0x14e')]));return{'code':0xc8,'result':_0x72d1('0x151')};}};AGIVertices[_0x72d1('0xe')][_0x72d1('0x1b1')]=function(_0x4168e7){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x1b2'),_0x4168e7[_0x72d1('0x35')]));var _0x39a1da=this[_0x72d1('0xc')][_0x72d1('0x55')](_0x72d1('0x1b3'),[_0x4168e7['mailbox'],_0x4168e7[_0x72d1('0x77')]]);if(_0x39a1da['result']===-0x1){return _0x39a1da;}return this[_0x72d1('0xc')][_0x72d1('0xa4')](util[_0x72d1('0x27')]('Executed\x20command\x20%s\x20%s',_0x72d1('0x1b3'),_0x4168e7['mailbox']));};AGIVertices[_0x72d1('0xe')][_0x72d1('0x1b4')]=function(_0x2c1043){logger[_0x72d1('0x2d')](util[_0x72d1('0x27')](_0x72d1('0x1b5'),_0x2c1043['label']));if(!this[_0x72d1('0x9f')](_0x2c1043[_0x72d1('0xd0')])){return this['channel']['error'](_0x2c1043,_0x72d1('0x1b6'));}var _0x32949a=this['getVariable']['sync'](this,_0x2c1043[_0x72d1('0xd0')]);if(!_0x32949a){return this['channel']['error'](_0x2c1043,'no\x20variable\x20found');}var _0x189d7a=this['channel'][_0x72d1('0xf')](_0x32949a);return{'code':0xc8,'result':_0x189d7a[_0x72d1('0x9b')]?_0x189d7a[_0x72d1('0x9b')]:'-'};};String[_0x72d1('0xe')][_0x72d1('0x9a')]=function(_0x53b582,_0x440161){return this[_0x72d1('0x99')](_0x53b582)[_0x72d1('0x1b7')](_0x440161);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 058dc6c..3d6f7ef 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 _0x9fd4=['[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','error','finally','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','resolve','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]'];(function(_0x210b93,_0x133e6d){var _0x2b020f=function(_0x3f9601){while(--_0x3f9601){_0x210b93['push'](_0x210b93['shift']());}};_0x2b020f(++_0x133e6d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x4cb55d,_0x1c6444){_0x4cb55d=_0x4cb55d-0x0;var _0x18b1ed=_0x9fd4[_0x4cb55d];return _0x18b1ed;};'use strict';var _=require(_0x49fd('0x0'));var moment=require(_0x49fd('0x1'));var ami=require(_0x49fd('0x2'));var logger=require(_0x49fd('0x3'))(_0x49fd('0x4'));var RpcUser=require(_0x49fd('0x5'));var RpcVoiceAgentReport=require(_0x49fd('0x6'));function Acw(_0x13ec80){this[_0x49fd('0x7')]=_0x13ec80['voiceQueues'];this['agents']=_0x13ec80[_0x49fd('0x8')];this[_0x49fd('0x9')]=_0x13ec80[_0x49fd('0x9')];this[_0x49fd('0xa')]={};ami['on']('agentconnect',this[_0x49fd('0xb')][_0x49fd('0xc')](this));ami['on'](_0x49fd('0xd'),this[_0x49fd('0xe')][_0x49fd('0xc')](this));ami['on']('hangup',this[_0x49fd('0xf')][_0x49fd('0xc')](this));ami['on'](_0x49fd('0x10'),this[_0x49fd('0x11')][_0x49fd('0xc')](this));ami['on'](_0x49fd('0x12'),this[_0x49fd('0x13')]['bind'](this));ami['on'](_0x49fd('0x14'),this[_0x49fd('0x15')][_0x49fd('0xc')](this));ami['on'](_0x49fd('0x16'),this[_0x49fd('0x17')][_0x49fd('0xc')](this));}function getDiff(_0x26f2c1){var _0x3fa518=moment()[_0x49fd('0x18')](0x0);var _0x652890=moment(_0x26f2c1)[_0x49fd('0x18')](0x0);return _0x3fa518[_0x49fd('0x19')](_0x652890,_0x49fd('0x1a'));}Acw[_0x49fd('0x1b')][_0x49fd('0x1c')]=function(_0x201109,_0x2859f2){var _0x3ca675=this;var _0x2f8d68=getDiff(_0x3ca675[_0x49fd('0x9')][_0x201109][_0x49fd('0x1d')]);clearTimeout(_0x3ca675[_0x49fd('0x9')][_0x201109][_0x49fd('0x1e')]);_0x3ca675[_0x49fd('0x9')][_0x201109][_0x49fd('0x1e')]=![];return RpcVoiceAgentReport[_0x49fd('0x1f')]({'acwtime':_0x2f8d68},_0x3ca675['timers'][_0x201109][_0x49fd('0x20')],_0x201109)[_0x49fd('0x21')](function(_0x59a407){logger['info'](_0x49fd('0x22'),_0x2859f2,_0x2f8d68,_0x59a407);})['catch'](function(_0x316e7c){logger[_0x49fd('0x23')]('[%s][UPDATE][ERRORS:%s]',_0x2859f2,_0x316e7c);})[_0x49fd('0x24')](function(){delete _0x3ca675[_0x49fd('0x9')][_0x201109];});};Acw['prototype'][_0x49fd('0x25')]=function(_0x1165db){try{var _0x2e1c40=this;var _0x290f59=this[_0x49fd('0xa')][_0x1165db][_0x49fd('0x26')];var _0x5dc839=this[_0x49fd('0xa')][_0x1165db][_0x49fd('0x27')];var _0x8f202b=this['voiceQueues'][_0x5dc839];var _0x3fa0c=![];var _0x10de13=_0x49fd('0x28');if(_0x8f202b['mandatoryDisposition']&&_0x8f202b['mandatoryDispositionPause']['name']){_0x3fa0c=!![];_0x10de13=_0x8f202b[_0x49fd('0x29')][_0x49fd('0x2a')];}if(!_0x2e1c40[_0x49fd('0x8')][_0x290f59]){return Promise[_0x49fd('0x2b')]();}return RpcUser[_0x49fd('0x2c')](_0x2e1c40[_0x49fd('0x8')][_0x290f59]['id'])[_0x49fd('0x21')](function(_0x9afc1c){if(!_0x9afc1c||_0x9afc1c['voicePause']){logger[_0x49fd('0x2d')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1165db,_0x290f59,_0x5dc839);return;}logger[_0x49fd('0x2d')](_0x49fd('0x2e'),_0x1165db,_0x290f59,_0x5dc839);var _0x54acb5=_0x2e1c40[_0x49fd('0xa')][_0x1165db][_0x49fd('0x2f')]&&_0x2e1c40[_0x49fd('0xa')][_0x1165db][_0x49fd('0x30')]?_0x2e1c40[_0x49fd('0xa')][_0x1165db][_0x49fd('0x30')]:_0x1165db;return RpcUser[_0x49fd('0x31')](_0x2e1c40[_0x49fd('0x8')][_0x290f59],_0x10de13,_0x54acb5);})['then'](function(_0x42181b){if(_0x3fa0c||!_0x42181b){return;}_0x2e1c40['timers'][_0x290f59]={};logger[_0x49fd('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1165db,_0x2e1c40[_0x49fd('0x7')][_0x5dc839][_0x49fd('0x32')],_0x290f59,_0x5dc839);_0x2e1c40[_0x49fd('0x9')][_0x290f59]['timer']=setTimeout(_0x2e1c40['stopAcw']['bind'](_0x2e1c40,_0x290f59),_0x2e1c40[_0x49fd('0x7')][_0x5dc839][_0x49fd('0x32')]*0x3e8);_0x2e1c40['timers'][_0x290f59][_0x49fd('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2e1c40[_0x49fd('0x9')][_0x290f59][_0x49fd('0x20')]=_0x1165db;_0x2e1c40[_0x49fd('0x9')][_0x290f59][_0x49fd('0x27')]=_0x5dc839;_0x2e1c40[_0x49fd('0x9')][_0x290f59]['updateAcw']=_0x2e1c40['updateAcw'][_0x49fd('0xc')](_0x2e1c40,_0x290f59,_0x1165db);})[_0x49fd('0x33')](function(){logger[_0x49fd('0x23')](_0x49fd('0x34'),_0x1165db,_0x2e1c40['voiceQueues'][_0x5dc839][_0x49fd('0x32')],_0x290f59,_0x5dc839);})[_0x49fd('0x24')](function(){delete _0x2e1c40[_0x49fd('0xa')][_0x1165db];});}catch(_0x3f2898){logger[_0x49fd('0x23')](_0x49fd('0x35'),_0x3f2898[_0x49fd('0x36')]);}};Acw[_0x49fd('0x1b')][_0x49fd('0x37')]=function(_0x89f196){try{var _0x3762c7=this;if(_0x3762c7['timers'][_0x89f196]){_0x3762c7[_0x49fd('0x9')][_0x89f196][_0x49fd('0x1e')]=![];var _0x8dc5b3=_0x3762c7[_0x49fd('0x9')][_0x89f196][_0x49fd('0x20')];var _0x44c7d5=_0x3762c7[_0x49fd('0x9')][_0x89f196][_0x49fd('0x27')];var _0xbd136c=_0x3762c7['voiceQueues'][_0x44c7d5][_0x49fd('0x32')];logger['info'](_0x49fd('0x38'),_0x8dc5b3,_0x89f196);RpcUser[_0x49fd('0x39')](this['agents'][_0x89f196]);RpcVoiceAgentReport[_0x49fd('0x1f')]({'acwtime':_0xbd136c,'agentacw':!![]},_0x8dc5b3,_0x89f196)[_0x49fd('0x21')](function(_0x4cf200){logger[_0x49fd('0x2d')]('[%s][UPDATE][ACWTIME:%s]',_0x8dc5b3,_0xbd136c,_0x4cf200);})['catch'](function(_0x5f56f8){logger[_0x49fd('0x23')](_0x49fd('0x3a'),_0x8dc5b3,_0x5f56f8);});}else{logger[_0x49fd('0x23')](_0x49fd('0x3b'),_0x89f196);if(_0x3762c7['timers']){logger[_0x49fd('0x2d')](_0x49fd('0x3c'),JSON[_0x49fd('0x3d')](_0x3762c7[_0x49fd('0x9')]));}}}catch(_0x115c5a){logger[_0x49fd('0x23')](_0x49fd('0x3e'),_0x115c5a[_0x49fd('0x36')]);}};Acw['prototype'][_0x49fd('0xb')]=function(_0x2c8ab1){try{if(this['voiceQueues'][_0x2c8ab1[_0x49fd('0x27')]]&&(this[_0x49fd('0x7')][_0x2c8ab1['queue']][_0x49fd('0x4')]||this['voiceQueues'][_0x2c8ab1[_0x49fd('0x27')]][_0x49fd('0x3f')])){if(this[_0x49fd('0x8')][_0x2c8ab1[_0x49fd('0x26')]]){this['channels'][_0x2c8ab1['uniqueid']]={'queue':_0x2c8ab1[_0x49fd('0x27')],'interface':_0x2c8ab1['interface'],'destlinkedid':_0x2c8ab1[_0x49fd('0x30')]};}}}catch(_0x1ede50){logger[_0x49fd('0x23')](_0x49fd('0x40'),_0x1ede50['message']);}};Acw[_0x49fd('0x1b')][_0x49fd('0x17')]=function(_0xb2168c){try{if(this[_0x49fd('0x7')][_0xb2168c[_0x49fd('0x27')]]&&(this[_0x49fd('0x7')][_0xb2168c[_0x49fd('0x27')]][_0x49fd('0x4')]||this[_0x49fd('0x7')][_0xb2168c[_0x49fd('0x27')]][_0x49fd('0x3f')])){if(this[_0x49fd('0x8')][_0xb2168c[_0x49fd('0x26')]]){this[_0x49fd('0xa')][_0xb2168c['uniqueid']]={'queue':_0xb2168c['queue'],'interface':_0xb2168c[_0x49fd('0x26')]};}}}catch(_0xa3518f){logger[_0x49fd('0x23')](_0x49fd('0x41'),_0xa3518f['message']);}};Acw[_0x49fd('0x1b')][_0x49fd('0xe')]=function(_0x4b28fa){try{if(this[_0x49fd('0xa')][_0x4b28fa[_0x49fd('0x20')]]&&_[_0x49fd('0x42')](this[_0x49fd('0xa')][_0x4b28fa[_0x49fd('0x20')]][_0x49fd('0x2f')])){logger[_0x49fd('0x2d')](_0x49fd('0x43'),_0x4b28fa[_0x49fd('0x20')]);this[_0x49fd('0x25')](_0x4b28fa[_0x49fd('0x20')]);}else if(this['channels'][_0x4b28fa[_0x49fd('0x44')]]&&_[_0x49fd('0x42')](this[_0x49fd('0xa')][_0x4b28fa[_0x49fd('0x44')]][_0x49fd('0x2f')])){logger[_0x49fd('0x2d')]('[%s][HANGUP:LINKEDID]',_0x4b28fa['linkedid']);this[_0x49fd('0x25')](_0x4b28fa[_0x49fd('0x44')]);}}catch(_0x3f11d4){logger['error'](_0x49fd('0x45'),_0x3f11d4[_0x49fd('0x36')]);}};Acw['prototype']['syncHangup']=function(_0x5c3268){try{if(this[_0x49fd('0xa')][_0x5c3268['uniqueid']]&&this['channels'][_0x5c3268['uniqueid']][_0x49fd('0x2f')]){logger[_0x49fd('0x2d')](_0x49fd('0x46'),_0x5c3268[_0x49fd('0x20')]);this[_0x49fd('0x25')](_0x5c3268[_0x49fd('0x20')]);}else if(this[_0x49fd('0xa')][_0x5c3268[_0x49fd('0x44')]]&&this[_0x49fd('0xa')][_0x5c3268[_0x49fd('0x44')]]['attended']){logger[_0x49fd('0x2d')](_0x49fd('0x47'),_0x5c3268[_0x49fd('0x44')]);this[_0x49fd('0x25')](_0x5c3268[_0x49fd('0x44')]);}}catch(_0x24bfde){logger['error'](_0x49fd('0x48'),_0x24bfde[_0x49fd('0x36')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x1d2833){try{if(!_['isNil'](this[_0x49fd('0xa')][_0x1d2833['transfereeuniqueid']])){this[_0x49fd('0x25')](_0x1d2833['transfereeuniqueid']);if(this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x49')]]){this['channels'][_0x1d2833[_0x49fd('0x49')]][_0x49fd('0x2f')]=!![];this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x4a')]]=this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x49')]];delete this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x49')]];}}else if(!_['isNil'](this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x4a')]])){this[_0x49fd('0x25')](_0x1d2833['transfertargetuniqueid']);if(this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x4b')]]){this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x4b')]][_0x49fd('0x2f')]=!![];this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x4c')]]=this[_0x49fd('0xa')][_0x1d2833[_0x49fd('0x4b')]];delete this['channels'][_0x1d2833[_0x49fd('0x4b')]];}}}catch(_0xb7eb45){logger['error'](_0x49fd('0x4d'),_0xb7eb45[_0x49fd('0x36')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x5b5041){try{if(this[_0x49fd('0xa')][_0x5b5041[_0x49fd('0x4e')]]){logger[_0x49fd('0x2d')](_0x49fd('0x4f'),JSON[_0x49fd('0x3d')](_0x5b5041['transfereruniqueid']));this[_0x49fd('0x25')](_0x5b5041['transfereruniqueid']);}else if(this[_0x49fd('0xa')][_0x5b5041['transfererlinkedid']]){logger[_0x49fd('0x2d')](_0x49fd('0x50'),JSON[_0x49fd('0x3d')](_0x5b5041[_0x49fd('0x51')]));this['startAcw'](_0x5b5041[_0x49fd('0x51')]);}}catch(_0x4feef4){logger['error'](_0x49fd('0x52'),_0x4feef4[_0x49fd('0x36')]);}};Acw[_0x49fd('0x1b')]['syncAgentRingNoAnswer']=function(_0x264fe9){try{if(this[_0x49fd('0x7')][_0x264fe9[_0x49fd('0x27')]]&&this[_0x49fd('0x7')][_0x264fe9[_0x49fd('0x27')]][_0x49fd('0x53')]==='all'){if(this['agents'][_0x264fe9[_0x49fd('0x26')]]){logger[_0x49fd('0x2d')](_0x49fd('0x54'),_0x264fe9[_0x49fd('0x20')],_0x264fe9[_0x49fd('0x26')],_0x264fe9[_0x49fd('0x27')]);return RpcUser[_0x49fd('0x31')](this[_0x49fd('0x8')][_0x264fe9[_0x49fd('0x26')]],_0x49fd('0x55'),_0x264fe9[_0x49fd('0x20')]);}}}catch(_0x14c112){logger[_0x49fd('0x23')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x14c112[_0x49fd('0x36')]);}};module[_0x49fd('0x56')]=Acw; \ No newline at end of file +var _0x7096=['syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','updateAcw','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','error','[ACW][START]\x20%s','message','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','acw'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7096,0x10c));var _0x6709=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7096[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var moment=require(_0x6709('0x0'));var ami=require('../ami');var logger=require(_0x6709('0x1'))('acw');var RpcUser=require(_0x6709('0x2'));var RpcVoiceAgentReport=require(_0x6709('0x3'));function Acw(_0x3e85e4){this[_0x6709('0x4')]=_0x3e85e4[_0x6709('0x4')];this[_0x6709('0x5')]=_0x3e85e4[_0x6709('0x5')];this[_0x6709('0x6')]=_0x3e85e4[_0x6709('0x6')];this[_0x6709('0x7')]={};ami['on'](_0x6709('0x8'),this[_0x6709('0x9')][_0x6709('0xa')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x6709('0xa')](this));ami['on'](_0x6709('0xb'),this[_0x6709('0xc')][_0x6709('0xa')](this));ami['on'](_0x6709('0xd'),this[_0x6709('0xe')]['bind'](this));ami['on']('attendedtransfer',this[_0x6709('0xf')][_0x6709('0xa')](this));ami['on'](_0x6709('0x10'),this[_0x6709('0x11')][_0x6709('0xa')](this));ami['on'](_0x6709('0x12'),this[_0x6709('0x13')][_0x6709('0xa')](this));}function getDiff(_0x5a8ebb){var _0x78ce3=moment()[_0x6709('0x14')](0x0);var _0x4d5255=moment(_0x5a8ebb)[_0x6709('0x14')](0x0);return _0x78ce3['diff'](_0x4d5255,_0x6709('0x15'));}Acw['prototype'][_0x6709('0x16')]=function(_0x4bc059,_0x149233){var _0x28866a=this;var _0x95c0c2=getDiff(_0x28866a[_0x6709('0x6')][_0x4bc059]['lastPauseAt']);clearTimeout(_0x28866a['timers'][_0x4bc059]['timer']);_0x28866a[_0x6709('0x6')][_0x4bc059][_0x6709('0x17')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x95c0c2},_0x28866a[_0x6709('0x6')][_0x4bc059][_0x6709('0x18')],_0x4bc059)[_0x6709('0x19')](function(_0x5a3263){logger[_0x6709('0x1a')](_0x6709('0x1b'),_0x149233,_0x95c0c2,_0x5a3263);})[_0x6709('0x1c')](function(_0x27a27b){logger['error'](_0x6709('0x1d'),_0x149233,_0x27a27b);})[_0x6709('0x1e')](function(){delete _0x28866a[_0x6709('0x6')][_0x4bc059];});};Acw[_0x6709('0x1f')][_0x6709('0x20')]=function(_0x224e8a){try{var _0x45921e=this;var _0x17763d=this[_0x6709('0x7')][_0x224e8a][_0x6709('0x21')];var _0x2f3415=this[_0x6709('0x7')][_0x224e8a]['queue'];var _0x29f25f=this[_0x6709('0x4')][_0x2f3415];var _0x2bcc73=![];var _0x5c7982=_0x6709('0x22');if(_0x29f25f[_0x6709('0x23')]&&_0x29f25f[_0x6709('0x24')][_0x6709('0x25')]){_0x2bcc73=!![];_0x5c7982=_0x29f25f['mandatoryDispositionPause'][_0x6709('0x25')];}if(!_0x45921e[_0x6709('0x5')][_0x17763d]){return Promise['resolve']();}return RpcUser[_0x6709('0x26')](_0x45921e[_0x6709('0x5')][_0x17763d]['id'])['then'](function(_0x444b0e){if(!_0x444b0e||_0x444b0e[_0x6709('0x27')]){logger['info'](_0x6709('0x28'),_0x224e8a,_0x17763d,_0x2f3415);return;}logger['info'](_0x6709('0x29'),_0x224e8a,_0x17763d,_0x2f3415);var _0x3cd555=_0x45921e['channels'][_0x224e8a][_0x6709('0x2a')]&&_0x45921e['channels'][_0x224e8a][_0x6709('0x2b')]?_0x45921e[_0x6709('0x7')][_0x224e8a]['destlinkedid']:_0x224e8a;return RpcUser[_0x6709('0x2c')](_0x45921e['agents'][_0x17763d],_0x5c7982,_0x3cd555);})[_0x6709('0x19')](function(_0x135f46){if(_0x2bcc73||!_0x135f46){return;}_0x45921e['timers'][_0x17763d]={};logger['info'](_0x6709('0x2d'),_0x224e8a,_0x45921e[_0x6709('0x4')][_0x2f3415][_0x6709('0x2e')],_0x17763d,_0x2f3415);_0x45921e[_0x6709('0x6')][_0x17763d][_0x6709('0x17')]=setTimeout(_0x45921e[_0x6709('0x2f')][_0x6709('0xa')](_0x45921e,_0x17763d),_0x45921e[_0x6709('0x4')][_0x2f3415][_0x6709('0x2e')]*0x3e8);_0x45921e['timers'][_0x17763d][_0x6709('0x30')]=moment()[_0x6709('0x31')](_0x6709('0x32'));_0x45921e[_0x6709('0x6')][_0x17763d]['uniqueid']=_0x224e8a;_0x45921e[_0x6709('0x6')][_0x17763d][_0x6709('0x33')]=_0x2f3415;_0x45921e[_0x6709('0x6')][_0x17763d][_0x6709('0x16')]=_0x45921e['updateAcw'][_0x6709('0xa')](_0x45921e,_0x17763d,_0x224e8a);})[_0x6709('0x1c')](function(){logger['error'](_0x6709('0x2d'),_0x224e8a,_0x45921e[_0x6709('0x4')][_0x2f3415]['acwTimeout'],_0x17763d,_0x2f3415);})[_0x6709('0x1e')](function(){delete _0x45921e[_0x6709('0x7')][_0x224e8a];});}catch(_0x65d1b7){logger[_0x6709('0x34')](_0x6709('0x35'),_0x65d1b7[_0x6709('0x36')]);}};Acw[_0x6709('0x1f')]['stopAcw']=function(_0x1cd361){try{var _0x34df09=this;if(_0x34df09['timers'][_0x1cd361]){_0x34df09[_0x6709('0x6')][_0x1cd361][_0x6709('0x17')]=![];var _0x6b5f39=_0x34df09[_0x6709('0x6')][_0x1cd361][_0x6709('0x18')];var _0x1c12bb=_0x34df09['timers'][_0x1cd361][_0x6709('0x33')];var _0x557a9b=_0x34df09[_0x6709('0x4')][_0x1c12bb][_0x6709('0x2e')];logger[_0x6709('0x1a')]('[%s][TIMER][STOP][AGENT:%s]',_0x6b5f39,_0x1cd361);RpcUser[_0x6709('0x37')](this[_0x6709('0x5')][_0x1cd361]);RpcVoiceAgentReport[_0x6709('0x38')]({'acwtime':_0x557a9b,'agentacw':!![]},_0x6b5f39,_0x1cd361)[_0x6709('0x19')](function(_0x2a0948){logger[_0x6709('0x1a')](_0x6709('0x1b'),_0x6b5f39,_0x557a9b,_0x2a0948);})['catch'](function(_0x3233a0){logger[_0x6709('0x34')](_0x6709('0x1d'),_0x6b5f39,_0x3233a0);});}else{logger[_0x6709('0x34')](_0x6709('0x39'),_0x1cd361);if(_0x34df09[_0x6709('0x6')]){logger[_0x6709('0x1a')]('[ACW][TIMERS]',JSON['stringify'](_0x34df09[_0x6709('0x6')]));}}}catch(_0x3f0da1){logger[_0x6709('0x34')](_0x6709('0x3a'),_0x3f0da1['message']);}};Acw['prototype']['syncAgentConnect']=function(_0x3d4237){try{if(this[_0x6709('0x4')][_0x3d4237['queue']]&&(this[_0x6709('0x4')][_0x3d4237[_0x6709('0x33')]]['acw']||this['voiceQueues'][_0x3d4237[_0x6709('0x33')]][_0x6709('0x23')])){if(this[_0x6709('0x5')][_0x3d4237[_0x6709('0x21')]]){this[_0x6709('0x7')][_0x3d4237['uniqueid']]={'queue':_0x3d4237[_0x6709('0x33')],'interface':_0x3d4237['interface'],'destlinkedid':_0x3d4237[_0x6709('0x2b')]};}}}catch(_0x409b84){logger[_0x6709('0x34')]('[ACW][syncAgentConnect]\x20%s',_0x409b84[_0x6709('0x36')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x22100d){try{if(this[_0x6709('0x4')][_0x22100d[_0x6709('0x33')]]&&(this[_0x6709('0x4')][_0x22100d[_0x6709('0x33')]][_0x6709('0x3b')]||this[_0x6709('0x4')][_0x22100d[_0x6709('0x33')]][_0x6709('0x23')])){if(this[_0x6709('0x5')][_0x22100d[_0x6709('0x21')]]){this[_0x6709('0x7')][_0x22100d[_0x6709('0x18')]]={'queue':_0x22100d[_0x6709('0x33')],'interface':_0x22100d[_0x6709('0x21')]};}}}catch(_0x4f82a0){logger[_0x6709('0x34')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4f82a0['message']);}};Acw[_0x6709('0x1f')][_0x6709('0x3c')]=function(_0x483e15){try{if(this[_0x6709('0x7')][_0x483e15[_0x6709('0x18')]]&&_[_0x6709('0x3d')](this[_0x6709('0x7')][_0x483e15[_0x6709('0x18')]]['attended'])){logger[_0x6709('0x1a')](_0x6709('0x3e'),_0x483e15[_0x6709('0x18')]);this[_0x6709('0x20')](_0x483e15['uniqueid']);}else if(this[_0x6709('0x7')][_0x483e15['linkedid']]&&_[_0x6709('0x3d')](this[_0x6709('0x7')][_0x483e15[_0x6709('0x3f')]][_0x6709('0x2a')])){logger[_0x6709('0x1a')]('[%s][HANGUP:LINKEDID]',_0x483e15[_0x6709('0x3f')]);this[_0x6709('0x20')](_0x483e15[_0x6709('0x3f')]);}}catch(_0x199591){logger[_0x6709('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x199591['message']);}};Acw[_0x6709('0x1f')]['syncHangup']=function(_0x4ec506){try{if(this[_0x6709('0x7')][_0x4ec506[_0x6709('0x18')]]&&this[_0x6709('0x7')][_0x4ec506[_0x6709('0x18')]][_0x6709('0x2a')]){logger[_0x6709('0x1a')](_0x6709('0x40'),_0x4ec506[_0x6709('0x18')]);this[_0x6709('0x20')](_0x4ec506[_0x6709('0x18')]);}else if(this[_0x6709('0x7')][_0x4ec506['linkedid']]&&this[_0x6709('0x7')][_0x4ec506[_0x6709('0x3f')]]['attended']){logger['info'](_0x6709('0x41'),_0x4ec506[_0x6709('0x3f')]);this[_0x6709('0x20')](_0x4ec506[_0x6709('0x3f')]);}}catch(_0x521e83){logger[_0x6709('0x34')]('[ACW][syncHangup]\x20%s',_0x521e83[_0x6709('0x36')]);}};Acw[_0x6709('0x1f')][_0x6709('0xf')]=function(_0xeec99c){try{if(!_[_0x6709('0x42')](this['channels'][_0xeec99c['transfereeuniqueid']])){this[_0x6709('0x20')](_0xeec99c[_0x6709('0x43')]);if(this['channels'][_0xeec99c[_0x6709('0x44')]]){this[_0x6709('0x7')][_0xeec99c['secondtransfereruniqueid']][_0x6709('0x2a')]=!![];this[_0x6709('0x7')][_0xeec99c[_0x6709('0x45')]]=this[_0x6709('0x7')][_0xeec99c['secondtransfereruniqueid']];delete this['channels'][_0xeec99c[_0x6709('0x44')]];}}else if(!_['isNil'](this[_0x6709('0x7')][_0xeec99c[_0x6709('0x45')]])){this[_0x6709('0x20')](_0xeec99c['transfertargetuniqueid']);if(this[_0x6709('0x7')][_0xeec99c['origtransfereruniqueid']]){this['channels'][_0xeec99c[_0x6709('0x46')]]['attended']=!![];this[_0x6709('0x7')][_0xeec99c['transfereeuniqueid']]=this[_0x6709('0x7')][_0xeec99c[_0x6709('0x46')]];delete this[_0x6709('0x7')][_0xeec99c[_0x6709('0x46')]];}}}catch(_0x5bc444){logger[_0x6709('0x34')](_0x6709('0x47'),_0x5bc444[_0x6709('0x36')]);}};Acw[_0x6709('0x1f')][_0x6709('0x11')]=function(_0x3d4d1c){try{if(this[_0x6709('0x7')][_0x3d4d1c['transfereruniqueid']]){logger[_0x6709('0x1a')](_0x6709('0x48'),JSON[_0x6709('0x49')](_0x3d4d1c[_0x6709('0x4a')]));this[_0x6709('0x20')](_0x3d4d1c[_0x6709('0x4a')]);}else if(this[_0x6709('0x7')][_0x3d4d1c[_0x6709('0x4b')]]){logger[_0x6709('0x1a')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x6709('0x49')](_0x3d4d1c[_0x6709('0x4b')]));this['startAcw'](_0x3d4d1c[_0x6709('0x4b')]);}}catch(_0x18b4fa){logger[_0x6709('0x34')](_0x6709('0x4c'),_0x18b4fa[_0x6709('0x36')]);}};Acw[_0x6709('0x1f')][_0x6709('0xe')]=function(_0x475449){try{if(this[_0x6709('0x4')][_0x475449['queue']]&&this[_0x6709('0x4')][_0x475449[_0x6709('0x33')]][_0x6709('0x4d')]===_0x6709('0x4e')){if(this[_0x6709('0x5')][_0x475449[_0x6709('0x21')]]){logger[_0x6709('0x1a')](_0x6709('0x4f'),_0x475449[_0x6709('0x18')],_0x475449[_0x6709('0x21')],_0x475449[_0x6709('0x33')]);return RpcUser['savePause'](this[_0x6709('0x5')][_0x475449['interface']],'Auto-Pause',_0x475449[_0x6709('0x18')]);}}}catch(_0xc65c7d){logger[_0x6709('0x34')](_0x6709('0x50'),_0xc65c7d[_0x6709('0x36')]);}};module[_0x6709('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 8b4fe57..80b8093 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 _0x5005=['actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','asterisk-manager','../../config/logger','ami','../../config/environment','port','asterisk','username','password','keepConnected','Action','action','inspect','error','format','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5005,0x129));var _0x5500=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x5005[_0x28fbe3];return _0x45db6a;};'use strict';var Manager=require(_0x5500('0x0'));var BPromise=require('bluebird');var util=require('util');var logger=require(_0x5500('0x1'))(_0x5500('0x2'));var config=require(_0x5500('0x3'));var ami=new Manager(config['asterisk'][_0x5500('0x4')],config[_0x5500('0x5')]['ip'],config['asterisk'][_0x5500('0x6')],config[_0x5500('0x5')][_0x5500('0x7')],!![]);ami[_0x5500('0x8')]();ami[_0x5500('0x9')]=BPromise['promisify'](ami[_0x5500('0xa')]);function error(_0x474cf6){logger['error'](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5500('0x5')]['username'],config[_0x5500('0x5')]['ip'],config[_0x5500('0x5')][_0x5500('0x4')],util[_0x5500('0xb')](_0x474cf6,![],null)));}function close(){logger[_0x5500('0xc')](util[_0x5500('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x5500('0x5')][_0x5500('0x6')],config[_0x5500('0x5')]['ip'],config['asterisk'][_0x5500('0x4')]));}ami[_0x5500('0xe')]=function(){return function(){return ami[_0x5500('0x9')]({'action':_0x5500('0xf')});};};ami[_0x5500('0x10')]=function(){return function(){return ami[_0x5500('0x9')]({'action':_0x5500('0x11')});};};ami[_0x5500('0x12')]=function(){return function(){return ami['Action']({'action':_0x5500('0x13')});};};ami[_0x5500('0x14')]=function(){return function(){return ami[_0x5500('0x9')]({'action':_0x5500('0x15')});};};ami[_0x5500('0x16')]=function(){return function(){return ami[_0x5500('0x9')]({'action':_0x5500('0x17')});};};function connect(){logger[_0x5500('0x18')](util[_0x5500('0xd')](_0x5500('0x19'),config[_0x5500('0x5')][_0x5500('0x6')],config['asterisk']['ip'],config['asterisk'][_0x5500('0x4')]));ami[_0x5500('0x1a')](_0x5500('0xc'),error);ami[_0x5500('0x1a')](_0x5500('0x1b'),close);}ami['on']('connect',connect);ami['on'](_0x5500('0x1c'),function(_0x1afd0e){logger['info'](util['format'](_0x5500('0x1d'),config[_0x5500('0x5')]['username'],config['asterisk']['ip'],config[_0x5500('0x5')][_0x5500('0x4')],util['inspect'](_0x1afd0e,![],null)));});ami['on'](_0x5500('0x1e'),function(){logger[_0x5500('0x18')](util[_0x5500('0xd')](_0x5500('0x1f'),config['asterisk'][_0x5500('0x6')],config[_0x5500('0x5')]['ip'],config[_0x5500('0x5')]['port']));return Promise['resolve']()['then'](ami[_0x5500('0xe')]())[_0x5500('0x20')](ami[_0x5500('0x10')]())[_0x5500('0x20')](ami[_0x5500('0x12')]())['then'](ami[_0x5500('0x14')]())[_0x5500('0x20')](ami[_0x5500('0x16')]())[_0x5500('0x21')](function(_0x380dfd){logger['error'](_0x5500('0x22'),util['inspect'](_0x380dfd,{'showHidden':![],'depth':null}));});});ami[_0x5500('0x1a')](_0x5500('0xc'),error);ami[_0x5500('0x1a')](_0x5500('0x1b'),close);module['exports']=ami; \ No newline at end of file +var _0xf0aa=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected','promisify','action'];(function(_0x28d111,_0x591d2e){var _0x173a3f=function(_0xb54650){while(--_0xb54650){_0x28d111['push'](_0x28d111['shift']());}};_0x173a3f(++_0x591d2e);}(_0xf0aa,0x68));var _0xaf0a=function(_0x19e294,_0x4ded18){_0x19e294=_0x19e294-0x0;var _0x66bd74=_0xf0aa[_0x19e294];return _0x66bd74;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xaf0a('0x0'));var util=require('util');var logger=require(_0xaf0a('0x1'))(_0xaf0a('0x2'));var config=require(_0xaf0a('0x3'));var ami=new Manager(config[_0xaf0a('0x4')][_0xaf0a('0x5')],config[_0xaf0a('0x4')]['ip'],config[_0xaf0a('0x4')]['username'],config[_0xaf0a('0x4')][_0xaf0a('0x6')],!![]);ami[_0xaf0a('0x7')]();ami['Action']=BPromise[_0xaf0a('0x8')](ami[_0xaf0a('0x9')]);function error(_0x2aac1c){logger[_0xaf0a('0xa')](util[_0xaf0a('0xb')](_0xaf0a('0xc'),config['asterisk'][_0xaf0a('0xd')],config[_0xaf0a('0x4')]['ip'],config[_0xaf0a('0x4')][_0xaf0a('0x5')],util[_0xaf0a('0xe')](_0x2aac1c,![],null)));}function close(){logger[_0xaf0a('0xa')](util[_0xaf0a('0xb')](_0xaf0a('0xf'),config[_0xaf0a('0x4')]['username'],config[_0xaf0a('0x4')]['ip'],config[_0xaf0a('0x4')][_0xaf0a('0x5')]));}ami[_0xaf0a('0x10')]=function(){return function(){return ami[_0xaf0a('0x11')]({'action':_0xaf0a('0x12')});};};ami[_0xaf0a('0x13')]=function(){return function(){return ami['Action']({'action':_0xaf0a('0x14')});};};ami[_0xaf0a('0x15')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xaf0a('0x16')]=function(){return function(){return ami[_0xaf0a('0x11')]({'action':'queuesummary'});};};ami[_0xaf0a('0x17')]=function(){return function(){return ami[_0xaf0a('0x11')]({'action':'coreshowchannels'});};};function connect(){logger[_0xaf0a('0x18')](util[_0xaf0a('0xb')](_0xaf0a('0x19'),config[_0xaf0a('0x4')][_0xaf0a('0xd')],config[_0xaf0a('0x4')]['ip'],config[_0xaf0a('0x4')][_0xaf0a('0x5')]));ami[_0xaf0a('0x1a')]('error',error);ami[_0xaf0a('0x1a')](_0xaf0a('0x1b'),close);}ami['on'](_0xaf0a('0x1c'),connect);ami['on'](_0xaf0a('0x1d'),function(_0x14168d){logger['info'](util['format'](_0xaf0a('0x1e'),config['asterisk'][_0xaf0a('0xd')],config[_0xaf0a('0x4')]['ip'],config[_0xaf0a('0x4')][_0xaf0a('0x5')],util['inspect'](_0x14168d,![],null)));});ami['on'](_0xaf0a('0x1f'),function(){logger[_0xaf0a('0x18')](util['format'](_0xaf0a('0x20'),config[_0xaf0a('0x4')][_0xaf0a('0xd')],config[_0xaf0a('0x4')]['ip'],config[_0xaf0a('0x4')][_0xaf0a('0x5')]));return Promise[_0xaf0a('0x21')]()[_0xaf0a('0x22')](ami[_0xaf0a('0x10')]())[_0xaf0a('0x22')](ami['actionDeviceStateList']())[_0xaf0a('0x22')](ami[_0xaf0a('0x15')]())['then'](ami[_0xaf0a('0x16')]())[_0xaf0a('0x22')](ami[_0xaf0a('0x17')]())[_0xaf0a('0x23')](function(_0x1759fc){logger[_0xaf0a('0xa')](_0xaf0a('0x24'),util[_0xaf0a('0xe')](_0x1759fc,{'showHidden':![],'depth':null}));});});ami[_0xaf0a('0x1a')]('error',error);ami['once'](_0xaf0a('0x1b'),close);module[_0xaf0a('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index e78f530..44c5340 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x5887ec,_0x504c12){var _0x23b637=function(_0x3f720f){while(--_0x3f720f){_0x5887ec['push'](_0x5887ec['shift']());}};_0x23b637(++_0x504c12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x193077,_0x8fc002){var _0x255135=function(_0x428564){while(--_0x428564){_0x193077['push'](_0x193077['shift']());}};_0x255135(++_0x8fc002);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 150f9c5..25e2545 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 _0x4326=['busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalAnsweredCalls','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','busyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','socket.io-emitter','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','then','emit','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','info','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','stack','error','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','starttime','queueStatusComplete','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','prototype','isTrunkReachable','active','SIP/%s','status','format','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','indexOf','true','catch','iftime\x20%s,%s','content','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','loopCampaigns','syncCampaigns','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','booked','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','type','ivr','updateOriginated','uniqueid','answertime','outboundAnswerCallsDay','reason','agent','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','VoiceQueueId','CampaignId','Abandoned','endtime','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','rrmemory','roundrobin','isNil','paused','stateinterface','locked','idHopper','syncQueueStatusComplete','strategy','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','membername','[syncHangupInAMDIvr]','countagentrejectretry','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','resolve','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','launchHandleIvr','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','getCaller','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Trunk','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy'];(function(_0x50b3a8,_0x1b1ad9){var _0x25e7dc=function(_0x2f8d6d){while(--_0x2f8d6d){_0x50b3a8['push'](_0x50b3a8['shift']());}};_0x25e7dc(++_0x1b1ad9);}(_0x4326,0x70));var _0x6432=function(_0x490911,_0x561078){_0x490911=_0x490911-0x0;var _0x300d1b=_0x4326[_0x490911];return _0x300d1b;};'use strict';var util=require('util');var _=require('lodash');var uuid=require('uuid');var moment=require(_0x6432('0x0'));var rr=require('rr');var Redis=require(_0x6432('0x1'));var utils=require('./utils');var hopperUtils=require(_0x6432('0x2'));var ut=require(_0x6432('0x3'));var config=require('../../../config/environment/');var logger=require(_0x6432('0x4'))(_0x6432('0x5'));var loggerBooked=require(_0x6432('0x4'))('booked');var loggerPredictive=require(_0x6432('0x4'))(_0x6432('0x6'));var loggerPredictiveCalls=require('../../../config/logger')(_0x6432('0x7'));var loggerSyncQueueSummary=require(_0x6432('0x4'))(_0x6432('0x8'));var ami=require(_0x6432('0x9'));config['redis']=_[_0x6432('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6432('0xb'))(new Redis(config[_0x6432('0xc')]));var cmHopper=require(_0x6432('0xd'));var voiceQueueRt=require(_0x6432('0xe'));var RpcSetting=require(_0x6432('0xf'));var Interval=require(_0x6432('0x10'));var Action=require('./models/action');var History=require(_0x6432('0x11'));var Final=require('./models/final');var AgentComplete=require(_0x6432('0x12'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x6432('0x13'));var ipAgi=process[_0x6432('0x14')][_0x6432('0x15')]||_0x6432('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x6432('0x17')]=function(_0x35be86){this[_0x6432('0x18')]=this['tail']?this[_0x6432('0x18')][_0x6432('0x19')](_0x35be86):_0x35be86();};function Dialer(_0x270792,_0x2495f9){this[_0x6432('0x1a')]=new Sequence();this[_0x6432('0x1b')]=_0x2495f9;this[_0x6432('0x1c')]=_0x270792['voiceQueues'];this[_0x6432('0x1d')]=_0x270792[_0x6432('0x1d')];this[_0x6432('0x1e')]=_0x270792[_0x6432('0x1e')];this[_0x6432('0x1f')]=_0x270792[_0x6432('0x1f')];this[_0x6432('0x20')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x6432('0x21')]={};this[_0x6432('0x22')]={};this[_0x6432('0x23')]={};this[_0x6432('0x24')]={};this['startPredictive']={};this[_0x6432('0x25')]={};this[_0x6432('0x26')]={};this[_0x6432('0x27')]={};this['queueBookedRR']={};this[_0x6432('0x28')]={};ami['on']('agentconnect',this[_0x6432('0x29')][_0x6432('0x2a')](this));ami['on'](_0x6432('0x2b'),this['syncQueueCallerAbandon'][_0x6432('0x2a')](this));ami['on'](_0x6432('0x2c'),this[_0x6432('0x2d')][_0x6432('0x2a')](this));ami['on']('agentcomplete',this[_0x6432('0x2e')][_0x6432('0x2a')](this));ami['on'](_0x6432('0x2f'),this['syncQueueSummary'][_0x6432('0x2a')](this));ami['on'](_0x6432('0x30'),this[_0x6432('0x31')][_0x6432('0x2a')](this));ami['on'](_0x6432('0x32'),this[_0x6432('0x33')][_0x6432('0x2a')](this));ami['on'](_0x6432('0x34'),this['syncNewExten'][_0x6432('0x2a')](this));ami['on'](_0x6432('0x35'),this[_0x6432('0x36')][_0x6432('0x2a')](this));ami['on'](_0x6432('0x37'),this[_0x6432('0x38')][_0x6432('0x2a')](this));ami['on'](_0x6432('0x39'),this['syncQueueStatusComplete'][_0x6432('0x2a')](this));this['loopCampaigns']();this[_0x6432('0x3a')]();RpcSetting['getSettings']()[_0x6432('0x3b')](function(_0x1b49b6){previewRecallmeReminderInterval=_0x1b49b6['previewRecallmeReminderInterval'];});}function isNotNull(_0x1ee1ea){return _0x1ee1ea!==null&&!_['isUndefined'](_0x1ee1ea);}function msgResponse(_0x579587,_0xc5c25b,_0x2ce65c){return{'action':_0x579587,'response':_0xc5c25b,'message':_0x2ce65c,'stack':_0x2ce65c};}function emit(_0x4f6ac2,_0x3a1da0,_0x101dd9){io['to'](_0x4f6ac2)[_0x6432('0x3c')](_0x3a1da0,_0x101dd9);}function emitOutboundVoiceQueueSummary(_0xe9a6a8){if(_0xe9a6a8['type']==='outbound'){logger['debug'](_0x6432('0x3d'),util[_0x6432('0x3e')](_0xe9a6a8,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0xe9a6a8[_0x6432('0x3f')]),_0x6432('0x40'),_0xe9a6a8);}}function checkGetDataPredictive(_0x3860a8){if(isNotNull(_0x3860a8)&&!_[_0x6432('0x41')](_0x3860a8)){loggerPredictive['info'](_0x6432('0x42'));loggerPredictive['info'](_0x6432('0x43'),_0x3860a8[_0x6432('0x44')]);loggerPredictive[_0x6432('0x45')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3860a8['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x6432('0x46'),_0x3860a8[_0x6432('0x47')]);loggerPredictive['info'](_0x6432('0x48'),_0x3860a8['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x6432('0x45')](_0x6432('0x49'),_0x3860a8[_0x6432('0x4a')]);loggerPredictive[_0x6432('0x45')](_0x6432('0x4b'),_0x3860a8[_0x6432('0x4c')]);loggerPredictive[_0x6432('0x45')](_0x6432('0x4d'));if(_0x3860a8['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x3860a8[_0x6432('0x4c')])&&_0x3860a8[_0x6432('0x4c')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x6432('0x4e')](_0x3860a8[_0x6432('0x4a')])&&_0x3860a8[_0x6432('0x4a')]>0x0){return!![];}loggerPredictive[_0x6432('0x45')](_0x6432('0x4f'));}else{loggerPredictive[_0x6432('0x45')](_0x6432('0x50'));}}else{loggerPredictive[_0x6432('0x45')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x4bb33b){return function(_0xf4f877){loggerPredictive[_0x6432('0x45')](_0x6432('0x51'));loggerPredictive[_0x6432('0x45')](_0x6432('0x52'),_0xf4f877[_0x6432('0x53')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf4f877[_0x6432('0x54')]);loggerPredictive[_0x6432('0x45')](_0x6432('0x55'),_0xf4f877[_0x6432('0x56')]);loggerPredictive[_0x6432('0x45')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf4f877[_0x6432('0x57')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf4f877[_0x6432('0x56')]);loggerPredictive[_0x6432('0x45')](_0x6432('0x4d'));_[_0x6432('0x58')](_0x4bb33b,_0xf4f877);};}function ifInterval(_0x317c7e,_0x39bc4e){if(_[_0x6432('0x4e')](_0x39bc4e)){return![];}return utils[_0x6432('0x59')](undefined,_0x39bc4e)<_0x317c7e*0x3c;}function clearPredictiveAttributes(_0xe31027){if(_0xe31027[_0x6432('0x25')]){_0xe31027[_0x6432('0x25')]=undefined;loggerPredictive[_0x6432('0x5a')](_0xe31027['name'],_0x6432('0x5b'));}if(_0xe31027[_0x6432('0x5c')]){_0xe31027[_0x6432('0x5c')]=undefined;loggerPredictive[_0x6432('0x5a')](_0xe31027[_0x6432('0x3f')],_0x6432('0x5d'));}if(_0xe31027[_0x6432('0x5e')]){clearInterval(_0xe31027[_0x6432('0x5e')]);_0xe31027[_0x6432('0x5e')]=undefined;loggerPredictive[_0x6432('0x5a')](_0xe31027[_0x6432('0x3f')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x4bc1a1,_0x30c770){return function(_0x3dbfe3){loggerPredictive['error'](_0x30c770[_0x6432('0x3f')],_0x4bc1a1);loggerPredictive['error'](_0x3dbfe3[_0x6432('0x5f')]);clearPredictiveAttributes(_0x30c770);};}function loggerCatch(_0x3da01d){return function(_0x453f59){logger[_0x6432('0x60')](_0x3da01d,util[_0x6432('0x3e')](_0x453f59,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x54cb6e,_0x5325a8,_0x88daf0){return function(_0x364a85){utils['checkContactLowerLimitOriginate'](_0x5325a8,_0x88daf0,0x0);_0x5325a8['temp']=0x0;logger[_0x6432('0x60')](_0x54cb6e,util[_0x6432('0x3e')](_0x364a85,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3fe278){return function(_0x2a42b2){if(isNotNull(_0x2a42b2)&&isNotNull(_0x2a42b2[0x0])){if(_0x2a42b2[0x0][_0x6432('0x61')]>0x0){_0x3fe278[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x64')];logger['info'](_0x6432('0x65')+_0x3fe278[_0x6432('0x3f')],_0x2a42b2[0x0][_0x6432('0x61')],_0x6432('0x66'));}else{_0x3fe278[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x67')];logger[_0x6432('0x45')]('[getContactDialer2][Empty]'+_0x3fe278[_0x6432('0x3f')]);}}};}function createObjHistory(_0x5deea4,_0x36366c,_0x3b2083,_0x27482d,_0x533b8e){_0x5deea4[_0x6432('0x62')]=_0x3b2083;var _0x28b6b6=new Action(_0x5deea4,_0x36366c);var _0x19a7d1=new History(_0x28b6b6);_0x19a7d1[_0x6432('0x68')]=_0x27482d;_0x19a7d1[_0x6432('0x69')]=_0x533b8e;_0x19a7d1['endtime']=_0x28b6b6[_0x6432('0x6a')];return _0x19a7d1;}function unlockQueueStatus(_0x30cf1a,_0x368592){setTimeout(function(){if(_[_0x6432('0x4e')](_0x30cf1a[_0x6432('0x6b')])){loggerBooked[_0x6432('0x60')]('[unlockQueueStatus][undefined]',_0x368592);}_0x30cf1a[_0x6432('0x6b')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x368592,JSON[_0x6432('0x6c')](_[_0x6432('0x6d')](_0x30cf1a,[_0x6432('0x3f'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x49fa4f){return function(){if(!isNotNull(_0x49fa4f[_0x6432('0x6e')])){_0x49fa4f[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x6f')];throw _0x49fa4f[_0x6432('0x3f')]+_0x6432('0x70');}if(!isNotNull(_0x49fa4f[_0x6432('0x6e')][_0x6432('0x71')])){_0x49fa4f[_0x6432('0x62')]=utils[_0x6432('0x63')]['NULL_INTERVAL'];throw _0x49fa4f[_0x6432('0x3f')]+_0x6432('0x70');}if(!isNotNull(_[_0x6432('0x41')](_0x49fa4f[_0x6432('0x6e')]['Intervals']))){_0x49fa4f[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x6f')];throw _0x49fa4f[_0x6432('0x3f')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x5b00b5){return function(){if(!utils[_0x6432('0x72')](_0x5b00b5)){_0x5b00b5[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x73')];throw _0x5b00b5[_0x6432('0x3f')]+_0x6432('0x74');}};}function emitCampaignSummary(_0x48802f){if(utils['isIVRCampaign'](_0x48802f)){emit(util['format'](_0x6432('0x75'),_0x48802f[_0x6432('0x3f')]),_0x6432('0x76'),_0x48802f);}}function loggerCatchQueueSummary(_0x2cdf3e,_0xd8ce6e){return function(_0x4502ab){clearPredictiveAttributes(_0xd8ce6e);emitCampaignSummary(_0xd8ce6e);loggerSyncQueueSummary['debug'](_0x2cdf3e,util[_0x6432('0x3e')](_0x4502ab,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2baf51){if(_0x2baf51[_0x6432('0x77')]){if(_0x2baf51['originated']===0x0){_0x2baf51[_0x6432('0x77')]=![];_0x2baf51[_0x6432('0x62')]=utils[_0x6432('0x63')]['INACTIVE'];loggerSyncQueueSummary[_0x6432('0x5a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2baf51[_0x6432('0x3f')],'is\x20not\x20active');}else{_0x2baf51[_0x6432('0x62')]=utils['CAMPAIGN_STATUS'][_0x6432('0x78')];loggerSyncQueueSummary[_0x6432('0x5a')](_0x6432('0x79'),_0x2baf51['name'],_0x6432('0x7a'));}emitCampaignSummary(_0x2baf51);}}function myreject(_0x3cadec){return function(_0xa344c5){return _0x3cadec(msgResponse(_0x6432('0x7b'),'Error',JSON['stringify'](_0xa344c5)));};}Dialer[_0x6432('0x7c')][_0x6432('0x7d')]=function(_0x5f54a3){return!_[_0x6432('0x4e')](_0x5f54a3)&&_0x5f54a3&&!_['isUndefined'](_0x5f54a3['name'])&&!_[_0x6432('0x4e')](_0x5f54a3[_0x6432('0x7e')])&&_0x5f54a3[_0x6432('0x7e')]&&(this[_0x6432('0x1f')][util['format'](_0x6432('0x7f'),_0x5f54a3[_0x6432('0x3f')])][_0x6432('0x80')]==='reachable'||this[_0x6432('0x1f')][util[_0x6432('0x81')](_0x6432('0x7f'),_0x5f54a3[_0x6432('0x3f')])][_0x6432('0x80')]==='unmonitored');};Dialer[_0x6432('0x7c')]['checkIsTrunkReachable']=function(_0x5c2d06){var _0x424d37=this;return function(){if(!_0x424d37['isTrunkReachable'](_0x5c2d06['Trunk'])){if(!_0x424d37[_0x6432('0x7d')](_0x5c2d06['TrunkBackup'])){_0x5c2d06['message']=utils[_0x6432('0x63')][_0x6432('0x82')];throw _0x5c2d06[_0x6432('0x3f')]+_0x6432('0x83');}}};};Dialer[_0x6432('0x7c')][_0x6432('0x84')]=function(_0x59f20a,_0x4a4c76,_0x180f9b,_0x248c14){var _0x4e34ed=this;return function(){var _0x158e44=!![];return _0x4e34ed[_0x6432('0x85')](_0x59f20a,_0x4a4c76,_0x180f9b,_0x248c14,_0x158e44);};};Dialer['prototype'][_0x6432('0x86')]=function(_0x53e710,_0x3ffa9f,_0x57096c,_0x1c20e9){var _0x72698a=this;return function(){var _0x1d58f5=![];return _0x72698a['ifTimeIvr'](_0x53e710[_0x6432('0x71')],_0x3ffa9f,_0x57096c,_0x1c20e9,_0x1d58f5);};};Dialer[_0x6432('0x7c')][_0x6432('0x85')]=function(_0xb21fe8,_0x1ff3c5,_0x122aa2,_0x304878,_0x28fc96){var _0x295b7c=[];return new Promise(function(_0x12fd70,_0x2d0b21){if(!isNotNull(_0xb21fe8)){_0x304878[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x6f')];return _0x2d0b21(msgResponse(_0x6432('0x87'),_0x6432('0x88'),_0x122aa2+_0x6432('0x89')));}if(_['isEmpty'](_0xb21fe8)){_0x304878[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x8a')];return _0x2d0b21(msgResponse(_0x6432('0x87'),_0x6432('0x88'),_0x122aa2+_0x6432('0x8b')));}if(_0x1ff3c5&&_[_0x6432('0x4e')](config[_0x6432('0x8c')][_0x1ff3c5])){_0x304878[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x8d')];return _0x2d0b21(msgResponse('ifTime',_0x6432('0x88'),_0x122aa2+_0x6432('0x8e')+_0x1ff3c5));}if(_[_0x6432('0x8f')](_0xb21fe8)){for(var _0x28ac0f=0x0;_0x28ac0f<_0xb21fe8[_0x6432('0x90')];_0x28ac0f+=0x1){_0x295b7c[_0x6432('0x91')](ami[_0x6432('0x92')]({'action':_0x6432('0x93'),'command':util[_0x6432('0x81')]('iftime\x20%s,%s',_0xb21fe8[_0x28ac0f][_0x6432('0x94')],!_[_0x6432('0x4e')](config[_0x6432('0x8c')][_0x1ff3c5])?_0x1ff3c5:'')})[_0x6432('0x3b')](function(_0x399e1e){return _0x399e1e['content'][_0x6432('0x95')](_0x6432('0x96'))>=0x0;})[_0x6432('0x97')](myreject(_0x2d0b21)));}}else{_0x295b7c[_0x6432('0x91')](ami[_0x6432('0x92')]({'action':_0x6432('0x93'),'command':util[_0x6432('0x81')](_0x6432('0x98'),_0xb21fe8,!_[_0x6432('0x4e')](config[_0x6432('0x8c')][_0x1ff3c5])?_0x1ff3c5:'')})[_0x6432('0x3b')](function(_0x179a9c){return _0x179a9c[_0x6432('0x99')][_0x6432('0x95')]('true')>=0x0;})[_0x6432('0x97')](myreject(_0x2d0b21)));}Promise[_0x6432('0x9a')](_0x295b7c)[_0x6432('0x3b')](function(_0x41bdaa){var _0xa9b76a=_[_0x6432('0x9b')](_0x41bdaa);if(_0xa9b76a){return _0x12fd70(_0xa9b76a);}else{_0x304878[_0x6432('0x62')]=_0x28fc96?utils[_0x6432('0x63')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x6432('0x63')][_0x6432('0x9c')];return _0x2d0b21(msgResponse(_0x6432('0x9d'),'Failure','Global:\x20'+_0x28fc96+'\x20'+_0x122aa2+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0xb21fe8,{'showHidden':![],'depth':null})+_0x6432('0x9e')+_0x1ff3c5));}})[_0x6432('0x97')](function(_0xa69a68){return _0x2d0b21(msgResponse(_0x6432('0x87'),'Failure',JSON[_0x6432('0x6c')](_0xa69a68)));});});};Dialer[_0x6432('0x7c')][_0x6432('0x9f')]=function(){var _0x3ee56b=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x6432('0x3b')](function(){setInterval(function(){_0x3ee56b['syncCampaigns']();},0x3e8);});};Dialer[_0x6432('0x7c')][_0x6432('0xa0')]=function(){var _0x39be61=this;var _0x3ea7f5;for(var _0x20f1ce in this[_0x6432('0x1d')]){if(typeof this[_0x6432('0x1d')][_0x20f1ce]!=='undefined'){_0x3ea7f5=this[_0x6432('0x1d')][_0x20f1ce];if(utils['isIVRCampaign'](_0x3ea7f5)&&utils[_0x6432('0x72')](_0x3ea7f5)){_0x3ea7f5[_0x6432('0x77')]=!![];Promise['resolve']()[_0x6432('0x3b')](checkIsIVRCampaignActive(_0x3ea7f5))['then'](checkInterval(_0x3ea7f5))['then'](_0x39be61['checkIsTrunkReachable'](_0x3ea7f5))[_0x6432('0x3b')](_0x39be61[_0x6432('0x84')](_0x3ea7f5['dialGlobalInterval'],_0x3ea7f5[_0x6432('0xa1')],_0x3ea7f5[_0x6432('0x3f')],_0x3ea7f5))[_0x6432('0x3b')](_0x39be61['checkIfTimeIntervals'](_0x3ea7f5['Interval'],_0x3ea7f5[_0x6432('0xa1')],_0x3ea7f5[_0x6432('0x3f')],_0x3ea7f5))['then'](_0x39be61['launchHandleIvr'](_0x3ea7f5))[_0x6432('0x97')](loggerCatchQueueSummary(_0x6432('0xa2'),_0x3ea7f5));}else{notSendMessagesCampaign(_0x3ea7f5);}}}};Dialer[_0x6432('0x7c')][_0x6432('0xa3')]=function(_0xd84655){if(_0xd84655[_0x6432('0xa4')]!=='predictive'){clearPredictiveAttributes(_0xd84655);}switch(_0xd84655[_0x6432('0xa4')]){case'progressive':this['handlePower'](_0xd84655,0x1);break;case'power':this[_0x6432('0xa5')](_0xd84655,_0xd84655['dialPowerLevel']);break;case _0x6432('0x6'):this[_0x6432('0x6')](_0xd84655);break;case _0x6432('0xa6'):this[_0x6432('0xa5')](_0xd84655,0x1);break;default:logger['error'](_0x6432('0xa7'),_0xd84655['name'],_0x6432('0xa8'));}};Dialer[_0x6432('0x7c')][_0x6432('0x87')]=function(_0xccd258,_0x1dc7ca){var _0x36c0f0=_0xccd258['dialTimezone'];var _0x5b2967=_0x1dc7ca?_0xccd258[_0x6432('0xa9')]:_0xccd258['Interval']['Intervals'];logger[_0x6432('0xaa')](_0x6432('0xab'),_0x5b2967,_0x36c0f0,_0xccd258[_0x6432('0x3f')],util[_0x6432('0x81')]('Voice\x20Queue\x20%s\x20$s',_0xccd258[_0x6432('0x3f')],_0xccd258['id']));var _0x1e8a35=null;return Interval[_0x6432('0xac')](_0x5b2967,_0x36c0f0)[_0x6432('0x3b')](function(_0x16e707){if(_0x16e707===!![]){return _0x16e707;}else{_0xccd258[_0x6432('0x62')]=_0x1dc7ca?utils[_0x6432('0x63')][_0x6432('0xad')]:utils[_0x6432('0x63')]['OVERTIME_INTERVAL'];_0x1e8a35=msgResponse(_0x6432('0x9d'),'Failure',_0x6432('0xae')+_0x1dc7ca+'\x20'+_0xccd258[_0x6432('0x3f')]+_0x6432('0xaf')+util[_0x6432('0x3e')](_0x5b2967,{'showHidden':![],'depth':null})+_0x6432('0x9e')+_0x36c0f0);}if(_0x1e8a35!==null){logger[_0x6432('0xaa')](_0x6432('0xb0'),_0x1e8a35);_0x1e8a35[_0x6432('0xb1')]=_0x1dc7ca;throw _0x1e8a35;}})[_0x6432('0x97')](function(_0x181679){logger[_0x6432('0x60')](_0x6432('0xb2'),_0x181679);throw msgResponse(_0x6432('0x7b'),'Error',util[_0x6432('0x3e')](_0x181679,{'showHidden':![],'depth':null}));});};Dialer[_0x6432('0x7c')][_0x6432('0x29')]=function(_0x222f9b){if(this['voiceQueues'][_0x222f9b[_0x6432('0xb3')]]){if(this['uniqueId'][_0x222f9b['uniqueid']]&&this[_0x6432('0x23')][_0x222f9b['uniqueid']][_0x6432('0xb4')]!==_0x6432('0xb5')){this[_0x6432('0xb6')](this[_0x6432('0x1c')][_0x222f9b[_0x6432('0xb3')]]);this['uniqueId'][_0x222f9b[_0x6432('0xb7')]][_0x6432('0xb8')]=moment()[_0x6432('0x81')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x6432('0x7c')][_0x6432('0x2e')]=function(_0x2ef9b9){var _0x3f2eca=this[_0x6432('0x23')][_0x2ef9b9[_0x6432('0xb7')]];if(this[_0x6432('0x1c')][_0x2ef9b9['queue']]){if(_0x3f2eca&&_0x3f2eca[_0x6432('0xb4')]!==_0x6432('0xb5')){delete this[_0x6432('0x23')][_0x2ef9b9[_0x6432('0xb7')]];this['voiceQueues'][_0x2ef9b9[_0x6432('0xb3')]][_0x6432('0xb9')]+=0x1;var _0x329680=new AgentComplete(_0x3f2eca,_0x2ef9b9);if(_0x2ef9b9[_0x6432('0xba')]===_0x6432('0xbb')){_0x329680['agiafterat']=this[_0x6432('0x1c')][_0x2ef9b9[_0x6432('0xb3')]][_0x6432('0xbc')]&&this[_0x6432('0x1c')][_0x2ef9b9['queue']]['dialAgiAfterHangupAgent']?moment()[_0x6432('0x81')](_0x6432('0xbd')):undefined;}hopperUtils[_0x6432('0xbe')](_0x329680)[_0x6432('0x97')](loggerCatch(_0x6432('0xbf')));hopperUtils[_0x6432('0xc0')](_0x329680)[_0x6432('0x97')](loggerCatch(_0x6432('0xc1')));}}};Dialer['prototype'][_0x6432('0xc2')]=function(_0x4596f5){var _0x2082b2=this[_0x6432('0x23')][_0x4596f5[_0x6432('0xb7')]];var _0x4eebec=this;var _0x5dd4d3=![];var _0xd927fd;var _0x39fa00;if(this['voiceQueues'][_0x4596f5[_0x6432('0xb3')]]){if(_0x2082b2&&_0x2082b2[_0x6432('0xb4')]!==_0x6432('0xb5')){delete this[_0x6432('0x23')][_0x4596f5[_0x6432('0xb7')]];this[_0x6432('0xb6')](this[_0x6432('0x1c')][_0x4596f5[_0x6432('0xb3')]]);_0x2082b2[_0x6432('0xc3')]=moment()[_0x6432('0x81')](_0x6432('0xbd'));var _0x3ccb20=new QueueCallerAbandon(_0x2082b2,_0x4596f5);if(utils[_0x6432('0x59')](_0x2082b2[_0x6432('0xc3')],_0x2082b2['responsetime'])>=_0x2082b2[_0x6432('0xc4')]){this['voiceQueues'][_0x4596f5[_0x6432('0xb3')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x4596f5['queue']][_0x6432('0xc5')]+=0x1;this[_0x6432('0x1c')][_0x4596f5[_0x6432('0xb3')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3ccb20[_0x6432('0x68')]=0xa;_0x3ccb20[_0x6432('0x69')]=_0x6432('0xc6');_0x3ccb20[_0x6432('0xc7')]=_0x6432('0xc8');_0x3ccb20[_0x6432('0xc9')]=this[_0x6432('0x1c')][_0x4596f5[_0x6432('0xb3')]][_0x6432('0xbc')]?moment()[_0x6432('0x81')](_0x6432('0xbd')):undefined;_0x3ccb20[_0x6432('0xca')]+=0x1;_0x3ccb20['countglobal']+=0x1;_0xd927fd=this['voiceQueues'][_0x4596f5[_0x6432('0xb3')]][_0x6432('0xcb')];_0x39fa00=this[_0x6432('0x1c')][_0x4596f5[_0x6432('0xb3')]][_0x6432('0xcc')];hopperUtils[_0x6432('0xcd')](_0x3ccb20,_0x3ccb20[_0x6432('0x68')],_0x2082b2[_0x6432('0xce')])['then'](function(_0x19beaf){_0x5dd4d3=_0x19beaf[_0x6432('0xcf')]==0x1;if(_0x3ccb20[_0x6432('0xca')]>=_0x4eebec['voiceQueues'][_0x4596f5[_0x6432('0xb3')]][_0x6432('0xd0')]){_0x4eebec[_0x6432('0xd1')](_0x3ccb20,_0x19beaf['additional']);}else{hopperUtils[_0x6432('0xd2')]({'active':![],'countdropretry':_0x3ccb20['countdropretry'],'scheduledat':moment()[_0x6432('0xd3')](_0x4eebec[_0x6432('0x1c')][_0x4596f5['queue']]['dialDropRetryFrequency'],_0x6432('0xd4'))[_0x6432('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2082b2[_0x6432('0xd5')],'ListId':_0x2082b2[_0x6432('0xd6')],'VoiceQueueId':_0x2082b2['VoiceQueueId']||undefined,'CampaignId':_0x2082b2['CampaignId']||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0xd7')));var _0x159f81=new History(_0x3ccb20);_0x159f81[_0x6432('0x68')]=0xa;_0x159f81[_0x6432('0x69')]=_0x6432('0xc6');_0x159f81[_0x6432('0x6a')]=moment()[_0x6432('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0x159f81['endtime']=_0x159f81[_0x6432('0x6a')];_0x159f81[_0x6432('0xd8')]=_0x3ccb20[_0x6432('0xd8')];_0x159f81[_0x6432('0xd9')]=_0x3ccb20[_0x6432('0xd9')];hopperUtils[_0x6432('0xbe')](_0x159f81)[_0x6432('0x97')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x6432('0x3b')](function(){if(_0x5dd4d3)hopperUtils[_0x6432('0xda')](_0x3ccb20,_0xd927fd,_0x39fa00)[_0x6432('0x3b')](function(){return 0x1;});});}else{this[_0x6432('0x1c')][_0x4596f5['queue']][_0x6432('0xdb')]+=0x1;this[_0x6432('0x1c')][_0x4596f5['queue']][_0x6432('0xdc')]+=0x1;_0x3ccb20['state']=0xb;_0x3ccb20[_0x6432('0x69')]='Abandoned';_0x3ccb20[_0x6432('0xc7')]=_0x6432('0xdd');_0x3ccb20[_0x6432('0xde')]+=0x1;_0x3ccb20[_0x6432('0xdf')]+=0x1;_0xd927fd=this['voiceQueues'][_0x4596f5[_0x6432('0xb3')]][_0x6432('0xe0')];_0x39fa00=this[_0x6432('0x1c')][_0x4596f5[_0x6432('0xb3')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x3ccb20,_0x3ccb20[_0x6432('0x68')],_0x2082b2[_0x6432('0xce')])[_0x6432('0x3b')](function(_0x5b97fe){if(_0x3ccb20[_0x6432('0xde')]>=_0x4eebec['voiceQueues'][_0x4596f5['queue']][_0x6432('0xe1')]){_0x4eebec[_0x6432('0xd1')](_0x3ccb20,_0x5b97fe[_0x6432('0xcf')]);}else{hopperUtils[_0x6432('0xd2')]({'active':![],'countabandonedretry':_0x3ccb20[_0x6432('0xde')],'scheduledat':moment()[_0x6432('0xd3')](_0x4eebec[_0x6432('0x1c')][_0x4596f5[_0x6432('0xb3')]][_0x6432('0xe0')],_0x6432('0xd4'))[_0x6432('0x81')](_0x6432('0xbd')),'ContactId':_0x2082b2[_0x6432('0xd5')],'ListId':_0x2082b2[_0x6432('0xd6')],'VoiceQueueId':_0x2082b2[_0x6432('0xe2')]||undefined,'CampaignId':_0x2082b2[_0x6432('0xe3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0xd9b4d4=new History(_0x3ccb20);_0xd9b4d4[_0x6432('0x68')]=0xb;_0xd9b4d4[_0x6432('0x69')]=_0x6432('0xe4');_0xd9b4d4[_0x6432('0x6a')]=moment()[_0x6432('0x81')](_0x6432('0xbd'));_0xd9b4d4[_0x6432('0xe5')]=_0xd9b4d4[_0x6432('0x6a')];_0xd9b4d4[_0x6432('0xd8')]=_0x3ccb20['calleridname'];_0xd9b4d4['calleridnum']=_0x3ccb20[_0x6432('0xd9')];hopperUtils[_0x6432('0xbe')](_0xd9b4d4)['catch'](loggerCatch(_0x6432('0xe6')));}})[_0x6432('0x3b')](function(){if(_0x5dd4d3)hopperUtils['swapAdditionalPhones'](_0x3ccb20,_0xd927fd,_0x39fa00)[_0x6432('0x3b')](function(){return 0x1;});});}}}};Dialer[_0x6432('0x7c')][_0x6432('0xe7')]=function(_0x45ce74){if(this[_0x6432('0x21')][_0x45ce74[_0x6432('0xb7')]]){this[_0x6432('0x21')][_0x45ce74[_0x6432('0xb7')]][_0x6432('0xe8')]=_0x45ce74[_0x6432('0xe8')];}if(this[_0x6432('0x23')][_0x45ce74[_0x6432('0xb7')]]){this[_0x6432('0x23')][_0x45ce74[_0x6432('0xb7')]][_0x6432('0xe8')]=_0x45ce74[_0x6432('0xe8')];}};Dialer['prototype'][_0x6432('0x38')]=function(_0x2eef0c){if(!this['actions'][_0x2eef0c[_0x6432('0xe9')]]){return;}var _0x81d629=this[_0x6432('0x1c')][this[_0x6432('0x21')][_0x2eef0c[_0x6432('0xe9')]][_0x6432('0xb3')]]['strategy']||_0x6432('0xea');if(_0x81d629===_0x6432('0xeb')){if(this[_0x6432('0x21')][_0x2eef0c[_0x6432('0xe9')]]&&_[_0x6432('0xec')](this['actions'][_0x2eef0c['actionid']]['locked'])&&_0x2eef0c[_0x6432('0x80')]==='1'&&_0x2eef0c[_0x6432('0xed')]==='0'){if(this[_0x6432('0x1e')][_0x2eef0c[_0x6432('0xee')]]){if(!this['agents'][_0x2eef0c['stateinterface']][_0x6432('0xef')]){this[_0x6432('0x1e')][_0x2eef0c[_0x6432('0xee')]]['locked']=!![];this[_0x6432('0x21')][_0x2eef0c['actionid']][_0x6432('0xef')]=!![];this[_0x6432('0x21')][_0x2eef0c[_0x6432('0xe9')]][_0x6432('0xee')]=_0x2eef0c[_0x6432('0xee')];}}}}else if(_0x81d629===_0x6432('0xea')){if(this[_0x6432('0x21')][_0x2eef0c[_0x6432('0xe9')]]){if(this[_0x6432('0x1e')][_0x2eef0c[_0x6432('0xee')]]){this['actions'][_0x2eef0c[_0x6432('0xe9')]][_0x6432('0xee')]=_0x2eef0c['stateinterface'];if(_[_0x6432('0xec')](this[_0x6432('0x27')][this[_0x6432('0x21')][_0x2eef0c[_0x6432('0xe9')]][_0x6432('0xb3')]])){this[_0x6432('0x27')][this[_0x6432('0x21')][_0x2eef0c[_0x6432('0xe9')]][_0x6432('0xb3')]]=[];}this[_0x6432('0x27')][this[_0x6432('0x21')][_0x2eef0c[_0x6432('0xe9')]]['queue']][_0x6432('0x91')](_[_0x6432('0x58')](_[_0x6432('0x6d')](this[_0x6432('0x21')][_0x2eef0c[_0x6432('0xe9')]],[_0x6432('0xf0'),_0x6432('0xee')]),{'status':_0x2eef0c[_0x6432('0x80')],'paused':_0x2eef0c[_0x6432('0xed')]}));}}}};Dialer[_0x6432('0x7c')][_0x6432('0xf1')]=function(_0xefae60){if(!this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]]){return;}var _0x6a0b0=this;var _0x1ddb74=this[_0x6432('0x1c')][this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]]['queue']];var _0x5003cb=_0x1ddb74[_0x6432('0xf2')]||'rrmemory';if(_0x5003cb===_0x6432('0xeb')){if(this[_0x6432('0x21')][_0xefae60['actionid']]&&this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]][_0x6432('0xee')]){this[_0x6432('0x1b')][_0x6432('0xf3')](this[_0x6432('0x21')][_0xefae60['actionid']][_0x6432('0xf0')],this[_0x6432('0x21')][_0xefae60['actionid']][_0x6432('0xee')])[_0x6432('0x97')](function(_0x885b34){logger[_0x6432('0x60')](_0x6432('0xf4'),util[_0x6432('0x3e')](_0x885b34,{'showHidden':![],'depth':null}));})[_0x6432('0x19')](function(){_0x6a0b0[_0x6432('0xb6')](_0x6a0b0['voiceQueues'][_0x6a0b0[_0x6432('0x21')][_0xefae60['actionid']][_0x6432('0xb3')]]);_0x6a0b0[_0x6432('0x1e')][_0x6a0b0['actions'][_0xefae60['actionid']][_0x6432('0xee')]][_0x6432('0xef')]=![];delete _0x6a0b0[_0x6432('0x21')][_0xefae60['actionid']];unlockQueueStatus(_0x1ddb74);});}else{this[_0x6432('0xb6')](this[_0x6432('0x1c')][this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]][_0x6432('0xb3')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]]['ContactId'],'ListId':this['actions'][_0xefae60['actionid']]['ListId'],'VoiceQueueId':this['actions'][_0xefae60[_0x6432('0xe9')]][_0x6432('0xe2')]||undefined,'CampaignId':this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]][_0x6432('0xe3')]||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0xf5')));delete this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]];unlockQueueStatus(_0x1ddb74);}}else if(_0x5003cb==='rrmemory'){var _0x20ed1a;if(this[_0x6432('0x21')][_0xefae60['actionid']]&&!_[_0x6432('0x41')](this['queueBooked'][this['actions'][_0xefae60['actionid']][_0x6432('0xb3')]])){if(this[_0x6432('0xf6')][_0x6a0b0[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]]['queue']]){this['queueBookedRR'][_0x6a0b0[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]][_0x6432('0xb3')]]=this[_0x6432('0xf6')][this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]][_0x6432('0xb3')]]?this[_0x6432('0xf6')][this[_0x6432('0x21')][_0xefae60['actionid']]['queue']]:this['queueBooked'][this['actions'][_0xefae60[_0x6432('0xe9')]][_0x6432('0xb3')]]?this[_0x6432('0x27')][this['actions'][_0xefae60[_0x6432('0xe9')]][_0x6432('0xb3')]][_0x6432('0xf7')]||0x0:0x0;}this[_0x6432('0x27')][this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]]['queue']][_0x6432('0xf7')]=this['queueBookedRR'][this[_0x6432('0x21')][_0xefae60[_0x6432('0xe9')]][_0x6432('0xb3')]];for(var _0x23a8cc=0x0;_0x23a8cc=_0x41cb79[_0x6432('0x11b')]){_0x1281c9[_0x6432('0x11c')](_0x11b8df,_0x43a4cc,_0x492aaa,_0x6432('0x11d'));}else{if(_0x11b8df[_0x6432('0x114')]>=_0x41cb79[_0x6432('0x11e')]){_0x1281c9['createStateFinal'](_0x11b8df,_0x43a4cc,_0x492aaa,_0x6432('0x11f'));}else{hopperUtils[_0x6432('0xd2')]({'active':![],'countmachineretry':_0x11b8df[_0x6432('0x114')],'scheduledat':moment()[_0x6432('0xd3')](_0x41cb79[_0x6432('0x120')],_0x6432('0xd4'))[_0x6432('0x81')](_0x6432('0xbd')),'ContactId':_0x11b8df['ContactId'],'ListId':_0x11b8df['ListId'],'VoiceQueueId':_0x11b8df[_0x6432('0xe2')]||undefined,'CampaignId':_0x11b8df[_0x6432('0xe3')]||undefined})['catch'](loggerCatch(_0x6432('0x121')));_0x43a4cc({'reschedule':0x1});}}});}if(_0x51b874[_0x6432('0xb4')]===_0x6432('0xb5')&&this[_0x6432('0x1d')][_0x51b874[_0x6432('0xb3')]]['dialAMDActive']&&_0x5ba254[_0x6432('0x108')]==='HANGUP'){delete this['uniqueId'][_0x5ba254['uniqueid']];this[_0x6432('0xb6')](this['campaigns'][_0x51b874[_0x6432('0xb3')]]);_0x3aeb97=new Hangup(_0x51b874,_0x5ba254);_0x3aeb97['state']=0x12;_0x3aeb97['statedesc']='HangupInAMD';_0x3aeb97[_0x6432('0x122')]=_0x6432('0x10c');ami[_0x6432('0x3c')](_0x6432('0x10d'),ut[_0x6432('0x115')](_0x3aeb97,_0x6432('0x10e')));this['saveInDb'](_0x3aeb97,'[syncHangupInAMDIvr][createHistory]',_0x6432('0x123'));}if(_0x51b874[_0x6432('0xb4')]===_0x6432('0xb5')&&this[_0x6432('0x1d')][_0x51b874['queue']][_0x6432('0x107')]&&_0x5ba254[_0x6432('0x108')]===_0x6432('0x112')){return new Promise(function(_0x3adb42,_0x1ec822){delete _0x1281c9[_0x6432('0x23')][_0x5ba254['uniqueid']];_0x1281c9[_0x6432('0xb6')](_0x1281c9[_0x6432('0x1d')][_0x51b874[_0x6432('0xb3')]]);_0x1281c9[_0x6432('0x1d')][_0x51b874[_0x6432('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x1281c9[_0x6432('0x1d')][_0x51b874[_0x6432('0xb3')]][_0x6432('0x10a')]+=0x1;var _0x5f332b=_0x1281c9[_0x6432('0x1d')][_0x51b874['queue']];var _0x16080c=new Hangup(_0x51b874,_0x5ba254);_0x16080c[_0x6432('0x68')]=0x13;_0x16080c[_0x6432('0x69')]=_0x6432('0x113');_0x16080c[_0x6432('0x122')]=_0x6432('0x10c');_0x16080c[_0x6432('0x114')]+=0x1;_0x16080c[_0x6432('0xdf')]+=0x1;_0x16080c[_0x6432('0x10e')]=!![];ami['emit'](_0x6432('0x10d'),ut['buildObj'](_0x16080c,'amd'));hopperUtils[_0x6432('0xbe')](_0x16080c)['catch'](loggerCatch(_0x6432('0x116')));if(_0x16080c[_0x6432('0x117')]+_0x16080c[_0x6432('0x118')]+_0x16080c['countnoanswerretry']+_0x16080c[_0x6432('0x11a')]+_0x16080c[_0x6432('0xca')]+_0x16080c['countabandonedretry']+_0x16080c[_0x6432('0x114')]+_0x16080c[_0x6432('0x124')]>=_0x5f332b['dialGlobalMaxRetry']){_0x1281c9[_0x6432('0x11c')](_0x16080c,_0x3adb42,_0x1ec822,_0x6432('0x11d'));}else{if(_0x16080c[_0x6432('0x114')]>=_0x5f332b[_0x6432('0x11e')]){_0x1281c9['createStateFinal'](_0x16080c,_0x3adb42,_0x1ec822,_0x6432('0x11f'));}else{hopperUtils[_0x6432('0xd2')]({'active':![],'countmachineretry':_0x16080c[_0x6432('0x114')],'scheduledat':moment()[_0x6432('0xd3')](_0x5f332b[_0x6432('0x120')],_0x6432('0xd4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16080c['ContactId'],'ListId':_0x16080c[_0x6432('0xd6')],'VoiceQueueId':_0x16080c[_0x6432('0xe2')]||undefined,'CampaignId':_0x16080c[_0x6432('0xe3')]||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0x121')));_0x3adb42({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x6432('0x33')]=function(_0x9be09f){var _0x2d2277=this[_0x6432('0x23')][_0x9be09f[_0x6432('0xb7')]];var _0x20262f;if(_0x2d2277&&_0x2d2277['type']===_0x6432('0xb5')){delete this['uniqueId'][_0x9be09f[_0x6432('0xb7')]];this['updateOriginated'](this['campaigns'][_0x2d2277[_0x6432('0xb3')]]);this[_0x6432('0x1d')][_0x2d2277[_0x6432('0xb3')]]['ivrAnswerCallsDay']+=0x1;_0x20262f=new Hangup(_0x2d2277,_0x9be09f);hopperUtils['createHistory'](_0x20262f)[_0x6432('0x97')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x6432('0xc0')](_0x20262f)['catch'](loggerCatch(_0x6432('0x125')));}if(_0x2d2277&&_0x2d2277['type']!==_0x6432('0xb5')&&isNotNull(this[_0x6432('0x1c')][_0x2d2277['queue']][_0x6432('0x126')])){delete this[_0x6432('0x23')][_0x9be09f[_0x6432('0xb7')]];this[_0x6432('0xb6')](this[_0x6432('0x1c')][_0x2d2277[_0x6432('0xb3')]]);this[_0x6432('0x1c')][_0x2d2277[_0x6432('0xb3')]][_0x6432('0xb9')]+=0x1;this[_0x6432('0x1c')][_0x2d2277['queue']][_0x6432('0x10a')]+=0x1;_0x20262f=new Hangup(_0x2d2277,_0x9be09f);_0x20262f[_0x6432('0x68')]=0x10;_0x20262f['statedesc']='AnswerAGI';_0x20262f[_0x6432('0x122')]=_0x6432('0x127');hopperUtils[_0x6432('0xbe')](_0x20262f)[_0x6432('0x97')](loggerCatch(_0x6432('0x128')));hopperUtils['moveContactManagedDialer'](_0x20262f)[_0x6432('0x97')](loggerCatch(_0x6432('0x125')));}if(_0x2d2277&&_0x2d2277[_0x6432('0xb4')]!==_0x6432('0xb5')&&!isNotNull(this[_0x6432('0x1c')][_0x2d2277['queue']][_0x6432('0x126')])){delete this['uniqueId'][_0x9be09f[_0x6432('0xb7')]];this[_0x6432('0xb6')](this[_0x6432('0x1c')][_0x2d2277[_0x6432('0xb3')]]);this[_0x6432('0x1c')][_0x2d2277[_0x6432('0xb3')]][_0x6432('0x129')]+=0x1;_0x20262f=new Hangup(_0x2d2277,_0x9be09f);_0x20262f[_0x6432('0x68')]=0xc;_0x20262f['statedesc']=_0x9be09f[_0x6432('0x12a')];_0x20262f[_0x6432('0x122')]=_0x6432('0x12b');hopperUtils['createHistory'](_0x20262f)[_0x6432('0x97')](loggerCatch(_0x6432('0x128')));hopperUtils[_0x6432('0xc0')](_0x20262f)[_0x6432('0x97')](loggerCatch(_0x6432('0x125')));}};Dialer[_0x6432('0x7c')][_0x6432('0x8')]=function(_0x2ba6b0){var _0x286679=this;if(!_0x286679['queuesSummary'][_0x2ba6b0[_0x6432('0x3f')]]){_0x286679['queuesSummary'][_0x2ba6b0[_0x6432('0x3f')]]={'running':![]};}else if(_0x286679['queuesSummary'][_0x2ba6b0['name']]['running']===!![]){return;}else if(_0x286679[_0x6432('0x28')][_0x2ba6b0[_0x6432('0x3f')]][_0x6432('0x12c')]===![]){_0x286679['queuesSummary'][_0x2ba6b0[_0x6432('0x3f')]]['running']=!![];}var _0x2a8005=_0x286679[_0x6432('0x1c')][_0x2ba6b0[_0x6432('0x3f')]];var _0x414005=_0x2a8005['message']!==utils[_0x6432('0x63')][_0x6432('0x73')];var _0xa3173e=utils[_0x6432('0x12d')](_0x2a8005);_0x2a8005['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x2a8005,_0x286679[_0x6432('0x1f')]);Promise[_0x6432('0x12e')]()['then'](function(){if(_0x2a8005[_0x6432('0x12f')]===utils['CAMPAIGN_STATUS'][_0x6432('0x73')]){if(_0x414005){clearPredictiveAttributes(_0x2a8005);_0x2ba6b0[_0x6432('0x5c')]=undefined;_0x2ba6b0['startProgressive']=undefined;}if(_0x2a8005[_0x6432('0x12f')]===utils['CAMPAIGN_STATUS'][_0x6432('0x73')]){_0x2ba6b0[_0x6432('0x130')]=0x0;_0x2ba6b0[_0x6432('0xed')]=0x0;_0x2ba6b0[_0x6432('0x131')]=0x0;_0x2ba6b0[_0x6432('0x132')]=0x0;_0x2ba6b0[_0x6432('0x133')]=0x0;}}else if(_0x2a8005[_0x6432('0x12f')]===utils[_0x6432('0x63')][_0x6432('0x134')]&&!_0xa3173e){return _0x286679['ifTime'](_0x2a8005,!![])['then'](function(){return _0x286679['ifTime'](_0x2a8005,![]);})[_0x6432('0x3b')](function(){return _0x286679[_0x6432('0xa3')](_0x2a8005);})[_0x6432('0x97')](function(_0x4e7fa7){loggerSyncQueueSummary[_0x6432('0x5a')](_0x6432('0x135'),util[_0x6432('0x3e')](_0x4e7fa7,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2a8005);});}else{clearPredictiveAttributes(_0x2a8005);}})[_0x6432('0x3b')](function(){var _0x21820a=_0x2ba6b0[_0x6432('0x136')](_0x2a8005);if(_0x21820a||_0x2a8005[_0x6432('0x137')]){_0x2a8005[_0x6432('0x137')]=![];_0x2ba6b0[_0x6432('0x138')](_0x2a8005);Object[_0x6432('0x139')](_0x2a8005,_0x2ba6b0);emitOutboundVoiceQueueSummary(_0x2ba6b0);}_0x286679[_0x6432('0x28')][_0x2a8005[_0x6432('0x3f')]]['running']=![];})[_0x6432('0x97')](function(_0x2083fa){logger[_0x6432('0x60')](_0x6432('0x135'),util[_0x6432('0x3e')](_0x2083fa,{'showHidden':![],'depth':null}));_0x286679[_0x6432('0x28')][_0x2a8005[_0x6432('0x3f')]][_0x6432('0x12c')]=![];});};Dialer[_0x6432('0x7c')][_0x6432('0x31')]=_[_0x6432('0x13a')](function(){var _0x4c5c1a=_[_0x6432('0x13b')](this[_0x6432('0x1c')],function(_0x265956){return _0x265956[_0x6432('0x13c')];});var _0x27643d=_[_0x6432('0x13b')](this[_0x6432('0x1e')],function(_0x32e053){return _0x32e053['online']&&_0x32e053[_0x6432('0x80')]===_0x6432('0x13d');});if(_0x4c5c1a[_0x6432('0x90')]>0x0&&_0x27643d[_0x6432('0x90')]>0x0){return Promise['resolve']()[_0x6432('0x3b')](cmHopper[_0x6432('0x13e')](_[_0x6432('0x13f')](_0x4c5c1a,'id'),previewRecallmeReminderInterval,_[_0x6432('0x13f')](_0x27643d,'id')))[_0x6432('0x3b')](function(_0x637543){for(var _0x59c66a=0x0;_0x59c66a<_0x637543[_0x6432('0x90')];_0x59c66a++){var _0x525f25=_0x637543[_0x59c66a][_0x6432('0x140')][_0x6432('0x3f')];if(_0x525f25)io['to'](util['format'](_0x6432('0x141'),_0x525f25))[_0x6432('0x3c')](_0x6432('0x142'),{'hopper':_0x637543[_0x59c66a]});}})[_0x6432('0x97')](function(_0x578622){logger[_0x6432('0x60')](_0x6432('0x143'),_0x578622);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x6432('0x3a')]=function(){var _0xc9be9=this;setInterval(function(){_0xc9be9['clearZombieChannels'](_0xc9be9[_0x6432('0x23')],_0x6432('0x144'));_0xc9be9[_0x6432('0x145')](_0xc9be9[_0x6432('0x21')],_0x6432('0x146'));},0x32c8);};Dialer[_0x6432('0x7c')][_0x6432('0x145')]=function(_0x5de03b,_0x3839e0){var _0x6d156f=this;for(var _0x408dfa in _0x5de03b){if(typeof _0x5de03b[_0x408dfa]!==_0x6432('0x147')){this['sequence'][_0x6432('0x17')](function(){if(!_[_0x6432('0xec')](_0x5de03b[_0x408dfa])){return ami[_0x6432('0x92')]({'action':'status','channel':_0x5de03b[_0x408dfa][_0x6432('0xe8')]})['catch'](function(_0x5199ba){if(_0x5199ba[_0x6432('0x62')]===_0x6432('0x148')){setTimeout(function(){if(_0x5de03b[_0x408dfa]&&_0x5de03b[_0x408dfa][_0x6432('0xb4')]!==_0x6432('0xb5')){_0x6d156f['updateOriginated'](_0x6d156f[_0x6432('0x1c')][_0x5de03b[_0x408dfa]['queue']]);logger[_0x6432('0x60')]('[Dialer][checkChannel]',_0x3839e0,_0x408dfa,_0x5de03b[_0x408dfa][_0x6432('0xb3')]);delete _0x5de03b[_0x408dfa];}if(_0x5de03b[_0x408dfa]&&_0x5de03b[_0x408dfa]['type']===_0x6432('0xb5')){_0x6d156f['updateOriginated'](_0x6d156f[_0x6432('0x1d')][_0x5de03b[_0x408dfa][_0x6432('0xb3')]]);logger[_0x6432('0x60')](_0x6432('0x149'),_0x3839e0,_0x408dfa,_0x5de03b[_0x408dfa][_0x6432('0xb3')]);delete _0x5de03b[_0x408dfa];}},0x2328);}});}});}}};Dialer[_0x6432('0x7c')][_0x6432('0x14a')]=function(_0x59bf8a){return Promise[_0x6432('0x12e')]()[_0x6432('0x3b')](voiceQueueRt[_0x6432('0x14a')](_0x59bf8a))[_0x6432('0x97')](loggerCatch(_0x6432('0x14b')));};Dialer[_0x6432('0x7c')][_0x6432('0xb6')]=function(_0x368a9b){if(!_[_0x6432('0x4e')](_0x368a9b)&&_0x368a9b!==null){if(typeof _0x368a9b[_0x6432('0x14c')]!==_0x6432('0x147')){if(_0x368a9b[_0x6432('0x14c')]>0x0){_0x368a9b[_0x6432('0x14c')]-=0x1;}else{logger[_0x6432('0x60')](_0x6432('0x14d'));}}}else{logger[_0x6432('0x60')](_0x6432('0x14e'));}};Dialer[_0x6432('0x7c')][_0x6432('0x14f')]=function(_0x3779c8,_0x436427){var _0xc00403=this;return function(_0x5505b0){_0xc00403[_0x6432('0xb6')](_0x436427);logger['error'](_0x3779c8,util[_0x6432('0x3e')](_0x5505b0,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x6432('0x150')]=function(_0x238827,_0x2b8cfd,_0x5729a2){var _0x2c9f83={'state':0x19,'statedesc':_0x6432('0x151')};this[_0x6432('0xb6')](_0x2b8cfd);this[_0x6432('0x10f')](_[_0x6432('0x58')](_0x2c9f83,_[_0x6432('0x6d')](_0x5729a2,[_0x6432('0xd5'),_0x6432('0xd6'),_0x6432('0x152'),_0x6432('0xe2'),_0x6432('0xe3')])),_0x6432('0x153'),_0x6432('0x154'));logger[_0x6432('0x60')](_0x238827);};Dialer['prototype'][_0x6432('0x10f')]=function(_0x222c1f,_0x293d19,_0x5c3ee3){hopperUtils[_0x6432('0xbe')](_0x222c1f)[_0x6432('0x97')](loggerCatch(_0x293d19));hopperUtils[_0x6432('0xc0')](_0x222c1f)[_0x6432('0x97')](loggerCatch(_0x5c3ee3));};Dialer[_0x6432('0x7c')]['queueCallerAbandonCreateState']=function(_0x3e8554,_0x17216f){hopperUtils[_0x6432('0xbe')](_0x3e8554)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x17216f==0x0){hopperUtils[_0x6432('0xc0')](_0x3e8554)[_0x6432('0x97')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x6432('0x143')]=function(_0x3d4f78){return Promise['resolve']()[_0x6432('0x3b')](cmHopper['handlePreviewRecallNotifications'](_0x3d4f78['id'],previewRecallmeReminderInterval))['then'](function(_0x225600){for(var _0x492678=0x0;_0x492678<_0x225600[_0x6432('0x90')];_0x492678++){var _0x54d7d3=_0x225600[_0x492678][_0x6432('0x140')][_0x6432('0x3f')];if(_0x54d7d3)io['to'](util[_0x6432('0x81')](_0x6432('0x141'),_0x54d7d3))[_0x6432('0x3c')](_0x6432('0x142'),{'hopper':_0x225600[_0x492678]});}})[_0x6432('0x97')](function(){});};Dialer[_0x6432('0x7c')][_0x6432('0x155')]=function(_0x55ba71){var _0x24a1b9=this;return function(){_0x24a1b9[_0x6432('0x156')](_0x55ba71);};};Dialer[_0x6432('0x7c')][_0x6432('0x157')]=function(_0xdf7ceb,_0x5a1697){var _0x302a25=this;var _0x122ad2=uuid['v4']();this['actions'][_0x122ad2]=new Action(_0xdf7ceb,_0x5a1697,_0x122ad2);return new Promise(function(_0x189eff,_0x2c83f0){if(_[_0x6432('0x4e')](_0xdf7ceb)&&typeof _0xdf7ceb!=='object'){return _0x2c83f0(msgResponse(_0x6432('0x158'),_0x6432('0x88'),_0x6432('0x159')));}if(_[_0x6432('0x4e')](_0x5a1697['phone'])||_0x5a1697[_0x6432('0x15a')]===null){return _0x2c83f0(msgResponse('originate',_0x6432('0x88'),_0x6432('0x15b')));}var _0x54467f={'XMD-CALLERID':_0x302a25['actions'][_0x122ad2]['getCaller'](),'XMD-AGI':_0xdf7ceb[_0x6432('0x126')]?util[_0x6432('0x81')](_0x6432('0x15c'),ipAgi,_0xdf7ceb[_0x6432('0x126')]):'NONE','XMD-AGIAFTER':_0xdf7ceb[_0x6432('0xbc')]?util['format'](_0x6432('0x15c'),ipAgi,_0xdf7ceb['dialQueueProject2']):_0x6432('0x15d'),'XMD-QUEUE':utils['isOutboundQueue'](_0xdf7ceb)?util[_0x6432('0x81')](_0x6432('0x15e'),_0xdf7ceb[_0x6432('0x3f')],_0xdf7ceb[_0x6432('0x15f')]||'',_0xdf7ceb[_0x6432('0x160')]?'c':'',_0xdf7ceb[_0x6432('0xc4')]||0x3):'NONE','XMD-CONTACTID':_0x5a1697[_0x6432('0xd5')],'XMD-CDRTYPE':_0x6432('0x5'),'CALLERID(all)':_0x302a25['actions'][_0x122ad2][_0x6432('0x161')](),'XMD-AMD':_0xdf7ceb[_0x6432('0x107')]?_0x6432('0x134'):_0x6432('0x15d'),'XMD-DESTINATION':_0x6432('0x106')};if(_0xdf7ceb[_0x6432('0x107')]){_0x54467f[_0x6432('0x162')]=_0xdf7ceb['dialAMDInitialSilence']||0x9c4;_0x54467f[_0x6432('0x163')]=_0xdf7ceb[_0x6432('0x164')]||0x5dc;_0x54467f['XMD-AMDAFTERGREETINGSILENCE']=_0xdf7ceb[_0x6432('0x165')]||0x320;_0x54467f[_0x6432('0x166')]=_0xdf7ceb[_0x6432('0x167')]||0x1388;_0x54467f[_0x6432('0x168')]=_0xdf7ceb[_0x6432('0x169')]||0x64;_0x54467f[_0x6432('0x16a')]=_0xdf7ceb[_0x6432('0x16b')]||0x32;_0x54467f[_0x6432('0x16c')]=_0xdf7ceb[_0x6432('0x16d')]||0x3;_0x54467f[_0x6432('0x16e')]=_0xdf7ceb[_0x6432('0x16f')]||0x100;_0x54467f[_0x6432('0x170')]=_0xdf7ceb[_0x6432('0x171')]||0x1388;}if(utils[_0x6432('0x172')](_0xdf7ceb)){_0x54467f[_0x6432('0x173')]=_0x5a1697[_0x6432('0xe2')];}else{_0x54467f[_0x6432('0x174')]=_0x5a1697[_0x6432('0xe3')];}var _0x2594b9=utils[_0x6432('0x175')](_0x5a1697['Contact']);Object[_0x6432('0x139')](_0x54467f,_0x2594b9);var _0x3ffad3=_0x302a25[_0x6432('0x7d')](_0xdf7ceb[_0x6432('0x176')])?utils[_0x6432('0x177')](_0xdf7ceb[_0x6432('0x176')][_0x6432('0x178')],_0xdf7ceb[_0x6432('0x179')],_0xdf7ceb['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x6432('0x17a')](_0xdf7ceb['dialOriginateCallerIdNumber'],_0xdf7ceb[_0x6432('0x17b')]):_0xdf7ceb[_0x6432('0x17c')]):utils[_0x6432('0x177')](_[_0x6432('0xec')](_0xdf7ceb[_0x6432('0x17d')])?_0xdf7ceb[_0x6432('0x176')][_0x6432('0x178')]:_0xdf7ceb[_0x6432('0x17d')][_0x6432('0x178')],_0xdf7ceb[_0x6432('0x179')],_0xdf7ceb[_0x6432('0x17b')]>0x0?utils[_0x6432('0x17a')](_0xdf7ceb[_0x6432('0x17c')],_0xdf7ceb['dialRandomLastDigitCallerIdNumber']):_0xdf7ceb[_0x6432('0x17c')]);if(_0x3ffad3){_0x54467f[_0x6432('0x17e')]=_0x302a25['actions'][_0x122ad2][_0x6432('0x17f')]=utils[_0x6432('0x180')](_0x3ffad3);_0x54467f[_0x6432('0x181')]=_0x5a1697[_0x6432('0x15a')];}_0xdf7ceb[_0x6432('0x182')]=_0x54467f;return ami[_0x6432('0x92')]({'actionid':_0x122ad2,'action':_0x6432('0x158'),'channel':_0x302a25[_0x6432('0x7d')](_0xdf7ceb[_0x6432('0x176')])?util[_0x6432('0x81')](_0x6432('0x183'),_0xdf7ceb[_0x6432('0x176')]['name'],isNotNull(_0xdf7ceb[_0x6432('0x184')])?_0xdf7ceb[_0x6432('0x184')][_0x6432('0x185')]()||'':'',_0xdf7ceb[_0x6432('0x186')]>0x0?_0x5a1697[_0x6432('0x15a')][_0x6432('0x187')](_0xdf7ceb[_0x6432('0x186')]):_0x5a1697[_0x6432('0x15a')]):util[_0x6432('0x81')](_0x6432('0x183'),_['isNil'](_0xdf7ceb[_0x6432('0x17d')])?_0xdf7ceb[_0x6432('0x176')][_0x6432('0x3f')]:_0xdf7ceb['TrunkBackup'][_0x6432('0x3f')],isNotNull(_0xdf7ceb[_0x6432('0x184')])?_0xdf7ceb['dialPrefix'][_0x6432('0x185')]()||'':'',_0xdf7ceb[_0x6432('0x186')]>0x0?_0x5a1697['phone']['substring'](_0xdf7ceb['dialCutDigit']):_0x5a1697[_0x6432('0x15a')]),'callerid':_0x3ffad3,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x54467f,'timeout':(_0xdf7ceb['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x122ad2})[_0x6432('0x3b')](function(_0xdc4d30){return _0x189eff(_0xdc4d30);})[_0x6432('0x97')](function(_0x136df5){_0xdf7ceb[_0x6432('0x188')]+=0x1;var _0x376f7a=new History(_0x302a25[_0x6432('0x21')][_0x122ad2]);logger[_0x6432('0x60')](util[_0x6432('0x81')](_0x6432('0x189'),JSON['stringify'](_0x136df5)));_0x376f7a['state']=0xe;_0x376f7a['statedesc']=_0x6432('0x18a');_0x376f7a[_0x6432('0x6a')]=moment()[_0x6432('0x81')](_0x6432('0xbd'));_0x376f7a['endtime']=_0x376f7a['starttime'];hopperUtils['createHistory'](_0x376f7a)[_0x6432('0x97')](loggerCatch(_0x6432('0x18b')));_0x302a25[_0x6432('0xc0')](_0x376f7a)[_0x6432('0x97')](loggerCatch(_0x6432('0x18b')))[_0x6432('0x19')](function(){delete _0x302a25['actions'][_0x122ad2];return _0x2c83f0(msgResponse(_0x6432('0x158'),_0x6432('0x18c'),'originate\x20action\x20Error'));});});});};Dialer[_0x6432('0x7c')][_0x6432('0x18d')]=function(_0x26622c,_0x31448a,_0x12b3ca){var _0x3046d4=new History(_0x31448a);if(_0x3046d4['countbusyretry']+_0x3046d4[_0x6432('0x118')]+_0x3046d4[_0x6432('0x119')]+_0x3046d4[_0x6432('0x11a')]+_0x3046d4[_0x6432('0xca')]+_0x3046d4[_0x6432('0xde')]+_0x3046d4[_0x6432('0x114')]+_0x3046d4[_0x6432('0x124')]>=_0x12b3ca[_0x6432('0x11b')]-0x1){return!![];}switch(_0x26622c){case 0x3:if(_0x3046d4[_0x6432('0x119')]>=_0x12b3ca[_0x6432('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3046d4[_0x6432('0x119')]+=0x1,'scheduledat':moment()['add'](_0x12b3ca[_0x6432('0x18f')],_0x6432('0xd4'))['format'](_0x6432('0xbd')),'ContactId':_0x3046d4['ContactId'],'ListId':_0x3046d4[_0x6432('0xd6')],'VoiceQueueId':_0x3046d4[_0x6432('0xe2')]||undefined,'CampaignId':_0x3046d4[_0x6432('0xe3')]||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0x190')));break;case 0x5:if(_0x3046d4[_0x6432('0x117')]>=_0x12b3ca[_0x6432('0x191')]-0x1){return!![];}hopperUtils[_0x6432('0xd2')]({'active':![],'countbusyretry':_0x3046d4[_0x6432('0x117')]+=0x1,'scheduledat':moment()[_0x6432('0xd3')](_0x12b3ca['dialBusyRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3046d4[_0x6432('0xd5')],'ListId':_0x3046d4[_0x6432('0xd6')],'VoiceQueueId':_0x3046d4[_0x6432('0xe2')]||undefined,'CampaignId':_0x3046d4[_0x6432('0xe3')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x3046d4[_0x6432('0x118')]>=_0x12b3ca[_0x6432('0x192')]-0x1){return!![];}hopperUtils[_0x6432('0xd2')]({'active':![],'countcongestionretry':_0x3046d4[_0x6432('0x118')]+=0x1,'scheduledat':moment()[_0x6432('0xd3')](_0x12b3ca[_0x6432('0x193')],_0x6432('0xd4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3046d4[_0x6432('0xd5')],'ListId':_0x3046d4[_0x6432('0xd6')],'VoiceQueueId':_0x3046d4[_0x6432('0xe2')]||undefined,'CampaignId':_0x3046d4['CampaignId']||undefined})[_0x6432('0x97')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x3046d4[_0x6432('0x11a')]>=_0x12b3ca[_0x6432('0x194')]-0x1){return!![];}else{hopperUtils[_0x6432('0xd2')]({'active':![],'countnosuchnumberretry':_0x3046d4[_0x6432('0x11a')]+=0x1,'scheduledat':moment()[_0x6432('0xd3')](_0x12b3ca[_0x6432('0x195')],'minutes')[_0x6432('0x81')](_0x6432('0xbd')),'ContactId':_0x3046d4[_0x6432('0xd5')],'ListId':_0x3046d4[_0x6432('0xd6')],'VoiceQueueId':_0x3046d4[_0x6432('0xe2')]||undefined,'CampaignId':_0x3046d4[_0x6432('0xe3')]||undefined})[_0x6432('0x97')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3046d4[_0x6432('0xca')]>=_0x12b3ca[_0x6432('0xd0')]-0x1){return!![];}hopperUtils[_0x6432('0xd2')]({'active':![],'countdropretry':_0x3046d4[_0x6432('0xca')]+=0x1,'scheduledat':moment()[_0x6432('0xd3')](_0x12b3ca[_0x6432('0xcb')],'minutes')['format'](_0x6432('0xbd')),'ContactId':_0x3046d4[_0x6432('0xd5')],'ListId':_0x3046d4[_0x6432('0xd6')],'VoiceQueueId':_0x3046d4[_0x6432('0xe2')]||undefined,'CampaignId':_0x3046d4[_0x6432('0xe3')]||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0xd7')));break;case 0xb:if(_0x3046d4['countabandonedretry']>=_0x12b3ca[_0x6432('0xe1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3046d4['countabandonedretry']+=0x1,'scheduledat':moment()[_0x6432('0xd3')](_0x12b3ca[_0x6432('0xe0')],_0x6432('0xd4'))[_0x6432('0x81')](_0x6432('0xbd')),'ContactId':_0x3046d4['ContactId'],'ListId':_0x3046d4[_0x6432('0xd6')],'VoiceQueueId':_0x3046d4[_0x6432('0xe2')]||undefined,'CampaignId':_0x3046d4['CampaignId']||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0x196')));break;case 0x13:if(_0x3046d4[_0x6432('0x114')]>=_0x12b3ca[_0x6432('0x11e')]-0x1){return!![];}hopperUtils[_0x6432('0xd2')]({'active':![],'countmachineretry':_0x3046d4[_0x6432('0x114')]+=0x1,'scheduledat':moment()['add'](_0x12b3ca['dialMachineRetryFrequency'],_0x6432('0xd4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3046d4[_0x6432('0xd5')],'ListId':_0x3046d4[_0x6432('0xd6')],'VoiceQueueId':_0x3046d4[_0x6432('0xe2')]||undefined,'CampaignId':_0x3046d4['CampaignId']||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0x121')));break;case 0x14:if(_0x3046d4[_0x6432('0x124')]>=_0x12b3ca[_0x6432('0x197')]-0x1){return!![];}hopperUtils[_0x6432('0xd2')]({'active':![],'countagentrejectretry':_0x3046d4['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x6432('0xd3')](_0x12b3ca['dialAgentRejectRetryFrequency'],_0x6432('0xd4'))[_0x6432('0x81')](_0x6432('0xbd')),'ContactId':_0x3046d4[_0x6432('0xd5')],'ListId':_0x3046d4['ListId'],'VoiceQueueId':_0x3046d4[_0x6432('0xe2')]||undefined,'CampaignId':_0x3046d4[_0x6432('0xe3')]||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0x198')));break;default:return!![];}};Dialer[_0x6432('0x7c')][_0x6432('0x102')]=function(_0xe0657e,_0x351fa6,_0x48e4e5){var _0x11ff5f=this;var _0x3d2262=new History(_0xe0657e);var _0x99343f=![];var _0x45912b;var _0x448580;return new Promise(function(_0x535f14,_0xad85e4){if(_[_0x6432('0x4e')](_0x351fa6)&&typeof _0x351fa6!==_0x6432('0x199')){return _0xad85e4(msgResponse('[callProgressDetecting]',_0x6432('0x88'),_0x6432('0x19a')));}if(_[_0x6432('0x4e')](_0x48e4e5)&&typeof _0x48e4e5!==_0x6432('0x199')){return _0xad85e4(msgResponse(_0x6432('0x19b'),_0x6432('0x88'),'evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x3d2262,_0x48e4e5['reason'],_0x351fa6)[_0x6432('0x3b')](function(_0x2646c8){if(_0x2646c8[_0x6432('0xcf')]==0x1)_0x99343f=!![];switch(_0x48e4e5[_0x6432('0xba')]){case'0':_0x351fa6[_0x6432('0x19c')]+=0x1;_0x3d2262[_0x6432('0x68')]=0x0;_0x3d2262[_0x6432('0x69')]=_0x6432('0x19d');_0x3d2262['countnosuchnumberretry']+=0x1;_0x3d2262[_0x6432('0xdf')]+=0x1;ami[_0x6432('0x3c')](_0x6432('0x19e'),ut[_0x6432('0x115')](_0xe0657e,_0x6432('0x19f')));_0x45912b=_0x351fa6['dialNoSuchNumberRetryFrequency'];_0x448580=_0x351fa6['callAdditionalPhoneAfterMin'];hopperUtils[_0x6432('0xbe')](_0x3d2262)['catch'](loggerCatch(_0x6432('0x116')));if(_0x11ff5f[_0x6432('0x18d')](0x0,_0xe0657e,_0x351fa6)&&!_0x99343f){if(_0x3d2262['countnosuchnumberretry']>=_0x351fa6[_0x6432('0x194')]){_0x11ff5f[_0x6432('0x1a0')](_0x3d2262,_0x535f14,_0xad85e4,_0x6432('0x1a1'));}else{_0x11ff5f[_0x6432('0x11c')](_0x3d2262,_0x535f14,_0xad85e4,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x351fa6['outboundNoAnswerCallsDay']+=0x1;_0x3d2262['state']=0x3;_0x3d2262[_0x6432('0x69')]='NoAnswer';_0x3d2262[_0x6432('0x119')]+=0x1;_0x3d2262[_0x6432('0xdf')]+=0x1;var _0x5da5f1=ut[_0x6432('0x1a2')](_0xe0657e,_0x351fa6);ami[_0x6432('0x3c')](_0x6432('0x1a3'),_0x5da5f1);_0x45912b=_0x351fa6[_0x6432('0x18f')];_0x448580=_0x351fa6['callAdditionalPhoneAfterMin'];hopperUtils[_0x6432('0xbe')](_0x3d2262)[_0x6432('0x97')](loggerCatch(_0x6432('0x1a4')));if(_0x11ff5f[_0x6432('0x18d')](0x3,_0xe0657e,_0x351fa6)&&!_0x99343f){if(_0x3d2262[_0x6432('0x119')]>=_0x351fa6[_0x6432('0x18e')]){_0x11ff5f[_0x6432('0x1a0')](_0x3d2262,_0x535f14,_0xad85e4,_0x6432('0x1a5'));}else{_0x11ff5f['stateGlobal'](_0x3d2262,_0x535f14,_0xad85e4,_0x6432('0x1a5'));}}break;case'5':_0x351fa6[_0x6432('0x1a6')]+=0x1;_0x3d2262[_0x6432('0x68')]=0x5;_0x3d2262[_0x6432('0x69')]=_0x6432('0x1a7');_0x3d2262[_0x6432('0x117')]+=0x1;_0x3d2262[_0x6432('0xdf')]+=0x1;ami['emit'](_0x6432('0x1a8'),ut['buildObj'](_0xe0657e,_0x6432('0x1a9')));_0x45912b=_0x351fa6['dialBusyRetryFrequency'];_0x448580=_0x351fa6[_0x6432('0xcc')];hopperUtils[_0x6432('0xbe')](_0x3d2262)[_0x6432('0x97')](loggerCatch(_0x6432('0x1aa')));if(_0x11ff5f[_0x6432('0x18d')](0x5,_0xe0657e,_0x351fa6)&&!_0x99343f){if(_0x3d2262[_0x6432('0x117')]>=_0x351fa6[_0x6432('0x191')]){_0x11ff5f[_0x6432('0x1a0')](_0x3d2262,_0x535f14,_0xad85e4,_0x6432('0x1ab'));}else{_0x11ff5f[_0x6432('0x11c')](_0x3d2262,_0x535f14,_0xad85e4,'reason\x205\x20busy');}}break;case'8':_0x351fa6[_0x6432('0x1ac')]+=0x1;_0x3d2262['state']=0x8;_0x3d2262['statedesc']='Congestion';_0x3d2262['countcongestionretry']+=0x1;_0x3d2262['countglobal']+=0x1;_0x45912b=_0x351fa6[_0x6432('0x193')];_0x448580=_0x351fa6['callAdditionalPhoneAfterMin'];ami[_0x6432('0x3c')](_0x6432('0x1ad'),ut[_0x6432('0x115')](_0xe0657e,_0x6432('0x1ae')));hopperUtils[_0x6432('0xbe')](_0x3d2262)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x11ff5f[_0x6432('0x18d')](0x8,_0xe0657e,_0x351fa6)&&!_0x99343f){if(_0x3d2262['countcongestionretry']>=_0x351fa6[_0x6432('0x192')]){_0x11ff5f[_0x6432('0x1a0')](_0x3d2262,_0x535f14,_0xad85e4,_0x6432('0x1af'));}else{_0x11ff5f[_0x6432('0x11c')](_0x3d2262,_0x535f14,_0xad85e4,'reason\x208\x20congestion');}}break;case'11':_0x351fa6[_0x6432('0x1b0')]+=0x1;_0x3d2262[_0x6432('0x68')]=0xb;_0x3d2262[_0x6432('0x69')]=_0x6432('0xe4');_0x3d2262[_0x6432('0xde')]+=0x1;_0x3d2262[_0x6432('0xdf')]+=0x1;_0x45912b=_0x351fa6[_0x6432('0xe0')];_0x448580=_0x351fa6[_0x6432('0xcc')];hopperUtils[_0x6432('0xbe')](_0x3d2262)[_0x6432('0x97')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x11ff5f[_0x6432('0x18d')](0xb,_0xe0657e,_0x351fa6)&&!_0x99343f){if(_0x3d2262['countabandonedretry']>=_0x351fa6['dialAbandonedMaxRetry']){_0x11ff5f[_0x6432('0x1a0')](_0x3d2262,_0x535f14,_0xad85e4,'reason\x2011\x20abandoned');}else{_0x11ff5f[_0x6432('0x11c')](_0x3d2262,_0x535f14,_0xad85e4,_0x6432('0x1b1'));}}break;case'20':_0x351fa6[_0x6432('0x1b2')]+=0x1;_0x3d2262[_0x6432('0x68')]=0x14;_0x3d2262[_0x6432('0x69')]=_0x6432('0x1b3');_0x3d2262[_0x6432('0x124')]+=0x1;_0x3d2262['countglobal']+=0x1;_0x45912b=_0x351fa6[_0x6432('0x1b4')];_0x448580=_0x351fa6[_0x6432('0xcc')];ami[_0x6432('0x3c')]('custom:agentreject',ut[_0x6432('0x115')](_0xe0657e,'agentreject'));hopperUtils[_0x6432('0xbe')](_0x3d2262)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x11ff5f[_0x6432('0x18d')](0x14,_0xe0657e,_0x351fa6)&&!_0x99343f){if(_0x3d2262['countagentrejectretry']>=_0x351fa6['dialAgentRejectMaxRetry']){_0x11ff5f[_0x6432('0x1a0')](_0x3d2262,_0x535f14,_0xad85e4,_0x6432('0x1b5'));}else{_0x11ff5f[_0x6432('0x11c')](_0x3d2262,_0x535f14,_0xad85e4,_0x6432('0x1b5'));}}break;default:_0x351fa6[_0x6432('0x129')]+=0x1;_0x3d2262[_0x6432('0x68')]=0xc;_0x3d2262[_0x6432('0x69')]=_0x48e4e5['reason'];_0x45912b=_0x351fa6[_0x6432('0x1b4')];_0x448580=_0x351fa6[_0x6432('0xcc')];hopperUtils['createHistory'](_0x3d2262)[_0x6432('0x97')](loggerCatch(_0x6432('0x1b6')));if(_0x11ff5f[_0x6432('0x18d')](_0x48e4e5[_0x6432('0xba')],_0xe0657e,_0x351fa6)&&!_0x99343f){if(_0x3d2262[_0x6432('0x117')]+_0x3d2262[_0x6432('0x118')]+_0x3d2262[_0x6432('0x119')]+_0x3d2262[_0x6432('0x11a')]+_0x3d2262['countdropretry']+_0x3d2262[_0x6432('0xde')]+_0x3d2262[_0x6432('0x114')]+_0x3d2262[_0x6432('0x124')]>=_0x351fa6[_0x6432('0x11b')]){_0x11ff5f[_0x6432('0x11c')](_0x3d2262,_0x535f14,_0xad85e4,_0x48e4e5[_0x6432('0xba')]);}else{_0x11ff5f[_0x6432('0x1a0')](_0x3d2262,_0x535f14,_0xad85e4,_0x48e4e5[_0x6432('0xba')]);}}}})[_0x6432('0x3b')](function(){if(_0x99343f){hopperUtils[_0x6432('0xda')](_0x3d2262,_0x45912b,_0x448580)['then'](function(){return _0x535f14(0x1);});}});});};Dialer[_0x6432('0x7c')]['stateGlobal']=function(_0x276e94,_0x3230c7,_0x50c5c3,_0x583b55){var _0x1680bb=new Final(_0x276e94);_0x1680bb[_0x6432('0x68')]=0xf;_0x1680bb[_0x6432('0x69')]='Global';this[_0x6432('0x1a0')](_0x1680bb,_0x3230c7,_0x50c5c3,_0x583b55);};Dialer[_0x6432('0x7c')][_0x6432('0x1a0')]=function(_0x3b8a61,_0x2ca07d,_0xf643ac,_0x423644){hopperUtils[_0x6432('0xc0')](_0x3b8a61)[_0x6432('0x3b')](function(){return _0x2ca07d(msgResponse(_0x6432('0x19b'),'Success',_0x423644));})[_0x6432('0x97')](function(){return _0xf643ac(msgResponse(_0x6432('0x1b7'),_0x6432('0x88'),'contact\x20not\x20moved'));});};Dialer[_0x6432('0x7c')][_0x6432('0x6')]=function(_0x776725){var _0x35012a=_0x776725[_0x6432('0x1b8')]/0x64;var _0x3dddd8=_0x776725['outboundDropCallsDayTimeout']/(_0x776725[_0x6432('0xc5')]+_0x776725['outboundAnswerCallsDay']);var _0x10acb8=Math[_0x6432('0x1b9')](_0x776725[_0x6432('0x1ba')]*(_0x776725[_0x6432('0x1bb')]/0x64));var _0x2c2061=Math[_0x6432('0x1b9')](_0x776725[_0x6432('0x1ba')]*(_0x776725[_0x6432('0x1bc')]/0x64));var _0x515395=_0x776725[_0x6432('0x130')]+_0x776725[_0x6432('0x132')];var _0x1f39ea=Math[_0x6432('0x1bd')](_0x776725['erlangCalls']*_0x776725[_0x6432('0x56')]*_0x776725[_0x6432('0x1be')]*_0x776725[_0x6432('0x1bf')]);if(_[_0x6432('0x4e')](_0x776725[_0x6432('0x25')])){if(!_[_0x6432('0x4e')](_0x776725['startPredictive'])){_0x776725[_0x6432('0x5c')]=undefined;loggerPredictive[_0x6432('0x60')]('[startMethodPredictive][StartProgressive]',_0x6432('0x1c0'));}if(!_[_0x6432('0x4e')](_0x776725[_0x6432('0x5e')])){loggerPredictive[_0x6432('0x60')](_0x6432('0x1c1'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x776725[_0x6432('0x5e')]);_0x776725[_0x6432('0x5e')]=undefined;}_0x776725[_0x6432('0x25')]=moment()[_0x6432('0x81')](_0x6432('0xbd'));loggerPredictive['info'](_0x776725[_0x6432('0x3f')],_0x6432('0x1c2'),_0x776725[_0x6432('0x25')]);this[_0x6432('0xa5')](_0x776725,0x1);}else if(ifInterval(_0x776725['dialPredictiveInterval'],_0x776725[_0x6432('0x25')])){this['handlePower'](_0x776725,0x1);loggerPredictiveCalls[_0x6432('0x45')]('[startMethodPredictive][StartProgressive][Loop]',_0x776725[_0x6432('0x25')],_0x776725[_0x6432('0x3f')]);_0x776725[_0x6432('0x53')]=0x0;_0x776725[_0x6432('0x1c3')]=0x0;}else if(_0x35012a<_0x3dddd8&&_0x776725[_0x6432('0x1c4')]===_0x6432('0x1c5')){clearPredictiveAttributes(_0x776725);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x3dddd8,'startProgressive',_0x776725[_0x6432('0x3f')]);}else if(_0x1f39ea<_0x776725[_0x6432('0x1c3')]&&_0x776725[_0x6432('0x1c4')]===_0x6432('0x1c5')){clearPredictiveAttributes(_0x776725);loggerPredictive['info'](_0x6432('0x1c6'),_0x6432('0x1c7'),_0x1f39ea,_0x6432('0x1c8'),_0x776725['predictiveIntervalErlangCallsDroppedCalls'],_0x6432('0x25'),_0x776725[_0x6432('0x3f')]);}else if(!ifInterval(_0x776725[_0x6432('0x1c9')],_0x776725[_0x6432('0x25')])&&_[_0x6432('0x4e')](_0x776725[_0x6432('0x5c')])&&!_[_0x6432('0x4e')](_0x776725[_0x6432('0x25')])){_0x776725[_0x6432('0x5c')]=moment()['format'](_0x6432('0xbd'));loggerPredictive[_0x6432('0x45')](_0x776725[_0x6432('0x3f')],'started\x20in\x20predictive\x20at',_0x776725[_0x6432('0x5c')]);hopperUtils[_0x6432('0x1ca')](_0x776725[_0x6432('0x1c9')])['then'](this[_0x6432('0x1cb')](_0x776725))[_0x6432('0x3b')](mergeDataErlangB(_0x776725))['then'](this[_0x6432('0x1cc')](_0x776725))[_0x6432('0x97')](loggerCatchPredictive(_0x6432('0x1cd'),_0x776725));}else if(!ifInterval(_0x776725[_0x6432('0x1c9')],_0x776725[_0x6432('0x5c')])){_0x776725[_0x6432('0x1c3')]=0x0;_0x776725[_0x6432('0x5c')]=moment()[_0x6432('0x81')](_0x6432('0xbd'));loggerPredictive['info'](_0x776725[_0x6432('0x3f')],_0x6432('0x1ce'),_0x776725[_0x6432('0x5c')]);clearInterval(_0x776725['handlePredictive']);_0x776725['handlePredictive']=undefined;hopperUtils[_0x6432('0x1ca')](_0x776725[_0x6432('0x1c9')])[_0x6432('0x3b')](this[_0x6432('0x1cb')](_0x776725))[_0x6432('0x3b')](mergeDataErlangB(_0x776725))[_0x6432('0x3b')](this[_0x6432('0x1cc')](_0x776725))[_0x6432('0x97')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x776725));}else if(_0x776725['predictiveIntervalAvailable']&&_0x515395<_0x776725['predictiveIntervalAvailable']-_0x2c2061){clearPredictiveAttributes(_0x776725);loggerPredictive['info'](_0x776725[_0x6432('0x3f')],_0x6432('0x1cf'),_0x515395,')\x20are\x20less\x20than\x20threshold\x20(',_0x776725[_0x6432('0x1ba')],'-',_0x2c2061,'=',_0x776725[_0x6432('0x1ba')]-_0x2c2061,')');}else if(_0x776725[_0x6432('0x1ba')]&&_0x515395>_0x776725[_0x6432('0x1ba')]+_0x10acb8){clearPredictiveAttributes(_0x776725);loggerPredictive[_0x6432('0x45')](_0x776725[_0x6432('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x515395,')\x20are\x20more\x20than\x20threshold\x20(',_0x776725[_0x6432('0x1ba')],'+',_0x10acb8,'=',_0x776725[_0x6432('0x1ba')]+_0x10acb8,')');}};Dialer[_0x6432('0x7c')]['getDataPredictive']=function(_0x5a7bbe){var _0x10354b=this;return function(_0x411d52){return new Promise(function(_0x168d08,_0x5b909a){_['merge'](_0x5a7bbe,_0x411d52[0x0]);if(checkGetDataPredictive(_0x411d52[0x0])){var _0x408f5d=_0x5a7bbe[_0x6432('0x1ba')]=_0x5a7bbe[_0x6432('0x132')]+_0x5a7bbe[_0x6432('0x130')];var _0x534597=_0x5a7bbe['dialPredictiveInterval']*0x3c;var _0x3e2e45=_0x411d52[0x0][_0x6432('0x4c')]+_0x411d52[0x0][_0x6432('0x4a')];var _0x2169ff=(_0x411d52[0x0][_0x6432('0x1d0')]+_0x411d52[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x411d52[0x0][_0x6432('0xdb')])/_0x411d52[0x0]['predictiveIntervalTotalCalls'];_0x5a7bbe[_0x6432('0x1be')]=_0x2169ff>0x0?_0x2169ff:0x1;switch(_0x5a7bbe['dialPredictiveOptimization']){case _0x6432('0x1c5'):var _0x45f8d0=_0x5a7bbe[_0x6432('0x1b8')]/0x64;return _0x10354b['abandonmentRate'](_0x408f5d,_0x534597,_0x3e2e45,_0x2169ff,_0x45f8d0)[_0x6432('0x3b')](function(_0x26b67b){return _0x168d08(_0x26b67b);});case'agentBusyFactor':var _0x47462a=_0x5a7bbe['dialPredictiveOptimizationPercentage']/0x64;return _0x10354b['busyFactor'](_0x408f5d,_0x534597,_0x3e2e45,_0x2169ff,_0x47462a)[_0x6432('0x3b')](function(_0x4c80cc){return _0x168d08(_0x4c80cc);});default:return _0x5b909a(msgResponse(_0x6432('0x1d1'),_0x6432('0x88'),_0x6432('0x1d2')));}}else{return _0x5b909a(msgResponse(_0x6432('0x1d1'),'Failure',_0x6432('0x1d3')));}});};};Dialer[_0x6432('0x7c')][_0x6432('0x1d4')]=function(_0x1b2d53){var _0x53bfa7=this;return function(_0x3854b1){return new Promise(function(_0x4b5532,_0x29d26e){_['merge'](_0x1b2d53,_0x3854b1[0x0]);if(checkGetDataPredictive(_0x3854b1[0x0])){loggerPredictive['info'](JSON[_0x6432('0x6c')](_0x3854b1[0x0]));if(_0x1b2d53[_0x6432('0x1c4')]===_0x6432('0x1c5')){return _0x53bfa7[_0x6432('0x14a')](_0x1b2d53['id'])[_0x6432('0x3b')](function(_0x50827b){var _0x2c7db8=_0x1b2d53['loggedIn']-_0x50827b[0x0][_0x6432('0x1d5')];var _0x2de584=_0x1b2d53['dialPredictiveInterval']*0x3c;var _0x14e03f=_0x3854b1[0x0][_0x6432('0x4c')]+_0x3854b1[0x0][_0x6432('0x4a')];var _0x5738cf=(_0x3854b1[0x0]['predictiveIntervalAnsweredCalls']+_0x3854b1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3854b1[0x0][_0x6432('0xdb')])/_0x3854b1[0x0][_0x6432('0x44')];var _0x26aa1a=_0x1b2d53[_0x6432('0x1b8')]/0x64;_0x1b2d53[_0x6432('0x1d6')]=_0x50827b[0x0][_0x6432('0x1d5')]||0x0;_0x1b2d53[_0x6432('0x1be')]=_0x5738cf>0x0?_0x5738cf:0x1;return _0x53bfa7[_0x6432('0x1d7')](_0x2c7db8,_0x2de584,_0x14e03f,_0x5738cf,_0x26aa1a);})[_0x6432('0x3b')](function(_0x4484d0){return _0x4b5532(_0x4484d0);})[_0x6432('0x97')](function(_0xbc6f7){return _0x29d26e(msgResponse(_0x6432('0x1d8'),_0x6432('0x88'),JSON[_0x6432('0x6c')](_0xbc6f7)));});}if(_0x1b2d53[_0x6432('0x1c4')]===_0x6432('0x1d9')){return _0x53bfa7['getVoiceQueueRtPauses'](_0x1b2d53['id'])[_0x6432('0x3b')](function(_0xf790c8){var _0x2a3c59=_0x1b2d53['loggedIn']-_0xf790c8[0x0][_0x6432('0x1d5')];var _0x1af00c=_0x1b2d53['dialPredictiveInterval']*0x3c;var _0x45eede=_0x3854b1[0x0][_0x6432('0x4c')]+_0x3854b1[0x0][_0x6432('0x4a')];var _0x1750d4=(_0x3854b1[0x0][_0x6432('0x1d0')]+_0x3854b1[0x0][_0x6432('0x47')]+_0x3854b1[0x0][_0x6432('0xdb')])/_0x3854b1[0x0][_0x6432('0x44')];var _0x206ad9=_0x1b2d53['dialPredictiveOptimizationPercentage']/0x64;_0x1b2d53[_0x6432('0x1d6')]=_0xf790c8[0x0]['outboundQueuePauses']||0x0;_0x1b2d53['predictiveIntervalHitRate']=_0x1750d4>0x0?_0x1750d4:0x1;return _0x53bfa7[_0x6432('0x1da')](_0x2a3c59,_0x1af00c,_0x45eede,_0x1750d4,_0x206ad9);})[_0x6432('0x3b')](function(_0x776444){return _0x4b5532(_0x776444);})['catch'](function(_0x56b6fd){return _0x29d26e(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x56b6fd)));});}}else{return _0x29d26e(msgResponse(_0x6432('0x1d1'),'Failure',_0x6432('0x1d3')));}});};};Dialer['prototype'][_0x6432('0x1cc')]=function(_0x54ed2c){var _0x42247e=this;return function(){var _0x2a6c9a=0x0;var _0x5b4458=Math[_0x6432('0x1bd')](_0x54ed2c[_0x6432('0x54')]*0x3e8);if(_0x5b4458>0x0){_0x5b4458=_0x5b4458<0x64?0x64:_0x5b4458;loggerPredictive['info'](_0x54ed2c[_0x6432('0x3f')],_0x6432('0x1db'),_0x5b4458,_0x6432('0x1dc'));_0x54ed2c[_0x6432('0x5e')]=setInterval(function(){_0x42247e['handlePredictive'](_0x54ed2c);loggerPredictiveCalls[_0x6432('0x45')](_0x6432('0x1dd'),_0x2a6c9a+=0x1);},_0x5b4458);}else{loggerPredictive[_0x6432('0x45')](_0x54ed2c[_0x6432('0x3f')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x6432('0x7c')]['checkContactBlack']=function(_0xdbf34d,_0x1f7f26){var _0x44ecf2=this;return function(_0x3a9a6a){if(_['isEmpty'](_0x3a9a6a)){if(_['isNil'](_0x1f7f26[_0x6432('0x152')])||!_0x1f7f26['recallme']){if(_0xdbf34d[_0x6432('0xa4')]==='booked'){_0xdbf34d['queueStatusComplete']=_[_0x6432('0x4e')](_0xdbf34d[_0x6432('0x6b')])?!![]:_0xdbf34d[_0x6432('0x6b')];var _0x5acc60=uuid['v4']();_0x44ecf2[_0x6432('0x21')][_0x5acc60]=new Action(_0xdbf34d,_0x1f7f26,_0x5acc60);loggerBooked[_0x6432('0x45')](_0x6432('0x1de'),_0x5acc60,_0x6432('0x1df'),JSON[_0x6432('0x6c')](_0xdbf34d['queueStatusComplete']),_0x6432('0x1e0'),_0xdbf34d[_0x6432('0x3f')]);if(_0xdbf34d[_0x6432('0x6b')]){_0xdbf34d['queueStatusComplete']=![];_0x44ecf2[_0x6432('0x27')][_0x44ecf2[_0x6432('0x21')][_0x5acc60]['queue']]=[];ami[_0x6432('0x92')]({'actionid':_0x5acc60,'action':_0x6432('0x1e1'),'queue':_0xdbf34d['name']})[_0x6432('0x97')](function(){_0x44ecf2[_0x6432('0xb6')](_0xdbf34d);hopperUtils[_0x6432('0xd2')]({'active':![],'ContactId':_0x44ecf2[_0x6432('0x21')][_0x5acc60][_0x6432('0xd5')],'ListId':_0x44ecf2[_0x6432('0x21')][_0x5acc60][_0x6432('0xd6')],'VoiceQueueId':_0x44ecf2[_0x6432('0x21')][_0x5acc60][_0x6432('0xe2')]||undefined,'CampaignId':_0x44ecf2[_0x6432('0x21')][_0x5acc60][_0x6432('0xe3')]||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0x1e2')));delete _0x44ecf2['actions'][_0x5acc60];});}else{loggerBooked['info'](_0x6432('0x1e3'),JSON[_0x6432('0x6c')](_0xdbf34d[_0x6432('0x6b')]),_0x6432('0x1e0'),_0xdbf34d['name']);_0x44ecf2['updateOriginated'](_0xdbf34d);hopperUtils[_0x6432('0xd2')]({'active':![],'ContactId':_0x44ecf2['actions'][_0x5acc60]['ContactId'],'ListId':_0x44ecf2[_0x6432('0x21')][_0x5acc60][_0x6432('0xd6')],'VoiceQueueId':_0x44ecf2[_0x6432('0x21')][_0x5acc60]['VoiceQueueId']||undefined,'CampaignId':_0x44ecf2[_0x6432('0x21')][_0x5acc60][_0x6432('0xe3')]||undefined})[_0x6432('0x97')](loggerCatch(_0x6432('0x1e2')));delete _0x44ecf2[_0x6432('0x21')][_0x5acc60];}}else{return _0x44ecf2['actionOriginate'](_0xdbf34d,_0x1f7f26);}}else{if(utils[_0x6432('0x59')](undefined,_0x1f7f26[_0x6432('0x1e4')])<_0xdbf34d[_0x6432('0x1e5')]*0x3c){if(_0x1f7f26['Agent']&&!_0x1f7f26[_0x6432('0x140')]['voicePause']){_0x44ecf2[_0x6432('0x1b')][_0x6432('0xf3')](_0x1f7f26['id'])[_0x6432('0x19')](function(){_0x44ecf2[_0x6432('0xb6')](_0xdbf34d);});}else{hopperUtils['unlockContact']({'active':![]},_0x1f7f26['id'],0x1)[_0x6432('0x19')](function(){_0x44ecf2['updateOriginated'](_0xdbf34d);});}}else{_0xdbf34d[_0x6432('0x1e6')]+=0x1;_0x44ecf2[_0x6432('0xb6')](_0xdbf34d);if(_0xdbf34d[_0x6432('0x1e7')]){hopperUtils[_0x6432('0xd2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1f7f26[_0x6432('0xd5')],'ListId':_0x1f7f26[_0x6432('0xd6')],'VoiceQueueId':_0x1f7f26['VoiceQueueId']||undefined,'CampaignId':_0x1f7f26[_0x6432('0xe3')]||undefined})['catch'](loggerCatch(_0x6432('0x1e8')));hopperUtils[_0x6432('0xbe')](createObjHistory(_0xdbf34d,_0x1f7f26,utils[_0x6432('0x63')][_0x6432('0x1e9')],0x17,'RecallInQueue'))[_0x6432('0x97')](loggerCatch(_0x6432('0x1ea')));}else{_0x44ecf2['saveInDb'](createObjHistory(_0xdbf34d,_0x1f7f26,utils[_0x6432('0x63')][_0x6432('0x1eb')],0x16,_0x6432('0x1ec')),_0x6432('0x1ed'),_0x6432('0x1ee'));}}}}else{_0xdbf34d['outboundBlacklistCallsDay']+=0x1;_0x44ecf2[_0x6432('0x10f')](createObjHistory(_0xdbf34d,_0x1f7f26,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,_0x6432('0x1ef')),_0x6432('0x1f0'),_0x6432('0x1f1'));throw _0x6432('0x1f2');}};};Dialer[_0x6432('0x7c')][_0x6432('0x156')]=function(_0x91e41c){var _0x3f5eca=this;var _0x571216=_0x91e41c[_0x6432('0x1f3')]-_0x91e41c[_0x6432('0x14c')];emitCampaignSummary(_0x91e41c);if(_0x571216>0x0&&_0x91e41c[_0x6432('0x1f4')]==0x0){if(_0x571216>this[_0x6432('0x20')]){_0x571216=this[_0x6432('0x20')];}_0x91e41c['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x91e41c,_0x571216)['then'](function(_0x562257){_0x91e41c[_0x6432('0x1f4')]=0x0;if(_0x562257){if(!utils[_0x6432('0x1f5')](_0x562257)){_0x91e41c[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x67')];logger[_0x6432('0x45')]('[getContactCampaign2][Empty]'+_0x91e41c[_0x6432('0x3f')]);}else{_0x91e41c['originated']+=_0x562257[_0x6432('0x90')];_0x91e41c[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x1f6')];for(var _0x26a191=0x0;_0x26a191<_0x562257[_0x6432('0x90')];_0x26a191+=0x1){_0x91e41c[_0x6432('0x1f7')]+=0x1;if(_[_0x6432('0xec')](_0x562257[_0x26a191])||_['isNil'](_0x562257[_0x26a191][_0x6432('0x1f8')])||_[_0x6432('0xec')](_0x562257[_0x26a191][_0x6432('0x15a')])){_0x3f5eca['emptyContact'](_0x6432('0x1f9'),_0x91e41c,_0x562257[_0x26a191]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x6432('0x6d')](_0x562257[_0x26a191],['CampaignId',_0x6432('0x15a')]))[_0x6432('0x3b')](_0x3f5eca[_0x6432('0x1fa')](_0x91e41c,_0x562257[_0x26a191]))[_0x6432('0x97')](_0x3f5eca[_0x6432('0x14f')](_0x6432('0x1fb'),_0x91e41c));}}}}})[_0x6432('0x97')](loggerGetContactDialer(_0x6432('0x1fc'),_0x91e41c,_0x571216));}};Dialer[_0x6432('0x7c')][_0x6432('0xa5')]=function(_0x3c3d45,_0x35ded3){var _0x25999=this;var _0x4f497e=[];if(_0x35ded3<0x1||_0x3c3d45['dialMethod']===_0x6432('0xa6')){_0x35ded3=0x1;}var _0x3fb370=Math[_0x6432('0x1bd')](_0x3c3d45[_0x6432('0x130')]*_0x35ded3)-_0x3c3d45[_0x6432('0x14c')];if(_0x3c3d45[_0x6432('0x1fd')]>0x0){var _0x5b928e=_0x3c3d45[_0x6432('0x1fd')]-_0x3c3d45[_0x6432('0x14c')]-_0x3c3d45[_0x6432('0x132')]-_0x3c3d45['pTalking'];if(_0x3fb370>_0x5b928e){_0x3fb370=_0x5b928e;}}if(_0x3fb370>0x0&&_0x3c3d45[_0x6432('0x1f4')]==0x0){if(_0x3c3d45[_0x6432('0xa4')]===_0x6432('0xa6')){_0x3fb370=0x1;}if(_0x3fb370>this[_0x6432('0x20')]){_0x3fb370=this[_0x6432('0x20')];}for(var _0x333612 in this[_0x6432('0x1e')]){if(typeof this[_0x6432('0x1e')][_0x333612]!=='undefined'){if(this[_0x6432('0x1e')][_0x333612]['state']===_0x6432('0x1fe')&&this[_0x6432('0x1e')][_0x333612][_0x6432('0x80')]===_0x6432('0x13d')){_0x4f497e[_0x6432('0x91')](this['agents'][_0x333612]['id']);}}}_0x3c3d45[_0x6432('0x1f4')]=0x1;hopperUtils['getContactDialer'](_0x3c3d45,_0x4f497e,_0x3fb370)[_0x6432('0x3b')](function(_0x4eb1aa){_0x3c3d45['temp']=0x0;if(_0x4eb1aa){if(!utils[_0x6432('0x1f5')](_0x4eb1aa)){hopperUtils[_0x6432('0x1ff')](_0x3c3d45)['then'](sendMessageReschedule(_0x3c3d45))['catch'](loggerCatch(_0x6432('0x200')));}else{_0x3c3d45['originated']+=_0x4eb1aa['length'];_0x3c3d45['message']=_0x3c3d45[_0x6432('0xa4')]==='booked'?utils['CAMPAIGN_STATUS'][_0x6432('0x134')]:utils[_0x6432('0x63')][_0x6432('0x1f6')];for(var _0x1895fd=0x0;_0x1895fd<_0x4eb1aa[_0x6432('0x90')];_0x1895fd+=0x1){if(_[_0x6432('0xec')](_0x4eb1aa[_0x1895fd])||_['isNil'](_0x4eb1aa[_0x1895fd][_0x6432('0x1f8')])||_[_0x6432('0xec')](_0x4eb1aa[_0x1895fd]['phone'])){_0x25999['emptyContact'](_0x6432('0x1f9'),_0x3c3d45,_0x4eb1aa[_0x1895fd]);}else{hopperUtils['checkIsBlackList'](_[_0x6432('0x6d')](_0x4eb1aa[_0x1895fd],[_0x6432('0xe2'),'phone']))[_0x6432('0x3b')](_0x25999[_0x6432('0x1fa')](_0x3c3d45,_0x4eb1aa[_0x1895fd]))[_0x6432('0x97')](_0x25999[_0x6432('0x14f')](_0x6432('0x1f9'),_0x3c3d45));}}}}})[_0x6432('0x97')](loggerGetContactDialer(_0x6432('0x201'),_0x3c3d45,_0x3fb370));}};Dialer[_0x6432('0x7c')][_0x6432('0x5e')]=function(_0x31ac72){if(_0x31ac72[_0x6432('0x1fd')]>0x0){var _0x2513ed=_0x31ac72[_0x6432('0x1fd')]-_0x31ac72['originated']-_0x31ac72[_0x6432('0x132')];if(_0x2513ed>0x0&&_0x31ac72[_0x6432('0x1f4')]==0x0){this[_0x6432('0x202')](_0x31ac72);}else{loggerPredictiveCalls[_0x6432('0x45')](_0x6432('0x203'));}}else{this['tryOriginatePredictive'](_0x31ac72);}};Dialer[_0x6432('0x7c')][_0x6432('0x202')]=function(_0x5746f2){var _0x10ffcd=this;var _0x30192f=[];_0x5746f2[_0x6432('0x14c')]+=0x1;for(var _0x4813fd in this[_0x6432('0x1e')]){if(typeof this[_0x6432('0x1e')][_0x4813fd]!==_0x6432('0x147')){if(this['agents'][_0x4813fd][_0x6432('0x68')]===_0x6432('0x1fe')&&this[_0x6432('0x1e')][_0x4813fd][_0x6432('0x80')]===_0x6432('0x13d')){_0x30192f[_0x6432('0x91')](this[_0x6432('0x1e')][_0x4813fd]['id']);}}}_0x5746f2[_0x6432('0x1f4')]=0x1;return this[_0x6432('0x204')](_0x5746f2['id'],_0x30192f,0x1,_0x5746f2[_0x6432('0x205')],_0x5746f2)['then'](function(_0x1f9e0f){_0x5746f2[_0x6432('0x1f4')]=0x1;if(_0x1f9e0f){if(!utils[_0x6432('0x1f5')](_0x1f9e0f)){utils['checkContactLowerLimitOriginate'](_0x5746f2,0x1,0x0);return hopperUtils[_0x6432('0x1ff')](_0x5746f2)[_0x6432('0x3b')](sendMessageReschedule(_0x5746f2))['catch'](loggerCatch(_0x6432('0x200')));}else{_0x5746f2[_0x6432('0x62')]=utils[_0x6432('0x63')][_0x6432('0x1f6')];if(_[_0x6432('0xec')](_0x1f9e0f[0x0])||_[_0x6432('0xec')](_0x1f9e0f[0x0][_0x6432('0x1f8')])||_['isNil'](_0x1f9e0f[0x0]['phone'])){_0x10ffcd[_0x6432('0x150')]('[actionOriginate]\x20',_0x5746f2,_0x1f9e0f[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x6432('0x6d')](_0x1f9e0f[0x0],[_0x6432('0xe2'),'phone']))[_0x6432('0x3b')](_0x10ffcd['checkContactBlack'](_0x5746f2,_0x1f9e0f[0x0]))[_0x6432('0x97')](_0x10ffcd[_0x6432('0x14f')](_0x6432('0x206'),_0x5746f2));}}}})['catch'](loggerGetContactDialer(_0x6432('0x207'),_0x5746f2,0x1));};Dialer[_0x6432('0x7c')]['abandonmentRate']=function(_0x23fab4,_0x3b998b,_0x6c66a6,_0xeb54b3,_0x5f2151,_0x2a22ed){loggerPredictive['info'](_0x6432('0x208'));loggerPredictive[_0x6432('0x45')](_0x6432('0x209'),_0x23fab4);loggerPredictive[_0x6432('0x45')](_0x6432('0x20a'),_0x3b998b);loggerPredictive[_0x6432('0x45')](_0x6432('0x20b'),_0x6c66a6);loggerPredictive['info'](_0x6432('0x20c'),_0xeb54b3);loggerPredictive[_0x6432('0x45')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5f2151);loggerPredictive['info'](_0x6432('0x4d'));return new Promise(function(_0x5c42bf,_0x18a850){if(_0x23fab4<=0x0||isNaN(_0x23fab4)){return _0x18a850(msgResponse('[abandonmentRate]',_0x6432('0x18c'),_0x6432('0x20d')+_0x23fab4));}if(_0x6c66a6<=0x0||isNaN(_0x6c66a6)){return _0x18a850(msgResponse(_0x6432('0x20e'),_0x6432('0x18c'),_0x6432('0x20f')+_0x6c66a6));}if(_0xeb54b3<=0x0||isNaN(_0xeb54b3)){return _0x18a850(msgResponse(_0x6432('0x20e'),'Error',_0x6432('0x210')+_0xeb54b3));}if(_0x3b998b<=0x0||isNaN(_0x3b998b)){return _0x18a850(msgResponse('[abandonmentRate]',_0x6432('0x18c'),_0x6432('0x211')+_0x3b998b));}if(_0x5f2151<=0x0||isNaN(_0x5f2151)){return _0x18a850(msgResponse(_0x6432('0x20e'),_0x6432('0x18c'),_0x6432('0x212')+_0x5f2151));}_0x2a22ed=_0x2a22ed||0x0;var _0x2750d9=0x1/_0x6c66a6;var _0x29b549=0x0;var _0x206bcd=0x0;var _0x3d4c1e=0x0;var _0x4568c5=0x0;for(var _0x435413=0x0;_0x3d4c1e<_0x5f2151;_0x435413+=0x1){_0x206bcd=_0x435413/_0x3b998b;_0x29b549=(_0xeb54b3*_0x206bcd+_0x2a22ed)/_0x2750d9;_0x3d4c1e=utils[_0x6432('0x213')](_0x29b549,_0x23fab4);_0x4568c5=_0x29b549/_0x23fab4*(0x1-utils['erlangb'](_0x29b549,_0x23fab4));}return _0x5c42bf({'erlangCalls':_0x435413,'erlangCallToSecond':_0x3b998b/_0x435413,'erlangAbandonmentRate':_0x3d4c1e,'erlangBusyFactor':_0x4568c5});});};Dialer[_0x6432('0x7c')][_0x6432('0x1da')]=function(_0x2dffbf,_0xac30d9,_0x13f8f9,_0x3bd035,_0x54dfe3,_0x248902){loggerPredictive[_0x6432('0x45')](_0x6432('0x214'));loggerPredictive['info'](_0x6432('0x209'),_0x2dffbf);loggerPredictive['info'](_0x6432('0x20a'),_0xac30d9);loggerPredictive[_0x6432('0x45')](_0x6432('0x20b'),_0x13f8f9);loggerPredictive['info'](_0x6432('0x20c'),_0x3bd035);loggerPredictive[_0x6432('0x45')](_0x6432('0x215'),_0x54dfe3);loggerPredictive[_0x6432('0x45')]('---------------------------');return new Promise(function(_0x5da232,_0x4123db){if(_0x2dffbf<=0x0||isNaN(_0x2dffbf)){return _0x4123db(msgResponse(_0x6432('0x216'),_0x6432('0x18c'),_0x6432('0x20d')+_0x2dffbf));}if(_0x13f8f9<=0x0||isNaN(_0x13f8f9)){return _0x4123db(msgResponse(_0x6432('0x216'),'Error',_0x6432('0x20f')+_0x13f8f9));}if(_0x3bd035<=0x0||isNaN(_0x3bd035)){return _0x4123db(msgResponse('[busyFactor]','Error',_0x6432('0x210')+_0x3bd035));}if(_0xac30d9<=0x0||isNaN(_0xac30d9)){return _0x4123db(msgResponse(_0x6432('0x216'),_0x6432('0x18c'),'interval\x20=\x20'+_0xac30d9));}if(_0x54dfe3<=0x0||isNaN(_0x54dfe3)){return _0x4123db(msgResponse(_0x6432('0x216'),'Error',_0x6432('0x217')+_0x54dfe3));}_0x248902=_0x248902||0x0;var _0x1f6681=0x1/_0x13f8f9;var _0x1c8bad=0x0;var _0x322377=0x0;var _0x515e80=0x0;var _0x42b67c=0x0;for(var _0x242816=0x0;_0x42b67c<_0x54dfe3;_0x242816+=0x1){_0x322377=_0x242816/_0xac30d9;_0x1c8bad=(_0x3bd035*_0x322377+_0x248902)/_0x1f6681;_0x515e80=utils[_0x6432('0x213')](_0x1c8bad,_0x2dffbf);_0x42b67c=_0x1c8bad/_0x2dffbf*(0x1-utils['erlangb'](_0x1c8bad,_0x2dffbf));}return _0x5da232({'erlangCalls':_0x242816,'erlangCallToSecond':_0xac30d9/_0x242816,'erlangAbandonmentRate':_0x515e80,'erlangBusyFactor':_0x42b67c});});};module[_0x6432('0x218')]=Dialer; \ No newline at end of file +var _0xdabd=['[rescheduleContact][AgentReject]','callProgressDetecting','object','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalAnsweredCalls','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','undefined','push','countReScheduled','[countReScheduled]\x20','Contact','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','getContactDialer','dialOrderByScheduledAt','checkContactLowerLimitOriginate','checkIsBlackList','[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','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','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','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','p\x20=\x20','Umin\x20=\x20','exports','util','uuid','ioredis','./utils/hopper','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','info','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','name','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','Intervals','Interval','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','originated','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','status','format','SIP/%s','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','ifTime','isArray','length','command','iftime\x20%s,%s','interval','timezones','indexOf','true','Action','content','catch','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','resolve','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','Queue','silly','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueId','uniqueid','ivr','updateOriginated','outboundAnswerCallsDay','reason','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','YYYY-MM-DD\x20HH:mm:ss','droptime','predictiveIntervalErlangCallsDroppedCalls','TIMEOUT','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','additional','ContactId','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','isNil','locked','paused','stateinterface','pick','idHopper','strategy','roundrobin','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','finally','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerAgiCallsDay','countcongestionretry','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','outboundUnknownCallsDay','cause-txt','queuesSummary','running','isPreviewCampaign','statusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','updateReportFromOutboundQueue','assign','dialPreviewRecallmeReminder','filter','online','reachable','map','Agent','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','checkPreviewRecallReminder','handlePreviewRecallNotifications','actionOriginate','originate','voiceQueue\x20is\x20undefine','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialQueueTimeout','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','setXMDContactVariables','Trunk','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry'];(function(_0x41d42b,_0x555bd3){var _0xc7f5a0=function(_0x1c578a){while(--_0x1c578a){_0x41d42b['push'](_0x41d42b['shift']());}};_0xc7f5a0(++_0x555bd3);}(_0xdabd,0x8f));var _0xddab=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xdabd[_0x599e60];return _0x468e19;};'use strict';var util=require(_0xddab('0x0'));var _=require('lodash');var uuid=require(_0xddab('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0xddab('0x2'));var utils=require('./utils');var hopperUtils=require(_0xddab('0x3'));var ut=require(_0xddab('0x4'));var config=require('../../../config/environment/');var logger=require(_0xddab('0x5'))(_0xddab('0x6'));var loggerBooked=require(_0xddab('0x5'))('booked');var loggerPredictive=require(_0xddab('0x5'))(_0xddab('0x7'));var loggerPredictiveCalls=require(_0xddab('0x5'))(_0xddab('0x8'));var loggerSyncQueueSummary=require(_0xddab('0x5'))(_0xddab('0x9'));var ami=require(_0xddab('0xa'));config[_0xddab('0xb')]=_[_0xddab('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xddab('0xd'))(new Redis(config[_0xddab('0xb')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xddab('0xe'));var Interval=require(_0xddab('0xf'));var Action=require(_0xddab('0x10'));var History=require('./models/history');var Final=require(_0xddab('0x11'));var AgentComplete=require(_0xddab('0x12'));var QueueCallerAbandon=require(_0xddab('0x13'));var Hangup=require(_0xddab('0x14'));var ipAgi=process[_0xddab('0x15')]['XCALLY_IP_AGI']||_0xddab('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xddab('0x17')][_0xddab('0x18')]=function(_0x2fa78c){this[_0xddab('0x19')]=this[_0xddab('0x19')]?this[_0xddab('0x19')]['finally'](_0x2fa78c):_0x2fa78c();};function Dialer(_0x574b9d,_0x2de4c2){this[_0xddab('0x1a')]=new Sequence();this[_0xddab('0x1b')]=_0x2de4c2;this[_0xddab('0x1c')]=_0x574b9d[_0xddab('0x1c')];this[_0xddab('0x1d')]=_0x574b9d[_0xddab('0x1d')];this[_0xddab('0x1e')]=_0x574b9d[_0xddab('0x1e')];this[_0xddab('0x1f')]=_0x574b9d['trunks'];this[_0xddab('0x20')]=config[_0xddab('0x20')]||0x2;this[_0xddab('0x21')]={};this[_0xddab('0x22')]={};this[_0xddab('0x23')]={};this['uniqueId']={};this[_0xddab('0x24')]={};this[_0xddab('0x25')]={};this[_0xddab('0x26')]={};this[_0xddab('0x27')]={};this[_0xddab('0x28')]={};this[_0xddab('0x29')]={};this['queuesSummary']={};ami['on']('agentconnect',this[_0xddab('0x2a')]['bind'](this));ami['on'](_0xddab('0x2b'),this[_0xddab('0x2c')][_0xddab('0x2d')](this));ami['on'](_0xddab('0x2e'),this[_0xddab('0x2f')][_0xddab('0x2d')](this));ami['on']('agentcomplete',this[_0xddab('0x30')][_0xddab('0x2d')](this));ami['on'](_0xddab('0x31'),this[_0xddab('0x9')][_0xddab('0x2d')](this));ami['on']('custom:queuesummarycomplete',this[_0xddab('0x32')][_0xddab('0x2d')](this));ami['on'](_0xddab('0x33'),this['syncHangup'][_0xddab('0x2d')](this));ami['on']('newexten',this[_0xddab('0x34')]['bind'](this));ami['on']('varset',this[_0xddab('0x35')][_0xddab('0x2d')](this));ami['on']('queuemember',this[_0xddab('0x36')][_0xddab('0x2d')](this));ami['on'](_0xddab('0x37'),this[_0xddab('0x38')][_0xddab('0x2d')](this));this['loopCampaigns']();this[_0xddab('0x39')]();RpcSetting[_0xddab('0x3a')]()[_0xddab('0x3b')](function(_0x438f7d){previewRecallmeReminderInterval=_0x438f7d[_0xddab('0x3c')];});}function isNotNull(_0x40866b){return _0x40866b!==null&&!_['isUndefined'](_0x40866b);}function msgResponse(_0x1690c4,_0x57c177,_0x34b75f){return{'action':_0x1690c4,'response':_0x57c177,'message':_0x34b75f,'stack':_0x34b75f};}function emit(_0x2fbdce,_0x49cbe6,_0x2f731a){io['to'](_0x2fbdce)[_0xddab('0x3d')](_0x49cbe6,_0x2f731a);}function emitOutboundVoiceQueueSummary(_0x262122){if(_0x262122[_0xddab('0x3e')]===_0xddab('0x3f')){logger[_0xddab('0x40')](_0xddab('0x41'),util[_0xddab('0x42')](_0x262122,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0x262122['name']),_0xddab('0x43'),_0x262122);}}function checkGetDataPredictive(_0x353b4){if(isNotNull(_0x353b4)&&!_[_0xddab('0x44')](_0x353b4)){loggerPredictive['info'](_0xddab('0x45'));loggerPredictive['info'](_0xddab('0x46'),_0x353b4[_0xddab('0x47')]);loggerPredictive[_0xddab('0x48')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x353b4['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xddab('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x353b4[_0xddab('0x49')]);loggerPredictive[_0xddab('0x48')](_0xddab('0x4a'),_0x353b4[_0xddab('0x4b')]);loggerPredictive[_0xddab('0x48')](_0xddab('0x4c'),_0x353b4['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xddab('0x48')](_0xddab('0x4d'),_0x353b4[_0xddab('0x4e')]);loggerPredictive[_0xddab('0x48')](_0xddab('0x4f'));if(_0x353b4[_0xddab('0x47')]>0x0){if(!_[_0xddab('0x50')](_0x353b4[_0xddab('0x4e')])&&_0x353b4[_0xddab('0x4e')]>0x0){return!![];}loggerPredictive[_0xddab('0x48')](_0xddab('0x51'));if(!_[_0xddab('0x50')](_0x353b4[_0xddab('0x52')])&&_0x353b4[_0xddab('0x52')]>0x0){return!![];}loggerPredictive[_0xddab('0x48')](_0xddab('0x53'));}else{loggerPredictive[_0xddab('0x48')](_0xddab('0x54'));}}else{loggerPredictive[_0xddab('0x48')](_0xddab('0x55'));}return![];}function mergeDataErlangB(_0x14319d){return function(_0x536534){loggerPredictive[_0xddab('0x48')](_0xddab('0x56'));loggerPredictive[_0xddab('0x48')](_0xddab('0x57'),_0x536534[_0xddab('0x58')]);loggerPredictive['info'](_0xddab('0x59'),_0x536534[_0xddab('0x5a')]);loggerPredictive[_0xddab('0x48')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x536534[_0xddab('0x5b')]);loggerPredictive[_0xddab('0x48')](_0xddab('0x5c'),_0x536534['erlangBusyFactor']);loggerPredictive[_0xddab('0x48')](_0xddab('0x5d'),_0x536534[_0xddab('0x5b')]);loggerPredictive['info']('---------------------------');_[_0xddab('0x5e')](_0x14319d,_0x536534);};}function ifInterval(_0x5a1943,_0x505cb4){if(_['isUndefined'](_0x505cb4)){return![];}return utils[_0xddab('0x5f')](undefined,_0x505cb4)<_0x5a1943*0x3c;}function clearPredictiveAttributes(_0x39a449){if(_0x39a449[_0xddab('0x26')]){_0x39a449[_0xddab('0x26')]=undefined;loggerPredictive[_0xddab('0x40')](_0x39a449[_0xddab('0x60')],_0xddab('0x61'));}if(_0x39a449['startPredictive']){_0x39a449[_0xddab('0x25')]=undefined;loggerPredictive[_0xddab('0x40')](_0x39a449[_0xddab('0x60')],'startPredictive\x20value\x20cleared');}if(_0x39a449[_0xddab('0x62')]){clearInterval(_0x39a449['handlePredictive']);_0x39a449[_0xddab('0x62')]=undefined;loggerPredictive[_0xddab('0x40')](_0x39a449[_0xddab('0x60')],_0xddab('0x63'));}}function loggerCatchPredictive(_0x2de991,_0x37b3d1){return function(_0x5bd839){loggerPredictive[_0xddab('0x64')](_0x37b3d1[_0xddab('0x60')],_0x2de991);loggerPredictive['error'](_0x5bd839[_0xddab('0x65')]);clearPredictiveAttributes(_0x37b3d1);};}function loggerCatch(_0x3ae90a){return function(_0x2b7fda){logger['error'](_0x3ae90a,util['inspect'](_0x2b7fda,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2351e4,_0x4be3ad,_0x11ecb2){return function(_0x2d93b6){utils['checkContactLowerLimitOriginate'](_0x4be3ad,_0x11ecb2,0x0);_0x4be3ad['temp']=0x0;logger[_0xddab('0x64')](_0x2351e4,util[_0xddab('0x42')](_0x2d93b6,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x31f29f){return function(_0x295c4a){if(isNotNull(_0x295c4a)&&isNotNull(_0x295c4a[0x0])){if(_0x295c4a[0x0][_0xddab('0x66')]>0x0){_0x31f29f['message']=utils[_0xddab('0x67')][_0xddab('0x68')];logger[_0xddab('0x48')](_0xddab('0x69')+_0x31f29f[_0xddab('0x60')],_0x295c4a[0x0][_0xddab('0x66')],'contacts');}else{_0x31f29f[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x6b')];logger[_0xddab('0x48')](_0xddab('0x6c')+_0x31f29f[_0xddab('0x60')]);}}};}function createObjHistory(_0x2c0421,_0x5c9c1d,_0x4edf6d,_0xdffdae,_0x206bb2){_0x2c0421[_0xddab('0x6a')]=_0x4edf6d;var _0x59e5e4=new Action(_0x2c0421,_0x5c9c1d);var _0xe51884=new History(_0x59e5e4);_0xe51884[_0xddab('0x6d')]=_0xdffdae;_0xe51884[_0xddab('0x6e')]=_0x206bb2;_0xe51884[_0xddab('0x6f')]=_0x59e5e4[_0xddab('0x70')];return _0xe51884;}function unlockQueueStatus(_0x35e38d,_0x15d4c0){setTimeout(function(){if(_[_0xddab('0x50')](_0x35e38d[_0xddab('0x71')])){loggerBooked[_0xddab('0x64')]('[unlockQueueStatus][undefined]',_0x15d4c0);}_0x35e38d[_0xddab('0x71')]=!![];loggerBooked[_0xddab('0x48')](_0xddab('0x72'),_0x15d4c0,JSON[_0xddab('0x73')](_['pick'](_0x35e38d,[_0xddab('0x60'),_0xddab('0x71')])));},0x1f3);}function checkInterval(_0x39e2b8){return function(){if(!isNotNull(_0x39e2b8['Interval'])){_0x39e2b8[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x74')];throw _0x39e2b8['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x39e2b8['Interval'][_0xddab('0x75')])){_0x39e2b8[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x74')];throw _0x39e2b8[_0xddab('0x60')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xddab('0x44')](_0x39e2b8[_0xddab('0x76')]['Intervals']))){_0x39e2b8[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x74')];throw _0x39e2b8['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0xa1c15){return function(){if(!utils[_0xddab('0x77')](_0xa1c15)){_0xa1c15[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x78')];throw _0xa1c15[_0xddab('0x60')]+_0xddab('0x79');}};}function emitCampaignSummary(_0x285ba7){if(utils[_0xddab('0x7a')](_0x285ba7)){emit(util['format'](_0xddab('0x7b'),_0x285ba7['name']),'campaign:save',_0x285ba7);}}function loggerCatchQueueSummary(_0x1796e5,_0xcc4d13){return function(_0x1a579b){clearPredictiveAttributes(_0xcc4d13);emitCampaignSummary(_0xcc4d13);loggerSyncQueueSummary['debug'](_0x1796e5,util[_0xddab('0x42')](_0x1a579b,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x33284a){if(_0x33284a['sendMessageOneNotActive']){if(_0x33284a[_0xddab('0x7c')]===0x0){_0x33284a[_0xddab('0x7d')]=![];_0x33284a['message']=utils['CAMPAIGN_STATUS'][_0xddab('0x78')];loggerSyncQueueSummary[_0xddab('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x33284a[_0xddab('0x60')],_0xddab('0x7e'));}else{_0x33284a[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x7f')];loggerSyncQueueSummary[_0xddab('0x40')](_0xddab('0x80'),_0x33284a[_0xddab('0x60')],_0xddab('0x81'));}emitCampaignSummary(_0x33284a);}}function myreject(_0x26d663){return function(_0x33fb90){return _0x26d663(msgResponse(_0xddab('0x82'),_0xddab('0x83'),JSON['stringify'](_0x33fb90)));};}Dialer[_0xddab('0x17')][_0xddab('0x84')]=function(_0x5ae1d6){return!_[_0xddab('0x50')](_0x5ae1d6)&&_0x5ae1d6&&!_[_0xddab('0x50')](_0x5ae1d6[_0xddab('0x60')])&&!_[_0xddab('0x50')](_0x5ae1d6[_0xddab('0x85')])&&_0x5ae1d6['active']&&(this['trunks'][util['format']('SIP/%s',_0x5ae1d6[_0xddab('0x60')])][_0xddab('0x86')]==='reachable'||this[_0xddab('0x1f')][util[_0xddab('0x87')](_0xddab('0x88'),_0x5ae1d6['name'])][_0xddab('0x86')]===_0xddab('0x89'));};Dialer[_0xddab('0x17')][_0xddab('0x8a')]=function(_0xe94439){var _0x60e3f4=this;return function(){if(!_0x60e3f4[_0xddab('0x84')](_0xe94439['Trunk'])){if(!_0x60e3f4[_0xddab('0x84')](_0xe94439[_0xddab('0x8b')])){_0xe94439['message']=utils[_0xddab('0x67')][_0xddab('0x8c')];throw _0xe94439[_0xddab('0x60')]+_0xddab('0x8d');}}};};Dialer['prototype']['checkIfTime']=function(_0xce43c2,_0xc5cbc2,_0x25c023,_0x440768){var _0x8cc4f7=this;return function(){var _0x393e00=!![];return _0x8cc4f7[_0xddab('0x8e')](_0xce43c2,_0xc5cbc2,_0x25c023,_0x440768,_0x393e00);};};Dialer[_0xddab('0x17')]['checkIfTimeIntervals']=function(_0x25c39b,_0x4216d7,_0x5092db,_0x3507b0){var _0x52c240=this;return function(){var _0x8bf94a=![];return _0x52c240[_0xddab('0x8e')](_0x25c39b[_0xddab('0x75')],_0x4216d7,_0x5092db,_0x3507b0,_0x8bf94a);};};Dialer['prototype'][_0xddab('0x8e')]=function(_0x49aae2,_0x25b231,_0x16321b,_0x1b753f,_0x2b800b){var _0x4db29e=[];return new Promise(function(_0x4a4dd7,_0x2fdcf1){if(!isNotNull(_0x49aae2)){_0x1b753f[_0xddab('0x6a')]=utils[_0xddab('0x67')]['NULL_INTERVAL'];return _0x2fdcf1(msgResponse('ifTime',_0xddab('0x8f'),_0x16321b+_0xddab('0x90')));}if(_[_0xddab('0x44')](_0x49aae2)){_0x1b753f[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x91')];return _0x2fdcf1(msgResponse('ifTime',_0xddab('0x8f'),_0x16321b+'\x20Intervals\x20is\x20empty\x20'));}if(_0x25b231&&_[_0xddab('0x50')](config['timezones'][_0x25b231])){_0x1b753f[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x92')];return _0x2fdcf1(msgResponse(_0xddab('0x93'),_0xddab('0x8f'),_0x16321b+'\x20Timezone\x20unknow\x20'+_0x25b231));}if(_[_0xddab('0x94')](_0x49aae2)){for(var _0x55aad9=0x0;_0x55aad9<_0x49aae2[_0xddab('0x95')];_0x55aad9+=0x1){_0x4db29e['push'](ami['Action']({'action':_0xddab('0x96'),'command':util[_0xddab('0x87')](_0xddab('0x97'),_0x49aae2[_0x55aad9][_0xddab('0x98')],!_['isUndefined'](config[_0xddab('0x99')][_0x25b231])?_0x25b231:'')})[_0xddab('0x3b')](function(_0x37f6fc){return _0x37f6fc['content'][_0xddab('0x9a')](_0xddab('0x9b'))>=0x0;})['catch'](myreject(_0x2fdcf1)));}}else{_0x4db29e['push'](ami[_0xddab('0x9c')]({'action':_0xddab('0x96'),'command':util[_0xddab('0x87')]('iftime\x20%s,%s',_0x49aae2,!_[_0xddab('0x50')](config['timezones'][_0x25b231])?_0x25b231:'')})[_0xddab('0x3b')](function(_0x212ebc){return _0x212ebc[_0xddab('0x9d')][_0xddab('0x9a')](_0xddab('0x9b'))>=0x0;})[_0xddab('0x9e')](myreject(_0x2fdcf1)));}Promise['all'](_0x4db29e)[_0xddab('0x3b')](function(_0xa0b1ed){var _0x5e2a6a=_[_0xddab('0x9f')](_0xa0b1ed);if(_0x5e2a6a){return _0x4a4dd7(_0x5e2a6a);}else{_0x1b753f[_0xddab('0x6a')]=_0x2b800b?utils[_0xddab('0x67')][_0xddab('0xa0')]:utils[_0xddab('0x67')]['OVERTIME_INTERVAL'];return _0x2fdcf1(msgResponse(_0xddab('0xa1'),_0xddab('0x8f'),_0xddab('0xa2')+_0x2b800b+'\x20'+_0x16321b+_0xddab('0xa3')+util[_0xddab('0x42')](_0x49aae2,{'showHidden':![],'depth':null})+_0xddab('0xa4')+_0x25b231));}})[_0xddab('0x9e')](function(_0x4c305e){return _0x2fdcf1(msgResponse('ifTime','Failure',JSON[_0xddab('0x73')](_0x4c305e)));});});};Dialer[_0xddab('0x17')][_0xddab('0xa5')]=function(){var _0x14ce1e=this;return cmHopper[_0xddab('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0xddab('0x3b')](function(){setInterval(function(){_0x14ce1e['syncCampaigns']();},0x3e8);});};Dialer[_0xddab('0x17')][_0xddab('0xa7')]=function(){var _0x37374c=this;var _0xfc0807;for(var _0xa3dc33 in this[_0xddab('0x1d')]){if(typeof this[_0xddab('0x1d')][_0xa3dc33]!=='undefined'){_0xfc0807=this[_0xddab('0x1d')][_0xa3dc33];if(utils[_0xddab('0x7a')](_0xfc0807)&&utils['isIVRCampaignActive'](_0xfc0807)){_0xfc0807[_0xddab('0x7d')]=!![];Promise[_0xddab('0xa8')]()['then'](checkIsIVRCampaignActive(_0xfc0807))[_0xddab('0x3b')](checkInterval(_0xfc0807))[_0xddab('0x3b')](_0x37374c[_0xddab('0x8a')](_0xfc0807))[_0xddab('0x3b')](_0x37374c['checkIfTime'](_0xfc0807[_0xddab('0xa9')],_0xfc0807['dialTimezone'],_0xfc0807['name'],_0xfc0807))[_0xddab('0x3b')](_0x37374c[_0xddab('0xaa')](_0xfc0807['Interval'],_0xfc0807[_0xddab('0xab')],_0xfc0807[_0xddab('0x60')],_0xfc0807))[_0xddab('0x3b')](_0x37374c[_0xddab('0xac')](_0xfc0807))[_0xddab('0x9e')](loggerCatchQueueSummary(_0xddab('0xad'),_0xfc0807));}else{notSendMessagesCampaign(_0xfc0807);}}}};Dialer[_0xddab('0x17')][_0xddab('0xae')]=function(_0x13ee33){if(_0x13ee33[_0xddab('0xaf')]!=='predictive'){clearPredictiveAttributes(_0x13ee33);}switch(_0x13ee33[_0xddab('0xaf')]){case _0xddab('0xb0'):this[_0xddab('0xb1')](_0x13ee33,0x1);break;case _0xddab('0xb2'):this[_0xddab('0xb1')](_0x13ee33,_0x13ee33['dialPowerLevel']);break;case _0xddab('0x7'):this[_0xddab('0x7')](_0x13ee33);break;case'booked':this[_0xddab('0xb1')](_0x13ee33,0x1);break;default:logger[_0xddab('0x64')](_0xddab('0xb3'),_0x13ee33[_0xddab('0x60')],'method\x20not\x20recognized');}};Dialer['prototype']['ifTime']=function(_0x3514c8,_0x463822){var _0x59b3ca=_0x3514c8[_0xddab('0xab')];var _0x469de7=_0x463822?_0x3514c8[_0xddab('0xa9')]:_0x3514c8[_0xddab('0x76')][_0xddab('0x75')];logger[_0xddab('0xb4')](_0xddab('0xb5'),_0x469de7,_0x59b3ca,_0x3514c8[_0xddab('0x60')],util['format']('Voice\x20Queue\x20%s\x20$s',_0x3514c8[_0xddab('0x60')],_0x3514c8['id']));var _0x9542dc=null;return Interval[_0xddab('0xb6')](_0x469de7,_0x59b3ca)[_0xddab('0x3b')](function(_0x16d527){if(_0x16d527===!![]){return _0x16d527;}else{_0x3514c8[_0xddab('0x6a')]=_0x463822?utils[_0xddab('0x67')][_0xddab('0xa0')]:utils[_0xddab('0x67')][_0xddab('0xb7')];_0x9542dc=msgResponse('[ifTime][promiseAll]',_0xddab('0x8f'),_0xddab('0xa2')+_0x463822+'\x20'+_0x3514c8[_0xddab('0x60')]+_0xddab('0xa3')+util[_0xddab('0x42')](_0x469de7,{'showHidden':![],'depth':null})+_0xddab('0xa4')+_0x59b3ca);}if(_0x9542dc!==null){logger[_0xddab('0xb4')](_0xddab('0xb8'),_0x9542dc);_0x9542dc['isGlobal']=_0x463822;throw _0x9542dc;}})[_0xddab('0x9e')](function(_0x422ff3){logger['error'](_0xddab('0xb9'),_0x422ff3);throw msgResponse(_0xddab('0x82'),_0xddab('0x83'),util[_0xddab('0x42')](_0x422ff3,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xddab('0x2a')]=function(_0x387b99){if(this[_0xddab('0x1c')][_0x387b99[_0xddab('0xba')]]){if(this[_0xddab('0xbb')][_0x387b99[_0xddab('0xbc')]]&&this[_0xddab('0xbb')][_0x387b99['uniqueid']]['type']!==_0xddab('0xbd')){this[_0xddab('0xbe')](this[_0xddab('0x1c')][_0x387b99['queue']]);this[_0xddab('0xbb')][_0x387b99[_0xddab('0xbc')]]['answertime']=moment()[_0xddab('0x87')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['syncAgentComplete']=function(_0x480091){var _0x33834c=this[_0xddab('0xbb')][_0x480091[_0xddab('0xbc')]];if(this[_0xddab('0x1c')][_0x480091[_0xddab('0xba')]]){if(_0x33834c&&_0x33834c[_0xddab('0x3e')]!==_0xddab('0xbd')){delete this['uniqueId'][_0x480091[_0xddab('0xbc')]];this[_0xddab('0x1c')][_0x480091['queue']][_0xddab('0xbf')]+=0x1;var _0xc70375=new AgentComplete(_0x33834c,_0x480091);if(_0x480091[_0xddab('0xc0')]==='agent'){_0xc70375[_0xddab('0xc1')]=this[_0xddab('0x1c')][_0x480091['queue']]['dialQueueProject2']&&this[_0xddab('0x1c')][_0x480091[_0xddab('0xba')]][_0xddab('0xc2')]?moment()[_0xddab('0x87')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xddab('0xc3')](_0xc70375)['catch'](loggerCatch(_0xddab('0xc4')));hopperUtils[_0xddab('0xc5')](_0xc70375)[_0xddab('0x9e')](loggerCatch(_0xddab('0xc6')));}}};Dialer[_0xddab('0x17')][_0xddab('0x2c')]=function(_0x9833c6){var _0x3f12c2=this[_0xddab('0xbb')][_0x9833c6['uniqueid']];var _0x498cf3=this;var _0xb6374=![];var _0x4df003;var _0x180d03;if(this[_0xddab('0x1c')][_0x9833c6[_0xddab('0xba')]]){if(_0x3f12c2&&_0x3f12c2[_0xddab('0x3e')]!==_0xddab('0xbd')){delete this['uniqueId'][_0x9833c6[_0xddab('0xbc')]];this[_0xddab('0xbe')](this[_0xddab('0x1c')][_0x9833c6[_0xddab('0xba')]]);_0x3f12c2['droptime']=moment()[_0xddab('0x87')](_0xddab('0xc7'));var _0x22e1f1=new QueueCallerAbandon(_0x3f12c2,_0x9833c6);if(utils[_0xddab('0x5f')](_0x3f12c2[_0xddab('0xc8')],_0x3f12c2['responsetime'])>=_0x3f12c2['dialQueueTimeout']){this['voiceQueues'][_0x9833c6['queue']][_0xddab('0x49')]+=0x1;this[_0xddab('0x1c')][_0x9833c6[_0xddab('0xba')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xddab('0x1c')][_0x9833c6[_0xddab('0xba')]][_0xddab('0xc9')]+=0x1;_0x22e1f1[_0xddab('0x6d')]=0xa;_0x22e1f1[_0xddab('0x6e')]='Drop';_0x22e1f1['dropreason']=_0xddab('0xca');_0x22e1f1['agiafterat']=this[_0xddab('0x1c')][_0x9833c6[_0xddab('0xba')]][_0xddab('0xcb')]?moment()[_0xddab('0x87')](_0xddab('0xc7')):undefined;_0x22e1f1[_0xddab('0xcc')]+=0x1;_0x22e1f1[_0xddab('0xcd')]+=0x1;_0x4df003=this['voiceQueues'][_0x9833c6[_0xddab('0xba')]][_0xddab('0xce')];_0x180d03=this[_0xddab('0x1c')][_0x9833c6['queue']][_0xddab('0xcf')];hopperUtils[_0xddab('0xd0')](_0x22e1f1,_0x22e1f1[_0xddab('0x6d')],_0x3f12c2[_0xddab('0xd1')])[_0xddab('0x3b')](function(_0xc13e33){_0xb6374=_0xc13e33['additional']==0x1;if(_0x22e1f1['countdropretry']>=_0x498cf3[_0xddab('0x1c')][_0x9833c6['queue']][_0xddab('0xd2')]){_0x498cf3[_0xddab('0xd3')](_0x22e1f1,_0xc13e33['additional']);}else{hopperUtils[_0xddab('0xd4')]({'active':![],'countdropretry':_0x22e1f1[_0xddab('0xcc')],'scheduledat':moment()[_0xddab('0xd5')](_0x498cf3[_0xddab('0x1c')][_0x9833c6['queue']][_0xddab('0xce')],_0xddab('0xd6'))[_0xddab('0x87')](_0xddab('0xc7')),'ContactId':_0x3f12c2['ContactId'],'ListId':_0x3f12c2[_0xddab('0xd7')],'VoiceQueueId':_0x3f12c2[_0xddab('0xd8')]||undefined,'CampaignId':_0x3f12c2[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch(_0xddab('0xda')));var _0x31d567=new History(_0x22e1f1);_0x31d567[_0xddab('0x6d')]=0xa;_0x31d567[_0xddab('0x6e')]=_0xddab('0xdb');_0x31d567[_0xddab('0x70')]=moment()[_0xddab('0x87')](_0xddab('0xc7'));_0x31d567[_0xddab('0x6f')]=_0x31d567[_0xddab('0x70')];_0x31d567[_0xddab('0xdc')]=_0x22e1f1[_0xddab('0xdc')];_0x31d567[_0xddab('0xdd')]=_0x22e1f1[_0xddab('0xdd')];hopperUtils['createHistory'](_0x31d567)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xddab('0x3b')](function(){if(_0xb6374)hopperUtils[_0xddab('0xde')](_0x22e1f1,_0x4df003,_0x180d03)[_0xddab('0x3b')](function(){return 0x1;});});}else{this[_0xddab('0x1c')][_0x9833c6['queue']][_0xddab('0x4b')]+=0x1;this['voiceQueues'][_0x9833c6[_0xddab('0xba')]][_0xddab('0xdf')]+=0x1;_0x22e1f1[_0xddab('0x6d')]=0xb;_0x22e1f1['statedesc']=_0xddab('0xe0');_0x22e1f1['dropreason']=_0xddab('0xe1');_0x22e1f1[_0xddab('0xe2')]+=0x1;_0x22e1f1[_0xddab('0xcd')]+=0x1;_0x4df003=this[_0xddab('0x1c')][_0x9833c6[_0xddab('0xba')]][_0xddab('0xe3')];_0x180d03=this[_0xddab('0x1c')][_0x9833c6[_0xddab('0xba')]][_0xddab('0xcf')];hopperUtils['verifyAdditionalPhones'](_0x22e1f1,_0x22e1f1[_0xddab('0x6d')],_0x3f12c2[_0xddab('0xd1')])[_0xddab('0x3b')](function(_0x30563d){if(_0x22e1f1['countabandonedretry']>=_0x498cf3[_0xddab('0x1c')][_0x9833c6[_0xddab('0xba')]][_0xddab('0xe4')]){_0x498cf3[_0xddab('0xd3')](_0x22e1f1,_0x30563d[_0xddab('0xe5')]);}else{hopperUtils[_0xddab('0xd4')]({'active':![],'countabandonedretry':_0x22e1f1['countabandonedretry'],'scheduledat':moment()[_0xddab('0xd5')](_0x498cf3['voiceQueues'][_0x9833c6[_0xddab('0xba')]][_0xddab('0xe3')],'minutes')[_0xddab('0x87')](_0xddab('0xc7')),'ContactId':_0x3f12c2[_0xddab('0xe6')],'ListId':_0x3f12c2['ListId'],'VoiceQueueId':_0x3f12c2[_0xddab('0xd8')]||undefined,'CampaignId':_0x3f12c2[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x111933=new History(_0x22e1f1);_0x111933[_0xddab('0x6d')]=0xb;_0x111933[_0xddab('0x6e')]='Abandoned';_0x111933['starttime']=moment()[_0xddab('0x87')](_0xddab('0xc7'));_0x111933[_0xddab('0x6f')]=_0x111933[_0xddab('0x70')];_0x111933[_0xddab('0xdc')]=_0x22e1f1[_0xddab('0xdc')];_0x111933[_0xddab('0xdd')]=_0x22e1f1[_0xddab('0xdd')];hopperUtils[_0xddab('0xc3')](_0x111933)[_0xddab('0x9e')](loggerCatch(_0xddab('0xe7')));}})[_0xddab('0x3b')](function(){if(_0xb6374)hopperUtils['swapAdditionalPhones'](_0x22e1f1,_0x4df003,_0x180d03)['then'](function(){return 0x1;});});}}}};Dialer[_0xddab('0x17')][_0xddab('0x34')]=function(_0x38af3e){if(this[_0xddab('0x22')][_0x38af3e[_0xddab('0xbc')]]){this['actions'][_0x38af3e[_0xddab('0xbc')]][_0xddab('0xe8')]=_0x38af3e['channel'];}if(this[_0xddab('0xbb')][_0x38af3e[_0xddab('0xbc')]]){this[_0xddab('0xbb')][_0x38af3e['uniqueid']][_0xddab('0xe8')]=_0x38af3e[_0xddab('0xe8')];}};Dialer[_0xddab('0x17')]['syncQueueMember']=function(_0x51212b){if(!this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]]){return;}var _0x3074cb=this[_0xddab('0x1c')][this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]][_0xddab('0xba')]]['strategy']||_0xddab('0xea');if(_0x3074cb==='roundrobin'){if(this['actions'][_0x51212b['actionid']]&&_[_0xddab('0xeb')](this['actions'][_0x51212b[_0xddab('0xe9')]][_0xddab('0xec')])&&_0x51212b[_0xddab('0x86')]==='1'&&_0x51212b[_0xddab('0xed')]==='0'){if(this['agents'][_0x51212b[_0xddab('0xee')]]){if(!this['agents'][_0x51212b['stateinterface']][_0xddab('0xec')]){this[_0xddab('0x1e')][_0x51212b[_0xddab('0xee')]][_0xddab('0xec')]=!![];this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]][_0xddab('0xec')]=!![];this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]][_0xddab('0xee')]=_0x51212b['stateinterface'];}}}}else if(_0x3074cb===_0xddab('0xea')){if(this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]]){if(this[_0xddab('0x1e')][_0x51212b[_0xddab('0xee')]]){this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]][_0xddab('0xee')]=_0x51212b[_0xddab('0xee')];if(_[_0xddab('0xeb')](this['queueBooked'][this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]][_0xddab('0xba')]])){this[_0xddab('0x28')][this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]][_0xddab('0xba')]]=[];}this[_0xddab('0x28')][this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]][_0xddab('0xba')]]['push'](_[_0xddab('0x5e')](_[_0xddab('0xef')](this[_0xddab('0x22')][_0x51212b[_0xddab('0xe9')]],[_0xddab('0xf0'),_0xddab('0xee')]),{'status':_0x51212b[_0xddab('0x86')],'paused':_0x51212b[_0xddab('0xed')]}));}}}};Dialer[_0xddab('0x17')][_0xddab('0x38')]=function(_0x1795c1){if(!this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]]){return;}var _0x17da7b=this;var _0x3a6a63=this[_0xddab('0x1c')][this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]];var _0x210144=_0x3a6a63[_0xddab('0xf1')]||'rrmemory';if(_0x210144===_0xddab('0xf2')){if(this[_0xddab('0x22')][_0x1795c1['actionid']]&&this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xee')]){this[_0xddab('0x1b')]['run'](this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xf0')],this[_0xddab('0x22')][_0x1795c1['actionid']][_0xddab('0xee')])[_0xddab('0x9e')](function(_0x3ca178){logger[_0xddab('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xddab('0x42')](_0x3ca178,{'showHidden':![],'depth':null}));})['finally'](function(){_0x17da7b[_0xddab('0xbe')](_0x17da7b[_0xddab('0x1c')][_0x17da7b[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]]);_0x17da7b[_0xddab('0x1e')][_0x17da7b['actions'][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xee')]][_0xddab('0xec')]=![];delete _0x17da7b[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]];unlockQueueStatus(_0x3a6a63);});}else{this[_0xddab('0xbe')](this[_0xddab('0x1c')][this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]]);hopperUtils[_0xddab('0xd4')]({'active':![],'ContactId':this['actions'][_0x1795c1[_0xddab('0xe9')]]['ContactId'],'ListId':this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xd7')],'VoiceQueueId':this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xd8')]||undefined,'CampaignId':this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]]['CampaignId']||undefined})[_0xddab('0x9e')](loggerCatch(_0xddab('0xf3')));delete this[_0xddab('0x22')][_0x1795c1['actionid']];unlockQueueStatus(_0x3a6a63);}}else if(_0x210144===_0xddab('0xea')){var _0x43df9b;if(this['actions'][_0x1795c1[_0xddab('0xe9')]]&&!_[_0xddab('0x44')](this[_0xddab('0x28')][this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]]['queue']])){if(this[_0xddab('0x29')][_0x17da7b[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]]){this[_0xddab('0x29')][_0x17da7b[_0xddab('0x22')][_0x1795c1['actionid']][_0xddab('0xba')]]=this[_0xddab('0x29')][this['actions'][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]]?this['queueBookedRR'][this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]]:this[_0xddab('0x28')][this[_0xddab('0x22')][_0x1795c1['actionid']][_0xddab('0xba')]]?this[_0xddab('0x28')][this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]]['_rr']||0x0:0x0;}this[_0xddab('0x28')][this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]][_0xddab('0xf4')]=this[_0xddab('0x29')][this[_0xddab('0x22')][_0x1795c1[_0xddab('0xe9')]][_0xddab('0xba')]];for(var _0x57b2dd=0x0;_0x57b2dd=_0x5b7bb6[_0xddab('0x11a')]){_0x54ef9b[_0xddab('0x11b')](_0x2443c4,_0x1831eb,_0xf499ea,_0xddab('0x11c'));}else{if(_0x2443c4[_0xddab('0x113')]>=_0x5b7bb6[_0xddab('0x11d')]){_0x54ef9b[_0xddab('0x11e')](_0x2443c4,_0x1831eb,_0xf499ea,_0xddab('0x11f'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2443c4[_0xddab('0x113')],'scheduledat':moment()[_0xddab('0xd5')](_0x5b7bb6[_0xddab('0x120')],_0xddab('0xd6'))[_0xddab('0x87')](_0xddab('0xc7')),'ContactId':_0x2443c4['ContactId'],'ListId':_0x2443c4[_0xddab('0xd7')],'VoiceQueueId':_0x2443c4[_0xddab('0xd8')]||undefined,'CampaignId':_0x2443c4['CampaignId']||undefined})[_0xddab('0x9e')](loggerCatch(_0xddab('0x121')));_0x1831eb({'reschedule':0x1});}}});}if(_0x4a477c['type']===_0xddab('0xbd')&&this[_0xddab('0x1d')][_0x4a477c[_0xddab('0xba')]]['dialAMDActive']&&_0x4446f2['value']===_0xddab('0x10a')){delete this['uniqueId'][_0x4446f2['uniqueid']];this['updateOriginated'](this[_0xddab('0x1d')][_0x4a477c['queue']]);_0x58633c=new Hangup(_0x4a477c,_0x4446f2);_0x58633c[_0xddab('0x6d')]=0x12;_0x58633c[_0xddab('0x6e')]=_0xddab('0x122');_0x58633c[_0xddab('0x10b')]=_0xddab('0x10c');ami[_0xddab('0x3d')]('custom:amd',ut[_0xddab('0x114')](_0x58633c,_0xddab('0x10e')));this[_0xddab('0x10f')](_0x58633c,_0xddab('0x123'),_0xddab('0x124'));}if(_0x4a477c[_0xddab('0x3e')]===_0xddab('0xbd')&&this[_0xddab('0x1d')][_0x4a477c[_0xddab('0xba')]][_0xddab('0x108')]&&_0x4446f2['value']==='MACHINE'){return new Promise(function(_0x5c7f9e,_0x274a67){delete _0x54ef9b[_0xddab('0xbb')][_0x4446f2[_0xddab('0xbc')]];_0x54ef9b[_0xddab('0xbe')](_0x54ef9b[_0xddab('0x1d')][_0x4a477c['queue']]);_0x54ef9b['campaigns'][_0x4a477c[_0xddab('0xba')]][_0xddab('0xbf')]+=0x1;_0x54ef9b['campaigns'][_0x4a477c[_0xddab('0xba')]][_0xddab('0x125')]+=0x1;var _0x1b1831=_0x54ef9b['campaigns'][_0x4a477c[_0xddab('0xba')]];var _0x1ddf3e=new Hangup(_0x4a477c,_0x4446f2);_0x1ddf3e[_0xddab('0x6d')]=0x13;_0x1ddf3e[_0xddab('0x6e')]=_0xddab('0x112');_0x1ddf3e['membername']=_0xddab('0x10c');_0x1ddf3e[_0xddab('0x113')]+=0x1;_0x1ddf3e['countglobal']+=0x1;_0x1ddf3e['amd']=!![];ami['emit']('custom:amd',ut[_0xddab('0x114')](_0x1ddf3e,_0xddab('0x10e')));hopperUtils[_0xddab('0xc3')](_0x1ddf3e)[_0xddab('0x9e')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1ddf3e[_0xddab('0x116')]+_0x1ddf3e[_0xddab('0x126')]+_0x1ddf3e[_0xddab('0x117')]+_0x1ddf3e[_0xddab('0x118')]+_0x1ddf3e[_0xddab('0xcc')]+_0x1ddf3e[_0xddab('0xe2')]+_0x1ddf3e[_0xddab('0x113')]+_0x1ddf3e['countagentrejectretry']>=_0x1b1831[_0xddab('0x11a')]){_0x54ef9b[_0xddab('0x11b')](_0x1ddf3e,_0x5c7f9e,_0x274a67,'reason19\x20machine....');}else{if(_0x1ddf3e[_0xddab('0x113')]>=_0x1b1831['dialMachineMaxRetry']){_0x54ef9b[_0xddab('0x11e')](_0x1ddf3e,_0x5c7f9e,_0x274a67,'reason\x2019\x20machine....');}else{hopperUtils[_0xddab('0xd4')]({'active':![],'countmachineretry':_0x1ddf3e['countmachineretry'],'scheduledat':moment()['add'](_0x1b1831[_0xddab('0x120')],_0xddab('0xd6'))['format'](_0xddab('0xc7')),'ContactId':_0x1ddf3e[_0xddab('0xe6')],'ListId':_0x1ddf3e[_0xddab('0xd7')],'VoiceQueueId':_0x1ddf3e['VoiceQueueId']||undefined,'CampaignId':_0x1ddf3e[_0xddab('0xd9')]||undefined})['catch'](loggerCatch(_0xddab('0x121')));_0x5c7f9e({'reschedule':0x1});}}});}}};Dialer[_0xddab('0x17')][_0xddab('0x127')]=function(_0x3d17de){var _0x177a4a=this[_0xddab('0xbb')][_0x3d17de[_0xddab('0xbc')]];var _0x3a2ec2;if(_0x177a4a&&_0x177a4a['type']===_0xddab('0xbd')){delete this[_0xddab('0xbb')][_0x3d17de['uniqueid']];this[_0xddab('0xbe')](this[_0xddab('0x1d')][_0x177a4a[_0xddab('0xba')]]);this[_0xddab('0x1d')][_0x177a4a[_0xddab('0xba')]][_0xddab('0x128')]+=0x1;_0x3a2ec2=new Hangup(_0x177a4a,_0x3d17de);hopperUtils['createHistory'](_0x3a2ec2)[_0xddab('0x9e')](loggerCatch(_0xddab('0x129')));hopperUtils[_0xddab('0xc5')](_0x3a2ec2)[_0xddab('0x9e')](loggerCatch(_0xddab('0x12a')));}if(_0x177a4a&&_0x177a4a[_0xddab('0x3e')]!==_0xddab('0xbd')&&isNotNull(this[_0xddab('0x1c')][_0x177a4a[_0xddab('0xba')]][_0xddab('0x12b')])){delete this[_0xddab('0xbb')][_0x3d17de[_0xddab('0xbc')]];this['updateOriginated'](this[_0xddab('0x1c')][_0x177a4a[_0xddab('0xba')]]);this[_0xddab('0x1c')][_0x177a4a['queue']][_0xddab('0xbf')]+=0x1;this['voiceQueues'][_0x177a4a['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x3a2ec2=new Hangup(_0x177a4a,_0x3d17de);_0x3a2ec2['state']=0x10;_0x3a2ec2[_0xddab('0x6e')]='AnswerAGI';_0x3a2ec2[_0xddab('0x10b')]='AGI';hopperUtils[_0xddab('0xc3')](_0x3a2ec2)[_0xddab('0x9e')](loggerCatch(_0xddab('0x129')));hopperUtils[_0xddab('0xc5')](_0x3a2ec2)['catch'](loggerCatch(_0xddab('0x12a')));}if(_0x177a4a&&_0x177a4a['type']!==_0xddab('0xbd')&&!isNotNull(this['voiceQueues'][_0x177a4a['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x3d17de[_0xddab('0xbc')]];this[_0xddab('0xbe')](this[_0xddab('0x1c')][_0x177a4a[_0xddab('0xba')]]);this[_0xddab('0x1c')][_0x177a4a[_0xddab('0xba')]][_0xddab('0x12c')]+=0x1;_0x3a2ec2=new Hangup(_0x177a4a,_0x3d17de);_0x3a2ec2[_0xddab('0x6d')]=0xc;_0x3a2ec2['statedesc']=_0x3d17de[_0xddab('0x12d')];_0x3a2ec2[_0xddab('0x10b')]='Unknow';hopperUtils['createHistory'](_0x3a2ec2)[_0xddab('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x3a2ec2)[_0xddab('0x9e')](loggerCatch(_0xddab('0x12a')));}};Dialer[_0xddab('0x17')][_0xddab('0x9')]=function(_0x135137){var _0x1bf511=this;if(!_0x1bf511[_0xddab('0x12e')][_0x135137[_0xddab('0x60')]]){_0x1bf511[_0xddab('0x12e')][_0x135137[_0xddab('0x60')]]={'running':![]};}else if(_0x1bf511[_0xddab('0x12e')][_0x135137[_0xddab('0x60')]][_0xddab('0x12f')]===!![]){return;}else if(_0x1bf511[_0xddab('0x12e')][_0x135137[_0xddab('0x60')]][_0xddab('0x12f')]===![]){_0x1bf511['queuesSummary'][_0x135137[_0xddab('0x60')]][_0xddab('0x12f')]=!![];}var _0x1825cc=_0x1bf511[_0xddab('0x1c')][_0x135137[_0xddab('0x60')]];var _0x551225=_0x1825cc[_0xddab('0x6a')]!==utils[_0xddab('0x67')][_0xddab('0x78')];var _0x245432=utils[_0xddab('0x130')](_0x1825cc);_0x1825cc[_0xddab('0x131')]=utils['getQueueCampaignStatusMessage'](_0x1825cc,_0x1bf511['trunks']);Promise[_0xddab('0xa8')]()[_0xddab('0x3b')](function(){if(_0x1825cc[_0xddab('0x131')]===utils[_0xddab('0x67')][_0xddab('0x78')]){if(_0x551225){clearPredictiveAttributes(_0x1825cc);_0x135137[_0xddab('0x25')]=undefined;_0x135137[_0xddab('0x26')]=undefined;}if(_0x1825cc['statusMessage']===utils[_0xddab('0x67')]['INACTIVE']){_0x135137[_0xddab('0x132')]=0x0;_0x135137[_0xddab('0xed')]=0x0;_0x135137['inUse']=0x0;_0x135137[_0xddab('0x133')]=0x0;_0x135137[_0xddab('0x134')]=0x0;}}else if(_0x1825cc[_0xddab('0x131')]===utils['CAMPAIGN_STATUS'][_0xddab('0x135')]&&!_0x245432){return _0x1bf511[_0xddab('0x93')](_0x1825cc,!![])[_0xddab('0x3b')](function(){return _0x1bf511[_0xddab('0x93')](_0x1825cc,![]);})[_0xddab('0x3b')](function(){return _0x1bf511[_0xddab('0xae')](_0x1825cc);})['catch'](function(_0x3defbb){loggerSyncQueueSummary[_0xddab('0x40')](_0xddab('0x136'),util[_0xddab('0x42')](_0x3defbb,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1825cc);});}else{clearPredictiveAttributes(_0x1825cc);}})['then'](function(){var _0xa3e50f=_0x135137[_0xddab('0x137')](_0x1825cc);if(_0xa3e50f||_0x1825cc['queueSummaryCountersUpdated']){_0x1825cc['queueSummaryCountersUpdated']=![];_0x135137[_0xddab('0x138')](_0x1825cc);Object[_0xddab('0x139')](_0x1825cc,_0x135137);emitOutboundVoiceQueueSummary(_0x135137);}_0x1bf511[_0xddab('0x12e')][_0x1825cc[_0xddab('0x60')]][_0xddab('0x12f')]=![];})['catch'](function(_0x580833){logger[_0xddab('0x64')](_0xddab('0x136'),util['inspect'](_0x580833,{'showHidden':![],'depth':null}));_0x1bf511[_0xddab('0x12e')][_0x1825cc[_0xddab('0x60')]][_0xddab('0x12f')]=![];});};Dialer['prototype'][_0xddab('0x32')]=_['throttle'](function(){var _0x35e2e9=_['filter'](this['voiceQueues'],function(_0x30aa5d){return _0x30aa5d[_0xddab('0x13a')];});var _0x1c67a7=_[_0xddab('0x13b')](this[_0xddab('0x1e')],function(_0x3adf55){return _0x3adf55[_0xddab('0x13c')]&&_0x3adf55[_0xddab('0x86')]===_0xddab('0x13d');});if(_0x35e2e9[_0xddab('0x95')]>0x0&&_0x1c67a7[_0xddab('0x95')]>0x0){return Promise[_0xddab('0xa8')]()[_0xddab('0x3b')](cmHopper['handlePreviewRecallNotifications'](_[_0xddab('0x13e')](_0x35e2e9,'id'),previewRecallmeReminderInterval,_['map'](_0x1c67a7,'id')))['then'](function(_0x154112){for(var _0xe55fd8=0x0;_0xe55fd8<_0x154112['length'];_0xe55fd8++){var _0x130fff=_0x154112[_0xe55fd8][_0xddab('0x13f')][_0xddab('0x60')];if(_0x130fff)io['to'](util[_0xddab('0x87')](_0xddab('0x140'),_0x130fff))[_0xddab('0x3d')](_0xddab('0x141'),{'hopper':_0x154112[_0xe55fd8]});}})[_0xddab('0x9e')](function(_0x123bb9){logger[_0xddab('0x64')]('checkPreviewRecallReminder',_0x123bb9);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x22ed15=this;setInterval(function(){_0x22ed15[_0xddab('0x142')](_0x22ed15[_0xddab('0xbb')],_0xddab('0x143'));_0x22ed15[_0xddab('0x142')](_0x22ed15['actions'],_0xddab('0x144'));},0x32c8);};Dialer[_0xddab('0x17')][_0xddab('0x142')]=function(_0x3886a7,_0x40c03f){var _0x3fccc6=this;for(var _0x48ef10 in _0x3886a7){if(typeof _0x3886a7[_0x48ef10]!=='undefined'){this['sequence'][_0xddab('0x18')](function(){if(!_['isNil'](_0x3886a7[_0x48ef10])){return ami[_0xddab('0x9c')]({'action':'status','channel':_0x3886a7[_0x48ef10][_0xddab('0xe8')]})[_0xddab('0x9e')](function(_0xbe790d){if(_0xbe790d['message']===_0xddab('0x145')){setTimeout(function(){if(_0x3886a7[_0x48ef10]&&_0x3886a7[_0x48ef10][_0xddab('0x3e')]!==_0xddab('0xbd')){_0x3fccc6[_0xddab('0xbe')](_0x3fccc6['voiceQueues'][_0x3886a7[_0x48ef10]['queue']]);logger[_0xddab('0x64')](_0xddab('0x146'),_0x40c03f,_0x48ef10,_0x3886a7[_0x48ef10][_0xddab('0xba')]);delete _0x3886a7[_0x48ef10];}if(_0x3886a7[_0x48ef10]&&_0x3886a7[_0x48ef10][_0xddab('0x3e')]===_0xddab('0xbd')){_0x3fccc6[_0xddab('0xbe')](_0x3fccc6[_0xddab('0x1d')][_0x3886a7[_0x48ef10][_0xddab('0xba')]]);logger[_0xddab('0x64')](_0xddab('0x147'),_0x40c03f,_0x48ef10,_0x3886a7[_0x48ef10][_0xddab('0xba')]);delete _0x3886a7[_0x48ef10];}},0x2328);}});}});}}};Dialer[_0xddab('0x17')][_0xddab('0x148')]=function(_0x56d091){return Promise[_0xddab('0xa8')]()[_0xddab('0x3b')](voiceQueueRt[_0xddab('0x148')](_0x56d091))[_0xddab('0x9e')](loggerCatch(_0xddab('0x149')));};Dialer['prototype']['updateOriginated']=function(_0x54ea38){if(!_[_0xddab('0x50')](_0x54ea38)&&_0x54ea38!==null){if(typeof _0x54ea38[_0xddab('0x7c')]!=='undefined'){if(_0x54ea38['originated']>0x0){_0x54ea38['originated']-=0x1;}else{logger['error'](_0xddab('0x14a'));}}}else{logger[_0xddab('0x64')](_0xddab('0x14b'));}};Dialer['prototype'][_0xddab('0x14c')]=function(_0x23e3c5,_0x36a0d3){var _0x32667a=this;return function(_0x2a6f2d){_0x32667a[_0xddab('0xbe')](_0x36a0d3);logger[_0xddab('0x64')](_0x23e3c5,util[_0xddab('0x42')](_0x2a6f2d,{'showHidden':![],'depth':null}));};};Dialer[_0xddab('0x17')]['emptyContact']=function(_0xd794e,_0x6bdf2,_0x461f1f){var _0x41c82e={'state':0x19,'statedesc':_0xddab('0x14d')};this[_0xddab('0xbe')](_0x6bdf2);this['saveInDb'](_['merge'](_0x41c82e,_['pick'](_0x461f1f,[_0xddab('0xe6'),_0xddab('0xd7'),_0xddab('0x14e'),_0xddab('0xd8'),_0xddab('0xd9')])),_0xddab('0x14f'),'[emptyContact]');logger[_0xddab('0x64')](_0xd794e);};Dialer[_0xddab('0x17')]['saveInDb']=function(_0x522513,_0xe20fbe,_0xc5d587){hopperUtils[_0xddab('0xc3')](_0x522513)['catch'](loggerCatch(_0xe20fbe));hopperUtils['moveContactManagedDialer'](_0x522513)['catch'](loggerCatch(_0xc5d587));};Dialer[_0xddab('0x17')]['queueCallerAbandonCreateState']=function(_0x3fbae2,_0x69b252){hopperUtils[_0xddab('0xc3')](_0x3fbae2)[_0xddab('0x9e')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x69b252==0x0){hopperUtils[_0xddab('0xc5')](_0x3fbae2)[_0xddab('0x9e')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xddab('0x17')][_0xddab('0x150')]=function(_0x1abebd){return Promise['resolve']()['then'](cmHopper[_0xddab('0x151')](_0x1abebd['id'],previewRecallmeReminderInterval))[_0xddab('0x3b')](function(_0x3f6341){for(var _0xaabd3d=0x0;_0xaabd3d<_0x3f6341[_0xddab('0x95')];_0xaabd3d++){var _0x11db51=_0x3f6341[_0xaabd3d]['Agent'][_0xddab('0x60')];if(_0x11db51)io['to'](util['format'](_0xddab('0x140'),_0x11db51))['emit'](_0xddab('0x141'),{'hopper':_0x3f6341[_0xaabd3d]});}})[_0xddab('0x9e')](function(){});};Dialer[_0xddab('0x17')][_0xddab('0xac')]=function(_0x21b9cd){var _0x3e8cf0=this;return function(){_0x3e8cf0['handleIvr'](_0x21b9cd);};};Dialer[_0xddab('0x17')][_0xddab('0x152')]=function(_0x23f146,_0x6cb7ec){var _0x2eef52=this;var _0x3f4b7d=uuid['v4']();this['actions'][_0x3f4b7d]=new Action(_0x23f146,_0x6cb7ec,_0x3f4b7d);return new Promise(function(_0x597857,_0x1d3f17){if(_['isUndefined'](_0x23f146)&&typeof _0x23f146!=='object'){return _0x1d3f17(msgResponse(_0xddab('0x153'),_0xddab('0x8f'),_0xddab('0x154')));}if(_[_0xddab('0x50')](_0x6cb7ec['phone'])||_0x6cb7ec['phone']===null){return _0x1d3f17(msgResponse(_0xddab('0x153'),'Failure',_0xddab('0x155')));}var _0x536cb0={'XMD-CALLERID':_0x2eef52[_0xddab('0x22')][_0x3f4b7d][_0xddab('0x156')](),'XMD-AGI':_0x23f146[_0xddab('0x12b')]?util[_0xddab('0x87')](_0xddab('0x157'),ipAgi,_0x23f146['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x23f146['dialQueueProject2']?util[_0xddab('0x87')](_0xddab('0x157'),ipAgi,_0x23f146[_0xddab('0xcb')]):_0xddab('0x158'),'XMD-QUEUE':utils['isOutboundQueue'](_0x23f146)?util[_0xddab('0x87')]('\x22%s,%s%s,,,%s\x22',_0x23f146['name'],_0x23f146[_0xddab('0x159')]||'',_0x23f146[_0xddab('0xc2')]?'c':'',_0x23f146[_0xddab('0x15a')]||0x3):_0xddab('0x158'),'XMD-CONTACTID':_0x6cb7ec[_0xddab('0xe6')],'XMD-CDRTYPE':_0xddab('0x6'),'CALLERID(all)':_0x2eef52[_0xddab('0x22')][_0x3f4b7d][_0xddab('0x156')](),'XMD-AMD':_0x23f146[_0xddab('0x108')]?_0xddab('0x135'):_0xddab('0x158'),'XMD-DESTINATION':_0xddab('0x107')};if(_0x23f146['dialAMDActive']){_0x536cb0['XMD-AMDINITIALSILENCE']=_0x23f146[_0xddab('0x15b')]||0x9c4;_0x536cb0[_0xddab('0x15c')]=_0x23f146['dialAMDGreeting']||0x5dc;_0x536cb0['XMD-AMDAFTERGREETINGSILENCE']=_0x23f146['dialAMDAfterGreetingSilence']||0x320;_0x536cb0[_0xddab('0x15d')]=_0x23f146[_0xddab('0x15e')]||0x1388;_0x536cb0[_0xddab('0x15f')]=_0x23f146[_0xddab('0x160')]||0x64;_0x536cb0[_0xddab('0x161')]=_0x23f146['dialAMDBetweenWordsSilence']||0x32;_0x536cb0['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x23f146[_0xddab('0x162')]||0x3;_0x536cb0['XMD-AMDSILENCETHRESHOLD']=_0x23f146[_0xddab('0x163')]||0x100;_0x536cb0[_0xddab('0x164')]=_0x23f146[_0xddab('0x165')]||0x1388;}if(utils[_0xddab('0x166')](_0x23f146)){_0x536cb0[_0xddab('0x167')]=_0x6cb7ec[_0xddab('0xd8')];}else{_0x536cb0['XMD-CAMPAIGNID']=_0x6cb7ec['CampaignId'];}var _0x2d3c68=utils[_0xddab('0x168')](_0x6cb7ec['Contact']);Object['assign'](_0x536cb0,_0x2d3c68);var _0x5802f0=_0x2eef52[_0xddab('0x84')](_0x23f146[_0xddab('0x169')])?utils[_0xddab('0x16a')](_0x23f146[_0xddab('0x169')][_0xddab('0x16b')],_0x23f146[_0xddab('0x16c')],_0x23f146['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xddab('0x16d')](_0x23f146[_0xddab('0x16e')],_0x23f146[_0xddab('0x16f')]):_0x23f146[_0xddab('0x16e')]):utils['getCallerId'](_[_0xddab('0xeb')](_0x23f146['TrunkBackup'])?_0x23f146['Trunk'][_0xddab('0x16b')]:_0x23f146['TrunkBackup']['callerid'],_0x23f146[_0xddab('0x16c')],_0x23f146[_0xddab('0x16f')]>0x0?utils[_0xddab('0x16d')](_0x23f146[_0xddab('0x16e')],_0x23f146['dialRandomLastDigitCallerIdNumber']):_0x23f146[_0xddab('0x16e')]);if(_0x5802f0){_0x536cb0[_0xddab('0x170')]=_0x2eef52['actions'][_0x3f4b7d][_0xddab('0x171')]=utils[_0xddab('0x172')](_0x5802f0);_0x536cb0[_0xddab('0x173')]=_0x6cb7ec[_0xddab('0x174')];}_0x23f146[_0xddab('0x175')]=_0x536cb0;return ami[_0xddab('0x9c')]({'actionid':_0x3f4b7d,'action':_0xddab('0x153'),'channel':_0x2eef52['isTrunkReachable'](_0x23f146[_0xddab('0x169')])?util[_0xddab('0x87')](_0xddab('0x176'),_0x23f146[_0xddab('0x169')][_0xddab('0x60')],isNotNull(_0x23f146[_0xddab('0x177')])?_0x23f146[_0xddab('0x177')][_0xddab('0x178')]()||'':'',_0x23f146[_0xddab('0x179')]>0x0?_0x6cb7ec[_0xddab('0x174')][_0xddab('0x17a')](_0x23f146[_0xddab('0x179')]):_0x6cb7ec[_0xddab('0x174')]):util[_0xddab('0x87')](_0xddab('0x176'),_[_0xddab('0xeb')](_0x23f146['TrunkBackup'])?_0x23f146['Trunk'][_0xddab('0x60')]:_0x23f146[_0xddab('0x8b')][_0xddab('0x60')],isNotNull(_0x23f146['dialPrefix'])?_0x23f146[_0xddab('0x177')][_0xddab('0x178')]()||'':'',_0x23f146['dialCutDigit']>0x0?_0x6cb7ec[_0xddab('0x174')][_0xddab('0x17a')](_0x23f146[_0xddab('0x179')]):_0x6cb7ec[_0xddab('0x174')]),'callerid':_0x5802f0,'Exten':'xcally-motion-dialer','Context':_0xddab('0x17b'),'Priority':'1','variable':_0x536cb0,'timeout':(_0x23f146[_0xddab('0x17c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f4b7d})[_0xddab('0x3b')](function(_0x4107a2){return _0x597857(_0x4107a2);})['catch'](function(_0x1ec801){_0x23f146[_0xddab('0x17d')]+=0x1;var _0x29b35c=new History(_0x2eef52[_0xddab('0x22')][_0x3f4b7d]);logger[_0xddab('0x64')](util[_0xddab('0x87')](_0xddab('0x17e'),JSON[_0xddab('0x73')](_0x1ec801)));_0x29b35c[_0xddab('0x6d')]=0xe;_0x29b35c[_0xddab('0x6e')]=_0xddab('0x17f');_0x29b35c['starttime']=moment()[_0xddab('0x87')](_0xddab('0xc7'));_0x29b35c[_0xddab('0x6f')]=_0x29b35c['starttime'];hopperUtils[_0xddab('0xc3')](_0x29b35c)[_0xddab('0x9e')](loggerCatch(_0xddab('0x180')));_0x2eef52[_0xddab('0xc5')](_0x29b35c)[_0xddab('0x9e')](loggerCatch(_0xddab('0x180')))['finally'](function(){delete _0x2eef52['actions'][_0x3f4b7d];return _0x1d3f17(msgResponse(_0xddab('0x153'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xddab('0x17')][_0xddab('0x181')]=function(_0x27a777,_0x3bc496,_0x5af9f7){var _0x2a4169=new History(_0x3bc496);if(_0x2a4169[_0xddab('0x116')]+_0x2a4169['countcongestionretry']+_0x2a4169[_0xddab('0x117')]+_0x2a4169['countnosuchnumberretry']+_0x2a4169[_0xddab('0xcc')]+_0x2a4169[_0xddab('0xe2')]+_0x2a4169[_0xddab('0x113')]+_0x2a4169[_0xddab('0x119')]>=_0x5af9f7['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x27a777){case 0x3:if(_0x2a4169[_0xddab('0x117')]>=_0x5af9f7[_0xddab('0x182')]-0x1){return!![];}hopperUtils[_0xddab('0xd4')]({'active':![],'countnoanswerretry':_0x2a4169[_0xddab('0x117')]+=0x1,'scheduledat':moment()[_0xddab('0xd5')](_0x5af9f7[_0xddab('0x183')],_0xddab('0xd6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a4169[_0xddab('0xe6')],'ListId':_0x2a4169['ListId'],'VoiceQueueId':_0x2a4169['VoiceQueueId']||undefined,'CampaignId':_0x2a4169[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch(_0xddab('0x184')));break;case 0x5:if(_0x2a4169[_0xddab('0x116')]>=_0x5af9f7[_0xddab('0x185')]-0x1){return!![];}hopperUtils[_0xddab('0xd4')]({'active':![],'countbusyretry':_0x2a4169[_0xddab('0x116')]+=0x1,'scheduledat':moment()[_0xddab('0xd5')](_0x5af9f7[_0xddab('0x186')],_0xddab('0xd6'))['format'](_0xddab('0xc7')),'ContactId':_0x2a4169[_0xddab('0xe6')],'ListId':_0x2a4169[_0xddab('0xd7')],'VoiceQueueId':_0x2a4169['VoiceQueueId']||undefined,'CampaignId':_0x2a4169[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2a4169[_0xddab('0x126')]>=_0x5af9f7[_0xddab('0x187')]-0x1){return!![];}hopperUtils[_0xddab('0xd4')]({'active':![],'countcongestionretry':_0x2a4169[_0xddab('0x126')]+=0x1,'scheduledat':moment()[_0xddab('0xd5')](_0x5af9f7[_0xddab('0x188')],'minutes')[_0xddab('0x87')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a4169['ContactId'],'ListId':_0x2a4169[_0xddab('0xd7')],'VoiceQueueId':_0x2a4169[_0xddab('0xd8')]||undefined,'CampaignId':_0x2a4169[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2a4169[_0xddab('0x118')]>=_0x5af9f7['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x2a4169[_0xddab('0x118')]+=0x1,'scheduledat':moment()['add'](_0x5af9f7[_0xddab('0x189')],_0xddab('0xd6'))['format'](_0xddab('0xc7')),'ContactId':_0x2a4169[_0xddab('0xe6')],'ListId':_0x2a4169[_0xddab('0xd7')],'VoiceQueueId':_0x2a4169[_0xddab('0xd8')]||undefined,'CampaignId':_0x2a4169[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch(_0xddab('0x18a')));}break;case 0xa:if(_0x2a4169[_0xddab('0xcc')]>=_0x5af9f7[_0xddab('0xd2')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2a4169[_0xddab('0xcc')]+=0x1,'scheduledat':moment()[_0xddab('0xd5')](_0x5af9f7[_0xddab('0xce')],'minutes')[_0xddab('0x87')](_0xddab('0xc7')),'ContactId':_0x2a4169['ContactId'],'ListId':_0x2a4169[_0xddab('0xd7')],'VoiceQueueId':_0x2a4169[_0xddab('0xd8')]||undefined,'CampaignId':_0x2a4169[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2a4169[_0xddab('0xe2')]>=_0x5af9f7['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xddab('0xd4')]({'active':![],'countabandonedretry':_0x2a4169[_0xddab('0xe2')]+=0x1,'scheduledat':moment()[_0xddab('0xd5')](_0x5af9f7[_0xddab('0xe3')],_0xddab('0xd6'))[_0xddab('0x87')](_0xddab('0xc7')),'ContactId':_0x2a4169['ContactId'],'ListId':_0x2a4169[_0xddab('0xd7')],'VoiceQueueId':_0x2a4169[_0xddab('0xd8')]||undefined,'CampaignId':_0x2a4169['CampaignId']||undefined})[_0xddab('0x9e')](loggerCatch(_0xddab('0x18b')));break;case 0x13:if(_0x2a4169[_0xddab('0x113')]>=_0x5af9f7['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2a4169[_0xddab('0x113')]+=0x1,'scheduledat':moment()[_0xddab('0xd5')](_0x5af9f7['dialMachineRetryFrequency'],_0xddab('0xd6'))[_0xddab('0x87')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a4169[_0xddab('0xe6')],'ListId':_0x2a4169[_0xddab('0xd7')],'VoiceQueueId':_0x2a4169[_0xddab('0xd8')]||undefined,'CampaignId':_0x2a4169[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2a4169[_0xddab('0x119')]>=_0x5af9f7[_0xddab('0x18c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x2a4169[_0xddab('0x119')]+=0x1,'scheduledat':moment()[_0xddab('0xd5')](_0x5af9f7['dialAgentRejectRetryFrequency'],_0xddab('0xd6'))[_0xddab('0x87')](_0xddab('0xc7')),'ContactId':_0x2a4169[_0xddab('0xe6')],'ListId':_0x2a4169[_0xddab('0xd7')],'VoiceQueueId':_0x2a4169[_0xddab('0xd8')]||undefined,'CampaignId':_0x2a4169[_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch(_0xddab('0x18d')));break;default:return!![];}};Dialer[_0xddab('0x17')][_0xddab('0x18e')]=function(_0x212401,_0x9d360c,_0x18bccd){var _0x19991a=this;var _0x391bf8=new History(_0x212401);var _0x28278c=![];var _0x50d986;var _0x5dd977;return new Promise(function(_0x35fdbf,_0x3808a5){if(_[_0xddab('0x50')](_0x9d360c)&&typeof _0x9d360c!==_0xddab('0x18f')){return _0x3808a5(msgResponse(_0xddab('0x190'),_0xddab('0x8f'),'entity\x20is\x20undefine'));}if(_[_0xddab('0x50')](_0x18bccd)&&typeof _0x18bccd!==_0xddab('0x18f')){return _0x3808a5(msgResponse(_0xddab('0x190'),_0xddab('0x8f'),_0xddab('0x191')));}hopperUtils[_0xddab('0xd0')](_0x391bf8,_0x18bccd[_0xddab('0xc0')],_0x9d360c)[_0xddab('0x3b')](function(_0x1b7759){if(_0x1b7759[_0xddab('0xe5')]==0x1)_0x28278c=!![];switch(_0x18bccd[_0xddab('0xc0')]){case'0':_0x9d360c[_0xddab('0x192')]+=0x1;_0x391bf8[_0xddab('0x6d')]=0x0;_0x391bf8[_0xddab('0x6e')]=_0xddab('0x193');_0x391bf8[_0xddab('0x118')]+=0x1;_0x391bf8[_0xddab('0xcd')]+=0x1;ami[_0xddab('0x3d')](_0xddab('0x194'),ut['buildObj'](_0x212401,_0xddab('0x195')));_0x50d986=_0x9d360c[_0xddab('0x189')];_0x5dd977=_0x9d360c[_0xddab('0xcf')];hopperUtils[_0xddab('0xc3')](_0x391bf8)[_0xddab('0x9e')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x19991a[_0xddab('0x181')](0x0,_0x212401,_0x9d360c)&&!_0x28278c){if(_0x391bf8[_0xddab('0x118')]>=_0x9d360c[_0xddab('0x196')]){_0x19991a[_0xddab('0x11e')](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x197'));}else{_0x19991a[_0xddab('0x11b')](_0x391bf8,_0x35fdbf,_0x3808a5,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x9d360c[_0xddab('0x198')]+=0x1;_0x391bf8[_0xddab('0x6d')]=0x3;_0x391bf8[_0xddab('0x6e')]=_0xddab('0x199');_0x391bf8[_0xddab('0x117')]+=0x1;_0x391bf8['countglobal']+=0x1;var _0x3e8ff1=ut[_0xddab('0x19a')](_0x212401,_0x9d360c);ami['emit'](_0xddab('0x19b'),_0x3e8ff1);_0x50d986=_0x9d360c[_0xddab('0x183')];_0x5dd977=_0x9d360c[_0xddab('0xcf')];hopperUtils['createHistory'](_0x391bf8)[_0xddab('0x9e')](loggerCatch(_0xddab('0x19c')));if(_0x19991a[_0xddab('0x181')](0x3,_0x212401,_0x9d360c)&&!_0x28278c){if(_0x391bf8[_0xddab('0x117')]>=_0x9d360c['dialNoAnswerMaxRetry']){_0x19991a['createStateFinal'](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x19d'));}else{_0x19991a[_0xddab('0x11b')](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x19d'));}}break;case'5':_0x9d360c[_0xddab('0x19e')]+=0x1;_0x391bf8[_0xddab('0x6d')]=0x5;_0x391bf8[_0xddab('0x6e')]=_0xddab('0x19f');_0x391bf8['countbusyretry']+=0x1;_0x391bf8[_0xddab('0xcd')]+=0x1;ami[_0xddab('0x3d')](_0xddab('0x1a0'),ut[_0xddab('0x114')](_0x212401,_0xddab('0x1a1')));_0x50d986=_0x9d360c[_0xddab('0x186')];_0x5dd977=_0x9d360c[_0xddab('0xcf')];hopperUtils[_0xddab('0xc3')](_0x391bf8)[_0xddab('0x9e')](loggerCatch(_0xddab('0x1a2')));if(_0x19991a[_0xddab('0x181')](0x5,_0x212401,_0x9d360c)&&!_0x28278c){if(_0x391bf8[_0xddab('0x116')]>=_0x9d360c['dialBusyMaxRetry']){_0x19991a['createStateFinal'](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x1a3'));}else{_0x19991a['stateGlobal'](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x1a3'));}}break;case'8':_0x9d360c[_0xddab('0x1a4')]+=0x1;_0x391bf8[_0xddab('0x6d')]=0x8;_0x391bf8[_0xddab('0x6e')]=_0xddab('0x1a5');_0x391bf8[_0xddab('0x126')]+=0x1;_0x391bf8[_0xddab('0xcd')]+=0x1;_0x50d986=_0x9d360c[_0xddab('0x188')];_0x5dd977=_0x9d360c[_0xddab('0xcf')];ami[_0xddab('0x3d')]('custom:agentcongestion',ut['buildObj'](_0x212401,_0xddab('0x1a6')));hopperUtils['createHistory'](_0x391bf8)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x19991a[_0xddab('0x181')](0x8,_0x212401,_0x9d360c)&&!_0x28278c){if(_0x391bf8['countcongestionretry']>=_0x9d360c['dialCongestionMaxRetry']){_0x19991a[_0xddab('0x11e')](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x1a7'));}else{_0x19991a[_0xddab('0x11b')](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x1a7'));}}break;case'11':_0x9d360c['outboundAbandonedCallsDay']+=0x1;_0x391bf8[_0xddab('0x6d')]=0xb;_0x391bf8['statedesc']=_0xddab('0xe0');_0x391bf8[_0xddab('0xe2')]+=0x1;_0x391bf8[_0xddab('0xcd')]+=0x1;_0x50d986=_0x9d360c[_0xddab('0xe3')];_0x5dd977=_0x9d360c[_0xddab('0xcf')];hopperUtils[_0xddab('0xc3')](_0x391bf8)[_0xddab('0x9e')](loggerCatch(_0xddab('0xe7')));if(_0x19991a[_0xddab('0x181')](0xb,_0x212401,_0x9d360c)&&!_0x28278c){if(_0x391bf8[_0xddab('0xe2')]>=_0x9d360c[_0xddab('0xe4')]){_0x19991a['createStateFinal'](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x1a8'));}else{_0x19991a[_0xddab('0x11b')](_0x391bf8,_0x35fdbf,_0x3808a5,'reason\x2011\x20abandoned');}}break;case'20':_0x9d360c[_0xddab('0x1a9')]+=0x1;_0x391bf8[_0xddab('0x6d')]=0x14;_0x391bf8[_0xddab('0x6e')]=_0xddab('0x1aa');_0x391bf8[_0xddab('0x119')]+=0x1;_0x391bf8[_0xddab('0xcd')]+=0x1;_0x50d986=_0x9d360c['dialAgentRejectRetryFrequency'];_0x5dd977=_0x9d360c[_0xddab('0xcf')];ami[_0xddab('0x3d')](_0xddab('0x1ab'),ut[_0xddab('0x114')](_0x212401,_0xddab('0x1ac')));hopperUtils['createHistory'](_0x391bf8)[_0xddab('0x9e')](loggerCatch(_0xddab('0x1ad')));if(_0x19991a[_0xddab('0x181')](0x14,_0x212401,_0x9d360c)&&!_0x28278c){if(_0x391bf8[_0xddab('0x119')]>=_0x9d360c['dialAgentRejectMaxRetry']){_0x19991a[_0xddab('0x11e')](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x1ae'));}else{_0x19991a[_0xddab('0x11b')](_0x391bf8,_0x35fdbf,_0x3808a5,_0xddab('0x1ae'));}}break;default:_0x9d360c[_0xddab('0x12c')]+=0x1;_0x391bf8['state']=0xc;_0x391bf8[_0xddab('0x6e')]=_0x18bccd['reason'];_0x50d986=_0x9d360c['dialAgentRejectRetryFrequency'];_0x5dd977=_0x9d360c[_0xddab('0xcf')];hopperUtils[_0xddab('0xc3')](_0x391bf8)['catch'](loggerCatch(_0xddab('0x1af')));if(_0x19991a[_0xddab('0x181')](_0x18bccd['reason'],_0x212401,_0x9d360c)&&!_0x28278c){if(_0x391bf8[_0xddab('0x116')]+_0x391bf8[_0xddab('0x126')]+_0x391bf8['countnoanswerretry']+_0x391bf8[_0xddab('0x118')]+_0x391bf8['countdropretry']+_0x391bf8['countabandonedretry']+_0x391bf8[_0xddab('0x113')]+_0x391bf8[_0xddab('0x119')]>=_0x9d360c['dialGlobalMaxRetry']){_0x19991a[_0xddab('0x11b')](_0x391bf8,_0x35fdbf,_0x3808a5,_0x18bccd['reason']);}else{_0x19991a[_0xddab('0x11e')](_0x391bf8,_0x35fdbf,_0x3808a5,_0x18bccd[_0xddab('0xc0')]);}}}})['then'](function(){if(_0x28278c){hopperUtils[_0xddab('0xde')](_0x391bf8,_0x50d986,_0x5dd977)[_0xddab('0x3b')](function(){return _0x35fdbf(0x1);});}});});};Dialer[_0xddab('0x17')][_0xddab('0x11b')]=function(_0x284c5,_0x423066,_0x17ac44,_0x5a9074){var _0x2c4d8d=new Final(_0x284c5);_0x2c4d8d[_0xddab('0x6d')]=0xf;_0x2c4d8d['statedesc']=_0xddab('0x1b0');this[_0xddab('0x11e')](_0x2c4d8d,_0x423066,_0x17ac44,_0x5a9074);};Dialer[_0xddab('0x17')]['createStateFinal']=function(_0x519406,_0x29e0f9,_0x36d16b,_0x568aa6){hopperUtils[_0xddab('0xc5')](_0x519406)[_0xddab('0x3b')](function(){return _0x29e0f9(msgResponse(_0xddab('0x190'),_0xddab('0x103'),_0x568aa6));})[_0xddab('0x9e')](function(){return _0x36d16b(msgResponse(_0xddab('0x1b1'),_0xddab('0x8f'),_0xddab('0x1b2')));});};Dialer[_0xddab('0x17')][_0xddab('0x7')]=function(_0x178809){var _0x4db4b4=_0x178809['dialPredictiveOptimizationPercentage']/0x64;var _0x1bb34c=_0x178809[_0xddab('0x1b3')]/(_0x178809[_0xddab('0x1b3')]+_0x178809[_0xddab('0xbf')]);var _0x87d40a=Math['round'](_0x178809[_0xddab('0x1b4')]*(_0x178809['predictiveIntervalMaxThreshold']/0x64));var _0x1b954f=Math['round'](_0x178809[_0xddab('0x1b4')]*(_0x178809[_0xddab('0x1b5')]/0x64));var _0x5234ac=_0x178809[_0xddab('0x132')]+_0x178809[_0xddab('0x133')];var _0x2b6497=Math[_0xddab('0x1b6')](_0x178809[_0xddab('0x58')]*_0x178809[_0xddab('0x5b')]*_0x178809[_0xddab('0x1b7')]*_0x178809['predictiveIntervalMultiplicativeFactor']);if(_[_0xddab('0x50')](_0x178809[_0xddab('0x26')])){if(!_[_0xddab('0x50')](_0x178809[_0xddab('0x25')])){_0x178809[_0xddab('0x25')]=undefined;loggerPredictive[_0xddab('0x64')](_0xddab('0x1b8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x178809['handlePredictive'])){loggerPredictive['error'](_0xddab('0x1b8'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x178809[_0xddab('0x62')]);_0x178809[_0xddab('0x62')]=undefined;}_0x178809[_0xddab('0x26')]=moment()[_0xddab('0x87')](_0xddab('0xc7'));loggerPredictive['info'](_0x178809[_0xddab('0x60')],'collection\x20data\x20in\x20progressive\x20at',_0x178809[_0xddab('0x26')]);this[_0xddab('0xb1')](_0x178809,0x1);}else if(ifInterval(_0x178809[_0xddab('0x1b9')],_0x178809[_0xddab('0x26')])){this[_0xddab('0xb1')](_0x178809,0x1);loggerPredictiveCalls[_0xddab('0x48')]('[startMethodPredictive][StartProgressive][Loop]',_0x178809[_0xddab('0x26')],_0x178809[_0xddab('0x60')]);_0x178809[_0xddab('0x58')]=0x0;_0x178809[_0xddab('0xc9')]=0x0;}else if(_0x4db4b4<_0x1bb34c&&_0x178809[_0xddab('0x1ba')]===_0xddab('0x1bb')){clearPredictiveAttributes(_0x178809);loggerPredictive[_0xddab('0x48')](_0xddab('0x1bc'),'Dropped\x20calls\x20day',_0x1bb34c,'startProgressive',_0x178809[_0xddab('0x60')]);}else if(_0x2b6497<_0x178809[_0xddab('0xc9')]&&_0x178809['dialPredictiveOptimization']===_0xddab('0x1bb')){clearPredictiveAttributes(_0x178809);loggerPredictive[_0xddab('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x2b6497,_0xddab('0x1bd'),_0x178809[_0xddab('0xc9')],_0xddab('0x26'),_0x178809['name']);}else if(!ifInterval(_0x178809['dialPredictiveInterval'],_0x178809[_0xddab('0x26')])&&_[_0xddab('0x50')](_0x178809[_0xddab('0x25')])&&!_['isUndefined'](_0x178809[_0xddab('0x26')])){_0x178809[_0xddab('0x25')]=moment()[_0xddab('0x87')](_0xddab('0xc7'));loggerPredictive[_0xddab('0x48')](_0x178809['name'],_0xddab('0x1be'),_0x178809[_0xddab('0x25')]);hopperUtils[_0xddab('0x1bf')](_0x178809[_0xddab('0x1b9')])[_0xddab('0x3b')](this[_0xddab('0x1c0')](_0x178809))[_0xddab('0x3b')](mergeDataErlangB(_0x178809))['then'](this[_0xddab('0x1c1')](_0x178809))[_0xddab('0x9e')](loggerCatchPredictive(_0xddab('0x1c2'),_0x178809));}else if(!ifInterval(_0x178809[_0xddab('0x1b9')],_0x178809[_0xddab('0x25')])){_0x178809['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x178809[_0xddab('0x25')]=moment()[_0xddab('0x87')](_0xddab('0xc7'));loggerPredictive[_0xddab('0x48')](_0x178809[_0xddab('0x60')],_0xddab('0x1c3'),_0x178809['startPredictive']);clearInterval(_0x178809[_0xddab('0x62')]);_0x178809[_0xddab('0x62')]=undefined;hopperUtils[_0xddab('0x1bf')](_0x178809['dialPredictiveInterval'])[_0xddab('0x3b')](this['getDataPredictive'](_0x178809))[_0xddab('0x3b')](mergeDataErlangB(_0x178809))[_0xddab('0x3b')](this['startMethodPredictive'](_0x178809))[_0xddab('0x9e')](loggerCatchPredictive(_0xddab('0x1c4'),_0x178809));}else if(_0x178809['predictiveIntervalAvailable']&&_0x5234ac<_0x178809[_0xddab('0x1b4')]-_0x1b954f){clearPredictiveAttributes(_0x178809);loggerPredictive[_0xddab('0x48')](_0x178809['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5234ac,')\x20are\x20less\x20than\x20threshold\x20(',_0x178809[_0xddab('0x1b4')],'-',_0x1b954f,'=',_0x178809[_0xddab('0x1b4')]-_0x1b954f,')');}else if(_0x178809[_0xddab('0x1b4')]&&_0x5234ac>_0x178809[_0xddab('0x1b4')]+_0x87d40a){clearPredictiveAttributes(_0x178809);loggerPredictive['info'](_0x178809[_0xddab('0x60')],_0xddab('0x1c5'),_0x5234ac,')\x20are\x20more\x20than\x20threshold\x20(',_0x178809['predictiveIntervalAvailable'],'+',_0x87d40a,'=',_0x178809['predictiveIntervalAvailable']+_0x87d40a,')');}};Dialer[_0xddab('0x17')][_0xddab('0x1c0')]=function(_0x1c9aef){var _0x3412af=this;return function(_0x274a3d){return new Promise(function(_0x1d6f4e,_0x5209ea){_[_0xddab('0x5e')](_0x1c9aef,_0x274a3d[0x0]);if(checkGetDataPredictive(_0x274a3d[0x0])){var _0x3abef7=_0x1c9aef[_0xddab('0x1b4')]=_0x1c9aef[_0xddab('0x133')]+_0x1c9aef[_0xddab('0x132')];var _0x181721=_0x1c9aef[_0xddab('0x1b9')]*0x3c;var _0x24f851=_0x274a3d[0x0]['predictiveIntervalAvgTalktime']+_0x274a3d[0x0]['predictiveIntervalAvgHoldtime'];var _0x2c0c66=(_0x274a3d[0x0][_0xddab('0x1c6')]+_0x274a3d[0x0][_0xddab('0x49')]+_0x274a3d[0x0][_0xddab('0x4b')])/_0x274a3d[0x0][_0xddab('0x47')];_0x1c9aef[_0xddab('0x1b7')]=_0x2c0c66>0x0?_0x2c0c66:0x1;switch(_0x1c9aef['dialPredictiveOptimization']){case'dropRate':var _0x329455=_0x1c9aef[_0xddab('0x1c7')]/0x64;return _0x3412af[_0xddab('0x1c8')](_0x3abef7,_0x181721,_0x24f851,_0x2c0c66,_0x329455)[_0xddab('0x3b')](function(_0x9aba30){return _0x1d6f4e(_0x9aba30);});case _0xddab('0x1c9'):var _0x30378f=_0x1c9aef[_0xddab('0x1c7')]/0x64;return _0x3412af[_0xddab('0x1ca')](_0x3abef7,_0x181721,_0x24f851,_0x2c0c66,_0x30378f)[_0xddab('0x3b')](function(_0x5c9976){return _0x1d6f4e(_0x5c9976);});default:return _0x5209ea(msgResponse(_0xddab('0x1cb'),_0xddab('0x8f'),_0xddab('0x1cc')));}}else{return _0x5209ea(msgResponse(_0xddab('0x1cb'),_0xddab('0x8f'),'check\x20failure'));}});};};Dialer['prototype'][_0xddab('0x1cd')]=function(_0x547297){var _0x31bb55=this;return function(_0x4b18f2){return new Promise(function(_0x53dad2,_0x20de96){_[_0xddab('0x5e')](_0x547297,_0x4b18f2[0x0]);if(checkGetDataPredictive(_0x4b18f2[0x0])){loggerPredictive[_0xddab('0x48')](JSON[_0xddab('0x73')](_0x4b18f2[0x0]));if(_0x547297['dialPredictiveOptimization']===_0xddab('0x1bb')){return _0x31bb55['getVoiceQueueRtPauses'](_0x547297['id'])[_0xddab('0x3b')](function(_0x7f183e){var _0x4664b5=_0x547297[_0xddab('0x1ce')]-_0x7f183e[0x0][_0xddab('0x1cf')];var _0xad814d=_0x547297['dialPredictiveInterval']*0x3c;var _0x558d40=_0x4b18f2[0x0]['predictiveIntervalAvgTalktime']+_0x4b18f2[0x0][_0xddab('0x52')];var _0x558a2d=(_0x4b18f2[0x0][_0xddab('0x1c6')]+_0x4b18f2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4b18f2[0x0][_0xddab('0x4b')])/_0x4b18f2[0x0][_0xddab('0x47')];var _0x3d45e1=_0x547297[_0xddab('0x1c7')]/0x64;_0x547297[_0xddab('0x1d0')]=_0x7f183e[0x0][_0xddab('0x1cf')]||0x0;_0x547297[_0xddab('0x1b7')]=_0x558a2d>0x0?_0x558a2d:0x1;return _0x31bb55['abandonmentRate'](_0x4664b5,_0xad814d,_0x558d40,_0x558a2d,_0x3d45e1);})[_0xddab('0x3b')](function(_0x4fb4f8){return _0x53dad2(_0x4fb4f8);})[_0xddab('0x9e')](function(_0x4db8b3){return _0x20de96(msgResponse(_0xddab('0x1d1'),_0xddab('0x8f'),JSON[_0xddab('0x73')](_0x4db8b3)));});}if(_0x547297[_0xddab('0x1ba')]==='agentBusyFactor'){return _0x31bb55[_0xddab('0x148')](_0x547297['id'])[_0xddab('0x3b')](function(_0xc7227f){var _0xee1610=_0x547297[_0xddab('0x1ce')]-_0xc7227f[0x0][_0xddab('0x1cf')];var _0x5dac93=_0x547297[_0xddab('0x1b9')]*0x3c;var _0x5be01f=_0x4b18f2[0x0][_0xddab('0x4e')]+_0x4b18f2[0x0][_0xddab('0x52')];var _0x2ea58b=(_0x4b18f2[0x0]['predictiveIntervalAnsweredCalls']+_0x4b18f2[0x0][_0xddab('0x49')]+_0x4b18f2[0x0][_0xddab('0x4b')])/_0x4b18f2[0x0][_0xddab('0x47')];var _0x16c5c9=_0x547297[_0xddab('0x1c7')]/0x64;_0x547297[_0xddab('0x1d0')]=_0xc7227f[0x0]['outboundQueuePauses']||0x0;_0x547297[_0xddab('0x1b7')]=_0x2ea58b>0x0?_0x2ea58b:0x1;return _0x31bb55[_0xddab('0x1ca')](_0xee1610,_0x5dac93,_0x5be01f,_0x2ea58b,_0x16c5c9);})['then'](function(_0x1ceaa5){return _0x53dad2(_0x1ceaa5);})[_0xddab('0x9e')](function(_0x5b03a4){return _0x20de96(msgResponse(_0xddab('0x1d1'),_0xddab('0x8f'),JSON[_0xddab('0x73')](_0x5b03a4)));});}}else{return _0x20de96(msgResponse(_0xddab('0x1cb'),_0xddab('0x8f'),_0xddab('0x1d2')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x40449e){var _0x1f332d=this;return function(){var _0x17cac7=0x0;var _0x4d5abf=Math[_0xddab('0x1b6')](_0x40449e[_0xddab('0x5a')]*0x3e8);if(_0x4d5abf>0x0){_0x4d5abf=_0x4d5abf<0x64?0x64:_0x4d5abf;loggerPredictive['info'](_0x40449e[_0xddab('0x60')],_0xddab('0x1d3'),_0x4d5abf,'milliseconds');_0x40449e['handlePredictive']=setInterval(function(){_0x1f332d['handlePredictive'](_0x40449e);loggerPredictiveCalls[_0xddab('0x48')](_0xddab('0x1d4'),_0x17cac7+=0x1);},_0x4d5abf);}else{loggerPredictive[_0xddab('0x48')](_0x40449e['name'],_0xddab('0x1d5'));}};};Dialer['prototype'][_0xddab('0x1d6')]=function(_0x382506,_0x2b19f9){var _0x2400ca=this;return function(_0x2f7d09){if(_[_0xddab('0x44')](_0x2f7d09)){if(_['isNil'](_0x2b19f9[_0xddab('0x14e')])||!_0x2b19f9[_0xddab('0x1d7')]){if(_0x382506['dialMethod']===_0xddab('0x1d8')){_0x382506['queueStatusComplete']=_[_0xddab('0x50')](_0x382506[_0xddab('0x71')])?!![]:_0x382506[_0xddab('0x71')];var _0x589f9b=uuid['v4']();_0x2400ca[_0xddab('0x22')][_0x589f9b]=new Action(_0x382506,_0x2b19f9,_0x589f9b);loggerBooked['info'](_0xddab('0x1d9'),_0x589f9b,_0xddab('0x1da'),JSON[_0xddab('0x73')](_0x382506[_0xddab('0x71')]),_0xddab('0x1db'),_0x382506[_0xddab('0x60')]);if(_0x382506['queueStatusComplete']){_0x382506[_0xddab('0x71')]=![];_0x2400ca[_0xddab('0x28')][_0x2400ca[_0xddab('0x22')][_0x589f9b][_0xddab('0xba')]]=[];ami['Action']({'actionid':_0x589f9b,'action':_0xddab('0x1dc'),'queue':_0x382506[_0xddab('0x60')]})['catch'](function(){_0x2400ca[_0xddab('0xbe')](_0x382506);hopperUtils[_0xddab('0xd4')]({'active':![],'ContactId':_0x2400ca[_0xddab('0x22')][_0x589f9b]['ContactId'],'ListId':_0x2400ca[_0xddab('0x22')][_0x589f9b][_0xddab('0xd7')],'VoiceQueueId':_0x2400ca[_0xddab('0x22')][_0x589f9b][_0xddab('0xd8')]||undefined,'CampaignId':_0x2400ca[_0xddab('0x22')][_0x589f9b]['CampaignId']||undefined})['catch'](loggerCatch(_0xddab('0x1dd')));delete _0x2400ca[_0xddab('0x22')][_0x589f9b];});}else{loggerBooked[_0xddab('0x48')](_0xddab('0x1de'),JSON[_0xddab('0x73')](_0x382506[_0xddab('0x71')]),_0xddab('0x1db'),_0x382506[_0xddab('0x60')]);_0x2400ca[_0xddab('0xbe')](_0x382506);hopperUtils[_0xddab('0xd4')]({'active':![],'ContactId':_0x2400ca[_0xddab('0x22')][_0x589f9b][_0xddab('0xe6')],'ListId':_0x2400ca[_0xddab('0x22')][_0x589f9b]['ListId'],'VoiceQueueId':_0x2400ca['actions'][_0x589f9b]['VoiceQueueId']||undefined,'CampaignId':_0x2400ca['actions'][_0x589f9b][_0xddab('0xd9')]||undefined})[_0xddab('0x9e')](loggerCatch(_0xddab('0x1dd')));delete _0x2400ca[_0xddab('0x22')][_0x589f9b];}}else{return _0x2400ca[_0xddab('0x152')](_0x382506,_0x2b19f9);}}else{if(utils['getSeconds'](undefined,_0x2b19f9[_0xddab('0x1df')])<_0x382506[_0xddab('0x1e0')]*0x3c){if(_0x2b19f9['Agent']&&!_0x2b19f9[_0xddab('0x13f')][_0xddab('0x1e1')]){_0x2400ca[_0xddab('0x1b')][_0xddab('0xf9')](_0x2b19f9['id'])[_0xddab('0xfa')](function(){_0x2400ca[_0xddab('0xbe')](_0x382506);});}else{hopperUtils[_0xddab('0x1e2')]({'active':![]},_0x2b19f9['id'],0x1)[_0xddab('0xfa')](function(){_0x2400ca[_0xddab('0xbe')](_0x382506);});}}else{_0x382506[_0xddab('0x1e3')]+=0x1;_0x2400ca[_0xddab('0xbe')](_0x382506);if(_0x382506[_0xddab('0x1e4')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b19f9[_0xddab('0xe6')],'ListId':_0x2b19f9['ListId'],'VoiceQueueId':_0x2b19f9[_0xddab('0xd8')]||undefined,'CampaignId':_0x2b19f9[_0xddab('0xd9')]||undefined})['catch'](loggerCatch(_0xddab('0x1e5')));hopperUtils['createHistory'](createObjHistory(_0x382506,_0x2b19f9,utils[_0xddab('0x67')]['QUEUE_RECALL'],0x17,_0xddab('0x1e6')))[_0xddab('0x9e')](loggerCatch(_0xddab('0x1e7')));}else{_0x2400ca[_0xddab('0x10f')](createObjHistory(_0x382506,_0x2b19f9,utils['CAMPAIGN_STATUS'][_0xddab('0x1e8')],0x16,_0xddab('0x1e9')),'[Originate][HistoryRecallClose][historyCatch]',_0xddab('0x1ea'));}}}}else{_0x382506[_0xddab('0x1eb')]+=0x1;_0x2400ca[_0xddab('0x10f')](createObjHistory(_0x382506,_0x2b19f9,utils[_0xddab('0x67')]['BLACKLIST'],0xd,_0xddab('0x1ec')),_0xddab('0x1ed'),_0xddab('0x1ee'));throw _0xddab('0x1ef');}};};Dialer[_0xddab('0x17')][_0xddab('0x1f0')]=function(_0x5ca1bf){var _0x3bee45=this;var _0x3c49da=_0x5ca1bf[_0xddab('0x1f1')]-_0x5ca1bf[_0xddab('0x7c')];emitCampaignSummary(_0x5ca1bf);if(_0x3c49da>0x0&&_0x5ca1bf[_0xddab('0x1f2')]==0x0){if(_0x3c49da>this[_0xddab('0x20')]){_0x3c49da=this[_0xddab('0x20')];}_0x5ca1bf[_0xddab('0x1f2')]=0x1;hopperUtils[_0xddab('0x1f3')](_0x5ca1bf,_0x3c49da)[_0xddab('0x3b')](function(_0x27093c){_0x5ca1bf[_0xddab('0x1f2')]=0x0;if(_0x27093c){if(!utils[_0xddab('0x1f4')](_0x27093c)){_0x5ca1bf[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x6b')];logger[_0xddab('0x48')]('[getContactCampaign2][Empty]'+_0x5ca1bf['name']);}else{_0x5ca1bf[_0xddab('0x7c')]+=_0x27093c['length'];_0x5ca1bf[_0xddab('0x6a')]=utils[_0xddab('0x67')][_0xddab('0x1f5')];for(var _0x15ea28=0x0;_0x15ea28<_0x27093c[_0xddab('0x95')];_0x15ea28+=0x1){_0x5ca1bf[_0xddab('0x1f6')]+=0x1;if(_[_0xddab('0xeb')](_0x27093c[_0x15ea28])||_[_0xddab('0xeb')](_0x27093c[_0x15ea28]['Contact'])||_[_0xddab('0xeb')](_0x27093c[_0x15ea28][_0xddab('0x174')])){_0x3bee45[_0xddab('0x1f7')](_0xddab('0x1f8'),_0x5ca1bf,_0x27093c[_0x15ea28]);}else{hopperUtils[_0xddab('0x1f9')](_[_0xddab('0xef')](_0x27093c[_0x15ea28],[_0xddab('0xd9'),_0xddab('0x174')]))[_0xddab('0x3b')](_0x3bee45['checkContactBlack'](_0x5ca1bf,_0x27093c[_0x15ea28]))[_0xddab('0x9e')](_0x3bee45['loggerHandler'](_0xddab('0x1fa'),_0x5ca1bf));}}}}})[_0xddab('0x9e')](loggerGetContactDialer('[getContactCampaign2]',_0x5ca1bf,_0x3c49da));}};Dialer['prototype'][_0xddab('0xb1')]=function(_0x4826b5,_0x336640){var _0x1aae5c=this;var _0x4be526=[];if(_0x336640<0x1||_0x4826b5[_0xddab('0xaf')]===_0xddab('0x1d8')){_0x336640=0x1;}var _0x272fee=Math[_0xddab('0x1b6')](_0x4826b5[_0xddab('0x132')]*_0x336640)-_0x4826b5[_0xddab('0x7c')];if(_0x4826b5[_0xddab('0x1fb')]>0x0){var _0x4b5c86=_0x4826b5[_0xddab('0x1fb')]-_0x4826b5[_0xddab('0x7c')]-_0x4826b5[_0xddab('0x133')]-_0x4826b5[_0xddab('0x134')];if(_0x272fee>_0x4b5c86){_0x272fee=_0x4b5c86;}}if(_0x272fee>0x0&&_0x4826b5['temp']==0x0){if(_0x4826b5[_0xddab('0xaf')]===_0xddab('0x1d8')){_0x272fee=0x1;}if(_0x272fee>this[_0xddab('0x20')]){_0x272fee=this[_0xddab('0x20')];}for(var _0x536f4f in this[_0xddab('0x1e')]){if(typeof this['agents'][_0x536f4f]!==_0xddab('0x1fc')){if(this['agents'][_0x536f4f][_0xddab('0x6d')]==='not_inuse'&&this[_0xddab('0x1e')][_0x536f4f][_0xddab('0x86')]===_0xddab('0x13d')){_0x4be526[_0xddab('0x1fd')](this[_0xddab('0x1e')][_0x536f4f]['id']);}}}_0x4826b5[_0xddab('0x1f2')]=0x1;hopperUtils['getContactDialer'](_0x4826b5,_0x4be526,_0x272fee)[_0xddab('0x3b')](function(_0x989b3e){_0x4826b5[_0xddab('0x1f2')]=0x0;if(_0x989b3e){if(!utils[_0xddab('0x1f4')](_0x989b3e)){hopperUtils[_0xddab('0x1fe')](_0x4826b5)['then'](sendMessageReschedule(_0x4826b5))['catch'](loggerCatch(_0xddab('0x1ff')));}else{_0x4826b5[_0xddab('0x7c')]+=_0x989b3e[_0xddab('0x95')];_0x4826b5[_0xddab('0x6a')]=_0x4826b5[_0xddab('0xaf')]===_0xddab('0x1d8')?utils[_0xddab('0x67')]['ACTIVE']:utils[_0xddab('0x67')][_0xddab('0x1f5')];for(var _0x274f40=0x0;_0x274f40<_0x989b3e[_0xddab('0x95')];_0x274f40+=0x1){if(_[_0xddab('0xeb')](_0x989b3e[_0x274f40])||_[_0xddab('0xeb')](_0x989b3e[_0x274f40][_0xddab('0x200')])||_[_0xddab('0xeb')](_0x989b3e[_0x274f40]['phone'])){_0x1aae5c[_0xddab('0x1f7')](_0xddab('0x1f8'),_0x4826b5,_0x989b3e[_0x274f40]);}else{hopperUtils['checkIsBlackList'](_[_0xddab('0xef')](_0x989b3e[_0x274f40],[_0xddab('0xd8'),_0xddab('0x174')]))[_0xddab('0x3b')](_0x1aae5c['checkContactBlack'](_0x4826b5,_0x989b3e[_0x274f40]))[_0xddab('0x9e')](_0x1aae5c[_0xddab('0x14c')]('[actionOriginate]\x20',_0x4826b5));}}}}})[_0xddab('0x9e')](loggerGetContactDialer(_0xddab('0x201'),_0x4826b5,_0x272fee));}};Dialer[_0xddab('0x17')][_0xddab('0x62')]=function(_0x3d8c40){if(_0x3d8c40[_0xddab('0x1fb')]>0x0){var _0x328082=_0x3d8c40[_0xddab('0x1fb')]-_0x3d8c40['originated']-_0x3d8c40[_0xddab('0x133')];if(_0x328082>0x0&&_0x3d8c40['temp']==0x0){this[_0xddab('0x202')](_0x3d8c40);}else{loggerPredictiveCalls[_0xddab('0x48')](_0xddab('0x203'));}}else{this['tryOriginatePredictive'](_0x3d8c40);}};Dialer['prototype'][_0xddab('0x202')]=function(_0x1a2b11){var _0x521f5f=this;var _0x28c804=[];_0x1a2b11[_0xddab('0x7c')]+=0x1;for(var _0x346867 in this['agents']){if(typeof this[_0xddab('0x1e')][_0x346867]!==_0xddab('0x1fc')){if(this[_0xddab('0x1e')][_0x346867]['state']===_0xddab('0x204')&&this[_0xddab('0x1e')][_0x346867][_0xddab('0x86')]===_0xddab('0x13d')){_0x28c804[_0xddab('0x1fd')](this[_0xddab('0x1e')][_0x346867]['id']);}}}_0x1a2b11[_0xddab('0x1f2')]=0x1;return this[_0xddab('0x205')](_0x1a2b11['id'],_0x28c804,0x1,_0x1a2b11[_0xddab('0x206')],_0x1a2b11)['then'](function(_0x16c104){_0x1a2b11[_0xddab('0x1f2')]=0x1;if(_0x16c104){if(!utils[_0xddab('0x1f4')](_0x16c104)){utils[_0xddab('0x207')](_0x1a2b11,0x1,0x0);return hopperUtils[_0xddab('0x1fe')](_0x1a2b11)[_0xddab('0x3b')](sendMessageReschedule(_0x1a2b11))[_0xddab('0x9e')](loggerCatch(_0xddab('0x1ff')));}else{_0x1a2b11['message']=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0xddab('0xeb')](_0x16c104[0x0])||_['isNil'](_0x16c104[0x0][_0xddab('0x200')])||_[_0xddab('0xeb')](_0x16c104[0x0][_0xddab('0x174')])){_0x521f5f[_0xddab('0x1f7')](_0xddab('0x1f8'),_0x1a2b11,_0x16c104[0x0]);}else{return hopperUtils[_0xddab('0x208')](_[_0xddab('0xef')](_0x16c104[0x0],[_0xddab('0xd8'),_0xddab('0x174')]))[_0xddab('0x3b')](_0x521f5f[_0xddab('0x1d6')](_0x1a2b11,_0x16c104[0x0]))['catch'](_0x521f5f['loggerHandler'](_0xddab('0x209'),_0x1a2b11));}}}})[_0xddab('0x9e')](loggerGetContactDialer(_0xddab('0x20a'),_0x1a2b11,0x1));};Dialer[_0xddab('0x17')][_0xddab('0x1c8')]=function(_0x1d9d83,_0x42852b,_0x2b2442,_0x3a500b,_0x37df63,_0xd4d79c){loggerPredictive[_0xddab('0x48')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xddab('0x48')](_0xddab('0x20b'),_0x1d9d83);loggerPredictive[_0xddab('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42852b);loggerPredictive[_0xddab('0x48')](_0xddab('0x20c'),_0x2b2442);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a500b);loggerPredictive['info'](_0xddab('0x20d'),_0x37df63);loggerPredictive['info']('---------------------------');return new Promise(function(_0x2ae1cc,_0x57201e){if(_0x1d9d83<=0x0||isNaN(_0x1d9d83)){return _0x57201e(msgResponse(_0xddab('0x20e'),'Error','m\x20=\x20'+_0x1d9d83));}if(_0x2b2442<=0x0||isNaN(_0x2b2442)){return _0x57201e(msgResponse('[abandonmentRate]','Error',_0xddab('0x20f')+_0x2b2442));}if(_0x3a500b<=0x0||isNaN(_0x3a500b)){return _0x57201e(msgResponse(_0xddab('0x20e'),_0xddab('0x83'),'p\x20=\x20'+_0x3a500b));}if(_0x42852b<=0x0||isNaN(_0x42852b)){return _0x57201e(msgResponse(_0xddab('0x20e'),_0xddab('0x83'),_0xddab('0x210')+_0x42852b));}if(_0x37df63<=0x0||isNaN(_0x37df63)){return _0x57201e(msgResponse(_0xddab('0x20e'),_0xddab('0x83'),_0xddab('0x211')+_0x37df63));}_0xd4d79c=_0xd4d79c||0x0;var _0x28f668=0x1/_0x2b2442;var _0x1df000=0x0;var _0x375f4a=0x0;var _0x36d1e3=0x0;var _0x17da39=0x0;for(var _0x35dfa5=0x0;_0x36d1e3<_0x37df63;_0x35dfa5+=0x1){_0x375f4a=_0x35dfa5/_0x42852b;_0x1df000=(_0x3a500b*_0x375f4a+_0xd4d79c)/_0x28f668;_0x36d1e3=utils[_0xddab('0x212')](_0x1df000,_0x1d9d83);_0x17da39=_0x1df000/_0x1d9d83*(0x1-utils['erlangb'](_0x1df000,_0x1d9d83));}return _0x2ae1cc({'erlangCalls':_0x35dfa5,'erlangCallToSecond':_0x42852b/_0x35dfa5,'erlangAbandonmentRate':_0x36d1e3,'erlangBusyFactor':_0x17da39});});};Dialer[_0xddab('0x17')][_0xddab('0x1ca')]=function(_0x1ae6a0,_0x54b6a9,_0x39bb4f,_0x14ff02,_0x272d6b,_0x395523){loggerPredictive['info'](_0xddab('0x213'));loggerPredictive[_0xddab('0x48')](_0xddab('0x20b'),_0x1ae6a0);loggerPredictive[_0xddab('0x48')](_0xddab('0x214'),_0x54b6a9);loggerPredictive[_0xddab('0x48')]('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',_0x39bb4f);loggerPredictive[_0xddab('0x48')](_0xddab('0x215'),_0x14ff02);loggerPredictive['info'](_0xddab('0x216'),_0x272d6b);loggerPredictive[_0xddab('0x48')]('---------------------------');return new Promise(function(_0x3e8fec,_0x2b05d7){if(_0x1ae6a0<=0x0||isNaN(_0x1ae6a0)){return _0x2b05d7(msgResponse(_0xddab('0x217'),_0xddab('0x83'),_0xddab('0x218')+_0x1ae6a0));}if(_0x39bb4f<=0x0||isNaN(_0x39bb4f)){return _0x2b05d7(msgResponse(_0xddab('0x217'),_0xddab('0x83'),_0xddab('0x20f')+_0x39bb4f));}if(_0x14ff02<=0x0||isNaN(_0x14ff02)){return _0x2b05d7(msgResponse('[busyFactor]',_0xddab('0x83'),_0xddab('0x219')+_0x14ff02));}if(_0x54b6a9<=0x0||isNaN(_0x54b6a9)){return _0x2b05d7(msgResponse('[busyFactor]',_0xddab('0x83'),'interval\x20=\x20'+_0x54b6a9));}if(_0x272d6b<=0x0||isNaN(_0x272d6b)){return _0x2b05d7(msgResponse('[busyFactor]',_0xddab('0x83'),_0xddab('0x21a')+_0x272d6b));}_0x395523=_0x395523||0x0;var _0x4a029e=0x1/_0x39bb4f;var _0xf18d70=0x0;var _0x44e8d2=0x0;var _0x368da6=0x0;var _0x95faf0=0x0;for(var _0x187621=0x0;_0x95faf0<_0x272d6b;_0x187621+=0x1){_0x44e8d2=_0x187621/_0x54b6a9;_0xf18d70=(_0x14ff02*_0x44e8d2+_0x395523)/_0x4a029e;_0x368da6=utils[_0xddab('0x212')](_0xf18d70,_0x1ae6a0);_0x95faf0=_0xf18d70/_0x1ae6a0*(0x1-utils[_0xddab('0x212')](_0xf18d70,_0x1ae6a0));}return _0x3e8fec({'erlangCalls':_0x187621,'erlangCallToSecond':_0x54b6a9/_0x187621,'erlangAbandonmentRate':_0x368da6,'erlangBusyFactor':_0x95faf0});});};module[_0xddab('0x21b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 159a859..a50c91a 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4427=['countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','moment','isNil','string','voiceQueue','uniqueid','phone','firstName','Contact','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat'];(function(_0x31b8f1,_0x28f2c8){var _0x159b53=function(_0x16b60e){while(--_0x16b60e){_0x31b8f1['push'](_0x31b8f1['shift']());}};_0x159b53(++_0x28f2c8);}(_0x4427,0x6e));var _0x7442=function(_0x459dc6,_0x38026f){_0x459dc6=_0x459dc6-0x0;var _0xf3f2a0=_0x4427[_0x459dc6];return _0xf3f2a0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7442('0x0'));function checkNameSurname(_0x19da9b,_0x414e8e,_0x2bdc0c){var _0x2643a1='';if(!_[_0x7442('0x1')](_0x414e8e)&&_0x7442('0x2')===typeof _0x414e8e){_0x2643a1+=_0x414e8e;}if(!_[_0x7442('0x1')](_0x2bdc0c)&&_0x7442('0x2')===typeof _0x2bdc0c){_0x2643a1+='\x20'+_0x2bdc0c;}if(_0x2643a1!==''){return _0x2643a1;}return _0x19da9b;}function Action(_0x2fe942,_0x459737,_0x131d7a){this[_0x7442('0x3')]=_0x2fe942;this[_0x7442('0x4')]=_0x131d7a||undefined;this['name']=checkNameSurname(_0x459737['Contact'][_0x7442('0x5')],_0x459737['Contact'][_0x7442('0x6')],_0x459737[_0x7442('0x7')][_0x7442('0x8')]);this[_0x7442('0x9')]=_0x459737[_0x7442('0x5')];this[_0x7442('0xa')]=_0x2fe942[_0x7442('0xb')];this['active']=_0x459737[_0x7442('0xc')]||![];this[_0x7442('0xd')]=_0x2fe942[_0x7442('0xd')];this[_0x7442('0xe')]=_0x2fe942[_0x7442('0xe')]||0x3;this[_0x7442('0xf')]=_0x459737[_0x7442('0xf')];this['countbusyretry']=_0x459737['countbusyretry'];this[_0x7442('0x10')]=_0x459737['countcongestionretry'];this['countnoanswerretry']=_0x459737['countnoanswerretry'];this[_0x7442('0x11')]=_0x459737[_0x7442('0x11')];this[_0x7442('0x12')]=_0x459737['countdropretry'];this[_0x7442('0x13')]=_0x459737[_0x7442('0x13')];this['countmachineretry']=_0x459737[_0x7442('0x14')];this['countagentrejectretry']=_0x459737[_0x7442('0x15')];this['ContactId']=_0x459737['ContactId'];this['ListId']=_0x459737[_0x7442('0x16')];this[_0x7442('0x17')]=_0x459737[_0x7442('0x17')];this[_0x7442('0x18')]=_0x459737[_0x7442('0x18')];this['CampaignId']=_0x459737[_0x7442('0x19')];this[_0x7442('0x1a')]=_0x459737['id'];this['ContactFirstName']=_0x459737[_0x7442('0x7')][_0x7442('0x6')]||'';this[_0x7442('0x1b')]=moment()[_0x7442('0x1c')](_0x7442('0x1d'));this[_0x7442('0x1e')]=_0x459737[_0x7442('0x1e')];this['callbackuniqueid']=_0x459737[_0x7442('0x1f')];this['callbackat']=_0x459737[_0x7442('0x20')];this[_0x7442('0x21')]=_0x459737[_0x7442('0x21')];this['originatecalleridnum']='';this[_0x7442('0x22')]='';}Action['prototype'][_0x7442('0x23')]=function(){return util[_0x7442('0x1c')](_0x7442('0x24'),this[_0x7442('0xb')],this['voiceQueue'][_0x7442('0x25')]>0x0?this[_0x7442('0x9')][_0x7442('0x26')](this[_0x7442('0x3')]['dialCutDigit']):this[_0x7442('0x9')]);};Action[_0x7442('0x27')][_0x7442('0x28')]=function(){return this[_0x7442('0xa')];};module[_0x7442('0x29')]=Action; \ No newline at end of file +var _0xe9f6=['ContactId','ListId','UserId','VoiceQueueId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','dialCutDigit','substring','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x1c82ea,_0x45ee10){var _0x248140=function(_0x385d6a){while(--_0x385d6a){_0x1c82ea['push'](_0x1c82ea['shift']());}};_0x248140(++_0x45ee10);}(_0xe9f6,0x141));var _0x6e9f=function(_0x4c2f5d,_0x3a2108){_0x4c2f5d=_0x4c2f5d-0x0;var _0x4eaf29=_0xe9f6[_0x4c2f5d];return _0x4eaf29;};'use strict';var util=require(_0x6e9f('0x0'));var _=require('lodash');var moment=require(_0x6e9f('0x1'));function checkNameSurname(_0x4cd420,_0x522f42,_0x6c865e){var _0xd0f08='';if(!_[_0x6e9f('0x2')](_0x522f42)&&'string'===typeof _0x522f42){_0xd0f08+=_0x522f42;}if(!_[_0x6e9f('0x2')](_0x6c865e)&&_0x6e9f('0x3')===typeof _0x6c865e){_0xd0f08+='\x20'+_0x6c865e;}if(_0xd0f08!==''){return _0xd0f08;}return _0x4cd420;}function Action(_0xf26028,_0x517eca,_0x5395db){this[_0x6e9f('0x4')]=_0xf26028;this[_0x6e9f('0x5')]=_0x5395db||undefined;this[_0x6e9f('0x6')]=checkNameSurname(_0x517eca['Contact']['phone'],_0x517eca[_0x6e9f('0x7')][_0x6e9f('0x8')],_0x517eca[_0x6e9f('0x7')][_0x6e9f('0x9')]);this[_0x6e9f('0xa')]=_0x517eca['phone'];this['queue']=_0xf26028[_0x6e9f('0x6')];this[_0x6e9f('0xb')]=_0x517eca[_0x6e9f('0xb')]||![];this['type']=_0xf26028[_0x6e9f('0xc')];this['dialQueueTimeout']=_0xf26028[_0x6e9f('0xd')]||0x3;this['scheduledat']=_0x517eca['scheduledat'];this[_0x6e9f('0xe')]=_0x517eca[_0x6e9f('0xe')];this[_0x6e9f('0xf')]=_0x517eca[_0x6e9f('0xf')];this['countnoanswerretry']=_0x517eca[_0x6e9f('0x10')];this[_0x6e9f('0x11')]=_0x517eca[_0x6e9f('0x11')];this['countdropretry']=_0x517eca[_0x6e9f('0x12')];this[_0x6e9f('0x13')]=_0x517eca['countabandonedretry'];this['countmachineretry']=_0x517eca[_0x6e9f('0x14')];this['countagentrejectretry']=_0x517eca['countagentrejectretry'];this[_0x6e9f('0x15')]=_0x517eca[_0x6e9f('0x15')];this[_0x6e9f('0x16')]=_0x517eca[_0x6e9f('0x16')];this['UserId']=_0x517eca[_0x6e9f('0x17')];this[_0x6e9f('0x18')]=_0x517eca[_0x6e9f('0x18')];this['CampaignId']=_0x517eca['CampaignId'];this[_0x6e9f('0x19')]=_0x517eca['id'];this['ContactFirstName']=_0x517eca['Contact'][_0x6e9f('0x8')]||'';this[_0x6e9f('0x1a')]=moment()[_0x6e9f('0x1b')](_0x6e9f('0x1c'));this[_0x6e9f('0x1d')]=_0x517eca[_0x6e9f('0x1d')];this[_0x6e9f('0x1e')]=_0x517eca[_0x6e9f('0x1e')];this[_0x6e9f('0x1f')]=_0x517eca[_0x6e9f('0x1f')];this[_0x6e9f('0x20')]=_0x517eca[_0x6e9f('0x20')];this[_0x6e9f('0x21')]='';this['originatecalleridname']='';}Action['prototype'][_0x6e9f('0x22')]=function(){return util[_0x6e9f('0x1b')]('\x22%s\x22\x20<%s>',this[_0x6e9f('0x6')],this['voiceQueue'][_0x6e9f('0x23')]>0x0?this['number'][_0x6e9f('0x24')](this[_0x6e9f('0x4')][_0x6e9f('0x23')]):this[_0x6e9f('0xa')]);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0x6e9f('0x25')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 8c3e5d0..12bf5a5 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a31=['countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','format','getSeconds','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry'];(function(_0xc09de0,_0x495e29){var _0x45a6c9=function(_0x970ea4){while(--_0x970ea4){_0xc09de0['push'](_0xc09de0['shift']());}};_0x45a6c9(++_0x495e29);}(_0x1a31,0xca));var _0x11a3=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x1a31[_0x39c734];return _0xb2a2f9;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x4c04c1,_0x1e51d8){this['state']=0x4;this[_0x11a3('0x0')]=_0x11a3('0x1');this[_0x11a3('0x2')]=_0x4c04c1[_0x11a3('0x2')];this[_0x11a3('0x3')]=_0x4c04c1['type'];this[_0x11a3('0x4')]=_0x4c04c1[_0x11a3('0x3')]===_0x11a3('0x5')?_0x11a3('0x6'):_0x4c04c1['type'];this[_0x11a3('0x7')]=_0x4c04c1[_0x11a3('0x7')];this[_0x11a3('0x8')]=_0x4c04c1['countcongestionretry'];this[_0x11a3('0x9')]=_0x4c04c1[_0x11a3('0x9')];this[_0x11a3('0xa')]=_0x4c04c1['countbusyretry']+_0x4c04c1[_0x11a3('0x8')]+_0x4c04c1[_0x11a3('0x9')]+_0x4c04c1['countnosuchnumberretry']+_0x4c04c1[_0x11a3('0xb')]+_0x4c04c1[_0x11a3('0xc')]+_0x4c04c1[_0x11a3('0xd')]+_0x4c04c1['countagentrejectretry'];this[_0x11a3('0xe')]=_0x4c04c1[_0x11a3('0xe')];this['countdropretry']=_0x4c04c1['countdropretry'];this['countabandonedretry']=_0x4c04c1['countabandonedretry'];this[_0x11a3('0xd')]=_0x4c04c1[_0x11a3('0xd')];this[_0x11a3('0xf')]=_0x4c04c1[_0x11a3('0xf')];this[_0x11a3('0x10')]=_0x1e51d8[_0x11a3('0x10')];this['calleridname']=_0x4c04c1[_0x11a3('0x11')];this[_0x11a3('0x12')]=_0x4c04c1[_0x11a3('0x13')];this[_0x11a3('0x14')]=_0x4c04c1[_0x11a3('0x14')];this[_0x11a3('0x15')]=_0x4c04c1[_0x11a3('0x15')];this[_0x11a3('0x16')]=_0x4c04c1[_0x11a3('0x16')];this['endtime']=moment()[_0x11a3('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0x11a3('0x18')](_0x4c04c1[_0x11a3('0x15')],_0x4c04c1[_0x11a3('0x14')]);this[_0x11a3('0x19')]=utils[_0x11a3('0x18')](_0x4c04c1['answertime'],_0x4c04c1[_0x11a3('0x15')]);this[_0x11a3('0x1a')]=utils[_0x11a3('0x18')](this[_0x11a3('0x1b')],_0x4c04c1[_0x11a3('0x16')]);this[_0x11a3('0x6')]=_0x1e51d8[_0x11a3('0x6')];this['membername']=_0x1e51d8[_0x11a3('0x1c')];this[_0x11a3('0x1d')]=_0x1e51d8[_0x11a3('0x1d')];this[_0x11a3('0x1e')]=_0x4c04c1[_0x11a3('0x1e')];this[_0x11a3('0x1f')]=_0x4c04c1['callbackuniqueid'];this[_0x11a3('0x20')]=_0x4c04c1['callbackat'];this[_0x11a3('0x21')]=_0x4c04c1[_0x11a3('0x21')];this[_0x11a3('0x22')]=_0x4c04c1[_0x11a3('0x22')];this[_0x11a3('0x23')]=_0x4c04c1[_0x11a3('0x23')];this[_0x11a3('0x24')]=_0x4c04c1[_0x11a3('0x24')];this[_0x11a3('0x25')]=_0x4c04c1['VoiceQueueId'];this['CampaignId']=_0x4c04c1[_0x11a3('0x26')];this[_0x11a3('0x27')]=_0x4c04c1[_0x11a3('0x27')]||'';this[_0x11a3('0x28')]=_0x4c04c1[_0x11a3('0x28')]||'';this[_0x11a3('0x29')]=_0x4c04c1[_0x11a3('0x29')];}module[_0x11a3('0x2a')]=AgentComplete; \ No newline at end of file +var _0xc76f=['moment','../utils','statedesc','Answer','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','getSeconds','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports'];(function(_0x107fbc,_0x45d5d0){var _0x5ede57=function(_0xaf6f33){while(--_0xaf6f33){_0x107fbc['push'](_0x107fbc['shift']());}};_0x5ede57(++_0x45d5d0);}(_0xc76f,0x87));var _0xfc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76f[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xfc76('0x0'));var utils=require(_0xfc76('0x1'));function AgentComplete(_0x263f88,_0x1c99e0){this['state']=0x4;this[_0xfc76('0x2')]=_0xfc76('0x3');this['scheduledat']=_0x263f88['scheduledat'];this[_0xfc76('0x4')]=_0x263f88[_0xfc76('0x4')];this[_0xfc76('0x5')]=_0x263f88['type']===_0xfc76('0x6')?'queue':_0x263f88[_0xfc76('0x4')];this[_0xfc76('0x7')]=_0x263f88['countbusyretry'];this['countcongestionretry']=_0x263f88['countcongestionretry'];this[_0xfc76('0x8')]=_0x263f88['countnoanswerretry'];this[_0xfc76('0x9')]=_0x263f88[_0xfc76('0x7')]+_0x263f88['countcongestionretry']+_0x263f88[_0xfc76('0x8')]+_0x263f88[_0xfc76('0xa')]+_0x263f88[_0xfc76('0xb')]+_0x263f88[_0xfc76('0xc')]+_0x263f88[_0xfc76('0xd')]+_0x263f88['countagentrejectretry'];this['countnosuchnumberretry']=_0x263f88[_0xfc76('0xa')];this[_0xfc76('0xb')]=_0x263f88['countdropretry'];this[_0xfc76('0xc')]=_0x263f88['countabandonedretry'];this[_0xfc76('0xd')]=_0x263f88[_0xfc76('0xd')];this[_0xfc76('0xe')]=_0x263f88['countagentrejectretry'];this[_0xfc76('0xf')]=_0x1c99e0['uniqueid'];this[_0xfc76('0x10')]=_0x263f88[_0xfc76('0x11')];this[_0xfc76('0x12')]=_0x263f88[_0xfc76('0x13')];this[_0xfc76('0x14')]=_0x263f88[_0xfc76('0x14')];this[_0xfc76('0x15')]=_0x263f88[_0xfc76('0x15')];this[_0xfc76('0x16')]=_0x263f88[_0xfc76('0x16')];this['endtime']=moment()[_0xfc76('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfc76('0x18')]=utils[_0xfc76('0x19')](_0x263f88[_0xfc76('0x15')],_0x263f88[_0xfc76('0x14')]);this[_0xfc76('0x1a')]=utils[_0xfc76('0x19')](_0x263f88[_0xfc76('0x16')],_0x263f88[_0xfc76('0x15')]);this[_0xfc76('0x1b')]=utils[_0xfc76('0x19')](this[_0xfc76('0x1c')],_0x263f88['answertime']);this[_0xfc76('0x1d')]=_0x1c99e0['queue'];this['membername']=_0x1c99e0[_0xfc76('0x1e')];this[_0xfc76('0x1f')]=_0x1c99e0[_0xfc76('0x1f')];this['callback']=_0x263f88[_0xfc76('0x20')];this['callbackuniqueid']=_0x263f88[_0xfc76('0x21')];this[_0xfc76('0x22')]=_0x263f88['callbackat'];this[_0xfc76('0x23')]=_0x263f88[_0xfc76('0x23')];this[_0xfc76('0x24')]=_0x263f88[_0xfc76('0x24')];this[_0xfc76('0x25')]=_0x263f88[_0xfc76('0x25')];this[_0xfc76('0x26')]=_0x263f88[_0xfc76('0x26')];this[_0xfc76('0x27')]=_0x263f88[_0xfc76('0x27')];this[_0xfc76('0x28')]=_0x263f88[_0xfc76('0x28')];this[_0xfc76('0x29')]=_0x263f88[_0xfc76('0x29')]||'';this[_0xfc76('0x2a')]=_0x263f88['originatecalleridname']||'';this[_0xfc76('0x2b')]=_0x263f88[_0xfc76('0x2b')];}module[_0xfc76('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 6ea53c7..ee7baaa 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb92=['countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xeb92,0x10b));var _0x2eb9=function(_0xce9565,_0x5681b3){_0xce9565=_0xce9565-0x0;var _0x50e6d0=_0xeb92[_0xce9565];return _0x50e6d0;};'use strict';function Final(_0x337cc9){this[_0x2eb9('0x0')]=_0x337cc9[_0x2eb9('0x0')];this[_0x2eb9('0x1')]=_0x337cc9['scheduledat'];this[_0x2eb9('0x2')]=_0x337cc9['type'];this[_0x2eb9('0x3')]=_0x337cc9['type']===_0x2eb9('0x4')?_0x2eb9('0x5'):_0x337cc9[_0x2eb9('0x2')];this['countbusyretry']=_0x337cc9[_0x2eb9('0x6')];this[_0x2eb9('0x7')]=_0x337cc9[_0x2eb9('0x7')];this[_0x2eb9('0x8')]=_0x337cc9[_0x2eb9('0x8')];this[_0x2eb9('0x9')]=_0x337cc9[_0x2eb9('0x6')]+_0x337cc9[_0x2eb9('0x7')]+_0x337cc9['countnoanswerretry']+_0x337cc9[_0x2eb9('0xa')]+_0x337cc9['countdropretry']+_0x337cc9[_0x2eb9('0xb')]+_0x337cc9[_0x2eb9('0xc')]+_0x337cc9[_0x2eb9('0xd')];this[_0x2eb9('0xa')]=_0x337cc9[_0x2eb9('0xa')];this[_0x2eb9('0xe')]=_0x337cc9[_0x2eb9('0xe')];this[_0x2eb9('0xb')]=_0x337cc9[_0x2eb9('0xb')];this[_0x2eb9('0xc')]=_0x337cc9[_0x2eb9('0xc')];this[_0x2eb9('0xd')]=_0x337cc9[_0x2eb9('0xd')];this[_0x2eb9('0x5')]=_0x337cc9['queue'];this[_0x2eb9('0xf')]=_0x337cc9[_0x2eb9('0xf')];this[_0x2eb9('0x10')]=_0x337cc9['calleridnum'];this[_0x2eb9('0x11')]=_0x337cc9['starttime'];this[_0x2eb9('0x12')]=_0x337cc9[_0x2eb9('0x12')];this[_0x2eb9('0x13')]=_0x337cc9[_0x2eb9('0x12')];this[_0x2eb9('0x14')]=_0x337cc9[_0x2eb9('0x14')]||0x0;this[_0x2eb9('0x15')]=_0x337cc9[_0x2eb9('0x15')]||0x0;this['talktime']=_0x337cc9['talktime']||0x0;this[_0x2eb9('0x16')]=_0x337cc9['callback'];this[_0x2eb9('0x17')]=_0x337cc9[_0x2eb9('0x17')];this[_0x2eb9('0x18')]=_0x337cc9[_0x2eb9('0x18')];this[_0x2eb9('0x19')]=_0x337cc9[_0x2eb9('0x19')];this[_0x2eb9('0x1a')]=_0x337cc9[_0x2eb9('0x1a')];this[_0x2eb9('0x1b')]=_0x337cc9['ListId'];this[_0x2eb9('0x1c')]=_0x337cc9['UserId'];this[_0x2eb9('0x1d')]=_0x337cc9[_0x2eb9('0x1d')];this['CampaignId']=_0x337cc9[_0x2eb9('0x1e')];this[_0x2eb9('0x1f')]=_0x337cc9[_0x2eb9('0x1f')]||'';this[_0x2eb9('0x20')]=_0x337cc9['originatecalleridname']||'';this[_0x2eb9('0x21')]=_0x337cc9['state'];this[_0x2eb9('0x22')]=_0x337cc9['statedesc'];}module['exports']=Final; \ No newline at end of file +var _0x454e=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x454e,0x193));var _0xe454=function(_0x49b86c,_0x4fa07f){_0x49b86c=_0x49b86c-0x0;var _0x5e0711=_0x454e[_0x49b86c];return _0x5e0711;};'use strict';function Final(_0x1d57ac){this[_0xe454('0x0')]=_0x1d57ac[_0xe454('0x0')];this[_0xe454('0x1')]=_0x1d57ac[_0xe454('0x1')];this[_0xe454('0x2')]=_0x1d57ac[_0xe454('0x2')];this[_0xe454('0x3')]=_0x1d57ac[_0xe454('0x2')]===_0xe454('0x4')?_0xe454('0x5'):_0x1d57ac[_0xe454('0x2')];this[_0xe454('0x6')]=_0x1d57ac[_0xe454('0x6')];this[_0xe454('0x7')]=_0x1d57ac[_0xe454('0x7')];this[_0xe454('0x8')]=_0x1d57ac[_0xe454('0x8')];this[_0xe454('0x9')]=_0x1d57ac[_0xe454('0x6')]+_0x1d57ac[_0xe454('0x7')]+_0x1d57ac[_0xe454('0x8')]+_0x1d57ac[_0xe454('0xa')]+_0x1d57ac['countdropretry']+_0x1d57ac[_0xe454('0xb')]+_0x1d57ac['countmachineretry']+_0x1d57ac[_0xe454('0xc')];this[_0xe454('0xa')]=_0x1d57ac[_0xe454('0xa')];this['countdropretry']=_0x1d57ac[_0xe454('0xd')];this['countabandonedretry']=_0x1d57ac[_0xe454('0xb')];this[_0xe454('0xe')]=_0x1d57ac[_0xe454('0xe')];this[_0xe454('0xc')]=_0x1d57ac['countagentrejectretry'];this[_0xe454('0x5')]=_0x1d57ac[_0xe454('0x5')];this['calleridname']=_0x1d57ac[_0xe454('0xf')];this[_0xe454('0x10')]=_0x1d57ac[_0xe454('0x10')];this['starttime']=_0x1d57ac[_0xe454('0x11')];this[_0xe454('0x12')]=_0x1d57ac[_0xe454('0x12')];this[_0xe454('0x13')]=_0x1d57ac[_0xe454('0x12')];this[_0xe454('0x14')]=_0x1d57ac['ringtime']||0x0;this[_0xe454('0x15')]=_0x1d57ac[_0xe454('0x15')]||0x0;this[_0xe454('0x16')]=_0x1d57ac['talktime']||0x0;this[_0xe454('0x17')]=_0x1d57ac[_0xe454('0x17')];this[_0xe454('0x18')]=_0x1d57ac[_0xe454('0x18')];this[_0xe454('0x19')]=_0x1d57ac[_0xe454('0x19')];this['recallme']=_0x1d57ac['recallme'];this[_0xe454('0x1a')]=_0x1d57ac['ContactId'];this['ListId']=_0x1d57ac['ListId'];this['UserId']=_0x1d57ac[_0xe454('0x1b')];this[_0xe454('0x1c')]=_0x1d57ac[_0xe454('0x1c')];this[_0xe454('0x1d')]=_0x1d57ac[_0xe454('0x1d')];this[_0xe454('0x1e')]=_0x1d57ac[_0xe454('0x1e')]||'';this[_0xe454('0x1f')]=_0x1d57ac[_0xe454('0x1f')]||'';this[_0xe454('0x20')]=_0x1d57ac[_0xe454('0x20')];this[_0xe454('0x21')]=_0x1d57ac['statedesc'];}module[_0xe454('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 1cb90a9..81f5c85 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe84a=['type','campaigntype','outbound','queue','amd','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','starttime','responsetime','format','getSeconds','holdtime','talktime','endtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat'];(function(_0x4ee8cc,_0x246bc6){var _0x592f35=function(_0x282000){while(--_0x282000){_0x4ee8cc['push'](_0x4ee8cc['shift']());}};_0x592f35(++_0x246bc6);}(_0xe84a,0x97));var _0xae84=function(_0x31b5de,_0x1c4fee){_0x31b5de=_0x31b5de-0x0;var _0x16ff09=_0xe84a[_0x31b5de];return _0x16ff09;};'use strict';var moment=require(_0xae84('0x0'));var utils=require(_0xae84('0x1'));function Hangup(_0x217fcc,_0x3683d8){this['state']=0x4;this[_0xae84('0x2')]=_0xae84('0x3');this['scheduledat']=_0x217fcc[_0xae84('0x4')];this[_0xae84('0x5')]=_0x217fcc[_0xae84('0x5')];this[_0xae84('0x6')]=_0x217fcc['type']===_0xae84('0x7')?_0xae84('0x8'):_0x217fcc[_0xae84('0x5')];this[_0xae84('0x9')]=_0x217fcc[_0xae84('0x9')]||![];this[_0xae84('0xa')]=_0x217fcc[_0xae84('0xa')];this['countcongestionretry']=_0x217fcc['countcongestionretry'];this[_0xae84('0xb')]=_0x217fcc[_0xae84('0xb')];this['countglobal']=_0x217fcc[_0xae84('0xa')]+_0x217fcc['countcongestionretry']+_0x217fcc[_0xae84('0xb')]+_0x217fcc[_0xae84('0xc')]+_0x217fcc['countdropretry']+_0x217fcc['countabandonedretry']+_0x217fcc[_0xae84('0xd')]+_0x217fcc[_0xae84('0xe')];this[_0xae84('0xc')]=_0x217fcc[_0xae84('0xc')];this[_0xae84('0xf')]=_0x217fcc[_0xae84('0xf')];this[_0xae84('0x10')]=_0x217fcc[_0xae84('0x10')];this[_0xae84('0xd')]=_0x217fcc[_0xae84('0xd')];this['countagentrejectretry']=_0x217fcc['countagentrejectretry'];this[_0xae84('0x11')]=_0x3683d8[_0xae84('0x11')];this[_0xae84('0x12')]=_0x217fcc[_0xae84('0x13')];this['calleridnum']=_0x217fcc['number'];this[_0xae84('0x14')]=_0x217fcc[_0xae84('0x14')];this[_0xae84('0x15')]=_0x217fcc[_0xae84('0x15')];this['endtime']=moment()[_0xae84('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0xae84('0x17')](_0x217fcc['responsetime'],_0x217fcc['starttime']);this[_0xae84('0x18')]=0x0;this[_0xae84('0x19')]=utils[_0xae84('0x17')](this[_0xae84('0x1a')],_0x217fcc[_0xae84('0x15')]);this['queue']=_0x217fcc[_0xae84('0x8')];this[_0xae84('0x1b')]=_0xae84('0x1c');this['reason']=_0x3683d8[_0xae84('0x1d')];this[_0xae84('0x1e')]=_0x217fcc[_0xae84('0x1e')];this[_0xae84('0x1f')]=_0x217fcc['callbackuniqueid'];this['callbackat']=_0x217fcc[_0xae84('0x20')];this[_0xae84('0x21')]=_0x217fcc[_0xae84('0x21')];this[_0xae84('0x22')]=_0x217fcc[_0xae84('0x22')];this[_0xae84('0x23')]=_0x217fcc[_0xae84('0x23')];this['UserId']=_0x217fcc['UserId'];this[_0xae84('0x24')]=_0x217fcc['VoiceQueueId'];this[_0xae84('0x25')]=_0x217fcc[_0xae84('0x25')];}module[_0xae84('0x26')]=Hangup; \ No newline at end of file +var _0xf47e=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','queue','membername','IVR','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','../utils','state','Answer','scheduledat','type','campaigntype','outbound'];(function(_0x337e3b,_0x4964b6){var _0x3ecc7d=function(_0x3c6b47){while(--_0x3c6b47){_0x337e3b['push'](_0x337e3b['shift']());}};_0x3ecc7d(++_0x4964b6);}(_0xf47e,0x68));var _0xef47=function(_0x3b8ffd,_0xfe57b0){_0x3b8ffd=_0x3b8ffd-0x0;var _0x4028f4=_0xf47e[_0x3b8ffd];return _0x4028f4;};'use strict';var moment=require('moment');var utils=require(_0xef47('0x0'));function Hangup(_0xfd4a91,_0x4ebcf9){this[_0xef47('0x1')]=0x4;this['statedesc']=_0xef47('0x2');this[_0xef47('0x3')]=_0xfd4a91[_0xef47('0x3')];this['type']=_0xfd4a91[_0xef47('0x4')];this[_0xef47('0x5')]=_0xfd4a91[_0xef47('0x4')]===_0xef47('0x6')?'queue':_0xfd4a91[_0xef47('0x4')];this['amd']=_0xfd4a91['amd']||![];this[_0xef47('0x7')]=_0xfd4a91[_0xef47('0x7')];this[_0xef47('0x8')]=_0xfd4a91['countcongestionretry'];this[_0xef47('0x9')]=_0xfd4a91[_0xef47('0x9')];this[_0xef47('0xa')]=_0xfd4a91['countbusyretry']+_0xfd4a91['countcongestionretry']+_0xfd4a91['countnoanswerretry']+_0xfd4a91['countnosuchnumberretry']+_0xfd4a91[_0xef47('0xb')]+_0xfd4a91[_0xef47('0xc')]+_0xfd4a91[_0xef47('0xd')]+_0xfd4a91[_0xef47('0xe')];this[_0xef47('0xf')]=_0xfd4a91[_0xef47('0xf')];this[_0xef47('0xb')]=_0xfd4a91[_0xef47('0xb')];this[_0xef47('0xc')]=_0xfd4a91[_0xef47('0xc')];this[_0xef47('0xd')]=_0xfd4a91[_0xef47('0xd')];this[_0xef47('0xe')]=_0xfd4a91[_0xef47('0xe')];this[_0xef47('0x10')]=_0x4ebcf9[_0xef47('0x10')];this['calleridname']=_0xfd4a91[_0xef47('0x11')];this[_0xef47('0x12')]=_0xfd4a91[_0xef47('0x13')];this[_0xef47('0x14')]=_0xfd4a91[_0xef47('0x14')];this['responsetime']=_0xfd4a91[_0xef47('0x15')];this[_0xef47('0x16')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0xef47('0x17')](_0xfd4a91[_0xef47('0x15')],_0xfd4a91[_0xef47('0x14')]);this[_0xef47('0x18')]=0x0;this['talktime']=utils[_0xef47('0x17')](this[_0xef47('0x16')],_0xfd4a91[_0xef47('0x15')]);this[_0xef47('0x19')]=_0xfd4a91['queue'];this[_0xef47('0x1a')]=_0xef47('0x1b');this['reason']=_0x4ebcf9['cause-txt'];this[_0xef47('0x1c')]=_0xfd4a91['callback'];this[_0xef47('0x1d')]=_0xfd4a91['callbackuniqueid'];this[_0xef47('0x1e')]=_0xfd4a91[_0xef47('0x1e')];this[_0xef47('0x1f')]=_0xfd4a91['recallme'];this[_0xef47('0x20')]=_0xfd4a91[_0xef47('0x20')];this[_0xef47('0x21')]=_0xfd4a91[_0xef47('0x21')];this[_0xef47('0x22')]=_0xfd4a91[_0xef47('0x22')];this['VoiceQueueId']=_0xfd4a91['VoiceQueueId'];this['CampaignId']=_0xfd4a91[_0xef47('0x23')];}module[_0xef47('0x24')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 53263ee..1ee8996 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf1b=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','campaigntype','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId'];(function(_0x211f04,_0x828280){var _0x1eab0d=function(_0x36e9a3){while(--_0x36e9a3){_0x211f04['push'](_0x211f04['shift']());}};_0x1eab0d(++_0x828280);}(_0xaf1b,0x182));var _0xbaf1=function(_0x7a878,_0x3ebab6){_0x7a878=_0x7a878-0x0;var _0x490e41=_0xaf1b[_0x7a878];return _0x490e41;};'use strict';var utils=require(_0xbaf1('0x0'));function History(_0x582158){this[_0xbaf1('0x1')]=_0x582158[_0xbaf1('0x1')];this[_0xbaf1('0x2')]=_0x582158['scheduledat']||undefined;this['type']=_0x582158['type'];this[_0xbaf1('0x3')]=_0x582158['type']==='outbound'?_0xbaf1('0x4'):_0x582158[_0xbaf1('0x5')];this[_0xbaf1('0x6')]=_0x582158['countbusyretry'];this[_0xbaf1('0x7')]=_0x582158[_0xbaf1('0x7')];this[_0xbaf1('0x8')]=_0x582158[_0xbaf1('0x8')];this['countglobal']=_0x582158[_0xbaf1('0x6')]+_0x582158['countcongestionretry']+_0x582158[_0xbaf1('0x8')]+_0x582158[_0xbaf1('0x9')]+_0x582158[_0xbaf1('0xa')]+_0x582158[_0xbaf1('0xb')]+_0x582158[_0xbaf1('0xc')]+_0x582158[_0xbaf1('0xd')];this['countnosuchnumberretry']=_0x582158[_0xbaf1('0x9')];this[_0xbaf1('0xa')]=_0x582158[_0xbaf1('0xa')];this[_0xbaf1('0xb')]=_0x582158[_0xbaf1('0xb')];this[_0xbaf1('0xc')]=_0x582158[_0xbaf1('0xc')];this[_0xbaf1('0xd')]=_0x582158[_0xbaf1('0xd')];this[_0xbaf1('0x4')]=_0x582158['queue'];this[_0xbaf1('0xe')]=_0x582158[_0xbaf1('0xf')];this[_0xbaf1('0x10')]=_0x582158[_0xbaf1('0x11')];this[_0xbaf1('0x12')]=_0x582158['starttime'];this[_0xbaf1('0x13')]=_0x582158[_0xbaf1('0x13')];this[_0xbaf1('0x14')]=_0x582158[_0xbaf1('0x13')];this[_0xbaf1('0x15')]=utils[_0xbaf1('0x16')](_0x582158[_0xbaf1('0x13')],_0x582158[_0xbaf1('0x12')]);this[_0xbaf1('0x17')]=0x0;this[_0xbaf1('0x18')]=0x0;this[_0xbaf1('0x19')]=_0x582158[_0xbaf1('0x19')];this[_0xbaf1('0x1a')]=_0x582158[_0xbaf1('0x1a')];this[_0xbaf1('0x1b')]=_0x582158[_0xbaf1('0x1b')];this[_0xbaf1('0x1c')]=_0x582158[_0xbaf1('0x1c')];this['ContactId']=_0x582158['ContactId'];this[_0xbaf1('0x1d')]=_0x582158[_0xbaf1('0x1d')];this[_0xbaf1('0x1e')]=_0x582158[_0xbaf1('0x1e')];this[_0xbaf1('0x1f')]=_0x582158[_0xbaf1('0x1f')];this['CampaignId']=_0x582158[_0xbaf1('0x20')];this[_0xbaf1('0x21')]=_0x582158[_0xbaf1('0x21')]||'';this['originatecalleridname']=_0x582158[_0xbaf1('0x22')]||'';this[_0xbaf1('0x23')]=_0x582158[_0xbaf1('0x23')];this[_0xbaf1('0x24')]=_0x582158['statedesc'];}module[_0xbaf1('0x25')]=History; \ No newline at end of file +var _0xd804=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','endtime','responsetime','ringtime','getSeconds','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x558e1e,_0x4d1811){var _0x1796ba=function(_0x576663){while(--_0x576663){_0x558e1e['push'](_0x558e1e['shift']());}};_0x1796ba(++_0x4d1811);}(_0xd804,0x94));var _0x4d80=function(_0x256773,_0x598214){_0x256773=_0x256773-0x0;var _0xc0a4bb=_0xd804[_0x256773];return _0xc0a4bb;};'use strict';var utils=require('../utils');function History(_0x12579b){this[_0x4d80('0x0')]=_0x12579b[_0x4d80('0x0')];this[_0x4d80('0x1')]=_0x12579b[_0x4d80('0x1')]||undefined;this[_0x4d80('0x2')]=_0x12579b[_0x4d80('0x2')];this['campaigntype']=_0x12579b[_0x4d80('0x2')]===_0x4d80('0x3')?_0x4d80('0x4'):_0x12579b['type'];this[_0x4d80('0x5')]=_0x12579b[_0x4d80('0x5')];this[_0x4d80('0x6')]=_0x12579b[_0x4d80('0x6')];this[_0x4d80('0x7')]=_0x12579b['countnoanswerretry'];this[_0x4d80('0x8')]=_0x12579b[_0x4d80('0x5')]+_0x12579b[_0x4d80('0x6')]+_0x12579b[_0x4d80('0x7')]+_0x12579b[_0x4d80('0x9')]+_0x12579b[_0x4d80('0xa')]+_0x12579b[_0x4d80('0xb')]+_0x12579b['countmachineretry']+_0x12579b[_0x4d80('0xc')];this[_0x4d80('0x9')]=_0x12579b[_0x4d80('0x9')];this[_0x4d80('0xa')]=_0x12579b['countdropretry'];this['countabandonedretry']=_0x12579b['countabandonedretry'];this['countmachineretry']=_0x12579b[_0x4d80('0xd')];this['countagentrejectretry']=_0x12579b[_0x4d80('0xc')];this[_0x4d80('0x4')]=_0x12579b['queue'];this[_0x4d80('0xe')]=_0x12579b[_0x4d80('0xf')];this[_0x4d80('0x10')]=_0x12579b[_0x4d80('0x11')];this['starttime']=_0x12579b['starttime'];this['responsetime']=_0x12579b['responsetime'];this[_0x4d80('0x12')]=_0x12579b[_0x4d80('0x13')];this[_0x4d80('0x14')]=utils[_0x4d80('0x15')](_0x12579b[_0x4d80('0x13')],_0x12579b[_0x4d80('0x16')]);this[_0x4d80('0x17')]=0x0;this[_0x4d80('0x18')]=0x0;this['callback']=_0x12579b[_0x4d80('0x19')];this['callbackuniqueid']=_0x12579b[_0x4d80('0x1a')];this[_0x4d80('0x1b')]=_0x12579b[_0x4d80('0x1b')];this[_0x4d80('0x1c')]=_0x12579b[_0x4d80('0x1c')];this[_0x4d80('0x1d')]=_0x12579b[_0x4d80('0x1d')];this[_0x4d80('0x1e')]=_0x12579b[_0x4d80('0x1e')];this['UserId']=_0x12579b[_0x4d80('0x1f')];this[_0x4d80('0x20')]=_0x12579b[_0x4d80('0x20')];this['CampaignId']=_0x12579b[_0x4d80('0x21')];this['originatecalleridnum']=_0x12579b[_0x4d80('0x22')]||'';this['originatecalleridname']=_0x12579b[_0x4d80('0x23')]||'';this[_0x4d80('0x24')]=_0x12579b[_0x4d80('0x24')];this[_0x4d80('0x25')]=_0x12579b[_0x4d80('0x25')];}module[_0x4d80('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index f1c4a83..34c22be 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x151b=['getSeconds','responsetime','holdtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','number','starttime','droptime','dropreason','endtime'];(function(_0x2ff6c6,_0x26de9e){var _0x2e5015=function(_0x19a870){while(--_0x19a870){_0x2ff6c6['push'](_0x2ff6c6['shift']());}};_0x2e5015(++_0x26de9e);}(_0x151b,0x153));var _0xb151=function(_0x66053d,_0x31e1bf){_0x66053d=_0x66053d-0x0;var _0x5e58fb=_0x151b[_0x66053d];return _0x5e58fb;};'use strict';var utils=require(_0xb151('0x0'));function QueueCallerAbandon(_0x50753c,_0x536251){this[_0xb151('0x1')]=_0x50753c['scheduledat'];this[_0xb151('0x2')]=_0x50753c[_0xb151('0x2')];this[_0xb151('0x3')]=_0x50753c['type']==='outbound'?_0xb151('0x4'):_0x50753c[_0xb151('0x2')];this['countbusyretry']=_0x50753c[_0xb151('0x5')];this['countcongestionretry']=_0x50753c[_0xb151('0x6')];this[_0xb151('0x7')]=_0x50753c[_0xb151('0x7')];this['countglobal']=_0x50753c['countbusyretry']+_0x50753c[_0xb151('0x6')]+_0x50753c[_0xb151('0x7')]+_0x50753c['countnosuchnumberretry']+_0x50753c['countdropretry']+_0x50753c[_0xb151('0x8')]+_0x50753c[_0xb151('0x9')]+_0x50753c[_0xb151('0xa')];this[_0xb151('0xb')]=_0x50753c[_0xb151('0xb')];this[_0xb151('0xc')]=_0x50753c[_0xb151('0xc')];this[_0xb151('0x8')]=_0x50753c[_0xb151('0x8')];this[_0xb151('0x9')]=_0x50753c['countmachineretry'];this[_0xb151('0xa')]=_0x50753c['countagentrejectretry'];this[_0xb151('0xd')]=_0x536251[_0xb151('0xd')];this[_0xb151('0xe')]=_0x50753c[_0xb151('0xf')];this['calleridnum']=_0x50753c[_0xb151('0x10')];this[_0xb151('0x11')]=_0x50753c[_0xb151('0x11')];this['responsetime']=_0x50753c['responsetime'];this[_0xb151('0x12')]=_0x50753c['droptime'];this[_0xb151('0x13')]=_0x50753c['dropreason'];this[_0xb151('0x14')]=this['droptime'];this['ringtime']=utils[_0xb151('0x15')](_0x50753c[_0xb151('0x16')],_0x50753c[_0xb151('0x11')]);this[_0xb151('0x17')]=utils[_0xb151('0x15')](this[_0xb151('0x12')],_0x50753c[_0xb151('0x16')]);this['talktime']=0x0;this[_0xb151('0x4')]=_0x536251[_0xb151('0x4')];this['membername']=_0x536251[_0xb151('0x18')];this[_0xb151('0x19')]=_0x536251[_0xb151('0x19')];this[_0xb151('0x1a')]=_0x50753c[_0xb151('0x1a')];this[_0xb151('0x1b')]=_0x50753c[_0xb151('0x1b')];this[_0xb151('0x1c')]=_0x50753c[_0xb151('0x1c')];this[_0xb151('0x1d')]=_0x50753c['recallme'];this[_0xb151('0x1e')]=_0x50753c[_0xb151('0x1e')];this[_0xb151('0x1f')]=_0x50753c[_0xb151('0x1f')];this[_0xb151('0x20')]=_0x50753c[_0xb151('0x20')];this[_0xb151('0x21')]=_0x50753c[_0xb151('0x21')];this[_0xb151('0x22')]=_0x50753c['CampaignId'];this[_0xb151('0x23')]=_0x50753c[_0xb151('0x23')]||'';this[_0xb151('0x24')]=_0x50753c[_0xb151('0x24')]||'';this[_0xb151('0x25')]=_0x50753c[_0xb151('0x25')];this[_0xb151('0x26')]=_0x50753c[_0xb151('0x26')];this['statedesc']=_0x50753c[_0xb151('0x27')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xe80a=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','dropreason','droptime','ringtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe80a,0x8c));var _0xae80=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe80a[_0x4cf98e];return _0x1623ac;};'use strict';var utils=require(_0xae80('0x0'));function QueueCallerAbandon(_0x3991b6,_0x374c2b){this[_0xae80('0x1')]=_0x3991b6['scheduledat'];this[_0xae80('0x2')]=_0x3991b6[_0xae80('0x2')];this[_0xae80('0x3')]=_0x3991b6[_0xae80('0x2')]===_0xae80('0x4')?'queue':_0x3991b6[_0xae80('0x2')];this[_0xae80('0x5')]=_0x3991b6[_0xae80('0x5')];this['countcongestionretry']=_0x3991b6[_0xae80('0x6')];this[_0xae80('0x7')]=_0x3991b6[_0xae80('0x7')];this[_0xae80('0x8')]=_0x3991b6[_0xae80('0x5')]+_0x3991b6[_0xae80('0x6')]+_0x3991b6[_0xae80('0x7')]+_0x3991b6[_0xae80('0x9')]+_0x3991b6[_0xae80('0xa')]+_0x3991b6[_0xae80('0xb')]+_0x3991b6[_0xae80('0xc')]+_0x3991b6[_0xae80('0xd')];this[_0xae80('0x9')]=_0x3991b6[_0xae80('0x9')];this[_0xae80('0xa')]=_0x3991b6[_0xae80('0xa')];this['countabandonedretry']=_0x3991b6[_0xae80('0xb')];this['countmachineretry']=_0x3991b6['countmachineretry'];this[_0xae80('0xd')]=_0x3991b6['countagentrejectretry'];this[_0xae80('0xe')]=_0x374c2b[_0xae80('0xe')];this[_0xae80('0xf')]=_0x3991b6[_0xae80('0x10')];this[_0xae80('0x11')]=_0x3991b6[_0xae80('0x12')];this[_0xae80('0x13')]=_0x3991b6[_0xae80('0x13')];this[_0xae80('0x14')]=_0x3991b6['responsetime'];this['droptime']=_0x3991b6['droptime'];this['dropreason']=_0x3991b6[_0xae80('0x15')];this['endtime']=this[_0xae80('0x16')];this[_0xae80('0x17')]=utils['getSeconds'](_0x3991b6['responsetime'],_0x3991b6[_0xae80('0x13')]);this['holdtime']=utils['getSeconds'](this['droptime'],_0x3991b6['responsetime']);this[_0xae80('0x18')]=0x0;this[_0xae80('0x19')]=_0x374c2b[_0xae80('0x19')];this[_0xae80('0x1a')]=_0x374c2b[_0xae80('0x1b')];this['reason']=_0x374c2b[_0xae80('0x1c')];this[_0xae80('0x1d')]=_0x3991b6[_0xae80('0x1d')];this[_0xae80('0x1e')]=_0x3991b6['callbackuniqueid'];this[_0xae80('0x1f')]=_0x3991b6[_0xae80('0x1f')];this[_0xae80('0x20')]=_0x3991b6[_0xae80('0x20')];this['ContactId']=_0x3991b6[_0xae80('0x21')];this['ListId']=_0x3991b6[_0xae80('0x22')];this['UserId']=_0x3991b6[_0xae80('0x23')];this[_0xae80('0x24')]=_0x3991b6[_0xae80('0x24')];this[_0xae80('0x25')]=_0x3991b6['CampaignId'];this['originatecalleridnum']=_0x3991b6[_0xae80('0x26')]||'';this[_0xae80('0x27')]=_0x3991b6[_0xae80('0x27')]||'';this[_0xae80('0x28')]=_0x3991b6['agiafterat'];this['state']=_0x3991b6[_0xae80('0x29')];this['statedesc']=_0x3991b6[_0xae80('0x2a')];}module[_0xae80('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index e8ce915..0730d2c 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5496=['[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error'];(function(_0x778a31,_0x527fbd){var _0x44da23=function(_0x209276){while(--_0x209276){_0x778a31['push'](_0x778a31['shift']());}};_0x44da23(++_0x527fbd);}(_0x5496,0x175));var _0x6549=function(_0x141f81,_0x1c5d6d){_0x141f81=_0x141f81-0x0;var _0x3d57f8=_0x5496[_0x141f81];return _0x3d57f8;};'use strict';var util=require(_0x6549('0x0'));var logger=require(_0x6549('0x1'))(_0x6549('0x2'));var cmHopper=require(_0x6549('0x3'));var cmHopperAdditionalPhone=require(_0x6549('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x6549('0x5'));function inspectError(_0x4de1db){return util[_0x6549('0x6')](_0x4de1db,{'showHidden':![],'depth':null});}function getContactDialer(_0x8112c5,_0x3750cc,_0x4d0473){return cmHopper['getContactDialer'](_0x8112c5['id'],_0x3750cc,_0x4d0473,_0x8112c5[_0x6549('0x7')])[_0x6549('0x8')](function(_0x4fcffd){_0x8112c5[_0x6549('0x9')]=0x0;logger[_0x6549('0xa')](_0x6549('0xb'),inspectError(_0x4fcffd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0xa12086,_0x35d008){return cmHopper[_0x6549('0xc')](_0xa12086['id'],_0x35d008,_0xa12086[_0x6549('0x7')])[_0x6549('0x8')](function(_0x3e08a6){_0xa12086['temp']=0x0;logger['error'](_0x6549('0xd'),inspectError(_0x3e08a6));});}exports[_0x6549('0xc')]=getContactDialerIvr;function countReScheduled(_0x3c5f9b){return cmHopper[_0x6549('0xe')](_0x3c5f9b)[_0x6549('0x8')](function(_0x5bc018){logger['error'](_0x6549('0xf'),inspectError(_0x5bc018));});}exports[_0x6549('0xe')]=countReScheduled;function rescheduleContact(_0x57a149){return cmHopper[_0x6549('0x10')](_0x57a149)[_0x6549('0x8')](function(_0x195d25){logger[_0x6549('0xa')](_0x6549('0x11'),inspectError(_0x195d25));});}exports[_0x6549('0x10')]=rescheduleContact;function unlockContact(_0x55c112,_0x5db86d,_0x384f75){return cmHopper[_0x6549('0x12')](_0x55c112,_0x5db86d,_0x384f75)['catch'](function(_0x238a04){logger[_0x6549('0xa')](_0x6549('0x13'),inspectError(_0x238a04));});}exports[_0x6549('0x12')]=unlockContact;function moveContactManagedDialer(_0xffc8b9){return cmHopper['moveContactManagedDialer'](_0xffc8b9)['catch'](function(_0x26a212){logger['error']('[moveContactManagedDialer]',inspectError(_0x26a212));});}exports[_0x6549('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1e5079){return cmHopperBlack[_0x6549('0x15')](_0x1e5079)[_0x6549('0x8')](function(_0x236fd9){logger['error'](_0x6549('0x16'),inspectError(_0x236fd9));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x125096){return cmHopperBlack[_0x6549('0x17')](_0x125096)[_0x6549('0x8')](function(_0x29c6b3){logger[_0x6549('0xa')](_0x6549('0x18'),inspectError(_0x29c6b3));});}exports[_0x6549('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x25bc01,_0x2be467,_0x6ae00c){return cmHopperAdditionalPhone[_0x6549('0x19')](_0x25bc01,_0x2be467,_0x6ae00c)[_0x6549('0x8')](function(_0x23c0ba){logger['error'](_0x6549('0x1a'),inspectError(_0x23c0ba));});}exports[_0x6549('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x53bbca,_0x126967,_0x29f89e){return cmHopperAdditionalPhone[_0x6549('0x1b')](_0x53bbca,_0x126967,_0x29f89e)['catch'](function(_0x31a95){logger[_0x6549('0xa')](_0x6549('0x1c'),inspectError(_0x31a95));});}exports[_0x6549('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x442862){return cmHopperHistory[_0x6549('0x1d')](_0x442862)[_0x6549('0x8')](function(_0xa6c718){logger['error'](_0x6549('0x1e'),inspectError(_0xa6c718));});}exports[_0x6549('0x1d')]=avgHandleTime;function createHistory(_0x17fdfb){return cmHopperHistory['createHistory'](_0x17fdfb)[_0x6549('0x8')](function(_0x4acaf5){logger['error']('[createHistory]',inspectError(_0x4acaf5));});}exports[_0x6549('0x1f')]=createHistory; \ No newline at end of file +var _0x814b=['rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','catch','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','temp','countReScheduled','[countReScheduled]'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x814b,0x1a2));var _0xb814=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0x814b[_0x31880d];return _0x423823;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var cmHopper=require(_0xb814('0x3'));var cmHopperAdditionalPhone=require(_0xb814('0x4'));var cmHopperBlack=require(_0xb814('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x38c21a){return util[_0xb814('0x6')](_0x38c21a,{'showHidden':![],'depth':null});}function getContactDialer(_0x258866,_0x4237bc,_0x44931c){return cmHopper[_0xb814('0x7')](_0x258866['id'],_0x4237bc,_0x44931c,_0x258866['dialOrderByScheduledAt'])[_0xb814('0x8')](function(_0x2e6272){_0x258866['temp']=0x0;logger[_0xb814('0x9')](_0xb814('0xa'),inspectError(_0x2e6272));});}exports[_0xb814('0x7')]=getContactDialer;function getContactDialerIvr(_0x41166c,_0x1fea33){return cmHopper[_0xb814('0xb')](_0x41166c['id'],_0x1fea33,_0x41166c[_0xb814('0xc')])[_0xb814('0x8')](function(_0x207dbc){_0x41166c[_0xb814('0xd')]=0x0;logger[_0xb814('0x9')]('[getContactDialerIvr]',inspectError(_0x207dbc));});}exports[_0xb814('0xb')]=getContactDialerIvr;function countReScheduled(_0x56278f){return cmHopper[_0xb814('0xe')](_0x56278f)[_0xb814('0x8')](function(_0x35b10d){logger[_0xb814('0x9')](_0xb814('0xf'),inspectError(_0x35b10d));});}exports[_0xb814('0xe')]=countReScheduled;function rescheduleContact(_0x1438e7){return cmHopper[_0xb814('0x10')](_0x1438e7)[_0xb814('0x8')](function(_0x2ab627){logger[_0xb814('0x9')](_0xb814('0x11'),inspectError(_0x2ab627));});}exports[_0xb814('0x10')]=rescheduleContact;function unlockContact(_0x39bfcf,_0x303aca,_0x3a71d6){return cmHopper[_0xb814('0x12')](_0x39bfcf,_0x303aca,_0x3a71d6)[_0xb814('0x8')](function(_0x125ce2){logger[_0xb814('0x9')](_0xb814('0x13'),inspectError(_0x125ce2));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x168a48){return cmHopper['moveContactManagedDialer'](_0x168a48)[_0xb814('0x8')](function(_0xfac75b){logger['error']('[moveContactManagedDialer]',inspectError(_0xfac75b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x399b43){return cmHopperBlack['checkIsBlackList'](_0x399b43)['catch'](function(_0xb684ea){logger[_0xb814('0x9')](_0xb814('0x14'),inspectError(_0xb684ea));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0xf5b8aa){return cmHopperBlack['checkIsBlackListIvr'](_0xf5b8aa)[_0xb814('0x8')](function(_0x1808a3){logger[_0xb814('0x9')](_0xb814('0x15'),inspectError(_0x1808a3));});}exports[_0xb814('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bd039,_0x1f5d40,_0x594470){return cmHopperAdditionalPhone[_0xb814('0x17')](_0x2bd039,_0x1f5d40,_0x594470)['catch'](function(_0x3f81d0){logger[_0xb814('0x9')](_0xb814('0x18'),inspectError(_0x3f81d0));});}exports[_0xb814('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1c8a2e,_0xb9e57d,_0x3d836c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1c8a2e,_0xb9e57d,_0x3d836c)[_0xb814('0x8')](function(_0xc0ef66){logger[_0xb814('0x9')](_0xb814('0x19'),inspectError(_0xc0ef66));});}exports[_0xb814('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x1d5965){return cmHopperHistory[_0xb814('0x1b')](_0x1d5965)[_0xb814('0x8')](function(_0x5a6291){logger[_0xb814('0x9')](_0xb814('0x1c'),inspectError(_0x5a6291));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x9008b2){return cmHopperHistory[_0xb814('0x1d')](_0x9008b2)[_0xb814('0x8')](function(_0x499f22){logger[_0xb814('0x9')](_0xb814('0x1e'),inspectError(_0x499f22));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index eb1094f..dfe144e 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x079d=['extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','createdAt','tags','updatedAt','%s%s','XMD-','setXMDContactVariables','lodash','moment','../../../../config/logger','../../../../config/environment/shared','timezones','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','milliseconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','TrunkBackup','includes','ACTIVE','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','match'];(function(_0x26a808,_0x44248f){var _0x143bdc=function(_0x3d4412){while(--_0x3d4412){_0x26a808['push'](_0x26a808['shift']());}};_0x143bdc(++_0x44248f);}(_0x079d,0x1b7));var _0xd079=function(_0x3ebe59,_0xd6b50){_0x3ebe59=_0x3ebe59-0x0;var _0x31fd01=_0x079d[_0x3ebe59];return _0x31fd01;};'use strict';var _=require(_0xd079('0x0'));var moment=require(_0xd079('0x1'));var util=require('util');var logger=require(_0xd079('0x2'))('dialer');var timezones=require(_0xd079('0x3'))[_0xd079('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xd079('0x5'),'DEACTIVATED':_0xd079('0x6'),'DISACTIVED':_0xd079('0x7'),'EMPTY_INTERVAL':_0xd079('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xd079('0x9'),'NO_AVAILABLE_CONTACTS':_0xd079('0xa'),'NULL_INTERVAL':_0xd079('0xb'),'OVERTIME_INTERVAL':_0xd079('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xd079('0xd'),'QUEUE_RECALL':_0xd079('0xe'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xd079('0xf'),'UNKNOWN_TIMEZONE':_0xd079('0x10'),'UNREACHABLE_TRUNK':_0xd079('0x11')};exports[_0xd079('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x509605){return _0x509605[_0xd079('0x13')]==='preview';}exports[_0xd079('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x3d7abc){return _0x3d7abc[_0xd079('0x15')]===_0xd079('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x1b521f){return _0x1b521f['type']===_0xd079('0x17');}exports[_0xd079('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x5b20c7){return _0x5b20c7['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x6adc6f){return _0x6adc6f['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x51beb,_0x424a17){var _0x4d8c39=moment(_0x51beb)[_0xd079('0x19')](0x0);var _0x48939f=moment(_0x424a17)[_0xd079('0x19')](0x0);return _0x4d8c39['diff'](_0x48939f,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x3aaf56,_0x4b9114){var _0x5a84bf=![];var _0x1d3e65=_0x3aaf56[_0xd079('0x13')]!==_0x4b9114[_0xd079('0x13')]||_0x3aaf56[_0xd079('0x1a')]!==_0x4b9114[_0xd079('0x1a')]||_0x3aaf56[_0xd079('0x1b')]!==_0x4b9114[_0xd079('0x1b')];var _0x4bfb41=_0x3aaf56[_0xd079('0x1c')]!==_0x4b9114['available']||_0x3aaf56[_0xd079('0x1d')]!==_0x4b9114['loggedIn']||_0x3aaf56['loggedInDb']!==_0x4b9114[_0xd079('0x1e')]||_0x3aaf56[_0xd079('0x1f')]!==_0x4b9114[_0xd079('0x1f')]||_0x3aaf56[_0xd079('0x20')]!==_0x4b9114[_0xd079('0x20')]||_0x3aaf56['pTalking']!==_0x4b9114[_0xd079('0x21')]||_0x3aaf56['waiting']!==_0x4b9114[_0xd079('0x22')]||_0x3aaf56['inUse']!==_0x4b9114[_0xd079('0x23')]||_0x3aaf56[_0xd079('0x24')]!==_0x4b9114['originated'];if(_0x3aaf56[_0xd079('0x25')]&&_0x4b9114[_0xd079('0x25')]){_0x5a84bf=_0x3aaf56['Trunk']['name']!==_0x4b9114[_0xd079('0x25')][_0xd079('0x26')]||_0x3aaf56['Trunk'][_0xd079('0x27')]!==_0x4b9114[_0xd079('0x25')][_0xd079('0x27')];}return _0x1d3e65||_0x4bfb41||_0x5a84bf;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x106b8c){var _0x35ec60=null;var _0x1e1712=_0x106b8c[_0xd079('0x28')];if(_[_0xd079('0x29')](_0x106b8c[_0xd079('0x2a')])||_['isNil'](_0x106b8c[_0xd079('0x2b')])||_['isNil'](_0x106b8c[_0xd079('0x2b')][_0xd079('0x2c')])){_0x35ec60=CAMPAIGN_STATUS[_0xd079('0x2d')];}else if(_[_0xd079('0x2e')](_0x106b8c['dialGlobalInterval'])||_['isEmpty'](_0x106b8c[_0xd079('0x2b')][_0xd079('0x2c')])){_0x35ec60=CAMPAIGN_STATUS[_0xd079('0x2f')];}else if(_0x1e1712&&!timezones[_0x1e1712]){_0x35ec60=CAMPAIGN_STATUS[_0xd079('0x30')];}return _0x35ec60;}function checkAnyValidTrunk(_0x15fd9a,_0x52f0e6){var _0x327e03=null;var _0x183cac=_0xd079('0x31');var _0x21bc5f=[_0xd079('0x32'),_0xd079('0x33')];var _0x4f4fbd=!![];if(_0x15fd9a['Trunk']&&_0x15fd9a[_0xd079('0x25')][_0xd079('0x27')]){_0x183cac+=_0x15fd9a[_0xd079('0x25')]['name'];_0x327e03=_0x52f0e6[_0x183cac];_0x4f4fbd=_0x21bc5f['includes'](_0x327e03['status']);}else if(_0x15fd9a[_0xd079('0x34')]&&_0x15fd9a['TrunkBackup']['active']){_0x183cac+=_0x15fd9a[_0xd079('0x34')]['name'];_0x327e03=_0x52f0e6[_0x183cac];_0x4f4fbd=_0x21bc5f[_0xd079('0x35')](_0x327e03['status']);}return _0x4f4fbd;}function getQueueCampaignStatusMessage(_0x609cf9,_0x59943a){var _0x18c6ed=CAMPAIGN_STATUS[_0xd079('0x36')];var _0x5472de=isPreviewCampaign(_0x609cf9);if(!isQueueCampaignActive(_0x609cf9)){if(_0x5472de){_0x18c6ed=CAMPAIGN_STATUS[_0xd079('0x37')];}else{if(_0x609cf9[_0xd079('0x24')]===0x0&&_0x609cf9['talking']===0x0&&_0x609cf9[_0xd079('0x22')]===0x0&&(_0x609cf9[_0xd079('0x21')]||0x0)===0x0){_0x18c6ed=CAMPAIGN_STATUS[_0xd079('0x37')];}else{_0x18c6ed=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x609cf9[_0xd079('0x1d')]===0x0){_0x18c6ed=CAMPAIGN_STATUS[_0xd079('0x38')];}else if(!checkAnyValidTrunk(_0x609cf9,_0x59943a)){_0x18c6ed=CAMPAIGN_STATUS[_0xd079('0x39')];}else if(!isPreviewCampaign(_0x609cf9)){var _0x12b457=checkAnyValidQueueCampaignInterval(_0x609cf9);if(_0x12b457){_0x18c6ed=_0x12b457;}}return _0x18c6ed;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x30b4de){var _0x37070b=CAMPAIGN_STATUS['DISACTIVED'];if(_0x30b4de[_0xd079('0x24')]===0x0&&_0x30b4de[_0xd079('0x20')]===0x0&&_0x30b4de[_0xd079('0x22')]===0x0&&(_0x30b4de[_0xd079('0x21')]||0x0)===0x0){_0x37070b=CAMPAIGN_STATUS['INACTIVE'];}return _0x37070b;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x32d035){var _0x229a87=_0x32d035[_0xd079('0x3a')](/"(.*?)"/);return _0x229a87?_0x229a87[0x1]:_0x32d035;}exports[_0xd079('0x3b')]=extractCalleridName;function getCallerId(_0x5a23e8,_0x1c9b81,_0x346e7b){if(!_[_0xd079('0x3c')](_0x346e7b)&&typeof _0x346e7b===_0xd079('0x3d')&&!_[_0xd079('0x2e')](_0x346e7b)){if(!_[_0xd079('0x3c')](_0x1c9b81)&&typeof _0x1c9b81===_0xd079('0x3d')&&!_[_0xd079('0x2e')](_0x1c9b81)){return util[_0xd079('0x3e')](_0xd079('0x3f'),_0x1c9b81,_0x346e7b);}return util[_0xd079('0x3e')]('\x22%s\x22\x20<%s>',_0x346e7b,_0x346e7b);}if(!_['isUndefined'](_0x5a23e8)&&typeof _0x5a23e8===_0xd079('0x3d')&&!_[_0xd079('0x2e')](_0x5a23e8)){return _0x5a23e8;}return _0xd079('0x40');}exports[_0xd079('0x41')]=getCallerId;function getCallerIdRandom(_0x43eb8c,_0x74d59a){var _0x25fffe;var _0x2c6ece;var _0x440fb3;if(_0x74d59a<=0x0){_0x74d59a=0x1;}_0x25fffe=new RegExp(_0xd079('0x42')+_0x74d59a+'}$');_0x2c6ece=Math[_0xd079('0x43')](0xa,_0x74d59a-0x1);_0x440fb3=Math['pow'](0xa,_0x74d59a)-0x1;return util['format']('%s',_[_0xd079('0x44')](_0x43eb8c,_0x25fffe,_[_0xd079('0x45')](_0x2c6ece,_0x440fb3)[_0xd079('0x46')]()));}exports[_0xd079('0x47')]=getCallerIdRandom;function decrementOriginate(_0x28c31b){if(_0x28c31b['originated']&&_0x28c31b[_0xd079('0x24')]>0x0){_0x28c31b[_0xd079('0x24')]-=0x1;}else{logger[_0xd079('0x48')](_0xd079('0x49'));}}exports[_0xd079('0x4a')]=decrementOriginate;function checkContactEmpty(_0x1b459b){return _0x1b459b&&_0x1b459b[_0xd079('0x4b')]>0x0;}exports[_0xd079('0x4c')]=checkContactEmpty;function erlangb(_0x43c566,_0x2ff374){if(_0x2ff374===0x0){return 0x0;}var _0x488fed=0x1;for(var _0x31c1dd=0x1;_0x31c1dd<=_0x2ff374;_0x31c1dd+=0x1){_0x488fed=0x1+_0x488fed*_0x31c1dd/_0x43c566;}return 0x1/_0x488fed;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0xec47b,_0x496bf6,_0x114279){if(_0x496bf6>_0x114279){for(var _0x5132bb=0x0;_0x5132bb<_0x496bf6-_0x114279;_0x5132bb+=0x1){decrementOriginate(_0xec47b);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x21ea8f){var _0x1b3596={};var _0x42c4f8=['id',_0xd079('0x4d'),'description',_0xd079('0x4e'),_0xd079('0x4f')];if(_0x21ea8f){for(var _0x155066 in _0x21ea8f){if(typeof _0x21ea8f[_0x155066]!=='undefined'){if(!_['isNil'](_0x21ea8f[_0x155066])&&!_0x42c4f8[_0xd079('0x35')](_0x155066)){_0x1b3596[util[_0xd079('0x3e')](_0xd079('0x50'),_0xd079('0x51'),_0x155066['toUpperCase']())]=_0x21ea8f[_0x155066];}}}}return _0x1b3596;}exports[_0xd079('0x52')]=setXMDContactVariables; \ No newline at end of file +var _0x3558=['NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','extractCalleridName','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','decrementOriginate','length','createdAt','description','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','active','diff','seconds','getSeconds','dialMethod','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED'];(function(_0x4315b1,_0x160c06){var _0x12a1a9=function(_0x1c0abf){while(--_0x1c0abf){_0x4315b1['push'](_0x4315b1['shift']());}};_0x12a1a9(++_0x160c06);}(_0x3558,0x15e));var _0x8355=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0x3558[_0xce6f11];return _0x35b709;};'use strict';var _=require(_0x8355('0x0'));var moment=require(_0x8355('0x1'));var util=require(_0x8355('0x2'));var logger=require(_0x8355('0x3'))(_0x8355('0x4'));var timezones=require(_0x8355('0x5'))[_0x8355('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x8355('0x7'),'BLACKLIST':_0x8355('0x8'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x8355('0x9'),'EMPTY_INTERVAL':_0x8355('0xa'),'INACTIVE':_0x8355('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x8355('0xc'),'NULL_INTERVAL':_0x8355('0xd'),'OVERTIME_INTERVAL':_0x8355('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x8355('0xf'),'QUEUE_RECALL':_0x8355('0x10'),'RECALL_TIMEOUT':_0x8355('0x11'),'RUNNING':_0x8355('0x12'),'UNKNOWN_TIMEZONE':_0x8355('0x13'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x8355('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5d8420){return _0x5d8420['dialMethod']===_0x8355('0x15');}exports[_0x8355('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x352c8c){return _0x352c8c[_0x8355('0x17')]===_0x8355('0x18');}exports[_0x8355('0x19')]=isIVRCampaign;function isOutboundQueue(_0x197cad){return _0x197cad[_0x8355('0x17')]==='outbound';}exports[_0x8355('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x15d05d){return _0x15d05d['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x272793){return _0x272793[_0x8355('0x1b')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x370773,_0x12490f){var _0x4b53cf=moment(_0x370773)['milliseconds'](0x0);var _0x21f0ef=moment(_0x12490f)['milliseconds'](0x0);return _0x4b53cf[_0x8355('0x1c')](_0x21f0ef,_0x8355('0x1d'));}exports[_0x8355('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x4304e6,_0x181737){var _0x7d8ca1=![];var _0x51e6be=_0x4304e6['dialMethod']!==_0x181737[_0x8355('0x1f')]||_0x4304e6[_0x8355('0x20')]!==_0x181737['dialActive']||_0x4304e6[_0x8355('0x21')]!==_0x181737[_0x8355('0x21')];var _0x23412b=_0x4304e6[_0x8355('0x22')]!==_0x181737[_0x8355('0x22')]||_0x4304e6[_0x8355('0x23')]!==_0x181737['loggedIn']||_0x4304e6[_0x8355('0x24')]!==_0x181737[_0x8355('0x24')]||_0x4304e6[_0x8355('0x25')]!==_0x181737[_0x8355('0x25')]||_0x4304e6[_0x8355('0x26')]!==_0x181737[_0x8355('0x26')]||_0x4304e6[_0x8355('0x27')]!==_0x181737[_0x8355('0x27')]||_0x4304e6[_0x8355('0x28')]!==_0x181737[_0x8355('0x28')]||_0x4304e6[_0x8355('0x29')]!==_0x181737['inUse']||_0x4304e6[_0x8355('0x2a')]!==_0x181737['originated'];if(_0x4304e6['Trunk']&&_0x181737[_0x8355('0x2b')]){_0x7d8ca1=_0x4304e6[_0x8355('0x2b')][_0x8355('0x2c')]!==_0x181737[_0x8355('0x2b')][_0x8355('0x2c')]||_0x4304e6[_0x8355('0x2b')][_0x8355('0x1b')]!==_0x181737[_0x8355('0x2b')][_0x8355('0x1b')];}return _0x51e6be||_0x23412b||_0x7d8ca1;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3d9063){var _0x3a807f=null;var _0x201138=_0x3d9063[_0x8355('0x2d')];if(_[_0x8355('0x2e')](_0x3d9063[_0x8355('0x2f')])||_[_0x8355('0x2e')](_0x3d9063['Interval'])||_[_0x8355('0x2e')](_0x3d9063[_0x8355('0x30')][_0x8355('0x31')])){_0x3a807f=CAMPAIGN_STATUS[_0x8355('0x32')];}else if(_[_0x8355('0x33')](_0x3d9063['dialGlobalInterval'])||_[_0x8355('0x33')](_0x3d9063[_0x8355('0x30')][_0x8355('0x31')])){_0x3a807f=CAMPAIGN_STATUS[_0x8355('0x34')];}else if(_0x201138&&!timezones[_0x201138]){_0x3a807f=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x3a807f;}function checkAnyValidTrunk(_0x3e8025,_0x458196){var _0x133417=null;var _0x10df8c=_0x8355('0x35');var _0x2d8d38=['reachable',_0x8355('0x36')];var _0x272747=!![];if(_0x3e8025[_0x8355('0x2b')]&&_0x3e8025[_0x8355('0x2b')][_0x8355('0x1b')]){_0x10df8c+=_0x3e8025[_0x8355('0x2b')][_0x8355('0x2c')];_0x133417=_0x458196[_0x10df8c];_0x272747=_0x2d8d38[_0x8355('0x37')](_0x133417[_0x8355('0x38')]);}else if(_0x3e8025['TrunkBackup']&&_0x3e8025[_0x8355('0x39')][_0x8355('0x1b')]){_0x10df8c+=_0x3e8025[_0x8355('0x39')]['name'];_0x133417=_0x458196[_0x10df8c];_0x272747=_0x2d8d38[_0x8355('0x37')](_0x133417[_0x8355('0x38')]);}return _0x272747;}function getQueueCampaignStatusMessage(_0x2e2808,_0x4ebe79){var _0x4166a7=CAMPAIGN_STATUS[_0x8355('0x7')];var _0x577b56=isPreviewCampaign(_0x2e2808);if(!isQueueCampaignActive(_0x2e2808)){if(_0x577b56){_0x4166a7=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2e2808[_0x8355('0x2a')]===0x0&&_0x2e2808['talking']===0x0&&_0x2e2808[_0x8355('0x28')]===0x0&&(_0x2e2808[_0x8355('0x27')]||0x0)===0x0){_0x4166a7=CAMPAIGN_STATUS[_0x8355('0x3a')];}else{_0x4166a7=CAMPAIGN_STATUS[_0x8355('0x3b')];}}}else if(_0x2e2808[_0x8355('0x23')]===0x0){_0x4166a7=CAMPAIGN_STATUS[_0x8355('0x3c')];}else if(!checkAnyValidTrunk(_0x2e2808,_0x4ebe79)){_0x4166a7=CAMPAIGN_STATUS[_0x8355('0x3d')];}else if(!isPreviewCampaign(_0x2e2808)){var _0x568c87=checkAnyValidQueueCampaignInterval(_0x2e2808);if(_0x568c87){_0x4166a7=_0x568c87;}}return _0x4166a7;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x40131b){var _0xfd0d26=CAMPAIGN_STATUS[_0x8355('0x3b')];if(_0x40131b['originated']===0x0&&_0x40131b[_0x8355('0x26')]===0x0&&_0x40131b[_0x8355('0x28')]===0x0&&(_0x40131b[_0x8355('0x27')]||0x0)===0x0){_0xfd0d26=CAMPAIGN_STATUS[_0x8355('0x3a')];}return _0xfd0d26;}exports[_0x8355('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x53b2b2){var _0x2934cf=_0x53b2b2['match'](/"(.*?)"/);return _0x2934cf?_0x2934cf[0x1]:_0x53b2b2;}exports[_0x8355('0x3f')]=extractCalleridName;function getCallerId(_0x7a2f99,_0x50f617,_0x2a8812){if(!_['isUndefined'](_0x2a8812)&&typeof _0x2a8812===_0x8355('0x40')&&!_[_0x8355('0x33')](_0x2a8812)){if(!_['isUndefined'](_0x50f617)&&typeof _0x50f617==='string'&&!_[_0x8355('0x33')](_0x50f617)){return util[_0x8355('0x41')](_0x8355('0x42'),_0x50f617,_0x2a8812);}return util[_0x8355('0x41')](_0x8355('0x42'),_0x2a8812,_0x2a8812);}if(!_['isUndefined'](_0x7a2f99)&&typeof _0x7a2f99===_0x8355('0x40')&&!_[_0x8355('0x33')](_0x7a2f99)){return _0x7a2f99;}return'\x22\x22\x20<>';}exports[_0x8355('0x43')]=getCallerId;function getCallerIdRandom(_0x188d0e,_0x399ba2){var _0x54245b;var _0x42fc2c;var _0x2a8f72;if(_0x399ba2<=0x0){_0x399ba2=0x1;}_0x54245b=new RegExp(_0x8355('0x44')+_0x399ba2+'}$');_0x42fc2c=Math[_0x8355('0x45')](0xa,_0x399ba2-0x1);_0x2a8f72=Math[_0x8355('0x45')](0xa,_0x399ba2)-0x1;return util[_0x8355('0x41')]('%s',_[_0x8355('0x46')](_0x188d0e,_0x54245b,_[_0x8355('0x47')](_0x42fc2c,_0x2a8f72)[_0x8355('0x48')]()));}exports[_0x8355('0x49')]=getCallerIdRandom;function decrementOriginate(_0x3d1bad){if(_0x3d1bad[_0x8355('0x2a')]&&_0x3d1bad[_0x8355('0x2a')]>0x0){_0x3d1bad['originated']-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x8355('0x4a')]=decrementOriginate;function checkContactEmpty(_0x4fb69b){return _0x4fb69b&&_0x4fb69b[_0x8355('0x4b')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x4c277e,_0x2e4c07){if(_0x2e4c07===0x0){return 0x0;}var _0x51c5ed=0x1;for(var _0x314392=0x1;_0x314392<=_0x2e4c07;_0x314392+=0x1){_0x51c5ed=0x1+_0x51c5ed*_0x314392/_0x4c277e;}return 0x1/_0x51c5ed;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x379da5,_0x187f70,_0x45a357){if(_0x187f70>_0x45a357){for(var _0x3bf2cf=0x0;_0x3bf2cf<_0x187f70-_0x45a357;_0x3bf2cf+=0x1){decrementOriginate(_0x379da5);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x40ad98){var _0x1c9005={};var _0x3ebce6=['id',_0x8355('0x4c'),_0x8355('0x4d'),'tags','updatedAt'];if(_0x40ad98){for(var _0x26975d in _0x40ad98){if(typeof _0x40ad98[_0x26975d]!=='undefined'){if(!_[_0x8355('0x2e')](_0x40ad98[_0x26975d])&&!_0x3ebce6[_0x8355('0x37')](_0x26975d)){_0x1c9005[util['format'](_0x8355('0x4e'),_0x8355('0x4f'),_0x26975d[_0x8355('0x50')]())]=_0x40ad98[_0x26975d];}}}}return _0x1c9005;}exports[_0x8355('0x51')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index aa592d0..52f302a 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(_0x463e2d,_0x55f7f8){var _0x119b4f=function(_0x2e5ffd){while(--_0x2e5ffd){_0x463e2d['push'](_0x463e2d['shift']());}};_0x119b4f(++_0x55f7f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x4d49d8,_0x1eb52d){var _0x2873f0=function(_0xb2dd57){while(--_0xb2dd57){_0x4d49d8['push'](_0x4d49d8['shift']());}};_0x2873f0(++_0x1eb52d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 b68596f..f017632 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 _0xa156=['channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage'];(function(_0x527c8c,_0x51f019){var _0xbe7cc3=function(_0x30e95a){while(--_0x30e95a){_0x527c8c['push'](_0x527c8c['shift']());}};_0xbe7cc3(++_0x51f019);}(_0xa156,0xe8));var _0x6a15=function(_0x49cdb8,_0x213faa){_0x49cdb8=_0x49cdb8-0x0;var _0x5838d4=_0xa156[_0x49cdb8];return _0x5838d4;};'use strict';var util=require('util');var _=require(_0x6a15('0x0'));var BPromise=require(_0x6a15('0x1'));var uuid=require(_0x6a15('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x6a15('0x3'));var gs=require(_0x6a15('0x4'));var logger=require('../../../config/logger')(_0x6a15('0x5'));var ami=require(_0x6a15('0x6'));var rpcDb=require(_0x6a15('0x7'));var Channel=require(_0x6a15('0x8'));var ut=require(_0x6a15('0x9'));var Action=require(_0x6a15('0xa'));var faxAccount=require(_0x6a15('0xb'));var attachment=require(_0x6a15('0xc'));var faxMessage=require(_0x6a15('0xd'));function Fax(_0x31a620){this[_0x6a15('0xe')]={};this['faxAccounts']=_0x31a620[_0x6a15('0xf')];this[_0x6a15('0x10')]=_0x31a620[_0x6a15('0x10')];this[_0x6a15('0x11')]={};ami['on'](_0x6a15('0x12'),this[_0x6a15('0x13')][_0x6a15('0x14')](this));ami['on'](_0x6a15('0x15'),this[_0x6a15('0x16')]['bind'](this));ami['on'](_0x6a15('0x17'),this[_0x6a15('0x18')][_0x6a15('0x14')](this));ami['on'](_0x6a15('0x19'),this['syncNewExten'][_0x6a15('0x14')](this));ami['on'](_0x6a15('0x1a'),this[_0x6a15('0x1b')]['bind'](this));ami['on'](_0x6a15('0x1c'),this[_0x6a15('0x1d')][_0x6a15('0x14')](this));ami['on']('hangup',this[_0x6a15('0x1e')][_0x6a15('0x14')](this));ami['on'](_0x6a15('0x1f'),this[_0x6a15('0x20')][_0x6a15('0x14')](this));}Fax[_0x6a15('0x21')][_0x6a15('0x13')]=function(_0x36e562){if(_0x36e562[_0x6a15('0x22')]===_0x6a15('0x23')){for(var _0x4facc0 in this[_0x6a15('0xf')]){if(this['faxAccounts']['hasOwnProperty'](_0x4facc0)){if(_0x36e562['exten']===this[_0x6a15('0xf')][_0x4facc0][_0x6a15('0x24')]){this[_0x6a15('0xe')][_0x36e562[_0x6a15('0x25')]]={};this[_0x6a15('0xe')][_0x36e562[_0x6a15('0x25')]][_0x6a15('0x26')]=_0x36e562['channel'];this[_0x6a15('0xe')][_0x36e562[_0x6a15('0x25')]]['id']=this[_0x6a15('0xf')][_0x4facc0]['id'];this[_0x6a15('0xe')][_0x36e562['uniqueid']][_0x6a15('0x27')]=this[_0x6a15('0xf')][_0x4facc0][_0x6a15('0x27')];logger[_0x6a15('0x28')](_0x36e562['uniqueid'],_0x6a15('0x29'));}}}}if(this[_0x6a15('0x11')][_0x36e562[_0x6a15('0x25')]]){this[_0x6a15('0xe')][_0x36e562[_0x6a15('0x25')]]={};this[_0x6a15('0xe')][_0x36e562[_0x6a15('0x25')]][_0x6a15('0x26')]=_0x36e562['channel'];logger[_0x6a15('0x28')](_0x36e562[_0x6a15('0x25')],_0x6a15('0x29'));}};Fax[_0x6a15('0x21')][_0x6a15('0x16')]=function(_0x14327d){if(this[_0x6a15('0xe')][_0x14327d[_0x6a15('0x25')]]){for(var _0x48dfe7 in _0x14327d['variable']){if(_0x14327d[_0x6a15('0x2a')][_0x6a15('0x2b')](_0x48dfe7)){this[_0x6a15('0xe')][_0x14327d[_0x6a15('0x25')]][_0x48dfe7]=_0x14327d[_0x6a15('0x2c')];}}}};Fax[_0x6a15('0x21')][_0x6a15('0x18')]=function(_0x1246c5){if(this[_0x6a15('0xe')][_0x1246c5[_0x6a15('0x25')]]){this[_0x6a15('0xe')][_0x1246c5['uniqueid']]['channelstate']=_0x1246c5[_0x6a15('0x2d')];this[_0x6a15('0xe')][_0x1246c5['uniqueid']][_0x6a15('0x2e')]=_0x1246c5[_0x6a15('0x2e')];}};Fax[_0x6a15('0x21')]['syncNewExten']=function(_0x2a8f4c){if(this[_0x6a15('0xe')][_0x2a8f4c['uniqueid']]){for(var _0x4b909c in _0x2a8f4c[_0x6a15('0x2a')]){if(_0x2a8f4c[_0x6a15('0x2a')]['hasOwnProperty'](_0x4b909c)){this[_0x6a15('0xe')][_0x2a8f4c[_0x6a15('0x25')]][_0x4b909c]=_0x2a8f4c[_0x6a15('0x2c')];}}}};Fax[_0x6a15('0x21')][_0x6a15('0x1b')]=function(_0x5da614){if(this[_0x6a15('0xe')][_0x5da614['uniqueid']]){this[_0x6a15('0xe')][_0x5da614[_0x6a15('0x25')]][_0x6a15('0x2f')]=_0x5da614['operation'];this[_0x6a15('0xe')][_0x5da614[_0x6a15('0x25')]][_0x6a15('0x30')]=_0x5da614[_0x6a15('0x30')];this['channels'][_0x5da614[_0x6a15('0x25')]]['localstationid']=_0x5da614[_0x6a15('0x24')];this[_0x6a15('0xe')][_0x5da614[_0x6a15('0x25')]]['filename']=_0x5da614[_0x6a15('0x31')];logger['info'](_0x5da614[_0x6a15('0x25')],_0x6a15('0x32'));}};Fax['prototype'][_0x6a15('0x1d')]=function(_0x1fa33a){var _0x715d97=this;if(this[_0x6a15('0xe')][_0x1fa33a[_0x6a15('0x25')]]){var _0x490cd1=this['channels'][_0x1fa33a[_0x6a15('0x25')]]['id'];this['channels'][_0x1fa33a[_0x6a15('0x25')]]['remotestationid']=_0x1fa33a[_0x6a15('0x33')];this[_0x6a15('0xe')][_0x1fa33a[_0x6a15('0x25')]][_0x6a15('0x34')]=_0x1fa33a[_0x6a15('0x34')];this[_0x6a15('0xe')][_0x1fa33a[_0x6a15('0x25')]][_0x6a15('0x24')]=_0x1fa33a['localstationid'];this['channels'][_0x1fa33a[_0x6a15('0x25')]]['resolution']=_0x1fa33a[_0x6a15('0x35')];this['channels'][_0x1fa33a[_0x6a15('0x25')]][_0x6a15('0x36')]=_0x1fa33a[_0x6a15('0x36')];this['channels'][_0x1fa33a['uniqueid']][_0x6a15('0x31')]=_0x1fa33a['filename'];this[_0x6a15('0xe')][_0x1fa33a[_0x6a15('0x25')]][_0x6a15('0x37')]=_0x1fa33a[_0x6a15('0x37')];if(this[_0x6a15('0xe')][_0x1fa33a[_0x6a15('0x25')]][_0x6a15('0x34')]>0x0){tiff2pdf(_0x1fa33a[_0x6a15('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x38a52e){logger[_0x6a15('0x28')](_0x1fa33a[_0x6a15('0x25')],_0x6a15('0x38'),_0x38a52e[_0x6a15('0x39')]);attachment[_0x6a15('0x3a')]({'name':path[_0x6a15('0x3b')](_0x1fa33a[_0x6a15('0x31')])[_0x6a15('0x27')],'basename':path[_0x6a15('0x3b')](_0x1fa33a[_0x6a15('0x31')])['name']+_0x6a15('0x3c'),'type':'application/pdf'})[_0x6a15('0x3d')](function(_0x11610e){faxAccount[_0x6a15('0x3e')](_0x490cd1,{'from':_0x1fa33a[_0x6a15('0x37')],'mapKey':'fax','body':path[_0x6a15('0x3b')](_0x1fa33a['filename'])['name']+_0x6a15('0x3c'),'AttachmentId':_0x11610e['id']})[_0x6a15('0x3f')](function(_0x9e7342){logger[_0x6a15('0x40')](_0x1fa33a['uniqueid'],_0x6a15('0x41'),JSON[_0x6a15('0x42')](_0x9e7342));});})[_0x6a15('0x3f')](function(_0x1bb435){logger[_0x6a15('0x40')](_0x1fa33a[_0x6a15('0x25')],_0x6a15('0x43'),JSON[_0x6a15('0x42')](_0x1bb435));});});}logger['info'](_0x1fa33a[_0x6a15('0x25')],_0x6a15('0x43'));}};Fax[_0x6a15('0x21')][_0x6a15('0x20')]=function(_0x2a6304){if(this[_0x6a15('0x11')][_0x2a6304[_0x6a15('0x25')]]){_[_0x6a15('0x44')](this[_0x6a15('0xe')][_0x2a6304[_0x6a15('0x25')]],_[_0x6a15('0x45')](_0x2a6304,[_0x6a15('0x46'),_0x6a15('0x47')]));}};function updateStatus(_0x15a533){if(_0x15a533[_0x6a15('0x48')]){faxMessage['update'](_0x15a533['AttachmentId'],{'failMessage':_0x6a15('0x49')})['then'](function(_0x6ac9cf){ut[_0x6a15('0x4a')](_0x6a15('0x4b'),_0x6ac9cf);})[_0x6a15('0x3f')](function(_0x3d4bb8){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x3d4bb8);});}else{ut[_0x6a15('0x4a')](_0x6a15('0x4c'));}}Fax[_0x6a15('0x21')]['updateStatus']=function(_0x3c0a77,_0x15ffe7,_0x5edb05){var _0x13d1db=this;var _0x1c41bb={};if(_0x15ffe7){_0x1c41bb={'read':_0x15ffe7};}else{_0x1c41bb={'failMessage':_0x5edb05};}if(this[_0x6a15('0x11')][_0x3c0a77]['AttachmentId']){faxMessage[_0x6a15('0x4d')](this[_0x6a15('0x11')][_0x3c0a77]['AttachmentId'],_0x1c41bb)[_0x6a15('0x3d')](function(_0x536f4f){ut[_0x6a15('0x4a')](_0x6a15('0x4e'),_0x536f4f);})[_0x6a15('0x3f')](function(_0x1e6b23){ut[_0x6a15('0x4a')](_0x6a15('0x4f'),_0x1e6b23);})[_0x6a15('0x50')](function(){delete _0x13d1db[_0x6a15('0xe')][_0x3c0a77];delete _0x13d1db[_0x6a15('0x11')][_0x3c0a77];});}else{ut[_0x6a15('0x4a')](_0x6a15('0x51'));delete this[_0x6a15('0xe')][_0x3c0a77];delete this[_0x6a15('0x11')][_0x3c0a77];}};Fax['prototype'][_0x6a15('0x1e')]=function(_0x48c958){var _0x6da0fc=this;if(this['channels'][_0x48c958[_0x6a15('0x25')]]){if(this[_0x6a15('0x11')][_0x48c958[_0x6a15('0x25')]]){this[_0x6a15('0xe')][_0x48c958[_0x6a15('0x25')]]['id']=this[_0x6a15('0x11')][_0x48c958[_0x6a15('0x25')]]['id'];this['channels'][_0x48c958[_0x6a15('0x25')]][_0x6a15('0x27')]=this[_0x6a15('0x11')][_0x48c958[_0x6a15('0x25')]][_0x6a15('0x27')];}logger[_0x6a15('0x28')](_0x48c958[_0x6a15('0x25')],this[_0x6a15('0x11')][_0x48c958[_0x6a15('0x25')]]?_0x6a15('0x52'):_0x6a15('0x53'),JSON['stringify'](this['channels'][_0x48c958[_0x6a15('0x25')]]));if(this[_0x6a15('0x11')][_0x48c958[_0x6a15('0x25')]]){if(this[_0x6a15('0xe')][_0x48c958['uniqueid']][_0x6a15('0x54')]>0x0&&this[_0x6a15('0xe')][_0x48c958[_0x6a15('0x25')]]['faxstatus']===_0x6a15('0x55')){this[_0x6a15('0x56')](_0x48c958['uniqueid'],!![]);}else{this[_0x6a15('0x56')](_0x48c958[_0x6a15('0x25')],![],this['channels'][_0x48c958[_0x6a15('0x25')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x48c958[_0x6a15('0x25')]][_0x6a15('0x57')]:_0x6a15('0x58'));}}}};Fax[_0x6a15('0x21')][_0x6a15('0x59')]=function(_0x263198){var _0x47ba02=this;return new BPromise(function(_0x4f954b,_0xee7da9){_0x47ba02[_0x6a15('0x5a')](_0x263198,_0x47ba02[_0x6a15('0xf')][_0x263198[_0x6a15('0x5b')]])[_0x6a15('0x3d')](function(_0x250e4e){ut[_0x6a15('0x4a')]('[Fax][execOriginate][success]',_0x250e4e);_0x4f954b(ut['message']('Fax\x20received'));})[_0x6a15('0x3f')](function(_0x362fb2){ut[_0x6a15('0x4a')](_0x6a15('0x5c'),_0x362fb2);updateStatus(_0x263198);_0xee7da9(ut['message'](_0x6a15('0x5d')));});});};Fax['prototype'][_0x6a15('0x5e')]=function(_0x26dff5){var _0x1ab77a=this;return new BPromise(function(_0x5c9d7d,_0x5614df){var _0x4b6639=_0x1ab77a['checkTrunk'](_0x1ab77a[_0x6a15('0xf')][_0x26dff5[_0x6a15('0x5b')]][_0x6a15('0x5f')],_0x26dff5);if(_0x4b6639[_0x6a15('0x60')]){_0x5c9d7d(ut[_0x6a15('0x39')](_0x6a15('0x61')));}else{_0x5614df(ut[_0x6a15('0x39')](_0x4b6639[_0x6a15('0x39')]));}});};function originate(_0xa06880,_0x5458bc,_0x1ffddc){return new BPromise(function(_0x3dae2b,_0x433e48){if(_0x1ffddc){var _0x39265b=util[_0x6a15('0x62')](_0x6a15('0x63'),path['parse'](_0xa06880[_0x6a15('0x64')])[_0x6a15('0x27')],_0xa06880[_0x6a15('0x64')]);gs[_0x6a15('0x65')](_0x39265b)[_0x6a15('0x3d')](function(){_0xa06880[_0x6a15('0x64')]=util['format'](_0x6a15('0x66'),path[_0x6a15('0x3b')](_0xa06880[_0x6a15('0x64')])[_0x6a15('0x67')],path['parse'](_0xa06880[_0x6a15('0x64')])[_0x6a15('0x27')]);_0x5458bc[_0x6a15('0x68')]=_0xa06880[_0x6a15('0x64')];ut[_0x6a15('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami[_0x6a15('0x69')](ut['variablesAction'](_0xa06880,_0x5458bc))[_0x6a15('0x3d')](function(_0x389982){_0x3dae2b(_0x389982);})[_0x6a15('0x3f')](function(_0x313106){_0x433e48(_0x313106);});})['catch'](function(_0x448f88){_0x433e48(_0x448f88);});}else{ami[_0x6a15('0x69')](ut[_0x6a15('0x6a')](_0xa06880,_0x5458bc))['then'](function(_0x41c1a4){_0x3dae2b(_0x41c1a4);})[_0x6a15('0x3f')](function(_0x4f79cd){_0x433e48(_0x4f79cd);});}});}Fax[_0x6a15('0x21')]['execOriginate']=function(_0x15503c,_0x5d2718){var _0x3927ae=this;return new BPromise(function(_0x1c91c8,_0x2e54da){var _0x467516=uuid['v4']();var _0x258d40=ut[_0x6a15('0x6b')](_0x15503c,_0x5d2718);_0x3927ae['actions'][_0x467516]=new Action(_0x467516,_0x5d2718,_0x15503c);var _0x363abe=_0x3927ae[_0x6a15('0x11')][_0x467516];if(path[_0x6a15('0x3b')](_0x15503c['path'])[_0x6a15('0x6c')]===_0x6a15('0x3c')){originate(_0x363abe,_0x258d40,!![])[_0x6a15('0x3d')](function(_0x2ce123){_0x1c91c8(_0x2ce123);})[_0x6a15('0x3f')](function(_0x2535f0){_0x2e54da(_0x2535f0);});}else{originate(_0x363abe,_0x258d40,![])['then'](function(_0x36956a){_0x1c91c8(_0x36956a);})[_0x6a15('0x3f')](function(_0x35a7e0){_0x2e54da(_0x35a7e0);});}});};Fax[_0x6a15('0x21')][_0x6a15('0x6d')]=function(_0x24d9cb){return!_[_0x6a15('0x6e')](_0x24d9cb)&&!_[_0x6a15('0x6e')](_0x24d9cb[_0x6a15('0x27')])&&!_[_0x6a15('0x6e')](_0x24d9cb[_0x6a15('0x6f')])&&_0x24d9cb[_0x6a15('0x6f')]&&!_[_0x6a15('0x6e')](this[_0x6a15('0x10')][util[_0x6a15('0x62')](_0x6a15('0x70'),_0x24d9cb['name'])])&&!_[_0x6a15('0x6e')](this['trunks'][util[_0x6a15('0x62')](_0x6a15('0x70'),_0x24d9cb['name'])][_0x6a15('0x30')])&&(this['trunks'][util['format']('SIP/%s',_0x24d9cb[_0x6a15('0x27')])]['status']===_0x6a15('0x71')||this[_0x6a15('0x10')][util[_0x6a15('0x62')](_0x6a15('0x70'),_0x24d9cb[_0x6a15('0x27')])][_0x6a15('0x30')]===_0x6a15('0x72'));};Fax['prototype'][_0x6a15('0x73')]=function(_0x13ea5a,_0x1e0bae){if(!this['isTrunkReachable'](_0x13ea5a)){ut[_0x6a15('0x4a')](_0x6a15('0x74'),_[_0x6a15('0x6e')](_0x13ea5a)?'':_0x13ea5a[_0x6a15('0x27')]+_0x6a15('0x75'));return{'isValid':![],'message':_0x6a15('0x76')};}if(_[_0x6a15('0x6e')](_0x1e0bae[_0x6a15('0x5')])){ut[_0x6a15('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x6a15('0x42')](_0x1e0bae));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x6a15('0x6e')](_0x1e0bae[_0x6a15('0x64')])){ut[_0x6a15('0x4a')](_0x6a15('0x77'),JSON['stringify'](_0x1e0bae));return{'isValid':![],'message':_0x6a15('0x78')};}return{'isValid':!![],'message':_0x6a15('0x79')};};module[_0x6a15('0x7a')]=Fax; \ No newline at end of file +var _0xab34=['Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','./util/gs','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','syncNewState','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','reason','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','AttachmentId','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','faxpages','faxstatus','SUCCESS','faxstatusstring','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path'];(function(_0x228b96,_0x5c02fd){var _0x32fe9a=function(_0x25e29d){while(--_0x25e29d){_0x228b96['push'](_0x228b96['shift']());}};_0x32fe9a(++_0x5c02fd);}(_0xab34,0xe8));var _0x4ab3=function(_0x2dc5fb,_0x5d0ad4){_0x2dc5fb=_0x2dc5fb-0x0;var _0x282c17=_0xab34[_0x2dc5fb];return _0x282c17;};'use strict';var util=require(_0x4ab3('0x0'));var _=require(_0x4ab3('0x1'));var BPromise=require(_0x4ab3('0x2'));var uuid=require(_0x4ab3('0x3'));var moment=require(_0x4ab3('0x4'));var path=require(_0x4ab3('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x4ab3('0x6'));var logger=require('../../../config/logger')(_0x4ab3('0x7'));var ami=require(_0x4ab3('0x8'));var rpcDb=require(_0x4ab3('0x9'));var Channel=require('./channel');var ut=require(_0x4ab3('0xa'));var Action=require(_0x4ab3('0xb'));var faxAccount=require(_0x4ab3('0xc'));var attachment=require(_0x4ab3('0xd'));var faxMessage=require(_0x4ab3('0xe'));function Fax(_0x4a0f11){this[_0x4ab3('0xf')]={};this[_0x4ab3('0x10')]=_0x4a0f11[_0x4ab3('0x10')];this['trunks']=_0x4a0f11[_0x4ab3('0x11')];this[_0x4ab3('0x12')]={};ami['on'](_0x4ab3('0x13'),this[_0x4ab3('0x14')][_0x4ab3('0x15')](this));ami['on']('varset',this[_0x4ab3('0x16')][_0x4ab3('0x15')](this));ami['on']('newstate',this[_0x4ab3('0x17')][_0x4ab3('0x15')](this));ami['on']('newexten',this[_0x4ab3('0x18')][_0x4ab3('0x15')](this));ami['on']('faxstatus',this[_0x4ab3('0x19')][_0x4ab3('0x15')](this));ami['on']('receivefax',this[_0x4ab3('0x1a')][_0x4ab3('0x15')](this));ami['on'](_0x4ab3('0x1b'),this['syncHangup'][_0x4ab3('0x15')](this));ami['on']('originateresponse',this[_0x4ab3('0x1c')]['bind'](this));}Fax[_0x4ab3('0x1d')][_0x4ab3('0x14')]=function(_0x299743){if(_0x299743[_0x4ab3('0x1e')]===_0x4ab3('0x1f')){for(var _0x1bda8c in this['faxAccounts']){if(this['faxAccounts'][_0x4ab3('0x20')](_0x1bda8c)){if(_0x299743[_0x4ab3('0x21')]===this[_0x4ab3('0x10')][_0x1bda8c]['localstationid']){this[_0x4ab3('0xf')][_0x299743[_0x4ab3('0x22')]]={};this[_0x4ab3('0xf')][_0x299743[_0x4ab3('0x22')]][_0x4ab3('0x23')]=_0x299743[_0x4ab3('0x23')];this[_0x4ab3('0xf')][_0x299743['uniqueid']]['id']=this['faxAccounts'][_0x1bda8c]['id'];this[_0x4ab3('0xf')][_0x299743[_0x4ab3('0x22')]][_0x4ab3('0x24')]=this[_0x4ab3('0x10')][_0x1bda8c][_0x4ab3('0x24')];logger[_0x4ab3('0x25')](_0x299743[_0x4ab3('0x22')],_0x4ab3('0x26'));}}}}if(this[_0x4ab3('0x12')][_0x299743[_0x4ab3('0x22')]]){this[_0x4ab3('0xf')][_0x299743[_0x4ab3('0x22')]]={};this['channels'][_0x299743[_0x4ab3('0x22')]][_0x4ab3('0x23')]=_0x299743[_0x4ab3('0x23')];logger[_0x4ab3('0x25')](_0x299743[_0x4ab3('0x22')],'\x20syncNewchannel\x20');}};Fax[_0x4ab3('0x1d')][_0x4ab3('0x16')]=function(_0x5e7091){if(this[_0x4ab3('0xf')][_0x5e7091[_0x4ab3('0x22')]]){for(var _0x512843 in _0x5e7091['variable']){if(_0x5e7091[_0x4ab3('0x27')]['hasOwnProperty'](_0x512843)){this[_0x4ab3('0xf')][_0x5e7091[_0x4ab3('0x22')]][_0x512843]=_0x5e7091[_0x4ab3('0x28')];}}}};Fax[_0x4ab3('0x1d')][_0x4ab3('0x17')]=function(_0x5059e3){if(this[_0x4ab3('0xf')][_0x5059e3[_0x4ab3('0x22')]]){this['channels'][_0x5059e3[_0x4ab3('0x22')]][_0x4ab3('0x29')]=_0x5059e3[_0x4ab3('0x29')];this[_0x4ab3('0xf')][_0x5059e3[_0x4ab3('0x22')]][_0x4ab3('0x2a')]=_0x5059e3['channelstatedesc'];}};Fax[_0x4ab3('0x1d')][_0x4ab3('0x18')]=function(_0x420cf0){if(this[_0x4ab3('0xf')][_0x420cf0[_0x4ab3('0x22')]]){for(var _0x456dd6 in _0x420cf0[_0x4ab3('0x27')]){if(_0x420cf0[_0x4ab3('0x27')]['hasOwnProperty'](_0x456dd6)){this[_0x4ab3('0xf')][_0x420cf0['uniqueid']][_0x456dd6]=_0x420cf0[_0x4ab3('0x28')];}}}};Fax[_0x4ab3('0x1d')][_0x4ab3('0x19')]=function(_0x4e37fd){if(this[_0x4ab3('0xf')][_0x4e37fd[_0x4ab3('0x22')]]){this[_0x4ab3('0xf')][_0x4e37fd[_0x4ab3('0x22')]][_0x4ab3('0x2b')]=_0x4e37fd[_0x4ab3('0x2b')];this[_0x4ab3('0xf')][_0x4e37fd[_0x4ab3('0x22')]]['status']=_0x4e37fd[_0x4ab3('0x2c')];this[_0x4ab3('0xf')][_0x4e37fd[_0x4ab3('0x22')]]['localstationid']=_0x4e37fd[_0x4ab3('0x2d')];this[_0x4ab3('0xf')][_0x4e37fd[_0x4ab3('0x22')]]['filename']=_0x4e37fd[_0x4ab3('0x2e')];logger[_0x4ab3('0x25')](_0x4e37fd[_0x4ab3('0x22')],_0x4ab3('0x2f'));}};Fax[_0x4ab3('0x1d')][_0x4ab3('0x1a')]=function(_0x3ce5c7){var _0x21328e=this;if(this[_0x4ab3('0xf')][_0x3ce5c7[_0x4ab3('0x22')]]){var _0x4ee722=this[_0x4ab3('0xf')][_0x3ce5c7[_0x4ab3('0x22')]]['id'];this[_0x4ab3('0xf')][_0x3ce5c7[_0x4ab3('0x22')]][_0x4ab3('0x30')]=_0x3ce5c7[_0x4ab3('0x30')];this[_0x4ab3('0xf')][_0x3ce5c7['uniqueid']][_0x4ab3('0x31')]=_0x3ce5c7[_0x4ab3('0x31')];this[_0x4ab3('0xf')][_0x3ce5c7[_0x4ab3('0x22')]][_0x4ab3('0x2d')]=_0x3ce5c7[_0x4ab3('0x2d')];this[_0x4ab3('0xf')][_0x3ce5c7['uniqueid']]['resolution']=_0x3ce5c7['resolution'];this['channels'][_0x3ce5c7[_0x4ab3('0x22')]][_0x4ab3('0x32')]=_0x3ce5c7[_0x4ab3('0x32')];this[_0x4ab3('0xf')][_0x3ce5c7['uniqueid']][_0x4ab3('0x2e')]=_0x3ce5c7[_0x4ab3('0x2e')];this[_0x4ab3('0xf')][_0x3ce5c7[_0x4ab3('0x22')]][_0x4ab3('0x33')]=_0x3ce5c7['calleridnum'];if(this[_0x4ab3('0xf')][_0x3ce5c7[_0x4ab3('0x22')]][_0x4ab3('0x31')]>0x0){tiff2pdf(_0x3ce5c7[_0x4ab3('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x2f0a23){logger[_0x4ab3('0x25')](_0x3ce5c7[_0x4ab3('0x22')],_0x4ab3('0x34'),_0x2f0a23['message']);attachment[_0x4ab3('0x35')]({'name':path['parse'](_0x3ce5c7[_0x4ab3('0x2e')])[_0x4ab3('0x24')],'basename':path[_0x4ab3('0x36')](_0x3ce5c7[_0x4ab3('0x2e')])[_0x4ab3('0x24')]+'.pdf','type':_0x4ab3('0x37')})[_0x4ab3('0x38')](function(_0x1b4ee1){faxAccount[_0x4ab3('0x39')](_0x4ee722,{'from':_0x3ce5c7['calleridnum'],'mapKey':_0x4ab3('0x7'),'body':path[_0x4ab3('0x36')](_0x3ce5c7[_0x4ab3('0x2e')])[_0x4ab3('0x24')]+_0x4ab3('0x3a'),'AttachmentId':_0x1b4ee1['id']})[_0x4ab3('0x3b')](function(_0x3d758c){logger[_0x4ab3('0x3c')](_0x3ce5c7[_0x4ab3('0x22')],_0x4ab3('0x3d'),JSON['stringify'](_0x3d758c));});})[_0x4ab3('0x3b')](function(_0x57c7bd){logger['error'](_0x3ce5c7[_0x4ab3('0x22')],_0x4ab3('0x3e'),JSON[_0x4ab3('0x3f')](_0x57c7bd));});});}logger[_0x4ab3('0x25')](_0x3ce5c7[_0x4ab3('0x22')],_0x4ab3('0x3e'));}};Fax[_0x4ab3('0x1d')][_0x4ab3('0x1c')]=function(_0x486f01){if(this[_0x4ab3('0x12')][_0x486f01['uniqueid']]){_[_0x4ab3('0x40')](this[_0x4ab3('0xf')][_0x486f01[_0x4ab3('0x22')]],_['pick'](_0x486f01,[_0x4ab3('0x41'),_0x4ab3('0x42')]));}};function updateStatus(_0x1e489b){if(_0x1e489b['AttachmentId']){faxMessage[_0x4ab3('0x43')](_0x1e489b['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4ab3('0x38')](function(_0x58cba5){ut[_0x4ab3('0x44')](_0x4ab3('0x45'),_0x58cba5);})[_0x4ab3('0x3b')](function(_0x5d0694){ut[_0x4ab3('0x44')](_0x4ab3('0x46'),_0x5d0694);});}else{ut[_0x4ab3('0x44')](_0x4ab3('0x47'));}}Fax[_0x4ab3('0x1d')][_0x4ab3('0x48')]=function(_0x5baf92,_0x736921,_0x10a098){var _0x4f83c5=this;var _0x7d7e3b={};if(_0x736921){_0x7d7e3b={'read':_0x736921};}else{_0x7d7e3b={'failMessage':_0x10a098};}if(this[_0x4ab3('0x12')][_0x5baf92][_0x4ab3('0x49')]){faxMessage[_0x4ab3('0x43')](this[_0x4ab3('0x12')][_0x5baf92][_0x4ab3('0x49')],_0x7d7e3b)[_0x4ab3('0x38')](function(_0x17c1c3){ut[_0x4ab3('0x44')]('[Fax][Message][Updated]',_0x17c1c3);})[_0x4ab3('0x3b')](function(_0x180222){ut[_0x4ab3('0x44')](_0x4ab3('0x4a'),_0x180222);})['finally'](function(){delete _0x4f83c5[_0x4ab3('0xf')][_0x5baf92];delete _0x4f83c5[_0x4ab3('0x12')][_0x5baf92];});}else{ut[_0x4ab3('0x44')](_0x4ab3('0x4b'));delete this['channels'][_0x5baf92];delete this[_0x4ab3('0x12')][_0x5baf92];}};Fax['prototype'][_0x4ab3('0x4c')]=function(_0x2bbd69){var _0x5c347b=this;if(this[_0x4ab3('0xf')][_0x2bbd69[_0x4ab3('0x22')]]){if(this[_0x4ab3('0x12')][_0x2bbd69[_0x4ab3('0x22')]]){this[_0x4ab3('0xf')][_0x2bbd69[_0x4ab3('0x22')]]['id']=this[_0x4ab3('0x12')][_0x2bbd69['uniqueid']]['id'];this[_0x4ab3('0xf')][_0x2bbd69[_0x4ab3('0x22')]][_0x4ab3('0x24')]=this['actions'][_0x2bbd69[_0x4ab3('0x22')]][_0x4ab3('0x24')];}logger[_0x4ab3('0x25')](_0x2bbd69[_0x4ab3('0x22')],this[_0x4ab3('0x12')][_0x2bbd69[_0x4ab3('0x22')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x4ab3('0x3f')](this['channels'][_0x2bbd69[_0x4ab3('0x22')]]));if(this[_0x4ab3('0x12')][_0x2bbd69['uniqueid']]){if(this[_0x4ab3('0xf')][_0x2bbd69['uniqueid']][_0x4ab3('0x4d')]>0x0&&this[_0x4ab3('0xf')][_0x2bbd69[_0x4ab3('0x22')]][_0x4ab3('0x4e')]===_0x4ab3('0x4f')){this['updateStatus'](_0x2bbd69[_0x4ab3('0x22')],!![]);}else{this[_0x4ab3('0x48')](_0x2bbd69[_0x4ab3('0x22')],![],this[_0x4ab3('0xf')][_0x2bbd69['uniqueid']][_0x4ab3('0x50')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x2bbd69[_0x4ab3('0x22')]][_0x4ab3('0x50')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x593604){var _0xaf2c34=this;return new BPromise(function(_0x2b0ead,_0x41650d){_0xaf2c34[_0x4ab3('0x51')](_0x593604,_0xaf2c34[_0x4ab3('0x10')][_0x593604[_0x4ab3('0x52')]])[_0x4ab3('0x38')](function(_0x107de0){ut['logger'](_0x4ab3('0x53'),_0x107de0);_0x2b0ead(ut[_0x4ab3('0x54')](_0x4ab3('0x55')));})[_0x4ab3('0x3b')](function(_0x2ecca5){ut[_0x4ab3('0x44')](_0x4ab3('0x56'),_0x2ecca5);updateStatus(_0x593604);_0x41650d(ut[_0x4ab3('0x54')](_0x4ab3('0x57')));});});};Fax[_0x4ab3('0x1d')]['checkAfterSend']=function(_0x1bb941){var _0x726d07=this;return new BPromise(function(_0x40c200,_0x3c59bb){var _0x35b1b4=_0x726d07[_0x4ab3('0x58')](_0x726d07[_0x4ab3('0x10')][_0x1bb941[_0x4ab3('0x52')]][_0x4ab3('0x59')],_0x1bb941);if(_0x35b1b4[_0x4ab3('0x5a')]){_0x40c200(ut['message']('Trunk\x20Reachable'));}else{_0x3c59bb(ut['message'](_0x35b1b4[_0x4ab3('0x54')]));}});};function originate(_0x3f5740,_0x5b310a,_0x8fb46e){return new BPromise(function(_0x37e1d4,_0x1c745f){if(_0x8fb46e){var _0x15fb60=util[_0x4ab3('0x5b')](_0x4ab3('0x5c'),path[_0x4ab3('0x36')](_0x3f5740['path'])[_0x4ab3('0x24')],_0x3f5740[_0x4ab3('0x5')]);gs[_0x4ab3('0x5d')](_0x15fb60)[_0x4ab3('0x38')](function(){_0x3f5740[_0x4ab3('0x5')]=util['format'](_0x4ab3('0x5e'),path['parse'](_0x3f5740['path'])[_0x4ab3('0x5f')],path[_0x4ab3('0x36')](_0x3f5740[_0x4ab3('0x5')])[_0x4ab3('0x24')]);_0x5b310a[_0x4ab3('0x60')]=_0x3f5740[_0x4ab3('0x5')];ut[_0x4ab3('0x44')](_0x4ab3('0x61'),'');ami['Action'](ut[_0x4ab3('0x62')](_0x3f5740,_0x5b310a))['then'](function(_0x132f91){_0x37e1d4(_0x132f91);})[_0x4ab3('0x3b')](function(_0x95e693){_0x1c745f(_0x95e693);});})[_0x4ab3('0x3b')](function(_0x23ddc8){_0x1c745f(_0x23ddc8);});}else{ami[_0x4ab3('0x63')](ut[_0x4ab3('0x62')](_0x3f5740,_0x5b310a))['then'](function(_0x5e45f2){_0x37e1d4(_0x5e45f2);})[_0x4ab3('0x3b')](function(_0xe6a6ab){_0x1c745f(_0xe6a6ab);});}});}Fax['prototype']['execOriginate']=function(_0x526997,_0x2ee73a){var _0x50a0cb=this;return new BPromise(function(_0x432039,_0x30fc9e){var _0x13de67=uuid['v4']();var _0xaa7d76=ut[_0x4ab3('0x64')](_0x526997,_0x2ee73a);_0x50a0cb[_0x4ab3('0x12')][_0x13de67]=new Action(_0x13de67,_0x2ee73a,_0x526997);var _0x1356ee=_0x50a0cb[_0x4ab3('0x12')][_0x13de67];if(path['parse'](_0x526997[_0x4ab3('0x5')])[_0x4ab3('0x65')]===_0x4ab3('0x3a')){originate(_0x1356ee,_0xaa7d76,!![])[_0x4ab3('0x38')](function(_0x16fa50){_0x432039(_0x16fa50);})[_0x4ab3('0x3b')](function(_0x40724d){_0x30fc9e(_0x40724d);});}else{originate(_0x1356ee,_0xaa7d76,![])[_0x4ab3('0x38')](function(_0xdef802){_0x432039(_0xdef802);})[_0x4ab3('0x3b')](function(_0x35800b){_0x30fc9e(_0x35800b);});}});};Fax[_0x4ab3('0x1d')]['isTrunkReachable']=function(_0x2d7814){return!_[_0x4ab3('0x66')](_0x2d7814)&&!_[_0x4ab3('0x66')](_0x2d7814[_0x4ab3('0x24')])&&!_[_0x4ab3('0x66')](_0x2d7814[_0x4ab3('0x67')])&&_0x2d7814[_0x4ab3('0x67')]&&!_[_0x4ab3('0x66')](this[_0x4ab3('0x11')][util[_0x4ab3('0x5b')]('SIP/%s',_0x2d7814['name'])])&&!_['isNil'](this[_0x4ab3('0x11')][util[_0x4ab3('0x5b')](_0x4ab3('0x68'),_0x2d7814[_0x4ab3('0x24')])]['status'])&&(this[_0x4ab3('0x11')][util[_0x4ab3('0x5b')]('SIP/%s',_0x2d7814[_0x4ab3('0x24')])][_0x4ab3('0x2c')]===_0x4ab3('0x69')||this[_0x4ab3('0x11')][util[_0x4ab3('0x5b')](_0x4ab3('0x68'),_0x2d7814['name'])][_0x4ab3('0x2c')]===_0x4ab3('0x6a'));};Fax[_0x4ab3('0x1d')][_0x4ab3('0x58')]=function(_0x1a320d,_0x295d06){if(!this['isTrunkReachable'](_0x1a320d)){ut[_0x4ab3('0x44')](_0x4ab3('0x6b'),_['isNil'](_0x1a320d)?'':_0x1a320d[_0x4ab3('0x24')]+_0x4ab3('0x6c'));return{'isValid':![],'message':_0x4ab3('0x6d')};}if(_[_0x4ab3('0x66')](_0x295d06[_0x4ab3('0x7')])){ut[_0x4ab3('0x44')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4ab3('0x3f')](_0x295d06));return{'isValid':![],'message':_0x4ab3('0x6e')};}if(_[_0x4ab3('0x66')](_0x295d06[_0x4ab3('0x5')])){ut[_0x4ab3('0x44')](_0x4ab3('0x6f'),JSON['stringify'](_0x295d06));return{'isValid':![],'message':_0x4ab3('0x70')};}return{'isValid':!![],'message':_0x4ab3('0x71')};};module[_0x4ab3('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 940a914..49ce745 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 _0x040f=['[Notify]\x20','bluebird','preview','lodash','../rpc/faxAccount','inspect','notify','resolve','catch'];(function(_0x34ec03,_0x31d9fc){var _0x3f5643=function(_0x1032d5){while(--_0x1032d5){_0x34ec03['push'](_0x34ec03['shift']());}};_0x3f5643(++_0x31d9fc);}(_0x040f,0x19f));var _0xf040=function(_0xade468,_0xa07081){_0xade468=_0xade468-0x0;var _0x54a9dc=_0x040f[_0xade468];return _0x54a9dc;};'use strict';var util=require('util');var BPromise=require(_0xf040('0x0'));var logger=require('../../../config/logger')(_0xf040('0x1'));var _=require(_0xf040('0x2'));var faxAccount=require(_0xf040('0x3'));function loggerCatch(_0x339777){return function(_0x250a8d){logger['error'](_0x339777,util[_0xf040('0x4')](_0x250a8d,{'showHidden':![],'depth':null}));};}exports[_0xf040('0x5')]=function(_0x12b62d,_0x5aaa55){return BPromise[_0xf040('0x6')]()['then'](faxAccount[_0xf040('0x5')](_0x12b62d,_0x5aaa55))[_0xf040('0x7')](loggerCatch(_0xf040('0x8')));}; \ No newline at end of file +var _0xd7a8=['catch','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','resolve'];(function(_0x2c984d,_0x5a6f2f){var _0x31df62=function(_0x180acd){while(--_0x180acd){_0x2c984d['push'](_0x2c984d['shift']());}};_0x31df62(++_0x5a6f2f);}(_0xd7a8,0x185));var _0x8d7a=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xd7a8[_0x341e0f];return _0x59555a;};'use strict';var util=require(_0x8d7a('0x0'));var BPromise=require('bluebird');var logger=require(_0x8d7a('0x1'))(_0x8d7a('0x2'));var _=require(_0x8d7a('0x3'));var faxAccount=require(_0x8d7a('0x4'));function loggerCatch(_0x111daf){return function(_0x40273c){logger[_0x8d7a('0x5')](_0x111daf,util['inspect'](_0x40273c,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x35702b,_0x2b3363){return BPromise[_0x8d7a('0x6')]()['then'](faxAccount['notify'](_0x35702b,_0x2b3363))[_0x8d7a('0x7')](loggerCatch(_0x8d7a('0x8')));}; \ 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 2971458..af6c485 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 _0x9dd0=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','inspect'];(function(_0x44d237,_0x464b03){var _0x5e5d08=function(_0xae1899){while(--_0xae1899){_0x44d237['push'](_0x44d237['shift']());}};_0x5e5d08(++_0x464b03);}(_0x9dd0,0x19a));var _0x09dd=function(_0x153ab7,_0x160de4){_0x153ab7=_0x153ab7-0x0;var _0xa39d4e=_0x9dd0[_0x153ab7];return _0xa39d4e;};'use strict';var util=require(_0x09dd('0x0'));var logger=require(_0x09dd('0x1'))(_0x09dd('0x2'));var BPromise=require(_0x09dd('0x3'));var exec=require(_0x09dd('0x4'))[_0x09dd('0x5')];exports[_0x09dd('0x6')]=function(_0x3a89a0){return new BPromise(function(_0x44892b,_0x5f34a8){exec(_0x3a89a0,function(_0x200b5d,_0x397908,_0x5aef4f){logger[_0x09dd('0x7')](_0x09dd('0x8'),_0x397908);if(_0x200b5d){logger[_0x09dd('0x7')](_0x09dd('0x8'),'\x20Error\x20:',util[_0x09dd('0x9')](_0x200b5d,{'showHidden':![],'depth':null}),_0x397908,_0x5aef4f);_0x5f34a8(_0x200b5d);}_0x44892b(_0x397908);});});}; \ No newline at end of file +var _0x93df=['Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','child_process','exec','execute','info'];(function(_0x49249c,_0x1e0997){var _0x484741=function(_0xd8eb04){while(--_0xd8eb04){_0x49249c['push'](_0x49249c['shift']());}};_0x484741(++_0x1e0997);}(_0x93df,0xa3));var _0xf93d=function(_0x55dbd0,_0x341a80){_0x55dbd0=_0x55dbd0-0x0;var _0xda1a93=_0x93df[_0x55dbd0];return _0xda1a93;};'use strict';var util=require(_0xf93d('0x0'));var logger=require('../../../../config/logger')(_0xf93d('0x1'));var BPromise=require(_0xf93d('0x2'));var exec=require(_0xf93d('0x3'))[_0xf93d('0x4')];exports[_0xf93d('0x5')]=function(_0x234231){return new BPromise(function(_0x9306ca,_0x9ec14f){exec(_0x234231,function(_0x4f74eb,_0x51a8f8,_0x4f9d3b){logger[_0xf93d('0x6')](_0xf93d('0x7'),_0x51a8f8);if(_0x4f74eb){logger[_0xf93d('0x6')](_0xf93d('0x7'),_0xf93d('0x8'),util[_0xf93d('0x9')](_0x4f74eb,{'showHidden':![],'depth':null}),_0x51a8f8,_0x4f9d3b);_0x9ec14f(_0x4f74eb);}_0x9306ca(_0x51a8f8);});});}; \ 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 5c04860..f9501c6 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 _0xd0ea=['\x22%s\x22','modem','gateway','path','variablesAction','\x22%s\x22\x20<%s>','localstationid','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','minrate','format'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0xd0ea,0x9b));var _0xad0e=function(_0x585276,_0x553f5a){_0x585276=_0x585276-0x0;var _0x4a7181=_0xd0ea[_0x585276];return _0x4a7181;};'use strict';var util=require(_0xad0e('0x0'));var _=require(_0xad0e('0x1'));var moment=require(_0xad0e('0x2'));var logger=require(_0xad0e('0x3'))(_0xad0e('0x4'));exports[_0xad0e('0x5')]=function(_0x5bc366){return{'message':_0x5bc366};};exports[_0xad0e('0x6')]=function(_0x4176bd,_0x2ac1c9){logger[_0xad0e('0x7')](_0x4176bd,util[_0xad0e('0x8')](_0x2ac1c9,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x61c776,_0x57ed14){var _0x2716f8={'XMF-ECM':_0x57ed14[_0xad0e('0x9')],'XMF-HEADERINFO':_0x57ed14[_0xad0e('0xa')],'XMF-MINRATE':_0x57ed14[_0xad0e('0xb')],'XMF-MAXRATE':_0x57ed14['maxrate'],'XMF-MODEM':util[_0xad0e('0xc')](_0xad0e('0xd'),_0x57ed14[_0xad0e('0xe')]),'XMF-GATEWAY':_0x57ed14[_0xad0e('0xf')],'XMF-FAXDETECT':_0x57ed14['faxdetect'],'XMF-T38TIMEOUT':_0x57ed14['t38timeout'],'XMF-LOCALSTATIONID':_0x57ed14['localstationid'],'XMF-PATH':_0x61c776[_0xad0e('0x10')]};return _0x2716f8;};exports[_0xad0e('0x11')]=function(_0x471af1,_0x5d9ee9){return{'actionid':_0x471af1['uniqueid'],'action':'originate','channel':_0x471af1['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0xad0e('0xc')](_0xad0e('0x12'),_0x471af1[_0xad0e('0xa')]?_0x471af1[_0xad0e('0xa')]:'',_0x471af1[_0xad0e('0x13')]),'variable':_0x5d9ee9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x471af1[_0xad0e('0x14')]};}; \ No newline at end of file +var _0xc6ef=['../../../../config/logger','fax','message','logger','info','inspect','addVariables','minrate','maxrate','modem','gateway','faxdetect','t38timeout','path','variablesAction','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','moment'];(function(_0x4c3c19,_0x198b34){var _0x2ab88d=function(_0x16325b){while(--_0x16325b){_0x4c3c19['push'](_0x4c3c19['shift']());}};_0x2ab88d(++_0x198b34);}(_0xc6ef,0x1a0));var _0xfc6e=function(_0xe8ccaa,_0x2eb2f7){_0xe8ccaa=_0xe8ccaa-0x0;var _0x2d0812=_0xc6ef[_0xe8ccaa];return _0x2d0812;};'use strict';var util=require(_0xfc6e('0x0'));var _=require('lodash');var moment=require(_0xfc6e('0x1'));var logger=require(_0xfc6e('0x2'))(_0xfc6e('0x3'));exports[_0xfc6e('0x4')]=function(_0x17219e){return{'message':_0x17219e};};exports[_0xfc6e('0x5')]=function(_0xefe71c,_0x2752cc){logger[_0xfc6e('0x6')](_0xefe71c,util[_0xfc6e('0x7')](_0x2752cc,{'showHidden':![],'depth':null}));};exports[_0xfc6e('0x8')]=function(_0x268309,_0x4ca2bc){var _0x4b7257={'XMF-ECM':_0x4ca2bc['ecm'],'XMF-HEADERINFO':_0x4ca2bc['headerinfo'],'XMF-MINRATE':_0x4ca2bc[_0xfc6e('0x9')],'XMF-MAXRATE':_0x4ca2bc[_0xfc6e('0xa')],'XMF-MODEM':util['format']('\x22%s\x22',_0x4ca2bc[_0xfc6e('0xb')]),'XMF-GATEWAY':_0x4ca2bc[_0xfc6e('0xc')],'XMF-FAXDETECT':_0x4ca2bc[_0xfc6e('0xd')],'XMF-T38TIMEOUT':_0x4ca2bc[_0xfc6e('0xe')],'XMF-LOCALSTATIONID':_0x4ca2bc['localstationid'],'XMF-PATH':_0x268309[_0xfc6e('0xf')]};return _0x4b7257;};exports[_0xfc6e('0x10')]=function(_0x67d055,_0x4542c9){return{'actionid':_0x67d055['uniqueid'],'action':'originate','channel':_0x67d055[_0xfc6e('0x11')],'Exten':_0xfc6e('0x12'),'Context':_0xfc6e('0x13'),'Priority':'1','callerid':util['format'](_0xfc6e('0x14'),_0x67d055['headerinfo']?_0x67d055[_0xfc6e('0x15')]:'',_0x67d055['localstationid']),'variable':_0x4542c9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x67d055['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 99a9a14..6165b36 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 _0x1efe=['ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','sync','[index.js][main]','util','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365'];(function(_0x442b7c,_0x2bda10){var _0x289a67=function(_0x424d78){while(--_0x424d78){_0x442b7c['push'](_0x442b7c['shift']());}};_0x289a67(++_0x2bda10);}(_0x1efe,0xf8));var _0xe1ef=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x1efe[_0x2cf2e9];return _0xd3670d;};'use strict';var util=require(_0xe1ef('0x0'));var moment=require('moment');var server=require(_0xe1ef('0x1'));var Realtime=require(_0xe1ef('0x2'));var Report=require(_0xe1ef('0x3'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0xe1ef('0x4'));var Preview=require(_0xe1ef('0x5'));var Fax=require(_0xe1ef('0x6'));var user=require(_0xe1ef('0x7'));var voiceQueue=require(_0xe1ef('0x8'));var voiceQueueReport=require(_0xe1ef('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xe1ef('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xe1ef('0xb'));var voiceExtension=require(_0xe1ef('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe1ef('0xd'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe1ef('0xe'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe1ef('0xf'));var zoho=require(_0xe1ef('0x10'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xe1ef('0x11'));var servicenow=require(_0xe1ef('0x12'));var dynamics365=require(_0xe1ef('0x13'));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')(_0xe1ef('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe1ef('0x15')](_0xe1ef('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe1ef('0x15')](_0xe1ef('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xe1ef('0x17')]()[_0xe1ef('0x18')](user['getAgents']())[_0xe1ef('0x18')](realtime[_0xe1ef('0x19')]())[_0xe1ef('0x18')](user[_0xe1ef('0x1a')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x1b')]())[_0xe1ef('0x18')](trunk[_0xe1ef('0x1c')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x1d')]())[_0xe1ef('0x18')](voiceQueue['getVoiceQueues']())['then'](realtime[_0xe1ef('0x1e')]())['then'](trigger[_0xe1ef('0x1f')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x20')]())['then'](template[_0xe1ef('0x21')]())['then'](realtime[_0xe1ef('0x22')]())[_0xe1ef('0x18')](zendesk[_0xe1ef('0x23')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x24')]())['then'](salesforce[_0xe1ef('0x25')]())['then'](realtime['initSalesforceAccounts']())[_0xe1ef('0x18')](sugarcrm[_0xe1ef('0x26')]())[_0xe1ef('0x18')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xe1ef('0x27')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x28')]())[_0xe1ef('0x18')](desk[_0xe1ef('0x29')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x2a')]())[_0xe1ef('0x18')](zoho[_0xe1ef('0x2b')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x2c')]())[_0xe1ef('0x18')](vtiger[_0xe1ef('0x2d')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x2e')]())[_0xe1ef('0x18')](freshsales[_0xe1ef('0x2f')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x30')]())[_0xe1ef('0x18')](servicenow[_0xe1ef('0x31')]())['then'](realtime[_0xe1ef('0x32')]())['then'](dynamics365[_0xe1ef('0x33')]())['then'](realtime['initDynamics365Accounts']())[_0xe1ef('0x18')](campaign[_0xe1ef('0x34')]())['then'](realtime['initCampaigns']())[_0xe1ef('0x18')](voiceExtension[_0xe1ef('0x35')]())[_0xe1ef('0x18')](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())[_0xe1ef('0x18')](realtime[_0xe1ef('0x36')]())[_0xe1ef('0x18')](function(){return realtime;});}function initParams(){return Promise[_0xe1ef('0x17')]()[_0xe1ef('0x18')](voiceQueueReport[_0xe1ef('0x37')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x38')]())['then'](cmHopperHistory[_0xe1ef('0x39')]())['then'](realtime[_0xe1ef('0x3a')]())[_0xe1ef('0x18')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0xe1ef('0x3b')]())[_0xe1ef('0x18')](voiceCallReport[_0xe1ef('0x3c')]())[_0xe1ef('0x18')](realtime[_0xe1ef('0x3d')]())[_0xe1ef('0x3e')](function(_0x52ced5){logger[_0xe1ef('0x3f')]('[index.js][initParams]',util[_0xe1ef('0x40')](_0x52ced5,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xe1ef('0x18')](function(){return initRealtime();})[_0xe1ef('0x18')](function(){return initParams();})[_0xe1ef('0x18')](function(){report[_0xe1ef('0x41')]();setInterval(initRealtime,0x1388);})[_0xe1ef('0x3e')](function(_0x46c68f){logger['error'](_0xe1ef('0x42'),util[_0xe1ef('0x40')](_0x46c68f,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x8b56=['sync','util','moment','./server','./realtime','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','resolve','then','getAgents','initAgents','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen'];(function(_0x25c936,_0x50ae88){var _0x50f4fe=function(_0x214b38){while(--_0x214b38){_0x25c936['push'](_0x25c936['shift']());}};_0x50f4fe(++_0x50ae88);}(_0x8b56,0x15a));var _0x68b5=function(_0x5aa9ba,_0x9829aa){_0x5aa9ba=_0x5aa9ba-0x0;var _0x407364=_0x8b56[_0x5aa9ba];return _0x407364;};'use strict';var util=require(_0x68b5('0x0'));var moment=require(_0x68b5('0x1'));var server=require(_0x68b5('0x2'));var Realtime=require(_0x68b5('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x68b5('0x4'));var Dialer=require(_0x68b5('0x5'));var Preview=require(_0x68b5('0x6'));var Fax=require(_0x68b5('0x7'));var user=require(_0x68b5('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x68b5('0x9'));var voiceCallReport=require(_0x68b5('0xa'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x68b5('0xb'));var cmHopperHistory=require(_0x68b5('0xc'));var campaign=require(_0x68b5('0xd'));var voiceExtension=require(_0x68b5('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x68b5('0xf'));var salesforce=require(_0x68b5('0x10'));var sugarcrm=require(_0x68b5('0x11'));var freshdesk=require(_0x68b5('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x68b5('0x13'));var vtiger=require(_0x68b5('0x14'));var freshsales=require(_0x68b5('0x15'));var servicenow=require(_0x68b5('0x16'));var dynamics365=require(_0x68b5('0x17'));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(_0x68b5('0x18'))(_0x68b5('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x68b5('0x1a')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x68b5('0x1b')]()[_0x68b5('0x1c')](user[_0x68b5('0x1d')]())['then'](realtime[_0x68b5('0x1e')]())[_0x68b5('0x1c')](user['getTelephones']())['then'](realtime['initTelephones']())[_0x68b5('0x1c')](trunk[_0x68b5('0x1f')]())[_0x68b5('0x1c')](realtime[_0x68b5('0x20')]())[_0x68b5('0x1c')](voiceQueue['getVoiceQueues']())[_0x68b5('0x1c')](realtime[_0x68b5('0x21')]())['then'](trigger[_0x68b5('0x22')]())[_0x68b5('0x1c')](realtime['initTriggers']())['then'](template['getTemplates']())[_0x68b5('0x1c')](realtime[_0x68b5('0x23')]())[_0x68b5('0x1c')](zendesk[_0x68b5('0x24')]())[_0x68b5('0x1c')](realtime[_0x68b5('0x25')]())[_0x68b5('0x1c')](salesforce['getSalesforceAccounts']())[_0x68b5('0x1c')](realtime[_0x68b5('0x26')]())[_0x68b5('0x1c')](sugarcrm[_0x68b5('0x27')]())[_0x68b5('0x1c')](realtime[_0x68b5('0x28')]())[_0x68b5('0x1c')](freshdesk['getFreshdeskAccounts']())[_0x68b5('0x1c')](realtime['initFreshdeskAccounts']())[_0x68b5('0x1c')](desk[_0x68b5('0x29')]())[_0x68b5('0x1c')](realtime['initDeskAccounts']())['then'](zoho[_0x68b5('0x2a')]())[_0x68b5('0x1c')](realtime[_0x68b5('0x2b')]())['then'](vtiger[_0x68b5('0x2c')]())['then'](realtime[_0x68b5('0x2d')]())['then'](freshsales[_0x68b5('0x2e')]())[_0x68b5('0x1c')](realtime['initFreshsalesAccounts']())[_0x68b5('0x1c')](servicenow[_0x68b5('0x2f')]())[_0x68b5('0x1c')](realtime[_0x68b5('0x30')]())[_0x68b5('0x1c')](dynamics365[_0x68b5('0x31')]())[_0x68b5('0x1c')](realtime[_0x68b5('0x32')]())['then'](campaign[_0x68b5('0x33')]())['then'](realtime[_0x68b5('0x34')]())['then'](voiceExtension[_0x68b5('0x35')]())['then'](realtime[_0x68b5('0x36')]())[_0x68b5('0x1c')](faxAccount['getFaxAccounts']())['then'](realtime[_0x68b5('0x37')]())[_0x68b5('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x68b5('0x1b')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x68b5('0x1c')](realtime[_0x68b5('0x38')]())[_0x68b5('0x1c')](cmHopperHistory[_0x68b5('0x39')]())['then'](realtime[_0x68b5('0x3a')]())[_0x68b5('0x1c')](cmHopperHistory[_0x68b5('0x3b')]())[_0x68b5('0x1c')](realtime[_0x68b5('0x3c')]())[_0x68b5('0x1c')](voiceCallReport[_0x68b5('0x3d')]())[_0x68b5('0x1c')](realtime[_0x68b5('0x3e')]())[_0x68b5('0x3f')](function(_0x4caa77){logger[_0x68b5('0x40')](_0x68b5('0x41'),util[_0x68b5('0x42')](_0x4caa77,{'showHidden':![],'depth':null}));});}function main(){return server[_0x68b5('0x43')](realtime,preview,fax)[_0x68b5('0x1c')](function(){return initRealtime();})[_0x68b5('0x1c')](function(){return initParams();})[_0x68b5('0x1c')](function(){report[_0x68b5('0x44')]();setInterval(initRealtime,0x1388);})[_0x68b5('0x3f')](function(_0x328400){logger[_0x68b5('0x40')]('[index.js][main]',util[_0x68b5('0x42')](_0x328400,{'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 acf73cb..145979f 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 _0x7166=['toLowerCase','not_inuse','talking','toNumber','format','address','voiceStatusQueue','interface','stringify','emit','user:ami:update','omit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime'];(function(_0x1e9773,_0x4fb878){var _0x59416d=function(_0x2cfc8b){while(--_0x2cfc8b){_0x1e9773['push'](_0x1e9773['shift']());}};_0x59416d(++_0x4fb878);}(_0x7166,0x194));var _0x6716=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x7166[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6716('0x0'));var md5=require(_0x6716('0x1'));var Redis=require(_0x6716('0x2'));var config=require(_0x6716('0x3'));config[_0x6716('0x4')]=_[_0x6716('0x5')](config['redis'],{'host':_0x6716('0x6'),'port':0x18eb});var io=require(_0x6716('0x7'))(new Redis(config['redis']));function Agent(_0x385c62){this['id']=_0x385c62['id']||0x0;this[_0x6716('0x8')]=_0x385c62[_0x6716('0x8')]||'';this[_0x6716('0x9')]=_0x385c62[_0x6716('0x9')]||'';this[_0x6716('0xa')]=_0x385c62[_0x6716('0xa')]||'';this[_0x6716('0xb')]=_0x385c62[_0x6716('0xb')]||'';this[_0x6716('0xc')]='unknown';this['stateTime']=0x0;this[_0x6716('0xd')]=_0x6716('0xe');this['address']='';this[_0x6716('0xf')]='';this[_0x6716('0x10')]='';this['interface']='';this[_0x6716('0x11')]=_0x385c62['online']||![];this[_0x6716('0x12')]=_0x6716('0xe');this[_0x6716('0x13')]=0x0;this[_0x6716('0x14')]='';this['voiceStatusQueue']='';this[_0x6716('0x15')]=![];this[_0x6716('0x16')]=![];this[_0x6716('0x1')]='';}Agent[_0x6716('0x17')][_0x6716('0x18')]=function(_0x2dac6e){var _0x5ecdc9;if(_0x2dac6e&&_0x2dac6e['state']){_0x5ecdc9=_0x2dac6e['state'][_0x6716('0x19')]();switch(_0x5ecdc9){case _0x6716('0x1a'):_0x5ecdc9='idle';break;case'inuse':_0x5ecdc9=_0x6716('0x1b');break;}}if(_0x5ecdc9&&this['voiceStatus']!==_0x5ecdc9||_0x2dac6e['statePause']){this[_0x6716('0x13')]=_[_0x6716('0x1c')](moment()[_0x6716('0x1d')]('x'));}if(_0x5ecdc9){this[_0x6716('0x12')]=_0x5ecdc9;}var _0x3c5433={'id':this['id'],'name':this['name'],'email':this[_0x6716('0x9')],'accountcode':this[_0x6716('0xa')],'fullname':this[_0x6716('0xb')],'state':this[_0x6716('0xc')],'stateTime':this['stateTime'],'status':this[_0x6716('0xd')],'address':this[_0x6716('0x1e')],'online':this['online'],'voiceStatus':this[_0x6716('0x12')],'voiceStatusTime':this[_0x6716('0x13')],'voiceStatusCallerIdNumber':this[_0x6716('0x14')],'voiceStatusQueue':this[_0x6716('0x1f')],'interface':this[_0x6716('0x20')],'onhold':this[_0x6716('0x15')]};var _0x452a31=md5(JSON[_0x6716('0x21')](_0x3c5433));if(this[_0x6716('0x1')]!==_0x452a31){this['md5']=_0x452a31;io['to'](util['format']('user:%s',_0x3c5433['name']))[_0x6716('0x22')](_0x6716('0x23'),_[_0x6716('0x24')](_0x3c5433,['online']));io['emit'](_0x6716('0x25'),_0x3c5433);}};module[_0x6716('0x26')]=Agent; \ No newline at end of file +var _0x1c8e=['accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatusTime','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','stringify','omit','emit','exports','lodash','util','md5','ioredis','defaults','redis','socket.io-emitter','name','email'];(function(_0x4e09ec,_0x530418){var _0x347fa2=function(_0x201dc3){while(--_0x201dc3){_0x4e09ec['push'](_0x4e09ec['shift']());}};_0x347fa2(++_0x530418);}(_0x1c8e,0x18f));var _0xe1c8=function(_0x23e0c1,_0x3db138){_0x23e0c1=_0x23e0c1-0x0;var _0x5b19e6=_0x1c8e[_0x23e0c1];return _0x5b19e6;};'use strict';var _=require(_0xe1c8('0x0'));var util=require(_0xe1c8('0x1'));var moment=require('moment');var md5=require(_0xe1c8('0x2'));var Redis=require(_0xe1c8('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xe1c8('0x4')](config[_0xe1c8('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xe1c8('0x6'))(new Redis(config['redis']));function Agent(_0x50b039){this['id']=_0x50b039['id']||0x0;this[_0xe1c8('0x7')]=_0x50b039[_0xe1c8('0x7')]||'';this['email']=_0x50b039[_0xe1c8('0x8')]||'';this[_0xe1c8('0x9')]=_0x50b039[_0xe1c8('0x9')]||'';this[_0xe1c8('0xa')]=_0x50b039[_0xe1c8('0xa')]||'';this[_0xe1c8('0xb')]=_0xe1c8('0xc');this[_0xe1c8('0xd')]=0x0;this['status']='unknown';this[_0xe1c8('0xe')]='';this['phone']='';this[_0xe1c8('0xf')]='';this[_0xe1c8('0x10')]='';this[_0xe1c8('0x11')]=_0x50b039[_0xe1c8('0x11')]||![];this['voiceStatus']='unknown';this[_0xe1c8('0x12')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this['onhold']=![];this['local']=![];this[_0xe1c8('0x2')]='';}Agent['prototype'][_0xe1c8('0x13')]=function(_0x30450d){var _0x23cd4a;if(_0x30450d&&_0x30450d[_0xe1c8('0xb')]){_0x23cd4a=_0x30450d[_0xe1c8('0xb')]['toLowerCase']();switch(_0x23cd4a){case _0xe1c8('0x14'):_0x23cd4a='idle';break;case _0xe1c8('0x15'):_0x23cd4a=_0xe1c8('0x16');break;}}if(_0x23cd4a&&this['voiceStatus']!==_0x23cd4a||_0x30450d[_0xe1c8('0x17')]){this['voiceStatusTime']=_[_0xe1c8('0x18')](moment()[_0xe1c8('0x19')]('x'));}if(_0x23cd4a){this[_0xe1c8('0x1a')]=_0x23cd4a;}var _0x48f4f0={'id':this['id'],'name':this[_0xe1c8('0x7')],'email':this[_0xe1c8('0x8')],'accountcode':this[_0xe1c8('0x9')],'fullname':this[_0xe1c8('0xa')],'state':this[_0xe1c8('0xb')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xe1c8('0xe')],'online':this[_0xe1c8('0x11')],'voiceStatus':this[_0xe1c8('0x1a')],'voiceStatusTime':this[_0xe1c8('0x12')],'voiceStatusCallerIdNumber':this[_0xe1c8('0x1b')],'voiceStatusQueue':this[_0xe1c8('0x1c')],'interface':this[_0xe1c8('0x10')],'onhold':this[_0xe1c8('0x1d')]};var _0x5cb9b5=md5(JSON[_0xe1c8('0x1e')](_0x48f4f0));if(this['md5']!==_0x5cb9b5){this['md5']=_0x5cb9b5;io['to'](util['format']('user:%s',_0x48f4f0[_0xe1c8('0x7')]))['emit']('user:ami:update',_[_0xe1c8('0x1f')](_0x48f4f0,[_0xe1c8('0x11')]));io[_0xe1c8('0x20')]('user:presence',_0x48f4f0);}};module[_0xe1c8('0x21')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index c7f97b3..6aa808f 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 _0xf786=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf786,0x1a5));var _0x6f78=function(_0x33579b,_0x122a76){_0x33579b=_0x33579b-0x0;var _0x1a1bde=_0xf786[_0x33579b];return _0x1a1bde;};'use strict';function Campaign(_0x48b3a1){this['id']=_0x48b3a1['id']||0x0;this['name']=_0x48b3a1['name']||'';this[_0x6f78('0x0')]=_0x48b3a1[_0x6f78('0x0')]||'campaign';this[_0x6f78('0x1')]=0x0;this[_0x6f78('0x2')]=0x0;this[_0x6f78('0x3')]=0x0;this[_0x6f78('0x4')]=0x0;this[_0x6f78('0x5')]='';this[_0x6f78('0x6')]=!![];this['active']=_0x48b3a1['active'];this[_0x6f78('0x7')]=_0x48b3a1[_0x6f78('0x7')];this[_0x6f78('0x8')]=_0x48b3a1[_0x6f78('0x8')]||null;this[_0x6f78('0x9')]=_0x48b3a1['dialGlobalInterval']?_0x48b3a1[_0x6f78('0x9')]:null;this[_0x6f78('0xa')]=_0x48b3a1['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x48b3a1[_0x6f78('0xb')];this[_0x6f78('0xc')]=_0x48b3a1[_0x6f78('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x48b3a1[_0x6f78('0xd')];this['dialCongestionRetryFrequency']=_0x48b3a1['dialCongestionRetryFrequency'];this[_0x6f78('0xe')]=_0x48b3a1[_0x6f78('0xe')];this[_0x6f78('0xf')]=_0x48b3a1[_0x6f78('0xf')];this[_0x6f78('0x10')]=_0x48b3a1[_0x6f78('0x10')];this[_0x6f78('0x11')]=_0x48b3a1[_0x6f78('0x11')];this['dialGlobalMaxRetry']=_0x48b3a1['dialGlobalMaxRetry'];this[_0x6f78('0x12')]=_0x48b3a1['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x48b3a1[_0x6f78('0x13')]||0x96;this['dialDropMaxRetry']=_0x48b3a1['dialDropMaxRetry']||0x3;this[_0x6f78('0x14')]=_0x48b3a1[_0x6f78('0x14')]||0x96;this['dialAbandonedMaxRetry']=_0x48b3a1['dialAbandonedMaxRetry']||0x3;this[_0x6f78('0x15')]=_0x48b3a1[_0x6f78('0x15')]||0x96;this[_0x6f78('0x16')]=_0x48b3a1[_0x6f78('0x16')]||0x3;this[_0x6f78('0x17')]=_0x48b3a1['dialMachineRetryFrequency']||0x96;this[_0x6f78('0x18')]=_0x48b3a1['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x48b3a1[_0x6f78('0x19')]||0x96;this[_0x6f78('0x1a')]=_0x48b3a1[_0x6f78('0x1a')]||_0x6f78('0x1b');this[_0x6f78('0x1c')]=_0x48b3a1[_0x6f78('0x1c')]||undefined;this[_0x6f78('0x1d')]=_0x48b3a1['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x48b3a1[_0x6f78('0x1e')]||undefined;this['TrunkBackup']=_0x48b3a1['TrunkBackup']?_0x48b3a1[_0x6f78('0x1f')]:undefined;this[_0x6f78('0x20')]=_0x48b3a1['Trunk']?_0x48b3a1[_0x6f78('0x20')]:undefined;this[_0x6f78('0x21')]=_0x48b3a1['Interval']?_0x48b3a1['Interval']:undefined;this[_0x6f78('0x22')]=_0x48b3a1[_0x6f78('0x22')]?_0x48b3a1['SquareProject']:undefined;this['dialQueueProject']=_0x48b3a1[_0x6f78('0x22')]?_0x48b3a1[_0x6f78('0x22')][_0x6f78('0x23')]:undefined;this[_0x6f78('0x24')]=_0x48b3a1[_0x6f78('0x24')]||![];this['dialAMDInitialSilence']=_0x48b3a1[_0x6f78('0x25')];this[_0x6f78('0x26')]=_0x48b3a1[_0x6f78('0x26')];this[_0x6f78('0x27')]=_0x48b3a1[_0x6f78('0x27')];this[_0x6f78('0x28')]=_0x48b3a1[_0x6f78('0x28')];this[_0x6f78('0x29')]=_0x48b3a1[_0x6f78('0x29')];this['dialAMDBetweenWordsSilence']=_0x48b3a1['dialAMDBetweenWordsSilence'];this[_0x6f78('0x2a')]=_0x48b3a1[_0x6f78('0x2a')];this[_0x6f78('0x2b')]=_0x48b3a1['dialAMDSilenceThreshold'];this[_0x6f78('0x2c')]=_0x48b3a1[_0x6f78('0x2c')];}module[_0x6f78('0x2d')]=Campaign; \ No newline at end of file +var _0x85be=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x668885,_0x545393){var _0x5088ad=function(_0x1bcebb){while(--_0x1bcebb){_0x668885['push'](_0x668885['shift']());}};_0x5088ad(++_0x545393);}(_0x85be,0x1bd));var _0xe85b=function(_0x19391,_0x27b376){_0x19391=_0x19391-0x0;var _0x139631=_0x85be[_0x19391];return _0x139631;};'use strict';function Campaign(_0x18e549){this['id']=_0x18e549['id']||0x0;this['name']=_0x18e549[_0xe85b('0x0')]||'';this['type']=_0x18e549['type']||_0xe85b('0x1');this[_0xe85b('0x2')]=0x0;this['temp']=0x0;this[_0xe85b('0x3')]=0x0;this[_0xe85b('0x4')]=0x0;this['message']='';this[_0xe85b('0x5')]=!![];this['active']=_0x18e549[_0xe85b('0x6')];this[_0xe85b('0x7')]=_0x18e549[_0xe85b('0x7')];this['dialTimezone']=_0x18e549[_0xe85b('0x8')]||null;this[_0xe85b('0x9')]=_0x18e549['dialGlobalInterval']?_0x18e549[_0xe85b('0x9')]:null;this[_0xe85b('0xa')]=_0x18e549[_0xe85b('0xa')];this[_0xe85b('0xb')]=_0x18e549[_0xe85b('0xb')];this[_0xe85b('0xc')]=_0x18e549[_0xe85b('0xc')]||0x1e;this[_0xe85b('0xd')]=_0x18e549[_0xe85b('0xd')];this[_0xe85b('0xe')]=_0x18e549[_0xe85b('0xe')];this[_0xe85b('0xf')]=_0x18e549[_0xe85b('0xf')];this[_0xe85b('0x10')]=_0x18e549['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x18e549['dialNoAnswerMaxRetry'];this[_0xe85b('0x11')]=_0x18e549[_0xe85b('0x11')];this['dialGlobalMaxRetry']=_0x18e549[_0xe85b('0x12')];this[_0xe85b('0x13')]=_0x18e549[_0xe85b('0x13')]||0x3;this[_0xe85b('0x14')]=_0x18e549[_0xe85b('0x14')]||0x96;this['dialDropMaxRetry']=_0x18e549[_0xe85b('0x15')]||0x3;this['dialDropRetryFrequency']=_0x18e549['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x18e549[_0xe85b('0x16')]||0x3;this[_0xe85b('0x17')]=_0x18e549[_0xe85b('0x17')]||0x96;this[_0xe85b('0x18')]=_0x18e549[_0xe85b('0x18')]||0x3;this[_0xe85b('0x19')]=_0x18e549['dialMachineRetryFrequency']||0x96;this[_0xe85b('0x1a')]=_0x18e549[_0xe85b('0x1a')]||0x3;this[_0xe85b('0x1b')]=_0x18e549['dialAgentRejectRetryFrequency']||0x96;this[_0xe85b('0x1c')]=_0x18e549[_0xe85b('0x1c')]||'DESC';this[_0xe85b('0x1d')]=_0x18e549[_0xe85b('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x18e549[_0xe85b('0x1e')]||undefined;this[_0xe85b('0x1f')]=_0x18e549[_0xe85b('0x1f')]||undefined;this[_0xe85b('0x20')]=_0x18e549['TrunkBackup']?_0x18e549['TrunkBackup']:undefined;this['Trunk']=_0x18e549[_0xe85b('0x21')]?_0x18e549[_0xe85b('0x21')]:undefined;this[_0xe85b('0x22')]=_0x18e549['Interval']?_0x18e549[_0xe85b('0x22')]:undefined;this[_0xe85b('0x23')]=_0x18e549[_0xe85b('0x23')]?_0x18e549[_0xe85b('0x23')]:undefined;this[_0xe85b('0x24')]=_0x18e549['SquareProject']?_0x18e549[_0xe85b('0x23')]['name']:undefined;this[_0xe85b('0x25')]=_0x18e549['dialAMDActive']||![];this[_0xe85b('0x26')]=_0x18e549[_0xe85b('0x26')];this[_0xe85b('0x27')]=_0x18e549[_0xe85b('0x27')];this[_0xe85b('0x28')]=_0x18e549['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x18e549[_0xe85b('0x29')];this['dialAMDMinWordLength']=_0x18e549['dialAMDMinWordLength'];this[_0xe85b('0x2a')]=_0x18e549[_0xe85b('0x2a')];this[_0xe85b('0x2b')]=_0x18e549[_0xe85b('0x2b')];this[_0xe85b('0x2c')]=_0x18e549[_0xe85b('0x2c')];this[_0xe85b('0x2d')]=_0x18e549[_0xe85b('0x2d')];}module[_0xe85b('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 8eb5938..4bce521 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 _0x288a=['type','tag','disposition','monitors','transfercalleridnum','transferType','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','accountcode','uniqueid','linkedid','exten','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime'];(function(_0x76b00b,_0x26e939){var _0xc8e4a=function(_0xb16025){while(--_0xb16025){_0x76b00b['push'](_0x76b00b['shift']());}};_0xc8e4a(++_0x26e939);}(_0x288a,0x188));var _0xa288=function(_0x41ae26,_0x32a2e8){_0x41ae26=_0x41ae26-0x0;var _0x321631=_0x288a[_0x41ae26];return _0x321631;};'use strict';function Channel(){this['starttime']=null;this[_0xa288('0x0')]='';this[_0xa288('0x1')]='';this[_0xa288('0x2')]=0x0;this[_0xa288('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xa288('0x4')]=0x0;this['context']='';this[_0xa288('0x5')]=0x0;this[_0xa288('0x6')]=0x0;this[_0xa288('0x7')]=0x0;this['answered']=![];this[_0xa288('0x8')]=null;this[_0xa288('0x9')]=null;this[_0xa288('0xa')]=![];this['abandoned']=![];this[_0xa288('0xb')]='';this[_0xa288('0xc')]='';this[_0xa288('0xd')]=0x0;this[_0xa288('0xe')]=0x0;this[_0xa288('0xf')]=0x0;this[_0xa288('0x10')]=null;this[_0xa288('0x11')]=null;this[_0xa288('0x12')]=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this[_0xa288('0x13')]=[];this[_0xa288('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xa288('0x15')]=undefined;this[_0xa288('0x16')]=0x0;}module[_0xa288('0x17')]=Channel; \ No newline at end of file +var _0xc5c0=['monitors','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','duration','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue'];(function(_0x1f97c4,_0x5e1a71){var _0x2ade2e=function(_0xcc45a0){while(--_0xcc45a0){_0x1f97c4['push'](_0x1f97c4['shift']());}};_0x2ade2e(++_0x5e1a71);}(_0xc5c0,0x6c));var _0x0c5c=function(_0xcb766e,_0x397152){_0xcb766e=_0xcb766e-0x0;var _0x527c6e=_0xc5c0[_0xcb766e];return _0x527c6e;};'use strict';function Channel(){this[_0x0c5c('0x0')]=null;this[_0x0c5c('0x1')]='';this[_0x0c5c('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x0c5c('0x3')]=undefined;this[_0x0c5c('0x4')]=undefined;this['accountcode']=0x0;this[_0x0c5c('0x5')]='';this[_0x0c5c('0x6')]=0x0;this[_0x0c5c('0x7')]=0x0;this[_0x0c5c('0x8')]=0x0;this[_0x0c5c('0x9')]=![];this[_0x0c5c('0xa')]=null;this[_0x0c5c('0xb')]=null;this['unmanaged']=![];this[_0x0c5c('0xc')]=![];this[_0x0c5c('0xd')]='';this['lastdata']='';this[_0x0c5c('0xe')]=0x0;this[_0x0c5c('0xf')]=0x0;this[_0x0c5c('0x10')]=0x0;this[_0x0c5c('0x11')]=null;this['tag']=null;this[_0x0c5c('0x12')]=null;this[_0x0c5c('0x13')]=![];this[_0x0c5c('0x14')]=null;this[_0x0c5c('0x15')]=null;this[_0x0c5c('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x0c5c('0x17')]=undefined;this['transferType']=undefined;this[_0x0c5c('0x18')]=0x0;}module[_0x0c5c('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 8672579..d494e50 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 _0x1d2e=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x1f8580,_0x634d83){var _0x451ea7=function(_0x3d2221){while(--_0x3d2221){_0x1f8580['push'](_0x1f8580['shift']());}};_0x451ea7(++_0x634d83);}(_0x1d2e,0xd5));var _0xe1d2=function(_0x2905dc,_0x5321a7){_0x2905dc=_0x2905dc-0x0;var _0x41513e=_0x1d2e[_0x2905dc];return _0x41513e;};'use strict';function DeskAccount(_0x3a15e9){this['id']=_0x3a15e9['id']||0x0;this['name']=_0x3a15e9[_0xe1d2('0x0')]||'';this[_0xe1d2('0x1')]=_0x3a15e9['username']||'';this[_0xe1d2('0x2')]=_0x3a15e9['remoteUri']||'';this['authType']=_0x3a15e9['authType']||'';this['password']=_0x3a15e9[_0xe1d2('0x3')]||'';this[_0xe1d2('0x4')]=_0x3a15e9[_0xe1d2('0x4')]||'';this[_0xe1d2('0x5')]=_0x3a15e9[_0xe1d2('0x5')]||'';this[_0xe1d2('0x6')]=_0x3a15e9[_0xe1d2('0x6')]||'';this[_0xe1d2('0x7')]=_0x3a15e9[_0xe1d2('0x7')]||'';this[_0xe1d2('0x8')]=_0x3a15e9[_0xe1d2('0x8')]||'';this[_0xe1d2('0x9')]=_0x3a15e9[_0xe1d2('0x9')]||'';this[_0xe1d2('0xa')]=_0x3a15e9[_0xe1d2('0xa')]||{};}module[_0xe1d2('0xb')]=DeskAccount; \ No newline at end of file +var _0xcf38=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','authType','password'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xcf38,0x80));var _0x8cf3=function(_0x353c9a,_0x289c6a){_0x353c9a=_0x353c9a-0x0;var _0x34c141=_0xcf38[_0x353c9a];return _0x34c141;};'use strict';function DeskAccount(_0x5198f9){this['id']=_0x5198f9['id']||0x0;this['name']=_0x5198f9[_0x8cf3('0x0')]||'';this[_0x8cf3('0x1')]=_0x5198f9[_0x8cf3('0x1')]||'';this['remoteUri']=_0x5198f9['remoteUri']||'';this[_0x8cf3('0x2')]=_0x5198f9[_0x8cf3('0x2')]||'';this[_0x8cf3('0x3')]=_0x5198f9['password']||'';this[_0x8cf3('0x4')]=_0x5198f9['consumerKey']||'';this[_0x8cf3('0x5')]=_0x5198f9[_0x8cf3('0x5')]||'';this['token']=_0x5198f9[_0x8cf3('0x6')]||'';this['tokenSecret']=_0x5198f9[_0x8cf3('0x7')]||'';this[_0x8cf3('0x8')]=_0x5198f9[_0x8cf3('0x8')]||'';this[_0x8cf3('0x9')]=_0x5198f9['serverUrl']||'';this[_0x8cf3('0xa')]=_0x5198f9['Configurations']||{};}module[_0x8cf3('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6e0c30d..aa59bc0 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 _0xe1df=['exports','name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xe1df,0x1cf));var _0xfe1d=function(_0xc64da3,_0x2585a2){_0xc64da3=_0xc64da3-0x0;var _0x36c533=_0xe1df[_0xc64da3];return _0x36c533;};'use strict';function Dynamics365Account(_0x5eecc7){this['id']=_0x5eecc7['id']||0x0;this[_0xfe1d('0x0')]=_0x5eecc7[_0xfe1d('0x0')]||'';this['username']=_0x5eecc7['username']||'';this[_0xfe1d('0x1')]=_0x5eecc7[_0xfe1d('0x1')]||'';this[_0xfe1d('0x2')]=_0x5eecc7[_0xfe1d('0x2')]||'';this[_0xfe1d('0x3')]=_0x5eecc7[_0xfe1d('0x3')]||'';this[_0xfe1d('0x4')]=_0x5eecc7['clientId']||'';this[_0xfe1d('0x5')]=_0x5eecc7[_0xfe1d('0x5')]||{};this[_0xfe1d('0x6')]=_0x5eecc7['serverUrl']||'';this[_0xfe1d('0x7')]=_0x5eecc7['modernAuthentication']||![];this['Configurations']=_0x5eecc7[_0xfe1d('0x8')]||{};this[_0xfe1d('0x9')]=_0x5eecc7[_0xfe1d('0x9')]||{};}module[_0xfe1d('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xb0ba=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x3f9aef,_0x1acb89){var _0x27d60d=function(_0x597aea){while(--_0x597aea){_0x3f9aef['push'](_0x3f9aef['shift']());}};_0x27d60d(++_0x1acb89);}(_0xb0ba,0x129));var _0xab0b=function(_0xf11fc3,_0x3ef6f7){_0xf11fc3=_0xf11fc3-0x0;var _0x338298=_0xb0ba[_0xf11fc3];return _0x338298;};'use strict';function Dynamics365Account(_0x3d33bd){this['id']=_0x3d33bd['id']||0x0;this[_0xab0b('0x0')]=_0x3d33bd[_0xab0b('0x0')]||'';this['username']=_0x3d33bd[_0xab0b('0x1')]||'';this['password']=_0x3d33bd[_0xab0b('0x2')]||'';this[_0xab0b('0x3')]=_0x3d33bd[_0xab0b('0x3')]||'';this[_0xab0b('0x4')]=_0x3d33bd[_0xab0b('0x4')]||'';this[_0xab0b('0x5')]=_0x3d33bd[_0xab0b('0x5')]||'';this[_0xab0b('0x6')]=_0x3d33bd[_0xab0b('0x6')]||{};this['serverUrl']=_0x3d33bd[_0xab0b('0x7')]||'';this[_0xab0b('0x8')]=_0x3d33bd['modernAuthentication']||![];this['Configurations']=_0x3d33bd[_0xab0b('0x9')]||{};this[_0xab0b('0xa')]=_0x3d33bd[_0xab0b('0xa')]||{};}module[_0xab0b('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 9736419..073e5e2 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 _0xeccf=['tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x2a4e12,_0x198400){var _0x290352=function(_0x494e79){while(--_0x494e79){_0x2a4e12['push'](_0x2a4e12['shift']());}};_0x290352(++_0x198400);}(_0xeccf,0x134));var _0xfecc=function(_0xbda334,_0x593245){_0xbda334=_0xbda334-0x0;var _0xf97df8=_0xeccf[_0xbda334];return _0xf97df8;};'use strict';function FaxAccount(_0xf9447c){this['id']=_0xf9447c['id']||0x0;this['name']=_0xf9447c[_0xfecc('0x0')]||'';this[_0xfecc('0x1')]=_0xf9447c[_0xfecc('0x1')];this[_0xfecc('0x2')]=_0xf9447c[_0xfecc('0x2')];this[_0xfecc('0x3')]=_0xf9447c[_0xfecc('0x3')];this['localstationid']=_0xf9447c[_0xfecc('0x4')];this[_0xfecc('0x5')]=_0xf9447c[_0xfecc('0x5')]||0x960;this[_0xfecc('0x6')]=_0xf9447c[_0xfecc('0x6')]||0x3840;this[_0xfecc('0x7')]=_0xf9447c[_0xfecc('0x7')]||_0xfecc('0x8');this[_0xfecc('0x9')]=_0xf9447c[_0xfecc('0x9')]||'no';this['faxdetect']=_0xf9447c[_0xfecc('0xa')]||'no';this['t38timeout']=_0xf9447c[_0xfecc('0xb')]||0x1388;this[_0xfecc('0xc')]=_0xf9447c[_0xfecc('0xc')]||'SIP';this[_0xfecc('0xd')]=_0xf9447c[_0xfecc('0xd')]?_0xf9447c[_0xfecc('0xd')]:undefined;this[_0xfecc('0xe')]=_0xf9447c[_0xfecc('0xe')];this[_0xfecc('0xf')]=_0xf9447c[_0xfecc('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xd006=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x932068,_0x204ebb){var _0x27643d=function(_0x3c97ef){while(--_0x3c97ef){_0x932068['push'](_0x932068['shift']());}};_0x27643d(++_0x204ebb);}(_0xd006,0x102));var _0x6d00=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xd006[_0x48e1ec];return _0x3b33eb;};'use strict';function FaxAccount(_0x1a36d5){this['id']=_0x1a36d5['id']||0x0;this[_0x6d00('0x0')]=_0x1a36d5[_0x6d00('0x0')]||'';this[_0x6d00('0x1')]=_0x1a36d5['description'];this[_0x6d00('0x2')]=_0x1a36d5[_0x6d00('0x2')];this['headerinfo']=_0x1a36d5[_0x6d00('0x3')];this[_0x6d00('0x4')]=_0x1a36d5[_0x6d00('0x4')];this['minrate']=_0x1a36d5['minrate']||0x960;this[_0x6d00('0x5')]=_0x1a36d5[_0x6d00('0x5')]||0x3840;this[_0x6d00('0x6')]=_0x1a36d5[_0x6d00('0x6')]||_0x6d00('0x7');this['gateway']=_0x1a36d5[_0x6d00('0x8')]||'no';this[_0x6d00('0x9')]=_0x1a36d5[_0x6d00('0x9')]||'no';this[_0x6d00('0xa')]=_0x1a36d5[_0x6d00('0xa')]||0x1388;this[_0x6d00('0xb')]=_0x1a36d5[_0x6d00('0xb')]||_0x6d00('0xc');this[_0x6d00('0xd')]=_0x1a36d5['Trunk']?_0x1a36d5[_0x6d00('0xd')]:undefined;this[_0x6d00('0xe')]=_0x1a36d5[_0x6d00('0xe')];this['key']=_0x1a36d5[_0x6d00('0xf')];}module[_0x6d00('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ee8a9b2..ac4e6e2 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 _0xcf9f=['remoteUri','Configurations','name','apiKey','token'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xcf9f,0x142));var _0xfcf9=function(_0x14f137,_0x3670a7){_0x14f137=_0x14f137-0x0;var _0x6169b6=_0xcf9f[_0x14f137];return _0x6169b6;};'use strict';function FreshdeskAccount(_0x54572d){this['id']=_0x54572d['id']||0x0;this[_0xfcf9('0x0')]=_0x54572d['name']||'';this['username']=_0x54572d['username']||'';this[_0xfcf9('0x1')]=_0x54572d[_0xfcf9('0x2')]||'';this[_0xfcf9('0x3')]=_0x54572d['remoteUri']||'';this['serverUrl']=_0x54572d['serverUrl']||'';this[_0xfcf9('0x4')]=_0x54572d['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xfecc=['apiKey','token','serverUrl','exports','name'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xfecc,0x1f3));var _0xcfec=function(_0x3a3c3d,_0x19fb39){_0x3a3c3d=_0x3a3c3d-0x0;var _0x3ac6ad=_0xfecc[_0x3a3c3d];return _0x3ac6ad;};'use strict';function FreshdeskAccount(_0x320980){this['id']=_0x320980['id']||0x0;this['name']=_0x320980[_0xcfec('0x0')]||'';this['username']=_0x320980['username']||'';this[_0xcfec('0x1')]=_0x320980[_0xcfec('0x2')]||'';this['remoteUri']=_0x320980['remoteUri']||'';this['serverUrl']=_0x320980[_0xcfec('0x3')]||'';this['Configurations']=_0x320980['Configurations']||{};}module[_0xcfec('0x4')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 00ab045..158bf8f 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 _0x0dd6=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x401d08,_0x3afbb4){var _0x3a7297=function(_0x2f83a9){while(--_0x2f83a9){_0x401d08['push'](_0x401d08['shift']());}};_0x3a7297(++_0x3afbb4);}(_0x0dd6,0xca));var _0x60dd=function(_0x40e40e,_0x19bc71){_0x40e40e=_0x40e40e-0x0;var _0x5cfe55=_0x0dd6[_0x40e40e];return _0x5cfe55;};'use strict';function FreshsalesAccount(_0x448f0f){this['id']=_0x448f0f['id']||0x0;this['name']=_0x448f0f[_0x60dd('0x0')]||'';this[_0x60dd('0x1')]=_0x448f0f[_0x60dd('0x1')]||'';this[_0x60dd('0x2')]=_0x448f0f[_0x60dd('0x3')]||'';this[_0x60dd('0x4')]=_0x448f0f[_0x60dd('0x4')]||'';this[_0x60dd('0x5')]=_0x448f0f[_0x60dd('0x5')]||'';this['Configurations']=_0x448f0f[_0x60dd('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x2975=['apiKey','token','serverUrl','Configurations','exports','name','username'];(function(_0x5ce60e,_0x723a77){var _0x4e2444=function(_0x2fb58e){while(--_0x2fb58e){_0x5ce60e['push'](_0x5ce60e['shift']());}};_0x4e2444(++_0x723a77);}(_0x2975,0x1c5));var _0x5297=function(_0x57eb9f,_0x4b159c){_0x57eb9f=_0x57eb9f-0x0;var _0x279f57=_0x2975[_0x57eb9f];return _0x279f57;};'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 diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 11374b5..844f8ae 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 _0x993d=['queuecallerexit','originalposition','channel','connectedlinename','accountcode','exten','priority','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x56ebcd,_0xc3247b){var _0xc22083=function(_0x1c0112){while(--_0x1c0112){_0x56ebcd['push'](_0x56ebcd['shift']());}};_0xc22083(++_0xc3247b);}(_0x993d,0x154));var _0xd993=function(_0x23cb80,_0xf788e9){_0x23cb80=_0x23cb80-0x0;var _0x23f845=_0x993d[_0x23cb80];return _0x23f845;};'use strict';function QueueReport(){this['type']='inbound';this[_0xd993('0x0')]='';this['calleridnum']='';this[_0xd993('0x1')]='';this['queue']='';this[_0xd993('0x2')]=null;this[_0xd993('0x3')]=null;this[_0xd993('0x4')]=0x1;this[_0xd993('0x5')]=0x1;this[_0xd993('0x6')]=![];this[_0xd993('0x7')]=null;this[_0xd993('0x8')]=![];this[_0xd993('0x9')]=null;this[_0xd993('0xa')]=![];this['queuecallerexitAt']=null;this[_0xd993('0xb')]=0x1;this[_0xd993('0xc')]='';this['connectedlinenum']='';this[_0xd993('0xd')]='';this[_0xd993('0xe')]='';this['context']='';this[_0xd993('0xf')]='';this[_0xd993('0x10')]='';this['holdtime']=0x0;this[_0xd993('0x11')]=![];this[_0xd993('0x12')]='';this[_0xd993('0x13')]=_0xd993('0x14');this[_0xd993('0x15')]=null;this[_0xd993('0x16')]=0x0;this[_0xd993('0x17')]={};}module[_0xd993('0x18')]=QueueReport; \ No newline at end of file +var _0x96ac=['mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','position','count','queuecallercomplete','queuecallercompleteAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice'];(function(_0x4b33c0,_0x17fb55){var _0x43c889=function(_0x410c0d){while(--_0x410c0d){_0x4b33c0['push'](_0x4b33c0['shift']());}};_0x43c889(++_0x17fb55);}(_0x96ac,0x13b));var _0xc96a=function(_0x43aa05,_0x209827){_0x43aa05=_0x43aa05-0x0;var _0x3d0c15=_0x96ac[_0x43aa05];return _0x3d0c15;};'use strict';function QueueReport(){this[_0xc96a('0x0')]=_0xc96a('0x1');this[_0xc96a('0x2')]='';this[_0xc96a('0x3')]='';this['calleridname']='';this[_0xc96a('0x4')]='';this[_0xc96a('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xc96a('0x6')]=0x1;this[_0xc96a('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xc96a('0x8')]=![];this[_0xc96a('0x9')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xc96a('0xa')]='';this[_0xc96a('0xb')]='';this[_0xc96a('0xc')]='';this[_0xc96a('0xd')]='';this[_0xc96a('0xe')]='';this[_0xc96a('0xf')]='';this[_0xc96a('0x10')]='';this[_0xc96a('0x11')]=0x0;this['assigned']=![];this[_0xc96a('0x12')]='';this[_0xc96a('0x13')]=_0xc96a('0x14');this['routealias']=null;this[_0xc96a('0x15')]=0x0;this[_0xc96a('0x16')]={};}module[_0xc96a('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c07a8ce..184b531 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 _0x8dd2=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x4eaf9e,_0x835a3d){var _0xac1e9=function(_0x1accf5){while(--_0x1accf5){_0x4eaf9e['push'](_0x4eaf9e['shift']());}};_0xac1e9(++_0x835a3d);}(_0x8dd2,0x106));var _0x28dd=function(_0x9a6ed7,_0x174916){_0x9a6ed7=_0x9a6ed7-0x0;var _0x13d571=_0x8dd2[_0x9a6ed7];return _0x13d571;};'use strict';function SalesforceAccount(_0x56b921){this['id']=_0x56b921['id']||0x0;this[_0x28dd('0x0')]=_0x56b921[_0x28dd('0x0')]||'';this[_0x28dd('0x1')]=_0x56b921['username']||'';this[_0x28dd('0x2')]=_0x56b921[_0x28dd('0x2')]||'';this[_0x28dd('0x3')]=_0x56b921[_0x28dd('0x3')]||'';this[_0x28dd('0x4')]=_0x56b921['clientId']||'';this['clientSecret']=_0x56b921[_0x28dd('0x5')]||'';this[_0x28dd('0x6')]=_0x56b921[_0x28dd('0x6')]||'';this['type']=_0x56b921[_0x28dd('0x7')]||_0x28dd('0x8');this[_0x28dd('0x9')]=_0x56b921[_0x28dd('0x9')]||'';this[_0x28dd('0xa')]=_0x56b921[_0x28dd('0xa')]||{};}module[_0x28dd('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x946c=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x946c,0x17a));var _0xc946=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x946c[_0x47b58b];return _0x46bebe;};'use strict';function SalesforceAccount(_0x4eff8a){this['id']=_0x4eff8a['id']||0x0;this[_0xc946('0x0')]=_0x4eff8a[_0xc946('0x0')]||'';this[_0xc946('0x1')]=_0x4eff8a[_0xc946('0x1')]||'';this[_0xc946('0x2')]=_0x4eff8a[_0xc946('0x2')]||'';this['password']=_0x4eff8a[_0xc946('0x3')]||'';this['clientId']=_0x4eff8a[_0xc946('0x4')]||'';this['clientSecret']=_0x4eff8a[_0xc946('0x5')]||'';this[_0xc946('0x6')]=_0x4eff8a[_0xc946('0x6')]||'';this[_0xc946('0x7')]=_0x4eff8a['type']||_0xc946('0x8');this[_0xc946('0x9')]=_0x4eff8a[_0xc946('0x9')]||'';this[_0xc946('0xa')]=_0x4eff8a[_0xc946('0xa')]||{};}module[_0xc946('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index af1be26..a1cf663 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 _0x35ca=['remoteUri','serverUrl','exports','name','username','password'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x35ca,0xb7));var _0xa35c=function(_0x231340,_0x39154c){_0x231340=_0x231340-0x0;var _0x270b19=_0x35ca[_0x231340];return _0x270b19;};'use strict';function ServicenowAccount(_0x5d36df){this['id']=_0x5d36df['id']||0x0;this[_0xa35c('0x0')]=_0x5d36df[_0xa35c('0x0')]||'';this['username']=_0x5d36df[_0xa35c('0x1')]||'';this[_0xa35c('0x2')]=_0x5d36df[_0xa35c('0x2')]||'';this[_0xa35c('0x3')]=_0x5d36df['remoteUri']||'';this['serverUrl']=_0x5d36df[_0xa35c('0x4')]||'';this['Configurations']=_0x5d36df['Configurations']||{};}module[_0xa35c('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xa1e2=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x352a93,_0x2d9522){var _0x4a0982=function(_0x26129c){while(--_0x26129c){_0x352a93['push'](_0x352a93['shift']());}};_0x4a0982(++_0x2d9522);}(_0xa1e2,0x1f4));var _0x2a1e=function(_0x4d1329,_0x2b1ee0){_0x4d1329=_0x4d1329-0x0;var _0x218625=_0xa1e2[_0x4d1329];return _0x218625;};'use strict';function ServicenowAccount(_0x1c1280){this['id']=_0x1c1280['id']||0x0;this['name']=_0x1c1280[_0x2a1e('0x0')]||'';this[_0x2a1e('0x1')]=_0x1c1280['username']||'';this['password']=_0x1c1280[_0x2a1e('0x2')]||'';this['remoteUri']=_0x1c1280[_0x2a1e('0x3')]||'';this[_0x2a1e('0x4')]=_0x1c1280['serverUrl']||'';this[_0x2a1e('0x5')]=_0x1c1280[_0x2a1e('0x5')]||{};}module[_0x2a1e('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 18154ad..e56a47d 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 _0x221b=['name','username','password','remoteUri','serverUrl','exports'];(function(_0x5083a7,_0x190bcc){var _0x36f3eb=function(_0xe0c329){while(--_0xe0c329){_0x5083a7['push'](_0x5083a7['shift']());}};_0x36f3eb(++_0x190bcc);}(_0x221b,0x114));var _0xb221=function(_0x10885a,_0x5eac83){_0x10885a=_0x10885a-0x0;var _0x2208ae=_0x221b[_0x10885a];return _0x2208ae;};'use strict';function SugarcrmAccount(_0x482a27){this['id']=_0x482a27['id']||0x0;this['name']=_0x482a27[_0xb221('0x0')]||'';this[_0xb221('0x1')]=_0x482a27['username']||'';this[_0xb221('0x2')]=_0x482a27[_0xb221('0x2')]||'';this[_0xb221('0x3')]=_0x482a27[_0xb221('0x3')]||'';this[_0xb221('0x4')]=_0x482a27['serverUrl']||'';this['Configurations']=_0x482a27['Configurations']||{};}module[_0xb221('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xa503=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1568af,_0x161e9f){var _0x55c004=function(_0x445e4f){while(--_0x445e4f){_0x1568af['push'](_0x1568af['shift']());}};_0x55c004(++_0x161e9f);}(_0xa503,0xbd));var _0x3a50=function(_0x132a14,_0x3fad4d){_0x132a14=_0x132a14-0x0;var _0x7f3803=_0xa503[_0x132a14];return _0x7f3803;};'use strict';function SugarcrmAccount(_0x322d10){this['id']=_0x322d10['id']||0x0;this['name']=_0x322d10[_0x3a50('0x0')]||'';this[_0x3a50('0x1')]=_0x322d10[_0x3a50('0x1')]||'';this[_0x3a50('0x2')]=_0x322d10[_0x3a50('0x2')]||'';this[_0x3a50('0x3')]=_0x322d10['remoteUri']||'';this['serverUrl']=_0x322d10[_0x3a50('0x4')]||'';this[_0x3a50('0x5')]=_0x322d10[_0x3a50('0x5')]||{};}module[_0x3a50('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 8cd239b..d0ee712 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 _0x579a=['stateTime','exports','name','accountcode','unknown'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x579a,0x9d));var _0xa579=function(_0x4b034f,_0x955419){_0x4b034f=_0x4b034f-0x0;var _0x546a0a=_0x579a[_0x4b034f];return _0x546a0a;};'use strict';function Telephone(_0x53ae98){this['id']=_0x53ae98['id']||0x0;this[_0xa579('0x0')]=_0x53ae98[_0xa579('0x0')]||'';this[_0xa579('0x1')]=_0x53ae98['accountcode']||'';this['state']=_0xa579('0x2');this[_0xa579('0x3')]=0x0;this['status']='unknown';this['address']='';}module[_0xa579('0x4')]=Telephone; \ No newline at end of file +var _0xfc7c=['exports','name','accountcode','state','stateTime','status'];(function(_0x520236,_0x5c8564){var _0x4d6664=function(_0x398c51){while(--_0x398c51){_0x520236['push'](_0x520236['shift']());}};_0x4d6664(++_0x5c8564);}(_0xfc7c,0x18d));var _0xcfc7=function(_0x571166,_0x17cb05){_0x571166=_0x571166-0x0;var _0xdbd2cc=_0xfc7c[_0x571166];return _0xdbd2cc;};'use strict';function Telephone(_0x4a6c5e){this['id']=_0x4a6c5e['id']||0x0;this[_0xcfc7('0x0')]=_0x4a6c5e['name']||'';this[_0xcfc7('0x1')]=_0x4a6c5e[_0xcfc7('0x1')]||'';this[_0xcfc7('0x2')]='unknown';this[_0xcfc7('0x3')]=0x0;this[_0xcfc7('0x4')]='unknown';this['address']='';}module[_0xcfc7('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index c6db0c8..756bad4 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(_0x8448c6,_0x7b6974){var _0x157d92=function(_0x15a6b1){while(--_0x15a6b1){_0x8448c6['push'](_0x8448c6['shift']());}};_0x157d92(++_0x7b6974);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 _0xb10b=['name','html'];(function(_0x35e889,_0x5c9451){var _0x119b00=function(_0x586dbc){while(--_0x586dbc){_0x35e889['push'](_0x35e889['shift']());}};_0x119b00(++_0x5c9451);}(_0xb10b,0x12a));var _0xbb10=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0xb10b[_0x572637];return _0xb6748;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 0583122..895175b 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 _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5d6280,_0x3f72ab){_0x5d6280=_0x5d6280-0x0;var _0x77b738=_0x5eb8[_0x5d6280];return _0x77b738;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x57e309,_0x1b7f1f){var _0x5aa5c2=function(_0x274fcb){while(--_0x274fcb){_0x57e309['push'](_0x57e309['shift']());}};_0x5aa5c2(++_0x1b7f1f);}(_0x4fc2,0x111));var _0x24fc=function(_0x518b4f,_0x22ae83){_0x518b4f=_0x518b4f-0x0;var _0x4d454d=_0x4fc2[_0x518b4f];return _0x4d454d;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 8e05765..5609c9e 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 _0xfb95=['active','name','unknown','stateTime','status','registry','split','host','domain','domainport','refresh','stateRegistry','defaultuser','exports'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xfb95,0x150));var _0x5fb9=function(_0x4486ee,_0x85b039){_0x4486ee=_0x4486ee-0x0;var _0x2713cb=_0xfb95[_0x4486ee];return _0x2713cb;};'use strict';function Trunk(_0x3c60c6){this['id']=_0x3c60c6['id']||0x0;this[_0x5fb9('0x0')]=_0x3c60c6[_0x5fb9('0x0')]||![];this[_0x5fb9('0x1')]=_0x3c60c6[_0x5fb9('0x1')]||'';this['state']=_0x5fb9('0x2');this[_0x5fb9('0x3')]=0x0;this[_0x5fb9('0x4')]='unknown';this[_0x5fb9('0x5')]=_0x3c60c6[_0x5fb9('0x5')]&&_0x3c60c6[_0x5fb9('0x5')]['indexOf'](':')?_0x3c60c6[_0x5fb9('0x5')][_0x5fb9('0x6')](':')[0x0]:'';this[_0x5fb9('0x7')]='';this['port']='';this[_0x5fb9('0x8')]='';this[_0x5fb9('0x9')]='';this[_0x5fb9('0xa')]='';this[_0x5fb9('0xb')]=_0x5fb9('0x2');this['registrationtime']='';this['address']='';this[_0x5fb9('0xc')]=_0x3c60c6[_0x5fb9('0xc')]||'';}module[_0x5fb9('0xd')]=Trunk; \ No newline at end of file +var _0x987a=['stateTime','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry','unknown','registrationtime','defaultuser','exports','active','name','state'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x987a,0x16d));var _0xa987=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x987a[_0x33032e];return _0x13316b;};'use strict';function Trunk(_0x5ccc02){this['id']=_0x5ccc02['id']||0x0;this[_0xa987('0x0')]=_0x5ccc02[_0xa987('0x0')]||![];this['name']=_0x5ccc02[_0xa987('0x1')]||'';this[_0xa987('0x2')]='unknown';this[_0xa987('0x3')]=0x0;this['status']='unknown';this[_0xa987('0x4')]=_0x5ccc02[_0xa987('0x4')]&&_0x5ccc02[_0xa987('0x4')][_0xa987('0x5')](':')?_0x5ccc02[_0xa987('0x4')][_0xa987('0x6')](':')[0x0]:'';this[_0xa987('0x7')]='';this['port']='';this[_0xa987('0x8')]='';this[_0xa987('0x9')]='';this[_0xa987('0xa')]='';this[_0xa987('0xb')]=_0xa987('0xc');this[_0xa987('0xd')]='';this['address']='';this['defaultuser']=_0x5ccc02[_0xa987('0xe')]||'';}module[_0xa987('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 1785ebd..be48949 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 _0xcae6=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x33055e,_0x54dff9){var _0x41dfb4=function(_0x5b4123){while(--_0x5b4123){_0x33055e['push'](_0x33055e['shift']());}};_0x41dfb4(++_0x54dff9);}(_0xcae6,0x68));var _0x6cae=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0xcae6[_0x515283];return _0x38f836;};'use strict';function voiceExtension(_0x4cdcf6){this['id']=_0x4cdcf6['id']||0x0;this[_0x6cae('0x0')]=_0x4cdcf6[_0x6cae('0x0')]||'';this[_0x6cae('0x1')]=_0x4cdcf6['recordingFormat']||'none';this[_0x6cae('0x2')]=_0x4cdcf6[_0x6cae('0x2')]||![];}module[_0x6cae('0x3')]=voiceExtension; \ No newline at end of file +var _0x35cb=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x4c4456,_0x234a0d){var _0x3ea1ff=function(_0x2249c6){while(--_0x2249c6){_0x4c4456['push'](_0x4c4456['shift']());}};_0x3ea1ff(++_0x234a0d);}(_0x35cb,0x1f0));var _0xb35c=function(_0x50c9af,_0x414a5b){_0x50c9af=_0x50c9af-0x0;var _0x3c82c2=_0x35cb[_0x50c9af];return _0x3c82c2;};'use strict';function voiceExtension(_0x205d8a){this['id']=_0x205d8a['id']||0x0;this[_0xb35c('0x0')]=_0x205d8a[_0xb35c('0x0')]||'';this[_0xb35c('0x1')]=_0x205d8a['recordingFormat']||_0xb35c('0x2');this[_0xb35c('0x3')]=_0x205d8a[_0xb35c('0x3')]||![];}module[_0xb35c('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c17a333..f308d49 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 _0xbbbd=['gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','unmanaged','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49'];(function(_0x31a7b8,_0x7b8d58){var _0x13b96b=function(_0x6234d2){while(--_0x6234d2){_0x31a7b8['push'](_0x31a7b8['shift']());}};_0x13b96b(++_0x7b8d58);}(_0xbbbd,0x86));var _0xdbbb=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xbbbd[_0x119d5a];return _0x15bff4;};'use strict';var monitorFormat={'wav':_0xdbbb('0x0'),'wav49':_0xdbbb('0x1'),'gsm':_0xdbbb('0x2')};var strategy={'fewestcalls':_0xdbbb('0x3'),'leastrecent':_0xdbbb('0x4'),'linear':_0xdbbb('0x5'),'random':_0xdbbb('0x6'),'ringall':_0xdbbb('0x7'),'rr':_0xdbbb('0x8'),'rrmemory':_0xdbbb('0x9'),'rrordered':_0xdbbb('0xa'),'wrandom':_0xdbbb('0xb')};function VoiceQueue(_0x4e9523){this['id']=_0x4e9523['id']||0x0;this[_0xdbbb('0xc')]=_0x4e9523[_0xdbbb('0xc')]||'';this[_0xdbbb('0xd')]=_0x4e9523[_0xdbbb('0xd')]||'';this[_0xdbbb('0xe')]=_0x4e9523[_0xdbbb('0xe')]||_0xdbbb('0xf');this[_0xdbbb('0x10')]=0x0;this[_0xdbbb('0x11')]=0x0;this[_0xdbbb('0x12')]=0x0;this['sumDuration']=0x0;this[_0xdbbb('0x13')]=0x0;this['sumBillable']=0x0;this[_0xdbbb('0x14')]=0x0;this['abandoned']=0x0;this[_0xdbbb('0x15')]=0x0;this[_0xdbbb('0x16')]=0x0;this[_0xdbbb('0x17')]=0x0;this[_0xdbbb('0x18')]=0x0;this[_0xdbbb('0x19')]=0x0;this[_0xdbbb('0x1a')]=0x0;this[_0xdbbb('0x1b')]=0x0;this[_0xdbbb('0x1c')]=0x0;this[_0xdbbb('0x1d')]=0x0;this['ringInUse']=0x0;this[_0xdbbb('0x1e')]=0x0;this[_0xdbbb('0x1f')]=0x0;this[_0xdbbb('0x20')]=0x0;this[_0xdbbb('0x21')]=_0x4e9523[_0xdbbb('0x21')]||![];this[_0xdbbb('0x22')]=_0x4e9523[_0xdbbb('0x22')]||0xa;this[_0xdbbb('0x23')]=_0x4e9523[_0xdbbb('0x23')]||'no';this[_0xdbbb('0x24')]=!![];this[_0xdbbb('0x25')]='';this[_0xdbbb('0x26')]='';this[_0xdbbb('0x27')]=0x0;this[_0xdbbb('0x28')]=0x0;this['dialTimezone']=_0x4e9523[_0xdbbb('0x29')]||null;this[_0xdbbb('0x2a')]=_0x4e9523['dialGlobalInterval']?_0x4e9523['dialGlobalInterval']:null;this[_0xdbbb('0x2b')]=_0x4e9523[_0xdbbb('0x2b')];this[_0xdbbb('0x2c')]=_0x4e9523['dialMethod']||_0xdbbb('0x2d');this[_0xdbbb('0x2e')]=_0x4e9523['dialLimitChannel']||0x0;this[_0xdbbb('0x2f')]=_0x4e9523[_0xdbbb('0x2f')]||0x0;this[_0xdbbb('0x30')]=_0x4e9523[_0xdbbb('0x30')]||0x1;this['dialPredictiveOptimization']=_0x4e9523[_0xdbbb('0x31')]||_0xdbbb('0x32');this[_0xdbbb('0x33')]=_0x4e9523[_0xdbbb('0x33')]||0.03;this[_0xdbbb('0x34')]=_0x4e9523[_0xdbbb('0x34')]||0x258;this['dialOriginateCallerIdName']=_0x4e9523[_0xdbbb('0x35')]||_0xdbbb('0x36');this['dialOriginateCallerIdNumber']=_0x4e9523['dialOriginateCallerIdNumber']||_0xdbbb('0x36');this[_0xdbbb('0x37')]=_0x4e9523[_0xdbbb('0x37')]||0x1e;this['dialQueueOptions']=_0x4e9523[_0xdbbb('0x38')]||'tTxX';this[_0xdbbb('0x39')]=_0x4e9523[_0xdbbb('0x39')]||0x3;this['dialQueueProject']=_0x4e9523['dialQueueProject']||undefined;this[_0xdbbb('0x3a')]=_0x4e9523['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x4e9523[_0xdbbb('0x3b')]||0x96;this[_0xdbbb('0x3c')]=_0x4e9523[_0xdbbb('0x3c')]||0x3;this[_0xdbbb('0x3d')]=_0x4e9523[_0xdbbb('0x3d')]||0x96;this[_0xdbbb('0x3e')]=_0x4e9523[_0xdbbb('0x3e')]||0x3;this[_0xdbbb('0x3f')]=_0x4e9523['dialNoAnswerRetryFrequency']||0x96;this[_0xdbbb('0x40')]=_0x4e9523[_0xdbbb('0x40')]||0x3;this[_0xdbbb('0x41')]=_0x4e9523['dialNoSuchNumberRetryFrequency']||0x96;this[_0xdbbb('0x42')]=_0x4e9523[_0xdbbb('0x42')]||0x3;this[_0xdbbb('0x43')]=_0x4e9523[_0xdbbb('0x43')]||0x96;this['dialAbandonedMaxRetry']=_0x4e9523[_0xdbbb('0x44')]||0x3;this['dialAbandonedRetryFrequency']=_0x4e9523[_0xdbbb('0x45')]||0x96;this['dialMachineMaxRetry']=_0x4e9523[_0xdbbb('0x46')]||0x3;this[_0xdbbb('0x47')]=_0x4e9523[_0xdbbb('0x47')]||0x96;this[_0xdbbb('0x48')]=_0x4e9523[_0xdbbb('0x48')]||0x3;this[_0xdbbb('0x49')]=_0x4e9523[_0xdbbb('0x49')]||0x96;this[_0xdbbb('0x4a')]=_0x4e9523[_0xdbbb('0x4a')]||0x3;this[_0xdbbb('0x4b')]=_0x4e9523[_0xdbbb('0x4b')]||0x4;this[_0xdbbb('0x4c')]=_0x4e9523[_0xdbbb('0x4c')]?_0x4e9523[_0xdbbb('0x4c')]:undefined;this[_0xdbbb('0x4d')]=_0x4e9523[_0xdbbb('0x4d')]?_0x4e9523[_0xdbbb('0x4d')]:undefined;this[_0xdbbb('0x4e')]=_0x4e9523['dialPrefix']||undefined;this[_0xdbbb('0x4f')]=_0x4e9523['Interval']?_0x4e9523[_0xdbbb('0x4f')]:undefined;this[_0xdbbb('0x50')]=_0x4e9523['dialOrderByScheduledAt']||_0xdbbb('0x51');this[_0xdbbb('0x52')]=_0x4e9523[_0xdbbb('0x52')]||undefined;this[_0xdbbb('0x53')]=_0x4e9523[_0xdbbb('0x53')]||undefined;this['strategy']=strategy[_0x4e9523[_0xdbbb('0x54')]];this[_0xdbbb('0x55')]=!![];this['dialAMDActive']=_0x4e9523[_0xdbbb('0x56')]||![];this[_0xdbbb('0x57')]=_0x4e9523[_0xdbbb('0x57')];this[_0xdbbb('0x58')]=_0x4e9523[_0xdbbb('0x58')];this[_0xdbbb('0x59')]=_0x4e9523['dialAMDAfterGreetingSilence'];this[_0xdbbb('0x5a')]=_0x4e9523[_0xdbbb('0x5a')];this[_0xdbbb('0x5b')]=_0x4e9523[_0xdbbb('0x5b')];this[_0xdbbb('0x5c')]=_0x4e9523[_0xdbbb('0x5c')];this['dialAMDMaximumNumberOfWords']=_0x4e9523[_0xdbbb('0x5d')];this[_0xdbbb('0x5e')]=_0x4e9523[_0xdbbb('0x5e')];this[_0xdbbb('0x5f')]=_0x4e9523[_0xdbbb('0x5f')];this[_0xdbbb('0x60')]=0x0;this[_0xdbbb('0x61')]=0x0;this['timeout']=_0x4e9523['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xdbbb('0x62')]=0x0;this[_0xdbbb('0x63')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xdbbb('0x64')]=0x0;this[_0xdbbb('0x65')]=0x0;this[_0xdbbb('0x66')]=0x0;this[_0xdbbb('0x67')]=0x0;this[_0xdbbb('0x68')]=0x0;this[_0xdbbb('0x69')]=0x0;this[_0xdbbb('0x6a')]=0x0;this[_0xdbbb('0x6b')]=0x0;this[_0xdbbb('0x6c')]=0x0;this[_0xdbbb('0x6d')]=0x0;this[_0xdbbb('0x6e')]=undefined;this['startPredictive']=undefined;this[_0xdbbb('0x6f')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xdbbb('0x70')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xdbbb('0x71')]=0x0;this[_0xdbbb('0x72')]=0x0;this[_0xdbbb('0x73')]=0x0;this[_0xdbbb('0x74')]=0x0;this[_0xdbbb('0x75')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xdbbb('0x76')]=_0x4e9523[_0xdbbb('0x77')]||0x14;this['predictiveIntervalMinThreshold']=_0x4e9523['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xdbbb('0x78')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xdbbb('0x79')]=0x0;this[_0xdbbb('0x7a')]=0x0;this[_0xdbbb('0x7b')]=0x0;this[_0xdbbb('0x7c')]=0x0;this[_0xdbbb('0x7d')]=_0x4e9523['dialRecallMeTimeout']||0x1e;this[_0xdbbb('0x7e')]=_0x4e9523['dialRecallInQueue']||![];this[_0xdbbb('0x7f')]=!!_0x4e9523['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x4e9523[_0xdbbb('0x80')]||![];this[_0xdbbb('0x81')]=_0x4e9523[_0xdbbb('0x81')]||undefined;this[_0xdbbb('0x82')]=_0x4e9523[_0xdbbb('0x82')]||![];this[_0xdbbb('0x83')]=_0x4e9523[_0xdbbb('0x83')]||![];this[_0xdbbb('0xd')]=monitorFormat[_0x4e9523[_0xdbbb('0xd')]]?monitorFormat[_0x4e9523[_0xdbbb('0xd')]]:undefined;this[_0xdbbb('0x84')]=_0x4e9523[_0xdbbb('0x84')]||![];this[_0xdbbb('0x85')]=_0x4e9523['mandatoryDispositionPause']?_0x4e9523['mandatoryDispositionPause']:undefined;this[_0xdbbb('0x86')]=![];}module[_0xdbbb('0x87')]=VoiceQueue; \ No newline at end of file +var _0x6e64=['startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','inUse','invalid','loggedIn','notInUse','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive'];(function(_0x2f67ac,_0x2456b7){var _0x25f851=function(_0x143889){while(--_0x143889){_0x2f67ac['push'](_0x2f67ac['shift']());}};_0x25f851(++_0x2456b7);}(_0x6e64,0x10f));var _0x46e6=function(_0xf3b939,_0x324423){_0xf3b939=_0xf3b939-0x0;var _0x563771=_0x6e64[_0xf3b939];return _0x563771;};'use strict';var monitorFormat={'wav':_0x46e6('0x0'),'wav49':_0x46e6('0x1'),'gsm':_0x46e6('0x2')};var strategy={'fewestcalls':_0x46e6('0x3'),'leastrecent':'leastrecent','linear':_0x46e6('0x4'),'random':'random','ringall':_0x46e6('0x5'),'rr':'roundrobin','rrmemory':_0x46e6('0x6'),'rrordered':_0x46e6('0x7'),'wrandom':_0x46e6('0x8')};function VoiceQueue(_0x1fbeb1){this['id']=_0x1fbeb1['id']||0x0;this[_0x46e6('0x9')]=_0x1fbeb1[_0x46e6('0x9')]||'';this['monitor_format']=_0x1fbeb1[_0x46e6('0xa')]||'';this[_0x46e6('0xb')]=_0x1fbeb1[_0x46e6('0xb')]||_0x46e6('0xc');this[_0x46e6('0xd')]=0x0;this[_0x46e6('0xe')]=0x0;this[_0x46e6('0xf')]=0x0;this[_0x46e6('0x10')]=0x0;this[_0x46e6('0x11')]=0x0;this[_0x46e6('0x12')]=0x0;this['unmanaged']=0x0;this[_0x46e6('0x13')]=0x0;this['available']=0x0;this['busy']=0x0;this[_0x46e6('0x14')]=0x0;this[_0x46e6('0x15')]=0x0;this[_0x46e6('0x16')]=0x0;this[_0x46e6('0x17')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x46e6('0x18')]=0x0;this[_0x46e6('0x19')]=0x0;this[_0x46e6('0x1a')]=0x0;this[_0x46e6('0x1b')]=0x0;this[_0x46e6('0x1c')]=0x0;this[_0x46e6('0x1d')]=_0x1fbeb1[_0x46e6('0x1d')]||![];this['acwTimeout']=_0x1fbeb1[_0x46e6('0x1e')]||0xa;this['autopause']=_0x1fbeb1[_0x46e6('0x1f')]||'no';this[_0x46e6('0x20')]=!![];this['message']='';this['statusMessage']='';this[_0x46e6('0x21')]=0x0;this[_0x46e6('0x22')]=0x0;this[_0x46e6('0x23')]=_0x1fbeb1['dialTimezone']||null;this[_0x46e6('0x24')]=_0x1fbeb1[_0x46e6('0x24')]?_0x1fbeb1[_0x46e6('0x24')]:null;this[_0x46e6('0x25')]=_0x1fbeb1[_0x46e6('0x25')];this[_0x46e6('0x26')]=_0x1fbeb1['dialMethod']||_0x46e6('0x27');this['dialLimitChannel']=_0x1fbeb1[_0x46e6('0x28')]||0x0;this['dialLimitQueue']=_0x1fbeb1[_0x46e6('0x29')]||0x0;this['dialPowerLevel']=_0x1fbeb1['dialPowerLevel']||0x1;this[_0x46e6('0x2a')]=_0x1fbeb1[_0x46e6('0x2a')]||_0x46e6('0x2b');this['dialPredictiveOptimizationPercentage']=_0x1fbeb1[_0x46e6('0x2c')]||0.03;this[_0x46e6('0x2d')]=_0x1fbeb1['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x1fbeb1[_0x46e6('0x2e')]||'anonymous';this[_0x46e6('0x2f')]=_0x1fbeb1[_0x46e6('0x2f')]||_0x46e6('0x30');this['dialOriginateTimeout']=_0x1fbeb1[_0x46e6('0x31')]||0x1e;this[_0x46e6('0x32')]=_0x1fbeb1[_0x46e6('0x32')]||_0x46e6('0x33');this[_0x46e6('0x34')]=_0x1fbeb1[_0x46e6('0x34')]||0x3;this[_0x46e6('0x35')]=_0x1fbeb1['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x1fbeb1[_0x46e6('0x36')]||0x3;this[_0x46e6('0x37')]=_0x1fbeb1[_0x46e6('0x37')]||0x96;this[_0x46e6('0x38')]=_0x1fbeb1[_0x46e6('0x38')]||0x3;this[_0x46e6('0x39')]=_0x1fbeb1[_0x46e6('0x39')]||0x96;this[_0x46e6('0x3a')]=_0x1fbeb1[_0x46e6('0x3a')]||0x3;this[_0x46e6('0x3b')]=_0x1fbeb1['dialNoAnswerRetryFrequency']||0x96;this[_0x46e6('0x3c')]=_0x1fbeb1[_0x46e6('0x3c')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1fbeb1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x46e6('0x3d')]=_0x1fbeb1[_0x46e6('0x3d')]||0x3;this[_0x46e6('0x3e')]=_0x1fbeb1[_0x46e6('0x3e')]||0x96;this[_0x46e6('0x3f')]=_0x1fbeb1['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x1fbeb1[_0x46e6('0x40')]||0x96;this[_0x46e6('0x41')]=_0x1fbeb1[_0x46e6('0x41')]||0x3;this[_0x46e6('0x42')]=_0x1fbeb1[_0x46e6('0x42')]||0x96;this[_0x46e6('0x43')]=_0x1fbeb1[_0x46e6('0x43')]||0x3;this[_0x46e6('0x44')]=_0x1fbeb1[_0x46e6('0x44')]||0x96;this[_0x46e6('0x45')]=_0x1fbeb1[_0x46e6('0x45')]||0x3;this[_0x46e6('0x46')]=_0x1fbeb1[_0x46e6('0x46')]||0x4;this[_0x46e6('0x47')]=_0x1fbeb1['Trunk']?_0x1fbeb1[_0x46e6('0x47')]:undefined;this['TrunkBackup']=_0x1fbeb1[_0x46e6('0x48')]?_0x1fbeb1['TrunkBackup']:undefined;this[_0x46e6('0x49')]=_0x1fbeb1['dialPrefix']||undefined;this[_0x46e6('0x4a')]=_0x1fbeb1[_0x46e6('0x4a')]?_0x1fbeb1[_0x46e6('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x1fbeb1['dialOrderByScheduledAt']||_0x46e6('0x4b');this[_0x46e6('0x4c')]=_0x1fbeb1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x46e6('0x4d')]=_0x1fbeb1[_0x46e6('0x4d')]||undefined;this['strategy']=strategy[_0x1fbeb1[_0x46e6('0x4e')]];this[_0x46e6('0x4f')]=!![];this['dialAMDActive']=_0x1fbeb1[_0x46e6('0x50')]||![];this['dialAMDInitialSilence']=_0x1fbeb1[_0x46e6('0x51')];this[_0x46e6('0x52')]=_0x1fbeb1[_0x46e6('0x52')];this[_0x46e6('0x53')]=_0x1fbeb1[_0x46e6('0x53')];this[_0x46e6('0x54')]=_0x1fbeb1[_0x46e6('0x54')];this[_0x46e6('0x55')]=_0x1fbeb1[_0x46e6('0x55')];this['dialAMDBetweenWordsSilence']=_0x1fbeb1['dialAMDBetweenWordsSilence'];this[_0x46e6('0x56')]=_0x1fbeb1[_0x46e6('0x56')];this[_0x46e6('0x57')]=_0x1fbeb1['dialAMDSilenceThreshold'];this[_0x46e6('0x58')]=_0x1fbeb1[_0x46e6('0x58')];this[_0x46e6('0x59')]=0x0;this['pTalking']=0x0;this[_0x46e6('0x5a')]=_0x1fbeb1[_0x46e6('0x5a')];this[_0x46e6('0x5b')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x46e6('0x5c')]=0x0;this[_0x46e6('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x46e6('0x5e')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x46e6('0x5f')]=0x0;this[_0x46e6('0x60')]=0x0;this[_0x46e6('0x61')]=0x0;this[_0x46e6('0x62')]=0x0;this[_0x46e6('0x63')]=0x0;this[_0x46e6('0x64')]=undefined;this[_0x46e6('0x65')]=undefined;this['handlePredictive']=undefined;this[_0x46e6('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x46e6('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x46e6('0x68')]=0x0;this[_0x46e6('0x69')]=0x0;this[_0x46e6('0x6a')]=0x0;this[_0x46e6('0x6b')]=0x0;this[_0x46e6('0x6c')]=_0x1fbeb1[_0x46e6('0x6d')]||0x14;this['predictiveIntervalMinThreshold']=_0x1fbeb1[_0x46e6('0x6d')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x46e6('0x6e')]=0x1;this[_0x46e6('0x6f')]=0x0;this[_0x46e6('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x46e6('0x71')]=0x0;this['dialRecallMeTimeout']=_0x1fbeb1[_0x46e6('0x72')]||0x1e;this['dialRecallInQueue']=_0x1fbeb1[_0x46e6('0x73')]||![];this[_0x46e6('0x74')]=!!_0x1fbeb1['dialPreviewAutoRecallMe']||![];this[_0x46e6('0x75')]=!!_0x1fbeb1['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x1fbeb1[_0x46e6('0x76')]||undefined;this[_0x46e6('0x77')]=_0x1fbeb1[_0x46e6('0x77')]||![];this[_0x46e6('0x78')]=_0x1fbeb1['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1fbeb1[_0x46e6('0xa')]]?monitorFormat[_0x1fbeb1['monitor_format']]:undefined;this[_0x46e6('0x79')]=_0x1fbeb1[_0x46e6('0x79')]||![];this['mandatoryDispositionPause']=_0x1fbeb1['mandatoryDispositionPause']?_0x1fbeb1['mandatoryDispositionPause']:undefined;this[_0x46e6('0x7a')]=![];}module[_0x46e6('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index be5fb22..70d9c9d 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd51=['loggedInDb','paused','ringing','talking','loggedIn','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','waiting','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','loggedin','callers','length','online','incall','status','keys','dialer','exten','xcally-motion-preview','prototype','some','compareToOutboundQueue','outboundAbandonedCallsDay','preview','available'];(function(_0x18be13,_0x12f269){var _0x17317b=function(_0x449d31){while(--_0x449d31){_0x18be13['push'](_0x18be13['shift']());}};_0x17317b(++_0x12f269);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5085ad,_0x3d12d4){_0x5085ad=_0x5085ad-0x0;var _0x3ad717=_0xbd51[_0x5085ad];return _0x3ad717;};'use strict';var INBOUND_COUNTERS=[_0x1bd5('0x0'),'loggedIn',_0x1bd5('0x1'),_0x1bd5('0x2'),_0x1bd5('0x3'),_0x1bd5('0x4'),'waiting'];var OUTBOUND_COUNTERS=['available','answered','inUse',_0x1bd5('0x5'),_0x1bd5('0x1'),_0x1bd5('0x6'),'outboundAbandonedCallsDay',_0x1bd5('0x7'),_0x1bd5('0x8'),_0x1bd5('0x9'),_0x1bd5('0xa'),_0x1bd5('0xb'),'outboundNoSuchCallsDay',_0x1bd5('0xc'),'outboundRejectCallsDay',_0x1bd5('0xd'),_0x1bd5('0x2'),_0x1bd5('0xe'),_0x1bd5('0x4'),_0x1bd5('0xf'),_0x1bd5('0x10'),'total',_0x1bd5('0x11')];function VoiceQueueSummary(_0x4e666c){this['id']=_0x4e666c['id'];this[_0x1bd5('0x12')]=_0x4e666c[_0x1bd5('0x12')];this[_0x1bd5('0x13')]=_0x4e666c[_0x1bd5('0x13')];this[_0x1bd5('0x14')]=_0x4e666c[_0x1bd5('0x14')]||0x0;this[_0x1bd5('0x15')]=_0x4e666c['answered']||0x0;this['available']=_0x4e666c[_0x1bd5('0x0')]||0x0;this[_0x1bd5('0x16')]=_0x4e666c[_0x1bd5('0x16')]||0x0;this[_0x1bd5('0x17')]=_0x4e666c['inUse']||0x0;this['invalid']=_0x4e666c[_0x1bd5('0x18')]||0x0;this[_0x1bd5('0x5')]=_0x4e666c[_0x1bd5('0x5')]||0x0;this[_0x1bd5('0x1')]=_0x4e666c[_0x1bd5('0x1')]||0x0;this[_0x1bd5('0x19')]=_0x4e666c[_0x1bd5('0x19')]||0x0;this[_0x1bd5('0x1a')]=_0x4e666c[_0x1bd5('0x1a')]||0x0;this['paused']=_0x4e666c['paused']||0x0;this[_0x1bd5('0x3')]=_0x4e666c[_0x1bd5('0x3')]||0x0;this[_0x1bd5('0x1b')]=_0x4e666c[_0x1bd5('0x1b')];this[_0x1bd5('0xf')]=_0x4e666c[_0x1bd5('0xf')];this[_0x1bd5('0x10')]=_0x4e666c[_0x1bd5('0x10')];this[_0x1bd5('0x1c')]=_0x4e666c[_0x1bd5('0x1c')]||0x0;this[_0x1bd5('0x4')]=_0x4e666c[_0x1bd5('0x4')]||0x0;this[_0x1bd5('0x1d')]=_0x4e666c[_0x1bd5('0x1d')]||0x0;this[_0x1bd5('0x1e')]=_0x4e666c[_0x1bd5('0x1e')];this[_0x1bd5('0x1f')]=_0x4e666c[_0x1bd5('0x1f')]||0x0;this['unknown']=_0x4e666c[_0x1bd5('0x20')]||0x0;this['unmanaged']=_0x4e666c[_0x1bd5('0x21')]||0x0;this[_0x1bd5('0x11')]=_0x4e666c[_0x1bd5('0x11')]||0x0;if(_0x4e666c['type']===_0x1bd5('0x22')){this['pTalking']=_0x4e666c[_0x1bd5('0xe')]||0x0;this[_0x1bd5('0x23')]=_0x4e666c[_0x1bd5('0x23')];this[_0x1bd5('0x24')]=_0x4e666c['dialMethod'];this[_0x1bd5('0x25')]=_0x4e666c[_0x1bd5('0x25')];this[_0x1bd5('0x26')]=_0x4e666c[_0x1bd5('0x26')];this['dialOriginateTimeout']=_0x4e666c[_0x1bd5('0x27')];this[_0x1bd5('0x28')]=_0x4e666c[_0x1bd5('0x28')];this[_0x1bd5('0x29')]=_0x4e666c[_0x1bd5('0x29')];this[_0x1bd5('0x2a')]=_0x4e666c['outboundAnswerAgiCallsDay'];this[_0x1bd5('0x7')]=_0x4e666c[_0x1bd5('0x7')];this[_0x1bd5('0x8')]=_0x4e666c['outboundBlacklistCallsDay'];this[_0x1bd5('0x9')]=_0x4e666c[_0x1bd5('0x9')];this[_0x1bd5('0xa')]=_0x4e666c[_0x1bd5('0xa')];this[_0x1bd5('0x2b')]=_0x4e666c[_0x1bd5('0x2b')];this['outboundDropCallsDayCallersExit']=_0x4e666c['outboundDropCallsDayCallersExit'];this[_0x1bd5('0x2c')]=_0x4e666c[_0x1bd5('0x2c')];this['outboundNoAnswerCallsDay']=_0x4e666c[_0x1bd5('0xb')];this[_0x1bd5('0x2d')]=_0x4e666c[_0x1bd5('0x2d')];this[_0x1bd5('0x2e')]=_0x4e666c['outboundOriginateFailureCallsDay'];this[_0x1bd5('0xc')]=_0x4e666c[_0x1bd5('0xc')];this[_0x1bd5('0x2f')]=_0x4e666c[_0x1bd5('0x2f')];this[_0x1bd5('0xd')]=_0x4e666c[_0x1bd5('0xd')];this[_0x1bd5('0x30')]=_0x4e666c[_0x1bd5('0x30')];this['predictiveIntervalAvgHoldtime']=_0x4e666c[_0x1bd5('0x31')];this[_0x1bd5('0x32')]=_0x4e666c[_0x1bd5('0x32')];this[_0x1bd5('0x33')]=_0x4e666c[_0x1bd5('0x33')];this[_0x1bd5('0x34')]=_0x4e666c[_0x1bd5('0x34')];this['predictiveIntervalErlangCalls']=_0x4e666c[_0x1bd5('0x35')];this[_0x1bd5('0x36')]=_0x4e666c[_0x1bd5('0x36')];this[_0x1bd5('0x37')]=_0x4e666c[_0x1bd5('0x37')];this[_0x1bd5('0x38')]=_0x4e666c[_0x1bd5('0x38')];this['predictiveIntervalPauses']=_0x4e666c['predictiveIntervalPauses'];this[_0x1bd5('0x39')]=_0x4e666c[_0x1bd5('0x39')];this[_0x1bd5('0x3a')]=_0x4e666c['predictiveIntervalTotalCalls'];this[_0x1bd5('0x6')]=_0x4e666c['originated'];this[_0x1bd5('0x3b')]=_0x4e666c[_0x1bd5('0x3b')];this[_0x1bd5('0x3c')]=_0x4e666c[_0x1bd5('0x3c')];this[_0x1bd5('0x3d')]=_0x4e666c[_0x1bd5('0x3d')];this[_0x1bd5('0x3e')]=_0x4e666c[_0x1bd5('0x3e')];this['startPredictive']=_0x4e666c[_0x1bd5('0x3f')];this[_0x1bd5('0x40')]=_0x4e666c['startProgressive'];this[_0x1bd5('0x41')]=_0x4e666c[_0x1bd5('0x41')];this[_0x1bd5('0x42')]=_0x4e666c['statusMessage'];}if(_0x4e666c[_0x1bd5('0x43')]){this[_0x1bd5('0x43')]={'id':_0x4e666c[_0x1bd5('0x43')]['id'],'name':_0x4e666c[_0x1bd5('0x43')]['name'],'active':_0x4e666c[_0x1bd5('0x43')][_0x1bd5('0x44')],'callerid':_0x4e666c[_0x1bd5('0x43')][_0x1bd5('0x45')]};}}VoiceQueueSummary['prototype']['createReport']=function(_0x40eeff,_0x35afc7,_0x453544,_0x561b3b){this[_0x1bd5('0x1')]=0x0;this[_0x1bd5('0x4')]=0x0;this['paused']=0x0;this[_0x1bd5('0x20')]=0x0;this['notInUse']=0x0;this[_0x1bd5('0x17')]=0x0;this[_0x1bd5('0x16')]=0x0;this['invalid']=0x0;this[_0x1bd5('0x1f')]=0x0;this[_0x1bd5('0x3')]=0x0;this[_0x1bd5('0x1b')]=0x0;this[_0x1bd5('0x19')]=0x0;if(_0x453544){if(_0x453544[_0x1bd5('0x0')]){this[_0x1bd5('0x0')]=Number(_0x453544[_0x1bd5('0x0')]);}if(_0x453544[_0x1bd5('0x46')]){this[_0x1bd5('0x5')]=Number(_0x453544[_0x1bd5('0x46')]);}if(_0x453544[_0x1bd5('0x47')]){this[_0x1bd5('0x11')]=Number(_0x453544['callers']);}}for(var _0x243bf7=0x0;_0x243bf7<_0x40eeff[_0x1bd5('0x48')];_0x243bf7++){var _0x335125=_0x35afc7['SIP/'+_0x40eeff[_0x243bf7][_0x1bd5('0x12')]];if(_0x335125&&_0x335125[_0x1bd5('0x49')]){this['loggedInDb']+=0x1;}if(_0x40eeff[_0x243bf7][_0x1bd5('0x4a')]==='1'){this['talking']+=0x1;}if(_0x40eeff[_0x243bf7][_0x1bd5('0x2')]==='1'&&!['2','7','8']['includes'](_0x40eeff[_0x243bf7][_0x1bd5('0x4b')])){this[_0x1bd5('0x2')]+=0x1;}switch(_0x40eeff[_0x243bf7]['status']){case'0':this[_0x1bd5('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x1bd5('0x17')]+=0x1;break;case'3':this[_0x1bd5('0x16')]+=0x1;break;case'4':this[_0x1bd5('0x18')]+=0x1;break;case'5':this[_0x1bd5('0x1f')]+=0x1;break;case'6':this[_0x1bd5('0x3')]+=0x1;break;case'7':this[_0x1bd5('0x1b')]+=0x1;break;case'8':this[_0x1bd5('0x19')]+=0x1;break;}}if(this[_0x1bd5('0x24')]==='booked'){var _0x13985e=Object[_0x1bd5('0x4c')](_0x561b3b);for(var _0x2a1ece=0x0;_0x2a1ece<_0x13985e[_0x1bd5('0x48')];_0x2a1ece++){var _0x34452a=_0x13985e[_0x2a1ece];var _0x1c4c20=_0x561b3b[_0x34452a];if(_0x1c4c20['queue']===this[_0x1bd5('0x12')]&&_0x1c4c20[_0x1bd5('0x1e')]===_0x1bd5('0x4d')&&_0x1c4c20[_0x1bd5('0x4e')]===_0x1bd5('0x4f')){this[_0x1bd5('0x4')]+=0x1;}}if(this[_0x1bd5('0x4')]>this['inUse']){this['talking']=this[_0x1bd5('0x17')];}this[_0x1bd5('0xe')]=0x0;}return this;};VoiceQueueSummary[_0x1bd5('0x50')]['compareToInboundQueue']=function(_0x281c87){var _0x1bb55b=![];if(_0x281c87){_0x1bb55b=INBOUND_COUNTERS[_0x1bd5('0x51')](function(_0x1f2d7e){return this[_0x1f2d7e]!==_0x281c87[_0x1f2d7e];},this);}return _0x1bb55b;};VoiceQueueSummary[_0x1bd5('0x50')][_0x1bd5('0x52')]=function(_0x1d66bc){var _0x4db78c=![];var _0x316fbb=![];var _0x2bcd23=![];if(_0x1d66bc){_0x4db78c=this['dialMethod']!==_0x1d66bc[_0x1bd5('0x24')]||this['dialActive']!==_0x1d66bc[_0x1bd5('0x23')]||this['message']!==_0x1d66bc[_0x1bd5('0x41')]||this[_0x1bd5('0x42')]!==_0x1d66bc['statusMessage'];_0x316fbb=OUTBOUND_COUNTERS[_0x1bd5('0x51')](function(_0x1abfb6){return this[_0x1abfb6]!==_0x1d66bc[_0x1abfb6];},this);if(this[_0x1bd5('0x43')]&&_0x1d66bc[_0x1bd5('0x43')]){_0x2bcd23=this[_0x1bd5('0x43')][_0x1bd5('0x12')]!==_0x1d66bc[_0x1bd5('0x43')]['name']||this[_0x1bd5('0x43')]['active']!==_0x1d66bc[_0x1bd5('0x43')][_0x1bd5('0x44')];}}return _0x4db78c||_0x316fbb||_0x2bcd23;};VoiceQueueSummary[_0x1bd5('0x50')]['updateReportFromOutboundQueue']=function(_0x5d0cfd){this[_0x1bd5('0x15')]=_0x5d0cfd[_0x1bd5('0x15')];this[_0x1bd5('0x41')]=_0x5d0cfd[_0x1bd5('0x41')];this[_0x1bd5('0x42')]=_0x5d0cfd[_0x1bd5('0x42')];this[_0x1bd5('0x6')]=_0x5d0cfd[_0x1bd5('0x6')];this[_0x1bd5('0x53')]=_0x5d0cfd[_0x1bd5('0x53')];this['outboundAnswerCallsDay']=_0x5d0cfd[_0x1bd5('0x7')];this['outboundBlacklistCallsDay']=_0x5d0cfd[_0x1bd5('0x8')];this[_0x1bd5('0x9')]=_0x5d0cfd[_0x1bd5('0x9')];this['outboundCongestionCallsDay']=_0x5d0cfd[_0x1bd5('0xa')];this[_0x1bd5('0xb')]=_0x5d0cfd[_0x1bd5('0xb')];this['outboundNoSuchCallsDay']=_0x5d0cfd[_0x1bd5('0x2d')];this[_0x1bd5('0xc')]=_0x5d0cfd[_0x1bd5('0xc')];this[_0x1bd5('0x2f')]=_0x5d0cfd['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x5d0cfd[_0x1bd5('0xd')];this[_0x1bd5('0xf')]=_0x5d0cfd[_0x1bd5('0xf')];this['sumDuration']=_0x5d0cfd['sumDuration'];this[_0x1bd5('0x1d')]=_0x5d0cfd['total'];if(this[_0x1bd5('0x24')]===_0x1bd5('0x54')){this['pTalking']=_0x5d0cfd[_0x1bd5('0xe')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x7f3f=['dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','busy','onHold','loggedin','callers','length','SIP/','incall','keys','queue','exten','compareToInboundQueue','some','updateReportFromOutboundQueue','outboundNoSuchCallsDay','preview','available','loggedIn','paused','ringing','talking','waiting','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','total','name','strategy','abandoned','answered','invalid','loggedInDb','notInUse','ringInUse','sumBillable','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x28f922,_0x1302f8){_0x28f922=_0x28f922-0x0;var _0x4eceac=_0x7f3f[_0x28f922];return _0x4eceac;};'use strict';var INBOUND_COUNTERS=[_0xf7f3('0x0'),_0xf7f3('0x1'),'loggedInDb',_0xf7f3('0x2'),_0xf7f3('0x3'),_0xf7f3('0x4'),_0xf7f3('0x5')];var OUTBOUND_COUNTERS=[_0xf7f3('0x0'),'answered',_0xf7f3('0x6'),_0xf7f3('0x1'),'loggedInDb',_0xf7f3('0x7'),_0xf7f3('0x8'),_0xf7f3('0x9'),_0xf7f3('0xa'),_0xf7f3('0xb'),_0xf7f3('0xc'),_0xf7f3('0xd'),'outboundNoSuchCallsDay',_0xf7f3('0xe'),_0xf7f3('0xf'),_0xf7f3('0x10'),_0xf7f3('0x2'),_0xf7f3('0x11'),_0xf7f3('0x4'),'sumBillable','sumDuration',_0xf7f3('0x12'),'waiting'];function VoiceQueueSummary(_0x51a819){this['id']=_0x51a819['id'];this['name']=_0x51a819[_0xf7f3('0x13')];this[_0xf7f3('0x14')]=_0x51a819[_0xf7f3('0x14')];this[_0xf7f3('0x15')]=_0x51a819[_0xf7f3('0x15')]||0x0;this['answered']=_0x51a819[_0xf7f3('0x16')]||0x0;this[_0xf7f3('0x0')]=_0x51a819['available']||0x0;this['busy']=_0x51a819['busy']||0x0;this['inUse']=_0x51a819['inUse']||0x0;this[_0xf7f3('0x17')]=_0x51a819[_0xf7f3('0x17')]||0x0;this['loggedIn']=_0x51a819[_0xf7f3('0x1')]||0x0;this[_0xf7f3('0x18')]=_0x51a819[_0xf7f3('0x18')]||0x0;this['onHold']=_0x51a819['onHold']||0x0;this[_0xf7f3('0x19')]=_0x51a819[_0xf7f3('0x19')]||0x0;this[_0xf7f3('0x2')]=_0x51a819[_0xf7f3('0x2')]||0x0;this[_0xf7f3('0x3')]=_0x51a819[_0xf7f3('0x3')]||0x0;this['ringInUse']=_0x51a819[_0xf7f3('0x1a')];this['sumBillable']=_0x51a819[_0xf7f3('0x1b')];this[_0xf7f3('0x1c')]=_0x51a819[_0xf7f3('0x1c')];this[_0xf7f3('0x1d')]=_0x51a819[_0xf7f3('0x1d')]||0x0;this[_0xf7f3('0x4')]=_0x51a819[_0xf7f3('0x4')]||0x0;this[_0xf7f3('0x12')]=_0x51a819['total']||0x0;this[_0xf7f3('0x1e')]=_0x51a819[_0xf7f3('0x1e')];this[_0xf7f3('0x1f')]=_0x51a819[_0xf7f3('0x1f')]||0x0;this[_0xf7f3('0x20')]=_0x51a819[_0xf7f3('0x20')]||0x0;this[_0xf7f3('0x21')]=_0x51a819[_0xf7f3('0x21')]||0x0;this[_0xf7f3('0x5')]=_0x51a819[_0xf7f3('0x5')]||0x0;if(_0x51a819[_0xf7f3('0x1e')]===_0xf7f3('0x22')){this[_0xf7f3('0x11')]=_0x51a819['pTalking']||0x0;this[_0xf7f3('0x23')]=_0x51a819[_0xf7f3('0x23')];this[_0xf7f3('0x24')]=_0x51a819[_0xf7f3('0x24')];this[_0xf7f3('0x25')]=_0x51a819[_0xf7f3('0x25')];this[_0xf7f3('0x26')]=_0x51a819['dialOriginateCallerIdNumber'];this[_0xf7f3('0x27')]=_0x51a819[_0xf7f3('0x27')];this['dialPrefix']=_0x51a819['dialPrefix'];this[_0xf7f3('0x28')]=_0x51a819['temp'];this[_0xf7f3('0x29')]=_0x51a819[_0xf7f3('0x29')];this[_0xf7f3('0x9')]=_0x51a819[_0xf7f3('0x9')];this[_0xf7f3('0xa')]=_0x51a819[_0xf7f3('0xa')];this['outboundBusyCallsDay']=_0x51a819[_0xf7f3('0xb')];this[_0xf7f3('0xc')]=_0x51a819[_0xf7f3('0xc')];this['outboundDropCallsDayACS']=_0x51a819['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x51a819[_0xf7f3('0x2a')];this[_0xf7f3('0x2b')]=_0x51a819[_0xf7f3('0x2b')];this[_0xf7f3('0xd')]=_0x51a819['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x51a819['outboundNoSuchCallsDay'];this[_0xf7f3('0x2c')]=_0x51a819[_0xf7f3('0x2c')];this['outboundReCallsDay']=_0x51a819[_0xf7f3('0xe')];this['outboundRejectCallsDay']=_0x51a819['outboundRejectCallsDay'];this[_0xf7f3('0x10')]=_0x51a819[_0xf7f3('0x10')];this[_0xf7f3('0x2d')]=_0x51a819[_0xf7f3('0x2d')];this[_0xf7f3('0x2e')]=_0x51a819[_0xf7f3('0x2e')];this[_0xf7f3('0x2f')]=_0x51a819['predictiveIntervalAvgTalktime'];this[_0xf7f3('0x30')]=_0x51a819[_0xf7f3('0x30')];this['predictiveIntervalDroppedCallsTimeout']=_0x51a819[_0xf7f3('0x31')];this['predictiveIntervalErlangCalls']=_0x51a819['predictiveIntervalErlangCalls'];this[_0xf7f3('0x32')]=_0x51a819['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x51a819['predictiveIntervalHitRate'];this[_0xf7f3('0x33')]=_0x51a819['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x51a819[_0xf7f3('0x34')];this[_0xf7f3('0x35')]=_0x51a819['predictiveIntervalAvailable'];this[_0xf7f3('0x36')]=_0x51a819[_0xf7f3('0x36')];this[_0xf7f3('0x7')]=_0x51a819[_0xf7f3('0x7')];this[_0xf7f3('0x37')]=_0x51a819[_0xf7f3('0x37')];this['erlangCallToSecond']=_0x51a819[_0xf7f3('0x38')];this['erlangAbandonmentRate']=_0x51a819[_0xf7f3('0x39')];this['erlangBusyFactor']=_0x51a819[_0xf7f3('0x3a')];this[_0xf7f3('0x3b')]=_0x51a819[_0xf7f3('0x3b')];this[_0xf7f3('0x3c')]=_0x51a819['startProgressive'];this[_0xf7f3('0x3d')]=_0x51a819[_0xf7f3('0x3d')];this[_0xf7f3('0x3e')]=_0x51a819[_0xf7f3('0x3e')];}if(_0x51a819[_0xf7f3('0x3f')]){this[_0xf7f3('0x3f')]={'id':_0x51a819['Trunk']['id'],'name':_0x51a819['Trunk'][_0xf7f3('0x13')],'active':_0x51a819['Trunk'][_0xf7f3('0x40')],'callerid':_0x51a819['Trunk']['callerid']};}}VoiceQueueSummary[_0xf7f3('0x41')][_0xf7f3('0x42')]=function(_0x5d7c72,_0x14b2da,_0x3bd337,_0x291401){this['loggedInDb']=0x0;this[_0xf7f3('0x4')]=0x0;this[_0xf7f3('0x2')]=0x0;this[_0xf7f3('0x20')]=0x0;this[_0xf7f3('0x19')]=0x0;this[_0xf7f3('0x6')]=0x0;this[_0xf7f3('0x43')]=0x0;this[_0xf7f3('0x17')]=0x0;this['unavailable']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0xf7f3('0x44')]=0x0;if(_0x3bd337){if(_0x3bd337[_0xf7f3('0x0')]){this[_0xf7f3('0x0')]=Number(_0x3bd337[_0xf7f3('0x0')]);}if(_0x3bd337[_0xf7f3('0x45')]){this['loggedIn']=Number(_0x3bd337[_0xf7f3('0x45')]);}if(_0x3bd337[_0xf7f3('0x46')]){this[_0xf7f3('0x5')]=Number(_0x3bd337[_0xf7f3('0x46')]);}}for(var _0x5acb50=0x0;_0x5acb50<_0x5d7c72[_0xf7f3('0x47')];_0x5acb50++){var _0x2c1c50=_0x14b2da[_0xf7f3('0x48')+_0x5d7c72[_0x5acb50][_0xf7f3('0x13')]];if(_0x2c1c50&&_0x2c1c50['online']){this['loggedInDb']+=0x1;}if(_0x5d7c72[_0x5acb50][_0xf7f3('0x49')]==='1'){this[_0xf7f3('0x4')]+=0x1;}if(_0x5d7c72[_0x5acb50][_0xf7f3('0x2')]==='1'&&!['2','7','8']['includes'](_0x5d7c72[_0x5acb50]['status'])){this['paused']+=0x1;}switch(_0x5d7c72[_0x5acb50]['status']){case'0':this[_0xf7f3('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xf7f3('0x43')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xf7f3('0x1a')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xf7f3('0x24')]==='booked'){var _0x1102b8=Object[_0xf7f3('0x4a')](_0x291401);for(var _0x1969be=0x0;_0x1969be<_0x1102b8[_0xf7f3('0x47')];_0x1969be++){var _0x3f5c6d=_0x1102b8[_0x1969be];var _0x38108e=_0x291401[_0x3f5c6d];if(_0x38108e[_0xf7f3('0x4b')]===this['name']&&_0x38108e[_0xf7f3('0x1e')]==='dialer'&&_0x38108e[_0xf7f3('0x4c')]==='xcally-motion-preview'){this[_0xf7f3('0x4')]+=0x1;}}if(this[_0xf7f3('0x4')]>this[_0xf7f3('0x6')]){this[_0xf7f3('0x4')]=this[_0xf7f3('0x6')];}this[_0xf7f3('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xf7f3('0x41')][_0xf7f3('0x4d')]=function(_0x27a451){var _0x53f7cb=![];if(_0x27a451){_0x53f7cb=INBOUND_COUNTERS['some'](function(_0x152155){return this[_0x152155]!==_0x27a451[_0x152155];},this);}return _0x53f7cb;};VoiceQueueSummary[_0xf7f3('0x41')]['compareToOutboundQueue']=function(_0x476f7f){var _0x4871fe=![];var _0x394aba=![];var _0x3bf99b=![];if(_0x476f7f){_0x4871fe=this[_0xf7f3('0x24')]!==_0x476f7f[_0xf7f3('0x24')]||this[_0xf7f3('0x23')]!==_0x476f7f[_0xf7f3('0x23')]||this[_0xf7f3('0x3d')]!==_0x476f7f['message']||this['statusMessage']!==_0x476f7f[_0xf7f3('0x3e')];_0x394aba=OUTBOUND_COUNTERS[_0xf7f3('0x4e')](function(_0x1a3197){return this[_0x1a3197]!==_0x476f7f[_0x1a3197];},this);if(this[_0xf7f3('0x3f')]&&_0x476f7f['Trunk']){_0x3bf99b=this['Trunk'][_0xf7f3('0x13')]!==_0x476f7f[_0xf7f3('0x3f')]['name']||this[_0xf7f3('0x3f')][_0xf7f3('0x40')]!==_0x476f7f[_0xf7f3('0x3f')][_0xf7f3('0x40')];}}return _0x4871fe||_0x394aba||_0x3bf99b;};VoiceQueueSummary[_0xf7f3('0x41')][_0xf7f3('0x4f')]=function(_0x44f770){this[_0xf7f3('0x16')]=_0x44f770[_0xf7f3('0x16')];this[_0xf7f3('0x3d')]=_0x44f770[_0xf7f3('0x3d')];this[_0xf7f3('0x3e')]=_0x44f770[_0xf7f3('0x3e')];this['originated']=_0x44f770[_0xf7f3('0x7')];this[_0xf7f3('0x8')]=_0x44f770[_0xf7f3('0x8')];this[_0xf7f3('0x9')]=_0x44f770['outboundAnswerCallsDay'];this[_0xf7f3('0xa')]=_0x44f770[_0xf7f3('0xa')];this['outboundBusyCallsDay']=_0x44f770[_0xf7f3('0xb')];this[_0xf7f3('0xc')]=_0x44f770[_0xf7f3('0xc')];this['outboundNoAnswerCallsDay']=_0x44f770[_0xf7f3('0xd')];this[_0xf7f3('0x50')]=_0x44f770[_0xf7f3('0x50')];this[_0xf7f3('0xe')]=_0x44f770['outboundReCallsDay'];this[_0xf7f3('0xf')]=_0x44f770[_0xf7f3('0xf')];this[_0xf7f3('0x10')]=_0x44f770[_0xf7f3('0x10')];this[_0xf7f3('0x1b')]=_0x44f770['sumBillable'];this[_0xf7f3('0x1c')]=_0x44f770[_0xf7f3('0x1c')];this['total']=_0x44f770[_0xf7f3('0x12')];if(this[_0xf7f3('0x24')]===_0xf7f3('0x51')){this[_0xf7f3('0x11')]=_0x44f770[_0xf7f3('0x11')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 894a0b9..dc349d2 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 _0xb54e=['exports','username','accessKey','serverUrl','Configurations'];(function(_0x44b249,_0x5b4811){var _0x23b853=function(_0x3f90ef){while(--_0x3f90ef){_0x44b249['push'](_0x44b249['shift']());}};_0x23b853(++_0x5b4811);}(_0xb54e,0xec));var _0xeb54=function(_0x23a7f5,_0x490f8a){_0x23a7f5=_0x23a7f5-0x0;var _0x1ac0d3=_0xb54e[_0x23a7f5];return _0x1ac0d3;};'use strict';function VtigerAccount(_0x213f1d){this['id']=_0x213f1d['id']||0x0;this['name']=_0x213f1d['name']||'';this[_0xeb54('0x0')]=_0x213f1d[_0xeb54('0x0')]||'';this[_0xeb54('0x1')]=_0x213f1d['accessKey']||'';this['remoteUri']=_0x213f1d['remoteUri']||'';this[_0xeb54('0x2')]=_0x213f1d[_0xeb54('0x2')]||'';this[_0xeb54('0x3')]=_0x213f1d[_0xeb54('0x3')]||{};}module[_0xeb54('0x4')]=VtigerAccount; \ No newline at end of file +var _0x4661=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x14ae8a,_0x4782e6){var _0x404bc9=function(_0x37ae1e){while(--_0x37ae1e){_0x14ae8a['push'](_0x14ae8a['shift']());}};_0x404bc9(++_0x4782e6);}(_0x4661,0xec));var _0x1466=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4661[_0x27af45];return _0x18df21;};'use strict';function VtigerAccount(_0x1a4a95){this['id']=_0x1a4a95['id']||0x0;this[_0x1466('0x0')]=_0x1a4a95['name']||'';this[_0x1466('0x1')]=_0x1a4a95[_0x1466('0x1')]||'';this['accessKey']=_0x1a4a95[_0x1466('0x2')]||'';this['remoteUri']=_0x1a4a95[_0x1466('0x3')]||'';this[_0x1466('0x4')]=_0x1a4a95[_0x1466('0x4')]||'';this[_0x1466('0x5')]=_0x1a4a95['Configurations']||{};}module[_0x1466('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index f244db9..e35a2f7 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 _0x04e6=['name','username','password','token','remoteUri','authType','type','integrationTab','Configurations','exports'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x04e6,0x6e));var _0x604e=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x04e6[_0x175a55];return _0x167adf;};'use strict';function ZendeskAccount(_0x37449c){this['id']=_0x37449c['id']||0x0;this[_0x604e('0x0')]=_0x37449c[_0x604e('0x0')]||'';this[_0x604e('0x1')]=_0x37449c[_0x604e('0x1')]||'';this[_0x604e('0x2')]=_0x37449c[_0x604e('0x2')]||'';this[_0x604e('0x3')]=_0x37449c[_0x604e('0x3')]||'';this[_0x604e('0x4')]=_0x37449c[_0x604e('0x4')]||'';this[_0x604e('0x5')]=_0x37449c['authType']||'';this[_0x604e('0x6')]=_0x37449c[_0x604e('0x6')]||_0x604e('0x7');this['serverUrl']=_0x37449c['serverUrl']||'';this['Configurations']=_0x37449c[_0x604e('0x8')]||{};}module[_0x604e('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xf463=['password','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x22fefb,_0x105065){var _0x49a5e0=function(_0x11b61a){while(--_0x11b61a){_0x22fefb['push'](_0x22fefb['shift']());}};_0x49a5e0(++_0x105065);}(_0xf463,0x1ca));var _0x3f46=function(_0x58bbf9,_0x27dec7){_0x58bbf9=_0x58bbf9-0x0;var _0x2f338f=_0xf463[_0x58bbf9];return _0x2f338f;};'use strict';function ZendeskAccount(_0x209069){this['id']=_0x209069['id']||0x0;this['name']=_0x209069[_0x3f46('0x0')]||'';this[_0x3f46('0x1')]=_0x209069[_0x3f46('0x1')]||'';this[_0x3f46('0x2')]=_0x209069[_0x3f46('0x2')]||'';this['token']=_0x209069['token']||'';this[_0x3f46('0x3')]=_0x209069[_0x3f46('0x3')]||'';this['authType']=_0x209069[_0x3f46('0x4')]||'';this[_0x3f46('0x5')]=_0x209069['type']||_0x3f46('0x6');this[_0x3f46('0x7')]=_0x209069[_0x3f46('0x7')]||'';this[_0x3f46('0x8')]=_0x209069[_0x3f46('0x8')]||{};}module[_0x3f46('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 5ecf793..fd71eb2 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 _0x1b7a=['name','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x5f2b5f,_0x491ae4){var _0x44ffe0=function(_0x1d88a5){while(--_0x1d88a5){_0x5f2b5f['push'](_0x5f2b5f['shift']());}};_0x44ffe0(++_0x491ae4);}(_0x1b7a,0xd2));var _0xa1b7=function(_0x4648a5,_0x37fcd4){_0x4648a5=_0x4648a5-0x0;var _0x571b08=_0x1b7a[_0x4648a5];return _0x571b08;};'use strict';function ZohoAccount(_0x5a9de3){this['id']=_0x5a9de3['id']||0x0;this[_0xa1b7('0x0')]=_0x5a9de3['name']||'';this['description']=_0x5a9de3['description']||'';this[_0xa1b7('0x1')]=_0x5a9de3['host']||'';this[_0xa1b7('0x2')]=_0x5a9de3[_0xa1b7('0x2')]||'';this['clientId']=_0x5a9de3[_0xa1b7('0x3')]||'';this[_0xa1b7('0x4')]=_0x5a9de3['clientSecret']||'';this['serverUrl']=_0x5a9de3[_0xa1b7('0x5')]||'';this[_0xa1b7('0x6')]=_0x5a9de3[_0xa1b7('0x6')]||'';this[_0xa1b7('0x7')]=_0x5a9de3[_0xa1b7('0x7')]||'';this[_0xa1b7('0x8')]=_0x5a9de3[_0xa1b7('0x8')]||{};}module[_0xa1b7('0x9')]=ZohoAccount; \ No newline at end of file +var _0x39a7=['zone','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x39a7,0xb1));var _0x739a=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x39a7[_0x53e3fa];return _0xe8584a;};'use strict';function ZohoAccount(_0x20389e){this['id']=_0x20389e['id']||0x0;this['name']=_0x20389e[_0x739a('0x0')]||'';this[_0x739a('0x1')]=_0x20389e[_0x739a('0x1')]||'';this[_0x739a('0x2')]=_0x20389e[_0x739a('0x2')]||'';this[_0x739a('0x3')]=_0x20389e[_0x739a('0x3')]||'';this['clientId']=_0x20389e['clientId']||'';this[_0x739a('0x4')]=_0x20389e[_0x739a('0x4')]||'';this[_0x739a('0x5')]=_0x20389e['serverUrl']||'';this['code']=_0x20389e[_0x739a('0x6')]||'';this[_0x739a('0x7')]=_0x20389e['refreshToken']||'';this[_0x739a('0x8')]=_0x20389e['Configurations']||{};}module[_0x739a('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 7ddffc9..3880fdc 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 _0xb016=['countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','type','campaigntype','queue','dialAnswer','Agent','name','membername','Contact','phone','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xb016,0x159));var _0x6b01=function(_0x3a7b48,_0x16bb02){_0x3a7b48=_0x3a7b48-0x0;var _0x16e6c1=_0xb016[_0x3a7b48];return _0x16e6c1;};'use strict';var util=require(_0x6b01('0x0'));var _=require(_0x6b01('0x1'));var moment=require('moment');function checkNameSurname(_0x57ecae,_0xf74fa1,_0x531b6a){var _0x160a7d='';if(!_[_0x6b01('0x2')](_0xf74fa1)&&_0x6b01('0x3')===typeof _0xf74fa1){_0x160a7d+=_0xf74fa1;}if(!_[_0x6b01('0x2')](_0x531b6a)&&'string'===typeof _0x531b6a){_0x160a7d+='\x20'+_0x531b6a;}if(_0x160a7d!==''){return _0x160a7d;}return _0x57ecae;}function Action(_0x1b7dd6,_0x65407a,_0x192b2d,_0x5759a1,_0x5c5bfb){this[_0x6b01('0x4')]=_0x192b2d||undefined;this[_0x6b01('0x5')]=_0x1b7dd6['id'];this['queue']=_0x65407a['name'];this[_0x6b01('0x6')]=_0x65407a[_0x6b01('0x6')];this[_0x6b01('0x7')]=_0x6b01('0x8');this[_0x6b01('0x9')]=![];this['membername']=_['isNil'](_0x1b7dd6[_0x6b01('0xa')])?undefined:_0x1b7dd6[_0x6b01('0xa')][_0x6b01('0xb')];this['channelAgent']=this[_0x6b01('0xc')]?util['format']('SIP/%s',this[_0x6b01('0xc')]):_0x5759a1||undefined;this['calleridname']=checkNameSurname(_0x1b7dd6[_0x6b01('0xd')][_0x6b01('0xe')],_0x1b7dd6['Contact'][_0x6b01('0xf')],_0x1b7dd6['Contact']['lastName']);this['active']=_0x1b7dd6[_0x6b01('0x10')]||![];this['calleridnum']=_0x1b7dd6['phone'];this[_0x6b01('0x11')]=_0x1b7dd6[_0x6b01('0x11')];this[_0x6b01('0x12')]=_0x1b7dd6[_0x6b01('0x12')]||0x0;this[_0x6b01('0x13')]=_0x1b7dd6[_0x6b01('0x13')]||0x0;this[_0x6b01('0x14')]=_0x1b7dd6[_0x6b01('0x14')]||0x0;this[_0x6b01('0x15')]=(_0x1b7dd6[_0x6b01('0x12')]||0x0)+(_0x1b7dd6[_0x6b01('0x13')]||0x0)+(_0x1b7dd6['countnoanswerretry']||0x0)+(_0x1b7dd6[_0x6b01('0x16')]||0x0)+(_0x1b7dd6[_0x6b01('0x17')]||0x0)+(_0x1b7dd6[_0x6b01('0x18')]||0x0)+(_0x1b7dd6[_0x6b01('0x19')]||0x0)+(_0x1b7dd6[_0x6b01('0x1a')]||0x0);this[_0x6b01('0x16')]=_0x1b7dd6[_0x6b01('0x16')]||0x0;this[_0x6b01('0x17')]=_0x1b7dd6['countdropretry']||0x0;this[_0x6b01('0x18')]=_0x1b7dd6[_0x6b01('0x18')]||0x0;this[_0x6b01('0x19')]=_0x1b7dd6[_0x6b01('0x19')]||0x0;this[_0x6b01('0x1a')]=_0x1b7dd6[_0x6b01('0x1a')]||0x0;this[_0x6b01('0x1b')]=_0x1b7dd6['callback'];this[_0x6b01('0x1c')]=_0x1b7dd6[_0x6b01('0x1c')];this[_0x6b01('0x1d')]=_0x1b7dd6['callbackat'];this[_0x6b01('0x1e')]=_0x1b7dd6[_0x6b01('0x1e')];this[_0x6b01('0x1f')]=_0x1b7dd6[_0x6b01('0x1f')];this[_0x6b01('0x20')]=_0x1b7dd6[_0x6b01('0x20')];this[_0x6b01('0x21')]=_[_0x6b01('0x2')](_0x1b7dd6[_0x6b01('0xa')])?_0x1b7dd6[_0x6b01('0x21')]:_0x1b7dd6[_0x6b01('0xa')]['id'];this[_0x6b01('0x22')]=_0x1b7dd6[_0x6b01('0x22')];this['originatecalleridnum']='';this[_0x6b01('0x23')]='';}Action[_0x6b01('0x24')][_0x6b01('0x25')]=function(){return util[_0x6b01('0x26')](_0x6b01('0x27'),this['calleridname'],this['number']);};module[_0x6b01('0x28')]=Action; \ No newline at end of file +var _0x57ca=['name','type','campaigntype','dialAnswer','Agent','membername','format','SIP/%s','calleridname','phone','firstName','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0xf915ef,_0x243c60){var _0xa5ed6e=function(_0x4ce19d){while(--_0x4ce19d){_0xf915ef['push'](_0xf915ef['shift']());}};_0xa5ed6e(++_0x243c60);}(_0x57ca,0x108));var _0xa57c=function(_0x5b1de0,_0x5af2b2){_0x5b1de0=_0x5b1de0-0x0;var _0x698a86=_0x57ca[_0x5b1de0];return _0x698a86;};'use strict';var util=require('util');var _=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));function checkNameSurname(_0x4b1712,_0x3a7394,_0x396613){var _0x1d38e7='';if(!_[_0xa57c('0x2')](_0x3a7394)&&_0xa57c('0x3')===typeof _0x3a7394){_0x1d38e7+=_0x3a7394;}if(!_['isNil'](_0x396613)&&_0xa57c('0x3')===typeof _0x396613){_0x1d38e7+='\x20'+_0x396613;}if(_0x1d38e7!==''){return _0x1d38e7;}return _0x4b1712;}function Action(_0x1c3e31,_0x113dcf,_0x19473f,_0xbdfffb,_0x314574){this[_0xa57c('0x4')]=_0x19473f||undefined;this[_0xa57c('0x5')]=_0x1c3e31['id'];this['queue']=_0x113dcf[_0xa57c('0x6')];this['type']=_0x113dcf[_0xa57c('0x7')];this[_0xa57c('0x8')]='queue';this[_0xa57c('0x9')]=![];this['membername']=_[_0xa57c('0x2')](_0x1c3e31[_0xa57c('0xa')])?undefined:_0x1c3e31['Agent'][_0xa57c('0x6')];this['channelAgent']=this[_0xa57c('0xb')]?util[_0xa57c('0xc')](_0xa57c('0xd'),this[_0xa57c('0xb')]):_0xbdfffb||undefined;this[_0xa57c('0xe')]=checkNameSurname(_0x1c3e31['Contact'][_0xa57c('0xf')],_0x1c3e31['Contact'][_0xa57c('0x10')],_0x1c3e31[_0xa57c('0x11')][_0xa57c('0x12')]);this[_0xa57c('0x13')]=_0x1c3e31[_0xa57c('0x13')]||![];this[_0xa57c('0x14')]=_0x1c3e31[_0xa57c('0xf')];this['scheduledat']=_0x1c3e31[_0xa57c('0x15')];this[_0xa57c('0x16')]=_0x1c3e31[_0xa57c('0x16')]||0x0;this['countcongestionretry']=_0x1c3e31[_0xa57c('0x17')]||0x0;this['countnoanswerretry']=_0x1c3e31[_0xa57c('0x18')]||0x0;this[_0xa57c('0x19')]=(_0x1c3e31[_0xa57c('0x16')]||0x0)+(_0x1c3e31[_0xa57c('0x17')]||0x0)+(_0x1c3e31[_0xa57c('0x18')]||0x0)+(_0x1c3e31[_0xa57c('0x1a')]||0x0)+(_0x1c3e31[_0xa57c('0x1b')]||0x0)+(_0x1c3e31[_0xa57c('0x1c')]||0x0)+(_0x1c3e31['countmachineretry']||0x0)+(_0x1c3e31[_0xa57c('0x1d')]||0x0);this['countnosuchnumberretry']=_0x1c3e31['countnosuchnumberretry']||0x0;this[_0xa57c('0x1b')]=_0x1c3e31[_0xa57c('0x1b')]||0x0;this[_0xa57c('0x1c')]=_0x1c3e31[_0xa57c('0x1c')]||0x0;this['countmachineretry']=_0x1c3e31[_0xa57c('0x1e')]||0x0;this[_0xa57c('0x1d')]=_0x1c3e31[_0xa57c('0x1d')]||0x0;this[_0xa57c('0x1f')]=_0x1c3e31[_0xa57c('0x1f')];this[_0xa57c('0x20')]=_0x1c3e31[_0xa57c('0x20')];this[_0xa57c('0x21')]=_0x1c3e31[_0xa57c('0x21')];this[_0xa57c('0x22')]=_0x1c3e31[_0xa57c('0x22')];this[_0xa57c('0x23')]=_0x1c3e31[_0xa57c('0x23')];this[_0xa57c('0x24')]=_0x1c3e31[_0xa57c('0x24')];this['UserId']=_[_0xa57c('0x2')](_0x1c3e31[_0xa57c('0xa')])?_0x1c3e31[_0xa57c('0x25')]:_0x1c3e31[_0xa57c('0xa')]['id'];this[_0xa57c('0x26')]=_0x1c3e31[_0xa57c('0x26')];this[_0xa57c('0x27')]='';this[_0xa57c('0x28')]='';}Action[_0xa57c('0x29')][_0xa57c('0x2a')]=function(){return util['format'](_0xa57c('0x2b'),this['calleridname'],this['number']);};module[_0xa57c('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5b4010f..19a8bb5 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 _0xf644=['additional','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','status','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','assign','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','OriginateError','syncOriginateResponse','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','defaults','redis','localhost','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','bind','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','available','paused','message','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','campaignsPreview','hasOwnProperty','dialMethod','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','TrunkBackup','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','custom:agentConnectPreview','custom:agentcomplete','outboundAnswerCallsDay','total','answered','[16]','Answer','crateCustomerReportQueue','sumDuration','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','busy'];(function(_0x441a8b,_0x4c6cc9){var _0x367ac5=function(_0x494a5b){while(--_0x494a5b){_0x441a8b['push'](_0x441a8b['shift']());}};_0x367ac5(++_0x4c6cc9);}(_0xf644,0x1eb));var _0x4f64=function(_0x72addc,_0x1d8928){_0x72addc=_0x72addc-0x0;var _0x59e938=_0xf644[_0x72addc];return _0x59e938;};'use strict';var util=require(_0x4f64('0x0'));var _=require(_0x4f64('0x1'));var uuid=require(_0x4f64('0x2'));var moment=require('moment');var Redis=require(_0x4f64('0x3'));var config=require(_0x4f64('0x4'));var logger=require(_0x4f64('0x5'))(_0x4f64('0x6'));var loggerAction=require(_0x4f64('0x5'))(_0x4f64('0x7'));var ami=require(_0x4f64('0x8'));var rpcDb=require(_0x4f64('0x9'));var cmHopperAdditionalPhone=require(_0x4f64('0xa'));var Action=require('./action');var ut=require(_0x4f64('0xb'));var utils=require('../dialer/utils');config['redis']=_[_0x4f64('0xc')](config[_0x4f64('0xd')],{'host':_0x4f64('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f64('0xd')]));var Sequence=function(){};Sequence[_0x4f64('0xf')][_0x4f64('0x10')]=function(_0x245728){this[_0x4f64('0x11')]=this[_0x4f64('0x11')]?this[_0x4f64('0x11')][_0x4f64('0x12')](_0x245728):_0x245728();};function Preview(_0x142169){this[_0x4f64('0x13')]=new Sequence();this['campaignsPreview']=_0x142169[_0x4f64('0x14')];this['trunks']=_0x142169[_0x4f64('0x15')];this['actions']={};this[_0x4f64('0x16')]=_0x142169[_0x4f64('0x16')];this[_0x4f64('0x17')]=0x0;ami['on'](_0x4f64('0x18'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x4f64('0x19'),this[_0x4f64('0x1a')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x4f64('0x1b')](this));ami['on'](_0x4f64('0x1c'),this[_0x4f64('0x1d')][_0x4f64('0x1b')](this));ami['on'](_0x4f64('0x1e'),this[_0x4f64('0x1f')][_0x4f64('0x1b')](this));ami['on']('varset',this[_0x4f64('0x20')][_0x4f64('0x1b')](this));ami['on'](_0x4f64('0x21'),this[_0x4f64('0x22')]['bind'](this));ami['on'](_0x4f64('0x23'),this[_0x4f64('0x24')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x2d6e95,_0x53071c,_0xb604fb){io['to'](_0x2d6e95)[_0x4f64('0x25')](_0x53071c,_0xb604fb);}function emitVoiceQueueChannelRemove(_0x1a9fc3){logger[_0x4f64('0x26')](_0x4f64('0x27'),JSON[_0x4f64('0x28')](_0x1a9fc3));emit(util[_0x4f64('0x29')]('voice:queue:%s',_0x1a9fc3['name']),'voice_queue_channel:remove',_0x1a9fc3);io[_0x4f64('0x25')](_0x4f64('0x2a'),_0x1a9fc3);}function notSendMessagesQueue(_0x1f878e){if(_0x1f878e['sendMessageOneNotActive']){if(_0x1f878e[_0x4f64('0x2b')]===0x0&&_0x1f878e[_0x4f64('0x2c')]===0x0){_0x1f878e[_0x4f64('0x2d')]=![];_0x1f878e[_0x4f64('0x2e')]=0x0;_0x1f878e[_0x4f64('0x2f')]=0x0;_0x1f878e[_0x4f64('0x30')]=utils['CAMPAIGN_STATUS'][_0x4f64('0x31')];ut[_0x4f64('0x32')](_0x4f64('0x33'),_0x1f878e[_0x4f64('0x34')]+_0x4f64('0x35'));}else{_0x1f878e[_0x4f64('0x30')]=utils[_0x4f64('0x36')][_0x4f64('0x37')];ut[_0x4f64('0x32')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1f878e[_0x4f64('0x34')]+_0x4f64('0x38'));}}}Preview[_0x4f64('0xf')]['loopCampaigns']=function(){var _0x1252c3=this;setInterval(function(){_0x1252c3[_0x4f64('0x39')]();},0x7cf);};Preview[_0x4f64('0xf')][_0x4f64('0x39')]=function(){var _0x39daeb=this[_0x4f64('0x3a')];this[_0x4f64('0x17')]+=0x1;for(var _0x576a77 in _0x39daeb){if(_0x39daeb[_0x4f64('0x3b')](_0x576a77)&&(_0x39daeb[_0x576a77][_0x4f64('0x3c')]===_0x4f64('0x6')||_0x39daeb[_0x576a77][_0x4f64('0x3c')]==='booked')&&_0x39daeb[_0x576a77]['type']===_0x4f64('0x3d')){if(this[_0x4f64('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x4f64('0x3e')]();}}if(_0x39daeb[_0x4f64('0x3b')](_0x576a77)&&_0x39daeb[_0x576a77]['dialMethod']===_0x4f64('0x6')&&_0x39daeb[_0x576a77]['type']===_0x4f64('0x3d')){if(_0x39daeb[_0x576a77][_0x4f64('0x3f')]){this[_0x4f64('0x40')](_0x39daeb[_0x576a77]);if(_0x39daeb[_0x576a77][_0x4f64('0x41')])this[_0x4f64('0x42')](_0x39daeb[_0x576a77]);}else{notSendMessagesQueue(_0x39daeb[_0x576a77]);}}}};Preview[_0x4f64('0xf')][_0x4f64('0x43')]=function(_0x1ef920){var _0x114f0a=this;this[_0x4f64('0x13')]['enqueue'](function(){if(!_[_0x4f64('0x44')](_0x114f0a['actions'][_0x1ef920])){loggerAction[_0x4f64('0x26')](_0x4f64('0x45'),_0x1ef920,_0x4f64('0x46'),_0x114f0a[_0x4f64('0x47')][_0x1ef920][_0x4f64('0x48')],_0x4f64('0x49'),JSON[_0x4f64('0x28')](_0x114f0a[_0x4f64('0x3a')][_0x114f0a['actions'][_0x1ef920]['queue']][_0x4f64('0x2b')]),_0x4f64('0x4a'),JSON[_0x4f64('0x28')](_0x114f0a[_0x4f64('0x3a')][_0x114f0a[_0x4f64('0x47')][_0x1ef920][_0x4f64('0x48')]]['pTalking']),JSON[_0x4f64('0x28')](_0x114f0a[_0x4f64('0x47')][_0x1ef920][_0x4f64('0x4b')]),JSON[_0x4f64('0x28')](_[_0x4f64('0x4c')](_0x114f0a[_0x4f64('0x47')][_0x1ef920],[_0x4f64('0x4d'),_0x4f64('0x4e'),_0x4f64('0x4f'),_0x4f64('0x50')])));return ami[_0x4f64('0x51')]({'action':'status','channel':_0x114f0a[_0x4f64('0x47')][_0x1ef920][_0x4f64('0x52')]})[_0x4f64('0x53')](function(_0x5eec9a){if(_0x5eec9a[_0x4f64('0x30')]===_0x4f64('0x54')){setTimeout(function(){if(_0x114f0a[_0x4f64('0x47')][_0x1ef920]){ut['updateOriginated'](_0x114f0a['campaignsPreview'][_0x114f0a[_0x4f64('0x47')][_0x1ef920][_0x4f64('0x48')]],_0x4f64('0x55'));if(_0x114f0a[_0x4f64('0x47')][_0x1ef920]['dialAnswer']===!![]){ut[_0x4f64('0x56')](_0x114f0a[_0x4f64('0x3a')][_0x114f0a[_0x4f64('0x47')][_0x1ef920][_0x4f64('0x48')]],_0x4f64('0x55'));ut[_0x4f64('0x57')](_0x4f64('0x58')+_0x1ef920,_0x114f0a[_0x4f64('0x47')][_0x1ef920][_0x4f64('0x48')]);}ut['loggerError'](_0x4f64('0x59')+_0x1ef920,_0x114f0a['actions'][_0x1ef920][_0x4f64('0x48')]);delete _0x114f0a[_0x4f64('0x47')][_0x1ef920];}},0x2328);}});}});};Preview[_0x4f64('0xf')][_0x4f64('0x3e')]=function(){var _0x20fd9c=this;loggerAction[_0x4f64('0x26')](_0x4f64('0x5a'),_[_0x4f64('0x5b')](this[_0x4f64('0x47')]));for(var _0xd5a4b1 in this[_0x4f64('0x47')]){if(_0x20fd9c[_0x4f64('0x47')]['hasOwnProperty'](_0xd5a4b1)){_0x20fd9c[_0x4f64('0x43')](_0xd5a4b1);}}};Preview[_0x4f64('0xf')][_0x4f64('0x42')]=function(_0xd658c1){var _0x293a9f=this;rpcDb[_0x4f64('0x5c')](_0xd658c1['id'],ut[_0x4f64('0x5d')](this[_0x4f64('0x16')]))[_0x4f64('0x5e')](function(_0x53bf69){if(!_[_0x4f64('0x44')](_0x53bf69)){for(var _0x272086=0x0;_0x272086<_0x53bf69[_0x4f64('0x5f')];_0x272086+=0x1){if(ut[_0x4f64('0x60')](_0x53bf69[_0x272086]['scheduledat'])<_0xd658c1[_0x4f64('0x61')]*0x3c){if(_0x53bf69[_0x272086][_0x4f64('0x62')]&&!_0x53bf69[_0x272086]['Agent']['voicePause']){_0x293a9f[_0x4f64('0x63')](_0x53bf69[_0x272086]['id'])[_0x4f64('0x5e')](ut['logger2']('[RecallMe]'))['catch'](ut[_0x4f64('0x64')](_0x4f64('0x65')));}else{rpcDb[_0x4f64('0x66')](_0x53bf69[_0x272086]['id']);}}else{var _0x2c3677=new Action(_0x53bf69[_0x272086],_0xd658c1);_0x2c3677['starttime']=moment()[_0x4f64('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0xd658c1[_0x4f64('0x67')]+=0x1;ut[_0x4f64('0x68')](_0x2c3677,0x17,_0x4f64('0x69'));if(_0xd658c1['dialRecallInQueue']){rpcDb[_0x4f64('0x6a')](ut[_0x4f64('0x6b')](_0x53bf69[_0x272086]));rpcDb['createCustomerHistory'](_0x2c3677,_0x4f64('0x6c'));}else{ut[_0x4f64('0x68')](_0x2c3677,0x16,_0x4f64('0x6d'));rpcDb[_0x4f64('0x6e')](_0x2c3677,_0x4f64('0x6f'));rpcDb['createCustomerFinal'](_0x2c3677,_0x4f64('0x6f'));}}}}})[_0x4f64('0x53')](ut[_0x4f64('0x64')]('[getContactRecallMe]'));};Preview[_0x4f64('0xf')][_0x4f64('0x40')]=function(_0x56443a){_0x56443a['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x56443a[_0x4f64('0x70')])){_0x56443a[_0x4f64('0x30')]=utils[_0x4f64('0x36')][_0x4f64('0x71')];}else if(!ut[_0x4f64('0x72')](_0x56443a[_0x4f64('0x3f')])){_0x56443a[_0x4f64('0x30')]=utils[_0x4f64('0x36')][_0x4f64('0x31')];}else if(!this[_0x4f64('0x73')](_0x56443a['Trunk'])){if(!this[_0x4f64('0x73')](_0x56443a[_0x4f64('0x74')])){_0x56443a[_0x4f64('0x30')]=utils[_0x4f64('0x36')]['UNREACHABLE_TRUNK'];}else{_0x56443a[_0x4f64('0x30')]=utils[_0x4f64('0x36')]['ACTIVE'];}}else{_0x56443a['message']=utils[_0x4f64('0x36')]['ACTIVE'];}};Preview['prototype'][_0x4f64('0x75')]=function(_0x5438e1,_0x22c70d,_0x32caf9){var _0x1f5109=this;var _0x35d0ac=this[_0x4f64('0x47')][_0x22c70d];var _0x374749=this[_0x4f64('0x3a')][_0x35d0ac['queue']];var _0x7b2558;var _0x4608e0=![];var _0x4b73f5=0x2;var _0x2a4448=0x3;if(_0x374749){switch(_0x32caf9){case'1':_0x374749[_0x4f64('0x76')]+=0x1;_0x35d0ac['countnosuchnumberretry']+=0x1;_0x35d0ac[_0x4f64('0x77')]=ut['totalGlobal'](_0x35d0ac);ut['logCustomer'](_0x35d0ac,0x0,'NoSuchNumber');ami[_0x4f64('0x25')](_0x4f64('0x78'),ut[_0x4f64('0x79')](_0x35d0ac,_0x4f64('0x7a')));rpcDb[_0x4f64('0x6e')](_0x35d0ac,_0x4f64('0x7b'));_0x1f5109[_0x4f64('0x7c')](_0x35d0ac,'0',_0x374749)[_0x4f64('0x5e')](function(_0x25d854){_0x4608e0=_0x25d854['additional']==0x1;_0x4b73f5=_0x374749[_0x4f64('0x7d')];_0x2a4448=_0x374749[_0x4f64('0x7e')];if(!_0x4608e0){if(ut[_0x4f64('0x7f')](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut['cloneAction'](_0x35d0ac,0xf,_0x4f64('0x81'));rpcDb[_0x4f64('0x82')](_0x7b2558,_0x4f64('0x83'));}else{if(_0x35d0ac[_0x4f64('0x84')]>=_0x374749[_0x4f64('0x85')]){rpcDb[_0x4f64('0x82')](_0x35d0ac,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x4f64('0x86')](ut[_0x4f64('0x87')](_0x35d0ac,_0x4f64('0x84'),_0x374749[_0x4f64('0x7d')]),_0x35d0ac[_0x4f64('0x88')],_0x35d0ac[_0x4f64('0x89')]);}}delete this[_0x4f64('0x47')][_0x5438e1[_0x4f64('0x8a')]];}else{_0x35d0ac[_0x4f64('0x84')]++;logger[_0x4f64('0x26')]('actioncountonusuch',_0x35d0ac[_0x4f64('0x84')]);logger[_0x4f64('0x26')]('id',_0x35d0ac['idContact']);_0x1f5109[_0x4f64('0x8b')]({'id':_0x35d0ac[_0x4f64('0x8c')],'field':{'countnosuchnumberretry':_0x35d0ac[_0x4f64('0x84')]}})[_0x4f64('0x5e')](function(){_0x1f5109[_0x4f64('0x8d')](_0x35d0ac,_0x4b73f5,_0x2a4448)['then'](function(){});});}});break;case _0x4f64('0x8e'):var _0x3cdf31=moment()[_0x4f64('0x29')](_0x4f64('0x8f'));_0x35d0ac[_0x4f64('0x90')]=_0x3cdf31;_0x35d0ac[_0x4f64('0x91')]=_0x3cdf31;_0x35d0ac[_0x4f64('0x4b')]=!![];_0x374749['pTalking']+=0x1;logger[_0x4f64('0x26')](_0x4f64('0x92'),_0x35d0ac[_0x4f64('0x93')],'\x20Queue',_0x374749[_0x4f64('0x34')],'pTalking:\x20',_0x374749[_0x4f64('0x2c')]);ami[_0x4f64('0x25')](_0x4f64('0x94'),ut[_0x4f64('0x79')](_0x35d0ac,_0x4f64('0x95'),this[_0x4f64('0x3a')][_0x35d0ac[_0x4f64('0x48')]]));if(_0x374749['acw']){ami[_0x4f64('0x25')](_0x4f64('0x96'),ut['buildAcw'](_0x35d0ac));}break;case'16':ami['emit'](_0x4f64('0x97'),ut['buildObj'](_0x35d0ac,'complete',this[_0x4f64('0x3a')][_0x35d0ac[_0x4f64('0x48')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x35d0ac,'complete'));_0x374749[_0x4f64('0x98')]+=0x1;_0x374749[_0x4f64('0x99')]+=0x1;_0x374749[_0x4f64('0x9a')]+=0x1;ut[_0x4f64('0x56')](_0x374749,_0x4f64('0x9b'));_0x35d0ac['countglobal']=ut[_0x4f64('0x7f')](_0x35d0ac);ut[_0x4f64('0x68')](_0x35d0ac,0x4,_0x4f64('0x9c'));rpcDb[_0x4f64('0x6e')](_0x35d0ac,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x35d0ac,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x4f64('0x9d')](_0x35d0ac);_0x374749[_0x4f64('0x9e')]+=_0x35d0ac['talktime'];_0x374749[_0x4f64('0x9f')]+=_0x35d0ac['talktime'];logger['info'](_0x4f64('0xa0'),_0x35d0ac[_0x4f64('0x93')],_0x4f64('0xa1'),_0x374749[_0x4f64('0x34')],_0x4f64('0x4a'),_0x374749[_0x4f64('0x2c')]);delete this['actions'][_0x5438e1[_0x4f64('0x8a')]];break;case'BUSY':_0x374749[_0x4f64('0xa2')]+=0x1;_0x35d0ac[_0x4f64('0xa3')]+=0x1;_0x35d0ac[_0x4f64('0x77')]=ut[_0x4f64('0x7f')](_0x35d0ac);ut['logCustomer'](_0x35d0ac,0x5,_0x4f64('0xa4'));_0x4b73f5=_0x374749[_0x4f64('0xa5')];_0x2a4448=_0x374749[_0x4f64('0x7e')];ami[_0x4f64('0x25')]('custom:agentbusy',ut[_0x4f64('0x79')](_0x35d0ac,_0x4f64('0xa6')));rpcDb[_0x4f64('0x6e')](_0x35d0ac,'[callProgressDetectingCustomer][logBusy]');_0x1f5109[_0x4f64('0x7c')](_0x35d0ac,'5',_0x374749)[_0x4f64('0x5e')](function(_0x59a7dc){_0x4608e0=_0x59a7dc[_0x4f64('0xa7')]==0x1;if(!_0x4608e0){if(ut[_0x4f64('0x7f')](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut[_0x4f64('0xa8')](_0x35d0ac,0xf,_0x4f64('0x81'));rpcDb['createCustomerFinal'](_0x7b2558,_0x4f64('0xa9'));}else{if(_0x35d0ac[_0x4f64('0xa3')]>=_0x374749[_0x4f64('0xaa')]){rpcDb[_0x4f64('0x82')](_0x35d0ac,_0x4f64('0xab'));}else{rpcDb[_0x4f64('0x86')](ut[_0x4f64('0x87')](_0x35d0ac,_0x4f64('0xa3'),_0x374749[_0x4f64('0xa5')]),_0x35d0ac[_0x4f64('0x88')],_0x35d0ac[_0x4f64('0x89')]);}}}else{_0x35d0ac['countbusyretry']++;_0x1f5109[_0x4f64('0x8b')]({'id':_0x35d0ac[_0x4f64('0x8c')],'field':{'countbusyretry':_0x35d0ac['countbusyretry']}})['then'](function(){_0x1f5109[_0x4f64('0x8d')](_0x35d0ac,_0x4b73f5,_0x2a4448)[_0x4f64('0x5e')](function(){});});}});break;case _0x4f64('0xac'):_0x374749[_0x4f64('0xad')]+=0x1;_0x35d0ac[_0x4f64('0xae')]+=0x1;_0x35d0ac[_0x4f64('0x77')]=ut['totalGlobal'](_0x35d0ac);ut['logCustomer'](_0x35d0ac,0x3,'NoAnswer');_0x4b73f5=_0x374749[_0x4f64('0xaf')];_0x2a4448=_0x374749[_0x4f64('0x7e')];var _0xdb1f95=ut[_0x4f64('0xb0')](_0x35d0ac,_0x374749);ami[_0x4f64('0x25')](_0x4f64('0xb1'),_0xdb1f95);rpcDb[_0x4f64('0x6e')](_0x35d0ac,'[callProgressDetectingCustomer][logNoAnswer]');_0x1f5109[_0x4f64('0x7c')](_0x35d0ac,'3',_0x374749)['then'](function(_0x5aa428){_0x4608e0=_0x5aa428[_0x4f64('0xa7')]==0x1;if(!_0x4608e0){if(ut[_0x4f64('0x7f')](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut[_0x4f64('0xa8')](_0x35d0ac,0xf,_0x4f64('0x81'));rpcDb['createCustomerFinal'](_0x7b2558,_0x4f64('0xb2'));}else{if(_0x35d0ac[_0x4f64('0xae')]>=_0x374749[_0x4f64('0xb3')]){rpcDb[_0x4f64('0x82')](_0x35d0ac,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x4f64('0x87')](_0x35d0ac,_0x4f64('0xae'),_0x374749[_0x4f64('0xaf')]),_0x35d0ac[_0x4f64('0x88')],_0x35d0ac[_0x4f64('0x89')]);}}}else{_0x35d0ac['countnoanswerretry']++;_0x1f5109[_0x4f64('0x8b')]({'id':_0x35d0ac[_0x4f64('0x8c')],'field':{'countnoanswerretry':_0x35d0ac[_0x4f64('0xae')]}})[_0x4f64('0x5e')](function(){_0x1f5109['swapAdditionalPhones'](_0x35d0ac,_0x4b73f5,_0x2a4448)['then'](function(){});});}});break;case _0x4f64('0xb4'):_0x374749[_0x4f64('0xb5')]+=0x1;_0x35d0ac['countcongestionretry']+=0x1;_0x35d0ac['countglobal']=ut['totalGlobal'](_0x35d0ac);ut['logCustomer'](_0x35d0ac,0x8,_0x4f64('0xb6'));_0x4b73f5=_0x374749['dialCongestionRetryFrequency'];_0x2a4448=_0x374749[_0x4f64('0x7e')];ami[_0x4f64('0x25')]('custom:agentcongestion',ut[_0x4f64('0x79')](_0x35d0ac,_0x4f64('0xb7')));rpcDb['createCustomerHistory'](_0x35d0ac,_0x4f64('0xb8'));_0x1f5109[_0x4f64('0x7c')](_0x35d0ac,'8',_0x374749)['then'](function(_0x47d172){_0x4608e0=_0x47d172['additional']==0x1;if(!_0x4608e0){if(ut[_0x4f64('0x7f')](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut['cloneAction'](_0x35d0ac,0xf,'Global');rpcDb['createCustomerFinal'](_0x7b2558,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x35d0ac[_0x4f64('0xb9')]>=_0x374749[_0x4f64('0xba')]){rpcDb[_0x4f64('0x82')](_0x35d0ac,_0x4f64('0xb8'));}else{rpcDb[_0x4f64('0x86')](ut[_0x4f64('0x87')](_0x35d0ac,_0x4f64('0xb9'),_0x374749[_0x4f64('0xa5')]),_0x35d0ac[_0x4f64('0x88')],_0x35d0ac['activeContact']);}}}else{_0x35d0ac[_0x4f64('0xb9')]++;_0x1f5109[_0x4f64('0x8b')]({'id':_0x35d0ac[_0x4f64('0x8c')],'field':{'countcongestionretry':_0x35d0ac[_0x4f64('0xb9')]}})[_0x4f64('0x5e')](function(){_0x1f5109[_0x4f64('0x8d')](_0x35d0ac,_0x4b73f5,_0x2a4448)['then'](function(){});});}});break;case _0x4f64('0xbb'):_0x374749['outboundRejectCallsDay']+=0x1;_0x35d0ac[_0x4f64('0xbc')]+=0x1;_0x35d0ac[_0x4f64('0x77')]=ut[_0x4f64('0x7f')](_0x35d0ac);ut['logCustomer'](_0x35d0ac,0x14,_0x4f64('0xbd'));_0x4b73f5=_0x374749['dialAgentRejectRetryFrequency'];_0x2a4448=_0x374749[_0x4f64('0x7e')];ami[_0x4f64('0x25')](_0x4f64('0xbe'),ut[_0x4f64('0x79')](_0x35d0ac,'agentreject'));rpcDb[_0x4f64('0x6e')](_0x35d0ac,_0x4f64('0xbf'));_0x1f5109[_0x4f64('0x7c')](_0x35d0ac,'20',_0x374749)[_0x4f64('0x5e')](function(_0x137522){_0x4608e0=_0x137522[_0x4f64('0xa7')]==0x1;if(!_0x4608e0){if(ut['totalGlobal'](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut[_0x4f64('0xa8')](_0x35d0ac,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x7b2558,_0x4f64('0xc0'));}else{if(_0x35d0ac[_0x4f64('0xbc')]>=_0x374749[_0x4f64('0xc1')]){rpcDb[_0x4f64('0x82')](_0x35d0ac,_0x4f64('0xc0'));}else{rpcDb[_0x4f64('0x86')](ut[_0x4f64('0x87')](_0x35d0ac,_0x4f64('0xbc'),_0x374749[_0x4f64('0xc2')]),_0x35d0ac['unlockAgent'],_0x35d0ac[_0x4f64('0x89')]);}}}else{_0x35d0ac[_0x4f64('0xae')]++;_0x1f5109[_0x4f64('0x8b')]({'id':_0x35d0ac[_0x4f64('0x8c')],'field':{'countnoanswerretry':_0x35d0ac[_0x4f64('0xae')]}})[_0x4f64('0x5e')](function(){_0x1f5109[_0x4f64('0x8d')](_0x35d0ac,_0x4b73f5,_0x2a4448)[_0x4f64('0x5e')](function(){});});}});break;case _0x4f64('0xc3'):_0x374749[_0x4f64('0xc4')]+=0x1;_0x35d0ac['countabandonedretry']+=0x1;_0x35d0ac['countglobal']=ut[_0x4f64('0x7f')](_0x35d0ac);ut[_0x4f64('0x68')](_0x35d0ac,0xb,_0x4f64('0xc5'));rpcDb[_0x4f64('0x6e')](_0x35d0ac,_0x4f64('0xc6'));_0x1f5109[_0x4f64('0x7c')](_0x35d0ac,'11',_0x374749)[_0x4f64('0x5e')](function(_0x3d4234){_0x4608e0=_0x3d4234[_0x4f64('0xa7')]==0x1;if(!_0x4608e0){if(ut[_0x4f64('0x7f')](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut[_0x4f64('0xa8')](_0x35d0ac,0xf,_0x4f64('0x81'));rpcDb['createCustomerFinal'](_0x7b2558,_0x4f64('0xc6'));}else{if(_0x35d0ac[_0x4f64('0xc7')]>=_0x374749[_0x4f64('0xc8')]){rpcDb[_0x4f64('0x82')](_0x35d0ac,_0x4f64('0xc6'));}else{rpcDb[_0x4f64('0x86')](ut[_0x4f64('0x87')](_0x35d0ac,'countabandonedretry',_0x374749[_0x4f64('0xc9')]),_0x35d0ac[_0x4f64('0x88')],_0x35d0ac[_0x4f64('0x89')]);}}}else{_0x35d0ac[_0x4f64('0xae')]++;_0x1f5109[_0x4f64('0x8b')]({'id':_0x35d0ac[_0x4f64('0x8c')],'field':{'countnoanswerretry':_0x35d0ac[_0x4f64('0xae')]}})[_0x4f64('0x5e')](function(){_0x1f5109[_0x4f64('0x8d')](_0x35d0ac,_0x4b73f5,_0x2a4448)[_0x4f64('0x5e')](function(){});});}});break;case'18':_0x374749[_0x4f64('0xca')]+=0x1;_0x35d0ac[_0x4f64('0xcb')]+=0x1;_0x35d0ac[_0x4f64('0x77')]=ut[_0x4f64('0x7f')](_0x35d0ac);ut[_0x4f64('0x68')](_0x35d0ac,0x12,_0x5438e1['cause-txt']||_0x5438e1[_0x4f64('0xcc')]);ami[_0x4f64('0x25')]('custom:amd',ut['buildObj'](_0x35d0ac,_0x4f64('0xcd')));rpcDb['createCustomerHistory'](_0x35d0ac,'[callProgressDetectingCustomer][hangupInAMD]');_0x1f5109[_0x4f64('0x7c')](_0x35d0ac,'18',_0x374749)[_0x4f64('0x5e')](function(_0x26e15e){_0x4608e0=_0x26e15e[_0x4f64('0xa7')]==0x1;if(!_0x4608e0){if(ut[_0x4f64('0x7f')](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut[_0x4f64('0xa8')](_0x35d0ac,0x12,_0x4f64('0x81'));rpcDb[_0x4f64('0x82')](_0x7b2558,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x4f64('0x82')](_0x35d0ac,_0x4f64('0xce'));}}else{_0x35d0ac[_0x4f64('0xae')]++;_0x1f5109['incrementPreviewCounters']({'id':_0x35d0ac[_0x4f64('0x8c')],'field':{'countnoanswerretry':_0x35d0ac[_0x4f64('0xae')]}})[_0x4f64('0x5e')](function(){_0x1f5109['swapAdditionalPhones'](_0x35d0ac,_0x4b73f5,_0x2a4448)['then'](function(){});});}});delete this[_0x4f64('0x47')][_0x5438e1['linkedid']];break;case'19':_0x374749[_0x4f64('0xca')]+=0x1;_0x35d0ac[_0x4f64('0x77')]=ut[_0x4f64('0x7f')](_0x35d0ac);ut[_0x4f64('0x68')](_0x35d0ac,0x13,_0x5438e1[_0x4f64('0xcf')]||_0x5438e1['dialstatus']);ami[_0x4f64('0x25')](_0x4f64('0xd0'),ut[_0x4f64('0x79')](_0x35d0ac,'amd'));rpcDb[_0x4f64('0x6e')](_0x35d0ac,_0x4f64('0xd1'));_0x1f5109['verifyAdditionalPhones'](_0x35d0ac,'18',_0x374749)[_0x4f64('0x5e')](function(_0x171e6f){_0x4608e0=_0x171e6f[_0x4f64('0xa7')]==0x1;if(!_0x4608e0){if(ut[_0x4f64('0x7f')](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut[_0x4f64('0xa8')](_0x35d0ac,0xf,_0x4f64('0x81'));rpcDb[_0x4f64('0x82')](_0x7b2558,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x4f64('0x82')](_0x35d0ac,_0x4f64('0xd1'));}}else{_0x35d0ac[_0x4f64('0xae')]++;_0x1f5109[_0x4f64('0x8b')]({'id':_0x35d0ac['idContact'],'field':{'countnoanswerretry':_0x35d0ac['countnoanswerretry']}})[_0x4f64('0x5e')](function(){_0x1f5109[_0x4f64('0x8d')](_0x35d0ac,_0x4b73f5,_0x2a4448)[_0x4f64('0x5e')](function(){});});}});delete this[_0x4f64('0x47')][_0x5438e1['linkedid']];break;default:if(_0x35d0ac[_0x4f64('0x4b')]){ut[_0x4f64('0x56')](_0x374749,_0x4f64('0xd2'));ut[_0x4f64('0x57')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x374749[_0x4f64('0x34')],_0x5438e1);}_0x374749[_0x4f64('0xca')]+=0x1;_0x35d0ac[_0x4f64('0x77')]=ut[_0x4f64('0x7f')](_0x35d0ac);ut[_0x4f64('0x68')](_0x35d0ac,0xc,_0x5438e1[_0x4f64('0xcf')]||_0x5438e1[_0x4f64('0xcc')]);_0x4b73f5=_0x374749[_0x4f64('0xc2')];_0x2a4448=_0x374749[_0x4f64('0x7e')];rpcDb[_0x4f64('0x6e')](_0x35d0ac,_0x4f64('0xd3'));_0x1f5109[_0x4f64('0x7c')](_0x35d0ac,'20',_0x374749)['then'](function(_0x17695c){_0x4608e0=_0x17695c[_0x4f64('0xa7')]==0x1;if(!_0x4608e0){if(ut[_0x4f64('0x7f')](_0x35d0ac)>=_0x374749[_0x4f64('0x80')]){_0x7b2558=ut[_0x4f64('0xa8')](_0x35d0ac,0xf,'Global');rpcDb[_0x4f64('0x82')](_0x7b2558,_0x4f64('0xd4'));}else{rpcDb[_0x4f64('0x82')](_0x35d0ac,_0x4f64('0xd4'));}delete this[_0x4f64('0x47')][_0x5438e1['linkedid']];}else{_0x1f5109[_0x4f64('0x8d')](_0x35d0ac,_0x4b73f5,_0x2a4448)['then'](function(){});}});}if(!(_0x35d0ac[_0x4f64('0x4b')]&&_0x32caf9==='16')){ut[_0x4f64('0xd5')](_0x374749,_0x4f64('0xd6'));logger[_0x4f64('0x26')](_0x4f64('0xd7'),_0x35d0ac['uniqueid'],_0x4f64('0xa1'),_0x374749[_0x4f64('0x34')],_0x4f64('0x49'),_0x374749['originated']);}if(_0x32caf9!==_0x4f64('0x8e')){delete this[_0x4f64('0x47')][_0x5438e1['linkedid']];delete this[_0x4f64('0x47')][_0x5438e1[_0x4f64('0xd8')]];}_0x374749[_0x4f64('0xd9')]=!![];}};Preview[_0x4f64('0xf')][_0x4f64('0xda')]=function(_0x26c45d,_0x324190,_0x2e4e52){if(_['isUndefined'](_0x324190)&&_0x4f64('0xdb')!==typeof _0x324190){return;}if(_[_0x4f64('0xdc')](_0x2e4e52)&&_0x4f64('0xdb')!==typeof _0x2e4e52){return;}switch(_0x2e4e52['reason']){case'0':ut[_0x4f64('0xdd')](_0x26c45d,0x0,_0x4f64('0xde'));rpcDb[_0x4f64('0xdf')](_0x26c45d,_0x4f64('0xe0'));break;case'3':ut[_0x4f64('0xdd')](_0x26c45d,0x3,_0x4f64('0xe1'));rpcDb[_0x4f64('0xdf')](_0x26c45d,_0x4f64('0xe2'));break;case'5':ut[_0x4f64('0xdd')](_0x26c45d,0x5,'Busy');rpcDb[_0x4f64('0xdf')](_0x26c45d,_0x4f64('0xe3'));break;case'8':ut[_0x4f64('0xdd')](_0x26c45d,0x8,'Congestion');rpcDb[_0x4f64('0xdf')](_0x26c45d,_0x4f64('0xe4'));break;case'22':ut[_0x4f64('0xdd')](_0x26c45d,0x16,_0x4f64('0xe5'));rpcDb[_0x4f64('0xdf')](_0x26c45d,_0x4f64('0xe6'));break;default:ut['logAgent'](_0x26c45d,0xc,_0x2e4e52[_0x4f64('0xe7')]);rpcDb[_0x4f64('0xdf')](_0x26c45d,_0x4f64('0xe4'));}ut[_0x4f64('0xd5')](_0x324190,'[callProgressDetectingAgent]');logger['info'](_0x4f64('0xe8'),_0x26c45d['uniqueid'],_0x4f64('0xa1'),_0x324190[_0x4f64('0x34')],_0x4f64('0x49'),_0x324190['originated']);delete this['actions'][_0x26c45d[_0x4f64('0x93')]];};Preview[_0x4f64('0xf')][_0x4f64('0x7c')]=function(_0x3a8f0d,_0x6c48d4,_0x1595cf){return cmHopperAdditionalPhone[_0x4f64('0x7c')](_0x3a8f0d,_0x6c48d4,_0x1595cf)['catch'](logger[_0x4f64('0x26')](_0x4f64('0xe9')));};Preview[_0x4f64('0xf')]['swapAdditionalPhones']=function(_0x15f5b0,_0x353ff3,_0x3937e5){return cmHopperAdditionalPhone[_0x4f64('0x8d')](_0x15f5b0,_0x353ff3,_0x3937e5)[_0x4f64('0x53')](logger['info'](_0x4f64('0xea')));};Preview[_0x4f64('0xf')][_0x4f64('0x8b')]=function(_0x4ff735){return Promise[_0x4f64('0xeb')]()[_0x4f64('0x5e')](cmHopperAdditionalPhone[_0x4f64('0x8b')](_0x4ff735))[_0x4f64('0x53')](logger[_0x4f64('0x26')](_0x4f64('0xec')));};Preview[_0x4f64('0xf')][_0x4f64('0xed')]=function(_0x3c2b02,_0x41a090,_0x5ec683,_0x4606d9,_0x1b9429){var _0x1bb819=this;return new Promise(function(_0x39b3f9,_0x2e47db){if(_['isNil'](_0x41a090)||_['isNil'](_0x41a090[_0x4f64('0xee')])||_[_0x4f64('0x44')](_0x41a090[_0x4f64('0xef')])||_[_0x4f64('0x44')](_0x41a090[_0x4f64('0x4f')])){_0x2e47db(ut[_0x4f64('0x30')](_0x4f64('0xf0'),_0x4606d9,_0x1b9429));return;}var _0x407493=uuid['v4']();var _0x925f7c=_0x1bb819[_0x4f64('0x3a')][_0x41a090[_0x4f64('0x46')]['name']];var _0x13594d=_0x5ec683?_0x1bb819[_0x4f64('0x16')][_0x5ec683]['id']:undefined;_0x1bb819['actions'][_0x407493]=new Action(_0x41a090,_0x925f7c,_0x407493,_0x5ec683,_0x13594d);var _0x33bb7a=_0x1bb819['actions'][_0x407493];_0x33bb7a[_0x4f64('0x88')]=_0x4606d9;_0x33bb7a['activeContact']=_0x1b9429;_0x33bb7a['lookAgent']=_0x5ec683;if(_[_0x4f64('0xf1')](_0x3c2b02)){_0x1bb819[_0x4f64('0xf2')](_0x33bb7a,_0x925f7c,_0x41a090,_0x5ec683)[_0x4f64('0x5e')](function(_0x44b62b){logger[_0x4f64('0x26')](_0x4f64('0xf3'),_0x4f64('0xf4')+_0x33bb7a[_0x4f64('0x48')]+'\x20IdHopper:\x20'+_0x33bb7a[_0x4f64('0x8c')],JSON[_0x4f64('0x28')](_0x44b62b));ami[_0x4f64('0x25')](_0x4f64('0xf5'),ut[_0x4f64('0x79')](_0x33bb7a,_0x4f64('0xf6'),_0x1bb819[_0x4f64('0x3a')][_0x33bb7a[_0x4f64('0x48')]]));_0x39b3f9(ut['message'](_0x4f64('0xf7')));})[_0x4f64('0x53')](function(_0x555ba4){ut[_0x4f64('0x32')]('[Preview][execCall][failure]',_0x555ba4);_0x2e47db(ut[_0x4f64('0x30')](_0x4f64('0xf8'),_0x4606d9,_0x1b9429));});}else{_0x925f7c[_0x4f64('0xf9')]+=0x1;ut[_0x4f64('0xfa')](_0x33bb7a);rpcDb[_0x4f64('0xfb')](_0x33bb7a,_0x4f64('0xfc'));delete _0x1bb819[_0x4f64('0x47')][_0x407493];_0x2e47db(ut['message']('Contact\x20in\x20black\x20List',_0x4606d9,_0x1b9429));}});};Preview[_0x4f64('0xf')][_0x4f64('0x73')]=function(_0x389cff){return!_[_0x4f64('0x44')](_0x389cff)&&!_[_0x4f64('0x44')](_0x389cff['name'])&&!_['isNil'](_0x389cff[_0x4f64('0xfd')])&&_0x389cff[_0x4f64('0xfd')]&&!_[_0x4f64('0x44')](this['trunks'][util[_0x4f64('0x29')](_0x4f64('0xfe'),_0x389cff[_0x4f64('0x34')])])&&!_[_0x4f64('0x44')](this[_0x4f64('0x15')][util[_0x4f64('0x29')]('SIP/%s',_0x389cff[_0x4f64('0x34')])][_0x4f64('0xff')])&&(this[_0x4f64('0x15')][util[_0x4f64('0x29')]('SIP/%s',_0x389cff[_0x4f64('0x34')])][_0x4f64('0xff')]==='reachable'||this[_0x4f64('0x15')][util[_0x4f64('0x29')](_0x4f64('0xfe'),_0x389cff[_0x4f64('0x34')])][_0x4f64('0xff')]===_0x4f64('0x100'));};Preview['prototype'][_0x4f64('0x63')]=function(_0x3db4e5,_0x2c5274){return this['execRun'](_0x3db4e5,_0x2c5274)[_0x4f64('0x5e')](function(_0x28f5b3){return _['pick'](_0x28f5b3,[_0x4f64('0x30')]);})['catch'](function(_0x391f4a){if(_0x391f4a[_0x4f64('0x101')]){rpcDb[_0x4f64('0x102')](_0x3db4e5);}if(_0x391f4a[_0x4f64('0xfd')]){rpcDb[_0x4f64('0x66')](_0x3db4e5);}throw _[_0x4f64('0x4c')](_0x391f4a,[_0x4f64('0x30')]);});};Preview['prototype'][_0x4f64('0x103')]=function(_0xa84139,_0x37f755){var _0x1f4c4e=this;var _0x52f11e,_0x5bd383;return rpcDb[_0x4f64('0x104')](_0xa84139)['then'](function(_0x56c5fa){if(!_[_0x4f64('0x44')](_0x56c5fa[0x0])){_0x5bd383=_0x56c5fa[0x0][_0x4f64('0x105')]?![]:!![];_0x52f11e=_0x56c5fa[0x0][_0x4f64('0x105')]?!![]:![];_0x52f11e=_0x37f755?!![]:_0x52f11e;}var _0x13f07f=_0x1f4c4e[_0x4f64('0x106')](_0x56c5fa);if(_0x13f07f[_0x4f64('0x107')]){rpcDb[_0x4f64('0x108')](_['pick'](_0x56c5fa[0x0],[_0x4f64('0x4f'),_0x4f64('0xef')]))['then'](function(_0x5558ab){_0x1f4c4e[_0x4f64('0xed')](_0x5558ab,_0x56c5fa[0x0],_0x37f755,_0x5bd383,_0x52f11e)[_0x4f64('0x5e')](function(_0x276726){return _0x276726;})[_0x4f64('0x53')](function(_0x3c54ec){throw _0x3c54ec;});})['catch'](function(_0x454fd5){ut['logger'](_0x4f64('0x109'),_0x454fd5);throw ut[_0x4f64('0x30')](_0x4f64('0x10a'),_0x5bd383,_0x52f11e);});}else{throw ut['message'](_0x13f07f[_0x4f64('0x30')],_0x5bd383,_0x52f11e);}})[_0x4f64('0x53')](function(_0x58408a){ut[_0x4f64('0x32')](_0x4f64('0x10b'),_0x58408a);throw ut[_0x4f64('0x30')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x4f64('0xf')][_0x4f64('0x106')]=function(_0x17910e){if(_[_0x4f64('0x44')](_0x17910e)||_[_0x4f64('0xf1')](_0x17910e)||!_[_0x4f64('0x44')](_0x17910e[0x0][_0x4f64('0x62')])&&_[_0x4f64('0x44')](_0x17910e[0x0][_0x4f64('0x62')][_0x4f64('0x34')])){ut[_0x4f64('0x32')](_0x4f64('0x10c'),_0x17910e);return{'isValid':![],'message':_0x4f64('0x10d')};}var _0x560867=this[_0x4f64('0x3a')][_0x17910e[0x0][_0x4f64('0x46')][_0x4f64('0x34')]];_0x560867[_0x4f64('0x30')]=utils[_0x4f64('0x36')][_0x4f64('0x10e')];if(_[_0x4f64('0x44')](_0x560867)){ut[_0x4f64('0x32')](_0x4f64('0x10f'),_0x560867);return{'isValid':![],'message':_0x4f64('0x110')};}if(!this['isTrunkReachable'](_0x560867[_0x4f64('0x111')])){ut['logger'](_0x4f64('0x112'),_0x4f64('0x113')+_0x560867[_0x4f64('0x34')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x4f64('0x73')](_0x560867[_0x4f64('0x74')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x560867[_0x4f64('0x34')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x4f64('0x114')};}}if(!ut[_0x4f64('0x72')](_0x560867[_0x4f64('0x3f')])){ut[_0x4f64('0x32')](_0x4f64('0x115'),_0x560867[_0x4f64('0x34')]+_0x4f64('0x116'));return{'isValid':![],'message':_0x4f64('0x113')+_0x560867[_0x4f64('0x34')]+_0x4f64('0x116')};}return{'isValid':!![],'message':_0x4f64('0x117')};};Preview[_0x4f64('0xf')][_0x4f64('0xf2')]=function(_0x241fe8,_0x57a3f7,_0x28cf09,_0x730f7e){var _0x598e2f=this;return new Promise(function(_0x39704b,_0x1079b1){var _0x36eb99=_0x241fe8[_0x4f64('0x93')];var _0x4595bf=_0x598e2f[_0x4f64('0x73')](_0x57a3f7[_0x4f64('0x111')])?util[_0x4f64('0x29')]('SIP/%s/%s%s',_0x57a3f7[_0x4f64('0x111')][_0x4f64('0x34')],_[_0x4f64('0x44')](_0x57a3f7['dialPrefix'])?'':_0x57a3f7[_0x4f64('0x118')][_0x4f64('0x119')]()||'',_0x57a3f7['dialCutDigit']>0x0?_0x28cf09[_0x4f64('0xef')][_0x4f64('0x11a')](_0x57a3f7[_0x4f64('0x11b')]):_0x28cf09[_0x4f64('0xef')]):util['format'](_0x4f64('0x11c'),_[_0x4f64('0x44')](_0x57a3f7[_0x4f64('0x74')])?_0x57a3f7['Trunk'][_0x4f64('0x34')]:_0x57a3f7[_0x4f64('0x74')][_0x4f64('0x34')],_[_0x4f64('0x44')](_0x57a3f7[_0x4f64('0x118')])?'':_0x57a3f7['dialPrefix'][_0x4f64('0x119')]()||'',_0x57a3f7[_0x4f64('0x11b')]>0x0?_0x28cf09['phone'][_0x4f64('0x11a')](_0x57a3f7[_0x4f64('0x11b')]):_0x28cf09[_0x4f64('0xef')]);var _0x4e33e2=_0x598e2f[_0x4f64('0x73')](_0x57a3f7[_0x4f64('0x111')])?ut['getCallerId'](_0x57a3f7[_0x4f64('0x111')]['callerid'],_0x57a3f7[_0x4f64('0x11d')],_0x57a3f7[_0x4f64('0x11e')]>0x0?ut[_0x4f64('0x11f')](_0x57a3f7[_0x4f64('0x120')],_0x57a3f7[_0x4f64('0x11e')]):_0x57a3f7['dialOriginateCallerIdNumber']):ut['getCallerId'](_['isNil'](_0x57a3f7[_0x4f64('0x74')])?_0x57a3f7['Trunk'][_0x4f64('0x121')]:_0x57a3f7[_0x4f64('0x74')][_0x4f64('0x121')],_0x57a3f7[_0x4f64('0x11d')],_0x57a3f7[_0x4f64('0x11e')]>0x0?ut[_0x4f64('0x11f')](_0x57a3f7[_0x4f64('0x120')],_0x57a3f7['dialRandomLastDigitCallerIdNumber']):_0x57a3f7[_0x4f64('0x120')]);if(_0x4e33e2){_0x241fe8[_0x4f64('0x122')]=ut[_0x4f64('0x123')](_0x4e33e2);_0x241fe8[_0x4f64('0x124')]=ut[_0x4f64('0x125')](_0x4e33e2);}var _0xb41efc=ut[_0x4f64('0x126')](_0x57a3f7,_0x28cf09,_0x4595bf,_0x4e33e2,_0x36eb99,_0x241fe8);var _0x29cea7=utils['setXMDContactVariables'](_0x28cf09[_0x4f64('0xee')]);Object[_0x4f64('0x127')](_0xb41efc,_0x29cea7);_['merge'](_0x241fe8,ut[_0x4f64('0x128')](_0xb41efc));_0x241fe8[_0x4f64('0x129')]=moment()[_0x4f64('0x29')](_0x4f64('0x8f'));_0x57a3f7[_0x4f64('0x12a')]=_0xb41efc;var _0x108658=ut[_0x4f64('0x12b')](_0x241fe8,_0x57a3f7,_0xb41efc,_0x241fe8['activeContact'],_0x730f7e);return ami[_0x4f64('0x51')](_0x108658)[_0x4f64('0x5e')](function(_0x33f99a){_0x57a3f7[_0x4f64('0x2b')]+=0x1;logger['info'](_0x4f64('0x12c'),_0x36eb99,'\x20Queue',_0x57a3f7[_0x4f64('0x34')],'originated:\x20',_0x57a3f7[_0x4f64('0x2b')]);_0x39704b(_0x33f99a);})['catch'](function(_0x2e58f2){ut[_0x4f64('0xdd')](_0x241fe8,0xe,_0x4f64('0x12d'));rpcDb['createAgentHistory'](_0x241fe8,'[originateFailure][logOriginateFailure]');_0x1079b1(_0x2e58f2);});});};Preview[_0x4f64('0xf')][_0x4f64('0x1f')]=function(_0x21ed55){if(this[_0x4f64('0x47')][_0x21ed55[_0x4f64('0x8a')]]){this[_0x4f64('0x47')][_0x21ed55['linkedid']]['channel']=_0x21ed55[_0x4f64('0x52')];}};Preview[_0x4f64('0xf')][_0x4f64('0x12e')]=function(_0x252423){var _0x2616e3=this;var _0x447d8e=this[_0x4f64('0x47')][_0x252423['actionid']];if(_0x447d8e){if(_0x447d8e[_0x4f64('0x12f')]&&this['agents'][_0x447d8e['lookAgent']]){ut[_0x4f64('0x130')](_0x447d8e,this['agents'][_0x447d8e['lookAgent']][_0x4f64('0x34')],this[_0x4f64('0x16')][_0x447d8e[_0x4f64('0x12f')]]['id']);}var _0x5041d3=_['clone'](_0x447d8e);_0x5041d3[_0x4f64('0x90')]=moment()[_0x4f64('0x29')](_0x4f64('0x8f'));var _0x10bbb3=_0x2616e3['campaignsPreview'][_0x447d8e['queue']];if(ut[_0x4f64('0x131')](_0x252423[_0x4f64('0x132')])){if(_0x447d8e[_0x4f64('0x88')]){rpcDb['unlockContact'](_0x447d8e[_0x4f64('0x8c')]);}if(_0x447d8e[_0x4f64('0x89')]){rpcDb[_0x4f64('0x66')](_0x447d8e[_0x4f64('0x8c')]);}ami[_0x4f64('0x25')](_0x4f64('0x133'),ut[_0x4f64('0x79')](_0x447d8e,_0x4f64('0x134'),this[_0x4f64('0x3a')][_0x447d8e[_0x4f64('0x48')]]));this[_0x4f64('0xda')](_0x5041d3,_0x10bbb3,_0x252423);}else{_0x447d8e['starttime']=moment()['format'](_0x4f64('0x8f'));ut['logAgent'](_0x5041d3,0x4,_0x4f64('0x9c'));rpcDb[_0x4f64('0xdf')](_0x5041d3,_0x4f64('0x135'));}}};Preview[_0x4f64('0xf')]['syncHangup']=function(_0x151ba0){var _0x2fd3c0=this[_0x4f64('0x47')][_0x151ba0[_0x4f64('0x8a')]];var _0x1ce52b;if(_0x2fd3c0){_0x1ce52b=this['campaignsPreview'][_0x2fd3c0[_0x4f64('0x48')]];logger['info'](_0x4f64('0x136'),_0x151ba0[_0x4f64('0x8a')],_0x4f64('0xa1'),_0x1ce52b['name'],_0x4f64('0x4a'),_0x1ce52b[_0x4f64('0x2c')]);}if(this[_0x4f64('0x47')][_0x151ba0[_0x4f64('0x8a')]]&&_0x151ba0[_0x4f64('0x8a')]!==_0x151ba0[_0x4f64('0x93')]){if(_0x151ba0[_0x4f64('0x137')]==='16'&&this['actions'][_0x151ba0['linkedid']][_0x4f64('0x4b')]){this[_0x4f64('0x75')](_0x151ba0,_0x151ba0[_0x4f64('0x8a')],_0x151ba0['cause']);}else if(this[_0x4f64('0x47')][_0x151ba0[_0x4f64('0x8a')]]['dialAnswer']){logger[_0x4f64('0x26')](_0x4f64('0x138'),_0x151ba0[_0x4f64('0x8a')],_0x151ba0[_0x4f64('0x137')],_0x4f64('0xa1'),_0x1ce52b[_0x4f64('0x34')],_0x4f64('0x4a'),_0x1ce52b[_0x4f64('0x2c')]);this[_0x4f64('0x75')](_0x151ba0,_0x151ba0['linkedid'],_0x151ba0['cause']);}}else if(_0x2fd3c0&&_[_0x4f64('0x44')](_0x2fd3c0[_0x4f64('0x139')])&&_0x1ce52b[_0x4f64('0x13a')]&&_0x151ba0[_0x4f64('0x8a')]===_0x151ba0['uniqueid']&&_[_0x4f64('0x44')](_0x151ba0[_0x4f64('0xe7')])&&_0x151ba0[_0x4f64('0x137')]==='16'&&_0x151ba0[_0x4f64('0x13b')]==='6'&&_[_0x4f64('0xdc')](_0x2fd3c0['transfer'])){if(_0x2fd3c0[_0x4f64('0x88')]){rpcDb['unlockContact'](_0x2fd3c0[_0x4f64('0x8c')]);}if(_0x2fd3c0['activeContact']){rpcDb[_0x4f64('0x66')](_0x2fd3c0[_0x4f64('0x8c')]);}_0x151ba0[_0x4f64('0xe7')]='22';this[_0x4f64('0xda')](_0x2fd3c0,_0x1ce52b,_0x151ba0);}else if(_0x2fd3c0&&_0x2fd3c0[_0x4f64('0x13c')]){if(_0x151ba0['cause']==='16'&&this[_0x4f64('0x47')][_0x151ba0[_0x4f64('0x8a')]][_0x4f64('0x4b')]){logger[_0x4f64('0x26')](_0x4f64('0x13d'),_0x151ba0[_0x4f64('0x8a')],_0x151ba0[_0x4f64('0x137')],'\x20Queue',_0x1ce52b['name'],'pTalking:\x20',_0x1ce52b[_0x4f64('0x2c')]);this['callProgressDetectingCustomer'](_0x151ba0,_0x151ba0[_0x4f64('0x8a')],_0x151ba0['cause']);}else if(this[_0x4f64('0x47')][_0x151ba0['linkedid']]['dialAnswer']){logger[_0x4f64('0x26')](_0x4f64('0x138'),_0x151ba0[_0x4f64('0x8a')],_0x151ba0[_0x4f64('0x137')],_0x4f64('0xa1'),_0x1ce52b['name'],_0x4f64('0x4a'),_0x1ce52b[_0x4f64('0x2c')]);this[_0x4f64('0x75')](_0x151ba0,_0x151ba0[_0x4f64('0x8a')],_0x151ba0['cause']);}}};Preview['prototype'][_0x4f64('0x1d')]=function(_0x404007){if(this[_0x4f64('0x47')][_0x404007[_0x4f64('0xd8')]]&&_0x404007[_0x4f64('0xd8')]!==_0x404007[_0x4f64('0x13e')]){this['callProgressDetectingCustomer'](_0x404007,_0x404007[_0x4f64('0xd8')],_0x404007[_0x4f64('0xcc')]);}};Preview[_0x4f64('0xf')][_0x4f64('0x13f')]=function(_0x3002bf){if(this[_0x4f64('0x47')][_0x3002bf[_0x4f64('0x8a')]]&&_0x3002bf['linkedid']!==_0x3002bf[_0x4f64('0x93')]&&!this[_0x4f64('0x47')][_0x3002bf[_0x4f64('0x8a')]]['dialAnswer']){if(_0x3002bf['cause']==='1'){this['callProgressDetectingCustomer'](_0x3002bf,_0x3002bf[_0x4f64('0x8a')],_0x3002bf[_0x4f64('0x137')]);}}};Preview[_0x4f64('0xf')][_0x4f64('0x140')]=function(_0x1a2726,_0x342e70,_0x3cff1e){if(this[_0x4f64('0x47')][_0x1a2726]){if(_[_0x4f64('0x44')](this[_0x4f64('0x47')][_0x1a2726][_0x4f64('0x12a')])){this['actions'][_0x1a2726]['variables']={};}this[_0x4f64('0x47')][_0x1a2726][_0x4f64('0x12a')][_0x342e70]=_0x3cff1e;}};Preview[_0x4f64('0xf')][_0x4f64('0x20')]=function(_0x74fe92){try{if(!_[_0x4f64('0x44')](_0x74fe92)){if(ut['filterKey'](_['keys'](_0x74fe92['variable'])[0x0])){this[_0x4f64('0x140')](_0x74fe92[_0x4f64('0x93')],_[_0x4f64('0x141')](_0x74fe92[_0x4f64('0x142')])[0x0],_0x74fe92[_0x4f64('0x143')]);}}}catch(_0x3d7e8d){logger[_0x4f64('0x144')](_0x4f64('0x145'),util['inspect'](_0x3d7e8d,{'showHidden':![],'depth':null}));}};Preview[_0x4f64('0xf')][_0x4f64('0x22')]=function(_0x837f58){if(_0x837f58){if(this['actions'][_0x837f58[_0x4f64('0x146')]]){this[_0x4f64('0x47')][_0x837f58['transfertargetlinkedid']][_0x4f64('0x13c')]=!![];}}};Preview[_0x4f64('0xf')][_0x4f64('0x24')]=function(_0x4becb6){if(_0x4becb6){if(this[_0x4f64('0x47')][_0x4becb6[_0x4f64('0x147')]]){this['actions'][_0x4becb6[_0x4f64('0x147')]]['transfer']=!![];}}};module[_0x4f64('0x148')]=Preview; \ No newline at end of file +var _0x6fe3=['Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','isActive','dialActive','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','TrunkBackup','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','setXMDContactVariables','Contact','assign','toLowerVariables','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variable','keys','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','prototype','syncCampaigns','hasOwnProperty','preview','dialMethod','booked','type','outbound','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','INACTIVE','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','total','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','countcongestionretry','custom:agentcongestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','reason','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone'];(function(_0x5b129f,_0x26183f){var _0x43b93d=function(_0x56d68d){while(--_0x56d68d){_0x5b129f['push'](_0x5b129f['shift']());}};_0x43b93d(++_0x26183f);}(_0x6fe3,0x193));var _0x36fe=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x6fe3[_0x5a79e2];return _0x266c45;};'use strict';var util=require(_0x36fe('0x0'));var _=require(_0x36fe('0x1'));var uuid=require(_0x36fe('0x2'));var moment=require(_0x36fe('0x3'));var Redis=require(_0x36fe('0x4'));var config=require(_0x36fe('0x5'));var logger=require(_0x36fe('0x6'))('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x36fe('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x36fe('0x8'));var Action=require(_0x36fe('0x9'));var ut=require(_0x36fe('0xa'));var utils=require(_0x36fe('0xb'));config[_0x36fe('0xc')]=_[_0x36fe('0xd')](config[_0x36fe('0xc')],{'host':_0x36fe('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x36fe('0xc')]));var Sequence=function(){};Sequence['prototype'][_0x36fe('0xf')]=function(_0x358317){this[_0x36fe('0x10')]=this['tail']?this[_0x36fe('0x10')][_0x36fe('0x11')](_0x358317):_0x358317();};function Preview(_0x59d954){this[_0x36fe('0x12')]=new Sequence();this[_0x36fe('0x13')]=_0x59d954[_0x36fe('0x14')];this[_0x36fe('0x15')]=_0x59d954[_0x36fe('0x15')];this['actions']={};this[_0x36fe('0x16')]=_0x59d954[_0x36fe('0x16')];this[_0x36fe('0x17')]=0x0;ami['on'](_0x36fe('0x18'),this[_0x36fe('0x19')][_0x36fe('0x1a')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x36fe('0x1a')](this));ami['on'](_0x36fe('0x1b'),this['syncDialEnd'][_0x36fe('0x1a')](this));ami['on'](_0x36fe('0x1c'),this[_0x36fe('0x1d')][_0x36fe('0x1a')](this));ami['on'](_0x36fe('0x1e'),this[_0x36fe('0x1f')][_0x36fe('0x1a')](this));ami['on'](_0x36fe('0x20'),this[_0x36fe('0x21')][_0x36fe('0x1a')](this));ami['on']('blindtransfer',this[_0x36fe('0x22')]['bind'](this));this[_0x36fe('0x23')](this['campaignsPreview']);}function emit(_0x15e9f2,_0x270ee5,_0x42d464){io['to'](_0x15e9f2)[_0x36fe('0x24')](_0x270ee5,_0x42d464);}function emitVoiceQueueChannelRemove(_0x4bb22b){logger[_0x36fe('0x25')](_0x36fe('0x26'),JSON[_0x36fe('0x27')](_0x4bb22b));emit(util[_0x36fe('0x28')](_0x36fe('0x29'),_0x4bb22b[_0x36fe('0x2a')]),_0x36fe('0x2b'),_0x4bb22b);io[_0x36fe('0x24')]('voice_queue_presence:remove',_0x4bb22b);}function notSendMessagesQueue(_0x2d4abf){if(_0x2d4abf[_0x36fe('0x2c')]){if(_0x2d4abf[_0x36fe('0x2d')]===0x0&&_0x2d4abf[_0x36fe('0x2e')]===0x0){_0x2d4abf[_0x36fe('0x2c')]=![];_0x2d4abf[_0x36fe('0x2f')]=0x0;_0x2d4abf[_0x36fe('0x30')]=0x0;_0x2d4abf[_0x36fe('0x31')]=utils[_0x36fe('0x32')]['INACTIVE'];ut[_0x36fe('0x33')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2d4abf[_0x36fe('0x2a')]+_0x36fe('0x34'));}else{_0x2d4abf[_0x36fe('0x31')]=utils['CAMPAIGN_STATUS'][_0x36fe('0x35')];ut[_0x36fe('0x33')](_0x36fe('0x36'),_0x2d4abf[_0x36fe('0x2a')]+'\x20is\x20deactivated');}}}Preview[_0x36fe('0x37')][_0x36fe('0x23')]=function(){var _0x41dcc1=this;setInterval(function(){_0x41dcc1[_0x36fe('0x38')]();},0x7cf);};Preview[_0x36fe('0x37')]['syncCampaigns']=function(){var _0x51c106=this[_0x36fe('0x13')];this[_0x36fe('0x17')]+=0x1;for(var _0x260964 in _0x51c106){if(_0x51c106[_0x36fe('0x39')](_0x260964)&&(_0x51c106[_0x260964]['dialMethod']===_0x36fe('0x3a')||_0x51c106[_0x260964][_0x36fe('0x3b')]===_0x36fe('0x3c'))&&_0x51c106[_0x260964][_0x36fe('0x3d')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x36fe('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x51c106[_0x36fe('0x39')](_0x260964)&&_0x51c106[_0x260964][_0x36fe('0x3b')]==='preview'&&_0x51c106[_0x260964]['type']===_0x36fe('0x3e')){if(_0x51c106[_0x260964]['dialActive']){this[_0x36fe('0x3f')](_0x51c106[_0x260964]);if(_0x51c106[_0x260964][_0x36fe('0x40')])this['recallMe'](_0x51c106[_0x260964]);}else{notSendMessagesQueue(_0x51c106[_0x260964]);}}}};Preview[_0x36fe('0x37')][_0x36fe('0x41')]=function(_0xa799ae){var _0x3c139d=this;this[_0x36fe('0x12')]['enqueue'](function(){if(!_[_0x36fe('0x42')](_0x3c139d[_0x36fe('0x43')][_0xa799ae])){loggerAction['info'](_0x36fe('0x44'),_0xa799ae,_0x36fe('0x45'),_0x3c139d[_0x36fe('0x43')][_0xa799ae][_0x36fe('0x46')],_0x36fe('0x47'),JSON[_0x36fe('0x27')](_0x3c139d['campaignsPreview'][_0x3c139d[_0x36fe('0x43')][_0xa799ae][_0x36fe('0x46')]]['originated']),_0x36fe('0x48'),JSON['stringify'](_0x3c139d[_0x36fe('0x13')][_0x3c139d['actions'][_0xa799ae]['queue']][_0x36fe('0x2e')]),JSON[_0x36fe('0x27')](_0x3c139d[_0x36fe('0x43')][_0xa799ae][_0x36fe('0x49')]),JSON['stringify'](_[_0x36fe('0x4a')](_0x3c139d[_0x36fe('0x43')][_0xa799ae],[_0x36fe('0x4b'),_0x36fe('0x4c'),_0x36fe('0x4d'),_0x36fe('0x4e')])));return ami[_0x36fe('0x4f')]({'action':_0x36fe('0x50'),'channel':_0x3c139d[_0x36fe('0x43')][_0xa799ae]['channel']})[_0x36fe('0x51')](function(_0x571d52){if(_0x571d52[_0x36fe('0x31')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3c139d['actions'][_0xa799ae]){ut[_0x36fe('0x52')](_0x3c139d[_0x36fe('0x13')][_0x3c139d['actions'][_0xa799ae]['queue']],_0x36fe('0x53'));if(_0x3c139d[_0x36fe('0x43')][_0xa799ae][_0x36fe('0x49')]===!![]){ut[_0x36fe('0x54')](_0x3c139d[_0x36fe('0x13')][_0x3c139d[_0x36fe('0x43')][_0xa799ae][_0x36fe('0x46')]],'[clearZombieChannel]');ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0xa799ae,_0x3c139d['actions'][_0xa799ae][_0x36fe('0x46')]);}ut[_0x36fe('0x55')](_0x36fe('0x56')+_0xa799ae,_0x3c139d['actions'][_0xa799ae][_0x36fe('0x46')]);delete _0x3c139d['actions'][_0xa799ae];}},0x2328);}});}});};Preview[_0x36fe('0x37')]['clearZombieChannels']=function(){var _0x334083=this;loggerAction[_0x36fe('0x25')]('[action]',_[_0x36fe('0x57')](this[_0x36fe('0x43')]));for(var _0x3f15cf in this[_0x36fe('0x43')]){if(_0x334083['actions'][_0x36fe('0x39')](_0x3f15cf)){_0x334083['clearZombieChannel'](_0x3f15cf);}}};Preview[_0x36fe('0x37')]['recallMe']=function(_0x5a82b6){var _0x56efd7=this;rpcDb['getContactRecallMe'](_0x5a82b6['id'],ut['agentReadyId'](this[_0x36fe('0x16')]))[_0x36fe('0x58')](function(_0x13553e){if(!_[_0x36fe('0x42')](_0x13553e)){for(var _0x3d5b3e=0x0;_0x3d5b3e<_0x13553e[_0x36fe('0x59')];_0x3d5b3e+=0x1){if(ut[_0x36fe('0x5a')](_0x13553e[_0x3d5b3e]['scheduledat'])<_0x5a82b6[_0x36fe('0x5b')]*0x3c){if(_0x13553e[_0x3d5b3e]['Agent']&&!_0x13553e[_0x3d5b3e][_0x36fe('0x5c')][_0x36fe('0x5d')]){_0x56efd7[_0x36fe('0x5e')](_0x13553e[_0x3d5b3e]['id'])[_0x36fe('0x58')](ut[_0x36fe('0x5f')](_0x36fe('0x60')))['catch'](ut[_0x36fe('0x5f')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x13553e[_0x3d5b3e]['id']);}}else{var _0x1a0e6b=new Action(_0x13553e[_0x3d5b3e],_0x5a82b6);_0x1a0e6b[_0x36fe('0x61')]=moment()[_0x36fe('0x28')](_0x36fe('0x62'));_0x5a82b6[_0x36fe('0x63')]+=0x1;ut[_0x36fe('0x64')](_0x1a0e6b,0x17,_0x36fe('0x65'));if(_0x5a82b6[_0x36fe('0x66')]){rpcDb[_0x36fe('0x67')](ut[_0x36fe('0x68')](_0x13553e[_0x3d5b3e]));rpcDb[_0x36fe('0x69')](_0x1a0e6b,_0x36fe('0x6a'));}else{ut[_0x36fe('0x64')](_0x1a0e6b,0x16,_0x36fe('0x6b'));rpcDb['createCustomerHistory'](_0x1a0e6b,_0x36fe('0x6c'));rpcDb[_0x36fe('0x6d')](_0x1a0e6b,_0x36fe('0x6c'));}}}}})[_0x36fe('0x51')](ut[_0x36fe('0x5f')](_0x36fe('0x6e')));};Preview[_0x36fe('0x37')][_0x36fe('0x3f')]=function(_0x4beed6){_0x4beed6[_0x36fe('0x2c')]=!![];if(ut[_0x36fe('0x6f')](_0x4beed6[_0x36fe('0x70')])){_0x4beed6['message']=utils[_0x36fe('0x32')][_0x36fe('0x71')];}else if(!ut['isActive'](_0x4beed6['dialActive'])){_0x4beed6[_0x36fe('0x31')]=utils[_0x36fe('0x32')][_0x36fe('0x72')];}else if(!this[_0x36fe('0x73')](_0x4beed6['Trunk'])){if(!this[_0x36fe('0x73')](_0x4beed6['TrunkBackup'])){_0x4beed6[_0x36fe('0x31')]=utils[_0x36fe('0x32')][_0x36fe('0x74')];}else{_0x4beed6[_0x36fe('0x31')]=utils[_0x36fe('0x32')][_0x36fe('0x75')];}}else{_0x4beed6[_0x36fe('0x31')]=utils[_0x36fe('0x32')][_0x36fe('0x75')];}};Preview[_0x36fe('0x37')][_0x36fe('0x76')]=function(_0x5b1b6b,_0x4b869f,_0x2dfe00){var _0x2ea7be=this;var _0x16536a=this[_0x36fe('0x43')][_0x4b869f];var _0x268b05=this['campaignsPreview'][_0x16536a[_0x36fe('0x46')]];var _0x293e9b;var _0x72808a=![];var _0x3f9a9c=0x2;var _0x3bc513=0x3;if(_0x268b05){switch(_0x2dfe00){case'1':_0x268b05['outboundNoSuchCallsDay']+=0x1;_0x16536a[_0x36fe('0x77')]+=0x1;_0x16536a[_0x36fe('0x78')]=ut[_0x36fe('0x79')](_0x16536a);ut['logCustomer'](_0x16536a,0x0,_0x36fe('0x7a'));ami[_0x36fe('0x24')](_0x36fe('0x7b'),ut['buildObj'](_0x16536a,_0x36fe('0x7c')));rpcDb[_0x36fe('0x69')](_0x16536a,'[callProgressDetectingCustomer][logNoSuch]');_0x2ea7be[_0x36fe('0x7d')](_0x16536a,'0',_0x268b05)[_0x36fe('0x58')](function(_0x4d7237){_0x72808a=_0x4d7237[_0x36fe('0x7e')]==0x1;_0x3f9a9c=_0x268b05[_0x36fe('0x7f')];_0x3bc513=_0x268b05[_0x36fe('0x80')];if(!_0x72808a){if(ut[_0x36fe('0x79')](_0x16536a)>=_0x268b05[_0x36fe('0x81')]){_0x293e9b=ut['cloneAction'](_0x16536a,0xf,'Global');rpcDb[_0x36fe('0x6d')](_0x293e9b,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x16536a[_0x36fe('0x77')]>=_0x268b05['dialNoSuchNumberMaxRetry']){rpcDb[_0x36fe('0x6d')](_0x16536a,_0x36fe('0x82'));}else{rpcDb[_0x36fe('0x83')](ut[_0x36fe('0x84')](_0x16536a,_0x36fe('0x77'),_0x268b05[_0x36fe('0x7f')]),_0x16536a[_0x36fe('0x85')],_0x16536a['activeContact']);}}delete this[_0x36fe('0x43')][_0x5b1b6b[_0x36fe('0x86')]];}else{_0x16536a['countnosuchnumberretry']++;logger[_0x36fe('0x25')]('actioncountonusuch',_0x16536a[_0x36fe('0x77')]);logger[_0x36fe('0x25')]('id',_0x16536a[_0x36fe('0x87')]);_0x2ea7be[_0x36fe('0x88')]({'id':_0x16536a[_0x36fe('0x87')],'field':{'countnosuchnumberretry':_0x16536a['countnosuchnumberretry']}})[_0x36fe('0x58')](function(){_0x2ea7be[_0x36fe('0x89')](_0x16536a,_0x3f9a9c,_0x3bc513)[_0x36fe('0x58')](function(){});});}});break;case _0x36fe('0x8a'):var _0x3f4060=moment()[_0x36fe('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x16536a[_0x36fe('0x8b')]=_0x3f4060;_0x16536a['answertime']=_0x3f4060;_0x16536a[_0x36fe('0x49')]=!![];_0x268b05[_0x36fe('0x2e')]+=0x1;logger[_0x36fe('0x25')](_0x36fe('0x8c'),_0x16536a[_0x36fe('0x8d')],_0x36fe('0x8e'),_0x268b05[_0x36fe('0x2a')],_0x36fe('0x48'),_0x268b05['pTalking']);ami[_0x36fe('0x24')](_0x36fe('0x8f'),ut[_0x36fe('0x90')](_0x16536a,_0x36fe('0x91'),this[_0x36fe('0x13')][_0x16536a['queue']]));if(_0x268b05[_0x36fe('0x92')]){ami[_0x36fe('0x24')](_0x36fe('0x93'),ut[_0x36fe('0x94')](_0x16536a));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x36fe('0x90')](_0x16536a,_0x36fe('0x95'),this[_0x36fe('0x13')][_0x16536a[_0x36fe('0x46')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x16536a,_0x36fe('0x95')));_0x268b05['outboundAnswerCallsDay']+=0x1;_0x268b05[_0x36fe('0x96')]+=0x1;_0x268b05['answered']+=0x1;ut[_0x36fe('0x54')](_0x268b05,'[16]');_0x16536a[_0x36fe('0x78')]=ut[_0x36fe('0x79')](_0x16536a);ut[_0x36fe('0x64')](_0x16536a,0x4,'Answer');rpcDb[_0x36fe('0x69')](_0x16536a,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x16536a,_0x36fe('0x97'));rpcDb['crateCustomerReportQueue'](_0x16536a);_0x268b05[_0x36fe('0x98')]+=_0x16536a['talktime'];_0x268b05['sumBillable']+=_0x16536a[_0x36fe('0x99')];logger[_0x36fe('0x25')]('[syncHangup][talking][decrement]',_0x16536a[_0x36fe('0x8d')],_0x36fe('0x8e'),_0x268b05['name'],'pTalking:\x20',_0x268b05['pTalking']);delete this[_0x36fe('0x43')][_0x5b1b6b['linkedid']];break;case _0x36fe('0x9a'):_0x268b05[_0x36fe('0x9b')]+=0x1;_0x16536a[_0x36fe('0x9c')]+=0x1;_0x16536a[_0x36fe('0x78')]=ut[_0x36fe('0x79')](_0x16536a);ut[_0x36fe('0x64')](_0x16536a,0x5,_0x36fe('0x9d'));_0x3f9a9c=_0x268b05[_0x36fe('0x9e')];_0x3bc513=_0x268b05['callAdditionalPhoneAfterMin'];ami['emit'](_0x36fe('0x9f'),ut[_0x36fe('0x90')](_0x16536a,_0x36fe('0xa0')));rpcDb[_0x36fe('0x69')](_0x16536a,_0x36fe('0xa1'));_0x2ea7be[_0x36fe('0x7d')](_0x16536a,'5',_0x268b05)[_0x36fe('0x58')](function(_0x15e276){_0x72808a=_0x15e276[_0x36fe('0x7e')]==0x1;if(!_0x72808a){if(ut[_0x36fe('0x79')](_0x16536a)>=_0x268b05[_0x36fe('0x81')]){_0x293e9b=ut[_0x36fe('0xa2')](_0x16536a,0xf,_0x36fe('0xa3'));rpcDb[_0x36fe('0x6d')](_0x293e9b,_0x36fe('0xa4'));}else{if(_0x16536a[_0x36fe('0x9c')]>=_0x268b05[_0x36fe('0xa5')]){rpcDb[_0x36fe('0x6d')](_0x16536a,_0x36fe('0xa1'));}else{rpcDb['rescheduleContact'](ut[_0x36fe('0x84')](_0x16536a,_0x36fe('0x9c'),_0x268b05[_0x36fe('0x9e')]),_0x16536a[_0x36fe('0x85')],_0x16536a[_0x36fe('0xa6')]);}}}else{_0x16536a[_0x36fe('0x9c')]++;_0x2ea7be['incrementPreviewCounters']({'id':_0x16536a['idContact'],'field':{'countbusyretry':_0x16536a[_0x36fe('0x9c')]}})[_0x36fe('0x58')](function(){_0x2ea7be[_0x36fe('0x89')](_0x16536a,_0x3f9a9c,_0x3bc513)['then'](function(){});});}});break;case _0x36fe('0xa7'):_0x268b05[_0x36fe('0xa8')]+=0x1;_0x16536a['countnoanswerretry']+=0x1;_0x16536a[_0x36fe('0x78')]=ut['totalGlobal'](_0x16536a);ut['logCustomer'](_0x16536a,0x3,'NoAnswer');_0x3f9a9c=_0x268b05[_0x36fe('0xa9')];_0x3bc513=_0x268b05[_0x36fe('0x80')];var _0x4f1365=ut[_0x36fe('0xaa')](_0x16536a,_0x268b05);ami[_0x36fe('0x24')]('custom:agentnoanswer',_0x4f1365);rpcDb[_0x36fe('0x69')](_0x16536a,'[callProgressDetectingCustomer][logNoAnswer]');_0x2ea7be[_0x36fe('0x7d')](_0x16536a,'3',_0x268b05)['then'](function(_0x270815){_0x72808a=_0x270815[_0x36fe('0x7e')]==0x1;if(!_0x72808a){if(ut[_0x36fe('0x79')](_0x16536a)>=_0x268b05[_0x36fe('0x81')]){_0x293e9b=ut[_0x36fe('0xa2')](_0x16536a,0xf,_0x36fe('0xa3'));rpcDb[_0x36fe('0x6d')](_0x293e9b,_0x36fe('0xab'));}else{if(_0x16536a[_0x36fe('0xac')]>=_0x268b05['dialNoAnswerMaxRetry']){rpcDb[_0x36fe('0x6d')](_0x16536a,_0x36fe('0xad'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x16536a,'countnoanswerretry',_0x268b05[_0x36fe('0xa9')]),_0x16536a['unlockAgent'],_0x16536a[_0x36fe('0xa6')]);}}}else{_0x16536a['countnoanswerretry']++;_0x2ea7be[_0x36fe('0x88')]({'id':_0x16536a[_0x36fe('0x87')],'field':{'countnoanswerretry':_0x16536a[_0x36fe('0xac')]}})['then'](function(){_0x2ea7be['swapAdditionalPhones'](_0x16536a,_0x3f9a9c,_0x3bc513)[_0x36fe('0x58')](function(){});});}});break;case'CONGESTION':_0x268b05['outboundCongestionCallsDay']+=0x1;_0x16536a[_0x36fe('0xae')]+=0x1;_0x16536a[_0x36fe('0x78')]=ut[_0x36fe('0x79')](_0x16536a);ut['logCustomer'](_0x16536a,0x8,'Congestion');_0x3f9a9c=_0x268b05['dialCongestionRetryFrequency'];_0x3bc513=_0x268b05['callAdditionalPhoneAfterMin'];ami[_0x36fe('0x24')](_0x36fe('0xaf'),ut['buildObj'](_0x16536a,'congestion'));rpcDb['createCustomerHistory'](_0x16536a,'[callProgressDetectingCustomer][logCongestion]');_0x2ea7be[_0x36fe('0x7d')](_0x16536a,'8',_0x268b05)[_0x36fe('0x58')](function(_0x431ac2){_0x72808a=_0x431ac2[_0x36fe('0x7e')]==0x1;if(!_0x72808a){if(ut['totalGlobal'](_0x16536a)>=_0x268b05[_0x36fe('0x81')]){_0x293e9b=ut[_0x36fe('0xa2')](_0x16536a,0xf,_0x36fe('0xa3'));rpcDb[_0x36fe('0x6d')](_0x293e9b,_0x36fe('0xb0'));}else{if(_0x16536a[_0x36fe('0xae')]>=_0x268b05[_0x36fe('0xb1')]){rpcDb[_0x36fe('0x6d')](_0x16536a,_0x36fe('0xb2'));}else{rpcDb[_0x36fe('0x83')](ut['scheduledAt'](_0x16536a,_0x36fe('0xae'),_0x268b05[_0x36fe('0x9e')]),_0x16536a[_0x36fe('0x85')],_0x16536a['activeContact']);}}}else{_0x16536a['countcongestionretry']++;_0x2ea7be['incrementPreviewCounters']({'id':_0x16536a[_0x36fe('0x87')],'field':{'countcongestionretry':_0x16536a[_0x36fe('0xae')]}})[_0x36fe('0x58')](function(){_0x2ea7be[_0x36fe('0x89')](_0x16536a,_0x3f9a9c,_0x3bc513)[_0x36fe('0x58')](function(){});});}});break;case _0x36fe('0xb3'):_0x268b05['outboundRejectCallsDay']+=0x1;_0x16536a[_0x36fe('0xb4')]+=0x1;_0x16536a[_0x36fe('0x78')]=ut['totalGlobal'](_0x16536a);ut[_0x36fe('0x64')](_0x16536a,0x14,_0x36fe('0xb5'));_0x3f9a9c=_0x268b05[_0x36fe('0xb6')];_0x3bc513=_0x268b05[_0x36fe('0x80')];ami[_0x36fe('0x24')](_0x36fe('0xb7'),ut[_0x36fe('0x90')](_0x16536a,_0x36fe('0xb8')));rpcDb[_0x36fe('0x69')](_0x16536a,'[syncHangupRequest][logAgentReject]');_0x2ea7be[_0x36fe('0x7d')](_0x16536a,'20',_0x268b05)[_0x36fe('0x58')](function(_0x5d940a){_0x72808a=_0x5d940a[_0x36fe('0x7e')]==0x1;if(!_0x72808a){if(ut[_0x36fe('0x79')](_0x16536a)>=_0x268b05[_0x36fe('0x81')]){_0x293e9b=ut[_0x36fe('0xa2')](_0x16536a,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x293e9b,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x16536a[_0x36fe('0xb4')]>=_0x268b05['dialAgentRejectMaxRetry']){rpcDb[_0x36fe('0x6d')](_0x16536a,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x36fe('0x83')](ut['scheduledAt'](_0x16536a,_0x36fe('0xb4'),_0x268b05[_0x36fe('0xb6')]),_0x16536a[_0x36fe('0x85')],_0x16536a['activeContact']);}}}else{_0x16536a[_0x36fe('0xac')]++;_0x2ea7be[_0x36fe('0x88')]({'id':_0x16536a[_0x36fe('0x87')],'field':{'countnoanswerretry':_0x16536a['countnoanswerretry']}})['then'](function(){_0x2ea7be[_0x36fe('0x89')](_0x16536a,_0x3f9a9c,_0x3bc513)['then'](function(){});});}});break;case'ABANDONED':_0x268b05[_0x36fe('0xb9')]+=0x1;_0x16536a[_0x36fe('0xba')]+=0x1;_0x16536a[_0x36fe('0x78')]=ut[_0x36fe('0x79')](_0x16536a);ut[_0x36fe('0x64')](_0x16536a,0xb,_0x36fe('0xbb'));rpcDb[_0x36fe('0x69')](_0x16536a,_0x36fe('0xbc'));_0x2ea7be['verifyAdditionalPhones'](_0x16536a,'11',_0x268b05)[_0x36fe('0x58')](function(_0x1ba902){_0x72808a=_0x1ba902[_0x36fe('0x7e')]==0x1;if(!_0x72808a){if(ut[_0x36fe('0x79')](_0x16536a)>=_0x268b05[_0x36fe('0x81')]){_0x293e9b=ut[_0x36fe('0xa2')](_0x16536a,0xf,_0x36fe('0xa3'));rpcDb['createCustomerFinal'](_0x293e9b,_0x36fe('0xbc'));}else{if(_0x16536a['countabandonedetry']>=_0x268b05[_0x36fe('0xbd')]){rpcDb[_0x36fe('0x6d')](_0x16536a,_0x36fe('0xbc'));}else{rpcDb[_0x36fe('0x83')](ut[_0x36fe('0x84')](_0x16536a,'countabandonedretry',_0x268b05[_0x36fe('0xbe')]),_0x16536a[_0x36fe('0x85')],_0x16536a[_0x36fe('0xa6')]);}}}else{_0x16536a[_0x36fe('0xac')]++;_0x2ea7be[_0x36fe('0x88')]({'id':_0x16536a[_0x36fe('0x87')],'field':{'countnoanswerretry':_0x16536a[_0x36fe('0xac')]}})['then'](function(){_0x2ea7be[_0x36fe('0x89')](_0x16536a,_0x3f9a9c,_0x3bc513)[_0x36fe('0x58')](function(){});});}});break;case'18':_0x268b05[_0x36fe('0xbf')]+=0x1;_0x16536a[_0x36fe('0xc0')]+=0x1;_0x16536a['countglobal']=ut[_0x36fe('0x79')](_0x16536a);ut[_0x36fe('0x64')](_0x16536a,0x12,_0x5b1b6b['cause-txt']||_0x5b1b6b['dialstatus']);ami[_0x36fe('0x24')]('custom:amd',ut[_0x36fe('0x90')](_0x16536a,_0x36fe('0xc1')));rpcDb[_0x36fe('0x69')](_0x16536a,_0x36fe('0xc2'));_0x2ea7be['verifyAdditionalPhones'](_0x16536a,'18',_0x268b05)[_0x36fe('0x58')](function(_0x5db9cd){_0x72808a=_0x5db9cd[_0x36fe('0x7e')]==0x1;if(!_0x72808a){if(ut[_0x36fe('0x79')](_0x16536a)>=_0x268b05['dialGlobalMaxRetry']){_0x293e9b=ut[_0x36fe('0xa2')](_0x16536a,0x12,'Global');rpcDb['createCustomerFinal'](_0x293e9b,_0x36fe('0xc2'));}else{rpcDb[_0x36fe('0x6d')](_0x16536a,_0x36fe('0xc2'));}}else{_0x16536a[_0x36fe('0xac')]++;_0x2ea7be[_0x36fe('0x88')]({'id':_0x16536a['idContact'],'field':{'countnoanswerretry':_0x16536a['countnoanswerretry']}})[_0x36fe('0x58')](function(){_0x2ea7be['swapAdditionalPhones'](_0x16536a,_0x3f9a9c,_0x3bc513)[_0x36fe('0x58')](function(){});});}});delete this['actions'][_0x5b1b6b[_0x36fe('0x86')]];break;case'19':_0x268b05[_0x36fe('0xbf')]+=0x1;_0x16536a['countglobal']=ut[_0x36fe('0x79')](_0x16536a);ut[_0x36fe('0x64')](_0x16536a,0x13,_0x5b1b6b[_0x36fe('0xc3')]||_0x5b1b6b[_0x36fe('0xc4')]);ami['emit'](_0x36fe('0xc5'),ut['buildObj'](_0x16536a,'amd'));rpcDb[_0x36fe('0x69')](_0x16536a,_0x36fe('0xc6'));_0x2ea7be[_0x36fe('0x7d')](_0x16536a,'18',_0x268b05)['then'](function(_0x450a27){_0x72808a=_0x450a27[_0x36fe('0x7e')]==0x1;if(!_0x72808a){if(ut[_0x36fe('0x79')](_0x16536a)>=_0x268b05[_0x36fe('0x81')]){_0x293e9b=ut[_0x36fe('0xa2')](_0x16536a,0xf,'Global');rpcDb[_0x36fe('0x6d')](_0x293e9b,_0x36fe('0xc6'));}else{rpcDb[_0x36fe('0x6d')](_0x16536a,_0x36fe('0xc6'));}}else{_0x16536a[_0x36fe('0xac')]++;_0x2ea7be['incrementPreviewCounters']({'id':_0x16536a[_0x36fe('0x87')],'field':{'countnoanswerretry':_0x16536a[_0x36fe('0xac')]}})[_0x36fe('0x58')](function(){_0x2ea7be['swapAdditionalPhones'](_0x16536a,_0x3f9a9c,_0x3bc513)[_0x36fe('0x58')](function(){});});}});delete this[_0x36fe('0x43')][_0x5b1b6b[_0x36fe('0x86')]];break;default:if(_0x16536a['dialAnswer']){ut[_0x36fe('0x54')](_0x268b05,_0x36fe('0xc7'));ut[_0x36fe('0x55')](_0x36fe('0xc8')+_0x268b05[_0x36fe('0x2a')],_0x5b1b6b);}_0x268b05[_0x36fe('0xbf')]+=0x1;_0x16536a[_0x36fe('0x78')]=ut[_0x36fe('0x79')](_0x16536a);ut['logCustomer'](_0x16536a,0xc,_0x5b1b6b[_0x36fe('0xc3')]||_0x5b1b6b[_0x36fe('0xc4')]);_0x3f9a9c=_0x268b05['dialAgentRejectRetryFrequency'];_0x3bc513=_0x268b05[_0x36fe('0x80')];rpcDb['createCustomerHistory'](_0x16536a,'[callProgressDetectingCustomer][logUnknown]');_0x2ea7be[_0x36fe('0x7d')](_0x16536a,'20',_0x268b05)[_0x36fe('0x58')](function(_0x175269){_0x72808a=_0x175269[_0x36fe('0x7e')]==0x1;if(!_0x72808a){if(ut[_0x36fe('0x79')](_0x16536a)>=_0x268b05[_0x36fe('0x81')]){_0x293e9b=ut[_0x36fe('0xa2')](_0x16536a,0xf,_0x36fe('0xa3'));rpcDb[_0x36fe('0x6d')](_0x293e9b,_0x36fe('0xc9'));}else{rpcDb[_0x36fe('0x6d')](_0x16536a,_0x36fe('0xc9'));}delete this[_0x36fe('0x43')][_0x5b1b6b[_0x36fe('0x86')]];}else{_0x2ea7be[_0x36fe('0x89')](_0x16536a,_0x3f9a9c,_0x3bc513)['then'](function(){});}});}if(!(_0x16536a[_0x36fe('0x49')]&&_0x2dfe00==='16')){ut[_0x36fe('0x52')](_0x268b05,'[callProgressDetectingCustomer]');logger['info'](_0x36fe('0xca'),_0x16536a['uniqueid'],_0x36fe('0x8e'),_0x268b05['name'],'originated:\x20',_0x268b05[_0x36fe('0x2d')]);}if(_0x2dfe00!==_0x36fe('0x8a')){delete this['actions'][_0x5b1b6b[_0x36fe('0x86')]];delete this[_0x36fe('0x43')][_0x5b1b6b[_0x36fe('0xcb')]];}_0x268b05[_0x36fe('0xcc')]=!![];}};Preview[_0x36fe('0x37')]['callProgressDetectingAgent']=function(_0x17b9b7,_0x26a1ae,_0x513558){if(_[_0x36fe('0xcd')](_0x26a1ae)&&_0x36fe('0xce')!==typeof _0x26a1ae){return;}if(_[_0x36fe('0xcd')](_0x513558)&&_0x36fe('0xce')!==typeof _0x513558){return;}switch(_0x513558['reason']){case'0':ut[_0x36fe('0xcf')](_0x17b9b7,0x0,_0x36fe('0x7a'));rpcDb[_0x36fe('0xd0')](_0x17b9b7,_0x36fe('0xd1'));break;case'3':ut[_0x36fe('0xcf')](_0x17b9b7,0x3,_0x36fe('0xd2'));rpcDb[_0x36fe('0xd0')](_0x17b9b7,_0x36fe('0xd3'));break;case'5':ut[_0x36fe('0xcf')](_0x17b9b7,0x5,_0x36fe('0x9d'));rpcDb[_0x36fe('0xd0')](_0x17b9b7,_0x36fe('0xd4'));break;case'8':ut['logAgent'](_0x17b9b7,0x8,_0x36fe('0xd5'));rpcDb[_0x36fe('0xd0')](_0x17b9b7,_0x36fe('0xd6'));break;case'22':ut['logAgent'](_0x17b9b7,0x16,'AnswerAGI');rpcDb[_0x36fe('0xd0')](_0x17b9b7,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x17b9b7,0xc,_0x513558[_0x36fe('0xd7')]);rpcDb[_0x36fe('0xd0')](_0x17b9b7,_0x36fe('0xd6'));}ut[_0x36fe('0x52')](_0x26a1ae,'[callProgressDetectingAgent]');logger[_0x36fe('0x25')](_0x36fe('0xd8'),_0x17b9b7[_0x36fe('0x8d')],'\x20Queue',_0x26a1ae['name'],_0x36fe('0x47'),_0x26a1ae[_0x36fe('0x2d')]);delete this[_0x36fe('0x43')][_0x17b9b7[_0x36fe('0x8d')]];};Preview[_0x36fe('0x37')]['verifyAdditionalPhones']=function(_0x4a826d,_0xb8b907,_0x1c31e9){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x4a826d,_0xb8b907,_0x1c31e9)[_0x36fe('0x51')](logger['info'](_0x36fe('0xd9')));};Preview[_0x36fe('0x37')][_0x36fe('0x89')]=function(_0x1a0d23,_0x128e03,_0x2274d2){return cmHopperAdditionalPhone[_0x36fe('0x89')](_0x1a0d23,_0x128e03,_0x2274d2)['catch'](logger[_0x36fe('0x25')](_0x36fe('0xda')));};Preview[_0x36fe('0x37')][_0x36fe('0x88')]=function(_0x2abe83){return Promise[_0x36fe('0xdb')]()[_0x36fe('0x58')](cmHopperAdditionalPhone[_0x36fe('0x88')](_0x2abe83))[_0x36fe('0x51')](logger['info'](_0x36fe('0xdc')));};Preview[_0x36fe('0x37')][_0x36fe('0xdd')]=function(_0x57a748,_0x35cb44,_0x52e85d,_0x55312a,_0x3b70aa){var _0x2a00ed=this;return new Promise(function(_0x4a7801,_0x1f9852){if(_[_0x36fe('0x42')](_0x35cb44)||_[_0x36fe('0x42')](_0x35cb44['Contact'])||_[_0x36fe('0x42')](_0x35cb44[_0x36fe('0xde')])||_[_0x36fe('0x42')](_0x35cb44[_0x36fe('0x4d')])){_0x1f9852(ut['message'](_0x36fe('0xdf'),_0x55312a,_0x3b70aa));return;}var _0x420dd5=uuid['v4']();var _0x2b3363=_0x2a00ed[_0x36fe('0x13')][_0x35cb44['Queue'][_0x36fe('0x2a')]];var _0x297bac=_0x52e85d?_0x2a00ed['agents'][_0x52e85d]['id']:undefined;_0x2a00ed['actions'][_0x420dd5]=new Action(_0x35cb44,_0x2b3363,_0x420dd5,_0x52e85d,_0x297bac);var _0x54cf99=_0x2a00ed[_0x36fe('0x43')][_0x420dd5];_0x54cf99[_0x36fe('0x85')]=_0x55312a;_0x54cf99['activeContact']=_0x3b70aa;_0x54cf99[_0x36fe('0xe0')]=_0x52e85d;if(_[_0x36fe('0xe1')](_0x57a748)){_0x2a00ed[_0x36fe('0xe2')](_0x54cf99,_0x2b3363,_0x35cb44,_0x52e85d)[_0x36fe('0x58')](function(_0x4d2ce1){logger[_0x36fe('0x25')]('[Preview][execCall][success]',_0x36fe('0xe3')+_0x54cf99[_0x36fe('0x46')]+_0x36fe('0xe4')+_0x54cf99[_0x36fe('0x87')],JSON[_0x36fe('0x27')](_0x4d2ce1));ami[_0x36fe('0x24')](_0x36fe('0xe5'),ut['buildObj'](_0x54cf99,_0x36fe('0xe6'),_0x2a00ed['campaignsPreview'][_0x54cf99[_0x36fe('0x46')]]));_0x4a7801(ut[_0x36fe('0x31')](_0x36fe('0xe7')));})[_0x36fe('0x51')](function(_0x274f9f){ut[_0x36fe('0x33')](_0x36fe('0xe8'),_0x274f9f);_0x1f9852(ut[_0x36fe('0x31')](_0x36fe('0xe9'),_0x55312a,_0x3b70aa));});}else{_0x2b3363['outboundBlacklistCallsDay']+=0x1;ut[_0x36fe('0xea')](_0x54cf99);rpcDb[_0x36fe('0xeb')](_0x54cf99,_0x36fe('0xec'));delete _0x2a00ed[_0x36fe('0x43')][_0x420dd5];_0x1f9852(ut[_0x36fe('0x31')](_0x36fe('0xed'),_0x55312a,_0x3b70aa));}});};Preview[_0x36fe('0x37')][_0x36fe('0x73')]=function(_0x415de0){return!_[_0x36fe('0x42')](_0x415de0)&&!_[_0x36fe('0x42')](_0x415de0[_0x36fe('0x2a')])&&!_[_0x36fe('0x42')](_0x415de0['active'])&&_0x415de0[_0x36fe('0xee')]&&!_[_0x36fe('0x42')](this[_0x36fe('0x15')][util[_0x36fe('0x28')](_0x36fe('0xef'),_0x415de0[_0x36fe('0x2a')])])&&!_['isNil'](this[_0x36fe('0x15')][util[_0x36fe('0x28')](_0x36fe('0xef'),_0x415de0['name'])][_0x36fe('0x50')])&&(this[_0x36fe('0x15')][util[_0x36fe('0x28')](_0x36fe('0xef'),_0x415de0['name'])]['status']==='reachable'||this['trunks'][util['format']('SIP/%s',_0x415de0['name'])]['status']===_0x36fe('0xf0'));};Preview[_0x36fe('0x37')][_0x36fe('0x5e')]=function(_0x3571e0,_0x577cf4){return this[_0x36fe('0xf1')](_0x3571e0,_0x577cf4)[_0x36fe('0x58')](function(_0x2648a0){return _[_0x36fe('0x4a')](_0x2648a0,['message']);})[_0x36fe('0x51')](function(_0x5336a7){if(_0x5336a7['unlock']){rpcDb[_0x36fe('0xf2')](_0x3571e0);}if(_0x5336a7[_0x36fe('0xee')]){rpcDb[_0x36fe('0xf3')](_0x3571e0);}throw _[_0x36fe('0x4a')](_0x5336a7,[_0x36fe('0x31')]);});};Preview['prototype']['execRun']=function(_0xd1910c,_0x51eb3c){var _0x522a62=this;var _0x2384b3,_0x5c3e65;return rpcDb[_0x36fe('0xf4')](_0xd1910c)[_0x36fe('0x58')](function(_0x282d5e){if(!_[_0x36fe('0x42')](_0x282d5e[0x0])){_0x5c3e65=_0x282d5e[0x0][_0x36fe('0xf5')]?![]:!![];_0x2384b3=_0x282d5e[0x0][_0x36fe('0xf5')]?!![]:![];_0x2384b3=_0x51eb3c?!![]:_0x2384b3;}var _0x1473f7=_0x522a62['validateContact'](_0x282d5e);if(_0x1473f7[_0x36fe('0xf6')]){rpcDb[_0x36fe('0xf7')](_['pick'](_0x282d5e[0x0],[_0x36fe('0x4d'),_0x36fe('0xde')]))[_0x36fe('0x58')](function(_0x4f2d06){_0x522a62[_0x36fe('0xdd')](_0x4f2d06,_0x282d5e[0x0],_0x51eb3c,_0x5c3e65,_0x2384b3)[_0x36fe('0x58')](function(_0x2f6731){return _0x2f6731;})[_0x36fe('0x51')](function(_0x24e4a9){throw _0x24e4a9;});})[_0x36fe('0x51')](function(_0x160bb4){ut['logger'](_0x36fe('0xf8'),_0x160bb4);throw ut[_0x36fe('0x31')](_0x36fe('0xf9'),_0x5c3e65,_0x2384b3);});}else{throw ut['message'](_0x1473f7[_0x36fe('0x31')],_0x5c3e65,_0x2384b3);}})[_0x36fe('0x51')](function(_0x33b387){ut[_0x36fe('0x33')](_0x36fe('0xfa'),_0x33b387);throw ut[_0x36fe('0x31')](_0x36fe('0xf9'),![],!![]);});};Preview[_0x36fe('0x37')][_0x36fe('0xfb')]=function(_0x21bbf2){if(_[_0x36fe('0x42')](_0x21bbf2)||_[_0x36fe('0xe1')](_0x21bbf2)||!_[_0x36fe('0x42')](_0x21bbf2[0x0][_0x36fe('0x5c')])&&_[_0x36fe('0x42')](_0x21bbf2[0x0]['Agent'][_0x36fe('0x2a')])){ut['logger'](_0x36fe('0xfc'),_0x21bbf2);return{'isValid':![],'message':_0x36fe('0xfd')};}var _0x4d6467=this[_0x36fe('0x13')][_0x21bbf2[0x0][_0x36fe('0x45')][_0x36fe('0x2a')]];_0x4d6467[_0x36fe('0x31')]=utils['CAMPAIGN_STATUS'][_0x36fe('0x75')];if(_['isNil'](_0x4d6467)){ut['logger'](_0x36fe('0xfe'),_0x4d6467);return{'isValid':![],'message':_0x36fe('0xff')};}if(!this[_0x36fe('0x73')](_0x4d6467[_0x36fe('0x100')])){ut['logger'](_0x36fe('0x101'),'campaign\x20Name:\x20'+_0x4d6467[_0x36fe('0x2a')]+_0x36fe('0x102'));if(!this[_0x36fe('0x73')](_0x4d6467['TrunkBackup'])){ut[_0x36fe('0x33')](_0x36fe('0x101'),_0x4d6467[_0x36fe('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x36fe('0x103')](_0x4d6467[_0x36fe('0x104')])){ut[_0x36fe('0x33')](_0x36fe('0x105'),_0x4d6467[_0x36fe('0x2a')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x36fe('0x106')+_0x4d6467[_0x36fe('0x2a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x36fe('0x37')]['execCall']=function(_0xcc8d8f,_0x16a341,_0x2ab818,_0x1886f9){var _0x3d622b=this;return new Promise(function(_0x3bd049,_0x48bd7e){var _0x52664c=_0xcc8d8f[_0x36fe('0x8d')];var _0x2ce4de=_0x3d622b[_0x36fe('0x73')](_0x16a341['Trunk'])?util[_0x36fe('0x28')](_0x36fe('0x107'),_0x16a341['Trunk'][_0x36fe('0x2a')],_[_0x36fe('0x42')](_0x16a341['dialPrefix'])?'':_0x16a341[_0x36fe('0x108')][_0x36fe('0x109')]()||'',_0x16a341[_0x36fe('0x10a')]>0x0?_0x2ab818[_0x36fe('0xde')][_0x36fe('0x10b')](_0x16a341[_0x36fe('0x10a')]):_0x2ab818[_0x36fe('0xde')]):util[_0x36fe('0x28')]('SIP/%s/%s%s',_[_0x36fe('0x42')](_0x16a341[_0x36fe('0x10c')])?_0x16a341[_0x36fe('0x100')]['name']:_0x16a341['TrunkBackup'][_0x36fe('0x2a')],_[_0x36fe('0x42')](_0x16a341['dialPrefix'])?'':_0x16a341[_0x36fe('0x108')][_0x36fe('0x109')]()||'',_0x16a341[_0x36fe('0x10a')]>0x0?_0x2ab818[_0x36fe('0xde')][_0x36fe('0x10b')](_0x16a341[_0x36fe('0x10a')]):_0x2ab818[_0x36fe('0xde')]);var _0x3a7e1d=_0x3d622b['isTrunkReachable'](_0x16a341[_0x36fe('0x100')])?ut[_0x36fe('0x10d')](_0x16a341[_0x36fe('0x100')][_0x36fe('0x10e')],_0x16a341[_0x36fe('0x10f')],_0x16a341[_0x36fe('0x110')]>0x0?ut[_0x36fe('0x111')](_0x16a341[_0x36fe('0x112')],_0x16a341[_0x36fe('0x110')]):_0x16a341[_0x36fe('0x112')]):ut[_0x36fe('0x10d')](_['isNil'](_0x16a341['TrunkBackup'])?_0x16a341[_0x36fe('0x100')][_0x36fe('0x10e')]:_0x16a341[_0x36fe('0x10c')]['callerid'],_0x16a341[_0x36fe('0x10f')],_0x16a341['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x16a341[_0x36fe('0x112')],_0x16a341['dialRandomLastDigitCallerIdNumber']):_0x16a341['dialOriginateCallerIdNumber']);if(_0x3a7e1d){_0xcc8d8f['originatecalleridname']=ut[_0x36fe('0x113')](_0x3a7e1d);_0xcc8d8f[_0x36fe('0x114')]=ut[_0x36fe('0x115')](_0x3a7e1d);}var _0x29131e=ut['addVariables'](_0x16a341,_0x2ab818,_0x2ce4de,_0x3a7e1d,_0x52664c,_0xcc8d8f);var _0x5a9280=utils[_0x36fe('0x116')](_0x2ab818[_0x36fe('0x117')]);Object[_0x36fe('0x118')](_0x29131e,_0x5a9280);_['merge'](_0xcc8d8f,ut[_0x36fe('0x119')](_0x29131e));_0xcc8d8f['starttime']=moment()['format'](_0x36fe('0x62'));_0x16a341[_0x36fe('0x11a')]=_0x29131e;var _0x49243d=ut['variablesAction'](_0xcc8d8f,_0x16a341,_0x29131e,_0xcc8d8f[_0x36fe('0xa6')],_0x1886f9);return ami[_0x36fe('0x4f')](_0x49243d)[_0x36fe('0x58')](function(_0x2252d2){_0x16a341['originated']+=0x1;logger[_0x36fe('0x25')](_0x36fe('0x11b'),_0x52664c,_0x36fe('0x8e'),_0x16a341['name'],_0x36fe('0x47'),_0x16a341['originated']);_0x3bd049(_0x2252d2);})[_0x36fe('0x51')](function(_0x1fc88c){ut['logAgent'](_0xcc8d8f,0xe,_0x36fe('0x11c'));rpcDb[_0x36fe('0xd0')](_0xcc8d8f,_0x36fe('0x11d'));_0x48bd7e(_0x1fc88c);});});};Preview[_0x36fe('0x37')][_0x36fe('0x1d')]=function(_0x50b52b){if(this[_0x36fe('0x43')][_0x50b52b['linkedid']]){this[_0x36fe('0x43')][_0x50b52b[_0x36fe('0x86')]]['channel']=_0x50b52b[_0x36fe('0x11e')];}};Preview['prototype'][_0x36fe('0x19')]=function(_0x10fc13){var _0x50ec43=this;var _0x3f5957=this[_0x36fe('0x43')][_0x10fc13[_0x36fe('0x11f')]];if(_0x3f5957){if(_0x3f5957[_0x36fe('0xe0')]&&this['agents'][_0x3f5957[_0x36fe('0xe0')]]){ut[_0x36fe('0x120')](_0x3f5957,this[_0x36fe('0x16')][_0x3f5957[_0x36fe('0xe0')]][_0x36fe('0x2a')],this[_0x36fe('0x16')][_0x3f5957[_0x36fe('0xe0')]]['id']);}var _0x5b57e5=_['clone'](_0x3f5957);_0x5b57e5['responsetime']=moment()[_0x36fe('0x28')](_0x36fe('0x62'));var _0x1aa8e7=_0x50ec43[_0x36fe('0x13')][_0x3f5957[_0x36fe('0x46')]];if(ut['isFailure'](_0x10fc13[_0x36fe('0x121')])){if(_0x3f5957['unlockAgent']){rpcDb[_0x36fe('0xf2')](_0x3f5957[_0x36fe('0x87')]);}if(_0x3f5957['activeContact']){rpcDb[_0x36fe('0xf3')](_0x3f5957[_0x36fe('0x87')]);}ami[_0x36fe('0x24')](_0x36fe('0x122'),ut[_0x36fe('0x90')](_0x3f5957,_0x36fe('0x123'),this[_0x36fe('0x13')][_0x3f5957[_0x36fe('0x46')]]));this[_0x36fe('0x124')](_0x5b57e5,_0x1aa8e7,_0x10fc13);}else{_0x3f5957[_0x36fe('0x61')]=moment()[_0x36fe('0x28')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x36fe('0xcf')](_0x5b57e5,0x4,_0x36fe('0x125'));rpcDb[_0x36fe('0xd0')](_0x5b57e5,_0x36fe('0x126'));}}};Preview[_0x36fe('0x37')][_0x36fe('0x127')]=function(_0x43666b){var _0x45a618=this[_0x36fe('0x43')][_0x43666b[_0x36fe('0x86')]];var _0x5cdd7b;if(_0x45a618){_0x5cdd7b=this[_0x36fe('0x13')][_0x45a618[_0x36fe('0x46')]];logger[_0x36fe('0x25')](_0x36fe('0x128'),_0x43666b['linkedid'],_0x36fe('0x8e'),_0x5cdd7b['name'],'pTalking:\x20',_0x5cdd7b[_0x36fe('0x2e')]);}if(this[_0x36fe('0x43')][_0x43666b['linkedid']]&&_0x43666b[_0x36fe('0x86')]!==_0x43666b['uniqueid']){if(_0x43666b[_0x36fe('0x129')]==='16'&&this[_0x36fe('0x43')][_0x43666b['linkedid']][_0x36fe('0x49')]){this['callProgressDetectingCustomer'](_0x43666b,_0x43666b['linkedid'],_0x43666b['cause']);}else if(this[_0x36fe('0x43')][_0x43666b[_0x36fe('0x86')]][_0x36fe('0x49')]){logger[_0x36fe('0x25')](_0x36fe('0x12a'),_0x43666b[_0x36fe('0x86')],_0x43666b[_0x36fe('0x129')],_0x36fe('0x8e'),_0x5cdd7b['name'],'pTalking:\x20',_0x5cdd7b['pTalking']);this[_0x36fe('0x76')](_0x43666b,_0x43666b[_0x36fe('0x86')],_0x43666b[_0x36fe('0x129')]);}}else if(_0x45a618&&_[_0x36fe('0x42')](_0x45a618[_0x36fe('0x12b')])&&_0x5cdd7b[_0x36fe('0x12c')]&&_0x43666b[_0x36fe('0x86')]===_0x43666b[_0x36fe('0x8d')]&&_['isNil'](_0x43666b[_0x36fe('0xd7')])&&_0x43666b[_0x36fe('0x129')]==='16'&&_0x43666b['channelstate']==='6'&&_[_0x36fe('0xcd')](_0x45a618[_0x36fe('0x12d')])){if(_0x45a618['unlockAgent']){rpcDb['unlockContact'](_0x45a618['idContact']);}if(_0x45a618[_0x36fe('0xa6')]){rpcDb[_0x36fe('0xf3')](_0x45a618[_0x36fe('0x87')]);}_0x43666b['reason']='22';this['callProgressDetectingAgent'](_0x45a618,_0x5cdd7b,_0x43666b);}else if(_0x45a618&&_0x45a618[_0x36fe('0x12d')]){if(_0x43666b[_0x36fe('0x129')]==='16'&&this[_0x36fe('0x43')][_0x43666b[_0x36fe('0x86')]]['dialAnswer']){logger['info'](_0x36fe('0x12e'),_0x43666b[_0x36fe('0x86')],_0x43666b['cause'],_0x36fe('0x8e'),_0x5cdd7b[_0x36fe('0x2a')],'pTalking:\x20',_0x5cdd7b[_0x36fe('0x2e')]);this[_0x36fe('0x76')](_0x43666b,_0x43666b['linkedid'],_0x43666b[_0x36fe('0x129')]);}else if(this['actions'][_0x43666b['linkedid']][_0x36fe('0x49')]){logger['info']('[syncHangup][talking][cause]',_0x43666b[_0x36fe('0x86')],_0x43666b[_0x36fe('0x129')],_0x36fe('0x8e'),_0x5cdd7b[_0x36fe('0x2a')],_0x36fe('0x48'),_0x5cdd7b[_0x36fe('0x2e')]);this[_0x36fe('0x76')](_0x43666b,_0x43666b[_0x36fe('0x86')],_0x43666b[_0x36fe('0x129')]);}}};Preview[_0x36fe('0x37')][_0x36fe('0x12f')]=function(_0x4eecd3){if(this[_0x36fe('0x43')][_0x4eecd3[_0x36fe('0xcb')]]&&_0x4eecd3[_0x36fe('0xcb')]!==_0x4eecd3[_0x36fe('0x130')]){this['callProgressDetectingCustomer'](_0x4eecd3,_0x4eecd3[_0x36fe('0xcb')],_0x4eecd3[_0x36fe('0xc4')]);}};Preview['prototype']['syncHangupRequest']=function(_0x3da2df){if(this[_0x36fe('0x43')][_0x3da2df[_0x36fe('0x86')]]&&_0x3da2df[_0x36fe('0x86')]!==_0x3da2df['uniqueid']&&!this[_0x36fe('0x43')][_0x3da2df['linkedid']][_0x36fe('0x49')]){if(_0x3da2df['cause']==='1'){this[_0x36fe('0x76')](_0x3da2df,_0x3da2df['linkedid'],_0x3da2df[_0x36fe('0x129')]);}}};Preview[_0x36fe('0x37')][_0x36fe('0x131')]=function(_0x97b2cf,_0x4d5002,_0x5e8eb8){if(this[_0x36fe('0x43')][_0x97b2cf]){if(_[_0x36fe('0x42')](this[_0x36fe('0x43')][_0x97b2cf][_0x36fe('0x11a')])){this[_0x36fe('0x43')][_0x97b2cf][_0x36fe('0x11a')]={};}this[_0x36fe('0x43')][_0x97b2cf][_0x36fe('0x11a')][_0x4d5002]=_0x5e8eb8;}};Preview[_0x36fe('0x37')]['syncVarSet']=function(_0x46de26){try{if(!_[_0x36fe('0x42')](_0x46de26)){if(ut['filterKey'](_['keys'](_0x46de26[_0x36fe('0x132')])[0x0])){this['addVariable'](_0x46de26[_0x36fe('0x8d')],_[_0x36fe('0x133')](_0x46de26['variable'])[0x0],_0x46de26[_0x36fe('0x134')]);}}}catch(_0x1f0524){logger[_0x36fe('0x135')](_0x36fe('0x136'),util['inspect'](_0x1f0524,{'showHidden':![],'depth':null}));}};Preview[_0x36fe('0x37')][_0x36fe('0x21')]=function(_0x5ba189){if(_0x5ba189){if(this[_0x36fe('0x43')][_0x5ba189['transfertargetlinkedid']]){this['actions'][_0x5ba189[_0x36fe('0x137')]]['transfer']=!![];}}};Preview[_0x36fe('0x37')]['syncBlindTransfer']=function(_0x7b4720){if(_0x7b4720){if(this[_0x36fe('0x43')][_0x7b4720[_0x36fe('0x138')]]){this[_0x36fe('0x43')][_0x7b4720['transfererlinkedid']][_0x36fe('0x12d')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ddc5ae2..e02c2bb 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 _0x6b57=['active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','resolve','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','then','getContactPreview','createCustomerHistory','createCustomerFinal','UserId'];(function(_0x8e2d4d,_0x310930){var _0x5e3047=function(_0x4665e4){while(--_0x4665e4){_0x8e2d4d['push'](_0x8e2d4d['shift']());}};_0x5e3047(++_0x310930);}(_0x6b57,0x1aa));var _0x76b5=function(_0x508abe,_0x37d20c){_0x508abe=_0x508abe-0x0;var _0x23d357=_0x6b57[_0x508abe];return _0x23d357;};'use strict';var util=require(_0x76b5('0x0'));var BPromise=require(_0x76b5('0x1'));var logger=require('../../../config/logger')(_0x76b5('0x2'));var cmHopper=require(_0x76b5('0x3'));var cmHopperHistory=require(_0x76b5('0x4'));var cmHopperBlack=require(_0x76b5('0x5'));var agentReportPreview=require(_0x76b5('0x6'));var voiceQueueReport=require(_0x76b5('0x7'));function loggerCatch(_0x28ede2){return function(_0x51e55a){logger[_0x76b5('0x8')](_0x28ede2,util[_0x76b5('0x9')](_0x51e55a,{'showHidden':![],'depth':null}));};}function create(_0x410d0a){return cmHopperHistory[_0x76b5('0xa')](_0x410d0a)[_0x76b5('0xb')](loggerCatch(_0x76b5('0xc')));}function createAgent(_0x5ebaa2){return BPromise['resolve']()['then'](agentReportPreview[_0x76b5('0xa')](_0x5ebaa2))[_0x76b5('0xb')](loggerCatch(_0x76b5('0xc')));}function moveContact(_0x2a6aee){return cmHopper[_0x76b5('0xd')](_0x2a6aee,!![])[_0x76b5('0xb')](loggerCatch(_0x76b5('0xe')));}exports['checkIsBlackList']=function(_0x59a104){return cmHopperBlack[_0x76b5('0xf')](_0x59a104)[_0x76b5('0xb')](loggerCatch(_0x76b5('0x10')));};exports['getContactPreview']=function(_0x562bad){return BPromise['resolve']()[_0x76b5('0x11')](cmHopper[_0x76b5('0x12')](_0x562bad))[_0x76b5('0xb')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x4f7ac0,_0x3834d0){create(_0x4f7ac0)[_0x76b5('0xb')](loggerCatch(_0x3834d0));moveContact(_0x4f7ac0)[_0x76b5('0xb')](loggerCatch(_0x3834d0));};exports['createAgentHistory']=function(_0x1dc0a9,_0x52157d){createAgent(_0x1dc0a9)[_0x76b5('0xb')](loggerCatch(_0x52157d));};exports[_0x76b5('0x13')]=function(_0x49ec55,_0x43785d){create(_0x49ec55)[_0x76b5('0xb')](loggerCatch(_0x43785d));};exports[_0x76b5('0x14')]=function(_0x52d114,_0x38c1bf){moveContact(_0x52d114)[_0x76b5('0xb')](loggerCatch(_0x38c1bf));};exports['rescheduleContact']=function(_0xd111ef,_0x3f4b25,_0x277a6b){if(_0x3f4b25){_0xd111ef[_0x76b5('0x15')]=null;}if(_0x277a6b){_0xd111ef[_0x76b5('0x16')]=![];}return cmHopper[_0x76b5('0x17')](_0xd111ef)[_0x76b5('0xb')](loggerCatch(_0x76b5('0x18')));};exports[_0x76b5('0x19')]=function(_0x40de24){return cmHopper[_0x76b5('0x19')](_0x40de24)[_0x76b5('0xb')](loggerCatch(_0x76b5('0x1a')));};exports[_0x76b5('0x1b')]=function(_0x450e59){return cmHopper[_0x76b5('0x1b')]({'UserId':null},_0x450e59,0x1)[_0x76b5('0xb')](loggerCatch(_0x76b5('0x1c')));};exports[_0x76b5('0x1d')]=function(_0xc23f15){return cmHopper[_0x76b5('0x1b')]({'active':![]},_0xc23f15,0x1)[_0x76b5('0xb')](loggerCatch(_0x76b5('0x1e')));};exports[_0x76b5('0x1f')]=function(_0x4ba118){var _0x51f8cc={};_0x51f8cc[_0x76b5('0x20')]=_0x4ba118[_0x76b5('0x20')];_0x51f8cc[_0x76b5('0x21')]=_0x4ba118['uniqueid'];_0x51f8cc[_0x76b5('0x22')]=_0x4ba118['calleridnum'];_0x51f8cc[_0x76b5('0x23')]=_0x4ba118[_0x76b5('0x23')];_0x51f8cc['queue']=_0x4ba118[_0x76b5('0x24')];_0x51f8cc[_0x76b5('0x25')]=_0x4ba118[_0x76b5('0x26')];_0x51f8cc[_0x76b5('0x27')]=_0x4ba118['answertime'];_0x51f8cc[_0x76b5('0x28')]=0x1;_0x51f8cc['queuecallercompleteAt']=_0x4ba118[_0x76b5('0x29')];_0x51f8cc[_0x76b5('0x2a')]=_0x4ba118['membername'];_0x51f8cc[_0x76b5('0x2b')]='from-sip';_0x51f8cc['exten']=_0x76b5('0x2c');_0x51f8cc[_0x76b5('0x2d')]=0x0;_0x51f8cc[_0x76b5('0x2e')]=0x1;_0x51f8cc[_0x76b5('0x2f')]=_0x4ba118[_0x76b5('0x30')];_0x51f8cc['queuecallerexitreason']=_0x76b5('0x31');return BPromise['resolve']()[_0x76b5('0x11')](voiceQueueReport['create'](_0x51f8cc))[_0x76b5('0xb')](loggerCatch(_0x76b5('0x32')));};exports[_0x76b5('0x33')]=function(_0x5cf379,_0x2ec582){return BPromise[_0x76b5('0x34')]()['then'](cmHopper[_0x76b5('0x33')](_0x5cf379,_0x2ec582))['catch'](loggerCatch(_0x76b5('0x35')));};exports[_0x76b5('0x36')]=function(_0x55a457){return cmHopper[_0x76b5('0x17')](_0x55a457,!![],!![])[_0x76b5('0xb')](loggerCatch(_0x76b5('0x37')));}; \ No newline at end of file +var _0x8864=['holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview'];(function(_0x2a236c,_0x4ea8c9){var _0x1c0ebc=function(_0x23c484){while(--_0x23c484){_0x2a236c['push'](_0x2a236c['shift']());}};_0x1c0ebc(++_0x4ea8c9);}(_0x8864,0x14d));var _0x4886=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0x8864[_0x58eec7];return _0x25c5d3;};'use strict';var util=require('util');var BPromise=require(_0x4886('0x0'));var logger=require(_0x4886('0x1'))(_0x4886('0x2'));var cmHopper=require(_0x4886('0x3'));var cmHopperHistory=require(_0x4886('0x4'));var cmHopperBlack=require(_0x4886('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x4886('0x6'));function loggerCatch(_0x1153e9){return function(_0x181078){logger[_0x4886('0x7')](_0x1153e9,util['inspect'](_0x181078,{'showHidden':![],'depth':null}));};}function create(_0x33ae58){return cmHopperHistory[_0x4886('0x8')](_0x33ae58)[_0x4886('0x9')](loggerCatch(_0x4886('0xa')));}function createAgent(_0x341568){return BPromise[_0x4886('0xb')]()[_0x4886('0xc')](agentReportPreview[_0x4886('0x8')](_0x341568))[_0x4886('0x9')](loggerCatch(_0x4886('0xa')));}function moveContact(_0xf22858){return cmHopper[_0x4886('0xd')](_0xf22858,!![])[_0x4886('0x9')](loggerCatch(_0x4886('0xe')));}exports[_0x4886('0xf')]=function(_0x38a38d){return cmHopperBlack[_0x4886('0xf')](_0x38a38d)['catch'](loggerCatch(_0x4886('0x10')));};exports[_0x4886('0x11')]=function(_0x350c82){return BPromise['resolve']()[_0x4886('0xc')](cmHopper[_0x4886('0x11')](_0x350c82))['catch'](loggerCatch(_0x4886('0x12')));};exports[_0x4886('0x8')]=function(_0x3d3549,_0x319259){create(_0x3d3549)[_0x4886('0x9')](loggerCatch(_0x319259));moveContact(_0x3d3549)[_0x4886('0x9')](loggerCatch(_0x319259));};exports[_0x4886('0x13')]=function(_0x5f47c2,_0x3cbe28){createAgent(_0x5f47c2)[_0x4886('0x9')](loggerCatch(_0x3cbe28));};exports['createCustomerHistory']=function(_0x128c0f,_0x2476b8){create(_0x128c0f)['catch'](loggerCatch(_0x2476b8));};exports[_0x4886('0x14')]=function(_0x2df9c5,_0x2a7e70){moveContact(_0x2df9c5)['catch'](loggerCatch(_0x2a7e70));};exports[_0x4886('0x15')]=function(_0x276702,_0x150336,_0x59c356){if(_0x150336){_0x276702[_0x4886('0x16')]=null;}if(_0x59c356){_0x276702['active']=![];}return cmHopper[_0x4886('0x15')](_0x276702)[_0x4886('0x9')](loggerCatch(_0x4886('0x17')));};exports[_0x4886('0x18')]=function(_0x4e30d0){return cmHopper[_0x4886('0x18')](_0x4e30d0)[_0x4886('0x9')](loggerCatch(_0x4886('0x19')));};exports[_0x4886('0x1a')]=function(_0x3b498c){return cmHopper[_0x4886('0x1a')]({'UserId':null},_0x3b498c,0x1)[_0x4886('0x9')](loggerCatch(_0x4886('0x1b')));};exports[_0x4886('0x1c')]=function(_0x10a949){return cmHopper[_0x4886('0x1a')]({'active':![]},_0x10a949,0x1)['catch'](loggerCatch(_0x4886('0x1d')));};exports[_0x4886('0x1e')]=function(_0x55602d){var _0x14cc0e={};_0x14cc0e['type']=_0x55602d['type'];_0x14cc0e[_0x4886('0x1f')]=_0x55602d[_0x4886('0x1f')];_0x14cc0e[_0x4886('0x20')]=_0x55602d[_0x4886('0x20')];_0x14cc0e[_0x4886('0x21')]=_0x55602d[_0x4886('0x21')];_0x14cc0e[_0x4886('0x22')]=_0x55602d['queue'];_0x14cc0e['queuecallerjoinAt']=_0x55602d['answertime'];_0x14cc0e[_0x4886('0x23')]=_0x55602d[_0x4886('0x24')];_0x14cc0e[_0x4886('0x25')]=0x1;_0x14cc0e[_0x4886('0x26')]=_0x55602d[_0x4886('0x27')];_0x14cc0e[_0x4886('0x28')]=_0x55602d[_0x4886('0x29')];_0x14cc0e[_0x4886('0x2a')]=_0x4886('0x2b');_0x14cc0e['exten']=_0x4886('0x2c');_0x14cc0e[_0x4886('0x2d')]=0x0;_0x14cc0e[_0x4886('0x2e')]=0x1;_0x14cc0e[_0x4886('0x2f')]=_0x55602d[_0x4886('0x29')];_0x14cc0e[_0x4886('0x30')]=_0x4886('0x31');return BPromise[_0x4886('0xb')]()['then'](voiceQueueReport[_0x4886('0x32')](_0x14cc0e))[_0x4886('0x9')](loggerCatch(_0x4886('0x33')));};exports[_0x4886('0x34')]=function(_0x2c51ab,_0x5f2450){return BPromise[_0x4886('0xb')]()[_0x4886('0xc')](cmHopper[_0x4886('0x34')](_0x2c51ab,_0x5f2450))['catch'](loggerCatch(_0x4886('0x35')));};exports['rescheduleContactInQueue']=function(_0x38868c){return cmHopper[_0x4886('0x15')](_0x38868c,!![],!![])[_0x4886('0x9')](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 6e58ba5..19afbf3 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 _0xbb24=['xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','extractCalleridNumber','match','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','scheduledAt','active','minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','name','queue','motionChannel','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','seconds','CampaignId','idContact','campaigntype','scheduledat','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0xbb24,0x1ad));var _0x4bb2=function(_0x55e18d,_0x4ef686){_0x55e18d=_0x55e18d-0x0;var _0x42d6e8=_0xbb24[_0x55e18d];return _0x42d6e8;};'use strict';var util=require(_0x4bb2('0x0'));var _=require(_0x4bb2('0x1'));var moment=require('moment');var logger=require(_0x4bb2('0x2'))(_0x4bb2('0x3'));var ipAgi=process[_0x4bb2('0x4')][_0x4bb2('0x5')]||_0x4bb2('0x6');var utils=require(_0x4bb2('0x7'));exports[_0x4bb2('0x8')]=function(_0x20f414){return function(_0x4c4626){logger[_0x4bb2('0x9')](_0x20f414,util['inspect'](_0x4c4626,{'showHidden':![],'depth':null}));};};exports[_0x4bb2('0xa')]=function(_0x2991e1,_0x51a1f9){logger[_0x4bb2('0xb')](_0x2991e1,util[_0x4bb2('0xc')](_0x51a1f9,{'showHidden':![],'depth':null}));};exports[_0x4bb2('0xd')]=function(_0xfd30a5,_0xeb4a39){logger[_0x4bb2('0x9')](_0xfd30a5,util[_0x4bb2('0xc')](_0xeb4a39,{'showHidden':![],'depth':null}));};exports[_0x4bb2('0xe')]=function(_0x317a28){return function(_0x5723ff){logger[_0x4bb2('0xb')](_0x317a28,util[_0x4bb2('0xc')](_0x5723ff,{'showHidden':![],'depth':null}));};};exports[_0x4bb2('0xf')]=function(_0x5c0b54,_0x3c0a9f,_0x15a12d){return{'message':_0x5c0b54,'unlock':_0x3c0a9f,'active':_0x15a12d};};exports[_0x4bb2('0x10')]=function(_0x564a9c,_0x5d8835,_0x4c7e2e){if(!_[_0x4bb2('0x11')](_0x4c7e2e)&&_0x4bb2('0x12')===typeof _0x4c7e2e&&!_[_0x4bb2('0x13')](_0x4c7e2e)){if(!_[_0x4bb2('0x11')](_0x5d8835)&&_0x4bb2('0x12')===typeof _0x5d8835&&!_[_0x4bb2('0x13')](_0x5d8835)){return util[_0x4bb2('0x14')](_0x4bb2('0x15'),_0x5d8835,_0x4c7e2e);}return util['format'](_0x4bb2('0x15'),_0x4c7e2e,_0x4c7e2e);}if(!_[_0x4bb2('0x11')](_0x564a9c)&&_0x4bb2('0x12')===typeof _0x564a9c&&!_['isEmpty'](_0x564a9c)){return _0x564a9c;}return'\x22\x22\x20<>';};exports[_0x4bb2('0x16')]=function(_0x36cc1d){if(_[_0x4bb2('0x17')](_0x36cc1d)){return![];}return _0x36cc1d;};exports[_0x4bb2('0x18')]=function(_0x1f275b,_0x2c4652,_0x50288e,_0x79228d,_0x45fd28,_0x59ff7d){var _0x3bb49b={'XMD-QUEUE':_0x2c4652['Queue']?_0x2c4652['Queue']['name']:'','XMD-CALLERID':_0x79228d,'XMD-CALLERID-PREVIEW':_0x59ff7d?util[_0x4bb2('0x14')](_0x4bb2('0x15'),_0x59ff7d[_0x4bb2('0x19')],_0x59ff7d[_0x4bb2('0x1a')]):_0x79228d,'XMD-DIALID':_0x45fd28,'XMD-CONTACTID':_0x2c4652[_0x4bb2('0x1b')],'XMD-CDRTYPE':_0x4bb2('0x1c'),'CALLERID(all)':_0x79228d,'XMD-VOICEQUEUEID':_0x2c4652[_0x4bb2('0x1d')],'XMD-DIALCHANNEL':_0x50288e,'XMD-DIALTIMEOUT':_0x1f275b[_0x4bb2('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x4bb2('0x14')](_0x4bb2('0x1f'),_0x1f275b[_0x4bb2('0x20')]?'g':'',_[_0x4bb2('0x13')](_0x1f275b[_0x4bb2('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1f275b['dialPreviewUrl']||'','XMD-AGI':_0x1f275b[_0x4bb2('0x22')]?util[_0x4bb2('0x14')](_0x4bb2('0x23'),ipAgi,_0x1f275b[_0x4bb2('0x22')]):'NONE','XMD-AGIAFTER':_0x1f275b[_0x4bb2('0x20')]?util['format'](_0x4bb2('0x23'),ipAgi,_0x1f275b['dialQueueProject2']):_0x4bb2('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x59ff7d?_0x59ff7d[_0x4bb2('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x59ff7d?_0x59ff7d['originatecalleridname']:'','XMD-DESTINATION':_0x4bb2('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x4bb2('0x13')](_0x1f275b[_0x4bb2('0x21')])){_0x3bb49b[util[_0x4bb2('0x14')]('%s',_0x4bb2('0x27'))]=_0x1f275b['monitor_format'];_0x3bb49b[util[_0x4bb2('0x14')]('%s',_0x4bb2('0x28'))]=_0x45fd28;}return _0x3bb49b;};exports[_0x4bb2('0x29')]=function(_0x4d0268){var _0x18dbcb={};for(var _0x5c0cdd in _0x4d0268){if(_0x4d0268['hasOwnProperty'](_0x5c0cdd)){_0x18dbcb[util[_0x4bb2('0x14')]('%s',_['toLower'](_0x5c0cdd))]=_0x4d0268[_0x5c0cdd];}}return{'variables':_0x18dbcb};};exports[_0x4bb2('0x2a')]=function(_0x38e8a4,_0x519080){if(!_['isNil'](_0x38e8a4)){if(_0x38e8a4[_0x4bb2('0x2b')](_0x4bb2('0x2c'))){if(_0x38e8a4[_0x4bb2('0x2c')]>0x0){_0x38e8a4['originated']-=0x1;}else{logger[_0x4bb2('0x9')](_0x4bb2('0x2d'),_0x519080);}}}else{logger[_0x4bb2('0x9')](_0x4bb2('0x2e'),_0x519080);}};exports[_0x4bb2('0x2f')]=function(_0xeb4b28){var _0x59c800=moment()[_0x4bb2('0x14')](_0x4bb2('0x30'));_0xeb4b28[_0x4bb2('0x31')]=0xd;_0xeb4b28[_0x4bb2('0x32')]=_0x4bb2('0x33');_0xeb4b28[_0x4bb2('0x34')]=_0x59c800;_0xeb4b28[_0x4bb2('0x35')]=_0x59c800;_0xeb4b28[_0x4bb2('0x36')]=_0x59c800;};exports[_0x4bb2('0x37')]=function(_0x3fbb30,_0x4b03d7,_0x561701){var _0x397c74=moment()['format'](_0x4bb2('0x30'));_0x3fbb30[_0x4bb2('0x31')]=_0x4b03d7;_0x3fbb30[_0x4bb2('0x32')]=_0x561701;_0x3fbb30['responsetime']=_0x397c74;_0x3fbb30[_0x4bb2('0x38')]=utils[_0x4bb2('0x39')](_0x3fbb30[_0x4bb2('0x35')],_0x3fbb30[_0x4bb2('0x34')]);};exports[_0x4bb2('0x3a')]=function(_0x10fa93,_0x39bbf6,_0x22bbb5){_0x10fa93[_0x4bb2('0x3b')]=_0x39bbf6;_0x10fa93[_0x4bb2('0x3c')]=_0x22bbb5;};exports[_0x4bb2('0x3d')]=function(_0x2fe737,_0xc3b08c,_0x19f110){var _0x5d0b8f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2fe737['state']=_0xc3b08c;_0x2fe737[_0x4bb2('0x32')]=_0x19f110;_0x2fe737[_0x4bb2('0x35')]=_0x2fe737[_0x4bb2('0x35')]?_0x2fe737['responsetime']:_0x5d0b8f;_0x2fe737['endtime']=_0x2fe737['endtime']?_0x2fe737[_0x4bb2('0x36')]:_0x5d0b8f;_0x2fe737['ringtime']=utils[_0x4bb2('0x39')](_0x2fe737[_0x4bb2('0x35')]||0x0,_0x2fe737[_0x4bb2('0x34')]||0x0);_0x2fe737[_0x4bb2('0x3e')]=_0x2fe737[_0x4bb2('0x3f')]?utils[_0x4bb2('0x39')](_0x2fe737[_0x4bb2('0x36')],_0x2fe737['answertime']):0x0;};exports['isFailure']=function(_0x258694){return _0x258694==='Failure';};exports[_0x4bb2('0x40')]=function(_0x2e0bfc,_0xff032b,_0x2e7969,_0x42a540,_0x2a6b98){var _0x471bd8=_0x42a540?_0x4bb2('0x41'):_0x2e0bfc[_0x4bb2('0x19')];_0x471bd8=_0x2a6b98?_0x4bb2('0x42'):_0x471bd8;return{'actionid':_0x2e0bfc[_0x4bb2('0x43')],'action':_0x4bb2('0x44'),'channel':_0x2e0bfc[_0x4bb2('0x45')],'callerid':util[_0x4bb2('0x14')](_0x4bb2('0x15'),_0x471bd8,_0x2e0bfc['calleridnum']),'Exten':_0x4bb2('0x26'),'Context':_0x4bb2('0x46'),'Priority':'1','variable':_0x2e7969,'timeout':(_0xff032b[_0x4bb2('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2e0bfc['uniqueid']};};exports[_0x4bb2('0x48')]=function(_0x4f28a4){return _0x4f28a4[_0x4bb2('0x49')]+_0x4f28a4[_0x4bb2('0x4a')]+_0x4f28a4[_0x4bb2('0x4b')]+_0x4f28a4[_0x4bb2('0x4c')]+_0x4f28a4['countnosuchnumberretry'];};exports[_0x4bb2('0x4d')]=function(_0x13c867){var _0x5b2a3d=_['clone'](_0x13c867);_0x5b2a3d[_0x4bb2('0x31')]=0xf;_0x5b2a3d['statedesc']=_0x4bb2('0x4e');return _0x5b2a3d;};exports[_0x4bb2('0x4f')]=function(_0x1ffdf3,_0x22a262,_0x142bfb){var _0x3f2b8e={};_0x3f2b8e[_0x22a262]=_0x1ffdf3[_0x22a262];_0x3f2b8e[_0x4bb2('0x50')]=![];_0x3f2b8e['scheduledat']=moment()['add'](_0x142bfb,_0x4bb2('0x51'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3f2b8e[_0x4bb2('0x1b')]=_0x1ffdf3[_0x4bb2('0x1b')];_0x3f2b8e[_0x4bb2('0x52')]=_0x1ffdf3[_0x4bb2('0x52')];_0x3f2b8e[_0x4bb2('0x1d')]=_0x1ffdf3[_0x4bb2('0x1d')]||undefined;return _0x3f2b8e;};exports[_0x4bb2('0x53')]=function(_0x484426,_0x116a38){if(!_[_0x4bb2('0x17')](_0x484426)){if(_0x484426['pTalking']>0x0){_0x484426[_0x4bb2('0x54')]-=0x1;}else{logger['error'](_0x116a38,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x4bb2('0x9')](_0x116a38,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x4bb2('0x55')]=function(_0x25816c){if(_0x25816c<=0x0){return!![];}return![];};function buildObj(_0x1bbbec,_0x44432f,_0x5b8e31){_0x1bbbec[_0x4bb2('0x56')]=_0x44432f;_0x1bbbec[_0x4bb2('0x57')]=_0x1bbbec[_0x4bb2('0x58')];_0x1bbbec['interface']=_0x1bbbec[_0x4bb2('0x45')];_0x1bbbec[_0x4bb2('0x59')]='voice';if(_0x5b8e31){_0x1bbbec[_0x4bb2('0x5a')]=_0x5b8e31[_0x4bb2('0x5a')];}return _0x1bbbec;}exports[_0x4bb2('0x5b')]=buildObj;exports[_0x4bb2('0x5c')]=function(_0x1f6087){var _0x224d14={};_0x224d14[_0x4bb2('0x58')]=_0x1f6087['queue'];_0x224d14[_0x4bb2('0x5d')]=_0x1f6087[_0x4bb2('0x45')];_0x224d14[_0x4bb2('0x43')]=_0x1f6087[_0x4bb2('0x43')];return _0x224d14;};exports[_0x4bb2('0x5e')]=function(_0x3cf825){var _0x5c2c98=[];for(var _0x424c2a in _0x3cf825){if(_0x3cf825['hasOwnProperty'](_0x424c2a)){if(!_[_0x4bb2('0x17')](_0x3cf825[_0x424c2a])&&_0x3cf825[_0x424c2a][_0x4bb2('0x31')]===_0x4bb2('0x5f')&&_0x3cf825[_0x424c2a][_0x4bb2('0x60')]===_0x4bb2('0x61')){_0x5c2c98[_0x4bb2('0x62')](_0x3cf825[_0x424c2a]['id']);}}}return _0x5c2c98;};exports[_0x4bb2('0x63')]=function(_0x396e0f){var _0x4e6340=moment()['milliseconds'](0x0);var _0x5f405a=moment(_0x396e0f)['milliseconds'](0x0);return _0x4e6340[_0x4bb2('0x64')](_0x5f405a,_0x4bb2('0x65'));};exports['createBody']=function(_0x1649cf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1649cf[_0x4bb2('0x1b')],'ListId':_0x1649cf[_0x4bb2('0x52')],'VoiceQueueId':_0x1649cf[_0x4bb2('0x1d')]||undefined,'CampaignId':_0x1649cf[_0x4bb2('0x66')]||undefined};};exports['filterKey']=function(_0x3cae44){if(_0x3cae44===_0x4bb2('0x43')||_0x3cae44===_0x4bb2('0x67')||_0x3cae44===_0x4bb2('0x58')||_0x3cae44==='type'||_0x3cae44===_0x4bb2('0x68')||_0x3cae44==='dialAnswer'||_0x3cae44===_0x4bb2('0x3b')||_0x3cae44===_0x4bb2('0x45')||_0x3cae44===_0x4bb2('0x19')||_0x3cae44===_0x4bb2('0x50')||_0x3cae44==='calleridnum'||_0x3cae44===_0x4bb2('0x69')||_0x3cae44==='countbusyretry'||_0x3cae44===_0x4bb2('0x4a')||_0x3cae44===_0x4bb2('0x4b')||_0x3cae44==='countglobal'||_0x3cae44===_0x4bb2('0x6a')||_0x3cae44===_0x4bb2('0x6b')||_0x3cae44==='callbackat'||_0x3cae44===_0x4bb2('0x6c')||_0x3cae44===_0x4bb2('0x1b')||_0x3cae44==='ListId'||_0x3cae44===_0x4bb2('0x3c')||_0x3cae44===_0x4bb2('0x1d')||_0x3cae44===_0x4bb2('0x6d')||_0x3cae44===_0x4bb2('0x6e')||_0x3cae44==='xmd-queue'||_0x3cae44==='xmd-phone'||_0x3cae44==='xmd-listid'||_0x3cae44===_0x4bb2('0x6f')||_0x3cae44===_0x4bb2('0x70')||_0x3cae44===_0x4bb2('0x71')||_0x3cae44===_0x4bb2('0x72')||_0x3cae44===_0x4bb2('0x73')||_0x3cae44===_0x4bb2('0x74')||_0x3cae44==='xmd-cdrtype'||_0x3cae44===_0x4bb2('0x75')||_0x3cae44==='xmd-agiafter'||_0x3cae44===_0x4bb2('0x76')||_0x3cae44==='rtpaudioqos'||_0x3cae44==='rtpaudioqosbridged'||_0x3cae44===_0x4bb2('0x77')||_0x3cae44==='rtpaudioqosjitterbridged'||_0x3cae44==='rtpaudioqosloss'||_0x3cae44===_0x4bb2('0x78')||_0x3cae44===_0x4bb2('0x79')||_0x3cae44===_0x4bb2('0x7a')||_0x3cae44===_0x4bb2('0x7b')||_0x3cae44===_0x4bb2('0x7c')||_0x3cae44===_0x4bb2('0x77')||_0x3cae44==='rtpaudioqosjitterbridged'||_0x3cae44==='rtpaudioqosloss'||_0x3cae44===_0x4bb2('0x78')||_0x3cae44===_0x4bb2('0x79')||_0x3cae44===_0x4bb2('0x7a')||_0x3cae44==='bridgepeer'||_0x3cae44===_0x4bb2('0x7d')||_0x3cae44===_0x4bb2('0x31')||_0x3cae44===_0x4bb2('0x32')){return![];}return!![];};exports[_0x4bb2('0x7e')]=function(_0x72503c,_0x36188c){var _0x30edbc,_0x3d448c,_0x351ca2;if(_0x36188c<=0x0){_0x36188c=0x1;}_0x30edbc=new RegExp(_0x4bb2('0x7f')+_0x36188c+'}$');_0x3d448c=Math[_0x4bb2('0x80')](0xa,_0x36188c-0x1);_0x351ca2=Math['pow'](0xa,_0x36188c)-0x1;return util[_0x4bb2('0x14')]('%s',_['replace'](_0x72503c,_0x30edbc,_[_0x4bb2('0x81')](_0x3d448c,_0x351ca2)));};exports[_0x4bb2('0x82')]=function(_0xb01666){var _0x46bc98=_0xb01666['match'](/"(.*?)"/);return _0x46bc98?_0x46bc98[0x1]:_0xb01666;};exports[_0x4bb2('0x83')]=function(_0xd78048){var _0x3d833d=_0xd78048[_0x4bb2('0x84')](/<(.*?)>/);return _0x3d833d?_0x3d833d[0x1]:_0xd78048;};function buildNoAnswerEventPayload(_0x4876a3,_0x33f3f3){var _0x3b35bb=buildObj(_0x4876a3,'noanswer');if(!_[_0x4bb2('0x13')](_0x33f3f3['variables'])){Object[_0x4bb2('0x85')](_0x33f3f3['variables'])['forEach'](function(_0xbdfc73){_0x3b35bb[_0xbdfc73[_0x4bb2('0x86')]()]=_0x33f3f3['variables'][_0xbdfc73];});}return _0x3b35bb;}exports[_0x4bb2('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xc8da=['xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','noanswer','variables','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','info','inspect','loggerError','logger2','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','getSeconds','logLookAgent','logCustomer','responsetime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','uniqueid','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','getDiff','milliseconds','CampaignId','filterKey','idContact','type','campaigntype','membername','callback','callbackuniqueid','callbackat','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialtimeout'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xc8da,0xa4));var _0xac8d=function(_0xe588e8,_0x3eb47c){_0xe588e8=_0xe588e8-0x0;var _0x15ad36=_0xc8da[_0xe588e8];return _0x15ad36;};'use strict';var util=require(_0xac8d('0x0'));var _=require(_0xac8d('0x1'));var moment=require(_0xac8d('0x2'));var logger=require(_0xac8d('0x3'))(_0xac8d('0x4'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xac8d('0x5');var utils=require(_0xac8d('0x6'));exports[_0xac8d('0x7')]=function(_0x54edc2){return function(_0x131be7){logger[_0xac8d('0x8')](_0x54edc2,util['inspect'](_0x131be7,{'showHidden':![],'depth':null}));};};exports[_0xac8d('0x9')]=function(_0x51fb25,_0x2fb0e8){logger[_0xac8d('0xa')](_0x51fb25,util[_0xac8d('0xb')](_0x2fb0e8,{'showHidden':![],'depth':null}));};exports[_0xac8d('0xc')]=function(_0x1c780e,_0x479230){logger[_0xac8d('0x8')](_0x1c780e,util[_0xac8d('0xb')](_0x479230,{'showHidden':![],'depth':null}));};exports[_0xac8d('0xd')]=function(_0x2692f2){return function(_0x4da153){logger[_0xac8d('0xa')](_0x2692f2,util[_0xac8d('0xb')](_0x4da153,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x24202a,_0x1cf93b,_0x423618){return{'message':_0x24202a,'unlock':_0x1cf93b,'active':_0x423618};};exports[_0xac8d('0xe')]=function(_0x31c482,_0x412acf,_0x257a71){if(!_['isUndefined'](_0x257a71)&&_0xac8d('0xf')===typeof _0x257a71&&!_[_0xac8d('0x10')](_0x257a71)){if(!_[_0xac8d('0x11')](_0x412acf)&&_0xac8d('0xf')===typeof _0x412acf&&!_[_0xac8d('0x10')](_0x412acf)){return util[_0xac8d('0x12')](_0xac8d('0x13'),_0x412acf,_0x257a71);}return util[_0xac8d('0x12')]('\x22%s\x22\x20<%s>',_0x257a71,_0x257a71);}if(!_['isUndefined'](_0x31c482)&&'string'===typeof _0x31c482&&!_['isEmpty'](_0x31c482)){return _0x31c482;}return _0xac8d('0x14');};exports[_0xac8d('0x15')]=function(_0x2db434){if(_[_0xac8d('0x16')](_0x2db434)){return![];}return _0x2db434;};exports[_0xac8d('0x17')]=function(_0x55c4c4,_0x3ec61c,_0x342cd8,_0x4b376e,_0x1c637f,_0x527fce){var _0xaf2962={'XMD-QUEUE':_0x3ec61c['Queue']?_0x3ec61c['Queue']['name']:'','XMD-CALLERID':_0x4b376e,'XMD-CALLERID-PREVIEW':_0x527fce?util[_0xac8d('0x12')]('\x22%s\x22\x20<%s>',_0x527fce['calleridname'],_0x527fce['calleridnum']):_0x4b376e,'XMD-DIALID':_0x1c637f,'XMD-CONTACTID':_0x3ec61c[_0xac8d('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4b376e,'XMD-VOICEQUEUEID':_0x3ec61c[_0xac8d('0x19')],'XMD-DIALCHANNEL':_0x342cd8,'XMD-DIALTIMEOUT':_0x55c4c4[_0xac8d('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xac8d('0x12')](_0xac8d('0x1b'),_0x55c4c4['dialQueueProject2']?'g':'',_[_0xac8d('0x10')](_0x55c4c4[_0xac8d('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x55c4c4['dialPreviewUrl']||'','XMD-AGI':_0x55c4c4[_0xac8d('0x1d')]?util[_0xac8d('0x12')](_0xac8d('0x1e'),ipAgi,_0x55c4c4['dialQueueProject']):_0xac8d('0x1f'),'XMD-AGIAFTER':_0x55c4c4[_0xac8d('0x20')]?util[_0xac8d('0x12')](_0xac8d('0x1e'),ipAgi,_0x55c4c4['dialQueueProject2']):_0xac8d('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x527fce?_0x527fce['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x527fce?_0x527fce[_0xac8d('0x21')]:'','XMD-DESTINATION':_0xac8d('0x22'),'SIPADDHEADER':_0xac8d('0x23')};if(!_['isEmpty'](_0x55c4c4[_0xac8d('0x1c')])){_0xaf2962[util[_0xac8d('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x55c4c4['monitor_format'];_0xaf2962[util[_0xac8d('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1c637f;}return _0xaf2962;};exports[_0xac8d('0x24')]=function(_0x4a2433){var _0x3c2e7b={};for(var _0x1363f0 in _0x4a2433){if(_0x4a2433[_0xac8d('0x25')](_0x1363f0)){_0x3c2e7b[util[_0xac8d('0x12')]('%s',_['toLower'](_0x1363f0))]=_0x4a2433[_0x1363f0];}}return{'variables':_0x3c2e7b};};exports[_0xac8d('0x26')]=function(_0x196a8a,_0x1d36e0){if(!_[_0xac8d('0x16')](_0x196a8a)){if(_0x196a8a[_0xac8d('0x25')](_0xac8d('0x27'))){if(_0x196a8a[_0xac8d('0x27')]>0x0){_0x196a8a[_0xac8d('0x27')]-=0x1;}else{logger['error'](_0xac8d('0x28'),_0x1d36e0);}}}else{logger[_0xac8d('0x8')](_0xac8d('0x29'),_0x1d36e0);}};exports[_0xac8d('0x2a')]=function(_0x3fece8){var _0x362049=moment()[_0xac8d('0x12')](_0xac8d('0x2b'));_0x3fece8[_0xac8d('0x2c')]=0xd;_0x3fece8[_0xac8d('0x2d')]=_0xac8d('0x2e');_0x3fece8[_0xac8d('0x2f')]=_0x362049;_0x3fece8['responsetime']=_0x362049;_0x3fece8[_0xac8d('0x30')]=_0x362049;};exports[_0xac8d('0x31')]=function(_0x457088,_0x26d92f,_0xe35ac2){var _0x5af9af=moment()[_0xac8d('0x12')](_0xac8d('0x2b'));_0x457088['state']=_0x26d92f;_0x457088[_0xac8d('0x2d')]=_0xe35ac2;_0x457088['responsetime']=_0x5af9af;_0x457088['ringtime']=utils[_0xac8d('0x32')](_0x457088['responsetime'],_0x457088[_0xac8d('0x2f')]);};exports[_0xac8d('0x33')]=function(_0x3ffa41,_0x1d9e29,_0x4e0db4){_0x3ffa41['membername']=_0x1d9e29;_0x3ffa41['UserId']=_0x4e0db4;};exports[_0xac8d('0x34')]=function(_0x5c8ff7,_0x460db4,_0x387ad5){var _0x327247=moment()[_0xac8d('0x12')](_0xac8d('0x2b'));_0x5c8ff7['state']=_0x460db4;_0x5c8ff7[_0xac8d('0x2d')]=_0x387ad5;_0x5c8ff7[_0xac8d('0x35')]=_0x5c8ff7[_0xac8d('0x35')]?_0x5c8ff7['responsetime']:_0x327247;_0x5c8ff7['endtime']=_0x5c8ff7[_0xac8d('0x30')]?_0x5c8ff7[_0xac8d('0x30')]:_0x327247;_0x5c8ff7[_0xac8d('0x36')]=utils['getSeconds'](_0x5c8ff7['responsetime']||0x0,_0x5c8ff7[_0xac8d('0x2f')]||0x0);_0x5c8ff7[_0xac8d('0x37')]=_0x5c8ff7[_0xac8d('0x38')]?utils['getSeconds'](_0x5c8ff7[_0xac8d('0x30')],_0x5c8ff7[_0xac8d('0x38')]):0x0;};exports[_0xac8d('0x39')]=function(_0x72bac9){return _0x72bac9===_0xac8d('0x3a');};exports[_0xac8d('0x3b')]=function(_0x1855ee,_0x2f2a17,_0x318658,_0x540e54,_0x30c30d){var _0x1753c4=_0x540e54?_0xac8d('0x3c'):_0x1855ee[_0xac8d('0x3d')];_0x1753c4=_0x30c30d?'BOOKED':_0x1753c4;return{'actionid':_0x1855ee[_0xac8d('0x3e')],'action':'originate','channel':_0x1855ee[_0xac8d('0x3f')],'callerid':util[_0xac8d('0x12')](_0xac8d('0x13'),_0x1753c4,_0x1855ee[_0xac8d('0x40')]),'Exten':_0xac8d('0x22'),'Context':_0xac8d('0x41'),'Priority':'1','variable':_0x318658,'timeout':(_0x2f2a17[_0xac8d('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1855ee[_0xac8d('0x3e')]};};exports[_0xac8d('0x43')]=function(_0x5bb7f4){return _0x5bb7f4[_0xac8d('0x44')]+_0x5bb7f4[_0xac8d('0x45')]+_0x5bb7f4[_0xac8d('0x46')]+_0x5bb7f4['countagentrejectretry']+_0x5bb7f4['countnosuchnumberretry'];};exports[_0xac8d('0x47')]=function(_0x47bdab){var _0x4704a4=_[_0xac8d('0x48')](_0x47bdab);_0x4704a4[_0xac8d('0x2c')]=0xf;_0x4704a4[_0xac8d('0x2d')]='Global';return _0x4704a4;};exports['scheduledAt']=function(_0x669c4a,_0x3600e9,_0x50aade){var _0x368eac={};_0x368eac[_0x3600e9]=_0x669c4a[_0x3600e9];_0x368eac[_0xac8d('0x49')]=![];_0x368eac[_0xac8d('0x4a')]=moment()[_0xac8d('0x4b')](_0x50aade,_0xac8d('0x4c'))[_0xac8d('0x12')](_0xac8d('0x2b'));_0x368eac[_0xac8d('0x18')]=_0x669c4a[_0xac8d('0x18')];_0x368eac[_0xac8d('0x4d')]=_0x669c4a[_0xac8d('0x4d')];_0x368eac[_0xac8d('0x19')]=_0x669c4a[_0xac8d('0x19')]||undefined;return _0x368eac;};exports['decrementTalkink']=function(_0x3b3eeb,_0x4840ff){if(!_[_0xac8d('0x16')](_0x3b3eeb)){if(_0x3b3eeb[_0xac8d('0x4e')]>0x0){_0x3b3eeb['pTalking']-=0x1;}else{logger[_0xac8d('0x8')](_0x4840ff,_0xac8d('0x4f'));}}else{logger[_0xac8d('0x8')](_0x4840ff,_0xac8d('0x50'));}};exports[_0xac8d('0x51')]=function(_0x2659e4){if(_0x2659e4<=0x0){return!![];}return![];};function buildObj(_0x2af06b,_0x38c9f7,_0x59321b){_0x2af06b[_0xac8d('0x52')]=_0x38c9f7;_0x2af06b[_0xac8d('0x53')]=_0x2af06b[_0xac8d('0x54')];_0x2af06b[_0xac8d('0x55')]=_0x2af06b[_0xac8d('0x3f')];_0x2af06b[_0xac8d('0x56')]='voice';if(_0x59321b){_0x2af06b[_0xac8d('0x57')]=_0x59321b['mandatoryDisposition'];}return _0x2af06b;}exports['buildObj']=buildObj;exports[_0xac8d('0x58')]=function(_0x168851){var _0x842c6c={};_0x842c6c[_0xac8d('0x54')]=_0x168851[_0xac8d('0x54')];_0x842c6c[_0xac8d('0x55')]=_0x168851[_0xac8d('0x3f')];_0x842c6c['uniqueid']=_0x168851[_0xac8d('0x3e')];return _0x842c6c;};exports[_0xac8d('0x59')]=function(_0x22fe8b){var _0x276f3f=[];for(var _0x2c574f in _0x22fe8b){if(_0x22fe8b[_0xac8d('0x25')](_0x2c574f)){if(!_[_0xac8d('0x16')](_0x22fe8b[_0x2c574f])&&_0x22fe8b[_0x2c574f][_0xac8d('0x2c')]===_0xac8d('0x5a')&&_0x22fe8b[_0x2c574f][_0xac8d('0x5b')]==='reachable'){_0x276f3f[_0xac8d('0x5c')](_0x22fe8b[_0x2c574f]['id']);}}}return _0x276f3f;};exports[_0xac8d('0x5d')]=function(_0x496b6d){var _0x4c185f=moment()[_0xac8d('0x5e')](0x0);var _0x4dbf12=moment(_0x496b6d)['milliseconds'](0x0);return _0x4c185f['diff'](_0x4dbf12,'seconds');};exports['createBody']=function(_0x2251bf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2251bf[_0xac8d('0x18')],'ListId':_0x2251bf[_0xac8d('0x4d')],'VoiceQueueId':_0x2251bf['VoiceQueueId']||undefined,'CampaignId':_0x2251bf[_0xac8d('0x5f')]||undefined};};exports[_0xac8d('0x60')]=function(_0x4c6370){if(_0x4c6370==='uniqueid'||_0x4c6370===_0xac8d('0x61')||_0x4c6370===_0xac8d('0x54')||_0x4c6370===_0xac8d('0x62')||_0x4c6370===_0xac8d('0x63')||_0x4c6370==='dialAnswer'||_0x4c6370===_0xac8d('0x64')||_0x4c6370===_0xac8d('0x3f')||_0x4c6370===_0xac8d('0x3d')||_0x4c6370===_0xac8d('0x49')||_0x4c6370==='calleridnum'||_0x4c6370===_0xac8d('0x4a')||_0x4c6370===_0xac8d('0x44')||_0x4c6370===_0xac8d('0x45')||_0x4c6370==='countnoanswerretry'||_0x4c6370==='countglobal'||_0x4c6370===_0xac8d('0x65')||_0x4c6370===_0xac8d('0x66')||_0x4c6370===_0xac8d('0x67')||_0x4c6370==='recallme'||_0x4c6370===_0xac8d('0x18')||_0x4c6370==='ListId'||_0x4c6370===_0xac8d('0x68')||_0x4c6370==='VoiceQueueId'||_0x4c6370===_0xac8d('0x69')||_0x4c6370===_0xac8d('0x6a')||_0x4c6370===_0xac8d('0x6b')||_0x4c6370==='xmd-phone'||_0x4c6370===_0xac8d('0x6c')||_0x4c6370==='xmd-dialurl'||_0x4c6370===_0xac8d('0x6d')||_0x4c6370===_0xac8d('0x6e')||_0x4c6370===_0xac8d('0x6f')||_0x4c6370===_0xac8d('0x70')||_0x4c6370===_0xac8d('0x71')||_0x4c6370==='xmd-cdrtype'||_0x4c6370===_0xac8d('0x72')||_0x4c6370==='xmd-agiafter'||_0x4c6370===_0xac8d('0x73')||_0x4c6370===_0xac8d('0x74')||_0x4c6370===_0xac8d('0x75')||_0x4c6370==='rtpaudioqosjitter'||_0x4c6370===_0xac8d('0x76')||_0x4c6370===_0xac8d('0x77')||_0x4c6370==='rtpaudioqoslossbridged'||_0x4c6370===_0xac8d('0x78')||_0x4c6370===_0xac8d('0x79')||_0x4c6370===_0xac8d('0x74')||_0x4c6370===_0xac8d('0x75')||_0x4c6370===_0xac8d('0x7a')||_0x4c6370==='rtpaudioqosjitterbridged'||_0x4c6370===_0xac8d('0x77')||_0x4c6370===_0xac8d('0x7b')||_0x4c6370===_0xac8d('0x78')||_0x4c6370==='rtpaudioqosrttbridged'||_0x4c6370===_0xac8d('0x7c')||_0x4c6370===_0xac8d('0x7d')||_0x4c6370===_0xac8d('0x2c')||_0x4c6370===_0xac8d('0x2d')){return![];}return!![];};exports[_0xac8d('0x7e')]=function(_0x507862,_0x5cc2cf){var _0x46d505,_0x598453,_0x178bcf;if(_0x5cc2cf<=0x0){_0x5cc2cf=0x1;}_0x46d505=new RegExp(_0xac8d('0x7f')+_0x5cc2cf+'}$');_0x598453=Math['pow'](0xa,_0x5cc2cf-0x1);_0x178bcf=Math[_0xac8d('0x80')](0xa,_0x5cc2cf)-0x1;return util[_0xac8d('0x12')]('%s',_[_0xac8d('0x81')](_0x507862,_0x46d505,_[_0xac8d('0x82')](_0x598453,_0x178bcf)));};exports[_0xac8d('0x83')]=function(_0x4948de){var _0x2ebc38=_0x4948de[_0xac8d('0x84')](/"(.*?)"/);return _0x2ebc38?_0x2ebc38[0x1]:_0x4948de;};exports['extractCalleridNumber']=function(_0x39410a){var _0x50041e=_0x39410a['match'](/<(.*?)>/);return _0x50041e?_0x50041e[0x1]:_0x39410a;};function buildNoAnswerEventPayload(_0x302024,_0x395d4a){var _0x341a20=buildObj(_0x302024,_0xac8d('0x85'));if(!_['isEmpty'](_0x395d4a[_0xac8d('0x86')])){Object['keys'](_0x395d4a['variables'])[_0xac8d('0x87')](function(_0x2abf6f){_0x341a20[_0x2abf6f['toLowerCase']()]=_0x395d4a['variables'][_0x2abf6f];});}return _0x341a20;}exports[_0xac8d('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 06b563b..119aa11 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 _0x875b=['voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x93e1f4,_0x46df5f){var _0xcb275b=function(_0x252070){while(--_0x252070){_0x93e1f4['push'](_0x93e1f4['shift']());}};_0xcb275b(++_0x46df5f);}(_0x875b,0xc0));var _0xb875=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x875b[_0x4fbb15];return _0x436338;};'use strict';exports[_0xb875('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xb875('0x1'),'required':!![]},'membername':{'type':_0xb875('0x1'),'required':!![]},'penalty':{'type':_0xb875('0x2'),'required':![]},'paused':{'type':_0xb875('0x3'),'required':![]}};exports[_0xb875('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xb875('0x5')]={'interface':{'type':_0xb875('0x1'),'required':!![]},'paused':{'type':_0xb875('0x3')},'reason':{'type':_0xb875('0x1'),'required':![]}};exports[_0xb875('0x6')]={'module':{'type':_0xb875('0x1'),'required':![]}};exports[_0xb875('0x7')]={'uniqueid':{'type':_0xb875('0x1'),'required':!![]}};exports[_0xb875('0x8')]={'uniqueid':{'type':_0xb875('0x1'),'required':!![]},'filename':{'type':_0xb875('0x1')},'format':{'type':_0xb875('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xb875('0x1'),'required':!![]}};exports[_0xb875('0x9')]={'uniqueid':{'type':_0xb875('0x1'),'required':!![]},'exten':{'type':_0xb875('0x1'),'required':!![]},'context':{'type':_0xb875('0x1')}}; \ No newline at end of file +var _0x6c4c=['boolean','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','queueremove','queuepause'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x6c4c,0x7a));var _0xc6c4=function(_0x4d935e,_0x1a9d41){_0x4d935e=_0x4d935e-0x0;var _0x3a6e8f=_0x6c4c[_0x4d935e];return _0x3a6e8f;};'use strict';exports['queueadd']={'queue':{'type':_0xc6c4('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xc6c4('0x0'),'required':!![]},'penalty':{'type':_0xc6c4('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xc6c4('0x2')]={'queue':{'type':_0xc6c4('0x0'),'required':!![]},'interface':{'type':_0xc6c4('0x0'),'required':!![]}};exports[_0xc6c4('0x3')]={'interface':{'type':_0xc6c4('0x0'),'required':!![]},'paused':{'type':_0xc6c4('0x4')},'reason':{'type':_0xc6c4('0x0'),'required':![]}};exports[_0xc6c4('0x5')]={'module':{'type':_0xc6c4('0x0'),'required':![]}};exports[_0xc6c4('0x6')]={'uniqueid':{'type':_0xc6c4('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xc6c4('0x0')},'format':{'type':_0xc6c4('0x0')},'mixmonitorid':{'type':_0xc6c4('0x0')}};exports[_0xc6c4('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xc6c4('0x8')]={'uniqueid':{'type':_0xc6c4('0x0'),'required':!![]},'exten':{'type':_0xc6c4('0x0'),'required':!![]},'context':{'type':_0xc6c4('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 62cdaa1..ffaf58f 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x1db678,_0x289498){var _0x4c01ad=function(_0x181506){while(--_0x181506){_0x1db678['push'](_0x1db678['shift']());}};_0x4c01ad(++_0x289498);}(_0xb10b,0x12a));var _0xbb10=function(_0x57d500,_0xf52c67){_0x57d500=_0x57d500-0x0;var _0x142c14=_0xb10b[_0x57d500];return _0x142c14;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x39fd8f,_0x5ca4f9){var _0x5d9e16=function(_0x4816e2){while(--_0x4816e2){_0x39fd8f['push'](_0x39fd8f['shift']());}};_0x5d9e16(++_0x5ca4f9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c060b,_0x4c5e75){_0x4c060b=_0x4c060b-0x0;var _0x5b9790=_0x5f2f[_0x4c060b];return _0x5b9790;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 0373086..df47854 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49d5=['mergeDBDataToRealtime','assign'];(function(_0xab2865,_0x32e71e){var _0x31f344=function(_0x2a3762){while(--_0x2a3762){_0xab2865['push'](_0xab2865['shift']());}};_0x31f344(++_0x32e71e);}(_0x49d5,0xbb));var _0x549d=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x49d5[_0x47b58b];return _0x46bebe;};'use strict';function mergeDBDataToRealtime(_0x166df0,_0xb17401){var _0x4de5a2=Object[_0x549d('0x0')]({},_0x166df0);for(var _0xd103e2 in _0xb17401){if(_0x4de5a2['hasOwnProperty'](_0xd103e2)){_0x4de5a2[_0xd103e2]=_0xb17401[_0xd103e2];}}return _0x4de5a2;}exports[_0x549d('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x9b6b=['assign','hasOwnProperty'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0x9b6b,0x172));var _0xb9b6=function(_0x4c14ee,_0x21c1ea){_0x4c14ee=_0x4c14ee-0x0;var _0x1daf81=_0x9b6b[_0x4c14ee];return _0x1daf81;};'use strict';function mergeDBDataToRealtime(_0x51f1aa,_0x64fe8e){var _0xf73bf8=Object[_0xb9b6('0x0')]({},_0x51f1aa);for(var _0x5e7cc0 in _0x64fe8e){if(_0xf73bf8[_0xb9b6('0x1')](_0x5e7cc0)){_0xf73bf8[_0x5e7cc0]=_0x64fe8e[_0x5e7cc0];}}return _0xf73bf8;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 049843a..67224fa 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 _0xdc66=['transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','sync','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','agents','name','isNil','interface','format','SIP/%s','prototype','length','findAgent','connectedlinenum','accountcode','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','getCallType','channel','split','calleridnum','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','callerid','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','phone','lastIndexOf'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0xdc66,0x176));var _0x6dc6=function(_0x19106c,_0x22da38){_0x19106c=_0x19106c-0x0;var _0xbe5a82=_0xdc66[_0x19106c];return _0xbe5a82;};'use strict';var _=require(_0x6dc6('0x0'));var moment=require('moment');var util=require(_0x6dc6('0x1'));var config=require(_0x6dc6('0x2'));var ami=require(_0x6dc6('0x3'));var RpcVoiceAgentReport=require(_0x6dc6('0x4'));var RpcVoiceCallReport=require(_0x6dc6('0x5'));var RpcVoiceDialReport=require(_0x6dc6('0x6'));var RpcMemberReport=require(_0x6dc6('0x7'));var RpcVoiceQueueReport=require(_0x6dc6('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x6dc6('0x9'));var VoiceCallReport=require(_0x6dc6('0xa'));var VoiceAgentReport=require(_0x6dc6('0xb'));var VoiceDialReport=require(_0x6dc6('0xc'));var UserReport=require(_0x6dc6('0xd'));function Report(_0x8fc4b3){this[_0x6dc6('0xe')]=_0x8fc4b3;this['agents']=_0x8fc4b3['agents'];this[_0x6dc6('0xf')]=_0x8fc4b3[_0x6dc6('0xf')];}Report['prototype'][_0x6dc6('0x10')]=function(_0x1d36b8){var _0x52dfa4=new VoiceQueueReport(this['realtime']);var _0x313a0c=new VoiceAgentReport(this[_0x6dc6('0xe')]);var _0x350019=new VoiceDialReport(this['realtime']);var _0x29cdfe=new VoiceCallReport(this['realtime']);var _0x1ef35a=new UserReport(this['realtime']);if(config[_0x6dc6('0x11')]&&config[_0x6dc6('0x11')][_0x6dc6('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x6dc6('0x13')]['bind'](this));ami['on'](_0x6dc6('0x14'),this[_0x6dc6('0x15')][_0x6dc6('0x16')](this));ami['on'](_0x6dc6('0x17'),this['voiceAgentReport'][_0x6dc6('0x16')](this));ami['on'](_0x6dc6('0x18'),this['voiceDialReport'][_0x6dc6('0x16')](this));ami['on'](_0x6dc6('0x19'),this[_0x6dc6('0x1a')][_0x6dc6('0x16')](this));ami['on'](_0x6dc6('0x1b'),this[_0x6dc6('0x1c')][_0x6dc6('0x16')](this));}};Report['prototype']['findAgent']=function(_0x3644ad){var _0x3fe637;_0x3fe637=_[_0x6dc6('0x1d')](this[_0x6dc6('0x1e')],function(_0xfdf421){return _0xfdf421['accountcode']==_0x3644ad||_0xfdf421[_0x6dc6('0x1f')]==_0x3644ad;});if(_[_0x6dc6('0x20')](_0x3fe637)){var _0x19d37a=_[_0x6dc6('0x1d')](this['telephones'],function(_0x4ebfd8){return _0x4ebfd8['accountcode']==_0x3644ad||_0x4ebfd8['name']==_0x3644ad;});if(_0x19d37a){_0x3fe637=_[_0x6dc6('0x1d')](this[_0x6dc6('0x1e')],function(_0x44d53d){return _0x44d53d[_0x6dc6('0x21')]==util[_0x6dc6('0x22')](_0x6dc6('0x23'),_0x19d37a['name']);});}}return _0x3fe637;};Report[_0x6dc6('0x24')][_0x6dc6('0x13')]=function(_0x5607ea){for(var _0x5c7ccd=0x0;_0x5c7ccd<_0x5607ea[_0x6dc6('0x25')];_0x5c7ccd+=0x1){var _0x274c9e=this[_0x6dc6('0x26')](_0x5607ea[_0x5c7ccd][_0x6dc6('0x27')]);if(_0x274c9e){_0x5607ea[_0x5c7ccd][_0x6dc6('0x28')]=_0x274c9e['accountcode'];_0x5607ea[_0x5c7ccd]['assigned']=!![];_0x5607ea[_0x5c7ccd]['lastAssignedTo']=_0x274c9e['name'];_0x5607ea[_0x5c7ccd][_0x6dc6('0x21')]=_[_0x6dc6('0x20')](_0x274c9e['interface'])?util['format']('SIP/%s',_0x274c9e[_0x6dc6('0x1f')]):_0x274c9e['interface'];if(_0x5607ea[_0x5c7ccd][_0x6dc6('0x29')]){_0x5607ea[_0x5c7ccd][_0x6dc6('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5607ea[_0x5c7ccd][_0x6dc6('0x2b')]){_0x5607ea[_0x5c7ccd][_0x6dc6('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x6dc6('0x13')](_0x5607ea[_0x5c7ccd]);}RpcVoiceQueueReport[_0x6dc6('0x2d')](_0x5607ea[_0x5c7ccd]);}};function extractCalleridNumber(_0x23a7de){var _0x275822=_0x23a7de[_0x6dc6('0x2e')](/<(.*?)>/);return _0x275822?_0x275822[0x1]:_0x23a7de;}Report[_0x6dc6('0x24')][_0x6dc6('0x2f')]=function(_0x5cd461){for(var _0x19c971=0x0;_0x19c971','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','exports','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','isNil','name','find','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType'];(function(_0x5afd1c,_0x5a8be5){var _0x477364=function(_0x51394b){while(--_0x51394b){_0x5afd1c['push'](_0x5afd1c['shift']());}};_0x477364(++_0x5a8be5);}(_0x1ce8,0xd9));var _0x81ce=function(_0x4ae962,_0x5d195d){_0x4ae962=_0x4ae962-0x0;var _0x405686=_0x1ce8[_0x4ae962];return _0x405686;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var config=require(_0x81ce('0x0'));var ami=require(_0x81ce('0x1'));var RpcVoiceAgentReport=require(_0x81ce('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x81ce('0x3'));var RpcMemberReport=require(_0x81ce('0x4'));var RpcVoiceQueueReport=require(_0x81ce('0x5'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x81ce('0x6'));var VoiceQueueReport=require(_0x81ce('0x7'));var VoiceCallReport=require(_0x81ce('0x8'));var VoiceAgentReport=require(_0x81ce('0x9'));var VoiceDialReport=require(_0x81ce('0xa'));var UserReport=require('./userReport');function Report(_0x8ac89f){this[_0x81ce('0xb')]=_0x8ac89f;this[_0x81ce('0xc')]=_0x8ac89f['agents'];this[_0x81ce('0xd')]=_0x8ac89f[_0x81ce('0xd')];}Report[_0x81ce('0xe')][_0x81ce('0xf')]=function(_0x4a3e4c){var _0x3de55b=new VoiceQueueReport(this['realtime']);var _0x3fe64c=new VoiceAgentReport(this[_0x81ce('0xb')]);var _0x15fb70=new VoiceDialReport(this[_0x81ce('0xb')]);var _0x550219=new VoiceCallReport(this['realtime']);var _0x399a06=new UserReport(this[_0x81ce('0xb')]);if(config[_0x81ce('0x10')]&&config[_0x81ce('0x10')][_0x81ce('0x11')]){ami['on'](_0x81ce('0x12'),this[_0x81ce('0x13')][_0x81ce('0x14')](this));ami['on'](_0x81ce('0x15'),this[_0x81ce('0x16')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x81ce('0x17')]['bind'](this));ami['on'](_0x81ce('0x18'),this['voiceDialReport'][_0x81ce('0x14')](this));ami['on'](_0x81ce('0x19'),this[_0x81ce('0x1a')][_0x81ce('0x14')](this));ami['on'](_0x81ce('0x1b'),this[_0x81ce('0x1c')][_0x81ce('0x14')](this));}};Report[_0x81ce('0xe')][_0x81ce('0x1d')]=function(_0x9c1104){var _0x58b294;_0x58b294=_['find'](this[_0x81ce('0xc')],function(_0xa53e7e){return _0xa53e7e[_0x81ce('0x1e')]==_0x9c1104||_0xa53e7e['name']==_0x9c1104;});if(_[_0x81ce('0x1f')](_0x58b294)){var _0x3449c9=_['find'](this[_0x81ce('0xd')],function(_0x5ac3b8){return _0x5ac3b8[_0x81ce('0x1e')]==_0x9c1104||_0x5ac3b8[_0x81ce('0x20')]==_0x9c1104;});if(_0x3449c9){_0x58b294=_[_0x81ce('0x21')](this[_0x81ce('0xc')],function(_0x27bdc4){return _0x27bdc4['interface']==util['format'](_0x81ce('0x22'),_0x3449c9[_0x81ce('0x20')]);});}}return _0x58b294;};Report[_0x81ce('0xe')][_0x81ce('0x13')]=function(_0x1485c9){for(var _0x2c4bd3=0x0;_0x2c4bd3<_0x1485c9[_0x81ce('0x23')];_0x2c4bd3+=0x1){var _0x2f45e5=this[_0x81ce('0x1d')](_0x1485c9[_0x2c4bd3][_0x81ce('0x24')]);if(_0x2f45e5){_0x1485c9[_0x2c4bd3][_0x81ce('0x1e')]=_0x2f45e5[_0x81ce('0x1e')];_0x1485c9[_0x2c4bd3][_0x81ce('0x25')]=!![];_0x1485c9[_0x2c4bd3][_0x81ce('0x26')]=_0x2f45e5[_0x81ce('0x20')];_0x1485c9[_0x2c4bd3]['interface']=_[_0x81ce('0x1f')](_0x2f45e5[_0x81ce('0x27')])?util['format'](_0x81ce('0x22'),_0x2f45e5[_0x81ce('0x20')]):_0x2f45e5['interface'];if(_0x1485c9[_0x2c4bd3][_0x81ce('0x28')]){_0x1485c9[_0x2c4bd3][_0x81ce('0x29')]=moment()[_0x81ce('0x2a')](_0x81ce('0x2b'));}if(_0x1485c9[_0x2c4bd3]['queuecallerexit']){_0x1485c9[_0x2c4bd3][_0x81ce('0x2c')]=moment()[_0x81ce('0x2a')](_0x81ce('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x1485c9[_0x2c4bd3]);}RpcVoiceQueueReport[_0x81ce('0x2d')](_0x1485c9[_0x2c4bd3]);}};function extractCalleridNumber(_0x3a6a34){var _0x360731=_0x3a6a34[_0x81ce('0x2e')](/<(.*?)>/);return _0x360731?_0x360731[0x1]:_0x3a6a34;}Report[_0x81ce('0xe')][_0x81ce('0x2f')]=function(_0x1af0c1){for(var _0x38d796=0x0;_0x38d7960x0?!![]:![];if(!_0x594759){return this[_0x8751('0x19')](this[_0x8751('0x16')][_0x8751('0x70')]);}};VoiceQueueReport[_0x8751('0xc')][_0x8751('0x1c')]=function(_0x2ff6ec){var _0x1d8eac=this[_0x8751('0x16')]['id'];if(this['summary'][_0x8751('0x66')][_0x1d8eac]&&this['summary'][_0x8751('0x66')][_0x1d8eac][_0x2ff6ec[_0x8751('0x64')]]){this[_0x8751('0x16')][_0x8751('0x66')][_0x1d8eac][_0x2ff6ec[_0x8751('0x64')]][_0x8751('0x11')][_0x8751('0x71')](_0x2ff6ec);}};VoiceQueueReport[_0x8751('0xc')][_0x8751('0x72')]=function(_0x5ea82e){var _0x2a2554=this;try{if(this['isNotNull'](_0x5ea82e)&&this['isNotNull'](_0x5ea82e[_0x8751('0x54')])){logger['debug'](_0x8751('0x73'),util['inspect'](_0x5ea82e,{'showHidden':![],'depth':null}));var _0x44995e=this[_0x8751('0x14')][_0x5ea82e['queue']];if(_0x44995e){logger[_0x8751('0x4f')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x44995e[_0x8751('0x68')]);this[_0x8751('0x16')]['queues'][_0x44995e['name']]={'summaryEvent':_0x5ea82e};this[_0x8751('0x16')]['statusRequests']+=0x1;return ami[_0x8751('0x3e')]({'action':_0x8751('0x66'),'queue':_0x44995e['name']})[_0x8751('0x63')](function(_0x1d1b36){if(!_0x2a2554[_0x8751('0x16')][_0x8751('0x66')][_0x5ea82e[_0x8751('0x64')]]){_0x2a2554['summary']['queuestatus'][_0x5ea82e['actionid']]={};}_0x2a2554[_0x8751('0x16')]['queuestatus'][_0x5ea82e[_0x8751('0x64')]][_0x1d1b36[_0x8751('0x64')]]={'queue':_0x44995e[_0x8751('0x68')],'agents':[]};})['catch'](function(_0x39276f){throw _0x39276f;});}}}catch(_0x3f9e01){logger[_0x8751('0x43')]('[voiceQueueReport][queuesummary]',util[_0x8751('0x45')](_0x3f9e01,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8751('0xc')][_0x8751('0x19')]=function(_0x23ad90){if(this[_0x8751('0x16')][_0x8751('0x6f')]>0x0){this[_0x8751('0x16')][_0x8751('0x70')]=_0x23ad90;return;}logger[_0x8751('0x4f')](_0x8751('0x74'),util[_0x8751('0x45')](_0x23ad90,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x8751('0x4d')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x8751('0xc')]['syncQueueCallerJoin']=function(_0x49af71){try{if(this[_0x8751('0x75')](_0x49af71)){logger[_0x8751('0x4f')](_0x8751('0x76'),_0x49af71[_0x8751('0x77')],util['inspect'](_0x49af71,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x8751('0x46')][_0x49af71[_0x8751('0x77')]])){this['queueReports'][_0x49af71[_0x8751('0x77')]]=[];}if(_[_0x8751('0x60')](this[_0x8751('0x12')][_0x49af71[_0x8751('0x77')]])){this[_0x8751('0x12')][_0x49af71[_0x8751('0x77')]]={};}var _0x39196e=new QueueReport();_0x39196e[_0x8751('0x54')]=_0x49af71[_0x8751('0x54')];_0x39196e[_0x8751('0x5c')]=this[_0x8751('0x14')][_0x39196e[_0x8751('0x54')]]&&this[_0x8751('0x14')][_0x39196e['queue']][_0x8751('0x5c')]?this['voiceQueues'][_0x39196e[_0x8751('0x54')]][_0x8751('0x5c')]||_0x8751('0x5d'):_0x8751('0x5d');_0x39196e[_0x8751('0x78')]=moment()['format'](_0x8751('0x79'));_0x39196e['position']=_0x49af71[_0x8751('0x7a')];_0x39196e[_0x8751('0x7b')]=_0x49af71[_0x8751('0x7b')];_0x39196e[_0x8751('0x77')]=_0x49af71[_0x8751('0x77')];_0x39196e[_0x8751('0x7c')]=this[_0x8751('0x12')][_0x49af71[_0x8751('0x77')]][_0x8751('0x7c')];logger[_0x8751('0x7d')](_0x8751('0x7e'),_0x39196e[_0x8751('0x54')],_0x39196e[_0x8751('0x5c')]);Object[_0x8751('0x7f')](_0x39196e,_[_0x8751('0x80')](_0x49af71,_[_0x8751('0x81')](_0x39196e)));this[_0x8751('0x46')][_0x49af71['uniqueid']][_0x8751('0x71')](_0x39196e);this[_0x8751('0x12')][_0x49af71['uniqueid']]=_0x39196e;this[_0x8751('0x4e')](_0x39196e,'queuecallerjoin');}}catch(_0x228afd){logger[_0x8751('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x49af71['uniqueid'],util[_0x8751('0x45')](_0x228afd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8751('0xc')]['syncQueueCallerAbandon']=function(_0x4ab91e){try{if(this[_0x8751('0x75')](_0x4ab91e)){logger[_0x8751('0x4f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4ab91e[_0x8751('0x77')],util[_0x8751('0x45')](_0x4ab91e,{'showHidden':![],'depth':null}));if(this[_0x8751('0x46')][_0x4ab91e['uniqueid']]){var _0x2c80db=_[_0x8751('0x82')](this[_0x8751('0x46')][_0x4ab91e[_0x8751('0x77')]]);_0x2c80db['queuecallercomplete']=![];_0x2c80db[_0x8751('0x83')]=null;_0x2c80db[_0x8751('0x84')]=_0x4ab91e[_0x8751('0x84')];_0x2c80db['originalposition']=_0x4ab91e['originalposition'];_0x2c80db['queuecallerabandon']=!![];_0x2c80db[_0x8751('0x85')]=moment()[_0x8751('0x52')](_0x8751('0x79'));_0x2c80db[_0x8751('0x57')]=_0x8751('0x86');_0x2c80db[_0x8751('0x87')]=null;logger[_0x8751('0x7d')](_0x8751('0x88'),_0x2c80db[_0x8751('0x54')],_0x2c80db[_0x8751('0x5c')]);this[_0x8751('0x12')][_0x4ab91e[_0x8751('0x77')]]=_0x2c80db;this[_0x8751('0x4b')](_0x2c80db,_0x8751('0x20'));}}}catch(_0x18b0c7){logger[_0x8751('0x43')](_0x8751('0x89'),_0x4ab91e[_0x8751('0x77')],util['inspect'](_0x18b0c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8751('0x23')]=function(_0x246fe2){try{if(this[_0x8751('0x75')](_0x246fe2)){logger[_0x8751('0x4f')](_0x8751('0x8a'),_0x246fe2[_0x8751('0x77')],util[_0x8751('0x45')](_0x246fe2,{'showHidden':![],'depth':null}));if(this[_0x8751('0x46')][_0x246fe2['uniqueid']]){var _0x32103c=_[_0x8751('0x82')](this[_0x8751('0x46')][_0x246fe2[_0x8751('0x77')]]);_0x32103c[_0x8751('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x32103c['connectedlinenum']=_0x246fe2[_0x8751('0x8c')];_0x32103c[_0x8751('0x8d')]=_0x246fe2[_0x8751('0x8d')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x32103c[_0x8751('0x54')],_0x32103c[_0x8751('0x5c')],_0x246fe2[_0x8751('0x8c')],_0x246fe2[_0x8751('0x8d')]);this[_0x8751('0x12')][_0x246fe2[_0x8751('0x77')]]=_0x32103c;this[_0x8751('0x4e')](_0x32103c,_0x8751('0x22'));}}}catch(_0x1261ed){logger[_0x8751('0x43')](_0x8751('0x8a'),_0x246fe2['uniqueid'],util[_0x8751('0x45')](_0x1261ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8751('0xc')][_0x8751('0x26')]=function(_0x18b5e3){try{if(this['isNotNull'](_0x18b5e3)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x18b5e3['uniqueid'],util['inspect'](_0x18b5e3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x18b5e3[_0x8751('0x77')]]){var _0x8946f8=_[_0x8751('0x82')](this[_0x8751('0x46')][_0x18b5e3[_0x8751('0x77')]]);_0x8946f8[_0x8751('0x3c')]=!![];_0x8946f8[_0x8751('0x57')]=_0x8751('0x8e');logger['info'](_0x8751('0x8f'),_0x8946f8[_0x8751('0x54')],_0x8946f8[_0x8751('0x5c')]);}}}catch(_0x4c6319){logger[_0x8751('0x43')](_0x8751('0x90'),_0x18b5e3[_0x8751('0x77')],util[_0x8751('0x45')](_0x4c6319,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8751('0xc')]['syncAgentComplete']=function(_0x5200d7){try{if(this['isNotNull'](_0x5200d7)){logger['debug'](_0x8751('0x91'),_0x5200d7[_0x8751('0x77')],util[_0x8751('0x45')](_0x5200d7,{'showHidden':![],'depth':null}));if(this[_0x8751('0x46')][_0x5200d7[_0x8751('0x77')]]){var _0x29c1a5=_[_0x8751('0x82')](this[_0x8751('0x46')][_0x5200d7['uniqueid']]);_0x29c1a5[_0x8751('0x20')]=![];_0x29c1a5[_0x8751('0x85')]=null;_0x29c1a5[_0x8751('0x92')]=!![];_0x29c1a5[_0x8751('0x87')]=_0x5200d7['membername'];_0x29c1a5['holdtime']=_0x5200d7[_0x8751('0x84')];_0x29c1a5['queuecallercomplete']=!![];_0x29c1a5[_0x8751('0x3b')]=![];_0x29c1a5[_0x8751('0x93')]=null;if(!_0x29c1a5[_0x8751('0x94')]){if(_0x5200d7[_0x8751('0x95')]==_0x8751('0x94')){_0x29c1a5[_0x8751('0x57')]=_0x8751('0x96');logger['info'](_0x8751('0x97'),_0x29c1a5[_0x8751('0x54')],_0x29c1a5[_0x8751('0x5c')]);}else{if(_[_0x8751('0x98')](_0x5200d7[_0x8751('0x3f')][_0x8751('0x99')](),'local/')){if(this['queueReports'][_0x5200d7[_0x8751('0x9a')]]){var _0x4b12ed=_[_0x8751('0x82')](this['queueReports'][_0x5200d7['linkedid']]);_0x4b12ed[_0x8751('0x3c')]=![];_0x4b12ed['queuecallerexit']=!![];_0x4b12ed[_0x8751('0x93')]=moment(_0x29c1a5[_0x8751('0x78')])[_0x8751('0x9b')](_0x5200d7['holdtime'],'seconds')['format'](_0x8751('0x79'));_0x4b12ed[_0x8751('0x57')]=_0x8751('0x9c');_0x4b12ed['transfer']=!![];_0x4b12ed[_0x8751('0x9d')]=_0x8751('0x9e');_0x4b12ed[_0x8751('0x9f')]=_0x5200d7['destexten'];_0x4b12ed['transferuniqueid']=_0x5200d7[_0x8751('0x77')];logger['info'](_0x8751('0xa0'),_0x4b12ed[_0x8751('0x54')],_0x4b12ed[_0x8751('0x5c')]);var _0x3f7462=this[_0x8751('0x46')][_0x5200d7[_0x8751('0x9a')]];this['queueReports'][_0x5200d7[_0x8751('0x9a')]]=this[_0x8751('0x46')][_0x5200d7['uniqueid']];this[_0x8751('0x46')][_0x5200d7['uniqueid']]=_0x3f7462;}}else{_0x29c1a5[_0x8751('0x57')]='COMPLETEDBY'+_0x5200d7[_0x8751('0x95')][_0x8751('0xa1')]();logger[_0x8751('0x7d')](_0x8751('0xa2'),_0x29c1a5[_0x8751('0x54')],_0x29c1a5[_0x8751('0x5c')],_0x29c1a5[_0x8751('0x57')]);}}}this[_0x8751('0x12')][_0x5200d7['uniqueid']]=_0x29c1a5;}}}catch(_0x2ecca6){logger[_0x8751('0x43')](_0x8751('0x91'),_0x5200d7[_0x8751('0x77')],util[_0x8751('0x45')](_0x2ecca6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8751('0xc')]['syncVarSet']=function(_0x1820eb){try{if(this[_0x8751('0x75')](_0x1820eb)){logger['debug']('[%s][voiceQueueReport][varset]',_0x1820eb[_0x8751('0x77')],util['inspect'](_0x1820eb,{'showHidden':![],'depth':null}));this[_0x8751('0xa3')](_0x1820eb[_0x8751('0x77')],_[_0x8751('0x81')](_0x1820eb[_0x8751('0xa4')])[0x0],_0x1820eb[_0x8751('0xa5')]);if(this[_0x8751('0x46')][_0x1820eb[_0x8751('0x77')]]){var _0x48ff1f=_[_0x8751('0x82')](this['queueReports'][_0x1820eb[_0x8751('0x77')]]);if(_0x48ff1f){if(this[_0x8751('0x75')](_0x1820eb[_0x8751('0xa4')])&&this[_0x8751('0x75')](_0x1820eb[_0x8751('0xa4')]['queuestatus'])){switch(_0x1820eb['value']){case'CONTINUE':_0x48ff1f[_0x8751('0x3b')]=![];_0x48ff1f[_0x8751('0x93')]=null;break;case _0x8751('0xa6'):_0x48ff1f['lastevent']='timeout';_0x48ff1f[_0x8751('0x3b')]=!![];_0x48ff1f[_0x8751('0x93')]=moment()[_0x8751('0x52')](_0x8751('0x79'));_0x48ff1f[_0x8751('0x8b')]=moment()[_0x8751('0x52')](_0x8751('0x79'));logger['debug'](_0x8751('0xa7'),_0x1820eb[_0x8751('0x77')],util['inspect'](_0x48ff1f,{'showHidden':![],'depth':null}));ami['emit'](_0x8751('0xa8'),_0x48ff1f);break;default:_0x48ff1f[_0x8751('0x3b')]=!![];_0x48ff1f[_0x8751('0x93')]=moment()['format'](_0x8751('0x79'));_0x48ff1f['queuecallerleaveAt']=moment()[_0x8751('0x52')](_0x8751('0x79'));}_0x48ff1f['queuecallerabandon']=![];_0x48ff1f[_0x8751('0x85')]=null;_0x48ff1f[_0x8751('0x57')]=_0x1820eb[_0x8751('0xa5')];this[_0x8751('0x12')][_0x1820eb[_0x8751('0x77')]]=_0x48ff1f;this[_0x8751('0x4b')](_0x48ff1f,_0x8751('0x27'));}else if(this[_0x8751('0x75')](_0x1820eb[_0x8751('0xa4')])&&this['isNotNull'](_0x1820eb['variable']['queueposition'])){if(!_0x48ff1f[_0x8751('0x20')]){_0x48ff1f['queuecallerexit']=!![];_0x48ff1f[_0x8751('0x93')]=moment()[_0x8751('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x48ff1f['queuecallerexitreason']=_0x8751('0xa9');_0x48ff1f[_0x8751('0x8b')]=moment()[_0x8751('0x52')](_0x8751('0x79'));this[_0x8751('0x12')][_0x1820eb[_0x8751('0x77')]]=_0x48ff1f;}}logger[_0x8751('0x7d')](_0x8751('0xaa'),_0x1820eb[_0x8751('0x77')],_0x48ff1f[_0x8751('0x54')],_0x48ff1f[_0x8751('0x5c')],_[_0x8751('0x81')](_0x1820eb[_0x8751('0xa4')])[0x0],_0x1820eb[_0x8751('0xa5')]);_0x48ff1f[_0x8751('0xab')]=this[_0x8751('0xab')][_0x1820eb[_0x8751('0x77')]];}}}}catch(_0x12fa8b){logger[_0x8751('0x43')](_0x8751('0xac'),_0x1820eb['uniqueid'],util[_0x8751('0x45')](_0x12fa8b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8751('0xc')][_0x8751('0xa3')]=function(_0x3aaff6,_0x453e0d,_0x36a5e0){var _0x3024fa=[_0x8751('0xad'),_0x8751('0xae'),_0x8751('0xaf'),_0x8751('0xb0'),_0x8751('0xb1'),_0x8751('0xb2'),_0x8751('0xb3'),_0x8751('0xb4'),'sipcallid','sipuri',_0x8751('0xb5'),_0x8751('0xb6'),_0x8751('0xb7'),_0x8751('0xb8'),_0x8751('0xb9'),'memberlastcall','membername',_0x8751('0xba'),_0x8751('0xbb')];if(!_[_0x8751('0xbc')](_0x453e0d)&&!_[_0x8751('0xbd')](_0x3024fa,_0x453e0d)){if(_[_0x8751('0x60')](this[_0x8751('0xab')][_0x3aaff6])){this[_0x8751('0xab')][_0x3aaff6]={};}this[_0x8751('0xab')][_0x3aaff6][_0x453e0d]=_0x36a5e0;}};VoiceQueueReport[_0x8751('0xc')][_0x8751('0xbe')]=function(_0x17bf84,_0x1274a2,_0x4fa66a){try{var _0x45a8f2={};if(this[_0x8751('0x46')][_0x17bf84]){for(var _0x4dca85=0x0;_0x4dca850x0?!![]:![];if(!_0x179a17){return this['syncQueueSummaryComplete'](this[_0x5184('0x16')]['completeEvent']);}};VoiceQueueReport[_0x5184('0xb')][_0x5184('0x1d')]=function(_0x5745b6){var _0x245e66=this[_0x5184('0x16')]['id'];if(this[_0x5184('0x16')][_0x5184('0x6b')][_0x245e66]&&this[_0x5184('0x16')][_0x5184('0x6b')][_0x245e66][_0x5745b6[_0x5184('0x66')]]){this[_0x5184('0x16')]['queuestatus'][_0x245e66][_0x5745b6[_0x5184('0x66')]][_0x5184('0x11')]['push'](_0x5745b6);}};VoiceQueueReport[_0x5184('0xb')][_0x5184('0x19')]=function(_0x1e330c){var _0xe3fa63=this;try{if(this[_0x5184('0x6f')](_0x1e330c)&&this[_0x5184('0x6f')](_0x1e330c[_0x5184('0x5a')])){logger[_0x5184('0x4f')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x5184('0x46')](_0x1e330c,{'showHidden':![],'depth':null}));var _0x3ccc95=this[_0x5184('0x14')][_0x1e330c['queue']];if(_0x3ccc95){logger[_0x5184('0x4f')](_0x5184('0x70'),_0x3ccc95[_0x5184('0x60')]);this[_0x5184('0x16')]['queues'][_0x3ccc95[_0x5184('0x60')]]={'summaryEvent':_0x1e330c};this[_0x5184('0x16')]['statusRequests']+=0x1;return ami[_0x5184('0x62')]({'action':_0x5184('0x6b'),'queue':_0x3ccc95[_0x5184('0x60')]})[_0x5184('0x65')](function(_0x1a34c2){if(!_0xe3fa63['summary'][_0x5184('0x6b')][_0x1e330c[_0x5184('0x66')]]){_0xe3fa63[_0x5184('0x16')][_0x5184('0x6b')][_0x1e330c[_0x5184('0x66')]]={};}_0xe3fa63[_0x5184('0x16')][_0x5184('0x6b')][_0x1e330c[_0x5184('0x66')]][_0x1a34c2[_0x5184('0x66')]]={'queue':_0x3ccc95[_0x5184('0x60')],'agents':[]};})[_0x5184('0x42')](function(_0x56aedc){throw _0x56aedc;});}}}catch(_0x30656e){logger[_0x5184('0x44')](_0x5184('0x67'),util['inspect'](_0x30656e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5184('0xb')]['syncQueueSummaryComplete']=function(_0x2b5517){if(this[_0x5184('0x16')][_0x5184('0x6e')]>0x0){this[_0x5184('0x16')]['completeEvent']=_0x2b5517;return;}logger[_0x5184('0x4f')](_0x5184('0x71'),util['inspect'](_0x2b5517,{'showHidden':![],'depth':null}));this[_0x5184('0x16')]=initializeSummary();ami[_0x5184('0x4e')](_0x5184('0x72'),{});};VoiceQueueReport[_0x5184('0xb')]['syncQueueCallerJoin']=function(_0x42fdd0){try{if(this[_0x5184('0x6f')](_0x42fdd0)){logger[_0x5184('0x4f')](_0x5184('0x73'),_0x42fdd0[_0x5184('0x51')],util['inspect'](_0x42fdd0,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x5184('0x47')][_0x42fdd0[_0x5184('0x51')]])){this['queueReports'][_0x42fdd0[_0x5184('0x51')]]=[];}if(_[_0x5184('0x61')](this['channels'][_0x42fdd0[_0x5184('0x51')]])){this[_0x5184('0x12')][_0x42fdd0[_0x5184('0x51')]]={};}var _0x393ac5=new QueueReport();_0x393ac5[_0x5184('0x5a')]=_0x42fdd0[_0x5184('0x5a')];_0x393ac5['type']=this[_0x5184('0x14')][_0x393ac5[_0x5184('0x5a')]]&&this[_0x5184('0x14')][_0x393ac5[_0x5184('0x5a')]]['type']?this[_0x5184('0x14')][_0x393ac5[_0x5184('0x5a')]]['type']||_0x5184('0x5e'):_0x5184('0x5e');_0x393ac5[_0x5184('0x74')]=moment()[_0x5184('0x59')](_0x5184('0x75'));_0x393ac5[_0x5184('0x76')]=_0x42fdd0[_0x5184('0x76')];_0x393ac5['count']=_0x42fdd0[_0x5184('0x77')];_0x393ac5[_0x5184('0x51')]=_0x42fdd0[_0x5184('0x51')];_0x393ac5['routealias']=this[_0x5184('0x12')][_0x42fdd0['uniqueid']][_0x5184('0x78')];logger[_0x5184('0x79')](_0x5184('0x7a'),_0x393ac5[_0x5184('0x5a')],_0x393ac5['type']);Object[_0x5184('0x6a')](_0x393ac5,_['pick'](_0x42fdd0,_[_0x5184('0x7b')](_0x393ac5)));this[_0x5184('0x47')][_0x42fdd0['uniqueid']][_0x5184('0x7c')](_0x393ac5);this[_0x5184('0x12')][_0x42fdd0[_0x5184('0x51')]]=_0x393ac5;this['emitVoiceQueueChannelSave'](_0x393ac5,'queuecallerjoin');}}catch(_0x462a9e){logger[_0x5184('0x44')](_0x5184('0x73'),_0x42fdd0['uniqueid'],util['inspect'](_0x462a9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5184('0xb')]['syncQueueCallerAbandon']=function(_0xa7330a){try{if(this[_0x5184('0x6f')](_0xa7330a)){logger['debug'](_0x5184('0x7d'),_0xa7330a[_0x5184('0x51')],util[_0x5184('0x46')](_0xa7330a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xa7330a[_0x5184('0x51')]]){var _0x23b787=_['last'](this[_0x5184('0x47')][_0xa7330a[_0x5184('0x51')]]);_0x23b787[_0x5184('0x3c')]=![];_0x23b787[_0x5184('0x7e')]=null;_0x23b787[_0x5184('0x7f')]=_0xa7330a['holdtime'];_0x23b787['originalposition']=_0xa7330a['originalposition'];_0x23b787[_0x5184('0x22')]=!![];_0x23b787['queuecallerabandonAt']=moment()[_0x5184('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x23b787[_0x5184('0x57')]=_0x5184('0x80');_0x23b787[_0x5184('0x81')]=null;logger['info'](_0x5184('0x82'),_0x23b787[_0x5184('0x5a')],_0x23b787[_0x5184('0x5d')]);this[_0x5184('0x12')][_0xa7330a[_0x5184('0x51')]]=_0x23b787;this[_0x5184('0x4c')](_0x23b787,_0x5184('0x22'));}}}catch(_0x4fb8d3){logger['error'](_0x5184('0x7d'),_0xa7330a['uniqueid'],util['inspect'](_0x4fb8d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5184('0xb')][_0x5184('0x24')]=function(_0x71856e){try{if(this['isNotNull'](_0x71856e)){logger[_0x5184('0x4f')]('[%s][voiceQueueReport][queuecallerleave]',_0x71856e[_0x5184('0x51')],util[_0x5184('0x46')](_0x71856e,{'showHidden':![],'depth':null}));if(this[_0x5184('0x47')][_0x71856e[_0x5184('0x51')]]){var _0x4c005e=_[_0x5184('0x83')](this['queueReports'][_0x71856e[_0x5184('0x51')]]);_0x4c005e[_0x5184('0x84')]=moment()[_0x5184('0x59')](_0x5184('0x75'));_0x4c005e[_0x5184('0x85')]=_0x71856e['connectedlinenum'];_0x4c005e[_0x5184('0x86')]=_0x71856e[_0x5184('0x86')];logger['info'](_0x5184('0x87'),_0x4c005e['queue'],_0x4c005e[_0x5184('0x5d')],_0x71856e[_0x5184('0x85')],_0x71856e['connectedlinename']);this[_0x5184('0x12')][_0x71856e[_0x5184('0x51')]]=_0x4c005e;this[_0x5184('0x88')](_0x4c005e,_0x5184('0x89'));}}}catch(_0x478567){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x71856e[_0x5184('0x51')],util[_0x5184('0x46')](_0x478567,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5184('0x28')]=function(_0x206d72){try{if(this[_0x5184('0x6f')](_0x206d72)){logger[_0x5184('0x4f')](_0x5184('0x8a'),_0x206d72['uniqueid'],util['inspect'](_0x206d72,{'showHidden':![],'depth':null}));if(this[_0x5184('0x47')][_0x206d72[_0x5184('0x51')]]){var _0xe4db05=_[_0x5184('0x83')](this[_0x5184('0x47')][_0x206d72['uniqueid']]);_0xe4db05['queuecallercomplete']=!![];_0xe4db05[_0x5184('0x57')]=_0x5184('0x8b');logger['info'](_0x5184('0x8c'),_0xe4db05[_0x5184('0x5a')],_0xe4db05[_0x5184('0x5d')]);}}}catch(_0x12ab39){logger['error'](_0x5184('0x8a'),_0x206d72['uniqueid'],util[_0x5184('0x46')](_0x12ab39,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5184('0xb')]['syncAgentComplete']=function(_0x8dfb63){try{if(this[_0x5184('0x6f')](_0x8dfb63)){logger[_0x5184('0x4f')](_0x5184('0x8d'),_0x8dfb63['uniqueid'],util[_0x5184('0x46')](_0x8dfb63,{'showHidden':![],'depth':null}));if(this[_0x5184('0x47')][_0x8dfb63['uniqueid']]){var _0x1ce2b4=_[_0x5184('0x83')](this['queueReports'][_0x8dfb63[_0x5184('0x51')]]);_0x1ce2b4['queuecallerabandon']=![];_0x1ce2b4['queuecallerabandonAt']=null;_0x1ce2b4['assigned']=!![];_0x1ce2b4[_0x5184('0x81')]=_0x8dfb63['membername'];_0x1ce2b4['holdtime']=_0x8dfb63[_0x5184('0x7f')];_0x1ce2b4[_0x5184('0x3c')]=!![];_0x1ce2b4[_0x5184('0x3b')]=![];_0x1ce2b4[_0x5184('0x8e')]=null;if(!_0x1ce2b4[_0x5184('0x8f')]){if(_0x8dfb63['reason']==_0x5184('0x8f')){_0x1ce2b4[_0x5184('0x57')]=_0x5184('0x90');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x1ce2b4['queue'],_0x1ce2b4[_0x5184('0x5d')]);}else{if(_['startsWith'](_0x8dfb63[_0x5184('0x41')][_0x5184('0x91')](),_0x5184('0x92'))){if(this[_0x5184('0x47')][_0x8dfb63[_0x5184('0x93')]]){var _0x21b105=_[_0x5184('0x83')](this[_0x5184('0x47')][_0x8dfb63[_0x5184('0x93')]]);_0x21b105[_0x5184('0x3c')]=![];_0x21b105[_0x5184('0x3b')]=!![];_0x21b105[_0x5184('0x8e')]=moment(_0x1ce2b4[_0x5184('0x74')])['add'](_0x8dfb63[_0x5184('0x7f')],_0x5184('0x94'))[_0x5184('0x59')](_0x5184('0x75'));_0x21b105['queuecallerexitreason']=_0x5184('0x95');_0x21b105[_0x5184('0x8f')]=!![];_0x21b105[_0x5184('0x96')]=_0x5184('0x97');_0x21b105['transferexten']=_0x8dfb63[_0x5184('0x98')];_0x21b105['transferuniqueid']=_0x8dfb63[_0x5184('0x51')];logger[_0x5184('0x79')](_0x5184('0x99'),_0x21b105[_0x5184('0x5a')],_0x21b105[_0x5184('0x5d')]);var _0x57ac02=this['queueReports'][_0x8dfb63[_0x5184('0x93')]];this['queueReports'][_0x8dfb63[_0x5184('0x93')]]=this[_0x5184('0x47')][_0x8dfb63[_0x5184('0x51')]];this[_0x5184('0x47')][_0x8dfb63['uniqueid']]=_0x57ac02;}}else{_0x1ce2b4['queuecallerexitreason']=_0x5184('0x9a')+_0x8dfb63[_0x5184('0x9b')][_0x5184('0x9c')]();logger[_0x5184('0x79')](_0x5184('0x9d'),_0x1ce2b4[_0x5184('0x5a')],_0x1ce2b4['type'],_0x1ce2b4[_0x5184('0x57')]);}}}this[_0x5184('0x12')][_0x8dfb63[_0x5184('0x51')]]=_0x1ce2b4;}}}catch(_0x3045b4){logger[_0x5184('0x44')]('[%s][voiceQueueReport][agentcomplete]',_0x8dfb63[_0x5184('0x51')],util[_0x5184('0x46')](_0x3045b4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5184('0x29')]=function(_0x31494d){try{if(this['isNotNull'](_0x31494d)){logger[_0x5184('0x4f')]('[%s][voiceQueueReport][varset]',_0x31494d[_0x5184('0x51')],util['inspect'](_0x31494d,{'showHidden':![],'depth':null}));this[_0x5184('0x9e')](_0x31494d[_0x5184('0x51')],_[_0x5184('0x7b')](_0x31494d[_0x5184('0x9f')])[0x0],_0x31494d[_0x5184('0xa0')]);if(this['queueReports'][_0x31494d['uniqueid']]){var _0x81ec75=_[_0x5184('0x83')](this[_0x5184('0x47')][_0x31494d[_0x5184('0x51')]]);if(_0x81ec75){if(this['isNotNull'](_0x31494d['variable'])&&this['isNotNull'](_0x31494d['variable'][_0x5184('0x6b')])){switch(_0x31494d[_0x5184('0xa0')]){case _0x5184('0xa1'):_0x81ec75[_0x5184('0x3b')]=![];_0x81ec75[_0x5184('0x8e')]=null;break;case _0x5184('0xa2'):_0x81ec75[_0x5184('0xa3')]=_0x5184('0xa4');_0x81ec75[_0x5184('0x3b')]=!![];_0x81ec75[_0x5184('0x8e')]=moment()[_0x5184('0x59')](_0x5184('0x75'));_0x81ec75[_0x5184('0x84')]=moment()[_0x5184('0x59')](_0x5184('0x75'));logger[_0x5184('0x4f')](_0x5184('0xa5'),_0x31494d[_0x5184('0x51')],util['inspect'](_0x81ec75,{'showHidden':![],'depth':null}));ami[_0x5184('0x4e')]('custom:timeout',_0x81ec75);break;default:_0x81ec75[_0x5184('0x3b')]=!![];_0x81ec75[_0x5184('0x8e')]=moment()['format'](_0x5184('0x75'));_0x81ec75['queuecallerleaveAt']=moment()[_0x5184('0x59')](_0x5184('0x75'));}_0x81ec75[_0x5184('0x22')]=![];_0x81ec75[_0x5184('0xa6')]=null;_0x81ec75[_0x5184('0x57')]=_0x31494d[_0x5184('0xa0')];this[_0x5184('0x12')][_0x31494d[_0x5184('0x51')]]=_0x81ec75;this['emitVoiceQueueChannelRemove'](_0x81ec75,_0x5184('0xa7'));}else if(this[_0x5184('0x6f')](_0x31494d[_0x5184('0x9f')])&&this['isNotNull'](_0x31494d[_0x5184('0x9f')][_0x5184('0xa8')])){if(!_0x81ec75[_0x5184('0x22')]){_0x81ec75['queuecallerexit']=!![];_0x81ec75[_0x5184('0x8e')]=moment()[_0x5184('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x81ec75[_0x5184('0x57')]=_0x5184('0xa9');_0x81ec75[_0x5184('0x84')]=moment()['format'](_0x5184('0x75'));this[_0x5184('0x12')][_0x31494d[_0x5184('0x51')]]=_0x81ec75;}}logger[_0x5184('0x79')](_0x5184('0xaa'),_0x31494d[_0x5184('0x51')],_0x81ec75[_0x5184('0x5a')],_0x81ec75[_0x5184('0x5d')],_[_0x5184('0x7b')](_0x31494d[_0x5184('0x9f')])[0x0],_0x31494d[_0x5184('0xa0')]);_0x81ec75['variables']=this['variables'][_0x31494d[_0x5184('0x51')]];}}}}catch(_0x563a05){logger[_0x5184('0x44')](_0x5184('0xab'),_0x31494d[_0x5184('0x51')],util[_0x5184('0x46')](_0x563a05,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5184('0xb')][_0x5184('0x9e')]=function(_0xc83c0e,_0x2353df,_0x4e8c50){var _0x4baf86=[_0x5184('0xac'),_0x5184('0xad'),_0x5184('0xae'),_0x5184('0xaf'),_0x5184('0xb0'),_0x5184('0xb1'),_0x5184('0xb2'),_0x5184('0xb3'),_0x5184('0xb4'),_0x5184('0xb5'),_0x5184('0xb6'),_0x5184('0xb7'),_0x5184('0xb8'),'memberdynamic',_0x5184('0xb9'),_0x5184('0xba'),_0x5184('0xbb'),_0x5184('0xbc'),_0x5184('0xbd')];if(!_['isNil'](_0x2353df)&&!_['includes'](_0x4baf86,_0x2353df)){if(_[_0x5184('0x61')](this[_0x5184('0x17')][_0xc83c0e])){this['variables'][_0xc83c0e]={};}this[_0x5184('0x17')][_0xc83c0e][_0x2353df]=_0x4e8c50;}};VoiceQueueReport['prototype'][_0x5184('0xbe')]=function(_0x9cd138,_0x17777a,_0x4166e0){try{var _0x36290f={};if(this[_0x5184('0x47')][_0x9cd138]){for(var _0x3a104a=0x0;_0x3a104a=0x0?moment(_0x5e18dd['endtime'])[_0xab69('0xb')](_0x5e18dd[_0xab69('0x18')],_0xab69('0xd')):null,'data1':_0xab69('0x1a'),'data2':_0x5e18dd[_0xab69('0x11')],'data3':_0x5e18dd[_0xab69('0x1b')],'data4':_0x5e18dd[_0xab69('0x1c')]||null,'role':'agent','internal':_0x5e18dd['accountcode']?_[_0xab69('0x12')](_0x5e18dd[_0xab69('0x11')]):undefined,'uniqueid':_0x5e18dd['uniqueid']},'log':_0xab69('0x6')});}; \ No newline at end of file +var _0xb2f7=['util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','accountcode','voiceDialReport','membername','starttime','endtime','outbound','dialstring','toNumber','moment'];(function(_0x43fc72,_0x34dd34){var _0xe0d78=function(_0xb95db8){while(--_0xb95db8){_0x43fc72['push'](_0x43fc72['shift']());}};_0xe0d78(++_0x34dd34);}(_0xb2f7,0x8b));var _0x7b2f=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xb2f7[_0x3899d1];return _0xeb4a7d;};'use strict';var moment=require(_0x7b2f('0x0'));var _=require('lodash');var util=require(_0x7b2f('0x1'));var client=require(_0x7b2f('0x2'));exports['voiceQueueReport']=function(_0x3aa768){var _0x4e0b76=_0x3aa768[_0x7b2f('0x3')]||_0x3aa768[_0x7b2f('0x4')];return client[_0x7b2f('0x5')](_0x7b2f('0x6'),{'body':{'channel':_0x7b2f('0x7'),'membername':_0x3aa768['lastAssignedTo'],'interface':_[_0x7b2f('0x8')](_0x3aa768[_0x7b2f('0x9')])?util[_0x7b2f('0xa')]('SIP/%s',_0x3aa768[_0x7b2f('0xb')]):_0x3aa768[_0x7b2f('0x9')],'type':_0x7b2f('0xc'),'enterAt':_0x3aa768[_0x7b2f('0xd')],'exitAt':_0x4e0b76,'duration':moment(_0x4e0b76)[_0x7b2f('0xe')](_0x3aa768['queuecallerleaveAt'],_0x7b2f('0xf')),'data1':_0x7b2f('0x10'),'data2':_0x3aa768[_0x7b2f('0x11')],'data3':_0x3aa768[_0x7b2f('0x12')],'data4':null,'data5':_0x3aa768[_0x7b2f('0x13')],'role':'agent','internal':_0x3aa768[_0x7b2f('0x14')]?_['toNumber'](_0x3aa768[_0x7b2f('0x14')]):undefined,'uniqueid':_0x3aa768['uniqueid']},'log':_0x7b2f('0x6')});};exports[_0x7b2f('0x15')]=function(_0x22eb4c){return client[_0x7b2f('0x5')]('CreateMemberReport',{'body':{'channel':_0x7b2f('0x7'),'membername':_0x22eb4c[_0x7b2f('0x16')],'interface':_0x22eb4c[_0x7b2f('0x9')],'type':_0x7b2f('0xc'),'enterAt':_0x22eb4c[_0x7b2f('0x17')],'exitAt':_0x22eb4c['endtime'],'duration':moment(_0x22eb4c[_0x7b2f('0x18')])[_0x7b2f('0xe')](_0x22eb4c[_0x7b2f('0x17')],_0x7b2f('0xf'))>=0x0?moment(_0x22eb4c[_0x7b2f('0x18')])['diff'](_0x22eb4c[_0x7b2f('0x17')],_0x7b2f('0xf')):null,'data1':_0x7b2f('0x19'),'data2':_0x22eb4c[_0x7b2f('0x14')],'data3':_0x22eb4c[_0x7b2f('0x12')],'data4':_0x22eb4c[_0x7b2f('0x1a')]||null,'role':'agent','internal':_0x22eb4c['accountcode']?_[_0x7b2f('0x1b')](_0x22eb4c['accountcode']):undefined,'uniqueid':_0x22eb4c['uniqueid']},'log':_0x7b2f('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 7e35ba3..9e5e0af 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 _0x35c0=['Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings'];(function(_0xd8b7c0,_0x19ff4d){var _0x4739a2=function(_0x386ec9){while(--_0x386ec9){_0xd8b7c0['push'](_0xd8b7c0['shift']());}};_0x4739a2(++_0x19ff4d);}(_0x35c0,0x10d));var _0x035c=function(_0x101842,_0x4db31b){_0x101842=_0x101842-0x0;var _0x45ce04=_0x35c0[_0x101842];return _0x45ce04;};'use strict';var client=require('../client');exports[_0x035c('0x0')]=function(){return client[_0x035c('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x035c('0x2'),_0x035c('0x3')]},'log':_0x035c('0x4')});}; \ No newline at end of file +var _0x61d0=['Request','ShowSetting','previewRecallmeReminderInterval','../client'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x61d0,0x187));var _0x061d=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x61d0[_0x1aeda2];return _0x32dc6d;};'use strict';var client=require(_0x061d('0x0'));exports['getSettings']=function(){return client[_0x061d('0x1')](_0x061d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x061d('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2c6e6fa..2aa2b77 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 _0x38fe=['GetTemplate','html','../client','getTemplates'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x38fe,0xfa));var _0xe38f=function(_0x78ef4f,_0x2dff56){_0x78ef4f=_0x78ef4f-0x0;var _0x451cb7=_0x38fe[_0x78ef4f];return _0x451cb7;};'use strict';var client=require(_0xe38f('0x0'));exports[_0xe38f('0x1')]=function(_0x1283da){return function(_0x42eaec){return client['Request'](_0xe38f('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xe38f('0x3')]},'log':_0xe38f('0x2')});};}; \ No newline at end of file +var _0x4189=['../client','Request','GetTemplate','html'];(function(_0x5bd3f2,_0x49f10b){var _0x444bfb=function(_0xae7210){while(--_0xae7210){_0x5bd3f2['push'](_0x5bd3f2['shift']());}};_0x444bfb(++_0x49f10b);}(_0x4189,0x13c));var _0x9418=function(_0x52b2db,_0x5e4db4){_0x52b2db=_0x52b2db-0x0;var _0x5a80db=_0x4189[_0x52b2db];return _0x5a80db;};'use strict';var client=require(_0x9418('0x0'));exports['getTemplates']=function(_0x114af8){return function(_0xbc128d){return client[_0x9418('0x1')](_0x9418('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x9418('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 0a7a345..19a9c91 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 _0x6d0e=['data3','data4','data5','data6','data7','GetTrigger','../client','Request','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2'];(function(_0x5aaa11,_0x1eed5e){var _0xde787e=function(_0x3c9599){while(--_0x3c9599){_0x5aaa11['push'](_0x5aaa11['shift']());}};_0xde787e(++_0x1eed5e);}(_0x6d0e,0xd8));var _0xe6d0=function(_0x531e4e,_0x2f458a){_0x531e4e=_0x531e4e-0x0;var _0x5c6ca9=_0x6d0e[_0x531e4e];return _0x5c6ca9;};'use strict';var client=require(_0xe6d0('0x0'));exports['getTriggers']=function(_0x2f2e4d){return function(_0xf36fa3){return client[_0xe6d0('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xe6d0('0x2'),_0xe6d0('0x3')],'include':[{'model':_0xe6d0('0x4'),'as':_0xe6d0('0x5'),'attributes':['id',_0xe6d0('0x6'),_0xe6d0('0x7'),_0xe6d0('0x8')]},{'model':_0xe6d0('0x4'),'as':_0xe6d0('0x9'),'attributes':['id',_0xe6d0('0x6'),_0xe6d0('0x7'),_0xe6d0('0x8')]},{'model':_0xe6d0('0xa'),'as':_0xe6d0('0xb'),'attributes':['id',_0xe6d0('0xc'),_0xe6d0('0xd'),_0xe6d0('0xe'),_0xe6d0('0xf'),_0xe6d0('0x10'),_0xe6d0('0x11'),_0xe6d0('0x12'),_0xe6d0('0x13')]}]},'log':_0xe6d0('0x14')});};}; \ No newline at end of file +var _0x1661=['Request','name','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','data1','data2','data4','data5','data7','GetTrigger','../client','getTriggers'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x1661,0x178));var _0x1166=function(_0x4b7a68,_0x2d75b8){_0x4b7a68=_0x4b7a68-0x0;var _0x192677=_0x1661[_0x4b7a68];return _0x192677;};'use strict';var client=require(_0x1166('0x0'));exports[_0x1166('0x1')]=function(_0x564147){return function(_0x3a0965){return client[_0x1166('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x1166('0x3'),'channel',_0x1166('0x4')],'include':[{'model':_0x1166('0x5'),'as':_0x1166('0x6'),'attributes':['id',_0x1166('0x7'),_0x1166('0x8'),'value']},{'model':_0x1166('0x5'),'as':_0x1166('0x9'),'attributes':['id',_0x1166('0x7'),'operator',_0x1166('0xa')]},{'model':_0x1166('0xb'),'as':'Actions','attributes':['id','action',_0x1166('0xc'),_0x1166('0xd'),'data3',_0x1166('0xe'),_0x1166('0xf'),'data6',_0x1166('0x10')]}]},'log':_0x1166('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 292980b..fc431b0 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 _0x4862=['defaultuser','GetTrunk','../client','Request','name'];(function(_0x3b736d,_0x22ed4c){var _0x5cde72=function(_0x2ca979){while(--_0x2ca979){_0x3b736d['push'](_0x3b736d['shift']());}};_0x5cde72(++_0x22ed4c);}(_0x4862,0x129));var _0x2486=function(_0x4a60b0,_0x432b5c){_0x4a60b0=_0x4a60b0-0x0;var _0x3d2e72=_0x4862[_0x4a60b0];return _0x3d2e72;};'use strict';var client=require(_0x2486('0x0'));exports['getTrunks']=function(_0x40b04d){return function(_0x2a9705){return client[_0x2486('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2486('0x2'),'registry',_0x2486('0x3')]},'log':_0x2486('0x4')});};}; \ No newline at end of file +var _0x3773=['Request','GetTrunk','name','registry','defaultuser','getTrunks'];(function(_0x1aa2d1,_0x346f58){var _0x447dc3=function(_0x47d082){while(--_0x47d082){_0x1aa2d1['push'](_0x1aa2d1['shift']());}};_0x447dc3(++_0x346f58);}(_0x3773,0x1a9));var _0x3377=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3773[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require('../client');exports[_0x3377('0x0')]=function(_0xd5c921){return function(_0x4a0655){return client[_0x3377('0x1')](_0x3377('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3377('0x3'),_0x3377('0x4'),_0x3377('0x5')]},'log':_0x3377('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index cc79197..7013dcb 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x17e95b,_0x1815ff){var _0x4b7398=function(_0x3205f6){while(--_0x3205f6){_0x17e95b['push'](_0x17e95b['shift']());}};_0x4b7398(++_0x1815ff);}(_0x70e0,0x17b));var _0x070e=function(_0x17db82,_0x5d2b34){_0x17db82=_0x17db82-0x0;var _0x1b1abc=_0x70e0[_0x17db82];return _0x1b1abc;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c9ab054..3ddba98 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 _0x132d=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','create'];(function(_0x3642ef,_0x52a3e0){var _0x120adf=function(_0x2aee16){while(--_0x2aee16){_0x3642ef['push'](_0x3642ef['shift']());}};_0x120adf(++_0x52a3e0);}(_0x132d,0xaf));var _0xd132=function(_0x40741b,_0x380f1a){_0x40741b=_0x40741b-0x0;var _0x30e499=_0x132d[_0x40741b];return _0x30e499;};'use strict';var client=require('../client');exports[_0xd132('0x0')]=function(_0x672b66){return client[_0xd132('0x1')](_0xd132('0x2'),{'body':_0x672b66,'log':_0xd132('0x2')});};exports['update']=function(_0x24a607,_0x37a611,_0x47d71a){return client[_0xd132('0x1')](_0xd132('0x3'),{'body':_0x24a607,'options':{'where':{'uniqueid':_0x37a611,'interface':_0x47d71a,'agentcomplete':!![]}},'log':_0xd132('0x3')});}; \ No newline at end of file +var _0x2de7=['Request','UpdateVoiceAgentReport','../client','create'];(function(_0x1702d5,_0x99a8ca){var _0x2639f1=function(_0x133300){while(--_0x133300){_0x1702d5['push'](_0x1702d5['shift']());}};_0x2639f1(++_0x99a8ca);}(_0x2de7,0xda));var _0x72de=function(_0x51bb92,_0x4eaf84){_0x51bb92=_0x51bb92-0x0;var _0x3b1232=_0x2de7[_0x51bb92];return _0x3b1232;};'use strict';var client=require(_0x72de('0x0'));exports[_0x72de('0x1')]=function(_0x3e19fd){return client[_0x72de('0x2')]('CreateVoiceAgentReport',{'body':_0x3e19fd,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x106218,_0x2847f4,_0x57d166){return client['Request'](_0x72de('0x3'),{'body':_0x106218,'options':{'where':{'uniqueid':_0x2847f4,'interface':_0x57d166,'agentcomplete':!![]}},'log':_0x72de('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index c355091..47ce183 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 _0x786e=['GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x786e,0x79));var _0xe786=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x786e[_0x4c7fb5];return _0x2e10ac;};'use strict';var moment=require(_0xe786('0x0'));var util=require(_0xe786('0x1'));var _=require(_0xe786('0x2'));var client=require('../client');exports[_0xe786('0x3')]=function(_0x522ae0){return client['Request'](_0xe786('0x4'),{'body':_[_0xe786('0x5')](_0x522ae0,{'source':_0x522ae0['calleridnum'],'destinationcontext':_0x522ae0[_0xe786('0x6')],'callerid':_0x522ae0[_0xe786('0x7')],'amaflags':_0xe786('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xe786('0x9')]=function(){return function(){return client[_0xe786('0xa')](_0xe786('0xb'),{'options':{'where':{'type':[_0xe786('0xc')],'createdAt':{'$between':[moment()['startOf'](_0xe786('0xd'))[_0xe786('0xe')](_0xe786('0xf')),moment()[_0xe786('0x10')](_0xe786('0xd'))['format'](_0xe786('0xf'))]}},'attributes':[_0xe786('0x11'),_0xe786('0x12'),_0xe786('0x13'),_0xe786('0x14')]},'log':_0xe786('0x15')});};}; \ No newline at end of file +var _0x5d75=['GetVoiceCallReport','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports'];(function(_0x20e135,_0x2e46e1){var _0x3ab6cb=function(_0x349463){while(--_0x349463){_0x20e135['push'](_0x20e135['shift']());}};_0x3ab6cb(++_0x2e46e1);}(_0x5d75,0x15b));var _0x55d7=function(_0x3c6d0c,_0x33b1f5){_0x3c6d0c=_0x3c6d0c-0x0;var _0x2c3e2e=_0x5d75[_0x3c6d0c];return _0x2c3e2e;};'use strict';var moment=require(_0x55d7('0x0'));var util=require(_0x55d7('0x1'));var _=require(_0x55d7('0x2'));var client=require('../client');exports['create']=function(_0x43b8a5){return client[_0x55d7('0x3')](_0x55d7('0x4'),{'body':_[_0x55d7('0x5')](_0x43b8a5,{'source':_0x43b8a5[_0x55d7('0x6')],'destinationcontext':_0x43b8a5[_0x55d7('0x7')],'callerid':_0x43b8a5['callerid'],'amaflags':_0x55d7('0x8')}),'log':_0x55d7('0x4')});};exports[_0x55d7('0x9')]=function(){return function(){return client['Request'](_0x55d7('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x55d7('0xb')](_0x55d7('0xc'))['format'](_0x55d7('0xd')),moment()[_0x55d7('0xe')](_0x55d7('0xc'))[_0x55d7('0xf')](_0x55d7('0xd'))]}},'attributes':[_0x55d7('0x10'),_0x55d7('0x11'),_0x55d7('0x12'),_0x55d7('0x13')]},'log':_0x55d7('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f6785a5..f66cdb0 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 _0x6b7c=['../client','Request','CreateVoiceDialReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6b7c,0xb1));var _0xc6b7=function(_0x3159c0,_0x592776){_0x3159c0=_0x3159c0-0x0;var _0x12411f=_0x6b7c[_0x3159c0];return _0x12411f;};'use strict';var client=require(_0xc6b7('0x0'));exports['create']=function(_0x3cc9fe){return client[_0xc6b7('0x1')](_0xc6b7('0x2'),{'body':_0x3cc9fe,'log':_0xc6b7('0x2')});}; \ No newline at end of file +var _0x72f4=['CreateVoiceDialReport','Request'];(function(_0x14f456,_0x3b6bb7){var _0x444e80=function(_0x76c6f3){while(--_0x76c6f3){_0x14f456['push'](_0x14f456['shift']());}};_0x444e80(++_0x3b6bb7);}(_0x72f4,0xd9));var _0x472f=function(_0x355494,_0x5a2f21){_0x355494=_0x355494-0x0;var _0x18b7e0=_0x72f4[_0x355494];return _0x18b7e0;};'use strict';var client=require('../client');exports['create']=function(_0x2e2893){return client[_0x472f('0x0')](_0x472f('0x1'),{'body':_0x2e2893,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index df815c6..e335b66 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 _0xcffe=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x122831,_0x2a35be){var _0x3f40fc=function(_0x2efb7b){while(--_0x2efb7b){_0x122831['push'](_0x122831['shift']());}};_0x3f40fc(++_0x2a35be);}(_0xcffe,0x1a1));var _0xecff=function(_0x37a0ab,_0x34b900){_0x37a0ab=_0x37a0ab-0x0;var _0x13ca1d=_0xcffe[_0x37a0ab];return _0x13ca1d;};'use strict';var client=require(_0xecff('0x0'));exports[_0xecff('0x1')]=function(){return function(){return client[_0xecff('0x2')](_0xecff('0x3'),{'options':{'raw':!![],'attributes':['id',_0xecff('0x4'),_0xecff('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xecff('0x1')});};}; \ No newline at end of file +var _0xb332=['recordingFormat','../client','Request','GetVoiceExtension'];(function(_0x3c52a2,_0x381c78){var _0x5860e8=function(_0x5a9bbd){while(--_0x5a9bbd){_0x3c52a2['push'](_0x3c52a2['shift']());}};_0x5860e8(++_0x381c78);}(_0xb332,0xd9));var _0x2b33=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xb332[_0x2cfb58];return _0xd99951;};'use strict';var client=require(_0x2b33('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x2b33('0x1')](_0x2b33('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x2b33('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 9cede5a..455e5e4 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 _0x1a95=['acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','active','Pause','TrunkBackup','callerid','Interval','interval','getVoiceQueues','GetVoiceQueue','name','acw'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1a95,0xaa));var _0x51a9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1a95[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0x51a9('0x0')]=function(){return function(){return client['Request'](_0x51a9('0x1'),{'options':{'raw':![],'attributes':['id',_0x51a9('0x2'),_0x51a9('0x3'),_0x51a9('0x4'),_0x51a9('0x5'),_0x51a9('0x6'),_0x51a9('0x7'),_0x51a9('0x8'),_0x51a9('0x9'),_0x51a9('0xa'),'dialLimitQueue','dialPowerLevel',_0x51a9('0xb'),_0x51a9('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x51a9('0xd'),_0x51a9('0xe'),'dialQueueOptions',_0x51a9('0xf'),_0x51a9('0x10'),_0x51a9('0x11'),'dialCongestionRetryFrequency',_0x51a9('0x12'),_0x51a9('0x13'),_0x51a9('0x14'),_0x51a9('0x15'),_0x51a9('0x16'),_0x51a9('0x17'),_0x51a9('0x18'),'dialPrefix',_0x51a9('0x19'),_0x51a9('0x1a'),_0x51a9('0x1b'),_0x51a9('0x1c'),_0x51a9('0x1d'),'dialAMDTotalAnalysisTime',_0x51a9('0x1e'),_0x51a9('0x1f'),_0x51a9('0x20'),_0x51a9('0x21'),'dialAMDMaximumWordLength',_0x51a9('0x22'),_0x51a9('0x23'),'dialRecallInQueue',_0x51a9('0x24'),_0x51a9('0x25'),_0x51a9('0x26'),_0x51a9('0x27'),_0x51a9('0x6'),'strategy',_0x51a9('0x28'),_0x51a9('0x29'),_0x51a9('0x2a'),_0x51a9('0x2b'),_0x51a9('0x2c'),'dialDropRetryFrequency',_0x51a9('0x2d'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x51a9('0x2e'),'dialAgentRejectMaxRetry',_0x51a9('0x2f'),'mandatoryDisposition',_0x51a9('0x30'),_0x51a9('0x31'),'dialPreviewAutoRecallMe',_0x51a9('0x32')],'include':[{'model':_0x51a9('0x33'),'as':_0x51a9('0x33'),'attributes':['id',_0x51a9('0x2'),'callerid',_0x51a9('0x34')]},{'model':_0x51a9('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0x51a9('0x2')]},{'model':_0x51a9('0x33'),'as':_0x51a9('0x36'),'attributes':['id',_0x51a9('0x2'),_0x51a9('0x37'),_0x51a9('0x34')]},{'model':'Interval','as':_0x51a9('0x38'),'attributes':['id','name'],'include':[{'model':_0x51a9('0x38'),'as':'Intervals','attributes':['id',_0x51a9('0x2'),_0x51a9('0x39')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x4560=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','Pause','mandatoryDispositionPause','TrunkBackup','callerid','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions'];(function(_0x5d2b4d,_0x814f08){var _0xa7cef5=function(_0x4dfcbf){while(--_0x4dfcbf){_0x5d2b4d['push'](_0x5d2b4d['shift']());}};_0xa7cef5(++_0x814f08);}(_0x4560,0x195));var _0x0456=function(_0x1b75f3,_0x522344){_0x1b75f3=_0x1b75f3-0x0;var _0x520c35=_0x4560[_0x1b75f3];return _0x520c35;};'use strict';var client=require(_0x0456('0x0'));exports[_0x0456('0x1')]=function(){return function(){return client[_0x0456('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x0456('0x3'),_0x0456('0x4'),_0x0456('0x5'),_0x0456('0x6'),_0x0456('0x7'),_0x0456('0x8'),'dialActive','dialMethod',_0x0456('0x9'),'dialLimitQueue','dialPowerLevel',_0x0456('0xa'),_0x0456('0xb'),_0x0456('0xc'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x0456('0xd'),_0x0456('0xe'),'dialQueueTimeout',_0x0456('0xf'),_0x0456('0x10'),_0x0456('0x11'),'dialBusyMaxRetry',_0x0456('0x12'),'dialNoAnswerMaxRetry',_0x0456('0x13'),_0x0456('0x14'),_0x0456('0x15'),_0x0456('0x16'),'dialPrefix',_0x0456('0x17'),_0x0456('0x18'),_0x0456('0x19'),'dialAMDGreeting',_0x0456('0x1a'),_0x0456('0x1b'),_0x0456('0x1c'),_0x0456('0x1d'),_0x0456('0x1e'),_0x0456('0x1f'),_0x0456('0x20'),_0x0456('0x21'),_0x0456('0x22'),_0x0456('0x23'),_0x0456('0x24'),'dialAgiAfterHangupAgent',_0x0456('0x25'),_0x0456('0x26'),'monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x0456('0x27'),_0x0456('0x28'),_0x0456('0x29'),_0x0456('0x2a'),_0x0456('0x2b'),_0x0456('0x2c'),_0x0456('0x2d'),'dialMachineRetryFrequency',_0x0456('0x2e'),_0x0456('0x2f'),_0x0456('0x30'),_0x0456('0x31'),'dialPredictiveIntervalMinThreshold',_0x0456('0x32'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x0456('0x33'),'attributes':['id',_0x0456('0x3'),'callerid','active']},{'model':_0x0456('0x34'),'as':_0x0456('0x35'),'attributes':['id',_0x0456('0x3')]},{'model':_0x0456('0x33'),'as':_0x0456('0x36'),'attributes':['id',_0x0456('0x3'),_0x0456('0x37'),_0x0456('0x38')]},{'model':_0x0456('0x39'),'as':'Interval','attributes':['id',_0x0456('0x3')],'include':[{'model':_0x0456('0x39'),'as':_0x0456('0x3a'),'attributes':['id',_0x0456('0x3'),_0x0456('0x3b')]}]}]},'log':_0x0456('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e7ade6b..dc6f1db 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(_0x5f5835,_0x51bb50){var _0x2ce9af=function(_0x1710ed){while(--_0x1710ed){_0x5f5835['push'](_0x5f5835['shift']());}};_0x2ce9af(++_0x51bb50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x38c639,_0x35b5bd){var _0x1fcfa8=function(_0x134dc5){while(--_0x134dc5){_0x38c639['push'](_0x38c639['shift']());}};_0x1fcfa8(++_0x35b5bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 b5b5a96..6b5b408 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 _0x4216=['Request','../client','getVoiceQueueRtPauses'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0x4216,0x19c));var _0x6421=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4216[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x6421('0x0'));exports[_0x6421('0x1')]=function(_0x2a9a4a){return function(){return client[_0x6421('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2a9a4a,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xd760=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd760,0x1b3));var _0x0d76=function(_0x3a5153,_0x521a9f){_0x3a5153=_0x3a5153-0x0;var _0x3df18e=_0xd760[_0x3a5153];return _0x3df18e;};'use strict';var client=require(_0x0d76('0x0'));exports[_0x0d76('0x1')]=function(_0x2ce5e7){return function(){return client['Request'](_0x0d76('0x2'),{'options':{'where':{'VoiceQueueId':_0x2ce5e7,'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 db0f7f8..d24dec5 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(_0x2388e5,_0x448c43){var _0x36ed45=function(_0x43049f){while(--_0x43049f){_0x2388e5['push'](_0x2388e5['shift']());}};_0x36ed45(++_0x448c43);}(_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(_0x5a972e,_0x109a57){var _0x1e44d6=function(_0x463dfa){while(--_0x463dfa){_0x5a972e['push'](_0x5a972e['shift']());}};_0x1e44d6(++_0x109a57);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 d583988..1a1174f 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 _0x7c81=['transfereecontext','transfereeexten','isexternal','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x58781a,_0x2f77bf){var _0x1e1b11=function(_0x1bddd7){while(--_0x1bddd7){_0x58781a['push'](_0x58781a['shift']());}};_0x1e1b11(++_0x2f77bf);}(_0x7c81,0x163));var _0x17c8=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x7c81[_0x2caaef];return _0xd011f8;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x17c8('0x0')]=function(_0x5cbd1f){return client[_0x17c8('0x1')](_0x17c8('0x2'),{'body':{'result':_0x5cbd1f[_0x17c8('0x3')],'transfererchannel':_0x5cbd1f['transfererchannel'],'transferercalleridnum':_0x5cbd1f[_0x17c8('0x4')],'transferercalleridname':_0x5cbd1f['transferercalleridname'],'transfererconnectedlinenum':_0x5cbd1f['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5cbd1f[_0x17c8('0x5')],'transfereraccountcode':_0x5cbd1f[_0x17c8('0x6')],'transferercontext':_0x5cbd1f[_0x17c8('0x7')],'transfererexten':_0x5cbd1f[_0x17c8('0x8')],'transfererlinkedid':_0x5cbd1f['transfererlinkedid'],'transfereechannel':_0x5cbd1f[_0x17c8('0x9')],'transfereecalleridnum':_0x5cbd1f[_0x17c8('0xa')],'transfereecalleridname':_0x5cbd1f[_0x17c8('0xb')],'transfereeconnectedlinenum':_0x5cbd1f[_0x17c8('0xc')],'transfereeconnectedlinename':_0x5cbd1f[_0x17c8('0xd')],'transfereeaccountcode':_0x5cbd1f[_0x17c8('0xe')],'transfereecontext':_0x5cbd1f[_0x17c8('0xf')],'transfereeexten':_0x5cbd1f[_0x17c8('0x10')],'transfereelinkedid':_0x5cbd1f['transfereelinkedid'],'isexternal':_0x5cbd1f[_0x17c8('0x11')],'context':_0x5cbd1f['context'],'extension':_0x5cbd1f[_0x17c8('0x12')],'type':'blind'},'log':_0x17c8('0x2')});};exports[_0x17c8('0x13')]=function(_0x474a5f){return client['Request'](_0x17c8('0x2'),{'body':{'result':_0x474a5f[_0x17c8('0x3')],'transfererchannel':_0x474a5f[_0x17c8('0x14')],'transferercalleridnum':_0x474a5f[_0x17c8('0x15')],'transferercalleridname':_0x474a5f[_0x17c8('0x16')],'transfererconnectedlinenum':_0x474a5f[_0x17c8('0x17')],'transfererconnectedlinename':_0x474a5f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x474a5f[_0x17c8('0x18')],'transferercontext':_0x474a5f[_0x17c8('0x19')],'transfererexten':_0x474a5f[_0x17c8('0x1a')],'transfererlinkedid':_0x474a5f[_0x17c8('0x1b')],'transfereechannel':_0x474a5f[_0x17c8('0x1c')],'transfereecalleridnum':_0x474a5f[_0x17c8('0x1d')],'transfereecalleridname':_0x474a5f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x474a5f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x474a5f[_0x17c8('0x1e')],'transfereeaccountcode':_0x474a5f[_0x17c8('0x1f')],'transfereecontext':_0x474a5f[_0x17c8('0x20')],'transfereeexten':_0x474a5f[_0x17c8('0x21')],'transfereelinkedid':_0x474a5f[_0x17c8('0x22')],'isexternal':_0x474a5f['isexternal'],'context':_0x474a5f[_0x17c8('0x23')],'extension':_0x474a5f[_0x17c8('0x24')],'type':'attended'},'log':_0x17c8('0x2')});}; \ No newline at end of file +var _0x3865=['transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result'];(function(_0x180391,_0x55d9ff){var _0x4ded40=function(_0x395160){while(--_0x395160){_0x180391['push'](_0x180391['shift']());}};_0x4ded40(++_0x55d9ff);}(_0x3865,0x1c3));var _0x5386=function(_0x221226,_0x17a0d3){_0x221226=_0x221226-0x0;var _0x438159=_0x3865[_0x221226];return _0x438159;};'use strict';var client=require('../client');exports[_0x5386('0x0')]={};exports[_0x5386('0x1')]=function(_0x286df2){return client[_0x5386('0x2')](_0x5386('0x3'),{'body':{'result':_0x286df2[_0x5386('0x4')],'transfererchannel':_0x286df2[_0x5386('0x5')],'transferercalleridnum':_0x286df2['transferercalleridnum'],'transferercalleridname':_0x286df2[_0x5386('0x6')],'transfererconnectedlinenum':_0x286df2[_0x5386('0x7')],'transfererconnectedlinename':_0x286df2[_0x5386('0x8')],'transfereraccountcode':_0x286df2[_0x5386('0x9')],'transferercontext':_0x286df2[_0x5386('0xa')],'transfererexten':_0x286df2[_0x5386('0xb')],'transfererlinkedid':_0x286df2['transfererlinkedid'],'transfereechannel':_0x286df2['transfereechannel'],'transfereecalleridnum':_0x286df2[_0x5386('0xc')],'transfereecalleridname':_0x286df2[_0x5386('0xd')],'transfereeconnectedlinenum':_0x286df2[_0x5386('0xe')],'transfereeconnectedlinename':_0x286df2['transfereeconnectedlinename'],'transfereeaccountcode':_0x286df2[_0x5386('0xf')],'transfereecontext':_0x286df2['transfereecontext'],'transfereeexten':_0x286df2[_0x5386('0x10')],'transfereelinkedid':_0x286df2[_0x5386('0x11')],'isexternal':_0x286df2[_0x5386('0x12')],'context':_0x286df2[_0x5386('0x13')],'extension':_0x286df2[_0x5386('0x14')],'type':_0x5386('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0x5386('0x16')]=function(_0x233353){return client[_0x5386('0x2')](_0x5386('0x3'),{'body':{'result':_0x233353[_0x5386('0x4')],'transfererchannel':_0x233353[_0x5386('0x17')],'transferercalleridnum':_0x233353[_0x5386('0x18')],'transferercalleridname':_0x233353[_0x5386('0x19')],'transfererconnectedlinenum':_0x233353['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x233353['secondtransfererconnectedlinename'],'transfereraccountcode':_0x233353['origtransfereraccountcode'],'transferercontext':_0x233353['secondtransferercontext'],'transfererexten':_0x233353[_0x5386('0x1a')],'transfererlinkedid':_0x233353[_0x5386('0x1b')],'transfereechannel':_0x233353[_0x5386('0x1c')],'transfereecalleridnum':_0x233353[_0x5386('0x1d')],'transfereecalleridname':_0x233353['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x233353[_0x5386('0x1e')],'transfereeconnectedlinename':_0x233353[_0x5386('0x1f')],'transfereeaccountcode':_0x233353[_0x5386('0x20')],'transfereecontext':_0x233353[_0x5386('0x21')],'transfereeexten':_0x233353['transfertargetexten'],'transfereelinkedid':_0x233353[_0x5386('0x22')],'isexternal':_0x233353[_0x5386('0x12')],'context':_0x233353[_0x5386('0x23')],'extension':_0x233353[_0x5386('0x24')],'type':_0x5386('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5c58090..c053575 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x52fef7,_0x48c8f7){var _0x21966a=function(_0x217c8b){while(--_0x217c8b){_0x52fef7['push'](_0x52fef7['shift']());}};_0x21966a(++_0x48c8f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x56d20e,_0x217c31){_0x56d20e=_0x56d20e-0x0;var _0x18b27a=_0xb10b[_0x56d20e];return _0x18b27a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x1ae5e5,_0x43c317){var _0x4e5044=function(_0x3a1783){while(--_0x3a1783){_0x1ae5e5['push'](_0x1ae5e5['shift']());}};_0x4e5044(++_0x43c317);}(_0x7a54,0x106));var _0x47a5=function(_0x50db23,_0x35b91c){_0x50db23=_0x50db23-0x0;var _0xd6bd1a=_0x7a54[_0x50db23];return _0xd6bd1a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 0ffd0d6..1b190b8 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 _0x1a5a=['[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','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','ListId','data3','phone','$or','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','length'];(function(_0x47af1c,_0x26c3fd){var _0x26a862=function(_0x410ef2){while(--_0x410ef2){_0x47af1c['push'](_0x47af1c['shift']());}};_0x26a862(++_0x26c3fd);}(_0x1a5a,0x1d5));var _0xa1a5=function(_0x2d224c,_0x4602fa){_0x2d224c=_0x2d224c-0x0;var _0x47f222=_0x1a5a[_0x2d224c];return _0x47f222;};'use strict';var _=require(_0xa1a5('0x0'));var BPromise=require('bluebird');var Redis=require(_0xa1a5('0x1'));var util=require(_0xa1a5('0x2'));var config=require(_0xa1a5('0x3'));var logger=require(_0xa1a5('0x4'))(_0xa1a5('0x5'));var cmContactRpc=require(_0xa1a5('0x6'));config['redis']=_[_0xa1a5('0x7')](config[_0xa1a5('0x8')],{'host':_0xa1a5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa1a5('0x8')]));function emit(_0x3a9306,_0x30655a,_0x2b7b46,_0x3e3564,_0x521d68){logger[_0xa1a5('0xa')](_0xa1a5('0xb'),_0x3a9306,_0x30655a['id'],_0x2b7b46,_0x3e3564,JSON[_0xa1a5('0xc')](_0x521d68));io['to'](_0x2b7b46)[_0xa1a5('0xd')](_0x3e3564,_0x521d68);}exports['exec']=function(_0x4eebba,_0x45fa5e,_0x39d64d,_0x5d350e){var _0x5b4cc9,_0x28d857;var _0x4091c5={};var _0x514cca;var _0x1708aa=Number(_0x39d64d[_0xa1a5('0xe')]);var _0x2ff69f=_0x39d64d[_0xa1a5('0xf')]?Boolean(Number(_0x39d64d[_0xa1a5('0xf')])):![];var _0x8adf42;var _0x204ece=![];if(!_[_0xa1a5('0x10')](_0x39d64d[_0xa1a5('0x11')])){if(_0x39d64d[_0xa1a5('0x11')]=='1')_0x204ece=!![];}if(!_0x204ece){if(_0x5d350e['xmd-contactid']){_0x4091c5['id']=_0x5d350e['xmd-contactid'];}}if(!_0x4091c5['id']){_0x4091c5[_0xa1a5('0x12')]=_0x1708aa;_0x8adf42=_0x39d64d['data3']&&_0x39d64d['data3']!=='0'?_0x39d64d[_0xa1a5('0x13')]['split'](','):[_0xa1a5('0x14')];_0x4091c5[_0xa1a5('0x15')]=_['map'](_0x8adf42,function(_0x2e6c64){var _0x337d29={};_0x337d29[_0x2e6c64]=_0x5d350e['routeId']?_0x5d350e[_0xa1a5('0x16')]:_0x5d350e[_0xa1a5('0x17')];return _0x337d29;});_0x514cca=_0x5d350e['routeId']?_0x5d350e['destcalleridnum']:_0x5d350e[_0xa1a5('0x17')];}var _0x1d0d9b=['id',_0xa1a5('0x18'),'lastName',_0xa1a5('0x14'),_0xa1a5('0x19'),_0xa1a5('0x1a'),'ListId',_0xa1a5('0x1b'),'scheduledAt',_0xa1a5('0x1c')];var _0x323876=_[_0xa1a5('0x1d')](_0x1d0d9b,_0x8adf42);BPromise[_0xa1a5('0x1e')]()[_0xa1a5('0x1f')](cmContactRpc[_0xa1a5('0x20')]({'attributes':_0x323876,'where':_0x4091c5,'phone':_0x514cca}))[_0xa1a5('0x1f')](function(_0x246253){_0x28d857=_0x246253;if(!_[_0xa1a5('0x21')](_0x28d857)){if(_0x28d857[_0xa1a5('0x22')]===0x1){_0x5b4cc9=_0x28d857[0x0];logger[_0xa1a5('0xa')](_0xa1a5('0x23'),_0x5d350e[_0xa1a5('0x24')],_0x45fa5e['id'],_0x5b4cc9['id']);}else{logger[_0xa1a5('0xa')](_0xa1a5('0x25'),_0x5d350e[_0xa1a5('0x24')],_0x45fa5e['id'],_['map'](_0x28d857,'id')[_0xa1a5('0x26')](','));}return;}else{logger[_0xa1a5('0xa')](_0xa1a5('0x27'),_0x5d350e['uniqueid'],_0x45fa5e['id']);var _0x5cba2={'ListId':_0x1708aa};var _0x2352ef=_0x39d64d['data4']&&_0x39d64d['data4']!=='0'?_0x39d64d[_0xa1a5('0x28')]:_0xa1a5('0x14');if(_0x2ff69f){logger['info'](_0xa1a5('0x29'),_0x5d350e['uniqueid'],_0x45fa5e['id']);_0x5cba2[_0x2352ef]=_[_0xa1a5('0x10')](_0x5d350e[_0xa1a5('0x2a')])?_0x5d350e[_0xa1a5('0x17')]:_0x5d350e[_0xa1a5('0x16')];if(_['isNil'](_0x5d350e[_0xa1a5('0x2a')])){_0x5cba2[_0xa1a5('0x18')]=_0x5d350e[_0xa1a5('0x2b')]&&_0x5d350e['calleridname']!==_0xa1a5('0x2c')?_0x5d350e['calleridname']:_0xa1a5('0x2d');}else{_0x5cba2[_0xa1a5('0x18')]=_0x5d350e['destcalleridname']&&_0x5d350e[_0xa1a5('0x2e')]!==_0xa1a5('0x2c')?_0x5d350e[_0xa1a5('0x2e')]:_0xa1a5('0x2d');}return BPromise['resolve']()[_0xa1a5('0x1f')](cmContactRpc[_0xa1a5('0x2f')](_0x5cba2))[_0xa1a5('0x1f')](function(_0x5d982f){_0x5b4cc9=_0x5d982f;_0x28d857[_0xa1a5('0x30')](_0x5d982f);if(_0x5b4cc9){logger[_0xa1a5('0xa')](_0xa1a5('0x31'),_0x5d350e[_0xa1a5('0x24')],_0x45fa5e['id'],_0x5b4cc9['id']);}return;});}else{logger[_0xa1a5('0xa')](_0xa1a5('0x32'),_0x5d350e[_0xa1a5('0x24')],_0x45fa5e['id']);_0x5cba2[_0x2352ef]=_['isNil'](_0x5d350e['routeId'])?_0x5d350e[_0xa1a5('0x17')]:_0x5d350e[_0xa1a5('0x16')];if(_[_0xa1a5('0x10')](_0x5d350e[_0xa1a5('0x2a')])){_0x5cba2[_0xa1a5('0x18')]=_0x5d350e[_0xa1a5('0x2b')]&&_0x5d350e[_0xa1a5('0x2b')]!==''?_0x5d350e[_0xa1a5('0x2b')]:_0xa1a5('0x2d');}else{_0x5cba2[_0xa1a5('0x18')]=_0x5d350e['destcalleridname']&&_0x5d350e[_0xa1a5('0x2e')]!==_0xa1a5('0x2c')?_0x5d350e[_0xa1a5('0x2e')]:_0xa1a5('0x2d');}_0x5b4cc9=_0x5cba2;_0x28d857[_0xa1a5('0x30')](_0x5cba2);return;}}})[_0xa1a5('0x1f')](function(){if(_0x4eebba){emit(_0x5d350e[_0xa1a5('0x24')],_0x45fa5e,util[_0xa1a5('0x33')](_0xa1a5('0x34'),_0x4eebba[_0xa1a5('0x35')]),util[_0xa1a5('0x33')](_0xa1a5('0x36'),_0x39d64d['action'][_0xa1a5('0x37')]()),{'evt':_['merge'](_0x5d350e,{'autoCreate':_0x2ff69f}),'contact':_0x5b4cc9===undefined?{}:_0x5b4cc9,'contacts':_0x28d857['length']===0x0?undefined:_0x28d857});}});}; \ No newline at end of file +var _0xbef0=['destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','user:%s','name','format','action','merge','lodash','../../../../config/logger','trigger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','isNil','calleridname','','Unknown'];(function(_0x119eb9,_0x3a550c){var _0x2d62b9=function(_0x44b064){while(--_0x44b064){_0x119eb9['push'](_0x119eb9['shift']());}};_0x2d62b9(++_0x3a550c);}(_0xbef0,0x72));var _0x0bef=function(_0x5c5d0c,_0x1af375){_0x5c5d0c=_0x5c5d0c-0x0;var _0x4e2331=_0xbef0[_0x5c5d0c];return _0x4e2331;};'use strict';var _=require(_0x0bef('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0x0bef('0x1'))(_0x0bef('0x2'));var cmContactRpc=require(_0x0bef('0x3'));config['redis']=_[_0x0bef('0x4')](config['redis'],{'host':_0x0bef('0x5'),'port':0x18eb});var io=require(_0x0bef('0x6'))(new Redis(config['redis']));function emit(_0x24660b,_0x29873b,_0x183dc7,_0x5e6b6b,_0x40039c){logger[_0x0bef('0x7')]('[CM][%s][%s]',_0x24660b,_0x29873b['id'],_0x183dc7,_0x5e6b6b,JSON[_0x0bef('0x8')](_0x40039c));io['to'](_0x183dc7)[_0x0bef('0x9')](_0x5e6b6b,_0x40039c);}exports[_0x0bef('0xa')]=function(_0xa8abaf,_0x2c7d67,_0x229ab6,_0x44ced9){var _0x572408,_0x2b9e62;var _0x2122ba={};var _0x41ab26;var _0x573b2b=Number(_0x229ab6['data1']);var _0x40759d=_0x229ab6[_0x0bef('0xb')]?Boolean(Number(_0x229ab6['data2'])):![];var _0x5e5c43;var _0x25876c=![];if(!_['isNil'](_0x229ab6[_0x0bef('0xc')])){if(_0x229ab6['data5']=='1')_0x25876c=!![];}if(!_0x25876c){if(_0x44ced9[_0x0bef('0xd')]){_0x2122ba['id']=_0x44ced9[_0x0bef('0xd')];}}if(!_0x2122ba['id']){_0x2122ba[_0x0bef('0xe')]=_0x573b2b;_0x5e5c43=_0x229ab6[_0x0bef('0xf')]&&_0x229ab6[_0x0bef('0xf')]!=='0'?_0x229ab6[_0x0bef('0xf')][_0x0bef('0x10')](','):[_0x0bef('0x11')];_0x2122ba[_0x0bef('0x12')]=_[_0x0bef('0x13')](_0x5e5c43,function(_0x4b0515){var _0x1b8b62={};_0x1b8b62[_0x4b0515]=_0x44ced9['routeId']?_0x44ced9[_0x0bef('0x14')]:_0x44ced9[_0x0bef('0x15')];return _0x1b8b62;});_0x41ab26=_0x44ced9[_0x0bef('0x16')]?_0x44ced9[_0x0bef('0x14')]:_0x44ced9[_0x0bef('0x15')];}var _0x13bc09=['id',_0x0bef('0x17'),_0x0bef('0x18'),'phone',_0x0bef('0x19'),_0x0bef('0x1a'),_0x0bef('0xe'),_0x0bef('0x1b'),_0x0bef('0x1c'),_0x0bef('0x1d')];var _0x3a7d8c=_[_0x0bef('0x1e')](_0x13bc09,_0x5e5c43);BPromise[_0x0bef('0x1f')]()['then'](cmContactRpc[_0x0bef('0x20')]({'attributes':_0x3a7d8c,'where':_0x2122ba,'phone':_0x41ab26}))['then'](function(_0x410e78){_0x2b9e62=_0x410e78;if(!_['isEmpty'](_0x2b9e62)){if(_0x2b9e62['length']===0x1){_0x572408=_0x2b9e62[0x0];logger[_0x0bef('0x7')](_0x0bef('0x21'),_0x44ced9[_0x0bef('0x22')],_0x2c7d67['id'],_0x572408['id']);}else{logger[_0x0bef('0x7')](_0x0bef('0x23'),_0x44ced9[_0x0bef('0x22')],_0x2c7d67['id'],_[_0x0bef('0x13')](_0x2b9e62,'id')[_0x0bef('0x24')](','));}return;}else{logger[_0x0bef('0x7')](_0x0bef('0x25'),_0x44ced9['uniqueid'],_0x2c7d67['id']);var _0x5e549b={'ListId':_0x573b2b};var _0x356015=_0x229ab6['data4']&&_0x229ab6['data4']!=='0'?_0x229ab6['data4']:_0x0bef('0x11');if(_0x40759d){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x44ced9[_0x0bef('0x22')],_0x2c7d67['id']);_0x5e549b[_0x356015]=_[_0x0bef('0x26')](_0x44ced9[_0x0bef('0x16')])?_0x44ced9[_0x0bef('0x15')]:_0x44ced9[_0x0bef('0x14')];if(_['isNil'](_0x44ced9[_0x0bef('0x16')])){_0x5e549b[_0x0bef('0x17')]=_0x44ced9[_0x0bef('0x27')]&&_0x44ced9[_0x0bef('0x27')]!==_0x0bef('0x28')?_0x44ced9['calleridname']:_0x0bef('0x29');}else{_0x5e549b[_0x0bef('0x17')]=_0x44ced9[_0x0bef('0x2a')]&&_0x44ced9[_0x0bef('0x2a')]!==''?_0x44ced9['destcalleridname']:_0x0bef('0x29');}return BPromise['resolve']()['then'](cmContactRpc[_0x0bef('0x2b')](_0x5e549b))['then'](function(_0x2f2d05){_0x572408=_0x2f2d05;_0x2b9e62['push'](_0x2f2d05);if(_0x572408){logger['info'](_0x0bef('0x2c'),_0x44ced9[_0x0bef('0x22')],_0x2c7d67['id'],_0x572408['id']);}return;});}else{logger[_0x0bef('0x7')](_0x0bef('0x2d'),_0x44ced9[_0x0bef('0x22')],_0x2c7d67['id']);_0x5e549b[_0x356015]=_[_0x0bef('0x26')](_0x44ced9[_0x0bef('0x16')])?_0x44ced9[_0x0bef('0x15')]:_0x44ced9[_0x0bef('0x14')];if(_[_0x0bef('0x26')](_0x44ced9[_0x0bef('0x16')])){_0x5e549b['firstName']=_0x44ced9[_0x0bef('0x27')]&&_0x44ced9[_0x0bef('0x27')]!==_0x0bef('0x28')?_0x44ced9[_0x0bef('0x27')]:'Unknown';}else{_0x5e549b[_0x0bef('0x17')]=_0x44ced9[_0x0bef('0x2a')]&&_0x44ced9[_0x0bef('0x2a')]!==_0x0bef('0x28')?_0x44ced9[_0x0bef('0x2a')]:_0x0bef('0x29');}_0x572408=_0x5e549b;_0x2b9e62[_0x0bef('0x2e')](_0x5e549b);return;}}})['then'](function(){if(_0xa8abaf){emit(_0x44ced9['uniqueid'],_0x2c7d67,util['format'](_0x0bef('0x2f'),_0xa8abaf[_0x0bef('0x30')]),util[_0x0bef('0x31')]('trigger:%s',_0x229ab6[_0x0bef('0x32')]['toLowerCase']()),{'evt':_[_0x0bef('0x33')](_0x44ced9,{'autoCreate':_0x40759d}),'contact':_0x572408===undefined?{}:_0x572408,'contacts':_0x2b9e62['length']===0x0?undefined:_0x2b9e62});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6aba33c..54e1973 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 _0x76a9=['freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentconnect','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','emit','info','stringify','prototype','clone','motionChannel','undefined','voice','debug','inspect','interface','checkTriggers','hasOwnProperty','checkTrigger','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','data6','winApplication','winArguments','format','user:%s','name','jscripty','trigger:%s','exec','integration','queue','urlforward','script','query','search','replace','length','every','checkConditions','AnyConditions','some','channel','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','routeId','mailSubstatus','substatus','created','exports','util','lodash','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x76a9,0x69));var _0x976a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x76a9[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x976a('0x0'));var _=require(_0x976a('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0x976a('0x2'));var urlforward=require(_0x976a('0x3'));var integration=require(_0x976a('0x4'));var cmContact=require(_0x976a('0x5'));var script=require(_0x976a('0x6'));var config=require(_0x976a('0x7'));var logger=require(_0x976a('0x8'))(_0x976a('0x9'));var ami=require('../ami');config[_0x976a('0xa')]=_[_0x976a('0xb')](config[_0x976a('0xa')],{'host':_0x976a('0xc'),'port':0x18eb});var io=require(_0x976a('0xd'))(new Redis(config[_0x976a('0xa')]));var operators={'equals':function(_0x4cd263,_0x4e700b){return _0x4cd263==_0x4e700b;},'not_equals':function(_0x107129,_0xa3c251){return _0x107129!=_0xa3c251;}};var barAndWebActions=[_0x976a('0xe'),_0x976a('0xf'),_0x976a('0x10')];function Trigger(_0x167c60){this[_0x976a('0x11')]=_0x167c60['triggers'];this[_0x976a('0x12')]=_0x167c60[_0x976a('0x12')];this[_0x976a('0x13')]=_0x167c60[_0x976a('0x13')];this[_0x976a('0x14')]=_0x167c60[_0x976a('0x14')];this[_0x976a('0x15')]=_0x167c60[_0x976a('0x15')];this['zendeskAccounts']=_0x167c60[_0x976a('0x16')];this[_0x976a('0x17')]=_0x167c60['freshdeskAccounts'];this[_0x976a('0x18')]=_0x167c60['salesforceAccounts'];this[_0x976a('0x19')]=_0x167c60[_0x976a('0x19')];this[_0x976a('0x1a')]=_0x167c60[_0x976a('0x1a')];this['deskAccounts']=_0x167c60['deskAccounts'];this['vtigerAccounts']=_0x167c60[_0x976a('0x1b')];this[_0x976a('0x1c')]=_0x167c60['servicenowAccounts'];this[_0x976a('0x1d')]=_0x167c60[_0x976a('0x1d')];this[_0x976a('0x1e')]=_0x167c60[_0x976a('0x1e')];this[_0x976a('0x1f')]={'zendesk':this[_0x976a('0x16')],'salesforce':this[_0x976a('0x18')],'freshdesk':this[_0x976a('0x17')],'sugarcrm':this[_0x976a('0x19')],'zoho':this['zohoAccounts'],'desk':this[_0x976a('0x20')],'vtiger':this[_0x976a('0x1b')],'dynamics365':this[_0x976a('0x1d')],'freshsales':this[_0x976a('0x1e')],'servicenow':this[_0x976a('0x1c')]};ami['on']('custom:agentcalled',this['syncCustomEvent']['bind'](this));ami['on'](_0x976a('0x21'),this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on'](_0x976a('0x24'),this['syncCustomEvent'][_0x976a('0x23')](this));ami['on'](_0x976a('0x25'),this[_0x976a('0x22')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on']('custom:agentnoanswer',this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on']('custom:agentbusy',this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on'](_0x976a('0x26'),this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on'](_0x976a('0x27'),this[_0x976a('0x22')]['bind'](this));ami['on'](_0x976a('0x28'),this[_0x976a('0x22')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0x976a('0x22')]['bind'](this));ami['on'](_0x976a('0x29'),this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on'](_0x976a('0x2a'),this[_0x976a('0x2b')][_0x976a('0x23')](this));ami['on']('custom:dialconnect',this[_0x976a('0x2b')][_0x976a('0x23')](this));ami['on'](_0x976a('0x2c'),this[_0x976a('0x2b')]['bind'](this));ami['on']('custom:newinteraction',this[_0x976a('0x22')]['bind'](this));ami['on'](_0x976a('0x2d'),this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on'](_0x976a('0x2e'),this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x976a('0x23')](this));ami['on'](_0x976a('0x2f'),this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on'](_0x976a('0x30'),this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on']('custom:rejectmessage',this[_0x976a('0x22')][_0x976a('0x23')](this));ami['on']('custom:offlineMessage',this[_0x976a('0x22')][_0x976a('0x23')](this));}Trigger['prototype'][_0x976a('0x31')]=function(_0x9332d0,_0x27819d,_0x30b2f2){logger[_0x976a('0x32')](_0x9332d0,_0x27819d,JSON[_0x976a('0x33')](_0x30b2f2));io['to'](_0x9332d0)[_0x976a('0x31')](_0x27819d,_0x30b2f2);};Trigger[_0x976a('0x34')]['syncCustomEvent']=function(_0x207dde){var _0x49dd05=_[_0x976a('0x35')](_0x207dde);if(typeof _0x49dd05[_0x976a('0x36')]===_0x976a('0x37')){_0x49dd05[_0x976a('0x36')]=_0x976a('0x38');}logger[_0x976a('0x39')]('syncCustomEvent',util[_0x976a('0x3a')](_0x49dd05,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x49dd05);};Trigger[_0x976a('0x34')][_0x976a('0x2b')]=function(_0x212cba){if(this['agents'][_0x212cba[_0x976a('0x3b')]]){this[_0x976a('0x22')](_0x212cba);}};Trigger[_0x976a('0x34')][_0x976a('0x3c')]=function(_0x5e8285){var _0x7a286a;for(var _0x4f129e in this['triggers']){if(this[_0x976a('0x11')][_0x976a('0x3d')](_0x4f129e)){if(this['triggers'][_0x4f129e]['status']){_0x7a286a=this[_0x976a('0x3e')](this['triggers'][_0x4f129e],_0x5e8285);if(_0x7a286a){_[_0x976a('0x3f')](_0x5e8285,_0x5e8285[_0x976a('0x40')]);for(var _0x123eee=0x0,_0x21770a,_0x4d75b3,_0x5266a1;_0x123eee0x0){_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 _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x57464e,_0x598b67){var _0x4af69f=function(_0x48cd6b){while(--_0x48cd6b){_0x57464e['push'](_0x57464e['shift']());}};_0x4af69f(++_0x598b67);}(_0x55ca,0x126));var _0xa55c=function(_0x41d552,_0x1e59db){_0x41d552=_0x41d552-0x0;var _0x45d056=_0x55ca[_0x41d552];return _0x45d056;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ 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 caf8ed5..d7bd9a3 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 _0xc803=['serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','outbound','destcalleridnum','calleridnum','POST','/systemusers(','body','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','telephone1','contacts?$select=','\x20eq\x20\x27','replace','Bearer\x20','contactid','nothing','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','type','nameField','customField','idField','indexOf','content','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','phonecalls','assign','queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','remoteUri'];(function(_0x4bc66f,_0x2f58d0){var _0x5c7349=function(_0x4cd5c9){while(--_0x4cd5c9){_0x4bc66f['push'](_0x4bc66f['shift']());}};_0x5c7349(++_0x2f58d0);}(_0xc803,0x84));var _0x3c80=function(_0x5837e7,_0x35de4f){_0x5837e7=_0x5837e7-0x0;var _0x537783=_0xc803[_0x5837e7];return _0x537783;};'use strict';var _=require('lodash');var rp=require(_0x3c80('0x0'));var util=require(_0x3c80('0x1'));var intUtil=require(_0x3c80('0x2'));var md5=require(_0x3c80('0x3'));var Redis=require(_0x3c80('0x4'));var logger=require(_0x3c80('0x5'))(_0x3c80('0x6'));var config=require(_0x3c80('0x7'));config[_0x3c80('0x8')]=_[_0x3c80('0x9')](config[_0x3c80('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3c80('0xa'))(new Redis(config[_0x3c80('0x8')]));function getAuthToken(_0x56baba,_0x1dc6d6,_0x35b348){if(_0x56baba[_0x3c80('0xb')]){_0x56baba['remoteUri']=_0x56baba[_0x3c80('0xc')][_0x3c80('0xd')];_0x56baba[_0x3c80('0xe')]=_0x56baba['CloudProvider'][_0x3c80('0xf')];return Promise[_0x3c80('0x10')](_0x56baba[_0x3c80('0xc')][_0x3c80('0x11')]);}var _0x4aa1e9={'method':'POST','uri':_0x1dc6d6,'form':{'client_id':_0x56baba[_0x3c80('0x12')],'resource':_0x56baba['remoteUri'],'username':_0x56baba[_0x3c80('0x13')],'password':_0x56baba['password'],'grant_type':_0x3c80('0x14'),'client_secret':_0x56baba[_0x3c80('0x15')]},'json':!![]};return rp(_0x4aa1e9)[_0x3c80('0x16')](function(_0x11a851){return _0x11a851[_0x3c80('0x17')];})['catch'](function(_0x1c9a14){logger[_0x3c80('0x18')]('['+[_0x35b348[_0x3c80('0x19')]()]+_0x3c80('0x1a'));return _0x1c9a14[_0x3c80('0x1b')];});}function getUser(_0x3206b4,_0x2e5f28,_0x4282f9,_0x1289c6,_0x6f56de,_0x549c59){return new Promise(function(_0x4a3a2d,_0x63ae42){return getAuthToken(_0x2e5f28,_0x1289c6,_0x549c59)[_0x3c80('0x16')](function(_0x36ab76){var _0x3b3333={'method':'GET','uri':_0x6f56de+_0x3c80('0x1c'),'headers':{'Authorization':'Bearer\x20'+_0x36ab76,'OData-Version':_0x3c80('0x1d')},'json':!![]};return rp(_0x3b3333);})[_0x3c80('0x16')](function(_0x55555e){var _0x460641=_0x55555e[_0x3c80('0x1e')];var _0x4629ba=![];var _0x2d8d94=null;if(!_[_0x3c80('0x1f')](_0x4282f9)){if(intUtil[_0x3c80('0x20')](_0x4282f9[_0x3c80('0x21')])){_0x3206b4[_0x3c80('0x22')]=_0x4282f9['email'];for(_0x2d8d94=0x0;_0x2d8d94<_0x460641[_0x3c80('0x23')];_0x2d8d94++){if(_0x460641[_0x2d8d94][_0x3c80('0x24')]===_0x4282f9['email']&&!_0x460641[_0x2d8d94]['isdisabled']){_0x4629ba=!![];logger['info']('['+[_0x549c59[_0x3c80('0x19')]()]+_0x3c80('0x25')+_0x460641[_0x2d8d94][_0x3c80('0x26')]+'!');_0x3206b4['userId']=_0x460641[_0x2d8d94][_0x3c80('0x26')];}}}}if(!_0x4629ba){logger['info']('['+[_0x549c59[_0x3c80('0x19')]()]+_0x3c80('0x27'));_0x3206b4[_0x3c80('0x22')]=_0x2e5f28[_0x3c80('0x13')];for(_0x2d8d94=0x0;_0x2d8d94<_0x460641[_0x3c80('0x23')];_0x2d8d94++){if(_0x460641[_0x2d8d94][_0x3c80('0x24')]===_0x2e5f28[_0x3c80('0x13')]){_0x3206b4[_0x3c80('0x28')]=_0x460641[_0x2d8d94]['systemuserid'];}}}_0x4a3a2d(_0x3206b4);})[_0x3c80('0x29')](function(_0x5c792a){_0x63ae42(_0x5c792a[_0x3c80('0x1b')]);});});}function createEndUser(_0x1b2d00,_0x2c774e,_0x5251bd,_0x29f1a1,_0x42e329,_0x139c3e,_0x5602c1){return new Promise(function(_0x33698e,_0x38310a){return getAuthToken(_0x2c774e,_0x5251bd,_0x139c3e)[_0x3c80('0x16')](function(_0x51c2de){var _0x1e9c93=_0x139c3e['toLowerCase']()===_0x3c80('0x2a')?_0x42e329[_0x3c80('0x2b')]:_0x42e329[_0x3c80('0x2c')];var _0x40b788={'method':_0x3c80('0x2d'),'uri':_0x29f1a1+'contacts','body':{'fullname':_0x1e9c93,'firstname':_0x1e9c93,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3c80('0x2e')+_0x1b2d00['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x51c2de,'OData-Version':_0x3c80('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x40b788[_0x3c80('0x2f')][_0x5602c1]=_0x1e9c93;return rp(_0x40b788);})[_0x3c80('0x16')](function(_0x4158ab){var _0x14fd82=_0x4158ab['headers'][_0x3c80('0x30')];var _0x286164=_0x14fd82[_0x3c80('0x31')](_0x14fd82[_0x3c80('0x32')]('(')+0x1,_0x14fd82['lastIndexOf'](')'));_0x1b2d00[_0x3c80('0x33')]=_0x286164;_0x33698e(_0x1b2d00);})[_0x3c80('0x29')](function(_0xd6d263){_0x38310a(_0xd6d263['message']);});});}function getEndUser(_0x4b2770,_0x52808a,_0x436655,_0x2ca673,_0x5154ed,_0x18f254,_0x4fabce,_0x2da040){var _0x2c5663=_0x18f254[_0x3c80('0x34')]()===_0x3c80('0x2a')?_0x5154ed[_0x3c80('0x2b')]:_0x5154ed[_0x3c80('0x2c')];return getAuthToken(_0x52808a,_0x436655,_0x18f254)[_0x3c80('0x16')](function(_0x464def){_0x2da040=_0x2da040?_0x2da040:_0x3c80('0x35');var _0x47d929={'method':'GET','uri':_0x2ca673+_0x3c80('0x36')+_0x2da040+'&$filter='+_0x2da040+_0x3c80('0x37')+_0x2c5663[_0x3c80('0x38')]('+','%2b')+'\x27','headers':{'Authorization':_0x3c80('0x39')+_0x464def,'If-None-Match':null,'OData-Version':_0x3c80('0x1d')},'json':!![]};return rp(_0x47d929);})[_0x3c80('0x16')](function(_0xb4c70d){var _0x282ddd=![];if(!_0xb4c70d)return _0x282ddd;var _0x5185c1=_0xb4c70d[_0x3c80('0x1e')];for(var _0x47cd74=0x0;_0x47cd74<_0x5185c1[_0x3c80('0x23')];_0x47cd74++){if(_0x5185c1[_0x47cd74][_0x2da040]===_0x2c5663){_0x282ddd=!![];_0x4b2770[_0x3c80('0x33')]=_0x5185c1[_0x47cd74][_0x3c80('0x3a')];}}return _0x282ddd;})[_0x3c80('0x16')](function(_0x458f99){if(_0x458f99)return _0x4b2770;if(_0x4fabce===_0x3c80('0x3b')){logger[_0x3c80('0x3c')]('['+[_0x18f254['toUpperCase']()]+_0x3c80('0x3d'));return _0x4b2770;}return createEndUser(_0x4b2770,_0x52808a,_0x436655,_0x2ca673,_0x5154ed,_0x18f254,_0x2da040)[_0x3c80('0x16')](function(_0x4d6936){logger[_0x3c80('0x3c')]('['+[_0x18f254[_0x3c80('0x19')]()]+_0x3c80('0x3e'),_0x4d6936['enduserId']);return _0x4d6936;});});}function getCustomFields(_0x55961,_0xa86882,_0x3f538e){var _0x1650a4={};if(_0x55961[_0x3c80('0x23')]>0x0){_['forEach'](_0x55961,function(_0x5aa98b){if(_[_0x3c80('0x3f')]([_0x3c80('0x40'),'picklist'],_0x5aa98b[_0x3c80('0x41')])&&_0x5aa98b[_0x3c80('0x42')]&&!_0x5aa98b[_0x3c80('0x43')]){var _0x1e747f=_0x5aa98b[_0x3c80('0x44')][_0x3c80('0x34')]();var _0x424442=_0x1e747f[_0x3c80('0x31')](0x0,_0x1e747f[_0x3c80('0x45')]('_'));var _0x2e8299=_0x1e747f[_0x3c80('0x31')](_0x1e747f[_0x3c80('0x45')]('_')+0x1);if(_0x424442===_0x3f538e){_0x1650a4[_0x2e8299]=_0x5aa98b[_0x3c80('0x46')];}}});}return _0x1650a4;}function getTicket(_0x22aaa1,_0x1b79dd,_0x3ca184,_0x1761e4,_0x14b2a3,_0x110f37,_0x1e9862){return new Promise(function(_0x404289,_0x10454b){var _0x306ce8;return getAuthToken(_0x1b79dd,_0x3ca184,_0x1e9862)[_0x3c80('0x16')](function(_0xa81161){if(_0x110f37['ticketType']===_0x3c80('0x47')){_0x306ce8={'method':'POST','uri':_0x1761e4+_0x3c80('0x48'),'body':Object['assign']({},{'title':intUtil[_0x3c80('0x49')](_0x110f37[_0x3c80('0x4a')],_0x14b2a3,'\x20'),'description':intUtil[_0x3c80('0x49')](_0x110f37[_0x3c80('0x4b')],_0x14b2a3,'\x0a'),'customerid_contact@odata.bind':_0x22aaa1[_0x3c80('0x33')]?_0x3c80('0x4c')+_0x22aaa1['enduserId']+')':undefined,'ownerid@odata.bind':_0x3c80('0x2e')+_0x22aaa1[_0x3c80('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x110f37[_0x3c80('0x4d')],_0x14b2a3,_0x110f37[_0x3c80('0x4e')])),'headers':{'Authorization':_0x3c80('0x39')+_0xa81161,'OData-Version':_0x3c80('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x110f37[_0x3c80('0x4e')]===_0x3c80('0x4f')){var _0x397fbd=_0x22aaa1[_0x3c80('0x33')]?[{'partyid_systemuser@odata.bind':_0x3c80('0x2e')+_0x22aaa1[_0x3c80('0x28')]+')','participationtypemask':_0x22aaa1[_0x3c80('0x50')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x3c80('0x4c')+_0x22aaa1[_0x3c80('0x33')]+')','participationtypemask':_0x22aaa1[_0x3c80('0x50')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x22aaa1[_0x3c80('0x28')]+')','participationtypemask':_0x22aaa1['callDirection']==='queue'?0x2:0x1}];_0x306ce8={'method':_0x3c80('0x2d'),'uri':_0x1761e4+_0x3c80('0x51'),'body':Object[_0x3c80('0x52')]({},{'subject':intUtil['getString'](_0x110f37[_0x3c80('0x4a')],_0x14b2a3,'\x20'),'phonenumber':String(_0x14b2a3[_0x3c80('0x2c')]),'description':intUtil[_0x3c80('0x49')](_0x110f37[_0x3c80('0x4b')],_0x14b2a3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x22aaa1[_0x3c80('0x33')]?'/contacts('+_0x22aaa1[_0x3c80('0x33')]+')':undefined,'ownerid@odata.bind':_0x3c80('0x2e')+_0x22aaa1[_0x3c80('0x28')]+')','directioncode':_0x22aaa1[_0x3c80('0x50')]===_0x3c80('0x53')?![]:!![],'phonecall_activity_parties':_0x397fbd},getCustomFields(_0x110f37[_0x3c80('0x4d')],_0x14b2a3,_0x110f37[_0x3c80('0x4e')])),'headers':{'Authorization':_0x3c80('0x39')+_0xa81161,'OData-Version':_0x3c80('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x306ce8);})[_0x3c80('0x16')](function(_0x4f7ec7){var _0x59f489=_0x4f7ec7[_0x3c80('0x54')][_0x3c80('0x30')];var _0x37edb9=_0x59f489['substring'](_0x59f489[_0x3c80('0x32')]('(')+0x1,_0x59f489[_0x3c80('0x32')](')'));_0x22aaa1[_0x3c80('0x55')]=_0x37edb9;_0x404289(_0x22aaa1);})[_0x3c80('0x29')](function(_0x224a42){_0x10454b(_0x224a42[_0x3c80('0x1b')]);});});}function emit(_0x373bb2,_0x7a51cf,_0x8ee0f2,_0x491678){var _0x5f19ec={'uri':util[_0x3c80('0x56')](_0x3c80('0x57'),_0x373bb2,_0x8ee0f2,_0x491678)};io['to'](util[_0x3c80('0x56')]('user:%s',_0x7a51cf))[_0x3c80('0x58')](_0x3c80('0x59'),_0x5f19ec);}exports['cs']=function(_0x226c5a,_0x1b64fc,_0x45b63b,_0x4125b2,_0x19e9a4,_0x43beaa,_0xbee98c,_0x3f82d5){var _0x50f0d1={};_0x43beaa['remoteUri']=_0x43beaa[_0x3c80('0xb')]?intUtil[_0x3c80('0x5a')](_0x43beaa['CloudProvider'][_0x3c80('0xd')]):intUtil[_0x3c80('0x5a')](_0x43beaa[_0x3c80('0x5b')]);_0x43beaa[_0x3c80('0x5c')]=intUtil[_0x3c80('0x5a')](_0x43beaa[_0x3c80('0x5c')]);_0x50f0d1[_0x3c80('0x50')]=_0x3f82d5===_0x3c80('0x53')||_0x3f82d5===_0x3c80('0x5d')?_0x3c80('0x53'):_0x3c80('0x2a');var _0x24c612=_0x43beaa[_0x3c80('0xb')]?util[_0x3c80('0x56')](_0x3c80('0x5e'),_0x43beaa[_0x3c80('0xc')][_0x3c80('0xd')]):util[_0x3c80('0x56')](_0x3c80('0x5e'),_0x43beaa[_0x3c80('0x5b')]);var _0x352ce1=util[_0x3c80('0x56')](_0x3c80('0x5f'),_0x43beaa[_0x3c80('0xe')]);var _0x3eb017=util[_0x3c80('0x56')](_0x3c80('0x60'),_0x43beaa['serverUrl'],_0x1b64fc[_0x3c80('0x61')],md5(_0x1b64fc[_0x3c80('0x61')]));if(_0x19e9a4&&_0x19e9a4[_0x3c80('0x62')]){logger[_0x3c80('0x3c')](_0x3c80('0x63'),_0x3c80('0x64'));_0x1b64fc[_0x3c80('0x65')]=_0x3eb017;}else if(_0xbee98c&&_0xbee98c['recordingFormat']&&_0xbee98c['recordingFormat']!==_0x3c80('0x66')){logger['info'](_0x3c80('0x67'),_0x3c80('0x64'));_0x1b64fc[_0x3c80('0x65')]=_0x3eb017;}else{_0x1b64fc[_0x3c80('0x65')]='';}return getUser(_0x50f0d1,_0x43beaa,_0x4125b2,_0x352ce1,_0x24c612,_0x3f82d5)[_0x3c80('0x16')](function(_0xaf7fa){logger[_0x3c80('0x3c')]('['+_0x3f82d5['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0xaf7fa[_0x3c80('0x28')]);logger[_0x3c80('0x3c')]('['+_0x3f82d5[_0x3c80('0x19')]()+']\x20The\x20User\x20email\x20is:',_0xaf7fa[_0x3c80('0x22')]);return getEndUser(_0xaf7fa,_0x43beaa,_0x352ce1,_0x24c612,_0x1b64fc,_0x3f82d5,_0x45b63b['moduleCreate'],_0x45b63b[_0x3c80('0x68')]);})['then'](function(_0x1c7922){logger[_0x3c80('0x3c')]('['+_0x3f82d5['toUpperCase']()+_0x3c80('0x69'),_0x1c7922['enduserId']);logger['info']('['+_0x3f82d5[_0x3c80('0x19')]()+_0x3c80('0x6a'),_0x1b64fc['calleridnum']);return getTicket(_0x1c7922,_0x43beaa,_0x352ce1,_0x24c612,_0x1b64fc,_0x45b63b,_0x3f82d5);})[_0x3c80('0x16')](function(_0x3fdd07){logger[_0x3c80('0x3c')](util[_0x3c80('0x56')]('['+_0x3f82d5[_0x3c80('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x45b63b[_0x3c80('0x4e')],_0x3fdd07[_0x3c80('0x55')]));logger[_0x3c80('0x3c')](util[_0x3c80('0x56')]('['+_0x3f82d5['toUpperCase']()+_0x3c80('0x6b'),_0x3f82d5));if(_0x3f82d5!==_0x3c80('0x5d')&&_0x45b63b[_0x3c80('0x6c')]){logger[_0x3c80('0x3c')]('['+_0x3f82d5[_0x3c80('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x43beaa[_0x3c80('0x5b')],_0x4125b2[_0x3c80('0x6d')],_0x45b63b[_0x3c80('0x4e')],_0x3fdd07[_0x3c80('0x55')]);}})['catch'](function(_0x4bc36e){logger[_0x3c80('0x18')]('['+_0x3f82d5[_0x3c80('0x19')]()+_0x3c80('0x6e'),_0x4bc36e[_0x3c80('0x1b')]);console['error'](_0x3c80('0x6f'),_0x4bc36e);});}; \ No newline at end of file +var _0xa555=['customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%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','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','remoteUri','data7','CloudProvider','data2','data5','POST','username','password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','string','picklist','type','nameField'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa555,0x1ee));var _0x5a55=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0xa555[_0x4704dc];return _0x254d81;};'use strict';var _=require(_0x5a55('0x0'));var rp=require(_0x5a55('0x1'));var util=require(_0x5a55('0x2'));var intUtil=require(_0x5a55('0x3'));var md5=require(_0x5a55('0x4'));var Redis=require(_0x5a55('0x5'));var logger=require(_0x5a55('0x6'))(_0x5a55('0x7'));var config=require(_0x5a55('0x8'));config['redis']=_[_0x5a55('0x9')](config['redis'],{'host':_0x5a55('0xa'),'port':0x18eb});var io=require(_0x5a55('0xb'))(new Redis(config[_0x5a55('0xc')]));function getAuthToken(_0x3e3508,_0x286251,_0x3a7915){if(_0x3e3508['modernAuthentication']){_0x3e3508[_0x5a55('0xd')]=_0x3e3508['CloudProvider'][_0x5a55('0xe')];_0x3e3508['tenantId']=_0x3e3508[_0x5a55('0xf')][_0x5a55('0x10')];return Promise['resolve'](_0x3e3508['CloudProvider'][_0x5a55('0x11')]);}var _0x48229e={'method':_0x5a55('0x12'),'uri':_0x286251,'form':{'client_id':_0x3e3508['clientId'],'resource':_0x3e3508[_0x5a55('0xd')],'username':_0x3e3508[_0x5a55('0x13')],'password':_0x3e3508['password'],'grant_type':_0x5a55('0x14'),'client_secret':_0x3e3508[_0x5a55('0x15')]},'json':!![]};return rp(_0x48229e)[_0x5a55('0x16')](function(_0x412909){return _0x412909['access_token'];})[_0x5a55('0x17')](function(_0x388fbb){logger[_0x5a55('0x18')]('['+[_0x3a7915[_0x5a55('0x19')]()]+_0x5a55('0x1a'));return _0x388fbb[_0x5a55('0x1b')];});}function getUser(_0x5415da,_0x4dcee5,_0x13cdd5,_0x355328,_0x21ff79,_0xe452ab){return new Promise(function(_0x130f52,_0x4b8300){return getAuthToken(_0x4dcee5,_0x355328,_0xe452ab)[_0x5a55('0x16')](function(_0x3a7361){var _0x405824={'method':_0x5a55('0x1c'),'uri':_0x21ff79+_0x5a55('0x1d'),'headers':{'Authorization':_0x5a55('0x1e')+_0x3a7361,'OData-Version':_0x5a55('0x1f')},'json':!![]};return rp(_0x405824);})[_0x5a55('0x16')](function(_0x3e906d){var _0x2a1b36=_0x3e906d[_0x5a55('0x20')];var _0x16ca72=![];var _0x457e50=null;if(!_[_0x5a55('0x21')](_0x13cdd5)){if(intUtil['validateEmail'](_0x13cdd5[_0x5a55('0x22')])){_0x5415da[_0x5a55('0x23')]=_0x13cdd5[_0x5a55('0x22')];for(_0x457e50=0x0;_0x457e50<_0x2a1b36['length'];_0x457e50++){if(_0x2a1b36[_0x457e50][_0x5a55('0x24')]===_0x13cdd5[_0x5a55('0x22')]&&!_0x2a1b36[_0x457e50][_0x5a55('0x25')]){_0x16ca72=!![];logger['info']('['+[_0xe452ab[_0x5a55('0x19')]()]+_0x5a55('0x26')+_0x2a1b36[_0x457e50][_0x5a55('0x27')]+'!');_0x5415da[_0x5a55('0x28')]=_0x2a1b36[_0x457e50][_0x5a55('0x27')];}}}}if(!_0x16ca72){logger[_0x5a55('0x29')]('['+[_0xe452ab[_0x5a55('0x19')]()]+_0x5a55('0x2a'));_0x5415da['userEmail']=_0x4dcee5['username'];for(_0x457e50=0x0;_0x457e50<_0x2a1b36[_0x5a55('0x2b')];_0x457e50++){if(_0x2a1b36[_0x457e50][_0x5a55('0x24')]===_0x4dcee5[_0x5a55('0x13')]){_0x5415da[_0x5a55('0x28')]=_0x2a1b36[_0x457e50][_0x5a55('0x27')];}}}_0x130f52(_0x5415da);})[_0x5a55('0x17')](function(_0x2c1b27){_0x4b8300(_0x2c1b27[_0x5a55('0x1b')]);});});}function createEndUser(_0x1f8f54,_0x2773a5,_0xb328fb,_0x78640d,_0x25b7ec,_0x416645,_0xd51c67){return new Promise(function(_0x222490,_0x4b1880){return getAuthToken(_0x2773a5,_0xb328fb,_0x416645)[_0x5a55('0x16')](function(_0x48c654){var _0x1ca6e9=_0x416645[_0x5a55('0x2c')]()===_0x5a55('0x2d')?_0x25b7ec[_0x5a55('0x2e')]:_0x25b7ec[_0x5a55('0x2f')];var _0x4c3f0e={'method':_0x5a55('0x12'),'uri':_0x78640d+'contacts','body':{'fullname':_0x1ca6e9,'firstname':_0x1ca6e9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5a55('0x30')+_0x1f8f54[_0x5a55('0x28')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x48c654,'OData-Version':_0x5a55('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x4c3f0e['body'][_0xd51c67]=_0x1ca6e9;return rp(_0x4c3f0e);})[_0x5a55('0x16')](function(_0x123bd2){var _0x261efd=_0x123bd2[_0x5a55('0x31')][_0x5a55('0x32')];var _0x360f16=_0x261efd[_0x5a55('0x33')](_0x261efd[_0x5a55('0x34')]('(')+0x1,_0x261efd['lastIndexOf'](')'));_0x1f8f54[_0x5a55('0x35')]=_0x360f16;_0x222490(_0x1f8f54);})[_0x5a55('0x17')](function(_0x492c16){_0x4b1880(_0x492c16[_0x5a55('0x1b')]);});});}function getEndUser(_0x15995a,_0x46712f,_0xc88292,_0x2df58e,_0x3c4c51,_0x5ae88c,_0x1df1ad,_0x44e4df){var _0x2f8bfd=_0x5ae88c[_0x5a55('0x2c')]()===_0x5a55('0x2d')?_0x3c4c51[_0x5a55('0x2e')]:_0x3c4c51[_0x5a55('0x2f')];return getAuthToken(_0x46712f,_0xc88292,_0x5ae88c)[_0x5a55('0x16')](function(_0x1722a3){_0x44e4df=_0x44e4df?_0x44e4df:_0x5a55('0x36');var _0x32492f={'method':_0x5a55('0x1c'),'uri':_0x2df58e+_0x5a55('0x37')+_0x44e4df+_0x5a55('0x38')+_0x44e4df+_0x5a55('0x39')+_0x2f8bfd[_0x5a55('0x3a')]('+',_0x5a55('0x3b'))+'\x27','headers':{'Authorization':_0x5a55('0x1e')+_0x1722a3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x32492f);})[_0x5a55('0x16')](function(_0x12a2bc){var _0x56f729=![];if(!_0x12a2bc)return _0x56f729;var _0x26ecc3=_0x12a2bc[_0x5a55('0x20')];for(var _0x443749=0x0;_0x443749<_0x26ecc3['length'];_0x443749++){if(_0x26ecc3[_0x443749][_0x44e4df]===_0x2f8bfd){_0x56f729=!![];_0x15995a['enduserId']=_0x26ecc3[_0x443749]['contactid'];}}return _0x56f729;})[_0x5a55('0x16')](function(_0xbf4a30){if(_0xbf4a30)return _0x15995a;if(_0x1df1ad===_0x5a55('0x3c')){logger[_0x5a55('0x29')]('['+[_0x5ae88c[_0x5a55('0x19')]()]+_0x5a55('0x3d'));return _0x15995a;}return createEndUser(_0x15995a,_0x46712f,_0xc88292,_0x2df58e,_0x3c4c51,_0x5ae88c,_0x44e4df)[_0x5a55('0x16')](function(_0x59090d){logger[_0x5a55('0x29')]('['+[_0x5ae88c[_0x5a55('0x19')]()]+']\x20Enduser\x20created!',_0x59090d['enduserId']);return _0x59090d;});});}function getCustomFields(_0x2970fa,_0x210c6e,_0x288d68){var _0x260624={};if(_0x2970fa[_0x5a55('0x2b')]>0x0){_['forEach'](_0x2970fa,function(_0x2d3db7){if(_['includes']([_0x5a55('0x3e'),_0x5a55('0x3f')],_0x2d3db7[_0x5a55('0x40')])&&_0x2d3db7[_0x5a55('0x41')]&&!_0x2d3db7[_0x5a55('0x42')]){var _0x309a13=_0x2d3db7[_0x5a55('0x43')][_0x5a55('0x2c')]();var _0xb60906=_0x309a13[_0x5a55('0x33')](0x0,_0x309a13[_0x5a55('0x44')]('_'));var _0x1ae71a=_0x309a13[_0x5a55('0x33')](_0x309a13['indexOf']('_')+0x1);if(_0xb60906===_0x288d68){_0x260624[_0x1ae71a]=_0x2d3db7[_0x5a55('0x45')];}}});}return _0x260624;}function getTicket(_0x4fc38d,_0x3cfb1e,_0x2670d9,_0x5b32ed,_0x2cfb2e,_0x598bc3,_0x6a22f0){return new Promise(function(_0x4b8af7,_0x13ab1e){var _0x47226c;return getAuthToken(_0x3cfb1e,_0x2670d9,_0x6a22f0)[_0x5a55('0x16')](function(_0x1ccb5b){if(_0x598bc3[_0x5a55('0x46')]===_0x5a55('0x47')){_0x47226c={'method':'POST','uri':_0x5b32ed+_0x5a55('0x48'),'body':Object[_0x5a55('0x49')]({},{'title':intUtil[_0x5a55('0x4a')](_0x598bc3[_0x5a55('0x4b')],_0x2cfb2e,'\x20'),'description':intUtil[_0x5a55('0x4a')](_0x598bc3[_0x5a55('0x4c')],_0x2cfb2e,'\x0a'),'customerid_contact@odata.bind':_0x4fc38d[_0x5a55('0x35')]?_0x5a55('0x4d')+_0x4fc38d['enduserId']+')':undefined,'ownerid@odata.bind':_0x5a55('0x30')+_0x4fc38d[_0x5a55('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x598bc3[_0x5a55('0x4e')],_0x2cfb2e,_0x598bc3[_0x5a55('0x46')])),'headers':{'Authorization':_0x5a55('0x1e')+_0x1ccb5b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x598bc3[_0x5a55('0x46')]===_0x5a55('0x4f')){var _0x550047=_0x4fc38d[_0x5a55('0x35')]?[{'partyid_systemuser@odata.bind':_0x5a55('0x30')+_0x4fc38d[_0x5a55('0x28')]+')','participationtypemask':_0x4fc38d[_0x5a55('0x50')]===_0x5a55('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0x5a55('0x4d')+_0x4fc38d[_0x5a55('0x35')]+')','participationtypemask':_0x4fc38d[_0x5a55('0x50')]===_0x5a55('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5a55('0x30')+_0x4fc38d[_0x5a55('0x28')]+')','participationtypemask':_0x4fc38d[_0x5a55('0x50')]===_0x5a55('0x51')?0x2:0x1}];_0x47226c={'method':'POST','uri':_0x5b32ed+'phonecalls','body':Object[_0x5a55('0x49')]({},{'subject':intUtil[_0x5a55('0x4a')](_0x598bc3[_0x5a55('0x4b')],_0x2cfb2e,'\x20'),'phonenumber':String(_0x2cfb2e[_0x5a55('0x2f')]),'description':intUtil[_0x5a55('0x4a')](_0x598bc3['Descriptions'],_0x2cfb2e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4fc38d[_0x5a55('0x35')]?_0x5a55('0x4d')+_0x4fc38d[_0x5a55('0x35')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4fc38d[_0x5a55('0x28')]+')','directioncode':_0x4fc38d['callDirection']===_0x5a55('0x51')?![]:!![],'phonecall_activity_parties':_0x550047},getCustomFields(_0x598bc3[_0x5a55('0x4e')],_0x2cfb2e,_0x598bc3[_0x5a55('0x46')])),'headers':{'Authorization':_0x5a55('0x1e')+_0x1ccb5b,'OData-Version':_0x5a55('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x47226c);})['then'](function(_0x3b922d){var _0x1f8788=_0x3b922d[_0x5a55('0x31')][_0x5a55('0x32')];var _0x1bc0f4=_0x1f8788[_0x5a55('0x33')](_0x1f8788[_0x5a55('0x34')]('(')+0x1,_0x1f8788[_0x5a55('0x34')](')'));_0x4fc38d[_0x5a55('0x52')]=_0x1bc0f4;_0x4b8af7(_0x4fc38d);})[_0x5a55('0x17')](function(_0x5d7cf8){_0x13ab1e(_0x5d7cf8['message']);});});}function emit(_0x57d1ad,_0x4bf104,_0x94fc2,_0x385d42){var _0x2c8903={'uri':util[_0x5a55('0x53')](_0x5a55('0x54'),_0x57d1ad,_0x94fc2,_0x385d42)};io['to'](util['format'](_0x5a55('0x55'),_0x4bf104))[_0x5a55('0x56')](_0x5a55('0x57'),_0x2c8903);}exports['cs']=function(_0x552dee,_0x14d731,_0x5f5051,_0x14a4af,_0x168a07,_0x2890b4,_0x2380d8,_0x5b5038){var _0x204a5a={};_0x2890b4['remoteUri']=_0x2890b4['modernAuthentication']?intUtil[_0x5a55('0x58')](_0x2890b4[_0x5a55('0xf')][_0x5a55('0xe')]):intUtil[_0x5a55('0x58')](_0x2890b4[_0x5a55('0xd')]);_0x2890b4['serverUrl']=intUtil[_0x5a55('0x58')](_0x2890b4[_0x5a55('0x59')]);_0x204a5a['callDirection']=_0x5b5038===_0x5a55('0x51')||_0x5b5038==='unmanaged'?_0x5a55('0x51'):'outbound';var _0x38dc9b=_0x2890b4['modernAuthentication']?util[_0x5a55('0x53')](_0x5a55('0x5a'),_0x2890b4[_0x5a55('0xf')][_0x5a55('0xe')]):util[_0x5a55('0x53')](_0x5a55('0x5a'),_0x2890b4[_0x5a55('0xd')]);var _0x2581e8=util[_0x5a55('0x53')](_0x5a55('0x5b'),_0x2890b4[_0x5a55('0x5c')]);var _0x5c1149=util['format'](_0x5a55('0x5d'),_0x2890b4[_0x5a55('0x59')],_0x14d731[_0x5a55('0x5e')],md5(_0x14d731[_0x5a55('0x5e')]));if(_0x168a07&&_0x168a07[_0x5a55('0x5f')]){logger['info'](_0x5a55('0x60'),_0x5a55('0x61'));_0x14d731[_0x5a55('0x62')]=_0x5c1149;}else if(_0x2380d8&&_0x2380d8[_0x5a55('0x63')]&&_0x2380d8[_0x5a55('0x63')]!==_0x5a55('0x64')){logger[_0x5a55('0x29')](_0x5a55('0x65'),_0x5a55('0x61'));_0x14d731[_0x5a55('0x62')]=_0x5c1149;}else{_0x14d731[_0x5a55('0x62')]='';}return getUser(_0x204a5a,_0x2890b4,_0x14a4af,_0x2581e8,_0x38dc9b,_0x5b5038)[_0x5a55('0x16')](function(_0x1923d7){logger['info']('['+_0x5b5038[_0x5a55('0x19')]()+']\x20The\x20User\x20ID\x20is:',_0x1923d7['userId']);logger[_0x5a55('0x29')]('['+_0x5b5038[_0x5a55('0x19')]()+_0x5a55('0x66'),_0x1923d7[_0x5a55('0x23')]);return getEndUser(_0x1923d7,_0x2890b4,_0x2581e8,_0x38dc9b,_0x14d731,_0x5b5038,_0x5f5051[_0x5a55('0x67')],_0x5f5051[_0x5a55('0x68')]);})[_0x5a55('0x16')](function(_0x55309b){logger['info']('['+_0x5b5038[_0x5a55('0x19')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x55309b[_0x5a55('0x35')]);logger[_0x5a55('0x29')]('['+_0x5b5038[_0x5a55('0x19')]()+_0x5a55('0x69'),_0x14d731[_0x5a55('0x2f')]);return getTicket(_0x55309b,_0x2890b4,_0x2581e8,_0x38dc9b,_0x14d731,_0x5f5051,_0x5b5038);})[_0x5a55('0x16')](function(_0x3284bd){logger[_0x5a55('0x29')](util[_0x5a55('0x53')]('['+_0x5b5038[_0x5a55('0x19')]()+_0x5a55('0x6a'),_0x5f5051[_0x5a55('0x46')],_0x3284bd['ticketId']));logger[_0x5a55('0x29')](util[_0x5a55('0x53')]('['+_0x5b5038[_0x5a55('0x19')]()+']\x20Call\x20direction:\x20%s',_0x5b5038));if(_0x5b5038!==_0x5a55('0x6b')&&_0x5f5051[_0x5a55('0x6c')]){logger[_0x5a55('0x29')]('['+_0x5b5038[_0x5a55('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2890b4[_0x5a55('0xd')],_0x14a4af[_0x5a55('0x6d')],_0x5f5051['ticketType'],_0x3284bd[_0x5a55('0x52')]);}})['catch'](function(_0x1da35a){logger[_0x5a55('0x18')]('['+_0x5b5038[_0x5a55('0x19')]()+_0x5a55('0x6e'),_0x1da35a[_0x5a55('0x1b')]);console[_0x5a55('0x18')](_0x5a55('0x6f'),_0x1da35a);});}; \ 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 5ab92ca..1f97077 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 _0xed28=['value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','push','content','variable','variableName','toString','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','The\x20Enduser\x20ID\x20is:','catch','unmanaged','toUpperCase','calleridname','lastevent','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy'];(function(_0xf7d0ef,_0x5147db){var _0x45697d=function(_0x4bc063){while(--_0x4bc063){_0xf7d0ef['push'](_0xf7d0ef['shift']());}};_0x45697d(++_0x5147db);}(_0xed28,0x15f));var _0x8ed2=function(_0x2d16e6,_0x301c3e){_0x2d16e6=_0x2d16e6-0x0;var _0x5af008=_0xed28[_0x2d16e6];return _0x5af008;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x8ed2('0x0'));var util=require(_0x8ed2('0x1'));var Redis=require(_0x8ed2('0x2'));var intUtil=require('./util');var config=require(_0x8ed2('0x3'));var logger=require(_0x8ed2('0x4'))(_0x8ed2('0x5'));config[_0x8ed2('0x6')]=_['defaults'](config[_0x8ed2('0x6')],{'host':_0x8ed2('0x7'),'port':0x18eb});var io=require(_0x8ed2('0x8'))(new Redis(config[_0x8ed2('0x6')]));var headers={'Content-Type':_0x8ed2('0x9'),'Accept':'application/json'};function emit(_0x1d99f0,_0x4e84f8,_0x211a65){io['to'](_0x1d99f0)[_0x8ed2('0xa')](_0x4e84f8,_0x211a65);}function getTicket(_0x30ae90,_0x4cc15c,_0x5a41dc,_0x20c76e,_0x3a32a3){logger[_0x8ed2('0xb')](_0x8ed2('0xc'));var _0x523934=_['merge']({'responder_id':_0x4cc15c['id'],'requester_id':_0x5a41dc['id'],'name':util[_0x8ed2('0xd')](_0x8ed2('0xe'),_0x3a32a3['calleridname']),'phone':_0x3a32a3[_0x8ed2('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8ed2('0x10')](_0x20c76e['Subjects'],_0x3a32a3,'\x20'),'description':intUtil['getString'](_0x20c76e[_0x8ed2('0x11')],_0x3a32a3,_0x8ed2('0x12')),'tags':getTags(_0x20c76e[_0x8ed2('0x13')],_0x8ed2('0x14'))},getCustomFields(_0x20c76e[_0x8ed2('0x15')],_0x3a32a3));_0x523934[_0x8ed2('0x16')]=_[_0x8ed2('0x17')](_[_0x8ed2('0x18')](_0x523934[_0x8ed2('0x16')],'id'),_0x8ed2('0x19'));return request({'uri':util[_0x8ed2('0xd')](_0x8ed2('0x1a'),_0x30ae90[_0x8ed2('0x1b')]),'method':'POST','body':_0x523934})[_0x8ed2('0x1c')](function(_0xa6b3bc){logger[_0x8ed2('0xb')](_0x8ed2('0x1d'));return _0xa6b3bc;});}function getUser(_0x185218,_0x55977a){if(intUtil[_0x8ed2('0x1e')](_0x55977a)){return request({'uri':util['format'](_0x8ed2('0x1f'),_0x185218[_0x8ed2('0x1b')]),'qs':{'email':_0x55977a}})[_0x8ed2('0x1c')](function(_0x4cd1be){if(_0x4cd1be['length']){logger['info'](_0x8ed2('0x20'));return _['find'](_0x4cd1be,function(_0x3b86e2){return _0x3b86e2[_0x8ed2('0x21')][_0x8ed2('0x22')]===_0x55977a;});}else{logger['info'](_0x8ed2('0x23'));return request({'uri':util[_0x8ed2('0xd')](_0x8ed2('0x24'),_0x185218[_0x8ed2('0x1b')])})[_0x8ed2('0x1c')](function(_0x3d1c70){logger[_0x8ed2('0xb')](_0x8ed2('0x25'));return _0x3d1c70;});}});}else{logger[_0x8ed2('0xb')](_0x8ed2('0x26'));return request({'uri':util[_0x8ed2('0xd')](_0x8ed2('0x24'),_0x185218[_0x8ed2('0x1b')])})['then'](function(_0x459297){logger[_0x8ed2('0xb')]('Admin\x20account\x20selected.');return _0x459297;});}}function getEndUser(_0x4fdb4a,_0x18f3a5,_0x24a412){logger['info'](_0x8ed2('0x27'),_0x24a412);return request({'uri':util[_0x8ed2('0xd')](_0x8ed2('0x28'),_0x4fdb4a[_0x8ed2('0x1b')]),'qs':{'phone':_0x24a412}})[_0x8ed2('0x1c')](function(_0x2850f8){if(_0x2850f8[_0x8ed2('0x29')]){logger[_0x8ed2('0xb')]('Enduser\x20found!');return _[_0x8ed2('0x2a')](_0x2850f8,{'phone':_0x24a412});}else{logger['info'](_0x8ed2('0x2b'));return request({'uri':util[_0x8ed2('0xd')](_0x8ed2('0x28'),_0x4fdb4a[_0x8ed2('0x1b')]),'method':_0x8ed2('0x2c'),'body':{'name':_0x18f3a5,'phone':_0x24a412}})[_0x8ed2('0x1c')](function(_0xd954b2){logger[_0x8ed2('0xb')]('Enduser\x20created.');return _0xd954b2;});}});}function getAuth(_0x1fb0f1){return util[_0x8ed2('0xd')](_0x8ed2('0x2d'),new Buffer(_0x1fb0f1[_0x8ed2('0x2e')]+':X')['toString'](_0x8ed2('0x2f')));}function request(_0x4d1802){logger[_0x8ed2('0x30')](_0x8ed2('0x31'),JSON[_0x8ed2('0x32')](_0x4d1802));return rp(_[_0x8ed2('0x33')](_0x4d1802,{'method':_0x8ed2('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x2cd2f7,_0x353da6){var _0x349a2a=[];if(_0x2cd2f7&&_0x2cd2f7[_0x8ed2('0x29')]>0x0){_0x349a2a=_['map'](_0x2cd2f7,_0x353da6);}return _0x349a2a;}function getCustomFields(_0x19fc57,_0x161010){var _0x50e38b=[];var _0x2d3178={'custom_fields':[]};if(_0x19fc57['length']>0x0){_[_0x8ed2('0x35')](_0x19fc57,function(_0x307cce){if(_[_0x8ed2('0x36')]([_0x8ed2('0x37'),_0x8ed2('0x38')],_0x307cce[_0x8ed2('0x39')])&&_0x307cce[_0x8ed2('0x3a')]&&!_0x307cce[_0x8ed2('0x3b')]){_0x2d3178[_0x307cce[_0x8ed2('0x3a')][_0x8ed2('0x3c')]()]=_0x307cce['content']['toString']();}else if(_['includes']([_0x8ed2('0x37'),'picklist'],_0x307cce['type'])&&_0x307cce[_0x8ed2('0x3d')]&&_0x307cce['customField']){_0x2d3178[_0x8ed2('0x16')][_0x8ed2('0x3e')]({'id':_0x307cce[_0x8ed2('0x3d')],'value':_0x307cce[_0x8ed2('0x3f')]['toString']()});}else if(_0x307cce[_0x8ed2('0x39')]===_0x8ed2('0x40')&&_0x307cce[_0x8ed2('0x41')]&&_0x307cce['idField']&&_0x307cce[_0x8ed2('0x3b')]){_0x161010[_0x307cce['variableName']]&&_0x2d3178[_0x8ed2('0x16')][_0x8ed2('0x3e')]({'id':_0x307cce[_0x8ed2('0x3d')],'value':_0x161010[_0x307cce[_0x8ed2('0x41')]][_0x8ed2('0x42')]()});}else if(_0x307cce['type']===_0x8ed2('0x43')&&_0x307cce[_0x8ed2('0x44')]&&_0x307cce[_0x8ed2('0x44')][_0x8ed2('0x14')]&&_0x307cce[_0x8ed2('0x3d')]&&_0x307cce[_0x8ed2('0x3b')]){_0x161010[_0x307cce['Variable'][_0x8ed2('0x14')][_0x8ed2('0x3c')]()]&&_0x2d3178[_0x8ed2('0x16')]['push']({'id':_0x307cce[_0x8ed2('0x3d')],'value':_0x161010[_0x307cce[_0x8ed2('0x44')][_0x8ed2('0x14')][_0x8ed2('0x3c')]()][_0x8ed2('0x42')]()});}});}return _0x2d3178;}exports[_0x8ed2('0x45')]=function(_0x1b5a7f,_0x575d1a,_0x42b677,_0x2fda8d,_0x43b719,_0x2f9b32){var _0x2390f1,_0x49568e;_0x2f9b32[_0x8ed2('0x1b')]=intUtil[_0x8ed2('0x46')](_0x2f9b32[_0x8ed2('0x1b')]);_0x2f9b32['serverUrl']=intUtil['stripTrailingSlash'](_0x2f9b32[_0x8ed2('0x47')]);if(_0x43b719&&_0x43b719[_0x8ed2('0x48')]){logger[_0x8ed2('0xb')](_0x8ed2('0x49'),_0x8ed2('0x4a'));_0x575d1a[_0x8ed2('0x4b')]=util[_0x8ed2('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f9b32[_0x8ed2('0x47')],_0x575d1a['uniqueid'],md5(_0x575d1a[_0x8ed2('0x4c')]));}else{_0x575d1a[_0x8ed2('0x4b')]='';}headers[_0x8ed2('0x4d')]=getAuth(_0x2f9b32);return getUser(_0x2f9b32,_0x2fda8d[_0x8ed2('0x22')])[_0x8ed2('0x1c')](function(_0x53a153){_0x2390f1=_0x53a153;logger[_0x8ed2('0xb')](_0x8ed2('0x4e'),_0x2390f1['id']);return getEndUser(_0x2f9b32,_0x575d1a['calleridname'],_0x575d1a[_0x8ed2('0xf')]);})['then'](function(_0x2532a5){_0x49568e=_0x2532a5;logger[_0x8ed2('0xb')]('The\x20Enduser\x20ID\x20is:',_0x49568e['id']);return getTicket(_0x2f9b32,_0x2390f1,_0x49568e,_0x42b677,_0x575d1a);})[_0x8ed2('0x1c')](function(_0x3a7a12){if(_0x3a7a12&&_0x3a7a12['id']){logger[_0x8ed2('0xb')](_0x8ed2('0x1d'));logger[_0x8ed2('0xb')](_0x8ed2('0x4f'),_0x3a7a12['id']);logger['info'](_0x8ed2('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x8ed2('0x50'),_0x2fda8d[_0x8ed2('0x14')]),_0x8ed2('0x51'),{'uri':util[_0x8ed2('0xd')](_0x8ed2('0x52'),_0x2f9b32['remoteUri'],_0x3a7a12['id'])});}})['catch'](function(_0x3b0733){logger[_0x8ed2('0x53')]('[QUEUE]',JSON[_0x8ed2('0x32')](_0x3b0733));});};exports['outbound']=function(_0x1d4530,_0x3fe347,_0x5de874,_0x439dc7,_0x56e51d,_0x375fc8,_0x13315d){var _0x32cacd,_0x2f3f0b;_0x375fc8[_0x8ed2('0x1b')]=intUtil['stripTrailingSlash'](_0x375fc8['remoteUri']);_0x375fc8['serverUrl']=intUtil[_0x8ed2('0x46')](_0x375fc8['serverUrl']);if(_0x13315d&&_0x13315d[_0x8ed2('0x54')]&&_0x13315d[_0x8ed2('0x54')]!=='none'){logger['info'](_0x8ed2('0x55'),_0x8ed2('0x4a'));_0x3fe347['recordingURL']=util['format'](_0x8ed2('0x56'),_0x375fc8[_0x8ed2('0x47')],_0x3fe347[_0x8ed2('0x4c')],md5(_0x3fe347['uniqueid']));}headers[_0x8ed2('0x4d')]=getAuth(_0x375fc8);return getUser(_0x375fc8,_0x439dc7['email'])['then'](function(_0x21dd07){_0x32cacd=_0x21dd07;logger['info'](_0x8ed2('0x4e'),_0x32cacd['id']);return getEndUser(_0x375fc8,_0x3fe347[_0x8ed2('0x57')],_0x3fe347['destcalleridnum']);})[_0x8ed2('0x1c')](function(_0x581230){_0x2f3f0b=_0x581230;logger[_0x8ed2('0xb')](_0x8ed2('0x58'),_0x2f3f0b['id']);return getTicket(_0x375fc8,_0x32cacd,_0x2f3f0b,_0x5de874,_0x3fe347);})[_0x8ed2('0x1c')](function(_0x2f7867){if(_0x2f7867&&_0x2f7867['id']){logger['info'](_0x8ed2('0x1d'));logger[_0x8ed2('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2f7867['id']);logger[_0x8ed2('0xb')](_0x8ed2('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8ed2('0xd')](_0x8ed2('0x50'),_0x439dc7[_0x8ed2('0x14')]),'trigger:browser:url',{'uri':util[_0x8ed2('0xd')]('%s/helpdesk/tickets/%d',_0x375fc8[_0x8ed2('0x1b')],_0x2f7867['id'])});}})[_0x8ed2('0x59')](function(_0x3871de){logger['error'](_0x8ed2('0x55'),JSON[_0x8ed2('0x32')](_0x3871de));});};exports[_0x8ed2('0x5a')]=function(_0x21872f,_0x1654dc,_0x10a110,_0x4c3c89,_0x4aac46,_0x50ad20){var _0x4ff0a5,_0x54f895;_0x50ad20[_0x8ed2('0x1b')]=intUtil[_0x8ed2('0x46')](_0x50ad20[_0x8ed2('0x1b')]);_0x50ad20[_0x8ed2('0x47')]=intUtil[_0x8ed2('0x46')](_0x50ad20[_0x8ed2('0x47')]);if(_0x4aac46&&_0x4aac46['monitor_format']){logger[_0x8ed2('0xb')]('['+_0x1654dc['lastevent'][_0x8ed2('0x5b')]()+']',_0x8ed2('0x4a'));_0x1654dc['recordingURL']=util['format'](_0x8ed2('0x56'),_0x50ad20[_0x8ed2('0x47')],_0x1654dc[_0x8ed2('0x4c')],md5(_0x1654dc[_0x8ed2('0x4c')]));}else{_0x1654dc['recordingURL']='';}headers[_0x8ed2('0x4d')]=getAuth(_0x50ad20);return getUser(_0x50ad20,'')[_0x8ed2('0x1c')](function(_0x47f163){_0x4ff0a5=_0x47f163;logger[_0x8ed2('0xb')](_0x8ed2('0x4e'),_0x4ff0a5['id']);return getEndUser(_0x50ad20,_0x1654dc[_0x8ed2('0x5c')],_0x1654dc[_0x8ed2('0xf')]);})['then'](function(_0x3d6866){_0x54f895=_0x3d6866;logger[_0x8ed2('0xb')]('The\x20Enduser\x20ID\x20is:',_0x54f895['id']);return getTicket(_0x50ad20,_0x4ff0a5,_0x54f895,_0x10a110,_0x1654dc);})[_0x8ed2('0x1c')](function(_0x18932b){if(_0x18932b){logger['info'](_0x8ed2('0x1d'));logger[_0x8ed2('0xb')](_0x8ed2('0x4f'),_0x18932b['id']);}})[_0x8ed2('0x59')](function(_0xe679a3){logger[_0x8ed2('0x53')]('['+_0x1654dc[_0x8ed2('0x5d')][_0x8ed2('0x5b')]()+']',JSON[_0x8ed2('0x32')](_0xe679a3));});}; \ No newline at end of file +var _0x8101=['calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','calleridname','getString','
','Tags','name','custom_fields','mapValues','keyBy','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','map','includes','picklist','type','nameField','customField','content','string','idField','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:'];(function(_0x4d4a74,_0x344a11){var _0x5491d8=function(_0x400056){while(--_0x400056){_0x4d4a74['push'](_0x4d4a74['shift']());}};_0x5491d8(++_0x344a11);}(_0x8101,0x69));var _0x1810=function(_0x11fb16,_0x29a381){_0x11fb16=_0x11fb16-0x0;var _0x343de1=_0x8101[_0x11fb16];return _0x343de1;};'use strict';var _=require(_0x1810('0x0'));var rp=require(_0x1810('0x1'));var md5=require(_0x1810('0x2'));var util=require(_0x1810('0x3'));var Redis=require(_0x1810('0x4'));var intUtil=require('./util');var config=require(_0x1810('0x5'));var logger=require('../../../../config/logger')(_0x1810('0x6'));config[_0x1810('0x7')]=_[_0x1810('0x8')](config[_0x1810('0x7')],{'host':_0x1810('0x9'),'port':0x18eb});var io=require(_0x1810('0xa'))(new Redis(config[_0x1810('0x7')]));var headers={'Content-Type':_0x1810('0xb'),'Accept':_0x1810('0xb')};function emit(_0x552029,_0x35e8d8,_0x78c36c){io['to'](_0x552029)[_0x1810('0xc')](_0x35e8d8,_0x78c36c);}function getTicket(_0x4d933e,_0x344b61,_0xc054b4,_0x1197e9,_0x66834f){logger[_0x1810('0xd')](_0x1810('0xe'));var _0x53d7d1=_['merge']({'responder_id':_0x344b61['id'],'requester_id':_0xc054b4['id'],'name':util['format']('Caller\x20-\x20%s',_0x66834f[_0x1810('0xf')]),'phone':_0x66834f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x1197e9['Subjects'],_0x66834f,'\x20'),'description':intUtil[_0x1810('0x10')](_0x1197e9['Descriptions'],_0x66834f,_0x1810('0x11')),'tags':getTags(_0x1197e9[_0x1810('0x12')],_0x1810('0x13'))},getCustomFields(_0x1197e9['Fields'],_0x66834f));_0x53d7d1[_0x1810('0x14')]=_[_0x1810('0x15')](_[_0x1810('0x16')](_0x53d7d1[_0x1810('0x14')],'id'),'value');return request({'uri':util[_0x1810('0x17')](_0x1810('0x18'),_0x4d933e[_0x1810('0x19')]),'method':_0x1810('0x1a'),'body':_0x53d7d1})['then'](function(_0x33aa98){logger[_0x1810('0xd')](_0x1810('0x1b'));return _0x33aa98;});}function getUser(_0x324779,_0xa399b8){if(intUtil[_0x1810('0x1c')](_0xa399b8)){return request({'uri':util[_0x1810('0x17')]('%s/api/v2/agents',_0x324779[_0x1810('0x19')]),'qs':{'email':_0xa399b8}})[_0x1810('0x1d')](function(_0x94d609){if(_0x94d609[_0x1810('0x1e')]){logger['info'](_0x1810('0x1f'));return _['find'](_0x94d609,function(_0x412ab0){return _0x412ab0['contact']['email']===_0xa399b8;});}else{logger[_0x1810('0xd')](_0x1810('0x20'));return request({'uri':util['format'](_0x1810('0x21'),_0x324779['remoteUri'])})[_0x1810('0x1d')](function(_0x212b32){logger['info'](_0x1810('0x22'));return _0x212b32;});}});}else{logger[_0x1810('0xd')](_0x1810('0x23'));return request({'uri':util[_0x1810('0x17')](_0x1810('0x21'),_0x324779[_0x1810('0x19')])})[_0x1810('0x1d')](function(_0x3f817f){logger['info'](_0x1810('0x22'));return _0x3f817f;});}}function getEndUser(_0x3e97f9,_0x612689,_0x5e2394){logger[_0x1810('0xd')](_0x1810('0x24'),_0x5e2394);return request({'uri':util[_0x1810('0x17')]('%s/api/v2/contacts',_0x3e97f9['remoteUri']),'qs':{'phone':_0x5e2394}})[_0x1810('0x1d')](function(_0x1e208d){if(_0x1e208d[_0x1810('0x1e')]){logger['info'](_0x1810('0x25'));return _['find'](_0x1e208d,{'phone':_0x5e2394});}else{logger[_0x1810('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x1810('0x26'),_0x3e97f9[_0x1810('0x19')]),'method':_0x1810('0x1a'),'body':{'name':_0x612689,'phone':_0x5e2394}})['then'](function(_0x34827a){logger[_0x1810('0xd')]('Enduser\x20created.');return _0x34827a;});}});}function getAuth(_0x4b13db){return util[_0x1810('0x17')](_0x1810('0x27'),new Buffer(_0x4b13db[_0x1810('0x28')]+':X')[_0x1810('0x29')]('base64'));}function request(_0x598939){logger[_0x1810('0x2a')](_0x1810('0x2b'),JSON[_0x1810('0x2c')](_0x598939));return rp(_[_0x1810('0x8')](_0x598939,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2d715d,_0x2a720c){var _0x37810d=[];if(_0x2d715d&&_0x2d715d[_0x1810('0x1e')]>0x0){_0x37810d=_[_0x1810('0x2d')](_0x2d715d,_0x2a720c);}return _0x37810d;}function getCustomFields(_0x5efce3,_0x1fa418){var _0xcb24db=[];var _0x464747={'custom_fields':[]};if(_0x5efce3[_0x1810('0x1e')]>0x0){_['forEach'](_0x5efce3,function(_0x324aaf){if(_[_0x1810('0x2e')](['string',_0x1810('0x2f')],_0x324aaf[_0x1810('0x30')])&&_0x324aaf[_0x1810('0x31')]&&!_0x324aaf[_0x1810('0x32')]){_0x464747[_0x324aaf['nameField']['toLowerCase']()]=_0x324aaf[_0x1810('0x33')][_0x1810('0x29')]();}else if(_[_0x1810('0x2e')]([_0x1810('0x34'),_0x1810('0x2f')],_0x324aaf['type'])&&_0x324aaf[_0x1810('0x35')]&&_0x324aaf['customField']){_0x464747['custom_fields']['push']({'id':_0x324aaf[_0x1810('0x35')],'value':_0x324aaf[_0x1810('0x33')][_0x1810('0x29')]()});}else if(_0x324aaf['type']===_0x1810('0x36')&&_0x324aaf[_0x1810('0x37')]&&_0x324aaf['idField']&&_0x324aaf[_0x1810('0x32')]){_0x1fa418[_0x324aaf[_0x1810('0x37')]]&&_0x464747[_0x1810('0x14')][_0x1810('0x38')]({'id':_0x324aaf['idField'],'value':_0x1fa418[_0x324aaf['variableName']]['toString']()});}else if(_0x324aaf[_0x1810('0x30')]===_0x1810('0x39')&&_0x324aaf[_0x1810('0x3a')]&&_0x324aaf[_0x1810('0x3a')][_0x1810('0x13')]&&_0x324aaf['idField']&&_0x324aaf[_0x1810('0x32')]){_0x1fa418[_0x324aaf[_0x1810('0x3a')][_0x1810('0x13')][_0x1810('0x3b')]()]&&_0x464747[_0x1810('0x14')][_0x1810('0x38')]({'id':_0x324aaf[_0x1810('0x35')],'value':_0x1fa418[_0x324aaf[_0x1810('0x3a')][_0x1810('0x13')][_0x1810('0x3b')]()][_0x1810('0x29')]()});}});}return _0x464747;}exports[_0x1810('0x3c')]=function(_0x434920,_0x8f11b9,_0x198237,_0x252e66,_0x374349,_0x4076ef){var _0x25747f,_0xf503c;_0x4076ef[_0x1810('0x19')]=intUtil[_0x1810('0x3d')](_0x4076ef['remoteUri']);_0x4076ef[_0x1810('0x3e')]=intUtil[_0x1810('0x3d')](_0x4076ef['serverUrl']);if(_0x374349&&_0x374349[_0x1810('0x3f')]){logger[_0x1810('0xd')](_0x1810('0x40'),'Recording\x20is\x20enabled!');_0x8f11b9[_0x1810('0x41')]=util[_0x1810('0x17')](_0x1810('0x42'),_0x4076ef[_0x1810('0x3e')],_0x8f11b9[_0x1810('0x43')],md5(_0x8f11b9['uniqueid']));}else{_0x8f11b9[_0x1810('0x41')]='';}headers[_0x1810('0x44')]=getAuth(_0x4076ef);return getUser(_0x4076ef,_0x252e66[_0x1810('0x45')])[_0x1810('0x1d')](function(_0x30a985){_0x25747f=_0x30a985;logger[_0x1810('0xd')](_0x1810('0x46'),_0x25747f['id']);return getEndUser(_0x4076ef,_0x8f11b9[_0x1810('0xf')],_0x8f11b9[_0x1810('0x47')]);})[_0x1810('0x1d')](function(_0xb8d8d2){_0xf503c=_0xb8d8d2;logger[_0x1810('0xd')](_0x1810('0x48'),_0xf503c['id']);return getTicket(_0x4076ef,_0x25747f,_0xf503c,_0x198237,_0x8f11b9);})['then'](function(_0x3cbe69){if(_0x3cbe69&&_0x3cbe69['id']){logger['info'](_0x1810('0x1b'));logger[_0x1810('0xd')](_0x1810('0x49'),_0x3cbe69['id']);logger[_0x1810('0xd')](_0x1810('0x40'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1810('0x17')](_0x1810('0x4a'),_0x252e66[_0x1810('0x13')]),_0x1810('0x4b'),{'uri':util[_0x1810('0x17')](_0x1810('0x4c'),_0x4076ef['remoteUri'],_0x3cbe69['id'])});}})[_0x1810('0x4d')](function(_0x27bae0){logger[_0x1810('0x4e')]('[QUEUE]',JSON[_0x1810('0x2c')](_0x27bae0));});};exports['outbound']=function(_0x2558bd,_0x4dc50f,_0x18a696,_0x2ad0a4,_0x21e52e,_0x20a99a,_0x131ce0){var _0x1927e2,_0x238018;_0x20a99a['remoteUri']=intUtil['stripTrailingSlash'](_0x20a99a['remoteUri']);_0x20a99a[_0x1810('0x3e')]=intUtil['stripTrailingSlash'](_0x20a99a[_0x1810('0x3e')]);if(_0x131ce0&&_0x131ce0[_0x1810('0x4f')]&&_0x131ce0[_0x1810('0x4f')]!==_0x1810('0x50')){logger['info'](_0x1810('0x51'),_0x1810('0x52'));_0x4dc50f['recordingURL']=util[_0x1810('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20a99a[_0x1810('0x3e')],_0x4dc50f[_0x1810('0x43')],md5(_0x4dc50f[_0x1810('0x43')]));}headers[_0x1810('0x44')]=getAuth(_0x20a99a);return getUser(_0x20a99a,_0x2ad0a4[_0x1810('0x45')])[_0x1810('0x1d')](function(_0x385501){_0x1927e2=_0x385501;logger[_0x1810('0xd')](_0x1810('0x46'),_0x1927e2['id']);return getEndUser(_0x20a99a,_0x4dc50f[_0x1810('0x53')],_0x4dc50f[_0x1810('0x54')]);})[_0x1810('0x1d')](function(_0x24fcda){_0x238018=_0x24fcda;logger[_0x1810('0xd')](_0x1810('0x48'),_0x238018['id']);return getTicket(_0x20a99a,_0x1927e2,_0x238018,_0x18a696,_0x4dc50f);})[_0x1810('0x1d')](function(_0x2f5263){if(_0x2f5263&&_0x2f5263['id']){logger[_0x1810('0xd')](_0x1810('0x1b'));logger[_0x1810('0xd')](_0x1810('0x49'),_0x2f5263['id']);logger[_0x1810('0xd')](_0x1810('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1810('0x4a'),_0x2ad0a4[_0x1810('0x13')]),_0x1810('0x4b'),{'uri':util[_0x1810('0x17')]('%s/helpdesk/tickets/%d',_0x20a99a[_0x1810('0x19')],_0x2f5263['id'])});}})['catch'](function(_0x13b8e1){logger['error']('[OUTBOUND]',JSON[_0x1810('0x2c')](_0x13b8e1));});};exports[_0x1810('0x55')]=function(_0x179eeb,_0x5c4533,_0x43f703,_0x395871,_0x332edc,_0x145203){var _0x596899,_0x229a4f;_0x145203[_0x1810('0x19')]=intUtil['stripTrailingSlash'](_0x145203[_0x1810('0x19')]);_0x145203[_0x1810('0x3e')]=intUtil[_0x1810('0x3d')](_0x145203[_0x1810('0x3e')]);if(_0x332edc&&_0x332edc[_0x1810('0x3f')]){logger[_0x1810('0xd')]('['+_0x5c4533[_0x1810('0x56')][_0x1810('0x57')]()+']','Recording\x20is\x20enabled!');_0x5c4533[_0x1810('0x41')]=util[_0x1810('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x145203['serverUrl'],_0x5c4533['uniqueid'],md5(_0x5c4533[_0x1810('0x43')]));}else{_0x5c4533['recordingURL']='';}headers[_0x1810('0x44')]=getAuth(_0x145203);return getUser(_0x145203,'')[_0x1810('0x1d')](function(_0x228a1d){_0x596899=_0x228a1d;logger[_0x1810('0xd')]('The\x20User\x20ID\x20is:',_0x596899['id']);return getEndUser(_0x145203,_0x5c4533['calleridname'],_0x5c4533[_0x1810('0x47')]);})[_0x1810('0x1d')](function(_0x15f38e){_0x229a4f=_0x15f38e;logger[_0x1810('0xd')]('The\x20Enduser\x20ID\x20is:',_0x229a4f['id']);return getTicket(_0x145203,_0x596899,_0x229a4f,_0x43f703,_0x5c4533);})[_0x1810('0x1d')](function(_0x40c2f6){if(_0x40c2f6){logger[_0x1810('0xd')]('Ticket\x20created!');logger[_0x1810('0xd')](_0x1810('0x49'),_0x40c2f6['id']);}})[_0x1810('0x4d')](function(_0x1cbe6f){logger[_0x1810('0x4e')]('['+_0x5c4533[_0x1810('0x56')][_0x1810('0x57')]()+']',JSON[_0x1810('0x2c')](_0x1cbe6f));});}; \ 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 0b317dc..0718f2a 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 _0x5290=['Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','message','GET','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Descriptions','task','/contacts/','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','moment','bluebird','./util','../../../../config/logger','freshsales','redis','defaults','localhost','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail'];(function(_0x22bf47,_0x4018b8){var _0x2acadb=function(_0x489c0b){while(--_0x489c0b){_0x22bf47['push'](_0x22bf47['shift']());}};_0x2acadb(++_0x4018b8);}(_0x5290,0x1c1));var _0x0529=function(_0x3f43ee,_0x531491){_0x3f43ee=_0x3f43ee-0x0;var _0x2ff3da=_0x5290[_0x3f43ee];return _0x2ff3da;};'use strict';var _=require(_0x0529('0x0'));var rp=require(_0x0529('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0x0529('0x2'));var Promise=require(_0x0529('0x3'));var Redis=require('ioredis');var intUtil=require(_0x0529('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0529('0x5'))(_0x0529('0x6'));config[_0x0529('0x7')]=_[_0x0529('0x8')](config[_0x0529('0x7')],{'host':_0x0529('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0529('0x7')]));function getAdminId(_0x1f59ec,_0x5476be,_0x3fac74,_0x54f0c6){return new Promise(function(_0x3cb8aa,_0x32373d){var _0x37897a=![];var _0x104327={'method':'GET','uri':_0x54f0c6+_0x0529('0xa'),'json':!![]};_0x104327[_0x0529('0xb')]=_0x3fac74;logger[_0x0529('0xc')](_0x0529('0xd'));return rp(_0x104327)[_0x0529('0xe')](function(_0x463e04){if(_0x463e04){var _0x1cc85a=_0x463e04[_0x0529('0xf')];var _0xdea2d9=null;for(_0xdea2d9=0x0;_0xdea2d9<_0x1cc85a[_0x0529('0x10')];_0xdea2d9++){if(_0x1cc85a[_0xdea2d9][_0x0529('0x11')]===_0x1f59ec[_0x0529('0x12')]){_0x1f59ec['adminId']=_0x1cc85a[_0xdea2d9]['id'];_0x37897a=!![];}}if(_0x37897a){logger[_0x0529('0xc')](_0x0529('0x13'),_0x1f59ec[_0x0529('0x14')]);_0x3cb8aa(_0x1f59ec);}else{_0x32373d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x32373d({'statusCode':0x194,'message':_0x0529('0x15')});}})[_0x0529('0x16')](function(_0x4f12b4){logger[_0x0529('0x17')]('['+[_0x5476be[_0x0529('0x18')]()]+']',_0x4f12b4['message']);_0x32373d(_0x4f12b4);});});}function getUser(_0x13a965,_0x30c8aa,_0xedb486){return function(_0x480234){return new Promise(function(_0x179ec7,_0x1efe03){var _0x3d8a9d={'method':'GET','uri':_0xedb486+_0x0529('0xa'),'json':!![]};_0x3d8a9d[_0x0529('0xb')]=_0x30c8aa;logger[_0x0529('0xc')]('Getting\x20user\x20list');return rp(_0x3d8a9d)[_0x0529('0xe')](function(_0x2ed604){if(_0x2ed604){var _0x1ae9a7=_0x2ed604[_0x0529('0xf')];var _0x441eec=![];var _0x5e50b9=null;if(_0x480234[_0x0529('0x19')]!==null){logger[_0x0529('0xc')](_0x0529('0x1a'),_0x480234[_0x0529('0x19')]);_0x480234['userEmail']=_0x480234[_0x0529('0x19')];for(_0x5e50b9=0x0;_0x5e50b9<_0x1ae9a7[_0x0529('0x10')];_0x5e50b9++){if(_0x1ae9a7[_0x5e50b9]['email']===_0x480234[_0x0529('0x19')]){_0x441eec=!![];_0x480234[_0x0529('0x1b')]=_0x1ae9a7[_0x5e50b9]['id'];logger[_0x0529('0xc')](_0x0529('0x1c'),_0x480234['userId']);}}}if(!_0x441eec){logger['info'](_0x0529('0x1d'));_0x480234[_0x0529('0x1e')]=_0x480234[_0x0529('0x12')];_0x480234[_0x0529('0x1b')]=_0x480234[_0x0529('0x14')];_0x441eec=!![];}if(_0x441eec){_0x179ec7(_0x480234);}else{_0x1efe03({'statusCode':0x194,'message':_0x0529('0x15')});}}else{_0x1efe03({'statusCode':0x194,'message':_0x0529('0x15')});}})[_0x0529('0x16')](function(_0x49cf13){logger[_0x0529('0x17')]('['+[_0x13a965[_0x0529('0x18')]()]+']',_0x49cf13[_0x0529('0x1f')]);_0x1efe03(_0x49cf13);});});};}function searchContact(_0x126066,_0x2171b1,_0x4f13e5,_0x43457c){return new Promise(function(_0x5ebcaa,_0x55f3b6){var _0x47dccd={'method':_0x0529('0x20'),'headers':_0x2171b1,'uri':_0x126066+_0x0529('0x21')+_0x43457c+_0x0529('0x22')+_0x4f13e5+_0x0529('0x23'),'json':!![]};rp(_0x47dccd)['then'](function(_0x56f0b8){var _0x94eb2c=_[_0x0529('0x24')](_0x56f0b8['contacts'][_0x0529('0x25')],[_0x4f13e5,_0x43457c]);_0x5ebcaa(_0x94eb2c);})[_0x0529('0x16')](function(_0x218ee4){_0x55f3b6(_0x218ee4);});});}function getEndUser(_0x1a815a,_0x4bacd6,_0x30a068){return function(_0x3cad2a){return new Promise(function(_0x49bc94,_0x426414){logger['info'](util[_0x0529('0x26')](_0x0529('0x27'),_0x3cad2a[_0x0529('0x28')]));searchContact(_0x30a068,_0x4bacd6,_0x0529('0x29'),_0x3cad2a['contactNumber'])['then'](function(_0x1960ff){if(_0x1960ff){_0x3cad2a[_0x0529('0x2a')]=_0x1960ff['id'];logger[_0x0529('0xc')](_0x0529('0x2b'),_0x3cad2a[_0x0529('0x2a')]);return _0x49bc94(_0x3cad2a);}searchContact(_0x30a068,_0x4bacd6,_0x0529('0x2c'),_0x3cad2a[_0x0529('0x28')])[_0x0529('0xe')](function(_0x270561){if(_0x270561){_0x3cad2a[_0x0529('0x2a')]=_0x270561['id'];logger['info'](_0x0529('0x2d'),_0x3cad2a[_0x0529('0x2a')]);return _0x49bc94(_0x3cad2a);}createEndUser(_0x3cad2a,_0x1a815a,_0x4bacd6,_0x30a068)[_0x0529('0xe')](function(_0x5dafd3){logger['info']('Contact\x20created:',_0x5dafd3[_0x0529('0x2a')]);return _0x49bc94(_0x5dafd3);});});})[_0x0529('0x16')](function(_0x5ac33d){_0x426414(_0x5ac33d);});});};}function createEndUser(_0x3d5d37,_0x4130bb,_0xf8a4c4,_0x4399b3){return new Promise(function(_0x20082d,_0x3cb525){var _0x333557=moment();var _0x3358ff={'method':_0x0529('0x2e'),'uri':_0x4399b3+_0x0529('0x2f'),'body':{'contact':{'last_name':_0x3d5d37[_0x0529('0x28')],'work_number':_0x3d5d37[_0x0529('0x28')],'mobile_number':_0x3d5d37[_0x0529('0x28')],'owner_id':_0x3d5d37[_0x0529('0x1b')],'created_at':_0x333557[_0x0529('0x26')](_0x0529('0x30'))}},'json':!![]};_0x3358ff['headers']=_0xf8a4c4;logger[_0x0529('0xc')](_0x0529('0x31'));return rp(_0x3358ff)['then'](function(_0x181b63){_0x3d5d37[_0x0529('0x2a')]=_0x181b63[_0x0529('0x32')]['id'];_0x20082d(_0x3d5d37);})[_0x0529('0x16')](function(_0x4b2acd){logger[_0x0529('0x17')]('['+[_0x4130bb['toUpperCase']()]+']',_0x4b2acd['message']);_0x3cb525(_0x4b2acd[_0x0529('0x1f')]);});});}function getTicket(_0x5bc905,_0x52f6e3,_0x2fb012,_0x21bf76,_0x4807e7){return function(_0x23abf7){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x294951,_0x4488fc){var _0x59941f=moment();var _0x45a812={'method':'POST','uri':_0x2fb012+'/api/tasks','body':{'title':intUtil['getString'](_0x21bf76['Subjects'],_0x4807e7,'\x20'),'description':intUtil[_0x0529('0x33')](_0x21bf76[_0x0529('0x34')],_0x4807e7,'\x0a'),'owner_id':_0x23abf7[_0x0529('0x1b')],'creater_id':_0x23abf7[_0x0529('0x14')],'targetable_id':_0x23abf7[_0x0529('0x2a')],'targetable_type':'Contact','created_at':_0x59941f['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x59941f['add'](0x1e,'m')[_0x0529('0x26')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x45a812['headers']=_0x52f6e3;return rp(_0x45a812)[_0x0529('0xe')](function(_0x17a419){_0x23abf7['ticketId']=_0x17a419[_0x0529('0x35')]['id'];logger[_0x0529('0xc')]('Task\x20created:',_0x23abf7['ticketId']);_0x294951(_0x23abf7);})[_0x0529('0x16')](function(_0x218f17){logger[_0x0529('0x17')]('['+[_0x5bc905[_0x0529('0x18')]()]+']',_0x218f17[_0x0529('0x1f')]);_0x4488fc(_0x218f17[_0x0529('0x1f')]);});});};}function emit(_0x4ac672,_0x6079cf,_0x4ecfab){var _0x407f2e={'uri':_0x4ac672+_0x0529('0x36')+_0x4ecfab};io['to'](util[_0x0529('0x26')]('user:%s',_0x6079cf))[_0x0529('0x37')](_0x0529('0x38'),_0x407f2e);}exports['cs']=function(_0x1719e8,_0x233a94,_0x3471ca,_0x32d301,_0x514d6d,_0x316944,_0x4d609d,_0x2f0c28){var _0x574c17={};var _0x4eb404={'Authorization':'Token\x20token='+_0x316944[_0x0529('0x39')]};_0x316944[_0x0529('0x3a')]=intUtil[_0x0529('0x3b')](_0x316944[_0x0529('0x3a')]);_0x316944['serverUrl']=intUtil[_0x0529('0x3b')](_0x316944[_0x0529('0x3c')]);var _0xdc1f36=_0x316944[_0x0529('0x3a')];_0x574c17[_0x0529('0x12')]=_0x316944['username'];_0x574c17[_0x0529('0x28')]=_0x2f0c28['toLowerCase']()===_0x0529('0x3d')?_0x233a94['destcalleridnum']:_0x233a94[_0x0529('0x3e')];_0x574c17[_0x0529('0x3f')]=_0x2f0c28===_0x0529('0x40')||_0x2f0c28==='unmanaged'?_0x0529('0x40'):_0x0529('0x3d');if(_0x32d301){_0x574c17['agentEmail']=_0x32d301[_0x0529('0x11')];}var _0x2214f1=util[_0x0529('0x26')](_0x0529('0x41'),_0x316944[_0x0529('0x3c')],_0x233a94[_0x0529('0x42')],md5(_0x233a94[_0x0529('0x42')]));if(_0x514d6d&&_0x514d6d['monitor_format']){logger[_0x0529('0xc')](_0x0529('0x43'),_0x0529('0x44'));_0x233a94[_0x0529('0x45')]=_0x2214f1;}else if(_0x4d609d&&_0x4d609d[_0x0529('0x46')]&&_0x4d609d[_0x0529('0x46')]!==_0x0529('0x47')){logger[_0x0529('0xc')](_0x0529('0x48'),_0x0529('0x44'));_0x233a94['recordingURL']=_0x2214f1;}else{_0x233a94[_0x0529('0x45')]='';}return getAdminId(_0x574c17,_0x2f0c28,_0x4eb404,_0xdc1f36)[_0x0529('0xe')](getUser(_0x2f0c28,_0x4eb404,_0xdc1f36))[_0x0529('0xe')](getEndUser(_0x2f0c28,_0x4eb404,_0xdc1f36))[_0x0529('0xe')](getTicket(_0x2f0c28,_0x4eb404,_0xdc1f36,_0x3471ca,_0x233a94))['then'](function(_0x4dd6ce){logger[_0x0529('0xc')](util[_0x0529('0x26')](_0x0529('0x49'),_0x4dd6ce[_0x0529('0x4a')]));if(_0x2f0c28!==_0x0529('0x4b')){logger[_0x0529('0xc')]('['+[_0x2f0c28['toUpperCase']()]+']',_0x0529('0x4c'));emit(_0xdc1f36,_0x32d301['name'],_0x4dd6ce['endUserId']);}})[_0x0529('0x16')](function(_0x541d00){logger[_0x0529('0x17')]('['+[_0x2f0c28[_0x0529('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x0529('0x4d')](_0x541d00,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7b50=['unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','name','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','ticketId','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b50,0xb3));var _0x07b5=function(_0x5a5cc9,_0x1ebc95){_0x5a5cc9=_0x5a5cc9-0x0;var _0xf70eee=_0x7b50[_0x5a5cc9];return _0xf70eee;};'use strict';var _=require(_0x07b5('0x0'));var rp=require(_0x07b5('0x1'));var md5=require(_0x07b5('0x2'));var util=require(_0x07b5('0x3'));var moment=require(_0x07b5('0x4'));var Promise=require(_0x07b5('0x5'));var Redis=require(_0x07b5('0x6'));var intUtil=require(_0x07b5('0x7'));var config=require(_0x07b5('0x8'));var logger=require('../../../../config/logger')(_0x07b5('0x9'));config[_0x07b5('0xa')]=_[_0x07b5('0xb')](config[_0x07b5('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x07b5('0xc'))(new Redis(config['redis']));function getAdminId(_0xbccfde,_0xa4375b,_0x65a798,_0x928c40){return new Promise(function(_0x1f7e1d,_0xfe2342){var _0x2a33a5=![];var _0x162f96={'method':_0x07b5('0xd'),'uri':_0x928c40+_0x07b5('0xe'),'json':!![]};_0x162f96['headers']=_0x65a798;logger[_0x07b5('0xf')](_0x07b5('0x10'));return rp(_0x162f96)[_0x07b5('0x11')](function(_0x582d4c){if(_0x582d4c){var _0x17648c=_0x582d4c[_0x07b5('0x12')];var _0x5575af=null;for(_0x5575af=0x0;_0x5575af<_0x17648c['length'];_0x5575af++){if(_0x17648c[_0x5575af][_0x07b5('0x13')]===_0xbccfde[_0x07b5('0x14')]){_0xbccfde[_0x07b5('0x15')]=_0x17648c[_0x5575af]['id'];_0x2a33a5=!![];}}if(_0x2a33a5){logger[_0x07b5('0xf')](_0x07b5('0x16'),_0xbccfde[_0x07b5('0x15')]);_0x1f7e1d(_0xbccfde);}else{_0xfe2342({'statusCode':0x194,'message':_0x07b5('0x17')});}}else{_0xfe2342({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x07b5('0x18')](function(_0x347752){logger[_0x07b5('0x19')]('['+[_0xa4375b[_0x07b5('0x1a')]()]+']',_0x347752[_0x07b5('0x1b')]);_0xfe2342(_0x347752);});});}function getUser(_0x28eea0,_0x6b0eb1,_0x2d5db1){return function(_0x1088a4){return new Promise(function(_0x29b71e,_0x136d5f){var _0xbb561f={'method':'GET','uri':_0x2d5db1+_0x07b5('0xe'),'json':!![]};_0xbb561f[_0x07b5('0x1c')]=_0x6b0eb1;logger[_0x07b5('0xf')](_0x07b5('0x1d'));return rp(_0xbb561f)[_0x07b5('0x11')](function(_0x306673){if(_0x306673){var _0x2a63c0=_0x306673['users'];var _0x13a9a7=![];var _0x1ac12d=null;if(_0x1088a4[_0x07b5('0x1e')]!==null){logger[_0x07b5('0xf')](_0x07b5('0x1f'),_0x1088a4[_0x07b5('0x1e')]);_0x1088a4[_0x07b5('0x20')]=_0x1088a4[_0x07b5('0x1e')];for(_0x1ac12d=0x0;_0x1ac12d<_0x2a63c0[_0x07b5('0x21')];_0x1ac12d++){if(_0x2a63c0[_0x1ac12d][_0x07b5('0x13')]===_0x1088a4[_0x07b5('0x1e')]){_0x13a9a7=!![];_0x1088a4[_0x07b5('0x22')]=_0x2a63c0[_0x1ac12d]['id'];logger[_0x07b5('0xf')](_0x07b5('0x23'),_0x1088a4[_0x07b5('0x22')]);}}}if(!_0x13a9a7){logger[_0x07b5('0xf')](_0x07b5('0x24'));_0x1088a4['userEmail']=_0x1088a4[_0x07b5('0x14')];_0x1088a4[_0x07b5('0x22')]=_0x1088a4[_0x07b5('0x15')];_0x13a9a7=!![];}if(_0x13a9a7){_0x29b71e(_0x1088a4);}else{_0x136d5f({'statusCode':0x194,'message':_0x07b5('0x17')});}}else{_0x136d5f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x07b5('0x18')](function(_0x9f43ba){logger['error']('['+[_0x28eea0[_0x07b5('0x1a')]()]+']',_0x9f43ba[_0x07b5('0x1b')]);_0x136d5f(_0x9f43ba);});});};}function searchContact(_0x55ee78,_0x36f432,_0x3cd9d1,_0x25d6f4){return new Promise(function(_0x393956,_0x247f65){var _0x4a489d={'method':_0x07b5('0xd'),'headers':_0x36f432,'uri':_0x55ee78+_0x07b5('0x25')+_0x25d6f4+_0x07b5('0x26')+_0x3cd9d1+_0x07b5('0x27'),'json':!![]};rp(_0x4a489d)[_0x07b5('0x11')](function(_0x470fbf){var _0x24548c=_['find'](_0x470fbf[_0x07b5('0x28')][_0x07b5('0x28')],[_0x3cd9d1,_0x25d6f4]);_0x393956(_0x24548c);})[_0x07b5('0x18')](function(_0x2ae05a){_0x247f65(_0x2ae05a);});});}function getEndUser(_0x40757c,_0x13d7ec,_0x2c07c5){return function(_0x2bd50c){return new Promise(function(_0x22dbf7,_0x9eaaef){logger['info'](util['format'](_0x07b5('0x29'),_0x2bd50c[_0x07b5('0x2a')]));searchContact(_0x2c07c5,_0x13d7ec,_0x07b5('0x2b'),_0x2bd50c[_0x07b5('0x2a')])[_0x07b5('0x11')](function(_0x3846df){if(_0x3846df){_0x2bd50c[_0x07b5('0x2c')]=_0x3846df['id'];logger[_0x07b5('0xf')](_0x07b5('0x2d'),_0x2bd50c['endUserId']);return _0x22dbf7(_0x2bd50c);}searchContact(_0x2c07c5,_0x13d7ec,_0x07b5('0x2e'),_0x2bd50c[_0x07b5('0x2a')])[_0x07b5('0x11')](function(_0x6199d8){if(_0x6199d8){_0x2bd50c[_0x07b5('0x2c')]=_0x6199d8['id'];logger['info'](_0x07b5('0x2f'),_0x2bd50c[_0x07b5('0x2c')]);return _0x22dbf7(_0x2bd50c);}createEndUser(_0x2bd50c,_0x40757c,_0x13d7ec,_0x2c07c5)['then'](function(_0x2b5cbd){logger[_0x07b5('0xf')](_0x07b5('0x30'),_0x2b5cbd[_0x07b5('0x2c')]);return _0x22dbf7(_0x2b5cbd);});});})[_0x07b5('0x18')](function(_0x2d6da3){_0x9eaaef(_0x2d6da3);});});};}function createEndUser(_0xfe4938,_0x543c15,_0x389529,_0x293f72){return new Promise(function(_0x2d1e06,_0x1ffe34){var _0x46a1fe=moment();var _0x594aeb={'method':'POST','uri':_0x293f72+_0x07b5('0x31'),'body':{'contact':{'last_name':_0xfe4938[_0x07b5('0x2a')],'work_number':_0xfe4938[_0x07b5('0x2a')],'mobile_number':_0xfe4938[_0x07b5('0x2a')],'owner_id':_0xfe4938[_0x07b5('0x22')],'created_at':_0x46a1fe[_0x07b5('0x32')](_0x07b5('0x33'))}},'json':!![]};_0x594aeb[_0x07b5('0x1c')]=_0x389529;logger[_0x07b5('0xf')](_0x07b5('0x34'));return rp(_0x594aeb)['then'](function(_0x282f37){_0xfe4938['endUserId']=_0x282f37[_0x07b5('0x35')]['id'];_0x2d1e06(_0xfe4938);})['catch'](function(_0x5275cd){logger[_0x07b5('0x19')]('['+[_0x543c15[_0x07b5('0x1a')]()]+']',_0x5275cd[_0x07b5('0x1b')]);_0x1ffe34(_0x5275cd[_0x07b5('0x1b')]);});});}function getTicket(_0xb5feb6,_0x1bc193,_0x34be0f,_0xc91d2,_0x32d346){return function(_0x413183){logger['info'](_0x07b5('0x36'));return new Promise(function(_0x9a6f70,_0x5653b1){var _0x49ac18=moment();var _0x427bc0={'method':'POST','uri':_0x34be0f+_0x07b5('0x37'),'body':{'title':intUtil[_0x07b5('0x38')](_0xc91d2[_0x07b5('0x39')],_0x32d346,'\x20'),'description':intUtil[_0x07b5('0x38')](_0xc91d2['Descriptions'],_0x32d346,'\x0a'),'owner_id':_0x413183[_0x07b5('0x22')],'creater_id':_0x413183['adminId'],'targetable_id':_0x413183[_0x07b5('0x2c')],'targetable_type':_0x07b5('0x3a'),'created_at':_0x49ac18[_0x07b5('0x32')](_0x07b5('0x33')),'due_date':_0x49ac18[_0x07b5('0x3b')](0x1e,'m')['format'](_0x07b5('0x33'))},'json':!![]};_0x427bc0[_0x07b5('0x1c')]=_0x1bc193;return rp(_0x427bc0)['then'](function(_0x5c304b){_0x413183[_0x07b5('0x3c')]=_0x5c304b['task']['id'];logger[_0x07b5('0xf')](_0x07b5('0x3d'),_0x413183[_0x07b5('0x3c')]);_0x9a6f70(_0x413183);})[_0x07b5('0x18')](function(_0x194e07){logger[_0x07b5('0x19')]('['+[_0xb5feb6[_0x07b5('0x1a')]()]+']',_0x194e07['message']);_0x5653b1(_0x194e07['message']);});});};}function emit(_0x17174e,_0x2a6dc6,_0x56b0a4){var _0x2a2e89={'uri':_0x17174e+'/contacts/'+_0x56b0a4};io['to'](util[_0x07b5('0x32')](_0x07b5('0x3e'),_0x2a6dc6))['emit'](_0x07b5('0x3f'),_0x2a2e89);}exports['cs']=function(_0x1c2757,_0x18d459,_0x136f4e,_0x20c450,_0x238e9f,_0x233fd1,_0x1708db,_0x4d43e0){var _0x4c9cf6={};var _0x12ed96={'Authorization':_0x07b5('0x40')+_0x233fd1['apiKey']};_0x233fd1[_0x07b5('0x41')]=intUtil[_0x07b5('0x42')](_0x233fd1[_0x07b5('0x41')]);_0x233fd1[_0x07b5('0x43')]=intUtil[_0x07b5('0x42')](_0x233fd1['serverUrl']);var _0x1c2a74=_0x233fd1[_0x07b5('0x41')];_0x4c9cf6[_0x07b5('0x14')]=_0x233fd1[_0x07b5('0x44')];_0x4c9cf6[_0x07b5('0x2a')]=_0x4d43e0['toLowerCase']()===_0x07b5('0x45')?_0x18d459[_0x07b5('0x46')]:_0x18d459[_0x07b5('0x47')];_0x4c9cf6[_0x07b5('0x48')]=_0x4d43e0==='queue'||_0x4d43e0===_0x07b5('0x49')?'queue':_0x07b5('0x45');if(_0x20c450){_0x4c9cf6[_0x07b5('0x1e')]=_0x20c450[_0x07b5('0x13')];}var _0x2e481c=util[_0x07b5('0x32')](_0x07b5('0x4a'),_0x233fd1[_0x07b5('0x43')],_0x18d459[_0x07b5('0x4b')],md5(_0x18d459['uniqueid']));if(_0x238e9f&&_0x238e9f[_0x07b5('0x4c')]){logger[_0x07b5('0xf')](_0x07b5('0x4d'),'Recording\x20is\x20enabled!');_0x18d459[_0x07b5('0x4e')]=_0x2e481c;}else if(_0x1708db&&_0x1708db[_0x07b5('0x4f')]&&_0x1708db[_0x07b5('0x4f')]!==_0x07b5('0x50')){logger[_0x07b5('0xf')]('[OUTBOUND]',_0x07b5('0x51'));_0x18d459[_0x07b5('0x4e')]=_0x2e481c;}else{_0x18d459[_0x07b5('0x4e')]='';}return getAdminId(_0x4c9cf6,_0x4d43e0,_0x12ed96,_0x1c2a74)[_0x07b5('0x11')](getUser(_0x4d43e0,_0x12ed96,_0x1c2a74))[_0x07b5('0x11')](getEndUser(_0x4d43e0,_0x12ed96,_0x1c2a74))[_0x07b5('0x11')](getTicket(_0x4d43e0,_0x12ed96,_0x1c2a74,_0x136f4e,_0x18d459))[_0x07b5('0x11')](function(_0xf320bc){logger[_0x07b5('0xf')](util['format'](_0x07b5('0x52'),_0xf320bc[_0x07b5('0x3c')]));if(_0x4d43e0!==_0x07b5('0x49')){logger[_0x07b5('0xf')]('['+[_0x4d43e0['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1c2a74,_0x20c450[_0x07b5('0x53')],_0xf320bc[_0x07b5('0x2c')]);}})['catch'](function(_0x336d2d){logger[_0x07b5('0x19')]('['+[_0x4d43e0[_0x07b5('0x1a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x336d2d,{'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 bb0348a..f9b9a63 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 _0xea21=['../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','./zoho','./vtiger','./servicenow','zendesk','salesforce','zoho','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','freshdesk','desk','unknown\x20integration'];(function(_0x2d2416,_0x32d65d){var _0x46aba2=function(_0x5bbb2c){while(--_0x5bbb2c){_0x2d2416['push'](_0x2d2416['shift']());}};_0x46aba2(++_0x32d65d);}(_0xea21,0x1f3));var _0x1ea2=function(_0x3a8cb0,_0x48f7df){_0x3a8cb0=_0x3a8cb0-0x0;var _0x1b838a=_0xea21[_0x3a8cb0];return _0x1b838a;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x1ea2('0x0'));var desk=require('./desk');var vtiger=require(_0x1ea2('0x1'));var servicenow=require(_0x1ea2('0x2'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x1ea2('0x3'),_0x1ea2('0x4'),'sugarcrm','freshdesk',_0x1ea2('0x5'),'desk',_0x1ea2('0x6'),_0x1ea2('0x7'),_0x1ea2('0x8'),_0x1ea2('0x9')];exports['exec']=function(_0x4c8010,_0x155843,_0x27aaa2,_0x2a033c,_0x9b3f9e,_0x8dd95f){if(_0x27aaa2){if(_[_0x1ea2('0xa')](integrations,_0x4c8010[_0x1ea2('0xb')][_0x1ea2('0xc')]())){try{var _0x179b52=null;var _0x29f9d0='';var _0x21eaf0=_0x27aaa2[_0x4c8010[_0x1ea2('0xb')][_0x1ea2('0xc')]()];if(_0x21eaf0){var _0x2b8ac0=_0x21eaf0[_0x4c8010[_0x1ea2('0xd')]];if(_0x2b8ac0){var _0x194d73=_['find'](_0x2b8ac0[_0x1ea2('0xe')],{'id':parseInt(_0x4c8010[_0x1ea2('0xf')],0xa)});if(_0x194d73){if(_0x2a033c){if(_0x9b3f9e&&_0x155843['queue']){_0x29f9d0=_0x1ea2('0x10');}else if(_0x155843['routeId']){_0x29f9d0=_0x1ea2('0x11');}else{console[_0x1ea2('0x12')](_0x1ea2('0x13'),_0x155843);}}else{_0x29f9d0='unmanaged';}switch(_0x4c8010[_0x1ea2('0xb')][_0x1ea2('0xc')]()){case _0x1ea2('0x3'):zendesk[_0x29f9d0](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f);break;case _0x1ea2('0x4'):salesforce[_0x29f9d0](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f);break;case'sugarcrm':sugarcrm[_0x29f9d0](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f);break;case _0x1ea2('0x14'):freshdesk[_0x29f9d0](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f);break;case'zoho':zoho[_0x29f9d0](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f);break;case _0x1ea2('0x15'):desk[_0x29f9d0](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f);break;case'vtiger':vtiger[_0x29f9d0](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f);break;case _0x1ea2('0x8'):freshsales['cs'](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f,_0x29f9d0);break;case _0x1ea2('0x9'):servicenow['cs'](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f,_0x29f9d0);break;case'dynamics365':dynamics365['cs'](_0x4c8010,_0x155843,_0x194d73,_0x2a033c,_0x9b3f9e,_0x2b8ac0,_0x8dd95f,_0x29f9d0);break;default:console[_0x1ea2('0x12')](_0x1ea2('0x16'));}}else{_0x179b52=require(_0x1ea2('0x17'))(_0x4c8010['data1'][_0x1ea2('0xc')]());_0x179b52[_0x1ea2('0x18')](_0x1ea2('0x19'),util[_0x1ea2('0x1a')](_0x1ea2('0x1b'),_0x4c8010[_0x1ea2('0xb')][_0x1ea2('0xc')](),_0x4c8010['data3']));}}else{_0x179b52=require(_0x1ea2('0x17'))(_0x4c8010[_0x1ea2('0xb')]['toLowerCase']());_0x179b52[_0x1ea2('0x18')](_0x1ea2('0x19'),util[_0x1ea2('0x1a')](_0x1ea2('0x1c'),_0x4c8010[_0x1ea2('0xb')][_0x1ea2('0xc')](),_0x4c8010[_0x1ea2('0xd')]));}}else{}}catch(_0x3283ee){console[_0x1ea2('0x18')](_0x3283ee);}}}}; \ No newline at end of file +var _0xb96f=['exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales'];(function(_0x43026c,_0x16e088){var _0x4c35b4=function(_0x12ee61){while(--_0x12ee61){_0x43026c['push'](_0x43026c['shift']());}};_0x4c35b4(++_0x16e088);}(_0xb96f,0xac));var _0xfb96=function(_0x466f54,_0x36263a){_0x466f54=_0x466f54-0x0;var _0x283b67=_0xb96f[_0x466f54];return _0x283b67;};'use strict';var _=require('lodash');var util=require(_0xfb96('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0xfb96('0x1'));var sugarcrm=require(_0xfb96('0x2'));var freshdesk=require(_0xfb96('0x3'));var zoho=require(_0xfb96('0x4'));var desk=require(_0xfb96('0x5'));var vtiger=require(_0xfb96('0x6'));var servicenow=require(_0xfb96('0x7'));var dynamics365=require(_0xfb96('0x8'));var freshsales=require('./freshsales');var integrations=[_0xfb96('0x9'),_0xfb96('0xa'),_0xfb96('0xb'),_0xfb96('0xc'),_0xfb96('0xd'),_0xfb96('0xe'),_0xfb96('0xf'),_0xfb96('0x10'),_0xfb96('0x11'),'servicenow'];exports[_0xfb96('0x12')]=function(_0x28ec12,_0xca5a37,_0x43f57c,_0x562906,_0x3dfb93,_0x5f4eb8){if(_0x43f57c){if(_[_0xfb96('0x13')](integrations,_0x28ec12[_0xfb96('0x14')][_0xfb96('0x15')]())){try{var _0xe0e897=null;var _0x9e4e8b='';var _0x292f43=_0x43f57c[_0x28ec12['data1'][_0xfb96('0x15')]()];if(_0x292f43){var _0x52c68a=_0x292f43[_0x28ec12[_0xfb96('0x16')]];if(_0x52c68a){var _0x4d96dd=_[_0xfb96('0x17')](_0x52c68a[_0xfb96('0x18')],{'id':parseInt(_0x28ec12[_0xfb96('0x19')],0xa)});if(_0x4d96dd){if(_0x562906){if(_0x3dfb93&&_0xca5a37[_0xfb96('0x1a')]){_0x9e4e8b=_0xfb96('0x1a');}else if(_0xca5a37[_0xfb96('0x1b')]){_0x9e4e8b='outbound';}else{console['log'](_0xfb96('0x1c'),_0xca5a37);}}else{_0x9e4e8b=_0xfb96('0x1d');}switch(_0x28ec12[_0xfb96('0x14')]['toLowerCase']()){case _0xfb96('0x9'):zendesk[_0x9e4e8b](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8);break;case _0xfb96('0xa'):salesforce[_0x9e4e8b](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8);break;case _0xfb96('0xb'):sugarcrm[_0x9e4e8b](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8);break;case'freshdesk':freshdesk[_0x9e4e8b](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8);break;case'zoho':zoho[_0x9e4e8b](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8);break;case _0xfb96('0xe'):desk[_0x9e4e8b](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8);break;case _0xfb96('0xf'):vtiger[_0x9e4e8b](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8);break;case'freshsales':freshsales['cs'](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8,_0x9e4e8b);break;case _0xfb96('0x1e'):servicenow['cs'](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8,_0x9e4e8b);break;case _0xfb96('0x10'):dynamics365['cs'](_0x28ec12,_0xca5a37,_0x4d96dd,_0x562906,_0x3dfb93,_0x52c68a,_0x5f4eb8,_0x9e4e8b);break;default:console['log'](_0xfb96('0x1f'));}}else{_0xe0e897=require(_0xfb96('0x20'))(_0x28ec12[_0xfb96('0x14')][_0xfb96('0x15')]());_0xe0e897['error'](_0xfb96('0x21'),util[_0xfb96('0x22')](_0xfb96('0x23'),_0x28ec12['data1'][_0xfb96('0x15')](),_0x28ec12[_0xfb96('0x19')]));}}else{_0xe0e897=require(_0xfb96('0x20'))(_0x28ec12[_0xfb96('0x14')][_0xfb96('0x15')]());_0xe0e897[_0xfb96('0x24')]('[EXEC]',util['format'](_0xfb96('0x25'),_0x28ec12[_0xfb96('0x14')]['toLowerCase'](),_0x28ec12[_0xfb96('0x16')]));}}else{}}catch(_0x395cdc){console[_0xfb96('0x24')](_0x395cdc);}}}}; \ 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 c3d8367..e18dc26 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 _0xf0fa=['ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','account','WhatId','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','create','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','lastevent',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','jsforce','util'];(function(_0x4b9216,_0x4eaf36){var _0x309f82=function(_0x3c4a31){while(--_0x3c4a31){_0x4b9216['push'](_0x4b9216['shift']());}};_0x309f82(++_0x4eaf36);}(_0xf0fa,0xfc));var _0xaf0f=function(_0x1bac9a,_0x2b1b38){_0x1bac9a=_0x1bac9a-0x0;var _0x27bb28=_0xf0fa[_0x1bac9a];return _0x27bb28;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xaf0f('0x0'));var BPromise=require(_0xaf0f('0x1'));var md5=require('md5');var jsforce=require(_0xaf0f('0x2'));var util=require(_0xaf0f('0x3'));var Redis=require(_0xaf0f('0x4'));var intUtil=require(_0xaf0f('0x5'));var config=require(_0xaf0f('0x6'));var logger=require(_0xaf0f('0x7'))('salesforce');config[_0xaf0f('0x8')]=_[_0xaf0f('0x9')](config[_0xaf0f('0x8')],{'host':_0xaf0f('0xa'),'port':0x18eb});var io=require(_0xaf0f('0xb'))(new Redis(config[_0xaf0f('0x8')]));function emit(_0x142ea7,_0x334875,_0x2245a2){io['to'](_0x142ea7)[_0xaf0f('0xc')](_0x334875,_0x2245a2);}function getTicket(_0x2d7381,_0xcb8eca,_0x378f86,_0x4d9a4b,_0x2ead33,_0x3bfbda,_0x642dac,_0x19e58f){var _0x3ae6c6=Object[_0xaf0f('0xd')]({},{'OwnerId':_0xcb8eca['id'],'Subject':intUtil[_0xaf0f('0xe')](_0x4d9a4b[_0xaf0f('0xf')],_0x2ead33,'\x20'),'Description':intUtil[_0xaf0f('0xe')](_0x4d9a4b['Descriptions'],_0x2ead33,'\x0a')},getCustomFields(_0x3bfbda,_0x2ead33));if(_0x378f86){if(_0x4d9a4b[_0xaf0f('0x10')]===_0xaf0f('0x11')){_0x3ae6c6[_0xaf0f('0x12')]=moment[_0xaf0f('0x13')]();_0x3ae6c6[_0xaf0f('0x14')]=![];_0x3ae6c6[_0xaf0f('0x15')]=![];if(_0x378f86['endUserType']===_0xaf0f('0x16')||_0x378f86[_0xaf0f('0x17')]===_0xaf0f('0x18')){_0x3ae6c6['WhoId']=_0x378f86['id'];}else if(_0x378f86['endUserType']===_0xaf0f('0x19')){_0x3ae6c6[_0xaf0f('0x1a')]=_0x378f86['id'];}}else if(_0x4d9a4b[_0xaf0f('0x10')]===_0xaf0f('0x1b')){if(_0x378f86['endUserType']===_0xaf0f('0x16')){_0x3ae6c6['ContactId']=_0x378f86['id'];}else if(_0x378f86[_0xaf0f('0x17')]==='account'){_0x3ae6c6['AccountId']=_0x378f86['id'];}else if(_0x378f86[_0xaf0f('0x17')]===_0xaf0f('0x18')&&_0x4d9a4b[_0xaf0f('0x1c')]){_0x3ae6c6[_0x4d9a4b[_0xaf0f('0x1c')]]=_0x378f86['id'];}else{logger[_0xaf0f('0x1d')](_0xaf0f('0x1e'));}}}return _0x642dac[_0xaf0f('0x1f')](_0x4d9a4b[_0xaf0f('0x10')])['create'](_0x3ae6c6);}function getUser(_0x18d2cd,_0x444871,_0x12e6e8){if(!_[_0xaf0f('0x20')](_0x444871)&&intUtil[_0xaf0f('0x21')](_0x444871)){var _0x4d4b43={'Email':_0x444871};var _0x5c73b7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x12e6e8['sobject'](_0xaf0f('0x22'))[_0xaf0f('0x23')](_0x4d4b43,_0x5c73b7)['execute']()[_0xaf0f('0x24')](function(_0x22e886){if(_0x22e886[_0xaf0f('0x25')]){var _0x530f37=_[_0xaf0f('0x23')](_0x22e886,function(_0x52f874){return _0x52f874[_0xaf0f('0x26')]===_0x444871;});if(_0x530f37){logger[_0xaf0f('0x1d')]('Agent\x20%s\x20found.',_0x444871);return BPromise[_0xaf0f('0x27')]({'id':_0x530f37['Id'],'name':_0x530f37[_0xaf0f('0x28')]});}}else{logger['info'](_0xaf0f('0x29'),_0x444871);return _0x12e6e8[_0xaf0f('0x2a')]()['then'](function(_0x4e8cb7){return BPromise['resolve']({'id':_0x4e8cb7[_0xaf0f('0x2b')],'name':_0x4e8cb7[_0xaf0f('0x2c')]});});}});}else{logger[_0xaf0f('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x444871);return _0x12e6e8[_0xaf0f('0x2a')]()[_0xaf0f('0x24')](function(_0x90f126){return BPromise[_0xaf0f('0x27')]({'id':_0x90f126[_0xaf0f('0x2b')],'name':_0x90f126[_0xaf0f('0x2c')]});});}}function getEndUser(_0x396b3e,_0x32fe37,_0x55fbfa,_0xd52248,_0x520558){var _0x429de6={'$or':{'Phone':_0xd52248}};var _0x557f0e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xaf0f('0x27')]()[_0xaf0f('0x24')](function(){logger[_0xaf0f('0x1d')](_0xaf0f('0x2d'),_0xd52248,_0x32fe37[_0xaf0f('0x2e')]);switch(_0x32fe37['moduleSearch']){case _0xaf0f('0x2f'):var _0x3373c3=_[_0xaf0f('0x30')](_0x429de6);if(_0x32fe37[_0xaf0f('0x31')]){var _0x3b7a64={};_0x3b7a64[_0x32fe37[_0xaf0f('0x31')]]=_0xd52248;_[_0xaf0f('0x32')](_0x3373c3[_0xaf0f('0x33')],_0x3b7a64);}return _0x520558['sobject'](_0xaf0f('0x34'))[_0xaf0f('0x23')](_0x3373c3,_0x557f0e)[_0xaf0f('0x35')]()['then'](function(_0x410abb){if(_0x410abb&&_0x410abb[_0xaf0f('0x25')]){return _0x410abb;}else{var _0x1f0d00=_[_0xaf0f('0x30')](_0x429de6);if(_0x32fe37[_0xaf0f('0x36')]){var _0x484348={};_0x484348[_0x32fe37['additionalSearchLead']]=_0xd52248;_[_0xaf0f('0x32')](_0x1f0d00[_0xaf0f('0x33')],_0x484348);}return _0x520558[_0xaf0f('0x1f')](_0xaf0f('0x37'))[_0xaf0f('0x23')](_0x1f0d00,_0x557f0e);}});case _0xaf0f('0x38'):var _0x5e29d6=_[_0xaf0f('0x30')](_0x429de6);if(_0x32fe37[_0xaf0f('0x39')]){var _0x3b7a64={};_0x3b7a64[_0x32fe37[_0xaf0f('0x39')]]=_0xd52248;_[_0xaf0f('0x32')](_0x5e29d6[_0xaf0f('0x33')],_0x3b7a64);}return _0x520558['sobject'](_0xaf0f('0x3a'))[_0xaf0f('0x23')](_0x5e29d6,_0x557f0e)['execute']()[_0xaf0f('0x24')](function(_0x33abe6){if(_0x33abe6&&_0x33abe6['length']){return _0x33abe6;}else{var _0x4d53b1=_['cloneDeep'](_0x429de6);if(_0x32fe37['additionalSearchContact']){var _0x1f392f={};_0x1f392f[_0x32fe37['additionalSearchContact']]=_0xd52248;_[_0xaf0f('0x32')](_0x4d53b1['$or'],_0x1f392f);}return _0x520558[_0xaf0f('0x1f')](_0xaf0f('0x34'))[_0xaf0f('0x23')](_0x4d53b1,_0x557f0e)[_0xaf0f('0x24')](function(_0x23cc73){if(_0x23cc73&&_0x23cc73[_0xaf0f('0x25')]){return _0x23cc73;}else{var _0xeb5245=_['cloneDeep'](_0x429de6);if(_0x32fe37[_0xaf0f('0x36')]){var _0x58067f={};_0x58067f[_0x32fe37[_0xaf0f('0x36')]]=_0xd52248;_[_0xaf0f('0x32')](_0xeb5245[_0xaf0f('0x33')],_0x58067f);}return _0x520558[_0xaf0f('0x1f')](_0xaf0f('0x37'))[_0xaf0f('0x23')](_0xeb5245,_0x557f0e);}});}});case _0xaf0f('0x16'):var _0x3373c3=_[_0xaf0f('0x30')](_0x429de6);if(_0x32fe37[_0xaf0f('0x31')]){var _0x3b7a64={};_0x3b7a64[_0x32fe37['additionalSearchContact']]=_0xd52248;_[_0xaf0f('0x32')](_0x3373c3[_0xaf0f('0x33')],_0x3b7a64);}return _0x520558[_0xaf0f('0x1f')]('Contact')[_0xaf0f('0x23')](_0x3373c3,_0x557f0e)[_0xaf0f('0x35')]();case _0xaf0f('0x18'):var _0x54b4d0=_[_0xaf0f('0x30')](_0x429de6);if(_0x32fe37[_0xaf0f('0x36')]){var _0x3b7a64={};_0x3b7a64[_0x32fe37[_0xaf0f('0x36')]]=_0xd52248;_[_0xaf0f('0x32')](_0x54b4d0['$or'],_0x3b7a64);}return _0x520558[_0xaf0f('0x1f')](_0xaf0f('0x37'))['find'](_0x54b4d0,_0x557f0e);case _0xaf0f('0x19'):var _0x5e29d6=_[_0xaf0f('0x30')](_0x429de6);if(_0x32fe37[_0xaf0f('0x39')]){var _0x3b7a64={};_0x3b7a64[_0x32fe37['additionalSearchAccount']]=_0xd52248;_[_0xaf0f('0x32')](_0x5e29d6[_0xaf0f('0x33')],_0x3b7a64);}return _0x520558[_0xaf0f('0x1f')](_0xaf0f('0x3a'))[_0xaf0f('0x23')](_0x5e29d6,_0x557f0e);default:return null;}})[_0xaf0f('0x24')](function(_0x3554d7){if(_0x3554d7&&_0x3554d7[_0xaf0f('0x25')]){var _0x8465c4=_[_0xaf0f('0x3b')](_0x3554d7);if(_0x8465c4){return BPromise[_0xaf0f('0x27')]({'id':_0x8465c4['Id'],'name':_0x8465c4['Name'],'phone':_0x8465c4[_0xaf0f('0x3c')],'endUserType':_0x8465c4[_0xaf0f('0x3d')][_0xaf0f('0x3e')][_0xaf0f('0x3f')]()});}}})['then'](function(_0x46c222){if(_0x46c222){logger[_0xaf0f('0x1d')](_0xaf0f('0x40'),_0x46c222['endUserType'],_0xd52248);return BPromise['resolve'](_0x46c222);}else{logger[_0xaf0f('0x1d')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0xd52248);var _0x5d701b={'Phone':_0xd52248};if(_0x32fe37[_0xaf0f('0x41')]){if(_0x32fe37[_0xaf0f('0x41')]===_0xaf0f('0x16')){logger[_0xaf0f('0x1d')](_0xaf0f('0x42'),_0xd52248,_0x32fe37[_0xaf0f('0x41')]);_0x5d701b[_0xaf0f('0x43')]=_0x55fbfa!==_0xaf0f('0x44')?_0x55fbfa:util[_0xaf0f('0x45')]('Caller\x20-\x20%s',_0xd52248);}else if(_0x32fe37['moduleCreate']==='lead'){logger[_0xaf0f('0x1d')](_0xaf0f('0x42'),_0xd52248,_0x32fe37[_0xaf0f('0x41')]);_0x5d701b[_0xaf0f('0x43')]=_0x55fbfa!==_0xaf0f('0x44')?_0x55fbfa:util[_0xaf0f('0x45')](_0xaf0f('0x46'),_0xd52248);_0x5d701b[_0xaf0f('0x47')]=_0xaf0f('0x48');}else if(_0x32fe37[_0xaf0f('0x41')]==='account'){logger[_0xaf0f('0x1d')](_0xaf0f('0x42'),_0xd52248,_0x32fe37[_0xaf0f('0x41')]);_0x5d701b[_0xaf0f('0x28')]=_0x55fbfa!==_0xaf0f('0x44')?_0x55fbfa:util['format'](_0xaf0f('0x46'),_0xd52248);}else{return null;}}return _0x520558[_0xaf0f('0x1f')](_['upperFirst'](_0x32fe37[_0xaf0f('0x41')]))[_0xaf0f('0x49')](_0x5d701b)['then'](function(_0x52a0db){return BPromise[_0xaf0f('0x27')]({'id':_0x52a0db['id'],'endUserType':_0x32fe37['moduleCreate']});});}});}function getCustomFields(_0x2c49f2,_0x279ba2){var _0x1ec778={};if(_0x2c49f2[_0xaf0f('0x25')]>0x0){_['forEach'](_0x2c49f2,function(_0x4c45f7){if(_['includes']([_0xaf0f('0x4a'),_0xaf0f('0x4b')],_0x4c45f7['type'])&&_0x4c45f7[_0xaf0f('0x4c')]){_0x1ec778[_0x4c45f7[_0xaf0f('0x4c')]]=_0x4c45f7[_0xaf0f('0x4d')][_0xaf0f('0x4e')]();}else if(_0x4c45f7[_0xaf0f('0x3e')]===_0xaf0f('0x4f')&&_0x4c45f7['variableName']&&_0x4c45f7[_0xaf0f('0x4c')]){_0x279ba2[_0x4c45f7[_0xaf0f('0x50')]]&&(_0x1ec778[_0x4c45f7[_0xaf0f('0x4c')]]=_0x279ba2[_0x4c45f7[_0xaf0f('0x50')]][_0xaf0f('0x4e')]());}else if(_0x4c45f7[_0xaf0f('0x3e')]===_0xaf0f('0x51')&&_0x4c45f7[_0xaf0f('0x52')]&&_0x4c45f7[_0xaf0f('0x52')][_0xaf0f('0x53')]&&_0x4c45f7['idField']){_0x279ba2[_0x4c45f7[_0xaf0f('0x52')][_0xaf0f('0x53')][_0xaf0f('0x3f')]()]&&(_0x1ec778[_0x4c45f7['idField']]=_0x279ba2[_0x4c45f7['Variable']['name'][_0xaf0f('0x3f')]()][_0xaf0f('0x4e')]());}});}return _0x1ec778;}function getConnection(_0x16be3b){var _0x160033=_0x16be3b[_0xaf0f('0x54')]['concat'](_0x16be3b[_0xaf0f('0x55')]);var _0x293bdc=new jsforce['Connection']({'oauth2':{'loginUrl':_0x16be3b[_0xaf0f('0x56')]||_0xaf0f('0x57'),'clientId':_0x16be3b['clientId'],'clientSecret':_0x16be3b['clientSecret']}});return _0x293bdc[_0xaf0f('0x58')](_0x16be3b[_0xaf0f('0x59')],_0x160033)['then'](function(){logger[_0xaf0f('0x1d')](_0xaf0f('0x5a'));return _0x293bdc;});}exports[_0xaf0f('0x5b')]=function(_0x49ba4d,_0x33e9f5,_0x85c0bc,_0x27febd,_0x5353cf,_0x1982ad){var _0x5da1da,_0x231bf9,_0x37a04a,_0x9254c7;_0x1982ad[_0xaf0f('0x5c')]=intUtil[_0xaf0f('0x5d')](_0x1982ad[_0xaf0f('0x5c')]);_0x1982ad[_0xaf0f('0x56')]=intUtil[_0xaf0f('0x5d')](_0x1982ad[_0xaf0f('0x56')]);if(_0x5353cf&&_0x5353cf[_0xaf0f('0x5e')]){logger['info']('[QUEUE]',_0xaf0f('0x5f'));_0x33e9f5[_0xaf0f('0x60')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1982ad[_0xaf0f('0x5c')],_0x33e9f5['uniqueid'],md5(_0x33e9f5[_0xaf0f('0x61')]));}else{_0x33e9f5[_0xaf0f('0x60')]='';}return getConnection(_0x1982ad)['then'](function(_0x3a457f){_0x9254c7=_0x3a457f;return getUser(_0x1982ad,_0x27febd['email'],_0x9254c7);})[_0xaf0f('0x24')](function(_0x1790fb){_0x5da1da=_0x1790fb;return getEndUser(_0x1982ad,_0x85c0bc,_0x33e9f5[_0xaf0f('0x62')],_0x33e9f5['calleridnum'],_0x9254c7);})[_0xaf0f('0x24')](function(_0x151829){_0x231bf9=_0x151829;return getTicket(_0x1982ad,_0x5da1da,_0x231bf9,_0x85c0bc,_0x33e9f5,_0x85c0bc['Fields'],_0x9254c7,_0xaf0f('0x5b'));})[_0xaf0f('0x24')](function(_0x8c2092){_0x37a04a=_0x8c2092;logger[_0xaf0f('0x1d')](_0xaf0f('0x63'),_0x37a04a['id']);logger[_0xaf0f('0x1d')](_0xaf0f('0x64'),_0x37a04a['id'],_0x27febd['name'],_0x1982ad[_0xaf0f('0x3e')]);switch(_0x1982ad[_0xaf0f('0x3e')]){case _0xaf0f('0x65'):emit(util[_0xaf0f('0x45')]('user:%s',_0x27febd[_0xaf0f('0x53')]),'trigger:salesforce:display',{'recordId':_0x37a04a['id']});break;case _0xaf0f('0x66'):emit(util['format'](_0xaf0f('0x67'),_0x27febd[_0xaf0f('0x53')]),_0xaf0f('0x68'),{'uri':util['format'](_0xaf0f('0x69'),_0x9254c7[_0xaf0f('0x6a')],_0x37a04a['id'])});break;default:logger[_0xaf0f('0x6b')](_0xaf0f('0x6c'));}})[_0xaf0f('0x6d')](function(_0x2c4bcf){logger['error'](_0xaf0f('0x6e'),_0x2c4bcf);});};exports[_0xaf0f('0x6f')]=function(_0x549a2d,_0x4b8a44,_0x461532,_0x42a9a1,_0x36ca50,_0x299722,_0x421191){var _0x50aca2,_0x3f0b94,_0x467e69,_0x258dee;_0x299722[_0xaf0f('0x5c')]=intUtil['stripTrailingSlash'](_0x299722[_0xaf0f('0x5c')]);_0x299722[_0xaf0f('0x56')]=intUtil[_0xaf0f('0x5d')](_0x299722[_0xaf0f('0x56')]);if(_0x421191&&_0x421191[_0xaf0f('0x70')]&&_0x421191[_0xaf0f('0x70')]!==_0xaf0f('0x71')){logger[_0xaf0f('0x1d')](_0xaf0f('0x72'),_0xaf0f('0x5f'));_0x4b8a44[_0xaf0f('0x60')]=util[_0xaf0f('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x299722[_0xaf0f('0x5c')],_0x4b8a44['uniqueid'],md5(_0x4b8a44[_0xaf0f('0x61')]));}return getConnection(_0x299722)[_0xaf0f('0x24')](function(_0x53d39d){_0x258dee=_0x53d39d;return getUser(_0x299722,_0x42a9a1[_0xaf0f('0x73')],_0x258dee);})[_0xaf0f('0x24')](function(_0x802f1c){_0x50aca2=_0x802f1c;return getEndUser(_0x299722,_0x461532,_0x4b8a44[_0xaf0f('0x74')],_0x4b8a44['destcalleridnum'],_0x258dee);})[_0xaf0f('0x24')](function(_0x446dee){_0x3f0b94=_0x446dee;return getTicket(_0x299722,_0x50aca2,_0x3f0b94,_0x461532,_0x4b8a44,_0x461532[_0xaf0f('0x75')],_0x258dee,_0xaf0f('0x6f'));})[_0xaf0f('0x24')](function(_0x1fdb5b){_0x467e69=_0x1fdb5b;logger[_0xaf0f('0x1d')](_0xaf0f('0x76'),_0x467e69['id']);logger[_0xaf0f('0x1d')](_0xaf0f('0x77'),_0x467e69['id'],_0x42a9a1[_0xaf0f('0x53')],_0x299722[_0xaf0f('0x3e')]);switch(_0x299722[_0xaf0f('0x3e')]){case'integrationTab':emit(util[_0xaf0f('0x45')]('user:%s',_0x42a9a1[_0xaf0f('0x53')]),_0xaf0f('0x78'),{'recordId':_0x467e69['id']});break;case'newTab':emit(util[_0xaf0f('0x45')](_0xaf0f('0x67'),_0x42a9a1[_0xaf0f('0x53')]),_0xaf0f('0x68'),{'uri':util[_0xaf0f('0x45')](_0xaf0f('0x69'),_0x258dee[_0xaf0f('0x6a')],_0x467e69['id'])});break;default:logger['error'](_0xaf0f('0x72'),_0xaf0f('0x79'));}})['catch'](function(_0x63ad6e){logger[_0xaf0f('0x6b')](_0xaf0f('0x72'),_0x63ad6e);});};exports[_0xaf0f('0x7a')]=function(_0x9d4925,_0x9368a7,_0x3d3bc0,_0x37791a,_0xf58a52,_0x550c6d){var _0x577045,_0x36da12,_0x48d111,_0x18416d;_0x550c6d[_0xaf0f('0x5c')]=intUtil[_0xaf0f('0x5d')](_0x550c6d[_0xaf0f('0x5c')]);_0x550c6d[_0xaf0f('0x56')]=intUtil[_0xaf0f('0x5d')](_0x550c6d[_0xaf0f('0x56')]);if(_0xf58a52&&_0xf58a52[_0xaf0f('0x5e')]){logger[_0xaf0f('0x1d')]('['+_0x9368a7['lastevent'][_0xaf0f('0x7b')]()+']',_0xaf0f('0x5f'));_0x9368a7[_0xaf0f('0x60')]=util[_0xaf0f('0x45')](_0xaf0f('0x7c'),_0x550c6d[_0xaf0f('0x5c')],_0x9368a7[_0xaf0f('0x61')],md5(_0x9368a7[_0xaf0f('0x61')]));}else{_0x9368a7[_0xaf0f('0x60')]='';}return getConnection(_0x550c6d)['then'](function(_0x539afd){_0x18416d=_0x539afd;if(!_[_0xaf0f('0x20')](_0x37791a)){return getUser(_0x550c6d,_0x37791a['name'],_0x18416d);}else{return getUser(_0x550c6d,null,_0x18416d);}})[_0xaf0f('0x24')](function(_0x3064ac){_0x577045=_0x3064ac;return getEndUser(_0x550c6d,_0x3d3bc0,_0x9368a7[_0xaf0f('0x62')],_0x9368a7[_0xaf0f('0x7d')],_0x18416d);})[_0xaf0f('0x24')](function(_0x1d094b){_0x36da12=_0x1d094b;return getTicket(_0x550c6d,_0x577045,_0x36da12,_0x3d3bc0,_0x9368a7,_0x3d3bc0[_0xaf0f('0x75')],_0x18416d);})[_0xaf0f('0x24')](function(_0x1d27f6){_0x48d111=_0x1d27f6;logger[_0xaf0f('0x1d')]('['+_0x9368a7[_0xaf0f('0x7e')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x48d111['id']);logger[_0xaf0f('0x1d')]('['+_0x9368a7['lastevent']['toUpperCase']()+_0xaf0f('0x7f'),_0x550c6d[_0xaf0f('0x3e')]);})[_0xaf0f('0x6d')](function(_0x3a8878){logger['error']('['+_0x9368a7[_0xaf0f('0x7e')][_0xaf0f('0x7b')]()+']',_0x3a8878);});}; \ No newline at end of file +var _0xd316=['display_name','then','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Company','No\x20Company','Name','Caller\x20-\x20%s','includes','string','idField','content','toString','variableName','customVariable','Variable','name','password','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','length','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity'];(function(_0x39032a,_0x147be5){var _0x25b409=function(_0x5005c3){while(--_0x5005c3){_0x39032a['push'](_0x39032a['shift']());}};_0x25b409(++_0x147be5);}(_0xd316,0x1c3));var _0x6d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd316[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x6d31('0x0'));var moment=require(_0x6d31('0x1'));var BPromise=require(_0x6d31('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x6d31('0x3'));var logger=require('../../../../config/logger')('salesforce');config[_0x6d31('0x4')]=_[_0x6d31('0x5')](config[_0x6d31('0x4')],{'host':_0x6d31('0x6'),'port':0x18eb});var io=require(_0x6d31('0x7'))(new Redis(config['redis']));function emit(_0x3ebc48,_0x31ad5e,_0x3a523e){io['to'](_0x3ebc48)[_0x6d31('0x8')](_0x31ad5e,_0x3a523e);}function getTicket(_0x2f809c,_0x2adcc6,_0x35b9df,_0x5a9391,_0x57f933,_0x579ff2,_0x170cee,_0x587a69){var _0x16d8e6=Object[_0x6d31('0x9')]({},{'OwnerId':_0x2adcc6['id'],'Subject':intUtil[_0x6d31('0xa')](_0x5a9391[_0x6d31('0xb')],_0x57f933,'\x20'),'Description':intUtil[_0x6d31('0xa')](_0x5a9391[_0x6d31('0xc')],_0x57f933,'\x0a')},getCustomFields(_0x579ff2,_0x57f933));if(_0x35b9df){if(_0x5a9391['ticketType']===_0x6d31('0xd')){_0x16d8e6[_0x6d31('0xe')]=moment[_0x6d31('0xf')]();_0x16d8e6['IsReminderSet']=![];_0x16d8e6[_0x6d31('0x10')]=![];if(_0x35b9df[_0x6d31('0x11')]===_0x6d31('0x12')||_0x35b9df[_0x6d31('0x11')]===_0x6d31('0x13')){_0x16d8e6[_0x6d31('0x14')]=_0x35b9df['id'];}else if(_0x35b9df[_0x6d31('0x11')]===_0x6d31('0x15')){_0x16d8e6[_0x6d31('0x16')]=_0x35b9df['id'];}}else if(_0x5a9391[_0x6d31('0x17')]==='Case'){if(_0x35b9df[_0x6d31('0x11')]===_0x6d31('0x12')){_0x16d8e6[_0x6d31('0x18')]=_0x35b9df['id'];}else if(_0x35b9df[_0x6d31('0x11')]===_0x6d31('0x15')){_0x16d8e6[_0x6d31('0x19')]=_0x35b9df['id'];}else if(_0x35b9df[_0x6d31('0x11')]==='lead'&&_0x5a9391[_0x6d31('0x1a')]){_0x16d8e6[_0x5a9391[_0x6d31('0x1a')]]=_0x35b9df['id'];}else{logger['info'](_0x6d31('0x1b'));}}}return _0x170cee[_0x6d31('0x1c')](_0x5a9391[_0x6d31('0x17')])[_0x6d31('0x1d')](_0x16d8e6);}function getUser(_0x530336,_0x50bbb4,_0x32aae2){if(!_[_0x6d31('0x1e')](_0x50bbb4)&&intUtil[_0x6d31('0x1f')](_0x50bbb4)){var _0x23dbb={'Email':_0x50bbb4};var _0x250a05={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x32aae2[_0x6d31('0x1c')](_0x6d31('0x20'))[_0x6d31('0x21')](_0x23dbb,_0x250a05)[_0x6d31('0x22')]()['then'](function(_0x5934ff){if(_0x5934ff[_0x6d31('0x23')]){var _0x599afd=_['find'](_0x5934ff,function(_0x52888c){return _0x52888c['Email']===_0x50bbb4;});if(_0x599afd){logger[_0x6d31('0x24')](_0x6d31('0x25'),_0x50bbb4);return BPromise[_0x6d31('0x26')]({'id':_0x599afd['Id'],'name':_0x599afd['Name']});}}else{logger[_0x6d31('0x24')](_0x6d31('0x27'),_0x50bbb4);return _0x32aae2[_0x6d31('0x28')]()['then'](function(_0x29a5d9){return BPromise['resolve']({'id':_0x29a5d9['user_id'],'name':_0x29a5d9[_0x6d31('0x29')]});});}});}else{logger[_0x6d31('0x24')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x50bbb4);return _0x32aae2[_0x6d31('0x28')]()[_0x6d31('0x2a')](function(_0x5af917){return BPromise['resolve']({'id':_0x5af917[_0x6d31('0x2b')],'name':_0x5af917[_0x6d31('0x29')]});});}}function getEndUser(_0x3f2faa,_0x16a3d0,_0x66d07d,_0x5561cf,_0x38c954){var _0x35d0a0={'$or':{'Phone':_0x5561cf}};var _0x39e2c5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x6d31('0x2a')](function(){logger[_0x6d31('0x24')](_0x6d31('0x2c'),_0x5561cf,_0x16a3d0['moduleSearch']);switch(_0x16a3d0[_0x6d31('0x2d')]){case _0x6d31('0x2e'):var _0x272ef8=_[_0x6d31('0x2f')](_0x35d0a0);if(_0x16a3d0[_0x6d31('0x30')]){var _0x4120b9={};_0x4120b9[_0x16a3d0[_0x6d31('0x30')]]=_0x5561cf;_[_0x6d31('0x31')](_0x272ef8[_0x6d31('0x32')],_0x4120b9);}return _0x38c954[_0x6d31('0x1c')]('Contact')[_0x6d31('0x21')](_0x272ef8,_0x39e2c5)[_0x6d31('0x22')]()[_0x6d31('0x2a')](function(_0xa6c3e9){if(_0xa6c3e9&&_0xa6c3e9[_0x6d31('0x23')]){return _0xa6c3e9;}else{var _0x4bd523=_[_0x6d31('0x2f')](_0x35d0a0);if(_0x16a3d0[_0x6d31('0x33')]){var _0x530d29={};_0x530d29[_0x16a3d0[_0x6d31('0x33')]]=_0x5561cf;_['merge'](_0x4bd523[_0x6d31('0x32')],_0x530d29);}return _0x38c954[_0x6d31('0x1c')]('Lead')[_0x6d31('0x21')](_0x4bd523,_0x39e2c5);}});case _0x6d31('0x34'):var _0x1fbe72=_[_0x6d31('0x2f')](_0x35d0a0);if(_0x16a3d0[_0x6d31('0x35')]){var _0x4120b9={};_0x4120b9[_0x16a3d0[_0x6d31('0x35')]]=_0x5561cf;_[_0x6d31('0x31')](_0x1fbe72['$or'],_0x4120b9);}return _0x38c954[_0x6d31('0x1c')]('Account')[_0x6d31('0x21')](_0x1fbe72,_0x39e2c5)[_0x6d31('0x22')]()[_0x6d31('0x2a')](function(_0x164d6b){if(_0x164d6b&&_0x164d6b[_0x6d31('0x23')]){return _0x164d6b;}else{var _0x12eac3=_[_0x6d31('0x2f')](_0x35d0a0);if(_0x16a3d0[_0x6d31('0x30')]){var _0x9f7dbf={};_0x9f7dbf[_0x16a3d0[_0x6d31('0x30')]]=_0x5561cf;_[_0x6d31('0x31')](_0x12eac3[_0x6d31('0x32')],_0x9f7dbf);}return _0x38c954[_0x6d31('0x1c')]('Contact')[_0x6d31('0x21')](_0x12eac3,_0x39e2c5)[_0x6d31('0x2a')](function(_0x550174){if(_0x550174&&_0x550174[_0x6d31('0x23')]){return _0x550174;}else{var _0x2e7ff1=_[_0x6d31('0x2f')](_0x35d0a0);if(_0x16a3d0[_0x6d31('0x33')]){var _0x308b94={};_0x308b94[_0x16a3d0['additionalSearchLead']]=_0x5561cf;_['merge'](_0x2e7ff1['$or'],_0x308b94);}return _0x38c954[_0x6d31('0x1c')]('Lead')[_0x6d31('0x21')](_0x2e7ff1,_0x39e2c5);}});}});case _0x6d31('0x12'):var _0x272ef8=_[_0x6d31('0x2f')](_0x35d0a0);if(_0x16a3d0[_0x6d31('0x30')]){var _0x4120b9={};_0x4120b9[_0x16a3d0[_0x6d31('0x30')]]=_0x5561cf;_[_0x6d31('0x31')](_0x272ef8['$or'],_0x4120b9);}return _0x38c954['sobject']('Contact')[_0x6d31('0x21')](_0x272ef8,_0x39e2c5)[_0x6d31('0x22')]();case'lead':var _0x35bf66=_[_0x6d31('0x2f')](_0x35d0a0);if(_0x16a3d0['additionalSearchLead']){var _0x4120b9={};_0x4120b9[_0x16a3d0[_0x6d31('0x33')]]=_0x5561cf;_[_0x6d31('0x31')](_0x35bf66['$or'],_0x4120b9);}return _0x38c954[_0x6d31('0x1c')]('Lead')[_0x6d31('0x21')](_0x35bf66,_0x39e2c5);case'account':var _0x1fbe72=_[_0x6d31('0x2f')](_0x35d0a0);if(_0x16a3d0[_0x6d31('0x35')]){var _0x4120b9={};_0x4120b9[_0x16a3d0[_0x6d31('0x35')]]=_0x5561cf;_['merge'](_0x1fbe72[_0x6d31('0x32')],_0x4120b9);}return _0x38c954[_0x6d31('0x1c')](_0x6d31('0x36'))['find'](_0x1fbe72,_0x39e2c5);default:return null;}})[_0x6d31('0x2a')](function(_0x2d7b23){if(_0x2d7b23&&_0x2d7b23[_0x6d31('0x23')]){var _0x3a0e57=_[_0x6d31('0x37')](_0x2d7b23);if(_0x3a0e57){return BPromise['resolve']({'id':_0x3a0e57['Id'],'name':_0x3a0e57['Name'],'phone':_0x3a0e57[_0x6d31('0x38')],'endUserType':_0x3a0e57[_0x6d31('0x39')][_0x6d31('0x3a')][_0x6d31('0x3b')]()});}}})[_0x6d31('0x2a')](function(_0x3f8675){if(_0x3f8675){logger[_0x6d31('0x24')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3f8675['endUserType'],_0x5561cf);return BPromise['resolve'](_0x3f8675);}else{logger['info'](_0x6d31('0x3c'),_0x5561cf);var _0xdc4de8={'Phone':_0x5561cf};if(_0x16a3d0[_0x6d31('0x3d')]){if(_0x16a3d0[_0x6d31('0x3d')]==='contact'){logger[_0x6d31('0x24')](_0x6d31('0x3e'),_0x5561cf,_0x16a3d0[_0x6d31('0x3d')]);_0xdc4de8[_0x6d31('0x3f')]=_0x66d07d!==_0x6d31('0x40')?_0x66d07d:util[_0x6d31('0x41')]('Caller\x20-\x20%s',_0x5561cf);}else if(_0x16a3d0[_0x6d31('0x3d')]==='lead'){logger[_0x6d31('0x24')](_0x6d31('0x3e'),_0x5561cf,_0x16a3d0[_0x6d31('0x3d')]);_0xdc4de8[_0x6d31('0x3f')]=_0x66d07d!==_0x6d31('0x40')?_0x66d07d:util['format']('Caller\x20-\x20%s',_0x5561cf);_0xdc4de8[_0x6d31('0x42')]=_0x6d31('0x43');}else if(_0x16a3d0[_0x6d31('0x3d')]===_0x6d31('0x15')){logger[_0x6d31('0x24')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5561cf,_0x16a3d0['moduleCreate']);_0xdc4de8[_0x6d31('0x44')]=_0x66d07d!==_0x6d31('0x40')?_0x66d07d:util[_0x6d31('0x41')](_0x6d31('0x45'),_0x5561cf);}else{return null;}}return _0x38c954[_0x6d31('0x1c')](_['upperFirst'](_0x16a3d0[_0x6d31('0x3d')]))[_0x6d31('0x1d')](_0xdc4de8)[_0x6d31('0x2a')](function(_0x435162){return BPromise[_0x6d31('0x26')]({'id':_0x435162['id'],'endUserType':_0x16a3d0['moduleCreate']});});}});}function getCustomFields(_0x4a8b33,_0x2a7852){var _0xf7e067={};if(_0x4a8b33['length']>0x0){_['forEach'](_0x4a8b33,function(_0x51faa4){if(_[_0x6d31('0x46')]([_0x6d31('0x47'),'picklist'],_0x51faa4['type'])&&_0x51faa4[_0x6d31('0x48')]){_0xf7e067[_0x51faa4['idField']]=_0x51faa4[_0x6d31('0x49')][_0x6d31('0x4a')]();}else if(_0x51faa4[_0x6d31('0x3a')]==='variable'&&_0x51faa4[_0x6d31('0x4b')]&&_0x51faa4[_0x6d31('0x48')]){_0x2a7852[_0x51faa4[_0x6d31('0x4b')]]&&(_0xf7e067[_0x51faa4['idField']]=_0x2a7852[_0x51faa4['variableName']][_0x6d31('0x4a')]());}else if(_0x51faa4[_0x6d31('0x3a')]===_0x6d31('0x4c')&&_0x51faa4[_0x6d31('0x4d')]&&_0x51faa4[_0x6d31('0x4d')][_0x6d31('0x4e')]&&_0x51faa4[_0x6d31('0x48')]){_0x2a7852[_0x51faa4[_0x6d31('0x4d')]['name'][_0x6d31('0x3b')]()]&&(_0xf7e067[_0x51faa4[_0x6d31('0x48')]]=_0x2a7852[_0x51faa4['Variable'][_0x6d31('0x4e')]['toLowerCase']()]['toString']());}});}return _0xf7e067;}function getConnection(_0x18715e){var _0x42a593=_0x18715e[_0x6d31('0x4f')]['concat'](_0x18715e['securityToken']);var _0x55029a=new jsforce[(_0x6d31('0x50'))]({'oauth2':{'loginUrl':_0x18715e[_0x6d31('0x51')]||_0x6d31('0x52'),'clientId':_0x18715e['clientId'],'clientSecret':_0x18715e[_0x6d31('0x53')]}});return _0x55029a[_0x6d31('0x54')](_0x18715e[_0x6d31('0x55')],_0x42a593)['then'](function(){logger['info'](_0x6d31('0x56'));return _0x55029a;});}exports[_0x6d31('0x57')]=function(_0x21f8bd,_0x2d55bb,_0x10724a,_0x340583,_0x46298b,_0xd7978b){var _0x3ba50d,_0x34e34b,_0x200730,_0x3236c4;_0xd7978b[_0x6d31('0x58')]=intUtil['stripTrailingSlash'](_0xd7978b['serverUrl']);_0xd7978b['remoteUri']=intUtil[_0x6d31('0x59')](_0xd7978b[_0x6d31('0x51')]);if(_0x46298b&&_0x46298b[_0x6d31('0x5a')]){logger[_0x6d31('0x24')]('[QUEUE]',_0x6d31('0x5b'));_0x2d55bb[_0x6d31('0x5c')]=util[_0x6d31('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd7978b[_0x6d31('0x58')],_0x2d55bb[_0x6d31('0x5d')],md5(_0x2d55bb[_0x6d31('0x5d')]));}else{_0x2d55bb[_0x6d31('0x5c')]='';}return getConnection(_0xd7978b)['then'](function(_0x271baf){_0x3236c4=_0x271baf;return getUser(_0xd7978b,_0x340583['email'],_0x3236c4);})[_0x6d31('0x2a')](function(_0x198395){_0x3ba50d=_0x198395;return getEndUser(_0xd7978b,_0x10724a,_0x2d55bb[_0x6d31('0x5e')],_0x2d55bb[_0x6d31('0x5f')],_0x3236c4);})[_0x6d31('0x2a')](function(_0x1ad2fd){_0x34e34b=_0x1ad2fd;return getTicket(_0xd7978b,_0x3ba50d,_0x34e34b,_0x10724a,_0x2d55bb,_0x10724a['Fields'],_0x3236c4,_0x6d31('0x57'));})[_0x6d31('0x2a')](function(_0x20f1a3){_0x200730=_0x20f1a3;logger['info'](_0x6d31('0x60'),_0x200730['id']);logger['info'](_0x6d31('0x61'),_0x200730['id'],_0x340583[_0x6d31('0x4e')],_0xd7978b[_0x6d31('0x3a')]);switch(_0xd7978b[_0x6d31('0x3a')]){case _0x6d31('0x62'):emit(util[_0x6d31('0x41')](_0x6d31('0x63'),_0x340583[_0x6d31('0x4e')]),_0x6d31('0x64'),{'recordId':_0x200730['id']});break;case'newTab':emit(util[_0x6d31('0x41')](_0x6d31('0x63'),_0x340583[_0x6d31('0x4e')]),_0x6d31('0x65'),{'uri':util[_0x6d31('0x41')](_0x6d31('0x66'),_0x3236c4[_0x6d31('0x67')],_0x200730['id'])});break;default:logger[_0x6d31('0x68')](_0x6d31('0x69'));}})[_0x6d31('0x6a')](function(_0x302ce9){logger['error']('[QUEUE]',_0x302ce9);});};exports[_0x6d31('0x6b')]=function(_0x28fac3,_0x1693a5,_0x39a6ea,_0xb08269,_0x1215a0,_0x2147d3,_0x5e136b){var _0x5206a6,_0x5867b5,_0x3f9ae5,_0x3f749e;_0x2147d3[_0x6d31('0x58')]=intUtil[_0x6d31('0x59')](_0x2147d3[_0x6d31('0x58')]);_0x2147d3[_0x6d31('0x51')]=intUtil[_0x6d31('0x59')](_0x2147d3[_0x6d31('0x51')]);if(_0x5e136b&&_0x5e136b[_0x6d31('0x6c')]&&_0x5e136b[_0x6d31('0x6c')]!==_0x6d31('0x6d')){logger[_0x6d31('0x24')](_0x6d31('0x6e'),'Recording\x20is\x20enabled!');_0x1693a5['recordingURL']=util[_0x6d31('0x41')](_0x6d31('0x6f'),_0x2147d3[_0x6d31('0x58')],_0x1693a5['uniqueid'],md5(_0x1693a5[_0x6d31('0x5d')]));}return getConnection(_0x2147d3)[_0x6d31('0x2a')](function(_0x252bb3){_0x3f749e=_0x252bb3;return getUser(_0x2147d3,_0xb08269[_0x6d31('0x70')],_0x3f749e);})[_0x6d31('0x2a')](function(_0x356b76){_0x5206a6=_0x356b76;return getEndUser(_0x2147d3,_0x39a6ea,_0x1693a5[_0x6d31('0x71')],_0x1693a5[_0x6d31('0x72')],_0x3f749e);})['then'](function(_0x7a3f59){_0x5867b5=_0x7a3f59;return getTicket(_0x2147d3,_0x5206a6,_0x5867b5,_0x39a6ea,_0x1693a5,_0x39a6ea[_0x6d31('0x73')],_0x3f749e,_0x6d31('0x6b'));})[_0x6d31('0x2a')](function(_0x574a81){_0x3f9ae5=_0x574a81;logger[_0x6d31('0x24')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3f9ae5['id']);logger['info'](_0x6d31('0x74'),_0x3f9ae5['id'],_0xb08269[_0x6d31('0x4e')],_0x2147d3[_0x6d31('0x3a')]);switch(_0x2147d3['type']){case _0x6d31('0x62'):emit(util[_0x6d31('0x41')]('user:%s',_0xb08269[_0x6d31('0x4e')]),_0x6d31('0x64'),{'recordId':_0x3f9ae5['id']});break;case _0x6d31('0x75'):emit(util[_0x6d31('0x41')](_0x6d31('0x63'),_0xb08269[_0x6d31('0x4e')]),'trigger:browser:url',{'uri':util[_0x6d31('0x41')]('%s/%s/e',_0x3f749e[_0x6d31('0x67')],_0x3f9ae5['id'])});break;default:logger['error'](_0x6d31('0x6e'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x4f18d3){logger[_0x6d31('0x68')]('[OUTBOUND]',_0x4f18d3);});};exports[_0x6d31('0x76')]=function(_0x54dc60,_0x1d95e5,_0x582197,_0x35b290,_0x414919,_0x8ad81c){var _0x457cbc,_0x4fcee3,_0x5dd5e2,_0x515a8e;_0x8ad81c[_0x6d31('0x58')]=intUtil['stripTrailingSlash'](_0x8ad81c[_0x6d31('0x58')]);_0x8ad81c['remoteUri']=intUtil['stripTrailingSlash'](_0x8ad81c[_0x6d31('0x51')]);if(_0x414919&&_0x414919[_0x6d31('0x5a')]){logger['info']('['+_0x1d95e5[_0x6d31('0x77')][_0x6d31('0x78')]()+']',_0x6d31('0x5b'));_0x1d95e5[_0x6d31('0x5c')]=util[_0x6d31('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8ad81c['serverUrl'],_0x1d95e5[_0x6d31('0x5d')],md5(_0x1d95e5[_0x6d31('0x5d')]));}else{_0x1d95e5[_0x6d31('0x5c')]='';}return getConnection(_0x8ad81c)[_0x6d31('0x2a')](function(_0x20f534){_0x515a8e=_0x20f534;if(!_[_0x6d31('0x1e')](_0x35b290)){return getUser(_0x8ad81c,_0x35b290[_0x6d31('0x4e')],_0x515a8e);}else{return getUser(_0x8ad81c,null,_0x515a8e);}})[_0x6d31('0x2a')](function(_0x531db){_0x457cbc=_0x531db;return getEndUser(_0x8ad81c,_0x582197,_0x1d95e5[_0x6d31('0x5e')],_0x1d95e5[_0x6d31('0x5f')],_0x515a8e);})[_0x6d31('0x2a')](function(_0x3b67b7){_0x4fcee3=_0x3b67b7;return getTicket(_0x8ad81c,_0x457cbc,_0x4fcee3,_0x582197,_0x1d95e5,_0x582197[_0x6d31('0x73')],_0x515a8e);})[_0x6d31('0x2a')](function(_0x2a0160){_0x5dd5e2=_0x2a0160;logger['info']('['+_0x1d95e5[_0x6d31('0x77')]['toUpperCase']()+_0x6d31('0x79'),_0x5dd5e2['id']);logger['info']('['+_0x1d95e5[_0x6d31('0x77')][_0x6d31('0x78')]()+_0x6d31('0x7a'),_0x8ad81c[_0x6d31('0x3a')]);})[_0x6d31('0x6a')](function(_0x13a378){logger[_0x6d31('0x68')]('['+_0x1d95e5[_0x6d31('0x77')]['toUpperCase']()+']',_0x13a378);});}; \ 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 2f392e0..a112f04 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 _0x36d8=['%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map'];(function(_0x304bb4,_0x561f9f){var _0x53302e=function(_0x2e2382){while(--_0x2e2382){_0x304bb4['push'](_0x304bb4['shift']());}};_0x53302e(++_0x561f9f);}(_0x36d8,0x1d2));var _0x836d=function(_0x215294,_0x517e94){_0x215294=_0x215294-0x0;var _0x13de21=_0x36d8[_0x215294];return _0x13de21;};'use strict';var _=require(_0x836d('0x0'));var Promise=require(_0x836d('0x1'));var rp=require(_0x836d('0x2'));var util=require('util');var md5=require(_0x836d('0x3'));var Redis=require(_0x836d('0x4'));var intUtil=require(_0x836d('0x5'));var config=require('../../../../config/environment');var logger=require(_0x836d('0x6'))(_0x836d('0x7'));config[_0x836d('0x8')]=_[_0x836d('0x9')](config[_0x836d('0x8')],{'host':_0x836d('0xa'),'port':0x18eb});var io=require(_0x836d('0xb'))(new Redis(config['redis']));function getAdminUser(_0x2b3971,_0x400c0e,_0x44860b,_0x221bef,_0x119bee,_0x4b9127){return new Promise(function(_0x4ff783,_0x4dc78e){var _0x9baa93={'method':_0x836d('0xc'),'uri':_0x221bef+_0x836d('0xd')+'&'+_0x119bee+'&'+_0x4b9127,'auth':_0x400c0e,'json':!![]};return rp(_0x9baa93)['then'](function(_0x3e0a74){if(_0x3e0a74[_0x836d('0xe')][_0x836d('0xf')]>0x0){_0x44860b[_0x836d('0x10')]=_0x3e0a74[_0x836d('0xe')][0x0][_0x836d('0x11')];}logger[_0x836d('0x12')]('['+[_0x2b3971[_0x836d('0x13')]()]+_0x836d('0x14'),_0x44860b);_0x4ff783(_0x44860b);})['catch'](function(_0x2a4c14){logger[_0x836d('0x15')]('['+[_0x2b3971['toUpperCase']()]+']',_0x2a4c14[_0x836d('0x16')]);_0x4dc78e(_0x2a4c14[_0x836d('0x16')]);});});}function getUser(_0x167b5b,_0x18eaa6,_0x879e2a,_0x64a80c,_0x42929e){return function(_0x5d12e3){logger[_0x836d('0x12')]('['+[_0x167b5b[_0x836d('0x13')]()]+_0x836d('0x17'),_0x5d12e3);return new Promise(function(_0x557a5b,_0x515933){if(intUtil['validateEmail'](_0x5d12e3[_0x836d('0x18')])){var _0x33406e={'method':'GET','uri':_0x879e2a+_0x836d('0x19')+_0x5d12e3[_0x836d('0x18')]+'&'+_0x64a80c+'&'+_0x42929e,'auth':_0x18eaa6,'json':!![]};logger[_0x836d('0x12')]('['+[_0x167b5b[_0x836d('0x13')]()]+_0x836d('0x1a'),_0x33406e);return rp(_0x33406e)['then'](function(_0x210193){logger[_0x836d('0x12')]('['+[_0x167b5b[_0x836d('0x13')]()]+'],\x20getUser\x20entity',_0x210193);if(_0x210193[_0x836d('0xe')]['length']>0x0&&String(_0x210193[_0x836d('0xe')][0x0]['active'])===_0x836d('0x1b')){_0x5d12e3[_0x836d('0x1c')]=_0x210193[_0x836d('0xe')][0x0]['sys_id'];}else{_0x5d12e3[_0x836d('0x1c')]=_0x5d12e3[_0x836d('0x10')];_0x5d12e3[_0x836d('0x18')]=_0x5d12e3['adminEmail'];}logger[_0x836d('0x12')]('['+[_0x167b5b[_0x836d('0x13')]()]+_0x836d('0x1d'),_0x5d12e3);_0x557a5b(_0x5d12e3);})[_0x836d('0x1e')](function(_0x2901fa){logger[_0x836d('0x15')]('['+[_0x167b5b[_0x836d('0x13')]()]+']',_0x2901fa[_0x836d('0x16')]);_0x515933(_0x2901fa[_0x836d('0x16')]);});}else{logger[_0x836d('0x12')]('['+[_0x167b5b['toUpperCase']()]+_0x836d('0x1f'));_0x5d12e3[_0x836d('0x1c')]=_0x5d12e3['adminId'];_0x5d12e3[_0x836d('0x18')]=_0x5d12e3[_0x836d('0x20')];_0x557a5b(_0x5d12e3);}});};}function createEndUser(_0x145d4a,_0x58ab40,_0x118ab4,_0x3897c8,_0xeed533){logger[_0x836d('0x12')]('['+[_0x145d4a[_0x836d('0x13')]()]+_0x836d('0x21'),_0x118ab4);return new Promise(function(_0x18cc60,_0x55ab9a){var _0x595c4c={'method':_0x836d('0x22'),'uri':_0x3897c8+_0x836d('0x23')+_0xeed533,'body':{'user_name':_0x118ab4[_0x836d('0x24')],'roles':_0x836d('0x25'),'first_name':_0x118ab4['endUserNumber'],'active':_0x836d('0x1b'),'date_format':'System','phone':_0x118ab4[_0x836d('0x24')]},'auth':_0x58ab40,'json':!![]};return rp(_0x595c4c)[_0x836d('0x26')](function(_0x2cea0a){logger[_0x836d('0x12')]('['+[_0x145d4a['toUpperCase']()]+_0x836d('0x27'),_0x2cea0a[_0x836d('0xe')]);_0x118ab4[_0x836d('0x28')]=_0x2cea0a['result'][_0x836d('0x11')];_0x18cc60(_0x118ab4);})[_0x836d('0x1e')](function(_0x1c6540){logger[_0x836d('0x15')]('['+[_0x145d4a[_0x836d('0x13')]()]+']',_0x1c6540['message']);_0x55ab9a(_0x1c6540[_0x836d('0x16')]);});});}function getEndUser(_0x4c46bc,_0x38c77f,_0x56c52c,_0x3c4cb1,_0x11b5b4){return function(_0x586a32){logger['info']('['+[_0x4c46bc[_0x836d('0x13')]()]+_0x836d('0x29'),_0x586a32);return new Promise(function(_0x296c14,_0x41439f){var _0x13d54b={'method':_0x836d('0xc'),'uri':_0x56c52c+'sys_user?sysparm_query=phone%3D'+_0x586a32[_0x836d('0x24')]+'&'+_0x3c4cb1+'&'+_0x11b5b4,'auth':_0x38c77f,'json':!![]};return rp(_0x13d54b)[_0x836d('0x26')](function(_0x2a7aa0){if(_0x2a7aa0[_0x836d('0xe')][_0x836d('0xf')]>0x0){_0x586a32[_0x836d('0x28')]=_0x2a7aa0[_0x836d('0xe')][0x0][_0x836d('0x11')];logger['info']('['+[_0x4c46bc[_0x836d('0x13')]()]+_0x836d('0x2a'),_0x586a32);_0x296c14(_0x586a32);}else{return createEndUser(_0x4c46bc,_0x38c77f,_0x586a32,_0x56c52c,_0x3c4cb1)[_0x836d('0x26')](function(_0xb50f4e){logger[_0x836d('0x12')]('['+[_0x4c46bc[_0x836d('0x13')]()]+'],\x20createEndUser\x20crm',_0xb50f4e);_0x296c14(_0xb50f4e);});}})[_0x836d('0x1e')](function(_0x525137){logger['error']('['+[_0x4c46bc[_0x836d('0x13')]()]+']',_0x525137[_0x836d('0x16')]);_0x41439f(_0x525137[_0x836d('0x16')]);});});};}function getCustomFields(_0x666c7d,_0x50f6b1){var _0x259f13={};if(_0x666c7d[_0x836d('0xf')]>0x0){_[_0x836d('0x2b')](_0x666c7d,function(_0xdf891d){if(_[_0x836d('0x2c')]([_0x836d('0x2d'),_0x836d('0x2e')],_0xdf891d[_0x836d('0x2f')])&&_0xdf891d[_0x836d('0x30')]&&!_0xdf891d[_0x836d('0x31')]){_0x259f13[_0xdf891d[_0x836d('0x30')][_0x836d('0x32')]()]=_0xdf891d[_0x836d('0x33')]['toString']();}else if(_[_0x836d('0x2c')]([_0x836d('0x2d'),_0x836d('0x2e')],_0xdf891d[_0x836d('0x2f')])&&_0xdf891d['idField']&&_0xdf891d['customField']){_0x259f13[_0xdf891d[_0x836d('0x34')][_0x836d('0x32')]()]=_0xdf891d[_0x836d('0x33')][_0x836d('0x35')]();}else if(_0xdf891d[_0x836d('0x2f')]===_0x836d('0x36')&&_0xdf891d[_0x836d('0x37')]&&_0xdf891d['idField']&&_0xdf891d[_0x836d('0x31')]){_0x259f13[_0xdf891d['idField']['toLowerCase']()]=_0x50f6b1[_0xdf891d[_0x836d('0x37')]][_0x836d('0x35')]();}else if(_0xdf891d['type']===_0x836d('0x38')&&_0xdf891d[_0x836d('0x39')]&&_0xdf891d[_0x836d('0x39')][_0x836d('0x3a')]&&_0xdf891d[_0x836d('0x34')]&&_0xdf891d[_0x836d('0x31')]){_0x259f13[_0xdf891d[_0x836d('0x34')][_0x836d('0x32')]()]=_0x50f6b1[_0xdf891d['Variable']['name'][_0x836d('0x32')]()][_0x836d('0x35')]();}});}return _0x259f13;}function getTicket(_0x3278d0,_0x1a8c94,_0x1b1c3f,_0x3c3bf6,_0x50aa31,_0x31cca6){return function(_0x25e982){logger[_0x836d('0x12')]('['+[_0x3278d0[_0x836d('0x13')]()]+_0x836d('0x3b'),_0x25e982);return new Promise(function(_0x5e58cf,_0x34a201){var _0x593f8c=_0x3278d0[_0x836d('0x32')]()===_0x836d('0x3c')?_0x25e982[_0x836d('0x1c')]:_0x25e982[_0x836d('0x28')];var _0x912585={'method':_0x836d('0x22'),'uri':_0x1b1c3f+'incident'+'?'+_0x31cca6,'body':Object[_0x836d('0x3d')]({},{'active':_0x836d('0x1b'),'caller_id':_0x593f8c,'assigned_to':_0x25e982[_0x836d('0x1c')],'short_description':intUtil[_0x836d('0x3e')](_0x3c3bf6[_0x836d('0x3f')],_0x50aa31,'\x20'),'description':intUtil[_0x836d('0x3e')](_0x3c3bf6[_0x836d('0x40')],_0x50aa31,'\x0a')},getCustomFields(_0x3c3bf6['Fields'],_0x50aa31)),'auth':_0x1a8c94,'json':!![]};return rp(_0x912585)[_0x836d('0x26')](function(_0x4169e1){logger['info']('['+[_0x3278d0[_0x836d('0x13')]()]+_0x836d('0x41'),_0x4169e1[_0x836d('0xe')]);_0x25e982[_0x836d('0x42')]=_0x4169e1['result'][_0x836d('0x11')];_0x25e982[_0x836d('0x43')]=_0x4169e1[_0x836d('0xe')][_0x836d('0x44')];logger[_0x836d('0x12')]('['+[_0x3278d0['toUpperCase']()]+']\x20getTicket\x20crm',_0x25e982);_0x5e58cf(_0x25e982);})[_0x836d('0x1e')](function(_0x462883){logger['error']('['+[_0x3278d0[_0x836d('0x13')]()]+']',_0x462883[_0x836d('0x16')]);_0x34a201(_0x462883[_0x836d('0x16')]);});});};}function createRemoteTag(_0x5b8756,_0x440f50,_0x5542bc,_0x34134d){return new Promise(function(_0x346cc5,_0x235e39){var _0x41dc70={'method':_0x836d('0x22'),'uri':_0x5542bc+_0x836d('0x45')+'?'+_0x34134d,'body':{'short_description':_0x5b8756,'global':!![],'active':!![],'name':_0x5b8756},'auth':_0x440f50,'json':!![]};return rp(_0x41dc70)[_0x836d('0x26')](function(_0xdd4b1f){var _0x4b05c4=_0xdd4b1f[_0x836d('0xe')][_0x836d('0x11')];_0x346cc5(_0x4b05c4);});});}function getRemoteTag(_0x51394e,_0x588bc0,_0x301eb2,_0x42dc0f,_0x382127){return new Promise(function(_0x107471,_0x44ace5){var _0x207bdf={'method':_0x836d('0xc'),'uri':_0x301eb2+'label'+_0x836d('0x46')+_0x51394e+'&'+_0x42dc0f,'auth':_0x588bc0,'json':!![]};return rp(_0x207bdf)[_0x836d('0x26')](function(_0x5d8bf7){if(_0x5d8bf7[_0x836d('0xe')][_0x836d('0xf')]>0x0){var _0x37a6d4=_0x5d8bf7[_0x836d('0xe')][0x0][_0x836d('0x11')];_0x107471(_0x37a6d4);}else{return createRemoteTag(_0x51394e,_0x588bc0,_0x301eb2,_0x42dc0f)[_0x836d('0x26')](function(_0x9104f1){_0x107471(_0x9104f1);});}});});}function assignTagToIncident(_0x4bd2d6,_0x4db2ed,_0x453948,_0x4a6356,_0x242c4f){return new Promise(function(_0x376f12,_0x18d46f){var _0x1d9922={'method':_0x836d('0x22'),'uri':_0x453948+_0x836d('0x47')+'?'+_0x242c4f,'body':{'label':_0x4bd2d6,'table':_0x836d('0x48'),'id_type':_0x836d('0x49'),'table_key':_0x4a6356['ticketId'],'title':_0x836d('0x4a')+_0x4a6356['ticketNumber'],'id_display':_0x4a6356[_0x836d('0x43')]},'auth':_0x4db2ed,'json':!![]};return rp(_0x1d9922)[_0x836d('0x26')](function(_0x2c90af){_0x376f12();})[_0x836d('0x1e')](function(){_0x376f12();});});}function manageTags(_0x2690b0,_0x575f0e,_0xc5f27e,_0x25c366,_0x281692,_0xdc70c5,_0xcc034){return new Promise(function(_0x10cbb0,_0x54a472){var _0x3e7322=[];_0x575f0e['forEach'](function(_0x3c82e7){_0x3e7322[_0x836d('0x4b')](getRemoteTag(_0x3c82e7,_0xc5f27e,_0x25c366,_0xdc70c5,_0xcc034));});return Promise['all'](_0x3e7322)['then'](function(_0x339291){if(_0x339291['length']){logger[_0x836d('0x12')]('['+[_0x2690b0[_0x836d('0x13')]()]+_0x836d('0x4c'),_0x339291);var _0x12357f=[];_0x339291[_0x836d('0x2b')](function(_0x41af67){_0x12357f[_0x836d('0x4b')](assignTagToIncident(_0x41af67,_0xc5f27e,_0x25c366,_0x281692,_0xdc70c5));});return Promise['all'](_0x12357f)[_0x836d('0x26')](function(){_0x10cbb0();})['catch'](function(){_0x10cbb0();});}else{_0x10cbb0();}});});}function getTags(_0x2e8486,_0x113a33,_0x15c540,_0x16e6b6,_0x316cab,_0x4f6ab6){return function(_0x359862){return new Promise(function(_0x2008a1,_0x133300){var _0x2a8cac=[];var _0x275c69=_0x16e6b6[_0x836d('0x4d')];if(_0x275c69&&_0x275c69[_0x836d('0xf')]>0x0){_0x2a8cac=_[_0x836d('0x4e')](_0x275c69,_0x836d('0x3a'));}if(_0x2a8cac[_0x836d('0xf')]>0x0){return manageTags(_0x2e8486,_0x2a8cac,_0x113a33,_0x15c540,_0x359862,_0x316cab,_0x4f6ab6)[_0x836d('0x26')](function(){_0x2008a1(_0x359862);});}else{_0x2008a1(_0x359862);}});};}function emit(_0x4f7782,_0x30ea3b,_0x314cb4){var _0x45c882=_0x836d('0x4f')+_0x836d('0x50')+_0x836d('0x51')+_0x836d('0x52');var _0x5108a2={'uri':_0x4f7782+_0x836d('0x53')+_0x314cb4+_0x45c882};io['to'](util['format']('user:%s',_0x30ea3b))[_0x836d('0x54')]('trigger:browser:url',_0x5108a2);}exports['cs']=function(_0xa91ab1,_0x4f8536,_0x56c2ad,_0xb5ae3e,_0xbe457e,_0x70cc3b,_0x3bfac5,_0x11b068){var _0x485ef9={};var _0xb230ee={'user':_0x70cc3b['username'],'pass':_0x70cc3b[_0x836d('0x55')]};var _0xf2b972='sysparm_limit=1';var _0x1906f0=_0x836d('0x56');_0x70cc3b[_0x836d('0x57')]=intUtil[_0x836d('0x58')](_0x70cc3b[_0x836d('0x57')]);_0x70cc3b[_0x836d('0x59')]=intUtil[_0x836d('0x58')](_0x70cc3b[_0x836d('0x59')]);var _0x4d4092=util[_0x836d('0x5a')](_0x836d('0x5b'),_0x70cc3b[_0x836d('0x57')]);_0x485ef9['userEmail']=!_[_0x836d('0x5c')](_0xb5ae3e)?_0xb5ae3e['email']:null;_0x485ef9['adminEmail']=_0x70cc3b['email'];_0x485ef9[_0x836d('0x24')]=_0x11b068['toLowerCase']()===_0x836d('0x3c')?_0x4f8536[_0x836d('0x5d')]:_0x4f8536['calleridnum'];_0x485ef9[_0x836d('0x5e')]=_0x11b068===_0x836d('0x5f')||_0x11b068===_0x836d('0x60')?'queue':_0x836d('0x3c');var _0x28b03e=util[_0x836d('0x5a')](_0x836d('0x61'),_0x70cc3b[_0x836d('0x59')],_0x4f8536[_0x836d('0x62')],md5(_0x4f8536[_0x836d('0x62')]));if(_0xbe457e&&_0xbe457e[_0x836d('0x63')]){logger[_0x836d('0x12')]('[QUEUE]',_0x836d('0x64'));_0x4f8536[_0x836d('0x65')]=_0x28b03e;}else if(_0x3bfac5&&_0x3bfac5[_0x836d('0x66')]&&_0x3bfac5[_0x836d('0x66')]!==_0x836d('0x67')){logger[_0x836d('0x12')](_0x836d('0x68'),_0x836d('0x64'));_0x4f8536[_0x836d('0x65')]=_0x28b03e;}else{_0x4f8536[_0x836d('0x65')]='';}return getAdminUser(_0x11b068,_0xb230ee,_0x485ef9,_0x4d4092,_0x1906f0,_0xf2b972)[_0x836d('0x26')](getUser(_0x11b068,_0xb230ee,_0x4d4092,_0x1906f0,_0xf2b972))[_0x836d('0x26')](getEndUser(_0x11b068,_0xb230ee,_0x4d4092,_0x1906f0,_0xf2b972))[_0x836d('0x26')](getTicket(_0x11b068,_0xb230ee,_0x4d4092,_0x56c2ad,_0x4f8536,_0x1906f0))['then'](function(_0x5be811){logger[_0x836d('0x12')](util[_0x836d('0x5a')](_0x836d('0x69'),_0x5be811['ticketId']));logger[_0x836d('0x12')](util[_0x836d('0x5a')](_0x836d('0x6a'),_0x11b068));if(_0x11b068!=='unmanaged'){logger['info']('['+[_0x11b068[_0x836d('0x13')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x70cc3b[_0x836d('0x57')],_0xb5ae3e[_0x836d('0x3a')],_0x5be811['ticketId']);}})[_0x836d('0x1e')](function(_0x4d8f7e){logger[_0x836d('0x15')]('['+[_0x11b068['toUpperCase']()]+_0x836d('0x6b'),util[_0x836d('0x6c')](_0x4d8f7e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5555=['Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','label_entry','Incident','all','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','result','sys_id','info','error','toUpperCase','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','toString','string','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x2462ef,_0x10fef3){var _0x448d77=function(_0x1a5fbc){while(--_0x1a5fbc){_0x2462ef['push'](_0x2462ef['shift']());}};_0x448d77(++_0x10fef3);}(_0x5555,0x1e8));var _0x5555=function(_0x14058e,_0x25c44d){_0x14058e=_0x14058e-0x0;var _0x105762=_0x5555[_0x14058e];return _0x105762;};'use strict';var _=require(_0x5555('0x0'));var Promise=require(_0x5555('0x1'));var rp=require('request-promise');var util=require(_0x5555('0x2'));var md5=require(_0x5555('0x3'));var Redis=require(_0x5555('0x4'));var intUtil=require(_0x5555('0x5'));var config=require(_0x5555('0x6'));var logger=require(_0x5555('0x7'))(_0x5555('0x8'));config[_0x5555('0x9')]=_[_0x5555('0xa')](config['redis'],{'host':_0x5555('0xb'),'port':0x18eb});var io=require(_0x5555('0xc'))(new Redis(config[_0x5555('0x9')]));function getAdminUser(_0x3b6e9c,_0x444bc0,_0x222c40,_0x5b1d52,_0x116f1e,_0x4b769e){return new Promise(function(_0x343387,_0x8d69b2){var _0x52c4b9={'method':_0x5555('0xd'),'uri':_0x5b1d52+_0x5555('0xe')+'&'+_0x116f1e+'&'+_0x4b769e,'auth':_0x444bc0,'json':!![]};return rp(_0x52c4b9)[_0x5555('0xf')](function(_0x3e0e36){if(_0x3e0e36['result']['length']>0x0){_0x222c40[_0x5555('0x10')]=_0x3e0e36[_0x5555('0x11')][0x0][_0x5555('0x12')];}logger[_0x5555('0x13')]('['+[_0x3b6e9c['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x222c40);_0x343387(_0x222c40);})['catch'](function(_0x1df301){logger[_0x5555('0x14')]('['+[_0x3b6e9c[_0x5555('0x15')]()]+']',_0x1df301[_0x5555('0x16')]);_0x8d69b2(_0x1df301[_0x5555('0x16')]);});});}function getUser(_0x226d93,_0x3ac139,_0x3a33e6,_0x3e3990,_0x226b84){return function(_0x199e87){logger[_0x5555('0x13')]('['+[_0x226d93[_0x5555('0x15')]()]+_0x5555('0x17'),_0x199e87);return new Promise(function(_0x6bdb16,_0xeabb56){if(intUtil['validateEmail'](_0x199e87[_0x5555('0x18')])){var _0x37ab64={'method':_0x5555('0xd'),'uri':_0x3a33e6+_0x5555('0x19')+_0x199e87['userEmail']+'&'+_0x3e3990+'&'+_0x226b84,'auth':_0x3ac139,'json':!![]};logger['info']('['+[_0x226d93[_0x5555('0x15')]()]+_0x5555('0x1a'),_0x37ab64);return rp(_0x37ab64)[_0x5555('0xf')](function(_0x3359a1){logger['info']('['+[_0x226d93['toUpperCase']()]+_0x5555('0x1b'),_0x3359a1);if(_0x3359a1[_0x5555('0x11')]['length']>0x0&&String(_0x3359a1[_0x5555('0x11')][0x0][_0x5555('0x1c')])===_0x5555('0x1d')){_0x199e87[_0x5555('0x1e')]=_0x3359a1[_0x5555('0x11')][0x0][_0x5555('0x12')];}else{_0x199e87[_0x5555('0x1e')]=_0x199e87[_0x5555('0x10')];_0x199e87[_0x5555('0x18')]=_0x199e87[_0x5555('0x1f')];}logger[_0x5555('0x13')]('['+[_0x226d93['toUpperCase']()]+_0x5555('0x20'),_0x199e87);_0x6bdb16(_0x199e87);})[_0x5555('0x21')](function(_0x513e17){logger[_0x5555('0x14')]('['+[_0x226d93['toUpperCase']()]+']',_0x513e17['message']);_0xeabb56(_0x513e17[_0x5555('0x16')]);});}else{logger[_0x5555('0x13')]('['+[_0x226d93[_0x5555('0x15')]()]+_0x5555('0x22'));_0x199e87[_0x5555('0x1e')]=_0x199e87[_0x5555('0x10')];_0x199e87[_0x5555('0x18')]=_0x199e87[_0x5555('0x1f')];_0x6bdb16(_0x199e87);}});};}function createEndUser(_0x337eb0,_0x30d220,_0x3b0cec,_0x342be0,_0x29d43b){logger[_0x5555('0x13')]('['+[_0x337eb0[_0x5555('0x15')]()]+'],\x20createEndUser\x20input\x20crm',_0x3b0cec);return new Promise(function(_0x51a876,_0x1caf82){var _0x48195a={'method':_0x5555('0x23'),'uri':_0x342be0+_0x5555('0x24')+_0x29d43b,'body':{'user_name':_0x3b0cec[_0x5555('0x25')],'roles':_0x5555('0x26'),'first_name':_0x3b0cec[_0x5555('0x25')],'active':_0x5555('0x1d'),'date_format':_0x5555('0x27'),'phone':_0x3b0cec[_0x5555('0x25')]},'auth':_0x30d220,'json':!![]};return rp(_0x48195a)['then'](function(_0x631fd1){logger[_0x5555('0x13')]('['+[_0x337eb0[_0x5555('0x15')]()]+_0x5555('0x28'),_0x631fd1[_0x5555('0x11')]);_0x3b0cec[_0x5555('0x29')]=_0x631fd1['result']['sys_id'];_0x51a876(_0x3b0cec);})['catch'](function(_0x44fd7c){logger[_0x5555('0x14')]('['+[_0x337eb0['toUpperCase']()]+']',_0x44fd7c['message']);_0x1caf82(_0x44fd7c['message']);});});}function getEndUser(_0x4b916e,_0x54b57f,_0x1c28f6,_0x3f7f06,_0x477afe){return function(_0x3ef05f){logger[_0x5555('0x13')]('['+[_0x4b916e['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x3ef05f);return new Promise(function(_0x5628be,_0x5ac651){var _0xc52650={'method':_0x5555('0xd'),'uri':_0x1c28f6+'sys_user?sysparm_query=phone%3D'+_0x3ef05f[_0x5555('0x25')]+'&'+_0x3f7f06+'&'+_0x477afe,'auth':_0x54b57f,'json':!![]};return rp(_0xc52650)['then'](function(_0x3d4c04){if(_0x3d4c04[_0x5555('0x11')][_0x5555('0x2a')]>0x0){_0x3ef05f[_0x5555('0x29')]=_0x3d4c04[_0x5555('0x11')][0x0][_0x5555('0x12')];logger[_0x5555('0x13')]('['+[_0x4b916e[_0x5555('0x15')]()]+_0x5555('0x2b'),_0x3ef05f);_0x5628be(_0x3ef05f);}else{return createEndUser(_0x4b916e,_0x54b57f,_0x3ef05f,_0x1c28f6,_0x3f7f06)[_0x5555('0xf')](function(_0x21ca36){logger[_0x5555('0x13')]('['+[_0x4b916e[_0x5555('0x15')]()]+_0x5555('0x2c'),_0x21ca36);_0x5628be(_0x21ca36);});}})[_0x5555('0x21')](function(_0x42f3ad){logger[_0x5555('0x14')]('['+[_0x4b916e[_0x5555('0x15')]()]+']',_0x42f3ad[_0x5555('0x16')]);_0x5ac651(_0x42f3ad[_0x5555('0x16')]);});});};}function getCustomFields(_0x303ca0,_0xbf438d){var _0x4008dd={};if(_0x303ca0[_0x5555('0x2a')]>0x0){_[_0x5555('0x2d')](_0x303ca0,function(_0x4b3044){if(_[_0x5555('0x2e')](['string',_0x5555('0x2f')],_0x4b3044[_0x5555('0x30')])&&_0x4b3044[_0x5555('0x31')]&&!_0x4b3044[_0x5555('0x32')]){_0x4008dd[_0x4b3044['nameField'][_0x5555('0x33')]()]=_0x4b3044['content'][_0x5555('0x34')]();}else if(_[_0x5555('0x2e')]([_0x5555('0x35'),_0x5555('0x2f')],_0x4b3044[_0x5555('0x30')])&&_0x4b3044[_0x5555('0x36')]&&_0x4b3044[_0x5555('0x32')]){_0x4008dd[_0x4b3044[_0x5555('0x36')][_0x5555('0x33')]()]=_0x4b3044['content'][_0x5555('0x34')]();}else if(_0x4b3044['type']==='variable'&&_0x4b3044[_0x5555('0x37')]&&_0x4b3044[_0x5555('0x36')]&&_0x4b3044[_0x5555('0x32')]){_0x4008dd[_0x4b3044[_0x5555('0x36')][_0x5555('0x33')]()]=_0xbf438d[_0x4b3044[_0x5555('0x37')]]['toString']();}else if(_0x4b3044['type']==='customVariable'&&_0x4b3044[_0x5555('0x38')]&&_0x4b3044[_0x5555('0x38')]['name']&&_0x4b3044['idField']&&_0x4b3044['customField']){_0x4008dd[_0x4b3044[_0x5555('0x36')]['toLowerCase']()]=_0xbf438d[_0x4b3044[_0x5555('0x38')][_0x5555('0x39')][_0x5555('0x33')]()][_0x5555('0x34')]();}});}return _0x4008dd;}function getTicket(_0x50779e,_0x531720,_0x5b9c6c,_0x1eefc1,_0x172238,_0x57428a){return function(_0x2e0562){logger[_0x5555('0x13')]('['+[_0x50779e[_0x5555('0x15')]()]+_0x5555('0x3a'),_0x2e0562);return new Promise(function(_0x160523,_0x27df5b){var _0x304f46=_0x50779e[_0x5555('0x33')]()===_0x5555('0x3b')?_0x2e0562[_0x5555('0x1e')]:_0x2e0562[_0x5555('0x29')];var _0x4e757e={'method':_0x5555('0x23'),'uri':_0x5b9c6c+_0x5555('0x3c')+'?'+_0x57428a,'body':Object[_0x5555('0x3d')]({},{'active':_0x5555('0x1d'),'caller_id':_0x304f46,'assigned_to':_0x2e0562[_0x5555('0x1e')],'short_description':intUtil['getString'](_0x1eefc1[_0x5555('0x3e')],_0x172238,'\x20'),'description':intUtil[_0x5555('0x3f')](_0x1eefc1[_0x5555('0x40')],_0x172238,'\x0a')},getCustomFields(_0x1eefc1[_0x5555('0x41')],_0x172238)),'auth':_0x531720,'json':!![]};return rp(_0x4e757e)[_0x5555('0xf')](function(_0x1a1c58){logger[_0x5555('0x13')]('['+[_0x50779e[_0x5555('0x15')]()]+_0x5555('0x42'),_0x1a1c58[_0x5555('0x11')]);_0x2e0562[_0x5555('0x43')]=_0x1a1c58[_0x5555('0x11')][_0x5555('0x12')];_0x2e0562[_0x5555('0x44')]=_0x1a1c58[_0x5555('0x11')][_0x5555('0x45')];logger[_0x5555('0x13')]('['+[_0x50779e['toUpperCase']()]+']\x20getTicket\x20crm',_0x2e0562);_0x160523(_0x2e0562);})[_0x5555('0x21')](function(_0x3c8694){logger[_0x5555('0x14')]('['+[_0x50779e[_0x5555('0x15')]()]+']',_0x3c8694[_0x5555('0x16')]);_0x27df5b(_0x3c8694[_0x5555('0x16')]);});});};}function createRemoteTag(_0x26df10,_0x3d9d25,_0x24480c,_0xf7d73e){return new Promise(function(_0x6f8f28,_0x51909f){var _0x1d0f31={'method':'POST','uri':_0x24480c+_0x5555('0x46')+'?'+_0xf7d73e,'body':{'short_description':_0x26df10,'global':!![],'active':!![],'name':_0x26df10},'auth':_0x3d9d25,'json':!![]};return rp(_0x1d0f31)['then'](function(_0x367905){var _0x491cfc=_0x367905[_0x5555('0x11')][_0x5555('0x12')];_0x6f8f28(_0x491cfc);});});}function getRemoteTag(_0x36eb29,_0xff0cd0,_0x33695f,_0x4cb88b,_0x29abb8){return new Promise(function(_0x542f1d,_0x5b5815){var _0x25b026={'method':'GET','uri':_0x33695f+_0x5555('0x46')+'?sysparm_query=name%3D'+_0x36eb29+'&'+_0x4cb88b,'auth':_0xff0cd0,'json':!![]};return rp(_0x25b026)[_0x5555('0xf')](function(_0x181228){if(_0x181228['result']['length']>0x0){var _0x253500=_0x181228['result'][0x0][_0x5555('0x12')];_0x542f1d(_0x253500);}else{return createRemoteTag(_0x36eb29,_0xff0cd0,_0x33695f,_0x4cb88b)[_0x5555('0xf')](function(_0x515fcb){_0x542f1d(_0x515fcb);});}});});}function assignTagToIncident(_0x6452fb,_0x15eed0,_0x37fb2d,_0x79a88f,_0x400cb2){return new Promise(function(_0x1803b4,_0x2ca925){var _0x1f6a7a={'method':_0x5555('0x23'),'uri':_0x37fb2d+_0x5555('0x47')+'?'+_0x400cb2,'body':{'label':_0x6452fb,'table':_0x5555('0x3c'),'id_type':_0x5555('0x48'),'table_key':_0x79a88f[_0x5555('0x43')],'title':'Incident\x20-\x20'+_0x79a88f['ticketNumber'],'id_display':_0x79a88f[_0x5555('0x44')]},'auth':_0x15eed0,'json':!![]};return rp(_0x1f6a7a)[_0x5555('0xf')](function(_0x3f2d14){_0x1803b4();})[_0x5555('0x21')](function(){_0x1803b4();});});}function manageTags(_0x1af54c,_0x2d5559,_0xb09509,_0x545479,_0x32ad5e,_0x357cd2,_0xae47dc){return new Promise(function(_0x2adcb1,_0x256cb8){var _0x529126=[];_0x2d5559['forEach'](function(_0x554549){_0x529126['push'](getRemoteTag(_0x554549,_0xb09509,_0x545479,_0x357cd2,_0xae47dc));});return Promise[_0x5555('0x49')](_0x529126)[_0x5555('0xf')](function(_0x27ffb5){if(_0x27ffb5[_0x5555('0x2a')]){logger[_0x5555('0x13')]('['+[_0x1af54c['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x27ffb5);var _0x4e3f39=[];_0x27ffb5[_0x5555('0x2d')](function(_0x2b9e0a){_0x4e3f39[_0x5555('0x4a')](assignTagToIncident(_0x2b9e0a,_0xb09509,_0x545479,_0x32ad5e,_0x357cd2));});return Promise['all'](_0x4e3f39)[_0x5555('0xf')](function(){_0x2adcb1();})[_0x5555('0x21')](function(){_0x2adcb1();});}else{_0x2adcb1();}});});}function getTags(_0x14da4d,_0x41ceb3,_0x4bcf54,_0x3367e3,_0x5bd9c4,_0xabb00b){return function(_0x21ac13){return new Promise(function(_0x2d500a,_0x307553){var _0x1f3878=[];var _0x195747=_0x3367e3[_0x5555('0x4b')];if(_0x195747&&_0x195747[_0x5555('0x2a')]>0x0){_0x1f3878=_[_0x5555('0x4c')](_0x195747,_0x5555('0x39'));}if(_0x1f3878[_0x5555('0x2a')]>0x0){return manageTags(_0x14da4d,_0x1f3878,_0x41ceb3,_0x4bcf54,_0x21ac13,_0x5bd9c4,_0xabb00b)[_0x5555('0xf')](function(){_0x2d500a(_0x21ac13);});}else{_0x2d500a(_0x21ac13);}});};}function emit(_0x534c4a,_0x161c1b,_0x48daa6){var _0xbdf32e=_0x5555('0x4d')+_0x5555('0x4e')+_0x5555('0x4f')+_0x5555('0x50');var _0x3532f0={'uri':_0x534c4a+_0x5555('0x51')+_0x48daa6+_0xbdf32e};io['to'](util[_0x5555('0x52')](_0x5555('0x53'),_0x161c1b))['emit'](_0x5555('0x54'),_0x3532f0);}exports['cs']=function(_0x389bc8,_0x41bc8c,_0x1439b4,_0x1589bb,_0x50c2d9,_0x33ac71,_0x4566ab,_0x572fda){var _0x3d54f7={};var _0x571844={'user':_0x33ac71['username'],'pass':_0x33ac71[_0x5555('0x55')]};var _0x1a8336=_0x5555('0x56');var _0x59b58a='sysparm_display_value=true';_0x33ac71[_0x5555('0x57')]=intUtil[_0x5555('0x58')](_0x33ac71[_0x5555('0x57')]);_0x33ac71[_0x5555('0x59')]=intUtil[_0x5555('0x58')](_0x33ac71[_0x5555('0x59')]);var _0x1dcbde=util[_0x5555('0x52')](_0x5555('0x5a'),_0x33ac71['remoteUri']);_0x3d54f7['userEmail']=!_[_0x5555('0x5b')](_0x1589bb)?_0x1589bb[_0x5555('0x5c')]:null;_0x3d54f7[_0x5555('0x1f')]=_0x33ac71[_0x5555('0x5c')];_0x3d54f7['endUserNumber']=_0x572fda[_0x5555('0x33')]()===_0x5555('0x3b')?_0x41bc8c[_0x5555('0x5d')]:_0x41bc8c['calleridnum'];_0x3d54f7[_0x5555('0x5e')]=_0x572fda===_0x5555('0x5f')||_0x572fda===_0x5555('0x60')?_0x5555('0x5f'):'outbound';var _0x547103=util['format'](_0x5555('0x61'),_0x33ac71[_0x5555('0x59')],_0x41bc8c[_0x5555('0x62')],md5(_0x41bc8c[_0x5555('0x62')]));if(_0x50c2d9&&_0x50c2d9[_0x5555('0x63')]){logger[_0x5555('0x13')](_0x5555('0x64'),_0x5555('0x65'));_0x41bc8c[_0x5555('0x66')]=_0x547103;}else if(_0x4566ab&&_0x4566ab[_0x5555('0x67')]&&_0x4566ab['recordingFormat']!==_0x5555('0x68')){logger[_0x5555('0x13')](_0x5555('0x69'),_0x5555('0x65'));_0x41bc8c[_0x5555('0x66')]=_0x547103;}else{_0x41bc8c[_0x5555('0x66')]='';}return getAdminUser(_0x572fda,_0x571844,_0x3d54f7,_0x1dcbde,_0x59b58a,_0x1a8336)[_0x5555('0xf')](getUser(_0x572fda,_0x571844,_0x1dcbde,_0x59b58a,_0x1a8336))[_0x5555('0xf')](getEndUser(_0x572fda,_0x571844,_0x1dcbde,_0x59b58a,_0x1a8336))[_0x5555('0xf')](getTicket(_0x572fda,_0x571844,_0x1dcbde,_0x1439b4,_0x41bc8c,_0x59b58a))[_0x5555('0xf')](function(_0x34b7a6){logger[_0x5555('0x13')](util[_0x5555('0x52')](_0x5555('0x6a'),_0x34b7a6[_0x5555('0x43')]));logger[_0x5555('0x13')](util[_0x5555('0x52')](_0x5555('0x6b'),_0x572fda));if(_0x572fda!=='unmanaged'){logger['info']('['+[_0x572fda[_0x5555('0x15')]()]+']',_0x5555('0x6c'));emit(_0x33ac71[_0x5555('0x57')],_0x1589bb[_0x5555('0x39')],_0x34b7a6[_0x5555('0x43')]);}})['catch'](function(_0x1b4064){logger[_0x5555('0x14')]('['+[_0x572fda[_0x5555('0x15')]()]+_0x5555('0x6d'),util['inspect'](_0x1b4064,{'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 f789e99..14ba0b2 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 _0x6755=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','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','trigger:browser:url','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','unmanaged','lastevent','toUpperCase','error','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','parent_type','Contacts','parent_name','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','isNil','info','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','user_name','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length'];(function(_0x5355b3,_0x2f1e18){var _0x1dbf46=function(_0x2139fe){while(--_0x2139fe){_0x5355b3['push'](_0x5355b3['shift']());}};_0x1dbf46(++_0x2f1e18);}(_0x6755,0x19a));var _0x5675=function(_0x18fe9d,_0x3904f5){_0x18fe9d=_0x18fe9d-0x0;var _0x1939b4=_0x6755[_0x18fe9d];return _0x1939b4;};'use strict';var _=require(_0x5675('0x0'));var rp=require(_0x5675('0x1'));var BPromise=require(_0x5675('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x5675('0x3'));var intUtil=require('./util');var config=require(_0x5675('0x4'));var logger=require(_0x5675('0x5'))(_0x5675('0x6'));config[_0x5675('0x7')]=_[_0x5675('0x8')](config[_0x5675('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5675('0x9'))(new Redis(config[_0x5675('0x7')]));var def={'method':_0x5675('0xa'),'json':!![]};function emit(_0x1c7949,_0x39df7d,_0x177332){io['to'](_0x1c7949)['emit'](_0x39df7d,_0x177332);}function getTicket(_0x18256f,_0x59b896,_0x62bcf9,_0x9ce7b4,_0x40ffe7,_0x11626f,_0x5d3897,_0x6f30f){logger['info'](_0x5675('0xb'));var _0x2788fd=new Date();var _0xc19c2a=[{'name':_0x5675('0xc'),'value':intUtil[_0x5675('0xd')](_0x9ce7b4[_0x5675('0xe')],_0x40ffe7,'\x20')},{'name':_0x5675('0xf'),'value':_0x59b896['id']},{'name':_0x5675('0x10'),'value':_0x59b896['id']},{'name':_0x5675('0x11'),'value':intUtil['getString'](_0x9ce7b4[_0x5675('0x12')],_0x40ffe7,'\x0a')},{'name':_0x5675('0x13'),'value':_0x2788fd[_0x5675('0x14')]()[_0x5675('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x62bcf9['id']},{'name':_0x5675('0x16'),'value':_0x5675('0x17')},{'name':_0x5675('0x18'),'value':_0x62bcf9['name']},{'name':'direction','value':_0x6f30f}];if(_0x11626f['length']){_[_0x5675('0x19')](_0x11626f,function(_0x56ed68){if(_0x40ffe7[_0x56ed68[_0x5675('0x1a')]]){_0xc19c2a[_0x5675('0x1b')]({'name':_0x56ed68[_0x5675('0x1c')],'value':_0x40ffe7[_0x56ed68[_0x5675('0x1a')]]});}});}return request({'form':{'method':_0x5675('0x1d'),'input_type':_0x5675('0x1e'),'response_type':_0x5675('0x1e'),'rest_data':JSON[_0x5675('0x1f')]({'session':_0x5d3897['id'],'module_name':_0x5675('0x20'),'name_value_list':_0xc19c2a})}});}function getAuth(_0x6afe3b){return util[_0x5675('0x21')]('Basic\x20%s',new Buffer(_0x6afe3b[_0x5675('0x22')]+':X')[_0x5675('0x23')]('base64'));}function getServerInfo(_0x2985fd){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x5675('0x1e'),'rest_data':JSON[_0x5675('0x1f')]({'session':_0x2985fd['id']})}});}function getUser(_0x1597e8,_0x1747d2,_0xdd7454){if(!_[_0x5675('0x24')](_0x1747d2)){logger[_0x5675('0x25')]('Getting\x20agent\x20with\x20name',_0x1747d2);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x5675('0x1e'),'rest_data':JSON[_0x5675('0x1f')]({'session':_0xdd7454['id'],'module_name':'Employees','query':util[_0x5675('0x21')](_0x5675('0x26'),_0x1747d2),'order_by':'','offset':'0','select_fields':['id',_0x5675('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5675('0x27')](function(_0x107203){if(_0x107203[_0x5675('0x28')]['length']){var _0x4919d1=_[_0x5675('0x29')](_0x107203[_0x5675('0x28')],function(_0x14c8fe){return _0x14c8fe['name_value_list'][_0x5675('0x2a')][_0x5675('0x2b')]===_0x1747d2;});if(_0x4919d1){logger['info'](_0x5675('0x2c'));return BPromise[_0x5675('0x2d')]({'id':_0x4919d1[_0x5675('0x2e')]['id'][_0x5675('0x2b')],'name':_0x4919d1['name_value_list'][_0x5675('0xc')][_0x5675('0x2b')]});}}logger[_0x5675('0x25')](_0x5675('0x2f'));return BPromise[_0x5675('0x2d')]({'id':_0xdd7454['name_value_list'][_0x5675('0x30')][_0x5675('0x2b')],'name':_0xdd7454['name_value_list']['user_name'][_0x5675('0x2b')]});});}else{logger[_0x5675('0x25')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5675('0x2d')]({'id':_0xdd7454[_0x5675('0x2e')][_0x5675('0x30')][_0x5675('0x2b')],'name':_0xdd7454[_0x5675('0x2e')][_0x5675('0x2a')][_0x5675('0x2b')]});}}function getEndUser(_0x2ae916,_0x3f2bf5,_0x104e17,_0x1219f4){logger[_0x5675('0x25')](_0x5675('0x31'),_0x104e17);return request({'form':{'method':_0x5675('0x32'),'input_type':'JSON','response_type':_0x5675('0x1e'),'rest_data':JSON['stringify']({'session':_0x1219f4['id'],'module_name':_0x5675('0x17'),'query':util['format'](_0x5675('0x33'),_0x104e17),'order_by':'','offset':'0','select_fields':['id',_0x5675('0xc'),_0x5675('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5675('0x27')](function(_0x4cc17e){if(_0x4cc17e[_0x5675('0x28')][_0x5675('0x35')]){var _0x43896e=_[_0x5675('0x29')](_0x4cc17e['entry_list'],function(_0x7423df){return _0x7423df[_0x5675('0x2e')]['phone_home']['value']===_0x104e17;});if(_0x43896e){logger[_0x5675('0x25')]('Enduser\x20found!');return BPromise[_0x5675('0x2d')]({'id':_0x43896e[_0x5675('0x2e')]['id'][_0x5675('0x2b')],'name':_0x43896e[_0x5675('0x2e')]['name']['value'],'phone':_0x43896e['name_value_list'][_0x5675('0x34')][_0x5675('0x2b')]});}}else{logger[_0x5675('0x25')](_0x5675('0x36'));return request({'form':{'method':'set_entry','input_type':_0x5675('0x1e'),'response_type':_0x5675('0x1e'),'rest_data':JSON['stringify']({'session':_0x1219f4['id'],'module_name':'Contacts','name_value_list':[{'name':_0x5675('0x37'),'value':_0x3f2bf5!==''?_0x3f2bf5:util[_0x5675('0x21')](_0x5675('0x38'),_0x104e17)},{'name':_0x5675('0x34'),'value':_0x104e17}]})}})['then'](function(_0x36893f){logger['info'](_0x5675('0x39'));return BPromise[_0x5675('0x2d')]({'id':_0x36893f['id'],'name':_0x36893f['entry_list'][_0x5675('0x37')][_0x5675('0x2b')],'phone':_0x36893f['entry_list'][_0x5675('0x34')][_0x5675('0x2b')]});});}});}function request(_0x18d604){logger[_0x5675('0x3a')](_0x5675('0x3b'),JSON['stringify'](_0x18d604));return rp(_[_0x5675('0x3c')](def,_0x18d604));}function getTags(_0x54b596,_0x339650){var _0xf36ce5=[];if(_0x54b596&&_0x54b596[_0x5675('0x35')]>0x0){_0xf36ce5=_[_0x5675('0x3d')](_0x54b596,_0x339650);}return _0xf36ce5;}function getCustomFields(_0x169b1d,_0x28c283){var _0x280866=[];var _0x3d5010={'custom_fields':[]};if(_0x169b1d[_0x5675('0x35')]>0x0){_[_0x5675('0x19')](_0x169b1d,function(_0x1847b9){if(_0x1847b9[_0x5675('0x3e')]===_0x5675('0x3f')&&_0x1847b9[_0x5675('0x40')]&&!_0x1847b9[_0x5675('0x41')]){_0x3d5010[_0x1847b9[_0x5675('0x40')][_0x5675('0x42')]()]=_0x1847b9[_0x5675('0x43')][_0x5675('0x23')]();}else if(_0x1847b9['type']===_0x5675('0x3f')&&_0x1847b9['idField']&&_0x1847b9['customField']){_0x3d5010[_0x5675('0x44')]['push']({'id':_0x1847b9[_0x5675('0x1c')],'value':_0x1847b9[_0x5675('0x43')][_0x5675('0x23')]()});}else if(_0x1847b9[_0x5675('0x3e')]===_0x5675('0x45')&&_0x1847b9['variableName']&&_0x1847b9[_0x5675('0x1c')]&&_0x1847b9['customField']){_0x28c283[_0x1847b9['variableName']]&&_0x3d5010['custom_fields'][_0x5675('0x1b')]({'id':_0x1847b9[_0x5675('0x1c')],'value':_0x28c283[_0x1847b9[_0x5675('0x1a')]][_0x5675('0x23')]()});}else if(_0x1847b9['type']===_0x5675('0x46')&&_0x1847b9[_0x5675('0x47')]&&_0x1847b9[_0x5675('0x47')][_0x5675('0xc')]&&_0x1847b9['idField']&&_0x1847b9[_0x5675('0x41')]){_0x28c283[_0x1847b9['Variable'][_0x5675('0xc')]['toLowerCase']()]&&_0x3d5010[_0x5675('0x44')]['push']({'id':_0x1847b9[_0x5675('0x1c')],'value':_0x28c283[_0x1847b9[_0x5675('0x47')][_0x5675('0xc')]['toLowerCase']()][_0x5675('0x23')]()});}});}return _0x3d5010;}function getConnection(_0x5828dd){return request({'method':_0x5675('0xa'),'form':{'method':_0x5675('0x48'),'input_type':_0x5675('0x1e'),'response_type':_0x5675('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5828dd[_0x5675('0x49')],'password':_0x5828dd[_0x5675('0x4a')],'encryption':_0x5675('0x4b')},'application':_0x5675('0x4c')})}})[_0x5675('0x27')](function(_0x58ee1b){var _0x394d92=_0x58ee1b;if(_0x394d92['id']){def['sessionID']=_0x394d92['id'];return BPromise[_0x5675('0x2d')](_0x394d92);}else{throw new Error(util[_0x5675('0x21')](_0x5675('0x4d'),_0x5828dd['id']));}});}function setRelationship(_0x453354,_0x59b83a,_0x119a3c,_0x431965){return request({'form':{'method':_0x5675('0x4e'),'input_type':_0x5675('0x1e'),'response_type':_0x5675('0x1e'),'rest_data':JSON[_0x5675('0x1f')]({'session':_0x453354['id'],'module_name':'Calls','module_id':_0x119a3c['id'],'link_field_name':_0x431965,'related_ids':[_0x59b83a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5675('0x4f')]=function(_0x442f84,_0x29dfb2,_0x4c11ec,_0x4b8adf,_0xb7c381,_0x3d3d55){var _0x1e68e2,_0x33669d,_0x43cec4,_0x7da3f0;_0x3d3d55['remoteUri']=intUtil['stripTrailingSlash'](_0x3d3d55[_0x5675('0x50')]);_0x3d3d55[_0x5675('0x51')]=intUtil[_0x5675('0x52')](_0x3d3d55[_0x5675('0x51')]);def[_0x5675('0x53')]=util['format']('%s/service/v4_1/rest.php',_0x3d3d55[_0x5675('0x50')]);if(_0xb7c381&&_0xb7c381[_0x5675('0x54')]){logger[_0x5675('0x25')](_0x5675('0x55'),_0x5675('0x56'));_0x29dfb2[_0x5675('0x57')]=util[_0x5675('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d3d55[_0x5675('0x51')],_0x29dfb2[_0x5675('0x58')],md5(_0x29dfb2[_0x5675('0x58')]));}else{_0x29dfb2[_0x5675('0x57')]='';}return getConnection(_0x3d3d55)[_0x5675('0x27')](function(_0x48dc01){_0x7da3f0=_0x48dc01;return getUser(_0x3d3d55,_0x4b8adf[_0x5675('0xc')],_0x7da3f0);})[_0x5675('0x27')](function(_0x5931d4){_0x1e68e2=_0x5931d4;logger[_0x5675('0x25')](_0x5675('0x59'),_0x1e68e2['id']);return getEndUser(_0x3d3d55,_0x29dfb2[_0x5675('0x5a')],_0x29dfb2[_0x5675('0x5b')],_0x7da3f0);})['then'](function(_0x4d32d5){_0x33669d=_0x4d32d5;logger['info'](_0x5675('0x5c'),_0x33669d['id']);return getTicket(_0x3d3d55,_0x1e68e2,_0x33669d,_0x4c11ec,_0x29dfb2,_0x4c11ec[_0x5675('0x5d')],_0x7da3f0,_0x5675('0x5e'));})[_0x5675('0x27')](function(_0x175f29){_0x43cec4=_0x175f29;logger[_0x5675('0x25')](_0x5675('0x5f'));logger[_0x5675('0x25')](_0x5675('0x60'),_0x43cec4['id']);return setRelationship(_0x7da3f0,_0x1e68e2,_0x43cec4,_0x5675('0x61'));})['then'](function(){return setRelationship(_0x7da3f0,_0x33669d,_0x43cec4,_0x5675('0x62'));})['then'](function(){return getServerInfo(_0x7da3f0);})[_0x5675('0x27')](function(_0x32c5ad){var _0x357f0c=parseInt(_0x32c5ad[_0x5675('0x63')][_0x5675('0x64')](0x0));var _0x9b130c=util[_0x5675('0x21')](_0x5675('0x65'),_0x3d3d55[_0x5675('0x50')],_0x43cec4['id']);if(_0x357f0c>0x6){_0x9b130c=util[_0x5675('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3d3d55['remoteUri'],_0x43cec4['id']);}logger[_0x5675('0x25')](_0x5675('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5675('0x21')]('user:%s',_0x4b8adf[_0x5675('0xc')]),_0x5675('0x66'),{'uri':_0x9b130c});})[_0x5675('0x67')](function(_0xef883){logger['error']('[QUEUE]',JSON[_0x5675('0x1f')](_0xef883));});};exports[_0x5675('0x68')]=function(_0x465def,_0x278e71,_0x4d6353,_0x4ebbac,_0x1f4c71,_0x258db8,_0x12fa52){var _0x43841a,_0x1bb933,_0x5aa54c,_0x1dfe45;_0x258db8[_0x5675('0x50')]=intUtil[_0x5675('0x52')](_0x258db8[_0x5675('0x50')]);_0x258db8[_0x5675('0x51')]=intUtil[_0x5675('0x52')](_0x258db8[_0x5675('0x51')]);def[_0x5675('0x53')]=util[_0x5675('0x21')](_0x5675('0x69'),_0x258db8[_0x5675('0x50')]);if(_0x12fa52&&_0x12fa52[_0x5675('0x6a')]&&_0x12fa52[_0x5675('0x6a')]!=='none'){logger['info'](_0x5675('0x6b'),_0x5675('0x56'));_0x278e71['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x258db8[_0x5675('0x51')],_0x278e71[_0x5675('0x58')],md5(_0x278e71[_0x5675('0x58')]));}return getConnection(_0x258db8)['then'](function(_0x56d9cb){_0x1dfe45=_0x56d9cb;return getUser(_0x258db8,_0x4ebbac['name'],_0x1dfe45);})[_0x5675('0x27')](function(_0x4d6bec){_0x43841a=_0x4d6bec;logger[_0x5675('0x25')](_0x5675('0x59'),_0x43841a['id']);return getEndUser(_0x258db8,_0x278e71[_0x5675('0x6c')],_0x278e71[_0x5675('0x6d')],_0x1dfe45);})[_0x5675('0x27')](function(_0x552d94){_0x1bb933=_0x552d94;logger[_0x5675('0x25')]('The\x20Enduser\x20ID\x20is:',_0x1bb933['id']);return getTicket(_0x258db8,_0x43841a,_0x1bb933,_0x4d6353,_0x278e71,_0x4d6353[_0x5675('0x5d')],_0x1dfe45,'Outbound');})[_0x5675('0x27')](function(_0x56cd07){_0x5aa54c=_0x56cd07;logger[_0x5675('0x25')](_0x5675('0x5f'));logger[_0x5675('0x25')](_0x5675('0x60'),_0x5aa54c['id']);return setRelationship(_0x1dfe45,_0x43841a,_0x5aa54c,'users');})['then'](function(){return setRelationship(_0x1dfe45,_0x1bb933,_0x5aa54c,_0x5675('0x62'));})[_0x5675('0x27')](function(){return getServerInfo(_0x1dfe45);})[_0x5675('0x27')](function(_0x4825fa){var _0x49ca05=parseInt(_0x4825fa['version'][_0x5675('0x64')](0x0));var _0x5abd6a=util[_0x5675('0x21')](_0x5675('0x65'),_0x258db8[_0x5675('0x50')],_0x5aa54c['id']);if(_0x49ca05>0x6){_0x5abd6a=util[_0x5675('0x21')](_0x5675('0x6e'),_0x258db8[_0x5675('0x50')],_0x5aa54c['id']);}logger[_0x5675('0x25')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5675('0x21')](_0x5675('0x6f'),_0x4ebbac['name']),_0x5675('0x66'),{'uri':_0x5abd6a});})[_0x5675('0x67')](function(_0x4e5f16){logger['error'](_0x5675('0x6b'),JSON[_0x5675('0x1f')](_0x4e5f16));});};exports[_0x5675('0x70')]=function(_0x18d90b,_0x1796bc,_0x504889,_0x59ac23,_0x223425,_0x1f2d6e){var _0x27de53,_0x1c557c,_0x5f2f01,_0x451897;_0x1f2d6e['remoteUri']=intUtil['stripTrailingSlash'](_0x1f2d6e[_0x5675('0x50')]);_0x1f2d6e[_0x5675('0x51')]=intUtil[_0x5675('0x52')](_0x1f2d6e['serverUrl']);def[_0x5675('0x53')]=util[_0x5675('0x21')](_0x5675('0x69'),_0x1f2d6e[_0x5675('0x50')]);if(_0x223425&&_0x223425[_0x5675('0x54')]){logger[_0x5675('0x25')]('['+_0x1796bc[_0x5675('0x71')][_0x5675('0x72')]()+']',_0x5675('0x56'));_0x1796bc[_0x5675('0x57')]=util[_0x5675('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f2d6e['serverUrl'],_0x1796bc[_0x5675('0x58')],md5(_0x1796bc[_0x5675('0x58')]));}else{_0x1796bc[_0x5675('0x57')]='';}return getConnection(_0x1f2d6e)[_0x5675('0x27')](function(_0x40898b){_0x451897=_0x40898b;if(!_[_0x5675('0x24')](_0x59ac23)){return getUser(_0x1f2d6e,_0x59ac23['name'],_0x451897);}else{return getUser(_0x1f2d6e,null,_0x451897);}})['then'](function(_0x324cc7){_0x27de53=_0x324cc7;logger['info']('The\x20User\x20ID\x20is:',_0x27de53['id']);return getEndUser(_0x1f2d6e,_0x1796bc[_0x5675('0x5a')],_0x1796bc[_0x5675('0x5b')],_0x451897);})[_0x5675('0x27')](function(_0x98685a){_0x1c557c=_0x98685a;logger[_0x5675('0x25')](_0x5675('0x5c'),_0x1c557c['id']);return getTicket(_0x1f2d6e,_0x27de53,_0x1c557c,_0x504889,_0x1796bc,_0x504889[_0x5675('0x5d')],_0x451897,'Inbound');})['then'](function(_0x5b9212){_0x5f2f01=_0x5b9212;logger[_0x5675('0x25')](_0x5675('0x5f'));logger[_0x5675('0x25')](_0x5675('0x60'),_0x5f2f01['id']);return setRelationship(_0x451897,_0x27de53,_0x5f2f01,_0x5675('0x61'));})['then'](function(){return setRelationship(_0x451897,_0x1c557c,_0x5f2f01,_0x5675('0x62'));})[_0x5675('0x27')](function(){return getServerInfo(_0x451897);})[_0x5675('0x67')](function(_0x29bc0d){logger[_0x5675('0x73')]('['+_0x1796bc[_0x5675('0x71')]['toUpperCase']()+']',JSON[_0x5675('0x1f')](_0x29bc0d));});}; \ No newline at end of file +var _0x8141=['The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','Outbound','trigger:browser:url','unmanaged','lastevent','recordingURL','calleridname','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_minutes','parent_type','Contacts','parent_name','direction','forEach','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','length','find','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','type','customVariable','Variable','POST','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum'];(function(_0x504582,_0x5b3965){var _0x43c6ce=function(_0x1199a4){while(--_0x1199a4){_0x504582['push'](_0x504582['shift']());}};_0x43c6ce(++_0x5b3965);}(_0x8141,0x91));var _0x1814=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8141[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1814('0x0'));var rp=require(_0x1814('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x1814('0x2'));var Redis=require(_0x1814('0x3'));var intUtil=require(_0x1814('0x4'));var config=require(_0x1814('0x5'));var logger=require(_0x1814('0x6'))(_0x1814('0x7'));config[_0x1814('0x8')]=_[_0x1814('0x9')](config[_0x1814('0x8')],{'host':_0x1814('0xa'),'port':0x18eb});var io=require(_0x1814('0xb'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x147669,_0x30ebf,_0x533b84){io['to'](_0x147669)[_0x1814('0xc')](_0x30ebf,_0x533b84);}function getTicket(_0x39b019,_0x5a31bf,_0x2756ff,_0x3527be,_0x1f9832,_0x1f0c38,_0x5882e9,_0x65742e){logger[_0x1814('0xd')](_0x1814('0xe'));var _0x446803=new Date();var _0x1e29c6=[{'name':_0x1814('0xf'),'value':intUtil[_0x1814('0x10')](_0x3527be['Subjects'],_0x1f9832,'\x20')},{'name':_0x1814('0x11'),'value':_0x5a31bf['id']},{'name':_0x1814('0x12'),'value':_0x5a31bf['id']},{'name':_0x1814('0x13'),'value':intUtil[_0x1814('0x10')](_0x3527be[_0x1814('0x14')],_0x1f9832,'\x0a')},{'name':_0x1814('0x15'),'value':_0x446803[_0x1814('0x16')]()['slice'](0x0,0x13)[_0x1814('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x1814('0x18'),'value':'15'},{'name':'parent_id','value':_0x2756ff['id']},{'name':_0x1814('0x19'),'value':_0x1814('0x1a')},{'name':_0x1814('0x1b'),'value':_0x2756ff[_0x1814('0xf')]},{'name':_0x1814('0x1c'),'value':_0x65742e}];if(_0x1f0c38['length']){_[_0x1814('0x1d')](_0x1f0c38,function(_0x1792fe){if(_0x1f9832[_0x1792fe['variableName']]){_0x1e29c6['push']({'name':_0x1792fe['idField'],'value':_0x1f9832[_0x1792fe[_0x1814('0x1e')]]});}});}return request({'form':{'method':_0x1814('0x1f'),'input_type':_0x1814('0x20'),'response_type':_0x1814('0x20'),'rest_data':JSON['stringify']({'session':_0x5882e9['id'],'module_name':_0x1814('0x21'),'name_value_list':_0x1e29c6})}});}function getAuth(_0x2a72da){return util[_0x1814('0x22')](_0x1814('0x23'),new Buffer(_0x2a72da[_0x1814('0x24')]+':X')[_0x1814('0x25')]('base64'));}function getServerInfo(_0x3f0087){return request({'form':{'method':_0x1814('0x26'),'input_type':'JSON','response_type':_0x1814('0x20'),'rest_data':JSON[_0x1814('0x27')]({'session':_0x3f0087['id']})}});}function getUser(_0x3d6b0e,_0x5940fc,_0x9020f3){if(!_[_0x1814('0x28')](_0x5940fc)){logger[_0x1814('0xd')]('Getting\x20agent\x20with\x20name',_0x5940fc);return request({'form':{'method':_0x1814('0x29'),'input_type':'JSON','response_type':_0x1814('0x20'),'rest_data':JSON[_0x1814('0x27')]({'session':_0x9020f3['id'],'module_name':_0x1814('0x2a'),'query':util['format'](_0x1814('0x2b'),_0x5940fc),'order_by':'','offset':'0','select_fields':['id',_0x1814('0xf'),_0x1814('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1814('0x2d')](function(_0x138632){if(_0x138632['entry_list']['length']){var _0x4d49ef=_['find'](_0x138632[_0x1814('0x2e')],function(_0xf59414){return _0xf59414['name_value_list'][_0x1814('0x2c')][_0x1814('0x2f')]===_0x5940fc;});if(_0x4d49ef){logger[_0x1814('0xd')](_0x1814('0x30'));return BPromise[_0x1814('0x31')]({'id':_0x4d49ef[_0x1814('0x32')]['id'][_0x1814('0x2f')],'name':_0x4d49ef[_0x1814('0x32')][_0x1814('0xf')][_0x1814('0x2f')]});}}logger[_0x1814('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1814('0x31')]({'id':_0x9020f3[_0x1814('0x32')]['user_id'][_0x1814('0x2f')],'name':_0x9020f3['name_value_list']['user_name']['value']});});}else{logger['info'](_0x1814('0x33'));return BPromise['resolve']({'id':_0x9020f3[_0x1814('0x32')]['user_id']['value'],'name':_0x9020f3[_0x1814('0x32')][_0x1814('0x2c')]['value']});}}function getEndUser(_0x466c5d,_0x19380f,_0x195eea,_0x3ad963){logger[_0x1814('0xd')](_0x1814('0x34'),_0x195eea);return request({'form':{'method':'get_entry_list','input_type':_0x1814('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3ad963['id'],'module_name':_0x1814('0x1a'),'query':util[_0x1814('0x22')](_0x1814('0x35'),_0x195eea),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1814('0x2d')](function(_0x1ac1d3){if(_0x1ac1d3[_0x1814('0x2e')][_0x1814('0x36')]){var _0x36fe04=_[_0x1814('0x37')](_0x1ac1d3[_0x1814('0x2e')],function(_0x480f0f){return _0x480f0f[_0x1814('0x32')]['phone_home'][_0x1814('0x2f')]===_0x195eea;});if(_0x36fe04){logger[_0x1814('0xd')]('Enduser\x20found!');return BPromise[_0x1814('0x31')]({'id':_0x36fe04['name_value_list']['id'][_0x1814('0x2f')],'name':_0x36fe04[_0x1814('0x32')][_0x1814('0xf')][_0x1814('0x2f')],'phone':_0x36fe04[_0x1814('0x32')][_0x1814('0x38')][_0x1814('0x2f')]});}}else{logger['info'](_0x1814('0x39'));return request({'form':{'method':_0x1814('0x1f'),'input_type':'JSON','response_type':_0x1814('0x20'),'rest_data':JSON[_0x1814('0x27')]({'session':_0x3ad963['id'],'module_name':'Contacts','name_value_list':[{'name':_0x1814('0x3a'),'value':_0x19380f!==''?_0x19380f:util[_0x1814('0x22')](_0x1814('0x3b'),_0x195eea)},{'name':_0x1814('0x38'),'value':_0x195eea}]})}})[_0x1814('0x2d')](function(_0x5a92f6){logger['info'](_0x1814('0x3c'));return BPromise[_0x1814('0x31')]({'id':_0x5a92f6['id'],'name':_0x5a92f6[_0x1814('0x2e')][_0x1814('0x3a')][_0x1814('0x2f')],'phone':_0x5a92f6[_0x1814('0x2e')][_0x1814('0x38')][_0x1814('0x2f')]});});}});}function request(_0xe07703){logger['debug'](_0x1814('0x3d'),JSON['stringify'](_0xe07703));return rp(_[_0x1814('0x3e')](def,_0xe07703));}function getTags(_0x5d240b,_0x2980dd){var _0x3d1898=[];if(_0x5d240b&&_0x5d240b['length']>0x0){_0x3d1898=_['map'](_0x5d240b,_0x2980dd);}return _0x3d1898;}function getCustomFields(_0x13e793,_0x4f44ec){var _0x5d003b=[];var _0x2f9361={'custom_fields':[]};if(_0x13e793[_0x1814('0x36')]>0x0){_['forEach'](_0x13e793,function(_0x4ea3b3){if(_0x4ea3b3['type']===_0x1814('0x3f')&&_0x4ea3b3[_0x1814('0x40')]&&!_0x4ea3b3[_0x1814('0x41')]){_0x2f9361[_0x4ea3b3[_0x1814('0x40')][_0x1814('0x42')]()]=_0x4ea3b3[_0x1814('0x43')][_0x1814('0x25')]();}else if(_0x4ea3b3['type']===_0x1814('0x3f')&&_0x4ea3b3[_0x1814('0x44')]&&_0x4ea3b3['customField']){_0x2f9361[_0x1814('0x45')][_0x1814('0x46')]({'id':_0x4ea3b3['idField'],'value':_0x4ea3b3[_0x1814('0x43')][_0x1814('0x25')]()});}else if(_0x4ea3b3[_0x1814('0x47')]==='variable'&&_0x4ea3b3[_0x1814('0x1e')]&&_0x4ea3b3[_0x1814('0x44')]&&_0x4ea3b3[_0x1814('0x41')]){_0x4f44ec[_0x4ea3b3[_0x1814('0x1e')]]&&_0x2f9361[_0x1814('0x45')]['push']({'id':_0x4ea3b3[_0x1814('0x44')],'value':_0x4f44ec[_0x4ea3b3['variableName']]['toString']()});}else if(_0x4ea3b3['type']===_0x1814('0x48')&&_0x4ea3b3[_0x1814('0x49')]&&_0x4ea3b3['Variable'][_0x1814('0xf')]&&_0x4ea3b3[_0x1814('0x44')]&&_0x4ea3b3['customField']){_0x4f44ec[_0x4ea3b3[_0x1814('0x49')]['name'][_0x1814('0x42')]()]&&_0x2f9361['custom_fields'][_0x1814('0x46')]({'id':_0x4ea3b3[_0x1814('0x44')],'value':_0x4f44ec[_0x4ea3b3[_0x1814('0x49')][_0x1814('0xf')][_0x1814('0x42')]()][_0x1814('0x25')]()});}});}return _0x2f9361;}function getConnection(_0x269614){return request({'method':_0x1814('0x4a'),'form':{'method':_0x1814('0x4b'),'input_type':_0x1814('0x20'),'response_type':_0x1814('0x20'),'rest_data':JSON[_0x1814('0x27')]({'user_auth':{'user_name':_0x269614[_0x1814('0x4c')],'password':_0x269614[_0x1814('0x4d')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x1814('0x2d')](function(_0x435ae6){var _0x5b44d6=_0x435ae6;if(_0x5b44d6['id']){def[_0x1814('0x4e')]=_0x5b44d6['id'];return BPromise[_0x1814('0x31')](_0x5b44d6);}else{throw new Error(util[_0x1814('0x22')](_0x1814('0x4f'),_0x269614['id']));}});}function setRelationship(_0x193dcd,_0x498e7d,_0x34dd74,_0x1d940f){return request({'form':{'method':_0x1814('0x50'),'input_type':_0x1814('0x20'),'response_type':_0x1814('0x20'),'rest_data':JSON[_0x1814('0x27')]({'session':_0x193dcd['id'],'module_name':_0x1814('0x21'),'module_id':_0x34dd74['id'],'link_field_name':_0x1d940f,'related_ids':[_0x498e7d['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x56a052,_0x5c405b,_0x341187,_0x772ce8,_0x5bd238,_0x3dad76){var _0x167e32,_0x4eca95,_0x1fd6ea,_0x56ccf7;_0x3dad76[_0x1814('0x51')]=intUtil[_0x1814('0x52')](_0x3dad76[_0x1814('0x51')]);_0x3dad76[_0x1814('0x53')]=intUtil['stripTrailingSlash'](_0x3dad76[_0x1814('0x53')]);def[_0x1814('0x54')]=util['format'](_0x1814('0x55'),_0x3dad76[_0x1814('0x51')]);if(_0x5bd238&&_0x5bd238[_0x1814('0x56')]){logger[_0x1814('0xd')](_0x1814('0x57'),_0x1814('0x58'));_0x5c405b['recordingURL']=util['format'](_0x1814('0x59'),_0x3dad76[_0x1814('0x53')],_0x5c405b[_0x1814('0x5a')],md5(_0x5c405b[_0x1814('0x5a')]));}else{_0x5c405b['recordingURL']='';}return getConnection(_0x3dad76)[_0x1814('0x2d')](function(_0x35c181){_0x56ccf7=_0x35c181;return getUser(_0x3dad76,_0x772ce8['name'],_0x56ccf7);})[_0x1814('0x2d')](function(_0x434549){_0x167e32=_0x434549;logger['info'](_0x1814('0x5b'),_0x167e32['id']);return getEndUser(_0x3dad76,_0x5c405b['calleridname'],_0x5c405b[_0x1814('0x5c')],_0x56ccf7);})['then'](function(_0x208aee){_0x4eca95=_0x208aee;logger[_0x1814('0xd')](_0x1814('0x5d'),_0x4eca95['id']);return getTicket(_0x3dad76,_0x167e32,_0x4eca95,_0x341187,_0x5c405b,_0x341187['Fields'],_0x56ccf7,_0x1814('0x5e'));})[_0x1814('0x2d')](function(_0x1640fd){_0x1fd6ea=_0x1640fd;logger['info'](_0x1814('0x5f'));logger[_0x1814('0xd')](_0x1814('0x60'),_0x1fd6ea['id']);return setRelationship(_0x56ccf7,_0x167e32,_0x1fd6ea,_0x1814('0x61'));})[_0x1814('0x2d')](function(){return setRelationship(_0x56ccf7,_0x4eca95,_0x1fd6ea,_0x1814('0x62'));})['then'](function(){return getServerInfo(_0x56ccf7);})[_0x1814('0x2d')](function(_0x5a214a){var _0x24e1f6=parseInt(_0x5a214a[_0x1814('0x63')][_0x1814('0x64')](0x0));var _0x2434d9=util[_0x1814('0x22')](_0x1814('0x65'),_0x3dad76[_0x1814('0x51')],_0x1fd6ea['id']);if(_0x24e1f6>0x6){_0x2434d9=util['format'](_0x1814('0x66'),_0x3dad76[_0x1814('0x51')],_0x1fd6ea['id']);}logger[_0x1814('0xd')]('[QUEUE]',_0x1814('0x67'));emit(util[_0x1814('0x22')](_0x1814('0x68'),_0x772ce8[_0x1814('0xf')]),'trigger:browser:url',{'uri':_0x2434d9});})[_0x1814('0x69')](function(_0x57e463){logger[_0x1814('0x6a')](_0x1814('0x57'),JSON[_0x1814('0x27')](_0x57e463));});};exports[_0x1814('0x6b')]=function(_0x1676c4,_0x3804a0,_0x4bb765,_0x11a561,_0x5171c3,_0x362333,_0x44bc22){var _0x3f175b,_0x3a6b31,_0x137b6f,_0x310237;_0x362333['remoteUri']=intUtil[_0x1814('0x52')](_0x362333['remoteUri']);_0x362333[_0x1814('0x53')]=intUtil[_0x1814('0x52')](_0x362333[_0x1814('0x53')]);def['uri']=util['format'](_0x1814('0x55'),_0x362333[_0x1814('0x51')]);if(_0x44bc22&&_0x44bc22[_0x1814('0x6c')]&&_0x44bc22[_0x1814('0x6c')]!==_0x1814('0x6d')){logger[_0x1814('0xd')](_0x1814('0x6e'),'Recording\x20is\x20enabled!');_0x3804a0['recordingURL']=util[_0x1814('0x22')](_0x1814('0x59'),_0x362333[_0x1814('0x53')],_0x3804a0[_0x1814('0x5a')],md5(_0x3804a0[_0x1814('0x5a')]));}return getConnection(_0x362333)[_0x1814('0x2d')](function(_0x34fc92){_0x310237=_0x34fc92;return getUser(_0x362333,_0x11a561['name'],_0x310237);})['then'](function(_0x33d441){_0x3f175b=_0x33d441;logger[_0x1814('0xd')]('The\x20User\x20ID\x20is:',_0x3f175b['id']);return getEndUser(_0x362333,_0x3804a0[_0x1814('0x6f')],_0x3804a0['destcalleridnum'],_0x310237);})[_0x1814('0x2d')](function(_0x2a5221){_0x3a6b31=_0x2a5221;logger['info'](_0x1814('0x5d'),_0x3a6b31['id']);return getTicket(_0x362333,_0x3f175b,_0x3a6b31,_0x4bb765,_0x3804a0,_0x4bb765[_0x1814('0x70')],_0x310237,_0x1814('0x71'));})[_0x1814('0x2d')](function(_0x3f8213){_0x137b6f=_0x3f8213;logger['info'](_0x1814('0x5f'));logger[_0x1814('0xd')]('The\x20Ticket\x20ID\x20is:',_0x137b6f['id']);return setRelationship(_0x310237,_0x3f175b,_0x137b6f,_0x1814('0x61'));})['then'](function(){return setRelationship(_0x310237,_0x3a6b31,_0x137b6f,'contacts');})[_0x1814('0x2d')](function(){return getServerInfo(_0x310237);})[_0x1814('0x2d')](function(_0x1936a9){var _0xc6a1df=parseInt(_0x1936a9[_0x1814('0x63')][_0x1814('0x64')](0x0));var _0x211fdc=util['format'](_0x1814('0x65'),_0x362333[_0x1814('0x51')],_0x137b6f['id']);if(_0xc6a1df>0x6){_0x211fdc=util[_0x1814('0x22')](_0x1814('0x66'),_0x362333['remoteUri'],_0x137b6f['id']);}logger[_0x1814('0xd')](_0x1814('0x6e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1814('0x22')](_0x1814('0x68'),_0x11a561[_0x1814('0xf')]),_0x1814('0x72'),{'uri':_0x211fdc});})['catch'](function(_0x4f3917){logger[_0x1814('0x6a')](_0x1814('0x6e'),JSON[_0x1814('0x27')](_0x4f3917));});};exports[_0x1814('0x73')]=function(_0x408921,_0x15d743,_0x5d7f26,_0x5aa13a,_0x4746cb,_0x124825){var _0x2d4481,_0x24a3be,_0x3ded26,_0x200fd7;_0x124825['remoteUri']=intUtil[_0x1814('0x52')](_0x124825[_0x1814('0x51')]);_0x124825[_0x1814('0x53')]=intUtil[_0x1814('0x52')](_0x124825[_0x1814('0x53')]);def[_0x1814('0x54')]=util[_0x1814('0x22')](_0x1814('0x55'),_0x124825[_0x1814('0x51')]);if(_0x4746cb&&_0x4746cb[_0x1814('0x56')]){logger[_0x1814('0xd')]('['+_0x15d743[_0x1814('0x74')]['toUpperCase']()+']',_0x1814('0x58'));_0x15d743[_0x1814('0x75')]=util[_0x1814('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x124825[_0x1814('0x53')],_0x15d743['uniqueid'],md5(_0x15d743[_0x1814('0x5a')]));}else{_0x15d743[_0x1814('0x75')]='';}return getConnection(_0x124825)['then'](function(_0x2eb522){_0x200fd7=_0x2eb522;if(!_[_0x1814('0x28')](_0x5aa13a)){return getUser(_0x124825,_0x5aa13a[_0x1814('0xf')],_0x200fd7);}else{return getUser(_0x124825,null,_0x200fd7);}})[_0x1814('0x2d')](function(_0x5ec25e){_0x2d4481=_0x5ec25e;logger[_0x1814('0xd')](_0x1814('0x5b'),_0x2d4481['id']);return getEndUser(_0x124825,_0x15d743[_0x1814('0x76')],_0x15d743[_0x1814('0x5c')],_0x200fd7);})[_0x1814('0x2d')](function(_0x1efa2b){_0x24a3be=_0x1efa2b;logger[_0x1814('0xd')](_0x1814('0x5d'),_0x24a3be['id']);return getTicket(_0x124825,_0x2d4481,_0x24a3be,_0x5d7f26,_0x15d743,_0x5d7f26[_0x1814('0x70')],_0x200fd7,'Inbound');})[_0x1814('0x2d')](function(_0x58cb39){_0x3ded26=_0x58cb39;logger[_0x1814('0xd')](_0x1814('0x5f'));logger['info'](_0x1814('0x60'),_0x3ded26['id']);return setRelationship(_0x200fd7,_0x2d4481,_0x3ded26,_0x1814('0x61'));})[_0x1814('0x2d')](function(){return setRelationship(_0x200fd7,_0x24a3be,_0x3ded26,'contacts');})[_0x1814('0x2d')](function(){return getServerInfo(_0x200fd7);})[_0x1814('0x69')](function(_0x3c5a49){logger['error']('['+_0x15d743[_0x1814('0x74')]['toUpperCase']()+']',JSON[_0x1814('0x27')](_0x3c5a49));});}; \ 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 cb2ae40..24927ee 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 _0xc04b=['stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','format','join'];(function(_0x5405d5,_0x1fbde9){var _0x2e1d42=function(_0x5bd213){while(--_0x5bd213){_0x5405d5['push'](_0x5405d5['shift']());}};_0x2e1d42(++_0x1fbde9);}(_0xc04b,0x1e2));var _0xbc04=function(_0x42dfe9,_0x351c36){_0x42dfe9=_0x42dfe9-0x0;var _0x582b46=_0xc04b[_0x42dfe9];return _0x582b46;};'use strict';var _=require(_0xbc04('0x0'));var util=require(_0xbc04('0x1'));exports[_0xbc04('0x2')]=function(_0x25ebf9,_0x46ae7e,_0x454e8c){var _0x53d1b9=[];if(_0x25ebf9[_0xbc04('0x3')]>0x0){var _0x2c4aec=_[_0xbc04('0x4')](_0x25ebf9,['id']);for(var _0x49130d=0x0;_0x49130d<_0x2c4aec['length'];_0x49130d++){var _0x333be8=_0x2c4aec[_0x49130d];if(_0x333be8['type']===_0xbc04('0x5')){_0x53d1b9[_0xbc04('0x6')](_0x333be8[_0xbc04('0x7')]);}else if(_0x333be8[_0xbc04('0x8')]===_0xbc04('0x9')&&_0x333be8[_0xbc04('0xa')]){_0x46ae7e[_0x333be8[_0xbc04('0xa')]]&&_0x53d1b9['push'](_0x46ae7e[_0x333be8['variableName']][_0xbc04('0xb')]());}else if(_0x333be8[_0xbc04('0x8')]===_0xbc04('0xc')&&_0x333be8[_0xbc04('0xd')]&&_0x333be8[_0xbc04('0xd')][_0xbc04('0xe')]){_0x46ae7e[_0x333be8[_0xbc04('0xd')]['name'][_0xbc04('0xf')]()]&&_0x53d1b9[_0xbc04('0x6')](_0x46ae7e[_0x333be8[_0xbc04('0xd')][_0xbc04('0xe')][_0xbc04('0xf')]()]['toString']());}else if(_0x333be8[_0xbc04('0x8')]===_0xbc04('0x10')){if(_0x333be8[_0xbc04('0x11')]==='string'&&_0x333be8[_0xbc04('0x12')]){_0x53d1b9[_0xbc04('0x6')](util['format'](_0xbc04('0x13'),_0x333be8['key'],_0x333be8['keyContent']));}else if(_0x333be8[_0xbc04('0x11')]==='variable'&&_0x333be8[_0xbc04('0xa')]&&_0x333be8[_0xbc04('0x12')]){_0x46ae7e[_0x333be8[_0xbc04('0xa')]]&&_0x53d1b9['push'](util[_0xbc04('0x14')](_0xbc04('0x13'),_0x333be8['key'],_0x46ae7e[_0x333be8[_0xbc04('0xa')]]));}else if(_0x333be8[_0xbc04('0x11')]===_0xbc04('0xc')&&_0x333be8['Variable']&&_0x333be8[_0xbc04('0xd')][_0xbc04('0xe')]&&_0x333be8[_0xbc04('0x12')]){_0x46ae7e[_0x333be8['Variable'][_0xbc04('0xe')][_0xbc04('0xf')]()]&&_0x53d1b9[_0xbc04('0x6')](util[_0xbc04('0x14')](_0xbc04('0x13'),_0x333be8[_0xbc04('0x12')],_0x46ae7e[_0x333be8[_0xbc04('0xd')][_0xbc04('0xe')][_0xbc04('0xf')]()]));}}}}return _0x53d1b9[_0xbc04('0x15')](_0x454e8c);};exports[_0xbc04('0x16')]=function(_0xacada9){var _0x53d175=_0xacada9['slice'](-0x1);if(_0x53d175==='/'){_0xacada9=_0xacada9[_0xbc04('0x17')](0x0,_0xacada9[_0xbc04('0x18')](_0x53d175));}return _0xacada9;};exports[_0xbc04('0x19')]=function(_0x458897){if(!_[_0xbc04('0x1a')](_0x458897)&&_0x458897!==''){var _0x188430=/^(([^<>()\[\]\\.,;:\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 _0x188430[_0xbc04('0x1b')](String(_0x458897)[_0xbc04('0xf')]());}else{return![];}}; \ No newline at end of file +var _0x0188=['%s:\x20%s','keyContent','variable','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','string','push','type','variableName','customVariable','Variable','toLowerCase','name','toString','keyValue','keyType','key','format'];(function(_0x5cd51d,_0x20d4fa){var _0x444608=function(_0x32a9dc){while(--_0x32a9dc){_0x5cd51d['push'](_0x5cd51d['shift']());}};_0x444608(++_0x20d4fa);}(_0x0188,0x1f0));var _0x8018=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x0188[_0x455c6c];return _0x488242;};'use strict';var _=require(_0x8018('0x0'));var util=require('util');exports[_0x8018('0x1')]=function(_0x4a94d5,_0x248859,_0xf216e0){var _0x29750f=[];if(_0x4a94d5[_0x8018('0x2')]>0x0){var _0x2e8c1a=_[_0x8018('0x3')](_0x4a94d5,['id']);for(var _0x399a27=0x0;_0x399a27<_0x2e8c1a[_0x8018('0x2')];_0x399a27++){var _0x590866=_0x2e8c1a[_0x399a27];if(_0x590866['type']===_0x8018('0x4')){_0x29750f[_0x8018('0x5')](_0x590866['content']);}else if(_0x590866[_0x8018('0x6')]==='variable'&&_0x590866['variableName']){_0x248859[_0x590866[_0x8018('0x7')]]&&_0x29750f[_0x8018('0x5')](_0x248859[_0x590866[_0x8018('0x7')]]['toString']());}else if(_0x590866['type']===_0x8018('0x8')&&_0x590866['Variable']&&_0x590866[_0x8018('0x9')]['name']){_0x248859[_0x590866[_0x8018('0x9')]['name'][_0x8018('0xa')]()]&&_0x29750f[_0x8018('0x5')](_0x248859[_0x590866[_0x8018('0x9')][_0x8018('0xb')][_0x8018('0xa')]()][_0x8018('0xc')]());}else if(_0x590866[_0x8018('0x6')]===_0x8018('0xd')){if(_0x590866[_0x8018('0xe')]===_0x8018('0x4')&&_0x590866[_0x8018('0xf')]){_0x29750f[_0x8018('0x5')](util[_0x8018('0x10')](_0x8018('0x11'),_0x590866['key'],_0x590866[_0x8018('0x12')]));}else if(_0x590866[_0x8018('0xe')]===_0x8018('0x13')&&_0x590866[_0x8018('0x7')]&&_0x590866[_0x8018('0xf')]){_0x248859[_0x590866['variableName']]&&_0x29750f[_0x8018('0x5')](util[_0x8018('0x10')](_0x8018('0x11'),_0x590866[_0x8018('0xf')],_0x248859[_0x590866[_0x8018('0x7')]]));}else if(_0x590866['keyType']===_0x8018('0x8')&&_0x590866[_0x8018('0x9')]&&_0x590866[_0x8018('0x9')][_0x8018('0xb')]&&_0x590866[_0x8018('0xf')]){_0x248859[_0x590866[_0x8018('0x9')][_0x8018('0xb')][_0x8018('0xa')]()]&&_0x29750f[_0x8018('0x5')](util[_0x8018('0x10')]('%s:\x20%s',_0x590866[_0x8018('0xf')],_0x248859[_0x590866[_0x8018('0x9')][_0x8018('0xb')]['toLowerCase']()]));}}}}return _0x29750f[_0x8018('0x14')](_0xf216e0);};exports['stripTrailingSlash']=function(_0x1955ec){var _0x5eb67d=_0x1955ec[_0x8018('0x15')](-0x1);if(_0x5eb67d==='/'){_0x1955ec=_0x1955ec[_0x8018('0x16')](0x0,_0x1955ec[_0x8018('0x17')](_0x5eb67d));}return _0x1955ec;};exports[_0x8018('0x18')]=function(_0xce2191){if(!_[_0x8018('0x19')](_0xce2191)&&_0xce2191!==''){var _0x23507a=/^(([^<>()\[\]\\.,;:\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 _0x23507a[_0x8018('0x1a')](String(_0xce2191)[_0x8018('0xa')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 213f2a8..977433b 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x2c1acc,_0x485af9){var _0x90bd4e=function(_0x43ee90){while(--_0x43ee90){_0x2c1acc['push'](_0x2c1acc['shift']());}};_0x90bd4e(++_0x485af9);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 3a3aeda..e4b64cd 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 _0xaecb=['count','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/users.json','POST','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','base64','debug','stringify','GET','length','map','forEach','string','picklist','type','customField','nameField','content','toString','includes','custom_fields','push','idField','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','inspect','outbound','none','[OUTBOUND]','uniqueid','Authorization','destcalleridname','destcalleridnum','newTab','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s'];(function(_0x469ae5,_0x1e413f){var _0x1dca37=function(_0x10cd6a){while(--_0x10cd6a){_0x469ae5['push'](_0x469ae5['shift']());}};_0x1dca37(++_0x1e413f);}(_0xaecb,0x19e));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xbaec('0x0'));var rp=require(_0xbaec('0x1'));var md5=require(_0xbaec('0x2'));var util=require(_0xbaec('0x3'));var Redis=require('ioredis');var intUtil=require(_0xbaec('0x4'));var config=require(_0xbaec('0x5'));var logger=require(_0xbaec('0x6'))('zendesk');config[_0xbaec('0x7')]=_[_0xbaec('0x8')](config['redis'],{'host':_0xbaec('0x9'),'port':0x18eb});var io=require(_0xbaec('0xa'))(new Redis(config[_0xbaec('0x7')]));function emit(_0x4121cf,_0x21322f,_0x39c947){io['to'](_0x4121cf)[_0xbaec('0xb')](_0x21322f,_0x39c947);}var headers={'Content-Type':_0xbaec('0xc'),'Accept':'application/json'};function getTicket(_0x5d0953,_0xf0c18f,_0x5199ed,_0x3212ef,_0x100b08){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xbaec('0xd')](_0xbaec('0xe'),_0x5d0953[_0xbaec('0xf')]),'method':'POST','body':{'ticket':_[_0xbaec('0x10')]({'requester_id':_0x5199ed['id'],'submitter_id':_0xf0c18f?_0xf0c18f['id']:undefined,'assignee_id':_0xf0c18f?_0xf0c18f['id']:undefined,'tags':getTags(_0x3212ef[_0xbaec('0x11')],_0xbaec('0x12')),'subject':intUtil[_0xbaec('0x13')](_0x3212ef[_0xbaec('0x14')],_0x100b08,'\x20'),'description':intUtil['getString'](_0x3212ef[_0xbaec('0x15')],_0x100b08,'\x0a'),'comment':{'public':![],'body':intUtil[_0xbaec('0x13')](_0x3212ef[_0xbaec('0x15')],_0x100b08,'\x0a')}},getCustomFields(_0x3212ef[_0xbaec('0x16')],_0x100b08))}})[_0xbaec('0x17')](function(_0x136e04){logger['info']('Ticket\x20created!');return _0x136e04[_0xbaec('0x18')];});}function getUser(_0x3009ed,_0x3b043f){if(intUtil[_0xbaec('0x19')](_0x3b043f)){logger[_0xbaec('0x1a')](_0xbaec('0x1b'),_0x3b043f);return request({'uri':util[_0xbaec('0xd')](_0xbaec('0x1c'),_0x3009ed[_0xbaec('0xf')]),'qs':{'query':util[_0xbaec('0xd')](_0xbaec('0x1d'),_0x3b043f)}})[_0xbaec('0x17')](function(_0x2d0419){if(_0x2d0419[_0xbaec('0x1e')]){logger['info']('Agent\x20found!');return _[_0xbaec('0x1f')](_0x2d0419[_0xbaec('0x20')],{'email':_0x3b043f,'role':'agent'});}else{logger['info'](_0xbaec('0x21'));return request({'uri':util['format'](_0xbaec('0x22'),_0x3009ed[_0xbaec('0xf')])})['then'](function(_0x32e3b8){logger['info'](_0xbaec('0x23'));return _0x32e3b8[_0xbaec('0x24')];});}});}else{logger[_0xbaec('0x1a')](_0xbaec('0x21'));return request({'uri':util[_0xbaec('0xd')](_0xbaec('0x22'),_0x3009ed['remoteUri'])})[_0xbaec('0x17')](function(_0x370800){logger[_0xbaec('0x1a')](_0xbaec('0x23'));return _0x370800[_0xbaec('0x24')];});}}function getEndUser(_0x3efca5,_0x14a5c8,_0x1918bb){logger[_0xbaec('0x1a')](_0xbaec('0x25'),_0x1918bb);return request({'uri':util['format'](_0xbaec('0x1c'),_0x3efca5['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x1918bb)}})[_0xbaec('0x17')](function(_0x3a63ff){var _0x1ffaa4;if(_0x3a63ff['results']['length']){_0x3a63ff[_0xbaec('0x20')]=_['filter'](_0x3a63ff['results'],{'suspended':![],'role':'end-user'});if(_0x3a63ff[_0xbaec('0x20')]['length']){_0x1ffaa4=_['first'](_0x3a63ff[_0xbaec('0x20')]);}}if(_0x1ffaa4){logger[_0xbaec('0x1a')]('Enduser\x20found!');return _0x1ffaa4;}else{logger[_0xbaec('0x1a')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbaec('0xd')](_0xbaec('0x26'),_0x3efca5[_0xbaec('0xf')]),'method':_0xbaec('0x27'),'body':{'user':{'role':_0xbaec('0x28'),'name':util[_0xbaec('0xd')](_0xbaec('0x29'),_0x14a5c8||_0x1918bb),'phone':_0x1918bb}}})[_0xbaec('0x17')](function(_0x5629b9){logger['info'](_0xbaec('0x2a'));return _0x5629b9[_0xbaec('0x24')];});}});}function getAuth(_0x42af49){var _0x9f6d59;if(_0x42af49[_0xbaec('0x2b')]===_0xbaec('0x2c')){_0x9f6d59=util[_0xbaec('0xd')](_0xbaec('0x2d'),_0x42af49['username'],_0x42af49[_0xbaec('0x2c')]);}else if(_0x42af49[_0xbaec('0x2b')]===_0xbaec('0x2e')){_0x9f6d59=util['format'](_0xbaec('0x2f'),_0x42af49[_0xbaec('0x30')],_0x42af49[_0xbaec('0x2e')]);}return util[_0xbaec('0xd')]('Basic\x20%s',new Buffer(_0x9f6d59)['toString'](_0xbaec('0x31')));}function request(_0x50c81a){logger[_0xbaec('0x32')]('[HTTP]',JSON[_0xbaec('0x33')](_0x50c81a));return rp(_[_0xbaec('0x8')](_0x50c81a,{'method':_0xbaec('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x13573b,_0x105fa0){var _0xb7242c=[];if(_0x13573b&&_0x13573b[_0xbaec('0x35')]>0x0){_0xb7242c=_[_0xbaec('0x36')](_0x13573b,_0x105fa0);}return _0xb7242c;}function getCustomFields(_0x4b5d0f,_0x18b491){var _0x4048f6=[];var _0x75a1a3={'custom_fields':[]};if(_0x4b5d0f['length']>0x0){_[_0xbaec('0x37')](_0x4b5d0f,function(_0x1155ec){if(_['includes']([_0xbaec('0x38'),_0xbaec('0x39')],_0x1155ec[_0xbaec('0x3a')])&&_0x1155ec['nameField']&&!_0x1155ec[_0xbaec('0x3b')]){_0x75a1a3[_0x1155ec[_0xbaec('0x3c')]['toLowerCase']()]=_0x1155ec[_0xbaec('0x3d')][_0xbaec('0x3e')]();}else if(_[_0xbaec('0x3f')]([_0xbaec('0x38'),'picklist'],_0x1155ec['type'])&&_0x1155ec['idField']&&_0x1155ec[_0xbaec('0x3b')]){_0x75a1a3[_0xbaec('0x40')][_0xbaec('0x41')]({'id':_0x1155ec[_0xbaec('0x42')],'value':_0x1155ec[_0xbaec('0x3d')][_0xbaec('0x3e')]()});}else if(_0x1155ec[_0xbaec('0x3a')]===_0xbaec('0x43')&&_0x1155ec['variableName']&&_0x1155ec[_0xbaec('0x42')]&&_0x1155ec[_0xbaec('0x3b')]){_0x18b491[_0x1155ec[_0xbaec('0x44')]]&&_0x75a1a3[_0xbaec('0x40')][_0xbaec('0x41')]({'id':_0x1155ec['idField'],'value':_0x18b491[_0x1155ec['variableName']][_0xbaec('0x3e')]()});}else if(_0x1155ec[_0xbaec('0x3a')]===_0xbaec('0x45')&&_0x1155ec[_0xbaec('0x46')]&&_0x1155ec[_0xbaec('0x46')][_0xbaec('0x12')]&&_0x1155ec['idField']&&_0x1155ec[_0xbaec('0x3b')]){_0x18b491[_0x1155ec[_0xbaec('0x46')][_0xbaec('0x12')][_0xbaec('0x47')]()]&&_0x75a1a3[_0xbaec('0x40')][_0xbaec('0x41')]({'id':_0x1155ec['idField'],'value':_0x18b491[_0x1155ec['Variable'][_0xbaec('0x12')]['toLowerCase']()]['toString']()});}});}return _0x75a1a3;}exports['queue']=function(_0x3d7fde,_0x305ff5,_0xd66631,_0x11f3ee,_0xbacc19,_0x1f985f){var _0x35f1f5,_0x840014;_0x1f985f[_0xbaec('0xf')]=intUtil[_0xbaec('0x48')](_0x1f985f['remoteUri']);_0x1f985f[_0xbaec('0x49')]=intUtil[_0xbaec('0x48')](_0x1f985f['serverUrl']);if(_0xbacc19&&_0xbacc19['monitor_format']){logger[_0xbaec('0x1a')](_0xbaec('0x4a'),_0xbaec('0x4b'));_0x305ff5['recordingURL']=util[_0xbaec('0xd')](_0xbaec('0x4c'),_0x1f985f[_0xbaec('0x49')],_0x305ff5['uniqueid'],md5(_0x305ff5['uniqueid']));}else{_0x305ff5[_0xbaec('0x4d')]='';}headers['Authorization']=getAuth(_0x1f985f);return getUser(_0x1f985f,_0x11f3ee[_0xbaec('0x4e')])[_0xbaec('0x17')](function(_0xbdd739){_0x35f1f5=_0xbdd739;logger['info'](_0xbaec('0x4f'),_0x35f1f5['id']);return getEndUser(_0x1f985f,_0x305ff5['calleridname'],_0x305ff5[_0xbaec('0x50')]);})[_0xbaec('0x17')](function(_0x9d38c6){_0x840014=_0x9d38c6;logger[_0xbaec('0x1a')](_0xbaec('0x51'),_0x840014['id']);return getTicket(_0x1f985f,_0x35f1f5,_0x840014,_0xd66631,_0x305ff5);})['then'](function(_0x57fd8f){if(_0x57fd8f){logger[_0xbaec('0x1a')](_0xbaec('0x52'),_0x57fd8f['id']);switch(_0x1f985f['type']){case _0xbaec('0x53'):logger['info'](_0xbaec('0x4a'),_0xbaec('0x54'));return request({'uri':util[_0xbaec('0xd')](_0xbaec('0x55'),_0x1f985f[_0xbaec('0xf')],_0x35f1f5['id'],_0x57fd8f['id']),'method':_0xbaec('0x27')});case'newTab':logger['info'](_0xbaec('0x4a'),_0xbaec('0x56'));emit(util[_0xbaec('0xd')](_0xbaec('0x57'),_0x11f3ee[_0xbaec('0x12')]),_0xbaec('0x58'),{'uri':util[_0xbaec('0xd')]('%s/agent/tickets/%s',_0x1f985f[_0xbaec('0xf')][_0xbaec('0x59')]('/api/v2',''),_0x57fd8f['id'])});break;default:logger[_0xbaec('0x5a')](_0xbaec('0x4a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x38e97a){logger[_0xbaec('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xbaec('0x5b')](_0x38e97a,{'showHidden':!![],'depth':null}));});};exports[_0xbaec('0x5c')]=function(_0x4cc49a,_0x392edd,_0x572b99,_0xc7701d,_0x14ed14,_0x1770db,_0x4b5a11){var _0x254c09,_0x4f7df3;_0x1770db[_0xbaec('0xf')]=intUtil[_0xbaec('0x48')](_0x1770db[_0xbaec('0xf')]);_0x1770db[_0xbaec('0x49')]=intUtil[_0xbaec('0x48')](_0x1770db[_0xbaec('0x49')]);if(_0x4b5a11&&_0x4b5a11['recordingFormat']&&_0x4b5a11['recordingFormat']!==_0xbaec('0x5d')){logger['info'](_0xbaec('0x5e'),'Recording\x20is\x20enabled!');_0x392edd[_0xbaec('0x4d')]=util[_0xbaec('0xd')](_0xbaec('0x4c'),_0x1770db['serverUrl'],_0x392edd['uniqueid'],md5(_0x392edd[_0xbaec('0x5f')]));}headers[_0xbaec('0x60')]=getAuth(_0x1770db);return getUser(_0x1770db,_0xc7701d[_0xbaec('0x4e')])['then'](function(_0x35adcf){_0x254c09=_0x35adcf;logger['info'](_0xbaec('0x4f'),_0x254c09['id']);return getEndUser(_0x1770db,_0x392edd[_0xbaec('0x61')],_0x392edd[_0xbaec('0x62')]);})[_0xbaec('0x17')](function(_0xa540c3){_0x4f7df3=_0xa540c3;logger['info'](_0xbaec('0x51'),_0x4f7df3['id']);return getTicket(_0x1770db,_0x254c09,_0x4f7df3,_0x572b99,_0x392edd);})['then'](function(_0x2ce8c2){if(_0x2ce8c2){logger[_0xbaec('0x1a')](_0xbaec('0x52'),_0x2ce8c2['id']);switch(_0x1770db[_0xbaec('0x3a')]){case _0xbaec('0x53'):logger[_0xbaec('0x1a')](_0xbaec('0x5e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xbaec('0xd')](_0xbaec('0x55'),_0x1770db[_0xbaec('0xf')],_0x254c09['id'],_0x2ce8c2['id']),'method':_0xbaec('0x27')});case _0xbaec('0x63'):logger[_0xbaec('0x1a')](_0xbaec('0x5e'),_0xbaec('0x56'));emit(util[_0xbaec('0xd')](_0xbaec('0x57'),_0xc7701d['name']),_0xbaec('0x58'),{'uri':util[_0xbaec('0xd')](_0xbaec('0x64'),_0x1770db[_0xbaec('0xf')][_0xbaec('0x59')](_0xbaec('0x65'),''),_0x2ce8c2['id'])});break;default:logger[_0xbaec('0x5a')](_0xbaec('0x5e'),_0xbaec('0x66'));}}})[_0xbaec('0x67')](function(_0x4066e1){logger[_0xbaec('0x5a')](_0xbaec('0x68'),util['inspect'](_0x4066e1,{'showHidden':!![],'depth':null}));});};exports[_0xbaec('0x69')]=function(_0x1591bd,_0x1b1f1c,_0x189dad,_0x5d0297,_0x396f07,_0x191333){var _0x584dc2,_0xeba6e5;_0x191333[_0xbaec('0xf')]=intUtil[_0xbaec('0x48')](_0x191333[_0xbaec('0xf')]);_0x191333[_0xbaec('0x49')]=intUtil[_0xbaec('0x48')](_0x191333[_0xbaec('0x49')]);if(_0x396f07&&_0x396f07[_0xbaec('0x6a')]){logger[_0xbaec('0x1a')]('['+_0x1b1f1c[_0xbaec('0x6b')][_0xbaec('0x6c')]()+']','Recording\x20is\x20enabled!');_0x1b1f1c[_0xbaec('0x4d')]=util[_0xbaec('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x191333[_0xbaec('0x49')],_0x1b1f1c[_0xbaec('0x5f')],md5(_0x1b1f1c[_0xbaec('0x5f')]));}else{_0x1b1f1c['recordingURL']='';}headers[_0xbaec('0x60')]=getAuth(_0x191333);return getUser(_0x191333)['then'](function(_0x140e6b){_0x584dc2=_0x140e6b;logger[_0xbaec('0x1a')](_0xbaec('0x4f'),_0x584dc2['id']);return getEndUser(_0x191333,_0x1b1f1c[_0xbaec('0x6d')],_0x1b1f1c[_0xbaec('0x50')]);})[_0xbaec('0x17')](function(_0x44935e){_0xeba6e5=_0x44935e;logger[_0xbaec('0x1a')]('The\x20Enduser\x20ID\x20is:',_0xeba6e5['id']);return getTicket(_0x191333,_0x584dc2,_0xeba6e5,_0x189dad,_0x1b1f1c);})[_0xbaec('0x17')](function(_0x2142ba){if(_0x2142ba){logger['info'](_0xbaec('0x52'),_0x2142ba['id']);}})[_0xbaec('0x67')](function(_0x1e1a60){logger[_0xbaec('0x5a')]('['+_0x1b1f1c[_0xbaec('0x6b')][_0xbaec('0x6c')]()+']'+_0xbaec('0x6e'),util['inspect'](_0x1e1a60,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdaec=['stringify','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','customField','custom_fields','push','variable','variableName','idField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%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','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','newTab','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','../../../../config/logger','zendesk','redis','defaults','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','format','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','base64','debug','[HTTP]'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0xdaec,0x188));var _0xcdae=function(_0x31b2d3,_0x2a787){_0x31b2d3=_0x31b2d3-0x0;var _0x583cfc=_0xdaec[_0x31b2d3];return _0x583cfc;};'use strict';var _=require(_0xcdae('0x0'));var rp=require(_0xcdae('0x1'));var md5=require(_0xcdae('0x2'));var util=require(_0xcdae('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xcdae('0x4'))(_0xcdae('0x5'));config[_0xcdae('0x6')]=_[_0xcdae('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcdae('0x6')]));function emit(_0x553978,_0x32f686,_0x33a53b){io['to'](_0x553978)['emit'](_0x32f686,_0x33a53b);}var headers={'Content-Type':'application/json','Accept':_0xcdae('0x8')};function getTicket(_0x1fb91f,_0x6945eb,_0x4f8ceb,_0x54a9f4,_0xf91798){logger[_0xcdae('0x9')](_0xcdae('0xa'));return request({'uri':util['format'](_0xcdae('0xb'),_0x1fb91f[_0xcdae('0xc')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x4f8ceb['id'],'submitter_id':_0x6945eb?_0x6945eb['id']:undefined,'assignee_id':_0x6945eb?_0x6945eb['id']:undefined,'tags':getTags(_0x54a9f4[_0xcdae('0xd')],_0xcdae('0xe')),'subject':intUtil[_0xcdae('0xf')](_0x54a9f4[_0xcdae('0x10')],_0xf91798,'\x20'),'description':intUtil[_0xcdae('0xf')](_0x54a9f4[_0xcdae('0x11')],_0xf91798,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcdae('0xf')](_0x54a9f4[_0xcdae('0x11')],_0xf91798,'\x0a')}},getCustomFields(_0x54a9f4[_0xcdae('0x12')],_0xf91798))}})[_0xcdae('0x13')](function(_0x146a7f){logger['info'](_0xcdae('0x14'));return _0x146a7f[_0xcdae('0x15')];});}function getUser(_0x963aaf,_0x469727){if(intUtil['validateEmail'](_0x469727)){logger['info']('Getting\x20agent\x20with\x20email',_0x469727);return request({'uri':util[_0xcdae('0x16')]('%s/search.json',_0x963aaf['remoteUri']),'qs':{'query':util[_0xcdae('0x16')](_0xcdae('0x17'),_0x469727)}})['then'](function(_0x450bdc){if(_0x450bdc['count']){logger['info'](_0xcdae('0x18'));return _[_0xcdae('0x19')](_0x450bdc[_0xcdae('0x1a')],{'email':_0x469727,'role':'agent'});}else{logger['info'](_0xcdae('0x1b'));return request({'uri':util[_0xcdae('0x16')](_0xcdae('0x1c'),_0x963aaf['remoteUri'])})[_0xcdae('0x13')](function(_0x591d23){logger[_0xcdae('0x9')](_0xcdae('0x1d'));return _0x591d23[_0xcdae('0x1e')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xcdae('0x16')](_0xcdae('0x1c'),_0x963aaf[_0xcdae('0xc')])})[_0xcdae('0x13')](function(_0x401a81){logger[_0xcdae('0x9')](_0xcdae('0x1d'));return _0x401a81['user'];});}}function getEndUser(_0x3f21d7,_0x24990f,_0x22a3a5){logger[_0xcdae('0x9')]('Searching\x20enduser\x20with\x20phone',_0x22a3a5);return request({'uri':util[_0xcdae('0x16')](_0xcdae('0x1f'),_0x3f21d7['remoteUri']),'qs':{'query':util['format'](_0xcdae('0x20'),_0x22a3a5)}})['then'](function(_0x3bb5cd){var _0x5ed79c;if(_0x3bb5cd[_0xcdae('0x1a')][_0xcdae('0x21')]){_0x3bb5cd['results']=_[_0xcdae('0x22')](_0x3bb5cd[_0xcdae('0x1a')],{'suspended':![],'role':_0xcdae('0x23')});if(_0x3bb5cd[_0xcdae('0x1a')]['length']){_0x5ed79c=_[_0xcdae('0x24')](_0x3bb5cd[_0xcdae('0x1a')]);}}if(_0x5ed79c){logger[_0xcdae('0x9')]('Enduser\x20found!');return _0x5ed79c;}else{logger[_0xcdae('0x9')](_0xcdae('0x25'));return request({'uri':util[_0xcdae('0x16')](_0xcdae('0x26'),_0x3f21d7[_0xcdae('0xc')]),'method':_0xcdae('0x27'),'body':{'user':{'role':_0xcdae('0x23'),'name':util['format'](_0xcdae('0x28'),_0x24990f||_0x22a3a5),'phone':_0x22a3a5}}})[_0xcdae('0x13')](function(_0x399a9a){logger[_0xcdae('0x9')](_0xcdae('0x29'));return _0x399a9a[_0xcdae('0x1e')];});}});}function getAuth(_0x46b935){var _0x5967b3;if(_0x46b935['authType']===_0xcdae('0x2a')){_0x5967b3=util[_0xcdae('0x16')](_0xcdae('0x2b'),_0x46b935[_0xcdae('0x2c')],_0x46b935[_0xcdae('0x2a')]);}else if(_0x46b935[_0xcdae('0x2d')]==='token'){_0x5967b3=util[_0xcdae('0x16')](_0xcdae('0x2e'),_0x46b935[_0xcdae('0x2c')],_0x46b935[_0xcdae('0x2f')]);}return util['format'](_0xcdae('0x30'),new Buffer(_0x5967b3)['toString'](_0xcdae('0x31')));}function request(_0x5328c4){logger[_0xcdae('0x32')](_0xcdae('0x33'),JSON[_0xcdae('0x34')](_0x5328c4));return rp(_[_0xcdae('0x7')](_0x5328c4,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x507dd2,_0x54cbc2){var _0x52a1e3=[];if(_0x507dd2&&_0x507dd2['length']>0x0){_0x52a1e3=_[_0xcdae('0x35')](_0x507dd2,_0x54cbc2);}return _0x52a1e3;}function getCustomFields(_0x3af4ed,_0xd2a1b2){var _0x3f9aa6=[];var _0x210056={'custom_fields':[]};if(_0x3af4ed[_0xcdae('0x21')]>0x0){_[_0xcdae('0x36')](_0x3af4ed,function(_0x3d2b92){if(_[_0xcdae('0x37')]([_0xcdae('0x38'),_0xcdae('0x39')],_0x3d2b92[_0xcdae('0x3a')])&&_0x3d2b92[_0xcdae('0x3b')]&&!_0x3d2b92['customField']){_0x210056[_0x3d2b92['nameField'][_0xcdae('0x3c')]()]=_0x3d2b92[_0xcdae('0x3d')][_0xcdae('0x3e')]();}else if(_[_0xcdae('0x37')]([_0xcdae('0x38'),_0xcdae('0x39')],_0x3d2b92['type'])&&_0x3d2b92['idField']&&_0x3d2b92[_0xcdae('0x3f')]){_0x210056[_0xcdae('0x40')][_0xcdae('0x41')]({'id':_0x3d2b92['idField'],'value':_0x3d2b92[_0xcdae('0x3d')]['toString']()});}else if(_0x3d2b92[_0xcdae('0x3a')]===_0xcdae('0x42')&&_0x3d2b92[_0xcdae('0x43')]&&_0x3d2b92['idField']&&_0x3d2b92[_0xcdae('0x3f')]){_0xd2a1b2[_0x3d2b92['variableName']]&&_0x210056[_0xcdae('0x40')][_0xcdae('0x41')]({'id':_0x3d2b92[_0xcdae('0x44')],'value':_0xd2a1b2[_0x3d2b92[_0xcdae('0x43')]]['toString']()});}else if(_0x3d2b92[_0xcdae('0x3a')]===_0xcdae('0x45')&&_0x3d2b92['Variable']&&_0x3d2b92[_0xcdae('0x46')][_0xcdae('0xe')]&&_0x3d2b92['idField']&&_0x3d2b92[_0xcdae('0x3f')]){_0xd2a1b2[_0x3d2b92[_0xcdae('0x46')][_0xcdae('0xe')][_0xcdae('0x3c')]()]&&_0x210056[_0xcdae('0x40')][_0xcdae('0x41')]({'id':_0x3d2b92[_0xcdae('0x44')],'value':_0xd2a1b2[_0x3d2b92[_0xcdae('0x46')][_0xcdae('0xe')][_0xcdae('0x3c')]()][_0xcdae('0x3e')]()});}});}return _0x210056;}exports[_0xcdae('0x47')]=function(_0x1eaaa8,_0x5246c6,_0x255e9b,_0x4616f3,_0x9e92ee,_0x1ab202){var _0x52c847,_0x348050;_0x1ab202['remoteUri']=intUtil[_0xcdae('0x48')](_0x1ab202[_0xcdae('0xc')]);_0x1ab202['serverUrl']=intUtil['stripTrailingSlash'](_0x1ab202[_0xcdae('0x49')]);if(_0x9e92ee&&_0x9e92ee[_0xcdae('0x4a')]){logger[_0xcdae('0x9')](_0xcdae('0x4b'),_0xcdae('0x4c'));_0x5246c6[_0xcdae('0x4d')]=util['format'](_0xcdae('0x4e'),_0x1ab202[_0xcdae('0x49')],_0x5246c6['uniqueid'],md5(_0x5246c6[_0xcdae('0x4f')]));}else{_0x5246c6[_0xcdae('0x4d')]='';}headers[_0xcdae('0x50')]=getAuth(_0x1ab202);return getUser(_0x1ab202,_0x4616f3[_0xcdae('0x51')])[_0xcdae('0x13')](function(_0x4b47c7){_0x52c847=_0x4b47c7;logger[_0xcdae('0x9')]('The\x20User\x20ID\x20is:',_0x52c847['id']);return getEndUser(_0x1ab202,_0x5246c6[_0xcdae('0x52')],_0x5246c6[_0xcdae('0x53')]);})[_0xcdae('0x13')](function(_0x41f50b){_0x348050=_0x41f50b;logger[_0xcdae('0x9')](_0xcdae('0x54'),_0x348050['id']);return getTicket(_0x1ab202,_0x52c847,_0x348050,_0x255e9b,_0x5246c6);})[_0xcdae('0x13')](function(_0x4e031b){if(_0x4e031b){logger['info'](_0xcdae('0x55'),_0x4e031b['id']);switch(_0x1ab202['type']){case _0xcdae('0x56'):logger[_0xcdae('0x9')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xcdae('0x16')](_0xcdae('0x57'),_0x1ab202[_0xcdae('0xc')],_0x52c847['id'],_0x4e031b['id']),'method':_0xcdae('0x27')});case'newTab':logger[_0xcdae('0x9')]('[QUEUE]',_0xcdae('0x58'));emit(util[_0xcdae('0x16')](_0xcdae('0x59'),_0x4616f3[_0xcdae('0xe')]),_0xcdae('0x5a'),{'uri':util['format'](_0xcdae('0x5b'),_0x1ab202[_0xcdae('0xc')]['replace']('/api/v2',''),_0x4e031b['id'])});break;default:logger[_0xcdae('0x5c')](_0xcdae('0x4b'),_0xcdae('0x5d'));}}})[_0xcdae('0x5e')](function(_0x39032d){logger[_0xcdae('0x5c')](_0xcdae('0x5f'),util[_0xcdae('0x60')](_0x39032d,{'showHidden':!![],'depth':null}));});};exports[_0xcdae('0x61')]=function(_0x542381,_0x57b3b5,_0x5a68fd,_0x139b8a,_0x25116f,_0x4d2409,_0x1484c5){var _0x184e73,_0x100c31;_0x4d2409['remoteUri']=intUtil[_0xcdae('0x48')](_0x4d2409['remoteUri']);_0x4d2409[_0xcdae('0x49')]=intUtil[_0xcdae('0x48')](_0x4d2409[_0xcdae('0x49')]);if(_0x1484c5&&_0x1484c5[_0xcdae('0x62')]&&_0x1484c5['recordingFormat']!=='none'){logger[_0xcdae('0x9')](_0xcdae('0x63'),_0xcdae('0x4c'));_0x57b3b5[_0xcdae('0x4d')]=util[_0xcdae('0x16')](_0xcdae('0x4e'),_0x4d2409[_0xcdae('0x49')],_0x57b3b5['uniqueid'],md5(_0x57b3b5[_0xcdae('0x4f')]));}headers[_0xcdae('0x50')]=getAuth(_0x4d2409);return getUser(_0x4d2409,_0x139b8a['email'])[_0xcdae('0x13')](function(_0x3b6ce1){_0x184e73=_0x3b6ce1;logger[_0xcdae('0x9')](_0xcdae('0x64'),_0x184e73['id']);return getEndUser(_0x4d2409,_0x57b3b5['destcalleridname'],_0x57b3b5[_0xcdae('0x65')]);})[_0xcdae('0x13')](function(_0x5ddf8f){_0x100c31=_0x5ddf8f;logger['info'](_0xcdae('0x54'),_0x100c31['id']);return getTicket(_0x4d2409,_0x184e73,_0x100c31,_0x5a68fd,_0x57b3b5);})['then'](function(_0x3213b0){if(_0x3213b0){logger['info'](_0xcdae('0x55'),_0x3213b0['id']);switch(_0x4d2409['type']){case _0xcdae('0x56'):logger[_0xcdae('0x9')]('[OUTBOUND]',_0xcdae('0x66'));return request({'uri':util[_0xcdae('0x16')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4d2409[_0xcdae('0xc')],_0x184e73['id'],_0x3213b0['id']),'method':'POST'});case _0xcdae('0x67'):logger['info'](_0xcdae('0x63'),_0xcdae('0x58'));emit(util[_0xcdae('0x16')](_0xcdae('0x59'),_0x139b8a[_0xcdae('0xe')]),_0xcdae('0x5a'),{'uri':util[_0xcdae('0x16')](_0xcdae('0x5b'),_0x4d2409[_0xcdae('0xc')][_0xcdae('0x68')](_0xcdae('0x69'),''),_0x3213b0['id'])});break;default:logger['error'](_0xcdae('0x63'),_0xcdae('0x5d'));}}})[_0xcdae('0x5e')](function(_0x4e80f3){logger[_0xcdae('0x5c')](_0xcdae('0x6a'),util[_0xcdae('0x60')](_0x4e80f3,{'showHidden':!![],'depth':null}));});};exports[_0xcdae('0x6b')]=function(_0x329a1f,_0x1c78ec,_0x35277e,_0x179831,_0x1ccb09,_0x2dfe53){var _0x286823,_0x23c5d6;_0x2dfe53[_0xcdae('0xc')]=intUtil[_0xcdae('0x48')](_0x2dfe53[_0xcdae('0xc')]);_0x2dfe53['serverUrl']=intUtil[_0xcdae('0x48')](_0x2dfe53[_0xcdae('0x49')]);if(_0x1ccb09&&_0x1ccb09[_0xcdae('0x4a')]){logger[_0xcdae('0x9')]('['+_0x1c78ec['lastevent'][_0xcdae('0x6c')]()+']','Recording\x20is\x20enabled!');_0x1c78ec[_0xcdae('0x4d')]=util[_0xcdae('0x16')](_0xcdae('0x4e'),_0x2dfe53[_0xcdae('0x49')],_0x1c78ec[_0xcdae('0x4f')],md5(_0x1c78ec[_0xcdae('0x4f')]));}else{_0x1c78ec[_0xcdae('0x4d')]='';}headers[_0xcdae('0x50')]=getAuth(_0x2dfe53);return getUser(_0x2dfe53)[_0xcdae('0x13')](function(_0x2b1105){_0x286823=_0x2b1105;logger[_0xcdae('0x9')](_0xcdae('0x64'),_0x286823['id']);return getEndUser(_0x2dfe53,_0x1c78ec[_0xcdae('0x52')],_0x1c78ec['calleridnum']);})['then'](function(_0x6d50bf){_0x23c5d6=_0x6d50bf;logger['info'](_0xcdae('0x54'),_0x23c5d6['id']);return getTicket(_0x2dfe53,_0x286823,_0x23c5d6,_0x35277e,_0x1c78ec);})[_0xcdae('0x13')](function(_0xa9b7d8){if(_0xa9b7d8){logger[_0xcdae('0x9')](_0xcdae('0x55'),_0xa9b7d8['id']);}})[_0xcdae('0x5e')](function(_0x2ffafd){logger[_0xcdae('0x5c')]('['+_0x1c78ec[_0xcdae('0x6d')][_0xcdae('0x6c')]()+']'+_0xcdae('0x6e'),util['inspect'](_0x2ffafd,{'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 f1b91cd..3476269 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 _0x13a2=['answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Inbound','Fields','/crm/v2/Calls','err','queue','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','./util','moment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','user','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime'];(function(_0x2dee2f,_0x19572f){var _0x327c18=function(_0x130ec0){while(--_0x130ec0){_0x2dee2f['push'](_0x2dee2f['shift']());}};_0x327c18(++_0x19572f);}(_0x13a2,0x175));var _0x213a=function(_0x2ee50f,_0x1ca83f){_0x2ee50f=_0x2ee50f-0x0;var _0x2fdd95=_0x13a2[_0x2ee50f];return _0x2fdd95;};'use strict';var _=require(_0x213a('0x0'));var rp=require(_0x213a('0x1'));var md5=require(_0x213a('0x2'));var util=require('util');var intUtil=require(_0x213a('0x3'));var moment=require(_0x213a('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x213a('0x5'))(_0x213a('0x6'));config[_0x213a('0x7')]=_['defaults'](config[_0x213a('0x7')],{'host':_0x213a('0x8'),'port':0x18eb});var io=require(_0x213a('0x9'))(new Redis(config[_0x213a('0x7')]));function emit(_0x5aa9bc,_0x11ad98,_0x4b6a39){io['to'](_0x5aa9bc)[_0x213a('0xa')](_0x11ad98,_0x4b6a39);}function request(_0xded729){logger[_0x213a('0xb')](_0x213a('0xc'),JSON[_0x213a('0xd')](_0xded729));return rp(_0xded729);}function getCustomFields(_0x335da8,_0x584389){var _0x4883b9={};if(_0x335da8['length']>0x0){_[_0x213a('0xe')](_0x335da8,function(_0x52c60e){if(_[_0x213a('0xf')]([_0x213a('0x10'),_0x213a('0x11')],_0x52c60e[_0x213a('0x12')])&&_0x52c60e[_0x213a('0x13')]){_0x4883b9[_0x52c60e[_0x213a('0x13')]]=_0x52c60e[_0x213a('0x14')][_0x213a('0x15')]();}else if(_0x52c60e[_0x213a('0x12')]===_0x213a('0x16')&&_0x52c60e[_0x213a('0x17')]&&_0x52c60e[_0x213a('0x13')]&&_0x584389[_0x52c60e[_0x213a('0x17')]]){_0x4883b9[_0x52c60e[_0x213a('0x13')]]=_0x584389[_0x52c60e[_0x213a('0x17')]]['toString']();}else if(_0x52c60e['type']===_0x213a('0x18')&&_0x52c60e[_0x213a('0x19')]&&_0x52c60e[_0x213a('0x19')]['name']&&_0x52c60e['idField']&&_0x584389[_0x52c60e[_0x213a('0x19')][_0x213a('0x1a')][_0x213a('0x1b')]()]){_0x4883b9[_0x52c60e[_0x213a('0x13')]]=_0x584389[_0x52c60e[_0x213a('0x19')][_0x213a('0x1a')][_0x213a('0x1b')]()][_0x213a('0x15')]();}});}return _0x4883b9;}function getName(_0x13acb1){if(_0x13acb1['indexOf']('\x20')>0x0){var _0x29ec40=_0x13acb1[_0x213a('0x1c')](/ (.+)/);if(_0x29ec40[0x1]){return _0x29ec40;}}return[_0x13acb1,_0x13acb1];}var accountsTokens={};function getAccessToken(_0x271567){return new Promise(function(_0x296c20,_0x31823f){if(!_[_0x213a('0x1d')](accountsTokens[_0x271567['id']])&&!_[_0x213a('0x1d')](accountsTokens[_0x271567['id']][_0x213a('0x1e')])){if(moment()[_0x213a('0x1f')](accountsTokens[_0x271567['id']][_0x213a('0x20')])){_0x296c20(accountsTokens[_0x271567['id']][_0x213a('0x1e')]);}}var _0x523c23;switch(_0x271567[_0x213a('0x21')]){case'US':_0x523c23=_0x213a('0x22');break;case'AU':_0x523c23=_0x213a('0x23');break;case'EU':_0x523c23=_0x213a('0x24');break;case'IN':_0x523c23=_0x213a('0x25');break;case'CN':_0x523c23=_0x213a('0x26');break;default:_0x523c23='https://accounts.zoho.eu';break;}var _0x5ec396={'method':_0x213a('0x27'),'uri':_0x523c23+'/oauth/v2/token','qs':{'refresh_token':_0x271567[_0x213a('0x28')],'client_id':_0x271567[_0x213a('0x29')],'client_secret':_0x271567[_0x213a('0x2a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5ec396)[_0x213a('0x2b')](function(_0x1e0025){accountsTokens[_0x271567['id']]={'access_token':_0x1e0025[_0x213a('0x1e')],'expires_in':moment()[_0x213a('0x2c')](_0x1e0025['expires_in'],_0x213a('0x2d'))};_0x296c20(_0x1e0025[_0x213a('0x1e')]);})[_0x213a('0x2e')](function(_0x22de34){logger[_0x213a('0x2f')](_0x213a('0x30'),_0x22de34[_0x213a('0x31')]);_0x31823f(_0x22de34);});});}function getUser(_0x1708f2,_0x48e35c,_0x35a4e0,_0x2e3ad2){logger[_0x213a('0x32')]('Search\x20user');return request({'method':_0x213a('0x33'),'uri':util[_0x213a('0x34')](_0x213a('0x35'),_0x48e35c),'qs':{'type':_0x213a('0x36')},'headers':{'Authorization':_0x213a('0x37')+_0x1708f2},'json':!![]})[_0x213a('0x2b')](function(_0x2f4d0f){if(_0x2f4d0f[_0x213a('0x38')]){var _0x8b9275=-0x1;if(_[_0x213a('0x39')](_0x2f4d0f['users'])){if(!_['isNil'](_0x2e3ad2)){_0x8b9275=_[_0x213a('0x3a')](_0x2f4d0f['users'],function(_0x54d2a7){return _0x54d2a7[_0x213a('0x3b')]===_0x2e3ad2;});}if(_0x8b9275>=0x0){logger[_0x213a('0x32')](_0x213a('0x3c'));}else{logger[_0x213a('0x32')]('Using\x20the\x20admin\x20account!');_0x8b9275=_[_0x213a('0x3a')](_0x2f4d0f[_0x213a('0x38')],function(_0x29552f){return _0x29552f[_0x213a('0x3d')][_0x213a('0x1a')]==='Administrator';});}return _0x2f4d0f['users'][_0x8b9275];}else{if(_0x2f4d0f[_0x213a('0x3e')][_0x213a('0x3d')][_0x213a('0x1a')]===_0x213a('0x3f')){logger[_0x213a('0x32')](_0x213a('0x40'));user=_0x2f4d0f[_0x213a('0x3e')];return user;}else{logger[_0x213a('0x2f')](_0x213a('0x41'),JSON[_0x213a('0xd')](_0x2f4d0f));throw new Error(_0x213a('0x42')+JSON[_0x213a('0xd')](_0x2f4d0f));}}}else{logger[_0x213a('0x2f')](_0x213a('0x41'),JSON[_0x213a('0xd')](_0x2f4d0f));throw new Error(_0x213a('0x42')+JSON[_0x213a('0xd')](_0x2f4d0f));}})['catch'](function(_0x4e6506){console[_0x213a('0x2f')](_0x4e6506);});}function getZohoUser(_0x528de0,_0x435697){return new BPromise(function(_0x100611,_0x4f6098){request(_0x528de0)[_0x213a('0x2b')](function(_0x57dedb){var _0x5ce8fe=null;if(_0x57dedb){_0x5ce8fe=_0x57dedb[_0x213a('0x43')][0x0];_0x5ce8fe[_0x213a('0x44')]=_0x435697;}_0x100611(_0x5ce8fe);})[_0x213a('0x2e')](function(_0x352942){_0x4f6098(_0x352942);});});}function createEndUser(_0x12aee2,_0xca723a,_0x2878d1,_0x297147,_0x3c15ae,_0x507efd){var _0x2878d1=getName(_0x2878d1);return request({'method':'POST','uri':_0x213a('0x45')+_0xca723a+_0x213a('0x46')+_[_0x213a('0x47')](_0x507efd[_0x213a('0x48')])+'s','body':{'data':[{'Last_Name':_0x2878d1[0x1],'First_Name':_0x2878d1[0x0],'Phone':_0x297147,'Owner':{'name':!_[_0x213a('0x1d')](_0x3c15ae[_0x213a('0x49')][_0x213a('0x1a')])?_0x3c15ae['role']['name']:!_['isNil'](_0x3c15ae[_0x213a('0x4a')])?_0x3c15ae[_0x213a('0x4a')]+'\x20'+_0x3c15ae[_0x213a('0x4b')]:_0x3c15ae['last_name'],'id':_0x3c15ae['id']}}]},'headers':{'Authorization':_0x213a('0x37')+_0x12aee2},'json':!![]})[_0x213a('0x2b')](function(_0x5a498c){if(_0x5a498c&&_0x5a498c['data'][0x0]['code']==='SUCCESS'){var _0x8d7f08=_0x5a498c['data'][0x0][_0x213a('0x4c')];_0x8d7f08['enduserType']=_[_0x213a('0x47')](_0x507efd['moduleCreate'])+'s';return _0x8d7f08;}logger[_0x213a('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x213a('0xd')](data));throw new Error(_0x213a('0x4d')+JSON[_0x213a('0xd')](data));})['catch'](function(_0x2402e6){console[_0x213a('0x4e')](_0x213a('0x4f'),_0x2402e6);});}function getEndUser(_0x1b2aba,_0x2d602c,_0x16af18,_0x23faf2,_0x3a4cf5,_0x1e5b31,_0x408327){var _0x18125d={'method':_0x213a('0x33'),'uri':'','headers':{'Authorization':_0x213a('0x37')+_0x1b2aba},'json':!![]};switch(_0x408327['moduleSearch']){case _0x213a('0x50'):_0x18125d[_0x213a('0x51')]=_0x213a('0x45')+_0x2d602c+_0x213a('0x52')+_0x3a4cf5+'))';return getZohoUser(_0x18125d,'Contacts')[_0x213a('0x2b')](function(_0x465ed6){if(_0x465ed6)return _0x465ed6;_0x18125d[_0x213a('0x51')]=_0x213a('0x45')+_0x2d602c+_0x213a('0x53')+_0x3a4cf5+'))';return getZohoUser(_0x18125d,_0x213a('0x54'))[_0x213a('0x2b')](function(_0x172a84){if(_0x172a84)return _0x172a84;if(_0x408327[_0x213a('0x48')]!=_0x213a('0x55')){return createEndUser(_0x1b2aba,_0x2d602c,_0x23faf2,_0x3a4cf5,_0x1e5b31,_0x408327);}else{return{};}});});break;case'contact':_0x18125d['uri']=_0x213a('0x45')+_0x2d602c+_0x213a('0x52')+_0x3a4cf5+'))';return getZohoUser(_0x18125d,_0x213a('0x56'))[_0x213a('0x2b')](function(_0xce9c06){if(_0xce9c06)return _0xce9c06;if(_0x408327['moduleCreate']!=_0x213a('0x55')){return createEndUser(_0x1b2aba,_0x2d602c,_0x23faf2,_0x3a4cf5,_0x1e5b31,_0x408327);}else{return{};}});break;case _0x213a('0x57'):_0x18125d[_0x213a('0x51')]=_0x213a('0x45')+_0x2d602c+_0x213a('0x53')+_0x3a4cf5+'))';return getZohoUser(_0x18125d,_0x213a('0x54'))['then'](function(_0x5728ac){if(_0x5728ac)return _0x5728ac;if(_0x408327[_0x213a('0x48')]!=_0x213a('0x55')){return createEndUser(_0x1b2aba,_0x2d602c,_0x23faf2,_0x3a4cf5,_0x1e5b31,_0x408327);}else{return{};}});break;}}function getCall(_0x48048a,_0x372e7c,_0x32549f,_0x1f167c,_0x3fba98,_0x315812,_0x447517,_0x2e31ff){logger['info'](_0x213a('0x58'));var _0x3ef39b={};_0x3ef39b[_0x213a('0x59')]={'name':!_[_0x213a('0x1d')](_0x1f167c[_0x213a('0x49')][_0x213a('0x1a')])&&!_[_0x213a('0x1d')](_0x1f167c[_0x213a('0x3d')][_0x213a('0x1a')])&&_0x1f167c[_0x213a('0x3d')][_0x213a('0x1a')]===_0x213a('0x5a')?_0x1f167c[_0x213a('0x49')][_0x213a('0x1a')]:!_['isNil'](_0x1f167c[_0x213a('0x4a')])?_0x1f167c[_0x213a('0x4a')]+'\x20'+_0x1f167c[_0x213a('0x4b')]:_0x1f167c[_0x213a('0x4b')],'id':_0x1f167c['id']};_0x3ef39b[_0x213a('0x5b')]=intUtil['getString'](_0x315812[_0x213a('0x5c')],_0x447517,'\x20');_0x3ef39b[_0x213a('0x5d')]=intUtil[_0x213a('0x5e')](_0x315812[_0x213a('0x5f')],_0x447517,'\x0a');if(_0x3fba98['enduserType']===_0x213a('0x56')){_0x3ef39b['Who_Id']={'name':!_[_0x213a('0x1d')](_0x3fba98[_0x213a('0x60')])?_0x3fba98['Full_Name']:!_[_0x213a('0x1d')](_0x3fba98[_0x213a('0x61')])?_0x3fba98[_0x213a('0x61')]+'\x20'+_0x3fba98['Last_Name']:_0x3fba98[_0x213a('0x62')],'id':_0x3fba98['id']};}if(_0x3fba98[_0x213a('0x44')]===_0x213a('0x54')){_0x3ef39b[_0x213a('0x63')]={'name':!_[_0x213a('0x1d')](_0x3fba98[_0x213a('0x60')])?_0x3fba98[_0x213a('0x60')]:!_[_0x213a('0x1d')](_0x3fba98[_0x213a('0x61')])?_0x3fba98['First_Name']+'\x20'+_0x3fba98['Last_Name']:_0x3fba98['Last_Name'],'id':_0x3fba98['id']};_0x3ef39b[_0x213a('0x64')]=_[_0x213a('0x47')](_0x3fba98['enduserType']);}if(_0x447517['talktime']){_0x3ef39b[_0x213a('0x65')]=moment[_0x213a('0x66')](parseInt(_0x447517[_0x213a('0x67')])*0x3e8)['format']('mm:ss');}else if(_0x447517[_0x213a('0x68')]&&_0x447517[_0x213a('0x69')]){_0x3ef39b[_0x213a('0x65')]=moment['utc'](moment(_0x447517['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x213a('0x6a')](moment(_0x447517['starttime'],_0x213a('0x6b'))))['format'](_0x213a('0x6c'));}switch(_0x447517['lastevent']){case _0x213a('0x6d'):_0x3ef39b[_0x213a('0x6e')]=_0x213a('0x6f');break;case _0x213a('0x70'):case _0x213a('0x71'):_0x3ef39b[_0x213a('0x6e')]=_0x213a('0x72');break;case _0x213a('0x73'):_0x3ef39b[_0x213a('0x6e')]=_0x213a('0x74');break;case _0x213a('0x75'):_0x3ef39b[_0x213a('0x6e')]=_0x213a('0x76');break;case _0x213a('0x77'):_0x3ef39b[_0x213a('0x6e')]=_0x213a('0x78');default:}_0x3ef39b[_0x213a('0x79')]=(_0x2e31ff===_0x213a('0x7a')?moment(_0x447517[_0x213a('0x7b')])[_0x213a('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x447517[_0x213a('0x7c')])[_0x213a('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x213a('0x6b'));_0x3ef39b['Call_Type']=_0x2e31ff||_0x213a('0x7d');_0x3ef39b=_['merge'](_0x3ef39b,getCustomFields(_0x315812[_0x213a('0x7e')],_0x447517));return request({'method':_0x213a('0x27'),'uri':_0x213a('0x45')+_0x372e7c+_0x213a('0x7f'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x48048a},'body':{'data':[_0x3ef39b]},'json':!![]})[_0x213a('0x2b')](function(_0x333919){if(_0x333919&&_0x333919[_0x213a('0x43')][0x0]['code']==='SUCCESS'){logger[_0x213a('0x32')]('Call\x20created!');return{'id':_0x333919[_0x213a('0x43')][0x0][_0x213a('0x4c')]['id']};}})[_0x213a('0x2e')](function(_0x2fb5b1){logger['info'](_0x213a('0x80'),_0x2fb5b1[_0x213a('0x31')]);console[_0x213a('0x4e')](_0x213a('0x80'),_0x2fb5b1);});}exports[_0x213a('0x81')]=function(_0x25380c,_0x445f6d,_0x52e3fc,_0x15e256,_0x1ec8f7,_0x1adccc){var _0x41d73d,_0x25bfe1,_0xd2440f;_0x1adccc[_0x213a('0x82')]=intUtil['stripTrailingSlash'](_0x1adccc[_0x213a('0x82')]);_0x1adccc[_0x213a('0x83')]=intUtil['stripTrailingSlash'](_0x1adccc[_0x213a('0x83')]);if(_0x1ec8f7&&_0x1ec8f7['monitor_format']){logger['info'](_0x213a('0x84'),_0x213a('0x85'));_0x445f6d[_0x213a('0x86')]=_0x1adccc['serverUrl']+_0x213a('0x87')+_0x445f6d[_0x213a('0x88')]+_0x213a('0x89')+md5(_0x445f6d[_0x213a('0x88')]);}else{_0x445f6d[_0x213a('0x86')]='';}var _0x379947=_0x1adccc['host']===_0x213a('0x8a')?'eu':_0x213a('0x8b');return getAccessToken(_0x1adccc)[_0x213a('0x2b')](function(_0x7d6939){_0xd2440f=_0x7d6939;return getUser(_0xd2440f,_0x379947,_0x1adccc,_0x15e256[_0x213a('0x3b')]);})['then'](function(_0x3c4932){_0x41d73d=_0x3c4932;logger['info'](_0x213a('0x8c'),_0x41d73d['id']);return getEndUser(_0xd2440f,_0x379947,_0x1adccc,_0x445f6d[_0x213a('0x8d')],_0x445f6d[_0x213a('0x8e')],_0x41d73d,_0x52e3fc);})[_0x213a('0x2b')](function(_0x1f5e17){_0x25bfe1=_0x1f5e17;return getCall(_0xd2440f,_0x379947,_0x1adccc,_0x41d73d,_0x25bfe1,_0x52e3fc,_0x445f6d,'Inbound');})[_0x213a('0x2b')](function(_0x2cba5c){if(_0x2cba5c){logger[_0x213a('0x32')]('The\x20Call\x20ID\x20is:',_0x2cba5c['id']);logger[_0x213a('0x32')](_0x213a('0x84'),_0x213a('0x8f'));emit(util['format']('user:%s',_0x15e256[_0x213a('0x1a')]),_0x213a('0x90'),{'uri':_0x213a('0x91')+_0x1adccc[_0x213a('0x82')]+_0x213a('0x92')+_0x2cba5c['id']});}})[_0x213a('0x2e')](function(_0x19cb64){logger[_0x213a('0x2f')](_0x213a('0x84'),JSON[_0x213a('0xd')](_0x19cb64));});};exports[_0x213a('0x7a')]=function(_0xcb4197,_0x389861,_0x22d4b0,_0xd43fc9,_0x4fc5f2,_0x3b3bf1,_0x5a932f){var _0x5c9424,_0x1cac56,_0x4874bf;_0x3b3bf1[_0x213a('0x82')]=intUtil[_0x213a('0x93')](_0x3b3bf1[_0x213a('0x82')]);_0x3b3bf1[_0x213a('0x83')]=intUtil[_0x213a('0x93')](_0x3b3bf1['serverUrl']);if(_0x5a932f&&_0x5a932f[_0x213a('0x94')]&&_0x5a932f[_0x213a('0x94')]!=='none'){logger[_0x213a('0x32')](_0x213a('0x95'),_0x213a('0x85'));_0x389861[_0x213a('0x86')]=_0x3b3bf1[_0x213a('0x83')]+_0x213a('0x87')+_0x389861['uniqueid']+_0x213a('0x89')+md5(_0x389861[_0x213a('0x88')]);}var _0x121ee1=_0x3b3bf1[_0x213a('0x82')]===_0x213a('0x8a')?'eu':_0x213a('0x8b');return getAccessToken(_0x3b3bf1)['then'](function(_0x4f3dc3){_0x4874bf=_0x4f3dc3;return getUser(_0x4874bf,_0x121ee1,_0x3b3bf1,_0xd43fc9['email']);})[_0x213a('0x2b')](function(_0x4164d7){_0x5c9424=_0x4164d7;logger[_0x213a('0x32')](_0x213a('0x8c'),_0x5c9424['id']);return getEndUser(_0x4874bf,_0x121ee1,_0x3b3bf1,_0x389861[_0x213a('0x96')],_0x389861[_0x213a('0x97')],_0x5c9424,_0x22d4b0);})[_0x213a('0x2b')](function(_0x5cddf){_0x1cac56=_0x5cddf;return getCall(_0x4874bf,_0x121ee1,_0x3b3bf1,_0x5c9424,_0x1cac56,_0x22d4b0,_0x389861,_0x213a('0x98'));})[_0x213a('0x2b')](function(_0x7d9dee){if(_0x7d9dee){logger['info'](_0x213a('0x99'),_0x7d9dee['id']);logger['info']('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x213a('0x34')](_0x213a('0x9a'),_0xd43fc9[_0x213a('0x1a')]),_0x213a('0x90'),{'uri':_0x213a('0x91')+_0x3b3bf1['host']+_0x213a('0x92')+_0x7d9dee['id']});}})[_0x213a('0x2e')](function(_0x5eb765){logger[_0x213a('0x2f')](_0x213a('0x95'),JSON[_0x213a('0xd')](_0x5eb765));});};exports[_0x213a('0x9b')]=function(_0x5ee0e7,_0x40003,_0x1a4c5b,_0x1a51e1,_0x39ef17,_0x3cc273){var _0x2d5a9d,_0x22b25f,_0x1649b5;_0x3cc273[_0x213a('0x82')]=intUtil['stripTrailingSlash'](_0x3cc273['host']);_0x3cc273['serverUrl']=intUtil[_0x213a('0x93')](_0x3cc273['serverUrl']);if(_0x39ef17&&_0x39ef17[_0x213a('0x9c')]){logger[_0x213a('0x32')]('['+_0x40003[_0x213a('0x9d')][_0x213a('0x9e')]()+']',_0x213a('0x85'));_0x40003['recordingURL']=_0x3cc273['serverUrl']+_0x213a('0x87')+_0x40003[_0x213a('0x88')]+_0x213a('0x89')+md5(_0x40003[_0x213a('0x88')]);}else{_0x40003['recordingURL']='';}var _0x125849=_0x3cc273[_0x213a('0x82')]===_0x213a('0x8a')?'eu':'com';return getAccessToken(_0x3cc273)[_0x213a('0x2b')](function(_0x290e0d){_0x1649b5=_0x290e0d;return getUser(_0x1649b5,_0x125849,_0x3cc273);})[_0x213a('0x2b')](function(_0x377e9f){_0x2d5a9d=_0x377e9f;logger[_0x213a('0x32')](_0x213a('0x8c'),_0x2d5a9d['id']);return getEndUser(_0x1649b5,_0x125849,_0x3cc273,_0x40003[_0x213a('0x8d')],_0x40003[_0x213a('0x8e')],_0x2d5a9d,_0x1a4c5b);})[_0x213a('0x2b')](function(_0x3399ae){_0x22b25f=_0x3399ae;return getCall(_0x1649b5,_0x125849,_0x3cc273,_0x2d5a9d,_0x22b25f,_0x1a4c5b,_0x40003,_0x213a('0x7d'));})[_0x213a('0x2b')](function(_0x99fa84){if(_0x99fa84){logger['info'](_0x213a('0x99'),_0x99fa84['id']);}})[_0x213a('0x2e')](function(_0x2216de){logger[_0x213a('0x2f')]('['+_0x40003[_0x213a('0x9d')][_0x213a('0x9e')]()+']',JSON['stringify'](_0x2216de));});}; \ No newline at end of file +var _0x781f=['Call\x20created!','err','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','lodash','request-promise','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','variable','variableName','toString','type','customVariable','Variable','name','toLowerCase','split','isNil','expires_in','access_token','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','https://www.zohoapis.','startCase','moduleCreate','role','first_name','code','details','Error:\x20','log','contact_lead','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Called','complete','connect','Call_Result','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls'];(function(_0x48bceb,_0x3658d8){var _0x274484=function(_0x37b589){while(--_0x37b589){_0x48bceb['push'](_0x48bceb['shift']());}};_0x274484(++_0x3658d8);}(_0x781f,0x13f));var _0xf781=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0x781f[_0x56e0e8];return _0x2dab50;};'use strict';var _=require(_0xf781('0x0'));var rp=require(_0xf781('0x1'));var md5=require('md5');var util=require(_0xf781('0x2'));var intUtil=require('./util');var moment=require(_0xf781('0x3'));var Redis=require(_0xf781('0x4'));var BPromise=require(_0xf781('0x5'));var config=require(_0xf781('0x6'));var logger=require(_0xf781('0x7'))(_0xf781('0x8'));config[_0xf781('0x9')]=_[_0xf781('0xa')](config[_0xf781('0x9')],{'host':_0xf781('0xb'),'port':0x18eb});var io=require(_0xf781('0xc'))(new Redis(config[_0xf781('0x9')]));function emit(_0x51678a,_0x3df5b0,_0x380ddb){io['to'](_0x51678a)['emit'](_0x3df5b0,_0x380ddb);}function request(_0x404523){logger[_0xf781('0xd')](_0xf781('0xe'),JSON[_0xf781('0xf')](_0x404523));return rp(_0x404523);}function getCustomFields(_0x1fbf91,_0x34a34d){var _0x466b94={};if(_0x1fbf91[_0xf781('0x10')]>0x0){_[_0xf781('0x11')](_0x1fbf91,function(_0x24aea8){if(_[_0xf781('0x12')]([_0xf781('0x13'),_0xf781('0x14')],_0x24aea8['type'])&&_0x24aea8['idField']){_0x466b94[_0x24aea8[_0xf781('0x15')]]=_0x24aea8['content']['toString']();}else if(_0x24aea8['type']===_0xf781('0x16')&&_0x24aea8[_0xf781('0x17')]&&_0x24aea8['idField']&&_0x34a34d[_0x24aea8[_0xf781('0x17')]]){_0x466b94[_0x24aea8['idField']]=_0x34a34d[_0x24aea8[_0xf781('0x17')]][_0xf781('0x18')]();}else if(_0x24aea8[_0xf781('0x19')]===_0xf781('0x1a')&&_0x24aea8['Variable']&&_0x24aea8[_0xf781('0x1b')]['name']&&_0x24aea8[_0xf781('0x15')]&&_0x34a34d[_0x24aea8[_0xf781('0x1b')][_0xf781('0x1c')]['toLowerCase']()]){_0x466b94[_0x24aea8[_0xf781('0x15')]]=_0x34a34d[_0x24aea8['Variable'][_0xf781('0x1c')][_0xf781('0x1d')]()]['toString']();}});}return _0x466b94;}function getName(_0x2b3ff2){if(_0x2b3ff2['indexOf']('\x20')>0x0){var _0x4f7b18=_0x2b3ff2[_0xf781('0x1e')](/ (.+)/);if(_0x4f7b18[0x1]){return _0x4f7b18;}}return[_0x2b3ff2,_0x2b3ff2];}var accountsTokens={};function getAccessToken(_0x574c3c){return new Promise(function(_0x5b7439,_0x105d46){if(!_[_0xf781('0x1f')](accountsTokens[_0x574c3c['id']])&&!_[_0xf781('0x1f')](accountsTokens[_0x574c3c['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x574c3c['id']][_0xf781('0x20')])){_0x5b7439(accountsTokens[_0x574c3c['id']][_0xf781('0x21')]);}}var _0x2de693;switch(_0x574c3c['zone']){case'US':_0x2de693='https://accounts.zoho.com';break;case'AU':_0x2de693='https://accounts.zoho.com.au';break;case'EU':_0x2de693=_0xf781('0x22');break;case'IN':_0x2de693='https://accounts.zoho.in';break;case'CN':_0x2de693=_0xf781('0x23');break;default:_0x2de693=_0xf781('0x22');break;}var _0x35c2e8={'method':_0xf781('0x24'),'uri':_0x2de693+_0xf781('0x25'),'qs':{'refresh_token':_0x574c3c['refreshToken'],'client_id':_0x574c3c[_0xf781('0x26')],'client_secret':_0x574c3c['clientSecret'],'grant_type':_0xf781('0x27')},'json':!![]};return rp(_0x35c2e8)[_0xf781('0x28')](function(_0xe1a2a9){accountsTokens[_0x574c3c['id']]={'access_token':_0xe1a2a9[_0xf781('0x21')],'expires_in':moment()[_0xf781('0x29')](_0xe1a2a9[_0xf781('0x20')],_0xf781('0x2a'))};_0x5b7439(_0xe1a2a9[_0xf781('0x21')]);})['catch'](function(_0x57d6d6){logger[_0xf781('0x2b')](_0xf781('0x2c'),_0x57d6d6[_0xf781('0x2d')]);_0x105d46(_0x57d6d6);});});}function getUser(_0x216eff,_0x1ba624,_0x26e6d6,_0x421546){logger[_0xf781('0x2e')]('Search\x20user');return request({'method':_0xf781('0x2f'),'uri':util[_0xf781('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x1ba624),'qs':{'type':_0xf781('0x31')},'headers':{'Authorization':_0xf781('0x32')+_0x216eff},'json':!![]})['then'](function(_0x198231){if(_0x198231[_0xf781('0x33')]){var _0x5578dc=-0x1;if(_[_0xf781('0x34')](_0x198231[_0xf781('0x33')])){if(!_['isNil'](_0x421546)){_0x5578dc=_[_0xf781('0x35')](_0x198231['users'],function(_0x33cbd6){return _0x33cbd6[_0xf781('0x36')]===_0x421546;});}if(_0x5578dc>=0x0){logger[_0xf781('0x2e')](_0xf781('0x37'));}else{logger['info'](_0xf781('0x38'));_0x5578dc=_[_0xf781('0x35')](_0x198231[_0xf781('0x33')],function(_0x3cbcfb){return _0x3cbcfb['profile']['name']===_0xf781('0x39');});}return _0x198231[_0xf781('0x33')][_0x5578dc];}else{if(_0x198231['user'][_0xf781('0x3a')][_0xf781('0x1c')]==='Administrator'){logger['info'](_0xf781('0x38'));user=_0x198231[_0xf781('0x3b')];return user;}else{logger['error'](_0xf781('0x3c'),JSON[_0xf781('0xf')](_0x198231));throw new Error(_0xf781('0x3d')+JSON[_0xf781('0xf')](_0x198231));}}}else{logger[_0xf781('0x2b')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x198231));throw new Error(_0xf781('0x3d')+JSON[_0xf781('0xf')](_0x198231));}})['catch'](function(_0x213725){console['error'](_0x213725);});}function getZohoUser(_0x29f262,_0x212305){return new BPromise(function(_0x2515ca,_0x565ecc){request(_0x29f262)['then'](function(_0x1cc639){var _0x3ac404=null;if(_0x1cc639){_0x3ac404=_0x1cc639[_0xf781('0x3e')][0x0];_0x3ac404[_0xf781('0x3f')]=_0x212305;}_0x2515ca(_0x3ac404);})[_0xf781('0x40')](function(_0x3fbce1){_0x565ecc(_0x3fbce1);});});}function createEndUser(_0x192a69,_0x4a7441,_0x335d72,_0x5413d5,_0x539a1a,_0x5003ff){var _0x335d72=getName(_0x335d72);return request({'method':_0xf781('0x24'),'uri':_0xf781('0x41')+_0x4a7441+'/crm/v2/'+_[_0xf781('0x42')](_0x5003ff[_0xf781('0x43')])+'s','body':{'data':[{'Last_Name':_0x335d72[0x1],'First_Name':_0x335d72[0x0],'Phone':_0x5413d5,'Owner':{'name':!_['isNil'](_0x539a1a[_0xf781('0x44')][_0xf781('0x1c')])?_0x539a1a['role'][_0xf781('0x1c')]:!_['isNil'](_0x539a1a[_0xf781('0x45')])?_0x539a1a[_0xf781('0x45')]+'\x20'+_0x539a1a['last_name']:_0x539a1a['last_name'],'id':_0x539a1a['id']}}]},'headers':{'Authorization':_0xf781('0x32')+_0x192a69},'json':!![]})[_0xf781('0x28')](function(_0x212ac3){if(_0x212ac3&&_0x212ac3['data'][0x0][_0xf781('0x46')]==='SUCCESS'){var _0x5dbbc9=_0x212ac3[_0xf781('0x3e')][0x0][_0xf781('0x47')];_0x5dbbc9[_0xf781('0x3f')]=_[_0xf781('0x42')](_0x5003ff[_0xf781('0x43')])+'s';return _0x5dbbc9;}logger[_0xf781('0x2b')](_0xf781('0x3c'),JSON[_0xf781('0xf')](data));throw new Error(_0xf781('0x48')+JSON[_0xf781('0xf')](data));})[_0xf781('0x40')](function(_0x4d4a83){console[_0xf781('0x49')]('CREATE\x20ERROR',_0x4d4a83);});}function getEndUser(_0x4cf976,_0x2713e8,_0x111325,_0x4dc59f,_0x2df118,_0x4d8649,_0x5c188d){var _0x96d75c={'method':'GET','uri':'','headers':{'Authorization':_0xf781('0x32')+_0x4cf976},'json':!![]};switch(_0x5c188d['moduleSearch']){case _0xf781('0x4a'):_0x96d75c['uri']=_0xf781('0x41')+_0x2713e8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2df118+'))';return getZohoUser(_0x96d75c,_0xf781('0x4b'))[_0xf781('0x28')](function(_0x25c324){if(_0x25c324)return _0x25c324;_0x96d75c[_0xf781('0x4c')]=_0xf781('0x41')+_0x2713e8+_0xf781('0x4d')+_0x2df118+'))';return getZohoUser(_0x96d75c,_0xf781('0x4e'))[_0xf781('0x28')](function(_0x21b512){if(_0x21b512)return _0x21b512;if(_0x5c188d[_0xf781('0x43')]!=_0xf781('0x4f')){return createEndUser(_0x4cf976,_0x2713e8,_0x4dc59f,_0x2df118,_0x4d8649,_0x5c188d);}else{return{};}});});break;case _0xf781('0x50'):_0x96d75c[_0xf781('0x4c')]=_0xf781('0x41')+_0x2713e8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2df118+'))';return getZohoUser(_0x96d75c,_0xf781('0x4b'))['then'](function(_0x2d678a){if(_0x2d678a)return _0x2d678a;if(_0x5c188d[_0xf781('0x43')]!='nothing'){return createEndUser(_0x4cf976,_0x2713e8,_0x4dc59f,_0x2df118,_0x4d8649,_0x5c188d);}else{return{};}});break;case'lead':_0x96d75c[_0xf781('0x4c')]=_0xf781('0x41')+_0x2713e8+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2df118+'))';return getZohoUser(_0x96d75c,_0xf781('0x4e'))['then'](function(_0xa62002){if(_0xa62002)return _0xa62002;if(_0x5c188d[_0xf781('0x43')]!=_0xf781('0x4f')){return createEndUser(_0x4cf976,_0x2713e8,_0x4dc59f,_0x2df118,_0x4d8649,_0x5c188d);}else{return{};}});break;}}function getCall(_0x439495,_0x23e6ca,_0x45b195,_0x2bc046,_0x4041a1,_0xa149a6,_0xae4775,_0x460799){logger['info'](_0xf781('0x51'));var _0x5b78ac={};_0x5b78ac[_0xf781('0x52')]={'name':!_['isNil'](_0x2bc046[_0xf781('0x44')]['name'])&&!_['isNil'](_0x2bc046[_0xf781('0x3a')][_0xf781('0x1c')])&&_0x2bc046[_0xf781('0x3a')][_0xf781('0x1c')]===_0xf781('0x53')?_0x2bc046[_0xf781('0x44')][_0xf781('0x1c')]:!_['isNil'](_0x2bc046[_0xf781('0x45')])?_0x2bc046[_0xf781('0x45')]+'\x20'+_0x2bc046[_0xf781('0x54')]:_0x2bc046[_0xf781('0x54')],'id':_0x2bc046['id']};_0x5b78ac[_0xf781('0x55')]=intUtil[_0xf781('0x56')](_0xa149a6['Subjects'],_0xae4775,'\x20');_0x5b78ac[_0xf781('0x57')]=intUtil[_0xf781('0x56')](_0xa149a6[_0xf781('0x58')],_0xae4775,'\x0a');if(_0x4041a1['enduserType']===_0xf781('0x4b')){_0x5b78ac[_0xf781('0x59')]={'name':!_['isNil'](_0x4041a1[_0xf781('0x5a')])?_0x4041a1[_0xf781('0x5a')]:!_[_0xf781('0x1f')](_0x4041a1[_0xf781('0x5b')])?_0x4041a1[_0xf781('0x5b')]+'\x20'+_0x4041a1[_0xf781('0x5c')]:_0x4041a1['Last_Name'],'id':_0x4041a1['id']};}if(_0x4041a1[_0xf781('0x3f')]===_0xf781('0x4e')){_0x5b78ac['What_Id']={'name':!_[_0xf781('0x1f')](_0x4041a1[_0xf781('0x5a')])?_0x4041a1[_0xf781('0x5a')]:!_[_0xf781('0x1f')](_0x4041a1['First_Name'])?_0x4041a1[_0xf781('0x5b')]+'\x20'+_0x4041a1[_0xf781('0x5c')]:_0x4041a1[_0xf781('0x5c')],'id':_0x4041a1['id']};_0x5b78ac['$se_module']=_[_0xf781('0x42')](_0x4041a1[_0xf781('0x3f')]);}if(_0xae4775[_0xf781('0x5d')]){_0x5b78ac['Call_Duration']=moment[_0xf781('0x5e')](parseInt(_0xae4775[_0xf781('0x5d')])*0x3e8)['format'](_0xf781('0x5f'));}else if(_0xae4775[_0xf781('0x60')]&&_0xae4775[_0xf781('0x61')]){_0x5b78ac[_0xf781('0x62')]=moment[_0xf781('0x5e')](moment(_0xae4775[_0xf781('0x61')],_0xf781('0x63'))['diff'](moment(_0xae4775[_0xf781('0x64')],_0xf781('0x63'))))[_0xf781('0x30')](_0xf781('0x5f'));}switch(_0xae4775[_0xf781('0x65')]){case _0xf781('0x66'):_0x5b78ac['Call_Result']=_0xf781('0x67');break;case _0xf781('0x68'):case _0xf781('0x69'):_0x5b78ac[_0xf781('0x6a')]='Answered';break;case'rejected':_0x5b78ac[_0xf781('0x6a')]=_0xf781('0x6b');break;case'abandoned':_0x5b78ac[_0xf781('0x6a')]=_0xf781('0x6c');break;case _0xf781('0x6d'):_0x5b78ac[_0xf781('0x6a')]=_0xf781('0x6e');default:}_0x5b78ac['Call_Start_Time']=(_0x460799===_0xf781('0x6f')?moment(_0xae4775[_0xf781('0x64')])[_0xf781('0x30')](_0xf781('0x63')):moment(_0xae4775[_0xf781('0x70')])[_0xf781('0x30')](_0xf781('0x63')))||moment()[_0xf781('0x30')](_0xf781('0x63'));_0x5b78ac['Call_Type']=_0x460799||_0xf781('0x71');_0x5b78ac=_[_0xf781('0x72')](_0x5b78ac,getCustomFields(_0xa149a6['Fields'],_0xae4775));return request({'method':_0xf781('0x24'),'uri':_0xf781('0x41')+_0x23e6ca+_0xf781('0x73'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x439495},'body':{'data':[_0x5b78ac]},'json':!![]})['then'](function(_0x3ebcc1){if(_0x3ebcc1&&_0x3ebcc1['data'][0x0][_0xf781('0x46')]==='SUCCESS'){logger[_0xf781('0x2e')](_0xf781('0x74'));return{'id':_0x3ebcc1['data'][0x0]['details']['id']};}})[_0xf781('0x40')](function(_0x4f87b8){logger[_0xf781('0x2e')]('err',_0x4f87b8[_0xf781('0x2d')]);console[_0xf781('0x49')](_0xf781('0x75'),_0x4f87b8);});}exports['queue']=function(_0x1da81f,_0x38d545,_0x245499,_0x4f06a7,_0x47c1f2,_0x155abc){var _0x252a19,_0x4c514f,_0xd5aa1a;_0x155abc['host']=intUtil[_0xf781('0x76')](_0x155abc[_0xf781('0x77')]);_0x155abc[_0xf781('0x78')]=intUtil[_0xf781('0x76')](_0x155abc[_0xf781('0x78')]);if(_0x47c1f2&&_0x47c1f2[_0xf781('0x79')]){logger[_0xf781('0x2e')]('[QUEUE]',_0xf781('0x7a'));_0x38d545[_0xf781('0x7b')]=_0x155abc[_0xf781('0x78')]+_0xf781('0x7c')+_0x38d545[_0xf781('0x7d')]+_0xf781('0x7e')+md5(_0x38d545[_0xf781('0x7d')]);}else{_0x38d545[_0xf781('0x7b')]='';}var _0x4148fa=_0x155abc[_0xf781('0x77')]===_0xf781('0x7f')?'eu':_0xf781('0x80');return getAccessToken(_0x155abc)[_0xf781('0x28')](function(_0x5f11e5){_0xd5aa1a=_0x5f11e5;return getUser(_0xd5aa1a,_0x4148fa,_0x155abc,_0x4f06a7['email']);})[_0xf781('0x28')](function(_0xe52956){_0x252a19=_0xe52956;logger[_0xf781('0x2e')](_0xf781('0x81'),_0x252a19['id']);return getEndUser(_0xd5aa1a,_0x4148fa,_0x155abc,_0x38d545[_0xf781('0x82')],_0x38d545['calleridnum'],_0x252a19,_0x245499);})['then'](function(_0x57133b){_0x4c514f=_0x57133b;return getCall(_0xd5aa1a,_0x4148fa,_0x155abc,_0x252a19,_0x4c514f,_0x245499,_0x38d545,_0xf781('0x71'));})[_0xf781('0x28')](function(_0x35b23d){if(_0x35b23d){logger[_0xf781('0x2e')]('The\x20Call\x20ID\x20is:',_0x35b23d['id']);logger['info'](_0xf781('0x83'),_0xf781('0x84'));emit(util[_0xf781('0x30')](_0xf781('0x85'),_0x4f06a7['name']),_0xf781('0x86'),{'uri':_0xf781('0x87')+_0x155abc[_0xf781('0x77')]+_0xf781('0x88')+_0x35b23d['id']});}})[_0xf781('0x40')](function(_0x173b16){logger[_0xf781('0x2b')](_0xf781('0x83'),JSON[_0xf781('0xf')](_0x173b16));});};exports[_0xf781('0x6f')]=function(_0x34a0bb,_0x4226ef,_0x3c7831,_0x405b8d,_0x2525bd,_0x434709,_0xa1a5f9){var _0x1dd134,_0x1ebdb0,_0xa2daa;_0x434709[_0xf781('0x77')]=intUtil['stripTrailingSlash'](_0x434709['host']);_0x434709[_0xf781('0x78')]=intUtil[_0xf781('0x76')](_0x434709['serverUrl']);if(_0xa1a5f9&&_0xa1a5f9[_0xf781('0x89')]&&_0xa1a5f9[_0xf781('0x89')]!=='none'){logger['info']('[OUTBOUND]',_0xf781('0x7a'));_0x4226ef[_0xf781('0x7b')]=_0x434709[_0xf781('0x78')]+_0xf781('0x7c')+_0x4226ef[_0xf781('0x7d')]+_0xf781('0x7e')+md5(_0x4226ef['uniqueid']);}var _0x5678c6=_0x434709[_0xf781('0x77')]===_0xf781('0x7f')?'eu':_0xf781('0x80');return getAccessToken(_0x434709)[_0xf781('0x28')](function(_0x412afc){_0xa2daa=_0x412afc;return getUser(_0xa2daa,_0x5678c6,_0x434709,_0x405b8d[_0xf781('0x36')]);})[_0xf781('0x28')](function(_0x19a162){_0x1dd134=_0x19a162;logger[_0xf781('0x2e')](_0xf781('0x81'),_0x1dd134['id']);return getEndUser(_0xa2daa,_0x5678c6,_0x434709,_0x4226ef[_0xf781('0x8a')],_0x4226ef['destcalleridnum'],_0x1dd134,_0x3c7831);})[_0xf781('0x28')](function(_0x162106){_0x1ebdb0=_0x162106;return getCall(_0xa2daa,_0x5678c6,_0x434709,_0x1dd134,_0x1ebdb0,_0x3c7831,_0x4226ef,_0xf781('0x8b'));})[_0xf781('0x28')](function(_0x19abf1){if(_0x19abf1){logger['info'](_0xf781('0x8c'),_0x19abf1['id']);logger[_0xf781('0x2e')](_0xf781('0x8d'),_0xf781('0x84'));emit(util[_0xf781('0x30')]('user:%s',_0x405b8d[_0xf781('0x1c')]),_0xf781('0x86'),{'uri':_0xf781('0x87')+_0x434709[_0xf781('0x77')]+'/crm/EntityInfo.do?module=Calls&id='+_0x19abf1['id']});}})[_0xf781('0x40')](function(_0x584e70){logger['error'](_0xf781('0x8d'),JSON[_0xf781('0xf')](_0x584e70));});};exports[_0xf781('0x8e')]=function(_0x30601a,_0x314ade,_0x4dd349,_0x84b266,_0x5e33bf,_0x5ee0e9){var _0x2d7395,_0x30b87e,_0x2313a2;_0x5ee0e9[_0xf781('0x77')]=intUtil[_0xf781('0x76')](_0x5ee0e9[_0xf781('0x77')]);_0x5ee0e9['serverUrl']=intUtil[_0xf781('0x76')](_0x5ee0e9[_0xf781('0x78')]);if(_0x5e33bf&&_0x5e33bf['monitor_format']){logger['info']('['+_0x314ade[_0xf781('0x65')][_0xf781('0x8f')]()+']',_0xf781('0x7a'));_0x314ade[_0xf781('0x7b')]=_0x5ee0e9['serverUrl']+'/api/voice/recordings/'+_0x314ade['uniqueid']+_0xf781('0x7e')+md5(_0x314ade['uniqueid']);}else{_0x314ade['recordingURL']='';}var _0x39f16e=_0x5ee0e9['host']==='zoho.eu'?'eu':_0xf781('0x80');return getAccessToken(_0x5ee0e9)['then'](function(_0x42a43a){_0x2313a2=_0x42a43a;return getUser(_0x2313a2,_0x39f16e,_0x5ee0e9);})[_0xf781('0x28')](function(_0x3c1b8d){_0x2d7395=_0x3c1b8d;logger[_0xf781('0x2e')](_0xf781('0x81'),_0x2d7395['id']);return getEndUser(_0x2313a2,_0x39f16e,_0x5ee0e9,_0x314ade[_0xf781('0x82')],_0x314ade[_0xf781('0x90')],_0x2d7395,_0x4dd349);})[_0xf781('0x28')](function(_0x26dcc7){_0x30b87e=_0x26dcc7;return getCall(_0x2313a2,_0x39f16e,_0x5ee0e9,_0x2d7395,_0x30b87e,_0x4dd349,_0x314ade,_0xf781('0x71'));})['then'](function(_0x4a40a3){if(_0x4a40a3){logger['info']('The\x20Call\x20ID\x20is:',_0x4a40a3['id']);}})[_0xf781('0x40')](function(_0x40f682){logger[_0xf781('0x2b')]('['+_0x314ade[_0xf781('0x65')]['toUpperCase']()+']',JSON['stringify'](_0x40f682));});}; \ 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 609d6ec..9c0fc43 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 _0xf2d7=['data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0xf2d7,0xe3));var _0x7f2d=function(_0x41ca26,_0x57d911){_0x41ca26=_0x41ca26-0x0;var _0xea4203=_0xf2d7[_0x41ca26];return _0xea4203;};'use strict';var util=require('util');var sh=require(_0x7f2d('0x0'));var Mustache=require(_0x7f2d('0x1'));var logger=require(_0x7f2d('0x2'))(_0x7f2d('0x3'));exports[_0x7f2d('0x4')]=function(_0x3d5ae9,_0x15a105){var _0x255b2f=_0x3d5ae9['data2']?_0x3d5ae9[_0x7f2d('0x5')]:_0x7f2d('0x6');var _0x24ca12=_0x3d5ae9[_0x7f2d('0x7')]?Mustache['render'](_0x3d5ae9['data3'],_0x15a105):_0x15a105;sh['exec'](_0x24ca12,function(_0x262f51,_0x2ef882,_0x165934){if(_0x262f51!==0x0){logger[_0x7f2d('0x8')](util[_0x7f2d('0x9')](_0x7f2d('0xa'),_0x255b2f,_0x24ca12,_0x262f51,_0x165934));}else{logger[_0x7f2d('0xb')](util[_0x7f2d('0x9')](_0x7f2d('0xc'),_0x255b2f,_0x24ca12,_0x2ef882));}});}; \ No newline at end of file +var _0x45e4=['error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger','data2','Script','data3','render'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x45e4,0xe2));var _0x445e=function(_0x5af4f7,_0x1e4ce9){_0x5af4f7=_0x5af4f7-0x0;var _0x28f222=_0x45e4[_0x5af4f7];return _0x28f222;};'use strict';var util=require(_0x445e('0x0'));var sh=require(_0x445e('0x1'));var Mustache=require('mustache');var logger=require(_0x445e('0x2'))(_0x445e('0x3'));exports['exec']=function(_0x1a926d,_0x256266){var _0x58644d=_0x1a926d[_0x445e('0x4')]?_0x1a926d['data2']:_0x445e('0x5');var _0x1c620b=_0x1a926d[_0x445e('0x6')]?Mustache[_0x445e('0x7')](_0x1a926d[_0x445e('0x6')],_0x256266):_0x256266;sh['exec'](_0x1c620b,function(_0x4c559f,_0x24dd02,_0x4393dd){if(_0x4c559f!==0x0){logger[_0x445e('0x8')](util['format'](_0x445e('0x9'),_0x58644d,_0x1c620b,_0x4c559f,_0x4393dd));}else{logger[_0x445e('0xa')](util[_0x445e('0xb')](_0x445e('0xc'),_0x58644d,_0x1c620b,_0x24dd02));}});}; \ 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 6aa17ec..685f239 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 _0xf301=['statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','lodash','../../../../config/logger','trigger','data1','render','data2','data5','number','headers','data6','parse','stack','toUpperCase','GET','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0x2887db,_0x491f8d){var _0xabc1a8=function(_0x161591){while(--_0x161591){_0x2887db['push'](_0x2887db['shift']());}};_0xabc1a8(++_0x491f8d);}(_0xf301,0x80));var _0x1f30=function(_0x108ebb,_0x250767){_0x108ebb=_0x108ebb-0x0;var _0x164c88=_0xf301[_0x108ebb];return _0x164c88;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x1f30('0x0'));var Mustache=require('mustache');var logger=require(_0x1f30('0x1'))(_0x1f30('0x2'));exports['exec']=function(_0x331abd,_0x1d35c6){var _0x166ff2,_0x83adb5;var _0x2ce1fb={'method':_0x331abd[_0x1f30('0x3')]['toUpperCase'](),'uri':Mustache[_0x1f30('0x4')](_0x331abd[_0x1f30('0x5')],_0x1d35c6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x331abd[_0x1f30('0x6')])===_0x1f30('0x7')&&parseInt(_0x331abd[_0x1f30('0x6')])>=0x1&&parseInt(_0x331abd[_0x1f30('0x6')])<=0xa?parseInt(_0x331abd[_0x1f30('0x6')])*0x3e8:0x5*0x3e8};try{_0x2ce1fb[_0x1f30('0x8')]=_0x331abd[_0x1f30('0x9')]?JSON[_0x1f30('0xa')](Mustache[_0x1f30('0x4')](_0x331abd[_0x1f30('0x9')],_0x1d35c6)):{};}catch(_0x33300c){logger['error'](_0x33300c[_0x1f30('0xb')]);}switch(_0x331abd['data1'][_0x1f30('0xc')]()){case _0x1f30('0xd'):case'DELETE':_0x166ff2=null;_0x2ce1fb['qs']=_0x1d35c6;break;case _0x1f30('0xe'):case _0x1f30('0xf'):if(_0x331abd[_0x1f30('0x10')]){try{_0x166ff2=JSON[_0x1f30('0xa')](Mustache['render'](_0x331abd['data7'],_0x1d35c6));_0x2ce1fb[_0x1f30('0x11')]=_0x166ff2;}catch(_0x23e03a){logger[_0x1f30('0x12')](_0x23e03a[_0x1f30('0xb')]);logger[_0x1f30('0x12')](_0x1f30('0x13'));}}else{_0x166ff2=_0x1d35c6;_0x2ce1fb['body']=_0x166ff2;}break;}logger['info'](util[_0x1f30('0x14')](_0x1f30('0x15'),_0x331abd[_0x1f30('0x3')],_0x331abd[_0x1f30('0x5')],JSON[_0x1f30('0x16')](_0x2ce1fb)));rp(_0x2ce1fb)[_0x1f30('0x17')](function(_0x520f7e){_0x166ff2=!_['isNil'](_0x166ff2)?_0x1f30('0x18')+_0x166ff2:'';_0x83adb5=typeof _0x520f7e[_0x1f30('0x11')]==='object'?JSON[_0x1f30('0x16')](_0x520f7e[_0x1f30('0x11')]):_0x520f7e['body'];logger[_0x1f30('0x19')](util[_0x1f30('0x14')](_0x1f30('0x1a'),_0x331abd[_0x1f30('0x3')],_0x331abd[_0x1f30('0x5')],_0x520f7e[_0x1f30('0x1b')],_0x83adb5));})[_0x1f30('0x1c')](function(_0x1610f4){logger[_0x1f30('0x12')](util['format'](_0x1f30('0x1d'),_0x331abd[_0x1f30('0x3')],_0x331abd['data2'],_0x1610f4[_0x1f30('0x1b')],_0x1610f4['name'],_0x1610f4[_0x1f30('0x1e')]));});}; \ No newline at end of file +var _0xed8d=['format','stringify','isNil','object','info','statusCode','catch','message','request-promise','util','mustache','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format'];(function(_0x21c7e4,_0x2d61be){var _0x310cd2=function(_0x27820b){while(--_0x27820b){_0x21c7e4['push'](_0x21c7e4['shift']());}};_0x310cd2(++_0x2d61be);}(_0xed8d,0x1ac));var _0xded8=function(_0x378d60,_0x39713d){_0x378d60=_0x378d60-0x0;var _0x137bff=_0xed8d[_0x378d60];return _0x137bff;};'use strict';var rp=require(_0xded8('0x0'));var util=require(_0xded8('0x1'));var _=require('lodash');var Mustache=require(_0xded8('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0xded8('0x3')]=function(_0x5af017,_0xceea05){var _0x57ffd0,_0x4111b7;var _0x16ba20={'method':_0x5af017[_0xded8('0x4')][_0xded8('0x5')](),'uri':Mustache[_0xded8('0x6')](_0x5af017[_0xded8('0x7')],_0xceea05),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5af017[_0xded8('0x8')])===_0xded8('0x9')&&parseInt(_0x5af017['data5'])>=0x1&&parseInt(_0x5af017['data5'])<=0xa?parseInt(_0x5af017[_0xded8('0x8')])*0x3e8:0x5*0x3e8};try{_0x16ba20[_0xded8('0xa')]=_0x5af017[_0xded8('0xb')]?JSON[_0xded8('0xc')](Mustache[_0xded8('0x6')](_0x5af017[_0xded8('0xb')],_0xceea05)):{};}catch(_0x58fb94){logger[_0xded8('0xd')](_0x58fb94[_0xded8('0xe')]);}switch(_0x5af017[_0xded8('0x4')][_0xded8('0x5')]()){case _0xded8('0xf'):case _0xded8('0x10'):_0x57ffd0=null;_0x16ba20['qs']=_0xceea05;break;case _0xded8('0x11'):case _0xded8('0x12'):if(_0x5af017[_0xded8('0x13')]){try{_0x57ffd0=JSON[_0xded8('0xc')](Mustache[_0xded8('0x6')](_0x5af017[_0xded8('0x13')],_0xceea05));_0x16ba20[_0xded8('0x14')]=_0x57ffd0;}catch(_0x2859bc){logger[_0xded8('0xd')](_0x2859bc[_0xded8('0xe')]);logger[_0xded8('0xd')](_0xded8('0x15'));}}else{_0x57ffd0=_0xceea05;_0x16ba20[_0xded8('0x14')]=_0x57ffd0;}break;}logger['info'](util[_0xded8('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x5af017[_0xded8('0x4')],_0x5af017[_0xded8('0x7')],JSON[_0xded8('0x17')](_0x16ba20)));rp(_0x16ba20)['then'](function(_0x100706){_0x57ffd0=!_[_0xded8('0x18')](_0x57ffd0)?',\x20request\x20body:\x20'+_0x57ffd0:'';_0x4111b7=typeof _0x100706[_0xded8('0x14')]===_0xded8('0x19')?JSON['stringify'](_0x100706[_0xded8('0x14')]):_0x100706[_0xded8('0x14')];logger[_0xded8('0x1a')](util[_0xded8('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x5af017[_0xded8('0x4')],_0x5af017[_0xded8('0x7')],_0x100706[_0xded8('0x1b')],_0x4111b7));})[_0xded8('0x1c')](function(_0x32ae90){logger[_0xded8('0xd')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5af017[_0xded8('0x4')],_0x5af017[_0xded8('0x7')],_0x32ae90[_0xded8('0x1b')],_0x32ae90['name'],_0x32ae90[_0xded8('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8f5dcd2..c43bf4b 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 _0x58a4=['debug','rpc','routing','error','message','result','catch','exports','bluebird','../../config/logger','client','http','then'];(function(_0x1e2447,_0x5fea89){var _0x306f03=function(_0x11ac2c){while(--_0x11ac2c){_0x1e2447['push'](_0x1e2447['shift']());}};_0x306f03(++_0x5fea89);}(_0x58a4,0x181));var _0x458a=function(_0x3feec6,_0x4db012){_0x3feec6=_0x3feec6-0x0;var _0x56d5e2=_0x58a4[_0x3feec6];return _0x56d5e2;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x458a('0x0'));var logger=require(_0x458a('0x1'))('routing');var client=jayson[_0x458a('0x2')][_0x458a('0x3')]({'port':0x2329});client['Request']=function(_0x267382,_0x4686ba){return new BPromise(function(_0x1a167d,_0xed9c40){return client['request'](_0x267382,_0x4686ba)[_0x458a('0x4')](function(_0x381637){logger[_0x458a('0x5')](_0x458a('0x6'),_0x458a('0x7'),_0x267382,_0x4686ba,_0x381637);if(_0x381637[_0x458a('0x8')]){logger[_0x458a('0x8')]('rpc','routing',_0x267382,_0x381637[_0x458a('0x8')][_0x458a('0x9')],_0x4686ba);return _0xed9c40(_0x381637['error'][_0x458a('0x9')]);}else{return _0x1a167d(_0x381637[_0x458a('0xa')]);}})[_0x458a('0xb')](function(_0x1296dd){logger[_0x458a('0x8')](_0x458a('0x6'),_0x458a('0x7'),_0x267382,_0x1296dd,_0x4686ba);return _0xed9c40(_0x1296dd);});});};module[_0x458a('0xc')]=client; \ No newline at end of file +var _0x7aec=['message','result','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','error','rpc'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x7aec,0x1e0));var _0xc7ae=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x7aec[_0x2aec52];return _0x3b8835;};'use strict';var jayson=require(_0xc7ae('0x0'));var BPromise=require('bluebird');var logger=require(_0xc7ae('0x1'))(_0xc7ae('0x2'));var client=jayson[_0xc7ae('0x3')][_0xc7ae('0x4')]({'port':0x2329});client[_0xc7ae('0x5')]=function(_0x359eb8,_0x1e59bf){return new BPromise(function(_0x352071,_0x37db7f){return client[_0xc7ae('0x6')](_0x359eb8,_0x1e59bf)[_0xc7ae('0x7')](function(_0x395da4){logger['debug']('rpc','routing',_0x359eb8,_0x1e59bf,_0x395da4);if(_0x395da4[_0xc7ae('0x8')]){logger[_0xc7ae('0x8')](_0xc7ae('0x9'),_0xc7ae('0x2'),_0x359eb8,_0x395da4[_0xc7ae('0x8')][_0xc7ae('0xa')],_0x1e59bf);return _0x37db7f(_0x395da4[_0xc7ae('0x8')]['message']);}else{return _0x352071(_0x395da4[_0xc7ae('0xb')]);}})[_0xc7ae('0xc')](function(_0x1e0370){logger[_0xc7ae('0x8')](_0xc7ae('0x9'),_0xc7ae('0x2'),_0x359eb8,_0x1e0370,_0x1e59bf);return _0x37db7f(_0x1e0370);});});};module[_0xc7ae('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 84cb19c..d2cccfd 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 _0x99ba=['loginMailFrequency','catch','error','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','mailAccounts','listen','getSettings'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x99ba,0x12f));var _0xa99b=function(_0x5a689e,_0x2d030d){_0x5a689e=_0x5a689e-0x0;var _0x5ab9c0=_0x99ba[_0x5a689e];return _0x5ab9c0;};'use strict';var server=require(_0xa99b('0x0'));var Realtime=require(_0xa99b('0x1'));var EmailChannel=require(_0xa99b('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xa99b('0x3'));var logger=require(_0xa99b('0x4'))(_0xa99b('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa99b('0x6')]()['then'](mailAccount['getMailAccounts']())[_0xa99b('0x7')](realtime[_0xa99b('0x8')]())[_0xa99b('0x7')](function(){email['refresh'](realtime[_0xa99b('0x9')]);return realtime;});}function main(){return server[_0xa99b('0xa')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xa99b('0xb')]();})[_0xa99b('0x7')](function(_0x5babd7){return setInterval(initRealtime,_0x5babd7[_0xa99b('0xc')]*0x3e8);})[_0xa99b('0xd')](function(_0x1d4401){logger[_0xa99b('0xe')]('Email\x20service\x20initialization',_0x1d4401);});}main(); \ No newline at end of file +var _0x8468=['getMailAccounts','refresh','mailAccounts','listen','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8468,0x95));var _0x8846=function(_0x38f481,_0x5a4ebf){_0x38f481=_0x38f481-0x0;var _0x574b89=_0x8468[_0x38f481];return _0x574b89;};'use strict';var server=require(_0x8846('0x0'));var Realtime=require(_0x8846('0x1'));var EmailChannel=require(_0x8846('0x2'));var mailAccount=require(_0x8846('0x3'));var setting=require('./rpc/setting');var logger=require(_0x8846('0x4'))(_0x8846('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x8846('0x6')](mailAccount[_0x8846('0x7')]())[_0x8846('0x6')](realtime['initMailAccounts']())[_0x8846('0x6')](function(){email[_0x8846('0x8')](realtime[_0x8846('0x9')]);return realtime;});}function main(){return server[_0x8846('0xa')](realtime,email)[_0x8846('0x6')](function(){return initRealtime();})[_0x8846('0x6')](function(){return setting['getSettings']();})[_0x8846('0x6')](function(_0x2dfa2b){return setInterval(initRealtime,_0x2dfa2b['loginMailFrequency']*0x3e8);})['catch'](function(_0x316907){logger['error'](_0x8846('0xb'),_0x316907);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ab1b313..71e5356 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 _0x0c77=['then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','Imap','status','total','isNil','mailAccount:update','hasOwnProperty','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','handleImapEnd','handleImapError','disabled','messageStatus','prototype','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify'];(function(_0x3a3d20,_0x244316){var _0x33bc94=function(_0x215ba9){while(--_0x215ba9){_0x3a3d20['push'](_0x3a3d20['shift']());}};_0x33bc94(++_0x244316);}(_0x0c77,0xfd));var _0x70c7=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x0c77[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x70c7('0x0'));var moment=require(_0x70c7('0x1'));var BPromise=require(_0x70c7('0x2'));var md5=require(_0x70c7('0x3'));var Redis=require(_0x70c7('0x4'));var config=require(_0x70c7('0x5'));var logger=require(_0x70c7('0x6'))(_0x70c7('0x7'));config['redis']=_[_0x70c7('0x8')](config['redis'],{'host':_0x70c7('0x9'),'port':0x18eb});var io=require(_0x70c7('0xa'))(new Redis(config[_0x70c7('0xb')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x70c7('0xc'));var mailAccount=require(_0x70c7('0xd'));var md5Accounts={};function EmailChannel(_0x1a53d1){logger['info'](_0x70c7('0xe'));this[_0x70c7('0xf')]=_0x1a53d1[_0x70c7('0xf')];this['imapAccounts']={};this[_0x70c7('0x10')]=new EmailSmtp();}EmailChannel['prototype'][_0x70c7('0x11')]=function(_0x252339){var _0x158f71=this['mailAccounts'][_0x252339];var _0x4643da={'id':_0x158f71['id'],'name':_0x158f71[_0x70c7('0x12')],'key':_0x158f71[_0x70c7('0x13')],'active':_0x158f71[_0x70c7('0x14')],'Imap':{'status':_0x158f71[_0x70c7('0x15')][_0x70c7('0x16')],'messageStatus':_0x158f71[_0x70c7('0x15')]['messageStatus'],'total':_0x158f71[_0x70c7('0x15')][_0x70c7('0x17')]}};if(_[_0x70c7('0x18')](md5Accounts[_0x252339])){md5Accounts[_0x252339]={};}var _0x313165=md5(JSON['stringify'](_0x4643da));if(md5Accounts[_0x252339]['md5']!==_0x313165){md5Accounts[_0x252339][_0x70c7('0x3')]=_0x313165;io[_0x70c7('0x11')](_0x70c7('0x19'),_0x4643da);}};EmailChannel['prototype']['refresh']=function(_0x3a6eeb){for(var _0x3e4bcd in _0x3a6eeb){if(_0x3a6eeb[_0x70c7('0x1a')](_0x3e4bcd)){if(_0x3a6eeb[_0x3e4bcd][_0x70c7('0x15')]&&_0x3a6eeb[_0x3e4bcd][_0x70c7('0x14')]){var _0x32ad85=_0x3a6eeb[_0x3e4bcd]['Imap'];if(!_0x32ad85[_0x70c7('0x1b')]&&_0x3a6eeb[_0x3e4bcd][_0x70c7('0x1c')]!=='custom')_0x32ad85[_0x70c7('0x1b')]=_0x3a6eeb[_0x3e4bcd]['provider'];if(!this['imapAccounts'][_0x70c7('0x1a')](_0x32ad85['id'])){this[_0x70c7('0x1d')][_0x32ad85['id']]=new EmailImap(_0x32ad85,_0x3a6eeb[_0x3e4bcd][_0x70c7('0x7')]);this['imapAccounts'][_0x32ad85['id']]['on'](_0x70c7('0x1e'),this[_0x70c7('0x1f')][_0x70c7('0x20')](this,_0x3e4bcd));this[_0x70c7('0x1d')][_0x32ad85['id']]['on'](_0x70c7('0x7'),this[_0x70c7('0x21')]['bind'](this,_0x3e4bcd));this[_0x70c7('0x1d')][_0x32ad85['id']]['on']('end',this[_0x70c7('0x22')]['bind'](this,_0x3e4bcd));this[_0x70c7('0x1d')][_0x32ad85['id']]['on']('error',this[_0x70c7('0x23')][_0x70c7('0x20')](this,_0x3e4bcd));}}else{if(_['isNil'](this['mailAccounts'][_0x3e4bcd]['Imap'])){this[_0x70c7('0xf')][_0x3e4bcd]['Imap']={};}this[_0x70c7('0xf')][_0x3e4bcd][_0x70c7('0x15')][_0x70c7('0x16')]=_0x70c7('0x24');this[_0x70c7('0xf')][_0x3e4bcd][_0x70c7('0x15')][_0x70c7('0x25')]='';this['emit'](_0x3e4bcd);}}}};EmailChannel[_0x70c7('0x26')][_0x70c7('0x1f')]=function(_0x186ee2,_0x408885){if(this[_0x70c7('0xf')][_0x186ee2]){this['mailAccounts'][_0x186ee2]['Imap'][_0x70c7('0x16')]=_0x70c7('0x27');this[_0x70c7('0xf')][_0x186ee2]['Imap'][_0x70c7('0x25')]=_0x408885[_0x70c7('0x12')];if(_0x408885[_0x70c7('0x28')]){this['mailAccounts'][_0x186ee2][_0x70c7('0x15')][_0x70c7('0x17')]=_0x408885[_0x70c7('0x28')][_0x70c7('0x17')];}return this[_0x70c7('0x11')](_0x186ee2);}};EmailChannel[_0x70c7('0x26')][_0x70c7('0x21')]=function(_0x27c3b0,_0x542011){logger[_0x70c7('0x29')](_0x70c7('0x2a'),_0x542011[_0x70c7('0x2b')],_0x542011[_0x70c7('0x2c')],_0x542011[_0x70c7('0x2d')],_0x27c3b0);if(this[_0x70c7('0xf')][_0x27c3b0]){return mailAccount[_0x70c7('0x2e')](_0x27c3b0,_0x542011)[_0x70c7('0x2f')](function(_0x134eed){if(_0x134eed){logger[_0x70c7('0x29')](_0x70c7('0x30'));}})[_0x70c7('0x31')](function(_0x8dae47){logger[_0x70c7('0x32')](_0x70c7('0x33'),JSON[_0x70c7('0x34')](_0x8dae47));});}};EmailChannel['prototype'][_0x70c7('0x22')]=function(_0x1e33ef){if(this[_0x70c7('0xf')][_0x1e33ef]&&this[_0x70c7('0xf')][_0x1e33ef][_0x70c7('0x15')]){if(this['imapAccounts'][this['mailAccounts'][_0x1e33ef][_0x70c7('0x15')]['id']]){delete this['imapAccounts'][this[_0x70c7('0xf')][_0x1e33ef][_0x70c7('0x15')]['id']];}this[_0x70c7('0xf')][_0x1e33ef][_0x70c7('0x15')][_0x70c7('0x35')]=moment();this['emit'](_0x1e33ef);}};EmailChannel[_0x70c7('0x26')][_0x70c7('0x23')]=function(_0x58a50a,_0x2f00c5){if(this[_0x70c7('0xf')][_0x58a50a]){this[_0x70c7('0xf')][_0x58a50a][_0x70c7('0x15')][_0x70c7('0x16')]=_0x70c7('0x32');this[_0x70c7('0xf')][_0x58a50a][_0x70c7('0x15')][_0x70c7('0x25')]=_0x2f00c5;return this[_0x70c7('0x11')](_0x58a50a);}};EmailChannel[_0x70c7('0x26')][_0x70c7('0x36')]=function(_0x53758f,_0xd56445){return this[_0x70c7('0x10')][_0x70c7('0x37')](_0x53758f,_0xd56445);};EmailChannel[_0x70c7('0x26')][_0x70c7('0x38')]=function(_0x41d86d){var _0x5d3f1c=this;if(this[_0x70c7('0xf')][_0x41d86d['id']]){if(_['isNil'](this[_0x70c7('0xf')][_0x41d86d['id']][_0x70c7('0x39')])){this['mailAccounts'][_0x41d86d['id']][_0x70c7('0x39')]={};}this['mailAccounts'][_0x41d86d['id']][_0x70c7('0x39')]['lastSync']=moment();return new BPromise(function(_0x1ef631,_0xd81bbd){return _0x5d3f1c['smtp'][_0x70c7('0x3a')](_0x41d86d)['then'](function(_0x1b2ca5){_0x5d3f1c[_0x70c7('0xf')][_0x41d86d['id']][_0x70c7('0x39')][_0x70c7('0x16')]=_0x70c7('0x3b');_0x5d3f1c['mailAccounts'][_0x41d86d['id']][_0x70c7('0x39')][_0x70c7('0x25')]='';_0x5d3f1c[_0x70c7('0x11')](_0x41d86d['id']);_0x1ef631(_0x1b2ca5);})[_0x70c7('0x31')](function(_0x59a83d){_0x5d3f1c['mailAccounts'][_0x41d86d['id']][_0x70c7('0x39')][_0x70c7('0x16')]='error';_0x5d3f1c[_0x70c7('0xf')][_0x41d86d['id']][_0x70c7('0x39')][_0x70c7('0x25')]=_0x59a83d;_0x5d3f1c[_0x70c7('0x11')](_0x41d86d['id']);_0xd81bbd(_0x59a83d);});});}return this[_0x70c7('0x10')][_0x70c7('0x3a')](_0x41d86d);};module['exports']=EmailChannel; \ No newline at end of file +var _0x366b=['send','verifySmtp','Smtp','verify','exports','moment','bluebird','ioredis','../../../config/environment','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','md5','mailAccount:update','refresh','provider','custom','service','hasOwnProperty','bind','end','disabled','handleImapBox','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','sendMail'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x366b,0x10e));var _0xb366=function(_0x33bc95,_0x2fed14){_0x33bc95=_0x33bc95-0x0;var _0x2f10a3=_0x366b[_0x33bc95];return _0x2f10a3;};'use strict';var _=require('lodash');var moment=require(_0xb366('0x0'));var BPromise=require(_0xb366('0x1'));var md5=require('md5');var Redis=require(_0xb366('0x2'));var config=require(_0xb366('0x3'));var logger=require('../../../config/logger')(_0xb366('0x4'));config[_0xb366('0x5')]=_[_0xb366('0x6')](config['redis'],{'host':_0xb366('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb366('0x5')]));var EmailImap=require(_0xb366('0x8'));var EmailSmtp=require(_0xb366('0x9'));var mailAccount=require(_0xb366('0xa'));var md5Accounts={};function EmailChannel(_0x290dba){logger['info']('start\x20email\x20channel');this[_0xb366('0xb')]=_0x290dba[_0xb366('0xb')];this[_0xb366('0xc')]={};this[_0xb366('0xd')]=new EmailSmtp();}EmailChannel[_0xb366('0xe')][_0xb366('0xf')]=function(_0x4c010d){var _0x5bb9a0=this[_0xb366('0xb')][_0x4c010d];var _0x1933af={'id':_0x5bb9a0['id'],'name':_0x5bb9a0[_0xb366('0x10')],'key':_0x5bb9a0[_0xb366('0x11')],'active':_0x5bb9a0[_0xb366('0x12')],'Imap':{'status':_0x5bb9a0[_0xb366('0x13')][_0xb366('0x14')],'messageStatus':_0x5bb9a0['Imap'][_0xb366('0x15')],'total':_0x5bb9a0[_0xb366('0x13')][_0xb366('0x16')]}};if(_['isNil'](md5Accounts[_0x4c010d])){md5Accounts[_0x4c010d]={};}var _0x357de1=md5(JSON['stringify'](_0x1933af));if(md5Accounts[_0x4c010d][_0xb366('0x17')]!==_0x357de1){md5Accounts[_0x4c010d]['md5']=_0x357de1;io[_0xb366('0xf')](_0xb366('0x18'),_0x1933af);}};EmailChannel[_0xb366('0xe')][_0xb366('0x19')]=function(_0x2c6706){for(var _0x3e6915 in _0x2c6706){if(_0x2c6706['hasOwnProperty'](_0x3e6915)){if(_0x2c6706[_0x3e6915][_0xb366('0x13')]&&_0x2c6706[_0x3e6915][_0xb366('0x12')]){var _0x55558d=_0x2c6706[_0x3e6915][_0xb366('0x13')];if(!_0x55558d['service']&&_0x2c6706[_0x3e6915][_0xb366('0x1a')]!==_0xb366('0x1b'))_0x55558d[_0xb366('0x1c')]=_0x2c6706[_0x3e6915][_0xb366('0x1a')];if(!this[_0xb366('0xc')][_0xb366('0x1d')](_0x55558d['id'])){this[_0xb366('0xc')][_0x55558d['id']]=new EmailImap(_0x55558d,_0x2c6706[_0x3e6915][_0xb366('0x4')]);this['imapAccounts'][_0x55558d['id']]['on']('box',this['handleImapBox'][_0xb366('0x1e')](this,_0x3e6915));this[_0xb366('0xc')][_0x55558d['id']]['on'](_0xb366('0x4'),this['handleImapEmail'][_0xb366('0x1e')](this,_0x3e6915));this[_0xb366('0xc')][_0x55558d['id']]['on'](_0xb366('0x1f'),this['handleImapEnd'][_0xb366('0x1e')](this,_0x3e6915));this[_0xb366('0xc')][_0x55558d['id']]['on']('error',this['handleImapError'][_0xb366('0x1e')](this,_0x3e6915));}}else{if(_['isNil'](this['mailAccounts'][_0x3e6915][_0xb366('0x13')])){this[_0xb366('0xb')][_0x3e6915]['Imap']={};}this['mailAccounts'][_0x3e6915][_0xb366('0x13')][_0xb366('0x14')]=_0xb366('0x20');this['mailAccounts'][_0x3e6915][_0xb366('0x13')][_0xb366('0x15')]='';this[_0xb366('0xf')](_0x3e6915);}}}};EmailChannel[_0xb366('0xe')][_0xb366('0x21')]=function(_0x242d9b,_0x2bbb9b){if(this[_0xb366('0xb')][_0x242d9b]){this[_0xb366('0xb')][_0x242d9b][_0xb366('0x13')][_0xb366('0x14')]='connected';this[_0xb366('0xb')][_0x242d9b][_0xb366('0x13')]['messageStatus']=_0x2bbb9b[_0xb366('0x10')];if(_0x2bbb9b[_0xb366('0x22')]){this[_0xb366('0xb')][_0x242d9b][_0xb366('0x13')]['total']=_0x2bbb9b['messages']['total'];}return this[_0xb366('0xf')](_0x242d9b);}};EmailChannel[_0xb366('0xe')][_0xb366('0x23')]=function(_0x101ba4,_0x595014){logger[_0xb366('0x24')](_0xb366('0x25'),_0x595014['firstName'],_0x595014['lastName'],_0x595014['from'],_0x101ba4);if(this[_0xb366('0xb')][_0x101ba4]){return mailAccount[_0xb366('0x26')](_0x101ba4,_0x595014)[_0xb366('0x27')](function(_0xc0440b){if(_0xc0440b){logger[_0xb366('0x24')](_0xb366('0x28'));}})[_0xb366('0x29')](function(_0x35e95f){logger[_0xb366('0x2a')](_0xb366('0x2b'),JSON[_0xb366('0x2c')](_0x35e95f));});}};EmailChannel[_0xb366('0xe')][_0xb366('0x2d')]=function(_0x417aec){if(this[_0xb366('0xb')][_0x417aec]&&this['mailAccounts'][_0x417aec][_0xb366('0x13')]){if(this[_0xb366('0xc')][this[_0xb366('0xb')][_0x417aec][_0xb366('0x13')]['id']]){delete this[_0xb366('0xc')][this[_0xb366('0xb')][_0x417aec][_0xb366('0x13')]['id']];}this[_0xb366('0xb')][_0x417aec][_0xb366('0x13')][_0xb366('0x2e')]=moment();this[_0xb366('0xf')](_0x417aec);}};EmailChannel['prototype']['handleImapError']=function(_0x40f265,_0x558c88){if(this[_0xb366('0xb')][_0x40f265]){this[_0xb366('0xb')][_0x40f265]['Imap'][_0xb366('0x14')]='error';this['mailAccounts'][_0x40f265][_0xb366('0x13')]['messageStatus']=_0x558c88;return this[_0xb366('0xf')](_0x40f265);}};EmailChannel['prototype'][_0xb366('0x2f')]=function(_0x115af5,_0x4aa0ec){return this['smtp'][_0xb366('0x30')](_0x115af5,_0x4aa0ec);};EmailChannel[_0xb366('0xe')][_0xb366('0x31')]=function(_0x3fb084){var _0x349afc=this;if(this[_0xb366('0xb')][_0x3fb084['id']]){if(_['isNil'](this[_0xb366('0xb')][_0x3fb084['id']][_0xb366('0x32')])){this[_0xb366('0xb')][_0x3fb084['id']][_0xb366('0x32')]={};}this['mailAccounts'][_0x3fb084['id']][_0xb366('0x32')]['lastSync']=moment();return new BPromise(function(_0x295f89,_0x30192d){return _0x349afc['smtp'][_0xb366('0x33')](_0x3fb084)['then'](function(_0x194286){_0x349afc[_0xb366('0xb')][_0x3fb084['id']]['Smtp'][_0xb366('0x14')]='verified';_0x349afc[_0xb366('0xb')][_0x3fb084['id']][_0xb366('0x32')][_0xb366('0x15')]='';_0x349afc[_0xb366('0xf')](_0x3fb084['id']);_0x295f89(_0x194286);})[_0xb366('0x29')](function(_0xf7d715){_0x349afc[_0xb366('0xb')][_0x3fb084['id']]['Smtp'][_0xb366('0x14')]=_0xb366('0x2a');_0x349afc[_0xb366('0xb')][_0x3fb084['id']][_0xb366('0x32')][_0xb366('0x15')]=_0xf7d715;_0x349afc['emit'](_0x3fb084['id']);_0x30192d(_0xf7d715);});});}return this[_0xb366('0xd')][_0xb366('0x33')](_0x3fb084);};module[_0xb366('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f28c4bb..9a21f36 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 _0x088a=['handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','password','authentication','anonymous@xcally.com','port','tls','mailbox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','mailparser','simpleParser','iconv','events','EventEmitter','./utils','email','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','error'];(function(_0x389728,_0x59caf5){var _0xe9359=function(_0x4201b9){while(--_0x4201b9){_0x389728['push'](_0x389728['shift']());}};_0xe9359(++_0x59caf5);}(_0x088a,0x192));var _0xa088=function(_0x3f4721,_0x28fe30){_0x3f4721=_0x3f4721-0x0;var _0x429e40=_0x088a[_0x3f4721];return _0x429e40;};'use strict';var _=require('lodash');var util=require(_0xa088('0x0'));var Imap=require('imap');var simpleParser=require(_0xa088('0x1'))[_0xa088('0x2')];var Iconv=require(_0xa088('0x3'))['Iconv'];var EventEmitter=require(_0xa088('0x4'))[_0xa088('0x5')];var utils=require(_0xa088('0x6'));var logger=require('../../../config/logger')(_0xa088('0x7'));function EmailImap(_0x48c546,_0x1b9991){this['mailbox']=_0x48c546['mailbox'];this[_0xa088('0x8')]=this[_0xa088('0x9')](_0x48c546,_0x1b9991);this[_0xa088('0xa')]=new Imap(this[_0xa088('0x8')]);this['imap'][_0xa088('0xb')](_0xa088('0xc'),this[_0xa088('0xd')][_0xa088('0xe')](this));this['imap'][_0xa088('0xb')](_0xa088('0xf'),this[_0xa088('0x10')][_0xa088('0xe')](this));this[_0xa088('0xa')]['on'](_0xa088('0x11'),this[_0xa088('0x12')][_0xa088('0xe')](this));this[_0xa088('0xa')][_0xa088('0x13')]();}util[_0xa088('0x14')](EmailImap,EventEmitter);EmailImap[_0xa088('0x15')][_0xa088('0x9')]=function(_0xb487d4,_0x41c045){var _0x5af3d5={'connTimeout':_0xb487d4['connTimeout']?_0xb487d4[_0xa088('0x16')]*0x3e8:0x2710,'authTimeout':_0xb487d4[_0xa088('0x17')]?_0xb487d4[_0xa088('0x17')]*0x3e8:0x1388};if(_0xb487d4[_0xa088('0x18')]){_0x5af3d5[_0xa088('0x19')]=_0xb487d4['user'];if(_0xb487d4['modernAuthentication']){_0x5af3d5[_0xa088('0x1a')]=utils[_0xa088('0x1b')](_0xb487d4['CloudProvider']['data5'],_0xb487d4[_0xa088('0x19')]);}else{_0x5af3d5['password']=_0xb487d4[_0xa088('0x1c')];}}else{if(_0xb487d4[_0xa088('0x1d')]){_0x5af3d5[_0xa088('0x19')]=_0xb487d4[_0xa088('0x19')];_0x5af3d5[_0xa088('0x1c')]=_0xb487d4[_0xa088('0x1c')];}}_0x5af3d5[_0xa088('0x7')]=_0x41c045||_0xb487d4[_0xa088('0x19')]||_0xa088('0x1e');_0x5af3d5['host']=_0xb487d4['host'];_0x5af3d5[_0xa088('0x1f')]=_0xb487d4[_0xa088('0x1f')]||0x3e1;if(_0xb487d4[_0xa088('0x20')]){_0x5af3d5[_0xa088('0x20')]=!![];}else{_0x5af3d5[_0xa088('0x20')]=![];_0x5af3d5['autotls']='required';}return _0x5af3d5;};EmailImap[_0xa088('0x15')]['handleReady']=function(){this[_0xa088('0xa')]['openBox'](this[_0xa088('0x21')],![],this[_0xa088('0x22')][_0xa088('0xe')](this));};EmailImap[_0xa088('0x15')][_0xa088('0x22')]=function(_0x3b4197,_0x34e0b4){if(_0x3b4197){this[_0xa088('0x12')](_0x3b4197,!![]);}else{this[_0xa088('0x23')](_0xa088('0x24'),_0x34e0b4);this[_0xa088('0x25')]();}};EmailImap[_0xa088('0x15')]['handleCloseBox']=function(_0x69607a){if(_0x69607a){this[_0xa088('0x12')](_0x69607a,!![]);}else{this[_0xa088('0xa')]['end']();}};EmailImap['prototype'][_0xa088('0x25')]=function(){this[_0xa088('0xa')][_0xa088('0x26')]([_0xa088('0x27')],this[_0xa088('0x28')][_0xa088('0xe')](this));};EmailImap[_0xa088('0x15')][_0xa088('0x28')]=function(_0x39eee5,_0x27b27a){if(_0x39eee5){this[_0xa088('0x12')](_0x39eee5,!![]);}else{if(_0x27b27a[_0xa088('0x29')]){try{var _0x39fdd4=this[_0xa088('0xa')][_0xa088('0x2a')](_0x27b27a,{'bodies':'','markSeen':!![]});_0x39fdd4['on'](_0xa088('0x2b'),this[_0xa088('0x2c')][_0xa088('0xe')](this));_0x39fdd4['once'](_0xa088('0x11'),this[_0xa088('0x2d')][_0xa088('0xe')](this));_0x39fdd4[_0xa088('0xb')](_0xa088('0xf'),this['handleFetchEnd'][_0xa088('0xe')](this));}catch(_0x1f5649){logger[_0xa088('0x11')](_0x1f5649);}}else{this['imap'][_0xa088('0x2e')](!![],this[_0xa088('0x2f')][_0xa088('0xe')](this));}}};EmailImap[_0xa088('0x15')][_0xa088('0x2c')]=function(_0x58939d){_0x58939d['on'](_0xa088('0x30'),this[_0xa088('0x31')][_0xa088('0xe')](this));_0x58939d[_0xa088('0xb')]('attributes',this[_0xa088('0x32')][_0xa088('0xe')](this));_0x58939d[_0xa088('0xb')]('end',this['handleMessageEnd'][_0xa088('0xe')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x372075){simpleParser(_0x372075,{'Iconv':Iconv},this[_0xa088('0x33')][_0xa088('0xe')](this));};EmailImap[_0xa088('0x15')]['handleMessageAttributes']=function(){};EmailImap[_0xa088('0x15')][_0xa088('0x34')]=function(){};EmailImap['prototype'][_0xa088('0x33')]=function(_0x51c2c7,_0x4402e7){if(_0x51c2c7){logger[_0xa088('0x11')](_0x51c2c7);}else{var _0x573833=this;utils[_0xa088('0x35')](this[_0xa088('0x8')],_0x4402e7,function(_0x3cca08){_0x573833[_0xa088('0x23')]('email',_0x3cca08);});}};EmailImap[_0xa088('0x15')][_0xa088('0x36')]=function(){this[_0xa088('0xa')]['closeBox'](!![],this[_0xa088('0x2f')][_0xa088('0xe')](this));};EmailImap[_0xa088('0x15')][_0xa088('0x2d')]=function(_0x384354){this[_0xa088('0x12')](_0x384354);this[_0xa088('0xa')]['closeBox'](!![],this['handleCloseBox'][_0xa088('0xe')](this));};EmailImap[_0xa088('0x15')][_0xa088('0x10')]=function(){this['emit'](_0xa088('0xf'));};EmailImap[_0xa088('0x15')][_0xa088('0x12')]=function(_0x411e1e,_0x10df1d){logger[_0xa088('0x11')](_0xa088('0x12'),this[_0xa088('0x8')][_0xa088('0x7')],JSON[_0xa088('0x37')](_0x411e1e));var _0x52cecd='';if(_0x411e1e){if(_0x411e1e[_0xa088('0x38')]){_0x52cecd=_0x411e1e['textCode'];}else{for(var _0x4d5fac in _0x411e1e){if(_0x411e1e[_0xa088('0x39')](_0x4d5fac)){_0x52cecd+=_[_0xa088('0x3a')](_0x4d5fac)+':\x20'+_0x411e1e[_0x4d5fac]+'\x0a';}}}}if(_0x10df1d){this['imap'][_0xa088('0xf')]();}else{this[_0xa088('0x23')]('error',_0x52cecd);this['emit']('end');}};module[_0xa088('0x3b')]=EmailImap; \ No newline at end of file +var _0x008e=['required','openBox','handleOpenBox','bind','handleError','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','end','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','parser','textCode','hasOwnProperty','upperFirst','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','mailbox','account','once','handleReady','handleEnd','error','connect','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls'];(function(_0x5447c1,_0x3635ab){var _0x3ebcab=function(_0x10178c){while(--_0x10178c){_0x5447c1['push'](_0x5447c1['shift']());}};_0x3ebcab(++_0x3635ab);}(_0x008e,0x182));var _0xe008=function(_0x358365,_0x259198){_0x358365=_0x358365-0x0;var _0x476c61=_0x008e[_0x358365];return _0x476c61;};'use strict';var _=require('lodash');var util=require(_0xe008('0x0'));var Imap=require(_0xe008('0x1'));var simpleParser=require('mailparser')[_0xe008('0x2')];var Iconv=require(_0xe008('0x3'))[_0xe008('0x4')];var EventEmitter=require(_0xe008('0x5'))[_0xe008('0x6')];var utils=require('./utils');var logger=require(_0xe008('0x7'))('email');function EmailImap(_0x59da9e,_0x2a7db8){this['mailbox']=_0x59da9e[_0xe008('0x8')];this[_0xe008('0x9')]=this['getAccount'](_0x59da9e,_0x2a7db8);this['imap']=new Imap(this[_0xe008('0x9')]);this[_0xe008('0x1')][_0xe008('0xa')]('ready',this[_0xe008('0xb')]['bind'](this));this[_0xe008('0x1')][_0xe008('0xa')]('end',this[_0xe008('0xc')]['bind'](this));this[_0xe008('0x1')]['on'](_0xe008('0xd'),this['handleError']['bind'](this));this[_0xe008('0x1')][_0xe008('0xe')]();}util[_0xe008('0xf')](EmailImap,EventEmitter);EmailImap[_0xe008('0x10')][_0xe008('0x11')]=function(_0x5bea92,_0x122cd3){var _0x165f9a={'connTimeout':_0x5bea92[_0xe008('0x12')]?_0x5bea92[_0xe008('0x12')]*0x3e8:0x2710,'authTimeout':_0x5bea92['authTimeout']?_0x5bea92[_0xe008('0x13')]*0x3e8:0x1388};if(_0x5bea92[_0xe008('0x14')]){_0x165f9a[_0xe008('0x15')]=_0x5bea92[_0xe008('0x15')];if(_0x5bea92[_0xe008('0x16')]){_0x165f9a[_0xe008('0x17')]=utils[_0xe008('0x18')](_0x5bea92[_0xe008('0x19')]['data5'],_0x5bea92[_0xe008('0x15')]);}else{_0x165f9a[_0xe008('0x1a')]=_0x5bea92[_0xe008('0x1a')];}}else{if(_0x5bea92[_0xe008('0x1b')]){_0x165f9a[_0xe008('0x15')]=_0x5bea92[_0xe008('0x15')];_0x165f9a[_0xe008('0x1a')]=_0x5bea92[_0xe008('0x1a')];}}_0x165f9a[_0xe008('0x1c')]=_0x122cd3||_0x5bea92[_0xe008('0x15')]||_0xe008('0x1d');_0x165f9a[_0xe008('0x1e')]=_0x5bea92[_0xe008('0x1e')];_0x165f9a[_0xe008('0x1f')]=_0x5bea92[_0xe008('0x1f')]||0x3e1;if(_0x5bea92[_0xe008('0x20')]){_0x165f9a[_0xe008('0x20')]=!![];}else{_0x165f9a[_0xe008('0x20')]=![];_0x165f9a[_0xe008('0x21')]=_0xe008('0x22');}return _0x165f9a;};EmailImap['prototype'][_0xe008('0xb')]=function(){this[_0xe008('0x1')][_0xe008('0x23')](this['mailbox'],![],this[_0xe008('0x24')][_0xe008('0x25')](this));};EmailImap[_0xe008('0x10')][_0xe008('0x24')]=function(_0x4553a2,_0x161da8){if(_0x4553a2){this[_0xe008('0x26')](_0x4553a2,!![]);}else{this[_0xe008('0x27')]('box',_0x161da8);this[_0xe008('0x28')]();}};EmailImap['prototype'][_0xe008('0x29')]=function(_0x12d8f5){if(_0x12d8f5){this[_0xe008('0x26')](_0x12d8f5,!![]);}else{this[_0xe008('0x1')]['end']();}};EmailImap[_0xe008('0x10')][_0xe008('0x28')]=function(){this[_0xe008('0x1')][_0xe008('0x2a')]([_0xe008('0x2b')],this[_0xe008('0x2c')][_0xe008('0x25')](this));};EmailImap[_0xe008('0x10')]['handleReadUnseen']=function(_0x6f83af,_0x4f8098){if(_0x6f83af){this[_0xe008('0x26')](_0x6f83af,!![]);}else{if(_0x4f8098[_0xe008('0x2d')]){try{var _0x104b4b=this[_0xe008('0x1')][_0xe008('0x2e')](_0x4f8098,{'bodies':'','markSeen':!![]});_0x104b4b['on']('message',this[_0xe008('0x2f')][_0xe008('0x25')](this));_0x104b4b[_0xe008('0xa')]('error',this[_0xe008('0x30')][_0xe008('0x25')](this));_0x104b4b[_0xe008('0xa')](_0xe008('0x31'),this['handleFetchEnd']['bind'](this));}catch(_0x4752b4){logger[_0xe008('0xd')](_0x4752b4);}}else{this[_0xe008('0x1')][_0xe008('0x32')](!![],this[_0xe008('0x29')][_0xe008('0x25')](this));}}};EmailImap['prototype'][_0xe008('0x2f')]=function(_0x4a33c4){_0x4a33c4['on'](_0xe008('0x33'),this[_0xe008('0x34')][_0xe008('0x25')](this));_0x4a33c4[_0xe008('0xa')](_0xe008('0x35'),this[_0xe008('0x36')][_0xe008('0x25')](this));_0x4a33c4[_0xe008('0xa')]('end',this[_0xe008('0x37')]['bind'](this));};EmailImap[_0xe008('0x10')]['handleMessageBody']=function(_0x332174){simpleParser(_0x332174,{'Iconv':Iconv},this['handleSimpleParser'][_0xe008('0x25')](this));};EmailImap[_0xe008('0x10')][_0xe008('0x36')]=function(){};EmailImap['prototype'][_0xe008('0x37')]=function(){};EmailImap[_0xe008('0x10')]['handleSimpleParser']=function(_0x4d5195,_0x39458d){if(_0x4d5195){logger[_0xe008('0xd')](_0x4d5195);}else{var _0x33278b=this;utils[_0xe008('0x38')](this[_0xe008('0x9')],_0x39458d,function(_0x3d700e){_0x33278b[_0xe008('0x27')](_0xe008('0x1c'),_0x3d700e);});}};EmailImap[_0xe008('0x10')]['handleFetchEnd']=function(){this[_0xe008('0x1')][_0xe008('0x32')](!![],this[_0xe008('0x29')]['bind'](this));};EmailImap['prototype'][_0xe008('0x30')]=function(_0x5cc61){this[_0xe008('0x26')](_0x5cc61);this[_0xe008('0x1')][_0xe008('0x32')](!![],this[_0xe008('0x29')]['bind'](this));};EmailImap['prototype'][_0xe008('0xc')]=function(){this[_0xe008('0x27')](_0xe008('0x31'));};EmailImap['prototype'][_0xe008('0x26')]=function(_0x9407a4,_0x503146){logger[_0xe008('0xd')](_0xe008('0x26'),this[_0xe008('0x9')][_0xe008('0x1c')],JSON['stringify'](_0x9407a4));var _0x16738e='';if(_0x9407a4){if(_0x9407a4[_0xe008('0x39')]){_0x16738e=_0x9407a4[_0xe008('0x39')];}else{for(var _0x58ff35 in _0x9407a4){if(_0x9407a4[_0xe008('0x3a')](_0x58ff35)){_0x16738e+=_[_0xe008('0x3b')](_0x58ff35)+':\x20'+_0x9407a4[_0x58ff35]+'\x0a';}}}}if(_0x503146){this[_0xe008('0x1')]['end']();}else{this[_0xe008('0x27')](_0xe008('0xd'),_0x16738e);this[_0xe008('0x27')](_0xe008('0x31'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2224c2a..d9335de 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 _0xcb60=['nodemailer','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','verify','createTransport'];(function(_0x5054e6,_0x2bc724){var _0x31c6c8=function(_0x3f5afc){while(--_0x3f5afc){_0x5054e6['push'](_0x5054e6['shift']());}};_0x31c6c8(++_0x2bc724);}(_0xcb60,0x1ea));var _0x0cb6=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xcb60[_0x1df7b8];return _0x29d911;};'use strict';var nodemailer=require(_0x0cb6('0x0'));var inlineBase64=require(_0x0cb6('0x1'));function EmailSmtp(){}EmailSmtp[_0x0cb6('0x2')][_0x0cb6('0x3')]=function(_0x11b18c,_0x40b383){return new Promise(function(_0x340a7e,_0x3f2fc){var _0x42ed9f=nodemailer['createTransport'](_0x11b18c);_0x42ed9f[_0x0cb6('0x4')](_0x0cb6('0x5'),inlineBase64());_0x42ed9f[_0x0cb6('0x6')](_0x40b383,function(_0x35c43c,_0x5367ce){if(_0x35c43c){_0x3f2fc(_0x35c43c[_0x0cb6('0x7')]());}else{_0x340a7e(_0x5367ce);}});});};EmailSmtp[_0x0cb6('0x2')][_0x0cb6('0x8')]=function(_0x5e8864){return new Promise(function(_0x2eaf33,_0x1738c8){var _0xd8ae9d=nodemailer[_0x0cb6('0x9')](_0x5e8864);_0xd8ae9d[_0x0cb6('0x8')](function(_0x449235,_0x95bee8){if(_0x449235){_0x1738c8(_0x449235['toString']());}else{if(_0x95bee8){_0x2eaf33(_0x95bee8);}else{_0x1738c8('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x2693=['use','compile','toString','Not\x20verifired','nodemailer-plugin-inline-base64','prototype','createTransport'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x2693,0x14d));var _0x3269=function(_0x2795d9,_0x349289){_0x2795d9=_0x2795d9-0x0;var _0x29a3ec=_0x2693[_0x2795d9];return _0x29a3ec;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x3269('0x0'));function EmailSmtp(){}EmailSmtp[_0x3269('0x1')]['send']=function(_0x421555,_0x24b0c9){return new Promise(function(_0x340329,_0x11d090){var _0x5d5dcb=nodemailer[_0x3269('0x2')](_0x421555);_0x5d5dcb[_0x3269('0x3')](_0x3269('0x4'),inlineBase64());_0x5d5dcb['sendMail'](_0x24b0c9,function(_0x52e7cb,_0x92c3f3){if(_0x52e7cb){_0x11d090(_0x52e7cb[_0x3269('0x5')]());}else{_0x340329(_0x92c3f3);}});});};EmailSmtp['prototype']['verify']=function(_0x163d0b){return new Promise(function(_0x3070bb,_0x34db82){var _0x48761a=nodemailer[_0x3269('0x2')](_0x163d0b);_0x48761a['verify'](function(_0x27d923,_0x4c93e8){if(_0x27d923){_0x34db82(_0x27d923[_0x3269('0x5')]());}else{if(_0x4c93e8){_0x3070bb(_0x4c93e8);}else{_0x34db82(_0x3269('0x6'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2e35dd9..7470a99 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 _0xc14a=['writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x283ae5[_0xac14('0x13')](0x0,-0x1)[_0xac14('0x14')]('\x20'):_0x57fd06['name'];}return _0xac14('0x15');}function getLastName(_0x554cb2){var _0xa16206=_['head'](_0x554cb2[_0xac14('0x8')]);if(_0xa16206&&_0xa16206[_0xac14('0xe')]){var _0x215020=_0xa16206[_0xac14('0xe')][_0xac14('0x11')](/\s+/);return _0x215020['length']>0x1?_0x215020[_0xac14('0x16')]():'';}return'';}function getMails(_0x30e23e,_0x414ad6){var _0x5e9118='';for(var _0x3e21bb=0x0;_0x3e21bb<_0x414ad6[_0xac14('0x8')][_0xac14('0x12')];_0x3e21bb+=0x1){if(_0x414ad6[_0xac14('0x8')][_0x3e21bb]['address']!==_0x30e23e){if(!_[_0xac14('0x17')](_0x5e9118)){_0x5e9118+=',';}_0x5e9118+=_0x414ad6[_0xac14('0x8')][_0x3e21bb][_0xac14('0xe')]||_0x414ad6[_0xac14('0x8')][_0x3e21bb][_0xac14('0x9')]||'';_0x5e9118+='\x20<';_0x5e9118+=_0x414ad6[_0xac14('0x8')][_0x3e21bb]['address']?_0x414ad6[_0xac14('0x8')][_0x3e21bb][_0xac14('0x9')]:_0xac14('0xa')+random[_0xac14('0xb')](0x6)+_0xac14('0xc');_0x5e9118+='>';}}return _0x5e9118;}function parseEmail(_0x1196d3,_0x1053cb,_0x42862c){if(_0x1053cb[_0xac14('0x18')]){var _0x2c321a=/)<[^<]*)*<\/script>/gi;while(_0x2c321a['test'](_0x1053cb['html'])){_0x1053cb[_0xac14('0x18')]=_0x1053cb[_0xac14('0x18')]['replace'](_0x2c321a,'');}if(_0x1053cb[_0xac14('0x18')]['includes'](_0xac14('0x19'))){var _0x241cbd=[];_0x1053cb['attachments']['forEach'](_0x176867=>{_0x241cbd[_0xac14('0x1a')](_0x176867[_0xac14('0x1b')]);});var _0x15ab55=/]+>/g;var _0x20fddd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xdd4a28=_0x1053cb[_0xac14('0x18')][_0xac14('0x1c')](_0x20fddd,_0xac14('0x1d'));var _0x3698b3=_0xdd4a28[_0xac14('0x1c')](_0x15ab55,'_IMG');for(let _0x4b190b=0x0;_0x4b190b<_0x241cbd['length'];_0x4b190b++){var _0x41639f=_0x3698b3['replace']('_IMG',_0xac14('0x1e')+_0x241cbd[_0x4b190b]+_0xac14('0x1f'));_0x3698b3=_0x41639f;}_0x1053cb[_0xac14('0x18')]=_0x3698b3;}_0x42862c['body']=_0x1053cb[_0xac14('0x18')];}else{_0x42862c[_0xac14('0x20')]=_0x1053cb[_0xac14('0x21')];}if(_0x42862c[_0xac14('0x20')]){_0x42862c[_0xac14('0x20')]=_0x42862c[_0xac14('0x20')][_0xac14('0x1c')](/0x0){var _0x34c4b8=[_0xac14('0x32'),_0xac14('0x33'),_0xac14('0x34')];for(var _0x5bdf55=0x0;_0x5bdf55<_0x1053cb[_0xac14('0x31')][_0xac14('0x12')];_0x5bdf55++){var _0x2a0f41=_[_0xac14('0x10')](_0x34c4b8,_0x1053cb[_0xac14('0x31')][_0x5bdf55][_0xac14('0x35')]);if(_0x2a0f41>=0x0){_0x42862c[_0xac14('0x36')]=!![];}}}return _0x42862c;}exports['parser']=function(_0x110419,_0x3ef3f3,_0x3e7332){var _0x1e8a26={'from':getAddress(_0x3ef3f3[_0xac14('0x37')]),'firstName':getFirstName(_0x3ef3f3[_0xac14('0x37')]),'lastName':getLastName(_0x3ef3f3[_0xac14('0x37')]),'mapKey':_0xac14('0x25'),'message':{'from':getMails(_0x110419['email'],_0x3ef3f3[_0xac14('0x37')]),'to':_0x110419[_0xac14('0x25')],'cc':'','subject':_0x3ef3f3[_0xac14('0x38')]||'','messageId':_0x3ef3f3[_0xac14('0x39')],'inReplyTo':_0x3ef3f3[_0xac14('0x3a')],'sentAt':moment(_0x3ef3f3[_0xac14('0x3b')])[_0xac14('0x3c')](_0xac14('0x3d')),'attach':![],'attachments':[]}};if(!_0x3ef3f3[_0xac14('0x18')]&&!_0x3ef3f3[_0xac14('0x21')]){var _0x2a1b42=_[_0xac14('0x3e')](_0x3ef3f3[_0xac14('0x28')],{'contentType':'application/ms-tnef'});if(_0x2a1b42['length']){logger[_0xac14('0x3f')](util['format'](_0xac14('0x40'),_0x3ef3f3[_0xac14('0x39')]));tnef[_0xac14('0x41')](_[_0xac14('0x42')](_0x2a1b42)[_0xac14('0x43')],function(_0x8d2d01,_0x323b57){if(_0x323b57){_0x3ef3f3['html']=_0x323b57[_0xac14('0x44')]||_0xac14('0x45');if(_0x323b57[_0xac14('0x46')]){for(var _0x7df974=0x0;_0x7df974<_0x323b57['Attachments'][_0xac14('0x12')];_0x7df974++){var _0x44f4ff=_0x323b57['Attachments'][_0x7df974];_0x1e8a26[_0xac14('0x23')]['attachments'][_0xac14('0x1a')]({'filename':_0x44f4ff[_0xac14('0x47')],'content':Buffer[_0xac14('0x37')](_0x44f4ff['Data'])});}}}_0x3e7332(parseEmail(_0x110419,_0x3ef3f3,_0x1e8a26));});}else{_0x3ef3f3['html']=_0xac14('0x45');_0x3e7332(parseEmail(_0x110419,_0x3ef3f3,_0x1e8a26));}}else{_0x3e7332(parseEmail(_0x110419,_0x3ef3f3,_0x1e8a26));}};exports[_0xac14('0x48')]=function(_0x5c148d,_0x1926f4){var _0x440f25=[_0xac14('0x49')+(_0x1926f4||''),_0xac14('0x4a')+_0x5c148d,'',''];return Buffer[_0xac14('0x37')](_0x440f25[_0xac14('0x14')](''),_0xac14('0x4b'))[_0xac14('0x4c')](_0xac14('0x4d'));}; \ No newline at end of file +var _0x846e=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','parser','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','content','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','node-tnef','email','address','anonymous','generate','@xcally.com','head','value','name','slice','join','Anonymous','split','length','pop','isEmpty','test','html','replace','includes','forEach','push','_IMG','\x20]','body','0x1?_0x11fa7b[_0xe846('0xc')](0x0,-0x1)[_0xe846('0xd')]('\x20'):_0x59f058[_0xe846('0xb')];}return _0xe846('0xe');}function getLastName(_0x245a00){var _0x52fb27=_['head'](_0x245a00[_0xe846('0xa')]);if(_0x52fb27&&_0x52fb27['name']){var _0x39c444=_0x52fb27[_0xe846('0xb')][_0xe846('0xf')](/\s+/);return _0x39c444[_0xe846('0x10')]>0x1?_0x39c444[_0xe846('0x11')]():'';}return'';}function getMails(_0x11ee56,_0x20f938){var _0x987ecd='';for(var _0x248b07=0x0;_0x248b07<_0x20f938['value'][_0xe846('0x10')];_0x248b07+=0x1){if(_0x20f938[_0xe846('0xa')][_0x248b07][_0xe846('0x5')]!==_0x11ee56){if(!_[_0xe846('0x12')](_0x987ecd)){_0x987ecd+=',';}_0x987ecd+=_0x20f938['value'][_0x248b07]['name']||_0x20f938[_0xe846('0xa')][_0x248b07][_0xe846('0x5')]||'';_0x987ecd+='\x20<';_0x987ecd+=_0x20f938[_0xe846('0xa')][_0x248b07][_0xe846('0x5')]?_0x20f938[_0xe846('0xa')][_0x248b07][_0xe846('0x5')]:_0xe846('0x6')+random[_0xe846('0x7')](0x6)+'@xcally.com';_0x987ecd+='>';}}return _0x987ecd;}function parseEmail(_0x33661e,_0x4ff4ac,_0x131cf9){if(_0x4ff4ac['html']){var _0x581423=/)<[^<]*)*<\/script>/gi;while(_0x581423[_0xe846('0x13')](_0x4ff4ac['html'])){_0x4ff4ac['html']=_0x4ff4ac[_0xe846('0x14')][_0xe846('0x15')](_0x581423,'');}if(_0x4ff4ac['html'][_0xe846('0x16')]('{_0x3c7748[_0xe846('0x18')](_0x177a04['filename']);});var _0x28eb15=/]+>/g;var _0x20b69c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4b4612=_0x4ff4ac[_0xe846('0x14')][_0xe846('0x15')](_0x20b69c,'_SRC');var _0x5a26bf=_0x4b4612[_0xe846('0x15')](_0x28eb15,_0xe846('0x19'));for(let _0x1f8b82=0x0;_0x1f8b82<_0x3c7748[_0xe846('0x10')];_0x1f8b82++){var _0x2627c2=_0x5a26bf[_0xe846('0x15')](_0xe846('0x19'),'\x20[Attachment:\x20'+_0x3c7748[_0x1f8b82]+_0xe846('0x1a'));_0x5a26bf=_0x2627c2;}_0x4ff4ac[_0xe846('0x14')]=_0x5a26bf;}_0x131cf9[_0xe846('0x1b')]=_0x4ff4ac['html'];}else{_0x131cf9[_0xe846('0x1b')]=_0x4ff4ac['textAsHtml'];}if(_0x131cf9[_0xe846('0x1b')]){_0x131cf9[_0xe846('0x1b')]=_0x131cf9[_0xe846('0x1b')]['replace'](/0x0){var _0x1b4c08=[_0xe846('0x2c'),_0xe846('0x2d'),_0xe846('0x2e')];for(var _0x54387f=0x0;_0x54387f<_0x4ff4ac[_0xe846('0x2b')]['length'];_0x54387f++){var _0x9d8337=_[_0xe846('0x2f')](_0x1b4c08,_0x4ff4ac[_0xe846('0x2b')][_0x54387f][_0xe846('0x30')]);if(_0x9d8337>=0x0){_0x131cf9['isAutoreply']=!![];}}}return _0x131cf9;}exports[_0xe846('0x31')]=function(_0x32a3cd,_0x3157f4,_0x33e36f){var _0x22ba30={'from':getAddress(_0x3157f4['from']),'firstName':getFirstName(_0x3157f4[_0xe846('0x32')]),'lastName':getLastName(_0x3157f4[_0xe846('0x32')]),'mapKey':_0xe846('0x4'),'message':{'from':getMails(_0x32a3cd['email'],_0x3157f4['from']),'to':_0x32a3cd['email'],'cc':'','subject':_0x3157f4['subject']||'','messageId':_0x3157f4[_0xe846('0x33')],'inReplyTo':_0x3157f4[_0xe846('0x34')],'sentAt':moment(_0x3157f4[_0xe846('0x35')])['format'](_0xe846('0x36')),'attach':![],'attachments':[]}};if(!_0x3157f4['html']&&!_0x3157f4[_0xe846('0x37')]){var _0x5a76e7=_['filter'](_0x3157f4[_0xe846('0x20')],{'contentType':_0xe846('0x38')});if(_0x5a76e7['length']){logger[_0xe846('0x39')](util['format'](_0xe846('0x3a'),_0x3157f4[_0xe846('0x33')]));tnef[_0xe846('0x3b')](_['first'](_0x5a76e7)[_0xe846('0x3c')],function(_0x1d1c22,_0x10de61){if(_0x10de61){_0x3157f4[_0xe846('0x14')]=_0x10de61['BodyHTML']||_0xe846('0x3d');if(_0x10de61[_0xe846('0x3e')]){for(var _0x47691d=0x0;_0x47691d<_0x10de61['Attachments'][_0xe846('0x10')];_0x47691d++){var _0x12628f=_0x10de61[_0xe846('0x3e')][_0x47691d];_0x22ba30[_0xe846('0x1d')][_0xe846('0x20')][_0xe846('0x18')]({'filename':_0x12628f['Title'],'content':Buffer[_0xe846('0x32')](_0x12628f[_0xe846('0x3f')])});}}}_0x33e36f(parseEmail(_0x32a3cd,_0x3157f4,_0x22ba30));});}else{_0x3157f4[_0xe846('0x14')]='

Empty\x20message

';_0x33e36f(parseEmail(_0x32a3cd,_0x3157f4,_0x22ba30));}}else{_0x33e36f(parseEmail(_0x32a3cd,_0x3157f4,_0x22ba30));}};exports[_0xe846('0x40')]=function(_0x517a7d,_0x4ede35){var _0x1c9f08=[_0xe846('0x41')+(_0x4ede35||''),_0xe846('0x42')+_0x517a7d,'',''];return Buffer[_0xe846('0x32')](_0x1c9f08[_0xe846('0xd')](''),'utf-8')[_0xe846('0x43')](_0xe846('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e9d8eb1..5659dc0 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 _0x369b=['Imap','Smtp','name','Service','active'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x369b,0x1ce));var _0xb369=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x369b[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');function MailAccount(_0x2619e9){this['id']=_0x2619e9['id']||0x0;this[_0xb369('0x0')]=_0x2619e9[_0xb369('0x0')]||_0xb369('0x1');this['key']=_0x2619e9['key']||'SERV';this[_0xb369('0x2')]=_0x2619e9['active']||![];this[_0xb369('0x3')]=_0x2619e9[_0xb369('0x3')]||[];this[_0xb369('0x4')]=_0x2619e9['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x74a3=['Smtp','exports','lodash','name','key','SERV','active','Imap'];(function(_0x24c353,_0x396ac8){var _0x32acad=function(_0x945125){while(--_0x945125){_0x24c353['push'](_0x24c353['shift']());}};_0x32acad(++_0x396ac8);}(_0x74a3,0x19a));var _0x374a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x74a3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x374a('0x0'));function MailAccount(_0x17d0e6){this['id']=_0x17d0e6['id']||0x0;this[_0x374a('0x1')]=_0x17d0e6[_0x374a('0x1')]||'Service';this[_0x374a('0x2')]=_0x17d0e6[_0x374a('0x2')]||_0x374a('0x3');this[_0x374a('0x4')]=_0x17d0e6[_0x374a('0x4')]||![];this[_0x374a('0x5')]=_0x17d0e6[_0x374a('0x5')]||[];this[_0x374a('0x6')]=_0x17d0e6[_0x374a('0x6')]||[];}module[_0x374a('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 4fdbd30..3cca0ec 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 _0x6af8=['hasOwnProperty','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype'];(function(_0x4c5086,_0x149d28){var _0x4d1a4c=function(_0x5c7f12){while(--_0x5c7f12){_0x4c5086['push'](_0x4c5086['shift']());}};_0x4d1a4c(++_0x149d28);}(_0x6af8,0x9b));var _0x86af=function(_0xa7e69a,_0x3ac457){_0xa7e69a=_0xa7e69a-0x0;var _0x3761b1=_0x6af8[_0xa7e69a];return _0x3761b1;};'use strict';var _=require(_0x86af('0x0'));var MailAccount=require(_0x86af('0x1'));var Realtime=function(){this[_0x86af('0x2')]={};};function freeIsNotKey(_0x434271,_0x4a59f4,_0x14576c){var _0x342240=_[_0x86af('0x3')](_0x434271,function(_0x37d743,_0x245172){return _0x37d743[_0x14576c];});for(var _0x20faec in _0x4a59f4){if(_0x4a59f4['hasOwnProperty'](_0x20faec)){if(!_0x342240[_0x20faec]){delete _0x4a59f4[_0x20faec];}}}}Realtime[_0x86af('0x4')]['mergeFromDatabase']=function(_0xa8b1bc,_0x36e2a1){for(var _0xd1d2f4 in _0x36e2a1){if(_0xa8b1bc[_0x86af('0x5')](_0xd1d2f4)){_0xa8b1bc[_0xd1d2f4]=_0x36e2a1[_0xd1d2f4];}}};Realtime[_0x86af('0x4')][_0x86af('0x6')]=function(){var _0x4622c8=this;return function(_0x5883ef){if(_0x5883ef){freeIsNotKey(_0x5883ef,_0x4622c8[_0x86af('0x2')],'id');for(var _0x518919=0x0,_0x535c19={},_0x4fba81={};_0x518919<_0x5883ef['length'];_0x518919+=0x1){_0x535c19=_0x5883ef[_0x518919];if(_[_0x86af('0x7')](_0x4622c8['mailAccounts'][_0x535c19['id']])){_0x4622c8[_0x86af('0x2')][_0x535c19['id']]=new MailAccount(_0x535c19);}else{_[_0x86af('0x8')](_0x4622c8[_0x86af('0x2')][_0x535c19['id']],_0x535c19);}}}return _0x4622c8[_0x86af('0x2')];};};module[_0x86af('0x9')]=Realtime; \ No newline at end of file +var _0xbf22=['merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','isUndefined'];(function(_0x24c988,_0x4d7960){var _0x58168d=function(_0x473fad){while(--_0x473fad){_0x24c988['push'](_0x24c988['shift']());}};_0x58168d(++_0x4d7960);}(_0xbf22,0x160));var _0x2bf2=function(_0x39b0e2,_0x305f73){_0x39b0e2=_0x39b0e2-0x0;var _0x44d899=_0xbf22[_0x39b0e2];return _0x44d899;};'use strict';var _=require(_0x2bf2('0x0'));var MailAccount=require(_0x2bf2('0x1'));var Realtime=function(){this[_0x2bf2('0x2')]={};};function freeIsNotKey(_0xbb31d8,_0x572c17,_0x249b16){var _0xb00ba5=_[_0x2bf2('0x3')](_0xbb31d8,function(_0x3bf9d6,_0x5881b7){return _0x3bf9d6[_0x249b16];});for(var _0x6c13d2 in _0x572c17){if(_0x572c17[_0x2bf2('0x4')](_0x6c13d2)){if(!_0xb00ba5[_0x6c13d2]){delete _0x572c17[_0x6c13d2];}}}}Realtime[_0x2bf2('0x5')][_0x2bf2('0x6')]=function(_0x1c3514,_0x3b6b9f){for(var _0x116bdc in _0x3b6b9f){if(_0x1c3514['hasOwnProperty'](_0x116bdc)){_0x1c3514[_0x116bdc]=_0x3b6b9f[_0x116bdc];}}};Realtime[_0x2bf2('0x5')]['initMailAccounts']=function(){var _0x399b0c=this;return function(_0x15411d){if(_0x15411d){freeIsNotKey(_0x15411d,_0x399b0c[_0x2bf2('0x2')],'id');for(var _0xfebf24=0x0,_0x26c456={},_0x596f53={};_0xfebf24<_0x15411d['length'];_0xfebf24+=0x1){_0x26c456=_0x15411d[_0xfebf24];if(_[_0x2bf2('0x7')](_0x399b0c[_0x2bf2('0x2')][_0x26c456['id']])){_0x399b0c[_0x2bf2('0x2')][_0x26c456['id']]=new MailAccount(_0x26c456);}else{_[_0x2bf2('0x8')](_0x399b0c[_0x2bf2('0x2')][_0x26c456['id']],_0x26c456);}}}return _0x399b0c[_0x2bf2('0x2')];};};module[_0x2bf2('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 8b4b4dc..a4cfac4 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 _0xe5e3=['Smtp','service','notify','NotifyMailAccount','getMailAccounts','Request','provider','email','active','ListId','TemplateId','Imap','name','type','data5','CloudProvider','MailServerOut'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xe5e3,0x17a));var _0x3e5e=function(_0x3d7bba,_0x24d468){_0x3d7bba=_0x3d7bba-0x0;var _0x2894cb=_0xe5e3[_0x3d7bba];return _0x2894cb;};'use strict';var client=require('../client');exports[_0x3e5e('0x0')]=function(){return function(){return client[_0x3e5e('0x1')]('GetMailAccount',{'options':{'attributes':['id','name',_0x3e5e('0x2'),'service',_0x3e5e('0x3'),_0x3e5e('0x4'),'key',_0x3e5e('0x5'),_0x3e5e('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':_0x3e5e('0x7'),'include':[{'model':'CloudProvider','attributes':['id',_0x3e5e('0x8'),'service',_0x3e5e('0x9'),_0x3e5e('0xa')],'as':_0x3e5e('0xb')}]},{'model':_0x3e5e('0xc'),'as':_0x3e5e('0xd'),'include':[{'model':_0x3e5e('0xb'),'attributes':['id',_0x3e5e('0x8'),_0x3e5e('0xe'),_0x3e5e('0x9'),_0x3e5e('0xa')],'as':_0x3e5e('0xb')}]}]},'log':'getMailAccount'});};};exports[_0x3e5e('0xf')]=function(_0x2aa6d6,_0x1275ad){return client[_0x3e5e('0x1')](_0x3e5e('0x10'),{'account':{'id':_0x2aa6d6},'body':_0x1275ad,'log':_0x3e5e('0x10')});}; \ No newline at end of file +var _0xbc48=['NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','active','ListId','CloudProvider','type','MailServerOut','Smtp','data5','getMailAccount','notify'];(function(_0x5dbdde,_0x58e5b2){var _0x1a5095=function(_0x3a2de3){while(--_0x3a2de3){_0x5dbdde['push'](_0x5dbdde['shift']());}};_0x1a5095(++_0x58e5b2);}(_0xbc48,0x111));var _0x8bc4=function(_0xc105b1,_0x401b6e){_0xc105b1=_0xc105b1-0x0;var _0x33d44d=_0xbc48[_0xc105b1];return _0x33d44d;};'use strict';var client=require(_0x8bc4('0x0'));exports[_0x8bc4('0x1')]=function(){return function(){return client[_0x8bc4('0x2')](_0x8bc4('0x3'),{'options':{'attributes':['id','name',_0x8bc4('0x4'),_0x8bc4('0x5'),_0x8bc4('0x6'),_0x8bc4('0x7'),'key',_0x8bc4('0x8'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x8bc4('0x9'),'attributes':['id','name','service',_0x8bc4('0xa'),'data5'],'as':_0x8bc4('0x9')}]},{'model':_0x8bc4('0xb'),'as':_0x8bc4('0xc'),'include':[{'model':_0x8bc4('0x9'),'attributes':['id','name',_0x8bc4('0x5'),_0x8bc4('0xa'),_0x8bc4('0xd')],'as':_0x8bc4('0x9')}]}]},'log':_0x8bc4('0xe')});};};exports[_0x8bc4('0xf')]=function(_0x462a7c,_0x6049b3){return client[_0x8bc4('0x2')](_0x8bc4('0x10'),{'account':{'id':_0x462a7c},'body':_0x6049b3,'log':_0x8bc4('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index dab4bf3..8473025 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 _0x74da=['GetSettings','../client','Request','ShowSetting','loginMailFrequency'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x74da,0x123));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa74d('0x0'));exports['getSettings']=function(){return client[_0xa74d('0x1')](_0xa74d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa74d('0x3')]},'log':_0xa74d('0x4')});}; \ No newline at end of file +var _0xf2f0=['Request','ShowSetting','loginMailFrequency','GetSettings','getSettings'];(function(_0x2c1335,_0x138446){var _0x10732e=function(_0x1a6a8a){while(--_0x1a6a8a){_0x2c1335['push'](_0x2c1335['shift']());}};_0x10732e(++_0x138446);}(_0xf2f0,0x112));var _0x0f2f=function(_0x2e14f2,_0x377d0d){_0x2e14f2=_0x2e14f2-0x0;var _0x12cc03=_0xf2f0[_0x2e14f2];return _0x12cc03;};'use strict';var client=require('../client');exports[_0x0f2f('0x0')]=function(){return client[_0x0f2f('0x1')](_0x0f2f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0f2f('0x3')]},'log':_0x0f2f('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 6413e5e..413548a 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 6164819..21f87db 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 _0x4994=['exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0xde2e34,_0x6b6ddf){var _0x4425fd=function(_0x50f96a){while(--_0x50f96a){_0xde2e34['push'](_0xde2e34['shift']());}};_0x4425fd(++_0x6b6ddf);}(_0x4994,0x191));var _0x4499=function(_0x2c55eb,_0x715248){_0x2c55eb=_0x2c55eb-0x0;var _0x1a6235=_0x4994[_0x2c55eb];return _0x1a6235;};'use strict';var _=require(_0x4499('0x0'));var http=require('http');var express=require(_0x4499('0x1'));var sticky=require(_0x4499('0x2'));var Redis=require(_0x4499('0x3'));var config=require(_0x4499('0x4'));var app=express();var server=http[_0x4499('0x5')](app);server[_0x4499('0x6')]=0xdbba0;if(sticky[_0x4499('0x7')](server,config[_0x4499('0x8')])){var socketio=require(_0x4499('0x9'))(server,{'transports':[_0x4499('0xa'),'polling']});config[_0x4499('0xb')]=_['defaults'](config[_0x4499('0xb')],{'host':_0x4499('0xc'),'port':0x18eb});socketio[_0x4499('0xd')](require(_0x4499('0xe'))({'pubClient':new Redis(config[_0x4499('0xb')]),'subClient':new Redis(config[_0x4499('0xb')])}));require(_0x4499('0xf'))[_0x4499('0x10')]();require(_0x4499('0x11'))[_0x4499('0x10')](socketio);require(_0x4499('0x12'))[_0x4499('0x10')](app);require(_0x4499('0x13'))['default'](app);}else{server[_0x4499('0x14')](_0x4499('0x15'),function(){console[_0x4499('0x16')](_0x4499('0x17'),config[_0x4499('0x8')]);});}exports=module[_0x4499('0x18')]=app; \ No newline at end of file +var _0xdea7=['socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost'];(function(_0x2dcf00,_0x579a6f){var _0x5bdf97=function(_0xbb360){while(--_0xbb360){_0x2dcf00['push'](_0x2dcf00['shift']());}};_0x5bdf97(++_0x579a6f);}(_0xdea7,0x162));var _0x7dea=function(_0x443b7d,_0x5b64ff){_0x443b7d=_0x443b7d-0x0;var _0x5d96f9=_0xdea7[_0x443b7d];return _0x5d96f9;};'use strict';var _=require(_0x7dea('0x0'));var http=require('http');var express=require(_0x7dea('0x1'));var sticky=require(_0x7dea('0x2'));var Redis=require(_0x7dea('0x3'));var config=require(_0x7dea('0x4'));var app=express();var server=http[_0x7dea('0x5')](app);server[_0x7dea('0x6')]=0xdbba0;if(sticky[_0x7dea('0x7')](server,config[_0x7dea('0x8')])){var socketio=require(_0x7dea('0x9'))(server,{'transports':[_0x7dea('0xa'),'polling']});config[_0x7dea('0xb')]=_[_0x7dea('0xc')](config[_0x7dea('0xb')],{'host':_0x7dea('0xd'),'port':0x18eb});socketio['adapter'](require(_0x7dea('0xe'))({'pubClient':new Redis(config[_0x7dea('0xb')]),'subClient':new Redis(config[_0x7dea('0xb')])}));require(_0x7dea('0xf'))[_0x7dea('0x10')]();require(_0x7dea('0x11'))[_0x7dea('0x10')](socketio);require(_0x7dea('0x12'))['default'](app);require('../../routes')[_0x7dea('0x10')](app);}else{server[_0x7dea('0x13')](_0x7dea('0x14'),function(){console['log'](_0x7dea('0x15'),config[_0x7dea('0x8')]);});}exports=module[_0x7dea('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 5cb38b5..99a725f 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 _0xa6f4=['jayson/promise','bluebird','../../config/logger','http','Request','then','debug','rpc','routing','error','message','result','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa6f4,0x1a0));var _0x4a6f=function(_0x377eaa,_0x454a24){_0x377eaa=_0x377eaa-0x0;var _0x372e4e=_0xa6f4[_0x377eaa];return _0x372e4e;};'use strict';var jayson=require(_0x4a6f('0x0'));var BPromise=require(_0x4a6f('0x1'));var logger=require(_0x4a6f('0x2'))('routing');var client=jayson['client'][_0x4a6f('0x3')]({'port':0x2329});client[_0x4a6f('0x4')]=function(_0x3ebcfe,_0x3000ad){return new BPromise(function(_0x50e149,_0x3b7651){return client['request'](_0x3ebcfe,_0x3000ad)[_0x4a6f('0x5')](function(_0x5a86df){logger[_0x4a6f('0x6')](_0x4a6f('0x7'),_0x4a6f('0x8'),_0x3ebcfe,_0x3000ad,_0x5a86df);if(_0x5a86df[_0x4a6f('0x9')]){logger[_0x4a6f('0x9')](_0x4a6f('0x7'),_0x4a6f('0x8'),_0x3ebcfe,_0x5a86df[_0x4a6f('0x9')][_0x4a6f('0xa')],_0x3000ad);return _0x3b7651(_0x5a86df['error'][_0x4a6f('0xa')]);}else{return _0x50e149(_0x5a86df[_0x4a6f('0xb')]);}})[_0x4a6f('0xc')](function(_0x2c6655){logger['error']('rpc',_0x4a6f('0x8'),_0x3ebcfe,_0x2c6655,_0x3000ad);return _0x3b7651(_0x2c6655);});});};module['exports']=client; \ No newline at end of file +var _0x9132=['result','rpc','exports','bluebird','../../config/logger','client','http','request','then','debug','error','routing','message'];(function(_0x468e71,_0x171468){var _0x2c9045=function(_0x3607c1){while(--_0x3607c1){_0x468e71['push'](_0x468e71['shift']());}};_0x2c9045(++_0x171468);}(_0x9132,0x12e));var _0x2913=function(_0x3f1683,_0x13c78){_0x3f1683=_0x3f1683-0x0;var _0x10c22c=_0x9132[_0x3f1683];return _0x10c22c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2913('0x0'));var logger=require(_0x2913('0x1'))('routing');var client=jayson[_0x2913('0x2')][_0x2913('0x3')]({'port':0x2329});client['Request']=function(_0x46a38b,_0x1d36ac){return new BPromise(function(_0x23ddad,_0x7ab9fa){return client[_0x2913('0x4')](_0x46a38b,_0x1d36ac)[_0x2913('0x5')](function(_0x54614e){logger[_0x2913('0x6')]('rpc','routing',_0x46a38b,_0x1d36ac,_0x54614e);if(_0x54614e[_0x2913('0x7')]){logger[_0x2913('0x7')]('rpc',_0x2913('0x8'),_0x46a38b,_0x54614e[_0x2913('0x7')]['message'],_0x1d36ac);return _0x7ab9fa(_0x54614e[_0x2913('0x7')][_0x2913('0x9')]);}else{return _0x23ddad(_0x54614e[_0x2913('0xa')]);}})['catch'](function(_0x51636b){logger[_0x2913('0x7')](_0x2913('0xb'),_0x2913('0x8'),_0x46a38b,_0x51636b,_0x1d36ac);return _0x7ab9fa(_0x51636b);});});};module[_0x2913('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 0abaa96..dab9ca6 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 _0xd46a=['./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','bluebird','./realtime','./rpc/user','./rpc/openchannelQueue'];(function(_0x13ca9f,_0x4ea82d){var _0x101873=function(_0xaba3ff){while(--_0xaba3ff){_0x13ca9f['push'](_0x13ca9f['shift']());}};_0x101873(++_0x4ea82d);}(_0xd46a,0x92));var _0xad46=function(_0x37104c,_0x17b779){_0x37104c=_0x37104c-0x0;var _0x20a4f5=_0xd46a[_0x37104c];return _0x20a4f5;};'use strict';var BPromise=require(_0xad46('0x0'));var server=require('./server');var Realtime=require(_0xad46('0x1'));var user=require(_0xad46('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xad46('0x3'));var chatQueue=require(_0xad46('0x4'));var smsQueue=require(_0xad46('0x5'));var mailQueue=require(_0xad46('0x6'));var faxQueue=require(_0xad46('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xad46('0x8')]()[_0xad46('0x9')](user[_0xad46('0xa')]())[_0xad46('0x9')](realtime[_0xad46('0xb')]())[_0xad46('0x9')](interval[_0xad46('0xc')]())[_0xad46('0x9')](realtime[_0xad46('0xd')]())['then'](openchannelQueue[_0xad46('0xe')]())['then'](realtime[_0xad46('0xf')]())[_0xad46('0x9')](chatQueue[_0xad46('0x10')]())[_0xad46('0x9')](realtime['initChatQueues']())[_0xad46('0x9')](smsQueue[_0xad46('0x11')]())[_0xad46('0x9')](realtime[_0xad46('0x12')]())['then'](mailQueue[_0xad46('0x13')]())[_0xad46('0x9')](realtime['initMailQueues']())['then'](faxQueue[_0xad46('0x14')]())[_0xad46('0x9')](realtime[_0xad46('0x15')]())[_0xad46('0x9')](whatsappQueue[_0xad46('0x16')]())[_0xad46('0x9')](realtime[_0xad46('0x17')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x347dd9){return initRealtime();})[_0xad46('0x9')](function(_0x332c40){return setInterval(initRealtime,0x1388);})[_0xad46('0x18')](function(_0x525d90){console['log'](_0x525d90);});}main(); \ No newline at end of file +var _0xf058=['./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','bluebird','./server','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xf058,0x9b));var _0x8f05=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf058[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x8f05('0x0'));var server=require(_0x8f05('0x1'));var Realtime=require('./realtime');var user=require(_0x8f05('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x8f05('0x3'));var chatQueue=require(_0x8f05('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x8f05('0x5'));var faxQueue=require(_0x8f05('0x6'));var whatsappQueue=require(_0x8f05('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8f05('0x8')]()[_0x8f05('0x9')](user['getAgents']())[_0x8f05('0x9')](realtime[_0x8f05('0xa')]())[_0x8f05('0x9')](interval['getIntervals']())[_0x8f05('0x9')](realtime[_0x8f05('0xb')]())[_0x8f05('0x9')](openchannelQueue[_0x8f05('0xc')]())['then'](realtime['initOpenchannelQueues']())[_0x8f05('0x9')](chatQueue[_0x8f05('0xd')]())[_0x8f05('0x9')](realtime[_0x8f05('0xe')]())['then'](smsQueue[_0x8f05('0xf')]())['then'](realtime[_0x8f05('0x10')]())['then'](mailQueue['getMailQueues']())[_0x8f05('0x9')](realtime[_0x8f05('0x11')]())['then'](faxQueue[_0x8f05('0x12')]())['then'](realtime[_0x8f05('0x13')]())[_0x8f05('0x9')](whatsappQueue[_0x8f05('0x14')]())[_0x8f05('0x9')](realtime[_0x8f05('0x15')]())[_0x8f05('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x3c83b3){return initRealtime();})['then'](function(_0x5c357e){return setInterval(initRealtime,0x1388);})[_0x8f05('0x16')](function(_0x503bf2){console['log'](_0x503bf2);});}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 e79d761..4ef8708 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x519bc2,_0x57a544){var _0xd3b093=function(_0xfe0ade){while(--_0xfe0ade){_0x519bc2['push'](_0x519bc2['shift']());}};_0xd3b093(++_0x57a544);}(_0x7a54,0x106));var _0x47a5=function(_0x33fe6f,_0x3e8d2d){_0x33fe6f=_0x33fe6f-0x0;var _0x4d4a10=_0x7a54[_0x33fe6f];return _0x4d4a10;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=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(_0x565d72,_0x3101c2){var _0x371f4d=function(_0x4abbbb){while(--_0x4abbbb){_0x565d72['push'](_0x565d72['shift']());}};_0x371f4d(++_0x3101c2);}(_0xe14b,0x93));var _0xbe14=function(_0x14b4dd,_0x5e9096){_0x14b4dd=_0x14b4dd-0x0;var _0x5d176b=_0xe14b[_0x14b4dd];return _0x5d176b;};'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 325cdf7..bd17bcf 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 _0x6844=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error'];(function(_0x5272c1,_0x46bf64){var _0x408a73=function(_0x3273c6){while(--_0x3273c6){_0x5272c1['push'](_0x5272c1['shift']());}};_0x408a73(++_0x46bf64);}(_0x6844,0x1d7));var _0x4684=function(_0x314ccd,_0x4636cb){_0x314ccd=_0x314ccd-0x0;var _0x573e39=_0x6844[_0x314ccd];return _0x573e39;};'use strict';var BPromise=require(_0x4684('0x0'));var jayson=require(_0x4684('0x1'));var client=jayson[_0x4684('0x2')][_0x4684('0x3')]({'port':0x232b});function request(_0x53c265,_0x3df272){return new BPromise(function(_0x1c0ebd,_0xe975a1){return client['request'](_0x53c265,_0x3df272)[_0x4684('0x4')](function(_0x1b767b){if(_0x1b767b[_0x4684('0x5')]){return _0xe975a1(_0x1b767b['error']['message']);}else{return _0x1c0ebd(_0x1b767b['result']);}})[_0x4684('0x6')](function(_0x1dd423){return _0xe975a1(_0x1dd423);});});}exports[_0x4684('0x7')]=function(_0x4c1a95,_0x48306d){return request(_0x4684('0x8'),{'account':_0x4c1a95,'message':_0x48306d});}; \ No newline at end of file +var _0x51e2=['bluebird','request','then','error','catch','sendMailMessage','SendMail'];(function(_0x90c697,_0x360339){var _0x13e320=function(_0x46e513){while(--_0x46e513){_0x90c697['push'](_0x90c697['shift']());}};_0x13e320(++_0x360339);}(_0x51e2,0x118));var _0x251e=function(_0x44c5ac,_0x56f86d){_0x44c5ac=_0x44c5ac-0x0;var _0x5b2895=_0x51e2[_0x44c5ac];return _0x5b2895;};'use strict';var BPromise=require(_0x251e('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x1f1d6e,_0x54ebe8){return new BPromise(function(_0x44370d,_0x4a889d){return client[_0x251e('0x1')](_0x1f1d6e,_0x54ebe8)[_0x251e('0x2')](function(_0x5afc58){if(_0x5afc58[_0x251e('0x3')]){return _0x4a889d(_0x5afc58[_0x251e('0x3')]['message']);}else{return _0x44370d(_0x5afc58['result']);}})[_0x251e('0x4')](function(_0x32b1a3){return _0x4a889d(_0x32b1a3);});});}exports[_0x251e('0x5')]=function(_0x4278c5,_0x3a4fcb){return request(_0x251e('0x6'),{'account':_0x4278c5,'message':_0x3a4fcb});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 2183998..6f8b0d0 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 _0x955f=['mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','length','Status','StatusTime','format','chatCurrentCapacity','smsStatusTime','whatsappStatusTime','busy','emit','user:routing:update','omit','lodash','md5','moment','ioredis','../../../config/environment','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime'];(function(_0x2fb20,_0x1f2cb9){var _0x3aff15=function(_0x24806e){while(--_0x24806e){_0x2fb20['push'](_0x2fb20['shift']());}};_0x3aff15(++_0x1f2cb9);}(_0x955f,0x1eb));var _0xf955=function(_0x5649df,_0x29717f){_0x5649df=_0x5649df-0x0;var _0x3befab=_0x955f[_0x5649df];return _0x3befab;};'use strict';var _=require(_0xf955('0x0'));var md5=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var Redis=require(_0xf955('0x3'));var config=require(_0xf955('0x4'));config['redis']=_[_0xf955('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf955('0x6'))(new Redis(config['redis']));function Agent(_0x13b796){this['id']=_0x13b796['id']||0x0;this[_0xf955('0x7')]=_0x13b796[_0xf955('0x7')]||'';this['online']=_0x13b796[_0xf955('0x8')]||!![];this[_0xf955('0x9')]=_0x13b796['voicePause']||![];this[_0xf955('0xa')]=_0x13b796[_0xf955('0xa')]||![];this[_0xf955('0xb')]=_0x13b796[_0xf955('0xb')]||![];this[_0xf955('0xc')]=_0x13b796[_0xf955('0xc')]||![];this[_0xf955('0xd')]=_0x13b796['smsPause']||![];this[_0xf955('0xe')]=_0x13b796['openchannelPause']||![];this[_0xf955('0xf')]=_0xf955('0x10');this[_0xf955('0x11')]=0x0;this['chatCapacity']=_0x13b796[_0xf955('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xf955('0x13')]='unknown';this[_0xf955('0x14')]=0x0;this[_0xf955('0x15')]=_0x13b796[_0xf955('0x15')]||0x0;this[_0xf955('0x16')]=0x0;this[_0xf955('0x17')]=_0xf955('0x10');this[_0xf955('0x18')]=0x0;this[_0xf955('0x19')]=_0x13b796[_0xf955('0x19')]||0x0;this[_0xf955('0x1a')]=0x0;this['smsStatus']=_0xf955('0x10');this['smsStatusTime']=0x0;this[_0xf955('0x1b')]=_0x13b796[_0xf955('0x1b')]||0x0;this[_0xf955('0x1c')]=0x0;this[_0xf955('0x1d')]='unknown';this['whatsappStatusTime']=0x0;this[_0xf955('0x1e')]=_0x13b796[_0xf955('0x1e')]||0x0;this[_0xf955('0x1f')]=0x0;this['openchannelStatus']=_0xf955('0x10');this[_0xf955('0x20')]=0x0;this[_0xf955('0x21')]=_0x13b796[_0xf955('0x21')]||0x0;this[_0xf955('0x22')]=0x0;this['busy']=![];this[_0xf955('0x23')]=undefined;this[_0xf955('0x1')]='';this[_0xf955('0x24')]={};this['faxWaitingInteractions']={};this[_0xf955('0x25')]={};this['openchannelWaitingInteractions']={};this[_0xf955('0x26')]={};this[_0xf955('0x27')]={};this[_0xf955('0x28')]();}Agent[_0xf955('0x29')][_0xf955('0x2a')]=function(_0x565641){if(this[_0x565641+_0xf955('0x2b')]>0x0){if(this[_0x565641+_0xf955('0x2c')]>0x0&&this[_0x565641+_0xf955('0x2b')]>=this[_0x565641+_0xf955('0x2c')]){return _0xf955('0x2d');}else{return _0xf955('0x2e');}}else{return _0xf955('0x2f');}};Agent['prototype'][_0xf955('0x28')]=function(){var _0x1acf33=[_0xf955('0x30'),_0xf955('0x31'),_0xf955('0x32'),_0xf955('0x33'),_0xf955('0x34'),'whatsapp'];for(var _0x3caea6=0x0;_0x3caea6<_0x1acf33[_0xf955('0x35')];_0x3caea6+=0x1){var _0x41c9f6=this[_0xf955('0x2a')](_0x1acf33[_0x3caea6]);if(this[_0x1acf33[_0x3caea6]+_0xf955('0x36')]!==_0x41c9f6){this[_0x1acf33[_0x3caea6]+_0xf955('0x37')]=_['toNumber'](moment()[_0xf955('0x38')]('x'));}this[_0x1acf33[_0x3caea6]+_0xf955('0x36')]=_0x41c9f6;}var _0x4ec3e8={'id':this['id'],'name':this[_0xf955('0x7')],'online':this[_0xf955('0x8')],'voicePause':this[_0xf955('0x9')],'chatPause':this[_0xf955('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0xf955('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf955('0xe')],'chatStatus':this[_0xf955('0xf')],'chatStatusTime':this[_0xf955('0x11')],'chatCapacity':this[_0xf955('0x12')],'chatCurrentCapacity':this[_0xf955('0x39')],'mailStatus':this[_0xf955('0x13')],'mailStatusTime':this[_0xf955('0x14')],'mailCapacity':this[_0xf955('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xf955('0x17')],'faxStatusTime':this[_0xf955('0x18')],'faxCapacity':this[_0xf955('0x19')],'faxCurrentCapacity':this[_0xf955('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xf955('0x3a')],'smsCapacity':this[_0xf955('0x1b')],'smsCurrentCapacity':this[_0xf955('0x1c')],'whatsappStatus':this[_0xf955('0x1d')],'whatsappStatusTime':this[_0xf955('0x3b')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xf955('0x20')],'openchannelCapacity':this[_0xf955('0x21')],'openchannelCurrentCapacity':this[_0xf955('0x22')],'busy':this[_0xf955('0x3c')],'busyQueue':this[_0xf955('0x23')],'chatWaitingInteractions':this[_0xf955('0x24')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xf955('0x25')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xf955('0x26')],'whatsappWaitingInteractions':this[_0xf955('0x27')]};var _0xe33ef2=md5(JSON['stringify'](_0x4ec3e8));if(this[_0xf955('0x1')]!==_0xe33ef2){this['md5']=_0xe33ef2;io[_0xf955('0x3d')](_0xf955('0x3e'),_[_0xf955('0x3f')](_0x4ec3e8,[_0xf955('0x8')]));}};module['exports']=Agent; \ No newline at end of file +var _0x2a07=['faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','updateRealtime','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','mailCurrentCapacity','faxStatus','whatsappCurrentCapacity','busy','faxWaitingInteractions','stringify','emit','user:routing:update','omit','lodash','md5','moment','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime'];(function(_0x16ae34,_0x1dc6d){var _0x184836=function(_0x1e48b7){while(--_0x1e48b7){_0x16ae34['push'](_0x16ae34['shift']());}};_0x184836(++_0x1dc6d);}(_0x2a07,0x74));var _0x72a0=function(_0x217e5b,_0x53776f){_0x217e5b=_0x217e5b-0x0;var _0x38f156=_0x2a07[_0x217e5b];return _0x38f156;};'use strict';var _=require(_0x72a0('0x0'));var md5=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var Redis=require(_0x72a0('0x3'));var config=require(_0x72a0('0x4'));config['redis']=_[_0x72a0('0x5')](config[_0x72a0('0x6')],{'host':_0x72a0('0x7'),'port':0x18eb});var io=require(_0x72a0('0x8'))(new Redis(config[_0x72a0('0x6')]));function Agent(_0xce74c){this['id']=_0xce74c['id']||0x0;this[_0x72a0('0x9')]=_0xce74c[_0x72a0('0x9')]||'';this[_0x72a0('0xa')]=_0xce74c[_0x72a0('0xa')]||!![];this[_0x72a0('0xb')]=_0xce74c[_0x72a0('0xb')]||![];this[_0x72a0('0xc')]=_0xce74c[_0x72a0('0xc')]||![];this[_0x72a0('0xd')]=_0xce74c[_0x72a0('0xd')]||![];this['faxPause']=_0xce74c[_0x72a0('0xe')]||![];this[_0x72a0('0xf')]=_0xce74c['smsPause']||![];this[_0x72a0('0x10')]=_0xce74c[_0x72a0('0x10')]||![];this[_0x72a0('0x11')]=_0x72a0('0x12');this[_0x72a0('0x13')]=0x0;this['chatCapacity']=_0xce74c[_0x72a0('0x14')]||0x0;this[_0x72a0('0x15')]=0x0;this[_0x72a0('0x16')]=_0x72a0('0x12');this[_0x72a0('0x17')]=0x0;this[_0x72a0('0x18')]=_0xce74c[_0x72a0('0x18')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x72a0('0x12');this[_0x72a0('0x19')]=0x0;this[_0x72a0('0x1a')]=_0xce74c[_0x72a0('0x1a')]||0x0;this[_0x72a0('0x1b')]=0x0;this[_0x72a0('0x1c')]='unknown';this[_0x72a0('0x1d')]=0x0;this[_0x72a0('0x1e')]=_0xce74c[_0x72a0('0x1e')]||0x0;this[_0x72a0('0x1f')]=0x0;this[_0x72a0('0x20')]='unknown';this[_0x72a0('0x21')]=0x0;this[_0x72a0('0x22')]=_0xce74c[_0x72a0('0x22')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x72a0('0x23')]=_0x72a0('0x12');this[_0x72a0('0x24')]=0x0;this[_0x72a0('0x25')]=_0xce74c['openchannelCapacity']||0x0;this[_0x72a0('0x26')]=0x0;this['busy']=![];this[_0x72a0('0x27')]=undefined;this[_0x72a0('0x1')]='';this[_0x72a0('0x28')]={};this['faxWaitingInteractions']={};this[_0x72a0('0x29')]={};this[_0x72a0('0x2a')]={};this[_0x72a0('0x2b')]={};this[_0x72a0('0x2c')]={};this['updateRealtime']();}Agent[_0x72a0('0x2d')][_0x72a0('0x2e')]=function(_0x1ddd54){if(this[_0x1ddd54+_0x72a0('0x2f')]>0x0){if(this[_0x1ddd54+_0x72a0('0x30')]>0x0&&this[_0x1ddd54+_0x72a0('0x2f')]>=this[_0x1ddd54+'Capacity']){return'maxcapacity';}else{return _0x72a0('0x31');}}else{return _0x72a0('0x32');}};Agent[_0x72a0('0x2d')][_0x72a0('0x33')]=function(){var _0xf5cb49=[_0x72a0('0x34'),_0x72a0('0x35'),_0x72a0('0x36'),_0x72a0('0x37'),_0x72a0('0x38'),'whatsapp'];for(var _0x304b92=0x0;_0x304b92<_0xf5cb49[_0x72a0('0x39')];_0x304b92+=0x1){var _0xc22d18=this[_0x72a0('0x2e')](_0xf5cb49[_0x304b92]);if(this[_0xf5cb49[_0x304b92]+_0x72a0('0x3a')]!==_0xc22d18){this[_0xf5cb49[_0x304b92]+_0x72a0('0x3b')]=_[_0x72a0('0x3c')](moment()[_0x72a0('0x3d')]('x'));}this[_0xf5cb49[_0x304b92]+_0x72a0('0x3a')]=_0xc22d18;}var _0x916733={'id':this['id'],'name':this['name'],'online':this[_0x72a0('0xa')],'voicePause':this[_0x72a0('0xb')],'chatPause':this[_0x72a0('0xc')],'mailPause':this[_0x72a0('0xd')],'smsPause':this[_0x72a0('0xf')],'faxPause':this[_0x72a0('0xe')],'openchannelPause':this[_0x72a0('0x10')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x72a0('0x13')],'chatCapacity':this[_0x72a0('0x14')],'chatCurrentCapacity':this[_0x72a0('0x15')],'mailStatus':this[_0x72a0('0x16')],'mailStatusTime':this[_0x72a0('0x17')],'mailCapacity':this[_0x72a0('0x18')],'mailCurrentCapacity':this[_0x72a0('0x3e')],'faxStatus':this[_0x72a0('0x3f')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x72a0('0x1a')],'faxCurrentCapacity':this[_0x72a0('0x1b')],'smsStatus':this[_0x72a0('0x1c')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x72a0('0x1e')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x72a0('0x20')],'whatsappStatusTime':this[_0x72a0('0x21')],'whatsappCapacity':this[_0x72a0('0x22')],'whatsappCurrentCapacity':this[_0x72a0('0x40')],'openchannelStatus':this[_0x72a0('0x23')],'openchannelStatusTime':this[_0x72a0('0x24')],'openchannelCapacity':this[_0x72a0('0x25')],'openchannelCurrentCapacity':this[_0x72a0('0x26')],'busy':this[_0x72a0('0x41')],'busyQueue':this[_0x72a0('0x27')],'chatWaitingInteractions':this[_0x72a0('0x28')],'faxWaitingInteractions':this[_0x72a0('0x42')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x72a0('0x2a')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x72a0('0x2c')]};var _0x13c251=md5(JSON[_0x72a0('0x43')](_0x916733));if(this[_0x72a0('0x1')]!==_0x13c251){this[_0x72a0('0x1')]=_0x13c251;io[_0x72a0('0x44')](_0x72a0('0x45'),_[_0x72a0('0x46')](_0x916733,[_0x72a0('0xa')]));}};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 9e17e98..d0461e7 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 _0x310b=['format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','chatPause','available','stringify'];(function(_0x17f489,_0x4d31f1){var _0x45edbf=function(_0x499d5e){while(--_0x499d5e){_0x17f489['push'](_0x17f489['shift']());}};_0x45edbf(++_0x4d31f1);}(_0x310b,0xad));var _0xb310=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x310b[_0x409353];return _0x4f4b59;};'use strict';var _=require('lodash');var md5=require(_0xb310('0x0'));var util=require(_0xb310('0x1'));var Redis=require(_0xb310('0x2'));var config=require('../../../config/environment');config[_0xb310('0x3')]=_[_0xb310('0x4')](config[_0xb310('0x3')],{'host':_0xb310('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x135bb7){this['id']=_0x135bb7['id']||0x0;this[_0xb310('0x6')]=_0x135bb7[_0xb310('0x6')]||'';this[_0xb310('0x7')]=_0x135bb7[_0xb310('0x7')]||0xa;this['strategy']=_0x135bb7[_0xb310('0x8')]||_0xb310('0x9');this[_0xb310('0xa')]=_0x135bb7['Agents'];this[_0xb310('0xb')]={};this[_0xb310('0xc')]=0x0;this[_0xb310('0x0')]='';this[_0xb310('0xd')]();this[_0xb310('0xe')]();}ChatQueue['prototype'][_0xb310('0xd')]=function(){var _0x328001=this[_0xb310('0xb')][_0xb310('0xf')];this[_0xb310('0xb')]=_[_0xb310('0x10')](this[_0xb310('0xa')],'id');this[_0xb310('0xb')][_0xb310('0xf')]=_0x328001;};ChatQueue[_0xb310('0x11')]['updateRealtime']=function(){this[_0xb310('0x12')]=0x0;this[_0xb310('0x13')]=0x0;for(var _0x52522f=0x0;_0x52522f=0x0?this[_0xb310('0x15')]:0x0;var _0x4fc892={'id':this['id'],'available':this[_0xb310('0x15')],'loggedIn':this[_0xb310('0x12')],'name':this[_0xb310('0x6')],'paused':this[_0xb310('0x13')],'waiting':this['waiting']};var _0x12e124=md5(JSON[_0xb310('0x16')](_0x4fc892));if(this[_0xb310('0x0')]!==_0x12e124){this[_0xb310('0x0')]=_0x12e124;io['to'](util[_0xb310('0x17')](_0xb310('0x18'),_0x4fc892['name']))[_0xb310('0x19')](_0xb310('0x1a'),_0x4fc892);}};module[_0xb310('0x1b')]=ChatQueue; \ No newline at end of file +var _0xcf53=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x2e66c9,_0x570d10){var _0x835aac=function(_0x7fcb44){while(--_0x7fcb44){_0x2e66c9['push'](_0x2e66c9['shift']());}};_0x835aac(++_0x570d10);}(_0xcf53,0x8c));var _0x3cf5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcf53[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3cf5('0x0'));var md5=require(_0x3cf5('0x1'));var util=require(_0x3cf5('0x2'));var Redis=require('ioredis');var config=require(_0x3cf5('0x3'));config[_0x3cf5('0x4')]=_[_0x3cf5('0x5')](config[_0x3cf5('0x4')],{'host':_0x3cf5('0x6'),'port':0x18eb});var io=require(_0x3cf5('0x7'))(new Redis(config['redis']));function ChatQueue(_0xd10ca1){this['id']=_0xd10ca1['id']||0x0;this[_0x3cf5('0x8')]=_0xd10ca1[_0x3cf5('0x8')]||'';this[_0x3cf5('0x9')]=_0xd10ca1['timeout']||0xa;this[_0x3cf5('0xa')]=_0xd10ca1['strategy']||_0x3cf5('0xb');this['Agents']=_0xd10ca1[_0x3cf5('0xc')];this[_0x3cf5('0xd')]={};this[_0x3cf5('0xe')]=0x0;this[_0x3cf5('0x1')]='';this[_0x3cf5('0xf')]();this[_0x3cf5('0x10')]();}ChatQueue[_0x3cf5('0x11')][_0x3cf5('0xf')]=function(){var _0x22cdb1=this[_0x3cf5('0xd')][_0x3cf5('0x12')];this[_0x3cf5('0xd')]=_[_0x3cf5('0x13')](this[_0x3cf5('0xc')],'id');this['mapAgentsId'][_0x3cf5('0x12')]=_0x22cdb1;};ChatQueue[_0x3cf5('0x11')][_0x3cf5('0x10')]=function(){this[_0x3cf5('0x14')]=0x0;this[_0x3cf5('0x15')]=0x0;for(var _0x5a4bf4=0x0;_0x5a4bf4=0x0?this[_0x3cf5('0x18')]:0x0;var _0x3817c2={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x3cf5('0x8')],'paused':this['paused'],'waiting':this[_0x3cf5('0xe')]};var _0x299846=md5(JSON[_0x3cf5('0x19')](_0x3817c2));if(this[_0x3cf5('0x1')]!==_0x299846){this[_0x3cf5('0x1')]=_0x299846;io['to'](util[_0x3cf5('0x1a')](_0x3cf5('0x1b'),_0x3817c2[_0x3cf5('0x8')]))['emit'](_0x3cf5('0x1c'),_0x3817c2);}};module[_0x3cf5('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index adb5307..6581efd 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 _0x5cda=['updateRouting','updateRealtime','prototype','map','_rr','paused','length','online','faxPause','available','loggedIn','format','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x32f097,_0x348950){var _0x54b302=function(_0xfcb5cc){while(--_0xfcb5cc){_0x32f097['push'](_0x32f097['shift']());}};_0x54b302(++_0x348950);}(_0x5cda,0x114));var _0xa5cd=function(_0x3e80ed,_0xebb114){_0x3e80ed=_0x3e80ed-0x0;var _0x1044bc=_0x5cda[_0x3e80ed];return _0x1044bc;};'use strict';var _=require(_0xa5cd('0x0'));var md5=require(_0xa5cd('0x1'));var util=require('util');var Redis=require(_0xa5cd('0x2'));var config=require(_0xa5cd('0x3'));config[_0xa5cd('0x4')]=_['defaults'](config['redis'],{'host':_0xa5cd('0x5'),'port':0x18eb});var io=require(_0xa5cd('0x6'))(new Redis(config[_0xa5cd('0x4')]));function FaxQueue(_0x230542){this['id']=_0x230542['id']||0x0;this[_0xa5cd('0x7')]=_0x230542[_0xa5cd('0x7')]||'';this[_0xa5cd('0x8')]=_0x230542['timeout']||0xa;this[_0xa5cd('0x9')]=_0x230542[_0xa5cd('0x9')]||_0xa5cd('0xa');this['Agents']=_0x230542[_0xa5cd('0xb')];this[_0xa5cd('0xc')]={};this[_0xa5cd('0xd')]=0x0;this[_0xa5cd('0x1')]='';this[_0xa5cd('0xe')]();this[_0xa5cd('0xf')]();}FaxQueue[_0xa5cd('0x10')][_0xa5cd('0xe')]=function(){var _0x11944a=this[_0xa5cd('0xc')]['_rr'];this[_0xa5cd('0xc')]=_[_0xa5cd('0x11')](this[_0xa5cd('0xb')],'id');this[_0xa5cd('0xc')][_0xa5cd('0x12')]=_0x11944a;};FaxQueue[_0xa5cd('0x10')][_0xa5cd('0xf')]=function(){this['loggedIn']=0x0;this[_0xa5cd('0x13')]=0x0;for(var _0x56d776=0x0;_0x56d776=0x0?this[_0xa5cd('0x17')]:0x0;var _0x4906b6={'id':this['id'],'available':this[_0xa5cd('0x17')],'loggedIn':this[_0xa5cd('0x18')],'name':this[_0xa5cd('0x7')],'paused':this[_0xa5cd('0x13')],'waiting':this[_0xa5cd('0xd')]};var _0x1f3e2b=md5(JSON['stringify'](_0x4906b6));if(this[_0xa5cd('0x1')]!==_0x1f3e2b){this[_0xa5cd('0x1')]=_0x1f3e2b;io['to'](util[_0xa5cd('0x19')]('fax:queue:%s',_0x4906b6[_0xa5cd('0x7')]))[_0xa5cd('0x1a')](_0xa5cd('0x1b'),_0x4906b6);}};module[_0xa5cd('0x1c')]=FaxQueue; \ No newline at end of file +var _0x78fc=['timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','faxPause','available','paused','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x5678c9,_0x2bf9f){var _0x58bf55=function(_0x218608){while(--_0x218608){_0x5678c9['push'](_0x5678c9['shift']());}};_0x58bf55(++_0x2bf9f);}(_0x78fc,0x1d3));var _0xc78f=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x78fc[_0x680821];return _0x3f132c;};'use strict';var _=require(_0xc78f('0x0'));var md5=require(_0xc78f('0x1'));var util=require(_0xc78f('0x2'));var Redis=require(_0xc78f('0x3'));var config=require(_0xc78f('0x4'));config['redis']=_['defaults'](config[_0xc78f('0x5')],{'host':_0xc78f('0x6'),'port':0x18eb});var io=require(_0xc78f('0x7'))(new Redis(config[_0xc78f('0x5')]));function FaxQueue(_0x5bd65c){this['id']=_0x5bd65c['id']||0x0;this[_0xc78f('0x8')]=_0x5bd65c[_0xc78f('0x8')]||'';this[_0xc78f('0x9')]=_0x5bd65c[_0xc78f('0x9')]||0xa;this[_0xc78f('0xa')]=_0x5bd65c[_0xc78f('0xa')]||_0xc78f('0xb');this[_0xc78f('0xc')]=_0x5bd65c[_0xc78f('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xc78f('0x1')]='';this[_0xc78f('0xd')]();this[_0xc78f('0xe')]();}FaxQueue[_0xc78f('0xf')]['updateRouting']=function(){var _0x11e5cd=this[_0xc78f('0x10')][_0xc78f('0x11')];this['mapAgentsId']=_[_0xc78f('0x12')](this[_0xc78f('0xc')],'id');this[_0xc78f('0x10')][_0xc78f('0x11')]=_0x11e5cd;};FaxQueue[_0xc78f('0xf')][_0xc78f('0xe')]=function(){this[_0xc78f('0x13')]=0x0;this['paused']=0x0;for(var _0x12c5a2=0x0;_0x12c5a2=0x0?this['available']:0x0;var _0xd85de5={'id':this['id'],'available':this[_0xc78f('0x15')],'loggedIn':this[_0xc78f('0x13')],'name':this[_0xc78f('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x49b9c8=md5(JSON[_0xc78f('0x17')](_0xd85de5));if(this[_0xc78f('0x1')]!==_0x49b9c8){this[_0xc78f('0x1')]=_0x49b9c8;io['to'](util['format'](_0xc78f('0x18'),_0xd85de5['name']))[_0xc78f('0x19')](_0xc78f('0x1a'),_0xd85de5);}};module[_0xc78f('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 791de4b..24fd833 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 _0x5cb4=['exports','name','Intervals'];(function(_0x15676a,_0x5edd39){var _0x175fa4=function(_0x1e8463){while(--_0x1e8463){_0x15676a['push'](_0x15676a['shift']());}};_0x175fa4(++_0x5edd39);}(_0x5cb4,0x1c3));var _0x45cb=function(_0x52ea49,_0x2dcda9){_0x52ea49=_0x52ea49-0x0;var _0x56b4fb=_0x5cb4[_0x52ea49];return _0x56b4fb;};'use strict';function Interval(_0x52d219){this['id']=_0x52d219['id']||0x0;this[_0x45cb('0x0')]=_0x52d219[_0x45cb('0x0')]||'';this[_0x45cb('0x1')]=_0x52d219[_0x45cb('0x1')]||{};}module[_0x45cb('0x2')]=Interval; \ No newline at end of file +var _0xf482=['exports','Intervals'];(function(_0x2d43bf,_0x11328a){var _0x6abec9=function(_0x137a67){while(--_0x137a67){_0x2d43bf['push'](_0x2d43bf['shift']());}};_0x6abec9(++_0x11328a);}(_0xf482,0x16f));var _0x2f48=function(_0x28809a,_0x573a8f){_0x28809a=_0x28809a-0x0;var _0x45b659=_0xf482[_0x28809a];return _0x45b659;};'use strict';function Interval(_0x1ee152){this['id']=_0x1ee152['id']||0x0;this['name']=_0x1ee152['name']||'';this[_0x2f48('0x0')]=_0x1ee152[_0x2f48('0x0')]||{};}module[_0x2f48('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 5e30c22..483f3e5 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 _0x3493=['Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','mailPause','available','mail_queue:save','exports','md5','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x446fc5,_0x1e66cd){var _0x4ec0f4=function(_0x57c168){while(--_0x57c168){_0x446fc5['push'](_0x446fc5['shift']());}};_0x4ec0f4(++_0x1e66cd);}(_0x3493,0x122));var _0x3349=function(_0x214434,_0x3facc0){_0x214434=_0x214434-0x0;var _0x309f3b=_0x3493[_0x214434];return _0x309f3b;};'use strict';var _=require('lodash');var md5=require(_0x3349('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3349('0x1'));config['redis']=_[_0x3349('0x2')](config[_0x3349('0x3')],{'host':_0x3349('0x4'),'port':0x18eb});var io=require(_0x3349('0x5'))(new Redis(config[_0x3349('0x3')]));function MailQueue(_0x283185){this['id']=_0x283185['id']||0x0;this[_0x3349('0x6')]=_0x283185[_0x3349('0x6')]||'';this[_0x3349('0x7')]=_0x283185[_0x3349('0x7')]||0xa;this[_0x3349('0x8')]=_0x283185[_0x3349('0x8')]||_0x3349('0x9');this[_0x3349('0xa')]=_0x283185[_0x3349('0xa')];this[_0x3349('0xb')]={};this[_0x3349('0xc')]=0x0;this[_0x3349('0x0')]='';this[_0x3349('0xd')]();this['updateRealtime']();}MailQueue[_0x3349('0xe')][_0x3349('0xd')]=function(){var _0xae0cf5=this[_0x3349('0xb')][_0x3349('0xf')];this[_0x3349('0xb')]=_[_0x3349('0x10')](this[_0x3349('0xa')],'id');this['mapAgentsId'][_0x3349('0xf')]=_0xae0cf5;};MailQueue[_0x3349('0xe')][_0x3349('0x11')]=function(){this[_0x3349('0x12')]=0x0;this[_0x3349('0x13')]=0x0;for(var _0x578297=0x0;_0x578297=0x0?this[_0x3349('0x16')]:0x0;var _0x4c6f59={'id':this['id'],'available':this[_0x3349('0x16')],'loggedIn':this[_0x3349('0x12')],'name':this[_0x3349('0x6')],'paused':this['paused'],'waiting':this[_0x3349('0xc')]};var _0x22de26=md5(JSON['stringify'](_0x4c6f59));if(this[_0x3349('0x0')]!==_0x22de26){this['md5']=_0x22de26;io['to'](util['format']('mail:queue:%s',_0x4c6f59['name']))['emit'](_0x3349('0x17'),_0x4c6f59);}};module[_0x3349('0x18')]=MailQueue; \ No newline at end of file +var _0xcf99=['name','waiting','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','strategy','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','mailPause','available'];(function(_0x4a522f,_0x90a85f){var _0x25d72=function(_0x1caaf6){while(--_0x1caaf6){_0x4a522f['push'](_0x4a522f['shift']());}};_0x25d72(++_0x90a85f);}(_0xcf99,0x130));var _0x9cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf99[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9cf9('0x0'));var md5=require('md5');var util=require(_0x9cf9('0x1'));var Redis=require(_0x9cf9('0x2'));var config=require(_0x9cf9('0x3'));config['redis']=_['defaults'](config[_0x9cf9('0x4')],{'host':_0x9cf9('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9cf9('0x4')]));function MailQueue(_0x127720){this['id']=_0x127720['id']||0x0;this['name']=_0x127720['name']||'';this['timeout']=_0x127720['timeout']||0xa;this[_0x9cf9('0x6')]=_0x127720[_0x9cf9('0x6')]||'beepall';this['Agents']=_0x127720[_0x9cf9('0x7')];this[_0x9cf9('0x8')]={};this['waiting']=0x0;this[_0x9cf9('0x9')]='';this[_0x9cf9('0xa')]();this[_0x9cf9('0xb')]();}MailQueue[_0x9cf9('0xc')][_0x9cf9('0xa')]=function(){var _0x3c4641=this[_0x9cf9('0x8')][_0x9cf9('0xd')];this[_0x9cf9('0x8')]=_['map'](this[_0x9cf9('0x7')],'id');this[_0x9cf9('0x8')][_0x9cf9('0xd')]=_0x3c4641;};MailQueue[_0x9cf9('0xc')][_0x9cf9('0xb')]=function(){this[_0x9cf9('0xe')]=0x0;this[_0x9cf9('0xf')]=0x0;for(var _0x56aa3c=0x0;_0x56aa3c=0x0?this[_0x9cf9('0x13')]:0x0;var _0x5015c8={'id':this['id'],'available':this[_0x9cf9('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x9cf9('0x14')],'paused':this[_0x9cf9('0xf')],'waiting':this[_0x9cf9('0x15')]};var _0x357915=md5(JSON[_0x9cf9('0x16')](_0x5015c8));if(this['md5']!==_0x357915){this['md5']=_0x357915;io['to'](util['format'](_0x9cf9('0x17'),_0x5015c8[_0x9cf9('0x14')]))[_0x9cf9('0x18')](_0x9cf9('0x19'),_0x5015c8);}};module[_0x9cf9('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9bd1fbd..e9486b4 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x5b1c87,_0x443611){var _0x5eeca9=function(_0x52d3c9){while(--_0x52d3c9){_0x5b1c87['push'](_0x5b1c87['shift']());}};_0x5eeca9(++_0x443611);}(_0x814b,0x1a2));var _0xb814=function(_0x119e7a,_0x3949d3){_0x119e7a=_0x119e7a-0x0;var _0x1fb90a=_0x814b[_0x119e7a];return _0x1fb90a;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +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(_0x146f25,_0x1d6489){var _0x2c17a2=function(_0x368e9a){while(--_0x368e9a){_0x146f25['push'](_0x146f25['shift']());}};_0x2c17a2(++_0x1d6489);}(_0x5fc3,0xa8));var _0x35fc=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5fc3[_0x279d37];return _0x530173;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f4e35b8..d3325f9 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 _0x2504=['strategy','beepall','Agents','waiting','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','loggedIn','paused','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x112710,_0xdd032a){var _0x4d05a9=function(_0x56c417){while(--_0x56c417){_0x112710['push'](_0x112710['shift']());}};_0x4d05a9(++_0xdd032a);}(_0x2504,0xee));var _0x4250=function(_0x429003,_0x3508da){_0x429003=_0x429003-0x0;var _0x3cc0d9=_0x2504[_0x429003];return _0x3cc0d9;};'use strict';var _=require(_0x4250('0x0'));var md5=require(_0x4250('0x1'));var util=require(_0x4250('0x2'));var Redis=require(_0x4250('0x3'));var config=require(_0x4250('0x4'));config[_0x4250('0x5')]=_[_0x4250('0x6')](config[_0x4250('0x5')],{'host':_0x4250('0x7'),'port':0x18eb});var io=require(_0x4250('0x8'))(new Redis(config[_0x4250('0x5')]));function SmsQueue(_0x33d70b){this['id']=_0x33d70b['id']||0x0;this['name']=_0x33d70b[_0x4250('0x9')]||'';this['timeout']=_0x33d70b['timeout']||0xa;this[_0x4250('0xa')]=_0x33d70b[_0x4250('0xa')]||_0x4250('0xb');this[_0x4250('0xc')]=_0x33d70b[_0x4250('0xc')];this['mapAgentsId']={};this[_0x4250('0xd')]=0x0;this['md5']='';this[_0x4250('0xe')]();this[_0x4250('0xf')]();}SmsQueue['prototype'][_0x4250('0xe')]=function(){var _0x583057=this['mapAgentsId'][_0x4250('0x10')];this[_0x4250('0x11')]=_[_0x4250('0x12')](this[_0x4250('0xc')],'id');this[_0x4250('0x11')]['_rr']=_0x583057;};SmsQueue[_0x4250('0x13')][_0x4250('0xf')]=function(){this[_0x4250('0x14')]=0x0;this[_0x4250('0x15')]=0x0;for(var _0xfa4d8a=0x0;_0xfa4d8a=0x0?this[_0x4250('0x18')]:0x0;var _0x369010={'id':this['id'],'available':this[_0x4250('0x18')],'loggedIn':this[_0x4250('0x14')],'name':this['name'],'paused':this[_0x4250('0x15')],'waiting':this['waiting']};var _0x5aa26e=md5(JSON[_0x4250('0x19')](_0x369010));if(this[_0x4250('0x1')]!==_0x5aa26e){this[_0x4250('0x1')]=_0x5aa26e;io['to'](util[_0x4250('0x1a')](_0x4250('0x1b'),_0x369010[_0x4250('0x9')]))[_0x4250('0x1c')](_0x4250('0x1d'),_0x369010);}};module[_0x4250('0x1e')]=SmsQueue; \ No newline at end of file +var _0x61a5=['lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','md5','sms:queue:%s','emit','sms_queue:save','exports'];(function(_0x59943d,_0x2e751b){var _0x46ace9=function(_0xfbd5f2){while(--_0xfbd5f2){_0x59943d['push'](_0x59943d['shift']());}};_0x46ace9(++_0x2e751b);}(_0x61a5,0xf0));var _0x561a=function(_0x584b9d,_0x1cb5c5){_0x584b9d=_0x584b9d-0x0;var _0x172053=_0x61a5[_0x584b9d];return _0x172053;};'use strict';var _=require(_0x561a('0x0'));var md5=require('md5');var util=require(_0x561a('0x1'));var Redis=require(_0x561a('0x2'));var config=require(_0x561a('0x3'));config[_0x561a('0x4')]=_[_0x561a('0x5')](config['redis'],{'host':_0x561a('0x6'),'port':0x18eb});var io=require(_0x561a('0x7'))(new Redis(config['redis']));function SmsQueue(_0x18902a){this['id']=_0x18902a['id']||0x0;this[_0x561a('0x8')]=_0x18902a[_0x561a('0x8')]||'';this[_0x561a('0x9')]=_0x18902a[_0x561a('0x9')]||0xa;this[_0x561a('0xa')]=_0x18902a[_0x561a('0xa')]||'beepall';this[_0x561a('0xb')]=_0x18902a['Agents'];this[_0x561a('0xc')]={};this[_0x561a('0xd')]=0x0;this['md5']='';this[_0x561a('0xe')]();this[_0x561a('0xf')]();}SmsQueue['prototype'][_0x561a('0xe')]=function(){var _0x5cc8ed=this[_0x561a('0xc')][_0x561a('0x10')];this[_0x561a('0xc')]=_[_0x561a('0x11')](this[_0x561a('0xb')],'id');this[_0x561a('0xc')][_0x561a('0x10')]=_0x5cc8ed;};SmsQueue[_0x561a('0x12')][_0x561a('0xf')]=function(){this[_0x561a('0x13')]=0x0;this[_0x561a('0x14')]=0x0;for(var _0x28638b=0x0;_0x28638b=0x0?this[_0x561a('0x18')]:0x0;var _0x190057={'id':this['id'],'available':this['available'],'loggedIn':this[_0x561a('0x13')],'name':this[_0x561a('0x8')],'paused':this['paused'],'waiting':this[_0x561a('0xd')]};var _0x567399=md5(JSON['stringify'](_0x190057));if(this[_0x561a('0x19')]!==_0x567399){this[_0x561a('0x19')]=_0x567399;io['to'](util['format'](_0x561a('0x1a'),_0x190057[_0x561a('0x8')]))[_0x561a('0x1b')](_0x561a('0x1c'),_0x190057);}};module[_0x561a('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 32db41e..47d0d4e 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 _0x4821=['name','stringify','md5','emit','whatsapp_queue:save','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','map','_rr','loggedIn','paused','online','available'];(function(_0x3307bd,_0x256dbf){var _0x2561be=function(_0x3ebf){while(--_0x3ebf){_0x3307bd['push'](_0x3307bd['shift']());}};_0x2561be(++_0x256dbf);}(_0x4821,0x157));var _0x1482=function(_0x9389c6,_0x44234e){_0x9389c6=_0x9389c6-0x0;var _0xa5404c=_0x4821[_0x9389c6];return _0xa5404c;};'use strict';var _=require(_0x1482('0x0'));var md5=require('md5');var util=require(_0x1482('0x1'));var Redis=require('ioredis');var config=require(_0x1482('0x2'));config[_0x1482('0x3')]=_[_0x1482('0x4')](config[_0x1482('0x3')],{'host':_0x1482('0x5'),'port':0x18eb});var io=require(_0x1482('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x1a046e){this['id']=_0x1a046e['id']||0x0;this['name']=_0x1a046e['name']||'';this['timeout']=_0x1a046e[_0x1482('0x7')]||0xa;this[_0x1482('0x8')]=_0x1a046e['strategy']||_0x1482('0x9');this['Agents']=_0x1a046e[_0x1482('0xa')];this[_0x1482('0xb')]={};this[_0x1482('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x1482('0xd')]();}WhatsappQueue['prototype'][_0x1482('0xe')]=function(){var _0x4b9060=this[_0x1482('0xb')]['_rr'];this['mapAgentsId']=_[_0x1482('0xf')](this[_0x1482('0xa')],'id');this[_0x1482('0xb')][_0x1482('0x10')]=_0x4b9060;};WhatsappQueue['prototype'][_0x1482('0xd')]=function(){this[_0x1482('0x11')]=0x0;this[_0x1482('0x12')]=0x0;for(var _0xf49826=0x0;_0xf49826=0x0?this[_0x1482('0x14')]:0x0;var _0x59d67={'id':this['id'],'available':this[_0x1482('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x1482('0x15')],'paused':this[_0x1482('0x12')],'waiting':this['waiting']};var _0x20bc22=md5(JSON[_0x1482('0x16')](_0x59d67));if(this[_0x1482('0x17')]!==_0x20bc22){this[_0x1482('0x17')]=_0x20bc22;io['to'](util['format']('whatsapp:queue:%s',_0x59d67[_0x1482('0x15')]))[_0x1482('0x18')](_0x1482('0x19'),_0x59d67);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x16ec=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','md5','ioredis','defaults','redis','socket.io-emitter','name'];(function(_0x16b10e,_0x9f999d){var _0x5324b5=function(_0x3b82f6){while(--_0x3b82f6){_0x16b10e['push'](_0x16b10e['shift']());}};_0x5324b5(++_0x9f999d);}(_0x16ec,0x13e));var _0xc16e=function(_0x506c5e,_0x518311){_0x506c5e=_0x506c5e-0x0;var _0x5b11f7=_0x16ec[_0x506c5e];return _0x5b11f7;};'use strict';var _=require('lodash');var md5=require(_0xc16e('0x0'));var util=require('util');var Redis=require(_0xc16e('0x1'));var config=require('../../../config/environment');config['redis']=_[_0xc16e('0x2')](config[_0xc16e('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xc16e('0x4'))(new Redis(config[_0xc16e('0x3')]));function WhatsappQueue(_0x437f07){this['id']=_0x437f07['id']||0x0;this['name']=_0x437f07[_0xc16e('0x5')]||'';this[_0xc16e('0x6')]=_0x437f07[_0xc16e('0x6')]||0xa;this[_0xc16e('0x7')]=_0x437f07[_0xc16e('0x7')]||_0xc16e('0x8');this[_0xc16e('0x9')]=_0x437f07[_0xc16e('0x9')];this[_0xc16e('0xa')]={};this[_0xc16e('0xb')]=0x0;this[_0xc16e('0x0')]='';this[_0xc16e('0xc')]();this[_0xc16e('0xd')]();}WhatsappQueue['prototype'][_0xc16e('0xc')]=function(){var _0x13812b=this['mapAgentsId'][_0xc16e('0xe')];this[_0xc16e('0xa')]=_[_0xc16e('0xf')](this['Agents'],'id');this[_0xc16e('0xa')][_0xc16e('0xe')]=_0x13812b;};WhatsappQueue['prototype'][_0xc16e('0xd')]=function(){this[_0xc16e('0x10')]=0x0;this[_0xc16e('0x11')]=0x0;for(var _0x2c89b5=0x0;_0x2c89b5=0x0?this['available']:0x0;var _0x434c17={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc16e('0x10')],'name':this['name'],'paused':this[_0xc16e('0x11')],'waiting':this[_0xc16e('0xb')]};var _0x30ef66=md5(JSON[_0xc16e('0x16')](_0x434c17));if(this[_0xc16e('0x0')]!==_0x30ef66){this[_0xc16e('0x0')]=_0x30ef66;io['to'](util[_0xc16e('0x17')](_0xc16e('0x18'),_0x434c17[_0xc16e('0x5')]))[_0xc16e('0x19')](_0xc16e('0x1a'),_0x434c17);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index f262ece..e2a2052 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index d3f030c..51c7025 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 _0x1369=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1369,0xd5));var _0x9136=function(_0x1af3c2,_0x414439){_0x1af3c2=_0x1af3c2-0x0;var _0x4ed667=_0x1369[_0x1af3c2];return _0x4ed667;};'use strict';var client=require(_0x9136('0x0'));exports['update']=function(_0x3a5f8c,_0x26b19a){return client[_0x9136('0x1')](_0x9136('0x2'),{'body':_0x26b19a,'options':{'where':{'id':_0x3a5f8c}},'log':_0x9136('0x3')});};exports[_0x9136('0x4')]=function(_0x218351,_0x105c16){return client[_0x9136('0x1')](_0x9136('0x5'),{'body':_0x105c16,'options':{'where':{'id':_0x218351}},'log':_0x9136('0x6')});}; \ No newline at end of file +var _0x10c9=['../client','UpdateChatInteraction','updateChatInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x10c9,0xea));var _0x910c=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x10c9[_0xe73080];return _0x12cbc4;};'use strict';var client=require(_0x910c('0x0'));exports['update']=function(_0x987a7c,_0x5ac14b){return client['Request'](_0x910c('0x1'),{'body':_0x5ac14b,'options':{'where':{'id':_0x987a7c}},'log':_0x910c('0x2')});};exports[_0x910c('0x3')]=function(_0x1ab8b4,_0x21a5de){return client[_0x910c('0x4')]('AddTagsToChatInteraction',{'body':_0x21a5de,'options':{'where':{'id':_0x1ab8b4}},'log':_0x910c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7f87fb3..064f1f1 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 _0x5e2a=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x217864,_0x183226){var _0x58d26f=function(_0x526adb){while(--_0x526adb){_0x217864['push'](_0x217864['shift']());}};_0x58d26f(++_0x183226);}(_0x5e2a,0x9d));var _0xa5e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e2a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa5e2('0x0'));exports[_0xa5e2('0x1')]=function(_0x8a819f){return client[_0xa5e2('0x2')](_0xa5e2('0x3'),{'body':_0x8a819f,'log':_0xa5e2('0x4')});}; \ No newline at end of file +var _0xd09f=['CreateChatMessage','createChatMessage','../client','create'];(function(_0x384f83,_0x4047d0){var _0x2a1f1a=function(_0x5cf392){while(--_0x5cf392){_0x384f83['push'](_0x384f83['shift']());}};_0x2a1f1a(++_0x4047d0);}(_0xd09f,0x152));var _0xfd09=function(_0x44714c,_0x2ac454){_0x44714c=_0x44714c-0x0;var _0x57d4d5=_0xd09f[_0x44714c];return _0x57d4d5;};'use strict';var client=require(_0xfd09('0x0'));exports[_0xfd09('0x1')]=function(_0x3a4705){return client['Request'](_0xfd09('0x2'),{'body':_0x3a4705,'log':_0xfd09('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a6a35f9..e7dadd1 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 _0xb194=['Agents','chatPause','../client','Request','GetChatQueue','name','timeout','strategy'];(function(_0xec2be8,_0x26230b){var _0x4c1390=function(_0xb91a78){while(--_0xb91a78){_0xec2be8['push'](_0xec2be8['shift']());}};_0x4c1390(++_0x26230b);}(_0xb194,0x1b2));var _0x4b19=function(_0x333160,_0x4c1df7){_0x333160=_0x333160-0x0;var _0x256d5a=_0xb194[_0x333160];return _0x256d5a;};'use strict';var client=require(_0x4b19('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x4b19('0x1')](_0x4b19('0x2'),{'options':{'raw':![],'attributes':['id',_0x4b19('0x3'),_0x4b19('0x4'),_0x4b19('0x5')],'include':[{'model':'User','as':_0x4b19('0x6'),'attributes':['id',_0x4b19('0x3'),'online',_0x4b19('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xe1dc=['strategy','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0xe1dc,0x8a));var _0xce1d=function(_0x278ef8,_0x3fdac3){_0x278ef8=_0x278ef8-0x0;var _0x481ad0=_0xe1dc[_0x278ef8];return _0x481ad0;};'use strict';var client=require(_0xce1d('0x0'));exports[_0xce1d('0x1')]=function(){return function(){return client[_0xce1d('0x2')](_0xce1d('0x3'),{'options':{'raw':![],'attributes':['id',_0xce1d('0x4'),_0xce1d('0x5'),_0xce1d('0x6')],'include':[{'model':'User','as':_0xce1d('0x7'),'attributes':['id','name','online',_0xce1d('0x8')]}]},'log':_0xce1d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6ef8b51..39e43fe 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 _0x23d3=['UpdateChatQueueReport','../client','create','CreateChatQueueReport','update','Request','DESC'];(function(_0x4de2e1,_0x485c35){var _0x3787e0=function(_0x464ff5){while(--_0x464ff5){_0x4de2e1['push'](_0x4de2e1['shift']());}};_0x3787e0(++_0x485c35);}(_0x23d3,0xe8));var _0x323d=function(_0x3813dc,_0xa9f842){_0x3813dc=_0x3813dc-0x0;var _0x3b0966=_0x23d3[_0x3813dc];return _0x3b0966;};'use strict';var client=require(_0x323d('0x0'));exports[_0x323d('0x1')]=function(_0x5b5fc4){return client['Request'](_0x323d('0x2'),{'body':_0x5b5fc4,'log':_0x323d('0x2')});};exports[_0x323d('0x3')]=function(_0x35c20b,_0xeb2e57){return client[_0x323d('0x4')]('UpdateChatQueueReport',{'body':_0xeb2e57,'options':{'where':{'uniqueid':_0x35c20b},'order':[['id',_0x323d('0x5')]],'limit':0x1},'log':_0x323d('0x6')});}; \ No newline at end of file +var _0x43f3=['UpdateChatQueueReport','create','CreateChatQueueReport','update','Request'];(function(_0x103421,_0x4d7fe7){var _0x3272c9=function(_0x5219ef){while(--_0x5219ef){_0x103421['push'](_0x103421['shift']());}};_0x3272c9(++_0x4d7fe7);}(_0x43f3,0xab));var _0x343f=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x43f3[_0x101e7b];return _0x4995c0;};'use strict';var client=require('../client');exports[_0x343f('0x0')]=function(_0x177f01){return client['Request'](_0x343f('0x1'),{'body':_0x177f01,'log':'CreateChatQueueReport'});};exports[_0x343f('0x2')]=function(_0x48008f,_0x3339a9){return client[_0x343f('0x3')](_0x343f('0x4'),{'body':_0x3339a9,'options':{'where':{'uniqueid':_0x48008f},'order':[['id','DESC']],'limit':0x1},'log':_0x343f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 85ca9fa..8cb4990 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(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x7a54,0x106));var _0x47a5=function(_0x3900b6,_0x3e1736){_0x3900b6=_0x3900b6-0x0;var _0x301582=_0x7a54[_0x3900b6];return _0x301582;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x7a54,0x106));var _0x47a5=function(_0x1ca89d,_0x205060){_0x1ca89d=_0x1ca89d-0x0;var _0x4986f4=_0x7a54[_0x1ca89d];return _0x4986f4;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 35fdc26..20065c9 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 _0xcfca=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x3374fd,_0x59a9bc){var _0xb10792=function(_0x51eb9d){while(--_0x51eb9d){_0x3374fd['push'](_0x3374fd['shift']());}};_0xb10792(++_0x59a9bc);}(_0xcfca,0x119));var _0xacfc=function(_0x445793,_0x46cec6){_0x445793=_0x445793-0x0;var _0x18ae1a=_0xcfca[_0x445793];return _0x18ae1a;};'use strict';var client=require(_0xacfc('0x0'));exports[_0xacfc('0x1')]=function(_0x852d46){return client[_0xacfc('0x2')](_0xacfc('0x3'),{'body':_0x852d46,'log':_0xacfc('0x4')});}; \ No newline at end of file +var _0x1fca=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x3c07c8,_0x553ecd){var _0x1ef9b1=function(_0x9a2e55){while(--_0x9a2e55){_0x3c07c8['push'](_0x3c07c8['shift']());}};_0x1ef9b1(++_0x553ecd);}(_0x1fca,0x1d9));var _0xa1fc=function(_0x1db998,_0x4f9a45){_0x1db998=_0x1db998-0x0;var _0x155d91=_0x1fca[_0x1db998];return _0x155d91;};'use strict';var client=require(_0xa1fc('0x0'));exports[_0xa1fc('0x1')]=function(_0x1e2032){return client[_0xa1fc('0x2')](_0xa1fc('0x3'),{'body':_0x1e2032,'log':_0xa1fc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 919c2a7..2d5a207 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 _0xe1e4=['strategy','Agents','online','faxPause','../client','getFaxQueues','Request','name'];(function(_0x520e68,_0xccf9a8){var _0x4147fd=function(_0x2fd5d7){while(--_0x2fd5d7){_0x520e68['push'](_0x520e68['shift']());}};_0x4147fd(++_0xccf9a8);}(_0xe1e4,0x12c));var _0x4e1e=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xe1e4[_0x4a53d];return _0x27410e;};'use strict';var client=require(_0x4e1e('0x0'));exports[_0x4e1e('0x1')]=function(){return function(){return client[_0x4e1e('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4e1e('0x3'),'timeout',_0x4e1e('0x4')],'include':[{'model':'User','as':_0x4e1e('0x5'),'attributes':['id',_0x4e1e('0x3'),_0x4e1e('0x6'),_0x4e1e('0x7')]}]},'log':_0x4e1e('0x1')});};}; \ No newline at end of file +var _0x518c=['getFaxQueues','Request','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0x12cec3,_0x5dfbb2){var _0x236122=function(_0x3808e7){while(--_0x3808e7){_0x12cec3['push'](_0x12cec3['shift']());}};_0x236122(++_0x5dfbb2);}(_0x518c,0x118));var _0xc518=function(_0xcd8f58,_0x394acd){_0xcd8f58=_0xcd8f58-0x0;var _0x408c94=_0x518c[_0xcd8f58];return _0x408c94;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xc518('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xc518('0x1'),_0xc518('0x2'),_0xc518('0x3')],'include':[{'model':_0xc518('0x4'),'as':_0xc518('0x5'),'attributes':['id',_0xc518('0x1'),_0xc518('0x6'),_0xc518('0x7')]}]},'log':_0xc518('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0569d94..797b07c 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 _0xc9bf=['update','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x3a76b6,_0x23fb16){var _0x18d17c=function(_0x2ce183){while(--_0x2ce183){_0x3a76b6['push'](_0x3a76b6['shift']());}};_0x18d17c(++_0x23fb16);}(_0xc9bf,0xe0));var _0xfc9b=function(_0xe41308,_0x47c625){_0xe41308=_0xe41308-0x0;var _0x14816f=_0xc9bf[_0xe41308];return _0x14816f;};'use strict';var client=require(_0xfc9b('0x0'));exports[_0xfc9b('0x1')]=function(_0x3d43f1){return client[_0xfc9b('0x2')](_0xfc9b('0x3'),{'body':_0x3d43f1,'log':_0xfc9b('0x3')});};exports[_0xfc9b('0x4')]=function(_0x54cfdb,_0x455297){return client[_0xfc9b('0x2')](_0xfc9b('0x5'),{'body':_0x455297,'options':{'where':{'uniqueid':_0x54cfdb},'order':[['id','DESC']],'limit':0x1},'log':_0xfc9b('0x5')});}; \ No newline at end of file +var _0xa9eb=['create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xa9eb,0x1f1));var _0xba9e=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xa9eb[_0x256b72];return _0x2183e3;};'use strict';var client=require(_0xba9e('0x0'));exports[_0xba9e('0x1')]=function(_0x122ad8){return client[_0xba9e('0x2')](_0xba9e('0x3'),{'body':_0x122ad8,'log':_0xba9e('0x3')});};exports['update']=function(_0x169c83,_0x2b087a){return client['Request'](_0xba9e('0x4'),{'body':_0x2b087a,'options':{'where':{'uniqueid':_0x169c83},'order':[['id',_0xba9e('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 bd4c05a..ae14eb6 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 _0x8468=['../client','getIntervals','Request','name','Interval','Intervals','interval'];(function(_0x357574,_0x52b0d7){var _0xab0308=function(_0x31d8a7){while(--_0x31d8a7){_0x357574['push'](_0x357574['shift']());}};_0xab0308(++_0x52b0d7);}(_0x8468,0x85));var _0x8846=function(_0x5469ea,_0x351c5c){_0x5469ea=_0x5469ea-0x0;var _0x10efdd=_0x8468[_0x5469ea];return _0x10efdd;};'use strict';var client=require(_0x8846('0x0'));exports[_0x8846('0x1')]=function(){return function(){return client[_0x8846('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8846('0x3')],'include':[{'model':_0x8846('0x4'),'as':_0x8846('0x5'),'attributes':['id','name',_0x8846('0x6')]}]},'log':_0x8846('0x1')});};}; \ No newline at end of file +var _0xe7e9=['name','../client','getIntervals'];(function(_0x2b7806,_0x3b0257){var _0x162485=function(_0x5174f3){while(--_0x5174f3){_0x2b7806['push'](_0x2b7806['shift']());}};_0x162485(++_0x3b0257);}(_0xe7e9,0x160));var _0x9e7e=function(_0x38b8c6,_0x541f91){_0x38b8c6=_0x38b8c6-0x0;var _0x3104d6=_0xe7e9[_0x38b8c6];return _0x3104d6;};'use strict';var client=require(_0x9e7e('0x0'));exports[_0x9e7e('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9e7e('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x9e7e('0x2'),'interval']}]},'log':_0x9e7e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 186a741..b65c3d0 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 _0xb016=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x5b0144,_0x48dcce){var _0x17903f=function(_0x404099){while(--_0x404099){_0x5b0144['push'](_0x5b0144['shift']());}};_0x17903f(++_0x48dcce);}(_0xb016,0x159));var _0x6b01=function(_0x35c00b,_0xeea160){_0x35c00b=_0x35c00b-0x0;var _0x574476=_0xb016[_0x35c00b];return _0x574476;};'use strict';var client=require(_0x6b01('0x0'));exports[_0x6b01('0x1')]=function(_0x513ed6,_0x57ecae){return client[_0x6b01('0x2')]('UpdateMailInteraction',{'body':_0x57ecae,'options':{'where':{'id':_0x513ed6}},'log':_0x6b01('0x3')});};exports[_0x6b01('0x4')]=function(_0x161b59,_0x3b9de1){return client['Request'](_0x6b01('0x5'),{'body':_0x3b9de1,'options':{'where':{'id':_0x161b59}},'log':_0x6b01('0x6')});}; \ No newline at end of file +var _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0xb247d5,_0x423231){var _0x5ac8a5=function(_0x7cea2d){while(--_0x7cea2d){_0xb247d5['push'](_0xb247d5['shift']());}};_0x5ac8a5(++_0x423231);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x2cb1d7,_0x17ca41){_0x2cb1d7=_0x2cb1d7-0x0;var _0x1ca645=_0xcf2f[_0x2cb1d7];return _0x1ca645;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5f91fe0..5cbd69d 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 _0xc070=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x53c739,_0x34dd56){var _0x1cf22e=function(_0x176909){while(--_0x176909){_0x53c739['push'](_0x53c739['shift']());}};_0x1cf22e(++_0x34dd56);}(_0xc070,0x81));var _0x0c07=function(_0x369f0f,_0x4af981){_0x369f0f=_0x369f0f-0x0;var _0x458882=_0xc070[_0x369f0f];return _0x458882;};'use strict';var client=require('../client');exports[_0x0c07('0x0')]=function(_0x475bac){return client[_0x0c07('0x1')](_0x0c07('0x2'),{'body':_0x475bac,'log':_0x0c07('0x3')});}; \ No newline at end of file +var _0xd8ac=['CreateMailMessage','createMailMessage','../client'];(function(_0xf70b9c,_0x3b8e10){var _0x3785f9=function(_0xdafe1b){while(--_0xdafe1b){_0xf70b9c['push'](_0xf70b9c['shift']());}};_0x3785f9(++_0x3b8e10);}(_0xd8ac,0x182));var _0xcd8a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd8ac[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xcd8a('0x0'));exports['create']=function(_0x1962b6){return client['Request'](_0xcd8a('0x1'),{'body':_0x1962b6,'log':_0xcd8a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6a495e4..0c58862 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 _0x521e=['User','Agents','mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy'];(function(_0xb195e9,_0x4c1c52){var _0x5b6b22=function(_0x242991){while(--_0x242991){_0xb195e9['push'](_0xb195e9['shift']());}};_0x5b6b22(++_0x4c1c52);}(_0x521e,0x162));var _0xe521=function(_0x231783,_0x3d73df){_0x231783=_0x231783-0x0;var _0x14c344=_0x521e[_0x231783];return _0x14c344;};'use strict';var client=require('../client');exports[_0xe521('0x0')]=function(){return function(){return client[_0xe521('0x1')](_0xe521('0x2'),{'options':{'raw':![],'attributes':['id',_0xe521('0x3'),_0xe521('0x4'),_0xe521('0x5')],'include':[{'model':_0xe521('0x6'),'as':_0xe521('0x7'),'attributes':['id',_0xe521('0x3'),'online',_0xe521('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x214e=['timeout','User','name','online','getMailQueues','GetMailQueue'];(function(_0x205eca,_0x138c20){var _0x193e81=function(_0x3e8c88){while(--_0x3e8c88){_0x205eca['push'](_0x205eca['shift']());}};_0x193e81(++_0x138c20);}(_0x214e,0x148));var _0xe214=function(_0x4f96f6,_0x578f1){_0x4f96f6=_0x4f96f6-0x0;var _0x2d1508=_0x214e[_0x4f96f6];return _0x2d1508;};'use strict';var client=require('../client');exports[_0xe214('0x0')]=function(){return function(){return client['Request'](_0xe214('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xe214('0x2'),'strategy'],'include':[{'model':_0xe214('0x3'),'as':'Agents','attributes':['id',_0xe214('0x4'),_0xe214('0x5'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7c7728f..3f840e6 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 _0x085c=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x4b1d15,_0x53d981){var _0x26e59b=function(_0x3d4561){while(--_0x3d4561){_0x4b1d15['push'](_0x4b1d15['shift']());}};_0x26e59b(++_0x53d981);}(_0x085c,0x149));var _0xc085=function(_0x25e761,_0xe5c435){_0x25e761=_0x25e761-0x0;var _0x2740af=_0x085c[_0x25e761];return _0x2740af;};'use strict';var client=require(_0xc085('0x0'));exports['create']=function(_0x3d4ec0){return client[_0xc085('0x1')]('CreateMailQueueReport',{'body':_0x3d4ec0,'log':_0xc085('0x2')});};exports[_0xc085('0x3')]=function(_0x4319d1,_0x104f2e){return client['Request'](_0xc085('0x4'),{'body':_0x104f2e,'options':{'where':{'uniqueid':_0x4319d1},'order':[['id',_0xc085('0x5')]],'limit':0x1},'log':_0xc085('0x4')});}; \ No newline at end of file +var _0xd365=['DESC','../client','create','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x31d079,_0x397bbc){var _0x6170d9=function(_0x2996f0){while(--_0x2996f0){_0x31d079['push'](_0x31d079['shift']());}};_0x6170d9(++_0x397bbc);}(_0xd365,0x1b9));var _0x5d36=function(_0x1d8a55,_0x2a8717){_0x1d8a55=_0x1d8a55-0x0;var _0x56174e=_0xd365[_0x1d8a55];return _0x56174e;};'use strict';var client=require(_0x5d36('0x0'));exports[_0x5d36('0x1')]=function(_0x48ac77){return client['Request'](_0x5d36('0x2'),{'body':_0x48ac77,'log':_0x5d36('0x2')});};exports['update']=function(_0x29c25e,_0x23eb0f){return client['Request'](_0x5d36('0x3'),{'body':_0x23eb0f,'options':{'where':{'uniqueid':_0x29c25e},'order':[['id',_0x5d36('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 94ea8c6..dc2ba25 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 _0xf709=['addTags','Request','../client','update','updateOpenchannelInteraction'];(function(_0x26e825,_0x323fd6){var _0x3dc545=function(_0x415fb2){while(--_0x415fb2){_0x26e825['push'](_0x26e825['shift']());}};_0x3dc545(++_0x323fd6);}(_0xf709,0xa7));var _0x9f70=function(_0x198d4b,_0x122cfd){_0x198d4b=_0x198d4b-0x0;var _0x458efd=_0xf709[_0x198d4b];return _0x458efd;};'use strict';var client=require(_0x9f70('0x0'));exports[_0x9f70('0x1')]=function(_0x4ef5ce,_0x317d59){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x317d59,'options':{'where':{'id':_0x4ef5ce}},'log':_0x9f70('0x2')});};exports[_0x9f70('0x3')]=function(_0x57de68,_0x38e85f){return client[_0x9f70('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x38e85f,'options':{'where':{'id':_0x57de68}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xffb1=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x4fbd57,_0x4ebb60){var _0x96138c=function(_0x51b6c3){while(--_0x51b6c3){_0x4fbd57['push'](_0x4fbd57['shift']());}};_0x96138c(++_0x4ebb60);}(_0xffb1,0xce));var _0x1ffb=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xffb1[_0x54d4fe];return _0x1ab5bb;};'use strict';var client=require(_0x1ffb('0x0'));exports[_0x1ffb('0x1')]=function(_0xc3ba56,_0x333577){return client['Request'](_0x1ffb('0x2'),{'body':_0x333577,'options':{'where':{'id':_0xc3ba56}},'log':_0x1ffb('0x3')});};exports[_0x1ffb('0x4')]=function(_0x4a98cd,_0x365ed5){return client['Request'](_0x1ffb('0x5'),{'body':_0x365ed5,'options':{'where':{'id':_0x4a98cd}},'log':_0x1ffb('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index cc3ad7a..31c994f 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 _0x0ce0=['createOpenchannelMessage'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0ce0,0xa2));var _0x00ce=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0x0ce0[_0x2bcddb];return _0x12a9e8;};'use strict';var client=require('../client');exports['create']=function(_0x288e73){return client['Request']('CreateOpenchannelMessage',{'body':_0x288e73,'log':_0x00ce('0x0')});}; \ No newline at end of file +var _0x024a=['create','Request','createOpenchannelMessage'];(function(_0x2c1390,_0x3bfb7e){var _0x250d2a=function(_0x1936b1){while(--_0x1936b1){_0x2c1390['push'](_0x2c1390['shift']());}};_0x250d2a(++_0x3bfb7e);}(_0x024a,0xc9));var _0xa024=function(_0x27e2e0,_0x2be956){_0x27e2e0=_0x27e2e0-0x0;var _0x2f4ba6=_0x024a[_0x27e2e0];return _0x2f4ba6;};'use strict';var client=require('../client');exports[_0xa024('0x0')]=function(_0x4942aa){return client[_0xa024('0x1')]('CreateOpenchannelMessage',{'body':_0x4942aa,'log':_0xa024('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f8b5950..576d93d 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 _0x9ffe=['strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x43d1ae,_0x277bc5){var _0x4cb0cd=function(_0x206203){while(--_0x206203){_0x43d1ae['push'](_0x43d1ae['shift']());}};_0x4cb0cd(++_0x277bc5);}(_0x9ffe,0x1e9));var _0xe9ff=function(_0x584bfa,_0x15fccb){_0x584bfa=_0x584bfa-0x0;var _0x3b55a6=_0x9ffe[_0x584bfa];return _0x3b55a6;};'use strict';var client=require(_0xe9ff('0x0'));exports[_0xe9ff('0x1')]=function(){return function(){return client[_0xe9ff('0x2')](_0xe9ff('0x3'),{'options':{'raw':![],'attributes':['id',_0xe9ff('0x4'),_0xe9ff('0x5'),_0xe9ff('0x6')],'include':[{'model':_0xe9ff('0x7'),'as':_0xe9ff('0x8'),'attributes':['id',_0xe9ff('0x4'),_0xe9ff('0x9'),_0xe9ff('0xa')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x6ab8=['Request','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x3984c2,_0xcee754){var _0x3b3fe4=function(_0xea47dd){while(--_0xea47dd){_0x3984c2['push'](_0x3984c2['shift']());}};_0x3b3fe4(++_0xcee754);}(_0x6ab8,0x66));var _0x86ab=function(_0x4c0fff,_0x28ebf9){_0x4c0fff=_0x4c0fff-0x0;var _0x3f650e=_0x6ab8[_0x4c0fff];return _0x3f650e;};'use strict';var client=require(_0x86ab('0x0'));exports[_0x86ab('0x1')]=function(){return function(){return client[_0x86ab('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x86ab('0x3')],'include':[{'model':_0x86ab('0x4'),'as':_0x86ab('0x5'),'attributes':['id','name',_0x86ab('0x6'),_0x86ab('0x7')]}]},'log':_0x86ab('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 6950b8f..21e0e57 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 _0x18d9=['UpdateOpenchannelQueueReport','DESC','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x2aed9c,_0x3cc875){var _0x3fd3a9=function(_0x273b79){while(--_0x273b79){_0x2aed9c['push'](_0x2aed9c['shift']());}};_0x3fd3a9(++_0x3cc875);}(_0x18d9,0x1b8));var _0x918d=function(_0x111142,_0x29427e){_0x111142=_0x111142-0x0;var _0x3d9e1d=_0x18d9[_0x111142];return _0x3d9e1d;};'use strict';var client=require(_0x918d('0x0'));exports['create']=function(_0x22ecd4){return client[_0x918d('0x1')](_0x918d('0x2'),{'body':_0x22ecd4,'log':_0x918d('0x2')});};exports[_0x918d('0x3')]=function(_0x11cba7,_0x41fddf){return client[_0x918d('0x1')](_0x918d('0x4'),{'body':_0x41fddf,'options':{'where':{'uniqueid':_0x11cba7},'order':[['id',_0x918d('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xc932=['update','UpdateOpenchannelQueueReport','DESC','../client','Request','CreateOpenchannelQueueReport'];(function(_0x575487,_0x23efcc){var _0x2a881b=function(_0x145e27){while(--_0x145e27){_0x575487['push'](_0x575487['shift']());}};_0x2a881b(++_0x23efcc);}(_0xc932,0x18f));var _0x2c93=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xc932[_0x1afabf];return _0x497ff1;};'use strict';var client=require(_0x2c93('0x0'));exports['create']=function(_0x56d9ef){return client[_0x2c93('0x1')](_0x2c93('0x2'),{'body':_0x56d9ef,'log':'CreateOpenchannelQueueReport'});};exports[_0x2c93('0x3')]=function(_0x5743b1,_0x1687b1){return client[_0x2c93('0x1')](_0x2c93('0x4'),{'body':_0x1687b1,'options':{'where':{'uniqueid':_0x5743b1},'order':[['id',_0x2c93('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e9e0b81..48467f6 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 _0x6bac=['addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x484ac0,_0x4179b5){var _0x2a9328=function(_0x4f3577){while(--_0x4f3577){_0x484ac0['push'](_0x484ac0['shift']());}};_0x2a9328(++_0x4179b5);}(_0x6bac,0xa5));var _0xc6ba=function(_0x32182d,_0x44d3be){_0x32182d=_0x32182d-0x0;var _0xbee51b=_0x6bac[_0x32182d];return _0xbee51b;};'use strict';var client=require(_0xc6ba('0x0'));exports['update']=function(_0x36ce25,_0x24d0f7){return client[_0xc6ba('0x1')](_0xc6ba('0x2'),{'body':_0x24d0f7,'options':{'where':{'id':_0x36ce25}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x487ef1,_0x378f3d){return client[_0xc6ba('0x1')]('AddTagsToSmsInteraction',{'body':_0x378f3d,'options':{'where':{'id':_0x487ef1}},'log':_0xc6ba('0x3')});}; \ No newline at end of file +var _0xb91a=['addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb91a,0xf4));var _0xab91=function(_0x356f2f,_0x25a05c){_0x356f2f=_0x356f2f-0x0;var _0x220512=_0xb91a[_0x356f2f];return _0x220512;};'use strict';var client=require(_0xab91('0x0'));exports[_0xab91('0x1')]=function(_0x12e73e,_0x5dcf46){return client['Request'](_0xab91('0x2'),{'body':_0x5dcf46,'options':{'where':{'id':_0x12e73e}},'log':_0xab91('0x3')});};exports[_0xab91('0x4')]=function(_0x439eb2,_0x1afca9){return client[_0xab91('0x5')](_0xab91('0x6'),{'body':_0x1afca9,'options':{'where':{'id':_0x439eb2}},'log':_0xab91('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8be0dbd..f101f1e 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 _0xc5b2=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x33acd0,_0x24b73e){var _0x553901=function(_0x318a52){while(--_0x318a52){_0x33acd0['push'](_0x33acd0['shift']());}};_0x553901(++_0x24b73e);}(_0xc5b2,0x189));var _0x2c5b=function(_0x2721a4,_0x29ea7e){_0x2721a4=_0x2721a4-0x0;var _0x29e5c9=_0xc5b2[_0x2721a4];return _0x29e5c9;};'use strict';var client=require(_0x2c5b('0x0'));exports[_0x2c5b('0x1')]=function(_0x28605a){return client[_0x2c5b('0x2')](_0x2c5b('0x3'),{'body':_0x28605a,'log':_0x2c5b('0x4')});}; \ No newline at end of file +var _0x0127=['../client','create','Request'];(function(_0x309684,_0x2c9d1b){var _0x2c3c07=function(_0x40adb5){while(--_0x40adb5){_0x309684['push'](_0x309684['shift']());}};_0x2c3c07(++_0x2c9d1b);}(_0x0127,0x9f));var _0x7012=function(_0x1e0f66,_0x49925a){_0x1e0f66=_0x1e0f66-0x0;var _0x3e6b66=_0x0127[_0x1e0f66];return _0x3e6b66;};'use strict';var client=require(_0x7012('0x0'));exports[_0x7012('0x1')]=function(_0x3d56ac){return client[_0x7012('0x2')]('CreateSmsMessage',{'body':_0x3d56ac,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7102392..4a7490c 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x3c27b1,_0xb47704){var _0x47e0fd=function(_0x1167a0){while(--_0x1167a0){_0x3c27b1['push'](_0x3c27b1['shift']());}};_0x47e0fd(++_0xb47704);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xcb91[_0x4409e7];return _0x24c751;};'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 +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0xf0c84a,_0xa726ab){var _0x4f8c73=function(_0x4872e7){while(--_0x4872e7){_0xf0c84a['push'](_0xf0c84a['shift']());}};_0x4f8c73(++_0xa726ab);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xcb91[_0x576266];return _0x18234f;};'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 2fdb2b6..f5f862c 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(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0x70e0,0x17b));var _0x070e=function(_0x166b22,_0xdc7f81){_0x166b22=_0x166b22-0x0;var _0x3d1c53=_0x70e0[_0x166b22];return _0x3d1c53;};'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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x3e44c9,_0xddad3e){var _0x42a9ec=function(_0x26dba4){while(--_0x26dba4){_0x3e44c9['push'](_0x3e44c9['shift']());}};_0x42a9ec(++_0xddad3e);}(_0x3e74,0x175));var _0x43e7=function(_0x5df1ad,_0x6fd6be){_0x5df1ad=_0x5df1ad-0x0;var _0x46b545=_0x3e74[_0x5df1ad];return _0x46b545;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index d0db094..1c95c32 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(_0x222255,_0x2ad952){var _0x2ff33f=function(_0x1b4ac5){while(--_0x1b4ac5){_0x222255['push'](_0x222255['shift']());}};_0x2ff33f(++_0x2ad952);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x5dbc8d,_0x10d22f){var _0x2bc6c0=function(_0x176084){while(--_0x176084){_0x5dbc8d['push'](_0x5dbc8d['shift']());}};_0x2bc6c0(++_0x10d22f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 3a2cb5c..a1b16f8 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 _0x5a5a=['update','Request','UpdateWhatsappInteraction','addTags','addTagsToWhatsappInteraction'];(function(_0x5c5ad9,_0x42eca7){var _0x4b4b58=function(_0x2c0f93){while(--_0x2c0f93){_0x5c5ad9['push'](_0x5c5ad9['shift']());}};_0x4b4b58(++_0x42eca7);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x4c463a,_0x4411bb){_0x4c463a=_0x4c463a-0x0;var _0x54f816=_0x5a5a[_0x4c463a];return _0x54f816;};'use strict';var client=require('../client');exports[_0xa5a5('0x0')]=function(_0x2be398,_0x171a5f){return client[_0xa5a5('0x1')](_0xa5a5('0x2'),{'body':_0x171a5f,'options':{'where':{'id':_0x2be398}},'log':'updateWhatsappInteraction'});};exports[_0xa5a5('0x3')]=function(_0x3307f1,_0x1fd3f0){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x1fd3f0,'options':{'where':{'id':_0x3307f1}},'log':_0xa5a5('0x4')});}; \ No newline at end of file +var _0x8585=['../client','update','Request','UpdateWhatsappInteraction'];(function(_0x791859,_0x3aab0b){var _0x250198=function(_0x3d7372){while(--_0x3d7372){_0x791859['push'](_0x791859['shift']());}};_0x250198(++_0x3aab0b);}(_0x8585,0x64));var _0x5858=function(_0x19d74c,_0x1a1a32){_0x19d74c=_0x19d74c-0x0;var _0x1f33d1=_0x8585[_0x19d74c];return _0x1f33d1;};'use strict';var client=require(_0x5858('0x0'));exports[_0x5858('0x1')]=function(_0x2c1bbd,_0x582708){return client[_0x5858('0x2')](_0x5858('0x3'),{'body':_0x582708,'options':{'where':{'id':_0x2c1bbd}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x5c548b,_0x307ed3){return client[_0x5858('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x307ed3,'options':{'where':{'id':_0x5c548b}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3669a27..f19e019 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 _0x29fe=['createWhatsappMessage','../client','create','Request'];(function(_0x1ed7cd,_0x5171e7){var _0x52df0c=function(_0x20c55f){while(--_0x20c55f){_0x1ed7cd['push'](_0x1ed7cd['shift']());}};_0x52df0c(++_0x5171e7);}(_0x29fe,0x149));var _0xe29f=function(_0x25bd27,_0x4cc0ba){_0x25bd27=_0x25bd27-0x0;var _0x2e3683=_0x29fe[_0x25bd27];return _0x2e3683;};'use strict';var client=require(_0xe29f('0x0'));exports[_0xe29f('0x1')]=function(_0xc7bfe){return client[_0xe29f('0x2')]('CreateWhatsappMessage',{'body':_0xc7bfe,'log':_0xe29f('0x3')});}; \ No newline at end of file +var _0x9fd6=['create','Request','createWhatsappMessage'];(function(_0x34fa62,_0x192696){var _0x422205=function(_0x5a9d7a){while(--_0x5a9d7a){_0x34fa62['push'](_0x34fa62['shift']());}};_0x422205(++_0x192696);}(_0x9fd6,0xff));var _0x69fd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9fd6[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0x69fd('0x0')]=function(_0x1563b4){return client[_0x69fd('0x1')]('CreateWhatsappMessage',{'body':_0x1563b4,'log':_0x69fd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index cf2ba46..4366852 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 _0x65a9=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','name','timeout','strategy'];(function(_0x4d4ec3,_0x15218b){var _0x2576ff=function(_0x54a863){while(--_0x54a863){_0x4d4ec3['push'](_0x4d4ec3['shift']());}};_0x2576ff(++_0x15218b);}(_0x65a9,0x111));var _0x965a=function(_0x14caa7,_0x399362){_0x14caa7=_0x14caa7-0x0;var _0x443883=_0x65a9[_0x14caa7];return _0x443883;};'use strict';var client=require(_0x965a('0x0'));exports[_0x965a('0x1')]=function(){return function(){return client[_0x965a('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x965a('0x3'),_0x965a('0x4'),_0x965a('0x5')],'include':[{'model':'User','as':_0x965a('0x6'),'attributes':['id',_0x965a('0x3'),_0x965a('0x7'),_0x965a('0x8')]}]},'log':_0x965a('0x1')});};}; \ No newline at end of file +var _0x5a44=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','getWhatsappQueues','Request'];(function(_0x442bc7,_0x3af033){var _0x407566=function(_0x4db91a){while(--_0x4db91a){_0x442bc7['push'](_0x442bc7['shift']());}};_0x407566(++_0x3af033);}(_0x5a44,0x13a));var _0x45a4=function(_0x4cbe23,_0x53c1aa){_0x4cbe23=_0x4cbe23-0x0;var _0x2045d=_0x5a44[_0x4cbe23];return _0x2045d;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x45a4('0x0')](_0x45a4('0x1'),{'options':{'raw':![],'attributes':['id',_0x45a4('0x2'),_0x45a4('0x3'),_0x45a4('0x4')],'include':[{'model':_0x45a4('0x5'),'as':_0x45a4('0x6'),'attributes':['id',_0x45a4('0x2'),_0x45a4('0x7'),'whatsappPause']}]},'log':_0x45a4('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 88dbe97..de8b558 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 _0x7b01=['UpdateWhatsappQueueReport','create','Request','CreateWhatsappQueueReport'];(function(_0x1bae49,_0x5c8915){var _0x1caa02=function(_0x2a728c){while(--_0x2a728c){_0x1bae49['push'](_0x1bae49['shift']());}};_0x1caa02(++_0x5c8915);}(_0x7b01,0x13d));var _0x17b0=function(_0x3347ad,_0x45986d){_0x3347ad=_0x3347ad-0x0;var _0x2d9796=_0x7b01[_0x3347ad];return _0x2d9796;};'use strict';var client=require('../client');exports[_0x17b0('0x0')]=function(_0xb67b1b){return client[_0x17b0('0x1')](_0x17b0('0x2'),{'body':_0xb67b1b,'log':_0x17b0('0x2')});};exports['update']=function(_0x4584f4,_0x495036){return client[_0x17b0('0x1')]('UpdateWhatsappQueueReport',{'body':_0x495036,'options':{'where':{'uniqueid':_0x4584f4},'order':[['id','DESC']],'limit':0x1},'log':_0x17b0('0x3')});}; \ No newline at end of file +var _0x4985=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x8f3442,_0x47668a){var _0x572539=function(_0x38d46d){while(--_0x38d46d){_0x8f3442['push'](_0x8f3442['shift']());}};_0x572539(++_0x47668a);}(_0x4985,0xba));var _0x5498=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x4985[_0x47e7cb];return _0x2a8874;};'use strict';var client=require(_0x5498('0x0'));exports[_0x5498('0x1')]=function(_0x3d2a45){return client[_0x5498('0x2')](_0x5498('0x3'),{'body':_0x3d2a45,'log':_0x5498('0x3')});};exports[_0x5498('0x4')]=function(_0x50d2a8,_0x3745e8){return client['Request'](_0x5498('0x5'),{'body':_0x3745e8,'options':{'where':{'uniqueid':_0x50d2a8},'order':[['id',_0x5498('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 924bf79..deebe4f 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 _0x237f=['agents','timeout','createQueue','atimeout','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','join','stop','find'];(function(_0x5b1287,_0x1e35d5){var _0x16f876=function(_0x4c5983){while(--_0x4c5983){_0x5b1287['push'](_0x5b1287['shift']());}};_0x16f876(++_0x1e35d5);}(_0x237f,0x80));var _0xf237=function(_0x5e43f4,_0x47ea74){_0x5e43f4=_0x5e43f4-0x0;var _0x3bcd34=_0x237f[_0x5e43f4];return _0x3bcd34;};'use strict';var schema=require(_0xf237('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0xf237('0x1'));var logger=require('../../../../config/logger')(_0xf237('0x2'));var strategy=require(_0xf237('0x3'));var queue=schema({'name':{'type':_0xf237('0x4'),'required':!![],'message':_0xf237('0x5')},'timeout':{'type':_0xf237('0x6'),'message':_0xf237('0x7')}});function writeLog(_0x398edf,_0x459aa7,_0x1e49f8){return logger[_0xf237('0x8')](util[_0xf237('0x9')](_0xf237('0xa'),_0x398edf,_0x459aa7[_0xf237('0xb')],_0x1e49f8));}function handleFindAgent(_0x2949d0){return function(_0x4d45e9){return _0x4d45e9[_0xf237('0xb')][_0xf237('0xc')]()===_0x2949d0['toLowerCase']();};}exports[_0xf237('0xd')]=function(_0x2b1769,_0x4942e6,_0x1a1355,_0x5c8e54){return function(_0x4e0e5a){try{var _0x2343bc={'name':_0x4942e6[0x0],'timeout':_0x4942e6[0x1]};var _0x31a644=queue[_0xf237('0x0')](_0x2343bc,{'typecast':!![]});if(_0x31a644[_0xf237('0xe')]){logger['error'](_0xf237('0xf'),_0x2b1769,_[_0xf237('0x10')](_0x31a644,'message')[_0xf237('0x11')](',\x20'));_0x4e0e5a[_0xf237('0x12')]();}else{var _0x59532d=_[_0xf237('0x13')](_0x1a1355[_0xf237('0x14')],handleFindAgent(_0x2343bc['name']));if(_0x59532d){var _0x49b9ea=(_0x2343bc[_0xf237('0x15')]||0xa)*0x3e8;var _0x11f12e,_0x292447;var _0x3b833b=seqqueue[_0xf237('0x16')](_0x49b9ea);_0x3b833b['id']=_0x2b1769;_0x3b833b[_0xf237('0x17')]=_0x49b9ea;_0x3b833b['channel']=_0x5c8e54['channel'];writeLog(_0x2b1769,_0x59532d,util[_0xf237('0x9')](_0xf237('0x18'),_0x49b9ea));_0x1a1355[_0xf237('0x19')][_0x2b1769]['on'](_0xf237('0x1a'),function(){logger[_0xf237('0x8')](_0xf237('0x1b'),_0x2b1769);clearTimeout(_0x292447);_0x292447=undefined;_0x3b833b[_0xf237('0x1c')]();if(_0x1a1355['rules'][_0x2b1769]){delete _0x1a1355[_0xf237('0x19')][_0x2b1769];}_0x4e0e5a['stop']();});_0x1a1355[_0xf237('0x19')][_0x2b1769]['on'](_0xf237('0x1d'),function(){if(_0x1a1355['rules'][_0x2b1769]){delete _0x1a1355['rules'][_0x2b1769];}});_0x292447=setTimeout(function(){logger[_0xf237('0x8')](_0xf237('0x1e'),_0x2b1769);clearTimeout(_0x292447);_0x3b833b['close']();_0x4e0e5a['next']();},_0x49b9ea);strategy[_0xf237('0x1f')](_0x3b833b,_0x59532d,_0x1a1355,_0x5c8e54);}else{logger[_0xf237('0x20')](_0xf237('0x21'),_0x2b1769,_0x2343bc['name']);_0x4e0e5a[_0xf237('0x12')]();}}}catch(_0x450870){console[_0xf237('0x22')](_0x450870);logger['error'](_0xf237('0x23'),_0x2b1769,_0x450870[_0xf237('0x24')]);_0x4e0e5a[_0xf237('0x12')]();}};}; \ No newline at end of file +var _0x9527=['agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','find'];(function(_0xbf7335,_0x5616db){var _0x20a95a=function(_0x28b863){while(--_0x28b863){_0xbf7335['push'](_0xbf7335['shift']());}};_0x20a95a(++_0x5616db);}(_0x9527,0xa8));var _0x7952=function(_0x34c7fa,_0x273a07){_0x34c7fa=_0x34c7fa-0x0;var _0x290287=_0x9527[_0x34c7fa];return _0x290287;};'use strict';var schema=require('validate');var _=require(_0x7952('0x0'));var util=require(_0x7952('0x1'));var seqqueue=require(_0x7952('0x2'));var logger=require(_0x7952('0x3'))(_0x7952('0x4'));var strategy=require(_0x7952('0x5'));var queue=schema({'name':{'type':_0x7952('0x6'),'required':!![],'message':_0x7952('0x7')},'timeout':{'type':_0x7952('0x8'),'message':_0x7952('0x9')}});function writeLog(_0x1d2182,_0x55ae05,_0x4d31d3){return logger[_0x7952('0xa')](util[_0x7952('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1d2182,_0x55ae05[_0x7952('0xc')],_0x4d31d3));}function handleFindAgent(_0xf27811){return function(_0x4fe6d9){return _0x4fe6d9['name'][_0x7952('0xd')]()===_0xf27811[_0x7952('0xd')]();};}exports[_0x7952('0xe')]=function(_0x350c22,_0x355966,_0x483a53,_0x300f5a){return function(_0x5c0e0f){try{var _0x40c36d={'name':_0x355966[0x0],'timeout':_0x355966[0x1]};var _0x5a7bb0=queue['validate'](_0x40c36d,{'typecast':!![]});if(_0x5a7bb0[_0x7952('0xf')]){logger[_0x7952('0x10')](_0x7952('0x11'),_0x350c22,_[_0x7952('0x12')](_0x5a7bb0,'message')[_0x7952('0x13')](',\x20'));_0x5c0e0f[_0x7952('0x14')]();}else{var _0x220bc7=_[_0x7952('0x15')](_0x483a53[_0x7952('0x16')],handleFindAgent(_0x40c36d[_0x7952('0xc')]));if(_0x220bc7){var _0x356739=(_0x40c36d[_0x7952('0x17')]||0xa)*0x3e8;var _0x4fc67b,_0x561080;var _0x4daab5=seqqueue[_0x7952('0x18')](_0x356739);_0x4daab5['id']=_0x350c22;_0x4daab5[_0x7952('0x19')]=_0x356739;_0x4daab5[_0x7952('0x1a')]=_0x300f5a[_0x7952('0x1a')];writeLog(_0x350c22,_0x220bc7,util[_0x7952('0xb')](_0x7952('0x1b'),_0x356739));_0x483a53[_0x7952('0x1c')][_0x350c22]['on'](_0x7952('0x1d'),function(){logger[_0x7952('0xa')](_0x7952('0x1e'),_0x350c22);clearTimeout(_0x561080);_0x561080=undefined;_0x4daab5[_0x7952('0x1f')]();if(_0x483a53[_0x7952('0x1c')][_0x350c22]){delete _0x483a53['rules'][_0x350c22];}_0x5c0e0f[_0x7952('0x14')]();});_0x483a53[_0x7952('0x1c')][_0x350c22]['on'](_0x7952('0x20'),function(){if(_0x483a53[_0x7952('0x1c')][_0x350c22]){delete _0x483a53[_0x7952('0x1c')][_0x350c22];}});_0x561080=setTimeout(function(){logger[_0x7952('0xa')](_0x7952('0x21'),_0x350c22);clearTimeout(_0x561080);_0x4daab5[_0x7952('0x1f')]();_0x5c0e0f[_0x7952('0x22')]();},_0x356739);strategy[_0x7952('0x23')](_0x4daab5,_0x220bc7,_0x483a53,_0x300f5a);}else{logger[_0x7952('0x10')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x350c22,_0x40c36d['name']);_0x5c0e0f[_0x7952('0x14')]();}}}catch(_0x56d09d){console['log'](_0x56d09d);logger[_0x7952('0x10')](_0x7952('0x24'),_0x350c22,_0x56d09d[_0x7952('0x25')]);_0x5c0e0f[_0x7952('0x14')]();}};}; \ 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 760163e..67fa363 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 _0x0106=['stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','LexRuntime','message','toString','postText','next','providerName','amazonlex','Message','Failed','stop','catch','lodash','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','body','getMustacheRender','create','then','error'];(function(_0x44774d,_0x27fe98){var _0x282b23=function(_0x3b05d4){while(--_0x3b05d4){_0x44774d['push'](_0x44774d['shift']());}};_0x282b23(++_0x27fe98);}(_0x0106,0xef));var _0x6010=function(_0x53b102,_0x2ac5ec){_0x53b102=_0x53b102-0x0;var _0x36c603=_0x0106[_0x53b102];return _0x36c603;};'use strict';var _=require(_0x6010('0x0'));var moment=require('moment');var AWS=require(_0x6010('0x1'));var utils=require(_0x6010('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x6010('0x3')),'openchannelMessage':require(_0x6010('0x4')),'mailMessage':require(_0x6010('0x5')),'smsMessage':require(_0x6010('0x6')),'faxMessage':require(_0x6010('0x7')),'whatsappMessage':require(_0x6010('0x8'))};exports['consequence']=function(_0x255051,_0x4bcf93){return function(_0x2593aa){try{if(!_[_0x6010('0x9')](this[_0x6010('0xa')][_0x6010('0xb')])){logger[_0x6010('0xc')](_0x6010('0xd'),_0x255051,_0x6010('0xe'));return _0x2593aa['next']();}var _0x33de90={'ContactId':this[_0x6010('0xf')]['id'],'sentAt':moment()[_0x6010('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6010('0x11')};if(this[_0x6010('0x12')]==='sms'||this[_0x6010('0x12')]===_0x6010('0x13')){_0x33de90[_0x6010('0x14')]=this[_0x6010('0xa')]['phone'];}var _0x46be43=this['channel'];if(_0x46be43===_0x6010('0x15')){_0x33de90[_0x6010('0x16')]=this['account']['id'];}else{_0x33de90[_[_0x6010('0x17')](_0x46be43)+'AccountId']=this[_0x6010('0x18')]['id'];}_0x33de90[_[_0x6010('0x17')](_0x46be43)+_0x6010('0x19')]=this[_0x6010('0xa')]['id'];if(this[_0x6010('0xa')]['created']){var _0x4b85a1=_0x4bcf93[0x4];if(!_['isEmpty'](_0x4b85a1)){_0x33de90[_0x6010('0x1a')]=utils[_0x6010('0x1b')](_0x4b85a1,this);return rpc[_0x46be43+'Message'][_0x6010('0x1c')](_0x33de90)[_0x6010('0x1d')](function(_0x2e5f3e){logger[_0x6010('0xc')](_0x6010('0xd'),_0x255051,_0x33de90[_0x6010('0x1a')]);})['catch'](function(_0xac1a03){logger[_0x6010('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x255051,JSON[_0x6010('0x1f')](_0xac1a03));})[_0x6010('0x20')](function(){logger['info'](_0x6010('0x21'),_0x255051);_0x2593aa['stop']();});}else{logger[_0x6010('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x255051);_0x2593aa['stop']();}}else{var _0xe22ad3=this;var _0x32c186=new AWS[(_0x6010('0x22'))]({'accessKeyId':_0x4bcf93[0x0],'secretAccessKey':_0x4bcf93[0x1],'region':_0x4bcf93[0x2]});var _0x25befc={'botAlias':'$LATEST','botName':_0x4bcf93[0x3],'inputText':this[_0x6010('0x23')][_0x6010('0x1a')],'userId':this['channel']+':'+this['interaction']['id'][_0x6010('0x24')]()};_0x32c186[_0x6010('0x25')](_0x25befc,function(_0x35a202,_0x52a505){if(_0x35a202){logger[_0x6010('0x1e')](_0x6010('0xd'),_0x255051,_0x35a202[_0x6010('0x23')]);_0x2593aa[_0x6010('0x26')]();}else if(_0x52a505&&_0x52a505[_0x6010('0x23')]){_0xe22ad3[_0x6010('0x1a')]['amazonlex']=_0x52a505;_0x33de90['body']=_0x52a505['message'];_0x33de90[_0x6010('0x27')]=_0x6010('0x28');_0x33de90['providerResponse']=JSON[_0x6010('0x1f')](_0x52a505);return rpc[_0x46be43+_0x6010('0x29')][_0x6010('0x1c')](_0x33de90)[_0x6010('0x1d')](function(_0x215a7e){logger[_0x6010('0xc')]('[%s][AMAZONLEX]\x20%s',_0x255051,_0x33de90['body']);if(_0x52a505['dialogState']==_0x6010('0x2a')){_0x2593aa[_0x6010('0x26')]();}else{_0x2593aa[_0x6010('0x2b')]();}})[_0x6010('0x2c')](function(_0x4d8e41){logger[_0x6010('0x1e')](_0x6010('0xd'),_0x255051,JSON['stringify'](_0x4d8e41));_0x2593aa['next']();});}else{_0x2593aa[_0x6010('0x26')]();}});}}catch(_0x50f6cf){logger[_0x6010('0x1e')](_0x6010('0xd'),_0x255051,JSON[_0x6010('0x1f')](_0x50f6cf));_0x2593aa[_0x6010('0x2b')]();}};}; \ No newline at end of file +var _0x43fa=['stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','toString','postText','message','amazonlex','providerResponse','Message','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','[%s][AMAZONLEX]\x20%s','catch','error'];(function(_0x1e182d,_0x4f35c2){var _0x5627c6=function(_0x12b34c){while(--_0x12b34c){_0x1e182d['push'](_0x1e182d['shift']());}};_0x5627c6(++_0x4f35c2);}(_0x43fa,0x180));var _0xa43f=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x43fa[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0xa43f('0x0'));var moment=require(_0xa43f('0x1'));var AWS=require(_0xa43f('0x2'));var utils=require(_0xa43f('0x3'));var logger=require(_0xa43f('0x4'))(_0xa43f('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa43f('0x6')),'mailMessage':require(_0xa43f('0x7')),'smsMessage':require(_0xa43f('0x8')),'faxMessage':require(_0xa43f('0x9')),'whatsappMessage':require(_0xa43f('0xa'))};exports[_0xa43f('0xb')]=function(_0x27725c,_0x56eaf8){return function(_0x59214f){try{if(!_[_0xa43f('0xc')](this[_0xa43f('0xd')][_0xa43f('0xe')])){logger[_0xa43f('0xf')]('[%s][AMAZONLEX]\x20%s',_0x27725c,_0xa43f('0x10'));return _0x59214f[_0xa43f('0x11')]();}var _0x1bdda2={'ContactId':this[_0xa43f('0x12')]['id'],'sentAt':moment()[_0xa43f('0x13')](_0xa43f('0x14')),'direction':_0xa43f('0x15')};if(this['channel']===_0xa43f('0x16')||this[_0xa43f('0x17')]===_0xa43f('0x18')){_0x1bdda2[_0xa43f('0x19')]=this[_0xa43f('0xd')]['phone'];}var _0x2b1676=this[_0xa43f('0x17')];if(_0x2b1676===_0xa43f('0x1a')){_0x1bdda2[_0xa43f('0x1b')]=this[_0xa43f('0x1c')]['id'];}else{_0x1bdda2[_['upperFirst'](_0x2b1676)+_0xa43f('0x1d')]=this['account']['id'];}_0x1bdda2[_['upperFirst'](_0x2b1676)+_0xa43f('0x1e')]=this[_0xa43f('0xd')]['id'];if(this[_0xa43f('0xd')][_0xa43f('0x1f')]){var _0x27a021=_0x56eaf8[0x4];if(!_[_0xa43f('0x20')](_0x27a021)){_0x1bdda2[_0xa43f('0x21')]=utils[_0xa43f('0x22')](_0x27a021,this);return rpc[_0x2b1676+'Message'][_0xa43f('0x23')](_0x1bdda2)[_0xa43f('0x24')](function(_0xafa31d){logger[_0xa43f('0xf')](_0xa43f('0x25'),_0x27725c,_0x1bdda2[_0xa43f('0x21')]);})[_0xa43f('0x26')](function(_0x542c86){logger[_0xa43f('0x27')](_0xa43f('0x25'),_0x27725c,JSON[_0xa43f('0x28')](_0x542c86));})[_0xa43f('0x29')](function(){logger[_0xa43f('0xf')](_0xa43f('0x2a'),_0x27725c);_0x59214f[_0xa43f('0x2b')]();});}else{logger[_0xa43f('0xf')](_0xa43f('0x2c'),_0x27725c);_0x59214f[_0xa43f('0x2b')]();}}else{var _0x40799a=this;var _0x50f65f=new AWS['LexRuntime']({'accessKeyId':_0x56eaf8[0x0],'secretAccessKey':_0x56eaf8[0x1],'region':_0x56eaf8[0x2]});var _0x3cafe3={'botAlias':'$LATEST','botName':_0x56eaf8[0x3],'inputText':this['message'][_0xa43f('0x21')],'userId':this[_0xa43f('0x17')]+':'+this['interaction']['id'][_0xa43f('0x2d')]()};_0x50f65f[_0xa43f('0x2e')](_0x3cafe3,function(_0x3ff01b,_0x469f70){if(_0x3ff01b){logger[_0xa43f('0x27')]('[%s][AMAZONLEX]\x20%s',_0x27725c,_0x3ff01b['message']);_0x59214f[_0xa43f('0x11')]();}else if(_0x469f70&&_0x469f70[_0xa43f('0x2f')]){_0x40799a[_0xa43f('0x21')]['amazonlex']=_0x469f70;_0x1bdda2[_0xa43f('0x21')]=_0x469f70[_0xa43f('0x2f')];_0x1bdda2['providerName']=_0xa43f('0x30');_0x1bdda2[_0xa43f('0x31')]=JSON[_0xa43f('0x28')](_0x469f70);return rpc[_0x2b1676+_0xa43f('0x32')]['create'](_0x1bdda2)[_0xa43f('0x24')](function(_0xfb4191){logger['info']('[%s][AMAZONLEX]\x20%s',_0x27725c,_0x1bdda2[_0xa43f('0x21')]);if(_0x469f70[_0xa43f('0x33')]==_0xa43f('0x34')){_0x59214f[_0xa43f('0x11')]();}else{_0x59214f[_0xa43f('0x2b')]();}})[_0xa43f('0x26')](function(_0x15ff03){logger['error'](_0xa43f('0x25'),_0x27725c,JSON['stringify'](_0x15ff03));_0x59214f['next']();});}else{_0x59214f[_0xa43f('0x11')]();}});}}catch(_0x54c8d7){logger[_0xa43f('0x27')](_0xa43f('0x25'),_0x27725c,JSON[_0xa43f('0x28')](_0x54c8d7));_0x59214f[_0xa43f('0x2b')]();}};}; \ 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 99a0204..3917513 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 _0x4d7e=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','AccountId','upperFirst','InteractionId','Message','mail','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','update','stop','lodash','./utils'];(function(_0xb1410f,_0x12e358){var _0xe55b39=function(_0x4cc791){while(--_0x4cc791){_0xb1410f['push'](_0xb1410f['shift']());}};_0xe55b39(++_0x12e358);}(_0x4d7e,0xca));var _0xe4d7=function(_0x2e9922,_0x562555){_0x2e9922=_0x2e9922-0x0;var _0x140f8d=_0x4d7e[_0x2e9922];return _0x140f8d;};'use strict';var _=require(_0xe4d7('0x0'));var moment=require('moment');var utils=require(_0xe4d7('0x1'));var logger=require(_0xe4d7('0x2'))(_0xe4d7('0x3'));var rpc={'chatMessage':require(_0xe4d7('0x4')),'openchannelMessage':require(_0xe4d7('0x5')),'mailMessage':require(_0xe4d7('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe4d7('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xe4d7('0x8')),'openchannelInteraction':require(_0xe4d7('0x9')),'mailInteraction':require(_0xe4d7('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xe4d7('0xb'))};var mailRpc=require(_0xe4d7('0xc'));exports[_0xe4d7('0xd')]=function(_0x4c5465,_0x29f45c,_0x524c24,_0x2b3c10){return function(_0x301d2b){try{var _0x4292df=this[_0xe4d7('0xe')];if(_0x4292df==='mail'&&_0x2b3c10['body'][_0xe4d7('0xf')]){logger[_0xe4d7('0x10')](_0xe4d7('0x11'),_0x4c5465,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x301d2b[_0xe4d7('0x12')]();}if(_0x29f45c[0x0]==='1'&&(_[_0xe4d7('0x13')](this[_0xe4d7('0x14')][_0xe4d7('0x15')])||!this['interaction']['created'])){logger[_0xe4d7('0x10')](_0xe4d7('0x11'),_0x4c5465,_0xe4d7('0x16'));return _0x301d2b['next']();}if(_0x29f45c[0x0]==='2'&&this[_0xe4d7('0x14')][_0xe4d7('0x17')]){logger[_0xe4d7('0x10')](_0xe4d7('0x18'),_0x4c5465,_0xe4d7('0x19'));return _0x301d2b['next']();}var _0x5c8815={'ContactId':this[_0xe4d7('0x1a')]['id'],'sentAt':moment()[_0xe4d7('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe4d7('0x1c')};if(this[_0xe4d7('0xe')]==='mail'){_0x5c8815[_0xe4d7('0x1d')]=utils[_0xe4d7('0x1e')](_0x29f45c[0x2],this);}else{_0x5c8815['body']=utils[_0xe4d7('0x1e')](_0x29f45c[0x1],this);}if(this[_0xe4d7('0x1f')]){_0x5c8815['to']=this[_0xe4d7('0x1f')][_0xe4d7('0x20')]||'';if(this[_0xe4d7('0xe')]==='mail'&&_0x29f45c[0x1]==='1'){_0x5c8815['cc']=this[_0xe4d7('0x1f')]['cc']||'';}_0x5c8815[_0xe4d7('0x20')]=this[_0xe4d7('0x1f')]['to']||'';_0x5c8815['phone']=this[_0xe4d7('0x1f')][_0xe4d7('0x21')]||'';_0x5c8815[_0xe4d7('0x22')]=!![];if(this[_0xe4d7('0x1f')][_0xe4d7('0x23')]){_0x5c8815['subject']='';_0x5c8815[_0xe4d7('0x23')]+=_[_0xe4d7('0x24')](this[_0xe4d7('0x1f')][_0xe4d7('0x23')],_0xe4d7('0x25'))?'':_0xe4d7('0x26');_0x5c8815[_0xe4d7('0x23')]+=this[_0xe4d7('0x1f')][_0xe4d7('0x23')];}}if(this[_0xe4d7('0xe')]===_0xe4d7('0x27')){_0x5c8815['ChatWebsiteId']=this[_0xe4d7('0x28')]['id'];}else{_0x5c8815[_['upperFirst'](this[_0xe4d7('0xe')])+_0xe4d7('0x29')]=this[_0xe4d7('0x28')]['id'];}_0x5c8815[_[_0xe4d7('0x2a')](this[_0xe4d7('0xe')])+_0xe4d7('0x2b')]=this['interaction']['id'];var _0x216509=this[_0xe4d7('0x14')];if(rpc[this[_0xe4d7('0xe')]+_0xe4d7('0x2c')]){if(this[_0xe4d7('0xe')]===_0xe4d7('0x2d')){_0x5c8815[_0xe4d7('0x2e')]=this['message'][_0xe4d7('0x2f')];_0x5c8815['html']=_0xe4d7('0x30')+_[_0xe4d7('0x31')](_0x5c8815[_0xe4d7('0x1d')],'','';_0x533129[_0x7449('0x2d')]={'Auto-Submitted':_0x7449('0x2e'),'X-Auto-Response-Suppress':_0x7449('0x2f'),'Precedence':_0x7449('0x30')};return mailRpc[_0x7449('0x31')](this[_0x7449('0x25')][_0x7449('0x32')],_0x533129)[_0x7449('0x33')](function(_0x4f25ab){logger[_0x7449('0x10')](_0x7449('0x34'),_0x140b14);_0x533129[_0x7449('0x29')]=_0x4f25ab[_0x7449('0x1f')]['messageId'];return rpc[_0x26806a+_0x7449('0x28')]['create'](_0x533129);})[_0x7449('0x33')](function(_0x2135b4){logger[_0x7449('0x10')]('[%s][AUTOREPLY]\x20%s',_0x140b14,JSON[_0x7449('0x35')](_0x2135b4));})[_0x7449('0x36')](function(_0x233722){logger[_0x7449('0x37')](_0x7449('0x38'),_0x140b14,JSON[_0x7449('0x35')](_0x233722));})[_0x7449('0x39')](function(){Promise[_0x7449('0x3a')]()[_0x7449('0x33')](function(){if(_0x59a3a6[0x0]!=='2'||_0x4a9270[_0x7449('0x17')])return;return rpc[_0x26806a+_0x7449('0x3b')][_0x7449('0x3c')](_0x4a9270['id'],{'autoreplyExecuted':!![]})[_0x7449('0x33')](function(_0x3e9633){logger[_0x7449('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x140b14,JSON[_0x7449('0x35')](_0x3e9633));})[_0x7449('0x36')](function(_0x1ae5eb){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x140b14,JSON['stringify'](_0x1ae5eb));});})[_0x7449('0x33')](function(){_0x10cd59[_0x7449('0x3d')]();});});}else{return rpc[this['channel']+_0x7449('0x28')][_0x7449('0x3e')](_0x533129)[_0x7449('0x33')](function(){logger[_0x7449('0x10')](_0x7449('0x11'),_0x140b14,_0x533129['body']);})[_0x7449('0x36')](function(_0x5e91a7){logger['error']('[%s][AUTOREPLY]\x20%s',_0x140b14,JSON[_0x7449('0x35')](_0x5e91a7));})['finally'](function(){Promise[_0x7449('0x3a')]()[_0x7449('0x33')](function(){if(_0x59a3a6[0x0]!=='2'||_0x4a9270[_0x7449('0x17')])return;return rpc[_0x26806a+'Interaction'][_0x7449('0x3c')](_0x4a9270['id'],{'autoreplyExecuted':!![]})[_0x7449('0x33')](function(_0x54d480){logger[_0x7449('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x140b14,JSON['stringify'](_0x54d480));})[_0x7449('0x36')](function(_0x2ef9d0){logger['error'](_0x7449('0x3f'),_0x140b14,JSON[_0x7449('0x35')](_0x2ef9d0));});})[_0x7449('0x33')](function(){_0x10cd59[_0x7449('0x3d')]();});});}}}catch(_0x565a6b){logger[_0x7449('0x37')](_0x7449('0x11'),_0x140b14,JSON[_0x7449('0x35')](_0x565a6b));_0x10cd59[_0x7449('0x40')]();}};}; \ 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 e3e41f0..64e61b6 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 _0x1672=['moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','interaction','error','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0xdd093,_0x1f9a5e){var _0x4af712=function(_0x4c7afc){while(--_0x4c7afc){_0xdd093['push'](_0xdd093['shift']());}};_0x4af712(++_0x1f9a5e);}(_0x1672,0x126));var _0x2167=function(_0x19a11b,_0x1b7ecc){_0x19a11b=_0x19a11b-0x0;var _0x17cbe8=_0x1672[_0x19a11b];return _0x17cbe8;};'use strict';var moment=require(_0x2167('0x0'));var logger=require(_0x2167('0x1'))(_0x2167('0x2'));var rpc={'chatInteraction':require(_0x2167('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x2167('0x4')),'mailInteraction':require(_0x2167('0x5')),'faxInteraction':require(_0x2167('0x6')),'whatsappInteraction':require(_0x2167('0x7'))};exports[_0x2167('0x8')]=function(_0x3bf805,_0xe8e36b,_0x35ce38,_0x1e25e7){return function(_0xd6489b){try{logger[_0x2167('0x9')](_0x2167('0xa'),_0x3bf805,_0xe8e36b[0x0]);var _0xc044e9={'closed':0x1,'closedAt':moment()[_0x2167('0xb')](_0x2167('0xc')),'closeReason':'system','disposition':_0xe8e36b[0x0]};if(rpc[_0x1e25e7['channel']+_0x2167('0xd')]){rpc[_0x1e25e7[_0x2167('0xe')]+'Interaction']['update'](_0x1e25e7['interaction']['id'],_0xc044e9)['then'](function(_0x2e95d3){logger[_0x2167('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x3bf805,_0x1e25e7[_0x2167('0xf')]['id']);})['catch'](function(_0x15a515){logger[_0x2167('0x10')](_0x2167('0x11'),_0x3bf805,JSON[_0x2167('0x12')](_0x15a515));})[_0x2167('0x13')](function(){_0xd6489b[_0x2167('0x14')]();});}}catch(_0x3c3af5){logger[_0x2167('0x10')](_0x2167('0x11'),_0x3bf805,JSON[_0x2167('0x12')](_0x3c3af5));_0xd6489b['stop']();}};}; \ No newline at end of file +var _0x2c03=['YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','stop','[%s][CLOSE]\x20%s','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c03,0x1ef));var _0x32c0=function(_0x38e870,_0x3d2e6a){_0x38e870=_0x38e870-0x0;var _0x2dabbe=_0x2c03[_0x38e870];return _0x2dabbe;};'use strict';var moment=require('moment');var logger=require(_0x32c0('0x0'))(_0x32c0('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x32c0('0x2')),'smsInteraction':require(_0x32c0('0x3')),'mailInteraction':require(_0x32c0('0x4')),'faxInteraction':require(_0x32c0('0x5')),'whatsappInteraction':require(_0x32c0('0x6'))};exports[_0x32c0('0x7')]=function(_0x3e0863,_0x4729a6,_0x461b59,_0xf3bedf){return function(_0x49cb51){try{logger[_0x32c0('0x8')](_0x32c0('0x9'),_0x3e0863,_0x4729a6[0x0]);var _0x366629={'closed':0x1,'closedAt':moment()[_0x32c0('0xa')](_0x32c0('0xb')),'closeReason':_0x32c0('0xc'),'disposition':_0x4729a6[0x0]};if(rpc[_0xf3bedf[_0x32c0('0xd')]+_0x32c0('0xe')]){rpc[_0xf3bedf[_0x32c0('0xd')]+_0x32c0('0xe')]['update'](_0xf3bedf[_0x32c0('0xf')]['id'],_0x366629)[_0x32c0('0x10')](function(_0xb8065e){logger[_0x32c0('0x8')](_0x32c0('0x11'),_0x3e0863,_0xf3bedf['interaction']['id']);})['catch'](function(_0x47bc0d){logger[_0x32c0('0x12')]('[%s][CLOSE]\x20%s',_0x3e0863,JSON[_0x32c0('0x13')](_0x47bc0d));})['finally'](function(){_0x49cb51[_0x32c0('0x14')]();});}}catch(_0x3458d5){logger['error'](_0x32c0('0x15'),_0x3e0863,JSON[_0x32c0('0x13')](_0x3458d5));_0x49cb51[_0x32c0('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 4bf60b7..b973e09 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 _0x5e17=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','create','next','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5e17,0x17a));var _0x75e1=function(_0x1681a3,_0x212a22){_0x1681a3=_0x1681a3-0x0;var _0x468286=_0x5e17[_0x1681a3];return _0x468286;};'use strict';var _=require(_0x75e1('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x75e1('0x1'));var rpc={'chatMessage':require(_0x75e1('0x2')),'openchannelMessage':require(_0x75e1('0x3')),'mailMessage':require(_0x75e1('0x4')),'smsMessage':require(_0x75e1('0x5')),'faxMessage':require(_0x75e1('0x6')),'whatsappMessage':require(_0x75e1('0x7'))};exports[_0x75e1('0x8')]=function(_0xb1af59,_0x36e724){return function(_0x689ac3){try{if(!_[_0x75e1('0x9')](this[_0x75e1('0xa')][_0x75e1('0xb')])){logger[_0x75e1('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xb1af59,_0x75e1('0xd'));return _0x689ac3['next']();}var _0x559db4={'ContactId':this[_0x75e1('0xe')]['id'],'sentAt':moment()[_0x75e1('0xf')](_0x75e1('0x10')),'direction':_0x75e1('0x11')};if(this[_0x75e1('0x12')]===_0x75e1('0x13')||this[_0x75e1('0x12')]===_0x75e1('0x14')){_0x559db4['phone']=this[_0x75e1('0xa')][_0x75e1('0x15')];}var _0x25fa06=this['channel'];if(_0x25fa06===_0x75e1('0x16')){_0x559db4[_0x75e1('0x17')]=this[_0x75e1('0x18')]['id'];}else{_0x559db4[_[_0x75e1('0x19')](_0x25fa06)+'AccountId']=this[_0x75e1('0x18')]['id'];}_0x559db4[_[_0x75e1('0x19')](_0x25fa06)+_0x75e1('0x1a')]=this[_0x75e1('0xa')]['id'];if(this[_0x75e1('0xa')][_0x75e1('0x1b')]){var _0x2fcad5=_0x36e724[0x2];if(!_['isEmpty'](_0x2fcad5)){_0x559db4[_0x75e1('0x1c')]=utils[_0x75e1('0x1d')](_0x2fcad5,this);return rpc[_0x25fa06+_0x75e1('0x1e')]['create'](_0x559db4)[_0x75e1('0x1f')](function(_0x1168e0){logger['info'](_0x75e1('0x20'),_0xb1af59,_0x559db4[_0x75e1('0x1c')]);})[_0x75e1('0x21')](function(_0x561c4c){logger[_0x75e1('0x22')](_0x75e1('0x20'),_0xb1af59,JSON[_0x75e1('0x23')](_0x561c4c));})[_0x75e1('0x24')](function(){logger[_0x75e1('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xb1af59);_0x689ac3[_0x75e1('0x25')]();});}else{logger['info'](_0x75e1('0x26'),_0xb1af59);_0x689ac3[_0x75e1('0x25')]();}}else{var _0x2ba733=this;var _0x50cdc1=apiai(_0x36e724[0x0],{'language':_0x36e724[0x1]||'en'});return _0x50cdc1['textRequest'](this[_0x75e1('0x27')][_0x75e1('0x1c')],{'sessionId':md5(this[_0x75e1('0xa')]['id'])})[_0x75e1('0x1f')](function(_0x1f81e6){_0x2ba733[_0x75e1('0x1c')][_0x75e1('0x28')]=_0x1f81e6;_0x559db4['body']=_0x1f81e6[_0x75e1('0x29')][_0x75e1('0x2a')][_0x75e1('0x2b')];_0x559db4[_0x75e1('0x2c')]=_0x75e1('0x28');_0x559db4[_0x75e1('0x2d')]=JSON[_0x75e1('0x23')](_0x1f81e6);return rpc[_0x25fa06+_0x75e1('0x1e')][_0x75e1('0x2e')](_0x559db4)['then'](function(_0x3ecd50){logger[_0x75e1('0xc')](_0x75e1('0x20'),_0xb1af59,_0x559db4['body']);if(_0x1f81e6[_0x75e1('0x29')]['metadata']['endConversation']){_0x689ac3[_0x75e1('0x2f')]();}else{_0x689ac3[_0x75e1('0x25')]();}})[_0x75e1('0x21')](function(_0x366ae8){logger[_0x75e1('0x22')]('[%s][DIALOGFLOW]\x20%s',_0xb1af59,JSON[_0x75e1('0x23')](_0x366ae8));_0x689ac3[_0x75e1('0x2f')]();});})[_0x75e1('0x21')](function(_0x5e30f1){logger[_0x75e1('0x22')](_0x75e1('0x20'),_0xb1af59,_0x5e30f1['message']);_0x689ac3[_0x75e1('0x2f')]();});}}catch(_0xb8aed7){logger[_0x75e1('0x22')](_0x75e1('0x20'),_0xb1af59,JSON[_0x75e1('0x23')](_0xb8aed7));_0x689ac3['stop']();}};}; \ No newline at end of file +var _0x277c=['message','then','result','fulfillment','speech','providerName','dialogflow','providerResponse','stringify','create','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','ChatWebsiteId','account','upperFirst','created','isEmpty','Message','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x277c,0x153));var _0xc277=function(_0x45d18a,_0x42da1f){_0x45d18a=_0x45d18a-0x0;var _0x3b9f65=_0x277c[_0x45d18a];return _0x3b9f65;};'use strict';var _=require(_0xc277('0x0'));var moment=require('moment');var apiai=require(_0xc277('0x1'));var md5=require(_0xc277('0x2'));var utils=require(_0xc277('0x3'));var logger=require(_0xc277('0x4'))(_0xc277('0x5'));var rpc={'chatMessage':require(_0xc277('0x6')),'openchannelMessage':require(_0xc277('0x7')),'mailMessage':require(_0xc277('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc277('0x9'))};exports['consequence']=function(_0x77e168,_0x54d634){return function(_0x378158){try{if(!_[_0xc277('0xa')](this['interaction'][_0xc277('0xb')])){logger[_0xc277('0xc')](_0xc277('0xd'),_0x77e168,_0xc277('0xe'));return _0x378158[_0xc277('0xf')]();}var _0x1e4087={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xc277('0x10')),'direction':_0xc277('0x11')};if(this[_0xc277('0x12')]===_0xc277('0x13')||this['channel']===_0xc277('0x14')){_0x1e4087['phone']=this[_0xc277('0x15')][_0xc277('0x16')];}var _0x1850eb=this[_0xc277('0x12')];if(_0x1850eb==='chat'){_0x1e4087[_0xc277('0x17')]=this[_0xc277('0x18')]['id'];}else{_0x1e4087[_[_0xc277('0x19')](_0x1850eb)+'AccountId']=this['account']['id'];}_0x1e4087[_[_0xc277('0x19')](_0x1850eb)+'InteractionId']=this[_0xc277('0x15')]['id'];if(this['interaction'][_0xc277('0x1a')]){var _0x1162b9=_0x54d634[0x2];if(!_[_0xc277('0x1b')](_0x1162b9)){_0x1e4087['body']=utils['getMustacheRender'](_0x1162b9,this);return rpc[_0x1850eb+_0xc277('0x1c')]['create'](_0x1e4087)['then'](function(_0x1e1a9b){logger[_0xc277('0xc')](_0xc277('0xd'),_0x77e168,_0x1e4087[_0xc277('0x1d')]);})[_0xc277('0x1e')](function(_0x355eee){logger[_0xc277('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x77e168,JSON['stringify'](_0x355eee));})[_0xc277('0x20')](function(){logger[_0xc277('0xc')](_0xc277('0x21'),_0x77e168);_0x378158[_0xc277('0x22')]();});}else{logger[_0xc277('0xc')](_0xc277('0x23'),_0x77e168);_0x378158[_0xc277('0x22')]();}}else{var _0x42cb0b=this;var _0x1bc888=apiai(_0x54d634[0x0],{'language':_0x54d634[0x1]||'en'});return _0x1bc888[_0xc277('0x24')](this[_0xc277('0x25')]['body'],{'sessionId':md5(this[_0xc277('0x15')]['id'])})[_0xc277('0x26')](function(_0x54b2e1){_0x42cb0b[_0xc277('0x1d')]['dialogflow']=_0x54b2e1;_0x1e4087['body']=_0x54b2e1[_0xc277('0x27')][_0xc277('0x28')][_0xc277('0x29')];_0x1e4087[_0xc277('0x2a')]=_0xc277('0x2b');_0x1e4087[_0xc277('0x2c')]=JSON[_0xc277('0x2d')](_0x54b2e1);return rpc[_0x1850eb+_0xc277('0x1c')][_0xc277('0x2e')](_0x1e4087)[_0xc277('0x26')](function(_0x40d17a){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x77e168,_0x1e4087[_0xc277('0x1d')]);if(_0x54b2e1[_0xc277('0x27')]['metadata']['endConversation']){_0x378158[_0xc277('0xf')]();}else{_0x378158[_0xc277('0x22')]();}})[_0xc277('0x1e')](function(_0x21c78c){logger[_0xc277('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x77e168,JSON[_0xc277('0x2d')](_0x21c78c));_0x378158['next']();});})[_0xc277('0x1e')](function(_0x74ff17){logger[_0xc277('0x1f')](_0xc277('0xd'),_0x77e168,_0x74ff17['message']);_0x378158[_0xc277('0xf')]();});}}catch(_0x5a7bb6){logger[_0xc277('0x1f')](_0xc277('0xd'),_0x77e168,JSON[_0xc277('0x2d')](_0x5a7bb6));_0x378158[_0xc277('0x22')]();}};}; \ 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 e5298a6..cc67f4b 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 _0x4a8f=['queryText','DIALOGFLOWV2_SCORE','providerResponse','length','fulfillmentText','all','message','stack','lodash','moment','bluebird','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','create','then','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a8f,0x11c));var _0xf4a8=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0x4a8f[_0x19f9e6];return _0x45c862;};'use strict';var _=require(_0xf4a8('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0xf4a8('0x1'));var Promise=require(_0xf4a8('0x2'));var logger=require('../../../../config/logger')('routing');var utils=require(_0xf4a8('0x3'));var rpc={'chatMessage':require(_0xf4a8('0x4')),'openchannelMessage':require(_0xf4a8('0x5')),'mailMessage':require(_0xf4a8('0x6')),'smsMessage':require(_0xf4a8('0x7')),'faxMessage':require(_0xf4a8('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1c070d,_0x5a2fa2,_0x573bac,_0x4f1ad9){return new Promise(function(_0x4559c3,_0x1c008a){var _0x44d29c=_[_0xf4a8('0x9')](_0x573bac);_0x44d29c[_0xf4a8('0xa')]=_0x4f1ad9;return rpc[_0x5a2fa2+_0xf4a8('0xb')]['create'](_0x44d29c)['then'](function(){logger[_0xf4a8('0xc')](_0xf4a8('0xd'),_0x1c070d,_0x44d29c[_0xf4a8('0xa')]);_0x4559c3();})[_0xf4a8('0xe')](function(_0x4aebd9){logger[_0xf4a8('0xf')](_0xf4a8('0xd'),_0x1c070d,JSON[_0xf4a8('0x10')](_0x4aebd9));_0x1c008a(_0x4aebd9);});});}exports[_0xf4a8('0x11')]=function(_0x5d2507,_0x586af2){return function(_0x1d70ec){try{if(!_[_0xf4a8('0x12')](this[_0xf4a8('0x13')]['UserId'])){logger[_0xf4a8('0xc')](_0xf4a8('0xd'),_0x5d2507,_0xf4a8('0x14'));return _0x1d70ec[_0xf4a8('0x15')]();}var _0x4c010f={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf4a8('0x16')](_0xf4a8('0x17')),'direction':'out'};if(this[_0xf4a8('0x18')]===_0xf4a8('0x19')||this[_0xf4a8('0x18')]===_0xf4a8('0x1a')){_0x4c010f[_0xf4a8('0x1b')]=this[_0xf4a8('0x13')][_0xf4a8('0x1b')];}var _0x549315=this[_0xf4a8('0x18')];if(_0x549315===_0xf4a8('0x1c')){_0x4c010f[_0xf4a8('0x1d')]=this['account']['id'];}else{_0x4c010f[_['upperFirst'](_0x549315)+_0xf4a8('0x1e')]=this[_0xf4a8('0x1f')]['id'];}_0x4c010f[_[_0xf4a8('0x20')](_0x549315)+_0xf4a8('0x21')]=this[_0xf4a8('0x13')]['id'];if(this[_0xf4a8('0x13')][_0xf4a8('0x22')]){var _0x29a61f=_0x586af2[0x4];if(!_['isEmpty'](_0x29a61f)){_0x4c010f[_0xf4a8('0xa')]=utils['getMustacheRender'](_0x29a61f,this);return rpc[_0x549315+_0xf4a8('0xb')][_0xf4a8('0x23')](_0x4c010f)[_0xf4a8('0x24')](function(_0x381d4b){logger[_0xf4a8('0xc')](_0xf4a8('0xd'),_0x5d2507,_0x4c010f['body']);})[_0xf4a8('0xe')](function(_0x241193){logger[_0xf4a8('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x5d2507,JSON[_0xf4a8('0x10')](_0x241193));})[_0xf4a8('0x25')](function(){logger[_0xf4a8('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5d2507);_0x1d70ec[_0xf4a8('0x26')]();});}else{logger['info'](_0xf4a8('0x27'),_0x5d2507);_0x1d70ec['stop']();}}else{var _0x7d43fe=this;var _0x5bf3ff=_0x586af2[0x2][_0xf4a8('0x28')](/\\n/g,'\x0a');var _0x57e98d={'credentials':{'private_key':_0x5bf3ff,'client_email':_0x586af2[0x1]}};var _0x429a62=new dialogflow[(_0xf4a8('0x29'))](_0x57e98d);var _0x30771d=_0x429a62[_0xf4a8('0x2a')](_0x586af2[0x0],md5(_0x7d43fe[_0xf4a8('0x13')]['id']));var _0x3ef097={'session':_0x30771d,'queryInput':{'text':{'text':_0x7d43fe['message']['body'],'languageCode':_0x586af2[0x3]||'en'}}};return _0x429a62[_0xf4a8('0x2b')](_0x3ef097)[_0xf4a8('0x24')](function(_0x1c7168){if(_0x1c7168&&_0x1c7168['length']){_0x7d43fe['body'][_0xf4a8('0x2c')]=_0x1c7168;var _0x2dc32e=_0x1c7168[0x0];var _0x3c151a=_0x2dc32e[_0xf4a8('0x2d')][_0xf4a8('0x2e')]&&_0x2dc32e['queryResult'][_0xf4a8('0x2e')]['fields']?_0x2dc32e['queryResult'][_0xf4a8('0x2e')][_0xf4a8('0x2f')]['end_conversation']['boolValue']:![];_0x7d43fe[_0xf4a8('0xa')][_0xf4a8('0x30')]=_0x2dc32e['queryResult'][_0xf4a8('0x31')];_0x7d43fe[_0xf4a8('0xa')][_0xf4a8('0x32')]=_0x2dc32e[_0xf4a8('0x2d')][_0xf4a8('0x33')];_0x7d43fe[_0xf4a8('0xa')][_0xf4a8('0x34')]=_0x2dc32e[_0xf4a8('0x2d')][_0xf4a8('0x2e')]&&_0x2dc32e[_0xf4a8('0x2d')][_0xf4a8('0x2e')][_0xf4a8('0x2f')]?_0x2dc32e[_0xf4a8('0x2d')][_0xf4a8('0x2e')]['fields'][_0xf4a8('0x35')][_0xf4a8('0x36')]:![];_0x7d43fe['body'][_0xf4a8('0x37')]=_0x2dc32e[_0xf4a8('0x2d')]['intent']['name'];_0x7d43fe[_0xf4a8('0xa')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x2dc32e[_0xf4a8('0x2d')][_0xf4a8('0x38')][_0xf4a8('0x39')];_0x7d43fe[_0xf4a8('0xa')][_0xf4a8('0x3a')]=_0x2dc32e['queryResult'][_0xf4a8('0x38')][_0xf4a8('0x3b')];_0x7d43fe[_0xf4a8('0xa')][_0xf4a8('0x3c')]=_0x2dc32e['queryResult']['languageCode'];_0x7d43fe['body']['DIALOGFLOWV2_QUERYTEXT']=_0x2dc32e[_0xf4a8('0x2d')][_0xf4a8('0x3d')];_0x7d43fe['body'][_0xf4a8('0x3e')]=_0x2dc32e[_0xf4a8('0x2d')]['intentDetectionConfidence'];_0x4c010f['providerName']=_0xf4a8('0x2c');_0x4c010f[_0xf4a8('0x3f')]=JSON[_0xf4a8('0x10')](_0x1c7168);var _0x1cdc12=[];for(var _0x447c50=0x0;_0x447c50<_0x1c7168[_0xf4a8('0x40')];_0x447c50++){var _0x57ee13=_0x1c7168[_0x447c50];if(_0x57ee13&&_0x57ee13[_0xf4a8('0x2d')]&&_0x57ee13[_0xf4a8('0x2d')][_0xf4a8('0x41')]){_0x1cdc12['push'](createMessage(_0x5d2507,_0x549315,_0x4c010f,_0x57ee13[_0xf4a8('0x2d')][_0xf4a8('0x41')]));}}return Promise[_0xf4a8('0x42')](_0x1cdc12)[_0xf4a8('0x24')](function(){if(_0x3c151a){_0x1d70ec[_0xf4a8('0x15')]();}else{_0x1d70ec[_0xf4a8('0x26')]();}})['catch'](function(_0x5b6080){logger[_0xf4a8('0xf')](_0xf4a8('0xd'),_0x5d2507,JSON['stringify'](_0x5b6080));_0x1d70ec['next']();});}})['catch'](function(_0x2e15ae){logger[_0xf4a8('0xf')](_0xf4a8('0xd'),_0x5d2507,_0x2e15ae[_0xf4a8('0x43')],_0x2e15ae[_0xf4a8('0x44')]);_0x1d70ec[_0xf4a8('0x15')]();});}}catch(_0x2a6710){logger[_0xf4a8('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x5d2507,JSON['stringify'](_0x2a6710));_0x1d70ec[_0xf4a8('0x26')]();}};}; \ No newline at end of file +var _0x4a66=['action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','all','stack','lodash','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','catch','stringify','consequence','isNil','UserId','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','then','error','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION'];(function(_0x2dc54e,_0x52abe5){var _0x1f41ca=function(_0x3b2c67){while(--_0x3b2c67){_0x2dc54e['push'](_0x2dc54e['shift']());}};_0x1f41ca(++_0x52abe5);}(_0x4a66,0x1b2));var _0x64a6=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x4a66[_0x3de873];return _0x380b8c;};'use strict';var _=require(_0x64a6('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x64a6('0x1'));var moment=require('moment');var Promise=require(_0x64a6('0x2'));var logger=require(_0x64a6('0x3'))(_0x64a6('0x4'));var utils=require(_0x64a6('0x5'));var rpc={'chatMessage':require(_0x64a6('0x6')),'openchannelMessage':require(_0x64a6('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x64a6('0x8'))};function createMessage(_0x4e4440,_0x354147,_0x4ca644,_0x5be0af){return new Promise(function(_0x31ef79,_0x4bfe3d){var _0x4af714=_[_0x64a6('0x9')](_0x4ca644);_0x4af714[_0x64a6('0xa')]=_0x5be0af;return rpc[_0x354147+_0x64a6('0xb')][_0x64a6('0xc')](_0x4af714)['then'](function(){logger[_0x64a6('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x4e4440,_0x4af714['body']);_0x31ef79();})[_0x64a6('0xe')](function(_0x22b743){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x4e4440,JSON[_0x64a6('0xf')](_0x22b743));_0x4bfe3d(_0x22b743);});});}exports[_0x64a6('0x10')]=function(_0x11ac41,_0x531b63){return function(_0x462319){try{if(!_[_0x64a6('0x11')](this['interaction'][_0x64a6('0x12')])){logger[_0x64a6('0xd')](_0x64a6('0x13'),_0x11ac41,_0x64a6('0x14'));return _0x462319[_0x64a6('0x15')]();}var _0x413c2b={'ContactId':this[_0x64a6('0x16')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x64a6('0x17')};if(this['channel']==='sms'||this[_0x64a6('0x18')]===_0x64a6('0x19')){_0x413c2b[_0x64a6('0x1a')]=this[_0x64a6('0x1b')][_0x64a6('0x1a')];}var _0x280b81=this[_0x64a6('0x18')];if(_0x280b81===_0x64a6('0x1c')){_0x413c2b[_0x64a6('0x1d')]=this['account']['id'];}else{_0x413c2b[_['upperFirst'](_0x280b81)+_0x64a6('0x1e')]=this[_0x64a6('0x1f')]['id'];}_0x413c2b[_[_0x64a6('0x20')](_0x280b81)+_0x64a6('0x21')]=this[_0x64a6('0x1b')]['id'];if(this[_0x64a6('0x1b')]['created']){var _0x216314=_0x531b63[0x4];if(!_['isEmpty'](_0x216314)){_0x413c2b[_0x64a6('0xa')]=utils['getMustacheRender'](_0x216314,this);return rpc[_0x280b81+_0x64a6('0xb')]['create'](_0x413c2b)[_0x64a6('0x22')](function(_0x50bbb0){logger[_0x64a6('0xd')](_0x64a6('0x13'),_0x11ac41,_0x413c2b[_0x64a6('0xa')]);})[_0x64a6('0xe')](function(_0x16723b){logger[_0x64a6('0x23')]('[%s][DIALOGFLOWV2]\x20%s',_0x11ac41,JSON[_0x64a6('0xf')](_0x16723b));})['finally'](function(){logger[_0x64a6('0xd')](_0x64a6('0x24'),_0x11ac41);_0x462319[_0x64a6('0x25')]();});}else{logger[_0x64a6('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x11ac41);_0x462319[_0x64a6('0x25')]();}}else{var _0x29ed96=this;var _0x309b44=_0x531b63[0x2]['replace'](/\\n/g,'\x0a');var _0x707ba5={'credentials':{'private_key':_0x309b44,'client_email':_0x531b63[0x1]}};var _0x1b9997=new dialogflow['SessionsClient'](_0x707ba5);var _0x3cb348=_0x1b9997[_0x64a6('0x26')](_0x531b63[0x0],md5(_0x29ed96[_0x64a6('0x1b')]['id']));var _0x552a50={'session':_0x3cb348,'queryInput':{'text':{'text':_0x29ed96[_0x64a6('0x27')]['body'],'languageCode':_0x531b63[0x3]||'en'}}};return _0x1b9997[_0x64a6('0x28')](_0x552a50)[_0x64a6('0x22')](function(_0x51af27){if(_0x51af27&&_0x51af27[_0x64a6('0x29')]){_0x29ed96[_0x64a6('0xa')][_0x64a6('0x2a')]=_0x51af27;var _0x3a3393=_0x51af27[0x0];var _0x186e10=_0x3a3393[_0x64a6('0x2b')][_0x64a6('0x2c')]&&_0x3a3393[_0x64a6('0x2b')]['diagnosticInfo'][_0x64a6('0x2d')]?_0x3a3393[_0x64a6('0x2b')]['diagnosticInfo'][_0x64a6('0x2d')][_0x64a6('0x2e')][_0x64a6('0x2f')]:![];_0x29ed96['body'][_0x64a6('0x30')]=_0x3a3393['queryResult'][_0x64a6('0x31')];_0x29ed96[_0x64a6('0xa')][_0x64a6('0x32')]=_0x3a3393[_0x64a6('0x2b')][_0x64a6('0x33')];_0x29ed96[_0x64a6('0xa')][_0x64a6('0x34')]=_0x3a3393['queryResult'][_0x64a6('0x2c')]&&_0x3a3393['queryResult'][_0x64a6('0x2c')]['fields']?_0x3a3393[_0x64a6('0x2b')]['diagnosticInfo'][_0x64a6('0x2d')][_0x64a6('0x2e')][_0x64a6('0x2f')]:![];_0x29ed96[_0x64a6('0xa')]['DIALOGFLOWV2_INTENTNAME']=_0x3a3393[_0x64a6('0x2b')][_0x64a6('0x35')][_0x64a6('0x36')];_0x29ed96[_0x64a6('0xa')][_0x64a6('0x37')]=_0x3a3393[_0x64a6('0x2b')]['intent'][_0x64a6('0x38')];_0x29ed96[_0x64a6('0xa')][_0x64a6('0x39')]=_0x3a3393['queryResult'][_0x64a6('0x35')][_0x64a6('0x3a')];_0x29ed96[_0x64a6('0xa')][_0x64a6('0x3b')]=_0x3a3393[_0x64a6('0x2b')][_0x64a6('0x3c')];_0x29ed96[_0x64a6('0xa')][_0x64a6('0x3d')]=_0x3a3393[_0x64a6('0x2b')][_0x64a6('0x3e')];_0x29ed96[_0x64a6('0xa')][_0x64a6('0x3f')]=_0x3a3393[_0x64a6('0x2b')]['intentDetectionConfidence'];_0x413c2b[_0x64a6('0x40')]=_0x64a6('0x2a');_0x413c2b[_0x64a6('0x41')]=JSON[_0x64a6('0xf')](_0x51af27);var _0x463217=[];for(var _0x53c728=0x0;_0x53c728<_0x51af27['length'];_0x53c728++){var _0x103d72=_0x51af27[_0x53c728];if(_0x103d72&&_0x103d72[_0x64a6('0x2b')]&&_0x103d72['queryResult'][_0x64a6('0x42')]){_0x463217['push'](createMessage(_0x11ac41,_0x280b81,_0x413c2b,_0x103d72[_0x64a6('0x2b')][_0x64a6('0x42')]));}}return Promise[_0x64a6('0x43')](_0x463217)[_0x64a6('0x22')](function(){if(_0x186e10){_0x462319[_0x64a6('0x15')]();}else{_0x462319[_0x64a6('0x25')]();}})[_0x64a6('0xe')](function(_0x1169bf){logger[_0x64a6('0x23')](_0x64a6('0x13'),_0x11ac41,JSON[_0x64a6('0xf')](_0x1169bf));_0x462319[_0x64a6('0x15')]();});}})[_0x64a6('0xe')](function(_0x1c0f28){logger[_0x64a6('0x23')](_0x64a6('0x13'),_0x11ac41,_0x1c0f28[_0x64a6('0x27')],_0x1c0f28[_0x64a6('0x44')]);_0x462319[_0x64a6('0x15')]();});}}catch(_0x4673b8){logger['error'](_0x64a6('0x13'),_0x11ac41,JSON['stringify'](_0x4673b8));_0x462319[_0x64a6('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 c8fb80b..cdf73a7 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 _0x5921=['lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate'];(function(_0x26e387,_0x1b5761){var _0x3630f6=function(_0xbe3c1e){while(--_0xbe3c1e){_0x26e387['push'](_0x26e387['shift']());}};_0x3630f6(++_0x1b5761);}(_0x5921,0x73));var _0x1592=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5921[_0x6cf19c];return _0xce14f3;};'use strict';var schema=require(_0x1592('0x0'));var _=require(_0x1592('0x1'));var htmlToText=require(_0x1592('0x2'));var utils=require(_0x1592('0x3'));var logger=require(_0x1592('0x4'))(_0x1592('0x5'));var gotoif=schema({'condition':{'type':_0x1592('0x6'),'required':!![],'message':_0x1592('0x7')},'priorityTrue':{'type':'number','message':_0x1592('0x8')},'priorityFalse':{'type':_0x1592('0x9'),'message':_0x1592('0xa')}});exports['consequence']=function(_0x248f19,_0x163974){return function(_0x545c51){try{var _0x1f0638={'condition':htmlToText[_0x1592('0xb')](utils[_0x1592('0xc')](_0x163974[0x0],this),{'wordwrap':![]})[_0x1592('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x163974[0x1],'priorityFalse':_0x163974[0x2]};var _0x405437=gotoif['validate'](_0x1f0638,{'typecast':!![]});if(_0x405437[_0x1592('0xe')]){logger[_0x1592('0xf')]('[%s][GOTOIF]\x20%s',_0x248f19,_['map'](_0x405437,_0x1592('0x10'))[_0x1592('0x11')](',\x20'));_0x545c51[_0x1592('0x12')]();}else{try{var _0x58ff06=eval('('+_0x1f0638['condition']+')');var _0x1e8159=_0x58ff06?_0x1f0638[_0x1592('0x13')]:_0x1f0638[_0x1592('0x14')];logger[_0x1592('0x15')](_0x1592('0x16'),_0x248f19,_0x1f0638[_0x1592('0x17')],_0x58ff06,_0x1e8159||_0x1592('0x18'));if(_0x1e8159){var _0x26b227=_[_0x1592('0x19')](_0x545c51['rules'](),{'p':_0x1e8159});if(_0x26b227>=0x0){logger['info'](_0x1592('0x1a'),_0x248f19,_0x1e8159||_0x1592('0x18'),_0x26b227);_0x545c51[_0x1592('0x18')](_0x26b227);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x248f19,_0x1e8159||_0x1592('0x18'));_0x545c51['stop']();}}else{_0x545c51[_0x1592('0x18')]();}}catch(_0x137aad){logger[_0x1592('0xf')](_0x1592('0x1b'),_0x248f19,_0x137aad[_0x1592('0x10')]);_0x545c51['stop']();}}}catch(_0x4a2c2a){logger[_0x1592('0xf')](_0x1592('0x1c'),_0x248f19,JSON['stringify'](_0x4a2c2a));_0x545c51[_0x1592('0x12')]();}};}; \ No newline at end of file +var _0xb963=['[%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','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','info','condition','next','findIndex','rules'];(function(_0x1286e2,_0x22d0a1){var _0x3a7f9a=function(_0x4c8fa0){while(--_0x4c8fa0){_0x1286e2['push'](_0x1286e2['shift']());}};_0x3a7f9a(++_0x22d0a1);}(_0xb963,0x1c7));var _0x3b96=function(_0x5db911,_0x360d9c){_0x5db911=_0x5db911-0x0;var _0x279651=_0xb963[_0x5db911];return _0x279651;};'use strict';var schema=require(_0x3b96('0x0'));var _=require(_0x3b96('0x1'));var htmlToText=require(_0x3b96('0x2'));var utils=require(_0x3b96('0x3'));var logger=require('../../../../config/logger')(_0x3b96('0x4'));var gotoif=schema({'condition':{'type':_0x3b96('0x5'),'required':!![],'message':_0x3b96('0x6')},'priorityTrue':{'type':_0x3b96('0x7'),'message':_0x3b96('0x8')},'priorityFalse':{'type':_0x3b96('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x3b96('0x9')]=function(_0x2556d9,_0x513a0b){return function(_0x559d1f){try{var _0x80d9ce={'condition':htmlToText[_0x3b96('0xa')](utils['getMustacheRender'](_0x513a0b[0x0],this),{'wordwrap':![]})[_0x3b96('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x513a0b[0x1],'priorityFalse':_0x513a0b[0x2]};var _0x483ef8=gotoif[_0x3b96('0x0')](_0x80d9ce,{'typecast':!![]});if(_0x483ef8[_0x3b96('0xc')]){logger['error'](_0x3b96('0xd'),_0x2556d9,_[_0x3b96('0xe')](_0x483ef8,_0x3b96('0xf'))[_0x3b96('0x10')](',\x20'));_0x559d1f[_0x3b96('0x11')]();}else{try{var _0x463e25=eval('('+_0x80d9ce['condition']+')');var _0x3b7e22=_0x463e25?_0x80d9ce[_0x3b96('0x12')]:_0x80d9ce[_0x3b96('0x13')];logger[_0x3b96('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2556d9,_0x80d9ce[_0x3b96('0x15')],_0x463e25,_0x3b7e22||_0x3b96('0x16'));if(_0x3b7e22){var _0x4a5e72=_[_0x3b96('0x17')](_0x559d1f[_0x3b96('0x18')](),{'p':_0x3b7e22});if(_0x4a5e72>=0x0){logger[_0x3b96('0x14')](_0x3b96('0x19'),_0x2556d9,_0x3b7e22||_0x3b96('0x16'),_0x4a5e72);_0x559d1f[_0x3b96('0x16')](_0x4a5e72);}else{logger[_0x3b96('0x14')](_0x3b96('0x1a'),_0x2556d9,_0x3b7e22||_0x3b96('0x16'));_0x559d1f[_0x3b96('0x11')]();}}else{_0x559d1f[_0x3b96('0x16')]();}}catch(_0xf0e4c5){logger[_0x3b96('0x1b')](_0x3b96('0x1c'),_0x2556d9,_0xf0e4c5[_0x3b96('0xf')]);_0x559d1f[_0x3b96('0x11')]();}}}catch(_0x3f0895){logger[_0x3b96('0x1b')](_0x3b96('0xd'),_0x2556d9,JSON[_0x3b96('0x1d')](_0x3f0895));_0x559d1f[_0x3b96('0x11')]();}};}; \ 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 db458cc..e98796e 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 _0xcfce=['error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcfce,0x125));var _0xecfc=function(_0x45f6e2,_0xe72d77){_0x45f6e2=_0x45f6e2-0x0;var _0x573b09=_0xcfce[_0x45f6e2];return _0x573b09;};'use strict';var schema=require('validate');var _=require(_0xecfc('0x0'));var logger=require(_0xecfc('0x1'))(_0xecfc('0x2'));var gotop=schema({'priority':{'type':_0xecfc('0x3'),'required':!![],'message':_0xecfc('0x4')}});exports[_0xecfc('0x5')]=function(_0xa53a02,_0x54278b){return function(_0x1840ff){try{var _0x5dd56e={'priority':_0x54278b[0x0]};var _0x36b39d=gotop[_0xecfc('0x6')](_0x5dd56e,{'typecast':!![]});if(_0x36b39d['length']){logger[_0xecfc('0x7')](_0xecfc('0x8'),_0xa53a02,_[_0xecfc('0x9')](_0x36b39d,'message')[_0xecfc('0xa')](',\x20'));_0x1840ff[_0xecfc('0xb')]();}else{logger[_0xecfc('0xc')](_0xecfc('0xd'),_0xa53a02,_0x5dd56e[_0xecfc('0xe')]);if(_0x5dd56e['priority']){var _0x50c983=_[_0xecfc('0xf')](_0x1840ff[_0xecfc('0x10')](),{'p':_0x5dd56e[_0xecfc('0xe')]});if(_0x50c983>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xa53a02,_0x5dd56e[_0xecfc('0xe')]||_0xecfc('0x11'),_0x50c983);_0x1840ff['next'](_0x50c983);}else{logger[_0xecfc('0xc')](_0xecfc('0x12'),_0xa53a02,_0x5dd56e['priority']||_0xecfc('0x11'));_0x1840ff[_0xecfc('0xb')]();}}else{_0x1840ff[_0xecfc('0x11')]();}}}catch(_0x38010d){logger[_0xecfc('0x7')](_0xecfc('0x8'),_0xa53a02,JSON[_0xecfc('0x13')](_0x38010d));_0x1840ff[_0xecfc('0xb')]();}};}; \ No newline at end of file +var _0xb1f9=['map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x585f45,_0x4ca0fd){var _0x1e6439=function(_0x2eb1a6){while(--_0x2eb1a6){_0x585f45['push'](_0x585f45['shift']());}};_0x1e6439(++_0x4ca0fd);}(_0xb1f9,0xe8));var _0x9b1f=function(_0x3cd8d9,_0x3c7f1d){_0x3cd8d9=_0x3cd8d9-0x0;var _0x3bcfa2=_0xb1f9[_0x3cd8d9];return _0x3bcfa2;};'use strict';var schema=require(_0x9b1f('0x0'));var _=require(_0x9b1f('0x1'));var logger=require(_0x9b1f('0x2'))(_0x9b1f('0x3'));var gotop=schema({'priority':{'type':_0x9b1f('0x4'),'required':!![],'message':_0x9b1f('0x5')}});exports[_0x9b1f('0x6')]=function(_0x71e903,_0x26a2df){return function(_0x1be368){try{var _0x5359d6={'priority':_0x26a2df[0x0]};var _0x3fc631=gotop[_0x9b1f('0x0')](_0x5359d6,{'typecast':!![]});if(_0x3fc631[_0x9b1f('0x7')]){logger[_0x9b1f('0x8')](_0x9b1f('0x9'),_0x71e903,_[_0x9b1f('0xa')](_0x3fc631,_0x9b1f('0xb'))[_0x9b1f('0xc')](',\x20'));_0x1be368['stop']();}else{logger[_0x9b1f('0xd')](_0x9b1f('0xe'),_0x71e903,_0x5359d6[_0x9b1f('0xf')]);if(_0x5359d6['priority']){var _0x3ec80a=_['findIndex'](_0x1be368[_0x9b1f('0x10')](),{'p':_0x5359d6['priority']});if(_0x3ec80a>=0x0){logger[_0x9b1f('0xd')](_0x9b1f('0x11'),_0x71e903,_0x5359d6[_0x9b1f('0xf')]||_0x9b1f('0x12'),_0x3ec80a);_0x1be368['next'](_0x3ec80a);}else{logger[_0x9b1f('0xd')](_0x9b1f('0x13'),_0x71e903,_0x5359d6[_0x9b1f('0xf')]||_0x9b1f('0x12'));_0x1be368[_0x9b1f('0x14')]();}}else{_0x1be368['next']();}}}catch(_0x1062fd){logger['error'](_0x9b1f('0x9'),_0x71e903,JSON[_0x9b1f('0x15')](_0x1062fd));_0x1be368['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 486724f..f65b748 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 _0x1a9e=['chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x1a9e,0x122));var _0xe1a9=function(_0xa1d2b8,_0x125743){_0xa1d2b8=_0xa1d2b8-0x0;var _0xb753c4=_0x1a9e[_0xa1d2b8];return _0xb753c4;};'use strict';var _=require(_0xe1a9('0x0'));var utils=require('./utils');var logger=require(_0xe1a9('0x1'))('routing');var rpc={'chatMessage':require(_0xe1a9('0x2')),'openchannelMessage':require(_0xe1a9('0x3')),'mailMessage':require(_0xe1a9('0x4')),'smsMessage':require(_0xe1a9('0x5')),'faxMessage':require(_0xe1a9('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xe1a9('0x7')]=function(_0xb5e5a4,_0x1fbb0f){return function(_0x389ed2){try{var _0x396dc3={'body':utils[_0xe1a9('0x8')](_0x1fbb0f[0x0],this),'ContactId':this['contact']['id']};if(this[_0xe1a9('0x9')]===_0xe1a9('0xa')){_0x396dc3[_0xe1a9('0xb')]=this[_0xe1a9('0xc')]['id'];}else{_0x396dc3[_[_0xe1a9('0xd')](this[_0xe1a9('0x9')])+'AccountId']=this['account']['id'];}_0x396dc3[_['upperFirst'](this['channel'])+_0xe1a9('0xe')]=this[_0xe1a9('0xf')]['id'];if(rpc[this[_0xe1a9('0x9')]+_0xe1a9('0x10')]){return rpc[this[_0xe1a9('0x9')]+_0xe1a9('0x10')][_0xe1a9('0x11')](_0x396dc3)[_0xe1a9('0x12')](function(_0x29c33d){logger['info'](_0xe1a9('0x13'),_0xb5e5a4,_0x396dc3[_0xe1a9('0x14')]);_0x389ed2[_0xe1a9('0x15')]();})['catch'](function(_0x54cb9e){logger[_0xe1a9('0x16')]('[%s][MESSAGE]\x20%s',_0xb5e5a4,JSON['stringify'](_0x54cb9e));_0x389ed2['stop']();});}}catch(_0x164f8b){logger[_0xe1a9('0x16')](_0xe1a9('0x13'),_0xb5e5a4,JSON[_0xe1a9('0x17')](_0x164f8b));_0x389ed2[_0xe1a9('0x18')]();}};}; \ No newline at end of file +var _0x1ab2=['error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next'];(function(_0x59ae4f,_0x13d7cf){var _0x31e795=function(_0x25e22c){while(--_0x25e22c){_0x59ae4f['push'](_0x59ae4f['shift']());}};_0x31e795(++_0x13d7cf);}(_0x1ab2,0x198));var _0x21ab=function(_0x21ada8,_0x1b189f){_0x21ada8=_0x21ada8-0x0;var _0x1c909b=_0x1ab2[_0x21ada8];return _0x1c909b;};'use strict';var _=require(_0x21ab('0x0'));var utils=require(_0x21ab('0x1'));var logger=require(_0x21ab('0x2'))(_0x21ab('0x3'));var rpc={'chatMessage':require(_0x21ab('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x21ab('0x5')),'smsMessage':require(_0x21ab('0x6')),'faxMessage':require(_0x21ab('0x7')),'whatsappMessage':require(_0x21ab('0x8'))};exports['consequence']=function(_0x44873a,_0x26d8fa){return function(_0x2a6592){try{var _0x506332={'body':utils['getMustacheRender'](_0x26d8fa[0x0],this),'ContactId':this['contact']['id']};if(this[_0x21ab('0x9')]===_0x21ab('0xa')){_0x506332[_0x21ab('0xb')]=this[_0x21ab('0xc')]['id'];}else{_0x506332[_['upperFirst'](this[_0x21ab('0x9')])+_0x21ab('0xd')]=this[_0x21ab('0xc')]['id'];}_0x506332[_[_0x21ab('0xe')](this['channel'])+_0x21ab('0xf')]=this[_0x21ab('0x10')]['id'];if(rpc[this[_0x21ab('0x9')]+_0x21ab('0x11')]){return rpc[this[_0x21ab('0x9')]+_0x21ab('0x11')][_0x21ab('0x12')](_0x506332)[_0x21ab('0x13')](function(_0x574626){logger[_0x21ab('0x14')](_0x21ab('0x15'),_0x44873a,_0x506332[_0x21ab('0x16')]);_0x2a6592[_0x21ab('0x17')]();})['catch'](function(_0x3a7741){logger[_0x21ab('0x18')](_0x21ab('0x15'),_0x44873a,JSON[_0x21ab('0x19')](_0x3a7741));_0x2a6592[_0x21ab('0x1a')]();});}}catch(_0x3784a6){logger[_0x21ab('0x18')](_0x21ab('0x15'),_0x44873a,JSON['stringify'](_0x3784a6));_0x2a6592[_0x21ab('0x1a')]();}};}; \ 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 e4f06d2..bd7181e 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 _0xdcd6=['getMustacheRender','error','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0xdcd6,0xdb));var _0x6dcd=function(_0x40c656,_0x27b0fa){_0x40c656=_0x40c656-0x0;var _0x553a28=_0xdcd6[_0x40c656];return _0x553a28;};'use strict';var utils=require(_0x6dcd('0x0'));var logger=require(_0x6dcd('0x1'))(_0x6dcd('0x2'));exports[_0x6dcd('0x3')]=function(_0x426cf4,_0x37e825){return function(_0x22dce6){try{logger[_0x6dcd('0x4')](_0x6dcd('0x5'),_0x426cf4,utils[_0x6dcd('0x6')](_0x37e825[0x0],this));_0x22dce6['next']();}catch(_0x53de12){logger[_0x6dcd('0x7')](_0x6dcd('0x5'),_0x426cf4,JSON['stringify'](_0x53de12));_0x22dce6[_0x6dcd('0x8')]();}};}; \ No newline at end of file +var _0x98f4=['consequence','info','getMustacheRender','next','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x98f4,0xe7));var _0x498f=function(_0x3bac2b,_0x137306){_0x3bac2b=_0x3bac2b-0x0;var _0xbadf45=_0x98f4[_0x3bac2b];return _0xbadf45;};'use strict';var utils=require(_0x498f('0x0'));var logger=require(_0x498f('0x1'))(_0x498f('0x2'));exports[_0x498f('0x3')]=function(_0x4d78ec,_0x4dd488){return function(_0x545d0c){try{logger[_0x498f('0x4')]('[%s][NOOP]\x20%s',_0x4d78ec,utils[_0x498f('0x5')](_0x4dd488[0x0],this));_0x545d0c[_0x498f('0x6')]();}catch(_0x579950){logger['error']('[%s][NOOP]\x20%s',_0x4d78ec,JSON[_0x498f('0x7')](_0x579950));_0x545d0c[_0x498f('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 8aab6b7..5592674 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 _0xbb55=['strategy','rrmemory','beepall','stop','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','queue_id','account','queue','emit','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','message','Interaction','update','then','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END'];(function(_0x28d310,_0x119e77){var _0x17428e=function(_0x484dc1){while(--_0x484dc1){_0x28d310['push'](_0x28d310['shift']());}};_0x17428e(++_0x119e77);}(_0xbb55,0x1b8));var _0x5bb5=function(_0x247a66,_0x58b2c6){_0x247a66=_0x247a66-0x0;var _0x416d7f=_0xbb55[_0x247a66];return _0x416d7f;};'use strict';var schema=require(_0x5bb5('0x0'));var _=require(_0x5bb5('0x1'));var util=require(_0x5bb5('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x5bb5('0x3'));var Redis=require(_0x5bb5('0x4'));var config=require(_0x5bb5('0x5'));var logger=require(_0x5bb5('0x6'))(_0x5bb5('0x7'));var strategy=require(_0x5bb5('0x8'));config[_0x5bb5('0x9')]=_['defaults'](config[_0x5bb5('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bb5('0x9')]));var attributes=['id',_0x5bb5('0xa'),_0x5bb5('0xb'),_0x5bb5('0xc'),'from','joinAt'];function emit(_0x4f652b,_0x7956d3,_0x11ec4e){io['to'](_0x4f652b)[_0x5bb5('0xd')](_0x7956d3,_0x11ec4e);}function emitChannelQueueInteraction(_0x2371a9,_0x4a0b1c,_0x365d51,_0x30830f,_0x17354f,_0x265a40,_0x7fcaf4,_0x52992b){var _0x1ae94d=_['clone'](_0x365d51);_0x1ae94d['queue_id']=_0x52992b;_0x1ae94d['queue']=_0x4a0b1c;_0x1ae94d['account']=_0x30830f;_0x1ae94d['id']=_0x17354f;if(_0x265a40){attributes['push'](_[_0x5bb5('0xe')](_0x2371a9)+'InteractionId');_0x7fcaf4[util[_0x5bb5('0xf')](_0x5bb5('0x10'),_0x2371a9)][_0x17354f]=_[_0x5bb5('0x11')](_0x1ae94d,attributes);}else{delete _0x7fcaf4[util[_0x5bb5('0xf')]('%sQueuesWaitingInteractions',_0x2371a9)][_0x17354f];}emit(util[_0x5bb5('0xf')](_0x5bb5('0x12'),_0x2371a9,_0x4a0b1c),util[_0x5bb5('0xf')]('%s_queue_waiting_interaction:%s',_0x2371a9,_0x265a40?_0x5bb5('0x13'):_0x5bb5('0x14')),_[_0x5bb5('0x11')](_0x1ae94d,attributes));}var rpc={'openchannelQueueReport':require(_0x5bb5('0x15')),'mailQueueReport':require(_0x5bb5('0x16')),'chatQueueReport':require(_0x5bb5('0x17')),'smsQueueReport':require(_0x5bb5('0x18')),'faxQueueReport':require(_0x5bb5('0x19')),'whatsappQueueReport':require(_0x5bb5('0x1a')),'chatInteraction':require(_0x5bb5('0x1b')),'faxInteraction':require(_0x5bb5('0x1c')),'mailInteraction':require(_0x5bb5('0x1d')),'openchannelInteraction':require(_0x5bb5('0x1e')),'smsInteraction':require(_0x5bb5('0x1f')),'whatsappInteraction':require(_0x5bb5('0x20'))};var queue=schema({'name':{'type':_0x5bb5('0x21'),'required':!![],'message':_0x5bb5('0x22')},'timeout':{'type':_0x5bb5('0x23'),'message':_0x5bb5('0x24')}});function startRouting(_0x4e48f5,_0x452908,_0xb21d14,_0x56e65c){if(_0x4e48f5&&_0x452908&&_0xb21d14){_0x452908[_0x5bb5('0x25')]+=0x1;var _0x2e3d71={'uniqueid':_0x4e48f5,'from':_0xb21d14[_0x5bb5('0x26')]?_0xb21d14['body'][_0x5bb5('0x27')]:'','joinAt':moment()[_0x5bb5('0xf')](_0x5bb5('0x28')),'ContactId':_0xb21d14[_0x5bb5('0x29')]?_0xb21d14[_0x5bb5('0x29')]['id']:null,'ListId':_0xb21d14[_0x5bb5('0x2a')]?_0xb21d14[_0x5bb5('0x2a')]['id']:null};_0x2e3d71[_[_0x5bb5('0x2b')](_0xb21d14[_0x5bb5('0x2c')])+_0x5bb5('0x2d')]=_0x452908['id']||null;_0x2e3d71[_['upperFirst'](_0xb21d14[_0x5bb5('0x2c')])+_0x5bb5('0x2e')]=_0xb21d14[_0x5bb5('0x2f')]?_0xb21d14[_0x5bb5('0x2f')]['id']:null;_0x2e3d71[_[_0x5bb5('0x2b')](_0xb21d14['channel'])+_0x5bb5('0x30')]=_0xb21d14['message']?_0xb21d14['message']['id']:null;_0x2e3d71[_[_0x5bb5('0x2b')](_0xb21d14['channel'])+(_0xb21d14[_0x5bb5('0x2c')]!==_0x5bb5('0x31')?_0x5bb5('0x32'):_0x5bb5('0x33'))]=_0xb21d14['account']?_0xb21d14[_0x5bb5('0xb')]['id']:null;logger[_0x5bb5('0x34')](util[_0x5bb5('0xf')](_0x5bb5('0x35'),_0x4e48f5,_0x452908[_0x5bb5('0x36')]));emitChannelQueueInteraction(_0xb21d14['channel'],_0x452908['name'],_0x2e3d71,_0xb21d14['account'][_0x5bb5('0x36')],_0xb21d14['message']['id'],!![],_0x56e65c,_0x452908['id']);if(rpc[_0xb21d14['channel']+_0x5bb5('0x37')]){return rpc[_0xb21d14[_0x5bb5('0x2c')]+_0x5bb5('0x37')]['create'](_0x2e3d71)[_0x5bb5('0x38')](function(_0x2f5028){logger[_0x5bb5('0x39')](_0x5bb5('0x3a'),_0x2f5028);});}}}function stopRouting(_0x14c0f6,_0xb50c20,_0x5f334f,_0x33b0fa){if(_0x14c0f6&&_0xb50c20){_0xb50c20[_0x5bb5('0x25')]-=0x1;var _0x3859c0={'leaveAt':moment()[_0x5bb5('0xf')](_0x5bb5('0x28')),'acceptAt':moment()[_0x5bb5('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x5bb5('0x3b')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x14c0f6,_0xb50c20[_0x5bb5('0x36')]));emitChannelQueueInteraction(_0x5f334f[_0x5bb5('0x2c')],_0xb50c20[_0x5bb5('0x36')],_0x5f334f[_0x5bb5('0x26')],_0x5f334f[_0x5bb5('0xb')]['name'],_0x5f334f[_0x5bb5('0x3c')]['id'],![],_0x33b0fa,_0xb50c20['id']);return rpc[_0x5f334f['channel']+_0x5bb5('0x3d')][_0x5bb5('0x3e')](_0x5f334f[_0x5bb5('0x2f')]['id'],{'queueId':_0xb50c20['id']})[_0x5bb5('0x3f')](function(){if(rpc[_0x5f334f[_0x5bb5('0x2c')]+_0x5bb5('0x37')]){return rpc[_0x5f334f[_0x5bb5('0x2c')]+_0x5bb5('0x37')][_0x5bb5('0x3e')](_0x14c0f6,_0x3859c0)['catch'](function(_0x4c24b0){logger[_0x5bb5('0x39')](_0x5bb5('0x40'),_0x4c24b0);});}});}}function endRouting(_0xc7c5c5,_0x287451,_0x30cf55,_0x50c23e){if(_0xc7c5c5&&_0x287451){_0x287451['waiting']-=0x1;var _0x31129f={'leaveAt':moment()[_0x5bb5('0xf')](_0x5bb5('0x28')),'exitAt':moment()[_0x5bb5('0xf')](_0x5bb5('0x28')),'reason':'timeout'};logger['info'](util[_0x5bb5('0xf')](_0x5bb5('0x41'),_0xc7c5c5,_0x287451['name']));emitChannelQueueInteraction(_0x30cf55['channel'],_0x287451[_0x5bb5('0x36')],_0x30cf55[_0x5bb5('0x26')],_0x30cf55['account'][_0x5bb5('0x36')],_0x30cf55[_0x5bb5('0x3c')]['id'],![],_0x50c23e);if(rpc[_0x30cf55[_0x5bb5('0x2c')]+_0x5bb5('0x37')]){return rpc[_0x30cf55[_0x5bb5('0x2c')]+_0x5bb5('0x37')][_0x5bb5('0x3e')](_0xc7c5c5,_0x31129f)['catch'](function(_0x456685){logger[_0x5bb5('0x39')](_0x5bb5('0x40'),_0x456685);});}}}function handleFindQueue(_0x55deef){return function(_0x47d79b){return _0x47d79b[_0x5bb5('0x36')]['toLowerCase']()===_0x55deef[_0x5bb5('0x42')]();};}exports[_0x5bb5('0x43')]=function(_0x453fe1,_0x493cce,_0xba81d8,_0x4767c3){return function(_0x18c632){try{var _0x247156={'name':_0x493cce[0x0],'timeout':_0x493cce[0x1]};var _0x207f5d=queue[_0x5bb5('0x0')](_0x247156,{'typecast':!![]});if(_0x207f5d[_0x5bb5('0x44')]){logger[_0x5bb5('0x39')](_0x5bb5('0x45'),_0x453fe1,_['map'](_0x207f5d,'message')[_0x5bb5('0x46')](',\x20'));_0x18c632['stop']();}else{var _0x294524=_[_0x5bb5('0x47')](_0xba81d8[_0x4767c3['channel']+_0x5bb5('0x48')],handleFindQueue(_0x247156['name']));if(_0x294524){startRouting(_0x453fe1,_0x294524,_0x4767c3,_0xba81d8);var _0x198f46=(_0x294524['timeout']||0xa)*0x3e8;var _0x26d7d9=(_0x247156['timeout']||0x14)*0x3e8;var _0x1cc3d9;if(_0x198f46>_0x26d7d9){_0x26d7d9=_0x198f46;}var _0x78bc2=seqqueue[_0x5bb5('0x49')](_0x198f46);_0x78bc2['id']=_0x453fe1;_0x78bc2[_0x5bb5('0x4a')]=_0x198f46;_0x78bc2[_0x5bb5('0x4b')]=_0x26d7d9;_0x78bc2['channel']=_0x4767c3[_0x5bb5('0x2c')];_0xba81d8[_0x5bb5('0x4c')][_0x453fe1]['on'](_0x5bb5('0x4d'),function(){logger[_0x5bb5('0x34')](_0x5bb5('0x4e'),_0x453fe1);stopRouting(_0x453fe1,_0x294524,_0x4767c3,_0xba81d8);clearTimeout(_0x1cc3d9);_0x1cc3d9=undefined;_0x78bc2[_0x5bb5('0x4f')](!![]);if(_0xba81d8[_0x5bb5('0x4c')][_0x453fe1]){delete _0xba81d8[_0x5bb5('0x4c')][_0x453fe1];}_0x18c632['stop']();});_0xba81d8[_0x5bb5('0x4c')][_0x453fe1]['on'](_0x5bb5('0x50'),function(){if(_0xba81d8['rules'][_0x453fe1]){delete _0xba81d8[_0x5bb5('0x4c')][_0x453fe1];}});_0x1cc3d9=setTimeout(function(){logger['info'](_0x5bb5('0x51'),_0x453fe1);endRouting(_0x453fe1,_0x294524,_0x4767c3,_0xba81d8);clearTimeout(_0x1cc3d9);_0x78bc2[_0x5bb5('0x4f')](!![]);_0x18c632['next']();},_0x26d7d9);switch(_0x294524[_0x5bb5('0x52')]){case _0x5bb5('0x53'):strategy['rrmemory'](_0x78bc2,_0x294524,_0xba81d8,_0x4767c3);break;default:strategy[_0x5bb5('0x54')](_0x78bc2,_0x294524,_0xba81d8,_0x4767c3);}}else{logger[_0x5bb5('0x39')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x453fe1,_0x247156[_0x5bb5('0x36')]);_0x18c632[_0x5bb5('0x55')]();}}}catch(_0x292abc){logger[_0x5bb5('0x39')](_0x5bb5('0x45'),_0x453fe1,_0x292abc[_0x5bb5('0x56')]);_0x18c632[_0x5bb5('0x55')]();}};}; \ No newline at end of file +var _0xbcfc=['close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','from','joinAt','emit','queue','account','push','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','then','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','error','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','qtimeout','end'];(function(_0x378bf6,_0x420778){var _0x21419e=function(_0x421d98){while(--_0x421d98){_0x378bf6['push'](_0x378bf6['shift']());}};_0x21419e(++_0x420778);}(_0xbcfc,0x162));var _0xcbcf=function(_0x3f1471,_0x494b78){_0x3f1471=_0x3f1471-0x0;var _0x6885fb=_0xbcfc[_0x3f1471];return _0x6885fb;};'use strict';var schema=require(_0xcbcf('0x0'));var _=require(_0xcbcf('0x1'));var util=require(_0xcbcf('0x2'));var seqqueue=require(_0xcbcf('0x3'));var moment=require('moment');var Redis=require(_0xcbcf('0x4'));var config=require(_0xcbcf('0x5'));var logger=require(_0xcbcf('0x6'))(_0xcbcf('0x7'));var strategy=require(_0xcbcf('0x8'));config['redis']=_[_0xcbcf('0x9')](config[_0xcbcf('0xa')],{'host':_0xcbcf('0xb'),'port':0x18eb});var io=require(_0xcbcf('0xc'))(new Redis(config['redis']));var attributes=['id',_0xcbcf('0xd'),'account','queue',_0xcbcf('0xe'),_0xcbcf('0xf')];function emit(_0x175969,_0x11916e,_0x48eb30){io['to'](_0x175969)[_0xcbcf('0x10')](_0x11916e,_0x48eb30);}function emitChannelQueueInteraction(_0x10a918,_0x7453be,_0x4d759f,_0x1f4628,_0x175638,_0x31294d,_0x40a22d,_0x4dbfc8){var _0x263bee=_['clone'](_0x4d759f);_0x263bee[_0xcbcf('0xd')]=_0x4dbfc8;_0x263bee[_0xcbcf('0x11')]=_0x7453be;_0x263bee[_0xcbcf('0x12')]=_0x1f4628;_0x263bee['id']=_0x175638;if(_0x31294d){attributes[_0xcbcf('0x13')](_[_0xcbcf('0x14')](_0x10a918)+'InteractionId');_0x40a22d[util[_0xcbcf('0x15')](_0xcbcf('0x16'),_0x10a918)][_0x175638]=_[_0xcbcf('0x17')](_0x263bee,attributes);}else{delete _0x40a22d[util[_0xcbcf('0x15')]('%sQueuesWaitingInteractions',_0x10a918)][_0x175638];}emit(util[_0xcbcf('0x15')](_0xcbcf('0x18'),_0x10a918,_0x7453be),util[_0xcbcf('0x15')]('%s_queue_waiting_interaction:%s',_0x10a918,_0x31294d?_0xcbcf('0x19'):_0xcbcf('0x1a')),_['pick'](_0x263bee,attributes));}var rpc={'openchannelQueueReport':require(_0xcbcf('0x1b')),'mailQueueReport':require(_0xcbcf('0x1c')),'chatQueueReport':require(_0xcbcf('0x1d')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xcbcf('0x1e')),'whatsappQueueReport':require(_0xcbcf('0x1f')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xcbcf('0x20')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0xcbcf('0x21'),'required':!![],'message':_0xcbcf('0x22')},'timeout':{'type':_0xcbcf('0x23'),'message':_0xcbcf('0x24')}});function startRouting(_0x2c1906,_0xb8511e,_0x5c6fd0,_0x434502){if(_0x2c1906&&_0xb8511e&&_0x5c6fd0){_0xb8511e['waiting']+=0x1;var _0x33f0b1={'uniqueid':_0x2c1906,'from':_0x5c6fd0['body']?_0x5c6fd0['body']['from']:'','joinAt':moment()[_0xcbcf('0x15')](_0xcbcf('0x25')),'ContactId':_0x5c6fd0[_0xcbcf('0x26')]?_0x5c6fd0[_0xcbcf('0x26')]['id']:null,'ListId':_0x5c6fd0['list']?_0x5c6fd0['list']['id']:null};_0x33f0b1[_[_0xcbcf('0x27')](_0x5c6fd0[_0xcbcf('0x28')])+_0xcbcf('0x29')]=_0xb8511e['id']||null;_0x33f0b1[_['upperFirst'](_0x5c6fd0[_0xcbcf('0x28')])+_0xcbcf('0x2a')]=_0x5c6fd0[_0xcbcf('0x2b')]?_0x5c6fd0['interaction']['id']:null;_0x33f0b1[_['upperFirst'](_0x5c6fd0[_0xcbcf('0x28')])+_0xcbcf('0x2c')]=_0x5c6fd0[_0xcbcf('0x2d')]?_0x5c6fd0['message']['id']:null;_0x33f0b1[_[_0xcbcf('0x27')](_0x5c6fd0[_0xcbcf('0x28')])+(_0x5c6fd0[_0xcbcf('0x28')]!==_0xcbcf('0x2e')?_0xcbcf('0x2f'):_0xcbcf('0x30'))]=_0x5c6fd0[_0xcbcf('0x12')]?_0x5c6fd0[_0xcbcf('0x12')]['id']:null;logger[_0xcbcf('0x31')](util[_0xcbcf('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x2c1906,_0xb8511e[_0xcbcf('0x32')]));emitChannelQueueInteraction(_0x5c6fd0[_0xcbcf('0x28')],_0xb8511e[_0xcbcf('0x32')],_0x33f0b1,_0x5c6fd0[_0xcbcf('0x12')][_0xcbcf('0x32')],_0x5c6fd0[_0xcbcf('0x2d')]['id'],!![],_0x434502,_0xb8511e['id']);if(rpc[_0x5c6fd0['channel']+_0xcbcf('0x33')]){return rpc[_0x5c6fd0[_0xcbcf('0x28')]+_0xcbcf('0x33')][_0xcbcf('0x34')](_0x33f0b1)[_0xcbcf('0x35')](function(_0x1cb809){logger['error'](_0xcbcf('0x36'),_0x1cb809);});}}}function stopRouting(_0x2cd3be,_0x576424,_0x4a9a1c,_0xf5d5bf){if(_0x2cd3be&&_0x576424){_0x576424['waiting']-=0x1;var _0x35e09d={'leaveAt':moment()[_0xcbcf('0x15')](_0xcbcf('0x25')),'acceptAt':moment()[_0xcbcf('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xcbcf('0x37')};logger['info'](util[_0xcbcf('0x15')](_0xcbcf('0x38'),_0x2cd3be,_0x576424[_0xcbcf('0x32')]));emitChannelQueueInteraction(_0x4a9a1c[_0xcbcf('0x28')],_0x576424[_0xcbcf('0x32')],_0x4a9a1c[_0xcbcf('0x39')],_0x4a9a1c[_0xcbcf('0x12')][_0xcbcf('0x32')],_0x4a9a1c['message']['id'],![],_0xf5d5bf,_0x576424['id']);return rpc[_0x4a9a1c['channel']+'Interaction'][_0xcbcf('0x3a')](_0x4a9a1c['interaction']['id'],{'queueId':_0x576424['id']})[_0xcbcf('0x3b')](function(){if(rpc[_0x4a9a1c['channel']+_0xcbcf('0x33')]){return rpc[_0x4a9a1c[_0xcbcf('0x28')]+'QueueReport'][_0xcbcf('0x3a')](_0x2cd3be,_0x35e09d)['catch'](function(_0x482732){logger['error'](_0xcbcf('0x3c'),_0x482732);});}});}}function endRouting(_0x352c63,_0x3a0949,_0x1603f4,_0x1b3521){if(_0x352c63&&_0x3a0949){_0x3a0949[_0xcbcf('0x3d')]-=0x1;var _0x107669={'leaveAt':moment()[_0xcbcf('0x15')](_0xcbcf('0x25')),'exitAt':moment()['format'](_0xcbcf('0x25')),'reason':_0xcbcf('0x3e')};logger['info'](util['format'](_0xcbcf('0x3f'),_0x352c63,_0x3a0949[_0xcbcf('0x32')]));emitChannelQueueInteraction(_0x1603f4[_0xcbcf('0x28')],_0x3a0949[_0xcbcf('0x32')],_0x1603f4[_0xcbcf('0x39')],_0x1603f4[_0xcbcf('0x12')]['name'],_0x1603f4[_0xcbcf('0x2d')]['id'],![],_0x1b3521);if(rpc[_0x1603f4['channel']+_0xcbcf('0x33')]){return rpc[_0x1603f4['channel']+_0xcbcf('0x33')][_0xcbcf('0x3a')](_0x352c63,_0x107669)[_0xcbcf('0x35')](function(_0x573922){logger[_0xcbcf('0x40')](_0xcbcf('0x3c'),_0x573922);});}}}function handleFindQueue(_0x3dc047){return function(_0x38a416){return _0x38a416[_0xcbcf('0x32')]['toLowerCase']()===_0x3dc047[_0xcbcf('0x41')]();};}exports[_0xcbcf('0x42')]=function(_0x395e1b,_0xb5a613,_0x44e1d0,_0x10bd81){return function(_0x331751){try{var _0x21f931={'name':_0xb5a613[0x0],'timeout':_0xb5a613[0x1]};var _0x49b87b=queue[_0xcbcf('0x0')](_0x21f931,{'typecast':!![]});if(_0x49b87b['length']){logger[_0xcbcf('0x40')](_0xcbcf('0x43'),_0x395e1b,_[_0xcbcf('0x44')](_0x49b87b,_0xcbcf('0x2d'))[_0xcbcf('0x45')](',\x20'));_0x331751[_0xcbcf('0x46')]();}else{var _0x2a6a53=_['find'](_0x44e1d0[_0x10bd81['channel']+_0xcbcf('0x47')],handleFindQueue(_0x21f931[_0xcbcf('0x32')]));if(_0x2a6a53){startRouting(_0x395e1b,_0x2a6a53,_0x10bd81,_0x44e1d0);var _0x3b5e74=(_0x2a6a53[_0xcbcf('0x3e')]||0xa)*0x3e8;var _0x22d7d8=(_0x21f931[_0xcbcf('0x3e')]||0x14)*0x3e8;var _0x549af0;if(_0x3b5e74>_0x22d7d8){_0x22d7d8=_0x3b5e74;}var _0x23155f=seqqueue[_0xcbcf('0x48')](_0x3b5e74);_0x23155f['id']=_0x395e1b;_0x23155f[_0xcbcf('0x49')]=_0x3b5e74;_0x23155f[_0xcbcf('0x4a')]=_0x22d7d8;_0x23155f[_0xcbcf('0x28')]=_0x10bd81[_0xcbcf('0x28')];_0x44e1d0['rules'][_0x395e1b]['on'](_0xcbcf('0x4b'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x395e1b);stopRouting(_0x395e1b,_0x2a6a53,_0x10bd81,_0x44e1d0);clearTimeout(_0x549af0);_0x549af0=undefined;_0x23155f[_0xcbcf('0x4c')](!![]);if(_0x44e1d0[_0xcbcf('0x4d')][_0x395e1b]){delete _0x44e1d0[_0xcbcf('0x4d')][_0x395e1b];}_0x331751[_0xcbcf('0x46')]();});_0x44e1d0[_0xcbcf('0x4d')][_0x395e1b]['on'](_0xcbcf('0x4e'),function(){if(_0x44e1d0[_0xcbcf('0x4d')][_0x395e1b]){delete _0x44e1d0['rules'][_0x395e1b];}});_0x549af0=setTimeout(function(){logger[_0xcbcf('0x31')](_0xcbcf('0x4f'),_0x395e1b);endRouting(_0x395e1b,_0x2a6a53,_0x10bd81,_0x44e1d0);clearTimeout(_0x549af0);_0x23155f[_0xcbcf('0x4c')](!![]);_0x331751[_0xcbcf('0x50')]();},_0x22d7d8);switch(_0x2a6a53[_0xcbcf('0x51')]){case _0xcbcf('0x52'):strategy[_0xcbcf('0x52')](_0x23155f,_0x2a6a53,_0x44e1d0,_0x10bd81);break;default:strategy[_0xcbcf('0x53')](_0x23155f,_0x2a6a53,_0x44e1d0,_0x10bd81);}}else{logger['error'](_0xcbcf('0x54'),_0x395e1b,_0x21f931[_0xcbcf('0x32')]);_0x331751[_0xcbcf('0x46')]();}}}catch(_0x181cf2){logger[_0xcbcf('0x40')](_0xcbcf('0x43'),_0x395e1b,_0x181cf2[_0xcbcf('0x55')]);_0x331751[_0xcbcf('0x46')]();}};}; \ 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 b1f9056..8af3c15 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 _0x0faf=['showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','debug','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification'];(function(_0x7e84c4,_0x36dfa3){var _0x1f40c2=function(_0x462024){while(--_0x462024){_0x7e84c4['push'](_0x7e84c4['shift']());}};_0x1f40c2(++_0x36dfa3);}(_0x0faf,0x132));var _0xf0fa=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0x0faf[_0x512e72];return _0x143086;};'use strict';var _=require(_0xf0fa('0x0'));var uuid=require('uuid');var util=require(_0xf0fa('0x1'));var logger=require(_0xf0fa('0x2'))(_0xf0fa('0x3'));var Agent=function(_0x35a260,_0xccb93e,_0xdc9ce3,_0x515b12){this[_0xf0fa('0x4')]=uuid['v4']();this[_0xf0fa('0x5')]=_0x35a260;this['agent']=_0xccb93e;this[_0xf0fa('0x6')]=_0xdc9ce3;this[_0xf0fa('0x3')]=_0x515b12;this[_0xf0fa('0x5')][_0xf0fa('0x7')](this[_0xf0fa('0x8')]['bind'](this),this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this['squeue']['on']('timeout',this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this[_0xf0fa('0x5')]['on'](_0xf0fa('0xb'),this[_0xf0fa('0xc')][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0x7')]=function(){this['squeue'][_0xf0fa('0x7')](this['handleRun'][_0xf0fa('0xa')](this),this['handleTimeout'][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xf0fa('0x8')]=function(){logger['debug'](_0xf0fa('0xe'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);if(_[_0xf0fa('0x10')](this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this[_0xf0fa('0x7')][_0xf0fa('0xa')](this),0x3e8);}else{if(this[_0xf0fa('0x3')][_0xf0fa('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],this[_0xf0fa('0x5')][_0xf0fa('0x14')],![])){this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x15')]=!![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x17')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this[_0xf0fa('0x5')][_0xf0fa('0x14')]);util[_0xf0fa('0x18')](this[_0xf0fa('0x4')],this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']],null,this[_0xf0fa('0x3')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0xf0fa('0x1a')+(this[_0xf0fa('0x3')]['forcedOwnership']?':FORCED':''));}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1b'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this['push'][_0xf0fa('0xa')](this),0x3e8);}}};Agent[_0xf0fa('0xd')][_0xf0fa('0x9')]=function(_0x5a4fd3){if(_[_0xf0fa('0x10')](this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){return logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1c'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);util['hideNotification'](this['notificationId'],this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0x6')]['agents'][this[_0xf0fa('0xf')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xf0fa('0xf')]['id']]['busy']=![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x1d')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this['squeue'][_0xf0fa('0x14')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0x5a4fd3?_0xf0fa('0x1e'):_0xf0fa('0x1f'));}if(!_0x5a4fd3){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f){return new Agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f);}module[_0xf0fa('0x20')]=agent; \ No newline at end of file +var _0x7a2c=['squeue','isNil','agents','forcedOwnership','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','channel','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x5bf24f,_0x1153ec){var _0x5b3241=function(_0x28da55){while(--_0x28da55){_0x5bf24f['push'](_0x5bf24f['shift']());}};_0x5b3241(++_0x1153ec);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x204655,_0x51ef29){_0x204655=_0x204655-0x0;var _0x27d346=_0x7a2c[_0x204655];return _0x27d346;};'use strict';var _=require(_0xc7a2('0x0'));var uuid=require('uuid');var util=require(_0xc7a2('0x1'));var logger=require(_0xc7a2('0x2'))(_0xc7a2('0x3'));var Agent=function(_0x26fb61,_0x44d702,_0x2abba8,_0x3f2b0d){this[_0xc7a2('0x4')]=uuid['v4']();this['squeue']=_0x26fb61;this[_0xc7a2('0x5')]=_0x44d702;this[_0xc7a2('0x6')]=_0x2abba8;this['routing']=_0x3f2b0d;this['squeue']['push'](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xa'),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xb'),this['handleDrained'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xd')]=function(){this['squeue'][_0xc7a2('0xd')](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this['handleTimeout'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xe')]=function(){this[_0xc7a2('0x9')](!![]);};Agent[_0xc7a2('0xc')][_0xc7a2('0x7')]=function(){logger[_0xc7a2('0xf')](_0xc7a2('0x10'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){logger[_0xc7a2('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc7a2('0x11')]['id'],this['agent']['id']);setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}else{if(this[_0xc7a2('0x3')][_0xc7a2('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],this['squeue']['channel'],![])){this[_0xc7a2('0x6')]['agents'][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x15')]=!![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x17')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this['squeue']['channel']);util[_0xc7a2('0x18')](this[_0xc7a2('0x4')],this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']],null,this[_0xc7a2('0x3')]);util[_0xc7a2('0x19')](this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0xc7a2('0x1a')+(this['routing'][_0xc7a2('0x14')]?':FORCED':''));}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1b'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xc7a2('0xc')][_0xc7a2('0x9')]=function(_0x272c6b){if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){return logger['debug'](_0xc7a2('0x1c'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1d'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);util[_0xc7a2('0x1e')](this['notificationId'],this[_0xc7a2('0x11')]['id'],this['realtime']['agents'][this[_0xc7a2('0x5')]['id']],null,this['routing']);this['realtime'][_0xc7a2('0x13')][this['agent']['id']][_0xc7a2('0x15')]=![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x1f')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this[_0xc7a2('0x11')][_0xc7a2('0x20')]);util[_0xc7a2('0x19')](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0x272c6b?_0xc7a2('0x21'):_0xc7a2('0x22'));}if(!_0x272c6b){setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}};function agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4){return new Agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4);}module[_0xc7a2('0x23')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 50e4f65..106692a 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 _0x0d91=['writeLog','STOP','removeWaitingNotification','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','push','prototype','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','RINGING','busy','busyQueue','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x0d91,0xb3));var _0x10d9=function(_0x382987,_0x58058b){_0x382987=_0x382987-0x0;var _0x29eb57=_0x0d91[_0x382987];return _0x29eb57;};'use strict';var _=require('lodash');var uuid=require(_0x10d9('0x0'));var util=require(_0x10d9('0x1'));var logger=require(_0x10d9('0x2'))(_0x10d9('0x3'));var Beepall=function(_0xfa8ecb,_0x29a8f6,_0x37e41a,_0x29b717){this[_0x10d9('0x4')]=uuid['v4']();this[_0x10d9('0x5')]=_0xfa8ecb;this[_0x10d9('0x6')]=_0x29a8f6;this[_0x10d9('0x7')]=_0x37e41a;this[_0x10d9('0x3')]=_0x29b717;this[_0x10d9('0x5')]['push'](this[_0x10d9('0x8')][_0x10d9('0x9')](this),this[_0x10d9('0xa')]['bind'](this));this['squeue']['on'](_0x10d9('0xb'),this['handleTimeout']['bind'](this));this[_0x10d9('0x5')]['on'](_0x10d9('0xc'),this[_0x10d9('0xd')][_0x10d9('0x9')](this));};Beepall['prototype'][_0x10d9('0xe')]=function(){this[_0x10d9('0x5')][_0x10d9('0xe')](this['handleRun'][_0x10d9('0x9')](this),this[_0x10d9('0xa')][_0x10d9('0x9')](this));};Beepall[_0x10d9('0xf')][_0x10d9('0xd')]=function(){this[_0x10d9('0xa')](!![]);};Beepall[_0x10d9('0xf')][_0x10d9('0x8')]=function(){var _0x53ad8e=!![];if(!_[_0x10d9('0x10')](this['queue'])&&!_[_0x10d9('0x10')](this[_0x10d9('0x6')][_0x10d9('0x11')])&&this[_0x10d9('0x6')][_0x10d9('0x11')][_0x10d9('0x12')]>0x0){for(var _0x460a74=0x0,_0x5e094b;_0x460a740x0){for(var _0x57d9ad=0x0,_0x175279;_0x57d9ad0x0&&_0x2d9b8d[_0x3d35bd+'CurrentCapacity']>=_0x2d9b8d[_0x3d35bd+_0x1f81('0x20')]){writeLog(_0x3f0de8,_0x2d9b8d,_0x3d35bd['toUpperCase']()+_0x1f81('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x21caa5,_0xe95e9c,_0x147695,_0x17129b,_0x19dab0){return sendNotification(!![],_0x21caa5,_0xe95e9c,_0x147695,_0x17129b,_0x19dab0);};exports[_0x1f81('0x23')]=function(_0x2ff623,_0x1bd2b3,_0x34bc53,_0x243bf5,_0x587636){return sendNotification(![],_0x2ff623,_0x1bd2b3,_0x34bc53,_0x243bf5,_0x587636);};exports[_0x1f81('0x24')]=function(_0x5413a1,_0x2f1096,_0x197da5){var _0x537166=_0x2f1096[_0x1f81('0x25')][_0x1f81('0x26')];if(!_0x537166&&_0x197da5){_0x537166=_0x197da5['id'];}var _0x218040=_[_0x1f81('0x27')](_0x5413a1[_0x2f1096[_0x1f81('0x28')]+_0x1f81('0x29')],function(_0x236676){var _0x381b5c=_['capitalize'](_0x2f1096[_0x1f81('0x28')])+_0x1f81('0x2a');return _0x236676[_0x381b5c]===_0x2f1096[_0x1f81('0x25')]['id'];});if(!_0x218040&&_0x537166&&_0x5413a1[_0x1f81('0x2b')][_0x537166]){_0x218040=_[_0x1f81('0x27')](_0x5413a1[_0x1f81('0x2b')][_0x537166][_0x2f1096[_0x1f81('0x28')]+_0x1f81('0x2c')],function(_0x1068c9){return _0x1068c9['id']===_0x2f1096[_0x1f81('0x25')]['id'];});}return _0x218040;};exports[_0x1f81('0x2d')]=function(_0x4b8335,_0x24e2ee,_0x2254c6,_0x2fe722){if(_0x2254c6&&_0x2254c6['id']&&_0x4b8335[_0x1f81('0x2b')]&&_0x4b8335['agents'][_0x2254c6['id']]){_0x4b8335[_0x1f81('0x2b')][_0x2254c6['id']][_0x2fe722+_0x1f81('0x2c')][_0x24e2ee[_0x1f81('0x2e')]['id']]={'id':_0x24e2ee['interaction']['id']};}};exports['removeWaitingNotification']=function(_0xb1969e,_0x4f092b,_0x3765aa,_0x5735aa){if(_0x3765aa&&_0x3765aa['id']&&_0xb1969e[_0x1f81('0x2b')]&&_0xb1969e[_0x1f81('0x2b')][_0x3765aa['id']]){delete _0xb1969e[_0x1f81('0x2b')][_0x3765aa['id']][_0x5735aa+_0x1f81('0x2c')][_0x4f092b[_0x1f81('0x2e')]['id']];}};exports[_0x1f81('0x2f')]=writeLog; \ No newline at end of file +var _0xf7b4=['OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','interaction','some','channel','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','ioredis','../../../../../config/environment','redis','defaults','localhost','socket.io-emitter','split','name','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','emit','save','remove','debug','busy','BUSY','online'];(function(_0x3e9105,_0x1d4f03){var _0x5ad319=function(_0x3eae37){while(--_0x3eae37){_0x3e9105['push'](_0x3e9105['shift']());}};_0x5ad319(++_0x1d4f03);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5efb4d,_0x17b335){_0x5efb4d=_0x5efb4d-0x0;var _0xafb394=_0xf7b4[_0x5efb4d];return _0xafb394;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var utils=require('../utils');var Redis=require(_0x4f7b('0x1'));var config=require(_0x4f7b('0x2'));var logger=require('../../../../../config/logger')('routing');config[_0x4f7b('0x3')]=_[_0x4f7b('0x4')](config[_0x4f7b('0x3')],{'host':_0x4f7b('0x5'),'port':0x18eb});var io=require(_0x4f7b('0x6'))(new Redis(config[_0x4f7b('0x3')]));function sendNotification(_0x427f8b,_0x3ad135,_0x173784,_0x351036,_0x36ea9c,_0x3ef6e1){var _0x2b7ad8=_0x3ef6e1||{};var _0x5c714d=_0x173784[_0x4f7b('0x7')]('.');var _0x1016e0={'uniqueid':_0x3ad135,'channel':_0x5c714d[0x0],'id':_0x5c714d[0x1],'title':_0x5c714d[0x0]+'\x20interaction','interactionId':_0x5c714d[0x2],'queue':_0x36ea9c?_0x36ea9c[_0x4f7b('0x8')]:null,'sound':_0x2b7ad8[_0x4f7b('0x9')][_0x4f7b('0xa')],'shake':_0x2b7ad8[_0x4f7b('0x9')][_0x4f7b('0xb')]};try{if(!_0x2b7ad8['body']){_0x2b7ad8[_0x4f7b('0xc')]={};}if(_0x36ea9c){_0x2b7ad8['body']['queue']=_0x36ea9c;}else if(_0x2b7ad8[_0x4f7b('0xc')][_0x4f7b('0xd')]){delete _0x2b7ad8[_0x4f7b('0xc')][_0x4f7b('0xd')];}_0x1016e0['msg']=utils[_0x4f7b('0xe')](_0x2b7ad8[_0x4f7b('0x9')][_0x4f7b('0xf')],_0x2b7ad8);}catch(_0x43a51a){_0x1016e0[_0x4f7b('0x10')]=_0x4f7b('0x11');logger[_0x4f7b('0x12')](util[_0x4f7b('0x13')](_0x4f7b('0x14'),_0x3ad135,_0x43a51a[_0x4f7b('0x15')]));}io['to'](util[_0x4f7b('0x13')](_0x4f7b('0x16'),_0x351036['name']))[_0x4f7b('0x17')](util['format']('notification:%s',_0x427f8b?_0x4f7b('0x18'):_0x4f7b('0x19')),_0x1016e0);}function writeLog(_0x519d90,_0x2b34c9,_0x24c460){return logger[_0x4f7b('0x1a')](util[_0x4f7b('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x519d90,_0x2b34c9[_0x4f7b('0x8')],_0x24c460));}exports['isAgentAvailable']=function(_0x41cf36,_0x12374b,_0xa2f54e,_0xdb2df2){if(_0x12374b[_0x4f7b('0x1b')]){writeLog(_0x41cf36,_0x12374b,_0x4f7b('0x1c'));return![];}if(!_0x12374b[_0x4f7b('0x1d')]){writeLog(_0x41cf36,_0x12374b,_0x4f7b('0x1e'));return![];}if(_0x12374b[_0xa2f54e+_0x4f7b('0x1f')]){writeLog(_0x41cf36,_0x12374b,'PAUSE');return![];}if(_0xdb2df2&&_0x12374b[_0x4f7b('0x20')](_0xa2f54e+_0x4f7b('0x21'))&&_0x12374b[_0x4f7b('0x20')](_0xa2f54e+'CurrentCapacity')){if(_0x12374b[_0xa2f54e+_0x4f7b('0x21')]>0x0&&_0x12374b[_0xa2f54e+_0x4f7b('0x22')]>=_0x12374b[_0xa2f54e+'Capacity']){writeLog(_0x41cf36,_0x12374b,_0xa2f54e[_0x4f7b('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x4f7b('0x24')]=function(_0x2429be,_0x23c820,_0x278c41,_0x17aa9d,_0x94478b){return sendNotification(!![],_0x2429be,_0x23c820,_0x278c41,_0x17aa9d,_0x94478b);};exports[_0x4f7b('0x25')]=function(_0x3ad769,_0x4ec9a3,_0x6c9626,_0x14e2c2,_0x311675){return sendNotification(![],_0x3ad769,_0x4ec9a3,_0x6c9626,_0x14e2c2,_0x311675);};exports['checkWaitingNotifications']=function(_0x19da29,_0x336739,_0x1db684){var _0x3a56ff=_0x336739[_0x4f7b('0x26')]['UserId'];if(!_0x3a56ff&&_0x1db684){_0x3a56ff=_0x1db684['id'];}var _0xac1f93=_[_0x4f7b('0x27')](_0x19da29[_0x336739[_0x4f7b('0x28')]+'QueuesWaitingInteractions'],function(_0x7de561){var _0x5d13a1=_['capitalize'](_0x336739[_0x4f7b('0x28')])+'InteractionId';return _0x7de561[_0x5d13a1]===_0x336739[_0x4f7b('0x26')]['id'];});if(!_0xac1f93&&_0x3a56ff&&_0x19da29[_0x4f7b('0x29')][_0x3a56ff]){_0xac1f93=_[_0x4f7b('0x27')](_0x19da29[_0x4f7b('0x29')][_0x3a56ff][_0x336739[_0x4f7b('0x28')]+_0x4f7b('0x2a')],function(_0x13a113){return _0x13a113['id']===_0x336739[_0x4f7b('0x26')]['id'];});}return _0xac1f93;};exports[_0x4f7b('0x2b')]=function(_0x557cd6,_0x1c133d,_0x8d3266,_0x3e7fb4){if(_0x8d3266&&_0x8d3266['id']&&_0x557cd6[_0x4f7b('0x29')]&&_0x557cd6[_0x4f7b('0x29')][_0x8d3266['id']]){_0x557cd6[_0x4f7b('0x29')][_0x8d3266['id']][_0x3e7fb4+_0x4f7b('0x2a')][_0x1c133d[_0x4f7b('0x15')]['id']]={'id':_0x1c133d[_0x4f7b('0x26')]['id']};}};exports[_0x4f7b('0x2c')]=function(_0x3cdf6d,_0x172235,_0x56e045,_0x2e7640){if(_0x56e045&&_0x56e045['id']&&_0x3cdf6d['agents']&&_0x3cdf6d[_0x4f7b('0x29')][_0x56e045['id']]){delete _0x3cdf6d[_0x4f7b('0x29')][_0x56e045['id']][_0x2e7640+'WaitingInteractions'][_0x172235[_0x4f7b('0x15')]['id']];}};exports[_0x4f7b('0x2d')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 49aba65..e559e78 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 _0xb0c5=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','validate','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x4af563,_0x2b2308){var _0x7deac1=function(_0x20deca){while(--_0x20deca){_0x4af563['push'](_0x4af563['shift']());}};_0x7deac1(++_0x2b2308);}(_0xb0c5,0xfa));var _0x5b0c=function(_0x346b28,_0x5e0181){_0x346b28=_0x346b28-0x0;var _0x406ddd=_0xb0c5[_0x346b28];return _0x406ddd;};'use strict';var schema=require(_0x5b0c('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require('./utils');var logger=require(_0x5b0c('0x1'))(_0x5b0c('0x2'));var system=schema({'command':{'type':_0x5b0c('0x3'),'required':!![],'message':_0x5b0c('0x4')}});exports[_0x5b0c('0x5')]=function(_0x425015,_0x348abf){return function(_0x121b51){try{var _0x48ad35={'command':_0x348abf[0x0]};var _0x4ea937=system['validate'](_0x48ad35,{'typecast':!![]});if(_0x4ea937[_0x5b0c('0x6')]){logger[_0x5b0c('0x7')]('[%s][SYSTEM]\x20%s',_0x425015,_[_0x5b0c('0x8')](_0x4ea937,'message')[_0x5b0c('0x9')](',\x20'));logger[_0x5b0c('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x425015);_0x121b51[_0x5b0c('0xb')]();}else{var _0x21de48=this;var _0x506eae=utils['getMustacheRender'](_0x348abf[0x0],this);logger[_0x5b0c('0xa')](_0x5b0c('0xc'),_0x425015,_0x506eae);sh[_0x5b0c('0xd')](_[_0x5b0c('0xe')](_0x506eae),function(_0x36004e,_0x281a58){logger[_0x5b0c('0xa')](_0x5b0c('0xf'),_0x425015,_0x36004e);if(_0x36004e==0x0){var _0x472250=_0x281a58['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x5b0c('0x10')](_0x348abf[0x1])||_['isEmpty'](_0x348abf[0x1])){logger['info'](_0x5b0c('0x11'),_0x425015);_0x21de48['body'][_0x348abf[0x1]]=_0x472250;}else{logger[_0x5b0c('0xa')](_0x5b0c('0x12'),_0x425015,_0x348abf[0x1],_0x472250);_0x21de48['body'][_0x348abf[0x1]]=_0x472250;}}_0x121b51[_0x5b0c('0xb')]();});}}catch(_0x347a27){logger[_0x5b0c('0x7')](_0x5b0c('0x13'),_0x425015,_[_0x5b0c('0x14')](_0x347a27)?JSON[_0x5b0c('0x15')](_0x347a27):_0x347a27);logger[_0x5b0c('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x425015);_0x121b51[_0x5b0c('0xb')]();}};}; \ No newline at end of file +var _0x59e0=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger'];(function(_0x3207a7,_0x123be8){var _0x2ce53d=function(_0x1db23e){while(--_0x1db23e){_0x3207a7['push'](_0x3207a7['shift']());}};_0x2ce53d(++_0x123be8);}(_0x59e0,0x1f4));var _0x059e=function(_0x27ea17,_0x17eec0){_0x27ea17=_0x27ea17-0x0;var _0xc76b37=_0x59e0[_0x27ea17];return _0xc76b37;};'use strict';var schema=require('validate');var sh=require(_0x059e('0x0'));var _=require(_0x059e('0x1'));var utils=require(_0x059e('0x2'));var logger=require(_0x059e('0x3'))(_0x059e('0x4'));var system=schema({'command':{'type':_0x059e('0x5'),'required':!![],'message':_0x059e('0x6')}});exports[_0x059e('0x7')]=function(_0x227705,_0x1d0ef9){return function(_0x2b920c){try{var _0x1ce502={'command':_0x1d0ef9[0x0]};var _0x4a4a89=system[_0x059e('0x8')](_0x1ce502,{'typecast':!![]});if(_0x4a4a89[_0x059e('0x9')]){logger[_0x059e('0xa')]('[%s][SYSTEM]\x20%s',_0x227705,_[_0x059e('0xb')](_0x4a4a89,_0x059e('0xc'))[_0x059e('0xd')](',\x20'));logger[_0x059e('0xe')](_0x059e('0xf'),_0x227705);_0x2b920c[_0x059e('0x10')]();}else{var _0x1ad0d7=this;var _0x20be01=utils[_0x059e('0x11')](_0x1d0ef9[0x0],this);logger[_0x059e('0xe')](_0x059e('0x12'),_0x227705,_0x20be01);sh['exec'](_[_0x059e('0x13')](_0x20be01),function(_0x317948,_0x2cd29c){logger[_0x059e('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x227705,_0x317948);if(_0x317948==0x0){var _0x5e1bc5=_0x2cd29c[_0x059e('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1d0ef9[0x1])||_[_0x059e('0x15')](_0x1d0ef9[0x1])){logger['info'](_0x059e('0x16'),_0x227705);_0x1ad0d7[_0x059e('0x17')][_0x1d0ef9[0x1]]=_0x5e1bc5;}else{logger[_0x059e('0xe')](_0x059e('0x18'),_0x227705,_0x1d0ef9[0x1],_0x5e1bc5);_0x1ad0d7[_0x059e('0x17')][_0x1d0ef9[0x1]]=_0x5e1bc5;}}_0x2b920c[_0x059e('0x10')]();});}}catch(_0x2ebc72){logger['error'](_0x059e('0x19'),_0x227705,_[_0x059e('0x1a')](_0x2ebc72)?JSON[_0x059e('0x1b')](_0x2ebc72):_0x2ebc72);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x227705);_0x2b920c['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index ea2eab8..875f3e0 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 _0x0cfc=['catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','length','error','[%s][TAG]\x20%s','map','message','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x2bdf3e,_0x168bfd){var _0x74e038=function(_0x2773f1){while(--_0x2773f1){_0x2bdf3e['push'](_0x2bdf3e['shift']());}};_0x74e038(++_0x168bfd);}(_0x0cfc,0x1d7));var _0xc0cf=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0cfc[_0x46698a];return _0x356db0;};'use strict';var schema=require(_0xc0cf('0x0'));var _=require(_0xc0cf('0x1'));var rpc={'chatInteraction':require(_0xc0cf('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc0cf('0x3')),'mailInteraction':require(_0xc0cf('0x4')),'faxInteraction':require(_0xc0cf('0x5')),'whatsappInteraction':require(_0xc0cf('0x6'))};var logger=require(_0xc0cf('0x7'))(_0xc0cf('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xc0cf('0x9')]=function(_0x5a6181,_0x3e12e,_0x509686,_0x59042a){return function(_0x3dc8fc){try{var _0x1eff33={'tag':_0x3e12e[0x0]};var _0x4fa035=tag[_0xc0cf('0x0')](_0x1eff33,{'typecast':!![]});if(_0x4fa035[_0xc0cf('0xa')]){logger[_0xc0cf('0xb')](_0xc0cf('0xc'),_0x5a6181,_[_0xc0cf('0xd')](_0x4fa035,_0xc0cf('0xe'))['join'](',\x20'));logger[_0xc0cf('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5a6181);_0x3dc8fc[_0xc0cf('0x10')]();}else{var _0x46802e={'ids':[_0x3e12e[0x0]]};if(rpc[_0x59042a[_0xc0cf('0x11')]+_0xc0cf('0x12')]){rpc[_0x59042a[_0xc0cf('0x11')]+_0xc0cf('0x12')][_0xc0cf('0x13')](_0x59042a[_0xc0cf('0x14')]['id'],_0x46802e)[_0xc0cf('0x15')](function(_0x1657cc){logger['info'](_0xc0cf('0x16'),_0x5a6181,_0x3e12e[0x1],_0x59042a[_0xc0cf('0x11')],_0x59042a[_0xc0cf('0x14')]['id']);})[_0xc0cf('0x17')](function(_0x249348){logger[_0xc0cf('0xb')](_0xc0cf('0xc'),_0x5a6181,JSON[_0xc0cf('0x18')](_0x249348));logger[_0xc0cf('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5a6181);})['finally'](function(){_0x3dc8fc['next']();});}}}catch(_0x2acfdc){logger[_0xc0cf('0xb')](_0xc0cf('0xc'),_0x5a6181,_['isObject'](_0x2acfdc)?JSON[_0xc0cf('0x18')](_0x2acfdc):_0x2acfdc);logger['info'](_0xc0cf('0x19'),_0x5a6181);_0x3dc8fc[_0xc0cf('0x10')]();}};}; \ No newline at end of file +var _0xd312=['finally','next','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','message','join','info','channel','addTags','then','interaction','catch','error','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0xd312,0xee));var _0x2d31=function(_0x486735,_0x3546af){_0x486735=_0x486735-0x0;var _0x586ab2=_0xd312[_0x486735];return _0x586ab2;};'use strict';var schema=require(_0x2d31('0x0'));var _=require(_0x2d31('0x1'));var rpc={'chatInteraction':require(_0x2d31('0x2')),'openchannelInteraction':require(_0x2d31('0x3')),'smsInteraction':require(_0x2d31('0x4')),'mailInteraction':require(_0x2d31('0x5')),'faxInteraction':require(_0x2d31('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x2d31('0x7'))(_0x2d31('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x2d31('0x9')}});exports['consequence']=function(_0x3f9b0f,_0x26b009,_0x4062e7,_0x55261f){return function(_0x5142b2){try{var _0x5b0f04={'tag':_0x26b009[0x0]};var _0x3149b4=tag[_0x2d31('0x0')](_0x5b0f04,{'typecast':!![]});if(_0x3149b4[_0x2d31('0xa')]){logger['error'](_0x2d31('0xb'),_0x3f9b0f,_['map'](_0x3149b4,_0x2d31('0xc'))[_0x2d31('0xd')](',\x20'));logger[_0x2d31('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3f9b0f);_0x5142b2['next']();}else{var _0x3316e9={'ids':[_0x26b009[0x0]]};if(rpc[_0x55261f[_0x2d31('0xf')]+'Interaction']){rpc[_0x55261f[_0x2d31('0xf')]+'Interaction'][_0x2d31('0x10')](_0x55261f['interaction']['id'],_0x3316e9)[_0x2d31('0x11')](function(_0x53ed7d){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3f9b0f,_0x26b009[0x1],_0x55261f['channel'],_0x55261f[_0x2d31('0x12')]['id']);})[_0x2d31('0x13')](function(_0x5253af){logger[_0x2d31('0x14')](_0x2d31('0xb'),_0x3f9b0f,JSON['stringify'](_0x5253af));logger[_0x2d31('0xe')](_0x2d31('0x15'),_0x3f9b0f);})[_0x2d31('0x16')](function(){_0x5142b2[_0x2d31('0x17')]();});}}}catch(_0x4de6d7){logger[_0x2d31('0x14')](_0x2d31('0xb'),_0x3f9b0f,_[_0x2d31('0x18')](_0x4de6d7)?JSON[_0x2d31('0x19')](_0x4de6d7):_0x4de6d7);logger[_0x2d31('0xe')](_0x2d31('0x15'),_0x3f9b0f);_0x5142b2[_0x2d31('0x17')]();}};}; \ 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 38d0d37..0f06e48 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 _0xa9d8=['stringify','utf8','POST','application/json-rpc','parse','logged','&serviceId=','&sessionId=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','isObject','info','next','lodash','consequence','\x20-\x20','replace','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','push','params'];(function(_0x2ccb64,_0x311974){var _0x175bdd=function(_0x1ae566){while(--_0x1ae566){_0x2ccb64['push'](_0x2ccb64['shift']());}};_0x175bdd(++_0x311974);}(_0xa9d8,0x87));var _0x8a9d=function(_0x23af72,_0x41b5fa){_0x23af72=_0x23af72-0x0;var _0x3d36b7=_0xa9d8[_0x23af72];return _0x3d36b7;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require(_0x8a9d('0x0'));var arr=[];exports[_0x8a9d('0x1')]=function(_0x3809bb,_0x47e105){return function(_0x477e53){var _0x3ba414=_0x47e105[0xa];var _0x518e57=_0x47e105[0xb];var _0x40c326=_0x47e105[0xc];var _0x53d446=_0x47e105[0xd];var _0x490568=_0x47e105[0xe];var _0x5b2660=_0x47e105[0xf]['replace'](/\n/g,_0x8a9d('0x2'));var _0x501e74=_0x47e105[0x10][_0x8a9d('0x3')](/\n/g,'\x20');if(!arr[_0x8a9d('0x4')](_0x518e57)){arr['push'](_0x518e57);var _0x1b32bb=_0x47e105[0x3];var _0x2eb9dc=_0x47e105[0x4];var _0x48be0c=_0x47e105[0x1];var _0x37770c=_0x47e105[0x0];var _0x43b4fa={};_0x43b4fa[_0x8a9d('0x5')]=_0x47e105[0x8]+_0x8a9d('0x6')+_0x40c326+'|'+_0x3ba414+'|'+_0x53d446+'|'+_0x518e57+'|'+_0x490568;_0x43b4fa[_0x8a9d('0x7')]=_0x47e105[0x7]+_0x8a9d('0x6')+_0x40c326+'|'+_0x3ba414+'|'+_0x53d446+'|'+_0x518e57+'|'+_0x490568+'|'+_0x5b2660+'|'+_0x501e74;_0x43b4fa[_0x8a9d('0x8')]=_0x47e105[0x9];var _0x5f0795={};_0x5f0795[_0x8a9d('0x9')]=_0x8a9d('0xa');_0x5f0795[_0x8a9d('0xb')]=_0x8a9d('0xc');var _0xdd758a=[];_0xdd758a[_0x8a9d('0xd')](_0x47e105[0x2]);_0xdd758a['push'](_0x47e105[0x5]);_0xdd758a['push'](_0x47e105[0x6]);_0x5f0795[_0x8a9d('0xe')]=_0xdd758a;_0x5f0795['id']=0x1;var _0x23388b=JSON[_0x8a9d('0xf')](_0x5f0795);var _0x4b5e0d={'encoding':_0x8a9d('0x10'),'method':_0x8a9d('0x11'),'timeout':0x2710,'url':_0x1b32bb,'headers':{'Content-Type':_0x8a9d('0x12')},'body':_0x23388b};return rp(_0x4b5e0d)['then'](function(_0x5e736a){const _0x4bb3ba=JSON[_0x8a9d('0x13')](_0x5e736a);if(!_0x4bb3ba['result'][_0x8a9d('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x9c0a6=_0x518e57;var _0x52dbdd='channelId='+_0x48be0c+_0x8a9d('0x15')+_0x37770c+_0x8a9d('0x16')+_0x9c0a6+'&data='+JSON['stringify'](_0x43b4fa);var _0x4ce7a1=_0x2eb9dc+'?'+_0x52dbdd;return rp(_0x4ce7a1);})[_0x8a9d('0x17')](function(_0x3c4759){logger['info'](_0x8a9d('0x18'),_0x3809bb,_0x3c4759);_0x477e53[_0x8a9d('0x19')]();})['catch'](function(_0x5c5761){logger[_0x8a9d('0x1a')]('[%s][TVOX]\x20%s',_0x3809bb,_[_0x8a9d('0x1b')](_0x5c5761)?JSON[_0x8a9d('0xf')](_0x5c5761):_0x5c5761);_0x477e53[_0x8a9d('0x19')]();});}else{logger[_0x8a9d('0x1c')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x3809bb);_0x477e53[_0x8a9d('0x1d')]();}};}; \ No newline at end of file +var _0xcd6e=['stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','\x20-\x20','replace','includes','urlOnAnswer','?params=','jsonrpc','2.0','login','push','then','parse','result','logged','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xcd6e,0xe6));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xecd6('0x0'));var logger=require(_0xecd6('0x1'))(_0xecd6('0x2'));var _=require(_0xecd6('0x3'));var arr=[];exports['consequence']=function(_0x2e4f20,_0x1d7cab){return function(_0x22ab7a){var _0x16a92c=_0x1d7cab[0xa];var _0x33e8b8=_0x1d7cab[0xb];var _0x59fe0f=_0x1d7cab[0xc];var _0xa19139=_0x1d7cab[0xd];var _0x64fa92=_0x1d7cab[0xe];var _0x2512af=_0x1d7cab[0xf]['replace'](/\n/g,_0xecd6('0x4'));var _0x22151f=_0x1d7cab[0x10][_0xecd6('0x5')](/\n/g,'\x20');if(!arr[_0xecd6('0x6')](_0x33e8b8)){arr['push'](_0x33e8b8);var _0x4f5f2f=_0x1d7cab[0x3];var _0x5b8fa6=_0x1d7cab[0x4];var _0x2d4bb2=_0x1d7cab[0x1];var _0x4a3c5c=_0x1d7cab[0x0];var _0x571bb8={};_0x571bb8[_0xecd6('0x7')]=_0x1d7cab[0x8]+_0xecd6('0x8')+_0x59fe0f+'|'+_0x16a92c+'|'+_0xa19139+'|'+_0x33e8b8+'|'+_0x64fa92;_0x571bb8['urlOnRing']=_0x1d7cab[0x7]+_0xecd6('0x8')+_0x59fe0f+'|'+_0x16a92c+'|'+_0xa19139+'|'+_0x33e8b8+'|'+_0x64fa92+'|'+_0x2512af+'|'+_0x22151f;_0x571bb8['title']=_0x1d7cab[0x9];var _0x592da2={};_0x592da2[_0xecd6('0x9')]=_0xecd6('0xa');_0x592da2['method']=_0xecd6('0xb');var _0x522120=[];_0x522120[_0xecd6('0xc')](_0x1d7cab[0x2]);_0x522120[_0xecd6('0xc')](_0x1d7cab[0x5]);_0x522120['push'](_0x1d7cab[0x6]);_0x592da2['params']=_0x522120;_0x592da2['id']=0x1;var _0x2799c7=JSON['stringify'](_0x592da2);var _0x14d004={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x4f5f2f,'headers':{'Content-Type':'application/json-rpc'},'body':_0x2799c7};return rp(_0x14d004)[_0xecd6('0xd')](function(_0x4b560f){const _0x583f7f=JSON[_0xecd6('0xe')](_0x4b560f);if(!_0x583f7f[_0xecd6('0xf')][_0xecd6('0x10')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0xf863ff=_0x33e8b8;var _0x5469a3='channelId='+_0x2d4bb2+'&serviceId='+_0x4a3c5c+_0xecd6('0x11')+_0xf863ff+_0xecd6('0x12')+JSON[_0xecd6('0x13')](_0x571bb8);var _0x1209ea=_0x5b8fa6+'?'+_0x5469a3;return rp(_0x1209ea);})['then'](function(_0x30a42b){logger[_0xecd6('0x14')](_0xecd6('0x15'),_0x2e4f20,_0x30a42b);_0x22ab7a[_0xecd6('0x16')]();})[_0xecd6('0x17')](function(_0x70ed1b){logger[_0xecd6('0x18')](_0xecd6('0x19'),_0x2e4f20,_['isObject'](_0x70ed1b)?JSON[_0xecd6('0x13')](_0x70ed1b):_0x70ed1b);_0x22ab7a[_0xecd6('0x16')]();});}else{logger[_0xecd6('0x14')](_0xecd6('0x1a'),_0x2e4f20);_0x22ab7a[_0xecd6('0x1b')]();}};}; \ 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 7e7f7b4..98eb3d0 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1fee53,_0x20f514){var _0x5b0cce=function(_0x23a480){while(--_0x23a480){_0x1fee53['push'](_0x1fee53['shift']());}};_0x5b0cce(++_0x20f514);}(_0xe706,0xa3));var _0x6e70=function(_0x4361b6,_0x414635){_0x4361b6=_0x4361b6-0x0;var _0x4c6878=_0xe706[_0x4361b6];return _0x4c6878;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4d62c7,_0x16b698){var _0x328b31=function(_0x2e66bb){while(--_0x2e66bb){_0x4d62c7['push'](_0x4d62c7['shift']());}};_0x328b31(++_0x16b698);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index dc93a75..9be281b 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 _0x7e1d=['on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','info','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','.js','toLowerCase','split','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','getMustacheRender','account','ChatWebsiteId','body','%s:%s:%s','condition','intervals','consequence','priority','Push\x20new\x20rule'];(function(_0x42a9b5,_0xb0bdb8){var _0x3c91e8=function(_0x19f529){while(--_0x19f529){_0x42a9b5['push'](_0x42a9b5['shift']());}};_0x3c91e8(++_0xb0bdb8);}(_0x7e1d,0x15a));var _0xd7e1=function(_0xca6724,_0x5a7acf){_0xca6724=_0xca6724-0x0;var _0xe77a99=_0x7e1d[_0xca6724];return _0xe77a99;};'use strict';var _=require(_0xd7e1('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xd7e1('0x1'));var BPromise=require(_0xd7e1('0x2'));var utils=require(_0xd7e1('0x3'));var sUtils=require(_0xd7e1('0x4'));var logger=require(_0xd7e1('0x5'))(_0xd7e1('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xd7e1('0x7')),'chatQueueReport':require(_0xd7e1('0x8')),'smsQueueReport':require(_0xd7e1('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xd7e1('0xa'))};var RuleEngine=require(_0xd7e1('0xb'));function getId(_0x18c178,_0x3bcb45,_0x158be6){return util[_0xd7e1('0xc')](_0xd7e1('0xd'),_0x18c178,_0x3bcb45||0x0,_0x158be6||0x0);}function getIntervals(_0x51cb1d,_0x1296bb){var _0x3dd9f0=[];if(!_[_0xd7e1('0xe')](_0x1296bb[_0xd7e1('0xf')])&&!_[_0xd7e1('0xe')](_0x51cb1d[_0x1296bb['IntervalId']])&&!_[_0xd7e1('0xe')](_0x51cb1d[_0x1296bb[_0xd7e1('0xf')]]['Intervals'])){_0x3dd9f0=_[_0xd7e1('0x10')](_0x51cb1d[_0x1296bb[_0xd7e1('0xf')]][_0xd7e1('0x11')],_0xd7e1('0x12'));}else if(!_['isNil'](_0x1296bb[_0xd7e1('0x12')])){_0x3dd9f0=[_0x1296bb['interval']];}return _0x3dd9f0;}exports[_0xd7e1('0x13')]=function(_0x8f3ce3){_0x8f3ce3[_0xd7e1('0x14')]={};return new BPromise(function(_0x30ba88,_0x318437){var _0x597836={'Start':function(_0x4e7575){var _0x32b017=this;return new Promise(function(_0x50c79a,_0x29f5e4){if(_0x4e7575){try{var _0x13e51e=[];var _0x47af2b=getId(_0x4e7575[_0xd7e1('0x15')],_0x4e7575['message']?_0x4e7575[_0xd7e1('0x16')]['id']:0x0,_0x4e7575['interaction']?_0x4e7575[_0xd7e1('0x17')]['id']:0x0);var _0xb150c5=sUtils[_0xd7e1('0x18')](_0x8f3ce3,_0x4e7575);if(_0x4e7575['transfer']||!_0xb150c5&&_0x4e7575['applications']&&_['isArray'](_0x4e7575['applications'])&&_0x4e7575[_0xd7e1('0x19')][_0xd7e1('0x1a')]){for(var _0x440aa4=0x0;_0x440aa4<_0x4e7575[_0xd7e1('0x19')][_0xd7e1('0x1a')];_0x440aa4+=0x1){var _0x39e93b=_0x4e7575[_0xd7e1('0x19')][_0x440aa4];if(fs[_0xd7e1('0x1b')](path[_0xd7e1('0x1c')](__dirname,'applications',_0x39e93b[_0xd7e1('0x1d')]+_0xd7e1('0x1e')))){var _0xd55501=[];switch(_0x39e93b[_0xd7e1('0x1d')][_0xd7e1('0x1f')]()){case'autoreply':var _0x2b9918=_0x39e93b['appdata'][_0xd7e1('0x20')](',');if(_0x4e7575[_0xd7e1('0x15')]==='mail'){_0xd55501[_0xd7e1('0x21')](_0x2b9918[0x0]);_0xd55501[_0xd7e1('0x21')](_0x2b9918[0x1]);_0xd55501[_0xd7e1('0x21')](_0x2b9918[_0xd7e1('0x22')](0x2,_0x2b9918['length'])[_0xd7e1('0x1c')](','));}else{_0xd55501[_0xd7e1('0x21')](_0x2b9918[0x0]);_0xd55501[_0xd7e1('0x21')](_0x2b9918[_0xd7e1('0x22')](0x1,_0x2b9918[_0xd7e1('0x1a')])[_0xd7e1('0x1c')](','));}break;case _0xd7e1('0x23'):var _0x596e2e=_0x39e93b[_0xd7e1('0x24')][_0xd7e1('0x20')](',');_0xd55501['push'](_0x596e2e[0x0]);_0xd55501[_0xd7e1('0x21')](_0x596e2e[0x1]);_0xd55501['push'](_0x596e2e['slice'](0x2,_0x596e2e[_0xd7e1('0x1a')])[_0xd7e1('0x1c')](','));break;case _0xd7e1('0x25'):var _0x526cb2=_0x39e93b[_0xd7e1('0x24')]['split'](',');_0xd55501[_0xd7e1('0x21')](_0x526cb2[0x0]);_0xd55501[_0xd7e1('0x21')](_0x526cb2[0x1]);_0xd55501[_0xd7e1('0x21')](_0x526cb2[0x2]);_0xd55501[_0xd7e1('0x21')](_0x526cb2[0x3]);_0xd55501[_0xd7e1('0x21')](_0x526cb2[_0xd7e1('0x22')](0x4,_0x526cb2[_0xd7e1('0x1a')])['join'](','));break;case _0xd7e1('0x26'):var _0x1af1c8=_0x39e93b[_0xd7e1('0x24')]['split'](',');_0xd55501[_0xd7e1('0x21')](_0x1af1c8[0x0]);_0xd55501[_0xd7e1('0x21')](_0x1af1c8[0x1]);_0xd55501[_0xd7e1('0x21')](_0x1af1c8[0x2]);_0xd55501[_0xd7e1('0x21')](_0x1af1c8[0x3]);_0xd55501[_0xd7e1('0x21')](_0x1af1c8[_0xd7e1('0x22')](0x4,_0x1af1c8[_0xd7e1('0x1a')])['join'](','));break;case _0xd7e1('0x16'):_0xd55501[_0xd7e1('0x21')](_0x39e93b[_0xd7e1('0x24')]);break;case _0xd7e1('0x27'):_0xd55501[_0xd7e1('0x21')](_0x39e93b['TagId']);_0xd55501[_0xd7e1('0x21')](_0x39e93b[_0xd7e1('0x24')]);break;case'tvox':var _0x277766=utils[_0xd7e1('0x28')](_0x4e7575[_0xd7e1('0x29')]['notificationTemplate'],_0x4e7575);var _0x199568=_0x39e93b['appdata'][_0xd7e1('0x20')](',');_0xd55501['push'](_0x199568[0x0]);_0xd55501[_0xd7e1('0x21')](_0x199568[0x1]);_0xd55501[_0xd7e1('0x21')](_0x199568[0x2]);_0xd55501['push'](_0x199568[0x3]);_0xd55501[_0xd7e1('0x21')](_0x199568[0x4]);_0xd55501['push'](_0x199568[0x5]);_0xd55501[_0xd7e1('0x21')](_0x199568[0x6]);_0xd55501[_0xd7e1('0x21')](_0x199568[0x7]);_0xd55501['push'](_0x199568[0x8]);_0xd55501[_0xd7e1('0x21')](_0x199568[0x9]);_0xd55501[_0xd7e1('0x21')](_0x199568[0xa]);_0xd55501[_0xd7e1('0x21')](_0x4e7575[_0xd7e1('0x17')]['id']);_0xd55501['push'](_0x4e7575['message']['id']);_0xd55501[_0xd7e1('0x21')](_0x39e93b[_0xd7e1('0x2a')]);_0xd55501[_0xd7e1('0x21')](_0x4e7575[_0xd7e1('0x17')]['ContactId']);_0xd55501[_0xd7e1('0x21')](_0x4e7575[_0xd7e1('0x2b')]['body']);_0xd55501['push'](_0x277766);break;default:_0xd55501=_[_0xd7e1('0xe')](_0x39e93b[_0xd7e1('0x24')])?[]:_0x39e93b[_0xd7e1('0x24')][_0xd7e1('0x20')](',');}var _0x46722e={'id':util[_0xd7e1('0xc')](_0xd7e1('0x2c'),_0x47af2b,_0x39e93b['id'],_0x39e93b[_0xd7e1('0x1d')]),'condition':require('./interval')[_0xd7e1('0x2d')](_0x47af2b,getIntervals(_0x8f3ce3[_0xd7e1('0x2e')],_0x39e93b),_0x8f3ce3),'consequence':require('./applications/'+_0x39e93b[_0xd7e1('0x1d')])[_0xd7e1('0x2f')](_0x47af2b,_0xd55501,_0x8f3ce3,_0x4e7575),'p':_0x39e93b[_0xd7e1('0x30')]||0x0};logger['info'](_0xd7e1('0x31'),_0x46722e['id'],_0xd7e1('0x32'),getIntervals(_0x8f3ce3[_0xd7e1('0x2e')],_0x39e93b)[_0xd7e1('0x1c')](_0xd7e1('0x33')));_0x13e51e['push'](_0x46722e);}else{logger['error'](_0xd7e1('0x34'),path[_0xd7e1('0x1c')](__dirname,_0xd7e1('0x19'),_0x39e93b[_0xd7e1('0x1d')]+_0xd7e1('0x1e')));}}_0x8f3ce3[_0xd7e1('0x14')][_0x47af2b]=new RuleEngine(_0x13e51e);_0x8f3ce3[_0xd7e1('0x14')][_0x47af2b]['execute'](_0x4e7575,function(_0x4ea71e){logger['info'](_0xd7e1('0x35'),JSON['stringify'](_0x4ea71e[_0xd7e1('0x36')]));if(_0x8f3ce3['rules'][_0x47af2b]){_0x8f3ce3[_0xd7e1('0x14')][_0x47af2b]['emit']('complete');}});return _0x50c79a({'code':0xc8,'message':_0x4e7575});}else{if(_0xb150c5){logger[_0xd7e1('0x37')](util[_0xd7e1('0xc')](_0xd7e1('0x38'),_0x47af2b));}else{logger[_0xd7e1('0x37')](_0xd7e1('0x39'));}return _0x50c79a({'code':0xc8,'message':_0x4e7575});}}catch(_0x240fa3){logger[_0xd7e1('0x3a')](_0x240fa3[_0xd7e1('0x3b')]);return _0x29f5e4(_0x32b017[_0xd7e1('0x3a')](0x1f4,_0x240fa3));}}return _0x29f5e4(_0xd7e1('0x3c'));});},'AcceptMessage':function(_0x935b){var _0x324851=this;return new Promise(function(_0x36c685,_0x3de6f8){if(_0x935b[_0xd7e1('0x3d')]&&_0x935b['agent']['id']){if(_0x8f3ce3[_0xd7e1('0x3e')][_0x935b['agent']['id']]){_0x8f3ce3[_0xd7e1('0x3e')][_0x935b['agent']['id']]['busy']=![];_0x8f3ce3[_0xd7e1('0x3e')][_0x935b[_0xd7e1('0x3d')]['id']][_0xd7e1('0x3f')]=undefined;}}if(_0x935b[_0xd7e1('0x16')]&&_0x935b[_0xd7e1('0x16')]['id']){try{var _0x4836ec=getId(_0x935b['channel'],_0x935b['message']?_0x935b[_0xd7e1('0x16')]['id']:0x0,_0x935b[_0xd7e1('0x17')]?_0x935b[_0xd7e1('0x17')]['id']:0x0);if(_0x8f3ce3[_0xd7e1('0x14')][_0x4836ec]){_0x8f3ce3[_0xd7e1('0x14')][_0x4836ec]['emit'](_0xd7e1('0x40'));if(rpc[_0x935b['channel']+_0xd7e1('0x41')]){rpc[_0x935b[_0xd7e1('0x15')]+_0xd7e1('0x41')][_0xd7e1('0x42')](_0x4836ec,{'UserId':_0x935b[_0xd7e1('0x16')]['UserId']})[_0xd7e1('0x43')](function(){logger['error'](_0xd7e1('0x44'));});}}return _0x36c685({'code':0xc8,'message':_0x935b});}catch(_0x5e28e3){logger[_0xd7e1('0x3a')](_0x5e28e3[_0xd7e1('0x3b')]);return _0x3de6f8(_0x324851[_0xd7e1('0x3a')](0x1f4,_0x5e28e3));}}logger[_0xd7e1('0x3a')](_0xd7e1('0x45'));return _0x3de6f8(_0x324851[_0xd7e1('0x3a')](0x1f4,_0xd7e1('0x45')));});},'RejectMessage':function(_0x7183a7){var _0xecdd8f=this;return new Promise(function(_0xe72b2d,_0x4f640f){if(_0x7183a7[_0xd7e1('0x3d')]&&_0x7183a7[_0xd7e1('0x3d')]['id']){try{if(_0x8f3ce3[_0xd7e1('0x3e')][_0x7183a7[_0xd7e1('0x3d')]['id']]){_0x8f3ce3[_0xd7e1('0x3e')][_0x7183a7[_0xd7e1('0x3d')]['id']]['busy']=![];_0x8f3ce3[_0xd7e1('0x3e')][_0x7183a7[_0xd7e1('0x3d')]['id']][_0xd7e1('0x3f')]=undefined;}return _0xe72b2d({'code':0xc8,'message':_0x7183a7});}catch(_0x2ec66d){logger['error'](_0x2ec66d[_0xd7e1('0x3b')]);return _0x4f640f(_0xecdd8f[_0xd7e1('0x3a')](0x1f4,_0x2ec66d));}}logger['error']('message\x20is\x20empty');return _0x4f640f(_0xecdd8f[_0xd7e1('0x3a')](0x1f4,_0xd7e1('0x45')));});},'AbandonInteraction':function(_0x50f1bc){var _0x11ffe7=this;return new Promise(function(_0x4a8c24,_0x15e4ff){if(_0x50f1bc[_0xd7e1('0x15')]&&_0x50f1bc[_0xd7e1('0x17')]&&_0x50f1bc['interaction']['id']){try{var _0x14de5a=getId(_0x50f1bc['channel'],_0x50f1bc[_0xd7e1('0x16')]?_0x50f1bc[_0xd7e1('0x16')]['id']:0x0,_0x50f1bc['interaction']?_0x50f1bc[_0xd7e1('0x17')]['id']:0x0);if(_0x8f3ce3[_0xd7e1('0x14')][_0x14de5a]){_0x8f3ce3[_0xd7e1('0x14')][_0x14de5a][_0xd7e1('0x46')](_0xd7e1('0x40'));}return _0x4a8c24({'code':0xc8,'message':_0x50f1bc});}catch(_0x436d6d){logger[_0xd7e1('0x3a')](_0x436d6d['stack']);return _0x15e4ff(_0x11ffe7[_0xd7e1('0x3a')](0x1f4,_0x436d6d));}}logger['error']('message\x20is\x20empty');return _0x15e4ff(_0x11ffe7['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x32801a){var _0x2059e4=this;return new Promise(function(_0x3de1dc,_0x509c08){if(_0x8f3ce3[_0xd7e1('0x3e')][_0xd7e1('0x47')](_0x32801a['id'])){for(var _0x2c4c36 in _0x32801a['capacity']){if(_0x32801a['capacity'][_0xd7e1('0x47')](_0x2c4c36)){if(_0x8f3ce3['agents'][_0x32801a['id']][_0xd7e1('0x47')](_0x2c4c36+_0xd7e1('0x48'))){_0x8f3ce3[_0xd7e1('0x3e')][_0x32801a['id']][_0x2c4c36+_0xd7e1('0x48')]=parseInt(_0x32801a[_0xd7e1('0x49')][_0x2c4c36],0xa);}}}_0x8f3ce3['agents'][_0x32801a['id']][_0xd7e1('0x4a')]();return _0x3de1dc({'code':0xc8,'message':_0x8f3ce3[_0xd7e1('0x3e')][_0x32801a['id']]});}else{return _0x509c08(_0x2059e4['error'](0x1f4,_0xd7e1('0x4b')));}});},'Agents':function(_0x1d4881){return new Promise(function(_0x912b4b){var _0x1798f9=_[_0xd7e1('0x4c')](_0x8f3ce3[_0xd7e1('0x3e')]);if(_0x1d4881&&_0x1d4881['id']){var _0x468e41=_[_0xd7e1('0x4d')](_0x1798f9,function(_0xac932f){return _0xac932f['id']===_0x1d4881['id'];});_0x912b4b(_0x468e41);}else{_0x912b4b({'count':_0x1798f9[_0xd7e1('0x1a')],'rows':_0x1798f9});}});},'ChatQueues':function(){return new Promise(function(_0x287afe){var _0x9ad75c=[];for(var _0x40e546 in _0x8f3ce3[_0xd7e1('0x4e')]){if(_0x8f3ce3[_0xd7e1('0x4e')][_0xd7e1('0x47')](_0x40e546)){var _0xc9f314=_0x8f3ce3[_0xd7e1('0x4e')][_0x40e546];var _0x5199ff={'id':_0xc9f314['id'],'available':_0xc9f314['available'],'loggedIn':_0xc9f314[_0xd7e1('0x4f')],'name':_0xc9f314[_0xd7e1('0x50')],'paused':_0xc9f314[_0xd7e1('0x51')],'waiting':_0xc9f314[_0xd7e1('0x52')]};_0x9ad75c[_0xd7e1('0x21')](_0x5199ff);}}_0x287afe({'count':_0x9ad75c[_0xd7e1('0x1a')],'rows':_0x9ad75c});});},'MailQueues':function(){return new Promise(function(_0x5b007a){var _0x22bb50=[];for(var _0xcf31ff in _0x8f3ce3['mailQueues']){if(_0x8f3ce3[_0xd7e1('0x53')]['hasOwnProperty'](_0xcf31ff)){var _0x340a22=_0x8f3ce3[_0xd7e1('0x53')][_0xcf31ff];var _0x1c5bd3={'id':_0x340a22['id'],'available':_0x340a22['available'],'loggedIn':_0x340a22[_0xd7e1('0x4f')],'name':_0x340a22['name'],'paused':_0x340a22['paused'],'waiting':_0x340a22['waiting']};_0x22bb50[_0xd7e1('0x21')](_0x1c5bd3);}}_0x5b007a({'count':_0x22bb50[_0xd7e1('0x1a')],'rows':_0x22bb50});});},'OpenchannelQueues':function(){return new Promise(function(_0x22d03e){var _0x221525=[];for(var _0x572e73 in _0x8f3ce3[_0xd7e1('0x54')]){if(_0x8f3ce3[_0xd7e1('0x54')][_0xd7e1('0x47')](_0x572e73)){var _0x116cdf=_0x8f3ce3['openchannelQueues'][_0x572e73];var _0x4209b6={'id':_0x116cdf['id'],'available':_0x116cdf[_0xd7e1('0x55')],'loggedIn':_0x116cdf[_0xd7e1('0x4f')],'name':_0x116cdf[_0xd7e1('0x50')],'paused':_0x116cdf[_0xd7e1('0x51')],'waiting':_0x116cdf[_0xd7e1('0x52')]};_0x221525['push'](_0x4209b6);}}_0x22d03e({'count':_0x221525[_0xd7e1('0x1a')],'rows':_0x221525});});},'SmsQueues':function(){return new Promise(function(_0x5de3cd){var _0x4fa0a3=[];for(var _0x300488 in _0x8f3ce3[_0xd7e1('0x56')]){if(_0x8f3ce3[_0xd7e1('0x56')][_0xd7e1('0x47')](_0x300488)){var _0xce7390=_0x8f3ce3[_0xd7e1('0x56')][_0x300488];var _0x2b9410={'id':_0xce7390['id'],'available':_0xce7390[_0xd7e1('0x55')],'loggedIn':_0xce7390[_0xd7e1('0x4f')],'name':_0xce7390['name'],'paused':_0xce7390['paused'],'waiting':_0xce7390['waiting']};_0x4fa0a3[_0xd7e1('0x21')](_0x2b9410);}}_0x5de3cd({'count':_0x4fa0a3['length'],'rows':_0x4fa0a3});});},'FaxQueues':function(){return new Promise(function(_0x3887e8){var _0xe62d56=[];for(var _0x4e1d49 in _0x8f3ce3['faxQueues']){if(_0x8f3ce3['faxQueues']['hasOwnProperty'](_0x4e1d49)){var _0x2fe78f=_0x8f3ce3[_0xd7e1('0x57')][_0x4e1d49];var _0x590800={'id':_0x2fe78f['id'],'available':_0x2fe78f[_0xd7e1('0x55')],'loggedIn':_0x2fe78f[_0xd7e1('0x4f')],'name':_0x2fe78f[_0xd7e1('0x50')],'paused':_0x2fe78f[_0xd7e1('0x51')],'waiting':_0x2fe78f[_0xd7e1('0x52')]};_0xe62d56[_0xd7e1('0x21')](_0x590800);}}_0x3887e8({'count':_0xe62d56[_0xd7e1('0x1a')],'rows':_0xe62d56});});},'WhatsappQueues':function(){return new Promise(function(_0xe59c1f){var _0x3f8650=[];for(var _0x57aaef in _0x8f3ce3[_0xd7e1('0x58')]){if(_0x8f3ce3[_0xd7e1('0x58')][_0xd7e1('0x47')](_0x57aaef)){var _0x5b38d5=_0x8f3ce3[_0xd7e1('0x58')][_0x57aaef];var _0x2acdb5={'id':_0x5b38d5['id'],'available':_0x5b38d5['available'],'loggedIn':_0x5b38d5['loggedIn'],'name':_0x5b38d5['name'],'paused':_0x5b38d5[_0xd7e1('0x51')],'waiting':_0x5b38d5['waiting']};_0x3f8650[_0xd7e1('0x21')](_0x2acdb5);}}_0xe59c1f({'count':_0x3f8650[_0xd7e1('0x1a')],'rows':_0x3f8650});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1a9dfa){var _0x14770e=_[_0xd7e1('0x4c')](_0x8f3ce3[_0xd7e1('0x59')]);_0x1a9dfa({'count':_0x14770e['length'],'rows':_0x14770e});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5c8207){var _0x363ded=_[_0xd7e1('0x4c')](_0x8f3ce3['mailQueuesWaitingInteractions']);_0x5c8207({'count':_0x363ded['length'],'rows':_0x363ded});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x176c1a){var _0x5ca0c1=_[_0xd7e1('0x4c')](_0x8f3ce3[_0xd7e1('0x5a')]);_0x176c1a({'count':_0x5ca0c1['length'],'rows':_0x5ca0c1});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x29dc26){var _0x1ea725=_[_0xd7e1('0x4c')](_0x8f3ce3[_0xd7e1('0x5b')]);_0x29dc26({'count':_0x1ea725[_0xd7e1('0x1a')],'rows':_0x1ea725});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1a2ce4){var _0x2cde53=_[_0xd7e1('0x4c')](_0x8f3ce3[_0xd7e1('0x5c')]);_0x1a2ce4({'count':_0x2cde53[_0xd7e1('0x1a')],'rows':_0x2cde53});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1f9a71){var _0x509fb4=_[_0xd7e1('0x4c')](_0x8f3ce3['whatsappQueuesWaitingInteractions']);_0x1f9a71({'count':_0x509fb4[_0xd7e1('0x1a')],'rows':_0x509fb4});});}};var _0x13f6e1=jayson[_0xd7e1('0x5d')](_0x597836)[_0xd7e1('0x5e')]();_0x13f6e1['on']('error',function(_0xe123d7){logger['error'](JSON['stringify'](_0xe123d7));return _0x318437(_0xe123d7);});_0x13f6e1[_0xd7e1('0x13')](0x232c,_0xd7e1('0x5f'),function(){console[_0xd7e1('0x60')](_0xd7e1('0x61'),0x232c);return _0x30ba88(_0xd7e1('0x62')+0x232c);});});}; \ No newline at end of file +var _0x3189=['jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','rules','channel','message','checkWaitingNotifications','transfer','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','mail','push','slice','split','dialogflowv2','amazonlex','tag','tvox','notificationTemplate','interaction','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','path'];(function(_0x3b3d5f,_0x31fdc4){var _0x227dad=function(_0x2739a6){while(--_0x2739a6){_0x3b3d5f['push'](_0x3b3d5f['shift']());}};_0x227dad(++_0x31fdc4);}(_0x3189,0x19a));var _0x9318=function(_0x39a031,_0x2dc4e4){_0x39a031=_0x39a031-0x0;var _0x3a5988=_0x3189[_0x39a031];return _0x3a5988;};'use strict';var _=require(_0x9318('0x0'));var util=require('util');var path=require(_0x9318('0x1'));var fs=require('fs');var jayson=require(_0x9318('0x2'));var BPromise=require(_0x9318('0x3'));var utils=require(_0x9318('0x4'));var sUtils=require(_0x9318('0x5'));var logger=require('../../../config/logger')(_0x9318('0x6'));var rpc={'openchannelQueueReport':require(_0x9318('0x7')),'mailQueueReport':require(_0x9318('0x8')),'chatQueueReport':require(_0x9318('0x9')),'smsQueueReport':require(_0x9318('0xa')),'faxQueueReport':require(_0x9318('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x9318('0xc'));function getId(_0x47cc66,_0x582fe9,_0x2deb10){return util[_0x9318('0xd')]('%s.%s.%s',_0x47cc66,_0x582fe9||0x0,_0x2deb10||0x0);}function getIntervals(_0x2b883e,_0xbf34cf){var _0x194853=[];if(!_[_0x9318('0xe')](_0xbf34cf[_0x9318('0xf')])&&!_[_0x9318('0xe')](_0x2b883e[_0xbf34cf[_0x9318('0xf')]])&&!_[_0x9318('0xe')](_0x2b883e[_0xbf34cf['IntervalId']][_0x9318('0x10')])){_0x194853=_[_0x9318('0x11')](_0x2b883e[_0xbf34cf[_0x9318('0xf')]][_0x9318('0x10')],_0x9318('0x12'));}else if(!_[_0x9318('0xe')](_0xbf34cf[_0x9318('0x12')])){_0x194853=[_0xbf34cf['interval']];}return _0x194853;}exports['listen']=function(_0x348f3e){_0x348f3e[_0x9318('0x13')]={};return new BPromise(function(_0x2ba5bd,_0x16ea41){var _0x3b988b={'Start':function(_0x296844){var _0x1d38de=this;return new Promise(function(_0x1113bf,_0x15dc1f){if(_0x296844){try{var _0x330dad=[];var _0x9cecf8=getId(_0x296844[_0x9318('0x14')],_0x296844['message']?_0x296844[_0x9318('0x15')]['id']:0x0,_0x296844['interaction']?_0x296844['interaction']['id']:0x0);var _0x1e1b06=sUtils[_0x9318('0x16')](_0x348f3e,_0x296844);if(_0x296844[_0x9318('0x17')]||!_0x1e1b06&&_0x296844[_0x9318('0x18')]&&_['isArray'](_0x296844[_0x9318('0x18')])&&_0x296844[_0x9318('0x18')]['length']){for(var _0x17fcc2=0x0;_0x17fcc2<_0x296844[_0x9318('0x18')][_0x9318('0x19')];_0x17fcc2+=0x1){var _0x3fd16c=_0x296844[_0x9318('0x18')][_0x17fcc2];if(fs[_0x9318('0x1a')](path[_0x9318('0x1b')](__dirname,'applications',_0x3fd16c[_0x9318('0x1c')]+'.js'))){var _0x54a52f=[];switch(_0x3fd16c[_0x9318('0x1c')][_0x9318('0x1d')]()){case _0x9318('0x1e'):var _0x5aad82=_0x3fd16c[_0x9318('0x1f')]['split'](',');if(_0x296844[_0x9318('0x14')]===_0x9318('0x20')){_0x54a52f[_0x9318('0x21')](_0x5aad82[0x0]);_0x54a52f[_0x9318('0x21')](_0x5aad82[0x1]);_0x54a52f[_0x9318('0x21')](_0x5aad82[_0x9318('0x22')](0x2,_0x5aad82[_0x9318('0x19')])[_0x9318('0x1b')](','));}else{_0x54a52f[_0x9318('0x21')](_0x5aad82[0x0]);_0x54a52f[_0x9318('0x21')](_0x5aad82[_0x9318('0x22')](0x1,_0x5aad82[_0x9318('0x19')])[_0x9318('0x1b')](','));}break;case'dialogflow':var _0x55beda=_0x3fd16c['appdata'][_0x9318('0x23')](',');_0x54a52f[_0x9318('0x21')](_0x55beda[0x0]);_0x54a52f[_0x9318('0x21')](_0x55beda[0x1]);_0x54a52f[_0x9318('0x21')](_0x55beda['slice'](0x2,_0x55beda[_0x9318('0x19')])[_0x9318('0x1b')](','));break;case _0x9318('0x24'):var _0x3d79e7=_0x3fd16c['appdata'][_0x9318('0x23')](',');_0x54a52f['push'](_0x3d79e7[0x0]);_0x54a52f[_0x9318('0x21')](_0x3d79e7[0x1]);_0x54a52f[_0x9318('0x21')](_0x3d79e7[0x2]);_0x54a52f['push'](_0x3d79e7[0x3]);_0x54a52f['push'](_0x3d79e7['slice'](0x4,_0x3d79e7[_0x9318('0x19')])[_0x9318('0x1b')](','));break;case _0x9318('0x25'):var _0x45e119=_0x3fd16c[_0x9318('0x1f')][_0x9318('0x23')](',');_0x54a52f['push'](_0x45e119[0x0]);_0x54a52f[_0x9318('0x21')](_0x45e119[0x1]);_0x54a52f['push'](_0x45e119[0x2]);_0x54a52f['push'](_0x45e119[0x3]);_0x54a52f['push'](_0x45e119[_0x9318('0x22')](0x4,_0x45e119[_0x9318('0x19')])[_0x9318('0x1b')](','));break;case _0x9318('0x15'):_0x54a52f[_0x9318('0x21')](_0x3fd16c['appdata']);break;case _0x9318('0x26'):_0x54a52f[_0x9318('0x21')](_0x3fd16c['TagId']);_0x54a52f[_0x9318('0x21')](_0x3fd16c[_0x9318('0x1f')]);break;case _0x9318('0x27'):var _0x6581e4=utils['getMustacheRender'](_0x296844['account'][_0x9318('0x28')],_0x296844);var _0x43f1d2=_0x3fd16c[_0x9318('0x1f')][_0x9318('0x23')](',');_0x54a52f[_0x9318('0x21')](_0x43f1d2[0x0]);_0x54a52f[_0x9318('0x21')](_0x43f1d2[0x1]);_0x54a52f[_0x9318('0x21')](_0x43f1d2[0x2]);_0x54a52f['push'](_0x43f1d2[0x3]);_0x54a52f[_0x9318('0x21')](_0x43f1d2[0x4]);_0x54a52f[_0x9318('0x21')](_0x43f1d2[0x5]);_0x54a52f[_0x9318('0x21')](_0x43f1d2[0x6]);_0x54a52f[_0x9318('0x21')](_0x43f1d2[0x7]);_0x54a52f['push'](_0x43f1d2[0x8]);_0x54a52f[_0x9318('0x21')](_0x43f1d2[0x9]);_0x54a52f[_0x9318('0x21')](_0x43f1d2[0xa]);_0x54a52f[_0x9318('0x21')](_0x296844[_0x9318('0x29')]['id']);_0x54a52f[_0x9318('0x21')](_0x296844[_0x9318('0x15')]['id']);_0x54a52f[_0x9318('0x21')](_0x3fd16c[_0x9318('0x2a')]);_0x54a52f[_0x9318('0x21')](_0x296844[_0x9318('0x29')][_0x9318('0x2b')]);_0x54a52f[_0x9318('0x21')](_0x296844[_0x9318('0x2c')][_0x9318('0x2c')]);_0x54a52f[_0x9318('0x21')](_0x6581e4);break;default:_0x54a52f=_[_0x9318('0xe')](_0x3fd16c[_0x9318('0x1f')])?[]:_0x3fd16c[_0x9318('0x1f')][_0x9318('0x23')](',');}var _0x831e49={'id':util[_0x9318('0xd')](_0x9318('0x2d'),_0x9cecf8,_0x3fd16c['id'],_0x3fd16c['app']),'condition':require(_0x9318('0x2e'))[_0x9318('0x2f')](_0x9cecf8,getIntervals(_0x348f3e[_0x9318('0x30')],_0x3fd16c),_0x348f3e),'consequence':require(_0x9318('0x31')+_0x3fd16c['app'])[_0x9318('0x32')](_0x9cecf8,_0x54a52f,_0x348f3e,_0x296844),'p':_0x3fd16c[_0x9318('0x33')]||0x0};logger[_0x9318('0x34')](_0x9318('0x35'),_0x831e49['id'],_0x9318('0x36'),getIntervals(_0x348f3e['intervals'],_0x3fd16c)[_0x9318('0x1b')](_0x9318('0x37')));_0x330dad[_0x9318('0x21')](_0x831e49);}else{logger[_0x9318('0x38')](_0x9318('0x39'),path[_0x9318('0x1b')](__dirname,_0x9318('0x18'),_0x3fd16c[_0x9318('0x1c')]+_0x9318('0x3a')));}}_0x348f3e[_0x9318('0x13')][_0x9cecf8]=new RuleEngine(_0x330dad);_0x348f3e['rules'][_0x9cecf8][_0x9318('0x3b')](_0x296844,function(_0x696089){logger[_0x9318('0x34')](_0x9318('0x3c'),JSON['stringify'](_0x696089[_0x9318('0x3d')]));if(_0x348f3e[_0x9318('0x13')][_0x9cecf8]){_0x348f3e['rules'][_0x9cecf8][_0x9318('0x3e')](_0x9318('0x3f'));}});return _0x1113bf({'code':0xc8,'message':_0x296844});}else{if(_0x1e1b06){logger[_0x9318('0x34')](util[_0x9318('0xd')](_0x9318('0x40'),_0x9cecf8));}else{logger[_0x9318('0x34')]('No\x20applications\x20to\x20execute');}return _0x1113bf({'code':0xc8,'message':_0x296844});}}catch(_0x1c524f){logger[_0x9318('0x38')](_0x1c524f[_0x9318('0x41')]);return _0x15dc1f(_0x1d38de[_0x9318('0x38')](0x1f4,_0x1c524f));}}return _0x15dc1f(_0x9318('0x42'));});},'AcceptMessage':function(_0x51e935){var _0x295eb2=this;return new Promise(function(_0x575cb8,_0x3ef00b){if(_0x51e935[_0x9318('0x43')]&&_0x51e935[_0x9318('0x43')]['id']){if(_0x348f3e[_0x9318('0x44')][_0x51e935['agent']['id']]){_0x348f3e[_0x9318('0x44')][_0x51e935['agent']['id']][_0x9318('0x45')]=![];_0x348f3e[_0x9318('0x44')][_0x51e935[_0x9318('0x43')]['id']][_0x9318('0x46')]=undefined;}}if(_0x51e935[_0x9318('0x15')]&&_0x51e935['message']['id']){try{var _0x4e29fc=getId(_0x51e935[_0x9318('0x14')],_0x51e935['message']?_0x51e935[_0x9318('0x15')]['id']:0x0,_0x51e935[_0x9318('0x29')]?_0x51e935['interaction']['id']:0x0);if(_0x348f3e[_0x9318('0x13')][_0x4e29fc]){_0x348f3e[_0x9318('0x13')][_0x4e29fc]['emit'](_0x9318('0x47'));if(rpc[_0x51e935[_0x9318('0x14')]+_0x9318('0x48')]){rpc[_0x51e935[_0x9318('0x14')]+_0x9318('0x48')][_0x9318('0x49')](_0x4e29fc,{'UserId':_0x51e935[_0x9318('0x15')][_0x9318('0x4a')]})['catch'](function(){logger[_0x9318('0x38')](_0x9318('0x4b'));});}}return _0x575cb8({'code':0xc8,'message':_0x51e935});}catch(_0x360340){logger['error'](_0x360340[_0x9318('0x41')]);return _0x3ef00b(_0x295eb2['error'](0x1f4,_0x360340));}}logger['error'](_0x9318('0x4c'));return _0x3ef00b(_0x295eb2[_0x9318('0x38')](0x1f4,_0x9318('0x4c')));});},'RejectMessage':function(_0x5123be){var _0x3203da=this;return new Promise(function(_0x326c4a,_0x537b7a){if(_0x5123be[_0x9318('0x43')]&&_0x5123be['agent']['id']){try{if(_0x348f3e[_0x9318('0x44')][_0x5123be[_0x9318('0x43')]['id']]){_0x348f3e[_0x9318('0x44')][_0x5123be[_0x9318('0x43')]['id']][_0x9318('0x45')]=![];_0x348f3e['agents'][_0x5123be[_0x9318('0x43')]['id']]['busyQueue']=undefined;}return _0x326c4a({'code':0xc8,'message':_0x5123be});}catch(_0x2c6ea7){logger[_0x9318('0x38')](_0x2c6ea7[_0x9318('0x41')]);return _0x537b7a(_0x3203da['error'](0x1f4,_0x2c6ea7));}}logger[_0x9318('0x38')]('message\x20is\x20empty');return _0x537b7a(_0x3203da['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x163ad5){var _0x544bf9=this;return new Promise(function(_0x4ee2a2,_0x357ed1){if(_0x163ad5[_0x9318('0x14')]&&_0x163ad5[_0x9318('0x29')]&&_0x163ad5['interaction']['id']){try{var _0x354bae=getId(_0x163ad5[_0x9318('0x14')],_0x163ad5['message']?_0x163ad5[_0x9318('0x15')]['id']:0x0,_0x163ad5[_0x9318('0x29')]?_0x163ad5['interaction']['id']:0x0);if(_0x348f3e['rules'][_0x354bae]){_0x348f3e[_0x9318('0x13')][_0x354bae][_0x9318('0x3e')](_0x9318('0x47'));}return _0x4ee2a2({'code':0xc8,'message':_0x163ad5});}catch(_0x14bdec){logger[_0x9318('0x38')](_0x14bdec[_0x9318('0x41')]);return _0x357ed1(_0x544bf9[_0x9318('0x38')](0x1f4,_0x14bdec));}}logger[_0x9318('0x38')](_0x9318('0x4c'));return _0x357ed1(_0x544bf9[_0x9318('0x38')](0x1f4,_0x9318('0x4c')));});},'AgentCapacity':function(_0x1ddef5){var _0x3f4810=this;return new Promise(function(_0x53e15f,_0x1515a2){if(_0x348f3e['agents'][_0x9318('0x4d')](_0x1ddef5['id'])){for(var _0x2ce546 in _0x1ddef5[_0x9318('0x4e')]){if(_0x1ddef5[_0x9318('0x4e')]['hasOwnProperty'](_0x2ce546)){if(_0x348f3e[_0x9318('0x44')][_0x1ddef5['id']][_0x9318('0x4d')](_0x2ce546+_0x9318('0x4f'))){_0x348f3e['agents'][_0x1ddef5['id']][_0x2ce546+_0x9318('0x4f')]=parseInt(_0x1ddef5[_0x9318('0x4e')][_0x2ce546],0xa);}}}_0x348f3e['agents'][_0x1ddef5['id']]['updateRealtime']();return _0x53e15f({'code':0xc8,'message':_0x348f3e[_0x9318('0x44')][_0x1ddef5['id']]});}else{return _0x1515a2(_0x3f4810['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xd39d1c){return new Promise(function(_0x25ce53){var _0x449088=_[_0x9318('0x50')](_0x348f3e[_0x9318('0x44')]);if(_0xd39d1c&&_0xd39d1c['id']){var _0x277ab5=_['find'](_0x449088,function(_0x3303dc){return _0x3303dc['id']===_0xd39d1c['id'];});_0x25ce53(_0x277ab5);}else{_0x25ce53({'count':_0x449088['length'],'rows':_0x449088});}});},'ChatQueues':function(){return new Promise(function(_0x50c1c2){var _0x3a795a=[];for(var _0x492765 in _0x348f3e['chatQueues']){if(_0x348f3e[_0x9318('0x51')][_0x9318('0x4d')](_0x492765)){var _0x43fece=_0x348f3e[_0x9318('0x51')][_0x492765];var _0x5bd41c={'id':_0x43fece['id'],'available':_0x43fece[_0x9318('0x52')],'loggedIn':_0x43fece['loggedIn'],'name':_0x43fece['name'],'paused':_0x43fece[_0x9318('0x53')],'waiting':_0x43fece[_0x9318('0x54')]};_0x3a795a[_0x9318('0x21')](_0x5bd41c);}}_0x50c1c2({'count':_0x3a795a[_0x9318('0x19')],'rows':_0x3a795a});});},'MailQueues':function(){return new Promise(function(_0x283b39){var _0x1fd4d1=[];for(var _0x4d0c1f in _0x348f3e[_0x9318('0x55')]){if(_0x348f3e['mailQueues'][_0x9318('0x4d')](_0x4d0c1f)){var _0x46ed6c=_0x348f3e[_0x9318('0x55')][_0x4d0c1f];var _0x491075={'id':_0x46ed6c['id'],'available':_0x46ed6c['available'],'loggedIn':_0x46ed6c[_0x9318('0x56')],'name':_0x46ed6c[_0x9318('0x57')],'paused':_0x46ed6c[_0x9318('0x53')],'waiting':_0x46ed6c[_0x9318('0x54')]};_0x1fd4d1['push'](_0x491075);}}_0x283b39({'count':_0x1fd4d1[_0x9318('0x19')],'rows':_0x1fd4d1});});},'OpenchannelQueues':function(){return new Promise(function(_0x349db9){var _0x1046b8=[];for(var _0xe10ae5 in _0x348f3e[_0x9318('0x58')]){if(_0x348f3e[_0x9318('0x58')][_0x9318('0x4d')](_0xe10ae5)){var _0x3bcee2=_0x348f3e['openchannelQueues'][_0xe10ae5];var _0x25bc31={'id':_0x3bcee2['id'],'available':_0x3bcee2[_0x9318('0x52')],'loggedIn':_0x3bcee2[_0x9318('0x56')],'name':_0x3bcee2[_0x9318('0x57')],'paused':_0x3bcee2[_0x9318('0x53')],'waiting':_0x3bcee2[_0x9318('0x54')]};_0x1046b8[_0x9318('0x21')](_0x25bc31);}}_0x349db9({'count':_0x1046b8[_0x9318('0x19')],'rows':_0x1046b8});});},'SmsQueues':function(){return new Promise(function(_0x28525e){var _0x5763fd=[];for(var _0x4f3ed8 in _0x348f3e[_0x9318('0x59')]){if(_0x348f3e[_0x9318('0x59')]['hasOwnProperty'](_0x4f3ed8)){var _0x1574d9=_0x348f3e[_0x9318('0x59')][_0x4f3ed8];var _0x5e3685={'id':_0x1574d9['id'],'available':_0x1574d9[_0x9318('0x52')],'loggedIn':_0x1574d9['loggedIn'],'name':_0x1574d9[_0x9318('0x57')],'paused':_0x1574d9[_0x9318('0x53')],'waiting':_0x1574d9[_0x9318('0x54')]};_0x5763fd['push'](_0x5e3685);}}_0x28525e({'count':_0x5763fd[_0x9318('0x19')],'rows':_0x5763fd});});},'FaxQueues':function(){return new Promise(function(_0x4c536){var _0x59051b=[];for(var _0x5783d6 in _0x348f3e[_0x9318('0x5a')]){if(_0x348f3e[_0x9318('0x5a')]['hasOwnProperty'](_0x5783d6)){var _0x55f6ef=_0x348f3e['faxQueues'][_0x5783d6];var _0x5cdeee={'id':_0x55f6ef['id'],'available':_0x55f6ef[_0x9318('0x52')],'loggedIn':_0x55f6ef['loggedIn'],'name':_0x55f6ef[_0x9318('0x57')],'paused':_0x55f6ef[_0x9318('0x53')],'waiting':_0x55f6ef[_0x9318('0x54')]};_0x59051b[_0x9318('0x21')](_0x5cdeee);}}_0x4c536({'count':_0x59051b[_0x9318('0x19')],'rows':_0x59051b});});},'WhatsappQueues':function(){return new Promise(function(_0x9614c2){var _0xef032d=[];for(var _0x62c862 in _0x348f3e[_0x9318('0x5b')]){if(_0x348f3e[_0x9318('0x5b')][_0x9318('0x4d')](_0x62c862)){var _0x154d34=_0x348f3e[_0x9318('0x5b')][_0x62c862];var _0x1030c1={'id':_0x154d34['id'],'available':_0x154d34[_0x9318('0x52')],'loggedIn':_0x154d34[_0x9318('0x56')],'name':_0x154d34['name'],'paused':_0x154d34[_0x9318('0x53')],'waiting':_0x154d34[_0x9318('0x54')]};_0xef032d['push'](_0x1030c1);}}_0x9614c2({'count':_0xef032d[_0x9318('0x19')],'rows':_0xef032d});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x6ef04f){var _0x448954=_[_0x9318('0x50')](_0x348f3e[_0x9318('0x5c')]);_0x6ef04f({'count':_0x448954[_0x9318('0x19')],'rows':_0x448954});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x282a35){var _0xed2428=_['values'](_0x348f3e[_0x9318('0x5d')]);_0x282a35({'count':_0xed2428[_0x9318('0x19')],'rows':_0xed2428});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x248393){var _0x173d67=_[_0x9318('0x50')](_0x348f3e[_0x9318('0x5e')]);_0x248393({'count':_0x173d67['length'],'rows':_0x173d67});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x342f84){var _0x9a3517=_[_0x9318('0x50')](_0x348f3e[_0x9318('0x5f')]);_0x342f84({'count':_0x9a3517[_0x9318('0x19')],'rows':_0x9a3517});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xda7df9){var _0x4db911=_['values'](_0x348f3e[_0x9318('0x60')]);_0xda7df9({'count':_0x4db911[_0x9318('0x19')],'rows':_0x4db911});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5641eb){var _0x492eb4=_['values'](_0x348f3e[_0x9318('0x61')]);_0x5641eb({'count':_0x492eb4[_0x9318('0x19')],'rows':_0x492eb4});});}};var _0xecc721=jayson['server'](_0x3b988b)[_0x9318('0x62')]();_0xecc721['on'](_0x9318('0x38'),function(_0xb58942){logger[_0x9318('0x38')](JSON[_0x9318('0x63')](_0xb58942));return _0x16ea41(_0xb58942);});_0xecc721['listen'](0x232c,_0x9318('0x64'),function(){console[_0x9318('0x65')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2ba5bd(_0x9318('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 543defe..8f934f3 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 _0x68da=['iftime','../../../config/logger','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','\x20|\x20','lodash','../../../utils/iftime'];(function(_0x538d29,_0x1cbe2e){var _0xcd37b8=function(_0x1c96e0){while(--_0x1c96e0){_0x538d29['push'](_0x538d29['shift']());}};_0xcd37b8(++_0x1cbe2e);}(_0x68da,0x94));var _0xa68d=function(_0x44784c,_0x4498c1){_0x44784c=_0x44784c-0x0;var _0x4bbfb1=_0x68da[_0x44784c];return _0x4bbfb1;};'use strict';var _=require(_0xa68d('0x0'));var iftime=require(_0xa68d('0x1'))[_0xa68d('0x2')];var logger=require(_0xa68d('0x3'))('routing');exports[_0xa68d('0x4')]=function(_0x1fc6d7,_0x135369,_0x2497da){return function(_0x32ed3f){if(_0x2497da[_0xa68d('0x5')]&&!_0x2497da[_0xa68d('0x5')][_0x1fc6d7]){logger[_0xa68d('0x6')](_0xa68d('0x7'),_0x1fc6d7);return _0x32ed3f[_0xa68d('0x8')]();}var _0x490d8c=_0x135369[_0xa68d('0x9')](function(_0x24ad06){return iftime(_0x24ad06);});var _0x454fd0=_['some'](_0x490d8c);if(_0x454fd0){logger['info'](_0xa68d('0xa'),_0x1fc6d7,_0x135369[_0xa68d('0xb')]('\x20|\x20'),_0x454fd0);_0x32ed3f[_0xa68d('0xc')](_0x454fd0);}else{logger[_0xa68d('0x6')](_0xa68d('0xd'),_0x1fc6d7,_0x135369[_0xa68d('0xb')](_0xa68d('0xe')));_0x32ed3f[_0xa68d('0x8')]();}};}; \ No newline at end of file +var _0x8f55=['when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','stop','lodash','../../../config/logger','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x8f55,0x1f2));var _0x58f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f55[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x58f5('0x0'));var iftime=require('../../../utils/iftime')['iftime'];var logger=require(_0x58f5('0x1'))(_0x58f5('0x2'));exports[_0x58f5('0x3')]=function(_0x422d1e,_0x159bcf,_0x2f820d){return function(_0x6d1c9c){if(_0x2f820d[_0x58f5('0x4')]&&!_0x2f820d['rules'][_0x422d1e]){logger[_0x58f5('0x5')](_0x58f5('0x6'),_0x422d1e);return _0x6d1c9c['stop']();}var _0x255032=_0x159bcf[_0x58f5('0x7')](function(_0x35ef0b){return iftime(_0x35ef0b);});var _0xb89729=_[_0x58f5('0x8')](_0x255032);if(_0xb89729){logger[_0x58f5('0x5')](_0x58f5('0x9'),_0x422d1e,_0x159bcf[_0x58f5('0xa')](_0x58f5('0xb')),_0xb89729);_0x6d1c9c[_0x58f5('0xc')](_0xb89729);}else{logger[_0x58f5('0x5')](_0x58f5('0xd'),_0x422d1e,_0x159bcf[_0x58f5('0xa')]('\x20|\x20'));_0x6d1c9c[_0x58f5('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 19d94ec..5cbca14 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 _0xae60=['transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','lodash','util','./utils','info','format','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten'];(function(_0x33bc12,_0x524ce4){var _0x520f08=function(_0x3f43fd){while(--_0x3f43fd){_0x33bc12['push'](_0x33bc12['shift']());}};_0x520f08(++_0x524ce4);}(_0xae60,0x1c7));var _0x0ae6=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xae60[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var utils=require(_0x0ae6('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52d7cd,_0x267ad6){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x52d7cd[_0x0ae6('0x5')],_0x52d7cd[_0x0ae6('0x6')],_0x52d7cd['queue'],_0x52d7cd[_0x0ae6('0x7')],_0x52d7cd[_0x0ae6('0x8')],_0x52d7cd[_0x0ae6('0x9')],_0x52d7cd[_0x0ae6('0xa')],_0x52d7cd[_0x0ae6('0xb')]));if(_0x52d7cd[_0x0ae6('0xc')]){utils[_0x0ae6('0xd')](_0x52d7cd[_0x0ae6('0xc')])['then'](function(_0x3b3fc3){if(_0x3b3fc3){_0x52d7cd[_0x0ae6('0xe')]=_0x3b3fc3[_0x0ae6('0xe')];_0x52d7cd[_0x0ae6('0xf')]=_0x52d7cd['agentcomplete']?_0x3b3fc3[_0x0ae6('0x10')]:![];_0x52d7cd[_0x0ae6('0x11')]=_0x52d7cd[_0x0ae6('0xf')]?_0x3b3fc3[_0x0ae6('0x12')]:0x0;}utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);});}else{utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);}if(_0x267ad6){delete transfers[_0x52d7cd[_0x0ae6('0x5')]];}else{delete agents[_0x52d7cd[_0x0ae6('0x15')]];}}exports[_0x0ae6('0x16')]=function(_0xf86cad){try{utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0xf86cad);agents[_0xf86cad[_0x0ae6('0x15')]]=_0xf86cad;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x18')]=utils[_0x0ae6('0x19')]();agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xb')]=_0x0ae6('0x1a');agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xa')]=null;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x1b')]=null;utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x1c'),_0xf86cad[_0x0ae6('0x5')],agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x7')],_0xf86cad[_0x0ae6('0x15')]));}catch(_0x9e2c46){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0x9e2c46);}};exports[_0x0ae6('0x1e')]=function(_0x140a3b){try{if(!_[_0x0ae6('0x1f')](agents[_0x140a3b[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b['uniqueid']),_0x140a3b);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x21'),_0x140a3b[_0x0ae6('0x5')],agents[_0x140a3b[_0x0ae6('0x15')]]['membername'],_0x140a3b[_0x0ae6('0x15')]));agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x1e')]=!![];agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();agents[_0x140a3b['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x23');agents[_0x140a3b['destuniqueid']]['reason']=_0x0ae6('0x23');agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x24')]=_0x140a3b['ringtime']?parseInt(_0x140a3b[_0x0ae6('0x25')])/0x3e8:0x0;agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x26')]=0x0;unanswered['push'](_0x140a3b[_0x0ae6('0x15')]);}}catch(_0x29fef3){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b[_0x0ae6('0x5')]),_0x29fef3);}};exports['queuecallerabandon']=function(_0x5b2ad6){try{_[_0x0ae6('0x27')](agents,function(_0x419384,_0x4e6df8){if(_0x419384['uniqueid']==_0x5b2ad6[_0x0ae6('0x5')]&&!_[_0x0ae6('0x28')](unanswered,_0x419384[_0x0ae6('0x15')])){utils[_0x0ae6('0x17')](util['format'](_0x0ae6('0x29'),_0x5b2ad6[_0x0ae6('0x5')]),_0x5b2ad6);utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x2a'),_0x5b2ad6[_0x0ae6('0x5')],_0x419384[_0x0ae6('0x7')],_0x419384[_0x0ae6('0x15')]));_0x419384[_0x0ae6('0x1e')]=!![];_0x419384[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x419384[_0x0ae6('0xb')]=_0x0ae6('0x2b');_0x419384[_0x0ae6('0x2c')]='abandoned';_0x419384[_0x0ae6('0x24')]=_0x5b2ad6[_0x0ae6('0x24')];_0x419384['talktime']=0x0;writeDB(_0x419384);}});}catch(_0x3264d5){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][queuecallerabandon]',_0x5b2ad6[_0x0ae6('0x5')]),_0x3264d5);}};exports['agentconnect']=function(_0x59e388){try{if(agents[_0x59e388[_0x0ae6('0x15')]]){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x59e388);utils['info'](util['format'](_0x0ae6('0x2e'),_0x59e388['uniqueid'],agents[_0x59e388[_0x0ae6('0x15')]]['membername'],_0x59e388[_0x0ae6('0x15')]));agents[_0x59e388['destuniqueid']][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();agents[_0x59e388[_0x0ae6('0x15')]][_0x0ae6('0xa')]=_0x59e388['connectedlinenum'];agents[_0x59e388['destuniqueid']][_0x0ae6('0x1b')]=_0x59e388[_0x0ae6('0x1b')];agents[_0x59e388[_0x0ae6('0x15')]]['holdtime']=_0x59e388[_0x0ae6('0x25')];agents[_0x59e388['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x30');_[_0x0ae6('0x27')](agents,function(_0x19403c,_0x450f00){if(_0x19403c[_0x0ae6('0x15')]!=_0x59e388['destuniqueid']&&_0x19403c[_0x0ae6('0x5')]==_0x59e388[_0x0ae6('0x5')]){_0x19403c[_0x0ae6('0x26')]=0x0;_0x19403c[_0x0ae6('0x24')]=_0x59e388[_0x0ae6('0x25')];_0x19403c[_0x0ae6('0x1e')]=!![];_0x19403c[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x19403c['lastevent']=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x2c')]=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x32')]=_0x59e388[_0x0ae6('0x15')];_0x19403c[_0x0ae6('0x33')]=_0x59e388[_0x0ae6('0x7')];writeDB(_0x19403c);}});}}catch(_0x21431e){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x21431e);}};exports[_0x0ae6('0x34')]=function(_0x85d9ce){try{if(!_[_0x0ae6('0x1f')](agents[_0x85d9ce[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x85d9ce);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x35'),_0x85d9ce[_0x0ae6('0x5')],agents[_0x85d9ce[_0x0ae6('0x15')]]['membername'],_0x85d9ce[_0x0ae6('0x15')]));agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x34')]=!![];agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt'],agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x2f')]);agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x2c')]=_0x85d9ce[_0x0ae6('0x2c')];agents[_0x85d9ce['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x37');writeDB(agents[_0x85d9ce['destuniqueid']]);}}catch(_0x76e561){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x76e561);}};exports[_0x0ae6('0x38')]=function(_0x46075a){try{if(!_[_0x0ae6('0x1f')](agents[_0x46075a[_0x0ae6('0x39')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][blindtransfer]',_0x46075a['uniqueid']),_0x46075a);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x3a'),_0x46075a['uniqueid'],agents[_0x46075a[_0x0ae6('0x39')]]['membername'],agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x5')]));agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3b')]=!![];agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x3c')]=_0x0ae6('0x3d');agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3e')]=_0x46075a[_0x0ae6('0x3f')];agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x40')]=agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x5')];}}catch(_0x117d24){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x41'),_0x46075a[_0x0ae6('0x5')]),_0x117d24);}};exports[_0x0ae6('0x42')]=function(_0x5c4785){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x5c4785);if(_0x5c4785[_0x0ae6('0x44')]==_0x5c4785[_0x0ae6('0x45')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785[_0x0ae6('0x46')]])){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3c')]=_0x0ae6('0x48');agents[_0x5c4785['secondtransfereruniqueid']][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x49')];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x40')]=_0x5c4785[_0x0ae6('0x44')];}if(_0x5c4785[_0x0ae6('0x4a')]&&agents[_0x5c4785[_0x0ae6('0x4a')]]){agents[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4a')]]=_['clone'](agents[_0x5c4785[_0x0ae6('0x4a')]]);transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x4c')];transfers[_0x5c4785['transfereeuniqueid']]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4a')]]['agentconnectAt']=utils['now']();transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x2;}}else if(_0x5c4785[_0x0ae6('0x46')]==_0x5c4785[_0x0ae6('0x4d')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785['origtransfereruniqueid']])){utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x3c')]='ATTENDED';agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x4e')];agents[_0x5c4785[_0x0ae6('0x44')]]['transferuniqueid']=_0x5c4785['secondtransfereruniqueid'];}if(_0x5c4785[_0x0ae6('0x4f')]&&agents[_0x5c4785[_0x0ae6('0x4f')]]){agents[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4f')]]=_[_0x0ae6('0x50')](agents[_0x5c4785['transfertargetuniqueid']]);transfers[_0x5c4785['transfertargetuniqueid']][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x4c')];transfers[_0x5c4785[_0x0ae6('0x4f')]]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x35068d){utils[_0x0ae6('0x1d')](util['format'](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x35068d);}};exports[_0x0ae6('0x51')]=function(_0x37ad9b){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x37ad9b);if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')]===_0x0ae6('0x23')){if(_0x37ad9b[_0x0ae6('0x53')]==='21'){agents[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]=_0x0ae6('0x54');agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x54');}utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b[_0x0ae6('0x5')]]);var _0x346d19=unanswered[_0x0ae6('0x56')](_0x37ad9b[_0x0ae6('0x5')]);if(_0x346d19>-0x1){unanswered[_0x0ae6('0x57')](_0x346d19,0x1);}}if(transfers[_0x37ad9b[_0x0ae6('0x5')]]){transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x34')]=!![];transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2f')]);transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]='agent';transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],transfers[_0x37ad9b['uniqueid']]['membername'],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(transfers[_0x37ad9b['uniqueid']],!![]);}if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]]['agentconnectAt']){agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x34')]=!![];agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();agents[_0x37ad9b[_0x0ae6('0x5')]]['talktime']=utils['diffTime'](agents[_0x37ad9b['uniqueid']][_0x0ae6('0x58')],agents[_0x37ad9b['uniqueid']]['agentconnectAt']);agents[_0x37ad9b['uniqueid']]['reason']=agents[_0x37ad9b[_0x0ae6('0x5')]]['transfer']?_0x0ae6('0x3b'):'agent';agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b['uniqueid']]);}}catch(_0x435707){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x435707);}}; \ No newline at end of file +var _0xa75b=['agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','agententerreason','agentcalledAt','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','complete','lodash','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','talktime','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]'];(function(_0x1f3dc7,_0x5e428f){var _0x2722b4=function(_0x5aace8){while(--_0x5aace8){_0x1f3dc7['push'](_0x1f3dc7['shift']());}};_0x2722b4(++_0x5e428f);}(_0xa75b,0x170));var _0xba75=function(_0x1dd58f,_0x3507e7){_0x1dd58f=_0x1dd58f-0x0;var _0x4330f3=_0xa75b[_0x1dd58f];return _0x4330f3;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x10c0dd,_0x39dc19){utils[_0xba75('0x1')](util[_0xba75('0x2')](_0xba75('0x3'),_0x10c0dd[_0xba75('0x4')],_0x10c0dd[_0xba75('0x5')],_0x10c0dd[_0xba75('0x6')],_0x10c0dd[_0xba75('0x7')],_0x10c0dd[_0xba75('0x8')],_0x10c0dd[_0xba75('0x9')],_0x10c0dd[_0xba75('0xa')],_0x10c0dd[_0xba75('0xb')]));if(_0x10c0dd['queue']){utils['getVoiceQueueByName'](_0x10c0dd[_0xba75('0x6')])['then'](function(_0x5c5fd7){if(_0x5c5fd7){_0x10c0dd[_0xba75('0xc')]=_0x5c5fd7['type'];_0x10c0dd[_0xba75('0xd')]=_0x10c0dd[_0xba75('0xe')]?_0x5c5fd7[_0xba75('0xf')]:![];_0x10c0dd[_0xba75('0x10')]=_0x10c0dd[_0xba75('0xd')]?_0x5c5fd7[_0xba75('0x11')]:0x0;}utils[_0xba75('0x12')](_0xba75('0x13'),_0x10c0dd);});}else{utils[_0xba75('0x12')](_0xba75('0x13'),_0x10c0dd);}if(_0x39dc19){delete transfers[_0x10c0dd[_0xba75('0x4')]];}else{delete agents[_0x10c0dd[_0xba75('0x14')]];}}exports['agentcalled']=function(_0x55553a){try{utils[_0xba75('0x15')](util['format'](_0xba75('0x16'),_0x55553a[_0xba75('0x4')]),_0x55553a);agents[_0x55553a[_0xba75('0x14')]]=_0x55553a;agents[_0x55553a[_0xba75('0x14')]]['agentcalledAt']=utils[_0xba75('0x17')]();agents[_0x55553a[_0xba75('0x14')]][_0xba75('0xb')]=_0xba75('0x18');agents[_0x55553a[_0xba75('0x14')]]['connectedlinenum']=null;agents[_0x55553a[_0xba75('0x14')]][_0xba75('0x19')]=null;utils[_0xba75('0x1')](util['format'](_0xba75('0x1a'),_0x55553a[_0xba75('0x4')],agents[_0x55553a[_0xba75('0x14')]][_0xba75('0x7')],_0x55553a[_0xba75('0x14')]));}catch(_0x1d1c44){utils['error'](util[_0xba75('0x2')](_0xba75('0x16'),_0x55553a['uniqueid']),_0x1d1c44);}};exports['agentringnoanswer']=function(_0x35ffd2){try{if(!_[_0xba75('0x1b')](agents[_0x35ffd2['destuniqueid']])){utils['debug'](util[_0xba75('0x2')]('[%s][agents][agentringnoanswer]',_0x35ffd2[_0xba75('0x4')]),_0x35ffd2);utils[_0xba75('0x1')](util[_0xba75('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x35ffd2[_0xba75('0x4')],agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0x7')],_0x35ffd2[_0xba75('0x14')]));agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0x1c')]=!![];agents[_0x35ffd2['destuniqueid']][_0xba75('0x1d')]=utils[_0xba75('0x17')]();agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0xb')]=_0xba75('0x1e');agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0x1f')]=_0xba75('0x1e');agents[_0x35ffd2[_0xba75('0x14')]][_0xba75('0x20')]=_0x35ffd2['ringtime']?parseInt(_0x35ffd2['ringtime'])/0x3e8:0x0;agents[_0x35ffd2['destuniqueid']][_0xba75('0x21')]=0x0;unanswered['push'](_0x35ffd2[_0xba75('0x14')]);}}catch(_0x58ea2d){utils[_0xba75('0x22')](util[_0xba75('0x2')](_0xba75('0x23'),_0x35ffd2['uniqueid']),_0x58ea2d);}};exports[_0xba75('0x24')]=function(_0x62cf49){try{_[_0xba75('0x25')](agents,function(_0x2808f0,_0x5d9f78){if(_0x2808f0['uniqueid']==_0x62cf49[_0xba75('0x4')]&&!_['includes'](unanswered,_0x2808f0[_0xba75('0x14')])){utils[_0xba75('0x15')](util[_0xba75('0x2')](_0xba75('0x26'),_0x62cf49['uniqueid']),_0x62cf49);utils[_0xba75('0x1')](util[_0xba75('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x62cf49[_0xba75('0x4')],_0x2808f0[_0xba75('0x7')],_0x2808f0[_0xba75('0x14')]));_0x2808f0[_0xba75('0x1c')]=!![];_0x2808f0['agentringnoanswerAt']=utils[_0xba75('0x17')]();_0x2808f0[_0xba75('0xb')]='abandoned';_0x2808f0[_0xba75('0x1f')]=_0xba75('0x27');_0x2808f0[_0xba75('0x20')]=_0x62cf49['holdtime'];_0x2808f0[_0xba75('0x21')]=0x0;writeDB(_0x2808f0);}});}catch(_0x282f98){utils[_0xba75('0x22')](util[_0xba75('0x2')](_0xba75('0x26'),_0x62cf49[_0xba75('0x4')]),_0x282f98);}};exports[_0xba75('0x28')]=function(_0x4c9fb2){try{if(agents[_0x4c9fb2['destuniqueid']]){utils[_0xba75('0x15')](util[_0xba75('0x2')](_0xba75('0x29'),_0x4c9fb2['uniqueid']),_0x4c9fb2);utils[_0xba75('0x1')](util[_0xba75('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4c9fb2['uniqueid'],agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0x7')],_0x4c9fb2[_0xba75('0x14')]));agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0x2a')]=utils['now']();agents[_0x4c9fb2['destuniqueid']][_0xba75('0xa')]=_0x4c9fb2[_0xba75('0xa')];agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0x19')]=_0x4c9fb2[_0xba75('0x19')];agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0x20')]=_0x4c9fb2['ringtime'];agents[_0x4c9fb2[_0xba75('0x14')]][_0xba75('0xb')]='connect';_[_0xba75('0x25')](agents,function(_0x3740bd,_0x2d56c0){if(_0x3740bd[_0xba75('0x14')]!=_0x4c9fb2[_0xba75('0x14')]&&_0x3740bd[_0xba75('0x4')]==_0x4c9fb2[_0xba75('0x4')]){_0x3740bd['talktime']=0x0;_0x3740bd[_0xba75('0x20')]=_0x4c9fb2['ringtime'];_0x3740bd[_0xba75('0x1c')]=!![];_0x3740bd['agentringnoanswerAt']=utils[_0xba75('0x17')]();_0x3740bd[_0xba75('0xb')]=_0xba75('0x2b');_0x3740bd[_0xba75('0x1f')]=_0xba75('0x2b');_0x3740bd[_0xba75('0x2c')]=_0x4c9fb2[_0xba75('0x14')];_0x3740bd[_0xba75('0x2d')]=_0x4c9fb2[_0xba75('0x7')];writeDB(_0x3740bd);}});}}catch(_0x5c7c7f){utils[_0xba75('0x22')](util[_0xba75('0x2')]('[%s][agents][agentconnect]',_0x4c9fb2[_0xba75('0x4')]),_0x5c7c7f);}};exports[_0xba75('0xe')]=function(_0x1130ac){try{if(!_['isNil'](agents[_0x1130ac['destuniqueid']])){utils['debug'](util['format'](_0xba75('0x2e'),_0x1130ac['uniqueid']),_0x1130ac);utils[_0xba75('0x1')](util[_0xba75('0x2')](_0xba75('0x2f'),_0x1130ac[_0xba75('0x4')],agents[_0x1130ac[_0xba75('0x14')]]['membername'],_0x1130ac['destuniqueid']));agents[_0x1130ac[_0xba75('0x14')]]['agentcomplete']=!![];agents[_0x1130ac[_0xba75('0x14')]]['agentcompleteAt']=utils[_0xba75('0x17')]();agents[_0x1130ac[_0xba75('0x14')]][_0xba75('0x21')]=utils[_0xba75('0x30')](agents[_0x1130ac['destuniqueid']][_0xba75('0x31')],agents[_0x1130ac[_0xba75('0x14')]][_0xba75('0x2a')]);agents[_0x1130ac[_0xba75('0x14')]][_0xba75('0x1f')]=_0x1130ac[_0xba75('0x1f')];agents[_0x1130ac[_0xba75('0x14')]][_0xba75('0xb')]='complete';writeDB(agents[_0x1130ac[_0xba75('0x14')]]);}}catch(_0x3fe479){utils[_0xba75('0x22')](util[_0xba75('0x2')](_0xba75('0x2e'),_0x1130ac['uniqueid']),_0x3fe479);}};exports[_0xba75('0x32')]=function(_0x25ae33){try{if(!_[_0xba75('0x1b')](agents[_0x25ae33[_0xba75('0x33')]])){utils[_0xba75('0x15')](util[_0xba75('0x2')](_0xba75('0x34'),_0x25ae33['uniqueid']),_0x25ae33);utils[_0xba75('0x1')](util[_0xba75('0x2')](_0xba75('0x35'),_0x25ae33['uniqueid'],agents[_0x25ae33[_0xba75('0x33')]][_0xba75('0x7')],agents[_0x25ae33['transfereruniqueid']]['uniqueid']));agents[_0x25ae33[_0xba75('0x33')]]['transfer']=!![];agents[_0x25ae33['transfereruniqueid']][_0xba75('0x36')]='blind';agents[_0x25ae33[_0xba75('0x33')]][_0xba75('0x37')]=_0x25ae33[_0xba75('0x38')];agents[_0x25ae33[_0xba75('0x33')]][_0xba75('0x39')]=agents[_0x25ae33['transfereruniqueid']][_0xba75('0x4')];}}catch(_0x3dee66){utils['error'](util[_0xba75('0x2')](_0xba75('0x34'),_0x25ae33[_0xba75('0x4')]),_0x3dee66);}};exports[_0xba75('0x3a')]=function(_0x322fdb){try{utils['debug'](util[_0xba75('0x2')](_0xba75('0x3b'),_0x322fdb['origtransfereruniqueid']),_0x322fdb);if(_0x322fdb[_0xba75('0x3c')]==_0x322fdb[_0xba75('0x3d')]){if(!_[_0xba75('0x1b')](agents[_0x322fdb[_0xba75('0x3e')]])){utils[_0xba75('0x1')](util[_0xba75('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x322fdb[_0xba75('0x3c')],agents[_0x322fdb[_0xba75('0x3e')]][_0xba75('0x7')]));agents[_0x322fdb[_0xba75('0x3e')]][_0xba75('0x3f')]=!![];agents[_0x322fdb[_0xba75('0x3e')]]['transfertype']='ATTENDED';agents[_0x322fdb['secondtransfereruniqueid']]['transferexten']=_0x322fdb[_0xba75('0x40')];agents[_0x322fdb[_0xba75('0x3e')]][_0xba75('0x39')]=_0x322fdb[_0xba75('0x3c')];}if(_0x322fdb[_0xba75('0x41')]&&agents[_0x322fdb[_0xba75('0x41')]]){agents[_0x322fdb[_0xba75('0x41')]]['agententerreason']=0x1;transfers[_0x322fdb[_0xba75('0x41')]]=_[_0xba75('0x42')](agents[_0x322fdb[_0xba75('0x41')]]);transfers[_0x322fdb[_0xba75('0x41')]]['calleridnum']=agents[_0x322fdb[_0xba75('0x3e')]][_0xba75('0x9')];transfers[_0x322fdb['transfereeuniqueid']][_0xba75('0x43')]=agents[_0x322fdb['secondtransfereruniqueid']][_0xba75('0x43')];transfers[_0x322fdb[_0xba75('0x41')]]['agentcalledAt']=utils[_0xba75('0x17')]();transfers[_0x322fdb[_0xba75('0x41')]]['agentconnectAt']=utils['now']();transfers[_0x322fdb[_0xba75('0x41')]]['holdtime']=0x0;transfers[_0x322fdb[_0xba75('0x41')]]['agententerreason']=0x2;}}else if(_0x322fdb[_0xba75('0x3e')]==_0x322fdb[_0xba75('0x44')]){if(!_[_0xba75('0x1b')](agents[_0x322fdb[_0xba75('0x3c')]])){utils[_0xba75('0x1')](util['format'](_0xba75('0x45'),_0x322fdb[_0xba75('0x3c')],agents[_0x322fdb['origtransfereruniqueid']][_0xba75('0x7')]));agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x3f')]=!![];agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x36')]=_0xba75('0x46');agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x37')]=_0x322fdb[_0xba75('0x47')];agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x39')]=_0x322fdb[_0xba75('0x3e')];}if(_0x322fdb['transfertargetuniqueid']&&agents[_0x322fdb['transfertargetuniqueid']]){agents[_0x322fdb[_0xba75('0x48')]][_0xba75('0x49')]=0x1;transfers[_0x322fdb[_0xba75('0x48')]]=_[_0xba75('0x42')](agents[_0x322fdb[_0xba75('0x48')]]);transfers[_0x322fdb[_0xba75('0x48')]][_0xba75('0x9')]=agents[_0x322fdb[_0xba75('0x3c')]][_0xba75('0x9')];transfers[_0x322fdb[_0xba75('0x48')]][_0xba75('0x43')]=agents[_0x322fdb['origtransfereruniqueid']][_0xba75('0x43')];transfers[_0x322fdb['transfertargetuniqueid']][_0xba75('0x4a')]=utils[_0xba75('0x17')]();transfers[_0x322fdb[_0xba75('0x48')]][_0xba75('0x2a')]=utils[_0xba75('0x17')]();transfers[_0x322fdb[_0xba75('0x48')]]['holdtime']=0x0;transfers[_0x322fdb[_0xba75('0x48')]]['agententerreason']=0x2;}}}catch(_0x8519a1){utils[_0xba75('0x22')](util['format']('[%s][agents][attendedtransfer]',_0x322fdb[_0xba75('0x3c')]),_0x8519a1);}};exports[_0xba75('0x4b')]=function(_0x30ef23){try{utils[_0xba75('0x15')](util[_0xba75('0x2')](_0xba75('0x4c'),_0x30ef23['uniqueid']),_0x30ef23);if(agents[_0x30ef23[_0xba75('0x4')]]&&agents[_0x30ef23[_0xba75('0x4')]]['reason']===_0xba75('0x1e')){if(_0x30ef23[_0xba75('0x4d')]==='21'){agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x1f')]=_0xba75('0x4e');agents[_0x30ef23['uniqueid']][_0xba75('0xb')]='rejected';}utils[_0xba75('0x1')](util[_0xba75('0x2')](_0xba75('0x4f'),_0x30ef23[_0xba75('0x4')],agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x7')],agents[_0x30ef23['uniqueid']]['reason'],agents[_0x30ef23[_0xba75('0x4')]]['lastevent']));writeDB(agents[_0x30ef23[_0xba75('0x4')]]);var _0x4707ef=unanswered['indexOf'](_0x30ef23[_0xba75('0x4')]);if(_0x4707ef>-0x1){unanswered[_0xba75('0x50')](_0x4707ef,0x1);}}if(transfers[_0x30ef23[_0xba75('0x4')]]){transfers[_0x30ef23['uniqueid']]['agentcomplete']=!![];transfers[_0x30ef23['uniqueid']]['agentcompleteAt']=utils['now']();transfers[_0x30ef23[_0xba75('0x4')]]['talktime']=utils[_0xba75('0x30')](transfers[_0x30ef23[_0xba75('0x4')]][_0xba75('0x31')],transfers[_0x30ef23[_0xba75('0x4')]][_0xba75('0x2a')]);transfers[_0x30ef23[_0xba75('0x4')]][_0xba75('0x1f')]='agent';transfers[_0x30ef23['uniqueid']][_0xba75('0xb')]=_0xba75('0x51');utils['info'](util[_0xba75('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x30ef23[_0xba75('0x4')],transfers[_0x30ef23[_0xba75('0x4')]]['membername'],transfers[_0x30ef23[_0xba75('0x4')]]['reason'],transfers[_0x30ef23[_0xba75('0x4')]][_0xba75('0xb')]));writeDB(transfers[_0x30ef23['uniqueid']],!![]);}if(agents[_0x30ef23[_0xba75('0x4')]]&&agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x2a')]){agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0xe')]=!![];agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x31')]=utils[_0xba75('0x17')]();agents[_0x30ef23['uniqueid']][_0xba75('0x21')]=utils[_0xba75('0x30')](agents[_0x30ef23['uniqueid']]['agentcompleteAt'],agents[_0x30ef23['uniqueid']][_0xba75('0x2a')]);agents[_0x30ef23['uniqueid']][_0xba75('0x1f')]=agents[_0x30ef23['uniqueid']][_0xba75('0x3f')]?'transfer':'agent';agents[_0x30ef23[_0xba75('0x4')]]['lastevent']=_0xba75('0x51');utils['info'](util['format'](_0xba75('0x4f'),_0x30ef23['uniqueid'],agents[_0x30ef23[_0xba75('0x4')]]['membername'],agents[_0x30ef23[_0xba75('0x4')]][_0xba75('0x1f')],agents[_0x30ef23[_0xba75('0x4')]]['lastevent']));writeDB(agents[_0x30ef23[_0xba75('0x4')]]);}}catch(_0x1de4a3){utils['error'](util[_0xba75('0x2')]('[%s][agents][hangup]',_0x30ef23['uniqueid']),_0x1de4a3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 915a5ae..1979d45 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 _0x4c42=['billableseconds','endtime','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','localtwolinkedid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','Queue','lastdata','[%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','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','appdata','application','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','set','lastapplication','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','starttime'];(function(_0x4ede09,_0x18801d){var _0x253193=function(_0xa4c752){while(--_0xa4c752){_0x4ede09['push'](_0x4ede09['shift']());}};_0x253193(++_0x18801d);}(_0x4c42,0xaf));var _0x24c4=function(_0x509fa0,_0x3099a7){_0x509fa0=_0x509fa0-0x0;var _0x4daddb=_0x4c42[_0x509fa0];return _0x4daddb;};'use strict';var _=require(_0x24c4('0x0'));var util=require(_0x24c4('0x1'));var utils=require(_0x24c4('0x2'));var dispositions=[_0x24c4('0x3'),_0x24c4('0x4'),_0x24c4('0x4'),_0x24c4('0x3'),_0x24c4('0x3'),_0x24c4('0x3'),_0x24c4('0x5'),_0x24c4('0x6'),_0x24c4('0x4'),_0x24c4('0x4'),_0x24c4('0x4')];var channels={};function writeDB(_0x1f9cb3){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x9'),_0x1f9cb3[_0x24c4('0xa')],_0x1f9cb3[_0x24c4('0xb')],_0x1f9cb3[_0x24c4('0xc')],_0x1f9cb3[_0x24c4('0xd')],_0x1f9cb3[_0x24c4('0xe')],_0x1f9cb3['calleridnum'],_0x1f9cb3[_0x24c4('0xf')],_0x1f9cb3[_0x24c4('0x10')]));if(_0x1f9cb3[_0x24c4('0x11')]){utils[_0x24c4('0x12')](_0x1f9cb3[_0x24c4('0x11')])[_0x24c4('0x13')](function(_0x5ed4d1){if(_0x5ed4d1){_0x1f9cb3[_0x24c4('0x14')]=_0x5ed4d1['id'];}utils[_0x24c4('0x15')](_0x24c4('0x16'),_0x1f9cb3);});}else{utils[_0x24c4('0x15')](_0x24c4('0x16'),_0x1f9cb3);}if(channels[_0x1f9cb3['uniqueid']]){delete channels[_0x1f9cb3['uniqueid']];}}exports[_0x24c4('0x17')]=function(_0x495096){try{utils['debug'](util['format'](_0x24c4('0x18'),_0x495096[_0x24c4('0xa')]),_0x495096);if(_0x495096['uniqueid']==_0x495096['linkedid']&&_0x495096['channel']!=_0x24c4('0x19')){utils[_0x24c4('0x7')](util['format'](_0x24c4('0x1a'),_0x495096[_0x24c4('0xa')],_0x495096[_0x24c4('0x1b')],_0x495096[_0x24c4('0x1c')]));channels[_0x495096['uniqueid']]={'uniqueid':_0x495096[_0x24c4('0xa')],'accountcode':_0x495096[_0x24c4('0x11')],'source':_0x495096[_0x24c4('0x1d')],'destination':_0x495096[_0x24c4('0x1c')],'destinationcontext':_0x495096['context'],'channel':_0x495096['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x24c4('0x3'),'amaflags':_0x24c4('0x1e')};}}catch(_0x497447){utils['error'](util['format'](_0x24c4('0x18'),_0x495096[_0x24c4('0xa')]),_0x497447);}};exports[_0x24c4('0x1f')]=function(_0x435d77){try{utils[_0x24c4('0x20')](util[_0x24c4('0x8')](_0x24c4('0x21'),_0x435d77[_0x24c4('0xa')]),_0x435d77);if(!_[_0x24c4('0x22')](channels[_0x435d77[_0x24c4('0xa')]])&&_0x435d77[_0x24c4('0x23')]==0x6){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x24'),_0x435d77[_0x24c4('0xa')],_0x435d77['context'],_0x435d77[_0x24c4('0xb')]));if(_[_0x24c4('0x22')](channels[_0x435d77[_0x24c4('0xa')]][_0x24c4('0x25')])){channels[_0x435d77[_0x24c4('0xa')]]['systemanswertime']=utils[_0x24c4('0x26')]();}}else if(!_[_0x24c4('0x22')](channels[_0x435d77[_0x24c4('0x27')]])&&_0x435d77['channelstate']==0x6&&_0x435d77[_0x24c4('0x1b')]!='transfer'){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x28'),_0x435d77[_0x24c4('0xa')],_0x435d77['linkedid'],_0x435d77[_0x24c4('0x1b')],_0x435d77['channel']));channels[_0x435d77['linkedid']][_0x24c4('0x11')]=_0x435d77[_0x24c4('0x11')];channels[_0x435d77[_0x24c4('0x27')]]['destinationchannel']=_0x435d77[_0x24c4('0xb')];if(_[_0x24c4('0x22')](channels[_0x435d77[_0x24c4('0x27')]][_0x24c4('0x29')])){channels[_0x435d77[_0x24c4('0x27')]]['answertime']=utils[_0x24c4('0x26')]();}channels[_0x435d77[_0x24c4('0x27')]][_0x24c4('0x2a')]=dispositions[_[_0x24c4('0x2b')](_0x435d77[_0x24c4('0x23')])]||_0x24c4('0x5');}}catch(_0x2e3032){utils[_0x24c4('0x2c')](util[_0x24c4('0x8')](_0x24c4('0x21'),_0x435d77['uniqueid']),_0x2e3032);}};exports['hangup']=function(_0x1e16d1){try{if(!_[_0x24c4('0x22')](channels[_0x1e16d1[_0x24c4('0xa')]])){utils[_0x24c4('0x20')](util[_0x24c4('0x8')]('[%s][calls][hangup]',_0x1e16d1[_0x24c4('0xa')]),_0x1e16d1);if(_[_0x24c4('0x22')](channels[_0x1e16d1[_0x24c4('0xa')]][_0x24c4('0x2d')])){channels[_0x1e16d1[_0x24c4('0xa')]][_0x24c4('0x2d')]=_0x1e16d1[_0x24c4('0x2e')]+'\x20<'+_0x1e16d1[_0x24c4('0x1d')]+'>';}utils['info'](util[_0x24c4('0x8')](_0x24c4('0x2f'),_0x1e16d1[_0x24c4('0xa')],channels[_0x1e16d1['uniqueid']][_0x24c4('0x2d')],_0x1e16d1[_0x24c4('0x30')]));channels[_0x1e16d1['uniqueid']]['endtime']=utils[_0x24c4('0x26')]();channels[_0x1e16d1['uniqueid']]['duration']=utils[_0x24c4('0x31')](channels[_0x1e16d1[_0x24c4('0xa')]]['endtime'],channels[_0x1e16d1[_0x24c4('0xa')]][_0x24c4('0x32')]);channels[_0x1e16d1[_0x24c4('0xa')]][_0x24c4('0x33')]=channels[_0x1e16d1[_0x24c4('0xa')]]['answertime']?utils[_0x24c4('0x31')](channels[_0x1e16d1[_0x24c4('0xa')]][_0x24c4('0x34')],channels[_0x1e16d1[_0x24c4('0xa')]][_0x24c4('0x29')]):0x0;writeDB(channels[_0x1e16d1[_0x24c4('0xa')]]);}}catch(_0x40818e){utils[_0x24c4('0x2c')](util[_0x24c4('0x8')](_0x24c4('0x35'),_0x1e16d1['uniqueid']),_0x40818e);}};exports[_0x24c4('0x36')]=function(_0xf349be){try{if(!_[_0x24c4('0x22')](channels[_0xf349be['localtwolinkedid']])){utils[_0x24c4('0x20')](util[_0x24c4('0x8')](_0x24c4('0x37'),_0xf349be[_0x24c4('0x38')]),_0xf349be);if(channels[_0xf349be['localtwolinkedid']][_0x24c4('0xb')]==_0xf349be[_0x24c4('0x39')]){utils[_0x24c4('0x7')](util[_0x24c4('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xf349be[_0x24c4('0x38')],_0xf349be[_0x24c4('0x3a')],_0xf349be[_0x24c4('0x3b')]));channels[_0xf349be[_0x24c4('0x3a')]][_0x24c4('0x3c')]=_0xf349be[_0x24c4('0x3b')];channels[_0xf349be['localtwolinkedid']][_0x24c4('0x3d')]=_0x24c4('0x3e');}else if(channels[_0xf349be[_0x24c4('0x3a')]][_0x24c4('0xb')]=_0xf349be[_0x24c4('0x3f')]){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x40'),_0xf349be['origtransfereruniqueid'],_0xf349be[_0x24c4('0x3a')],_0xf349be['origtransfererchannel']));channels[_0xf349be[_0x24c4('0x3a')]][_0x24c4('0x3c')]=_0xf349be[_0x24c4('0x41')];channels[_0xf349be['localtwolinkedid']]['userfield']=_0x24c4('0x3e');}}}catch(_0x3c8437){utils[_0x24c4('0x2c')](util[_0x24c4('0x8')]('[%s][calls][attendedtransfer]',_0xf349be[_0x24c4('0x38')]),_0x3c8437);}};exports[_0x24c4('0x42')]=function(_0x3ac272){try{if(!_[_0x24c4('0x22')](channels[_0x3ac272[_0x24c4('0xa')]])){utils[_0x24c4('0x20')](util['format'](_0x24c4('0x43'),_0x3ac272['uniqueid']),_0x3ac272);channels[_0x3ac272[_0x24c4('0xa')]][_0x24c4('0x44')]=utils[_0x24c4('0x26')]();utils['info'](util[_0x24c4('0x8')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3ac272[_0x24c4('0xa')],channels[_0x3ac272[_0x24c4('0xa')]][_0x24c4('0x44')]));}}catch(_0x4749fb){utils[_0x24c4('0x2c')](util[_0x24c4('0x8')](_0x24c4('0x43'),_0x3ac272['uniqueid']),_0x4749fb);}};exports[_0x24c4('0x45')]=function(_0x1fafb8){try{if(!_[_0x24c4('0x22')](channels[_0x1fafb8[_0x24c4('0xa')]])){utils[_0x24c4('0x20')](util[_0x24c4('0x8')](_0x24c4('0x46'),_0x1fafb8[_0x24c4('0xa')]),_0x1fafb8);if(!_['isNil'](channels[_0x1fafb8[_0x24c4('0xa')]][_0x24c4('0x44')])){channels[_0x1fafb8[_0x24c4('0xa')]][_0x24c4('0x47')]+=utils[_0x24c4('0x31')](utils[_0x24c4('0x26')](),channels[_0x1fafb8['uniqueid']][_0x24c4('0x44')]);utils[_0x24c4('0x7')](util['format'](_0x24c4('0x48'),_0x1fafb8['uniqueid'],channels[_0x1fafb8[_0x24c4('0xa')]]['mohtime']));delete channels[_0x1fafb8[_0x24c4('0xa')]]['musiconholdstartAt'];}}}catch(_0x256d76){utils['error'](util[_0x24c4('0x8')](_0x24c4('0x46'),_0x1fafb8[_0x24c4('0xa')]),_0x256d76);}};exports['varset']=function(_0xaa2c8d){try{if(!_[_0x24c4('0x22')](channels[_0xaa2c8d[_0x24c4('0xa')]])){utils[_0x24c4('0x20')](util['format']('[%s][calls][varset]',_0xaa2c8d[_0x24c4('0xa')]),_0xaa2c8d);if(!_[_0x24c4('0x22')](_0xaa2c8d[_0x24c4('0x49')][_0x24c4('0x4a')])){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x4b'),_0xaa2c8d[_0x24c4('0xa')],_0xaa2c8d[_0x24c4('0x4c')]));channels[_0xaa2c8d['uniqueid']]['source']=_0xaa2c8d['value'];}if(!_['isNil'](_0xaa2c8d[_0x24c4('0x49')]['xmd-phone'])){utils[_0x24c4('0x7')](util['format'](_0x24c4('0x4d'),_0xaa2c8d[_0x24c4('0xa')],_0xaa2c8d[_0x24c4('0x4c')]));channels[_0xaa2c8d['uniqueid']][_0x24c4('0x4e')]=_0xaa2c8d[_0x24c4('0x4c')];channels[_0xaa2c8d[_0x24c4('0xa')]][_0x24c4('0x2d')]='\x22'+_0xaa2c8d[_0x24c4('0x4c')]+_0x24c4('0x4f')+_0xaa2c8d[_0x24c4('0x4c')]+'>';}if(!_['isNil'](_0xaa2c8d['variable']['xmd-callerid-preview'])||!_[_0x24c4('0x22')](_0xaa2c8d[_0x24c4('0x49')][_0x24c4('0x50')])){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x51'),_0xaa2c8d[_0x24c4('0xa')],!_[_0x24c4('0x22')](_0xaa2c8d['variable']['xmd-callerid-preview'])?_0x24c4('0x52'):_0x24c4('0x50'),_0xaa2c8d[_0x24c4('0x4c')]));channels[_0xaa2c8d[_0x24c4('0xa')]][_0x24c4('0x2d')]=_0xaa2c8d[_0x24c4('0x4c')];}if(!_['isNil'](_0xaa2c8d[_0x24c4('0x49')]['xmd-queue'])||!_[_0x24c4('0x22')](_0xaa2c8d['variable'][_0x24c4('0x53')])){utils['info'](util[_0x24c4('0x8')](_0x24c4('0x51'),_0xaa2c8d[_0x24c4('0xa')],!_[_0x24c4('0x22')](_0xaa2c8d[_0x24c4('0x49')][_0x24c4('0x54')])?'xmd-queue':_0x24c4('0x53'),_0xaa2c8d[_0x24c4('0x4c')]));channels[_0xaa2c8d['uniqueid']]['lastapplication']=_0x24c4('0x55');channels[_0xaa2c8d['uniqueid']][_0x24c4('0x56')]=_0xaa2c8d[_0x24c4('0x4c')];channels[_0xaa2c8d['uniqueid']][_0x24c4('0xc')]=!![];}if(!_[_0x24c4('0x22')](_0xaa2c8d['variable']['xmd-contactid'])){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x57'),_0xaa2c8d[_0x24c4('0xa')],_0xaa2c8d[_0x24c4('0x4c')]));channels[_0xaa2c8d[_0x24c4('0xa')]][_0x24c4('0x58')]=_0xaa2c8d[_0x24c4('0x4c')];}if(!_[_0x24c4('0x22')](_0xaa2c8d[_0x24c4('0x49')][_0x24c4('0x59')])){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x5a'),_0xaa2c8d[_0x24c4('0xa')],_0xaa2c8d['value']));channels[_0xaa2c8d['uniqueid']][_0x24c4('0x5b')]=_0xaa2c8d[_0x24c4('0x4c')];}if(!_[_0x24c4('0x22')](_0xaa2c8d[_0x24c4('0x49')][_0x24c4('0x5c')])){utils[_0x24c4('0x7')](util[_0x24c4('0x8')](_0x24c4('0x5d'),_0xaa2c8d['uniqueid'],_0xaa2c8d[_0x24c4('0x4c')]));channels[_0xaa2c8d[_0x24c4('0xa')]][_0x24c4('0x5e')]=_0xaa2c8d[_0x24c4('0x4c')];}if(!_[_0x24c4('0x22')](_0xaa2c8d[_0x24c4('0x49')][_0x24c4('0x5f')])){utils['info'](util[_0x24c4('0x8')](_0x24c4('0x60'),_0xaa2c8d[_0x24c4('0xa')],_0xaa2c8d[_0x24c4('0x4c')]));channels[_0xaa2c8d[_0x24c4('0xa')]][_0x24c4('0x5f')]=_0xaa2c8d['value'];}}}catch(_0x596763){utils[_0x24c4('0x2c')](util[_0x24c4('0x8')](_0x24c4('0x61'),_0xaa2c8d[_0x24c4('0xa')]),_0x596763);}};exports[_0x24c4('0x62')]=function(_0x2f783d){try{if(!_[_0x24c4('0x22')](channels[_0x2f783d['uniqueid']])){utils[_0x24c4('0x20')](util[_0x24c4('0x8')]('[%s][calls][newexten]',_0x2f783d['uniqueid']),_0x2f783d);utils[_0x24c4('0x7')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2f783d[_0x24c4('0xa')],_0x2f783d['application'],_0x2f783d[_0x24c4('0x63')]));if(_0x2f783d[_0x24c4('0x64')][_0x24c4('0x65')]()=='set'&&_['startsWith'](_0x2f783d[_0x24c4('0x63')]['toLowerCase'](),_0x24c4('0x66'))){var _0x565aa4=_0x2f783d[_0x24c4('0x63')][_0x24c4('0x67')]('=');var _0x492efa=_0x565aa4[0x0][_0x24c4('0x68')](_0x565aa4[0x0][_0x24c4('0x69')]('(')+0x1,_0x565aa4[0x0][_0x24c4('0x69')](')'));var _0x5194d7=_0x565aa4[0x1];channels[_0x2f783d[_0x24c4('0xa')]][_0x492efa]=_0x5194d7;}if(!_[_0x24c4('0x6a')]([_0x24c4('0x6b'),_0x24c4('0x6c'),_0x24c4('0x6d'),_0x24c4('0x6e'),'gotoif'],_0x2f783d[_0x24c4('0x64')][_0x24c4('0x65')]())){channels[_0x2f783d['uniqueid']][_0x24c4('0x6f')]=_0x2f783d[_0x24c4('0x64')];channels[_0x2f783d[_0x24c4('0xa')]][_0x24c4('0x56')]=_0x2f783d[_0x24c4('0x63')];}}}catch(_0x3ab933){utils[_0x24c4('0x2c')](util['format'](_0x24c4('0x70'),_0x2f783d[_0x24c4('0xa')]),_0x3ab933);}}; \ No newline at end of file +var _0x75a4=['newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','[%s][calls][newchannel]','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','toNumber','ANSWERED','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','starttime','billableseconds','endtime','answertime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-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','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','UserId','CreateVoiceCallReport','request'];(function(_0x4fb675,_0x3fb007){var _0x467d92=function(_0x357a5e){while(--_0x357a5e){_0x4fb675['push'](_0x4fb675['shift']());}};_0x467d92(++_0x3fb007);}(_0x75a4,0xcf));var _0x475a=function(_0x5a2613,_0x4675e6){_0x5a2613=_0x5a2613-0x0;var _0x448d34=_0x75a4[_0x5a2613];return _0x448d34;};'use strict';var _=require(_0x475a('0x0'));var util=require(_0x475a('0x1'));var utils=require(_0x475a('0x2'));var dispositions=['NO\x20ANSWER',_0x475a('0x3'),_0x475a('0x3'),_0x475a('0x4'),_0x475a('0x4'),_0x475a('0x4'),'ANSWERED','BUSY','FAILED',_0x475a('0x3'),_0x475a('0x3')];var channels={};function writeDB(_0x24a7d3){utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x7'),_0x24a7d3[_0x475a('0x8')],_0x24a7d3[_0x475a('0x9')],_0x24a7d3[_0x475a('0xa')],_0x24a7d3[_0x475a('0xb')],_0x24a7d3[_0x475a('0xc')],_0x24a7d3[_0x475a('0xd')],_0x24a7d3[_0x475a('0xe')],_0x24a7d3[_0x475a('0xf')]));if(_0x24a7d3['accountcode']){utils[_0x475a('0x10')](_0x24a7d3[_0x475a('0x11')])['then'](function(_0x1016a2){if(_0x1016a2){_0x24a7d3[_0x475a('0x12')]=_0x1016a2['id'];}utils['request'](_0x475a('0x13'),_0x24a7d3);});}else{utils[_0x475a('0x14')]('CreateVoiceCallReport',_0x24a7d3);}if(channels[_0x24a7d3[_0x475a('0x8')]]){delete channels[_0x24a7d3[_0x475a('0x8')]];}}exports[_0x475a('0x15')]=function(_0x4aa9b5){try{utils[_0x475a('0x16')](util[_0x475a('0x6')]('[%s][calls][newchannel]',_0x4aa9b5[_0x475a('0x8')]),_0x4aa9b5);if(_0x4aa9b5[_0x475a('0x8')]==_0x4aa9b5[_0x475a('0x17')]&&_0x4aa9b5[_0x475a('0x9')]!=_0x475a('0x18')){utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x19'),_0x4aa9b5[_0x475a('0x8')],_0x4aa9b5[_0x475a('0x1a')],_0x4aa9b5[_0x475a('0x1b')]));channels[_0x4aa9b5[_0x475a('0x8')]]={'uniqueid':_0x4aa9b5[_0x475a('0x8')],'accountcode':_0x4aa9b5[_0x475a('0x11')],'source':_0x4aa9b5[_0x475a('0xd')],'destination':_0x4aa9b5[_0x475a('0x1b')],'destinationcontext':_0x4aa9b5[_0x475a('0x1a')],'channel':_0x4aa9b5['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x475a('0x4'),'amaflags':_0x475a('0x1c')};}}catch(_0x4e4334){utils['error'](util[_0x475a('0x6')](_0x475a('0x1d'),_0x4aa9b5[_0x475a('0x8')]),_0x4e4334);}};exports[_0x475a('0x1e')]=function(_0x38d888){try{utils[_0x475a('0x16')](util[_0x475a('0x6')]('[%s][calls][newstate]',_0x38d888[_0x475a('0x8')]),_0x38d888);if(!_[_0x475a('0x1f')](channels[_0x38d888[_0x475a('0x8')]])&&_0x38d888[_0x475a('0x20')]==0x6){utils[_0x475a('0x5')](util['format'](_0x475a('0x21'),_0x38d888[_0x475a('0x8')],_0x38d888[_0x475a('0x1a')],_0x38d888[_0x475a('0x9')]));if(_[_0x475a('0x1f')](channels[_0x38d888[_0x475a('0x8')]][_0x475a('0x22')])){channels[_0x38d888[_0x475a('0x8')]][_0x475a('0x22')]=utils[_0x475a('0x23')]();}}else if(!_[_0x475a('0x1f')](channels[_0x38d888[_0x475a('0x17')]])&&_0x38d888[_0x475a('0x20')]==0x6&&_0x38d888[_0x475a('0x1a')]!=_0x475a('0x24')){utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x25'),_0x38d888[_0x475a('0x8')],_0x38d888[_0x475a('0x17')],_0x38d888[_0x475a('0x1a')],_0x38d888[_0x475a('0x9')]));channels[_0x38d888[_0x475a('0x17')]]['accountcode']=_0x38d888[_0x475a('0x11')];channels[_0x38d888[_0x475a('0x17')]]['destinationchannel']=_0x38d888[_0x475a('0x9')];if(_['isNil'](channels[_0x38d888[_0x475a('0x17')]]['answertime'])){channels[_0x38d888[_0x475a('0x17')]]['answertime']=utils[_0x475a('0x23')]();}channels[_0x38d888[_0x475a('0x17')]][_0x475a('0x26')]=dispositions[_[_0x475a('0x27')](_0x38d888[_0x475a('0x20')])]||_0x475a('0x28');}}catch(_0x29a601){utils[_0x475a('0x29')](util['format'](_0x475a('0x2a'),_0x38d888['uniqueid']),_0x29a601);}};exports[_0x475a('0x2b')]=function(_0x29a988){try{if(!_['isNil'](channels[_0x29a988[_0x475a('0x8')]])){utils[_0x475a('0x16')](util[_0x475a('0x6')](_0x475a('0x2c'),_0x29a988[_0x475a('0x8')]),_0x29a988);if(_['isNil'](channels[_0x29a988[_0x475a('0x8')]][_0x475a('0x2d')])){channels[_0x29a988['uniqueid']][_0x475a('0x2d')]=_0x29a988[_0x475a('0x2e')]+'\x20<'+_0x29a988[_0x475a('0xd')]+'>';}utils[_0x475a('0x5')](util['format'](_0x475a('0x2f'),_0x29a988[_0x475a('0x8')],channels[_0x29a988[_0x475a('0x8')]]['callerid'],_0x29a988[_0x475a('0x30')]));channels[_0x29a988[_0x475a('0x8')]]['endtime']=utils[_0x475a('0x23')]();channels[_0x29a988[_0x475a('0x8')]][_0x475a('0x31')]=utils[_0x475a('0x32')](channels[_0x29a988['uniqueid']]['endtime'],channels[_0x29a988['uniqueid']][_0x475a('0x33')]);channels[_0x29a988[_0x475a('0x8')]][_0x475a('0x34')]=channels[_0x29a988[_0x475a('0x8')]]['answertime']?utils['diffTime'](channels[_0x29a988['uniqueid']][_0x475a('0x35')],channels[_0x29a988[_0x475a('0x8')]][_0x475a('0x36')]):0x0;writeDB(channels[_0x29a988[_0x475a('0x8')]]);}}catch(_0x9a924c){utils[_0x475a('0x29')](util[_0x475a('0x6')](_0x475a('0x2c'),_0x29a988[_0x475a('0x8')]),_0x9a924c);}};exports[_0x475a('0x37')]=function(_0x41f4cd){try{if(!_[_0x475a('0x1f')](channels[_0x41f4cd[_0x475a('0x38')]])){utils[_0x475a('0x16')](util[_0x475a('0x6')](_0x475a('0x39'),_0x41f4cd['origtransfereruniqueid']),_0x41f4cd);if(channels[_0x41f4cd[_0x475a('0x38')]][_0x475a('0x9')]==_0x41f4cd[_0x475a('0x3a')]){utils['info'](util[_0x475a('0x6')](_0x475a('0x3b'),_0x41f4cd['origtransfereruniqueid'],_0x41f4cd[_0x475a('0x38')],_0x41f4cd[_0x475a('0x3c')]));channels[_0x41f4cd[_0x475a('0x38')]][_0x475a('0x3d')]=_0x41f4cd[_0x475a('0x3c')];channels[_0x41f4cd[_0x475a('0x38')]][_0x475a('0x3e')]=_0x475a('0x3f');}else if(channels[_0x41f4cd['localtwolinkedid']][_0x475a('0x9')]=_0x41f4cd[_0x475a('0x40')]){utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x3b'),_0x41f4cd[_0x475a('0x41')],_0x41f4cd['localtwolinkedid'],_0x41f4cd[_0x475a('0x42')]));channels[_0x41f4cd[_0x475a('0x38')]]['destinationchannel']=_0x41f4cd[_0x475a('0x42')];channels[_0x41f4cd[_0x475a('0x38')]][_0x475a('0x3e')]=_0x475a('0x3f');}}}catch(_0x4a8e41){utils['error'](util['format']('[%s][calls][attendedtransfer]',_0x41f4cd[_0x475a('0x41')]),_0x4a8e41);}};exports[_0x475a('0x43')]=function(_0x2fa335){try{if(!_[_0x475a('0x1f')](channels[_0x2fa335['uniqueid']])){utils[_0x475a('0x16')](util[_0x475a('0x6')]('[%s][calls][musiconholdstart]',_0x2fa335[_0x475a('0x8')]),_0x2fa335);channels[_0x2fa335[_0x475a('0x8')]][_0x475a('0x44')]=utils[_0x475a('0x23')]();utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x45'),_0x2fa335[_0x475a('0x8')],channels[_0x2fa335[_0x475a('0x8')]][_0x475a('0x44')]));}}catch(_0x45a214){utils[_0x475a('0x29')](util['format'](_0x475a('0x46'),_0x2fa335[_0x475a('0x8')]),_0x45a214);}};exports['musiconholdstop']=function(_0x51833d){try{if(!_[_0x475a('0x1f')](channels[_0x51833d['uniqueid']])){utils[_0x475a('0x16')](util[_0x475a('0x6')](_0x475a('0x47'),_0x51833d[_0x475a('0x8')]),_0x51833d);if(!_[_0x475a('0x1f')](channels[_0x51833d[_0x475a('0x8')]]['musiconholdstartAt'])){channels[_0x51833d[_0x475a('0x8')]][_0x475a('0x48')]+=utils[_0x475a('0x32')](utils['now'](),channels[_0x51833d['uniqueid']]['musiconholdstartAt']);utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x49'),_0x51833d[_0x475a('0x8')],channels[_0x51833d[_0x475a('0x8')]][_0x475a('0x48')]));delete channels[_0x51833d[_0x475a('0x8')]]['musiconholdstartAt'];}}}catch(_0xecde82){utils[_0x475a('0x29')](util[_0x475a('0x6')](_0x475a('0x47'),_0x51833d[_0x475a('0x8')]),_0xecde82);}};exports[_0x475a('0x4a')]=function(_0x429af6){try{if(!_['isNil'](channels[_0x429af6[_0x475a('0x8')]])){utils[_0x475a('0x16')](util[_0x475a('0x6')](_0x475a('0x4b'),_0x429af6[_0x475a('0x8')]),_0x429af6);if(!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')][_0x475a('0x4d')])){utils['info'](util[_0x475a('0x6')](_0x475a('0x4e'),_0x429af6['uniqueid'],_0x429af6[_0x475a('0x4f')]));channels[_0x429af6[_0x475a('0x8')]]['source']=_0x429af6[_0x475a('0x4f')];}if(!_[_0x475a('0x1f')](_0x429af6['variable'][_0x475a('0x50')])){utils['info'](util[_0x475a('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x429af6[_0x475a('0x8')],_0x429af6['value']));channels[_0x429af6[_0x475a('0x8')]][_0x475a('0x51')]=_0x429af6['value'];channels[_0x429af6['uniqueid']][_0x475a('0x2d')]='\x22'+_0x429af6['value']+'\x22\x20<'+_0x429af6[_0x475a('0x4f')]+'>';}if(!_[_0x475a('0x1f')](_0x429af6['variable'][_0x475a('0x52')])||!_['isNil'](_0x429af6[_0x475a('0x4c')][_0x475a('0x53')])){utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x54'),_0x429af6[_0x475a('0x8')],!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')][_0x475a('0x52')])?'xmd-callerid-preview':_0x475a('0x53'),_0x429af6[_0x475a('0x4f')]));channels[_0x429af6[_0x475a('0x8')]][_0x475a('0x2d')]=_0x429af6[_0x475a('0x4f')];}if(!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')][_0x475a('0x55')])||!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')][_0x475a('0x56')])){utils['info'](util[_0x475a('0x6')](_0x475a('0x54'),_0x429af6[_0x475a('0x8')],!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')]['xmd-queue'])?_0x475a('0x55'):_0x475a('0x56'),_0x429af6[_0x475a('0x4f')]));channels[_0x429af6[_0x475a('0x8')]][_0x475a('0x57')]=_0x475a('0x58');channels[_0x429af6[_0x475a('0x8')]][_0x475a('0x59')]=_0x429af6['value'];channels[_0x429af6[_0x475a('0x8')]][_0x475a('0xa')]=!![];}if(!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')][_0x475a('0x5a')])){utils['info'](util[_0x475a('0x6')](_0x475a('0x5b'),_0x429af6[_0x475a('0x8')],_0x429af6[_0x475a('0x4f')]));channels[_0x429af6['uniqueid']][_0x475a('0x5c')]=_0x429af6[_0x475a('0x4f')];}if(!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')][_0x475a('0x5d')])){utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x5e'),_0x429af6[_0x475a('0x8')],_0x429af6[_0x475a('0x4f')]));channels[_0x429af6['uniqueid']]['type']=_0x429af6[_0x475a('0x4f')];}if(!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')][_0x475a('0x5f')])){utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x60'),_0x429af6[_0x475a('0x8')],_0x429af6[_0x475a('0x4f')]));channels[_0x429af6[_0x475a('0x8')]]['routeid']=_0x429af6['value'];}if(!_[_0x475a('0x1f')](_0x429af6[_0x475a('0x4c')][_0x475a('0x61')])){utils[_0x475a('0x5')](util['format'](_0x475a('0x62'),_0x429af6[_0x475a('0x8')],_0x429af6[_0x475a('0x4f')]));channels[_0x429af6['uniqueid']]['sipcallid']=_0x429af6[_0x475a('0x4f')];}}}catch(_0x2c6e17){utils[_0x475a('0x29')](util[_0x475a('0x6')](_0x475a('0x4b'),_0x429af6[_0x475a('0x8')]),_0x2c6e17);}};exports[_0x475a('0x63')]=function(_0xbd6924){try{if(!_[_0x475a('0x1f')](channels[_0xbd6924['uniqueid']])){utils[_0x475a('0x16')](util[_0x475a('0x6')](_0x475a('0x64'),_0xbd6924[_0x475a('0x8')]),_0xbd6924);utils[_0x475a('0x5')](util[_0x475a('0x6')](_0x475a('0x65'),_0xbd6924[_0x475a('0x8')],_0xbd6924[_0x475a('0x66')],_0xbd6924[_0x475a('0x67')]));if(_0xbd6924[_0x475a('0x66')][_0x475a('0x68')]()==_0x475a('0x69')&&_[_0x475a('0x6a')](_0xbd6924[_0x475a('0x67')][_0x475a('0x68')](),_0x475a('0x6b'))){var _0x85f590=_0xbd6924[_0x475a('0x67')]['split']('=');var _0x6bf7a=_0x85f590[0x0][_0x475a('0x6c')](_0x85f590[0x0][_0x475a('0x6d')]('(')+0x1,_0x85f590[0x0]['lastIndexOf'](')'));var _0x9a9670=_0x85f590[0x1];channels[_0xbd6924[_0x475a('0x8')]][_0x6bf7a]=_0x9a9670;}if(!_[_0x475a('0x6e')]([_0x475a('0x2b'),_0x475a('0x6f'),_0x475a('0x70'),_0x475a('0x69'),_0x475a('0x71')],_0xbd6924[_0x475a('0x66')][_0x475a('0x68')]())){channels[_0xbd6924['uniqueid']][_0x475a('0x57')]=_0xbd6924['application'];channels[_0xbd6924['uniqueid']][_0x475a('0x59')]=_0xbd6924['appdata'];}}}catch(_0x578ff7){utils[_0x475a('0x29')](util[_0x475a('0x6')](_0x475a('0x64'),_0xbd6924[_0x475a('0x8')]),_0x578ff7);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 902e3d9..e4567d2 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 _0xb317=['shutdown','[core]\x20shutdown','fullybooted','error','close','./utils','connect','info','[core]\x20connected'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb317,0x188));var _0x7b31=function(_0x2e93c7,_0x48d492){_0x2e93c7=_0x2e93c7-0x0;var _0xcce2b4=_0xb317[_0x2e93c7];return _0xcce2b4;};'use strict';var utils=require(_0x7b31('0x0'));exports[_0x7b31('0x1')]=function(){utils[_0x7b31('0x2')](_0x7b31('0x3'));};exports[_0x7b31('0x4')]=function(){utils[_0x7b31('0x2')](_0x7b31('0x5'));};exports[_0x7b31('0x6')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x7b31('0x7')]=function(_0x132a98){utils[_0x7b31('0x7')]('[core]\x20error',_0x132a98);};exports[_0x7b31('0x8')]=function(){utils[_0x7b31('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x11076c){}; \ No newline at end of file +var _0x6649=['[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','./utils','connect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6649,0x1f2));var _0x9664=function(_0x28364,_0xd13c78){_0x28364=_0x28364-0x0;var _0x42b595=_0x6649[_0x28364];return _0x42b595;};'use strict';var utils=require(_0x9664('0x0'));exports[_0x9664('0x1')]=function(){utils['info'](_0x9664('0x2'));};exports[_0x9664('0x3')]=function(){utils[_0x9664('0x4')](_0x9664('0x5'));};exports[_0x9664('0x6')]=function(){utils['info'](_0x9664('0x7'));};exports[_0x9664('0x8')]=function(_0x4bb0b6){utils[_0x9664('0x8')]('[core]\x20error',_0x4bb0b6);};exports[_0x9664('0x9')]=function(){utils[_0x9664('0x4')]('[core]\x20close');};exports['managerevent']=function(_0x580562){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0e7e63e..d50921b 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 _0x2fc7=['./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','split','error','varset','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','dialend','[%s][dials][dialend]','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','diffTime','endtime','billableseconds','lodash','util'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x2fc7,0xee));var _0x72fc=function(_0x1c3ef6,_0x1ab356){_0x1c3ef6=_0x1c3ef6-0x0;var _0x2f4e2f=_0x2fc7[_0x1c3ef6];return _0x2f4e2f;};'use strict';var _=require(_0x72fc('0x0'));var util=require(_0x72fc('0x1'));var utils=require(_0x72fc('0x2'));var dials={};function writeDB(_0x568c91){utils[_0x72fc('0x3')](util[_0x72fc('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x568c91[_0x72fc('0x5')],_0x568c91[_0x72fc('0x6')],_0x568c91[_0x72fc('0x7')],_0x568c91[_0x72fc('0x8')],_0x568c91[_0x72fc('0x9')],_0x568c91[_0x72fc('0xa')]));utils['request']('CreateVoiceDialReport',_0x568c91);delete dials[_0x568c91[_0x72fc('0x5')]];}exports[_0x72fc('0xb')]=function(_0x5f3c22){try{utils['debug'](util[_0x72fc('0x4')](_0x72fc('0xc'),_0x5f3c22['uniqueid']),_0x5f3c22);utils['info'](util[_0x72fc('0x4')](_0x72fc('0xd'),_0x5f3c22[_0x72fc('0x5')],_0x5f3c22[_0x72fc('0xe')],_0x5f3c22[_0x72fc('0xf')]));if(_0x5f3c22[_0x72fc('0xe')]['toLowerCase']()==_0x72fc('0x10')&&_[_0x72fc('0x11')](_0x5f3c22[_0x72fc('0xf')][_0x72fc('0x12')](),'cdr(routeid)')){var _0x2897b1=_0x5f3c22['appdata'][_0x72fc('0x13')]('=');dials[_0x5f3c22[_0x72fc('0x5')]]={'routeId':_0x2897b1[0x1]};}}catch(_0x1bb319){utils[_0x72fc('0x14')](util[_0x72fc('0x4')](_0x72fc('0xc'),_0x5f3c22[_0x72fc('0x5')]),_0x1bb319);}};exports[_0x72fc('0x15')]=function(_0x39e08f){try{utils[_0x72fc('0x16')](util[_0x72fc('0x4')](_0x72fc('0x17'),_0x39e08f[_0x72fc('0x5')]),_0x39e08f);if(!_[_0x72fc('0x18')](_0x39e08f[_0x72fc('0x19')][_0x72fc('0x1a')])){utils['info'](util[_0x72fc('0x4')](_0x72fc('0x1b'),_0x39e08f[_0x72fc('0x5')],_0x39e08f[_0x72fc('0x1c')]));dials[_0x39e08f[_0x72fc('0x5')]]={'routeId':_0x39e08f[_0x72fc('0x1c')]};}}catch(_0x4050fa){utils[_0x72fc('0x14')](util[_0x72fc('0x4')]('[%s][dials][varset]',_0x39e08f[_0x72fc('0x5')]),_0x4050fa);}};exports[_0x72fc('0x1d')]=function(_0x3aac86){try{if(!_[_0x72fc('0x18')](dials[_0x3aac86['uniqueid']])){utils[_0x72fc('0x16')](util[_0x72fc('0x4')](_0x72fc('0x1e'),_0x3aac86[_0x72fc('0x5')]),_0x3aac86);dials[_0x3aac86[_0x72fc('0x5')]]=_[_0x72fc('0x1f')](dials[_0x3aac86['uniqueid']],_0x3aac86);dials[_0x3aac86[_0x72fc('0x5')]][_0x72fc('0x20')]=utils[_0x72fc('0x21')]();dials[_0x3aac86[_0x72fc('0x5')]][_0x72fc('0x22')]='called';utils['info'](util[_0x72fc('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3aac86['uniqueid'],dials[_0x3aac86[_0x72fc('0x5')]][_0x72fc('0x20')]));}}catch(_0x2cd638){utils[_0x72fc('0x14')](util[_0x72fc('0x4')](_0x72fc('0x1e'),_0x3aac86['uniqueid']),_0x2cd638);}};exports[_0x72fc('0x23')]=function(_0x5f59d3){try{if(!_[_0x72fc('0x18')](dials[_0x5f59d3[_0x72fc('0x5')]])){utils[_0x72fc('0x16')](util[_0x72fc('0x4')](_0x72fc('0x24'),_0x5f59d3[_0x72fc('0x5')]),_0x5f59d3);dials[_0x5f59d3[_0x72fc('0x5')]][_0x72fc('0xa')]=_0x5f59d3[_0x72fc('0xa')];if(_0x5f59d3['dialstatus']=='ANSWER'){dials[_0x5f59d3[_0x72fc('0x5')]]=_['assign'](dials[_0x5f59d3[_0x72fc('0x5')]],_0x5f59d3);dials[_0x5f59d3[_0x72fc('0x5')]]['answertime']=utils[_0x72fc('0x21')]();dials[_0x5f59d3[_0x72fc('0x5')]][_0x72fc('0x22')]=_0x72fc('0x25');utils['info'](util[_0x72fc('0x4')](_0x72fc('0x26'),_0x5f59d3[_0x72fc('0x5')],_0x5f59d3['dialstatus'],dials[_0x5f59d3[_0x72fc('0x5')]][_0x72fc('0x27')]));}else{utils[_0x72fc('0x3')](util[_0x72fc('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x5f59d3[_0x72fc('0x5')],_0x5f59d3[_0x72fc('0xa')]));}}}catch(_0x58618e){utils[_0x72fc('0x14')](util['format'](_0x72fc('0x24'),_0x5f59d3['uniqueid']),_0x58618e);}};exports[_0x72fc('0x28')]=function(_0x3c6eee){try{if(!_[_0x72fc('0x18')](dials[_0x3c6eee[_0x72fc('0x5')]])){utils['debug'](util['format'](_0x72fc('0x29'),_0x3c6eee[_0x72fc('0x5')]),_0x3c6eee);utils[_0x72fc('0x3')](util[_0x72fc('0x4')](_0x72fc('0x2a'),_0x3c6eee[_0x72fc('0x5')],_0x3c6eee[_0x72fc('0x8')],_0x3c6eee['calleridname'],_0x3c6eee[_0x72fc('0x2b')]));dials[_0x3c6eee[_0x72fc('0x5')]]=_[_0x72fc('0x1f')](dials[_0x3c6eee[_0x72fc('0x5')]],{'endtime':utils[_0x72fc('0x21')](),'lastevent':_0x72fc('0x2c')});dials[_0x3c6eee[_0x72fc('0x5')]]['duration']=utils[_0x72fc('0x2d')](dials[_0x3c6eee[_0x72fc('0x5')]][_0x72fc('0x2e')],dials[_0x3c6eee['uniqueid']][_0x72fc('0x20')]);dials[_0x3c6eee[_0x72fc('0x5')]]['holdtime']=utils['diffTime'](dials[_0x3c6eee['uniqueid']][_0x72fc('0x27')]||dials[_0x3c6eee[_0x72fc('0x5')]][_0x72fc('0x2e')],dials[_0x3c6eee[_0x72fc('0x5')]][_0x72fc('0x20')]);dials[_0x3c6eee['uniqueid']][_0x72fc('0x2f')]=dials[_0x3c6eee[_0x72fc('0x5')]][_0x72fc('0x27')]?utils[_0x72fc('0x2d')](dials[_0x3c6eee['uniqueid']][_0x72fc('0x2e')],dials[_0x3c6eee[_0x72fc('0x5')]][_0x72fc('0x27')]):0x0;writeDB(dials[_0x3c6eee[_0x72fc('0x5')]]);}}catch(_0x556243){utils['error'](util[_0x72fc('0x4')]('[%s][dials][hangup]',_0x3c6eee[_0x72fc('0x5')]),_0x556243);}}; \ No newline at end of file +var _0x6f5d=['startsWith','appdata','toLowerCase','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','now','called','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','endtime','holdtime','diffTime','starttime','billableseconds','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set'];(function(_0x3404af,_0x40d2fe){var _0x197ade=function(_0x1bf977){while(--_0x1bf977){_0x3404af['push'](_0x3404af['shift']());}};_0x197ade(++_0x40d2fe);}(_0x6f5d,0x116));var _0xd6f5=function(_0x1f063b,_0x53088f){_0x1f063b=_0x1f063b-0x0;var _0x4db984=_0x6f5d[_0x1f063b];return _0x4db984;};'use strict';var _=require(_0xd6f5('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x4359a4){utils[_0xd6f5('0x1')](util[_0xd6f5('0x2')](_0xd6f5('0x3'),_0x4359a4[_0xd6f5('0x4')],_0x4359a4[_0xd6f5('0x5')],_0x4359a4['dialstring'],_0x4359a4['calleridnum'],_0x4359a4[_0xd6f5('0x6')],_0x4359a4[_0xd6f5('0x7')]));utils[_0xd6f5('0x8')](_0xd6f5('0x9'),_0x4359a4);delete dials[_0x4359a4[_0xd6f5('0x4')]];}exports[_0xd6f5('0xa')]=function(_0x2b17c8){try{utils[_0xd6f5('0xb')](util['format'](_0xd6f5('0xc'),_0x2b17c8[_0xd6f5('0x4')]),_0x2b17c8);utils[_0xd6f5('0x1')](util[_0xd6f5('0x2')](_0xd6f5('0xd'),_0x2b17c8['uniqueid'],_0x2b17c8['application'],_0x2b17c8['appdata']));if(_0x2b17c8[_0xd6f5('0xe')]['toLowerCase']()==_0xd6f5('0xf')&&_[_0xd6f5('0x10')](_0x2b17c8[_0xd6f5('0x11')][_0xd6f5('0x12')](),'cdr(routeid)')){var _0x137107=_0x2b17c8['appdata'][_0xd6f5('0x13')]('=');dials[_0x2b17c8[_0xd6f5('0x4')]]={'routeId':_0x137107[0x1]};}}catch(_0x141825){utils[_0xd6f5('0x14')](util[_0xd6f5('0x2')]('[%s][dials][newexten]',_0x2b17c8[_0xd6f5('0x4')]),_0x141825);}};exports[_0xd6f5('0x15')]=function(_0x8b8e6f){try{utils[_0xd6f5('0xb')](util[_0xd6f5('0x2')](_0xd6f5('0x16'),_0x8b8e6f[_0xd6f5('0x4')]),_0x8b8e6f);if(!_[_0xd6f5('0x17')](_0x8b8e6f[_0xd6f5('0x18')][_0xd6f5('0x19')])){utils[_0xd6f5('0x1')](util[_0xd6f5('0x2')](_0xd6f5('0x1a'),_0x8b8e6f[_0xd6f5('0x4')],_0x8b8e6f[_0xd6f5('0x1b')]));dials[_0x8b8e6f[_0xd6f5('0x4')]]={'routeId':_0x8b8e6f['value']};}}catch(_0x265e2c){utils[_0xd6f5('0x14')](util[_0xd6f5('0x2')]('[%s][dials][varset]',_0x8b8e6f[_0xd6f5('0x4')]),_0x265e2c);}};exports['dialbegin']=function(_0x1bc2e9){try{if(!_['isNil'](dials[_0x1bc2e9[_0xd6f5('0x4')]])){utils[_0xd6f5('0xb')](util[_0xd6f5('0x2')](_0xd6f5('0x1c'),_0x1bc2e9[_0xd6f5('0x4')]),_0x1bc2e9);dials[_0x1bc2e9[_0xd6f5('0x4')]]=_[_0xd6f5('0x1d')](dials[_0x1bc2e9[_0xd6f5('0x4')]],_0x1bc2e9);dials[_0x1bc2e9['uniqueid']]['starttime']=utils[_0xd6f5('0x1e')]();dials[_0x1bc2e9[_0xd6f5('0x4')]]['lastevent']=_0xd6f5('0x1f');utils['info'](util[_0xd6f5('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x1bc2e9['uniqueid'],dials[_0x1bc2e9[_0xd6f5('0x4')]]['starttime']));}}catch(_0x158cb0){utils['error'](util[_0xd6f5('0x2')](_0xd6f5('0x1c'),_0x1bc2e9['uniqueid']),_0x158cb0);}};exports['dialend']=function(_0x553ecd){try{if(!_[_0xd6f5('0x17')](dials[_0x553ecd[_0xd6f5('0x4')]])){utils[_0xd6f5('0xb')](util[_0xd6f5('0x2')](_0xd6f5('0x20'),_0x553ecd[_0xd6f5('0x4')]),_0x553ecd);dials[_0x553ecd['uniqueid']][_0xd6f5('0x7')]=_0x553ecd[_0xd6f5('0x7')];if(_0x553ecd['dialstatus']==_0xd6f5('0x21')){dials[_0x553ecd['uniqueid']]=_['assign'](dials[_0x553ecd[_0xd6f5('0x4')]],_0x553ecd);dials[_0x553ecd[_0xd6f5('0x4')]]['answertime']=utils[_0xd6f5('0x1e')]();dials[_0x553ecd[_0xd6f5('0x4')]]['lastevent']=_0xd6f5('0x22');utils[_0xd6f5('0x1')](util['format'](_0xd6f5('0x23'),_0x553ecd['uniqueid'],_0x553ecd['dialstatus'],dials[_0x553ecd[_0xd6f5('0x4')]][_0xd6f5('0x24')]));}else{utils[_0xd6f5('0x1')](util[_0xd6f5('0x2')](_0xd6f5('0x25'),_0x553ecd[_0xd6f5('0x4')],_0x553ecd[_0xd6f5('0x7')]));}}}catch(_0xd7a87a){utils['error'](util[_0xd6f5('0x2')](_0xd6f5('0x20'),_0x553ecd['uniqueid']),_0xd7a87a);}};exports['hangup']=function(_0x9fc52d){try{if(!_[_0xd6f5('0x17')](dials[_0x9fc52d['uniqueid']])){utils['debug'](util[_0xd6f5('0x2')](_0xd6f5('0x26'),_0x9fc52d[_0xd6f5('0x4')]),_0x9fc52d);utils[_0xd6f5('0x1')](util['format'](_0xd6f5('0x27'),_0x9fc52d['uniqueid'],_0x9fc52d[_0xd6f5('0x28')],_0x9fc52d[_0xd6f5('0x29')],_0x9fc52d[_0xd6f5('0x2a')]));dials[_0x9fc52d[_0xd6f5('0x4')]]=_['assign'](dials[_0x9fc52d[_0xd6f5('0x4')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x9fc52d[_0xd6f5('0x4')]][_0xd6f5('0x2b')]=utils['diffTime'](dials[_0x9fc52d['uniqueid']][_0xd6f5('0x2c')],dials[_0x9fc52d['uniqueid']]['starttime']);dials[_0x9fc52d['uniqueid']][_0xd6f5('0x2d')]=utils[_0xd6f5('0x2e')](dials[_0x9fc52d[_0xd6f5('0x4')]][_0xd6f5('0x24')]||dials[_0x9fc52d[_0xd6f5('0x4')]][_0xd6f5('0x2c')],dials[_0x9fc52d[_0xd6f5('0x4')]][_0xd6f5('0x2f')]);dials[_0x9fc52d[_0xd6f5('0x4')]][_0xd6f5('0x30')]=dials[_0x9fc52d[_0xd6f5('0x4')]][_0xd6f5('0x24')]?utils[_0xd6f5('0x2e')](dials[_0x9fc52d[_0xd6f5('0x4')]][_0xd6f5('0x2c')],dials[_0x9fc52d['uniqueid']]['answertime']):0x0;writeDB(dials[_0x9fc52d['uniqueid']]);}}catch(_0x7fc17){utils[_0xd6f5('0x14')](util[_0xd6f5('0x2')](_0xd6f5('0x26'),_0x9fc52d[_0xd6f5('0x4')]),_0x7fc17);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 97f4e5c..4790757 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 _0xf4f2=['[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','util','xdr','disabled','production','local','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup'];(function(_0x338c24,_0x13ad02){var _0x5f27be=function(_0x25c1ea){while(--_0x25c1ea){_0x338c24['push'](_0x338c24['shift']());}};_0x5f27be(++_0x13ad02);}(_0xf4f2,0x12e));var _0x2f4f=function(_0x532693,_0x194de9){_0x532693=_0x532693-0x0;var _0x51052a=_0xf4f2[_0x532693];return _0x51052a;};var AsteriskManager=require(_0x2f4f('0x0'));var config=require(_0x2f4f('0x1'));var utils=require('./utils');var util=require(_0x2f4f('0x2'));var isXDREnabled=config[_0x2f4f('0x3')]&&config['xdr'][_0x2f4f('0x4')]?!config['xdr']['disabled']:!![];var isProduction=config['env']===_0x2f4f('0x5')||![];var isLocalAsterisk=config['xdr']&&config['xdr'][_0x2f4f('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x2f4f('0x7')]['port'],config[_0x2f4f('0x7')]['ip'],config[_0x2f4f('0x7')][_0x2f4f('0x8')],config[_0x2f4f('0x7')][_0x2f4f('0x9')],!![]);ami[_0x2f4f('0xa')]();if(!isXDREnabled){utils[_0x2f4f('0xb')](_0x2f4f('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x2f4f('0xb')](_0x2f4f('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0x2f4f('0xe'));var queues=require(_0x2f4f('0xf'));var recordings=require(_0x2f4f('0x10'));var members=require(_0x2f4f('0x11'));var dials=require(_0x2f4f('0x12'));var transfers=require(_0x2f4f('0x13'));var core=require(_0x2f4f('0x14'));ami['on'](_0x2f4f('0x15'),core[_0x2f4f('0x15')]);ami['on'](_0x2f4f('0x16'),core[_0x2f4f('0x16')]);ami['on']('fullybooted',core[_0x2f4f('0x17')]);ami['on'](_0x2f4f('0x18'),core['error']);ami['on'](_0x2f4f('0x19'),core['close']);ami['on'](_0x2f4f('0x1a'),core[_0x2f4f('0x1a')]);ami['on']('devicestatechange',function(_0xf27c75){try{utils[_0x2f4f('0x1b')](util['format'](_0x2f4f('0x1c'),_0xf27c75[_0x2f4f('0x1d')]),_0xf27c75);members[_0x2f4f('0x1e')](_0xf27c75);}catch(_0x6772dc){utils[_0x2f4f('0x18')](util['format'](_0x2f4f('0x1c'),_0xf27c75[_0x2f4f('0x1d')]),_0x6772dc);}});ami['on'](_0x2f4f('0x1f'),function(_0x5129ce){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x21'),_0x5129ce[_0x2f4f('0x22')]),_0x5129ce);agents['agentcalled'](_0x5129ce);}catch(_0x2022f9){utils[_0x2f4f('0x18')](util['format'](_0x2f4f('0x21'),_0x5129ce[_0x2f4f('0x22')]),_0x2022f9);}});ami['on'](_0x2f4f('0x23'),function(_0x31feef){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x24'),_0x31feef[_0x2f4f('0x22')]),_0x31feef);agents['agentringnoanswer'](_0x31feef);}catch(_0x482395){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x24'),_0x31feef[_0x2f4f('0x22')]),_0x482395);}});ami['on'](_0x2f4f('0x25'),function(_0x209ce1){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x26'),_0x209ce1[_0x2f4f('0x22')]),_0x209ce1);agents['agentconnect'](_0x209ce1);queues[_0x2f4f('0x25')](_0x209ce1);}catch(_0x471ec8){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')]('[%s][index][agentconnect]',_0x209ce1[_0x2f4f('0x22')]),_0x471ec8);}});ami['on']('agentcomplete',function(_0x18527d){try{utils['debug'](util[_0x2f4f('0x20')](_0x2f4f('0x27'),_0x18527d[_0x2f4f('0x22')]),_0x18527d);agents['agentcomplete'](_0x18527d);queues[_0x2f4f('0x28')](_0x18527d);members[_0x2f4f('0x28')](_0x18527d);}catch(_0x132b62){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')]('[%s][index][agentcomplete]',_0x18527d[_0x2f4f('0x22')]),_0x132b62);}});ami['on']('queuecallerabandon',function(_0x28bdf0){try{utils['debug'](util[_0x2f4f('0x20')]('[%s][index][queuecallerabandon]',_0x28bdf0['uniqueid']),_0x28bdf0);agents[_0x2f4f('0x29')](_0x28bdf0);queues['queuecallerabandon'](_0x28bdf0);}catch(_0x1a73bb){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')]('[%s][index][queuecallerabandon]',_0x28bdf0[_0x2f4f('0x22')]),_0x1a73bb);}});ami['on']('queuecallerjoin',function(_0x564132){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')]('[%s][index][queuecallerjoin]',_0x564132[_0x2f4f('0x22')]),_0x564132);queues[_0x2f4f('0x2a')](_0x564132);recordings[_0x2f4f('0x2a')](_0x564132);}catch(_0x1aa769){utils[_0x2f4f('0x18')](util['format'](_0x2f4f('0x2b'),_0x564132[_0x2f4f('0x22')]),_0x1aa769);}});ami['on'](_0x2f4f('0x2c'),function(_0x488e93){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')]('[%s][index][queuecallerleave]',_0x488e93['uniqueid']),_0x488e93);queues[_0x2f4f('0x2c')](_0x488e93);}catch(_0x5382cf){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x2d'),_0x488e93[_0x2f4f('0x22')]),_0x5382cf);}});ami['on'](_0x2f4f('0x2e'),function(_0x5a7071){try{utils[_0x2f4f('0x1b')](util['format'](_0x2f4f('0x2f'),_0x5a7071[_0x2f4f('0x22')]),_0x5a7071);queues[_0x2f4f('0x2e')](_0x5a7071);calls[_0x2f4f('0x2e')](_0x5a7071);}catch(_0x1f0cb9){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x2f'),_0x5a7071['uniqueid']),_0x1f0cb9);}});ami['on'](_0x2f4f('0x30'),function(_0x1be92b){try{utils['debug'](util[_0x2f4f('0x20')](_0x2f4f('0x31'),_0x1be92b[_0x2f4f('0x22')]),_0x1be92b);queues[_0x2f4f('0x30')](_0x1be92b);calls[_0x2f4f('0x30')](_0x1be92b);}catch(_0x5f33e1){utils['error'](util[_0x2f4f('0x20')](_0x2f4f('0x31'),_0x1be92b['uniqueid']),_0x5f33e1);}});ami['on'](_0x2f4f('0x32'),function(_0x5ed420){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x33'),_0x5ed420[_0x2f4f('0x22')]),_0x5ed420);calls['newstate'](_0x5ed420);recordings['newstate'](_0x5ed420);}catch(_0x326aca){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x33'),_0x5ed420['uniqueid']),_0x326aca);}});ami['on'](_0x2f4f('0x34'),function(_0x2626fd){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x35'),_0x2626fd[_0x2f4f('0x22')]),_0x2626fd);calls[_0x2f4f('0x34')](_0x2626fd);recordings[_0x2f4f('0x34')](_0x2626fd);dials[_0x2f4f('0x34')](_0x2626fd);agents[_0x2f4f('0x34')](_0x2626fd);queues[_0x2f4f('0x34')](_0x2626fd);}catch(_0x51c752){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x35'),_0x2626fd['uniqueid']),_0x51c752);}});ami['on']('cdr',function(_0x4d677a){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x36'),_0x4d677a[_0x2f4f('0x22')]),_0x4d677a);members[_0x2f4f('0x37')](_0x4d677a);}catch(_0x4811f2){utils['error'](util[_0x2f4f('0x20')](_0x2f4f('0x36'),_0x4d677a[_0x2f4f('0x22')]),_0x4811f2);}});ami['on']('blindtransfer',function(_0x40268f){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x38'),_0x40268f[_0x2f4f('0x22')]),_0x40268f);queues['blindtransfer'](_0x40268f);agents[_0x2f4f('0x39')](_0x40268f);transfers[_0x2f4f('0x39')](_0x40268f);}catch(_0x31e868){utils['error'](util['format'](_0x2f4f('0x38'),_0x40268f[_0x2f4f('0x22')]),_0x31e868);}});ami['on']('attendedtransfer',function(_0x253881){try{utils[_0x2f4f('0x1b')](util['format'](_0x2f4f('0x3a'),_0x253881[_0x2f4f('0x3b')]),_0x253881);queues[_0x2f4f('0x3c')](_0x253881);transfers[_0x2f4f('0x3c')](_0x253881);agents[_0x2f4f('0x3c')](_0x253881);calls[_0x2f4f('0x3c')](_0x253881);}catch(_0x16204c){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x3a'),_0x253881[_0x2f4f('0x3b')]),_0x16204c);}});ami['on'](_0x2f4f('0x3d'),function(_0x16d591){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x3e'),_0x16d591[_0x2f4f('0x22')]),_0x16d591);queues[_0x2f4f('0x3d')](_0x16d591);recordings[_0x2f4f('0x3d')](_0x16d591);calls[_0x2f4f('0x3d')](_0x16d591);dials['varset'](_0x16d591);}catch(_0x4fcea9){utils['error'](util['format'](_0x2f4f('0x3e'),_0x16d591[_0x2f4f('0x22')]),_0x4fcea9);}});ami['on'](_0x2f4f('0x3f'),function(_0x4026c0){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x40'),_0x4026c0[_0x2f4f('0x22')]),_0x4026c0);calls[_0x2f4f('0x3f')](_0x4026c0);recordings[_0x2f4f('0x3f')](_0x4026c0);dials[_0x2f4f('0x3f')](_0x4026c0);}catch(_0x1efae0){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x40'),_0x4026c0[_0x2f4f('0x22')]),_0x1efae0);}});ami['on']('newchannel',function(_0x2aa21a){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')](_0x2f4f('0x41'),_0x2aa21a[_0x2f4f('0x22')]),_0x2aa21a);calls['newchannel'](_0x2aa21a);recordings[_0x2f4f('0x42')](_0x2aa21a);}catch(_0x706612){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x41'),_0x2aa21a[_0x2f4f('0x22')]),_0x706612);}});ami['on']('dialbegin',function(_0x571835){try{utils[_0x2f4f('0x1b')](util[_0x2f4f('0x20')]('[%s][index][dialbegin]',_0x571835['uniqueid']),_0x571835);dials[_0x2f4f('0x43')](_0x571835);}catch(_0x4a887f){utils[_0x2f4f('0x18')](util[_0x2f4f('0x20')](_0x2f4f('0x44'),_0x571835['uniqueid']),_0x4a887f);}});ami['on']('dialend',function(_0x1584be){try{utils['debug'](util[_0x2f4f('0x20')](_0x2f4f('0x45'),_0x1584be[_0x2f4f('0x22')]),_0x1584be);dials[_0x2f4f('0x46')](_0x1584be);}catch(_0x4ecb28){utils[_0x2f4f('0x18')](util['format'](_0x2f4f('0x45'),_0x1584be[_0x2f4f('0x22')]),_0x4ecb28);}});} \ No newline at end of file +var _0x7647=['varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','asterisk','port','username','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid'];(function(_0x3c9770,_0x139385){var _0x4df6bf=function(_0x143de5){while(--_0x143de5){_0x3c9770['push'](_0x3c9770['shift']());}};_0x4df6bf(++_0x139385);}(_0x7647,0xe9));var _0x7764=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7647[_0x8c43de];return _0xa6591b;};var AsteriskManager=require(_0x7764('0x0'));var config=require(_0x7764('0x1'));var utils=require('./utils');var util=require(_0x7764('0x2'));var isXDREnabled=config['xdr']&&config[_0x7764('0x3')][_0x7764('0x4')]?!config[_0x7764('0x3')]['disabled']:!![];var isProduction=config[_0x7764('0x5')]===_0x7764('0x6')||![];var isLocalAsterisk=config[_0x7764('0x3')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x7764('0x7')][_0x7764('0x8')],config[_0x7764('0x7')]['ip'],config[_0x7764('0x7')][_0x7764('0x9')],config[_0x7764('0x7')]['password'],!![]);ami[_0x7764('0xa')]();if(!isXDREnabled){utils['info'](_0x7764('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x7764('0xc')](_0x7764('0xd'));}else{var agents=require(_0x7764('0xe'));var calls=require(_0x7764('0xf'));var queues=require(_0x7764('0x10'));var recordings=require(_0x7764('0x11'));var members=require(_0x7764('0x12'));var dials=require(_0x7764('0x13'));var transfers=require(_0x7764('0x14'));var core=require(_0x7764('0x15'));ami['on']('connect',core[_0x7764('0x16')]);ami['on'](_0x7764('0x17'),core[_0x7764('0x17')]);ami['on'](_0x7764('0x18'),core[_0x7764('0x18')]);ami['on'](_0x7764('0x19'),core[_0x7764('0x19')]);ami['on']('close',core[_0x7764('0x1a')]);ami['on'](_0x7764('0x1b'),core[_0x7764('0x1b')]);ami['on'](_0x7764('0x1c'),function(_0x387525){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x1f'),_0x387525['device']),_0x387525);members['devicestatechange'](_0x387525);}catch(_0x14c8e0){utils[_0x7764('0x19')](util[_0x7764('0x1e')](_0x7764('0x1f'),_0x387525[_0x7764('0x20')]),_0x14c8e0);}});ami['on'](_0x7764('0x21'),function(_0x1ffef8){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x22'),_0x1ffef8[_0x7764('0x23')]),_0x1ffef8);agents[_0x7764('0x21')](_0x1ffef8);}catch(_0x312e77){utils[_0x7764('0x19')](util[_0x7764('0x1e')]('[%s][index][agentcalled]',_0x1ffef8[_0x7764('0x23')]),_0x312e77);}});ami['on'](_0x7764('0x24'),function(_0x17bc1a){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x25'),_0x17bc1a[_0x7764('0x23')]),_0x17bc1a);agents[_0x7764('0x24')](_0x17bc1a);}catch(_0x1d0413){utils[_0x7764('0x19')](util[_0x7764('0x1e')]('[%s][index][agentringnoanswer]',_0x17bc1a[_0x7764('0x23')]),_0x1d0413);}});ami['on'](_0x7764('0x26'),function(_0x5bce76){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x27'),_0x5bce76['uniqueid']),_0x5bce76);agents[_0x7764('0x26')](_0x5bce76);queues[_0x7764('0x26')](_0x5bce76);}catch(_0x4c8067){utils['error'](util[_0x7764('0x1e')](_0x7764('0x27'),_0x5bce76[_0x7764('0x23')]),_0x4c8067);}});ami['on'](_0x7764('0x28'),function(_0x1716b2){try{utils['debug'](util[_0x7764('0x1e')](_0x7764('0x29'),_0x1716b2[_0x7764('0x23')]),_0x1716b2);agents[_0x7764('0x28')](_0x1716b2);queues[_0x7764('0x28')](_0x1716b2);members[_0x7764('0x28')](_0x1716b2);}catch(_0x561f25){utils['error'](util[_0x7764('0x1e')](_0x7764('0x29'),_0x1716b2[_0x7764('0x23')]),_0x561f25);}});ami['on'](_0x7764('0x2a'),function(_0x533a2c){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x2b'),_0x533a2c[_0x7764('0x23')]),_0x533a2c);agents[_0x7764('0x2a')](_0x533a2c);queues[_0x7764('0x2a')](_0x533a2c);}catch(_0x31a4ee){utils[_0x7764('0x19')](util[_0x7764('0x1e')](_0x7764('0x2b'),_0x533a2c[_0x7764('0x23')]),_0x31a4ee);}});ami['on']('queuecallerjoin',function(_0x425257){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x2c'),_0x425257[_0x7764('0x23')]),_0x425257);queues[_0x7764('0x2d')](_0x425257);recordings[_0x7764('0x2d')](_0x425257);}catch(_0x363e07){utils[_0x7764('0x19')](util[_0x7764('0x1e')](_0x7764('0x2c'),_0x425257[_0x7764('0x23')]),_0x363e07);}});ami['on'](_0x7764('0x2e'),function(_0x32a650){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x2f'),_0x32a650[_0x7764('0x23')]),_0x32a650);queues[_0x7764('0x2e')](_0x32a650);}catch(_0x33c9d1){utils[_0x7764('0x19')](util[_0x7764('0x1e')](_0x7764('0x2f'),_0x32a650[_0x7764('0x23')]),_0x33c9d1);}});ami['on']('musiconholdstart',function(_0x57d246){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x30'),_0x57d246[_0x7764('0x23')]),_0x57d246);queues[_0x7764('0x31')](_0x57d246);calls[_0x7764('0x31')](_0x57d246);}catch(_0x4f77bf){utils['error'](util[_0x7764('0x1e')]('[%s][index][musiconholdstart]',_0x57d246[_0x7764('0x23')]),_0x4f77bf);}});ami['on']('musiconholdstop',function(_0x258411){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x32'),_0x258411['uniqueid']),_0x258411);queues[_0x7764('0x33')](_0x258411);calls[_0x7764('0x33')](_0x258411);}catch(_0x2b2602){utils['error'](util[_0x7764('0x1e')]('[%s][index][musiconholdstop]',_0x258411[_0x7764('0x23')]),_0x2b2602);}});ami['on'](_0x7764('0x34'),function(_0x3ebff3){try{utils[_0x7764('0x1d')](util['format']('[%s][index][newstate]',_0x3ebff3[_0x7764('0x23')]),_0x3ebff3);calls[_0x7764('0x34')](_0x3ebff3);recordings[_0x7764('0x34')](_0x3ebff3);}catch(_0x35dd3c){utils['error'](util['format'](_0x7764('0x35'),_0x3ebff3[_0x7764('0x23')]),_0x35dd3c);}});ami['on']('hangup',function(_0xe756a5){try{utils['debug'](util['format'](_0x7764('0x36'),_0xe756a5[_0x7764('0x23')]),_0xe756a5);calls[_0x7764('0x37')](_0xe756a5);recordings[_0x7764('0x37')](_0xe756a5);dials[_0x7764('0x37')](_0xe756a5);agents['hangup'](_0xe756a5);queues[_0x7764('0x37')](_0xe756a5);}catch(_0x39620c){utils[_0x7764('0x19')](util['format'](_0x7764('0x36'),_0xe756a5[_0x7764('0x23')]),_0x39620c);}});ami['on']('cdr',function(_0x405b2b){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x38'),_0x405b2b[_0x7764('0x23')]),_0x405b2b);members[_0x7764('0x39')](_0x405b2b);}catch(_0x10c34e){utils[_0x7764('0x19')](util[_0x7764('0x1e')](_0x7764('0x38'),_0x405b2b[_0x7764('0x23')]),_0x10c34e);}});ami['on']('blindtransfer',function(_0x334989){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x3a'),_0x334989[_0x7764('0x23')]),_0x334989);queues[_0x7764('0x3b')](_0x334989);agents[_0x7764('0x3b')](_0x334989);transfers[_0x7764('0x3b')](_0x334989);}catch(_0x319fdc){utils[_0x7764('0x19')](util['format']('[%s][index][blindtransfer]',_0x334989[_0x7764('0x23')]),_0x319fdc);}});ami['on'](_0x7764('0x3c'),function(_0xfc0565){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x3d'),_0xfc0565['origtransfereruniqueid']),_0xfc0565);queues[_0x7764('0x3c')](_0xfc0565);transfers[_0x7764('0x3c')](_0xfc0565);agents[_0x7764('0x3c')](_0xfc0565);calls[_0x7764('0x3c')](_0xfc0565);}catch(_0x1786da){utils[_0x7764('0x19')](util[_0x7764('0x1e')](_0x7764('0x3d'),_0xfc0565[_0x7764('0x3e')]),_0x1786da);}});ami['on'](_0x7764('0x3f'),function(_0x3934c4){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x40'),_0x3934c4[_0x7764('0x23')]),_0x3934c4);queues[_0x7764('0x3f')](_0x3934c4);recordings[_0x7764('0x3f')](_0x3934c4);calls[_0x7764('0x3f')](_0x3934c4);dials[_0x7764('0x3f')](_0x3934c4);}catch(_0x4774e8){utils[_0x7764('0x19')](util[_0x7764('0x1e')](_0x7764('0x40'),_0x3934c4[_0x7764('0x23')]),_0x4774e8);}});ami['on'](_0x7764('0x41'),function(_0x536ca0){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x42'),_0x536ca0['uniqueid']),_0x536ca0);calls[_0x7764('0x41')](_0x536ca0);recordings[_0x7764('0x41')](_0x536ca0);dials['newexten'](_0x536ca0);}catch(_0x3b062e){utils[_0x7764('0x19')](util['format'](_0x7764('0x42'),_0x536ca0[_0x7764('0x23')]),_0x3b062e);}});ami['on'](_0x7764('0x43'),function(_0xefa74c){try{utils['debug'](util['format'](_0x7764('0x44'),_0xefa74c['uniqueid']),_0xefa74c);calls[_0x7764('0x43')](_0xefa74c);recordings[_0x7764('0x43')](_0xefa74c);}catch(_0x2eeb31){utils['error'](util['format'](_0x7764('0x44'),_0xefa74c[_0x7764('0x23')]),_0x2eeb31);}});ami['on'](_0x7764('0x45'),function(_0x564b9d){try{utils['debug'](util['format'](_0x7764('0x46'),_0x564b9d['uniqueid']),_0x564b9d);dials[_0x7764('0x45')](_0x564b9d);}catch(_0x214dc2){utils[_0x7764('0x19')](util['format'](_0x7764('0x47'),_0x564b9d[_0x7764('0x23')]),_0x214dc2);}});ami['on'](_0x7764('0x48'),function(_0x2f915a){try{utils[_0x7764('0x1d')](util[_0x7764('0x1e')](_0x7764('0x49'),_0x2f915a['uniqueid']),_0x2f915a);dials[_0x7764('0x48')](_0x2f915a);}catch(_0x374ee6){utils['error'](util['format'](_0x7764('0x49'),_0x2f915a['uniqueid']),_0x374ee6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4f78ea8..1b4fc4f 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 _0x8865=['then','name','internal','request','CreateMemberReport','getUserByName','catch','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','BUSY','voice','TALKING','now','agent','isNil','exitAt','duration','diffTime','enterAt','error','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','destinationchannel','lodash','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface'];(function(_0x28f69f,_0x401e5d){var _0x4881c8=function(_0x2e4b06){while(--_0x2e4b06){_0x28f69f['push'](_0x28f69f['shift']());}};_0x4881c8(++_0x401e5d);}(_0x8865,0x173));var _0x5886=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x8865[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x5886('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x5886('0x1'),_0x5886('0x2')];function writeDB(_0x48f3b0){utils[_0x5886('0x3')](util[_0x5886('0x4')](_0x5886('0x5'),_0x48f3b0[_0x5886('0x6')],_0x48f3b0[_0x5886('0x7')],_0x48f3b0[_0x5886('0x8')],_0x48f3b0[_0x5886('0x9')],_0x48f3b0[_0x5886('0xa')],_0x48f3b0[_0x5886('0xb')]));if(_0x48f3b0['interface']){utils[_0x5886('0xc')](_0x48f3b0[_0x5886('0x7')])[_0x5886('0xd')](function(_0x56980b){if(_0x56980b){_0x48f3b0[_0x5886('0xa')]=_0x56980b[_0x5886('0xe')];_0x48f3b0['internal']=_0x56980b[_0x5886('0xf')];utils[_0x5886('0x10')](_0x5886('0x11'),_0x48f3b0);}else{utils[_0x5886('0x12')](_0x48f3b0[_0x5886('0x7')]['split']('/')[0x1])['then'](function(_0x2b5367){if(_0x2b5367){_0x48f3b0[_0x5886('0xa')]=_0x2b5367[_0x5886('0xe')];_0x48f3b0['internal']=_0x2b5367[_0x5886('0xf')];utils[_0x5886('0x10')]('CreateMemberReport',_0x48f3b0);}});}})[_0x5886('0x13')](function(_0xba0238){utils['error'](util['format'](_0x5886('0x14'),_0x48f3b0[_0x5886('0x6')]),_0xba0238);});}delete members[_0x48f3b0[_0x5886('0x7')]];}function startsWith(_0x2e7df7,_0x119a01){return _['some'](_0x2e7df7,function(_0x510752){return _['startsWith'](_0x119a01,_0x510752);});}exports[_0x5886('0x15')]=function(_0x2e3b9c){try{utils[_0x5886('0x16')](util[_0x5886('0x4')](_0x5886('0x17'),members[_0x2e3b9c['device']]?members[_0x2e3b9c[_0x5886('0x18')]][_0x5886('0x6')]:_0x2e3b9c['device']),_0x2e3b9c);utils[_0x5886('0x3')](util[_0x5886('0x4')](_0x5886('0x19'),members[_0x2e3b9c['device']]?members[_0x2e3b9c[_0x5886('0x18')]]['uniqueid']:_0x2e3b9c[_0x5886('0x18')],_0x2e3b9c['state'],_0x2e3b9c[_0x5886('0x18')]));switch(_0x2e3b9c['state']){case'INUSE':case _0x5886('0x1a'):if(!startsWith(exclude,_0x2e3b9c[_0x5886('0x18')])){members[_0x2e3b9c[_0x5886('0x18')]]={'channel':_0x5886('0x1b'),'interface':_0x2e3b9c[_0x5886('0x18')],'type':_0x5886('0x1c'),'enterAt':utils[_0x5886('0x1d')](),'role':_0x5886('0x1e')};}break;case'NOT_INUSE':if(!_[_0x5886('0x1f')](members[_0x2e3b9c['device']])){members[_0x2e3b9c[_0x5886('0x18')]][_0x5886('0x20')]=utils[_0x5886('0x1d')]();members[_0x2e3b9c[_0x5886('0x18')]][_0x5886('0x21')]=utils[_0x5886('0x22')](members[_0x2e3b9c[_0x5886('0x18')]]['exitAt'],members[_0x2e3b9c[_0x5886('0x18')]][_0x5886('0x23')]);if(members[_0x2e3b9c[_0x5886('0x18')]][_0x5886('0x6')]){writeDB(members[_0x2e3b9c[_0x5886('0x18')]]);}}break;default:break;}}catch(_0x270b7a){utils[_0x5886('0x24')](util[_0x5886('0x4')](_0x5886('0x17'),members[_0x2e3b9c[_0x5886('0x18')]]?members[_0x2e3b9c['device']]['uniqueid']:_0x2e3b9c[_0x5886('0x18')]),_0x270b7a);}};exports['agentcomplete']=function(_0xdbb815){try{if(!_['isNil'](members[_0xdbb815['interface']])){utils[_0x5886('0x16')](util[_0x5886('0x4')](_0x5886('0x25'),_0xdbb815[_0x5886('0x6')]),_0xdbb815);utils[_0x5886('0x3')](util[_0x5886('0x4')](_0x5886('0x26'),_0xdbb815[_0x5886('0x6')],_0xdbb815[_0x5886('0x7')],_0xdbb815[_0x5886('0x27')]));members[_0xdbb815[_0x5886('0x7')]]=_[_0x5886('0x28')](members[_0xdbb815['interface']],{'data4':_0xdbb815[_0x5886('0x27')],'uniqueid':_0xdbb815[_0x5886('0x6')]});}}catch(_0x365def){utils[_0x5886('0x24')](util['format'](_0x5886('0x25'),_0xdbb815[_0x5886('0x6')]),_0x365def);}};exports[_0x5886('0x29')]=function(_0xb0efc2){try{utils[_0x5886('0x16')](util[_0x5886('0x4')](_0x5886('0x2a'),_0xb0efc2[_0x5886('0x6')]),_0xb0efc2);if(_0xb0efc2[_0x5886('0x8')]){var _0x45b2b1=_0xb0efc2[_0x5886('0x8')]['split']('-')[0x0];if(!_[_0x5886('0x1f')](members[_0x45b2b1])){members[_0x45b2b1]=_[_0x5886('0x28')](members[_0x45b2b1],{'data1':members[_0x45b2b1][_0x5886('0x2b')]||_0xb0efc2[_0x5886('0xb')],'data2':members[_0x45b2b1]['data2']||_0xb0efc2[_0x5886('0x2c')],'data3':members[_0x45b2b1][_0x5886('0x2d')]||_0xb0efc2[_0x5886('0x2e')],'uniqueid':members[_0x45b2b1]['uniqueid']||_0xb0efc2[_0x5886('0x6')]});utils[_0x5886('0x3')](util[_0x5886('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xb0efc2[_0x5886('0x6')],members[_0x45b2b1][_0x5886('0x2b')],members[_0x45b2b1]['data2'],members[_0x45b2b1]['data3']));if(members[_0x45b2b1][_0x5886('0x20')]){writeDB(members[_0x45b2b1]);}}}if(_0xb0efc2[_0x5886('0x2f')]){var _0x59d1ec=_0xb0efc2[_0x5886('0x2f')]['split']('-')[0x0];if(!_['isNil'](members[_0x59d1ec])){members[_0x59d1ec]=_[_0x5886('0x28')](members[_0x59d1ec],{'data1':members[_0x59d1ec]['data1']||_0xb0efc2[_0x5886('0xb')],'data2':members[_0x59d1ec][_0x5886('0x9')]||_0xb0efc2[_0x5886('0x2c')],'data3':members[_0x59d1ec][_0x5886('0x2d')]||_0xb0efc2[_0x5886('0x2e')],'uniqueid':members[_0x59d1ec][_0x5886('0x6')]||_0xb0efc2[_0x5886('0x6')]});utils['info'](util[_0x5886('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xb0efc2[_0x5886('0x6')],members[_0x59d1ec][_0x5886('0x2b')],members[_0x59d1ec][_0x5886('0x9')],members[_0x59d1ec]['data3']));if(members[_0x59d1ec][_0x5886('0x20')]){writeDB(members[_0x59d1ec]);}}}}catch(_0x4f88a9){utils[_0x5886('0x24')](util[_0x5886('0x4')](_0x5886('0x2a'),_0xb0efc2['uniqueid']),_0x4f88a9);}}; \ No newline at end of file +var _0xde50=['error','some','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','now','duration','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][cdr]','channel','assign','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','./utils','Local/_attended@transfer','Queue:','format','uniqueid','membername','type','interface','name','internal','CreateMemberReport','getUserByName','split','then','request','catch'];(function(_0x22ad0f,_0x35bb20){var _0x1ea528=function(_0x3bf2c5){while(--_0x3bf2c5){_0x22ad0f['push'](_0x22ad0f['shift']());}};_0x1ea528(++_0x35bb20);}(_0xde50,0x140));var _0x0de5=function(_0x192c7c,_0x5c1136){_0x192c7c=_0x192c7c-0x0;var _0x2b01f8=_0xde50[_0x192c7c];return _0x2b01f8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0de5('0x0'));var members={};var exclude=[_0x0de5('0x1'),_0x0de5('0x2')];function writeDB(_0x3ae828){utils['info'](util[_0x0de5('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3ae828[_0x0de5('0x4')],_0x3ae828['interface'],_0x3ae828['channel'],_0x3ae828['data2'],_0x3ae828[_0x0de5('0x5')],_0x3ae828[_0x0de5('0x6')]));if(_0x3ae828[_0x0de5('0x7')]){utils['getUserByInterface'](_0x3ae828[_0x0de5('0x7')])['then'](function(_0x54c94f){if(_0x54c94f){_0x3ae828['membername']=_0x54c94f[_0x0de5('0x8')];_0x3ae828[_0x0de5('0x9')]=_0x54c94f[_0x0de5('0x9')];utils['request'](_0x0de5('0xa'),_0x3ae828);}else{utils[_0x0de5('0xb')](_0x3ae828['interface'][_0x0de5('0xc')]('/')[0x1])[_0x0de5('0xd')](function(_0x4040c6){if(_0x4040c6){_0x3ae828['membername']=_0x4040c6['name'];_0x3ae828[_0x0de5('0x9')]=_0x4040c6[_0x0de5('0x9')];utils[_0x0de5('0xe')](_0x0de5('0xa'),_0x3ae828);}});}})[_0x0de5('0xf')](function(_0x5ba869){utils[_0x0de5('0x10')](util['format']('[%s][members][writeDB]',_0x3ae828[_0x0de5('0x4')]),_0x5ba869);});}delete members[_0x3ae828[_0x0de5('0x7')]];}function startsWith(_0x443218,_0x92fe6d){return _[_0x0de5('0x11')](_0x443218,function(_0x2be086){return _['startsWith'](_0x92fe6d,_0x2be086);});}exports[_0x0de5('0x12')]=function(_0xeb58e1){try{utils[_0x0de5('0x13')](util[_0x0de5('0x3')](_0x0de5('0x14'),members[_0xeb58e1[_0x0de5('0x15')]]?members[_0xeb58e1['device']][_0x0de5('0x4')]:_0xeb58e1['device']),_0xeb58e1);utils[_0x0de5('0x16')](util[_0x0de5('0x3')](_0x0de5('0x17'),members[_0xeb58e1[_0x0de5('0x15')]]?members[_0xeb58e1['device']][_0x0de5('0x4')]:_0xeb58e1['device'],_0xeb58e1[_0x0de5('0x18')],_0xeb58e1[_0x0de5('0x15')]));switch(_0xeb58e1[_0x0de5('0x18')]){case'INUSE':case _0x0de5('0x19'):if(!startsWith(exclude,_0xeb58e1[_0x0de5('0x15')])){members[_0xeb58e1[_0x0de5('0x15')]]={'channel':_0x0de5('0x1a'),'interface':_0xeb58e1['device'],'type':_0x0de5('0x1b'),'enterAt':utils['now'](),'role':_0x0de5('0x1c')};}break;case _0x0de5('0x1d'):if(!_[_0x0de5('0x1e')](members[_0xeb58e1[_0x0de5('0x15')]])){members[_0xeb58e1['device']]['exitAt']=utils[_0x0de5('0x1f')]();members[_0xeb58e1['device']][_0x0de5('0x20')]=utils['diffTime'](members[_0xeb58e1[_0x0de5('0x15')]][_0x0de5('0x21')],members[_0xeb58e1[_0x0de5('0x15')]][_0x0de5('0x22')]);if(members[_0xeb58e1[_0x0de5('0x15')]]['uniqueid']){writeDB(members[_0xeb58e1[_0x0de5('0x15')]]);}}break;default:break;}}catch(_0x17b0f9){utils[_0x0de5('0x10')](util[_0x0de5('0x3')](_0x0de5('0x14'),members[_0xeb58e1[_0x0de5('0x15')]]?members[_0xeb58e1['device']][_0x0de5('0x4')]:_0xeb58e1['device']),_0x17b0f9);}};exports['agentcomplete']=function(_0x2b6853){try{if(!_['isNil'](members[_0x2b6853['interface']])){utils[_0x0de5('0x13')](util[_0x0de5('0x3')](_0x0de5('0x23'),_0x2b6853['uniqueid']),_0x2b6853);utils[_0x0de5('0x16')](util['format'](_0x0de5('0x24'),_0x2b6853[_0x0de5('0x4')],_0x2b6853[_0x0de5('0x7')],_0x2b6853[_0x0de5('0x25')]));members[_0x2b6853['interface']]=_['assign'](members[_0x2b6853[_0x0de5('0x7')]],{'data4':_0x2b6853[_0x0de5('0x25')],'uniqueid':_0x2b6853[_0x0de5('0x4')]});}}catch(_0x192dd6){utils[_0x0de5('0x10')](util['format'](_0x0de5('0x23'),_0x2b6853[_0x0de5('0x4')]),_0x192dd6);}};exports['cdr']=function(_0x5205ab){try{utils[_0x0de5('0x13')](util[_0x0de5('0x3')](_0x0de5('0x26'),_0x5205ab[_0x0de5('0x4')]),_0x5205ab);if(_0x5205ab[_0x0de5('0x27')]){var _0x29effb=_0x5205ab[_0x0de5('0x27')]['split']('-')[0x0];if(!_[_0x0de5('0x1e')](members[_0x29effb])){members[_0x29effb]=_[_0x0de5('0x28')](members[_0x29effb],{'data1':members[_0x29effb]['data1']||_0x5205ab[_0x0de5('0x6')],'data2':members[_0x29effb][_0x0de5('0x29')]||_0x5205ab[_0x0de5('0x2a')],'data3':members[_0x29effb][_0x0de5('0x2b')]||_0x5205ab[_0x0de5('0x2c')],'uniqueid':members[_0x29effb][_0x0de5('0x4')]||_0x5205ab[_0x0de5('0x4')]});utils[_0x0de5('0x16')](util['format'](_0x0de5('0x2d'),_0x5205ab['uniqueid'],members[_0x29effb][_0x0de5('0x2e')],members[_0x29effb]['data2'],members[_0x29effb][_0x0de5('0x2b')]));if(members[_0x29effb][_0x0de5('0x21')]){writeDB(members[_0x29effb]);}}}if(_0x5205ab[_0x0de5('0x2f')]){var _0x49f80a=_0x5205ab[_0x0de5('0x2f')][_0x0de5('0xc')]('-')[0x0];if(!_[_0x0de5('0x1e')](members[_0x49f80a])){members[_0x49f80a]=_[_0x0de5('0x28')](members[_0x49f80a],{'data1':members[_0x49f80a][_0x0de5('0x2e')]||_0x5205ab['type'],'data2':members[_0x49f80a][_0x0de5('0x29')]||_0x5205ab['source'],'data3':members[_0x49f80a]['data3']||_0x5205ab['destination'],'uniqueid':members[_0x49f80a][_0x0de5('0x4')]||_0x5205ab[_0x0de5('0x4')]});utils[_0x0de5('0x16')](util[_0x0de5('0x3')](_0x0de5('0x2d'),_0x5205ab['uniqueid'],members[_0x49f80a]['data1'],members[_0x49f80a][_0x0de5('0x29')],members[_0x49f80a][_0x0de5('0x2b')]));if(members[_0x49f80a][_0x0de5('0x21')]){writeDB(members[_0x49f80a]);}}}}catch(_0xbb9bf7){utils[_0x0de5('0x10')](util['format'](_0x0de5('0x26'),_0x5205ab[_0x0de5('0x4')]),_0xbb9bf7);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6434491..05f717e 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 _0x4f48=['debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','accountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin'];(function(_0x546a6d,_0x2f839d){var _0x2847a1=function(_0x56ca4b){while(--_0x56ca4b){_0x546a6d['push'](_0x546a6d['shift']());}};_0x2847a1(++_0x2f839d);}(_0x4f48,0x179));var _0x84f4=function(_0x58d9f9,_0x5b5fb9){_0x58d9f9=_0x58d9f9-0x0;var _0x13de9e=_0x4f48[_0x58d9f9];return _0x13de9e;};'use strict';var _=require(_0x84f4('0x0'));var util=require('util');var utils=require(_0x84f4('0x1'));var queues={};function writeDB(_0x326f05){utils[_0x84f4('0x2')](util[_0x84f4('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x326f05[_0x84f4('0x4')],_0x326f05[_0x84f4('0x5')],_0x326f05[_0x84f4('0x6')],_0x326f05[_0x84f4('0x7')],_0x326f05['calleridnum'],_0x326f05['accountcode'],_0x326f05[_0x84f4('0x8')]));if(_0x326f05[_0x84f4('0x6')]){utils['getVoiceQueueByName'](_0x326f05[_0x84f4('0x6')])[_0x84f4('0x9')](function(_0x2b5d14){if(_0x2b5d14){_0x326f05[_0x84f4('0xa')]=_0x2b5d14[_0x84f4('0xa')];}utils['request'](_0x84f4('0xb'),_0x326f05);});}else{utils[_0x84f4('0xc')](_0x84f4('0xb'),_0x326f05);}if(_0x326f05[_0x84f4('0xd')]){delete queues[_0x326f05[_0x84f4('0xd')]];}else{delete queues[_0x326f05['uniqueid']];}}exports[_0x84f4('0xe')]=function(_0x3c18d6){try{utils[_0x84f4('0xf')](util[_0x84f4('0x3')](_0x84f4('0x10'),_0x3c18d6[_0x84f4('0x4')]),_0x3c18d6);utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x11'),_0x3c18d6[_0x84f4('0x4')],_0x3c18d6[_0x84f4('0x6')],_0x3c18d6[_0x84f4('0x12')]));queues[_0x3c18d6[_0x84f4('0x4')]]=_[_0x84f4('0x13')](_0x3c18d6,{'originalposition':_0x3c18d6[_0x84f4('0x12')],'queuecallerjoinAt':utils[_0x84f4('0x14')](),'mohtime':0x0});}catch(_0x42c6c2){utils[_0x84f4('0x15')](util[_0x84f4('0x3')](_0x84f4('0x10'),_0x3c18d6[_0x84f4('0x4')]),_0x42c6c2);}};exports[_0x84f4('0x16')]=function(_0x1fe541){try{if(!_['isNil'](queues[_0x1fe541[_0x84f4('0x4')]])){utils[_0x84f4('0xf')](util['format'](_0x84f4('0x17'),_0x1fe541['uniqueid']),_0x1fe541);if(queues[_0x1fe541[_0x84f4('0x4')]][_0x84f4('0x18')]){if(!queues[_0x1fe541['uniqueid']][_0x84f4('0x19')]&&!queues[_0x1fe541[_0x84f4('0x4')]][_0x84f4('0x1a')]){queues[_0x1fe541[_0x84f4('0x4')]][_0x84f4('0x1b')]=!![];queues[_0x1fe541[_0x84f4('0x4')]][_0x84f4('0x1c')]=utils['now']();queues[_0x1fe541[_0x84f4('0x4')]][_0x84f4('0x8')]=_0x84f4('0x1d');}utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x1e'),_0x1fe541[_0x84f4('0x4')],queues[_0x1fe541[_0x84f4('0x4')]]['name'],queues[_0x1fe541['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x1fe541[_0x84f4('0x4')]]);}else if(queues[_0x1fe541[_0x84f4('0x4')]]['transfereduniqueid']){utils['info'](util[_0x84f4('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x1fe541['uniqueid'],queues[_0x1fe541['uniqueid']][_0x84f4('0x1f')],queues[_0x1fe541[_0x84f4('0x4')]][_0x84f4('0xd')]));queues[queues[_0x1fe541[_0x84f4('0x4')]][_0x84f4('0xd')]]=queues[_0x1fe541[_0x84f4('0x4')]];queues[queues[_0x1fe541[_0x84f4('0x4')]][_0x84f4('0xd')]][_0x84f4('0x20')]=0x2;delete queues[_0x1fe541[_0x84f4('0x4')]];}}}catch(_0x57fbbe){utils[_0x84f4('0x15')](util[_0x84f4('0x3')](_0x84f4('0x17'),_0x1fe541['uniqueid']),_0x57fbbe);}};exports['varset']=function(_0x1e4205){try{utils[_0x84f4('0xf')](util[_0x84f4('0x3')](_0x84f4('0x21'),_0x1e4205['uniqueid']),_0x1e4205);if(!_[_0x84f4('0x22')](_0x1e4205[_0x84f4('0x23')][_0x84f4('0x24')])&&_0x1e4205[_0x84f4('0x25')][_0x84f4('0x26')]()!=='CONTINUE'){if(!_[_0x84f4('0x22')](queues[_0x1e4205[_0x84f4('0x4')]])){queues[_0x1e4205['uniqueid']][_0x84f4('0x19')]=![];queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x27')]=null;queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x1a')]=!![];queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x28')]=utils[_0x84f4('0x14')]();queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x8')]=_0x1e4205['value'][_0x84f4('0x26')]();utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x29'),_0x1e4205[_0x84f4('0x4')],queues[_0x1e4205['uniqueid']]['name'],_0x1e4205[_0x84f4('0x25')],queues[_0x1e4205[_0x84f4('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x1e4205[_0x84f4('0x4')]]);}}else if(!_[_0x84f4('0x22')](_0x1e4205[_0x84f4('0x23')][_0x84f4('0x2a')])){if(!_['isNil'](queues[_0x1e4205[_0x84f4('0x4')]])&&!queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x19')]){queues[_0x1e4205['uniqueid']][_0x84f4('0x19')]=![];queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x27')]=null;queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x1a')]=!![];queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x28')]=utils[_0x84f4('0x14')]();queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x8')]=_0x84f4('0x2b');utils[_0x84f4('0x2')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1e4205[_0x84f4('0x4')],queues[_0x1e4205[_0x84f4('0x4')]][_0x84f4('0x1f')],_0x1e4205[_0x84f4('0x25')],queues[_0x1e4205[_0x84f4('0x4')]]['queuecallerexitreason']));}}}catch(_0x486cb6){utils['error'](util[_0x84f4('0x3')](_0x84f4('0x21'),_0x1e4205['uniqueid']),_0x486cb6);}};exports['queuecallerabandon']=function(_0x5b45ce){try{if(!_[_0x84f4('0x22')](queues[_0x5b45ce['uniqueid']])){utils[_0x84f4('0xf')](util[_0x84f4('0x3')]('[%s][queues][queuecallerabandon]',_0x5b45ce[_0x84f4('0x4')]),_0x5b45ce);queues[_0x5b45ce[_0x84f4('0x4')]][_0x84f4('0x1a')]=![];queues[_0x5b45ce[_0x84f4('0x4')]]['queuecallerexitAt']=null;queues[_0x5b45ce['uniqueid']][_0x84f4('0x19')]=!![];queues[_0x5b45ce[_0x84f4('0x4')]][_0x84f4('0x27')]=utils[_0x84f4('0x14')]();queues[_0x5b45ce[_0x84f4('0x4')]]['queuecallerexitreason']=_0x84f4('0x2c');utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x2d'),_0x5b45ce[_0x84f4('0x4')],queues[_0x5b45ce[_0x84f4('0x4')]][_0x84f4('0x1f')],queues[_0x5b45ce[_0x84f4('0x4')]][_0x84f4('0x8')]));}}catch(_0x3bbdc9){utils[_0x84f4('0x15')](util[_0x84f4('0x3')]('[%s][queues][queuecallerabandon]',_0x5b45ce[_0x84f4('0x4')]),_0x3bbdc9);}};exports[_0x84f4('0x2e')]=function(_0x5297f9){try{if(!_['isNil'](queues[_0x5297f9['uniqueid']])){utils[_0x84f4('0xf')](util[_0x84f4('0x3')](_0x84f4('0x2f'),_0x5297f9[_0x84f4('0x4')]),_0x5297f9);utils[_0x84f4('0x2')](util[_0x84f4('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5297f9[_0x84f4('0x4')],queues[_0x5297f9['uniqueid']][_0x84f4('0x1f')],_0x5297f9[_0x84f4('0x30')],_0x5297f9[_0x84f4('0x31')]));queues[_0x5297f9[_0x84f4('0x4')]][_0x84f4('0x2e')]=!![];queues[_0x5297f9[_0x84f4('0x4')]]['queuecallerleaveAt']=utils['now']();queues[_0x5297f9[_0x84f4('0x4')]]['holdtime']=utils[_0x84f4('0x32')](queues[_0x5297f9[_0x84f4('0x4')]][_0x84f4('0x18')],queues[_0x5297f9['uniqueid']][_0x84f4('0x33')]);queues[_0x5297f9[_0x84f4('0x4')]][_0x84f4('0x12')]=_0x5297f9[_0x84f4('0x12')];queues[_0x5297f9[_0x84f4('0x4')]]['count']=_0x5297f9[_0x84f4('0x34')];queues[_0x5297f9[_0x84f4('0x4')]][_0x84f4('0x30')]=_0x5297f9[_0x84f4('0x30')];queues[_0x5297f9[_0x84f4('0x4')]][_0x84f4('0x31')]=_0x5297f9[_0x84f4('0x31')];}}catch(_0x52ab70){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x5297f9[_0x84f4('0x4')]),_0x52ab70);}};exports[_0x84f4('0x35')]=function(_0x346184){try{if(!_['isNil'](queues[_0x346184[_0x84f4('0x4')]])){utils[_0x84f4('0xf')](util[_0x84f4('0x3')](_0x84f4('0x36'),_0x346184[_0x84f4('0x4')]),_0x346184);utils[_0x84f4('0x2')](util[_0x84f4('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x346184['uniqueid'],queues[_0x346184['uniqueid']][_0x84f4('0x1f')],_0x346184[_0x84f4('0x37')],_0x346184[_0x84f4('0x38')]));queues[_0x346184[_0x84f4('0x4')]][_0x84f4('0x19')]=![];queues[_0x346184[_0x84f4('0x4')]][_0x84f4('0x19')]=![];queues[_0x346184[_0x84f4('0x4')]][_0x84f4('0x27')]=null;queues[_0x346184['uniqueid']][_0x84f4('0x1a')]=![];queues[_0x346184[_0x84f4('0x4')]][_0x84f4('0x8')]=null;queues[_0x346184[_0x84f4('0x4')]][_0x84f4('0x28')]=null;queues[_0x346184[_0x84f4('0x4')]]['assigned']=!![];queues[_0x346184[_0x84f4('0x4')]][_0x84f4('0x39')]=_0x346184[_0x84f4('0x38')];queues[_0x346184[_0x84f4('0x4')]][_0x84f4('0x7')]=_0x346184[_0x84f4('0x37')];}}catch(_0x3e2085){utils['error'](util[_0x84f4('0x3')]('[%s][queues][agentconnect]',_0x346184[_0x84f4('0x4')]),_0x3e2085);}};exports[_0x84f4('0x3a')]=function(_0x22f2f1){try{if(!_[_0x84f4('0x22')](queues[_0x22f2f1[_0x84f4('0x4')]])){if(queues[_0x22f2f1[_0x84f4('0x4')]][_0x84f4('0x18')]){utils[_0x84f4('0xf')](util['format'](_0x84f4('0x3b'),_0x22f2f1[_0x84f4('0x4')]),_0x22f2f1);queues[_0x22f2f1[_0x84f4('0x4')]]['queuecallerabandon']=![];queues[_0x22f2f1['uniqueid']][_0x84f4('0x19')]=![];queues[_0x22f2f1[_0x84f4('0x4')]][_0x84f4('0x27')]=null;queues[_0x22f2f1['uniqueid']][_0x84f4('0x1a')]=![];queues[_0x22f2f1[_0x84f4('0x4')]][_0x84f4('0x28')]=null;queues[_0x22f2f1[_0x84f4('0x4')]]['assigned']=!![];queues[_0x22f2f1['uniqueid']][_0x84f4('0x7')]=_0x22f2f1[_0x84f4('0x37')];queues[_0x22f2f1[_0x84f4('0x4')]][_0x84f4('0x1b')]=!![];queues[_0x22f2f1[_0x84f4('0x4')]][_0x84f4('0x1c')]=utils[_0x84f4('0x14')]();if(_0x22f2f1['reason']==_0x84f4('0x3c')){if(!queues[_0x22f2f1[_0x84f4('0x4')]]['transfer']){queues[_0x22f2f1[_0x84f4('0x4')]][_0x84f4('0x8')]='TRANSFER';}}else{queues[_0x22f2f1[_0x84f4('0x4')]]['queuecallerexitreason']=_0x84f4('0x3d')+_0x22f2f1[_0x84f4('0x3e')][_0x84f4('0x26')]();}utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x3f'),_0x22f2f1[_0x84f4('0x4')],queues[_0x22f2f1[_0x84f4('0x4')]][_0x84f4('0x1f')],_0x22f2f1[_0x84f4('0x37')],queues[_0x22f2f1[_0x84f4('0x4')]][_0x84f4('0x8')]));writeDB(queues[_0x22f2f1['uniqueid']]);}}}catch(_0x243cf1){utils[_0x84f4('0x15')](util[_0x84f4('0x3')]('[%s][queues][agentcomplete]',_0x22f2f1[_0x84f4('0x4')]),_0x243cf1);}};exports[_0x84f4('0x40')]=function(_0xa5c99){try{if(!_[_0x84f4('0x22')](queues[_0xa5c99[_0x84f4('0x41')]])){utils['debug'](util[_0x84f4('0x3')](_0x84f4('0x42'),_0xa5c99[_0x84f4('0x4')]),_0xa5c99);queues[_0xa5c99['transfereeuniqueid']][_0x84f4('0x3c')]=!![];queues[_0xa5c99[_0x84f4('0x41')]][_0x84f4('0x43')]=_0x84f4('0x44');queues[_0xa5c99[_0x84f4('0x41')]]['transferexten']=_0xa5c99[_0x84f4('0x45')];queues[_0xa5c99['transfereeuniqueid']][_0x84f4('0x46')]=_0xa5c99[_0x84f4('0x41')];queues[_0xa5c99[_0x84f4('0x41')]][_0x84f4('0x8')]='BLINDTRANSFER';utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x47'),_0xa5c99['uniqueid'],queues[_0xa5c99['transfereeuniqueid']]['name'],_0xa5c99[_0x84f4('0x41')],_0xa5c99[_0x84f4('0x45')]));}}catch(_0x52a632){utils[_0x84f4('0x15')](util['format'](_0x84f4('0x42'),_0xa5c99[_0x84f4('0x4')]),_0x52a632);}};exports[_0x84f4('0x48')]=function(_0x4fed71){try{utils[_0x84f4('0xf')](util[_0x84f4('0x3')](_0x84f4('0x49'),_0x4fed71[_0x84f4('0x4a')]),_0x4fed71);if(_0x4fed71[_0x84f4('0x4a')]==_0x4fed71[_0x84f4('0x4b')]){if(!_[_0x84f4('0x22')](queues[_0x4fed71[_0x84f4('0x4c')]])){utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x4d'),_0x4fed71[_0x84f4('0x4a')],queues[_0x4fed71[_0x84f4('0x4c')]][_0x84f4('0x1f')],_0x4fed71[_0x84f4('0x4e')]));queues[_0x4fed71[_0x84f4('0x4c')]][_0x84f4('0x3c')]=!![];queues[_0x4fed71['secondtransfererlinkedid']][_0x84f4('0x43')]=_0x84f4('0x4f');queues[_0x4fed71['secondtransfererlinkedid']][_0x84f4('0x50')]=_0x4fed71[_0x84f4('0x4e')];queues[_0x4fed71['secondtransfererlinkedid']][_0x84f4('0x46')]=_0x4fed71[_0x84f4('0x4a')];queues[_0x4fed71[_0x84f4('0x4c')]][_0x84f4('0x8')]=_0x84f4('0x51');}if(!_[_0x84f4('0x22')](queues[_0x4fed71['origtransfererlinkedid']])){if(_0x4fed71[_0x84f4('0x52')]&&queues[_0x4fed71['transfereelinkedid']]){queues[_0x4fed71[_0x84f4('0x52')]][_0x84f4('0x20')]=0x1;queues[_0x4fed71[_0x84f4('0x41')]]=_['clone'](queues[_0x4fed71[_0x84f4('0x52')]]);queues[_0x4fed71[_0x84f4('0x41')]][_0x84f4('0xd')]=_0x4fed71[_0x84f4('0x53')];queues[_0x4fed71[_0x84f4('0x41')]][_0x84f4('0x20')]=0x2;queues[_0x4fed71[_0x84f4('0x41')]][_0x84f4('0x54')]=queues[_0x4fed71['secondtransfererlinkedid']][_0x84f4('0x54')];queues[_0x4fed71['transfereeuniqueid']][_0x84f4('0x55')]=queues[_0x4fed71['secondtransfererlinkedid']][_0x84f4('0x55')];queues[_0x4fed71[_0x84f4('0x41')]][_0x84f4('0x33')]=utils[_0x84f4('0x14')]();queues[_0x4fed71[_0x84f4('0x41')]]['queuecallerleaveAt']=utils[_0x84f4('0x14')]();queues[_0x4fed71[_0x84f4('0x41')]]['holdtime']=0x0;queues[_0x4fed71[_0x84f4('0x41')]][_0x84f4('0x56')]=0x0;utils['info'](util[_0x84f4('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x4fed71['origtransfereruniqueid'],queues[_0x4fed71[_0x84f4('0x41')]][_0x84f4('0x1f')],queues[_0x4fed71[_0x84f4('0x41')]][_0x84f4('0x54')],queues[_0x4fed71['transfereeuniqueid']][_0x84f4('0x55')]));}else{utils['info'](util[_0x84f4('0x3')](_0x84f4('0x57'),_0x4fed71[_0x84f4('0x4a')],queues[_0x4fed71[_0x84f4('0x4b')]]['name'],_0x4fed71[_0x84f4('0x4c')]));queues[_0x4fed71['origtransfererlinkedid']][_0x84f4('0xd')]=_0x4fed71[_0x84f4('0x4c')];}}}else if(_0x4fed71['secondtransfereruniqueid']==_0x4fed71[_0x84f4('0x4c')]){if(!_[_0x84f4('0x22')](queues[_0x4fed71['origtransfererlinkedid']])){utils[_0x84f4('0x2')](util[_0x84f4('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4fed71[_0x84f4('0x4a')],queues[_0x4fed71[_0x84f4('0x4b')]][_0x84f4('0x1f')],_0x4fed71[_0x84f4('0x58')],_0x4fed71[_0x84f4('0x59')]));queues[_0x4fed71[_0x84f4('0x4b')]][_0x84f4('0x3c')]=!![];queues[_0x4fed71[_0x84f4('0x4b')]][_0x84f4('0x43')]=_0x84f4('0x4f');queues[_0x4fed71[_0x84f4('0x4b')]][_0x84f4('0x50')]=_0x4fed71[_0x84f4('0x59')];queues[_0x4fed71[_0x84f4('0x4b')]][_0x84f4('0x46')]=_0x4fed71['secondtransfereruniqueid'];queues[_0x4fed71['origtransfererlinkedid']]['queuecallerexitreason']=_0x84f4('0x51');}if(!_[_0x84f4('0x22')](queues[_0x4fed71[_0x84f4('0x4c')]])){if(_0x4fed71[_0x84f4('0x5a')]&&queues[_0x4fed71[_0x84f4('0x5a')]]){queues[_0x4fed71[_0x84f4('0x5a')]][_0x84f4('0x20')]=0x1;queues[_0x4fed71['transfertargetuniqueid']]=_[_0x84f4('0x5b')](queues[_0x4fed71['transfertargetlinkedid']]);queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0xd')]=_0x4fed71[_0x84f4('0x53')];queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0x20')]=0x2;queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0x54')]=queues[_0x4fed71[_0x84f4('0x4b')]]['calleridnum'];queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0x55')]=queues[_0x4fed71[_0x84f4('0x4b')]][_0x84f4('0x55')];queues[_0x4fed71['transfertargetuniqueid']][_0x84f4('0x33')]=utils[_0x84f4('0x14')]();queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0x18')]=utils[_0x84f4('0x14')]();queues[_0x4fed71['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0x56')]=0x0;utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x5c'),_0x4fed71[_0x84f4('0x4a')],queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0x1f')],queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0xd')],queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0x54')],queues[_0x4fed71[_0x84f4('0x53')]][_0x84f4('0x55')]));}else{utils['info'](util[_0x84f4('0x3')](_0x84f4('0x57'),_0x4fed71['origtransfereruniqueid'],queues[_0x4fed71[_0x84f4('0x4c')]]['name'],_0x4fed71[_0x84f4('0x4b')]));queues[_0x4fed71[_0x84f4('0x4c')]][_0x84f4('0xd')]=_0x4fed71['origtransfererlinkedid'];}}}}catch(_0x4e1ced){utils[_0x84f4('0x15')](util[_0x84f4('0x3')]('[%s][queues][attendedtransfer]',_0x4fed71['origtransfereruniqueid']),_0x4e1ced);}};exports[_0x84f4('0x5d')]=function(_0x18ac67){try{if(!_['isNil'](queues[_0x18ac67[_0x84f4('0x4')]])){utils[_0x84f4('0xf')](util[_0x84f4('0x3')]('[%s][queues][musiconholdstart]',_0x18ac67[_0x84f4('0x4')]),_0x18ac67);queues[_0x18ac67[_0x84f4('0x4')]]['musiconholdstartAt']=utils[_0x84f4('0x14')]();utils[_0x84f4('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x18ac67[_0x84f4('0x4')],queues[_0x18ac67[_0x84f4('0x4')]][_0x84f4('0x1f')],queues[_0x18ac67[_0x84f4('0x4')]][_0x84f4('0x5e')]));}}catch(_0x5eb67f){utils['error'](util[_0x84f4('0x3')](_0x84f4('0x5f'),_0x18ac67['uniqueid']),_0x5eb67f);}};exports['musiconholdstop']=function(_0x5b8bfa){try{if(!_[_0x84f4('0x22')](queues[_0x5b8bfa[_0x84f4('0x4')]])){if(!_['isNil'](queues[_0x5b8bfa[_0x84f4('0x4')]][_0x84f4('0x5e')])){utils[_0x84f4('0xf')](util[_0x84f4('0x3')](_0x84f4('0x60'),_0x5b8bfa['uniqueid']),_0x5b8bfa);queues[_0x5b8bfa[_0x84f4('0x4')]]['mohtime']+=utils[_0x84f4('0x32')](utils[_0x84f4('0x14')](),queues[_0x5b8bfa[_0x84f4('0x4')]]['musiconholdstartAt']);utils[_0x84f4('0x2')](util[_0x84f4('0x3')](_0x84f4('0x61'),_0x5b8bfa[_0x84f4('0x4')],queues[_0x5b8bfa[_0x84f4('0x4')]][_0x84f4('0x1f')],queues[_0x5b8bfa[_0x84f4('0x4')]][_0x84f4('0x56')]));delete queues[_0x5b8bfa[_0x84f4('0x4')]][_0x84f4('0x5e')];}}}catch(_0x22b819){utils[_0x84f4('0x15')](util[_0x84f4('0x3')](_0x84f4('0x60'),_0x5b8bfa[_0x84f4('0x4')]),_0x22b819);}}; \ No newline at end of file +var _0x4549=['queuecallerjoin','debug','format','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexit','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','holdtime','diffTime','count','connectedlinenum','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%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','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','type','CreateVoiceQueueReport','request','transfereduniqueid'];(function(_0x5c414f,_0x1d92a2){var _0x155203=function(_0x4b4aa6){while(--_0x4b4aa6){_0x5c414f['push'](_0x5c414f['shift']());}};_0x155203(++_0x1d92a2);}(_0x4549,0x1f3));var _0x9454=function(_0x4213cc,_0x58bcae){_0x4213cc=_0x4213cc-0x0;var _0xe7cfc2=_0x4549[_0x4213cc];return _0xe7cfc2;};'use strict';var _=require(_0x9454('0x0'));var util=require(_0x9454('0x1'));var utils=require(_0x9454('0x2'));var queues={};function writeDB(_0x26dd74){utils[_0x9454('0x3')](util['format'](_0x9454('0x4'),_0x26dd74[_0x9454('0x5')],_0x26dd74[_0x9454('0x6')],_0x26dd74['queue'],_0x26dd74[_0x9454('0x7')],_0x26dd74[_0x9454('0x8')],_0x26dd74[_0x9454('0x9')],_0x26dd74[_0x9454('0xa')]));if(_0x26dd74[_0x9454('0xb')]){utils['getVoiceQueueByName'](_0x26dd74[_0x9454('0xb')])['then'](function(_0x1d119b){if(_0x1d119b){_0x26dd74[_0x9454('0xc')]=_0x1d119b[_0x9454('0xc')];}utils['request'](_0x9454('0xd'),_0x26dd74);});}else{utils[_0x9454('0xe')](_0x9454('0xd'),_0x26dd74);}if(_0x26dd74['transfereduniqueid']){delete queues[_0x26dd74[_0x9454('0xf')]];}else{delete queues[_0x26dd74[_0x9454('0x5')]];}}exports[_0x9454('0x10')]=function(_0x1ad817){try{utils[_0x9454('0x11')](util[_0x9454('0x12')]('[%s][queues][queuecallerjoin]',_0x1ad817[_0x9454('0x5')]),_0x1ad817);utils[_0x9454('0x3')](util[_0x9454('0x12')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1ad817['uniqueid'],_0x1ad817[_0x9454('0xb')],_0x1ad817[_0x9454('0x13')]));queues[_0x1ad817[_0x9454('0x5')]]=_[_0x9454('0x14')](_0x1ad817,{'originalposition':_0x1ad817['position'],'queuecallerjoinAt':utils[_0x9454('0x15')](),'mohtime':0x0});}catch(_0x493e59){utils[_0x9454('0x16')](util['format'](_0x9454('0x17'),_0x1ad817[_0x9454('0x5')]),_0x493e59);}};exports['hangup']=function(_0xb4ed32){try{if(!_[_0x9454('0x18')](queues[_0xb4ed32[_0x9454('0x5')]])){utils['debug'](util[_0x9454('0x12')](_0x9454('0x19'),_0xb4ed32[_0x9454('0x5')]),_0xb4ed32);if(queues[_0xb4ed32['uniqueid']][_0x9454('0x1a')]){if(!queues[_0xb4ed32[_0x9454('0x5')]][_0x9454('0x1b')]&&!queues[_0xb4ed32['uniqueid']]['queuecallerexit']){queues[_0xb4ed32[_0x9454('0x5')]][_0x9454('0x1c')]=!![];queues[_0xb4ed32['uniqueid']][_0x9454('0x1d')]=utils['now']();queues[_0xb4ed32['uniqueid']]['queuecallerexitreason']=_0x9454('0x1e');}utils['info'](util[_0x9454('0x12')](_0x9454('0x1f'),_0xb4ed32[_0x9454('0x5')],queues[_0xb4ed32[_0x9454('0x5')]]['name'],queues[_0xb4ed32['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0xb4ed32[_0x9454('0x5')]]);}else if(queues[_0xb4ed32[_0x9454('0x5')]][_0x9454('0xf')]){utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x20'),_0xb4ed32[_0x9454('0x5')],queues[_0xb4ed32['uniqueid']][_0x9454('0x21')],queues[_0xb4ed32[_0x9454('0x5')]][_0x9454('0xf')]));queues[queues[_0xb4ed32[_0x9454('0x5')]][_0x9454('0xf')]]=queues[_0xb4ed32[_0x9454('0x5')]];queues[queues[_0xb4ed32['uniqueid']][_0x9454('0xf')]][_0x9454('0x22')]=0x2;delete queues[_0xb4ed32[_0x9454('0x5')]];}}}catch(_0xe318f){utils[_0x9454('0x16')](util['format'](_0x9454('0x19'),_0xb4ed32[_0x9454('0x5')]),_0xe318f);}};exports[_0x9454('0x23')]=function(_0x4d00ec){try{utils['debug'](util[_0x9454('0x12')](_0x9454('0x24'),_0x4d00ec[_0x9454('0x5')]),_0x4d00ec);if(!_[_0x9454('0x18')](_0x4d00ec['variable'][_0x9454('0x25')])&&_0x4d00ec[_0x9454('0x26')][_0x9454('0x27')]()!==_0x9454('0x28')){if(!_[_0x9454('0x18')](queues[_0x4d00ec[_0x9454('0x5')]])){queues[_0x4d00ec['uniqueid']][_0x9454('0x1b')]=![];queues[_0x4d00ec[_0x9454('0x5')]]['queuecallerabandonAt']=null;queues[_0x4d00ec[_0x9454('0x5')]]['queuecallerexit']=!![];queues[_0x4d00ec[_0x9454('0x5')]][_0x9454('0x29')]=utils[_0x9454('0x15')]();queues[_0x4d00ec[_0x9454('0x5')]][_0x9454('0xa')]=_0x4d00ec['value'][_0x9454('0x27')]();utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x2a'),_0x4d00ec[_0x9454('0x5')],queues[_0x4d00ec['uniqueid']][_0x9454('0x21')],_0x4d00ec[_0x9454('0x26')],queues[_0x4d00ec[_0x9454('0x5')]][_0x9454('0xa')]));writeDB(queues[_0x4d00ec[_0x9454('0x5')]]);}}else if(!_['isNil'](_0x4d00ec['variable'][_0x9454('0x2b')])){if(!_[_0x9454('0x18')](queues[_0x4d00ec[_0x9454('0x5')]])&&!queues[_0x4d00ec[_0x9454('0x5')]][_0x9454('0x1b')]){queues[_0x4d00ec[_0x9454('0x5')]][_0x9454('0x1b')]=![];queues[_0x4d00ec[_0x9454('0x5')]][_0x9454('0x2c')]=null;queues[_0x4d00ec['uniqueid']][_0x9454('0x2d')]=!![];queues[_0x4d00ec['uniqueid']][_0x9454('0x29')]=utils[_0x9454('0x15')]();queues[_0x4d00ec[_0x9454('0x5')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x9454('0x3')](util[_0x9454('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4d00ec['uniqueid'],queues[_0x4d00ec[_0x9454('0x5')]][_0x9454('0x21')],_0x4d00ec['value'],queues[_0x4d00ec[_0x9454('0x5')]]['queuecallerexitreason']));}}}catch(_0x38ba8a){utils[_0x9454('0x16')](util[_0x9454('0x12')](_0x9454('0x24'),_0x4d00ec['uniqueid']),_0x38ba8a);}};exports[_0x9454('0x1b')]=function(_0x1d66ec){try{if(!_[_0x9454('0x18')](queues[_0x1d66ec[_0x9454('0x5')]])){utils[_0x9454('0x11')](util['format'](_0x9454('0x2e'),_0x1d66ec[_0x9454('0x5')]),_0x1d66ec);queues[_0x1d66ec['uniqueid']][_0x9454('0x2d')]=![];queues[_0x1d66ec[_0x9454('0x5')]][_0x9454('0x29')]=null;queues[_0x1d66ec[_0x9454('0x5')]][_0x9454('0x1b')]=!![];queues[_0x1d66ec[_0x9454('0x5')]][_0x9454('0x2c')]=utils['now']();queues[_0x1d66ec['uniqueid']][_0x9454('0xa')]='ABANDONED';utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x2f'),_0x1d66ec[_0x9454('0x5')],queues[_0x1d66ec[_0x9454('0x5')]]['name'],queues[_0x1d66ec[_0x9454('0x5')]]['queuecallerexitreason']));}}catch(_0x33a806){utils['error'](util[_0x9454('0x12')](_0x9454('0x2e'),_0x1d66ec[_0x9454('0x5')]),_0x33a806);}};exports[_0x9454('0x30')]=function(_0x34fc38){try{if(!_[_0x9454('0x18')](queues[_0x34fc38[_0x9454('0x5')]])){utils[_0x9454('0x11')](util[_0x9454('0x12')](_0x9454('0x31'),_0x34fc38[_0x9454('0x5')]),_0x34fc38);utils[_0x9454('0x3')](util[_0x9454('0x12')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x34fc38[_0x9454('0x5')],queues[_0x34fc38['uniqueid']][_0x9454('0x21')],_0x34fc38['connectedlinenum'],_0x34fc38['connectedlinename']));queues[_0x34fc38['uniqueid']][_0x9454('0x30')]=!![];queues[_0x34fc38[_0x9454('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x34fc38[_0x9454('0x5')]][_0x9454('0x32')]=utils[_0x9454('0x33')](queues[_0x34fc38[_0x9454('0x5')]][_0x9454('0x1a')],queues[_0x34fc38[_0x9454('0x5')]]['queuecallerjoinAt']);queues[_0x34fc38['uniqueid']][_0x9454('0x13')]=_0x34fc38[_0x9454('0x13')];queues[_0x34fc38['uniqueid']][_0x9454('0x34')]=_0x34fc38[_0x9454('0x34')];queues[_0x34fc38[_0x9454('0x5')]][_0x9454('0x35')]=_0x34fc38['connectedlinenum'];queues[_0x34fc38[_0x9454('0x5')]][_0x9454('0x36')]=_0x34fc38[_0x9454('0x36')];}}catch(_0x36dc04){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x34fc38[_0x9454('0x5')]),_0x36dc04);}};exports['agentconnect']=function(_0x559c49){try{if(!_[_0x9454('0x18')](queues[_0x559c49[_0x9454('0x5')]])){utils[_0x9454('0x11')](util[_0x9454('0x12')](_0x9454('0x37'),_0x559c49['uniqueid']),_0x559c49);utils['info'](util['format'](_0x9454('0x38'),_0x559c49[_0x9454('0x5')],queues[_0x559c49[_0x9454('0x5')]]['name'],_0x559c49[_0x9454('0x39')],_0x559c49[_0x9454('0x3a')]));queues[_0x559c49['uniqueid']][_0x9454('0x1b')]=![];queues[_0x559c49[_0x9454('0x5')]][_0x9454('0x1b')]=![];queues[_0x559c49['uniqueid']][_0x9454('0x2c')]=null;queues[_0x559c49[_0x9454('0x5')]][_0x9454('0x2d')]=![];queues[_0x559c49['uniqueid']][_0x9454('0xa')]=null;queues[_0x559c49[_0x9454('0x5')]][_0x9454('0x29')]=null;queues[_0x559c49['uniqueid']]['assigned']=!![];queues[_0x559c49[_0x9454('0x5')]][_0x9454('0x9')]=_0x559c49[_0x9454('0x3a')];queues[_0x559c49[_0x9454('0x5')]][_0x9454('0x7')]=_0x559c49[_0x9454('0x39')];}}catch(_0x533f68){utils[_0x9454('0x16')](util[_0x9454('0x12')]('[%s][queues][agentconnect]',_0x559c49[_0x9454('0x5')]),_0x533f68);}};exports[_0x9454('0x3b')]=function(_0x5cbfb6){try{if(!_['isNil'](queues[_0x5cbfb6[_0x9454('0x5')]])){if(queues[_0x5cbfb6['uniqueid']][_0x9454('0x1a')]){utils[_0x9454('0x11')](util[_0x9454('0x12')](_0x9454('0x3c'),_0x5cbfb6[_0x9454('0x5')]),_0x5cbfb6);queues[_0x5cbfb6[_0x9454('0x5')]][_0x9454('0x1b')]=![];queues[_0x5cbfb6['uniqueid']]['queuecallerabandon']=![];queues[_0x5cbfb6['uniqueid']][_0x9454('0x2c')]=null;queues[_0x5cbfb6[_0x9454('0x5')]][_0x9454('0x2d')]=![];queues[_0x5cbfb6[_0x9454('0x5')]]['queuecallerexitAt']=null;queues[_0x5cbfb6[_0x9454('0x5')]][_0x9454('0x3d')]=!![];queues[_0x5cbfb6['uniqueid']][_0x9454('0x7')]=_0x5cbfb6[_0x9454('0x39')];queues[_0x5cbfb6['uniqueid']][_0x9454('0x1c')]=!![];queues[_0x5cbfb6[_0x9454('0x5')]]['queuecallercompleteAt']=utils[_0x9454('0x15')]();if(_0x5cbfb6['reason']=='transfer'){if(!queues[_0x5cbfb6[_0x9454('0x5')]][_0x9454('0x3e')]){queues[_0x5cbfb6[_0x9454('0x5')]][_0x9454('0xa')]=_0x9454('0x3f');}}else{queues[_0x5cbfb6[_0x9454('0x5')]][_0x9454('0xa')]=_0x9454('0x40')+_0x5cbfb6[_0x9454('0x41')][_0x9454('0x27')]();}utils['info'](util['format'](_0x9454('0x42'),_0x5cbfb6[_0x9454('0x5')],queues[_0x5cbfb6[_0x9454('0x5')]][_0x9454('0x21')],_0x5cbfb6['membername'],queues[_0x5cbfb6[_0x9454('0x5')]][_0x9454('0xa')]));writeDB(queues[_0x5cbfb6[_0x9454('0x5')]]);}}}catch(_0x1c94ef){utils['error'](util[_0x9454('0x12')]('[%s][queues][agentcomplete]',_0x5cbfb6[_0x9454('0x5')]),_0x1c94ef);}};exports['blindtransfer']=function(_0x442cbd){try{if(!_[_0x9454('0x18')](queues[_0x442cbd[_0x9454('0x43')]])){utils[_0x9454('0x11')](util[_0x9454('0x12')](_0x9454('0x44'),_0x442cbd[_0x9454('0x5')]),_0x442cbd);queues[_0x442cbd[_0x9454('0x43')]][_0x9454('0x3e')]=!![];queues[_0x442cbd[_0x9454('0x43')]]['transfertype']=_0x9454('0x45');queues[_0x442cbd[_0x9454('0x43')]][_0x9454('0x46')]=_0x442cbd[_0x9454('0x47')];queues[_0x442cbd[_0x9454('0x43')]]['transferuniqueid']=_0x442cbd[_0x9454('0x43')];queues[_0x442cbd[_0x9454('0x43')]][_0x9454('0xa')]=_0x9454('0x48');utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x49'),_0x442cbd['uniqueid'],queues[_0x442cbd[_0x9454('0x43')]][_0x9454('0x21')],_0x442cbd[_0x9454('0x43')],_0x442cbd[_0x9454('0x47')]));}}catch(_0x1de842){utils['error'](util[_0x9454('0x12')](_0x9454('0x44'),_0x442cbd['uniqueid']),_0x1de842);}};exports['attendedtransfer']=function(_0x112d46){try{utils[_0x9454('0x11')](util[_0x9454('0x12')](_0x9454('0x4a'),_0x112d46['origtransfereruniqueid']),_0x112d46);if(_0x112d46[_0x9454('0x4b')]==_0x112d46[_0x9454('0x4c')]){if(!_['isNil'](queues[_0x112d46[_0x9454('0x4d')]])){utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x4e'),_0x112d46[_0x9454('0x4b')],queues[_0x112d46['secondtransfererlinkedid']][_0x9454('0x21')],_0x112d46[_0x9454('0x4f')]));queues[_0x112d46[_0x9454('0x4d')]]['transfer']=!![];queues[_0x112d46[_0x9454('0x4d')]][_0x9454('0x50')]=_0x9454('0x51');queues[_0x112d46[_0x9454('0x4d')]]['transferexten']=_0x112d46['origtransfererexten'];queues[_0x112d46[_0x9454('0x4d')]][_0x9454('0x52')]=_0x112d46[_0x9454('0x4b')];queues[_0x112d46['secondtransfererlinkedid']]['queuecallerexitreason']=_0x9454('0x53');}if(!_[_0x9454('0x18')](queues[_0x112d46[_0x9454('0x4c')]])){if(_0x112d46['transfereelinkedid']&&queues[_0x112d46[_0x9454('0x54')]]){queues[_0x112d46[_0x9454('0x54')]][_0x9454('0x22')]=0x1;queues[_0x112d46[_0x9454('0x43')]]=_['clone'](queues[_0x112d46['transfereelinkedid']]);queues[_0x112d46[_0x9454('0x43')]][_0x9454('0xf')]=_0x112d46[_0x9454('0x55')];queues[_0x112d46[_0x9454('0x43')]][_0x9454('0x22')]=0x2;queues[_0x112d46[_0x9454('0x43')]][_0x9454('0x8')]=queues[_0x112d46[_0x9454('0x4d')]][_0x9454('0x8')];queues[_0x112d46[_0x9454('0x43')]][_0x9454('0x56')]=queues[_0x112d46['secondtransfererlinkedid']]['calleridname'];queues[_0x112d46['transfereeuniqueid']][_0x9454('0x57')]=utils[_0x9454('0x15')]();queues[_0x112d46[_0x9454('0x43')]][_0x9454('0x1a')]=utils['now']();queues[_0x112d46[_0x9454('0x43')]][_0x9454('0x32')]=0x0;queues[_0x112d46['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util[_0x9454('0x12')](_0x9454('0x58'),_0x112d46[_0x9454('0x4b')],queues[_0x112d46['transfereeuniqueid']][_0x9454('0x21')],queues[_0x112d46[_0x9454('0x43')]][_0x9454('0x8')],queues[_0x112d46[_0x9454('0x43')]][_0x9454('0x56')]));}else{utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x59'),_0x112d46[_0x9454('0x4b')],queues[_0x112d46[_0x9454('0x4c')]][_0x9454('0x21')],_0x112d46[_0x9454('0x4d')]));queues[_0x112d46[_0x9454('0x4c')]][_0x9454('0xf')]=_0x112d46['secondtransfererlinkedid'];}}}else if(_0x112d46[_0x9454('0x5a')]==_0x112d46['secondtransfererlinkedid']){if(!_[_0x9454('0x18')](queues[_0x112d46['origtransfererlinkedid']])){utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x5b'),_0x112d46[_0x9454('0x4b')],queues[_0x112d46[_0x9454('0x4c')]][_0x9454('0x21')],_0x112d46[_0x9454('0x5a')],_0x112d46[_0x9454('0x5c')]));queues[_0x112d46['origtransfererlinkedid']][_0x9454('0x3e')]=!![];queues[_0x112d46[_0x9454('0x4c')]][_0x9454('0x50')]=_0x9454('0x51');queues[_0x112d46[_0x9454('0x4c')]]['transferexten']=_0x112d46[_0x9454('0x5c')];queues[_0x112d46[_0x9454('0x4c')]][_0x9454('0x52')]=_0x112d46[_0x9454('0x5a')];queues[_0x112d46[_0x9454('0x4c')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x112d46[_0x9454('0x4d')]])){if(_0x112d46['transfertargetlinkedid']&&queues[_0x112d46[_0x9454('0x5d')]]){queues[_0x112d46['transfertargetlinkedid']][_0x9454('0x22')]=0x1;queues[_0x112d46['transfertargetuniqueid']]=_['clone'](queues[_0x112d46[_0x9454('0x5d')]]);queues[_0x112d46[_0x9454('0x55')]][_0x9454('0xf')]=_0x112d46[_0x9454('0x55')];queues[_0x112d46[_0x9454('0x55')]][_0x9454('0x22')]=0x2;queues[_0x112d46[_0x9454('0x55')]]['calleridnum']=queues[_0x112d46[_0x9454('0x4c')]][_0x9454('0x8')];queues[_0x112d46[_0x9454('0x55')]][_0x9454('0x56')]=queues[_0x112d46[_0x9454('0x4c')]][_0x9454('0x56')];queues[_0x112d46[_0x9454('0x55')]]['queuecallerjoinAt']=utils[_0x9454('0x15')]();queues[_0x112d46[_0x9454('0x55')]][_0x9454('0x1a')]=utils[_0x9454('0x15')]();queues[_0x112d46[_0x9454('0x55')]][_0x9454('0x32')]=0x0;queues[_0x112d46[_0x9454('0x55')]][_0x9454('0x5e')]=0x0;utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x5f'),_0x112d46[_0x9454('0x4b')],queues[_0x112d46[_0x9454('0x55')]]['name'],queues[_0x112d46['transfertargetuniqueid']][_0x9454('0xf')],queues[_0x112d46['transfertargetuniqueid']][_0x9454('0x8')],queues[_0x112d46[_0x9454('0x55')]]['calleridname']));}else{utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x59'),_0x112d46[_0x9454('0x4b')],queues[_0x112d46[_0x9454('0x4d')]]['name'],_0x112d46[_0x9454('0x4c')]));queues[_0x112d46[_0x9454('0x4d')]][_0x9454('0xf')]=_0x112d46[_0x9454('0x4c')];}}}}catch(_0xd68a40){utils[_0x9454('0x16')](util[_0x9454('0x12')](_0x9454('0x4a'),_0x112d46[_0x9454('0x4b')]),_0xd68a40);}};exports[_0x9454('0x60')]=function(_0x391ae8){try{if(!_[_0x9454('0x18')](queues[_0x391ae8[_0x9454('0x5')]])){utils[_0x9454('0x11')](util[_0x9454('0x12')](_0x9454('0x61'),_0x391ae8[_0x9454('0x5')]),_0x391ae8);queues[_0x391ae8['uniqueid']][_0x9454('0x62')]=utils[_0x9454('0x15')]();utils['info'](util['format'](_0x9454('0x63'),_0x391ae8[_0x9454('0x5')],queues[_0x391ae8[_0x9454('0x5')]]['name'],queues[_0x391ae8[_0x9454('0x5')]][_0x9454('0x62')]));}}catch(_0x46dae8){utils[_0x9454('0x16')](util[_0x9454('0x12')](_0x9454('0x61'),_0x391ae8[_0x9454('0x5')]),_0x46dae8);}};exports[_0x9454('0x64')]=function(_0x2d2abe){try{if(!_['isNil'](queues[_0x2d2abe[_0x9454('0x5')]])){if(!_[_0x9454('0x18')](queues[_0x2d2abe[_0x9454('0x5')]]['musiconholdstartAt'])){utils[_0x9454('0x11')](util[_0x9454('0x12')](_0x9454('0x65'),_0x2d2abe['uniqueid']),_0x2d2abe);queues[_0x2d2abe[_0x9454('0x5')]][_0x9454('0x5e')]+=utils[_0x9454('0x33')](utils[_0x9454('0x15')](),queues[_0x2d2abe[_0x9454('0x5')]][_0x9454('0x62')]);utils[_0x9454('0x3')](util[_0x9454('0x12')](_0x9454('0x66'),_0x2d2abe[_0x9454('0x5')],queues[_0x2d2abe[_0x9454('0x5')]][_0x9454('0x21')],queues[_0x2d2abe[_0x9454('0x5')]][_0x9454('0x5e')]));delete queues[_0x2d2abe[_0x9454('0x5')]][_0x9454('0x62')];}}}catch(_0x189232){utils[_0x9454('0x16')](util['format'](_0x9454('0x65'),_0x2d2abe[_0x9454('0x5')]),_0x189232);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 85340b0..5d8ba05 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 _0x6334=['[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','value','.WAV','find','monitors','push','[%s][recordings][varset]','hangup'];(function(_0x53f302,_0x167f2c){var _0x195bc3=function(_0x8b0b2d){while(--_0x8b0b2d){_0x53f302['push'](_0x53f302['shift']());}};_0x195bc3(++_0x167f2c);}(_0x6334,0x95));var _0x4633=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0x6334[_0x251d43];return _0x3d7759;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x49d005){utils[_0x4633('0x2')](util[_0x4633('0x3')](_0x4633('0x4'),_0x49d005[_0x4633('0x5')]));if(_0x49d005['accountcode']){utils[_0x4633('0x6')](_0x49d005[_0x4633('0x7')])[_0x4633('0x8')](function(_0x5438ec){if(_0x5438ec){_0x49d005[_0x4633('0x9')]=_0x5438ec[_0x4633('0xa')];_0x49d005[_0x4633('0xb')]=_0x5438ec['id'];}utils[_0x4633('0xc')]('CreateVoiceRecording',_0x49d005);});}else{utils[_0x4633('0xc')](_0x4633('0xd'),_0x49d005);}}exports[_0x4633('0xe')]=function(_0x4cf202){try{utils['debug'](util['format'](_0x4633('0xf'),_0x4cf202[_0x4633('0x5')]),_0x4cf202);if(_0x4cf202['uniqueid']==_0x4cf202[_0x4633('0x10')]){utils[_0x4633('0x2')](util[_0x4633('0x3')](_0x4633('0x11'),_0x4cf202['uniqueid'],_0x4cf202[_0x4633('0x12')],_0x4cf202[_0x4633('0x13')]));recordings[_0x4cf202['uniqueid']]={'uniqueid':_0x4cf202[_0x4633('0x5')],'accountcode':_0x4cf202[_0x4633('0x7')],'exten':_0x4cf202[_0x4633('0x13')],'context':_0x4cf202['context'],'channel':_0x4cf202['channel'],'monitors':[]};}}catch(_0x247f7e){utils['error'](util[_0x4633('0x3')](_0x4633('0xf'),_0x4cf202[_0x4633('0x5')]),_0x247f7e);}};exports['newstate']=function(_0x387078){try{utils[_0x4633('0x14')](util[_0x4633('0x3')](_0x4633('0x15'),_0x387078[_0x4633('0x5')]),_0x387078);if(!_[_0x4633('0x16')](recordings[_0x387078[_0x4633('0x5')]])&&_0x387078['channelstate']==0x6){utils[_0x4633('0x2')](util[_0x4633('0x3')](_0x4633('0x17'),_0x387078[_0x4633('0x5')],_0x387078['context'],_0x387078[_0x4633('0x18')]));}else if(!_[_0x4633('0x16')](recordings[_0x387078[_0x4633('0x10')]])&&_0x387078['channelstate']==0x6&&_0x387078[_0x4633('0x12')]!=_0x4633('0x19')){utils[_0x4633('0x2')](util[_0x4633('0x3')](_0x4633('0x1a'),_0x387078[_0x4633('0x5')],_0x387078[_0x4633('0x10')],_0x387078[_0x4633('0x12')],_0x387078[_0x4633('0x18')]));recordings[_0x387078[_0x4633('0x10')]][_0x4633('0x7')]=_0x387078[_0x4633('0x7')];}}catch(_0x2a430e){utils[_0x4633('0x1b')](util[_0x4633('0x3')](_0x4633('0x15'),_0x387078[_0x4633('0x5')]),_0x2a430e);}};exports['varset']=function(_0x4be14a){try{if(!_['isNil'](_0x4be14a[_0x4633('0x1c')])&&!_[_0x4633('0x16')](_0x4be14a['variable'][_0x4633('0x1d')])){utils[_0x4633('0x14')](util['format']('[%s][recordings][varset]',_0x4be14a[_0x4633('0x5')]),_0x4be14a);utils[_0x4633('0x2')](util[_0x4633('0x3')](_0x4633('0x1e'),_0x4be14a[_0x4633('0x5')],_0x4be14a[_0x4633('0x1c')],_0x4be14a['value']));if(_[_0x4633('0x1f')](_0x4be14a['value'],_0x4633('0x20'))){_0x4be14a[_0x4633('0x21')]=_0x4be14a['value']['replace'](_0x4633('0x20'),_0x4633('0x22'));}if(recordings[_0x4be14a[_0x4633('0x10')]]){var _0x407bc4=_[_0x4633('0x23')](recordings[_0x4be14a['linkedid']][_0x4633('0x24')],{'value':_0x4be14a[_0x4633('0x21')]});if(_['isNil'](_0x407bc4)){recordings[_0x4be14a[_0x4633('0x10')]][_0x4633('0x24')][_0x4633('0x25')]({'value':_0x4be14a[_0x4633('0x21')]});}}}}catch(_0x21f5ea){utils[_0x4633('0x1b')](util[_0x4633('0x3')](_0x4633('0x26'),_0x4be14a[_0x4633('0x5')]),_0x21f5ea);}};exports[_0x4633('0x27')]=function(_0x2d4a33){try{if(!_['isNil'](recordings[_0x2d4a33['uniqueid']])){utils[_0x4633('0x14')](util[_0x4633('0x3')](_0x4633('0x28'),_0x2d4a33[_0x4633('0x5')]),_0x2d4a33);utils[_0x4633('0x2')](util[_0x4633('0x3')](_0x4633('0x29'),_0x2d4a33[_0x4633('0x5')],_0x2d4a33[_0x4633('0x2a')],_0x2d4a33[_0x4633('0x2b')],_0x2d4a33['cause-txt']));recordings[_0x2d4a33['uniqueid']][_0x4633('0x2a')]=_0x2d4a33[_0x4633('0x2a')];recordings[_0x2d4a33[_0x4633('0x5')]]['calleridname']=_0x2d4a33[_0x4633('0x2b')];recordings[_0x2d4a33[_0x4633('0x5')]][_0x4633('0x2c')]=_0x2d4a33[_0x4633('0x2c')];recordings[_0x2d4a33[_0x4633('0x5')]]['connectedlinename']=_0x2d4a33[_0x4633('0x2d')];if(recordings[_0x2d4a33[_0x4633('0x5')]][_0x4633('0x2e')]==_0x4633('0x2f')&&recordings[_0x2d4a33[_0x4633('0x5')]]['accountcode']){recordings[_0x2d4a33[_0x4633('0x5')]][_0x4633('0x2c')]=recordings[_0x2d4a33[_0x4633('0x5')]]['accountcode'];recordings[_0x2d4a33['uniqueid']][_0x4633('0x2d')]='';}recordings[_0x2d4a33[_0x4633('0x5')]][_0x4633('0x24')][_0x4633('0x30')](function(_0x465d9f){var _0x34e72f=_['clone'](recordings[_0x2d4a33[_0x4633('0x5')]]);_0x34e72f['value']=_0x465d9f[_0x4633('0x21')];writeDB(_0x34e72f);});delete recordings[_0x2d4a33[_0x4633('0x5')]];}}catch(_0x58871a){utils['error'](util[_0x4633('0x3')](_0x4633('0x28'),_0x2d4a33[_0x4633('0x5')]),_0x58871a);}};exports[_0x4633('0x31')]=function(_0x5a6a7c){try{if(!_[_0x4633('0x16')](recordings[_0x5a6a7c[_0x4633('0x5')]])){utils[_0x4633('0x14')](util[_0x4633('0x3')](_0x4633('0x32'),_0x5a6a7c['uniqueid']),_0x5a6a7c);utils[_0x4633('0x2')](util[_0x4633('0x3')](_0x4633('0x33'),_0x5a6a7c[_0x4633('0x5')],_0x5a6a7c[_0x4633('0x34')],_0x5a6a7c[_0x4633('0x35')]));if(_0x5a6a7c['application'][_0x4633('0x36')]()=='set'&&_[_0x4633('0x37')](_0x5a6a7c[_0x4633('0x35')][_0x4633('0x36')](),_0x4633('0x38'))){var _0xf8132=_0x5a6a7c['appdata'][_0x4633('0x39')]('=');var _0x381a89=_0xf8132[0x0]['substring'](_0xf8132[0x0][_0x4633('0x3a')]('(')+0x1,_0xf8132[0x0][_0x4633('0x3a')](')'));var _0x1e1900=_0xf8132[0x1];recordings[_0x5a6a7c['uniqueid']][_0x381a89]=_0x1e1900;}}}catch(_0x2b45b3){utils[_0x4633('0x1b')](util[_0x4633('0x3')]('[%s][recordings][newexten]',_0x5a6a7c[_0x4633('0x5')]),_0x2b45b3);}};exports[_0x4633('0x3b')]=function(_0x1302c9){try{if(!_['isNil'](recordings[_0x1302c9['uniqueid']])){utils['debug'](util[_0x4633('0x3')](_0x4633('0x3c'),_0x1302c9[_0x4633('0x5')]),_0x1302c9);utils[_0x4633('0x2')](util[_0x4633('0x3')](_0x4633('0x3d'),_0x1302c9[_0x4633('0x5')],_0x1302c9[_0x4633('0x3e')]));recordings[_0x1302c9[_0x4633('0x5')]][_0x4633('0x3e')]=_0x1302c9['queue'];}}catch(_0x1d0444){utils['error'](util[_0x4633('0x3')]('[%s][recordings][queuecallerjoin]',_0x1302c9[_0x4633('0x5')]),_0x1d0444);}}; \ No newline at end of file +var _0x366e=['.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','clone','[%s][recordings][newexten]','application','appdata','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','membername','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x366e,0xc5));var _0xe366=function(_0x426258,_0x22e200){_0x426258=_0x426258-0x0;var _0x40f83f=_0x366e[_0x426258];return _0x40f83f;};'use strict';var _=require('lodash');var util=require(_0xe366('0x0'));var utils=require(_0xe366('0x1'));var recordings={};function writeDB(_0x50fcb8){utils[_0xe366('0x2')](util[_0xe366('0x3')](_0xe366('0x4'),_0x50fcb8[_0xe366('0x5')]));if(_0x50fcb8[_0xe366('0x6')]){utils['getUserByInternal'](_0x50fcb8[_0xe366('0x6')])['then'](function(_0x38ec98){if(_0x38ec98){_0x50fcb8[_0xe366('0x7')]=_0x38ec98['name'];_0x50fcb8[_0xe366('0x8')]=_0x38ec98['id'];}utils[_0xe366('0x9')](_0xe366('0xa'),_0x50fcb8);});}else{utils[_0xe366('0x9')]('CreateVoiceRecording',_0x50fcb8);}}exports[_0xe366('0xb')]=function(_0x35ed52){try{utils[_0xe366('0xc')](util[_0xe366('0x3')](_0xe366('0xd'),_0x35ed52[_0xe366('0x5')]),_0x35ed52);if(_0x35ed52[_0xe366('0x5')]==_0x35ed52['linkedid']){utils[_0xe366('0x2')](util['format'](_0xe366('0xe'),_0x35ed52[_0xe366('0x5')],_0x35ed52[_0xe366('0xf')],_0x35ed52[_0xe366('0x10')]));recordings[_0x35ed52[_0xe366('0x5')]]={'uniqueid':_0x35ed52[_0xe366('0x5')],'accountcode':_0x35ed52['accountcode'],'exten':_0x35ed52[_0xe366('0x10')],'context':_0x35ed52[_0xe366('0xf')],'channel':_0x35ed52[_0xe366('0x11')],'monitors':[]};}}catch(_0x229aa1){utils[_0xe366('0x12')](util[_0xe366('0x3')](_0xe366('0xd'),_0x35ed52[_0xe366('0x5')]),_0x229aa1);}};exports[_0xe366('0x13')]=function(_0x26179e){try{utils[_0xe366('0xc')](util['format']('[%s][recordings][newstate]',_0x26179e[_0xe366('0x5')]),_0x26179e);if(!_[_0xe366('0x14')](recordings[_0x26179e[_0xe366('0x5')]])&&_0x26179e[_0xe366('0x15')]==0x6){utils[_0xe366('0x2')](util[_0xe366('0x3')](_0xe366('0x16'),_0x26179e[_0xe366('0x5')],_0x26179e[_0xe366('0xf')],_0x26179e['channel']));}else if(!_['isNil'](recordings[_0x26179e['linkedid']])&&_0x26179e[_0xe366('0x15')]==0x6&&_0x26179e[_0xe366('0xf')]!='transfer'){utils['info'](util[_0xe366('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x26179e[_0xe366('0x5')],_0x26179e['linkedid'],_0x26179e['context'],_0x26179e[_0xe366('0x11')]));recordings[_0x26179e[_0xe366('0x17')]][_0xe366('0x6')]=_0x26179e[_0xe366('0x6')];}}catch(_0x4099bd){utils[_0xe366('0x12')](util[_0xe366('0x3')](_0xe366('0x18'),_0x26179e[_0xe366('0x5')]),_0x4099bd);}};exports[_0xe366('0x19')]=function(_0xcd1963){try{if(!_[_0xe366('0x14')](_0xcd1963[_0xe366('0x1a')])&&!_[_0xe366('0x14')](_0xcd1963[_0xe366('0x1a')]['mixmonitor_filename'])){utils[_0xe366('0xc')](util['format']('[%s][recordings][varset]',_0xcd1963[_0xe366('0x5')]),_0xcd1963);utils[_0xe366('0x2')](util[_0xe366('0x3')](_0xe366('0x1b'),_0xcd1963[_0xe366('0x5')],_0xcd1963[_0xe366('0x1a')],_0xcd1963[_0xe366('0x1c')]));if(_[_0xe366('0x1d')](_0xcd1963[_0xe366('0x1c')],_0xe366('0x1e'))){_0xcd1963[_0xe366('0x1c')]=_0xcd1963['value']['replace']('.wav49',_0xe366('0x1f'));}if(recordings[_0xcd1963['linkedid']]){var _0x4183b1=_[_0xe366('0x20')](recordings[_0xcd1963[_0xe366('0x17')]][_0xe366('0x21')],{'value':_0xcd1963['value']});if(_[_0xe366('0x14')](_0x4183b1)){recordings[_0xcd1963[_0xe366('0x17')]][_0xe366('0x21')][_0xe366('0x22')]({'value':_0xcd1963[_0xe366('0x1c')]});}}}}catch(_0x167021){utils['error'](util[_0xe366('0x3')](_0xe366('0x23'),_0xcd1963[_0xe366('0x5')]),_0x167021);}};exports['hangup']=function(_0x54a4f3){try{if(!_[_0xe366('0x14')](recordings[_0x54a4f3[_0xe366('0x5')]])){utils['debug'](util['format'](_0xe366('0x24'),_0x54a4f3[_0xe366('0x5')]),_0x54a4f3);utils['info'](util[_0xe366('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x54a4f3[_0xe366('0x5')],_0x54a4f3[_0xe366('0x25')],_0x54a4f3[_0xe366('0x26')],_0x54a4f3[_0xe366('0x27')]));recordings[_0x54a4f3[_0xe366('0x5')]][_0xe366('0x25')]=_0x54a4f3['calleridnum'];recordings[_0x54a4f3['uniqueid']]['calleridname']=_0x54a4f3[_0xe366('0x26')];recordings[_0x54a4f3[_0xe366('0x5')]][_0xe366('0x28')]=_0x54a4f3[_0xe366('0x28')];recordings[_0x54a4f3[_0xe366('0x5')]][_0xe366('0x29')]=_0x54a4f3['connectedlinename'];if(recordings[_0x54a4f3['uniqueid']]['type']==_0xe366('0x2a')&&recordings[_0x54a4f3[_0xe366('0x5')]][_0xe366('0x6')]){recordings[_0x54a4f3[_0xe366('0x5')]][_0xe366('0x28')]=recordings[_0x54a4f3['uniqueid']][_0xe366('0x6')];recordings[_0x54a4f3[_0xe366('0x5')]]['connectedlinename']='';}recordings[_0x54a4f3['uniqueid']][_0xe366('0x21')]['forEach'](function(_0x1f04d6){var _0x4d90a6=_[_0xe366('0x2b')](recordings[_0x54a4f3[_0xe366('0x5')]]);_0x4d90a6[_0xe366('0x1c')]=_0x1f04d6[_0xe366('0x1c')];writeDB(_0x4d90a6);});delete recordings[_0x54a4f3[_0xe366('0x5')]];}}catch(_0x2f4df4){utils[_0xe366('0x12')](util['format'](_0xe366('0x24'),_0x54a4f3['uniqueid']),_0x2f4df4);}};exports['newexten']=function(_0xa8ec86){try{if(!_[_0xe366('0x14')](recordings[_0xa8ec86[_0xe366('0x5')]])){utils[_0xe366('0xc')](util[_0xe366('0x3')](_0xe366('0x2c'),_0xa8ec86[_0xe366('0x5')]),_0xa8ec86);utils['info'](util[_0xe366('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0xa8ec86[_0xe366('0x5')],_0xa8ec86[_0xe366('0x2d')],_0xa8ec86[_0xe366('0x2e')]));if(_0xa8ec86['application']['toLowerCase']()==_0xe366('0x2f')&&_[_0xe366('0x30')](_0xa8ec86[_0xe366('0x2e')]['toLowerCase'](),_0xe366('0x31'))){var _0x4fe7c5=_0xa8ec86[_0xe366('0x2e')][_0xe366('0x32')]('=');var _0x5956bd=_0x4fe7c5[0x0][_0xe366('0x33')](_0x4fe7c5[0x0]['lastIndexOf']('(')+0x1,_0x4fe7c5[0x0][_0xe366('0x34')](')'));var _0x2462be=_0x4fe7c5[0x1];recordings[_0xa8ec86['uniqueid']][_0x5956bd]=_0x2462be;}}}catch(_0x4b0ed2){utils['error'](util['format']('[%s][recordings][newexten]',_0xa8ec86['uniqueid']),_0x4b0ed2);}};exports[_0xe366('0x35')]=function(_0x119a6b){try{if(!_['isNil'](recordings[_0x119a6b[_0xe366('0x5')]])){utils[_0xe366('0xc')](util['format']('[%s][recordings][queuecallerjoin]',_0x119a6b['uniqueid']),_0x119a6b);utils[_0xe366('0x2')](util[_0xe366('0x3')](_0xe366('0x36'),_0x119a6b[_0xe366('0x5')],_0x119a6b[_0xe366('0x37')]));recordings[_0x119a6b[_0xe366('0x5')]][_0xe366('0x37')]=_0x119a6b[_0xe366('0x37')];}}catch(_0x15052b){utils['error'](util['format'](_0xe366('0x38'),_0x119a6b[_0xe366('0x5')]),_0x15052b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4d812dd..9880f36 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 _0x0c35=['transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','assign','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x13fcaf,_0x416c69){var _0x4fa631=function(_0x15ca44){while(--_0x15ca44){_0x13fcaf['push'](_0x13fcaf['shift']());}};_0x4fa631(++_0x416c69);}(_0x0c35,0x1e3));var _0x50c3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0c35[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x50c3('0x0'));var util=require(_0x50c3('0x1'));var utils=require(_0x50c3('0x2'));function writeDB(_0x154f04){utils[_0x50c3('0x3')](util[_0x50c3('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x154f04[_0x50c3('0x5')]==='attended'?_0x154f04[_0x50c3('0x6')]:_0x154f04[_0x50c3('0x7')],_0x154f04[_0x50c3('0x5')]));utils[_0x50c3('0x8')](_0x50c3('0x9'),_0x154f04);}exports['blindtransfer']=function(_0x11de4f){try{utils[_0x50c3('0xa')](util[_0x50c3('0x4')](_0x50c3('0xb'),_0x11de4f[_0x50c3('0x7')]),_0x11de4f);utils['info'](util[_0x50c3('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x11de4f['uniqueid'],_0x11de4f[_0x50c3('0xc')],_0x11de4f[_0x50c3('0xd')],_0x11de4f[_0x50c3('0xe')],_0x11de4f[_0x50c3('0xf')]));_0x11de4f[_0x50c3('0x5')]=_0x50c3('0x10');writeDB(_0x11de4f);}catch(_0x570c0f){utils[_0x50c3('0x11')](util[_0x50c3('0x4')](_0x50c3('0xb'),_0x11de4f[_0x50c3('0x7')]),_0x570c0f);}};exports[_0x50c3('0x12')]=function(_0x13496e){try{utils['debug'](util[_0x50c3('0x4')]('[%s][transfers][attendedtransfer]',_0x13496e['origtransfereruniqueid']),_0x13496e);utils[_0x50c3('0x3')](util[_0x50c3('0x4')](_0x50c3('0x13'),_0x13496e[_0x50c3('0x6')],_0x13496e[_0x50c3('0x14')],_0x13496e[_0x50c3('0x15')],_0x13496e[_0x50c3('0x16')],_0x13496e['transfertargetcalleridname']));_0x13496e=_['assign'](_0x13496e,{'transfererchannel':_0x13496e[_0x50c3('0x17')],'transferercalleridnum':_0x13496e['origtransferercalleridnum'],'transferercalleridname':_0x13496e[_0x50c3('0x15')],'transfererconnectedlinenum':_0x13496e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x13496e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x13496e[_0x50c3('0x18')],'transferercontext':_0x13496e[_0x50c3('0x19')],'transfererexten':_0x13496e[_0x50c3('0x1a')],'transfererlinkedid':_0x13496e['origtransfererlinkedid'],'context':_0x13496e[_0x50c3('0x1b')],'extension':_0x13496e[_0x50c3('0x1c')],'type':'attended'});if(_[_0x50c3('0x1d')](_0x13496e['transfereechannel'])){_0x13496e=_[_0x50c3('0x1e')](_0x13496e,{'transfereechannel':_0x13496e['transfertargetchannel'],'transfereecalleridnum':_0x13496e[_0x50c3('0x16')],'transfereecalleridname':_0x13496e[_0x50c3('0x1f')],'transfereeconnectedlinenum':_0x13496e[_0x50c3('0x20')],'transfereeconnectedlinename':_0x13496e[_0x50c3('0x21')],'transfereeaccountcode':_0x13496e[_0x50c3('0x22')],'transfereecontext':_0x13496e['transfertargetcontext'],'transfereeexten':_0x13496e['transfertargetexten'],'transfereelinkedid':_0x13496e[_0x50c3('0x23')]});}writeDB(_0x13496e);}catch(_0xd10794){utils[_0x50c3('0x11')](util[_0x50c3('0x4')](_0x50c3('0x24'),_0x13496e['origtransfereruniqueid']),_0xd10794);}}; \ No newline at end of file +var _0x4066=['transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','format','type','attended','origtransfereruniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname'];(function(_0xd5709b,_0x101823){var _0x3dc484=function(_0x28a409){while(--_0x28a409){_0xd5709b['push'](_0xd5709b['shift']());}};_0x3dc484(++_0x101823);}(_0x4066,0x1b3));var _0x6406=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4066[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6406('0x0'));var util=require('util');var utils=require(_0x6406('0x1'));function writeDB(_0x5dcf9d){utils[_0x6406('0x2')](util[_0x6406('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x5dcf9d[_0x6406('0x4')]===_0x6406('0x5')?_0x5dcf9d[_0x6406('0x6')]:_0x5dcf9d['uniqueid'],_0x5dcf9d[_0x6406('0x4')]));utils['request'](_0x6406('0x7'),_0x5dcf9d);}exports[_0x6406('0x8')]=function(_0x3e4d1f){try{utils[_0x6406('0x9')](util[_0x6406('0x3')](_0x6406('0xa'),_0x3e4d1f[_0x6406('0xb')]),_0x3e4d1f);utils[_0x6406('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3e4d1f['uniqueid'],_0x3e4d1f[_0x6406('0xc')],_0x3e4d1f[_0x6406('0xd')],_0x3e4d1f[_0x6406('0xe')],_0x3e4d1f[_0x6406('0xf')]));_0x3e4d1f[_0x6406('0x4')]='blind';writeDB(_0x3e4d1f);}catch(_0x5689a0){utils[_0x6406('0x10')](util['format'](_0x6406('0xa'),_0x3e4d1f[_0x6406('0xb')]),_0x5689a0);}};exports[_0x6406('0x11')]=function(_0xb94d02){try{utils[_0x6406('0x9')](util[_0x6406('0x3')](_0x6406('0x12'),_0xb94d02[_0x6406('0x6')]),_0xb94d02);utils['info'](util[_0x6406('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xb94d02[_0x6406('0x6')],_0xb94d02[_0x6406('0x13')],_0xb94d02[_0x6406('0x14')],_0xb94d02[_0x6406('0x15')],_0xb94d02[_0x6406('0x16')]));_0xb94d02=_[_0x6406('0x17')](_0xb94d02,{'transfererchannel':_0xb94d02[_0x6406('0x18')],'transferercalleridnum':_0xb94d02[_0x6406('0x13')],'transferercalleridname':_0xb94d02['origtransferercalleridname'],'transfererconnectedlinenum':_0xb94d02[_0x6406('0x19')],'transfererconnectedlinename':_0xb94d02[_0x6406('0x1a')],'transfereraccountcode':_0xb94d02[_0x6406('0x1b')],'transferercontext':_0xb94d02[_0x6406('0x1c')],'transfererexten':_0xb94d02['secondtransfererexten'],'transfererlinkedid':_0xb94d02[_0x6406('0x1d')],'context':_0xb94d02[_0x6406('0x1e')],'extension':_0xb94d02[_0x6406('0x1f')],'type':'attended'});if(_[_0x6406('0x20')](_0xb94d02['transfereechannel'])){_0xb94d02=_[_0x6406('0x17')](_0xb94d02,{'transfereechannel':_0xb94d02[_0x6406('0x21')],'transfereecalleridnum':_0xb94d02[_0x6406('0x15')],'transfereecalleridname':_0xb94d02['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xb94d02[_0x6406('0x22')],'transfereeconnectedlinename':_0xb94d02['transfertargetconnectedlinename'],'transfereeaccountcode':_0xb94d02['transfertargetaccountcode'],'transfereecontext':_0xb94d02[_0x6406('0x23')],'transfereeexten':_0xb94d02[_0x6406('0x24')],'transfereelinkedid':_0xb94d02[_0x6406('0x25')]});}writeDB(_0xb94d02);}catch(_0x275cd0){utils[_0x6406('0x10')](util['format'](_0x6406('0x12'),_0xb94d02[_0x6406('0x6')]),_0x275cd0);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index bc0fe0b..00f6a49 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 _0xe13a=['jayson/promise','moment','client','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','format','diffTime','sumTime','now','isAfter','isBefore','bluebird'];(function(_0x28ba0f,_0x53772d){var _0x4272e1=function(_0x3f1480){while(--_0x3f1480){_0x28ba0f['push'](_0x28ba0f['shift']());}};_0x4272e1(++_0x53772d);}(_0xe13a,0x1ee));var _0xae13=function(_0x1c3bb5,_0x368a2f){_0x1c3bb5=_0x1c3bb5-0x0;var _0x54188e=_0xe13a[_0x1c3bb5];return _0x54188e;};'use strict';var BPromise=require(_0xae13('0x0'));var jayson=require(_0xae13('0x1'));var moment=require(_0xae13('0x2'));var util=require('util');var client=jayson[_0xae13('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0xae13('0x4'));exports[_0xae13('0x5')]=function(_0x5eb673,_0x1a356e){logger[_0xae13('0x5')](_0x5eb673,_0x1a356e?util[_0xae13('0x6')](_0x1a356e,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x2eb6e2,_0x4bbccd){logger[_0xae13('0x7')](_0x2eb6e2,_0x4bbccd?util['inspect'](_0x4bbccd,{'showHidden':![],'depth':null}):'');};exports[_0xae13('0x8')]=function(_0x2c5903,_0x187fcd){logger[_0xae13('0x8')](_0x2c5903,_0x187fcd?util[_0xae13('0x6')](_0x187fcd,{'showHidden':![],'depth':null}):'');};exports[_0xae13('0x9')]=function(_0x593dbc,_0x40e892){return client[_0xae13('0x9')](_0x593dbc,{'body':_0x40e892})[_0xae13('0xa')](function(_0xbfcf8b){logger[_0xae13('0x7')](_0xae13('0xb'),_0x593dbc,_0xbfcf8b?util['inspect'](_0xbfcf8b,{'showHidden':![],'depth':null}):'');})[_0xae13('0xc')](function(_0x1c39da){logger[_0xae13('0x8')]('[utils][request]\x20name:%s',_0x593dbc,_0x1c39da?util['inspect'](_0x1c39da,{'showHidden':![],'depth':null}):'');});};function getUser(_0x12acc4){return client[_0xae13('0x9')](_0xae13('0xd'),{'options':{'raw':!![],'attributes':['id',_0xae13('0xe'),'name',_0xae13('0xf')],'where':_0x12acc4,'limit':0x1}})[_0xae13('0xa')](function(_0x120d63){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0xae13('0x10')](_0x12acc4),_0x120d63?util['inspect'](_0x120d63,{'showHidden':![],'depth':null}):'');return _0x120d63[_0xae13('0x11')][_0xae13('0x12')]?_0x120d63[_0xae13('0x11')][0x0]:null;});}exports[_0xae13('0x13')]=function(_0x54b277){return new BPromise(function(_0x2766a2,_0x3528ca){if(_0x54b277){return getUser({'internal':_0x54b277})['then'](function(_0x3f2ed0){logger[_0xae13('0x5')](_0xae13('0x14'),_0x54b277,_0x3f2ed0?_0xae13('0x15'):_0xae13('0x16'));return _0x2766a2(_0x3f2ed0);})['catch'](function(_0xdc7023){logger[_0xae13('0x8')](_0xae13('0x17'),_0xdc7023?util[_0xae13('0x6')](_0xdc7023,{'showHidden':![],'depth':null}):'');return _0x2766a2(null);});}return _0x2766a2(null);});};exports['getUserByInterface']=function(_0x90fc57){return new BPromise(function(_0x36bf78,_0x4f7844){if(_0x90fc57){return getUser({'interface':_0x90fc57})['then'](function(_0x2d13a8){logger['info'](_0xae13('0x18'),_0x90fc57,_0x2d13a8?_0xae13('0x15'):'notfound');return _0x36bf78(_0x2d13a8);})['catch'](function(_0x455365){logger[_0xae13('0x8')](_0xae13('0x19'),_0x455365?util[_0xae13('0x6')](_0x455365,{'showHidden':![],'depth':null}):'');return _0x36bf78(null);});}return _0x36bf78(null);});};exports[_0xae13('0x1a')]=function(_0x39462d){return new BPromise(function(_0x508137,_0x330cdd){if(_0x39462d){return getUser({'name':_0x39462d})[_0xae13('0xa')](function(_0x5e4927){logger[_0xae13('0x5')](_0xae13('0x1b'),_0x39462d,_0x5e4927?_0xae13('0x15'):'notfound');return _0x508137(_0x5e4927);})[_0xae13('0xc')](function(_0x534d8e){logger['error'](_0xae13('0x1c'),_0x534d8e?util[_0xae13('0x6')](_0x534d8e,{'showHidden':![],'depth':null}):'');return _0x508137(null);});}return _0x508137(null);});};exports['getVoiceQueueByName']=function(_0x694c76){return new BPromise(function(_0x4521a1,_0x2df84f){if(_0x694c76){return client[_0xae13('0x9')](_0xae13('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xae13('0x1e'),'type','acw',_0xae13('0x1f')],'where':{'name':_0x694c76},'limit':0x1}})[_0xae13('0xa')](function(_0x4f033e){logger[_0xae13('0x7')](_0xae13('0x20'),_0x694c76,_0x4f033e?util[_0xae13('0x6')](_0x4f033e,{'showHidden':![],'depth':null}):'');logger['info'](_0xae13('0x21'),_0x694c76,_0x4f033e?_0xae13('0x15'):'notfound');return _0x4521a1(_0x4f033e['result']['length']?_0x4f033e[_0xae13('0x11')][0x0]:null);})[_0xae13('0xc')](function(_0xdcd1af){logger[_0xae13('0x8')](_0xae13('0x22'),_0xdcd1af?util[_0xae13('0x6')](_0xdcd1af,{'showHidden':![],'depth':null}):'');return _0x4521a1(null);});}return _0x4521a1(null);});};exports[_0xae13('0x23')]=function(_0x38fefe,_0x4971e5){return moment(_0x38fefe)[_0xae13('0x24')](_0x4971e5,_0xae13('0x25'))['format'](_0xae13('0x26'));};exports['subtractTime']=function(_0x2d2129,_0x230c36){return moment(_0x2d2129)['subtract'](_0x230c36,_0xae13('0x25'))[_0xae13('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xae13('0x28')]=function(_0x3bda89,_0x4f5b0c){return moment(_0x3bda89)['diff'](moment(_0x4f5b0c),_0xae13('0x25'));};exports[_0xae13('0x29')]=function(_0x1297ca,_0x5829be){return parseInt(_0x1297ca,0xa)+parseInt(_0x5829be,0xa);};exports[_0xae13('0x2a')]=function(){return moment()[_0xae13('0x27')](_0xae13('0x26'));};exports[_0xae13('0x2b')]=function(_0x20a442,_0x1a982f){if(_0x1a982f){return moment(_0x20a442)[_0xae13('0x2b')](_0x1a982f);}return!![];};exports[_0xae13('0x2c')]=function(_0x1b6423,_0x3bcc63){if(_0x3bcc63){return moment(_0x1b6423)[_0xae13('0x2c')](_0x3bcc63);}else if(_0x1b6423){return!![];}return![];}; \ No newline at end of file +var _0x9f7a=['info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','name','[utils][getUser]\x20where:%s','result','length','getUserByInternal'];(function(_0x2b01d1,_0x1aa3ce){var _0x37ea8a=function(_0xe9aa9){while(--_0xe9aa9){_0x2b01d1['push'](_0x2b01d1['shift']());}};_0x37ea8a(++_0x1aa3ce);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x9f7a[_0x468b0f];return _0x3e74d9;};'use strict';var BPromise=require(_0xa9f7('0x0'));var jayson=require(_0xa9f7('0x1'));var moment=require(_0xa9f7('0x2'));var util=require(_0xa9f7('0x3'));var client=jayson['client'][_0xa9f7('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports['info']=function(_0x22dbdd,_0x44545d){logger['info'](_0x22dbdd,_0x44545d?util['inspect'](_0x44545d,{'showHidden':![],'depth':null}):'');};exports[_0xa9f7('0x5')]=function(_0x5497c8,_0x48e791){logger['debug'](_0x5497c8,_0x48e791?util[_0xa9f7('0x6')](_0x48e791,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x433d03,_0x1f2f1d){logger[_0xa9f7('0x7')](_0x433d03,_0x1f2f1d?util['inspect'](_0x1f2f1d,{'showHidden':![],'depth':null}):'');};exports[_0xa9f7('0x8')]=function(_0xdda0e0,_0x4d9b2a){return client[_0xa9f7('0x8')](_0xdda0e0,{'body':_0x4d9b2a})[_0xa9f7('0x9')](function(_0x148b68){logger[_0xa9f7('0x5')](_0xa9f7('0xa'),_0xdda0e0,_0x148b68?util[_0xa9f7('0x6')](_0x148b68,{'showHidden':![],'depth':null}):'');})[_0xa9f7('0xb')](function(_0x52e4d4){logger[_0xa9f7('0x7')]('[utils][request]\x20name:%s',_0xdda0e0,_0x52e4d4?util[_0xa9f7('0x6')](_0x52e4d4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x437a83){return client[_0xa9f7('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xa9f7('0xc'),'interface'],'where':_0x437a83,'limit':0x1}})['then'](function(_0x188f8a){logger[_0xa9f7('0x5')](_0xa9f7('0xd'),JSON['stringify'](_0x437a83),_0x188f8a?util[_0xa9f7('0x6')](_0x188f8a,{'showHidden':![],'depth':null}):'');return _0x188f8a[_0xa9f7('0xe')][_0xa9f7('0xf')]?_0x188f8a['result'][0x0]:null;});}exports[_0xa9f7('0x10')]=function(_0x1a1a13){return new BPromise(function(_0x230904,_0x11652b){if(_0x1a1a13){return getUser({'internal':_0x1a1a13})[_0xa9f7('0x9')](function(_0xf01914){logger[_0xa9f7('0x11')](_0xa9f7('0x12'),_0x1a1a13,_0xf01914?_0xa9f7('0x13'):'notfound');return _0x230904(_0xf01914);})[_0xa9f7('0xb')](function(_0x36cfbe){logger[_0xa9f7('0x7')](_0xa9f7('0x14'),_0x36cfbe?util[_0xa9f7('0x6')](_0x36cfbe,{'showHidden':![],'depth':null}):'');return _0x230904(null);});}return _0x230904(null);});};exports['getUserByInterface']=function(_0x4a27de){return new BPromise(function(_0x5ccc53,_0x50b73c){if(_0x4a27de){return getUser({'interface':_0x4a27de})['then'](function(_0x4b7202){logger['info'](_0xa9f7('0x15'),_0x4a27de,_0x4b7202?'found':'notfound');return _0x5ccc53(_0x4b7202);})[_0xa9f7('0xb')](function(_0x530992){logger['error']('[utils][getUserByInterface]',_0x530992?util[_0xa9f7('0x6')](_0x530992,{'showHidden':![],'depth':null}):'');return _0x5ccc53(null);});}return _0x5ccc53(null);});};exports[_0xa9f7('0x16')]=function(_0x204cdb){return new BPromise(function(_0x537d55,_0x131872){if(_0x204cdb){return getUser({'name':_0x204cdb})[_0xa9f7('0x9')](function(_0x42d6b4){logger['info'](_0xa9f7('0x17'),_0x204cdb,_0x42d6b4?'found':_0xa9f7('0x18'));return _0x537d55(_0x42d6b4);})['catch'](function(_0x1bf651){logger[_0xa9f7('0x7')](_0xa9f7('0x19'),_0x1bf651?util[_0xa9f7('0x6')](_0x1bf651,{'showHidden':![],'depth':null}):'');return _0x537d55(null);});}return _0x537d55(null);});};exports['getVoiceQueueByName']=function(_0x41530a){return new BPromise(function(_0x249604,_0x16437e){if(_0x41530a){return client[_0xa9f7('0x8')](_0xa9f7('0x1a'),{'options':{'raw':!![],'attributes':['id',_0xa9f7('0xc'),_0xa9f7('0x1b'),_0xa9f7('0x1c'),'acwTimeout'],'where':{'name':_0x41530a},'limit':0x1}})['then'](function(_0x519aea){logger[_0xa9f7('0x5')](_0xa9f7('0x1d'),_0x41530a,_0x519aea?util['inspect'](_0x519aea,{'showHidden':![],'depth':null}):'');logger[_0xa9f7('0x11')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x41530a,_0x519aea?'found':'notfound');return _0x249604(_0x519aea[_0xa9f7('0xe')]['length']?_0x519aea[_0xa9f7('0xe')][0x0]:null);})[_0xa9f7('0xb')](function(_0x2058c5){logger[_0xa9f7('0x7')](_0xa9f7('0x1e'),_0x2058c5?util['inspect'](_0x2058c5,{'showHidden':![],'depth':null}):'');return _0x249604(null);});}return _0x249604(null);});};exports[_0xa9f7('0x1f')]=function(_0x1aabcd,_0x484e51){return moment(_0x1aabcd)[_0xa9f7('0x20')](_0x484e51,_0xa9f7('0x21'))['format'](_0xa9f7('0x22'));};exports[_0xa9f7('0x23')]=function(_0x10a856,_0x55f85f){return moment(_0x10a856)['subtract'](_0x55f85f,_0xa9f7('0x21'))[_0xa9f7('0x24')](_0xa9f7('0x22'));};exports[_0xa9f7('0x25')]=function(_0xdeeec2,_0x5df4d6){return moment(_0xdeeec2)[_0xa9f7('0x26')](moment(_0x5df4d6),_0xa9f7('0x21'));};exports[_0xa9f7('0x27')]=function(_0x5c9bef,_0x563619){return parseInt(_0x5c9bef,0xa)+parseInt(_0x563619,0xa);};exports[_0xa9f7('0x28')]=function(){return moment()['format'](_0xa9f7('0x22'));};exports[_0xa9f7('0x29')]=function(_0x2020a1,_0x30c089){if(_0x30c089){return moment(_0x2020a1)['isAfter'](_0x30c089);}return!![];};exports[_0xa9f7('0x2a')]=function(_0x31982d,_0x3b310e){if(_0x3b310e){return moment(_0x31982d)[_0xa9f7('0x2a')](_0x3b310e);}else if(_0x31982d){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 6ed93b3..a560d43 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd553=['/var','log','xcally','join','client','role','ensureDir','user','then','no-user','data','catch','error','api','auth','set','client-side-logger','use','logger','isEmpty','\x20body=%s','body','method','headers','x-forwarded-for','url','statusCode','responseTime','name','inspect','device','format','connection','remoteAddress','other','agent_id','agent_name','test','fs-extra','lodash','path','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0xd553,0x13a));var _0x3d55=function(_0x42bfb7,_0x25a3ec){_0x42bfb7=_0x42bfb7-0x0;var _0x5c497d=_0xd553[_0x42bfb7];return _0x5c497d;};var fs=require(_0x3d55('0x0'));var _=require(_0x3d55('0x1'));var ewinston=require('express-winston');var path=require(_0x3d55('0x2'));var util=require('util');var fileLogger=require(_0x3d55('0x3'))[_0x3d55('0x4')];var safeTemplate=require('./safe-template')[_0x3d55('0x5')];var maskSensitiveData=require(_0x3d55('0x6'))[_0x3d55('0x7')];function ClientSideLogger(){function _0x32beb1(_0x108c5a){var _0xb19d61=path['join'](_0x3d55('0x8'),_0x3d55('0x9'),_0x3d55('0xa'));var _0x146eb0=path[_0x3d55('0xb')](_0x3d55('0xc'),_0x108c5a[_0x3d55('0xd')]+'-'+_0x108c5a['name']);return fs[_0x3d55('0xe')](path[_0x3d55('0xb')](_0xb19d61,_0x146eb0))['then'](function(){var _0xd4dcb=fileLogger('client',path[_0x3d55('0xb')](_0xb19d61,_0x146eb0));return _0xd4dcb;})['catch'](function(_0x1c7d01){throw _0x1c7d01;});}this[_0x3d55('0x9')]=function(_0x359913,_0x1c89fd,_0x34e8a8,_0x141562){return _0x32beb1(_0x359913[_0x3d55('0xf')])[_0x3d55('0x10')](function(_0x4f8a99){var _0xdeb63c=_0x4f8a99[_0x1c89fd];return _0xdeb63c;})[_0x3d55('0x10')](function(_0x1c9fee){var _0x1eb151=_0x359913[_0x3d55('0xf')]?_0x359913['user']['id']:_0x3d55('0x11');var _0x40d79f=_0x141562[_0x3d55('0x12')];var _0x2e71d4=_0x141562['timestamp'];var _0x54eb99=new Date(Number(_0x2e71d4));return _0x1c9fee(_0x1eb151,_0x54eb99,_0x34e8a8,_0x40d79f);})[_0x3d55('0x13')](function(_0x2e025b){fileLogger('client')[_0x3d55('0x14')](_0x2e025b);});};}function setupLoggers(_0x1bf3a5){return new Promise(function(_0x1e0a43){var _0x95724d=new ClientSideLogger();var _0x58e767=fileLogger(_0x3d55('0x15'));var _0x1cc162=fileLogger(_0x3d55('0x16'));_0x1bf3a5[_0x3d55('0x17')](_0x3d55('0x18'),_0x95724d);_0x1bf3a5[_0x3d55('0x19')](ewinston[_0x3d55('0x1a')]({'winstonInstance':_0x58e767,'meta':![],'statusLevels':!![],'msg':function(_0x2661e6,_0x453a89){var _0x144662='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x3d55('0x1b')](_0x2661e6['body'])){_0x144662+=_0x3d55('0x1c');var _0x38d48c=_0x2661e6[_0x3d55('0x1d')];maskSensitiveData(_0x38d48c);}return safeTemplate(util['format'](_0x144662,_0x2661e6[_0x3d55('0x1e')],_0x2661e6[_0x3d55('0x1f')][_0x3d55('0x20')]?_0x2661e6['headers'][_0x3d55('0x20')]:_0x2661e6['connection']['remoteAddress']||_0x2661e6['ip'],_0x2661e6[_0x3d55('0x21')],_0x453a89[_0x3d55('0x22')],_0x453a89[_0x3d55('0x23')],_0x2661e6['user']?_0x2661e6['user']['id']:null,_0x2661e6['user']?_0x2661e6[_0x3d55('0xf')][_0x3d55('0x24')]:null,_0x2661e6['user']?_0x2661e6['user'][_0x3d55('0xd')]:null,_0x38d48c?util[_0x3d55('0x25')](_0x38d48c,![],null):''));}}));_0x1bf3a5[_0x3d55('0x19')](ewinston['logger']({'winstonInstance':_0x1cc162,'meta':![],'statusLevels':!![],'msg':function(_0x5204ca,_0x411426){var _0x288074='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x5204ca[_0x3d55('0x1d')]&&_0x5204ca['body'][_0x3d55('0x26')]&&_0x5204ca['body']['agent_id']){_0x288074='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3d55('0x27')](_0x288074,_0x5204ca[_0x3d55('0x1e')],_0x5204ca['headers'][_0x3d55('0x20')]?_0x5204ca['headers'][_0x3d55('0x20')]:_0x5204ca[_0x3d55('0x28')][_0x3d55('0x29')]||_0x5204ca['ip'],_0x5204ca[_0x3d55('0x21')],_0x411426['statusCode'],_0x411426[_0x3d55('0x23')],_0x5204ca[_0x3d55('0xf')]?_0x5204ca[_0x3d55('0xf')]['id']:null,_0x5204ca[_0x3d55('0xf')]?_0x5204ca[_0x3d55('0xf')]['name']:null,_0x5204ca[_0x3d55('0xf')]?_0x5204ca['user'][_0x3d55('0xd')]:null,_0x5204ca['body']&&_0x5204ca['body'][_0x3d55('0x26')]?_0x5204ca[_0x3d55('0x1d')][_0x3d55('0x26')]:_0x3d55('0x2a'),_0x5204ca[_0x3d55('0x1d')]&&_0x5204ca[_0x3d55('0x1d')][_0x3d55('0x2b')]?_0x5204ca[_0x3d55('0x1d')]['agent_id']:'',_0x5204ca['body']&&_0x5204ca[_0x3d55('0x1d')][_0x3d55('0x2c')]?_0x5204ca[_0x3d55('0x1d')]['agent_name']:'');},'ignoreRoute':function(_0x4423f0){var _0x5bbece=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5bbece[_0x3d55('0x2d')](_0x4423f0[_0x3d55('0x21')]);}}));return _0x1e0a43();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x393c=['other','agent_name','test','setupLoggers','fs-extra','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','name','client','log','user','then','no-user','data','timestamp','catch','error','api','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','role','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method'];(function(_0x10c88f,_0x2fa04e){var _0x5b92f3=function(_0x3bdd6a){while(--_0x3bdd6a){_0x10c88f['push'](_0x10c88f['shift']());}};_0x5b92f3(++_0x2fa04e);}(_0x393c,0x146));var _0xc393=function(_0x448bdd,_0x542303){_0x448bdd=_0x448bdd-0x0;var _0xc416c8=_0x393c[_0x448bdd];return _0xc416c8;};var fs=require(_0xc393('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require(_0xc393('0x1'));var fileLogger=require(_0xc393('0x2'))['fileLogger'];var safeTemplate=require(_0xc393('0x3'))[_0xc393('0x4')];var maskSensitiveData=require(_0xc393('0x5'))[_0xc393('0x6')];function ClientSideLogger(){function _0x4bc269(_0x26af50){var _0x1a5f9c=path[_0xc393('0x7')](_0xc393('0x8'),'log',_0xc393('0x9'));var _0x3346b4=path[_0xc393('0x7')]('client',_0x26af50['role']+'-'+_0x26af50[_0xc393('0xa')]);return fs['ensureDir'](path[_0xc393('0x7')](_0x1a5f9c,_0x3346b4))['then'](function(){var _0x24cc54=fileLogger(_0xc393('0xb'),path['join'](_0x1a5f9c,_0x3346b4));return _0x24cc54;})['catch'](function(_0x10c042){throw _0x10c042;});}this[_0xc393('0xc')]=function(_0x1c12b6,_0xe8672f,_0x49d6f0,_0x43dca0){return _0x4bc269(_0x1c12b6[_0xc393('0xd')])[_0xc393('0xe')](function(_0x19f819){var _0x29b628=_0x19f819[_0xe8672f];return _0x29b628;})[_0xc393('0xe')](function(_0x79d98){var _0x1d60dd=_0x1c12b6['user']?_0x1c12b6[_0xc393('0xd')]['id']:_0xc393('0xf');var _0x27124e=_0x43dca0[_0xc393('0x10')];var _0x5c86a4=_0x43dca0[_0xc393('0x11')];var _0x27ff25=new Date(Number(_0x5c86a4));return _0x79d98(_0x1d60dd,_0x27ff25,_0x49d6f0,_0x27124e);})[_0xc393('0x12')](function(_0x128901){fileLogger(_0xc393('0xb'))[_0xc393('0x13')](_0x128901);});};}function setupLoggers(_0x22e0cb){return new Promise(function(_0xea2a4f){var _0x5e04b6=new ClientSideLogger();var _0x4bc549=fileLogger(_0xc393('0x14'));var _0x19c5ec=fileLogger('auth');_0x22e0cb['set'](_0xc393('0x15'),_0x5e04b6);_0x22e0cb[_0xc393('0x16')](ewinston[_0xc393('0x17')]({'winstonInstance':_0x4bc549,'meta':![],'statusLevels':!![],'msg':function(_0x151886,_0x396dcc){var _0x12cd3a=_0xc393('0x18');if(!_[_0xc393('0x19')](_0x151886[_0xc393('0x1a')])){_0x12cd3a+=_0xc393('0x1b');var _0x1cee0c=_0x151886[_0xc393('0x1a')];maskSensitiveData(_0x1cee0c);}return safeTemplate(util[_0xc393('0x1c')](_0x12cd3a,_0x151886['method'],_0x151886['headers'][_0xc393('0x1d')]?_0x151886[_0xc393('0x1e')][_0xc393('0x1d')]:_0x151886[_0xc393('0x1f')][_0xc393('0x20')]||_0x151886['ip'],_0x151886[_0xc393('0x21')],_0x396dcc[_0xc393('0x22')],_0x396dcc[_0xc393('0x23')],_0x151886[_0xc393('0xd')]?_0x151886['user']['id']:null,_0x151886[_0xc393('0xd')]?_0x151886['user'][_0xc393('0xa')]:null,_0x151886[_0xc393('0xd')]?_0x151886[_0xc393('0xd')][_0xc393('0x24')]:null,_0x1cee0c?util[_0xc393('0x25')](_0x1cee0c,![],null):''));}}));_0x22e0cb[_0xc393('0x16')](ewinston[_0xc393('0x17')]({'winstonInstance':_0x19c5ec,'meta':![],'statusLevels':!![],'msg':function(_0x3966c7,_0x197694){var _0x88e3e2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x3966c7[_0xc393('0x1a')]&&_0x3966c7[_0xc393('0x1a')][_0xc393('0x26')]&&_0x3966c7[_0xc393('0x1a')][_0xc393('0x27')]){_0x88e3e2=_0xc393('0x28');}return util[_0xc393('0x1c')](_0x88e3e2,_0x3966c7[_0xc393('0x29')],_0x3966c7[_0xc393('0x1e')][_0xc393('0x1d')]?_0x3966c7[_0xc393('0x1e')][_0xc393('0x1d')]:_0x3966c7[_0xc393('0x1f')][_0xc393('0x20')]||_0x3966c7['ip'],_0x3966c7['url'],_0x197694[_0xc393('0x22')],_0x197694[_0xc393('0x23')],_0x3966c7[_0xc393('0xd')]?_0x3966c7[_0xc393('0xd')]['id']:null,_0x3966c7[_0xc393('0xd')]?_0x3966c7[_0xc393('0xd')]['name']:null,_0x3966c7[_0xc393('0xd')]?_0x3966c7[_0xc393('0xd')][_0xc393('0x24')]:null,_0x3966c7[_0xc393('0x1a')]&&_0x3966c7[_0xc393('0x1a')][_0xc393('0x26')]?_0x3966c7['body'][_0xc393('0x26')]:_0xc393('0x2a'),_0x3966c7['body']&&_0x3966c7[_0xc393('0x1a')][_0xc393('0x27')]?_0x3966c7[_0xc393('0x1a')][_0xc393('0x27')]:'',_0x3966c7['body']&&_0x3966c7['body'][_0xc393('0x2b')]?_0x3966c7['body'][_0xc393('0x2b')]:'');},'ignoreRoute':function(_0x392e9c){var _0x1601b1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1601b1[_0xc393('0x2c')](_0x392e9c[_0xc393('0x21')]);}}));return _0xea2a4f();});}exports[_0xc393('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 4568445..89bd106 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee8a=['padStart','iftime','source','join','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','test','isMoment','length'];(function(_0x708ec,_0x4d03a0){var _0x49fd4d=function(_0x568ec9){while(--_0x568ec9){_0x708ec['push'](_0x708ec['shift']());}};_0x49fd4d(++_0x4d03a0);}(_0xee8a,0x13a));var _0xaee8=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0xee8a[_0x28edda];return _0x21f4a4;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x161600){return _0x161600[_0xaee8('0x0')];})[_0xaee8('0x1')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0xaee8('0x2');function throwIfDateNotValid(_0x581084){if(!_0x581084[_0xaee8('0x3')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x365de2){var _0x39a37b=_0x365de2[_0xaee8('0x4')](':')[_0xaee8('0x5')](function(_0x2b6ab5){return parseInt(_0x2b6ab5,0xa);});var _0x106868=_0x39a37b[0x0];var _0x597c12=_0x39a37b[0x1];if(_0x106868<0x0||_0x106868>0x17||_0x597c12<0x0||_0x597c12>0x3b){throw new Error(EINVALID_DATE);}return[_0x106868,_0x597c12];}function circularDoWInterval(_0x8288ee,_0x20dded){if(_0x8288ee===_0x20dded){return[_0x8288ee];}else{var _0x276d42=moment[_0xaee8('0x6')]();moment[_0xaee8('0x6')]('en');var _0x54fc6f=moment[_0xaee8('0x7')]()[_0xaee8('0x5')](function(_0x3e0c22){return _0x3e0c22[_0xaee8('0x8')]();});moment[_0xaee8('0x6')](_0x276d42);var _0x429f99=_0x54fc6f[_0xaee8('0x9')](_0x8288ee);var _0x1e8a84=_0x54fc6f[_0xaee8('0x9')](_0x20dded);if(_0x1e8a84>_0x429f99){return _0x54fc6f['slice'](_0x429f99,_0x1e8a84+0x1);}else{var _0x43e3c2=_0x54fc6f[_0xaee8('0xa')](0x0,_0x1e8a84+0x1);var _0x2ce581=_0x54fc6f[_0xaee8('0xa')](_0x429f99);return _0x2ce581[_0xaee8('0xb')](_0x43e3c2);}}}module[_0xaee8('0xc')][_0xaee8('0xd')]=circularDoWInterval;function circularMonthInterval(_0x339207,_0x3189c6){if(_0x339207===_0x3189c6){return[_0x339207];}else{var _0x75df1=moment[_0xaee8('0x6')]();moment['locale']('en');var _0x4349a4=moment['monthsShort']()['map'](function(_0x394f53){return _0x394f53[_0xaee8('0x8')]();});moment[_0xaee8('0x6')](_0x75df1);var _0x37bd93=_0x4349a4[_0xaee8('0x9')](_0x339207);var _0x222edf=_0x4349a4[_0xaee8('0x9')](_0x3189c6);if(_0x222edf>_0x37bd93){return _0x4349a4[_0xaee8('0xa')](_0x37bd93,_0x222edf+0x1);}else{var _0x41a7ca=_0x4349a4[_0xaee8('0xa')](0x0,_0x222edf+0x1);var _0x3e429a=_0x4349a4[_0xaee8('0xa')](_0x37bd93);return _0x3e429a[_0xaee8('0xb')](_0x41a7ca);}}}module[_0xaee8('0xc')][_0xaee8('0xe')]=circularMonthInterval;function parseDom(_0x2156e9){var _0x33eafb=parseInt(_0x2156e9,0xa);if(_0x33eafb<0x1||_0x33eafb>0x1f){throw new Error(EINVALID_DATE);}return _0x33eafb;}function timeCompare(_0x2a0b42,_0x4e30d3,_0x51c900){var _0x268a62=_0x2a0b42['clone']();var _0x1a6620=extractTime(_0x4e30d3);var _0x3b41d7=_0x1a6620[0x0];var _0x3390c1=_0x1a6620[0x1];var _0x127cb5=_0x2a0b42[_0xaee8('0xf')]()[_0xaee8('0x10')](_0x3b41d7)[_0xaee8('0x11')](_0x3390c1);throwIfDateNotValid(_0x127cb5);var _0x8794e6=extractTime(_0x51c900);var _0x269e4a=_0x8794e6[0x0];var _0x512f9d=_0x8794e6[0x1];var _0x4bd08f=_0x2a0b42[_0xaee8('0xf')]()[_0xaee8('0x10')](_0x269e4a)['minutes'](_0x512f9d);throwIfDateNotValid(_0x4bd08f);if(_0x4bd08f[_0xaee8('0x12')](_0x127cb5)){var _0x4f42f2=_0x268a62['clone']()[_0xaee8('0x13')]('day');var _0x1d03e6=_0x268a62['clone']()['endOf'](_0xaee8('0x14'));return _0x268a62['isBetween'](_0x127cb5,_0x1d03e6,undefined,'[]')||_0x268a62[_0xaee8('0x15')](_0x4f42f2,_0x4bd08f,undefined,'[]');}else{return _0x268a62[_0xaee8('0x15')](_0x127cb5,_0x4bd08f,undefined,'[]');}}module[_0xaee8('0xc')][_0xaee8('0x16')]=timeCompare;function dowCompare(_0x4c3ae0,_0x10bebc,_0x29101b){var _0x107bf9=_0x4c3ae0['locale']('en')[_0xaee8('0x17')](_0xaee8('0x18'))[_0xaee8('0x8')]();return circularDoWInterval(_0x10bebc,_0x29101b)[_0xaee8('0x19')](_0x107bf9);}module[_0xaee8('0xc')][_0xaee8('0x1a')]=dowCompare;function domCompare(_0x1b4664,_0x7b9f53,_0x16abb2){var _0x2c1fb3=_0x1b4664[_0xaee8('0x1b')]();if(_0x7b9f53===_0x16abb2){return _0x2c1fb3===_0x7b9f53;}else{var _0x154454=_0x1b4664[_0xaee8('0x1c')]();var _0x116f4d=_0x7b9f53<_0x16abb2;let _0x19ac0a=![];var _0x3f367a=0x0;var _0x42e69d=0x0;if(_0x116f4d){_0x3f367a=Math[_0xaee8('0x1d')](0x1,_0x7b9f53);_0x42e69d=Math[_0xaee8('0x1e')](_0x16abb2,_0x154454);_0x19ac0a=_0x2c1fb3>=_0x3f367a&&_0x2c1fb3<=_0x42e69d;}else{_0x3f367a=Math[_0xaee8('0x1e')](_0x7b9f53,_0x154454);_0x42e69d=Math[_0xaee8('0x1d')](0x1,_0x16abb2);_0x19ac0a=_0x2c1fb3>=_0x3f367a||_0x2c1fb3<=_0x42e69d;}return _0x19ac0a;}}module[_0xaee8('0xc')][_0xaee8('0x1f')]=domCompare;function monthCompare(_0x3e7a0a,_0x8faab6,_0xa16ee0){var _0x3177ce=_0x3e7a0a[_0xaee8('0x6')]('en')[_0xaee8('0x17')](_0xaee8('0x20'))[_0xaee8('0x8')]();return circularMonthInterval(_0x8faab6,_0xa16ee0)[_0xaee8('0x19')](_0x3177ce);}module[_0xaee8('0xc')][_0xaee8('0x21')]=monthCompare;function iftime(_0x1a7e8a,_0x1db0fe=moment['tz']['guess'](),_0x59350e=moment()){if(!validateRx[_0xaee8('0x22')](_0x1a7e8a)){throw new Error(EINVALID_STRING);}else{var _0x11ccaa=(moment[_0xaee8('0x23')](_0x59350e)?_0x59350e[_0xaee8('0xf')]():moment(_0x59350e))['tz'](_0x1db0fe)[_0xaee8('0x6')]('en');throwIfDateNotValid(_0x11ccaa);var _0x228931=_0x1a7e8a['split'](',');var _0x561856=_0x228931[0x0];var _0x4ca35d=_0x228931[0x1];var _0x3e8627=_0x228931[0x2];var _0x557e75=_0x228931[0x3];let _0x127869=!![];if(_0x561856!=='*'){var _0x366f4f=_0x561856[_0xaee8('0x4')]('-');var _0x4f13f7=_['padStart'](_0x366f4f[0x0],0x5,'0');var _0x993194=_0x366f4f[_0xaee8('0x24')]===0x2?_[_0xaee8('0x25')](_0x366f4f[0x1],0x5,'0'):_0x4f13f7;_0x127869=timeCompare(_0x11ccaa,_0x4f13f7,_0x993194);}let _0x21c16f=!![];if(_0x4ca35d!=='*'){var _0x2abe73=_0x4ca35d[_0xaee8('0x4')]('-');var _0xd892a4=_0x2abe73[0x0];var _0x1e63c5=_0x2abe73[_0xaee8('0x24')]===0x2?_0x2abe73[0x1]:_0xd892a4;_0x21c16f=dowCompare(_0x11ccaa,_0xd892a4,_0x1e63c5);}let _0x1ee5fc=!![];if(_0x3e8627!=='*'){var _0x1674bd=_0x3e8627[_0xaee8('0x4')]('-');var _0x14b73b=parseDom(_0x1674bd[0x0]);var _0x450c61=_0x1674bd['length']===0x2?parseDom(_0x1674bd[0x1]):_0x14b73b;_0x1ee5fc=domCompare(_0x11ccaa,_0x14b73b,_0x450c61);}let _0x289cc8=!![];if(_0x557e75!=='*'){var _0x13c0f2=_0x557e75['split']('-');var _0x1fa9e1=_0x13c0f2[0x0];var _0x2e1dde=_0x13c0f2[_0xaee8('0x24')]===0x2?_0x13c0f2[0x1]:_0x13c0f2[0x0];_0x289cc8=monthCompare(_0x11ccaa,_0x1fa9e1,_0x2e1dde);}return _0x127869&&_0x21c16f&&_0x1ee5fc&&_0x289cc8;}}module[_0xaee8('0xc')][_0xaee8('0x26')]=iftime; \ No newline at end of file +var _0xf6bd=['locale','weekdaysShort','toLowerCase','indexOf','concat','exports','circularDoWInterval','monthsShort','slice','circularMonthInterval','clone','hours','minutes','isBefore','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','map'];(function(_0x58347e,_0x2c6409){var _0x493ca6=function(_0x8b3a4c){while(--_0x8b3a4c){_0x58347e['push'](_0x58347e['shift']());}};_0x493ca6(++_0x2c6409);}(_0xf6bd,0x1bc));var _0xdf6b=function(_0xadc7d9,_0x203608){_0xadc7d9=_0xadc7d9-0x0;var _0x915ca1=_0xf6bd[_0xadc7d9];return _0x915ca1;};var _=require(_0xdf6b('0x0'));var moment=require(_0xdf6b('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0xd97e77){return _0xd97e77['source'];})[_0xdf6b('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xdf6b('0x3');var EINVALID_DATE=_0xdf6b('0x4');function throwIfDateNotValid(_0x149f2a){if(!_0x149f2a[_0xdf6b('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x10a2df){var _0x8c2fe6=_0x10a2df['split'](':')[_0xdf6b('0x6')](function(_0x1b20ea){return parseInt(_0x1b20ea,0xa);});var _0x318d12=_0x8c2fe6[0x0];var _0x1fa719=_0x8c2fe6[0x1];if(_0x318d12<0x0||_0x318d12>0x17||_0x1fa719<0x0||_0x1fa719>0x3b){throw new Error(EINVALID_DATE);}return[_0x318d12,_0x1fa719];}function circularDoWInterval(_0xcbc7ce,_0x156e0a){if(_0xcbc7ce===_0x156e0a){return[_0xcbc7ce];}else{var _0x5588e5=moment[_0xdf6b('0x7')]();moment[_0xdf6b('0x7')]('en');var _0x32c01b=moment[_0xdf6b('0x8')]()[_0xdf6b('0x6')](function(_0xa86973){return _0xa86973[_0xdf6b('0x9')]();});moment[_0xdf6b('0x7')](_0x5588e5);var _0x361b8a=_0x32c01b[_0xdf6b('0xa')](_0xcbc7ce);var _0x4770b7=_0x32c01b['indexOf'](_0x156e0a);if(_0x4770b7>_0x361b8a){return _0x32c01b['slice'](_0x361b8a,_0x4770b7+0x1);}else{var _0x28ba96=_0x32c01b['slice'](0x0,_0x4770b7+0x1);var _0x4128b9=_0x32c01b['slice'](_0x361b8a);return _0x4128b9[_0xdf6b('0xb')](_0x28ba96);}}}module[_0xdf6b('0xc')][_0xdf6b('0xd')]=circularDoWInterval;function circularMonthInterval(_0x5c13cb,_0x2c1e95){if(_0x5c13cb===_0x2c1e95){return[_0x5c13cb];}else{var _0x2ed8c9=moment[_0xdf6b('0x7')]();moment[_0xdf6b('0x7')]('en');var _0x47c07c=moment[_0xdf6b('0xe')]()[_0xdf6b('0x6')](function(_0x4e141c){return _0x4e141c[_0xdf6b('0x9')]();});moment[_0xdf6b('0x7')](_0x2ed8c9);var _0x6629b2=_0x47c07c[_0xdf6b('0xa')](_0x5c13cb);var _0x3a21d4=_0x47c07c[_0xdf6b('0xa')](_0x2c1e95);if(_0x3a21d4>_0x6629b2){return _0x47c07c[_0xdf6b('0xf')](_0x6629b2,_0x3a21d4+0x1);}else{var _0x2b257=_0x47c07c[_0xdf6b('0xf')](0x0,_0x3a21d4+0x1);var _0xe5ffdb=_0x47c07c[_0xdf6b('0xf')](_0x6629b2);return _0xe5ffdb[_0xdf6b('0xb')](_0x2b257);}}}module['exports'][_0xdf6b('0x10')]=circularMonthInterval;function parseDom(_0x4866b8){var _0x13bd66=parseInt(_0x4866b8,0xa);if(_0x13bd66<0x1||_0x13bd66>0x1f){throw new Error(EINVALID_DATE);}return _0x13bd66;}function timeCompare(_0x390b4b,_0x3c4324,_0x5b9926){var _0x1c9e39=_0x390b4b['clone']();var _0xba67c1=extractTime(_0x3c4324);var _0x213d0a=_0xba67c1[0x0];var _0x5d134d=_0xba67c1[0x1];var _0x4084b9=_0x390b4b[_0xdf6b('0x11')]()[_0xdf6b('0x12')](_0x213d0a)[_0xdf6b('0x13')](_0x5d134d);throwIfDateNotValid(_0x4084b9);var _0x4a257c=extractTime(_0x5b9926);var _0x40e5bd=_0x4a257c[0x0];var _0x5d8437=_0x4a257c[0x1];var _0x103521=_0x390b4b[_0xdf6b('0x11')]()[_0xdf6b('0x12')](_0x40e5bd)[_0xdf6b('0x13')](_0x5d8437);throwIfDateNotValid(_0x103521);if(_0x103521[_0xdf6b('0x14')](_0x4084b9)){var _0x5c017a=_0x1c9e39['clone']()['startOf'](_0xdf6b('0x15'));var _0x53b1dc=_0x1c9e39[_0xdf6b('0x11')]()[_0xdf6b('0x16')](_0xdf6b('0x15'));return _0x1c9e39[_0xdf6b('0x17')](_0x4084b9,_0x53b1dc,undefined,'[]')||_0x1c9e39['isBetween'](_0x5c017a,_0x103521,undefined,'[]');}else{return _0x1c9e39['isBetween'](_0x4084b9,_0x103521,undefined,'[]');}}module[_0xdf6b('0xc')][_0xdf6b('0x18')]=timeCompare;function dowCompare(_0x3533d6,_0x2e7ace,_0x4209bf){var _0x2171a5=_0x3533d6[_0xdf6b('0x7')]('en')[_0xdf6b('0x19')](_0xdf6b('0x1a'))[_0xdf6b('0x9')]();return circularDoWInterval(_0x2e7ace,_0x4209bf)[_0xdf6b('0x1b')](_0x2171a5);}module['exports'][_0xdf6b('0x1c')]=dowCompare;function domCompare(_0x7daaca,_0x511bc9,_0xf599a7){var _0x4f7ae2=_0x7daaca[_0xdf6b('0x1d')]();if(_0x511bc9===_0xf599a7){return _0x4f7ae2===_0x511bc9;}else{var _0x35b6e1=_0x7daaca[_0xdf6b('0x1e')]();var _0x71c29=_0x511bc9<_0xf599a7;let _0x5b0075=![];var _0x3a93f6=0x0;var _0x338650=0x0;if(_0x71c29){_0x3a93f6=Math[_0xdf6b('0x1f')](0x1,_0x511bc9);_0x338650=Math['min'](_0xf599a7,_0x35b6e1);_0x5b0075=_0x4f7ae2>=_0x3a93f6&&_0x4f7ae2<=_0x338650;}else{_0x3a93f6=Math[_0xdf6b('0x20')](_0x511bc9,_0x35b6e1);_0x338650=Math[_0xdf6b('0x1f')](0x1,_0xf599a7);_0x5b0075=_0x4f7ae2>=_0x3a93f6||_0x4f7ae2<=_0x338650;}return _0x5b0075;}}module[_0xdf6b('0xc')][_0xdf6b('0x21')]=domCompare;function monthCompare(_0x3f4495,_0x168306,_0x9b9b1a){var _0x882b76=_0x3f4495['locale']('en')[_0xdf6b('0x19')]('MMM')[_0xdf6b('0x9')]();return circularMonthInterval(_0x168306,_0x9b9b1a)[_0xdf6b('0x1b')](_0x882b76);}module['exports'][_0xdf6b('0x22')]=monthCompare;function iftime(_0x3d4d40,_0x338bcb=moment['tz']['guess'](),_0x595e20=moment()){if(!validateRx[_0xdf6b('0x23')](_0x3d4d40)){throw new Error(EINVALID_STRING);}else{var _0x2ec5bc=(moment[_0xdf6b('0x24')](_0x595e20)?_0x595e20[_0xdf6b('0x11')]():moment(_0x595e20))['tz'](_0x338bcb)[_0xdf6b('0x7')]('en');throwIfDateNotValid(_0x2ec5bc);var _0x466a41=_0x3d4d40[_0xdf6b('0x25')](',');var _0x18b490=_0x466a41[0x0];var _0x42266b=_0x466a41[0x1];var _0x81b914=_0x466a41[0x2];var _0x3452be=_0x466a41[0x3];let _0x195491=!![];if(_0x18b490!=='*'){var _0x2445b0=_0x18b490[_0xdf6b('0x25')]('-');var _0x582b2a=_[_0xdf6b('0x26')](_0x2445b0[0x0],0x5,'0');var _0x7689f8=_0x2445b0[_0xdf6b('0x27')]===0x2?_[_0xdf6b('0x26')](_0x2445b0[0x1],0x5,'0'):_0x582b2a;_0x195491=timeCompare(_0x2ec5bc,_0x582b2a,_0x7689f8);}let _0x1e06a9=!![];if(_0x42266b!=='*'){var _0x38ac86=_0x42266b[_0xdf6b('0x25')]('-');var _0x1df0f1=_0x38ac86[0x0];var _0x1b19b6=_0x38ac86[_0xdf6b('0x27')]===0x2?_0x38ac86[0x1]:_0x1df0f1;_0x1e06a9=dowCompare(_0x2ec5bc,_0x1df0f1,_0x1b19b6);}let _0x8d6250=!![];if(_0x81b914!=='*'){var _0x3d296f=_0x81b914[_0xdf6b('0x25')]('-');var _0x4821da=parseDom(_0x3d296f[0x0]);var _0x41658c=_0x3d296f[_0xdf6b('0x27')]===0x2?parseDom(_0x3d296f[0x1]):_0x4821da;_0x8d6250=domCompare(_0x2ec5bc,_0x4821da,_0x41658c);}let _0x3bb983=!![];if(_0x3452be!=='*'){var _0x4aa10c=_0x3452be[_0xdf6b('0x25')]('-');var _0x2a0cc1=_0x4aa10c[0x0];var _0x1084f7=_0x4aa10c[_0xdf6b('0x27')]===0x2?_0x4aa10c[0x1]:_0x4aa10c[0x0];_0x3bb983=monthCompare(_0x2ec5bc,_0x2a0cc1,_0x1084f7);}return _0x195491&&_0x1e06a9&&_0x8d6250&&_0x3bb983;}}module[_0xdf6b('0xc')][_0xdf6b('0x28')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 5ac9315..9be68e7 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8344=['toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','warn','File','error','%s-%s','Console','consoleLogger','fileLogger','moment','winston','debugLevel'];(function(_0x148316,_0x6c9dc){var _0xdbe95d=function(_0x138a9f){while(--_0x138a9f){_0x148316['push'](_0x148316['shift']());}};_0xdbe95d(++_0x6c9dc);}(_0x8344,0xf9));var _0x4834=function(_0x4656a0,_0x84588c){_0x4656a0=_0x4656a0-0x0;var _0x122619=_0x8344[_0x4656a0];return _0x122619;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x4834('0x0'));var winston=require(_0x4834('0x1'));var config=require('../config/environment');var debugLevel=config[_0x4834('0x2')]?config['debugLevel'][_0x4834('0x3')]():_0x4834('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x4834('0x5'),'error':_0x4834('0x6'),'warn':_0x4834('0x7'),'info':_0x4834('0x8'),'print':'bold\x20white','success':_0x4834('0x9'),'http':'gray','verbose':_0x4834('0xa'),'debug':_0x4834('0xb'),'silly':_0x4834('0xc')};winston[_0x4834('0xd')](XC_LOG_COLORS);function getLogFileName(_0x1d0428,_0x132850,_0x5cfc66){var _0x4b714a=_0x1d0428||_0x4834('0xe');return path[_0x4834('0xf')](_0x4b714a,util[_0x4834('0x10')]('%s-%s.log',_0x132850,_0x5cfc66));}function formatter(_0x3294bd,_0x480e12){_0x480e12[_0x4834('0x11')]=_0x480e12[_0x4834('0x11')][_0x4834('0x12')](/@@{/g,_0x4834('0x13'))['replace'](/}@@/g,_0x4834('0x14'))[_0x4834('0x12')](/@{/g,'{{')[_0x4834('0x12')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x4834('0x10')](_0x4834('0x15')),_0x480e12[_0x4834('0x16')][_0x4834('0x17')](),_0x3294bd,_0x480e12[_0x4834('0x11')]);}function fileFormat(_0x4b938d,_0x18ff18){_0x18ff18[_0x4834('0x11')]=_0x18ff18[_0x4834('0x11')][_0x4834('0x12')](/@@{/g,_0x4834('0x13'))[_0x4834('0x12')](/}@@/g,'}}}')[_0x4834('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x145db0=_0x18ff18[_0x4834('0x18')]&&Object[_0x4834('0x19')](_0x18ff18['meta'])['length']?'\x0a\x09'+JSON['stringify'](_0x18ff18['meta']):'';return util[_0x4834('0x10')](_0x4834('0x1a'),moment()[_0x4834('0x10')](_0x4834('0x15')),_0x18ff18[_0x4834('0x16')][_0x4834('0x17')](),_0x4b938d,_0x18ff18[_0x4834('0x11')],_0x145db0);}function consoleLogger(){var _0x2d4a96=new winston[(_0x4834('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4834('0x1c'))]['Console']({'level':_0x4834('0x1d'),'json':![],'formatter':function(_0x5ace2a){return formatter('',_0x5ace2a);}})]});return _0x2d4a96;}function fileLogger(_0x251059,_0x13bbe7){var _0x420db2=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4834('0x1c'))][(_0x4834('0x1e'))]({'name':util[_0x4834('0x10')]('%s-%s',_0x251059,'error'),'filename':getLogFileName(_0x13bbe7,_0x251059,'error'),'level':_0x4834('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4814d1){return fileFormat(_0x251059,_0x4814d1);}}),new winston[(_0x4834('0x1c'))]['File']({'name':util[_0x4834('0x10')](_0x4834('0x20'),_0x251059,debugLevel),'filename':getLogFileName(_0x13bbe7,_0x251059,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3f57a3){return fileFormat(_0x251059,_0x3f57a3);}}),new winston[(_0x4834('0x1c'))][(_0x4834('0x21'))]({'level':_0x4834('0x1d'),'json':![],'formatter':function(_0x2d010e){return fileFormat(_0x251059,_0x2d010e);}})]});return _0x420db2;}exports[_0x4834('0x22')]=consoleLogger;exports[_0x4834('0x23')]=fileLogger; \ No newline at end of file +var _0xd31b=['red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','warn','%s-%s','error','File','Console','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white'];(function(_0x15cb8f,_0x4e20a5){var _0x48d892=function(_0x45a97a){while(--_0x45a97a){_0x15cb8f['push'](_0x15cb8f['shift']());}};_0x48d892(++_0x4e20a5);}(_0xd31b,0xbb));var _0xbd31=function(_0x4ca731,_0x3d9665){_0x4ca731=_0x4ca731-0x0;var _0x1fd0a1=_0xd31b[_0x4ca731];return _0x1fd0a1;};'use strict';var path=require(_0xbd31('0x0'));var util=require('util');var moment=require(_0xbd31('0x1'));var winston=require(_0xbd31('0x2'));var config=require(_0xbd31('0x3'));var debugLevel=config[_0xbd31('0x4')]?config['debugLevel'][_0xbd31('0x5')]():_0xbd31('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xbd31('0x7'),'error':_0xbd31('0x8'),'warn':_0xbd31('0x9'),'info':'white','print':_0xbd31('0xa'),'success':_0xbd31('0xb'),'http':_0xbd31('0xc'),'verbose':_0xbd31('0xd'),'debug':_0xbd31('0xe'),'silly':_0xbd31('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x38400b,_0x50c00c,_0x230b57){var _0x3a5a90=_0x38400b||_0xbd31('0x10');return path[_0xbd31('0x11')](_0x3a5a90,util[_0xbd31('0x12')](_0xbd31('0x13'),_0x50c00c,_0x230b57));}function formatter(_0x52c13d,_0x58736e){_0x58736e['message']=_0x58736e['message'][_0xbd31('0x14')](/@@{/g,_0xbd31('0x15'))[_0xbd31('0x14')](/}@@/g,'}}}')[_0xbd31('0x14')](/@{/g,'{{')[_0xbd31('0x14')](/}@/g,'}}');return util['format'](_0xbd31('0x16'),moment()[_0xbd31('0x12')](_0xbd31('0x17')),_0x58736e['level'][_0xbd31('0x18')](),_0x52c13d,_0x58736e[_0xbd31('0x19')]);}function fileFormat(_0x475b36,_0xfbbb01){_0xfbbb01[_0xbd31('0x19')]=_0xfbbb01[_0xbd31('0x19')][_0xbd31('0x14')](/@@{/g,'{{{')[_0xbd31('0x14')](/}@@/g,'}}}')[_0xbd31('0x14')](/@{/g,'{{')[_0xbd31('0x14')](/}@/g,'}}');var _0x4f4fd9=_0xfbbb01[_0xbd31('0x1a')]&&Object['keys'](_0xfbbb01[_0xbd31('0x1a')])[_0xbd31('0x1b')]?'\x0a\x09'+JSON['stringify'](_0xfbbb01['meta']):'';return util[_0xbd31('0x12')](_0xbd31('0x1c'),moment()['format'](_0xbd31('0x17')),_0xfbbb01[_0xbd31('0x1d')][_0xbd31('0x18')](),_0x475b36,_0xfbbb01[_0xbd31('0x19')],_0x4f4fd9);}function consoleLogger(){var _0x2737f0=new winston[(_0xbd31('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd31('0x1f'))]['Console']({'level':_0xbd31('0x20'),'json':![],'formatter':function(_0x2b77ed){return formatter('',_0x2b77ed);}})]});return _0x2737f0;}function fileLogger(_0x157711,_0x3768a5){var _0x1fc1b5=new winston[(_0xbd31('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xbd31('0x12')](_0xbd31('0x21'),_0x157711,_0xbd31('0x22')),'filename':getLogFileName(_0x3768a5,_0x157711,'error'),'level':_0xbd31('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a4ca7){return fileFormat(_0x157711,_0x4a4ca7);}}),new winston[(_0xbd31('0x1f'))][(_0xbd31('0x23'))]({'name':util[_0xbd31('0x12')](_0xbd31('0x21'),_0x157711,debugLevel),'filename':getLogFileName(_0x3768a5,_0x157711,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a9488){return fileFormat(_0x157711,_0x4a9488);}}),new winston[(_0xbd31('0x1f'))][(_0xbd31('0x24'))]({'level':_0xbd31('0x20'),'json':![],'formatter':function(_0xb2322f){return fileFormat(_0x157711,_0xb2322f);}})]});return _0x1fc1b5;}exports[_0xbd31('0x25')]=consoleLogger;exports[_0xbd31('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 9916b8b..5d017cc 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x262fb1,_0x54d50d){var _0x39c238=function(_0x32fa66){while(--_0x32fa66){_0x262fb1['push'](_0x262fb1['shift']());}};_0x39c238(++_0x54d50d);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c3a76,_0x5841eb){_0x1c3a76=_0x1c3a76-0x0;var _0x590278=_0x2ef3[_0x1c3a76];return _0x590278;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdb28,0x106));var _0x8db2=function(_0x18c162,_0x5af010){_0x18c162=_0x18c162-0x0;var _0x20b98e=_0xdb28[_0x18c162];return _0x20b98e;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 609d402..585952b 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e3f=['reduce','exports','safeTemplate','lodash','{\x20{\x20','string','isArray','map','isPlainObject','keys'];(function(_0xd14c63,_0x3a303b){var _0x3a29e3=function(_0x567415){while(--_0x567415){_0xd14c63['push'](_0xd14c63['shift']());}};_0x3a29e3(++_0x3a303b);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};var _=require(_0xf8e3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42db69){return _0x42db69==='{{'?_0xf8e3('0x1'):'\x20}\x20}';}function safeTemplate(_0x3f3440){var _0x292de5=_0x3f3440;if(typeof _0x3f3440===_0xf8e3('0x2')){_0x292de5=_0x3f3440['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xf8e3('0x3')](_0x3f3440)){_0x292de5=_0x3f3440[_0xf8e3('0x4')](function(_0x4dab56){return safeTemplate(_0x4dab56);});}else if(_[_0xf8e3('0x5')](_0x3f3440)){_0x292de5=Object[_0xf8e3('0x6')](_0x3f3440)[_0xf8e3('0x7')](function(_0x1ee9f3,_0x4e9e57){_0x1ee9f3[_0x4e9e57]=safeTemplate(_0x3f3440[_0x4e9e57]);return _0x1ee9f3;},{});}return _0x292de5;}module[_0xf8e3('0x8')][_0xf8e3('0x9')]=safeTemplate; \ No newline at end of file +var _0x757a=['isArray','map','isPlainObject','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x335a97,_0x5e18d1){var _0x5e608a=function(_0x41ae5f){while(--_0x41ae5f){_0x335a97['push'](_0x335a97['shift']());}};_0x5e608a(++_0x5e18d1);}(_0x757a,0xde));var _0xa757=function(_0x84a13f,_0x47bc61){_0x84a13f=_0x84a13f-0x0;var _0x2aa552=_0x757a[_0x84a13f];return _0x2aa552;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24afaf){return _0x24afaf==='{{'?_0xa757('0x0'):'\x20}\x20}';}function safeTemplate(_0x5c03c3){var _0x5709ed=_0x5c03c3;if(typeof _0x5c03c3===_0xa757('0x1')){_0x5709ed=_0x5c03c3[_0xa757('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa757('0x3')](_0x5c03c3)){_0x5709ed=_0x5c03c3[_0xa757('0x4')](function(_0x32630d){return safeTemplate(_0x32630d);});}else if(_[_0xa757('0x5')](_0x5c03c3)){_0x5709ed=Object['keys'](_0x5c03c3)[_0xa757('0x6')](function(_0x4343b6,_0x53be0e){_0x4343b6[_0x53be0e]=safeTemplate(_0x5c03c3[_0x53be0e]);return _0x4343b6;},{});}return _0x5709ed;}module[_0xa757('0x7')][_0xa757('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 27fab8f..b139a3e 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefdc=['path','../config/environment','root','resolve','isArray','apps','findIndex','env','NODE_PATH','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra'];(function(_0x329ff8,_0x2c0907){var _0x27f260=function(_0x367dc7){while(--_0x367dc7){_0x329ff8['push'](_0x329ff8['shift']());}};_0x27f260(++_0x2c0907);}(_0xefdc,0x18b));var _0xcefd=function(_0x1dcf37,_0x150062){_0x1dcf37=_0x1dcf37-0x0;var _0x4323ea=_0xefdc[_0x1dcf37];return _0x4323ea;};var fs=require(_0xcefd('0x0'));var path=require(_0xcefd('0x1'));var config=require(_0xcefd('0x2'));var root=config[_0xcefd('0x3')];var APP_JSON_PATH=path[_0xcefd('0x4')](root,'server/app.json');var NODEPATH=path[_0xcefd('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x2846d2){let _0x424a00=![];if(Array[_0xcefd('0x5')](_0x2846d2[_0xcefd('0x6')])){var _0x196697=_0x2846d2['apps'][_0xcefd('0x7')](function(_0x5989db){return _0x5989db['name']==='motion2';});if(_0x196697>-0x1){var _0x3b6484=_0x2846d2[_0xcefd('0x6')][_0x196697];if(typeof _0x3b6484[_0xcefd('0x8')][_0xcefd('0x9')]!=='string'){_0x3b6484[_0xcefd('0x8')][_0xcefd('0x9')]=NODEPATH;_0x424a00=!![];}}return{'appConfig':_0x2846d2,'updated':_0x424a00};}}function updateAppConfig(_0x71e565){return fs[_0xcefd('0xa')](APP_JSON_PATH)[_0xcefd('0xb')](function(_0x355062){if(_0x355062){return fs[_0xcefd('0xc')](APP_JSON_PATH)['then'](function(_0x8004b2){var _0x2750a6=setLegacyLibsNodeEnvPath(_0x8004b2);if(_0x2750a6[_0xcefd('0xd')]){_0x71e565[_0xcefd('0xe')](_0xcefd('0xf'));return fs[_0xcefd('0x10')](APP_JSON_PATH,_0x8004b2,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xcefd('0x4')]();}});}module[_0xcefd('0x11')]=updateAppConfig; \ No newline at end of file +var _0x0d67=['resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','pathExists','then','readJSON','updated','Updating\x20app.json','writeJSON','fs-extra','path','../config/environment','root'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x0d67,0xf8));var _0x70d6=function(_0x412668,_0x25beb1){_0x412668=_0x412668-0x0;var _0x140488=_0x0d67[_0x412668];return _0x140488;};var fs=require(_0x70d6('0x0'));var path=require(_0x70d6('0x1'));var config=require(_0x70d6('0x2'));var root=config[_0x70d6('0x3')];var APP_JSON_PATH=path[_0x70d6('0x4')](root,_0x70d6('0x5'));var NODEPATH=path['resolve'](root,_0x70d6('0x6'));function setLegacyLibsNodeEnvPath(_0xd5fcb6){let _0x2633a5=![];if(Array[_0x70d6('0x7')](_0xd5fcb6[_0x70d6('0x8')])){var _0xde69a1=_0xd5fcb6[_0x70d6('0x8')][_0x70d6('0x9')](function(_0x5c5cd8){return _0x5c5cd8[_0x70d6('0xa')]===_0x70d6('0xb');});if(_0xde69a1>-0x1){var _0xd929b5=_0xd5fcb6[_0x70d6('0x8')][_0xde69a1];if(typeof _0xd929b5['env'][_0x70d6('0xc')]!==_0x70d6('0xd')){_0xd929b5[_0x70d6('0xe')][_0x70d6('0xc')]=NODEPATH;_0x2633a5=!![];}}return{'appConfig':_0xd5fcb6,'updated':_0x2633a5};}}function updateAppConfig(_0x56e658){return fs[_0x70d6('0xf')](APP_JSON_PATH)[_0x70d6('0x10')](function(_0x1e1c56){if(_0x1e1c56){return fs[_0x70d6('0x11')](APP_JSON_PATH)[_0x70d6('0x10')](function(_0x560cf9){var _0x2a7ebd=setLegacyLibsNodeEnvPath(_0x560cf9);if(_0x2a7ebd[_0x70d6('0x12')]){_0x56e658['info'](_0x70d6('0x13'));return fs[_0x70d6('0x14')](APP_JSON_PATH,_0x560cf9,{'spaces':0x2});}else{return Promise[_0x70d6('0x4')]();}});}else{return Promise[_0x70d6('0x4')]();}});}module['exports']=updateAppConfig; \ No newline at end of file